From: support Date: Tue, 10 Jan 2023 13:15:35 +0000 (+0000) Subject: Built motion from commit 9e1ec266.|2.6.28 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=d733a3b773bb4bd91844c1a9de788a984eda9df2;p=motion2.git Built motion from commit 9e1ec266.|2.6.28 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 17dee92..530d747 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-10T10:07:17.295Z", + "time": "2023-01-10T13:06:36.497Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 813bb80..40eaec8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-10T10:07:17.295Z", + "time": "2023-01-10T13:06:36.497Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 0b88d18..34dc741 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 _0x683f=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','action','integration','motionbar','jscripty','urlForward','bot','script'];(function(_0x16bfeb,_0x20684f){var _0x4da8a7=function(_0x34e70d){while(--_0x34e70d){_0x16bfeb['push'](_0x16bfeb['shift']());}};_0x4da8a7(++_0x20684f);}(_0x683f,0x18e));var _0xf683=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x683f[_0x35a274];return _0x40d905;};'use strict';var Sequelize=require(_0xf683('0x0'));module[_0xf683('0x1')]={'name':{'type':Sequelize[_0xf683('0x2')],'get':function(_0x448e3f){return this['getDataValue'](_0xf683('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xf683('0x4'),_0xf683('0x5'),_0xf683('0x6'),_0xf683('0x7'),'browser',_0xf683('0x8'),_0xf683('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xf683('0xa')},'data1':{'type':Sequelize[_0xf683('0xb')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xf683('0xb')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xf683('0xb')](0x1000),'comment':_0xf683('0xc')},'data4':{'type':Sequelize[_0xf683('0xb')](0x1000),'comments':_0xf683('0xd')},'data5':{'type':Sequelize[_0xf683('0xb')](0x1000),'comments':_0xf683('0xe')},'data6':{'type':Sequelize[_0xf683('0xb')],'comments':_0xf683('0xf')},'data7':{'type':Sequelize[_0xf683('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xb235=['getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0xfc98bf,_0x1efed4){var _0x295f51=function(_0x5e7cd5){while(--_0x5e7cd5){_0xfc98bf['push'](_0xfc98bf['shift']());}};_0x295f51(++_0x1efed4);}(_0xb235,0x6b));var _0x5b23=function(_0xbcea1,_0x469f9f){_0xbcea1=_0xbcea1-0x0;var _0x17fb47=_0xb235[_0xbcea1];return _0x17fb47;};'use strict';var Sequelize=require(_0x5b23('0x0'));module[_0x5b23('0x1')]={'name':{'type':Sequelize[_0x5b23('0x2')],'get':function(_0x3bf3dd){return this[_0x5b23('0x3')](_0x5b23('0x4'));}},'action':{'type':Sequelize[_0x5b23('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5b23('0x6'),_0x5b23('0x7'),_0x5b23('0x8'),_0x5b23('0x9'),_0x5b23('0xa'),_0x5b23('0xb'),_0x5b23('0xc'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x5b23('0xd')},'data1':{'type':Sequelize[_0x5b23('0x5')](0x1000),'comment':_0x5b23('0xe')},'data2':{'type':Sequelize[_0x5b23('0x5')](0x1000),'comment':_0x5b23('0xf')},'data3':{'type':Sequelize[_0x5b23('0x5')](0x1000),'comment':_0x5b23('0x10')},'data4':{'type':Sequelize[_0x5b23('0x5')](0x1000),'comments':_0x5b23('0x11')},'data5':{'type':Sequelize[_0x5b23('0x5')](0x1000),'comments':_0x5b23('0x12')},'data6':{'type':Sequelize[_0x5b23('0x5')],'comments':_0x5b23('0x13')},'data7':{'type':Sequelize[_0x5b23('0x14')],'comments':_0x5b23('0x15')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b144405..0e84c8e 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 _0x7203=['update','then','destroy','stack','name','send','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7203,0x138));var _0x3720=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0x7203[_0x3ff0f0];return _0x5dc82a;};'use strict';var emlformat=require(_0x3720('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3720('0x1'));var jsonpatch=require(_0x3720('0x2'));var rp=require(_0x3720('0x3'));var moment=require('moment');var BPromise=require(_0x3720('0x4'));var Mustache=require(_0x3720('0x5'));var util=require(_0x3720('0x6'));var path=require(_0x3720('0x7'));var sox=require('sox');var csv=require(_0x3720('0x8'));var ejs=require(_0x3720('0x9'));var fs=require('fs');var fs_extra=require(_0x3720('0xa'));var _=require(_0x3720('0xb'));var squel=require('squel');var crypto=require(_0x3720('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3720('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3720('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3720('0xe'));var as=require(_0x3720('0xf'));var hardwareService=require(_0x3720('0x10'));var logger=require(_0x3720('0x11'))(_0x3720('0x12'));var utils=require(_0x3720('0x13'));var config=require(_0x3720('0x14'));var licenseUtil=require(_0x3720('0x15'));var db=require(_0x3720('0x16'))['db'];function respondWithStatusCode(_0x19aa3c,_0x4c7b08){_0x4c7b08=_0x4c7b08||0xcc;return function(_0x39b77d){if(_0x39b77d){return _0x19aa3c[_0x3720('0x17')](_0x4c7b08);}return _0x19aa3c[_0x3720('0x18')](_0x4c7b08)[_0x3720('0x19')]();};}function respondWithResult(_0x52b449,_0xd0578f){_0xd0578f=_0xd0578f||0xc8;return function(_0x595240){if(_0x595240){return _0x52b449[_0x3720('0x18')](_0xd0578f)[_0x3720('0x1a')](_0x595240);}};}function respondWithFilteredResult(_0x29d369,_0x13d164){return function(_0x598663){if(_0x598663){var _0x5b1ff0=typeof _0x13d164[_0x3720('0x1b')]===_0x3720('0x1c')&&typeof _0x13d164[_0x3720('0x1d')]===_0x3720('0x1c');var _0x214d85=_0x598663['count'];var _0x41de72=_0x5b1ff0?0x0:_0x13d164[_0x3720('0x1b')];var _0x29efb9=_0x5b1ff0?_0x598663['count']:_0x13d164['offset']+_0x13d164[_0x3720('0x1d')];var _0x3f4082;if(_0x29efb9>=_0x214d85){_0x29efb9=_0x214d85;_0x3f4082=0xc8;}else{_0x3f4082=0xce;}_0x29d369[_0x3720('0x18')](_0x3f4082);return _0x29d369[_0x3720('0x1e')](_0x3720('0x1f'),_0x41de72+'-'+_0x29efb9+'/'+_0x214d85)['json'](_0x598663);}return null;};}function patchUpdates(_0x1448a1){return function(_0xee4d71){try{jsonpatch['apply'](_0xee4d71,_0x1448a1,!![]);}catch(_0x117c61){return BPromise['reject'](_0x117c61);}return _0xee4d71['save']();};}function saveUpdates(_0x2422e4,_0x4bf8ce){return function(_0x3c06b1){if(_0x3c06b1){return _0x3c06b1[_0x3720('0x20')](_0x2422e4)[_0x3720('0x21')](function(_0x539472){return _0x539472;});}return null;};}function removeEntity(_0x443e6,_0x57ebb7){return function(_0xcb6ea9){if(_0xcb6ea9){return _0xcb6ea9[_0x3720('0x22')]()[_0x3720('0x21')](function(){_0x443e6['status'](0xcc)[_0x3720('0x19')]();});}};}function handleEntityNotFound(_0x33aed3,_0x122fd6){return function(_0x81af04){if(!_0x81af04){_0x33aed3[_0x3720('0x17')](0x194);}return _0x81af04;};}function handleError(_0x16fb7b,_0x275516){_0x275516=_0x275516||0x1f4;return function(_0x2eade4){logger['error'](_0x2eade4[_0x3720('0x23')]);if(_0x2eade4['name']){delete _0x2eade4[_0x3720('0x24')];}_0x16fb7b['status'](_0x275516)[_0x3720('0x25')](_0x2eade4);};}exports[_0x3720('0x20')]=function(_0xb7f253,_0x4b52af){if(_0xb7f253[_0x3720('0x26')]['id']){delete _0xb7f253[_0x3720('0x26')]['id'];}return db[_0x3720('0x27')]['find']({'where':{'id':_0xb7f253[_0x3720('0x28')]['id']}})[_0x3720('0x21')](handleEntityNotFound(_0x4b52af,null))[_0x3720('0x21')](saveUpdates(_0xb7f253['body'],null))[_0x3720('0x21')](respondWithResult(_0x4b52af,null))[_0x3720('0x29')](handleError(_0x4b52af,null));};exports['destroy']=function(_0x5e62e4,_0x5f25f7){return db[_0x3720('0x27')][_0x3720('0x2a')]({'where':{'id':_0x5e62e4[_0x3720('0x28')]['id']}})[_0x3720('0x21')](handleEntityNotFound(_0x5f25f7,null))[_0x3720('0x21')](removeEntity(_0x5f25f7,null))['catch'](handleError(_0x5f25f7,null));}; \ No newline at end of file +var _0xcc26=['apply','reject','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xcc26,0x67));var _0x6cc2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcc26[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x6cc2('0x0'));var rimraf=require(_0x6cc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cc2('0x2'));var rp=require(_0x6cc2('0x3'));var moment=require('moment');var BPromise=require(_0x6cc2('0x4'));var Mustache=require(_0x6cc2('0x5'));var util=require(_0x6cc2('0x6'));var path=require(_0x6cc2('0x7'));var sox=require(_0x6cc2('0x8'));var csv=require(_0x6cc2('0x9'));var ejs=require(_0x6cc2('0xa'));var fs=require('fs');var fs_extra=require(_0x6cc2('0xb'));var _=require('lodash');var squel=require(_0x6cc2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6cc2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cc2('0xe'));var authService=require(_0x6cc2('0xf'));var qs=require(_0x6cc2('0x10'));var as=require(_0x6cc2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6cc2('0x12'))(_0x6cc2('0x13'));var utils=require(_0x6cc2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6cc2('0x15'));var db=require(_0x6cc2('0x16'))['db'];function respondWithStatusCode(_0x121393,_0x55ab5a){_0x55ab5a=_0x55ab5a||0xcc;return function(_0x43cbdb){if(_0x43cbdb){return _0x121393[_0x6cc2('0x17')](_0x55ab5a);}return _0x121393[_0x6cc2('0x18')](_0x55ab5a)[_0x6cc2('0x19')]();};}function respondWithResult(_0x5ec647,_0x5d0d0a){_0x5d0d0a=_0x5d0d0a||0xc8;return function(_0x4ef3b0){if(_0x4ef3b0){return _0x5ec647[_0x6cc2('0x18')](_0x5d0d0a)[_0x6cc2('0x1a')](_0x4ef3b0);}};}function respondWithFilteredResult(_0x55e2ca,_0x1e7c5c){return function(_0x519c57){if(_0x519c57){var _0x39ab53=typeof _0x1e7c5c['offset']===_0x6cc2('0x1b')&&typeof _0x1e7c5c[_0x6cc2('0x1c')]===_0x6cc2('0x1b');var _0x91c516=_0x519c57[_0x6cc2('0x1d')];var _0x38200b=_0x39ab53?0x0:_0x1e7c5c[_0x6cc2('0x1e')];var _0x3dfa64=_0x39ab53?_0x519c57['count']:_0x1e7c5c[_0x6cc2('0x1e')]+_0x1e7c5c[_0x6cc2('0x1c')];var _0x568880;if(_0x3dfa64>=_0x91c516){_0x3dfa64=_0x91c516;_0x568880=0xc8;}else{_0x568880=0xce;}_0x55e2ca['status'](_0x568880);return _0x55e2ca[_0x6cc2('0x1f')]('Content-Range',_0x38200b+'-'+_0x3dfa64+'/'+_0x91c516)[_0x6cc2('0x1a')](_0x519c57);}return null;};}function patchUpdates(_0x22d3a0){return function(_0x2a2c14){try{jsonpatch[_0x6cc2('0x20')](_0x2a2c14,_0x22d3a0,!![]);}catch(_0xf52a9f){return BPromise[_0x6cc2('0x21')](_0xf52a9f);}return _0x2a2c14['save']();};}function saveUpdates(_0x624dc5,_0x123d31){return function(_0x6f1115){if(_0x6f1115){return _0x6f1115['update'](_0x624dc5)[_0x6cc2('0x22')](function(_0x2c20cb){return _0x2c20cb;});}return null;};}function removeEntity(_0x5cc87e,_0x41591b){return function(_0x6a7de){if(_0x6a7de){return _0x6a7de[_0x6cc2('0x23')]()[_0x6cc2('0x22')](function(){_0x5cc87e[_0x6cc2('0x18')](0xcc)[_0x6cc2('0x19')]();});}};}function handleEntityNotFound(_0xa51e6c,_0x2b5c1b){return function(_0x1b7fa1){if(!_0x1b7fa1){_0xa51e6c[_0x6cc2('0x17')](0x194);}return _0x1b7fa1;};}function handleError(_0x4306b0,_0x5cc6f9){_0x5cc6f9=_0x5cc6f9||0x1f4;return function(_0x3dec54){logger[_0x6cc2('0x24')](_0x3dec54[_0x6cc2('0x25')]);if(_0x3dec54[_0x6cc2('0x26')]){delete _0x3dec54[_0x6cc2('0x26')];}_0x4306b0[_0x6cc2('0x18')](_0x5cc6f9)[_0x6cc2('0x27')](_0x3dec54);};}exports['update']=function(_0x3a3567,_0x52b85e){if(_0x3a3567[_0x6cc2('0x28')]['id']){delete _0x3a3567[_0x6cc2('0x28')]['id'];}return db[_0x6cc2('0x29')][_0x6cc2('0x2a')]({'where':{'id':_0x3a3567[_0x6cc2('0x2b')]['id']}})[_0x6cc2('0x22')](handleEntityNotFound(_0x52b85e,null))[_0x6cc2('0x22')](saveUpdates(_0x3a3567[_0x6cc2('0x28')],null))['then'](respondWithResult(_0x52b85e,null))[_0x6cc2('0x2c')](handleError(_0x52b85e,null));};exports['destroy']=function(_0x2115e0,_0x1ed81e){return db[_0x6cc2('0x29')][_0x6cc2('0x2a')]({'where':{'id':_0x2115e0[_0x6cc2('0x2b')]['id']}})[_0x6cc2('0x22')](handleEntityNotFound(_0x1ed81e,null))[_0x6cc2('0x22')](removeEntity(_0x1ed81e,null))[_0x6cc2('0x2c')](handleError(_0x1ed81e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4f649a4..43015e4 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 _0xa6d1=['./action.attributes','exports','define','../../config/logger','api','rimraf'];(function(_0x38949c,_0x311001){var _0x33466a=function(_0xfebbee){while(--_0xfebbee){_0x38949c['push'](_0x38949c['shift']());}};_0x33466a(++_0x311001);}(_0xa6d1,0x19b));var _0x1a6d=function(_0x5b1241,_0x4f5155){_0x5b1241=_0x5b1241-0x0;var _0x1b4e2d=_0xa6d1[_0x5b1241];return _0x1b4e2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a6d('0x0'))(_0x1a6d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a6d('0x2'));var config=require('../../config/environment');var attributes=require(_0x1a6d('0x3'));module[_0x1a6d('0x4')]=function(_0x3778a9,_0x199227){return _0x3778a9[_0x1a6d('0x5')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99d8=['exports','define','Action','tools_actions','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x171f7a,_0xdc733c){var _0x1e1659=function(_0x15907b){while(--_0x15907b){_0x171f7a['push'](_0x171f7a['shift']());}};_0x1e1659(++_0xdc733c);}(_0x99d8,0x13c));var _0x899d=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x99d8[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x899d('0x0'));var util=require(_0x899d('0x1'));var logger=require(_0x899d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x899d('0x3'));var fs=require('fs');var path=require(_0x899d('0x4'));var rimraf=require(_0x899d('0x5'));var config=require(_0x899d('0x6'));var attributes=require(_0x899d('0x7'));module[_0x899d('0x8')]=function(_0x113ae0,_0x2ff459){return _0x113ae0[_0x899d('0x9')](_0x899d('0xa'),attributes,{'tableName':_0x899d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 792f54d..442a0a1 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xbcb94f,_0x54fe63){var _0x14a1b8=function(_0x96af90){while(--_0x96af90){_0xbcb94f['push'](_0xbcb94f['shift']());}};_0x14a1b8(++_0x54fe63);}(_0x8ef6,0xf2));var _0x68ef=function(_0x54f61d,_0x28baf4){_0x54f61d=_0x54f61d-0x0;var _0x4bb3e9=_0x8ef6[_0x54f61d];return _0x4bb3e9;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4f9d9a2..795a59f 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 _0x7f75=['./action.controller','put','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x278ccc,_0x4619e9){var _0x283f73=function(_0x5655e1){while(--_0x5655e1){_0x278ccc['push'](_0x278ccc['shift']());}};_0x283f73(++_0x4619e9);}(_0x7f75,0x96));var _0x57f7=function(_0x186e77,_0x408518){_0x186e77=_0x186e77-0x0;var _0x590425=_0x7f75[_0x186e77];return _0x590425;};'use strict';var multer=require(_0x57f7('0x0'));var util=require('util');var path=require(_0x57f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x57f7('0x2'));var router=express[_0x57f7('0x3')]();var fs_extra=require(_0x57f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x57f7('0x5'));var config=require('../../config/environment');var controller=require(_0x57f7('0x6'));router[_0x57f7('0x7')](_0x57f7('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x57f7('0x9')](_0x57f7('0x8'),auth['isAuthenticated'](),controller[_0x57f7('0xa')]);module[_0x57f7('0xb')]=router; \ No newline at end of file +var _0xb320=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x3a9dd4,_0x5d439f){var _0x447ba3=function(_0x27c99c){while(--_0x27c99c){_0x3a9dd4['push'](_0x3a9dd4['shift']());}};_0x447ba3(++_0x5d439f);}(_0xb320,0x138));var _0x0b32=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xb320[_0xdaab62];return _0x13d767;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b32('0x0'));var timeout=require('connect-timeout');var express=require(_0x0b32('0x1'));var router=express['Router']();var fs_extra=require(_0x0b32('0x2'));var auth=require(_0x0b32('0x3'));var interaction=require(_0x0b32('0x4'));var config=require('../../config/environment');var controller=require(_0x0b32('0x5'));router[_0x0b32('0x6')](_0x0b32('0x7'),auth[_0x0b32('0x8')](),controller[_0x0b32('0x9')]);router[_0x0b32('0xa')](_0x0b32('0x7'),auth[_0x0b32('0x8')](),controller[_0x0b32('0xb')]);module[_0x0b32('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5c1f204..8038f36 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 _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4df2ff,_0x3cb8ca){_0x4df2ff=_0x4df2ff-0x0;var _0x3b4d97=_0x8ef6[_0x4df2ff];return _0x3b4d97;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x25dcd1,_0x3077cd){var _0x44310a=function(_0xdbea90){while(--_0xdbea90){_0x25dcd1['push'](_0x25dcd1['shift']());}};_0x44310a(++_0x3077cd);}(_0xb138,0x1dd));var _0x8b13=function(_0xb84c7f,_0x4ac90f){_0xb84c7f=_0xb84c7f-0x0;var _0x3e28f1=_0xb138[_0xb84c7f];return _0x3e28f1;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8722803..362a9cb 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 _0x1280=['to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','status','end','json','limit','undefined','count','offset','Content-Range','apply','destroy','then','get','CustomReports','error','stack','send','map','rawAttributes','fieldName','type','key','name','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','AnalyticCustomReport','includeAll','include','findAll','rows','keys','length','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','DATE(%s)','HOUR(%s)','AnalyticMetric','table','output','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../files/reports','countTable','run','runReport','COUNT(%s)','IS\x20NOT\x20EMPTY','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1280,0x98));var _0x0128=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x1280[_0x3eb713];return _0x1d7128;};'use strict';var emlformat=require(_0x0128('0x0'));var rimraf=require(_0x0128('0x1'));var zipdir=require(_0x0128('0x2'));var jsonpatch=require(_0x0128('0x3'));var rp=require('request-promise');var moment=require(_0x0128('0x4'));var BPromise=require(_0x0128('0x5'));var Mustache=require('mustache');var util=require(_0x0128('0x6'));var path=require(_0x0128('0x7'));var sox=require(_0x0128('0x8'));var csv=require(_0x0128('0x9'));var ejs=require(_0x0128('0xa'));var fs=require('fs');var fs_extra=require(_0x0128('0xb'));var _=require('lodash');var squel=require(_0x0128('0xc'));var crypto=require(_0x0128('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0128('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0128('0xf'));var Redis=require(_0x0128('0x10'));var authService=require(_0x0128('0x11'));var qs=require(_0x0128('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0128('0x13'));var logger=require(_0x0128('0x14'))(_0x0128('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0128('0x16'));var db=require(_0x0128('0x17'))['db'];var dbH=require(_0x0128('0x17'))[_0x0128('0x18')];function respondWithStatusCode(_0x3c5f18,_0x3b8a00){_0x3b8a00=_0x3b8a00||0xcc;return function(_0x4b79f3){if(_0x4b79f3){return _0x3c5f18['sendStatus'](_0x3b8a00);}return _0x3c5f18[_0x0128('0x19')](_0x3b8a00)[_0x0128('0x1a')]();};}function respondWithResult(_0x4b8eeb,_0x14fcb5){_0x14fcb5=_0x14fcb5||0xc8;return function(_0x437211){if(_0x437211){return _0x4b8eeb['status'](_0x14fcb5)[_0x0128('0x1b')](_0x437211);}};}function respondWithFilteredResult(_0x59f69e,_0x9412f5){return function(_0x2db78a){if(_0x2db78a){var _0x902e87=typeof _0x9412f5['offset']==='undefined'&&typeof _0x9412f5[_0x0128('0x1c')]===_0x0128('0x1d');var _0x1e23ba=_0x2db78a[_0x0128('0x1e')];var _0x42ff6e=_0x902e87?0x0:_0x9412f5[_0x0128('0x1f')];var _0x5d8a6f=_0x902e87?_0x2db78a['count']:_0x9412f5[_0x0128('0x1f')]+_0x9412f5[_0x0128('0x1c')];var _0x475b71;if(_0x5d8a6f>=_0x1e23ba){_0x5d8a6f=_0x1e23ba;_0x475b71=0xc8;}else{_0x475b71=0xce;}_0x59f69e[_0x0128('0x19')](_0x475b71);return _0x59f69e['set'](_0x0128('0x20'),_0x42ff6e+'-'+_0x5d8a6f+'/'+_0x1e23ba)[_0x0128('0x1b')](_0x2db78a);}return null;};}function patchUpdates(_0x5ecc67){return function(_0x565609){try{jsonpatch[_0x0128('0x21')](_0x565609,_0x5ecc67,!![]);}catch(_0x4f3042){return BPromise['reject'](_0x4f3042);}return _0x565609['save']();};}function saveUpdates(_0x27b256,_0x3aa4ae){return function(_0x1c6e63){if(_0x1c6e63){return _0x1c6e63['update'](_0x27b256)['then'](function(_0x335b43){return _0x335b43;});}return null;};}function removeEntity(_0x30f49f,_0x489764){return function(_0x55940e){if(_0x55940e){return _0x55940e[_0x0128('0x22')]()[_0x0128('0x23')](function(){var _0x1ead70=_0x55940e[_0x0128('0x24')]({'plain':!![]});var _0x4b989c=_0x0128('0x25');return db['UserProfileResource'][_0x0128('0x22')]({'where':{'type':_0x4b989c,'resourceId':_0x1ead70['id']}})['then'](function(){return _0x55940e;});})['then'](function(){_0x30f49f[_0x0128('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ecb1,_0x4bffb3){return function(_0x5b71da){if(!_0x5b71da){_0x33ecb1['sendStatus'](0x194);}return _0x5b71da;};}function handleError(_0x59b3d1,_0x2aa33e){_0x2aa33e=_0x2aa33e||0x1f4;return function(_0x1a4284){logger[_0x0128('0x26')](_0x1a4284[_0x0128('0x27')]);if(_0x1a4284['name']){delete _0x1a4284['name'];}_0x59b3d1['status'](_0x2aa33e)[_0x0128('0x28')](_0x1a4284);};}exports['index']=function(_0x32a649,_0x46b8bc){var _0x2b8584={},_0x562c3b={},_0x3616dc={'count':0x0,'rows':[]};var _0x56daad=_[_0x0128('0x29')](db['AnalyticCustomReport'][_0x0128('0x2a')],function(_0x385a39){return{'name':_0x385a39[_0x0128('0x2b')],'type':_0x385a39[_0x0128('0x2c')][_0x0128('0x2d')]};});_0x562c3b['model']=_['map'](_0x56daad,_0x0128('0x2e'));_0x562c3b[_0x0128('0x2f')]=_['keys'](_0x32a649[_0x0128('0x2f')]);_0x562c3b['filters']=_[_0x0128('0x30')](_0x562c3b[_0x0128('0x31')],_0x562c3b['query']);_0x2b8584[_0x0128('0x32')]=_[_0x0128('0x30')](_0x562c3b[_0x0128('0x31')],qs[_0x0128('0x33')](_0x32a649[_0x0128('0x2f')][_0x0128('0x33')]));_0x2b8584[_0x0128('0x32')]=_0x2b8584[_0x0128('0x32')]['length']?_0x2b8584[_0x0128('0x32')]:_0x562c3b[_0x0128('0x31')];if(!_0x32a649[_0x0128('0x2f')][_0x0128('0x34')](_0x0128('0x35'))){_0x2b8584[_0x0128('0x1c')]=qs[_0x0128('0x1c')](_0x32a649[_0x0128('0x2f')][_0x0128('0x1c')]);_0x2b8584[_0x0128('0x1f')]=qs[_0x0128('0x1f')](_0x32a649['query'][_0x0128('0x1f')]);}_0x2b8584[_0x0128('0x36')]=qs[_0x0128('0x37')](_0x32a649['query']['sort']);_0x2b8584[_0x0128('0x38')]=qs[_0x0128('0x39')](_[_0x0128('0x3a')](_0x32a649['query'],_0x562c3b['filters']),_0x56daad);if(_0x32a649[_0x0128('0x2f')][_0x0128('0x3b')]){_0x2b8584[_0x0128('0x38')]=_[_0x0128('0x3c')](_0x2b8584[_0x0128('0x38')],{'$or':_[_0x0128('0x29')](_0x56daad,function(_0x1692f2){if(_0x1692f2[_0x0128('0x2c')]!=='VIRTUAL'){var _0x5ba663={};_0x5ba663[_0x1692f2[_0x0128('0x2e')]]={'$like':'%'+_0x32a649['query'][_0x0128('0x3b')]+'%'};return _0x5ba663;}})});}_0x2b8584=_[_0x0128('0x3c')]({},_0x2b8584,_0x32a649['options']);var _0x3f5713={'where':_0x2b8584[_0x0128('0x38')]};return db[_0x0128('0x3d')][_0x0128('0x1e')](_0x3f5713)[_0x0128('0x23')](function(_0x248393){_0x3616dc[_0x0128('0x1e')]=_0x248393;if(_0x32a649[_0x0128('0x2f')][_0x0128('0x3e')]){_0x2b8584[_0x0128('0x3f')]=[{'all':!![]}];}return db[_0x0128('0x3d')][_0x0128('0x40')](_0x2b8584);})[_0x0128('0x23')](function(_0x58269b){_0x3616dc[_0x0128('0x41')]=_0x58269b;return _0x3616dc;})[_0x0128('0x23')](respondWithFilteredResult(_0x46b8bc,_0x2b8584))['catch'](handleError(_0x46b8bc,null));};exports['show']=function(_0x37fce0,_0x39aafd){var _0x59915e={'raw':![],'where':{'id':_0x37fce0['params']['id']}},_0x544aa2={};_0x544aa2['model']=_[_0x0128('0x42')](db['AnalyticCustomReport'][_0x0128('0x2a')]);_0x544aa2[_0x0128('0x2f')]=_[_0x0128('0x42')](_0x37fce0[_0x0128('0x2f')]);_0x544aa2[_0x0128('0x39')]=_['intersection'](_0x544aa2['model'],_0x544aa2[_0x0128('0x2f')]);_0x59915e[_0x0128('0x32')]=_[_0x0128('0x30')](_0x544aa2[_0x0128('0x31')],qs[_0x0128('0x33')](_0x37fce0['query'][_0x0128('0x33')]));_0x59915e[_0x0128('0x32')]=_0x59915e[_0x0128('0x32')][_0x0128('0x43')]?_0x59915e['attributes']:_0x544aa2[_0x0128('0x31')];if(_0x37fce0[_0x0128('0x2f')][_0x0128('0x3e')]){_0x59915e[_0x0128('0x3f')]=[{'all':!![]}];}_0x59915e=_['merge']({},_0x59915e,_0x37fce0[_0x0128('0x44')]);return db[_0x0128('0x3d')][_0x0128('0x45')](_0x59915e)[_0x0128('0x23')](handleEntityNotFound(_0x39aafd,null))[_0x0128('0x23')](respondWithResult(_0x39aafd,null))[_0x0128('0x46')](handleError(_0x39aafd,null));};exports[_0x0128('0x47')]=function(_0x37976a,_0x20ee32){return db[_0x0128('0x3d')][_0x0128('0x47')](_0x37976a[_0x0128('0x48')],{})[_0x0128('0x23')](function(_0x40e347){var _0x57e357=_0x37976a[_0x0128('0x49')][_0x0128('0x24')]({'plain':!![]});if(!_0x57e357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57e357[_0x0128('0x4a')]===_0x0128('0x49')){var _0x532ece=_0x40e347[_0x0128('0x24')]({'plain':!![]});var _0x38a8e2=_0x0128('0x4b');return db['UserProfileSection'][_0x0128('0x45')]({'where':{'name':_0x38a8e2,'userProfileId':_0x57e357[_0x0128('0x4c')]},'raw':!![]})[_0x0128('0x23')](function(_0x507bf2){if(_0x507bf2&&_0x507bf2[_0x0128('0x4d')]===0x0){return db[_0x0128('0x4e')][_0x0128('0x47')]({'name':_0x532ece[_0x0128('0x2e')],'resourceId':_0x532ece['id'],'type':'CustomReports','sectionId':_0x507bf2['id']},{})[_0x0128('0x23')](function(){return _0x40e347;});}else{return _0x40e347;}})[_0x0128('0x46')](function(_0x555a5d){logger['error'](_0x0128('0x4f'),_0x555a5d);throw _0x555a5d;});}return _0x40e347;})['then'](respondWithResult(_0x20ee32,0xc9))[_0x0128('0x46')](handleError(_0x20ee32,null));};exports[_0x0128('0x50')]=function(_0x4f763f,_0x5d7593){if(_0x4f763f['body']['id']){delete _0x4f763f['body']['id'];}return db[_0x0128('0x3d')][_0x0128('0x45')]({'where':{'id':_0x4f763f[_0x0128('0x51')]['id']}})[_0x0128('0x23')](handleEntityNotFound(_0x5d7593,null))[_0x0128('0x23')](saveUpdates(_0x4f763f[_0x0128('0x48')],null))[_0x0128('0x23')](respondWithResult(_0x5d7593,null))[_0x0128('0x46')](handleError(_0x5d7593,null));};exports[_0x0128('0x22')]=function(_0x50f975,_0x372af5){return db[_0x0128('0x3d')][_0x0128('0x45')]({'where':{'id':_0x50f975['params']['id']}})['then'](handleEntityNotFound(_0x372af5,null))[_0x0128('0x23')](removeEntity(_0x372af5,null))[_0x0128('0x46')](handleError(_0x372af5,null));};exports[_0x0128('0x52')]=function(_0x581d52,_0x42efe5){var _0x4aa56a=0xa;var _0x7eb326=[_0x0128('0x53'),_0x0128('0x54'),_0x0128('0x55'),_0x0128('0x56')];var _0x3eeecd={'SUM':_0x0128('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0128('0x58'),'MIN':_0x0128('0x59'),'AVG':_0x0128('0x5a'),'GROUP_CONCAT':_0x0128('0x5b'),'GROUP_CONCAT ASC':_0x0128('0x5c'),'GROUP_CONCAT DESC':_0x0128('0x5d')};var _0x4b594b={'SEC_TO_TIME':_0x0128('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x0128('0x5f'),'UNIX_TIMESTAMP':_0x0128('0x60')};var _0x2b69d3=function(_0x17a2b0){return!_['includes']([_0x0128('0x61'),_0x0128('0x62'),_0x0128('0x63'),'IS\x20NOT\x20EMPTY'],_0x17a2b0);};var _0x5cba5e=function(_0x56b5d6){if(!_0x56b5d6||!_0x56b5d6['rules']['length']){return'';}for(var _0x4d4dd5='(',_0x3e04a8=0x0;_0x3e04a8<_0x56b5d6['rules'][_0x0128('0x43')];_0x3e04a8+=0x1){_0x3e04a8>0x0&&(_0x4d4dd5+='\x20'+_0x56b5d6[_0x0128('0x64')]+'\x20');_0x4d4dd5+=_0x56b5d6[_0x0128('0x65')][_0x3e04a8][_0x0128('0x66')]?_0x5cba5e(_0x56b5d6[_0x0128('0x65')][_0x3e04a8][_0x0128('0x66')]):_0x56b5d6[_0x0128('0x65')][_0x3e04a8]['field']+'\x20'+_0x56b5d6[_0x0128('0x65')][_0x3e04a8][_0x0128('0x67')]+(_0x2b69d3(_0x56b5d6['rules'][_0x3e04a8]['condition'])?'\x20'+_0x56b5d6[_0x0128('0x65')][_0x3e04a8]['value']:'');}return _0x4d4dd5+')';};var _0x451841={'where':{'id':_0x581d52[_0x0128('0x51')]['id']}},_0x4a5088,_0x1cb691,_0x486032,_0x3a3180,_0x14892d;_0x451841=_[_0x0128('0x3c')]({},_0x451841,_0x581d52[_0x0128('0x44')]);return db['AnalyticCustomReport'][_0x0128('0x45')](_0x451841)[_0x0128('0x23')](function(_0x353048){if(_0x353048){_0x4a5088=_0x353048;return _0x353048[_0x0128('0x68')]();}return null;})[_0x0128('0x23')](function(_0x304e14){if(_0x304e14){if(!_0x304e14[_0x0128('0x43')]){throw new db[(_0x0128('0x69'))][(_0x0128('0x6a'))](_0x0128('0x6b'),0x193);}_0x1cb691=_0x304e14;return db['AnalyticMetric'][_0x0128('0x40')]({'raw':!![]});}return null;})['then'](function(_0x104f70){if(_0x104f70){_0x486032=_[_0x0128('0x6c')](_0x104f70,'id');var _0x18eb9a;var _0xab8c68=squel[_0x0128('0x6d')]();_0xab8c68[_0x0128('0x6e')](_0x4a5088['table']);for(var _0x1b502e=0x0;_0x1b502e<_0x1cb691[_0x0128('0x43')];_0x1b502e+=0x1){_0x18eb9a=_0x1cb691[_0x1b502e]['MetricId']?_0x486032[_0x1cb691[_0x1b502e][_0x0128('0x6f')]][_0x0128('0x70')]:_0x1cb691[_0x1b502e][_0x0128('0x71')];_0x18eb9a=_0x1cb691[_0x1b502e][_0x0128('0x72')]?_[_0x0128('0x73')](_0x3eeecd[_0x1cb691[_0x1b502e][_0x0128('0x72')]],'%s',_0x18eb9a):_0x18eb9a;_0x18eb9a=_0x1cb691[_0x1b502e][_0x0128('0x74')]?_[_0x0128('0x73')](_0x4b594b[_0x1cb691[_0x1b502e][_0x0128('0x74')]],'%s',_0x18eb9a):_0x18eb9a;if(_0x1cb691[_0x1b502e][_0x0128('0x75')]){_0xab8c68[_0x0128('0x66')](_0x18eb9a);}_0x1cb691[_0x1b502e][_0x0128('0x76')]&&_0xab8c68['order'](_0x18eb9a,_0x1cb691[_0x1b502e][_0x0128('0x76')]===_0x0128('0x77')?![]:!![]);_0xab8c68[_0x0128('0x71')](_0x18eb9a,_0x1cb691[_0x1b502e][_0x0128('0x78')]||_0x18eb9a);}if(_0x4a5088[_0x0128('0x79')]){_0x4a5088['joins']=JSON[_0x0128('0x7a')](_0x4a5088[_0x0128('0x79')]);for(var _0x378f94=0x0;_0x378f94<_0x4a5088[_0x0128('0x79')]['length'];_0x378f94+=0x1){if(_0x4a5088[_0x0128('0x79')][_0x378f94][_0x0128('0x2c')]&&_[_0x0128('0x7b')](_0x7eb326,_0x4a5088['joins'][_0x378f94]['type'])&&_0x4a5088['joins'][_0x378f94][_0x0128('0x7c')]&&_0x4a5088[_0x0128('0x79')][_0x378f94][_0x0128('0x7d')]&&_0x4a5088[_0x0128('0x79')][_0x378f94][_0x0128('0x7e')]){_0xab8c68[_0x4a5088['joins'][_0x378f94][_0x0128('0x2c')]](_0x4a5088[_0x0128('0x79')][_0x378f94]['foreignTable'],null,util[_0x0128('0x74')](_0x0128('0x7f'),_0x4a5088['table'],_0x4a5088['joins'][_0x378f94][_0x0128('0x7c')],_0x4a5088[_0x0128('0x79')][_0x378f94][_0x0128('0x7d')],_0x4a5088[_0x0128('0x79')][_0x378f94][_0x0128('0x7e')]));}}}if(_0x4a5088[_0x0128('0x80')]){_0x4a5088[_0x0128('0x80')]=JSON[_0x0128('0x7a')](_0x4a5088[_0x0128('0x80')]);_0xab8c68['where'](_0x5cba5e(_0x4a5088['conditions'][_0x0128('0x66')]));}_0x14892d=_0xab8c68[_0x0128('0x81')]();_0xab8c68[_0x0128('0x1c')](_0x4aa56a);_0xab8c68[_0x0128('0x1f')](0x0);logger[_0x0128('0x82')](_0x0128('0x83'),_0xab8c68[_0x0128('0x84')]());return dbH[_0x0128('0x85')][_0x0128('0x2f')](_0xab8c68['toString'](),{'type':dbH[_0x0128('0x85')][_0x0128('0x86')][_0x0128('0x87')]});}})[_0x0128('0x23')](respondWithResult(_0x42efe5,null))['catch'](handleError(_0x42efe5,null));};function runReport(_0x59a5ac,_0x5a3ffa,_0x3a1d09){var _0xaff55b=_0x5a3ffa[_0x0128('0x2e')];var _0x37f074=0xa;var _0xf1f5ee=['join',_0x0128('0x54'),_0x0128('0x55'),_0x0128('0x56')];var _0x41f215={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0128('0x88'),'MAX':_0x0128('0x58'),'MIN':_0x0128('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0128('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x42ac40={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0128('0x89'),'HOUR':_0x0128('0x8a'),'ROUND':_0x0128('0x5f'),'UNIX_TIMESTAMP':_0x0128('0x60')};var _0x4beef1=function(_0x554213){return!_[_0x0128('0x7b')]([_0x0128('0x61'),_0x0128('0x62'),_0x0128('0x63'),'IS\x20NOT\x20EMPTY'],_0x554213);};var _0x288cac=function(_0x1bfb6c){if(!_0x1bfb6c||!_0x1bfb6c['rules'][_0x0128('0x43')]){return'';}for(var _0x540a24='(',_0x1f0bae=0x0;_0x1f0bae<_0x1bfb6c[_0x0128('0x65')][_0x0128('0x43')];_0x1f0bae+=0x1){_0x1f0bae>0x0&&(_0x540a24+='\x20'+_0x1bfb6c[_0x0128('0x64')]+'\x20');_0x540a24+=_0x1bfb6c[_0x0128('0x65')][_0x1f0bae][_0x0128('0x66')]?_0x288cac(_0x1bfb6c[_0x0128('0x65')][_0x1f0bae][_0x0128('0x66')]):_0x1bfb6c[_0x0128('0x65')][_0x1f0bae][_0x0128('0x71')]+'\x20'+_0x1bfb6c[_0x0128('0x65')][_0x1f0bae][_0x0128('0x67')]+(_0x4beef1(_0x1bfb6c[_0x0128('0x65')][_0x1f0bae]['condition'])?'\x20'+_0x1bfb6c[_0x0128('0x65')][_0x1f0bae]['value']:'');}return _0x540a24+')';};var _0x2e9c5f={'where':{'id':_0x59a5ac['id']}},_0xd22a97,_0x5b960a,_0x115c0e,_0x5f850f,_0x9a1dc4;_0x2e9c5f=_[_0x0128('0x3c')]({},_0x2e9c5f,_0x3a1d09);return db[_0x0128('0x3d')][_0x0128('0x45')](_0x2e9c5f)['then'](function(_0x2161b1){if(_0x2161b1){_0xd22a97=_0x2161b1;return _0x2161b1[_0x0128('0x68')]();}return null;})['then'](function(_0x5c4668){if(_0x5c4668){if(!_0x5c4668[_0x0128('0x43')]){throw new db[(_0x0128('0x69'))][(_0x0128('0x6a'))](_0x0128('0x6b'),0x193);}_0x5b960a=_0x5c4668;return db[_0x0128('0x8b')][_0x0128('0x40')]({'raw':!![]});}return null;})[_0x0128('0x23')](function(_0x195506){if(_0x195506){_0x115c0e=_[_0x0128('0x6c')](_0x195506,'id');var _0x56b2ee;var _0x48588f=squel['select']();_0x48588f[_0x0128('0x6e')](_0xd22a97[_0x0128('0x8c')]);for(var _0x4d4ed1=0x0;_0x4d4ed1<_0x5b960a[_0x0128('0x43')];_0x4d4ed1+=0x1){_0x56b2ee=_0x5b960a[_0x4d4ed1]['MetricId']?_0x115c0e[_0x5b960a[_0x4d4ed1][_0x0128('0x6f')]][_0x0128('0x70')]:_0x5b960a[_0x4d4ed1][_0x0128('0x71')];_0x56b2ee=_0x5b960a[_0x4d4ed1][_0x0128('0x72')]?_[_0x0128('0x73')](_0x41f215[_0x5b960a[_0x4d4ed1][_0x0128('0x72')]],'%s',_0x56b2ee):_0x56b2ee;_0x56b2ee=_0x5b960a[_0x4d4ed1]['format']?_[_0x0128('0x73')](_0x42ac40[_0x5b960a[_0x4d4ed1]['format']],'%s',_0x56b2ee):_0x56b2ee;if(_0x5b960a[_0x4d4ed1][_0x0128('0x75')]){_0x48588f[_0x0128('0x66')](_0x56b2ee);}_0x5b960a[_0x4d4ed1]['orderBy']&&_0x48588f['order'](_0x56b2ee,_0x5b960a[_0x4d4ed1][_0x0128('0x76')]===_0x0128('0x77')?![]:!![]);_0x48588f[_0x0128('0x71')](_0x56b2ee,_0x5b960a[_0x4d4ed1][_0x0128('0x78')]||_0x56b2ee);}if(_0xd22a97['joins']){_0xd22a97[_0x0128('0x79')]=JSON[_0x0128('0x7a')](_0xd22a97[_0x0128('0x79')]);for(var _0x29d535=0x0;_0x29d535<_0xd22a97[_0x0128('0x79')][_0x0128('0x43')];_0x29d535+=0x1){if(_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x2c')]&&_['includes'](_0xf1f5ee,_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x2c')])&&_0xd22a97['joins'][_0x29d535][_0x0128('0x7c')]&&_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x7d')]&&_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x7e')]){_0x48588f[_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x2c')]](_0xd22a97['joins'][_0x29d535][_0x0128('0x7d')],null,util[_0x0128('0x74')](_0x0128('0x7f'),_0xd22a97[_0x0128('0x8c')],_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x7c')],_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x7d')],_0xd22a97[_0x0128('0x79')][_0x29d535][_0x0128('0x7e')]));}}}if(_0xd22a97['conditions']){_0xd22a97[_0x0128('0x80')]=JSON['parse'](_0xd22a97[_0x0128('0x80')]);_0x48588f[_0x0128('0x38')](_0x288cac(_0xd22a97[_0x0128('0x80')][_0x0128('0x66')]));}_0x9a1dc4=_0x48588f[_0x0128('0x81')]();_0x48588f['limit'](_0x37f074);_0x48588f[_0x0128('0x1f')](0x0);return;}})[_0x0128('0x23')](function(){if(_0x5a3ffa[_0x0128('0x8d')]==='web'){return null;}var _0x3b51e3=_[_0x0128('0x3c')](_0x5a3ffa,{'name':_0x5a3ffa['fullPath']||_0x5a3ffa[_0x0128('0x2e')]||_0xd22a97[_0x0128('0x2e')],'basename':_0xaff55b,'savename':util[_0x0128('0x74')](_0x0128('0x8e'),_0x5a3ffa[_0x0128('0x2e')]||_0xd22a97[_0x0128('0x2e')],require('randomstring')['generate'](0x4),_0x5a3ffa[_0x0128('0x8d')]||_0x0128('0x8f')),'reportId':_0xd22a97['id'],'reportType':_0x0128('0x90')});return db[_0x0128('0x91')][_0x0128('0x47')](_0x3b51e3,{'raw':!![]});})['then'](function(_0x3193a2){if(_0xd22a97[_0x0128('0x8c')]===_0x0128('0x92')){_0x9a1dc4['where'](_0xd22a97['table']+_0x0128('0x93'),_0x5a3ffa[_0x0128('0x94')],_0x5a3ffa['endDate']);}else{_0x9a1dc4['where'](_0xd22a97[_0x0128('0x8c')]+_0x0128('0x95'),_0x5a3ffa[_0x0128('0x94')],_0x5a3ffa[_0x0128('0x96')]);}if(_0x3193a2){logger['info'](_0x0128('0x97'),_0x9a1dc4['toString']());require(_0x0128('0x98'))[_0x0128('0x99')](path[_0x0128('0x53')](__dirname,'../../components/export/',_0x3193a2['output']),[_0x3193a2['id'],_0x9a1dc4[_0x0128('0x84')](),path[_0x0128('0x53')](__dirname,_0x0128('0x9a'),_0x3193a2['savename']),_0xaff55b]);return _0x3193a2;}else{var _0x997e3d=squel['select']();_0x997e3d['from']('('+_0x9a1dc4[_0x0128('0x84')]()+')',_0x0128('0x9b'));_0x997e3d[_0x0128('0x71')]('COUNT(*)','count');_0x9a1dc4['limit'](_0x5a3ffa['limit']||_0x37f074);_0x9a1dc4['offset'](_0x5a3ffa[_0x0128('0x1f')]||0x0);return dbH[_0x0128('0x85')][_0x0128('0x2f')](_0x997e3d[_0x0128('0x84')](),{'type':dbH[_0x0128('0x85')][_0x0128('0x86')][_0x0128('0x87')]})['then'](function(_0x249e0b){if(!_0x249e0b[_0x0128('0x43')]){_0x5f850f=0x0;}else{_0x5f850f=_0x249e0b[0x0][_0x0128('0x1e')]||0x0;}return dbH['sequelize'][_0x0128('0x2f')](_0x9a1dc4[_0x0128('0x84')](),{'type':dbH['sequelize'][_0x0128('0x86')]['SELECT']});})[_0x0128('0x23')](function(_0x49fe03){return{'rows':_0x49fe03||[],'count':_0x5f850f};});}});}exports[_0x0128('0x9c')]=function(_0x2acc39,_0x406708){return runReport(_0x2acc39[_0x0128('0x51')],_0x2acc39[_0x0128('0x2f')],_0x2acc39[_0x0128('0x44')])['then'](respondWithResult(_0x406708,null))[_0x0128('0x46')](handleError(_0x406708,null));};exports[_0x0128('0x9d')]=runReport;exports[_0x0128('0x2f')]=function(_0x3c2d02,_0x218229){var _0x1978bc=0xa;var _0x100153=['join','left_join','right_join','cross_join'];var _0x44bdad={'SUM':'SUM(%s)','COUNT':_0x0128('0x9e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x0128('0x5a'),'GROUP_CONCAT':_0x0128('0x5b'),'GROUP_CONCAT ASC':_0x0128('0x5c'),'GROUP_CONCAT DESC':_0x0128('0x5d')};var _0x12ee2f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0128('0x89'),'HOUR':_0x0128('0x8a'),'ROUND':_0x0128('0x5f'),'UNIX_TIMESTAMP':_0x0128('0x60')};var _0x36d169=function(_0x5817cc){return!_[_0x0128('0x7b')]([_0x0128('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x0128('0x9f')],_0x5817cc);};var _0x1e2ef2=function(_0xd6dab){if(!_0xd6dab||!_0xd6dab[_0x0128('0x65')][_0x0128('0x43')]){return'';}for(var _0x990c8f='(',_0x289918=0x0;_0x289918<_0xd6dab[_0x0128('0x65')][_0x0128('0x43')];_0x289918+=0x1){_0x289918>0x0&&(_0x990c8f+='\x20'+_0xd6dab[_0x0128('0x64')]+'\x20');_0x990c8f+=_0xd6dab[_0x0128('0x65')][_0x289918][_0x0128('0x66')]?_0x1e2ef2(_0xd6dab[_0x0128('0x65')][_0x289918]['group']):_0xd6dab[_0x0128('0x65')][_0x289918][_0x0128('0x71')]+'\x20'+_0xd6dab[_0x0128('0x65')][_0x289918][_0x0128('0x67')]+(_0x36d169(_0xd6dab[_0x0128('0x65')][_0x289918]['condition'])?'\x20'+_0xd6dab[_0x0128('0x65')][_0x289918][_0x0128('0xa0')]:'');}return _0x990c8f+')';};var _0x5ecd6f={'where':{'id':_0x3c2d02[_0x0128('0x51')]['id']}},_0x45628a,_0x16e08f,_0x1da562,_0x2efbab,_0x1ec73;_0x5ecd6f=_[_0x0128('0x3c')]({},_0x5ecd6f,_0x3c2d02['options']);return db['AnalyticCustomReport']['find'](_0x5ecd6f)[_0x0128('0x23')](function(_0x4d29fb){if(_0x4d29fb){_0x45628a=_0x4d29fb;return _0x4d29fb['getFields']();}return null;})[_0x0128('0x23')](function(_0x465044){if(_0x465044){if(!_0x465044[_0x0128('0x43')]){throw new db[(_0x0128('0x69'))]['ValidationErrorItem'](_0x0128('0x6b'),0x193);}_0x16e08f=_0x465044;return db[_0x0128('0x8b')][_0x0128('0x40')]({'raw':!![]});}return null;})['then'](function(_0x23ca5c){if(_0x23ca5c){_0x1da562=_[_0x0128('0x6c')](_0x23ca5c,'id');var _0x40d044;var _0x108298=squel[_0x0128('0x6d')]();_0x108298[_0x0128('0x6e')](_0x45628a[_0x0128('0x8c')]);for(var _0x4161c3=0x0;_0x4161c3<_0x16e08f['length'];_0x4161c3+=0x1){_0x40d044=_0x16e08f[_0x4161c3]['MetricId']?_0x1da562[_0x16e08f[_0x4161c3]['MetricId']][_0x0128('0x70')]:_0x16e08f[_0x4161c3][_0x0128('0x71')];_0x40d044=_0x16e08f[_0x4161c3][_0x0128('0x72')]?_[_0x0128('0x73')](_0x44bdad[_0x16e08f[_0x4161c3][_0x0128('0x72')]],'%s',_0x40d044):_0x40d044;_0x40d044=_0x16e08f[_0x4161c3][_0x0128('0x74')]?_['replace'](_0x12ee2f[_0x16e08f[_0x4161c3][_0x0128('0x74')]],'%s',_0x40d044):_0x40d044;if(_0x16e08f[_0x4161c3]['groupBy']){_0x108298[_0x0128('0x66')](_0x40d044);}_0x16e08f[_0x4161c3][_0x0128('0x76')]&&_0x108298['order'](_0x40d044,_0x16e08f[_0x4161c3][_0x0128('0x76')]===_0x0128('0x77')?![]:!![]);_0x108298[_0x0128('0x71')](_0x40d044,_0x16e08f[_0x4161c3][_0x0128('0x78')]||_0x40d044);}if(_0x45628a['joins']){_0x45628a[_0x0128('0x79')]=JSON[_0x0128('0x7a')](_0x45628a[_0x0128('0x79')]);for(var _0x23f290=0x0;_0x23f290<_0x45628a[_0x0128('0x79')][_0x0128('0x43')];_0x23f290+=0x1){if(_0x45628a[_0x0128('0x79')][_0x23f290]['type']&&_['includes'](_0x100153,_0x45628a['joins'][_0x23f290]['type'])&&_0x45628a[_0x0128('0x79')][_0x23f290]['parentKey']&&_0x45628a[_0x0128('0x79')][_0x23f290][_0x0128('0x7d')]&&_0x45628a[_0x0128('0x79')][_0x23f290]['foreignKey']){_0x108298[_0x45628a[_0x0128('0x79')][_0x23f290][_0x0128('0x2c')]](_0x45628a['joins'][_0x23f290][_0x0128('0x7d')],null,util[_0x0128('0x74')]('%s.%s\x20=\x20%s.%s',_0x45628a[_0x0128('0x8c')],_0x45628a['joins'][_0x23f290][_0x0128('0x7c')],_0x45628a[_0x0128('0x79')][_0x23f290][_0x0128('0x7d')],_0x45628a[_0x0128('0x79')][_0x23f290][_0x0128('0x7e')]));}}}if(_0x45628a[_0x0128('0x80')]){_0x45628a[_0x0128('0x80')]=JSON[_0x0128('0x7a')](_0x45628a[_0x0128('0x80')]);_0x108298[_0x0128('0x38')](_0x1e2ef2(_0x45628a[_0x0128('0x80')][_0x0128('0x66')]));}_0x1ec73=_0x108298[_0x0128('0x81')]();_0x108298[_0x0128('0x1c')](_0x1978bc);_0x108298[_0x0128('0x1f')](0x0);logger[_0x0128('0x82')](_0x0128('0x83'),_0x108298[_0x0128('0x84')]());return dbH['sequelize'][_0x0128('0x2f')](_0x108298['toString'](),{'type':dbH[_0x0128('0x85')][_0x0128('0x86')]['SELECT']});}})[_0x0128('0x23')](function(){return{'sql':_0x1ec73[_0x0128('0x84')]()};})['then'](respondWithResult(_0x218229,null))[_0x0128('0x46')](handleError(_0x218229,null));}; \ No newline at end of file +var _0x7db2=['body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','debug','Limited\x20Query:','QueryTypes','SELECT','MAX(%s)','AVG(%s)','DATE(%s)','keyBy','orderBy','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','randomstring','output','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','run','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','CustomReports','destroy','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x20d204,_0x19e9e8){var _0xc898d=function(_0x5190f0){while(--_0x5190f0){_0x20d204['push'](_0x20d204['shift']());}};_0xc898d(++_0x19e9e8);}(_0x7db2,0xf6));var _0x27db=function(_0x301ad3,_0x3e9eb8){_0x301ad3=_0x301ad3-0x0;var _0x278765=_0x7db2[_0x301ad3];return _0x278765;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27db('0x0'));var zipdir=require(_0x27db('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27db('0x2'));var moment=require(_0x27db('0x3'));var BPromise=require(_0x27db('0x4'));var Mustache=require(_0x27db('0x5'));var util=require(_0x27db('0x6'));var path=require(_0x27db('0x7'));var sox=require('sox');var csv=require(_0x27db('0x8'));var ejs=require(_0x27db('0x9'));var fs=require('fs');var fs_extra=require(_0x27db('0xa'));var _=require(_0x27db('0xb'));var squel=require(_0x27db('0xc'));var crypto=require(_0x27db('0xd'));var jsforce=require(_0x27db('0xe'));var deskjs=require(_0x27db('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x27db('0x10'));var Redis=require('ioredis');var authService=require(_0x27db('0x11'));var qs=require(_0x27db('0x12'));var as=require(_0x27db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27db('0x14'))('api');var utils=require(_0x27db('0x15'));var config=require(_0x27db('0x16'));var licenseUtil=require(_0x27db('0x17'));var db=require(_0x27db('0x18'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x4f70d2,_0xf3a3f1){_0xf3a3f1=_0xf3a3f1||0xcc;return function(_0x597adc){if(_0x597adc){return _0x4f70d2[_0x27db('0x19')](_0xf3a3f1);}return _0x4f70d2['status'](_0xf3a3f1)[_0x27db('0x1a')]();};}function respondWithResult(_0x22a54b,_0x439ddd){_0x439ddd=_0x439ddd||0xc8;return function(_0x4dba5f){if(_0x4dba5f){return _0x22a54b[_0x27db('0x1b')](_0x439ddd)[_0x27db('0x1c')](_0x4dba5f);}};}function respondWithFilteredResult(_0x20dad9,_0x2f4ac9){return function(_0x6c9342){if(_0x6c9342){var _0x3ecaf3=typeof _0x2f4ac9['offset']===_0x27db('0x1d')&&typeof _0x2f4ac9[_0x27db('0x1e')]===_0x27db('0x1d');var _0x11bdc4=_0x6c9342[_0x27db('0x1f')];var _0x19f026=_0x3ecaf3?0x0:_0x2f4ac9[_0x27db('0x20')];var _0xb3cbc4=_0x3ecaf3?_0x6c9342[_0x27db('0x1f')]:_0x2f4ac9['offset']+_0x2f4ac9[_0x27db('0x1e')];var _0x4ebb8e;if(_0xb3cbc4>=_0x11bdc4){_0xb3cbc4=_0x11bdc4;_0x4ebb8e=0xc8;}else{_0x4ebb8e=0xce;}_0x20dad9[_0x27db('0x1b')](_0x4ebb8e);return _0x20dad9[_0x27db('0x21')](_0x27db('0x22'),_0x19f026+'-'+_0xb3cbc4+'/'+_0x11bdc4)[_0x27db('0x1c')](_0x6c9342);}return null;};}function patchUpdates(_0x1677a5){return function(_0x33e50f){try{jsonpatch[_0x27db('0x23')](_0x33e50f,_0x1677a5,!![]);}catch(_0x2371cc){return BPromise['reject'](_0x2371cc);}return _0x33e50f[_0x27db('0x24')]();};}function saveUpdates(_0x5bff75,_0x1b8377){return function(_0x23aa92){if(_0x23aa92){return _0x23aa92['update'](_0x5bff75)[_0x27db('0x25')](function(_0x167e1a){return _0x167e1a;});}return null;};}function removeEntity(_0x304d0b,_0x3a6bb4){return function(_0xbbcfda){if(_0xbbcfda){return _0xbbcfda['destroy']()[_0x27db('0x25')](function(){var _0x5d2766=_0xbbcfda[_0x27db('0x26')]({'plain':!![]});var _0x5a6ce5=_0x27db('0x27');return db['UserProfileResource'][_0x27db('0x28')]({'where':{'type':_0x5a6ce5,'resourceId':_0x5d2766['id']}})[_0x27db('0x25')](function(){return _0xbbcfda;});})[_0x27db('0x25')](function(){_0x304d0b[_0x27db('0x1b')](0xcc)[_0x27db('0x1a')]();});}};}function handleEntityNotFound(_0x2898e3,_0x139306){return function(_0x2c0b27){if(!_0x2c0b27){_0x2898e3['sendStatus'](0x194);}return _0x2c0b27;};}function handleError(_0x1d5ebb,_0x1a99f4){_0x1a99f4=_0x1a99f4||0x1f4;return function(_0x17e817){logger['error'](_0x17e817['stack']);if(_0x17e817[_0x27db('0x29')]){delete _0x17e817['name'];}_0x1d5ebb[_0x27db('0x1b')](_0x1a99f4)[_0x27db('0x2a')](_0x17e817);};}exports[_0x27db('0x2b')]=function(_0x593660,_0x5608d0){var _0x2aea6a={},_0x57dbba={},_0xffd462={'count':0x0,'rows':[]};var _0x53c2a7=_[_0x27db('0x2c')](db[_0x27db('0x2d')]['rawAttributes'],function(_0x14827b){return{'name':_0x14827b[_0x27db('0x2e')],'type':_0x14827b[_0x27db('0x2f')][_0x27db('0x30')]};});_0x57dbba[_0x27db('0x31')]=_[_0x27db('0x2c')](_0x53c2a7,_0x27db('0x29'));_0x57dbba[_0x27db('0x32')]=_[_0x27db('0x33')](_0x593660['query']);_0x57dbba[_0x27db('0x34')]=_[_0x27db('0x35')](_0x57dbba['model'],_0x57dbba['query']);_0x2aea6a['attributes']=_[_0x27db('0x35')](_0x57dbba[_0x27db('0x31')],qs['fields'](_0x593660[_0x27db('0x32')][_0x27db('0x36')]));_0x2aea6a[_0x27db('0x37')]=_0x2aea6a[_0x27db('0x37')][_0x27db('0x38')]?_0x2aea6a[_0x27db('0x37')]:_0x57dbba[_0x27db('0x31')];if(!_0x593660[_0x27db('0x32')]['hasOwnProperty'](_0x27db('0x39'))){_0x2aea6a['limit']=qs['limit'](_0x593660[_0x27db('0x32')]['limit']);_0x2aea6a[_0x27db('0x20')]=qs[_0x27db('0x20')](_0x593660[_0x27db('0x32')][_0x27db('0x20')]);}_0x2aea6a[_0x27db('0x3a')]=qs[_0x27db('0x3b')](_0x593660[_0x27db('0x32')]['sort']);_0x2aea6a[_0x27db('0x3c')]=qs[_0x27db('0x34')](_[_0x27db('0x3d')](_0x593660[_0x27db('0x32')],_0x57dbba[_0x27db('0x34')]),_0x53c2a7);if(_0x593660[_0x27db('0x32')][_0x27db('0x3e')]){_0x2aea6a[_0x27db('0x3c')]=_[_0x27db('0x3f')](_0x2aea6a[_0x27db('0x3c')],{'$or':_[_0x27db('0x2c')](_0x53c2a7,function(_0x5e32e6){if(_0x5e32e6[_0x27db('0x2f')]!==_0x27db('0x40')){var _0x218caa={};_0x218caa[_0x5e32e6[_0x27db('0x29')]]={'$like':'%'+_0x593660[_0x27db('0x32')][_0x27db('0x3e')]+'%'};return _0x218caa;}})});}_0x2aea6a=_[_0x27db('0x3f')]({},_0x2aea6a,_0x593660[_0x27db('0x41')]);var _0x20807e={'where':_0x2aea6a[_0x27db('0x3c')]};return db[_0x27db('0x2d')][_0x27db('0x1f')](_0x20807e)['then'](function(_0x14161e){_0xffd462[_0x27db('0x1f')]=_0x14161e;if(_0x593660[_0x27db('0x32')][_0x27db('0x42')]){_0x2aea6a[_0x27db('0x43')]=[{'all':!![]}];}return db[_0x27db('0x2d')][_0x27db('0x44')](_0x2aea6a);})[_0x27db('0x25')](function(_0x553a1a){_0xffd462[_0x27db('0x45')]=_0x553a1a;return _0xffd462;})[_0x27db('0x25')](respondWithFilteredResult(_0x5608d0,_0x2aea6a))['catch'](handleError(_0x5608d0,null));};exports[_0x27db('0x46')]=function(_0x3e1b69,_0x2e17a0){var _0x41c15a={'raw':![],'where':{'id':_0x3e1b69[_0x27db('0x47')]['id']}},_0x33a967={};_0x33a967['model']=_[_0x27db('0x33')](db[_0x27db('0x2d')]['rawAttributes']);_0x33a967['query']=_[_0x27db('0x33')](_0x3e1b69[_0x27db('0x32')]);_0x33a967[_0x27db('0x34')]=_[_0x27db('0x35')](_0x33a967[_0x27db('0x31')],_0x33a967[_0x27db('0x32')]);_0x41c15a[_0x27db('0x37')]=_[_0x27db('0x35')](_0x33a967[_0x27db('0x31')],qs['fields'](_0x3e1b69[_0x27db('0x32')][_0x27db('0x36')]));_0x41c15a[_0x27db('0x37')]=_0x41c15a['attributes']['length']?_0x41c15a[_0x27db('0x37')]:_0x33a967[_0x27db('0x31')];if(_0x3e1b69[_0x27db('0x32')][_0x27db('0x42')]){_0x41c15a[_0x27db('0x43')]=[{'all':!![]}];}_0x41c15a=_['merge']({},_0x41c15a,_0x3e1b69[_0x27db('0x41')]);return db['AnalyticCustomReport']['find'](_0x41c15a)['then'](handleEntityNotFound(_0x2e17a0,null))[_0x27db('0x25')](respondWithResult(_0x2e17a0,null))[_0x27db('0x48')](handleError(_0x2e17a0,null));};exports[_0x27db('0x49')]=function(_0x5b4ebf,_0x1003c0){return db[_0x27db('0x2d')][_0x27db('0x49')](_0x5b4ebf['body'],{})[_0x27db('0x25')](function(_0x1ede38){var _0x2dc872=_0x5b4ebf[_0x27db('0x4a')][_0x27db('0x26')]({'plain':!![]});if(!_0x2dc872)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dc872[_0x27db('0x4b')]===_0x27db('0x4a')){var _0x42f244=_0x1ede38[_0x27db('0x26')]({'plain':!![]});var _0x46480d=_0x27db('0x4c');return db[_0x27db('0x4d')][_0x27db('0x4e')]({'where':{'name':_0x46480d,'userProfileId':_0x2dc872[_0x27db('0x4f')]},'raw':!![]})['then'](function(_0xc164e4){if(_0xc164e4&&_0xc164e4[_0x27db('0x50')]===0x0){return db[_0x27db('0x51')][_0x27db('0x49')]({'name':_0x42f244['name'],'resourceId':_0x42f244['id'],'type':_0x27db('0x27'),'sectionId':_0xc164e4['id']},{})[_0x27db('0x25')](function(){return _0x1ede38;});}else{return _0x1ede38;}})[_0x27db('0x48')](function(_0x5b6778){logger['error'](_0x27db('0x52'),_0x5b6778);throw _0x5b6778;});}return _0x1ede38;})[_0x27db('0x25')](respondWithResult(_0x1003c0,0xc9))['catch'](handleError(_0x1003c0,null));};exports[_0x27db('0x53')]=function(_0x2bdf98,_0x20b632){if(_0x2bdf98[_0x27db('0x54')]['id']){delete _0x2bdf98[_0x27db('0x54')]['id'];}return db[_0x27db('0x2d')][_0x27db('0x4e')]({'where':{'id':_0x2bdf98[_0x27db('0x47')]['id']}})[_0x27db('0x25')](handleEntityNotFound(_0x20b632,null))[_0x27db('0x25')](saveUpdates(_0x2bdf98[_0x27db('0x54')],null))[_0x27db('0x25')](respondWithResult(_0x20b632,null))[_0x27db('0x48')](handleError(_0x20b632,null));};exports[_0x27db('0x28')]=function(_0x261c4d,_0x2ba99d){return db['AnalyticCustomReport'][_0x27db('0x4e')]({'where':{'id':_0x261c4d[_0x27db('0x47')]['id']}})[_0x27db('0x25')](handleEntityNotFound(_0x2ba99d,null))[_0x27db('0x25')](removeEntity(_0x2ba99d,null))['catch'](handleError(_0x2ba99d,null));};exports[_0x27db('0x55')]=function(_0x1bc3f6,_0x2b2ac9){var _0x36f502=0xa;var _0x32a1a0=[_0x27db('0x56'),_0x27db('0x57'),_0x27db('0x58'),_0x27db('0x59')];var _0x4dacbd={'SUM':_0x27db('0x5a'),'COUNT':_0x27db('0x5b'),'COUNT DISTINCT':_0x27db('0x5c'),'MAX':'MAX(%s)','MIN':_0x27db('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x27db('0x5e'),'GROUP_CONCAT ASC':_0x27db('0x5f'),'GROUP_CONCAT DESC':_0x27db('0x60')};var _0x4beb4c={'SEC_TO_TIME':_0x27db('0x61'),'DATE':'DATE(%s)','HOUR':_0x27db('0x62'),'ROUND':_0x27db('0x63'),'UNIX_TIMESTAMP':_0x27db('0x64')};var _0x4fea68=function(_0x466d50){return!_[_0x27db('0x65')]([_0x27db('0x66'),_0x27db('0x67'),_0x27db('0x68'),_0x27db('0x69')],_0x466d50);};var _0x542ab1=function(_0x13b0f2){if(!_0x13b0f2||!_0x13b0f2[_0x27db('0x6a')][_0x27db('0x38')]){return'';}for(var _0x5eea25='(',_0x5b9f79=0x0;_0x5b9f79<_0x13b0f2[_0x27db('0x6a')][_0x27db('0x38')];_0x5b9f79+=0x1){_0x5b9f79>0x0&&(_0x5eea25+='\x20'+_0x13b0f2[_0x27db('0x6b')]+'\x20');_0x5eea25+=_0x13b0f2['rules'][_0x5b9f79][_0x27db('0x6c')]?_0x542ab1(_0x13b0f2[_0x27db('0x6a')][_0x5b9f79][_0x27db('0x6c')]):_0x13b0f2['rules'][_0x5b9f79][_0x27db('0x6d')]+'\x20'+_0x13b0f2[_0x27db('0x6a')][_0x5b9f79][_0x27db('0x6e')]+(_0x4fea68(_0x13b0f2[_0x27db('0x6a')][_0x5b9f79][_0x27db('0x6e')])?'\x20'+_0x13b0f2['rules'][_0x5b9f79][_0x27db('0x6f')]:'');}return _0x5eea25+')';};var _0x19ac41={'where':{'id':_0x1bc3f6[_0x27db('0x47')]['id']}},_0x55f1ba,_0x432f07,_0x3e8bd2,_0x4b49f9,_0x4331d1;_0x19ac41=_[_0x27db('0x3f')]({},_0x19ac41,_0x1bc3f6[_0x27db('0x41')]);return db['AnalyticCustomReport'][_0x27db('0x4e')](_0x19ac41)[_0x27db('0x25')](function(_0x2fa1ee){if(_0x2fa1ee){_0x55f1ba=_0x2fa1ee;return _0x2fa1ee[_0x27db('0x70')]();}return null;})['then'](function(_0xd6fac3){if(_0xd6fac3){if(!_0xd6fac3[_0x27db('0x38')]){throw new db[(_0x27db('0x71'))][(_0x27db('0x72'))](_0x27db('0x73'),0x193);}_0x432f07=_0xd6fac3;return db[_0x27db('0x74')][_0x27db('0x44')]({'raw':!![]});}return null;})['then'](function(_0x56b560){if(_0x56b560){_0x3e8bd2=_['keyBy'](_0x56b560,'id');var _0x23b39e;var _0x4e343e=squel[_0x27db('0x75')]();_0x4e343e[_0x27db('0x76')](_0x55f1ba[_0x27db('0x77')]);for(var _0x5150d9=0x0;_0x5150d9<_0x432f07[_0x27db('0x38')];_0x5150d9+=0x1){_0x23b39e=_0x432f07[_0x5150d9][_0x27db('0x78')]?_0x3e8bd2[_0x432f07[_0x5150d9][_0x27db('0x78')]][_0x27db('0x79')]:_0x432f07[_0x5150d9][_0x27db('0x6d')];_0x23b39e=_0x432f07[_0x5150d9][_0x27db('0x7a')]?_[_0x27db('0x7b')](_0x4dacbd[_0x432f07[_0x5150d9]['function']],'%s',_0x23b39e):_0x23b39e;_0x23b39e=_0x432f07[_0x5150d9][_0x27db('0x7c')]?_[_0x27db('0x7b')](_0x4beb4c[_0x432f07[_0x5150d9]['format']],'%s',_0x23b39e):_0x23b39e;if(_0x432f07[_0x5150d9][_0x27db('0x7d')]){_0x4e343e[_0x27db('0x6c')](_0x23b39e);}_0x432f07[_0x5150d9]['orderBy']&&_0x4e343e['order'](_0x23b39e,_0x432f07[_0x5150d9]['orderBy']===_0x27db('0x7e')?![]:!![]);_0x4e343e[_0x27db('0x6d')](_0x23b39e,_0x432f07[_0x5150d9]['alias']||_0x23b39e);}if(_0x55f1ba['joins']){_0x55f1ba[_0x27db('0x7f')]=JSON[_0x27db('0x80')](_0x55f1ba[_0x27db('0x7f')]);for(var _0x765e98=0x0;_0x765e98<_0x55f1ba['joins'][_0x27db('0x38')];_0x765e98+=0x1){if(_0x55f1ba[_0x27db('0x7f')][_0x765e98]['type']&&_[_0x27db('0x65')](_0x32a1a0,_0x55f1ba[_0x27db('0x7f')][_0x765e98]['type'])&&_0x55f1ba[_0x27db('0x7f')][_0x765e98][_0x27db('0x81')]&&_0x55f1ba[_0x27db('0x7f')][_0x765e98]['foreignTable']&&_0x55f1ba[_0x27db('0x7f')][_0x765e98][_0x27db('0x82')]){_0x4e343e[_0x55f1ba['joins'][_0x765e98][_0x27db('0x2f')]](_0x55f1ba[_0x27db('0x7f')][_0x765e98][_0x27db('0x83')],null,util[_0x27db('0x7c')]('%s.%s\x20=\x20%s.%s',_0x55f1ba['table'],_0x55f1ba[_0x27db('0x7f')][_0x765e98]['parentKey'],_0x55f1ba[_0x27db('0x7f')][_0x765e98][_0x27db('0x83')],_0x55f1ba[_0x27db('0x7f')][_0x765e98][_0x27db('0x82')]));}}}if(_0x55f1ba[_0x27db('0x84')]){_0x55f1ba[_0x27db('0x84')]=JSON['parse'](_0x55f1ba[_0x27db('0x84')]);_0x4e343e[_0x27db('0x3c')](_0x542ab1(_0x55f1ba[_0x27db('0x84')][_0x27db('0x6c')]));}_0x4331d1=_0x4e343e[_0x27db('0x85')]();_0x4e343e[_0x27db('0x1e')](_0x36f502);_0x4e343e[_0x27db('0x20')](0x0);logger[_0x27db('0x86')](_0x27db('0x87'),_0x4e343e['toString']());return dbH['sequelize'][_0x27db('0x32')](_0x4e343e['toString'](),{'type':dbH['sequelize'][_0x27db('0x88')][_0x27db('0x89')]});}})['then'](respondWithResult(_0x2b2ac9,null))['catch'](handleError(_0x2b2ac9,null));};function runReport(_0x4ae0c4,_0x263238,_0x52ec26){var _0x42fc8e=_0x263238[_0x27db('0x29')];var _0x7b950d=0xa;var _0x2b63d9=['join','left_join',_0x27db('0x58'),'cross_join'];var _0x50aaa1={'SUM':'SUM(%s)','COUNT':_0x27db('0x5b'),'COUNT DISTINCT':_0x27db('0x5c'),'MAX':_0x27db('0x8a'),'MIN':_0x27db('0x5d'),'AVG':_0x27db('0x8b'),'GROUP_CONCAT':_0x27db('0x5e'),'GROUP_CONCAT ASC':_0x27db('0x5f'),'GROUP_CONCAT DESC':_0x27db('0x60')};var _0x5bb87a={'SEC_TO_TIME':_0x27db('0x61'),'DATE':_0x27db('0x8c'),'HOUR':_0x27db('0x62'),'ROUND':_0x27db('0x63'),'UNIX_TIMESTAMP':_0x27db('0x64')};var _0x4785e0=function(_0x12b57c){return!_[_0x27db('0x65')](['IS\x20NULL',_0x27db('0x67'),_0x27db('0x68'),_0x27db('0x69')],_0x12b57c);};var _0x436477=function(_0x1568a9){if(!_0x1568a9||!_0x1568a9['rules'][_0x27db('0x38')]){return'';}for(var _0x24caf7='(',_0x50ebfc=0x0;_0x50ebfc<_0x1568a9[_0x27db('0x6a')][_0x27db('0x38')];_0x50ebfc+=0x1){_0x50ebfc>0x0&&(_0x24caf7+='\x20'+_0x1568a9[_0x27db('0x6b')]+'\x20');_0x24caf7+=_0x1568a9[_0x27db('0x6a')][_0x50ebfc][_0x27db('0x6c')]?_0x436477(_0x1568a9[_0x27db('0x6a')][_0x50ebfc][_0x27db('0x6c')]):_0x1568a9[_0x27db('0x6a')][_0x50ebfc][_0x27db('0x6d')]+'\x20'+_0x1568a9[_0x27db('0x6a')][_0x50ebfc][_0x27db('0x6e')]+(_0x4785e0(_0x1568a9[_0x27db('0x6a')][_0x50ebfc]['condition'])?'\x20'+_0x1568a9['rules'][_0x50ebfc][_0x27db('0x6f')]:'');}return _0x24caf7+')';};var _0x383c0a={'where':{'id':_0x4ae0c4['id']}},_0x50b376,_0x5b72f3,_0x55bb1c,_0x37b4dd,_0x1b07a9;_0x383c0a=_[_0x27db('0x3f')]({},_0x383c0a,_0x52ec26);return db[_0x27db('0x2d')][_0x27db('0x4e')](_0x383c0a)['then'](function(_0x1f09c8){if(_0x1f09c8){_0x50b376=_0x1f09c8;return _0x1f09c8[_0x27db('0x70')]();}return null;})[_0x27db('0x25')](function(_0x219269){if(_0x219269){if(!_0x219269[_0x27db('0x38')]){throw new db[(_0x27db('0x71'))][(_0x27db('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b72f3=_0x219269;return db[_0x27db('0x74')][_0x27db('0x44')]({'raw':!![]});}return null;})[_0x27db('0x25')](function(_0x9e927e){if(_0x9e927e){_0x55bb1c=_[_0x27db('0x8d')](_0x9e927e,'id');var _0x313cf3;var _0x57ad5a=squel['select']();_0x57ad5a[_0x27db('0x76')](_0x50b376[_0x27db('0x77')]);for(var _0x159b28=0x0;_0x159b28<_0x5b72f3[_0x27db('0x38')];_0x159b28+=0x1){_0x313cf3=_0x5b72f3[_0x159b28][_0x27db('0x78')]?_0x55bb1c[_0x5b72f3[_0x159b28][_0x27db('0x78')]]['metric']:_0x5b72f3[_0x159b28][_0x27db('0x6d')];_0x313cf3=_0x5b72f3[_0x159b28][_0x27db('0x7a')]?_[_0x27db('0x7b')](_0x50aaa1[_0x5b72f3[_0x159b28]['function']],'%s',_0x313cf3):_0x313cf3;_0x313cf3=_0x5b72f3[_0x159b28][_0x27db('0x7c')]?_[_0x27db('0x7b')](_0x5bb87a[_0x5b72f3[_0x159b28][_0x27db('0x7c')]],'%s',_0x313cf3):_0x313cf3;if(_0x5b72f3[_0x159b28][_0x27db('0x7d')]){_0x57ad5a[_0x27db('0x6c')](_0x313cf3);}_0x5b72f3[_0x159b28][_0x27db('0x8e')]&&_0x57ad5a[_0x27db('0x3a')](_0x313cf3,_0x5b72f3[_0x159b28][_0x27db('0x8e')]===_0x27db('0x7e')?![]:!![]);_0x57ad5a[_0x27db('0x6d')](_0x313cf3,_0x5b72f3[_0x159b28]['alias']||_0x313cf3);}if(_0x50b376[_0x27db('0x7f')]){_0x50b376['joins']=JSON[_0x27db('0x80')](_0x50b376[_0x27db('0x7f')]);for(var _0x2929a8=0x0;_0x2929a8<_0x50b376[_0x27db('0x7f')][_0x27db('0x38')];_0x2929a8+=0x1){if(_0x50b376['joins'][_0x2929a8]['type']&&_[_0x27db('0x65')](_0x2b63d9,_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x2f')])&&_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x81')]&&_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x83')]&&_0x50b376['joins'][_0x2929a8][_0x27db('0x82')]){_0x57ad5a[_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x2f')]](_0x50b376['joins'][_0x2929a8][_0x27db('0x83')],null,util[_0x27db('0x7c')](_0x27db('0x8f'),_0x50b376[_0x27db('0x77')],_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x81')],_0x50b376[_0x27db('0x7f')][_0x2929a8][_0x27db('0x83')],_0x50b376[_0x27db('0x7f')][_0x2929a8]['foreignKey']));}}}if(_0x50b376[_0x27db('0x84')]){_0x50b376[_0x27db('0x84')]=JSON[_0x27db('0x80')](_0x50b376[_0x27db('0x84')]);_0x57ad5a[_0x27db('0x3c')](_0x436477(_0x50b376[_0x27db('0x84')][_0x27db('0x6c')]));}_0x1b07a9=_0x57ad5a[_0x27db('0x85')]();_0x57ad5a['limit'](_0x7b950d);_0x57ad5a[_0x27db('0x20')](0x0);return;}})[_0x27db('0x25')](function(){if(_0x263238['output']===_0x27db('0x90')){return null;}var _0x5c0854=_['merge'](_0x263238,{'name':_0x263238[_0x27db('0x91')]||_0x263238[_0x27db('0x29')]||_0x50b376[_0x27db('0x29')],'basename':_0x42fc8e,'savename':util[_0x27db('0x7c')](_0x27db('0x92'),_0x263238[_0x27db('0x29')]||_0x50b376[_0x27db('0x29')],require(_0x27db('0x93'))['generate'](0x4),_0x263238[_0x27db('0x94')]||'csv'),'reportId':_0x50b376['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x27db('0x49')](_0x5c0854,{'raw':!![]});})[_0x27db('0x25')](function(_0x574f50){if(_0x50b376[_0x27db('0x77')]===_0x27db('0x95')){_0x1b07a9['where'](_0x50b376[_0x27db('0x77')]+_0x27db('0x96'),_0x263238[_0x27db('0x97')],_0x263238[_0x27db('0x98')]);}else{_0x1b07a9['where'](_0x50b376[_0x27db('0x77')]+_0x27db('0x99'),_0x263238[_0x27db('0x97')],_0x263238[_0x27db('0x98')]);}if(_0x574f50){logger[_0x27db('0x9a')]('Run\x20Query:',_0x1b07a9[_0x27db('0x9b')]());require(_0x27db('0x9c'))[_0x27db('0x9d')](path[_0x27db('0x56')](__dirname,_0x27db('0x9e'),_0x574f50['output']),[_0x574f50['id'],_0x1b07a9[_0x27db('0x9b')](),path[_0x27db('0x56')](__dirname,_0x27db('0x9f'),_0x574f50[_0x27db('0xa0')]),_0x42fc8e]);return _0x574f50;}else{var _0x1a5bb2=squel[_0x27db('0x75')]();_0x1a5bb2[_0x27db('0x76')]('('+_0x1b07a9['toString']()+')',_0x27db('0xa1'));_0x1a5bb2['field'](_0x27db('0xa2'),_0x27db('0x1f'));_0x1b07a9['limit'](_0x263238[_0x27db('0x1e')]||_0x7b950d);_0x1b07a9['offset'](_0x263238[_0x27db('0x20')]||0x0);return dbH[_0x27db('0xa3')][_0x27db('0x32')](_0x1a5bb2[_0x27db('0x9b')](),{'type':dbH[_0x27db('0xa3')][_0x27db('0x88')][_0x27db('0x89')]})[_0x27db('0x25')](function(_0xbd556c){if(!_0xbd556c[_0x27db('0x38')]){_0x37b4dd=0x0;}else{_0x37b4dd=_0xbd556c[0x0][_0x27db('0x1f')]||0x0;}return dbH[_0x27db('0xa3')][_0x27db('0x32')](_0x1b07a9[_0x27db('0x9b')](),{'type':dbH[_0x27db('0xa3')]['QueryTypes'][_0x27db('0x89')]});})['then'](function(_0x2d72c3){return{'rows':_0x2d72c3||[],'count':_0x37b4dd};});}});}exports[_0x27db('0xa4')]=function(_0x1df95c,_0x93548b){return runReport(_0x1df95c[_0x27db('0x47')],_0x1df95c[_0x27db('0x32')],_0x1df95c['options'])[_0x27db('0x25')](respondWithResult(_0x93548b,null))['catch'](handleError(_0x93548b,null));};exports['runReport']=runReport;exports['query']=function(_0x2f5184,_0x318c9a){var _0x312e35=0xa;var _0x2447c2=[_0x27db('0x56'),_0x27db('0x57'),'right_join','cross_join'];var _0x54f2fe={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x27db('0x5c'),'MAX':_0x27db('0x8a'),'MIN':'MIN(%s)','AVG':_0x27db('0x8b'),'GROUP_CONCAT':_0x27db('0x5e'),'GROUP_CONCAT ASC':_0x27db('0x5f'),'GROUP_CONCAT DESC':_0x27db('0x60')};var _0x4269de={'SEC_TO_TIME':_0x27db('0x61'),'DATE':_0x27db('0x8c'),'HOUR':_0x27db('0x62'),'ROUND':_0x27db('0x63'),'UNIX_TIMESTAMP':_0x27db('0x64')};var _0x3623ae=function(_0x58d723){return!_['includes'](['IS\x20NULL',_0x27db('0x67'),_0x27db('0x68'),_0x27db('0x69')],_0x58d723);};var _0x5853d2=function(_0x49dddb){if(!_0x49dddb||!_0x49dddb['rules'][_0x27db('0x38')]){return'';}for(var _0x1160b8='(',_0x193afe=0x0;_0x193afe<_0x49dddb[_0x27db('0x6a')][_0x27db('0x38')];_0x193afe+=0x1){_0x193afe>0x0&&(_0x1160b8+='\x20'+_0x49dddb[_0x27db('0x6b')]+'\x20');_0x1160b8+=_0x49dddb['rules'][_0x193afe][_0x27db('0x6c')]?_0x5853d2(_0x49dddb[_0x27db('0x6a')][_0x193afe]['group']):_0x49dddb[_0x27db('0x6a')][_0x193afe]['field']+'\x20'+_0x49dddb[_0x27db('0x6a')][_0x193afe][_0x27db('0x6e')]+(_0x3623ae(_0x49dddb['rules'][_0x193afe][_0x27db('0x6e')])?'\x20'+_0x49dddb[_0x27db('0x6a')][_0x193afe][_0x27db('0x6f')]:'');}return _0x1160b8+')';};var _0x1c9ee8={'where':{'id':_0x2f5184[_0x27db('0x47')]['id']}},_0x48112c,_0x29f136,_0x5a652f,_0x3db6d4,_0x4677f7;_0x1c9ee8=_[_0x27db('0x3f')]({},_0x1c9ee8,_0x2f5184[_0x27db('0x41')]);return db[_0x27db('0x2d')][_0x27db('0x4e')](_0x1c9ee8)[_0x27db('0x25')](function(_0x11fd2e){if(_0x11fd2e){_0x48112c=_0x11fd2e;return _0x11fd2e['getFields']();}return null;})['then'](function(_0x123611){if(_0x123611){if(!_0x123611['length']){throw new db['Sequelize'][(_0x27db('0x72'))](_0x27db('0x73'),0x193);}_0x29f136=_0x123611;return db[_0x27db('0x74')][_0x27db('0x44')]({'raw':!![]});}return null;})[_0x27db('0x25')](function(_0x208239){if(_0x208239){_0x5a652f=_[_0x27db('0x8d')](_0x208239,'id');var _0x43cf83;var _0x52cbd6=squel[_0x27db('0x75')]();_0x52cbd6[_0x27db('0x76')](_0x48112c[_0x27db('0x77')]);for(var _0x2f5611=0x0;_0x2f5611<_0x29f136[_0x27db('0x38')];_0x2f5611+=0x1){_0x43cf83=_0x29f136[_0x2f5611][_0x27db('0x78')]?_0x5a652f[_0x29f136[_0x2f5611][_0x27db('0x78')]][_0x27db('0x79')]:_0x29f136[_0x2f5611]['field'];_0x43cf83=_0x29f136[_0x2f5611][_0x27db('0x7a')]?_[_0x27db('0x7b')](_0x54f2fe[_0x29f136[_0x2f5611]['function']],'%s',_0x43cf83):_0x43cf83;_0x43cf83=_0x29f136[_0x2f5611][_0x27db('0x7c')]?_[_0x27db('0x7b')](_0x4269de[_0x29f136[_0x2f5611]['format']],'%s',_0x43cf83):_0x43cf83;if(_0x29f136[_0x2f5611][_0x27db('0x7d')]){_0x52cbd6[_0x27db('0x6c')](_0x43cf83);}_0x29f136[_0x2f5611][_0x27db('0x8e')]&&_0x52cbd6[_0x27db('0x3a')](_0x43cf83,_0x29f136[_0x2f5611][_0x27db('0x8e')]===_0x27db('0x7e')?![]:!![]);_0x52cbd6[_0x27db('0x6d')](_0x43cf83,_0x29f136[_0x2f5611]['alias']||_0x43cf83);}if(_0x48112c['joins']){_0x48112c[_0x27db('0x7f')]=JSON['parse'](_0x48112c[_0x27db('0x7f')]);for(var _0xf468b2=0x0;_0xf468b2<_0x48112c['joins'][_0x27db('0x38')];_0xf468b2+=0x1){if(_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x2f')]&&_['includes'](_0x2447c2,_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x2f')])&&_0x48112c['joins'][_0xf468b2][_0x27db('0x81')]&&_0x48112c['joins'][_0xf468b2][_0x27db('0x83')]&&_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x82')]){_0x52cbd6[_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x2f')]](_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x83')],null,util[_0x27db('0x7c')]('%s.%s\x20=\x20%s.%s',_0x48112c['table'],_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x81')],_0x48112c[_0x27db('0x7f')][_0xf468b2][_0x27db('0x83')],_0x48112c['joins'][_0xf468b2][_0x27db('0x82')]));}}}if(_0x48112c[_0x27db('0x84')]){_0x48112c[_0x27db('0x84')]=JSON['parse'](_0x48112c[_0x27db('0x84')]);_0x52cbd6['where'](_0x5853d2(_0x48112c['conditions']['group']));}_0x4677f7=_0x52cbd6[_0x27db('0x85')]();_0x52cbd6['limit'](_0x312e35);_0x52cbd6[_0x27db('0x20')](0x0);logger[_0x27db('0x86')](_0x27db('0x87'),_0x52cbd6[_0x27db('0x9b')]());return dbH[_0x27db('0xa3')][_0x27db('0x32')](_0x52cbd6[_0x27db('0x9b')](),{'type':dbH['sequelize']['QueryTypes'][_0x27db('0x89')]});}})[_0x27db('0x25')](function(){return{'sql':_0x4677f7['toString']()};})[_0x27db('0x25')](respondWithResult(_0x318c9a,null))[_0x27db('0x48')](handleError(_0x318c9a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6955124..3e6a786 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 _0xb147=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20fc8c,_0x1c5379){var _0x3b1899=function(_0x151093){while(--_0x151093){_0x20fc8c['push'](_0x20fc8c['shift']());}};_0x3b1899(++_0x1c5379);}(_0xb147,0x116));var _0x7b14=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0xb147[_0x3f0d76];return _0x12c12e;};'use strict';var _=require(_0x7b14('0x0'));var util=require(_0x7b14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7b14('0x2'));var BPromise=require(_0x7b14('0x3'));var rp=require(_0x7b14('0x4'));var fs=require('fs');var path=require(_0x7b14('0x5'));var rimraf=require(_0x7b14('0x6'));var config=require(_0x7b14('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x2336be,_0x42479d){return _0x2336be[_0x7b14('0x8')](_0x7b14('0x9'),attributes,{'tableName':_0x7b14('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39c0=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x44ad1c,_0x530bf0){var _0x30a66a=function(_0xb30d83){while(--_0xb30d83){_0x44ad1c['push'](_0x44ad1c['shift']());}};_0x30a66a(++_0x530bf0);}(_0x39c0,0x149));var _0x039c=function(_0x2727a5,_0xfb2cf5){_0x2727a5=_0x2727a5-0x0;var _0x40666c=_0x39c0[_0x2727a5];return _0x40666c;};'use strict';var _=require(_0x039c('0x0'));var util=require(_0x039c('0x1'));var logger=require(_0x039c('0x2'))(_0x039c('0x3'));var moment=require(_0x039c('0x4'));var BPromise=require(_0x039c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x039c('0x6'));var rimraf=require(_0x039c('0x7'));var config=require(_0x039c('0x8'));var attributes=require(_0x039c('0x9'));module[_0x039c('0xa')]=function(_0xae0497,_0x548cac){return _0xae0497[_0x039c('0xb')](_0x039c('0xc'),attributes,{'tableName':_0x039c('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 470efff..1f43f47 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 _0x6200=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info'];(function(_0x493e5e,_0x2b7505){var _0x321e0b=function(_0x38d039){while(--_0x38d039){_0x493e5e['push'](_0x493e5e['shift']());}};_0x321e0b(++_0x2b7505);}(_0x6200,0x178));var _0x0620=function(_0x245d86,_0x341d4f){_0x245d86=_0x245d86-0x0;var _0x1511d6=_0x6200[_0x245d86];return _0x1511d6;};'use strict';var _=require(_0x0620('0x0'));var util=require(_0x0620('0x1'));var moment=require(_0x0620('0x2'));var BPromise=require(_0x0620('0x3'));var rs=require(_0x0620('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0620('0x5'))['db'];var utils=require(_0x0620('0x6'));var logger=require(_0x0620('0x7'))('rpc');var config=require(_0x0620('0x8'));var jayson=require(_0x0620('0x9'));var client=jayson[_0x0620('0xa')][_0x0620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x175dcf,_0x3867a5,_0x595b80){return new BPromise(function(_0x40171f,_0x1bc460){return client['request'](_0x175dcf,_0x595b80)['then'](function(_0x3db312){logger['info'](_0x0620('0xc'),_0x3867a5,'request\x20sent');logger[_0x0620('0xd')](_0x0620('0xe'),_0x3867a5,_0x0620('0xf'),JSON['stringify'](_0x3db312));if(_0x3db312['error']){if(_0x3db312['error'][_0x0620('0x10')]===0x1f4){logger[_0x0620('0x11')](_0x0620('0xc'),_0x3867a5,_0x3db312[_0x0620('0x11')]['message']);return _0x1bc460(_0x3db312[_0x0620('0x11')]['message']);}logger[_0x0620('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3867a5,_0x3db312[_0x0620('0x11')][_0x0620('0x12')]);return _0x40171f(_0x3db312[_0x0620('0x11')][_0x0620('0x12')]);}else{logger[_0x0620('0x13')](_0x0620('0xc'),_0x3867a5,_0x0620('0xf'));_0x40171f(_0x3db312[_0x0620('0x14')][_0x0620('0x12')]);}})[_0x0620('0x15')](function(_0x5a108e){logger['error'](_0x0620('0xc'),_0x3867a5,_0x5a108e);_0x1bc460(_0x5a108e);});});} \ No newline at end of file +var _0xd03b=['../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bcd02,_0x401b12){var _0x4696eb=function(_0x35a989){while(--_0x35a989){_0x4bcd02['push'](_0x4bcd02['shift']());}};_0x4696eb(++_0x401b12);}(_0xd03b,0xd5));var _0xbd03=function(_0x1ed3da,_0x1e549f){_0x1ed3da=_0x1ed3da-0x0;var _0x368b7f=_0xd03b[_0x1ed3da];return _0x368b7f;};'use strict';var _=require(_0xbd03('0x0'));var util=require(_0xbd03('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbd03('0x2'));var fs=require('fs');var Redis=require(_0xbd03('0x3'));var db=require(_0xbd03('0x4'))['db'];var utils=require(_0xbd03('0x5'));var logger=require(_0xbd03('0x6'))('rpc');var config=require(_0xbd03('0x7'));var jayson=require(_0xbd03('0x8'));var client=jayson[_0xbd03('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c63e,_0x201a3b,_0x4a3f5d){return new BPromise(function(_0x1838d7,_0x5479c7){return client[_0xbd03('0xa')](_0x27c63e,_0x4a3f5d)['then'](function(_0x4bf5dc){logger[_0xbd03('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x201a3b,_0xbd03('0xc'));logger[_0xbd03('0xd')](_0xbd03('0xe'),_0x201a3b,_0xbd03('0xc'),JSON[_0xbd03('0xf')](_0x4bf5dc));if(_0x4bf5dc[_0xbd03('0x10')]){if(_0x4bf5dc[_0xbd03('0x10')]['code']===0x1f4){logger[_0xbd03('0x10')](_0xbd03('0x11'),_0x201a3b,_0x4bf5dc['error'][_0xbd03('0x12')]);return _0x5479c7(_0x4bf5dc[_0xbd03('0x10')][_0xbd03('0x12')]);}logger[_0xbd03('0x10')](_0xbd03('0x11'),_0x201a3b,_0x4bf5dc['error'][_0xbd03('0x12')]);return _0x1838d7(_0x4bf5dc[_0xbd03('0x10')][_0xbd03('0x12')]);}else{logger['info'](_0xbd03('0x11'),_0x201a3b,_0xbd03('0xc'));_0x1838d7(_0x4bf5dc['result'][_0xbd03('0x12')]);}})[_0xbd03('0x13')](function(_0x328dec){logger[_0xbd03('0x10')](_0xbd03('0x11'),_0x201a3b,_0x328dec);_0x5479c7(_0x328dec);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 041ddf0..fe41d3a 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 _0x79cd=['/:id','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x24163b,_0x50b658){var _0x5840d1=function(_0x208200){while(--_0x208200){_0x24163b['push'](_0x24163b['shift']());}};_0x5840d1(++_0x50b658);}(_0x79cd,0x11f));var _0xd79c=function(_0x4cf794,_0x182a8a){_0x4cf794=_0x4cf794-0x0;var _0x289096=_0x79cd[_0x4cf794];return _0x289096;};'use strict';var multer=require(_0xd79c('0x0'));var util=require(_0xd79c('0x1'));var path=require(_0xd79c('0x2'));var timeout=require(_0xd79c('0x3'));var express=require(_0xd79c('0x4'));var router=express[_0xd79c('0x5')]();var fs_extra=require(_0xd79c('0x6'));var auth=require(_0xd79c('0x7'));var interaction=require(_0xd79c('0x8'));var config=require(_0xd79c('0x9'));var controller=require(_0xd79c('0xa'));router[_0xd79c('0xb')]('/',auth[_0xd79c('0xc')](),controller['index']);router['get'](_0xd79c('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xd79c('0xe')]);router[_0xd79c('0xb')](_0xd79c('0xf'),auth[_0xd79c('0xc')](),controller[_0xd79c('0x10')]);router[_0xd79c('0xb')](_0xd79c('0x11'),auth[_0xd79c('0xc')](),controller[_0xd79c('0x12')]);router[_0xd79c('0x13')]('/',auth[_0xd79c('0xc')](),controller[_0xd79c('0x14')]);router['put'](_0xd79c('0xd'),auth[_0xd79c('0xc')](),controller[_0xd79c('0x15')]);router[_0xd79c('0x16')](_0xd79c('0xd'),auth[_0xd79c('0xc')](),controller[_0xd79c('0x17')]);module[_0xd79c('0x18')]=router; \ No newline at end of file +var _0x8db1=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports'];(function(_0xf4de83,_0x5d3a41){var _0x13b505=function(_0x55e2f2){while(--_0x55e2f2){_0xf4de83['push'](_0xf4de83['shift']());}};_0x13b505(++_0x5d3a41);}(_0x8db1,0x84));var _0x18db=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8db1[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x18db('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x18db('0x1'));var router=express['Router']();var fs_extra=require(_0x18db('0x2'));var auth=require(_0x18db('0x3'));var interaction=require(_0x18db('0x4'));var config=require(_0x18db('0x5'));var controller=require(_0x18db('0x6'));router[_0x18db('0x7')]('/',auth[_0x18db('0x8')](),controller['index']);router[_0x18db('0x7')](_0x18db('0x9'),auth[_0x18db('0x8')](),controller[_0x18db('0xa')]);router[_0x18db('0x7')](_0x18db('0xb'),auth[_0x18db('0x8')](),controller[_0x18db('0xc')]);router[_0x18db('0x7')](_0x18db('0xd'),auth['isAuthenticated'](),controller[_0x18db('0xe')]);router[_0x18db('0x7')](_0x18db('0xf'),auth[_0x18db('0x8')](),controller[_0x18db('0x10')]);router[_0x18db('0x11')]('/',auth[_0x18db('0x8')](),controller[_0x18db('0x12')]);router[_0x18db('0x13')](_0x18db('0x9'),auth[_0x18db('0x8')](),controller[_0x18db('0x14')]);router['delete'](_0x18db('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x18db('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 b4ed04c..28c157c 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x833d5f,_0x2d47b3){var _0x9ea801=function(_0x1d3e48){while(--_0x1d3e48){_0x833d5f['push'](_0x833d5f['shift']());}};_0x9ea801(++_0x2d47b3);}(_0x7c09,0x102));var _0x97c0=function(_0x5e94e7,_0x4f3eb2){_0x5e94e7=_0x5e94e7-0x0;var _0x208ced=_0x7c09[_0x5e94e7];return _0x208ced;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4b332a,_0x442c93){_0x4b332a=_0x4b332a-0x0;var _0xd1af10=_0x8ef6[_0x4b332a];return _0xd1af10;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 11046fb..0117a7c 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','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','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x21f607,_0x57683d){var _0x3226d7=function(_0x152d74){while(--_0x152d74){_0x21f607['push'](_0x21f607['shift']());}};_0x3226d7(++_0x57683d);}(_0x1967,0x173));var _0x7196=function(_0x350c49,_0xb8436f){_0x350c49=_0x350c49-0x0;var _0x43ac1f=_0x1967[_0x350c49];return _0x43ac1f;};'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'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%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)','UNIX_TIMESTAMP(%s)','includes'];(function(_0xa0e317,_0xf5c888){var _0x4e6c74=function(_0x3eed4d){while(--_0x3eed4d){_0xa0e317['push'](_0xa0e317['shift']());}};_0x4e6c74(++_0xf5c888);}(_0x53ec,0x192));var _0xc53e=function(_0x39ff0c,_0x2069c7){_0x39ff0c=_0x39ff0c-0x0;var _0x5c4ca6=_0x53ec[_0x39ff0c];return _0x5c4ca6;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d0ad76b..413119f 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 _0x159b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports'];(function(_0x1a3d07,_0x105a71){var _0xd0058a=function(_0x213e53){while(--_0x213e53){_0x1a3d07['push'](_0x1a3d07['shift']());}};_0xd0058a(++_0x105a71);}(_0x159b,0x138));var _0xb159=function(_0x35030,_0x4478d1){_0x35030=_0x35030-0x0;var _0x1af59b=_0x159b[_0x35030];return _0x1af59b;};'use strict';var _=require('lodash');var util=require(_0xb159('0x0'));var logger=require(_0xb159('0x1'))(_0xb159('0x2'));var moment=require(_0xb159('0x3'));var BPromise=require('bluebird');var rp=require(_0xb159('0x4'));var fs=require('fs');var path=require(_0xb159('0x5'));var rimraf=require(_0xb159('0x6'));var config=require(_0xb159('0x7'));var attributes=require(_0xb159('0x8'));module[_0xb159('0x9')]=function(_0x4fd580,_0xc3dab2){return _0x4fd580[_0xb159('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xb159('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777e=['analytics_default_reports','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','AnalyticDefaultReport'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x777e,0x135));var _0xe777=function(_0x1988b0,_0x1fa6a0){_0x1988b0=_0x1988b0-0x0;var _0x1240b2=_0x777e[_0x1988b0];return _0x1240b2;};'use strict';var _=require(_0xe777('0x0'));var util=require(_0xe777('0x1'));var logger=require(_0xe777('0x2'))(_0xe777('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe777('0x4'));var fs=require('fs');var path=require(_0xe777('0x5'));var rimraf=require(_0xe777('0x6'));var config=require(_0xe777('0x7'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x53efd7,_0x18a129){return _0x53efd7[_0xe777('0x8')](_0xe777('0x9'),attributes,{'tableName':_0xe777('0xa'),'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 6b6666a..9df1779 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 _0x6add=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x6add,0x191));var _0xd6ad=function(_0x3ba03c,_0x17833b){_0x3ba03c=_0x3ba03c-0x0;var _0x5f29ff=_0x6add[_0x3ba03c];return _0x5f29ff;};'use strict';var _=require('lodash');var util=require(_0xd6ad('0x0'));var moment=require(_0xd6ad('0x1'));var BPromise=require(_0xd6ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6ad('0x3'));var db=require(_0xd6ad('0x4'))['db'];var utils=require(_0xd6ad('0x5'));var logger=require(_0xd6ad('0x6'))(_0xd6ad('0x7'));var config=require(_0xd6ad('0x8'));var jayson=require(_0xd6ad('0x9'));var client=jayson[_0xd6ad('0xa')][_0xd6ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f872a,_0x4436a6,_0x44a26){return new BPromise(function(_0x4e69b9,_0x4bb05c){return client['request'](_0x1f872a,_0x44a26)[_0xd6ad('0xc')](function(_0x27b5ea){logger[_0xd6ad('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4436a6,_0xd6ad('0xe'));logger[_0xd6ad('0xf')](_0xd6ad('0x10'),_0x4436a6,_0xd6ad('0xe'),JSON[_0xd6ad('0x11')](_0x27b5ea));if(_0x27b5ea[_0xd6ad('0x12')]){if(_0x27b5ea['error'][_0xd6ad('0x13')]===0x1f4){logger[_0xd6ad('0x12')](_0xd6ad('0x14'),_0x4436a6,_0x27b5ea[_0xd6ad('0x12')]['message']);return _0x4bb05c(_0x27b5ea[_0xd6ad('0x12')]['message']);}logger[_0xd6ad('0x12')](_0xd6ad('0x14'),_0x4436a6,_0x27b5ea[_0xd6ad('0x12')][_0xd6ad('0x15')]);return _0x4e69b9(_0x27b5ea[_0xd6ad('0x12')][_0xd6ad('0x15')]);}else{logger[_0xd6ad('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4436a6,_0xd6ad('0xe'));_0x4e69b9(_0x27b5ea[_0xd6ad('0x16')][_0xd6ad('0x15')]);}})[_0xd6ad('0x17')](function(_0xa66e3b){logger[_0xd6ad('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4436a6,_0xa66e3b);_0x4bb05c(_0xa66e3b);});});} \ No newline at end of file +var _0xa6c3=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x4ac494,_0x2ac7d3){var _0x369355=function(_0x8fefb2){while(--_0x8fefb2){_0x4ac494['push'](_0x4ac494['shift']());}};_0x369355(++_0x2ac7d3);}(_0xa6c3,0x92));var _0x3a6c=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa6c3[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x3a6c('0x0'));var util=require(_0x3a6c('0x1'));var moment=require('moment');var BPromise=require(_0x3a6c('0x2'));var rs=require(_0x3a6c('0x3'));var fs=require('fs');var Redis=require(_0x3a6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a6c('0x5'));var logger=require(_0x3a6c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a6c('0x7'));var client=jayson[_0x3a6c('0x8')][_0x3a6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e84bf,_0x4579b4,_0x11bd55){return new BPromise(function(_0x57c38d,_0x20bb43){return client[_0x3a6c('0xa')](_0x1e84bf,_0x11bd55)[_0x3a6c('0xb')](function(_0x5b9e7d){logger[_0x3a6c('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4579b4,_0x3a6c('0xd'));logger[_0x3a6c('0xe')](_0x3a6c('0xf'),_0x4579b4,'request\x20sent',JSON[_0x3a6c('0x10')](_0x5b9e7d));if(_0x5b9e7d[_0x3a6c('0x11')]){if(_0x5b9e7d[_0x3a6c('0x11')][_0x3a6c('0x12')]===0x1f4){logger[_0x3a6c('0x11')](_0x3a6c('0x13'),_0x4579b4,_0x5b9e7d[_0x3a6c('0x11')][_0x3a6c('0x14')]);return _0x20bb43(_0x5b9e7d['error'][_0x3a6c('0x14')]);}logger[_0x3a6c('0x11')](_0x3a6c('0x13'),_0x4579b4,_0x5b9e7d['error']['message']);return _0x57c38d(_0x5b9e7d[_0x3a6c('0x11')]['message']);}else{logger[_0x3a6c('0xc')](_0x3a6c('0x13'),_0x4579b4,_0x3a6c('0xd'));_0x57c38d(_0x5b9e7d[_0x3a6c('0x15')][_0x3a6c('0x14')]);}})[_0x3a6c('0x16')](function(_0x58f14c){logger[_0x3a6c('0x11')](_0x3a6c('0x13'),_0x4579b4,_0x58f14c);_0x20bb43(_0x58f14c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 85980c1..e182def 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 _0xbc3e=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','delete','destroy','util','path'];(function(_0x3a6def,_0x333000){var _0x53494c=function(_0x4b391e){while(--_0x4b391e){_0x3a6def['push'](_0x3a6def['shift']());}};_0x53494c(++_0x333000);}(_0xbc3e,0xd6));var _0xebc3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbc3e[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require(_0xebc3('0x0'));var path=require(_0xebc3('0x1'));var timeout=require(_0xebc3('0x2'));var express=require(_0xebc3('0x3'));var router=express[_0xebc3('0x4')]();var fs_extra=require(_0xebc3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xebc3('0x6'));var config=require(_0xebc3('0x7'));var controller=require(_0xebc3('0x8'));router[_0xebc3('0x9')]('/',auth[_0xebc3('0xa')](),controller[_0xebc3('0xb')]);router[_0xebc3('0x9')](_0xebc3('0xc'),auth[_0xebc3('0xa')](),controller[_0xebc3('0xd')]);router[_0xebc3('0x9')](_0xebc3('0xe'),auth[_0xebc3('0xa')](),controller[_0xebc3('0xf')]);router[_0xebc3('0x9')](_0xebc3('0x10'),auth[_0xebc3('0xa')](),controller[_0xebc3('0x11')]);router[_0xebc3('0x9')](_0xebc3('0x12'),auth[_0xebc3('0xa')](),controller[_0xebc3('0x13')]);router['post']('/',auth[_0xebc3('0xa')](),controller[_0xebc3('0x14')]);router[_0xebc3('0x15')](_0xebc3('0xc'),auth[_0xebc3('0xa')](),controller['update']);router[_0xebc3('0x16')](_0xebc3('0xc'),auth['isAuthenticated'](),controller[_0xebc3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6194=['show','/:id/preview','/:id/run','run','query','post','create','put','/:id','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get'];(function(_0x43396a,_0x3f3f7c){var _0x4bcc56=function(_0xc969e){while(--_0xc969e){_0x43396a['push'](_0x43396a['shift']());}};_0x4bcc56(++_0x3f3f7c);}(_0x6194,0x173));var _0x4619=function(_0x413b4f,_0x19b291){_0x413b4f=_0x413b4f-0x0;var _0x1ca30b=_0x6194[_0x413b4f];return _0x1ca30b;};'use strict';var multer=require('multer');var util=require(_0x4619('0x0'));var path=require(_0x4619('0x1'));var timeout=require('connect-timeout');var express=require(_0x4619('0x2'));var router=express['Router']();var fs_extra=require(_0x4619('0x3'));var auth=require(_0x4619('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4619('0x5'));var controller=require(_0x4619('0x6'));router['get']('/',auth[_0x4619('0x7')](),controller['index']);router[_0x4619('0x8')]('/:id',auth[_0x4619('0x7')](),controller[_0x4619('0x9')]);router[_0x4619('0x8')](_0x4619('0xa'),auth[_0x4619('0x7')](),controller['preview']);router[_0x4619('0x8')](_0x4619('0xb'),auth[_0x4619('0x7')](),controller[_0x4619('0xc')]);router[_0x4619('0x8')]('/:id/query',auth[_0x4619('0x7')](),controller[_0x4619('0xd')]);router[_0x4619('0xe')]('/',auth[_0x4619('0x7')](),controller[_0x4619('0xf')]);router[_0x4619('0x10')](_0x4619('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4619('0x7')](),controller[_0x4619('0x12')]);module[_0x4619('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 584418a..e108321 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 _0x2f8c=['DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','xlsx','csv'];(function(_0x5ad1bb,_0x477c32){var _0x2a82e6=function(_0x265c49){while(--_0x265c49){_0x5ad1bb['push'](_0x5ad1bb['shift']());}};_0x2a82e6(++_0x477c32);}(_0x2f8c,0x102));var _0xc2f8=function(_0x464f39,_0x99e6fd){_0x464f39=_0x464f39-0x0;var _0x2226c4=_0x2f8c[_0x464f39];return _0x2226c4;};'use strict';var Sequelize=require(_0xc2f8('0x0'));var moment=require(_0xc2f8('0x1'));module[_0xc2f8('0x2')]={'name':{'type':Sequelize[_0xc2f8('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xc2f8('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xc2f8('0x4')),'allowNull':![],'defaultValue':_0xc2f8('0x5')},'savename':{'type':Sequelize[_0xc2f8('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xc2f8('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xc2f8('0x7')},'type':{'type':Sequelize[_0xc2f8('0x8')](_0xc2f8('0x9'),_0xc2f8('0xa')),'allowNull':![],'defaultValue':_0xc2f8('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc2f8('0xb')]},'reportType':{'type':Sequelize[_0xc2f8('0x3')]}}; \ No newline at end of file +var _0x30a1=['moment','exports','ENUM','csv','pdf','xlsx','DATE','STRING','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30a1,0x141));var _0x130a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x130a('0x0'));var moment=require(_0x130a('0x1'));module[_0x130a('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x130a('0x3')](_0x130a('0x4'),_0x130a('0x5'),_0x130a('0x6')),'allowNull':![],'defaultValue':_0x130a('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x130a('0x7')]},'endDate':{'type':Sequelize[_0x130a('0x7')]},'status':{'type':Sequelize[_0x130a('0x8')],'defaultValue':_0x130a('0x9')},'type':{'type':Sequelize[_0x130a('0x3')]('manual',_0x130a('0xa')),'allowNull':![],'defaultValue':_0x130a('0xb')},'reportId':{'type':Sequelize[_0x130a('0xc')](0xb)[_0x130a('0xd')]},'reportType':{'type':Sequelize[_0x130a('0x8')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 905192d..d161da3 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 _0xe858=['body','download','basename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','savename','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','nolimit','order','sort','where','filters','merge','type','VIRTUAL','options','AnalyticExtractedReport','count','includeAll','findAll','catch','show','params','keys','attributes','length','include','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x403f88,_0x4aa611){var _0x2c304a=function(_0x369242){while(--_0x369242){_0x403f88['push'](_0x403f88['shift']());}};_0x2c304a(++_0x4aa611);}(_0xe858,0x72));var _0x8e85=function(_0x50a1f6,_0x238fd8){_0x50a1f6=_0x50a1f6-0x0;var _0x84f8d4=_0xe858[_0x50a1f6];return _0x84f8d4;};'use strict';var emlformat=require(_0x8e85('0x0'));var rimraf=require(_0x8e85('0x1'));var zipdir=require(_0x8e85('0x2'));var jsonpatch=require(_0x8e85('0x3'));var rp=require(_0x8e85('0x4'));var moment=require(_0x8e85('0x5'));var BPromise=require(_0x8e85('0x6'));var Mustache=require('mustache');var util=require(_0x8e85('0x7'));var path=require('path');var sox=require(_0x8e85('0x8'));var csv=require(_0x8e85('0x9'));var ejs=require(_0x8e85('0xa'));var fs=require('fs');var fs_extra=require(_0x8e85('0xb'));var _=require(_0x8e85('0xc'));var squel=require(_0x8e85('0xd'));var crypto=require(_0x8e85('0xe'));var jsforce=require(_0x8e85('0xf'));var deskjs=require(_0x8e85('0x10'));var toCsv=require(_0x8e85('0x9'));var querystring=require(_0x8e85('0x11'));var Papa=require('papaparse');var Redis=require(_0x8e85('0x12'));var authService=require(_0x8e85('0x13'));var qs=require(_0x8e85('0x14'));var as=require(_0x8e85('0x15'));var hardwareService=require(_0x8e85('0x16'));var logger=require(_0x8e85('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8e85('0x18'));var licenseUtil=require(_0x8e85('0x19'));var db=require(_0x8e85('0x1a'))['db'];function respondWithStatusCode(_0xa09df6,_0x2abd49){_0x2abd49=_0x2abd49||0xcc;return function(_0x22595c){if(_0x22595c){return _0xa09df6[_0x8e85('0x1b')](_0x2abd49);}return _0xa09df6[_0x8e85('0x1c')](_0x2abd49)[_0x8e85('0x1d')]();};}function respondWithResult(_0x826fd,_0x3d7448){_0x3d7448=_0x3d7448||0xc8;return function(_0x2ee93e){if(_0x2ee93e){return _0x826fd[_0x8e85('0x1c')](_0x3d7448)[_0x8e85('0x1e')](_0x2ee93e);}};}function respondWithFilteredResult(_0x4e30df,_0x503843){return function(_0x5b215e){if(_0x5b215e){var _0x36e249=typeof _0x503843[_0x8e85('0x1f')]===_0x8e85('0x20')&&typeof _0x503843['limit']==='undefined';var _0x21f883=_0x5b215e['count'];var _0x40196d=_0x36e249?0x0:_0x503843['offset'];var _0x25d965=_0x36e249?_0x5b215e['count']:_0x503843['offset']+_0x503843[_0x8e85('0x21')];var _0x212e3c;if(_0x25d965>=_0x21f883){_0x25d965=_0x21f883;_0x212e3c=0xc8;}else{_0x212e3c=0xce;}_0x4e30df[_0x8e85('0x1c')](_0x212e3c);return _0x4e30df[_0x8e85('0x22')](_0x8e85('0x23'),_0x40196d+'-'+_0x25d965+'/'+_0x21f883)[_0x8e85('0x1e')](_0x5b215e);}return null;};}function patchUpdates(_0x21f07c){return function(_0x5a4b21){try{jsonpatch['apply'](_0x5a4b21,_0x21f07c,!![]);}catch(_0x2feebe){return BPromise['reject'](_0x2feebe);}return _0x5a4b21[_0x8e85('0x24')]();};}function saveUpdates(_0x1ab7c5,_0xbb1c2b){return function(_0x170d7d){if(_0x170d7d){return _0x170d7d[_0x8e85('0x25')](_0x1ab7c5)[_0x8e85('0x26')](function(_0x131167){return _0x131167;});}return null;};}function removeEntity(_0x6889,_0x342e01){return function(_0x15a875){if(_0x15a875){return _0x15a875[_0x8e85('0x27')]()[_0x8e85('0x26')](function(){var _0x36e524=_0x15a875[_0x8e85('0x28')]({'plain':!![]});var _0x343069=_0x8e85('0x29');return db[_0x8e85('0x2a')][_0x8e85('0x27')]({'where':{'type':_0x343069,'resourceId':_0x36e524['id']}})[_0x8e85('0x26')](function(){return _0x15a875;});})[_0x8e85('0x26')](function(){_0x6889[_0x8e85('0x1c')](0xcc)[_0x8e85('0x1d')]();});}};}function handleEntityNotFound(_0x33ed78,_0x15a158){return function(_0x45be6f){if(!_0x45be6f){_0x33ed78[_0x8e85('0x1b')](0x194);}return _0x45be6f;};}function handleError(_0x586bff,_0xc2be64){_0xc2be64=_0xc2be64||0x1f4;return function(_0x564bcb){logger[_0x8e85('0x2b')](_0x564bcb[_0x8e85('0x2c')]);if(_0x564bcb[_0x8e85('0x2d')]){delete _0x564bcb['name'];}_0x586bff['status'](_0xc2be64)[_0x8e85('0x2e')](_0x564bcb);};}exports[_0x8e85('0x2f')]=function(_0x2e47db,_0x5b89d3){var _0x83c2a4={},_0x325942={},_0x36162f={'count':0x0,'rows':[]};var _0xf45d=_[_0x8e85('0x30')](db['AnalyticExtractedReport'][_0x8e85('0x31')],function(_0x5bfe3b){return{'name':_0x5bfe3b[_0x8e85('0x32')],'type':_0x5bfe3b['type'][_0x8e85('0x33')]};});_0x325942[_0x8e85('0x34')]=_[_0x8e85('0x30')](_0xf45d,_0x8e85('0x2d'));_0x325942[_0x8e85('0x35')]=_['keys'](_0x2e47db[_0x8e85('0x35')]);_0x325942['filters']=_[_0x8e85('0x36')](_0x325942['model'],_0x325942[_0x8e85('0x35')]);_0x83c2a4['attributes']=_[_0x8e85('0x36')](_0x325942[_0x8e85('0x34')],qs[_0x8e85('0x37')](_0x2e47db['query'][_0x8e85('0x37')]));_0x83c2a4['attributes']=_0x83c2a4['attributes']['length']?_0x83c2a4['attributes']:_0x325942['model'];if(!_0x2e47db[_0x8e85('0x35')]['hasOwnProperty'](_0x8e85('0x38'))){_0x83c2a4[_0x8e85('0x21')]=qs[_0x8e85('0x21')](_0x2e47db[_0x8e85('0x35')][_0x8e85('0x21')]);_0x83c2a4[_0x8e85('0x1f')]=qs[_0x8e85('0x1f')](_0x2e47db[_0x8e85('0x35')][_0x8e85('0x1f')]);}_0x83c2a4[_0x8e85('0x39')]=qs['sort'](_0x2e47db['query'][_0x8e85('0x3a')]);_0x83c2a4[_0x8e85('0x3b')]=qs[_0x8e85('0x3c')](_['pick'](_0x2e47db[_0x8e85('0x35')],_0x325942['filters']),_0xf45d);if(_0x2e47db[_0x8e85('0x35')]['filter']){_0x83c2a4['where']=_[_0x8e85('0x3d')](_0x83c2a4[_0x8e85('0x3b')],{'$or':_[_0x8e85('0x30')](_0xf45d,function(_0x1c5b81){if(_0x1c5b81[_0x8e85('0x3e')]!==_0x8e85('0x3f')){var _0x5469f5={};_0x5469f5[_0x1c5b81[_0x8e85('0x2d')]]={'$like':'%'+_0x2e47db[_0x8e85('0x35')]['filter']+'%'};return _0x5469f5;}})});}_0x83c2a4=_['merge']({},_0x83c2a4,_0x2e47db[_0x8e85('0x40')]);var _0x60c431={'where':_0x83c2a4[_0x8e85('0x3b')]};return db[_0x8e85('0x41')][_0x8e85('0x42')](_0x60c431)['then'](function(_0x4f0537){_0x36162f[_0x8e85('0x42')]=_0x4f0537;if(_0x2e47db[_0x8e85('0x35')][_0x8e85('0x43')]){_0x83c2a4['include']=[{'all':!![]}];}return db[_0x8e85('0x41')][_0x8e85('0x44')](_0x83c2a4);})['then'](function(_0x2cd72a){_0x36162f['rows']=_0x2cd72a;return _0x36162f;})[_0x8e85('0x26')](respondWithFilteredResult(_0x5b89d3,_0x83c2a4))[_0x8e85('0x45')](handleError(_0x5b89d3,null));};exports[_0x8e85('0x46')]=function(_0x3b1334,_0x2fbc3e){var _0x65e302={'raw':!![],'where':{'id':_0x3b1334[_0x8e85('0x47')]['id']}},_0xd8ba8c={};_0xd8ba8c[_0x8e85('0x34')]=_[_0x8e85('0x48')](db['AnalyticExtractedReport'][_0x8e85('0x31')]);_0xd8ba8c[_0x8e85('0x35')]=_[_0x8e85('0x48')](_0x3b1334['query']);_0xd8ba8c['filters']=_[_0x8e85('0x36')](_0xd8ba8c[_0x8e85('0x34')],_0xd8ba8c[_0x8e85('0x35')]);_0x65e302['attributes']=_[_0x8e85('0x36')](_0xd8ba8c[_0x8e85('0x34')],qs[_0x8e85('0x37')](_0x3b1334[_0x8e85('0x35')]['fields']));_0x65e302[_0x8e85('0x49')]=_0x65e302[_0x8e85('0x49')][_0x8e85('0x4a')]?_0x65e302[_0x8e85('0x49')]:_0xd8ba8c[_0x8e85('0x34')];if(_0x3b1334[_0x8e85('0x35')][_0x8e85('0x43')]){_0x65e302[_0x8e85('0x4b')]=[{'all':!![]}];}_0x65e302=_['merge']({},_0x65e302,_0x3b1334[_0x8e85('0x40')]);return db[_0x8e85('0x41')]['find'](_0x65e302)[_0x8e85('0x26')](handleEntityNotFound(_0x2fbc3e,null))['then'](respondWithResult(_0x2fbc3e,null))[_0x8e85('0x45')](handleError(_0x2fbc3e,null));};exports[_0x8e85('0x4c')]=function(_0x53d6fd,_0x16cb56){return db[_0x8e85('0x41')][_0x8e85('0x4c')](_0x53d6fd['body'],{})[_0x8e85('0x26')](function(_0xf5c1e9){var _0x112889=_0x53d6fd[_0x8e85('0x4d')][_0x8e85('0x28')]({'plain':!![]});if(!_0x112889)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x112889[_0x8e85('0x4e')]===_0x8e85('0x4d')){var _0x43897d=_0xf5c1e9[_0x8e85('0x28')]({'plain':!![]});var _0x3ddfd7=_0x8e85('0x29');return db[_0x8e85('0x4f')][_0x8e85('0x50')]({'where':{'name':_0x3ddfd7,'userProfileId':_0x112889[_0x8e85('0x51')]},'raw':!![]})[_0x8e85('0x26')](function(_0x2ea724){if(_0x2ea724&&_0x2ea724[_0x8e85('0x52')]===0x0){return db[_0x8e85('0x2a')][_0x8e85('0x4c')]({'name':_0x43897d[_0x8e85('0x2d')],'resourceId':_0x43897d['id'],'type':_0x2ea724[_0x8e85('0x2d')],'sectionId':_0x2ea724['id']},{})[_0x8e85('0x26')](function(){return _0xf5c1e9;});}else{return _0xf5c1e9;}})[_0x8e85('0x45')](function(_0x8c2bf5){logger[_0x8e85('0x2b')](_0x8e85('0x53'),_0x8c2bf5);throw _0x8c2bf5;});}return _0xf5c1e9;})[_0x8e85('0x26')](respondWithResult(_0x16cb56,0xc9))['catch'](handleError(_0x16cb56,null));};exports[_0x8e85('0x25')]=function(_0x3007a8,_0x4b93a5){if(_0x3007a8[_0x8e85('0x54')]['id']){delete _0x3007a8['body']['id'];}return db[_0x8e85('0x41')]['find']({'where':{'id':_0x3007a8[_0x8e85('0x47')]['id']}})[_0x8e85('0x26')](handleEntityNotFound(_0x4b93a5,null))[_0x8e85('0x26')](saveUpdates(_0x3007a8[_0x8e85('0x54')],null))[_0x8e85('0x26')](respondWithResult(_0x4b93a5,null))[_0x8e85('0x45')](handleError(_0x4b93a5,null));};exports['destroy']=function(_0x587fb1,_0x834eae){return db[_0x8e85('0x41')][_0x8e85('0x50')]({'where':{'id':_0x587fb1[_0x8e85('0x47')]['id']}})[_0x8e85('0x26')](handleEntityNotFound(_0x834eae,null))[_0x8e85('0x26')](removeEntity(_0x834eae,null))[_0x8e85('0x45')](handleError(_0x834eae,null));};exports[_0x8e85('0x55')]=function(_0x1dcbe,_0x1f6768,_0x47c224){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1dcbe['params']['id']},'attributes':[_0x8e85('0x2d'),_0x8e85('0x56'),'savename',_0x8e85('0x57')],'raw':!![]})[_0x8e85('0x26')](handleEntityNotFound(_0x1f6768,null))[_0x8e85('0x26')](function(_0xe47fca){if(_0xe47fca){if(!fs[_0x8e85('0x58')](path[_0x8e85('0x59')](config[_0x8e85('0x5a')],_0x8e85('0x5b'),_0xe47fca['savename']))){throw new db[(_0x8e85('0x5c'))]['ValidationError'](_0x8e85('0x5d'));}if(_0x1dcbe[_0x8e85('0x35')][_0x8e85('0x5e')]){return _0x1f6768[_0x8e85('0x1b')](0xc8);}return _0x1f6768[_0x8e85('0x55')](path['join'](config[_0x8e85('0x5a')],_0x8e85('0x5b'),_0xe47fca[_0x8e85('0x5f')]),util[_0x8e85('0x60')](_0x8e85('0x61'),_0xe47fca[_0x8e85('0x56')]||_0xe47fca['name'],_0xe47fca['output'][_0x8e85('0x62')]()));}})['catch'](handleError(_0x1f6768,null));}; \ No newline at end of file +var _0x31df=['name','send','index','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','rawAttributes','intersection','length','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','output','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','error','stack'];(function(_0x5c697e,_0x3f680d){var _0x962132=function(_0x29d9b1){while(--_0x29d9b1){_0x5c697e['push'](_0x5c697e['shift']());}};_0x962132(++_0x3f680d);}(_0x31df,0xff));var _0xf31d=function(_0x1920cd,_0x567031){_0x1920cd=_0x1920cd-0x0;var _0x35c72e=_0x31df[_0x1920cd];return _0x35c72e;};'use strict';var emlformat=require(_0xf31d('0x0'));var rimraf=require(_0xf31d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf31d('0x2'));var rp=require('request-promise');var moment=require(_0xf31d('0x3'));var BPromise=require(_0xf31d('0x4'));var Mustache=require(_0xf31d('0x5'));var util=require(_0xf31d('0x6'));var path=require(_0xf31d('0x7'));var sox=require(_0xf31d('0x8'));var csv=require(_0xf31d('0x9'));var ejs=require(_0xf31d('0xa'));var fs=require('fs');var fs_extra=require(_0xf31d('0xb'));var _=require('lodash');var squel=require(_0xf31d('0xc'));var crypto=require(_0xf31d('0xd'));var jsforce=require(_0xf31d('0xe'));var deskjs=require(_0xf31d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf31d('0x10'));var Papa=require(_0xf31d('0x11'));var Redis=require(_0xf31d('0x12'));var authService=require(_0xf31d('0x13'));var qs=require(_0xf31d('0x14'));var as=require(_0xf31d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf31d('0x16'));var utils=require(_0xf31d('0x17'));var config=require(_0xf31d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf31d('0x19'))['db'];function respondWithStatusCode(_0x566f76,_0x22d9de){_0x22d9de=_0x22d9de||0xcc;return function(_0xbf50dd){if(_0xbf50dd){return _0x566f76[_0xf31d('0x1a')](_0x22d9de);}return _0x566f76[_0xf31d('0x1b')](_0x22d9de)[_0xf31d('0x1c')]();};}function respondWithResult(_0x5ef99b,_0x135ee5){_0x135ee5=_0x135ee5||0xc8;return function(_0x3cb48b){if(_0x3cb48b){return _0x5ef99b[_0xf31d('0x1b')](_0x135ee5)[_0xf31d('0x1d')](_0x3cb48b);}};}function respondWithFilteredResult(_0x3a2ad3,_0x20ce14){return function(_0x42ed4e){if(_0x42ed4e){var _0x89b5f6=typeof _0x20ce14[_0xf31d('0x1e')]==='undefined'&&typeof _0x20ce14['limit']===_0xf31d('0x1f');var _0x20d1f4=_0x42ed4e[_0xf31d('0x20')];var _0x4024b6=_0x89b5f6?0x0:_0x20ce14[_0xf31d('0x1e')];var _0x2fcfb8=_0x89b5f6?_0x42ed4e[_0xf31d('0x20')]:_0x20ce14[_0xf31d('0x1e')]+_0x20ce14[_0xf31d('0x21')];var _0x38a889;if(_0x2fcfb8>=_0x20d1f4){_0x2fcfb8=_0x20d1f4;_0x38a889=0xc8;}else{_0x38a889=0xce;}_0x3a2ad3[_0xf31d('0x1b')](_0x38a889);return _0x3a2ad3[_0xf31d('0x22')](_0xf31d('0x23'),_0x4024b6+'-'+_0x2fcfb8+'/'+_0x20d1f4)[_0xf31d('0x1d')](_0x42ed4e);}return null;};}function patchUpdates(_0x398b6e){return function(_0x4089a4){try{jsonpatch[_0xf31d('0x24')](_0x4089a4,_0x398b6e,!![]);}catch(_0xe46b40){return BPromise[_0xf31d('0x25')](_0xe46b40);}return _0x4089a4['save']();};}function saveUpdates(_0x3f87df,_0x932d2d){return function(_0x15bc80){if(_0x15bc80){return _0x15bc80['update'](_0x3f87df)[_0xf31d('0x26')](function(_0x37964b){return _0x37964b;});}return null;};}function removeEntity(_0x512bd5,_0x501768){return function(_0xdccdd2){if(_0xdccdd2){return _0xdccdd2[_0xf31d('0x27')]()[_0xf31d('0x26')](function(){var _0x515983=_0xdccdd2[_0xf31d('0x28')]({'plain':!![]});var _0x1feeb8=_0xf31d('0x29');return db[_0xf31d('0x2a')]['destroy']({'where':{'type':_0x1feeb8,'resourceId':_0x515983['id']}})['then'](function(){return _0xdccdd2;});})[_0xf31d('0x26')](function(){_0x512bd5[_0xf31d('0x1b')](0xcc)[_0xf31d('0x1c')]();});}};}function handleEntityNotFound(_0x1440ea,_0x114bb1){return function(_0x5b715b){if(!_0x5b715b){_0x1440ea['sendStatus'](0x194);}return _0x5b715b;};}function handleError(_0x3529a4,_0x288c18){_0x288c18=_0x288c18||0x1f4;return function(_0x3846d5){logger[_0xf31d('0x2b')](_0x3846d5[_0xf31d('0x2c')]);if(_0x3846d5[_0xf31d('0x2d')]){delete _0x3846d5[_0xf31d('0x2d')];}_0x3529a4['status'](_0x288c18)[_0xf31d('0x2e')](_0x3846d5);};}exports[_0xf31d('0x2f')]=function(_0x2066f1,_0x48e2b9){var _0x56cd8e={},_0x345fa4={},_0x539dd0={'count':0x0,'rows':[]};var _0x432277=_['map'](db[_0xf31d('0x30')]['rawAttributes'],function(_0x3aa3fd){return{'name':_0x3aa3fd[_0xf31d('0x31')],'type':_0x3aa3fd[_0xf31d('0x32')][_0xf31d('0x33')]};});_0x345fa4[_0xf31d('0x34')]=_[_0xf31d('0x35')](_0x432277,'name');_0x345fa4[_0xf31d('0x36')]=_[_0xf31d('0x37')](_0x2066f1[_0xf31d('0x36')]);_0x345fa4[_0xf31d('0x38')]=_['intersection'](_0x345fa4[_0xf31d('0x34')],_0x345fa4[_0xf31d('0x36')]);_0x56cd8e[_0xf31d('0x39')]=_['intersection'](_0x345fa4[_0xf31d('0x34')],qs['fields'](_0x2066f1[_0xf31d('0x36')][_0xf31d('0x3a')]));_0x56cd8e[_0xf31d('0x39')]=_0x56cd8e[_0xf31d('0x39')]['length']?_0x56cd8e['attributes']:_0x345fa4[_0xf31d('0x34')];if(!_0x2066f1[_0xf31d('0x36')][_0xf31d('0x3b')](_0xf31d('0x3c'))){_0x56cd8e[_0xf31d('0x21')]=qs[_0xf31d('0x21')](_0x2066f1[_0xf31d('0x36')]['limit']);_0x56cd8e[_0xf31d('0x1e')]=qs[_0xf31d('0x1e')](_0x2066f1[_0xf31d('0x36')][_0xf31d('0x1e')]);}_0x56cd8e[_0xf31d('0x3d')]=qs[_0xf31d('0x3e')](_0x2066f1[_0xf31d('0x36')]['sort']);_0x56cd8e[_0xf31d('0x3f')]=qs[_0xf31d('0x38')](_[_0xf31d('0x40')](_0x2066f1['query'],_0x345fa4[_0xf31d('0x38')]),_0x432277);if(_0x2066f1[_0xf31d('0x36')]['filter']){_0x56cd8e[_0xf31d('0x3f')]=_[_0xf31d('0x41')](_0x56cd8e[_0xf31d('0x3f')],{'$or':_[_0xf31d('0x35')](_0x432277,function(_0x45d0d2){if(_0x45d0d2[_0xf31d('0x32')]!==_0xf31d('0x42')){var _0x5a3294={};_0x5a3294[_0x45d0d2[_0xf31d('0x2d')]]={'$like':'%'+_0x2066f1[_0xf31d('0x36')]['filter']+'%'};return _0x5a3294;}})});}_0x56cd8e=_[_0xf31d('0x41')]({},_0x56cd8e,_0x2066f1['options']);var _0x40d043={'where':_0x56cd8e['where']};return db['AnalyticExtractedReport'][_0xf31d('0x20')](_0x40d043)[_0xf31d('0x26')](function(_0x15ef8a){_0x539dd0['count']=_0x15ef8a;if(_0x2066f1['query']['includeAll']){_0x56cd8e['include']=[{'all':!![]}];}return db[_0xf31d('0x30')]['findAll'](_0x56cd8e);})['then'](function(_0x209ab7){_0x539dd0[_0xf31d('0x43')]=_0x209ab7;return _0x539dd0;})[_0xf31d('0x26')](respondWithFilteredResult(_0x48e2b9,_0x56cd8e))[_0xf31d('0x44')](handleError(_0x48e2b9,null));};exports['show']=function(_0x12b255,_0x3d3fdb){var _0x3bebe7={'raw':!![],'where':{'id':_0x12b255['params']['id']}},_0xb8981f={};_0xb8981f['model']=_[_0xf31d('0x37')](db['AnalyticExtractedReport'][_0xf31d('0x45')]);_0xb8981f['query']=_[_0xf31d('0x37')](_0x12b255[_0xf31d('0x36')]);_0xb8981f['filters']=_[_0xf31d('0x46')](_0xb8981f[_0xf31d('0x34')],_0xb8981f[_0xf31d('0x36')]);_0x3bebe7[_0xf31d('0x39')]=_[_0xf31d('0x46')](_0xb8981f[_0xf31d('0x34')],qs[_0xf31d('0x3a')](_0x12b255[_0xf31d('0x36')][_0xf31d('0x3a')]));_0x3bebe7[_0xf31d('0x39')]=_0x3bebe7[_0xf31d('0x39')][_0xf31d('0x47')]?_0x3bebe7['attributes']:_0xb8981f[_0xf31d('0x34')];if(_0x12b255[_0xf31d('0x36')][_0xf31d('0x48')]){_0x3bebe7[_0xf31d('0x49')]=[{'all':!![]}];}_0x3bebe7=_['merge']({},_0x3bebe7,_0x12b255[_0xf31d('0x4a')]);return db[_0xf31d('0x30')][_0xf31d('0x4b')](_0x3bebe7)['then'](handleEntityNotFound(_0x3d3fdb,null))['then'](respondWithResult(_0x3d3fdb,null))[_0xf31d('0x44')](handleError(_0x3d3fdb,null));};exports['create']=function(_0xad83a3,_0xc825cb){return db[_0xf31d('0x30')][_0xf31d('0x4c')](_0xad83a3[_0xf31d('0x4d')],{})['then'](function(_0x475334){var _0x3277fc=_0xad83a3[_0xf31d('0x4e')][_0xf31d('0x28')]({'plain':!![]});if(!_0x3277fc)throw new Error(_0xf31d('0x4f'));if(_0x3277fc[_0xf31d('0x50')]===_0xf31d('0x4e')){var _0x23f130=_0x475334[_0xf31d('0x28')]({'plain':!![]});var _0x9c891b=_0xf31d('0x29');return db[_0xf31d('0x51')]['find']({'where':{'name':_0x9c891b,'userProfileId':_0x3277fc[_0xf31d('0x52')]},'raw':!![]})[_0xf31d('0x26')](function(_0xf1b995){if(_0xf1b995&&_0xf1b995[_0xf31d('0x53')]===0x0){return db[_0xf31d('0x2a')]['create']({'name':_0x23f130[_0xf31d('0x2d')],'resourceId':_0x23f130['id'],'type':_0xf1b995['name'],'sectionId':_0xf1b995['id']},{})[_0xf31d('0x26')](function(){return _0x475334;});}else{return _0x475334;}})[_0xf31d('0x44')](function(_0xfaddf6){logger[_0xf31d('0x2b')](_0xf31d('0x54'),_0xfaddf6);throw _0xfaddf6;});}return _0x475334;})[_0xf31d('0x26')](respondWithResult(_0xc825cb,0xc9))['catch'](handleError(_0xc825cb,null));};exports['update']=function(_0xb28f93,_0x400bc0){if(_0xb28f93[_0xf31d('0x4d')]['id']){delete _0xb28f93['body']['id'];}return db['AnalyticExtractedReport'][_0xf31d('0x4b')]({'where':{'id':_0xb28f93[_0xf31d('0x55')]['id']}})[_0xf31d('0x26')](handleEntityNotFound(_0x400bc0,null))[_0xf31d('0x26')](saveUpdates(_0xb28f93[_0xf31d('0x4d')],null))[_0xf31d('0x26')](respondWithResult(_0x400bc0,null))[_0xf31d('0x44')](handleError(_0x400bc0,null));};exports['destroy']=function(_0x3f8bb6,_0x3537d1){return db[_0xf31d('0x30')][_0xf31d('0x4b')]({'where':{'id':_0x3f8bb6[_0xf31d('0x55')]['id']}})[_0xf31d('0x26')](handleEntityNotFound(_0x3537d1,null))[_0xf31d('0x26')](removeEntity(_0x3537d1,null))[_0xf31d('0x44')](handleError(_0x3537d1,null));};exports[_0xf31d('0x56')]=function(_0x3e714c,_0x33dc15,_0x1be3a8){return db[_0xf31d('0x30')][_0xf31d('0x4b')]({'where':{'id':_0x3e714c[_0xf31d('0x55')]['id']},'attributes':['name',_0xf31d('0x57'),'savename','output'],'raw':!![]})[_0xf31d('0x26')](handleEntityNotFound(_0x33dc15,null))[_0xf31d('0x26')](function(_0x3fa64a){if(_0x3fa64a){if(!fs['existsSync'](path['join'](config[_0xf31d('0x58')],_0xf31d('0x59'),_0x3fa64a[_0xf31d('0x5a')]))){throw new db[(_0xf31d('0x5b'))][(_0xf31d('0x5c'))](_0xf31d('0x5d'));}if(_0x3e714c[_0xf31d('0x36')][_0xf31d('0x5e')]){return _0x33dc15[_0xf31d('0x1a')](0xc8);}return _0x33dc15[_0xf31d('0x56')](path[_0xf31d('0x5f')](config[_0xf31d('0x58')],'server/files/reports',_0x3fa64a[_0xf31d('0x5a')]),util[_0xf31d('0x60')](_0xf31d('0x61'),_0x3fa64a['basename']||_0x3fa64a[_0xf31d('0x2d')],_0x3fa64a[_0xf31d('0x62')][_0xf31d('0x63')]()));}})['catch'](handleError(_0x33dc15,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 06427e6..656c95c 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 _0xe360=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xe360,0x155));var _0x0e36=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xe360[_0x1646fa];return _0x5a47a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e36('0x0'))(_0x0e36('0x1'));var moment=require(_0x0e36('0x2'));var BPromise=require(_0x0e36('0x3'));var rp=require(_0x0e36('0x4'));var fs=require('fs');var path=require(_0x0e36('0x5'));var rimraf=require(_0x0e36('0x6'));var config=require(_0x0e36('0x7'));var attributes=require(_0x0e36('0x8'));module['exports']=function(_0x261736,_0x4257d0){return _0x261736[_0x0e36('0x9')](_0x0e36('0xa'),attributes,{'tableName':_0x0e36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e16=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6e16,0x1b0));var _0x66e1=function(_0x460d00,_0xff714){_0x460d00=_0x460d00-0x0;var _0x4e6ddd=_0x6e16[_0x460d00];return _0x4e6ddd;};'use strict';var _=require(_0x66e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x66e1('0x1'));var moment=require(_0x66e1('0x2'));var BPromise=require(_0x66e1('0x3'));var rp=require(_0x66e1('0x4'));var fs=require('fs');var path=require(_0x66e1('0x5'));var rimraf=require(_0x66e1('0x6'));var config=require(_0x66e1('0x7'));var attributes=require(_0x66e1('0x8'));module[_0x66e1('0x9')]=function(_0x3cc718,_0x4e07b9){return _0x3cc718['define'](_0x66e1('0xa'),attributes,{'tableName':_0x66e1('0xb'),'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 a046009..df52e45 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 _0x5194=['client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e5e0f,_0xce82e7){var _0x11bbda=function(_0x51974f){while(--_0x51974f){_0x2e5e0f['push'](_0x2e5e0f['shift']());}};_0x11bbda(++_0xce82e7);}(_0x5194,0x173));var _0x4519=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5194[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4519('0x0'));var BPromise=require(_0x4519('0x1'));var rs=require(_0x4519('0x2'));var fs=require('fs');var Redis=require(_0x4519('0x3'));var db=require(_0x4519('0x4'))['db'];var utils=require(_0x4519('0x5'));var logger=require(_0x4519('0x6'))(_0x4519('0x7'));var config=require(_0x4519('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4519('0x9')][_0x4519('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6de583,_0x2d41df,_0x4e4537){return new BPromise(function(_0x554121,_0x5eb1c4){return client[_0x4519('0xb')](_0x6de583,_0x4e4537)[_0x4519('0xc')](function(_0xd57979){logger['info'](_0x4519('0xd'),_0x2d41df,_0x4519('0xe'));logger[_0x4519('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2d41df,_0x4519('0xe'),JSON['stringify'](_0xd57979));if(_0xd57979['error']){if(_0xd57979['error'][_0x4519('0x10')]===0x1f4){logger[_0x4519('0x11')](_0x4519('0xd'),_0x2d41df,_0xd57979[_0x4519('0x11')][_0x4519('0x12')]);return _0x5eb1c4(_0xd57979['error']['message']);}logger[_0x4519('0x11')](_0x4519('0xd'),_0x2d41df,_0xd57979[_0x4519('0x11')][_0x4519('0x12')]);return _0x554121(_0xd57979['error'][_0x4519('0x12')]);}else{logger['info'](_0x4519('0xd'),_0x2d41df,_0x4519('0xe'));_0x554121(_0xd57979['result'][_0x4519('0x12')]);}})[_0x4519('0x13')](function(_0x19b0c1){logger['error'](_0x4519('0xd'),_0x2d41df,_0x19b0c1);_0x5eb1c4(_0x19b0c1);});});} \ No newline at end of file +var _0x0ac0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0ac0,0x130));var _0x00ac=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x0ac0[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var moment=require(_0x00ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x00ac('0x3'));var fs=require('fs');var Redis=require(_0x00ac('0x4'));var db=require(_0x00ac('0x5'))['db'];var utils=require(_0x00ac('0x6'));var logger=require(_0x00ac('0x7'))(_0x00ac('0x8'));var config=require(_0x00ac('0x9'));var jayson=require(_0x00ac('0xa'));var client=jayson['client'][_0x00ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a17e,_0x3546f0,_0x282faa){return new BPromise(function(_0x4427de,_0x121a9e){return client[_0x00ac('0xc')](_0xa2a17e,_0x282faa)['then'](function(_0x48c47e){logger[_0x00ac('0xd')](_0x00ac('0xe'),_0x3546f0,_0x00ac('0xf'));logger[_0x00ac('0x10')](_0x00ac('0x11'),_0x3546f0,'request\x20sent',JSON[_0x00ac('0x12')](_0x48c47e));if(_0x48c47e['error']){if(_0x48c47e[_0x00ac('0x13')]['code']===0x1f4){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x48c47e[_0x00ac('0x13')][_0x00ac('0x14')]);return _0x121a9e(_0x48c47e['error']['message']);}logger[_0x00ac('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3546f0,_0x48c47e['error'][_0x00ac('0x14')]);return _0x4427de(_0x48c47e[_0x00ac('0x13')]['message']);}else{logger[_0x00ac('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3546f0,'request\x20sent');_0x4427de(_0x48c47e[_0x00ac('0x15')][_0x00ac('0x14')]);}})['catch'](function(_0x66e4ba){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x66e4ba);_0x121a9e(_0x66e4ba);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6268732..9c61c8d 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 _0x0a11=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0a11,0xcc));var _0x10a1=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0x0a11[_0x606fe8];return _0x28b517;};'use strict';var multer=require(_0x10a1('0x0'));var util=require(_0x10a1('0x1'));var path=require(_0x10a1('0x2'));var timeout=require(_0x10a1('0x3'));var express=require(_0x10a1('0x4'));var router=express[_0x10a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x10a1('0x6'));var interaction=require(_0x10a1('0x7'));var config=require(_0x10a1('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x10a1('0x9')]('/',auth[_0x10a1('0xa')](),controller[_0x10a1('0xb')]);router[_0x10a1('0x9')](_0x10a1('0xc'),auth['isAuthenticated'](),controller[_0x10a1('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x10a1('0xe')]);router[_0x10a1('0xf')]('/',auth[_0x10a1('0xa')](),controller[_0x10a1('0x10')]);router[_0x10a1('0x11')](_0x10a1('0xc'),auth[_0x10a1('0xa')](),controller[_0x10a1('0x12')]);router[_0x10a1('0x13')](_0x10a1('0xc'),auth['isAuthenticated'](),controller[_0x10a1('0x14')]);module[_0x10a1('0x15')]=router; \ No newline at end of file +var _0xb4f9=['/:id','/:id/download','download','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x5e7b3a,_0x389a0b){var _0x1463bd=function(_0x3a031f){while(--_0x3a031f){_0x5e7b3a['push'](_0x5e7b3a['shift']());}};_0x1463bd(++_0x389a0b);}(_0xb4f9,0xef));var _0x9b4f=function(_0x42db3e,_0x4e0e33){_0x42db3e=_0x42db3e-0x0;var _0x1c86e2=_0xb4f9[_0x42db3e];return _0x1c86e2;};'use strict';var multer=require(_0x9b4f('0x0'));var util=require(_0x9b4f('0x1'));var path=require(_0x9b4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b4f('0x3'));var router=express[_0x9b4f('0x4')]();var fs_extra=require(_0x9b4f('0x5'));var auth=require(_0x9b4f('0x6'));var interaction=require(_0x9b4f('0x7'));var config=require(_0x9b4f('0x8'));var controller=require(_0x9b4f('0x9'));router[_0x9b4f('0xa')]('/',auth[_0x9b4f('0xb')](),controller[_0x9b4f('0xc')]);router[_0x9b4f('0xa')](_0x9b4f('0xd'),auth[_0x9b4f('0xb')](),controller['show']);router[_0x9b4f('0xa')](_0x9b4f('0xe'),auth[_0x9b4f('0xb')](),controller[_0x9b4f('0xf')]);router[_0x9b4f('0x10')]('/',auth[_0x9b4f('0xb')](),controller[_0x9b4f('0x11')]);router[_0x9b4f('0x12')](_0x9b4f('0xd'),auth[_0x9b4f('0xb')](),controller['update']);router[_0x9b4f('0x13')](_0x9b4f('0xd'),auth[_0x9b4f('0xb')](),controller[_0x9b4f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0d8bd00..5225bbe 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 _0xe571=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x563b4f,_0x35a0f8){var _0x265629=function(_0x1124dc){while(--_0x1124dc){_0x563b4f['push'](_0x563b4f['shift']());}};_0x265629(++_0x35a0f8);}(_0xe571,0xae));var _0x1e57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe571[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1e57('0x0'));module[_0x1e57('0x1')]={'field':{'type':Sequelize[_0x1e57('0x2')]},'alias':{'type':Sequelize[_0x1e57('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1e57('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1e57('0x3')]},'custom':{'type':Sequelize[_0x1e57('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ca3=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5a5648,_0x3b8b5e){var _0x598cdc=function(_0x3fbe16){while(--_0x3fbe16){_0x5a5648['push'](_0x5a5648['shift']());}};_0x598cdc(++_0x3b8b5e);}(_0x3ca3,0x116));var _0x33ca=function(_0x3deeb3,_0x243a11){_0x3deeb3=_0x3deeb3-0x0;var _0x29ed85=_0x3ca3[_0x3deeb3];return _0x29ed85;};'use strict';var Sequelize=require(_0x33ca('0x0'));module[_0x33ca('0x1')]={'field':{'type':Sequelize[_0x33ca('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x33ca('0x3')]},'format':{'type':Sequelize[_0x33ca('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x33ca('0x3')]},'custom':{'type':Sequelize[_0x33ca('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a2aa785..e1f9c35 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 _0x15ff=['length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields'];(function(_0x45e6f4,_0x5c0ebd){var _0x5e975b=function(_0x60fa5){while(--_0x60fa5){_0x45e6f4['push'](_0x45e6f4['shift']());}};_0x5e975b(++_0x5c0ebd);}(_0x15ff,0x74));var _0xf15f=function(_0x56fd06,_0x54835c){_0x56fd06=_0x56fd06-0x0;var _0x9fde0a=_0x15ff[_0x56fd06];return _0x9fde0a;};'use strict';var emlformat=require(_0xf15f('0x0'));var rimraf=require(_0xf15f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf15f('0x2'));var rp=require('request-promise');var moment=require(_0xf15f('0x3'));var BPromise=require(_0xf15f('0x4'));var Mustache=require(_0xf15f('0x5'));var util=require(_0xf15f('0x6'));var path=require(_0xf15f('0x7'));var sox=require(_0xf15f('0x8'));var csv=require('to-csv');var ejs=require(_0xf15f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15f('0xa'));var squel=require(_0xf15f('0xb'));var crypto=require(_0xf15f('0xc'));var jsforce=require(_0xf15f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf15f('0xe'));var querystring=require(_0xf15f('0xf'));var Papa=require(_0xf15f('0x10'));var Redis=require('ioredis');var authService=require(_0xf15f('0x11'));var qs=require(_0xf15f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15f('0x13'));var logger=require(_0xf15f('0x14'))(_0xf15f('0x15'));var utils=require(_0xf15f('0x16'));var config=require(_0xf15f('0x17'));var licenseUtil=require(_0xf15f('0x18'));var db=require(_0xf15f('0x19'))['db'];function respondWithStatusCode(_0x379ae3,_0x36303f){_0x36303f=_0x36303f||0xcc;return function(_0x35767b){if(_0x35767b){return _0x379ae3[_0xf15f('0x1a')](_0x36303f);}return _0x379ae3[_0xf15f('0x1b')](_0x36303f)[_0xf15f('0x1c')]();};}function respondWithResult(_0x273c5d,_0x15d65e){_0x15d65e=_0x15d65e||0xc8;return function(_0x1b57e8){if(_0x1b57e8){return _0x273c5d[_0xf15f('0x1b')](_0x15d65e)[_0xf15f('0x1d')](_0x1b57e8);}};}function respondWithFilteredResult(_0x37cb43,_0x5331ff){return function(_0x5f4479){if(_0x5f4479){var _0x34dd78=typeof _0x5331ff[_0xf15f('0x1e')]==='undefined'&&typeof _0x5331ff['limit']===_0xf15f('0x1f');var _0x54c173=_0x5f4479[_0xf15f('0x20')];var _0x48bb65=_0x34dd78?0x0:_0x5331ff[_0xf15f('0x1e')];var _0x45f5c8=_0x34dd78?_0x5f4479[_0xf15f('0x20')]:_0x5331ff[_0xf15f('0x1e')]+_0x5331ff[_0xf15f('0x21')];var _0xda3331;if(_0x45f5c8>=_0x54c173){_0x45f5c8=_0x54c173;_0xda3331=0xc8;}else{_0xda3331=0xce;}_0x37cb43[_0xf15f('0x1b')](_0xda3331);return _0x37cb43['set']('Content-Range',_0x48bb65+'-'+_0x45f5c8+'/'+_0x54c173)[_0xf15f('0x1d')](_0x5f4479);}return null;};}function patchUpdates(_0x1f3edb){return function(_0x65f04f){try{jsonpatch[_0xf15f('0x22')](_0x65f04f,_0x1f3edb,!![]);}catch(_0x1c4ab9){return BPromise[_0xf15f('0x23')](_0x1c4ab9);}return _0x65f04f[_0xf15f('0x24')]();};}function saveUpdates(_0x488647,_0x2d707b){return function(_0x41ec0d){if(_0x41ec0d){return _0x41ec0d[_0xf15f('0x25')](_0x488647)[_0xf15f('0x26')](function(_0x50be2a){return _0x50be2a;});}return null;};}function removeEntity(_0x5c6b41,_0x2c168){return function(_0x5090dc){if(_0x5090dc){return _0x5090dc[_0xf15f('0x27')]()[_0xf15f('0x26')](function(){_0x5c6b41[_0xf15f('0x1b')](0xcc)[_0xf15f('0x1c')]();});}};}function handleEntityNotFound(_0xe060d0,_0x506cd6){return function(_0x5201b6){if(!_0x5201b6){_0xe060d0['sendStatus'](0x194);}return _0x5201b6;};}function handleError(_0x55df22,_0x1644ce){_0x1644ce=_0x1644ce||0x1f4;return function(_0x34021d){logger[_0xf15f('0x28')](_0x34021d[_0xf15f('0x29')]);if(_0x34021d['name']){delete _0x34021d['name'];}_0x55df22[_0xf15f('0x1b')](_0x1644ce)[_0xf15f('0x2a')](_0x34021d);};}exports[_0xf15f('0x2b')]=function(_0x1b7dd6,_0x1bd85d){var _0x20b41b={},_0x3bd730={},_0x347ce4={'count':0x0,'rows':[]};var _0x400039=_['map'](db['AnalyticFieldReport'][_0xf15f('0x2c')],function(_0x56aa1f){return{'name':_0x56aa1f[_0xf15f('0x2d')],'type':_0x56aa1f['type'][_0xf15f('0x2e')]};});_0x3bd730[_0xf15f('0x2f')]=_[_0xf15f('0x30')](_0x400039,_0xf15f('0x31'));_0x3bd730[_0xf15f('0x32')]=_[_0xf15f('0x33')](_0x1b7dd6[_0xf15f('0x32')]);_0x3bd730[_0xf15f('0x34')]=_[_0xf15f('0x35')](_0x3bd730[_0xf15f('0x2f')],_0x3bd730[_0xf15f('0x32')]);_0x20b41b[_0xf15f('0x36')]=_['intersection'](_0x3bd730['model'],qs[_0xf15f('0x37')](_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x37')]));_0x20b41b['attributes']=_0x20b41b[_0xf15f('0x36')][_0xf15f('0x38')]?_0x20b41b[_0xf15f('0x36')]:_0x3bd730[_0xf15f('0x2f')];if(!_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x39')](_0xf15f('0x3a'))){_0x20b41b[_0xf15f('0x21')]=qs[_0xf15f('0x21')](_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x21')]);_0x20b41b[_0xf15f('0x1e')]=qs[_0xf15f('0x1e')](_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x1e')]);}_0x20b41b[_0xf15f('0x3b')]=qs[_0xf15f('0x3c')](_0x1b7dd6[_0xf15f('0x32')]['sort']);_0x20b41b['where']=qs['filters'](_[_0xf15f('0x3d')](_0x1b7dd6[_0xf15f('0x32')],_0x3bd730['filters']),_0x400039);if(_0x1b7dd6[_0xf15f('0x32')]['filter']){_0x20b41b[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x20b41b[_0xf15f('0x3e')],{'$or':_[_0xf15f('0x30')](_0x400039,function(_0x14a10d){if(_0x14a10d[_0xf15f('0x40')]!==_0xf15f('0x41')){var _0x1b3d2d={};_0x1b3d2d[_0x14a10d[_0xf15f('0x31')]]={'$like':'%'+_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x42')]+'%'};return _0x1b3d2d;}})});}_0x20b41b=_[_0xf15f('0x3f')]({},_0x20b41b,_0x1b7dd6[_0xf15f('0x43')]);var _0x27ed10={'where':_0x20b41b[_0xf15f('0x3e')]};return db[_0xf15f('0x44')][_0xf15f('0x20')](_0x27ed10)['then'](function(_0x3cd6cc){_0x347ce4[_0xf15f('0x20')]=_0x3cd6cc;if(_0x1b7dd6[_0xf15f('0x32')][_0xf15f('0x45')]){_0x20b41b[_0xf15f('0x46')]=[{'all':!![]}];}return db[_0xf15f('0x44')][_0xf15f('0x47')](_0x20b41b);})[_0xf15f('0x26')](function(_0x2d8743){_0x347ce4[_0xf15f('0x48')]=_0x2d8743;return _0x347ce4;})[_0xf15f('0x26')](respondWithFilteredResult(_0x1bd85d,_0x20b41b))[_0xf15f('0x49')](handleError(_0x1bd85d,null));};exports[_0xf15f('0x4a')]=function(_0x3d8deb,_0x524da3){var _0x32e6d8={'raw':![],'where':{'id':_0x3d8deb[_0xf15f('0x4b')]['id']}},_0x4c3c6c={};_0x4c3c6c[_0xf15f('0x2f')]=_[_0xf15f('0x33')](db[_0xf15f('0x44')][_0xf15f('0x2c')]);_0x4c3c6c['query']=_['keys'](_0x3d8deb['query']);_0x4c3c6c[_0xf15f('0x34')]=_['intersection'](_0x4c3c6c[_0xf15f('0x2f')],_0x4c3c6c[_0xf15f('0x32')]);_0x32e6d8['attributes']=_[_0xf15f('0x35')](_0x4c3c6c[_0xf15f('0x2f')],qs[_0xf15f('0x37')](_0x3d8deb[_0xf15f('0x32')][_0xf15f('0x37')]));_0x32e6d8[_0xf15f('0x36')]=_0x32e6d8[_0xf15f('0x36')]['length']?_0x32e6d8[_0xf15f('0x36')]:_0x4c3c6c[_0xf15f('0x2f')];if(_0x3d8deb['query'][_0xf15f('0x45')]){_0x32e6d8['include']=[{'all':!![]}];}_0x32e6d8=_['merge']({},_0x32e6d8,_0x3d8deb[_0xf15f('0x43')]);return db['AnalyticFieldReport']['find'](_0x32e6d8)[_0xf15f('0x26')](handleEntityNotFound(_0x524da3,null))[_0xf15f('0x26')](respondWithResult(_0x524da3,null))[_0xf15f('0x49')](handleError(_0x524da3,null));};exports[_0xf15f('0x4c')]=function(_0x4b3850,_0x301d8a){return db[_0xf15f('0x44')]['create'](_0x4b3850[_0xf15f('0x4d')],{})['then'](respondWithResult(_0x301d8a,0xc9))[_0xf15f('0x49')](handleError(_0x301d8a,null));};exports[_0xf15f('0x4e')]=function(_0x2150bf,_0x684d95){return db[_0xf15f('0x44')][_0xf15f('0x4e')](_0x2150bf[_0xf15f('0x4d')],{'raw':![],'individualHooks':!![]})[_0xf15f('0x26')](respondWithResult(_0x684d95,0xc9))[_0xf15f('0x49')](handleError(_0x684d95,null));};exports[_0xf15f('0x25')]=function(_0x44bc1c,_0x1b993e){if(_0x44bc1c[_0xf15f('0x4d')]['id']){delete _0x44bc1c[_0xf15f('0x4d')]['id'];}return db[_0xf15f('0x44')]['find']({'where':{'id':_0x44bc1c['params']['id']}})['then'](handleEntityNotFound(_0x1b993e,null))[_0xf15f('0x26')](saveUpdates(_0x44bc1c[_0xf15f('0x4d')],null))[_0xf15f('0x26')](respondWithResult(_0x1b993e,null))[_0xf15f('0x49')](handleError(_0x1b993e,null));};exports[_0xf15f('0x27')]=function(_0x516c54,_0x3446a3){return db['AnalyticFieldReport'][_0xf15f('0x4f')]({'where':{'id':_0x516c54['params']['id']}})['then'](handleEntityNotFound(_0x3446a3,null))[_0xf15f('0x26')](removeEntity(_0x3446a3,null))['catch'](handleError(_0x3446a3,null));};exports[_0xf15f('0x50')]=function(_0x5d8ddb,_0x4d3447){return db['AnalyticFieldReport'][_0xf15f('0x27')]({'where':{'id':_0x5d8ddb[_0xf15f('0x32')][_0xf15f('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0xf15f('0x26')](respondWithResult(_0x4d3447,0xcc))['catch'](handleError(_0x4d3447,null));};exports[_0xf15f('0x52')]=function(_0x41c999,_0x14ff58,_0x2adf3c){return db[_0xf15f('0x53')]['findOne']({'where':{'id':_0x41c999[_0xf15f('0x4b')]['id']}})[_0xf15f('0x26')](handleEntityNotFound(_0x14ff58,null))['then'](function(_0x24b504){if(_0x24b504){return db[_0xf15f('0x54')]['transaction'](function(_0x7bbc25){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x41c999[_0xf15f('0x4b')]['id']},'transaction':_0x7bbc25})[_0xf15f('0x26')](function(_0xc32d72){var _0x5dc7d0=_['map'](_0x41c999['body'],function(_0x2a13ee){delete _0x2a13ee['id'];_0x2a13ee[_0xf15f('0x55')]=_0x41c999[_0xf15f('0x4b')]['id'];return _0x2a13ee;});return db[_0xf15f('0x44')]['bulkCreate'](_0x5dc7d0,{'transaction':_0x7bbc25});});})[_0xf15f('0x26')](function(){return db[_0xf15f('0x44')][_0xf15f('0x47')]({'where':{'CustomReportId':_0x41c999[_0xf15f('0x4b')]['id']}});});}})[_0xf15f('0x26')](respondWithResult(_0x14ff58,null))['catch'](handleError(_0x14ff58,null));}; \ No newline at end of file +var _0x309d=['sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','keys','length','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x56f5b6,_0x217e76){var _0x1e512b=function(_0x1c017f){while(--_0x1c017f){_0x56f5b6['push'](_0x56f5b6['shift']());}};_0x1e512b(++_0x217e76);}(_0x309d,0x1e5));var _0xd309=function(_0x369177,_0x235c2b){_0x369177=_0x369177-0x0;var _0x5f0948=_0x309d[_0x369177];return _0x5f0948;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd309('0x0'));var zipdir=require(_0xd309('0x1'));var jsonpatch=require(_0xd309('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd309('0x3'));var Mustache=require(_0xd309('0x4'));var util=require(_0xd309('0x5'));var path=require(_0xd309('0x6'));var sox=require('sox');var csv=require(_0xd309('0x7'));var ejs=require(_0xd309('0x8'));var fs=require('fs');var fs_extra=require(_0xd309('0x9'));var _=require(_0xd309('0xa'));var squel=require(_0xd309('0xb'));var crypto=require(_0xd309('0xc'));var jsforce=require(_0xd309('0xd'));var deskjs=require(_0xd309('0xe'));var toCsv=require(_0xd309('0x7'));var querystring=require('querystring');var Papa=require(_0xd309('0xf'));var Redis=require(_0xd309('0x10'));var authService=require(_0xd309('0x11'));var qs=require(_0xd309('0x12'));var as=require(_0xd309('0x13'));var hardwareService=require(_0xd309('0x14'));var logger=require(_0xd309('0x15'))(_0xd309('0x16'));var utils=require(_0xd309('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd309('0x18'));var db=require(_0xd309('0x19'))['db'];function respondWithStatusCode(_0x38bfca,_0x150d9b){_0x150d9b=_0x150d9b||0xcc;return function(_0x15bf42){if(_0x15bf42){return _0x38bfca[_0xd309('0x1a')](_0x150d9b);}return _0x38bfca[_0xd309('0x1b')](_0x150d9b)[_0xd309('0x1c')]();};}function respondWithResult(_0x5c3c1e,_0x63104){_0x63104=_0x63104||0xc8;return function(_0x57a52c){if(_0x57a52c){return _0x5c3c1e['status'](_0x63104)[_0xd309('0x1d')](_0x57a52c);}};}function respondWithFilteredResult(_0x6a418e,_0x20208e){return function(_0x367a6d){if(_0x367a6d){var _0xdb8022=typeof _0x20208e[_0xd309('0x1e')]==='undefined'&&typeof _0x20208e[_0xd309('0x1f')]===_0xd309('0x20');var _0x48e52f=_0x367a6d[_0xd309('0x21')];var _0x117c72=_0xdb8022?0x0:_0x20208e[_0xd309('0x1e')];var _0x561386=_0xdb8022?_0x367a6d[_0xd309('0x21')]:_0x20208e[_0xd309('0x1e')]+_0x20208e['limit'];var _0x4536ff;if(_0x561386>=_0x48e52f){_0x561386=_0x48e52f;_0x4536ff=0xc8;}else{_0x4536ff=0xce;}_0x6a418e['status'](_0x4536ff);return _0x6a418e[_0xd309('0x22')](_0xd309('0x23'),_0x117c72+'-'+_0x561386+'/'+_0x48e52f)[_0xd309('0x1d')](_0x367a6d);}return null;};}function patchUpdates(_0x392a57){return function(_0x283716){try{jsonpatch['apply'](_0x283716,_0x392a57,!![]);}catch(_0x76113){return BPromise[_0xd309('0x24')](_0x76113);}return _0x283716['save']();};}function saveUpdates(_0x70c943,_0xce8afc){return function(_0x4c731f){if(_0x4c731f){return _0x4c731f[_0xd309('0x25')](_0x70c943)[_0xd309('0x26')](function(_0x49a39d){return _0x49a39d;});}return null;};}function removeEntity(_0x5bbad3,_0x1963d5){return function(_0x2abe12){if(_0x2abe12){return _0x2abe12[_0xd309('0x27')]()[_0xd309('0x26')](function(){_0x5bbad3[_0xd309('0x1b')](0xcc)[_0xd309('0x1c')]();});}};}function handleEntityNotFound(_0x3a2acb,_0x2f4d43){return function(_0x4f16de){if(!_0x4f16de){_0x3a2acb['sendStatus'](0x194);}return _0x4f16de;};}function handleError(_0x1a8053,_0x1532b1){_0x1532b1=_0x1532b1||0x1f4;return function(_0x48f323){logger['error'](_0x48f323[_0xd309('0x28')]);if(_0x48f323[_0xd309('0x29')]){delete _0x48f323[_0xd309('0x29')];}_0x1a8053[_0xd309('0x1b')](_0x1532b1)['send'](_0x48f323);};}exports['index']=function(_0x404e11,_0x115c53){var _0x1b4aa6={},_0x150a49={},_0x59b048={'count':0x0,'rows':[]};var _0x232b61=_[_0xd309('0x2a')](db[_0xd309('0x2b')][_0xd309('0x2c')],function(_0x1671b5){return{'name':_0x1671b5[_0xd309('0x2d')],'type':_0x1671b5['type'][_0xd309('0x2e')]};});_0x150a49[_0xd309('0x2f')]=_[_0xd309('0x2a')](_0x232b61,_0xd309('0x29'));_0x150a49[_0xd309('0x30')]=_['keys'](_0x404e11[_0xd309('0x30')]);_0x150a49[_0xd309('0x31')]=_[_0xd309('0x32')](_0x150a49['model'],_0x150a49['query']);_0x1b4aa6['attributes']=_['intersection'](_0x150a49[_0xd309('0x2f')],qs[_0xd309('0x33')](_0x404e11[_0xd309('0x30')]['fields']));_0x1b4aa6[_0xd309('0x34')]=_0x1b4aa6[_0xd309('0x34')]['length']?_0x1b4aa6[_0xd309('0x34')]:_0x150a49['model'];if(!_0x404e11[_0xd309('0x30')][_0xd309('0x35')]('nolimit')){_0x1b4aa6[_0xd309('0x1f')]=qs[_0xd309('0x1f')](_0x404e11[_0xd309('0x30')]['limit']);_0x1b4aa6[_0xd309('0x1e')]=qs[_0xd309('0x1e')](_0x404e11[_0xd309('0x30')][_0xd309('0x1e')]);}_0x1b4aa6['order']=qs[_0xd309('0x36')](_0x404e11[_0xd309('0x30')][_0xd309('0x36')]);_0x1b4aa6[_0xd309('0x37')]=qs[_0xd309('0x31')](_[_0xd309('0x38')](_0x404e11[_0xd309('0x30')],_0x150a49[_0xd309('0x31')]),_0x232b61);if(_0x404e11[_0xd309('0x30')][_0xd309('0x39')]){_0x1b4aa6[_0xd309('0x37')]=_[_0xd309('0x3a')](_0x1b4aa6[_0xd309('0x37')],{'$or':_[_0xd309('0x2a')](_0x232b61,function(_0x56143e){if(_0x56143e[_0xd309('0x3b')]!==_0xd309('0x3c')){var _0x1a7073={};_0x1a7073[_0x56143e[_0xd309('0x29')]]={'$like':'%'+_0x404e11[_0xd309('0x30')][_0xd309('0x39')]+'%'};return _0x1a7073;}})});}_0x1b4aa6=_['merge']({},_0x1b4aa6,_0x404e11[_0xd309('0x3d')]);var _0x5e909b={'where':_0x1b4aa6[_0xd309('0x37')]};return db[_0xd309('0x2b')][_0xd309('0x21')](_0x5e909b)['then'](function(_0x2667ba){_0x59b048['count']=_0x2667ba;if(_0x404e11[_0xd309('0x30')]['includeAll']){_0x1b4aa6[_0xd309('0x3e')]=[{'all':!![]}];}return db[_0xd309('0x2b')][_0xd309('0x3f')](_0x1b4aa6);})[_0xd309('0x26')](function(_0x499d3e){_0x59b048['rows']=_0x499d3e;return _0x59b048;})[_0xd309('0x26')](respondWithFilteredResult(_0x115c53,_0x1b4aa6))[_0xd309('0x40')](handleError(_0x115c53,null));};exports['show']=function(_0xa5baa1,_0x59d4ed){var _0x77ec13={'raw':![],'where':{'id':_0xa5baa1['params']['id']}},_0x2f5c61={};_0x2f5c61[_0xd309('0x2f')]=_[_0xd309('0x41')](db['AnalyticFieldReport'][_0xd309('0x2c')]);_0x2f5c61[_0xd309('0x30')]=_[_0xd309('0x41')](_0xa5baa1[_0xd309('0x30')]);_0x2f5c61[_0xd309('0x31')]=_['intersection'](_0x2f5c61[_0xd309('0x2f')],_0x2f5c61[_0xd309('0x30')]);_0x77ec13[_0xd309('0x34')]=_[_0xd309('0x32')](_0x2f5c61['model'],qs[_0xd309('0x33')](_0xa5baa1[_0xd309('0x30')]['fields']));_0x77ec13[_0xd309('0x34')]=_0x77ec13[_0xd309('0x34')][_0xd309('0x42')]?_0x77ec13[_0xd309('0x34')]:_0x2f5c61[_0xd309('0x2f')];if(_0xa5baa1[_0xd309('0x30')]['includeAll']){_0x77ec13[_0xd309('0x3e')]=[{'all':!![]}];}_0x77ec13=_[_0xd309('0x3a')]({},_0x77ec13,_0xa5baa1[_0xd309('0x3d')]);return db[_0xd309('0x2b')][_0xd309('0x43')](_0x77ec13)[_0xd309('0x26')](handleEntityNotFound(_0x59d4ed,null))['then'](respondWithResult(_0x59d4ed,null))[_0xd309('0x40')](handleError(_0x59d4ed,null));};exports[_0xd309('0x44')]=function(_0x3ffb7e,_0x12052f){return db['AnalyticFieldReport'][_0xd309('0x44')](_0x3ffb7e[_0xd309('0x45')],{})['then'](respondWithResult(_0x12052f,0xc9))['catch'](handleError(_0x12052f,null));};exports[_0xd309('0x46')]=function(_0x2d9efc,_0x143620){return db['AnalyticFieldReport'][_0xd309('0x46')](_0x2d9efc[_0xd309('0x45')],{'raw':![],'individualHooks':!![]})[_0xd309('0x26')](respondWithResult(_0x143620,0xc9))[_0xd309('0x40')](handleError(_0x143620,null));};exports[_0xd309('0x25')]=function(_0x416299,_0x2ab7be){if(_0x416299[_0xd309('0x45')]['id']){delete _0x416299[_0xd309('0x45')]['id'];}return db[_0xd309('0x2b')][_0xd309('0x43')]({'where':{'id':_0x416299[_0xd309('0x47')]['id']}})[_0xd309('0x26')](handleEntityNotFound(_0x2ab7be,null))[_0xd309('0x26')](saveUpdates(_0x416299[_0xd309('0x45')],null))[_0xd309('0x26')](respondWithResult(_0x2ab7be,null))[_0xd309('0x40')](handleError(_0x2ab7be,null));};exports[_0xd309('0x27')]=function(_0x2257b1,_0x3f98b0){return db['AnalyticFieldReport'][_0xd309('0x43')]({'where':{'id':_0x2257b1[_0xd309('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f98b0,null))[_0xd309('0x26')](removeEntity(_0x3f98b0,null))[_0xd309('0x40')](handleError(_0x3f98b0,null));};exports[_0xd309('0x48')]=function(_0x748f6f,_0x430b59){return db[_0xd309('0x2b')][_0xd309('0x27')]({'where':{'id':_0x748f6f[_0xd309('0x30')][_0xd309('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xd309('0x26')](respondWithResult(_0x430b59,0xcc))[_0xd309('0x40')](handleError(_0x430b59,null));};exports[_0xd309('0x4a')]=function(_0x355c4c,_0x55d0ad,_0x1b5f84){return db[_0xd309('0x4b')]['findOne']({'where':{'id':_0x355c4c[_0xd309('0x47')]['id']}})['then'](handleEntityNotFound(_0x55d0ad,null))[_0xd309('0x26')](function(_0x57ebc1){if(_0x57ebc1){return db[_0xd309('0x4c')]['transaction'](function(_0x34c240){return db['AnalyticFieldReport'][_0xd309('0x27')]({'where':{'CustomReportId':_0x355c4c[_0xd309('0x47')]['id']},'transaction':_0x34c240})[_0xd309('0x26')](function(_0x28d79c){var _0x33ea2e=_['map'](_0x355c4c[_0xd309('0x45')],function(_0x2564a2){delete _0x2564a2['id'];_0x2564a2['CustomReportId']=_0x355c4c['params']['id'];return _0x2564a2;});return db['AnalyticFieldReport'][_0xd309('0x46')](_0x33ea2e,{'transaction':_0x34c240});});})['then'](function(){return db[_0xd309('0x2b')][_0xd309('0x3f')]({'where':{'CustomReportId':_0x355c4c[_0xd309('0x47')]['id']}});});}})[_0xd309('0x26')](respondWithResult(_0x55d0ad,null))[_0xd309('0x40')](handleError(_0x55d0ad,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 29e22e6..4ab3e59 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 _0xaed4=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x462c06,_0x55cc75){var _0xa347cd=function(_0x1bb939){while(--_0x1bb939){_0x462c06['push'](_0x462c06['shift']());}};_0xa347cd(++_0x55cc75);}(_0xaed4,0x173));var _0x4aed=function(_0x36ceb0,_0x400094){_0x36ceb0=_0x36ceb0-0x0;var _0x36498a=_0xaed4[_0x36ceb0];return _0x36498a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4aed('0x0'))(_0x4aed('0x1'));var moment=require(_0x4aed('0x2'));var BPromise=require(_0x4aed('0x3'));var rp=require(_0x4aed('0x4'));var fs=require('fs');var path=require(_0x4aed('0x5'));var rimraf=require(_0x4aed('0x6'));var config=require(_0x4aed('0x7'));var attributes=require(_0x4aed('0x8'));module[_0x4aed('0x9')]=function(_0x55e5ec,_0x290817){return _0x55e5ec[_0x4aed('0xa')](_0x4aed('0xb'),attributes,{'tableName':_0x4aed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b4c=['analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x133156,_0x109b02){var _0xb6d904=function(_0x2dc8ba){while(--_0x2dc8ba){_0x133156['push'](_0x133156['shift']());}};_0xb6d904(++_0x109b02);}(_0x9b4c,0x198));var _0xc9b4=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x9b4c[_0x4fe19c];return _0x952ac7;};'use strict';var _=require('lodash');var util=require(_0xc9b4('0x0'));var logger=require(_0xc9b4('0x1'))(_0xc9b4('0x2'));var moment=require(_0xc9b4('0x3'));var BPromise=require(_0xc9b4('0x4'));var rp=require(_0xc9b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b4('0x6'));var config=require(_0xc9b4('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xc9b4('0x8')]=function(_0x28420f,_0x255689){return _0x28420f[_0xc9b4('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xc9b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 577e4e0..c3cfcbb 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 _0x483e=['jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a4768,_0x592e18){var _0x42d417=function(_0x21def4){while(--_0x21def4){_0x4a4768['push'](_0x4a4768['shift']());}};_0x42d417(++_0x592e18);}(_0x483e,0x14e));var _0xe483=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x483e[_0x67f95e];return _0x538f5a;};'use strict';var _=require(_0xe483('0x0'));var util=require('util');var moment=require(_0xe483('0x1'));var BPromise=require(_0xe483('0x2'));var rs=require(_0xe483('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe483('0x4'))['db'];var utils=require(_0xe483('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe483('0x6'));var client=jayson[_0xe483('0x7')][_0xe483('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52b9e3,_0x347a55,_0x376827){return new BPromise(function(_0x58d8e7,_0x55bcc1){return client[_0xe483('0x9')](_0x52b9e3,_0x376827)[_0xe483('0xa')](function(_0xe8763f){logger[_0xe483('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x347a55,'request\x20sent');logger['debug'](_0xe483('0xc'),_0x347a55,_0xe483('0xd'),JSON[_0xe483('0xe')](_0xe8763f));if(_0xe8763f[_0xe483('0xf')]){if(_0xe8763f['error'][_0xe483('0x10')]===0x1f4){logger[_0xe483('0xf')](_0xe483('0x11'),_0x347a55,_0xe8763f['error'][_0xe483('0x12')]);return _0x55bcc1(_0xe8763f['error'][_0xe483('0x12')]);}logger[_0xe483('0xf')](_0xe483('0x11'),_0x347a55,_0xe8763f[_0xe483('0xf')][_0xe483('0x12')]);return _0x58d8e7(_0xe8763f[_0xe483('0xf')][_0xe483('0x12')]);}else{logger['info'](_0xe483('0x11'),_0x347a55,_0xe483('0xd'));_0x58d8e7(_0xe8763f['result'][_0xe483('0x12')]);}})[_0xe483('0x13')](function(_0x37e38a){logger[_0xe483('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x347a55,_0x37e38a);_0x55bcc1(_0x37e38a);});});} \ No newline at end of file +var _0x4caf=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x17ed7d,_0x5547ce){var _0x74132a=function(_0x397908){while(--_0x397908){_0x17ed7d['push'](_0x17ed7d['shift']());}};_0x74132a(++_0x5547ce);}(_0x4caf,0xf0));var _0xf4ca=function(_0x3dad9d,_0x24c027){_0x3dad9d=_0x3dad9d-0x0;var _0x314e3a=_0x4caf[_0x3dad9d];return _0x314e3a;};'use strict';var _=require('lodash');var util=require(_0xf4ca('0x0'));var moment=require('moment');var BPromise=require(_0xf4ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4ca('0x2'))['db'];var utils=require(_0xf4ca('0x3'));var logger=require(_0xf4ca('0x4'))(_0xf4ca('0x5'));var config=require(_0xf4ca('0x6'));var jayson=require(_0xf4ca('0x7'));var client=jayson[_0xf4ca('0x8')][_0xf4ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87c1e7,_0x44683e,_0x2fb810){return new BPromise(function(_0x59761e,_0x373b6a){return client['request'](_0x87c1e7,_0x2fb810)[_0xf4ca('0xa')](function(_0x18e901){logger[_0xf4ca('0xb')](_0xf4ca('0xc'),_0x44683e,_0xf4ca('0xd'));logger[_0xf4ca('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x44683e,'request\x20sent',JSON[_0xf4ca('0xf')](_0x18e901));if(_0x18e901['error']){if(_0x18e901[_0xf4ca('0x10')][_0xf4ca('0x11')]===0x1f4){logger[_0xf4ca('0x10')](_0xf4ca('0xc'),_0x44683e,_0x18e901[_0xf4ca('0x10')]['message']);return _0x373b6a(_0x18e901['error'][_0xf4ca('0x12')]);}logger[_0xf4ca('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x44683e,_0x18e901['error']['message']);return _0x59761e(_0x18e901['error'][_0xf4ca('0x12')]);}else{logger['info'](_0xf4ca('0xc'),_0x44683e,'request\x20sent');_0x59761e(_0x18e901['result'][_0xf4ca('0x12')]);}})[_0xf4ca('0x13')](function(_0x1e2aff){logger[_0xf4ca('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x44683e,_0x1e2aff);_0x373b6a(_0x1e2aff);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ae37364..c4e9cc2 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(_0x580303,_0x54c923){var _0x1edb7d=function(_0xeb883f){while(--_0xeb883f){_0x580303['push'](_0x580303['shift']());}};_0x1edb7d(++_0x54c923);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x53b9e9,_0x582db1){var _0x370056=function(_0x301788){while(--_0x301788){_0x53b9e9['push'](_0x53b9e9['shift']());}};_0x370056(++_0x582db1);}(_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('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 d689580..d57a3c5 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 _0x58a7=['name','TEXT','sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x58a7,0xf7));var _0x758a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x58a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x758a('0x0'));module[_0x758a('0x1')]={'name':{'type':Sequelize[_0x758a('0x2')],'allowNull':![],'unique':_0x758a('0x3')},'table':{'type':Sequelize[_0x758a('0x2')]},'metric':{'type':Sequelize[_0x758a('0x4')]},'description':{'type':Sequelize[_0x758a('0x2')]}}; \ No newline at end of file +var _0x4ffe=['STRING','TEXT','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4ffe,0x172));var _0xe4ff=function(_0x15f852,_0x530d85){_0x15f852=_0x15f852-0x0;var _0x387460=_0x4ffe[_0x15f852];return _0x387460;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'name':{'type':Sequelize[_0xe4ff('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe4ff('0x2')]},'metric':{'type':Sequelize[_0xe4ff('0x3')]},'description':{'type':Sequelize[_0xe4ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5bfa15f..5fb1551 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x16360c,_0x37c098){var _0x17dd2d=function(_0x32b306){while(--_0x32b306){_0x16360c['push'](_0x16360c['shift']());}};_0x17dd2d(++_0x37c098);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x271429,_0x25a7cc){_0x271429=_0x271429-0x0;var _0x1426b6=_0x9c5a[_0x271429];return _0x1426b6;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xaf74e9,_0x1095cb){var _0x305840=function(_0x5b800c){while(--_0x5b800c){_0xaf74e9['push'](_0xaf74e9['shift']());}};_0x305840(++_0x1095cb);}(_0x55ca,0x126));var _0xa55c=function(_0x3bae28,_0x5ca4f5){_0x3bae28=_0x3bae28-0x0;var _0xb431b=_0x55ca[_0x3bae28];return _0xb431b;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2a4d9b2..0373302 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 _0x6822=['path','rimraf','./analyticMetric.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54dd2f,_0x5a62c7){var _0x3a5483=function(_0x4b011d){while(--_0x4b011d){_0x54dd2f['push'](_0x54dd2f['shift']());}};_0x3a5483(++_0x5a62c7);}(_0x6822,0xca));var _0x2682=function(_0x2dc119,_0x54a53d){_0x2dc119=_0x2dc119-0x0;var _0x55ce4f=_0x6822[_0x2dc119];return _0x55ce4f;};'use strict';var _=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var logger=require(_0x2682('0x2'))(_0x2682('0x3'));var moment=require(_0x2682('0x4'));var BPromise=require(_0x2682('0x5'));var rp=require(_0x2682('0x6'));var fs=require('fs');var path=require(_0x2682('0x7'));var rimraf=require(_0x2682('0x8'));var config=require('../../config/environment');var attributes=require(_0x2682('0x9'));module['exports']=function(_0x30fcd9,_0x39d4f7){return _0x30fcd9[_0x2682('0xa')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['rimraf','../../config/environment','./analyticMetric.attributes','define','analytics_metrics','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0309,0x165));var _0x9030=function(_0xcfd2fd,_0x40a3cf){_0xcfd2fd=_0xcfd2fd-0x0;var _0x2ad9b8=_0x0309[_0xcfd2fd];return _0x2ad9b8;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('AnalyticMetric',attributes,{'tableName':_0x9030('0xa'),'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 80a4510..7b9d6a4 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 _0x4205=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','lodash','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4205,0x15d));var _0x5420=function(_0x2d5c00,_0x41f173){_0x2d5c00=_0x2d5c00-0x0;var _0x1e8c4e=_0x4205[_0x2d5c00];return _0x1e8c4e;};'use strict';var _=require(_0x5420('0x0'));var util=require(_0x5420('0x1'));var moment=require(_0x5420('0x2'));var BPromise=require(_0x5420('0x3'));var rs=require(_0x5420('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5420('0x5'))['db'];var utils=require(_0x5420('0x6'));var logger=require(_0x5420('0x7'))('rpc');var config=require(_0x5420('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5420('0x9')][_0x5420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d29ba,_0x150908,_0x1bc905){return new BPromise(function(_0x4ca433,_0x51009f){return client[_0x5420('0xb')](_0x4d29ba,_0x1bc905)[_0x5420('0xc')](function(_0xdd0cac){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x150908,_0x5420('0xd'));logger[_0x5420('0xe')](_0x5420('0xf'),_0x150908,_0x5420('0xd'),JSON[_0x5420('0x10')](_0xdd0cac));if(_0xdd0cac[_0x5420('0x11')]){if(_0xdd0cac[_0x5420('0x11')][_0x5420('0x12')]===0x1f4){logger['error'](_0x5420('0x13'),_0x150908,_0xdd0cac[_0x5420('0x11')][_0x5420('0x14')]);return _0x51009f(_0xdd0cac[_0x5420('0x11')][_0x5420('0x14')]);}logger['error'](_0x5420('0x13'),_0x150908,_0xdd0cac[_0x5420('0x11')][_0x5420('0x14')]);return _0x4ca433(_0xdd0cac[_0x5420('0x11')]['message']);}else{logger[_0x5420('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x150908,_0x5420('0xd'));_0x4ca433(_0xdd0cac['result'][_0x5420('0x14')]);}})['catch'](function(_0x37c918){logger['error'](_0x5420('0x13'),_0x150908,_0x37c918);_0x51009f(_0x37c918);});});} \ No newline at end of file +var _0x320d=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info'];(function(_0x2828f8,_0x39a528){var _0x4f5aae=function(_0x3cc63b){while(--_0x3cc63b){_0x2828f8['push'](_0x2828f8['shift']());}};_0x4f5aae(++_0x39a528);}(_0x320d,0x135));var _0xd320=function(_0x2d0ea5,_0x2654ec){_0x2d0ea5=_0x2d0ea5-0x0;var _0x42b033=_0x320d[_0x2d0ea5];return _0x42b033;};'use strict';var _=require(_0xd320('0x0'));var util=require(_0xd320('0x1'));var moment=require(_0xd320('0x2'));var BPromise=require('bluebird');var rs=require(_0xd320('0x3'));var fs=require('fs');var Redis=require(_0xd320('0x4'));var db=require(_0xd320('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd320('0x6'))(_0xd320('0x7'));var config=require(_0xd320('0x8'));var jayson=require(_0xd320('0x9'));var client=jayson['client'][_0xd320('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b83a8,_0x5b7863,_0x5e17a5){return new BPromise(function(_0x39cf55,_0x2fcf8b){return client[_0xd320('0xb')](_0x2b83a8,_0x5e17a5)[_0xd320('0xc')](function(_0x22bab4){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5b7863,'request\x20sent');logger[_0xd320('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5b7863,_0xd320('0xe'),JSON[_0xd320('0xf')](_0x22bab4));if(_0x22bab4[_0xd320('0x10')]){if(_0x22bab4[_0xd320('0x10')][_0xd320('0x11')]===0x1f4){logger['error'](_0xd320('0x12'),_0x5b7863,_0x22bab4['error'][_0xd320('0x13')]);return _0x2fcf8b(_0x22bab4[_0xd320('0x10')][_0xd320('0x13')]);}logger[_0xd320('0x10')](_0xd320('0x12'),_0x5b7863,_0x22bab4['error'][_0xd320('0x13')]);return _0x39cf55(_0x22bab4['error'][_0xd320('0x13')]);}else{logger[_0xd320('0x14')](_0xd320('0x12'),_0x5b7863,'request\x20sent');_0x39cf55(_0x22bab4['result'][_0xd320('0x13')]);}})[_0xd320('0x15')](function(_0x159978){logger[_0xd320('0x10')](_0xd320('0x12'),_0x5b7863,_0x159978);_0x2fcf8b(_0x159978);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 45e8b81..0761dff 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 _0xe93b=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x250641,_0xc06eea){var _0x86c8a8=function(_0x28c4bf){while(--_0x28c4bf){_0x250641['push'](_0x250641['shift']());}};_0x86c8a8(++_0xc06eea);}(_0xe93b,0x1c2));var _0xbe93=function(_0x3290e6,_0xceafbc){_0x3290e6=_0x3290e6-0x0;var _0x4e8f7f=_0xe93b[_0x3290e6];return _0x4e8f7f;};'use strict';var multer=require('multer');var util=require(_0xbe93('0x0'));var path=require(_0xbe93('0x1'));var timeout=require(_0xbe93('0x2'));var express=require('express');var router=express[_0xbe93('0x3')]();var fs_extra=require(_0xbe93('0x4'));var auth=require(_0xbe93('0x5'));var interaction=require(_0xbe93('0x6'));var config=require(_0xbe93('0x7'));var controller=require(_0xbe93('0x8'));router[_0xbe93('0x9')]('/',auth[_0xbe93('0xa')](),controller['index']);router[_0xbe93('0x9')](_0xbe93('0xb'),auth[_0xbe93('0xa')](),controller[_0xbe93('0xc')]);router[_0xbe93('0xd')]('/',auth[_0xbe93('0xa')](),controller[_0xbe93('0xe')]);router[_0xbe93('0xf')](_0xbe93('0xb'),auth['isAuthenticated'](),controller[_0xbe93('0x10')]);router[_0xbe93('0x11')](_0xbe93('0xb'),auth[_0xbe93('0xa')](),controller[_0xbe93('0x12')]);module[_0xbe93('0x13')]=router; \ No newline at end of file +var _0x3148=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','multer'];(function(_0x33350c,_0x1f85d8){var _0x3a1eeb=function(_0x21863d){while(--_0x21863d){_0x33350c['push'](_0x33350c['shift']());}};_0x3a1eeb(++_0x1f85d8);}(_0x3148,0x1d3));var _0x8314=function(_0x5bff9e,_0x39ea3a){_0x5bff9e=_0x5bff9e-0x0;var _0x7f42ef=_0x3148[_0x5bff9e];return _0x7f42ef;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var fs_extra=require(_0x8314('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var controller=require(_0x8314('0x8'));router[_0x8314('0x9')]('/',auth[_0x8314('0xa')](),controller[_0x8314('0xb')]);router[_0x8314('0x9')]('/:id',auth[_0x8314('0xa')](),controller['show']);router[_0x8314('0xc')]('/',auth[_0x8314('0xa')](),controller[_0x8314('0xd')]);router[_0x8314('0xe')](_0x8314('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8314('0x10')](_0x8314('0xf'),auth[_0x8314('0xa')](),controller[_0x8314('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index db04f0a..d14c109 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 _0xbdb8=['sequelize','exports'];(function(_0x2b0b4c,_0x385f66){var _0x1c0e1a=function(_0x46c69f){while(--_0x46c69f){_0x2b0b4c['push'](_0x2b0b4c['shift']());}};_0x1c0e1a(++_0x385f66);}(_0xbdb8,0xe2));var _0x8bdb=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0xbdb8[_0x41b29e];return _0xacd517;};'use strict';var Sequelize=require(_0x8bdb('0x0'));module[_0x8bdb('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x20cb=['exports','TEXT'];(function(_0xb89eab,_0x905eba){var _0x1706ba=function(_0x411ad4){while(--_0x411ad4){_0xb89eab['push'](_0xb89eab['shift']());}};_0x1706ba(++_0x905eba);}(_0x20cb,0x12a));var _0xb20c=function(_0x454f02,_0x4af1d9){_0x454f02=_0x454f02-0x0;var _0x46a8e7=_0x20cb[_0x454f02];return _0x46a8e7;};'use strict';var Sequelize=require('sequelize');module[_0xb20c('0x0')]={'tree':{'type':Sequelize[_0xb20c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index c4da01e..af7cb21 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 _0x0991=['send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x54a911,_0x394179){var _0x381526=function(_0x514ed5){while(--_0x514ed5){_0x54a911['push'](_0x54a911['shift']());}};_0x381526(++_0x394179);}(_0x0991,0xb8));var _0x1099=function(_0x4bf100,_0x3d9fcf){_0x4bf100=_0x4bf100-0x0;var _0x2a3aaf=_0x0991[_0x4bf100];return _0x2a3aaf;};'use strict';var emlformat=require(_0x1099('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1099('0x1'));var rp=require(_0x1099('0x2'));var moment=require(_0x1099('0x3'));var BPromise=require(_0x1099('0x4'));var Mustache=require(_0x1099('0x5'));var util=require(_0x1099('0x6'));var path=require('path');var sox=require(_0x1099('0x7'));var csv=require(_0x1099('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1099('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1099('0xa'));var jsforce=require(_0x1099('0xb'));var deskjs=require(_0x1099('0xc'));var toCsv=require(_0x1099('0x8'));var querystring=require(_0x1099('0xd'));var Papa=require('papaparse');var Redis=require(_0x1099('0xe'));var authService=require(_0x1099('0xf'));var qs=require(_0x1099('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1099('0x11'));var logger=require(_0x1099('0x12'))('api');var utils=require(_0x1099('0x13'));var config=require(_0x1099('0x14'));var licenseUtil=require(_0x1099('0x15'));var db=require(_0x1099('0x16'))['db'];function respondWithStatusCode(_0x49cb83,_0x34804a){_0x34804a=_0x34804a||0xcc;return function(_0x32e30c){if(_0x32e30c){return _0x49cb83[_0x1099('0x17')](_0x34804a);}return _0x49cb83[_0x1099('0x18')](_0x34804a)[_0x1099('0x19')]();};}function respondWithResult(_0x205e68,_0x5cca6c){_0x5cca6c=_0x5cca6c||0xc8;return function(_0x3ca79c){if(_0x3ca79c){return _0x205e68[_0x1099('0x18')](_0x5cca6c)[_0x1099('0x1a')](_0x3ca79c);}};}function respondWithFilteredResult(_0x111f92,_0x6dc43a){return function(_0x248977){if(_0x248977){var _0x3cd306=typeof _0x6dc43a[_0x1099('0x1b')]==='undefined'&&typeof _0x6dc43a[_0x1099('0x1c')]===_0x1099('0x1d');var _0x3d4c3a=_0x248977[_0x1099('0x1e')];var _0x41a3d7=_0x3cd306?0x0:_0x6dc43a[_0x1099('0x1b')];var _0x34d524=_0x3cd306?_0x248977[_0x1099('0x1e')]:_0x6dc43a[_0x1099('0x1b')]+_0x6dc43a[_0x1099('0x1c')];var _0x2205fd;if(_0x34d524>=_0x3d4c3a){_0x34d524=_0x3d4c3a;_0x2205fd=0xc8;}else{_0x2205fd=0xce;}_0x111f92[_0x1099('0x18')](_0x2205fd);return _0x111f92[_0x1099('0x1f')](_0x1099('0x20'),_0x41a3d7+'-'+_0x34d524+'/'+_0x3d4c3a)['json'](_0x248977);}return null;};}function patchUpdates(_0x2934e7){return function(_0x287f1f){try{jsonpatch[_0x1099('0x21')](_0x287f1f,_0x2934e7,!![]);}catch(_0x387732){return BPromise[_0x1099('0x22')](_0x387732);}return _0x287f1f[_0x1099('0x23')]();};}function saveUpdates(_0xa4b26c,_0x333676){return function(_0x24e89a){if(_0x24e89a){return _0x24e89a['update'](_0xa4b26c)[_0x1099('0x24')](function(_0x16ae52){return _0x16ae52;});}return null;};}function removeEntity(_0x22ce5f,_0x4619e1){return function(_0x454e78){if(_0x454e78){return _0x454e78[_0x1099('0x25')]()[_0x1099('0x24')](function(){_0x22ce5f[_0x1099('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6e25,_0x5e73f6){return function(_0x3796ba){if(!_0x3796ba){_0x4a6e25[_0x1099('0x17')](0x194);}return _0x3796ba;};}function handleError(_0x419cb0,_0x1e396e){_0x1e396e=_0x1e396e||0x1f4;return function(_0x1a3eab){logger[_0x1099('0x26')](_0x1a3eab[_0x1099('0x27')]);if(_0x1a3eab[_0x1099('0x28')]){delete _0x1a3eab[_0x1099('0x28')];}_0x419cb0[_0x1099('0x18')](_0x1e396e)[_0x1099('0x29')](_0x1a3eab);};}exports[_0x1099('0x2a')]=function(_0x46b94e,_0x5a45ae){var _0x2c912a={},_0x5dd32c={},_0x218404={'count':0x0,'rows':[]};var _0x583fe6=_[_0x1099('0x2b')](db[_0x1099('0x2c')][_0x1099('0x2d')],function(_0x36f587){return{'name':_0x36f587[_0x1099('0x2e')],'type':_0x36f587[_0x1099('0x2f')][_0x1099('0x30')]};});_0x5dd32c[_0x1099('0x31')]=_[_0x1099('0x2b')](_0x583fe6,'name');_0x5dd32c[_0x1099('0x32')]=_[_0x1099('0x33')](_0x46b94e[_0x1099('0x32')]);_0x5dd32c[_0x1099('0x34')]=_[_0x1099('0x35')](_0x5dd32c[_0x1099('0x31')],_0x5dd32c[_0x1099('0x32')]);_0x2c912a['attributes']=_[_0x1099('0x35')](_0x5dd32c[_0x1099('0x31')],qs[_0x1099('0x36')](_0x46b94e[_0x1099('0x32')][_0x1099('0x36')]));_0x2c912a[_0x1099('0x37')]=_0x2c912a[_0x1099('0x37')][_0x1099('0x38')]?_0x2c912a['attributes']:_0x5dd32c[_0x1099('0x31')];if(!_0x46b94e[_0x1099('0x32')][_0x1099('0x39')](_0x1099('0x3a'))){_0x2c912a['limit']=qs[_0x1099('0x1c')](_0x46b94e['query']['limit']);_0x2c912a[_0x1099('0x1b')]=qs[_0x1099('0x1b')](_0x46b94e[_0x1099('0x32')][_0x1099('0x1b')]);}_0x2c912a[_0x1099('0x3b')]=qs[_0x1099('0x3c')](_0x46b94e[_0x1099('0x32')][_0x1099('0x3c')]);_0x2c912a[_0x1099('0x3d')]=qs[_0x1099('0x34')](_['pick'](_0x46b94e['query'],_0x5dd32c[_0x1099('0x34')]),_0x583fe6);if(_0x46b94e[_0x1099('0x32')]['filter']){_0x2c912a['where']=_['merge'](_0x2c912a['where'],{'$or':_[_0x1099('0x2b')](_0x583fe6,function(_0x24ceff){if(_0x24ceff[_0x1099('0x2f')]!==_0x1099('0x3e')){var _0x22e76c={};_0x22e76c[_0x24ceff[_0x1099('0x28')]]={'$like':'%'+_0x46b94e[_0x1099('0x32')][_0x1099('0x3f')]+'%'};return _0x22e76c;}})});}_0x2c912a=_[_0x1099('0x40')]({},_0x2c912a,_0x46b94e[_0x1099('0x41')]);var _0x17b67d={'where':_0x2c912a[_0x1099('0x3d')]};return db[_0x1099('0x2c')]['count'](_0x17b67d)[_0x1099('0x24')](function(_0x383428){_0x218404[_0x1099('0x1e')]=_0x383428;if(_0x46b94e[_0x1099('0x32')]['includeAll']){_0x2c912a[_0x1099('0x42')]=[{'all':!![]}];}return db[_0x1099('0x2c')][_0x1099('0x43')](_0x2c912a);})[_0x1099('0x24')](function(_0x39d8e1){_0x218404[_0x1099('0x44')]=_0x39d8e1;return _0x218404;})['then'](respondWithFilteredResult(_0x5a45ae,_0x2c912a))[_0x1099('0x45')](handleError(_0x5a45ae,null));};exports[_0x1099('0x46')]=function(_0x3f302f,_0x952a49){var _0x11b89f={'raw':!![],'where':{'id':_0x3f302f['params']['id']}},_0x5e03af={};_0x5e03af[_0x1099('0x31')]=_['keys'](db[_0x1099('0x2c')][_0x1099('0x2d')]);_0x5e03af[_0x1099('0x32')]=_[_0x1099('0x33')](_0x3f302f[_0x1099('0x32')]);_0x5e03af[_0x1099('0x34')]=_['intersection'](_0x5e03af[_0x1099('0x31')],_0x5e03af[_0x1099('0x32')]);_0x11b89f[_0x1099('0x37')]=_['intersection'](_0x5e03af['model'],qs[_0x1099('0x36')](_0x3f302f['query'][_0x1099('0x36')]));_0x11b89f[_0x1099('0x37')]=_0x11b89f[_0x1099('0x37')][_0x1099('0x38')]?_0x11b89f[_0x1099('0x37')]:_0x5e03af['model'];if(_0x3f302f['query']['includeAll']){_0x11b89f['include']=[{'all':!![]}];}_0x11b89f=_['merge']({},_0x11b89f,_0x3f302f[_0x1099('0x41')]);return db[_0x1099('0x2c')][_0x1099('0x47')](_0x11b89f)[_0x1099('0x24')](handleEntityNotFound(_0x952a49,null))[_0x1099('0x24')](respondWithResult(_0x952a49,null))[_0x1099('0x45')](handleError(_0x952a49,null));};exports[_0x1099('0x48')]=function(_0x5386d3,_0x554236){return db[_0x1099('0x2c')][_0x1099('0x48')](_0x5386d3[_0x1099('0x49')],{})[_0x1099('0x24')](respondWithResult(_0x554236,0xc9))[_0x1099('0x45')](handleError(_0x554236,null));};exports['update']=function(_0x351a33,_0x5d6bf0){if(_0x351a33[_0x1099('0x49')]['id']){delete _0x351a33[_0x1099('0x49')]['id'];}return db[_0x1099('0x2c')][_0x1099('0x47')]({'where':{'id':_0x351a33[_0x1099('0x4a')]['id']}})[_0x1099('0x24')](handleEntityNotFound(_0x5d6bf0,null))[_0x1099('0x24')](saveUpdates(_0x351a33[_0x1099('0x49')],null))[_0x1099('0x24')](respondWithResult(_0x5d6bf0,null))[_0x1099('0x45')](handleError(_0x5d6bf0,null));};exports[_0x1099('0x25')]=function(_0x4f516f,_0x2e65f5){return db['AnalyticTreeReport']['find']({'where':{'id':_0x4f516f['params']['id']}})[_0x1099('0x24')](handleEntityNotFound(_0x2e65f5,null))[_0x1099('0x24')](removeEntity(_0x2e65f5,null))['catch'](handleError(_0x2e65f5,null));}; \ No newline at end of file +var _0x10b0=['../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x56ec94,_0x539e9e){var _0x5a88e3=function(_0x562e25){while(--_0x562e25){_0x56ec94['push'](_0x56ec94['shift']());}};_0x5a88e3(++_0x539e9e);}(_0x10b0,0x11b));var _0x010b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x10b0[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x010b('0x0'));var rimraf=require(_0x010b('0x1'));var zipdir=require(_0x010b('0x2'));var jsonpatch=require(_0x010b('0x3'));var rp=require(_0x010b('0x4'));var moment=require(_0x010b('0x5'));var BPromise=require(_0x010b('0x6'));var Mustache=require(_0x010b('0x7'));var util=require(_0x010b('0x8'));var path=require(_0x010b('0x9'));var sox=require('sox');var csv=require(_0x010b('0xa'));var ejs=require(_0x010b('0xb'));var fs=require('fs');var fs_extra=require(_0x010b('0xc'));var _=require(_0x010b('0xd'));var squel=require(_0x010b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x010b('0xf'));var toCsv=require(_0x010b('0xa'));var querystring=require(_0x010b('0x10'));var Papa=require(_0x010b('0x11'));var Redis=require('ioredis');var authService=require(_0x010b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x010b('0x13'));var hardwareService=require(_0x010b('0x14'));var logger=require(_0x010b('0x15'))(_0x010b('0x16'));var utils=require('../../config/utils');var config=require(_0x010b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x453bd9,_0x59701b){_0x59701b=_0x59701b||0xcc;return function(_0x292fab){if(_0x292fab){return _0x453bd9[_0x010b('0x18')](_0x59701b);}return _0x453bd9[_0x010b('0x19')](_0x59701b)[_0x010b('0x1a')]();};}function respondWithResult(_0x2c7d20,_0x229747){_0x229747=_0x229747||0xc8;return function(_0x34970d){if(_0x34970d){return _0x2c7d20[_0x010b('0x19')](_0x229747)[_0x010b('0x1b')](_0x34970d);}};}function respondWithFilteredResult(_0xff86d7,_0x51d392){return function(_0x4dad68){if(_0x4dad68){var _0x33fb4c=typeof _0x51d392[_0x010b('0x1c')]===_0x010b('0x1d')&&typeof _0x51d392[_0x010b('0x1e')]==='undefined';var _0x4c7002=_0x4dad68[_0x010b('0x1f')];var _0x26f011=_0x33fb4c?0x0:_0x51d392[_0x010b('0x1c')];var _0x406cde=_0x33fb4c?_0x4dad68[_0x010b('0x1f')]:_0x51d392['offset']+_0x51d392[_0x010b('0x1e')];var _0x277004;if(_0x406cde>=_0x4c7002){_0x406cde=_0x4c7002;_0x277004=0xc8;}else{_0x277004=0xce;}_0xff86d7[_0x010b('0x19')](_0x277004);return _0xff86d7[_0x010b('0x20')]('Content-Range',_0x26f011+'-'+_0x406cde+'/'+_0x4c7002)['json'](_0x4dad68);}return null;};}function patchUpdates(_0x22dda2){return function(_0x12800f){try{jsonpatch[_0x010b('0x21')](_0x12800f,_0x22dda2,!![]);}catch(_0x51ee03){return BPromise[_0x010b('0x22')](_0x51ee03);}return _0x12800f[_0x010b('0x23')]();};}function saveUpdates(_0x5b867e,_0x183111){return function(_0x333f70){if(_0x333f70){return _0x333f70[_0x010b('0x24')](_0x5b867e)[_0x010b('0x25')](function(_0x3070e7){return _0x3070e7;});}return null;};}function removeEntity(_0x5c2f0b,_0x42fffc){return function(_0x8ecda7){if(_0x8ecda7){return _0x8ecda7['destroy']()['then'](function(){_0x5c2f0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8f65,_0x3c3dd1){return function(_0xda66f1){if(!_0xda66f1){_0x5e8f65[_0x010b('0x18')](0x194);}return _0xda66f1;};}function handleError(_0x1e9992,_0x11ff97){_0x11ff97=_0x11ff97||0x1f4;return function(_0x4987a7){logger[_0x010b('0x26')](_0x4987a7[_0x010b('0x27')]);if(_0x4987a7[_0x010b('0x28')]){delete _0x4987a7[_0x010b('0x28')];}_0x1e9992[_0x010b('0x19')](_0x11ff97)[_0x010b('0x29')](_0x4987a7);};}exports[_0x010b('0x2a')]=function(_0x3ab26a,_0x1c14ae){var _0x10b53d={},_0x56bc87={},_0x40edea={'count':0x0,'rows':[]};var _0x35675e=_['map'](db[_0x010b('0x2b')][_0x010b('0x2c')],function(_0x3ba0fa){return{'name':_0x3ba0fa[_0x010b('0x2d')],'type':_0x3ba0fa[_0x010b('0x2e')][_0x010b('0x2f')]};});_0x56bc87[_0x010b('0x30')]=_['map'](_0x35675e,_0x010b('0x28'));_0x56bc87[_0x010b('0x31')]=_[_0x010b('0x32')](_0x3ab26a[_0x010b('0x31')]);_0x56bc87[_0x010b('0x33')]=_[_0x010b('0x34')](_0x56bc87[_0x010b('0x30')],_0x56bc87[_0x010b('0x31')]);_0x10b53d[_0x010b('0x35')]=_[_0x010b('0x34')](_0x56bc87[_0x010b('0x30')],qs[_0x010b('0x36')](_0x3ab26a['query'][_0x010b('0x36')]));_0x10b53d[_0x010b('0x35')]=_0x10b53d[_0x010b('0x35')]['length']?_0x10b53d[_0x010b('0x35')]:_0x56bc87[_0x010b('0x30')];if(!_0x3ab26a['query']['hasOwnProperty'](_0x010b('0x37'))){_0x10b53d['limit']=qs[_0x010b('0x1e')](_0x3ab26a['query'][_0x010b('0x1e')]);_0x10b53d['offset']=qs[_0x010b('0x1c')](_0x3ab26a[_0x010b('0x31')][_0x010b('0x1c')]);}_0x10b53d[_0x010b('0x38')]=qs[_0x010b('0x39')](_0x3ab26a[_0x010b('0x31')]['sort']);_0x10b53d[_0x010b('0x3a')]=qs[_0x010b('0x33')](_['pick'](_0x3ab26a[_0x010b('0x31')],_0x56bc87[_0x010b('0x33')]),_0x35675e);if(_0x3ab26a['query'][_0x010b('0x3b')]){_0x10b53d[_0x010b('0x3a')]=_['merge'](_0x10b53d[_0x010b('0x3a')],{'$or':_[_0x010b('0x3c')](_0x35675e,function(_0x355b9b){if(_0x355b9b['type']!==_0x010b('0x3d')){var _0x16835a={};_0x16835a[_0x355b9b['name']]={'$like':'%'+_0x3ab26a[_0x010b('0x31')][_0x010b('0x3b')]+'%'};return _0x16835a;}})});}_0x10b53d=_[_0x010b('0x3e')]({},_0x10b53d,_0x3ab26a['options']);var _0x690aa7={'where':_0x10b53d['where']};return db[_0x010b('0x2b')][_0x010b('0x1f')](_0x690aa7)['then'](function(_0x2e2cc2){_0x40edea['count']=_0x2e2cc2;if(_0x3ab26a[_0x010b('0x31')][_0x010b('0x3f')]){_0x10b53d[_0x010b('0x40')]=[{'all':!![]}];}return db[_0x010b('0x2b')][_0x010b('0x41')](_0x10b53d);})['then'](function(_0x235692){_0x40edea[_0x010b('0x42')]=_0x235692;return _0x40edea;})[_0x010b('0x25')](respondWithFilteredResult(_0x1c14ae,_0x10b53d))[_0x010b('0x43')](handleError(_0x1c14ae,null));};exports[_0x010b('0x44')]=function(_0x5cdfbe,_0x274030){var _0x1b9028={'raw':!![],'where':{'id':_0x5cdfbe[_0x010b('0x45')]['id']}},_0x18b519={};_0x18b519[_0x010b('0x30')]=_[_0x010b('0x32')](db[_0x010b('0x2b')][_0x010b('0x2c')]);_0x18b519[_0x010b('0x31')]=_['keys'](_0x5cdfbe[_0x010b('0x31')]);_0x18b519[_0x010b('0x33')]=_[_0x010b('0x34')](_0x18b519['model'],_0x18b519[_0x010b('0x31')]);_0x1b9028[_0x010b('0x35')]=_[_0x010b('0x34')](_0x18b519[_0x010b('0x30')],qs[_0x010b('0x36')](_0x5cdfbe[_0x010b('0x31')][_0x010b('0x36')]));_0x1b9028[_0x010b('0x35')]=_0x1b9028[_0x010b('0x35')][_0x010b('0x46')]?_0x1b9028['attributes']:_0x18b519[_0x010b('0x30')];if(_0x5cdfbe[_0x010b('0x31')][_0x010b('0x3f')]){_0x1b9028['include']=[{'all':!![]}];}_0x1b9028=_[_0x010b('0x3e')]({},_0x1b9028,_0x5cdfbe[_0x010b('0x47')]);return db[_0x010b('0x2b')][_0x010b('0x48')](_0x1b9028)[_0x010b('0x25')](handleEntityNotFound(_0x274030,null))[_0x010b('0x25')](respondWithResult(_0x274030,null))[_0x010b('0x43')](handleError(_0x274030,null));};exports[_0x010b('0x49')]=function(_0x4e9f5c,_0x377612){return db['AnalyticTreeReport'][_0x010b('0x49')](_0x4e9f5c[_0x010b('0x4a')],{})[_0x010b('0x25')](respondWithResult(_0x377612,0xc9))['catch'](handleError(_0x377612,null));};exports[_0x010b('0x24')]=function(_0xce6669,_0x351f0e){if(_0xce6669['body']['id']){delete _0xce6669[_0x010b('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x010b('0x48')]({'where':{'id':_0xce6669['params']['id']}})[_0x010b('0x25')](handleEntityNotFound(_0x351f0e,null))[_0x010b('0x25')](saveUpdates(_0xce6669['body'],null))[_0x010b('0x25')](respondWithResult(_0x351f0e,null))['catch'](handleError(_0x351f0e,null));};exports[_0x010b('0x4b')]=function(_0x379c1d,_0x14ee9c){return db[_0x010b('0x2b')]['find']({'where':{'id':_0x379c1d[_0x010b('0x45')]['id']}})['then'](handleEntityNotFound(_0x14ee9c,null))[_0x010b('0x25')](removeEntity(_0x14ee9c,null))[_0x010b('0x43')](handleError(_0x14ee9c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 2188a49..67094a8 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 _0x2c18=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x2c18,0x182));var _0x82c1=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x2c18[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0x82c1('0x0'));var util=require('util');var logger=require(_0x82c1('0x1'))(_0x82c1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x82c1('0x3'));var fs=require('fs');var path=require(_0x82c1('0x4'));var rimraf=require(_0x82c1('0x5'));var config=require(_0x82c1('0x6'));var attributes=require(_0x82c1('0x7'));module[_0x82c1('0x8')]=function(_0x444dcb,_0x49ec3d){return _0x444dcb[_0x82c1('0x9')](_0x82c1('0xa'),attributes,{'tableName':_0x82c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1051=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1051,0x1a6));var _0x1105=function(_0x1d1bbe,_0x262169){_0x1d1bbe=_0x1d1bbe-0x0;var _0x402d86=_0x1051[_0x1d1bbe];return _0x402d86;};'use strict';var _=require(_0x1105('0x0'));var util=require(_0x1105('0x1'));var logger=require(_0x1105('0x2'))(_0x1105('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1105('0x4'));var attributes=require(_0x1105('0x5'));module[_0x1105('0x6')]=function(_0x5eab0f,_0x96218c){return _0x5eab0f[_0x1105('0x7')](_0x1105('0x8'),attributes,{'tableName':_0x1105('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index c5618c2..1afc792 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2d46f0,_0x24696c){var _0x5afa28=function(_0x20f482){while(--_0x20f482){_0x2d46f0['push'](_0x2d46f0['shift']());}};_0x5afa28(++_0x24696c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x8fba89,_0x1eac90){var _0x59c446=function(_0x53d140){while(--_0x53d140){_0x8fba89['push'](_0x8fba89['shift']());}};_0x59c446(++_0x1eac90);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b54f8db..4a1a1b8 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 _0x3d1f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','path'];(function(_0x5afd0c,_0xc78bfe){var _0x13f95f=function(_0x3b91bf){while(--_0x3b91bf){_0x5afd0c['push'](_0x5afd0c['shift']());}};_0x13f95f(++_0xc78bfe);}(_0x3d1f,0x12f));var _0xf3d1=function(_0x410484,_0x57244a){_0x410484=_0x410484-0x0;var _0x3c8009=_0x3d1f[_0x410484];return _0x3c8009;};'use strict';var multer=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var path=require(_0xf3d1('0x2'));var timeout=require(_0xf3d1('0x3'));var express=require(_0xf3d1('0x4'));var router=express[_0xf3d1('0x5')]();var fs_extra=require(_0xf3d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf3d1('0x7'));var config=require(_0xf3d1('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xa')]);router['get'](_0xf3d1('0xb'),auth[_0xf3d1('0x9')](),controller['show']);router['post']('/',auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xc')]);router['put'](_0xf3d1('0xb'),auth['isAuthenticated'](),controller[_0xf3d1('0xd')]);router[_0xf3d1('0xe')]('/:id',auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xf')]);module[_0xf3d1('0x10')]=router; \ No newline at end of file +var _0x1237=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x17f460,_0x47f86e){var _0xdf779a=function(_0x417446){while(--_0x417446){_0x17f460['push'](_0x17f460['shift']());}};_0xdf779a(++_0x47f86e);}(_0x1237,0x1c9));var _0x7123=function(_0x49fce6,_0x4e0ccb){_0x49fce6=_0x49fce6-0x0;var _0x37457e=_0x1237[_0x49fce6];return _0x37457e;};'use strict';var multer=require('multer');var util=require(_0x7123('0x0'));var path=require(_0x7123('0x1'));var timeout=require(_0x7123('0x2'));var express=require(_0x7123('0x3'));var router=express[_0x7123('0x4')]();var fs_extra=require(_0x7123('0x5'));var auth=require(_0x7123('0x6'));var interaction=require(_0x7123('0x7'));var config=require('../../config/environment');var controller=require(_0x7123('0x8'));router[_0x7123('0x9')]('/',auth[_0x7123('0xa')](),controller[_0x7123('0xb')]);router['get'](_0x7123('0xc'),auth[_0x7123('0xa')](),controller[_0x7123('0xd')]);router[_0x7123('0xe')]('/',auth['isAuthenticated'](),controller[_0x7123('0xf')]);router[_0x7123('0x10')]('/:id',auth[_0x7123('0xa')](),controller[_0x7123('0x11')]);router[_0x7123('0x12')](_0x7123('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7123('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f1f77c9..31c6f76 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 _0x0531=['sequelize','exports','STRING'];(function(_0x513f73,_0x58b64b){var _0x5a375f=function(_0x41cd0b){while(--_0x41cd0b){_0x513f73['push'](_0x513f73['shift']());}};_0x5a375f(++_0x58b64b);}(_0x0531,0xde));var _0x1053=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x0531[_0x2af29a];return _0x5ef02f;};'use strict';var Sequelize=require(_0x1053('0x0'));module[_0x1053('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1053('0x2')]}}; \ No newline at end of file +var _0x9b2a=['STRING','sequelize'];(function(_0x40a383,_0x20e356){var _0x177115=function(_0x4287a0){while(--_0x4287a0){_0x40a383['push'](_0x40a383['shift']());}};_0x177115(++_0x20e356);}(_0x9b2a,0x127));var _0xa9b2=function(_0x36b2d5,_0x30a687){_0x36b2d5=_0x36b2d5-0x0;var _0x41299d=_0x9b2a[_0x36b2d5];return _0x41299d;};'use strict';var Sequelize=require(_0xa9b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9b2('0x1')]},'basename':{'type':Sequelize[_0xa9b2('0x1')]},'type':{'type':Sequelize[_0xa9b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8e38e85..6b37407 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 _0x2a66=['createdAt','body','updatedAt','create','update','file','originalname','basename','filename','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','include','Attachment','findAll','rows','catch','show','params','rawAttributes','includeAll','find','clone','get','omit'];(function(_0x35325f,_0x5d615e){var _0x247af9=function(_0x6102e4){while(--_0x6102e4){_0x35325f['push'](_0x35325f['shift']());}};_0x247af9(++_0x5d615e);}(_0x2a66,0x6b));var _0x62a6=function(_0x2f379a,_0x53382d){_0x2f379a=_0x2f379a-0x0;var _0x305249=_0x2a66[_0x2f379a];return _0x305249;};'use strict';var emlformat=require(_0x62a6('0x0'));var rimraf=require(_0x62a6('0x1'));var zipdir=require(_0x62a6('0x2'));var jsonpatch=require(_0x62a6('0x3'));var rp=require(_0x62a6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x62a6('0x5'));var util=require(_0x62a6('0x6'));var path=require(_0x62a6('0x7'));var sox=require(_0x62a6('0x8'));var csv=require(_0x62a6('0x9'));var ejs=require(_0x62a6('0xa'));var fs=require('fs');var fs_extra=require(_0x62a6('0xb'));var _=require(_0x62a6('0xc'));var squel=require(_0x62a6('0xd'));var crypto=require('crypto');var jsforce=require(_0x62a6('0xe'));var deskjs=require(_0x62a6('0xf'));var toCsv=require(_0x62a6('0x9'));var querystring=require(_0x62a6('0x10'));var Papa=require('papaparse');var Redis=require(_0x62a6('0x11'));var authService=require(_0x62a6('0x12'));var qs=require(_0x62a6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62a6('0x14'))('api');var utils=require(_0x62a6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x62a6('0x16'));var db=require(_0x62a6('0x17'))['db'];function respondWithStatusCode(_0x1dc0dd,_0x451d9f){_0x451d9f=_0x451d9f||0xcc;return function(_0x1daa11){if(_0x1daa11){return _0x1dc0dd[_0x62a6('0x18')](_0x451d9f);}return _0x1dc0dd['status'](_0x451d9f)[_0x62a6('0x19')]();};}function respondWithResult(_0x52da7e,_0xfcd68){_0xfcd68=_0xfcd68||0xc8;return function(_0x1dbb3a){if(_0x1dbb3a){return _0x52da7e[_0x62a6('0x1a')](_0xfcd68)[_0x62a6('0x1b')](_0x1dbb3a);}};}function respondWithFilteredResult(_0x22a048,_0xb7f9ec){return function(_0x506916){if(_0x506916){var _0x5d6d1b=typeof _0xb7f9ec[_0x62a6('0x1c')]===_0x62a6('0x1d')&&typeof _0xb7f9ec[_0x62a6('0x1e')]===_0x62a6('0x1d');var _0x84c071=_0x506916[_0x62a6('0x1f')];var _0x1713d8=_0x5d6d1b?0x0:_0xb7f9ec[_0x62a6('0x1c')];var _0x56eb3f=_0x5d6d1b?_0x506916[_0x62a6('0x1f')]:_0xb7f9ec[_0x62a6('0x1c')]+_0xb7f9ec[_0x62a6('0x1e')];var _0x20ca36;if(_0x56eb3f>=_0x84c071){_0x56eb3f=_0x84c071;_0x20ca36=0xc8;}else{_0x20ca36=0xce;}_0x22a048['status'](_0x20ca36);return _0x22a048['set'](_0x62a6('0x20'),_0x1713d8+'-'+_0x56eb3f+'/'+_0x84c071)['json'](_0x506916);}return null;};}function patchUpdates(_0x56c964){return function(_0x1bd539){try{jsonpatch[_0x62a6('0x21')](_0x1bd539,_0x56c964,!![]);}catch(_0x2273e4){return BPromise[_0x62a6('0x22')](_0x2273e4);}return _0x1bd539[_0x62a6('0x23')]();};}function saveUpdates(_0x338b2f,_0x548b32){return function(_0x1619ef){if(_0x1619ef){return _0x1619ef['update'](_0x338b2f)[_0x62a6('0x24')](function(_0x479883){return _0x479883;});}return null;};}function removeEntity(_0x5c976c,_0x1c88a9){return function(_0xefcb34){if(_0xefcb34){return _0xefcb34[_0x62a6('0x25')]()[_0x62a6('0x24')](function(){_0x5c976c[_0x62a6('0x1a')](0xcc)[_0x62a6('0x19')]();});}};}function handleEntityNotFound(_0x472bdd,_0x61fd4c){return function(_0x1d5302){if(!_0x1d5302){_0x472bdd[_0x62a6('0x18')](0x194);}return _0x1d5302;};}function handleError(_0x5b643b,_0x5de642){_0x5de642=_0x5de642||0x1f4;return function(_0x550730){logger[_0x62a6('0x26')](_0x550730[_0x62a6('0x27')]);if(_0x550730[_0x62a6('0x28')]){delete _0x550730[_0x62a6('0x28')];}_0x5b643b[_0x62a6('0x1a')](_0x5de642)['send'](_0x550730);};}exports[_0x62a6('0x29')]=function(_0x2ffa13,_0x29db48){var _0x109a25={},_0x5e7ded={},_0x4a5a55={'count':0x0,'rows':[]};var _0xf2e959=_['map'](db['Attachment']['rawAttributes'],function(_0x2fea59){return{'name':_0x2fea59[_0x62a6('0x2a')],'type':_0x2fea59[_0x62a6('0x2b')][_0x62a6('0x2c')]};});_0x5e7ded[_0x62a6('0x2d')]=_[_0x62a6('0x2e')](_0xf2e959,_0x62a6('0x28'));_0x5e7ded[_0x62a6('0x2f')]=_[_0x62a6('0x30')](_0x2ffa13[_0x62a6('0x2f')]);_0x5e7ded['filters']=_[_0x62a6('0x31')](_0x5e7ded[_0x62a6('0x2d')],_0x5e7ded[_0x62a6('0x2f')]);_0x109a25[_0x62a6('0x32')]=_[_0x62a6('0x31')](_0x5e7ded[_0x62a6('0x2d')],qs[_0x62a6('0x33')](_0x2ffa13['query']['fields']));_0x109a25[_0x62a6('0x32')]=_0x109a25[_0x62a6('0x32')][_0x62a6('0x34')]?_0x109a25[_0x62a6('0x32')]:_0x5e7ded[_0x62a6('0x2d')];if(!_0x2ffa13['query'][_0x62a6('0x35')]('nolimit')){_0x109a25[_0x62a6('0x1e')]=qs[_0x62a6('0x1e')](_0x2ffa13[_0x62a6('0x2f')][_0x62a6('0x1e')]);_0x109a25[_0x62a6('0x1c')]=qs[_0x62a6('0x1c')](_0x2ffa13['query'][_0x62a6('0x1c')]);}_0x109a25[_0x62a6('0x36')]=qs['sort'](_0x2ffa13[_0x62a6('0x2f')][_0x62a6('0x37')]);_0x109a25['where']=qs[_0x62a6('0x38')](_[_0x62a6('0x39')](_0x2ffa13[_0x62a6('0x2f')],_0x5e7ded[_0x62a6('0x38')]),_0xf2e959);if(_0x2ffa13[_0x62a6('0x2f')][_0x62a6('0x3a')]){_0x109a25[_0x62a6('0x3b')]=_[_0x62a6('0x3c')](_0x109a25['where'],{'$or':_[_0x62a6('0x2e')](_0xf2e959,function(_0x1d619d){if(_0x1d619d['type']!=='VIRTUAL'){var _0x31ee4f={};_0x31ee4f[_0x1d619d[_0x62a6('0x28')]]={'$like':'%'+_0x2ffa13[_0x62a6('0x2f')][_0x62a6('0x3a')]+'%'};return _0x31ee4f;}})});}_0x109a25=_[_0x62a6('0x3c')]({},_0x109a25,_0x2ffa13[_0x62a6('0x3d')]);var _0x21c10e={'where':_0x109a25[_0x62a6('0x3b')]};return db['Attachment'][_0x62a6('0x1f')](_0x21c10e)[_0x62a6('0x24')](function(_0x4cc49e){_0x4a5a55[_0x62a6('0x1f')]=_0x4cc49e;if(_0x2ffa13[_0x62a6('0x2f')]['includeAll']){_0x109a25[_0x62a6('0x3e')]=[{'all':!![]}];}return db[_0x62a6('0x3f')][_0x62a6('0x40')](_0x109a25);})[_0x62a6('0x24')](function(_0x3c001d){_0x4a5a55[_0x62a6('0x41')]=_0x3c001d;return _0x4a5a55;})['then'](respondWithFilteredResult(_0x29db48,_0x109a25))[_0x62a6('0x42')](handleError(_0x29db48,null));};exports[_0x62a6('0x43')]=function(_0x5b0092,_0x48c80d){var _0x5ec600={'raw':!![],'where':{'id':_0x5b0092[_0x62a6('0x44')]['id']}},_0x166b81={};_0x166b81['model']=_[_0x62a6('0x30')](db[_0x62a6('0x3f')][_0x62a6('0x45')]);_0x166b81['query']=_['keys'](_0x5b0092[_0x62a6('0x2f')]);_0x166b81['filters']=_[_0x62a6('0x31')](_0x166b81[_0x62a6('0x2d')],_0x166b81[_0x62a6('0x2f')]);_0x5ec600['attributes']=_[_0x62a6('0x31')](_0x166b81[_0x62a6('0x2d')],qs[_0x62a6('0x33')](_0x5b0092['query'][_0x62a6('0x33')]));_0x5ec600[_0x62a6('0x32')]=_0x5ec600['attributes'][_0x62a6('0x34')]?_0x5ec600['attributes']:_0x166b81[_0x62a6('0x2d')];if(_0x5b0092[_0x62a6('0x2f')][_0x62a6('0x46')]){_0x5ec600[_0x62a6('0x3e')]=[{'all':!![]}];}_0x5ec600=_[_0x62a6('0x3c')]({},_0x5ec600,_0x5b0092[_0x62a6('0x3d')]);return db[_0x62a6('0x3f')][_0x62a6('0x47')](_0x5ec600)[_0x62a6('0x24')](handleEntityNotFound(_0x48c80d,null))[_0x62a6('0x24')](respondWithResult(_0x48c80d,null))[_0x62a6('0x42')](handleError(_0x48c80d,null));};exports[_0x62a6('0x48')]=function(_0x10cc00,_0x296c2e){var _0x47d516={'where':{'id':_0x10cc00[_0x62a6('0x44')]['id']}},_0x4912a5={};_0x4912a5[_0x62a6('0x2d')]=_[_0x62a6('0x30')](db[_0x62a6('0x3f')][_0x62a6('0x45')]);_0x47d516['attributes']=_['intersection'](_0x4912a5['model'],qs[_0x62a6('0x33')](_0x10cc00[_0x62a6('0x2f')][_0x62a6('0x33')]));_0x47d516[_0x62a6('0x32')]=_0x47d516[_0x62a6('0x32')][_0x62a6('0x34')]?_0x47d516[_0x62a6('0x32')]:_0x4912a5['model'];if(_0x10cc00[_0x62a6('0x2f')][_0x62a6('0x46')]){_0x47d516[_0x62a6('0x3e')]=[{'all':!![]}];}_0x47d516=_[_0x62a6('0x3c')]({},_0x47d516,_0x10cc00['options']);return db[_0x62a6('0x3f')]['find'](_0x47d516)[_0x62a6('0x24')](handleEntityNotFound(_0x296c2e,null))[_0x62a6('0x24')](function(_0x459c78){if(_0x459c78){var _0xea84b1=_0x459c78[_0x62a6('0x49')]({'plain':!![]});_0xea84b1=qs[_0x62a6('0x4a')](_0xea84b1,['id',_0x62a6('0x4b'),'updatedAt']);_0x10cc00[_0x62a6('0x4c')]=_[_0x62a6('0x4a')](_0x10cc00['body'],['id','createdAt',_0x62a6('0x4d')]);return db[_0x62a6('0x3f')][_0x62a6('0x4e')](_['merge'](_0xea84b1,_0x10cc00[_0x62a6('0x4c')]),{'include':_0x10cc00[_0x62a6('0x2f')][_0x62a6('0x46')]?[{'all':!![]}]:undefined});}})[_0x62a6('0x24')](respondWithResult(_0x296c2e,0xc9))[_0x62a6('0x42')](handleError(_0x296c2e,null));};exports[_0x62a6('0x4f')]=function(_0x17bb5e,_0x5ee428){if(_0x17bb5e[_0x62a6('0x4c')]['id']){delete _0x17bb5e[_0x62a6('0x4c')]['id'];}return db[_0x62a6('0x3f')]['find']({'where':{'id':_0x17bb5e['params']['id']}})[_0x62a6('0x24')](handleEntityNotFound(_0x5ee428,null))[_0x62a6('0x24')](saveUpdates(_0x17bb5e[_0x62a6('0x4c')],null))['then'](respondWithResult(_0x5ee428,null))[_0x62a6('0x42')](handleError(_0x5ee428,null));};exports[_0x62a6('0x25')]=function(_0x50013d,_0x4ece75){return db[_0x62a6('0x3f')]['find']({'where':{'id':_0x50013d[_0x62a6('0x44')]['id']}})[_0x62a6('0x24')](handleEntityNotFound(_0x4ece75,null))[_0x62a6('0x24')](removeEntity(_0x4ece75,null))[_0x62a6('0x42')](handleError(_0x4ece75,null));};exports[_0x62a6('0x4e')]=function(_0x1a40b2,_0x946224,_0x27dde4){_0x1a40b2['body'][_0x62a6('0x28')]=_0x1a40b2[_0x62a6('0x50')][_0x62a6('0x51')];_0x1a40b2['body'][_0x62a6('0x52')]=_0x1a40b2['file'][_0x62a6('0x53')];_0x1a40b2[_0x62a6('0x4c')][_0x62a6('0x2b')]=_0x1a40b2[_0x62a6('0x50')][_0x62a6('0x54')];return db[_0x62a6('0x3f')]['create'](_0x1a40b2[_0x62a6('0x4c')])[_0x62a6('0x24')](respondWithResult(_0x946224,0xc9))['catch'](handleError(_0x946224,null));};exports['download']=function(_0x5b5ee3,_0x492baf,_0x40dbc9){return db['Attachment'][_0x62a6('0x55')]({'where':{'id':_0x5b5ee3[_0x62a6('0x44')]['id']},'raw':!![]})[_0x62a6('0x24')](handleEntityNotFound(_0x492baf,null))[_0x62a6('0x24')](function(_0x37a993){if(_0x37a993){var _0x4e2730=_0x37a993['ChatOfflineMessageId']!==null;var _0x36242c=path[_0x62a6('0x56')](config[_0x62a6('0x57')],_0x62a6('0x58'));if(_0x4e2730){_0x36242c=path[_0x62a6('0x56')](_0x36242c,_0x62a6('0x59'));}var _0x3cf54f=path['join'](_0x36242c,_0x37a993['basename']);return _0x492baf[_0x62a6('0x5a')](_0x3cf54f);}})[_0x62a6('0x42')](handleError(_0x492baf,null));}; \ No newline at end of file +var _0x9063=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','clone','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','to-csv'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x9063,0x1a5));var _0x3906=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9063[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x3906('0x0'));var rimraf=require(_0x3906('0x1'));var zipdir=require(_0x3906('0x2'));var jsonpatch=require(_0x3906('0x3'));var rp=require(_0x3906('0x4'));var moment=require(_0x3906('0x5'));var BPromise=require(_0x3906('0x6'));var Mustache=require(_0x3906('0x7'));var util=require(_0x3906('0x8'));var path=require(_0x3906('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3906('0xa'));var fs=require('fs');var fs_extra=require(_0x3906('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3906('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3906('0xd'));var querystring=require(_0x3906('0xe'));var Papa=require(_0x3906('0xf'));var Redis=require(_0x3906('0x10'));var authService=require(_0x3906('0x11'));var qs=require(_0x3906('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3906('0x13'))(_0x3906('0x14'));var utils=require(_0x3906('0x15'));var config=require(_0x3906('0x16'));var licenseUtil=require(_0x3906('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131d58,_0x8b9cc7){_0x8b9cc7=_0x8b9cc7||0xcc;return function(_0xad2553){if(_0xad2553){return _0x131d58[_0x3906('0x18')](_0x8b9cc7);}return _0x131d58[_0x3906('0x19')](_0x8b9cc7)['end']();};}function respondWithResult(_0xb7a205,_0x2f23cc){_0x2f23cc=_0x2f23cc||0xc8;return function(_0x388961){if(_0x388961){return _0xb7a205[_0x3906('0x19')](_0x2f23cc)['json'](_0x388961);}};}function respondWithFilteredResult(_0x1aaa59,_0x2b3414){return function(_0x23b173){if(_0x23b173){var _0x172f36=typeof _0x2b3414[_0x3906('0x1a')]==='undefined'&&typeof _0x2b3414['limit']===_0x3906('0x1b');var _0x451922=_0x23b173[_0x3906('0x1c')];var _0x232599=_0x172f36?0x0:_0x2b3414[_0x3906('0x1a')];var _0x28981f=_0x172f36?_0x23b173[_0x3906('0x1c')]:_0x2b3414[_0x3906('0x1a')]+_0x2b3414[_0x3906('0x1d')];var _0x4d9e29;if(_0x28981f>=_0x451922){_0x28981f=_0x451922;_0x4d9e29=0xc8;}else{_0x4d9e29=0xce;}_0x1aaa59[_0x3906('0x19')](_0x4d9e29);return _0x1aaa59['set']('Content-Range',_0x232599+'-'+_0x28981f+'/'+_0x451922)[_0x3906('0x1e')](_0x23b173);}return null;};}function patchUpdates(_0x51b93d){return function(_0x31a1f8){try{jsonpatch[_0x3906('0x1f')](_0x31a1f8,_0x51b93d,!![]);}catch(_0x4a6e2b){return BPromise[_0x3906('0x20')](_0x4a6e2b);}return _0x31a1f8[_0x3906('0x21')]();};}function saveUpdates(_0x402ff8,_0x86b325){return function(_0x13217c){if(_0x13217c){return _0x13217c[_0x3906('0x22')](_0x402ff8)[_0x3906('0x23')](function(_0x364f6f){return _0x364f6f;});}return null;};}function removeEntity(_0x4c21b3,_0x15fdbe){return function(_0x9c2dd){if(_0x9c2dd){return _0x9c2dd[_0x3906('0x24')]()[_0x3906('0x23')](function(){_0x4c21b3[_0x3906('0x19')](0xcc)[_0x3906('0x25')]();});}};}function handleEntityNotFound(_0x32c1ef,_0xca6726){return function(_0x112b53){if(!_0x112b53){_0x32c1ef[_0x3906('0x18')](0x194);}return _0x112b53;};}function handleError(_0xab8cd3,_0x24007b){_0x24007b=_0x24007b||0x1f4;return function(_0x4a192e){logger['error'](_0x4a192e[_0x3906('0x26')]);if(_0x4a192e[_0x3906('0x27')]){delete _0x4a192e[_0x3906('0x27')];}_0xab8cd3['status'](_0x24007b)[_0x3906('0x28')](_0x4a192e);};}exports[_0x3906('0x29')]=function(_0x44226d,_0x45823e){var _0x4cf48a={},_0xc44495={},_0x599b3e={'count':0x0,'rows':[]};var _0x3890de=_['map'](db[_0x3906('0x2a')][_0x3906('0x2b')],function(_0x346ca5){return{'name':_0x346ca5[_0x3906('0x2c')],'type':_0x346ca5[_0x3906('0x2d')][_0x3906('0x2e')]};});_0xc44495[_0x3906('0x2f')]=_[_0x3906('0x30')](_0x3890de,_0x3906('0x27'));_0xc44495[_0x3906('0x31')]=_[_0x3906('0x32')](_0x44226d[_0x3906('0x31')]);_0xc44495[_0x3906('0x33')]=_[_0x3906('0x34')](_0xc44495['model'],_0xc44495['query']);_0x4cf48a[_0x3906('0x35')]=_[_0x3906('0x34')](_0xc44495['model'],qs[_0x3906('0x36')](_0x44226d[_0x3906('0x31')][_0x3906('0x36')]));_0x4cf48a[_0x3906('0x35')]=_0x4cf48a['attributes']['length']?_0x4cf48a[_0x3906('0x35')]:_0xc44495[_0x3906('0x2f')];if(!_0x44226d[_0x3906('0x31')][_0x3906('0x37')](_0x3906('0x38'))){_0x4cf48a[_0x3906('0x1d')]=qs[_0x3906('0x1d')](_0x44226d['query']['limit']);_0x4cf48a[_0x3906('0x1a')]=qs[_0x3906('0x1a')](_0x44226d['query'][_0x3906('0x1a')]);}_0x4cf48a[_0x3906('0x39')]=qs[_0x3906('0x3a')](_0x44226d[_0x3906('0x31')]['sort']);_0x4cf48a[_0x3906('0x3b')]=qs[_0x3906('0x33')](_['pick'](_0x44226d[_0x3906('0x31')],_0xc44495[_0x3906('0x33')]),_0x3890de);if(_0x44226d[_0x3906('0x31')][_0x3906('0x3c')]){_0x4cf48a[_0x3906('0x3b')]=_['merge'](_0x4cf48a[_0x3906('0x3b')],{'$or':_[_0x3906('0x30')](_0x3890de,function(_0x34f1b6){if(_0x34f1b6[_0x3906('0x2d')]!==_0x3906('0x3d')){var _0x4905c6={};_0x4905c6[_0x34f1b6[_0x3906('0x27')]]={'$like':'%'+_0x44226d['query'][_0x3906('0x3c')]+'%'};return _0x4905c6;}})});}_0x4cf48a=_[_0x3906('0x3e')]({},_0x4cf48a,_0x44226d[_0x3906('0x3f')]);var _0x2c412a={'where':_0x4cf48a[_0x3906('0x3b')]};return db[_0x3906('0x2a')][_0x3906('0x1c')](_0x2c412a)[_0x3906('0x23')](function(_0x1ad233){_0x599b3e[_0x3906('0x1c')]=_0x1ad233;if(_0x44226d['query'][_0x3906('0x40')]){_0x4cf48a[_0x3906('0x41')]=[{'all':!![]}];}return db[_0x3906('0x2a')]['findAll'](_0x4cf48a);})[_0x3906('0x23')](function(_0x382e1f){_0x599b3e[_0x3906('0x42')]=_0x382e1f;return _0x599b3e;})['then'](respondWithFilteredResult(_0x45823e,_0x4cf48a))[_0x3906('0x43')](handleError(_0x45823e,null));};exports[_0x3906('0x44')]=function(_0x14ef7e,_0x4ff1e9){var _0x4f89aa={'raw':!![],'where':{'id':_0x14ef7e[_0x3906('0x45')]['id']}},_0x155bda={};_0x155bda['model']=_[_0x3906('0x32')](db['Attachment'][_0x3906('0x2b')]);_0x155bda[_0x3906('0x31')]=_[_0x3906('0x32')](_0x14ef7e['query']);_0x155bda[_0x3906('0x33')]=_[_0x3906('0x34')](_0x155bda[_0x3906('0x2f')],_0x155bda[_0x3906('0x31')]);_0x4f89aa[_0x3906('0x35')]=_[_0x3906('0x34')](_0x155bda['model'],qs[_0x3906('0x36')](_0x14ef7e[_0x3906('0x31')]['fields']));_0x4f89aa['attributes']=_0x4f89aa[_0x3906('0x35')][_0x3906('0x46')]?_0x4f89aa[_0x3906('0x35')]:_0x155bda[_0x3906('0x2f')];if(_0x14ef7e[_0x3906('0x31')]['includeAll']){_0x4f89aa[_0x3906('0x41')]=[{'all':!![]}];}_0x4f89aa=_['merge']({},_0x4f89aa,_0x14ef7e[_0x3906('0x3f')]);return db['Attachment'][_0x3906('0x47')](_0x4f89aa)[_0x3906('0x23')](handleEntityNotFound(_0x4ff1e9,null))[_0x3906('0x23')](respondWithResult(_0x4ff1e9,null))[_0x3906('0x43')](handleError(_0x4ff1e9,null));};exports[_0x3906('0x48')]=function(_0x47f129,_0x2f531e){var _0x202ae4={'where':{'id':_0x47f129[_0x3906('0x45')]['id']}},_0x5b533b={};_0x5b533b[_0x3906('0x2f')]=_[_0x3906('0x32')](db[_0x3906('0x2a')]['rawAttributes']);_0x202ae4[_0x3906('0x35')]=_[_0x3906('0x34')](_0x5b533b[_0x3906('0x2f')],qs[_0x3906('0x36')](_0x47f129['query'][_0x3906('0x36')]));_0x202ae4[_0x3906('0x35')]=_0x202ae4[_0x3906('0x35')][_0x3906('0x46')]?_0x202ae4[_0x3906('0x35')]:_0x5b533b[_0x3906('0x2f')];if(_0x47f129['query'][_0x3906('0x40')]){_0x202ae4[_0x3906('0x41')]=[{'all':!![]}];}_0x202ae4=_[_0x3906('0x3e')]({},_0x202ae4,_0x47f129[_0x3906('0x3f')]);return db[_0x3906('0x2a')]['find'](_0x202ae4)[_0x3906('0x23')](handleEntityNotFound(_0x2f531e,null))[_0x3906('0x23')](function(_0x4a1416){if(_0x4a1416){var _0x10e60b=_0x4a1416['get']({'plain':!![]});_0x10e60b=qs[_0x3906('0x49')](_0x10e60b,['id',_0x3906('0x4a'),'updatedAt']);_0x47f129[_0x3906('0x4b')]=_[_0x3906('0x49')](_0x47f129[_0x3906('0x4b')],['id','createdAt',_0x3906('0x4c')]);return db[_0x3906('0x2a')][_0x3906('0x4d')](_['merge'](_0x10e60b,_0x47f129['body']),{'include':_0x47f129[_0x3906('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x3906('0x23')](respondWithResult(_0x2f531e,0xc9))[_0x3906('0x43')](handleError(_0x2f531e,null));};exports['update']=function(_0x1e14e3,_0x5af2c3){if(_0x1e14e3[_0x3906('0x4b')]['id']){delete _0x1e14e3[_0x3906('0x4b')]['id'];}return db[_0x3906('0x2a')]['find']({'where':{'id':_0x1e14e3[_0x3906('0x45')]['id']}})[_0x3906('0x23')](handleEntityNotFound(_0x5af2c3,null))['then'](saveUpdates(_0x1e14e3[_0x3906('0x4b')],null))[_0x3906('0x23')](respondWithResult(_0x5af2c3,null))['catch'](handleError(_0x5af2c3,null));};exports[_0x3906('0x24')]=function(_0x376810,_0x27121f){return db[_0x3906('0x2a')]['find']({'where':{'id':_0x376810[_0x3906('0x45')]['id']}})['then'](handleEntityNotFound(_0x27121f,null))[_0x3906('0x23')](removeEntity(_0x27121f,null))['catch'](handleError(_0x27121f,null));};exports[_0x3906('0x4d')]=function(_0x199c2f,_0x586f8a,_0x2fbc3f){_0x199c2f['body'][_0x3906('0x27')]=_0x199c2f[_0x3906('0x4e')][_0x3906('0x4f')];_0x199c2f[_0x3906('0x4b')][_0x3906('0x50')]=_0x199c2f[_0x3906('0x4e')][_0x3906('0x51')];_0x199c2f[_0x3906('0x4b')][_0x3906('0x2d')]=_0x199c2f[_0x3906('0x4e')]['mimetype'];return db['Attachment'][_0x3906('0x4d')](_0x199c2f[_0x3906('0x4b')])[_0x3906('0x23')](respondWithResult(_0x586f8a,0xc9))[_0x3906('0x43')](handleError(_0x586f8a,null));};exports[_0x3906('0x52')]=function(_0x3b0d80,_0x466da4,_0x156f6a){return db[_0x3906('0x2a')]['findOne']({'where':{'id':_0x3b0d80[_0x3906('0x45')]['id']},'raw':!![]})[_0x3906('0x23')](handleEntityNotFound(_0x466da4,null))[_0x3906('0x23')](function(_0x40e1e1){if(_0x40e1e1){var _0x5b2de8=_0x40e1e1[_0x3906('0x53')]!==null;var _0x1b9bfb=path[_0x3906('0x54')](config[_0x3906('0x55')],_0x3906('0x56'));if(_0x5b2de8){_0x1b9bfb=path[_0x3906('0x54')](_0x1b9bfb,'offline-chat/');}var _0x5d51d2=path[_0x3906('0x54')](_0x1b9bfb,_0x40e1e1[_0x3906('0x50')]);return _0x466da4[_0x3906('0x52')](_0x5d51d2);}})[_0x3906('0x43')](handleError(_0x466da4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d586a61..8a0c5d4 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 _0x266a=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api','bluebird'];(function(_0x222a0f,_0x1b97cd){var _0x126665=function(_0x56c1ec){while(--_0x56c1ec){_0x222a0f['push'](_0x222a0f['shift']());}};_0x126665(++_0x1b97cd);}(_0x266a,0x10f));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require(_0xa266('0x2'))(_0xa266('0x3'));var moment=require('moment');var BPromise=require(_0xa266('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa266('0x5'));var rimraf=require(_0xa266('0x6'));var config=require(_0xa266('0x7'));var attributes=require(_0xa266('0x8'));module[_0xa266('0x9')]=function(_0x4c5b6f,_0x2e33d0){return _0x4c5b6f[_0xa266('0xa')]('Attachment',attributes,{'tableName':_0xa266('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b07=['Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x2c9f51,_0x2eec01){var _0x12abf9=function(_0x2d463f){while(--_0x2d463f){_0x2c9f51['push'](_0x2c9f51['shift']());}};_0x12abf9(++_0x2eec01);}(_0x5b07,0x1db));var _0x75b0=function(_0x4a6b5d,_0x63d8a){_0x4a6b5d=_0x4a6b5d-0x0;var _0x4fe057=_0x5b07[_0x4a6b5d];return _0x4fe057;};'use strict';var _=require(_0x75b0('0x0'));var util=require(_0x75b0('0x1'));var logger=require(_0x75b0('0x2'))('api');var moment=require(_0x75b0('0x3'));var BPromise=require(_0x75b0('0x4'));var rp=require(_0x75b0('0x5'));var fs=require('fs');var path=require(_0x75b0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x75b0('0x7')]=function(_0x46fce0,_0x5ae519){return _0x46fce0[_0x75b0('0x8')](_0x75b0('0x9'),attributes,{'tableName':_0x75b0('0xa'),'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 a1e6b2d..e5483b3 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 _0x25a3=['result','catch','Attachment','create','body','options','raw','then','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3c6064,_0x4af185){var _0x3d520b=function(_0x3ed263){while(--_0x3ed263){_0x3c6064['push'](_0x3c6064['shift']());}};_0x3d520b(++_0x4af185);}(_0x25a3,0x121));var _0x325a=function(_0x1fed61,_0x169500){_0x1fed61=_0x1fed61-0x0;var _0x57a050=_0x25a3[_0x1fed61];return _0x57a050;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var BPromise=require('bluebird');var rs=require(_0x325a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325a('0x4'))['db'];var utils=require(_0x325a('0x5'));var logger=require(_0x325a('0x6'))('rpc');var config=require(_0x325a('0x7'));var jayson=require(_0x325a('0x8'));var client=jayson[_0x325a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533867,_0x3bb82f,_0x209f5e){return new BPromise(function(_0x43bd79,_0x33f09a){return client['request'](_0x533867,_0x209f5e)['then'](function(_0x37e954){logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));logger[_0x325a('0xd')](_0x325a('0xe'),_0x3bb82f,'request\x20sent',JSON[_0x325a('0xf')](_0x37e954));if(_0x37e954[_0x325a('0x10')]){if(_0x37e954['error'][_0x325a('0x11')]===0x1f4){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')]['message']);return _0x33f09a(_0x37e954['error'][_0x325a('0x12')]);}logger['error'](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);return _0x43bd79(_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);}else{logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));_0x43bd79(_0x37e954[_0x325a('0x13')][_0x325a('0x12')]);}})[_0x325a('0x14')](function(_0x21315f){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x21315f);_0x33f09a(_0x21315f);});});}exports['CreateAttachment']=function(_0x4cba7){var _0x4fbd50=this;return new Promise(function(_0x4a1f9f,_0x34c4c8){return db[_0x325a('0x15')][_0x325a('0x16')](_0x4cba7[_0x325a('0x17')],{'raw':_0x4cba7[_0x325a('0x18')]?_0x4cba7[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![]})[_0x325a('0x1a')](function(_0x347f2d){logger[_0x325a('0xa')](_0x325a('0x1b'),_0x4cba7);logger[_0x325a('0xd')]('CreateAttachment',_0x4cba7,JSON[_0x325a('0xf')](_0x347f2d));_0x4a1f9f(_0x347f2d);})[_0x325a('0x14')](function(_0x18e29f){logger[_0x325a('0x10')](_0x325a('0x1b'),_0x18e29f[_0x325a('0x12')],_0x4cba7);_0x34c4c8(_0x4fbd50['error'](0x1f4,_0x18e29f[_0x325a('0x12')]));});});}; \ No newline at end of file +var _0x2821=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','then','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2821,0x87));var _0x1282=function(_0xef067f,_0x157096){_0xef067f=_0xef067f-0x0;var _0x5d8012=_0x2821[_0xef067f];return _0x5d8012;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var moment=require(_0x1282('0x2'));var BPromise=require(_0x1282('0x3'));var rs=require(_0x1282('0x4'));var fs=require('fs');var Redis=require(_0x1282('0x5'));var db=require(_0x1282('0x6'))['db'];var utils=require(_0x1282('0x7'));var logger=require(_0x1282('0x8'))(_0x1282('0x9'));var config=require(_0x1282('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1282('0xb')][_0x1282('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x293947,_0x13beb5,_0xa4eee9){return new BPromise(function(_0x1a8666,_0x18d69a){return client[_0x1282('0xd')](_0x293947,_0xa4eee9)['then'](function(_0x41c458){logger[_0x1282('0xe')](_0x1282('0xf'),_0x13beb5,_0x1282('0x10'));logger[_0x1282('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x13beb5,_0x1282('0x10'),JSON[_0x1282('0x12')](_0x41c458));if(_0x41c458['error']){if(_0x41c458[_0x1282('0x13')][_0x1282('0x14')]===0x1f4){logger['error'](_0x1282('0xf'),_0x13beb5,_0x41c458['error']['message']);return _0x18d69a(_0x41c458[_0x1282('0x13')][_0x1282('0x15')]);}logger[_0x1282('0x13')](_0x1282('0xf'),_0x13beb5,_0x41c458['error']['message']);return _0x1a8666(_0x41c458['error'][_0x1282('0x15')]);}else{logger[_0x1282('0xe')](_0x1282('0xf'),_0x13beb5,_0x1282('0x10'));_0x1a8666(_0x41c458[_0x1282('0x16')][_0x1282('0x15')]);}})[_0x1282('0x17')](function(_0x116ef1){logger['error'](_0x1282('0xf'),_0x13beb5,_0x116ef1);_0x18d69a(_0x116ef1);});});}exports[_0x1282('0x18')]=function(_0x518733){var _0x48c857=this;return new Promise(function(_0xebc97e,_0x4e3ec7){return db[_0x1282('0x19')][_0x1282('0x1a')](_0x518733['body'],{'raw':_0x518733['options']?_0x518733['options']['raw']===undefined?!![]:![]:!![]})[_0x1282('0x1b')](function(_0x2f4e4a){logger[_0x1282('0xe')](_0x1282('0x18'),_0x518733);logger[_0x1282('0x11')](_0x1282('0x18'),_0x518733,JSON[_0x1282('0x12')](_0x2f4e4a));_0xebc97e(_0x2f4e4a);})[_0x1282('0x17')](function(_0x153159){logger[_0x1282('0x13')]('CreateAttachment',_0x153159[_0x1282('0x15')],_0x518733);_0x4e3ec7(_0x48c857['error'](0x1f4,_0x153159[_0x1282('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 90d9775..e566710 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 _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(_0x368ede,_0x1dc90b){var _0x1fa498=function(_0x12b27c){while(--_0x12b27c){_0x368ede['push'](_0x368ede['shift']());}};_0x1fa498(++_0x1dc90b);}(_0xadb5,0xad));var _0x5adb=function(_0x3336e7,_0x1dbd64){_0x3336e7=_0x3336e7-0x0;var _0x1f6a92=_0xadb5[_0x3336e7];return _0x1f6a92;};'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 +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x398c90,_0x5e7d93){var _0x99f3e7=function(_0x5b0ee0){while(--_0x5b0ee0){_0x398c90['push'](_0x398c90['shift']());}};_0x99f3e7(++_0x5e7d93);}(_0x2032,0xd9));var _0x2203=function(_0x542da8,_0x367ffd){_0x542da8=_0x542da8-0x0;var _0x24c3df=_0x2032[_0x542da8];return _0x24c3df;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5070a9c..7ec81d0 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 _0x051e=['passport','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','baseDN','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','minutes','then','getLicense','status','send','login','ad-login','signToken','User'];(function(_0x58c3a7,_0x1e0d71){var _0xafb522=function(_0x3c0472){while(--_0x3c0472){_0x58c3a7['push'](_0x58c3a7['shift']());}};_0xafb522(++_0x1e0d71);}(_0x051e,0xb8));var _0xe051=function(_0x5998f8,_0x2f8e15){_0x5998f8=_0x5998f8-0x0;var _0x1adb98=_0x051e[_0x5998f8];return _0x1adb98;};'use strict';var passport=require(_0xe051('0x0'));var LocalStrategy=require('passport-local')[_0xe051('0x1')];var moment=require(_0xe051('0x2'));var ActiveDirectory=require(_0xe051('0x3'));var BPromise=require(_0xe051('0x4'));var util=require(_0xe051('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xe051('0x6'));var utils=require(_0xe051('0x7'));var config=require(_0xe051('0x8'));var logger=require(_0xe051('0x9'))(_0xe051('0xa'));function isActiveDirectoryConfigured(_0x3389e0){var _0x5a0b5e=![];if(typeof _0x3389e0['activedirectory']!=='undefined'){_0x5a0b5e=_0x3389e0['activedirectory'][_0xe051('0xb')]&&_0x3389e0[_0xe051('0xc')][_0xe051('0xd')]&&_0x3389e0['activedirectory'][_0xe051('0xe')];}return _0x5a0b5e;}function adAuthenticate(_0x5ebed8,_0x17bc49,_0x3f9295){return new BPromise(function(_0x26acd3,_0x4a7d64){try{var _0x2c1837=new ActiveDirectory(_0x5ebed8);_0x2c1837[_0xe051('0xf')](_0x17bc49,_0x3f9295,function(_0xd0483f,_0x412d8e){if(_0xd0483f){logger[_0xe051('0x10')](_0xe051('0x11'),_0x17bc49,util['inspect'](_0xd0483f,{'showHidden':![],'depth':null}));_0x4a7d64(_0xe051('0x12'));}else if(!_0x412d8e){logger[_0xe051('0x10')](_0xe051('0x13'),_0x17bc49);_0x4a7d64('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x26acd3(_0x412d8e);}});}catch(_0x170653){_0x4a7d64(_0x170653);}});}function ActiveDirectoryAuthenticate(_0x51b71d,_0x79fd59,_0x1f7ec3,_0x122dd7){var _0x22c68b,_0xba50f4;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xe051('0x14'),_0x79fd59);return _0x122dd7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xe051('0x15')][_0xe051('0x16')]({'where':{'id':0x1},'attributes':[_0xe051('0x17'),_0xe051('0x18')],'raw':!![]})['then'](function(_0x3a2486){_0x22c68b=_0x3a2486;if(!_0x22c68b[_0xe051('0x17')]){logger['error'](_0xe051('0x19'),_0x79fd59);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x51b71d[_0xe051('0x16')]({'attributes':['id',_0xe051('0x1a'),_0xe051('0x1b'),_0xe051('0x1c'),_0xe051('0x1d'),_0xe051('0x1e'),_0xe051('0x1f'),_0xe051('0x20'),_0xe051('0x21')],'where':{'name':_0x79fd59,'role':{'$or':[_0xe051('0x22'),_0xe051('0x23'),_0xe051('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0x3244e5){if(!_0x3244e5||_0x3244e5&&_0x3244e5[_0xe051('0x1a')]!==_0x79fd59){throw new Error(_0xe051('0x12'));}_0xba50f4=_0x3244e5;var _0x27eab8=_0xba50f4[_0xe051('0x1a')]+'@'+config[_0xe051('0xc')][_0xe051('0xe')];return adAuthenticate(config[_0xe051('0xc')],_0x27eab8,_0x1f7ec3);})['then'](function(_0x108c4b){if(_0xba50f4[_0xe051('0x1e')]){throw new Error(_0xe051('0x12'));}if(_0x22c68b['blockDuration']>0x0){if(_0xba50f4['blocked']){if(moment(_0xba50f4['blockedAt'])['add'](_0x22c68b[_0xe051('0x18')],_0xe051('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0xba50f4,0x0,![],null)[_0xe051('0x26')](function(){return utils['getLicense'](_0xba50f4);})['then'](function(){return _0x122dd7(null,_0xba50f4);});}else{return utils[_0xe051('0x27')](_0xba50f4)[_0xe051('0x26')](function(){return _0x122dd7(null,_0xba50f4);});}}else{return utils['getLicense'](_0xba50f4)[_0xe051('0x26')](function(){return _0x122dd7(null,_0xba50f4);});}})['catch'](function(_0x1b9fc8){return _0x122dd7(null,![],_0x1b9fc8);});}function handleError(_0x5cf726,_0x54ddc9,_0x2337cc){return _0x5cf726[_0xe051('0x28')](_0x54ddc9||0x1f4)[_0xe051('0x29')]({'message':_0x2337cc?_0x2337cc['message']||_0x2337cc:''});}exports[_0xe051('0x2a')]=function(_0x185eb0,_0x52fb40,_0x42f1a0){passport[_0xe051('0xf')](_0xe051('0x2b'),function(_0x1bf2cf,_0x5dfbeb,_0x7ae8f2){var _0x133c38=_0x1bf2cf||_0x7ae8f2;if(_0x133c38){return handleError(_0x52fb40,0x191,_0x133c38);}if(!_0x5dfbeb){return handleError(_0x52fb40,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x492cc3={'payload':{'id':_0x5dfbeb['id'],'role':_0x5dfbeb[_0xe051('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xe051('0x2c')](_0x492cc3)['then'](function(_0x5aa550){_0x52fb40['json']({'id':_0x5dfbeb['id'],'token':_0x5aa550,'statusCall':'','isAlreadyLogged':_0x5dfbeb[_0xe051('0x21')]});});}})(_0x185eb0,_0x52fb40,_0x42f1a0);};passport['use'](_0xe051('0x2b'),new LocalStrategy({'usernameField':_0xe051('0x1a'),'passwordField':'password'},function(_0x14e52a,_0x301bbd,_0x255726){return ActiveDirectoryAuthenticate(db[_0xe051('0x2d')],_0x14e52a,_0x301bbd,_0x255726);})); \ No newline at end of file +var _0xba6e=['passport','passport-local','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blockedAt','online','admin','blocked','add','clearBlockUser','getLicense','status','send','login','ad-login','json','use','User'];(function(_0x5349a9,_0x3245fc){var _0x4285e9=function(_0x3f6442){while(--_0x3f6442){_0x5349a9['push'](_0x5349a9['shift']());}};_0x4285e9(++_0x3245fc);}(_0xba6e,0x168));var _0xeba6=function(_0x28c02e,_0x4c9b20){_0x28c02e=_0x28c02e-0x0;var _0xa550ac=_0xba6e[_0x28c02e];return _0xa550ac;};'use strict';var passport=require(_0xeba6('0x0'));var LocalStrategy=require(_0xeba6('0x1'))['Strategy'];var moment=require(_0xeba6('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xeba6('0x3'));var util=require(_0xeba6('0x4'));var db=require(_0xeba6('0x5'))['db'];var authService=require(_0xeba6('0x6'));var utils=require(_0xeba6('0x7'));var config=require(_0xeba6('0x8'));var logger=require(_0xeba6('0x9'))(_0xeba6('0xa'));function isActiveDirectoryConfigured(_0x15fcd7){var _0xf68154=![];if(typeof _0x15fcd7[_0xeba6('0xb')]!==_0xeba6('0xc')){_0xf68154=_0x15fcd7[_0xeba6('0xb')]['baseDN']&&_0x15fcd7[_0xeba6('0xb')][_0xeba6('0xd')]&&_0x15fcd7[_0xeba6('0xb')][_0xeba6('0xe')];}return _0xf68154;}function adAuthenticate(_0x18e626,_0x229f9a,_0x59c0b8){return new BPromise(function(_0x3b713e,_0xa2ef9){try{var _0x3377fd=new ActiveDirectory(_0x18e626);_0x3377fd[_0xeba6('0xf')](_0x229f9a,_0x59c0b8,function(_0xc349cc,_0x5466e1){if(_0xc349cc){logger[_0xeba6('0x10')](_0xeba6('0x11'),_0x229f9a,util[_0xeba6('0x12')](_0xc349cc,{'showHidden':![],'depth':null}));_0xa2ef9(_0xeba6('0x13'));}else if(!_0x5466e1){logger[_0xeba6('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x229f9a);_0xa2ef9(_0xeba6('0x13'));}else{_0x3b713e(_0x5466e1);}});}catch(_0x48abfc){_0xa2ef9(_0x48abfc);}});}function ActiveDirectoryAuthenticate(_0x2a9607,_0x232ac1,_0xa66b22,_0x20a564){var _0x25d2f9,_0x32c8aa;if(!isActiveDirectoryConfigured(config)){logger[_0xeba6('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x232ac1);return _0x20a564(null,![],{'message':_0xeba6('0x13')});}return db[_0xeba6('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xeba6('0x15'),_0xeba6('0x16')],'raw':!![]})[_0xeba6('0x17')](function(_0xd632dc){_0x25d2f9=_0xd632dc;if(!_0x25d2f9[_0xeba6('0x15')]){logger[_0xeba6('0x10')](_0xeba6('0x18'),_0x232ac1);throw new Error(_0xeba6('0x13'));}return _0x2a9607[_0xeba6('0x19')]({'attributes':['id',_0xeba6('0x1a'),_0xeba6('0x1b'),_0xeba6('0x1c'),_0xeba6('0x1d'),_0xeba6('0x1e'),'blocked',_0xeba6('0x1f'),_0xeba6('0x20')],'where':{'name':_0x232ac1,'role':{'$or':[_0xeba6('0x21'),'user','agent']},'adSsoEnabled':!![]}});})[_0xeba6('0x17')](function(_0x1264fc){if(!_0x1264fc||_0x1264fc&&_0x1264fc[_0xeba6('0x1a')]!==_0x232ac1){throw new Error(_0xeba6('0x13'));}_0x32c8aa=_0x1264fc;var _0x2b78aa=_0x32c8aa[_0xeba6('0x1a')]+'@'+config[_0xeba6('0xb')]['domain'];return adAuthenticate(config[_0xeba6('0xb')],_0x2b78aa,_0xa66b22);})[_0xeba6('0x17')](function(_0x2649e6){if(_0x32c8aa['disabled']){throw new Error(_0xeba6('0x13'));}if(_0x25d2f9[_0xeba6('0x16')]>0x0){if(_0x32c8aa[_0xeba6('0x22')]){if(moment(_0x32c8aa[_0xeba6('0x1f')])[_0xeba6('0x23')](_0x25d2f9[_0xeba6('0x16')],'minutes')>moment()){throw new Error(_0xeba6('0x13'));}return utils[_0xeba6('0x24')](_0x32c8aa,0x0,![],null)[_0xeba6('0x17')](function(){return utils[_0xeba6('0x25')](_0x32c8aa);})['then'](function(){return _0x20a564(null,_0x32c8aa);});}else{return utils[_0xeba6('0x25')](_0x32c8aa)['then'](function(){return _0x20a564(null,_0x32c8aa);});}}else{return utils['getLicense'](_0x32c8aa)[_0xeba6('0x17')](function(){return _0x20a564(null,_0x32c8aa);});}})['catch'](function(_0x2c27f9){return _0x20a564(null,![],_0x2c27f9);});}function handleError(_0x1d7107,_0x4a6a19,_0x4ad2bc){return _0x1d7107[_0xeba6('0x26')](_0x4a6a19||0x1f4)[_0xeba6('0x27')]({'message':_0x4ad2bc?_0x4ad2bc['message']||_0x4ad2bc:''});}exports[_0xeba6('0x28')]=function(_0x3327dc,_0x5c6797,_0x2f8ef6){passport['authenticate'](_0xeba6('0x29'),function(_0x1b8d06,_0x28605b,_0x56bcde){var _0x3d671f=_0x1b8d06||_0x56bcde;if(_0x3d671f){return handleError(_0x5c6797,0x191,_0x3d671f);}if(!_0x28605b){return handleError(_0x5c6797,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xc51367={'payload':{'id':_0x28605b['id'],'role':_0x28605b[_0xeba6('0x1d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xc51367)[_0xeba6('0x17')](function(_0xf51cbb){_0x5c6797[_0xeba6('0x2a')]({'id':_0x28605b['id'],'token':_0xf51cbb,'statusCall':'','isAlreadyLogged':_0x28605b[_0xeba6('0x20')]});});}})(_0x3327dc,_0x5c6797,_0x2f8ef6);};passport[_0xeba6('0x2b')](_0xeba6('0x29'),new LocalStrategy({'usernameField':_0xeba6('0x1a'),'passwordField':_0xeba6('0x1b')},function(_0xf9eed9,_0x17c23d,_0x4be5af){return ActiveDirectoryAuthenticate(db[_0xeba6('0x2c')],_0xf9eed9,_0x17c23d,_0x4be5af);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 20a9480..8c45a17 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 _0x7ac1=['login','Router','./authActiveDirectory.controller','post'];(function(_0x8d81c6,_0x268107){var _0x1e13fb=function(_0x2102fa){while(--_0x2102fa){_0x8d81c6['push'](_0x8d81c6['shift']());}};_0x1e13fb(++_0x268107);}(_0x7ac1,0x1e1));var _0x17ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7ac1[_0xa464c9];return _0x3d73c4;};'use strict';var express=require('express');var router=express[_0x17ac('0x0')]();var controller=require(_0x17ac('0x1'));router[_0x17ac('0x2')]('/',controller[_0x17ac('0x3')]);module['exports']=router; \ No newline at end of file +var _0x7bf7=['./authActiveDirectory.controller','post','exports','express','Router'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7bf7,0x8f));var _0x77bf=function(_0xfa374c,_0x76b208){_0xfa374c=_0xfa374c-0x0;var _0x1fb223=_0x7bf7[_0xfa374c];return _0x1fb223;};'use strict';var express=require(_0x77bf('0x0'));var router=express[_0x77bf('0x1')]();var controller=require(_0x77bf('0x2'));router[_0x77bf('0x3')]('/',controller['login']);module[_0x77bf('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 37c495e..28da81e 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xdff215,_0x51203d){var _0x51b48e=function(_0x42df88){while(--_0x42df88){_0xdff215['push'](_0xdff215['shift']());}};_0x51b48e(++_0x51203d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x13134f,_0xffe6f2){var _0x160f40=function(_0x5e0b9e){while(--_0x5e0b9e){_0x13134f['push'](_0x13134f['shift']());}};_0x160f40(++_0xffe6f2);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6ccb530..f47948c 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 _0xdd06=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','Router','../user/user.controller.js'];(function(_0x350561,_0x4d3be3){var _0x54bfa9=function(_0x2e786d){while(--_0x2e786d){_0x350561['push'](_0x350561['shift']());}};_0x54bfa9(++_0x4d3be3);}(_0xdd06,0x1d6));var _0x6dd0=function(_0x15d178,_0x533561){_0x15d178=_0x15d178-0x0;var _0xc73785=_0xdd06[_0x15d178];return _0xc73785;};'use strict';var express=require(_0x6dd0('0x0'));var passport=require('passport');var router=express[_0x6dd0('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x6dd0('0x2'));var authService=require(_0x6dd0('0x3'));router[_0x6dd0('0x4')]('/',controller[_0x6dd0('0x5')]);router[_0x6dd0('0x4')](_0x6dd0('0x6'),controller[_0x6dd0('0x7')],authService[_0x6dd0('0x8')],userController[_0x6dd0('0x5')],authService[_0x6dd0('0x9')]);module[_0x6dd0('0xa')]=router; \ No newline at end of file +var _0xce5c=['exports','express','Router','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0xce5c,0x79));var _0xcce5=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xce5c[_0x1b745b];return _0x120a9d;};'use strict';var express=require(_0xcce5('0x0'));var passport=require('passport');var router=express[_0xcce5('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xcce5('0x2'));router[_0xcce5('0x3')]('/',controller[_0xcce5('0x4')]);router['get'](_0xcce5('0x5'),controller[_0xcce5('0x6')],authService[_0xcce5('0x7')],userController[_0xcce5('0x4')],authService[_0xcce5('0x8')]);module[_0xcce5('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c150559..365bfe9 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 _0xfcac=['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','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','Password\x20reset!','util','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','findOne','allowedLoginAttempts','then','password','role','disabled','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','authenticate','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.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfcac,0x1a9));var _0xcfca=function(_0xabcfad,_0x505b4a){_0xabcfad=_0xabcfad-0x0;var _0x3b10fe=_0xfcac[_0xabcfad];return _0x3b10fe;};'use strict';var util=require(_0xcfca('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xcfca('0x1')];var jayson=require(_0xcfca('0x2'));var _=require(_0xcfca('0x3'));var rs=require('randomstring');var moment=require(_0xcfca('0x4'));var db=require(_0xcfca('0x5'))['db'];var authService=require(_0xcfca('0x6'));var utils=require(_0xcfca('0x7'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x3d39e2,_0x3a9cbe,_0x21248d,_0x3cd819){var _0xd13474,_0x370071;return db[_0xcfca('0x8')][_0xcfca('0x9')]({'where':{'id':0x1},'attributes':[_0xcfca('0xa'),'blockDuration'],'raw':!![]})[_0xcfca('0xb')](function(_0x26c0fa){_0xd13474=_0x26c0fa;return _0x3d39e2[_0xcfca('0x9')]({'attributes':['id','name',_0xcfca('0xc'),'salt',_0xcfca('0xd'),_0xcfca('0xe'),'blocked',_0xcfca('0xf'),_0xcfca('0x10')],'where':{'name':_0x3a9cbe,'role':{'$or':[_0xcfca('0x11'),_0xcfca('0x12'),'agent']}}});})['then'](function(_0xf19ef6){if(!_0xf19ef6||_0xf19ef6&&_0xf19ef6[_0xcfca('0x13')]!==_0x3a9cbe){throw new Error(_0xcfca('0x14'));}else{_0x370071=_0xf19ef6;return _0x370071;}})[_0xcfca('0xb')](function(){_0x370071['authenticate'](_0x21248d,function(_0x5bb56d,_0x8fe3aa){var _0x643026=_0x370071[_0xcfca('0x10')]+0x1;if(_0x5bb56d){return _0x3cd819(_0x5bb56d);}else if(!_0x8fe3aa){if(_0x370071[_0xcfca('0xe')]){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});}else if(_0xd13474[_0xcfca('0xa')]>0x0){if(_0x370071[_0xcfca('0x15')]){if(_0xd13474['blockDuration']>0x0){if(moment(_0x370071[_0xcfca('0xf')])[_0xcfca('0x16')](_0xd13474[_0xcfca('0x17')],_0xcfca('0x18'))>moment()){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});}else{return utils[_0xcfca('0x19')](_0x370071,_0x643026,![],null)[_0xcfca('0xb')](function(){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});});}}else{return _0x3cd819(null,![],{'message':_0xcfca('0x14')});}}else{if(_0x643026>=_0xd13474['allowedLoginAttempts']){return utils['clearBlockUser'](_0x370071,0x0,!![],moment())[_0xcfca('0xb')](function(){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});});}else{return utils['clearBlockUser'](_0x370071,_0x643026,![],null)[_0xcfca('0xb')](function(){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});});}}}else{return _0x3cd819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x370071['disabled']){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});}else if(_0xd13474[_0xcfca('0xa')]>0x0){if(_0x370071[_0xcfca('0x15')]){if(_0xd13474[_0xcfca('0x17')]>0x0){if(moment(_0x370071[_0xcfca('0xf')])[_0xcfca('0x16')](_0xd13474[_0xcfca('0x17')],'minutes')>moment()){return _0x3cd819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcfca('0x19')](_0x370071,0x0,![],null)[_0xcfca('0xb')](function(){return utils['getLicense'](_0x370071);})[_0xcfca('0xb')](function(){return _0x3cd819(null,_0x370071);});}}else{return _0x3cd819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x370071,0x0,![],null)[_0xcfca('0xb')](function(){return utils[_0xcfca('0x1a')](_0x370071);})[_0xcfca('0xb')](function(){return _0x3cd819(null,_0x370071);})[_0xcfca('0x1b')](function(_0x1b6a93){return _0x3cd819(null,![],_0x1b6a93);});}}else{if(_0x370071['blocked']){return _0x3cd819(null,![],{'message':_0xcfca('0x14')});}else{return utils['getLicense'](_0x370071)['then'](function(){return _0x3cd819(null,_0x370071);});}}}});})[_0xcfca('0x1b')](function(_0x56e13d){return _0x3cd819(null,![],_0x56e13d);});}function sendServiceMail(_0x1a2980){return db[_0xcfca('0x1c')][_0xcfca('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xcfca('0x13'),_0xcfca('0x1e')],'include':[{'model':db[_0xcfca('0x1f')],'as':'Smtp','include':[{'model':db[_0xcfca('0x20')],'as':_0xcfca('0x20')}]}]})['then'](function(_0x574e4e){if(!_0x574e4e){throw new Error(_0xcfca('0x21'));}var _0x141651=_0x574e4e[_0xcfca('0x22')]();var _0x2e189f={'account':_0x141651,'message':_['merge']({'from':util['format'](_0xcfca('0x23'),_0x574e4e[_0xcfca('0x13')],_0x574e4e[_0xcfca('0x1e')]||_0x574e4e[_0xcfca('0x24')][_0xcfca('0x12')])},_0x1a2980)};return client[_0xcfca('0x25')](_0xcfca('0x26'),_0x2e189f);})['then'](function(_0xb5cd00){if(_0xb5cd00[_0xcfca('0x27')]){throw new Error(util[_0xcfca('0x28')](_0xcfca('0x29'),_0xb5cd00[_0xcfca('0x27')][_0xcfca('0x2a')]||JSON['stringify'](_0xb5cd00[_0xcfca('0x27')])));}return!![];});}function handleError(_0x36255c,_0x4a7423,_0x286093){return _0x36255c[_0xcfca('0x2b')](_0x4a7423||0x1f4)[_0xcfca('0x2c')]({'message':_0x286093?_0x286093[_0xcfca('0x2a')]||_0x286093:''});}exports['login']=function(_0x300931,_0x4763df,_0x2741fb){passport[_0xcfca('0x2d')](_0xcfca('0x2e'),function(_0x290c7a,_0x198845,_0x49a974){var _0xe166a7=_0x290c7a||_0x49a974;if(_0xe166a7){return handleError(_0x4763df,0x191,_0xe166a7);}if(!_0x198845){return handleError(_0x4763df,0x194,{'message':_0xcfca('0x2f')});}else{var _0x40b76d={'payload':{'id':_0x198845['id'],'role':_0x198845[_0xcfca('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xcfca('0x30')](_0x40b76d)[_0xcfca('0xb')](function(_0x5a5826){_0x4763df[_0xcfca('0x31')]({'id':_0x198845['id'],'token':_0x5a5826,'statusCall':'','isAlreadyLogged':_0x198845[_0xcfca('0x32')]});});}})(_0x300931,_0x4763df,_0x2741fb);};exports[_0xcfca('0x33')]=function(_0x44f18a,_0x5b307a){if(!_0x44f18a[_0xcfca('0x34')][_0xcfca('0x1e')]){return handleError(_0x5b307a,0x1f4,{'message':_0xcfca('0x35')});}var _0x58fe99=rs[_0xcfca('0x36')]();_0x44f18a[_0xcfca('0x34')]['email']=_0x44f18a[_0xcfca('0x34')][_0xcfca('0x1e')]['trim']()[_0xcfca('0x37')]();var _0x2fb195;return db[_0xcfca('0x8')][_0xcfca('0x9')]({'where':{'id':0x1},'attributes':[_0xcfca('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x270376){_0x2fb195=_0x270376;return db[_0xcfca('0x38')][_0xcfca('0x1d')]({'where':{'email':_0x44f18a[_0xcfca('0x34')][_0xcfca('0x1e')]}});})[_0xcfca('0xb')](function(_0x5b606c){if(!_0x5b606c){throw new Error(_0xcfca('0x39'));}if(_0x5b606c['disabled']){throw new Error(_0xcfca('0x3a'));}if(_0x5b606c[_0xcfca('0x15')]){if(moment(_0x5b606c[_0xcfca('0xf')])[_0xcfca('0x16')](_0x2fb195[_0xcfca('0x17')],'minutes')>moment()){throw new Error(_0xcfca('0x3b'));}else{_0x5b606c[_0xcfca('0x15')]=![];_0x5b606c[_0xcfca('0xf')]=null;}}_0x5b606c[_0xcfca('0x3c')]=_0x58fe99;_0x5b606c[_0xcfca('0x3d')]=Date[_0xcfca('0x3e')]()+0x36ee80;return _0x5b606c[_0xcfca('0x3f')]();})[_0xcfca('0xb')](function(){return sendServiceMail({'to':_0x44f18a[_0xcfca('0x34')][_0xcfca('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xcfca('0x40')+_0xcfca('0x41')+_0xcfca('0x42')+_0x44f18a[_0xcfca('0x43')][_0xcfca('0x44')]+_0xcfca('0x45')+_0x58fe99+'\x0a\x0a'+_0xcfca('0x46')});})['then'](function(){_0x5b307a[_0xcfca('0x2b')](0xc8)[_0xcfca('0x2c')]({'message':_0xcfca('0x47')});})[_0xcfca('0x1b')](function(_0x3fd343){return handleError(_0x5b307a,0x1f4,_0x3fd343);});};exports['reset']=function(_0x5473ff,_0x2834f9){return db[_0xcfca('0x38')][_0xcfca('0x1d')]({'where':{'resetPasswordToken':_0x5473ff['params'][_0xcfca('0x48')],'resetPasswordExpires':{'$gt':Date[_0xcfca('0x3e')]()}}})[_0xcfca('0xb')](function(_0x48f264){if(!_0x48f264){throw new Error(_0xcfca('0x49'));}return db['Setting'][_0xcfca('0x9')]({'attributes':['id',_0xcfca('0x4a'),_0xcfca('0x4b'),_0xcfca('0x4c')]})[_0xcfca('0xb')](function(_0x4ef821){if(_0x4ef821[_0xcfca('0x4a')])authService[_0xcfca('0x4d')](_0x5473ff[_0xcfca('0x34')][_0xcfca('0xc')]);if(!_0x4ef821[_0xcfca('0x4b')]||!_0x48f264['previousPasswords'])return _0x48f264;authService[_0xcfca('0x4e')](_0x5473ff[_0xcfca('0x34')]['password'],_0x48f264[_0xcfca('0x4f')],_0x4ef821[_0xcfca('0x4c')]);return _0x48f264;})[_0xcfca('0xb')](function(){_0x48f264[_0xcfca('0xc')]=_0x5473ff[_0xcfca('0x34')][_0xcfca('0xc')];_0x48f264['resetPasswordToken']=null;_0x48f264[_0xcfca('0x3d')]=null;return _0x48f264[_0xcfca('0x3f')]();});})[_0xcfca('0xb')](function(){_0x2834f9[_0xcfca('0x2b')](0xc8)['send']({'message':_0xcfca('0x50')});})[_0xcfca('0x1b')](function(_0x1b5263){return handleError(_0x2834f9,0x1f4,_0x1b5263);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0xcfca('0x13'),'passwordField':_0xcfca('0xc')},function(_0x5d1783,_0x46d25b,_0x3a2995){return localAuthenticate(db['User'],_0x5d1783,_0x46d25b,_0x3a2995);})); \ No newline at end of file +var _0x6fec=['https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','client','Setting','findOne','blockDuration','name','password','role','disabled','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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'];(function(_0x24de36,_0x506331){var _0x639465=function(_0x4319a1){while(--_0x4319a1){_0x24de36['push'](_0x24de36['shift']());}};_0x639465(++_0x506331);}(_0x6fec,0xb2));var _0xc6fe=function(_0x32e6db,_0x9dc9b5){_0x32e6db=_0x32e6db-0x0;var _0x47a10b=_0x6fec[_0x32e6db];return _0x47a10b;};'use strict';var util=require(_0xc6fe('0x0'));var passport=require(_0xc6fe('0x1'));var LocalStrategy=require(_0xc6fe('0x2'))[_0xc6fe('0x3')];var jayson=require(_0xc6fe('0x4'));var _=require(_0xc6fe('0x5'));var rs=require(_0xc6fe('0x6'));var moment=require(_0xc6fe('0x7'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xc6fe('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x33f8ad,_0x527104,_0x4a44f0,_0x196144){var _0xa32c8f,_0x3dcd02;return db[_0xc6fe('0x9')][_0xc6fe('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc6fe('0xb')],'raw':!![]})['then'](function(_0x1d49e8){_0xa32c8f=_0x1d49e8;return _0x33f8ad['findOne']({'attributes':['id',_0xc6fe('0xc'),_0xc6fe('0xd'),'salt',_0xc6fe('0xe'),_0xc6fe('0xf'),_0xc6fe('0x10'),'blockedAt',_0xc6fe('0x11')],'where':{'name':_0x527104,'role':{'$or':[_0xc6fe('0x12'),_0xc6fe('0x13'),_0xc6fe('0x14')]}}});})[_0xc6fe('0x15')](function(_0x5fb4c4){if(!_0x5fb4c4||_0x5fb4c4&&_0x5fb4c4['name']!==_0x527104){throw new Error(_0xc6fe('0x16'));}else{_0x3dcd02=_0x5fb4c4;return _0x3dcd02;}})[_0xc6fe('0x15')](function(){_0x3dcd02[_0xc6fe('0x17')](_0x4a44f0,function(_0x48307e,_0x2831d2){var _0x2f41dc=_0x3dcd02[_0xc6fe('0x11')]+0x1;if(_0x48307e){return _0x196144(_0x48307e);}else if(!_0x2831d2){if(_0x3dcd02[_0xc6fe('0xf')]){return _0x196144(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xa32c8f[_0xc6fe('0x18')]>0x0){if(_0x3dcd02[_0xc6fe('0x10')]){if(_0xa32c8f['blockDuration']>0x0){if(moment(_0x3dcd02[_0xc6fe('0x19')])[_0xc6fe('0x1a')](_0xa32c8f[_0xc6fe('0xb')],_0xc6fe('0x1b'))>moment()){return _0x196144(null,![],{'message':_0xc6fe('0x16')});}else{return utils[_0xc6fe('0x1c')](_0x3dcd02,_0x2f41dc,![],null)[_0xc6fe('0x15')](function(){return _0x196144(null,![],{'message':_0xc6fe('0x16')});});}}else{return _0x196144(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2f41dc>=_0xa32c8f[_0xc6fe('0x18')]){return utils[_0xc6fe('0x1c')](_0x3dcd02,0x0,!![],moment())['then'](function(){return _0x196144(null,![],{'message':_0xc6fe('0x16')});});}else{return utils[_0xc6fe('0x1c')](_0x3dcd02,_0x2f41dc,![],null)['then'](function(){return _0x196144(null,![],{'message':_0xc6fe('0x16')});});}}}else{return _0x196144(null,![],{'message':_0xc6fe('0x16')});}}else{if(_0x3dcd02[_0xc6fe('0xf')]){return _0x196144(null,![],{'message':_0xc6fe('0x16')});}else if(_0xa32c8f[_0xc6fe('0x18')]>0x0){if(_0x3dcd02[_0xc6fe('0x10')]){if(_0xa32c8f[_0xc6fe('0xb')]>0x0){if(moment(_0x3dcd02[_0xc6fe('0x19')])[_0xc6fe('0x1a')](_0xa32c8f[_0xc6fe('0xb')],'minutes')>moment()){return _0x196144(null,![],{'message':_0xc6fe('0x16')});}else{return utils['clearBlockUser'](_0x3dcd02,0x0,![],null)[_0xc6fe('0x15')](function(){return utils[_0xc6fe('0x1d')](_0x3dcd02);})['then'](function(){return _0x196144(null,_0x3dcd02);});}}else{return _0x196144(null,![],{'message':_0xc6fe('0x16')});}}else{return utils[_0xc6fe('0x1c')](_0x3dcd02,0x0,![],null)[_0xc6fe('0x15')](function(){return utils[_0xc6fe('0x1d')](_0x3dcd02);})[_0xc6fe('0x15')](function(){return _0x196144(null,_0x3dcd02);})[_0xc6fe('0x1e')](function(_0x1a2703){return _0x196144(null,![],_0x1a2703);});}}else{if(_0x3dcd02[_0xc6fe('0x10')]){return _0x196144(null,![],{'message':_0xc6fe('0x16')});}else{return utils[_0xc6fe('0x1d')](_0x3dcd02)[_0xc6fe('0x15')](function(){return _0x196144(null,_0x3dcd02);});}}}});})[_0xc6fe('0x1e')](function(_0x5b7f8b){return _0x196144(null,![],_0x5b7f8b);});}function sendServiceMail(_0x5778b6){return db[_0xc6fe('0x1f')][_0xc6fe('0x20')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xc6fe('0x21')],'as':'Smtp','include':[{'model':db[_0xc6fe('0x22')],'as':'CloudProvider'}]}]})['then'](function(_0x3bc4a0){if(!_0x3bc4a0){throw new Error(_0xc6fe('0x23'));}var _0x16cf91=_0x3bc4a0['getSmtpOptions']();var _0x479262={'account':_0x16cf91,'message':_[_0xc6fe('0x24')]({'from':util[_0xc6fe('0x25')](_0xc6fe('0x26'),_0x3bc4a0[_0xc6fe('0xc')],_0x3bc4a0[_0xc6fe('0x27')]||_0x3bc4a0['Smtp'][_0xc6fe('0x13')])},_0x5778b6)};return client[_0xc6fe('0x28')](_0xc6fe('0x29'),_0x479262);})[_0xc6fe('0x15')](function(_0x406e25){if(_0x406e25[_0xc6fe('0x2a')]){throw new Error(util[_0xc6fe('0x25')](_0xc6fe('0x2b'),_0x406e25[_0xc6fe('0x2a')][_0xc6fe('0x2c')]||JSON['stringify'](_0x406e25[_0xc6fe('0x2a')])));}return!![];});}function handleError(_0x25799c,_0x1e574a,_0xaff673){return _0x25799c[_0xc6fe('0x2d')](_0x1e574a||0x1f4)[_0xc6fe('0x2e')]({'message':_0xaff673?_0xaff673[_0xc6fe('0x2c')]||_0xaff673:''});}exports['login']=function(_0x173c24,_0x41a2d5,_0x807678){passport[_0xc6fe('0x17')](_0xc6fe('0x2f'),function(_0x36bcbe,_0x2541d1,_0x42e231){var _0x20116c=_0x36bcbe||_0x42e231;if(_0x20116c){return handleError(_0x41a2d5,0x191,_0x20116c);}if(!_0x2541d1){return handleError(_0x41a2d5,0x194,{'message':_0xc6fe('0x30')});}else{var _0x48bf29={'payload':{'id':_0x2541d1['id'],'role':_0x2541d1[_0xc6fe('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xc6fe('0x31')](_0x48bf29)[_0xc6fe('0x15')](function(_0x19391a){_0x41a2d5[_0xc6fe('0x32')]({'id':_0x2541d1['id'],'token':_0x19391a,'statusCall':'','isAlreadyLogged':_0x2541d1[_0xc6fe('0x33')]});});}})(_0x173c24,_0x41a2d5,_0x807678);};exports[_0xc6fe('0x34')]=function(_0x699a56,_0x416c34){if(!_0x699a56['body']['email']){return handleError(_0x416c34,0x1f4,{'message':_0xc6fe('0x35')});}var _0x38852f=rs[_0xc6fe('0x36')]();_0x699a56[_0xc6fe('0x37')][_0xc6fe('0x27')]=_0x699a56[_0xc6fe('0x37')][_0xc6fe('0x27')][_0xc6fe('0x38')]()[_0xc6fe('0x39')]();var _0xfb4d54;return db[_0xc6fe('0x9')][_0xc6fe('0xa')]({'where':{'id':0x1},'attributes':[_0xc6fe('0x18'),'blockDuration'],'raw':!![]})['then'](function(_0x2dd9b3){_0xfb4d54=_0x2dd9b3;return db[_0xc6fe('0x3a')][_0xc6fe('0x20')]({'where':{'email':_0x699a56[_0xc6fe('0x37')][_0xc6fe('0x27')]}});})[_0xc6fe('0x15')](function(_0x7d12e){if(!_0x7d12e){throw new Error(_0xc6fe('0x3b'));}if(_0x7d12e[_0xc6fe('0xf')]){throw new Error(_0xc6fe('0x3c'));}if(_0x7d12e[_0xc6fe('0x10')]){if(moment(_0x7d12e['blockedAt'])['add'](_0xfb4d54[_0xc6fe('0xb')],_0xc6fe('0x1b'))>moment()){throw new Error(_0xc6fe('0x3d'));}else{_0x7d12e['blocked']=![];_0x7d12e['blockedAt']=null;}}_0x7d12e[_0xc6fe('0x3e')]=_0x38852f;_0x7d12e[_0xc6fe('0x3f')]=Date[_0xc6fe('0x40')]()+0x36ee80;return _0x7d12e['save']();})[_0xc6fe('0x15')](function(){return sendServiceMail({'to':_0x699a56[_0xc6fe('0x37')][_0xc6fe('0x27')],'subject':_0xc6fe('0x41'),'text':_0xc6fe('0x42')+_0xc6fe('0x43')+_0xc6fe('0x44')+_0x699a56[_0xc6fe('0x45')][_0xc6fe('0x46')]+_0xc6fe('0x47')+_0x38852f+'\x0a\x0a'+_0xc6fe('0x48')});})[_0xc6fe('0x15')](function(){_0x416c34['status'](0xc8)[_0xc6fe('0x2e')]({'message':_0xc6fe('0x49')});})[_0xc6fe('0x1e')](function(_0xd4a82b){return handleError(_0x416c34,0x1f4,_0xd4a82b);});};exports[_0xc6fe('0x4a')]=function(_0x20243a,_0x4a56f9){return db[_0xc6fe('0x3a')][_0xc6fe('0x20')]({'where':{'resetPasswordToken':_0x20243a['params'][_0xc6fe('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xc6fe('0x40')]()}}})[_0xc6fe('0x15')](function(_0x34ae66){if(!_0x34ae66){throw new Error(_0xc6fe('0x4c'));}return db[_0xc6fe('0x9')][_0xc6fe('0xa')]({'attributes':['id',_0xc6fe('0x4d'),_0xc6fe('0x4e'),_0xc6fe('0x4f')]})[_0xc6fe('0x15')](function(_0x1f5350){if(_0x1f5350['securePassword'])authService['validatePasswordPattern'](_0x20243a[_0xc6fe('0x37')][_0xc6fe('0xd')]);if(!_0x1f5350[_0xc6fe('0x4e')]||!_0x34ae66[_0xc6fe('0x50')])return _0x34ae66;authService['validatePasswordHistory'](_0x20243a[_0xc6fe('0x37')]['password'],_0x34ae66[_0xc6fe('0x50')],_0x1f5350[_0xc6fe('0x4f')]);return _0x34ae66;})[_0xc6fe('0x15')](function(){_0x34ae66[_0xc6fe('0xd')]=_0x20243a[_0xc6fe('0x37')][_0xc6fe('0xd')];_0x34ae66['resetPasswordToken']=null;_0x34ae66['resetPasswordExpires']=null;return _0x34ae66['save']();});})['then'](function(){_0x4a56f9[_0xc6fe('0x2d')](0xc8)[_0xc6fe('0x2e')]({'message':'Password\x20reset!'});})['catch'](function(_0x5c8676){return handleError(_0x4a56f9,0x1f4,_0x5c8676);});};passport[_0xc6fe('0x51')](_0xc6fe('0x2f'),new LocalStrategy({'usernameField':_0xc6fe('0xc'),'passwordField':_0xc6fe('0xd')},function(_0x319f75,_0xd0acf8,_0x55a55e){return localAuthenticate(db['User'],_0x319f75,_0xd0acf8,_0x55a55e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2df96a4..64688df 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 _0x5384=['express','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports'];(function(_0x2190ff,_0x7e0a09){var _0x1dacaa=function(_0x4002ff){while(--_0x4002ff){_0x2190ff['push'](_0x2190ff['shift']());}};_0x1dacaa(++_0x7e0a09);}(_0x5384,0x1d4));var _0x4538=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x5384[_0x2e2c1b];return _0x43a4f2;};'use strict';var express=require(_0x4538('0x0'));var router=express['Router']();var controller=require(_0x4538('0x1'));router[_0x4538('0x2')]('/',controller[_0x4538('0x3')]);router['post'](_0x4538('0x4'),controller[_0x4538('0x5')]);router[_0x4538('0x2')](_0x4538('0x6'),controller[_0x4538('0x7')]);module[_0x4538('0x8')]=router; \ No newline at end of file +var _0xa34a=['./authLocal.controller','post','/forgot','/reset/:token','express','Router'];(function(_0x5676db,_0x5cd7d1){var _0x51394d=function(_0x10deed){while(--_0x10deed){_0x5676db['push'](_0x5676db['shift']());}};_0x51394d(++_0x5cd7d1);}(_0xa34a,0x160));var _0xaa34=function(_0x4ce783,_0x30d6d2){_0x4ce783=_0x4ce783-0x0;var _0x1fa2a1=_0xa34a[_0x4ce783];return _0x1fa2a1;};'use strict';var express=require(_0xaa34('0x0'));var router=express[_0xaa34('0x1')]();var controller=require(_0xaa34('0x2'));router[_0xaa34('0x3')]('/',controller['login']);router[_0xaa34('0x3')](_0xaa34('0x4'),controller['forgot']);router[_0xaa34('0x3')](_0xaa34('0x5'),controller['reset']);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 53addfa..502770a 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 _0x6730=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3c941e,_0x108fdb){var _0x5a4711=function(_0x2c7d83){while(--_0x2c7d83){_0x3c941e['push'](_0x3c941e['shift']());}};_0x5a4711(++_0x108fdb);}(_0x6730,0x10b));var _0x0673=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0x6730[_0x1d0aee];return _0x34ee2c;};'use strict';var Sequelize=require(_0x0673('0x0'));module[_0x0673('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x0673('0x2')]},'description':{'type':Sequelize[_0x0673('0x2')]},'status':{'type':Sequelize[_0x0673('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0673('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc9e9=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x3c8e96,_0x49f9fd){var _0x18667f=function(_0x5b7e14){while(--_0x5b7e14){_0x3c8e96['push'](_0x3c8e96['shift']());}};_0x18667f(++_0x49f9fd);}(_0xc9e9,0x123));var _0x9c9e=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xc9e9[_0x40d8d7];return _0x3454cc;};'use strict';var Sequelize=require(_0x9c9e('0x0'));module[_0x9c9e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c9e('0x2')]},'status':{'type':Sequelize[_0x9c9e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9c9e('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ff681a1..7503284 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 _0x5e7a=['squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','Automation','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','keys','include','options','find','create','body','params','addConditions','Condition','ids','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash'];(function(_0xa4392a,_0x2df99b){var _0x1032ab=function(_0x28f350){while(--_0x28f350){_0xa4392a['push'](_0xa4392a['shift']());}};_0x1032ab(++_0x2df99b);}(_0x5e7a,0x96));var _0xa5e7=function(_0x7b9e83,_0x5e1e5f){_0x7b9e83=_0x7b9e83-0x0;var _0x376a92=_0x5e7a[_0x7b9e83];return _0x376a92;};'use strict';var emlformat=require(_0xa5e7('0x0'));var rimraf=require(_0xa5e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5e7('0x2'));var rp=require(_0xa5e7('0x3'));var moment=require('moment');var BPromise=require(_0xa5e7('0x4'));var Mustache=require('mustache');var util=require(_0xa5e7('0x5'));var path=require(_0xa5e7('0x6'));var sox=require(_0xa5e7('0x7'));var csv=require('to-csv');var ejs=require(_0xa5e7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5e7('0x9'));var squel=require(_0xa5e7('0xa'));var crypto=require(_0xa5e7('0xb'));var jsforce=require(_0xa5e7('0xc'));var deskjs=require(_0xa5e7('0xd'));var toCsv=require(_0xa5e7('0xe'));var querystring=require('querystring');var Papa=require(_0xa5e7('0xf'));var Redis=require(_0xa5e7('0x10'));var authService=require(_0xa5e7('0x11'));var qs=require(_0xa5e7('0x12'));var as=require(_0xa5e7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5e7('0x14'))(_0xa5e7('0x15'));var utils=require(_0xa5e7('0x16'));var config=require(_0xa5e7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377378,_0x23b5b8){_0x23b5b8=_0x23b5b8||0xcc;return function(_0x5162a9){if(_0x5162a9){return _0x377378[_0xa5e7('0x18')](_0x23b5b8);}return _0x377378[_0xa5e7('0x19')](_0x23b5b8)['end']();};}function respondWithResult(_0x57f567,_0xeaf07f){_0xeaf07f=_0xeaf07f||0xc8;return function(_0x57fc94){if(_0x57fc94){return _0x57f567[_0xa5e7('0x19')](_0xeaf07f)[_0xa5e7('0x1a')](_0x57fc94);}};}function respondWithFilteredResult(_0x39ee5a,_0x39f0ef){return function(_0x825dea){if(_0x825dea){var _0x463372=typeof _0x39f0ef[_0xa5e7('0x1b')]===_0xa5e7('0x1c')&&typeof _0x39f0ef[_0xa5e7('0x1d')]===_0xa5e7('0x1c');var _0xf794b0=_0x825dea[_0xa5e7('0x1e')];var _0x2b012d=_0x463372?0x0:_0x39f0ef[_0xa5e7('0x1b')];var _0x5bc4eb=_0x463372?_0x825dea['count']:_0x39f0ef['offset']+_0x39f0ef[_0xa5e7('0x1d')];var _0x1f6ba2;if(_0x5bc4eb>=_0xf794b0){_0x5bc4eb=_0xf794b0;_0x1f6ba2=0xc8;}else{_0x1f6ba2=0xce;}_0x39ee5a[_0xa5e7('0x19')](_0x1f6ba2);return _0x39ee5a[_0xa5e7('0x1f')]('Content-Range',_0x2b012d+'-'+_0x5bc4eb+'/'+_0xf794b0)[_0xa5e7('0x1a')](_0x825dea);}return null;};}function patchUpdates(_0x9e7d4c){return function(_0x2a10f7){try{jsonpatch['apply'](_0x2a10f7,_0x9e7d4c,!![]);}catch(_0x520e9b){return BPromise[_0xa5e7('0x20')](_0x520e9b);}return _0x2a10f7['save']();};}function saveUpdates(_0x1c52e2,_0x123788){return function(_0x1af859){if(_0x1af859){return _0x1af859[_0xa5e7('0x21')](_0x1c52e2)[_0xa5e7('0x22')](function(_0x2ee6d1){return _0x2ee6d1;});}return null;};}function removeEntity(_0x5ab225,_0x2304bd){return function(_0x2ee1a6){if(_0x2ee1a6){return _0x2ee1a6['destroy']()[_0xa5e7('0x22')](function(){_0x5ab225['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x398b19,_0x1a1990){return function(_0x33abe9){if(!_0x33abe9){_0x398b19[_0xa5e7('0x18')](0x194);}return _0x33abe9;};}function handleError(_0x185643,_0x44b682){_0x44b682=_0x44b682||0x1f4;return function(_0x35c766){logger[_0xa5e7('0x23')](_0x35c766[_0xa5e7('0x24')]);if(_0x35c766['name']){delete _0x35c766[_0xa5e7('0x25')];}_0x185643['status'](_0x44b682)[_0xa5e7('0x26')](_0x35c766);};}exports[_0xa5e7('0x27')]=function(_0x443604,_0x1ba04c){var _0xca314e={},_0x18b14a={},_0x180ac4={'count':0x0,'rows':[]};var _0x534ce4=_['map'](db[_0xa5e7('0x28')][_0xa5e7('0x29')],function(_0x36fe8b){return{'name':_0x36fe8b['fieldName'],'type':_0x36fe8b[_0xa5e7('0x2a')][_0xa5e7('0x2b')]};});_0x18b14a[_0xa5e7('0x2c')]=_[_0xa5e7('0x2d')](_0x534ce4,'name');_0x18b14a[_0xa5e7('0x2e')]=_['keys'](_0x443604[_0xa5e7('0x2e')]);_0x18b14a[_0xa5e7('0x2f')]=_[_0xa5e7('0x30')](_0x18b14a[_0xa5e7('0x2c')],_0x18b14a['query']);_0xca314e[_0xa5e7('0x31')]=_[_0xa5e7('0x30')](_0x18b14a['model'],qs[_0xa5e7('0x32')](_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x32')]));_0xca314e['attributes']=_0xca314e[_0xa5e7('0x31')][_0xa5e7('0x33')]?_0xca314e[_0xa5e7('0x31')]:_0x18b14a[_0xa5e7('0x2c')];if(!_0x443604[_0xa5e7('0x2e')]['hasOwnProperty'](_0xa5e7('0x34'))){_0xca314e['limit']=qs[_0xa5e7('0x1d')](_0x443604['query'][_0xa5e7('0x1d')]);_0xca314e[_0xa5e7('0x1b')]=qs[_0xa5e7('0x1b')](_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x1b')]);}_0xca314e[_0xa5e7('0x35')]=qs[_0xa5e7('0x36')](_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x36')]);_0xca314e[_0xa5e7('0x37')]=qs[_0xa5e7('0x2f')](_[_0xa5e7('0x38')](_0x443604[_0xa5e7('0x2e')],_0x18b14a[_0xa5e7('0x2f')]),_0x534ce4);if(_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x39')]){_0xca314e[_0xa5e7('0x37')]=_[_0xa5e7('0x3a')](_0xca314e[_0xa5e7('0x37')],{'$or':_[_0xa5e7('0x2d')](_0x534ce4,function(_0x37479d){if(_0x37479d[_0xa5e7('0x2a')]!==_0xa5e7('0x3b')){var _0x3f961f={};_0x3f961f[_0x37479d[_0xa5e7('0x25')]]={'$like':'%'+_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x39')]+'%'};return _0x3f961f;}})});}_0xca314e=_['merge']({},_0xca314e,_0x443604['options']);var _0x4d5614={'where':_0xca314e[_0xa5e7('0x37')]};return db[_0xa5e7('0x28')][_0xa5e7('0x1e')](_0x4d5614)[_0xa5e7('0x22')](function(_0x240c29){_0x180ac4[_0xa5e7('0x1e')]=_0x240c29;if(_0x443604[_0xa5e7('0x2e')][_0xa5e7('0x3c')]){_0xca314e['include']=[{'all':!![]}];}return db[_0xa5e7('0x28')][_0xa5e7('0x3d')](_0xca314e);})[_0xa5e7('0x22')](function(_0x2dd393){_0x180ac4['rows']=_0x2dd393;return _0x180ac4;})[_0xa5e7('0x22')](respondWithFilteredResult(_0x1ba04c,_0xca314e))[_0xa5e7('0x3e')](handleError(_0x1ba04c,null));};exports[_0xa5e7('0x3f')]=function(_0x5bd47e,_0x18bc74){var _0x3c88b7={'raw':![],'where':{'id':_0x5bd47e['params']['id']}},_0x5ccc12={};_0x5ccc12[_0xa5e7('0x2c')]=_[_0xa5e7('0x40')](db[_0xa5e7('0x28')]['rawAttributes']);_0x5ccc12[_0xa5e7('0x2e')]=_[_0xa5e7('0x40')](_0x5bd47e['query']);_0x5ccc12[_0xa5e7('0x2f')]=_[_0xa5e7('0x30')](_0x5ccc12['model'],_0x5ccc12['query']);_0x3c88b7['attributes']=_['intersection'](_0x5ccc12[_0xa5e7('0x2c')],qs[_0xa5e7('0x32')](_0x5bd47e[_0xa5e7('0x2e')][_0xa5e7('0x32')]));_0x3c88b7[_0xa5e7('0x31')]=_0x3c88b7[_0xa5e7('0x31')][_0xa5e7('0x33')]?_0x3c88b7[_0xa5e7('0x31')]:_0x5ccc12[_0xa5e7('0x2c')];if(_0x5bd47e[_0xa5e7('0x2e')][_0xa5e7('0x3c')]){_0x3c88b7[_0xa5e7('0x41')]=[{'all':!![]}];}_0x3c88b7=_[_0xa5e7('0x3a')]({},_0x3c88b7,_0x5bd47e[_0xa5e7('0x42')]);return db[_0xa5e7('0x28')][_0xa5e7('0x43')](_0x3c88b7)[_0xa5e7('0x22')](handleEntityNotFound(_0x18bc74,null))[_0xa5e7('0x22')](respondWithResult(_0x18bc74,null))[_0xa5e7('0x3e')](handleError(_0x18bc74,null));};exports[_0xa5e7('0x44')]=function(_0x525713,_0x527e53){return db[_0xa5e7('0x28')][_0xa5e7('0x44')](_0x525713[_0xa5e7('0x45')],{})[_0xa5e7('0x22')](respondWithResult(_0x527e53,0xc9))[_0xa5e7('0x3e')](handleError(_0x527e53,null));};exports['update']=function(_0x12be36,_0x16bfbf){if(_0x12be36[_0xa5e7('0x45')]['id']){delete _0x12be36['body']['id'];}return db[_0xa5e7('0x28')][_0xa5e7('0x43')]({'where':{'id':_0x12be36[_0xa5e7('0x46')]['id']}})['then'](handleEntityNotFound(_0x16bfbf,null))['then'](saveUpdates(_0x12be36[_0xa5e7('0x45')],null))['then'](respondWithResult(_0x16bfbf,null))[_0xa5e7('0x3e')](handleError(_0x16bfbf,null));};exports['destroy']=function(_0x22e512,_0x1c31d2){return db[_0xa5e7('0x28')]['find']({'where':{'id':_0x22e512[_0xa5e7('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c31d2,null))[_0xa5e7('0x22')](removeEntity(_0x1c31d2,null))[_0xa5e7('0x3e')](handleError(_0x1c31d2,null));};exports[_0xa5e7('0x47')]=function(_0x18686a,_0x79c67b,_0x172f41){return db[_0xa5e7('0x48')]['find']({'where':{'id':_0x18686a[_0xa5e7('0x46')]['id']}})[_0xa5e7('0x22')](handleEntityNotFound(_0x79c67b,null))[_0xa5e7('0x22')](function(_0x36188d){if(_0x36188d){return _0x36188d['addConditions'](_0x18686a['body'][_0xa5e7('0x49')],_['omit'](_0x18686a['body'],[_0xa5e7('0x49'),'id'])||{});}})['then'](respondWithResult(_0x79c67b,null))[_0xa5e7('0x3e')](handleError(_0x79c67b,null));};exports[_0xa5e7('0x4a')]=function(_0x328f84,_0x4c25f7,_0x37206f){var _0x36993c={};var _0x487f20={};var _0x1bff9e;var _0x10db75;return db[_0xa5e7('0x28')][_0xa5e7('0x4b')]({'where':{'id':_0x328f84['params']['id']}})[_0xa5e7('0x22')](handleEntityNotFound(_0x4c25f7,null))[_0xa5e7('0x22')](function(_0x4d3732){if(_0x4d3732){_0x1bff9e=_0x4d3732;_0x487f20[_0xa5e7('0x2c')]=_[_0xa5e7('0x40')](db['Condition']['rawAttributes']);_0x487f20[_0xa5e7('0x2e')]=_[_0xa5e7('0x40')](_0x328f84[_0xa5e7('0x2e')]);_0x487f20[_0xa5e7('0x2f')]=_[_0xa5e7('0x30')](_0x487f20[_0xa5e7('0x2c')],_0x487f20[_0xa5e7('0x2e')]);_0x36993c[_0xa5e7('0x31')]=_['intersection'](_0x487f20[_0xa5e7('0x2c')],qs[_0xa5e7('0x32')](_0x328f84[_0xa5e7('0x2e')][_0xa5e7('0x32')]));_0x36993c[_0xa5e7('0x31')]=_0x36993c['attributes'][_0xa5e7('0x33')]?_0x36993c[_0xa5e7('0x31')]:_0x487f20[_0xa5e7('0x2c')];_0x36993c[_0xa5e7('0x35')]=qs['sort'](_0x328f84[_0xa5e7('0x2e')][_0xa5e7('0x36')]);_0x36993c['where']=qs['filters'](_['pick'](_0x328f84[_0xa5e7('0x2e')],_0x487f20[_0xa5e7('0x2f')]));if(_0x328f84[_0xa5e7('0x2e')][_0xa5e7('0x39')]){_0x36993c[_0xa5e7('0x37')]=_[_0xa5e7('0x3a')](_0x36993c[_0xa5e7('0x37')],{'$or':_[_0xa5e7('0x2d')](_0x36993c[_0xa5e7('0x31')],function(_0x560654){var _0x4027af={};_0x4027af[_0x560654]={'$like':'%'+_0x328f84[_0xa5e7('0x2e')]['filter']+'%'};return _0x4027af;})});}_0x36993c=_[_0xa5e7('0x3a')]({},_0x36993c,_0x328f84['options']);return _0x1bff9e[_0xa5e7('0x4a')](_0x36993c);}})[_0xa5e7('0x22')](function(_0x33276a){if(_0x33276a){_0x10db75=_0x33276a[_0xa5e7('0x33')];if(!_0x328f84[_0xa5e7('0x2e')][_0xa5e7('0x4c')](_0xa5e7('0x34'))){_0x36993c[_0xa5e7('0x1d')]=qs[_0xa5e7('0x1d')](_0x328f84['query']['limit']);_0x36993c[_0xa5e7('0x1b')]=qs[_0xa5e7('0x1b')](_0x328f84[_0xa5e7('0x2e')][_0xa5e7('0x1b')]);}return _0x1bff9e[_0xa5e7('0x4a')](_0x36993c);}})[_0xa5e7('0x22')](function(_0x7dd788){if(_0x7dd788){return _0x7dd788?{'count':_0x10db75,'rows':_0x7dd788}:null;}})['then'](respondWithResult(_0x4c25f7,null))['catch'](handleError(_0x4c25f7,null));};exports[_0xa5e7('0x4d')]=function(_0x36333f,_0x3a1485,_0x43d5e4){return db[_0xa5e7('0x4e')]['find']({'where':{'id':_0x36333f[_0xa5e7('0x46')]['id']}})[_0xa5e7('0x22')](handleEntityNotFound(_0x3a1485,null))[_0xa5e7('0x22')](function(_0x5ebef5){if(_0x5ebef5){return _0x5ebef5[_0xa5e7('0x4d')](_0x36333f['body'][_0xa5e7('0x49')],_['omit'](_0x36333f[_0xa5e7('0x45')],[_0xa5e7('0x49'),'id'])||{});}})[_0xa5e7('0x22')](respondWithResult(_0x3a1485,null))['catch'](handleError(_0x3a1485,null));};exports[_0xa5e7('0x4f')]=function(_0x4033ac,_0x3a4043,_0x3364be){var _0x19ad5d={};var _0x25440f={};var _0x1e0375;var _0x442ffc;return db[_0xa5e7('0x28')][_0xa5e7('0x4b')]({'where':{'id':_0x4033ac[_0xa5e7('0x46')]['id']}})[_0xa5e7('0x22')](handleEntityNotFound(_0x3a4043,null))['then'](function(_0x22805a){if(_0x22805a){_0x1e0375=_0x22805a;_0x25440f[_0xa5e7('0x2c')]=_[_0xa5e7('0x40')](db[_0xa5e7('0x4e')][_0xa5e7('0x29')]);_0x25440f['query']=_[_0xa5e7('0x40')](_0x4033ac[_0xa5e7('0x2e')]);_0x25440f[_0xa5e7('0x2f')]=_[_0xa5e7('0x30')](_0x25440f['model'],_0x25440f[_0xa5e7('0x2e')]);_0x19ad5d['attributes']=_[_0xa5e7('0x30')](_0x25440f[_0xa5e7('0x2c')],qs['fields'](_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x32')]));_0x19ad5d['attributes']=_0x19ad5d['attributes'][_0xa5e7('0x33')]?_0x19ad5d[_0xa5e7('0x31')]:_0x25440f[_0xa5e7('0x2c')];_0x19ad5d[_0xa5e7('0x35')]=qs[_0xa5e7('0x36')](_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x36')]);_0x19ad5d[_0xa5e7('0x37')]=qs['filters'](_[_0xa5e7('0x38')](_0x4033ac['query'],_0x25440f[_0xa5e7('0x2f')]));if(_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x39')]){_0x19ad5d[_0xa5e7('0x37')]=_[_0xa5e7('0x3a')](_0x19ad5d[_0xa5e7('0x37')],{'$or':_[_0xa5e7('0x2d')](_0x19ad5d[_0xa5e7('0x31')],function(_0x10802d){var _0x11bab1={};_0x11bab1[_0x10802d]={'$like':'%'+_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x39')]+'%'};return _0x11bab1;})});}_0x19ad5d=_[_0xa5e7('0x3a')]({},_0x19ad5d,_0x4033ac['options']);return _0x1e0375[_0xa5e7('0x4f')](_0x19ad5d);}})[_0xa5e7('0x22')](function(_0xbd79ca){if(_0xbd79ca){_0x442ffc=_0xbd79ca[_0xa5e7('0x33')];if(!_0x4033ac['query'][_0xa5e7('0x4c')]('nolimit')){_0x19ad5d['limit']=qs[_0xa5e7('0x1d')](_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x1d')]);_0x19ad5d['offset']=qs[_0xa5e7('0x1b')](_0x4033ac[_0xa5e7('0x2e')][_0xa5e7('0x1b')]);}return _0x1e0375[_0xa5e7('0x4f')](_0x19ad5d);}})['then'](function(_0x6d655f){if(_0x6d655f){return _0x6d655f?{'count':_0x442ffc,'rows':_0x6d655f}:null;}})[_0xa5e7('0x22')](respondWithResult(_0x3a4043,null))['catch'](handleError(_0x3a4043,null));}; \ No newline at end of file +var _0x6b3d=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','create','body','find','addConditions','Condition','omit','ids','Action','addActions','findOne','getActions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','Automation','rawAttributes','fieldName','key','model','map','query','keys','filters'];(function(_0x134258,_0x16c07d){var _0x494c0b=function(_0x3fe3ad){while(--_0x3fe3ad){_0x134258['push'](_0x134258['shift']());}};_0x494c0b(++_0x16c07d);}(_0x6b3d,0x1a3));var _0xd6b3=function(_0x35a8dd,_0x41adcc){_0x35a8dd=_0x35a8dd-0x0;var _0x525969=_0x6b3d[_0x35a8dd];return _0x525969;};'use strict';var emlformat=require(_0xd6b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6b3('0x1'));var jsonpatch=require(_0xd6b3('0x2'));var rp=require(_0xd6b3('0x3'));var moment=require('moment');var BPromise=require(_0xd6b3('0x4'));var Mustache=require('mustache');var util=require(_0xd6b3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd6b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6b3('0x7'));var _=require('lodash');var squel=require(_0xd6b3('0x8'));var crypto=require(_0xd6b3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd6b3('0xa'));var toCsv=require(_0xd6b3('0x6'));var querystring=require('querystring');var Papa=require(_0xd6b3('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd6b3('0xc'));var as=require(_0xd6b3('0xd'));var hardwareService=require(_0xd6b3('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6b3('0xf'));var db=require(_0xd6b3('0x10'))['db'];function respondWithStatusCode(_0x6062ba,_0x550b82){_0x550b82=_0x550b82||0xcc;return function(_0x535b88){if(_0x535b88){return _0x6062ba[_0xd6b3('0x11')](_0x550b82);}return _0x6062ba[_0xd6b3('0x12')](_0x550b82)[_0xd6b3('0x13')]();};}function respondWithResult(_0x49f084,_0x479264){_0x479264=_0x479264||0xc8;return function(_0x19f0d2){if(_0x19f0d2){return _0x49f084[_0xd6b3('0x12')](_0x479264)[_0xd6b3('0x14')](_0x19f0d2);}};}function respondWithFilteredResult(_0x1dd995,_0x3ee5f9){return function(_0x19e7ff){if(_0x19e7ff){var _0x1efe8d=typeof _0x3ee5f9[_0xd6b3('0x15')]===_0xd6b3('0x16')&&typeof _0x3ee5f9['limit']==='undefined';var _0x5cd5d5=_0x19e7ff['count'];var _0x5f21d7=_0x1efe8d?0x0:_0x3ee5f9[_0xd6b3('0x15')];var _0x14c6cb=_0x1efe8d?_0x19e7ff[_0xd6b3('0x17')]:_0x3ee5f9[_0xd6b3('0x15')]+_0x3ee5f9['limit'];var _0x3a11f0;if(_0x14c6cb>=_0x5cd5d5){_0x14c6cb=_0x5cd5d5;_0x3a11f0=0xc8;}else{_0x3a11f0=0xce;}_0x1dd995[_0xd6b3('0x12')](_0x3a11f0);return _0x1dd995[_0xd6b3('0x18')](_0xd6b3('0x19'),_0x5f21d7+'-'+_0x14c6cb+'/'+_0x5cd5d5)[_0xd6b3('0x14')](_0x19e7ff);}return null;};}function patchUpdates(_0x5075bf){return function(_0x5a44bc){try{jsonpatch[_0xd6b3('0x1a')](_0x5a44bc,_0x5075bf,!![]);}catch(_0x1dc60b){return BPromise[_0xd6b3('0x1b')](_0x1dc60b);}return _0x5a44bc[_0xd6b3('0x1c')]();};}function saveUpdates(_0x513709,_0x16d64d){return function(_0x4e528e){if(_0x4e528e){return _0x4e528e[_0xd6b3('0x1d')](_0x513709)['then'](function(_0x30528f){return _0x30528f;});}return null;};}function removeEntity(_0x16d292,_0x2e2ba7){return function(_0x218969){if(_0x218969){return _0x218969[_0xd6b3('0x1e')]()['then'](function(){_0x16d292[_0xd6b3('0x12')](0xcc)[_0xd6b3('0x13')]();});}};}function handleEntityNotFound(_0xa48ff1,_0x475622){return function(_0x57f50c){if(!_0x57f50c){_0xa48ff1[_0xd6b3('0x11')](0x194);}return _0x57f50c;};}function handleError(_0x484a60,_0x16eb3d){_0x16eb3d=_0x16eb3d||0x1f4;return function(_0x1a7d46){logger[_0xd6b3('0x1f')](_0x1a7d46[_0xd6b3('0x20')]);if(_0x1a7d46['name']){delete _0x1a7d46[_0xd6b3('0x21')];}_0x484a60[_0xd6b3('0x12')](_0x16eb3d)['send'](_0x1a7d46);};}exports['index']=function(_0x2e4796,_0x53738c){var _0x45601b={},_0x35b2f3={},_0x3960e7={'count':0x0,'rows':[]};var _0x4901d4=_['map'](db[_0xd6b3('0x22')][_0xd6b3('0x23')],function(_0x57dc4f){return{'name':_0x57dc4f[_0xd6b3('0x24')],'type':_0x57dc4f['type'][_0xd6b3('0x25')]};});_0x35b2f3[_0xd6b3('0x26')]=_[_0xd6b3('0x27')](_0x4901d4,_0xd6b3('0x21'));_0x35b2f3[_0xd6b3('0x28')]=_[_0xd6b3('0x29')](_0x2e4796[_0xd6b3('0x28')]);_0x35b2f3[_0xd6b3('0x2a')]=_[_0xd6b3('0x2b')](_0x35b2f3[_0xd6b3('0x26')],_0x35b2f3[_0xd6b3('0x28')]);_0x45601b[_0xd6b3('0x2c')]=_['intersection'](_0x35b2f3[_0xd6b3('0x26')],qs['fields'](_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x2d')]));_0x45601b[_0xd6b3('0x2c')]=_0x45601b['attributes'][_0xd6b3('0x2e')]?_0x45601b['attributes']:_0x35b2f3[_0xd6b3('0x26')];if(!_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x2f')](_0xd6b3('0x30'))){_0x45601b[_0xd6b3('0x31')]=qs[_0xd6b3('0x31')](_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x31')]);_0x45601b['offset']=qs['offset'](_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x15')]);}_0x45601b[_0xd6b3('0x32')]=qs['sort'](_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x33')]);_0x45601b[_0xd6b3('0x34')]=qs[_0xd6b3('0x2a')](_[_0xd6b3('0x35')](_0x2e4796[_0xd6b3('0x28')],_0x35b2f3['filters']),_0x4901d4);if(_0x2e4796[_0xd6b3('0x28')][_0xd6b3('0x36')]){_0x45601b['where']=_[_0xd6b3('0x37')](_0x45601b[_0xd6b3('0x34')],{'$or':_['map'](_0x4901d4,function(_0x281c23){if(_0x281c23['type']!==_0xd6b3('0x38')){var _0xe9077a={};_0xe9077a[_0x281c23[_0xd6b3('0x21')]]={'$like':'%'+_0x2e4796['query']['filter']+'%'};return _0xe9077a;}})});}_0x45601b=_[_0xd6b3('0x37')]({},_0x45601b,_0x2e4796[_0xd6b3('0x39')]);var _0x419f25={'where':_0x45601b[_0xd6b3('0x34')]};return db[_0xd6b3('0x22')][_0xd6b3('0x17')](_0x419f25)['then'](function(_0x22b101){_0x3960e7[_0xd6b3('0x17')]=_0x22b101;if(_0x2e4796[_0xd6b3('0x28')]['includeAll']){_0x45601b[_0xd6b3('0x3a')]=[{'all':!![]}];}return db[_0xd6b3('0x22')][_0xd6b3('0x3b')](_0x45601b);})[_0xd6b3('0x3c')](function(_0x195a3a){_0x3960e7[_0xd6b3('0x3d')]=_0x195a3a;return _0x3960e7;})[_0xd6b3('0x3c')](respondWithFilteredResult(_0x53738c,_0x45601b))[_0xd6b3('0x3e')](handleError(_0x53738c,null));};exports[_0xd6b3('0x3f')]=function(_0x5e1256,_0x167be5){var _0x3adcb6={'raw':![],'where':{'id':_0x5e1256[_0xd6b3('0x40')]['id']}},_0x1dd7c4={};_0x1dd7c4[_0xd6b3('0x26')]=_[_0xd6b3('0x29')](db[_0xd6b3('0x22')][_0xd6b3('0x23')]);_0x1dd7c4[_0xd6b3('0x28')]=_[_0xd6b3('0x29')](_0x5e1256[_0xd6b3('0x28')]);_0x1dd7c4['filters']=_[_0xd6b3('0x2b')](_0x1dd7c4['model'],_0x1dd7c4[_0xd6b3('0x28')]);_0x3adcb6[_0xd6b3('0x2c')]=_[_0xd6b3('0x2b')](_0x1dd7c4[_0xd6b3('0x26')],qs[_0xd6b3('0x2d')](_0x5e1256[_0xd6b3('0x28')]['fields']));_0x3adcb6[_0xd6b3('0x2c')]=_0x3adcb6['attributes'][_0xd6b3('0x2e')]?_0x3adcb6[_0xd6b3('0x2c')]:_0x1dd7c4[_0xd6b3('0x26')];if(_0x5e1256[_0xd6b3('0x28')][_0xd6b3('0x41')]){_0x3adcb6[_0xd6b3('0x3a')]=[{'all':!![]}];}_0x3adcb6=_[_0xd6b3('0x37')]({},_0x3adcb6,_0x5e1256[_0xd6b3('0x39')]);return db[_0xd6b3('0x22')]['find'](_0x3adcb6)[_0xd6b3('0x3c')](handleEntityNotFound(_0x167be5,null))[_0xd6b3('0x3c')](respondWithResult(_0x167be5,null))[_0xd6b3('0x3e')](handleError(_0x167be5,null));};exports[_0xd6b3('0x42')]=function(_0x165be5,_0x1cdc60){return db[_0xd6b3('0x22')][_0xd6b3('0x42')](_0x165be5['body'],{})[_0xd6b3('0x3c')](respondWithResult(_0x1cdc60,0xc9))['catch'](handleError(_0x1cdc60,null));};exports['update']=function(_0x4fb8e7,_0x440faf){if(_0x4fb8e7['body']['id']){delete _0x4fb8e7[_0xd6b3('0x43')]['id'];}return db['Automation']['find']({'where':{'id':_0x4fb8e7[_0xd6b3('0x40')]['id']}})[_0xd6b3('0x3c')](handleEntityNotFound(_0x440faf,null))[_0xd6b3('0x3c')](saveUpdates(_0x4fb8e7[_0xd6b3('0x43')],null))['then'](respondWithResult(_0x440faf,null))[_0xd6b3('0x3e')](handleError(_0x440faf,null));};exports['destroy']=function(_0x1ebb17,_0x438877){return db['Automation'][_0xd6b3('0x44')]({'where':{'id':_0x1ebb17[_0xd6b3('0x40')]['id']}})['then'](handleEntityNotFound(_0x438877,null))['then'](removeEntity(_0x438877,null))[_0xd6b3('0x3e')](handleError(_0x438877,null));};exports[_0xd6b3('0x45')]=function(_0x4a3726,_0x3a4d67,_0x2e87a9){return db[_0xd6b3('0x46')][_0xd6b3('0x44')]({'where':{'id':_0x4a3726['params']['id']}})[_0xd6b3('0x3c')](handleEntityNotFound(_0x3a4d67,null))[_0xd6b3('0x3c')](function(_0x6f9dda){if(_0x6f9dda){return _0x6f9dda[_0xd6b3('0x45')](_0x4a3726[_0xd6b3('0x43')]['ids'],_[_0xd6b3('0x47')](_0x4a3726[_0xd6b3('0x43')],[_0xd6b3('0x48'),'id'])||{});}})[_0xd6b3('0x3c')](respondWithResult(_0x3a4d67,null))[_0xd6b3('0x3e')](handleError(_0x3a4d67,null));};exports['getConditions']=function(_0x41c06d,_0x212e26,_0x367a45){var _0x524235={};var _0x3af15b={};var _0x24734f;var _0x258ae4;return db[_0xd6b3('0x22')]['findOne']({'where':{'id':_0x41c06d[_0xd6b3('0x40')]['id']}})[_0xd6b3('0x3c')](handleEntityNotFound(_0x212e26,null))[_0xd6b3('0x3c')](function(_0x209772){if(_0x209772){_0x24734f=_0x209772;_0x3af15b[_0xd6b3('0x26')]=_['keys'](db['Condition'][_0xd6b3('0x23')]);_0x3af15b[_0xd6b3('0x28')]=_[_0xd6b3('0x29')](_0x41c06d['query']);_0x3af15b[_0xd6b3('0x2a')]=_[_0xd6b3('0x2b')](_0x3af15b[_0xd6b3('0x26')],_0x3af15b[_0xd6b3('0x28')]);_0x524235[_0xd6b3('0x2c')]=_[_0xd6b3('0x2b')](_0x3af15b['model'],qs[_0xd6b3('0x2d')](_0x41c06d[_0xd6b3('0x28')][_0xd6b3('0x2d')]));_0x524235[_0xd6b3('0x2c')]=_0x524235[_0xd6b3('0x2c')][_0xd6b3('0x2e')]?_0x524235[_0xd6b3('0x2c')]:_0x3af15b[_0xd6b3('0x26')];_0x524235[_0xd6b3('0x32')]=qs['sort'](_0x41c06d[_0xd6b3('0x28')][_0xd6b3('0x33')]);_0x524235[_0xd6b3('0x34')]=qs[_0xd6b3('0x2a')](_['pick'](_0x41c06d[_0xd6b3('0x28')],_0x3af15b[_0xd6b3('0x2a')]));if(_0x41c06d[_0xd6b3('0x28')][_0xd6b3('0x36')]){_0x524235[_0xd6b3('0x34')]=_[_0xd6b3('0x37')](_0x524235[_0xd6b3('0x34')],{'$or':_[_0xd6b3('0x27')](_0x524235[_0xd6b3('0x2c')],function(_0x4fd2ae){var _0xa8c5ee={};_0xa8c5ee[_0x4fd2ae]={'$like':'%'+_0x41c06d['query']['filter']+'%'};return _0xa8c5ee;})});}_0x524235=_['merge']({},_0x524235,_0x41c06d[_0xd6b3('0x39')]);return _0x24734f['getConditions'](_0x524235);}})['then'](function(_0x9376a9){if(_0x9376a9){_0x258ae4=_0x9376a9['length'];if(!_0x41c06d[_0xd6b3('0x28')][_0xd6b3('0x2f')](_0xd6b3('0x30'))){_0x524235['limit']=qs[_0xd6b3('0x31')](_0x41c06d[_0xd6b3('0x28')]['limit']);_0x524235['offset']=qs['offset'](_0x41c06d[_0xd6b3('0x28')]['offset']);}return _0x24734f['getConditions'](_0x524235);}})['then'](function(_0x511ef7){if(_0x511ef7){return _0x511ef7?{'count':_0x258ae4,'rows':_0x511ef7}:null;}})[_0xd6b3('0x3c')](respondWithResult(_0x212e26,null))['catch'](handleError(_0x212e26,null));};exports['addActions']=function(_0x5cdb09,_0x3dce16,_0x8bf187){return db[_0xd6b3('0x49')]['find']({'where':{'id':_0x5cdb09[_0xd6b3('0x40')]['id']}})['then'](handleEntityNotFound(_0x3dce16,null))[_0xd6b3('0x3c')](function(_0x10fead){if(_0x10fead){return _0x10fead[_0xd6b3('0x4a')](_0x5cdb09[_0xd6b3('0x43')][_0xd6b3('0x48')],_['omit'](_0x5cdb09[_0xd6b3('0x43')],['ids','id'])||{});}})[_0xd6b3('0x3c')](respondWithResult(_0x3dce16,null))[_0xd6b3('0x3e')](handleError(_0x3dce16,null));};exports['getActions']=function(_0xddc8b2,_0x47def,_0x38770a){var _0x4c791e={};var _0x8b3977={};var _0x3d340b;var _0x3072d1;return db[_0xd6b3('0x22')][_0xd6b3('0x4b')]({'where':{'id':_0xddc8b2[_0xd6b3('0x40')]['id']}})['then'](handleEntityNotFound(_0x47def,null))[_0xd6b3('0x3c')](function(_0x6316ae){if(_0x6316ae){_0x3d340b=_0x6316ae;_0x8b3977[_0xd6b3('0x26')]=_['keys'](db[_0xd6b3('0x49')][_0xd6b3('0x23')]);_0x8b3977[_0xd6b3('0x28')]=_['keys'](_0xddc8b2[_0xd6b3('0x28')]);_0x8b3977[_0xd6b3('0x2a')]=_['intersection'](_0x8b3977[_0xd6b3('0x26')],_0x8b3977[_0xd6b3('0x28')]);_0x4c791e[_0xd6b3('0x2c')]=_[_0xd6b3('0x2b')](_0x8b3977[_0xd6b3('0x26')],qs[_0xd6b3('0x2d')](_0xddc8b2['query'][_0xd6b3('0x2d')]));_0x4c791e[_0xd6b3('0x2c')]=_0x4c791e[_0xd6b3('0x2c')][_0xd6b3('0x2e')]?_0x4c791e[_0xd6b3('0x2c')]:_0x8b3977[_0xd6b3('0x26')];_0x4c791e['order']=qs['sort'](_0xddc8b2[_0xd6b3('0x28')]['sort']);_0x4c791e['where']=qs[_0xd6b3('0x2a')](_[_0xd6b3('0x35')](_0xddc8b2['query'],_0x8b3977[_0xd6b3('0x2a')]));if(_0xddc8b2[_0xd6b3('0x28')][_0xd6b3('0x36')]){_0x4c791e[_0xd6b3('0x34')]=_[_0xd6b3('0x37')](_0x4c791e[_0xd6b3('0x34')],{'$or':_[_0xd6b3('0x27')](_0x4c791e[_0xd6b3('0x2c')],function(_0xb5913){var _0x26cbf7={};_0x26cbf7[_0xb5913]={'$like':'%'+_0xddc8b2['query'][_0xd6b3('0x36')]+'%'};return _0x26cbf7;})});}_0x4c791e=_[_0xd6b3('0x37')]({},_0x4c791e,_0xddc8b2['options']);return _0x3d340b[_0xd6b3('0x4c')](_0x4c791e);}})[_0xd6b3('0x3c')](function(_0x119f3d){if(_0x119f3d){_0x3072d1=_0x119f3d[_0xd6b3('0x2e')];if(!_0xddc8b2[_0xd6b3('0x28')]['hasOwnProperty']('nolimit')){_0x4c791e['limit']=qs[_0xd6b3('0x31')](_0xddc8b2[_0xd6b3('0x28')][_0xd6b3('0x31')]);_0x4c791e[_0xd6b3('0x15')]=qs[_0xd6b3('0x15')](_0xddc8b2['query'][_0xd6b3('0x15')]);}return _0x3d340b[_0xd6b3('0x4c')](_0x4c791e);}})[_0xd6b3('0x3c')](function(_0x5f174f){if(_0x5f174f){return _0x5f174f?{'count':_0x3072d1,'rows':_0x5f174f}:null;}})[_0xd6b3('0x3c')](respondWithResult(_0x47def,null))[_0xd6b3('0x3e')](handleError(_0x47def,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 3140eda..611b87a 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 _0x9ca4=['Automation','tools_automations','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0xc270de,_0x589127){var _0x3f9868=function(_0x2ae065){while(--_0x2ae065){_0xc270de['push'](_0xc270de['shift']());}};_0x3f9868(++_0x589127);}(_0x9ca4,0xde));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x49ca('0x0'));var logger=require(_0x49ca('0x1'))('api');var moment=require(_0x49ca('0x2'));var BPromise=require(_0x49ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x49ca('0x4'));var config=require(_0x49ca('0x5'));var attributes=require(_0x49ca('0x6'));module[_0x49ca('0x7')]=function(_0x51721b,_0xdf1140){return _0x51721b[_0x49ca('0x8')](_0x49ca('0x9'),attributes,{'tableName':_0x49ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25f3=['define','Automation','api','moment','bluebird','../../config/environment','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x25f3,0x167));var _0x325f=function(_0x256e19,_0x6e625){_0x256e19=_0x256e19-0x0;var _0x4a2bf8=_0x25f3[_0x256e19];return _0x4a2bf8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x325f('0x0'));var moment=require(_0x325f('0x1'));var BPromise=require(_0x325f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x325f('0x3'));var attributes=require('./automation.attributes');module[_0x325f('0x4')]=function(_0x5080bb,_0x380e93){return _0x5080bb[_0x325f('0x5')](_0x325f('0x6'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 84fa2d9..79df4f8 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 _0xa064=['stringify','error','message','Automation,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x249206,_0x4526fb){var _0xa1c48c=function(_0x3ae129){while(--_0x3ae129){_0x249206['push'](_0x249206['shift']());}};_0xa1c48c(++_0x4526fb);}(_0xa064,0x192));var _0x4a06=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0xa064[_0x3dc089];return _0x34d9d3;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require(_0x4a06('0x2'));var BPromise=require(_0x4a06('0x3'));var rs=require(_0x4a06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a06('0x5'));var logger=require('../../config/logger')(_0x4a06('0x6'));var config=require(_0x4a06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a06('0x8')][_0x4a06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d4e3,_0x3b01cc,_0x454574){return new BPromise(function(_0x4c966b,_0x5e3342){return client[_0x4a06('0xa')](_0x55d4e3,_0x454574)[_0x4a06('0xb')](function(_0x3a8db5){logger[_0x4a06('0xc')]('Automation,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));logger[_0x4a06('0xe')](_0x4a06('0xf'),_0x3b01cc,_0x4a06('0xd'),JSON[_0x4a06('0x10')](_0x3a8db5));if(_0x3a8db5[_0x4a06('0x11')]){if(_0x3a8db5[_0x4a06('0x11')]['code']===0x1f4){logger[_0x4a06('0x11')]('Automation,\x20%s,\x20%s',_0x3b01cc,_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);return _0x5e3342(_0x3a8db5[_0x4a06('0x11')]['message']);}logger[_0x4a06('0x11')](_0x4a06('0x13'),_0x3b01cc,_0x3a8db5[_0x4a06('0x11')]['message']);return _0x4c966b(_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);}else{logger[_0x4a06('0xc')]('Automation,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));_0x4c966b(_0x3a8db5[_0x4a06('0x14')][_0x4a06('0x12')]);}})[_0x4a06('0x15')](function(_0x15b067){logger['error'](_0x4a06('0x13'),_0x3b01cc,_0x15b067);_0x5e3342(_0x15b067);});});} \ No newline at end of file +var _0x4329=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c642a,_0x35223b){var _0x9db7d6=function(_0x4d0d8d){while(--_0x4d0d8d){_0x3c642a['push'](_0x3c642a['shift']());}};_0x9db7d6(++_0x35223b);}(_0x4329,0x13b));var _0x9432=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4329[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var BPromise=require(_0x9432('0x3'));var rs=require(_0x9432('0x4'));var fs=require('fs');var Redis=require(_0x9432('0x5'));var db=require(_0x9432('0x6'))['db'];var utils=require(_0x9432('0x7'));var logger=require(_0x9432('0x8'))(_0x9432('0x9'));var config=require(_0x9432('0xa'));var jayson=require(_0x9432('0xb'));var client=jayson[_0x9432('0xc')][_0x9432('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5568ad,_0x376967,_0x5346c3){return new BPromise(function(_0x10509f,_0x4563c4){return client['request'](_0x5568ad,_0x5346c3)[_0x9432('0xe')](function(_0x2b06c7){logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,_0x9432('0x11'));logger['debug'](_0x9432('0x12'),_0x376967,_0x9432('0x11'),JSON['stringify'](_0x2b06c7));if(_0x2b06c7['error']){if(_0x2b06c7[_0x9432('0x13')][_0x9432('0x14')]===0x1f4){logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x4563c4(_0x2b06c7[_0x9432('0x13')][_0x9432('0x15')]);}logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x10509f(_0x2b06c7[_0x9432('0x13')]['message']);}else{logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,'request\x20sent');_0x10509f(_0x2b06c7[_0x9432('0x16')][_0x9432('0x15')]);}})['catch'](function(_0x5c4360){logger['error']('Automation,\x20%s,\x20%s',_0x376967,_0x5c4360);_0x4563c4(_0x5c4360);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ca4c645..5fbb880 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 _0xd1b3=['/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions'];(function(_0x450b00,_0x1cc659){var _0x219b54=function(_0x46fd91){while(--_0x46fd91){_0x450b00['push'](_0x450b00['shift']());}};_0x219b54(++_0x1cc659);}(_0xd1b3,0xec));var _0x3d1b=function(_0x203c83,_0x3441aa){_0x203c83=_0x203c83-0x0;var _0x127ee4=_0xd1b3[_0x203c83];return _0x127ee4;};'use strict';var multer=require(_0x3d1b('0x0'));var util=require(_0x3d1b('0x1'));var path=require(_0x3d1b('0x2'));var timeout=require(_0x3d1b('0x3'));var express=require(_0x3d1b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d1b('0x5'));var config=require(_0x3d1b('0x6'));var controller=require(_0x3d1b('0x7'));router[_0x3d1b('0x8')]('/',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xa')]);router[_0x3d1b('0x8')](_0x3d1b('0xb'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xc')]);router[_0x3d1b('0x8')]('/:id/conditions',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xd')]);router[_0x3d1b('0x8')](_0x3d1b('0xe'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xf')]);router[_0x3d1b('0x10')]('/',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0x11')]);router[_0x3d1b('0x10')](_0x3d1b('0x12'),auth['isAuthenticated'](),controller[_0x3d1b('0x13')]);router[_0x3d1b('0x10')](_0x3d1b('0xe'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0x14')]);router['put'](_0x3d1b('0xb'),auth['isAuthenticated'](),controller[_0x3d1b('0x15')]);router[_0x3d1b('0x16')]('/:id',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0x17')]);module[_0x3d1b('0x18')]=router; \ No newline at end of file +var _0xf712=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions','put','/:id'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0xf712,0x19c));var _0x2f71=function(_0x6d7a2b,_0x56bff4){_0x6d7a2b=_0x6d7a2b-0x0;var _0x3e8361=_0xf712[_0x6d7a2b];return _0x3e8361;};'use strict';var multer=require(_0x2f71('0x0'));var util=require('util');var path=require(_0x2f71('0x1'));var timeout=require(_0x2f71('0x2'));var express=require(_0x2f71('0x3'));var router=express[_0x2f71('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2f71('0x5'));var interaction=require(_0x2f71('0x6'));var config=require(_0x2f71('0x7'));var controller=require(_0x2f71('0x8'));router[_0x2f71('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f71('0xa')]);router['get']('/:id',auth[_0x2f71('0xb')](),controller['show']);router[_0x2f71('0x9')](_0x2f71('0xc'),auth[_0x2f71('0xb')](),controller[_0x2f71('0xd')]);router[_0x2f71('0x9')](_0x2f71('0xe'),auth[_0x2f71('0xb')](),controller[_0x2f71('0xf')]);router['post']('/',auth[_0x2f71('0xb')](),controller[_0x2f71('0x10')]);router['post'](_0x2f71('0xc'),auth[_0x2f71('0xb')](),controller[_0x2f71('0x11')]);router['post']('/:id/actions',auth[_0x2f71('0xb')](),controller['addActions']);router[_0x2f71('0x12')](_0x2f71('0x13'),auth[_0x2f71('0xb')](),controller[_0x2f71('0x14')]);router[_0x2f71('0x15')](_0x2f71('0x13'),auth[_0x2f71('0xb')](),controller[_0x2f71('0x16')]);module[_0x2f71('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3f52752..0077fdb 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 _0xca50=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','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','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x4e5cc,_0x4a79cd){var _0x252a7d=function(_0x1ca859){while(--_0x1ca859){_0x4e5cc['push'](_0x4e5cc['shift']());}};_0x252a7d(++_0x4a79cd);}(_0xca50,0xaf));var _0x0ca5=function(_0x55b1c3,_0x24c819){_0x55b1c3=_0x55b1c3-0x0;var _0x5f519d=_0xca50[_0x55b1c3];return _0x5f519d;};'use strict';var Sequelize=require(_0x0ca5('0x0'));module[_0x0ca5('0x1')]={'name':{'type':Sequelize[_0x0ca5('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0ca5('0x3')),'allowNull':![],'defaultValue':_0x0ca5('0x3')},'description':{'type':Sequelize[_0x0ca5('0x2')]},'active':{'type':Sequelize[_0x0ca5('0x4')],'defaultValue':0x0,'comment':_0x0ca5('0x5')},'limitCalls':{'type':Sequelize[_0x0ca5('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0ca5('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ca5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ca5('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ca5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0ca5('0x6')](0x5)[_0x0ca5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0ca5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'defaultValue':0x3,'comment':_0x0ca5('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0ca5('0x6')](0x5)[_0x0ca5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ca5('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ca5('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ca5('0x2')],'defaultValue':_0x0ca5('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0ca5('0x11'),'never',_0x0ca5('0x12')),'defaultValue':_0x0ca5('0x11')},'dialAMDActive':{'type':Sequelize[_0x0ca5('0x4')],'defaultValue':0x0,'comment':_0x0ca5('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ca5('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0ca5('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ca5('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ca5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ca5('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0ca5('0x6')](0x9)[_0x0ca5('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ca5('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0ca5('0x6')](0x5)[_0x0ca5('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0ca5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ca5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ca5('0x1a')](_0x0ca5('0x1b'),_0x0ca5('0x1c')),'defaultValue':_0x0ca5('0x1b')},'dialPrefix':{'type':Sequelize[_0x0ca5('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ca5('0x1d')},'dialCutDigit':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ca5('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0ca5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0ca5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ca5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ca5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ca5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0ca5('0x6')](0x5)[_0x0ca5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0ca5('0x6')](0x3)[_0x0ca5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ca5('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ca5('0x28')}}; \ No newline at end of file +var _0x5990=['DESC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#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(_0x2c16ab,_0xaa3f47){var _0x50d50c=function(_0x4bd914){while(--_0x4bd914){_0x2c16ab['push'](_0x2c16ab['shift']());}};_0x50d50c(++_0xaa3f47);}(_0x5990,0x1a1));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0599('0x0'));module[_0x0599('0x1')]={'name':{'type':Sequelize[_0x0599('0x2')],'unique':_0x0599('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x0599('0x2')]},'active':{'type':Sequelize[_0x0599('0x4')],'defaultValue':0x0,'comment':_0x0599('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x0599('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0599('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0599('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0599('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0599('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0599('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0599('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0599('0xd')},'dialTimezone':{'type':Sequelize[_0x0599('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0599('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0599('0xe')](_0x0599('0xf'),_0x0599('0x10'),_0x0599('0x11')),'defaultValue':_0x0599('0xf')},'dialAMDActive':{'type':Sequelize[_0x0599('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0599('0x8')](0x9)[_0x0599('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0599('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x0599('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0599('0x8')](0x9)[_0x0599('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0599('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0599('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0599('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0599('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0599('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0599('0x8')](0x9)[_0x0599('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0599('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0599('0x8')](0x9)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0599('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0599('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0599('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0599('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0599('0xe')](_0x0599('0x19'),'ASC'),'defaultValue':_0x0599('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0x1a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0599('0x1b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0599('0x8')](0x3)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0599('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0x1e')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)[_0x0599('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0599('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0599('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0599('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0599('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 690eecb..bdfad0a 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 _0x76d2=['Campaign','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','cm_hopper','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','destroy','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map'];(function(_0x115e5b,_0x503d9f){var _0x468051=function(_0xa176af){while(--_0xa176af){_0x115e5b['push'](_0x115e5b['shift']());}};_0x468051(++_0x503d9f);}(_0x76d2,0xf8));var _0x276d=function(_0x15c07d,_0x12ad4c){_0x15c07d=_0x15c07d-0x0;var _0x159156=_0x76d2[_0x15c07d];return _0x159156;};'use strict';var emlformat=require(_0x276d('0x0'));var rimraf=require(_0x276d('0x1'));var zipdir=require(_0x276d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x276d('0x3'));var moment=require(_0x276d('0x4'));var BPromise=require(_0x276d('0x5'));var Mustache=require(_0x276d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x276d('0x7'));var csv=require(_0x276d('0x8'));var ejs=require(_0x276d('0x9'));var fs=require('fs');var fs_extra=require(_0x276d('0xa'));var _=require(_0x276d('0xb'));var squel=require(_0x276d('0xc'));var crypto=require(_0x276d('0xd'));var jsforce=require(_0x276d('0xe'));var deskjs=require(_0x276d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x276d('0x10'));var Redis=require(_0x276d('0x11'));var authService=require(_0x276d('0x12'));var qs=require(_0x276d('0x13'));var as=require(_0x276d('0x14'));var hardwareService=require(_0x276d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x276d('0x16'));var config=require(_0x276d('0x17'));var licenseUtil=require(_0x276d('0x18'));var db=require(_0x276d('0x19'))['db'];function respondWithStatusCode(_0x2e107c,_0x2e4374){_0x2e4374=_0x2e4374||0xcc;return function(_0x4b9f5f){if(_0x4b9f5f){return _0x2e107c['sendStatus'](_0x2e4374);}return _0x2e107c[_0x276d('0x1a')](_0x2e4374)[_0x276d('0x1b')]();};}function respondWithResult(_0x3bdd13,_0x377540){_0x377540=_0x377540||0xc8;return function(_0x3166a2){if(_0x3166a2){return _0x3bdd13[_0x276d('0x1a')](_0x377540)[_0x276d('0x1c')](_0x3166a2);}};}function respondWithFilteredResult(_0x2c309f,_0x5b23b7){return function(_0x2165c6){if(_0x2165c6){var _0x43efeb=typeof _0x5b23b7['offset']==='undefined'&&typeof _0x5b23b7[_0x276d('0x1d')]===_0x276d('0x1e');var _0x4d9859=_0x2165c6[_0x276d('0x1f')];var _0x5d96cb=_0x43efeb?0x0:_0x5b23b7['offset'];var _0xb75b36=_0x43efeb?_0x2165c6['count']:_0x5b23b7[_0x276d('0x20')]+_0x5b23b7[_0x276d('0x1d')];var _0x42d335;if(_0xb75b36>=_0x4d9859){_0xb75b36=_0x4d9859;_0x42d335=0xc8;}else{_0x42d335=0xce;}_0x2c309f[_0x276d('0x1a')](_0x42d335);return _0x2c309f['set'](_0x276d('0x21'),_0x5d96cb+'-'+_0xb75b36+'/'+_0x4d9859)[_0x276d('0x1c')](_0x2165c6);}return null;};}function patchUpdates(_0x54565b){return function(_0x5e8fee){try{jsonpatch[_0x276d('0x22')](_0x5e8fee,_0x54565b,!![]);}catch(_0xead902){return BPromise['reject'](_0xead902);}return _0x5e8fee[_0x276d('0x23')]();};}function saveUpdates(_0x1f3545,_0x57d4b7){return function(_0x284160){if(_0x284160){return _0x284160['update'](_0x1f3545)[_0x276d('0x24')](function(_0x152195){return _0x152195;});}return null;};}function removeEntity(_0x5f0561,_0x476671){return function(_0x3edb3b){if(_0x3edb3b){return _0x3edb3b['destroy']()['then'](function(){var _0x991d5d=_0x3edb3b[_0x276d('0x25')]({'plain':!![]});var _0x121e75=_0x276d('0x26');return db[_0x276d('0x27')]['destroy']({'where':{'type':_0x121e75,'resourceId':_0x991d5d['id']}})[_0x276d('0x24')](function(){return _0x3edb3b;});})['then'](function(){_0x5f0561[_0x276d('0x1a')](0xcc)[_0x276d('0x1b')]();});}};}function handleEntityNotFound(_0x54c37c,_0xaa77c7){return function(_0x596248){if(!_0x596248){_0x54c37c['sendStatus'](0x194);}return _0x596248;};}function handleError(_0x5dec41,_0x235509){_0x235509=_0x235509||0x1f4;return function(_0x3226f5){logger[_0x276d('0x28')](_0x3226f5[_0x276d('0x29')]);if(_0x3226f5['name']){delete _0x3226f5[_0x276d('0x2a')];}_0x5dec41[_0x276d('0x1a')](_0x235509)[_0x276d('0x2b')](_0x3226f5);};}exports[_0x276d('0x2c')]=function(_0x29755c,_0x251135){var _0x1102f7={},_0x4b9966={},_0x168406={'count':0x0,'rows':[]};var _0x3fb13b=_[_0x276d('0x2d')](db[_0x276d('0x2e')][_0x276d('0x2f')],function(_0x335372){return{'name':_0x335372[_0x276d('0x30')],'type':_0x335372['type'][_0x276d('0x31')]};});_0x4b9966[_0x276d('0x32')]=_[_0x276d('0x2d')](_0x3fb13b,_0x276d('0x2a'));_0x4b9966['query']=_[_0x276d('0x33')](_0x29755c['query']);_0x4b9966[_0x276d('0x34')]=_[_0x276d('0x35')](_0x4b9966[_0x276d('0x32')],_0x4b9966[_0x276d('0x36')]);_0x1102f7[_0x276d('0x37')]=_[_0x276d('0x35')](_0x4b9966[_0x276d('0x32')],qs[_0x276d('0x38')](_0x29755c['query']['fields']));_0x1102f7[_0x276d('0x37')]=_0x1102f7['attributes'][_0x276d('0x39')]?_0x1102f7[_0x276d('0x37')]:_0x4b9966[_0x276d('0x32')];if(!_0x29755c[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x1102f7[_0x276d('0x1d')]=qs['limit'](_0x29755c['query'][_0x276d('0x1d')]);_0x1102f7[_0x276d('0x20')]=qs['offset'](_0x29755c['query'][_0x276d('0x20')]);}_0x1102f7[_0x276d('0x3c')]=qs['sort'](_0x29755c[_0x276d('0x36')][_0x276d('0x3d')]);_0x1102f7[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x29755c[_0x276d('0x36')],_0x4b9966['filters']),_0x3fb13b);if(_0x29755c[_0x276d('0x36')][_0x276d('0x40')]){_0x1102f7['where']=_['merge'](_0x1102f7['where'],{'$or':_[_0x276d('0x2d')](_0x3fb13b,function(_0x4b9c99){if(_0x4b9c99['type']!=='VIRTUAL'){var _0x1390fa={};_0x1390fa[_0x4b9c99[_0x276d('0x2a')]]={'$like':'%'+_0x29755c[_0x276d('0x36')][_0x276d('0x40')]+'%'};return _0x1390fa;}})});}_0x1102f7=_[_0x276d('0x41')]({},_0x1102f7,_0x29755c[_0x276d('0x42')]);var _0xb5c0c7={'where':_0x1102f7[_0x276d('0x3e')]};return db[_0x276d('0x2e')][_0x276d('0x1f')](_0xb5c0c7)[_0x276d('0x24')](function(_0x117f0f){_0x168406[_0x276d('0x1f')]=_0x117f0f;if(_0x29755c[_0x276d('0x36')]['includeAll']){_0x1102f7[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x2e')][_0x276d('0x44')](_0x1102f7);})[_0x276d('0x24')](function(_0x8ef582){_0x168406[_0x276d('0x45')]=_0x8ef582;return _0x168406;})[_0x276d('0x24')](respondWithFilteredResult(_0x251135,_0x1102f7))[_0x276d('0x46')](handleError(_0x251135,null));};exports[_0x276d('0x47')]=function(_0x5d780e,_0x32513e){var _0x3173a4={'raw':![],'where':{'id':_0x5d780e[_0x276d('0x48')]['id']}},_0x318402={};_0x318402['model']=_[_0x276d('0x33')](db[_0x276d('0x2e')][_0x276d('0x2f')]);_0x318402[_0x276d('0x36')]=_[_0x276d('0x33')](_0x5d780e[_0x276d('0x36')]);_0x318402['filters']=_[_0x276d('0x35')](_0x318402['model'],_0x318402[_0x276d('0x36')]);_0x3173a4[_0x276d('0x37')]=_['intersection'](_0x318402[_0x276d('0x32')],qs[_0x276d('0x38')](_0x5d780e['query'][_0x276d('0x38')]));_0x3173a4[_0x276d('0x37')]=_0x3173a4['attributes'][_0x276d('0x39')]?_0x3173a4[_0x276d('0x37')]:_0x318402[_0x276d('0x32')];if(_0x5d780e[_0x276d('0x36')][_0x276d('0x49')]){_0x3173a4['include']=[{'all':!![]}];}_0x3173a4=_[_0x276d('0x41')]({},_0x3173a4,_0x5d780e[_0x276d('0x42')]);return db[_0x276d('0x2e')]['find'](_0x3173a4)[_0x276d('0x24')](handleEntityNotFound(_0x32513e,null))[_0x276d('0x24')](respondWithResult(_0x32513e,null))[_0x276d('0x46')](handleError(_0x32513e,null));};exports['create']=function(_0x28659a,_0x1642d7){return db[_0x276d('0x2e')][_0x276d('0x4a')](_0x28659a['body'],{})['then'](function(_0x44f825){var _0x27ed2a=_0x28659a[_0x276d('0x4b')][_0x276d('0x25')]({'plain':!![]});if(!_0x27ed2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27ed2a[_0x276d('0x4c')]==='user'){var _0x5d07e1=_0x44f825['get']({'plain':!![]});var _0x525c45=_0x276d('0x26');return db[_0x276d('0x4d')][_0x276d('0x4e')]({'where':{'name':_0x525c45,'userProfileId':_0x27ed2a['userProfileId']},'raw':!![]})['then'](function(_0x50b77e){if(_0x50b77e&&_0x50b77e[_0x276d('0x4f')]===0x0){return db[_0x276d('0x27')][_0x276d('0x4a')]({'name':_0x5d07e1[_0x276d('0x2a')],'resourceId':_0x5d07e1['id'],'type':_0x50b77e['name'],'sectionId':_0x50b77e['id']},{})['then'](function(){return _0x44f825;});}else{return _0x44f825;}})['catch'](function(_0x21d079){logger[_0x276d('0x28')](_0x276d('0x50'),_0x21d079);throw _0x21d079;});}return _0x44f825;})[_0x276d('0x24')](respondWithResult(_0x1642d7,0xc9))['catch'](handleError(_0x1642d7,null));};exports[_0x276d('0x51')]=function(_0x2be3ef,_0x3298d1){var _0x3702e5={'where':{'id':_0x2be3ef[_0x276d('0x48')]['id']}},_0x2d2373={};_0x2d2373[_0x276d('0x32')]=_[_0x276d('0x33')](db['Campaign']['rawAttributes']);_0x3702e5[_0x276d('0x37')]=_['intersection'](_0x2d2373[_0x276d('0x32')],qs[_0x276d('0x38')](_0x2be3ef[_0x276d('0x36')][_0x276d('0x38')]));_0x3702e5[_0x276d('0x37')]=_0x3702e5['attributes'][_0x276d('0x39')]?_0x3702e5[_0x276d('0x37')]:_0x2d2373[_0x276d('0x32')];if(_0x2be3ef[_0x276d('0x36')][_0x276d('0x49')]){_0x3702e5['include']=[{'all':!![]}];}_0x3702e5=_[_0x276d('0x41')]({},_0x3702e5,_0x2be3ef[_0x276d('0x42')]);return db['Campaign'][_0x276d('0x4e')](_0x3702e5)[_0x276d('0x24')](handleEntityNotFound(_0x3298d1,null))['then'](function(_0x347f21){if(_0x347f21){var _0x22cf48=_0x347f21[_0x276d('0x25')]({'plain':!![]});_0x22cf48=qs[_0x276d('0x52')](_0x22cf48,['id',_0x276d('0x53'),_0x276d('0x54')]);_0x2be3ef[_0x276d('0x55')]=_[_0x276d('0x52')](_0x2be3ef[_0x276d('0x55')],['id',_0x276d('0x53'),_0x276d('0x54')]);return db[_0x276d('0x2e')][_0x276d('0x4a')](_['merge'](_0x22cf48,_0x2be3ef[_0x276d('0x55')]),{'include':_0x2be3ef[_0x276d('0x36')][_0x276d('0x49')]?[{'all':!![]}]:undefined})[_0x276d('0x24')](function(_0x4876f4){var _0x51d8f2=_0x2be3ef['user'][_0x276d('0x25')]({'plain':!![]});if(!_0x51d8f2)throw new Error(_0x276d('0x56'));if(_0x51d8f2[_0x276d('0x4c')]===_0x276d('0x4b')){var _0x48001f=_0x4876f4[_0x276d('0x25')]({'plain':!![]});var _0x3fd2f5=_0x276d('0x26');return db[_0x276d('0x4d')][_0x276d('0x4e')]({'where':{'name':_0x3fd2f5,'userProfileId':_0x51d8f2[_0x276d('0x57')]},'raw':!![]})[_0x276d('0x24')](function(_0x357a8c){if(_0x357a8c&&_0x357a8c[_0x276d('0x4f')]===0x0){return db[_0x276d('0x27')][_0x276d('0x4a')]({'name':_0x48001f[_0x276d('0x2a')],'resourceId':_0x48001f['id'],'type':_0x357a8c[_0x276d('0x2a')],'sectionId':_0x357a8c['id']},{})[_0x276d('0x24')](function(){return _0x4876f4;});}else{return _0x4876f4;}})['catch'](function(_0x3653ab){logger[_0x276d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3653ab);throw _0x3653ab;});}return _0x4876f4;});}})[_0x276d('0x24')](respondWithResult(_0x3298d1,0xc9))[_0x276d('0x46')](handleError(_0x3298d1,null));};exports[_0x276d('0x58')]=function(_0x5db132,_0xc5446b){if(_0x5db132[_0x276d('0x55')]['id']){delete _0x5db132[_0x276d('0x55')]['id'];}return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x5db132[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0xc5446b,null))[_0x276d('0x24')](saveUpdates(_0x5db132['body'],null))[_0x276d('0x24')](respondWithResult(_0xc5446b,null))['catch'](handleError(_0xc5446b,null));};exports['destroy']=function(_0x1dcdce,_0x2dd008){return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x1dcdce['params']['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x2dd008,null))[_0x276d('0x24')](removeEntity(_0x2dd008,null))[_0x276d('0x46')](handleError(_0x2dd008,null));};exports[_0x276d('0x59')]=function(_0x3e314a,_0x62fa2a,_0x156fac){var _0x2763bc={'raw':!![],'where':{}};var _0x3d2220={};var _0x196257={'count':0x0,'rows':[]};return db[_0x276d('0x2e')]['findOne']({'where':{'id':_0x3e314a[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x62fa2a,null))[_0x276d('0x24')](function(_0x34d77c){if(_0x34d77c){_0x3d2220[_0x276d('0x32')]=_[_0x276d('0x33')](db[_0x276d('0x5a')][_0x276d('0x2f')]);_0x3d2220[_0x276d('0x36')]=_['keys'](_0x3e314a[_0x276d('0x36')]);_0x3d2220[_0x276d('0x34')]=_[_0x276d('0x35')](_0x3d2220[_0x276d('0x32')],_0x3d2220[_0x276d('0x36')]);_0x2763bc[_0x276d('0x37')]=_['intersection'](_0x3d2220[_0x276d('0x32')],qs[_0x276d('0x38')](_0x3e314a[_0x276d('0x36')][_0x276d('0x38')]));_0x2763bc[_0x276d('0x37')]=_0x2763bc['attributes'][_0x276d('0x39')]?_0x2763bc['attributes']:_0x3d2220['model'];if(!_0x3e314a[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x2763bc[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x3e314a[_0x276d('0x36')][_0x276d('0x1d')]);_0x2763bc[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x3e314a[_0x276d('0x36')][_0x276d('0x20')]);}_0x2763bc[_0x276d('0x3c')]=qs[_0x276d('0x3d')](_0x3e314a['query'][_0x276d('0x3d')]);_0x2763bc[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x3e314a[_0x276d('0x36')],_0x3d2220[_0x276d('0x34')]));_0x2763bc[_0x276d('0x3e')][_0x276d('0x5b')]=_0x34d77c['id'];if(_0x3e314a['query']['filter']){_0x2763bc[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x2763bc[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x2763bc[_0x276d('0x37')],function(_0x49ca7a){var _0x5265e8={};_0x5265e8[_0x49ca7a]={'$like':'%'+_0x3e314a[_0x276d('0x36')]['filter']+'%'};return _0x5265e8;})});}_0x2763bc=_[_0x276d('0x41')]({},_0x2763bc,_0x3e314a[_0x276d('0x42')]);return db[_0x276d('0x5a')]['count']({'where':_0x2763bc[_0x276d('0x3e')]})['then'](function(_0x2bfb5d){_0x196257['count']=_0x2bfb5d;if(_0x3e314a['query']['includeAll']){_0x2763bc[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x5a')][_0x276d('0x44')](_0x2763bc);})[_0x276d('0x24')](function(_0x1a1957){_0x196257[_0x276d('0x45')]=_0x1a1957;return _0x196257;});}})[_0x276d('0x24')](respondWithFilteredResult(_0x62fa2a,_0x2763bc))[_0x276d('0x46')](handleError(_0x62fa2a,null));};exports[_0x276d('0x5c')]=function(_0x5a1524,_0x35252d,_0x5c839b){var _0x2ae16a={'raw':!![],'where':{}};var _0xc8ebb6={};var _0x326752={'count':0x0,'rows':[]};return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x5a1524['params']['id']}})['then'](handleEntityNotFound(_0x35252d,null))[_0x276d('0x24')](function(_0x56e6d8){if(_0x56e6d8){_0xc8ebb6[_0x276d('0x32')]=_[_0x276d('0x33')](db[_0x276d('0x5e')][_0x276d('0x2f')]);_0xc8ebb6['query']=_['keys'](_0x5a1524[_0x276d('0x36')]);_0xc8ebb6['filters']=_[_0x276d('0x35')](_0xc8ebb6[_0x276d('0x32')],_0xc8ebb6['query']);_0x2ae16a[_0x276d('0x37')]=_['intersection'](_0xc8ebb6['model'],qs[_0x276d('0x38')](_0x5a1524['query'][_0x276d('0x38')]));_0x2ae16a[_0x276d('0x37')]=_0x2ae16a['attributes'][_0x276d('0x39')]?_0x2ae16a[_0x276d('0x37')]:_0xc8ebb6['model'];if(!_0x5a1524[_0x276d('0x36')]['hasOwnProperty'](_0x276d('0x3b'))){_0x2ae16a[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x5a1524[_0x276d('0x36')][_0x276d('0x1d')]);_0x2ae16a['offset']=qs['offset'](_0x5a1524[_0x276d('0x36')][_0x276d('0x20')]);}_0x2ae16a[_0x276d('0x3c')]=qs[_0x276d('0x3d')](_0x5a1524[_0x276d('0x36')][_0x276d('0x3d')]);_0x2ae16a[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x5a1524[_0x276d('0x36')],_0xc8ebb6[_0x276d('0x34')]));_0x2ae16a[_0x276d('0x3e')]['CampaignId']=_0x56e6d8['id'];if(_0x5a1524['query'][_0x276d('0x40')]){_0x2ae16a[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x2ae16a['where'],{'$or':_['map'](_0x2ae16a[_0x276d('0x37')],function(_0x3ae14d){var _0x577857={};_0x577857[_0x3ae14d]={'$like':'%'+_0x5a1524[_0x276d('0x36')]['filter']+'%'};return _0x577857;})});}_0x2ae16a=_[_0x276d('0x41')]({},_0x2ae16a,_0x5a1524[_0x276d('0x42')]);return db['CmHopperHistory'][_0x276d('0x1f')]({'where':_0x2ae16a[_0x276d('0x3e')]})[_0x276d('0x24')](function(_0x2a4acf){_0x326752[_0x276d('0x1f')]=_0x2a4acf;if(_0x5a1524[_0x276d('0x36')][_0x276d('0x49')]){_0x2ae16a[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x5e')][_0x276d('0x44')](_0x2ae16a);})[_0x276d('0x24')](function(_0x43ec7f){_0x326752[_0x276d('0x45')]=_0x43ec7f;return _0x326752;});}})[_0x276d('0x24')](respondWithFilteredResult(_0x35252d,_0x2ae16a))[_0x276d('0x46')](handleError(_0x35252d,null));};exports[_0x276d('0x5f')]=function(_0x4b611d,_0xd47cb2,_0x582207){var _0x337a31={'raw':!![],'where':{}};var _0xd4729d={};var _0x32e162={'count':0x0,'rows':[]};return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x4b611d['params']['id']}})['then'](handleEntityNotFound(_0xd47cb2,null))['then'](function(_0x320c50){if(_0x320c50){_0xd4729d['model']=_[_0x276d('0x33')](db[_0x276d('0x60')][_0x276d('0x2f')]);_0xd4729d[_0x276d('0x36')]=_[_0x276d('0x33')](_0x4b611d[_0x276d('0x36')]);_0xd4729d['filters']=_[_0x276d('0x35')](_0xd4729d[_0x276d('0x32')],_0xd4729d[_0x276d('0x36')]);_0x337a31[_0x276d('0x37')]=_[_0x276d('0x35')](_0xd4729d['model'],qs[_0x276d('0x38')](_0x4b611d[_0x276d('0x36')]['fields']));_0x337a31[_0x276d('0x37')]=_0x337a31[_0x276d('0x37')][_0x276d('0x39')]?_0x337a31[_0x276d('0x37')]:_0xd4729d[_0x276d('0x32')];if(!_0x4b611d[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x337a31[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x4b611d['query']['limit']);_0x337a31[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x4b611d[_0x276d('0x36')]['offset']);}_0x337a31['order']=qs[_0x276d('0x3d')](_0x4b611d[_0x276d('0x36')][_0x276d('0x3d')]);_0x337a31[_0x276d('0x3e')]=qs[_0x276d('0x34')](_['pick'](_0x4b611d['query'],_0xd4729d['filters']));_0x337a31['where'][_0x276d('0x5b')]=_0x320c50['id'];if(_0x4b611d[_0x276d('0x36')]['filter']){_0x337a31[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x337a31[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x337a31[_0x276d('0x37')],function(_0x13a594){var _0x2d48f7={};_0x2d48f7[_0x13a594]={'$like':'%'+_0x4b611d['query'][_0x276d('0x40')]+'%'};return _0x2d48f7;})});}_0x337a31=_[_0x276d('0x41')]({},_0x337a31,_0x4b611d['options']);return db[_0x276d('0x60')][_0x276d('0x1f')]({'where':_0x337a31[_0x276d('0x3e')]})[_0x276d('0x24')](function(_0x2926de){_0x32e162['count']=_0x2926de;if(_0x4b611d[_0x276d('0x36')]['includeAll']){_0x337a31[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x60')][_0x276d('0x44')](_0x337a31);})['then'](function(_0x56f273){_0x32e162[_0x276d('0x45')]=_0x56f273;return _0x32e162;});}})[_0x276d('0x24')](respondWithFilteredResult(_0xd47cb2,_0x337a31))[_0x276d('0x46')](handleError(_0xd47cb2,null));};exports[_0x276d('0x61')]=function(_0x344608,_0x585eba,_0x5d261b){var _0x58ecdc={'raw':!![],'where':{}};var _0x2ac194={};var _0x5823ff={'count':0x0,'rows':[]};return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x344608['params']['id']}})['then'](handleEntityNotFound(_0x585eba,null))['then'](function(_0x11c1a5){if(_0x11c1a5){_0x2ac194[_0x276d('0x32')]=_['keys'](db[_0x276d('0x62')][_0x276d('0x2f')]);_0x2ac194[_0x276d('0x36')]=_[_0x276d('0x33')](_0x344608[_0x276d('0x36')]);_0x2ac194[_0x276d('0x34')]=_[_0x276d('0x35')](_0x2ac194[_0x276d('0x32')],_0x2ac194[_0x276d('0x36')]);_0x58ecdc[_0x276d('0x37')]=_[_0x276d('0x35')](_0x2ac194[_0x276d('0x32')],qs[_0x276d('0x38')](_0x344608[_0x276d('0x36')]['fields']));_0x58ecdc[_0x276d('0x37')]=_0x58ecdc[_0x276d('0x37')][_0x276d('0x39')]?_0x58ecdc[_0x276d('0x37')]:_0x2ac194[_0x276d('0x32')];if(!_0x344608[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x58ecdc['limit']=qs['limit'](_0x344608[_0x276d('0x36')][_0x276d('0x1d')]);_0x58ecdc[_0x276d('0x20')]=qs['offset'](_0x344608[_0x276d('0x36')]['offset']);}_0x58ecdc[_0x276d('0x3c')]=qs[_0x276d('0x3d')](_0x344608[_0x276d('0x36')]['sort']);_0x58ecdc[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x344608[_0x276d('0x36')],_0x2ac194[_0x276d('0x34')]));_0x58ecdc[_0x276d('0x3e')][_0x276d('0x5b')]=_0x11c1a5['id'];if(_0x344608['query'][_0x276d('0x40')]){_0x58ecdc[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x58ecdc[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x58ecdc[_0x276d('0x37')],function(_0x3e8a71){var _0x1e44df={};_0x1e44df[_0x3e8a71]={'$like':'%'+_0x344608[_0x276d('0x36')][_0x276d('0x40')]+'%'};return _0x1e44df;})});}_0x58ecdc=_[_0x276d('0x41')]({},_0x58ecdc,_0x344608[_0x276d('0x42')]);return db[_0x276d('0x62')]['count']({'where':_0x58ecdc['where']})[_0x276d('0x24')](function(_0x463c7a){_0x5823ff['count']=_0x463c7a;if(_0x344608['query'][_0x276d('0x49')]){_0x58ecdc['include']=[{'all':!![]}];}return db[_0x276d('0x62')][_0x276d('0x44')](_0x58ecdc);})[_0x276d('0x24')](function(_0x5cd43a){_0x5823ff[_0x276d('0x45')]=_0x5cd43a;return _0x5823ff;});}})[_0x276d('0x24')](respondWithFilteredResult(_0x585eba,_0x58ecdc))[_0x276d('0x46')](handleError(_0x585eba,null));};exports[_0x276d('0x63')]=function(_0x25d497,_0x2b630b,_0x3ed51e){var _0x46b542={};var _0xd70176={};var _0x42437a;var _0x472ab9;return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x25d497[_0x276d('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b630b,null))[_0x276d('0x24')](function(_0x1466fc){if(_0x1466fc){_0x42437a=_0x1466fc;_0xd70176[_0x276d('0x32')]=_[_0x276d('0x33')](db[_0x276d('0x64')][_0x276d('0x2f')]);_0xd70176[_0x276d('0x36')]=_[_0x276d('0x33')](_0x25d497[_0x276d('0x36')]);_0xd70176[_0x276d('0x34')]=_['intersection'](_0xd70176['model'],_0xd70176[_0x276d('0x36')]);_0x46b542['attributes']=_[_0x276d('0x35')](_0xd70176[_0x276d('0x32')],qs['fields'](_0x25d497[_0x276d('0x36')]['fields']));_0x46b542[_0x276d('0x37')]=_0x46b542[_0x276d('0x37')][_0x276d('0x39')]?_0x46b542['attributes']:_0xd70176[_0x276d('0x32')];_0x46b542[_0x276d('0x3c')]=qs['sort'](_0x25d497['query']['sort']);_0x46b542[_0x276d('0x3e')]=qs['filters'](_[_0x276d('0x3f')](_0x25d497['query'],_0xd70176['filters']));if(_0x25d497['query']['filter']){_0x46b542[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x46b542[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x46b542[_0x276d('0x37')],function(_0x2a112a){var _0xa76923={};_0xa76923[_0x2a112a]={'$like':'%'+_0x25d497[_0x276d('0x36')]['filter']+'%'};return _0xa76923;})});}_0x46b542=_['merge']({},_0x46b542,_0x25d497[_0x276d('0x42')]);return _0x42437a[_0x276d('0x63')](_0x46b542);}})['then'](function(_0x194abc){if(_0x194abc){_0x472ab9=_0x194abc[_0x276d('0x39')];if(!_0x25d497[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x46b542['limit']=qs[_0x276d('0x1d')](_0x25d497['query'][_0x276d('0x1d')]);_0x46b542[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x25d497[_0x276d('0x36')][_0x276d('0x20')]);}return _0x42437a[_0x276d('0x63')](_0x46b542);}})[_0x276d('0x24')](function(_0x48cdcf){if(_0x48cdcf){return _0x48cdcf?{'count':_0x472ab9,'rows':_0x48cdcf}:null;}})[_0x276d('0x24')](respondWithResult(_0x2b630b,null))['catch'](handleError(_0x2b630b,null));};exports[_0x276d('0x65')]=function(_0x2e74fe,_0x2f5c86,_0x182fc0){var _0x3d3935,_0x1c49a9;var _0x5157cd=[];var _0x18326f=moment()[_0x276d('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x276d('0x2e')]['find']({'where':{'id':_0x2e74fe[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x2f5c86,null))['then'](function(_0x497088){if(_0x497088){_0x1c49a9=_0x497088;return _0x497088['addLists'](_0x2e74fe[_0x276d('0x55')][_0x276d('0x67')],_['omit'](_0x2e74fe[_0x276d('0x55')],[_0x276d('0x67'),'id'])||{});}return null;})['spread'](function(_0x3f8add){var _0x1eaed3;var _0xfdbcc9;_0x3d3935=_0x3f8add||[];var _0x47ee70=[];if(_0x3f8add){for(var _0x5c3f62=0x0;_0x5c3f62<_0x3f8add['length'];_0x5c3f62+=0x1){var _0x2c4bd3=_0x3f8add[_0x5c3f62][_0x276d('0x25')]({'plain':!![]});_0x1c49a9[_0x276d('0x68')]=_0x2e74fe[_0x276d('0x55')][_0x276d('0x68')]?_0x2e74fe[_0x276d('0x55')][_0x276d('0x68')]:_0x1c49a9[_0x276d('0x68')];switch(_0x1c49a9[_0x276d('0x68')]){case _0x276d('0x69'):_0x1eaed3=squel[_0x276d('0x6a')]()[_0x276d('0x6b')]('cm_hopper')[_0x276d('0x6c')]([_0x276d('0x6d'),'scheduledAt',_0x276d('0x6e'),_0x276d('0x6f'),'CampaignId',_0x276d('0x53'),_0x276d('0x54')],squel[_0x276d('0x70')]()[_0x276d('0x71')](_0x276d('0x6d'),_0x276d('0x6d'))[_0x276d('0x71')](_0x276d('0x72'),'scheduledAt')[_0x276d('0x71')]('id',_0x276d('0x6e'))['field'](_0x2c4bd3[_0x276d('0x73')]['toString'](),_0x276d('0x6f'))[_0x276d('0x71')](_0x2e74fe[_0x276d('0x48')]['id'][_0x276d('0x74')](),'CampaignId')[_0x276d('0x71')]('\x27'+_0x18326f+'\x27',_0x276d('0x53'))['field']('\x27'+_0x18326f+'\x27',_0x276d('0x54'))['from'](_0x276d('0x75'))[_0x276d('0x3e')](_0x276d('0x76'))[_0x276d('0x3e')](_0x276d('0x77'),_0x2c4bd3[_0x276d('0x73')][_0x276d('0x74')]())[_0x276d('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x276d('0x78'),squel['select']()[_0x276d('0x71')](_0x276d('0x79'))[_0x276d('0x7a')](_0x276d('0x7b'))[_0x276d('0x3e')](_0x276d('0x7c'),_0x2e74fe['params']['id'][_0x276d('0x74')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x276d('0x70')]()['field'](_0x276d('0x7d'))['from']('cm_hopper')[_0x276d('0x3e')](_0x276d('0x7c'),_0x2e74fe['params']['id'][_0x276d('0x74')]())))[_0x276d('0x74')]();break;case _0x276d('0x7e'):_0x1eaed3=squel[_0x276d('0x6a')]()[_0x276d('0x6b')]('cm_hopper')['fromQuery']([_0x276d('0x6d'),_0x276d('0x7f'),_0x276d('0x6e'),_0x276d('0x6f'),'CampaignId',_0x276d('0x53'),_0x276d('0x54')],squel['select']()['field'](_0x276d('0x6d'),'phone')[_0x276d('0x71')](_0x276d('0x72'),_0x276d('0x7f'))[_0x276d('0x71')]('id',_0x276d('0x6e'))[_0x276d('0x71')](_0x2c4bd3['CmListId'][_0x276d('0x74')](),_0x276d('0x6f'))[_0x276d('0x71')](_0x2e74fe['params']['id'][_0x276d('0x74')](),'CampaignId')['field']('\x27'+_0x18326f+'\x27',_0x276d('0x53'))['field']('\x27'+_0x18326f+'\x27',_0x276d('0x54'))[_0x276d('0x7a')](_0x276d('0x75'))[_0x276d('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x276d('0x77'),_0x2c4bd3[_0x276d('0x73')]['toString']())[_0x276d('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x276d('0x70')]()['field'](_0x276d('0x7d'))[_0x276d('0x7a')]('cm_hopper')[_0x276d('0x3e')](_0x276d('0x7c'),_0x2e74fe[_0x276d('0x48')]['id'][_0x276d('0x74')]())))[_0x276d('0x74')]();break;default:_0x1eaed3=squel[_0x276d('0x6a')]()['into'](_0x276d('0x80'))[_0x276d('0x6c')](['phone','scheduledAt',_0x276d('0x6e'),_0x276d('0x6f'),_0x276d('0x5b'),_0x276d('0x53'),_0x276d('0x54')],squel[_0x276d('0x70')]()[_0x276d('0x71')]('phone',_0x276d('0x6d'))[_0x276d('0x71')](_0x276d('0x72'),_0x276d('0x7f'))['field']('id','ContactId')[_0x276d('0x71')](_0x2c4bd3['CmListId'][_0x276d('0x74')](),_0x276d('0x6f'))[_0x276d('0x71')](_0x2e74fe[_0x276d('0x48')]['id'][_0x276d('0x74')](),_0x276d('0x5b'))[_0x276d('0x71')]('\x27'+_0x18326f+'\x27',_0x276d('0x53'))[_0x276d('0x71')]('\x27'+_0x18326f+'\x27','updatedAt')[_0x276d('0x7a')](_0x276d('0x75'))[_0x276d('0x3e')](_0x276d('0x76'))[_0x276d('0x3e')](_0x276d('0x77'),_0x2c4bd3[_0x276d('0x73')][_0x276d('0x74')]())[_0x276d('0x3e')](_0x276d('0x81')))['toString']();}_0xfdbcc9=squel[_0x276d('0x6a')]()[_0x276d('0x6b')](_0x276d('0x82'))[_0x276d('0x6c')](['cmHopperId','scheduledAt','phone',_0x276d('0x83'),_0x276d('0x53'),_0x276d('0x54')],squel[_0x276d('0x70')]()[_0x276d('0x71')]('h.id','id')[_0x276d('0x71')]('NOW()',_0x276d('0x7f'))['field'](_0x276d('0x84'),'phone')['field'](_0x276d('0x85'),_0x276d('0x83'))[_0x276d('0x71')]('\x27'+_0x18326f+'\x27','createdAt')[_0x276d('0x71')]('\x27'+_0x18326f+'\x27',_0x276d('0x54'))[_0x276d('0x7a')]('cm_contact_has_items','ci')[_0x276d('0x86')](_0x276d('0x80'),'h',_0x276d('0x87'))['where']('h.ListId\x20=\x20?',_0x2c4bd3[_0x276d('0x73')][_0x276d('0x74')]())['where']('h.CampaignId=?',_0x2e74fe[_0x276d('0x48')]['id'][_0x276d('0x74')]())[_0x276d('0x3e')](_0x276d('0x88'),_0x18326f))[_0x276d('0x74')]();_0x47ee70[_0x276d('0x89')](db[_0x276d('0x8a')]['query'](_0x1eaed3));_0x5157cd[_0x276d('0x89')](db['sequelize'][_0x276d('0x36')](_0xfdbcc9));}return BPromise[_0x276d('0x8b')](_0x47ee70);}})[_0x276d('0x24')](function(){return BPromise[_0x276d('0x8b')](_0x5157cd);})[_0x276d('0x24')](function(){return _0x3d3935;})[_0x276d('0x24')](respondWithResult(_0x2f5c86,null))[_0x276d('0x46')](handleError(_0x2f5c86,null));};exports[_0x276d('0x8c')]=function(_0x4bce23,_0x1694f6,_0x420116){return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x4bce23[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x1694f6,null))[_0x276d('0x24')](function(_0x418b5d){if(_0x418b5d){return _0x418b5d[_0x276d('0x8c')](_0x4bce23[_0x276d('0x36')][_0x276d('0x67')]);}})[_0x276d('0x24')](function(_0x155ef3){if(_0x155ef3){return db[_0x276d('0x5a')][_0x276d('0x8d')]({'where':{'ListId':_0x4bce23[_0x276d('0x36')][_0x276d('0x67')],'CampaignId':_0x4bce23[_0x276d('0x48')]['id']}})[_0x276d('0x24')](function(){return _0x155ef3;});}})[_0x276d('0x24')](respondWithStatusCode(_0x1694f6,null))[_0x276d('0x46')](handleError(_0x1694f6,null));};exports['getBlackLists']=function(_0x2d78b7,_0x24ceb3,_0x386b55){var _0x4b3db8={};var _0x2d649c={};var _0x1163f8;var _0x49553f;return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x2d78b7['params']['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x24ceb3,null))[_0x276d('0x24')](function(_0x39ce5c){if(_0x39ce5c){_0x1163f8=_0x39ce5c;_0x2d649c['model']=_[_0x276d('0x33')](db[_0x276d('0x64')][_0x276d('0x2f')]);_0x2d649c[_0x276d('0x36')]=_[_0x276d('0x33')](_0x2d78b7['query']);_0x2d649c[_0x276d('0x34')]=_[_0x276d('0x35')](_0x2d649c[_0x276d('0x32')],_0x2d649c[_0x276d('0x36')]);_0x4b3db8[_0x276d('0x37')]=_[_0x276d('0x35')](_0x2d649c[_0x276d('0x32')],qs[_0x276d('0x38')](_0x2d78b7[_0x276d('0x36')][_0x276d('0x38')]));_0x4b3db8[_0x276d('0x37')]=_0x4b3db8[_0x276d('0x37')][_0x276d('0x39')]?_0x4b3db8['attributes']:_0x2d649c[_0x276d('0x32')];_0x4b3db8['order']=qs[_0x276d('0x3d')](_0x2d78b7[_0x276d('0x36')][_0x276d('0x3d')]);_0x4b3db8['where']=qs[_0x276d('0x34')](_['pick'](_0x2d78b7['query'],_0x2d649c[_0x276d('0x34')]));if(_0x2d78b7['query'][_0x276d('0x40')]){_0x4b3db8[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x4b3db8[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x4b3db8[_0x276d('0x37')],function(_0xfe7ec7){var _0x3689da={};_0x3689da[_0xfe7ec7]={'$like':'%'+_0x2d78b7[_0x276d('0x36')][_0x276d('0x40')]+'%'};return _0x3689da;})});}_0x4b3db8=_[_0x276d('0x41')]({},_0x4b3db8,_0x2d78b7[_0x276d('0x42')]);return _0x1163f8[_0x276d('0x8e')](_0x4b3db8);}})[_0x276d('0x24')](function(_0x133139){if(_0x133139){_0x49553f=_0x133139[_0x276d('0x39')];if(!_0x2d78b7[_0x276d('0x36')]['hasOwnProperty'](_0x276d('0x3b'))){_0x4b3db8[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x2d78b7[_0x276d('0x36')][_0x276d('0x1d')]);_0x4b3db8[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x2d78b7[_0x276d('0x36')]['offset']);}return _0x1163f8['getBlackLists'](_0x4b3db8);}})[_0x276d('0x24')](function(_0xac7aff){if(_0xac7aff){return _0xac7aff?{'count':_0x49553f,'rows':_0xac7aff}:null;}})[_0x276d('0x24')](respondWithResult(_0x24ceb3,null))['catch'](handleError(_0x24ceb3,null));};exports[_0x276d('0x8f')]=function(_0x5c6eda,_0x1dd8dd,_0x3e4df2){var _0x505ba4,_0x41e08c;var _0x1d2081=[];var _0x540bdc=moment()[_0x276d('0x66')](_0x276d('0x90'));return db[_0x276d('0x2e')]['find']({'where':{'id':_0x5c6eda[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x1dd8dd,null))[_0x276d('0x24')](function(_0x546134){if(_0x546134){_0x41e08c=_0x546134;return _0x546134[_0x276d('0x8f')](_0x5c6eda['body'][_0x276d('0x67')],_[_0x276d('0x52')](_0x5c6eda[_0x276d('0x55')],['ids','id'])||{});}return null;})[_0x276d('0x91')](function(_0x3dd699){var _0x1d64b3;var _0x35944c;_0x505ba4=_0x3dd699||[];var _0xed2e5f=[];if(_0x3dd699){for(var _0x4b0354=0x0;_0x4b0354<_0x3dd699['length'];_0x4b0354+=0x1){var _0x5e5df1=_0x3dd699[_0x4b0354][_0x276d('0x25')]({'plain':!![]});_0x1d64b3=squel[_0x276d('0x6a')]()['into'](_0x276d('0x92'))[_0x276d('0x6c')]([_0x276d('0x6d'),_0x276d('0x6e'),'ListId',_0x276d('0x5b'),_0x276d('0x53'),'updatedAt'],squel[_0x276d('0x70')]()[_0x276d('0x71')]('phone',_0x276d('0x6d'))[_0x276d('0x71')]('id',_0x276d('0x6e'))[_0x276d('0x71')](_0x5e5df1['CmListId'][_0x276d('0x74')](),_0x276d('0x6f'))['field'](_0x5c6eda['params']['id'][_0x276d('0x74')](),_0x276d('0x5b'))['field']('NOW()','createdAt')[_0x276d('0x71')](_0x276d('0x72'),_0x276d('0x54'))[_0x276d('0x7a')](_0x276d('0x75'))[_0x276d('0x3e')]('deletedAt\x20IS\x20NULL')[_0x276d('0x3e')](_0x276d('0x77'),_0x5e5df1['CmListId']['toString']())[_0x276d('0x3e')](_0x276d('0x81')))[_0x276d('0x74')]();_0xed2e5f[_0x276d('0x89')](db[_0x276d('0x8a')]['query'](_0x1d64b3));}return BPromise[_0x276d('0x8b')](_0xed2e5f);}})['then'](function(){return _0x505ba4;})[_0x276d('0x24')](respondWithResult(_0x1dd8dd,null))[_0x276d('0x46')](handleError(_0x1dd8dd,null));};exports['removeBlackLists']=function(_0x394524,_0x245298,_0x42a6f6){return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x394524[_0x276d('0x48')]['id']}})['then'](handleEntityNotFound(_0x245298,null))['then'](function(_0x46cd07){if(_0x46cd07){return _0x46cd07['removeBlackLists'](_0x394524[_0x276d('0x36')][_0x276d('0x67')]);}})[_0x276d('0x24')](function(_0x186ce0){if(_0x186ce0){return db[_0x276d('0x62')][_0x276d('0x8d')]({'where':{'ListId':_0x394524['query'][_0x276d('0x67')],'CampaignId':_0x394524[_0x276d('0x48')]['id']}})[_0x276d('0x24')](function(){return _0x186ce0;});}})['then'](respondWithStatusCode(_0x245298,null))[_0x276d('0x46')](handleError(_0x245298,null));}; \ No newline at end of file +var _0xbc6f=['sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','params','CmHopper','length','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc6f,0x127));var _0xfbc6=function(_0x5c0a22,_0x3e0eb3){_0x5c0a22=_0x5c0a22-0x0;var _0x292d8e=_0xbc6f[_0x5c0a22];return _0x292d8e;};'use strict';var emlformat=require(_0xfbc6('0x0'));var rimraf=require(_0xfbc6('0x1'));var zipdir=require(_0xfbc6('0x2'));var jsonpatch=require(_0xfbc6('0x3'));var rp=require(_0xfbc6('0x4'));var moment=require(_0xfbc6('0x5'));var BPromise=require(_0xfbc6('0x6'));var Mustache=require(_0xfbc6('0x7'));var util=require('util');var path=require(_0xfbc6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfbc6('0x9'));var fs=require('fs');var fs_extra=require(_0xfbc6('0xa'));var _=require('lodash');var squel=require(_0xfbc6('0xb'));var crypto=require(_0xfbc6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfbc6('0xd'));var toCsv=require(_0xfbc6('0xe'));var querystring=require(_0xfbc6('0xf'));var Papa=require('papaparse');var Redis=require(_0xfbc6('0x10'));var authService=require(_0xfbc6('0x11'));var qs=require(_0xfbc6('0x12'));var as=require(_0xfbc6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfbc6('0x14'));var utils=require(_0xfbc6('0x15'));var config=require(_0xfbc6('0x16'));var licenseUtil=require(_0xfbc6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x266b26,_0x2fc2d1){_0x2fc2d1=_0x2fc2d1||0xcc;return function(_0x2fb25a){if(_0x2fb25a){return _0x266b26[_0xfbc6('0x18')](_0x2fc2d1);}return _0x266b26[_0xfbc6('0x19')](_0x2fc2d1)[_0xfbc6('0x1a')]();};}function respondWithResult(_0x39efba,_0x20f3ab){_0x20f3ab=_0x20f3ab||0xc8;return function(_0x5416e8){if(_0x5416e8){return _0x39efba[_0xfbc6('0x19')](_0x20f3ab)[_0xfbc6('0x1b')](_0x5416e8);}};}function respondWithFilteredResult(_0x3721c7,_0x5212da){return function(_0x152d3d){if(_0x152d3d){var _0x3e6cd5=typeof _0x5212da[_0xfbc6('0x1c')]===_0xfbc6('0x1d')&&typeof _0x5212da[_0xfbc6('0x1e')]==='undefined';var _0x56bf3a=_0x152d3d[_0xfbc6('0x1f')];var _0x2eea68=_0x3e6cd5?0x0:_0x5212da['offset'];var _0x486b96=_0x3e6cd5?_0x152d3d[_0xfbc6('0x1f')]:_0x5212da[_0xfbc6('0x1c')]+_0x5212da[_0xfbc6('0x1e')];var _0x514b12;if(_0x486b96>=_0x56bf3a){_0x486b96=_0x56bf3a;_0x514b12=0xc8;}else{_0x514b12=0xce;}_0x3721c7[_0xfbc6('0x19')](_0x514b12);return _0x3721c7[_0xfbc6('0x20')](_0xfbc6('0x21'),_0x2eea68+'-'+_0x486b96+'/'+_0x56bf3a)['json'](_0x152d3d);}return null;};}function patchUpdates(_0x52c6fe){return function(_0x4bf3f3){try{jsonpatch[_0xfbc6('0x22')](_0x4bf3f3,_0x52c6fe,!![]);}catch(_0x4a1927){return BPromise[_0xfbc6('0x23')](_0x4a1927);}return _0x4bf3f3[_0xfbc6('0x24')]();};}function saveUpdates(_0x4ba737,_0x57d3b3){return function(_0x4afd39){if(_0x4afd39){return _0x4afd39[_0xfbc6('0x25')](_0x4ba737)[_0xfbc6('0x26')](function(_0x59d74a){return _0x59d74a;});}return null;};}function removeEntity(_0x94aa88,_0x3bca40){return function(_0x3572d7){if(_0x3572d7){return _0x3572d7[_0xfbc6('0x27')]()[_0xfbc6('0x26')](function(){var _0x575d1a=_0x3572d7[_0xfbc6('0x28')]({'plain':!![]});var _0x535952=_0xfbc6('0x29');return db['UserProfileResource'][_0xfbc6('0x27')]({'where':{'type':_0x535952,'resourceId':_0x575d1a['id']}})['then'](function(){return _0x3572d7;});})['then'](function(){_0x94aa88[_0xfbc6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2753f0,_0x4c0b60){return function(_0x37c3d3){if(!_0x37c3d3){_0x2753f0['sendStatus'](0x194);}return _0x37c3d3;};}function handleError(_0x11b105,_0x3c9ed3){_0x3c9ed3=_0x3c9ed3||0x1f4;return function(_0x52176b){logger['error'](_0x52176b['stack']);if(_0x52176b['name']){delete _0x52176b[_0xfbc6('0x2a')];}_0x11b105[_0xfbc6('0x19')](_0x3c9ed3)[_0xfbc6('0x2b')](_0x52176b);};}exports['index']=function(_0x352442,_0x2c11de){var _0x531e0b={},_0x36c13d={},_0xd37e53={'count':0x0,'rows':[]};var _0x21e864=_[_0xfbc6('0x2c')](db['Campaign'][_0xfbc6('0x2d')],function(_0x5232a0){return{'name':_0x5232a0[_0xfbc6('0x2e')],'type':_0x5232a0[_0xfbc6('0x2f')]['key']};});_0x36c13d[_0xfbc6('0x30')]=_[_0xfbc6('0x2c')](_0x21e864,_0xfbc6('0x2a'));_0x36c13d[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x352442[_0xfbc6('0x31')]);_0x36c13d[_0xfbc6('0x33')]=_['intersection'](_0x36c13d[_0xfbc6('0x30')],_0x36c13d[_0xfbc6('0x31')]);_0x531e0b['attributes']=_[_0xfbc6('0x34')](_0x36c13d[_0xfbc6('0x30')],qs['fields'](_0x352442[_0xfbc6('0x31')][_0xfbc6('0x35')]));_0x531e0b[_0xfbc6('0x36')]=_0x531e0b[_0xfbc6('0x36')]['length']?_0x531e0b[_0xfbc6('0x36')]:_0x36c13d[_0xfbc6('0x30')];if(!_0x352442['query'][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0x531e0b[_0xfbc6('0x1e')]=qs[_0xfbc6('0x1e')](_0x352442[_0xfbc6('0x31')]['limit']);_0x531e0b[_0xfbc6('0x1c')]=qs[_0xfbc6('0x1c')](_0x352442[_0xfbc6('0x31')]['offset']);}_0x531e0b[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0x352442[_0xfbc6('0x31')][_0xfbc6('0x3a')]);_0x531e0b['where']=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0x352442[_0xfbc6('0x31')],_0x36c13d[_0xfbc6('0x33')]),_0x21e864);if(_0x352442[_0xfbc6('0x31')][_0xfbc6('0x3c')]){_0x531e0b[_0xfbc6('0x3d')]=_['merge'](_0x531e0b[_0xfbc6('0x3d')],{'$or':_[_0xfbc6('0x2c')](_0x21e864,function(_0x465bb1){if(_0x465bb1[_0xfbc6('0x2f')]!==_0xfbc6('0x3e')){var _0x3c39ce={};_0x3c39ce[_0x465bb1[_0xfbc6('0x2a')]]={'$like':'%'+_0x352442[_0xfbc6('0x31')][_0xfbc6('0x3c')]+'%'};return _0x3c39ce;}})});}_0x531e0b=_['merge']({},_0x531e0b,_0x352442[_0xfbc6('0x3f')]);var _0x4ae754={'where':_0x531e0b['where']};return db[_0xfbc6('0x40')][_0xfbc6('0x1f')](_0x4ae754)['then'](function(_0x554a0f){_0xd37e53[_0xfbc6('0x1f')]=_0x554a0f;if(_0x352442[_0xfbc6('0x31')][_0xfbc6('0x41')]){_0x531e0b[_0xfbc6('0x42')]=[{'all':!![]}];}return db[_0xfbc6('0x40')][_0xfbc6('0x43')](_0x531e0b);})[_0xfbc6('0x26')](function(_0x2db510){_0xd37e53[_0xfbc6('0x44')]=_0x2db510;return _0xd37e53;})['then'](respondWithFilteredResult(_0x2c11de,_0x531e0b))[_0xfbc6('0x45')](handleError(_0x2c11de,null));};exports[_0xfbc6('0x46')]=function(_0x3170b7,_0x1a4012){var _0x11d734={'raw':![],'where':{'id':_0x3170b7['params']['id']}},_0x39c609={};_0x39c609[_0xfbc6('0x30')]=_['keys'](db[_0xfbc6('0x40')]['rawAttributes']);_0x39c609[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x3170b7[_0xfbc6('0x31')]);_0x39c609[_0xfbc6('0x33')]=_[_0xfbc6('0x34')](_0x39c609[_0xfbc6('0x30')],_0x39c609[_0xfbc6('0x31')]);_0x11d734[_0xfbc6('0x36')]=_['intersection'](_0x39c609[_0xfbc6('0x30')],qs[_0xfbc6('0x35')](_0x3170b7[_0xfbc6('0x31')][_0xfbc6('0x35')]));_0x11d734[_0xfbc6('0x36')]=_0x11d734['attributes']['length']?_0x11d734[_0xfbc6('0x36')]:_0x39c609[_0xfbc6('0x30')];if(_0x3170b7[_0xfbc6('0x31')]['includeAll']){_0x11d734['include']=[{'all':!![]}];}_0x11d734=_[_0xfbc6('0x47')]({},_0x11d734,_0x3170b7[_0xfbc6('0x3f')]);return db[_0xfbc6('0x40')][_0xfbc6('0x48')](_0x11d734)[_0xfbc6('0x26')](handleEntityNotFound(_0x1a4012,null))[_0xfbc6('0x26')](respondWithResult(_0x1a4012,null))[_0xfbc6('0x45')](handleError(_0x1a4012,null));};exports[_0xfbc6('0x49')]=function(_0x1bfc78,_0x324c44){return db[_0xfbc6('0x40')][_0xfbc6('0x49')](_0x1bfc78[_0xfbc6('0x4a')],{})['then'](function(_0x2d34cd){var _0x8be198=_0x1bfc78[_0xfbc6('0x4b')][_0xfbc6('0x28')]({'plain':!![]});if(!_0x8be198)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8be198['role']===_0xfbc6('0x4b')){var _0x2ddf8e=_0x2d34cd[_0xfbc6('0x28')]({'plain':!![]});var _0x1022ec='IvrCampaigns';return db[_0xfbc6('0x4c')][_0xfbc6('0x48')]({'where':{'name':_0x1022ec,'userProfileId':_0x8be198['userProfileId']},'raw':!![]})['then'](function(_0x3556c3){if(_0x3556c3&&_0x3556c3[_0xfbc6('0x4d')]===0x0){return db[_0xfbc6('0x4e')]['create']({'name':_0x2ddf8e[_0xfbc6('0x2a')],'resourceId':_0x2ddf8e['id'],'type':_0x3556c3[_0xfbc6('0x2a')],'sectionId':_0x3556c3['id']},{})[_0xfbc6('0x26')](function(){return _0x2d34cd;});}else{return _0x2d34cd;}})[_0xfbc6('0x45')](function(_0x35f6d0){logger[_0xfbc6('0x4f')](_0xfbc6('0x50'),_0x35f6d0);throw _0x35f6d0;});}return _0x2d34cd;})[_0xfbc6('0x26')](respondWithResult(_0x324c44,0xc9))[_0xfbc6('0x45')](handleError(_0x324c44,null));};exports[_0xfbc6('0x51')]=function(_0x3aa570,_0x3bbe1d){var _0x52cac0={'where':{'id':_0x3aa570['params']['id']}},_0x44312f={};_0x44312f[_0xfbc6('0x30')]=_[_0xfbc6('0x32')](db[_0xfbc6('0x40')]['rawAttributes']);_0x52cac0['attributes']=_[_0xfbc6('0x34')](_0x44312f[_0xfbc6('0x30')],qs[_0xfbc6('0x35')](_0x3aa570[_0xfbc6('0x31')]['fields']));_0x52cac0[_0xfbc6('0x36')]=_0x52cac0[_0xfbc6('0x36')]['length']?_0x52cac0[_0xfbc6('0x36')]:_0x44312f[_0xfbc6('0x30')];if(_0x3aa570['query']['includeAll']){_0x52cac0[_0xfbc6('0x42')]=[{'all':!![]}];}_0x52cac0=_[_0xfbc6('0x47')]({},_0x52cac0,_0x3aa570[_0xfbc6('0x3f')]);return db[_0xfbc6('0x40')][_0xfbc6('0x48')](_0x52cac0)[_0xfbc6('0x26')](handleEntityNotFound(_0x3bbe1d,null))['then'](function(_0xce017b){if(_0xce017b){var _0x4111e0=_0xce017b[_0xfbc6('0x28')]({'plain':!![]});_0x4111e0=qs[_0xfbc6('0x52')](_0x4111e0,['id',_0xfbc6('0x53'),_0xfbc6('0x54')]);_0x3aa570[_0xfbc6('0x4a')]=_['omit'](_0x3aa570[_0xfbc6('0x4a')],['id','createdAt','updatedAt']);return db[_0xfbc6('0x40')][_0xfbc6('0x49')](_[_0xfbc6('0x47')](_0x4111e0,_0x3aa570[_0xfbc6('0x4a')]),{'include':_0x3aa570[_0xfbc6('0x31')][_0xfbc6('0x41')]?[{'all':!![]}]:undefined})[_0xfbc6('0x26')](function(_0x40a847){var _0x1b21c9=_0x3aa570[_0xfbc6('0x4b')][_0xfbc6('0x28')]({'plain':!![]});if(!_0x1b21c9)throw new Error(_0xfbc6('0x55'));if(_0x1b21c9['role']===_0xfbc6('0x4b')){var _0x229026=_0x40a847[_0xfbc6('0x28')]({'plain':!![]});var _0x4e5332='IvrCampaigns';return db[_0xfbc6('0x4c')][_0xfbc6('0x48')]({'where':{'name':_0x4e5332,'userProfileId':_0x1b21c9[_0xfbc6('0x56')]},'raw':!![]})['then'](function(_0x1f8d22){if(_0x1f8d22&&_0x1f8d22[_0xfbc6('0x4d')]===0x0){return db[_0xfbc6('0x4e')][_0xfbc6('0x49')]({'name':_0x229026[_0xfbc6('0x2a')],'resourceId':_0x229026['id'],'type':_0x1f8d22['name'],'sectionId':_0x1f8d22['id']},{})[_0xfbc6('0x26')](function(){return _0x40a847;});}else{return _0x40a847;}})['catch'](function(_0x309868){logger[_0xfbc6('0x4f')](_0xfbc6('0x50'),_0x309868);throw _0x309868;});}return _0x40a847;});}})[_0xfbc6('0x26')](respondWithResult(_0x3bbe1d,0xc9))['catch'](handleError(_0x3bbe1d,null));};exports[_0xfbc6('0x25')]=function(_0xb5e9dc,_0x3f7ed4){if(_0xb5e9dc[_0xfbc6('0x4a')]['id']){delete _0xb5e9dc[_0xfbc6('0x4a')]['id'];}return db[_0xfbc6('0x40')][_0xfbc6('0x48')]({'where':{'id':_0xb5e9dc[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x3f7ed4,null))[_0xfbc6('0x26')](saveUpdates(_0xb5e9dc[_0xfbc6('0x4a')],null))['then'](respondWithResult(_0x3f7ed4,null))[_0xfbc6('0x45')](handleError(_0x3f7ed4,null));};exports[_0xfbc6('0x27')]=function(_0x42548e,_0xbc0a14){return db['Campaign'][_0xfbc6('0x48')]({'where':{'id':_0x42548e['params']['id']}})['then'](handleEntityNotFound(_0xbc0a14,null))[_0xfbc6('0x26')](removeEntity(_0xbc0a14,null))['catch'](handleError(_0xbc0a14,null));};exports['getHoppers']=function(_0x12167d,_0x595b58,_0x33c5c0){var _0x30382f={'raw':!![],'where':{}};var _0x5ca340={};var _0x28abf9={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x12167d[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x595b58,null))[_0xfbc6('0x26')](function(_0x366775){if(_0x366775){_0x5ca340[_0xfbc6('0x30')]=_[_0xfbc6('0x32')](db[_0xfbc6('0x58')][_0xfbc6('0x2d')]);_0x5ca340['query']=_['keys'](_0x12167d['query']);_0x5ca340[_0xfbc6('0x33')]=_[_0xfbc6('0x34')](_0x5ca340[_0xfbc6('0x30')],_0x5ca340[_0xfbc6('0x31')]);_0x30382f[_0xfbc6('0x36')]=_[_0xfbc6('0x34')](_0x5ca340[_0xfbc6('0x30')],qs['fields'](_0x12167d['query'][_0xfbc6('0x35')]));_0x30382f['attributes']=_0x30382f[_0xfbc6('0x36')][_0xfbc6('0x59')]?_0x30382f[_0xfbc6('0x36')]:_0x5ca340[_0xfbc6('0x30')];if(!_0x12167d[_0xfbc6('0x31')][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0x30382f[_0xfbc6('0x1e')]=qs[_0xfbc6('0x1e')](_0x12167d[_0xfbc6('0x31')]['limit']);_0x30382f['offset']=qs['offset'](_0x12167d[_0xfbc6('0x31')][_0xfbc6('0x1c')]);}_0x30382f[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0x12167d[_0xfbc6('0x31')]['sort']);_0x30382f[_0xfbc6('0x3d')]=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0x12167d[_0xfbc6('0x31')],_0x5ca340[_0xfbc6('0x33')]));_0x30382f[_0xfbc6('0x3d')][_0xfbc6('0x5a')]=_0x366775['id'];if(_0x12167d[_0xfbc6('0x31')]['filter']){_0x30382f['where']=_[_0xfbc6('0x47')](_0x30382f['where'],{'$or':_[_0xfbc6('0x2c')](_0x30382f['attributes'],function(_0x2c5bbb){var _0x4a1cdd={};_0x4a1cdd[_0x2c5bbb]={'$like':'%'+_0x12167d['query'][_0xfbc6('0x3c')]+'%'};return _0x4a1cdd;})});}_0x30382f=_[_0xfbc6('0x47')]({},_0x30382f,_0x12167d[_0xfbc6('0x3f')]);return db['CmHopper'][_0xfbc6('0x1f')]({'where':_0x30382f[_0xfbc6('0x3d')]})[_0xfbc6('0x26')](function(_0x49eb6e){_0x28abf9[_0xfbc6('0x1f')]=_0x49eb6e;if(_0x12167d[_0xfbc6('0x31')][_0xfbc6('0x41')]){_0x30382f[_0xfbc6('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0xfbc6('0x43')](_0x30382f);})[_0xfbc6('0x26')](function(_0x375b8f){_0x28abf9[_0xfbc6('0x44')]=_0x375b8f;return _0x28abf9;});}})[_0xfbc6('0x26')](respondWithFilteredResult(_0x595b58,_0x30382f))[_0xfbc6('0x45')](handleError(_0x595b58,null));};exports['getHopperHistories']=function(_0x4fe6b4,_0x5eba30,_0x33fd98){var _0xbe1474={'raw':!![],'where':{}};var _0x5dfe97={};var _0x256bc9={'count':0x0,'rows':[]};return db[_0xfbc6('0x40')][_0xfbc6('0x5b')]({'where':{'id':_0x4fe6b4['params']['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x5eba30,null))[_0xfbc6('0x26')](function(_0x3aeb91){if(_0x3aeb91){_0x5dfe97[_0xfbc6('0x30')]=_[_0xfbc6('0x32')](db['CmHopperHistory'][_0xfbc6('0x2d')]);_0x5dfe97[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x4fe6b4[_0xfbc6('0x31')]);_0x5dfe97['filters']=_['intersection'](_0x5dfe97['model'],_0x5dfe97[_0xfbc6('0x31')]);_0xbe1474[_0xfbc6('0x36')]=_[_0xfbc6('0x34')](_0x5dfe97['model'],qs['fields'](_0x4fe6b4[_0xfbc6('0x31')]['fields']));_0xbe1474[_0xfbc6('0x36')]=_0xbe1474[_0xfbc6('0x36')][_0xfbc6('0x59')]?_0xbe1474[_0xfbc6('0x36')]:_0x5dfe97['model'];if(!_0x4fe6b4[_0xfbc6('0x31')][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0xbe1474[_0xfbc6('0x1e')]=qs['limit'](_0x4fe6b4[_0xfbc6('0x31')][_0xfbc6('0x1e')]);_0xbe1474['offset']=qs[_0xfbc6('0x1c')](_0x4fe6b4['query'][_0xfbc6('0x1c')]);}_0xbe1474[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0x4fe6b4[_0xfbc6('0x31')][_0xfbc6('0x3a')]);_0xbe1474[_0xfbc6('0x3d')]=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0x4fe6b4[_0xfbc6('0x31')],_0x5dfe97[_0xfbc6('0x33')]));_0xbe1474[_0xfbc6('0x3d')][_0xfbc6('0x5a')]=_0x3aeb91['id'];if(_0x4fe6b4['query'][_0xfbc6('0x3c')]){_0xbe1474['where']=_[_0xfbc6('0x47')](_0xbe1474[_0xfbc6('0x3d')],{'$or':_[_0xfbc6('0x2c')](_0xbe1474[_0xfbc6('0x36')],function(_0x5c4712){var _0x234367={};_0x234367[_0x5c4712]={'$like':'%'+_0x4fe6b4[_0xfbc6('0x31')][_0xfbc6('0x3c')]+'%'};return _0x234367;})});}_0xbe1474=_[_0xfbc6('0x47')]({},_0xbe1474,_0x4fe6b4['options']);return db[_0xfbc6('0x5c')][_0xfbc6('0x1f')]({'where':_0xbe1474[_0xfbc6('0x3d')]})['then'](function(_0x5cd893){_0x256bc9['count']=_0x5cd893;if(_0x4fe6b4['query'][_0xfbc6('0x41')]){_0xbe1474[_0xfbc6('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xfbc6('0x43')](_0xbe1474);})['then'](function(_0x2e8845){_0x256bc9[_0xfbc6('0x44')]=_0x2e8845;return _0x256bc9;});}})[_0xfbc6('0x26')](respondWithFilteredResult(_0x5eba30,_0xbe1474))[_0xfbc6('0x45')](handleError(_0x5eba30,null));};exports[_0xfbc6('0x5d')]=function(_0x99a884,_0x24808b,_0x5d40af){var _0x5cbe87={'raw':!![],'where':{}};var _0x3b2c49={};var _0x358310={'count':0x0,'rows':[]};return db[_0xfbc6('0x40')][_0xfbc6('0x5b')]({'where':{'id':_0x99a884['params']['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x24808b,null))[_0xfbc6('0x26')](function(_0xd36be0){if(_0xd36be0){_0x3b2c49[_0xfbc6('0x30')]=_[_0xfbc6('0x32')](db[_0xfbc6('0x5e')][_0xfbc6('0x2d')]);_0x3b2c49[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x99a884['query']);_0x3b2c49[_0xfbc6('0x33')]=_[_0xfbc6('0x34')](_0x3b2c49['model'],_0x3b2c49[_0xfbc6('0x31')]);_0x5cbe87[_0xfbc6('0x36')]=_['intersection'](_0x3b2c49['model'],qs[_0xfbc6('0x35')](_0x99a884[_0xfbc6('0x31')]['fields']));_0x5cbe87['attributes']=_0x5cbe87[_0xfbc6('0x36')][_0xfbc6('0x59')]?_0x5cbe87[_0xfbc6('0x36')]:_0x3b2c49[_0xfbc6('0x30')];if(!_0x99a884['query'][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0x5cbe87[_0xfbc6('0x1e')]=qs[_0xfbc6('0x1e')](_0x99a884[_0xfbc6('0x31')]['limit']);_0x5cbe87[_0xfbc6('0x1c')]=qs[_0xfbc6('0x1c')](_0x99a884[_0xfbc6('0x31')][_0xfbc6('0x1c')]);}_0x5cbe87['order']=qs['sort'](_0x99a884[_0xfbc6('0x31')][_0xfbc6('0x3a')]);_0x5cbe87['where']=qs['filters'](_[_0xfbc6('0x3b')](_0x99a884[_0xfbc6('0x31')],_0x3b2c49[_0xfbc6('0x33')]));_0x5cbe87['where'][_0xfbc6('0x5a')]=_0xd36be0['id'];if(_0x99a884[_0xfbc6('0x31')][_0xfbc6('0x3c')]){_0x5cbe87[_0xfbc6('0x3d')]=_[_0xfbc6('0x47')](_0x5cbe87[_0xfbc6('0x3d')],{'$or':_[_0xfbc6('0x2c')](_0x5cbe87[_0xfbc6('0x36')],function(_0x565cad){var _0xb80f9={};_0xb80f9[_0x565cad]={'$like':'%'+_0x99a884['query'][_0xfbc6('0x3c')]+'%'};return _0xb80f9;})});}_0x5cbe87=_[_0xfbc6('0x47')]({},_0x5cbe87,_0x99a884['options']);return db[_0xfbc6('0x5e')][_0xfbc6('0x1f')]({'where':_0x5cbe87[_0xfbc6('0x3d')]})[_0xfbc6('0x26')](function(_0x40a15f){_0x358310[_0xfbc6('0x1f')]=_0x40a15f;if(_0x99a884[_0xfbc6('0x31')][_0xfbc6('0x41')]){_0x5cbe87[_0xfbc6('0x42')]=[{'all':!![]}];}return db[_0xfbc6('0x5e')][_0xfbc6('0x43')](_0x5cbe87);})[_0xfbc6('0x26')](function(_0x2b3ce8){_0x358310[_0xfbc6('0x44')]=_0x2b3ce8;return _0x358310;});}})['then'](respondWithFilteredResult(_0x24808b,_0x5cbe87))[_0xfbc6('0x45')](handleError(_0x24808b,null));};exports['getHopperBlacks']=function(_0x5b3e3f,_0x22eeab,_0xc78df0){var _0x4a0dbc={'raw':!![],'where':{}};var _0x25e443={};var _0x4f5ae8={'count':0x0,'rows':[]};return db[_0xfbc6('0x40')]['findOne']({'where':{'id':_0x5b3e3f[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x22eeab,null))[_0xfbc6('0x26')](function(_0x58d51b){if(_0x58d51b){_0x25e443[_0xfbc6('0x30')]=_['keys'](db['CmHopperBlack'][_0xfbc6('0x2d')]);_0x25e443[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x5b3e3f[_0xfbc6('0x31')]);_0x25e443[_0xfbc6('0x33')]=_[_0xfbc6('0x34')](_0x25e443[_0xfbc6('0x30')],_0x25e443['query']);_0x4a0dbc[_0xfbc6('0x36')]=_[_0xfbc6('0x34')](_0x25e443['model'],qs[_0xfbc6('0x35')](_0x5b3e3f['query'][_0xfbc6('0x35')]));_0x4a0dbc[_0xfbc6('0x36')]=_0x4a0dbc['attributes'][_0xfbc6('0x59')]?_0x4a0dbc[_0xfbc6('0x36')]:_0x25e443[_0xfbc6('0x30')];if(!_0x5b3e3f['query'][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0x4a0dbc[_0xfbc6('0x1e')]=qs['limit'](_0x5b3e3f[_0xfbc6('0x31')][_0xfbc6('0x1e')]);_0x4a0dbc[_0xfbc6('0x1c')]=qs['offset'](_0x5b3e3f[_0xfbc6('0x31')]['offset']);}_0x4a0dbc[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0x5b3e3f[_0xfbc6('0x31')][_0xfbc6('0x3a')]);_0x4a0dbc[_0xfbc6('0x3d')]=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0x5b3e3f[_0xfbc6('0x31')],_0x25e443[_0xfbc6('0x33')]));_0x4a0dbc[_0xfbc6('0x3d')][_0xfbc6('0x5a')]=_0x58d51b['id'];if(_0x5b3e3f[_0xfbc6('0x31')][_0xfbc6('0x3c')]){_0x4a0dbc[_0xfbc6('0x3d')]=_['merge'](_0x4a0dbc['where'],{'$or':_['map'](_0x4a0dbc[_0xfbc6('0x36')],function(_0x5f48e1){var _0x1763a4={};_0x1763a4[_0x5f48e1]={'$like':'%'+_0x5b3e3f[_0xfbc6('0x31')][_0xfbc6('0x3c')]+'%'};return _0x1763a4;})});}_0x4a0dbc=_[_0xfbc6('0x47')]({},_0x4a0dbc,_0x5b3e3f[_0xfbc6('0x3f')]);return db['CmHopperBlack']['count']({'where':_0x4a0dbc[_0xfbc6('0x3d')]})[_0xfbc6('0x26')](function(_0x293ab4){_0x4f5ae8[_0xfbc6('0x1f')]=_0x293ab4;if(_0x5b3e3f[_0xfbc6('0x31')][_0xfbc6('0x41')]){_0x4a0dbc[_0xfbc6('0x42')]=[{'all':!![]}];}return db[_0xfbc6('0x5f')][_0xfbc6('0x43')](_0x4a0dbc);})[_0xfbc6('0x26')](function(_0xcdb6ef){_0x4f5ae8[_0xfbc6('0x44')]=_0xcdb6ef;return _0x4f5ae8;});}})[_0xfbc6('0x26')](respondWithFilteredResult(_0x22eeab,_0x4a0dbc))['catch'](handleError(_0x22eeab,null));};exports[_0xfbc6('0x60')]=function(_0x2f4ddd,_0xb661cc,_0x2a2eee){var _0x38548f={};var _0x410cd6={};var _0x1e9c3e;var _0x5c8213;return db[_0xfbc6('0x40')][_0xfbc6('0x5b')]({'where':{'id':_0x2f4ddd[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0xb661cc,null))[_0xfbc6('0x26')](function(_0x54b3f4){if(_0x54b3f4){_0x1e9c3e=_0x54b3f4;_0x410cd6[_0xfbc6('0x30')]=_[_0xfbc6('0x32')](db[_0xfbc6('0x61')][_0xfbc6('0x2d')]);_0x410cd6[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0x2f4ddd[_0xfbc6('0x31')]);_0x410cd6[_0xfbc6('0x33')]=_['intersection'](_0x410cd6[_0xfbc6('0x30')],_0x410cd6['query']);_0x38548f[_0xfbc6('0x36')]=_[_0xfbc6('0x34')](_0x410cd6['model'],qs[_0xfbc6('0x35')](_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x35')]));_0x38548f[_0xfbc6('0x36')]=_0x38548f[_0xfbc6('0x36')][_0xfbc6('0x59')]?_0x38548f['attributes']:_0x410cd6[_0xfbc6('0x30')];_0x38548f[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0x2f4ddd['query']['sort']);_0x38548f[_0xfbc6('0x3d')]=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0x2f4ddd[_0xfbc6('0x31')],_0x410cd6['filters']));if(_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x3c')]){_0x38548f[_0xfbc6('0x3d')]=_[_0xfbc6('0x47')](_0x38548f[_0xfbc6('0x3d')],{'$or':_[_0xfbc6('0x2c')](_0x38548f['attributes'],function(_0x286aec){var _0x41d46c={};_0x41d46c[_0x286aec]={'$like':'%'+_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x3c')]+'%'};return _0x41d46c;})});}_0x38548f=_['merge']({},_0x38548f,_0x2f4ddd[_0xfbc6('0x3f')]);return _0x1e9c3e[_0xfbc6('0x60')](_0x38548f);}})[_0xfbc6('0x26')](function(_0x290d05){if(_0x290d05){_0x5c8213=_0x290d05[_0xfbc6('0x59')];if(!_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x37')](_0xfbc6('0x38'))){_0x38548f[_0xfbc6('0x1e')]=qs[_0xfbc6('0x1e')](_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x1e')]);_0x38548f[_0xfbc6('0x1c')]=qs['offset'](_0x2f4ddd[_0xfbc6('0x31')][_0xfbc6('0x1c')]);}return _0x1e9c3e['getLists'](_0x38548f);}})[_0xfbc6('0x26')](function(_0x39a439){if(_0x39a439){return _0x39a439?{'count':_0x5c8213,'rows':_0x39a439}:null;}})[_0xfbc6('0x26')](respondWithResult(_0xb661cc,null))['catch'](handleError(_0xb661cc,null));};exports[_0xfbc6('0x62')]=function(_0x3a1b49,_0x5e618f,_0x42e139){var _0x47db90,_0x1760aa;var _0x4ab1ac=[];var _0x176174=moment()[_0xfbc6('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x3a1b49[_0xfbc6('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e618f,null))[_0xfbc6('0x26')](function(_0x13ff22){if(_0x13ff22){_0x1760aa=_0x13ff22;return _0x13ff22['addLists'](_0x3a1b49[_0xfbc6('0x4a')][_0xfbc6('0x64')],_[_0xfbc6('0x52')](_0x3a1b49[_0xfbc6('0x4a')],[_0xfbc6('0x64'),'id'])||{});}return null;})['spread'](function(_0x1bd495){var _0x35a4e0;var _0x342c70;_0x47db90=_0x1bd495||[];var _0x30996b=[];if(_0x1bd495){for(var _0x234078=0x0;_0x234078<_0x1bd495[_0xfbc6('0x59')];_0x234078+=0x1){var _0x5446af=_0x1bd495[_0x234078][_0xfbc6('0x28')]({'plain':!![]});_0x1760aa[_0xfbc6('0x65')]=_0x3a1b49['body']['dialCheckDuplicateType']?_0x3a1b49[_0xfbc6('0x4a')][_0xfbc6('0x65')]:_0x1760aa[_0xfbc6('0x65')];switch(_0x1760aa[_0xfbc6('0x65')]){case _0xfbc6('0x66'):_0x35a4e0=squel[_0xfbc6('0x67')]()[_0xfbc6('0x68')](_0xfbc6('0x69'))[_0xfbc6('0x6a')](['phone',_0xfbc6('0x6b'),_0xfbc6('0x6c'),'ListId',_0xfbc6('0x5a'),_0xfbc6('0x53'),_0xfbc6('0x54')],squel[_0xfbc6('0x6d')]()[_0xfbc6('0x6e')](_0xfbc6('0x6f'),_0xfbc6('0x6f'))[_0xfbc6('0x6e')](_0xfbc6('0x70'),'scheduledAt')[_0xfbc6('0x6e')]('id','ContactId')['field'](_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')](),_0xfbc6('0x73'))[_0xfbc6('0x6e')](_0x3a1b49[_0xfbc6('0x57')]['id'][_0xfbc6('0x72')](),'CampaignId')[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27','createdAt')[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27',_0xfbc6('0x54'))[_0xfbc6('0x74')](_0xfbc6('0x75'))['where'](_0xfbc6('0x76'))[_0xfbc6('0x3d')]('ListId\x20=\x20?',_0x5446af[_0xfbc6('0x71')]['toString']())['where'](_0xfbc6('0x77'))[_0xfbc6('0x3d')](_0xfbc6('0x78'),squel[_0xfbc6('0x6d')]()[_0xfbc6('0x6e')](_0xfbc6('0x79'))[_0xfbc6('0x74')](_0xfbc6('0x7a'))[_0xfbc6('0x3d')](_0xfbc6('0x7b'),_0x3a1b49[_0xfbc6('0x57')]['id'][_0xfbc6('0x72')]()))[_0xfbc6('0x3d')](_0xfbc6('0x78'),squel['select']()[_0xfbc6('0x6e')](_0xfbc6('0x7c'))[_0xfbc6('0x74')](_0xfbc6('0x69'))['where'](_0xfbc6('0x7b'),_0x3a1b49['params']['id'][_0xfbc6('0x72')]())))[_0xfbc6('0x72')]();break;case _0xfbc6('0x7d'):_0x35a4e0=squel[_0xfbc6('0x67')]()[_0xfbc6('0x68')]('cm_hopper')[_0xfbc6('0x6a')](['phone','scheduledAt',_0xfbc6('0x6c'),_0xfbc6('0x73'),'CampaignId','createdAt',_0xfbc6('0x54')],squel[_0xfbc6('0x6d')]()[_0xfbc6('0x6e')](_0xfbc6('0x6f'),_0xfbc6('0x6f'))[_0xfbc6('0x6e')](_0xfbc6('0x70'),'scheduledAt')['field']('id',_0xfbc6('0x6c'))[_0xfbc6('0x6e')](_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')](),_0xfbc6('0x73'))[_0xfbc6('0x6e')](_0x3a1b49[_0xfbc6('0x57')]['id'][_0xfbc6('0x72')](),_0xfbc6('0x5a'))['field']('\x27'+_0x176174+'\x27',_0xfbc6('0x53'))[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27','updatedAt')[_0xfbc6('0x74')](_0xfbc6('0x75'))['where'](_0xfbc6('0x76'))[_0xfbc6('0x3d')]('ListId\x20=\x20?',_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')]())[_0xfbc6('0x3d')](_0xfbc6('0x77'))[_0xfbc6('0x3d')](_0xfbc6('0x78'),squel['select']()[_0xfbc6('0x6e')](_0xfbc6('0x7c'))[_0xfbc6('0x74')]('cm_hopper')['where'](_0xfbc6('0x7b'),_0x3a1b49[_0xfbc6('0x57')]['id']['toString']())))['toString']();break;default:_0x35a4e0=squel[_0xfbc6('0x67')]()[_0xfbc6('0x68')](_0xfbc6('0x69'))[_0xfbc6('0x6a')]([_0xfbc6('0x6f'),_0xfbc6('0x6b'),_0xfbc6('0x6c'),_0xfbc6('0x73'),_0xfbc6('0x5a'),_0xfbc6('0x53'),'updatedAt'],squel[_0xfbc6('0x6d')]()[_0xfbc6('0x6e')](_0xfbc6('0x6f'),_0xfbc6('0x6f'))[_0xfbc6('0x6e')](_0xfbc6('0x70'),_0xfbc6('0x6b'))['field']('id',_0xfbc6('0x6c'))[_0xfbc6('0x6e')](_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')](),_0xfbc6('0x73'))[_0xfbc6('0x6e')](_0x3a1b49[_0xfbc6('0x57')]['id'][_0xfbc6('0x72')](),_0xfbc6('0x5a'))[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27','createdAt')[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27',_0xfbc6('0x54'))[_0xfbc6('0x74')](_0xfbc6('0x75'))[_0xfbc6('0x3d')](_0xfbc6('0x76'))[_0xfbc6('0x3d')](_0xfbc6('0x7e'),_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')]())['where'](_0xfbc6('0x77')))[_0xfbc6('0x72')]();}_0x342c70=squel[_0xfbc6('0x67')]()[_0xfbc6('0x68')]('cm_hopper_additional_phones')['fromQuery']([_0xfbc6('0x7f'),_0xfbc6('0x6b'),_0xfbc6('0x6f'),'OrderBy',_0xfbc6('0x53'),_0xfbc6('0x54')],squel['select']()['field'](_0xfbc6('0x80'),'id')[_0xfbc6('0x6e')](_0xfbc6('0x70'),_0xfbc6('0x6b'))[_0xfbc6('0x6e')](_0xfbc6('0x81'),_0xfbc6('0x6f'))[_0xfbc6('0x6e')](_0xfbc6('0x82'),'OrderBy')[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27','createdAt')[_0xfbc6('0x6e')]('\x27'+_0x176174+'\x27','updatedAt')[_0xfbc6('0x74')](_0xfbc6('0x83'),'ci')[_0xfbc6('0x84')](_0xfbc6('0x69'),'h',_0xfbc6('0x85'))[_0xfbc6('0x3d')](_0xfbc6('0x86'),_0x5446af[_0xfbc6('0x71')][_0xfbc6('0x72')]())['where'](_0xfbc6('0x87'),_0x3a1b49[_0xfbc6('0x57')]['id']['toString']())[_0xfbc6('0x3d')]('h.createdAt\x20=\x20?',_0x176174))['toString']();_0x30996b[_0xfbc6('0x88')](db[_0xfbc6('0x89')][_0xfbc6('0x31')](_0x35a4e0));_0x4ab1ac['push'](db[_0xfbc6('0x89')][_0xfbc6('0x31')](_0x342c70));}return BPromise[_0xfbc6('0x8a')](_0x30996b);}})[_0xfbc6('0x26')](function(){return BPromise[_0xfbc6('0x8a')](_0x4ab1ac);})[_0xfbc6('0x26')](function(){return _0x47db90;})[_0xfbc6('0x26')](respondWithResult(_0x5e618f,null))['catch'](handleError(_0x5e618f,null));};exports[_0xfbc6('0x8b')]=function(_0x2a8545,_0x10134e,_0x2779e8){return db[_0xfbc6('0x40')][_0xfbc6('0x48')]({'where':{'id':_0x2a8545[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x10134e,null))[_0xfbc6('0x26')](function(_0x253748){if(_0x253748){return _0x253748[_0xfbc6('0x8b')](_0x2a8545[_0xfbc6('0x31')][_0xfbc6('0x64')]);}})[_0xfbc6('0x26')](function(_0x52e437){if(_0x52e437){return db[_0xfbc6('0x58')][_0xfbc6('0x27')]({'where':{'ListId':_0x2a8545['query'][_0xfbc6('0x64')],'CampaignId':_0x2a8545[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](function(){return _0x52e437;});}})[_0xfbc6('0x26')](respondWithStatusCode(_0x10134e,null))['catch'](handleError(_0x10134e,null));};exports[_0xfbc6('0x8c')]=function(_0xcdeb57,_0x5307c7,_0x5af0b1){var _0x112490={};var _0x3327e0={};var _0x304f14;var _0x58c992;return db['Campaign']['findOne']({'where':{'id':_0xcdeb57[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x5307c7,null))[_0xfbc6('0x26')](function(_0x49ce44){if(_0x49ce44){_0x304f14=_0x49ce44;_0x3327e0[_0xfbc6('0x30')]=_['keys'](db[_0xfbc6('0x61')]['rawAttributes']);_0x3327e0[_0xfbc6('0x31')]=_[_0xfbc6('0x32')](_0xcdeb57[_0xfbc6('0x31')]);_0x3327e0[_0xfbc6('0x33')]=_[_0xfbc6('0x34')](_0x3327e0['model'],_0x3327e0['query']);_0x112490[_0xfbc6('0x36')]=_[_0xfbc6('0x34')](_0x3327e0[_0xfbc6('0x30')],qs[_0xfbc6('0x35')](_0xcdeb57[_0xfbc6('0x31')][_0xfbc6('0x35')]));_0x112490[_0xfbc6('0x36')]=_0x112490['attributes'][_0xfbc6('0x59')]?_0x112490[_0xfbc6('0x36')]:_0x3327e0[_0xfbc6('0x30')];_0x112490[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_0xcdeb57[_0xfbc6('0x31')][_0xfbc6('0x3a')]);_0x112490[_0xfbc6('0x3d')]=qs[_0xfbc6('0x33')](_[_0xfbc6('0x3b')](_0xcdeb57[_0xfbc6('0x31')],_0x3327e0['filters']));if(_0xcdeb57[_0xfbc6('0x31')][_0xfbc6('0x3c')]){_0x112490[_0xfbc6('0x3d')]=_[_0xfbc6('0x47')](_0x112490[_0xfbc6('0x3d')],{'$or':_['map'](_0x112490['attributes'],function(_0x1ccb5f){var _0x1b5df0={};_0x1b5df0[_0x1ccb5f]={'$like':'%'+_0xcdeb57['query'][_0xfbc6('0x3c')]+'%'};return _0x1b5df0;})});}_0x112490=_[_0xfbc6('0x47')]({},_0x112490,_0xcdeb57[_0xfbc6('0x3f')]);return _0x304f14[_0xfbc6('0x8c')](_0x112490);}})['then'](function(_0x2277ef){if(_0x2277ef){_0x58c992=_0x2277ef[_0xfbc6('0x59')];if(!_0xcdeb57['query'][_0xfbc6('0x37')]('nolimit')){_0x112490[_0xfbc6('0x1e')]=qs[_0xfbc6('0x1e')](_0xcdeb57[_0xfbc6('0x31')][_0xfbc6('0x1e')]);_0x112490[_0xfbc6('0x1c')]=qs[_0xfbc6('0x1c')](_0xcdeb57['query'][_0xfbc6('0x1c')]);}return _0x304f14['getBlackLists'](_0x112490);}})[_0xfbc6('0x26')](function(_0x4eed5c){if(_0x4eed5c){return _0x4eed5c?{'count':_0x58c992,'rows':_0x4eed5c}:null;}})[_0xfbc6('0x26')](respondWithResult(_0x5307c7,null))[_0xfbc6('0x45')](handleError(_0x5307c7,null));};exports['addBlackLists']=function(_0x22c568,_0x2b3899,_0x4c097d){var _0x1e4b67,_0x52d7f4;var _0x26170a=[];var _0x1ab43a=moment()[_0xfbc6('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xfbc6('0x40')][_0xfbc6('0x48')]({'where':{'id':_0x22c568[_0xfbc6('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b3899,null))[_0xfbc6('0x26')](function(_0x1dabfa){if(_0x1dabfa){_0x52d7f4=_0x1dabfa;return _0x1dabfa[_0xfbc6('0x8d')](_0x22c568['body']['ids'],_[_0xfbc6('0x52')](_0x22c568[_0xfbc6('0x4a')],[_0xfbc6('0x64'),'id'])||{});}return null;})[_0xfbc6('0x8e')](function(_0x4af880){var _0x16d1b0;var _0x1d41b8;_0x1e4b67=_0x4af880||[];var _0x3a822b=[];if(_0x4af880){for(var _0x331ba1=0x0;_0x331ba1<_0x4af880['length'];_0x331ba1+=0x1){var _0x491cd9=_0x4af880[_0x331ba1][_0xfbc6('0x28')]({'plain':!![]});_0x16d1b0=squel[_0xfbc6('0x67')]()[_0xfbc6('0x68')](_0xfbc6('0x8f'))[_0xfbc6('0x6a')]([_0xfbc6('0x6f'),'ContactId',_0xfbc6('0x73'),'CampaignId','createdAt',_0xfbc6('0x54')],squel[_0xfbc6('0x6d')]()[_0xfbc6('0x6e')](_0xfbc6('0x6f'),_0xfbc6('0x6f'))[_0xfbc6('0x6e')]('id',_0xfbc6('0x6c'))[_0xfbc6('0x6e')](_0x491cd9[_0xfbc6('0x71')][_0xfbc6('0x72')](),_0xfbc6('0x73'))[_0xfbc6('0x6e')](_0x22c568[_0xfbc6('0x57')]['id'][_0xfbc6('0x72')](),_0xfbc6('0x5a'))[_0xfbc6('0x6e')](_0xfbc6('0x70'),'createdAt')[_0xfbc6('0x6e')](_0xfbc6('0x70'),_0xfbc6('0x54'))[_0xfbc6('0x74')]('cm_contacts')[_0xfbc6('0x3d')](_0xfbc6('0x76'))[_0xfbc6('0x3d')]('ListId\x20=\x20?',_0x491cd9[_0xfbc6('0x71')][_0xfbc6('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xfbc6('0x72')]();_0x3a822b[_0xfbc6('0x88')](db['sequelize']['query'](_0x16d1b0));}return BPromise[_0xfbc6('0x8a')](_0x3a822b);}})[_0xfbc6('0x26')](function(){return _0x1e4b67;})[_0xfbc6('0x26')](respondWithResult(_0x2b3899,null))[_0xfbc6('0x45')](handleError(_0x2b3899,null));};exports['removeBlackLists']=function(_0x5157d5,_0x54d593,_0x343402){return db[_0xfbc6('0x40')][_0xfbc6('0x48')]({'where':{'id':_0x5157d5[_0xfbc6('0x57')]['id']}})[_0xfbc6('0x26')](handleEntityNotFound(_0x54d593,null))[_0xfbc6('0x26')](function(_0x278e05){if(_0x278e05){return _0x278e05['removeBlackLists'](_0x5157d5[_0xfbc6('0x31')][_0xfbc6('0x64')]);}})['then'](function(_0xf1bf7f){if(_0xf1bf7f){return db[_0xfbc6('0x5f')][_0xfbc6('0x27')]({'where':{'ListId':_0x5157d5[_0xfbc6('0x31')]['ids'],'CampaignId':_0x5157d5[_0xfbc6('0x57')]['id']}})['then'](function(){return _0xf1bf7f;});}})[_0xfbc6('0x26')](respondWithStatusCode(_0x54d593,null))[_0xfbc6('0x45')](handleError(_0x54d593,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 099d824..51c2dc5 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xf7b88a,_0x12c26c){var _0x286494=function(_0x22c311){while(--_0x22c311){_0xf7b88a['push'](_0xf7b88a['shift']());}};_0x286494(++_0x12c26c);}(_0x7a54,0x106));var _0x47a5=function(_0x1797e3,_0x4cc700){_0x1797e3=_0x1797e3-0x0;var _0x3f35f5=_0x7a54[_0x1797e3];return _0x3f35f5;};'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 a72e158..aabd15f 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 _0x142c=['message','info','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x666f3c,_0x5d442e){var _0x3a4823=function(_0x16530c){while(--_0x16530c){_0x666f3c['push'](_0x666f3c['shift']());}};_0x3a4823(++_0x5d442e);}(_0x142c,0x86));var _0xc142=function(_0x320d12,_0x4c0ae8){_0x320d12=_0x320d12-0x0;var _0x9b4c7c=_0x142c[_0x320d12];return _0x9b4c7c;};'use strict';var _=require(_0xc142('0x0'));var util=require('util');var moment=require(_0xc142('0x1'));var BPromise=require(_0xc142('0x2'));var rs=require(_0xc142('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc142('0x4'))['db'];var utils=require(_0xc142('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc142('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc142('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6796,_0x43226a,_0x30bf01){return new BPromise(function(_0x4ba28e,_0x5c9b91){return client[_0xc142('0x8')](_0x2d6796,_0x30bf01)[_0xc142('0x9')](function(_0x590002){logger['info'](_0xc142('0xa'),_0x43226a,_0xc142('0xb'));logger['debug'](_0xc142('0xc'),_0x43226a,'request\x20sent',JSON[_0xc142('0xd')](_0x590002));if(_0x590002['error']){if(_0x590002[_0xc142('0xe')][_0xc142('0xf')]===0x1f4){logger[_0xc142('0xe')](_0xc142('0xa'),_0x43226a,_0x590002['error'][_0xc142('0x10')]);return _0x5c9b91(_0x590002[_0xc142('0xe')]['message']);}logger[_0xc142('0xe')]('Campaign,\x20%s,\x20%s',_0x43226a,_0x590002[_0xc142('0xe')]['message']);return _0x4ba28e(_0x590002['error'][_0xc142('0x10')]);}else{logger[_0xc142('0x11')](_0xc142('0xa'),_0x43226a,_0xc142('0xb'));_0x4ba28e(_0x590002['result'][_0xc142('0x10')]);}})[_0xc142('0x12')](function(_0x260844){logger[_0xc142('0xe')](_0xc142('0xa'),_0x43226a,_0x260844);_0x5c9b91(_0x260844);});});}exports[_0xc142('0x13')]=function(_0x59e6c0){var _0x2d55c5=this;return new Promise(function(_0x18fcee,_0x20ead4){return db[_0xc142('0x14')][_0xc142('0x15')]({'raw':_0x59e6c0[_0xc142('0x16')]?_0x59e6c0[_0xc142('0x16')][_0xc142('0x17')]===undefined?!![]:![]:!![],'where':_0x59e6c0[_0xc142('0x16')]?_0x59e6c0[_0xc142('0x16')][_0xc142('0x18')]||null:null,'attributes':_0x59e6c0['options']?_0x59e6c0['options'][_0xc142('0x19')]||null:null,'limit':_0x59e6c0['options']?_0x59e6c0[_0xc142('0x16')][_0xc142('0x1a')]||null:null,'include':_0x59e6c0[_0xc142('0x16')]?_0x59e6c0[_0xc142('0x16')][_0xc142('0x1b')]?_[_0xc142('0x1c')](_0x59e6c0[_0xc142('0x16')][_0xc142('0x1b')],function(_0x4fae76){return{'model':db[_0x4fae76[_0xc142('0x1d')]],'as':_0x4fae76['as'],'attributes':_0x4fae76[_0xc142('0x19')],'include':_0x4fae76[_0xc142('0x1b')]?_[_0xc142('0x1c')](_0x4fae76[_0xc142('0x1b')],function(_0x553a0c){return{'model':db[_0x553a0c[_0xc142('0x1d')]],'as':_0x553a0c['as'],'attributes':_0x553a0c[_0xc142('0x19')],'include':_0x553a0c['include']?_[_0xc142('0x1c')](_0x553a0c[_0xc142('0x1b')],function(_0x4e49ab){return{'model':db[_0x4e49ab['model']],'as':_0x4e49ab['as'],'attributes':_0x4e49ab[_0xc142('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc142('0x9')](function(_0x88d193){logger['info'](_0xc142('0x13'),_0x59e6c0);logger['debug'](_0xc142('0x13'),_0x59e6c0,JSON[_0xc142('0xd')](_0x88d193));_0x18fcee(_0x88d193);})['catch'](function(_0x472372){logger[_0xc142('0xe')](_0xc142('0x13'),_0x472372[_0xc142('0x10')],_0x59e6c0);_0x20ead4(_0x2d55c5[_0xc142('0xe')](0x1f4,_0x472372['message']));});});}; \ No newline at end of file +var _0x9224=['options','raw','where','attributes','limit','include','map','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','findAll'];(function(_0x1e9dfe,_0x13f09f){var _0x5c0b0f=function(_0x2f99af){while(--_0x2f99af){_0x1e9dfe['push'](_0x1e9dfe['shift']());}};_0x5c0b0f(++_0x13f09f);}(_0x9224,0xa3));var _0x4922=function(_0x1238cf,_0xb25e8f){_0x1238cf=_0x1238cf-0x0;var _0x5eec1d=_0x9224[_0x1238cf];return _0x5eec1d;};'use strict';var _=require('lodash');var util=require(_0x4922('0x0'));var moment=require(_0x4922('0x1'));var BPromise=require(_0x4922('0x2'));var rs=require(_0x4922('0x3'));var fs=require('fs');var Redis=require(_0x4922('0x4'));var db=require(_0x4922('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4922('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4922('0x7')][_0x4922('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4216c0,_0x251048,_0x7a8bd1){return new BPromise(function(_0x245562,_0x5c65dd){return client[_0x4922('0x9')](_0x4216c0,_0x7a8bd1)[_0x4922('0xa')](function(_0x50db40){logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));logger[_0x4922('0xe')](_0x4922('0xf'),_0x251048,_0x4922('0xd'),JSON[_0x4922('0x10')](_0x50db40));if(_0x50db40[_0x4922('0x11')]){if(_0x50db40['error'][_0x4922('0x12')]===0x1f4){logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);return _0x5c65dd(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')]['message']);return _0x245562(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}else{logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));_0x245562(_0x50db40[_0x4922('0x14')][_0x4922('0x13')]);}})['catch'](function(_0x2ae924){logger['error'](_0x4922('0xc'),_0x251048,_0x2ae924);_0x5c65dd(_0x2ae924);});});}exports[_0x4922('0x15')]=function(_0x1d7fc2){var _0x15cdc9=this;return new Promise(function(_0x2ef410,_0x435e7b){return db['Campaign'][_0x4922('0x16')]({'raw':_0x1d7fc2[_0x4922('0x17')]?_0x1d7fc2[_0x4922('0x17')][_0x4922('0x18')]===undefined?!![]:![]:!![],'where':_0x1d7fc2[_0x4922('0x17')]?_0x1d7fc2['options'][_0x4922('0x19')]||null:null,'attributes':_0x1d7fc2[_0x4922('0x17')]?_0x1d7fc2[_0x4922('0x17')][_0x4922('0x1a')]||null:null,'limit':_0x1d7fc2[_0x4922('0x17')]?_0x1d7fc2[_0x4922('0x17')][_0x4922('0x1b')]||null:null,'include':_0x1d7fc2[_0x4922('0x17')]?_0x1d7fc2['options'][_0x4922('0x1c')]?_[_0x4922('0x1d')](_0x1d7fc2['options'][_0x4922('0x1c')],function(_0x23ce8d){return{'model':db[_0x23ce8d['model']],'as':_0x23ce8d['as'],'attributes':_0x23ce8d[_0x4922('0x1a')],'include':_0x23ce8d['include']?_[_0x4922('0x1d')](_0x23ce8d[_0x4922('0x1c')],function(_0x26bb17){return{'model':db[_0x26bb17['model']],'as':_0x26bb17['as'],'attributes':_0x26bb17[_0x4922('0x1a')],'include':_0x26bb17[_0x4922('0x1c')]?_[_0x4922('0x1d')](_0x26bb17['include'],function(_0x3eb5d){return{'model':db[_0x3eb5d['model']],'as':_0x3eb5d['as'],'attributes':_0x3eb5d[_0x4922('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4922('0xa')](function(_0x41ef37){logger[_0x4922('0xb')](_0x4922('0x15'),_0x1d7fc2);logger['debug'](_0x4922('0x15'),_0x1d7fc2,JSON['stringify'](_0x41ef37));_0x2ef410(_0x41ef37);})[_0x4922('0x1e')](function(_0x416e26){logger['error']('GetCampaign',_0x416e26['message'],_0x1d7fc2);_0x435e7b(_0x15cdc9[_0x4922('0x11')](0x1f4,_0x416e26['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index aac6ed5..0f7b44b 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 _0xaa81=['/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x596850,_0x57bf08){var _0x110dfb=function(_0x2ce63e){while(--_0x2ce63e){_0x596850['push'](_0x596850['shift']());}};_0x110dfb(++_0x57bf08);}(_0xaa81,0x136));var _0x1aa8=function(_0x4e3d8b,_0x4cd1ee){_0x4e3d8b=_0x4e3d8b-0x0;var _0x1c563f=_0xaa81[_0x4e3d8b];return _0x1c563f;};'use strict';var multer=require('multer');var util=require(_0x1aa8('0x0'));var path=require(_0x1aa8('0x1'));var timeout=require(_0x1aa8('0x2'));var express=require(_0x1aa8('0x3'));var router=express[_0x1aa8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1aa8('0x5'));var interaction=require(_0x1aa8('0x6'));var config=require(_0x1aa8('0x7'));var controller=require(_0x1aa8('0x8'));router[_0x1aa8('0x9')]('/',auth[_0x1aa8('0xa')](),controller[_0x1aa8('0xb')]);router[_0x1aa8('0x9')](_0x1aa8('0xc'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0xd')]);router[_0x1aa8('0x9')](_0x1aa8('0xe'),auth['isAuthenticated'](),controller[_0x1aa8('0xf')]);router[_0x1aa8('0x9')]('/:id/hopper_histories',auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x10')]);router['get']('/:id/hopper_finals',auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x11')]);router[_0x1aa8('0x9')](_0x1aa8('0x12'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x13')]);router[_0x1aa8('0x9')]('/:id/lists',auth[_0x1aa8('0xa')](),controller['getLists']);router['get'](_0x1aa8('0x14'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x15')]);router[_0x1aa8('0x16')]('/',auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x17')]);router['post'](_0x1aa8('0x18'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x19')]);router[_0x1aa8('0x16')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x1aa8('0x16')]('/:id/blacklists',auth[_0x1aa8('0xa')](),controller['addBlackLists']);router['put'](_0x1aa8('0xc'),auth['isAuthenticated'](),controller[_0x1aa8('0x1a')]);router[_0x1aa8('0x1b')](_0x1aa8('0xc'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x1c')]);router[_0x1aa8('0x1b')](_0x1aa8('0x1d'),auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x1e')]);router[_0x1aa8('0x1b')]('/:id/blacklists',auth[_0x1aa8('0xa')](),controller[_0x1aa8('0x1f')]);module[_0x1aa8('0x20')]=router; \ No newline at end of file +var _0x1445=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperHistories','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','multer','util'];(function(_0x60a07f,_0x3cfed8){var _0x500cdd=function(_0x5874ea){while(--_0x5874ea){_0x60a07f['push'](_0x60a07f['shift']());}};_0x500cdd(++_0x3cfed8);}(_0x1445,0xa3));var _0x5144=function(_0x23a32f,_0x115c93){_0x23a32f=_0x23a32f-0x0;var _0x54eaf6=_0x1445[_0x23a32f];return _0x54eaf6;};'use strict';var multer=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var path=require('path');var timeout=require(_0x5144('0x2'));var express=require(_0x5144('0x3'));var router=express[_0x5144('0x4')]();var fs_extra=require(_0x5144('0x5'));var auth=require(_0x5144('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5144('0x7'));var controller=require('./campaign.controller');router[_0x5144('0x8')]('/',auth[_0x5144('0x9')](),controller[_0x5144('0xa')]);router[_0x5144('0x8')](_0x5144('0xb'),auth['isAuthenticated'](),controller[_0x5144('0xc')]);router[_0x5144('0x8')](_0x5144('0xd'),auth[_0x5144('0x9')](),controller['getHoppers']);router[_0x5144('0x8')]('/:id/hopper_histories',auth[_0x5144('0x9')](),controller[_0x5144('0xe')]);router[_0x5144('0x8')]('/:id/hopper_finals',auth[_0x5144('0x9')](),controller[_0x5144('0xf')]);router[_0x5144('0x8')]('/:id/hopper_black',auth[_0x5144('0x9')](),controller[_0x5144('0x10')]);router['get']('/:id/lists',auth[_0x5144('0x9')](),controller[_0x5144('0x11')]);router[_0x5144('0x8')](_0x5144('0x12'),auth[_0x5144('0x9')](),controller[_0x5144('0x13')]);router['post']('/',auth[_0x5144('0x9')](),controller[_0x5144('0x14')]);router[_0x5144('0x15')](_0x5144('0x16'),auth[_0x5144('0x9')](),controller[_0x5144('0x17')]);router['post']('/:id/lists',auth[_0x5144('0x9')](),controller['addLists']);router[_0x5144('0x15')](_0x5144('0x12'),auth['isAuthenticated'](),controller[_0x5144('0x18')]);router[_0x5144('0x19')](_0x5144('0xb'),auth[_0x5144('0x9')](),controller[_0x5144('0x1a')]);router[_0x5144('0x1b')](_0x5144('0xb'),auth[_0x5144('0x9')](),controller[_0x5144('0x1c')]);router[_0x5144('0x1b')](_0x5144('0x1d'),auth['isAuthenticated'](),controller[_0x5144('0x1e')]);router[_0x5144('0x1b')](_0x5144('0x12'),auth[_0x5144('0x9')](),controller[_0x5144('0x1f')]);module[_0x5144('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f7f5d36..c75eed8 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 _0xa2ed=['getDataValue','sequelize','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x8e1a06,_0x2035f9){var _0x169a32=function(_0x503061){while(--_0x503061){_0x8e1a06['push'](_0x8e1a06['shift']());}};_0x169a32(++_0x2035f9);}(_0xa2ed,0x15f));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda2e('0x0'));module[_0xda2e('0x1')]={'key':{'type':Sequelize[_0xda2e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xda2e('0x3')],'length':_0xda2e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xda2e('0x2')]},'name':{'type':Sequelize[_0xda2e('0x5')],'get':function(){return this[_0xda2e('0x6')]('key');}}}; \ No newline at end of file +var _0xc9fe=['STRING','VIRTUAL','key','exports','TEXT','medium'];(function(_0x216b8a,_0x459a11){var _0x344626=function(_0x27c690){while(--_0x27c690){_0x216b8a['push'](_0x216b8a['shift']());}};_0x344626(++_0x459a11);}(_0xc9fe,0x1b9));var _0xec9f=function(_0x30c5c6,_0x43db74){_0x30c5c6=_0x30c5c6-0x0;var _0x2aaa31=_0xc9fe[_0x30c5c6];return _0x2aaa31;};'use strict';var Sequelize=require('sequelize');module[_0xec9f('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xec9f('0x1')],'length':_0xec9f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xec9f('0x3')]},'name':{'type':Sequelize[_0xec9f('0x4')],'get':function(){return this['getDataValue'](_0xec9f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3001e8a..eab278e 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 _0xa4db=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','find','catch','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','get','UserProfileResource','destroy','error','name','send','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x170ae0,_0x2e66ad){var _0x28bfd5=function(_0x326e37){while(--_0x326e37){_0x170ae0['push'](_0x170ae0['shift']());}};_0x28bfd5(++_0x2e66ad);}(_0xa4db,0x12e));var _0xba4d=function(_0x5a1552,_0x8b26d1){_0x5a1552=_0x5a1552-0x0;var _0x2a6de3=_0xa4db[_0x5a1552];return _0x2a6de3;};'use strict';var emlformat=require(_0xba4d('0x0'));var rimraf=require(_0xba4d('0x1'));var zipdir=require(_0xba4d('0x2'));var jsonpatch=require(_0xba4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba4d('0x4'));var Mustache=require(_0xba4d('0x5'));var util=require(_0xba4d('0x6'));var path=require('path');var sox=require(_0xba4d('0x7'));var csv=require(_0xba4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba4d('0x9'));var _=require(_0xba4d('0xa'));var squel=require('squel');var crypto=require(_0xba4d('0xb'));var jsforce=require(_0xba4d('0xc'));var deskjs=require(_0xba4d('0xd'));var toCsv=require(_0xba4d('0x8'));var querystring=require(_0xba4d('0xe'));var Papa=require(_0xba4d('0xf'));var Redis=require('ioredis');var authService=require(_0xba4d('0x10'));var qs=require(_0xba4d('0x11'));var as=require(_0xba4d('0x12'));var hardwareService=require(_0xba4d('0x13'));var logger=require(_0xba4d('0x14'))(_0xba4d('0x15'));var utils=require(_0xba4d('0x16'));var config=require(_0xba4d('0x17'));var licenseUtil=require(_0xba4d('0x18'));var db=require(_0xba4d('0x19'))['db'];function respondWithStatusCode(_0x53f3ec,_0x22ace5){_0x22ace5=_0x22ace5||0xcc;return function(_0x75aae3){if(_0x75aae3){return _0x53f3ec[_0xba4d('0x1a')](_0x22ace5);}return _0x53f3ec[_0xba4d('0x1b')](_0x22ace5)[_0xba4d('0x1c')]();};}function respondWithResult(_0x4c072b,_0x27fbb7){_0x27fbb7=_0x27fbb7||0xc8;return function(_0x1dbbf3){if(_0x1dbbf3){return _0x4c072b[_0xba4d('0x1b')](_0x27fbb7)[_0xba4d('0x1d')](_0x1dbbf3);}};}function respondWithFilteredResult(_0xe96aa6,_0x456101){return function(_0x4e03c4){if(_0x4e03c4){var _0x415a0c=typeof _0x456101['offset']===_0xba4d('0x1e')&&typeof _0x456101[_0xba4d('0x1f')]===_0xba4d('0x1e');var _0x4bee67=_0x4e03c4['count'];var _0x399cd6=_0x415a0c?0x0:_0x456101[_0xba4d('0x20')];var _0x1cf230=_0x415a0c?_0x4e03c4[_0xba4d('0x21')]:_0x456101[_0xba4d('0x20')]+_0x456101['limit'];var _0x260fb2;if(_0x1cf230>=_0x4bee67){_0x1cf230=_0x4bee67;_0x260fb2=0xc8;}else{_0x260fb2=0xce;}_0xe96aa6['status'](_0x260fb2);return _0xe96aa6[_0xba4d('0x22')](_0xba4d('0x23'),_0x399cd6+'-'+_0x1cf230+'/'+_0x4bee67)['json'](_0x4e03c4);}return null;};}function patchUpdates(_0x3e9519){return function(_0x5abfdf){try{jsonpatch['apply'](_0x5abfdf,_0x3e9519,!![]);}catch(_0x2b704e){return BPromise[_0xba4d('0x24')](_0x2b704e);}return _0x5abfdf[_0xba4d('0x25')]();};}function saveUpdates(_0x53595a,_0x822dae){return function(_0x109ce7){if(_0x109ce7){return _0x109ce7['update'](_0x53595a)['then'](function(_0x1bbada){return _0x1bbada;});}return null;};}function removeEntity(_0x7e002,_0x3ed74d){return function(_0x4b276b){if(_0x4b276b){return _0x4b276b['destroy']()[_0xba4d('0x26')](function(){var _0x36983b=_0x4b276b[_0xba4d('0x27')]({'plain':!![]});var _0x4e4400='CannedAnswers';return db[_0xba4d('0x28')][_0xba4d('0x29')]({'where':{'type':_0x4e4400,'resourceId':_0x36983b['id']}})['then'](function(){return _0x4b276b;});})[_0xba4d('0x26')](function(){_0x7e002[_0xba4d('0x1b')](0xcc)[_0xba4d('0x1c')]();});}};}function handleEntityNotFound(_0x32b3c4,_0x750bbb){return function(_0x43031a){if(!_0x43031a){_0x32b3c4['sendStatus'](0x194);}return _0x43031a;};}function handleError(_0x877fa9,_0x599e6d){_0x599e6d=_0x599e6d||0x1f4;return function(_0x107dbd){logger[_0xba4d('0x2a')](_0x107dbd['stack']);if(_0x107dbd[_0xba4d('0x2b')]){delete _0x107dbd[_0xba4d('0x2b')];}_0x877fa9[_0xba4d('0x1b')](_0x599e6d)[_0xba4d('0x2c')](_0x107dbd);};}exports['index']=function(_0x5a86c1,_0x588a79){var _0x3e59ed={},_0x491535={},_0x276e5c={'count':0x0,'rows':[]};var _0x537c63=_[_0xba4d('0x2d')](db[_0xba4d('0x2e')][_0xba4d('0x2f')],function(_0x116183){return{'name':_0x116183['fieldName'],'type':_0x116183[_0xba4d('0x30')][_0xba4d('0x31')]};});_0x491535[_0xba4d('0x32')]=_[_0xba4d('0x2d')](_0x537c63,'name');_0x491535[_0xba4d('0x33')]=_[_0xba4d('0x34')](_0x5a86c1[_0xba4d('0x33')]);_0x491535[_0xba4d('0x35')]=_[_0xba4d('0x36')](_0x491535['model'],_0x491535[_0xba4d('0x33')]);_0x3e59ed[_0xba4d('0x37')]=_[_0xba4d('0x36')](_0x491535[_0xba4d('0x32')],qs['fields'](_0x5a86c1[_0xba4d('0x33')][_0xba4d('0x38')]));_0x3e59ed[_0xba4d('0x37')]=_0x3e59ed[_0xba4d('0x37')][_0xba4d('0x39')]?_0x3e59ed[_0xba4d('0x37')]:_0x491535['model'];if(!_0x5a86c1['query'][_0xba4d('0x3a')](_0xba4d('0x3b'))){_0x3e59ed['limit']=qs[_0xba4d('0x1f')](_0x5a86c1[_0xba4d('0x33')]['limit']);_0x3e59ed[_0xba4d('0x20')]=qs[_0xba4d('0x20')](_0x5a86c1[_0xba4d('0x33')][_0xba4d('0x20')]);}_0x3e59ed[_0xba4d('0x3c')]=qs[_0xba4d('0x3d')](_0x5a86c1[_0xba4d('0x33')][_0xba4d('0x3d')]);_0x3e59ed[_0xba4d('0x3e')]=qs[_0xba4d('0x35')](_[_0xba4d('0x3f')](_0x5a86c1[_0xba4d('0x33')],_0x491535[_0xba4d('0x35')]),_0x537c63);if(_0x5a86c1['query'][_0xba4d('0x40')]){_0x3e59ed['where']=_[_0xba4d('0x41')](_0x3e59ed[_0xba4d('0x3e')],{'$or':[{'key':{'$like':'%'+_0x5a86c1[_0xba4d('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x5a86c1[_0xba4d('0x33')][_0xba4d('0x40')]+'%'}}]});}_0x3e59ed=_[_0xba4d('0x41')]({},_0x3e59ed,_0x5a86c1['options']);var _0xb2808d={'where':_0x3e59ed[_0xba4d('0x3e')]};return db[_0xba4d('0x2e')][_0xba4d('0x21')](_0xb2808d)['then'](function(_0x3aaed6){_0x276e5c[_0xba4d('0x21')]=_0x3aaed6;if(_0x5a86c1[_0xba4d('0x33')][_0xba4d('0x42')]){_0x3e59ed[_0xba4d('0x43')]=[{'all':!![]}];}return db[_0xba4d('0x2e')][_0xba4d('0x44')](_0x3e59ed);})[_0xba4d('0x26')](function(_0x17af53){_0x276e5c[_0xba4d('0x45')]=_0x17af53;return _0x276e5c;})['then'](respondWithFilteredResult(_0x588a79,_0x3e59ed))['catch'](handleError(_0x588a79,null));};exports['show']=function(_0x8fa85f,_0x3a801c){var _0x1dadfd={'raw':!![],'where':{'id':_0x8fa85f[_0xba4d('0x46')]['id']}},_0xc0485={};_0xc0485[_0xba4d('0x32')]=_[_0xba4d('0x34')](db[_0xba4d('0x2e')][_0xba4d('0x2f')]);_0xc0485[_0xba4d('0x33')]=_['keys'](_0x8fa85f[_0xba4d('0x33')]);_0xc0485[_0xba4d('0x35')]=_[_0xba4d('0x36')](_0xc0485['model'],_0xc0485['query']);_0x1dadfd[_0xba4d('0x37')]=_['intersection'](_0xc0485[_0xba4d('0x32')],qs[_0xba4d('0x38')](_0x8fa85f[_0xba4d('0x33')][_0xba4d('0x38')]));_0x1dadfd[_0xba4d('0x37')]=_0x1dadfd[_0xba4d('0x37')][_0xba4d('0x39')]?_0x1dadfd[_0xba4d('0x37')]:_0xc0485[_0xba4d('0x32')];if(_0x8fa85f[_0xba4d('0x33')][_0xba4d('0x42')]){_0x1dadfd['include']=[{'all':!![]}];}_0x1dadfd=_[_0xba4d('0x41')]({},_0x1dadfd,_0x8fa85f['options']);return db[_0xba4d('0x2e')][_0xba4d('0x47')](_0x1dadfd)[_0xba4d('0x26')](handleEntityNotFound(_0x3a801c,null))[_0xba4d('0x26')](respondWithResult(_0x3a801c,null))[_0xba4d('0x48')](handleError(_0x3a801c,null));};exports[_0xba4d('0x49')]=function(_0x120ea6,_0x3b7802){if(_0x120ea6[_0xba4d('0x4a')]['id']){delete _0x120ea6[_0xba4d('0x4a')]['id'];}return db[_0xba4d('0x2e')]['find']({'where':{'id':_0x120ea6[_0xba4d('0x46')]['id']}})[_0xba4d('0x26')](handleEntityNotFound(_0x3b7802,null))[_0xba4d('0x26')](saveUpdates(_0x120ea6['body'],null))[_0xba4d('0x26')](respondWithResult(_0x3b7802,null))[_0xba4d('0x48')](handleError(_0x3b7802,null));};exports[_0xba4d('0x29')]=function(_0x4bf6c6,_0x1b1f8d){return db[_0xba4d('0x2e')]['find']({'where':{'id':_0x4bf6c6[_0xba4d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1f8d,null))[_0xba4d('0x26')](removeEntity(_0x1b1f8d,null))[_0xba4d('0x48')](handleError(_0x1b1f8d,null));};exports['create']=function(_0x12dc05,_0x4e6d4c){var _0x4be4c4={'key':_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x31')]};if(_0x12dc05['body']['MailAccountId']){_0x4be4c4[_0xba4d('0x4b')]=_0x12dc05[_0xba4d('0x4a')]['MailAccountId'];}else if(_0x12dc05['body'][_0xba4d('0x4c')]){_0x4be4c4[_0xba4d('0x4c')]=_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x4c')];}else if(_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x4d')]){_0x4be4c4['OpenchannelAccountId']=_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x4d')];}else if(_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x4e')]){_0x4be4c4[_0xba4d('0x4e')]=_0x12dc05[_0xba4d('0x4a')][_0xba4d('0x4e')];}return db[_0xba4d('0x2e')][_0xba4d('0x47')]({'where':_0x4be4c4})['then'](function(_0x2eb1ad){if(_0x2eb1ad){throw new db[(_0xba4d('0x4f'))][(_0xba4d('0x50'))](_0xba4d('0x51'));}return db['CannedAnswer'][_0xba4d('0x52')](_0x12dc05[_0xba4d('0x4a')]);})['then'](function(_0xe60650){var _0x210ad5=_0x12dc05[_0xba4d('0x53')][_0xba4d('0x27')]({'plain':!![]});if(!_0x210ad5)throw new Error(_0xba4d('0x54'));if(_0x210ad5[_0xba4d('0x55')]===_0xba4d('0x53')){var _0x33fb16=_0xe60650[_0xba4d('0x27')]({'plain':!![]});return db[_0xba4d('0x56')][_0xba4d('0x47')]({'where':{'name':_0xba4d('0x57'),'userProfileId':_0x210ad5[_0xba4d('0x58')]},'raw':!![]})['then'](function(_0x17dc46){if(_0x17dc46&&_0x17dc46['autoAssociation']===0x0){return db[_0xba4d('0x28')][_0xba4d('0x52')]({'name':_0x33fb16[_0xba4d('0x2b')],'resourceId':_0x33fb16['id'],'type':_0x17dc46[_0xba4d('0x2b')],'sectionId':_0x17dc46['id']},{})[_0xba4d('0x26')](function(){return _0xe60650;});}else{return _0xe60650;}})[_0xba4d('0x48')](function(_0x478974){logger[_0xba4d('0x2a')](_0xba4d('0x59'),_0x478974);throw _0x478974;});}return _0xe60650;})['then'](respondWithResult(_0x4e6d4c,0xc9))[_0xba4d('0x48')](handleError(_0x4e6d4c,null));}; \ No newline at end of file +var _0x92ff=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x92ff,0x118));var _0xf92f=function(_0x3b968d,_0x1bf92a){_0x3b968d=_0x3b968d-0x0;var _0x565012=_0x92ff[_0x3b968d];return _0x565012;};'use strict';var emlformat=require(_0xf92f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf92f('0x1'));var rp=require(_0xf92f('0x2'));var moment=require(_0xf92f('0x3'));var BPromise=require(_0xf92f('0x4'));var Mustache=require(_0xf92f('0x5'));var util=require('util');var path=require(_0xf92f('0x6'));var sox=require(_0xf92f('0x7'));var csv=require('to-csv');var ejs=require(_0xf92f('0x8'));var fs=require('fs');var fs_extra=require(_0xf92f('0x9'));var _=require('lodash');var squel=require(_0xf92f('0xa'));var crypto=require(_0xf92f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf92f('0xc'));var toCsv=require(_0xf92f('0xd'));var querystring=require(_0xf92f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf92f('0xf'));var authService=require(_0xf92f('0x10'));var qs=require(_0xf92f('0x11'));var as=require(_0xf92f('0x12'));var hardwareService=require(_0xf92f('0x13'));var logger=require(_0xf92f('0x14'))(_0xf92f('0x15'));var utils=require(_0xf92f('0x16'));var config=require(_0xf92f('0x17'));var licenseUtil=require(_0xf92f('0x18'));var db=require(_0xf92f('0x19'))['db'];function respondWithStatusCode(_0x51db28,_0x497030){_0x497030=_0x497030||0xcc;return function(_0x2e4a0d){if(_0x2e4a0d){return _0x51db28[_0xf92f('0x1a')](_0x497030);}return _0x51db28[_0xf92f('0x1b')](_0x497030)[_0xf92f('0x1c')]();};}function respondWithResult(_0x566a02,_0x2ff88a){_0x2ff88a=_0x2ff88a||0xc8;return function(_0x5773d1){if(_0x5773d1){return _0x566a02['status'](_0x2ff88a)[_0xf92f('0x1d')](_0x5773d1);}};}function respondWithFilteredResult(_0x565a4f,_0x586585){return function(_0x3bd8c2){if(_0x3bd8c2){var _0x4f2248=typeof _0x586585[_0xf92f('0x1e')]===_0xf92f('0x1f')&&typeof _0x586585[_0xf92f('0x20')]===_0xf92f('0x1f');var _0x2584a5=_0x3bd8c2[_0xf92f('0x21')];var _0x58f139=_0x4f2248?0x0:_0x586585[_0xf92f('0x1e')];var _0x3e59c9=_0x4f2248?_0x3bd8c2['count']:_0x586585[_0xf92f('0x1e')]+_0x586585[_0xf92f('0x20')];var _0x1d052e;if(_0x3e59c9>=_0x2584a5){_0x3e59c9=_0x2584a5;_0x1d052e=0xc8;}else{_0x1d052e=0xce;}_0x565a4f[_0xf92f('0x1b')](_0x1d052e);return _0x565a4f['set'](_0xf92f('0x22'),_0x58f139+'-'+_0x3e59c9+'/'+_0x2584a5)[_0xf92f('0x1d')](_0x3bd8c2);}return null;};}function patchUpdates(_0x1a47de){return function(_0x57c5b9){try{jsonpatch[_0xf92f('0x23')](_0x57c5b9,_0x1a47de,!![]);}catch(_0x56bc24){return BPromise[_0xf92f('0x24')](_0x56bc24);}return _0x57c5b9[_0xf92f('0x25')]();};}function saveUpdates(_0x2644f9,_0x42b939){return function(_0x4abf18){if(_0x4abf18){return _0x4abf18[_0xf92f('0x26')](_0x2644f9)[_0xf92f('0x27')](function(_0x4252b9){return _0x4252b9;});}return null;};}function removeEntity(_0x1729ca,_0x5f3099){return function(_0x1ae76d){if(_0x1ae76d){return _0x1ae76d[_0xf92f('0x28')]()[_0xf92f('0x27')](function(){var _0x4a4329=_0x1ae76d[_0xf92f('0x29')]({'plain':!![]});var _0x2bed05=_0xf92f('0x2a');return db[_0xf92f('0x2b')][_0xf92f('0x28')]({'where':{'type':_0x2bed05,'resourceId':_0x4a4329['id']}})[_0xf92f('0x27')](function(){return _0x1ae76d;});})[_0xf92f('0x27')](function(){_0x1729ca[_0xf92f('0x1b')](0xcc)[_0xf92f('0x1c')]();});}};}function handleEntityNotFound(_0x446dfc,_0x437f1d){return function(_0x24928b){if(!_0x24928b){_0x446dfc[_0xf92f('0x1a')](0x194);}return _0x24928b;};}function handleError(_0x2816da,_0x20ba6d){_0x20ba6d=_0x20ba6d||0x1f4;return function(_0x50f67f){logger[_0xf92f('0x2c')](_0x50f67f[_0xf92f('0x2d')]);if(_0x50f67f['name']){delete _0x50f67f[_0xf92f('0x2e')];}_0x2816da['status'](_0x20ba6d)[_0xf92f('0x2f')](_0x50f67f);};}exports[_0xf92f('0x30')]=function(_0x3df235,_0x3e1603){var _0x5d12d1={},_0x3d4f2b={},_0x25e8f8={'count':0x0,'rows':[]};var _0x291a47=_[_0xf92f('0x31')](db[_0xf92f('0x32')][_0xf92f('0x33')],function(_0x140a8d){return{'name':_0x140a8d['fieldName'],'type':_0x140a8d[_0xf92f('0x34')][_0xf92f('0x35')]};});_0x3d4f2b[_0xf92f('0x36')]=_[_0xf92f('0x31')](_0x291a47,_0xf92f('0x2e'));_0x3d4f2b[_0xf92f('0x37')]=_[_0xf92f('0x38')](_0x3df235[_0xf92f('0x37')]);_0x3d4f2b[_0xf92f('0x39')]=_[_0xf92f('0x3a')](_0x3d4f2b[_0xf92f('0x36')],_0x3d4f2b['query']);_0x5d12d1['attributes']=_['intersection'](_0x3d4f2b[_0xf92f('0x36')],qs['fields'](_0x3df235[_0xf92f('0x37')][_0xf92f('0x3b')]));_0x5d12d1[_0xf92f('0x3c')]=_0x5d12d1[_0xf92f('0x3c')][_0xf92f('0x3d')]?_0x5d12d1[_0xf92f('0x3c')]:_0x3d4f2b[_0xf92f('0x36')];if(!_0x3df235[_0xf92f('0x37')]['hasOwnProperty'](_0xf92f('0x3e'))){_0x5d12d1[_0xf92f('0x20')]=qs['limit'](_0x3df235[_0xf92f('0x37')]['limit']);_0x5d12d1['offset']=qs['offset'](_0x3df235[_0xf92f('0x37')][_0xf92f('0x1e')]);}_0x5d12d1[_0xf92f('0x3f')]=qs[_0xf92f('0x40')](_0x3df235['query'][_0xf92f('0x40')]);_0x5d12d1['where']=qs[_0xf92f('0x39')](_[_0xf92f('0x41')](_0x3df235[_0xf92f('0x37')],_0x3d4f2b[_0xf92f('0x39')]),_0x291a47);if(_0x3df235[_0xf92f('0x37')][_0xf92f('0x42')]){_0x5d12d1[_0xf92f('0x43')]=_[_0xf92f('0x44')](_0x5d12d1[_0xf92f('0x43')],{'$or':[{'key':{'$like':'%'+_0x3df235[_0xf92f('0x37')][_0xf92f('0x42')]+'%'}},{'value':{'$like':'%'+_0x3df235[_0xf92f('0x37')][_0xf92f('0x42')]+'%'}}]});}_0x5d12d1=_[_0xf92f('0x44')]({},_0x5d12d1,_0x3df235['options']);var _0x4aede5={'where':_0x5d12d1[_0xf92f('0x43')]};return db[_0xf92f('0x32')][_0xf92f('0x21')](_0x4aede5)['then'](function(_0x5eb3f9){_0x25e8f8[_0xf92f('0x21')]=_0x5eb3f9;if(_0x3df235[_0xf92f('0x37')][_0xf92f('0x45')]){_0x5d12d1[_0xf92f('0x46')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf92f('0x47')](_0x5d12d1);})['then'](function(_0x25b18c){_0x25e8f8[_0xf92f('0x48')]=_0x25b18c;return _0x25e8f8;})[_0xf92f('0x27')](respondWithFilteredResult(_0x3e1603,_0x5d12d1))[_0xf92f('0x49')](handleError(_0x3e1603,null));};exports[_0xf92f('0x4a')]=function(_0x2786c2,_0x12f088){var _0x359cb2={'raw':!![],'where':{'id':_0x2786c2[_0xf92f('0x4b')]['id']}},_0x287e6b={};_0x287e6b[_0xf92f('0x36')]=_[_0xf92f('0x38')](db[_0xf92f('0x32')][_0xf92f('0x33')]);_0x287e6b[_0xf92f('0x37')]=_[_0xf92f('0x38')](_0x2786c2[_0xf92f('0x37')]);_0x287e6b['filters']=_['intersection'](_0x287e6b[_0xf92f('0x36')],_0x287e6b['query']);_0x359cb2[_0xf92f('0x3c')]=_[_0xf92f('0x3a')](_0x287e6b['model'],qs[_0xf92f('0x3b')](_0x2786c2[_0xf92f('0x37')]['fields']));_0x359cb2[_0xf92f('0x3c')]=_0x359cb2[_0xf92f('0x3c')][_0xf92f('0x3d')]?_0x359cb2[_0xf92f('0x3c')]:_0x287e6b[_0xf92f('0x36')];if(_0x2786c2[_0xf92f('0x37')][_0xf92f('0x45')]){_0x359cb2[_0xf92f('0x46')]=[{'all':!![]}];}_0x359cb2=_[_0xf92f('0x44')]({},_0x359cb2,_0x2786c2[_0xf92f('0x4c')]);return db['CannedAnswer'][_0xf92f('0x4d')](_0x359cb2)[_0xf92f('0x27')](handleEntityNotFound(_0x12f088,null))[_0xf92f('0x27')](respondWithResult(_0x12f088,null))[_0xf92f('0x49')](handleError(_0x12f088,null));};exports[_0xf92f('0x26')]=function(_0x251a0f,_0x304cfe){if(_0x251a0f[_0xf92f('0x4e')]['id']){delete _0x251a0f[_0xf92f('0x4e')]['id'];}return db[_0xf92f('0x32')][_0xf92f('0x4d')]({'where':{'id':_0x251a0f[_0xf92f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x304cfe,null))['then'](saveUpdates(_0x251a0f['body'],null))[_0xf92f('0x27')](respondWithResult(_0x304cfe,null))[_0xf92f('0x49')](handleError(_0x304cfe,null));};exports['destroy']=function(_0x333ce0,_0x4331e1){return db[_0xf92f('0x32')][_0xf92f('0x4d')]({'where':{'id':_0x333ce0[_0xf92f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4331e1,null))[_0xf92f('0x27')](removeEntity(_0x4331e1,null))[_0xf92f('0x49')](handleError(_0x4331e1,null));};exports[_0xf92f('0x4f')]=function(_0x478370,_0x5f5413){var _0x59a300={'key':_0x478370[_0xf92f('0x4e')]['key']};if(_0x478370[_0xf92f('0x4e')][_0xf92f('0x50')]){_0x59a300[_0xf92f('0x50')]=_0x478370[_0xf92f('0x4e')][_0xf92f('0x50')];}else if(_0x478370[_0xf92f('0x4e')][_0xf92f('0x51')]){_0x59a300['SmsAccountId']=_0x478370[_0xf92f('0x4e')][_0xf92f('0x51')];}else if(_0x478370[_0xf92f('0x4e')][_0xf92f('0x52')]){_0x59a300[_0xf92f('0x52')]=_0x478370[_0xf92f('0x4e')][_0xf92f('0x52')];}else if(_0x478370[_0xf92f('0x4e')][_0xf92f('0x53')]){_0x59a300[_0xf92f('0x53')]=_0x478370[_0xf92f('0x4e')][_0xf92f('0x53')];}return db[_0xf92f('0x32')][_0xf92f('0x4d')]({'where':_0x59a300})[_0xf92f('0x27')](function(_0x579e06){if(_0x579e06){throw new db[(_0xf92f('0x54'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xf92f('0x32')]['create'](_0x478370['body']);})[_0xf92f('0x27')](function(_0x107c8d){var _0x402b57=_0x478370[_0xf92f('0x55')]['get']({'plain':!![]});if(!_0x402b57)throw new Error(_0xf92f('0x56'));if(_0x402b57[_0xf92f('0x57')]===_0xf92f('0x55')){var _0x3819ab=_0x107c8d['get']({'plain':!![]});return db[_0xf92f('0x58')][_0xf92f('0x4d')]({'where':{'name':'CannedAnswers','userProfileId':_0x402b57[_0xf92f('0x59')]},'raw':!![]})[_0xf92f('0x27')](function(_0x5554f9){if(_0x5554f9&&_0x5554f9[_0xf92f('0x5a')]===0x0){return db[_0xf92f('0x2b')][_0xf92f('0x4f')]({'name':_0x3819ab[_0xf92f('0x2e')],'resourceId':_0x3819ab['id'],'type':_0x5554f9['name'],'sectionId':_0x5554f9['id']},{})[_0xf92f('0x27')](function(){return _0x107c8d;});}else{return _0x107c8d;}})[_0xf92f('0x49')](function(_0x25d8d7){logger[_0xf92f('0x2c')](_0xf92f('0x5b'),_0x25d8d7);throw _0x25d8d7;});}return _0x107c8d;})['then'](respondWithResult(_0x5f5413,0xc9))[_0xf92f('0x49')](handleError(_0x5f5413,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a6a4d0e..c493c0f 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 _0xba10=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xba10,0x70));var _0x0ba1=function(_0x11ed89,_0x5930df){_0x11ed89=_0x11ed89-0x0;var _0xef0497=_0xba10[_0x11ed89];return _0xef0497;};'use strict';var _=require(_0x0ba1('0x0'));var util=require(_0x0ba1('0x1'));var logger=require(_0x0ba1('0x2'))(_0x0ba1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ba1('0x4'));var fs=require('fs');var path=require(_0x0ba1('0x5'));var rimraf=require(_0x0ba1('0x6'));var config=require(_0x0ba1('0x7'));var attributes=require(_0x0ba1('0x8'));module[_0x0ba1('0x9')]=function(_0x482081,_0x1e71f7){return _0x482081[_0x0ba1('0xa')](_0x0ba1('0xb'),attributes,{'tableName':_0x0ba1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ba1('0xd'),'collate':_0x0ba1('0xe')});}; \ No newline at end of file +var _0x8fde=['util','api','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x8fde,0x138));var _0xe8fd=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8fde[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0xe8fd('0x0'));var logger=require('../../config/logger')(_0xe8fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8fd('0x2'));var rimraf=require(_0xe8fd('0x3'));var config=require(_0xe8fd('0x4'));var attributes=require(_0xe8fd('0x5'));module[_0xe8fd('0x6')]=function(_0x2c8125,_0x289235){return _0x2c8125[_0xe8fd('0x7')](_0xe8fd('0x8'),attributes,{'tableName':_0xe8fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8fd('0xa'),'collate':_0xe8fd('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2933cbd..2736216 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(_0x34e935,_0x146bf2){var _0x515d56=function(_0x173010){while(--_0x173010){_0x34e935['push'](_0x34e935['shift']());}};_0x515d56(++_0x146bf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x180342,_0x58a67b){var _0x23e0f7=function(_0x14c8bf){while(--_0x14c8bf){_0x180342['push'](_0x180342['shift']());}};_0x23e0f7(++_0x58a67b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b63bccc..f251339 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 _0xc807=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x13403b,_0x431a8c){var _0x23c821=function(_0x554f6){while(--_0x554f6){_0x13403b['push'](_0x13403b['shift']());}};_0x23c821(++_0x431a8c);}(_0xc807,0x1a9));var _0x7c80=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xc807[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x7c80('0x0'));var util=require(_0x7c80('0x1'));var path=require(_0x7c80('0x2'));var timeout=require(_0x7c80('0x3'));var express=require(_0x7c80('0x4'));var router=express[_0x7c80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7c80('0x6'));var interaction=require(_0x7c80('0x7'));var config=require(_0x7c80('0x8'));var controller=require(_0x7c80('0x9'));router['get']('/',auth[_0x7c80('0xa')](),controller['index']);router[_0x7c80('0xb')](_0x7c80('0xc'),auth[_0x7c80('0xa')](),controller[_0x7c80('0xd')]);router['post']('/',auth[_0x7c80('0xa')](),controller[_0x7c80('0xe')]);router['put']('/:id',auth[_0x7c80('0xa')](),controller[_0x7c80('0xf')]);router[_0x7c80('0x10')](_0x7c80('0xc'),auth[_0x7c80('0xa')](),controller[_0x7c80('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbc87=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x5c56ef,_0x32b007){var _0x5f03ca=function(_0x44ce5c){while(--_0x44ce5c){_0x5c56ef['push'](_0x5c56ef['shift']());}};_0x5f03ca(++_0x32b007);}(_0xbc87,0x199));var _0x7bc8=function(_0x109e39,_0x27f91c){_0x109e39=_0x109e39-0x0;var _0x3b142f=_0xbc87[_0x109e39];return _0x3b142f;};'use strict';var multer=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var path=require(_0x7bc8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7bc8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7bc8('0x4'));var interaction=require(_0x7bc8('0x5'));var config=require(_0x7bc8('0x6'));var controller=require(_0x7bc8('0x7'));router[_0x7bc8('0x8')]('/',auth[_0x7bc8('0x9')](),controller[_0x7bc8('0xa')]);router[_0x7bc8('0x8')](_0x7bc8('0xb'),auth[_0x7bc8('0x9')](),controller['show']);router[_0x7bc8('0xc')]('/',auth[_0x7bc8('0x9')](),controller[_0x7bc8('0xd')]);router[_0x7bc8('0xe')](_0x7bc8('0xb'),auth[_0x7bc8('0x9')](),controller[_0x7bc8('0xf')]);router[_0x7bc8('0x10')](_0x7bc8('0xb'),auth[_0x7bc8('0x9')](),controller[_0x7bc8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 202e82f..ad26407 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 _0x2179=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0xed1a03,_0xf86ecf){var _0x38f61e=function(_0x1e443b){while(--_0x1e443b){_0xed1a03['push'](_0xed1a03['shift']());}};_0x38f61e(++_0xf86ecf);}(_0x2179,0xc0));var _0x9217=function(_0x50408f,_0x92ffac){_0x50408f=_0x50408f-0x0;var _0xb02957=_0x2179[_0x50408f];return _0xb02957;};'use strict';var Sequelize=require(_0x9217('0x0'));module[_0x9217('0x1')]={'calldate':{'type':Sequelize[_0x9217('0x2')],'allowNull':![],'defaultValue':_0x9217('0x3')},'clid':{'type':Sequelize[_0x9217('0x4')]},'src':{'type':Sequelize[_0x9217('0x4')]},'dst':{'type':Sequelize[_0x9217('0x4')]},'dcontext':{'type':Sequelize[_0x9217('0x4')]},'channel':{'type':Sequelize[_0x9217('0x4')]},'dstchannel':{'type':Sequelize[_0x9217('0x4')]},'lastapp':{'type':Sequelize[_0x9217('0x4')]},'lastdata':{'type':Sequelize[_0x9217('0x4')]},'duration':{'type':Sequelize[_0x9217('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9217('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9217('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9217('0x4')]},'userfield':{'type':Sequelize[_0x9217('0x4')]},'uniqueid':{'type':Sequelize[_0x9217('0x4')]},'linkedid':{'type':Sequelize[_0x9217('0x4')]},'sequence':{'type':Sequelize[_0x9217('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9217('0x4')]}}; \ No newline at end of file +var _0x3095=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x43b0d5,_0x499afb){var _0x25909e=function(_0x44b792){while(--_0x44b792){_0x43b0d5['push'](_0x43b0d5['shift']());}};_0x25909e(++_0x499afb);}(_0x3095,0x158));var _0x5309=function(_0x476031,_0x41aef3){_0x476031=_0x476031-0x0;var _0x4950fb=_0x3095[_0x476031];return _0x4950fb;};'use strict';var Sequelize=require(_0x5309('0x0'));module[_0x5309('0x1')]={'calldate':{'type':Sequelize[_0x5309('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5309('0x3')]},'dst':{'type':Sequelize[_0x5309('0x3')]},'dcontext':{'type':Sequelize[_0x5309('0x3')]},'channel':{'type':Sequelize[_0x5309('0x3')]},'dstchannel':{'type':Sequelize[_0x5309('0x3')]},'lastapp':{'type':Sequelize[_0x5309('0x3')]},'lastdata':{'type':Sequelize[_0x5309('0x3')]},'duration':{'type':Sequelize[_0x5309('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5309('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5309('0x3')]},'amaflags':{'type':Sequelize[_0x5309('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5309('0x3')]},'userfield':{'type':Sequelize[_0x5309('0x3')]},'uniqueid':{'type':Sequelize[_0x5309('0x3')]},'linkedid':{'type':Sequelize[_0x5309('0x3')]},'sequence':{'type':Sequelize[_0x5309('0x3')]},'peeraccount':{'type':Sequelize[_0x5309('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x5309('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 94d7bb8..836e26f 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 _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(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x8ce1,0x183));var _0x18ce=function(_0x2f1b8c,_0x3f63f1){_0x2f1b8c=_0x2f1b8c-0x0;var _0x158768=_0x8ce1[_0x2f1b8c];return _0x158768;};'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 +var _0x3c17=['apply','reject','save','update','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','then','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json'];(function(_0x2bd693,_0x436100){var _0x125b5a=function(_0x1a587b){while(--_0x1a587b){_0x2bd693['push'](_0x2bd693['shift']());}};_0x125b5a(++_0x436100);}(_0x3c17,0x1a1));var _0x73c1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x3c17[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x73c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c1('0x2'));var moment=require(_0x73c1('0x3'));var BPromise=require(_0x73c1('0x4'));var Mustache=require('mustache');var util=require(_0x73c1('0x5'));var path=require(_0x73c1('0x6'));var sox=require(_0x73c1('0x7'));var csv=require(_0x73c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73c1('0x9'));var _=require('lodash');var squel=require(_0x73c1('0xa'));var crypto=require(_0x73c1('0xb'));var jsforce=require(_0x73c1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x73c1('0xd'));var Papa=require(_0x73c1('0xe'));var Redis=require(_0x73c1('0xf'));var authService=require(_0x73c1('0x10'));var qs=require(_0x73c1('0x11'));var as=require(_0x73c1('0x12'));var hardwareService=require(_0x73c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x73c1('0x14'));var config=require(_0x73c1('0x15'));var licenseUtil=require(_0x73c1('0x16'));var db=require(_0x73c1('0x17'))['db'];function respondWithStatusCode(_0x592a6a,_0x2b77bc){_0x2b77bc=_0x2b77bc||0xcc;return function(_0x5e6b55){if(_0x5e6b55){return _0x592a6a[_0x73c1('0x18')](_0x2b77bc);}return _0x592a6a['status'](_0x2b77bc)[_0x73c1('0x19')]();};}function respondWithResult(_0x3ecf5a,_0x57cb11){_0x57cb11=_0x57cb11||0xc8;return function(_0x537965){if(_0x537965){return _0x3ecf5a[_0x73c1('0x1a')](_0x57cb11)['json'](_0x537965);}};}function respondWithFilteredResult(_0x72a36,_0x52d0ff){return function(_0xe5d5c8){if(_0xe5d5c8){var _0x47d81e=typeof _0x52d0ff[_0x73c1('0x1b')]===_0x73c1('0x1c')&&typeof _0x52d0ff[_0x73c1('0x1d')]===_0x73c1('0x1c');var _0x8c0803=_0xe5d5c8[_0x73c1('0x1e')];var _0x16deb6=_0x47d81e?0x0:_0x52d0ff[_0x73c1('0x1b')];var _0x1ce19e=_0x47d81e?_0xe5d5c8['count']:_0x52d0ff[_0x73c1('0x1b')]+_0x52d0ff[_0x73c1('0x1d')];var _0x28df60;if(_0x1ce19e>=_0x8c0803){_0x1ce19e=_0x8c0803;_0x28df60=0xc8;}else{_0x28df60=0xce;}_0x72a36[_0x73c1('0x1a')](_0x28df60);return _0x72a36['set'](_0x73c1('0x1f'),_0x16deb6+'-'+_0x1ce19e+'/'+_0x8c0803)[_0x73c1('0x20')](_0xe5d5c8);}return null;};}function patchUpdates(_0x344fb5){return function(_0x2e17e5){try{jsonpatch[_0x73c1('0x21')](_0x2e17e5,_0x344fb5,!![]);}catch(_0x2aa7df){return BPromise[_0x73c1('0x22')](_0x2aa7df);}return _0x2e17e5[_0x73c1('0x23')]();};}function saveUpdates(_0x49b817,_0x2eba51){return function(_0x32b379){if(_0x32b379){return _0x32b379[_0x73c1('0x24')](_0x49b817)['then'](function(_0x10254c){return _0x10254c;});}return null;};}function removeEntity(_0x2ebfda,_0x1125ff){return function(_0x3abaab){if(_0x3abaab){return _0x3abaab[_0x73c1('0x25')]()['then'](function(){_0x2ebfda[_0x73c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54feeb,_0x2301b7){return function(_0x1c567d){if(!_0x1c567d){_0x54feeb[_0x73c1('0x18')](0x194);}return _0x1c567d;};}function handleError(_0x1c54aa,_0x123cc0){_0x123cc0=_0x123cc0||0x1f4;return function(_0x30ec73){logger[_0x73c1('0x26')](_0x30ec73[_0x73c1('0x27')]);if(_0x30ec73[_0x73c1('0x28')]){delete _0x30ec73[_0x73c1('0x28')];}_0x1c54aa[_0x73c1('0x1a')](_0x123cc0)[_0x73c1('0x29')](_0x30ec73);};}exports[_0x73c1('0x2a')]=function(_0x240137,_0x5bf2b1){var _0x2b2996={},_0x9050fd={},_0x33b5bc={'count':0x0,'rows':[]};var _0x153141=_[_0x73c1('0x2b')](db[_0x73c1('0x2c')][_0x73c1('0x2d')],function(_0x45c411){return{'name':_0x45c411[_0x73c1('0x2e')],'type':_0x45c411['type']['key']};});_0x9050fd[_0x73c1('0x2f')]=_[_0x73c1('0x2b')](_0x153141,_0x73c1('0x28'));_0x9050fd[_0x73c1('0x30')]=_['keys'](_0x240137[_0x73c1('0x30')]);_0x9050fd[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x9050fd['model'],_0x9050fd[_0x73c1('0x30')]);_0x2b2996[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x9050fd[_0x73c1('0x2f')],qs[_0x73c1('0x34')](_0x240137[_0x73c1('0x30')]['fields']));_0x2b2996[_0x73c1('0x33')]=_0x2b2996[_0x73c1('0x33')][_0x73c1('0x35')]?_0x2b2996[_0x73c1('0x33')]:_0x9050fd[_0x73c1('0x2f')];if(!_0x240137[_0x73c1('0x30')][_0x73c1('0x36')](_0x73c1('0x37'))){_0x2b2996[_0x73c1('0x1d')]=qs[_0x73c1('0x1d')](_0x240137['query'][_0x73c1('0x1d')]);_0x2b2996['offset']=qs[_0x73c1('0x1b')](_0x240137[_0x73c1('0x30')][_0x73c1('0x1b')]);}_0x2b2996[_0x73c1('0x38')]=qs['sort'](_0x240137['query']['sort']);_0x2b2996[_0x73c1('0x39')]=qs['filters'](_[_0x73c1('0x3a')](_0x240137[_0x73c1('0x30')],_0x9050fd[_0x73c1('0x31')]),_0x153141);if(_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]){_0x2b2996[_0x73c1('0x39')]=_[_0x73c1('0x3c')](_0x2b2996[_0x73c1('0x39')],{'$or':_[_0x73c1('0x2b')](_0x153141,function(_0x304c2b){if(_0x304c2b[_0x73c1('0x3d')]!=='VIRTUAL'){var _0x2bb535={};_0x2bb535[_0x304c2b[_0x73c1('0x28')]]={'$like':'%'+_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]+'%'};return _0x2bb535;}})});}_0x2b2996=_[_0x73c1('0x3c')]({},_0x2b2996,_0x240137[_0x73c1('0x3e')]);var _0x5a8c11={'where':_0x2b2996[_0x73c1('0x39')]};return db[_0x73c1('0x2c')][_0x73c1('0x1e')](_0x5a8c11)[_0x73c1('0x3f')](function(_0x21feb9){_0x33b5bc[_0x73c1('0x1e')]=_0x21feb9;if(_0x240137['query'][_0x73c1('0x40')]){_0x2b2996['include']=[{'all':!![]}];}return db[_0x73c1('0x2c')][_0x73c1('0x41')](_0x2b2996);})['then'](function(_0x57d843){_0x33b5bc[_0x73c1('0x42')]=_0x57d843;return _0x33b5bc;})[_0x73c1('0x3f')](respondWithFilteredResult(_0x5bf2b1,_0x2b2996))[_0x73c1('0x43')](handleError(_0x5bf2b1,null));};exports[_0x73c1('0x44')]=function(_0x689ca5,_0x282b73){var _0x515a52={'raw':!![],'where':{'id':_0x689ca5[_0x73c1('0x45')]['id']}},_0x5c70b9={};_0x5c70b9[_0x73c1('0x2f')]=_['keys'](db['Cdr'][_0x73c1('0x2d')]);_0x5c70b9['query']=_[_0x73c1('0x46')](_0x689ca5[_0x73c1('0x30')]);_0x5c70b9[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x5c70b9[_0x73c1('0x2f')],_0x5c70b9[_0x73c1('0x30')]);_0x515a52[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x5c70b9['model'],qs['fields'](_0x689ca5[_0x73c1('0x30')][_0x73c1('0x34')]));_0x515a52[_0x73c1('0x33')]=_0x515a52['attributes'][_0x73c1('0x35')]?_0x515a52[_0x73c1('0x33')]:_0x5c70b9[_0x73c1('0x2f')];if(_0x689ca5[_0x73c1('0x30')][_0x73c1('0x40')]){_0x515a52[_0x73c1('0x47')]=[{'all':!![]}];}_0x515a52=_[_0x73c1('0x3c')]({},_0x515a52,_0x689ca5[_0x73c1('0x3e')]);return db[_0x73c1('0x2c')][_0x73c1('0x48')](_0x515a52)[_0x73c1('0x3f')](handleEntityNotFound(_0x282b73,null))[_0x73c1('0x3f')](respondWithResult(_0x282b73,null))['catch'](handleError(_0x282b73,null));};exports[_0x73c1('0x49')]=function(_0x512295,_0x1a681c){return db[_0x73c1('0x2c')][_0x73c1('0x49')](_0x512295[_0x73c1('0x4a')],{})[_0x73c1('0x3f')](respondWithResult(_0x1a681c,0xc9))[_0x73c1('0x43')](handleError(_0x1a681c,null));};exports['update']=function(_0x34093c,_0x2ccd11){if(_0x34093c[_0x73c1('0x4a')]['id']){delete _0x34093c['body']['id'];}return db[_0x73c1('0x2c')][_0x73c1('0x48')]({'where':{'id':_0x34093c[_0x73c1('0x45')]['id']}})[_0x73c1('0x3f')](handleEntityNotFound(_0x2ccd11,null))[_0x73c1('0x3f')](saveUpdates(_0x34093c[_0x73c1('0x4a')],null))[_0x73c1('0x3f')](respondWithResult(_0x2ccd11,null))[_0x73c1('0x43')](handleError(_0x2ccd11,null));};exports[_0x73c1('0x25')]=function(_0x53d491,_0x3291db){return db['Cdr']['find']({'where':{'id':_0x53d491['params']['id']}})['then'](handleEntityNotFound(_0x3291db,null))['then'](removeEntity(_0x3291db,null))[_0x73c1('0x43')](handleError(_0x3291db,null));};exports['describe']=function(_0x3c31e8,_0x47e3ca){return db['Cdr']['describe']()[_0x73c1('0x3f')](respondWithResult(_0x47e3ca,null))['catch'](handleError(_0x47e3ca,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 458064b..2a3aadb 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(_0x81ffa8,_0x5315ae){var _0x391605=function(_0x2a5638){while(--_0x2a5638){_0x81ffa8['push'](_0x81ffa8['shift']());}};_0x391605(++_0x5315ae);}(_0x7a54,0x106));var _0x47a5=function(_0xe8b65f,_0x2369a8){_0xe8b65f=_0xe8b65f-0x0;var _0x1143de=_0x7a54[_0xe8b65f];return _0x1143de;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x559948,_0x5d7a75){var _0x4fc8d5=function(_0x4f77aa){while(--_0x4f77aa){_0x559948['push'](_0x559948['shift']());}};_0x4fc8d5(++_0x5d7a75);}(_0x7a54,0x106));var _0x47a5=function(_0x5dbb19,_0x1b55c9){_0x5dbb19=_0x5dbb19-0x0;var _0x27f390=_0x7a54[_0x5dbb19];return _0x27f390;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 78dcffe..4b4b01c 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 _0x48ce=['http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a1f26,_0x4fc0d7){var _0x4613b9=function(_0x17bc3b){while(--_0x17bc3b){_0x3a1f26['push'](_0x3a1f26['shift']());}};_0x4613b9(++_0x4fc0d7);}(_0x48ce,0xb4));var _0xe48c=function(_0x16c6e9,_0x5aecfc){_0x16c6e9=_0x16c6e9-0x0;var _0x53439f=_0x48ce[_0x16c6e9];return _0x53439f;};'use strict';var _=require(_0xe48c('0x0'));var util=require(_0xe48c('0x1'));var moment=require(_0xe48c('0x2'));var BPromise=require(_0xe48c('0x3'));var rs=require(_0xe48c('0x4'));var fs=require('fs');var Redis=require(_0xe48c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe48c('0x6'));var logger=require(_0xe48c('0x7'))(_0xe48c('0x8'));var config=require(_0xe48c('0x9'));var jayson=require(_0xe48c('0xa'));var client=jayson[_0xe48c('0xb')][_0xe48c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40d464,_0x5b97c7,_0x120e3e){return new BPromise(function(_0x3f397e,_0x44ce83){return client['request'](_0x40d464,_0x120e3e)[_0xe48c('0xd')](function(_0x90f8a0){logger[_0xe48c('0xe')](_0xe48c('0xf'),_0x5b97c7,_0xe48c('0x10'));logger[_0xe48c('0x11')](_0xe48c('0x12'),_0x5b97c7,_0xe48c('0x10'),JSON[_0xe48c('0x13')](_0x90f8a0));if(_0x90f8a0[_0xe48c('0x14')]){if(_0x90f8a0[_0xe48c('0x14')][_0xe48c('0x15')]===0x1f4){logger[_0xe48c('0x14')](_0xe48c('0xf'),_0x5b97c7,_0x90f8a0['error']['message']);return _0x44ce83(_0x90f8a0[_0xe48c('0x14')][_0xe48c('0x16')]);}logger[_0xe48c('0x14')](_0xe48c('0xf'),_0x5b97c7,_0x90f8a0['error'][_0xe48c('0x16')]);return _0x3f397e(_0x90f8a0[_0xe48c('0x14')][_0xe48c('0x16')]);}else{logger[_0xe48c('0xe')](_0xe48c('0xf'),_0x5b97c7,'request\x20sent');_0x3f397e(_0x90f8a0[_0xe48c('0x17')]['message']);}})['catch'](function(_0xfa9dd0){logger[_0xe48c('0x14')]('Cdr,\x20%s,\x20%s',_0x5b97c7,_0xfa9dd0);_0x44ce83(_0xfa9dd0);});});} \ No newline at end of file +var _0xce3d=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0x52fd3c,_0x988fa7){var _0x69b86d=function(_0x3328ad){while(--_0x3328ad){_0x52fd3c['push'](_0x52fd3c['shift']());}};_0x69b86d(++_0x988fa7);}(_0xce3d,0x1bb));var _0xdce3=function(_0xea6c20,_0x5a0de8){_0xea6c20=_0xea6c20-0x0;var _0x458655=_0xce3d[_0xea6c20];return _0x458655;};'use strict';var _=require('lodash');var util=require(_0xdce3('0x0'));var moment=require(_0xdce3('0x1'));var BPromise=require(_0xdce3('0x2'));var rs=require(_0xdce3('0x3'));var fs=require('fs');var Redis=require(_0xdce3('0x4'));var db=require(_0xdce3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdce3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdce3('0x7')][_0xdce3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fe2d8,_0x6e819a,_0x4003a2){return new BPromise(function(_0x103d74,_0x914d47){return client[_0xdce3('0x9')](_0x1fe2d8,_0x4003a2)['then'](function(_0x1fe3aa){logger[_0xdce3('0xa')]('Cdr,\x20%s,\x20%s',_0x6e819a,_0xdce3('0xb'));logger[_0xdce3('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x6e819a,'request\x20sent',JSON[_0xdce3('0xd')](_0x1fe3aa));if(_0x1fe3aa[_0xdce3('0xe')]){if(_0x1fe3aa[_0xdce3('0xe')][_0xdce3('0xf')]===0x1f4){logger['error'](_0xdce3('0x10'),_0x6e819a,_0x1fe3aa['error'][_0xdce3('0x11')]);return _0x914d47(_0x1fe3aa[_0xdce3('0xe')][_0xdce3('0x11')]);}logger[_0xdce3('0xe')]('Cdr,\x20%s,\x20%s',_0x6e819a,_0x1fe3aa[_0xdce3('0xe')][_0xdce3('0x11')]);return _0x103d74(_0x1fe3aa[_0xdce3('0xe')][_0xdce3('0x11')]);}else{logger[_0xdce3('0xa')](_0xdce3('0x10'),_0x6e819a,_0xdce3('0xb'));_0x103d74(_0x1fe3aa[_0xdce3('0x12')][_0xdce3('0x11')]);}})[_0xdce3('0x13')](function(_0x24f658){logger[_0xdce3('0xe')](_0xdce3('0x10'),_0x6e819a,_0x24f658);_0x914d47(_0x24f658);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b8bb8de..aa27f8b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x38015e,_0x1a5000){var _0x164067=function(_0x403094){while(--_0x403094){_0x38015e['push'](_0x38015e['shift']());}};_0x164067(++_0x1a5000);}(_0xb10b,0x12a));var _0xbb10=function(_0x3093fe,_0x5a0cff){_0x3093fe=_0x3093fe-0x0;var _0x31517d=_0xb10b[_0x3093fe];return _0x31517d;};'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 2ea397d..85a2dbd 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 _0xcb6a=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0xcb6a,0x19e));var _0xacb6=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xcb6a[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xacb6('0x0'));module[_0xacb6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xacb6('0x2')],'allowNull':![],'defaultValue':_0xacb6('0x3')},'appdata':{'type':Sequelize[_0xacb6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xacb6('0x5')}}; \ No newline at end of file +var _0xf909=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x465e16,_0x511b1f){var _0x2546c4=function(_0x49eb2f){while(--_0x49eb2f){_0x465e16['push'](_0x465e16['shift']());}};_0x2546c4(++_0x511b1f);}(_0xf909,0xc7));var _0x9f90=function(_0x276654,_0x5a16d9){_0x276654=_0x276654-0x0;var _0x3ca0b8=_0xf909[_0x276654];return _0x3ca0b8;};'use strict';var Sequelize=require(_0x9f90('0x0'));module[_0x9f90('0x1')]={'priority':{'type':Sequelize[_0x9f90('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f90('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f90('0x4')]},'interval':{'type':Sequelize[_0x9f90('0x4')],'defaultValue':_0x9f90('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c81dffb..cbbc5a0 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 _0x25a3=['util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','attributes','intersection','fields','length','includeAll','include','options','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x25a3,0x121));var _0x325a=function(_0x9e43d3,_0x1f6a1b){_0x9e43d3=_0x9e43d3-0x0;var _0x5e46d3=_0x25a3[_0x9e43d3];return _0x5e46d3;};'use strict';var emlformat=require(_0x325a('0x0'));var rimraf=require(_0x325a('0x1'));var zipdir=require(_0x325a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x325a('0x3'));var moment=require('moment');var BPromise=require(_0x325a('0x4'));var Mustache=require(_0x325a('0x5'));var util=require(_0x325a('0x6'));var path=require('path');var sox=require(_0x325a('0x7'));var csv=require(_0x325a('0x8'));var ejs=require(_0x325a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x325a('0xa'));var crypto=require(_0x325a('0xb'));var jsforce=require(_0x325a('0xc'));var deskjs=require(_0x325a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x325a('0xe'));var Redis=require(_0x325a('0xf'));var authService=require(_0x325a('0x10'));var qs=require(_0x325a('0x11'));var as=require(_0x325a('0x12'));var hardwareService=require(_0x325a('0x13'));var logger=require('../../config/logger')(_0x325a('0x14'));var utils=require(_0x325a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x325a('0x16'));var db=require(_0x325a('0x17'))['db'];function respondWithStatusCode(_0x2a8750,_0x3e90fe){_0x3e90fe=_0x3e90fe||0xcc;return function(_0x4e3b88){if(_0x4e3b88){return _0x2a8750['sendStatus'](_0x3e90fe);}return _0x2a8750[_0x325a('0x18')](_0x3e90fe)['end']();};}function respondWithResult(_0x3d12d5,_0xa8dc3a){_0xa8dc3a=_0xa8dc3a||0xc8;return function(_0x3db556){if(_0x3db556){return _0x3d12d5[_0x325a('0x18')](_0xa8dc3a)[_0x325a('0x19')](_0x3db556);}};}function respondWithFilteredResult(_0x3d198c,_0x1d7efc){return function(_0x4412ba){if(_0x4412ba){var _0x1fd4ec=typeof _0x1d7efc[_0x325a('0x1a')]===_0x325a('0x1b')&&typeof _0x1d7efc[_0x325a('0x1c')]===_0x325a('0x1b');var _0x1dcafe=_0x4412ba['count'];var _0x4cba7=_0x1fd4ec?0x0:_0x1d7efc[_0x325a('0x1a')];var _0x4a1f9f=_0x1fd4ec?_0x4412ba[_0x325a('0x1d')]:_0x1d7efc[_0x325a('0x1a')]+_0x1d7efc[_0x325a('0x1c')];var _0x297599;if(_0x4a1f9f>=_0x1dcafe){_0x4a1f9f=_0x1dcafe;_0x297599=0xc8;}else{_0x297599=0xce;}_0x3d198c[_0x325a('0x18')](_0x297599);return _0x3d198c[_0x325a('0x1e')](_0x325a('0x1f'),_0x4cba7+'-'+_0x4a1f9f+'/'+_0x1dcafe)[_0x325a('0x19')](_0x4412ba);}return null;};}function patchUpdates(_0x347f2d){return function(_0x1d76b7){try{jsonpatch[_0x325a('0x20')](_0x1d76b7,_0x347f2d,!![]);}catch(_0x11f0cb){return BPromise['reject'](_0x11f0cb);}return _0x1d76b7[_0x325a('0x21')]();};}function saveUpdates(_0x32a2f5,_0x18e29f){return function(_0x192e83){if(_0x192e83){return _0x192e83[_0x325a('0x22')](_0x32a2f5)[_0x325a('0x23')](function(_0x4c21bf){return _0x4c21bf;});}return null;};}function removeEntity(_0x36b2ac,_0x4c403d){return function(_0x15b5a6){if(_0x15b5a6){return _0x15b5a6[_0x325a('0x24')]()[_0x325a('0x23')](function(){_0x36b2ac[_0x325a('0x18')](0xcc)[_0x325a('0x25')]();});}};}function handleEntityNotFound(_0x4b3d65,_0x29543e){return function(_0x4b4155){if(!_0x4b4155){_0x4b3d65[_0x325a('0x26')](0x194);}return _0x4b4155;};}function handleError(_0x26c001,_0x41d0d2){_0x41d0d2=_0x41d0d2||0x1f4;return function(_0x5ad31d){logger[_0x325a('0x27')](_0x5ad31d[_0x325a('0x28')]);if(_0x5ad31d[_0x325a('0x29')]){delete _0x5ad31d[_0x325a('0x29')];}_0x26c001[_0x325a('0x18')](_0x41d0d2)[_0x325a('0x2a')](_0x5ad31d);};}exports[_0x325a('0x2b')]=function(_0x49d93b,_0x44468d){var _0x5cdfd1={'raw':!![],'where':{'id':_0x49d93b[_0x325a('0x2c')]['id']}},_0x201e01={};_0x201e01[_0x325a('0x2d')]=_[_0x325a('0x2e')](db[_0x325a('0x2f')]['rawAttributes']);_0x201e01[_0x325a('0x30')]=_['keys'](_0x49d93b[_0x325a('0x30')]);_0x201e01[_0x325a('0x31')]=_['intersection'](_0x201e01[_0x325a('0x2d')],_0x201e01[_0x325a('0x30')]);_0x5cdfd1[_0x325a('0x32')]=_[_0x325a('0x33')](_0x201e01['model'],qs[_0x325a('0x34')](_0x49d93b[_0x325a('0x30')][_0x325a('0x34')]));_0x5cdfd1[_0x325a('0x32')]=_0x5cdfd1['attributes'][_0x325a('0x35')]?_0x5cdfd1[_0x325a('0x32')]:_0x201e01[_0x325a('0x2d')];if(_0x49d93b[_0x325a('0x30')][_0x325a('0x36')]){_0x5cdfd1[_0x325a('0x37')]=[{'all':!![]}];}_0x5cdfd1=_['merge']({},_0x5cdfd1,_0x49d93b[_0x325a('0x38')]);return db[_0x325a('0x2f')]['find'](_0x5cdfd1)[_0x325a('0x23')](handleEntityNotFound(_0x44468d,null))[_0x325a('0x23')](respondWithResult(_0x44468d,null))['catch'](handleError(_0x44468d,null));};exports[_0x325a('0x22')]=function(_0x54d32a,_0x2dd1de){if(_0x54d32a[_0x325a('0x39')]['id']){delete _0x54d32a[_0x325a('0x39')]['id'];}return db[_0x325a('0x2f')]['find']({'where':{'id':_0x54d32a[_0x325a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2dd1de,null))[_0x325a('0x23')](saveUpdates(_0x54d32a['body'],null))['then'](respondWithResult(_0x2dd1de,null))[_0x325a('0x3a')](handleError(_0x2dd1de,null));};exports[_0x325a('0x24')]=function(_0x37f206,_0x50b80c){return db[_0x325a('0x2f')]['find']({'where':{'id':_0x37f206[_0x325a('0x2c')]['id']}})[_0x325a('0x23')](handleEntityNotFound(_0x50b80c,null))[_0x325a('0x23')](removeEntity(_0x50b80c,null))[_0x325a('0x3a')](handleError(_0x50b80c,null));}; \ No newline at end of file +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','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5685fc,_0x4a57c8){var _0x3a68a1=function(_0x151705){while(--_0x151705){_0x5685fc['push'](_0x5685fc['shift']());}};_0x3a68a1(++_0x4a57c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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['ChatApplication'][_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 diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5406a1f..3c6af5b 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 _0x3868=['lodash','../../config/logger','api','request-promise','path','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci'];(function(_0xb05c71,_0x5891c7){var _0x4132b4=function(_0x5ca6f9){while(--_0x5ca6f9){_0xb05c71['push'](_0xb05c71['shift']());}};_0x4132b4(++_0x5891c7);}(_0x3868,0x1ad));var _0x8386=function(_0x686dfa,_0x38aca5){_0x686dfa=_0x686dfa-0x0;var _0x2190c1=_0x3868[_0x686dfa];return _0x2190c1;};'use strict';var _=require(_0x8386('0x0'));var util=require('util');var logger=require(_0x8386('0x1'))(_0x8386('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8386('0x3'));var fs=require('fs');var path=require(_0x8386('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8386('0x5'));module[_0x8386('0x6')]=function(_0x53357b,_0x5af64c){return _0x53357b[_0x8386('0x7')](_0x8386('0x8'),attributes,{'tableName':_0x8386('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8386('0xa')});}; \ No newline at end of file +var _0xf903=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','request-promise','path'];(function(_0xcb6d2b,_0x1a56ac){var _0x2c3687=function(_0x1b6ed0){while(--_0x1b6ed0){_0xcb6d2b['push'](_0xcb6d2b['shift']());}};_0x2c3687(++_0x1a56ac);}(_0xf903,0x174));var _0x3f90=function(_0x2c25bc,_0x13b023){_0x2c25bc=_0x2c25bc-0x0;var _0x52408c=_0xf903[_0x2c25bc];return _0x52408c;};'use strict';var _=require(_0x3f90('0x0'));var util=require(_0x3f90('0x1'));var logger=require(_0x3f90('0x2'))(_0x3f90('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f90('0x4'));var fs=require('fs');var path=require(_0x3f90('0x5'));var rimraf=require(_0x3f90('0x6'));var config=require(_0x3f90('0x7'));var attributes=require(_0x3f90('0x8'));module[_0x3f90('0x9')]=function(_0x1f625b,_0x2dca71){return _0x1f625b[_0x3f90('0xa')](_0x3f90('0xb'),attributes,{'tableName':_0x3f90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f90('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 49bb5e9..ab6b551 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 _0xf6f0=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x520871,_0x3234ec){var _0x3966d4=function(_0x255796){while(--_0x255796){_0x520871['push'](_0x520871['shift']());}};_0x3966d4(++_0x3234ec);}(_0xf6f0,0xdd));var _0x0f6f=function(_0x582d37,_0xc34a90){_0x582d37=_0x582d37-0x0;var _0x4aa6b6=_0xf6f0[_0x582d37];return _0x4aa6b6;};'use strict';var _=require('lodash');var util=require(_0x0f6f('0x0'));var moment=require('moment');var BPromise=require(_0x0f6f('0x1'));var rs=require(_0x0f6f('0x2'));var fs=require('fs');var Redis=require(_0x0f6f('0x3'));var db=require(_0x0f6f('0x4'))['db'];var utils=require(_0x0f6f('0x5'));var logger=require(_0x0f6f('0x6'))(_0x0f6f('0x7'));var config=require(_0x0f6f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33da23,_0x1bb1e2,_0x247412){return new BPromise(function(_0x3298c1,_0x52eff3){return client[_0x0f6f('0xa')](_0x33da23,_0x247412)[_0x0f6f('0xb')](function(_0xc1537f){logger[_0x0f6f('0xc')](_0x0f6f('0xd'),_0x1bb1e2,_0x0f6f('0xe'));logger['debug'](_0x0f6f('0xf'),_0x1bb1e2,_0x0f6f('0xe'),JSON[_0x0f6f('0x10')](_0xc1537f));if(_0xc1537f[_0x0f6f('0x11')]){if(_0xc1537f['error'][_0x0f6f('0x12')]===0x1f4){logger[_0x0f6f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1bb1e2,_0xc1537f[_0x0f6f('0x11')][_0x0f6f('0x13')]);return _0x52eff3(_0xc1537f['error'][_0x0f6f('0x13')]);}logger[_0x0f6f('0x11')](_0x0f6f('0xd'),_0x1bb1e2,_0xc1537f[_0x0f6f('0x11')][_0x0f6f('0x13')]);return _0x3298c1(_0xc1537f[_0x0f6f('0x11')]['message']);}else{logger[_0x0f6f('0xc')](_0x0f6f('0xd'),_0x1bb1e2,_0x0f6f('0xe'));_0x3298c1(_0xc1537f['result'][_0x0f6f('0x13')]);}})[_0x0f6f('0x14')](function(_0x2c8cab){logger[_0x0f6f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1bb1e2,_0x2c8cab);_0x52eff3(_0x2c8cab);});});} \ No newline at end of file +var _0x7125=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a5388,_0x2acd5d){var _0x59e707=function(_0x50aec1){while(--_0x50aec1){_0x5a5388['push'](_0x5a5388['shift']());}};_0x59e707(++_0x2acd5d);}(_0x7125,0x15f));var _0x5712=function(_0x4aabdf,_0x1694c1){_0x4aabdf=_0x4aabdf-0x0;var _0x226ab0=_0x7125[_0x4aabdf];return _0x226ab0;};'use strict';var _=require(_0x5712('0x0'));var util=require(_0x5712('0x1'));var moment=require('moment');var BPromise=require(_0x5712('0x2'));var rs=require(_0x5712('0x3'));var fs=require('fs');var Redis=require(_0x5712('0x4'));var db=require(_0x5712('0x5'))['db'];var utils=require(_0x5712('0x6'));var logger=require(_0x5712('0x7'))(_0x5712('0x8'));var config=require('../../config/environment');var jayson=require(_0x5712('0x9'));var client=jayson[_0x5712('0xa')][_0x5712('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28f42e,_0xf6642c,_0x2b1b80){return new BPromise(function(_0x588ee8,_0x3354f2){return client[_0x5712('0xc')](_0x28f42e,_0x2b1b80)[_0x5712('0xd')](function(_0x22fff2){logger[_0x5712('0xe')]('ChatApplication,\x20%s,\x20%s',_0xf6642c,_0x5712('0xf'));logger[_0x5712('0x10')](_0x5712('0x11'),_0xf6642c,_0x5712('0xf'),JSON[_0x5712('0x12')](_0x22fff2));if(_0x22fff2['error']){if(_0x22fff2[_0x5712('0x13')]['code']===0x1f4){logger[_0x5712('0x13')](_0x5712('0x14'),_0xf6642c,_0x22fff2['error'][_0x5712('0x15')]);return _0x3354f2(_0x22fff2[_0x5712('0x13')][_0x5712('0x15')]);}logger['error'](_0x5712('0x14'),_0xf6642c,_0x22fff2[_0x5712('0x13')][_0x5712('0x15')]);return _0x588ee8(_0x22fff2[_0x5712('0x13')][_0x5712('0x15')]);}else{logger[_0x5712('0xe')](_0x5712('0x14'),_0xf6642c,_0x5712('0xf'));_0x588ee8(_0x22fff2[_0x5712('0x16')][_0x5712('0x15')]);}})[_0x5712('0x17')](function(_0x50ea61){logger['error']('ChatApplication,\x20%s,\x20%s',_0xf6642c,_0x50ea61);_0x3354f2(_0x50ea61);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4478ddf..9b574b8 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 _0x9a73=['get','show','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./chatApplication.controller'];(function(_0x28068a,_0x5bf598){var _0x73c877=function(_0x3ce275){while(--_0x3ce275){_0x28068a['push'](_0x28068a['shift']());}};_0x73c877(++_0x5bf598);}(_0x9a73,0x104));var _0x39a7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9a73[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x39a7('0x0'));var util=require('util');var path=require(_0x39a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x39a7('0x2'));var router=express['Router']();var fs_extra=require(_0x39a7('0x3'));var auth=require(_0x39a7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39a7('0x5'));router[_0x39a7('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x39a7('0x7')]);router[_0x39a7('0x8')](_0x39a7('0x9'),auth[_0x39a7('0xa')](),controller['update']);router[_0x39a7('0xb')]('/:id',auth[_0x39a7('0xa')](),controller[_0x39a7('0xc')]);module[_0x39a7('0xd')]=router; \ No newline at end of file +var _0x2493=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path'];(function(_0x46ff82,_0x59d48c){var _0x262d95=function(_0xec0f3f){while(--_0xec0f3f){_0x46ff82['push'](_0x46ff82['shift']());}};_0x262d95(++_0x59d48c);}(_0x2493,0x14e));var _0x3249=function(_0x5b92f6,_0x383c5d){_0x5b92f6=_0x5b92f6-0x0;var _0x5d6d66=_0x2493[_0x5b92f6];return _0x5d6d66;};'use strict';var multer=require(_0x3249('0x0'));var util=require('util');var path=require(_0x3249('0x1'));var timeout=require(_0x3249('0x2'));var express=require(_0x3249('0x3'));var router=express[_0x3249('0x4')]();var fs_extra=require(_0x3249('0x5'));var auth=require(_0x3249('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3249('0x7'));router[_0x3249('0x8')](_0x3249('0x9'),auth[_0x3249('0xa')](),controller[_0x3249('0xb')]);router[_0x3249('0xc')](_0x3249('0x9'),auth[_0x3249('0xa')](),controller[_0x3249('0xd')]);router[_0x3249('0xe')](_0x3249('0x9'),auth[_0x3249('0xa')](),controller[_0x3249('0xf')]);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 fee7a05..c9dcc7d 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 _0xab47=['BOOLEAN','STRING'];(function(_0x2fd116,_0x1a4969){var _0x3433c7=function(_0x5b3d70){while(--_0x5b3d70){_0x2fd116['push'](_0x2fd116['shift']());}};_0x3433c7(++_0x1a4969);}(_0xab47,0xb1));var _0x7ab4=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xab47[_0x7b173];return _0x1c598c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7ab4('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x7ab4('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x48f5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x118c0f,_0x1d196f){var _0xa6cd15=function(_0x62c53a){while(--_0x62c53a){_0x118c0f['push'](_0x118c0f['shift']());}};_0xa6cd15(++_0x1d196f);}(_0x48f5,0x68));var _0x548f=function(_0x408e4f,_0x2da1ac){_0x408e4f=_0x408e4f-0x0;var _0x3b49a0=_0x48f5[_0x408e4f];return _0x3b49a0;};'use strict';var Sequelize=require(_0x548f('0x0'));module[_0x548f('0x1')]={'name':{'type':Sequelize[_0x548f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x548f('0x2')]},'write':{'type':Sequelize[_0x548f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ac80b23..94d86c7 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 _0x664c=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','attributes','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','getMembers','findOne','removeMembers','addMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra'];(function(_0x53af50,_0x53e3f6){var _0x4629b2=function(_0x40f99a){while(--_0x40f99a){_0x53af50['push'](_0x53af50['shift']());}};_0x4629b2(++_0x53e3f6);}(_0x664c,0x178));var _0xc664=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x664c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc664('0x0'));var rimraf=require(_0xc664('0x1'));var zipdir=require(_0xc664('0x2'));var jsonpatch=require(_0xc664('0x3'));var rp=require(_0xc664('0x4'));var moment=require(_0xc664('0x5'));var BPromise=require(_0xc664('0x6'));var Mustache=require(_0xc664('0x7'));var util=require(_0xc664('0x8'));var path=require('path');var sox=require(_0xc664('0x9'));var csv=require('to-csv');var ejs=require(_0xc664('0xa'));var fs=require('fs');var fs_extra=require(_0xc664('0xb'));var _=require(_0xc664('0xc'));var squel=require(_0xc664('0xd'));var crypto=require(_0xc664('0xe'));var jsforce=require(_0xc664('0xf'));var deskjs=require(_0xc664('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc664('0x11'));var Papa=require(_0xc664('0x12'));var Redis=require(_0xc664('0x13'));var authService=require(_0xc664('0x14'));var qs=require(_0xc664('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc664('0x16'))(_0xc664('0x17'));var utils=require(_0xc664('0x18'));var config=require(_0xc664('0x19'));var licenseUtil=require(_0xc664('0x1a'));var db=require(_0xc664('0x1b'))['db'];config[_0xc664('0x1c')]=_[_0xc664('0x1d')](config[_0xc664('0x1c')],{'host':_0xc664('0x1e'),'port':0x18eb});var socket=require(_0xc664('0x1f'))(new Redis(config['redis']));require(_0xc664('0x20'))['register'](socket);function respondWithStatusCode(_0x45aa22,_0x329221){_0x329221=_0x329221||0xcc;return function(_0xa20683){if(_0xa20683){return _0x45aa22['sendStatus'](_0x329221);}return _0x45aa22['status'](_0x329221)[_0xc664('0x21')]();};}function respondWithResult(_0x41369c,_0x12e049){_0x12e049=_0x12e049||0xc8;return function(_0x332032){if(_0x332032){return _0x41369c['status'](_0x12e049)[_0xc664('0x22')](_0x332032);}};}function respondWithFilteredResult(_0x3baeef,_0x4edb38){return function(_0x2d28cf){if(_0x2d28cf){var _0x3a65a7=typeof _0x4edb38[_0xc664('0x23')]===_0xc664('0x24')&&typeof _0x4edb38[_0xc664('0x25')]===_0xc664('0x24');var _0x28145e=_0x2d28cf['count'];var _0x35a31a=_0x3a65a7?0x0:_0x4edb38[_0xc664('0x23')];var _0x21227e=_0x3a65a7?_0x2d28cf[_0xc664('0x26')]:_0x4edb38['offset']+_0x4edb38[_0xc664('0x25')];var _0x4538d9;if(_0x21227e>=_0x28145e){_0x21227e=_0x28145e;_0x4538d9=0xc8;}else{_0x4538d9=0xce;}_0x3baeef[_0xc664('0x27')](_0x4538d9);return _0x3baeef[_0xc664('0x28')]('Content-Range',_0x35a31a+'-'+_0x21227e+'/'+_0x28145e)[_0xc664('0x22')](_0x2d28cf);}return null;};}function patchUpdates(_0x5a4c12){return function(_0x7937c4){try{jsonpatch[_0xc664('0x29')](_0x7937c4,_0x5a4c12,!![]);}catch(_0x25c480){return BPromise[_0xc664('0x2a')](_0x25c480);}return _0x7937c4[_0xc664('0x2b')]();};}function saveUpdates(_0x482e36,_0x3e64e2){return function(_0x33788b){if(_0x33788b){return _0x33788b[_0xc664('0x2c')](_0x482e36)[_0xc664('0x2d')](function(_0x42cc2a){return _0x42cc2a;});}return null;};}function removeEntity(_0x351840,_0x478563){return function(_0x504980){if(_0x504980){return _0x504980[_0xc664('0x2e')]()[_0xc664('0x2d')](function(){_0x351840[_0xc664('0x27')](0xcc)[_0xc664('0x21')]();});}};}function handleEntityNotFound(_0x2dd705,_0x357382){return function(_0x864595){if(!_0x864595){_0x2dd705['sendStatus'](0x194);}return _0x864595;};}function handleError(_0x54cba7,_0x2876a3){_0x2876a3=_0x2876a3||0x1f4;return function(_0x45e783){logger['error'](_0x45e783[_0xc664('0x2f')]);if(_0x45e783[_0xc664('0x30')]){delete _0x45e783[_0xc664('0x30')];}_0x54cba7[_0xc664('0x27')](_0x2876a3)['send'](_0x45e783);};}exports[_0xc664('0x31')]=function(_0x507a8f,_0x40c20b){var _0x12f424={},_0x178923={},_0x32788c={'count':0x0,'rows':[]};var _0x16b86c=_[_0xc664('0x32')](db[_0xc664('0x33')][_0xc664('0x34')],function(_0x1f2586){return{'name':_0x1f2586[_0xc664('0x35')],'type':_0x1f2586[_0xc664('0x36')][_0xc664('0x37')]};});_0x178923[_0xc664('0x38')]=_[_0xc664('0x32')](_0x16b86c,'name');_0x178923[_0xc664('0x39')]=_[_0xc664('0x3a')](_0x507a8f[_0xc664('0x39')]);_0x178923[_0xc664('0x3b')]=_[_0xc664('0x3c')](_0x178923['model'],_0x178923[_0xc664('0x39')]);_0x12f424['attributes']=_[_0xc664('0x3c')](_0x178923[_0xc664('0x38')],qs[_0xc664('0x3d')](_0x507a8f[_0xc664('0x39')][_0xc664('0x3d')]));_0x12f424['attributes']=_0x12f424['attributes'][_0xc664('0x3e')]?_0x12f424['attributes']:_0x178923[_0xc664('0x38')];if(!_0x507a8f[_0xc664('0x39')][_0xc664('0x3f')](_0xc664('0x40'))){_0x12f424[_0xc664('0x25')]=qs[_0xc664('0x25')](_0x507a8f['query']['limit']);_0x12f424[_0xc664('0x23')]=qs[_0xc664('0x23')](_0x507a8f['query'][_0xc664('0x23')]);}_0x12f424[_0xc664('0x41')]=qs[_0xc664('0x42')](_0x507a8f[_0xc664('0x39')][_0xc664('0x42')]);_0x12f424['where']=qs['filters'](_['pick'](_0x507a8f['query'],_0x178923[_0xc664('0x3b')]),_0x16b86c);if(_0x507a8f[_0xc664('0x39')][_0xc664('0x43')]){_0x12f424['where']=_[_0xc664('0x44')](_0x12f424[_0xc664('0x45')],{'$or':_[_0xc664('0x32')](_0x16b86c,function(_0x139780){if(_0x139780[_0xc664('0x36')]!==_0xc664('0x46')){var _0xe48f81={};_0xe48f81[_0x139780[_0xc664('0x30')]]={'$like':'%'+_0x507a8f[_0xc664('0x39')][_0xc664('0x43')]+'%'};return _0xe48f81;}})});}_0x12f424=_[_0xc664('0x44')]({},_0x12f424,_0x507a8f[_0xc664('0x47')]);var _0x438a23={'where':_0x12f424[_0xc664('0x45')]};return db[_0xc664('0x33')][_0xc664('0x26')](_0x438a23)['then'](function(_0x36e1a4){_0x32788c[_0xc664('0x26')]=_0x36e1a4;if(_0x507a8f[_0xc664('0x39')][_0xc664('0x48')]){_0x12f424[_0xc664('0x49')]=[{'all':!![]}];}return db['ChatGroup'][_0xc664('0x4a')](_0x12f424);})[_0xc664('0x2d')](function(_0xc597f){_0x32788c['rows']=_0xc597f;return _0x32788c;})[_0xc664('0x2d')](respondWithFilteredResult(_0x40c20b,_0x12f424))[_0xc664('0x4b')](handleError(_0x40c20b,null));};exports[_0xc664('0x4c')]=function(_0x16a919,_0xdd7e16){var _0x543ac9={'raw':!![],'where':{'id':_0x16a919[_0xc664('0x4d')]['id']}},_0x303f8f={};_0x303f8f[_0xc664('0x38')]=_[_0xc664('0x3a')](db[_0xc664('0x33')]['rawAttributes']);_0x303f8f[_0xc664('0x39')]=_[_0xc664('0x3a')](_0x16a919[_0xc664('0x39')]);_0x303f8f[_0xc664('0x3b')]=_[_0xc664('0x3c')](_0x303f8f[_0xc664('0x38')],_0x303f8f[_0xc664('0x39')]);_0x543ac9['attributes']=_[_0xc664('0x3c')](_0x303f8f['model'],qs[_0xc664('0x3d')](_0x16a919[_0xc664('0x39')][_0xc664('0x3d')]));_0x543ac9[_0xc664('0x4e')]=_0x543ac9[_0xc664('0x4e')][_0xc664('0x3e')]?_0x543ac9[_0xc664('0x4e')]:_0x303f8f[_0xc664('0x38')];if(_0x16a919['query']['includeAll']){_0x543ac9[_0xc664('0x49')]=[{'all':!![]}];}_0x543ac9=_[_0xc664('0x44')]({},_0x543ac9,_0x16a919[_0xc664('0x47')]);return db[_0xc664('0x33')][_0xc664('0x4f')](_0x543ac9)['then'](handleEntityNotFound(_0xdd7e16,null))['then'](respondWithResult(_0xdd7e16,null))[_0xc664('0x4b')](handleError(_0xdd7e16,null));};exports[_0xc664('0x50')]=function(_0x501237,_0x2bfa2e){return db[_0xc664('0x33')][_0xc664('0x50')](_0x501237[_0xc664('0x51')],{})[_0xc664('0x2d')](respondWithResult(_0x2bfa2e,0xc9))[_0xc664('0x4b')](handleError(_0x2bfa2e,null));};exports[_0xc664('0x2c')]=function(_0x4caaf6,_0x1753bf){if(_0x4caaf6['body']['id']){delete _0x4caaf6[_0xc664('0x51')]['id'];}return db[_0xc664('0x33')][_0xc664('0x4f')]({'where':{'id':_0x4caaf6[_0xc664('0x4d')]['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x1753bf,null))[_0xc664('0x2d')](saveUpdates(_0x4caaf6['body'],null))[_0xc664('0x2d')](respondWithResult(_0x1753bf,null))['catch'](handleError(_0x1753bf,null));};exports[_0xc664('0x2e')]=function(_0x1bf32d,_0x1ea7df){return db['ChatGroup']['find']({'where':{'id':_0x1bf32d[_0xc664('0x4d')]['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x1ea7df,null))[_0xc664('0x2d')](removeEntity(_0x1ea7df,null))['catch'](handleError(_0x1ea7df,null));};exports[_0xc664('0x52')]=function(_0x5c4b50,_0x3a11b5){return db[_0xc664('0x33')][_0xc664('0x52')]()[_0xc664('0x2d')](respondWithResult(_0x3a11b5,null))[_0xc664('0x4b')](handleError(_0x3a11b5,null));};exports[_0xc664('0x53')]=function(_0x1fba1b,_0x17b94d,_0xeac1b){return db[_0xc664('0x54')][_0xc664('0x26')]({'where':{'ChatGroupId':_0x1fba1b[_0xc664('0x4d')]['id'],'ToId':_0x1fba1b['user']['id'],'read':![]}})['then'](function(_0x38963f){return{'id':_[_0xc664('0x55')](_0x1fba1b[_0xc664('0x4d')]['id']),'count':_0x38963f};})['then'](respondWithResult(_0x17b94d,null))[_0xc664('0x4b')](handleError(_0x17b94d,null));};exports[_0xc664('0x56')]=function(_0x3d7677,_0x3d1dfd,_0x28b11a){return db[_0xc664('0x33')][_0xc664('0x4f')]({'where':{'id':_0x3d7677['params']['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x3d1dfd,null))['then'](function(_0x2aa12e){if(_0x2aa12e){return _0x2aa12e[_0xc664('0x56')](_0x3d7677[_0xc664('0x51')]['ids'],_[_0xc664('0x57')](_0x3d7677['body'],[_0xc664('0x58'),'id'])||{});}})['then'](respondWithResult(_0x3d1dfd,null))['catch'](handleError(_0x3d1dfd,null));};exports[_0xc664('0x59')]=function(_0x259653,_0x17f3a4,_0x9f2b62){var _0x5991ed={};var _0x4e1ca3={};var _0x5dc62c;var _0x47d07;return db[_0xc664('0x33')][_0xc664('0x5a')]({'where':{'id':_0x259653[_0xc664('0x4d')]['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x17f3a4,null))[_0xc664('0x2d')](function(_0x4a7481){if(_0x4a7481){_0x5dc62c=_0x4a7481;_0x4e1ca3[_0xc664('0x38')]=_[_0xc664('0x3a')](db['User'][_0xc664('0x34')]);_0x4e1ca3['query']=_[_0xc664('0x3a')](_0x259653['query']);_0x4e1ca3[_0xc664('0x3b')]=_[_0xc664('0x3c')](_0x4e1ca3[_0xc664('0x38')],_0x4e1ca3[_0xc664('0x39')]);_0x5991ed[_0xc664('0x4e')]=_[_0xc664('0x3c')](_0x4e1ca3[_0xc664('0x38')],qs['fields'](_0x259653['query'][_0xc664('0x3d')]));_0x5991ed['attributes']=_0x5991ed['attributes'][_0xc664('0x3e')]?_0x5991ed['attributes']:_0x4e1ca3['model'];_0x5991ed[_0xc664('0x41')]=qs['sort'](_0x259653[_0xc664('0x39')][_0xc664('0x42')]);_0x5991ed[_0xc664('0x45')]=qs[_0xc664('0x3b')](_['pick'](_0x259653[_0xc664('0x39')],_0x4e1ca3[_0xc664('0x3b')]));if(_0x259653[_0xc664('0x39')][_0xc664('0x43')]){_0x5991ed[_0xc664('0x45')]=_[_0xc664('0x44')](_0x5991ed['where'],{'$or':_[_0xc664('0x32')](_0x5991ed[_0xc664('0x4e')],function(_0x4ac3f1){var _0x568ea7={};_0x568ea7[_0x4ac3f1]={'$like':'%'+_0x259653[_0xc664('0x39')][_0xc664('0x43')]+'%'};return _0x568ea7;})});}_0x5991ed=_[_0xc664('0x44')]({},_0x5991ed,_0x259653['options']);return _0x5dc62c['getMembers'](_0x5991ed);}})[_0xc664('0x2d')](function(_0x3136ee){if(_0x3136ee){_0x47d07=_0x3136ee[_0xc664('0x3e')];if(!_0x259653[_0xc664('0x39')][_0xc664('0x3f')](_0xc664('0x40'))){_0x5991ed[_0xc664('0x25')]=qs['limit'](_0x259653[_0xc664('0x39')]['limit']);_0x5991ed[_0xc664('0x23')]=qs[_0xc664('0x23')](_0x259653[_0xc664('0x39')][_0xc664('0x23')]);}return _0x5dc62c[_0xc664('0x59')](_0x5991ed);}})['then'](function(_0x4aba10){if(_0x4aba10){return _0x4aba10?{'count':_0x47d07,'rows':_0x4aba10}:null;}})[_0xc664('0x2d')](respondWithResult(_0x17f3a4,null))['catch'](handleError(_0x17f3a4,null));};exports[_0xc664('0x5b')]=function(_0x37fd47,_0x39e313,_0x426742){return db['ChatGroup'][_0xc664('0x4f')]({'where':{'id':_0x37fd47[_0xc664('0x4d')]['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x39e313,null))[_0xc664('0x2d')](function(_0x55ca2f){if(_0x55ca2f){return _0x55ca2f[_0xc664('0x5b')](_0x37fd47['query'][_0xc664('0x58')]);}})[_0xc664('0x2d')](respondWithStatusCode(_0x39e313,null))[_0xc664('0x4b')](handleError(_0x39e313,null));};exports[_0xc664('0x5c')]=function(_0x415fb0,_0x176f3d,_0x3c16d3){if(_0x415fb0[_0xc664('0x51')]['id']){delete _0x415fb0[_0xc664('0x51')]['id'];}return db[_0xc664('0x33')][_0xc664('0x4f')]({'where':{'id':_0x415fb0['params']['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x176f3d,null))[_0xc664('0x2d')](function(_0x2ddda0){if(_0x2ddda0){_0x415fb0[_0xc664('0x51')]['ChatGroupId']=_0x2ddda0['id'];return db[_0xc664('0x54')][_0xc664('0x50')](_0x415fb0['body']);}})[_0xc664('0x2d')](respondWithResult(_0x176f3d,null))[_0xc664('0x4b')](handleError(_0x176f3d,null));};exports[_0xc664('0x5d')]=function(_0x162e05,_0x2ae08a,_0x2afa04){var _0x5c2f0d={};var _0x1fe0d0={};var _0x2a4aaf;var _0x47ff14;return db['ChatGroup']['findOne']({'where':{'id':_0x162e05[_0xc664('0x4d')]['id']}})[_0xc664('0x2d')](handleEntityNotFound(_0x2ae08a,null))['then'](function(_0x22d329){if(_0x22d329){_0x2a4aaf=_0x22d329;_0x1fe0d0[_0xc664('0x38')]=_[_0xc664('0x3a')](db[_0xc664('0x54')]['rawAttributes']);_0x1fe0d0[_0xc664('0x39')]=_[_0xc664('0x3a')](_0x162e05[_0xc664('0x39')]);_0x1fe0d0[_0xc664('0x3b')]=_[_0xc664('0x3c')](_0x1fe0d0[_0xc664('0x38')],_0x1fe0d0[_0xc664('0x39')]);_0x5c2f0d['attributes']=_[_0xc664('0x3c')](_0x1fe0d0[_0xc664('0x38')],qs[_0xc664('0x3d')](_0x162e05[_0xc664('0x39')]['fields']));_0x5c2f0d[_0xc664('0x4e')]=_0x5c2f0d[_0xc664('0x4e')][_0xc664('0x3e')]?_0x5c2f0d[_0xc664('0x4e')]:_0x1fe0d0[_0xc664('0x38')];_0x5c2f0d[_0xc664('0x41')]=qs['sort'](_0x162e05[_0xc664('0x39')][_0xc664('0x42')]);_0x5c2f0d[_0xc664('0x45')]=qs[_0xc664('0x3b')](_['pick'](_0x162e05[_0xc664('0x39')],_0x1fe0d0[_0xc664('0x3b')]));if(_0x162e05['query'][_0xc664('0x43')]){_0x5c2f0d[_0xc664('0x45')]=_[_0xc664('0x44')](_0x5c2f0d[_0xc664('0x45')],{'$or':_[_0xc664('0x32')](_0x5c2f0d[_0xc664('0x4e')],function(_0xc9492c){var _0x2c960e={};_0x2c960e[_0xc9492c]={'$like':'%'+_0x162e05[_0xc664('0x39')]['filter']+'%'};return _0x2c960e;})});}if(_0x162e05[_0xc664('0x39')][_0xc664('0x5e')]){var _0x1fdb66=_0x162e05[_0xc664('0x39')][_0xc664('0x5e')][_0xc664('0x5f')](',');var _0x321d43={};_0x321d43[_0x1fdb66[0x0]]={'$gte':moment(_0x1fdb66[0x1])['format'](_0xc664('0x60'))};_0x5c2f0d[_0xc664('0x45')]=_[_0xc664('0x44')](_0x5c2f0d['where'],_0x321d43);}_0x5c2f0d=_[_0xc664('0x44')]({},_0x5c2f0d,_0x162e05[_0xc664('0x47')]);return _0x2a4aaf[_0xc664('0x5d')](_0x5c2f0d);}})[_0xc664('0x2d')](function(_0xdc7735){if(_0xdc7735){_0x47ff14=_0xdc7735[_0xc664('0x3e')];if(!_0x162e05['query']['hasOwnProperty']('nolimit')){_0x5c2f0d[_0xc664('0x25')]=qs[_0xc664('0x25')](_0x162e05[_0xc664('0x39')][_0xc664('0x25')]);_0x5c2f0d[_0xc664('0x23')]=qs[_0xc664('0x23')](_0x162e05['query'][_0xc664('0x23')]);}return _0x2a4aaf['getMessages'](_0x5c2f0d);}})[_0xc664('0x2d')](function(_0x1194bb){if(_0x1194bb){return _0x1194bb?{'count':_0x47ff14,'rows':_0x1194bb}:null;}})[_0xc664('0x2d')](respondWithResult(_0x2ae08a,null))[_0xc664('0x4b')](handleError(_0x2ae08a,null));}; \ No newline at end of file +var _0xd2fc=['key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','includeAll','rows','catch','show','include','options','find','body','params','describe','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','map','rawAttributes','fieldName','type'];(function(_0x6bb0a0,_0x468b8f){var _0x19dbc5=function(_0x28bbbb){while(--_0x28bbbb){_0x6bb0a0['push'](_0x6bb0a0['shift']());}};_0x19dbc5(++_0x468b8f);}(_0xd2fc,0x198));var _0xcd2f=function(_0x20b103,_0xe86d0c){_0x20b103=_0x20b103-0x0;var _0x2de2c2=_0xd2fc[_0x20b103];return _0x2de2c2;};'use strict';var emlformat=require(_0xcd2f('0x0'));var rimraf=require(_0xcd2f('0x1'));var zipdir=require(_0xcd2f('0x2'));var jsonpatch=require(_0xcd2f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcd2f('0x4'));var Mustache=require(_0xcd2f('0x5'));var util=require(_0xcd2f('0x6'));var path=require(_0xcd2f('0x7'));var sox=require('sox');var csv=require(_0xcd2f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd2f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd2f('0xa'));var deskjs=require(_0xcd2f('0xb'));var toCsv=require(_0xcd2f('0x8'));var querystring=require(_0xcd2f('0xc'));var Papa=require(_0xcd2f('0xd'));var Redis=require(_0xcd2f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcd2f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd2f('0x10'));var logger=require(_0xcd2f('0x11'))(_0xcd2f('0x12'));var utils=require(_0xcd2f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcd2f('0x14')]=_[_0xcd2f('0x15')](config[_0xcd2f('0x14')],{'host':_0xcd2f('0x16'),'port':0x18eb});var socket=require(_0xcd2f('0x17'))(new Redis(config[_0xcd2f('0x14')]));require('./chatGroup.socket')[_0xcd2f('0x18')](socket);function respondWithStatusCode(_0x3bb21d,_0x5f26b6){_0x5f26b6=_0x5f26b6||0xcc;return function(_0x127bdb){if(_0x127bdb){return _0x3bb21d[_0xcd2f('0x19')](_0x5f26b6);}return _0x3bb21d[_0xcd2f('0x1a')](_0x5f26b6)['end']();};}function respondWithResult(_0x128b2a,_0xbb727b){_0xbb727b=_0xbb727b||0xc8;return function(_0x22b3ff){if(_0x22b3ff){return _0x128b2a['status'](_0xbb727b)[_0xcd2f('0x1b')](_0x22b3ff);}};}function respondWithFilteredResult(_0x40e8fb,_0x14a818){return function(_0x229ee2){if(_0x229ee2){var _0x625472=typeof _0x14a818[_0xcd2f('0x1c')]===_0xcd2f('0x1d')&&typeof _0x14a818[_0xcd2f('0x1e')]==='undefined';var _0x203e5c=_0x229ee2['count'];var _0x2323a5=_0x625472?0x0:_0x14a818[_0xcd2f('0x1c')];var _0x25089e=_0x625472?_0x229ee2[_0xcd2f('0x1f')]:_0x14a818[_0xcd2f('0x1c')]+_0x14a818[_0xcd2f('0x1e')];var _0x1c10e4;if(_0x25089e>=_0x203e5c){_0x25089e=_0x203e5c;_0x1c10e4=0xc8;}else{_0x1c10e4=0xce;}_0x40e8fb[_0xcd2f('0x1a')](_0x1c10e4);return _0x40e8fb[_0xcd2f('0x20')](_0xcd2f('0x21'),_0x2323a5+'-'+_0x25089e+'/'+_0x203e5c)[_0xcd2f('0x1b')](_0x229ee2);}return null;};}function patchUpdates(_0x4d617c){return function(_0x102011){try{jsonpatch[_0xcd2f('0x22')](_0x102011,_0x4d617c,!![]);}catch(_0x347765){return BPromise['reject'](_0x347765);}return _0x102011[_0xcd2f('0x23')]();};}function saveUpdates(_0x4d9eda,_0xb3afde){return function(_0x228c2d){if(_0x228c2d){return _0x228c2d[_0xcd2f('0x24')](_0x4d9eda)['then'](function(_0x928d2){return _0x928d2;});}return null;};}function removeEntity(_0x23ff12,_0x2124f2){return function(_0x2fc21d){if(_0x2fc21d){return _0x2fc21d[_0xcd2f('0x25')]()[_0xcd2f('0x26')](function(){_0x23ff12['status'](0xcc)[_0xcd2f('0x27')]();});}};}function handleEntityNotFound(_0x4c2903,_0x3ae591){return function(_0x17b3eb){if(!_0x17b3eb){_0x4c2903[_0xcd2f('0x19')](0x194);}return _0x17b3eb;};}function handleError(_0x154b0a,_0x2d4397){_0x2d4397=_0x2d4397||0x1f4;return function(_0x26dab0){logger[_0xcd2f('0x28')](_0x26dab0['stack']);if(_0x26dab0[_0xcd2f('0x29')]){delete _0x26dab0[_0xcd2f('0x29')];}_0x154b0a[_0xcd2f('0x1a')](_0x2d4397)[_0xcd2f('0x2a')](_0x26dab0);};}exports['index']=function(_0x672387,_0x5c175e){var _0x774cd2={},_0x56a857={},_0x22d9d0={'count':0x0,'rows':[]};var _0x537736=_[_0xcd2f('0x2b')](db['ChatGroup'][_0xcd2f('0x2c')],function(_0x41229c){return{'name':_0x41229c[_0xcd2f('0x2d')],'type':_0x41229c[_0xcd2f('0x2e')][_0xcd2f('0x2f')]};});_0x56a857[_0xcd2f('0x30')]=_[_0xcd2f('0x2b')](_0x537736,'name');_0x56a857['query']=_[_0xcd2f('0x31')](_0x672387['query']);_0x56a857[_0xcd2f('0x32')]=_[_0xcd2f('0x33')](_0x56a857[_0xcd2f('0x30')],_0x56a857['query']);_0x774cd2['attributes']=_[_0xcd2f('0x33')](_0x56a857[_0xcd2f('0x30')],qs[_0xcd2f('0x34')](_0x672387[_0xcd2f('0x35')][_0xcd2f('0x34')]));_0x774cd2[_0xcd2f('0x36')]=_0x774cd2[_0xcd2f('0x36')][_0xcd2f('0x37')]?_0x774cd2[_0xcd2f('0x36')]:_0x56a857[_0xcd2f('0x30')];if(!_0x672387[_0xcd2f('0x35')][_0xcd2f('0x38')](_0xcd2f('0x39'))){_0x774cd2['limit']=qs[_0xcd2f('0x1e')](_0x672387[_0xcd2f('0x35')][_0xcd2f('0x1e')]);_0x774cd2[_0xcd2f('0x1c')]=qs[_0xcd2f('0x1c')](_0x672387['query'][_0xcd2f('0x1c')]);}_0x774cd2[_0xcd2f('0x3a')]=qs[_0xcd2f('0x3b')](_0x672387['query'][_0xcd2f('0x3b')]);_0x774cd2[_0xcd2f('0x3c')]=qs[_0xcd2f('0x32')](_[_0xcd2f('0x3d')](_0x672387['query'],_0x56a857['filters']),_0x537736);if(_0x672387[_0xcd2f('0x35')][_0xcd2f('0x3e')]){_0x774cd2[_0xcd2f('0x3c')]=_[_0xcd2f('0x3f')](_0x774cd2[_0xcd2f('0x3c')],{'$or':_['map'](_0x537736,function(_0x3c3f86){if(_0x3c3f86[_0xcd2f('0x2e')]!==_0xcd2f('0x40')){var _0x1fd028={};_0x1fd028[_0x3c3f86[_0xcd2f('0x29')]]={'$like':'%'+_0x672387['query']['filter']+'%'};return _0x1fd028;}})});}_0x774cd2=_['merge']({},_0x774cd2,_0x672387['options']);var _0x1fd831={'where':_0x774cd2[_0xcd2f('0x3c')]};return db[_0xcd2f('0x41')][_0xcd2f('0x1f')](_0x1fd831)[_0xcd2f('0x26')](function(_0x44255a){_0x22d9d0['count']=_0x44255a;if(_0x672387[_0xcd2f('0x35')][_0xcd2f('0x42')]){_0x774cd2['include']=[{'all':!![]}];}return db[_0xcd2f('0x41')]['findAll'](_0x774cd2);})[_0xcd2f('0x26')](function(_0x5f5922){_0x22d9d0[_0xcd2f('0x43')]=_0x5f5922;return _0x22d9d0;})['then'](respondWithFilteredResult(_0x5c175e,_0x774cd2))[_0xcd2f('0x44')](handleError(_0x5c175e,null));};exports[_0xcd2f('0x45')]=function(_0x5a887c,_0x386694){var _0x42a2e2={'raw':!![],'where':{'id':_0x5a887c['params']['id']}},_0x222677={};_0x222677[_0xcd2f('0x30')]=_[_0xcd2f('0x31')](db[_0xcd2f('0x41')][_0xcd2f('0x2c')]);_0x222677[_0xcd2f('0x35')]=_[_0xcd2f('0x31')](_0x5a887c['query']);_0x222677[_0xcd2f('0x32')]=_[_0xcd2f('0x33')](_0x222677['model'],_0x222677['query']);_0x42a2e2[_0xcd2f('0x36')]=_['intersection'](_0x222677[_0xcd2f('0x30')],qs[_0xcd2f('0x34')](_0x5a887c[_0xcd2f('0x35')]['fields']));_0x42a2e2['attributes']=_0x42a2e2[_0xcd2f('0x36')][_0xcd2f('0x37')]?_0x42a2e2[_0xcd2f('0x36')]:_0x222677['model'];if(_0x5a887c[_0xcd2f('0x35')][_0xcd2f('0x42')]){_0x42a2e2[_0xcd2f('0x46')]=[{'all':!![]}];}_0x42a2e2=_[_0xcd2f('0x3f')]({},_0x42a2e2,_0x5a887c[_0xcd2f('0x47')]);return db[_0xcd2f('0x41')][_0xcd2f('0x48')](_0x42a2e2)[_0xcd2f('0x26')](handleEntityNotFound(_0x386694,null))[_0xcd2f('0x26')](respondWithResult(_0x386694,null))[_0xcd2f('0x44')](handleError(_0x386694,null));};exports['create']=function(_0x3b7797,_0x195666){return db[_0xcd2f('0x41')]['create'](_0x3b7797['body'],{})[_0xcd2f('0x26')](respondWithResult(_0x195666,0xc9))[_0xcd2f('0x44')](handleError(_0x195666,null));};exports['update']=function(_0x13fda7,_0x428c47){if(_0x13fda7[_0xcd2f('0x49')]['id']){delete _0x13fda7['body']['id'];}return db['ChatGroup'][_0xcd2f('0x48')]({'where':{'id':_0x13fda7[_0xcd2f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x428c47,null))[_0xcd2f('0x26')](saveUpdates(_0x13fda7['body'],null))[_0xcd2f('0x26')](respondWithResult(_0x428c47,null))['catch'](handleError(_0x428c47,null));};exports[_0xcd2f('0x25')]=function(_0x1163a8,_0x252e59){return db[_0xcd2f('0x41')]['find']({'where':{'id':_0x1163a8[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0x252e59,null))[_0xcd2f('0x26')](removeEntity(_0x252e59,null))[_0xcd2f('0x44')](handleError(_0x252e59,null));};exports[_0xcd2f('0x4b')]=function(_0x265106,_0x4e32e9){return db['ChatGroup'][_0xcd2f('0x4b')]()['then'](respondWithResult(_0x4e32e9,null))[_0xcd2f('0x44')](handleError(_0x4e32e9,null));};exports['getUnread']=function(_0x4c820c,_0x2d2ca6,_0x443940){return db[_0xcd2f('0x4c')][_0xcd2f('0x1f')]({'where':{'ChatGroupId':_0x4c820c[_0xcd2f('0x4a')]['id'],'ToId':_0x4c820c[_0xcd2f('0x4d')]['id'],'read':![]}})[_0xcd2f('0x26')](function(_0x566ea3){return{'id':_['toInteger'](_0x4c820c[_0xcd2f('0x4a')]['id']),'count':_0x566ea3};})['then'](respondWithResult(_0x2d2ca6,null))[_0xcd2f('0x44')](handleError(_0x2d2ca6,null));};exports[_0xcd2f('0x4e')]=function(_0x19ad2b,_0x1a451b,_0x71f741){return db['ChatGroup']['find']({'where':{'id':_0x19ad2b[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0x1a451b,null))['then'](function(_0x1a0231){if(_0x1a0231){return _0x1a0231[_0xcd2f('0x4e')](_0x19ad2b['body'][_0xcd2f('0x4f')],_[_0xcd2f('0x50')](_0x19ad2b[_0xcd2f('0x49')],[_0xcd2f('0x4f'),'id'])||{});}})[_0xcd2f('0x26')](respondWithResult(_0x1a451b,null))[_0xcd2f('0x44')](handleError(_0x1a451b,null));};exports[_0xcd2f('0x51')]=function(_0x4cd25d,_0x5c7ef1,_0x4f5798){var _0xb36b0b={};var _0x2bbec9={};var _0x313f42;var _0x279965;return db['ChatGroup'][_0xcd2f('0x52')]({'where':{'id':_0x4cd25d[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0x5c7ef1,null))[_0xcd2f('0x26')](function(_0xa0751c){if(_0xa0751c){_0x313f42=_0xa0751c;_0x2bbec9[_0xcd2f('0x30')]=_[_0xcd2f('0x31')](db[_0xcd2f('0x53')][_0xcd2f('0x2c')]);_0x2bbec9[_0xcd2f('0x35')]=_[_0xcd2f('0x31')](_0x4cd25d[_0xcd2f('0x35')]);_0x2bbec9[_0xcd2f('0x32')]=_[_0xcd2f('0x33')](_0x2bbec9['model'],_0x2bbec9[_0xcd2f('0x35')]);_0xb36b0b[_0xcd2f('0x36')]=_[_0xcd2f('0x33')](_0x2bbec9[_0xcd2f('0x30')],qs['fields'](_0x4cd25d[_0xcd2f('0x35')]['fields']));_0xb36b0b[_0xcd2f('0x36')]=_0xb36b0b[_0xcd2f('0x36')][_0xcd2f('0x37')]?_0xb36b0b[_0xcd2f('0x36')]:_0x2bbec9[_0xcd2f('0x30')];_0xb36b0b[_0xcd2f('0x3a')]=qs[_0xcd2f('0x3b')](_0x4cd25d[_0xcd2f('0x35')][_0xcd2f('0x3b')]);_0xb36b0b[_0xcd2f('0x3c')]=qs[_0xcd2f('0x32')](_[_0xcd2f('0x3d')](_0x4cd25d['query'],_0x2bbec9[_0xcd2f('0x32')]));if(_0x4cd25d[_0xcd2f('0x35')][_0xcd2f('0x3e')]){_0xb36b0b['where']=_[_0xcd2f('0x3f')](_0xb36b0b[_0xcd2f('0x3c')],{'$or':_[_0xcd2f('0x2b')](_0xb36b0b[_0xcd2f('0x36')],function(_0x394015){var _0x29fbff={};_0x29fbff[_0x394015]={'$like':'%'+_0x4cd25d[_0xcd2f('0x35')][_0xcd2f('0x3e')]+'%'};return _0x29fbff;})});}_0xb36b0b=_['merge']({},_0xb36b0b,_0x4cd25d['options']);return _0x313f42[_0xcd2f('0x51')](_0xb36b0b);}})[_0xcd2f('0x26')](function(_0x44deb7){if(_0x44deb7){_0x279965=_0x44deb7['length'];if(!_0x4cd25d[_0xcd2f('0x35')][_0xcd2f('0x38')]('nolimit')){_0xb36b0b[_0xcd2f('0x1e')]=qs[_0xcd2f('0x1e')](_0x4cd25d['query'][_0xcd2f('0x1e')]);_0xb36b0b[_0xcd2f('0x1c')]=qs['offset'](_0x4cd25d['query'][_0xcd2f('0x1c')]);}return _0x313f42[_0xcd2f('0x51')](_0xb36b0b);}})[_0xcd2f('0x26')](function(_0x172617){if(_0x172617){return _0x172617?{'count':_0x279965,'rows':_0x172617}:null;}})[_0xcd2f('0x26')](respondWithResult(_0x5c7ef1,null))[_0xcd2f('0x44')](handleError(_0x5c7ef1,null));};exports[_0xcd2f('0x54')]=function(_0x5f4d12,_0x24c342,_0x17425b){return db['ChatGroup'][_0xcd2f('0x48')]({'where':{'id':_0x5f4d12[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0x24c342,null))['then'](function(_0x40df4a){if(_0x40df4a){return _0x40df4a[_0xcd2f('0x54')](_0x5f4d12['query'][_0xcd2f('0x4f')]);}})[_0xcd2f('0x26')](respondWithStatusCode(_0x24c342,null))[_0xcd2f('0x44')](handleError(_0x24c342,null));};exports[_0xcd2f('0x55')]=function(_0x2f73a4,_0xe413c1,_0x2aade0){if(_0x2f73a4[_0xcd2f('0x49')]['id']){delete _0x2f73a4[_0xcd2f('0x49')]['id'];}return db[_0xcd2f('0x41')][_0xcd2f('0x48')]({'where':{'id':_0x2f73a4[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0xe413c1,null))[_0xcd2f('0x26')](function(_0x39bcaf){if(_0x39bcaf){_0x2f73a4[_0xcd2f('0x49')][_0xcd2f('0x56')]=_0x39bcaf['id'];return db['ChatInternalMessage'][_0xcd2f('0x57')](_0x2f73a4[_0xcd2f('0x49')]);}})[_0xcd2f('0x26')](respondWithResult(_0xe413c1,null))['catch'](handleError(_0xe413c1,null));};exports[_0xcd2f('0x58')]=function(_0x215af2,_0x21a282,_0x9e38b4){var _0x28f4a3={};var _0x1f2625={};var _0x287a3a;var _0x4af001;return db['ChatGroup'][_0xcd2f('0x52')]({'where':{'id':_0x215af2[_0xcd2f('0x4a')]['id']}})[_0xcd2f('0x26')](handleEntityNotFound(_0x21a282,null))[_0xcd2f('0x26')](function(_0x42d791){if(_0x42d791){_0x287a3a=_0x42d791;_0x1f2625[_0xcd2f('0x30')]=_['keys'](db[_0xcd2f('0x4c')][_0xcd2f('0x2c')]);_0x1f2625[_0xcd2f('0x35')]=_[_0xcd2f('0x31')](_0x215af2[_0xcd2f('0x35')]);_0x1f2625[_0xcd2f('0x32')]=_[_0xcd2f('0x33')](_0x1f2625[_0xcd2f('0x30')],_0x1f2625[_0xcd2f('0x35')]);_0x28f4a3[_0xcd2f('0x36')]=_[_0xcd2f('0x33')](_0x1f2625[_0xcd2f('0x30')],qs[_0xcd2f('0x34')](_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x34')]));_0x28f4a3[_0xcd2f('0x36')]=_0x28f4a3['attributes'][_0xcd2f('0x37')]?_0x28f4a3[_0xcd2f('0x36')]:_0x1f2625[_0xcd2f('0x30')];_0x28f4a3['order']=qs[_0xcd2f('0x3b')](_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x3b')]);_0x28f4a3[_0xcd2f('0x3c')]=qs[_0xcd2f('0x32')](_['pick'](_0x215af2[_0xcd2f('0x35')],_0x1f2625['filters']));if(_0x215af2[_0xcd2f('0x35')]['filter']){_0x28f4a3[_0xcd2f('0x3c')]=_[_0xcd2f('0x3f')](_0x28f4a3[_0xcd2f('0x3c')],{'$or':_[_0xcd2f('0x2b')](_0x28f4a3[_0xcd2f('0x36')],function(_0x210e37){var _0x11ac69={};_0x11ac69[_0x210e37]={'$like':'%'+_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x3e')]+'%'};return _0x11ac69;})});}if(_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x59')]){var _0x564b94=_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x59')]['split'](',');var _0x86aa6d={};_0x86aa6d[_0x564b94[0x0]]={'$gte':moment(_0x564b94[0x1])['format'](_0xcd2f('0x5a'))};_0x28f4a3[_0xcd2f('0x3c')]=_[_0xcd2f('0x3f')](_0x28f4a3[_0xcd2f('0x3c')],_0x86aa6d);}_0x28f4a3=_['merge']({},_0x28f4a3,_0x215af2[_0xcd2f('0x47')]);return _0x287a3a['getMessages'](_0x28f4a3);}})['then'](function(_0xef6399){if(_0xef6399){_0x4af001=_0xef6399[_0xcd2f('0x37')];if(!_0x215af2['query']['hasOwnProperty'](_0xcd2f('0x39'))){_0x28f4a3[_0xcd2f('0x1e')]=qs[_0xcd2f('0x1e')](_0x215af2[_0xcd2f('0x35')][_0xcd2f('0x1e')]);_0x28f4a3[_0xcd2f('0x1c')]=qs[_0xcd2f('0x1c')](_0x215af2[_0xcd2f('0x35')]['offset']);}return _0x287a3a[_0xcd2f('0x58')](_0x28f4a3);}})['then'](function(_0x3a69f8){if(_0x3a69f8){return _0x3a69f8?{'count':_0x4af001,'rows':_0x3a69f8}:null;}})['then'](respondWithResult(_0x21a282,null))['catch'](handleError(_0x21a282,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b91abb2..87d8a85 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 _0x631c=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x563e09,_0x1741e4){var _0x116a37=function(_0x368122){while(--_0x368122){_0x563e09['push'](_0x563e09['shift']());}};_0x116a37(++_0x1741e4);}(_0x631c,0x1b6));var _0xc631=function(_0x2d5d61,_0x41b810){_0x2d5d61=_0x2d5d61-0x0;var _0x425531=_0x631c[_0x2d5d61];return _0x425531;};'use strict';var EventEmitter=require(_0xc631('0x0'));var ChatGroup=require(_0xc631('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc631('0x2')](0x0);var events={'afterCreate':_0xc631('0x3'),'afterUpdate':'update','afterDestroy':_0xc631('0x4')};function emitEvent(_0x854d5b){return function(_0x128401,_0x4e8b9f,_0x17dc11){ChatGroupEvents[_0xc631('0x5')](_0x854d5b+':'+_0x128401['id'],_0x128401);ChatGroupEvents['emit'](_0x854d5b,_0x128401);_0x17dc11(null);};}for(var e in events){if(events[_0xc631('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xc631('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xfcf0=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5124d2,_0x3400cb){var _0x361478=function(_0x21915a){while(--_0x21915a){_0x5124d2['push'](_0x5124d2['shift']());}};_0x361478(++_0x3400cb);}(_0xfcf0,0x138));var _0x0fcf=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xfcf0[_0x50bf5a];return _0x4ddc1d;};'use strict';var EventEmitter=require(_0x0fcf('0x0'));var ChatGroup=require(_0x0fcf('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0fcf('0x2')](0x0);var events={'afterCreate':_0x0fcf('0x3'),'afterUpdate':_0x0fcf('0x4'),'afterDestroy':_0x0fcf('0x5')};function emitEvent(_0x5c865e){return function(_0x2fe6d8,_0x265968,_0x3bd34d){ChatGroupEvents[_0x0fcf('0x6')](_0x5c865e+':'+_0x2fe6d8['id'],_0x2fe6d8);ChatGroupEvents[_0x0fcf('0x6')](_0x5c865e,_0x2fe6d8);_0x3bd34d(null);};}for(var e in events){if(events[_0x0fcf('0x7')](e)){var event=events[e];ChatGroup[_0x0fcf('0x8')](e,emitEvent(event));}}module[_0x0fcf('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3450a70..41795c0 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 _0xbf8c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0xbf8c,0x138));var _0xcbf8=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xbf8c[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0xcbf8('0x0'));var util=require(_0xcbf8('0x1'));var logger=require(_0xcbf8('0x2'))(_0xcbf8('0x3'));var moment=require(_0xcbf8('0x4'));var BPromise=require(_0xcbf8('0x5'));var rp=require(_0xcbf8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbf8('0x7'));var attributes=require(_0xcbf8('0x8'));module[_0xcbf8('0x9')]=function(_0x11bf73,_0x28ea3e){return _0x11bf73[_0xcbf8('0xa')](_0xcbf8('0xb'),attributes,{'tableName':_0xcbf8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eb8=['../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e49de,_0x1d3dd9){var _0x328849=function(_0x457210){while(--_0x457210){_0x5e49de['push'](_0x5e49de['shift']());}};_0x328849(++_0x1d3dd9);}(_0x4eb8,0x88));var _0x84eb=function(_0x206137,_0x2a56c7){_0x206137=_0x206137-0x0;var _0x96c5f7=_0x4eb8[_0x206137];return _0x96c5f7;};'use strict';var _=require(_0x84eb('0x0'));var util=require(_0x84eb('0x1'));var logger=require(_0x84eb('0x2'))(_0x84eb('0x3'));var moment=require(_0x84eb('0x4'));var BPromise=require(_0x84eb('0x5'));var rp=require(_0x84eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84eb('0x7'));var attributes=require(_0x84eb('0x8'));module['exports']=function(_0x260bd5,_0x487fef){return _0x260bd5['define'](_0x84eb('0x9'),attributes,{'tableName':_0x84eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index c9b1f8d..5849271 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 _0xd51f=['error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5bb855,_0x5279be){var _0x238828=function(_0x4f74c9){while(--_0x4f74c9){_0x5bb855['push'](_0x5bb855['shift']());}};_0x238828(++_0x5279be);}(_0xd51f,0xf0));var _0xfd51=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd51f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var moment=require('moment');var BPromise=require(_0xfd51('0x2'));var rs=require(_0xfd51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd51('0x4'))['db'];var utils=require(_0xfd51('0x5'));var logger=require('../../config/logger')(_0xfd51('0x6'));var config=require(_0xfd51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd51('0x8')][_0xfd51('0x9')]({'port':0x232a});config['redis']=_[_0xfd51('0xa')](config[_0xfd51('0xb')],{'host':_0xfd51('0xc'),'port':0x18eb});var socket=require(_0xfd51('0xd'))(new Redis(config[_0xfd51('0xb')]));require('./chatGroup.socket')[_0xfd51('0xe')](socket);function respondWithRpcPromise(_0x444385,_0x2878c6,_0x5cc2a8){return new BPromise(function(_0x19d70e,_0x5a6fcc){return client['request'](_0x444385,_0x5cc2a8)[_0xfd51('0xf')](function(_0xfc313b){logger[_0xfd51('0x10')]('ChatGroup,\x20%s,\x20%s',_0x2878c6,'request\x20sent');logger['debug'](_0xfd51('0x11'),_0x2878c6,_0xfd51('0x12'),JSON[_0xfd51('0x13')](_0xfc313b));if(_0xfc313b[_0xfd51('0x14')]){if(_0xfc313b[_0xfd51('0x14')][_0xfd51('0x15')]===0x1f4){logger[_0xfd51('0x14')]('ChatGroup,\x20%s,\x20%s',_0x2878c6,_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);return _0x5a6fcc(_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);}logger[_0xfd51('0x14')](_0xfd51('0x17'),_0x2878c6,_0xfc313b[_0xfd51('0x14')][_0xfd51('0x16')]);return _0x19d70e(_0xfc313b['error'][_0xfd51('0x16')]);}else{logger['info'](_0xfd51('0x17'),_0x2878c6,_0xfd51('0x12'));_0x19d70e(_0xfc313b[_0xfd51('0x18')][_0xfd51('0x16')]);}})[_0xfd51('0x19')](function(_0x22b2d0){logger[_0xfd51('0x14')](_0xfd51('0x17'),_0x2878c6,_0x22b2d0);_0x5a6fcc(_0x22b2d0);});});} \ No newline at end of file +var _0x7ec7=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','socket.io-emitter','./chatGroup.socket','request'];(function(_0x37e342,_0x160c8f){var _0x1768f9=function(_0x413c98){while(--_0x413c98){_0x37e342['push'](_0x37e342['shift']());}};_0x1768f9(++_0x160c8f);}(_0x7ec7,0x19b));var _0x77ec=function(_0x57a368,_0x69b27c){_0x57a368=_0x57a368-0x0;var _0x26ac3b=_0x7ec7[_0x57a368];return _0x26ac3b;};'use strict';var _=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var moment=require(_0x77ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x77ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77ec('0x4'))['db'];var utils=require(_0x77ec('0x5'));var logger=require(_0x77ec('0x6'))('rpc');var config=require(_0x77ec('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77ec('0x8')]({'port':0x232a});config['redis']=_[_0x77ec('0x9')](config[_0x77ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x77ec('0xb'))(new Redis(config[_0x77ec('0xa')]));require(_0x77ec('0xc'))['register'](socket);function respondWithRpcPromise(_0xd62db6,_0x329cb9,_0x3d87cc){return new BPromise(function(_0x300933,_0x4494c7){return client[_0x77ec('0xd')](_0xd62db6,_0x3d87cc)[_0x77ec('0xe')](function(_0x5c3bf4){logger[_0x77ec('0xf')](_0x77ec('0x10'),_0x329cb9,_0x77ec('0x11'));logger[_0x77ec('0x12')](_0x77ec('0x13'),_0x329cb9,'request\x20sent',JSON[_0x77ec('0x14')](_0x5c3bf4));if(_0x5c3bf4['error']){if(_0x5c3bf4['error'][_0x77ec('0x15')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x329cb9,_0x5c3bf4[_0x77ec('0x16')]['message']);return _0x4494c7(_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);}logger[_0x77ec('0x16')]('ChatGroup,\x20%s,\x20%s',_0x329cb9,_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);return _0x300933(_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);}else{logger[_0x77ec('0xf')]('ChatGroup,\x20%s,\x20%s',_0x329cb9,_0x77ec('0x11'));_0x300933(_0x5c3bf4[_0x77ec('0x18')]['message']);}})['catch'](function(_0x49a879){logger[_0x77ec('0x16')](_0x77ec('0x10'),_0x329cb9,_0x49a879);_0x4494c7(_0x49a879);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 877ed08..c26ebef 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 _0xc9bc=['save','emit','removeListener','length'];(function(_0x1b8a6c,_0x4c2a5f){var _0x13ec3b=function(_0x53e579){while(--_0x53e579){_0x1b8a6c['push'](_0x1b8a6c['shift']());}};_0x13ec3b(++_0x4c2a5f);}(_0xc9bc,0xe4));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcc9b('0x0'),'remove','update'];function createListener(_0x49ab71,_0x1f4bba){return function(_0x4f1149){_0x1f4bba[_0xcc9b('0x1')](_0x49ab71,_0x4f1149);};}function removeListener(_0x1ef706,_0x8a649c){return function(){ChatGroupEvents[_0xcc9b('0x2')](_0x1ef706,_0x8a649c);};}exports['register']=function(_0x2094e3){for(var _0x27cb0a=0x0,_0x28d4cd=events[_0xcc9b('0x3')];_0x27cb0a<_0x28d4cd;_0x27cb0a++){var _0x38242f=events[_0x27cb0a];var _0x5669f2=createListener('chatGroup:'+_0x38242f,_0x2094e3);ChatGroupEvents['on'](_0x38242f,_0x5669f2);}}; \ No newline at end of file +var _0x5704=['removeListener','length','./chatGroup.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5704,0xed));var _0x4570=function(_0x3a29e5,_0xffee26){_0x3a29e5=_0x3a29e5-0x0;var _0x496fb5=_0x5704[_0x3a29e5];return _0x496fb5;};'use strict';var ChatGroupEvents=require(_0x4570('0x0'));var events=['save',_0x4570('0x1'),_0x4570('0x2')];function createListener(_0xc73d2d,_0x41b5db){return function(_0x3c885a){_0x41b5db['emit'](_0xc73d2d,_0x3c885a);};}function removeListener(_0x13b8e8,_0x43f98b){return function(){ChatGroupEvents[_0x4570('0x3')](_0x13b8e8,_0x43f98b);};}exports['register']=function(_0xfa91ee){for(var _0x150655=0x0,_0x506086=events[_0x4570('0x4')];_0x150655<_0x506086;_0x150655++){var _0x2f37c2=events[_0x150655];var _0x20b87b=createListener('chatGroup:'+_0x2f37c2,_0xfa91ee);ChatGroupEvents['on'](_0x2f37c2,_0x20b87b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 383f41f..d7d2652 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 _0x6629=['create','/:id/members','addMembers','addMessage','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','describe','/:id','get','getUnread','getMembers','/:id/messages','getMessages','post'];(function(_0x5af6f0,_0x5a031b){var _0x5e1016=function(_0x413d55){while(--_0x413d55){_0x5af6f0['push'](_0x5af6f0['shift']());}};_0x5e1016(++_0x5a031b);}(_0x6629,0x13c));var _0x9662=function(_0xd4963d,_0x78bf48){_0xd4963d=_0xd4963d-0x0;var _0x3246b0=_0x6629[_0xd4963d];return _0x3246b0;};'use strict';var multer=require(_0x9662('0x0'));var util=require(_0x9662('0x1'));var path=require('path');var timeout=require(_0x9662('0x2'));var express=require('express');var router=express[_0x9662('0x3')]();var fs_extra=require(_0x9662('0x4'));var auth=require(_0x9662('0x5'));var interaction=require(_0x9662('0x6'));var config=require(_0x9662('0x7'));var controller=require(_0x9662('0x8'));router['get']('/',auth[_0x9662('0x9')](),controller[_0x9662('0xa')]);router['get'](_0x9662('0xb'),auth[_0x9662('0x9')](),controller[_0x9662('0xc')]);router['get'](_0x9662('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9662('0xe')]('/:id/unread',auth['isAuthenticated'](),controller[_0x9662('0xf')]);router[_0x9662('0xe')]('/:id/members',auth[_0x9662('0x9')](),controller[_0x9662('0x10')]);router['get'](_0x9662('0x11'),auth['isAuthenticated'](),controller[_0x9662('0x12')]);router[_0x9662('0x13')]('/',auth[_0x9662('0x9')](),controller[_0x9662('0x14')]);router[_0x9662('0x13')](_0x9662('0x15'),auth['isAuthenticated'](),controller[_0x9662('0x16')]);router[_0x9662('0x13')](_0x9662('0x11'),auth['isAuthenticated'](),controller[_0x9662('0x17')]);router[_0x9662('0x18')](_0x9662('0xd'),auth[_0x9662('0x9')](),controller['update']);router[_0x9662('0x19')](_0x9662('0xd'),auth['isAuthenticated'](),controller[_0x9662('0x1a')]);router[_0x9662('0x19')](_0x9662('0x15'),auth[_0x9662('0x9')](),controller['removeMembers']);module[_0x9662('0x1b')]=router; \ No newline at end of file +var _0xcb48=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcb48,0xda));var _0x8cb4=function(_0x10f9b6,_0x41fe76){_0x10f9b6=_0x10f9b6-0x0;var _0xca3e65=_0xcb48[_0x10f9b6];return _0xca3e65;};'use strict';var multer=require(_0x8cb4('0x0'));var util=require('util');var path=require(_0x8cb4('0x1'));var timeout=require(_0x8cb4('0x2'));var express=require(_0x8cb4('0x3'));var router=express[_0x8cb4('0x4')]();var fs_extra=require(_0x8cb4('0x5'));var auth=require(_0x8cb4('0x6'));var interaction=require(_0x8cb4('0x7'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x8cb4('0x8')]('/',auth[_0x8cb4('0x9')](),controller['index']);router['get'](_0x8cb4('0xa'),auth[_0x8cb4('0x9')](),controller[_0x8cb4('0xb')]);router[_0x8cb4('0x8')](_0x8cb4('0xc'),auth[_0x8cb4('0x9')](),controller[_0x8cb4('0xd')]);router['get'](_0x8cb4('0xe'),auth['isAuthenticated'](),controller[_0x8cb4('0xf')]);router[_0x8cb4('0x8')](_0x8cb4('0x10'),auth['isAuthenticated'](),controller[_0x8cb4('0x11')]);router[_0x8cb4('0x8')](_0x8cb4('0x12'),auth['isAuthenticated'](),controller[_0x8cb4('0x13')]);router['post']('/',auth[_0x8cb4('0x9')](),controller['create']);router[_0x8cb4('0x14')](_0x8cb4('0x10'),auth[_0x8cb4('0x9')](),controller[_0x8cb4('0x15')]);router[_0x8cb4('0x14')](_0x8cb4('0x12'),auth['isAuthenticated'](),controller[_0x8cb4('0x16')]);router[_0x8cb4('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x8cb4('0x18')]);router[_0x8cb4('0x19')](_0x8cb4('0xc'),auth[_0x8cb4('0x9')](),controller[_0x8cb4('0x1a')]);router['delete']('/:id/members',auth[_0x8cb4('0x9')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f16eef6..84a7f10 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 _0x375a=['star','STRING','TEXT','long','DATE','out','sequelize','BOOLEAN','INTEGER','ENUM','thumb'];(function(_0x56b1aa,_0x526389){var _0x9489ab=function(_0x896e5c){while(--_0x896e5c){_0x56b1aa['push'](_0x56b1aa['shift']());}};_0x9489ab(++_0x526389);}(_0x375a,0x95));var _0xa375=function(_0x4d833b,_0x282fc3){_0x4d833b=_0x4d833b-0x0;var _0x207499=_0x375a[_0x4d833b];return _0x207499;};'use strict';var Sequelize=require(_0xa375('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa375('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa375('0x2')]},'ratingType':{'type':Sequelize[_0xa375('0x3')]('star',_0xa375('0x4')),'defaultValue':_0xa375('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa375('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa375('0x6')]},'thirdDisposition':{'type':Sequelize[_0xa375('0x6')]},'note':{'type':Sequelize[_0xa375('0x6')]},'browserName':{'type':Sequelize[_0xa375('0x6')]},'browserVersion':{'type':Sequelize[_0xa375('0x6')]},'osName':{'type':Sequelize[_0xa375('0x6')]},'osVersion':{'type':Sequelize[_0xa375('0x6')]},'deviceModel':{'type':Sequelize[_0xa375('0x6')]},'deviceVendor':{'type':Sequelize[_0xa375('0x6')]},'deviceType':{'type':Sequelize[_0xa375('0x6')]},'referer':{'type':Sequelize[_0xa375('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa375('0x7')](_0xa375('0x8'))},'read1stAt':{'type':Sequelize[_0xa375('0x9')]},'lastMsgAt':{'type':Sequelize[_0xa375('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xa375('0x3')]('in',_0xa375('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa375('0x6')]},'customerPort':{'type':Sequelize[_0xa375('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xa375('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xa375('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa375('0x2')]}}; \ No newline at end of file +var _0x035c=['exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x035c,0xc5));var _0xc035=function(_0x2304e4,_0x2fd0f5){_0x2304e4=_0x2304e4-0x0;var _0x1561f7=_0x035c[_0x2304e4];return _0x1561f7;};'use strict';var Sequelize=require(_0xc035('0x0'));module[_0xc035('0x1')]={'closed':{'type':Sequelize[_0xc035('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc035('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xc035('0x4'),_0xc035('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc035('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xc035('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc035('0x8')]},'disposition':{'type':Sequelize[_0xc035('0x7')]},'secondDisposition':{'type':Sequelize[_0xc035('0x7')]},'thirdDisposition':{'type':Sequelize[_0xc035('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xc035('0x7')]},'browserVersion':{'type':Sequelize[_0xc035('0x7')]},'osName':{'type':Sequelize[_0xc035('0x7')]},'osVersion':{'type':Sequelize[_0xc035('0x7')]},'deviceModel':{'type':Sequelize[_0xc035('0x7')]},'deviceVendor':{'type':Sequelize[_0xc035('0x7')]},'deviceType':{'type':Sequelize[_0xc035('0x7')]},'referer':{'type':Sequelize[_0xc035('0x6')]},'customerIp':{'type':Sequelize[_0xc035('0x7')]},'formData':{'type':Sequelize[_0xc035('0x6')](_0xc035('0x9'))},'read1stAt':{'type':Sequelize[_0xc035('0x8')]},'lastMsgAt':{'type':Sequelize[_0xc035('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xc035('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc035('0x7')]},'customerPort':{'type':Sequelize[_0xc035('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xc035('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc035('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 35f26ce..4e7f78d 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 _0xb14a=['defaults','localhost','./chatInteraction.socket','register','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','then','destroy','end','stack','name','send','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','key','getOptions','findAll','chat','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','include','find','create','update','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','vidaooTopic','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','attachmentUpload','file','basename','filename','type','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','agentAlias','customer','format','%s%d','Visitor','ContactId','agentIdentifier','website_alias','System','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','options','includeAll','rows','getMyMessages','pick','includeAgent','push','setTags','spread','Tag','color','removeTags','toString','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0xd5e0c0,_0x9cd318){var _0x30b3de=function(_0xbf717c){while(--_0xbf717c){_0xd5e0c0['push'](_0xd5e0c0['shift']());}};_0x30b3de(++_0x9cd318);}(_0xb14a,0x197));var _0xab14=function(_0x1f3c66,_0x2df6dc){_0x1f3c66=_0x1f3c66-0x0;var _0x26c49e=_0xb14a[_0x1f3c66];return _0x26c49e;};'use strict';var rimraf=require(_0xab14('0x0'));var zipdir=require(_0xab14('0x1'));var rp=require('request-promise');var moment=require(_0xab14('0x2'));var BPromise=require(_0xab14('0x3'));var Mustache=require(_0xab14('0x4'));var util=require(_0xab14('0x5'));var path=require(_0xab14('0x6'));var ejs=require(_0xab14('0x7'));var fs=require('fs');var _=require(_0xab14('0x8'));var Redis=require(_0xab14('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0xab14('0xa'));var pdf=require(_0xab14('0xb'));var logger=require(_0xab14('0xc'))(_0xab14('0xd'));var config=require(_0xab14('0xe'));var db=require(_0xab14('0xf'))['db'];config[_0xab14('0x10')]=_[_0xab14('0x11')](config[_0xab14('0x10')],{'host':_0xab14('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab14('0x10')]));require(_0xab14('0x13'))[_0xab14('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0xab14('0x15')]['http']({'port':0x232b});var client9004=jayson[_0xab14('0x15')][_0xab14('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x38bb0e,_0xbcd762,_0x23aa0d,_0x2cdcae){return new BPromise(function(_0x422f63,_0x1e944f){var _0x35c7b2=_0x2cdcae||client;return _0x35c7b2[_0xab14('0x17')](_0x38bb0e,_0x23aa0d)['then'](function(_0x32174b){logger['info'](_0xab14('0x18'),_0xbcd762,_0xab14('0x19'));logger[_0xab14('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xbcd762,_0xab14('0x19'),JSON[_0xab14('0x1b')](_0x32174b));if(_0x32174b[_0xab14('0x1c')]){if(_0x32174b[_0xab14('0x1c')][_0xab14('0x1d')]===0x1f4){logger[_0xab14('0x1c')](_0xab14('0x18'),_0xbcd762,_0x32174b[_0xab14('0x1c')]['message']);return _0x1e944f(_0x32174b['error'][_0xab14('0x1e')]);}logger[_0xab14('0x1c')](_0xab14('0x18'),_0xbcd762,_0x32174b[_0xab14('0x1c')]['message']);return _0x422f63(_0x32174b[_0xab14('0x1c')][_0xab14('0x1e')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xbcd762,_0xab14('0x19'));_0x422f63(_0x32174b[_0xab14('0x1f')][_0xab14('0x1e')]);}})[_0xab14('0x20')](function(_0x5a652f){logger['error'](_0xab14('0x18'),_0xbcd762,_0x5a652f);_0x1e944f(_0x5a652f);});});}function respondWithStatusCode(_0x552c69,_0x67a806){_0x67a806=_0x67a806||0xcc;return function(_0x2ca02c){if(_0x2ca02c){return _0x552c69[_0xab14('0x21')](_0x67a806);}return _0x552c69[_0xab14('0x22')](_0x67a806)['end']();};}function respondWithResult(_0x267ede,_0x5aa19e){_0x5aa19e=_0x5aa19e||0xc8;return function(_0x3d22e3){if(_0x3d22e3){return _0x267ede[_0xab14('0x22')](_0x5aa19e)['json'](_0x3d22e3);}};}function respondWithFilteredResult(_0x312b9f,_0x5af8de){return function(_0x3e73f5){if(_0x3e73f5){var _0x4d351e=typeof _0x5af8de[_0xab14('0x23')]===_0xab14('0x24')&&typeof _0x5af8de[_0xab14('0x25')]===_0xab14('0x24');var _0x6be9d5=_0x3e73f5[_0xab14('0x26')];var _0x3801ae=_0x4d351e?0x0:_0x5af8de[_0xab14('0x23')];var _0x27f3f0=_0x4d351e?_0x3e73f5[_0xab14('0x26')]:_0x5af8de[_0xab14('0x23')]+_0x5af8de['limit'];var _0x1356ee;if(_0x27f3f0>=_0x6be9d5){_0x27f3f0=_0x6be9d5;_0x1356ee=0xc8;}else{_0x1356ee=0xce;}_0x312b9f['status'](_0x1356ee);return _0x312b9f['set'](_0xab14('0x27'),_0x3801ae+'-'+_0x27f3f0+'/'+_0x6be9d5)[_0xab14('0x28')](_0x3e73f5);}return null;};}function saveUpdates(_0x3ffe65){return function(_0x42cc40){if(_0x42cc40){return _0x42cc40['update'](_0x3ffe65)[_0xab14('0x29')](function(_0x3fa6ad){return _0x3fa6ad;});}return null;};}function removeEntity(_0x4166d3){return function(_0x571b2c){if(_0x571b2c){return _0x571b2c[_0xab14('0x2a')]()[_0xab14('0x29')](function(){_0x4166d3[_0xab14('0x22')](0xcc)[_0xab14('0x2b')]();});}};}function handleEntityNotFound(_0x5b0742){return function(_0x14dd26){if(!_0x14dd26){_0x5b0742[_0xab14('0x21')](0x194);}return _0x14dd26;};}function handleError(_0x7d05c,_0x28b18e){_0x28b18e=_0x28b18e||0x1f4;return function(_0x51bd9a){logger[_0xab14('0x1c')](_0x51bd9a[_0xab14('0x2c')]);if(_0x51bd9a[_0xab14('0x2d')]){delete _0x51bd9a[_0xab14('0x2d')];}_0x7d05c['status'](_0x28b18e)[_0xab14('0x2e')](_0x51bd9a);};}function getMustacheRender(_0x3d80a1,_0x2ff1e7){return Mustache[_0xab14('0x2f')](_0x3d80a1,_[_0xab14('0x30')](_0x2ff1e7[_0xab14('0x31')],{'contact':_0x2ff1e7[_0xab14('0x32')],'message':_0x2ff1e7[_0xab14('0x1e')],'agent':_0x2ff1e7[_0xab14('0x33')],'interaction':_0x2ff1e7[_0xab14('0x34')],'account':_0x2ff1e7[_0xab14('0x35')]}))||'';}exports['index']=function(_0x3a293d,_0x5b340c){var _0x5be832={};var _0x3a099e=_[_0xab14('0x36')](db[_0xab14('0x37')][_0xab14('0x38')],function(_0x573e95){return{'name':_0x573e95['fieldName'],'type':_0x573e95['type'][_0xab14('0x39')]};});_0x5be832=qs[_0xab14('0x3a')](_0x3a099e,_0x3a293d);return interaction[_0xab14('0x3b')](_0xab14('0x3c'),_0x3a293d[_0xab14('0x3d')],_0x3a293d[_0xab14('0x3e')],_0x5be832,_0x3a099e)[_0xab14('0x29')](respondWithFilteredResult(_0x5b340c,_0x5be832))[_0xab14('0x20')](handleError(_0x5b340c,null));};exports[_0xab14('0x3f')]=function(_0x1caa91,_0x2354be){var _0xb2a99f={'raw':![],'where':{'id':_0x1caa91[_0xab14('0x40')]['id']}},_0xd878d6={};_0xd878d6[_0xab14('0x41')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0xd878d6['query']=_[_0xab14('0x42')](_0x1caa91[_0xab14('0x3d')]);_0xd878d6[_0xab14('0x43')]=_[_0xab14('0x44')](_0xd878d6[_0xab14('0x41')],_0xd878d6[_0xab14('0x3d')]);_0xb2a99f[_0xab14('0x45')]=_['intersection'](_0xd878d6['model'],qs['fields'](_0x1caa91[_0xab14('0x3d')][_0xab14('0x46')]));_0xb2a99f[_0xab14('0x45')]=_0xb2a99f[_0xab14('0x45')][_0xab14('0x47')]?_0xb2a99f[_0xab14('0x45')]:_0xd878d6[_0xab14('0x41')];if(_0x1caa91[_0xab14('0x3d')]['includeAll']){_0xb2a99f[_0xab14('0x48')]=[{'all':!![]}];}_0xb2a99f=_['merge']({},_0xb2a99f,_0x1caa91['options']);return db['ChatInteraction'][_0xab14('0x49')](_0xb2a99f)[_0xab14('0x29')](handleEntityNotFound(_0x2354be,null))[_0xab14('0x29')](respondWithResult(_0x2354be,null))[_0xab14('0x20')](handleError(_0x2354be,null));};exports[_0xab14('0x4a')]=function(_0x423dd6,_0x2958af){return db['ChatInteraction'][_0xab14('0x4a')](_0x423dd6[_0xab14('0x31')],{})['then'](respondWithResult(_0x2958af,0xc9))[_0xab14('0x20')](handleError(_0x2958af,null));};exports[_0xab14('0x4b')]=function(_0x236da3,_0x413964){if(_0x236da3[_0xab14('0x31')]['id']){delete _0x236da3[_0xab14('0x31')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x236da3[_0xab14('0x40')]['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x413964,null))['then'](saveUpdates(_0x236da3[_0xab14('0x31')],null))[_0xab14('0x29')](respondWithResult(_0x413964,null))[_0xab14('0x20')](handleError(_0x413964,null));};exports['destroy']=function(_0x3e653a,_0x4ee84b){return db['ChatInteraction']['find']({'where':{'id':_0x3e653a[_0xab14('0x40')]['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x4ee84b,null))['then'](removeEntity(_0x4ee84b,null))[_0xab14('0x20')](handleError(_0x4ee84b,null));};exports[_0xab14('0x4c')]=function(_0x1c7a4b,_0x2edcd0){return db['ChatInteraction'][_0xab14('0x4c')]()[_0xab14('0x29')](respondWithResult(_0x2edcd0,null))[_0xab14('0x20')](handleError(_0x2edcd0,null));};exports[_0xab14('0x4d')]=function(_0x43b4c3,_0x50d94c){var _0x4e75bf=_0x43b4c3['params']['id'];var _0x50f658;var _0x33513b;var _0x383d13;return db['ChatInteraction']['findOne']({'where':{'id':_0x4e75bf}})[_0xab14('0x29')](function(_0x19580c){_0x50f658=_0x19580c;return db[_0xab14('0x4e')][_0xab14('0x4f')]({'where':{'id':_0x19580c[_0xab14('0x50')]},'attributes':['id','vidaooApiKey',_0xab14('0x51'),'vidaooTopic',_0xab14('0x52'),_0xab14('0x53')],'raw':!![]});})['then'](function(_0x17c8a4){if(_0x17c8a4&&_0x17c8a4['vidaooApiKey']&&_0x17c8a4[_0xab14('0x51')]){_0x33513b=_0x17c8a4;var _0x12c2e4={'interaction':{'id':_0x4e75bf},'agent':{'id':_0x43b4c3[_0xab14('0x3e')]['id'],'name':_0x43b4c3[_0xab14('0x3e')][_0xab14('0x2d')],'fullname':_0x43b4c3['user']['fullname'],'email':_0x43b4c3['user'][_0xab14('0x54')]},'contact':_0x43b4c3['body'][_0xab14('0x32')],'account':_0x43b4c3['body'][_0xab14('0x35')]};var _0x5a9788={'rejectUnauthorized':![],'method':_0xab14('0x55'),'url':_0xab14('0x56'),'headers':{'X-APIKEY':_0x17c8a4[_0xab14('0x57')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x43b4c3[_0xab14('0x3e')][_0xab14('0x54')]],'buttons':null,'topic':_0x33513b[_0xab14('0x58')],'note':_[_0xab14('0x59')](_0x33513b[_0xab14('0x52')])?null:getMustacheRender(_0x33513b['vidaooNote'],_0x12c2e4),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xab14('0x59')](_0x33513b[_0xab14('0x53')])){var _0x6f25a6=getMustacheRender(_0x33513b[_0xab14('0x53')],_0x12c2e4);var _0x305eb8=JSON['parse'](_0x6f25a6);_0x5a9788['body'][_0xab14('0x5a')]=_0x305eb8;}}catch(_0x504730){throw new db[(_0xab14('0x5b'))][(_0xab14('0x5c'))](_0xab14('0x5d'));}return rp(_0x5a9788);}else{throw new db[(_0xab14('0x5b'))][(_0xab14('0x5c'))](_0xab14('0x5e'));}})[_0xab14('0x29')](function(_0x23622e){_0x383d13=_0x23622e;if(_0x383d13['id']){var _0x8d3784={'body':_0x383d13[_0xab14('0x5f')],'ChatWebsiteId':_0x33513b['id'],'ChatInteractionId':_0x50f658['id'],'direction':_0xab14('0x60'),'UserId':_0x43b4c3['user']['id']};return db[_0xab14('0x61')][_0xab14('0x4a')](_0x8d3784,{});}else{throw new db['Sequelize'][(_0xab14('0x5c'))](_0xab14('0x62'));}})[_0xab14('0x29')](function(){return _0x50f658[_0xab14('0x63')]({'vidaooSessionId':_0x383d13['id']});})[_0xab14('0x29')](respondWithResult(_0x50d94c,null))['catch'](handleError(_0x50d94c,null));};exports[_0xab14('0x64')]=function(_0x2abfa0,_0x41b6e5){if(_0x2abfa0[_0xab14('0x31')]['id']){delete _0x2abfa0[_0xab14('0x31')]['id'];}return db['ChatInteraction'][_0xab14('0x49')]({'where':{'id':_0x2abfa0[_0xab14('0x40')]['id']},'include':[{'model':db[_0xab14('0x65')],'as':_0xab14('0x66')}]})[_0xab14('0x29')](handleEntityNotFound(_0x41b6e5,null))[_0xab14('0x29')](saveUpdates(_0x2abfa0[_0xab14('0x31')],null))[_0xab14('0x29')](respondWithResult(_0x41b6e5,null))[_0xab14('0x20')](handleError(_0x41b6e5,null));};exports[_0xab14('0x67')]=function(_0x4cbf86,_0x4a39f3){if(_0x4cbf86[_0xab14('0x31')]['id']){delete _0x4cbf86['body']['id'];}return db[_0xab14('0x37')]['find']({'where':{'id':_0x4cbf86[_0xab14('0x40')]['id']}})['then'](function(_0x2c1554){if(!_0x2c1554){logger[_0xab14('0x1c')](_0xab14('0x68'),_0xab14('0x67'),0x194,_0xab14('0x69'));_0x4a39f3[_0xab14('0x21')](0x194);}else{if(_0x2c1554[_0xab14('0x6a')]){throw new db[(_0xab14('0x5b'))][(_0xab14('0x5c'))](_0xab14('0x6b'));}}return _0x2c1554;})['then'](function(_0x153ebe){if(_0x153ebe){return _0x153ebe[_0xab14('0x4b')]({'closed':_0x4cbf86[_0xab14('0x31')]['closed'],'disposition':_0x4cbf86['body']['disposition']})[_0xab14('0x29')](function(_0x4166a3){return _0x4166a3;});}})[_0xab14('0x29')](function(){return respondWithRpcPromise('AbandonInteraction',_0xab14('0x67'),_0x4cbf86[_0xab14('0x31')],client9004);})[_0xab14('0x29')](respondWithResult(_0x4a39f3,null))[_0xab14('0x20')](handleError(_0x4a39f3,null));};exports[_0xab14('0x6c')]=function(_0x2dccb3,_0x5df2e5){_0x2dccb3['body'][_0xab14('0x2d')]=_0x2dccb3[_0xab14('0x6d')]['originalname'];_0x2dccb3[_0xab14('0x31')][_0xab14('0x6e')]=_0x2dccb3[_0xab14('0x6d')][_0xab14('0x6f')];_0x2dccb3[_0xab14('0x31')][_0xab14('0x70')]=_0x2dccb3[_0xab14('0x6d')][_0xab14('0x71')];return db[_0xab14('0x72')][_0xab14('0x4a')](_0x2dccb3[_0xab14('0x31')])[_0xab14('0x29')](respondWithResult(_0x5df2e5,0xc9))[_0xab14('0x20')](handleError(_0x5df2e5,null));};exports[_0xab14('0x73')]=function(_0x39c8c6,_0x48364b){return db[_0xab14('0x37')][_0xab14('0x4f')]({'where':{'id':_0x39c8c6[_0xab14('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x48364b,null))[_0xab14('0x29')](function(_0x4b8af6){if(_0x4b8af6){if(_0x4b8af6[_0xab14('0x74')]){return _0x48364b[_0xab14('0x22')](0x193)[_0xab14('0x28')]({'status':0x193,'message':_0xab14('0x75')});}return db[_0xab14('0x72')][_0xab14('0x4f')]({'where':{'id':_0x39c8c6[_0xab14('0x3d')][_0xab14('0x76')]},'raw':!![]})[_0xab14('0x29')](handleEntityNotFound(_0x48364b,null));}})[_0xab14('0x29')](function(_0x43da62){if(_0x43da62){var _0xdd8093=_0x43da62[_0xab14('0x77')]!==null;var _0x2545f1=path[_0xab14('0x78')](config[_0xab14('0x79')],'server/files/attachments/');if(_0xdd8093){_0x2545f1=path[_0xab14('0x78')](_0x2545f1,_0xab14('0x7a'));}var _0x304aff=path[_0xab14('0x78')](_0x2545f1,_0x43da62[_0xab14('0x6e')]);return _0x48364b[_0xab14('0x7b')](_0x304aff);}})['catch'](handleError(_0x48364b,null));};exports[_0xab14('0x7c')]=function(_0x48b6ae,_0x402ee6){var _0x34a869=null;var _0x30dd4d=null;var _0x1b1054=null;if(_0x48b6ae[_0xab14('0x31')]['id']){delete _0x48b6ae[_0xab14('0x31')]['id'];}if(_0x48b6ae[_0xab14('0x31')]['mailTranscript']){_0x1b1054=path[_0xab14('0x78')](config['root'],_0xab14('0x7d'),util['format'](_0xab14('0x7e'),Date['now']()));_0x48b6ae[_0xab14('0x31')][_0xab14('0x7f')]=_0x1b1054;}return db[_0xab14('0x37')]['find']({'where':{'id':_0x48b6ae[_0xab14('0x40')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xab14('0x80'),'include':[{'model':db[_0xab14('0x81')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x402ee6,null))[_0xab14('0x29')](saveUpdates(_0x48b6ae[_0xab14('0x31')],null))['then'](function(_0x47894c){if(_0x47894c){_0x34a869=_0x47894c;return db[_0xab14('0x4e')]['find']({'where':{'id':_0x34a869[_0xab14('0x50')]}});}})[_0xab14('0x29')](function(_0x1ef34f){if(_0x1ef34f){_0x30dd4d=_0x1ef34f;return db[_0xab14('0x65')][_0xab14('0x49')]({'where':{'id':_0x34a869['ContactId']}});}})[_0xab14('0x29')](function(_0x235603){if(_0x235603){if(_0x1b1054){var _0x486b19=null;for(var _0x5d01ba=0x1;_0x5d01ba<_0x34a869[_0xab14('0x80')][_0xab14('0x47')];++_0x5d01ba){_0x486b19=_0x34a869['Messages'][_0x5d01ba];var _0x1660ca=_0x486b19[_0xab14('0x6a')]?util['format']('%s%d',_0x30dd4d[_0xab14('0x82')],_0x486b19['UserId']):'System';var _0x5ccd29=_0x48b6ae['body'][_0xab14('0x83')]||util[_0xab14('0x84')](_0xab14('0x85'),_0xab14('0x86'),_0x486b19[_0xab14('0x87')]);switch(_0x30dd4d[_0xab14('0x88')]){case _0xab14('0x89'):_0x1660ca=_0x486b19[_0xab14('0x6a')]?util['format']('%s%d',_0x30dd4d[_0xab14('0x82')],_0x486b19[_0xab14('0x6a')]):_0xab14('0x8a');break;case'agent_alias':_0x1660ca=_0x486b19[_0xab14('0x6a')]?_0x486b19[_0xab14('0x81')][_0xab14('0x8b')]||_0x486b19[_0xab14('0x81')][_0xab14('0x8c')]:_0xab14('0x8a');break;case _0xab14('0x8d'):_0x1660ca=_0x486b19[_0xab14('0x6a')]?_0x486b19['User'][_0xab14('0x8c')]:_0xab14('0x8a');break;default:_0x1660ca=_0x486b19['UserId']?util['format'](_0xab14('0x85'),_0x30dd4d[_0xab14('0x82')],_0x486b19['UserId']):_0xab14('0x8a');}var _0xf7b7b3=util[_0xab14('0x84')]('[%s]\x20%s:\x20%s\x0a',moment(_0x486b19[_0xab14('0x8e')])[_0xab14('0x84')](_0xab14('0x8f')),_0x486b19[_0xab14('0x90')]==='in'?_0x5ccd29:_0x1660ca,_0x486b19['body']);if(!_0x486b19[_0xab14('0x91')]){fs[_0xab14('0x92')](_0x1b1054,_0xf7b7b3);}}return db['MailAccount'][_0xab14('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0xab14('0x93')],'as':_0xab14('0x94'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xab14('0x95'),'raw':!![]}]}]});}}})[_0xab14('0x29')](function(_0x3f720b){if(!_0x3f720b||!_0x3f720b[_0xab14('0x94')]||!_0x48b6ae[_0xab14('0x31')])return _0x34a869;var _0x460f0d=_0x3f720b[_0xab14('0x96')]();return respondWithRpcPromise('SendMail',_0xab14('0x97'),{'account':_0x460f0d,'message':{'from':util[_0xab14('0x84')](_0xab14('0x98'),_0x3f720b['name'],_0x3f720b[_0xab14('0x54')]||_0x3f720b[_0xab14('0x94')][_0xab14('0x3e')]),'to':_0x48b6ae[_0xab14('0x31')][_0xab14('0x99')],'subject':_0xab14('0x9a'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48b6ae['body'][_0xab14('0x99')]),'attachments':[{'path':_0x1b1054}]}})[_0xab14('0x29')](function(){return _0x34a869;})['catch'](function(_0x42a3e2){logger[_0xab14('0x1c')](_0x42a3e2);});})[_0xab14('0x29')](respondWithStatusCode(_0x402ee6,0xc8))[_0xab14('0x20')](handleError(_0x402ee6,null));};exports[_0xab14('0x9b')]=function(_0x6d5fb5,_0x4aace8){return db[_0xab14('0x61')]['find']({'where':{'id':_0x6d5fb5[_0xab14('0x40')]['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x4aace8,null))[_0xab14('0x29')](function(_0x216992){if(_0x216992){return _0x216992[_0xab14('0x9b')](_0x6d5fb5['body'][_0xab14('0x9c')],_[_0xab14('0x9d')](_0x6d5fb5[_0xab14('0x31')],[_0xab14('0x9c'),'id'])||{});}})[_0xab14('0x29')](respondWithResult(_0x4aace8,null))[_0xab14('0x20')](handleError(_0x4aace8,null));};exports[_0xab14('0x9e')]=function(_0x2ef79c,_0x9a3f60){var _0x4c698f={'raw':![],'where':{}};var _0x196ba7={};var _0x2a9bc9={'count':0x0,'rows':[]};return db[_0xab14('0x37')]['findOne']({'where':{'id':_0x2ef79c[_0xab14('0x40')]['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x9a3f60,null))['then'](function(_0xb801e3){if(_0xb801e3){_0x196ba7[_0xab14('0x41')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x196ba7['query']=_[_0xab14('0x42')](_0x2ef79c[_0xab14('0x3d')]);_0x196ba7[_0xab14('0x43')]=_[_0xab14('0x44')](_0x196ba7[_0xab14('0x41')],_0x196ba7[_0xab14('0x3d')]);_0x4c698f[_0xab14('0x45')]=_[_0xab14('0x44')](_0x196ba7[_0xab14('0x41')],qs[_0xab14('0x46')](_0x2ef79c[_0xab14('0x3d')][_0xab14('0x46')]));_0x4c698f[_0xab14('0x45')]=_0x4c698f[_0xab14('0x45')][_0xab14('0x47')]?_0x4c698f[_0xab14('0x45')]:_0x196ba7[_0xab14('0x41')];if(!_0x2ef79c[_0xab14('0x3d')][_0xab14('0x9f')](_0xab14('0xa0'))){_0x4c698f[_0xab14('0x25')]=qs[_0xab14('0x25')](_0x2ef79c['query']['limit']);_0x4c698f[_0xab14('0x23')]=qs['offset'](_0x2ef79c['query']['offset']);}_0x4c698f[_0xab14('0xa1')]=qs[_0xab14('0xa2')](_0x2ef79c[_0xab14('0x3d')][_0xab14('0xa2')]);_0x4c698f[_0xab14('0xa3')]=qs['filters'](_['pick'](_0x2ef79c[_0xab14('0x3d')],_0x196ba7['filters']));_0x4c698f[_0xab14('0xa3')][_0xab14('0xa4')]=_0xb801e3['id'];if(_0x2ef79c[_0xab14('0x3d')][_0xab14('0xa5')]){_0x4c698f[_0xab14('0xa3')]=_[_0xab14('0x30')](_0x4c698f[_0xab14('0xa3')],{'$or':_[_0xab14('0x36')](_0x4c698f[_0xab14('0x45')],function(_0x108139){var _0x88bfc8={};_0x88bfc8[_0x108139]={'$like':'%'+_0x2ef79c['query'][_0xab14('0xa5')]+'%'};return _0x88bfc8;})});}if(_0x2ef79c[_0xab14('0x3d')][_0xab14('0xa6')]){var _0xa48162=_0x2ef79c[_0xab14('0x3d')]['$gte'][_0xab14('0xa7')](',');var _0x13d414={};_0x13d414[_0xa48162[0x0]]={'$gte':moment(_0xa48162[0x1])[_0xab14('0x84')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4c698f[_0xab14('0xa3')]=_[_0xab14('0x30')](_0x4c698f['where'],_0x13d414);}_0x4c698f=_[_0xab14('0x30')]({},_0x4c698f,_0x2ef79c[_0xab14('0xa8')]);return db[_0xab14('0x61')][_0xab14('0x26')]({'where':_0x4c698f[_0xab14('0xa3')]})[_0xab14('0x29')](function(_0x591450){_0x2a9bc9[_0xab14('0x26')]=_0x591450;if(_0x2ef79c[_0xab14('0x3d')][_0xab14('0xa9')]){_0x4c698f[_0xab14('0x48')]=[{'all':!![]}];}return db[_0xab14('0x61')][_0xab14('0x3b')](_0x4c698f);})[_0xab14('0x29')](function(_0x2f74e4){_0x2a9bc9[_0xab14('0xaa')]=_0x2f74e4;return _0x2a9bc9;});}})[_0xab14('0x29')](respondWithFilteredResult(_0x9a3f60,_0x4c698f))['catch'](handleError(_0x9a3f60,null));};exports[_0xab14('0xab')]=function(_0x36a56b,_0x4c3f7b){var _0x1728fe={'where':{}},_0x44d323={},_0xfb0535={'count':0x0,'rows':[]};return db[_0xab14('0x37')][_0xab14('0x4f')]({'where':{'id':_0x36a56b['params']['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x4c3f7b,null))[_0xab14('0x29')](function(_0x4970ab){if(_0x4970ab){_0x44d323[_0xab14('0x41')]=_[_0xab14('0x42')](db[_0xab14('0x61')][_0xab14('0x38')]);_0x44d323['query']=_[_0xab14('0x42')](_0x36a56b[_0xab14('0x3d')]);_0x44d323[_0xab14('0x43')]=_[_0xab14('0x44')](_0x44d323[_0xab14('0x41')],_0x44d323[_0xab14('0x3d')]);_0x1728fe[_0xab14('0x45')]=_[_0xab14('0x44')](_0x44d323[_0xab14('0x41')],qs[_0xab14('0x46')](_0x36a56b[_0xab14('0x3d')][_0xab14('0x46')]));_0x1728fe[_0xab14('0x45')]=_0x1728fe[_0xab14('0x45')][_0xab14('0x47')]?_0x1728fe['attributes']:_0x44d323[_0xab14('0x41')];if(!_0x36a56b[_0xab14('0x3d')][_0xab14('0x9f')](_0xab14('0xa0'))){_0x1728fe[_0xab14('0x25')]=qs[_0xab14('0x25')](_0x36a56b[_0xab14('0x3d')][_0xab14('0x25')]);_0x1728fe[_0xab14('0x23')]=qs[_0xab14('0x23')](_0x36a56b[_0xab14('0x3d')]['offset']);}_0x1728fe[_0xab14('0xa1')]=qs['sort'](_0x36a56b[_0xab14('0x3d')]['sort']);_0x1728fe[_0xab14('0xa3')]=qs[_0xab14('0x43')](_[_0xab14('0xac')](_0x36a56b[_0xab14('0x3d')],_0x44d323[_0xab14('0x43')]));_0x1728fe[_0xab14('0xa3')][_0xab14('0xa4')]=_0x4970ab['id'];if(_0x36a56b[_0xab14('0x3d')]['filter']){_0x1728fe[_0xab14('0xa3')]=_[_0xab14('0x30')](_0x1728fe['where'],{'$or':_[_0xab14('0x36')](_0x1728fe[_0xab14('0x45')],function(_0x128240){var _0x498474={};_0x498474[_0x128240]={'$like':'%'+_0x36a56b[_0xab14('0x3d')][_0xab14('0xa5')]+'%'};return _0x498474;})});}_0x1728fe[_0xab14('0xa3')][_0xab14('0x91')]=![];if(_0x36a56b['query']['id']){_0x1728fe['where']['id']={'$gt':_0x36a56b['query']['id']};}_0x1728fe=_['merge']({},_0x1728fe,_0x36a56b[_0xab14('0xa8')]);return db[_0xab14('0x61')][_0xab14('0x26')]({'where':_0x1728fe[_0xab14('0xa3')]})[_0xab14('0x29')](function(_0x3d22fa){_0xfb0535[_0xab14('0x26')]=_0x3d22fa;_0x1728fe[_0xab14('0x48')]=[];if(_0x36a56b[_0xab14('0x3d')][_0xab14('0xad')]){_0x1728fe[_0xab14('0x48')][_0xab14('0xae')]({'model':db[_0xab14('0x81')],'as':_0xab14('0x81'),'attributes':['id',_0xab14('0x8c'),_0xab14('0x8b')]});}if(_0x36a56b[_0xab14('0x3d')]['includeAll']){_0x1728fe[_0xab14('0x48')]=[{'all':!![]}];}return db[_0xab14('0x61')][_0xab14('0x3b')](_0x1728fe);})[_0xab14('0x29')](function(_0x4e3d32){_0xfb0535[_0xab14('0xaa')]=_0x4e3d32;return _0xfb0535;});}})[_0xab14('0x29')](respondWithFilteredResult(_0x4c3f7b,_0x1728fe))[_0xab14('0x20')](handleError(_0x4c3f7b,null));};exports['addTags']=function(_0x2396cd,_0x1d4d8c){return db[_0xab14('0x37')][_0xab14('0x49')]({'where':{'id':_0x2396cd[_0xab14('0x40')]['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x1d4d8c,null))[_0xab14('0x29')](function(_0x3b45b3){if(_0x3b45b3){return _0x3b45b3[_0xab14('0xaf')](_0x2396cd[_0xab14('0x31')]['ids'],_[_0xab14('0x9d')](_0x2396cd[_0xab14('0x31')],[_0xab14('0x9c'),'id'])||{})[_0xab14('0xb0')](function(){return db[_0xab14('0xb1')]['findAll']({'attributes':['id','name',_0xab14('0xb2')],'where':{'id':_0x2396cd['body'][_0xab14('0x9c')]}});})[_0xab14('0x29')](function(_0x1a05a6){socket['emit']('chatInteractionTags:save',{'id':Number(_0x2396cd['params']['id']),'tags':_0x1a05a6||[]});return{'id':Number(_0x2396cd[_0xab14('0x40')]['id']),'tags':_0x1a05a6||[]};});}})[_0xab14('0x29')](respondWithResult(_0x1d4d8c,null))['catch'](handleError(_0x1d4d8c,null));};exports[_0xab14('0xb3')]=function(_0x2c4645,_0x26f230){return db[_0xab14('0x37')][_0xab14('0x49')]({'where':{'id':_0x2c4645['params']['id']}})[_0xab14('0x29')](handleEntityNotFound(_0x26f230,null))['then'](function(_0xc0044e){if(_0xc0044e){return _0xc0044e[_0xab14('0xb3')](_0x2c4645[_0xab14('0x3d')][_0xab14('0x9c')]);}})['then'](respondWithStatusCode(_0x26f230,null))['catch'](handleError(_0x26f230,null));};exports[_0xab14('0x7b')]=function(_0x421bfa,_0x1d7dba){var _0x488aca=moment()['unix']()[_0xab14('0xb4')]();var _0x1b2e1d=path[_0xab14('0x78')](config['root'],_0xab14('0xb5'),_0xab14('0xb6'),_0xab14('0xb7'));var _0x4a1e28=path[_0xab14('0x78')](config[_0xab14('0x79')],'server',_0xab14('0xb6'),'attachments');var _0x3e3346=path[_0xab14('0x78')](_0x1b2e1d,_0x488aca);var _0x31f05b=util[_0xab14('0x84')](_0xab14('0xb8'),_0x421bfa[_0xab14('0x40')]['id'],_0x488aca);var _0x2fb24e=path[_0xab14('0x78')](_0x1b2e1d,_0x31f05b);var _0x22a912=[];_0x22a912['push']({'model':db['User'],'as':'User','attributes':['id',_0xab14('0x8c')],'raw':!![]});_0x22a912[_0xab14('0xae')]({'model':db[_0xab14('0x65')],'as':'Contact','attributes':['id',_0xab14('0xb9'),_0xab14('0xba')],'raw':!![]});if(_0x421bfa[_0xab14('0x3d')]['attachments']){_0x22a912['push']({'model':db[_0xab14('0x72')],'as':'Attachment','raw':!![]});}var _0x32a377=[{'model':db[_0xab14('0x61')],'as':'Messages','attributes':['id',_0xab14('0x31'),_0xab14('0x8e'),_0xab14('0x90'),'secret','read'],'include':_0x22a912}];_0x32a377[_0xab14('0xae')]({'model':db[_0xab14('0x4e')],'as':_0xab14('0xbb'),'attributes':['id','name']});_0x32a377[_0xab14('0xae')]({'model':db[_0xab14('0x81')],'as':_0xab14('0xbc'),'attributes':['id',_0xab14('0x8c')]});return db[_0xab14('0x37')][_0xab14('0x49')]({'where':{'id':_0x421bfa[_0xab14('0x40')]['id']},'include':_0x32a377})[_0xab14('0x29')](handleEntityNotFound(_0x1d7dba,null))[_0xab14('0x29')](function(_0x4ed102){if(_0x4ed102){var _0x38494f=_0x4ed102[_0xab14('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x3e3346);var _0x189eaf={'channel':_0xab14('0xbe'),'account':_0x38494f[_0xab14('0xbb')][_0xab14('0x2d')],'agent':_0x38494f[_0xab14('0xbc')]?_0x38494f[_0xab14('0xbc')][_0xab14('0x8c')]:_0xab14('0xbf'),'createdAt':moment(_0x38494f[_0xab14('0x8e')])[_0xab14('0x84')](_0xab14('0xc0'))['toString'](),'closedAt':_0x38494f[_0xab14('0x74')]?moment(_0x38494f[_0xab14('0xc1')])[_0xab14('0x84')](_0xab14('0xc0'))[_0xab14('0xb4')]():'','disposition':_0x38494f['disposition'],'chatInfo':{'browser':_0x38494f[_0xab14('0xc2')],'os':_0x38494f[_0xab14('0xc3')],'referer':_0x38494f[_0xab14('0xc4')],'customerIp':_0x38494f['customerIp'],'customerPort':_0x38494f['customerPort']?_0x38494f[_0xab14('0xc5')]:_0xab14('0xbf')},'messages':_(_0x38494f['Messages'])[_0xab14('0xc6')]()[_0xab14('0xa5')]({'secret':![]})[_0xab14('0x36')](function(_0x5d41b0){if(_0x5d41b0['Attachment']){var _0x54e5c7=path['join'](_0x4a1e28,_0x5d41b0[_0xab14('0x72')][_0xab14('0x6e')]);if(fs[_0xab14('0xc7')](_0x54e5c7)){fs[_0xab14('0xc8')](_0x54e5c7)['pipe'](fs[_0xab14('0xc9')](path[_0xab14('0x78')](_0x3e3346,_0x5d41b0[_0xab14('0x72')]['basename'])));}}return{'date':moment(_0x5d41b0[_0xab14('0x8e')])[_0xab14('0x84')](_0xab14('0xc0'))['toString'](),'sender':_0x5d41b0[_0xab14('0x90')]===_0xab14('0x60')?_0x5d41b0['User']?_0x5d41b0['User'][_0xab14('0x8c')]:'System':_0x5d41b0[_0xab14('0x66')][_0xab14('0xb9')]+(_0x5d41b0[_0xab14('0x66')][_0xab14('0xba')]?'\x20'+_0x5d41b0[_0xab14('0x66')]['lastName']:''),'body':_0x5d41b0[_0xab14('0x72')]?_0x5d41b0[_0xab14('0x72')][_0xab14('0x6e')]:_0x5d41b0[_0xab14('0x31')],'direction':_0x5d41b0[_0xab14('0x90')]==='out'?'A':'C','secret':_0x5d41b0[_0xab14('0x91')],'read':_0x5d41b0[_0xab14('0xca')],'attachment':_0x5d41b0['Attachment']};})[_0xab14('0xcb')]()};return ejs[_0xab14('0xcc')](path[_0xab14('0x78')](config[_0xab14('0x79')],_0xab14('0xb5'),_0xab14('0xcd'),_0xab14('0xce')),{'interaction':_0x189eaf})['then'](function(_0x44f488){var _0xeaadaf=path['join'](_0x3e3346,_0xab14('0xcf')+_0x38494f['id']+'-'+_0x488aca+_0xab14('0xd0'));var _0xd5c989={'path':_0xeaadaf,'channel':_0xab14('0xbe'),'interactionId':_0x38494f['id']};return pdf[_0xab14('0xd1')](_0x44f488,_0xd5c989);})[_0xab14('0x29')](function(){return new Promise(function(_0x18e6bb,_0x17cecc){zipdir(_0x3e3346,{'saveTo':_0x2fb24e},function(_0x28d3d8,_0x592180){if(_0x28d3d8)return _0x17cecc(_0x28d3d8);return _0x18e6bb(_0x592180);});})[_0xab14('0x29')](function(){return new BPromise(function(_0x51ace5,_0x171620){rimraf(_0x3e3346,function(_0x6a9bc8){if(_0x6a9bc8)_0x171620(_0x6a9bc8);return _0x51ace5();});});})[_0xab14('0x29')](function(){return _0x1d7dba[_0xab14('0x7b')](_0x2fb24e,_0x31f05b,function(_0x4b28d8){if(_0x4b28d8){logger[_0xab14('0x1c')](_0xab14('0xd2'),_0x4b28d8);}else{fs[_0xab14('0xd3')](_0x2fb24e);}});});});}else{return _0x1d7dba[_0xab14('0x21')](0xc8);}})['catch'](handleError(_0x1d7dba,null));}; \ No newline at end of file +var _0xaa04=['read','Account','Owner','get','mkdirSync','Chat','N.A.','toString','browserName','osName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','stack','name','send','render','merge','body','contact','agent','account','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','query','user','catch','params','model','keys','intersection','fields','attributes','length','include','options','find','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','basename','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','User','Messages','agentAlias','UserId','System','customer','%s%d','Visitor','ContactId','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','CloudProvider','Smtp','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filters','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','server','files','tmp','transcript-%d-%s.zip','push','firstName','lastName','attachments'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xaa04,0x1ba));var _0x4aa0=function(_0x2b01af,_0x3e8848){_0x2b01af=_0x2b01af-0x0;var _0x3d2c18=_0xaa04[_0x2b01af];return _0x3d2c18;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4aa0('0x0'));var rp=require('request-promise');var moment=require(_0x4aa0('0x1'));var BPromise=require(_0x4aa0('0x2'));var Mustache=require(_0x4aa0('0x3'));var util=require(_0x4aa0('0x4'));var path=require(_0x4aa0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4aa0('0x6'));var Redis=require(_0x4aa0('0x7'));var interaction=require(_0x4aa0('0x8'));var qs=require(_0x4aa0('0x9'));var pdf=require(_0x4aa0('0xa'));var logger=require(_0x4aa0('0xb'))(_0x4aa0('0xc'));var config=require(_0x4aa0('0xd'));var db=require(_0x4aa0('0xe'))['db'];config[_0x4aa0('0xf')]=_[_0x4aa0('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4aa0('0x11'))(new Redis(config[_0x4aa0('0xf')]));require('./chatInteraction.socket')[_0x4aa0('0x12')](socket);var jayson=require(_0x4aa0('0x13'));var client=jayson[_0x4aa0('0x14')][_0x4aa0('0x15')]({'port':0x232b});var client9004=jayson[_0x4aa0('0x14')][_0x4aa0('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x184568,_0x4e92e5,_0x2618da,_0xf908ec){return new BPromise(function(_0x1d1e4e,_0x58b035){var _0x513bc=_0xf908ec||client;return _0x513bc[_0x4aa0('0x16')](_0x184568,_0x2618da)['then'](function(_0x34a2bc){logger[_0x4aa0('0x17')](_0x4aa0('0x18'),_0x4e92e5,_0x4aa0('0x19'));logger[_0x4aa0('0x1a')](_0x4aa0('0x1b'),_0x4e92e5,'request\x20sent',JSON[_0x4aa0('0x1c')](_0x34a2bc));if(_0x34a2bc['error']){if(_0x34a2bc[_0x4aa0('0x1d')][_0x4aa0('0x1e')]===0x1f4){logger[_0x4aa0('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x4e92e5,_0x34a2bc[_0x4aa0('0x1d')][_0x4aa0('0x1f')]);return _0x58b035(_0x34a2bc[_0x4aa0('0x1d')][_0x4aa0('0x1f')]);}logger[_0x4aa0('0x1d')](_0x4aa0('0x18'),_0x4e92e5,_0x34a2bc[_0x4aa0('0x1d')][_0x4aa0('0x1f')]);return _0x1d1e4e(_0x34a2bc[_0x4aa0('0x1d')]['message']);}else{logger[_0x4aa0('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4e92e5,_0x4aa0('0x19'));_0x1d1e4e(_0x34a2bc[_0x4aa0('0x20')][_0x4aa0('0x1f')]);}})['catch'](function(_0x3e2bd2){logger[_0x4aa0('0x1d')](_0x4aa0('0x18'),_0x4e92e5,_0x3e2bd2);_0x58b035(_0x3e2bd2);});});}function respondWithStatusCode(_0x147df1,_0x33f220){_0x33f220=_0x33f220||0xcc;return function(_0x440827){if(_0x440827){return _0x147df1[_0x4aa0('0x21')](_0x33f220);}return _0x147df1['status'](_0x33f220)[_0x4aa0('0x22')]();};}function respondWithResult(_0x465941,_0x1b2dae){_0x1b2dae=_0x1b2dae||0xc8;return function(_0x3ce20e){if(_0x3ce20e){return _0x465941[_0x4aa0('0x23')](_0x1b2dae)[_0x4aa0('0x24')](_0x3ce20e);}};}function respondWithFilteredResult(_0x552b10,_0x48a2f5){return function(_0xbc1156){if(_0xbc1156){var _0x543bbb=typeof _0x48a2f5[_0x4aa0('0x25')]===_0x4aa0('0x26')&&typeof _0x48a2f5[_0x4aa0('0x27')]===_0x4aa0('0x26');var _0x1e7e3e=_0xbc1156['count'];var _0x18e43f=_0x543bbb?0x0:_0x48a2f5[_0x4aa0('0x25')];var _0x266fb4=_0x543bbb?_0xbc1156[_0x4aa0('0x28')]:_0x48a2f5['offset']+_0x48a2f5[_0x4aa0('0x27')];var _0x52c781;if(_0x266fb4>=_0x1e7e3e){_0x266fb4=_0x1e7e3e;_0x52c781=0xc8;}else{_0x52c781=0xce;}_0x552b10[_0x4aa0('0x23')](_0x52c781);return _0x552b10['set'](_0x4aa0('0x29'),_0x18e43f+'-'+_0x266fb4+'/'+_0x1e7e3e)['json'](_0xbc1156);}return null;};}function saveUpdates(_0x107a6f){return function(_0x462ca9){if(_0x462ca9){return _0x462ca9[_0x4aa0('0x2a')](_0x107a6f)[_0x4aa0('0x2b')](function(_0x36dd82){return _0x36dd82;});}return null;};}function removeEntity(_0x24f1a1){return function(_0x9dd407){if(_0x9dd407){return _0x9dd407[_0x4aa0('0x2c')]()['then'](function(){_0x24f1a1[_0x4aa0('0x23')](0xcc)[_0x4aa0('0x22')]();});}};}function handleEntityNotFound(_0x2b9f5d){return function(_0x1cd446){if(!_0x1cd446){_0x2b9f5d[_0x4aa0('0x21')](0x194);}return _0x1cd446;};}function handleError(_0x2ad39d,_0x3f0404){_0x3f0404=_0x3f0404||0x1f4;return function(_0x1dfd41){logger['error'](_0x1dfd41[_0x4aa0('0x2d')]);if(_0x1dfd41[_0x4aa0('0x2e')]){delete _0x1dfd41[_0x4aa0('0x2e')];}_0x2ad39d[_0x4aa0('0x23')](_0x3f0404)[_0x4aa0('0x2f')](_0x1dfd41);};}function getMustacheRender(_0x5708d9,_0x1b913c){return Mustache[_0x4aa0('0x30')](_0x5708d9,_[_0x4aa0('0x31')](_0x1b913c[_0x4aa0('0x32')],{'contact':_0x1b913c[_0x4aa0('0x33')],'message':_0x1b913c[_0x4aa0('0x1f')],'agent':_0x1b913c[_0x4aa0('0x34')],'interaction':_0x1b913c['interaction'],'account':_0x1b913c[_0x4aa0('0x35')]}))||'';}exports['index']=function(_0x5b097b,_0x723cc){var _0x1f5a08={};var _0x1b615c=_[_0x4aa0('0x36')](db[_0x4aa0('0x37')][_0x4aa0('0x38')],function(_0x12d073){return{'name':_0x12d073[_0x4aa0('0x39')],'type':_0x12d073[_0x4aa0('0x3a')][_0x4aa0('0x3b')]};});_0x1f5a08=qs['getOptions'](_0x1b615c,_0x5b097b);return interaction[_0x4aa0('0x3c')](_0x4aa0('0x3d'),_0x5b097b[_0x4aa0('0x3e')],_0x5b097b[_0x4aa0('0x3f')],_0x1f5a08,_0x1b615c)['then'](respondWithFilteredResult(_0x723cc,_0x1f5a08))[_0x4aa0('0x40')](handleError(_0x723cc,null));};exports['show']=function(_0x596f38,_0x4af8d8){var _0x26b687={'raw':![],'where':{'id':_0x596f38[_0x4aa0('0x41')]['id']}},_0x4940ae={};_0x4940ae[_0x4aa0('0x42')]=_[_0x4aa0('0x43')](db[_0x4aa0('0x37')][_0x4aa0('0x38')]);_0x4940ae[_0x4aa0('0x3e')]=_['keys'](_0x596f38['query']);_0x4940ae['filters']=_[_0x4aa0('0x44')](_0x4940ae['model'],_0x4940ae['query']);_0x26b687['attributes']=_[_0x4aa0('0x44')](_0x4940ae[_0x4aa0('0x42')],qs[_0x4aa0('0x45')](_0x596f38[_0x4aa0('0x3e')][_0x4aa0('0x45')]));_0x26b687['attributes']=_0x26b687[_0x4aa0('0x46')][_0x4aa0('0x47')]?_0x26b687[_0x4aa0('0x46')]:_0x4940ae['model'];if(_0x596f38['query']['includeAll']){_0x26b687[_0x4aa0('0x48')]=[{'all':!![]}];}_0x26b687=_[_0x4aa0('0x31')]({},_0x26b687,_0x596f38[_0x4aa0('0x49')]);return db['ChatInteraction'][_0x4aa0('0x4a')](_0x26b687)[_0x4aa0('0x2b')](handleEntityNotFound(_0x4af8d8,null))[_0x4aa0('0x2b')](respondWithResult(_0x4af8d8,null))['catch'](handleError(_0x4af8d8,null));};exports[_0x4aa0('0x4b')]=function(_0xc3b5c3,_0x10b4f3){return db[_0x4aa0('0x37')][_0x4aa0('0x4b')](_0xc3b5c3[_0x4aa0('0x32')],{})[_0x4aa0('0x2b')](respondWithResult(_0x10b4f3,0xc9))[_0x4aa0('0x40')](handleError(_0x10b4f3,null));};exports['update']=function(_0x21d774,_0x27fe87){if(_0x21d774[_0x4aa0('0x32')]['id']){delete _0x21d774[_0x4aa0('0x32')]['id'];}return db[_0x4aa0('0x37')][_0x4aa0('0x4a')]({'where':{'id':_0x21d774[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x27fe87,null))['then'](saveUpdates(_0x21d774['body'],null))[_0x4aa0('0x2b')](respondWithResult(_0x27fe87,null))[_0x4aa0('0x40')](handleError(_0x27fe87,null));};exports[_0x4aa0('0x2c')]=function(_0x2f3985,_0x501f0c){return db['ChatInteraction'][_0x4aa0('0x4a')]({'where':{'id':_0x2f3985[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x501f0c,null))[_0x4aa0('0x2b')](removeEntity(_0x501f0c,null))[_0x4aa0('0x40')](handleError(_0x501f0c,null));};exports[_0x4aa0('0x4c')]=function(_0x5a0081,_0x5144af){return db[_0x4aa0('0x37')]['describe']()[_0x4aa0('0x2b')](respondWithResult(_0x5144af,null))[_0x4aa0('0x40')](handleError(_0x5144af,null));};exports['createVidaooSession']=function(_0x51eae3,_0x27c5cd){var _0x3133a2=_0x51eae3[_0x4aa0('0x41')]['id'];var _0x462429;var _0x465b6e;var _0x460a6a;return db[_0x4aa0('0x37')]['findOne']({'where':{'id':_0x3133a2}})[_0x4aa0('0x2b')](function(_0x5c05cb){_0x462429=_0x5c05cb;return db[_0x4aa0('0x4d')][_0x4aa0('0x4e')]({'where':{'id':_0x5c05cb['ChatWebsiteId']},'attributes':['id',_0x4aa0('0x4f'),_0x4aa0('0x50'),_0x4aa0('0x51'),_0x4aa0('0x52'),_0x4aa0('0x53')],'raw':!![]});})[_0x4aa0('0x2b')](function(_0x5b99a9){if(_0x5b99a9&&_0x5b99a9[_0x4aa0('0x4f')]&&_0x5b99a9[_0x4aa0('0x50')]){_0x465b6e=_0x5b99a9;var _0x84716a={'interaction':{'id':_0x3133a2},'agent':{'id':_0x51eae3[_0x4aa0('0x3f')]['id'],'name':_0x51eae3[_0x4aa0('0x3f')]['name'],'fullname':_0x51eae3['user'][_0x4aa0('0x54')],'email':_0x51eae3[_0x4aa0('0x3f')][_0x4aa0('0x55')]},'contact':_0x51eae3[_0x4aa0('0x32')][_0x4aa0('0x33')],'account':_0x51eae3[_0x4aa0('0x32')][_0x4aa0('0x35')]};var _0x4b96a1={'rejectUnauthorized':![],'method':_0x4aa0('0x56'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x5b99a9[_0x4aa0('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x51eae3[_0x4aa0('0x3f')][_0x4aa0('0x55')]],'buttons':null,'topic':_0x465b6e['vidaooTopic'],'note':_[_0x4aa0('0x57')](_0x465b6e[_0x4aa0('0x52')])?null:getMustacheRender(_0x465b6e[_0x4aa0('0x52')],_0x84716a),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x4aa0('0x57')](_0x465b6e['vidaooMetadata'])){var _0x4333d6=getMustacheRender(_0x465b6e['vidaooMetadata'],_0x84716a);var _0x1c9047=JSON['parse'](_0x4333d6);_0x4b96a1[_0x4aa0('0x32')][_0x4aa0('0x58')]=_0x1c9047;}}catch(_0x3c0e36){throw new db[(_0x4aa0('0x59'))][(_0x4aa0('0x5a'))](_0x4aa0('0x5b'));}return rp(_0x4b96a1);}else{throw new db[(_0x4aa0('0x59'))]['ValidationError'](_0x4aa0('0x5c'));}})[_0x4aa0('0x2b')](function(_0x5d49d3){_0x460a6a=_0x5d49d3;if(_0x460a6a['id']){var _0x5663a={'body':_0x460a6a[_0x4aa0('0x5d')],'ChatWebsiteId':_0x465b6e['id'],'ChatInteractionId':_0x462429['id'],'direction':_0x4aa0('0x5e'),'UserId':_0x51eae3['user']['id']};return db[_0x4aa0('0x5f')][_0x4aa0('0x4b')](_0x5663a,{});}else{throw new db['Sequelize'][(_0x4aa0('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x462429['updateAttributes']({'vidaooSessionId':_0x460a6a['id']});})[_0x4aa0('0x2b')](respondWithResult(_0x27c5cd,null))[_0x4aa0('0x40')](handleError(_0x27c5cd,null));};exports[_0x4aa0('0x60')]=function(_0x22cb91,_0x491a96){if(_0x22cb91[_0x4aa0('0x32')]['id']){delete _0x22cb91[_0x4aa0('0x32')]['id'];}return db['ChatInteraction'][_0x4aa0('0x4a')]({'where':{'id':_0x22cb91[_0x4aa0('0x41')]['id']},'include':[{'model':db[_0x4aa0('0x61')],'as':_0x4aa0('0x62')}]})['then'](handleEntityNotFound(_0x491a96,null))[_0x4aa0('0x2b')](saveUpdates(_0x22cb91[_0x4aa0('0x32')],null))[_0x4aa0('0x2b')](respondWithResult(_0x491a96,null))[_0x4aa0('0x40')](handleError(_0x491a96,null));};exports[_0x4aa0('0x63')]=function(_0x30307f,_0xa6da62){if(_0x30307f[_0x4aa0('0x32')]['id']){delete _0x30307f[_0x4aa0('0x32')]['id'];}return db[_0x4aa0('0x37')][_0x4aa0('0x4a')]({'where':{'id':_0x30307f[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](function(_0x489754){if(!_0x489754){logger[_0x4aa0('0x1d')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x4aa0('0x63'),0x194,_0x4aa0('0x64'));_0xa6da62[_0x4aa0('0x21')](0x194);}else{if(_0x489754['UserId']){throw new db['Sequelize'][(_0x4aa0('0x5a'))](_0x4aa0('0x65'));}}return _0x489754;})[_0x4aa0('0x2b')](function(_0xe7cd8c){if(_0xe7cd8c){return _0xe7cd8c[_0x4aa0('0x2a')]({'closed':_0x30307f[_0x4aa0('0x32')][_0x4aa0('0x66')],'disposition':_0x30307f[_0x4aa0('0x32')][_0x4aa0('0x67')]})[_0x4aa0('0x2b')](function(_0x3a5d36){return _0x3a5d36;});}})[_0x4aa0('0x2b')](function(){return respondWithRpcPromise('AbandonInteraction',_0x4aa0('0x63'),_0x30307f[_0x4aa0('0x32')],client9004);})[_0x4aa0('0x2b')](respondWithResult(_0xa6da62,null))[_0x4aa0('0x40')](handleError(_0xa6da62,null));};exports[_0x4aa0('0x68')]=function(_0x3b5232,_0x1f976e){_0x3b5232[_0x4aa0('0x32')][_0x4aa0('0x2e')]=_0x3b5232[_0x4aa0('0x69')][_0x4aa0('0x6a')];_0x3b5232['body']['basename']=_0x3b5232[_0x4aa0('0x69')][_0x4aa0('0x6b')];_0x3b5232[_0x4aa0('0x32')][_0x4aa0('0x3a')]=_0x3b5232['file'][_0x4aa0('0x6c')];return db[_0x4aa0('0x6d')][_0x4aa0('0x4b')](_0x3b5232['body'])[_0x4aa0('0x2b')](respondWithResult(_0x1f976e,0xc9))[_0x4aa0('0x40')](handleError(_0x1f976e,null));};exports[_0x4aa0('0x6e')]=function(_0x12c41a,_0x530f34){return db[_0x4aa0('0x37')][_0x4aa0('0x4e')]({'where':{'id':_0x12c41a[_0x4aa0('0x41')]['id']},'raw':!![]})[_0x4aa0('0x2b')](handleEntityNotFound(_0x530f34,null))[_0x4aa0('0x2b')](function(_0x520fe1){if(_0x520fe1){if(_0x520fe1[_0x4aa0('0x66')]){return _0x530f34[_0x4aa0('0x23')](0x193)[_0x4aa0('0x24')]({'status':0x193,'message':_0x4aa0('0x6f')});}return db[_0x4aa0('0x6d')][_0x4aa0('0x4e')]({'where':{'id':_0x12c41a[_0x4aa0('0x3e')][_0x4aa0('0x70')]},'raw':!![]})['then'](handleEntityNotFound(_0x530f34,null));}})[_0x4aa0('0x2b')](function(_0x1c7d5d){if(_0x1c7d5d){var _0x272a00=_0x1c7d5d['ChatOfflineMessageId']!==null;var _0x2cf9e9=path[_0x4aa0('0x71')](config[_0x4aa0('0x72')],_0x4aa0('0x73'));if(_0x272a00){_0x2cf9e9=path[_0x4aa0('0x71')](_0x2cf9e9,_0x4aa0('0x74'));}var _0x454a49=path['join'](_0x2cf9e9,_0x1c7d5d[_0x4aa0('0x75')]);return _0x530f34['download'](_0x454a49);}})[_0x4aa0('0x40')](handleError(_0x530f34,null));};exports[_0x4aa0('0x76')]=function(_0x419924,_0x3a5bce){var _0x31b48c=null;var _0x43195a=null;var _0x58bf79=null;if(_0x419924[_0x4aa0('0x32')]['id']){delete _0x419924[_0x4aa0('0x32')]['id'];}if(_0x419924[_0x4aa0('0x32')][_0x4aa0('0x77')]){_0x58bf79=path[_0x4aa0('0x71')](config[_0x4aa0('0x72')],_0x4aa0('0x78'),util[_0x4aa0('0x79')](_0x4aa0('0x7a'),Date['now']()));_0x419924[_0x4aa0('0x32')][_0x4aa0('0x7b')]=_0x58bf79;}return db[_0x4aa0('0x37')][_0x4aa0('0x4a')]({'where':{'id':_0x419924[_0x4aa0('0x41')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x4aa0('0x7c')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x3a5bce,null))[_0x4aa0('0x2b')](saveUpdates(_0x419924[_0x4aa0('0x32')],null))[_0x4aa0('0x2b')](function(_0x2b0aaa){if(_0x2b0aaa){_0x31b48c=_0x2b0aaa;return db[_0x4aa0('0x4d')][_0x4aa0('0x4a')]({'where':{'id':_0x31b48c['ChatWebsiteId']}});}})[_0x4aa0('0x2b')](function(_0x2f5fd9){if(_0x2f5fd9){_0x43195a=_0x2f5fd9;return db['CmContact'][_0x4aa0('0x4a')]({'where':{'id':_0x31b48c['ContactId']}});}})['then'](function(_0xa1eb47){if(_0xa1eb47){if(_0x58bf79){var _0x2fe338=null;for(var _0x599399=0x1;_0x599399<_0x31b48c[_0x4aa0('0x7d')][_0x4aa0('0x47')];++_0x599399){_0x2fe338=_0x31b48c[_0x4aa0('0x7d')][_0x599399];var _0x9082d3=_0x2fe338['UserId']?util['format']('%s%d',_0x43195a[_0x4aa0('0x7e')],_0x2fe338[_0x4aa0('0x7f')]):_0x4aa0('0x80');var _0x1903da=_0x419924[_0x4aa0('0x32')][_0x4aa0('0x81')]||util[_0x4aa0('0x79')](_0x4aa0('0x82'),_0x4aa0('0x83'),_0x2fe338[_0x4aa0('0x84')]);switch(_0x43195a['agentIdentifier']){case _0x4aa0('0x85'):_0x9082d3=_0x2fe338[_0x4aa0('0x7f')]?util[_0x4aa0('0x79')]('%s%d',_0x43195a[_0x4aa0('0x7e')],_0x2fe338['UserId']):'System';break;case'agent_alias':_0x9082d3=_0x2fe338['UserId']?_0x2fe338[_0x4aa0('0x7c')][_0x4aa0('0x86')]||_0x2fe338[_0x4aa0('0x7c')][_0x4aa0('0x54')]:_0x4aa0('0x80');break;case _0x4aa0('0x87'):_0x9082d3=_0x2fe338[_0x4aa0('0x7f')]?_0x2fe338[_0x4aa0('0x7c')][_0x4aa0('0x54')]:_0x4aa0('0x80');break;default:_0x9082d3=_0x2fe338[_0x4aa0('0x7f')]?util[_0x4aa0('0x79')](_0x4aa0('0x82'),_0x43195a['agentAlias'],_0x2fe338[_0x4aa0('0x7f')]):_0x4aa0('0x80');}var _0x132948=util[_0x4aa0('0x79')](_0x4aa0('0x88'),moment(_0x2fe338[_0x4aa0('0x89')])['format'](_0x4aa0('0x8a')),_0x2fe338[_0x4aa0('0x8b')]==='in'?_0x1903da:_0x9082d3,_0x2fe338[_0x4aa0('0x32')]);if(!_0x2fe338['secret']){fs[_0x4aa0('0x8c')](_0x58bf79,_0x132948);}}return db[_0x4aa0('0x8d')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4aa0('0x8e')],'as':_0x4aa0('0x8e'),'raw':!![]}]}]});}}})['then'](function(_0x3c52de){if(!_0x3c52de||!_0x3c52de[_0x4aa0('0x8f')]||!_0x419924[_0x4aa0('0x32')])return _0x31b48c;var _0x38d360=_0x3c52de['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x4aa0('0x90'),{'account':_0x38d360,'message':{'from':util[_0x4aa0('0x79')]('\x22%s\x22\x20<%s>',_0x3c52de[_0x4aa0('0x2e')],_0x3c52de['email']||_0x3c52de[_0x4aa0('0x8f')][_0x4aa0('0x3f')]),'to':_0x419924[_0x4aa0('0x32')]['mailTranscript'],'subject':_0x4aa0('0x91'),'text':util[_0x4aa0('0x79')](_0x4aa0('0x92'),_0x419924['body'][_0x4aa0('0x77')]),'attachments':[{'path':_0x58bf79}]}})[_0x4aa0('0x2b')](function(){return _0x31b48c;})['catch'](function(_0x12f86e){logger['error'](_0x12f86e);});})[_0x4aa0('0x2b')](respondWithStatusCode(_0x3a5bce,0xc8))[_0x4aa0('0x40')](handleError(_0x3a5bce,null));};exports[_0x4aa0('0x93')]=function(_0x7c69c0,_0x4ff4a1){return db['ChatMessage'][_0x4aa0('0x4a')]({'where':{'id':_0x7c69c0[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x4ff4a1,null))[_0x4aa0('0x2b')](function(_0x164398){if(_0x164398){return _0x164398['addMessage'](_0x7c69c0[_0x4aa0('0x32')][_0x4aa0('0x94')],_[_0x4aa0('0x95')](_0x7c69c0['body'],['ids','id'])||{});}})[_0x4aa0('0x2b')](respondWithResult(_0x4ff4a1,null))[_0x4aa0('0x40')](handleError(_0x4ff4a1,null));};exports[_0x4aa0('0x96')]=function(_0xe8ac8,_0x4fbee1){var _0x531662={'raw':![],'where':{}};var _0x12a077={};var _0x23d36b={'count':0x0,'rows':[]};return db[_0x4aa0('0x37')][_0x4aa0('0x4e')]({'where':{'id':_0xe8ac8[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x4fbee1,null))[_0x4aa0('0x2b')](function(_0x456647){if(_0x456647){_0x12a077[_0x4aa0('0x42')]=_['keys'](db[_0x4aa0('0x5f')][_0x4aa0('0x38')]);_0x12a077[_0x4aa0('0x3e')]=_[_0x4aa0('0x43')](_0xe8ac8[_0x4aa0('0x3e')]);_0x12a077['filters']=_[_0x4aa0('0x44')](_0x12a077[_0x4aa0('0x42')],_0x12a077[_0x4aa0('0x3e')]);_0x531662[_0x4aa0('0x46')]=_[_0x4aa0('0x44')](_0x12a077[_0x4aa0('0x42')],qs[_0x4aa0('0x45')](_0xe8ac8[_0x4aa0('0x3e')][_0x4aa0('0x45')]));_0x531662['attributes']=_0x531662[_0x4aa0('0x46')][_0x4aa0('0x47')]?_0x531662[_0x4aa0('0x46')]:_0x12a077[_0x4aa0('0x42')];if(!_0xe8ac8['query'][_0x4aa0('0x97')](_0x4aa0('0x98'))){_0x531662[_0x4aa0('0x27')]=qs[_0x4aa0('0x27')](_0xe8ac8['query'][_0x4aa0('0x27')]);_0x531662[_0x4aa0('0x25')]=qs[_0x4aa0('0x25')](_0xe8ac8[_0x4aa0('0x3e')]['offset']);}_0x531662[_0x4aa0('0x99')]=qs[_0x4aa0('0x9a')](_0xe8ac8[_0x4aa0('0x3e')]['sort']);_0x531662[_0x4aa0('0x9b')]=qs['filters'](_[_0x4aa0('0x9c')](_0xe8ac8[_0x4aa0('0x3e')],_0x12a077[_0x4aa0('0x9d')]));_0x531662['where'][_0x4aa0('0x9e')]=_0x456647['id'];if(_0xe8ac8[_0x4aa0('0x3e')]['filter']){_0x531662[_0x4aa0('0x9b')]=_[_0x4aa0('0x31')](_0x531662[_0x4aa0('0x9b')],{'$or':_[_0x4aa0('0x36')](_0x531662[_0x4aa0('0x46')],function(_0x4fc716){var _0x37e99f={};_0x37e99f[_0x4fc716]={'$like':'%'+_0xe8ac8[_0x4aa0('0x3e')][_0x4aa0('0x9f')]+'%'};return _0x37e99f;})});}if(_0xe8ac8[_0x4aa0('0x3e')][_0x4aa0('0xa0')]){var _0x4182de=_0xe8ac8[_0x4aa0('0x3e')][_0x4aa0('0xa0')][_0x4aa0('0xa1')](',');var _0x5791bc={};_0x5791bc[_0x4182de[0x0]]={'$gte':moment(_0x4182de[0x1])[_0x4aa0('0x79')](_0x4aa0('0xa2'))};_0x531662['where']=_['merge'](_0x531662[_0x4aa0('0x9b')],_0x5791bc);}_0x531662=_[_0x4aa0('0x31')]({},_0x531662,_0xe8ac8[_0x4aa0('0x49')]);return db['ChatMessage'][_0x4aa0('0x28')]({'where':_0x531662[_0x4aa0('0x9b')]})[_0x4aa0('0x2b')](function(_0x41f542){_0x23d36b[_0x4aa0('0x28')]=_0x41f542;if(_0xe8ac8[_0x4aa0('0x3e')][_0x4aa0('0xa3')]){_0x531662['include']=[{'all':!![]}];}return db['ChatMessage'][_0x4aa0('0x3c')](_0x531662);})['then'](function(_0x368692){_0x23d36b[_0x4aa0('0xa4')]=_0x368692;return _0x23d36b;});}})['then'](respondWithFilteredResult(_0x4fbee1,_0x531662))[_0x4aa0('0x40')](handleError(_0x4fbee1,null));};exports[_0x4aa0('0xa5')]=function(_0x56c58a,_0x3735c7){var _0xf7be16={'where':{}},_0x55f04b={},_0x1c8d8e={'count':0x0,'rows':[]};return db[_0x4aa0('0x37')][_0x4aa0('0x4e')]({'where':{'id':_0x56c58a[_0x4aa0('0x41')]['id']}})['then'](handleEntityNotFound(_0x3735c7,null))[_0x4aa0('0x2b')](function(_0x3c732b){if(_0x3c732b){_0x55f04b[_0x4aa0('0x42')]=_['keys'](db[_0x4aa0('0x5f')][_0x4aa0('0x38')]);_0x55f04b[_0x4aa0('0x3e')]=_['keys'](_0x56c58a[_0x4aa0('0x3e')]);_0x55f04b[_0x4aa0('0x9d')]=_[_0x4aa0('0x44')](_0x55f04b[_0x4aa0('0x42')],_0x55f04b[_0x4aa0('0x3e')]);_0xf7be16[_0x4aa0('0x46')]=_['intersection'](_0x55f04b['model'],qs[_0x4aa0('0x45')](_0x56c58a[_0x4aa0('0x3e')][_0x4aa0('0x45')]));_0xf7be16[_0x4aa0('0x46')]=_0xf7be16[_0x4aa0('0x46')]['length']?_0xf7be16['attributes']:_0x55f04b[_0x4aa0('0x42')];if(!_0x56c58a[_0x4aa0('0x3e')]['hasOwnProperty'](_0x4aa0('0x98'))){_0xf7be16['limit']=qs[_0x4aa0('0x27')](_0x56c58a[_0x4aa0('0x3e')][_0x4aa0('0x27')]);_0xf7be16[_0x4aa0('0x25')]=qs[_0x4aa0('0x25')](_0x56c58a[_0x4aa0('0x3e')][_0x4aa0('0x25')]);}_0xf7be16['order']=qs['sort'](_0x56c58a[_0x4aa0('0x3e')]['sort']);_0xf7be16[_0x4aa0('0x9b')]=qs[_0x4aa0('0x9d')](_['pick'](_0x56c58a[_0x4aa0('0x3e')],_0x55f04b[_0x4aa0('0x9d')]));_0xf7be16[_0x4aa0('0x9b')][_0x4aa0('0x9e')]=_0x3c732b['id'];if(_0x56c58a[_0x4aa0('0x3e')]['filter']){_0xf7be16['where']=_[_0x4aa0('0x31')](_0xf7be16[_0x4aa0('0x9b')],{'$or':_['map'](_0xf7be16[_0x4aa0('0x46')],function(_0x24018a){var _0x40f347={};_0x40f347[_0x24018a]={'$like':'%'+_0x56c58a[_0x4aa0('0x3e')][_0x4aa0('0x9f')]+'%'};return _0x40f347;})});}_0xf7be16[_0x4aa0('0x9b')][_0x4aa0('0xa6')]=![];if(_0x56c58a[_0x4aa0('0x3e')]['id']){_0xf7be16['where']['id']={'$gt':_0x56c58a['query']['id']};}_0xf7be16=_['merge']({},_0xf7be16,_0x56c58a['options']);return db[_0x4aa0('0x5f')][_0x4aa0('0x28')]({'where':_0xf7be16['where']})[_0x4aa0('0x2b')](function(_0x24a69d){_0x1c8d8e[_0x4aa0('0x28')]=_0x24a69d;_0xf7be16['include']=[];if(_0x56c58a['query'][_0x4aa0('0xa7')]){_0xf7be16[_0x4aa0('0x48')]['push']({'model':db[_0x4aa0('0x7c')],'as':_0x4aa0('0x7c'),'attributes':['id',_0x4aa0('0x54'),_0x4aa0('0x86')]});}if(_0x56c58a[_0x4aa0('0x3e')][_0x4aa0('0xa3')]){_0xf7be16[_0x4aa0('0x48')]=[{'all':!![]}];}return db['ChatMessage'][_0x4aa0('0x3c')](_0xf7be16);})[_0x4aa0('0x2b')](function(_0x1bf7f7){_0x1c8d8e['rows']=_0x1bf7f7;return _0x1c8d8e;});}})[_0x4aa0('0x2b')](respondWithFilteredResult(_0x3735c7,_0xf7be16))[_0x4aa0('0x40')](handleError(_0x3735c7,null));};exports[_0x4aa0('0xa8')]=function(_0x1fea65,_0x2c54a7){return db[_0x4aa0('0x37')][_0x4aa0('0x4a')]({'where':{'id':_0x1fea65[_0x4aa0('0x41')]['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x2c54a7,null))['then'](function(_0x447725){if(_0x447725){return _0x447725[_0x4aa0('0xa9')](_0x1fea65[_0x4aa0('0x32')][_0x4aa0('0x94')],_[_0x4aa0('0x95')](_0x1fea65[_0x4aa0('0x32')],[_0x4aa0('0x94'),'id'])||{})[_0x4aa0('0xaa')](function(){return db[_0x4aa0('0xab')]['findAll']({'attributes':['id',_0x4aa0('0x2e'),_0x4aa0('0xac')],'where':{'id':_0x1fea65[_0x4aa0('0x32')][_0x4aa0('0x94')]}});})[_0x4aa0('0x2b')](function(_0x1436d0){socket[_0x4aa0('0xad')]('chatInteractionTags:save',{'id':Number(_0x1fea65[_0x4aa0('0x41')]['id']),'tags':_0x1436d0||[]});return{'id':Number(_0x1fea65['params']['id']),'tags':_0x1436d0||[]};});}})[_0x4aa0('0x2b')](respondWithResult(_0x2c54a7,null))[_0x4aa0('0x40')](handleError(_0x2c54a7,null));};exports[_0x4aa0('0xae')]=function(_0xb436e2,_0x1b3925){return db[_0x4aa0('0x37')]['find']({'where':{'id':_0xb436e2['params']['id']}})[_0x4aa0('0x2b')](handleEntityNotFound(_0x1b3925,null))[_0x4aa0('0x2b')](function(_0x265b81){if(_0x265b81){return _0x265b81[_0x4aa0('0xae')](_0xb436e2[_0x4aa0('0x3e')][_0x4aa0('0x94')]);}})['then'](respondWithStatusCode(_0x1b3925,null))[_0x4aa0('0x40')](handleError(_0x1b3925,null));};exports[_0x4aa0('0xaf')]=function(_0x3c3d34,_0x433faa){var _0x4ac2c4=moment()[_0x4aa0('0xb0')]()['toString']();var _0x26b8b1=path[_0x4aa0('0x71')](config[_0x4aa0('0x72')],_0x4aa0('0xb1'),_0x4aa0('0xb2'),_0x4aa0('0xb3'));var _0x38c550=path[_0x4aa0('0x71')](config[_0x4aa0('0x72')],_0x4aa0('0xb1'),_0x4aa0('0xb2'),'attachments');var _0x2ecb82=path[_0x4aa0('0x71')](_0x26b8b1,_0x4ac2c4);var _0x114be1=util[_0x4aa0('0x79')](_0x4aa0('0xb4'),_0x3c3d34[_0x4aa0('0x41')]['id'],_0x4ac2c4);var _0x248dbc=path[_0x4aa0('0x71')](_0x26b8b1,_0x114be1);var _0x4c3bc5=[];_0x4c3bc5[_0x4aa0('0xb5')]({'model':db['User'],'as':_0x4aa0('0x7c'),'attributes':['id',_0x4aa0('0x54')],'raw':!![]});_0x4c3bc5[_0x4aa0('0xb5')]({'model':db['CmContact'],'as':_0x4aa0('0x62'),'attributes':['id',_0x4aa0('0xb6'),_0x4aa0('0xb7')],'raw':!![]});if(_0x3c3d34[_0x4aa0('0x3e')][_0x4aa0('0xb8')]){_0x4c3bc5[_0x4aa0('0xb5')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0xd36fde=[{'model':db['ChatMessage'],'as':_0x4aa0('0x7d'),'attributes':['id',_0x4aa0('0x32'),_0x4aa0('0x89'),'direction',_0x4aa0('0xa6'),_0x4aa0('0xb9')],'include':_0x4c3bc5}];_0xd36fde[_0x4aa0('0xb5')]({'model':db['ChatWebsite'],'as':_0x4aa0('0xba'),'attributes':['id',_0x4aa0('0x2e')]});_0xd36fde['push']({'model':db['User'],'as':_0x4aa0('0xbb'),'attributes':['id',_0x4aa0('0x54')]});return db[_0x4aa0('0x37')][_0x4aa0('0x4a')]({'where':{'id':_0x3c3d34['params']['id']},'include':_0xd36fde})[_0x4aa0('0x2b')](handleEntityNotFound(_0x433faa,null))[_0x4aa0('0x2b')](function(_0x17ac27){if(_0x17ac27){var _0x1977e5=_0x17ac27[_0x4aa0('0xbc')]({'plain':!![]});fs[_0x4aa0('0xbd')](_0x2ecb82);var _0x1cf702={'channel':_0x4aa0('0xbe'),'account':_0x1977e5[_0x4aa0('0xba')]['name'],'agent':_0x1977e5[_0x4aa0('0xbb')]?_0x1977e5['Owner'][_0x4aa0('0x54')]:_0x4aa0('0xbf'),'createdAt':moment(_0x1977e5[_0x4aa0('0x89')])[_0x4aa0('0x79')](_0x4aa0('0xa2'))[_0x4aa0('0xc0')](),'closedAt':_0x1977e5[_0x4aa0('0x66')]?moment(_0x1977e5['closedAt'])['format'](_0x4aa0('0xa2'))['toString']():'','disposition':_0x1977e5['disposition'],'chatInfo':{'browser':_0x1977e5[_0x4aa0('0xc1')],'os':_0x1977e5[_0x4aa0('0xc2')],'referer':_0x1977e5[_0x4aa0('0xc3')],'customerIp':_0x1977e5['customerIp'],'customerPort':_0x1977e5[_0x4aa0('0xc4')]?_0x1977e5['customerPort']:'N.A.'},'messages':_(_0x1977e5['Messages'])[_0x4aa0('0xc5')]()[_0x4aa0('0x9f')]({'secret':![]})[_0x4aa0('0x36')](function(_0x16efef){if(_0x16efef['Attachment']){var _0x4f323b=path['join'](_0x38c550,_0x16efef['Attachment']['basename']);if(fs['existsSync'](_0x4f323b)){fs[_0x4aa0('0xc6')](_0x4f323b)[_0x4aa0('0xc7')](fs[_0x4aa0('0xc8')](path[_0x4aa0('0x71')](_0x2ecb82,_0x16efef[_0x4aa0('0x6d')]['basename'])));}}return{'date':moment(_0x16efef[_0x4aa0('0x89')])[_0x4aa0('0x79')](_0x4aa0('0xa2'))[_0x4aa0('0xc0')](),'sender':_0x16efef[_0x4aa0('0x8b')]===_0x4aa0('0x5e')?_0x16efef[_0x4aa0('0x7c')]?_0x16efef[_0x4aa0('0x7c')][_0x4aa0('0x54')]:_0x4aa0('0x80'):_0x16efef[_0x4aa0('0x62')][_0x4aa0('0xb6')]+(_0x16efef[_0x4aa0('0x62')][_0x4aa0('0xb7')]?'\x20'+_0x16efef['Contact'][_0x4aa0('0xb7')]:''),'body':_0x16efef['Attachment']?_0x16efef[_0x4aa0('0x6d')][_0x4aa0('0x75')]:_0x16efef[_0x4aa0('0x32')],'direction':_0x16efef[_0x4aa0('0x8b')]===_0x4aa0('0x5e')?'A':'C','secret':_0x16efef['secret'],'read':_0x16efef[_0x4aa0('0xb9')],'attachment':_0x16efef[_0x4aa0('0x6d')]};})[_0x4aa0('0xc9')]()};return ejs[_0x4aa0('0xca')](path[_0x4aa0('0x71')](config[_0x4aa0('0x72')],_0x4aa0('0xb1'),_0x4aa0('0xcb'),'downloadInteraction.ejs'),{'interaction':_0x1cf702})[_0x4aa0('0x2b')](function(_0x20d5b4){var _0x1969c4=path[_0x4aa0('0x71')](_0x2ecb82,_0x4aa0('0xcc')+_0x1977e5['id']+'-'+_0x4ac2c4+_0x4aa0('0xcd'));var _0x5adb35={'path':_0x1969c4,'channel':_0x4aa0('0xbe'),'interactionId':_0x1977e5['id']};return pdf[_0x4aa0('0xce')](_0x20d5b4,_0x5adb35);})[_0x4aa0('0x2b')](function(){return new Promise(function(_0x4b9996,_0x308d36){zipdir(_0x2ecb82,{'saveTo':_0x248dbc},function(_0x26b173,_0x4848ec){if(_0x26b173)return _0x308d36(_0x26b173);return _0x4b9996(_0x4848ec);});})[_0x4aa0('0x2b')](function(){return new BPromise(function(_0x2cda69,_0x2b2ac7){rimraf(_0x2ecb82,function(_0x86eb8e){if(_0x86eb8e)_0x2b2ac7(_0x86eb8e);return _0x2cda69();});});})['then'](function(){return _0x433faa[_0x4aa0('0xaf')](_0x248dbc,_0x114be1,function(_0x4aadc5){if(_0x4aadc5){logger['error'](_0x4aa0('0xcf'),_0x4aadc5);}else{fs[_0x4aa0('0xd0')](_0x248dbc);}});});});}else{return _0x433faa[_0x4aa0('0x21')](0xc8);}})[_0x4aa0('0x40')](handleError(_0x433faa,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 01938bd..4dcc920 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 _0xf32e=['remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update'];(function(_0xb6d6e4,_0x53b48c){var _0xf76614=function(_0x1d10a6){while(--_0x1d10a6){_0xb6d6e4['push'](_0xb6d6e4['shift']());}};_0xf76614(++_0x53b48c);}(_0xf32e,0x93));var _0xef32=function(_0x1b6557,_0x411984){_0x1b6557=_0x1b6557-0x0;var _0x1ddb5f=_0xf32e[_0x1b6557];return _0x1ddb5f;};'use strict';var EventEmitter=require(_0xef32('0x0'));var ChatInteraction=require(_0xef32('0x1'))['db'][_0xef32('0x2')];var ChatMessage=require(_0xef32('0x1'))['db'][_0xef32('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef32('0x4'),'afterUpdate':_0xef32('0x5'),'afterDestroy':_0xef32('0x6')};function emitEvent(_0x524140){return function(_0x186ea0,_0x5653d2,_0x5009ae){_0x186ea0[_0xef32('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x285c52){_0x186ea0[_0xef32('0x8')](_0xef32('0x9'),_0x285c52[_0xef32('0xa')](function(_0xe304b1){return{'id':_0xe304b1['id']};}));return ChatMessage[_0xef32('0xb')]({'where':{'ChatInteractionId':_0x186ea0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef32('0xc')](function(_0x2c4f5b){_0x186ea0[_0xef32('0x8')](_0xef32('0xd'),_0x2c4f5b[_0xef32('0xe')]);ChatInteractionEvents[_0xef32('0xf')](_0x524140+':'+_0x186ea0['id'],_0x186ea0);ChatInteractionEvents[_0xef32('0xf')](_0x524140,_0x186ea0);_0x5009ae(null);})['catch'](_0x5009ae(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xef32('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xb18d=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x3a7077,_0x1f9d15){var _0x3ad27d=function(_0x3e2ece){while(--_0x3e2ece){_0x3a7077['push'](_0x3a7077['shift']());}};_0x3ad27d(++_0x1f9d15);}(_0xb18d,0x18e));var _0xdb18=function(_0x45da17,_0x17a5f4){_0x45da17=_0x45da17-0x0;var _0x52997b=_0xb18d[_0x45da17];return _0x52997b;};'use strict';var EventEmitter=require(_0xdb18('0x0'));var ChatInteraction=require(_0xdb18('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xdb18('0x1'))['db'][_0xdb18('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb18('0x3'),'afterUpdate':_0xdb18('0x4'),'afterDestroy':_0xdb18('0x5')};function emitEvent(_0x3e47b5){return function(_0x388f66,_0x2fd8af,_0x294454){_0x388f66[_0xdb18('0x6')]({'attributes':['id'],'raw':!![]})[_0xdb18('0x7')](function(_0x4b1c91){_0x388f66[_0xdb18('0x8')]('Users',_0x4b1c91[_0xdb18('0x9')](function(_0x1db826){return{'id':_0x1db826['id']};}));return ChatMessage[_0xdb18('0xa')]({'where':{'ChatInteractionId':_0x388f66['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x54e064){_0x388f66['setDataValue'](_0xdb18('0xb'),_0x54e064[_0xdb18('0xc')]);ChatInteractionEvents[_0xdb18('0xd')](_0x3e47b5+':'+_0x388f66['id'],_0x388f66);ChatInteractionEvents['emit'](_0x3e47b5,_0x388f66);_0x294454(null);})[_0xdb18('0xe')](_0x294454(null));};}for(var e in events){if(events[_0xdb18('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xdb18('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9cde1fd..35de728 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 _0x369d=['./chatInteraction.attributes','define','chat_interactions','changed','closed','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x369d,0x1ba));var _0xd369=function(_0x5de154,_0x5d1c77){_0x5de154=_0x5de154-0x0;var _0x1a8650=_0x369d[_0x5de154];return _0x1a8650;};'use strict';var _=require(_0xd369('0x0'));var util=require(_0xd369('0x1'));var logger=require(_0xd369('0x2'))(_0xd369('0x3'));var moment=require(_0xd369('0x4'));var BPromise=require(_0xd369('0x5'));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(_0xd369('0x6'));module['exports']=function(_0xdff293,_0x2c5352){return _0xdff293[_0xd369('0x7')]('ChatInteraction',attributes,{'tableName':_0xd369('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2466f5,_0x1a051c,_0x4fd718){if(_0x2466f5[_0xd369('0x9')](_0xd369('0xa'))){_0x2466f5[_0xd369('0xb')]=moment()[_0xd369('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4fd718(null,_0x2466f5);}},'charset':_0xd369('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x02f0=['define','ChatInteraction','chat_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInteraction.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x02f0,0x1e4));var _0x002f=function(_0x15bea2,_0x5d7617){_0x15bea2=_0x15bea2-0x0;var _0x4bc90a=_0x02f0[_0x15bea2];return _0x4bc90a;};'use strict';var _=require(_0x002f('0x0'));var util=require(_0x002f('0x1'));var logger=require(_0x002f('0x2'))(_0x002f('0x3'));var moment=require('moment');var BPromise=require(_0x002f('0x4'));var rp=require(_0x002f('0x5'));var fs=require('fs');var path=require(_0x002f('0x6'));var rimraf=require(_0x002f('0x7'));var config=require('../../config/environment');var attributes=require(_0x002f('0x8'));module['exports']=function(_0xb56179,_0x3834a8){return _0xb56179[_0x002f('0x9')](_0x002f('0xa'),attributes,{'tableName':_0x002f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c1c02,_0xd0b01f,_0x26507f){if(_0x5c1c02[_0x002f('0xc')](_0x002f('0xd'))){_0x5c1c02['closedAt']=moment()['format'](_0x002f('0xe'));}_0x26507f(null,_0x5c1c02);}},'charset':_0x002f('0xf'),'collate':_0x002f('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5843b08..32f6554 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 _0x1b21=['UpdateChatInteraction','AddTagsToChatInteraction','where','addTags','ids','AddTags','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatInteraction','body','options','raw','limit'];(function(_0x3ff28a,_0x2d4ab5){var _0x417b81=function(_0x2615fc){while(--_0x2615fc){_0x3ff28a['push'](_0x3ff28a['shift']());}};_0x417b81(++_0x2d4ab5);}(_0x1b21,0x15c));var _0x11b2=function(_0x15558a,_0x52f6e7){_0x15558a=_0x15558a-0x0;var _0x205ba5=_0x1b21[_0x15558a];return _0x205ba5;};'use strict';var _=require(_0x11b2('0x0'));var util=require(_0x11b2('0x1'));var moment=require(_0x11b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x11b2('0x4'))(_0x11b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x11b2('0x6'));var client=jayson[_0x11b2('0x7')][_0x11b2('0x8')]({'port':0x232a});config[_0x11b2('0x9')]=_[_0x11b2('0xa')](config[_0x11b2('0x9')],{'host':_0x11b2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11b2('0x9')]));require(_0x11b2('0xc'))[_0x11b2('0xd')](socket);function respondWithRpcPromise(_0x4e546e,_0x2d1498,_0x3aea2e){return new BPromise(function(_0x3cc85d,_0x34d9fc){return client[_0x11b2('0xe')](_0x4e546e,_0x3aea2e)[_0x11b2('0xf')](function(_0x417020){logger[_0x11b2('0x10')](_0x11b2('0x11'),_0x2d1498,'request\x20sent');logger[_0x11b2('0x12')](_0x11b2('0x13'),_0x2d1498,_0x11b2('0x14'),JSON[_0x11b2('0x15')](_0x417020));if(_0x417020[_0x11b2('0x16')]){if(_0x417020[_0x11b2('0x16')][_0x11b2('0x17')]===0x1f4){logger['error'](_0x11b2('0x11'),_0x2d1498,_0x417020['error'][_0x11b2('0x18')]);return _0x34d9fc(_0x417020['error'][_0x11b2('0x18')]);}logger[_0x11b2('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2d1498,_0x417020['error']['message']);return _0x3cc85d(_0x417020[_0x11b2('0x16')][_0x11b2('0x18')]);}else{logger['info'](_0x11b2('0x11'),_0x2d1498,_0x11b2('0x14'));_0x3cc85d(_0x417020[_0x11b2('0x19')]['message']);}})[_0x11b2('0x1a')](function(_0x37cedf){logger[_0x11b2('0x16')](_0x11b2('0x11'),_0x2d1498,_0x37cedf);_0x34d9fc(_0x37cedf);});});}exports['UpdateChatInteraction']=function(_0x596942){var _0x45577e=this;return new Promise(function(_0x2d85ec,_0x5d587c){return db[_0x11b2('0x1b')]['update'](_0x596942[_0x11b2('0x1c')],{'raw':_0x596942[_0x11b2('0x1d')]?_0x596942['options'][_0x11b2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x596942[_0x11b2('0x1d')]?_0x596942['options']['where']||null:null,'attributes':_0x596942[_0x11b2('0x1d')]?_0x596942[_0x11b2('0x1d')]['attributes']||null:null,'limit':_0x596942[_0x11b2('0x1d')]?_0x596942[_0x11b2('0x1d')][_0x11b2('0x1f')]||null:null})['then'](function(_0x68c730){logger[_0x11b2('0x10')](_0x11b2('0x20'),_0x596942);logger[_0x11b2('0x12')](_0x11b2('0x20'),_0x596942,JSON[_0x11b2('0x15')](_0x68c730));_0x2d85ec(_0x68c730);})[_0x11b2('0x1a')](function(_0x1eb862){logger['error']('UpdateChatInteraction',_0x1eb862[_0x11b2('0x18')],_0x596942);_0x5d587c(_0x45577e[_0x11b2('0x16')](0x1f4,_0x1eb862[_0x11b2('0x18')]));});});};exports[_0x11b2('0x21')]=function(_0x491559){return new Promise(function(_0x1f21f5,_0x5048c3){return db[_0x11b2('0x1b')]['find']({'where':_0x491559[_0x11b2('0x1d')]?_0x491559[_0x11b2('0x1d')][_0x11b2('0x22')]||null:null})[_0x11b2('0xf')](function(_0xb9113a){if(_0xb9113a){return _0xb9113a[_0x11b2('0x23')](_0x491559['body'][_0x11b2('0x24')],_['omit'](_0x491559[_0x11b2('0x1c')],[_0x11b2('0x24'),'id'])||{});}})['spread'](function(_0x24c333){logger[_0x11b2('0x10')](_0x11b2('0x25'),_0x491559);logger[_0x11b2('0x12')]('AddTags',_0x491559,JSON[_0x11b2('0x15')](_0x24c333));_0x1f21f5(_0x24c333);})[_0x11b2('0x1a')](function(_0x1566ee){logger['error'](_0x11b2('0x25'),_0x1566ee['message'],_0x491559);_0x5048c3(_this[_0x11b2('0x16')](0x1f4,_0x1566ee[_0x11b2('0x18')]));});});}; \ No newline at end of file +var _0xafb7=['where','limit','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateChatInteraction','body','options','raw'];(function(_0x3e1cdd,_0xbef891){var _0x497827=function(_0x25604b){while(--_0x25604b){_0x3e1cdd['push'](_0x3e1cdd['shift']());}};_0x497827(++_0xbef891);}(_0xafb7,0x1ad));var _0x7afb=function(_0x4b6316,_0x43f114){_0x4b6316=_0x4b6316-0x0;var _0x12fa84=_0xafb7[_0x4b6316];return _0x12fa84;};'use strict';var _=require(_0x7afb('0x0'));var util=require('util');var moment=require(_0x7afb('0x1'));var BPromise=require('bluebird');var rs=require(_0x7afb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7afb('0x3'));var logger=require(_0x7afb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7afb('0x5'));var client=jayson[_0x7afb('0x6')][_0x7afb('0x7')]({'port':0x232a});config[_0x7afb('0x8')]=_[_0x7afb('0x9')](config[_0x7afb('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7afb('0x8')]));require('./chatInteraction.socket')[_0x7afb('0xa')](socket);function respondWithRpcPromise(_0x1d13d4,_0xcd3e12,_0x594337){return new BPromise(function(_0x527fb0,_0x512611){return client[_0x7afb('0xb')](_0x1d13d4,_0x594337)[_0x7afb('0xc')](function(_0x18e925){logger['info'](_0x7afb('0xd'),_0xcd3e12,_0x7afb('0xe'));logger[_0x7afb('0xf')](_0x7afb('0x10'),_0xcd3e12,'request\x20sent',JSON[_0x7afb('0x11')](_0x18e925));if(_0x18e925[_0x7afb('0x12')]){if(_0x18e925[_0x7afb('0x12')][_0x7afb('0x13')]===0x1f4){logger['error'](_0x7afb('0xd'),_0xcd3e12,_0x18e925[_0x7afb('0x12')][_0x7afb('0x14')]);return _0x512611(_0x18e925[_0x7afb('0x12')][_0x7afb('0x14')]);}logger['error'](_0x7afb('0xd'),_0xcd3e12,_0x18e925[_0x7afb('0x12')][_0x7afb('0x14')]);return _0x527fb0(_0x18e925['error']['message']);}else{logger[_0x7afb('0x15')](_0x7afb('0xd'),_0xcd3e12,_0x7afb('0xe'));_0x527fb0(_0x18e925[_0x7afb('0x16')][_0x7afb('0x14')]);}})['catch'](function(_0x21c8a6){logger[_0x7afb('0x12')](_0x7afb('0xd'),_0xcd3e12,_0x21c8a6);_0x512611(_0x21c8a6);});});}exports[_0x7afb('0x17')]=function(_0x20c7ac){var _0x21564d=this;return new Promise(function(_0x5bbc23,_0x1b7d87){return db['ChatInteraction']['update'](_0x20c7ac[_0x7afb('0x18')],{'raw':_0x20c7ac[_0x7afb('0x19')]?_0x20c7ac['options'][_0x7afb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20c7ac[_0x7afb('0x19')]?_0x20c7ac['options'][_0x7afb('0x1b')]||null:null,'attributes':_0x20c7ac[_0x7afb('0x19')]?_0x20c7ac[_0x7afb('0x19')]['attributes']||null:null,'limit':_0x20c7ac[_0x7afb('0x19')]?_0x20c7ac['options'][_0x7afb('0x1c')]||null:null})[_0x7afb('0xc')](function(_0x18bc03){logger[_0x7afb('0x15')](_0x7afb('0x17'),_0x20c7ac);logger[_0x7afb('0xf')]('UpdateChatInteraction',_0x20c7ac,JSON[_0x7afb('0x11')](_0x18bc03));_0x5bbc23(_0x18bc03);})[_0x7afb('0x1d')](function(_0xaa2660){logger['error'](_0x7afb('0x17'),_0xaa2660['message'],_0x20c7ac);_0x1b7d87(_0x21564d[_0x7afb('0x12')](0x1f4,_0xaa2660[_0x7afb('0x14')]));});});};exports[_0x7afb('0x1e')]=function(_0x57eb6f){return new Promise(function(_0x4684b1,_0x3168f6){return db[_0x7afb('0x1f')][_0x7afb('0x20')]({'where':_0x57eb6f[_0x7afb('0x19')]?_0x57eb6f['options']['where']||null:null})[_0x7afb('0xc')](function(_0x1aa4d5){if(_0x1aa4d5){return _0x1aa4d5[_0x7afb('0x21')](_0x57eb6f[_0x7afb('0x18')][_0x7afb('0x22')],_[_0x7afb('0x23')](_0x57eb6f['body'],[_0x7afb('0x22'),'id'])||{});}})[_0x7afb('0x24')](function(_0x80aff4){logger['info']('AddTags',_0x57eb6f);logger[_0x7afb('0xf')](_0x7afb('0x25'),_0x57eb6f,JSON[_0x7afb('0x11')](_0x80aff4));_0x4684b1(_0x80aff4);})[_0x7afb('0x1d')](function(_0x4875b6){logger[_0x7afb('0x12')]('AddTags',_0x4875b6[_0x7afb('0x14')],_0x57eb6f);_0x3168f6(_this[_0x7afb('0x12')](0x1f4,_0x4875b6[_0x7afb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index dccd43d..346c449 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 _0xefa9=['length','save','remove','update','register'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0xefa9,0x92));var _0x9efa=function(_0x44e2ab,_0x2bc919){_0x44e2ab=_0x44e2ab-0x0;var _0x1c42e1=_0xefa9[_0x44e2ab];return _0x1c42e1;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9efa('0x0'),_0x9efa('0x1'),_0x9efa('0x2')];function createListener(_0xe9121c,_0x2f65a6){return function(_0x3d192d){_0x2f65a6['emit'](_0xe9121c,_0x3d192d);};}function removeListener(_0x4a1585,_0x5a0f60){return function(){ChatInteractionEvents['removeListener'](_0x4a1585,_0x5a0f60);};}exports[_0x9efa('0x3')]=function(_0x234160){for(var _0x153145=0x0,_0x43bc43=events[_0x9efa('0x4')];_0x153145<_0x43bc43;_0x153145++){var _0x29b698=events[_0x153145];var _0xfaeab1=createListener('chatInteraction:'+_0x29b698,_0x234160);ChatInteractionEvents['on'](_0x29b698,_0xfaeab1);}}; \ No newline at end of file +var _0xe8c5=['./chatInteraction.events','save','update','removeListener','register','length','chatInteraction:'];(function(_0xdb2ca,_0x166259){var _0x3b8030=function(_0x5d5cf4){while(--_0x5d5cf4){_0xdb2ca['push'](_0xdb2ca['shift']());}};_0x3b8030(++_0x166259);}(_0xe8c5,0x1c0));var _0x5e8c=function(_0xce7df0,_0x310799){_0xce7df0=_0xce7df0-0x0;var _0x5882a9=_0xe8c5[_0xce7df0];return _0x5882a9;};'use strict';var ChatInteractionEvents=require(_0x5e8c('0x0'));var events=[_0x5e8c('0x1'),'remove',_0x5e8c('0x2')];function createListener(_0xbc9a46,_0x4fc18d){return function(_0x1fb9ea){_0x4fc18d['emit'](_0xbc9a46,_0x1fb9ea);};}function removeListener(_0xeacb5b,_0x17f0e0){return function(){ChatInteractionEvents[_0x5e8c('0x3')](_0xeacb5b,_0x17f0e0);};}exports[_0x5e8c('0x4')]=function(_0xe4055b){for(var _0x40c88f=0x0,_0x20a6e8=events[_0x5e8c('0x5')];_0x40c88f<_0x20a6e8;_0x40c88f++){var _0x5bd9db=events[_0x40c88f];var _0x5edb0f=createListener(_0x5e8c('0x6')+_0x5bd9db,_0xe4055b);ChatInteractionEvents['on'](_0x5bd9db,_0x5edb0f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 017a6ad..11fa8d2 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 _0xb125=['removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy'];(function(_0x371fdd,_0x546ace){var _0x1bbc92=function(_0x11dbd1){while(--_0x11dbd1){_0x371fdd['push'](_0x371fdd['shift']());}};_0x1bbc92(++_0x546ace);}(_0xb125,0x9b));var _0x5b12=function(_0x178bba,_0x1f7e29){_0x178bba=_0x178bba-0x0;var _0x610ebc=_0xb125[_0x178bba];return _0x610ebc;};'use strict';var multer=require(_0x5b12('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b12('0x1'));var express=require(_0x5b12('0x2'));var router=express[_0x5b12('0x3')]();var fs_extra=require(_0x5b12('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b12('0x5'));var config=require('../../config/environment');var controller=require(_0x5b12('0x6'));router['get']('/',auth[_0x5b12('0x7')](),controller[_0x5b12('0x8')]);router['get'](_0x5b12('0x9'),auth[_0x5b12('0x7')](),controller[_0x5b12('0xa')]);router[_0x5b12('0xb')](_0x5b12('0xc'),auth[_0x5b12('0xd')](),controller[_0x5b12('0xe')]);router[_0x5b12('0xb')]('/:id/attachment_download',auth[_0x5b12('0xd')](),controller[_0x5b12('0xf')]);router['get'](_0x5b12('0x10'),auth[_0x5b12('0x7')](),controller[_0x5b12('0x11')]);router[_0x5b12('0xb')](_0x5b12('0x12'),auth[_0x5b12('0xd')](),controller['getMyMessages']);router['get'](_0x5b12('0x13'),auth[_0x5b12('0x7')](),controller[_0x5b12('0x14')]);router[_0x5b12('0x15')]('/',auth[_0x5b12('0x7')](),controller[_0x5b12('0x16')]);router[_0x5b12('0x15')]('/:id/vidaoo',auth[_0x5b12('0x7')](),controller[_0x5b12('0x17')]);var upload=multer({'storage':multer[_0x5b12('0x18')]({'destination':function(_0x596f0f,_0x2c066e,_0x3a0b2e){_0x3a0b2e(null,path[_0x5b12('0x19')](config[_0x5b12('0x1a')],_0x5b12('0x1b')));},'filename':function(_0x8f0910,_0x566488,_0x3caa18){_0x3caa18(null,util[_0x5b12('0x1c')](_0x5b12('0x1d'),Date[_0x5b12('0x1e')](),_0x566488[_0x5b12('0x1f')][_0x5b12('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5b12('0x21'),upload[_0x5b12('0x22')](_0x5b12('0x23')),controller['attachmentUpload']);router[_0x5b12('0x15')](_0x5b12('0x10'),auth[_0x5b12('0xd')](),controller['addMessage']);router[_0x5b12('0x15')](_0x5b12('0x24'),auth[_0x5b12('0x7')](),interaction[_0x5b12('0x25')](_0x5b12('0x26'),_0x5b12('0x27')),controller[_0x5b12('0x28')]);router[_0x5b12('0x29')](_0x5b12('0xc'),auth[_0x5b12('0x7')](),interaction['tracked'](_0x5b12('0x26'),_0x5b12('0x2a')),controller['update']);router[_0x5b12('0x29')](_0x5b12('0x2b'),controller['customUpdate']);router['put'](_0x5b12('0x2c'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x5b12('0x29')](_0x5b12('0x2d'),controller['close']);router[_0x5b12('0x2e')](_0x5b12('0xc'),auth[_0x5b12('0x7')](),interaction['tracked'](_0x5b12('0x26'),_0x5b12('0x2f')),controller[_0x5b12('0x30')]);router[_0x5b12('0x2e')]('/:id/tags',auth[_0x5b12('0x7')](),controller[_0x5b12('0x31')]);module[_0x5b12('0x32')]=router; \ No newline at end of file +var _0xcd77=['getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','addTags','/:id','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','put','/:id/close','delete','chatinteraction:destroy','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','isChatInteractionAuthorized','/:id/messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd77,0x1ec));var _0x7cd7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcd77[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7cd7('0x0'));var util=require(_0x7cd7('0x1'));var path=require(_0x7cd7('0x2'));var timeout=require(_0x7cd7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cd7('0x4'));var interaction=require(_0x7cd7('0x5'));var config=require(_0x7cd7('0x6'));var controller=require(_0x7cd7('0x7'));router['get']('/',auth[_0x7cd7('0x8')](),controller[_0x7cd7('0x9')]);router[_0x7cd7('0xa')](_0x7cd7('0xb'),auth[_0x7cd7('0x8')](),controller['describe']);router[_0x7cd7('0xa')]('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0x7cd7('0xc')](),controller['attachmentDownload']);router[_0x7cd7('0xa')](_0x7cd7('0xd'),auth[_0x7cd7('0x8')](),controller[_0x7cd7('0xe')]);router[_0x7cd7('0xa')](_0x7cd7('0xf'),auth[_0x7cd7('0xc')](),controller[_0x7cd7('0x10')]);router[_0x7cd7('0xa')](_0x7cd7('0x11'),auth[_0x7cd7('0x8')](),controller[_0x7cd7('0x12')]);router[_0x7cd7('0x13')]('/',auth['isAuthenticated'](),controller[_0x7cd7('0x14')]);router[_0x7cd7('0x13')]('/:id/vidaoo',auth[_0x7cd7('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ee115,_0x4314ef,_0x5f3ce8){_0x5f3ce8(null,path[_0x7cd7('0x15')](config[_0x7cd7('0x16')],_0x7cd7('0x17')));},'filename':function(_0x3fe5f7,_0x1d30e1,_0x26b0d4){_0x26b0d4(null,util[_0x7cd7('0x18')](_0x7cd7('0x19'),Date[_0x7cd7('0x1a')](),_0x1d30e1['originalname'][_0x7cd7('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7cd7('0x13')](_0x7cd7('0x1c'),upload['single'](_0x7cd7('0x1d')),controller[_0x7cd7('0x1e')]);router['post'](_0x7cd7('0xd'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x7cd7('0x1f'),auth[_0x7cd7('0x8')](),interaction[_0x7cd7('0x20')](_0x7cd7('0x21'),'chatinteraction:addtags'),controller[_0x7cd7('0x22')]);router['put'](_0x7cd7('0x23'),auth[_0x7cd7('0x8')](),interaction[_0x7cd7('0x20')](_0x7cd7('0x21'),_0x7cd7('0x24')),controller[_0x7cd7('0x25')]);router['put']('/:id/custom_update',controller[_0x7cd7('0x26')]);router['put'](_0x7cd7('0x27'),auth[_0x7cd7('0xc')](),controller[_0x7cd7('0x28')]);router[_0x7cd7('0x29')](_0x7cd7('0x2a'),controller['close']);router[_0x7cd7('0x2b')](_0x7cd7('0x23'),auth[_0x7cd7('0x8')](),interaction[_0x7cd7('0x20')]('chat',_0x7cd7('0x2c')),controller[_0x7cd7('0x2d')]);router[_0x7cd7('0x2b')]('/:id/tags',auth[_0x7cd7('0x8')](),controller['removeTags']);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 8ae372c..ec1d06d 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 _0x1368=['medium','BOOLEAN','exports','TEXT'];(function(_0x222550,_0x3c0a0c){var _0x58ac61=function(_0x4f7201){while(--_0x4f7201){_0x222550['push'](_0x222550['shift']());}};_0x58ac61(++_0x3c0a0c);}(_0x1368,0x116));var _0x8136=function(_0x206a3b,_0x11b371){_0x206a3b=_0x206a3b-0x0;var _0x46e0ab=_0x1368[_0x206a3b];return _0x46e0ab;};'use strict';var Sequelize=require('sequelize');module[_0x8136('0x0')]={'body':{'type':Sequelize[_0x8136('0x1')](_0x8136('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8136('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0762=['exports','BOOLEAN','sequelize'];(function(_0x4003dd,_0x6a4f7e){var _0x403928=function(_0x52bd4e){while(--_0x52bd4e){_0x4003dd['push'](_0x4003dd['shift']());}};_0x403928(++_0x6a4f7e);}(_0x0762,0x128));var _0x2076=function(_0x1111ac,_0x27f3d9){_0x1111ac=_0x1111ac-0x0;var _0x2b30c6=_0x0762[_0x1111ac];return _0x2b30c6;};'use strict';var Sequelize=require(_0x2076('0x0'));module[_0x2076('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2076('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index de017bf..98df504 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 _0x988a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','rows','catch','show','keys','length','include','options','find','create','body','params','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','User','findAll','agent','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x583130,_0x523059){var _0x5ab161=function(_0x4b340e){while(--_0x4b340e){_0x583130['push'](_0x583130['shift']());}};_0x5ab161(++_0x523059);}(_0x988a,0x12d));var _0xa988=function(_0x7744bf,_0x2f2270){_0x7744bf=_0x7744bf-0x0;var _0x1a34ac=_0x988a[_0x7744bf];return _0x1a34ac;};'use strict';var emlformat=require(_0xa988('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa988('0x1'));var jsonpatch=require(_0xa988('0x2'));var rp=require(_0xa988('0x3'));var moment=require(_0xa988('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa988('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa988('0x6'));var ejs=require(_0xa988('0x7'));var fs=require('fs');var fs_extra=require(_0xa988('0x8'));var _=require('lodash');var squel=require(_0xa988('0x9'));var crypto=require('crypto');var jsforce=require(_0xa988('0xa'));var deskjs=require(_0xa988('0xb'));var toCsv=require(_0xa988('0x6'));var querystring=require('querystring');var Papa=require(_0xa988('0xc'));var Redis=require(_0xa988('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa988('0xe'));var as=require(_0xa988('0xf'));var hardwareService=require(_0xa988('0x10'));var logger=require(_0xa988('0x11'))(_0xa988('0x12'));var utils=require(_0xa988('0x13'));var config=require(_0xa988('0x14'));var licenseUtil=require(_0xa988('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa988('0x16')](config[_0xa988('0x17')],{'host':_0xa988('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa988('0x17')]));require(_0xa988('0x19'))[_0xa988('0x1a')](socket);function respondWithStatusCode(_0x5178f8,_0x34fef4){_0x34fef4=_0x34fef4||0xcc;return function(_0x16547a){if(_0x16547a){return _0x5178f8[_0xa988('0x1b')](_0x34fef4);}return _0x5178f8['status'](_0x34fef4)[_0xa988('0x1c')]();};}function respondWithResult(_0x8bb3e7,_0x35a9ec){_0x35a9ec=_0x35a9ec||0xc8;return function(_0xe21025){if(_0xe21025){return _0x8bb3e7[_0xa988('0x1d')](_0x35a9ec)['json'](_0xe21025);}};}function respondWithFilteredResult(_0x2b68a2,_0x5f0509){return function(_0x4b07d8){if(_0x4b07d8){var _0x33b2aa=typeof _0x5f0509[_0xa988('0x1e')]===_0xa988('0x1f')&&typeof _0x5f0509[_0xa988('0x20')]===_0xa988('0x1f');var _0x405117=_0x4b07d8[_0xa988('0x21')];var _0x2afbfb=_0x33b2aa?0x0:_0x5f0509[_0xa988('0x1e')];var _0x82bae5=_0x33b2aa?_0x4b07d8[_0xa988('0x21')]:_0x5f0509[_0xa988('0x1e')]+_0x5f0509[_0xa988('0x20')];var _0x1db980;if(_0x82bae5>=_0x405117){_0x82bae5=_0x405117;_0x1db980=0xc8;}else{_0x1db980=0xce;}_0x2b68a2[_0xa988('0x1d')](_0x1db980);return _0x2b68a2[_0xa988('0x22')](_0xa988('0x23'),_0x2afbfb+'-'+_0x82bae5+'/'+_0x405117)[_0xa988('0x24')](_0x4b07d8);}return null;};}function patchUpdates(_0x2afa59){return function(_0x3bc249){try{jsonpatch[_0xa988('0x25')](_0x3bc249,_0x2afa59,!![]);}catch(_0x11e5a6){return BPromise[_0xa988('0x26')](_0x11e5a6);}return _0x3bc249[_0xa988('0x27')]();};}function saveUpdates(_0x14aed4,_0x180cd4){return function(_0x4e6377){if(_0x4e6377){return _0x4e6377[_0xa988('0x28')](_0x14aed4)['then'](function(_0x4dc8ab){return _0x4dc8ab;});}return null;};}function removeEntity(_0x29b271,_0x331d12){return function(_0x3fdbd8){if(_0x3fdbd8){return _0x3fdbd8[_0xa988('0x29')]()[_0xa988('0x2a')](function(){_0x29b271['status'](0xcc)[_0xa988('0x1c')]();});}};}function handleEntityNotFound(_0x271d4c,_0x41c9dc){return function(_0x419f6f){if(!_0x419f6f){_0x271d4c[_0xa988('0x1b')](0x194);}return _0x419f6f;};}function handleError(_0x2da918,_0x42957a){_0x42957a=_0x42957a||0x1f4;return function(_0x879528){logger[_0xa988('0x2b')](_0x879528[_0xa988('0x2c')]);if(_0x879528[_0xa988('0x2d')]){delete _0x879528[_0xa988('0x2d')];}_0x2da918[_0xa988('0x1d')](_0x42957a)[_0xa988('0x2e')](_0x879528);};}exports['index']=function(_0x5c1af3,_0xd56c23){var _0x1cb08b={},_0x3c8cf6={},_0x4b0de3={'count':0x0,'rows':[]};var _0x5069ed=_[_0xa988('0x2f')](db[_0xa988('0x30')][_0xa988('0x31')],function(_0x5b3b7d){return{'name':_0x5b3b7d['fieldName'],'type':_0x5b3b7d[_0xa988('0x32')]['key']};});_0x3c8cf6['model']=_[_0xa988('0x2f')](_0x5069ed,_0xa988('0x2d'));_0x3c8cf6[_0xa988('0x33')]=_['keys'](_0x5c1af3['query']);_0x3c8cf6[_0xa988('0x34')]=_[_0xa988('0x35')](_0x3c8cf6[_0xa988('0x36')],_0x3c8cf6[_0xa988('0x33')]);_0x1cb08b[_0xa988('0x37')]=_[_0xa988('0x35')](_0x3c8cf6['model'],qs[_0xa988('0x38')](_0x5c1af3['query'][_0xa988('0x38')]));_0x1cb08b[_0xa988('0x37')]=_0x1cb08b[_0xa988('0x37')]['length']?_0x1cb08b['attributes']:_0x3c8cf6[_0xa988('0x36')];if(!_0x5c1af3['query'][_0xa988('0x39')](_0xa988('0x3a'))){_0x1cb08b[_0xa988('0x20')]=qs[_0xa988('0x20')](_0x5c1af3['query'][_0xa988('0x20')]);_0x1cb08b[_0xa988('0x1e')]=qs[_0xa988('0x1e')](_0x5c1af3['query']['offset']);}_0x1cb08b[_0xa988('0x3b')]=qs[_0xa988('0x3c')](_0x5c1af3[_0xa988('0x33')]['sort']);_0x1cb08b[_0xa988('0x3d')]=qs['filters'](_['pick'](_0x5c1af3[_0xa988('0x33')],_0x3c8cf6[_0xa988('0x34')]),_0x5069ed);if(_0x5c1af3['query'][_0xa988('0x3e')]){_0x1cb08b[_0xa988('0x3d')]=_[_0xa988('0x3f')](_0x1cb08b[_0xa988('0x3d')],{'$or':_['map'](_0x5069ed,function(_0x457a18){if(_0x457a18[_0xa988('0x32')]!=='VIRTUAL'){var _0xcde034={};_0xcde034[_0x457a18[_0xa988('0x2d')]]={'$like':'%'+_0x5c1af3[_0xa988('0x33')]['filter']+'%'};return _0xcde034;}})});}_0x1cb08b=_['merge']({},_0x1cb08b,_0x5c1af3['options']);var _0x186cdf={'where':_0x1cb08b[_0xa988('0x3d')]};return db[_0xa988('0x30')][_0xa988('0x21')](_0x186cdf)[_0xa988('0x2a')](function(_0xf43f17){_0x4b0de3[_0xa988('0x21')]=_0xf43f17;if(_0x5c1af3['query'][_0xa988('0x40')]){_0x1cb08b['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x1cb08b);})[_0xa988('0x2a')](function(_0x5b3fd9){_0x4b0de3[_0xa988('0x41')]=_0x5b3fd9;return _0x4b0de3;})['then'](respondWithFilteredResult(_0xd56c23,_0x1cb08b))[_0xa988('0x42')](handleError(_0xd56c23,null));};exports[_0xa988('0x43')]=function(_0x55c4bd,_0x4e155c){var _0xf0150c={'raw':!![],'where':{'id':_0x55c4bd['params']['id']}},_0x433a73={};_0x433a73['model']=_[_0xa988('0x44')](db[_0xa988('0x30')][_0xa988('0x31')]);_0x433a73[_0xa988('0x33')]=_[_0xa988('0x44')](_0x55c4bd[_0xa988('0x33')]);_0x433a73[_0xa988('0x34')]=_[_0xa988('0x35')](_0x433a73['model'],_0x433a73['query']);_0xf0150c[_0xa988('0x37')]=_[_0xa988('0x35')](_0x433a73[_0xa988('0x36')],qs[_0xa988('0x38')](_0x55c4bd[_0xa988('0x33')]['fields']));_0xf0150c[_0xa988('0x37')]=_0xf0150c[_0xa988('0x37')][_0xa988('0x45')]?_0xf0150c[_0xa988('0x37')]:_0x433a73[_0xa988('0x36')];if(_0x55c4bd[_0xa988('0x33')][_0xa988('0x40')]){_0xf0150c[_0xa988('0x46')]=[{'all':!![]}];}_0xf0150c=_[_0xa988('0x3f')]({},_0xf0150c,_0x55c4bd[_0xa988('0x47')]);return db[_0xa988('0x30')][_0xa988('0x48')](_0xf0150c)['then'](handleEntityNotFound(_0x4e155c,null))['then'](respondWithResult(_0x4e155c,null))[_0xa988('0x42')](handleError(_0x4e155c,null));};exports[_0xa988('0x49')]=function(_0x3bf684,_0x1ed8a8){return db['ChatInternalMessage'][_0xa988('0x49')](_0x3bf684[_0xa988('0x4a')],{})[_0xa988('0x2a')](respondWithResult(_0x1ed8a8,0xc9))['catch'](handleError(_0x1ed8a8,null));};exports[_0xa988('0x28')]=function(_0x442c3c,_0x25b77e){if(_0x442c3c[_0xa988('0x4a')]['id']){delete _0x442c3c[_0xa988('0x4a')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x442c3c[_0xa988('0x4b')]['id']}})[_0xa988('0x2a')](handleEntityNotFound(_0x25b77e,null))[_0xa988('0x2a')](saveUpdates(_0x442c3c[_0xa988('0x4a')],null))[_0xa988('0x2a')](respondWithResult(_0x25b77e,null))[_0xa988('0x42')](handleError(_0x25b77e,null));};exports[_0xa988('0x29')]=function(_0xbe7995,_0x42d06e){return db[_0xa988('0x30')][_0xa988('0x48')]({'where':{'id':_0xbe7995[_0xa988('0x4b')]['id']}})[_0xa988('0x2a')](handleEntityNotFound(_0x42d06e,null))[_0xa988('0x2a')](removeEntity(_0x42d06e,null))['catch'](handleError(_0x42d06e,null));};exports[_0xa988('0x4c')]=function(_0x43d697,_0x3898a9){return db[_0xa988('0x30')]['describe']()[_0xa988('0x2a')](respondWithResult(_0x3898a9,null))[_0xa988('0x42')](handleError(_0x3898a9,null));};function wrapUser(_0x579a5c){return function(_0x3b9674){var _0x4c465a=_0x579a5c[_0xa988('0x4d')]({'plain':!![]});_0x4c465a['messages']=[];if(_0x3b9674){_0x4c465a[_0xa988('0x4e')]=_0x3b9674[_0xa988('0x4f')];_0x4c465a[_0xa988('0x50')]=_0x3b9674;}else{_0x4c465a[_0xa988('0x4e')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c465a['lastMessage']={};}return _0x4c465a;};}exports[_0xa988('0x51')]=function(_0x7b6961,_0x14c3c2,_0x419c80){var _0x4f8266=[];return db[_0xa988('0x52')][_0xa988('0x53')]({'where':{'role':[_0xa988('0x54'),'admin',_0xa988('0x55')]},'attributes':['id',_0xa988('0x56'),'name',_0xa988('0x57'),_0xa988('0x58'),_0xa988('0x59'),_0xa988('0x5a'),'lastLoginAt',_0xa988('0x5b'),_0xa988('0x5c')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa988('0x5d')],'as':_0xa988('0x5e'),'attributes':['id',_0xa988('0x2d'),_0xa988('0x32')],'through':{'attributes':[]}}]})[_0xa988('0x2a')](function(_0x2fc0cf){if(_0x2fc0cf){var _0xff68bb=_0x7b6961[_0xa988('0x55')]['get']({'plain':!![]});if(!_0xff68bb)throw new Error(_0xa988('0x5f'));if(_0xff68bb['role']===_0xa988('0x55')){return db[_0xa988('0x60')]['find']({'where':{'name':'Agents','userProfileId':_0xff68bb[_0xa988('0x61')]},'raw':!![]})[_0xa988('0x2a')](function(_0x575bdb){if(_0x575bdb){if(_0x575bdb[_0xa988('0x62')]===0x0){return db[_0xa988('0x63')][_0xa988('0x53')]({'where':{'sectionId':_0x575bdb['id']},'raw':!![]})['then'](function(_0x5e1232){var _0x11e9b3=[];if(_[_0xa988('0x64')](_0x5e1232)){_0x11e9b3=_[_0xa988('0x3e')](_0x2fc0cf,function(_0x45659c){if(_0x45659c['role']!=='agent'){return _0x45659c;}});return _0x11e9b3;}else{for(var _0x332d64=0x0;_0x332d64<_0x2fc0cf[_0xa988('0x45')];_0x332d64++){var _0x55e04d=_0x2fc0cf[_0x332d64];if(_0x55e04d[_0xa988('0x57')]===_0xa988('0x54')){var _0x658b0b=_[_0xa988('0x48')](_0x5e1232,function(_0x2823c0){return _0x2823c0['resourceId']===_0x55e04d['id'];});if(_0x658b0b)_0x11e9b3['push'](_0x55e04d);}else{_0x11e9b3['push'](_0x55e04d);}}return _0x11e9b3;}});}else{return _0x2fc0cf;}}else{var _0x499f53=_[_0xa988('0x3e')](_0x2fc0cf,function(_0x37cb86){if(_0x37cb86['role']!==_0xa988('0x54')){return _0x37cb86;}});return _0x499f53;}});}else{return _0x2fc0cf;}}})[_0xa988('0x2a')](function(_0x2df4b2){var _0x637b76=[];if(_0x2df4b2){_0x4f8266=_0x2df4b2;for(var _0x35e3c0=0x0;_0x35e3c0<_0x2df4b2[_0xa988('0x45')];_0x35e3c0+=0x1){_0x4f8266[_0x35e3c0]['messages']=[];_0x637b76[_0xa988('0x65')](db[_0xa988('0x30')]['find']({'where':{'FromId':[_0x7b6961['user']['id'],_0x2df4b2[_0x35e3c0]['id']],'ToId':[_0x7b6961[_0xa988('0x55')]['id'],_0x2df4b2[_0x35e3c0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa988('0x66'),_0xa988('0x67'),_0xa988('0x68'),_0xa988('0x4a')],'order':qs[_0xa988('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2df4b2[_0x35e3c0])));}return BPromise[_0xa988('0x69')](_0x637b76);}return[];})[_0xa988('0x2a')](function(_0x285d83){return{'rows':_0x285d83,'count':_0x285d83[_0xa988('0x45')]};})[_0xa988('0x2a')](respondWithResult(_0x14c3c2,null))[_0xa988('0x42')](handleError(_0x14c3c2,null));}; \ No newline at end of file +var _0x0027=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','createdAt','all','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0027,0x1a4));var _0x7002=function(_0x3f539e,_0x1fadde){_0x3f539e=_0x3f539e-0x0;var _0x5c5653=_0x0027[_0x3f539e];return _0x5c5653;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7002('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7002('0x1'));var moment=require(_0x7002('0x2'));var BPromise=require(_0x7002('0x3'));var Mustache=require(_0x7002('0x4'));var util=require('util');var path=require(_0x7002('0x5'));var sox=require(_0x7002('0x6'));var csv=require(_0x7002('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7002('0x8'));var squel=require('squel');var crypto=require(_0x7002('0x9'));var jsforce=require(_0x7002('0xa'));var deskjs=require(_0x7002('0xb'));var toCsv=require(_0x7002('0x7'));var querystring=require(_0x7002('0xc'));var Papa=require(_0x7002('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7002('0xe'));var as=require(_0x7002('0xf'));var hardwareService=require(_0x7002('0x10'));var logger=require(_0x7002('0x11'))(_0x7002('0x12'));var utils=require(_0x7002('0x13'));var config=require(_0x7002('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7002('0x15'))['db'];config[_0x7002('0x16')]=_['defaults'](config[_0x7002('0x16')],{'host':_0x7002('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7002('0x16')]));require(_0x7002('0x18'))[_0x7002('0x19')](socket);function respondWithStatusCode(_0x2110cf,_0x4706f4){_0x4706f4=_0x4706f4||0xcc;return function(_0x5957e8){if(_0x5957e8){return _0x2110cf['sendStatus'](_0x4706f4);}return _0x2110cf[_0x7002('0x1a')](_0x4706f4)[_0x7002('0x1b')]();};}function respondWithResult(_0x45914e,_0x261164){_0x261164=_0x261164||0xc8;return function(_0x28ed4d){if(_0x28ed4d){return _0x45914e[_0x7002('0x1a')](_0x261164)[_0x7002('0x1c')](_0x28ed4d);}};}function respondWithFilteredResult(_0xa5abe2,_0x37271a){return function(_0x4fbf16){if(_0x4fbf16){var _0x1e284a=typeof _0x37271a['offset']===_0x7002('0x1d')&&typeof _0x37271a[_0x7002('0x1e')]===_0x7002('0x1d');var _0x5b11bf=_0x4fbf16[_0x7002('0x1f')];var _0x4ab270=_0x1e284a?0x0:_0x37271a[_0x7002('0x20')];var _0x1eedee=_0x1e284a?_0x4fbf16['count']:_0x37271a[_0x7002('0x20')]+_0x37271a['limit'];var _0x411b74;if(_0x1eedee>=_0x5b11bf){_0x1eedee=_0x5b11bf;_0x411b74=0xc8;}else{_0x411b74=0xce;}_0xa5abe2[_0x7002('0x1a')](_0x411b74);return _0xa5abe2[_0x7002('0x21')]('Content-Range',_0x4ab270+'-'+_0x1eedee+'/'+_0x5b11bf)[_0x7002('0x1c')](_0x4fbf16);}return null;};}function patchUpdates(_0x3cf805){return function(_0x3d5355){try{jsonpatch[_0x7002('0x22')](_0x3d5355,_0x3cf805,!![]);}catch(_0x15b638){return BPromise['reject'](_0x15b638);}return _0x3d5355[_0x7002('0x23')]();};}function saveUpdates(_0x5aad9a,_0x3cc654){return function(_0x26bb62){if(_0x26bb62){return _0x26bb62[_0x7002('0x24')](_0x5aad9a)['then'](function(_0x32de7d){return _0x32de7d;});}return null;};}function removeEntity(_0xa3e983,_0x4e828e){return function(_0x45ab16){if(_0x45ab16){return _0x45ab16[_0x7002('0x25')]()[_0x7002('0x26')](function(){_0xa3e983[_0x7002('0x1a')](0xcc)[_0x7002('0x1b')]();});}};}function handleEntityNotFound(_0x16ca87,_0x1a6e0c){return function(_0x193e80){if(!_0x193e80){_0x16ca87['sendStatus'](0x194);}return _0x193e80;};}function handleError(_0x1ede36,_0x5a84c1){_0x5a84c1=_0x5a84c1||0x1f4;return function(_0x5c4e6f){logger['error'](_0x5c4e6f['stack']);if(_0x5c4e6f['name']){delete _0x5c4e6f[_0x7002('0x27')];}_0x1ede36[_0x7002('0x1a')](_0x5a84c1)['send'](_0x5c4e6f);};}exports[_0x7002('0x28')]=function(_0x12ed3c,_0x3033fd){var _0x2b69c2={},_0x4bc987={},_0x7983f9={'count':0x0,'rows':[]};var _0x1b2e98=_[_0x7002('0x29')](db['ChatInternalMessage'][_0x7002('0x2a')],function(_0x370cd3){return{'name':_0x370cd3[_0x7002('0x2b')],'type':_0x370cd3[_0x7002('0x2c')][_0x7002('0x2d')]};});_0x4bc987[_0x7002('0x2e')]=_['map'](_0x1b2e98,_0x7002('0x27'));_0x4bc987[_0x7002('0x2f')]=_['keys'](_0x12ed3c['query']);_0x4bc987['filters']=_['intersection'](_0x4bc987['model'],_0x4bc987[_0x7002('0x2f')]);_0x2b69c2[_0x7002('0x30')]=_[_0x7002('0x31')](_0x4bc987[_0x7002('0x2e')],qs[_0x7002('0x32')](_0x12ed3c[_0x7002('0x2f')][_0x7002('0x32')]));_0x2b69c2[_0x7002('0x30')]=_0x2b69c2['attributes'][_0x7002('0x33')]?_0x2b69c2[_0x7002('0x30')]:_0x4bc987[_0x7002('0x2e')];if(!_0x12ed3c['query'][_0x7002('0x34')](_0x7002('0x35'))){_0x2b69c2[_0x7002('0x1e')]=qs[_0x7002('0x1e')](_0x12ed3c[_0x7002('0x2f')][_0x7002('0x1e')]);_0x2b69c2[_0x7002('0x20')]=qs[_0x7002('0x20')](_0x12ed3c['query'][_0x7002('0x20')]);}_0x2b69c2[_0x7002('0x36')]=qs[_0x7002('0x37')](_0x12ed3c[_0x7002('0x2f')][_0x7002('0x37')]);_0x2b69c2['where']=qs[_0x7002('0x38')](_[_0x7002('0x39')](_0x12ed3c[_0x7002('0x2f')],_0x4bc987[_0x7002('0x38')]),_0x1b2e98);if(_0x12ed3c[_0x7002('0x2f')]['filter']){_0x2b69c2['where']=_[_0x7002('0x3a')](_0x2b69c2[_0x7002('0x3b')],{'$or':_[_0x7002('0x29')](_0x1b2e98,function(_0x2d4028){if(_0x2d4028['type']!==_0x7002('0x3c')){var _0x310d67={};_0x310d67[_0x2d4028[_0x7002('0x27')]]={'$like':'%'+_0x12ed3c[_0x7002('0x2f')][_0x7002('0x3d')]+'%'};return _0x310d67;}})});}_0x2b69c2=_[_0x7002('0x3a')]({},_0x2b69c2,_0x12ed3c[_0x7002('0x3e')]);var _0x1dd1af={'where':_0x2b69c2[_0x7002('0x3b')]};return db[_0x7002('0x3f')]['count'](_0x1dd1af)['then'](function(_0x579bed){_0x7983f9[_0x7002('0x1f')]=_0x579bed;if(_0x12ed3c[_0x7002('0x2f')][_0x7002('0x40')]){_0x2b69c2[_0x7002('0x41')]=[{'all':!![]}];}return db[_0x7002('0x3f')][_0x7002('0x42')](_0x2b69c2);})[_0x7002('0x26')](function(_0x226a46){_0x7983f9[_0x7002('0x43')]=_0x226a46;return _0x7983f9;})[_0x7002('0x26')](respondWithFilteredResult(_0x3033fd,_0x2b69c2))[_0x7002('0x44')](handleError(_0x3033fd,null));};exports[_0x7002('0x45')]=function(_0x1bb55e,_0xcea194){var _0x227c28={'raw':!![],'where':{'id':_0x1bb55e['params']['id']}},_0x48e48c={};_0x48e48c[_0x7002('0x2e')]=_[_0x7002('0x46')](db[_0x7002('0x3f')]['rawAttributes']);_0x48e48c['query']=_[_0x7002('0x46')](_0x1bb55e['query']);_0x48e48c['filters']=_[_0x7002('0x31')](_0x48e48c[_0x7002('0x2e')],_0x48e48c[_0x7002('0x2f')]);_0x227c28[_0x7002('0x30')]=_[_0x7002('0x31')](_0x48e48c[_0x7002('0x2e')],qs[_0x7002('0x32')](_0x1bb55e[_0x7002('0x2f')][_0x7002('0x32')]));_0x227c28['attributes']=_0x227c28[_0x7002('0x30')]['length']?_0x227c28['attributes']:_0x48e48c[_0x7002('0x2e')];if(_0x1bb55e[_0x7002('0x2f')][_0x7002('0x40')]){_0x227c28[_0x7002('0x41')]=[{'all':!![]}];}_0x227c28=_[_0x7002('0x3a')]({},_0x227c28,_0x1bb55e[_0x7002('0x3e')]);return db[_0x7002('0x3f')][_0x7002('0x47')](_0x227c28)[_0x7002('0x26')](handleEntityNotFound(_0xcea194,null))['then'](respondWithResult(_0xcea194,null))['catch'](handleError(_0xcea194,null));};exports[_0x7002('0x48')]=function(_0x4385c2,_0x1cb965){return db[_0x7002('0x3f')][_0x7002('0x48')](_0x4385c2[_0x7002('0x49')],{})[_0x7002('0x26')](respondWithResult(_0x1cb965,0xc9))[_0x7002('0x44')](handleError(_0x1cb965,null));};exports[_0x7002('0x24')]=function(_0x5f0096,_0x3d7581){if(_0x5f0096[_0x7002('0x49')]['id']){delete _0x5f0096['body']['id'];}return db['ChatInternalMessage'][_0x7002('0x47')]({'where':{'id':_0x5f0096[_0x7002('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d7581,null))[_0x7002('0x26')](saveUpdates(_0x5f0096[_0x7002('0x49')],null))[_0x7002('0x26')](respondWithResult(_0x3d7581,null))[_0x7002('0x44')](handleError(_0x3d7581,null));};exports[_0x7002('0x25')]=function(_0x3760f6,_0x56e821){return db[_0x7002('0x3f')][_0x7002('0x47')]({'where':{'id':_0x3760f6[_0x7002('0x4a')]['id']}})[_0x7002('0x26')](handleEntityNotFound(_0x56e821,null))[_0x7002('0x26')](removeEntity(_0x56e821,null))['catch'](handleError(_0x56e821,null));};exports[_0x7002('0x4b')]=function(_0x4d8851,_0x291e86){return db[_0x7002('0x3f')][_0x7002('0x4b')]()[_0x7002('0x26')](respondWithResult(_0x291e86,null))[_0x7002('0x44')](handleError(_0x291e86,null));};function wrapUser(_0x2dd0d1){return function(_0x51c8a5){var _0x170fab=_0x2dd0d1[_0x7002('0x4c')]({'plain':!![]});_0x170fab[_0x7002('0x4d')]=[];if(_0x51c8a5){_0x170fab['lastMessageAt']=_0x51c8a5['createdAt'];_0x170fab['lastMessage']=_0x51c8a5;}else{_0x170fab[_0x7002('0x4e')]=moment(0x0)[_0x7002('0x4f')](_0x7002('0x50'));_0x170fab[_0x7002('0x51')]={};}return _0x170fab;};}exports[_0x7002('0x52')]=function(_0x372e63,_0x2d0a0d,_0x45a8f2){var _0x53acfe=[];return db[_0x7002('0x53')]['findAll']({'where':{'role':[_0x7002('0x54'),_0x7002('0x55'),'user']},'attributes':['id',_0x7002('0x56'),'name',_0x7002('0x57'),_0x7002('0x58'),_0x7002('0x59'),_0x7002('0x5a'),_0x7002('0x5b'),_0x7002('0x5c'),_0x7002('0x5d')],'order':qs['sort'](_0x7002('0x5e')),'include':[{'model':db[_0x7002('0x5f')],'as':'VoiceQueues','attributes':['id',_0x7002('0x27'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x9c345c){if(_0x9c345c){var _0x1bb597=_0x372e63['user'][_0x7002('0x4c')]({'plain':!![]});if(!_0x1bb597)throw new Error(_0x7002('0x60'));if(_0x1bb597['role']===_0x7002('0x61')){return db[_0x7002('0x62')][_0x7002('0x47')]({'where':{'name':_0x7002('0x63'),'userProfileId':_0x1bb597[_0x7002('0x64')]},'raw':!![]})[_0x7002('0x26')](function(_0x263ea1){if(_0x263ea1){if(_0x263ea1[_0x7002('0x65')]===0x0){return db['UserProfileResource'][_0x7002('0x42')]({'where':{'sectionId':_0x263ea1['id']},'raw':!![]})[_0x7002('0x26')](function(_0x431ce7){var _0x3e1a3b=[];if(_[_0x7002('0x66')](_0x431ce7)){_0x3e1a3b=_[_0x7002('0x3d')](_0x9c345c,function(_0x45a46f){if(_0x45a46f['role']!==_0x7002('0x54')){return _0x45a46f;}});return _0x3e1a3b;}else{for(var _0x440091=0x0;_0x440091<_0x9c345c[_0x7002('0x33')];_0x440091++){var _0x455838=_0x9c345c[_0x440091];if(_0x455838[_0x7002('0x57')]===_0x7002('0x54')){var _0x599434=_[_0x7002('0x47')](_0x431ce7,function(_0x4a6467){return _0x4a6467[_0x7002('0x67')]===_0x455838['id'];});if(_0x599434)_0x3e1a3b[_0x7002('0x68')](_0x455838);}else{_0x3e1a3b['push'](_0x455838);}}return _0x3e1a3b;}});}else{return _0x9c345c;}}else{var _0xa67c8f=_[_0x7002('0x3d')](_0x9c345c,function(_0x3417bb){if(_0x3417bb[_0x7002('0x57')]!==_0x7002('0x54')){return _0x3417bb;}});return _0xa67c8f;}});}else{return _0x9c345c;}}})[_0x7002('0x26')](function(_0x170346){var _0x5c7ec0=[];if(_0x170346){_0x53acfe=_0x170346;for(var _0x487dbb=0x0;_0x487dbb<_0x170346['length'];_0x487dbb+=0x1){_0x53acfe[_0x487dbb][_0x7002('0x4d')]=[];_0x5c7ec0[_0x7002('0x68')](db[_0x7002('0x3f')][_0x7002('0x47')]({'where':{'FromId':[_0x372e63[_0x7002('0x61')]['id'],_0x170346[_0x487dbb]['id']],'ToId':[_0x372e63[_0x7002('0x61')]['id'],_0x170346[_0x487dbb]['id']],'ChatGroupId':null},'attributes':['id',_0x7002('0x69'),'FromId','ToId','read','body'],'order':qs[_0x7002('0x37')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7002('0x26')](wrapUser(_0x170346[_0x487dbb])));}return BPromise[_0x7002('0x6a')](_0x5c7ec0);}return[];})[_0x7002('0x26')](function(_0x53edf6){return{'rows':_0x53edf6,'count':_0x53edf6[_0x7002('0x33')]};})[_0x7002('0x26')](respondWithResult(_0x2d0a0d,null))[_0x7002('0x44')](handleError(_0x2d0a0d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 85be7fc..462aedc 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 _0x7462=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x7218f3,_0x1c4bc9){var _0x42067d=function(_0x59fd64){while(--_0x59fd64){_0x7218f3['push'](_0x7218f3['shift']());}};_0x42067d(++_0x1c4bc9);}(_0x7462,0x165));var _0x2746=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x7462[_0x5471ec];return _0x121d4c;};'use strict';var EventEmitter=require(_0x2746('0x0'));var ChatInternalMessage=require(_0x2746('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2746('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a2c7f){return function(_0x2274b7,_0x57c788,_0x2afbbd){ChatInternalMessageEvents[_0x2746('0x3')](_0x3a2c7f+':'+_0x2274b7['id'],_0x2274b7);ChatInternalMessageEvents[_0x2746('0x3')](_0x3a2c7f,_0x2274b7);_0x2afbbd(null);};}for(var e in events){if(events[_0x2746('0x4')](e)){var event=events[e];ChatInternalMessage[_0x2746('0x5')](e,emitEvent(event));}}module[_0x2746('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xcc88=['hasOwnProperty','exports','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x345f8f,_0x54cdb7){var _0x274518=function(_0x3857cf){while(--_0x3857cf){_0x345f8f['push'](_0x345f8f['shift']());}};_0x274518(++_0x54cdb7);}(_0xcc88,0xc2));var _0x8cc8=function(_0x57f74e,_0x34b923){_0x57f74e=_0x57f74e-0x0;var _0x451a29=_0xcc88[_0x57f74e];return _0x451a29;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x8cc8('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8cc8('0x1')](0x0);var events={'afterCreate':_0x8cc8('0x2'),'afterUpdate':_0x8cc8('0x3'),'afterDestroy':_0x8cc8('0x4')};function emitEvent(_0x174286){return function(_0x5bcc01,_0x49b977,_0x16cb22){ChatInternalMessageEvents[_0x8cc8('0x5')](_0x174286+':'+_0x5bcc01['id'],_0x5bcc01);ChatInternalMessageEvents[_0x8cc8('0x5')](_0x174286,_0x5bcc01);_0x16cb22(null);};}for(var e in events){if(events[_0x8cc8('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x8cc8('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c7a40ea..b68b995 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 _0xcf48=['util','../../config/logger','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x46f2d3,_0x3eb573){var _0x4cd17f=function(_0x2f5543){while(--_0x2f5543){_0x46f2d3['push'](_0x46f2d3['shift']());}};_0x4cd17f(++_0x3eb573);}(_0xcf48,0x129));var _0x8cf4=function(_0x1ff22d,_0x325116){_0x1ff22d=_0x1ff22d-0x0;var _0x2b58fa=_0xcf48[_0x1ff22d];return _0x2b58fa;};'use strict';var _=require('lodash');var util=require(_0x8cf4('0x0'));var logger=require(_0x8cf4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8cf4('0x2'));var rp=require(_0x8cf4('0x3'));var fs=require('fs');var path=require(_0x8cf4('0x4'));var rimraf=require(_0x8cf4('0x5'));var config=require('../../config/environment');var attributes=require(_0x8cf4('0x6'));module[_0x8cf4('0x7')]=function(_0x553ca4,_0x2424e4){return _0x553ca4['define']('ChatInternalMessage',attributes,{'tableName':_0x8cf4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8cf4('0x9'),'collate':_0x8cf4('0xa')});}; \ No newline at end of file +var _0x0752=['path','rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x0752,0x19e));var _0x2075=function(_0x5dba7e,_0x1a50b7){_0x5dba7e=_0x5dba7e-0x0;var _0x7bdae9=_0x0752[_0x5dba7e];return _0x7bdae9;};'use strict';var _=require(_0x2075('0x0'));var util=require(_0x2075('0x1'));var logger=require(_0x2075('0x2'))(_0x2075('0x3'));var moment=require(_0x2075('0x4'));var BPromise=require(_0x2075('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2075('0x6'));var rimraf=require(_0x2075('0x7'));var config=require('../../config/environment');var attributes=require(_0x2075('0x8'));module[_0x2075('0x9')]=function(_0x3c839f,_0x2b7b34){return _0x3c839f['define'](_0x2075('0xa'),attributes,{'tableName':_0x2075('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2075('0xc'),'collate':_0x2075('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 541de4d..a5ed563 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 _0x44f6=['stringify','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x57e97d,_0x1e293f){var _0x449c77=function(_0x1b44bf){while(--_0x1b44bf){_0x57e97d['push'](_0x57e97d['shift']());}};_0x449c77(++_0x1e293f);}(_0x44f6,0xa4));var _0x644f=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x44f6[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var moment=require(_0x644f('0x2'));var BPromise=require(_0x644f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x644f('0x4'))['db'];var utils=require(_0x644f('0x5'));var logger=require(_0x644f('0x6'))(_0x644f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x644f('0x8')][_0x644f('0x9')]({'port':0x232a});config[_0x644f('0xa')]=_[_0x644f('0xb')](config[_0x644f('0xa')],{'host':_0x644f('0xc'),'port':0x18eb});var socket=require(_0x644f('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x18eee9,_0x12210d,_0x1b7bc9){return new BPromise(function(_0x485c0a,_0x486476){return client[_0x644f('0xe')](_0x18eee9,_0x1b7bc9)[_0x644f('0xf')](function(_0x2e8c6b){logger[_0x644f('0x10')](_0x644f('0x11'),_0x12210d,_0x644f('0x12'));logger['debug'](_0x644f('0x13'),_0x12210d,_0x644f('0x12'),JSON[_0x644f('0x14')](_0x2e8c6b));if(_0x2e8c6b[_0x644f('0x15')]){if(_0x2e8c6b[_0x644f('0x15')]['code']===0x1f4){logger['error'](_0x644f('0x11'),_0x12210d,_0x2e8c6b[_0x644f('0x15')][_0x644f('0x16')]);return _0x486476(_0x2e8c6b[_0x644f('0x15')][_0x644f('0x16')]);}logger[_0x644f('0x15')](_0x644f('0x11'),_0x12210d,_0x2e8c6b[_0x644f('0x15')][_0x644f('0x16')]);return _0x485c0a(_0x2e8c6b[_0x644f('0x15')][_0x644f('0x16')]);}else{logger['info'](_0x644f('0x11'),_0x12210d,_0x644f('0x12'));_0x485c0a(_0x2e8c6b['result'][_0x644f('0x16')]);}})['catch'](function(_0x15a0a2){logger[_0x644f('0x15')](_0x644f('0x11'),_0x12210d,_0x15a0a2);_0x486476(_0x15a0a2);});});} \ No newline at end of file +var _0x53a2=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','then','info'];(function(_0x152a08,_0x23d85e){var _0x4651d6=function(_0x4163ed){while(--_0x4163ed){_0x152a08['push'](_0x152a08['shift']());}};_0x4651d6(++_0x23d85e);}(_0x53a2,0x1a7));var _0x253a=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x53a2[_0x34021d];return _0x16597b;};'use strict';var _=require('lodash');var util=require(_0x253a('0x0'));var moment=require(_0x253a('0x1'));var BPromise=require('bluebird');var rs=require(_0x253a('0x2'));var fs=require('fs');var Redis=require(_0x253a('0x3'));var db=require(_0x253a('0x4'))['db'];var utils=require(_0x253a('0x5'));var logger=require(_0x253a('0x6'))(_0x253a('0x7'));var config=require(_0x253a('0x8'));var jayson=require(_0x253a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x253a('0xa')]=_[_0x253a('0xb')](config[_0x253a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x253a('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x58319a,_0x1d7f76,_0x177cf9){return new BPromise(function(_0x47d0d2,_0x4a5d06){return client['request'](_0x58319a,_0x177cf9)[_0x253a('0xc')](function(_0x1d0e1a){logger[_0x253a('0xd')](_0x253a('0xe'),_0x1d7f76,_0x253a('0xf'));logger['debug'](_0x253a('0x10'),_0x1d7f76,_0x253a('0xf'),JSON[_0x253a('0x11')](_0x1d0e1a));if(_0x1d0e1a['error']){if(_0x1d0e1a[_0x253a('0x12')][_0x253a('0x13')]===0x1f4){logger[_0x253a('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x1d7f76,_0x1d0e1a[_0x253a('0x12')][_0x253a('0x14')]);return _0x4a5d06(_0x1d0e1a[_0x253a('0x12')]['message']);}logger[_0x253a('0x12')](_0x253a('0xe'),_0x1d7f76,_0x1d0e1a[_0x253a('0x12')][_0x253a('0x14')]);return _0x47d0d2(_0x1d0e1a[_0x253a('0x12')][_0x253a('0x14')]);}else{logger[_0x253a('0xd')](_0x253a('0xe'),_0x1d7f76,_0x253a('0xf'));_0x47d0d2(_0x1d0e1a[_0x253a('0x15')]['message']);}})[_0x253a('0x16')](function(_0x322ed0){logger[_0x253a('0x12')](_0x253a('0xe'),_0x1d7f76,_0x322ed0);_0x4a5d06(_0x322ed0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9c406ae..5820684 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 _0xea18=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','register','length'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xea18,0x1ba));var _0x8ea1=function(_0x4e6acf,_0x124c8a){_0x4e6acf=_0x4e6acf-0x0;var _0x260a7c=_0xea18[_0x4e6acf];return _0x260a7c;};'use strict';var ChatInternalMessageEvents=require(_0x8ea1('0x0'));var events=[_0x8ea1('0x1'),'remove','update'];function createListener(_0x4d6932,_0x383524){return function(_0x1eb674){_0x383524[_0x8ea1('0x2')](_0x4d6932,_0x1eb674);};}function removeListener(_0x2fbfd4,_0x24e3f1){return function(){ChatInternalMessageEvents[_0x8ea1('0x3')](_0x2fbfd4,_0x24e3f1);};}exports[_0x8ea1('0x4')]=function(_0x31b9b3){for(var _0x897ad0=0x0,_0x55db19=events[_0x8ea1('0x5')];_0x897ad0<_0x55db19;_0x897ad0++){var _0x311ab5=events[_0x897ad0];var _0x59327a=createListener(_0x8ea1('0x6')+_0x311ab5,_0x31b9b3);ChatInternalMessageEvents['on'](_0x311ab5,_0x59327a);}}; \ No newline at end of file +var _0x2fc6=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x243dce,_0x548bcf){var _0x482b9d=function(_0x504104){while(--_0x504104){_0x243dce['push'](_0x243dce['shift']());}};_0x482b9d(++_0x548bcf);}(_0x2fc6,0xf7));var _0x62fc=function(_0x375308,_0x2afd0d){_0x375308=_0x375308-0x0;var _0x35b040=_0x2fc6[_0x375308];return _0x35b040;};'use strict';var ChatInternalMessageEvents=require(_0x62fc('0x0'));var events=[_0x62fc('0x1'),_0x62fc('0x2'),_0x62fc('0x3')];function createListener(_0x324072,_0x50afdb){return function(_0x4b8f24){_0x50afdb[_0x62fc('0x4')](_0x324072,_0x4b8f24);};}function removeListener(_0x141c26,_0x4965dd){return function(){ChatInternalMessageEvents[_0x62fc('0x5')](_0x141c26,_0x4965dd);};}exports[_0x62fc('0x6')]=function(_0x456e06){for(var _0x729022=0x0,_0xd58bf9=events[_0x62fc('0x7')];_0x729022<_0xd58bf9;_0x729022++){var _0xa38461=events[_0x729022];var _0x2296ab=createListener(_0x62fc('0x8')+_0xa38461,_0x456e06);ChatInternalMessageEvents['on'](_0xa38461,_0x2296ab);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b7fc04c..bd91501 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 _0x5ee1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ee1,0xfd));var _0x15ee=function(_0x1ba792,_0x1db740){_0x1ba792=_0x1ba792-0x0;var _0x1a0ce4=_0x5ee1[_0x1ba792];return _0x1a0ce4;};'use strict';var multer=require(_0x15ee('0x0'));var util=require(_0x15ee('0x1'));var path=require(_0x15ee('0x2'));var timeout=require(_0x15ee('0x3'));var express=require(_0x15ee('0x4'));var router=express[_0x15ee('0x5')]();var fs_extra=require(_0x15ee('0x6'));var auth=require(_0x15ee('0x7'));var interaction=require(_0x15ee('0x8'));var config=require(_0x15ee('0x9'));var controller=require(_0x15ee('0xa'));router[_0x15ee('0xb')]('/',auth[_0x15ee('0xc')](),controller['index']);router[_0x15ee('0xb')](_0x15ee('0xd'),auth[_0x15ee('0xc')](),controller[_0x15ee('0xe')]);router['get'](_0x15ee('0xf'),auth['isAuthenticated'](),controller[_0x15ee('0x10')]);router[_0x15ee('0xb')](_0x15ee('0x11'),auth[_0x15ee('0xc')](),controller[_0x15ee('0x12')]);router[_0x15ee('0x13')]('/',auth[_0x15ee('0xc')](),controller['create']);router[_0x15ee('0x14')](_0x15ee('0x11'),controller[_0x15ee('0x15')]);router['delete'](_0x15ee('0x11'),auth[_0x15ee('0xc')](),controller['destroy']);module[_0x15ee('0x16')]=router; \ No newline at end of file +var _0x0498=['delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','show','post','put','update'];(function(_0x7a5cf1,_0x1f6459){var _0x4e4825=function(_0x39bac3){while(--_0x39bac3){_0x7a5cf1['push'](_0x7a5cf1['shift']());}};_0x4e4825(++_0x1f6459);}(_0x0498,0x193));var _0x8049=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0498[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x8049('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8049('0x1'));var router=express[_0x8049('0x2')]();var fs_extra=require(_0x8049('0x3'));var auth=require(_0x8049('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8049('0x5'));router[_0x8049('0x6')]('/',auth[_0x8049('0x7')](),controller[_0x8049('0x8')]);router[_0x8049('0x6')](_0x8049('0x9'),auth[_0x8049('0x7')](),controller[_0x8049('0xa')]);router[_0x8049('0x6')](_0x8049('0xb'),auth['isAuthenticated'](),controller['getUsers']);router[_0x8049('0x6')](_0x8049('0xc'),auth['isAuthenticated'](),controller[_0x8049('0xd')]);router[_0x8049('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8049('0xf')](_0x8049('0xc'),controller[_0x8049('0x10')]);router[_0x8049('0x11')](_0x8049('0xc'),auth['isAuthenticated'](),controller[_0x8049('0x12')]);module[_0x8049('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7ac0113..7c9a2cd 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 _0x3ee7=['ENUM','out','DATE','STRING','TEXT','exports','BOOLEAN'];(function(_0x379d55,_0x33b6d4){var _0x202a13=function(_0x4017e1){while(--_0x4017e1){_0x379d55['push'](_0x379d55['shift']());}};_0x202a13(++_0x33b6d4);}(_0x3ee7,0x98));var _0x73ee=function(_0x50dba9,_0x2fe5f7){_0x50dba9=_0x50dba9-0x0;var _0x37a156=_0x3ee7[_0x50dba9];return _0x37a156;};'use strict';var Sequelize=require('sequelize');module[_0x73ee('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x73ee('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x73ee('0x2')]('in',_0x73ee('0x3')),'defaultValue':_0x73ee('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x73ee('0x4')]},'providerName':{'type':Sequelize[_0x73ee('0x5')]},'providerResponse':{'type':Sequelize[_0x73ee('0x6')]}}; \ No newline at end of file +var _0x39c4=['exports','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x5d3226,_0x389ddf){var _0x1a1c3b=function(_0x22128c){while(--_0x22128c){_0x5d3226['push'](_0x5d3226['shift']());}};_0x1a1c3b(++_0x389ddf);}(_0x39c4,0x174));var _0x439c=function(_0x440535,_0x25d8a1){_0x440535=_0x440535-0x0;var _0xb68db2=_0x39c4[_0x440535];return _0xb68db2;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x439c('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x439c('0x3')]},'providerName':{'type':Sequelize[_0x439c('0x4')]},'providerResponse':{'type':Sequelize[_0x439c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5576ca6..e0db8ca 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 _0xea18=['socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','stack','map','ChatMessage','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','keys','include','find','create','body','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','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','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','QueryTypes','rejectmessage','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xea18,0x1de));var _0x8ea1=function(_0x1019df,_0x4dcb7){_0x1019df=_0x1019df-0x0;var _0x248a58=_0xea18[_0x1019df];return _0x248a58;};'use strict';var emlformat=require(_0x8ea1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ea1('0x1'));var rp=require(_0x8ea1('0x2'));var moment=require(_0x8ea1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ea1('0x4'));var util=require(_0x8ea1('0x5'));var path=require(_0x8ea1('0x6'));var sox=require('sox');var csv=require(_0x8ea1('0x7'));var ejs=require(_0x8ea1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8ea1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ea1('0xa'));var Papa=require(_0x8ea1('0xb'));var Redis=require('ioredis');var authService=require(_0x8ea1('0xc'));var qs=require(_0x8ea1('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ea1('0xe'));var logger=require(_0x8ea1('0xf'))(_0x8ea1('0x10'));var utils=require(_0x8ea1('0x11'));var config=require(_0x8ea1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ea1('0x13'))['db'];config['redis']=_[_0x8ea1('0x14')](config[_0x8ea1('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ea1('0x16'))(new Redis(config['redis']));require(_0x8ea1('0x17'))['register'](socket);var jayson=require(_0x8ea1('0x18'));var client=jayson[_0x8ea1('0x19')][_0x8ea1('0x1a')]({'port':0x232c});var client9002=jayson[_0x8ea1('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc55a,_0x50f8a2,_0x2f93a1,_0x14ae3a){return new BPromise(function(_0x56c621,_0x28671e){var _0xb19d4b=_0x14ae3a||client;return _0xb19d4b[_0x8ea1('0x1b')](_0x5bc55a,_0x2f93a1)[_0x8ea1('0x1c')](function(_0x121ad4){logger[_0x8ea1('0x1d')](_0x8ea1('0x1e'),_0x50f8a2,_0x8ea1('0x1f'));logger[_0x8ea1('0x20')](_0x8ea1('0x21'),_0x50f8a2,_0x8ea1('0x1f'),JSON[_0x8ea1('0x22')](_0x121ad4));if(_0x121ad4[_0x8ea1('0x23')]){if(_0x121ad4[_0x8ea1('0x23')][_0x8ea1('0x24')]===0x1f4){logger['error'](_0x8ea1('0x1e'),_0x50f8a2,_0x121ad4[_0x8ea1('0x23')]['message']);return _0x28671e(_0x121ad4['error'][_0x8ea1('0x25')]);}logger[_0x8ea1('0x23')](_0x8ea1('0x1e'),_0x50f8a2,_0x121ad4[_0x8ea1('0x23')][_0x8ea1('0x25')]);return _0x56c621(_0x121ad4['error'][_0x8ea1('0x25')]);}else{logger[_0x8ea1('0x1d')](_0x8ea1('0x1e'),_0x50f8a2,_0x8ea1('0x1f'));_0x56c621(_0x121ad4['result'][_0x8ea1('0x25')]);}})['catch'](function(_0x321457){logger[_0x8ea1('0x23')](_0x8ea1('0x1e'),_0x50f8a2,_0x321457);_0x28671e(_0x321457);});});}function respondWithStatusCode(_0x213d28,_0x37ec1d){_0x37ec1d=_0x37ec1d||0xcc;return function(_0x2d504e){if(_0x2d504e){return _0x213d28[_0x8ea1('0x26')](_0x37ec1d);}return _0x213d28[_0x8ea1('0x27')](_0x37ec1d)[_0x8ea1('0x28')]();};}function respondWithResult(_0x10ff47,_0xc7c34a){_0xc7c34a=_0xc7c34a||0xc8;return function(_0x723904){if(_0x723904){return _0x10ff47[_0x8ea1('0x27')](_0xc7c34a)[_0x8ea1('0x29')](_0x723904);}};}function respondWithFilteredResult(_0x287b2b,_0x42080e){return function(_0x23414d){if(_0x23414d){var _0x1f00b2=typeof _0x42080e[_0x8ea1('0x2a')]==='undefined'&&typeof _0x42080e[_0x8ea1('0x2b')]===_0x8ea1('0x2c');var _0x5ea817=_0x23414d[_0x8ea1('0x2d')];var _0x17d5f4=_0x1f00b2?0x0:_0x42080e[_0x8ea1('0x2a')];var _0x1dbcfa=_0x1f00b2?_0x23414d['count']:_0x42080e[_0x8ea1('0x2a')]+_0x42080e[_0x8ea1('0x2b')];var _0x326472;if(_0x1dbcfa>=_0x5ea817){_0x1dbcfa=_0x5ea817;_0x326472=0xc8;}else{_0x326472=0xce;}_0x287b2b[_0x8ea1('0x27')](_0x326472);return _0x287b2b['set'](_0x8ea1('0x2e'),_0x17d5f4+'-'+_0x1dbcfa+'/'+_0x5ea817)[_0x8ea1('0x29')](_0x23414d);}return null;};}function patchUpdates(_0x71bf62){return function(_0x401174){try{jsonpatch[_0x8ea1('0x2f')](_0x401174,_0x71bf62,!![]);}catch(_0x8237f2){return BPromise[_0x8ea1('0x30')](_0x8237f2);}return _0x401174['save']();};}function saveUpdates(_0x538385,_0x4e25a0){return function(_0x2a0e7d){if(_0x2a0e7d){return _0x2a0e7d[_0x8ea1('0x31')](_0x538385)[_0x8ea1('0x1c')](function(_0x2e8214){return _0x2e8214;});}return null;};}function removeEntity(_0x51563b,_0x1b3558){return function(_0xf5188a){if(_0xf5188a){return _0xf5188a[_0x8ea1('0x32')]()[_0x8ea1('0x1c')](function(){_0x51563b[_0x8ea1('0x27')](0xcc)[_0x8ea1('0x28')]();});}};}function handleEntityNotFound(_0x3d70d2,_0x1f0508){return function(_0x3abfca){if(!_0x3abfca){_0x3d70d2[_0x8ea1('0x26')](0x194);}return _0x3abfca;};}function handleError(_0x15a791,_0xa81626){_0xa81626=_0xa81626||0x1f4;return function(_0x21f07e){logger[_0x8ea1('0x23')](_0x21f07e[_0x8ea1('0x33')]);if(_0x21f07e['name']){delete _0x21f07e['name'];}_0x15a791[_0x8ea1('0x27')](_0xa81626)['send'](_0x21f07e);};}exports['index']=function(_0x5462e2,_0x5419c6){var _0x3e0da2={},_0x57530b={},_0x57380c={'count':0x0,'rows':[]};var _0xa68c27=_[_0x8ea1('0x34')](db[_0x8ea1('0x35')]['rawAttributes'],function(_0x125515){return{'name':_0x125515['fieldName'],'type':_0x125515[_0x8ea1('0x36')][_0x8ea1('0x37')]};});_0x57530b[_0x8ea1('0x38')]=_[_0x8ea1('0x34')](_0xa68c27,_0x8ea1('0x39'));_0x57530b[_0x8ea1('0x3a')]=_['keys'](_0x5462e2['query']);_0x57530b[_0x8ea1('0x3b')]=_[_0x8ea1('0x3c')](_0x57530b[_0x8ea1('0x38')],_0x57530b['query']);_0x3e0da2[_0x8ea1('0x3d')]=_['intersection'](_0x57530b[_0x8ea1('0x38')],qs[_0x8ea1('0x3e')](_0x5462e2[_0x8ea1('0x3a')]['fields']));_0x3e0da2[_0x8ea1('0x3d')]=_0x3e0da2[_0x8ea1('0x3d')][_0x8ea1('0x3f')]?_0x3e0da2[_0x8ea1('0x3d')]:_0x57530b[_0x8ea1('0x38')];if(!_0x5462e2['query']['hasOwnProperty'](_0x8ea1('0x40'))){_0x3e0da2[_0x8ea1('0x2b')]=qs[_0x8ea1('0x2b')](_0x5462e2['query'][_0x8ea1('0x2b')]);_0x3e0da2[_0x8ea1('0x2a')]=qs[_0x8ea1('0x2a')](_0x5462e2[_0x8ea1('0x3a')][_0x8ea1('0x2a')]);}_0x3e0da2['order']=qs[_0x8ea1('0x41')](_0x5462e2[_0x8ea1('0x3a')][_0x8ea1('0x41')]);_0x3e0da2['where']=qs['filters'](_[_0x8ea1('0x42')](_0x5462e2[_0x8ea1('0x3a')],_0x57530b[_0x8ea1('0x3b')]),_0xa68c27);if(_0x5462e2[_0x8ea1('0x3a')][_0x8ea1('0x43')]){_0x3e0da2['where']=_[_0x8ea1('0x44')](_0x3e0da2[_0x8ea1('0x45')],{'$or':_[_0x8ea1('0x34')](_0xa68c27,function(_0x102d26){if(_0x102d26[_0x8ea1('0x36')]!==_0x8ea1('0x46')){var _0x5096fb={};_0x5096fb[_0x102d26[_0x8ea1('0x39')]]={'$like':'%'+_0x5462e2['query'][_0x8ea1('0x43')]+'%'};return _0x5096fb;}})});}_0x3e0da2=_[_0x8ea1('0x44')]({},_0x3e0da2,_0x5462e2[_0x8ea1('0x47')]);var _0x388d3c={'where':_0x3e0da2['where']};return db[_0x8ea1('0x35')][_0x8ea1('0x2d')](_0x388d3c)[_0x8ea1('0x1c')](function(_0x2758c8){_0x57380c['count']=_0x2758c8;if(_0x5462e2[_0x8ea1('0x3a')][_0x8ea1('0x48')]){_0x3e0da2['include']=[{'all':!![]}];}return db[_0x8ea1('0x35')]['findAll'](_0x3e0da2);})[_0x8ea1('0x1c')](function(_0x181e8c){_0x57380c['rows']=_0x181e8c;return _0x57380c;})[_0x8ea1('0x1c')](respondWithFilteredResult(_0x5419c6,_0x3e0da2))[_0x8ea1('0x49')](handleError(_0x5419c6,null));};exports[_0x8ea1('0x4a')]=function(_0x77fe9a,_0x2f0624){var _0x50c1d9={'raw':!![],'where':{'id':_0x77fe9a[_0x8ea1('0x4b')]['id']}},_0x44d5b5={};_0x44d5b5[_0x8ea1('0x38')]=_['keys'](db[_0x8ea1('0x35')][_0x8ea1('0x4c')]);_0x44d5b5[_0x8ea1('0x3a')]=_[_0x8ea1('0x4d')](_0x77fe9a[_0x8ea1('0x3a')]);_0x44d5b5[_0x8ea1('0x3b')]=_[_0x8ea1('0x3c')](_0x44d5b5[_0x8ea1('0x38')],_0x44d5b5[_0x8ea1('0x3a')]);_0x50c1d9[_0x8ea1('0x3d')]=_[_0x8ea1('0x3c')](_0x44d5b5['model'],qs[_0x8ea1('0x3e')](_0x77fe9a[_0x8ea1('0x3a')][_0x8ea1('0x3e')]));_0x50c1d9['attributes']=_0x50c1d9['attributes'][_0x8ea1('0x3f')]?_0x50c1d9[_0x8ea1('0x3d')]:_0x44d5b5[_0x8ea1('0x38')];if(_0x77fe9a['query'][_0x8ea1('0x48')]){_0x50c1d9[_0x8ea1('0x4e')]=[{'all':!![]}];}_0x50c1d9=_[_0x8ea1('0x44')]({},_0x50c1d9,_0x77fe9a[_0x8ea1('0x47')]);return db[_0x8ea1('0x35')][_0x8ea1('0x4f')](_0x50c1d9)[_0x8ea1('0x1c')](handleEntityNotFound(_0x2f0624,null))[_0x8ea1('0x1c')](respondWithResult(_0x2f0624,null))['catch'](handleError(_0x2f0624,null));};exports[_0x8ea1('0x50')]=function(_0x4ebde1,_0x38648d){return db[_0x8ea1('0x35')][_0x8ea1('0x50')](_0x4ebde1[_0x8ea1('0x51')],{})[_0x8ea1('0x1c')](respondWithResult(_0x38648d,0xc9))['catch'](handleError(_0x38648d,null));};exports[_0x8ea1('0x31')]=function(_0x26aa25,_0x357099){if(_0x26aa25[_0x8ea1('0x51')]['id']){delete _0x26aa25[_0x8ea1('0x51')]['id'];}return db[_0x8ea1('0x35')][_0x8ea1('0x4f')]({'where':{'id':_0x26aa25[_0x8ea1('0x4b')]['id']}})[_0x8ea1('0x1c')](handleEntityNotFound(_0x357099,null))[_0x8ea1('0x1c')](saveUpdates(_0x26aa25['body'],null))['then'](respondWithResult(_0x357099,null))[_0x8ea1('0x49')](handleError(_0x357099,null));};exports[_0x8ea1('0x32')]=function(_0x1552e1,_0x49c773){return db[_0x8ea1('0x35')][_0x8ea1('0x4f')]({'where':{'id':_0x1552e1[_0x8ea1('0x4b')]['id']}})[_0x8ea1('0x1c')](handleEntityNotFound(_0x49c773,null))[_0x8ea1('0x1c')](removeEntity(_0x49c773,null))['catch'](handleError(_0x49c773,null));};exports[_0x8ea1('0x52')]=function(_0x4d53a7,_0x93859){return db['ChatMessage'][_0x8ea1('0x52')]()[_0x8ea1('0x1c')](respondWithResult(_0x93859,null))[_0x8ea1('0x49')](handleError(_0x93859,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8ea1('0x53')]=function(_0x365ffe,_0x1f838c,_0x3a359b){var _0x5d835d={'agent':{},'channel':_0x8ea1('0x54')};if(_0x365ffe['body']['id']){delete _0x365ffe[_0x8ea1('0x51')]['id'];}_0x365ffe[_0x8ea1('0x51')][_0x8ea1('0x55')]=!![];_0x365ffe['body'][_0x8ea1('0x56')]=moment()[_0x8ea1('0x57')](_0x8ea1('0x58'));_0x365ffe[_0x8ea1('0x51')]['UserId']=_0x365ffe[_0x8ea1('0x51')][_0x8ea1('0x59')]||_0x365ffe[_0x8ea1('0x5a')]['id'];_0x5d835d[_0x8ea1('0x5b')]['id']=_0x365ffe[_0x8ea1('0x51')]['UserId'];return db['ChatMessage'][_0x8ea1('0x4f')]({'where':{'id':_0x365ffe['params']['id'],'UserId':null}})[_0x8ea1('0x1c')](handleEntityNotFound(_0x1f838c,null))[_0x8ea1('0x1c')](saveUpdates(_0x365ffe[_0x8ea1('0x51')],null))[_0x8ea1('0x1c')](function(_0x3d6741){if(_0x3d6741){_0x5d835d[_0x8ea1('0x25')]=_0x3d6741[_0x8ea1('0x5c')]({'plain':!![]});return db[_0x8ea1('0x5d')][_0x8ea1('0x4f')]({'where':{'id':_0x3d6741[_0x8ea1('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x1f838c,null))[_0x8ea1('0x1c')](function(_0xcd01fc){if(_0xcd01fc){return _0xcd01fc[_0x8ea1('0x31')]({'UserId':_0x365ffe['body'][_0x8ea1('0x59')],'read1stAt':_['isNil'](_0xcd01fc['read1stAt'])?moment()[_0x8ea1('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2eeb33){if(_0x2eeb33){_0x5d835d[_0x8ea1('0x5f')]=_0x2eeb33['get']({'plain':!![]});interaction_log['info'](_0x8ea1('0x60'),_0x365ffe['user']['id'],_0x365ffe['user'][_0x8ea1('0x39')],_0x365ffe[_0x8ea1('0x5a')][_0x8ea1('0x61')],_0x5d835d[_0x8ea1('0x5f')]['id'],_0x365ffe['body']?JSON[_0x8ea1('0x22')](_0x365ffe[_0x8ea1('0x51')]):_0x8ea1('0x62'));return respondWithRpcPromise(_0x8ea1('0x63'),_0x8ea1('0x64'),_0x5d835d);}return null;})[_0x8ea1('0x1c')](function(_0xf62502){var _0x10ffa5=_0x8ea1('0x65')+_0xf62502['message'][_0x8ea1('0x66')];return db['sequelize']['query'](_0x10ffa5,{'type':db[_0x8ea1('0x67')]['QueryTypes'][_0x8ea1('0x68')],'raw':!![]})[_0x8ea1('0x1c')](function(_0x55f5b7){return _0x55f5b7;});})['then'](function(_0x27e876){if(_0x27e876){_0x5d835d[_0x8ea1('0x25')][_0x8ea1('0x69')]=_0x27e876[0x0];if(!_0x365ffe['body'][_0x8ea1('0x59')])return;return db[_0x8ea1('0x6a')][_0x8ea1('0x4f')]({'where':{'id':_0x365ffe[_0x8ea1('0x51')]['UserId'],'role':_0x8ea1('0x5b')},'attributes':['id',_0x8ea1('0x39'),_0x8ea1('0x6b'),_0x8ea1('0x6c'),_0x8ea1('0x6d')],'raw':!![]});}return null;})[_0x8ea1('0x1c')](function(_0x4eea11){if(!_0x4eea11)return null;_0x5d835d[_0x8ea1('0x25')][_0x8ea1('0x5b')]=_0x4eea11;return _0x5d835d;})[_0x8ea1('0x1c')](function(_0x291a8){if(_0x291a8){if(_0x365ffe[_0x8ea1('0x51')][_0x8ea1('0x6e')]){_0x5d835d[_0x8ea1('0x25')][_0x8ea1('0x6f')]=util['format'](_0x8ea1('0x70'),_0x365ffe['user'][_0x8ea1('0x39')]);_0x5d835d[_0x8ea1('0x25')][_0x8ea1('0x71')]=_0x5d835d[_0x8ea1('0x71')];_0x5d835d['message'][_0x8ea1('0x72')]=_0x5d835d[_0x8ea1('0x71')];_0x5d835d['message'][_0x8ea1('0x73')]=_0x8ea1('0x53');return respondWithRpcPromise(_0x8ea1('0x74'),_0x8ea1('0x74'),{'event':_0x8ea1('0x75'),'message':_[_0x8ea1('0x44')](_0x5d835d[_0x8ea1('0x25')],JSON[_0x8ea1('0x76')](_0x5d835d[_0x8ea1('0x5f')][_0x8ea1('0x77')]))},client9002)[_0x8ea1('0x1c')](function(){return _0x5d835d;});}return _0x5d835d;}return null;})[_0x8ea1('0x1c')](respondWithResult(_0x1f838c,null))[_0x8ea1('0x49')](handleError(_0x1f838c,null));};var interaction_log=require(_0x8ea1('0xf'))(_0x8ea1('0x78'));exports[_0x8ea1('0x30')]=function(_0x4cf677,_0x3ea1e5,_0x3d65dc){var _0x21bf66={'agent':{},'channel':_0x8ea1('0x54')};if(_0x4cf677['body']['id']){delete _0x4cf677[_0x8ea1('0x51')]['id'];}_0x4cf677[_0x8ea1('0x51')][_0x8ea1('0x59')]=_0x4cf677[_0x8ea1('0x51')]['UserId']||_0x4cf677[_0x8ea1('0x5a')]['id'];_0x21bf66['agent']['id']=_0x4cf677[_0x8ea1('0x51')][_0x8ea1('0x59')];return db['ChatMessage']['find']({'where':{'id':_0x4cf677[_0x8ea1('0x4b')]['id'],'UserId':null}})[_0x8ea1('0x1c')](handleEntityNotFound(_0x3ea1e5,null))[_0x8ea1('0x1c')](function(_0x23f98c){if(_0x23f98c){_0x21bf66[_0x8ea1('0x25')]=_0x23f98c['get']({'plain':!![]});return db[_0x8ea1('0x5d')][_0x8ea1('0x4f')]({'where':{'id':_0x23f98c[_0x8ea1('0x5e')]}});}return null;})[_0x8ea1('0x1c')](handleEntityNotFound(_0x3ea1e5,null))[_0x8ea1('0x1c')](function(_0x1a5ffc){if(_0x1a5ffc){_0x21bf66[_0x8ea1('0x5f')]=_0x1a5ffc[_0x8ea1('0x5c')]({'plain':!![]});interaction_log[_0x8ea1('0x1d')](_0x8ea1('0x79'),_0x4cf677[_0x8ea1('0x5a')]['id'],_0x4cf677[_0x8ea1('0x5a')]['name'],_0x4cf677[_0x8ea1('0x5a')][_0x8ea1('0x61')],_0x21bf66[_0x8ea1('0x5f')]['id'],_0x4cf677[_0x8ea1('0x51')]?JSON[_0x8ea1('0x22')](_0x4cf677['body']):_0x8ea1('0x62'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x21bf66);}return null;})[_0x8ea1('0x1c')](function(_0x137096){var _0x56c501=_0x8ea1('0x65')+_0x137096[_0x8ea1('0x25')]['ContactId'];return db[_0x8ea1('0x7a')][_0x8ea1('0x3a')](_0x56c501,{'type':db[_0x8ea1('0x67')][_0x8ea1('0x7b')]['SELECT'],'raw':!![]})[_0x8ea1('0x1c')](function(_0x1fe60d){return _0x1fe60d;});})[_0x8ea1('0x1c')](function(_0x350e48){if(_0x350e48){_0x21bf66[_0x8ea1('0x25')][_0x8ea1('0x69')]=_0x350e48[0x0];if(!_0x4cf677[_0x8ea1('0x51')][_0x8ea1('0x59')])return;return db[_0x8ea1('0x6a')][_0x8ea1('0x4f')]({'where':{'id':_0x4cf677[_0x8ea1('0x51')][_0x8ea1('0x59')],'role':_0x8ea1('0x5b')},'attributes':['id','name',_0x8ea1('0x6b'),'email','internal'],'raw':!![]});}return null;})[_0x8ea1('0x1c')](function(_0x15a31d){if(!_0x15a31d)return null;_0x21bf66[_0x8ea1('0x25')][_0x8ea1('0x5b')]=_0x15a31d;return _0x21bf66;})[_0x8ea1('0x1c')](function(_0x304e75){if(_0x304e75){_0x304e75[_0x8ea1('0x25')][_0x8ea1('0x6f')]=util['format']('SIP/%s',_0x4cf677['user']['name']);_0x304e75[_0x8ea1('0x25')]['channel']=_0x21bf66['channel'];_0x304e75[_0x8ea1('0x25')]['motionChannel']=_0x21bf66[_0x8ea1('0x71')];_0x304e75[_0x8ea1('0x25')][_0x8ea1('0x73')]=_0x8ea1('0x30');respondWithRpcPromise(_0x8ea1('0x74'),'EventManager',{'event':_0x8ea1('0x7c'),'message':_[_0x8ea1('0x44')](_0x21bf66['message'],JSON[_0x8ea1('0x76')](_0x21bf66[_0x8ea1('0x5f')][_0x8ea1('0x77')]))},client9002);return _0x21bf66;}return null;})[_0x8ea1('0x1c')](respondWithResult(_0x3ea1e5,null))[_0x8ea1('0x49')](handleError(_0x3ea1e5,null));}; \ No newline at end of file +var _0xe886=['set','Content-Range','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','params','keys','includeAll','find','body','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','interaction','stringify','AcceptMessage','acceptMessage','ContactId','Sequelize','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','parse','formData','reject','ChatInteraction','null','RejectMessage','rejectMessage','sequelize','SELECT','interface','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x44ec72,_0x3a2a12){var _0x447fa8=function(_0x4c37b5){while(--_0x4c37b5){_0x44ec72['push'](_0x44ec72['shift']());}};_0x447fa8(++_0x3a2a12);}(_0xe886,0xc0));var _0x6e88=function(_0x5b37ce,_0x5bae3b){_0x5b37ce=_0x5b37ce-0x0;var _0x13f369=_0xe886[_0x5b37ce];return _0x13f369;};'use strict';var emlformat=require(_0x6e88('0x0'));var rimraf=require(_0x6e88('0x1'));var zipdir=require(_0x6e88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e88('0x3'));var moment=require(_0x6e88('0x4'));var BPromise=require(_0x6e88('0x5'));var Mustache=require(_0x6e88('0x6'));var util=require('util');var path=require(_0x6e88('0x7'));var sox=require(_0x6e88('0x8'));var csv=require('to-csv');var ejs=require(_0x6e88('0x9'));var fs=require('fs');var fs_extra=require(_0x6e88('0xa'));var _=require('lodash');var squel=require(_0x6e88('0xb'));var crypto=require(_0x6e88('0xc'));var jsforce=require(_0x6e88('0xd'));var deskjs=require(_0x6e88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6e88('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e88('0x10'));var authService=require(_0x6e88('0x11'));var qs=require(_0x6e88('0x12'));var as=require(_0x6e88('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e88('0x14'))('api');var utils=require(_0x6e88('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6e88('0x16'));var db=require('../../mysqldb')['db'];config[_0x6e88('0x17')]=_[_0x6e88('0x18')](config[_0x6e88('0x17')],{'host':_0x6e88('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e88('0x17')]));require(_0x6e88('0x1a'))['register'](socket);var jayson=require(_0x6e88('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x6e88('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x21af31,_0x28641e,_0x1a0572,_0x43cd3d){return new BPromise(function(_0x2f3df5,_0x55ca71){var _0x4442f6=_0x43cd3d||client;return _0x4442f6[_0x6e88('0x1d')](_0x21af31,_0x1a0572)[_0x6e88('0x1e')](function(_0x2df51a){logger[_0x6e88('0x1f')](_0x6e88('0x20'),_0x28641e,'request\x20sent');logger['debug'](_0x6e88('0x21'),_0x28641e,_0x6e88('0x22'),JSON['stringify'](_0x2df51a));if(_0x2df51a[_0x6e88('0x23')]){if(_0x2df51a['error']['code']===0x1f4){logger[_0x6e88('0x23')]('ChatMessage,\x20%s,\x20%s',_0x28641e,_0x2df51a[_0x6e88('0x23')][_0x6e88('0x24')]);return _0x55ca71(_0x2df51a[_0x6e88('0x23')][_0x6e88('0x24')]);}logger[_0x6e88('0x23')](_0x6e88('0x20'),_0x28641e,_0x2df51a[_0x6e88('0x23')]['message']);return _0x2f3df5(_0x2df51a[_0x6e88('0x23')][_0x6e88('0x24')]);}else{logger['info'](_0x6e88('0x20'),_0x28641e,_0x6e88('0x22'));_0x2f3df5(_0x2df51a[_0x6e88('0x25')][_0x6e88('0x24')]);}})[_0x6e88('0x26')](function(_0x5aa188){logger['error'](_0x6e88('0x20'),_0x28641e,_0x5aa188);_0x55ca71(_0x5aa188);});});}function respondWithStatusCode(_0x3d6051,_0x5cedfd){_0x5cedfd=_0x5cedfd||0xcc;return function(_0x155cba){if(_0x155cba){return _0x3d6051[_0x6e88('0x27')](_0x5cedfd);}return _0x3d6051[_0x6e88('0x28')](_0x5cedfd)[_0x6e88('0x29')]();};}function respondWithResult(_0xe9da02,_0x52a68){_0x52a68=_0x52a68||0xc8;return function(_0x2f4b0e){if(_0x2f4b0e){return _0xe9da02[_0x6e88('0x28')](_0x52a68)['json'](_0x2f4b0e);}};}function respondWithFilteredResult(_0x4e295f,_0x339ed8){return function(_0x48f8dc){if(_0x48f8dc){var _0x54dd07=typeof _0x339ed8[_0x6e88('0x2a')]===_0x6e88('0x2b')&&typeof _0x339ed8['limit']===_0x6e88('0x2b');var _0x4d1f20=_0x48f8dc['count'];var _0x2cd05f=_0x54dd07?0x0:_0x339ed8[_0x6e88('0x2a')];var _0x23fde4=_0x54dd07?_0x48f8dc[_0x6e88('0x2c')]:_0x339ed8[_0x6e88('0x2a')]+_0x339ed8[_0x6e88('0x2d')];var _0x44f02e;if(_0x23fde4>=_0x4d1f20){_0x23fde4=_0x4d1f20;_0x44f02e=0xc8;}else{_0x44f02e=0xce;}_0x4e295f[_0x6e88('0x28')](_0x44f02e);return _0x4e295f[_0x6e88('0x2e')](_0x6e88('0x2f'),_0x2cd05f+'-'+_0x23fde4+'/'+_0x4d1f20)['json'](_0x48f8dc);}return null;};}function patchUpdates(_0x3ea491){return function(_0x1f38e3){try{jsonpatch['apply'](_0x1f38e3,_0x3ea491,!![]);}catch(_0x53448b){return BPromise['reject'](_0x53448b);}return _0x1f38e3[_0x6e88('0x30')]();};}function saveUpdates(_0x3b0e9c,_0x30de99){return function(_0x3113dc){if(_0x3113dc){return _0x3113dc[_0x6e88('0x31')](_0x3b0e9c)[_0x6e88('0x1e')](function(_0x248dde){return _0x248dde;});}return null;};}function removeEntity(_0x1f9e5e,_0x227268){return function(_0x4daeb9){if(_0x4daeb9){return _0x4daeb9[_0x6e88('0x32')]()[_0x6e88('0x1e')](function(){_0x1f9e5e[_0x6e88('0x28')](0xcc)[_0x6e88('0x29')]();});}};}function handleEntityNotFound(_0x31abbb,_0x2e477f){return function(_0x21a90f){if(!_0x21a90f){_0x31abbb[_0x6e88('0x27')](0x194);}return _0x21a90f;};}function handleError(_0x49c117,_0x2a9f93){_0x2a9f93=_0x2a9f93||0x1f4;return function(_0x271a71){logger['error'](_0x271a71[_0x6e88('0x33')]);if(_0x271a71['name']){delete _0x271a71[_0x6e88('0x34')];}_0x49c117['status'](_0x2a9f93)['send'](_0x271a71);};}exports[_0x6e88('0x35')]=function(_0x3e7e4f,_0x32f0ae){var _0x1296b1={},_0x58ffec={},_0x502fb1={'count':0x0,'rows':[]};var _0x43b14c=_[_0x6e88('0x36')](db[_0x6e88('0x37')][_0x6e88('0x38')],function(_0x50efc4){return{'name':_0x50efc4[_0x6e88('0x39')],'type':_0x50efc4[_0x6e88('0x3a')][_0x6e88('0x3b')]};});_0x58ffec['model']=_[_0x6e88('0x36')](_0x43b14c,_0x6e88('0x34'));_0x58ffec[_0x6e88('0x3c')]=_['keys'](_0x3e7e4f[_0x6e88('0x3c')]);_0x58ffec[_0x6e88('0x3d')]=_[_0x6e88('0x3e')](_0x58ffec[_0x6e88('0x3f')],_0x58ffec[_0x6e88('0x3c')]);_0x1296b1['attributes']=_['intersection'](_0x58ffec['model'],qs[_0x6e88('0x40')](_0x3e7e4f[_0x6e88('0x3c')]['fields']));_0x1296b1['attributes']=_0x1296b1[_0x6e88('0x41')][_0x6e88('0x42')]?_0x1296b1[_0x6e88('0x41')]:_0x58ffec['model'];if(!_0x3e7e4f[_0x6e88('0x3c')][_0x6e88('0x43')](_0x6e88('0x44'))){_0x1296b1[_0x6e88('0x2d')]=qs[_0x6e88('0x2d')](_0x3e7e4f[_0x6e88('0x3c')][_0x6e88('0x2d')]);_0x1296b1[_0x6e88('0x2a')]=qs[_0x6e88('0x2a')](_0x3e7e4f[_0x6e88('0x3c')][_0x6e88('0x2a')]);}_0x1296b1['order']=qs['sort'](_0x3e7e4f[_0x6e88('0x3c')][_0x6e88('0x45')]);_0x1296b1[_0x6e88('0x46')]=qs[_0x6e88('0x3d')](_[_0x6e88('0x47')](_0x3e7e4f[_0x6e88('0x3c')],_0x58ffec[_0x6e88('0x3d')]),_0x43b14c);if(_0x3e7e4f[_0x6e88('0x3c')][_0x6e88('0x48')]){_0x1296b1[_0x6e88('0x46')]=_['merge'](_0x1296b1[_0x6e88('0x46')],{'$or':_[_0x6e88('0x36')](_0x43b14c,function(_0x2051d2){if(_0x2051d2[_0x6e88('0x3a')]!=='VIRTUAL'){var _0x34cc11={};_0x34cc11[_0x2051d2['name']]={'$like':'%'+_0x3e7e4f['query'][_0x6e88('0x48')]+'%'};return _0x34cc11;}})});}_0x1296b1=_[_0x6e88('0x49')]({},_0x1296b1,_0x3e7e4f[_0x6e88('0x4a')]);var _0x5d5d74={'where':_0x1296b1['where']};return db[_0x6e88('0x37')][_0x6e88('0x2c')](_0x5d5d74)[_0x6e88('0x1e')](function(_0x192987){_0x502fb1[_0x6e88('0x2c')]=_0x192987;if(_0x3e7e4f[_0x6e88('0x3c')]['includeAll']){_0x1296b1['include']=[{'all':!![]}];}return db[_0x6e88('0x37')]['findAll'](_0x1296b1);})[_0x6e88('0x1e')](function(_0xafbc56){_0x502fb1['rows']=_0xafbc56;return _0x502fb1;})[_0x6e88('0x1e')](respondWithFilteredResult(_0x32f0ae,_0x1296b1))[_0x6e88('0x26')](handleError(_0x32f0ae,null));};exports['show']=function(_0x1a08f6,_0x23b87d){var _0x3cfa50={'raw':!![],'where':{'id':_0x1a08f6[_0x6e88('0x4b')]['id']}},_0x591c09={};_0x591c09[_0x6e88('0x3f')]=_[_0x6e88('0x4c')](db[_0x6e88('0x37')][_0x6e88('0x38')]);_0x591c09[_0x6e88('0x3c')]=_[_0x6e88('0x4c')](_0x1a08f6[_0x6e88('0x3c')]);_0x591c09[_0x6e88('0x3d')]=_[_0x6e88('0x3e')](_0x591c09['model'],_0x591c09[_0x6e88('0x3c')]);_0x3cfa50[_0x6e88('0x41')]=_[_0x6e88('0x3e')](_0x591c09[_0x6e88('0x3f')],qs[_0x6e88('0x40')](_0x1a08f6['query'][_0x6e88('0x40')]));_0x3cfa50['attributes']=_0x3cfa50[_0x6e88('0x41')][_0x6e88('0x42')]?_0x3cfa50[_0x6e88('0x41')]:_0x591c09[_0x6e88('0x3f')];if(_0x1a08f6[_0x6e88('0x3c')][_0x6e88('0x4d')]){_0x3cfa50['include']=[{'all':!![]}];}_0x3cfa50=_['merge']({},_0x3cfa50,_0x1a08f6[_0x6e88('0x4a')]);return db[_0x6e88('0x37')][_0x6e88('0x4e')](_0x3cfa50)[_0x6e88('0x1e')](handleEntityNotFound(_0x23b87d,null))['then'](respondWithResult(_0x23b87d,null))[_0x6e88('0x26')](handleError(_0x23b87d,null));};exports['create']=function(_0x440b46,_0x354ef3){return db['ChatMessage']['create'](_0x440b46[_0x6e88('0x4f')],{})[_0x6e88('0x1e')](respondWithResult(_0x354ef3,0xc9))['catch'](handleError(_0x354ef3,null));};exports['update']=function(_0x5f5a1b,_0x21db8c){if(_0x5f5a1b[_0x6e88('0x4f')]['id']){delete _0x5f5a1b[_0x6e88('0x4f')]['id'];}return db[_0x6e88('0x37')]['find']({'where':{'id':_0x5f5a1b[_0x6e88('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21db8c,null))['then'](saveUpdates(_0x5f5a1b[_0x6e88('0x4f')],null))[_0x6e88('0x1e')](respondWithResult(_0x21db8c,null))[_0x6e88('0x26')](handleError(_0x21db8c,null));};exports[_0x6e88('0x32')]=function(_0x546893,_0x311463){return db[_0x6e88('0x37')][_0x6e88('0x4e')]({'where':{'id':_0x546893[_0x6e88('0x4b')]['id']}})[_0x6e88('0x1e')](handleEntityNotFound(_0x311463,null))[_0x6e88('0x1e')](removeEntity(_0x311463,null))[_0x6e88('0x26')](handleError(_0x311463,null));};exports['describe']=function(_0x25fa30,_0x433c4f){return db[_0x6e88('0x37')]['describe']()['then'](respondWithResult(_0x433c4f,null))['catch'](handleError(_0x433c4f,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x6e88('0x50')]=function(_0x30828c,_0x1983ec,_0x3326cb){var _0x10f3c9={'agent':{},'channel':_0x6e88('0x51')};if(_0x30828c[_0x6e88('0x4f')]['id']){delete _0x30828c['body']['id'];}_0x30828c['body'][_0x6e88('0x52')]=!![];_0x30828c[_0x6e88('0x4f')][_0x6e88('0x53')]=moment()[_0x6e88('0x54')](_0x6e88('0x55'));_0x30828c[_0x6e88('0x4f')][_0x6e88('0x56')]=_0x30828c[_0x6e88('0x4f')][_0x6e88('0x56')]||_0x30828c[_0x6e88('0x57')]['id'];_0x10f3c9[_0x6e88('0x58')]['id']=_0x30828c[_0x6e88('0x4f')]['UserId'];return db[_0x6e88('0x37')][_0x6e88('0x4e')]({'where':{'id':_0x30828c[_0x6e88('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1983ec,null))['then'](saveUpdates(_0x30828c[_0x6e88('0x4f')],null))[_0x6e88('0x1e')](function(_0x290d09){if(_0x290d09){_0x10f3c9[_0x6e88('0x24')]=_0x290d09[_0x6e88('0x59')]({'plain':!![]});return db['ChatInteraction'][_0x6e88('0x4e')]({'where':{'id':_0x290d09[_0x6e88('0x5a')]}});}return null;})[_0x6e88('0x1e')](handleEntityNotFound(_0x1983ec,null))[_0x6e88('0x1e')](function(_0x507d47){if(_0x507d47){return _0x507d47[_0x6e88('0x31')]({'UserId':_0x30828c['body'][_0x6e88('0x56')],'read1stAt':_[_0x6e88('0x5b')](_0x507d47['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6e88('0x1e')](function(_0x405a07){if(_0x405a07){_0x10f3c9[_0x6e88('0x5c')]=_0x405a07[_0x6e88('0x59')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30828c[_0x6e88('0x57')]['id'],_0x30828c[_0x6e88('0x57')]['name'],_0x30828c['user']['role'],_0x10f3c9['interaction']['id'],_0x30828c[_0x6e88('0x4f')]?JSON[_0x6e88('0x5d')](_0x30828c[_0x6e88('0x4f')]):'null');return respondWithRpcPromise(_0x6e88('0x5e'),_0x6e88('0x5f'),_0x10f3c9);}return null;})['then'](function(_0x2d7a38){var _0x2bd362='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d7a38[_0x6e88('0x24')][_0x6e88('0x60')];return db['sequelize']['query'](_0x2bd362,{'type':db[_0x6e88('0x61')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6e88('0x1e')](function(_0x1325a8){return _0x1325a8;});})['then'](function(_0x52dd1a){if(_0x52dd1a){_0x10f3c9[_0x6e88('0x24')][_0x6e88('0x62')]=_0x52dd1a[0x0];if(!_0x30828c[_0x6e88('0x4f')][_0x6e88('0x56')])return;return db[_0x6e88('0x63')][_0x6e88('0x4e')]({'where':{'id':_0x30828c[_0x6e88('0x4f')]['UserId'],'role':'agent'},'attributes':['id','name',_0x6e88('0x64'),_0x6e88('0x65'),_0x6e88('0x66')],'raw':!![]});}return null;})[_0x6e88('0x1e')](function(_0x11f545){if(!_0x11f545)return null;_0x10f3c9['message'][_0x6e88('0x58')]=_0x11f545;return _0x10f3c9;})[_0x6e88('0x1e')](function(_0x5f12a3){if(_0x5f12a3){if(_0x30828c['body'][_0x6e88('0x67')]){_0x10f3c9[_0x6e88('0x24')]['interface']=util[_0x6e88('0x54')](_0x6e88('0x68'),_0x30828c[_0x6e88('0x57')][_0x6e88('0x34')]);_0x10f3c9['message']['channel']=_0x10f3c9[_0x6e88('0x69')];_0x10f3c9[_0x6e88('0x24')]['motionChannel']=_0x10f3c9['channel'];_0x10f3c9['message'][_0x6e88('0x6a')]='accept';return respondWithRpcPromise(_0x6e88('0x6b'),_0x6e88('0x6b'),{'event':'acceptmessage','message':_[_0x6e88('0x49')](_0x10f3c9[_0x6e88('0x24')],JSON[_0x6e88('0x6c')](_0x10f3c9[_0x6e88('0x5c')][_0x6e88('0x6d')]))},client9002)[_0x6e88('0x1e')](function(){return _0x10f3c9;});}return _0x10f3c9;}return null;})['then'](respondWithResult(_0x1983ec,null))[_0x6e88('0x26')](handleError(_0x1983ec,null));};var interaction_log=require(_0x6e88('0x14'))('chat-interactions');exports[_0x6e88('0x6e')]=function(_0x2de834,_0x10bdeb,_0x439a74){var _0x54eb76={'agent':{},'channel':_0x6e88('0x51')};if(_0x2de834[_0x6e88('0x4f')]['id']){delete _0x2de834[_0x6e88('0x4f')]['id'];}_0x2de834['body'][_0x6e88('0x56')]=_0x2de834[_0x6e88('0x4f')][_0x6e88('0x56')]||_0x2de834[_0x6e88('0x57')]['id'];_0x54eb76['agent']['id']=_0x2de834[_0x6e88('0x4f')][_0x6e88('0x56')];return db[_0x6e88('0x37')][_0x6e88('0x4e')]({'where':{'id':_0x2de834[_0x6e88('0x4b')]['id'],'UserId':null}})[_0x6e88('0x1e')](handleEntityNotFound(_0x10bdeb,null))[_0x6e88('0x1e')](function(_0x3c658c){if(_0x3c658c){_0x54eb76[_0x6e88('0x24')]=_0x3c658c['get']({'plain':!![]});return db[_0x6e88('0x6f')][_0x6e88('0x4e')]({'where':{'id':_0x3c658c[_0x6e88('0x5a')]}});}return null;})[_0x6e88('0x1e')](handleEntityNotFound(_0x10bdeb,null))[_0x6e88('0x1e')](function(_0x4ea996){if(_0x4ea996){_0x54eb76['interaction']=_0x4ea996['get']({'plain':!![]});interaction_log[_0x6e88('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2de834[_0x6e88('0x57')]['id'],_0x2de834[_0x6e88('0x57')][_0x6e88('0x34')],_0x2de834[_0x6e88('0x57')]['role'],_0x54eb76[_0x6e88('0x5c')]['id'],_0x2de834[_0x6e88('0x4f')]?JSON['stringify'](_0x2de834['body']):_0x6e88('0x70'));return respondWithRpcPromise(_0x6e88('0x71'),_0x6e88('0x72'),_0x54eb76);}return null;})[_0x6e88('0x1e')](function(_0xb18c04){var _0x509108='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb18c04[_0x6e88('0x24')][_0x6e88('0x60')];return db[_0x6e88('0x73')]['query'](_0x509108,{'type':db[_0x6e88('0x61')]['QueryTypes'][_0x6e88('0x74')],'raw':!![]})[_0x6e88('0x1e')](function(_0x2e82b8){return _0x2e82b8;});})[_0x6e88('0x1e')](function(_0x2c59e7){if(_0x2c59e7){_0x54eb76[_0x6e88('0x24')][_0x6e88('0x62')]=_0x2c59e7[0x0];if(!_0x2de834[_0x6e88('0x4f')][_0x6e88('0x56')])return;return db['User']['find']({'where':{'id':_0x2de834[_0x6e88('0x4f')]['UserId'],'role':_0x6e88('0x58')},'attributes':['id',_0x6e88('0x34'),_0x6e88('0x64'),_0x6e88('0x65'),_0x6e88('0x66')],'raw':!![]});}return null;})[_0x6e88('0x1e')](function(_0x157959){if(!_0x157959)return null;_0x54eb76[_0x6e88('0x24')][_0x6e88('0x58')]=_0x157959;return _0x54eb76;})[_0x6e88('0x1e')](function(_0x5270f8){if(_0x5270f8){_0x5270f8[_0x6e88('0x24')][_0x6e88('0x75')]=util[_0x6e88('0x54')]('SIP/%s',_0x2de834[_0x6e88('0x57')][_0x6e88('0x34')]);_0x5270f8[_0x6e88('0x24')][_0x6e88('0x69')]=_0x54eb76[_0x6e88('0x69')];_0x5270f8[_0x6e88('0x24')]['motionChannel']=_0x54eb76[_0x6e88('0x69')];_0x5270f8[_0x6e88('0x24')]['event']=_0x6e88('0x6e');respondWithRpcPromise(_0x6e88('0x6b'),'EventManager',{'event':_0x6e88('0x76'),'message':_['merge'](_0x54eb76['message'],JSON['parse'](_0x54eb76[_0x6e88('0x5c')]['formData']))},client9002);return _0x54eb76;}return null;})[_0x6e88('0x1e')](respondWithResult(_0x10bdeb,null))[_0x6e88('0x26')](handleError(_0x10bdeb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e3830c0..1b99ccd 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 _0xa3cf=['../../mysqldb','ChatMessage','setMaxListeners','emit','hook','exports'];(function(_0x4ce611,_0x2bd68f){var _0x9e7299=function(_0x50e524){while(--_0x50e524){_0x4ce611['push'](_0x4ce611['shift']());}};_0x9e7299(++_0x2bd68f);}(_0xa3cf,0x150));var _0xfa3c=function(_0x4ceadb,_0x4acb5c){_0x4ceadb=_0x4ceadb-0x0;var _0x280bb2=_0xa3cf[_0x4ceadb];return _0x280bb2;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xfa3c('0x0'))['db'][_0xfa3c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfa3c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x211e66){return function(_0x11cb5d,_0xd12b3a,_0x5456cf){ChatMessageEvents[_0xfa3c('0x3')](_0x211e66+':'+_0x11cb5d['id'],_0x11cb5d);ChatMessageEvents[_0xfa3c('0x3')](_0x211e66,_0x11cb5d);_0x5456cf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfa3c('0x4')](e,emitEvent(event));}}module[_0xfa3c('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x8a6c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x771b25,_0x286c5f){var _0x42522f=function(_0x75c890){while(--_0x75c890){_0x771b25['push'](_0x771b25['shift']());}};_0x42522f(++_0x286c5f);}(_0x8a6c,0x19f));var _0xc8a6=function(_0x166714,_0x244119){_0x166714=_0x166714-0x0;var _0x1e40a0=_0x8a6c[_0x166714];return _0x1e40a0;};'use strict';var EventEmitter=require(_0xc8a6('0x0'));var ChatMessage=require(_0xc8a6('0x1'))['db'][_0xc8a6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc8a6('0x3')](0x0);var events={'afterCreate':_0xc8a6('0x4'),'afterUpdate':_0xc8a6('0x5'),'afterDestroy':_0xc8a6('0x6')};function emitEvent(_0x447bcd){return function(_0x422ef5,_0x36aa54,_0x2b920f){ChatMessageEvents[_0xc8a6('0x7')](_0x447bcd+':'+_0x422ef5['id'],_0x422ef5);ChatMessageEvents[_0xc8a6('0x7')](_0x447bcd,_0x422ef5);_0x2b920f(null);};}for(var e in events){if(events[_0xc8a6('0x8')](e)){var event=events[e];ChatMessage[_0xc8a6('0x9')](e,emitEvent(event));}}module[_0xc8a6('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d43238a..670e6e9 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 _0x3d9e=['UserId','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x382c89,_0xca765e){var _0x302c19=function(_0x35b3f2){while(--_0x35b3f2){_0x382c89['push'](_0x382c89['shift']());}};_0x302c19(++_0xca765e);}(_0x3d9e,0x181));var _0xe3d9=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x3d9e[_0x2f6541];return _0x4d76d8;};'use strict';var _=require('lodash');var util=require(_0xe3d9('0x0'));var logger=require(_0xe3d9('0x1'))(_0xe3d9('0x2'));var moment=require(_0xe3d9('0x3'));var BPromise=require(_0xe3d9('0x4'));var rp=require(_0xe3d9('0x5'));var fs=require('fs');var path=require(_0xe3d9('0x6'));var rimraf=require(_0xe3d9('0x7'));var config=require(_0xe3d9('0x8'));var attributes=require('./chatMessage.attributes');module[_0xe3d9('0x9')]=function(_0xfa896e,_0x178be9){return _0xfa896e['define']('ChatMessage',attributes,{'tableName':_0xe3d9('0xa'),'paranoid':![],'indexes':[{'name':_0xe3d9('0xb'),'fields':[_0xe3d9('0xc')],'type':_0xe3d9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3615cb,_0x4da71e,_0x173415){var _0x55f612=_0xfa896e[_0xe3d9('0xe')];var _0x85104d=_0x3615cb[_0xe3d9('0xf')]({'plain':!![]});if(_0x85104d[_0xe3d9('0x10')][_0xe3d9('0x11')]()==='in'||_0x85104d['direction'][_0xe3d9('0x11')]()===_0xe3d9('0x12')&&!_0x85104d[_0xe3d9('0x13')]&&!_[_0xe3d9('0x14')](_0x85104d[_0xe3d9('0x15')])){_0x55f612['ChatInteraction']['findOne']({'where':{'id':_0x85104d[_0xe3d9('0x16')]}})['then'](function(_0x7a827){if(_0x7a827){_0x7a827[_0xe3d9('0x17')]({'lastMsgAt':_0x85104d[_0xe3d9('0x18')],'lastMsgDirection':_0x85104d[_0xe3d9('0x10')][_0xe3d9('0x11')]()});}})[_0xe3d9('0x19')](function(_0x3d2860){console[_0xe3d9('0x1a')](_0x3d2860);});}_0x173415();}},'charset':_0xe3d9('0x1b'),'collate':_0xe3d9('0x1c')});}; \ No newline at end of file +var _0x15ff=['./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x307a28,_0x2bdd9f){var _0x523ac7=function(_0x173ff2){while(--_0x173ff2){_0x307a28['push'](_0x307a28['shift']());}};_0x523ac7(++_0x2bdd9f);}(_0x15ff,0x74));var _0xf15f=function(_0x53902a,_0x4abe1c){_0x53902a=_0x53902a-0x0;var _0x4772e4=_0x15ff[_0x53902a];return _0x4772e4;};'use strict';var _=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var logger=require('../../config/logger')(_0xf15f('0x2'));var moment=require('moment');var BPromise=require(_0xf15f('0x3'));var rp=require(_0xf15f('0x4'));var fs=require('fs');var path=require(_0xf15f('0x5'));var rimraf=require(_0xf15f('0x6'));var config=require(_0xf15f('0x7'));var attributes=require(_0xf15f('0x8'));module['exports']=function(_0x31df48,_0x48b6a4){return _0x31df48[_0xf15f('0x9')](_0xf15f('0xa'),attributes,{'tableName':_0xf15f('0xb'),'paranoid':![],'indexes':[{'name':_0xf15f('0xc'),'fields':['body'],'type':_0xf15f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x122f18,_0xec7424,_0x5f18ef){var _0x1dfda0=_0x31df48[_0xf15f('0xe')];var _0x4fa7d8=_0x122f18[_0xf15f('0xf')]({'plain':!![]});if(_0x4fa7d8[_0xf15f('0x10')][_0xf15f('0x11')]()==='in'||_0x4fa7d8[_0xf15f('0x10')][_0xf15f('0x11')]()===_0xf15f('0x12')&&!_0x4fa7d8[_0xf15f('0x13')]&&!_[_0xf15f('0x14')](_0x4fa7d8[_0xf15f('0x15')])){_0x1dfda0[_0xf15f('0x16')][_0xf15f('0x17')]({'where':{'id':_0x4fa7d8[_0xf15f('0x18')]}})[_0xf15f('0x19')](function(_0x273c5d){if(_0x273c5d){_0x273c5d[_0xf15f('0x1a')]({'lastMsgAt':_0x4fa7d8[_0xf15f('0x1b')],'lastMsgDirection':_0x4fa7d8[_0xf15f('0x10')][_0xf15f('0x11')]()});}})[_0xf15f('0x1c')](function(_0x5331ff){console['error'](_0x5331ff);});}_0x5f18ef();}},'charset':_0xf15f('0x1d'),'collate':_0xf15f('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a681c49..c0e7495 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 _0x5186=['socket.io-emitter','redis','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x262fb1,_0x54d50d){var _0x39c238=function(_0x32fa66){while(--_0x32fa66){_0x262fb1['push'](_0x262fb1['shift']());}};_0x39c238(++_0x54d50d);}(_0x5186,0x180));var _0x6518=function(_0x3dd6b0,_0x5222f1){_0x3dd6b0=_0x3dd6b0-0x0;var _0x51e3be=_0x5186[_0x3dd6b0];return _0x51e3be;};'use strict';var _=require(_0x6518('0x0'));var util=require(_0x6518('0x1'));var moment=require(_0x6518('0x2'));var BPromise=require(_0x6518('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6518('0x4'));var db=require(_0x6518('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6518('0x6'));var config=require('../../config/environment');var jayson=require(_0x6518('0x7'));var client=jayson[_0x6518('0x8')][_0x6518('0x9')]({'port':0x232a});config['redis']=_[_0x6518('0xa')](config['redis'],{'host':_0x6518('0xb'),'port':0x18eb});var socket=require(_0x6518('0xc'))(new Redis(config[_0x6518('0xd')]));require(_0x6518('0xe'))['register'](socket);function respondWithRpcPromise(_0x3414ff,_0x3b2e34,_0x2ba042){return new BPromise(function(_0x3e42dd,_0x3ea3d7){return client[_0x6518('0xf')](_0x3414ff,_0x2ba042)[_0x6518('0x10')](function(_0xaa4c87){logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));logger['debug'](_0x6518('0x14'),_0x3b2e34,_0x6518('0x13'),JSON[_0x6518('0x15')](_0xaa4c87));if(_0xaa4c87['error']){if(_0xaa4c87['error'][_0x6518('0x16')]===0x1f4){logger[_0x6518('0x17')]('ChatMessage,\x20%s,\x20%s',_0x3b2e34,_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);return _0x3ea3d7(_0xaa4c87['error'][_0x6518('0x18')]);}logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0xaa4c87['error']['message']);return _0x3e42dd(_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);}else{logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));_0x3e42dd(_0xaa4c87['result'][_0x6518('0x18')]);}})[_0x6518('0x19')](function(_0x53f49a){logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0x53f49a);_0x3ea3d7(_0x53f49a);});});}exports[_0x6518('0x1a')]=function(_0x29302e){var _0x486a0f=this;return new Promise(function(_0x2fa8a9,_0x5785ff){return db[_0x6518('0x1b')][_0x6518('0x1c')](_0x29302e[_0x6518('0x1d')],{'raw':_0x29302e['options']?_0x29302e[_0x6518('0x1e')][_0x6518('0x1f')]===undefined?!![]:![]:!![]})[_0x6518('0x10')](function(_0x28f27a){logger[_0x6518('0x11')](_0x6518('0x1a'),_0x29302e);logger[_0x6518('0x20')](_0x6518('0x1a'),_0x29302e,JSON['stringify'](_0x28f27a));_0x2fa8a9(_0x28f27a);})[_0x6518('0x19')](function(_0x3cb488){logger[_0x6518('0x17')](_0x6518('0x1a'),_0x3cb488[_0x6518('0x18')],_0x29302e);_0x5785ff(_0x486a0f[_0x6518('0x17')](0x1f4,_0x3cb488['message']));});});}; \ No newline at end of file +var _0xc811=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateChatMessage','body','options','raw','moment'];(function(_0x84293f,_0x1b4173){var _0x15a611=function(_0x32f46b){while(--_0x32f46b){_0x84293f['push'](_0x84293f['shift']());}};_0x15a611(++_0x1b4173);}(_0xc811,0x14f));var _0x1c81=function(_0xc695a3,_0x116142){_0xc695a3=_0xc695a3-0x0;var _0x2d0864=_0xc811[_0xc695a3];return _0x2d0864;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c81('0x0'));var BPromise=require(_0x1c81('0x1'));var rs=require(_0x1c81('0x2'));var fs=require('fs');var Redis=require(_0x1c81('0x3'));var db=require(_0x1c81('0x4'))['db'];var utils=require(_0x1c81('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1c81('0x6')][_0x1c81('0x7')]({'port':0x232a});config[_0x1c81('0x8')]=_[_0x1c81('0x9')](config[_0x1c81('0x8')],{'host':_0x1c81('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c81('0x8')]));require(_0x1c81('0xb'))[_0x1c81('0xc')](socket);function respondWithRpcPromise(_0x258352,_0x431f18,_0x276c12){return new BPromise(function(_0xa76a20,_0x1d5c67){return client['request'](_0x258352,_0x276c12)[_0x1c81('0xd')](function(_0x2edd09){logger['info'](_0x1c81('0xe'),_0x431f18,'request\x20sent');logger[_0x1c81('0xf')](_0x1c81('0x10'),_0x431f18,_0x1c81('0x11'),JSON[_0x1c81('0x12')](_0x2edd09));if(_0x2edd09[_0x1c81('0x13')]){if(_0x2edd09['error']['code']===0x1f4){logger[_0x1c81('0x13')](_0x1c81('0xe'),_0x431f18,_0x2edd09['error'][_0x1c81('0x14')]);return _0x1d5c67(_0x2edd09[_0x1c81('0x13')][_0x1c81('0x14')]);}logger[_0x1c81('0x13')](_0x1c81('0xe'),_0x431f18,_0x2edd09['error'][_0x1c81('0x14')]);return _0xa76a20(_0x2edd09[_0x1c81('0x13')]['message']);}else{logger[_0x1c81('0x15')](_0x1c81('0xe'),_0x431f18,_0x1c81('0x11'));_0xa76a20(_0x2edd09[_0x1c81('0x16')][_0x1c81('0x14')]);}})[_0x1c81('0x17')](function(_0x1da860){logger[_0x1c81('0x13')]('ChatMessage,\x20%s,\x20%s',_0x431f18,_0x1da860);_0x1d5c67(_0x1da860);});});}exports[_0x1c81('0x18')]=function(_0x3b96cd){var _0x896934=this;return new Promise(function(_0x45d2c5,_0x56e6cc){return db['ChatMessage']['create'](_0x3b96cd[_0x1c81('0x19')],{'raw':_0x3b96cd[_0x1c81('0x1a')]?_0x3b96cd['options'][_0x1c81('0x1b')]===undefined?!![]:![]:!![]})[_0x1c81('0xd')](function(_0x574108){logger[_0x1c81('0x15')](_0x1c81('0x18'),_0x3b96cd);logger[_0x1c81('0xf')](_0x1c81('0x18'),_0x3b96cd,JSON[_0x1c81('0x12')](_0x574108));_0x45d2c5(_0x574108);})[_0x1c81('0x17')](function(_0x38bdb6){logger[_0x1c81('0x13')](_0x1c81('0x18'),_0x38bdb6['message'],_0x3b96cd);_0x56e6cc(_0x896934[_0x1c81('0x13')](0x1f4,_0x38bdb6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9a6768e..9ea718b 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 _0xff2a=['removeListener','length','chatMessage:','save','remove','emit'];(function(_0x46f88c,_0x5e7855){var _0x146849=function(_0x2afbbc){while(--_0x2afbbc){_0x46f88c['push'](_0x46f88c['shift']());}};_0x146849(++_0x5e7855);}(_0xff2a,0x93));var _0xaff2=function(_0x53e787,_0x4298e6){_0x53e787=_0x53e787-0x0;var _0x2781a0=_0xff2a[_0x53e787];return _0x2781a0;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xaff2('0x0'),_0xaff2('0x1'),'update'];function createListener(_0x1c7cc9,_0x25db80){return function(_0x5bb7dd){_0x25db80[_0xaff2('0x2')](_0x1c7cc9,_0x5bb7dd);};}function removeListener(_0x5c7c1c,_0x1cf624){return function(){ChatMessageEvents[_0xaff2('0x3')](_0x5c7c1c,_0x1cf624);};}exports['register']=function(_0x70cadf){for(var _0x8313e5=0x0,_0x2e4f44=events[_0xaff2('0x4')];_0x8313e5<_0x2e4f44;_0x8313e5++){var _0x33229b=events[_0x8313e5];var _0x1125e=createListener(_0xaff2('0x5')+_0x33229b,_0x70cadf);ChatMessageEvents['on'](_0x33229b,_0x1125e);}}; \ No newline at end of file +var _0x46e1=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x2debc2,_0x4a20fc){var _0x2cd301=function(_0x210259){while(--_0x210259){_0x2debc2['push'](_0x2debc2['shift']());}};_0x2cd301(++_0x4a20fc);}(_0x46e1,0x155));var _0x146e=function(_0x434757,_0x1605ce){_0x434757=_0x434757-0x0;var _0x10087c=_0x46e1[_0x434757];return _0x10087c;};'use strict';var ChatMessageEvents=require(_0x146e('0x0'));var events=[_0x146e('0x1'),_0x146e('0x2'),_0x146e('0x3')];function createListener(_0x155784,_0x1ff284){return function(_0x3708b1){_0x1ff284[_0x146e('0x4')](_0x155784,_0x3708b1);};}function removeListener(_0x18dab9,_0x3bbaec){return function(){ChatMessageEvents['removeListener'](_0x18dab9,_0x3bbaec);};}exports[_0x146e('0x5')]=function(_0x1f1f15){for(var _0x3de564=0x0,_0x228fe7=events[_0x146e('0x6')];_0x3de564<_0x228fe7;_0x3de564++){var _0x35e40e=events[_0x3de564];var _0x1c1398=createListener('chatMessage:'+_0x35e40e,_0x1f1f15);ChatMessageEvents['on'](_0x35e40e,_0x1c1398);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1567f5a..26200ca 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 _0x549e=['create','update','put','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked'];(function(_0x92ae86,_0x26822a){var _0x8fbc48=function(_0xc3e55){while(--_0xc3e55){_0x92ae86['push'](_0x92ae86['shift']());}};_0x8fbc48(++_0x26822a);}(_0x549e,0x11b));var _0xe549=function(_0x277446,_0xbef1a4){_0x277446=_0x277446-0x0;var _0x3486ed=_0x549e[_0x277446];return _0x3486ed;};'use strict';var multer=require(_0xe549('0x0'));var util=require(_0xe549('0x1'));var path=require(_0xe549('0x2'));var timeout=require(_0xe549('0x3'));var express=require(_0xe549('0x4'));var router=express['Router']();var fs_extra=require(_0xe549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe549('0x6'));var config=require(_0xe549('0x7'));var controller=require(_0xe549('0x8'));router[_0xe549('0x9')]('/',auth[_0xe549('0xa')](),controller[_0xe549('0xb')]);router['get'](_0xe549('0xc'),auth[_0xe549('0xa')](),controller[_0xe549('0xd')]);router[_0xe549('0x9')](_0xe549('0xe'),auth[_0xe549('0xa')](),controller[_0xe549('0xf')]);router['post']('/',auth[_0xe549('0xa')](),interaction[_0xe549('0x10')]('chat','chatmessage:create'),controller[_0xe549('0x11')]);router['put'](_0xe549('0xe'),controller[_0xe549('0x12')]);router[_0xe549('0x13')](_0xe549('0x14'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0xe549('0xa')](),controller[_0xe549('0x15')]);router[_0xe549('0x16')](_0xe549('0xe'),auth[_0xe549('0xa')](),controller[_0xe549('0x17')]);module[_0xe549('0x18')]=router; \ No newline at end of file +var _0x9e8f=['tracked','chat','chatmessage:create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x10427a,_0x1dfe34){var _0x45e8e2=function(_0x3f5fca){while(--_0x3f5fca){_0x10427a['push'](_0x10427a['shift']());}};_0x45e8e2(++_0x1dfe34);}(_0x9e8f,0x1ba));var _0xf9e8=function(_0x1d10a3,_0xdeea7c){_0x1d10a3=_0x1d10a3-0x0;var _0x4bf0d7=_0x9e8f[_0x1d10a3];return _0x4bf0d7;};'use strict';var multer=require(_0xf9e8('0x0'));var util=require(_0xf9e8('0x1'));var path=require(_0xf9e8('0x2'));var timeout=require(_0xf9e8('0x3'));var express=require('express');var router=express[_0xf9e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf9e8('0x5'));var interaction=require(_0xf9e8('0x6'));var config=require('../../config/environment');var controller=require(_0xf9e8('0x7'));router[_0xf9e8('0x8')]('/',auth[_0xf9e8('0x9')](),controller['index']);router['get']('/describe',auth[_0xf9e8('0x9')](),controller[_0xf9e8('0xa')]);router['get'](_0xf9e8('0xb'),auth[_0xf9e8('0x9')](),controller[_0xf9e8('0xc')]);router[_0xf9e8('0xd')]('/',auth[_0xf9e8('0x9')](),interaction[_0xf9e8('0xe')](_0xf9e8('0xf'),_0xf9e8('0x10')),controller['create']);router[_0xf9e8('0x11')](_0xf9e8('0xb'),controller['update']);router['put'](_0xf9e8('0x12'),auth[_0xf9e8('0x9')](),controller[_0xf9e8('0x13')]);router[_0xf9e8('0x11')](_0xf9e8('0x14'),auth[_0xf9e8('0x9')](),controller[_0xf9e8('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf9e8('0x16')]);module[_0xf9e8('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b66f3e9..d7ffeea 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1b7ea6,_0x195a62){_0x1b7ea6=_0x1b7ea6-0x0;var _0x4fcea6=_0x0b0e[_0x1b7ea6];return _0x4fcea6;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23c262,_0x74765a){_0x23c262=_0x23c262-0x0;var _0x9b913f=_0x0b0e[_0x23c262];return _0x9b913f;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1be9ec2..8b5c159 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(_0x3be445,_0x128238){var _0x3164be=function(_0x2befa8){while(--_0x2befa8){_0x3be445['push'](_0x3be445['shift']());}};_0x3164be(++_0x128238);}(_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){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(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x7a54,0x106));var _0x47a5=function(_0x26a901,_0x2da806){_0x26a901=_0x26a901-0x0;var _0x329bb6=_0x7a54[_0x26a901];return _0x329bb6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 7e5ae79..6675bd1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc180=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5941b7,_0x499160){var _0x2ae4df=function(_0x17a9d5){while(--_0x17a9d5){_0x5941b7['push'](_0x5941b7['shift']());}};_0x2ae4df(++_0x499160);}(_0xc180,0x15e));var _0x0c18=function(_0x19eb97,_0x51577a){_0x19eb97=_0x19eb97-0x0;var _0x4e9cb1=_0xc180[_0x19eb97];return _0x4e9cb1;};'use strict';var EventEmitter=require(_0x0c18('0x0'));var ChatOfflineMessage=require(_0x0c18('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c18('0x2'),'afterUpdate':_0x0c18('0x3'),'afterDestroy':_0x0c18('0x4')};function emitEvent(_0x3a3555){return function(_0x1f1e41,_0x548a9f,_0x395055){ChatOfflineMessageEvents[_0x0c18('0x5')](_0x3a3555+':'+_0x1f1e41['id'],_0x1f1e41);ChatOfflineMessageEvents[_0x0c18('0x5')](_0x3a3555,_0x1f1e41);_0x395055(null);};}for(var e in events){if(events[_0x0c18('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x0c18('0x7')](e,emitEvent(event));}}module[_0x0c18('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8ae5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0x8ae5,0xab));var _0x58ae=function(_0x44057a,_0x31e227){_0x44057a=_0x44057a-0x0;var _0x5859db=_0x8ae5[_0x44057a];return _0x5859db;};'use strict';var EventEmitter=require(_0x58ae('0x0'));var ChatOfflineMessage=require(_0x58ae('0x1'))['db'][_0x58ae('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x58ae('0x3')](0x0);var events={'afterCreate':_0x58ae('0x4'),'afterUpdate':_0x58ae('0x5'),'afterDestroy':_0x58ae('0x6')};function emitEvent(_0x736589){return function(_0x464fbb,_0x898c59,_0x1e9111){ChatOfflineMessageEvents[_0x58ae('0x7')](_0x736589+':'+_0x464fbb['id'],_0x464fbb);ChatOfflineMessageEvents[_0x58ae('0x7')](_0x736589,_0x464fbb);_0x1e9111(null);};}for(var e in events){if(events[_0x58ae('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x58ae('0x9')](e,emitEvent(event));}}module[_0x58ae('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b6fdc97..ed0ff5d 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 _0xc2d6=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','define'];(function(_0x64e24d,_0x1bfab5){var _0x2f8b96=function(_0xce26e1){while(--_0xce26e1){_0x64e24d['push'](_0x64e24d['shift']());}};_0x2f8b96(++_0x1bfab5);}(_0xc2d6,0x1cf));var _0x6c2d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc2d6[_0xefd519];return _0x4bb882;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x4798ec){return _0x4798ec[_0x6c2d('0x0')]('ChatOfflineMessage',attributes,{'tableName':_0x6c2d('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c2d('0x2'),'collate':_0x6c2d('0x3')});}; \ No newline at end of file +var _0x385e=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4'];(function(_0x37357f,_0x3b23bb){var _0x505ef9=function(_0x42df61){while(--_0x42df61){_0x37357f['push'](_0x37357f['shift']());}};_0x505ef9(++_0x3b23bb);}(_0x385e,0x1b7));var _0xe385=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x385e[_0x412342];return _0x3e62cb;};'use strict';var attributes=require(_0xe385('0x0'));module[_0xe385('0x1')]=function(_0x4e12e9){return _0x4e12e9[_0xe385('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xe385('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe385('0x4'),'collate':_0xe385('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ebc2050..114de60 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 _0x3525=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','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'];(function(_0x2132c0,_0xbc40a8){var _0x364b5b=function(_0x8ba567){while(--_0x8ba567){_0x2132c0['push'](_0x2132c0['shift']());}};_0x364b5b(++_0xbc40a8);}(_0x3525,0x143));var _0x5352=function(_0x1e76fd,_0x25167d){_0x1e76fd=_0x1e76fd-0x0;var _0x2e7572=_0x3525[_0x1e76fd];return _0x2e7572;};'use strict';var _=require(_0x5352('0x0'));var util=require(_0x5352('0x1'));var moment=require(_0x5352('0x2'));var BPromise=require(_0x5352('0x3'));var rs=require(_0x5352('0x4'));var fs=require('fs');var Redis=require(_0x5352('0x5'));var db=require(_0x5352('0x6'))['db'];var utils=require(_0x5352('0x7'));var logger=require('../../config/logger')(_0x5352('0x8'));var config=require(_0x5352('0x9'));var jayson=require(_0x5352('0xa'));var client=jayson[_0x5352('0xb')][_0x5352('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a6f6f,_0x5b1065,_0x11cbbc){return new BPromise(function(_0x9d74dc,_0x4bd764){return client[_0x5352('0xd')](_0x3a6f6f,_0x11cbbc)[_0x5352('0xe')](function(_0x4f6fb2){logger[_0x5352('0xf')](_0x5352('0x10'),_0x5b1065,_0x5352('0x11'));logger[_0x5352('0x12')](_0x5352('0x13'),_0x5b1065,_0x5352('0x11'),JSON['stringify'](_0x4f6fb2));if(_0x4f6fb2[_0x5352('0x14')]){if(_0x4f6fb2[_0x5352('0x14')][_0x5352('0x15')]===0x1f4){logger[_0x5352('0x14')](_0x5352('0x10'),_0x5b1065,_0x4f6fb2['error']['message']);return _0x4bd764(_0x4f6fb2[_0x5352('0x14')][_0x5352('0x16')]);}logger[_0x5352('0x14')](_0x5352('0x10'),_0x5b1065,_0x4f6fb2['error'][_0x5352('0x16')]);return _0x9d74dc(_0x4f6fb2['error'][_0x5352('0x16')]);}else{logger[_0x5352('0xf')](_0x5352('0x10'),_0x5b1065,_0x5352('0x11'));_0x9d74dc(_0x4f6fb2[_0x5352('0x17')][_0x5352('0x16')]);}})[_0x5352('0x18')](function(_0xd14043){logger[_0x5352('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5b1065,_0xd14043);_0x4bd764(_0xd14043);});});} \ No newline at end of file +var _0xe3f6=['stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4fac01,_0x58c00a){var _0x1db7ba=function(_0x4f4f19){while(--_0x4f4f19){_0x4fac01['push'](_0x4fac01['shift']());}};_0x1db7ba(++_0x58c00a);}(_0xe3f6,0x9e));var _0x6e3f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe3f6[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x6e3f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e3f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e3f('0x2'))['db'];var utils=require(_0x6e3f('0x3'));var logger=require(_0x6e3f('0x4'))(_0x6e3f('0x5'));var config=require(_0x6e3f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e3f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f7bf1,_0x5b0791,_0x3b8c01){return new BPromise(function(_0x32f8ac,_0xe49409){return client[_0x6e3f('0x8')](_0x4f7bf1,_0x3b8c01)['then'](function(_0x2307e9){logger['info'](_0x6e3f('0x9'),_0x5b0791,_0x6e3f('0xa'));logger[_0x6e3f('0xb')](_0x6e3f('0xc'),_0x5b0791,_0x6e3f('0xa'),JSON[_0x6e3f('0xd')](_0x2307e9));if(_0x2307e9[_0x6e3f('0xe')]){if(_0x2307e9[_0x6e3f('0xe')][_0x6e3f('0xf')]===0x1f4){logger[_0x6e3f('0xe')](_0x6e3f('0x9'),_0x5b0791,_0x2307e9[_0x6e3f('0xe')][_0x6e3f('0x10')]);return _0xe49409(_0x2307e9[_0x6e3f('0xe')][_0x6e3f('0x10')]);}logger[_0x6e3f('0xe')](_0x6e3f('0x9'),_0x5b0791,_0x2307e9[_0x6e3f('0xe')][_0x6e3f('0x10')]);return _0x32f8ac(_0x2307e9['error'][_0x6e3f('0x10')]);}else{logger['info'](_0x6e3f('0x9'),_0x5b0791,_0x6e3f('0xa'));_0x32f8ac(_0x2307e9[_0x6e3f('0x11')][_0x6e3f('0x10')]);}})[_0x6e3f('0x12')](function(_0x1826af){logger[_0x6e3f('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5b0791,_0x1826af);_0xe49409(_0x1826af);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 18d0567..cd35c59 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 _0xd700=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x305792,_0x491a61){var _0x394535=function(_0x32230a){while(--_0x32230a){_0x305792['push'](_0x305792['shift']());}};_0x394535(++_0x491a61);}(_0xd700,0x1b5));var _0x0d70=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xd700[_0xe0b81f];return _0x290e5e;};'use strict';var multer=require(_0x0d70('0x0'));var util=require(_0x0d70('0x1'));var path=require(_0x0d70('0x2'));var timeout=require(_0x0d70('0x3'));var express=require(_0x0d70('0x4'));var router=express[_0x0d70('0x5')]();var fs_extra=require(_0x0d70('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0d70('0x7'));var config=require(_0x0d70('0x8'));var controller=require(_0x0d70('0x9'));router[_0x0d70('0xa')]('/',auth[_0x0d70('0xb')](),controller[_0x0d70('0xc')]);router[_0x0d70('0xa')](_0x0d70('0xd'),auth[_0x0d70('0xb')](),controller[_0x0d70('0xe')]);router[_0x0d70('0xa')](_0x0d70('0xf'),auth[_0x0d70('0xb')](),controller[_0x0d70('0x10')]);router[_0x0d70('0x11')]('/',auth[_0x0d70('0xb')](),controller['create']);router[_0x0d70('0x12')](_0x0d70('0xf'),auth[_0x0d70('0xb')](),controller[_0x0d70('0x13')]);router[_0x0d70('0x14')](_0x0d70('0xf'),auth[_0x0d70('0xb')](),controller[_0x0d70('0x15')]);module[_0x0d70('0x16')]=router; \ No newline at end of file +var _0x99f1=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x552c4b,_0xce95ce){var _0x3f54f5=function(_0x3effaf){while(--_0x3effaf){_0x552c4b['push'](_0x552c4b['shift']());}};_0x3f54f5(++_0xce95ce);}(_0x99f1,0x1ce));var _0x199f=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x99f1[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require('multer');var util=require(_0x199f('0x0'));var path=require(_0x199f('0x1'));var timeout=require(_0x199f('0x2'));var express=require('express');var router=express[_0x199f('0x3')]();var fs_extra=require(_0x199f('0x4'));var auth=require(_0x199f('0x5'));var interaction=require(_0x199f('0x6'));var config=require('../../config/environment');var controller=require(_0x199f('0x7'));router[_0x199f('0x8')]('/',auth[_0x199f('0x9')](),controller[_0x199f('0xa')]);router[_0x199f('0x8')](_0x199f('0xb'),auth[_0x199f('0x9')](),controller[_0x199f('0xc')]);router['get'](_0x199f('0xd'),auth['isAuthenticated'](),controller[_0x199f('0xe')]);router[_0x199f('0xf')]('/',auth[_0x199f('0x9')](),controller[_0x199f('0x10')]);router[_0x199f('0x11')](_0x199f('0xd'),auth[_0x199f('0x9')](),controller[_0x199f('0x12')]);router['delete'](_0x199f('0xd'),auth['isAuthenticated'](),controller[_0x199f('0x13')]);module[_0x199f('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 92b64d3..267719c 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 _0xe88f=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x511282,_0x57a251){var _0x26a59a=function(_0xc13ec4){while(--_0xc13ec4){_0x511282['push'](_0x511282['shift']());}};_0x26a59a(++_0x57a251);}(_0xe88f,0x8c));var _0xfe88=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0xe88f[_0x3825a8];return _0xabc9bc;};'use strict';var Sequelize=require(_0xfe88('0x0'));module[_0xfe88('0x1')]={'name':{'type':Sequelize[_0xfe88('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfe88('0x3')](_0xfe88('0x4'),_0xfe88('0x5')),'defaultValue':_0xfe88('0x4')},'selector':{'type':Sequelize[_0xfe88('0x2')]},'timeout':{'type':Sequelize[_0xfe88('0x6')]}}; \ No newline at end of file +var _0x3f97=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x2786d9,_0x333eb5){var _0x34fb80=function(_0x8aa31){while(--_0x8aa31){_0x2786d9['push'](_0x2786d9['shift']());}};_0x34fb80(++_0x333eb5);}(_0x3f97,0xd1));var _0x73f9=function(_0x1a8b10,_0x2cd934){_0x1a8b10=_0x1a8b10-0x0;var _0x167aa4=_0x3f97[_0x1a8b10];return _0x167aa4;};'use strict';var Sequelize=require('sequelize');module[_0x73f9('0x0')]={'name':{'type':Sequelize[_0x73f9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x73f9('0x2')](_0x73f9('0x3'),_0x73f9('0x4')),'defaultValue':_0x73f9('0x3')},'selector':{'type':Sequelize[_0x73f9('0x1')]},'timeout':{'type':Sequelize[_0x73f9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5f97a7f..4afcfd1 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 _0x3981=['send','show','ChatProactiveAction','rawAttributes','query','filters','attributes','model','fields','length','include','merge','options','find','catch','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','stack'];(function(_0xf1603b,_0x257c11){var _0x298fab=function(_0x5a96fd){while(--_0x5a96fd){_0xf1603b['push'](_0xf1603b['shift']());}};_0x298fab(++_0x257c11);}(_0x3981,0x144));var _0x1398=function(_0x8c9834,_0x3056c4){_0x8c9834=_0x8c9834-0x0;var _0x522e08=_0x3981[_0x8c9834];return _0x522e08;};'use strict';var emlformat=require(_0x1398('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1398('0x1'));var jsonpatch=require(_0x1398('0x2'));var rp=require(_0x1398('0x3'));var moment=require(_0x1398('0x4'));var BPromise=require(_0x1398('0x5'));var Mustache=require(_0x1398('0x6'));var util=require(_0x1398('0x7'));var path=require(_0x1398('0x8'));var sox=require(_0x1398('0x9'));var csv=require(_0x1398('0xa'));var ejs=require(_0x1398('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1398('0xc'));var squel=require(_0x1398('0xd'));var crypto=require(_0x1398('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1398('0xf'));var toCsv=require(_0x1398('0xa'));var querystring=require(_0x1398('0x10'));var Papa=require(_0x1398('0x11'));var Redis=require(_0x1398('0x12'));var authService=require(_0x1398('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1398('0x14'));var hardwareService=require(_0x1398('0x15'));var logger=require(_0x1398('0x16'))(_0x1398('0x17'));var utils=require(_0x1398('0x18'));var config=require(_0x1398('0x19'));var licenseUtil=require(_0x1398('0x1a'));var db=require(_0x1398('0x1b'))['db'];function respondWithStatusCode(_0x4460a6,_0x31b5bf){_0x31b5bf=_0x31b5bf||0xcc;return function(_0x5f37ac){if(_0x5f37ac){return _0x4460a6[_0x1398('0x1c')](_0x31b5bf);}return _0x4460a6[_0x1398('0x1d')](_0x31b5bf)[_0x1398('0x1e')]();};}function respondWithResult(_0xa9ef49,_0x49424a){_0x49424a=_0x49424a||0xc8;return function(_0x4d8a1a){if(_0x4d8a1a){return _0xa9ef49['status'](_0x49424a)[_0x1398('0x1f')](_0x4d8a1a);}};}function respondWithFilteredResult(_0x5cd5aa,_0x51ad37){return function(_0x514216){if(_0x514216){var _0x2afbd6=typeof _0x51ad37['offset']===_0x1398('0x20')&&typeof _0x51ad37[_0x1398('0x21')]===_0x1398('0x20');var _0x382319=_0x514216[_0x1398('0x22')];var _0x579fd2=_0x2afbd6?0x0:_0x51ad37[_0x1398('0x23')];var _0x5531bc=_0x2afbd6?_0x514216['count']:_0x51ad37[_0x1398('0x23')]+_0x51ad37['limit'];var _0x57fce1;if(_0x5531bc>=_0x382319){_0x5531bc=_0x382319;_0x57fce1=0xc8;}else{_0x57fce1=0xce;}_0x5cd5aa[_0x1398('0x1d')](_0x57fce1);return _0x5cd5aa[_0x1398('0x24')]('Content-Range',_0x579fd2+'-'+_0x5531bc+'/'+_0x382319)[_0x1398('0x1f')](_0x514216);}return null;};}function patchUpdates(_0x146357){return function(_0x268fc5){try{jsonpatch[_0x1398('0x25')](_0x268fc5,_0x146357,!![]);}catch(_0xcd19c1){return BPromise[_0x1398('0x26')](_0xcd19c1);}return _0x268fc5['save']();};}function saveUpdates(_0x5c1d68,_0x58e886){return function(_0x5dcedc){if(_0x5dcedc){return _0x5dcedc[_0x1398('0x27')](_0x5c1d68)[_0x1398('0x28')](function(_0x5029d4){return _0x5029d4;});}return null;};}function removeEntity(_0x3e4cfa,_0x929d8a){return function(_0x45b78a){if(_0x45b78a){return _0x45b78a['destroy']()[_0x1398('0x28')](function(){_0x3e4cfa[_0x1398('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb54964,_0x340d90){return function(_0x41c42c){if(!_0x41c42c){_0xb54964[_0x1398('0x1c')](0x194);}return _0x41c42c;};}function handleError(_0x50d3cf,_0x5edfdd){_0x5edfdd=_0x5edfdd||0x1f4;return function(_0x2b73e7){logger['error'](_0x2b73e7[_0x1398('0x29')]);if(_0x2b73e7['name']){delete _0x2b73e7['name'];}_0x50d3cf['status'](_0x5edfdd)[_0x1398('0x2a')](_0x2b73e7);};}exports[_0x1398('0x2b')]=function(_0x76bd5,_0x2c8d2b){var _0x24965c={'raw':!![],'where':{'id':_0x76bd5['params']['id']}},_0x2fd175={};_0x2fd175['model']=_['keys'](db[_0x1398('0x2c')][_0x1398('0x2d')]);_0x2fd175[_0x1398('0x2e')]=_['keys'](_0x76bd5[_0x1398('0x2e')]);_0x2fd175[_0x1398('0x2f')]=_['intersection'](_0x2fd175['model'],_0x2fd175['query']);_0x24965c[_0x1398('0x30')]=_['intersection'](_0x2fd175[_0x1398('0x31')],qs[_0x1398('0x32')](_0x76bd5[_0x1398('0x2e')][_0x1398('0x32')]));_0x24965c[_0x1398('0x30')]=_0x24965c['attributes'][_0x1398('0x33')]?_0x24965c[_0x1398('0x30')]:_0x2fd175['model'];if(_0x76bd5[_0x1398('0x2e')]['includeAll']){_0x24965c[_0x1398('0x34')]=[{'all':!![]}];}_0x24965c=_[_0x1398('0x35')]({},_0x24965c,_0x76bd5[_0x1398('0x36')]);return db[_0x1398('0x2c')][_0x1398('0x37')](_0x24965c)['then'](handleEntityNotFound(_0x2c8d2b,null))['then'](respondWithResult(_0x2c8d2b,null))[_0x1398('0x38')](handleError(_0x2c8d2b,null));};exports[_0x1398('0x39')]=function(_0x511276,_0x4b9cfa){return db['ChatProactiveAction'][_0x1398('0x39')](_0x511276['body'],{})[_0x1398('0x28')](respondWithResult(_0x4b9cfa,0xc9))['catch'](handleError(_0x4b9cfa,null));};exports[_0x1398('0x27')]=function(_0x5b4a65,_0xab4136){if(_0x5b4a65[_0x1398('0x3a')]['id']){delete _0x5b4a65[_0x1398('0x3a')]['id'];}return db[_0x1398('0x2c')][_0x1398('0x37')]({'where':{'id':_0x5b4a65[_0x1398('0x3b')]['id']}})[_0x1398('0x28')](handleEntityNotFound(_0xab4136,null))[_0x1398('0x28')](saveUpdates(_0x5b4a65[_0x1398('0x3a')],null))[_0x1398('0x28')](respondWithResult(_0xab4136,null))[_0x1398('0x38')](handleError(_0xab4136,null));};exports[_0x1398('0x3c')]=function(_0x59caea,_0x20ec32){return db[_0x1398('0x2c')][_0x1398('0x37')]({'where':{'id':_0x59caea['params']['id']}})[_0x1398('0x28')](handleEntityNotFound(_0x20ec32,null))['then'](removeEntity(_0x20ec32,null))[_0x1398('0x38')](handleError(_0x20ec32,null));}; \ No newline at end of file +var _0x48e3=['bluebird','mustache','util','path','to-csv','lodash','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','end','status','offset','limit','count','set','Content-Range','json','apply','save','then','destroy','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','ChatProactiveAction','update','body','params','eml-format','rimraf','fast-json-patch'];(function(_0x3ba721,_0x5b8f13){var _0x3a3244=function(_0x5f4c29){while(--_0x5f4c29){_0x3ba721['push'](_0x3ba721['shift']());}};_0x3a3244(++_0x5b8f13);}(_0x48e3,0xe9));var _0x348e=function(_0x268fdd,_0x46b228){_0x268fdd=_0x268fdd-0x0;var _0x5ce50c=_0x48e3[_0x268fdd];return _0x5ce50c;};'use strict';var emlformat=require(_0x348e('0x0'));var rimraf=require(_0x348e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x348e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x348e('0x3'));var Mustache=require(_0x348e('0x4'));var util=require(_0x348e('0x5'));var path=require(_0x348e('0x6'));var sox=require('sox');var csv=require(_0x348e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x348e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x348e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x348e('0x7'));var querystring=require(_0x348e('0xa'));var Papa=require(_0x348e('0xb'));var Redis=require(_0x348e('0xc'));var authService=require(_0x348e('0xd'));var qs=require(_0x348e('0xe'));var as=require(_0x348e('0xf'));var hardwareService=require(_0x348e('0x10'));var logger=require(_0x348e('0x11'))(_0x348e('0x12'));var utils=require(_0x348e('0x13'));var config=require(_0x348e('0x14'));var licenseUtil=require(_0x348e('0x15'));var db=require(_0x348e('0x16'))['db'];function respondWithStatusCode(_0x57c341,_0x2ba049){_0x2ba049=_0x2ba049||0xcc;return function(_0x271fe7){if(_0x271fe7){return _0x57c341[_0x348e('0x17')](_0x2ba049);}return _0x57c341['status'](_0x2ba049)[_0x348e('0x18')]();};}function respondWithResult(_0x3031ee,_0x23865f){_0x23865f=_0x23865f||0xc8;return function(_0x246a85){if(_0x246a85){return _0x3031ee[_0x348e('0x19')](_0x23865f)['json'](_0x246a85);}};}function respondWithFilteredResult(_0x5169aa,_0x718b84){return function(_0x9cf0b8){if(_0x9cf0b8){var _0x1f9e74=typeof _0x718b84[_0x348e('0x1a')]==='undefined'&&typeof _0x718b84[_0x348e('0x1b')]==='undefined';var _0x217857=_0x9cf0b8[_0x348e('0x1c')];var _0x409ea8=_0x1f9e74?0x0:_0x718b84['offset'];var _0x2326bc=_0x1f9e74?_0x9cf0b8['count']:_0x718b84['offset']+_0x718b84['limit'];var _0x5eca68;if(_0x2326bc>=_0x217857){_0x2326bc=_0x217857;_0x5eca68=0xc8;}else{_0x5eca68=0xce;}_0x5169aa[_0x348e('0x19')](_0x5eca68);return _0x5169aa[_0x348e('0x1d')](_0x348e('0x1e'),_0x409ea8+'-'+_0x2326bc+'/'+_0x217857)[_0x348e('0x1f')](_0x9cf0b8);}return null;};}function patchUpdates(_0x3a5907){return function(_0x3d1ae3){try{jsonpatch[_0x348e('0x20')](_0x3d1ae3,_0x3a5907,!![]);}catch(_0x5c631d){return BPromise['reject'](_0x5c631d);}return _0x3d1ae3[_0x348e('0x21')]();};}function saveUpdates(_0x33600d,_0x2225d0){return function(_0xa0917f){if(_0xa0917f){return _0xa0917f['update'](_0x33600d)[_0x348e('0x22')](function(_0x45c4a9){return _0x45c4a9;});}return null;};}function removeEntity(_0x1c0caa,_0x4a5a84){return function(_0x116583){if(_0x116583){return _0x116583[_0x348e('0x23')]()[_0x348e('0x22')](function(){_0x1c0caa['status'](0xcc)[_0x348e('0x18')]();});}};}function handleEntityNotFound(_0x845e7f,_0x2519f3){return function(_0x49ba87){if(!_0x49ba87){_0x845e7f[_0x348e('0x17')](0x194);}return _0x49ba87;};}function handleError(_0x6f72c4,_0x1a987a){_0x1a987a=_0x1a987a||0x1f4;return function(_0x23bed7){logger['error'](_0x23bed7[_0x348e('0x24')]);if(_0x23bed7[_0x348e('0x25')]){delete _0x23bed7[_0x348e('0x25')];}_0x6f72c4[_0x348e('0x19')](_0x1a987a)[_0x348e('0x26')](_0x23bed7);};}exports[_0x348e('0x27')]=function(_0xcf5f40,_0x487784){var _0x37d892={'raw':!![],'where':{'id':_0xcf5f40['params']['id']}},_0xcf7f99={};_0xcf7f99[_0x348e('0x28')]=_[_0x348e('0x29')](db['ChatProactiveAction'][_0x348e('0x2a')]);_0xcf7f99[_0x348e('0x2b')]=_['keys'](_0xcf5f40[_0x348e('0x2b')]);_0xcf7f99[_0x348e('0x2c')]=_[_0x348e('0x2d')](_0xcf7f99[_0x348e('0x28')],_0xcf7f99[_0x348e('0x2b')]);_0x37d892[_0x348e('0x2e')]=_[_0x348e('0x2d')](_0xcf7f99['model'],qs['fields'](_0xcf5f40['query'][_0x348e('0x2f')]));_0x37d892[_0x348e('0x2e')]=_0x37d892[_0x348e('0x2e')]['length']?_0x37d892[_0x348e('0x2e')]:_0xcf7f99['model'];if(_0xcf5f40['query'][_0x348e('0x30')]){_0x37d892[_0x348e('0x31')]=[{'all':!![]}];}_0x37d892=_[_0x348e('0x32')]({},_0x37d892,_0xcf5f40[_0x348e('0x33')]);return db['ChatProactiveAction'][_0x348e('0x34')](_0x37d892)[_0x348e('0x22')](handleEntityNotFound(_0x487784,null))[_0x348e('0x22')](respondWithResult(_0x487784,null))[_0x348e('0x35')](handleError(_0x487784,null));};exports[_0x348e('0x36')]=function(_0x3a3b2c,_0x3e769c){return db[_0x348e('0x37')]['create'](_0x3a3b2c['body'],{})[_0x348e('0x22')](respondWithResult(_0x3e769c,0xc9))[_0x348e('0x35')](handleError(_0x3e769c,null));};exports[_0x348e('0x38')]=function(_0x900473,_0x405e6e){if(_0x900473[_0x348e('0x39')]['id']){delete _0x900473['body']['id'];}return db[_0x348e('0x37')][_0x348e('0x34')]({'where':{'id':_0x900473[_0x348e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x405e6e,null))[_0x348e('0x22')](saveUpdates(_0x900473[_0x348e('0x39')],null))[_0x348e('0x22')](respondWithResult(_0x405e6e,null))[_0x348e('0x35')](handleError(_0x405e6e,null));};exports[_0x348e('0x23')]=function(_0x326b50,_0x40d487){return db['ChatProactiveAction'][_0x348e('0x34')]({'where':{'id':_0x326b50[_0x348e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40d487,null))[_0x348e('0x22')](removeEntity(_0x40d487,null))[_0x348e('0x35')](handleError(_0x40d487,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e3a059c..1116cf4 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 _0x643c=['path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','request-promise'];(function(_0x51dd2c,_0x2a2345){var _0x41c678=function(_0xa14c31){while(--_0xa14c31){_0x51dd2c['push'](_0x51dd2c['shift']());}};_0x41c678(++_0x2a2345);}(_0x643c,0x8b));var _0xc643=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x643c[_0x35027c];return _0x4bba7d;};'use strict';var _=require('lodash');var util=require(_0xc643('0x0'));var logger=require(_0xc643('0x1'))('api');var moment=require(_0xc643('0x2'));var BPromise=require('bluebird');var rp=require(_0xc643('0x3'));var fs=require('fs');var path=require(_0xc643('0x4'));var rimraf=require('rimraf');var config=require(_0xc643('0x5'));var attributes=require(_0xc643('0x6'));module[_0xc643('0x7')]=function(_0x37656c,_0x646755){return _0x37656c[_0xc643('0x8')](_0xc643('0x9'),attributes,{'tableName':_0xc643('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032a=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x032a,0xfe));var _0xa032=function(_0x5c6c64,_0x12d4cb){_0x5c6c64=_0x5c6c64-0x0;var _0x172174=_0x032a[_0x5c6c64];return _0x172174;};'use strict';var _=require(_0xa032('0x0'));var util=require(_0xa032('0x1'));var logger=require(_0xa032('0x2'))(_0xa032('0x3'));var moment=require(_0xa032('0x4'));var BPromise=require(_0xa032('0x5'));var rp=require(_0xa032('0x6'));var fs=require('fs');var path=require(_0xa032('0x7'));var rimraf=require(_0xa032('0x8'));var config=require(_0xa032('0x9'));var attributes=require(_0xa032('0xa'));module['exports']=function(_0x529494,_0xc8a2b6){return _0x529494[_0xa032('0xb')](_0xa032('0xc'),attributes,{'tableName':_0xa032('0xd'),'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 969a509..7ffbebd 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 _0x886b=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3ce25d,_0x5d873a){var _0x3fa872=function(_0x149cf3){while(--_0x149cf3){_0x3ce25d['push'](_0x3ce25d['shift']());}};_0x3fa872(++_0x5d873a);}(_0x886b,0x1ca));var _0xb886=function(_0x2b54d9,_0x5e4a14){_0x2b54d9=_0x2b54d9-0x0;var _0x47f39b=_0x886b[_0x2b54d9];return _0x47f39b;};'use strict';var _=require(_0xb886('0x0'));var util=require(_0xb886('0x1'));var moment=require(_0xb886('0x2'));var BPromise=require(_0xb886('0x3'));var rs=require(_0xb886('0x4'));var fs=require('fs');var Redis=require(_0xb886('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb886('0x6'));var logger=require('../../config/logger')(_0xb886('0x7'));var config=require(_0xb886('0x8'));var jayson=require(_0xb886('0x9'));var client=jayson[_0xb886('0xa')][_0xb886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100662,_0x136a70,_0x5651dc){return new BPromise(function(_0x163a90,_0x9f2714){return client[_0xb886('0xc')](_0x100662,_0x5651dc)['then'](function(_0x3f747a){logger[_0xb886('0xd')](_0xb886('0xe'),_0x136a70,_0xb886('0xf'));logger[_0xb886('0x10')](_0xb886('0x11'),_0x136a70,_0xb886('0xf'),JSON[_0xb886('0x12')](_0x3f747a));if(_0x3f747a[_0xb886('0x13')]){if(_0x3f747a['error'][_0xb886('0x14')]===0x1f4){logger[_0xb886('0x13')](_0xb886('0xe'),_0x136a70,_0x3f747a[_0xb886('0x13')]['message']);return _0x9f2714(_0x3f747a[_0xb886('0x13')][_0xb886('0x15')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x136a70,_0x3f747a[_0xb886('0x13')][_0xb886('0x15')]);return _0x163a90(_0x3f747a[_0xb886('0x13')][_0xb886('0x15')]);}else{logger[_0xb886('0xd')](_0xb886('0xe'),_0x136a70,_0xb886('0xf'));_0x163a90(_0x3f747a['result']['message']);}})[_0xb886('0x16')](function(_0x52f7e6){logger[_0xb886('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x136a70,_0x52f7e6);_0x9f2714(_0x52f7e6);});});} \ No newline at end of file +var _0xf0a0=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2ed3ea,_0x1669e1){var _0x33a347=function(_0x5b69f7){while(--_0x5b69f7){_0x2ed3ea['push'](_0x2ed3ea['shift']());}};_0x33a347(++_0x1669e1);}(_0xf0a0,0x178));var _0x0f0a=function(_0x5c128e,_0x3d5149){_0x5c128e=_0x5c128e-0x0;var _0x3951d6=_0xf0a0[_0x5c128e];return _0x3951d6;};'use strict';var _=require(_0x0f0a('0x0'));var util=require('util');var moment=require(_0x0f0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f0a('0x2'));var fs=require('fs');var Redis=require(_0x0f0a('0x3'));var db=require(_0x0f0a('0x4'))['db'];var utils=require(_0x0f0a('0x5'));var logger=require('../../config/logger')(_0x0f0a('0x6'));var config=require(_0x0f0a('0x7'));var jayson=require(_0x0f0a('0x8'));var client=jayson[_0x0f0a('0x9')][_0x0f0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb9ff58,_0x36acc2,_0x5795ad){return new BPromise(function(_0x1bfa65,_0x24409d){return client[_0x0f0a('0xb')](_0xb9ff58,_0x5795ad)['then'](function(_0x198aba){logger[_0x0f0a('0xc')](_0x0f0a('0xd'),_0x36acc2,_0x0f0a('0xe'));logger[_0x0f0a('0xf')](_0x0f0a('0x10'),_0x36acc2,'request\x20sent',JSON[_0x0f0a('0x11')](_0x198aba));if(_0x198aba[_0x0f0a('0x12')]){if(_0x198aba['error']['code']===0x1f4){logger[_0x0f0a('0x12')](_0x0f0a('0xd'),_0x36acc2,_0x198aba[_0x0f0a('0x12')][_0x0f0a('0x13')]);return _0x24409d(_0x198aba[_0x0f0a('0x12')][_0x0f0a('0x13')]);}logger['error'](_0x0f0a('0xd'),_0x36acc2,_0x198aba[_0x0f0a('0x12')][_0x0f0a('0x13')]);return _0x1bfa65(_0x198aba[_0x0f0a('0x12')][_0x0f0a('0x13')]);}else{logger[_0x0f0a('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x36acc2,_0x0f0a('0xe'));_0x1bfa65(_0x198aba[_0x0f0a('0x14')][_0x0f0a('0x13')]);}})[_0x0f0a('0x15')](function(_0x264bfe){logger['error'](_0x0f0a('0xd'),_0x36acc2,_0x264bfe);_0x24409d(_0x264bfe);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c2af729..d1e5745 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 _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x51c3f7,_0x2bb9d1){var _0x89b734=function(_0x120eb6){while(--_0x120eb6){_0x51c3f7['push'](_0x51c3f7['shift']());}};_0x89b734(++_0x2bb9d1);}(_0xeec6,0x1c2));var _0x6eec=function(_0xe0c564,_0x2ff569){_0xe0c564=_0xe0c564-0x0;var _0x32e0f6=_0xeec6[_0xe0c564];return _0x32e0f6;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file +var _0xae24=['destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x490c02,_0x2faa1b){var _0x4604ab=function(_0x336e0d){while(--_0x336e0d){_0x490c02['push'](_0x490c02['shift']());}};_0x4604ab(++_0x2faa1b);}(_0xae24,0x182));var _0x4ae2=function(_0x2fdbb8,_0x3c304f){_0x2fdbb8=_0x2fdbb8-0x0;var _0xfa5de=_0xae24[_0x2fdbb8];return _0xfa5de;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')](_0x4ae2('0x7'),auth[_0x4ae2('0x8')](),controller[_0x4ae2('0x9')]);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')]('/:id',auth[_0x4ae2('0x8')](),controller[_0x4ae2('0xe')]);module[_0x4ae2('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 107c395..be9a95b 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 _0x8dec=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x8dec,0x13a));var _0xc8de=function(_0x517fc3,_0x384d51){_0x517fc3=_0x517fc3-0x0;var _0xc4a05c=_0x8dec[_0x517fc3];return _0xc4a05c;};'use strict';var Sequelize=require(_0xc8de('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8de('0x1')],'unique':_0xc8de('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8de('0x1')]},'timeout':{'type':Sequelize[_0xc8de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8de('0x4')](_0xc8de('0x5'),'beepall',_0xc8de('0x6'))}}; \ No newline at end of file +var _0x25c5=['ENUM','beepall','sequelize','STRING','name','INTEGER'];(function(_0x2e0fb8,_0x489160){var _0x212b1b=function(_0x2bb946){while(--_0x2bb946){_0x2e0fb8['push'](_0x2e0fb8['shift']());}};_0x212b1b(++_0x489160);}(_0x25c5,0xda));var _0x525c=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x25c5[_0x420d8d];return _0x4865d7;};'use strict';var Sequelize=require(_0x525c('0x0'));module['exports']={'name':{'type':Sequelize[_0x525c('0x1')],'unique':_0x525c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x525c('0x1')]},'timeout':{'type':Sequelize[_0x525c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x525c('0x4')]('rrmemory',_0x525c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ca2f5b0..1d690dc 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 _0x6af3=['localhost','socket.io-emitter','./chatQueue.socket','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','UserProfileResource','status','error','name','send','index','map','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','catch','show','params','keys','model','attributes','intersection','fields','options','find','create','user','get','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','filters','length','nolimit','sort','pick','filter','merge','User','findAndCountAll','UserId','agent','chatPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','Team','order','hasOwnProperty','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','ids','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','value','isEmpty','userChatQueue:remove','addAgents','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','redis'];(function(_0x4c8213,_0x1bda8e){var _0x2af582=function(_0x581e84){while(--_0x581e84){_0x4c8213['push'](_0x4c8213['shift']());}};_0x2af582(++_0x1bda8e);}(_0x6af3,0x14f));var _0x36af=function(_0x25dc3c,_0x17c816){_0x25dc3c=_0x25dc3c-0x0;var _0x1382e3=_0x6af3[_0x25dc3c];return _0x1382e3;};'use strict';var BPromise=require(_0x36af('0x0'));var util=require(_0x36af('0x1'));var _=require(_0x36af('0x2'));var squel=require(_0x36af('0x3'));var Redis=require('ioredis');var qs=require(_0x36af('0x4'));var logger=require(_0x36af('0x5'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x36af('0x6')]=_['defaults'](config['redis'],{'host':_0x36af('0x7'),'port':0x18eb});var socket=require(_0x36af('0x8'))(new Redis(config[_0x36af('0x6')]));require(_0x36af('0x9'))['register'](socket);function respondWithStatusCode(_0x344763,_0x16dd01){_0x16dd01=_0x16dd01||0xcc;return function(_0x590acb){if(_0x590acb){return _0x344763[_0x36af('0xa')](_0x16dd01);}return _0x344763['status'](_0x16dd01)[_0x36af('0xb')]();};}function respondWithResult(_0x4395af,_0x2afc41){_0x2afc41=_0x2afc41||0xc8;return function(_0x1bd821){if(_0x1bd821){return _0x4395af['status'](_0x2afc41)[_0x36af('0xc')](_0x1bd821);}};}function respondWithFilteredResult(_0x2e97f9,_0x23c5d7){return function(_0x282636){if(_0x282636){var _0x5359c7=typeof _0x23c5d7[_0x36af('0xd')]===_0x36af('0xe')&&typeof _0x23c5d7[_0x36af('0xf')]==='undefined';var _0xf759ad=_0x282636[_0x36af('0x10')];var _0x4558bb=_0x5359c7?0x0:_0x23c5d7[_0x36af('0xd')];var _0x54b8e8=_0x5359c7?_0x282636[_0x36af('0x10')]:_0x23c5d7[_0x36af('0xd')]+_0x23c5d7[_0x36af('0xf')];var _0x11395d;if(_0x54b8e8>=_0xf759ad){_0x54b8e8=_0xf759ad;_0x11395d=0xc8;}else{_0x11395d=0xce;}_0x2e97f9['status'](_0x11395d);return _0x2e97f9[_0x36af('0x11')](_0x36af('0x12'),_0x4558bb+'-'+_0x54b8e8+'/'+_0xf759ad)[_0x36af('0xc')](_0x282636);}return null;};}function saveUpdates(_0x319bb9){return function(_0x1aa42e){if(_0x1aa42e){return _0x1aa42e['update'](_0x319bb9)[_0x36af('0x13')](function(_0x27d00f){return _0x27d00f;});}return null;};}function removeEntity(_0x2b8b83){return function(_0x258b93){if(_0x258b93){return _0x258b93[_0x36af('0x14')]()[_0x36af('0x13')](function(){var _0x41caf2=_0x258b93['get']({'plain':!![]});var _0x6f0cd='ChatQueues';return db[_0x36af('0x15')][_0x36af('0x14')]({'where':{'type':_0x6f0cd,'resourceId':_0x41caf2['id']}})[_0x36af('0x13')](function(){return _0x258b93;});})[_0x36af('0x13')](function(){_0x2b8b83[_0x36af('0x16')](0xcc)[_0x36af('0xb')]();});}};}function handleEntityNotFound(_0x58933a){return function(_0x34a961){if(!_0x34a961){_0x58933a[_0x36af('0xa')](0x194);}return _0x34a961;};}function handleError(_0x36d729,_0x1b3793){_0x1b3793=_0x1b3793||0x1f4;return function(_0x43c268){logger[_0x36af('0x17')](_0x43c268['stack']);if(_0x43c268['name']){delete _0x43c268[_0x36af('0x18')];}_0x36d729[_0x36af('0x16')](_0x1b3793)[_0x36af('0x19')](_0x43c268);};}exports[_0x36af('0x1a')]=function(_0x5bc534,_0x15729b){var _0x10d8c3={};var _0x52651b={'count':0x0,'rows':[]};var _0x2d269f=_[_0x36af('0x1b')](db['ChatQueue']['rawAttributes'],function(_0x2f3842){return{'name':_0x2f3842[_0x36af('0x1c')],'type':_0x2f3842[_0x36af('0x1d')][_0x36af('0x1e')]};});_0x10d8c3=qs[_0x36af('0x1f')](_0x2d269f,_0x5bc534);var _0x1d77f9={'where':_0x10d8c3[_0x36af('0x20')]};return db[_0x36af('0x21')][_0x36af('0x10')](_0x1d77f9)['then'](function(_0x35927d){_0x52651b[_0x36af('0x10')]=_0x35927d;_0x10d8c3[_0x36af('0x22')]=qs[_0x36af('0x22')](_0x5bc534[_0x36af('0x23')]);return db[_0x36af('0x21')][_0x36af('0x24')](_0x10d8c3);})[_0x36af('0x13')](function(_0x1664a6){_0x52651b['rows']=_0x1664a6;return _0x52651b;})[_0x36af('0x13')](respondWithFilteredResult(_0x15729b,_0x10d8c3))[_0x36af('0x25')](handleError(_0x15729b,null));};exports[_0x36af('0x26')]=function(_0x1dd8e4,_0x98672c){var _0xf3da7f={'raw':!![],'where':{'id':_0x1dd8e4[_0x36af('0x27')]['id']}},_0x3373f9={};_0x3373f9['model']=_[_0x36af('0x28')](db['ChatQueue']['rawAttributes']);_0x3373f9['query']=_[_0x36af('0x28')](_0x1dd8e4[_0x36af('0x23')]);_0x3373f9['filters']=_['intersection'](_0x3373f9[_0x36af('0x29')],_0x3373f9[_0x36af('0x23')]);_0xf3da7f[_0x36af('0x2a')]=_[_0x36af('0x2b')](_0x3373f9[_0x36af('0x29')],qs[_0x36af('0x2c')](_0x1dd8e4[_0x36af('0x23')][_0x36af('0x2c')]));_0xf3da7f[_0x36af('0x2a')]=_0xf3da7f[_0x36af('0x2a')]['length']?_0xf3da7f[_0x36af('0x2a')]:_0x3373f9[_0x36af('0x29')];if(_0x1dd8e4[_0x36af('0x23')]['includeAll']){_0xf3da7f['include']=[{'all':!![]}];}_0xf3da7f=_['merge']({},_0xf3da7f,_0x1dd8e4[_0x36af('0x2d')]);return db[_0x36af('0x21')][_0x36af('0x2e')](_0xf3da7f)[_0x36af('0x13')](handleEntityNotFound(_0x98672c,null))[_0x36af('0x13')](respondWithResult(_0x98672c,null))[_0x36af('0x25')](handleError(_0x98672c,null));};exports[_0x36af('0x2f')]=function(_0x19208a,_0x204015){return db[_0x36af('0x21')]['create'](_0x19208a['body'],{})[_0x36af('0x13')](function(_0x181d21){var _0x2de4b4=_0x19208a[_0x36af('0x30')][_0x36af('0x31')]({'plain':!![]});if(!_0x2de4b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2de4b4[_0x36af('0x32')]===_0x36af('0x30')){var _0x24e459=_0x181d21[_0x36af('0x31')]({'plain':!![]});var _0x355770=_0x36af('0x33');return db[_0x36af('0x34')][_0x36af('0x2e')]({'where':{'name':_0x355770,'userProfileId':_0x2de4b4[_0x36af('0x35')]},'raw':!![]})[_0x36af('0x13')](function(_0x2fa240){if(_0x2fa240&&_0x2fa240[_0x36af('0x36')]===0x0){return db[_0x36af('0x15')][_0x36af('0x2f')]({'name':_0x24e459[_0x36af('0x18')],'resourceId':_0x24e459['id'],'type':_0x2fa240[_0x36af('0x18')],'sectionId':_0x2fa240['id']},{})[_0x36af('0x13')](function(){return _0x181d21;});}else{return _0x181d21;}})[_0x36af('0x25')](function(_0x3d1e36){logger[_0x36af('0x17')](_0x36af('0x37'),_0x3d1e36);throw _0x3d1e36;});}return _0x181d21;})['then'](respondWithResult(_0x204015,0xc9))[_0x36af('0x25')](handleError(_0x204015,null));};exports['update']=function(_0x5dc6c5,_0x5114a6){if(_0x5dc6c5['body']['id']){delete _0x5dc6c5[_0x36af('0x38')]['id'];}return db[_0x36af('0x21')][_0x36af('0x2e')]({'where':{'id':_0x5dc6c5['params']['id']}})[_0x36af('0x13')](handleEntityNotFound(_0x5114a6,null))[_0x36af('0x13')](saveUpdates(_0x5dc6c5[_0x36af('0x38')],null))[_0x36af('0x13')](respondWithResult(_0x5114a6,null))[_0x36af('0x25')](handleError(_0x5114a6,null));};exports[_0x36af('0x14')]=function(_0x46b001,_0x2d69c7){return db['ChatQueue']['find']({'where':{'id':_0x46b001['params']['id']}})[_0x36af('0x13')](handleEntityNotFound(_0x2d69c7,null))[_0x36af('0x13')](removeEntity(_0x2d69c7,null))[_0x36af('0x25')](handleError(_0x2d69c7,null));};exports[_0x36af('0x39')]=function(_0x1255c6,_0x3b74cb){return db[_0x36af('0x21')][_0x36af('0x39')]()['then'](respondWithResult(_0x3b74cb,null))['catch'](handleError(_0x3b74cb,null));};exports[_0x36af('0x3a')]=function(_0x367c11,_0x362d71){var _0x46ba96={'raw':!![],'where':{}},_0x45ad70={},_0x24c491;return db[_0x36af('0x21')][_0x36af('0x3b')]({'where':{'id':_0x367c11['params']['id']}})[_0x36af('0x13')](handleEntityNotFound(_0x362d71,null))[_0x36af('0x13')](function(_0x300ddd){if(_0x300ddd){_0x24c491=_0x300ddd['get']({'plain':!![]});_0x45ad70['model']=_['keys'](db[_0x36af('0x3c')]['rawAttributes']);_0x45ad70[_0x36af('0x23')]=_[_0x36af('0x28')](_0x367c11[_0x36af('0x23')]);_0x45ad70[_0x36af('0x3d')]=_[_0x36af('0x2b')](_0x45ad70[_0x36af('0x29')],_0x45ad70['query']);_0x46ba96[_0x36af('0x2a')]=_['intersection'](_0x45ad70[_0x36af('0x29')],qs[_0x36af('0x2c')](_0x367c11[_0x36af('0x23')][_0x36af('0x2c')]));_0x46ba96[_0x36af('0x2a')]=_0x46ba96[_0x36af('0x2a')][_0x36af('0x3e')]?_0x46ba96[_0x36af('0x2a')]:_0x45ad70[_0x36af('0x29')];if(!_0x367c11[_0x36af('0x23')]['hasOwnProperty'](_0x36af('0x3f'))){_0x46ba96[_0x36af('0xf')]=qs[_0x36af('0xf')](_0x367c11[_0x36af('0x23')]['limit']);_0x46ba96[_0x36af('0xd')]=qs['offset'](_0x367c11[_0x36af('0x23')]['offset']);}_0x46ba96['order']=qs[_0x36af('0x40')](_0x367c11[_0x36af('0x23')][_0x36af('0x40')]);_0x46ba96[_0x36af('0x20')]=qs['filters'](_[_0x36af('0x41')](_0x367c11[_0x36af('0x23')],_0x45ad70['filters']));_0x46ba96[_0x36af('0x20')]['ChatQueueId']=_0x300ddd['id'];if(_0x367c11[_0x36af('0x23')][_0x36af('0x42')]){_0x46ba96[_0x36af('0x20')]=_[_0x36af('0x43')](_0x46ba96['where'],{'$or':_[_0x36af('0x1b')](_0x46ba96[_0x36af('0x2a')],function(_0x266f46){var _0xb59d9f={};_0xb59d9f[_0x266f46]={'$like':'%'+_0x367c11['query']['filter']+'%'};return _0xb59d9f;})});}_0x46ba96=_['merge']({},_0x46ba96,_0x367c11[_0x36af('0x2d')]);return db[_0x36af('0x3c')][_0x36af('0x24')](_0x46ba96);}})[_0x36af('0x13')](function(_0x190721){if(_0x190721){return db[_0x36af('0x44')][_0x36af('0x45')]({'where':{'id':_[_0x36af('0x1b')](_0x190721,_0x36af('0x46')),'role':_0x36af('0x47')},'attributes':['id','name',_0x36af('0x48'),'updatedAt',_0x36af('0x49')]});}})[_0x36af('0x13')](function(_0xd19836){if(_0xd19836){return{'count':_0xd19836[_0x36af('0x10')],'rows':_[_0x36af('0x1b')](_0xd19836[_0x36af('0x4a')],function(_0x3a0b31){return{'membername':_0x3a0b31['name'],'UserId':_0x3a0b31['id'],'queue_name':_0x24c491[_0x36af('0x18')],'ChatQueueId':_0x24c491['id'],'interface':util[_0x36af('0x4b')](_0x36af('0x4c'),'SIP',_0x3a0b31['name']),'penalty':0x0,'paused':_0x3a0b31['chatPause'],'createdAt':_0x3a0b31['createdAt'],'updatedAt':_0x3a0b31[_0x36af('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x36af('0x13')](respondWithFilteredResult(_0x362d71,_0x46ba96))[_0x36af('0x25')](handleError(_0x362d71,null));};exports[_0x36af('0x4e')]=function(_0x5eb893,_0xc56f12){var _0x1170fb={};var _0x11c9e1={};var _0x3ea612;var _0x31c3cf;return db[_0x36af('0x21')][_0x36af('0x3b')]({'where':{'id':_0x5eb893[_0x36af('0x27')]['id']}})[_0x36af('0x13')](handleEntityNotFound(_0xc56f12,null))['then'](function(_0x27b04e){if(_0x27b04e){_0x3ea612=_0x27b04e;_0x11c9e1[_0x36af('0x29')]=_[_0x36af('0x28')](db[_0x36af('0x4f')]['rawAttributes']);_0x11c9e1['query']=_['keys'](_0x5eb893[_0x36af('0x23')]);_0x11c9e1[_0x36af('0x3d')]=_[_0x36af('0x2b')](_0x11c9e1[_0x36af('0x29')],_0x11c9e1[_0x36af('0x23')]);_0x1170fb['attributes']=_[_0x36af('0x2b')](_0x11c9e1[_0x36af('0x29')],qs['fields'](_0x5eb893[_0x36af('0x23')][_0x36af('0x2c')]));_0x1170fb[_0x36af('0x2a')]=_0x1170fb[_0x36af('0x2a')][_0x36af('0x3e')]?_0x1170fb['attributes']:_0x11c9e1[_0x36af('0x29')];_0x1170fb[_0x36af('0x50')]=qs[_0x36af('0x40')](_0x5eb893['query'][_0x36af('0x40')]);_0x1170fb[_0x36af('0x20')]=qs[_0x36af('0x3d')](_[_0x36af('0x41')](_0x5eb893[_0x36af('0x23')],_0x11c9e1['filters']));if(_0x5eb893[_0x36af('0x23')][_0x36af('0x42')]){_0x1170fb[_0x36af('0x20')]=_[_0x36af('0x43')](_0x1170fb['where'],{'$or':_[_0x36af('0x1b')](_0x1170fb[_0x36af('0x2a')],function(_0x225c83){var _0x877a94={};_0x877a94[_0x225c83]={'$like':'%'+_0x5eb893['query'][_0x36af('0x42')]+'%'};return _0x877a94;})});}_0x1170fb=_[_0x36af('0x43')]({},_0x1170fb,_0x5eb893[_0x36af('0x2d')]);return _0x3ea612[_0x36af('0x4e')](_0x1170fb);}})[_0x36af('0x13')](function(_0x3f2956){if(_0x3f2956){_0x31c3cf=_0x3f2956['length'];if(!_0x5eb893['query'][_0x36af('0x51')](_0x36af('0x3f'))){_0x1170fb[_0x36af('0xf')]=qs[_0x36af('0xf')](_0x5eb893[_0x36af('0x23')]['limit']);_0x1170fb[_0x36af('0xd')]=qs[_0x36af('0xd')](_0x5eb893[_0x36af('0x23')][_0x36af('0xd')]);}return _0x3ea612[_0x36af('0x4e')](_0x1170fb);}})[_0x36af('0x13')](function(_0x4deff9){if(_0x4deff9){return _0x4deff9?{'count':_0x31c3cf,'rows':_0x4deff9}:null;}})[_0x36af('0x13')](respondWithResult(_0xc56f12,null))[_0x36af('0x25')](handleError(_0xc56f12,null));};exports[_0x36af('0x52')]=function(_0x30f6d3,_0x3af9b5){var _0x253a98=_0x30f6d3[_0x36af('0x38')]['ids'];return db[_0x36af('0x4f')]['findAll']({'where':{'id':_0x253a98},'attributes':['id'],'include':[{'model':db[_0x36af('0x44')],'as':'Agents','attributes':['id',_0x36af('0x18'),'online',_0x36af('0x53'),_0x36af('0x54')],'raw':!![]}]})['then'](function(_0xea0c5){if(_0xea0c5){var _0xac38fa=_[_0x36af('0x55')](_0xea0c5,function(_0x4932a0){var _0x1cd098=_0x4932a0['get']({'plain':!![]});return _0x1cd098[_0x36af('0x56')];});return db['ChatQueue'][_0x36af('0x2e')]({'where':{'id':_0x30f6d3[_0x36af('0x27')]['id']}})['then'](function(_0x73884b){return db[_0x36af('0x57')][_0x36af('0x58')](function(_0xa60538){return _0x73884b['addTeams'](_0x253a98,{'transaction':_0xa60538})['then'](function(){return BPromise[_0x36af('0x59')](_0xac38fa,function(_0x35e5cc){return db[_0x36af('0x3c')]['findOrCreate']({'where':{'UserId':_0x35e5cc['id'],'ChatQueueId':_0x30f6d3[_0x36af('0x27')]['id']},'transaction':_0xa60538});});})['then'](function(){_0xac38fa[_0x36af('0x5a')](function(_0x288704){socket[_0x36af('0x5b')](_0x36af('0x5c'),{'UserId':_0x288704['id'],'ChatQueueId':_0x73884b['id']});});});});});}})[_0x36af('0x13')](respondWithStatusCode(_0x3af9b5,null))[_0x36af('0x25')](handleError(_0x3af9b5,null));};exports['removeTeams']=function(_0x59dff0,_0x2f9650){return db[_0x36af('0x4f')][_0x36af('0x24')]({'where':{'id':_0x59dff0['query'][_0x36af('0x5d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x36af('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f9650,null))[_0x36af('0x13')](function(_0x578a9e){var _0x3c7ed5=_[_0x36af('0x1b')](_0x578a9e,'id');var _0x98004c=[];var _0x220511=[];var _0x1eb353=squel['select']();_0x1eb353[_0x36af('0x5e')](_0x36af('0x5f'))['from'](_0x36af('0x60'),'tq')[_0x36af('0x61')]('user_has_teams','ut',_0x36af('0x62'))[_0x36af('0x20')](_0x36af('0x63'),_0x59dff0[_0x36af('0x27')]['id']);for(var _0x3e85a1=0x0;_0x3e85a1<_0x578a9e[_0x36af('0x3e')];_0x3e85a1+=0x1){let _0x112681=_0x578a9e[_0x3e85a1];for(var _0x21a223=0x0;_0x21a223<_0x112681['Agents'][_0x36af('0x3e')];_0x21a223+=0x1){let _0x1ce2db=_0x112681['Agents'][_0x21a223];var _0xba51c6=_0x1eb353['clone']();_0xba51c6[_0x36af('0x20')](_0x36af('0x64'),_0x1ce2db['id']);_0x220511[_0x36af('0x65')](db[_0x36af('0x57')]['query'](_0xba51c6['toString'](),{'type':db[_0x36af('0x57')][_0x36af('0x66')]['SELECT']})[_0x36af('0x13')](function(_0x31f602){if(_0x31f602[_0x36af('0x3e')]===0x1){return _0x1ce2db['id'];}else{var _0x2933b4=_[_0x36af('0x67')](_[_0x36af('0x1b')](_0x31f602,_0x36af('0x68')),function(_0x4def36){return _[_0x36af('0x69')](_0x3c7ed5,_0x4def36);});if(_0x2933b4){return _0x1ce2db['id'];}}}));}}return BPromise[_0x36af('0x6a')](_0x220511)[_0x36af('0x13')](function(_0x3dfedb){_0x98004c=_(_0x98004c)['union'](_0x3dfedb)['compact']()[_0x36af('0x6b')]();return db['ChatQueue']['find']({'where':{'id':_0x59dff0[_0x36af('0x27')]['id']}})[_0x36af('0x13')](function(_0x451f4f){return db['sequelize'][_0x36af('0x58')](function(_0x1b1135){return _0x451f4f['removeTeams'](_0x59dff0['query'][_0x36af('0x5d')],{'transaction':_0x1b1135})[_0x36af('0x13')](function(){if(!_[_0x36af('0x6c')](_0x98004c)){return _0x451f4f['removeAgents'](_0x98004c,{'transaction':_0x1b1135});}})[_0x36af('0x13')](function(){_0x98004c[_0x36af('0x5a')](function(_0x25fd3e){socket[_0x36af('0x5b')](_0x36af('0x6d'),{'UserId':_0x25fd3e,'ChatQueueId':_0x451f4f['id']});});});});});});})[_0x36af('0x13')](respondWithStatusCode(_0x2f9650,null))[_0x36af('0x25')](handleError(_0x2f9650,null));};exports[_0x36af('0x6e')]=function(_0x482375,_0x416e33){return db[_0x36af('0x21')][_0x36af('0x2e')]({'where':{'id':_0x482375['params']['id']}})['then'](handleEntityNotFound(_0x416e33,null))[_0x36af('0x13')](function(_0x4af425){if(_0x4af425){return _0x4af425[_0x36af('0x6e')](_0x482375[_0x36af('0x38')]['ids'],_['omit'](_0x482375[_0x36af('0x38')],[_0x36af('0x5d'),'id'])||{})['spread'](function(_0x3f960e){for(var _0x25757c=0x0;_0x25757c<_0x482375[_0x36af('0x38')][_0x36af('0x5d')][_0x36af('0x3e')];_0x25757c+=0x1){socket[_0x36af('0x5b')]('userChatQueue:save',{'UserId':Number(_0x482375['body'][_0x36af('0x5d')][_0x25757c]),'ChatQueueId':Number(_0x482375[_0x36af('0x27')]['id'])});}return _0x3f960e;});}})[_0x36af('0x13')](respondWithResult(_0x416e33,null))[_0x36af('0x25')](handleError(_0x416e33,null));};exports[_0x36af('0x6f')]=function(_0x117030,_0x47174d){return db[_0x36af('0x21')][_0x36af('0x2e')]({'where':{'id':_0x117030[_0x36af('0x27')]['id']}})[_0x36af('0x13')](handleEntityNotFound(_0x47174d,null))['then'](function(_0x161337){if(_0x161337){return _0x161337['removeAgents'](_0x117030['query'][_0x36af('0x5d')])[_0x36af('0x13')](function(){if(_[_0x36af('0x70')](_0x117030[_0x36af('0x23')][_0x36af('0x5d')])){for(var _0x153a7e=0x0;_0x153a7e<_0x117030[_0x36af('0x23')][_0x36af('0x5d')][_0x36af('0x3e')];_0x153a7e+=0x1){socket[_0x36af('0x5b')](_0x36af('0x6d'),{'UserId':Number(_0x117030[_0x36af('0x23')][_0x36af('0x5d')][_0x153a7e]),'ChatQueueId':Number(_0x117030[_0x36af('0x27')]['id'])});}}else{socket['emit'](_0x36af('0x6d'),{'UserId':Number(_0x117030[_0x36af('0x23')][_0x36af('0x5d')]),'ChatQueueId':Number(_0x117030[_0x36af('0x27')]['id'])});}});}})[_0x36af('0x13')](respondWithStatusCode(_0x47174d,null))[_0x36af('0x25')](handleError(_0x47174d,null));};exports[_0x36af('0x71')]=function(_0x342765,_0x4586da){var _0x3c1759={};var _0x190bd4={};var _0x341738;var _0xf54a5e;return db['ChatQueue'][_0x36af('0x3b')]({'where':{'id':_0x342765[_0x36af('0x27')]['id']}})['then'](handleEntityNotFound(_0x4586da,null))['then'](function(_0x53ec34){if(_0x53ec34){_0x341738=_0x53ec34;_0x190bd4[_0x36af('0x29')]=_['keys'](db[_0x36af('0x44')]['rawAttributes']);_0x190bd4[_0x36af('0x23')]=_['keys'](_0x342765[_0x36af('0x23')]);_0x190bd4[_0x36af('0x3d')]=_['intersection'](_0x190bd4[_0x36af('0x29')],_0x190bd4[_0x36af('0x23')]);_0x3c1759[_0x36af('0x2a')]=_[_0x36af('0x2b')](_0x190bd4[_0x36af('0x29')],qs[_0x36af('0x2c')](_0x342765[_0x36af('0x23')][_0x36af('0x2c')]));_0x3c1759[_0x36af('0x2a')]=_0x3c1759[_0x36af('0x2a')][_0x36af('0x3e')]?_0x3c1759[_0x36af('0x2a')]:_0x190bd4[_0x36af('0x29')];_0x3c1759['order']=qs[_0x36af('0x40')](_0x342765['query'][_0x36af('0x40')]);_0x3c1759[_0x36af('0x20')]=qs[_0x36af('0x3d')](_[_0x36af('0x41')](_0x342765[_0x36af('0x23')],_0x190bd4[_0x36af('0x3d')]));if(_0x342765[_0x36af('0x23')][_0x36af('0x42')]){_0x3c1759['where']=_[_0x36af('0x43')](_0x3c1759[_0x36af('0x20')],{'$or':_['map'](_0x3c1759[_0x36af('0x2a')],function(_0x176f20){var _0x1592cc={};_0x1592cc[_0x176f20]={'$like':'%'+_0x342765[_0x36af('0x23')][_0x36af('0x42')]+'%'};return _0x1592cc;})});}_0x3c1759=_[_0x36af('0x43')]({},_0x3c1759,_0x342765[_0x36af('0x2d')]);return _0x341738[_0x36af('0x71')](_0x3c1759);}})[_0x36af('0x13')](function(_0x2d7f9d){if(_0x2d7f9d){_0xf54a5e=_0x2d7f9d[_0x36af('0x3e')];if(!_0x342765[_0x36af('0x23')]['hasOwnProperty'](_0x36af('0x3f'))){_0x3c1759[_0x36af('0xf')]=qs[_0x36af('0xf')](_0x342765[_0x36af('0x23')][_0x36af('0xf')]);_0x3c1759[_0x36af('0xd')]=qs[_0x36af('0xd')](_0x342765[_0x36af('0x23')][_0x36af('0xd')]);}return _0x341738['getAgents'](_0x3c1759);}})[_0x36af('0x13')](function(_0x104267){if(_0x104267){return _0x104267?{'count':_0xf54a5e,'rows':_0x104267}:null;}})['then'](respondWithResult(_0x4586da,null))['catch'](handleError(_0x4586da,null));}; \ No newline at end of file +var _0xb8c5=['online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','options','catch','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','merge','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents'];(function(_0x153515,_0x4b0bec){var _0x260bc2=function(_0x40f802){while(--_0x40f802){_0x153515['push'](_0x153515['shift']());}};_0x260bc2(++_0x4b0bec);}(_0xb8c5,0xa0));var _0x5b8c=function(_0x464cef,_0xf19a90){_0x464cef=_0x464cef-0x0;var _0x4f535a=_0xb8c5[_0x464cef];return _0x4f535a;};'use strict';var BPromise=require(_0x5b8c('0x0'));var util=require(_0x5b8c('0x1'));var _=require(_0x5b8c('0x2'));var squel=require(_0x5b8c('0x3'));var Redis=require(_0x5b8c('0x4'));var qs=require(_0x5b8c('0x5'));var logger=require(_0x5b8c('0x6'))(_0x5b8c('0x7'));var config=require(_0x5b8c('0x8'));var db=require('../../mysqldb')['db'];config[_0x5b8c('0x9')]=_['defaults'](config[_0x5b8c('0x9')],{'host':_0x5b8c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b8c('0x9')]));require(_0x5b8c('0xb'))[_0x5b8c('0xc')](socket);function respondWithStatusCode(_0x5f31da,_0x31d880){_0x31d880=_0x31d880||0xcc;return function(_0x264010){if(_0x264010){return _0x5f31da[_0x5b8c('0xd')](_0x31d880);}return _0x5f31da[_0x5b8c('0xe')](_0x31d880)[_0x5b8c('0xf')]();};}function respondWithResult(_0x54c26f,_0x4401ff){_0x4401ff=_0x4401ff||0xc8;return function(_0x53cd75){if(_0x53cd75){return _0x54c26f[_0x5b8c('0xe')](_0x4401ff)['json'](_0x53cd75);}};}function respondWithFilteredResult(_0x1e50ef,_0x54f6b5){return function(_0xf52482){if(_0xf52482){var _0x16f2b6=typeof _0x54f6b5[_0x5b8c('0x10')]===_0x5b8c('0x11')&&typeof _0x54f6b5[_0x5b8c('0x12')]==='undefined';var _0x17854a=_0xf52482[_0x5b8c('0x13')];var _0x32c207=_0x16f2b6?0x0:_0x54f6b5['offset'];var _0x136b1f=_0x16f2b6?_0xf52482[_0x5b8c('0x13')]:_0x54f6b5[_0x5b8c('0x10')]+_0x54f6b5[_0x5b8c('0x12')];var _0x1bdb6b;if(_0x136b1f>=_0x17854a){_0x136b1f=_0x17854a;_0x1bdb6b=0xc8;}else{_0x1bdb6b=0xce;}_0x1e50ef[_0x5b8c('0xe')](_0x1bdb6b);return _0x1e50ef[_0x5b8c('0x14')](_0x5b8c('0x15'),_0x32c207+'-'+_0x136b1f+'/'+_0x17854a)['json'](_0xf52482);}return null;};}function saveUpdates(_0x2d6f58){return function(_0x4de7e0){if(_0x4de7e0){return _0x4de7e0[_0x5b8c('0x16')](_0x2d6f58)[_0x5b8c('0x17')](function(_0x2dd30b){return _0x2dd30b;});}return null;};}function removeEntity(_0x22b725){return function(_0x4efc3b){if(_0x4efc3b){return _0x4efc3b[_0x5b8c('0x18')]()[_0x5b8c('0x17')](function(){var _0x318ac8=_0x4efc3b[_0x5b8c('0x19')]({'plain':!![]});var _0x5a3510=_0x5b8c('0x1a');return db[_0x5b8c('0x1b')][_0x5b8c('0x18')]({'where':{'type':_0x5a3510,'resourceId':_0x318ac8['id']}})[_0x5b8c('0x17')](function(){return _0x4efc3b;});})[_0x5b8c('0x17')](function(){_0x22b725[_0x5b8c('0xe')](0xcc)[_0x5b8c('0xf')]();});}};}function handleEntityNotFound(_0x370f35){return function(_0xcc324c){if(!_0xcc324c){_0x370f35['sendStatus'](0x194);}return _0xcc324c;};}function handleError(_0x4340f4,_0xb520c8){_0xb520c8=_0xb520c8||0x1f4;return function(_0x4dbd51){logger[_0x5b8c('0x1c')](_0x4dbd51[_0x5b8c('0x1d')]);if(_0x4dbd51[_0x5b8c('0x1e')]){delete _0x4dbd51[_0x5b8c('0x1e')];}_0x4340f4['status'](_0xb520c8)[_0x5b8c('0x1f')](_0x4dbd51);};}exports[_0x5b8c('0x20')]=function(_0x3861ea,_0x3db38f){var _0x3af101={};var _0x691050={'count':0x0,'rows':[]};var _0x23521a=_[_0x5b8c('0x21')](db['ChatQueue']['rawAttributes'],function(_0x5d8566){return{'name':_0x5d8566[_0x5b8c('0x22')],'type':_0x5d8566[_0x5b8c('0x23')][_0x5b8c('0x24')]};});_0x3af101=qs[_0x5b8c('0x25')](_0x23521a,_0x3861ea);var _0x517f26={'where':_0x3af101[_0x5b8c('0x26')]};return db[_0x5b8c('0x27')][_0x5b8c('0x13')](_0x517f26)[_0x5b8c('0x17')](function(_0x15a038){_0x691050[_0x5b8c('0x13')]=_0x15a038;_0x3af101[_0x5b8c('0x28')]=qs[_0x5b8c('0x28')](_0x3861ea[_0x5b8c('0x29')]);return db[_0x5b8c('0x27')][_0x5b8c('0x2a')](_0x3af101);})[_0x5b8c('0x17')](function(_0x143f08){_0x691050[_0x5b8c('0x2b')]=_0x143f08;return _0x691050;})[_0x5b8c('0x17')](respondWithFilteredResult(_0x3db38f,_0x3af101))['catch'](handleError(_0x3db38f,null));};exports[_0x5b8c('0x2c')]=function(_0x474065,_0x13db02){var _0x1f0a16={'raw':!![],'where':{'id':_0x474065['params']['id']}},_0x4509d7={};_0x4509d7[_0x5b8c('0x2d')]=_[_0x5b8c('0x2e')](db[_0x5b8c('0x27')][_0x5b8c('0x2f')]);_0x4509d7['query']=_[_0x5b8c('0x2e')](_0x474065[_0x5b8c('0x29')]);_0x4509d7[_0x5b8c('0x30')]=_['intersection'](_0x4509d7['model'],_0x4509d7[_0x5b8c('0x29')]);_0x1f0a16['attributes']=_[_0x5b8c('0x31')](_0x4509d7[_0x5b8c('0x2d')],qs[_0x5b8c('0x32')](_0x474065[_0x5b8c('0x29')][_0x5b8c('0x32')]));_0x1f0a16[_0x5b8c('0x33')]=_0x1f0a16[_0x5b8c('0x33')][_0x5b8c('0x34')]?_0x1f0a16[_0x5b8c('0x33')]:_0x4509d7[_0x5b8c('0x2d')];if(_0x474065[_0x5b8c('0x29')][_0x5b8c('0x35')]){_0x1f0a16['include']=[{'all':!![]}];}_0x1f0a16=_['merge']({},_0x1f0a16,_0x474065[_0x5b8c('0x36')]);return db[_0x5b8c('0x27')]['find'](_0x1f0a16)[_0x5b8c('0x17')](handleEntityNotFound(_0x13db02,null))['then'](respondWithResult(_0x13db02,null))[_0x5b8c('0x37')](handleError(_0x13db02,null));};exports[_0x5b8c('0x38')]=function(_0x129a3f,_0x21e215){return db[_0x5b8c('0x27')][_0x5b8c('0x38')](_0x129a3f[_0x5b8c('0x39')],{})['then'](function(_0x5a59b4){var _0x192a3c=_0x129a3f['user'][_0x5b8c('0x19')]({'plain':!![]});if(!_0x192a3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x192a3c[_0x5b8c('0x3a')]===_0x5b8c('0x3b')){var _0x162e1c=_0x5a59b4[_0x5b8c('0x19')]({'plain':!![]});var _0x421111='ChatQueues';return db[_0x5b8c('0x3c')][_0x5b8c('0x3d')]({'where':{'name':_0x421111,'userProfileId':_0x192a3c[_0x5b8c('0x3e')]},'raw':!![]})['then'](function(_0x1d234c){if(_0x1d234c&&_0x1d234c[_0x5b8c('0x3f')]===0x0){return db[_0x5b8c('0x1b')][_0x5b8c('0x38')]({'name':_0x162e1c[_0x5b8c('0x1e')],'resourceId':_0x162e1c['id'],'type':_0x1d234c['name'],'sectionId':_0x1d234c['id']},{})[_0x5b8c('0x17')](function(){return _0x5a59b4;});}else{return _0x5a59b4;}})[_0x5b8c('0x37')](function(_0x5d9fc3){logger[_0x5b8c('0x1c')](_0x5b8c('0x40'),_0x5d9fc3);throw _0x5d9fc3;});}return _0x5a59b4;})[_0x5b8c('0x17')](respondWithResult(_0x21e215,0xc9))[_0x5b8c('0x37')](handleError(_0x21e215,null));};exports['update']=function(_0x17407b,_0x468896){if(_0x17407b['body']['id']){delete _0x17407b[_0x5b8c('0x39')]['id'];}return db['ChatQueue'][_0x5b8c('0x3d')]({'where':{'id':_0x17407b[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x468896,null))[_0x5b8c('0x17')](saveUpdates(_0x17407b[_0x5b8c('0x39')],null))[_0x5b8c('0x17')](respondWithResult(_0x468896,null))[_0x5b8c('0x37')](handleError(_0x468896,null));};exports[_0x5b8c('0x18')]=function(_0xcbf4ee,_0x285f4d){return db[_0x5b8c('0x27')][_0x5b8c('0x3d')]({'where':{'id':_0xcbf4ee[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x285f4d,null))[_0x5b8c('0x17')](removeEntity(_0x285f4d,null))['catch'](handleError(_0x285f4d,null));};exports[_0x5b8c('0x42')]=function(_0x548b7f,_0x5b6b84){return db[_0x5b8c('0x27')][_0x5b8c('0x42')]()[_0x5b8c('0x17')](respondWithResult(_0x5b6b84,null))[_0x5b8c('0x37')](handleError(_0x5b6b84,null));};exports['getMembers']=function(_0x294ec5,_0x57f2fd){var _0x33344d={'raw':!![],'where':{}},_0x452904={},_0x54e738;return db[_0x5b8c('0x27')][_0x5b8c('0x43')]({'where':{'id':_0x294ec5[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x57f2fd,null))[_0x5b8c('0x17')](function(_0x223940){if(_0x223940){_0x54e738=_0x223940['get']({'plain':!![]});_0x452904['model']=_[_0x5b8c('0x2e')](db[_0x5b8c('0x44')][_0x5b8c('0x2f')]);_0x452904[_0x5b8c('0x29')]=_[_0x5b8c('0x2e')](_0x294ec5[_0x5b8c('0x29')]);_0x452904[_0x5b8c('0x30')]=_[_0x5b8c('0x31')](_0x452904[_0x5b8c('0x2d')],_0x452904[_0x5b8c('0x29')]);_0x33344d[_0x5b8c('0x33')]=_[_0x5b8c('0x31')](_0x452904['model'],qs[_0x5b8c('0x32')](_0x294ec5[_0x5b8c('0x29')]['fields']));_0x33344d[_0x5b8c('0x33')]=_0x33344d['attributes'][_0x5b8c('0x34')]?_0x33344d[_0x5b8c('0x33')]:_0x452904['model'];if(!_0x294ec5[_0x5b8c('0x29')][_0x5b8c('0x45')](_0x5b8c('0x46'))){_0x33344d[_0x5b8c('0x12')]=qs[_0x5b8c('0x12')](_0x294ec5[_0x5b8c('0x29')]['limit']);_0x33344d[_0x5b8c('0x10')]=qs[_0x5b8c('0x10')](_0x294ec5[_0x5b8c('0x29')][_0x5b8c('0x10')]);}_0x33344d[_0x5b8c('0x47')]=qs[_0x5b8c('0x48')](_0x294ec5['query'][_0x5b8c('0x48')]);_0x33344d[_0x5b8c('0x26')]=qs[_0x5b8c('0x30')](_[_0x5b8c('0x49')](_0x294ec5[_0x5b8c('0x29')],_0x452904[_0x5b8c('0x30')]));_0x33344d[_0x5b8c('0x26')][_0x5b8c('0x4a')]=_0x223940['id'];if(_0x294ec5[_0x5b8c('0x29')][_0x5b8c('0x4b')]){_0x33344d[_0x5b8c('0x26')]=_['merge'](_0x33344d[_0x5b8c('0x26')],{'$or':_['map'](_0x33344d['attributes'],function(_0x19474a){var _0x392c3d={};_0x392c3d[_0x19474a]={'$like':'%'+_0x294ec5['query'][_0x5b8c('0x4b')]+'%'};return _0x392c3d;})});}_0x33344d=_[_0x5b8c('0x4c')]({},_0x33344d,_0x294ec5[_0x5b8c('0x36')]);return db[_0x5b8c('0x44')][_0x5b8c('0x2a')](_0x33344d);}})['then'](function(_0x42e0b5){if(_0x42e0b5){return db['User'][_0x5b8c('0x4d')]({'where':{'id':_[_0x5b8c('0x21')](_0x42e0b5,'UserId'),'role':_0x5b8c('0x4e')},'attributes':['id',_0x5b8c('0x1e'),_0x5b8c('0x4f'),_0x5b8c('0x50'),_0x5b8c('0x51')]});}})[_0x5b8c('0x17')](function(_0x173216){if(_0x173216){return{'count':_0x173216[_0x5b8c('0x13')],'rows':_[_0x5b8c('0x21')](_0x173216[_0x5b8c('0x2b')],function(_0x2e6e70){return{'membername':_0x2e6e70['name'],'UserId':_0x2e6e70['id'],'queue_name':_0x54e738[_0x5b8c('0x1e')],'ChatQueueId':_0x54e738['id'],'interface':util['format'](_0x5b8c('0x52'),_0x5b8c('0x53'),_0x2e6e70[_0x5b8c('0x1e')]),'penalty':0x0,'paused':_0x2e6e70[_0x5b8c('0x4f')],'createdAt':_0x2e6e70[_0x5b8c('0x51')],'updatedAt':_0x2e6e70[_0x5b8c('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x57f2fd,_0x33344d))[_0x5b8c('0x37')](handleError(_0x57f2fd,null));};exports[_0x5b8c('0x54')]=function(_0x44366c,_0xdf18b1){var _0x45721f={};var _0x5901a3={};var _0x1ef146;var _0x751ea4;return db[_0x5b8c('0x27')][_0x5b8c('0x43')]({'where':{'id':_0x44366c[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0xdf18b1,null))['then'](function(_0x94a26d){if(_0x94a26d){_0x1ef146=_0x94a26d;_0x5901a3['model']=_[_0x5b8c('0x2e')](db[_0x5b8c('0x55')][_0x5b8c('0x2f')]);_0x5901a3[_0x5b8c('0x29')]=_['keys'](_0x44366c[_0x5b8c('0x29')]);_0x5901a3['filters']=_['intersection'](_0x5901a3['model'],_0x5901a3['query']);_0x45721f[_0x5b8c('0x33')]=_[_0x5b8c('0x31')](_0x5901a3[_0x5b8c('0x2d')],qs['fields'](_0x44366c[_0x5b8c('0x29')][_0x5b8c('0x32')]));_0x45721f['attributes']=_0x45721f[_0x5b8c('0x33')]['length']?_0x45721f[_0x5b8c('0x33')]:_0x5901a3[_0x5b8c('0x2d')];_0x45721f[_0x5b8c('0x47')]=qs['sort'](_0x44366c[_0x5b8c('0x29')][_0x5b8c('0x48')]);_0x45721f[_0x5b8c('0x26')]=qs[_0x5b8c('0x30')](_['pick'](_0x44366c[_0x5b8c('0x29')],_0x5901a3[_0x5b8c('0x30')]));if(_0x44366c[_0x5b8c('0x29')][_0x5b8c('0x4b')]){_0x45721f[_0x5b8c('0x26')]=_[_0x5b8c('0x4c')](_0x45721f[_0x5b8c('0x26')],{'$or':_[_0x5b8c('0x21')](_0x45721f[_0x5b8c('0x33')],function(_0x2f2888){var _0x2f45ac={};_0x2f45ac[_0x2f2888]={'$like':'%'+_0x44366c['query'][_0x5b8c('0x4b')]+'%'};return _0x2f45ac;})});}_0x45721f=_['merge']({},_0x45721f,_0x44366c[_0x5b8c('0x36')]);return _0x1ef146[_0x5b8c('0x54')](_0x45721f);}})[_0x5b8c('0x17')](function(_0x1d23f4){if(_0x1d23f4){_0x751ea4=_0x1d23f4[_0x5b8c('0x34')];if(!_0x44366c[_0x5b8c('0x29')][_0x5b8c('0x45')](_0x5b8c('0x46'))){_0x45721f[_0x5b8c('0x12')]=qs[_0x5b8c('0x12')](_0x44366c[_0x5b8c('0x29')]['limit']);_0x45721f['offset']=qs[_0x5b8c('0x10')](_0x44366c['query'][_0x5b8c('0x10')]);}return _0x1ef146['getTeams'](_0x45721f);}})[_0x5b8c('0x17')](function(_0x31e561){if(_0x31e561){return _0x31e561?{'count':_0x751ea4,'rows':_0x31e561}:null;}})[_0x5b8c('0x17')](respondWithResult(_0xdf18b1,null))['catch'](handleError(_0xdf18b1,null));};exports['addTeams']=function(_0x316c6a,_0x51de3a){var _0x32a58a=_0x316c6a[_0x5b8c('0x39')][_0x5b8c('0x56')];return db[_0x5b8c('0x55')][_0x5b8c('0x2a')]({'where':{'id':_0x32a58a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5b8c('0x57'),'attributes':['id',_0x5b8c('0x1e'),_0x5b8c('0x58'),_0x5b8c('0x59'),_0x5b8c('0x5a')],'raw':!![]}]})[_0x5b8c('0x17')](function(_0x16a610){if(_0x16a610){var _0x5c702a=_[_0x5b8c('0x5b')](_0x16a610,function(_0x201987){var _0x4ba31d=_0x201987['get']({'plain':!![]});return _0x4ba31d[_0x5b8c('0x57')];});return db[_0x5b8c('0x27')][_0x5b8c('0x3d')]({'where':{'id':_0x316c6a['params']['id']}})[_0x5b8c('0x17')](function(_0x4cccf3){return db[_0x5b8c('0x5c')][_0x5b8c('0x5d')](function(_0x4440ca){return _0x4cccf3['addTeams'](_0x32a58a,{'transaction':_0x4440ca})[_0x5b8c('0x17')](function(){return BPromise[_0x5b8c('0x5e')](_0x5c702a,function(_0x5758af){return db[_0x5b8c('0x44')][_0x5b8c('0x5f')]({'where':{'UserId':_0x5758af['id'],'ChatQueueId':_0x316c6a[_0x5b8c('0x41')]['id']},'transaction':_0x4440ca});});})[_0x5b8c('0x17')](function(){_0x5c702a[_0x5b8c('0x60')](function(_0x38b1e9){socket[_0x5b8c('0x61')](_0x5b8c('0x62'),{'UserId':_0x38b1e9['id'],'ChatQueueId':_0x4cccf3['id']});});});});});}})[_0x5b8c('0x17')](respondWithStatusCode(_0x51de3a,null))['catch'](handleError(_0x51de3a,null));};exports[_0x5b8c('0x63')]=function(_0x5927e2,_0x17ae85){return db[_0x5b8c('0x55')][_0x5b8c('0x2a')]({'where':{'id':_0x5927e2['query'][_0x5b8c('0x56')]},'attributes':['id'],'include':[{'model':db[_0x5b8c('0x64')],'as':_0x5b8c('0x57'),'attributes':['id'],'raw':!![]}]})[_0x5b8c('0x17')](handleEntityNotFound(_0x17ae85,null))['then'](function(_0x1dcc53){var _0x2e402e=_['map'](_0x1dcc53,'id');var _0x1b9134=[];var _0x5ef605=[];var _0x5bd48c=squel[_0x5b8c('0x65')]();_0x5bd48c[_0x5b8c('0x66')](_0x5b8c('0x67'))[_0x5b8c('0x68')]('team_has_chat_queues','tq')['join']('user_has_teams','ut',_0x5b8c('0x69'))[_0x5b8c('0x26')](_0x5b8c('0x6a'),_0x5927e2[_0x5b8c('0x41')]['id']);for(var _0x48486d=0x0;_0x48486d<_0x1dcc53['length'];_0x48486d+=0x1){let _0x20e9ce=_0x1dcc53[_0x48486d];for(var _0x593a38=0x0;_0x593a38<_0x20e9ce[_0x5b8c('0x57')][_0x5b8c('0x34')];_0x593a38+=0x1){let _0xc28e7d=_0x20e9ce['Agents'][_0x593a38];var _0x477a61=_0x5bd48c[_0x5b8c('0x6b')]();_0x477a61[_0x5b8c('0x26')]('ut.UserId\x20=\x20?',_0xc28e7d['id']);_0x5ef605[_0x5b8c('0x6c')](db[_0x5b8c('0x5c')]['query'](_0x477a61[_0x5b8c('0x6d')](),{'type':db[_0x5b8c('0x5c')][_0x5b8c('0x6e')][_0x5b8c('0x6f')]})[_0x5b8c('0x17')](function(_0x2da927){if(_0x2da927[_0x5b8c('0x34')]===0x1){return _0xc28e7d['id'];}else{var _0x8a3a88=_[_0x5b8c('0x70')](_[_0x5b8c('0x21')](_0x2da927,'TeamId'),function(_0x423ca8){return _['includes'](_0x2e402e,_0x423ca8);});if(_0x8a3a88){return _0xc28e7d['id'];}}}));}}return BPromise[_0x5b8c('0x71')](_0x5ef605)[_0x5b8c('0x17')](function(_0x3b1739){_0x1b9134=_(_0x1b9134)[_0x5b8c('0x72')](_0x3b1739)[_0x5b8c('0x73')]()[_0x5b8c('0x74')]();return db[_0x5b8c('0x27')][_0x5b8c('0x3d')]({'where':{'id':_0x5927e2[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](function(_0x27e2b7){return db[_0x5b8c('0x5c')][_0x5b8c('0x5d')](function(_0x269bbc){return _0x27e2b7[_0x5b8c('0x63')](_0x5927e2[_0x5b8c('0x29')][_0x5b8c('0x56')],{'transaction':_0x269bbc})[_0x5b8c('0x17')](function(){if(!_[_0x5b8c('0x75')](_0x1b9134)){return _0x27e2b7[_0x5b8c('0x76')](_0x1b9134,{'transaction':_0x269bbc});}})[_0x5b8c('0x17')](function(){_0x1b9134[_0x5b8c('0x60')](function(_0x5d0b8c){socket[_0x5b8c('0x61')](_0x5b8c('0x77'),{'UserId':_0x5d0b8c,'ChatQueueId':_0x27e2b7['id']});});});});});});})[_0x5b8c('0x17')](respondWithStatusCode(_0x17ae85,null))[_0x5b8c('0x37')](handleError(_0x17ae85,null));};exports[_0x5b8c('0x78')]=function(_0x12afd3,_0x473f85){return db[_0x5b8c('0x27')][_0x5b8c('0x3d')]({'where':{'id':_0x12afd3[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x473f85,null))['then'](function(_0x367980){if(_0x367980){return _0x367980[_0x5b8c('0x78')](_0x12afd3[_0x5b8c('0x39')][_0x5b8c('0x56')],_[_0x5b8c('0x79')](_0x12afd3[_0x5b8c('0x39')],[_0x5b8c('0x56'),'id'])||{})['spread'](function(_0x18874d){for(var _0xcaf120=0x0;_0xcaf120<_0x12afd3[_0x5b8c('0x39')]['ids']['length'];_0xcaf120+=0x1){socket[_0x5b8c('0x61')](_0x5b8c('0x62'),{'UserId':Number(_0x12afd3[_0x5b8c('0x39')][_0x5b8c('0x56')][_0xcaf120]),'ChatQueueId':Number(_0x12afd3[_0x5b8c('0x41')]['id'])});}return _0x18874d;});}})[_0x5b8c('0x17')](respondWithResult(_0x473f85,null))[_0x5b8c('0x37')](handleError(_0x473f85,null));};exports['removeAgents']=function(_0x5e13b8,_0x18cc97){return db['ChatQueue'][_0x5b8c('0x3d')]({'where':{'id':_0x5e13b8[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x18cc97,null))['then'](function(_0x4f6e53){if(_0x4f6e53){return _0x4f6e53[_0x5b8c('0x76')](_0x5e13b8[_0x5b8c('0x29')][_0x5b8c('0x56')])[_0x5b8c('0x17')](function(){if(_[_0x5b8c('0x7a')](_0x5e13b8[_0x5b8c('0x29')][_0x5b8c('0x56')])){for(var _0x113f9b=0x0;_0x113f9b<_0x5e13b8['query']['ids'][_0x5b8c('0x34')];_0x113f9b+=0x1){socket[_0x5b8c('0x61')](_0x5b8c('0x77'),{'UserId':Number(_0x5e13b8[_0x5b8c('0x29')]['ids'][_0x113f9b]),'ChatQueueId':Number(_0x5e13b8[_0x5b8c('0x41')]['id'])});}}else{socket[_0x5b8c('0x61')](_0x5b8c('0x77'),{'UserId':Number(_0x5e13b8[_0x5b8c('0x29')][_0x5b8c('0x56')]),'ChatQueueId':Number(_0x5e13b8[_0x5b8c('0x41')]['id'])});}});}})['then'](respondWithStatusCode(_0x18cc97,null))[_0x5b8c('0x37')](handleError(_0x18cc97,null));};exports['getAgents']=function(_0x492610,_0x1473dc){var _0x1e1967={};var _0x138d46={};var _0x27e497;var _0x3c4f39;return db[_0x5b8c('0x27')][_0x5b8c('0x43')]({'where':{'id':_0x492610[_0x5b8c('0x41')]['id']}})[_0x5b8c('0x17')](handleEntityNotFound(_0x1473dc,null))[_0x5b8c('0x17')](function(_0x2f0659){if(_0x2f0659){_0x27e497=_0x2f0659;_0x138d46[_0x5b8c('0x2d')]=_['keys'](db[_0x5b8c('0x64')][_0x5b8c('0x2f')]);_0x138d46[_0x5b8c('0x29')]=_[_0x5b8c('0x2e')](_0x492610[_0x5b8c('0x29')]);_0x138d46[_0x5b8c('0x30')]=_[_0x5b8c('0x31')](_0x138d46[_0x5b8c('0x2d')],_0x138d46[_0x5b8c('0x29')]);_0x1e1967[_0x5b8c('0x33')]=_[_0x5b8c('0x31')](_0x138d46[_0x5b8c('0x2d')],qs['fields'](_0x492610[_0x5b8c('0x29')][_0x5b8c('0x32')]));_0x1e1967[_0x5b8c('0x33')]=_0x1e1967[_0x5b8c('0x33')][_0x5b8c('0x34')]?_0x1e1967[_0x5b8c('0x33')]:_0x138d46['model'];_0x1e1967['order']=qs[_0x5b8c('0x48')](_0x492610[_0x5b8c('0x29')][_0x5b8c('0x48')]);_0x1e1967['where']=qs[_0x5b8c('0x30')](_['pick'](_0x492610[_0x5b8c('0x29')],_0x138d46[_0x5b8c('0x30')]));if(_0x492610[_0x5b8c('0x29')][_0x5b8c('0x4b')]){_0x1e1967[_0x5b8c('0x26')]=_[_0x5b8c('0x4c')](_0x1e1967[_0x5b8c('0x26')],{'$or':_[_0x5b8c('0x21')](_0x1e1967[_0x5b8c('0x33')],function(_0x55cb54){var _0x2a1de8={};_0x2a1de8[_0x55cb54]={'$like':'%'+_0x492610['query'][_0x5b8c('0x4b')]+'%'};return _0x2a1de8;})});}_0x1e1967=_[_0x5b8c('0x4c')]({},_0x1e1967,_0x492610[_0x5b8c('0x36')]);return _0x27e497[_0x5b8c('0x7b')](_0x1e1967);}})[_0x5b8c('0x17')](function(_0x45f715){if(_0x45f715){_0x3c4f39=_0x45f715[_0x5b8c('0x34')];if(!_0x492610[_0x5b8c('0x29')][_0x5b8c('0x45')](_0x5b8c('0x46'))){_0x1e1967[_0x5b8c('0x12')]=qs[_0x5b8c('0x12')](_0x492610['query']['limit']);_0x1e1967[_0x5b8c('0x10')]=qs['offset'](_0x492610[_0x5b8c('0x29')][_0x5b8c('0x10')]);}return _0x27e497[_0x5b8c('0x7b')](_0x1e1967);}})[_0x5b8c('0x17')](function(_0x41078e){if(_0x41078e){return _0x41078e?{'count':_0x3c4f39,'rows':_0x41078e}:null;}})[_0x5b8c('0x17')](respondWithResult(_0x1473dc,null))['catch'](handleError(_0x1473dc,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d2a6d2e..cacefca 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 _0x2991=['events','ChatQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x16970b,_0x19b654){var _0x2aff7f=function(_0x241df3){while(--_0x241df3){_0x16970b['push'](_0x16970b['shift']());}};_0x2aff7f(++_0x19b654);}(_0x2991,0x132));var _0x1299=function(_0x414ddf,_0x14586c){_0x414ddf=_0x414ddf-0x0;var _0x2e6951=_0x2991[_0x414ddf];return _0x2e6951;};'use strict';var EventEmitter=require(_0x1299('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x1299('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1299('0x2'),'afterUpdate':_0x1299('0x3'),'afterDestroy':_0x1299('0x4')};function emitEvent(_0x50bb12){return function(_0x2e360b,_0x48ac72,_0xefd74a){ChatQueueEvents[_0x1299('0x5')](_0x50bb12+':'+_0x2e360b['id'],_0x2e360b);ChatQueueEvents['emit'](_0x50bb12,_0x2e360b);_0xefd74a(null);};}for(var e in events){if(events[_0x1299('0x6')](e)){var event=events[e];ChatQueue[_0x1299('0x7')](e,emitEvent(event));}}module[_0x1299('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x6d93=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x368e74,_0x1afa3c){var _0x1f393e=function(_0xd401c4){while(--_0xd401c4){_0x368e74['push'](_0x368e74['shift']());}};_0x1f393e(++_0x1afa3c);}(_0x6d93,0x177));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x36d9('0x0'));var ChatQueue=require(_0x36d9('0x1'))['db'][_0x36d9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x36d9('0x3')](0x0);var events={'afterCreate':_0x36d9('0x4'),'afterUpdate':_0x36d9('0x5'),'afterDestroy':_0x36d9('0x6')};function emitEvent(_0x5caf36){return function(_0xd57379,_0x21a561,_0x179082){ChatQueueEvents[_0x36d9('0x7')](_0x5caf36+':'+_0xd57379['id'],_0xd57379);ChatQueueEvents[_0x36d9('0x7')](_0x5caf36,_0xd57379);_0x179082(null);};}for(var e in events){if(events[_0x36d9('0x8')](e)){var event=events[e];ChatQueue[_0x36d9('0x9')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 43645fc..392a179 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 _0x5da4=['../../config/logger','api','moment','bluebird','path','../../config/environment','ChatQueue','chat_queues','util'];(function(_0x146fd9,_0x2188c9){var _0x469fb1=function(_0x26f4e4){while(--_0x26f4e4){_0x146fd9['push'](_0x146fd9['shift']());}};_0x469fb1(++_0x2188c9);}(_0x5da4,0x15e));var _0x45da=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x5da4[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x45da('0x0'));var logger=require(_0x45da('0x1'))(_0x45da('0x2'));var moment=require(_0x45da('0x3'));var BPromise=require(_0x45da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45da('0x5'));var rimraf=require('rimraf');var config=require(_0x45da('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x1687dc,_0x718fe3){return _0x1687dc['define'](_0x45da('0x7'),attributes,{'tableName':_0x45da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x383c=['bluebird','request-promise','rimraf','./chatQueue.attributes','lodash','util','../../config/logger','api','moment'];(function(_0x3c8d95,_0x1cffaa){var _0x501c2f=function(_0x5c88d0){while(--_0x5c88d0){_0x3c8d95['push'](_0x3c8d95['shift']());}};_0x501c2f(++_0x1cffaa);}(_0x383c,0xaf));var _0xc383=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x383c[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xc383('0x0'));var util=require(_0xc383('0x1'));var logger=require(_0xc383('0x2'))(_0xc383('0x3'));var moment=require(_0xc383('0x4'));var BPromise=require(_0xc383('0x5'));var rp=require(_0xc383('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc383('0x7'));var config=require('../../config/environment');var attributes=require(_0xc383('0x8'));module['exports']=function(_0x1598a7,_0x11f6d6){return _0x1598a7['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index dd61ebe..3c92e24 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 _0x06ef=['catch','GetChatQueue','ChatQueue','options','where','attributes','limit','map','include','model','debug','stringify','ShowChatQueue','find','raw','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','socket.io-emitter','redis','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x422975,_0x57b9da){var _0x461d1c=function(_0x1fbaab){while(--_0x1fbaab){_0x422975['push'](_0x422975['shift']());}};_0x461d1c(++_0x57b9da);}(_0x06ef,0x185));var _0xf06e=function(_0x465c59,_0x1d6706){_0x465c59=_0x465c59-0x0;var _0x5b4314=_0x06ef[_0x465c59];return _0x5b4314;};'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});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf06e('0x6'))(new Redis(config[_0xf06e('0x7')]));require(_0xf06e('0x8'))[_0xf06e('0x9')](socket);function respondWithRpcPromise(_0xbb0e3c,_0x5e594e,_0x1fe49b){return new BPromise(function(_0x3a33c1,_0x4e3591){return client[_0xf06e('0xa')](_0xbb0e3c,_0x1fe49b)[_0xf06e('0xb')](function(_0x454d77){logger[_0xf06e('0xc')](_0xf06e('0xd'),_0x5e594e,_0xf06e('0xe'));logger['debug'](_0xf06e('0xf'),_0x5e594e,_0xf06e('0xe'),JSON['stringify'](_0x454d77));if(_0x454d77[_0xf06e('0x10')]){if(_0x454d77[_0xf06e('0x10')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5e594e,_0x454d77[_0xf06e('0x10')][_0xf06e('0x11')]);return _0x4e3591(_0x454d77[_0xf06e('0x10')]['message']);}logger[_0xf06e('0x10')](_0xf06e('0xd'),_0x5e594e,_0x454d77[_0xf06e('0x10')][_0xf06e('0x11')]);return _0x3a33c1(_0x454d77[_0xf06e('0x10')][_0xf06e('0x11')]);}else{logger[_0xf06e('0xc')]('ChatQueue,\x20%s,\x20%s',_0x5e594e,_0xf06e('0xe'));_0x3a33c1(_0x454d77[_0xf06e('0x12')][_0xf06e('0x11')]);}})[_0xf06e('0x13')](function(_0x5c1a80){logger['error'](_0xf06e('0xd'),_0x5e594e,_0x5c1a80);_0x4e3591(_0x5c1a80);});});}exports[_0xf06e('0x14')]=function(_0x5d66f9){var _0x5710f1=this;return new Promise(function(_0x5fcefb,_0x211590){return db[_0xf06e('0x15')]['findAll']({'raw':_0x5d66f9[_0xf06e('0x16')]?_0x5d66f9[_0xf06e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d66f9[_0xf06e('0x16')]?_0x5d66f9[_0xf06e('0x16')][_0xf06e('0x17')]||null:null,'attributes':_0x5d66f9['options']?_0x5d66f9[_0xf06e('0x16')][_0xf06e('0x18')]||null:null,'limit':_0x5d66f9[_0xf06e('0x16')]?_0x5d66f9[_0xf06e('0x16')][_0xf06e('0x19')]||null:null,'include':_0x5d66f9['options']?_0x5d66f9[_0xf06e('0x16')]['include']?_[_0xf06e('0x1a')](_0x5d66f9[_0xf06e('0x16')][_0xf06e('0x1b')],function(_0x322f4c){return{'model':db[_0x322f4c[_0xf06e('0x1c')]],'as':_0x322f4c['as'],'attributes':_0x322f4c[_0xf06e('0x18')],'include':_0x322f4c['include']?_[_0xf06e('0x1a')](_0x322f4c[_0xf06e('0x1b')],function(_0x873aa5){return{'model':db[_0x873aa5[_0xf06e('0x1c')]],'as':_0x873aa5['as'],'attributes':_0x873aa5[_0xf06e('0x18')],'include':_0x873aa5['include']?_[_0xf06e('0x1a')](_0x873aa5[_0xf06e('0x1b')],function(_0x126aa9){return{'model':db[_0x126aa9[_0xf06e('0x1c')]],'as':_0x126aa9['as'],'attributes':_0x126aa9[_0xf06e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf06e('0xb')](function(_0x4b5185){logger[_0xf06e('0xc')](_0xf06e('0x14'),_0x5d66f9);logger[_0xf06e('0x1d')]('GetChatQueue',_0x5d66f9,JSON[_0xf06e('0x1e')](_0x4b5185));_0x5fcefb(_0x4b5185);})[_0xf06e('0x13')](function(_0xb1fa81){logger[_0xf06e('0x10')](_0xf06e('0x14'),_0xb1fa81[_0xf06e('0x11')],_0x5d66f9);_0x211590(_0x5710f1[_0xf06e('0x10')](0x1f4,_0xb1fa81[_0xf06e('0x11')]));});});};exports[_0xf06e('0x1f')]=function(_0x51a105){var _0x5206b7=this;return new Promise(function(_0x43f22a,_0x4fb3e9){return db['ChatQueue'][_0xf06e('0x20')]({'raw':_0x51a105[_0xf06e('0x16')]?_0x51a105[_0xf06e('0x16')][_0xf06e('0x21')]===undefined?!![]:![]:!![],'where':_0x51a105[_0xf06e('0x16')]?_0x51a105[_0xf06e('0x16')]['where']||null:null,'attributes':_0x51a105[_0xf06e('0x16')]?_0x51a105[_0xf06e('0x16')][_0xf06e('0x18')]||null:null,'include':_0x51a105['options']?_0x51a105[_0xf06e('0x16')][_0xf06e('0x1b')]?_[_0xf06e('0x1a')](_0x51a105[_0xf06e('0x16')][_0xf06e('0x1b')],function(_0x380a8a){return{'model':db[_0x380a8a[_0xf06e('0x1c')]],'as':_0x380a8a['as'],'attributes':_0x380a8a['attributes'],'include':_0x380a8a['include']?_[_0xf06e('0x1a')](_0x380a8a['include'],function(_0x276ed8){return{'model':db[_0x276ed8['model']],'as':_0x276ed8['as'],'attributes':_0x276ed8[_0xf06e('0x18')],'include':_0x276ed8['include']?_[_0xf06e('0x1a')](_0x276ed8[_0xf06e('0x1b')],function(_0x13b50b){return{'model':db[_0x13b50b[_0xf06e('0x1c')]],'as':_0x13b50b['as'],'attributes':_0x13b50b[_0xf06e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf06e('0xb')](function(_0x523f90){logger[_0xf06e('0xc')](_0xf06e('0x1f'),_0x51a105);logger[_0xf06e('0x1d')](_0xf06e('0x1f'),_0x51a105,JSON[_0xf06e('0x1e')](_0x523f90));_0x43f22a(_0x523f90);})[_0xf06e('0x13')](function(_0x25d9ad){logger[_0xf06e('0x10')](_0xf06e('0x1f'),_0x25d9ad[_0xf06e('0x11')],_0x51a105);_0x4fb3e9(_0x5206b7[_0xf06e('0x10')](0x1f4,_0x25d9ad['message']));});});}; \ No newline at end of file +var _0x9bc7=['ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowChatQueue','ChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ba96b,_0x3bcefd){var _0x4b7d33=function(_0x3379b7){while(--_0x3379b7){_0x2ba96b['push'](_0x2ba96b['shift']());}};_0x4b7d33(++_0x3bcefd);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9bc7[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var moment=require(_0x79bc('0x2'));var BPromise=require(_0x79bc('0x3'));var rs=require(_0x79bc('0x4'));var fs=require('fs');var Redis=require(_0x79bc('0x5'));var db=require(_0x79bc('0x6'))['db'];var utils=require(_0x79bc('0x7'));var logger=require(_0x79bc('0x8'))(_0x79bc('0x9'));var config=require('../../config/environment');var jayson=require(_0x79bc('0xa'));var client=jayson[_0x79bc('0xb')][_0x79bc('0xc')]({'port':0x232a});config['redis']=_[_0x79bc('0xd')](config['redis'],{'host':_0x79bc('0xe'),'port':0x18eb});var socket=require(_0x79bc('0xf'))(new Redis(config[_0x79bc('0x10')]));require(_0x79bc('0x11'))[_0x79bc('0x12')](socket);function respondWithRpcPromise(_0x5046ba,_0x2513e5,_0x500abb){return new BPromise(function(_0x217077,_0x3c5c73){return client['request'](_0x5046ba,_0x500abb)['then'](function(_0xc6122d){logger[_0x79bc('0x13')](_0x79bc('0x14'),_0x2513e5,_0x79bc('0x15'));logger[_0x79bc('0x16')](_0x79bc('0x17'),_0x2513e5,_0x79bc('0x15'),JSON[_0x79bc('0x18')](_0xc6122d));if(_0xc6122d['error']){if(_0xc6122d[_0x79bc('0x19')][_0x79bc('0x1a')]===0x1f4){logger[_0x79bc('0x19')](_0x79bc('0x14'),_0x2513e5,_0xc6122d[_0x79bc('0x19')][_0x79bc('0x1b')]);return _0x3c5c73(_0xc6122d['error'][_0x79bc('0x1b')]);}logger[_0x79bc('0x19')]('ChatQueue,\x20%s,\x20%s',_0x2513e5,_0xc6122d[_0x79bc('0x19')]['message']);return _0x217077(_0xc6122d[_0x79bc('0x19')][_0x79bc('0x1b')]);}else{logger['info'](_0x79bc('0x14'),_0x2513e5,_0x79bc('0x15'));_0x217077(_0xc6122d[_0x79bc('0x1c')][_0x79bc('0x1b')]);}})[_0x79bc('0x1d')](function(_0x5a2129){logger[_0x79bc('0x19')](_0x79bc('0x14'),_0x2513e5,_0x5a2129);_0x3c5c73(_0x5a2129);});});}exports[_0x79bc('0x1e')]=function(_0x269d07){var _0x5686f6=this;return new Promise(function(_0x3067f4,_0x52a423){return db['ChatQueue'][_0x79bc('0x1f')]({'raw':_0x269d07[_0x79bc('0x20')]?_0x269d07[_0x79bc('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x269d07[_0x79bc('0x20')]?_0x269d07[_0x79bc('0x20')][_0x79bc('0x21')]||null:null,'attributes':_0x269d07[_0x79bc('0x20')]?_0x269d07[_0x79bc('0x20')][_0x79bc('0x22')]||null:null,'limit':_0x269d07['options']?_0x269d07['options'][_0x79bc('0x23')]||null:null,'include':_0x269d07[_0x79bc('0x20')]?_0x269d07[_0x79bc('0x20')][_0x79bc('0x24')]?_[_0x79bc('0x25')](_0x269d07[_0x79bc('0x20')][_0x79bc('0x24')],function(_0x38f667){return{'model':db[_0x38f667[_0x79bc('0x26')]],'as':_0x38f667['as'],'attributes':_0x38f667[_0x79bc('0x22')],'include':_0x38f667[_0x79bc('0x24')]?_[_0x79bc('0x25')](_0x38f667['include'],function(_0x4b3eb9){return{'model':db[_0x4b3eb9[_0x79bc('0x26')]],'as':_0x4b3eb9['as'],'attributes':_0x4b3eb9[_0x79bc('0x22')],'include':_0x4b3eb9['include']?_[_0x79bc('0x25')](_0x4b3eb9[_0x79bc('0x24')],function(_0x48584b){return{'model':db[_0x48584b['model']],'as':_0x48584b['as'],'attributes':_0x48584b['attributes']};}):[]};}):[]};}):[]:[]})[_0x79bc('0x27')](function(_0xe7fe10){logger[_0x79bc('0x13')]('GetChatQueue',_0x269d07);logger[_0x79bc('0x16')](_0x79bc('0x1e'),_0x269d07,JSON['stringify'](_0xe7fe10));_0x3067f4(_0xe7fe10);})['catch'](function(_0x2da9bc){logger['error'](_0x79bc('0x1e'),_0x2da9bc[_0x79bc('0x1b')],_0x269d07);_0x52a423(_0x5686f6[_0x79bc('0x19')](0x1f4,_0x2da9bc['message']));});});};exports[_0x79bc('0x28')]=function(_0x4d70d1){var _0x17808c=this;return new Promise(function(_0x265901,_0x1587fb){return db[_0x79bc('0x29')][_0x79bc('0x2a')]({'raw':_0x4d70d1['options']?_0x4d70d1[_0x79bc('0x20')][_0x79bc('0x2b')]===undefined?!![]:![]:!![],'where':_0x4d70d1[_0x79bc('0x20')]?_0x4d70d1[_0x79bc('0x20')]['where']||null:null,'attributes':_0x4d70d1[_0x79bc('0x20')]?_0x4d70d1[_0x79bc('0x20')]['attributes']||null:null,'include':_0x4d70d1[_0x79bc('0x20')]?_0x4d70d1[_0x79bc('0x20')][_0x79bc('0x24')]?_['map'](_0x4d70d1[_0x79bc('0x20')][_0x79bc('0x24')],function(_0x3209d2){return{'model':db[_0x3209d2['model']],'as':_0x3209d2['as'],'attributes':_0x3209d2[_0x79bc('0x22')],'include':_0x3209d2['include']?_['map'](_0x3209d2[_0x79bc('0x24')],function(_0x47c36d){return{'model':db[_0x47c36d[_0x79bc('0x26')]],'as':_0x47c36d['as'],'attributes':_0x47c36d[_0x79bc('0x22')],'include':_0x47c36d[_0x79bc('0x24')]?_[_0x79bc('0x25')](_0x47c36d[_0x79bc('0x24')],function(_0x4972d9){return{'model':db[_0x4972d9['model']],'as':_0x4972d9['as'],'attributes':_0x4972d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x79bc('0x27')](function(_0x45d5a6){logger[_0x79bc('0x13')]('ShowChatQueue',_0x4d70d1);logger[_0x79bc('0x16')]('ShowChatQueue',_0x4d70d1,JSON['stringify'](_0x45d5a6));_0x265901(_0x45d5a6);})[_0x79bc('0x1d')](function(_0x413edb){logger[_0x79bc('0x19')](_0x79bc('0x28'),_0x413edb[_0x79bc('0x1b')],_0x4d70d1);_0x1587fb(_0x17808c[_0x79bc('0x19')](0x1f4,_0x413edb[_0x79bc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5859607..6498a32 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 _0x0e85=['update','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x4d5c30,_0x594f37){var _0x5b7f8b=function(_0x4196aa){while(--_0x4196aa){_0x4d5c30['push'](_0x4d5c30['shift']());}};_0x5b7f8b(++_0x594f37);}(_0x0e85,0x7c));var _0x50e8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x0e85[_0x24f31b];return _0x488401;};'use strict';var ChatQueueEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatQueueEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatQueueEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x4d6bce,_0x62fd0e){var _0x287399=function(_0x37bf32){while(--_0x37bf32){_0x4d6bce['push'](_0x4d6bce['shift']());}};_0x287399(++_0x62fd0e);}(_0x54ef,0x112));var _0xf54e=function(_0x1bb786,_0x22b392){_0x1bb786=_0x1bb786-0x0;var _0x21263f=_0x54ef[_0x1bb786];return _0x21263f;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e3e71b7..fbdcdb1 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x5fc3[_0x43a5c7];return _0x3b12a2;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x501b84,_0x2e173f){var _0x34f5b5=function(_0x499a09){while(--_0x499a09){_0x501b84['push'](_0x501b84['shift']());}};_0x34f5b5(++_0x2e173f);}(_0x814b,0x1a2));var _0xb814=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x814b[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 326d52e..3ac675a 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 _0x27d0=['moment','sequelize','STRING','DATE'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x27d0,0x84));var _0x027d=function(_0x49a890,_0x4a88e9){_0x49a890=_0x49a890-0x0;var _0x13b168=_0x27d0[_0x49a890];return _0x13b168;};'use strict';var moment=require(_0x027d('0x0'));var Sequelize=require(_0x027d('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x027d('0x2')]},'joinAt':{'type':Sequelize[_0x027d('0x3')]},'leaveAt':{'type':Sequelize[_0x027d('0x3')]},'acceptAt':{'type':Sequelize[_0x027d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4b6=['DATE','sequelize','exports','STRING'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xf4b6,0x85));var _0x6f4b=function(_0x1c7136,_0x4bb9c4){_0x1c7136=_0x1c7136-0x0;var _0x401f8c=_0xf4b6[_0x1c7136];return _0x401f8c;};'use strict';var moment=require('moment');var Sequelize=require(_0x6f4b('0x0'));module[_0x6f4b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6f4b('0x2')]},'joinAt':{'type':Sequelize[_0x6f4b('0x3')]},'leaveAt':{'type':Sequelize[_0x6f4b('0x3')]},'acceptAt':{'type':Sequelize[_0x6f4b('0x3')]},'exitAt':{'type':Sequelize[_0x6f4b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e9ab908..a0dbe24 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 _0xa3fe=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe'];(function(_0x1efdd9,_0x48abbe){var _0x2aa04c=function(_0x23974e){while(--_0x23974e){_0x1efdd9['push'](_0x1efdd9['shift']());}};_0x2aa04c(++_0x48abbe);}(_0xa3fe,0xd8));var _0xea3f=function(_0x3a0ad9,_0x106f96){_0x3a0ad9=_0x3a0ad9-0x0;var _0x37ce43=_0xa3fe[_0x3a0ad9];return _0x37ce43;};'use strict';var emlformat=require(_0xea3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea3f('0x1'));var jsonpatch=require(_0xea3f('0x2'));var rp=require('request-promise');var moment=require(_0xea3f('0x3'));var BPromise=require(_0xea3f('0x4'));var Mustache=require(_0xea3f('0x5'));var util=require('util');var path=require(_0xea3f('0x6'));var sox=require('sox');var csv=require(_0xea3f('0x7'));var ejs=require(_0xea3f('0x8'));var fs=require('fs');var fs_extra=require(_0xea3f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xea3f('0xa'));var jsforce=require(_0xea3f('0xb'));var deskjs=require(_0xea3f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea3f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea3f('0xe'));var as=require(_0xea3f('0xf'));var hardwareService=require(_0xea3f('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xea3f('0x11'));var licenseUtil=require(_0xea3f('0x12'));var db=require(_0xea3f('0x13'))['db'];function respondWithStatusCode(_0x363046,_0x4a36da){_0x4a36da=_0x4a36da||0xcc;return function(_0x5afd23){if(_0x5afd23){return _0x363046['sendStatus'](_0x4a36da);}return _0x363046[_0xea3f('0x14')](_0x4a36da)[_0xea3f('0x15')]();};}function respondWithResult(_0x5b246b,_0x260985){_0x260985=_0x260985||0xc8;return function(_0x393dac){if(_0x393dac){return _0x5b246b['status'](_0x260985)[_0xea3f('0x16')](_0x393dac);}};}function respondWithFilteredResult(_0x307409,_0x153f0e){return function(_0x4becc3){if(_0x4becc3){var _0x32c2f=typeof _0x153f0e[_0xea3f('0x17')]===_0xea3f('0x18')&&typeof _0x153f0e[_0xea3f('0x19')]===_0xea3f('0x18');var _0x403fd2=_0x4becc3[_0xea3f('0x1a')];var _0x31b8ca=_0x32c2f?0x0:_0x153f0e[_0xea3f('0x17')];var _0x116d13=_0x32c2f?_0x4becc3[_0xea3f('0x1a')]:_0x153f0e[_0xea3f('0x17')]+_0x153f0e[_0xea3f('0x19')];var _0x35153d;if(_0x116d13>=_0x403fd2){_0x116d13=_0x403fd2;_0x35153d=0xc8;}else{_0x35153d=0xce;}_0x307409['status'](_0x35153d);return _0x307409[_0xea3f('0x1b')](_0xea3f('0x1c'),_0x31b8ca+'-'+_0x116d13+'/'+_0x403fd2)[_0xea3f('0x16')](_0x4becc3);}return null;};}function patchUpdates(_0xe50958){return function(_0x11f66c){try{jsonpatch['apply'](_0x11f66c,_0xe50958,!![]);}catch(_0x4af6e4){return BPromise[_0xea3f('0x1d')](_0x4af6e4);}return _0x11f66c[_0xea3f('0x1e')]();};}function saveUpdates(_0x4c6d50,_0x284f3b){return function(_0x1cc3c8){if(_0x1cc3c8){return _0x1cc3c8[_0xea3f('0x1f')](_0x4c6d50)[_0xea3f('0x20')](function(_0x5f452b){return _0x5f452b;});}return null;};}function removeEntity(_0x5bd381,_0x5c2eb0){return function(_0x2f8bdc){if(_0x2f8bdc){return _0x2f8bdc[_0xea3f('0x21')]()[_0xea3f('0x20')](function(){_0x5bd381[_0xea3f('0x14')](0xcc)[_0xea3f('0x15')]();});}};}function handleEntityNotFound(_0x11df76,_0x3f07d5){return function(_0x55a32d){if(!_0x55a32d){_0x11df76[_0xea3f('0x22')](0x194);}return _0x55a32d;};}function handleError(_0x4a111b,_0x29de3c){_0x29de3c=_0x29de3c||0x1f4;return function(_0x22cd02){logger[_0xea3f('0x23')](_0x22cd02[_0xea3f('0x24')]);if(_0x22cd02[_0xea3f('0x25')]){delete _0x22cd02['name'];}_0x4a111b[_0xea3f('0x14')](_0x29de3c)['send'](_0x22cd02);};}exports[_0xea3f('0x26')]=function(_0x9413e5,_0x20e014){var _0x4cd4e9={},_0x437070={},_0x10c397={'count':0x0,'rows':[]};var _0x59ec90=_[_0xea3f('0x27')](db[_0xea3f('0x28')][_0xea3f('0x29')],function(_0x391828){return{'name':_0x391828[_0xea3f('0x2a')],'type':_0x391828[_0xea3f('0x2b')][_0xea3f('0x2c')]};});_0x437070[_0xea3f('0x2d')]=_[_0xea3f('0x27')](_0x59ec90,_0xea3f('0x25'));_0x437070[_0xea3f('0x2e')]=_[_0xea3f('0x2f')](_0x9413e5[_0xea3f('0x2e')]);_0x437070[_0xea3f('0x30')]=_[_0xea3f('0x31')](_0x437070[_0xea3f('0x2d')],_0x437070[_0xea3f('0x2e')]);_0x4cd4e9[_0xea3f('0x32')]=_[_0xea3f('0x31')](_0x437070['model'],qs[_0xea3f('0x33')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x33')]));_0x4cd4e9[_0xea3f('0x32')]=_0x4cd4e9[_0xea3f('0x32')][_0xea3f('0x34')]?_0x4cd4e9[_0xea3f('0x32')]:_0x437070[_0xea3f('0x2d')];if(!_0x9413e5[_0xea3f('0x2e')]['hasOwnProperty'](_0xea3f('0x35'))){_0x4cd4e9[_0xea3f('0x19')]=qs[_0xea3f('0x19')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x19')]);_0x4cd4e9['offset']=qs['offset'](_0x9413e5[_0xea3f('0x2e')]['offset']);}_0x4cd4e9[_0xea3f('0x36')]=qs[_0xea3f('0x37')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x37')]);_0x4cd4e9[_0xea3f('0x38')]=qs[_0xea3f('0x30')](_['pick'](_0x9413e5[_0xea3f('0x2e')],_0x437070['filters']),_0x59ec90);if(_0x9413e5['query'][_0xea3f('0x39')]){_0x4cd4e9[_0xea3f('0x38')]=_[_0xea3f('0x3a')](_0x4cd4e9[_0xea3f('0x38')],{'$or':_[_0xea3f('0x27')](_0x59ec90,function(_0x352402){if(_0x352402[_0xea3f('0x2b')]!==_0xea3f('0x3b')){var _0x365033={};_0x365033[_0x352402[_0xea3f('0x25')]]={'$like':'%'+_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x39')]+'%'};return _0x365033;}})});}_0x4cd4e9=_[_0xea3f('0x3a')]({},_0x4cd4e9,_0x9413e5['options']);var _0xb7d4e5={'where':_0x4cd4e9['where']};return db[_0xea3f('0x28')][_0xea3f('0x1a')](_0xb7d4e5)[_0xea3f('0x20')](function(_0xea73b8){_0x10c397[_0xea3f('0x1a')]=_0xea73b8;if(_0x9413e5['query'][_0xea3f('0x3c')]){_0x4cd4e9['include']=[{'all':!![]}];}return db[_0xea3f('0x28')][_0xea3f('0x3d')](_0x4cd4e9);})[_0xea3f('0x20')](function(_0x26b06a){_0x10c397[_0xea3f('0x3e')]=_0x26b06a;return _0x10c397;})[_0xea3f('0x20')](respondWithFilteredResult(_0x20e014,_0x4cd4e9))[_0xea3f('0x3f')](handleError(_0x20e014,null));};exports[_0xea3f('0x40')]=function(_0x2a61e4,_0x2c018c){var _0x411e4a={'raw':!![],'where':{'id':_0x2a61e4[_0xea3f('0x41')]['id']}},_0x410250={};_0x410250[_0xea3f('0x2d')]=_[_0xea3f('0x2f')](db['ChatQueueReport'][_0xea3f('0x29')]);_0x410250['query']=_[_0xea3f('0x2f')](_0x2a61e4['query']);_0x410250[_0xea3f('0x30')]=_[_0xea3f('0x31')](_0x410250['model'],_0x410250[_0xea3f('0x2e')]);_0x411e4a[_0xea3f('0x32')]=_['intersection'](_0x410250[_0xea3f('0x2d')],qs[_0xea3f('0x33')](_0x2a61e4[_0xea3f('0x2e')]['fields']));_0x411e4a[_0xea3f('0x32')]=_0x411e4a[_0xea3f('0x32')][_0xea3f('0x34')]?_0x411e4a[_0xea3f('0x32')]:_0x410250[_0xea3f('0x2d')];if(_0x2a61e4[_0xea3f('0x2e')][_0xea3f('0x3c')]){_0x411e4a[_0xea3f('0x42')]=[{'all':!![]}];}_0x411e4a=_[_0xea3f('0x3a')]({},_0x411e4a,_0x2a61e4[_0xea3f('0x43')]);return db[_0xea3f('0x28')][_0xea3f('0x44')](_0x411e4a)[_0xea3f('0x20')](handleEntityNotFound(_0x2c018c,null))[_0xea3f('0x20')](respondWithResult(_0x2c018c,null))['catch'](handleError(_0x2c018c,null));};exports['create']=function(_0x7f50cd,_0x521d33){return db[_0xea3f('0x28')][_0xea3f('0x45')](_0x7f50cd['body'],{})['then'](respondWithResult(_0x521d33,0xc9))['catch'](handleError(_0x521d33,null));};exports['update']=function(_0xcad7cb,_0x302fc0){if(_0xcad7cb[_0xea3f('0x46')]['id']){delete _0xcad7cb[_0xea3f('0x46')]['id'];}return db[_0xea3f('0x28')][_0xea3f('0x44')]({'where':{'id':_0xcad7cb['params']['id']}})[_0xea3f('0x20')](handleEntityNotFound(_0x302fc0,null))['then'](saveUpdates(_0xcad7cb[_0xea3f('0x46')],null))[_0xea3f('0x20')](respondWithResult(_0x302fc0,null))['catch'](handleError(_0x302fc0,null));};exports[_0xea3f('0x21')]=function(_0x3d261c,_0x5b0ca1){return db[_0xea3f('0x28')][_0xea3f('0x44')]({'where':{'id':_0x3d261c[_0xea3f('0x41')]['id']}})[_0xea3f('0x20')](handleEntityNotFound(_0x5b0ca1,null))[_0xea3f('0x20')](removeEntity(_0x5b0ca1,null))[_0xea3f('0x3f')](handleError(_0x5b0ca1,null));};exports[_0xea3f('0x47')]=function(_0x180620,_0x40ae4b){return db[_0xea3f('0x28')][_0xea3f('0x47')]()[_0xea3f('0x20')](respondWithResult(_0x40ae4b,null))[_0xea3f('0x3f')](handleError(_0x40ae4b,null));}; \ No newline at end of file +var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','ChatQueueReport','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x626517,_0x45895d){var _0x12d579=function(_0x130787){while(--_0x130787){_0x626517['push'](_0x626517['shift']());}};_0x12d579(++_0x45895d);}(_0xafc4,0x69));var _0x4afc=function(_0x3e79ea,_0x3367ab){_0x3e79ea=_0x3e79ea-0x0;var _0x318d9e=_0xafc4[_0x3e79ea];return _0x318d9e;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['ChatQueueReport'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['ChatQueueReport']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 835e75f..6de28f2 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2ea20d,_0x5e8e3c){var _0x3ba66a=function(_0x164ca6){while(--_0x164ca6){_0x2ea20d['push'](_0x2ea20d['shift']());}};_0x3ba66a(++_0x5e8e3c);}(_0xb10b,0x12a));var _0xbb10=function(_0x17eec6,_0x54a955){_0x17eec6=_0x17eec6-0x0;var _0x1e4d32=_0xb10b[_0x17eec6];return _0x1e4d32;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x542fa7,_0x4d89ef){var _0xbc8fa6=function(_0x4afb38){while(--_0x4afb38){_0x542fa7['push'](_0x542fa7['shift']());}};_0xbc8fa6(++_0x4d89ef);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'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_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b970d1f..6b92934 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 _0xfd46=['request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','body','options','UpdateChatQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x2b469e,_0x587bc0){var _0x433ed2=function(_0xf3386e){while(--_0xf3386e){_0x2b469e['push'](_0x2b469e['shift']());}};_0x433ed2(++_0x587bc0);}(_0xfd46,0x176));var _0x6fd4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfd46[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x6fd4('0x0'));var util=require('util');var moment=require(_0x6fd4('0x1'));var BPromise=require(_0x6fd4('0x2'));var rs=require(_0x6fd4('0x3'));var fs=require('fs');var Redis=require(_0x6fd4('0x4'));var db=require(_0x6fd4('0x5'))['db'];var utils=require(_0x6fd4('0x6'));var logger=require(_0x6fd4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6fd4('0x8')][_0x6fd4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ae977,_0x51cb27,_0x3a9b0c){return new BPromise(function(_0x5f3c84,_0x114bf1){return client[_0x6fd4('0xa')](_0x2ae977,_0x3a9b0c)[_0x6fd4('0xb')](function(_0x5d61b1){logger[_0x6fd4('0xc')](_0x6fd4('0xd'),_0x51cb27,_0x6fd4('0xe'));logger[_0x6fd4('0xf')](_0x6fd4('0x10'),_0x51cb27,'request\x20sent',JSON[_0x6fd4('0x11')](_0x5d61b1));if(_0x5d61b1[_0x6fd4('0x12')]){if(_0x5d61b1['error'][_0x6fd4('0x13')]===0x1f4){logger[_0x6fd4('0x12')](_0x6fd4('0xd'),_0x51cb27,_0x5d61b1[_0x6fd4('0x12')][_0x6fd4('0x14')]);return _0x114bf1(_0x5d61b1[_0x6fd4('0x12')][_0x6fd4('0x14')]);}logger[_0x6fd4('0x12')](_0x6fd4('0xd'),_0x51cb27,_0x5d61b1[_0x6fd4('0x12')][_0x6fd4('0x14')]);return _0x5f3c84(_0x5d61b1['error']['message']);}else{logger[_0x6fd4('0xc')](_0x6fd4('0xd'),_0x51cb27,_0x6fd4('0xe'));_0x5f3c84(_0x5d61b1[_0x6fd4('0x15')][_0x6fd4('0x14')]);}})[_0x6fd4('0x16')](function(_0x18a868){logger[_0x6fd4('0x12')](_0x6fd4('0xd'),_0x51cb27,_0x18a868);_0x114bf1(_0x18a868);});});}exports[_0x6fd4('0x17')]=function(_0x4d77d3){var _0x2d9484=this;return new Promise(function(_0x2c956c,_0x4832bc){return db['ChatQueueReport']['create'](_0x4d77d3[_0x6fd4('0x18')],{'raw':_0x4d77d3[_0x6fd4('0x19')]?_0x4d77d3[_0x6fd4('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d2afc){logger['info'](_0x6fd4('0x17'),_0x4d77d3);logger['debug'](_0x6fd4('0x17'),_0x4d77d3,JSON['stringify'](_0x3d2afc));_0x2c956c(_0x3d2afc);})[_0x6fd4('0x16')](function(_0x202410){logger[_0x6fd4('0x12')](_0x6fd4('0x17'),_0x202410[_0x6fd4('0x14')],_0x4d77d3);_0x4832bc(_0x2d9484['error'](0x1f4,_0x202410['message']));});});};exports[_0x6fd4('0x1a')]=function(_0x5b91f9){var _0x590d73=this;return new Promise(function(_0x53dfe0,_0x40c7a3){return db['ChatQueueReport'][_0x6fd4('0x1b')](_0x5b91f9[_0x6fd4('0x18')],{'raw':_0x5b91f9[_0x6fd4('0x19')]?_0x5b91f9[_0x6fd4('0x19')][_0x6fd4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b91f9[_0x6fd4('0x19')]?_0x5b91f9[_0x6fd4('0x19')][_0x6fd4('0x1d')]||null:null,'attributes':_0x5b91f9[_0x6fd4('0x19')]?_0x5b91f9[_0x6fd4('0x19')][_0x6fd4('0x1e')]||null:null,'limit':_0x5b91f9[_0x6fd4('0x19')]?_0x5b91f9['options'][_0x6fd4('0x1f')]||null:null})['then'](function(_0x26fb48){logger[_0x6fd4('0xc')]('UpdateChatQueueReport',_0x5b91f9);logger[_0x6fd4('0xf')](_0x6fd4('0x1a'),_0x5b91f9,JSON[_0x6fd4('0x11')](_0x26fb48));_0x53dfe0(_0x26fb48);})[_0x6fd4('0x16')](function(_0x3cf724){logger['error'](_0x6fd4('0x1a'),_0x3cf724['message'],_0x5b91f9);_0x40c7a3(_0x590d73['error'](0x1f4,_0x3cf724[_0x6fd4('0x14')]));});});}; \ No newline at end of file +var _0xe157=['body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0xe157,0x1f2));var _0x7e15=function(_0x1fa478,_0x95b11c){_0x1fa478=_0x1fa478-0x0;var _0x566766=_0xe157[_0x1fa478];return _0x566766;};'use strict';var _=require('lodash');var util=require(_0x7e15('0x0'));var moment=require(_0x7e15('0x1'));var BPromise=require(_0x7e15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e15('0x3'));var db=require(_0x7e15('0x4'))['db'];var utils=require(_0x7e15('0x5'));var logger=require(_0x7e15('0x6'))(_0x7e15('0x7'));var config=require(_0x7e15('0x8'));var jayson=require(_0x7e15('0x9'));var client=jayson[_0x7e15('0xa')][_0x7e15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3461bd,_0x3f2f12,_0x3bb872){return new BPromise(function(_0x3273a3,_0x16c62b){return client['request'](_0x3461bd,_0x3bb872)[_0x7e15('0xc')](function(_0x2b3a6c){logger[_0x7e15('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3f2f12,_0x7e15('0xe'));logger[_0x7e15('0xf')](_0x7e15('0x10'),_0x3f2f12,_0x7e15('0xe'),JSON[_0x7e15('0x11')](_0x2b3a6c));if(_0x2b3a6c[_0x7e15('0x12')]){if(_0x2b3a6c[_0x7e15('0x12')][_0x7e15('0x13')]===0x1f4){logger[_0x7e15('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3f2f12,_0x2b3a6c[_0x7e15('0x12')][_0x7e15('0x14')]);return _0x16c62b(_0x2b3a6c['error']['message']);}logger[_0x7e15('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3f2f12,_0x2b3a6c[_0x7e15('0x12')][_0x7e15('0x14')]);return _0x3273a3(_0x2b3a6c[_0x7e15('0x12')][_0x7e15('0x14')]);}else{logger[_0x7e15('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3f2f12,_0x7e15('0xe'));_0x3273a3(_0x2b3a6c[_0x7e15('0x15')][_0x7e15('0x14')]);}})[_0x7e15('0x16')](function(_0x561999){logger['error'](_0x7e15('0x17'),_0x3f2f12,_0x561999);_0x16c62b(_0x561999);});});}exports[_0x7e15('0x18')]=function(_0x4ca9cc){var _0x332338=this;return new Promise(function(_0x3b40a9,_0x35f48d){return db[_0x7e15('0x19')][_0x7e15('0x1a')](_0x4ca9cc[_0x7e15('0x1b')],{'raw':_0x4ca9cc['options']?_0x4ca9cc[_0x7e15('0x1c')][_0x7e15('0x1d')]===undefined?!![]:![]:!![]})[_0x7e15('0xc')](function(_0x427e26){logger['info'](_0x7e15('0x18'),_0x4ca9cc);logger[_0x7e15('0xf')](_0x7e15('0x18'),_0x4ca9cc,JSON[_0x7e15('0x11')](_0x427e26));_0x3b40a9(_0x427e26);})[_0x7e15('0x16')](function(_0x166f91){logger[_0x7e15('0x12')](_0x7e15('0x18'),_0x166f91[_0x7e15('0x14')],_0x4ca9cc);_0x35f48d(_0x332338[_0x7e15('0x12')](0x1f4,_0x166f91[_0x7e15('0x14')]));});});};exports[_0x7e15('0x1e')]=function(_0x4215e5){var _0x1b2a67=this;return new Promise(function(_0x2aaacc,_0x544c9e){return db[_0x7e15('0x19')][_0x7e15('0x1f')](_0x4215e5['body'],{'raw':_0x4215e5[_0x7e15('0x1c')]?_0x4215e5[_0x7e15('0x1c')][_0x7e15('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4215e5['options']?_0x4215e5[_0x7e15('0x1c')][_0x7e15('0x20')]||null:null,'attributes':_0x4215e5[_0x7e15('0x1c')]?_0x4215e5[_0x7e15('0x1c')][_0x7e15('0x21')]||null:null,'limit':_0x4215e5[_0x7e15('0x1c')]?_0x4215e5['options'][_0x7e15('0x22')]||null:null})[_0x7e15('0xc')](function(_0x4528d5){logger[_0x7e15('0xd')](_0x7e15('0x1e'),_0x4215e5);logger[_0x7e15('0xf')](_0x7e15('0x1e'),_0x4215e5,JSON[_0x7e15('0x11')](_0x4528d5));_0x2aaacc(_0x4528d5);})[_0x7e15('0x16')](function(_0x1e23d5){logger[_0x7e15('0x12')](_0x7e15('0x1e'),_0x1e23d5[_0x7e15('0x14')],_0x4215e5);_0x544c9e(_0x1b2a67[_0x7e15('0x12')](0x1f4,_0x1e23d5[_0x7e15('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 49f8e4a..500e98b 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 _0x63b0=['describe','/:id','show','post','create','put','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x40a90d,_0x5a8c17){var _0x2957f8=function(_0x2053b5){while(--_0x2053b5){_0x40a90d['push'](_0x40a90d['shift']());}};_0x2957f8(++_0x5a8c17);}(_0x63b0,0x7f));var _0x063b=function(_0x12a408,_0x2ff898){_0x12a408=_0x12a408-0x0;var _0xe04c9d=_0x63b0[_0x12a408];return _0xe04c9d;};'use strict';var multer=require('multer');var util=require(_0x063b('0x0'));var path=require(_0x063b('0x1'));var timeout=require('connect-timeout');var express=require(_0x063b('0x2'));var router=express['Router']();var fs_extra=require(_0x063b('0x3'));var auth=require(_0x063b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x063b('0x5'));var controller=require(_0x063b('0x6'));router[_0x063b('0x7')]('/',auth[_0x063b('0x8')](),controller['index']);router[_0x063b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x063b('0x9')]);router['get'](_0x063b('0xa'),auth[_0x063b('0x8')](),controller[_0x063b('0xb')]);router[_0x063b('0xc')]('/',auth['isAuthenticated'](),controller[_0x063b('0xd')]);router[_0x063b('0xe')](_0x063b('0xa'),auth[_0x063b('0x8')](),controller['update']);router[_0x063b('0xf')]('/:id',auth[_0x063b('0x8')](),controller['destroy']);module[_0x063b('0x10')]=router; \ No newline at end of file +var _0x00a4=['isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0x471b53,_0x4ddaec){var _0x3c8fe8=function(_0x2af33f){while(--_0x2af33f){_0x471b53['push'](_0x471b53['shift']());}};_0x3c8fe8(++_0x4ddaec);}(_0x00a4,0x1c4));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x400a('0x0'));var util=require(_0x400a('0x1'));var path=require('path');var timeout=require(_0x400a('0x2'));var express=require(_0x400a('0x3'));var router=express[_0x400a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x400a('0x5'));var interaction=require(_0x400a('0x6'));var config=require(_0x400a('0x7'));var controller=require(_0x400a('0x8'));router[_0x400a('0x9')]('/',auth[_0x400a('0xa')](),controller['index']);router[_0x400a('0x9')](_0x400a('0xb'),auth[_0x400a('0xa')](),controller[_0x400a('0xc')]);router[_0x400a('0x9')](_0x400a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x400a('0xe')]('/',auth['isAuthenticated'](),controller[_0x400a('0xf')]);router[_0x400a('0x10')](_0x400a('0xd'),auth[_0x400a('0xa')](),controller[_0x400a('0x11')]);router[_0x400a('0x12')](_0x400a('0xd'),auth[_0x400a('0xa')](),controller[_0x400a('0x13')]);module[_0x400a('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dd57afd..1ac1a39 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x2d5cb7,_0x4535b0){var _0x374ce6=function(_0x3f7fec){while(--_0x3f7fec){_0x2d5cb7['push'](_0x2d5cb7['shift']());}};_0x374ce6(++_0x4535b0);}(_0xe706,0xa3));var _0x6e70=function(_0x519de3,_0xe7c04e){_0x519de3=_0x519de3-0x0;var _0x3e21d9=_0xe706[_0x519de3];return _0x3e21d9;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x163874,_0xb045df){var _0x42bb8d=function(_0xca7cf4){while(--_0xca7cf4){_0x163874['push'](_0x163874['shift']());}};_0x42bb8d(++_0xb045df);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcb91[_0x34d275];return _0x1379cc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d56ba62..2a77591 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 _0x824c=['pick','filter','merge','options','include','findAll','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where'];(function(_0x444e61,_0x39bf0f){var _0x4a16bd=function(_0x40a619){while(--_0x40a619){_0x444e61['push'](_0x444e61['shift']());}};_0x4a16bd(++_0x39bf0f);}(_0x824c,0xe3));var _0xc824=function(_0x14b0b3,_0x52eb72){_0x14b0b3=_0x14b0b3-0x0;var _0x33c5ca=_0x824c[_0x14b0b3];return _0x33c5ca;};'use strict';var emlformat=require(_0xc824('0x0'));var rimraf=require(_0xc824('0x1'));var zipdir=require(_0xc824('0x2'));var jsonpatch=require(_0xc824('0x3'));var rp=require(_0xc824('0x4'));var moment=require(_0xc824('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc824('0x6'));var sox=require(_0xc824('0x7'));var csv=require(_0xc824('0x8'));var ejs=require(_0xc824('0x9'));var fs=require('fs');var fs_extra=require(_0xc824('0xa'));var _=require(_0xc824('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc824('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc824('0x8'));var querystring=require('querystring');var Papa=require(_0xc824('0xd'));var Redis=require(_0xc824('0xe'));var authService=require(_0xc824('0xf'));var qs=require(_0xc824('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc824('0x11'))(_0xc824('0x12'));var utils=require(_0xc824('0x13'));var config=require(_0xc824('0x14'));var licenseUtil=require(_0xc824('0x15'));var db=require(_0xc824('0x16'))['db'];function respondWithStatusCode(_0x4d4e0c,_0x1e9f48){_0x1e9f48=_0x1e9f48||0xcc;return function(_0x42c07e){if(_0x42c07e){return _0x4d4e0c[_0xc824('0x17')](_0x1e9f48);}return _0x4d4e0c[_0xc824('0x18')](_0x1e9f48)[_0xc824('0x19')]();};}function respondWithResult(_0xc58201,_0xebd9e8){_0xebd9e8=_0xebd9e8||0xc8;return function(_0xa1f645){if(_0xa1f645){return _0xc58201[_0xc824('0x18')](_0xebd9e8)['json'](_0xa1f645);}};}function respondWithFilteredResult(_0xee2755,_0x497a95){return function(_0x2cdfa5){if(_0x2cdfa5){var _0x1412c2=typeof _0x497a95['offset']==='undefined'&&typeof _0x497a95['limit']===_0xc824('0x1a');var _0x2d2925=_0x2cdfa5['count'];var _0x168037=_0x1412c2?0x0:_0x497a95[_0xc824('0x1b')];var _0xae790b=_0x1412c2?_0x2cdfa5[_0xc824('0x1c')]:_0x497a95['offset']+_0x497a95[_0xc824('0x1d')];var _0x3b08af;if(_0xae790b>=_0x2d2925){_0xae790b=_0x2d2925;_0x3b08af=0xc8;}else{_0x3b08af=0xce;}_0xee2755[_0xc824('0x18')](_0x3b08af);return _0xee2755['set'](_0xc824('0x1e'),_0x168037+'-'+_0xae790b+'/'+_0x2d2925)[_0xc824('0x1f')](_0x2cdfa5);}return null;};}function patchUpdates(_0xd11a26){return function(_0x16691a){try{jsonpatch[_0xc824('0x20')](_0x16691a,_0xd11a26,!![]);}catch(_0x15f8a3){return BPromise[_0xc824('0x21')](_0x15f8a3);}return _0x16691a[_0xc824('0x22')]();};}function saveUpdates(_0x1910e3,_0xeccd8a){return function(_0x358418){if(_0x358418){return _0x358418['update'](_0x1910e3)[_0xc824('0x23')](function(_0x4e4f){return _0x4e4f;});}return null;};}function removeEntity(_0x2ec259,_0x579bd4){return function(_0x31eda0){if(_0x31eda0){return _0x31eda0[_0xc824('0x24')]()[_0xc824('0x23')](function(){_0x2ec259['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f31dc,_0x490b8f){return function(_0x2e6309){if(!_0x2e6309){_0x5f31dc[_0xc824('0x17')](0x194);}return _0x2e6309;};}function handleError(_0xd3405,_0x5a10a0){_0x5a10a0=_0x5a10a0||0x1f4;return function(_0x2b1789){logger['error'](_0x2b1789[_0xc824('0x25')]);if(_0x2b1789['name']){delete _0x2b1789[_0xc824('0x26')];}_0xd3405[_0xc824('0x18')](_0x5a10a0)['send'](_0x2b1789);};}exports[_0xc824('0x27')]=function(_0x6e8085,_0x2de3b7){var _0x409eb7={},_0x54c1dc={},_0x3a8f92={'count':0x0,'rows':[]};var _0x5d90ed=_[_0xc824('0x28')](db[_0xc824('0x29')][_0xc824('0x2a')],function(_0x5baf0e){return{'name':_0x5baf0e[_0xc824('0x2b')],'type':_0x5baf0e[_0xc824('0x2c')]['key']};});_0x54c1dc['model']=_[_0xc824('0x28')](_0x5d90ed,'name');_0x54c1dc['query']=_[_0xc824('0x2d')](_0x6e8085['query']);_0x54c1dc[_0xc824('0x2e')]=_[_0xc824('0x2f')](_0x54c1dc[_0xc824('0x30')],_0x54c1dc['query']);_0x409eb7[_0xc824('0x31')]=_[_0xc824('0x2f')](_0x54c1dc[_0xc824('0x30')],qs[_0xc824('0x32')](_0x6e8085[_0xc824('0x33')][_0xc824('0x32')]));_0x409eb7[_0xc824('0x31')]=_0x409eb7[_0xc824('0x31')][_0xc824('0x34')]?_0x409eb7['attributes']:_0x54c1dc[_0xc824('0x30')];if(!_0x6e8085['query'][_0xc824('0x35')](_0xc824('0x36'))){_0x409eb7[_0xc824('0x1d')]=qs['limit'](_0x6e8085[_0xc824('0x33')][_0xc824('0x1d')]);_0x409eb7[_0xc824('0x1b')]=qs['offset'](_0x6e8085['query'][_0xc824('0x1b')]);}_0x409eb7['order']=qs[_0xc824('0x37')](_0x6e8085[_0xc824('0x33')][_0xc824('0x37')]);_0x409eb7[_0xc824('0x38')]=qs[_0xc824('0x2e')](_[_0xc824('0x39')](_0x6e8085[_0xc824('0x33')],_0x54c1dc[_0xc824('0x2e')]),_0x5d90ed);if(_0x6e8085[_0xc824('0x33')][_0xc824('0x3a')]){_0x409eb7[_0xc824('0x38')]=_[_0xc824('0x3b')](_0x409eb7[_0xc824('0x38')],{'$or':_[_0xc824('0x28')](_0x5d90ed,function(_0x4bbdf3){if(_0x4bbdf3[_0xc824('0x2c')]!=='VIRTUAL'){var _0x333430={};_0x333430[_0x4bbdf3['name']]={'$like':'%'+_0x6e8085[_0xc824('0x33')]['filter']+'%'};return _0x333430;}})});}_0x409eb7=_['merge']({},_0x409eb7,_0x6e8085[_0xc824('0x3c')]);var _0x530a9c={'where':_0x409eb7[_0xc824('0x38')]};return db[_0xc824('0x29')][_0xc824('0x1c')](_0x530a9c)[_0xc824('0x23')](function(_0x12c00d){_0x3a8f92[_0xc824('0x1c')]=_0x12c00d;if(_0x6e8085['query']['includeAll']){_0x409eb7[_0xc824('0x3d')]=[{'all':!![]}];}return db[_0xc824('0x29')][_0xc824('0x3e')](_0x409eb7);})[_0xc824('0x23')](function(_0x2a6127){_0x3a8f92['rows']=_0x2a6127;return _0x3a8f92;})['then'](respondWithFilteredResult(_0x2de3b7,_0x409eb7))[_0xc824('0x3f')](handleError(_0x2de3b7,null));};exports[_0xc824('0x40')]=function(_0x5f5d19,_0x24c472){var _0x323589={'raw':!![],'where':{'id':_0x5f5d19['params']['id']}},_0x1ffdec={};_0x1ffdec[_0xc824('0x30')]=_[_0xc824('0x2d')](db[_0xc824('0x29')][_0xc824('0x2a')]);_0x1ffdec['query']=_[_0xc824('0x2d')](_0x5f5d19[_0xc824('0x33')]);_0x1ffdec[_0xc824('0x2e')]=_[_0xc824('0x2f')](_0x1ffdec[_0xc824('0x30')],_0x1ffdec[_0xc824('0x33')]);_0x323589[_0xc824('0x31')]=_[_0xc824('0x2f')](_0x1ffdec[_0xc824('0x30')],qs[_0xc824('0x32')](_0x5f5d19[_0xc824('0x33')][_0xc824('0x32')]));_0x323589['attributes']=_0x323589[_0xc824('0x31')][_0xc824('0x34')]?_0x323589[_0xc824('0x31')]:_0x1ffdec[_0xc824('0x30')];if(_0x5f5d19[_0xc824('0x33')]['includeAll']){_0x323589[_0xc824('0x3d')]=[{'all':!![]}];}_0x323589=_[_0xc824('0x3b')]({},_0x323589,_0x5f5d19[_0xc824('0x3c')]);return db[_0xc824('0x29')][_0xc824('0x41')](_0x323589)['then'](handleEntityNotFound(_0x24c472,null))['then'](respondWithResult(_0x24c472,null))[_0xc824('0x3f')](handleError(_0x24c472,null));};exports[_0xc824('0x42')]=function(_0x4121c0,_0x18a42a){return db[_0xc824('0x29')][_0xc824('0x42')](_0x4121c0[_0xc824('0x43')],{})['then'](respondWithResult(_0x18a42a,0xc9))['catch'](handleError(_0x18a42a,null));};exports[_0xc824('0x44')]=function(_0x3fea47,_0x449767){if(_0x3fea47[_0xc824('0x43')]['id']){delete _0x3fea47['body']['id'];}return db[_0xc824('0x29')]['find']({'where':{'id':_0x3fea47[_0xc824('0x45')]['id']}})[_0xc824('0x23')](handleEntityNotFound(_0x449767,null))[_0xc824('0x23')](saveUpdates(_0x3fea47[_0xc824('0x43')],null))[_0xc824('0x23')](respondWithResult(_0x449767,null))[_0xc824('0x3f')](handleError(_0x449767,null));};exports['destroy']=function(_0xa070e0,_0x242ca4){return db[_0xc824('0x29')]['find']({'where':{'id':_0xa070e0[_0xc824('0x45')]['id']}})[_0xc824('0x23')](handleEntityNotFound(_0x242ca4,null))[_0xc824('0x23')](removeEntity(_0x242ca4,null))['catch'](handleError(_0x242ca4,null));};exports[_0xc824('0x46')]=function(_0x4c7407,_0x5ed571){return db[_0xc824('0x29')]['describe']()[_0xc824('0x23')](respondWithResult(_0x5ed571,null))['catch'](handleError(_0x5ed571,null));}; \ No newline at end of file +var _0x60ca=['send','index','map','ChatTransferReport','fieldName','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x60ca,0x71));var _0xa60c=function(_0x2f75a6,_0x2a57c7){_0x2f75a6=_0x2f75a6-0x0;var _0xfb964f=_0x60ca[_0x2f75a6];return _0xfb964f;};'use strict';var emlformat=require(_0xa60c('0x0'));var rimraf=require(_0xa60c('0x1'));var zipdir=require(_0xa60c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa60c('0x3'));var moment=require(_0xa60c('0x4'));var BPromise=require(_0xa60c('0x5'));var Mustache=require(_0xa60c('0x6'));var util=require(_0xa60c('0x7'));var path=require(_0xa60c('0x8'));var sox=require(_0xa60c('0x9'));var csv=require(_0xa60c('0xa'));var ejs=require(_0xa60c('0xb'));var fs=require('fs');var fs_extra=require(_0xa60c('0xc'));var _=require(_0xa60c('0xd'));var squel=require(_0xa60c('0xe'));var crypto=require(_0xa60c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa60c('0x10'));var toCsv=require(_0xa60c('0xa'));var querystring=require(_0xa60c('0x11'));var Papa=require(_0xa60c('0x12'));var Redis=require('ioredis');var authService=require(_0xa60c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa60c('0x14'));var hardwareService=require(_0xa60c('0x15'));var logger=require(_0xa60c('0x16'))(_0xa60c('0x17'));var utils=require(_0xa60c('0x18'));var config=require(_0xa60c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4adf36,_0x567aad){_0x567aad=_0x567aad||0xcc;return function(_0x93c397){if(_0x93c397){return _0x4adf36['sendStatus'](_0x567aad);}return _0x4adf36['status'](_0x567aad)[_0xa60c('0x1a')]();};}function respondWithResult(_0x40ae3e,_0x5f0b7e){_0x5f0b7e=_0x5f0b7e||0xc8;return function(_0x25086f){if(_0x25086f){return _0x40ae3e['status'](_0x5f0b7e)[_0xa60c('0x1b')](_0x25086f);}};}function respondWithFilteredResult(_0x17f596,_0xeaff5e){return function(_0x43a4ee){if(_0x43a4ee){var _0x381d5f=typeof _0xeaff5e[_0xa60c('0x1c')]===_0xa60c('0x1d')&&typeof _0xeaff5e['limit']===_0xa60c('0x1d');var _0x2ecf0b=_0x43a4ee[_0xa60c('0x1e')];var _0x1a3394=_0x381d5f?0x0:_0xeaff5e[_0xa60c('0x1c')];var _0x2847c5=_0x381d5f?_0x43a4ee[_0xa60c('0x1e')]:_0xeaff5e[_0xa60c('0x1c')]+_0xeaff5e[_0xa60c('0x1f')];var _0x22afe1;if(_0x2847c5>=_0x2ecf0b){_0x2847c5=_0x2ecf0b;_0x22afe1=0xc8;}else{_0x22afe1=0xce;}_0x17f596['status'](_0x22afe1);return _0x17f596[_0xa60c('0x20')](_0xa60c('0x21'),_0x1a3394+'-'+_0x2847c5+'/'+_0x2ecf0b)[_0xa60c('0x1b')](_0x43a4ee);}return null;};}function patchUpdates(_0x51649c){return function(_0x312ba7){try{jsonpatch[_0xa60c('0x22')](_0x312ba7,_0x51649c,!![]);}catch(_0x567467){return BPromise[_0xa60c('0x23')](_0x567467);}return _0x312ba7[_0xa60c('0x24')]();};}function saveUpdates(_0x32784a,_0x5071a5){return function(_0x33b3aa){if(_0x33b3aa){return _0x33b3aa[_0xa60c('0x25')](_0x32784a)[_0xa60c('0x26')](function(_0x2aca72){return _0x2aca72;});}return null;};}function removeEntity(_0x35b2c7,_0x183e25){return function(_0x2c0723){if(_0x2c0723){return _0x2c0723[_0xa60c('0x27')]()[_0xa60c('0x26')](function(){_0x35b2c7[_0xa60c('0x28')](0xcc)[_0xa60c('0x1a')]();});}};}function handleEntityNotFound(_0x45ddb7,_0x44f51c){return function(_0x124bed){if(!_0x124bed){_0x45ddb7[_0xa60c('0x29')](0x194);}return _0x124bed;};}function handleError(_0x55fef0,_0x49ab5c){_0x49ab5c=_0x49ab5c||0x1f4;return function(_0x4921d0){logger[_0xa60c('0x2a')](_0x4921d0[_0xa60c('0x2b')]);if(_0x4921d0[_0xa60c('0x2c')]){delete _0x4921d0[_0xa60c('0x2c')];}_0x55fef0[_0xa60c('0x28')](_0x49ab5c)[_0xa60c('0x2d')](_0x4921d0);};}exports[_0xa60c('0x2e')]=function(_0x56383e,_0x8b6ab1){var _0x44badc={},_0x3e8d8e={},_0x508077={'count':0x0,'rows':[]};var _0xa2240b=_[_0xa60c('0x2f')](db[_0xa60c('0x30')]['rawAttributes'],function(_0x381317){return{'name':_0x381317[_0xa60c('0x31')],'type':_0x381317['type']['key']};});_0x3e8d8e[_0xa60c('0x32')]=_[_0xa60c('0x2f')](_0xa2240b,'name');_0x3e8d8e[_0xa60c('0x33')]=_['keys'](_0x56383e[_0xa60c('0x33')]);_0x3e8d8e[_0xa60c('0x34')]=_['intersection'](_0x3e8d8e[_0xa60c('0x32')],_0x3e8d8e[_0xa60c('0x33')]);_0x44badc[_0xa60c('0x35')]=_['intersection'](_0x3e8d8e['model'],qs['fields'](_0x56383e[_0xa60c('0x33')][_0xa60c('0x36')]));_0x44badc[_0xa60c('0x35')]=_0x44badc['attributes'][_0xa60c('0x37')]?_0x44badc[_0xa60c('0x35')]:_0x3e8d8e[_0xa60c('0x32')];if(!_0x56383e['query'][_0xa60c('0x38')](_0xa60c('0x39'))){_0x44badc[_0xa60c('0x1f')]=qs[_0xa60c('0x1f')](_0x56383e[_0xa60c('0x33')]['limit']);_0x44badc[_0xa60c('0x1c')]=qs[_0xa60c('0x1c')](_0x56383e[_0xa60c('0x33')][_0xa60c('0x1c')]);}_0x44badc[_0xa60c('0x3a')]=qs[_0xa60c('0x3b')](_0x56383e['query'][_0xa60c('0x3b')]);_0x44badc[_0xa60c('0x3c')]=qs[_0xa60c('0x34')](_[_0xa60c('0x3d')](_0x56383e[_0xa60c('0x33')],_0x3e8d8e[_0xa60c('0x34')]),_0xa2240b);if(_0x56383e[_0xa60c('0x33')][_0xa60c('0x3e')]){_0x44badc['where']=_[_0xa60c('0x3f')](_0x44badc['where'],{'$or':_[_0xa60c('0x2f')](_0xa2240b,function(_0x3adeee){if(_0x3adeee['type']!==_0xa60c('0x40')){var _0x42e50f={};_0x42e50f[_0x3adeee['name']]={'$like':'%'+_0x56383e[_0xa60c('0x33')][_0xa60c('0x3e')]+'%'};return _0x42e50f;}})});}_0x44badc=_[_0xa60c('0x3f')]({},_0x44badc,_0x56383e[_0xa60c('0x41')]);var _0x395e12={'where':_0x44badc[_0xa60c('0x3c')]};return db[_0xa60c('0x30')][_0xa60c('0x1e')](_0x395e12)[_0xa60c('0x26')](function(_0x26bc17){_0x508077[_0xa60c('0x1e')]=_0x26bc17;if(_0x56383e[_0xa60c('0x33')][_0xa60c('0x42')]){_0x44badc[_0xa60c('0x43')]=[{'all':!![]}];}return db[_0xa60c('0x30')][_0xa60c('0x44')](_0x44badc);})[_0xa60c('0x26')](function(_0x8f549d){_0x508077[_0xa60c('0x45')]=_0x8f549d;return _0x508077;})[_0xa60c('0x26')](respondWithFilteredResult(_0x8b6ab1,_0x44badc))[_0xa60c('0x46')](handleError(_0x8b6ab1,null));};exports[_0xa60c('0x47')]=function(_0x51286b,_0x41dc71){var _0x378bb4={'raw':!![],'where':{'id':_0x51286b[_0xa60c('0x48')]['id']}},_0x558344={};_0x558344['model']=_['keys'](db['ChatTransferReport'][_0xa60c('0x49')]);_0x558344[_0xa60c('0x33')]=_[_0xa60c('0x4a')](_0x51286b[_0xa60c('0x33')]);_0x558344['filters']=_['intersection'](_0x558344['model'],_0x558344[_0xa60c('0x33')]);_0x378bb4[_0xa60c('0x35')]=_['intersection'](_0x558344[_0xa60c('0x32')],qs[_0xa60c('0x36')](_0x51286b['query'][_0xa60c('0x36')]));_0x378bb4['attributes']=_0x378bb4[_0xa60c('0x35')][_0xa60c('0x37')]?_0x378bb4[_0xa60c('0x35')]:_0x558344[_0xa60c('0x32')];if(_0x51286b['query'][_0xa60c('0x42')]){_0x378bb4[_0xa60c('0x43')]=[{'all':!![]}];}_0x378bb4=_['merge']({},_0x378bb4,_0x51286b['options']);return db['ChatTransferReport']['find'](_0x378bb4)[_0xa60c('0x26')](handleEntityNotFound(_0x41dc71,null))[_0xa60c('0x26')](respondWithResult(_0x41dc71,null))[_0xa60c('0x46')](handleError(_0x41dc71,null));};exports[_0xa60c('0x4b')]=function(_0x54a85a,_0x298503){return db[_0xa60c('0x30')][_0xa60c('0x4b')](_0x54a85a[_0xa60c('0x4c')],{})['then'](respondWithResult(_0x298503,0xc9))[_0xa60c('0x46')](handleError(_0x298503,null));};exports[_0xa60c('0x25')]=function(_0x47f06e,_0xd26c06){if(_0x47f06e['body']['id']){delete _0x47f06e[_0xa60c('0x4c')]['id'];}return db[_0xa60c('0x30')][_0xa60c('0x4d')]({'where':{'id':_0x47f06e[_0xa60c('0x48')]['id']}})[_0xa60c('0x26')](handleEntityNotFound(_0xd26c06,null))['then'](saveUpdates(_0x47f06e[_0xa60c('0x4c')],null))[_0xa60c('0x26')](respondWithResult(_0xd26c06,null))['catch'](handleError(_0xd26c06,null));};exports[_0xa60c('0x27')]=function(_0x1b8489,_0x176958){return db[_0xa60c('0x30')][_0xa60c('0x4d')]({'where':{'id':_0x1b8489[_0xa60c('0x48')]['id']}})['then'](handleEntityNotFound(_0x176958,null))[_0xa60c('0x26')](removeEntity(_0x176958,null))[_0xa60c('0x46')](handleError(_0x176958,null));};exports['describe']=function(_0x510145,_0x5a95b9){return db[_0xa60c('0x30')][_0xa60c('0x4e')]()[_0xa60c('0x26')](respondWithResult(_0x5a95b9,null))[_0xa60c('0x46')](handleError(_0x5a95b9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6845fc5..21de619 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 _0xe2ad=['request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','moment'];(function(_0x123e2a,_0x3602ee){var _0x47e48e=function(_0x441cee){while(--_0x441cee){_0x123e2a['push'](_0x123e2a['shift']());}};_0x47e48e(++_0x3602ee);}(_0xe2ad,0xa8));var _0xde2a=function(_0x469b61,_0x1d1835){_0x469b61=_0x469b61-0x0;var _0x249df4=_0xe2ad[_0x469b61];return _0x249df4;};'use strict';var _=require('lodash');var util=require(_0xde2a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xde2a('0x1'));var BPromise=require('bluebird');var rp=require(_0xde2a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xde2a('0x3'));var attributes=require(_0xde2a('0x4'));module[_0xde2a('0x5')]=function(_0xe84219,_0x579dbd){return _0xe84219[_0xde2a('0x6')](_0xde2a('0x7'),attributes,{'tableName':_0xde2a('0x8'),'paranoid':![],'indexes':[{'name':_0xde2a('0x9'),'fields':[_0xde2a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa69b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x340454,_0x52af2c){var _0x118e75=function(_0x3d3e27){while(--_0x3d3e27){_0x340454['push'](_0x340454['shift']());}};_0x118e75(++_0x52af2c);}(_0xa69b,0x11d));var _0xba69=function(_0x48c7c5,_0x504d06){_0x48c7c5=_0x48c7c5-0x0;var _0x45fc92=_0xa69b[_0x48c7c5];return _0x45fc92;};'use strict';var _=require(_0xba69('0x0'));var util=require('util');var logger=require(_0xba69('0x1'))(_0xba69('0x2'));var moment=require('moment');var BPromise=require(_0xba69('0x3'));var rp=require(_0xba69('0x4'));var fs=require('fs');var path=require(_0xba69('0x5'));var rimraf=require(_0xba69('0x6'));var config=require(_0xba69('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xba69('0x8')]=function(_0x3bac6d,_0x5be9bc){return _0x3bac6d[_0xba69('0x9')](_0xba69('0xa'),attributes,{'tableName':_0xba69('0xb'),'paranoid':![],'indexes':[{'name':_0xba69('0xc'),'fields':[_0xba69('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 93ba8a7..c53611c 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 _0x92a5=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x92a5,0x1e4));var _0x592a=function(_0x438d40,_0x54e013){_0x438d40=_0x438d40-0x0;var _0x5fe6fd=_0x92a5[_0x438d40];return _0x5fe6fd;};'use strict';var _=require(_0x592a('0x0'));var util=require(_0x592a('0x1'));var moment=require(_0x592a('0x2'));var BPromise=require('bluebird');var rs=require(_0x592a('0x3'));var fs=require('fs');var Redis=require(_0x592a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x592a('0x5'));var logger=require(_0x592a('0x6'))(_0x592a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x592a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dae48,_0x594a2c,_0x4f22b6){return new BPromise(function(_0x4f2e74,_0x319be1){return client[_0x592a('0x9')](_0x3dae48,_0x4f22b6)[_0x592a('0xa')](function(_0x526dbe){logger[_0x592a('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x594a2c,'request\x20sent');logger[_0x592a('0xc')](_0x592a('0xd'),_0x594a2c,_0x592a('0xe'),JSON[_0x592a('0xf')](_0x526dbe));if(_0x526dbe[_0x592a('0x10')]){if(_0x526dbe['error'][_0x592a('0x11')]===0x1f4){logger['error'](_0x592a('0x12'),_0x594a2c,_0x526dbe['error'][_0x592a('0x13')]);return _0x319be1(_0x526dbe[_0x592a('0x10')][_0x592a('0x13')]);}logger[_0x592a('0x10')](_0x592a('0x12'),_0x594a2c,_0x526dbe[_0x592a('0x10')][_0x592a('0x13')]);return _0x4f2e74(_0x526dbe[_0x592a('0x10')][_0x592a('0x13')]);}else{logger[_0x592a('0xb')](_0x592a('0x12'),_0x594a2c,_0x592a('0xe'));_0x4f2e74(_0x526dbe[_0x592a('0x14')]['message']);}})[_0x592a('0x15')](function(_0x5613bd){logger['error'](_0x592a('0x12'),_0x594a2c,_0x5613bd);_0x319be1(_0x5613bd);});});} \ No newline at end of file +var _0x889e=['jayson/promise','client','http','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','moment','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x3c0ffa,_0xf7ee6a){var _0x38c658=function(_0x95a838){while(--_0x95a838){_0x3c0ffa['push'](_0x3c0ffa['shift']());}};_0x38c658(++_0xf7ee6a);}(_0x889e,0x117));var _0xe889=function(_0x4857a9,_0x53b85d){_0x4857a9=_0x4857a9-0x0;var _0x1fe8af=_0x889e[_0x4857a9];return _0x1fe8af;};'use strict';var _=require(_0xe889('0x0'));var util=require(_0xe889('0x1'));var moment=require(_0xe889('0x2'));var BPromise=require(_0xe889('0x3'));var rs=require(_0xe889('0x4'));var fs=require('fs');var Redis=require(_0xe889('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe889('0x6'));var jayson=require(_0xe889('0x7'));var client=jayson[_0xe889('0x8')][_0xe889('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2934c9,_0x2b7406,_0x1b966e){return new BPromise(function(_0x598735,_0x54867c){return client['request'](_0x2934c9,_0x1b966e)[_0xe889('0xa')](function(_0x58da71){logger[_0xe889('0xb')](_0xe889('0xc'),_0x2b7406,_0xe889('0xd'));logger[_0xe889('0xe')](_0xe889('0xf'),_0x2b7406,_0xe889('0xd'),JSON[_0xe889('0x10')](_0x58da71));if(_0x58da71[_0xe889('0x11')]){if(_0x58da71[_0xe889('0x11')][_0xe889('0x12')]===0x1f4){logger[_0xe889('0x11')](_0xe889('0xc'),_0x2b7406,_0x58da71[_0xe889('0x11')]['message']);return _0x54867c(_0x58da71[_0xe889('0x11')][_0xe889('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2b7406,_0x58da71[_0xe889('0x11')][_0xe889('0x13')]);return _0x598735(_0x58da71[_0xe889('0x11')][_0xe889('0x13')]);}else{logger[_0xe889('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x2b7406,_0xe889('0xd'));_0x598735(_0x58da71[_0xe889('0x14')][_0xe889('0x13')]);}})[_0xe889('0x15')](function(_0xaf505c){logger[_0xe889('0x11')](_0xe889('0xc'),_0x2b7406,_0xaf505c);_0x54867c(_0xaf505c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 29d3df0..fd23205 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 _0x43f9=['express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','multer','util','path'];(function(_0x362225,_0x5c85b6){var _0x3c9871=function(_0x314643){while(--_0x314643){_0x362225['push'](_0x362225['shift']());}};_0x3c9871(++_0x5c85b6);}(_0x43f9,0x179));var _0x943f=function(_0x1678b5,_0x304b75){_0x1678b5=_0x1678b5-0x0;var _0x4d2630=_0x43f9[_0x1678b5];return _0x4d2630;};'use strict';var multer=require(_0x943f('0x0'));var util=require(_0x943f('0x1'));var path=require(_0x943f('0x2'));var timeout=require('connect-timeout');var express=require(_0x943f('0x3'));var router=express[_0x943f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x943f('0x5'));var interaction=require(_0x943f('0x6'));var config=require('../../config/environment');var controller=require(_0x943f('0x7'));router[_0x943f('0x8')]('/',auth[_0x943f('0x9')](),controller[_0x943f('0xa')]);router[_0x943f('0x8')](_0x943f('0xb'),auth[_0x943f('0x9')](),controller['describe']);router[_0x943f('0x8')](_0x943f('0xc'),auth[_0x943f('0x9')](),controller[_0x943f('0xd')]);router[_0x943f('0xe')]('/',auth[_0x943f('0x9')](),controller[_0x943f('0xf')]);router[_0x943f('0x10')](_0x943f('0xc'),auth[_0x943f('0x9')](),controller['update']);router[_0x943f('0x11')]('/:id',auth[_0x943f('0x9')](),controller[_0x943f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb798=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','post','create','put','/:id','exports','multer','util'];(function(_0x3387ae,_0x1368ca){var _0x3385c6=function(_0x4622ef){while(--_0x4622ef){_0x3387ae['push'](_0x3387ae['shift']());}};_0x3385c6(++_0x1368ca);}(_0xb798,0xc4));var _0x8b79=function(_0x59165d,_0x15c6ef){_0x59165d=_0x59165d-0x0;var _0x5ee1cd=_0xb798[_0x59165d];return _0x5ee1cd;};'use strict';var multer=require(_0x8b79('0x0'));var util=require(_0x8b79('0x1'));var path=require('path');var timeout=require(_0x8b79('0x2'));var express=require(_0x8b79('0x3'));var router=express[_0x8b79('0x4')]();var fs_extra=require(_0x8b79('0x5'));var auth=require(_0x8b79('0x6'));var interaction=require(_0x8b79('0x7'));var config=require(_0x8b79('0x8'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x8b79('0x9')](),controller[_0x8b79('0xa')]);router[_0x8b79('0xb')](_0x8b79('0xc'),auth[_0x8b79('0x9')](),controller['describe']);router[_0x8b79('0xb')]('/:id',auth[_0x8b79('0x9')](),controller['show']);router[_0x8b79('0xd')]('/',auth[_0x8b79('0x9')](),controller[_0x8b79('0xe')]);router[_0x8b79('0xf')](_0x8b79('0x10'),auth[_0x8b79('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8b79('0x9')](),controller['destroy']);module[_0x8b79('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4e25c4a..531f29b 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 _0x4b36=['We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Skip','star','stringify','input','name','onlineForm','parse','getDataValue','setDataValue','textarea','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','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','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}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x4b59e2,_0x59a4c9){var _0x23546a=function(_0xcea80f){while(--_0xcea80f){_0x4b59e2['push'](_0x4b59e2['shift']());}};_0x23546a(++_0x59a4c9);}(_0x4b36,0x14b));var _0x64b3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4b36[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x64b3('0x0'));var rs=require('randomstring');module[_0x64b3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'unique':_0x64b3('0x3')},'description':{'type':Sequelize[_0x64b3('0x2')]},'mapKey':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x4')},'mapKeyOffline':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x4')},'key':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':_0x64b3('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':_0x64b3('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':_0x64b3('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x64b3('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x64b3('0x2')]},'animation':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x64b3('0xa')]('rounded','squared'),'defaultValue':_0x64b3('0xb')},'header_online':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0xc')},'start_chat_button':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0xd')},'header_offline':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x64b3('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x64b3('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x12')},'placeholderMessage':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x13')},'closingMessage':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0xd')},'skipMessageButton':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x64b3('0x15'),'thumb'),'defaultValue':_0x64b3('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x64b3('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x64b3('0xf')],'defaultValue':function(){return JSON[_0x64b3('0x16')]({'items':[{'type':_0x64b3('0x17'),'variable':null,'config':{'placeholder':_0x64b3('0x18'),'type':'text','required':!![]},'props':{'title':_0x64b3('0x18'),'helpText':''}},{'type':_0x64b3('0x17'),'props':{'title':_0x64b3('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x64b3('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x64b3('0x19'))?JSON[_0x64b3('0x1a')](this[_0x64b3('0x1b')]('onlineForm')):{};},'set':function(_0xafd0fe){return this[_0x64b3('0x1c')](_0x64b3('0x19'),JSON[_0x64b3('0x16')](_0xafd0fe));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x64b3('0x16')]({'items':[{'type':'input','props':{'title':_0x64b3('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x64b3('0x4'),'type':'email'},'variable':null},{'type':_0x64b3('0x1d'),'config':{'placeholder':_0x64b3('0x1e')},'props':{'title':_0x64b3('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x64b3('0x1b')](_0x64b3('0x1f'))?JSON[_0x64b3('0x1a')](this[_0x64b3('0x1b')](_0x64b3('0x1f'))):{};},'set':function(_0x58b0c0){return this[_0x64b3('0x1c')](_0x64b3('0x1f'),JSON[_0x64b3('0x16')](_0x58b0c0));}},'token':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':function(){return rs[_0x64b3('0x20')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x64b3('0x2')]},'forwardOffline':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x64b3('0x2')]},'waitingTitle':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x21')},'waitingMessage':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x23')},'offlineMessageBody':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0x24')},'skipUnmanaged':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x14')},'sendUnmanaged':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x64b3('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x64b3('0x2')]},'notificationTemplate':{'type':Sequelize[_0x64b3('0xf')],'defaultValue':function(){return _0x64b3('0x25');}},'notificationSound':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x64b3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x64b3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x27')},'verticalAlignment':{'type':Sequelize[_0x64b3('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x28')},'messagesAlignment':{'type':Sequelize[_0x64b3('0x2')],'defaultValue':_0x64b3('0x29')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x64b3('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x64b3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x64b3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x64b3('0x2a')},'systemAvatar':{'type':Sequelize[_0x64b3('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x64b3('0x8')],'comment':_0x64b3('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![],'comment':_0x64b3('0x2c'),'set':function(_0x34881e){if(!_0x34881e)this[_0x64b3('0x1c')](_0x64b3('0x2d'),null);this['setDataValue'](_0x64b3('0x2e'),_0x34881e);}},'vidaooEscalation':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x64b3('0x2')]},'vidaooTopic':{'type':Sequelize[_0x64b3('0x2')],'allowNull':![],'defaultValue':_0x64b3('0x2f')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x64b3('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x64b3('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x64b3('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x64b3('0xf')]}}; \ No newline at end of file +var _0x393c=['onlineForm','parse','setDataValue','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.','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue'];(function(_0x334209,_0x522448){var _0x27c495=function(_0x26a2ef){while(--_0x26a2ef){_0x334209['push'](_0x334209['shift']());}};_0x27c495(++_0x522448);}(_0x393c,0x189));var _0xc393=function(_0x4ffe4f,_0x531c08){_0x4ffe4f=_0x4ffe4f-0x0;var _0x3c0864=_0x393c[_0x4ffe4f];return _0x3c0864;};'use strict';var Sequelize=require(_0xc393('0x0'));var rs=require('randomstring');module[_0xc393('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'unique':_0xc393('0x3')},'description':{'type':Sequelize[_0xc393('0x2')]},'mapKey':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x4')},'mapKeyOffline':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc393('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'defaultValue':_0xc393('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'defaultValue':_0xc393('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc393('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc393('0x2')]},'animation':{'type':Sequelize[_0xc393('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc393('0xa')]('rounded',_0xc393('0xb')),'defaultValue':_0xc393('0xc')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0xd')},'start_chat_button':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc393('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc393('0x11')]},'closingQuestion':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x13')},'noteTitle':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x14')},'closingMessage':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0xf')},'skipMessageButton':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x15')},'conditionAgreement':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x16')},'ratingType':{'type':Sequelize[_0xc393('0xa')](_0xc393('0x17'),_0xc393('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xc393('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc393('0x11')],'defaultValue':function(){return JSON[_0xc393('0x19')]({'items':[{'type':_0xc393('0x1a'),'variable':null,'config':{'placeholder':_0xc393('0x1b'),'type':_0xc393('0x1c'),'required':!![]},'props':{'title':_0xc393('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xc393('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc393('0x4'),'type':_0xc393('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc393('0x1d')](_0xc393('0x1e'))?JSON[_0xc393('0x1f')](this[_0xc393('0x1d')](_0xc393('0x1e'))):{};},'set':function(_0x4fad5b){return this[_0xc393('0x20')]('onlineForm',JSON['stringify'](_0x4fad5b));}},'offlineForm':{'type':Sequelize[_0xc393('0x11')],'defaultValue':function(){return JSON[_0xc393('0x19')]({'items':[{'type':_0xc393('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xc393('0x4'),'type':_0xc393('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xc393('0x21'))?JSON[_0xc393('0x1f')](this[_0xc393('0x1d')](_0xc393('0x21'))):{};},'set':function(_0x5c0ef4){return this['setDataValue'](_0xc393('0x21'),JSON[_0xc393('0x19')](_0x5c0ef4));}},'token':{'type':Sequelize[_0xc393('0x2')],'defaultValue':function(){return rs[_0xc393('0x22')]();}},'autoclose':{'type':Sequelize[_0xc393('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc393('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc393('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0x23')},'waitingMessage':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xc393('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x27')},'skipUnmanaged':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc393('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc393('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xc393('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc393('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xc393('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xc393('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x28')},'defaultTitle':{'type':Sequelize[_0xc393('0x2')]},'customerAvatar':{'type':Sequelize[_0xc393('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc393('0x2')],'allowNull':![],'defaultValue':_0xc393('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc393('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc393('0x2')],'defaultValue':_0xc393('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc393('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ff88e){if(!_0x3ff88e)this[_0xc393('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xc393('0x2c'),_0x3ff88e);}},'vidaooEscalation':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc393('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc393('0x2d')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xc393('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xc393('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc393('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc393('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4673546..6f9fd92 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 _0x800f=['Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','addAvatar','agentAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','CmContact','contact','threadId','closed','ChatInteraction','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','messageId','created','autoclose','push','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','firstName','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','findOne','includeAll','Owner','fullname','internal','Tag','Tags','tag','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','3.9.0','origin','headers','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','color','labelText','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','json','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','http','client','request','then','info','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','status','end','offset','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','sendStatus','stack','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','version','format','%s\x20%s','name','unknown','device','model','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','find','create','testWildcardValidity','body','address','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','describe','addDisposition','ChatWebsiteId'];(function(_0x3360d5,_0x212ac0){var _0x51ebce=function(_0xdefe5d){while(--_0xdefe5d){_0x3360d5['push'](_0x3360d5['shift']());}};_0x51ebce(++_0x212ac0);}(_0x800f,0xbe));var _0xf800=function(_0x22f331,_0x4e8aed){_0x22f331=_0x22f331-0x0;var _0x374774=_0x800f[_0x22f331];return _0x374774;};'use strict';var Mustache=require(_0xf800('0x0'));var util=require(_0xf800('0x1'));var path=require(_0xf800('0x2'));var ejs=require(_0xf800('0x3'));var fs=require('fs');var fs_extra=require(_0xf800('0x4'));var _=require(_0xf800('0x5'));var querystring=require(_0xf800('0x6'));var htmlToText=require(_0xf800('0x7'));var Redis=require(_0xf800('0x8'));var jayson=require(_0xf800('0x9'));var qs=require(_0xf800('0xa'));var logger=require(_0xf800('0xb'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0xf800('0xc'))[_0xf800('0xd')];var APINotFoundError=require(_0xf800('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xf800('0xc'))[_0xf800('0xe')];var APIHandleError=require(_0xf800('0xc'))[_0xf800('0xf')];var APIConflictError=require(_0xf800('0xc'))['APIConflictError'];var wildcardUtils=require(_0xf800('0x10'));var URL=require(_0xf800('0x11'))[_0xf800('0x12')];var db=require(_0xf800('0x13'))['db'];config['redis']=_[_0xf800('0x14')](config[_0xf800('0x15')],{'host':_0xf800('0x16'),'port':0x18eb});var socket=require(_0xf800('0x17'))(new Redis(config[_0xf800('0x15')]));require('./chatWebsite.socket')['register'](socket);var client=jayson['client'][_0xf800('0x18')]({'port':0x232c});var client9002=jayson[_0xf800('0x19')]['http']({'port':0x232a});var client9003=jayson[_0xf800('0x19')]['http']({'port':0x232b});var client9001=jayson[_0xf800('0x19')][_0xf800('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x51c4e5,_0x4d46dc,_0x473810,_0x16583a){return new Promise(function(_0x5adf1f,_0x109f26){var _0x47a8e4=_0x16583a||client;return _0x47a8e4[_0xf800('0x1a')](_0x51c4e5,_0x473810)[_0xf800('0x1b')](function(_0x5ba795){logger[_0xf800('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x4d46dc,_0xf800('0x1d'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4d46dc,_0xf800('0x1d'),JSON[_0xf800('0x1e')](_0x5ba795));if(_0x5ba795[_0xf800('0x1f')]){if(_0x5ba795[_0xf800('0x1f')][_0xf800('0x20')]===0x1f4){logger[_0xf800('0x1f')](_0xf800('0x21'),_0x4d46dc,_0x5ba795['error']['message']);return _0x109f26(_0x5ba795[_0xf800('0x1f')][_0xf800('0x22')]);}logger['error'](_0xf800('0x21'),_0x4d46dc,_0x5ba795[_0xf800('0x1f')][_0xf800('0x22')]);return _0x5adf1f(_0x5ba795[_0xf800('0x1f')][_0xf800('0x22')]);}else{logger[_0xf800('0x1c')](_0xf800('0x21'),_0x4d46dc,'request\x20sent');_0x5adf1f(_0x5ba795['result'][_0xf800('0x22')]);}})[_0xf800('0x23')](function(_0x2130f1){logger['error'](_0xf800('0x21'),_0x4d46dc,_0x2130f1);_0x109f26(_0x2130f1);});});}function respondWithStatusCode(_0x1e710,_0x56fbf2){_0x56fbf2=_0x56fbf2||0xcc;return function(_0x3eb397){if(_0x3eb397){return _0x1e710['sendStatus'](_0x56fbf2);}return _0x1e710[_0xf800('0x24')](_0x56fbf2)[_0xf800('0x25')]();};}function respondWithResult(_0x5dc60a,_0x8f5333){_0x8f5333=_0x8f5333||0xc8;return function(_0x12ebe6){if(_0x12ebe6){return _0x5dc60a[_0xf800('0x24')](_0x8f5333)['json'](_0x12ebe6);}};}function respondWithFilteredResult(_0x3f276e,_0x5c9daa){return function(_0x2bd036){if(_0x2bd036){var _0x2552e6=typeof _0x5c9daa[_0xf800('0x26')]==='undefined'&&typeof _0x5c9daa[_0xf800('0x27')]==='undefined';var _0xd0c95e=_0x2bd036['count'];var _0x236956=_0x2552e6?0x0:_0x5c9daa[_0xf800('0x26')];var _0x1bc27f=_0x2552e6?_0x2bd036[_0xf800('0x28')]:_0x5c9daa['offset']+_0x5c9daa[_0xf800('0x27')];var _0x2265ae;if(_0x1bc27f>=_0xd0c95e){_0x1bc27f=_0xd0c95e;_0x2265ae=0xc8;}else{_0x2265ae=0xce;}_0x3f276e[_0xf800('0x24')](_0x2265ae);return _0x3f276e[_0xf800('0x29')](_0xf800('0x2a'),_0x236956+'-'+_0x1bc27f+'/'+_0xd0c95e)['json'](_0x2bd036);}return null;};}function saveUpdates(_0x1fd9d1){return function(_0xc363db){if(_0xc363db){return _0xc363db[_0xf800('0x2b')](_0x1fd9d1)[_0xf800('0x1b')](function(_0x5ee718){return _0x5ee718;});}return null;};}function removeEntity(_0x5bdea7){return function(_0x174dd5){if(_0x174dd5){return _0x174dd5[_0xf800('0x2c')]()[_0xf800('0x1b')](function(){var _0x4685a1=_0x174dd5[_0xf800('0x2d')]({'plain':!![]});var _0x2e94f8=_0xf800('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e94f8,'resourceId':_0x4685a1['id']}})[_0xf800('0x1b')](function(){return _0x174dd5;});})[_0xf800('0x1b')](function(){_0x5bdea7[_0xf800('0x24')](0xcc)[_0xf800('0x25')]();});}};}function handleEntityNotFound(_0xb2fe71){return function(_0x1ab4ec){if(!_0x1ab4ec){_0xb2fe71[_0xf800('0x2f')](0x194);}return _0x1ab4ec;};}function handleError(_0xa4a3b2,_0x3eecd0){_0x3eecd0=_0x3eecd0||0x1f4;return function(_0x27f5ad){logger[_0xf800('0x1f')](_0x27f5ad[_0xf800('0x30')]);if(_0x27f5ad['name']){delete _0x27f5ad['name'];}_0xa4a3b2[_0xf800('0x24')](_0x3eecd0)[_0xf800('0x31')](_0x27f5ad);};}function createInteractionObject(_0x87d90e,_0x2fc47c,_0x4f8f9c,_0x21ad2c){var _0x5da614=require(_0xf800('0x32'));var _0x491772=new _0x5da614();var _0x3dd4c4=_0x491772['setUA'](_0x4f8f9c[_0xf800('0x33')])[_0xf800('0x34')]();var _0x54a251=_0x2fc47c[_0xf800('0x35')];if(_0x4f8f9c[_0xf800('0x36')]){_0x54a251=_0x4f8f9c[_0xf800('0x36')];}else if(_0x4f8f9c[_0xf800('0x37')]){_0x54a251=_[_0xf800('0x38')](_0x4f8f9c[_0xf800('0x37')][_0xf800('0x39')](','));}return{'ContactId':_0x21ad2c['id'],'ChatWebsiteId':_0x87d90e,'from':(_0x21ad2c['firstName']||'')+'\x20'+(_0x21ad2c[_0xf800('0x3a')]||''),'customerIp':_0x54a251,'customerPort':_0x4f8f9c[_0xf800('0x3b')]?_0x4f8f9c[_0xf800('0x3b')]:null,'referer':_0x2fc47c['referer'],'browserName':_0x3dd4c4[_0xf800('0x3c')]['name']&&_0x3dd4c4[_0xf800('0x3c')][_0xf800('0x3d')]?util[_0xf800('0x3e')](_0xf800('0x3f'),_0x3dd4c4[_0xf800('0x3c')][_0xf800('0x40')],_0x3dd4c4[_0xf800('0x3c')][_0xf800('0x3d')]):_0xf800('0x41'),'browserVersion':_0x3dd4c4[_0xf800('0x3c')][_0xf800('0x3d')]||_0xf800('0x41'),'osName':util['format']('%s\x20%s',_0x3dd4c4['os'][_0xf800('0x40')],_0x3dd4c4['os'][_0xf800('0x3d')]),'osVersion':_0x3dd4c4['os'][_0xf800('0x3d')],'deviceModel':_0x3dd4c4[_0xf800('0x42')][_0xf800('0x43')]&&_0x3dd4c4[_0xf800('0x42')][_0xf800('0x44')]?util['format']('%s\x20%s\x20%s',_0x3dd4c4[_0xf800('0x42')][_0xf800('0x43')],_0x3dd4c4[_0xf800('0x42')]['vendor'],_0x3dd4c4['device'][_0xf800('0x45')]):null,'deviceVendor':_0x3dd4c4[_0xf800('0x42')]['vendor'],'deviceType':_0x3dd4c4[_0xf800('0x42')][_0xf800('0x45')],'formData':JSON[_0xf800('0x1e')](_0x2fc47c)};}exports[_0xf800('0x46')]=function(_0x546dcc,_0x3f8c49){var _0x13b6b3={'include':[{'model':db[_0xf800('0x47')],'as':_0xf800('0x48')}]},_0x1cf6ed={},_0xfe29ea={'count':0x0,'rows':[]};var _0x24e41a=_[_0xf800('0x49')](db[_0xf800('0x4a')][_0xf800('0x4b')],function(_0x29a7ff){return{'name':_0x29a7ff[_0xf800('0x4c')],'type':_0x29a7ff[_0xf800('0x45')][_0xf800('0x4d')]};});_0x1cf6ed[_0xf800('0x43')]=_[_0xf800('0x49')](_0x24e41a,_0xf800('0x40'));_0x1cf6ed[_0xf800('0x4e')]=_[_0xf800('0x4f')](_0x546dcc[_0xf800('0x4e')]);_0x1cf6ed[_0xf800('0x50')]=_['intersection'](_0x1cf6ed[_0xf800('0x43')],_0x1cf6ed[_0xf800('0x4e')]);_0x13b6b3['attributes']=_['intersection'](_0x1cf6ed['model'],qs[_0xf800('0x51')](_0x546dcc[_0xf800('0x4e')][_0xf800('0x51')]));_0x13b6b3[_0xf800('0x52')]=_0x13b6b3[_0xf800('0x52')][_0xf800('0x53')]?_0x13b6b3[_0xf800('0x52')]:_0x1cf6ed[_0xf800('0x43')];if(!_0x546dcc[_0xf800('0x4e')][_0xf800('0x54')]('nolimit')){_0x13b6b3[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x546dcc[_0xf800('0x4e')][_0xf800('0x27')]);_0x13b6b3[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x546dcc[_0xf800('0x4e')][_0xf800('0x26')]);}_0x13b6b3[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x546dcc['query'][_0xf800('0x56')]);_0x13b6b3[_0xf800('0x57')]=qs['filters'](_[_0xf800('0x58')](_0x546dcc[_0xf800('0x4e')],_0x1cf6ed[_0xf800('0x50')]),_0x24e41a);if(_0x546dcc[_0xf800('0x4e')][_0xf800('0x59')]){_0x13b6b3[_0xf800('0x57')]=_[_0xf800('0x5a')](_0x13b6b3[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0x24e41a,function(_0x5122a2){if(_0x5122a2[_0xf800('0x45')]!==_0xf800('0x5b')){var _0x36e246={};_0x36e246[_0x5122a2[_0xf800('0x40')]]={'$like':'%'+_0x546dcc['query'][_0xf800('0x59')]+'%'};return _0x36e246;}})});}_0x13b6b3=_['merge']({},_0x13b6b3,_0x546dcc[_0xf800('0x5c')]);var _0x43beaa={'where':_0x13b6b3[_0xf800('0x57')]};return db[_0xf800('0x4a')][_0xf800('0x28')](_0x43beaa)[_0xf800('0x1b')](function(_0x3180b9){_0xfe29ea[_0xf800('0x28')]=_0x3180b9;if(_0x546dcc[_0xf800('0x4e')]['includeAll']){_0x13b6b3[_0xf800('0x5d')]=[{'all':!![]}];}return db['ChatWebsite'][_0xf800('0x5e')](_0x13b6b3);})[_0xf800('0x1b')](function(_0x1ab4c4){_0xfe29ea[_0xf800('0x5f')]=_0x1ab4c4;return _0xfe29ea;})[_0xf800('0x1b')](respondWithFilteredResult(_0x3f8c49,_0x13b6b3))[_0xf800('0x23')](handleError(_0x3f8c49,null));};exports[_0xf800('0x60')]=function(_0xdeaacb,_0x299f0a){var _0x2186f2={'raw':![],'where':{'id':_0xdeaacb[_0xf800('0x61')]['id']},'include':[{'model':db[_0xf800('0x47')],'as':'mandatoryDispositionPause'}]},_0x152bbf={};_0x152bbf[_0xf800('0x43')]=_[_0xf800('0x4f')](db[_0xf800('0x4a')][_0xf800('0x4b')]);_0x152bbf['query']=_[_0xf800('0x4f')](_0xdeaacb['query']);_0x152bbf['filters']=_[_0xf800('0x62')](_0x152bbf['model'],_0x152bbf[_0xf800('0x4e')]);_0x2186f2[_0xf800('0x52')]=_['intersection'](_0x152bbf['model'],qs[_0xf800('0x51')](_0xdeaacb[_0xf800('0x4e')][_0xf800('0x51')]));_0x2186f2[_0xf800('0x52')]=_0x2186f2['attributes'][_0xf800('0x53')]?_0x2186f2['attributes']:_0x152bbf[_0xf800('0x43')];if(_0xdeaacb[_0xf800('0x4e')]['includeAll']){_0x2186f2['include']=[{'all':!![]}];}_0x2186f2=_[_0xf800('0x5a')]({},_0x2186f2,_0xdeaacb[_0xf800('0x5c')]);return db[_0xf800('0x4a')][_0xf800('0x63')](_0x2186f2)[_0xf800('0x1b')](handleEntityNotFound(_0x299f0a,null))[_0xf800('0x1b')](respondWithResult(_0x299f0a,null))[_0xf800('0x23')](handleError(_0x299f0a,null));};exports[_0xf800('0x64')]=function(_0x1e48db,_0x21dd75){if(!wildcardUtils[_0xf800('0x65')](_0x1e48db[_0xf800('0x66')][_0xf800('0x67')])){return handleError(_0x21dd75,null)(new APIBadRequestError('\x22'+_0x1e48db[_0xf800('0x66')]['address']+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}return db[_0xf800('0x4a')]['create'](_0x1e48db[_0xf800('0x66')],{})['then'](function(_0x319823){var _0x2d67e1=_0x1e48db[_0xf800('0x68')][_0xf800('0x2d')]({'plain':!![]});if(!_0x2d67e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d67e1[_0xf800('0x69')]===_0xf800('0x68')){var _0x113203=_0x319823[_0xf800('0x2d')]({'plain':!![]});var _0xbff70d=_0xf800('0x2e');return db[_0xf800('0x6a')][_0xf800('0x63')]({'where':{'name':_0xbff70d,'userProfileId':_0x2d67e1[_0xf800('0x6b')]},'raw':!![]})[_0xf800('0x1b')](function(_0x3f8f78){if(_0x3f8f78&&_0x3f8f78[_0xf800('0x6c')]===0x0){return db[_0xf800('0x6d')][_0xf800('0x64')]({'name':_0x113203['name'],'resourceId':_0x113203['id'],'type':_0x3f8f78['name'],'sectionId':_0x3f8f78['id']},{})['then'](function(){return _0x319823;});}else{return _0x319823;}})[_0xf800('0x23')](function(_0x502a1b){logger[_0xf800('0x1f')](_0xf800('0x6e'),_0x502a1b);throw _0x502a1b;});}return _0x319823;})['then'](respondWithResult(_0x21dd75,0xc9))['catch'](handleError(_0x21dd75,null));};exports[_0xf800('0x2b')]=function(_0x3d35ec,_0xfab04d){if(!wildcardUtils[_0xf800('0x65')](_0x3d35ec[_0xf800('0x66')]['address'])){return handleError(_0xfab04d,null)(new APIBadRequestError('\x22'+_0x3d35ec[_0xf800('0x66')][_0xf800('0x67')]+_0xf800('0x6f')));}if(_0x3d35ec[_0xf800('0x66')]['id']){delete _0x3d35ec[_0xf800('0x66')]['id'];}return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x3d35ec[_0xf800('0x61')]['id']},'include':[{'model':db[_0xf800('0x47')],'as':_0xf800('0x48')}]})[_0xf800('0x1b')](handleEntityNotFound(_0xfab04d,null))[_0xf800('0x1b')](saveUpdates(_0x3d35ec[_0xf800('0x66')],null))[_0xf800('0x1b')](respondWithResult(_0xfab04d,null))[_0xf800('0x23')](handleError(_0xfab04d,null));};exports['destroy']=function(_0x1f7529,_0x39d69c){return db[_0xf800('0x4a')]['find']({'where':{'id':_0x1f7529[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x39d69c,null))[_0xf800('0x1b')](removeEntity(_0x39d69c,null))[_0xf800('0x23')](handleError(_0x39d69c,null));};exports[_0xf800('0x70')]=function(_0x2b62c0,_0x521cc2){return db['ChatWebsite'][_0xf800('0x70')]()[_0xf800('0x1b')](respondWithResult(_0x521cc2,null))[_0xf800('0x23')](handleError(_0x521cc2,null));};exports[_0xf800('0x71')]=function(_0x4c4588,_0x59edc9){if(_0x4c4588['body']['id']){delete _0x4c4588[_0xf800('0x66')]['id'];}return db[_0xf800('0x4a')]['find']({'where':{'id':_0x4c4588[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x59edc9,null))[_0xf800('0x1b')](function(_0x13c031){if(_0x13c031){_0x4c4588[_0xf800('0x66')][_0xf800('0x72')]=_0x13c031['id'];return db[_0xf800('0x73')][_0xf800('0x64')](_0x4c4588['body']);}})[_0xf800('0x1b')](respondWithResult(_0x59edc9,null))['catch'](handleError(_0x59edc9,null));};exports['getDispositions']=function(_0x53732c,_0x373976){var _0x2af1c0={'raw':![],'where':{}};var _0x1b6d76={};var _0x5acaa6={'count':0x0,'rows':[]};return db[_0xf800('0x4a')]['findOne']({'where':{'id':_0x53732c[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x373976,null))[_0xf800('0x1b')](function(_0x40e39e){if(_0x40e39e){_0x1b6d76[_0xf800('0x43')]=_[_0xf800('0x4f')](db['Disposition']['rawAttributes']);_0x1b6d76[_0xf800('0x4e')]=_[_0xf800('0x4f')](_0x53732c[_0xf800('0x4e')]);_0x1b6d76['filters']=_[_0xf800('0x62')](_0x1b6d76['model'],_0x1b6d76[_0xf800('0x4e')]);_0x2af1c0['attributes']=_[_0xf800('0x62')](_0x1b6d76['model'],qs[_0xf800('0x51')](_0x53732c['query']['fields']));_0x2af1c0[_0xf800('0x52')]=_0x2af1c0['attributes'][_0xf800('0x53')]?_0x2af1c0[_0xf800('0x52')]:_0x1b6d76[_0xf800('0x43')];if(!_0x53732c[_0xf800('0x4e')][_0xf800('0x54')](_0xf800('0x74'))){_0x2af1c0[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x53732c['query']['limit']);_0x2af1c0[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x53732c['query'][_0xf800('0x26')]);}_0x2af1c0[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x53732c[_0xf800('0x4e')][_0xf800('0x56')]);_0x2af1c0[_0xf800('0x57')]=qs[_0xf800('0x50')](_['pick'](_0x53732c[_0xf800('0x4e')],_0x1b6d76['filters']));_0x2af1c0[_0xf800('0x57')][_0xf800('0x72')]=_0x40e39e['id'];if(_0x53732c[_0xf800('0x4e')]['filter']){_0x2af1c0[_0xf800('0x57')]=_[_0xf800('0x5a')](_0x2af1c0[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0x2af1c0[_0xf800('0x52')],function(_0x185d59){var _0x5aeb0d={};_0x5aeb0d[_0x185d59]={'$like':'%'+_0x53732c[_0xf800('0x4e')][_0xf800('0x59')]+'%'};return _0x5aeb0d;})});}_0x2af1c0=_['merge']({},_0x2af1c0,_0x53732c[_0xf800('0x5c')]);return db[_0xf800('0x73')][_0xf800('0x28')]({'where':_0x2af1c0[_0xf800('0x57')]})[_0xf800('0x1b')](function(_0x19a035){_0x5acaa6[_0xf800('0x28')]=_0x19a035;if(_0x53732c[_0xf800('0x4e')]['includeAll']){_0x2af1c0[_0xf800('0x5d')]=[{'all':!![]}];}return db[_0xf800('0x73')][_0xf800('0x5e')](_0x2af1c0);})[_0xf800('0x1b')](function(_0x5c63e3){_0x5acaa6[_0xf800('0x5f')]=_0x5c63e3;return _0x5acaa6;});}})[_0xf800('0x1b')](respondWithFilteredResult(_0x373976,_0x2af1c0))[_0xf800('0x23')](handleError(_0x373976,null));};exports[_0xf800('0x75')]=function(_0x4a0139,_0x164817){return db[_0xf800('0x4a')]['find']({'where':{'id':_0x4a0139[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x164817,null))[_0xf800('0x1b')](function(_0x3f8336){if(_0x3f8336){return _0x3f8336['removeDispositions'](_0x4a0139[_0xf800('0x4e')][_0xf800('0x76')]);}})[_0xf800('0x1b')](respondWithStatusCode(_0x164817,null))['catch'](handleError(_0x164817,null));};exports[_0xf800('0x77')]=function(_0x3ee151,_0x221f72){if(_0x3ee151['body']['id']){delete _0x3ee151[_0xf800('0x66')]['id'];}return db[_0xf800('0x4a')]['find']({'where':{'id':_0x3ee151[_0xf800('0x61')]['id']}})['then'](handleEntityNotFound(_0x221f72,null))['then'](function(_0x37872a){if(_0x37872a){_0x3ee151[_0xf800('0x66')][_0xf800('0x72')]=_0x37872a['id'];return db[_0xf800('0x78')][_0xf800('0x64')](_0x3ee151[_0xf800('0x66')]);}})[_0xf800('0x1b')](respondWithResult(_0x221f72,null))['catch'](handleError(_0x221f72,null));};exports[_0xf800('0x79')]=function(_0x2731cb,_0x34920e){var _0x3ffbcf={'raw':![],'where':{}};var _0x2674aa={};var _0x513de7={'count':0x0,'rows':[]};return db[_0xf800('0x4a')]['findOne']({'where':{'id':_0x2731cb['params']['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x34920e,null))[_0xf800('0x1b')](function(_0x121e17){if(_0x121e17){_0x2674aa[_0xf800('0x43')]=_['keys'](db[_0xf800('0x78')][_0xf800('0x4b')]);_0x2674aa[_0xf800('0x4e')]=_['keys'](_0x2731cb['query']);_0x2674aa[_0xf800('0x50')]=_[_0xf800('0x62')](_0x2674aa[_0xf800('0x43')],_0x2674aa[_0xf800('0x4e')]);_0x3ffbcf[_0xf800('0x52')]=_[_0xf800('0x62')](_0x2674aa[_0xf800('0x43')],qs['fields'](_0x2731cb[_0xf800('0x4e')]['fields']));_0x3ffbcf[_0xf800('0x52')]=_0x3ffbcf['attributes']['length']?_0x3ffbcf[_0xf800('0x52')]:_0x2674aa[_0xf800('0x43')];if(!_0x2731cb[_0xf800('0x4e')][_0xf800('0x54')](_0xf800('0x74'))){_0x3ffbcf[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x2731cb[_0xf800('0x4e')]['limit']);_0x3ffbcf[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x2731cb['query'][_0xf800('0x26')]);}_0x3ffbcf['order']=qs[_0xf800('0x56')](_0x2731cb[_0xf800('0x4e')][_0xf800('0x56')]);_0x3ffbcf['where']=qs[_0xf800('0x50')](_['pick'](_0x2731cb[_0xf800('0x4e')],_0x2674aa['filters']));_0x3ffbcf[_0xf800('0x57')][_0xf800('0x72')]=_0x121e17['id'];if(_0x2731cb[_0xf800('0x4e')][_0xf800('0x59')]){_0x3ffbcf[_0xf800('0x57')]=_[_0xf800('0x5a')](_0x3ffbcf[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0x3ffbcf[_0xf800('0x52')],function(_0x21440b){var _0x314b7b={};_0x314b7b[_0x21440b]={'$like':'%'+_0x2731cb['query'][_0xf800('0x59')]+'%'};return _0x314b7b;})});}_0x3ffbcf=_[_0xf800('0x5a')]({},_0x3ffbcf,_0x2731cb[_0xf800('0x5c')]);return db[_0xf800('0x78')][_0xf800('0x28')]({'where':_0x3ffbcf['where']})[_0xf800('0x1b')](function(_0x21cac2){_0x513de7[_0xf800('0x28')]=_0x21cac2;if(_0x2731cb[_0xf800('0x4e')]['includeAll']){_0x3ffbcf[_0xf800('0x5d')]=[{'all':!![]}];}return db[_0xf800('0x78')][_0xf800('0x5e')](_0x3ffbcf);})[_0xf800('0x1b')](function(_0x3ed734){_0x513de7['rows']=_0x3ed734;return _0x513de7;});}})['then'](respondWithFilteredResult(_0x34920e,_0x3ffbcf))[_0xf800('0x23')](handleError(_0x34920e,null));};exports[_0xf800('0x7a')]=function(_0x3a2296,_0x496cce){return db[_0xf800('0x4a')]['find']({'where':{'id':_0x3a2296[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x496cce,null))[_0xf800('0x1b')](function(_0x7336fe){if(_0x7336fe){return _0x7336fe[_0xf800('0x7a')](_0x3a2296[_0xf800('0x4e')][_0xf800('0x76')]);}})[_0xf800('0x1b')](respondWithStatusCode(_0x496cce,null))['catch'](handleError(_0x496cce,null));};exports[_0xf800('0x7b')]=function(_0x29ff98,_0xa990cd){_0x29ff98['body']['sitepic']=_0x29ff98[_0xf800('0x7c')]['filename'];return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x29ff98[_0xf800('0x61')]['id']}})['then'](handleEntityNotFound(_0xa990cd,null))[_0xf800('0x1b')](saveUpdates(_0x29ff98[_0xf800('0x66')],null))['then'](respondWithResult(_0xa990cd,null))['catch'](handleError(_0xa990cd,null));};exports[_0xf800('0x7d')]=function(_0x2e2f3d,_0x5610e2){_0x2e2f3d[_0xf800('0x66')][_0xf800('0x7e')]=_0x2e2f3d[_0xf800('0x7c')]['filename'];return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x2e2f3d[_0xf800('0x61')]['id']}})['then'](handleEntityNotFound(_0x5610e2,null))['then'](saveUpdates(_0x2e2f3d['body'],null))[_0xf800('0x1b')](respondWithResult(_0x5610e2,null))[_0xf800('0x23')](handleError(_0x5610e2,null));};exports['addCustomerAvatar']=function(_0x39d26a,_0x39709b){_0x39d26a[_0xf800('0x66')][_0xf800('0x7f')]=_0x39d26a[_0xf800('0x7c')][_0xf800('0x80')];return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x39d26a[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x39709b,null))[_0xf800('0x1b')](saveUpdates(_0x39d26a[_0xf800('0x66')],null))[_0xf800('0x1b')](respondWithResult(_0x39709b,null))['catch'](handleError(_0x39709b,null));};exports[_0xf800('0x81')]=function(_0x519d95,_0x194b2c){_0x519d95[_0xf800('0x66')][_0xf800('0x82')]=_0x519d95[_0xf800('0x7c')][_0xf800('0x80')];return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x519d95['params']['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x194b2c,null))[_0xf800('0x1b')](saveUpdates(_0x519d95[_0xf800('0x66')],null))[_0xf800('0x1b')](respondWithResult(_0x194b2c,null))[_0xf800('0x23')](handleError(_0x194b2c,null));};exports[_0xf800('0x83')]=function(_0x3cf8b6,_0x50a37b){var _0x1ccacc=path[_0xf800('0x84')](config[_0xf800('0x85')],_0xf800('0x86'));var _0x5a2073={'where':{'id':_0x3cf8b6[_0xf800('0x61')]['id']},'attributes':['id',_0xf800('0x87')],'raw':!![]};var _0x28a2db=![];return require(_0xf800('0x88'))['getLicense']()[_0xf800('0x1b')](function(_0x398858){if(_0x398858){_0x28a2db=_0x398858[_0xf800('0x89')];}})[_0xf800('0x1b')](function(){return db[_0xf800('0x4a')][_0xf800('0x63')](_0x5a2073);})['then'](handleEntityNotFound(_0x50a37b,null))[_0xf800('0x1b')](function(_0x49d2cd){if(_0x49d2cd){if(!_[_0xf800('0x8a')](_0x49d2cd[_0xf800('0x87')])){if(fs[_0xf800('0x8b')](path[_0xf800('0x84')](config[_0xf800('0x85')],_0xf800('0x8c'),_0x49d2cd[_0xf800('0x87')]))&&_0x28a2db){_0x1ccacc=path[_0xf800('0x84')](config[_0xf800('0x85')],'server/files/images/logos/',_0x49d2cd['sitepic']);}}return _0x50a37b[_0xf800('0x8d')](_0x1ccacc);}})[_0xf800('0x23')](handleError(_0x50a37b,null));};exports[_0xf800('0x8e')]=function(_0x4756c7,_0x104731){var _0x32ed09=path[_0xf800('0x84')](config[_0xf800('0x85')],_0xf800('0x8f'));var _0xf5efc1={'where':{'id':_0x4756c7[_0xf800('0x61')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xf800('0x63')](_0xf5efc1)[_0xf800('0x1b')](handleEntityNotFound(_0x104731,null))[_0xf800('0x1b')](function(_0x1e39f0){if(_0x1e39f0){if(!_[_0xf800('0x8a')](_0x1e39f0['agentAvatar'])){if(fs[_0xf800('0x8b')](path[_0xf800('0x84')](config['root'],'server/files/images/avatars/',_0x1e39f0[_0xf800('0x7e')]))){_0x32ed09=path[_0xf800('0x84')](config['root'],'server/files/images/avatars/',_0x1e39f0[_0xf800('0x7e')]);}}return _0x104731[_0xf800('0x8d')](_0x32ed09);}})['catch'](handleError(_0x104731,null));};exports[_0xf800('0x90')]=function(_0xb27940,_0x272100){var _0x57b57a=path[_0xf800('0x84')](config[_0xf800('0x85')],'server/files/images/avatars/customer_avatar.png');var _0x10350a={'where':{'id':_0xb27940[_0xf800('0x61')]['id']},'attributes':['id',_0xf800('0x7f'),'showCustomerAvatar'],'raw':!![]};return db[_0xf800('0x4a')][_0xf800('0x63')](_0x10350a)[_0xf800('0x1b')](handleEntityNotFound(_0x272100,null))[_0xf800('0x1b')](function(_0x2b4f03){if(_0x2b4f03){if(!_[_0xf800('0x8a')](_0x2b4f03[_0xf800('0x7f')])){if(fs['existsSync'](path[_0xf800('0x84')](config['root'],_0xf800('0x91'),_0x2b4f03['customerAvatar']))&&_0x2b4f03[_0xf800('0x92')]){_0x57b57a=path[_0xf800('0x84')](config['root'],'server/files/images/avatars/',_0x2b4f03['customerAvatar']);}}return _0x272100[_0xf800('0x8d')](_0x57b57a);}})[_0xf800('0x23')](handleError(_0x272100,null));};exports[_0xf800('0x93')]=function(_0x2eb447,_0x4a3f8b){var _0x44fa7d=path[_0xf800('0x84')](config[_0xf800('0x85')],_0xf800('0x94'));var _0x388c8a={'where':{'id':_0x2eb447[_0xf800('0x61')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xf800('0x63')](_0x388c8a)[_0xf800('0x1b')](handleEntityNotFound(_0x4a3f8b,null))['then'](function(_0xee95){if(_0xee95){if(!_[_0xf800('0x8a')](_0xee95[_0xf800('0x82')])){if(fs[_0xf800('0x8b')](path[_0xf800('0x84')](config[_0xf800('0x85')],_0xf800('0x91'),_0xee95['systemAvatar']))){_0x44fa7d=path[_0xf800('0x84')](config[_0xf800('0x85')],'server/files/images/avatars/',_0xee95['systemAvatar']);}}return _0x4a3f8b[_0xf800('0x8d')](_0x44fa7d);}})[_0xf800('0x23')](handleError(_0x4a3f8b,null));};function checkWebsiteInterval(_0x18cc2f){var _0x53d9f8=_0x18cc2f[_0xf800('0x95')];if(!_0x53d9f8){return Promise[_0xf800('0x96')](_0x18cc2f);}var _0x53d9a0=_0x18cc2f[_0xf800('0x97')]||undefined;return _0x53d9f8[_0xf800('0x98')](_0x53d9a0)[_0xf800('0x1b')](function(_0x2216e1){if(!_0x2216e1){throw new APIOutOfIntervalError();}return _0x18cc2f;});}exports[_0xf800('0x99')]=function(_0x1c8d90,_0x1610ae){var _0x2d625c={'body':_0x1c8d90[_0xf800('0x66')],'channel':_0xf800('0x9a')};var _0x3654e0=[];var _0x5b9821=[];var _0x3e8619={};var _0x42e204=![];if(_0x1c8d90[_0xf800('0x66')]['id']){delete _0x1c8d90[_0xf800('0x66')]['id'];}if(_[_0xf800('0x8a')](_0x1c8d90[_0xf800('0x66')][_0xf800('0x9b')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xf800('0x8a')](_0x1c8d90[_0xf800('0x66')][_0xf800('0x9c')])){throw new APIBadRequestError(_0xf800('0x9d'));}if(_[_0xf800('0x9e')](_0x1c8d90[_0xf800('0x66')][_0xf800('0x66')])){throw new APIBadRequestError(_0xf800('0x9f'));}var _0x28aaab=_0x1c8d90['body'][_0xf800('0x35')]&&_0x1c8d90[_0xf800('0x66')][_0xf800('0xa0')];return db['CmContact'][_0xf800('0x70')]()[_0xf800('0x1b')](function(_0x27ad2e){if(!_0x27ad2e){throw new Error(_0xf800('0xa1'));}_0x3654e0=Object[_0xf800('0x4f')](_0x27ad2e)['filter'](function(_0x195c6a){return![_0xf800('0xa2'),_0xf800('0xa3')]['includes'](_0x195c6a);});_0x5b9821=Object[_0xf800('0x4f')](_0x27ad2e)[_0xf800('0x59')](function(_0x12af4c){return!['createdAt','updatedAt',_0xf800('0xa4'),_0xf800('0xa5')][_0xf800('0xa6')](_0x12af4c);});if(!_[_0xf800('0xa6')](_0x5b9821,_0x1c8d90[_0xf800('0x66')][_0xf800('0x9c')])){throw new APIBadRequestError(_0xf800('0xa7')+_0x5b9821[_0xf800('0x84')](',\x20'));}_0x3e8619[_0x1c8d90[_0xf800('0x66')][_0xf800('0x9c')]]=_0x1c8d90[_0xf800('0x66')][_0xf800('0x9b')];})[_0xf800('0x1b')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1c8d90['params']['id']},'include':[{'model':db[_0xf800('0xa8')],'as':_0xf800('0xa9'),'include':[{'model':db['CmContact'],'as':_0xf800('0xaa'),'where':_0x3e8619,'limit':0x1,'order':[[_0xf800('0xa3'),_0xf800('0xab')]]}]},{'model':db[_0xf800('0xac')],'as':_0xf800('0xad')},{'model':db[_0xf800('0x95')],'as':'Interval','include':[{'model':db[_0xf800('0x95')],'as':_0xf800('0xae'),'attributes':['id',_0xf800('0xaf')],'raw':!![]}]}]});})[_0xf800('0x1b')](function(_0x824020){if(!_0x824020){throw new APINotFoundError(util[_0xf800('0x3e')](_0xf800('0xb0'),_0x1c8d90[_0xf800('0x61')]['id']));}if(_0x28aaab){return checkWebsiteInterval(_0x824020);}return _0x824020;})[_0xf800('0x1b')](function(_0x210070){_0x2d625c[_0xf800('0xb1')]=_0x210070;_0x2d625c[_0xf800('0xb2')]=_[_0xf800('0xb3')](_0x210070[_0xf800('0xad')],[_0xf800('0xb4')],[_0xf800('0xb5')]);if(_0x2d625c[_0xf800('0xb1')]['Applications']){delete _0x2d625c[_0xf800('0xb1')][_0xf800('0xad')];}_0x2d625c[_0xf800('0xb6')]=_0x210070[_0xf800('0xa9')]||{'id':_0x210070[_0xf800('0xa5')]};if(_0x2d625c[_0xf800('0xb6')]&&_0x2d625c['list'][_0xf800('0xaa')][_0xf800('0x53')]){return _0x2d625c[_0xf800('0xb6')][_0xf800('0xaa')][0x0];}var _0x431712=_[_0xf800('0x14')](_0x1c8d90[_0xf800('0x66')],{'firstName':_0x1c8d90[_0xf800('0x66')][_0xf800('0x9b')],'ListId':_0x210070[_0xf800('0xa5')]});_0x431712[_0x1c8d90[_0xf800('0x66')][_0xf800('0x9c')]]=_0x1c8d90[_0xf800('0x66')][_0xf800('0x9b')];return db[_0xf800('0xb7')][_0xf800('0x64')](_0x431712,{'fields':_0x3654e0,'raw':!![]});})[_0xf800('0x1b')](function(_0x2a1c11){_0x2d625c[_0xf800('0xb8')]=_0x2a1c11;var _0x46f539=createInteractionObject(_0x1c8d90[_0xf800('0x61')]['id'],_0x1c8d90[_0xf800('0x66')],_0x1c8d90['headers'],_0x2a1c11);var _0x415aa1={'ChatWebsiteId':_0x1c8d90[_0xf800('0x61')]['id']};if(_0x1c8d90[_0xf800('0x66')]['threadId']){_0x415aa1[_0xf800('0xb9')]=_0x1c8d90[_0xf800('0x66')]['threadId'];_0x415aa1[_0xf800('0xba')]=![];return db[_0xf800('0xbb')][_0xf800('0x63')]({'where':_0x415aa1})[_0xf800('0x1b')](function(_0x1ac6cc){var _0x2e96c1=_0x1c8d90[_0xf800('0x66')][_0xf800('0x35')]&&_0x1c8d90['body'][_0xf800('0xa0')];if(_0x1ac6cc){_0x42e204=!![];return _0x1ac6cc;}else if(!_0x2e96c1&&_0x1ac6cc&&_0x1ac6cc[_0xf800('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x46f539[_0xf800('0xb9')]=_0x1c8d90[_0xf800('0x66')][_0xf800('0xb9')];_0x46f539[_0xf800('0xbc')]=_0x1c8d90[_0xf800('0x66')]['externalUrl'];return db[_0xf800('0xbb')]['create'](_0x46f539);});}_0x415aa1[_0xf800('0xbd')]=_0x2a1c11['id'];if(_0x1c8d90[_0xf800('0x66')][_0xf800('0xbe')]&&_0x1c8d90[_0xf800('0x66')][_0xf800('0xbe')]['id']){_0x415aa1['id']=_0x1c8d90[_0xf800('0x66')][_0xf800('0xbe')]['id'];return db[_0xf800('0xbb')][_0xf800('0x63')]({'where':_0x415aa1})[_0xf800('0x1b')](function(_0x37356d){var _0x2c5ec7=_0x1c8d90[_0xf800('0x66')][_0xf800('0x35')]&&_0x1c8d90[_0xf800('0x66')]['referer'];if(!_0x2c5ec7&&_0x37356d&&_0x37356d[_0xf800('0xba')]){throw new APIConflictError(_0xf800('0xbf'));}else if(_0x37356d){_0x42e204=!![];return _0x37356d;}else{return db[_0xf800('0xbb')][_0xf800('0x64')](_0x46f539);}});}return db[_0xf800('0xbb')][_0xf800('0x64')](_0x46f539);})['then'](function(_0x17bdf4){if(!_0x42e204){return _0x17bdf4;}var _0x5b0adb={'from':(_0x2d625c[_0xf800('0xb8')]['firstName']||'')+'\x20'+(_0x2d625c[_0xf800('0xb8')]['lastName']||'')};if(_0x1c8d90[_0xf800('0x66')][_0xf800('0xb9')]&&_0x1c8d90['body']['messageId']&&_0x1c8d90[_0xf800('0x66')][_0xf800('0xb9')]!=_0x1c8d90['body'][_0xf800('0xc0')]){_0x5b0adb[_0xf800('0xb9')]=_0x1c8d90[_0xf800('0x66')]['messageId'];}return _0x17bdf4[_0xf800('0x2b')](_0x5b0adb);})[_0xf800('0x1b')](function(_0x177f73){_0x2d625c[_0xf800('0xbe')]=_0x177f73[_0xf800('0x2d')]({'plain':!![]});_0x2d625c[_0xf800('0xbe')]['created']=!_0x42e204;if(_0x2d625c[_0xf800('0xbe')][_0xf800('0xc1')]){if(_0x2d625c[_0xf800('0xb1')][_0xf800('0xc2')]){_0x2d625c['applications'][_0xf800('0xc3')]({'id':0x0,'priority':_0x2d625c[_0xf800('0xb2')]['length']+0x1,'app':'close','appdata':_0xf800('0xc4'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xf800('0x64')]({'body':_0x1c8d90[_0xf800('0x66')][_0xf800('0x66')],'ChatWebsiteId':_0x1c8d90[_0xf800('0x61')]['id'],'ChatInteractionId':_0x177f73['id'],'direction':'in','ContactId':_0x2d625c['contact']['id'],'AttachmentId':_0x1c8d90['body'][_0xf800('0xc5')]});})[_0xf800('0x1b')](function(_0x3b2bf9){_0x2d625c['message']=_0x3b2bf9;if(!_0x2d625c['interaction'][_0xf800('0xc6')]){return;}return db[_0xf800('0xc7')][_0xf800('0x63')]({'attributes':['id',_0xf800('0x40')],'where':{'id':_0x2d625c[_0xf800('0xbe')][_0xf800('0xc6')]}});})['then'](function(_0x416745){if(_0x416745){_0x2d625c['applications'][_0xf800('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x416745[_0xf800('0x40')]+','+(_0x2d625c[_0xf800('0xb1')][_0xf800('0xc9')]||0xa),'interval':_0xf800('0xca')});_0x2d625c['forcedOwnership']=!![];}if(!_0x2d625c[_0xf800('0xbe')][_0xf800('0xcb')]){return;}return db[_0xf800('0xcc')][_0xf800('0x63')]({'attributes':['id',_0xf800('0x40')],'where':{'id':_0x2d625c[_0xf800('0xbe')][_0xf800('0xcb')]}});})['then'](function(_0x56c231){if(_0x56c231){_0x2d625c['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xf800('0xcd'),'appdata':_0x56c231[_0xf800('0x40')]+','+(_0x2d625c[_0xf800('0xb1')][_0xf800('0xce')]||0x12c),'interval':_0xf800('0xca')});}return respondWithRpcPromise(_0xf800('0xcf'),'startRouting',_0x2d625c);})['then'](function(_0xd0533e){respondWithRpcPromise(_0xf800('0xd0'),_0xf800('0xd0'),{'event':_0xf800('0x99'),'message':_0xd0533e},client9002);return _0xd0533e;})[_0xf800('0x1b')](respondWithResult(_0x1610ae,null))[_0xf800('0x23')](APIHandleError(_0x1610ae));};exports[_0xf800('0xd1')]=function(_0x40a26d,_0x47c5ad){var _0x42128a,_0x4b291b,_0x52be5e;var _0x42eb6f=[];var _0x23440e={};var _0x2ac84=_0x40a26d[_0xf800('0xd2')]||[];var _0x169cde=[];var _0x542f35;return db[_0xf800('0xb7')][_0xf800('0x70')]()[_0xf800('0x1b')](function(_0x33adc3){if(!_0x33adc3){throw new db[(_0xf800('0xd3'))][(_0xf800('0xd4'))]('no\x20available\x20attributes');}_0x42eb6f=_[_0xf800('0xd5')](_[_0xf800('0x4f')](_0x33adc3),['createdAt',_0xf800('0xa3'),_0xf800('0xa4'),_0xf800('0xa5')]);if(_0x40a26d[_0xf800('0x66')]['id']){delete _0x40a26d[_0xf800('0x66')]['id'];}if(_[_0xf800('0x8a')](_0x40a26d[_0xf800('0x66')][_0xf800('0x9b')])){throw _0x47c5ad[_0xf800('0x24')](0x1f4)[_0xf800('0x31')](new db[(_0xf800('0xd3'))][(_0xf800('0xd4'))](_0xf800('0xd6')));}if(_[_0xf800('0x8a')](_0x40a26d[_0xf800('0x66')][_0xf800('0x66')])||_0x40a26d[_0xf800('0x66')]['body']===''){throw _0x47c5ad[_0xf800('0x24')](0x1f4)['send'](new db[(_0xf800('0xd3'))][(_0xf800('0xd4'))](_0xf800('0xd7')));}if(_[_0xf800('0x8a')](_0x40a26d[_0xf800('0x66')][_0xf800('0xd8')])){throw _0x47c5ad[_0xf800('0x24')](0x1f4)[_0xf800('0x31')](new db[(_0xf800('0xd3'))]['ValidationError'](_0xf800('0xd9')+_0x42eb6f));}if(!_[_0xf800('0xa6')](_0x42eb6f,_0x40a26d[_0xf800('0x66')][_0xf800('0xd8')])){throw _0x47c5ad['status'](0x1f4)[_0xf800('0x31')](new db[(_0xf800('0xd3'))][(_0xf800('0xd4'))](_0xf800('0xda')+_0x42eb6f));}_0x23440e[_0x40a26d['body'][_0xf800('0xd8')]]=_0x40a26d[_0xf800('0x66')]['from'];})[_0xf800('0x1b')](function(){return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x40a26d['params']['id']},'include':[{'model':db[_0xf800('0xa8')],'as':'List'},{'model':db[_0xf800('0xdb')],'as':_0xf800('0xdb')}]});})[_0xf800('0x1b')](handleEntityNotFound(_0x47c5ad,null))[_0xf800('0x1b')](function(_0x450734){if(_0x450734&&_0x450734[_0xf800('0xa9')]){_0x4b291b=_0x450734;var _0xb5e441=_[_0xf800('0x14')](_0x40a26d[_0xf800('0x66')],{'firstName':_0x40a26d[_0xf800('0x66')]['from'],'phone':_0x40a26d['body']['from'],'ListId':_0x450734['ListId']});_0xb5e441[_0x40a26d[_0xf800('0x66')]['mapKeyOffline']]=_0x40a26d[_0xf800('0x66')][_0xf800('0x9b')];return db[_0xf800('0xb7')]['findOrCreate']({'where':_0x23440e,'defaults':_0xb5e441});}})[_0xf800('0xdc')](function(_0x1942df){if(_0x1942df){_0x52be5e=_0x1942df;var _0x20b162=fs[_0xf800('0xdd')](path['join'](config[_0xf800('0x85')],_0xf800('0xde')),_0xf800('0xdf'));var _0x36e9fe=ejs[_0xf800('0xe0')](_0x20b162,{'body':_[_0xf800('0xe1')](_0x40a26d[_0xf800('0x66')][_0xf800('0x66')]),'bodyTitle':_0x4b291b[_0xf800('0xe2')]});return db['ChatOfflineMessage'][_0xf800('0x64')]({'body':_0x36e9fe,'plainBody':htmlToText['fromString'](_0x36e9fe),'ContactId':_0x1942df['id'],'ChatWebsiteId':_0x4b291b['id']});}})['then'](function(_0x174c9f){_0x542f35=_0x174c9f;if(_0x2ac84[_0xf800('0x53')]){var _0x2c2c5b=_0x2ac84[_0xf800('0x49')](function(_0x260a86){return{'name':_0x260a86[_0xf800('0xe3')],'basename':_0x260a86[_0xf800('0x80')],'type':_0x260a86[_0xf800('0xe4')],'ChatOfflineMessageId':_0x174c9f['id']};});_0x169cde=_0x2c2c5b[_0xf800('0x49')](_0x29afe4=>{var _0x3be96d={'filename':_0x29afe4['name'],'path':path['join'](config[_0xf800('0x85')],_0xf800('0xe5'),_0xf800('0xd2'),_0xf800('0xe6'),_0xf800('0xe7'),_0x29afe4['basename'])};return _0x3be96d;});if(!_0x4b291b[_0xf800('0xe8')]){return db[_0xf800('0xe9')][_0xf800('0xea')](function(_0x5b40d6){return db[_0xf800('0xeb')]['bulkCreate'](_0x2c2c5b,{'transaction':_0x5b40d6});});}}})[_0xf800('0x1b')](function(){if(_0x542f35){_0x42128a=_0x542f35;return db[_0xf800('0xdb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf800('0xec')],'as':_0xf800('0xed'),'raw':!![],'include':[{'model':db[_0xf800('0xee')],'as':_0xf800('0xee'),'raw':!![]}]}]});}})['then'](function(_0x319818){if(_0x319818&&_0x319818[_0xf800('0xed')]&&_0x4b291b[_0xf800('0xef')]&&_0x4b291b[_0xf800('0xf0')]){var _0x3674d7=_0x319818['getSmtpOptions']();return respondWithRpcPromise(_0xf800('0xf1'),_0xf800('0xf2'),{'account':_0x3674d7,'message':{'from':util['format'](_0xf800('0xf3'),_0x319818[_0xf800('0x40')],_0x319818[_0xf800('0xf4')]||_0x319818[_0xf800('0xed')][_0xf800('0x68')]),'to':_0x4b291b['forwardOfflineAddress'],'subject':_0x4b291b[_0xf800('0xf5')],'html':_0x42128a['body'],'attachments':_0x169cde}},client9003)[_0xf800('0x1b')](function(){return _0x42128a;})[_0xf800('0x23')](function(_0x7b61ee){logger['error'](_0x7b61ee);});}})[_0xf800('0x1b')](function(){if(_0x4b291b&&_0x4b291b[_0xf800('0xe8')]&&_0x4b291b[_0xf800('0xf6')]){var _0x498280=[];if(_0x2ac84[_0xf800('0x53')]){_0x498280=_0x2ac84['map'](function(_0x1f2eb5){return{'name':_0x1f2eb5[_0xf800('0xe3')],'basename':_0x1f2eb5[_0xf800('0x80')],'type':_0x1f2eb5[_0xf800('0xe4')],'ChatOfflineMessageId':_0x542f35['id']};});}var _0x5e1baa;if(!_[_0xf800('0x8a')](_0x4b291b[_0xf800('0xf7')])){var _0x2ed683=_['map'](_0x40a26d['body'],function(_0x1da259){return _0x1da259;});var _0x5d555e=_['toPairsIn'](_0x2ed683)[0x0];var _0x4ae75b=_['mapValues'](_0x5d555e,function(_0x165960){return _0x165960;});_0x5e1baa=_0x4ae75b[0x1][_0x4b291b['subjectOffline']];}var _0x560269={'from':_0x52be5e[_0xf800('0xf4')],'firstName':_0x52be5e[_0xf800('0xf8')],'lastName':_0x52be5e[_0xf800('0x3a')],'mapKey':_0xf800('0xf4'),'message':{'from':_0x52be5e[_0xf800('0xf4')],'to':_0x4b291b[_0xf800('0xdb')][_0xf800('0xf4')],'cc':'','subject':_[_0xf800('0x8a')](_0x5e1baa)?_0x4b291b[_0xf800('0xf5')]:_0x5e1baa,'messageId':'','sentAt':new Date(),'attach':_0x498280['length'],'attachments':_0x498280,'originChannel':_0xf800('0xf9'),'ChatWebsiteId':_0x4b291b['id'],'ChatOfflineMessageId':_0x42128a['id'],'originTo':_0x4b291b[_0xf800('0xdb')]['email']},'body':_0x42128a[_0xf800('0x66')]};var _0x1cb5f2={'account':{'id':_0x4b291b['MailAccountId']},'body':_0x560269,'log':_0xf800('0xfa')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x1cb5f2,client9001)[_0xf800('0x1b')](function(){return _0x42128a;})[_0xf800('0x23')](function(_0x8848f){logger['error'](_0x8848f);});}return;})[_0xf800('0x1b')](function(){if(_0x42128a){return _0x42128a;}})['then'](respondWithResult(_0x47c5ad,null))[_0xf800('0x23')](function(){for(var _0x228655 of _0x2ac84){var _0x36ab26=path['join'](config[_0xf800('0x85')],'server',_0xf800('0xd2'),_0xf800('0xe6'),_0xf800('0xe7'),_0x228655['filename']);fs_extra['remove'](_0x36ab26)['catch'](function(_0x5250d3){logger[_0xf800('0x1f')]('Could\x20not\x20remove\x20attachment\x20file',_0x36ab26,_0x5250d3);});}});};exports[_0xf800('0xfb')]=function(_0x582588,_0x48a4c8){return db[_0xf800('0xbb')][_0xf800('0x63')]({'where':{'id':_0x582588[_0xf800('0x61')]['id']}})['then'](handleEntityNotFound(_0x48a4c8,null))[_0xf800('0x1b')](function(_0x4ccf5c){if(_0x4ccf5c){return _0x4ccf5c[_0xf800('0xfb')](_0x582588[_0xf800('0x66')][_0xf800('0x76')],_[_0xf800('0xfc')](_0x582588['body'],[_0xf800('0x76'),'id'])||{});}})[_0xf800('0x1b')](respondWithResult(_0x48a4c8,null))[_0xf800('0x23')](handleError(_0x48a4c8,null));};exports[_0xf800('0xfd')]=function(_0x13d1ef,_0x5a8ca8){var _0x1f6392={'raw':![],'where':{}};var _0x256222={};var _0x137d05={'count':0x0,'rows':[]};return db[_0xf800('0x4a')][_0xf800('0xfe')]({'where':{'id':_0x13d1ef[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x5a8ca8,null))[_0xf800('0x1b')](function(_0x2f7238){if(_0x2f7238){_0x256222[_0xf800('0x43')]=_[_0xf800('0x4f')](db[_0xf800('0xbb')]['rawAttributes']);_0x256222[_0xf800('0x4e')]=_['keys'](_0x13d1ef[_0xf800('0x4e')]);_0x256222[_0xf800('0x50')]=_[_0xf800('0x62')](_0x256222[_0xf800('0x43')],_0x256222[_0xf800('0x4e')]);_0x1f6392[_0xf800('0x52')]=_[_0xf800('0x62')](_0x256222[_0xf800('0x43')],qs['fields'](_0x13d1ef[_0xf800('0x4e')][_0xf800('0x51')]));_0x1f6392['attributes']=_0x1f6392[_0xf800('0x52')]['length']?_0x1f6392[_0xf800('0x52')]:_0x256222[_0xf800('0x43')];if(!_0x13d1ef[_0xf800('0x4e')][_0xf800('0x54')](_0xf800('0x74'))){_0x1f6392[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x13d1ef[_0xf800('0x4e')][_0xf800('0x27')]);_0x1f6392[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x13d1ef[_0xf800('0x4e')][_0xf800('0x26')]);}_0x1f6392[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x13d1ef[_0xf800('0x4e')][_0xf800('0x56')]);_0x1f6392[_0xf800('0x57')]=qs[_0xf800('0x50')](_[_0xf800('0x58')](_0x13d1ef[_0xf800('0x4e')],_0x256222[_0xf800('0x50')]));_0x1f6392[_0xf800('0x57')][_0xf800('0x72')]=_0x2f7238['id'];if(_0x13d1ef[_0xf800('0x4e')][_0xf800('0x59')]){_0x1f6392['where']=_[_0xf800('0x5a')](_0x1f6392[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0x1f6392[_0xf800('0x52')],function(_0x3f3113){var _0x10bbae={};_0x10bbae[_0x3f3113]={'$like':'%'+_0x13d1ef['query'][_0xf800('0x59')]+'%'};return _0x10bbae;})});}_0x1f6392=_[_0xf800('0x5a')]({},_0x1f6392,_0x13d1ef['options']);return db['ChatInteraction'][_0xf800('0x28')]({'where':_0x1f6392[_0xf800('0x57')]})[_0xf800('0x1b')](function(_0x671703){_0x137d05[_0xf800('0x28')]=_0x671703;if(_0x13d1ef[_0xf800('0x4e')][_0xf800('0xff')]){_0x1f6392['include']=[{'model':db[_0xf800('0xb7')],'as':'Contact','required':![]},{'model':db[_0xf800('0xc7')],'as':_0xf800('0x100'),'attributes':[_0xf800('0x40'),_0xf800('0x101'),_0xf800('0x102')],'required':![]},{'model':db[_0xf800('0x103')],'as':_0xf800('0x104'),'attributes':['id',_0xf800('0x40'),'color'],'where':_0x13d1ef['query'][_0xf800('0x105')]?{'id':_0x13d1ef[_0xf800('0x4e')]['tag']}:undefined,'required':_0x13d1ef[_0xf800('0x4e')][_0xf800('0x105')]?!![]:![]}];}return db['ChatInteraction'][_0xf800('0x5e')](_0x1f6392);})[_0xf800('0x1b')](function(_0x3ccee7){_0x137d05[_0xf800('0x5f')]=_0x3ccee7;return _0x137d05;});}})[_0xf800('0x1b')](respondWithFilteredResult(_0x5a8ca8,_0x1f6392))[_0xf800('0x23')](handleError(_0x5a8ca8,null));};exports['getSnippet']=function(_0x1a3f8c,_0x3b651c){var _0x425a1d=0x0;var _0x2c68bb=0x0;var _0x1da823=![];var _0x4fac39;var _0x202b8f;return db['ChatWebsite'][_0xf800('0x63')]({'where':{'id':_0x1a3f8c['params']['id']},'include':[{'model':db[_0xf800('0x95')],'as':_0xf800('0x95'),'include':[{'model':db[_0xf800('0x95')],'as':_0xf800('0xae'),'attributes':['id',_0xf800('0xaf')]}]}]})[_0xf800('0x1b')](handleEntityNotFound(_0x3b651c,null))[_0xf800('0x1b')](function(_0x57952a){if(_0x57952a){_0x4fac39=_0x57952a;return _0x57952a[_0xf800('0x106')]({'raw':!![]});}})[_0xf800('0x1b')](function(_0x4fbc35){if(_0x4fac39){if(_0x4fbc35){_0x202b8f=_0x4fbc35;}}return require('../../config/license/util')[_0xf800('0x107')]();})[_0xf800('0x1b')](function(_0x23447c){if(_0x23447c){_0x2c68bb=_0x23447c[_0xf800('0x108')];_0x1da823=_0x23447c[_0xf800('0x89')];}})['then'](function(){return db['ChatInteraction'][_0xf800('0x28')]({'where':{'closed':![]}});})['then'](function(_0x40b977){_0x425a1d=_0x40b977;if(_0x2c68bb&&_0x40b977>_0x2c68bb){return db[_0xf800('0x109')]['findOne']({'where':{'id':0x1}})[_0xf800('0x1b')](function(_0x5d4b74){if(_0x5d4b74){_0x5d4b74['increment'](_0xf800('0x10a'));}});}})[_0xf800('0x1b')](function(){var _0x1052d1=_0x4fac39['Interval'];var _0x182a6f=_0x4fac39[_0xf800('0x97')]||undefined;return _0x1052d1?_0x1052d1[_0xf800('0x98')](_0x182a6f):!![];})['then'](function(_0x4a306e){var _0x5bba57=fs[_0xf800('0xdd')](path[_0xf800('0x84')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x31cb4d=_0xf800('0x10b');var _0x3a1c48=![];try{const _0x2b4c4c=new URL(_0x4fac39[_0xf800('0x67')]);_0x4fac39[_0xf800('0x67')]=_0x2b4c4c[_0xf800('0x10c')];}catch(_0x1d285d){}var _0x4f2803;if(_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]){_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]=_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]['replace'](/\/$/,'');_0x4f2803=wildcardUtils['testWebsiteWithWildcard'](_0x4fac39[_0xf800('0x67')],_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]);}else{_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]=_0x4fac39['address'];_0x4f2803=!![];}var _0xb80c79={'chatVersion':_0x31cb4d,'chatWebsiteAddressOrigin':_0x4f2803?_0x1a3f8c[_0xf800('0x10d')]['referer']:_0x4fac39[_0xf800('0x67')],'remote':_0x4fac39['remote'],'query':querystring[_0xf800('0x1e')](_[_0xf800('0x5a')](_0x4fac39['get']({'plain':!![]}),{'customerIp':_0x1a3f8c[_0xf800('0x10d')][_0xf800('0x37')]||_0x1a3f8c[_0xf800('0x10d')][_0xf800('0x10e')]||_0x1a3f8c['connection'][_0xf800('0x10f')]||_0x1a3f8c['ip'],'referer':_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')],'openedInteractions':_0x425a1d,'maxInteractions':_0x2c68bb,'virtual':_0x1da823[_0xf800('0x108')],'online':_0x4a306e,'custom':_0x1da823,'address':_0x4f2803?_0x1a3f8c[_0xf800('0x10d')][_0xf800('0xa0')]:null}))[_0xf800('0x110')](/'/g,'\x5c\x27')};_0x3b651c[_0xf800('0x31')](ejs[_0xf800('0xe0')](Mustache[_0xf800('0xe0')](_0x5bba57,_0xb80c79),{'proactiveActions':_0x202b8f,'alignment':_0x4fac39[_0xf800('0x111')],'verticalAlignment':_0x4fac39[_0xf800('0x112')],'div_color':_0x4fac39[_0xf800('0x113')],'labelText':_0x4fac39[_0xf800('0x114')],'text_color':_0x4fac39['textColor'],'text_button_color':_0x4fac39[_0xf800('0x115')],'button_color':_0x4fac39[_0xf800('0x116')],'background_color':_0x4fac39[_0xf800('0x117')],'hideWhenOffline':_0x4fac39['hideWhenOffline'],'intervalId':_0x4fac39[_0xf800('0x118')],'isDevelopment':_0x3a1c48,'chatVersion':_0x31cb4d}));})[_0xf800('0x23')](handleError(_0x3b651c,null));};exports[_0xf800('0x119')]=function(_0x49154c,_0x38ca3b){var _0x3ab053=_0x49154c[_0xf800('0x61')]['id'];var _0x1a3a39=_0x49154c[_0xf800('0x66')];var _0x10fc60=0xc8;var _0x4194c5=null;return db[_0xf800('0xe9')][_0xf800('0xea')]({'isolationLevel':db[_0xf800('0xe9')][_0xf800('0x11a')][_0xf800('0x11b')][_0xf800('0x11c')]},function(_0x4245c1){return db[_0xf800('0x4a')]['findOne']({'where':{'id':_0x3ab053},'transaction':_0x4245c1})[_0xf800('0x1b')](function(_0x7e2442){if(_0x7e2442){return db[_0xf800('0xac')]['destroy']({'where':{'ChatWebsiteId':_0x3ab053},'transaction':_0x4245c1})[_0xf800('0x1b')](function(){var _0x2652bb=_[_0xf800('0x49')](_0x1a3a39,function(_0x2261d4){_0x2261d4[_0xf800('0x72')]=_0x3ab053;return _0x2261d4;});return db[_0xf800('0xac')]['bulkCreate'](_0x2652bb,{'transaction':_0x4245c1});});}else{_0x10fc60=0x194;_0x4194c5=[];}});})[_0xf800('0x1b')](function(){if(_0x10fc60!==0x194){return db['ChatApplication'][_0xf800('0x11d')]({'where':{'ChatWebsiteId':_0x3ab053},'order':_0xf800('0xb4')})['then'](function(_0x281c8c){_0x4194c5=_0x281c8c;});}})[_0xf800('0x23')](function(_0x362c76){_0x10fc60=0x1f4;logger[_0xf800('0x1f')](_0x362c76['stack']);if(_0x362c76[_0xf800('0x40')]){delete _0x362c76['name'];}_0x4194c5=_0x362c76;})['finally'](function(){if(_0x4194c5===null){_0x38ca3b[_0xf800('0x2f')](_0x10fc60);}else{if(_0x10fc60===0x1f4){_0x38ca3b[_0xf800('0x24')](_0x10fc60)[_0xf800('0x31')](_0x4194c5);}else{_0x38ca3b[_0xf800('0x24')](_0x10fc60)[_0xf800('0x11e')](_0x4194c5);}}});};exports[_0xf800('0x11f')]=function(_0x154aca,_0x4a470b){var _0xc342dd={};var _0x528296={};var _0x34636a;var _0x411d83;return db[_0xf800('0x4a')]['findOne']({'where':{'id':_0x154aca[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x4a470b,null))[_0xf800('0x1b')](function(_0x542f44){if(_0x542f44){_0x34636a=_0x542f44;_0x528296[_0xf800('0x43')]=_[_0xf800('0x4f')](db[_0xf800('0xac')][_0xf800('0x4b')]);_0x528296[_0xf800('0x4e')]=_['keys'](_0x154aca[_0xf800('0x4e')]);_0x528296[_0xf800('0x50')]=_[_0xf800('0x62')](_0x528296[_0xf800('0x43')],_0x528296[_0xf800('0x4e')]);_0xc342dd[_0xf800('0x52')]=_[_0xf800('0x62')](_0x528296[_0xf800('0x43')],qs[_0xf800('0x51')](_0x154aca[_0xf800('0x4e')][_0xf800('0x51')]));_0xc342dd['attributes']=_0xc342dd[_0xf800('0x52')][_0xf800('0x53')]?_0xc342dd[_0xf800('0x52')]:_0x528296[_0xf800('0x43')];_0xc342dd[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x154aca[_0xf800('0x4e')]['sort']);_0xc342dd['where']=qs['filters'](_[_0xf800('0x58')](_0x154aca['query'],_0x528296[_0xf800('0x50')]));if(_0x154aca[_0xf800('0x4e')][_0xf800('0x59')]){_0xc342dd[_0xf800('0x57')]=_[_0xf800('0x5a')](_0xc342dd[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0xc342dd[_0xf800('0x52')],function(_0x422e80){var _0x2e1b4e={};_0x2e1b4e[_0x422e80]={'$like':'%'+_0x154aca[_0xf800('0x4e')][_0xf800('0x59')]+'%'};return _0x2e1b4e;})});}_0xc342dd=_[_0xf800('0x5a')]({},_0xc342dd,_0x154aca[_0xf800('0x5c')]);return _0x34636a['getApplications'](_0xc342dd);}})['then'](function(_0xd51d18){if(_0xd51d18){_0x411d83=_0xd51d18['length'];if(!_0x154aca['query'][_0xf800('0x54')](_0xf800('0x74'))){_0xc342dd['limit']=qs[_0xf800('0x27')](_0x154aca[_0xf800('0x4e')]['limit']);_0xc342dd[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x154aca[_0xf800('0x4e')][_0xf800('0x26')]);}return _0x34636a[_0xf800('0x11f')](_0xc342dd);}})[_0xf800('0x1b')](function(_0x7640dd){if(_0x7640dd){return _0x7640dd?{'count':_0x411d83,'rows':_0x7640dd}:null;}})['then'](respondWithResult(_0x4a470b,null))[_0xf800('0x23')](handleError(_0x4a470b,null));};exports[_0xf800('0x120')]=function(_0x4b94a5,_0x459651){return db[_0xf800('0x121')]['find']({'where':{'id':_0x4b94a5[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x459651,null))[_0xf800('0x1b')](function(_0x4fa589){if(_0x4fa589){return _0x4fa589[_0xf800('0x120')](_0x4b94a5[_0xf800('0x66')][_0xf800('0x76')],_[_0xf800('0xfc')](_0x4b94a5[_0xf800('0x66')],[_0xf800('0x76'),'id'])||{});}})['then'](respondWithResult(_0x459651,null))[_0xf800('0x23')](handleError(_0x459651,null));};exports[_0xf800('0x106')]=function(_0x2ca122,_0x50fa73){var _0x34e1e7={};var _0x5c01ad={};var _0x48de78;var _0x306c2b;return db[_0xf800('0x4a')][_0xf800('0xfe')]({'where':{'id':_0x2ca122[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x50fa73,null))[_0xf800('0x1b')](function(_0x5cf89){if(_0x5cf89){_0x48de78=_0x5cf89;_0x5c01ad[_0xf800('0x43')]=_[_0xf800('0x4f')](db[_0xf800('0x122')][_0xf800('0x4b')]);_0x5c01ad['query']=_['keys'](_0x2ca122[_0xf800('0x4e')]);_0x5c01ad[_0xf800('0x50')]=_[_0xf800('0x62')](_0x5c01ad[_0xf800('0x43')],_0x5c01ad[_0xf800('0x4e')]);_0x34e1e7['attributes']=_['intersection'](_0x5c01ad[_0xf800('0x43')],qs['fields'](_0x2ca122[_0xf800('0x4e')][_0xf800('0x51')]));_0x34e1e7['attributes']=_0x34e1e7[_0xf800('0x52')]['length']?_0x34e1e7[_0xf800('0x52')]:_0x5c01ad['model'];_0x34e1e7[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x2ca122['query'][_0xf800('0x56')]);_0x34e1e7[_0xf800('0x57')]=qs['filters'](_[_0xf800('0x58')](_0x2ca122[_0xf800('0x4e')],_0x5c01ad[_0xf800('0x50')]));if(_0x2ca122[_0xf800('0x4e')][_0xf800('0x59')]){_0x34e1e7[_0xf800('0x57')]=_[_0xf800('0x5a')](_0x34e1e7['where'],{'$or':_[_0xf800('0x49')](_0x34e1e7[_0xf800('0x52')],function(_0x319f0a){var _0x4b98b4={};_0x4b98b4[_0x319f0a]={'$like':'%'+_0x2ca122[_0xf800('0x4e')]['filter']+'%'};return _0x4b98b4;})});}_0x34e1e7=_[_0xf800('0x5a')]({},_0x34e1e7,_0x2ca122[_0xf800('0x5c')]);return _0x48de78[_0xf800('0x106')](_0x34e1e7);}})[_0xf800('0x1b')](function(_0x6cd133){if(_0x6cd133){_0x306c2b=_0x6cd133[_0xf800('0x53')];if(!_0x2ca122[_0xf800('0x4e')]['hasOwnProperty'](_0xf800('0x74'))){_0x34e1e7[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x2ca122['query']['limit']);_0x34e1e7[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x2ca122[_0xf800('0x4e')][_0xf800('0x26')]);}return _0x48de78['getProactiveActions'](_0x34e1e7);}})[_0xf800('0x1b')](function(_0xe6d0d6){if(_0xe6d0d6){return _0xe6d0d6?{'count':_0x306c2b,'rows':_0xe6d0d6}:null;}})[_0xf800('0x1b')](respondWithResult(_0x50fa73,null))[_0xf800('0x23')](handleError(_0x50fa73,null));};exports['getFields']=function(_0x39214f,_0x3dbd38){var _0x1254c0=_0x39214f[_0xf800('0x4e')][_0xf800('0x123')]===_0xf800('0x124')?'offlineForm':_0xf800('0x125');return db['ChatWebsite'][_0xf800('0x63')]({'attributes':['id',_0x1254c0],'where':{'id':_0x39214f[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x3dbd38,null))[_0xf800('0x1b')](function(_0x2ccdc3){if(_0x2ccdc3){var _0x18b4da=_0x2ccdc3[_0x1254c0];var _0x186acd=_0x18b4da&&_0x18b4da['items']?_0x18b4da[_0xf800('0x126')]:[];_0x3dbd38[_0xf800('0x31')]({'fromKey':_['isNil'](_0x18b4da['fromKey'])?undefined:_0x18b4da[_0xf800('0x127')],'count':_0x186acd[_0xf800('0x53')],'rows':_0x186acd});}})[_0xf800('0x23')](handleError(_0x3dbd38,null));};exports[_0xf800('0x128')]=function(_0x469def,_0x117ed0){var _0x13cace={'raw':![],'where':{}};var _0x23124d={};var _0x377160={'count':0x0,'rows':[]};return db[_0xf800('0x4a')][_0xf800('0xfe')]({'where':{'id':_0x469def[_0xf800('0x61')]['id']}})['then'](handleEntityNotFound(_0x117ed0,null))[_0xf800('0x1b')](function(_0x5503e9){if(_0x5503e9){_0x23124d[_0xf800('0x43')]=_[_0xf800('0x4f')](db[_0xf800('0x129')][_0xf800('0x4b')]);_0x23124d[_0xf800('0x4e')]=_[_0xf800('0x4f')](_0x469def[_0xf800('0x4e')]);_0x23124d[_0xf800('0x50')]=_[_0xf800('0x62')](_0x23124d[_0xf800('0x43')],_0x23124d[_0xf800('0x4e')]);_0x13cace['attributes']=_[_0xf800('0x62')](_0x23124d[_0xf800('0x43')],qs['fields'](_0x469def[_0xf800('0x4e')][_0xf800('0x51')]));_0x13cace[_0xf800('0x52')]=_0x13cace[_0xf800('0x52')][_0xf800('0x53')]?_0x13cace[_0xf800('0x52')]:_0x23124d[_0xf800('0x43')];if(!_0x469def[_0xf800('0x4e')][_0xf800('0x54')](_0xf800('0x74'))){_0x13cace[_0xf800('0x27')]=qs[_0xf800('0x27')](_0x469def[_0xf800('0x4e')]['limit']);_0x13cace[_0xf800('0x26')]=qs[_0xf800('0x26')](_0x469def[_0xf800('0x4e')][_0xf800('0x26')]);}_0x13cace['order']=qs[_0xf800('0x56')](_0x469def[_0xf800('0x4e')][_0xf800('0x56')]);_0x13cace[_0xf800('0x57')]=qs[_0xf800('0x50')](_[_0xf800('0x58')](_0x469def[_0xf800('0x4e')],_0x23124d[_0xf800('0x50')]));_0x13cace[_0xf800('0x57')][_0xf800('0x72')]=_0x5503e9['id'];if(_0x469def[_0xf800('0x4e')][_0xf800('0x59')]){_0x13cace['where']=_[_0xf800('0x5a')](_0x13cace['where'],{'$or':_[_0xf800('0x49')](_0x13cace[_0xf800('0x52')],function(_0x20abe5){var _0x49e52c={};_0x49e52c[_0x20abe5]={'$like':'%'+_0x469def[_0xf800('0x4e')]['filter']+'%'};return _0x49e52c;})});}_0x13cace=_[_0xf800('0x5a')]({},_0x13cace,_0x469def[_0xf800('0x5c')]);return db['ChatOfflineMessage'][_0xf800('0x28')]({'where':_0x13cace['where']})['then'](function(_0x1d86bf){_0x377160[_0xf800('0x28')]=_0x1d86bf;if(_0x469def[_0xf800('0x4e')][_0xf800('0xff')]){_0x13cace[_0xf800('0x5d')]=[{'all':!![]}];}else{_0x13cace[_0xf800('0x5d')]=[{'model':db[_0xf800('0xb7')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xf800('0x129')]['findAll'](_0x13cace);})[_0xf800('0x1b')](function(_0x4ea6c5){_0x377160[_0xf800('0x5f')]=_0x4ea6c5;return _0x377160;});}})[_0xf800('0x1b')](respondWithFilteredResult(_0x117ed0,_0x13cace))['catch'](handleError(_0x117ed0,null));};exports[_0xf800('0x12a')]=function(_0x533226,_0x4499da){return db[_0xf800('0x4a')]['find']({'where':{'id':_0x533226['params']['id']}})['then'](handleEntityNotFound(_0x4499da,null))[_0xf800('0x1b')](function(_0x13c891){if(_0x13c891){return _0x13c891['addAgents'](_0x533226[_0xf800('0x66')][_0xf800('0x76')],_['omit'](_0x533226[_0xf800('0x66')],['ids','id'])||{})[_0xf800('0xdc')](function(_0x24a24c){for(var _0x2cb1e5=0x0;_0x2cb1e5<_0x533226['body'][_0xf800('0x76')][_0xf800('0x53')];_0x2cb1e5+=0x1){socket['emit'](_0xf800('0x12b'),{'UserId':Number(_0x533226[_0xf800('0x66')][_0xf800('0x76')][_0x2cb1e5]),'ChatWebsiteId':Number(_0x533226[_0xf800('0x61')]['id'])});}return _0x24a24c;});}})[_0xf800('0x1b')](respondWithResult(_0x4499da,null))[_0xf800('0x23')](handleError(_0x4499da,null));};exports[_0xf800('0x12c')]=function(_0x4678d8,_0x14099f){return db[_0xf800('0x4a')][_0xf800('0x63')]({'where':{'id':_0x4678d8[_0xf800('0x61')]['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x14099f,null))[_0xf800('0x1b')](function(_0x5496e7){if(_0x5496e7){return _0x5496e7[_0xf800('0x12c')](_0x4678d8[_0xf800('0x4e')][_0xf800('0x76')])['then'](function(){if(_[_0xf800('0x12d')](_0x4678d8[_0xf800('0x4e')][_0xf800('0x76')])){for(var _0x21fb14=0x0;_0x21fb14<_0x4678d8[_0xf800('0x4e')][_0xf800('0x76')][_0xf800('0x53')];_0x21fb14+=0x1){socket['emit'](_0xf800('0x12e'),{'UserId':Number(_0x4678d8['query'][_0xf800('0x76')][_0x21fb14]),'ChatWebsiteId':Number(_0x4678d8[_0xf800('0x61')]['id'])});}}else{socket[_0xf800('0x12f')](_0xf800('0x12e'),{'UserId':Number(_0x4678d8[_0xf800('0x4e')][_0xf800('0x76')]),'ChatWebsiteId':Number(_0x4678d8[_0xf800('0x61')]['id'])});}});}})[_0xf800('0x1b')](respondWithStatusCode(_0x14099f,null))[_0xf800('0x23')](handleError(_0x14099f,null));};exports[_0xf800('0x130')]=function(_0x12a36a,_0x2efd73){var _0x5ae7e0={};var _0xf4fa43={};var _0x2961be;var _0x3607ee;return db[_0xf800('0x4a')][_0xf800('0xfe')]({'where':{'id':_0x12a36a['params']['id']}})[_0xf800('0x1b')](handleEntityNotFound(_0x2efd73,null))[_0xf800('0x1b')](function(_0x3dc9a9){if(_0x3dc9a9){_0x2961be=_0x3dc9a9;_0xf4fa43['model']=_[_0xf800('0x4f')](db[_0xf800('0xc7')][_0xf800('0x4b')]);_0xf4fa43[_0xf800('0x4e')]=_[_0xf800('0x4f')](_0x12a36a[_0xf800('0x4e')]);_0xf4fa43['filters']=_[_0xf800('0x62')](_0xf4fa43['model'],_0xf4fa43[_0xf800('0x4e')]);_0x5ae7e0['attributes']=_['intersection'](_0xf4fa43[_0xf800('0x43')],qs[_0xf800('0x51')](_0x12a36a[_0xf800('0x4e')][_0xf800('0x51')]));_0x5ae7e0['attributes']=_0x5ae7e0['attributes'][_0xf800('0x53')]?_0x5ae7e0[_0xf800('0x52')]:_0xf4fa43[_0xf800('0x43')];_0x5ae7e0[_0xf800('0x55')]=qs[_0xf800('0x56')](_0x12a36a[_0xf800('0x4e')][_0xf800('0x56')]);_0x5ae7e0['where']=qs['filters'](_['pick'](_0x12a36a[_0xf800('0x4e')],_0xf4fa43[_0xf800('0x50')]));if(_0x12a36a[_0xf800('0x4e')][_0xf800('0x59')]){_0x5ae7e0['where']=_[_0xf800('0x5a')](_0x5ae7e0[_0xf800('0x57')],{'$or':_[_0xf800('0x49')](_0x5ae7e0[_0xf800('0x52')],function(_0x32b500){var _0xbb7b31={};_0xbb7b31[_0x32b500]={'$like':'%'+_0x12a36a['query'][_0xf800('0x59')]+'%'};return _0xbb7b31;})});}_0x5ae7e0=_[_0xf800('0x5a')]({},_0x5ae7e0,_0x12a36a['options']);return _0x2961be[_0xf800('0x130')](_0x5ae7e0);}})[_0xf800('0x1b')](function(_0x24aa23){if(_0x24aa23){_0x3607ee=_0x24aa23[_0xf800('0x53')];if(!_0x12a36a[_0xf800('0x4e')][_0xf800('0x54')](_0xf800('0x74'))){_0x5ae7e0[_0xf800('0x27')]=qs['limit'](_0x12a36a['query'][_0xf800('0x27')]);_0x5ae7e0['offset']=qs[_0xf800('0x26')](_0x12a36a[_0xf800('0x4e')]['offset']);}return _0x2961be[_0xf800('0x130')](_0x5ae7e0);}})[_0xf800('0x1b')](function(_0x5ceecb){if(_0x5ceecb){return _0x5ceecb?{'count':_0x3607ee,'rows':_0x5ceecb}:null;}})[_0xf800('0x1b')](respondWithResult(_0x2efd73,null))['catch'](handleError(_0x2efd73,null));}; \ No newline at end of file +var _0x3aae=['Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','ContactId','interaction','contact','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','unshift','queue','Start','startRouting','EventManager','files','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','originalname','mimetype','openNewInteraction','sequelize','transaction','Attachment','findOne','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','color','tag','getSnippet','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','origin','replace','testWebsiteWithWildcard','remote','x-forwarded-for','x-real-ip','remoteAddress','render','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','onlineForm','items','fromKey','addAgents','spread','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatWebsite,\x20%s,\x20%s','status','end','json','undefined','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','sendStatus','stack','send','user-agent-parser','setUA','user-agent','customerIp','first','firstName','x-real-port','referer','name','format','browser','version','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','describe','addDisposition','getDispositions','Disposition','hasOwnProperty','order','ChatWebsiteId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','asc','list','headers','threadId','closed'];(function(_0x52b227,_0x590c49){var _0x122ec5=function(_0x147b77){while(--_0x147b77){_0x52b227['push'](_0x52b227['shift']());}};_0x122ec5(++_0x590c49);}(_0x3aae,0x7e));var _0xe3aa=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3aae[_0x17d9e3];return _0x14192d;};'use strict';var Mustache=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var path=require(_0xe3aa('0x2'));var ejs=require(_0xe3aa('0x3'));var fs=require('fs');var fs_extra=require(_0xe3aa('0x4'));var _=require(_0xe3aa('0x5'));var querystring=require(_0xe3aa('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xe3aa('0x7'));var jayson=require(_0xe3aa('0x8'));var qs=require(_0xe3aa('0x9'));var logger=require(_0xe3aa('0xa'))(_0xe3aa('0xb'));var config=require(_0xe3aa('0xc'));var APIBadRequestError=require(_0xe3aa('0xd'))[_0xe3aa('0xe')];var APINotFoundError=require(_0xe3aa('0xd'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xe3aa('0xd'))[_0xe3aa('0xf')];var APIHandleError=require('../../errors/api')[_0xe3aa('0x10')];var APIConflictError=require('../../errors/api')[_0xe3aa('0x11')];var wildcardUtils=require(_0xe3aa('0x12'));var URL=require(_0xe3aa('0x13'))['URL'];var db=require(_0xe3aa('0x14'))['db'];config[_0xe3aa('0x15')]=_[_0xe3aa('0x16')](config[_0xe3aa('0x15')],{'host':_0xe3aa('0x17'),'port':0x18eb});var socket=require(_0xe3aa('0x18'))(new Redis(config[_0xe3aa('0x15')]));require(_0xe3aa('0x19'))[_0xe3aa('0x1a')](socket);var client=jayson[_0xe3aa('0x1b')][_0xe3aa('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xe3aa('0x1c')]({'port':0x232a});var client9003=jayson[_0xe3aa('0x1b')][_0xe3aa('0x1c')]({'port':0x232b});var client9001=jayson[_0xe3aa('0x1b')][_0xe3aa('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x32c45a,_0x2b9dd2,_0x6041ac,_0x3aab8e){return new Promise(function(_0x5121ac,_0x492bbc){var _0x24eaaa=_0x3aab8e||client;return _0x24eaaa[_0xe3aa('0x1d')](_0x32c45a,_0x6041ac)[_0xe3aa('0x1e')](function(_0x108238){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2b9dd2,_0xe3aa('0x1f'));logger[_0xe3aa('0x20')](_0xe3aa('0x21'),_0x2b9dd2,'request\x20sent',JSON[_0xe3aa('0x22')](_0x108238));if(_0x108238[_0xe3aa('0x23')]){if(_0x108238[_0xe3aa('0x23')][_0xe3aa('0x24')]===0x1f4){logger[_0xe3aa('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x2b9dd2,_0x108238[_0xe3aa('0x23')][_0xe3aa('0x25')]);return _0x492bbc(_0x108238[_0xe3aa('0x23')]['message']);}logger[_0xe3aa('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x2b9dd2,_0x108238[_0xe3aa('0x23')][_0xe3aa('0x25')]);return _0x5121ac(_0x108238[_0xe3aa('0x23')][_0xe3aa('0x25')]);}else{logger[_0xe3aa('0x26')](_0xe3aa('0x27'),_0x2b9dd2,'request\x20sent');_0x5121ac(_0x108238['result'][_0xe3aa('0x25')]);}})['catch'](function(_0x202610){logger[_0xe3aa('0x23')](_0xe3aa('0x27'),_0x2b9dd2,_0x202610);_0x492bbc(_0x202610);});});}function respondWithStatusCode(_0x4e2144,_0x1117a5){_0x1117a5=_0x1117a5||0xcc;return function(_0x52cce2){if(_0x52cce2){return _0x4e2144['sendStatus'](_0x1117a5);}return _0x4e2144[_0xe3aa('0x28')](_0x1117a5)[_0xe3aa('0x29')]();};}function respondWithResult(_0x16199f,_0x378375){_0x378375=_0x378375||0xc8;return function(_0x35ef25){if(_0x35ef25){return _0x16199f[_0xe3aa('0x28')](_0x378375)[_0xe3aa('0x2a')](_0x35ef25);}};}function respondWithFilteredResult(_0x417424,_0x22919f){return function(_0x3c5094){if(_0x3c5094){var _0x1501da=typeof _0x22919f['offset']===_0xe3aa('0x2b')&&typeof _0x22919f['limit']===_0xe3aa('0x2b');var _0x5dddf1=_0x3c5094[_0xe3aa('0x2c')];var _0x352b99=_0x1501da?0x0:_0x22919f['offset'];var _0x3c924f=_0x1501da?_0x3c5094[_0xe3aa('0x2c')]:_0x22919f['offset']+_0x22919f[_0xe3aa('0x2d')];var _0x14a35c;if(_0x3c924f>=_0x5dddf1){_0x3c924f=_0x5dddf1;_0x14a35c=0xc8;}else{_0x14a35c=0xce;}_0x417424[_0xe3aa('0x28')](_0x14a35c);return _0x417424[_0xe3aa('0x2e')](_0xe3aa('0x2f'),_0x352b99+'-'+_0x3c924f+'/'+_0x5dddf1)['json'](_0x3c5094);}return null;};}function saveUpdates(_0x405f0a){return function(_0x558fb6){if(_0x558fb6){return _0x558fb6[_0xe3aa('0x30')](_0x405f0a)['then'](function(_0xbe1d93){return _0xbe1d93;});}return null;};}function removeEntity(_0x2b9538){return function(_0x2706da){if(_0x2706da){return _0x2706da[_0xe3aa('0x31')]()[_0xe3aa('0x1e')](function(){var _0x13be1b=_0x2706da[_0xe3aa('0x32')]({'plain':!![]});var _0x56adca=_0xe3aa('0x33');return db['UserProfileResource'][_0xe3aa('0x31')]({'where':{'type':_0x56adca,'resourceId':_0x13be1b['id']}})[_0xe3aa('0x1e')](function(){return _0x2706da;});})[_0xe3aa('0x1e')](function(){_0x2b9538[_0xe3aa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28af1e){return function(_0x3d9168){if(!_0x3d9168){_0x28af1e[_0xe3aa('0x34')](0x194);}return _0x3d9168;};}function handleError(_0x2b4ecc,_0x4883db){_0x4883db=_0x4883db||0x1f4;return function(_0x13aa20){logger[_0xe3aa('0x23')](_0x13aa20[_0xe3aa('0x35')]);if(_0x13aa20['name']){delete _0x13aa20['name'];}_0x2b4ecc['status'](_0x4883db)[_0xe3aa('0x36')](_0x13aa20);};}function createInteractionObject(_0x5e8477,_0x2b97a1,_0x2774e6,_0x2cff7a){var _0x12b866=require(_0xe3aa('0x37'));var _0x2d6881=new _0x12b866();var _0x35e69a=_0x2d6881[_0xe3aa('0x38')](_0x2774e6[_0xe3aa('0x39')])['getResult']();var _0x4cbffb=_0x2b97a1[_0xe3aa('0x3a')];if(_0x2774e6['cf-connecting-ip']){_0x4cbffb=_0x2774e6['cf-connecting-ip'];}else if(_0x2774e6['x-forwarded-for']){_0x4cbffb=_[_0xe3aa('0x3b')](_0x2774e6['x-forwarded-for']['split'](','));}return{'ContactId':_0x2cff7a['id'],'ChatWebsiteId':_0x5e8477,'from':(_0x2cff7a[_0xe3aa('0x3c')]||'')+'\x20'+(_0x2cff7a['lastName']||''),'customerIp':_0x4cbffb,'customerPort':_0x2774e6[_0xe3aa('0x3d')]?_0x2774e6[_0xe3aa('0x3d')]:null,'referer':_0x2b97a1[_0xe3aa('0x3e')],'browserName':_0x35e69a['browser'][_0xe3aa('0x3f')]&&_0x35e69a['browser']['version']?util[_0xe3aa('0x40')]('%s\x20%s',_0x35e69a['browser'][_0xe3aa('0x3f')],_0x35e69a[_0xe3aa('0x41')][_0xe3aa('0x42')]):'unknown','browserVersion':_0x35e69a[_0xe3aa('0x41')][_0xe3aa('0x42')]||_0xe3aa('0x43'),'osName':util[_0xe3aa('0x40')](_0xe3aa('0x44'),_0x35e69a['os']['name'],_0x35e69a['os'][_0xe3aa('0x42')]),'osVersion':_0x35e69a['os']['version'],'deviceModel':_0x35e69a[_0xe3aa('0x45')][_0xe3aa('0x46')]&&_0x35e69a[_0xe3aa('0x45')][_0xe3aa('0x47')]?util[_0xe3aa('0x40')](_0xe3aa('0x48'),_0x35e69a[_0xe3aa('0x45')][_0xe3aa('0x46')],_0x35e69a[_0xe3aa('0x45')]['vendor'],_0x35e69a[_0xe3aa('0x45')][_0xe3aa('0x49')]):null,'deviceVendor':_0x35e69a['device'][_0xe3aa('0x47')],'deviceType':_0x35e69a[_0xe3aa('0x45')][_0xe3aa('0x49')],'formData':JSON[_0xe3aa('0x22')](_0x2b97a1)};}exports[_0xe3aa('0x4a')]=function(_0x18c84f,_0xd013a8){var _0x28f799={'include':[{'model':db[_0xe3aa('0x4b')],'as':_0xe3aa('0x4c')}]},_0x3ac8f0={},_0x7736fb={'count':0x0,'rows':[]};var _0x282a40=_[_0xe3aa('0x4d')](db[_0xe3aa('0x4e')][_0xe3aa('0x4f')],function(_0x1be115){return{'name':_0x1be115[_0xe3aa('0x50')],'type':_0x1be115['type'][_0xe3aa('0x51')]};});_0x3ac8f0[_0xe3aa('0x46')]=_[_0xe3aa('0x4d')](_0x282a40,_0xe3aa('0x3f'));_0x3ac8f0[_0xe3aa('0x52')]=_[_0xe3aa('0x53')](_0x18c84f['query']);_0x3ac8f0[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x3ac8f0['model'],_0x3ac8f0[_0xe3aa('0x52')]);_0x28f799[_0xe3aa('0x56')]=_['intersection'](_0x3ac8f0[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x18c84f['query'][_0xe3aa('0x57')]));_0x28f799[_0xe3aa('0x56')]=_0x28f799[_0xe3aa('0x56')][_0xe3aa('0x58')]?_0x28f799[_0xe3aa('0x56')]:_0x3ac8f0['model'];if(!_0x18c84f[_0xe3aa('0x52')]['hasOwnProperty'](_0xe3aa('0x59'))){_0x28f799[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x18c84f[_0xe3aa('0x52')][_0xe3aa('0x2d')]);_0x28f799[_0xe3aa('0x5a')]=qs['offset'](_0x18c84f['query']['offset']);}_0x28f799['order']=qs[_0xe3aa('0x5b')](_0x18c84f[_0xe3aa('0x52')][_0xe3aa('0x5b')]);_0x28f799['where']=qs['filters'](_['pick'](_0x18c84f['query'],_0x3ac8f0[_0xe3aa('0x54')]),_0x282a40);if(_0x18c84f[_0xe3aa('0x52')][_0xe3aa('0x5c')]){_0x28f799['where']=_[_0xe3aa('0x5d')](_0x28f799[_0xe3aa('0x5e')],{'$or':_['map'](_0x282a40,function(_0x58951d){if(_0x58951d[_0xe3aa('0x49')]!==_0xe3aa('0x5f')){var _0x3d054a={};_0x3d054a[_0x58951d['name']]={'$like':'%'+_0x18c84f['query'][_0xe3aa('0x5c')]+'%'};return _0x3d054a;}})});}_0x28f799=_[_0xe3aa('0x5d')]({},_0x28f799,_0x18c84f[_0xe3aa('0x60')]);var _0x53ea6a={'where':_0x28f799['where']};return db[_0xe3aa('0x4e')]['count'](_0x53ea6a)[_0xe3aa('0x1e')](function(_0x47e74c){_0x7736fb[_0xe3aa('0x2c')]=_0x47e74c;if(_0x18c84f[_0xe3aa('0x52')][_0xe3aa('0x61')]){_0x28f799[_0xe3aa('0x62')]=[{'all':!![]}];}return db[_0xe3aa('0x4e')]['findAll'](_0x28f799);})['then'](function(_0x5bc8a8){_0x7736fb[_0xe3aa('0x63')]=_0x5bc8a8;return _0x7736fb;})[_0xe3aa('0x1e')](respondWithFilteredResult(_0xd013a8,_0x28f799))['catch'](handleError(_0xd013a8,null));};exports[_0xe3aa('0x64')]=function(_0x909ca6,_0x4db825){var _0x289c7d={'raw':![],'where':{'id':_0x909ca6[_0xe3aa('0x65')]['id']},'include':[{'model':db[_0xe3aa('0x4b')],'as':_0xe3aa('0x4c')}]},_0x1340b2={};_0x1340b2['model']=_['keys'](db['ChatWebsite'][_0xe3aa('0x4f')]);_0x1340b2['query']=_[_0xe3aa('0x53')](_0x909ca6[_0xe3aa('0x52')]);_0x1340b2[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x1340b2['model'],_0x1340b2[_0xe3aa('0x52')]);_0x289c7d[_0xe3aa('0x56')]=_[_0xe3aa('0x55')](_0x1340b2[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x909ca6[_0xe3aa('0x52')]['fields']));_0x289c7d[_0xe3aa('0x56')]=_0x289c7d['attributes'][_0xe3aa('0x58')]?_0x289c7d[_0xe3aa('0x56')]:_0x1340b2['model'];if(_0x909ca6[_0xe3aa('0x52')][_0xe3aa('0x61')]){_0x289c7d[_0xe3aa('0x62')]=[{'all':!![]}];}_0x289c7d=_[_0xe3aa('0x5d')]({},_0x289c7d,_0x909ca6[_0xe3aa('0x60')]);return db['ChatWebsite'][_0xe3aa('0x66')](_0x289c7d)[_0xe3aa('0x1e')](handleEntityNotFound(_0x4db825,null))[_0xe3aa('0x1e')](respondWithResult(_0x4db825,null))[_0xe3aa('0x67')](handleError(_0x4db825,null));};exports[_0xe3aa('0x68')]=function(_0x5d56cf,_0x336ab5){if(!wildcardUtils['testWildcardValidity'](_0x5d56cf[_0xe3aa('0x69')][_0xe3aa('0x6a')])){return handleError(_0x336ab5,null)(new APIBadRequestError('\x22'+_0x5d56cf[_0xe3aa('0x69')][_0xe3aa('0x6a')]+_0xe3aa('0x6b')));}return db[_0xe3aa('0x4e')]['create'](_0x5d56cf[_0xe3aa('0x69')],{})[_0xe3aa('0x1e')](function(_0xf15208){var _0x2a76ee=_0x5d56cf[_0xe3aa('0x6c')][_0xe3aa('0x32')]({'plain':!![]});if(!_0x2a76ee)throw new Error(_0xe3aa('0x6d'));if(_0x2a76ee['role']==='user'){var _0x295d3f=_0xf15208[_0xe3aa('0x32')]({'plain':!![]});var _0x2e7e24=_0xe3aa('0x33');return db['UserProfileSection'][_0xe3aa('0x66')]({'where':{'name':_0x2e7e24,'userProfileId':_0x2a76ee[_0xe3aa('0x6e')]},'raw':!![]})['then'](function(_0x1fec9c){if(_0x1fec9c&&_0x1fec9c[_0xe3aa('0x6f')]===0x0){return db['UserProfileResource'][_0xe3aa('0x68')]({'name':_0x295d3f[_0xe3aa('0x3f')],'resourceId':_0x295d3f['id'],'type':_0x1fec9c[_0xe3aa('0x3f')],'sectionId':_0x1fec9c['id']},{})[_0xe3aa('0x1e')](function(){return _0xf15208;});}else{return _0xf15208;}})['catch'](function(_0x36fc23){logger[_0xe3aa('0x23')](_0xe3aa('0x70'),_0x36fc23);throw _0x36fc23;});}return _0xf15208;})['then'](respondWithResult(_0x336ab5,0xc9))[_0xe3aa('0x67')](handleError(_0x336ab5,null));};exports[_0xe3aa('0x30')]=function(_0x5179f5,_0x124170){if(!wildcardUtils[_0xe3aa('0x71')](_0x5179f5['body'][_0xe3aa('0x6a')])){return handleError(_0x124170,null)(new APIBadRequestError('\x22'+_0x5179f5[_0xe3aa('0x69')]['address']+_0xe3aa('0x6b')));}if(_0x5179f5[_0xe3aa('0x69')]['id']){delete _0x5179f5[_0xe3aa('0x69')]['id'];}return db['ChatWebsite'][_0xe3aa('0x66')]({'where':{'id':_0x5179f5['params']['id']},'include':[{'model':db[_0xe3aa('0x4b')],'as':_0xe3aa('0x4c')}]})[_0xe3aa('0x1e')](handleEntityNotFound(_0x124170,null))[_0xe3aa('0x1e')](saveUpdates(_0x5179f5[_0xe3aa('0x69')],null))['then'](respondWithResult(_0x124170,null))[_0xe3aa('0x67')](handleError(_0x124170,null));};exports['destroy']=function(_0x5b4794,_0x2e1810){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x5b4794[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x2e1810,null))['then'](removeEntity(_0x2e1810,null))['catch'](handleError(_0x2e1810,null));};exports[_0xe3aa('0x72')]=function(_0x4890a5,_0x31061b){return db['ChatWebsite'][_0xe3aa('0x72')]()[_0xe3aa('0x1e')](respondWithResult(_0x31061b,null))['catch'](handleError(_0x31061b,null));};exports[_0xe3aa('0x73')]=function(_0x4ca7a0,_0x5b7dd0){if(_0x4ca7a0[_0xe3aa('0x69')]['id']){delete _0x4ca7a0[_0xe3aa('0x69')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4ca7a0[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x5b7dd0,null))[_0xe3aa('0x1e')](function(_0x1a1359){if(_0x1a1359){_0x4ca7a0[_0xe3aa('0x69')]['ChatWebsiteId']=_0x1a1359['id'];return db['Disposition']['create'](_0x4ca7a0[_0xe3aa('0x69')]);}})[_0xe3aa('0x1e')](respondWithResult(_0x5b7dd0,null))[_0xe3aa('0x67')](handleError(_0x5b7dd0,null));};exports[_0xe3aa('0x74')]=function(_0xe3efe,_0x1e01bd){var _0x527b7c={'raw':![],'where':{}};var _0x5966b7={};var _0x22acb5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xe3efe[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x1e01bd,null))['then'](function(_0x3cb1f3){if(_0x3cb1f3){_0x5966b7[_0xe3aa('0x46')]=_['keys'](db[_0xe3aa('0x75')]['rawAttributes']);_0x5966b7[_0xe3aa('0x52')]=_[_0xe3aa('0x53')](_0xe3efe[_0xe3aa('0x52')]);_0x5966b7[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x5966b7['model'],_0x5966b7['query']);_0x527b7c['attributes']=_[_0xe3aa('0x55')](_0x5966b7[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0xe3efe[_0xe3aa('0x52')]['fields']));_0x527b7c[_0xe3aa('0x56')]=_0x527b7c[_0xe3aa('0x56')]['length']?_0x527b7c[_0xe3aa('0x56')]:_0x5966b7[_0xe3aa('0x46')];if(!_0xe3efe['query'][_0xe3aa('0x76')]('nolimit')){_0x527b7c[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0xe3efe[_0xe3aa('0x52')][_0xe3aa('0x2d')]);_0x527b7c['offset']=qs[_0xe3aa('0x5a')](_0xe3efe[_0xe3aa('0x52')][_0xe3aa('0x5a')]);}_0x527b7c[_0xe3aa('0x77')]=qs[_0xe3aa('0x5b')](_0xe3efe[_0xe3aa('0x52')][_0xe3aa('0x5b')]);_0x527b7c[_0xe3aa('0x5e')]=qs[_0xe3aa('0x54')](_['pick'](_0xe3efe[_0xe3aa('0x52')],_0x5966b7['filters']));_0x527b7c[_0xe3aa('0x5e')][_0xe3aa('0x78')]=_0x3cb1f3['id'];if(_0xe3efe[_0xe3aa('0x52')]['filter']){_0x527b7c[_0xe3aa('0x5e')]=_[_0xe3aa('0x5d')](_0x527b7c[_0xe3aa('0x5e')],{'$or':_[_0xe3aa('0x4d')](_0x527b7c[_0xe3aa('0x56')],function(_0x1bc77d){var _0xb760fa={};_0xb760fa[_0x1bc77d]={'$like':'%'+_0xe3efe[_0xe3aa('0x52')][_0xe3aa('0x5c')]+'%'};return _0xb760fa;})});}_0x527b7c=_[_0xe3aa('0x5d')]({},_0x527b7c,_0xe3efe['options']);return db['Disposition'][_0xe3aa('0x2c')]({'where':_0x527b7c[_0xe3aa('0x5e')]})['then'](function(_0x389de8){_0x22acb5['count']=_0x389de8;if(_0xe3efe[_0xe3aa('0x52')][_0xe3aa('0x61')]){_0x527b7c[_0xe3aa('0x62')]=[{'all':!![]}];}return db[_0xe3aa('0x75')][_0xe3aa('0x79')](_0x527b7c);})['then'](function(_0x2278b6){_0x22acb5['rows']=_0x2278b6;return _0x22acb5;});}})[_0xe3aa('0x1e')](respondWithFilteredResult(_0x1e01bd,_0x527b7c))[_0xe3aa('0x67')](handleError(_0x1e01bd,null));};exports[_0xe3aa('0x7a')]=function(_0x2bae00,_0x1875de){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x2bae00['params']['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x1875de,null))[_0xe3aa('0x1e')](function(_0x47c942){if(_0x47c942){return _0x47c942[_0xe3aa('0x7a')](_0x2bae00[_0xe3aa('0x52')][_0xe3aa('0x7b')]);}})[_0xe3aa('0x1e')](respondWithStatusCode(_0x1875de,null))[_0xe3aa('0x67')](handleError(_0x1875de,null));};exports[_0xe3aa('0x7c')]=function(_0x151a3d,_0x6d6aef){if(_0x151a3d['body']['id']){delete _0x151a3d[_0xe3aa('0x69')]['id'];}return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x151a3d[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x6d6aef,null))[_0xe3aa('0x1e')](function(_0x5ac9bd){if(_0x5ac9bd){_0x151a3d[_0xe3aa('0x69')][_0xe3aa('0x78')]=_0x5ac9bd['id'];return db[_0xe3aa('0x7d')][_0xe3aa('0x68')](_0x151a3d['body']);}})['then'](respondWithResult(_0x6d6aef,null))[_0xe3aa('0x67')](handleError(_0x6d6aef,null));};exports['getAnswers']=function(_0x52290d,_0x5c2123){var _0x2b49be={'raw':![],'where':{}};var _0x5f2d13={};var _0x153882={'count':0x0,'rows':[]};return db[_0xe3aa('0x4e')]['findOne']({'where':{'id':_0x52290d['params']['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x5c2123,null))[_0xe3aa('0x1e')](function(_0xa7dceb){if(_0xa7dceb){_0x5f2d13[_0xe3aa('0x46')]=_[_0xe3aa('0x53')](db['CannedAnswer']['rawAttributes']);_0x5f2d13['query']=_[_0xe3aa('0x53')](_0x52290d['query']);_0x5f2d13[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x5f2d13[_0xe3aa('0x46')],_0x5f2d13[_0xe3aa('0x52')]);_0x2b49be[_0xe3aa('0x56')]=_['intersection'](_0x5f2d13[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x52290d['query']['fields']));_0x2b49be[_0xe3aa('0x56')]=_0x2b49be['attributes'][_0xe3aa('0x58')]?_0x2b49be[_0xe3aa('0x56')]:_0x5f2d13[_0xe3aa('0x46')];if(!_0x52290d[_0xe3aa('0x52')][_0xe3aa('0x76')](_0xe3aa('0x59'))){_0x2b49be[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x52290d[_0xe3aa('0x52')]['limit']);_0x2b49be[_0xe3aa('0x5a')]=qs[_0xe3aa('0x5a')](_0x52290d[_0xe3aa('0x52')][_0xe3aa('0x5a')]);}_0x2b49be[_0xe3aa('0x77')]=qs[_0xe3aa('0x5b')](_0x52290d[_0xe3aa('0x52')][_0xe3aa('0x5b')]);_0x2b49be['where']=qs[_0xe3aa('0x54')](_[_0xe3aa('0x7e')](_0x52290d[_0xe3aa('0x52')],_0x5f2d13[_0xe3aa('0x54')]));_0x2b49be['where'][_0xe3aa('0x78')]=_0xa7dceb['id'];if(_0x52290d[_0xe3aa('0x52')][_0xe3aa('0x5c')]){_0x2b49be[_0xe3aa('0x5e')]=_[_0xe3aa('0x5d')](_0x2b49be[_0xe3aa('0x5e')],{'$or':_[_0xe3aa('0x4d')](_0x2b49be[_0xe3aa('0x56')],function(_0x2a1062){var _0x257b0e={};_0x257b0e[_0x2a1062]={'$like':'%'+_0x52290d['query']['filter']+'%'};return _0x257b0e;})});}_0x2b49be=_[_0xe3aa('0x5d')]({},_0x2b49be,_0x52290d[_0xe3aa('0x60')]);return db[_0xe3aa('0x7d')][_0xe3aa('0x2c')]({'where':_0x2b49be[_0xe3aa('0x5e')]})[_0xe3aa('0x1e')](function(_0xf0e76e){_0x153882[_0xe3aa('0x2c')]=_0xf0e76e;if(_0x52290d[_0xe3aa('0x52')][_0xe3aa('0x61')]){_0x2b49be['include']=[{'all':!![]}];}return db[_0xe3aa('0x7d')]['findAll'](_0x2b49be);})[_0xe3aa('0x1e')](function(_0x89ba6d){_0x153882[_0xe3aa('0x63')]=_0x89ba6d;return _0x153882;});}})[_0xe3aa('0x1e')](respondWithFilteredResult(_0x5c2123,_0x2b49be))[_0xe3aa('0x67')](handleError(_0x5c2123,null));};exports['removeAnswers']=function(_0x408c7a,_0x352294){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x408c7a[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x352294,null))[_0xe3aa('0x1e')](function(_0x2679ee){if(_0x2679ee){return _0x2679ee[_0xe3aa('0x7f')](_0x408c7a[_0xe3aa('0x52')][_0xe3aa('0x7b')]);}})[_0xe3aa('0x1e')](respondWithStatusCode(_0x352294,null))[_0xe3aa('0x67')](handleError(_0x352294,null));};exports[_0xe3aa('0x80')]=function(_0x1beb73,_0xc42725){_0x1beb73[_0xe3aa('0x69')][_0xe3aa('0x81')]=_0x1beb73[_0xe3aa('0x82')][_0xe3aa('0x83')];return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x1beb73[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0xc42725,null))[_0xe3aa('0x1e')](saveUpdates(_0x1beb73[_0xe3aa('0x69')],null))[_0xe3aa('0x1e')](respondWithResult(_0xc42725,null))['catch'](handleError(_0xc42725,null));};exports[_0xe3aa('0x84')]=function(_0xfde800,_0x306f47){_0xfde800['body'][_0xe3aa('0x85')]=_0xfde800[_0xe3aa('0x82')][_0xe3aa('0x83')];return db['ChatWebsite'][_0xe3aa('0x66')]({'where':{'id':_0xfde800[_0xe3aa('0x65')]['id']}})['then'](handleEntityNotFound(_0x306f47,null))['then'](saveUpdates(_0xfde800['body'],null))[_0xe3aa('0x1e')](respondWithResult(_0x306f47,null))[_0xe3aa('0x67')](handleError(_0x306f47,null));};exports[_0xe3aa('0x86')]=function(_0xeb01f8,_0x327c76){_0xeb01f8[_0xe3aa('0x69')][_0xe3aa('0x87')]=_0xeb01f8[_0xe3aa('0x82')][_0xe3aa('0x83')];return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0xeb01f8[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x327c76,null))[_0xe3aa('0x1e')](saveUpdates(_0xeb01f8[_0xe3aa('0x69')],null))[_0xe3aa('0x1e')](respondWithResult(_0x327c76,null))[_0xe3aa('0x67')](handleError(_0x327c76,null));};exports['addSystemAvatar']=function(_0x1abd02,_0x191621){_0x1abd02[_0xe3aa('0x69')][_0xe3aa('0x88')]=_0x1abd02['file'][_0xe3aa('0x83')];return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x1abd02[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x191621,null))[_0xe3aa('0x1e')](saveUpdates(_0x1abd02[_0xe3aa('0x69')],null))['then'](respondWithResult(_0x191621,null))[_0xe3aa('0x67')](handleError(_0x191621,null));};exports[_0xe3aa('0x89')]=function(_0x15ec4f,_0x53002d){var _0x20d54c=path['join'](config[_0xe3aa('0x8a')],_0xe3aa('0x8b'));var _0x3b4ab7={'where':{'id':_0x15ec4f[_0xe3aa('0x65')]['id']},'attributes':['id',_0xe3aa('0x81')],'raw':!![]};var _0x20db3f=![];return require('../../config/license/util')['getLicense']()[_0xe3aa('0x1e')](function(_0x299cff){if(_0x299cff){_0x20db3f=_0x299cff[_0xe3aa('0x8c')];}})[_0xe3aa('0x1e')](function(){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')](_0x3b4ab7);})['then'](handleEntityNotFound(_0x53002d,null))[_0xe3aa('0x1e')](function(_0x33795d){if(_0x33795d){if(!_[_0xe3aa('0x8d')](_0x33795d[_0xe3aa('0x81')])){if(fs[_0xe3aa('0x8e')](path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],'server/files/images/logos/',_0x33795d[_0xe3aa('0x81')]))&&_0x20db3f){_0x20d54c=path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0x90'),_0x33795d[_0xe3aa('0x81')]);}}return _0x53002d[_0xe3aa('0x91')](_0x20d54c);}})['catch'](handleError(_0x53002d,null));};exports[_0xe3aa('0x92')]=function(_0x1c0d66,_0x3bfa8a){var _0x12fd8b=path['join'](config['root'],_0xe3aa('0x93'));var _0x1221e2={'where':{'id':_0x1c0d66[_0xe3aa('0x65')]['id']},'attributes':['id',_0xe3aa('0x85')],'raw':!![]};return db[_0xe3aa('0x4e')][_0xe3aa('0x66')](_0x1221e2)['then'](handleEntityNotFound(_0x3bfa8a,null))[_0xe3aa('0x1e')](function(_0x40879a){if(_0x40879a){if(!_[_0xe3aa('0x8d')](_0x40879a[_0xe3aa('0x85')])){if(fs['existsSync'](path[_0xe3aa('0x8f')](config['root'],_0xe3aa('0x94'),_0x40879a[_0xe3aa('0x85')]))){_0x12fd8b=path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0x94'),_0x40879a['agentAvatar']);}}return _0x3bfa8a[_0xe3aa('0x91')](_0x12fd8b);}})[_0xe3aa('0x67')](handleError(_0x3bfa8a,null));};exports[_0xe3aa('0x95')]=function(_0x5132dc,_0xcb288d){var _0x240ca0=path['join'](config['root'],_0xe3aa('0x96'));var _0x187c9d={'where':{'id':_0x5132dc['params']['id']},'attributes':['id',_0xe3aa('0x87'),_0xe3aa('0x97')],'raw':!![]};return db[_0xe3aa('0x4e')][_0xe3aa('0x66')](_0x187c9d)['then'](handleEntityNotFound(_0xcb288d,null))[_0xe3aa('0x1e')](function(_0x290c62){if(_0x290c62){if(!_[_0xe3aa('0x8d')](_0x290c62['customerAvatar'])){if(fs[_0xe3aa('0x8e')](path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0x94'),_0x290c62[_0xe3aa('0x87')]))&&_0x290c62[_0xe3aa('0x97')]){_0x240ca0=path['join'](config[_0xe3aa('0x8a')],_0xe3aa('0x94'),_0x290c62[_0xe3aa('0x87')]);}}return _0xcb288d[_0xe3aa('0x91')](_0x240ca0);}})[_0xe3aa('0x67')](handleError(_0xcb288d,null));};exports['getSystemAvatar']=function(_0x2e66e6,_0x1879cf){var _0x207b04=path[_0xe3aa('0x8f')](config['root'],_0xe3aa('0x98'));var _0x3f8acb={'where':{'id':_0x2e66e6[_0xe3aa('0x65')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe3aa('0x4e')][_0xe3aa('0x66')](_0x3f8acb)[_0xe3aa('0x1e')](handleEntityNotFound(_0x1879cf,null))[_0xe3aa('0x1e')](function(_0x370fa8){if(_0x370fa8){if(!_[_0xe3aa('0x8d')](_0x370fa8[_0xe3aa('0x88')])){if(fs[_0xe3aa('0x8e')](path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0x94'),_0x370fa8[_0xe3aa('0x88')]))){_0x207b04=path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0x94'),_0x370fa8[_0xe3aa('0x88')]);}}return _0x1879cf['download'](_0x207b04);}})[_0xe3aa('0x67')](handleError(_0x1879cf,null));};function checkWebsiteInterval(_0x3734a3){var _0x9e4b13=_0x3734a3[_0xe3aa('0x99')];if(!_0x9e4b13){return Promise['resolve'](_0x3734a3);}var _0x219225=_0x3734a3[_0xe3aa('0x9a')]||undefined;return _0x9e4b13[_0xe3aa('0x9b')](_0x219225)[_0xe3aa('0x1e')](function(_0x5ed5b0){if(!_0x5ed5b0){throw new APIOutOfIntervalError();}return _0x3734a3;});}exports[_0xe3aa('0x9c')]=function(_0x4431f3,_0x38c1a9){var _0x154d01={'body':_0x4431f3[_0xe3aa('0x69')],'channel':'chat'};var _0x23175b=[];var _0x5c8ea4=[];var _0x329851={};var _0x12e7f9=![];if(_0x4431f3[_0xe3aa('0x69')]['id']){delete _0x4431f3[_0xe3aa('0x69')]['id'];}if(_[_0xe3aa('0x8d')](_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9d')])){throw new APIBadRequestError(_0xe3aa('0x9e'));}if(_[_0xe3aa('0x8d')](_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9f')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x4431f3['body'][_0xe3aa('0x69')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x12585b=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x3a')]&&_0x4431f3['body'][_0xe3aa('0x3e')];return db['CmContact']['describe']()[_0xe3aa('0x1e')](function(_0x1c47c9){if(!_0x1c47c9){throw new Error(_0xe3aa('0xa0'));}_0x23175b=Object[_0xe3aa('0x53')](_0x1c47c9)[_0xe3aa('0x5c')](function(_0x1dfe39){return![_0xe3aa('0xa1'),_0xe3aa('0xa2')][_0xe3aa('0xa3')](_0x1dfe39);});_0x5c8ea4=Object[_0xe3aa('0x53')](_0x1c47c9)[_0xe3aa('0x5c')](function(_0x258faa){return![_0xe3aa('0xa1'),'updatedAt',_0xe3aa('0xa4'),_0xe3aa('0xa5')][_0xe3aa('0xa3')](_0x258faa);});if(!_['includes'](_0x5c8ea4,_0x4431f3['body'][_0xe3aa('0x9f')])){throw new APIBadRequestError(_0xe3aa('0xa6')+_0x5c8ea4[_0xe3aa('0x8f')](',\x20'));}_0x329851[_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9f')]]=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9d')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4431f3['params']['id']},'include':[{'model':db[_0xe3aa('0xa7')],'as':_0xe3aa('0xa8'),'include':[{'model':db[_0xe3aa('0xa9')],'as':_0xe3aa('0xaa'),'where':_0x329851,'limit':0x1,'order':[[_0xe3aa('0xa2'),_0xe3aa('0xab')]]}]},{'model':db['ChatApplication'],'as':_0xe3aa('0xac')},{'model':db[_0xe3aa('0x99')],'as':_0xe3aa('0x99'),'include':[{'model':db['Interval'],'as':_0xe3aa('0xad'),'attributes':['id',_0xe3aa('0xae')],'raw':!![]}]}]});})[_0xe3aa('0x1e')](function(_0x50925b){if(!_0x50925b){throw new APINotFoundError(util[_0xe3aa('0x40')](_0xe3aa('0xaf'),_0x4431f3[_0xe3aa('0x65')]['id']));}if(_0x12585b){return checkWebsiteInterval(_0x50925b);}return _0x50925b;})[_0xe3aa('0x1e')](function(_0x3c654a){_0x154d01[_0xe3aa('0xb0')]=_0x3c654a;_0x154d01[_0xe3aa('0xb1')]=_['orderBy'](_0x3c654a[_0xe3aa('0xac')],['priority'],[_0xe3aa('0xb2')]);if(_0x154d01['account'][_0xe3aa('0xac')]){delete _0x154d01[_0xe3aa('0xb0')]['Applications'];}_0x154d01['list']=_0x3c654a[_0xe3aa('0xa8')]||{'id':_0x3c654a[_0xe3aa('0xa5')]};if(_0x154d01[_0xe3aa('0xb3')]&&_0x154d01[_0xe3aa('0xb3')][_0xe3aa('0xaa')][_0xe3aa('0x58')]){return _0x154d01[_0xe3aa('0xb3')]['Contacts'][0x0];}var _0x20f83a=_[_0xe3aa('0x16')](_0x4431f3[_0xe3aa('0x69')],{'firstName':_0x4431f3['body'][_0xe3aa('0x9d')],'ListId':_0x3c654a['ListId']});_0x20f83a[_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9f')]]=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x9d')];return db[_0xe3aa('0xa9')][_0xe3aa('0x68')](_0x20f83a,{'fields':_0x23175b,'raw':!![]});})['then'](function(_0x1f06db){_0x154d01['contact']=_0x1f06db;var _0x1a1c03=createInteractionObject(_0x4431f3[_0xe3aa('0x65')]['id'],_0x4431f3[_0xe3aa('0x69')],_0x4431f3[_0xe3aa('0xb4')],_0x1f06db);var _0x345b2a={'ChatWebsiteId':_0x4431f3['params']['id']};if(_0x4431f3[_0xe3aa('0x69')]['threadId']){_0x345b2a[_0xe3aa('0xb5')]=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xb5')];_0x345b2a[_0xe3aa('0xb6')]=![];return db['ChatInteraction'][_0xe3aa('0x66')]({'where':_0x345b2a})['then'](function(_0x6bddd4){var _0x11699a=_0x4431f3['body'][_0xe3aa('0x3a')]&&_0x4431f3[_0xe3aa('0x69')]['referer'];if(_0x6bddd4){_0x12e7f9=!![];return _0x6bddd4;}else if(!_0x11699a&&_0x6bddd4&&_0x6bddd4[_0xe3aa('0xb6')]){throw new APIConflictError(_0xe3aa('0xb7'));}_0x1a1c03['threadId']=_0x4431f3['body'][_0xe3aa('0xb5')];_0x1a1c03['externalUrl']=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xb8')];return db[_0xe3aa('0xb9')][_0xe3aa('0x68')](_0x1a1c03);});}_0x345b2a[_0xe3aa('0xba')]=_0x1f06db['id'];if(_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xbb')]&&_0x4431f3['body'][_0xe3aa('0xbb')]['id']){_0x345b2a['id']=_0x4431f3['body'][_0xe3aa('0xbb')]['id'];return db[_0xe3aa('0xb9')][_0xe3aa('0x66')]({'where':_0x345b2a})[_0xe3aa('0x1e')](function(_0x2b418b){var _0x245045=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x3a')]&&_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x3e')];if(!_0x245045&&_0x2b418b&&_0x2b418b[_0xe3aa('0xb6')]){throw new APIConflictError(_0xe3aa('0xb7'));}else if(_0x2b418b){_0x12e7f9=!![];return _0x2b418b;}else{return db[_0xe3aa('0xb9')][_0xe3aa('0x68')](_0x1a1c03);}});}return db[_0xe3aa('0xb9')][_0xe3aa('0x68')](_0x1a1c03);})[_0xe3aa('0x1e')](function(_0x4b2434){if(!_0x12e7f9){return _0x4b2434;}var _0x5829ab={'from':(_0x154d01['contact'][_0xe3aa('0x3c')]||'')+'\x20'+(_0x154d01[_0xe3aa('0xbc')][_0xe3aa('0xbd')]||'')};if(_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xb5')]&&_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xbe')]&&_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xb5')]!=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xbe')]){_0x5829ab[_0xe3aa('0xb5')]=_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xbe')];}return _0x4b2434['update'](_0x5829ab);})[_0xe3aa('0x1e')](function(_0x358992){_0x154d01[_0xe3aa('0xbb')]=_0x358992[_0xe3aa('0x32')]({'plain':!![]});_0x154d01['interaction'][_0xe3aa('0xbf')]=!_0x12e7f9;if(_0x154d01[_0xe3aa('0xbb')][_0xe3aa('0xbf')]){if(_0x154d01[_0xe3aa('0xb0')][_0xe3aa('0xc0')]){_0x154d01[_0xe3aa('0xb1')][_0xe3aa('0xc1')]({'id':0x0,'priority':_0x154d01[_0xe3aa('0xb1')][_0xe3aa('0x58')]+0x1,'app':_0xe3aa('0xc2'),'appdata':_0xe3aa('0xc3'),'interval':'*,*,*,*'});}}return db[_0xe3aa('0xc4')]['create']({'body':_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0x69')],'ChatWebsiteId':_0x4431f3[_0xe3aa('0x65')]['id'],'ChatInteractionId':_0x358992['id'],'direction':'in','ContactId':_0x154d01[_0xe3aa('0xbc')]['id'],'AttachmentId':_0x4431f3[_0xe3aa('0x69')][_0xe3aa('0xc5')]});})[_0xe3aa('0x1e')](function(_0x862ac3){_0x154d01[_0xe3aa('0x25')]=_0x862ac3;if(!_0x154d01['interaction'][_0xe3aa('0xc6')]){return;}return db[_0xe3aa('0xc7')][_0xe3aa('0x66')]({'attributes':['id','name'],'where':{'id':_0x154d01[_0xe3aa('0xbb')][_0xe3aa('0xc6')]}});})[_0xe3aa('0x1e')](function(_0x5cf8f7){if(_0x5cf8f7){_0x154d01[_0xe3aa('0xb1')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5cf8f7[_0xe3aa('0x3f')]+','+(_0x154d01[_0xe3aa('0xb0')][_0xe3aa('0xc8')]||0xa),'interval':_0xe3aa('0xc9')});_0x154d01[_0xe3aa('0xca')]=!![];}if(!_0x154d01['interaction']['queueId']){return;}return db[_0xe3aa('0xcb')]['find']({'attributes':['id','name'],'where':{'id':_0x154d01['interaction'][_0xe3aa('0xcc')]}});})[_0xe3aa('0x1e')](function(_0x82f0d7){if(_0x82f0d7){_0x154d01['applications'][_0xe3aa('0xcd')]({'id':0x0,'priority':0x1,'app':_0xe3aa('0xce'),'appdata':_0x82f0d7[_0xe3aa('0x3f')]+','+(_0x154d01[_0xe3aa('0xb0')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe3aa('0xcf'),_0xe3aa('0xd0'),_0x154d01);})['then'](function(_0x209024){respondWithRpcPromise('EventManager',_0xe3aa('0xd1'),{'event':_0xe3aa('0x9c'),'message':_0x209024},client9002);return _0x209024;})['then'](respondWithResult(_0x38c1a9,null))['catch'](APIHandleError(_0x38c1a9));};exports['offline']=function(_0x307870,_0x502696){var _0x33553d,_0x979de1,_0x2b2747;var _0x2b6bfa=[];var _0x5394b6={};var _0x30a862=_0x307870[_0xe3aa('0xd2')]||[];var _0xab41f9=[];var _0x15020e;return db[_0xe3aa('0xa9')][_0xe3aa('0x72')]()[_0xe3aa('0x1e')](function(_0x52f5fc){if(!_0x52f5fc){throw new db[(_0xe3aa('0xd3'))]['ValidationError']('no\x20available\x20attributes');}_0x2b6bfa=_[_0xe3aa('0xd4')](_[_0xe3aa('0x53')](_0x52f5fc),[_0xe3aa('0xa1'),'updatedAt',_0xe3aa('0xa4'),_0xe3aa('0xa5')]);if(_0x307870[_0xe3aa('0x69')]['id']){delete _0x307870[_0xe3aa('0x69')]['id'];}if(_[_0xe3aa('0x8d')](_0x307870[_0xe3aa('0x69')][_0xe3aa('0x9d')])){throw _0x502696[_0xe3aa('0x28')](0x1f4)[_0xe3aa('0x36')](new db[(_0xe3aa('0xd3'))][(_0xe3aa('0xd5'))](_0xe3aa('0xd6')));}if(_[_0xe3aa('0x8d')](_0x307870[_0xe3aa('0x69')][_0xe3aa('0x69')])||_0x307870['body'][_0xe3aa('0x69')]===''){throw _0x502696[_0xe3aa('0x28')](0x1f4)[_0xe3aa('0x36')](new db['Sequelize'][(_0xe3aa('0xd5'))](_0xe3aa('0xd7')));}if(_[_0xe3aa('0x8d')](_0x307870[_0xe3aa('0x69')][_0xe3aa('0xd8')])){throw _0x502696[_0xe3aa('0x28')](0x1f4)[_0xe3aa('0x36')](new db[(_0xe3aa('0xd3'))]['ValidationError'](_0xe3aa('0xd9')+_0x2b6bfa));}if(!_['includes'](_0x2b6bfa,_0x307870[_0xe3aa('0x69')][_0xe3aa('0xd8')])){throw _0x502696['status'](0x1f4)[_0xe3aa('0x36')](new db[(_0xe3aa('0xd3'))][(_0xe3aa('0xd5'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b6bfa));}_0x5394b6[_0x307870[_0xe3aa('0x69')]['mapKeyOffline']]=_0x307870[_0xe3aa('0x69')]['from'];})[_0xe3aa('0x1e')](function(){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x307870[_0xe3aa('0x65')]['id']},'include':[{'model':db[_0xe3aa('0xa7')],'as':_0xe3aa('0xa8')},{'model':db[_0xe3aa('0xda')],'as':_0xe3aa('0xda')}]});})[_0xe3aa('0x1e')](handleEntityNotFound(_0x502696,null))[_0xe3aa('0x1e')](function(_0x41ef2a){if(_0x41ef2a&&_0x41ef2a[_0xe3aa('0xa8')]){_0x979de1=_0x41ef2a;var _0x1a1a52=_['defaults'](_0x307870[_0xe3aa('0x69')],{'firstName':_0x307870[_0xe3aa('0x69')][_0xe3aa('0x9d')],'phone':_0x307870[_0xe3aa('0x69')]['from'],'ListId':_0x41ef2a[_0xe3aa('0xa5')]});_0x1a1a52[_0x307870[_0xe3aa('0x69')][_0xe3aa('0xd8')]]=_0x307870[_0xe3aa('0x69')]['from'];return db[_0xe3aa('0xa9')][_0xe3aa('0xdb')]({'where':_0x5394b6,'defaults':_0x1a1a52});}})['spread'](function(_0x8a7b25){if(_0x8a7b25){_0x2b2747=_0x8a7b25;var _0x4c2618=fs[_0xe3aa('0xdc')](path['join'](config[_0xe3aa('0x8a')],_0xe3aa('0xdd')),_0xe3aa('0xde'));var _0x302fa6=ejs['render'](_0x4c2618,{'body':_[_0xe3aa('0xdf')](_0x307870[_0xe3aa('0x69')]['body']),'bodyTitle':_0x979de1['offlineMessageBody']});return db[_0xe3aa('0xe0')]['create']({'body':_0x302fa6,'plainBody':htmlToText['fromString'](_0x302fa6),'ContactId':_0x8a7b25['id'],'ChatWebsiteId':_0x979de1['id']});}})['then'](function(_0x49b060){_0x15020e=_0x49b060;if(_0x30a862[_0xe3aa('0x58')]){var _0x4e349b=_0x30a862[_0xe3aa('0x4d')](function(_0x65691d){return{'name':_0x65691d[_0xe3aa('0xe1')],'basename':_0x65691d['filename'],'type':_0x65691d[_0xe3aa('0xe2')],'ChatOfflineMessageId':_0x49b060['id']};});_0xab41f9=_0x4e349b[_0xe3aa('0x4d')](_0x3f7c89=>{var _0x47e248={'filename':_0x3f7c89[_0xe3aa('0x3f')],'path':path['join'](config[_0xe3aa('0x8a')],'server',_0xe3aa('0xd2'),'attachments','offline-chat',_0x3f7c89['basename'])};return _0x47e248;});if(!_0x979de1[_0xe3aa('0xe3')]){return db[_0xe3aa('0xe4')][_0xe3aa('0xe5')](function(_0x4532f2){return db[_0xe3aa('0xe6')]['bulkCreate'](_0x4e349b,{'transaction':_0x4532f2});});}}})['then'](function(){if(_0x15020e){_0x33553d=_0x15020e;return db['MailAccount'][_0xe3aa('0xe7')]({'where':{'service':!![]},'include':[{'model':db[_0xe3aa('0xe8')],'as':_0xe3aa('0xe9'),'raw':!![],'include':[{'model':db[_0xe3aa('0xea')],'as':_0xe3aa('0xea'),'raw':!![]}]}]});}})[_0xe3aa('0x1e')](function(_0x41d0fb){if(_0x41d0fb&&_0x41d0fb['Smtp']&&_0x979de1[_0xe3aa('0xeb')]&&_0x979de1['forwardOfflineAddress']){var _0x10eb6e=_0x41d0fb[_0xe3aa('0xec')]();return respondWithRpcPromise(_0xe3aa('0xed'),_0xe3aa('0xee'),{'account':_0x10eb6e,'message':{'from':util[_0xe3aa('0x40')](_0xe3aa('0xef'),_0x41d0fb[_0xe3aa('0x3f')],_0x41d0fb[_0xe3aa('0xf0')]||_0x41d0fb[_0xe3aa('0xe9')]['user']),'to':_0x979de1['forwardOfflineAddress'],'subject':_0x979de1[_0xe3aa('0xf1')],'html':_0x33553d[_0xe3aa('0x69')],'attachments':_0xab41f9}},client9003)['then'](function(){return _0x33553d;})[_0xe3aa('0x67')](function(_0x2a03c0){logger['error'](_0x2a03c0);});}})[_0xe3aa('0x1e')](function(){if(_0x979de1&&_0x979de1[_0xe3aa('0xe3')]&&_0x979de1[_0xe3aa('0xf2')]){var _0x357408=[];if(_0x30a862[_0xe3aa('0x58')]){_0x357408=_0x30a862[_0xe3aa('0x4d')](function(_0x3d37e2){return{'name':_0x3d37e2[_0xe3aa('0xe1')],'basename':_0x3d37e2['filename'],'type':_0x3d37e2['mimetype'],'ChatOfflineMessageId':_0x15020e['id']};});}var _0x2249c1;if(!_[_0xe3aa('0x8d')](_0x979de1[_0xe3aa('0xf3')])){var _0x4248d3=_[_0xe3aa('0x4d')](_0x307870[_0xe3aa('0x69')],function(_0x3e8c80){return _0x3e8c80;});var _0x4e5c9c=_[_0xe3aa('0xf4')](_0x4248d3)[0x0];var _0x37843d=_[_0xe3aa('0xf5')](_0x4e5c9c,function(_0x2a5cdd){return _0x2a5cdd;});_0x2249c1=_0x37843d[0x1][_0x979de1[_0xe3aa('0xf3')]];}var _0x417ce6={'from':_0x2b2747[_0xe3aa('0xf0')],'firstName':_0x2b2747[_0xe3aa('0x3c')],'lastName':_0x2b2747[_0xe3aa('0xbd')],'mapKey':_0xe3aa('0xf0'),'message':{'from':_0x2b2747[_0xe3aa('0xf0')],'to':_0x979de1[_0xe3aa('0xda')]['email'],'cc':'','subject':_[_0xe3aa('0x8d')](_0x2249c1)?_0x979de1[_0xe3aa('0xf1')]:_0x2249c1,'messageId':'','sentAt':new Date(),'attach':_0x357408[_0xe3aa('0x58')],'attachments':_0x357408,'originChannel':_0xe3aa('0xf6'),'ChatWebsiteId':_0x979de1['id'],'ChatOfflineMessageId':_0x33553d['id'],'originTo':_0x979de1[_0xe3aa('0xda')][_0xe3aa('0xf0')]},'body':_0x33553d['body']};var _0x45086f={'account':{'id':_0x979de1['MailAccountId']},'body':_0x417ce6,'log':_0xe3aa('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0xe3aa('0xf8'),_0x45086f,client9001)['then'](function(){return _0x33553d;})[_0xe3aa('0x67')](function(_0x5c65ff){logger['error'](_0x5c65ff);});}return;})[_0xe3aa('0x1e')](function(){if(_0x33553d){return _0x33553d;}})['then'](respondWithResult(_0x502696,null))[_0xe3aa('0x67')](function(){for(var _0x5a3c3c of _0x30a862){var _0x52fa87=path[_0xe3aa('0x8f')](config[_0xe3aa('0x8a')],_0xe3aa('0xf9'),_0xe3aa('0xd2'),_0xe3aa('0xfa'),'offline-chat',_0x5a3c3c['filename']);fs_extra[_0xe3aa('0xfb')](_0x52fa87)[_0xe3aa('0x67')](function(_0x26438d){logger[_0xe3aa('0x23')](_0xe3aa('0xfc'),_0x52fa87,_0x26438d);});}});};exports[_0xe3aa('0xfd')]=function(_0x3a15e5,_0x3f1e08){return db['ChatInteraction'][_0xe3aa('0x66')]({'where':{'id':_0x3a15e5[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x3f1e08,null))[_0xe3aa('0x1e')](function(_0x39f7e3){if(_0x39f7e3){return _0x39f7e3['addInteraction'](_0x3a15e5[_0xe3aa('0x69')][_0xe3aa('0x7b')],_[_0xe3aa('0xfe')](_0x3a15e5['body'],[_0xe3aa('0x7b'),'id'])||{});}})[_0xe3aa('0x1e')](respondWithResult(_0x3f1e08,null))['catch'](handleError(_0x3f1e08,null));};exports[_0xe3aa('0xff')]=function(_0x2d6ff1,_0x481ef4){var _0x48bb72={'raw':![],'where':{}};var _0x1e2754={};var _0x4739f2={'count':0x0,'rows':[]};return db[_0xe3aa('0x4e')][_0xe3aa('0xe7')]({'where':{'id':_0x2d6ff1[_0xe3aa('0x65')]['id']}})['then'](handleEntityNotFound(_0x481ef4,null))['then'](function(_0x406212){if(_0x406212){_0x1e2754[_0xe3aa('0x46')]=_[_0xe3aa('0x53')](db['ChatInteraction'][_0xe3aa('0x4f')]);_0x1e2754[_0xe3aa('0x52')]=_['keys'](_0x2d6ff1[_0xe3aa('0x52')]);_0x1e2754[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x1e2754[_0xe3aa('0x46')],_0x1e2754[_0xe3aa('0x52')]);_0x48bb72[_0xe3aa('0x56')]=_[_0xe3aa('0x55')](_0x1e2754[_0xe3aa('0x46')],qs['fields'](_0x2d6ff1[_0xe3aa('0x52')]['fields']));_0x48bb72['attributes']=_0x48bb72[_0xe3aa('0x56')][_0xe3aa('0x58')]?_0x48bb72[_0xe3aa('0x56')]:_0x1e2754[_0xe3aa('0x46')];if(!_0x2d6ff1[_0xe3aa('0x52')][_0xe3aa('0x76')](_0xe3aa('0x59'))){_0x48bb72[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x2d6ff1[_0xe3aa('0x52')]['limit']);_0x48bb72[_0xe3aa('0x5a')]=qs[_0xe3aa('0x5a')](_0x2d6ff1['query'][_0xe3aa('0x5a')]);}_0x48bb72['order']=qs[_0xe3aa('0x5b')](_0x2d6ff1[_0xe3aa('0x52')][_0xe3aa('0x5b')]);_0x48bb72[_0xe3aa('0x5e')]=qs[_0xe3aa('0x54')](_[_0xe3aa('0x7e')](_0x2d6ff1[_0xe3aa('0x52')],_0x1e2754[_0xe3aa('0x54')]));_0x48bb72['where'][_0xe3aa('0x78')]=_0x406212['id'];if(_0x2d6ff1[_0xe3aa('0x52')][_0xe3aa('0x5c')]){_0x48bb72[_0xe3aa('0x5e')]=_['merge'](_0x48bb72['where'],{'$or':_[_0xe3aa('0x4d')](_0x48bb72[_0xe3aa('0x56')],function(_0x17f47b){var _0x42a5de={};_0x42a5de[_0x17f47b]={'$like':'%'+_0x2d6ff1[_0xe3aa('0x52')]['filter']+'%'};return _0x42a5de;})});}_0x48bb72=_['merge']({},_0x48bb72,_0x2d6ff1['options']);return db[_0xe3aa('0xb9')][_0xe3aa('0x2c')]({'where':_0x48bb72[_0xe3aa('0x5e')]})['then'](function(_0x468e62){_0x4739f2[_0xe3aa('0x2c')]=_0x468e62;if(_0x2d6ff1['query'][_0xe3aa('0x61')]){_0x48bb72[_0xe3aa('0x62')]=[{'model':db[_0xe3aa('0xa9')],'as':_0xe3aa('0x100'),'required':![]},{'model':db[_0xe3aa('0xc7')],'as':'Owner','attributes':['name',_0xe3aa('0x101'),_0xe3aa('0x102')],'required':![]},{'model':db[_0xe3aa('0x103')],'as':'Tags','attributes':['id',_0xe3aa('0x3f'),_0xe3aa('0x104')],'where':_0x2d6ff1[_0xe3aa('0x52')][_0xe3aa('0x105')]?{'id':_0x2d6ff1[_0xe3aa('0x52')]['tag']}:undefined,'required':_0x2d6ff1['query']['tag']?!![]:![]}];}return db[_0xe3aa('0xb9')][_0xe3aa('0x79')](_0x48bb72);})[_0xe3aa('0x1e')](function(_0x1f7006){_0x4739f2[_0xe3aa('0x63')]=_0x1f7006;return _0x4739f2;});}})[_0xe3aa('0x1e')](respondWithFilteredResult(_0x481ef4,_0x48bb72))[_0xe3aa('0x67')](handleError(_0x481ef4,null));};exports[_0xe3aa('0x106')]=function(_0x293727,_0x5a9041){var _0x3d9475=0x0;var _0x134cc3=0x0;var _0x1db2f9=![];var _0x555616;var _0x43ca71;return db['ChatWebsite']['find']({'where':{'id':_0x293727[_0xe3aa('0x65')]['id']},'include':[{'model':db[_0xe3aa('0x99')],'as':_0xe3aa('0x99'),'include':[{'model':db[_0xe3aa('0x99')],'as':'Intervals','attributes':['id',_0xe3aa('0xae')]}]}]})[_0xe3aa('0x1e')](handleEntityNotFound(_0x5a9041,null))[_0xe3aa('0x1e')](function(_0x4eea4c){if(_0x4eea4c){_0x555616=_0x4eea4c;return _0x4eea4c[_0xe3aa('0x107')]({'raw':!![]});}})['then'](function(_0x2588b4){if(_0x555616){if(_0x2588b4){_0x43ca71=_0x2588b4;}}return require('../../config/license/util')[_0xe3aa('0x108')]();})[_0xe3aa('0x1e')](function(_0x521b61){if(_0x521b61){_0x134cc3=_0x521b61[_0xe3aa('0x109')];_0x1db2f9=_0x521b61[_0xe3aa('0x8c')];}})[_0xe3aa('0x1e')](function(){return db[_0xe3aa('0xb9')][_0xe3aa('0x2c')]({'where':{'closed':![]}});})['then'](function(_0x351e70){_0x3d9475=_0x351e70;if(_0x134cc3&&_0x351e70>_0x134cc3){return db[_0xe3aa('0x10a')][_0xe3aa('0xe7')]({'where':{'id':0x1}})['then'](function(_0x123f3b){if(_0x123f3b){_0x123f3b[_0xe3aa('0x10b')](_0xe3aa('0x10c'));}});}})[_0xe3aa('0x1e')](function(){var _0x44e176=_0x555616[_0xe3aa('0x99')];var _0x18ac97=_0x555616[_0xe3aa('0x9a')]||undefined;return _0x44e176?_0x44e176[_0xe3aa('0x9b')](_0x18ac97):!![];})[_0xe3aa('0x1e')](function(_0x41c6d3){var _0x2e75b1=fs[_0xe3aa('0xdc')](path['join'](config[_0xe3aa('0x8a')],_0xe3aa('0x10d')),_0xe3aa('0xde'));var _0x56e859=_0xe3aa('0x10e');var _0x28b7b1=![];try{const _0x274aa6=new URL(_0x555616[_0xe3aa('0x6a')]);_0x555616[_0xe3aa('0x6a')]=_0x274aa6[_0xe3aa('0x10f')];}catch(_0x216f15){}var _0x37b642;if(_0x293727['headers']['referer']){_0x293727[_0xe3aa('0xb4')][_0xe3aa('0x3e')]=_0x293727[_0xe3aa('0xb4')][_0xe3aa('0x3e')][_0xe3aa('0x110')](/\/$/,'');_0x37b642=wildcardUtils[_0xe3aa('0x111')](_0x555616[_0xe3aa('0x6a')],_0x293727['headers'][_0xe3aa('0x3e')]);}else{_0x293727[_0xe3aa('0xb4')][_0xe3aa('0x3e')]=_0x555616[_0xe3aa('0x6a')];_0x37b642=!![];}var _0x5003dc={'chatVersion':_0x56e859,'chatWebsiteAddressOrigin':_0x37b642?_0x293727[_0xe3aa('0xb4')][_0xe3aa('0x3e')]:_0x555616[_0xe3aa('0x6a')],'remote':_0x555616[_0xe3aa('0x112')],'query':querystring[_0xe3aa('0x22')](_['merge'](_0x555616[_0xe3aa('0x32')]({'plain':!![]}),{'customerIp':_0x293727['headers'][_0xe3aa('0x113')]||_0x293727[_0xe3aa('0xb4')][_0xe3aa('0x114')]||_0x293727['connection'][_0xe3aa('0x115')]||_0x293727['ip'],'referer':_0x293727[_0xe3aa('0xb4')]['referer'],'openedInteractions':_0x3d9475,'maxInteractions':_0x134cc3,'virtual':_0x1db2f9[_0xe3aa('0x109')],'online':_0x41c6d3,'custom':_0x1db2f9,'address':_0x37b642?_0x293727['headers']['referer']:null}))[_0xe3aa('0x110')](/'/g,'\x5c\x27')};_0x5a9041[_0xe3aa('0x36')](ejs[_0xe3aa('0x116')](Mustache[_0xe3aa('0x116')](_0x2e75b1,_0x5003dc),{'proactiveActions':_0x43ca71,'alignment':_0x555616[_0xe3aa('0x117')],'verticalAlignment':_0x555616[_0xe3aa('0x118')],'div_color':_0x555616[_0xe3aa('0x104')],'labelText':_0x555616['labelText'],'text_color':_0x555616[_0xe3aa('0x119')],'text_button_color':_0x555616[_0xe3aa('0x11a')],'button_color':_0x555616[_0xe3aa('0x11b')],'background_color':_0x555616[_0xe3aa('0x11c')],'hideWhenOffline':_0x555616['hideWhenOffline'],'intervalId':_0x555616['IntervalId'],'isDevelopment':_0x28b7b1,'chatVersion':_0x56e859}));})[_0xe3aa('0x67')](handleError(_0x5a9041,null));};exports[_0xe3aa('0x11d')]=function(_0x4fe879,_0x534f03){var _0x2506fb=_0x4fe879[_0xe3aa('0x65')]['id'];var _0x6c4770=_0x4fe879[_0xe3aa('0x69')];var _0x2a025d=0xc8;var _0x1ccd19=null;return db[_0xe3aa('0xe4')][_0xe3aa('0xe5')]({'isolationLevel':db[_0xe3aa('0xe4')][_0xe3aa('0x11e')][_0xe3aa('0x11f')][_0xe3aa('0x120')]},function(_0xd23b74){return db['ChatWebsite'][_0xe3aa('0xe7')]({'where':{'id':_0x2506fb},'transaction':_0xd23b74})[_0xe3aa('0x1e')](function(_0x5258e4){if(_0x5258e4){return db[_0xe3aa('0x121')]['destroy']({'where':{'ChatWebsiteId':_0x2506fb},'transaction':_0xd23b74})['then'](function(){var _0x25e39d=_['map'](_0x6c4770,function(_0x5b6b3a){_0x5b6b3a[_0xe3aa('0x78')]=_0x2506fb;return _0x5b6b3a;});return db[_0xe3aa('0x121')][_0xe3aa('0x122')](_0x25e39d,{'transaction':_0xd23b74});});}else{_0x2a025d=0x194;_0x1ccd19=[];}});})[_0xe3aa('0x1e')](function(){if(_0x2a025d!==0x194){return db['ChatApplication'][_0xe3aa('0x123')]({'where':{'ChatWebsiteId':_0x2506fb},'order':_0xe3aa('0x124')})[_0xe3aa('0x1e')](function(_0x105a14){_0x1ccd19=_0x105a14;});}})[_0xe3aa('0x67')](function(_0x248c26){_0x2a025d=0x1f4;logger[_0xe3aa('0x23')](_0x248c26[_0xe3aa('0x35')]);if(_0x248c26[_0xe3aa('0x3f')]){delete _0x248c26['name'];}_0x1ccd19=_0x248c26;})[_0xe3aa('0x125')](function(){if(_0x1ccd19===null){_0x534f03[_0xe3aa('0x34')](_0x2a025d);}else{if(_0x2a025d===0x1f4){_0x534f03[_0xe3aa('0x28')](_0x2a025d)['send'](_0x1ccd19);}else{_0x534f03[_0xe3aa('0x28')](_0x2a025d)[_0xe3aa('0x2a')](_0x1ccd19);}}});};exports[_0xe3aa('0x126')]=function(_0x4bb69c,_0x3a7c65){var _0x5f0bbe={};var _0x4dd045={};var _0x56e470;var _0x34b73a;return db[_0xe3aa('0x4e')][_0xe3aa('0xe7')]({'where':{'id':_0x4bb69c[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x3a7c65,null))[_0xe3aa('0x1e')](function(_0x2c3f36){if(_0x2c3f36){_0x56e470=_0x2c3f36;_0x4dd045[_0xe3aa('0x46')]=_['keys'](db[_0xe3aa('0x121')][_0xe3aa('0x4f')]);_0x4dd045[_0xe3aa('0x52')]=_[_0xe3aa('0x53')](_0x4bb69c[_0xe3aa('0x52')]);_0x4dd045[_0xe3aa('0x54')]=_['intersection'](_0x4dd045['model'],_0x4dd045[_0xe3aa('0x52')]);_0x5f0bbe['attributes']=_[_0xe3aa('0x55')](_0x4dd045[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x4bb69c[_0xe3aa('0x52')][_0xe3aa('0x57')]));_0x5f0bbe[_0xe3aa('0x56')]=_0x5f0bbe['attributes'][_0xe3aa('0x58')]?_0x5f0bbe[_0xe3aa('0x56')]:_0x4dd045['model'];_0x5f0bbe[_0xe3aa('0x77')]=qs['sort'](_0x4bb69c[_0xe3aa('0x52')]['sort']);_0x5f0bbe['where']=qs[_0xe3aa('0x54')](_['pick'](_0x4bb69c[_0xe3aa('0x52')],_0x4dd045[_0xe3aa('0x54')]));if(_0x4bb69c['query'][_0xe3aa('0x5c')]){_0x5f0bbe[_0xe3aa('0x5e')]=_[_0xe3aa('0x5d')](_0x5f0bbe[_0xe3aa('0x5e')],{'$or':_['map'](_0x5f0bbe[_0xe3aa('0x56')],function(_0x353527){var _0x2293e2={};_0x2293e2[_0x353527]={'$like':'%'+_0x4bb69c['query'][_0xe3aa('0x5c')]+'%'};return _0x2293e2;})});}_0x5f0bbe=_[_0xe3aa('0x5d')]({},_0x5f0bbe,_0x4bb69c[_0xe3aa('0x60')]);return _0x56e470[_0xe3aa('0x126')](_0x5f0bbe);}})['then'](function(_0x4a5c60){if(_0x4a5c60){_0x34b73a=_0x4a5c60[_0xe3aa('0x58')];if(!_0x4bb69c[_0xe3aa('0x52')][_0xe3aa('0x76')](_0xe3aa('0x59'))){_0x5f0bbe[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x4bb69c[_0xe3aa('0x52')][_0xe3aa('0x2d')]);_0x5f0bbe[_0xe3aa('0x5a')]=qs['offset'](_0x4bb69c[_0xe3aa('0x52')]['offset']);}return _0x56e470[_0xe3aa('0x126')](_0x5f0bbe);}})['then'](function(_0x484593){if(_0x484593){return _0x484593?{'count':_0x34b73a,'rows':_0x484593}:null;}})[_0xe3aa('0x1e')](respondWithResult(_0x3a7c65,null))[_0xe3aa('0x67')](handleError(_0x3a7c65,null));};exports['addProactiveActions']=function(_0x37cb6d,_0x32085a){return db[_0xe3aa('0x127')][_0xe3aa('0x66')]({'where':{'id':_0x37cb6d[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x32085a,null))['then'](function(_0x275abd){if(_0x275abd){return _0x275abd[_0xe3aa('0x128')](_0x37cb6d[_0xe3aa('0x69')]['ids'],_[_0xe3aa('0xfe')](_0x37cb6d[_0xe3aa('0x69')],['ids','id'])||{});}})[_0xe3aa('0x1e')](respondWithResult(_0x32085a,null))[_0xe3aa('0x67')](handleError(_0x32085a,null));};exports[_0xe3aa('0x107')]=function(_0x1160dc,_0x101108){var _0x5bc5af={};var _0x36443b={};var _0x5eb62e;var _0x5112e8;return db['ChatWebsite'][_0xe3aa('0xe7')]({'where':{'id':_0x1160dc[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x101108,null))['then'](function(_0x2e7f77){if(_0x2e7f77){_0x5eb62e=_0x2e7f77;_0x36443b[_0xe3aa('0x46')]=_[_0xe3aa('0x53')](db[_0xe3aa('0x129')]['rawAttributes']);_0x36443b[_0xe3aa('0x52')]=_[_0xe3aa('0x53')](_0x1160dc[_0xe3aa('0x52')]);_0x36443b[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x36443b['model'],_0x36443b[_0xe3aa('0x52')]);_0x5bc5af[_0xe3aa('0x56')]=_[_0xe3aa('0x55')](_0x36443b[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x1160dc['query']['fields']));_0x5bc5af[_0xe3aa('0x56')]=_0x5bc5af[_0xe3aa('0x56')][_0xe3aa('0x58')]?_0x5bc5af[_0xe3aa('0x56')]:_0x36443b[_0xe3aa('0x46')];_0x5bc5af[_0xe3aa('0x77')]=qs[_0xe3aa('0x5b')](_0x1160dc[_0xe3aa('0x52')][_0xe3aa('0x5b')]);_0x5bc5af['where']=qs[_0xe3aa('0x54')](_[_0xe3aa('0x7e')](_0x1160dc[_0xe3aa('0x52')],_0x36443b[_0xe3aa('0x54')]));if(_0x1160dc[_0xe3aa('0x52')][_0xe3aa('0x5c')]){_0x5bc5af[_0xe3aa('0x5e')]=_[_0xe3aa('0x5d')](_0x5bc5af['where'],{'$or':_[_0xe3aa('0x4d')](_0x5bc5af[_0xe3aa('0x56')],function(_0x233057){var _0x1d644a={};_0x1d644a[_0x233057]={'$like':'%'+_0x1160dc[_0xe3aa('0x52')][_0xe3aa('0x5c')]+'%'};return _0x1d644a;})});}_0x5bc5af=_[_0xe3aa('0x5d')]({},_0x5bc5af,_0x1160dc[_0xe3aa('0x60')]);return _0x5eb62e[_0xe3aa('0x107')](_0x5bc5af);}})['then'](function(_0xc6e122){if(_0xc6e122){_0x5112e8=_0xc6e122[_0xe3aa('0x58')];if(!_0x1160dc['query'][_0xe3aa('0x76')](_0xe3aa('0x59'))){_0x5bc5af[_0xe3aa('0x2d')]=qs['limit'](_0x1160dc[_0xe3aa('0x52')][_0xe3aa('0x2d')]);_0x5bc5af[_0xe3aa('0x5a')]=qs[_0xe3aa('0x5a')](_0x1160dc[_0xe3aa('0x52')]['offset']);}return _0x5eb62e[_0xe3aa('0x107')](_0x5bc5af);}})['then'](function(_0x4a74dc){if(_0x4a74dc){return _0x4a74dc?{'count':_0x5112e8,'rows':_0x4a74dc}:null;}})[_0xe3aa('0x1e')](respondWithResult(_0x101108,null))[_0xe3aa('0x67')](handleError(_0x101108,null));};exports['getFields']=function(_0x14ef06,_0x7ea29b){var _0x407742=_0x14ef06[_0xe3aa('0x52')][_0xe3aa('0x12a')]==='false'?'offlineForm':_0xe3aa('0x12b');return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'attributes':['id',_0x407742],'where':{'id':_0x14ef06[_0xe3aa('0x65')]['id']}})['then'](handleEntityNotFound(_0x7ea29b,null))[_0xe3aa('0x1e')](function(_0x3836f0){if(_0x3836f0){var _0x47c157=_0x3836f0[_0x407742];var _0x27d498=_0x47c157&&_0x47c157['items']?_0x47c157[_0xe3aa('0x12c')]:[];_0x7ea29b[_0xe3aa('0x36')]({'fromKey':_[_0xe3aa('0x8d')](_0x47c157[_0xe3aa('0x12d')])?undefined:_0x47c157['fromKey'],'count':_0x27d498[_0xe3aa('0x58')],'rows':_0x27d498});}})[_0xe3aa('0x67')](handleError(_0x7ea29b,null));};exports['getOfflineMessages']=function(_0x37fa13,_0x2bb59c){var _0x1706ff={'raw':![],'where':{}};var _0x33ee16={};var _0x325e74={'count':0x0,'rows':[]};return db[_0xe3aa('0x4e')][_0xe3aa('0xe7')]({'where':{'id':_0x37fa13[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x2bb59c,null))[_0xe3aa('0x1e')](function(_0x150062){if(_0x150062){_0x33ee16[_0xe3aa('0x46')]=_[_0xe3aa('0x53')](db[_0xe3aa('0xe0')][_0xe3aa('0x4f')]);_0x33ee16[_0xe3aa('0x52')]=_[_0xe3aa('0x53')](_0x37fa13[_0xe3aa('0x52')]);_0x33ee16[_0xe3aa('0x54')]=_[_0xe3aa('0x55')](_0x33ee16[_0xe3aa('0x46')],_0x33ee16[_0xe3aa('0x52')]);_0x1706ff[_0xe3aa('0x56')]=_[_0xe3aa('0x55')](_0x33ee16[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x37fa13[_0xe3aa('0x52')][_0xe3aa('0x57')]));_0x1706ff[_0xe3aa('0x56')]=_0x1706ff[_0xe3aa('0x56')][_0xe3aa('0x58')]?_0x1706ff[_0xe3aa('0x56')]:_0x33ee16[_0xe3aa('0x46')];if(!_0x37fa13[_0xe3aa('0x52')][_0xe3aa('0x76')]('nolimit')){_0x1706ff[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x37fa13[_0xe3aa('0x52')][_0xe3aa('0x2d')]);_0x1706ff['offset']=qs[_0xe3aa('0x5a')](_0x37fa13['query'][_0xe3aa('0x5a')]);}_0x1706ff[_0xe3aa('0x77')]=qs[_0xe3aa('0x5b')](_0x37fa13[_0xe3aa('0x52')]['sort']);_0x1706ff[_0xe3aa('0x5e')]=qs[_0xe3aa('0x54')](_[_0xe3aa('0x7e')](_0x37fa13[_0xe3aa('0x52')],_0x33ee16['filters']));_0x1706ff[_0xe3aa('0x5e')][_0xe3aa('0x78')]=_0x150062['id'];if(_0x37fa13['query'][_0xe3aa('0x5c')]){_0x1706ff['where']=_['merge'](_0x1706ff[_0xe3aa('0x5e')],{'$or':_[_0xe3aa('0x4d')](_0x1706ff['attributes'],function(_0x135c8e){var _0x3572c6={};_0x3572c6[_0x135c8e]={'$like':'%'+_0x37fa13['query'][_0xe3aa('0x5c')]+'%'};return _0x3572c6;})});}_0x1706ff=_[_0xe3aa('0x5d')]({},_0x1706ff,_0x37fa13[_0xe3aa('0x60')]);return db[_0xe3aa('0xe0')][_0xe3aa('0x2c')]({'where':_0x1706ff[_0xe3aa('0x5e')]})[_0xe3aa('0x1e')](function(_0x445605){_0x325e74[_0xe3aa('0x2c')]=_0x445605;if(_0x37fa13[_0xe3aa('0x52')]['includeAll']){_0x1706ff[_0xe3aa('0x62')]=[{'all':!![]}];}else{_0x1706ff['include']=[{'model':db[_0xe3aa('0xa9')],'as':_0xe3aa('0x100'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xe3aa('0xe0')][_0xe3aa('0x79')](_0x1706ff);})['then'](function(_0x5ad30c){_0x325e74[_0xe3aa('0x63')]=_0x5ad30c;return _0x325e74;});}})['then'](respondWithFilteredResult(_0x2bb59c,_0x1706ff))['catch'](handleError(_0x2bb59c,null));};exports[_0xe3aa('0x12e')]=function(_0x3a81ab,_0x2f5ace){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x3a81ab[_0xe3aa('0x65')]['id']}})['then'](handleEntityNotFound(_0x2f5ace,null))[_0xe3aa('0x1e')](function(_0x48983c){if(_0x48983c){return _0x48983c[_0xe3aa('0x12e')](_0x3a81ab['body']['ids'],_[_0xe3aa('0xfe')](_0x3a81ab[_0xe3aa('0x69')],['ids','id'])||{})[_0xe3aa('0x12f')](function(_0x840c40){for(var _0x13b3d7=0x0;_0x13b3d7<_0x3a81ab['body'][_0xe3aa('0x7b')][_0xe3aa('0x58')];_0x13b3d7+=0x1){socket[_0xe3aa('0x130')]('userChatWebsite:save',{'UserId':Number(_0x3a81ab[_0xe3aa('0x69')][_0xe3aa('0x7b')][_0x13b3d7]),'ChatWebsiteId':Number(_0x3a81ab[_0xe3aa('0x65')]['id'])});}return _0x840c40;});}})[_0xe3aa('0x1e')](respondWithResult(_0x2f5ace,null))[_0xe3aa('0x67')](handleError(_0x2f5ace,null));};exports[_0xe3aa('0x131')]=function(_0x3f083d,_0x4c17ed){return db[_0xe3aa('0x4e')][_0xe3aa('0x66')]({'where':{'id':_0x3f083d['params']['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x4c17ed,null))[_0xe3aa('0x1e')](function(_0xd79f59){if(_0xd79f59){return _0xd79f59['removeAgents'](_0x3f083d[_0xe3aa('0x52')][_0xe3aa('0x7b')])[_0xe3aa('0x1e')](function(){if(_[_0xe3aa('0x132')](_0x3f083d[_0xe3aa('0x52')][_0xe3aa('0x7b')])){for(var _0x32ed14=0x0;_0x32ed14<_0x3f083d[_0xe3aa('0x52')]['ids'][_0xe3aa('0x58')];_0x32ed14+=0x1){socket[_0xe3aa('0x130')](_0xe3aa('0x133'),{'UserId':Number(_0x3f083d[_0xe3aa('0x52')]['ids'][_0x32ed14]),'ChatWebsiteId':Number(_0x3f083d[_0xe3aa('0x65')]['id'])});}}else{socket['emit'](_0xe3aa('0x133'),{'UserId':Number(_0x3f083d[_0xe3aa('0x52')][_0xe3aa('0x7b')]),'ChatWebsiteId':Number(_0x3f083d[_0xe3aa('0x65')]['id'])});}});}})[_0xe3aa('0x1e')](respondWithStatusCode(_0x4c17ed,null))[_0xe3aa('0x67')](handleError(_0x4c17ed,null));};exports[_0xe3aa('0x134')]=function(_0x4f49c1,_0x270b58){var _0x308da2={};var _0x182eb8={};var _0x4a01e6;var _0x335d23;return db[_0xe3aa('0x4e')][_0xe3aa('0xe7')]({'where':{'id':_0x4f49c1[_0xe3aa('0x65')]['id']}})[_0xe3aa('0x1e')](handleEntityNotFound(_0x270b58,null))[_0xe3aa('0x1e')](function(_0x3337ee){if(_0x3337ee){_0x4a01e6=_0x3337ee;_0x182eb8['model']=_['keys'](db[_0xe3aa('0xc7')]['rawAttributes']);_0x182eb8['query']=_[_0xe3aa('0x53')](_0x4f49c1['query']);_0x182eb8['filters']=_['intersection'](_0x182eb8[_0xe3aa('0x46')],_0x182eb8[_0xe3aa('0x52')]);_0x308da2['attributes']=_[_0xe3aa('0x55')](_0x182eb8[_0xe3aa('0x46')],qs[_0xe3aa('0x57')](_0x4f49c1[_0xe3aa('0x52')][_0xe3aa('0x57')]));_0x308da2['attributes']=_0x308da2['attributes'][_0xe3aa('0x58')]?_0x308da2[_0xe3aa('0x56')]:_0x182eb8[_0xe3aa('0x46')];_0x308da2['order']=qs[_0xe3aa('0x5b')](_0x4f49c1[_0xe3aa('0x52')]['sort']);_0x308da2[_0xe3aa('0x5e')]=qs[_0xe3aa('0x54')](_[_0xe3aa('0x7e')](_0x4f49c1[_0xe3aa('0x52')],_0x182eb8[_0xe3aa('0x54')]));if(_0x4f49c1[_0xe3aa('0x52')][_0xe3aa('0x5c')]){_0x308da2[_0xe3aa('0x5e')]=_[_0xe3aa('0x5d')](_0x308da2[_0xe3aa('0x5e')],{'$or':_[_0xe3aa('0x4d')](_0x308da2[_0xe3aa('0x56')],function(_0x3e477a){var _0x34a262={};_0x34a262[_0x3e477a]={'$like':'%'+_0x4f49c1['query'][_0xe3aa('0x5c')]+'%'};return _0x34a262;})});}_0x308da2=_[_0xe3aa('0x5d')]({},_0x308da2,_0x4f49c1[_0xe3aa('0x60')]);return _0x4a01e6[_0xe3aa('0x134')](_0x308da2);}})[_0xe3aa('0x1e')](function(_0x1c5f46){if(_0x1c5f46){_0x335d23=_0x1c5f46['length'];if(!_0x4f49c1[_0xe3aa('0x52')][_0xe3aa('0x76')](_0xe3aa('0x59'))){_0x308da2[_0xe3aa('0x2d')]=qs[_0xe3aa('0x2d')](_0x4f49c1[_0xe3aa('0x52')]['limit']);_0x308da2['offset']=qs[_0xe3aa('0x5a')](_0x4f49c1['query'][_0xe3aa('0x5a')]);}return _0x4a01e6[_0xe3aa('0x134')](_0x308da2);}})['then'](function(_0x232b96){if(_0x232b96){return _0x232b96?{'count':_0x335d23,'rows':_0x232b96}:null;}})['then'](respondWithResult(_0x270b58,null))[_0xe3aa('0x67')](handleError(_0x270b58,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9a054d4..0bf72ab 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 _0xc9b7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x3cc90b,_0x1b69d9){_0x3cc90b=_0x3cc90b-0x0;var _0x34051b=_0xc9b7[_0x3cc90b];return _0x34051b;};'use strict';var EventEmitter=require(_0x7c9b('0x0'));var ChatWebsite=require(_0x7c9b('0x1'))['db'][_0x7c9b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7c9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c9b('0x4'),'afterDestroy':_0x7c9b('0x5')};function emitEvent(_0x56f327){return function(_0x474486,_0x365dd6,_0x1fb942){ChatWebsiteEvents[_0x7c9b('0x6')](_0x56f327+':'+_0x474486['id'],_0x474486);ChatWebsiteEvents[_0x7c9b('0x6')](_0x56f327,_0x474486);_0x1fb942(null);};}for(var e in events){if(events[_0x7c9b('0x7')](e)){var event=events[e];ChatWebsite[_0x7c9b('0x8')](e,emitEvent(event));}}module[_0x7c9b('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6dfa=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x5201c0,_0x5d5fba){var _0x1cf48b=function(_0x5b9203){while(--_0x5b9203){_0x5201c0['push'](_0x5201c0['shift']());}};_0x1cf48b(++_0x5d5fba);}(_0x6dfa,0x7b));var _0xa6df=function(_0x159232,_0x439514){_0x159232=_0x159232-0x0;var _0x448bc4=_0x6dfa[_0x159232];return _0x448bc4;};'use strict';var EventEmitter=require(_0xa6df('0x0'));var ChatWebsite=require(_0xa6df('0x1'))['db'][_0xa6df('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa6df('0x3')](0x0);var events={'afterCreate':_0xa6df('0x4'),'afterUpdate':'update','afterDestroy':_0xa6df('0x5')};function emitEvent(_0x4e356f){return function(_0x2ea163,_0x4da450,_0x5b92a8){ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f+':'+_0x2ea163['id'],_0x2ea163);ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f,_0x2ea163);_0x5b92a8(null);};}for(var e in events){if(events[_0xa6df('0x7')](e)){var event=events[e];ChatWebsite[_0xa6df('0x8')](e,emitEvent(event));}}module[_0xa6df('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e2fe637..4b37aec 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 _0x9708=['define','ChatWebsite','chat_websites','lodash','util','api','bluebird','path','../../config/environment','./chatWebsite.attributes'];(function(_0x408adb,_0x1c32f1){var _0x2fca01=function(_0xf46442){while(--_0xf46442){_0x408adb['push'](_0x408adb['shift']());}};_0x2fca01(++_0x1c32f1);}(_0x9708,0x1b1));var _0x8970=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x9708[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x8970('0x0'));var util=require(_0x8970('0x1'));var logger=require('../../config/logger')(_0x8970('0x2'));var moment=require('moment');var BPromise=require(_0x8970('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8970('0x4'));var rimraf=require('rimraf');var config=require(_0x8970('0x5'));var attributes=require(_0x8970('0x6'));module['exports']=function(_0x49a369,_0x51f57c){return _0x49a369[_0x8970('0x7')](_0x8970('0x8'),attributes,{'tableName':_0x8970('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x22ac02,_0x183aec){var _0x20cc5c=function(_0x1e0bd9){while(--_0x1e0bd9){_0x22ac02['push'](_0x22ac02['shift']());}};_0x20cc5c(++_0x183aec);}(_0x8958,0x180));var _0x8895=function(_0x36cb88,_0x3c5153){_0x36cb88=_0x36cb88-0x0;var _0x59fbf9=_0x8958[_0x36cb88];return _0x59fbf9;};'use strict';var _=require(_0x8895('0x0'));var util=require(_0x8895('0x1'));var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var moment=require(_0x8895('0x4'));var BPromise=require(_0x8895('0x5'));var rp=require(_0x8895('0x6'));var fs=require('fs');var path=require(_0x8895('0x7'));var rimraf=require(_0x8895('0x8'));var config=require(_0x8895('0x9'));var attributes=require(_0x8895('0xa'));module['exports']=function(_0x592a1a,_0x161a49){return _0x592a1a[_0x8895('0xb')](_0x8895('0xc'),attributes,{'tableName':_0x8895('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index de0b5e1..b0712de 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 _0xc26e=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0xc26e,0x19c));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec26('0x0'));var util=require('util');var moment=require(_0xec26('0x1'));var BPromise=require('bluebird');var rs=require(_0xec26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec26('0x3'))['db'];var utils=require(_0xec26('0x4'));var logger=require('../../config/logger')(_0xec26('0x5'));var config=require(_0xec26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec26('0x7')][_0xec26('0x8')]({'port':0x232a});config[_0xec26('0x9')]=_[_0xec26('0xa')](config[_0xec26('0x9')],{'host':_0xec26('0xb'),'port':0x18eb});var socket=require(_0xec26('0xc'))(new Redis(config[_0xec26('0x9')]));require(_0xec26('0xd'))['register'](socket);function respondWithRpcPromise(_0x4bf35e,_0x30857e,_0x300113){return new BPromise(function(_0x171e7d,_0x5cefea){return client[_0xec26('0xe')](_0x4bf35e,_0x300113)[_0xec26('0xf')](function(_0x1e6375){logger[_0xec26('0x10')](_0xec26('0x11'),_0x30857e,_0xec26('0x12'));logger[_0xec26('0x13')](_0xec26('0x14'),_0x30857e,_0xec26('0x12'),JSON[_0xec26('0x15')](_0x1e6375));if(_0x1e6375[_0xec26('0x16')]){if(_0x1e6375[_0xec26('0x16')][_0xec26('0x17')]===0x1f4){logger[_0xec26('0x16')](_0xec26('0x11'),_0x30857e,_0x1e6375['error'][_0xec26('0x18')]);return _0x5cefea(_0x1e6375['error'][_0xec26('0x18')]);}logger[_0xec26('0x16')](_0xec26('0x11'),_0x30857e,_0x1e6375[_0xec26('0x16')]['message']);return _0x171e7d(_0x1e6375[_0xec26('0x16')][_0xec26('0x18')]);}else{logger[_0xec26('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x30857e,_0xec26('0x12'));_0x171e7d(_0x1e6375['result']['message']);}})[_0xec26('0x19')](function(_0x1f1a91){logger[_0xec26('0x16')](_0xec26('0x11'),_0x30857e,_0x1f1a91);_0x5cefea(_0x1f1a91);});});} \ No newline at end of file +var _0x674b=['http','redis','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x674b,0xdf));var _0xb674=function(_0x3159c0,_0x592776){_0x3159c0=_0x3159c0-0x0;var _0x12411f=_0x674b[_0x3159c0];return _0x12411f;};'use strict';var _=require(_0xb674('0x0'));var util=require(_0xb674('0x1'));var moment=require(_0xb674('0x2'));var BPromise=require(_0xb674('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb674('0x4'))['db'];var utils=require(_0xb674('0x5'));var logger=require(_0xb674('0x6'))(_0xb674('0x7'));var config=require(_0xb674('0x8'));var jayson=require(_0xb674('0x9'));var client=jayson[_0xb674('0xa')][_0xb674('0xb')]({'port':0x232a});config[_0xb674('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb674('0xd'))(new Redis(config[_0xb674('0xc')]));require(_0xb674('0xe'))[_0xb674('0xf')](socket);function respondWithRpcPromise(_0x3cbeca,_0x4af829,_0x56e29a){return new BPromise(function(_0x160914,_0x31208a){return client['request'](_0x3cbeca,_0x56e29a)[_0xb674('0x10')](function(_0x32f792){logger['info'](_0xb674('0x11'),_0x4af829,'request\x20sent');logger[_0xb674('0x12')](_0xb674('0x13'),_0x4af829,'request\x20sent',JSON['stringify'](_0x32f792));if(_0x32f792['error']){if(_0x32f792[_0xb674('0x14')][_0xb674('0x15')]===0x1f4){logger[_0xb674('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4af829,_0x32f792[_0xb674('0x14')][_0xb674('0x16')]);return _0x31208a(_0x32f792[_0xb674('0x14')][_0xb674('0x16')]);}logger[_0xb674('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4af829,_0x32f792[_0xb674('0x14')][_0xb674('0x16')]);return _0x160914(_0x32f792[_0xb674('0x14')][_0xb674('0x16')]);}else{logger[_0xb674('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x4af829,_0xb674('0x18'));_0x160914(_0x32f792['result'][_0xb674('0x16')]);}})[_0xb674('0x19')](function(_0x126adf){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4af829,_0x126adf);_0x31208a(_0x126adf);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2eefc86..008b1bf 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 _0xd0e1=['update','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xd0e1,0x140));var _0x1d0e=function(_0x86839d,_0x52f9d6){_0x86839d=_0x86839d-0x0;var _0x12b631=_0xd0e1[_0x86839d];return _0x12b631;};'use strict';var ChatWebsiteEvents=require(_0x1d0e('0x0'));var events=[_0x1d0e('0x1'),'remove',_0x1d0e('0x2')];function createListener(_0x43012b,_0x5160f7){return function(_0x43bcfd){_0x5160f7['emit'](_0x43012b,_0x43bcfd);};}function removeListener(_0x3f00c5,_0x110a97){return function(){ChatWebsiteEvents[_0x1d0e('0x3')](_0x3f00c5,_0x110a97);};}exports[_0x1d0e('0x4')]=function(_0x3fa82e){for(var _0x42e3da=0x0,_0x3dbd39=events[_0x1d0e('0x5')];_0x42e3da<_0x3dbd39;_0x42e3da++){var _0x5645ff=events[_0x42e3da];var _0x51d363=createListener(_0x1d0e('0x6')+_0x5645ff,_0x3fa82e);ChatWebsiteEvents['on'](_0x5645ff,_0x51d363);}}; \ No newline at end of file +var _0x4067=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x58c9a1,_0xd72b43){var _0x1026b1=function(_0x2c0fde){while(--_0x2c0fde){_0x58c9a1['push'](_0x58c9a1['shift']());}};_0x1026b1(++_0xd72b43);}(_0x4067,0x154));var _0x7406=function(_0x85ee53,_0x6698ec){_0x85ee53=_0x85ee53-0x0;var _0x42552e=_0x4067[_0x85ee53];return _0x42552e;};'use strict';var ChatWebsiteEvents=require(_0x7406('0x0'));var events=[_0x7406('0x1'),_0x7406('0x2'),_0x7406('0x3')];function createListener(_0x41beb2,_0x2c0775){return function(_0x20cc64){_0x2c0775[_0x7406('0x4')](_0x41beb2,_0x20cc64);};}function removeListener(_0x56d555,_0x5d614e){return function(){ChatWebsiteEvents[_0x7406('0x5')](_0x56d555,_0x5d614e);};}exports[_0x7406('0x6')]=function(_0x3afd61){for(var _0x5cabff=0x0,_0x3bfea4=events[_0x7406('0x7')];_0x5cabff<_0x3bfea4;_0x5cabff++){var _0x230354=events[_0x5cabff];var _0x36ced4=createListener(_0x7406('0x8')+_0x230354,_0x3afd61);ChatWebsiteEvents['on'](_0x230354,_0x36ced4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 2e61a76..62a527f 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x222f=['replace','localhost','test','exports','../../../utils/misc','escapeRegExp','url','URL'];(function(_0x39deb4,_0x17f79e){var _0x4fbf7b=function(_0x43ad63){while(--_0x43ad63){_0x39deb4['push'](_0x39deb4['shift']());}};_0x4fbf7b(++_0x17f79e);}(_0x222f,0x1a4));var _0xf222=function(_0x11ad65,_0x352d3c){_0x11ad65=_0x11ad65-0x0;var _0x35590c=_0x222f[_0x11ad65];return _0x35590c;};var escapeRegExp=require(_0xf222('0x0'))[_0xf222('0x1')];var URL=require(_0xf222('0x2'))[_0xf222('0x3')];function testWildcardValidity(_0x4d09ec){let _0x4b4237=!![];try{new URL(_0x4d09ec[_0xf222('0x4')]('*',_0xf222('0x5')));}catch(_0x307791){_0x4b4237=![];}return _0x4b4237&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf222('0x6')](_0x4d09ec);}function testWebsiteWithWildcard(_0x59a619,_0x3a2751){let _0x54a758;const _0x112e6d=escapeRegExp(_0x59a619)[_0xf222('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x59a619[_0xf222('0x4')]('\x5c*',_0xf222('0x5')));_0x54a758=new RegExp(_0x112e6d)['test'](_0x3a2751);}catch(_0x31c027){_0x54a758=![];}return _0x54a758;}module[_0xf222('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x9234=['localhost','replace','([\x5cw]+)','test','exports','../../../utils/misc','url','URL'];(function(_0x5d2481,_0x1d0d33){var _0x8a55d2=function(_0x2a2647){while(--_0x2a2647){_0x5d2481['push'](_0x5d2481['shift']());}};_0x8a55d2(++_0x1d0d33);}(_0x9234,0x1bd));var _0x4923=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x9234[_0x11e05d];return _0x335588;};var escapeRegExp=require(_0x4923('0x0'))['escapeRegExp'];var URL=require(_0x4923('0x1'))[_0x4923('0x2')];function testWildcardValidity(_0x1f0d3a){let _0x34915b=!![];try{new URL(_0x1f0d3a['replace']('*',_0x4923('0x3')));}catch(_0x436ce1){_0x34915b=![];}return _0x34915b&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x1f0d3a);}function testWebsiteWithWildcard(_0x100be3,_0x1184c3){let _0x526ad7;const _0x3c5e3f=escapeRegExp(_0x100be3)[_0x4923('0x4')]('\x5c*',_0x4923('0x5'));try{new URL(_0x100be3[_0x4923('0x4')]('\x5c*','localhost'));_0x526ad7=new RegExp(_0x3c5e3f)[_0x4923('0x6')](_0x1184c3);}catch(_0x590bb6){_0x526ad7=![];}return _0x526ad7;}module[_0x4923('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 5ceaef2..306dd7b 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 _0xf83c=['server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','delete','destroy','/:id/dispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','show','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','post','create','addDisposition','addAnswer','root','now','originalname','addLogo','diskStorage','server/files/images/avatars/','format','%s-%s','file','addAvatar','/:id/customer_avatar','single','join','/:id/system_avatar','notify'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xf83c,0x11e));var _0xcf83=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xf83c[_0x5c72ee];return _0x231876;};'use strict';var multer=require(_0xcf83('0x0'));var util=require(_0xcf83('0x1'));var path=require(_0xcf83('0x2'));var timeout=require(_0xcf83('0x3'));var express=require(_0xcf83('0x4'));var router=express[_0xcf83('0x5')]();var fs_extra=require(_0xcf83('0x6'));var auth=require(_0xcf83('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcf83('0x8'));var controller=require(_0xcf83('0x9'));router[_0xcf83('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcf83('0xa')](_0xcf83('0xb'),auth[_0xcf83('0xc')](),controller['describe']);router[_0xcf83('0xa')]('/:id',auth[_0xcf83('0xc')](),controller[_0xcf83('0xd')]);router[_0xcf83('0xa')]('/:id/dispositions',auth[_0xcf83('0xc')](),controller['getDispositions']);router[_0xcf83('0xa')](_0xcf83('0xe'),auth[_0xcf83('0xc')](),controller[_0xcf83('0xf')]);router[_0xcf83('0xa')]('/:id/logo',controller[_0xcf83('0x10')]);router[_0xcf83('0xa')](_0xcf83('0x11'),controller['getAvatar']);router[_0xcf83('0xa')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xcf83('0xa')]('/:id/system_avatar',controller[_0xcf83('0x12')]);router[_0xcf83('0xa')](_0xcf83('0x13'),auth['isAuthenticated'](),controller[_0xcf83('0x14')]);router[_0xcf83('0xa')](_0xcf83('0x15'),controller[_0xcf83('0x16')]);router[_0xcf83('0xa')](_0xcf83('0x17'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x18')]);router[_0xcf83('0xa')](_0xcf83('0x19'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x1a')]);router[_0xcf83('0xa')](_0xcf83('0x1b'),controller[_0xcf83('0x1c')]);router[_0xcf83('0xa')]('/:id/offline_messages',auth[_0xcf83('0xc')](),controller[_0xcf83('0x1d')]);router['get']('/:id/users',auth[_0xcf83('0xc')](),controller['getAgents']);router[_0xcf83('0x1e')]('/',auth[_0xcf83('0xc')](),controller[_0xcf83('0x1f')]);router['post']('/:id/dispositions',auth[_0xcf83('0xc')](),controller[_0xcf83('0x20')]);router[_0xcf83('0x1e')](_0xcf83('0xe'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5558da,_0x422c0a,_0x5bbcc7){_0x5bbcc7(null,path['join'](config[_0xcf83('0x22')],'server/files/images/logos/'));},'filename':function(_0x22365f,_0x58e859,_0x1a49e0){_0x1a49e0(null,util['format']('%s-%s',Date[_0xcf83('0x23')](),_0x58e859[_0xcf83('0x24')]));}})});router['post']('/:id/logo',upload['single']('file'),controller[_0xcf83('0x25')]);var upload=multer({'storage':multer[_0xcf83('0x26')]({'destination':function(_0x5524c0,_0x87d612,_0x6e9225){_0x6e9225(null,path['join'](config[_0xcf83('0x22')],_0xcf83('0x27')));},'filename':function(_0x5bac9c,_0x3eda82,_0x46311e){_0x46311e(null,util[_0xcf83('0x28')](_0xcf83('0x29'),Date[_0xcf83('0x23')](),_0x3eda82[_0xcf83('0x24')]));}})});router[_0xcf83('0x1e')](_0xcf83('0x11'),upload['single'](_0xcf83('0x2a')),controller[_0xcf83('0x2b')]);var upload=multer({'storage':multer[_0xcf83('0x26')]({'destination':function(_0x3b74ac,_0x382811,_0x15b3ab){_0x15b3ab(null,path['join'](config[_0xcf83('0x22')],_0xcf83('0x27')));},'filename':function(_0x507ba7,_0x4b536a,_0xd01209){_0xd01209(null,util[_0xcf83('0x28')](_0xcf83('0x29'),Date['now'](),_0x4b536a['originalname']));}})});router[_0xcf83('0x1e')](_0xcf83('0x2c'),upload[_0xcf83('0x2d')](_0xcf83('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xcf83('0x26')]({'destination':function(_0x26fd9c,_0xa14616,_0x499626){_0x499626(null,path[_0xcf83('0x2e')](config[_0xcf83('0x22')],_0xcf83('0x27')));},'filename':function(_0x77c030,_0x1dc37c,_0x1f838c){_0x1f838c(null,util[_0xcf83('0x28')]('%s-%s',Date[_0xcf83('0x23')](),_0x1dc37c[_0xcf83('0x24')]));}})});router['post'](_0xcf83('0x2f'),upload[_0xcf83('0x2d')](_0xcf83('0x2a')),controller['addSystemAvatar']);router[_0xcf83('0x1e')]('/:id/notify',controller[_0xcf83('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x43b5ca,_0x534f09,_0x196ea4){const _0x44e045=path[_0xcf83('0x2e')](config['root'],_0xcf83('0x31'),_0xcf83('0x32'),'offline-chat');fs_extra[_0xcf83('0x33')](_0x44e045,function(){_0x196ea4(null,_0x44e045);});},'filename':function(_0x5407e0,_0x2fc7fa,_0x55d8ec){const _0x2b79c1=_0x2fc7fa[_0xcf83('0x24')][_0xcf83('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x7159e0=path[_0xcf83('0x35')](_0x2b79c1);const _0x96c6a8=Date['now']()+'-'+_0x2b79c1[_0xcf83('0x34')](_0x7159e0,'')+_0x7159e0;_0x55d8ec(null,_0x96c6a8);}})});router[_0xcf83('0x1e')](_0xcf83('0x36'),offlineUploadMulter[_0xcf83('0x37')](),controller[_0xcf83('0x38')]);router[_0xcf83('0x1e')](_0xcf83('0x13'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x39')]);router[_0xcf83('0x1e')]('/:id/applications',auth[_0xcf83('0xc')](),controller['addApplications']);router['post']('/:id/proactive_actions',auth[_0xcf83('0xc')](),controller[_0xcf83('0x3a')]);router[_0xcf83('0x1e')](_0xcf83('0x3b'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x3c')]);router[_0xcf83('0x3d')]('/:id',auth[_0xcf83('0xc')](),controller['update']);router[_0xcf83('0x3e')]('/:id',auth[_0xcf83('0xc')](),controller[_0xcf83('0x3f')]);router['delete'](_0xcf83('0x40'),auth[_0xcf83('0xc')](),controller['removeDispositions']);router[_0xcf83('0x3e')](_0xcf83('0xe'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x41')]);router[_0xcf83('0x3e')](_0xcf83('0x3b'),auth[_0xcf83('0xc')](),controller[_0xcf83('0x42')]);module['exports']=router; \ No newline at end of file +var _0x708e=['getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','notify','extname','replace','/:id/offline','offline','addInteraction','addAgents','put','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x708e,0xac));var _0xe708=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x708e[_0x183256];return _0x5394a2;};'use strict';var multer=require(_0xe708('0x0'));var util=require(_0xe708('0x1'));var path=require(_0xe708('0x2'));var timeout=require(_0xe708('0x3'));var express=require('express');var router=express[_0xe708('0x4')]();var fs_extra=require(_0xe708('0x5'));var auth=require(_0xe708('0x6'));var interaction=require(_0xe708('0x7'));var config=require(_0xe708('0x8'));var controller=require(_0xe708('0x9'));router[_0xe708('0xa')]('/',auth['isAuthenticated'](),controller[_0xe708('0xb')]);router[_0xe708('0xa')](_0xe708('0xc'),auth[_0xe708('0xd')](),controller[_0xe708('0xe')]);router[_0xe708('0xa')](_0xe708('0xf'),auth['isAuthenticated'](),controller[_0xe708('0x10')]);router[_0xe708('0xa')](_0xe708('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe708('0xa')](_0xe708('0x12'),auth[_0xe708('0xd')](),controller['getAnswers']);router[_0xe708('0xa')](_0xe708('0x13'),controller[_0xe708('0x14')]);router[_0xe708('0xa')](_0xe708('0x15'),controller[_0xe708('0x16')]);router[_0xe708('0xa')]('/:id/customer_avatar',controller[_0xe708('0x17')]);router[_0xe708('0xa')]('/:id/system_avatar',controller[_0xe708('0x18')]);router[_0xe708('0xa')](_0xe708('0x19'),auth[_0xe708('0xd')](),controller['getInteractions']);router[_0xe708('0xa')](_0xe708('0x1a'),controller[_0xe708('0x1b')]);router[_0xe708('0xa')](_0xe708('0x1c'),auth[_0xe708('0xd')](),controller[_0xe708('0x1d')]);router[_0xe708('0xa')](_0xe708('0x1e'),auth[_0xe708('0xd')](),controller['getProactiveActions']);router['get']('/:id/fields',controller['getFields']);router[_0xe708('0xa')](_0xe708('0x1f'),auth['isAuthenticated'](),controller[_0xe708('0x20')]);router[_0xe708('0xa')]('/:id/users',auth[_0xe708('0xd')](),controller[_0xe708('0x21')]);router[_0xe708('0x22')]('/',auth[_0xe708('0xd')](),controller[_0xe708('0x23')]);router[_0xe708('0x22')](_0xe708('0x11'),auth[_0xe708('0xd')](),controller[_0xe708('0x24')]);router[_0xe708('0x22')](_0xe708('0x12'),auth[_0xe708('0xd')](),controller[_0xe708('0x25')]);var upload=multer({'storage':multer[_0xe708('0x26')]({'destination':function(_0x1e66cd,_0x171b75,_0x3fd39e){_0x3fd39e(null,path[_0xe708('0x27')](config[_0xe708('0x28')],_0xe708('0x29')));},'filename':function(_0x19415e,_0x247e9b,_0x3f2ed2){_0x3f2ed2(null,util[_0xe708('0x2a')](_0xe708('0x2b'),Date[_0xe708('0x2c')](),_0x247e9b[_0xe708('0x2d')]));}})});router[_0xe708('0x22')](_0xe708('0x13'),upload[_0xe708('0x2e')](_0xe708('0x2f')),controller[_0xe708('0x30')]);var upload=multer({'storage':multer[_0xe708('0x26')]({'destination':function(_0x37faec,_0x5149f7,_0x124bae){_0x124bae(null,path[_0xe708('0x27')](config['root'],_0xe708('0x31')));},'filename':function(_0x344be9,_0x14518b,_0x44b47f){_0x44b47f(null,util[_0xe708('0x2a')](_0xe708('0x2b'),Date['now'](),_0x14518b[_0xe708('0x2d')]));}})});router['post'](_0xe708('0x15'),upload[_0xe708('0x2e')](_0xe708('0x2f')),controller[_0xe708('0x32')]);var upload=multer({'storage':multer[_0xe708('0x26')]({'destination':function(_0x496c52,_0x943255,_0x3ea043){_0x3ea043(null,path[_0xe708('0x27')](config[_0xe708('0x28')],_0xe708('0x31')));},'filename':function(_0x13029c,_0x4fba12,_0xefe2c5){_0xefe2c5(null,util[_0xe708('0x2a')](_0xe708('0x2b'),Date[_0xe708('0x2c')](),_0x4fba12[_0xe708('0x2d')]));}})});router['post'](_0xe708('0x33'),upload[_0xe708('0x2e')](_0xe708('0x2f')),controller[_0xe708('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c70d8,_0x125c16,_0x47a8a8){_0x47a8a8(null,path['join'](config[_0xe708('0x28')],_0xe708('0x31')));},'filename':function(_0x60bde0,_0x1eff96,_0x25b1db){_0x25b1db(null,util['format'](_0xe708('0x2b'),Date[_0xe708('0x2c')](),_0x1eff96[_0xe708('0x2d')]));}})});router['post'](_0xe708('0x35'),upload[_0xe708('0x2e')](_0xe708('0x2f')),controller['addSystemAvatar']);router['post']('/:id/notify',controller[_0xe708('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xe708('0x26')]({'destination':function(_0x39626e,_0x1213e9,_0x3aa796){const _0x4f0449=path[_0xe708('0x27')](config[_0xe708('0x28')],'server/files','attachments','offline-chat');fs_extra['ensureDir'](_0x4f0449,function(){_0x3aa796(null,_0x4f0449);});},'filename':function(_0x19b35b,_0x387a70,_0x5ed2a9){const _0x14e1a8=_0x387a70[_0xe708('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x430965=path[_0xe708('0x37')](_0x14e1a8);const _0x255969=Date[_0xe708('0x2c')]()+'-'+_0x14e1a8[_0xe708('0x38')](_0x430965,'')+_0x430965;_0x5ed2a9(null,_0x255969);}})});router[_0xe708('0x22')](_0xe708('0x39'),offlineUploadMulter['any'](),controller[_0xe708('0x3a')]);router[_0xe708('0x22')](_0xe708('0x19'),auth[_0xe708('0xd')](),controller[_0xe708('0x3b')]);router[_0xe708('0x22')](_0xe708('0x1c'),auth[_0xe708('0xd')](),controller['addApplications']);router[_0xe708('0x22')](_0xe708('0x1e'),auth[_0xe708('0xd')](),controller['addProactiveActions']);router[_0xe708('0x22')]('/:id/users',auth[_0xe708('0xd')](),controller[_0xe708('0x3c')]);router[_0xe708('0x3d')](_0xe708('0xf'),auth[_0xe708('0xd')](),controller['update']);router[_0xe708('0x3e')](_0xe708('0xf'),auth[_0xe708('0xd')](),controller['destroy']);router[_0xe708('0x3e')]('/:id/dispositions',auth[_0xe708('0xd')](),controller[_0xe708('0x3f')]);router[_0xe708('0x3e')](_0xe708('0x12'),auth[_0xe708('0xd')](),controller['removeAnswers']);router[_0xe708('0x3e')]('/:id/users',auth[_0xe708('0xd')](),controller[_0xe708('0x40')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 37faa89..b6eb633 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6738=['express','../config/environment','Router','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','beaver-logger/server'];(function(_0x43bb22,_0x127f6b){var _0xd2adef=function(_0x44f446){while(--_0x44f446){_0x43bb22['push'](_0x43bb22['shift']());}};_0xd2adef(++_0x127f6b);}(_0x6738,0x103));var _0x8673=function(_0x2dd3d8,_0x2a49b5){_0x2dd3d8=_0x2dd3d8-0x0;var _0x5ebf99=_0x6738[_0x2dd3d8];return _0x5ebf99;};var beaverLogger=require(_0x8673('0x0'));var express=require(_0x8673('0x1'));var auth=require('../components/auth/service');var config=require(_0x8673('0x2'));var router=express[_0x8673('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x2b1bfb,_0x72a71d,_0x51faaf){var _0x48f133=_0x2b1bfb[_0x8673('0x4')][_0x8673('0x5')]('client-side-logger');if(!_0x48f133){throw new Error(_0x8673('0x6'));}return beaverLogger[_0x8673('0x7')]({'uri':'/client-logs','logger':_0x48f133,'enableCors':!isProduction})(_0x2b1bfb,_0x72a71d,_0x51faaf);}router[_0x8673('0x8')](auth[_0x8673('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x29cd=['production','app','get','client-side-logger','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x29cd,0x167));var _0xd29c=function(_0xc44e06,_0x308d58){_0xc44e06=_0xc44e06-0x0;var _0x3094dd=_0x29cd[_0xc44e06];return _0x3094dd;};var beaverLogger=require(_0xd29c('0x0'));var express=require('express');var auth=require(_0xd29c('0x1'));var config=require(_0xd29c('0x2'));var router=express[_0xd29c('0x3')]();var isProduction=config[_0xd29c('0x4')]===_0xd29c('0x5')||![];function clientSideLogs(_0x57682f,_0x3dc0c7,_0x2ca520){var _0x4b2c23=_0x57682f[_0xd29c('0x6')][_0xd29c('0x7')](_0xd29c('0x8'));if(!_0x4b2c23){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xd29c('0x9')]({'uri':'/client-logs','logger':_0x4b2c23,'enableCors':!isProduction})(_0x57682f,_0x3dc0c7,_0x2ca520);}router[_0xd29c('0xa')](auth[_0xd29c('0xb')](),clientSideLogs);module[_0xd29c('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5c6ac7a..b2f7b41 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 _0x237b=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x237b,0x112));var _0xb237=function(_0x3ee898,_0x277d5c){_0x3ee898=_0x3ee898-0x0;var _0xaf93e=_0x237b[_0x3ee898];return _0xaf93e;};'use strict';var Sequelize=require(_0xb237('0x0'));module[_0xb237('0x1')]={'name':{'type':Sequelize[_0xb237('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb237('0x3')](_0xb237('0x4'),_0xb237('0x5'),_0xb237('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb237('0x7'),_0xb237('0x8'))},'data1':{'type':Sequelize[_0xb237('0x2')],'comment':_0xb237('0x9')},'data2':{'type':Sequelize[_0xb237('0x2')],'comment':_0xb237('0xa')},'data3':{'type':Sequelize[_0xb237('0x2')],'comment':_0xb237('0xb')},'data4':{'type':Sequelize[_0xb237('0x2')],'comment':_0xb237('0xc')},'data5':{'type':Sequelize['TEXT'],'comment':_0xb237('0xd')},'data6':{'type':Sequelize[_0xb237('0xe')],'comment':_0xb237('0xf')},'data7':{'type':Sequelize[_0xb237('0xe')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xf4b7=['exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x1b6e11,_0x51702b){var _0x439bca=function(_0x4f75d0){while(--_0x4f75d0){_0x1b6e11['push'](_0x1b6e11['shift']());}};_0x439bca(++_0x51702b);}(_0xf4b7,0x95));var _0x7f4b=function(_0x5dbaa4,_0x2a4df0){_0x5dbaa4=_0x5dbaa4-0x0;var _0x41cf0f=_0xf4b7[_0x5dbaa4];return _0x41cf0f;};'use strict';var Sequelize=require(_0x7f4b('0x0'));module[_0x7f4b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7f4b('0x2')](_0x7f4b('0x3'),_0x7f4b('0x4'),_0x7f4b('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7f4b('0x6'),_0x7f4b('0x7'))},'data1':{'type':Sequelize[_0x7f4b('0x8')],'comment':_0x7f4b('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x7f4b('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x7f4b('0xb')},'data4':{'type':Sequelize[_0x7f4b('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x7f4b('0xc')},'data6':{'type':Sequelize[_0x7f4b('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0x7f4b('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6db6621..1c8c72c 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 _0xe6f7=['Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','find','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data5','access_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes'];(function(_0xbad322,_0x3e6b0b){var _0x2101cb=function(_0x1c3c3b){while(--_0x1c3c3b){_0xbad322['push'](_0xbad322['shift']());}};_0x2101cb(++_0x3e6b0b);}(_0xe6f7,0xd5));var _0x7e6f=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0xe6f7[_0x1a014b];return _0x462258;};'use strict';var _=require('lodash');var Redis=require(_0x7e6f('0x0'));var qs=require(_0x7e6f('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x7e6f('0x2'));var db=require(_0x7e6f('0x3'))['db'];var oauth=require(_0x7e6f('0x4'));config[_0x7e6f('0x5')]=_[_0x7e6f('0x6')](config[_0x7e6f('0x5')],{'host':_0x7e6f('0x7'),'port':0x18eb});var socket=require(_0x7e6f('0x8'))(new Redis(config[_0x7e6f('0x5')]));var redis=new Redis(config[_0x7e6f('0x5')]);function respondWithStatusCode(_0x53e13b,_0x344247){_0x344247=_0x344247||0xcc;return function(_0x31c847){if(_0x31c847){return _0x53e13b['sendStatus'](_0x344247);}return _0x53e13b['status'](_0x344247)[_0x7e6f('0x9')]();};}function respondWithResult(_0x2d75e3,_0x2e187d){_0x2e187d=_0x2e187d||0xc8;return function(_0x27f816){if(_0x27f816){return _0x2d75e3[_0x7e6f('0xa')](_0x2e187d)[_0x7e6f('0xb')](_0x27f816);}};}function respondWithFilteredResult(_0x1c2e4e,_0x213052){return function(_0x1d57db){if(_0x1d57db){var _0x1b460b=typeof _0x213052[_0x7e6f('0xc')]===_0x7e6f('0xd')&&typeof _0x213052[_0x7e6f('0xe')]===_0x7e6f('0xd');var _0x18f280=_0x1d57db[_0x7e6f('0xf')];var _0x580c3d=_0x1b460b?0x0:_0x213052['offset'];var _0x3e42c2=_0x1b460b?_0x1d57db[_0x7e6f('0xf')]:_0x213052[_0x7e6f('0xc')]+_0x213052[_0x7e6f('0xe')];var _0x13ffac;if(_0x3e42c2>=_0x18f280){_0x3e42c2=_0x18f280;_0x13ffac=0xc8;}else{_0x13ffac=0xce;}_0x1c2e4e[_0x7e6f('0xa')](_0x13ffac);return _0x1c2e4e['set'](_0x7e6f('0x10'),_0x580c3d+'-'+_0x3e42c2+'/'+_0x18f280)[_0x7e6f('0xb')](_0x1d57db);}return null;};}function saveUpdates(_0xcebdd7){return function(_0x19dff2){if(_0x19dff2){return _0x19dff2[_0x7e6f('0x11')](_0xcebdd7)[_0x7e6f('0x12')](function(_0x13f37f){return _0x13f37f;});}return null;};}function removeEntity(_0x33e32a){return function(_0x1e817d){if(_0x1e817d){return _0x1e817d['destroy']()[_0x7e6f('0x12')](function(){_0x33e32a[_0x7e6f('0xa')](0xcc)[_0x7e6f('0x9')]();});}};}function handleEntityNotFound(_0x55156f){return function(_0x478532){if(!_0x478532){_0x55156f['sendStatus'](0x194);}return _0x478532;};}function handleError(_0x5a6417,_0x5bd7e3){_0x5bd7e3=_0x5bd7e3||0x1f4;return function(_0x1d67c1){logger[_0x7e6f('0x13')](_0x1d67c1[_0x7e6f('0x14')]);if(_0x1d67c1[_0x7e6f('0x15')]){delete _0x1d67c1['name'];}_0x5a6417[_0x7e6f('0xa')](_0x5bd7e3)[_0x7e6f('0x16')](_0x1d67c1);};}function maskClientSecret(_0x2a2f82){return _[_0x7e6f('0x17')](_0x2a2f82['slice'](0x0,0x3),0x14,'*');}exports[_0x7e6f('0x18')]=function(_0x2955ad,_0x2dc4c9){var _0x22e322={},_0x1c71a4={},_0x57b706={'count':0x0,'rows':[]};var _0x569a9b=_[_0x7e6f('0x19')](db[_0x7e6f('0x1a')][_0x7e6f('0x1b')],function(_0x524d11){return{'name':_0x524d11[_0x7e6f('0x1c')],'type':_0x524d11[_0x7e6f('0x1d')][_0x7e6f('0x1e')]};});_0x1c71a4[_0x7e6f('0x1f')]=_[_0x7e6f('0x19')](_0x569a9b,'name');_0x1c71a4[_0x7e6f('0x20')]=_[_0x7e6f('0x21')](_0x2955ad['query']);_0x1c71a4[_0x7e6f('0x22')]=_[_0x7e6f('0x23')](_0x1c71a4[_0x7e6f('0x1f')],_0x1c71a4[_0x7e6f('0x20')]);_0x22e322['attributes']=_[_0x7e6f('0x23')](_0x1c71a4[_0x7e6f('0x1f')],qs['fields'](_0x2955ad[_0x7e6f('0x20')][_0x7e6f('0x24')]));_0x22e322[_0x7e6f('0x25')]=_0x22e322[_0x7e6f('0x25')][_0x7e6f('0x26')]?_0x22e322[_0x7e6f('0x25')]:_0x1c71a4['model'];if(!_0x2955ad[_0x7e6f('0x20')][_0x7e6f('0x27')](_0x7e6f('0x28'))){_0x22e322[_0x7e6f('0xe')]=qs['limit'](_0x2955ad[_0x7e6f('0x20')]['limit']);_0x22e322[_0x7e6f('0xc')]=qs[_0x7e6f('0xc')](_0x2955ad['query'][_0x7e6f('0xc')]);}_0x22e322['order']=qs[_0x7e6f('0x29')](_0x2955ad[_0x7e6f('0x20')][_0x7e6f('0x29')]);_0x22e322[_0x7e6f('0x2a')]=qs[_0x7e6f('0x22')](_[_0x7e6f('0x2b')](_0x2955ad[_0x7e6f('0x20')],_0x1c71a4[_0x7e6f('0x22')]),_0x569a9b);if(_0x2955ad[_0x7e6f('0x20')]['filter']){_0x22e322[_0x7e6f('0x2a')]=_[_0x7e6f('0x2c')](_0x22e322[_0x7e6f('0x2a')],{'$or':_['map'](_0x569a9b,function(_0x49b0ca){if(_0x49b0ca[_0x7e6f('0x1d')]!==_0x7e6f('0x2d')){var _0x388ec6={};_0x388ec6[_0x49b0ca[_0x7e6f('0x15')]]={'$like':'%'+_0x2955ad[_0x7e6f('0x20')][_0x7e6f('0x2e')]+'%'};return _0x388ec6;}})});}_0x22e322=_[_0x7e6f('0x2c')]({},_0x22e322,_0x2955ad[_0x7e6f('0x2f')]);var _0x40df55={'where':_0x22e322[_0x7e6f('0x2a')]};return db['CloudProvider'][_0x7e6f('0xf')](_0x40df55)[_0x7e6f('0x12')](function(_0x1aa844){_0x57b706[_0x7e6f('0xf')]=_0x1aa844;if(_0x2955ad['query'][_0x7e6f('0x30')]){_0x22e322[_0x7e6f('0x31')]=[{'all':!![]}];}return db[_0x7e6f('0x1a')][_0x7e6f('0x32')](_0x22e322);})[_0x7e6f('0x12')](function(_0x26226d){_0x57b706[_0x7e6f('0x33')]=_[_0x7e6f('0x19')](_0x26226d,function(_0x6cfec4){if(_0x6cfec4[_0x7e6f('0x34')]===_0x7e6f('0x35')){var _0x3e22ee=encryptor['decryptString'](_0x6cfec4[_0x7e6f('0x36')]);_0x6cfec4['data3']=maskClientSecret(_0x3e22ee);}return _0x6cfec4;});return _0x57b706;})[_0x7e6f('0x12')](respondWithFilteredResult(_0x2dc4c9,_0x22e322))[_0x7e6f('0x37')](handleError(_0x2dc4c9,null));};exports[_0x7e6f('0x38')]=function(_0x53028a,_0x390a39){var _0xe06e0e={'raw':!![],'where':{'id':_0x53028a[_0x7e6f('0x39')]['id']}},_0x1be4f3={};_0x1be4f3[_0x7e6f('0x1f')]=_[_0x7e6f('0x21')](db[_0x7e6f('0x1a')][_0x7e6f('0x1b')]);_0x1be4f3['query']=_[_0x7e6f('0x21')](_0x53028a[_0x7e6f('0x20')]);_0x1be4f3[_0x7e6f('0x22')]=_[_0x7e6f('0x23')](_0x1be4f3[_0x7e6f('0x1f')],_0x1be4f3['query']);_0xe06e0e[_0x7e6f('0x25')]=_[_0x7e6f('0x23')](_0x1be4f3[_0x7e6f('0x1f')],qs[_0x7e6f('0x24')](_0x53028a[_0x7e6f('0x20')][_0x7e6f('0x24')]));_0xe06e0e['attributes']=_0xe06e0e[_0x7e6f('0x25')][_0x7e6f('0x26')]?_0xe06e0e[_0x7e6f('0x25')]:_0x1be4f3[_0x7e6f('0x1f')];if(_0x53028a[_0x7e6f('0x20')][_0x7e6f('0x30')]){_0xe06e0e[_0x7e6f('0x31')]=[{'all':!![]}];}_0xe06e0e=_[_0x7e6f('0x2c')]({},_0xe06e0e,_0x53028a['options']);return db['CloudProvider']['find'](_0xe06e0e)[_0x7e6f('0x12')](handleEntityNotFound(_0x390a39,null))[_0x7e6f('0x12')](function(_0x46ec4e){if(_0x46ec4e[_0x7e6f('0x34')]===_0x7e6f('0x35')){var _0x1cdcea=encryptor['decryptString'](_0x46ec4e[_0x7e6f('0x36')]);_0x46ec4e[_0x7e6f('0x36')]=maskClientSecret(_0x1cdcea);}return _0x46ec4e;})[_0x7e6f('0x12')](respondWithResult(_0x390a39,null))[_0x7e6f('0x37')](handleError(_0x390a39,null));};exports[_0x7e6f('0x3a')]=function(_0x2d2649,_0xb32c93){if(!_0x2d2649[_0x7e6f('0x3b')][_0x7e6f('0x15')])throw new Error(_0x7e6f('0x3c'));if(!_0x2d2649[_0x7e6f('0x3b')][_0x7e6f('0x34')])throw new Error(_0x7e6f('0x3d'));var _0x500036=db[_0x7e6f('0x1a')][_0x7e6f('0x1b')][_0x7e6f('0x34')]['values'];if(!_0x500036[_0x7e6f('0x3e')](_0x2d2649[_0x7e6f('0x3b')][_0x7e6f('0x34')]))throw new Error(_0x7e6f('0x3f')+_0x500036['join'](',\x20'));if(_0x2d2649[_0x7e6f('0x3b')]['service']===_0x7e6f('0x35')&&_0x2d2649[_0x7e6f('0x3b')]['data3']){_0x2d2649[_0x7e6f('0x3b')][_0x7e6f('0x36')]=encryptor['encryptString'](_0x2d2649['body'][_0x7e6f('0x36')]);}return db[_0x7e6f('0x1a')][_0x7e6f('0x3a')](_0x2d2649[_0x7e6f('0x3b')],{})[_0x7e6f('0x12')](respondWithResult(_0xb32c93,0xc9))[_0x7e6f('0x37')](handleError(_0xb32c93,null));};exports['update']=function(_0x2fbfaa,_0x5da4f5){if(_0x2fbfaa[_0x7e6f('0x3b')]['id']){delete _0x2fbfaa[_0x7e6f('0x3b')]['id'];}return db['CloudProvider'][_0x7e6f('0x40')]({'where':{'id':_0x2fbfaa[_0x7e6f('0x39')]['id']}})[_0x7e6f('0x12')](handleEntityNotFound(_0x5da4f5,null))[_0x7e6f('0x12')](function(_0x536463){if(_0x536463[_0x7e6f('0x34')]==='MicrosoftAzure'&&_0x2fbfaa[_0x7e6f('0x3b')][_0x7e6f('0x36')]){_0x2fbfaa[_0x7e6f('0x3b')][_0x7e6f('0x36')]=encryptor[_0x7e6f('0x41')](_0x2fbfaa[_0x7e6f('0x3b')][_0x7e6f('0x36')]);}return _0x536463;})[_0x7e6f('0x12')](saveUpdates(_0x2fbfaa['body'],null))[_0x7e6f('0x12')](respondWithResult(_0x5da4f5,null))[_0x7e6f('0x37')](handleError(_0x5da4f5,null));};exports[_0x7e6f('0x42')]=function(_0x584aac,_0x1841f8){return db[_0x7e6f('0x1a')][_0x7e6f('0x40')]({'where':{'id':_0x584aac['params']['id']}})[_0x7e6f('0x12')](handleEntityNotFound(_0x1841f8,null))['then'](removeEntity(_0x1841f8,null))[_0x7e6f('0x37')](handleError(_0x1841f8,null));};exports[_0x7e6f('0x43')]=function(_0xf9e351,_0x13839b){return db[_0x7e6f('0x1a')][_0x7e6f('0x44')]({'where':{'id':_0xf9e351['params']['id']},'raw':!![]})[_0x7e6f('0x12')](function(_0x12aeda){if(!_0x12aeda)return _0x13839b[_0x7e6f('0x45')](0x194);return{'url':oauth[_0x7e6f('0x46')](_0x12aeda,_0xf9e351[_0x7e6f('0x47')]['id'])};})['then'](respondWithResult(_0x13839b,null))[_0x7e6f('0x37')](handleError(_0x13839b,null));};exports[_0x7e6f('0x48')]=function(_0x4d0a6a,_0x3e37ea){var _0x51f96b=_0x4d0a6a[_0x7e6f('0x3b')];var _0x5d37d7;var _0x24549f;if(_0x51f96b[_0x7e6f('0x13')])throw _0x51f96b;redis[_0x7e6f('0x49')](_0x51f96b[_0x7e6f('0x4a')])[_0x7e6f('0x12')](function(_0x3de669){if(!_0x3de669)throw new Error(_0x7e6f('0x4b'));_0x5d37d7=JSON[_0x7e6f('0x4c')](_0x3de669);var _0x2cfad4=Buffer['from'](_0x51f96b[_0x7e6f('0x4a')],_0x7e6f('0x4d'))[_0x7e6f('0x4e')](_0x7e6f('0x4f'));_0x24549f=JSON[_0x7e6f('0x4c')](_0x2cfad4);if(!oauth[_0x7e6f('0x50')](_0x51f96b[_0x7e6f('0x51')],_0x5d37d7[_0x7e6f('0x52')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x51f96b[_0x7e6f('0x4a')]);return oauth[_0x7e6f('0x53')](_0x51f96b[_0x7e6f('0x54')],_0x5d37d7);})[_0x7e6f('0x12')](function(_0x27a5e5){_0x5d37d7[_0x7e6f('0x55')]=_0x27a5e5[_0x7e6f('0x56')];_0x5d37d7['data6']=_0x27a5e5['refresh_token'];return db[_0x7e6f('0x1a')][_0x7e6f('0x11')]({'data5':_0x5d37d7[_0x7e6f('0x55')],'data6':_0x5d37d7['data6']},{'where':{'id':_0x5d37d7['id']}});})[_0x7e6f('0x12')](function(){oauth['startRefreshInterval'](_0x5d37d7);socket[_0x7e6f('0x57')](_0x7e6f('0x58'),{'id':_0x24549f['id']});return;})[_0x7e6f('0x12')](respondWithStatusCode(_0x3e37ea,null))[_0x7e6f('0x37')](function(_0x1263c3){if(_0x24549f){socket[_0x7e6f('0x57')](_0x7e6f('0x59'),{'id':_0x24549f['id']});}if(!_0x5d37d7){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x1263c3);return _0x3e37ea[_0x7e6f('0xa')](0x1f4)[_0x7e6f('0x16')](_0x1263c3['message']);}logger[_0x7e6f('0x13')](_0x7e6f('0x5a'),_0x5d37d7['id'],JSON[_0x7e6f('0x5b')](_0x1263c3));});}; \ No newline at end of file +var _0xc31f=['name','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','service','decryptString','data3','catch','show','params','include','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','data5','data6','refresh_token','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','update','then','error','stack'];(function(_0x3a2c92,_0x409f57){var _0x4433a1=function(_0x410efc){while(--_0x410efc){_0x3a2c92['push'](_0x3a2c92['shift']());}};_0x4433a1(++_0x409f57);}(_0xc31f,0x105));var _0xfc31=function(_0x16a4a8,_0x275cb8){_0x16a4a8=_0x16a4a8-0x0;var _0x319271=_0xc31f[_0x16a4a8];return _0x319271;};'use strict';var _=require(_0xfc31('0x0'));var Redis=require('ioredis');var qs=require(_0xfc31('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xfc31('0x2'))('api');var db=require(_0xfc31('0x3'))['db'];var oauth=require(_0xfc31('0x4'));config[_0xfc31('0x5')]=_[_0xfc31('0x6')](config[_0xfc31('0x5')],{'host':_0xfc31('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc31('0x5')]));var redis=new Redis(config[_0xfc31('0x5')]);function respondWithStatusCode(_0x524c16,_0x20bd3b){_0x20bd3b=_0x20bd3b||0xcc;return function(_0x52d385){if(_0x52d385){return _0x524c16[_0xfc31('0x8')](_0x20bd3b);}return _0x524c16['status'](_0x20bd3b)[_0xfc31('0x9')]();};}function respondWithResult(_0x574621,_0x1d52dd){_0x1d52dd=_0x1d52dd||0xc8;return function(_0x5e82f0){if(_0x5e82f0){return _0x574621[_0xfc31('0xa')](_0x1d52dd)[_0xfc31('0xb')](_0x5e82f0);}};}function respondWithFilteredResult(_0x3a4e9d,_0x1d9479){return function(_0x2abb57){if(_0x2abb57){var _0x56b022=typeof _0x1d9479['offset']===_0xfc31('0xc')&&typeof _0x1d9479[_0xfc31('0xd')]==='undefined';var _0x4598db=_0x2abb57['count'];var _0x1220e2=_0x56b022?0x0:_0x1d9479[_0xfc31('0xe')];var _0x101575=_0x56b022?_0x2abb57['count']:_0x1d9479[_0xfc31('0xe')]+_0x1d9479[_0xfc31('0xd')];var _0x44ba82;if(_0x101575>=_0x4598db){_0x101575=_0x4598db;_0x44ba82=0xc8;}else{_0x44ba82=0xce;}_0x3a4e9d['status'](_0x44ba82);return _0x3a4e9d[_0xfc31('0xf')](_0xfc31('0x10'),_0x1220e2+'-'+_0x101575+'/'+_0x4598db)[_0xfc31('0xb')](_0x2abb57);}return null;};}function saveUpdates(_0x35a670){return function(_0x38b1bb){if(_0x38b1bb){return _0x38b1bb[_0xfc31('0x11')](_0x35a670)[_0xfc31('0x12')](function(_0x4d7511){return _0x4d7511;});}return null;};}function removeEntity(_0x2e5a78){return function(_0x3f7b68){if(_0x3f7b68){return _0x3f7b68['destroy']()[_0xfc31('0x12')](function(){_0x2e5a78[_0xfc31('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9912){return function(_0xff2187){if(!_0xff2187){_0x4f9912['sendStatus'](0x194);}return _0xff2187;};}function handleError(_0x14ba4a,_0x5dee54){_0x5dee54=_0x5dee54||0x1f4;return function(_0x48f908){logger[_0xfc31('0x13')](_0x48f908[_0xfc31('0x14')]);if(_0x48f908[_0xfc31('0x15')]){delete _0x48f908[_0xfc31('0x15')];}_0x14ba4a[_0xfc31('0xa')](_0x5dee54)['send'](_0x48f908);};}function maskClientSecret(_0x4dee06){return _[_0xfc31('0x16')](_0x4dee06[_0xfc31('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x5ac563,_0x524bce){var _0x9cdbf7={},_0x1a3a47={},_0x2d11a1={'count':0x0,'rows':[]};var _0x48a7ed=_[_0xfc31('0x18')](db[_0xfc31('0x19')][_0xfc31('0x1a')],function(_0xdd0ce5){return{'name':_0xdd0ce5[_0xfc31('0x1b')],'type':_0xdd0ce5[_0xfc31('0x1c')]['key']};});_0x1a3a47[_0xfc31('0x1d')]=_[_0xfc31('0x18')](_0x48a7ed,_0xfc31('0x15'));_0x1a3a47[_0xfc31('0x1e')]=_[_0xfc31('0x1f')](_0x5ac563[_0xfc31('0x1e')]);_0x1a3a47[_0xfc31('0x20')]=_['intersection'](_0x1a3a47[_0xfc31('0x1d')],_0x1a3a47[_0xfc31('0x1e')]);_0x9cdbf7[_0xfc31('0x21')]=_[_0xfc31('0x22')](_0x1a3a47['model'],qs[_0xfc31('0x23')](_0x5ac563[_0xfc31('0x1e')][_0xfc31('0x23')]));_0x9cdbf7['attributes']=_0x9cdbf7[_0xfc31('0x21')][_0xfc31('0x24')]?_0x9cdbf7[_0xfc31('0x21')]:_0x1a3a47[_0xfc31('0x1d')];if(!_0x5ac563[_0xfc31('0x1e')][_0xfc31('0x25')](_0xfc31('0x26'))){_0x9cdbf7[_0xfc31('0xd')]=qs[_0xfc31('0xd')](_0x5ac563['query'][_0xfc31('0xd')]);_0x9cdbf7[_0xfc31('0xe')]=qs['offset'](_0x5ac563[_0xfc31('0x1e')]['offset']);}_0x9cdbf7[_0xfc31('0x27')]=qs[_0xfc31('0x28')](_0x5ac563[_0xfc31('0x1e')][_0xfc31('0x28')]);_0x9cdbf7[_0xfc31('0x29')]=qs['filters'](_[_0xfc31('0x2a')](_0x5ac563[_0xfc31('0x1e')],_0x1a3a47[_0xfc31('0x20')]),_0x48a7ed);if(_0x5ac563[_0xfc31('0x1e')]['filter']){_0x9cdbf7[_0xfc31('0x29')]=_['merge'](_0x9cdbf7[_0xfc31('0x29')],{'$or':_[_0xfc31('0x18')](_0x48a7ed,function(_0xe9028c){if(_0xe9028c[_0xfc31('0x1c')]!==_0xfc31('0x2b')){var _0xf0eff0={};_0xf0eff0[_0xe9028c['name']]={'$like':'%'+_0x5ac563['query'][_0xfc31('0x2c')]+'%'};return _0xf0eff0;}})});}_0x9cdbf7=_[_0xfc31('0x2d')]({},_0x9cdbf7,_0x5ac563[_0xfc31('0x2e')]);var _0x238227={'where':_0x9cdbf7['where']};return db[_0xfc31('0x19')][_0xfc31('0x2f')](_0x238227)[_0xfc31('0x12')](function(_0x16c3c6){_0x2d11a1['count']=_0x16c3c6;if(_0x5ac563[_0xfc31('0x1e')][_0xfc31('0x30')]){_0x9cdbf7['include']=[{'all':!![]}];}return db['CloudProvider'][_0xfc31('0x31')](_0x9cdbf7);})[_0xfc31('0x12')](function(_0x4b855b){_0x2d11a1[_0xfc31('0x32')]=_[_0xfc31('0x18')](_0x4b855b,function(_0x3108fd){if(_0x3108fd[_0xfc31('0x33')]==='MicrosoftAzure'){var _0x2af9fd=encryptor[_0xfc31('0x34')](_0x3108fd[_0xfc31('0x35')]);_0x3108fd[_0xfc31('0x35')]=maskClientSecret(_0x2af9fd);}return _0x3108fd;});return _0x2d11a1;})['then'](respondWithFilteredResult(_0x524bce,_0x9cdbf7))[_0xfc31('0x36')](handleError(_0x524bce,null));};exports[_0xfc31('0x37')]=function(_0x2ce943,_0xe8504){var _0xa5cbad={'raw':!![],'where':{'id':_0x2ce943[_0xfc31('0x38')]['id']}},_0x51e57d={};_0x51e57d[_0xfc31('0x1d')]=_['keys'](db[_0xfc31('0x19')]['rawAttributes']);_0x51e57d[_0xfc31('0x1e')]=_[_0xfc31('0x1f')](_0x2ce943['query']);_0x51e57d[_0xfc31('0x20')]=_[_0xfc31('0x22')](_0x51e57d[_0xfc31('0x1d')],_0x51e57d[_0xfc31('0x1e')]);_0xa5cbad[_0xfc31('0x21')]=_[_0xfc31('0x22')](_0x51e57d['model'],qs[_0xfc31('0x23')](_0x2ce943[_0xfc31('0x1e')][_0xfc31('0x23')]));_0xa5cbad[_0xfc31('0x21')]=_0xa5cbad[_0xfc31('0x21')][_0xfc31('0x24')]?_0xa5cbad[_0xfc31('0x21')]:_0x51e57d[_0xfc31('0x1d')];if(_0x2ce943[_0xfc31('0x1e')][_0xfc31('0x30')]){_0xa5cbad[_0xfc31('0x39')]=[{'all':!![]}];}_0xa5cbad=_['merge']({},_0xa5cbad,_0x2ce943['options']);return db[_0xfc31('0x19')][_0xfc31('0x3a')](_0xa5cbad)[_0xfc31('0x12')](handleEntityNotFound(_0xe8504,null))[_0xfc31('0x12')](function(_0x22de38){if(_0x22de38[_0xfc31('0x33')]===_0xfc31('0x3b')){var _0x5437d4=encryptor[_0xfc31('0x34')](_0x22de38['data3']);_0x22de38['data3']=maskClientSecret(_0x5437d4);}return _0x22de38;})[_0xfc31('0x12')](respondWithResult(_0xe8504,null))[_0xfc31('0x36')](handleError(_0xe8504,null));};exports[_0xfc31('0x3c')]=function(_0x2bb395,_0x21834d){if(!_0x2bb395[_0xfc31('0x3d')]['name'])throw new Error(_0xfc31('0x3e'));if(!_0x2bb395['body'][_0xfc31('0x33')])throw new Error(_0xfc31('0x3f'));var _0x5efdea=db[_0xfc31('0x19')][_0xfc31('0x1a')][_0xfc31('0x33')][_0xfc31('0x40')];if(!_0x5efdea['includes'](_0x2bb395[_0xfc31('0x3d')][_0xfc31('0x33')]))throw new Error(_0xfc31('0x41')+_0x5efdea[_0xfc31('0x42')](',\x20'));if(_0x2bb395['body'][_0xfc31('0x33')]===_0xfc31('0x3b')&&_0x2bb395[_0xfc31('0x3d')]['data3']){_0x2bb395[_0xfc31('0x3d')]['data3']=encryptor['encryptString'](_0x2bb395[_0xfc31('0x3d')][_0xfc31('0x35')]);}return db[_0xfc31('0x19')][_0xfc31('0x3c')](_0x2bb395[_0xfc31('0x3d')],{})['then'](respondWithResult(_0x21834d,0xc9))[_0xfc31('0x36')](handleError(_0x21834d,null));};exports[_0xfc31('0x11')]=function(_0x5b07c2,_0x54d8dc){if(_0x5b07c2[_0xfc31('0x3d')]['id']){delete _0x5b07c2[_0xfc31('0x3d')]['id'];}return db[_0xfc31('0x19')][_0xfc31('0x3a')]({'where':{'id':_0x5b07c2[_0xfc31('0x38')]['id']}})[_0xfc31('0x12')](handleEntityNotFound(_0x54d8dc,null))[_0xfc31('0x12')](function(_0x40fcec){if(_0x40fcec[_0xfc31('0x33')]===_0xfc31('0x3b')&&_0x5b07c2[_0xfc31('0x3d')][_0xfc31('0x35')]){_0x5b07c2[_0xfc31('0x3d')][_0xfc31('0x35')]=encryptor[_0xfc31('0x43')](_0x5b07c2['body'][_0xfc31('0x35')]);}return _0x40fcec;})['then'](saveUpdates(_0x5b07c2[_0xfc31('0x3d')],null))[_0xfc31('0x12')](respondWithResult(_0x54d8dc,null))[_0xfc31('0x36')](handleError(_0x54d8dc,null));};exports[_0xfc31('0x44')]=function(_0x57cf8e,_0x26b1f4){return db[_0xfc31('0x19')][_0xfc31('0x3a')]({'where':{'id':_0x57cf8e[_0xfc31('0x38')]['id']}})[_0xfc31('0x12')](handleEntityNotFound(_0x26b1f4,null))['then'](removeEntity(_0x26b1f4,null))[_0xfc31('0x36')](handleError(_0x26b1f4,null));};exports[_0xfc31('0x45')]=function(_0x282e5a,_0x3552e1){return db[_0xfc31('0x19')][_0xfc31('0x46')]({'where':{'id':_0x282e5a[_0xfc31('0x38')]['id']},'raw':!![]})[_0xfc31('0x12')](function(_0xf12c22){if(!_0xf12c22)return _0x3552e1[_0xfc31('0x8')](0x194);return{'url':oauth[_0xfc31('0x47')](_0xf12c22,_0x282e5a[_0xfc31('0x48')]['id'])};})[_0xfc31('0x12')](respondWithResult(_0x3552e1,null))[_0xfc31('0x36')](handleError(_0x3552e1,null));};exports[_0xfc31('0x49')]=function(_0x3047aa,_0x660dea){var _0x246d7d=_0x3047aa[_0xfc31('0x3d')];var _0x58190a;var _0x416c02;if(_0x246d7d[_0xfc31('0x13')])throw _0x246d7d;redis[_0xfc31('0x4a')](_0x246d7d[_0xfc31('0x4b')])[_0xfc31('0x12')](function(_0x1f0c5a){if(!_0x1f0c5a)throw new Error(_0xfc31('0x4c'));_0x58190a=JSON[_0xfc31('0x4d')](_0x1f0c5a);var _0x206811=Buffer[_0xfc31('0x4e')](_0x246d7d[_0xfc31('0x4b')],_0xfc31('0x4f'))[_0xfc31('0x50')](_0xfc31('0x51'));_0x416c02=JSON[_0xfc31('0x4d')](_0x206811);if(!oauth[_0xfc31('0x52')](_0x246d7d[_0xfc31('0x53')],_0x58190a['oauth2Claims']))throw new Error(_0xfc31('0x54'));redis[_0xfc31('0x55')](_0x246d7d[_0xfc31('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x246d7d['code'],_0x58190a);})[_0xfc31('0x12')](function(_0x13781f){_0x58190a[_0xfc31('0x56')]=_0x13781f['access_token'];_0x58190a[_0xfc31('0x57')]=_0x13781f[_0xfc31('0x58')];return db[_0xfc31('0x19')][_0xfc31('0x11')]({'data5':_0x58190a[_0xfc31('0x56')],'data6':_0x58190a[_0xfc31('0x57')]},{'where':{'id':_0x58190a['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x58190a);socket[_0xfc31('0x59')]('microsoftAuthorization:success',{'id':_0x416c02['id']});return;})[_0xfc31('0x12')](respondWithStatusCode(_0x660dea,null))['catch'](function(_0x384bfc){if(_0x416c02){socket[_0xfc31('0x59')](_0xfc31('0x5a'),{'id':_0x416c02['id']});}if(!_0x58190a){logger[_0xfc31('0x13')](_0xfc31('0x5b'),_0x384bfc);return _0x660dea[_0xfc31('0xa')](0x1f4)['send'](_0x384bfc['message']);}logger[_0xfc31('0x13')](_0xfc31('0x5c'),_0x58190a['id'],JSON[_0xfc31('0x5d')](_0x384bfc));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 20b502e..91f7e3a 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 _0xe725=['CloudProvider','lodash','util','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xe725,0x109));var _0x5e72=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe725[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5e72('0x0'));var util=require(_0x5e72('0x1'));var logger=require('../../config/logger')(_0x5e72('0x2'));var moment=require(_0x5e72('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e72('0x4'));var fs=require('fs');var path=require(_0x5e72('0x5'));var rimraf=require('rimraf');var config=require(_0x5e72('0x6'));var attributes=require(_0x5e72('0x7'));module[_0x5e72('0x8')]=function(_0x13b5aa,_0x2a4726){return _0x13b5aa[_0x5e72('0x9')](_0x5e72('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51dc=['CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x6c77bb,_0xa00580){var _0x3932f7=function(_0x12e066){while(--_0x12e066){_0x6c77bb['push'](_0x6c77bb['shift']());}};_0x3932f7(++_0xa00580);}(_0x51dc,0x1af));var _0xc51d=function(_0x129d3b,_0x4f181a){_0x129d3b=_0x129d3b-0x0;var _0x35281d=_0x51dc[_0x129d3b];return _0x35281d;};'use strict';var _=require(_0xc51d('0x0'));var util=require('util');var logger=require(_0xc51d('0x1'))(_0xc51d('0x2'));var moment=require(_0xc51d('0x3'));var BPromise=require(_0xc51d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc51d('0x5'));var rimraf=require(_0xc51d('0x6'));var config=require(_0xc51d('0x7'));var attributes=require(_0xc51d('0x8'));module['exports']=function(_0x28f889,_0x53fd3c){return _0x28f889['define'](_0xc51d('0x9'),attributes,{'tableName':_0xc51d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 241a310..52b929b 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b58=['exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','Outlook365','{TENANT_ID}','data2','code','stringify','base64','randomBytes','toString','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','key','value','replace','set','decode','payload','issuer','audience','nonce','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s'];(function(_0xe54f75,_0x55f6b3){var _0x2953e6=function(_0x2b62ca){while(--_0x2b62ca){_0xe54f75['push'](_0xe54f75['shift']());}};_0x2953e6(++_0x55f6b3);}(_0x1b58,0x9b));var _0x81b5=function(_0x24ede2,_0x21e9a4){_0x24ede2=_0x24ede2-0x0;var _0x51ec40=_0x1b58[_0x24ede2];return _0x51ec40;};'use strict';var _=require(_0x81b5('0x0'));var crypto=require(_0x81b5('0x1'));var jwt=require(_0x81b5('0x2'));var moment=require(_0x81b5('0x3'));var Redis=require('ioredis');var rp=require(_0x81b5('0x4'));var util=require(_0x81b5('0x5'));var encryptor=require(_0x81b5('0x6'));var config=require(_0x81b5('0x7'));var logger=require(_0x81b5('0x8'))(_0x81b5('0x9'));var schedule=require(_0x81b5('0xa'));var db=require(_0x81b5('0xb'))['db'];config[_0x81b5('0xc')]=_[_0x81b5('0xd')](config['redis'],{'host':_0x81b5('0xe'),'port':0x18eb});var redis=new Redis(config[_0x81b5('0xc')]);var MICROSOFT_AUTH_URL=_0x81b5('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x81b5('0x10'),_0x81b5('0x11'),'email','offline_access',_0x81b5('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x81b5('0x13')],'Dynamics365':[_0x81b5('0x10'),_0x81b5('0x14')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x81b5('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x47593c){var _0x3e4526=_[_0x81b5('0x16')](AZURE_AUTH_SCOPES[_0x47593c[_0x81b5('0x17')]]);if(_0x47593c[_0x81b5('0x17')]===_0x81b5('0x18'))_0x3e4526[_0x81b5('0x19')](_0x47593c[_0x81b5('0x1a')]+_0x81b5('0x1b'));return _0x3e4526['join']('\x20');}function getAccessTokenScope(_0x2f082c){if(_0x2f082c[_0x81b5('0x17')]===_0x81b5('0x1c'))return _0x81b5('0x12');if(_0x2f082c[_0x81b5('0x17')]===_0x81b5('0x18'))return _0x2f082c['data7']+_0x81b5('0x1b');}function generateMicrosoftAuthorizationUrl(_0x492497,_0x5e74be){var _0x5b3b16=MICROSOFT_AUTH_URL['replace'](_0x81b5('0x1d'),_0x492497[_0x81b5('0x1e')]);var _0x4eb3fc=[_0x81b5('0x1f'),'id_token'];var _0x18b53a=Buffer['from'](JSON[_0x81b5('0x20')]({'id':_0x5e74be}))['toString'](_0x81b5('0x21'));var _0x2ec858=crypto[_0x81b5('0x22')](0x10)[_0x81b5('0x23')]('hex');var _0xbc794d=getAuthorizationScopes(_0x492497);var _0x3f17d6=[{'key':'client_id','value':_0x492497[_0x81b5('0x24')]},{'key':_0x81b5('0x25'),'value':encodeURIComponent(_0x4eb3fc[_0x81b5('0x26')]('\x20'))},{'key':_0x81b5('0x27'),'value':_0x492497[_0x81b5('0x28')]},{'key':_0x81b5('0x29'),'value':_0x81b5('0x2a')},{'key':_0x81b5('0x2b'),'value':encodeURIComponent(_0xbc794d)},{'key':_0x81b5('0x2c'),'value':_0x18b53a},{'key':'nonce','value':_0x2ec858},{'key':_0x81b5('0x2d'),'value':_0x81b5('0x2e')}];var _0x2b4b7d=_0x5b3b16+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x81b5('0x16')](_0x3f17d6,function(_0x583d0b){return _0x583d0b[_0x81b5('0x2f')]+'='+_0x583d0b[_0x81b5('0x30')];})[_0x81b5('0x26')]('&');_0x492497['oauth2Claims']={'issuer':_0x5b3b16[_0x81b5('0x31')]('oauth2/',''),'audience':_0x492497['data1'],'state':_0x18b53a,'nonce':_0x2ec858};redis[_0x81b5('0x32')](_0x18b53a,JSON[_0x81b5('0x20')](_0x492497));return _0x2b4b7d;}function isValidIdToken(_0x1a5728,_0x55e714){try{var _0x3314c6=jwt[_0x81b5('0x33')](_0x1a5728,{'complete':!![]});var _0x2fad91=_0x3314c6[_0x81b5('0x34')];if(_0x2fad91['iss']!==_0x55e714[_0x81b5('0x35')])return![];if(_0x2fad91['aud']!==_0x55e714[_0x81b5('0x36')])return![];if(_0x2fad91['nonce']!==_0x55e714[_0x81b5('0x37')])return![];if(moment()['isAfter'](moment[_0x81b5('0x38')](_0x2fad91['exp'])))return![];return!![];}catch(_0x3c5285){throw _0x3c5285;}}function refreshOauth2MicrosoftAccessToken(_0x4700a2){return Promise[_0x81b5('0x39')]()[_0x81b5('0x3a')](function(){if(_0x4700a2[_0x81b5('0x3b')])return _0x4700a2;return db[_0x81b5('0x3c')][_0x81b5('0x3d')]({'where':{'id':_0x4700a2['id']},'raw':!![]});})[_0x81b5('0x3a')](function(_0x4b5442){var _0x2cdce6={'grant_type':_0x81b5('0x3e'),'refresh_token':_0x4b5442[_0x81b5('0x3f')],'scope':getAccessTokenScope(_0x4b5442),'redirect_uri':_0x4b5442[_0x81b5('0x28')],'client_id':_0x4b5442[_0x81b5('0x24')],'client_secret':encryptor[_0x81b5('0x40')](_0x4b5442[_0x81b5('0x3b')])};var _0x5923e1={'method':_0x81b5('0x41'),'uri':MICROSOFT_AUTH_URL[_0x81b5('0x31')](_0x81b5('0x1d'),_0x4b5442[_0x81b5('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2cdce6,'json':!![]};return rp(_0x5923e1);})[_0x81b5('0x3a')](function(_0x502f19){_0x4700a2[_0x81b5('0x42')]=_0x502f19['access_token'];_0x4700a2[_0x81b5('0x3f')]=_0x502f19[_0x81b5('0x3e')];return db[_0x81b5('0x3c')]['update']({'data5':_0x4700a2['data5'],'data6':_0x4700a2[_0x81b5('0x3f')]},{'where':{'id':_0x4700a2['id']}});})['then'](function(){return _0x4700a2;})['catch'](function(_0x3c29b3){logger['error'](_0x81b5('0x43'),_0x4700a2['id'],_0x3c29b3);});}function getOauth2MicrosoftAccessToken(_0x47bb87,_0x267199){var _0x3ce1ad={'grant_type':_0x81b5('0x44'),'code':_0x47bb87,'scope':getAccessTokenScope(_0x267199),'redirect_uri':_0x267199[_0x81b5('0x28')],'client_id':_0x267199[_0x81b5('0x24')],'client_secret':encryptor[_0x81b5('0x40')](_0x267199['data3'])};var _0x3081d1={'method':_0x81b5('0x41'),'uri':MICROSOFT_AUTH_URL[_0x81b5('0x31')](_0x81b5('0x1d'),_0x267199[_0x81b5('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ce1ad,'json':!![]};return rp(_0x3081d1);}function startRefreshInterval(_0x36bf01){var _0x30c4e8=schedule[_0x81b5('0x45')];if(_0x30c4e8[_0x36bf01['id']])clearInterval(_0x30c4e8[_0x36bf01['id']]);_0x30c4e8[_0x36bf01['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x81b5('0x46')](this,{'id':_0x36bf01['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x81b5('0x45')]=_0x30c4e8;}function startAllRefreshIntervals(){return db[_0x81b5('0x3c')][_0x81b5('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0xc590fa){var _0x45d1e2=_0xc590fa[_0x81b5('0x16')](function(_0x306645){return refreshOauth2MicrosoftAccessToken(_0x306645)[_0x81b5('0x3a')](function(_0x4c440e){startRefreshInterval(_0x4c440e);});});return Promise['all'](_0x45d1e2);})[_0x81b5('0x48')](function(_0x1ccd5e){var _0x2cef1e=_0x1ccd5e?util[_0x81b5('0x49')](_0x1ccd5e,{'showHidden':![],'depth':null}):'';logger[_0x81b5('0x4a')](_0x81b5('0x4b'),_0x2cef1e);});}module[_0x81b5('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x67b7=['resolve','then','data3','CloudProvider','findOne','data6','data4','POST','access_token','refresh_token','update','data5','catch','error','authorization_code','decryptString','intervals','bind','findAll','all','inspect','exports','lodash','crypto','jsonwebtoken','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/token','map','type','push','join','Outlook365','Dynamics365','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','client_id','data1','response_type','form_post','state','nonce','key','oauth2/','set','decode','payload','issuer','aud','audience','exp'];(function(_0x4eb00b,_0x22adaf){var _0x2dd4bf=function(_0x5e3d6e){while(--_0x5e3d6e){_0x4eb00b['push'](_0x4eb00b['shift']());}};_0x2dd4bf(++_0x22adaf);}(_0x67b7,0x136));var _0x767b=function(_0x479744,_0x1c7d54){_0x479744=_0x479744-0x0;var _0x1f33ae=_0x67b7[_0x479744];return _0x1f33ae;};'use strict';var _=require(_0x767b('0x0'));var crypto=require(_0x767b('0x1'));var jwt=require(_0x767b('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x767b('0x3'));var util=require(_0x767b('0x4'));var encryptor=require(_0x767b('0x5'));var config=require(_0x767b('0x6'));var logger=require(_0x767b('0x7'))('api');var schedule=require(_0x767b('0x8'));var db=require('../../mysqldb')['db'];config[_0x767b('0x9')]=_[_0x767b('0xa')](config[_0x767b('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x767b('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x767b('0xc'),_0x767b('0xd'),_0x767b('0xe'),_0x767b('0xf'),_0x767b('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x767b('0x11'),_0x767b('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x767b('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x299999){var _0x5b86bc=_[_0x767b('0x13')](AZURE_AUTH_SCOPES[_0x299999[_0x767b('0x14')]]);if(_0x299999['type']==='Dynamics365')_0x5b86bc[_0x767b('0x15')](_0x299999['data7']+'/.default');return _0x5b86bc[_0x767b('0x16')]('\x20');}function getAccessTokenScope(_0x54be58){if(_0x54be58[_0x767b('0x14')]===_0x767b('0x17'))return _0x767b('0xf');if(_0x54be58[_0x767b('0x14')]===_0x767b('0x18'))return _0x54be58[_0x767b('0x19')]+_0x767b('0x1a');}function generateMicrosoftAuthorizationUrl(_0x3fe469,_0x28113d){var _0x544349=MICROSOFT_AUTH_URL[_0x767b('0x1b')](_0x767b('0x1c'),_0x3fe469[_0x767b('0x1d')]);var _0x36d169=[_0x767b('0x1e'),_0x767b('0x1f')];var _0x41c90a=Buffer[_0x767b('0x20')](JSON[_0x767b('0x21')]({'id':_0x28113d}))['toString']('base64');var _0x3a6c54=crypto[_0x767b('0x22')](0x10)['toString']('hex');var _0x2e98d2=getAuthorizationScopes(_0x3fe469);var _0x198c6c=[{'key':_0x767b('0x23'),'value':_0x3fe469[_0x767b('0x24')]},{'key':_0x767b('0x25'),'value':encodeURIComponent(_0x36d169['join']('\x20'))},{'key':'redirect_uri','value':_0x3fe469['data4']},{'key':'response_mode','value':_0x767b('0x26')},{'key':'scope','value':encodeURIComponent(_0x2e98d2)},{'key':_0x767b('0x27'),'value':_0x41c90a},{'key':_0x767b('0x28'),'value':_0x3a6c54},{'key':'prompt','value':'login'}];var _0x19416b=_0x544349+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x767b('0x13')](_0x198c6c,function(_0x145080){return _0x145080[_0x767b('0x29')]+'='+_0x145080['value'];})[_0x767b('0x16')]('&');_0x3fe469['oauth2Claims']={'issuer':_0x544349[_0x767b('0x1b')](_0x767b('0x2a'),''),'audience':_0x3fe469[_0x767b('0x24')],'state':_0x41c90a,'nonce':_0x3a6c54};redis[_0x767b('0x2b')](_0x41c90a,JSON[_0x767b('0x21')](_0x3fe469));return _0x19416b;}function isValidIdToken(_0x43726c,_0xa9fd98){try{var _0x465ec4=jwt[_0x767b('0x2c')](_0x43726c,{'complete':!![]});var _0x564abb=_0x465ec4[_0x767b('0x2d')];if(_0x564abb['iss']!==_0xa9fd98[_0x767b('0x2e')])return![];if(_0x564abb[_0x767b('0x2f')]!==_0xa9fd98[_0x767b('0x30')])return![];if(_0x564abb['nonce']!==_0xa9fd98[_0x767b('0x28')])return![];if(moment()['isAfter'](moment['unix'](_0x564abb[_0x767b('0x31')])))return![];return!![];}catch(_0x24ce80){throw _0x24ce80;}}function refreshOauth2MicrosoftAccessToken(_0xcd83e0){return Promise[_0x767b('0x32')]()[_0x767b('0x33')](function(){if(_0xcd83e0[_0x767b('0x34')])return _0xcd83e0;return db[_0x767b('0x35')][_0x767b('0x36')]({'where':{'id':_0xcd83e0['id']},'raw':!![]});})[_0x767b('0x33')](function(_0x2af5ae){var _0x6ffb34={'grant_type':'refresh_token','refresh_token':_0x2af5ae[_0x767b('0x37')],'scope':getAccessTokenScope(_0x2af5ae),'redirect_uri':_0x2af5ae[_0x767b('0x38')],'client_id':_0x2af5ae[_0x767b('0x24')],'client_secret':encryptor['decryptString'](_0x2af5ae[_0x767b('0x34')])};var _0x6515b5={'method':_0x767b('0x39'),'uri':MICROSOFT_AUTH_URL['replace'](_0x767b('0x1c'),_0x2af5ae[_0x767b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6ffb34,'json':!![]};return rp(_0x6515b5);})[_0x767b('0x33')](function(_0x297fdc){_0xcd83e0['data5']=_0x297fdc[_0x767b('0x3a')];_0xcd83e0[_0x767b('0x37')]=_0x297fdc[_0x767b('0x3b')];return db[_0x767b('0x35')][_0x767b('0x3c')]({'data5':_0xcd83e0[_0x767b('0x3d')],'data6':_0xcd83e0[_0x767b('0x37')]},{'where':{'id':_0xcd83e0['id']}});})['then'](function(){return _0xcd83e0;})[_0x767b('0x3e')](function(_0x7fcd3d){logger[_0x767b('0x3f')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xcd83e0['id'],_0x7fcd3d);});}function getOauth2MicrosoftAccessToken(_0x2f38ae,_0x998404){var _0x1a7f17={'grant_type':_0x767b('0x40'),'code':_0x2f38ae,'scope':getAccessTokenScope(_0x998404),'redirect_uri':_0x998404[_0x767b('0x38')],'client_id':_0x998404[_0x767b('0x24')],'client_secret':encryptor[_0x767b('0x41')](_0x998404[_0x767b('0x34')])};var _0x443047={'method':_0x767b('0x39'),'uri':MICROSOFT_AUTH_URL[_0x767b('0x1b')](_0x767b('0x1c'),_0x998404['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a7f17,'json':!![]};return rp(_0x443047);}function startRefreshInterval(_0x4f67d1){var _0xb000c7=schedule[_0x767b('0x42')];if(_0xb000c7[_0x4f67d1['id']])clearInterval(_0xb000c7[_0x4f67d1['id']]);_0xb000c7[_0x4f67d1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x767b('0x43')](this,{'id':_0x4f67d1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x767b('0x42')]=_0xb000c7;}function startAllRefreshIntervals(){return db[_0x767b('0x35')][_0x767b('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x767b('0x33')](function(_0x203aa8){var _0x22f707=_0x203aa8['map'](function(_0x234c99){return refreshOauth2MicrosoftAccessToken(_0x234c99)[_0x767b('0x33')](function(_0xe7b633){startRefreshInterval(_0xe7b633);});});return Promise[_0x767b('0x45')](_0x22f707);})[_0x767b('0x3e')](function(_0x2a0b69){var _0x4d55df=_0x2a0b69?util[_0x767b('0x46')](_0x2a0b69,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4d55df);});}module[_0x767b('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index aa2504f..78a55e4 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 _0x7880=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x2d1fe6,_0x34d8d5){var _0x454ad7=function(_0x432567){while(--_0x432567){_0x2d1fe6['push'](_0x2d1fe6['shift']());}};_0x454ad7(++_0x34d8d5);}(_0x7880,0x10f));var _0x0788=function(_0x4a26e7,_0x232272){_0x4a26e7=_0x4a26e7-0x0;var _0x13c81b=_0x7880[_0x4a26e7];return _0x13c81b;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0788('0x6'));var config=require('../../config/environment');var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x14cfa5,_0x450b71){return new BPromise(function(_0x5366c7,_0x1662a2){return client[_0x0788('0xa')](_0x5ece1c,_0x450b71)[_0x0788('0xb')](function(_0x95ebe3){logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x14cfa5,_0x0788('0xe'),JSON[_0x0788('0x11')](_0x95ebe3));if(_0x95ebe3['error']){if(_0x95ebe3[_0x0788('0x12')]['code']===0x1f4){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x95ebe3[_0x0788('0x12')][_0x0788('0x13')]);return _0x1662a2(_0x95ebe3[_0x0788('0x12')]['message']);}logger[_0x0788('0x12')]('CloudProvider,\x20%s,\x20%s',_0x14cfa5,_0x95ebe3[_0x0788('0x12')]['message']);return _0x5366c7(_0x95ebe3['error'][_0x0788('0x13')]);}else{logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,'request\x20sent');_0x5366c7(_0x95ebe3[_0x0788('0x14')][_0x0788('0x13')]);}})['catch'](function(_0x334f58){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x334f58);_0x1662a2(_0x334f58);});});} \ No newline at end of file +var _0x7c71=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x1b704b,_0x51747d){var _0x7ebffa=function(_0x13b16c){while(--_0x13b16c){_0x1b704b['push'](_0x1b704b['shift']());}};_0x7ebffa(++_0x51747d);}(_0x7c71,0x177));var _0x17c7=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x7c71[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c061b,_0xf284a2,_0x1ff4ec){return new BPromise(function(_0x50feb0,_0x13fdad){return client[_0x17c7('0xb')](_0x3c061b,_0x1ff4ec)[_0x17c7('0xc')](function(_0xdb3575){logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));logger[_0x17c7('0x10')](_0x17c7('0x11'),_0xf284a2,_0x17c7('0xf'),JSON['stringify'](_0xdb3575));if(_0xdb3575['error']){if(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x13')]===0x1f4){logger['error'](_0x17c7('0xe'),_0xf284a2,_0xdb3575[_0x17c7('0x12')]['message']);return _0x13fdad(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf284a2,_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);return _0x50feb0(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}else{logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));_0x50feb0(_0xdb3575[_0x17c7('0x15')][_0x17c7('0x14')]);}})[_0x17c7('0x16')](function(_0x296f9c){logger[_0x17c7('0x12')]('CloudProvider,\x20%s,\x20%s',_0xf284a2,_0x296f9c);_0x13fdad(_0x296f9c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 58389c9..5a2d14e 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x1a22df,_0x2d30b7){var _0x3ff5a6=function(_0x4f17f8){while(--_0x4f17f8){_0x1a22df['push'](_0x1a22df['shift']());}};_0x3ff5a6(++_0x2d30b7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x1261,0x144));var _0x1126=function(_0x3fa1c7,_0x13d816){_0x3fa1c7=_0x3fa1c7-0x0;var _0x21e45d=_0x1261[_0x3fa1c7];return _0x21e45d;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index db0816f..30a0d47 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 _0x2159=['exports','STRING','name','sequelize'];(function(_0x56d8e1,_0x35a5d0){var _0x111567=function(_0x318669){while(--_0x318669){_0x56d8e1['push'](_0x56d8e1['shift']());}};_0x111567(++_0x35a5d0);}(_0x2159,0x17f));var _0x9215=function(_0x17f7d8,_0x549112){_0x17f7d8=_0x17f7d8-0x0;var _0x2c5198=_0x2159[_0x17f7d8];return _0x2c5198;};'use strict';var Sequelize=require(_0x9215('0x0'));module[_0x9215('0x1')]={'name':{'type':Sequelize[_0x9215('0x2')],'unique':_0x9215('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9215('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9215('0x2')]},'fax':{'type':Sequelize[_0x9215('0x2')]},'type':{'type':Sequelize[_0x9215('0x2')]},'street':{'type':Sequelize[_0x9215('0x2')]},'postalCode':{'type':Sequelize[_0x9215('0x2')]},'city':{'type':Sequelize[_0x9215('0x2')]},'country':{'type':Sequelize[_0x9215('0x2')]},'email':{'type':Sequelize[_0x9215('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x9215('0x2')]},'sPostalCode':{'type':Sequelize[_0x9215('0x2')]},'sCity':{'type':Sequelize[_0x9215('0x2')]},'sCountry':{'type':Sequelize[_0x9215('0x2')]},'description':{'type':Sequelize[_0x9215('0x2')]}}; \ No newline at end of file +var _0x7bbd=['sequelize','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bbd,0x12c));var _0xd7bb=function(_0x5ce195,_0x12511b){_0x5ce195=_0x5ce195-0x0;var _0x53d780=_0x7bbd[_0x5ce195];return _0x53d780;};'use strict';var Sequelize=require(_0xd7bb('0x0'));module['exports']={'name':{'type':Sequelize[_0xd7bb('0x1')],'unique':_0xd7bb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd7bb('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xd7bb('0x1')]},'phone':{'type':Sequelize[_0xd7bb('0x1')]},'fax':{'type':Sequelize[_0xd7bb('0x1')]},'type':{'type':Sequelize[_0xd7bb('0x1')]},'street':{'type':Sequelize[_0xd7bb('0x1')]},'postalCode':{'type':Sequelize[_0xd7bb('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd7bb('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd7bb('0x1')]},'sStreet':{'type':Sequelize[_0xd7bb('0x1')]},'sPostalCode':{'type':Sequelize[_0xd7bb('0x1')]},'sCity':{'type':Sequelize[_0xd7bb('0x1')]},'sCountry':{'type':Sequelize[_0xd7bb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2f85c2e..58f7d4e 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 _0x7f85=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','destroy','Companies','UserProfileResource','then','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','merge','findAll','catch','show','rawAttributes','length','include','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','update','params','addContacts','CmContact','ids','omit','getContacts','order','sort','filter','options','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis'];(function(_0x5e9b49,_0x4cf97d){var _0x3b8bac=function(_0x2a5a1e){while(--_0x2a5a1e){_0x5e9b49['push'](_0x5e9b49['shift']());}};_0x3b8bac(++_0x4cf97d);}(_0x7f85,0x188));var _0x57f8=function(_0x5c225c,_0x5b0b1f){_0x5c225c=_0x5c225c-0x0;var _0x1668e7=_0x7f85[_0x5c225c];return _0x1668e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57f8('0x0'));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(_0x57f8('0x1'));var util=require(_0x57f8('0x2'));var path=require(_0x57f8('0x3'));var sox=require(_0x57f8('0x4'));var csv=require(_0x57f8('0x5'));var ejs=require(_0x57f8('0x6'));var fs=require('fs');var fs_extra=require(_0x57f8('0x7'));var _=require(_0x57f8('0x8'));var squel=require('squel');var crypto=require(_0x57f8('0x9'));var jsforce=require(_0x57f8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x57f8('0x5'));var querystring=require('querystring');var Papa=require(_0x57f8('0xb'));var Redis=require(_0x57f8('0xc'));var authService=require(_0x57f8('0xd'));var qs=require(_0x57f8('0xe'));var as=require(_0x57f8('0xf'));var hardwareService=require(_0x57f8('0x10'));var logger=require(_0x57f8('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x57f8('0x12'));var licenseUtil=require(_0x57f8('0x13'));var db=require(_0x57f8('0x14'))['db'];function respondWithStatusCode(_0x4867ee,_0x2ea63e){_0x2ea63e=_0x2ea63e||0xcc;return function(_0x3833d7){if(_0x3833d7){return _0x4867ee[_0x57f8('0x15')](_0x2ea63e);}return _0x4867ee['status'](_0x2ea63e)[_0x57f8('0x16')]();};}function respondWithResult(_0x58181a,_0x508f7d){_0x508f7d=_0x508f7d||0xc8;return function(_0x9d0917){if(_0x9d0917){return _0x58181a[_0x57f8('0x17')](_0x508f7d)[_0x57f8('0x18')](_0x9d0917);}};}function respondWithFilteredResult(_0x4e9c1d,_0x2fd9be){return function(_0x16d552){if(_0x16d552){var _0x321065=typeof _0x2fd9be[_0x57f8('0x19')]===_0x57f8('0x1a')&&typeof _0x2fd9be['limit']===_0x57f8('0x1a');var _0x525966=_0x16d552['count'];var _0x4a3c40=_0x321065?0x0:_0x2fd9be[_0x57f8('0x19')];var _0x53fb49=_0x321065?_0x16d552[_0x57f8('0x1b')]:_0x2fd9be[_0x57f8('0x19')]+_0x2fd9be[_0x57f8('0x1c')];var _0x2f53f4;if(_0x53fb49>=_0x525966){_0x53fb49=_0x525966;_0x2f53f4=0xc8;}else{_0x2f53f4=0xce;}_0x4e9c1d[_0x57f8('0x17')](_0x2f53f4);return _0x4e9c1d['set'](_0x57f8('0x1d'),_0x4a3c40+'-'+_0x53fb49+'/'+_0x525966)[_0x57f8('0x18')](_0x16d552);}return null;};}function patchUpdates(_0x1e9796){return function(_0x229ac0){try{jsonpatch['apply'](_0x229ac0,_0x1e9796,!![]);}catch(_0x26632c){return BPromise[_0x57f8('0x1e')](_0x26632c);}return _0x229ac0['save']();};}function saveUpdates(_0x4d6e1e,_0x5348ee){return function(_0x101f74){if(_0x101f74){return _0x101f74['update'](_0x4d6e1e)['then'](function(_0x5f34a5){return _0x5f34a5;});}return null;};}function removeEntity(_0x4bf1f8,_0x39132b){return function(_0x6ca6a1){if(_0x6ca6a1){return _0x6ca6a1[_0x57f8('0x1f')]()['then'](function(){var _0x4b02a1=_0x6ca6a1['get']({'plain':!![]});var _0x414a24=_0x57f8('0x20');return db[_0x57f8('0x21')][_0x57f8('0x1f')]({'where':{'type':_0x414a24,'resourceId':_0x4b02a1['id']}})[_0x57f8('0x22')](function(){return _0x6ca6a1;});})[_0x57f8('0x22')](function(){_0x4bf1f8[_0x57f8('0x17')](0xcc)[_0x57f8('0x16')]();});}};}function handleEntityNotFound(_0x599e69,_0x40b2ca){return function(_0x1b44ba){if(!_0x1b44ba){_0x599e69[_0x57f8('0x15')](0x194);}return _0x1b44ba;};}function handleError(_0x565943,_0x2fbe35){_0x2fbe35=_0x2fbe35||0x1f4;return function(_0x1aed4f){logger[_0x57f8('0x23')](_0x1aed4f[_0x57f8('0x24')]);if(_0x1aed4f[_0x57f8('0x25')]){delete _0x1aed4f['name'];}_0x565943[_0x57f8('0x17')](_0x2fbe35)[_0x57f8('0x26')](_0x1aed4f);};}exports[_0x57f8('0x27')]=function(_0x2dbd5c,_0x5d8d5f){var _0x154f41={},_0x20460d={},_0xf58f76={'count':0x0,'rows':[]};return db[_0x57f8('0x28')][_0x57f8('0x29')]()[_0x57f8('0x22')](function(_0x4fe127){_0x20460d[_0x57f8('0x2a')]=_[_0x57f8('0x2b')](_0x4fe127);_0x20460d[_0x57f8('0x2c')]=_[_0x57f8('0x2b')](_0x2dbd5c[_0x57f8('0x2c')]);_0x20460d['filters']=_[_0x57f8('0x2d')](_0x20460d['model'],_0x20460d[_0x57f8('0x2c')]);_0x154f41[_0x57f8('0x2e')]=_[_0x57f8('0x2d')](_0x20460d['model'],qs['fields'](_0x2dbd5c[_0x57f8('0x2c')][_0x57f8('0x2f')]));_0x154f41[_0x57f8('0x2e')]=_0x154f41['attributes']['length']?_0x154f41[_0x57f8('0x2e')]:_0x20460d[_0x57f8('0x2a')];if(!_0x2dbd5c[_0x57f8('0x2c')][_0x57f8('0x30')](_0x57f8('0x31'))){_0x154f41['limit']=qs[_0x57f8('0x1c')](_0x2dbd5c[_0x57f8('0x2c')][_0x57f8('0x1c')]);_0x154f41['offset']=qs[_0x57f8('0x19')](_0x2dbd5c[_0x57f8('0x2c')][_0x57f8('0x19')]);}_0x154f41['order']=qs['sort'](_0x2dbd5c['query']['sort']);_0x154f41[_0x57f8('0x32')]=qs[_0x57f8('0x33')](_[_0x57f8('0x34')](_0x2dbd5c[_0x57f8('0x2c')],_0x20460d['filters']),_0x4fe127);if(_0x2dbd5c[_0x57f8('0x2c')]['filter']){_0x154f41[_0x57f8('0x32')]=_[_0x57f8('0x35')](_0x154f41[_0x57f8('0x32')],{'$or':_['map'](_0x154f41['attributes'],function(_0x14d729){var _0x4f7c52={};_0x4f7c52[_0x14d729]={'$like':'%'+_0x2dbd5c[_0x57f8('0x2c')]['filter']+'%'};return _0x4f7c52;})});}_0x154f41=_[_0x57f8('0x35')]({},_0x154f41,_0x2dbd5c['options']);var _0x808066={'where':_0x154f41['where']};return db[_0x57f8('0x28')][_0x57f8('0x1b')](_0x808066)[_0x57f8('0x22')](function(_0x2b7b17){_0xf58f76[_0x57f8('0x1b')]=_0x2b7b17;if(_0x2dbd5c['query']['includeAll']){_0x154f41['include']=[{'all':!![]}];}return db[_0x57f8('0x28')][_0x57f8('0x36')](_0x154f41);})[_0x57f8('0x22')](function(_0x4fce1c){_0xf58f76['rows']=_0x4fce1c;return _0xf58f76;})[_0x57f8('0x22')](respondWithFilteredResult(_0x5d8d5f,_0x154f41))[_0x57f8('0x37')](handleError(_0x5d8d5f,null));})[_0x57f8('0x37')](handleError(_0x5d8d5f,null));};exports[_0x57f8('0x38')]=function(_0x26b8d0,_0x2f7c06){var _0xa44ca={'raw':![],'where':{'id':_0x26b8d0['params']['id']}},_0x184549={};_0x184549[_0x57f8('0x2a')]=_[_0x57f8('0x2b')](db[_0x57f8('0x28')][_0x57f8('0x39')]);_0x184549['query']=_[_0x57f8('0x2b')](_0x26b8d0[_0x57f8('0x2c')]);_0x184549[_0x57f8('0x33')]=_[_0x57f8('0x2d')](_0x184549[_0x57f8('0x2a')],_0x184549[_0x57f8('0x2c')]);_0xa44ca[_0x57f8('0x2e')]=_[_0x57f8('0x2d')](_0x184549[_0x57f8('0x2a')],qs[_0x57f8('0x2f')](_0x26b8d0['query'][_0x57f8('0x2f')]));_0xa44ca[_0x57f8('0x2e')]=_0xa44ca[_0x57f8('0x2e')][_0x57f8('0x3a')]?_0xa44ca['attributes']:_0x184549['model'];if(_0x26b8d0[_0x57f8('0x2c')]['includeAll']){_0xa44ca[_0x57f8('0x3b')]=[{'all':!![]}];}_0xa44ca=_['merge']({},_0xa44ca,_0x26b8d0['options']);return db[_0x57f8('0x28')][_0x57f8('0x3c')](_0xa44ca)['then'](handleEntityNotFound(_0x2f7c06,null))[_0x57f8('0x22')](respondWithResult(_0x2f7c06,null))[_0x57f8('0x37')](handleError(_0x2f7c06,null));};exports[_0x57f8('0x3d')]=function(_0x1c58e5,_0xde3f40){return db[_0x57f8('0x28')]['create'](_0x1c58e5[_0x57f8('0x3e')],{})[_0x57f8('0x22')](function(_0x265725){var _0x565691=_0x1c58e5[_0x57f8('0x3f')][_0x57f8('0x40')]({'plain':!![]});if(!_0x565691)throw new Error(_0x57f8('0x41'));if(_0x565691['role']===_0x57f8('0x3f')){var _0x49595e=_0x265725['get']({'plain':!![]});var _0x4a890e=_0x57f8('0x20');return db[_0x57f8('0x42')][_0x57f8('0x3c')]({'where':{'name':_0x4a890e,'userProfileId':_0x565691[_0x57f8('0x43')]},'raw':!![]})[_0x57f8('0x22')](function(_0x3f7f2f){if(_0x3f7f2f&&_0x3f7f2f[_0x57f8('0x44')]===0x0){return db[_0x57f8('0x21')][_0x57f8('0x3d')]({'name':_0x49595e[_0x57f8('0x25')],'resourceId':_0x49595e['id'],'type':_0x3f7f2f[_0x57f8('0x25')],'sectionId':_0x3f7f2f['id']},{})[_0x57f8('0x22')](function(){return _0x265725;});}else{return _0x265725;}})[_0x57f8('0x37')](function(_0x2254cf){logger[_0x57f8('0x23')](_0x57f8('0x45'),_0x2254cf);throw _0x2254cf;});}return _0x265725;})[_0x57f8('0x22')](respondWithResult(_0xde3f40,0xc9))['catch'](handleError(_0xde3f40,null));};exports[_0x57f8('0x46')]=function(_0x1e40cd,_0x3af694){if(_0x1e40cd[_0x57f8('0x3e')]['id']){delete _0x1e40cd['body']['id'];}return db[_0x57f8('0x28')][_0x57f8('0x3c')]({'where':{'id':_0x1e40cd['params']['id']}})[_0x57f8('0x22')](handleEntityNotFound(_0x3af694,null))[_0x57f8('0x22')](saveUpdates(_0x1e40cd[_0x57f8('0x3e')],null))[_0x57f8('0x22')](respondWithResult(_0x3af694,null))[_0x57f8('0x37')](handleError(_0x3af694,null));};exports[_0x57f8('0x1f')]=function(_0x4ce3f6,_0xacfa07){return db[_0x57f8('0x28')][_0x57f8('0x3c')]({'where':{'id':_0x4ce3f6[_0x57f8('0x47')]['id']}})[_0x57f8('0x22')](handleEntityNotFound(_0xacfa07,null))[_0x57f8('0x22')](removeEntity(_0xacfa07,null))['catch'](handleError(_0xacfa07,null));};exports[_0x57f8('0x29')]=function(_0x153685,_0x5769b6){return db[_0x57f8('0x28')][_0x57f8('0x29')]()['then'](respondWithResult(_0x5769b6,null))[_0x57f8('0x37')](handleError(_0x5769b6,null));};exports[_0x57f8('0x48')]=function(_0x59db52,_0x1437b8,_0xd9b68a){return db[_0x57f8('0x49')][_0x57f8('0x3c')]({'where':{'id':_0x59db52['params']['id']}})[_0x57f8('0x22')](handleEntityNotFound(_0x1437b8,null))[_0x57f8('0x22')](function(_0x20f8f0){if(_0x20f8f0){return _0x20f8f0['addContacts'](_0x59db52['body'][_0x57f8('0x4a')],_[_0x57f8('0x4b')](_0x59db52[_0x57f8('0x3e')],[_0x57f8('0x4a'),'id'])||{});}})[_0x57f8('0x22')](respondWithResult(_0x1437b8,null))[_0x57f8('0x37')](handleError(_0x1437b8,null));};exports[_0x57f8('0x4c')]=function(_0x15e5ff,_0x193071,_0x5362e2){var _0x48c94f={};var _0x15f9ec={};var _0x28767c;var _0x22cb1f;return db[_0x57f8('0x28')]['findOne']({'where':{'id':_0x15e5ff['params']['id']}})['then'](handleEntityNotFound(_0x193071,null))[_0x57f8('0x22')](function(_0x204370){if(_0x204370){_0x28767c=_0x204370;_0x15f9ec['model']=_[_0x57f8('0x2b')](db[_0x57f8('0x49')]['rawAttributes']);_0x15f9ec['query']=_['keys'](_0x15e5ff[_0x57f8('0x2c')]);_0x15f9ec[_0x57f8('0x33')]=_[_0x57f8('0x2d')](_0x15f9ec[_0x57f8('0x2a')],_0x15f9ec[_0x57f8('0x2c')]);_0x48c94f[_0x57f8('0x2e')]=_[_0x57f8('0x2d')](_0x15f9ec[_0x57f8('0x2a')],qs[_0x57f8('0x2f')](_0x15e5ff[_0x57f8('0x2c')]['fields']));_0x48c94f[_0x57f8('0x2e')]=_0x48c94f[_0x57f8('0x2e')]['length']?_0x48c94f['attributes']:_0x15f9ec['model'];_0x48c94f[_0x57f8('0x4d')]=qs[_0x57f8('0x4e')](_0x15e5ff[_0x57f8('0x2c')][_0x57f8('0x4e')]);_0x48c94f[_0x57f8('0x32')]=qs[_0x57f8('0x33')](_[_0x57f8('0x34')](_0x15e5ff[_0x57f8('0x2c')],_0x15f9ec[_0x57f8('0x33')]));if(_0x15e5ff[_0x57f8('0x2c')][_0x57f8('0x4f')]){_0x48c94f[_0x57f8('0x32')]=_[_0x57f8('0x35')](_0x48c94f['where'],{'$or':_['map'](_0x48c94f[_0x57f8('0x2e')],function(_0x2e46ee){var _0x2fc4de={};_0x2fc4de[_0x2e46ee]={'$like':'%'+_0x15e5ff[_0x57f8('0x2c')][_0x57f8('0x4f')]+'%'};return _0x2fc4de;})});}_0x48c94f=_['merge']({},_0x48c94f,_0x15e5ff[_0x57f8('0x50')]);return _0x28767c[_0x57f8('0x4c')](_0x48c94f);}})[_0x57f8('0x22')](function(_0x20f1c4){if(_0x20f1c4){_0x22cb1f=_0x20f1c4[_0x57f8('0x3a')];if(!_0x15e5ff[_0x57f8('0x2c')][_0x57f8('0x30')]('nolimit')){_0x48c94f[_0x57f8('0x1c')]=qs[_0x57f8('0x1c')](_0x15e5ff[_0x57f8('0x2c')]['limit']);_0x48c94f[_0x57f8('0x19')]=qs[_0x57f8('0x19')](_0x15e5ff[_0x57f8('0x2c')][_0x57f8('0x19')]);}return _0x28767c[_0x57f8('0x4c')](_0x48c94f);}})[_0x57f8('0x22')](function(_0xf2eec9){if(_0xf2eec9){return _0xf2eec9?{'count':_0x22cb1f,'rows':_0xf2eec9}:null;}})[_0x57f8('0x22')](respondWithResult(_0x193071,null))[_0x57f8('0x37')](handleError(_0x193071,null));}; \ No newline at end of file +var _0x53b2=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','options','getContacts','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','describe','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','CmCompany','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x53b2,0x10c));var _0x253b=function(_0x5ee08e,_0x353983){_0x5ee08e=_0x5ee08e-0x0;var _0x53c275=_0x53b2[_0x5ee08e];return _0x53c275;};'use strict';var emlformat=require(_0x253b('0x0'));var rimraf=require(_0x253b('0x1'));var zipdir=require(_0x253b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x253b('0x3'));var moment=require('moment');var BPromise=require(_0x253b('0x4'));var Mustache=require('mustache');var util=require(_0x253b('0x5'));var path=require(_0x253b('0x6'));var sox=require(_0x253b('0x7'));var csv=require(_0x253b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x253b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x253b('0xa'));var jsforce=require(_0x253b('0xb'));var deskjs=require(_0x253b('0xc'));var toCsv=require(_0x253b('0x8'));var querystring=require('querystring');var Papa=require(_0x253b('0xd'));var Redis=require(_0x253b('0xe'));var authService=require(_0x253b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x253b('0x10'))(_0x253b('0x11'));var utils=require(_0x253b('0x12'));var config=require(_0x253b('0x13'));var licenseUtil=require(_0x253b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508171,_0x4ebcc0){_0x4ebcc0=_0x4ebcc0||0xcc;return function(_0x19048a){if(_0x19048a){return _0x508171[_0x253b('0x15')](_0x4ebcc0);}return _0x508171[_0x253b('0x16')](_0x4ebcc0)[_0x253b('0x17')]();};}function respondWithResult(_0xaa2020,_0x37f2d7){_0x37f2d7=_0x37f2d7||0xc8;return function(_0x21db0a){if(_0x21db0a){return _0xaa2020[_0x253b('0x16')](_0x37f2d7)[_0x253b('0x18')](_0x21db0a);}};}function respondWithFilteredResult(_0x3f5c9f,_0x330ec5){return function(_0xb9cfd7){if(_0xb9cfd7){var _0x9cbae=typeof _0x330ec5[_0x253b('0x19')]===_0x253b('0x1a')&&typeof _0x330ec5[_0x253b('0x1b')]==='undefined';var _0x1c9c41=_0xb9cfd7[_0x253b('0x1c')];var _0xba0422=_0x9cbae?0x0:_0x330ec5[_0x253b('0x19')];var _0x4fb88e=_0x9cbae?_0xb9cfd7['count']:_0x330ec5[_0x253b('0x19')]+_0x330ec5[_0x253b('0x1b')];var _0x39d795;if(_0x4fb88e>=_0x1c9c41){_0x4fb88e=_0x1c9c41;_0x39d795=0xc8;}else{_0x39d795=0xce;}_0x3f5c9f[_0x253b('0x16')](_0x39d795);return _0x3f5c9f[_0x253b('0x1d')](_0x253b('0x1e'),_0xba0422+'-'+_0x4fb88e+'/'+_0x1c9c41)[_0x253b('0x18')](_0xb9cfd7);}return null;};}function patchUpdates(_0xa33615){return function(_0x484153){try{jsonpatch[_0x253b('0x1f')](_0x484153,_0xa33615,!![]);}catch(_0x558de9){return BPromise[_0x253b('0x20')](_0x558de9);}return _0x484153[_0x253b('0x21')]();};}function saveUpdates(_0x12721a,_0x24ac26){return function(_0x585dd0){if(_0x585dd0){return _0x585dd0[_0x253b('0x22')](_0x12721a)[_0x253b('0x23')](function(_0x44a0e6){return _0x44a0e6;});}return null;};}function removeEntity(_0x4a828c,_0x2b5e5d){return function(_0x38c253){if(_0x38c253){return _0x38c253[_0x253b('0x24')]()[_0x253b('0x23')](function(){var _0x1980bd=_0x38c253[_0x253b('0x25')]({'plain':!![]});var _0x2626e5=_0x253b('0x26');return db[_0x253b('0x27')][_0x253b('0x24')]({'where':{'type':_0x2626e5,'resourceId':_0x1980bd['id']}})['then'](function(){return _0x38c253;});})[_0x253b('0x23')](function(){_0x4a828c[_0x253b('0x16')](0xcc)[_0x253b('0x17')]();});}};}function handleEntityNotFound(_0x7d4417,_0x4319df){return function(_0x40a404){if(!_0x40a404){_0x7d4417[_0x253b('0x15')](0x194);}return _0x40a404;};}function handleError(_0x478a4d,_0x5f20dc){_0x5f20dc=_0x5f20dc||0x1f4;return function(_0x3cf621){logger['error'](_0x3cf621[_0x253b('0x28')]);if(_0x3cf621['name']){delete _0x3cf621[_0x253b('0x29')];}_0x478a4d[_0x253b('0x16')](_0x5f20dc)[_0x253b('0x2a')](_0x3cf621);};}exports['index']=function(_0x2e822c,_0x399d7d){var _0x30b531={},_0x4dbb69={},_0x2d71d2={'count':0x0,'rows':[]};return db['CmCompany'][_0x253b('0x2b')]()['then'](function(_0x58394b){_0x4dbb69[_0x253b('0x2c')]=_[_0x253b('0x2d')](_0x58394b);_0x4dbb69[_0x253b('0x2e')]=_[_0x253b('0x2d')](_0x2e822c['query']);_0x4dbb69['filters']=_['intersection'](_0x4dbb69[_0x253b('0x2c')],_0x4dbb69[_0x253b('0x2e')]);_0x30b531[_0x253b('0x2f')]=_[_0x253b('0x30')](_0x4dbb69['model'],qs[_0x253b('0x31')](_0x2e822c[_0x253b('0x2e')]['fields']));_0x30b531[_0x253b('0x2f')]=_0x30b531['attributes'][_0x253b('0x32')]?_0x30b531[_0x253b('0x2f')]:_0x4dbb69[_0x253b('0x2c')];if(!_0x2e822c[_0x253b('0x2e')][_0x253b('0x33')](_0x253b('0x34'))){_0x30b531['limit']=qs[_0x253b('0x1b')](_0x2e822c[_0x253b('0x2e')]['limit']);_0x30b531['offset']=qs[_0x253b('0x19')](_0x2e822c['query'][_0x253b('0x19')]);}_0x30b531[_0x253b('0x35')]=qs[_0x253b('0x36')](_0x2e822c['query'][_0x253b('0x36')]);_0x30b531[_0x253b('0x37')]=qs[_0x253b('0x38')](_[_0x253b('0x39')](_0x2e822c[_0x253b('0x2e')],_0x4dbb69[_0x253b('0x38')]),_0x58394b);if(_0x2e822c[_0x253b('0x2e')][_0x253b('0x3a')]){_0x30b531[_0x253b('0x37')]=_[_0x253b('0x3b')](_0x30b531[_0x253b('0x37')],{'$or':_[_0x253b('0x3c')](_0x30b531['attributes'],function(_0x110dfd){var _0x4973f8={};_0x4973f8[_0x110dfd]={'$like':'%'+_0x2e822c[_0x253b('0x2e')][_0x253b('0x3a')]+'%'};return _0x4973f8;})});}_0x30b531=_[_0x253b('0x3b')]({},_0x30b531,_0x2e822c['options']);var _0x4c8762={'where':_0x30b531[_0x253b('0x37')]};return db[_0x253b('0x3d')][_0x253b('0x1c')](_0x4c8762)[_0x253b('0x23')](function(_0x2d8ab1){_0x2d71d2['count']=_0x2d8ab1;if(_0x2e822c[_0x253b('0x2e')]['includeAll']){_0x30b531[_0x253b('0x3e')]=[{'all':!![]}];}return db[_0x253b('0x3d')][_0x253b('0x3f')](_0x30b531);})[_0x253b('0x23')](function(_0x1cf622){_0x2d71d2[_0x253b('0x40')]=_0x1cf622;return _0x2d71d2;})[_0x253b('0x23')](respondWithFilteredResult(_0x399d7d,_0x30b531))[_0x253b('0x41')](handleError(_0x399d7d,null));})['catch'](handleError(_0x399d7d,null));};exports[_0x253b('0x42')]=function(_0x22d1bf,_0x3d6576){var _0x442313={'raw':![],'where':{'id':_0x22d1bf[_0x253b('0x43')]['id']}},_0x478d7d={};_0x478d7d[_0x253b('0x2c')]=_[_0x253b('0x2d')](db['CmCompany'][_0x253b('0x44')]);_0x478d7d[_0x253b('0x2e')]=_[_0x253b('0x2d')](_0x22d1bf['query']);_0x478d7d[_0x253b('0x38')]=_[_0x253b('0x30')](_0x478d7d[_0x253b('0x2c')],_0x478d7d[_0x253b('0x2e')]);_0x442313[_0x253b('0x2f')]=_[_0x253b('0x30')](_0x478d7d['model'],qs[_0x253b('0x31')](_0x22d1bf[_0x253b('0x2e')]['fields']));_0x442313[_0x253b('0x2f')]=_0x442313[_0x253b('0x2f')][_0x253b('0x32')]?_0x442313[_0x253b('0x2f')]:_0x478d7d[_0x253b('0x2c')];if(_0x22d1bf[_0x253b('0x2e')][_0x253b('0x45')]){_0x442313[_0x253b('0x3e')]=[{'all':!![]}];}_0x442313=_[_0x253b('0x3b')]({},_0x442313,_0x22d1bf['options']);return db[_0x253b('0x3d')][_0x253b('0x46')](_0x442313)[_0x253b('0x23')](handleEntityNotFound(_0x3d6576,null))['then'](respondWithResult(_0x3d6576,null))['catch'](handleError(_0x3d6576,null));};exports['create']=function(_0x3d4042,_0x3826d7){return db['CmCompany'][_0x253b('0x47')](_0x3d4042[_0x253b('0x48')],{})['then'](function(_0x43b2f5){var _0x2eeae7=_0x3d4042[_0x253b('0x49')][_0x253b('0x25')]({'plain':!![]});if(!_0x2eeae7)throw new Error(_0x253b('0x4a'));if(_0x2eeae7['role']===_0x253b('0x49')){var _0x17ec6f=_0x43b2f5['get']({'plain':!![]});var _0x37660c='Companies';return db[_0x253b('0x4b')][_0x253b('0x46')]({'where':{'name':_0x37660c,'userProfileId':_0x2eeae7[_0x253b('0x4c')]},'raw':!![]})[_0x253b('0x23')](function(_0x36d3af){if(_0x36d3af&&_0x36d3af[_0x253b('0x4d')]===0x0){return db[_0x253b('0x27')][_0x253b('0x47')]({'name':_0x17ec6f['name'],'resourceId':_0x17ec6f['id'],'type':_0x36d3af[_0x253b('0x29')],'sectionId':_0x36d3af['id']},{})[_0x253b('0x23')](function(){return _0x43b2f5;});}else{return _0x43b2f5;}})['catch'](function(_0x1b8723){logger['error'](_0x253b('0x4e'),_0x1b8723);throw _0x1b8723;});}return _0x43b2f5;})['then'](respondWithResult(_0x3826d7,0xc9))[_0x253b('0x41')](handleError(_0x3826d7,null));};exports['update']=function(_0xb61e37,_0x10c1f4){if(_0xb61e37[_0x253b('0x48')]['id']){delete _0xb61e37[_0x253b('0x48')]['id'];}return db[_0x253b('0x3d')][_0x253b('0x46')]({'where':{'id':_0xb61e37[_0x253b('0x43')]['id']}})[_0x253b('0x23')](handleEntityNotFound(_0x10c1f4,null))[_0x253b('0x23')](saveUpdates(_0xb61e37[_0x253b('0x48')],null))['then'](respondWithResult(_0x10c1f4,null))['catch'](handleError(_0x10c1f4,null));};exports[_0x253b('0x24')]=function(_0x524242,_0x163b97){return db['CmCompany'][_0x253b('0x46')]({'where':{'id':_0x524242[_0x253b('0x43')]['id']}})[_0x253b('0x23')](handleEntityNotFound(_0x163b97,null))[_0x253b('0x23')](removeEntity(_0x163b97,null))[_0x253b('0x41')](handleError(_0x163b97,null));};exports['describe']=function(_0x144eb2,_0x12a3ce){return db[_0x253b('0x3d')][_0x253b('0x2b')]()['then'](respondWithResult(_0x12a3ce,null))['catch'](handleError(_0x12a3ce,null));};exports[_0x253b('0x4f')]=function(_0x21cfa8,_0x57643e,_0x141380){return db[_0x253b('0x50')][_0x253b('0x46')]({'where':{'id':_0x21cfa8[_0x253b('0x43')]['id']}})[_0x253b('0x23')](handleEntityNotFound(_0x57643e,null))[_0x253b('0x23')](function(_0x2349bb){if(_0x2349bb){return _0x2349bb[_0x253b('0x4f')](_0x21cfa8[_0x253b('0x48')][_0x253b('0x51')],_[_0x253b('0x52')](_0x21cfa8[_0x253b('0x48')],[_0x253b('0x51'),'id'])||{});}})['then'](respondWithResult(_0x57643e,null))[_0x253b('0x41')](handleError(_0x57643e,null));};exports['getContacts']=function(_0x584a50,_0x5c2a99,_0x10a709){var _0x25b8bb={};var _0x41fdf9={};var _0x1a7ee6;var _0x31070b;return db['CmCompany']['findOne']({'where':{'id':_0x584a50[_0x253b('0x43')]['id']}})[_0x253b('0x23')](handleEntityNotFound(_0x5c2a99,null))[_0x253b('0x23')](function(_0x270fe7){if(_0x270fe7){_0x1a7ee6=_0x270fe7;_0x41fdf9[_0x253b('0x2c')]=_[_0x253b('0x2d')](db[_0x253b('0x50')][_0x253b('0x44')]);_0x41fdf9[_0x253b('0x2e')]=_[_0x253b('0x2d')](_0x584a50[_0x253b('0x2e')]);_0x41fdf9[_0x253b('0x38')]=_[_0x253b('0x30')](_0x41fdf9[_0x253b('0x2c')],_0x41fdf9['query']);_0x25b8bb[_0x253b('0x2f')]=_[_0x253b('0x30')](_0x41fdf9[_0x253b('0x2c')],qs[_0x253b('0x31')](_0x584a50[_0x253b('0x2e')][_0x253b('0x31')]));_0x25b8bb['attributes']=_0x25b8bb[_0x253b('0x2f')][_0x253b('0x32')]?_0x25b8bb['attributes']:_0x41fdf9['model'];_0x25b8bb[_0x253b('0x35')]=qs[_0x253b('0x36')](_0x584a50['query'][_0x253b('0x36')]);_0x25b8bb[_0x253b('0x37')]=qs[_0x253b('0x38')](_[_0x253b('0x39')](_0x584a50[_0x253b('0x2e')],_0x41fdf9['filters']));if(_0x584a50[_0x253b('0x2e')]['filter']){_0x25b8bb[_0x253b('0x37')]=_['merge'](_0x25b8bb[_0x253b('0x37')],{'$or':_[_0x253b('0x3c')](_0x25b8bb[_0x253b('0x2f')],function(_0x3e87d9){var _0x53e326={};_0x53e326[_0x3e87d9]={'$like':'%'+_0x584a50[_0x253b('0x2e')][_0x253b('0x3a')]+'%'};return _0x53e326;})});}_0x25b8bb=_[_0x253b('0x3b')]({},_0x25b8bb,_0x584a50[_0x253b('0x53')]);return _0x1a7ee6[_0x253b('0x54')](_0x25b8bb);}})[_0x253b('0x23')](function(_0x1eec63){if(_0x1eec63){_0x31070b=_0x1eec63['length'];if(!_0x584a50[_0x253b('0x2e')][_0x253b('0x33')](_0x253b('0x34'))){_0x25b8bb['limit']=qs[_0x253b('0x1b')](_0x584a50[_0x253b('0x2e')][_0x253b('0x1b')]);_0x25b8bb['offset']=qs[_0x253b('0x19')](_0x584a50[_0x253b('0x2e')][_0x253b('0x19')]);}return _0x1a7ee6[_0x253b('0x54')](_0x25b8bb);}})[_0x253b('0x23')](function(_0x1e3a05){if(_0x1e3a05){return _0x1e3a05?{'count':_0x31070b,'rows':_0x1e3a05}:null;}})[_0x253b('0x23')](respondWithResult(_0x5c2a99,null))['catch'](handleError(_0x5c2a99,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7573ed2..428ee0b 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 _0x0015=['lodash','moment','bluebird','rimraf','../../config/environment','./cmCompany.attributes','CmCompany'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x0015,0x85));var _0x5001=function(_0x29868a,_0x5c63c6){_0x29868a=_0x29868a-0x0;var _0x3b6a6b=_0x0015[_0x29868a];return _0x3b6a6b;};'use strict';var _=require(_0x5001('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5001('0x1'));var BPromise=require(_0x5001('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5001('0x3'));var config=require(_0x5001('0x4'));var attributes=require(_0x5001('0x5'));module['exports']=function(_0x5be126,_0x367064){return _0x5be126['define'](_0x5001('0x6'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b88=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3b88,0x10f));var _0x83b8=function(_0x3a17cf,_0x26adcf){_0x3a17cf=_0x3a17cf-0x0;var _0x274e11=_0x3b88[_0x3a17cf];return _0x274e11;};'use strict';var _=require(_0x83b8('0x0'));var util=require(_0x83b8('0x1'));var logger=require(_0x83b8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x83b8('0x3'));var rp=require(_0x83b8('0x4'));var fs=require('fs');var path=require(_0x83b8('0x5'));var rimraf=require(_0x83b8('0x6'));var config=require(_0x83b8('0x7'));var attributes=require(_0x83b8('0x8'));module[_0x83b8('0x9')]=function(_0xbbbe43,_0x118f10){return _0xbbbe43['define'](_0x83b8('0xa'),attributes,{'tableName':_0x83b8('0xb'),'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 846ad51..0a7f6f1 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 _0xf57c=['info','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xf57c,0x16b));var _0xcf57=function(_0x1bd7ca,_0x501ec8){_0x1bd7ca=_0x1bd7ca-0x0;var _0x9c182=_0xf57c[_0x1bd7ca];return _0x9c182;};'use strict';var _=require('lodash');var util=require(_0xcf57('0x0'));var moment=require(_0xcf57('0x1'));var BPromise=require(_0xcf57('0x2'));var rs=require(_0xcf57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf57('0x4'))['db'];var utils=require(_0xcf57('0x5'));var logger=require(_0xcf57('0x6'))('rpc');var config=require(_0xcf57('0x7'));var jayson=require(_0xcf57('0x8'));var client=jayson[_0xcf57('0x9')][_0xcf57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c546f,_0x13c93b,_0x5c3b3e){return new BPromise(function(_0x53316c,_0x517331){return client['request'](_0x4c546f,_0x5c3b3e)['then'](function(_0x23c399){logger[_0xcf57('0xb')]('CmCompany,\x20%s,\x20%s',_0x13c93b,'request\x20sent');logger[_0xcf57('0xc')](_0xcf57('0xd'),_0x13c93b,_0xcf57('0xe'),JSON[_0xcf57('0xf')](_0x23c399));if(_0x23c399[_0xcf57('0x10')]){if(_0x23c399[_0xcf57('0x10')][_0xcf57('0x11')]===0x1f4){logger[_0xcf57('0x10')](_0xcf57('0x12'),_0x13c93b,_0x23c399['error'][_0xcf57('0x13')]);return _0x517331(_0x23c399['error'][_0xcf57('0x13')]);}logger['error'](_0xcf57('0x12'),_0x13c93b,_0x23c399['error'][_0xcf57('0x13')]);return _0x53316c(_0x23c399[_0xcf57('0x10')]['message']);}else{logger['info'](_0xcf57('0x12'),_0x13c93b,_0xcf57('0xe'));_0x53316c(_0x23c399[_0xcf57('0x14')][_0xcf57('0x13')]);}})[_0xcf57('0x15')](function(_0x85e4c){logger[_0xcf57('0x10')]('CmCompany,\x20%s,\x20%s',_0x13c93b,_0x85e4c);_0x517331(_0x85e4c);});});} \ No newline at end of file +var _0x9c76=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring'];(function(_0x517dcb,_0xbc9470){var _0x107e15=function(_0x2450a2){while(--_0x2450a2){_0x517dcb['push'](_0x517dcb['shift']());}};_0x107e15(++_0xbc9470);}(_0x9c76,0x75));var _0x69c7=function(_0x2c03c1,_0x19b296){_0x2c03c1=_0x2c03c1-0x0;var _0x513ba0=_0x9c76[_0x2c03c1];return _0x513ba0;};'use strict';var _=require(_0x69c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69c7('0x1'));var rs=require(_0x69c7('0x2'));var fs=require('fs');var Redis=require(_0x69c7('0x3'));var db=require(_0x69c7('0x4'))['db'];var utils=require(_0x69c7('0x5'));var logger=require('../../config/logger')(_0x69c7('0x6'));var config=require(_0x69c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69c7('0x8')][_0x69c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d11f5,_0x3b1f13,_0x3cd10f){return new BPromise(function(_0x23525b,_0x1efa97){return client['request'](_0x3d11f5,_0x3cd10f)[_0x69c7('0xa')](function(_0x1f5a2e){logger['info'](_0x69c7('0xb'),_0x3b1f13,_0x69c7('0xc'));logger['debug'](_0x69c7('0xd'),_0x3b1f13,_0x69c7('0xc'),JSON[_0x69c7('0xe')](_0x1f5a2e));if(_0x1f5a2e[_0x69c7('0xf')]){if(_0x1f5a2e[_0x69c7('0xf')][_0x69c7('0x10')]===0x1f4){logger['error'](_0x69c7('0xb'),_0x3b1f13,_0x1f5a2e[_0x69c7('0xf')]['message']);return _0x1efa97(_0x1f5a2e[_0x69c7('0xf')][_0x69c7('0x11')]);}logger[_0x69c7('0xf')](_0x69c7('0xb'),_0x3b1f13,_0x1f5a2e[_0x69c7('0xf')][_0x69c7('0x11')]);return _0x23525b(_0x1f5a2e['error'][_0x69c7('0x11')]);}else{logger[_0x69c7('0x12')](_0x69c7('0xb'),_0x3b1f13,'request\x20sent');_0x23525b(_0x1f5a2e[_0x69c7('0x13')]['message']);}})['catch'](function(_0xaed830){logger[_0x69c7('0xf')](_0x69c7('0xb'),_0x3b1f13,_0xaed830);_0x1efa97(_0xaed830);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0651994..1a4db6e 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 _0xd1b2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','create','post','addContacts','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x890c0e,_0x245cb6){var _0x63e763=function(_0x172e3a){while(--_0x172e3a){_0x890c0e['push'](_0x890c0e['shift']());}};_0x63e763(++_0x245cb6);}(_0xd1b2,0x1db));var _0x2d1b=function(_0x6ce989,_0x673d65){_0x6ce989=_0x6ce989-0x0;var _0x17550=_0xd1b2[_0x6ce989];return _0x17550;};'use strict';var multer=require(_0x2d1b('0x0'));var util=require(_0x2d1b('0x1'));var path=require(_0x2d1b('0x2'));var timeout=require(_0x2d1b('0x3'));var express=require(_0x2d1b('0x4'));var router=express[_0x2d1b('0x5')]();var fs_extra=require(_0x2d1b('0x6'));var auth=require(_0x2d1b('0x7'));var interaction=require(_0x2d1b('0x8'));var config=require(_0x2d1b('0x9'));var controller=require('./cmCompany.controller');router[_0x2d1b('0xa')]('/',auth['isAuthenticated'](),controller[_0x2d1b('0xb')]);router['get'](_0x2d1b('0xc'),auth[_0x2d1b('0xd')](),controller[_0x2d1b('0xe')]);router['get'](_0x2d1b('0xf'),auth[_0x2d1b('0xd')](),controller[_0x2d1b('0x10')]);router[_0x2d1b('0xa')](_0x2d1b('0x11'),auth[_0x2d1b('0xd')](),controller['getContacts']);router['post']('/',auth[_0x2d1b('0xd')](),controller[_0x2d1b('0x12')]);router[_0x2d1b('0x13')](_0x2d1b('0x11'),auth[_0x2d1b('0xd')](),controller[_0x2d1b('0x14')]);router[_0x2d1b('0x15')]('/:id',auth[_0x2d1b('0xd')](),controller[_0x2d1b('0x16')]);router['delete']('/:id',auth[_0x2d1b('0xd')](),controller[_0x2d1b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x81a9=['show','create','post','/:id/contacts','addContacts','put','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x22e9a5,_0x2a1c0e){var _0x393dda=function(_0x4d67eb){while(--_0x4d67eb){_0x22e9a5['push'](_0x22e9a5['shift']());}};_0x393dda(++_0x2a1c0e);}(_0x81a9,0xe4));var _0x981a=function(_0x1d840d,_0x4160f2){_0x1d840d=_0x1d840d-0x0;var _0x4f52c4=_0x81a9[_0x1d840d];return _0x4f52c4;};'use strict';var multer=require(_0x981a('0x0'));var util=require(_0x981a('0x1'));var path=require('path');var timeout=require(_0x981a('0x2'));var express=require('express');var router=express[_0x981a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x981a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x981a('0x5'));var controller=require(_0x981a('0x6'));router['get']('/',auth[_0x981a('0x7')](),controller[_0x981a('0x8')]);router[_0x981a('0x9')]('/describe',auth[_0x981a('0x7')](),controller[_0x981a('0xa')]);router[_0x981a('0x9')](_0x981a('0xb'),auth['isAuthenticated'](),controller[_0x981a('0xc')]);router['get']('/:id/contacts',auth[_0x981a('0x7')](),controller['getContacts']);router['post']('/',auth[_0x981a('0x7')](),controller[_0x981a('0xd')]);router[_0x981a('0xe')](_0x981a('0xf'),auth['isAuthenticated'](),controller[_0x981a('0x10')]);router[_0x981a('0x11')](_0x981a('0xb'),auth[_0x981a('0x7')](),controller[_0x981a('0x12')]);router[_0x981a('0x13')]('/:id',auth[_0x981a('0x7')](),controller['destroy']);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 c705219..a961c33 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 _0xef0f=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xef0f,0xd7));var _0xfef0=function(_0x42a63f,_0x59b73f){_0x42a63f=_0x42a63f-0x0;var _0x495a79=_0xef0f[_0x42a63f];return _0x495a79;};'use strict';var _=require(_0xfef0('0x0'));var Sequelize=require(_0xfef0('0x1'));module[_0xfef0('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xfef0('0x3')]},'street':{'type':Sequelize[_0xfef0('0x3')]},'postalCode':{'type':Sequelize[_0xfef0('0x3')]},'city':{'type':Sequelize[_0xfef0('0x3')]},'country':{'type':Sequelize[_0xfef0('0x3')]},'dateOfBirth':{'type':Sequelize[_0xfef0('0x3')]},'description':{'type':Sequelize[_0xfef0('0x4')]},'phone':{'type':Sequelize[_0xfef0('0x3')]},'mobile':{'type':Sequelize[_0xfef0('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfef0('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xfef0('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xfef0('0x3')]},'line':{'type':Sequelize[_0xfef0('0x3')]},'wechat':{'type':Sequelize[_0xfef0('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfef0('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xfef0('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfef0('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfef0('0x7')],'defaultValue':Sequelize[_0xfef0('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x998a=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x3850bb,_0xd4b9ad){var _0x801b50=function(_0x1731d3){while(--_0x1731d3){_0x3850bb['push'](_0x3850bb['shift']());}};_0x801b50(++_0xd4b9ad);}(_0x998a,0x15e));var _0xa998=function(_0x88f35f,_0x51aa02){_0x88f35f=_0x88f35f-0x0;var _0xfeed1c=_0x998a[_0x88f35f];return _0xfeed1c;};'use strict';var _=require(_0xa998('0x0'));var Sequelize=require(_0xa998('0x1'));module[_0xa998('0x2')]={'firstName':{'type':Sequelize[_0xa998('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa998('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa998('0x3')]},'country':{'type':Sequelize[_0xa998('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa998('0x3')]},'description':{'type':Sequelize[_0xa998('0x4')]},'phone':{'type':Sequelize[_0xa998('0x3')]},'mobile':{'type':Sequelize[_0xa998('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa998('0x3')]},'url':{'type':Sequelize[_0xa998('0x3')]},'facebook':{'type':Sequelize[_0xa998('0x3')]},'fb_data':{'type':Sequelize[_0xa998('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa998('0x3')]},'teams':{'type':Sequelize[_0xa998('0x3')]},'viber':{'type':Sequelize[_0xa998('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xa998('0x3')]},'telegram':{'type':Sequelize[_0xa998('0x3')]},'UserId':{'type':Sequelize[_0xa998('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa998('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa998('0x7')],'defaultValue':Sequelize[_0xa998('0x8')]},'dialTimezone':{'type':Sequelize[_0xa998('0x3')]},'utcOffset':{'type':Sequelize[_0xa998('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e1439a7..29d6fed 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 _0x3304=['chmodSync','0777','CompanyId','File\x20uploaded\x20correctly!','pid','parse','meta','import','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','No\x20phone\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','mail','chat','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','range','isValid','source','destination','callerid','starttime','endtime','duration','note','userThirdDisposition','UserId','createdAt','DESC','VoiceCallReport','findAndCountAll','fullname','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Tags','browserName','customerIp','customerPort','osName','ratingType','ratingValue','subject','substatus','threadId','Interaction','Owner','flatten','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','error','stack','name','send','index','then','getOptions','query','catch','CmContact','find','params','describe','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','findAll','length','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','additionalPhones','duplicates','$or','ListId','findOrCreate','spread','push','contact','all','show','Tag','color','tag','Phones','Phones.OrderBy','where','$and','omit','map','format','cf_%d','utcOffset','pickBy','table','setFields','id\x20=\x20?','toParam','text','phone','findOne','model','rawAttributes','filters','attributes','fields','sort','pick','options','getTags','nolimit','setTags','ids','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','sequelize','duplicateAdditionalPhones','toContactId','hopperId','getHoppers','intersection','order','ContactId','filter','rows','includeAll','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','file','filename'];(function(_0x5dc6e8,_0x1ed7cc){var _0x2cb306=function(_0xae157e){while(--_0xae157e){_0x5dc6e8['push'](_0x5dc6e8['shift']());}};_0x2cb306(++_0x1ed7cc);}(_0x3304,0x143));var _0x4330=function(_0x320cdc,_0x356339){_0x320cdc=_0x320cdc-0x0;var _0xc6d765=_0x3304[_0x320cdc];return _0xc6d765;};'use strict';var moment=require(_0x4330('0x0'));var BPromise=require(_0x4330('0x1'));var util=require(_0x4330('0x2'));var path=require(_0x4330('0x3'));var fs=require('fs');var _=require(_0x4330('0x4'));var squel=require(_0x4330('0x5'));var Papa=require(_0x4330('0x6'));var Redis=require(_0x4330('0x7'));var contacts=require(_0x4330('0x8'));var qs=require(_0x4330('0x9'));var logger=require(_0x4330('0xa'))(_0x4330('0xb'));var config=require('../../config/environment');var shared=require(_0x4330('0xc'));var db=require(_0x4330('0xd'))['db'];config[_0x4330('0xe')]=_[_0x4330('0xf')](config[_0x4330('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4330('0x10'))[_0x4330('0x11')](socket);function respondWithResult(_0x73142a,_0x262485){_0x262485=_0x262485||0xc8;return function(_0x2f0d93){if(_0x2f0d93){return _0x73142a[_0x4330('0x12')](_0x262485)[_0x4330('0x13')](_0x2f0d93);}};}function respondWithFilteredResult(_0x2ae6d8,_0x2f9013){return function(_0x57cdb3){if(_0x57cdb3){var _0x33300b=typeof _0x2f9013[_0x4330('0x14')]===_0x4330('0x15')&&typeof _0x2f9013[_0x4330('0x16')]===_0x4330('0x15');var _0x1d233c=_0x57cdb3[_0x4330('0x17')];var _0x367bd5=_0x33300b?0x0:_0x2f9013[_0x4330('0x14')];var _0x151a7d=_0x33300b?_0x57cdb3['count']:_0x2f9013[_0x4330('0x14')]+_0x2f9013[_0x4330('0x16')];var _0x2d87f6;if(_0x151a7d>=_0x1d233c){_0x151a7d=_0x1d233c;_0x2d87f6=0xc8;}else{_0x2d87f6=0xce;}_0x2ae6d8[_0x4330('0x12')](_0x2d87f6);return _0x2ae6d8[_0x4330('0x18')](_0x4330('0x19'),_0x367bd5+'-'+_0x151a7d+'/'+_0x1d233c)[_0x4330('0x13')](_0x57cdb3);}return null;};}function saveUpdates(_0x82e88b){return function(_0x5f403a){if(_0x5f403a){return _0x5f403a[_0x4330('0x1a')](_0x82e88b)['then'](function(_0x28ac93){return _0x28ac93;});}return null;};}function removeEntity(_0xc2bde){return function(_0x52ad17){if(_0x52ad17){return _0x52ad17[_0x4330('0x1b')]()['then'](function(){_0xc2bde[_0x4330('0x12')](0xcc)[_0x4330('0x1c')]();});}};}function handleEntityNotFound(_0xe20872){return function(_0x57f816){if(!_0x57f816){_0xe20872['sendStatus'](0x194);}return _0x57f816;};}function handleError(_0x41959e,_0x1cfb4a){_0x1cfb4a=_0x1cfb4a||0x1f4;return function(_0x13c41b){logger[_0x4330('0x1d')](_0x13c41b[_0x4330('0x1e')]);if(_0x13c41b[_0x4330('0x1f')]){delete _0x13c41b['name'];}_0x41959e[_0x4330('0x12')](_0x1cfb4a)[_0x4330('0x20')](_0x13c41b);};}exports[_0x4330('0x21')]=function(_0x3fc959,_0x1ef49b){var _0x4ed7bc={};return contacts['describe']()[_0x4330('0x22')](function(_0xc4df78){_0x4ed7bc=qs[_0x4330('0x23')](_0xc4df78,_0x3fc959);return contacts['findAll'](_0x3fc959[_0x4330('0x24')],_0x3fc959['user'],_0x4ed7bc,_0xc4df78);})[_0x4330('0x22')](respondWithFilteredResult(_0x1ef49b,_0x4ed7bc))[_0x4330('0x25')](handleError(_0x1ef49b,null));};exports[_0x4330('0x1b')]=function(_0x2e9618,_0x4704eb){return db[_0x4330('0x26')][_0x4330('0x27')]({'where':{'id':_0x2e9618[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x4704eb,null))[_0x4330('0x22')](removeEntity(_0x4704eb,null))[_0x4330('0x25')](handleError(_0x4704eb,null));};exports[_0x4330('0x29')]=function(_0x57ba07,_0x30c9a4){return db[_0x4330('0x26')][_0x4330('0x29')]()['then'](function(_0x79a495){delete _0x79a495[_0x4330('0x2a')];for(var _0x19cc0e=0x0;_0x19cc0e0x0){return new Promise(function(_0x27ba53){var _0x3ed0c8=[];for(var _0x42d710=0x0;_0x42d710<_0x317ac8[_0x4330('0x32')];_0x42d710++){_0x3ed0c8[_0x4330('0x62')](insertAdditionalPhones(_0x317ac8[_0x42d710][_0x4330('0x63')],_0x317ac8[_0x42d710]['additionalPhones']));}Promise[_0x4330('0x64')](_0x3ed0c8)[_0x4330('0x22')](function(){_0x27ba53(0x1);});})['then'](function(){return{'success':_0x9b3ecd,'failure':_0x397cef,'duplicates':_0x38f37c};});}else{return{'success':_0x9b3ecd,'failure':_0x397cef,'duplicates':_0x38f37c};}}})[_0x4330('0x22')](respondWithResult(_0x77d34,0xc9))[_0x4330('0x25')](handleError(_0x77d34,null));};exports[_0x4330('0x65')]=function(_0x517998,_0xd046a7){var _0x5cc192;return db['CmContact'][_0x4330('0x29')]()['then'](function(_0x27142e){return db[_0x4330('0x26')][_0x4330('0x27')]({'where':{'id':_0x517998[_0x4330('0x28')]['id']},'include':[{'model':db[_0x4330('0x66')],'as':'Tags','attributes':['id',_0x4330('0x1f'),_0x4330('0x67')],'required':_0x517998[_0x4330('0x24')][_0x4330('0x68')]?!![]:![]},{'model':db[_0x4330('0x4e')],'as':_0x4330('0x69'),'where':{'CmContactId':_0x517998['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db['sequelize']['literal'](_0x4330('0x6a'))],'attributes':_[_0x4330('0x2b')](_0x27142e)});})[_0x4330('0x22')](function(_0x59baa5){if(!_[_0x4330('0x59')](_0x59baa5)){_0x5cc192=_0x59baa5[_0x4330('0x3d')]({'plain':!![]});var _0x46a2bb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x59baa5&&_0x59baa5[_0x4330('0x5f')]){if(_0x59baa5[_0x4330('0x5f')]){_0x46a2bb[_0x4330('0x6b')][_0x4330('0x6c')][_0x4330('0x62')]({'ListId':{'$ne':_0x59baa5['ListId']}});}}return db[_0x4330('0x30')]['findAll'](_0x46a2bb);}})[_0x4330('0x22')](function(_0x1ddc8a){if(!_[_0x4330('0x59')](_0x1ddc8a)){return _[_0x4330('0x6d')](_0x5cc192,_[_0x4330('0x6e')](_0x1ddc8a,function(_0x4e68a4){return util[_0x4330('0x6f')](_0x4330('0x70'),_0x4e68a4['id']);}));}})[_0x4330('0x22')](handleEntityNotFound(_0xd046a7,null))[_0x4330('0x22')](respondWithResult(_0xd046a7,null))[_0x4330('0x25')](handleError(_0xd046a7,null));};exports[_0x4330('0x1a')]=function(_0x31de2e,_0x2ba413){var _0x1236f9;if(_0x31de2e[_0x4330('0x3b')]['id']){delete _0x31de2e['body']['id'];}if(!_[_0x4330('0x59')](_0x31de2e[_0x4330('0x3b')][_0x4330('0x5a')])){var _0x3ac750=_0x31de2e['body'][_0x4330('0x5a')];if(!_[_0x4330('0x59')](shared[_0x4330('0x5b')][_0x3ac750]))_0x31de2e[_0x4330('0x3b')][_0x4330('0x71')]=shared[_0x4330('0x5b')][_0x3ac750]['utcOffset'];}return db[_0x4330('0x26')][_0x4330('0x27')]({'where':{'id':_0x31de2e[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x2ba413,null))['then'](saveUpdates(_0x31de2e[_0x4330('0x3b')],null))['then'](function(_0x47f587){_0x1236f9=_0x47f587;var _0x32fc9a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x47f587&&_0x47f587[_0x4330('0x5f')]){if(_0x47f587['ListId']){_0x32fc9a[_0x4330('0x6b')][_0x4330('0x6c')]['push']({'ListId':{'$ne':_0x47f587[_0x4330('0x5f')]}});}}return db[_0x4330('0x30')][_0x4330('0x31')](_0x32fc9a);})[_0x4330('0x22')](function(_0x458c2e){if(_0x458c2e){return _[_0x4330('0x6d')](_[_0x4330('0x72')](_0x31de2e[_0x4330('0x3b')],function(_0x17a37a,_0x355b58){return _['startsWith'](_0x355b58,'cf_');}),_['map'](_0x458c2e,function(_0x5c6951){return util[_0x4330('0x6f')]('cf_%d',_0x5c6951['id']);}));}})[_0x4330('0x22')](function(_0x3860a5){if(_0x3860a5&&!_['isEmpty'](_0x3860a5)){var _0x136dc3=squel[_0x4330('0x1a')]()[_0x4330('0x73')]('cm_contacts')[_0x4330('0x74')](_0x3860a5)[_0x4330('0x6b')](_0x4330('0x75'),_0x31de2e[_0x4330('0x28')]['id'])[_0x4330('0x76')]();return db['sequelize'][_0x4330('0x24')](_0x136dc3[_0x4330('0x77')],{'replacements':_0x136dc3[_0x4330('0x35')]});}})[_0x4330('0x22')](function(){if(_0x31de2e[_0x4330('0x3b')]['phone']&&_0x1236f9){return db[_0x4330('0x42')][_0x4330('0x1a')]({'phone':_0x31de2e['body'][_0x4330('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x1236f9['id']}});}})['then'](function(){return _0x1236f9;})['then'](respondWithResult(_0x2ba413,null))[_0x4330('0x25')](handleError(_0x2ba413,null));};exports['getTags']=function(_0x1554c3,_0x2ae3f8){var _0x2cf3a7={};var _0x4eaa84={};var _0x1dae6f;var _0x4f9ae9;return db[_0x4330('0x26')][_0x4330('0x79')]({'where':{'id':_0x1554c3[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x2ae3f8,null))[_0x4330('0x22')](function(_0x5f57c6){if(_0x5f57c6){_0x1dae6f=_0x5f57c6;_0x4eaa84[_0x4330('0x7a')]=_[_0x4330('0x2b')](db[_0x4330('0x66')][_0x4330('0x7b')]);_0x4eaa84[_0x4330('0x24')]=_[_0x4330('0x2b')](_0x1554c3[_0x4330('0x24')]);_0x4eaa84[_0x4330('0x7c')]=_['intersection'](_0x4eaa84[_0x4330('0x7a')],_0x4eaa84[_0x4330('0x24')]);_0x2cf3a7[_0x4330('0x7d')]=_['intersection'](_0x4eaa84['model'],qs[_0x4330('0x7e')](_0x1554c3[_0x4330('0x24')]['fields']));_0x2cf3a7['attributes']=_0x2cf3a7['attributes']['length']?_0x2cf3a7['attributes']:_0x4eaa84[_0x4330('0x7a')];_0x2cf3a7['order']=qs['sort'](_0x1554c3[_0x4330('0x24')][_0x4330('0x7f')]);_0x2cf3a7[_0x4330('0x6b')]=qs[_0x4330('0x7c')](_[_0x4330('0x80')](_0x1554c3[_0x4330('0x24')],_0x4eaa84[_0x4330('0x7c')]));if(_0x1554c3[_0x4330('0x24')]['filter']){_0x2cf3a7[_0x4330('0x6b')]=_[_0x4330('0x3a')](_0x2cf3a7[_0x4330('0x6b')],{'$or':_[_0x4330('0x6e')](_0x2cf3a7[_0x4330('0x7d')],function(_0x3977df){var _0x422dda={};_0x422dda[_0x3977df]={'$like':'%'+_0x1554c3[_0x4330('0x24')]['filter']+'%'};return _0x422dda;})});}_0x2cf3a7=_[_0x4330('0x3a')]({},_0x2cf3a7,_0x1554c3[_0x4330('0x81')]);return _0x1dae6f[_0x4330('0x82')](_0x2cf3a7);}})[_0x4330('0x22')](function(_0x4e4038){if(_0x4e4038){_0x4f9ae9=_0x4e4038[_0x4330('0x32')];if(!_0x1554c3[_0x4330('0x24')][_0x4330('0x39')](_0x4330('0x83'))){_0x2cf3a7['limit']=qs[_0x4330('0x16')](_0x1554c3['query'][_0x4330('0x16')]);_0x2cf3a7['offset']=qs['offset'](_0x1554c3[_0x4330('0x24')]['offset']);}return _0x1dae6f[_0x4330('0x82')](_0x2cf3a7);}})[_0x4330('0x22')](function(_0x30ee61){if(_0x30ee61){return _0x30ee61?{'count':_0x4f9ae9,'rows':_0x30ee61}:null;}})[_0x4330('0x22')](respondWithResult(_0x2ae3f8,null))['catch'](handleError(_0x2ae3f8,null));};exports[_0x4330('0x84')]=function(_0x41122a,_0x5d72e2){if(_0x41122a[_0x4330('0x3b')]['id']){delete _0x41122a['body']['id'];}return db[_0x4330('0x26')]['findOne']({'where':{'id':_0x41122a[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x5d72e2,null))[_0x4330('0x22')](function(_0x288a61){if(_0x288a61){return _0x288a61[_0x4330('0x84')](_0x41122a[_0x4330('0x3b')][_0x4330('0x85')]||[]);}return null;})[_0x4330('0x22')](respondWithResult(_0x5d72e2,null))[_0x4330('0x25')](handleError(_0x5d72e2,null));};exports['setAdditionalPhones']=function(_0x28e330,_0x5a976a){var _0xe52e01=[];_0xe52e01[_0x4330('0x62')](addAdditionalPhones(_0x28e330[_0x4330('0x3b')]));Promise['all'](_0xe52e01)['then'](function(){_0xe52e01=[];_0xe52e01[_0x4330('0x62')](deleteCmHopperPhones(_0x28e330['body']['id']));_0xe52e01[_0x4330('0x62')](addCmHopperPhones(_0x28e330[_0x4330('0x3b')]['id']));Promise[_0x4330('0x64')](_0xe52e01)['then'](function(){return[0x1];})[_0x4330('0x22')](respondWithResult(_0x5a976a,null));});};function addAdditionalPhones(_0x154286){var _0x56a37f;return new Promise(function(_0x54a7b2){return db['CmContactHasItem'][_0x4330('0x1b')]({'where':{'CmContactId':_0x154286['id']}})[_0x4330('0x22')](function(){db[_0x4330('0x86')][_0x4330('0x31')]({'raw':!![],'attributes':['id',_0x4330('0x87')]})[_0x4330('0x22')](function(_0x3084bd){var _0x184498=[];for(var _0x5646ec=0x0;_0x5646ec<_0x154286[_0x4330('0x88')]['length'];_0x5646ec++){var _0x3f59f7=_0x154286[_0x4330('0x89')]?_[_0x4330('0x59')](_0x154286['item_types'][_0x5646ec])?'':_0x154286[_0x4330('0x89')][_0x5646ec]:_0x154286[_0x4330('0x88')][_0x5646ec][_0x4330('0x8a')]?_0x154286['items'][_0x5646ec][_0x4330('0x8a')]:'';var _0x42eee9=_[_0x4330('0x59')](_0x154286['items'][_0x5646ec][_0x4330('0x8b')])?'':_0x154286[_0x4330('0x88')][_0x5646ec][_0x4330('0x8b')];var _0x5b37f5=_0x3f59f7+':'+_0x154286[_0x4330('0x88')][_0x5646ec][_0x4330('0x78')]+'§'+_0x42eee9;if(_[_0x4330('0x59')](_0x56a37f))_0x56a37f=_0x5b37f5;else _0x56a37f+=';'+_0x5b37f5;var _0x41c907=null;var _0x3a5bc2=null;if(_0x154286['item_types']){if(!_[_0x4330('0x59')](_0x154286[_0x4330('0x89')][_0x5646ec])){_0x3a5bc2=_[_0x4330('0x27')](_0x3084bd,function(_0x4c180f){return _0x4c180f['id']===_0x154286[_0x4330('0x89')][_0x5646ec];});if(!_[_0x4330('0x59')](_0x3a5bc2)){_0x41c907=_0x3a5bc2[_0x4330('0x87')];}}}else{if(!_[_0x4330('0x59')](_0x154286['items'][_0x5646ec])){_0x3a5bc2=_[_0x4330('0x27')](_0x3084bd,function(_0x3bbfc9){return _0x3bbfc9['id']===_0x154286['items'][_0x5646ec][_0x4330('0x8a')];});if(!_[_0x4330('0x59')](_0x3a5bc2)){_0x41c907=_0x5646ec;}}}if(_[_0x4330('0x59')](_0x41c907)){_0x41c907=0x64;}_0x184498['push'](addAdditionalPhone(_0x154286['id'],_0x154286[_0x4330('0x88')][_0x5646ec][_0x4330('0x78')],_0x154286[_0x4330('0x89')]?_[_0x4330('0x59')](_0x154286['item_types'][_0x5646ec])?null:_0x154286['item_types'][_0x5646ec]:_0x154286['items'][_0x5646ec][_0x4330('0x8a')]?_0x154286['items'][_0x5646ec][_0x4330('0x8a')]:null,_0x41c907,_0x42eee9));}Promise[_0x4330('0x64')](_0x184498)[_0x4330('0x22')](function(){db[_0x4330('0x26')][_0x4330('0x1a')]({'AdditionalPhones':_0x56a37f},{'where':{'id':_0x154286['id']}})[_0x4330('0x22')](function(){_0x54a7b2(0x1);});});});});});}function addAdditionalPhone(_0x4de287,_0x2c1085,_0x39c2e7,_0x5de527,_0x5603f6){return db[_0x4330('0x4e')][_0x4330('0x27')]({'where':{'CmContactId':_0x4de287,'item':_0x2c1085}})[_0x4330('0x22')](function(_0x18095b){if(_0x18095b)logger[_0x4330('0x36')](_0x4330('0x8c'),_0x18095b);else{db['CmContactHasItem']['create']({'CmContactId':_0x4de287,'item':_0x2c1085,'ItemTypeId':_0x39c2e7,'OrderBy':_0x5de527,'ItemClass':_0x4330('0x8d'),'description':_0x5603f6});}});}function deleteCmHopperPhones(_0x50b3b8){return new Promise(function(_0x3813ab){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x50b3b8}})[_0x4330('0x22')](function(_0x42ed81){db[_0x4330('0x8e')][_0x4330('0x1b')]({'where':{'CmHopperId':{'$in':_[_0x4330('0x6e')](_0x42ed81,'id')}}});})[_0x4330('0x22')](function(){_0x3813ab(0x1);});});}function addCmHopperPhones(_0x4f3393){return new Promise(function(_0x1d0cc2){return db[_0x4330('0x42')][_0x4330('0x31')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f3393}})[_0x4330('0x22')](function(_0x2e9599){var _0x5c2976=[];_[_0x4330('0x6e')](_0x2e9599,function(_0x559e87){_0x5c2976[_0x4330('0x62')](createCmHopperPhone(_0x4f3393,_0x559e87['id']));});Promise[_0x4330('0x64')](_0x5c2976)[_0x4330('0x22')](function(){_0x1d0cc2(0x1);});});});}function createCmHopperPhone(_0x1efc6e,_0x103004){return new Promise(function(_0x57bfff){db[_0x4330('0x4e')][_0x4330('0x31')]({'raw':!![],'attributes':[_0x4330('0x8f'),_0x4330('0x87')],'where':{'CmContactId':_0x1efc6e,'ItemClass':_0x4330('0x8d')},'include':[{'model':db['ContactItemType'],'attributes':[_0x4330('0x87')],'as':_0x4330('0x90')}],'order':[_0x4330('0x87'),db['sequelize'][_0x4330('0x91')](_0x4330('0x92'))]})['then'](function(_0x227439){var _0x143ef3=0x1;var _0x416b12=_[_0x4330('0x6e')](_0x227439,function(_0x579dd8){_0x579dd8[_0x4330('0x93')]=_0x103004;_0x579dd8[_0x4330('0x78')]=_0x579dd8[_0x4330('0x8f')];_0x579dd8['OrderBy']=_0x143ef3;delete _0x579dd8[_0x4330('0x94')];_0x143ef3=_0x143ef3+0x1;return _0x579dd8;});return db[_0x4330('0x8e')][_0x4330('0x95')](_0x416b12,{});})[_0x4330('0x22')](function(){_0x57bfff(0x1);});});}function insertAdditionalPhones(_0xdd1437,_0x1ce7d4){return new Promise(function(_0x3c76fe){var _0x16a23a=[];for(var _0x27bc14=0x0;_0x27bc14<_0x1ce7d4[_0x4330('0x32')];_0x27bc14++){var _0x2798e2=_0x1ce7d4[_0x27bc14];_0x16a23a[_0x4330('0x62')](parseContactItemType(_0x2798e2));}Promise['all'](_0x16a23a)['then'](function(){var _0x2ad2d7={'id':_0xdd1437['id'],'items':_0x1ce7d4};return addAdditionalPhones(_0x2ad2d7)[_0x4330('0x22')](function(){return addCmHopperPhones(_0xdd1437['id']);});})[_0x4330('0x22')](function(){_0x3c76fe(_0xdd1437);});});}function parseContactItemType(_0x43198e){return new Promise(function(_0xdd9e58){if(_0x43198e[_0x4330('0x39')](_0x4330('0x8a'))){_0xdd9e58(_0x43198e);}else{return db[_0x4330('0x86')][_0x4330('0x27')]({'where':{'name':_0x43198e[_0x4330('0x90')]}})['then'](function(_0x37372e){if(_[_0x4330('0x59')](_0x37372e))_0x43198e[_0x4330('0x8a')]=null;else _0x43198e['ItemTypeId']=_0x37372e['id'];_0xdd9e58(_0x43198e);});}});}exports['getAdditionalPhones']=function(_0x2d2c4b,_0x29cfe6){return db[_0x4330('0x4e')][_0x4330('0x31')]({'raw':!![],'where':{'CmContactId':_0x2d2c4b[_0x4330('0x28')]['id'],'ItemClass':_0x4330('0x8d')},'include':[{'model':db[_0x4330('0x86')],'as':_0x4330('0x90')}],'order':[[_0x4330('0x87')],[db[_0x4330('0x96')][_0x4330('0x91')](_0x4330('0x92'))]]})[_0x4330('0x22')](function(_0x431319){return _0x431319;})['then'](respondWithResult(_0x29cfe6,null))[_0x4330('0x25')](handleError(_0x29cfe6,null));};exports[_0x4330('0x97')]=function(_0x125d93,_0x50902d){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x125d93[_0x4330('0x3b')]['fromContactId']}})['then'](function(_0x3ac591){var _0x280655=_[_0x4330('0x6e')](_0x3ac591,function(_0x939940){_0x939940['CmContactId']=_0x125d93[_0x4330('0x3b')]['toContactId'];return _0x939940;});return db[_0x4330('0x4e')]['bulkCreate'](_0x280655,{});})[_0x4330('0x22')](function(){return addCmHopperPhones(_0x125d93[_0x4330('0x3b')][_0x4330('0x98')]);})[_0x4330('0x22')](function(){return['ok'];})[_0x4330('0x22')](respondWithResult(_0x50902d,null))[_0x4330('0x25')](handleError(_0x50902d,null));};exports['rescheduleAdditionalPhones']=function(_0x11bd20,_0x548737){var _0x2d619a=[];_0x2d619a[_0x4330('0x62')](createCmHopperPhone(_0x11bd20['body']['id'],_0x11bd20[_0x4330('0x3b')][_0x4330('0x99')]));Promise[_0x4330('0x64')](_0x2d619a)[_0x4330('0x22')](function(){return[0x1];})['then'](respondWithResult(_0x548737,null));};exports[_0x4330('0x9a')]=function(_0xd54853,_0x5b560d){var _0x5a6a9a={'raw':![],'where':{}};var _0x272f98={};var _0x55accf={'count':0x0,'rows':[]};return db['CmContact'][_0x4330('0x79')]({'where':{'id':_0xd54853[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x5b560d,null))['then'](function(_0x351132){if(_0x351132){_0x272f98[_0x4330('0x7a')]=_['keys'](db[_0x4330('0x42')]['rawAttributes']);_0x272f98[_0x4330('0x24')]=_[_0x4330('0x2b')](_0xd54853[_0x4330('0x24')]);_0x272f98['filters']=_[_0x4330('0x9b')](_0x272f98['model'],_0x272f98[_0x4330('0x24')]);_0x5a6a9a[_0x4330('0x7d')]=_['intersection'](_0x272f98[_0x4330('0x7a')],qs[_0x4330('0x7e')](_0xd54853[_0x4330('0x24')]['fields']));_0x5a6a9a[_0x4330('0x7d')]=_0x5a6a9a['attributes'][_0x4330('0x32')]?_0x5a6a9a['attributes']:_0x272f98[_0x4330('0x7a')];if(!_0xd54853['query'][_0x4330('0x39')](_0x4330('0x83'))){_0x5a6a9a[_0x4330('0x16')]=qs[_0x4330('0x16')](_0xd54853[_0x4330('0x24')][_0x4330('0x16')]);_0x5a6a9a['offset']=qs[_0x4330('0x14')](_0xd54853['query']['offset']);}_0x5a6a9a[_0x4330('0x9c')]=qs[_0x4330('0x7f')](_0xd54853['query']['sort']);_0x5a6a9a[_0x4330('0x6b')]=qs[_0x4330('0x7c')](_[_0x4330('0x80')](_0xd54853['query'],_0x272f98[_0x4330('0x7c')]));_0x5a6a9a['where'][_0x4330('0x9d')]=_0x351132['id'];if(_0xd54853[_0x4330('0x24')]['filter']){_0x5a6a9a[_0x4330('0x6b')]=_[_0x4330('0x3a')](_0x5a6a9a['where'],{'$or':_[_0x4330('0x6e')](_0x5a6a9a[_0x4330('0x7d')],function(_0x30b9a6){var _0x16f7bb={};_0x16f7bb[_0x30b9a6]={'$like':'%'+_0xd54853[_0x4330('0x24')][_0x4330('0x9e')]+'%'};return _0x16f7bb;})});}_0x5a6a9a=_[_0x4330('0x3a')]({},_0x5a6a9a,_0xd54853['options']);return db['CmHopper']['count']({'where':_0x5a6a9a[_0x4330('0x6b')]})['then'](function(_0x4d408a){_0x55accf[_0x4330('0x17')]=_0x4d408a;if(_0xd54853[_0x4330('0x24')]['includeAll']){_0x5a6a9a['include']=[{'all':!![]}];}return db['CmHopper'][_0x4330('0x31')](_0x5a6a9a);})[_0x4330('0x22')](function(_0x2a78e3){_0x55accf[_0x4330('0x9f')]=_0x2a78e3;return _0x55accf;});}})['then'](respondWithFilteredResult(_0x5b560d,_0x5a6a9a))['catch'](handleError(_0x5b560d,null));};exports['getHopperHistories']=function(_0x51e12c,_0x22bdcb){var _0x39145e={'raw':!![],'where':{}};var _0x5c5a07={};var _0x371701={'count':0x0,'rows':[]};return db[_0x4330('0x26')][_0x4330('0x79')]({'where':{'id':_0x51e12c[_0x4330('0x28')]['id']}})['then'](handleEntityNotFound(_0x22bdcb,null))[_0x4330('0x22')](function(_0x2eafd8){if(_0x2eafd8){_0x5c5a07['model']=_[_0x4330('0x2b')](db['CmHopperHistory'][_0x4330('0x7b')]);_0x5c5a07['query']=_[_0x4330('0x2b')](_0x51e12c[_0x4330('0x24')]);_0x5c5a07[_0x4330('0x7c')]=_[_0x4330('0x9b')](_0x5c5a07[_0x4330('0x7a')],_0x5c5a07[_0x4330('0x24')]);_0x39145e[_0x4330('0x7d')]=_[_0x4330('0x9b')](_0x5c5a07[_0x4330('0x7a')],qs[_0x4330('0x7e')](_0x51e12c[_0x4330('0x24')][_0x4330('0x7e')]));_0x39145e[_0x4330('0x7d')]=_0x39145e[_0x4330('0x7d')][_0x4330('0x32')]?_0x39145e[_0x4330('0x7d')]:_0x5c5a07[_0x4330('0x7a')];if(!_0x51e12c[_0x4330('0x24')][_0x4330('0x39')](_0x4330('0x83'))){_0x39145e[_0x4330('0x16')]=qs[_0x4330('0x16')](_0x51e12c[_0x4330('0x24')][_0x4330('0x16')]);_0x39145e[_0x4330('0x14')]=qs[_0x4330('0x14')](_0x51e12c[_0x4330('0x24')][_0x4330('0x14')]);}_0x39145e['order']=qs[_0x4330('0x7f')](_0x51e12c['query']['sort']);_0x39145e[_0x4330('0x6b')]=qs[_0x4330('0x7c')](_[_0x4330('0x80')](_0x51e12c[_0x4330('0x24')],_0x5c5a07[_0x4330('0x7c')]));_0x39145e[_0x4330('0x6b')]['ContactId']=_0x2eafd8['id'];if(_0x51e12c['query']['filter']){_0x39145e['where']=_[_0x4330('0x3a')](_0x39145e['where'],{'$or':_['map'](_0x39145e[_0x4330('0x7d')],function(_0x3578bc){var _0x47b11f={};_0x47b11f[_0x3578bc]={'$like':'%'+_0x51e12c[_0x4330('0x24')][_0x4330('0x9e')]+'%'};return _0x47b11f;})});}_0x39145e=_[_0x4330('0x3a')]({},_0x39145e,_0x51e12c[_0x4330('0x81')]);return db['CmHopperHistory'][_0x4330('0x17')]({'where':_0x39145e['where']})['then'](function(_0x5f8baa){_0x371701['count']=_0x5f8baa;if(_0x51e12c[_0x4330('0x24')][_0x4330('0xa0')]){_0x39145e[_0x4330('0xa1')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4330('0x31')](_0x39145e);})['then'](function(_0xc31972){_0x371701['rows']=_0xc31972;return _0x371701;});}})[_0x4330('0x22')](respondWithFilteredResult(_0x22bdcb,_0x39145e))[_0x4330('0x25')](handleError(_0x22bdcb,null));};exports[_0x4330('0xa2')]=function(_0x5bb88c,_0x6ab8b9){var _0x34391d={'raw':!![],'where':{}};var _0xa8f5b={};var _0x2e7c97={'count':0x0,'rows':[]};return db[_0x4330('0x26')][_0x4330('0x79')]({'where':{'id':_0x5bb88c['params']['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x6ab8b9,null))['then'](function(_0x580d9b){if(_0x580d9b){_0xa8f5b[_0x4330('0x7a')]=_[_0x4330('0x2b')](db['CmHopperFinal']['rawAttributes']);_0xa8f5b[_0x4330('0x24')]=_[_0x4330('0x2b')](_0x5bb88c['query']);_0xa8f5b[_0x4330('0x7c')]=_[_0x4330('0x9b')](_0xa8f5b[_0x4330('0x7a')],_0xa8f5b[_0x4330('0x24')]);_0x34391d[_0x4330('0x7d')]=_[_0x4330('0x9b')](_0xa8f5b[_0x4330('0x7a')],qs['fields'](_0x5bb88c[_0x4330('0x24')][_0x4330('0x7e')]));_0x34391d[_0x4330('0x7d')]=_0x34391d[_0x4330('0x7d')]['length']?_0x34391d[_0x4330('0x7d')]:_0xa8f5b[_0x4330('0x7a')];if(!_0x5bb88c[_0x4330('0x24')][_0x4330('0x39')](_0x4330('0x83'))){_0x34391d[_0x4330('0x16')]=qs[_0x4330('0x16')](_0x5bb88c[_0x4330('0x24')]['limit']);_0x34391d[_0x4330('0x14')]=qs[_0x4330('0x14')](_0x5bb88c[_0x4330('0x24')]['offset']);}_0x34391d['order']=qs['sort'](_0x5bb88c['query'][_0x4330('0x7f')]);_0x34391d[_0x4330('0x6b')]=qs[_0x4330('0x7c')](_[_0x4330('0x80')](_0x5bb88c[_0x4330('0x24')],_0xa8f5b[_0x4330('0x7c')]));_0x34391d[_0x4330('0x6b')][_0x4330('0x9d')]=_0x580d9b['id'];if(_0x5bb88c[_0x4330('0x24')][_0x4330('0x9e')]){_0x34391d[_0x4330('0x6b')]=_[_0x4330('0x3a')](_0x34391d[_0x4330('0x6b')],{'$or':_[_0x4330('0x6e')](_0x34391d[_0x4330('0x7d')],function(_0x136a41){var _0x285c67={};_0x285c67[_0x136a41]={'$like':'%'+_0x5bb88c[_0x4330('0x24')][_0x4330('0x9e')]+'%'};return _0x285c67;})});}_0x34391d=_[_0x4330('0x3a')]({},_0x34391d,_0x5bb88c[_0x4330('0x81')]);return db[_0x4330('0x4f')][_0x4330('0x17')]({'where':_0x34391d['where']})['then'](function(_0x3b1c95){_0x2e7c97[_0x4330('0x17')]=_0x3b1c95;if(_0x5bb88c[_0x4330('0x24')][_0x4330('0xa0')]){_0x34391d[_0x4330('0xa1')]=[{'all':!![]}];}return db[_0x4330('0x4f')][_0x4330('0x31')](_0x34391d);})['then'](function(_0x1ac4b6){_0x2e7c97[_0x4330('0x9f')]=_0x1ac4b6;return _0x2e7c97;});}})['then'](respondWithFilteredResult(_0x6ab8b9,_0x34391d))[_0x4330('0x25')](handleError(_0x6ab8b9,null));};exports[_0x4330('0xa3')]=function(_0x95c089,_0x1c73f2){var _0x438497={'raw':!![],'where':{}};var _0x111e6e={};var _0x383120={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x95c089[_0x4330('0x28')]['id']}})[_0x4330('0x22')](handleEntityNotFound(_0x1c73f2,null))[_0x4330('0x22')](function(_0x1fe7c9){if(_0x1fe7c9){_0x111e6e['model']=_[_0x4330('0x2b')](db[_0x4330('0x55')][_0x4330('0x7b')]);_0x111e6e['query']=_[_0x4330('0x2b')](_0x95c089[_0x4330('0x24')]);_0x111e6e['filters']=_['intersection'](_0x111e6e['model'],_0x111e6e[_0x4330('0x24')]);_0x438497[_0x4330('0x7d')]=_[_0x4330('0x9b')](_0x111e6e[_0x4330('0x7a')],qs[_0x4330('0x7e')](_0x95c089[_0x4330('0x24')][_0x4330('0x7e')]));_0x438497[_0x4330('0x7d')]=_0x438497[_0x4330('0x7d')][_0x4330('0x32')]?_0x438497['attributes']:_0x111e6e[_0x4330('0x7a')];if(!_0x95c089['query']['hasOwnProperty']('nolimit')){_0x438497['limit']=qs['limit'](_0x95c089[_0x4330('0x24')]['limit']);_0x438497['offset']=qs[_0x4330('0x14')](_0x95c089[_0x4330('0x24')][_0x4330('0x14')]);}_0x438497[_0x4330('0x9c')]=qs['sort'](_0x95c089['query'][_0x4330('0x7f')]);_0x438497['where']=qs[_0x4330('0x7c')](_[_0x4330('0x80')](_0x95c089['query'],_0x111e6e['filters']));_0x438497[_0x4330('0x6b')]['ContactId']=_0x1fe7c9['id'];if(_0x95c089[_0x4330('0x24')][_0x4330('0x9e')]){_0x438497[_0x4330('0x6b')]=_['merge'](_0x438497[_0x4330('0x6b')],{'$or':_[_0x4330('0x6e')](_0x438497['attributes'],function(_0x27f758){var _0x42e67e={};_0x42e67e[_0x27f758]={'$like':'%'+_0x95c089[_0x4330('0x24')]['filter']+'%'};return _0x42e67e;})});}_0x438497=_['merge']({},_0x438497,_0x95c089['options']);return db['JscriptySessionReport'][_0x4330('0x17')]({'where':_0x438497['where']})['then'](function(_0x357494){_0x383120['count']=_0x357494;if(_0x95c089[_0x4330('0x24')][_0x4330('0xa0')]){_0x438497[_0x4330('0xa1')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4330('0x31')](_0x438497);})[_0x4330('0x22')](function(_0x4f65fe){_0x383120[_0x4330('0x9f')]=_0x4f65fe;return _0x383120;});}})[_0x4330('0x22')](respondWithFilteredResult(_0x1c73f2,_0x438497))[_0x4330('0x25')](handleError(_0x1c73f2,null));};exports[_0x4330('0xa4')]=function(_0x37e512,_0x442234){try{if(!_0x37e512[_0x4330('0x3b')][_0x4330('0x5f')]){throw new Error(_0x4330('0xa5'));}if(!_0x37e512[_0x4330('0x3b')][_0x4330('0xa6')]){throw new Error(_0x4330('0xa7'));}if(!_0x37e512[_0x4330('0x3b')]['binding_values']){throw new Error(_0x4330('0xa8'));}if(!_0x37e512['body'][_0x4330('0xa9')]){throw new Error(_0x4330('0xaa'));}var _0x594f93=_0x37e512[_0x4330('0x3b')][_0x4330('0xa6')][_0x4330('0xab')](',');var _0x39ae17=_0x37e512[_0x4330('0x3b')][_0x4330('0xac')][_0x4330('0xab')](',');if(!_0x594f93[_0x4330('0x32')]||!_0x39ae17[_0x4330('0x32')]||_0x594f93[_0x4330('0x32')]!==_0x39ae17['length']){throw new Error(_0x4330('0xad'));}_0x37e512[_0x4330('0x3b')][_0x4330('0x7e')]=_['zipObject'](_0x594f93,_0x39ae17);if(!_0x37e512[_0x4330('0x3b')][_0x4330('0x7e')][_0x4330('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x37e512[_0x4330('0x3b')][_0x4330('0x7e')][_0x4330('0xae')]){throw new Error(_0x4330('0xaf'));}var _0x5cfe9a=path[_0x4330('0x40')](config[_0x4330('0xb0')],'server/files/tmp',_0x37e512[_0x4330('0xb1')][_0x4330('0xb2')]);fs[_0x4330('0xb3')](_0x5cfe9a,parseInt(_0x4330('0xb4'),0x8));var _0x233802=require('child_process')['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x5cfe9a,_0x37e512[_0x4330('0x3b')]['binding_keys'],_0x37e512[_0x4330('0x3b')][_0x4330('0xac')],_0x37e512[_0x4330('0x3b')][_0x4330('0x5f')],_0x37e512[_0x4330('0x3b')][_0x4330('0xb5')],_0x37e512[_0x4330('0x3b')][_0x4330('0x5d')],_0x37e512[_0x4330('0x3b')]['socket_timestamp']]);return _0x442234[_0x4330('0x12')](0xc8)['json']({'message':_0x4330('0xb6'),'pid':_0x233802[_0x4330('0xb7')]});}catch(_0x491c1d){return _0x442234[_0x4330('0x12')](0x1f4)['send'](_0x491c1d);}};exports['upload']=function(_0x18c8f6,_0x564acf){var _0x4fe3eb=fs['createReadStream'](_0x18c8f6[_0x4330('0xb1')]['path']);Papa[_0x4330('0xb8')](_0x4fe3eb,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x32d494){return _0x564acf[_0x4330('0x12')](0xc8)[_0x4330('0x13')]({'file':_0x18c8f6[_0x4330('0xb1')],'fields':_0x32d494[_0x4330('0xb9')]['fields']});}});};exports[_0x4330('0xba')]=function(_0x1214ea,_0x197746){return db['User'][_0x4330('0x31')]({'raw':!![],'attributes':['id'],'where':{'role':_0x4330('0xbb')}})[_0x4330('0x22')](function(_0xf17ff7){var _0x1662a8=![];if(!_0x1214ea['body'][_0x4330('0x5f')]){throw new Error(_0x4330('0xa5'));}if(!_0x1214ea[_0x4330('0x3b')][_0x4330('0xbc')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1214ea[_0x4330('0x3b')][_0x4330('0xbc')][_0x4330('0xae')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1214ea[_0x4330('0x3b')][_0x4330('0xa9')]){throw new Error(_0x4330('0xaa'));}var _0x3bc56c=require(_0x4330('0xbd'))['fork'](path[_0x4330('0x40')](__dirname,_0x4330('0xbe')),[_0x1214ea[_0x4330('0x28')]['id'],JSON[_0x4330('0xbf')](_0x1214ea['body']),JSON[_0x4330('0xbf')](_0xf17ff7)]);_0x3bc56c['on'](_0x4330('0xc0'),function(){_0x1662a8=!![];return _0x197746[_0x4330('0x12')](0xc8)[_0x4330('0x13')]({'message':_0x4330('0xc1'),'pid':_0x3bc56c[_0x4330('0xb7')]});});_0x3bc56c['on'](_0x4330('0xc2'),function(_0x5d47a4){if(_0x5d47a4&&!_0x1662a8){return _0x197746[_0x4330('0x12')](0x1f4)[_0x4330('0x13')]({'message':_0x4330('0xc3'),'pid':_0x3bc56c[_0x4330('0xb7')]});}});})[_0x4330('0x25')](handleError(_0x197746,null));};exports[_0x4330('0xc4')]=function(_0x40c72b,_0x1fedf0){return db[_0x4330('0xc5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x3b98f1){var _0x2f4c36=![];if(!_0x40c72b[_0x4330('0x3b')][_0x4330('0x5f')]){throw new Error(_0x4330('0xa5'));}if(!_0x40c72b[_0x4330('0x3b')]['binding'][_0x4330('0x78')]){throw new Error(_0x4330('0xc6'));}if(!_0x40c72b[_0x4330('0x3b')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x40c72b['body'][_0x4330('0xa9')]){throw new Error(_0x4330('0xaa'));}var _0x1d54a7=require(_0x4330('0xbd'))['fork'](path[_0x4330('0x40')](__dirname,_0x4330('0xc7')),[_0x40c72b[_0x4330('0x28')]['id'],JSON[_0x4330('0xbf')](_0x40c72b[_0x4330('0x3b')]),JSON[_0x4330('0xbf')](_0x3b98f1)]);_0x1d54a7['on'](_0x4330('0xc0'),function(){_0x2f4c36=!![];return _0x1fedf0['status'](0xc8)[_0x4330('0x13')]({'message':_0x4330('0xc1'),'pid':_0x1d54a7[_0x4330('0xb7')]});});_0x1d54a7['on']('exit',function(_0x2718ab){if(_0x2718ab&&!_0x2f4c36){return _0x1fedf0[_0x4330('0x12')](0x1f4)['json']({'message':_0x4330('0xc3'),'pid':_0x1d54a7['pid']});}});})[_0x4330('0x25')](handleError(_0x1fedf0,null));};exports[_0x4330('0xc8')]=function(_0x54bfc5,_0x4ee8ae){var _0x3a4b65=[_0x4330('0xc9'),_0x4330('0xca'),'sms',_0x4330('0xcb'),_0x4330('0xcc'),_0x4330('0xcd'),_0x4330('0xce')];var _0x57057a={'offset':0x0,'order':qs['sort']('-createdAt')},_0x48b4e0={'count':0x0,'rows':[]};Promise[_0x4330('0xcf')]()[_0x4330('0x22')](function(){if(_0x54bfc5[_0x4330('0x24')][_0x4330('0xd0')]){if(!_[_0x4330('0xd1')](_0x3a4b65,_0x54bfc5[_0x4330('0x24')][_0x4330('0xd0')][_0x4330('0xd2')]())){throw new Error('Invalid\x20channel');}_0x3a4b65=[_0x54bfc5[_0x4330('0x24')][_0x4330('0xd0')][_0x4330('0xd2')]()];}if(_0x54bfc5[_0x4330('0x24')][_0x4330('0xd3')]){try{var _0xc265f1=JSON[_0x4330('0xb8')](_0x54bfc5[_0x4330('0x24')][_0x4330('0xd3')]);if(!moment(_0xc265f1[_0x4330('0x3c')])[_0x4330('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0xc265f1['to'])[_0x4330('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x4f817b){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x54bfc5['query']['hasOwnProperty'](_0x4330('0x83'))){_0x57057a[_0x4330('0x16')]=qs[_0x4330('0x16')](_0x54bfc5[_0x4330('0x24')][_0x4330('0x16')]||0xa);_0x57057a[_0x4330('0x14')]=qs['offset'](_0x54bfc5[_0x4330('0x24')]['offset']);}var _0x2e85ec=_0x3a4b65['map'](function(_0x4f60c6){if(_0x4f60c6===_0x4330('0xce')){var _0x4473ed={'attributes':['id','uniqueid','type',_0x4330('0xd5'),_0x4330('0xd6'),_0x4330('0xd7'),_0x4330('0xd8'),_0x4330('0xd9'),_0x4330('0xda'),_0x4330('0xdb'),'createdAt','userDisposition','userSecondDisposition',_0x4330('0xdc'),_0x4330('0xdd')],'where':{'ContactId':_0x54bfc5['params']['id']},'include':[{'model':db[_0x4330('0xc5')],'as':_0x4330('0xc5'),'attributes':['id','name','fullname',_0x4330('0x33')]}],'order':[[_0x4330('0xde'),_0x4330('0xdf')]]};if(_0x54bfc5['query'][_0x4330('0xd3')]){_0x4473ed['where'][_0x4330('0xde')]={'$gte':_0xc265f1[_0x4330('0x3c')],'$lte':_0xc265f1['to']};}return db[_0x4330('0xe0')][_0x4330('0xe1')](_0x4473ed)[_0x4330('0x22')](function(_0x8ae284){_0x48b4e0[_0x4330('0x17')]+=_0x8ae284['count'];return _[_0x4330('0x6e')](_0x8ae284[_0x4330('0x9f')],function(_0x526408){var _0x4eb975=_0x526408[_0x4330('0x3d')]({'plain':!![]});_0x4eb975[_0x4330('0xd0')]=_0x4f60c6;if(_0x4eb975[_0x4330('0xc5')]){_0x4eb975['User']={'id':_0x4eb975[_0x4330('0xc5')]['id'],'name':_0x4eb975[_0x4330('0xc5')]['name'],'fullname':_0x4eb975[_0x4330('0xc5')][_0x4330('0xe2')],'alias':_0x4eb975[_0x4330('0xc5')][_0x4330('0x33')]};}return _0x4eb975;});});}else{var _0x1b6b22=_[_0x4330('0xe3')](_0x4f60c6)+(_0x4f60c6===_0x4330('0xca')?'Website':_0x4330('0xe4'));var _0x18add8={'attributes':['id',_0x4330('0xe5'),_0x4330('0xe6'),_0x4330('0xde'),'note',_0x4330('0xe7'),_0x4330('0xe8'),_0x4330('0xe9'),_0x4330('0xdd'),_0x1b6b22+'Id'],'where':{'ContactId':_0x54bfc5[_0x4330('0x28')]['id']},'include':[{'model':db[_0x1b6b22],'as':'Account','attributes':['id',_0x4330('0x1f'),_0x4330('0xea')]},{'model':db['User'],'as':'Owner','attributes':['id',_0x4330('0x1f'),_0x4330('0xe2')]},{'model':db[_0x4330('0x66')],'as':_0x4330('0xeb'),'attributes':['id',_0x4330('0x1f'),_0x4330('0x67')],'through':{'attributes':[]}}],'order':[[_0x4330('0xde'),_0x4330('0xdf')]]};if(_0x54bfc5[_0x4330('0x24')][_0x4330('0xd3')]){_0x18add8[_0x4330('0x6b')]['createdAt']={'$gte':_0xc265f1[_0x4330('0x3c')],'$lte':_0xc265f1['to']};}switch(_0x4f60c6){case'chat':_0x18add8[_0x4330('0x7d')][_0x4330('0x62')](_0x4330('0xec'),_0x4330('0xed'),_0x4330('0xee'),'deviceModel',_0x4330('0xef'),'ratingMessage',_0x4330('0xf0'),_0x4330('0xf1'),'referer');break;case _0x4330('0xc9'):_0x18add8[_0x4330('0x7d')]['push'](_0x4330('0xf2'),_0x4330('0xf3'));break;case _0x4330('0xcb'):_0x18add8[_0x4330('0x7d')][_0x4330('0x62')]('externalUrl',_0x4330('0xf4'));break;}return db[_['startCase'](_0x4f60c6)+_0x4330('0xf5')][_0x4330('0xe1')](_0x18add8)['then'](function(_0x4e5b4d){_0x48b4e0['count']+=_0x4e5b4d[_0x4330('0x17')];return _[_0x4330('0x6e')](_0x4e5b4d['rows'],function(_0x5ba9e0){var _0x5aa9c7=_0x5ba9e0['get']({'plain':!![]});_0x5aa9c7['channel']=_0x4f60c6;if(_0x5aa9c7[_0x4330('0xf6')]){_0x5aa9c7['Owner']={'id':_0x5aa9c7[_0x4330('0xf6')]['id'],'name':_0x5aa9c7['Owner'][_0x4330('0x1f')],'fullname':_0x5aa9c7[_0x4330('0xf6')][_0x4330('0xe2')]};}return _0x5aa9c7;});});}});return Promise[_0x4330('0x64')](_0x2e85ec);})[_0x4330('0x22')](function(_0x1cd6bf){return _(_0x1cd6bf)[_0x4330('0xf7')]()['sortBy']('createdAt')[_0x4330('0xf8')]()[_0x4330('0xf9')]();})[_0x4330('0x22')](function(_0x4bfd01){_0x48b4e0[_0x4330('0x9f')]=_0x57057a[_0x4330('0x16')]?_0x4bfd01[_0x4330('0xfa')](_0x57057a[_0x4330('0x14')],_0x57057a[_0x4330('0x14')]+_0x57057a[_0x4330('0x16')]):_0x4bfd01;return _0x48b4e0;})[_0x4330('0x22')](respondWithFilteredResult(_0x4ee8ae,_0x57057a))['catch'](handleError(_0x4ee8ae,null));}; \ No newline at end of file +var _0xfa93=['setFields','toParam','phone','getTags','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','pick','filter','options','nolimit','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','sort','ContactId','rows','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','0777','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','json','error\x20child\x20process','importUpdates','fork','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','createdAt','DESC','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','threadId','Interaction','flatten','sortBy','reverse','value','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','describe','getOptions','findAll','query','user','catch','find','params','keys','startsWith','columnName','analytics','CmCustomField','cf_','alias','custom','type','forEach','merge','body','CmContact','from','length','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','where','ListId','findOrCreate','hasOwnProperty','push','contact','all','Tag','Tags','color','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','map','format','cf_%d','pickBy','table'];(function(_0x146711,_0x160ec6){var _0x101a19=function(_0xe6cb2a){while(--_0xe6cb2a){_0x146711['push'](_0x146711['shift']());}};_0x101a19(++_0x160ec6);}(_0xfa93,0x183));var _0x3fa9=function(_0xd4ff0f,_0x45a95a){_0xd4ff0f=_0xd4ff0f-0x0;var _0x5ce111=_0xfa93[_0xd4ff0f];return _0x5ce111;};'use strict';var moment=require(_0x3fa9('0x0'));var BPromise=require(_0x3fa9('0x1'));var util=require(_0x3fa9('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x3fa9('0x3'));var squel=require(_0x3fa9('0x4'));var Papa=require(_0x3fa9('0x5'));var Redis=require(_0x3fa9('0x6'));var contacts=require(_0x3fa9('0x7'));var qs=require(_0x3fa9('0x8'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var shared=require(_0x3fa9('0x9'));var db=require(_0x3fa9('0xa'))['db'];config['redis']=_['defaults'](config[_0x3fa9('0xb')],{'host':_0x3fa9('0xc'),'port':0x18eb});var socket=require(_0x3fa9('0xd'))(new Redis(config[_0x3fa9('0xb')]));require(_0x3fa9('0xe'))[_0x3fa9('0xf')](socket);function respondWithResult(_0x26118f,_0x2d6388){_0x2d6388=_0x2d6388||0xc8;return function(_0x246a17){if(_0x246a17){return _0x26118f[_0x3fa9('0x10')](_0x2d6388)['json'](_0x246a17);}};}function respondWithFilteredResult(_0x30e45d,_0x438c4d){return function(_0x36c163){if(_0x36c163){var _0x57c2aa=typeof _0x438c4d['offset']==='undefined'&&typeof _0x438c4d['limit']===_0x3fa9('0x11');var _0x22b16d=_0x36c163[_0x3fa9('0x12')];var _0x249bfe=_0x57c2aa?0x0:_0x438c4d[_0x3fa9('0x13')];var _0xd88594=_0x57c2aa?_0x36c163[_0x3fa9('0x12')]:_0x438c4d[_0x3fa9('0x13')]+_0x438c4d[_0x3fa9('0x14')];var _0x5fe48c;if(_0xd88594>=_0x22b16d){_0xd88594=_0x22b16d;_0x5fe48c=0xc8;}else{_0x5fe48c=0xce;}_0x30e45d[_0x3fa9('0x10')](_0x5fe48c);return _0x30e45d[_0x3fa9('0x15')](_0x3fa9('0x16'),_0x249bfe+'-'+_0xd88594+'/'+_0x22b16d)['json'](_0x36c163);}return null;};}function saveUpdates(_0x116172){return function(_0x1fa56b){if(_0x1fa56b){return _0x1fa56b[_0x3fa9('0x17')](_0x116172)[_0x3fa9('0x18')](function(_0x3b23a7){return _0x3b23a7;});}return null;};}function removeEntity(_0x5c6a34){return function(_0x5d496c){if(_0x5d496c){return _0x5d496c[_0x3fa9('0x19')]()['then'](function(){_0x5c6a34[_0x3fa9('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2816d2){return function(_0x536965){if(!_0x536965){_0x2816d2[_0x3fa9('0x1a')](0x194);}return _0x536965;};}function handleError(_0x10c0d5,_0x1b7896){_0x1b7896=_0x1b7896||0x1f4;return function(_0x77e5cc){logger[_0x3fa9('0x1b')](_0x77e5cc[_0x3fa9('0x1c')]);if(_0x77e5cc[_0x3fa9('0x1d')]){delete _0x77e5cc[_0x3fa9('0x1d')];}_0x10c0d5['status'](_0x1b7896)[_0x3fa9('0x1e')](_0x77e5cc);};}exports['index']=function(_0x6bc056,_0x3ab978){var _0x3335e3={};return contacts[_0x3fa9('0x1f')]()[_0x3fa9('0x18')](function(_0x4ab2b2){_0x3335e3=qs[_0x3fa9('0x20')](_0x4ab2b2,_0x6bc056);return contacts[_0x3fa9('0x21')](_0x6bc056[_0x3fa9('0x22')],_0x6bc056[_0x3fa9('0x23')],_0x3335e3,_0x4ab2b2);})[_0x3fa9('0x18')](respondWithFilteredResult(_0x3ab978,_0x3335e3))[_0x3fa9('0x24')](handleError(_0x3ab978,null));};exports['destroy']=function(_0x4a2d76,_0x5c9646){return db['CmContact'][_0x3fa9('0x25')]({'where':{'id':_0x4a2d76[_0x3fa9('0x26')]['id']}})['then'](handleEntityNotFound(_0x5c9646,null))[_0x3fa9('0x18')](removeEntity(_0x5c9646,null))[_0x3fa9('0x24')](handleError(_0x5c9646,null));};exports[_0x3fa9('0x1f')]=function(_0x370ddd,_0x350b50){return db['CmContact'][_0x3fa9('0x1f')]()[_0x3fa9('0x18')](function(_0x81eac2){delete _0x81eac2['tags'];for(var _0x4bca5b=0x0;_0x4bca5b0x0){return new Promise(function(_0x21c9d1){var _0x3f61b5=[];for(var _0x1d966f=0x0;_0x1d966f<_0x93105b['length'];_0x1d966f++){_0x3f61b5[_0x3fa9('0x60')](insertAdditionalPhones(_0x93105b[_0x1d966f][_0x3fa9('0x61')],_0x93105b[_0x1d966f][_0x3fa9('0x57')]));}Promise[_0x3fa9('0x62')](_0x3f61b5)[_0x3fa9('0x18')](function(){_0x21c9d1(0x1);});})[_0x3fa9('0x18')](function(){return{'success':_0x33ea43,'failure':_0x11edd0,'duplicates':_0x4693e7};});}else{return{'success':_0x33ea43,'failure':_0x11edd0,'duplicates':_0x4693e7};}}})[_0x3fa9('0x18')](respondWithResult(_0x23c84b,0xc9))[_0x3fa9('0x24')](handleError(_0x23c84b,null));};exports['show']=function(_0xf28e08,_0x7cc52c){var _0x531255;return db[_0x3fa9('0x33')][_0x3fa9('0x1f')]()['then'](function(_0x2bc3c2){return db['CmContact'][_0x3fa9('0x25')]({'where':{'id':_0xf28e08['params']['id']},'include':[{'model':db[_0x3fa9('0x63')],'as':_0x3fa9('0x64'),'attributes':['id',_0x3fa9('0x1d'),_0x3fa9('0x65')],'required':_0xf28e08[_0x3fa9('0x22')]['tag']?!![]:![]},{'model':db[_0x3fa9('0x66')],'as':_0x3fa9('0x67'),'where':{'CmContactId':_0xf28e08[_0x3fa9('0x26')]['id']},'required':![],'include':[{'model':db[_0x3fa9('0x68')],'as':_0x3fa9('0x69')}]}],'order':[db[_0x3fa9('0x6a')][_0x3fa9('0x6b')](_0x3fa9('0x6c'))],'attributes':_[_0x3fa9('0x27')](_0x2bc3c2)});})[_0x3fa9('0x18')](function(_0x488874){if(!_[_0x3fa9('0x53')](_0x488874)){_0x531255=_0x488874['get']({'plain':!![]});var _0x10b73e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x488874&&_0x488874['ListId']){if(_0x488874['ListId']){_0x10b73e[_0x3fa9('0x5c')][_0x3fa9('0x6d')][_0x3fa9('0x60')]({'ListId':{'$ne':_0x488874[_0x3fa9('0x5d')]}});}}return db[_0x3fa9('0x2b')][_0x3fa9('0x21')](_0x10b73e);}})[_0x3fa9('0x18')](function(_0x30eb81){if(!_[_0x3fa9('0x53')](_0x30eb81)){return _['omit'](_0x531255,_[_0x3fa9('0x6e')](_0x30eb81,function(_0x3e01f1){return util[_0x3fa9('0x6f')](_0x3fa9('0x70'),_0x3e01f1['id']);}));}})[_0x3fa9('0x18')](handleEntityNotFound(_0x7cc52c,null))[_0x3fa9('0x18')](respondWithResult(_0x7cc52c,null))['catch'](handleError(_0x7cc52c,null));};exports['update']=function(_0x3aa063,_0x19f407){var _0x33f316;if(_0x3aa063[_0x3fa9('0x32')]['id']){delete _0x3aa063['body']['id'];}if(!_[_0x3fa9('0x53')](_0x3aa063[_0x3fa9('0x32')][_0x3fa9('0x54')])){var _0x3cd6ae=_0x3aa063[_0x3fa9('0x32')]['dialTimezone'];if(!_[_0x3fa9('0x53')](shared['timezones'][_0x3cd6ae]))_0x3aa063[_0x3fa9('0x32')][_0x3fa9('0x56')]=shared[_0x3fa9('0x55')][_0x3cd6ae][_0x3fa9('0x56')];}return db['CmContact'][_0x3fa9('0x25')]({'where':{'id':_0x3aa063[_0x3fa9('0x26')]['id']}})['then'](handleEntityNotFound(_0x19f407,null))[_0x3fa9('0x18')](saveUpdates(_0x3aa063[_0x3fa9('0x32')],null))[_0x3fa9('0x18')](function(_0x4ab7fe){_0x33f316=_0x4ab7fe;var _0x465529={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4ab7fe&&_0x4ab7fe[_0x3fa9('0x5d')]){if(_0x4ab7fe[_0x3fa9('0x5d')]){_0x465529[_0x3fa9('0x5c')][_0x3fa9('0x6d')][_0x3fa9('0x60')]({'ListId':{'$ne':_0x4ab7fe[_0x3fa9('0x5d')]}});}}return db[_0x3fa9('0x2b')][_0x3fa9('0x21')](_0x465529);})[_0x3fa9('0x18')](function(_0x4d2c8b){if(_0x4d2c8b){return _['omit'](_[_0x3fa9('0x71')](_0x3aa063[_0x3fa9('0x32')],function(_0x510d5b,_0x3be40b){return _[_0x3fa9('0x28')](_0x3be40b,_0x3fa9('0x2c'));}),_[_0x3fa9('0x6e')](_0x4d2c8b,function(_0x17bab5){return util[_0x3fa9('0x6f')]('cf_%d',_0x17bab5['id']);}));}})['then'](function(_0x4000f0){if(_0x4000f0&&!_['isEmpty'](_0x4000f0)){var _0x405941=squel[_0x3fa9('0x17')]()[_0x3fa9('0x72')]('cm_contacts')[_0x3fa9('0x73')](_0x4000f0)[_0x3fa9('0x5c')]('id\x20=\x20?',_0x3aa063[_0x3fa9('0x26')]['id'])[_0x3fa9('0x74')]();return db[_0x3fa9('0x6a')][_0x3fa9('0x22')](_0x405941['text'],{'replacements':_0x405941['values']});}})[_0x3fa9('0x18')](function(){if(_0x3aa063[_0x3fa9('0x32')][_0x3fa9('0x75')]&&_0x33f316){return db['CmHopper'][_0x3fa9('0x17')]({'phone':_0x3aa063[_0x3fa9('0x32')][_0x3fa9('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x33f316['id']}});}})[_0x3fa9('0x18')](function(){return _0x33f316;})['then'](respondWithResult(_0x19f407,null))['catch'](handleError(_0x19f407,null));};exports[_0x3fa9('0x76')]=function(_0x33c972,_0x4a22a2){var _0x2d31db={};var _0x4aa5fb={};var _0x32ea04;var _0x494ac2;return db[_0x3fa9('0x33')][_0x3fa9('0x77')]({'where':{'id':_0x33c972['params']['id']}})[_0x3fa9('0x18')](handleEntityNotFound(_0x4a22a2,null))[_0x3fa9('0x18')](function(_0x444e2d){if(_0x444e2d){_0x32ea04=_0x444e2d;_0x4aa5fb[_0x3fa9('0x78')]=_[_0x3fa9('0x27')](db[_0x3fa9('0x63')][_0x3fa9('0x79')]);_0x4aa5fb[_0x3fa9('0x22')]=_['keys'](_0x33c972[_0x3fa9('0x22')]);_0x4aa5fb[_0x3fa9('0x7a')]=_['intersection'](_0x4aa5fb[_0x3fa9('0x78')],_0x4aa5fb[_0x3fa9('0x22')]);_0x2d31db[_0x3fa9('0x7b')]=_[_0x3fa9('0x7c')](_0x4aa5fb['model'],qs[_0x3fa9('0x7d')](_0x33c972[_0x3fa9('0x22')][_0x3fa9('0x7d')]));_0x2d31db['attributes']=_0x2d31db[_0x3fa9('0x7b')][_0x3fa9('0x35')]?_0x2d31db['attributes']:_0x4aa5fb['model'];_0x2d31db[_0x3fa9('0x7e')]=qs['sort'](_0x33c972[_0x3fa9('0x22')]['sort']);_0x2d31db[_0x3fa9('0x5c')]=qs[_0x3fa9('0x7a')](_[_0x3fa9('0x7f')](_0x33c972[_0x3fa9('0x22')],_0x4aa5fb[_0x3fa9('0x7a')]));if(_0x33c972['query'][_0x3fa9('0x80')]){_0x2d31db['where']=_[_0x3fa9('0x31')](_0x2d31db['where'],{'$or':_[_0x3fa9('0x6e')](_0x2d31db[_0x3fa9('0x7b')],function(_0x187ebb){var _0x52a429={};_0x52a429[_0x187ebb]={'$like':'%'+_0x33c972[_0x3fa9('0x22')][_0x3fa9('0x80')]+'%'};return _0x52a429;})});}_0x2d31db=_[_0x3fa9('0x31')]({},_0x2d31db,_0x33c972[_0x3fa9('0x81')]);return _0x32ea04[_0x3fa9('0x76')](_0x2d31db);}})[_0x3fa9('0x18')](function(_0xe0b04d){if(_0xe0b04d){_0x494ac2=_0xe0b04d['length'];if(!_0x33c972['query'][_0x3fa9('0x5f')](_0x3fa9('0x82'))){_0x2d31db[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x33c972['query'][_0x3fa9('0x14')]);_0x2d31db[_0x3fa9('0x13')]=qs[_0x3fa9('0x13')](_0x33c972['query'][_0x3fa9('0x13')]);}return _0x32ea04[_0x3fa9('0x76')](_0x2d31db);}})[_0x3fa9('0x18')](function(_0x552310){if(_0x552310){return _0x552310?{'count':_0x494ac2,'rows':_0x552310}:null;}})[_0x3fa9('0x18')](respondWithResult(_0x4a22a2,null))[_0x3fa9('0x24')](handleError(_0x4a22a2,null));};exports[_0x3fa9('0x83')]=function(_0x47fe70,_0x8da793){if(_0x47fe70[_0x3fa9('0x32')]['id']){delete _0x47fe70[_0x3fa9('0x32')]['id'];}return db[_0x3fa9('0x33')]['findOne']({'where':{'id':_0x47fe70[_0x3fa9('0x26')]['id']}})[_0x3fa9('0x18')](handleEntityNotFound(_0x8da793,null))[_0x3fa9('0x18')](function(_0x5b4df0){if(_0x5b4df0){return _0x5b4df0['setTags'](_0x47fe70['body'][_0x3fa9('0x84')]||[]);}return null;})[_0x3fa9('0x18')](respondWithResult(_0x8da793,null))[_0x3fa9('0x24')](handleError(_0x8da793,null));};exports['setAdditionalPhones']=function(_0x3e778c,_0x1ffddd){var _0x234178=[];_0x234178[_0x3fa9('0x60')](addAdditionalPhones(_0x3e778c['body']));Promise[_0x3fa9('0x62')](_0x234178)[_0x3fa9('0x18')](function(){_0x234178=[];_0x234178[_0x3fa9('0x60')](deleteCmHopperPhones(_0x3e778c[_0x3fa9('0x32')]['id']));_0x234178[_0x3fa9('0x60')](addCmHopperPhones(_0x3e778c[_0x3fa9('0x32')]['id']));Promise[_0x3fa9('0x62')](_0x234178)[_0x3fa9('0x18')](function(){return[0x1];})[_0x3fa9('0x18')](respondWithResult(_0x1ffddd,null));});};function addAdditionalPhones(_0x5433ee){var _0x40c3fd;return new Promise(function(_0x4acba7){return db[_0x3fa9('0x66')][_0x3fa9('0x19')]({'where':{'CmContactId':_0x5433ee['id']}})[_0x3fa9('0x18')](function(){db['ContactItemType'][_0x3fa9('0x21')]({'raw':!![],'attributes':['id',_0x3fa9('0x85')]})[_0x3fa9('0x18')](function(_0x44ff71){var _0xea3c47=[];for(var _0x2ebc3e=0x0;_0x2ebc3e<_0x5433ee[_0x3fa9('0x86')][_0x3fa9('0x35')];_0x2ebc3e++){var _0x5c173f=_0x5433ee['item_types']?_['isNil'](_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e])?'':_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e]:_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x88')]?_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x88')]:'';var _0x59227e=_['isNil'](_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x89')])?'':_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x89')];var _0x6d7512=_0x5c173f+':'+_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x75')]+'§'+_0x59227e;if(_[_0x3fa9('0x53')](_0x40c3fd))_0x40c3fd=_0x6d7512;else _0x40c3fd+=';'+_0x6d7512;var _0x199fcd=null;var _0x7cbade=null;if(_0x5433ee[_0x3fa9('0x87')]){if(!_[_0x3fa9('0x53')](_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e])){_0x7cbade=_[_0x3fa9('0x25')](_0x44ff71,function(_0xfaeeab){return _0xfaeeab['id']===_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e];});if(!_[_0x3fa9('0x53')](_0x7cbade)){_0x199fcd=_0x7cbade['OrderBy'];}}}else{if(!_[_0x3fa9('0x53')](_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e])){_0x7cbade=_[_0x3fa9('0x25')](_0x44ff71,function(_0x18fce8){return _0x18fce8['id']===_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x88')];});if(!_[_0x3fa9('0x53')](_0x7cbade)){_0x199fcd=_0x2ebc3e;}}}if(_[_0x3fa9('0x53')](_0x199fcd)){_0x199fcd=0x64;}_0xea3c47[_0x3fa9('0x60')](addAdditionalPhone(_0x5433ee['id'],_0x5433ee['items'][_0x2ebc3e][_0x3fa9('0x75')],_0x5433ee[_0x3fa9('0x87')]?_[_0x3fa9('0x53')](_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e])?null:_0x5433ee[_0x3fa9('0x87')][_0x2ebc3e]:_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x88')]?_0x5433ee[_0x3fa9('0x86')][_0x2ebc3e][_0x3fa9('0x88')]:null,_0x199fcd,_0x59227e));}Promise['all'](_0xea3c47)[_0x3fa9('0x18')](function(){db[_0x3fa9('0x33')][_0x3fa9('0x17')]({'AdditionalPhones':_0x40c3fd},{'where':{'id':_0x5433ee['id']}})[_0x3fa9('0x18')](function(){_0x4acba7(0x1);});});});});});}function addAdditionalPhone(_0x3f40af,_0x5b1d88,_0x16d36f,_0x493a2b,_0x44d47c){return db[_0x3fa9('0x66')][_0x3fa9('0x25')]({'where':{'CmContactId':_0x3f40af,'item':_0x5b1d88}})[_0x3fa9('0x18')](function(_0x143ec3){if(_0x143ec3)logger['info'](_0x3fa9('0x8a'),_0x143ec3);else{db[_0x3fa9('0x66')][_0x3fa9('0x40')]({'CmContactId':_0x3f40af,'item':_0x5b1d88,'ItemTypeId':_0x16d36f,'OrderBy':_0x493a2b,'ItemClass':'PHONE','description':_0x44d47c});}});}function deleteCmHopperPhones(_0x18c5d1){return new Promise(function(_0x960819){return db[_0x3fa9('0x3d')][_0x3fa9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x18c5d1}})[_0x3fa9('0x18')](function(_0x18fe81){db[_0x3fa9('0x8b')][_0x3fa9('0x19')]({'where':{'CmHopperId':{'$in':_[_0x3fa9('0x6e')](_0x18fe81,'id')}}});})[_0x3fa9('0x18')](function(){_0x960819(0x1);});});}function addCmHopperPhones(_0x39dd28){return new Promise(function(_0x2f0729){return db[_0x3fa9('0x3d')][_0x3fa9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x39dd28}})[_0x3fa9('0x18')](function(_0x1a7276){var _0x156bd3=[];_[_0x3fa9('0x6e')](_0x1a7276,function(_0x598073){_0x156bd3[_0x3fa9('0x60')](createCmHopperPhone(_0x39dd28,_0x598073['id']));});Promise[_0x3fa9('0x62')](_0x156bd3)[_0x3fa9('0x18')](function(){_0x2f0729(0x1);});});});}function createCmHopperPhone(_0x4b02db,_0x45fa24){return new Promise(function(_0x35bd72){db[_0x3fa9('0x66')][_0x3fa9('0x21')]({'raw':!![],'attributes':['item',_0x3fa9('0x85')],'where':{'CmContactId':_0x4b02db,'ItemClass':'PHONE'},'include':[{'model':db[_0x3fa9('0x68')],'attributes':['OrderBy'],'as':'ItemType'}],'order':['OrderBy',db[_0x3fa9('0x6a')][_0x3fa9('0x6b')](_0x3fa9('0x8c'))]})['then'](function(_0x46e2ac){var _0x435e19=0x1;var _0x5eebe0=_[_0x3fa9('0x6e')](_0x46e2ac,function(_0x5593bd){_0x5593bd[_0x3fa9('0x8d')]=_0x45fa24;_0x5593bd['phone']=_0x5593bd[_0x3fa9('0x8e')];_0x5593bd[_0x3fa9('0x85')]=_0x435e19;delete _0x5593bd[_0x3fa9('0x8f')];_0x435e19=_0x435e19+0x1;return _0x5593bd;});return db['CmHopperAdditionalPhone'][_0x3fa9('0x58')](_0x5eebe0,{});})[_0x3fa9('0x18')](function(){_0x35bd72(0x1);});});}function insertAdditionalPhones(_0x360a78,_0xbf019e){return new Promise(function(_0x55b097){var _0x5e90b2=[];for(var _0x2a3ef4=0x0;_0x2a3ef4<_0xbf019e[_0x3fa9('0x35')];_0x2a3ef4++){var _0x13261d=_0xbf019e[_0x2a3ef4];_0x5e90b2[_0x3fa9('0x60')](parseContactItemType(_0x13261d));}Promise[_0x3fa9('0x62')](_0x5e90b2)[_0x3fa9('0x18')](function(){var _0x390234={'id':_0x360a78['id'],'items':_0xbf019e};return addAdditionalPhones(_0x390234)['then'](function(){return addCmHopperPhones(_0x360a78['id']);});})[_0x3fa9('0x18')](function(){_0x55b097(_0x360a78);});});}function parseContactItemType(_0x17d304){return new Promise(function(_0x480522){if(_0x17d304[_0x3fa9('0x5f')]('ItemTypeId')){_0x480522(_0x17d304);}else{return db[_0x3fa9('0x68')][_0x3fa9('0x25')]({'where':{'name':_0x17d304[_0x3fa9('0x69')]}})[_0x3fa9('0x18')](function(_0x509df6){if(_['isNil'](_0x509df6))_0x17d304[_0x3fa9('0x88')]=null;else _0x17d304[_0x3fa9('0x88')]=_0x509df6['id'];_0x480522(_0x17d304);});}});}exports[_0x3fa9('0x90')]=function(_0x4312ef,_0x2b316a){return db['CmContactHasItem'][_0x3fa9('0x21')]({'raw':!![],'where':{'CmContactId':_0x4312ef[_0x3fa9('0x26')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x3fa9('0x68')],'as':_0x3fa9('0x69')}],'order':[[_0x3fa9('0x85')],[db[_0x3fa9('0x6a')][_0x3fa9('0x6b')](_0x3fa9('0x8c'))]]})[_0x3fa9('0x18')](function(_0x12e0c7){return _0x12e0c7;})[_0x3fa9('0x18')](respondWithResult(_0x2b316a,null))[_0x3fa9('0x24')](handleError(_0x2b316a,null));};exports[_0x3fa9('0x91')]=function(_0x5d7538,_0x1f2602){return db[_0x3fa9('0x66')][_0x3fa9('0x21')]({'raw':!![],'where':{'CmContactId':_0x5d7538[_0x3fa9('0x32')][_0x3fa9('0x92')]}})[_0x3fa9('0x18')](function(_0x553144){var _0x354196=_[_0x3fa9('0x6e')](_0x553144,function(_0x420f04){_0x420f04[_0x3fa9('0x93')]=_0x5d7538[_0x3fa9('0x32')][_0x3fa9('0x94')];return _0x420f04;});return db[_0x3fa9('0x66')][_0x3fa9('0x58')](_0x354196,{});})[_0x3fa9('0x18')](function(){return addCmHopperPhones(_0x5d7538[_0x3fa9('0x32')][_0x3fa9('0x94')]);})[_0x3fa9('0x18')](function(){return['ok'];})[_0x3fa9('0x18')](respondWithResult(_0x1f2602,null))[_0x3fa9('0x24')](handleError(_0x1f2602,null));};exports[_0x3fa9('0x95')]=function(_0x19db34,_0x19468d){var _0x4cfcd9=[];_0x4cfcd9[_0x3fa9('0x60')](createCmHopperPhone(_0x19db34['body']['id'],_0x19db34['body']['hopperId']));Promise[_0x3fa9('0x62')](_0x4cfcd9)['then'](function(){return[0x1];})[_0x3fa9('0x18')](respondWithResult(_0x19468d,null));};exports[_0x3fa9('0x96')]=function(_0x269d65,_0x3d28ed){var _0x1e6b92={'raw':![],'where':{}};var _0x3bfdaf={};var _0x7647c8={'count':0x0,'rows':[]};return db[_0x3fa9('0x33')][_0x3fa9('0x77')]({'where':{'id':_0x269d65['params']['id']}})[_0x3fa9('0x18')](handleEntityNotFound(_0x3d28ed,null))[_0x3fa9('0x18')](function(_0x28b07c){if(_0x28b07c){_0x3bfdaf[_0x3fa9('0x78')]=_[_0x3fa9('0x27')](db[_0x3fa9('0x3d')]['rawAttributes']);_0x3bfdaf[_0x3fa9('0x22')]=_['keys'](_0x269d65['query']);_0x3bfdaf[_0x3fa9('0x7a')]=_[_0x3fa9('0x7c')](_0x3bfdaf['model'],_0x3bfdaf[_0x3fa9('0x22')]);_0x1e6b92[_0x3fa9('0x7b')]=_[_0x3fa9('0x7c')](_0x3bfdaf[_0x3fa9('0x78')],qs['fields'](_0x269d65[_0x3fa9('0x22')][_0x3fa9('0x7d')]));_0x1e6b92[_0x3fa9('0x7b')]=_0x1e6b92[_0x3fa9('0x7b')][_0x3fa9('0x35')]?_0x1e6b92[_0x3fa9('0x7b')]:_0x3bfdaf[_0x3fa9('0x78')];if(!_0x269d65[_0x3fa9('0x22')][_0x3fa9('0x5f')](_0x3fa9('0x82'))){_0x1e6b92[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x269d65[_0x3fa9('0x22')]['limit']);_0x1e6b92[_0x3fa9('0x13')]=qs[_0x3fa9('0x13')](_0x269d65[_0x3fa9('0x22')][_0x3fa9('0x13')]);}_0x1e6b92[_0x3fa9('0x7e')]=qs[_0x3fa9('0x97')](_0x269d65[_0x3fa9('0x22')][_0x3fa9('0x97')]);_0x1e6b92['where']=qs[_0x3fa9('0x7a')](_[_0x3fa9('0x7f')](_0x269d65[_0x3fa9('0x22')],_0x3bfdaf[_0x3fa9('0x7a')]));_0x1e6b92['where'][_0x3fa9('0x98')]=_0x28b07c['id'];if(_0x269d65['query'][_0x3fa9('0x80')]){_0x1e6b92['where']=_[_0x3fa9('0x31')](_0x1e6b92[_0x3fa9('0x5c')],{'$or':_[_0x3fa9('0x6e')](_0x1e6b92[_0x3fa9('0x7b')],function(_0x58a1a4){var _0x3b206f={};_0x3b206f[_0x58a1a4]={'$like':'%'+_0x269d65[_0x3fa9('0x22')][_0x3fa9('0x80')]+'%'};return _0x3b206f;})});}_0x1e6b92=_[_0x3fa9('0x31')]({},_0x1e6b92,_0x269d65[_0x3fa9('0x81')]);return db[_0x3fa9('0x3d')][_0x3fa9('0x12')]({'where':_0x1e6b92[_0x3fa9('0x5c')]})['then'](function(_0x510887){_0x7647c8[_0x3fa9('0x12')]=_0x510887;if(_0x269d65[_0x3fa9('0x22')]['includeAll']){_0x1e6b92['include']=[{'all':!![]}];}return db['CmHopper'][_0x3fa9('0x21')](_0x1e6b92);})[_0x3fa9('0x18')](function(_0x502ed7){_0x7647c8[_0x3fa9('0x99')]=_0x502ed7;return _0x7647c8;});}})[_0x3fa9('0x18')](respondWithFilteredResult(_0x3d28ed,_0x1e6b92))[_0x3fa9('0x24')](handleError(_0x3d28ed,null));};exports[_0x3fa9('0x9a')]=function(_0x1750f3,_0x2f5c17){var _0x42ba1f={'raw':!![],'where':{}};var _0x2b2e5d={};var _0x365d79={'count':0x0,'rows':[]};return db[_0x3fa9('0x33')][_0x3fa9('0x77')]({'where':{'id':_0x1750f3[_0x3fa9('0x26')]['id']}})[_0x3fa9('0x18')](handleEntityNotFound(_0x2f5c17,null))[_0x3fa9('0x18')](function(_0x3314c4){if(_0x3314c4){_0x2b2e5d[_0x3fa9('0x78')]=_[_0x3fa9('0x27')](db[_0x3fa9('0x9b')]['rawAttributes']);_0x2b2e5d['query']=_[_0x3fa9('0x27')](_0x1750f3['query']);_0x2b2e5d[_0x3fa9('0x7a')]=_['intersection'](_0x2b2e5d[_0x3fa9('0x78')],_0x2b2e5d[_0x3fa9('0x22')]);_0x42ba1f[_0x3fa9('0x7b')]=_[_0x3fa9('0x7c')](_0x2b2e5d[_0x3fa9('0x78')],qs[_0x3fa9('0x7d')](_0x1750f3[_0x3fa9('0x22')]['fields']));_0x42ba1f['attributes']=_0x42ba1f['attributes'][_0x3fa9('0x35')]?_0x42ba1f[_0x3fa9('0x7b')]:_0x2b2e5d[_0x3fa9('0x78')];if(!_0x1750f3[_0x3fa9('0x22')][_0x3fa9('0x5f')]('nolimit')){_0x42ba1f[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x1750f3['query'][_0x3fa9('0x14')]);_0x42ba1f[_0x3fa9('0x13')]=qs[_0x3fa9('0x13')](_0x1750f3[_0x3fa9('0x22')][_0x3fa9('0x13')]);}_0x42ba1f[_0x3fa9('0x7e')]=qs['sort'](_0x1750f3[_0x3fa9('0x22')][_0x3fa9('0x97')]);_0x42ba1f[_0x3fa9('0x5c')]=qs[_0x3fa9('0x7a')](_[_0x3fa9('0x7f')](_0x1750f3[_0x3fa9('0x22')],_0x2b2e5d[_0x3fa9('0x7a')]));_0x42ba1f[_0x3fa9('0x5c')][_0x3fa9('0x98')]=_0x3314c4['id'];if(_0x1750f3[_0x3fa9('0x22')]['filter']){_0x42ba1f[_0x3fa9('0x5c')]=_['merge'](_0x42ba1f[_0x3fa9('0x5c')],{'$or':_[_0x3fa9('0x6e')](_0x42ba1f[_0x3fa9('0x7b')],function(_0x4ada14){var _0x4ce3b0={};_0x4ce3b0[_0x4ada14]={'$like':'%'+_0x1750f3['query'][_0x3fa9('0x80')]+'%'};return _0x4ce3b0;})});}_0x42ba1f=_[_0x3fa9('0x31')]({},_0x42ba1f,_0x1750f3[_0x3fa9('0x81')]);return db[_0x3fa9('0x9b')]['count']({'where':_0x42ba1f[_0x3fa9('0x5c')]})['then'](function(_0xc6e0b9){_0x365d79[_0x3fa9('0x12')]=_0xc6e0b9;if(_0x1750f3[_0x3fa9('0x22')][_0x3fa9('0x9c')]){_0x42ba1f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3fa9('0x21')](_0x42ba1f);})[_0x3fa9('0x18')](function(_0x4c450e){_0x365d79[_0x3fa9('0x99')]=_0x4c450e;return _0x365d79;});}})[_0x3fa9('0x18')](respondWithFilteredResult(_0x2f5c17,_0x42ba1f))['catch'](handleError(_0x2f5c17,null));};exports[_0x3fa9('0x9d')]=function(_0x34aa51,_0x1a107b){var _0x76161f={'raw':!![],'where':{}};var _0x3e0e8a={};var _0x5ccb0e={'count':0x0,'rows':[]};return db[_0x3fa9('0x33')][_0x3fa9('0x77')]({'where':{'id':_0x34aa51[_0x3fa9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1a107b,null))['then'](function(_0x42657e){if(_0x42657e){_0x3e0e8a[_0x3fa9('0x78')]=_[_0x3fa9('0x27')](db[_0x3fa9('0x4a')][_0x3fa9('0x79')]);_0x3e0e8a['query']=_[_0x3fa9('0x27')](_0x34aa51[_0x3fa9('0x22')]);_0x3e0e8a[_0x3fa9('0x7a')]=_[_0x3fa9('0x7c')](_0x3e0e8a[_0x3fa9('0x78')],_0x3e0e8a[_0x3fa9('0x22')]);_0x76161f[_0x3fa9('0x7b')]=_[_0x3fa9('0x7c')](_0x3e0e8a[_0x3fa9('0x78')],qs['fields'](_0x34aa51[_0x3fa9('0x22')]['fields']));_0x76161f[_0x3fa9('0x7b')]=_0x76161f['attributes'][_0x3fa9('0x35')]?_0x76161f[_0x3fa9('0x7b')]:_0x3e0e8a[_0x3fa9('0x78')];if(!_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x5f')]('nolimit')){_0x76161f[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x14')]);_0x76161f[_0x3fa9('0x13')]=qs['offset'](_0x34aa51[_0x3fa9('0x22')]['offset']);}_0x76161f['order']=qs[_0x3fa9('0x97')](_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x97')]);_0x76161f[_0x3fa9('0x5c')]=qs[_0x3fa9('0x7a')](_['pick'](_0x34aa51[_0x3fa9('0x22')],_0x3e0e8a[_0x3fa9('0x7a')]));_0x76161f['where'][_0x3fa9('0x98')]=_0x42657e['id'];if(_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x80')]){_0x76161f[_0x3fa9('0x5c')]=_[_0x3fa9('0x31')](_0x76161f[_0x3fa9('0x5c')],{'$or':_[_0x3fa9('0x6e')](_0x76161f['attributes'],function(_0x487dc){var _0x4d55cb={};_0x4d55cb[_0x487dc]={'$like':'%'+_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x80')]+'%'};return _0x4d55cb;})});}_0x76161f=_[_0x3fa9('0x31')]({},_0x76161f,_0x34aa51[_0x3fa9('0x81')]);return db[_0x3fa9('0x4a')][_0x3fa9('0x12')]({'where':_0x76161f[_0x3fa9('0x5c')]})[_0x3fa9('0x18')](function(_0xff0412){_0x5ccb0e[_0x3fa9('0x12')]=_0xff0412;if(_0x34aa51[_0x3fa9('0x22')][_0x3fa9('0x9c')]){_0x76161f[_0x3fa9('0x9e')]=[{'all':!![]}];}return db[_0x3fa9('0x4a')][_0x3fa9('0x21')](_0x76161f);})['then'](function(_0x17b5cb){_0x5ccb0e[_0x3fa9('0x99')]=_0x17b5cb;return _0x5ccb0e;});}})[_0x3fa9('0x18')](respondWithFilteredResult(_0x1a107b,_0x76161f))[_0x3fa9('0x24')](handleError(_0x1a107b,null));};exports[_0x3fa9('0x9f')]=function(_0x5e18f0,_0xecfcaa){var _0xdb5965={'raw':!![],'where':{}};var _0x10b05d={};var _0x344fa7={'count':0x0,'rows':[]};return db[_0x3fa9('0x33')][_0x3fa9('0x77')]({'where':{'id':_0x5e18f0[_0x3fa9('0x26')]['id']}})['then'](handleEntityNotFound(_0xecfcaa,null))[_0x3fa9('0x18')](function(_0x413b55){if(_0x413b55){_0x10b05d[_0x3fa9('0x78')]=_[_0x3fa9('0x27')](db['JscriptySessionReport'][_0x3fa9('0x79')]);_0x10b05d['query']=_[_0x3fa9('0x27')](_0x5e18f0[_0x3fa9('0x22')]);_0x10b05d['filters']=_[_0x3fa9('0x7c')](_0x10b05d[_0x3fa9('0x78')],_0x10b05d[_0x3fa9('0x22')]);_0xdb5965[_0x3fa9('0x7b')]=_['intersection'](_0x10b05d[_0x3fa9('0x78')],qs[_0x3fa9('0x7d')](_0x5e18f0[_0x3fa9('0x22')][_0x3fa9('0x7d')]));_0xdb5965[_0x3fa9('0x7b')]=_0xdb5965['attributes'][_0x3fa9('0x35')]?_0xdb5965[_0x3fa9('0x7b')]:_0x10b05d['model'];if(!_0x5e18f0[_0x3fa9('0x22')][_0x3fa9('0x5f')](_0x3fa9('0x82'))){_0xdb5965[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x5e18f0['query'][_0x3fa9('0x14')]);_0xdb5965[_0x3fa9('0x13')]=qs[_0x3fa9('0x13')](_0x5e18f0[_0x3fa9('0x22')]['offset']);}_0xdb5965['order']=qs[_0x3fa9('0x97')](_0x5e18f0['query']['sort']);_0xdb5965['where']=qs[_0x3fa9('0x7a')](_[_0x3fa9('0x7f')](_0x5e18f0[_0x3fa9('0x22')],_0x10b05d['filters']));_0xdb5965[_0x3fa9('0x5c')]['ContactId']=_0x413b55['id'];if(_0x5e18f0[_0x3fa9('0x22')][_0x3fa9('0x80')]){_0xdb5965[_0x3fa9('0x5c')]=_['merge'](_0xdb5965[_0x3fa9('0x5c')],{'$or':_[_0x3fa9('0x6e')](_0xdb5965[_0x3fa9('0x7b')],function(_0x12d311){var _0xab2bf8={};_0xab2bf8[_0x12d311]={'$like':'%'+_0x5e18f0[_0x3fa9('0x22')][_0x3fa9('0x80')]+'%'};return _0xab2bf8;})});}_0xdb5965=_[_0x3fa9('0x31')]({},_0xdb5965,_0x5e18f0[_0x3fa9('0x81')]);return db[_0x3fa9('0x51')]['count']({'where':_0xdb5965[_0x3fa9('0x5c')]})[_0x3fa9('0x18')](function(_0x4c47b1){_0x344fa7[_0x3fa9('0x12')]=_0x4c47b1;if(_0x5e18f0[_0x3fa9('0x22')]['includeAll']){_0xdb5965[_0x3fa9('0x9e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3fa9('0x21')](_0xdb5965);})[_0x3fa9('0x18')](function(_0x481472){_0x344fa7['rows']=_0x481472;return _0x344fa7;});}})[_0x3fa9('0x18')](respondWithFilteredResult(_0xecfcaa,_0xdb5965))[_0x3fa9('0x24')](handleError(_0xecfcaa,null));};exports[_0x3fa9('0xa0')]=function(_0x2cce2b,_0x4d3ba9){try{if(!_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0x5d')]){throw new Error(_0x3fa9('0xa1'));}if(!_0x2cce2b[_0x3fa9('0x32')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa2')]){throw new Error(_0x3fa9('0xa3'));}if(!_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4f4844=_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa5')][_0x3fa9('0xa6')](',');var _0x3cf240=_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa2')][_0x3fa9('0xa6')](',');if(!_0x4f4844[_0x3fa9('0x35')]||!_0x3cf240[_0x3fa9('0x35')]||_0x4f4844[_0x3fa9('0x35')]!==_0x3cf240[_0x3fa9('0x35')]){throw new Error(_0x3fa9('0xa7'));}_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0x7d')]=_[_0x3fa9('0xa8')](_0x4f4844,_0x3cf240);if(!_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0x7d')][_0x3fa9('0x75')]){throw new Error(_0x3fa9('0xa9'));}if(!_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0x7d')][_0x3fa9('0xaa')]){throw new Error(_0x3fa9('0xab'));}var _0x43c8d7=path[_0x3fa9('0x3a')](config['root'],'server/files/tmp',_0x2cce2b[_0x3fa9('0xac')][_0x3fa9('0xad')]);fs[_0x3fa9('0xae')](_0x43c8d7,parseInt(_0x3fa9('0xaf'),0x8));var _0x43c15b=require(_0x3fa9('0xb0'))['fork'](path[_0x3fa9('0x3a')](__dirname,'../../components/import/cm/csv'),[_0x43c8d7,_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa5')],_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa2')],_0x2cce2b['body'][_0x3fa9('0x5d')],_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xb1')],_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0x5a')],_0x2cce2b[_0x3fa9('0x32')][_0x3fa9('0xa4')]]);return _0x4d3ba9[_0x3fa9('0x10')](0xc8)['json']({'message':_0x3fa9('0xb2'),'pid':_0x43c15b[_0x3fa9('0xb3')]});}catch(_0x48856c){return _0x4d3ba9[_0x3fa9('0x10')](0x1f4)['send'](_0x48856c);}};exports[_0x3fa9('0xb4')]=function(_0x5b54fe,_0x7b26bd){var _0x19aa47=fs[_0x3fa9('0xb5')](_0x5b54fe[_0x3fa9('0xac')][_0x3fa9('0xb6')]);Papa[_0x3fa9('0xb7')](_0x19aa47,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x155d7c){return _0x7b26bd['status'](0xc8)['json']({'file':_0x5b54fe['file'],'fields':_0x155d7c['meta'][_0x3fa9('0x7d')]});}});};exports[_0x3fa9('0xb8')]=function(_0x40cee7,_0x518672){return db[_0x3fa9('0xb9')][_0x3fa9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3fa9('0xba')}})['then'](function(_0x3329f1){var _0x3b71c3=![];if(!_0x40cee7[_0x3fa9('0x32')][_0x3fa9('0x5d')]){throw new Error(_0x3fa9('0xa1'));}if(!_0x40cee7[_0x3fa9('0x32')]['binding'][_0x3fa9('0x75')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x40cee7[_0x3fa9('0x32')][_0x3fa9('0xbb')][_0x3fa9('0xaa')]){throw new Error(_0x3fa9('0xab'));}if(!_0x40cee7['body'][_0x3fa9('0xa4')]){throw new Error(_0x3fa9('0xbc'));}var _0x283e87=require('child_process')['fork'](path[_0x3fa9('0x3a')](__dirname,_0x3fa9('0xbd')),[_0x40cee7['params']['id'],JSON[_0x3fa9('0xbe')](_0x40cee7[_0x3fa9('0x32')]),JSON[_0x3fa9('0xbe')](_0x3329f1)]);_0x283e87['on'](_0x3fa9('0xbf'),function(){_0x3b71c3=!![];return _0x518672[_0x3fa9('0x10')](0xc8)[_0x3fa9('0xc0')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x283e87[_0x3fa9('0xb3')]});});_0x283e87['on']('exit',function(_0x58d44d){if(_0x58d44d&&!_0x3b71c3){return _0x518672['status'](0x1f4)[_0x3fa9('0xc0')]({'message':_0x3fa9('0xc1'),'pid':_0x283e87[_0x3fa9('0xb3')]});}});})['catch'](handleError(_0x518672,null));};exports[_0x3fa9('0xc2')]=function(_0x1f65c4,_0x1e2599){return db['User'][_0x3fa9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3fa9('0xba')}})['then'](function(_0x49211e){var _0x4ece3d=![];if(!_0x1f65c4[_0x3fa9('0x32')][_0x3fa9('0x5d')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1f65c4[_0x3fa9('0x32')][_0x3fa9('0xbb')][_0x3fa9('0x75')]){throw new Error(_0x3fa9('0xa9'));}if(!_0x1f65c4['body']['binding'][_0x3fa9('0xaa')]){throw new Error(_0x3fa9('0xab'));}if(!_0x1f65c4[_0x3fa9('0x32')][_0x3fa9('0xa4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x9c2449=require(_0x3fa9('0xb0'))[_0x3fa9('0xc3')](path[_0x3fa9('0x3a')](__dirname,_0x3fa9('0xc4')),[_0x1f65c4['params']['id'],JSON[_0x3fa9('0xbe')](_0x1f65c4['body']),JSON['stringify'](_0x49211e)]);_0x9c2449['on']('message',function(){_0x4ece3d=!![];return _0x1e2599[_0x3fa9('0x10')](0xc8)[_0x3fa9('0xc0')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x9c2449['pid']});});_0x9c2449['on'](_0x3fa9('0xc5'),function(_0x173e9c){if(_0x173e9c&&!_0x4ece3d){return _0x1e2599[_0x3fa9('0x10')](0x1f4)[_0x3fa9('0xc0')]({'message':_0x3fa9('0xc1'),'pid':_0x9c2449[_0x3fa9('0xb3')]});}});})[_0x3fa9('0x24')](handleError(_0x1e2599,null));};exports[_0x3fa9('0xc6')]=function(_0x5bb97a,_0x2e0224){var _0x22756a=[_0x3fa9('0xc7'),_0x3fa9('0xc8'),_0x3fa9('0xc9'),_0x3fa9('0xca'),'fax',_0x3fa9('0xcb'),_0x3fa9('0xcc')];var _0x27d2f1={'offset':0x0,'order':qs[_0x3fa9('0x97')](_0x3fa9('0xcd'))},_0x4f0e60={'count':0x0,'rows':[]};Promise['resolve']()[_0x3fa9('0x18')](function(){if(_0x5bb97a['query'][_0x3fa9('0xce')]){if(!_[_0x3fa9('0xcf')](_0x22756a,_0x5bb97a[_0x3fa9('0x22')]['channel'][_0x3fa9('0xd0')]())){throw new Error('Invalid\x20channel');}_0x22756a=[_0x5bb97a['query'][_0x3fa9('0xce')][_0x3fa9('0xd0')]()];}if(_0x5bb97a[_0x3fa9('0x22')][_0x3fa9('0xd1')]){try{var _0x25362e=JSON[_0x3fa9('0xb7')](_0x5bb97a[_0x3fa9('0x22')]['range']);if(!moment(_0x25362e[_0x3fa9('0x34')])['isValid']()){throw new Error(_0x3fa9('0xd2'));}if(!moment(_0x25362e['to'])[_0x3fa9('0xd3')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x4df7bd){throw new Error(_0x3fa9('0xd4'));}}if(!_0x5bb97a['query'][_0x3fa9('0x5f')](_0x3fa9('0x82'))){_0x27d2f1[_0x3fa9('0x14')]=qs[_0x3fa9('0x14')](_0x5bb97a[_0x3fa9('0x22')][_0x3fa9('0x14')]||0xa);_0x27d2f1[_0x3fa9('0x13')]=qs[_0x3fa9('0x13')](_0x5bb97a[_0x3fa9('0x22')][_0x3fa9('0x13')]);}var _0x2fa206=_0x22756a[_0x3fa9('0x6e')](function(_0x4e1062){if(_0x4e1062==='voice'){var _0x574290={'attributes':['id',_0x3fa9('0xd5'),_0x3fa9('0x2f'),'source','destination','callerid',_0x3fa9('0xd6'),_0x3fa9('0xd7'),_0x3fa9('0xd8'),_0x3fa9('0xd9'),'createdAt',_0x3fa9('0xda'),_0x3fa9('0xdb'),_0x3fa9('0xdc'),'UserId'],'where':{'ContactId':_0x5bb97a[_0x3fa9('0x26')]['id']},'include':[{'model':db['User'],'as':_0x3fa9('0xb9'),'attributes':['id',_0x3fa9('0x1d'),_0x3fa9('0xdd'),_0x3fa9('0x2d')]}],'order':[[_0x3fa9('0xde'),_0x3fa9('0xdf')]]};if(_0x5bb97a[_0x3fa9('0x22')][_0x3fa9('0xd1')]){_0x574290[_0x3fa9('0x5c')][_0x3fa9('0xde')]={'$gte':_0x25362e[_0x3fa9('0x34')],'$lte':_0x25362e['to']};}return db[_0x3fa9('0x4c')]['findAndCountAll'](_0x574290)[_0x3fa9('0x18')](function(_0x17acc1){_0x4f0e60[_0x3fa9('0x12')]+=_0x17acc1[_0x3fa9('0x12')];return _[_0x3fa9('0x6e')](_0x17acc1[_0x3fa9('0x99')],function(_0x247a54){var _0x144936=_0x247a54[_0x3fa9('0x36')]({'plain':!![]});_0x144936[_0x3fa9('0xce')]=_0x4e1062;if(_0x144936[_0x3fa9('0xb9')]){_0x144936['User']={'id':_0x144936[_0x3fa9('0xb9')]['id'],'name':_0x144936[_0x3fa9('0xb9')][_0x3fa9('0x1d')],'fullname':_0x144936['User'][_0x3fa9('0xdd')],'alias':_0x144936[_0x3fa9('0xb9')][_0x3fa9('0x2d')]};}return _0x144936;});});}else{var _0x276703=_[_0x3fa9('0xe0')](_0x4e1062)+(_0x4e1062==='chat'?_0x3fa9('0xe1'):_0x3fa9('0xe2'));var _0x26abf={'attributes':['id',_0x3fa9('0xe3'),_0x3fa9('0xe4'),'createdAt',_0x3fa9('0xd9'),_0x3fa9('0xe5'),_0x3fa9('0xe6'),_0x3fa9('0xe7'),_0x3fa9('0xe8'),_0x276703+'Id'],'where':{'ContactId':_0x5bb97a['params']['id']},'include':[{'model':db[_0x276703],'as':_0x3fa9('0xe2'),'attributes':['id',_0x3fa9('0x1d'),'key']},{'model':db['User'],'as':_0x3fa9('0xe9'),'attributes':['id',_0x3fa9('0x1d'),'fullname']},{'model':db['Tag'],'as':_0x3fa9('0x64'),'attributes':['id',_0x3fa9('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x3fa9('0xde'),_0x3fa9('0xdf')]]};if(_0x5bb97a[_0x3fa9('0x22')][_0x3fa9('0xd1')]){_0x26abf['where'][_0x3fa9('0xde')]={'$gte':_0x25362e[_0x3fa9('0x34')],'$lte':_0x25362e['to']};}switch(_0x4e1062){case _0x3fa9('0xc8'):_0x26abf[_0x3fa9('0x7b')]['push'](_0x3fa9('0xea'),_0x3fa9('0xeb'),_0x3fa9('0xec'),_0x3fa9('0xed'),_0x3fa9('0xee'),_0x3fa9('0xef'),_0x3fa9('0xf0'),_0x3fa9('0xf1'),_0x3fa9('0xf2'));break;case'mail':_0x26abf[_0x3fa9('0x7b')][_0x3fa9('0x60')](_0x3fa9('0xf3'),_0x3fa9('0xf4'));break;case'openchannel':_0x26abf[_0x3fa9('0x7b')]['push']('externalUrl',_0x3fa9('0xf5'));break;}return db[_[_0x3fa9('0xe0')](_0x4e1062)+_0x3fa9('0xf6')]['findAndCountAll'](_0x26abf)[_0x3fa9('0x18')](function(_0xba152e){_0x4f0e60[_0x3fa9('0x12')]+=_0xba152e[_0x3fa9('0x12')];return _[_0x3fa9('0x6e')](_0xba152e[_0x3fa9('0x99')],function(_0x5c05db){var _0x221c97=_0x5c05db['get']({'plain':!![]});_0x221c97[_0x3fa9('0xce')]=_0x4e1062;if(_0x221c97[_0x3fa9('0xe9')]){_0x221c97[_0x3fa9('0xe9')]={'id':_0x221c97['Owner']['id'],'name':_0x221c97[_0x3fa9('0xe9')][_0x3fa9('0x1d')],'fullname':_0x221c97[_0x3fa9('0xe9')][_0x3fa9('0xdd')]};}return _0x221c97;});});}});return Promise[_0x3fa9('0x62')](_0x2fa206);})[_0x3fa9('0x18')](function(_0x515303){return _(_0x515303)[_0x3fa9('0xf7')]()[_0x3fa9('0xf8')](_0x3fa9('0xde'))[_0x3fa9('0xf9')]()[_0x3fa9('0xfa')]();})[_0x3fa9('0x18')](function(_0x3b55a2){_0x4f0e60[_0x3fa9('0x99')]=_0x27d2f1[_0x3fa9('0x14')]?_0x3b55a2['slice'](_0x27d2f1[_0x3fa9('0x13')],_0x27d2f1[_0x3fa9('0x13')]+_0x27d2f1['limit']):_0x3b55a2;return _0x4f0e60;})[_0x3fa9('0x18')](respondWithFilteredResult(_0x2e0224,_0x27d2f1))[_0x3fa9('0x24')](handleError(_0x2e0224,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index d672c28..5ee9104 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6558=['remove','emit','hook','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x3ecbd4,_0x29c8ea){var _0x266209=function(_0x394cee){while(--_0x394cee){_0x3ecbd4['push'](_0x3ecbd4['shift']());}};_0x266209(++_0x29c8ea);}(_0x6558,0xd2));var _0x8655=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x6558[_0x368bba];return _0x409f8f;};'use strict';var EventEmitter=require(_0x8655('0x0'));var CmContact=require(_0x8655('0x1'))['db'][_0x8655('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8655('0x3')](0x0);var events={'afterCreate':_0x8655('0x4'),'afterUpdate':_0x8655('0x5'),'afterDestroy':_0x8655('0x6')};function emitEvent(_0x567be5){return function(_0x2e80c3,_0x54ba60,_0x505cd4){CmContactEvents[_0x8655('0x7')](_0x567be5+':'+_0x2e80c3['id'],_0x2e80c3);CmContactEvents['emit'](_0x567be5,_0x2e80c3);_0x505cd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x8655('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x8c28=['CmContact','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x37bb50,_0x307c14){var _0x183cc4=function(_0x2baf80){while(--_0x2baf80){_0x37bb50['push'](_0x37bb50['shift']());}};_0x183cc4(++_0x307c14);}(_0x8c28,0x106));var _0x88c2=function(_0x34900,_0x2c3e4e){_0x34900=_0x34900-0x0;var _0x1a4d59=_0x8c28[_0x34900];return _0x1a4d59;};'use strict';var EventEmitter=require(_0x88c2('0x0'));var CmContact=require(_0x88c2('0x1'))['db'][_0x88c2('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x88c2('0x3')](0x0);var events={'afterCreate':_0x88c2('0x4'),'afterUpdate':'update','afterDestroy':_0x88c2('0x5')};function emitEvent(_0x37ec90){return function(_0x2548ba,_0x4a727c,_0x3e20e5){CmContactEvents[_0x88c2('0x6')](_0x37ec90+':'+_0x2548ba['id'],_0x2548ba);CmContactEvents[_0x88c2('0x6')](_0x37ec90,_0x2548ba);_0x3e20e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x88c2('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 39dd068..0f81ef2 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14c7=['destroy','VoiceQueueId','push','all','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','fti_cm_contacts','phone','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','cmContact','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','then','dialTimezone','utcOffset','add','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','format','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','error','afterCreate','inspect','Campaign','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','BlackLists','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty'];(function(_0x31a33a,_0x437ed2){var _0x54881f=function(_0x14b55e){while(--_0x14b55e){_0x31a33a['push'](_0x31a33a['shift']());}};_0x54881f(++_0x437ed2);}(_0x14c7,0x18a));var _0x714c=function(_0x1f5861,_0x3fbdf6){_0x1f5861=_0x1f5861-0x0;var _0x222162=_0x14c7[_0x1f5861];return _0x222162;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x714c('0x0'));var moment=require(_0x714c('0x1'));var BPromise=require('bluebird');var rp=require(_0x714c('0x2'));var fs=require('fs');var path=require(_0x714c('0x3'));var rimraf=require('rimraf');var config=require(_0x714c('0x4'));var shared=require(_0x714c('0x5'));var attributes=require(_0x714c('0x6'));module[_0x714c('0x7')]=function(_0x1aeb06,_0x380360){return _0x1aeb06[_0x714c('0x8')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x714c('0x9'),'fields':['firstName','lastName',_0x714c('0xa'),_0x714c('0xb'),_0x714c('0xc'),'email'],'type':_0x714c('0xd')}],'timestamps':!![],'charset':_0x714c('0xe'),'collate':_0x714c('0xf'),'hooks':{'afterCreate':function(_0x477ccf,_0x489e4f,_0x4614ec){var _0x30464f=_0x1aeb06[_0x714c('0x10')];var _0x5b3eae=_0x477ccf['get']({'plain':!![]});function _0x409948(){return function(_0x1f9536){logger['error'](_0x714c('0x11'),'afterCreate',util['inspect'](_0x1f9536,{'showHidden':![],'depth':null}));};}function _0xfe192a(_0xb95476,_0x583c2d){var _0x3705ea=_0x583c2d[_0x714c('0x12')]?_0x583c2d[_0x714c('0x12')]:moment()['format'](_0x714c('0x13'));return new BPromise(function(_0x5d45ed,_0x27f70f){if(_[_0x714c('0x14')](_0x583c2d['dialTimezone'])){_0x5d45ed({'ret':_0x3705ea});}else{_0x30464f['VoiceQueue']['findOne']({'where':{'id':_0xb95476['id']}})[_0x714c('0x15')](function(_0x1a8a41){if(!_[_0x714c('0x14')](_0x1a8a41)){var _0x100717=_0x1a8a41[_0x714c('0x16')];if(!_[_0x714c('0x14')](_0x100717)){var _0x2fe2fa=shared['timezones'];var _0x25f66b=_0x2fe2fa[_0x100717];var _0x6472a7=_0x2fe2fa[_0x583c2d['dialTimezone']];if(!_['isNil'](_0x25f66b)&&!_['isNil'](_0x6472a7)){var _0x4c006a=_0x25f66b[_0x714c('0x17')]-_0x6472a7[_0x714c('0x17')];_0x3705ea=_0x583c2d[_0x714c('0x12')]?_0x583c2d[_0x714c('0x12')]:moment();var _0x15eeff=moment(_0x3705ea)[_0x714c('0x18')](_0x4c006a,'minutes');_0x5d45ed({'ret':_0x15eeff['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5d45ed({'ret':_0x3705ea});}else _0x5d45ed({'ret':_0x3705ea});}else{_0x5d45ed({'ret':_0x3705ea});}});}});return 0xa;}var _0x38264e=function(_0x41303f){return new BPromise(function(_0x24bc26,_0x5e3d5e){_0xfe192a(_0x41303f,_0x5b3eae)[_0x714c('0x15')](function(_0x516a8f){_0x5b3eae['scheduledat']=_0x516a8f[_0x714c('0x19')];_0x30464f['CmHopper'][_0x714c('0x1a')]({'where':{'phone':_0x5b3eae[_0x714c('0xa')],'VoiceQueueId':_0x41303f['id']}})[_0x714c('0x15')](function(_0x57a16c){if(!_[_0x714c('0x14')](_0x57a16c)){throw new Error(_0x714c('0x1b')+_0x5b3eae['phone']+_0x714c('0x1c')+_0x41303f['id']);}return _0x30464f[_0x714c('0x1d')][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae[_0x714c('0x1f')],'priority':_0x5b3eae[_0x714c('0x20')]?_0x5b3eae[_0x714c('0x20')]:0x2,'scheduledat':_0x5b3eae[_0x714c('0x12')]?_0x5b3eae[_0x714c('0x12')]:moment()[_0x714c('0x21')](_0x714c('0x13')),'callback':_0x5b3eae[_0x714c('0x22')]?!![]:![],'callbackuniqueid':_0x5b3eae['callbackUniqueid']?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()[_0x714c('0x21')](_0x714c('0x13')):undefined,'VoiceQueueId':_0x41303f['id']});})['catch'](function(_0xe01f5a){_0x5e3d5e(_0xe01f5a);});});});};var _0xabeb41=function(_0x26d814){return new BPromise(function(_0x325587,_0x345ca2){_0xfe192a(_0x26d814,_0x5b3eae)[_0x714c('0x15')](function(_0x589987){_0x5b3eae[_0x714c('0x12')]=_0x589987[_0x714c('0x19')];_0x30464f[_0x714c('0x1d')][_0x714c('0x1a')]({'where':{'phone':_0x5b3eae['phone'],'VoiceQueueId':_0x26d814['id']}})[_0x714c('0x15')](function(_0x29ef24){if(!_[_0x714c('0x14')](_0x29ef24)){throw new Error(_0x714c('0x1b')+_0x5b3eae['phone']+_0x714c('0x23')+_0x26d814['id']);}return _0x30464f[_0x714c('0x24')][_0x714c('0x1a')]({'where':{'calleridnum':_0x5b3eae[_0x714c('0xa')],'VoiceQueueId':_0x26d814['id']}});})[_0x714c('0x15')](function(_0x2093e1){if(!_['isNil'](_0x2093e1)){throw new Error(_0x714c('0x25')+_0x5b3eae[_0x714c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x26d814['id']);}return _0x30464f[_0x714c('0x1d')]['create']({'phone':_0x5b3eae['phone'],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae[_0x714c('0x1f')],'priority':_0x5b3eae[_0x714c('0x20')]?_0x5b3eae[_0x714c('0x20')]:0x2,'scheduledat':_0x5b3eae['scheduledat']?_0x5b3eae[_0x714c('0x12')]:moment()[_0x714c('0x21')](_0x714c('0x13')),'callback':_0x5b3eae[_0x714c('0x22')]?!![]:![],'callbackuniqueid':_0x5b3eae[_0x714c('0x22')]?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()[_0x714c('0x21')](_0x714c('0x13')):undefined,'VoiceQueueId':_0x26d814['id']});})['catch'](function(_0x40dfb1){_0x345ca2(_0x40dfb1);});});});};function _0x4bf6c1(){return function(_0x2d9db4){logger[_0x714c('0x26')](_0x714c('0x11'),_0x714c('0x27'),util[_0x714c('0x28')](_0x2d9db4,{'showHidden':![],'depth':null}));};}function _0xbfa1c7(_0xb7a447,_0x5ca9db){var _0x3d4b9d=_0x5ca9db['scheduledat']?_0x5ca9db['scheduledat']:moment()[_0x714c('0x21')](_0x714c('0x13'));return new BPromise(function(_0x3e81f8,_0xd2d6e6){if(_[_0x714c('0x14')](_0x5ca9db[_0x714c('0x16')])){_0x3e81f8({'ret':_0x3d4b9d});}else{_0x30464f[_0x714c('0x29')][_0x714c('0x1a')]({'where':{'id':_0xb7a447['id']}})[_0x714c('0x15')](function(_0x14b4e3){if(!_[_0x714c('0x14')](_0x14b4e3)){var _0x323c50=_0x14b4e3[_0x714c('0x16')];if(!_[_0x714c('0x14')](_0x323c50)){var _0x2c333f=shared[_0x714c('0x2a')];var _0x46018e=_0x2c333f[_0x323c50];var _0x42f558=_0x2c333f[_0x5ca9db[_0x714c('0x16')]];if(!_['isNil'](_0x46018e)&&!_[_0x714c('0x14')](_0x42f558)){var _0x5a6884=_0x46018e[_0x714c('0x17')]-_0x42f558[_0x714c('0x17')];_0x3d4b9d=_0x5ca9db[_0x714c('0x12')]?_0x5ca9db['scheduledat']:moment();var _0x4d2774=moment(_0x3d4b9d)[_0x714c('0x18')](_0x5a6884,_0x714c('0x2b'));_0x3e81f8({'ret':_0x4d2774[_0x714c('0x21')](_0x714c('0x13'))});}else _0x3e81f8({'ret':_0x3d4b9d});}else _0x3e81f8({'ret':_0x3d4b9d});}else{_0x3e81f8({'ret':_0x3d4b9d});}});}});return 0xa;}var _0x3ac09b=function(_0x396d43){return new BPromise(function(_0x39c947,_0xa1b206){_0xbfa1c7(_0x396d43,_0x5b3eae)[_0x714c('0x15')](function(_0x4886bc){_0x5b3eae[_0x714c('0x12')]=_0x4886bc[_0x714c('0x19')];_0x30464f[_0x714c('0x1d')]['findOne']({'where':{'phone':_0x5b3eae[_0x714c('0xa')],'CampaignId':_0x396d43['id']}})['then'](function(_0x214a47){if(!_['isNil'](_0x214a47)){throw new Error(_0x714c('0x1b')+_0x5b3eae[_0x714c('0xa')]+_0x714c('0x2c')+_0x396d43['id']);}return _0x30464f[_0x714c('0x1d')][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae['ListId'],'priority':_0x5b3eae[_0x714c('0x20')]?_0x5b3eae[_0x714c('0x20')]:0x2,'scheduledat':_0x5b3eae[_0x714c('0x12')]?_0x5b3eae[_0x714c('0x12')]:moment()[_0x714c('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5b3eae[_0x714c('0x22')]?!![]:![],'callbackuniqueid':_0x5b3eae[_0x714c('0x22')]?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()[_0x714c('0x21')](_0x714c('0x13')):undefined,'CampaignId':_0x396d43['id']});})[_0x714c('0x2d')](function(_0x1cbdd8){_0xa1b206(_0x1cbdd8);});});});};var _0x23a52a=function(_0x3f09b7){return new BPromise(function(_0x5d9778,_0x11c672){_0xbfa1c7(_0x3f09b7,_0x5b3eae)[_0x714c('0x15')](function(_0x36f546){_0x5b3eae[_0x714c('0x12')]=_0x36f546[_0x714c('0x19')];_0x30464f[_0x714c('0x1d')][_0x714c('0x1a')]({'where':{'phone':_0x5b3eae['phone'],'CampaignId':_0x3f09b7['id']}})[_0x714c('0x15')](function(_0x183aca){if(!_[_0x714c('0x14')](_0x183aca)){throw new Error(_0x714c('0x1b')+_0x5b3eae['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3f09b7['id']);}return _0x30464f[_0x714c('0x24')][_0x714c('0x1a')]({'where':{'calleridnum':_0x5b3eae[_0x714c('0xa')],'CampaignId':_0x3f09b7['id']}});})[_0x714c('0x15')](function(_0x228a23){if(!_[_0x714c('0x14')](_0x228a23)){throw new Error(_0x714c('0x25')+_0x5b3eae['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3f09b7['id']);}return _0x30464f['CmHopper'][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae[_0x714c('0x1f')],'priority':_0x5b3eae['priority']?_0x5b3eae[_0x714c('0x20')]:0x2,'scheduledat':_0x5b3eae[_0x714c('0x12')]?_0x5b3eae[_0x714c('0x12')]:moment()[_0x714c('0x21')](_0x714c('0x13')),'callback':_0x5b3eae[_0x714c('0x22')]?!![]:![],'callbackuniqueid':_0x5b3eae[_0x714c('0x22')]?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()[_0x714c('0x21')](_0x714c('0x13')):undefined,'CampaignId':_0x3f09b7['id']});})[_0x714c('0x2d')](function(_0x544b03){_0x11c672(_0x544b03);});});});};if(_0x5b3eae[_0x714c('0x1f')]){_0x30464f['VoiceQueue'][_0x714c('0x2e')]({'where':{'type':_0x714c('0x2f')},'attributes':['id',_0x714c('0x30'),'dialTimezone'],'include':[{'model':_0x30464f[_0x714c('0x31')],'as':_0x714c('0x32'),'where':{'id':_0x5b3eae[_0x714c('0x1f')]}}]})['then'](function(_0x5aeb49){if(_0x5aeb49){var _0x835f43=[];for(var _0x1ec39e=0x0,_0x160a37;_0x1ec39e<_0x5aeb49[_0x714c('0x33')];_0x1ec39e+=0x1){_0x160a37=_0x5aeb49[_0x1ec39e][_0x714c('0x34')]({'plain':!![]});switch(_0x160a37[_0x714c('0x30')]){case _0x714c('0x35'):_0xabeb41(_0x160a37)[_0x714c('0x2d')](_0x409948());break;case _0x714c('0x36'):_0x38264e(_0x160a37)[_0x714c('0x2d')](_0x409948());break;default:_0xbfa1c7(_0x160a37,_0x5b3eae)[_0x714c('0x15')](function(_0xf5d3b4){_0x5b3eae[_0x714c('0x12')]=_0xf5d3b4[_0x714c('0x19')];_0x30464f['CmHopper'][_0x714c('0x1e')]({'phone':_0x5b3eae['phone'],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae[_0x714c('0x1f')],'scheduledat':_0x5b3eae[_0x714c('0x12')]?_0x5b3eae['scheduledat']:moment()[_0x714c('0x21')](_0x714c('0x13')),'priority':_0x5b3eae[_0x714c('0x20')]?_0x5b3eae[_0x714c('0x20')]:0x2,'callback':_0x5b3eae[_0x714c('0x22')]?!![]:![],'callbackuniqueid':_0x5b3eae[_0x714c('0x22')]?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()['format'](_0x714c('0x13')):undefined,'VoiceQueueId':_0x160a37['id']})[_0x714c('0x2d')](_0x409948());});}}}})[_0x714c('0x15')](function(){return _0x30464f['VoiceQueue'][_0x714c('0x2e')]({'where':{'type':_0x714c('0x2f')},'attributes':['id'],'include':[{'model':_0x30464f['CmList'],'as':_0x714c('0x37'),'where':{'id':_0x5b3eae['ListId']}}]})[_0x714c('0x15')](function(_0x1559b4){if(_0x1559b4){var _0x158dee=[];for(var _0x5f3988=0x0,_0x1c55df;_0x5f3988<_0x1559b4[_0x714c('0x33')];_0x5f3988+=0x1){_0x1c55df=_0x1559b4[_0x5f3988][_0x714c('0x34')]({'plain':!![]});_0x30464f[_0x714c('0x38')][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae['ListId'],'VoiceQueueId':_0x1c55df['id']})['catch'](function(_0x21288c){logger[_0x714c('0x26')]('cmContact,\x20%s,\x20%s',_0x714c('0x27'),_0x21288c[_0x714c('0x39')]);});}}});})[_0x714c('0x15')](function(){return _0x30464f[_0x714c('0x29')][_0x714c('0x2e')]({'attributes':['id','dialCheckDuplicateType',_0x714c('0x16')],'include':[{'model':_0x30464f['CmList'],'as':'Lists','where':{'id':_0x5b3eae[_0x714c('0x1f')]}}]})['then'](function(_0x288870){if(_0x288870){var _0x5e3b5e=[];for(var _0x56517f=0x0,_0x595e5b;_0x56517f<_0x288870[_0x714c('0x33')];_0x56517f+=0x1){_0x595e5b=_0x288870[_0x56517f][_0x714c('0x34')]({'plain':!![]});switch(_0x595e5b[_0x714c('0x30')]){case _0x714c('0x35'):_0x23a52a(_0x595e5b)[_0x714c('0x2d')](_0x4bf6c1());break;case'onlyIfOpen':_0x3ac09b(_0x595e5b)[_0x714c('0x2d')](_0x4bf6c1());break;default:_0x30464f[_0x714c('0x1d')][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae['ListId'],'scheduledat':_0x5b3eae[_0x714c('0x12')]?_0x5b3eae['scheduledat']:moment()[_0x714c('0x21')](_0x714c('0x13')),'priority':_0x5b3eae['priority']?_0x5b3eae[_0x714c('0x20')]:0x2,'callback':_0x5b3eae['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5b3eae[_0x714c('0x22')]?_0x5b3eae[_0x714c('0x22')]:undefined,'callbackat':_0x5b3eae[_0x714c('0x22')]?moment()[_0x714c('0x21')](_0x714c('0x13')):undefined,'CampaignId':_0x595e5b['id']})['catch'](_0x4bf6c1());}}}});})[_0x714c('0x15')](function(){return _0x30464f[_0x714c('0x29')][_0x714c('0x2e')]({'attributes':['id'],'include':[{'model':_0x30464f[_0x714c('0x31')],'as':_0x714c('0x37'),'where':{'id':_0x5b3eae[_0x714c('0x1f')]}}]})[_0x714c('0x15')](function(_0x350a74){if(_0x350a74){var _0x11785f=[];for(var _0x525f73=0x0,_0x4833bf;_0x525f73<_0x350a74['length'];_0x525f73+=0x1){_0x4833bf=_0x350a74[_0x525f73][_0x714c('0x34')]({'plain':!![]});_0x30464f[_0x714c('0x38')][_0x714c('0x1e')]({'phone':_0x5b3eae[_0x714c('0xa')],'ContactId':_0x5b3eae['id'],'ListId':_0x5b3eae['ListId'],'CampaignId':_0x4833bf['id']})['catch'](function(_0x1df228){logger[_0x714c('0x26')](_0x714c('0x3a'),_0x714c('0x27'),_0x1df228[_0x714c('0x39')]);});}}});})[_0x714c('0x15')](function(){_0x4614ec();})[_0x714c('0x2d')](function(_0x21526f){logger[_0x714c('0x26')](_0x714c('0x3a'),_0x714c('0x27'),_0x21526f[_0x714c('0x39')]);_0x4614ec(_0x21526f);});}else{_0x4614ec(new Error(_0x714c('0x3b')));}},'afterDestroy':function(_0x973171,_0x4e31c7,_0x356857){var _0x4aad2c=_0x1aeb06[_0x714c('0x10')];var _0x572e67=_0x973171['get']({'plain':!![]});return _0x4aad2c[_0x714c('0x1d')]['findAll']({'raw':!![],'where':{'ListId':_0x572e67['ListId'],'ContactId':_0x572e67['id']}})[_0x714c('0x15')](function(_0xb119cd){if(!_[_0x714c('0x3c')](_0xb119cd)){var _0x5853ae=[];for(var _0x19b252=0x0;_0x19b252<_0xb119cd[_0x714c('0x33')];_0x19b252+=0x1){var _0x3b0faf=_0x4aad2c['CmHopper'][_0x714c('0x3d')]({'where':{'ListId':_0xb119cd[_0x19b252]['ListId'],'ContactId':_0xb119cd[_0x19b252]['ContactId'],'VoiceQueueId':_0xb119cd[_0x19b252][_0x714c('0x3e')],'CampaignId':_0xb119cd[_0x19b252]['CampaignId']}});_0x5853ae[_0x714c('0x3f')](_0x3b0faf);}return BPromise[_0x714c('0x40')](_0x5853ae);}})['then'](function(_0x166906){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x714c('0x28')](_0x166906,{'showHidden':![],'depth':null}));_0x356857();})[_0x714c('0x2d')](function(_0x4af718){logger[_0x714c('0x26')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x4af718,{'showHidden':![],'depth':null}));_0x356857(_0x4af718);});}}});}; \ No newline at end of file +var _0xc8d5=['YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','create','error','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','length','always','onlyIfOpen','outbound','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','BlackLists','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','minutes','format','ret','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority'];(function(_0x2de0ae,_0x2eaf39){var _0x51059a=function(_0x4235e6){while(--_0x4235e6){_0x2de0ae['push'](_0x2de0ae['shift']());}};_0x51059a(++_0x2eaf39);}(_0xc8d5,0x17d));var _0x5c8d=function(_0x56e632,_0xe99421){_0x56e632=_0x56e632-0x0;var _0x2a710e=_0xc8d5[_0x56e632];return _0x2a710e;};'use strict';var _=require(_0x5c8d('0x0'));var util=require(_0x5c8d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5c8d('0x2'));var BPromise=require(_0x5c8d('0x3'));var rp=require(_0x5c8d('0x4'));var fs=require('fs');var path=require(_0x5c8d('0x5'));var rimraf=require(_0x5c8d('0x6'));var config=require(_0x5c8d('0x7'));var shared=require(_0x5c8d('0x8'));var attributes=require(_0x5c8d('0x9'));module[_0x5c8d('0xa')]=function(_0x4bb13a,_0x339c29){return _0x4bb13a[_0x5c8d('0xb')]('CmContact',attributes,{'tableName':_0x5c8d('0xc'),'paranoid':!![],'indexes':[{'name':_0x5c8d('0xd'),'fields':[_0x5c8d('0xd')]},{'name':_0x5c8d('0xe'),'fields':[_0x5c8d('0xf'),'lastName',_0x5c8d('0xd'),_0x5c8d('0x10'),'fax',_0x5c8d('0x11')],'type':_0x5c8d('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c8d('0x13'),'hooks':{'afterCreate':function(_0x37d735,_0x524ff3,_0x4b9a76){var _0x1a0854=_0x4bb13a['models'];var _0x1cba4c=_0x37d735[_0x5c8d('0x14')]({'plain':!![]});function _0x3c1c67(){return function(_0x1ea42f){logger['error'](_0x5c8d('0x15'),_0x5c8d('0x16'),util[_0x5c8d('0x17')](_0x1ea42f,{'showHidden':![],'depth':null}));};}function _0x47e2c7(_0x153a4b,_0x4c94eb){var _0x143844=_0x4c94eb[_0x5c8d('0x18')]?_0x4c94eb[_0x5c8d('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5a4f73,_0xc7c9ef){if(_[_0x5c8d('0x19')](_0x4c94eb['dialTimezone'])){_0x5a4f73({'ret':_0x143844});}else{_0x1a0854[_0x5c8d('0x1a')][_0x5c8d('0x1b')]({'where':{'id':_0x153a4b['id']}})[_0x5c8d('0x1c')](function(_0x1ba1a2){if(!_['isNil'](_0x1ba1a2)){var _0x355c80=_0x1ba1a2[_0x5c8d('0x1d')];if(!_[_0x5c8d('0x19')](_0x355c80)){var _0x16df60=shared[_0x5c8d('0x1e')];var _0x194a0f=_0x16df60[_0x355c80];var _0x264cc3=_0x16df60[_0x4c94eb['dialTimezone']];if(!_[_0x5c8d('0x19')](_0x194a0f)&&!_[_0x5c8d('0x19')](_0x264cc3)){var _0x2b6145=_0x194a0f[_0x5c8d('0x1f')]-_0x264cc3[_0x5c8d('0x1f')];_0x143844=_0x4c94eb[_0x5c8d('0x18')]?_0x4c94eb[_0x5c8d('0x18')]:moment();var _0x355ace=moment(_0x143844)['add'](_0x2b6145,_0x5c8d('0x20'));_0x5a4f73({'ret':_0x355ace[_0x5c8d('0x21')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5a4f73({'ret':_0x143844});}else _0x5a4f73({'ret':_0x143844});}else{_0x5a4f73({'ret':_0x143844});}});}});return 0xa;}var _0x49e2e8=function(_0x54eca4){return new BPromise(function(_0x52b452,_0x5e175f){_0x47e2c7(_0x54eca4,_0x1cba4c)['then'](function(_0x4d483c){_0x1cba4c[_0x5c8d('0x18')]=_0x4d483c[_0x5c8d('0x22')];_0x1a0854[_0x5c8d('0x23')][_0x5c8d('0x1b')]({'where':{'phone':_0x1cba4c[_0x5c8d('0xd')],'VoiceQueueId':_0x54eca4['id']}})[_0x5c8d('0x1c')](function(_0x303aa9){if(!_[_0x5c8d('0x19')](_0x303aa9)){throw new Error(_0x5c8d('0x24')+_0x1cba4c[_0x5c8d('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x54eca4['id']);}return _0x1a0854[_0x5c8d('0x23')]['create']({'phone':_0x1cba4c['phone'],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'priority':_0x1cba4c[_0x5c8d('0x26')]?_0x1cba4c[_0x5c8d('0x26')]:0x2,'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c[_0x5c8d('0x18')]:moment()[_0x5c8d('0x21')](_0x5c8d('0x27')),'callback':_0x1cba4c[_0x5c8d('0x28')]?!![]:![],'callbackuniqueid':_0x1cba4c[_0x5c8d('0x28')]?_0x1cba4c['callbackUniqueid']:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()[_0x5c8d('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x54eca4['id']});})[_0x5c8d('0x29')](function(_0x56c25d){_0x5e175f(_0x56c25d);});});});};var _0x2c4b42=function(_0x280f2f){return new BPromise(function(_0x176d1e,_0x544ced){_0x47e2c7(_0x280f2f,_0x1cba4c)['then'](function(_0xea936b){_0x1cba4c[_0x5c8d('0x18')]=_0xea936b[_0x5c8d('0x22')];_0x1a0854[_0x5c8d('0x23')][_0x5c8d('0x1b')]({'where':{'phone':_0x1cba4c['phone'],'VoiceQueueId':_0x280f2f['id']}})[_0x5c8d('0x1c')](function(_0x121b09){if(!_[_0x5c8d('0x19')](_0x121b09)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1cba4c[_0x5c8d('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x280f2f['id']);}return _0x1a0854[_0x5c8d('0x2a')][_0x5c8d('0x1b')]({'where':{'calleridnum':_0x1cba4c['phone'],'VoiceQueueId':_0x280f2f['id']}});})[_0x5c8d('0x1c')](function(_0x34af18){if(!_[_0x5c8d('0x19')](_0x34af18)){throw new Error(_0x5c8d('0x2b')+_0x1cba4c['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x280f2f['id']);}return _0x1a0854['CmHopper'][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c['ListId'],'priority':_0x1cba4c[_0x5c8d('0x26')]?_0x1cba4c['priority']:0x2,'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c['scheduledat']:moment()[_0x5c8d('0x21')](_0x5c8d('0x27')),'callback':_0x1cba4c[_0x5c8d('0x28')]?!![]:![],'callbackuniqueid':_0x1cba4c[_0x5c8d('0x28')]?_0x1cba4c[_0x5c8d('0x28')]:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x280f2f['id']});})[_0x5c8d('0x29')](function(_0x1c856f){_0x544ced(_0x1c856f);});});});};function _0x41e59b(){return function(_0x136971){logger[_0x5c8d('0x2d')](_0x5c8d('0x15'),_0x5c8d('0x16'),util[_0x5c8d('0x17')](_0x136971,{'showHidden':![],'depth':null}));};}function _0x5e465d(_0x5dd084,_0x5552dd){var _0x508540=_0x5552dd[_0x5c8d('0x18')]?_0x5552dd[_0x5c8d('0x18')]:moment()[_0x5c8d('0x21')](_0x5c8d('0x27'));return new BPromise(function(_0x1732af,_0x444c50){if(_[_0x5c8d('0x19')](_0x5552dd[_0x5c8d('0x1d')])){_0x1732af({'ret':_0x508540});}else{_0x1a0854[_0x5c8d('0x2e')][_0x5c8d('0x1b')]({'where':{'id':_0x5dd084['id']}})[_0x5c8d('0x1c')](function(_0x4540cf){if(!_[_0x5c8d('0x19')](_0x4540cf)){var _0xbe0c37=_0x4540cf[_0x5c8d('0x1d')];if(!_['isNil'](_0xbe0c37)){var _0x4781cf=shared[_0x5c8d('0x1e')];var _0xb04cc8=_0x4781cf[_0xbe0c37];var _0x30dd27=_0x4781cf[_0x5552dd[_0x5c8d('0x1d')]];if(!_['isNil'](_0xb04cc8)&&!_[_0x5c8d('0x19')](_0x30dd27)){var _0x5b3c23=_0xb04cc8[_0x5c8d('0x1f')]-_0x30dd27[_0x5c8d('0x1f')];_0x508540=_0x5552dd[_0x5c8d('0x18')]?_0x5552dd[_0x5c8d('0x18')]:moment();var _0x57cdec=moment(_0x508540)[_0x5c8d('0x2f')](_0x5b3c23,'minutes');_0x1732af({'ret':_0x57cdec['format'](_0x5c8d('0x27'))});}else _0x1732af({'ret':_0x508540});}else _0x1732af({'ret':_0x508540});}else{_0x1732af({'ret':_0x508540});}});}});return 0xa;}var _0x17337e=function(_0x253f94){return new BPromise(function(_0x268756,_0x43553d){_0x5e465d(_0x253f94,_0x1cba4c)['then'](function(_0x1c02b3){_0x1cba4c['scheduledat']=_0x1c02b3[_0x5c8d('0x22')];_0x1a0854['CmHopper']['findOne']({'where':{'phone':_0x1cba4c[_0x5c8d('0xd')],'CampaignId':_0x253f94['id']}})['then'](function(_0x33d8f4){if(!_[_0x5c8d('0x19')](_0x33d8f4)){throw new Error(_0x5c8d('0x24')+_0x1cba4c[_0x5c8d('0xd')]+_0x5c8d('0x30')+_0x253f94['id']);}return _0x1a0854[_0x5c8d('0x23')][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'priority':_0x1cba4c['priority']?_0x1cba4c[_0x5c8d('0x26')]:0x2,'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c[_0x5c8d('0x18')]:moment()['format'](_0x5c8d('0x27')),'callback':_0x1cba4c[_0x5c8d('0x28')]?!![]:![],'callbackuniqueid':_0x1cba4c[_0x5c8d('0x28')]?_0x1cba4c[_0x5c8d('0x28')]:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()[_0x5c8d('0x21')](_0x5c8d('0x27')):undefined,'CampaignId':_0x253f94['id']});})[_0x5c8d('0x29')](function(_0x415cd5){_0x43553d(_0x415cd5);});});});};var _0x51f7da=function(_0xcf474){return new BPromise(function(_0x20214b,_0x7293b){_0x5e465d(_0xcf474,_0x1cba4c)[_0x5c8d('0x1c')](function(_0x5ce7e7){_0x1cba4c['scheduledat']=_0x5ce7e7[_0x5c8d('0x22')];_0x1a0854['CmHopper'][_0x5c8d('0x1b')]({'where':{'phone':_0x1cba4c[_0x5c8d('0xd')],'CampaignId':_0xcf474['id']}})[_0x5c8d('0x1c')](function(_0x32c8ce){if(!_[_0x5c8d('0x19')](_0x32c8ce)){throw new Error(_0x5c8d('0x24')+_0x1cba4c[_0x5c8d('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0xcf474['id']);}return _0x1a0854[_0x5c8d('0x2a')][_0x5c8d('0x1b')]({'where':{'calleridnum':_0x1cba4c[_0x5c8d('0xd')],'CampaignId':_0xcf474['id']}});})[_0x5c8d('0x1c')](function(_0x4270a1){if(!_['isNil'](_0x4270a1)){throw new Error(_0x5c8d('0x2b')+_0x1cba4c['phone']+_0x5c8d('0x31')+_0xcf474['id']);}return _0x1a0854['CmHopper'][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c['ListId'],'priority':_0x1cba4c[_0x5c8d('0x26')]?_0x1cba4c[_0x5c8d('0x26')]:0x2,'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c[_0x5c8d('0x18')]:moment()[_0x5c8d('0x21')](_0x5c8d('0x27')),'callback':_0x1cba4c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1cba4c['callbackUniqueid']?_0x1cba4c[_0x5c8d('0x28')]:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()[_0x5c8d('0x21')](_0x5c8d('0x27')):undefined,'CampaignId':_0xcf474['id']});})[_0x5c8d('0x29')](function(_0x6dcb7a){_0x7293b(_0x6dcb7a);});});});};if(_0x1cba4c[_0x5c8d('0x25')]){_0x1a0854[_0x5c8d('0x1a')][_0x5c8d('0x32')]({'where':{'type':'outbound'},'attributes':['id',_0x5c8d('0x33'),_0x5c8d('0x1d')],'include':[{'model':_0x1a0854['CmList'],'as':'Lists','where':{'id':_0x1cba4c[_0x5c8d('0x25')]}}]})[_0x5c8d('0x1c')](function(_0x42b7b1){if(_0x42b7b1){var _0x11f3a7=[];for(var _0x1be12a=0x0,_0x531616;_0x1be12a<_0x42b7b1[_0x5c8d('0x34')];_0x1be12a+=0x1){_0x531616=_0x42b7b1[_0x1be12a]['get']({'plain':!![]});switch(_0x531616[_0x5c8d('0x33')]){case _0x5c8d('0x35'):_0x2c4b42(_0x531616)[_0x5c8d('0x29')](_0x3c1c67());break;case _0x5c8d('0x36'):_0x49e2e8(_0x531616)[_0x5c8d('0x29')](_0x3c1c67());break;default:_0x5e465d(_0x531616,_0x1cba4c)[_0x5c8d('0x1c')](function(_0x3c6ccd){_0x1cba4c[_0x5c8d('0x18')]=_0x3c6ccd[_0x5c8d('0x22')];_0x1a0854[_0x5c8d('0x23')][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c[_0x5c8d('0x18')]:moment()['format'](_0x5c8d('0x27')),'priority':_0x1cba4c[_0x5c8d('0x26')]?_0x1cba4c[_0x5c8d('0x26')]:0x2,'callback':_0x1cba4c[_0x5c8d('0x28')]?!![]:![],'callbackuniqueid':_0x1cba4c[_0x5c8d('0x28')]?_0x1cba4c[_0x5c8d('0x28')]:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()[_0x5c8d('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x531616['id']})[_0x5c8d('0x29')](_0x3c1c67());});}}}})['then'](function(){return _0x1a0854['VoiceQueue'][_0x5c8d('0x32')]({'where':{'type':_0x5c8d('0x37')},'attributes':['id'],'include':[{'model':_0x1a0854[_0x5c8d('0x38')],'as':'BlackLists','where':{'id':_0x1cba4c[_0x5c8d('0x25')]}}]})[_0x5c8d('0x1c')](function(_0x409c08){if(_0x409c08){var _0x59f2b8=[];for(var _0x303ea6=0x0,_0x714fc2;_0x303ea6<_0x409c08[_0x5c8d('0x34')];_0x303ea6+=0x1){_0x714fc2=_0x409c08[_0x303ea6][_0x5c8d('0x14')]({'plain':!![]});_0x1a0854[_0x5c8d('0x39')][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'VoiceQueueId':_0x714fc2['id']})[_0x5c8d('0x29')](function(_0x128cdd){logger[_0x5c8d('0x2d')](_0x5c8d('0x3a'),_0x5c8d('0x16'),_0x128cdd[_0x5c8d('0x3b')]);});}}});})[_0x5c8d('0x1c')](function(){return _0x1a0854['Campaign'][_0x5c8d('0x32')]({'attributes':['id','dialCheckDuplicateType',_0x5c8d('0x1d')],'include':[{'model':_0x1a0854[_0x5c8d('0x38')],'as':_0x5c8d('0x3c'),'where':{'id':_0x1cba4c[_0x5c8d('0x25')]}}]})[_0x5c8d('0x1c')](function(_0x297797){if(_0x297797){var _0x399e72=[];for(var _0x2fa0e7=0x0,_0x3117a1;_0x2fa0e7<_0x297797[_0x5c8d('0x34')];_0x2fa0e7+=0x1){_0x3117a1=_0x297797[_0x2fa0e7][_0x5c8d('0x14')]({'plain':!![]});switch(_0x3117a1[_0x5c8d('0x33')]){case'always':_0x51f7da(_0x3117a1)[_0x5c8d('0x29')](_0x41e59b());break;case'onlyIfOpen':_0x17337e(_0x3117a1)[_0x5c8d('0x29')](_0x41e59b());break;default:_0x1a0854[_0x5c8d('0x23')][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'scheduledat':_0x1cba4c[_0x5c8d('0x18')]?_0x1cba4c[_0x5c8d('0x18')]:moment()[_0x5c8d('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1cba4c[_0x5c8d('0x26')]?_0x1cba4c['priority']:0x2,'callback':_0x1cba4c[_0x5c8d('0x28')]?!![]:![],'callbackuniqueid':_0x1cba4c[_0x5c8d('0x28')]?_0x1cba4c['callbackUniqueid']:undefined,'callbackat':_0x1cba4c[_0x5c8d('0x28')]?moment()[_0x5c8d('0x21')](_0x5c8d('0x27')):undefined,'CampaignId':_0x3117a1['id']})[_0x5c8d('0x29')](_0x41e59b());}}}});})[_0x5c8d('0x1c')](function(){return _0x1a0854['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x1a0854['CmList'],'as':_0x5c8d('0x3d'),'where':{'id':_0x1cba4c[_0x5c8d('0x25')]}}]})['then'](function(_0x5cb8e9){if(_0x5cb8e9){var _0xf3c3b3=[];for(var _0x429af4=0x0,_0x105c98;_0x429af4<_0x5cb8e9[_0x5c8d('0x34')];_0x429af4+=0x1){_0x105c98=_0x5cb8e9[_0x429af4][_0x5c8d('0x14')]({'plain':!![]});_0x1a0854[_0x5c8d('0x39')][_0x5c8d('0x2c')]({'phone':_0x1cba4c[_0x5c8d('0xd')],'ContactId':_0x1cba4c['id'],'ListId':_0x1cba4c[_0x5c8d('0x25')],'CampaignId':_0x105c98['id']})[_0x5c8d('0x29')](function(_0x194985){logger[_0x5c8d('0x2d')](_0x5c8d('0x3a'),_0x5c8d('0x16'),_0x194985[_0x5c8d('0x3b')]);});}}});})[_0x5c8d('0x1c')](function(){_0x4b9a76();})[_0x5c8d('0x29')](function(_0x4eae92){logger['error']('cmContact,\x20%s,\x20%s',_0x5c8d('0x16'),_0x4eae92[_0x5c8d('0x3b')]);_0x4b9a76(_0x4eae92);});}else{_0x4b9a76(new Error(_0x5c8d('0x3e')));}},'afterDestroy':function(_0x3dbb67,_0xf6e392,_0x519743){var _0x299a8f=_0x4bb13a['models'];var _0x314d0d=_0x3dbb67[_0x5c8d('0x14')]({'plain':!![]});return _0x299a8f[_0x5c8d('0x23')][_0x5c8d('0x32')]({'raw':!![],'where':{'ListId':_0x314d0d['ListId'],'ContactId':_0x314d0d['id']}})[_0x5c8d('0x1c')](function(_0xe89400){if(!_['isEmpty'](_0xe89400)){var _0x1a3594=[];for(var _0x4c34a3=0x0;_0x4c34a3<_0xe89400[_0x5c8d('0x34')];_0x4c34a3+=0x1){var _0x6a4b0=_0x299a8f[_0x5c8d('0x23')][_0x5c8d('0x3f')]({'where':{'ListId':_0xe89400[_0x4c34a3][_0x5c8d('0x25')],'ContactId':_0xe89400[_0x4c34a3][_0x5c8d('0x40')],'VoiceQueueId':_0xe89400[_0x4c34a3][_0x5c8d('0x41')],'CampaignId':_0xe89400[_0x4c34a3][_0x5c8d('0x42')]}});_0x1a3594[_0x5c8d('0x43')](_0x6a4b0);}return BPromise[_0x5c8d('0x44')](_0x1a3594);}})[_0x5c8d('0x1c')](function(_0x4d6801){logger['info'](_0x5c8d('0x45'),util['inspect'](_0x4d6801,{'showHidden':![],'depth':null}));_0x519743();})[_0x5c8d('0x29')](function(_0x34768b){logger[_0x5c8d('0x2d')]('[CmContact][afterDestroy][Error]',util[_0x5c8d('0x17')](_0x34768b,{'showHidden':![],'depth':null}));_0x519743(_0x34768b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 17d0fd3..dc5b534 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x33420c,_0x4d33e2){var _0x1636ac=function(_0x1fcb71){while(--_0x1fcb71){_0x33420c['push'](_0x33420c['shift']());}};_0x1636ac(++_0x4d33e2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x34d736,_0xd20210){var _0x3cbe2b=function(_0x1e6326){while(--_0x1e6326){_0x34d736['push'](_0x34d736['shift']());}};_0x3cbe2b(++_0xd20210);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 4b5fa5f..16c086c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38c3=['INTEGER','PHONE','sequelize','exports','STRING'];(function(_0x1b619b,_0x3fc625){var _0x3f7f24=function(_0x59ecec){while(--_0x59ecec){_0x1b619b['push'](_0x1b619b['shift']());}};_0x3f7f24(++_0x3fc625);}(_0x38c3,0x13d));var _0x338c=function(_0x3396cd,_0x4047f0){_0x3396cd=_0x3396cd-0x0;var _0x2d6b4a=_0x38c3[_0x3396cd];return _0x2d6b4a;};'use strict';var Sequelize=require(_0x338c('0x0'));module[_0x338c('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x338c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x338c('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x338c('0x2')],'defaultValue':_0x338c('0x4')},'OrderBy':{'type':Sequelize[_0x338c('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x338c('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x5127=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x5127,0x18f));var _0x7512=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0x5127[_0x2d3c60];return _0x560041;};'use strict';var Sequelize=require(_0x7512('0x0'));module[_0x7512('0x1')]={'CmContactId':{'type':Sequelize[_0x7512('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7512('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x7512('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x7512('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f3ef93e..572d63a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd728=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','CmContactHasItem','rows','show','params','rawAttributes','find','create'];(function(_0x89bb32,_0x2b2a2c){var _0x5acf8a=function(_0x32214e){while(--_0x32214e){_0x89bb32['push'](_0x89bb32['shift']());}};_0x5acf8a(++_0x2b2a2c);}(_0xd728,0x15b));var _0x8d72=function(_0x2bf3de,_0x5b5c16){_0x2bf3de=_0x2bf3de-0x0;var _0x133dc4=_0xd728[_0x2bf3de];return _0x133dc4;};'use strict';var emlformat=require(_0x8d72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d72('0x2'));var moment=require(_0x8d72('0x3'));var BPromise=require(_0x8d72('0x4'));var Mustache=require(_0x8d72('0x5'));var util=require('util');var path=require(_0x8d72('0x6'));var sox=require(_0x8d72('0x7'));var csv=require('to-csv');var ejs=require(_0x8d72('0x8'));var fs=require('fs');var fs_extra=require(_0x8d72('0x9'));var _=require(_0x8d72('0xa'));var squel=require(_0x8d72('0xb'));var crypto=require(_0x8d72('0xc'));var jsforce=require(_0x8d72('0xd'));var deskjs=require(_0x8d72('0xe'));var toCsv=require(_0x8d72('0xf'));var querystring=require(_0x8d72('0x10'));var Papa=require(_0x8d72('0x11'));var Redis=require(_0x8d72('0x12'));var authService=require(_0x8d72('0x13'));var qs=require(_0x8d72('0x14'));var as=require(_0x8d72('0x15'));var hardwareService=require(_0x8d72('0x16'));var logger=require(_0x8d72('0x17'))(_0x8d72('0x18'));var utils=require('../../config/utils');var config=require(_0x8d72('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d72('0x1a'))['db'];function respondWithStatusCode(_0x3b617e,_0x4ab273){_0x4ab273=_0x4ab273||0xcc;return function(_0x5da623){if(_0x5da623){return _0x3b617e[_0x8d72('0x1b')](_0x4ab273);}return _0x3b617e[_0x8d72('0x1c')](_0x4ab273)[_0x8d72('0x1d')]();};}function respondWithResult(_0x584c78,_0x5c4b35){_0x5c4b35=_0x5c4b35||0xc8;return function(_0xd914c8){if(_0xd914c8){return _0x584c78[_0x8d72('0x1c')](_0x5c4b35)['json'](_0xd914c8);}};}function respondWithFilteredResult(_0x3687df,_0x28e11d){return function(_0x21412b){if(_0x21412b){var _0x3f174e=typeof _0x28e11d['offset']===_0x8d72('0x1e')&&typeof _0x28e11d['limit']===_0x8d72('0x1e');var _0x379c92=_0x21412b[_0x8d72('0x1f')];var _0x5a155b=_0x3f174e?0x0:_0x28e11d[_0x8d72('0x20')];var _0x51019c=_0x3f174e?_0x21412b[_0x8d72('0x1f')]:_0x28e11d['offset']+_0x28e11d[_0x8d72('0x21')];var _0x262d08;if(_0x51019c>=_0x379c92){_0x51019c=_0x379c92;_0x262d08=0xc8;}else{_0x262d08=0xce;}_0x3687df[_0x8d72('0x1c')](_0x262d08);return _0x3687df[_0x8d72('0x22')](_0x8d72('0x23'),_0x5a155b+'-'+_0x51019c+'/'+_0x379c92)['json'](_0x21412b);}return null;};}function patchUpdates(_0x4b3abf){return function(_0x551f8b){try{jsonpatch[_0x8d72('0x24')](_0x551f8b,_0x4b3abf,!![]);}catch(_0x2e3183){return BPromise[_0x8d72('0x25')](_0x2e3183);}return _0x551f8b[_0x8d72('0x26')]();};}function saveUpdates(_0x195fd1,_0x167c1d){return function(_0x39ce84){if(_0x39ce84){return _0x39ce84[_0x8d72('0x27')](_0x195fd1)['then'](function(_0x139222){return _0x139222;});}return null;};}function removeEntity(_0x17cb48,_0x1a8d1c){return function(_0x47382a){if(_0x47382a){return _0x47382a['destroy']()[_0x8d72('0x28')](function(){var _0x58d2f8=_0x47382a[_0x8d72('0x29')]({'plain':!![]});var _0x5b3bc6=_0x8d72('0x2a');return db[_0x8d72('0x2b')][_0x8d72('0x2c')]({'where':{'type':_0x5b3bc6,'resourceId':_0x58d2f8['id']}})[_0x8d72('0x28')](function(){return _0x47382a;});})[_0x8d72('0x28')](function(){_0x17cb48[_0x8d72('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd376,_0x31af0b){return function(_0x3bd357){if(!_0x3bd357){_0x3bd376['sendStatus'](0x194);}return _0x3bd357;};}function handleError(_0x31bf7f,_0x5a5982){_0x5a5982=_0x5a5982||0x1f4;return function(_0x5260ed){logger[_0x8d72('0x2d')](_0x5260ed[_0x8d72('0x2e')]);if(_0x5260ed[_0x8d72('0x2f')]){delete _0x5260ed[_0x8d72('0x2f')];}_0x31bf7f[_0x8d72('0x1c')](_0x5a5982)['send'](_0x5260ed);};}exports[_0x8d72('0x30')]=function(_0x9f30fb,_0x4a16ec){var _0x8bbd3e={},_0x52fbc6={},_0x6686ab={'count':0x0,'rows':[]};var _0xc78a24=_[_0x8d72('0x31')](db['CmContactHasItem']['rawAttributes'],function(_0x536794){return{'name':_0x536794[_0x8d72('0x32')],'type':_0x536794[_0x8d72('0x33')][_0x8d72('0x34')]};});_0x52fbc6[_0x8d72('0x35')]=_['map'](_0xc78a24,_0x8d72('0x2f'));_0x52fbc6[_0x8d72('0x36')]=_[_0x8d72('0x37')](_0x9f30fb[_0x8d72('0x36')]);_0x52fbc6[_0x8d72('0x38')]=_['intersection'](_0x52fbc6['model'],_0x52fbc6['query']);_0x8bbd3e[_0x8d72('0x39')]=_[_0x8d72('0x3a')](_0x52fbc6[_0x8d72('0x35')],qs[_0x8d72('0x3b')](_0x9f30fb[_0x8d72('0x36')][_0x8d72('0x3b')]));_0x8bbd3e[_0x8d72('0x39')]=_0x8bbd3e[_0x8d72('0x39')][_0x8d72('0x3c')]?_0x8bbd3e[_0x8d72('0x39')]:_0x52fbc6['model'];if(!_0x9f30fb[_0x8d72('0x36')][_0x8d72('0x3d')]('nolimit')){_0x8bbd3e[_0x8d72('0x21')]=qs['limit'](_0x9f30fb[_0x8d72('0x36')][_0x8d72('0x21')]);_0x8bbd3e[_0x8d72('0x20')]=qs[_0x8d72('0x20')](_0x9f30fb['query']['offset']);}_0x8bbd3e['order']=qs[_0x8d72('0x3e')](_0x9f30fb[_0x8d72('0x36')]['sort']);_0x8bbd3e[_0x8d72('0x3f')]=qs[_0x8d72('0x38')](_[_0x8d72('0x40')](_0x9f30fb[_0x8d72('0x36')],_0x52fbc6[_0x8d72('0x38')]),_0xc78a24);if(_0x9f30fb['query'][_0x8d72('0x41')]){_0x8bbd3e[_0x8d72('0x3f')]=_['merge'](_0x8bbd3e[_0x8d72('0x3f')],{'$or':_[_0x8d72('0x31')](_0xc78a24,function(_0x338ffa){if(_0x338ffa[_0x8d72('0x33')]!==_0x8d72('0x42')){var _0x28cb21={};_0x28cb21[_0x338ffa[_0x8d72('0x2f')]]={'$like':'%'+_0x9f30fb[_0x8d72('0x36')]['filter']+'%'};return _0x28cb21;}})});}_0x8bbd3e=_[_0x8d72('0x43')]({},_0x8bbd3e,_0x9f30fb[_0x8d72('0x44')]);var _0x15d5f6={'where':_0x8bbd3e[_0x8d72('0x3f')]};return db['CmContactHasItem'][_0x8d72('0x1f')](_0x15d5f6)['then'](function(_0x15d121){_0x6686ab['count']=_0x15d121;if(_0x9f30fb[_0x8d72('0x36')][_0x8d72('0x45')]){_0x8bbd3e[_0x8d72('0x46')]=[{'all':!![]}];}return db[_0x8d72('0x47')]['findAll'](_0x8bbd3e);})[_0x8d72('0x28')](function(_0x4118f7){_0x6686ab[_0x8d72('0x48')]=_0x4118f7;return _0x6686ab;})[_0x8d72('0x28')](respondWithFilteredResult(_0x4a16ec,_0x8bbd3e))['catch'](handleError(_0x4a16ec,null));};exports[_0x8d72('0x49')]=function(_0x4e834c,_0x23f17d){var _0x5148b7={'raw':!![],'where':{'id':_0x4e834c[_0x8d72('0x4a')]['id']}},_0x56f510={};_0x56f510[_0x8d72('0x35')]=_['keys'](db[_0x8d72('0x47')][_0x8d72('0x4b')]);_0x56f510['query']=_[_0x8d72('0x37')](_0x4e834c[_0x8d72('0x36')]);_0x56f510[_0x8d72('0x38')]=_[_0x8d72('0x3a')](_0x56f510[_0x8d72('0x35')],_0x56f510[_0x8d72('0x36')]);_0x5148b7[_0x8d72('0x39')]=_['intersection'](_0x56f510['model'],qs[_0x8d72('0x3b')](_0x4e834c['query'][_0x8d72('0x3b')]));_0x5148b7[_0x8d72('0x39')]=_0x5148b7['attributes']['length']?_0x5148b7['attributes']:_0x56f510[_0x8d72('0x35')];if(_0x4e834c['query'][_0x8d72('0x45')]){_0x5148b7[_0x8d72('0x46')]=[{'all':!![]}];}_0x5148b7=_[_0x8d72('0x43')]({},_0x5148b7,_0x4e834c[_0x8d72('0x44')]);return db[_0x8d72('0x47')][_0x8d72('0x4c')](_0x5148b7)[_0x8d72('0x28')](handleEntityNotFound(_0x23f17d,null))[_0x8d72('0x28')](respondWithResult(_0x23f17d,null))['catch'](handleError(_0x23f17d,null));};exports[_0x8d72('0x4d')]=function(_0x385560,_0x72b6ad){return db[_0x8d72('0x47')][_0x8d72('0x4d')](_0x385560['body'],{})[_0x8d72('0x28')](function(_0x2484f8){var _0x352a0e=_0x385560[_0x8d72('0x4e')]['get']({'plain':!![]});if(!_0x352a0e)throw new Error(_0x8d72('0x4f'));if(_0x352a0e['role']===_0x8d72('0x4e')){var _0x17463a=_0x2484f8[_0x8d72('0x29')]({'plain':!![]});var _0x3c891d=_0x8d72('0x2a');return db[_0x8d72('0x50')][_0x8d72('0x4c')]({'where':{'name':_0x3c891d,'userProfileId':_0x352a0e[_0x8d72('0x51')]},'raw':!![]})['then'](function(_0x45c59c){if(_0x45c59c&&_0x45c59c[_0x8d72('0x52')]===0x0){return db[_0x8d72('0x2b')][_0x8d72('0x4d')]({'name':_0x17463a['name'],'resourceId':_0x17463a['id'],'type':_0x45c59c['name'],'sectionId':_0x45c59c['id']},{})[_0x8d72('0x28')](function(){return _0x2484f8;});}else{return _0x2484f8;}})[_0x8d72('0x53')](function(_0x2e73b8){logger[_0x8d72('0x2d')](_0x8d72('0x54'),_0x2e73b8);throw _0x2e73b8;});}return _0x2484f8;})[_0x8d72('0x28')](respondWithResult(_0x72b6ad,0xc9))[_0x8d72('0x53')](handleError(_0x72b6ad,null));};exports[_0x8d72('0x27')]=function(_0x510cb1,_0x2c12b7){if(_0x510cb1['body']['id']){delete _0x510cb1['body']['id'];}return db[_0x8d72('0x47')]['find']({'where':{'id':_0x510cb1[_0x8d72('0x4a')]['id']}})[_0x8d72('0x28')](handleEntityNotFound(_0x2c12b7,null))[_0x8d72('0x28')](saveUpdates(_0x510cb1['body'],null))[_0x8d72('0x28')](respondWithResult(_0x2c12b7,null))['catch'](handleError(_0x2c12b7,null));};exports['destroy']=function(_0x82f49e,_0x4c8162){return db[_0x8d72('0x47')][_0x8d72('0x4c')]({'where':{'id':_0x82f49e['params']['id']}})['then'](handleEntityNotFound(_0x4c8162,null))[_0x8d72('0x28')](removeEntity(_0x4c8162,null))[_0x8d72('0x53')](handleError(_0x4c8162,null));}; \ No newline at end of file +var _0x9a3b=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','update','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','find'];(function(_0x2618a7,_0x590671){var _0x27668b=function(_0x2b1b63){while(--_0x2b1b63){_0x2618a7['push'](_0x2618a7['shift']());}};_0x27668b(++_0x590671);}(_0x9a3b,0x14e));var _0xb9a3=function(_0x272e19,_0x1fbcc2){_0x272e19=_0x272e19-0x0;var _0x835bfb=_0x9a3b[_0x272e19];return _0x835bfb;};'use strict';var emlformat=require(_0xb9a3('0x0'));var rimraf=require(_0xb9a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9a3('0x2'));var rp=require(_0xb9a3('0x3'));var moment=require(_0xb9a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9a3('0x5'));var util=require(_0xb9a3('0x6'));var path=require('path');var sox=require(_0xb9a3('0x7'));var csv=require('to-csv');var ejs=require(_0xb9a3('0x8'));var fs=require('fs');var fs_extra=require(_0xb9a3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9a3('0xa'));var deskjs=require(_0xb9a3('0xb'));var toCsv=require(_0xb9a3('0xc'));var querystring=require('querystring');var Papa=require(_0xb9a3('0xd'));var Redis=require(_0xb9a3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9a3('0xf'));var as=require(_0xb9a3('0x10'));var hardwareService=require(_0xb9a3('0x11'));var logger=require(_0xb9a3('0x12'))(_0xb9a3('0x13'));var utils=require(_0xb9a3('0x14'));var config=require(_0xb9a3('0x15'));var licenseUtil=require(_0xb9a3('0x16'));var db=require(_0xb9a3('0x17'))['db'];function respondWithStatusCode(_0x4d72f4,_0x5f3442){_0x5f3442=_0x5f3442||0xcc;return function(_0x1a33e1){if(_0x1a33e1){return _0x4d72f4[_0xb9a3('0x18')](_0x5f3442);}return _0x4d72f4[_0xb9a3('0x19')](_0x5f3442)['end']();};}function respondWithResult(_0x190fd6,_0x79d6b2){_0x79d6b2=_0x79d6b2||0xc8;return function(_0x2b4392){if(_0x2b4392){return _0x190fd6['status'](_0x79d6b2)['json'](_0x2b4392);}};}function respondWithFilteredResult(_0x10a459,_0x8c01f7){return function(_0x11dbed){if(_0x11dbed){var _0x36a922=typeof _0x8c01f7[_0xb9a3('0x1a')]===_0xb9a3('0x1b')&&typeof _0x8c01f7[_0xb9a3('0x1c')]==='undefined';var _0x260736=_0x11dbed[_0xb9a3('0x1d')];var _0x185da6=_0x36a922?0x0:_0x8c01f7[_0xb9a3('0x1a')];var _0x413bc0=_0x36a922?_0x11dbed[_0xb9a3('0x1d')]:_0x8c01f7[_0xb9a3('0x1a')]+_0x8c01f7['limit'];var _0x21ba0a;if(_0x413bc0>=_0x260736){_0x413bc0=_0x260736;_0x21ba0a=0xc8;}else{_0x21ba0a=0xce;}_0x10a459[_0xb9a3('0x19')](_0x21ba0a);return _0x10a459['set']('Content-Range',_0x185da6+'-'+_0x413bc0+'/'+_0x260736)[_0xb9a3('0x1e')](_0x11dbed);}return null;};}function patchUpdates(_0x1cfc6a){return function(_0x33affc){try{jsonpatch[_0xb9a3('0x1f')](_0x33affc,_0x1cfc6a,!![]);}catch(_0x1ed271){return BPromise['reject'](_0x1ed271);}return _0x33affc['save']();};}function saveUpdates(_0xa8d361,_0x39a123){return function(_0x28ee53){if(_0x28ee53){return _0x28ee53[_0xb9a3('0x20')](_0xa8d361)[_0xb9a3('0x21')](function(_0x1c4677){return _0x1c4677;});}return null;};}function removeEntity(_0x82bbc8,_0x54e948){return function(_0x4d5e10){if(_0x4d5e10){return _0x4d5e10['destroy']()[_0xb9a3('0x21')](function(){var _0x41dc14=_0x4d5e10['get']({'plain':!![]});var _0x3027b0='CmContactHasItems';return db[_0xb9a3('0x22')][_0xb9a3('0x23')]({'where':{'type':_0x3027b0,'resourceId':_0x41dc14['id']}})[_0xb9a3('0x21')](function(){return _0x4d5e10;});})[_0xb9a3('0x21')](function(){_0x82bbc8[_0xb9a3('0x19')](0xcc)[_0xb9a3('0x24')]();});}};}function handleEntityNotFound(_0x188406,_0x1ab5c3){return function(_0x1d80d1){if(!_0x1d80d1){_0x188406[_0xb9a3('0x18')](0x194);}return _0x1d80d1;};}function handleError(_0x4b1f9a,_0x5a5d90){_0x5a5d90=_0x5a5d90||0x1f4;return function(_0x53e502){logger[_0xb9a3('0x25')](_0x53e502[_0xb9a3('0x26')]);if(_0x53e502[_0xb9a3('0x27')]){delete _0x53e502[_0xb9a3('0x27')];}_0x4b1f9a[_0xb9a3('0x19')](_0x5a5d90)[_0xb9a3('0x28')](_0x53e502);};}exports[_0xb9a3('0x29')]=function(_0x4e8ac9,_0x478bed){var _0x347dd6={},_0x37f670={},_0x30645c={'count':0x0,'rows':[]};var _0x5ca7e7=_[_0xb9a3('0x2a')](db[_0xb9a3('0x2b')][_0xb9a3('0x2c')],function(_0x21f16a){return{'name':_0x21f16a[_0xb9a3('0x2d')],'type':_0x21f16a[_0xb9a3('0x2e')][_0xb9a3('0x2f')]};});_0x37f670[_0xb9a3('0x30')]=_['map'](_0x5ca7e7,_0xb9a3('0x27'));_0x37f670[_0xb9a3('0x31')]=_['keys'](_0x4e8ac9[_0xb9a3('0x31')]);_0x37f670[_0xb9a3('0x32')]=_[_0xb9a3('0x33')](_0x37f670[_0xb9a3('0x30')],_0x37f670[_0xb9a3('0x31')]);_0x347dd6[_0xb9a3('0x34')]=_[_0xb9a3('0x33')](_0x37f670[_0xb9a3('0x30')],qs[_0xb9a3('0x35')](_0x4e8ac9[_0xb9a3('0x31')][_0xb9a3('0x35')]));_0x347dd6[_0xb9a3('0x34')]=_0x347dd6['attributes'][_0xb9a3('0x36')]?_0x347dd6['attributes']:_0x37f670[_0xb9a3('0x30')];if(!_0x4e8ac9[_0xb9a3('0x31')][_0xb9a3('0x37')](_0xb9a3('0x38'))){_0x347dd6[_0xb9a3('0x1c')]=qs[_0xb9a3('0x1c')](_0x4e8ac9[_0xb9a3('0x31')]['limit']);_0x347dd6[_0xb9a3('0x1a')]=qs['offset'](_0x4e8ac9[_0xb9a3('0x31')]['offset']);}_0x347dd6[_0xb9a3('0x39')]=qs['sort'](_0x4e8ac9[_0xb9a3('0x31')][_0xb9a3('0x3a')]);_0x347dd6[_0xb9a3('0x3b')]=qs['filters'](_[_0xb9a3('0x3c')](_0x4e8ac9[_0xb9a3('0x31')],_0x37f670['filters']),_0x5ca7e7);if(_0x4e8ac9[_0xb9a3('0x31')][_0xb9a3('0x3d')]){_0x347dd6[_0xb9a3('0x3b')]=_[_0xb9a3('0x3e')](_0x347dd6[_0xb9a3('0x3b')],{'$or':_['map'](_0x5ca7e7,function(_0x498f90){if(_0x498f90['type']!==_0xb9a3('0x3f')){var _0x14ae3e={};_0x14ae3e[_0x498f90[_0xb9a3('0x27')]]={'$like':'%'+_0x4e8ac9['query'][_0xb9a3('0x3d')]+'%'};return _0x14ae3e;}})});}_0x347dd6=_['merge']({},_0x347dd6,_0x4e8ac9[_0xb9a3('0x40')]);var _0x191792={'where':_0x347dd6['where']};return db[_0xb9a3('0x2b')][_0xb9a3('0x1d')](_0x191792)[_0xb9a3('0x21')](function(_0x416edc){_0x30645c['count']=_0x416edc;if(_0x4e8ac9[_0xb9a3('0x31')][_0xb9a3('0x41')]){_0x347dd6[_0xb9a3('0x42')]=[{'all':!![]}];}return db[_0xb9a3('0x2b')]['findAll'](_0x347dd6);})[_0xb9a3('0x21')](function(_0x403a56){_0x30645c['rows']=_0x403a56;return _0x30645c;})['then'](respondWithFilteredResult(_0x478bed,_0x347dd6))['catch'](handleError(_0x478bed,null));};exports[_0xb9a3('0x43')]=function(_0x2943fa,_0x7a3b9f){var _0x22f814={'raw':!![],'where':{'id':_0x2943fa[_0xb9a3('0x44')]['id']}},_0x3901c9={};_0x3901c9[_0xb9a3('0x30')]=_[_0xb9a3('0x45')](db['CmContactHasItem']['rawAttributes']);_0x3901c9['query']=_[_0xb9a3('0x45')](_0x2943fa[_0xb9a3('0x31')]);_0x3901c9[_0xb9a3('0x32')]=_['intersection'](_0x3901c9[_0xb9a3('0x30')],_0x3901c9['query']);_0x22f814[_0xb9a3('0x34')]=_[_0xb9a3('0x33')](_0x3901c9[_0xb9a3('0x30')],qs[_0xb9a3('0x35')](_0x2943fa['query'][_0xb9a3('0x35')]));_0x22f814[_0xb9a3('0x34')]=_0x22f814['attributes'][_0xb9a3('0x36')]?_0x22f814[_0xb9a3('0x34')]:_0x3901c9[_0xb9a3('0x30')];if(_0x2943fa[_0xb9a3('0x31')][_0xb9a3('0x41')]){_0x22f814[_0xb9a3('0x42')]=[{'all':!![]}];}_0x22f814=_[_0xb9a3('0x3e')]({},_0x22f814,_0x2943fa[_0xb9a3('0x40')]);return db[_0xb9a3('0x2b')][_0xb9a3('0x46')](_0x22f814)[_0xb9a3('0x21')](handleEntityNotFound(_0x7a3b9f,null))['then'](respondWithResult(_0x7a3b9f,null))[_0xb9a3('0x47')](handleError(_0x7a3b9f,null));};exports['create']=function(_0x5c5c60,_0x233d34){return db[_0xb9a3('0x2b')][_0xb9a3('0x48')](_0x5c5c60[_0xb9a3('0x49')],{})[_0xb9a3('0x21')](function(_0x41c3c0){var _0x2a329a=_0x5c5c60[_0xb9a3('0x4a')]['get']({'plain':!![]});if(!_0x2a329a)throw new Error(_0xb9a3('0x4b'));if(_0x2a329a[_0xb9a3('0x4c')]===_0xb9a3('0x4a')){var _0x27cda3=_0x41c3c0['get']({'plain':!![]});var _0x14db8c=_0xb9a3('0x4d');return db[_0xb9a3('0x4e')][_0xb9a3('0x46')]({'where':{'name':_0x14db8c,'userProfileId':_0x2a329a[_0xb9a3('0x4f')]},'raw':!![]})[_0xb9a3('0x21')](function(_0x3cec8d){if(_0x3cec8d&&_0x3cec8d['autoAssociation']===0x0){return db[_0xb9a3('0x22')][_0xb9a3('0x48')]({'name':_0x27cda3[_0xb9a3('0x27')],'resourceId':_0x27cda3['id'],'type':_0x3cec8d[_0xb9a3('0x27')],'sectionId':_0x3cec8d['id']},{})[_0xb9a3('0x21')](function(){return _0x41c3c0;});}else{return _0x41c3c0;}})[_0xb9a3('0x47')](function(_0x5e4b54){logger[_0xb9a3('0x25')](_0xb9a3('0x50'),_0x5e4b54);throw _0x5e4b54;});}return _0x41c3c0;})['then'](respondWithResult(_0x233d34,0xc9))['catch'](handleError(_0x233d34,null));};exports[_0xb9a3('0x20')]=function(_0x24cf9c,_0x2112df){if(_0x24cf9c[_0xb9a3('0x49')]['id']){delete _0x24cf9c['body']['id'];}return db[_0xb9a3('0x2b')][_0xb9a3('0x46')]({'where':{'id':_0x24cf9c[_0xb9a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2112df,null))[_0xb9a3('0x21')](saveUpdates(_0x24cf9c[_0xb9a3('0x49')],null))[_0xb9a3('0x21')](respondWithResult(_0x2112df,null))[_0xb9a3('0x47')](handleError(_0x2112df,null));};exports['destroy']=function(_0x4d3743,_0x588de2){return db[_0xb9a3('0x2b')][_0xb9a3('0x46')]({'where':{'id':_0x4d3743[_0xb9a3('0x44')]['id']}})[_0xb9a3('0x21')](handleEntityNotFound(_0x588de2,null))[_0xb9a3('0x21')](removeEntity(_0x588de2,null))[_0xb9a3('0x47')](handleError(_0x588de2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index ac8ab10..e740afe 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a31=['bluebird','request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment'];(function(_0x520f08,_0x469f5b){var _0x4651ac=function(_0x14d451){while(--_0x14d451){_0x520f08['push'](_0x520f08['shift']());}};_0x4651ac(++_0x469f5b);}(_0x9a31,0x181));var _0x19a3=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x9a31[_0x13b392];return _0x39db24;};'use strict';var _=require(_0x19a3('0x0'));var util=require(_0x19a3('0x1'));var logger=require(_0x19a3('0x2'))(_0x19a3('0x3'));var moment=require(_0x19a3('0x4'));var BPromise=require(_0x19a3('0x5'));var rp=require(_0x19a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19a3('0x7'));var attributes=require(_0x19a3('0x8'));module[_0x19a3('0x9')]=function(_0x9e6a03,_0x1f2929){return _0x9e6a03[_0x19a3('0xa')](_0x19a3('0xb'),attributes,{'tableName':_0x19a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45a6=['../../config/logger','api','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x1e8854,_0x54be63){var _0xdbb377=function(_0x3dbf3b){while(--_0x3dbf3b){_0x1e8854['push'](_0x1e8854['shift']());}};_0xdbb377(++_0x54be63);}(_0x45a6,0xfb));var _0x645a=function(_0x4d5c99,_0x31fa6a){_0x4d5c99=_0x4d5c99-0x0;var _0x13e254=_0x45a6[_0x4d5c99];return _0x13e254;};'use strict';var _=require(_0x645a('0x0'));var util=require(_0x645a('0x1'));var logger=require(_0x645a('0x2'))(_0x645a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x645a('0x4'));var fs=require('fs');var path=require(_0x645a('0x5'));var rimraf=require('rimraf');var config=require(_0x645a('0x6'));var attributes=require(_0x645a('0x7'));module[_0x645a('0x8')]=function(_0x11ee3b,_0x5e9775){return _0x11ee3b['define'](_0x645a('0x9'),attributes,{'tableName':_0x645a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index cda097e..23e8ded 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5645=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird'];(function(_0x5db8d7,_0x370648){var _0x231930=function(_0xba47b4){while(--_0xba47b4){_0x5db8d7['push'](_0x5db8d7['shift']());}};_0x231930(++_0x370648);}(_0x5645,0x105));var _0x5564=function(_0x1d10cd,_0x29c342){_0x1d10cd=_0x1d10cd-0x0;var _0x536baa=_0x5645[_0x1d10cd];return _0x536baa;};'use strict';var _=require('lodash');var util=require(_0x5564('0x0'));var moment=require(_0x5564('0x1'));var BPromise=require(_0x5564('0x2'));var rs=require(_0x5564('0x3'));var fs=require('fs');var Redis=require(_0x5564('0x4'));var db=require(_0x5564('0x5'))['db'];var utils=require(_0x5564('0x6'));var logger=require(_0x5564('0x7'))(_0x5564('0x8'));var config=require(_0x5564('0x9'));var jayson=require(_0x5564('0xa'));var client=jayson[_0x5564('0xb')][_0x5564('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aafb7,_0x69cdcc,_0x179977){return new BPromise(function(_0x18c124,_0x1bed67){return client[_0x5564('0xd')](_0x2aafb7,_0x179977)[_0x5564('0xe')](function(_0x5c058e){logger[_0x5564('0xf')](_0x5564('0x10'),_0x69cdcc,'request\x20sent');logger['debug'](_0x5564('0x11'),_0x69cdcc,_0x5564('0x12'),JSON['stringify'](_0x5c058e));if(_0x5c058e['error']){if(_0x5c058e[_0x5564('0x13')][_0x5564('0x14')]===0x1f4){logger[_0x5564('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x69cdcc,_0x5c058e['error'][_0x5564('0x15')]);return _0x1bed67(_0x5c058e[_0x5564('0x13')][_0x5564('0x15')]);}logger[_0x5564('0x13')](_0x5564('0x10'),_0x69cdcc,_0x5c058e['error'][_0x5564('0x15')]);return _0x18c124(_0x5c058e[_0x5564('0x13')][_0x5564('0x15')]);}else{logger[_0x5564('0xf')](_0x5564('0x10'),_0x69cdcc,'request\x20sent');_0x18c124(_0x5c058e[_0x5564('0x16')]['message']);}})[_0x5564('0x17')](function(_0x4d5192){logger[_0x5564('0x13')](_0x5564('0x10'),_0x69cdcc,_0x4d5192);_0x1bed67(_0x4d5192);});});} \ No newline at end of file +var _0xd445=['stringify','error','CmContactHasItem,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x36c686,_0x2d83fa){var _0xc10915=function(_0x147aec){while(--_0x147aec){_0x36c686['push'](_0x36c686['shift']());}};_0xc10915(++_0x2d83fa);}(_0xd445,0x167));var _0x5d44=function(_0x179bd9,_0x1d5672){_0x179bd9=_0x179bd9-0x0;var _0x2d608d=_0xd445[_0x179bd9];return _0x2d608d;};'use strict';var _=require(_0x5d44('0x0'));var util=require(_0x5d44('0x1'));var moment=require('moment');var BPromise=require(_0x5d44('0x2'));var rs=require(_0x5d44('0x3'));var fs=require('fs');var Redis=require(_0x5d44('0x4'));var db=require(_0x5d44('0x5'))['db'];var utils=require(_0x5d44('0x6'));var logger=require(_0x5d44('0x7'))(_0x5d44('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d44('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dbfc5,_0x405f56,_0x21ad4f){return new BPromise(function(_0x19bed1,_0x5a5e83){return client[_0x5d44('0xa')](_0x1dbfc5,_0x21ad4f)[_0x5d44('0xb')](function(_0x3f8acb){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x405f56,_0x5d44('0xc'));logger[_0x5d44('0xd')](_0x5d44('0xe'),_0x405f56,_0x5d44('0xc'),JSON[_0x5d44('0xf')](_0x3f8acb));if(_0x3f8acb[_0x5d44('0x10')]){if(_0x3f8acb['error']['code']===0x1f4){logger[_0x5d44('0x10')](_0x5d44('0x11'),_0x405f56,_0x3f8acb[_0x5d44('0x10')]['message']);return _0x5a5e83(_0x3f8acb['error'][_0x5d44('0x12')]);}logger['error'](_0x5d44('0x11'),_0x405f56,_0x3f8acb[_0x5d44('0x10')][_0x5d44('0x12')]);return _0x19bed1(_0x3f8acb[_0x5d44('0x10')][_0x5d44('0x12')]);}else{logger[_0x5d44('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x405f56,'request\x20sent');_0x19bed1(_0x3f8acb[_0x5d44('0x14')][_0x5d44('0x12')]);}})[_0x5d44('0x15')](function(_0x2c1918){logger[_0x5d44('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x405f56,_0x2c1918);_0x5a5e83(_0x2c1918);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index fc455cf..ace30fa 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe537=['../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','get','show','post','create','/:id','update','delete','destroy','util','connect-timeout','fs-extra'];(function(_0x45505a,_0x59368a){var _0x36a1f6=function(_0x2f4542){while(--_0x2f4542){_0x45505a['push'](_0x45505a['shift']());}};_0x36a1f6(++_0x59368a);}(_0xe537,0x13f));var _0x7e53=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0xe537[_0xbc346f];return _0x9f9260;};'use strict';var multer=require('multer');var util=require(_0x7e53('0x0'));var path=require('path');var timeout=require(_0x7e53('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7e53('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7e53('0x3'));var config=require('../../config/environment');var controller=require(_0x7e53('0x4'));router['get']('/',auth[_0x7e53('0x5')](),controller['index']);router[_0x7e53('0x6')]('/:id',auth[_0x7e53('0x5')](),controller[_0x7e53('0x7')]);router[_0x7e53('0x8')]('/',auth[_0x7e53('0x5')](),controller[_0x7e53('0x9')]);router['put'](_0x7e53('0xa'),auth['isAuthenticated'](),controller[_0x7e53('0xb')]);router[_0x7e53('0xc')](_0x7e53('0xa'),auth[_0x7e53('0x5')](),controller[_0x7e53('0xd')]);module['exports']=router; \ No newline at end of file +var _0x36b1=['get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x1f1af6,_0x26de84){var _0x516025=function(_0x4e4967){while(--_0x4e4967){_0x1f1af6['push'](_0x1f1af6['shift']());}};_0x516025(++_0x26de84);}(_0x36b1,0x1aa));var _0x136b=function(_0x43bbd7,_0x1fbced){_0x43bbd7=_0x43bbd7-0x0;var _0x229107=_0x36b1[_0x43bbd7];return _0x229107;};'use strict';var multer=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var path=require(_0x136b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x136b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x136b('0x4'));var controller=require(_0x136b('0x5'));router[_0x136b('0x6')]('/',auth[_0x136b('0x7')](),controller['index']);router[_0x136b('0x6')](_0x136b('0x8'),auth['isAuthenticated'](),controller[_0x136b('0x9')]);router[_0x136b('0xa')]('/',auth[_0x136b('0x7')](),controller[_0x136b('0xb')]);router['put']('/:id',auth[_0x136b('0x7')](),controller[_0x136b('0xc')]);router[_0x136b('0xd')]('/:id',auth[_0x136b('0x7')](),controller[_0x136b('0xe')]);module[_0x136b('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 082f54f..e968f0f 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 _0x4567=['getDataValue','alias','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','VIRTUAL'];(function(_0x2b80f6,_0x2410a2){var _0x27fecd=function(_0x2848d9){while(--_0x2848d9){_0x2b80f6['push'](_0x2b80f6['shift']());}};_0x27fecd(++_0x2410a2);}(_0x4567,0x152));var _0x7456=function(_0x25c43f,_0x4b687b){_0x25c43f=_0x25c43f-0x0;var _0x27fecd=_0x4567[_0x25c43f];return _0x27fecd;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7456('0x0'));module['exports']={'name':{'type':Sequelize[_0x7456('0x1')],'get':function(_0x1d4ce5){return this[_0x7456('0x2')](_0x7456('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3db43d){this[_0x7456('0x4')](_0x7456('0x3'),_0x3db43d?_0x3db43d:this['getDataValue'](_0x7456('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x7456('0x6')](_0x7456('0x7')),'get':function(){if(this[_0x7456('0x2')](_0x7456('0x8'))===_0x7456('0x9')){return JSON[_0x7456('0xa')](this[_0x7456('0x2')](_0x7456('0xb')));}else{return this[_0x7456('0x2')](_0x7456('0xb'));}},'set':function(_0x51cf83){if(Array[_0x7456('0xc')](_0x51cf83)){this['setDataValue'](_0x7456('0xb'),JSON[_0x7456('0xd')](_0x51cf83));}else{this[_0x7456('0x4')](_0x7456('0xb'),_0x51cf83);}}},'required':{'type':Sequelize[_0x7456('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7456('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7456('0xf')](_0x7456('0x10'))}}; \ No newline at end of file +var _0x133e=['ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type','select','parse','values','isArray','BOOLEAN'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x133e,0x1c1));var _0xe133=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x133e[_0x12bcf7];return _0x2825a;};'use strict';var Sequelize=require(_0xe133('0x0'));var _=require(_0xe133('0x1'));module['exports']={'name':{'type':Sequelize[_0xe133('0x2')],'get':function(_0x4c99d1){return this[_0xe133('0x3')](_0xe133('0x4'));}},'alias':{'type':Sequelize[_0xe133('0x5')],'allowNull':![],'set':function(_0x47ba04){this[_0xe133('0x6')](_0xe133('0x4'),_0x47ba04?_0x47ba04:this[_0xe133('0x3')](_0xe133('0x7')));}},'type':{'type':Sequelize[_0xe133('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xe133('0x8')),'get':function(){if(this[_0xe133('0x3')](_0xe133('0x9'))===_0xe133('0xa')){return JSON[_0xe133('0xb')](this[_0xe133('0x3')](_0xe133('0xc')));}else{return this[_0xe133('0x3')](_0xe133('0xc'));}},'set':function(_0xf31a7c){if(Array[_0xe133('0xd')](_0xf31a7c)){this[_0xe133('0x6')](_0xe133('0xc'),JSON['stringify'](_0xf31a7c));}else{this['setDataValue'](_0xe133('0xc'),_0xf31a7c);}}},'required':{'type':Sequelize[_0xe133('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe133('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe133('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index fc685ec..a6fb7fe 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 _0x93b8=['format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','sendStatus','name','send','map','CmCustomField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','destroy','find','transaction','Sequelize','TEXT','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts'];(function(_0x7bcc3e,_0x164e76){var _0x2b6dc8=function(_0x411c20){while(--_0x411c20){_0x7bcc3e['push'](_0x7bcc3e['shift']());}};_0x2b6dc8(++_0x164e76);}(_0x93b8,0xa8));var _0x893b=function(_0x20fbe7,_0x37da5b){_0x20fbe7=_0x20fbe7-0x0;var _0x5f535c=_0x93b8[_0x20fbe7];return _0x5f535c;};'use strict';var emlformat=require(_0x893b('0x0'));var rimraf=require(_0x893b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x893b('0x2'));var rp=require(_0x893b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x893b('0x4'));var util=require(_0x893b('0x5'));var path=require('path');var sox=require(_0x893b('0x6'));var csv=require(_0x893b('0x7'));var ejs=require(_0x893b('0x8'));var fs=require('fs');var fs_extra=require(_0x893b('0x9'));var _=require(_0x893b('0xa'));var squel=require(_0x893b('0xb'));var crypto=require(_0x893b('0xc'));var jsforce=require(_0x893b('0xd'));var deskjs=require(_0x893b('0xe'));var toCsv=require(_0x893b('0x7'));var querystring=require(_0x893b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x893b('0x10'));var qs=require(_0x893b('0x11'));var as=require(_0x893b('0x12'));var hardwareService=require(_0x893b('0x13'));var logger=require(_0x893b('0x14'))(_0x893b('0x15'));var utils=require('../../config/utils');var config=require(_0x893b('0x16'));var licenseUtil=require(_0x893b('0x17'));var db=require(_0x893b('0x18'))['db'];function respondWithStatusCode(_0x2ec39d,_0x26064){_0x26064=_0x26064||0xcc;return function(_0x5173fe){if(_0x5173fe){return _0x2ec39d['sendStatus'](_0x26064);}return _0x2ec39d[_0x893b('0x19')](_0x26064)['end']();};}function respondWithResult(_0x5df872,_0x31b8d1){_0x31b8d1=_0x31b8d1||0xc8;return function(_0x30cbb4){if(_0x30cbb4){return _0x5df872[_0x893b('0x19')](_0x31b8d1)[_0x893b('0x1a')](_0x30cbb4);}};}function respondWithFilteredResult(_0x5b36ea,_0x2d0585){return function(_0x4b2b89){if(_0x4b2b89){var _0x26cd70=typeof _0x2d0585['offset']===_0x893b('0x1b')&&typeof _0x2d0585[_0x893b('0x1c')]===_0x893b('0x1b');var _0xdf3ce9=_0x4b2b89[_0x893b('0x1d')];var _0x40881c=_0x26cd70?0x0:_0x2d0585[_0x893b('0x1e')];var _0x20446f=_0x26cd70?_0x4b2b89['count']:_0x2d0585[_0x893b('0x1e')]+_0x2d0585[_0x893b('0x1c')];var _0x3918ba;if(_0x20446f>=_0xdf3ce9){_0x20446f=_0xdf3ce9;_0x3918ba=0xc8;}else{_0x3918ba=0xce;}_0x5b36ea[_0x893b('0x19')](_0x3918ba);return _0x5b36ea['set'](_0x893b('0x1f'),_0x40881c+'-'+_0x20446f+'/'+_0xdf3ce9)['json'](_0x4b2b89);}return null;};}function patchUpdates(_0x5dead7){return function(_0x4a948a){try{jsonpatch[_0x893b('0x20')](_0x4a948a,_0x5dead7,!![]);}catch(_0x5a9c02){return BPromise[_0x893b('0x21')](_0x5a9c02);}return _0x4a948a['save']();};}function saveUpdates(_0x332de5,_0x2f8850){return function(_0x473ca1){if(_0x473ca1){return _0x473ca1[_0x893b('0x22')](_0x332de5)[_0x893b('0x23')](function(_0x4e9ea9){return _0x4e9ea9;});}return null;};}function removeEntity(_0x5e2b16,_0x5783ac){return function(_0x96af1){if(_0x96af1){return _0x96af1['destroy']()[_0x893b('0x23')](function(){_0x5e2b16[_0x893b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa997,_0xaf8538){return function(_0x264b55){if(!_0x264b55){_0x5aa997[_0x893b('0x24')](0x194);}return _0x264b55;};}function handleError(_0x521c68,_0x4d41ad){_0x4d41ad=_0x4d41ad||0x1f4;return function(_0x47d6aa){logger['error'](_0x47d6aa['stack']);if(_0x47d6aa['name']){delete _0x47d6aa[_0x893b('0x25')];}_0x521c68[_0x893b('0x19')](_0x4d41ad)[_0x893b('0x26')](_0x47d6aa);};}exports['index']=function(_0x4fd2a9,_0x1c67c5){var _0x1a4b75={},_0x1fd0fc={},_0x310b61={'count':0x0,'rows':[]};var _0x218465=_[_0x893b('0x27')](db[_0x893b('0x28')][_0x893b('0x29')],function(_0x3c2482){return{'name':_0x3c2482[_0x893b('0x2a')],'type':_0x3c2482['type']['key']};});_0x1fd0fc[_0x893b('0x2b')]=_['differenceBy'](_[_0x893b('0x27')](_0x218465,'name'),[_0x893b('0x25')]);_0x1fd0fc[_0x893b('0x2c')]=_[_0x893b('0x2d')](_0x4fd2a9[_0x893b('0x2c')]);_0x1fd0fc[_0x893b('0x2e')]=_['intersection'](_0x1fd0fc['model'],_0x1fd0fc['query']);_0x1a4b75[_0x893b('0x2f')]=_[_0x893b('0x30')](_0x1fd0fc[_0x893b('0x2b')],qs[_0x893b('0x31')](_0x4fd2a9['query']['fields']));_0x1a4b75['attributes']=_0x1a4b75[_0x893b('0x2f')][_0x893b('0x32')]?_0x1a4b75[_0x893b('0x2f')]:_0x1fd0fc[_0x893b('0x2b')];if(!_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x33')](_0x893b('0x34'))){_0x1a4b75['limit']=qs[_0x893b('0x1c')](_0x4fd2a9['query'][_0x893b('0x1c')]);_0x1a4b75[_0x893b('0x1e')]=qs[_0x893b('0x1e')](_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x1e')]);}_0x1a4b75['order']=qs[_0x893b('0x35')](_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x35')]);_0x1a4b75[_0x893b('0x36')]=qs[_0x893b('0x2e')](_[_0x893b('0x37')](_0x4fd2a9['query'],_0x1fd0fc['filters']),_0x218465);if(_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x38')]){_0x1a4b75[_0x893b('0x36')]=_[_0x893b('0x39')](_0x1a4b75[_0x893b('0x36')],{'$or':_['map'](_0x218465,function(_0x52d653){if(_0x52d653[_0x893b('0x3a')]!==_0x893b('0x3b')){var _0x454f55={};_0x454f55[_0x52d653[_0x893b('0x25')]]={'$like':'%'+_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x38')]+'%'};return _0x454f55;}})});}_0x1a4b75=_['merge']({},_0x1a4b75,_0x4fd2a9[_0x893b('0x3c')]);var _0x4ac71e={'where':_0x1a4b75[_0x893b('0x36')]};return db[_0x893b('0x28')][_0x893b('0x1d')](_0x4ac71e)[_0x893b('0x23')](function(_0x3c939a){_0x310b61[_0x893b('0x1d')]=_0x3c939a;if(_0x4fd2a9[_0x893b('0x2c')][_0x893b('0x3d')]){_0x1a4b75[_0x893b('0x3e')]=[{'all':!![]}];}return db[_0x893b('0x28')][_0x893b('0x3f')](_0x1a4b75);})[_0x893b('0x23')](function(_0xeb0d94){_0x310b61[_0x893b('0x40')]=_0xeb0d94;return _0x310b61;})[_0x893b('0x23')](respondWithFilteredResult(_0x1c67c5,_0x1a4b75))[_0x893b('0x41')](handleError(_0x1c67c5,null));};exports[_0x893b('0x42')]=function(_0x264a7e,_0x3e8201){var _0x181dbb={'raw':!![],'where':{'id':_0x264a7e[_0x893b('0x43')]['id']}},_0x451ec9={};_0x451ec9[_0x893b('0x2b')]=_['keys'](db[_0x893b('0x28')][_0x893b('0x29')]);_0x451ec9['query']=_[_0x893b('0x2d')](_0x264a7e['query']);_0x451ec9[_0x893b('0x2e')]=_[_0x893b('0x30')](_0x451ec9[_0x893b('0x2b')],_0x451ec9[_0x893b('0x2c')]);_0x181dbb['attributes']=_[_0x893b('0x30')](_0x451ec9[_0x893b('0x2b')],qs[_0x893b('0x31')](_0x264a7e['query']['fields']));_0x181dbb[_0x893b('0x2f')]=_0x181dbb[_0x893b('0x2f')]['length']?_0x181dbb[_0x893b('0x2f')]:_0x451ec9[_0x893b('0x2b')];if(_0x264a7e[_0x893b('0x2c')][_0x893b('0x3d')]){_0x181dbb[_0x893b('0x3e')]=[{'all':!![]}];}_0x181dbb=_[_0x893b('0x39')]({},_0x181dbb,_0x264a7e[_0x893b('0x3c')]);return db[_0x893b('0x28')]['find'](_0x181dbb)['then'](handleEntityNotFound(_0x3e8201,null))[_0x893b('0x23')](respondWithResult(_0x3e8201,null))[_0x893b('0x41')](handleError(_0x3e8201,null));};exports[_0x893b('0x22')]=function(_0x44e53f,_0x25f301){if(_0x44e53f['body']['id']){delete _0x44e53f[_0x893b('0x44')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x44e53f[_0x893b('0x43')]['id']}})['then'](handleEntityNotFound(_0x25f301,null))[_0x893b('0x23')](saveUpdates(_0x44e53f['body'],null))[_0x893b('0x23')](respondWithResult(_0x25f301,null))['catch'](handleError(_0x25f301,null));};exports[_0x893b('0x45')]=function(_0x5e2322,_0x29ee2e){return db[_0x893b('0x28')][_0x893b('0x46')]({'where':{'id':_0x5e2322['params']['id']}})['then'](handleEntityNotFound(_0x29ee2e,null))[_0x893b('0x23')](removeEntity(_0x29ee2e,null))[_0x893b('0x41')](handleError(_0x29ee2e,null));};exports['create']=function(_0x5311d3,_0x54c41b){var _0x55775c;return db['sequelize'][_0x893b('0x47')](function(_0x49e95e){return db[_0x893b('0x28')]['create'](_0x5311d3[_0x893b('0x44')],{'transaction':_0x49e95e})[_0x893b('0x23')](function(_0x23893c){_0x55775c=_0x23893c;var _0x35b118={'type':db[_0x893b('0x48')][_0x893b('0x49')],'transaction':_0x49e95e};switch(_0x5311d3[_0x893b('0x44')][_0x893b('0x3a')]){case'text':_0x35b118[_0x893b('0x3a')]=db[_0x893b('0x48')][_0x893b('0x49')];break;case'number':_0x35b118[_0x893b('0x3a')]=db[_0x893b('0x48')][_0x893b('0x4a')];break;case'switch':_0x35b118[_0x893b('0x3a')]=db[_0x893b('0x48')][_0x893b('0x4b')];_0x35b118[_0x893b('0x4c')]=![];break;default:}return db[_0x893b('0x4d')][_0x893b('0x4e')][_0x893b('0x4f')](_0x893b('0x50'),util[_0x893b('0x51')](_0x893b('0x52'),_0x55775c['id']),_0x35b118);})[_0x893b('0x23')](function(){return _0x55775c;});})[_0x893b('0x23')](respondWithResult(_0x54c41b,0xc9))[_0x893b('0x41')](handleError(_0x54c41b,null));}; \ No newline at end of file +var _0x4707=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','transaction','create','TEXT','text','number','Sequelize','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','model','differenceBy','filters','intersection','query','attributes'];(function(_0x29586f,_0x2c49b6){var _0x3cc6ab=function(_0xb62915){while(--_0xb62915){_0x29586f['push'](_0x29586f['shift']());}};_0x3cc6ab(++_0x2c49b6);}(_0x4707,0x80));var _0x7470=function(_0x2f8ad2,_0x2482ca){_0x2f8ad2=_0x2f8ad2-0x0;var _0x3e6483=_0x4707[_0x2f8ad2];return _0x3e6483;};'use strict';var emlformat=require(_0x7470('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7470('0x1'));var jsonpatch=require(_0x7470('0x2'));var rp=require(_0x7470('0x3'));var moment=require(_0x7470('0x4'));var BPromise=require(_0x7470('0x5'));var Mustache=require(_0x7470('0x6'));var util=require(_0x7470('0x7'));var path=require(_0x7470('0x8'));var sox=require(_0x7470('0x9'));var csv=require(_0x7470('0xa'));var ejs=require(_0x7470('0xb'));var fs=require('fs');var fs_extra=require(_0x7470('0xc'));var _=require('lodash');var squel=require(_0x7470('0xd'));var crypto=require(_0x7470('0xe'));var jsforce=require(_0x7470('0xf'));var deskjs=require(_0x7470('0x10'));var toCsv=require(_0x7470('0xa'));var querystring=require(_0x7470('0x11'));var Papa=require(_0x7470('0x12'));var Redis=require(_0x7470('0x13'));var authService=require(_0x7470('0x14'));var qs=require(_0x7470('0x15'));var as=require(_0x7470('0x16'));var hardwareService=require(_0x7470('0x17'));var logger=require(_0x7470('0x18'))(_0x7470('0x19'));var utils=require('../../config/utils');var config=require(_0x7470('0x1a'));var licenseUtil=require(_0x7470('0x1b'));var db=require(_0x7470('0x1c'))['db'];function respondWithStatusCode(_0x48ba6d,_0x35ebfd){_0x35ebfd=_0x35ebfd||0xcc;return function(_0x2cfe49){if(_0x2cfe49){return _0x48ba6d[_0x7470('0x1d')](_0x35ebfd);}return _0x48ba6d[_0x7470('0x1e')](_0x35ebfd)[_0x7470('0x1f')]();};}function respondWithResult(_0x1fe136,_0x32f4fc){_0x32f4fc=_0x32f4fc||0xc8;return function(_0x5aa58a){if(_0x5aa58a){return _0x1fe136[_0x7470('0x1e')](_0x32f4fc)[_0x7470('0x20')](_0x5aa58a);}};}function respondWithFilteredResult(_0x3834eb,_0x261318){return function(_0x9d1b59){if(_0x9d1b59){var _0xae8681=typeof _0x261318[_0x7470('0x21')]==='undefined'&&typeof _0x261318[_0x7470('0x22')]===_0x7470('0x23');var _0x58e370=_0x9d1b59[_0x7470('0x24')];var _0x282b0e=_0xae8681?0x0:_0x261318['offset'];var _0x535108=_0xae8681?_0x9d1b59[_0x7470('0x24')]:_0x261318[_0x7470('0x21')]+_0x261318[_0x7470('0x22')];var _0x1fe16e;if(_0x535108>=_0x58e370){_0x535108=_0x58e370;_0x1fe16e=0xc8;}else{_0x1fe16e=0xce;}_0x3834eb[_0x7470('0x1e')](_0x1fe16e);return _0x3834eb[_0x7470('0x25')](_0x7470('0x26'),_0x282b0e+'-'+_0x535108+'/'+_0x58e370)['json'](_0x9d1b59);}return null;};}function patchUpdates(_0x52e4ac){return function(_0x4ffb13){try{jsonpatch[_0x7470('0x27')](_0x4ffb13,_0x52e4ac,!![]);}catch(_0x51ff6c){return BPromise[_0x7470('0x28')](_0x51ff6c);}return _0x4ffb13[_0x7470('0x29')]();};}function saveUpdates(_0xf97ceb,_0x3b2183){return function(_0x23a51f){if(_0x23a51f){return _0x23a51f[_0x7470('0x2a')](_0xf97ceb)[_0x7470('0x2b')](function(_0x3cc29a){return _0x3cc29a;});}return null;};}function removeEntity(_0x3b905e,_0x15d196){return function(_0x29faae){if(_0x29faae){return _0x29faae[_0x7470('0x2c')]()[_0x7470('0x2b')](function(){_0x3b905e[_0x7470('0x1e')](0xcc)[_0x7470('0x1f')]();});}};}function handleEntityNotFound(_0x4b459b,_0x99d771){return function(_0x451963){if(!_0x451963){_0x4b459b[_0x7470('0x1d')](0x194);}return _0x451963;};}function handleError(_0x5a8b57,_0x26ef2c){_0x26ef2c=_0x26ef2c||0x1f4;return function(_0x270ec0){logger[_0x7470('0x2d')](_0x270ec0[_0x7470('0x2e')]);if(_0x270ec0['name']){delete _0x270ec0[_0x7470('0x2f')];}_0x5a8b57[_0x7470('0x1e')](_0x26ef2c)[_0x7470('0x30')](_0x270ec0);};}exports[_0x7470('0x31')]=function(_0x19a7eb,_0x12f67a){var _0x4362a8={},_0x4e2696={},_0x16bee4={'count':0x0,'rows':[]};var _0x1d44e4=_[_0x7470('0x32')](db[_0x7470('0x33')][_0x7470('0x34')],function(_0x3b8125){return{'name':_0x3b8125[_0x7470('0x35')],'type':_0x3b8125['type']['key']};});_0x4e2696[_0x7470('0x36')]=_[_0x7470('0x37')](_[_0x7470('0x32')](_0x1d44e4,'name'),[_0x7470('0x2f')]);_0x4e2696['query']=_['keys'](_0x19a7eb['query']);_0x4e2696[_0x7470('0x38')]=_[_0x7470('0x39')](_0x4e2696[_0x7470('0x36')],_0x4e2696[_0x7470('0x3a')]);_0x4362a8[_0x7470('0x3b')]=_[_0x7470('0x39')](_0x4e2696['model'],qs[_0x7470('0x3c')](_0x19a7eb[_0x7470('0x3a')][_0x7470('0x3c')]));_0x4362a8[_0x7470('0x3b')]=_0x4362a8[_0x7470('0x3b')][_0x7470('0x3d')]?_0x4362a8[_0x7470('0x3b')]:_0x4e2696['model'];if(!_0x19a7eb[_0x7470('0x3a')][_0x7470('0x3e')](_0x7470('0x3f'))){_0x4362a8[_0x7470('0x22')]=qs[_0x7470('0x22')](_0x19a7eb[_0x7470('0x3a')][_0x7470('0x22')]);_0x4362a8['offset']=qs['offset'](_0x19a7eb[_0x7470('0x3a')]['offset']);}_0x4362a8[_0x7470('0x40')]=qs['sort'](_0x19a7eb[_0x7470('0x3a')][_0x7470('0x41')]);_0x4362a8[_0x7470('0x42')]=qs[_0x7470('0x38')](_[_0x7470('0x43')](_0x19a7eb['query'],_0x4e2696[_0x7470('0x38')]),_0x1d44e4);if(_0x19a7eb[_0x7470('0x3a')]['filter']){_0x4362a8['where']=_[_0x7470('0x44')](_0x4362a8['where'],{'$or':_[_0x7470('0x32')](_0x1d44e4,function(_0x26cc8b){if(_0x26cc8b[_0x7470('0x45')]!==_0x7470('0x46')){var _0x40e5db={};_0x40e5db[_0x26cc8b[_0x7470('0x2f')]]={'$like':'%'+_0x19a7eb[_0x7470('0x3a')]['filter']+'%'};return _0x40e5db;}})});}_0x4362a8=_[_0x7470('0x44')]({},_0x4362a8,_0x19a7eb[_0x7470('0x47')]);var _0x29a7f1={'where':_0x4362a8['where']};return db[_0x7470('0x33')][_0x7470('0x24')](_0x29a7f1)[_0x7470('0x2b')](function(_0x1129ee){_0x16bee4[_0x7470('0x24')]=_0x1129ee;if(_0x19a7eb['query'][_0x7470('0x48')]){_0x4362a8[_0x7470('0x49')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x4362a8);})[_0x7470('0x2b')](function(_0x1199cd){_0x16bee4[_0x7470('0x4a')]=_0x1199cd;return _0x16bee4;})[_0x7470('0x2b')](respondWithFilteredResult(_0x12f67a,_0x4362a8))[_0x7470('0x4b')](handleError(_0x12f67a,null));};exports[_0x7470('0x4c')]=function(_0x18a6a0,_0x1f26e3){var _0x4e237f={'raw':!![],'where':{'id':_0x18a6a0[_0x7470('0x4d')]['id']}},_0x339de7={};_0x339de7[_0x7470('0x36')]=_['keys'](db['CmCustomField'][_0x7470('0x34')]);_0x339de7['query']=_[_0x7470('0x4e')](_0x18a6a0['query']);_0x339de7['filters']=_[_0x7470('0x39')](_0x339de7[_0x7470('0x36')],_0x339de7[_0x7470('0x3a')]);_0x4e237f['attributes']=_['intersection'](_0x339de7[_0x7470('0x36')],qs[_0x7470('0x3c')](_0x18a6a0['query'][_0x7470('0x3c')]));_0x4e237f['attributes']=_0x4e237f['attributes'][_0x7470('0x3d')]?_0x4e237f[_0x7470('0x3b')]:_0x339de7[_0x7470('0x36')];if(_0x18a6a0[_0x7470('0x3a')][_0x7470('0x48')]){_0x4e237f['include']=[{'all':!![]}];}_0x4e237f=_[_0x7470('0x44')]({},_0x4e237f,_0x18a6a0[_0x7470('0x47')]);return db['CmCustomField'][_0x7470('0x4f')](_0x4e237f)[_0x7470('0x2b')](handleEntityNotFound(_0x1f26e3,null))[_0x7470('0x2b')](respondWithResult(_0x1f26e3,null))[_0x7470('0x4b')](handleError(_0x1f26e3,null));};exports[_0x7470('0x2a')]=function(_0x847c0f,_0x5a07ae){if(_0x847c0f[_0x7470('0x50')]['id']){delete _0x847c0f[_0x7470('0x50')]['id'];}return db['CmCustomField'][_0x7470('0x4f')]({'where':{'id':_0x847c0f[_0x7470('0x4d')]['id']}})[_0x7470('0x2b')](handleEntityNotFound(_0x5a07ae,null))[_0x7470('0x2b')](saveUpdates(_0x847c0f[_0x7470('0x50')],null))[_0x7470('0x2b')](respondWithResult(_0x5a07ae,null))[_0x7470('0x4b')](handleError(_0x5a07ae,null));};exports[_0x7470('0x2c')]=function(_0x3486c7,_0x5e39c4){return db['CmCustomField'][_0x7470('0x4f')]({'where':{'id':_0x3486c7[_0x7470('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e39c4,null))['then'](removeEntity(_0x5e39c4,null))['catch'](handleError(_0x5e39c4,null));};exports['create']=function(_0x5823e9,_0x2a0328){var _0x17f907;return db['sequelize'][_0x7470('0x51')](function(_0x60c6){return db['CmCustomField'][_0x7470('0x52')](_0x5823e9[_0x7470('0x50')],{'transaction':_0x60c6})[_0x7470('0x2b')](function(_0x5a9355){_0x17f907=_0x5a9355;var _0x524028={'type':db['Sequelize'][_0x7470('0x53')],'transaction':_0x60c6};switch(_0x5823e9[_0x7470('0x50')][_0x7470('0x45')]){case _0x7470('0x54'):_0x524028[_0x7470('0x45')]=db['Sequelize'][_0x7470('0x53')];break;case _0x7470('0x55'):_0x524028[_0x7470('0x45')]=db[_0x7470('0x56')][_0x7470('0x57')];break;case'switch':_0x524028[_0x7470('0x45')]=db[_0x7470('0x56')][_0x7470('0x58')];_0x524028[_0x7470('0x59')]=![];break;default:}return db[_0x7470('0x5a')][_0x7470('0x5b')][_0x7470('0x5c')](_0x7470('0x5d'),util['format']('cf_%d',_0x17f907['id']),_0x524028);})[_0x7470('0x2b')](function(){return _0x17f907;});})[_0x7470('0x2b')](respondWithResult(_0x2a0328,0xc9))[_0x7470('0x4b')](handleError(_0x2a0328,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3e194d7..1b86940 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 _0xb8be=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger'];(function(_0x263992,_0x1b4090){var _0x379836=function(_0x4a8db4){while(--_0x4a8db4){_0x263992['push'](_0x263992['shift']());}};_0x379836(++_0x1b4090);}(_0xb8be,0x1ab));var _0xeb8b=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0xb8be[_0xf91841];return _0x4b9c44;};'use strict';var _=require(_0xeb8b('0x0'));var util=require('util');var logger=require(_0xeb8b('0x1'))(_0xeb8b('0x2'));var moment=require(_0xeb8b('0x3'));var BPromise=require(_0xeb8b('0x4'));var rp=require(_0xeb8b('0x5'));var fs=require('fs');var path=require(_0xeb8b('0x6'));var rimraf=require(_0xeb8b('0x7'));var config=require(_0xeb8b('0x8'));var attributes=require(_0xeb8b('0x9'));module[_0xeb8b('0xa')]=function(_0x5c8071,_0x570ecc){return _0x5c8071['define'](_0xeb8b('0xb'),attributes,{'tableName':_0xeb8b('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3021=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2f353c,_0x1162d6){var _0x12db88=function(_0x569333){while(--_0x569333){_0x2f353c['push'](_0x2f353c['shift']());}};_0x12db88(++_0x1162d6);}(_0x3021,0xf8));var _0x1302=function(_0x5721fb,_0x156210){_0x5721fb=_0x5721fb-0x0;var _0x3fa003=_0x3021[_0x5721fb];return _0x3fa003;};'use strict';var _=require(_0x1302('0x0'));var util=require(_0x1302('0x1'));var logger=require(_0x1302('0x2'))('api');var moment=require(_0x1302('0x3'));var BPromise=require('bluebird');var rp=require(_0x1302('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1302('0x5'));var config=require(_0x1302('0x6'));var attributes=require(_0x1302('0x7'));module[_0x1302('0x8')]=function(_0x17cac9,_0x22ec8a){return _0x17cac9[_0x1302('0x9')]('CmCustomField',attributes,{'tableName':_0x1302('0xa'),'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 54e93f1..ebf6bac 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 _0xba55=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x33e7cd,_0x5a81c8){var _0x8f2027=function(_0x2ac27c){while(--_0x2ac27c){_0x33e7cd['push'](_0x33e7cd['shift']());}};_0x8f2027(++_0x5a81c8);}(_0xba55,0x1f3));var _0x5ba5=function(_0xe1a7a0,_0x1cf62c){_0xe1a7a0=_0xe1a7a0-0x0;var _0x575a86=_0xba55[_0xe1a7a0];return _0x575a86;};'use strict';var _=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var moment=require(_0x5ba5('0x2'));var BPromise=require(_0x5ba5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ba5('0x4'));var db=require(_0x5ba5('0x5'))['db'];var utils=require(_0x5ba5('0x6'));var logger=require(_0x5ba5('0x7'))(_0x5ba5('0x8'));var config=require(_0x5ba5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5ba5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5bea,_0x166aec,_0x401282){return new BPromise(function(_0x29b210,_0x2744e8){return client[_0x5ba5('0xb')](_0x2d5bea,_0x401282)[_0x5ba5('0xc')](function(_0x384989){logger['info'](_0x5ba5('0xd'),_0x166aec,_0x5ba5('0xe'));logger['debug'](_0x5ba5('0xf'),_0x166aec,'request\x20sent',JSON[_0x5ba5('0x10')](_0x384989));if(_0x384989[_0x5ba5('0x11')]){if(_0x384989[_0x5ba5('0x11')][_0x5ba5('0x12')]===0x1f4){logger[_0x5ba5('0x11')](_0x5ba5('0xd'),_0x166aec,_0x384989[_0x5ba5('0x11')][_0x5ba5('0x13')]);return _0x2744e8(_0x384989[_0x5ba5('0x11')][_0x5ba5('0x13')]);}logger[_0x5ba5('0x11')](_0x5ba5('0xd'),_0x166aec,_0x384989[_0x5ba5('0x11')][_0x5ba5('0x13')]);return _0x29b210(_0x384989[_0x5ba5('0x11')]['message']);}else{logger['info'](_0x5ba5('0xd'),_0x166aec,'request\x20sent');_0x29b210(_0x384989['result']['message']);}})[_0x5ba5('0x14')](function(_0x51cbf2){logger[_0x5ba5('0x11')](_0x5ba5('0xd'),_0x166aec,_0x51cbf2);_0x2744e8(_0x51cbf2);});});} \ No newline at end of file +var _0x7a1c=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x1bc1a9,_0x274638){var _0x4ac617=function(_0x58cf23){while(--_0x58cf23){_0x1bc1a9['push'](_0x1bc1a9['shift']());}};_0x4ac617(++_0x274638);}(_0x7a1c,0x78));var _0xc7a1=function(_0x493665,_0x475fae){_0x493665=_0x493665-0x0;var _0x496f1d=_0x7a1c[_0x493665];return _0x496f1d;};'use strict';var _=require('lodash');var util=require(_0xc7a1('0x0'));var moment=require(_0xc7a1('0x1'));var BPromise=require(_0xc7a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a1('0x4'))(_0xc7a1('0x5'));var config=require(_0xc7a1('0x6'));var jayson=require(_0xc7a1('0x7'));var client=jayson[_0xc7a1('0x8')][_0xc7a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b162,_0x21d8f1,_0x4c11d0){return new BPromise(function(_0x7f53c0,_0x40439a){return client[_0xc7a1('0xa')](_0x52b162,_0x4c11d0)[_0xc7a1('0xb')](function(_0x25a9b4){logger['info'](_0xc7a1('0xc'),_0x21d8f1,_0xc7a1('0xd'));logger[_0xc7a1('0xe')](_0xc7a1('0xf'),_0x21d8f1,_0xc7a1('0xd'),JSON['stringify'](_0x25a9b4));if(_0x25a9b4['error']){if(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x11')]===0x1f4){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x40439a(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);return _0x7f53c0(_0x25a9b4[_0xc7a1('0x10')][_0xc7a1('0x12')]);}else{logger['info'](_0xc7a1('0xc'),_0x21d8f1,'request\x20sent');_0x7f53c0(_0x25a9b4['result']['message']);}})[_0xc7a1('0x13')](function(_0x38886d){logger[_0xc7a1('0x10')](_0xc7a1('0xc'),_0x21d8f1,_0x38886d);_0x40439a(_0x38886d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d7586ea..d1f97fa 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 _0x5024=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','create','put','update','/:id','destroy','exports'];(function(_0x2ded05,_0x5ec1e6){var _0x57b50b=function(_0x5d0a3c){while(--_0x5d0a3c){_0x2ded05['push'](_0x2ded05['shift']());}};_0x57b50b(++_0x5ec1e6);}(_0x5024,0xf7));var _0x4502=function(_0x16cb32,_0x29cd49){_0x16cb32=_0x16cb32-0x0;var _0x19b452=_0x5024[_0x16cb32];return _0x19b452;};'use strict';var multer=require(_0x4502('0x0'));var util=require(_0x4502('0x1'));var path=require(_0x4502('0x2'));var timeout=require(_0x4502('0x3'));var express=require('express');var router=express[_0x4502('0x4')]();var fs_extra=require(_0x4502('0x5'));var auth=require(_0x4502('0x6'));var interaction=require(_0x4502('0x7'));var config=require(_0x4502('0x8'));var controller=require(_0x4502('0x9'));router[_0x4502('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4502('0xa')]('/:id',auth[_0x4502('0xb')](),controller[_0x4502('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4502('0xd')]);router[_0x4502('0xe')]('/:id',auth[_0x4502('0xb')](),controller[_0x4502('0xf')]);router['delete'](_0x4502('0x10'),auth[_0x4502('0xb')](),controller[_0x4502('0x11')]);module[_0x4502('0x12')]=router; \ No newline at end of file +var _0x8289=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x8289,0xf8));var _0x9828=function(_0x336579,_0x43e21a){_0x336579=_0x336579-0x0;var _0x41e244=_0x8289[_0x336579];return _0x41e244;};'use strict';var multer=require(_0x9828('0x0'));var util=require(_0x9828('0x1'));var path=require(_0x9828('0x2'));var timeout=require(_0x9828('0x3'));var express=require(_0x9828('0x4'));var router=express[_0x9828('0x5')]();var fs_extra=require(_0x9828('0x6'));var auth=require(_0x9828('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9828('0x8'));var controller=require(_0x9828('0x9'));router[_0x9828('0xa')]('/',auth[_0x9828('0xb')](),controller[_0x9828('0xc')]);router[_0x9828('0xa')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller[_0x9828('0xe')]);router[_0x9828('0xf')]('/',auth[_0x9828('0xb')](),controller[_0x9828('0x10')]);router[_0x9828('0x11')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller[_0x9828('0x12')]);router[_0x9828('0x13')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller['destroy']);module[_0x9828('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 26ea9c0..e78a014 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 _0xea53=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a63da,_0x4cc79b){var _0x376fc3=function(_0x203783){while(--_0x203783){_0x1a63da['push'](_0x1a63da['shift']());}};_0x376fc3(++_0x4cc79b);}(_0xea53,0x15a));var _0x3ea5=function(_0x5c7faf,_0x2aa47a){_0x5c7faf=_0x5c7faf-0x0;var _0x102c2a=_0xea53[_0x5c7faf];return _0x102c2a;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ea5('0x0'));module[_0x3ea5('0x1')]={'phone':{'type':Sequelize[_0x3ea5('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3ea5('0x3')],'defaultValue':moment()['format'](_0x3ea5('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3ea5('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3ea5('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3ea5('0x3')]},'priority':{'type':Sequelize[_0x3ea5('0x5')](0x2)[_0x3ea5('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3ea5('0x5')],'unique':_0x3ea5('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x3ea5('0x5')],'unique':_0x3ea5('0x8')},'CampaignId':{'type':Sequelize[_0x3ea5('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3ea5('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ea5('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3ea5('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3ea5('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x3ea5('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x2391=['sequelize','STRING','BOOLEAN','DATE','format','INTEGER','contactListQueue','moment'];(function(_0x323582,_0x3fd4b5){var _0xc12c85=function(_0x253653){while(--_0x253653){_0x323582['push'](_0x323582['shift']());}};_0xc12c85(++_0x3fd4b5);}(_0x2391,0xa7));var _0x1239=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2391[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0x1239('0x0'));var Sequelize=require(_0x1239('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1239('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1239('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1239('0x4')],'defaultValue':moment()[_0x1239('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1239('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1239('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1239('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1239('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1239('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x1239('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x1239('0x6')],'unique':_0x1239('0x7')},'CampaignId':{'type':Sequelize[_0x1239('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1239('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1239('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1239('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1239('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8342271..0c73e43 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 _0x23f4=['VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','findOne','recallme','LOCK','Contact','CmCompany','Queue','dialActive','getPreviewRecall','transaction','scheduledat','UPDATE','Company','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notILike','$overlap','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filter','where'];(function(_0x2e5965,_0x4609d){var _0x2d8537=function(_0x1da752){while(--_0x1da752){_0x2e5965['push'](_0x2e5965['shift']());}};_0x2d8537(++_0x4609d);}(_0x23f4,0x1ee));var _0x423f=function(_0x6ac718,_0x335ac0){_0x6ac718=_0x6ac718-0x0;var _0x3def08=_0x23f4[_0x6ac718];return _0x3def08;};'use strict';var moment=require('moment');var _=require(_0x423f('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x423f('0x1'));var shared=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];function respondWithResult(_0x3503a0,_0x1ab106){_0x1ab106=_0x1ab106||0xc8;return function(_0x129dba){if(_0x129dba){return _0x3503a0[_0x423f('0x4')](_0x1ab106)[_0x423f('0x5')](_0x129dba);}};}function respondWithFilteredResult(_0x34a2d9,_0x51066b){return function(_0x260eae){if(_0x260eae){var _0x47716d=typeof _0x51066b['offset']===_0x423f('0x6')&&typeof _0x51066b[_0x423f('0x7')]===_0x423f('0x6');var _0x50301a=_0x260eae['count'];var _0x4b8a90=_0x47716d?0x0:_0x51066b[_0x423f('0x8')];var _0x481c41=_0x47716d?_0x260eae[_0x423f('0x9')]:_0x51066b[_0x423f('0x8')]+_0x51066b[_0x423f('0x7')];var _0x162c83;if(_0x481c41>=_0x50301a){_0x481c41=_0x50301a;_0x162c83=0xc8;}else{_0x162c83=0xce;}_0x34a2d9['status'](_0x162c83);return _0x34a2d9[_0x423f('0xa')](_0x423f('0xb'),_0x4b8a90+'-'+_0x481c41+'/'+_0x50301a)[_0x423f('0x5')](_0x260eae);}return null;};}function saveUpdates(_0x3d4027,_0x216360){return function(_0x5275b0){if(_0x5275b0){return _0x5275b0[_0x423f('0xc')](_0x3d4027)[_0x423f('0xd')](function(_0x2ebc8c){return _0x2ebc8c;});}return null;};}function handleEntityNotFound(_0x1c894f,_0x44e1d5){return function(_0x3b531d){if(!_0x3b531d){_0x1c894f[_0x423f('0xe')](0x194);}return _0x3b531d;};}function handleError(_0x21d804,_0x252e6c){_0x252e6c=_0x252e6c||0x1f4;return function(_0x235c86){logger[_0x423f('0xf')](_0x235c86[_0x423f('0x10')]);if(_0x235c86[_0x423f('0x11')]){delete _0x235c86[_0x423f('0x11')];}_0x21d804[_0x423f('0x4')](_0x252e6c)[_0x423f('0x12')](_0x235c86);};}exports[_0x423f('0x13')]=function(_0x34e968,_0x26b6d1){var _0x5424e6={},_0x99435f={},_0x569fd0={'count':0x0,'rows':[]};var _0x504d8b=_[_0x423f('0x14')](db['CmHopper'][_0x423f('0x15')],function(_0xd7b80e){return{'name':_0xd7b80e['fieldName'],'type':_0xd7b80e[_0x423f('0x16')][_0x423f('0x17')]};});_0x99435f['model']=_[_0x423f('0x14')](_0x504d8b,_0x423f('0x11'));_0x99435f['query']=_[_0x423f('0x18')](_0x34e968[_0x423f('0x19')]);_0x99435f['filters']=_[_0x423f('0x1a')](_0x99435f['model'],_0x99435f[_0x423f('0x19')]);_0x99435f[_0x423f('0x1b')]=_[_0x423f('0x1c')](_0x99435f[_0x423f('0x1b')],[_0x423f('0x1d'),_0x423f('0x1e'),_0x423f('0x1f'),_0x423f('0x20'),_0x423f('0x21'),_0x423f('0x22'),_0x423f('0x23'),_0x423f('0x24'),_0x423f('0x25'),_0x423f('0x26'),'$notBetween',_0x423f('0x27'),_0x423f('0x28'),_0x423f('0x29'),'$notLike','$iLike',_0x423f('0x2a'),_0x423f('0x29'),_0x423f('0x2b'),'$contains','$contained',_0x423f('0x2c')]);_0x5424e6[_0x423f('0x2d')]=_['intersection'](_0x99435f[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x34e968[_0x423f('0x19')][_0x423f('0x2f')]));_0x5424e6['attributes']=_0x5424e6[_0x423f('0x2d')][_0x423f('0x30')]?_0x5424e6[_0x423f('0x2d')]:_0x99435f[_0x423f('0x2e')];if(!_0x34e968['query'][_0x423f('0x31')](_0x423f('0x32'))){_0x5424e6[_0x423f('0x7')]=qs[_0x423f('0x7')](_0x34e968[_0x423f('0x19')][_0x423f('0x7')]);_0x5424e6[_0x423f('0x8')]=qs[_0x423f('0x8')](_0x34e968[_0x423f('0x19')][_0x423f('0x8')]);}_0x5424e6['order']=qs[_0x423f('0x33')](_0x34e968[_0x423f('0x19')][_0x423f('0x33')]);_0x5424e6['where']=qs[_0x423f('0x1b')](_['pick'](_0x34e968[_0x423f('0x19')],_0x99435f[_0x423f('0x1b')]),_0x504d8b);if(_0x34e968[_0x423f('0x19')][_0x423f('0x34')]){_0x5424e6[_0x423f('0x35')]=_['merge'](_0x5424e6['where'],{'$or':_[_0x423f('0x14')](_0x504d8b,function(_0x5a2225){if(_0x5a2225[_0x423f('0x16')]!==_0x423f('0x36')){var _0x3e4c9f={};_0x3e4c9f[_0x5a2225[_0x423f('0x11')]]={'$like':'%'+_0x34e968[_0x423f('0x19')][_0x423f('0x34')]+'%'};return _0x3e4c9f;}})});}_0x5424e6=_[_0x423f('0x37')]({},_0x5424e6,_0x34e968[_0x423f('0x38')]);var _0x3aeb17={'where':_0x5424e6[_0x423f('0x35')]};return db[_0x423f('0x39')]['count'](_0x3aeb17)['then'](function(_0x382f91){_0x569fd0[_0x423f('0x9')]=_0x382f91;if(_0x34e968[_0x423f('0x19')][_0x423f('0x3a')]){_0x5424e6[_0x423f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x423f('0x3c')](_0x5424e6);})[_0x423f('0xd')](function(_0x2e6d28){_0x569fd0[_0x423f('0x3d')]=_0x2e6d28;return _0x569fd0;})[_0x423f('0xd')](respondWithFilteredResult(_0x26b6d1,_0x5424e6))[_0x423f('0x3e')](handleError(_0x26b6d1,null));};exports[_0x423f('0x3f')]=function(_0x1d280f,_0x3464e3){var _0x40571a={'raw':!![],'where':{'id':_0x1d280f['params']['id']}},_0x4fb566={};_0x4fb566[_0x423f('0x2e')]=_[_0x423f('0x18')](db[_0x423f('0x39')][_0x423f('0x15')]);_0x4fb566[_0x423f('0x19')]=_[_0x423f('0x18')](_0x1d280f['query']);_0x4fb566[_0x423f('0x1b')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],_0x4fb566[_0x423f('0x19')]);_0x40571a[_0x423f('0x2d')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x1d280f['query'][_0x423f('0x2f')]));_0x40571a[_0x423f('0x2d')]=_0x40571a[_0x423f('0x2d')][_0x423f('0x30')]?_0x40571a[_0x423f('0x2d')]:_0x4fb566[_0x423f('0x2e')];if(_0x1d280f[_0x423f('0x19')][_0x423f('0x3a')]){_0x40571a[_0x423f('0x3b')]=[{'all':!![]}];}_0x40571a=_['merge']({},_0x40571a,_0x1d280f[_0x423f('0x38')]);return db['CmHopper'][_0x423f('0x40')](_0x40571a)[_0x423f('0xd')](handleEntityNotFound(_0x3464e3,null))[_0x423f('0xd')](respondWithResult(_0x3464e3,null))[_0x423f('0x3e')](handleError(_0x3464e3,null));};exports[_0x423f('0x41')]=function(_0x3ad48c,_0x3087e4){return db[_0x423f('0x39')][_0x423f('0x41')](_0x3ad48c[_0x423f('0x42')],{})[_0x423f('0xd')](respondWithResult(_0x3087e4,0xc9))[_0x423f('0x3e')](handleError(_0x3087e4,null));};exports[_0x423f('0xc')]=function(_0x350e11,_0xa7708c){if(_0x350e11[_0x423f('0x42')]['id']){delete _0x350e11[_0x423f('0x42')]['id'];}return db[_0x423f('0x39')][_0x423f('0x40')]({'where':{'id':_0x350e11[_0x423f('0x43')]['id']}})['then'](handleEntityNotFound(_0xa7708c,null))[_0x423f('0xd')](saveUpdates(_0x350e11['body'],null))[_0x423f('0xd')](respondWithResult(_0xa7708c,null))[_0x423f('0x3e')](handleError(_0xa7708c,null));};exports[_0x423f('0x44')]=function(_0x37035a,_0x57f5d6){return db[_0x423f('0x39')][_0x423f('0x44')]()[_0x423f('0xd')](respondWithResult(_0x57f5d6,null))[_0x423f('0x3e')](handleError(_0x57f5d6,null));};exports[_0x423f('0x45')]=function(_0x31b88e,_0x2dcbec){var _0x489894;var _0x1e2b9f=_0x31b88e[_0x423f('0x43')]['id'];return db['CmHopper'][_0x423f('0x40')]({'where':{'id':_0x31b88e['params']['id']}})[_0x423f('0xd')](handleEntityNotFound(_0x2dcbec,null))['then'](function(_0x56e907){if(_0x56e907){return _0x56e907[_0x423f('0x45')]()[_0x423f('0xd')](function(_0x1668d4){return _0x1668d4;});}})[_0x423f('0xd')](function(_0x545476){_0x489894=_0x545476;if(_0x545476){if(_0x545476[_0x423f('0x46')]||_0x545476['CampaignId']){return db[_0x545476[_0x423f('0x46')]?_0x423f('0x47'):_0x423f('0x48')][_0x423f('0x40')]({'where':{'id':_0x545476[_0x423f('0x46')]?_0x545476[_0x423f('0x46')]:_0x545476[_0x423f('0x49')]},'attributes':['id',_0x423f('0x11')],'raw':!![]});}}})[_0x423f('0xd')](function(_0x4e3003){var _0x104fd9={};if(_0x4e3003){_[_0x423f('0x37')](_0x104fd9,_['omit'](_0x489894[_0x423f('0x4a')],['createdAt',_0x423f('0x4b'),'id']));_0x104fd9[_0x423f('0x4c')]=0x15;_0x104fd9[_0x423f('0x4d')]=_0x423f('0x4e');_0x104fd9[_0x423f('0x4f')]=_0x4e3003[_0x423f('0x11')];_0x104fd9['membername']=_0x31b88e['user'][_0x423f('0x11')];_0x104fd9[_0x423f('0x50')]=_0x31b88e[_0x423f('0x51')]['id'];_0x104fd9[_0x423f('0x4e')]=!![];_0x104fd9[_0x423f('0x52')]=moment()[_0x423f('0x53')](_0x423f('0x54'));_0x104fd9[_0x423f('0x55')]=_0x489894[_0x423f('0x56')];_0x104fd9['campaigntype']=_0x489894[_0x423f('0x46')]?_0x423f('0x57'):'ivr';return db[_0x423f('0x58')]['find']({'where':{'id':_0x104fd9[_0x423f('0x59')]},'attributes':[_0x423f('0x5a'),_0x423f('0x5b')]})['then'](function(_0x5c39e4){if(!_[_0x423f('0x5c')](_0x2dcbec)&&!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5a')])){_0x104fd9['calleridname']=_0x5c39e4[_0x423f('0x5a')];if(!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5b')])){_0x104fd9[_0x423f('0x5d')]+='\x20'+_0x5c39e4[_0x423f('0x5b')];}}})[_0x423f('0x5e')](function(){return db[_0x423f('0x5f')]['create'](_0x104fd9);});}})[_0x423f('0xd')](function(_0x588483){return db[_0x423f('0x60')][_0x423f('0x45')]({'where':{'CmHopperId':_0x1e2b9f}});})[_0x423f('0xd')](function(){return _0x2dcbec[_0x423f('0x4')](0xcc)['end']();})[_0x423f('0x3e')](handleError(_0x2dcbec,null));};exports[_0x423f('0x61')]=function(_0x4c33c7,_0x5ae8a9){var _0xfe89a9=[];return db[_0x423f('0x58')]['describe']()[_0x423f('0xd')](function(_0x1897ff){_0xfe89a9=_['keys'](_0x1897ff);return _0x4c33c7['user']['getVoiceQueues']({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':_0x423f('0x63')},'attributes':['id',_0x423f('0x64'),_0x423f('0x65')],'raw':!![]});})['then'](function(_0x4fa0ef){if(_0x4fa0ef&&_0x4fa0ef[_0x423f('0x30')]){return db[_0x423f('0x66')]['transaction'](function(_0x43b569){var _0x13ed0b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_[_0x423f('0x14')](_0x4fa0ef,'id')},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x116605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4fa0ef)['filter']([_0x423f('0x65'),0x0])[_0x423f('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x223e8c={'$or':[_0x13ed0b,_0x116605]};var _0x3e5d47=[];if(_0x4c33c7['body'][_0x423f('0x67')]&&_0x4c33c7[_0x423f('0x42')][_0x423f('0x67')]===_0x423f('0x68')){if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')])){_0x223e8c['id']={'$in':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[['priority',_0x423f('0x6b')],[_0x423f('0x6c'),_0x4fa0ef[0x0][_0x423f('0x64')]===_0x423f('0x6b')?'DESC':_0x423f('0x6b')],db[_0x423f('0x66')][_0x423f('0x6d')](_0x423f('0x6e')),['id',_0x423f('0x6f')]];}else{if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')]['hopperIds'])){_0x223e8c['id']={'$notIn':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[[_0x423f('0x70'),_0x423f('0x6f')],['scheduledAt',_0x4fa0ef[0x0][_0x423f('0x64')]],db[_0x423f('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x423f('0x6b')]];}return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id','scheduledat',_0x423f('0x56'),_0x423f('0x72')],'where':_0x223e8c,'order':_0x3e5d47,'transaction':_0x43b569,'lock':_0x43b569[_0x423f('0x73')]['UPDATE'],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0xfe89a9,'include':[{'model':db[_0x423f('0x75')],'as':'Company','attributes':['id',_0x423f('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':_0x423f('0x76'),'attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})['then'](function(_0x29e60c){if(_0x29e60c){return _0x29e60c[_0x423f('0xc')]({'UserId':_0x4c33c7[_0x423f('0x51')]['id']},{'transaction':_0x43b569});}});});}})[_0x423f('0xd')](handleEntityNotFound(_0x5ae8a9,null))[_0x423f('0xd')](respondWithResult(_0x5ae8a9,null))[_0x423f('0x3e')](handleError(_0x5ae8a9,null));};exports[_0x423f('0x78')]=function(_0x5b9577,_0x4e1e04,_0xd9409e){var _0x320528=[];var _0xe76487=_0x5b9577[_0x423f('0x43')]['id'];var _0x3cffc3=_0x5b9577['user']['id'];return db[_0x423f('0x58')][_0x423f('0x44')]()[_0x423f('0xd')](function(_0x358ab3){_0x320528=_[_0x423f('0x18')](_0x358ab3);return db[_0x423f('0x66')][_0x423f('0x79')](function(_0x1db383){const _0x20bd00={'id':_0xe76487};return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id',_0x423f('0x7a'),_0x423f('0x72')],'where':_0x20bd00,'transaction':_0x1db383,'lock':_0x1db383['LOCK'][_0x423f('0x7b')],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0x320528,'include':[{'model':db[_0x423f('0x75')],'as':_0x423f('0x7c'),'attributes':['id','name']}]},{'model':db[_0x423f('0x7d')],'as':_0x423f('0x7e'),'attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':'Queue','attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})[_0x423f('0xd')](function(_0x3832b6){if(_0x3832b6){return _0x3832b6[_0x423f('0xc')]({'UserId':_0x3cffc3},{'transaction':_0x1db383});}});});})[_0x423f('0xd')](handleEntityNotFound(_0x4e1e04,null))[_0x423f('0xd')](respondWithResult(_0x4e1e04,null))[_0x423f('0x3e')](handleError(_0x4e1e04,null));};exports[_0x423f('0x7f')]=function(_0x22f2af,_0x3c78c7){return _0x22f2af[_0x423f('0x51')][_0x423f('0x80')]({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x423f('0xd')](function(_0x5333b7){if(_0x5333b7&&_0x5333b7['length']){return db[_0x423f('0x39')][_0x423f('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_['map'](_0x5333b7,'id')},'$or':[{'UserId':null},{'UserId':_0x22f2af[_0x423f('0x51')]['id']}]}});}return 0x0;})['then'](function(_0xf18525){if(!_[_0x423f('0x5c')](_0xf18525)&&_[_0x423f('0x81')](_0xf18525)){return _0x3c78c7[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'contacts':_0xf18525});}else{logger['error'](_0x423f('0x82'),'getOpenContacts',0x194,_0x423f('0x83'));_0x3c78c7['sendStatus'](0x194);}})[_0x423f('0x3e')](handleError(_0x3c78c7,null));};exports[_0x423f('0x84')]=function(_0x1990ec,_0x5697e8){var _0xbcf529=shared[_0x423f('0x85')];var _0x3ecfd5=[];_[_0x423f('0x14')](_0xbcf529,function(_0x5baf51){_0x3ecfd5[_0x423f('0x86')]({'id':_0x5baf51[_0x423f('0x11')],'name':_0x5baf51['name'],'utcOffset':_0x5baf51[_0x423f('0x87')]});});return _0x5697e8[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'tz':_0x3ecfd5});};exports[_0x423f('0x88')]=function(_0x36241e,_0x2bb2ba){var _0x140db1=shared[_0x423f('0x85')];var _0x2ede33={};if(!_[_0x423f('0x5c')](_0x140db1[_0x36241e['body']['id']]))_0x2ede33=_0x140db1[_0x36241e['body']['id']];return _0x2bb2ba[_0x423f('0x4')](0xc8)['json'](_0x2ede33);}; \ No newline at end of file +var _0xf8b2=['VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','state','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','filter','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Company','dialActive','getPreviewRecall','scheduledat','recallme','Contact','CmCompany','List','Queue','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','update','body','describe','destroy'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x178ca4,_0x5aaa16){_0x178ca4=_0x178ca4-0x0;var _0x57f6a8=_0xf8b2[_0x178ca4];return _0x57f6a8;};'use strict';var moment=require(_0x2f8b('0x0'));var _=require(_0x2f8b('0x1'));var qs=require(_0x2f8b('0x2'));var logger=require(_0x2f8b('0x3'))(_0x2f8b('0x4'));var shared=require(_0x2f8b('0x5'));var db=require(_0x2f8b('0x6'))['db'];function respondWithResult(_0x2952c2,_0x50dae3){_0x50dae3=_0x50dae3||0xc8;return function(_0x4b33e9){if(_0x4b33e9){return _0x2952c2[_0x2f8b('0x7')](_0x50dae3)[_0x2f8b('0x8')](_0x4b33e9);}};}function respondWithFilteredResult(_0x3c6838,_0x1d133a){return function(_0x3b0511){if(_0x3b0511){var _0x2cc1e9=typeof _0x1d133a[_0x2f8b('0x9')]===_0x2f8b('0xa')&&typeof _0x1d133a[_0x2f8b('0xb')]==='undefined';var _0xdb9718=_0x3b0511[_0x2f8b('0xc')];var _0x120486=_0x2cc1e9?0x0:_0x1d133a['offset'];var _0x225804=_0x2cc1e9?_0x3b0511[_0x2f8b('0xc')]:_0x1d133a[_0x2f8b('0x9')]+_0x1d133a['limit'];var _0x53cec0;if(_0x225804>=_0xdb9718){_0x225804=_0xdb9718;_0x53cec0=0xc8;}else{_0x53cec0=0xce;}_0x3c6838[_0x2f8b('0x7')](_0x53cec0);return _0x3c6838[_0x2f8b('0xd')](_0x2f8b('0xe'),_0x120486+'-'+_0x225804+'/'+_0xdb9718)[_0x2f8b('0x8')](_0x3b0511);}return null;};}function saveUpdates(_0x175111,_0x4cb1e0){return function(_0x16d5a2){if(_0x16d5a2){return _0x16d5a2['update'](_0x175111)[_0x2f8b('0xf')](function(_0x5e9eb1){return _0x5e9eb1;});}return null;};}function handleEntityNotFound(_0x1b6a17,_0x15634){return function(_0xf9cbe0){if(!_0xf9cbe0){_0x1b6a17[_0x2f8b('0x10')](0x194);}return _0xf9cbe0;};}function handleError(_0xd7dbcd,_0x2b6003){_0x2b6003=_0x2b6003||0x1f4;return function(_0x532fe4){logger[_0x2f8b('0x11')](_0x532fe4[_0x2f8b('0x12')]);if(_0x532fe4[_0x2f8b('0x13')]){delete _0x532fe4[_0x2f8b('0x13')];}_0xd7dbcd[_0x2f8b('0x7')](_0x2b6003)[_0x2f8b('0x14')](_0x532fe4);};}exports[_0x2f8b('0x15')]=function(_0x1fe74a,_0x35ec40){var _0x4aaef4={},_0x23dd63={},_0x2a0a49={'count':0x0,'rows':[]};var _0x35f0ca=_['map'](db[_0x2f8b('0x16')]['rawAttributes'],function(_0x1c455f){return{'name':_0x1c455f[_0x2f8b('0x17')],'type':_0x1c455f[_0x2f8b('0x18')][_0x2f8b('0x19')]};});_0x23dd63[_0x2f8b('0x1a')]=_['map'](_0x35f0ca,_0x2f8b('0x13'));_0x23dd63[_0x2f8b('0x1b')]=_[_0x2f8b('0x1c')](_0x1fe74a[_0x2f8b('0x1b')]);_0x23dd63[_0x2f8b('0x1d')]=_[_0x2f8b('0x1e')](_0x23dd63[_0x2f8b('0x1a')],_0x23dd63['query']);_0x23dd63[_0x2f8b('0x1d')]=_[_0x2f8b('0x1f')](_0x23dd63[_0x2f8b('0x1d')],[_0x2f8b('0x20'),_0x2f8b('0x21'),'$gt',_0x2f8b('0x22'),_0x2f8b('0x23'),_0x2f8b('0x24'),_0x2f8b('0x25'),_0x2f8b('0x26'),_0x2f8b('0x27'),_0x2f8b('0x28'),_0x2f8b('0x29'),_0x2f8b('0x2a'),'$notIn',_0x2f8b('0x2b'),'$notLike',_0x2f8b('0x2c'),_0x2f8b('0x2d'),_0x2f8b('0x2b'),_0x2f8b('0x2e'),_0x2f8b('0x2f'),'$contained',_0x2f8b('0x30')]);_0x4aaef4['attributes']=_['intersection'](_0x23dd63[_0x2f8b('0x1a')],qs[_0x2f8b('0x31')](_0x1fe74a['query'][_0x2f8b('0x31')]));_0x4aaef4[_0x2f8b('0x32')]=_0x4aaef4[_0x2f8b('0x32')][_0x2f8b('0x33')]?_0x4aaef4[_0x2f8b('0x32')]:_0x23dd63[_0x2f8b('0x1a')];if(!_0x1fe74a['query'][_0x2f8b('0x34')](_0x2f8b('0x35'))){_0x4aaef4[_0x2f8b('0xb')]=qs[_0x2f8b('0xb')](_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0xb')]);_0x4aaef4[_0x2f8b('0x9')]=qs['offset'](_0x1fe74a[_0x2f8b('0x1b')]['offset']);}_0x4aaef4[_0x2f8b('0x36')]=qs[_0x2f8b('0x37')](_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0x37')]);_0x4aaef4[_0x2f8b('0x38')]=qs[_0x2f8b('0x1d')](_[_0x2f8b('0x39')](_0x1fe74a[_0x2f8b('0x1b')],_0x23dd63[_0x2f8b('0x1d')]),_0x35f0ca);if(_0x1fe74a['query']['filter']){_0x4aaef4[_0x2f8b('0x38')]=_[_0x2f8b('0x3a')](_0x4aaef4[_0x2f8b('0x38')],{'$or':_[_0x2f8b('0x3b')](_0x35f0ca,function(_0x5c52ad){if(_0x5c52ad[_0x2f8b('0x18')]!==_0x2f8b('0x3c')){var _0x37676c={};_0x37676c[_0x5c52ad[_0x2f8b('0x13')]]={'$like':'%'+_0x1fe74a[_0x2f8b('0x1b')]['filter']+'%'};return _0x37676c;}})});}_0x4aaef4=_['merge']({},_0x4aaef4,_0x1fe74a[_0x2f8b('0x3d')]);var _0x25c805={'where':_0x4aaef4[_0x2f8b('0x38')]};return db[_0x2f8b('0x16')][_0x2f8b('0xc')](_0x25c805)[_0x2f8b('0xf')](function(_0x2c554d){_0x2a0a49['count']=_0x2c554d;if(_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0x3e')]){_0x4aaef4['include']=[{'all':!![]}];}return db[_0x2f8b('0x16')][_0x2f8b('0x3f')](_0x4aaef4);})[_0x2f8b('0xf')](function(_0x4fc170){_0x2a0a49[_0x2f8b('0x40')]=_0x4fc170;return _0x2a0a49;})[_0x2f8b('0xf')](respondWithFilteredResult(_0x35ec40,_0x4aaef4))['catch'](handleError(_0x35ec40,null));};exports[_0x2f8b('0x41')]=function(_0x46a49b,_0x5e8a3e){var _0x92b37a={'raw':!![],'where':{'id':_0x46a49b[_0x2f8b('0x42')]['id']}},_0x57576e={};_0x57576e[_0x2f8b('0x1a')]=_['keys'](db[_0x2f8b('0x16')][_0x2f8b('0x43')]);_0x57576e[_0x2f8b('0x1b')]=_['keys'](_0x46a49b[_0x2f8b('0x1b')]);_0x57576e['filters']=_[_0x2f8b('0x1e')](_0x57576e[_0x2f8b('0x1a')],_0x57576e[_0x2f8b('0x1b')]);_0x92b37a[_0x2f8b('0x32')]=_[_0x2f8b('0x1e')](_0x57576e[_0x2f8b('0x1a')],qs[_0x2f8b('0x31')](_0x46a49b[_0x2f8b('0x1b')][_0x2f8b('0x31')]));_0x92b37a[_0x2f8b('0x32')]=_0x92b37a[_0x2f8b('0x32')][_0x2f8b('0x33')]?_0x92b37a[_0x2f8b('0x32')]:_0x57576e[_0x2f8b('0x1a')];if(_0x46a49b[_0x2f8b('0x1b')][_0x2f8b('0x3e')]){_0x92b37a[_0x2f8b('0x44')]=[{'all':!![]}];}_0x92b37a=_[_0x2f8b('0x3a')]({},_0x92b37a,_0x46a49b[_0x2f8b('0x3d')]);return db[_0x2f8b('0x16')][_0x2f8b('0x45')](_0x92b37a)[_0x2f8b('0xf')](handleEntityNotFound(_0x5e8a3e,null))[_0x2f8b('0xf')](respondWithResult(_0x5e8a3e,null))[_0x2f8b('0x46')](handleError(_0x5e8a3e,null));};exports[_0x2f8b('0x47')]=function(_0x564b81,_0x4a8a89){return db['CmHopper'][_0x2f8b('0x47')](_0x564b81['body'],{})[_0x2f8b('0xf')](respondWithResult(_0x4a8a89,0xc9))[_0x2f8b('0x46')](handleError(_0x4a8a89,null));};exports[_0x2f8b('0x48')]=function(_0x5f0a8d,_0x98b96){if(_0x5f0a8d['body']['id']){delete _0x5f0a8d[_0x2f8b('0x49')]['id'];}return db['CmHopper'][_0x2f8b('0x45')]({'where':{'id':_0x5f0a8d[_0x2f8b('0x42')]['id']}})['then'](handleEntityNotFound(_0x98b96,null))[_0x2f8b('0xf')](saveUpdates(_0x5f0a8d[_0x2f8b('0x49')],null))[_0x2f8b('0xf')](respondWithResult(_0x98b96,null))[_0x2f8b('0x46')](handleError(_0x98b96,null));};exports[_0x2f8b('0x4a')]=function(_0x465d59,_0xd9b1d1){return db[_0x2f8b('0x16')][_0x2f8b('0x4a')]()['then'](respondWithResult(_0xd9b1d1,null))[_0x2f8b('0x46')](handleError(_0xd9b1d1,null));};exports[_0x2f8b('0x4b')]=function(_0x2d79f9,_0x1bb257){var _0x14e50e;var _0x487c81=_0x2d79f9[_0x2f8b('0x42')]['id'];return db[_0x2f8b('0x16')][_0x2f8b('0x45')]({'where':{'id':_0x2d79f9['params']['id']}})[_0x2f8b('0xf')](handleEntityNotFound(_0x1bb257,null))['then'](function(_0x26dfb1){if(_0x26dfb1){return _0x26dfb1[_0x2f8b('0x4b')]()[_0x2f8b('0xf')](function(_0x3a25bb){return _0x3a25bb;});}})[_0x2f8b('0xf')](function(_0x5b181f){_0x14e50e=_0x5b181f;if(_0x5b181f){if(_0x5b181f['VoiceQueueId']||_0x5b181f['CampaignId']){return db[_0x5b181f[_0x2f8b('0x4c')]?_0x2f8b('0x4d'):_0x2f8b('0x4e')][_0x2f8b('0x45')]({'where':{'id':_0x5b181f['VoiceQueueId']?_0x5b181f['VoiceQueueId']:_0x5b181f[_0x2f8b('0x4f')]},'attributes':['id',_0x2f8b('0x13')],'raw':!![]});}}})[_0x2f8b('0xf')](function(_0x448382){var _0x4ae427={};if(_0x448382){_[_0x2f8b('0x3a')](_0x4ae427,_[_0x2f8b('0x50')](_0x14e50e['dataValues'],[_0x2f8b('0x51'),'updatedAt','id']));_0x4ae427[_0x2f8b('0x52')]=0x15;_0x4ae427['statedesc']=_0x2f8b('0x53');_0x4ae427[_0x2f8b('0x54')]=_0x448382[_0x2f8b('0x13')];_0x4ae427['membername']=_0x2d79f9[_0x2f8b('0x55')]['name'];_0x4ae427[_0x2f8b('0x56')]=_0x2d79f9['user']['id'];_0x4ae427[_0x2f8b('0x53')]=!![];_0x4ae427[_0x2f8b('0x57')]=moment()[_0x2f8b('0x58')](_0x2f8b('0x59'));_0x4ae427[_0x2f8b('0x5a')]=_0x14e50e[_0x2f8b('0x5b')];_0x4ae427[_0x2f8b('0x5c')]=_0x14e50e[_0x2f8b('0x4c')]?'queue':_0x2f8b('0x5d');return db[_0x2f8b('0x5e')][_0x2f8b('0x45')]({'where':{'id':_0x4ae427[_0x2f8b('0x5f')]},'attributes':[_0x2f8b('0x60'),_0x2f8b('0x61')]})[_0x2f8b('0xf')](function(_0x2de537){if(!_[_0x2f8b('0x62')](_0x1bb257)&&!_[_0x2f8b('0x62')](_0x2de537[_0x2f8b('0x60')])){_0x4ae427[_0x2f8b('0x63')]=_0x2de537['firstName'];if(!_[_0x2f8b('0x62')](_0x2de537['lastName'])){_0x4ae427[_0x2f8b('0x63')]+='\x20'+_0x2de537[_0x2f8b('0x61')];}}})[_0x2f8b('0x64')](function(){return db[_0x2f8b('0x65')][_0x2f8b('0x47')](_0x4ae427);});}})['then'](function(_0x2b0627){return db[_0x2f8b('0x66')][_0x2f8b('0x4b')]({'where':{'CmHopperId':_0x487c81}});})[_0x2f8b('0xf')](function(){return _0x1bb257['status'](0xcc)['end']();})[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x67')]=function(_0x334153,_0x34870f){var _0x5441ea=[];return db[_0x2f8b('0x5e')][_0x2f8b('0x4a')]()['then'](function(_0x4c502d){_0x5441ea=_['keys'](_0x4c502d);return _0x334153[_0x2f8b('0x55')]['getVoiceQueues']({'where':{'type':_0x2f8b('0x68'),'dialActive':!![],'dialMethod':_0x2f8b('0x69')},'attributes':['id',_0x2f8b('0x6a'),_0x2f8b('0x6b')],'raw':!![]});})[_0x2f8b('0xf')](function(_0x1c1563){if(_0x1c1563&&_0x1c1563[_0x2f8b('0x33')]){return db[_0x2f8b('0x6c')]['transaction'](function(_0x49a2ca){var _0x14ff2a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2f8b('0x58')](_0x2f8b('0x59'))},'VoiceQueueId':{'$in':_[_0x2f8b('0x3b')](_0x1c1563,'id')},'$or':[{'UserId':null},{'UserId':_0x334153[_0x2f8b('0x55')]['id']}]};var _0x23ac08={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1c1563)[_0x2f8b('0x6d')]([_0x2f8b('0x6b'),0x0])[_0x2f8b('0x3b')]('id')[_0x2f8b('0x6e')]()},'$or':[{'UserId':null},{'UserId':_0x334153['user']['id']}]};var _0x3dbd17={'$or':[_0x14ff2a,_0x23ac08]};var _0x1e3434=[];if(_0x334153[_0x2f8b('0x49')][_0x2f8b('0x6f')]&&_0x334153[_0x2f8b('0x49')]['direction']===_0x2f8b('0x70')){if(!_[_0x2f8b('0x71')](_0x334153['body'][_0x2f8b('0x72')])){_0x3dbd17['id']={'$in':_0x334153['body']['hopperIds']};}_0x1e3434=[[_0x2f8b('0x73'),_0x2f8b('0x74')],[_0x2f8b('0x75'),_0x1c1563[0x0]['dialOrderByScheduledAt']===_0x2f8b('0x74')?'DESC':_0x2f8b('0x74')],db[_0x2f8b('0x6c')][_0x2f8b('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x2f8b('0x77')]];}else{if(!_['isEmpty'](_0x334153[_0x2f8b('0x49')][_0x2f8b('0x72')])){_0x3dbd17['id']={'$notIn':_0x334153['body'][_0x2f8b('0x72')]};}_0x1e3434=[[_0x2f8b('0x73'),_0x2f8b('0x77')],['scheduledAt',_0x1c1563[0x0][_0x2f8b('0x6a')]],db[_0x2f8b('0x6c')][_0x2f8b('0x76')](_0x2f8b('0x78')),['id','ASC']];}return db[_0x2f8b('0x16')][_0x2f8b('0x79')]({'attributes':['id','scheduledat',_0x2f8b('0x5b'),'recallme'],'where':_0x3dbd17,'order':_0x1e3434,'transaction':_0x49a2ca,'lock':_0x49a2ca[_0x2f8b('0x7a')][_0x2f8b('0x7b')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5441ea,'include':[{'model':db['CmCompany'],'as':_0x2f8b('0x7c'),'attributes':['id',_0x2f8b('0x13')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x2f8b('0x7d')]}]})[_0x2f8b('0xf')](function(_0x7348e8){if(_0x7348e8){return _0x7348e8[_0x2f8b('0x48')]({'UserId':_0x334153[_0x2f8b('0x55')]['id']},{'transaction':_0x49a2ca});}});});}})['then'](handleEntityNotFound(_0x34870f,null))['then'](respondWithResult(_0x34870f,null))[_0x2f8b('0x46')](handleError(_0x34870f,null));};exports[_0x2f8b('0x7e')]=function(_0x34a7b6,_0x585196,_0x5ae32e){var _0x55254b=[];var _0x4358e0=_0x34a7b6[_0x2f8b('0x42')]['id'];var _0x34b0d2=_0x34a7b6['user']['id'];return db[_0x2f8b('0x5e')][_0x2f8b('0x4a')]()[_0x2f8b('0xf')](function(_0x3afad1){_0x55254b=_[_0x2f8b('0x1c')](_0x3afad1);return db[_0x2f8b('0x6c')]['transaction'](function(_0x38b1fe){const _0x31d6cc={'id':_0x4358e0};return db['CmHopper'][_0x2f8b('0x79')]({'attributes':['id',_0x2f8b('0x7f'),_0x2f8b('0x80')],'where':_0x31d6cc,'transaction':_0x38b1fe,'lock':_0x38b1fe[_0x2f8b('0x7a')][_0x2f8b('0x7b')],'include':[{'model':db[_0x2f8b('0x5e')],'as':_0x2f8b('0x81'),'attributes':_0x55254b,'include':[{'model':db[_0x2f8b('0x82')],'as':'Company','attributes':['id',_0x2f8b('0x13')]}]},{'model':db['CmList'],'as':_0x2f8b('0x83'),'attributes':['id',_0x2f8b('0x13')]},{'model':db['VoiceQueue'],'as':_0x2f8b('0x84'),'attributes':['id','name',_0x2f8b('0x7d')]}]})[_0x2f8b('0xf')](function(_0x1ebbc8){if(_0x1ebbc8){return _0x1ebbc8[_0x2f8b('0x48')]({'UserId':_0x34b0d2},{'transaction':_0x38b1fe});}});});})['then'](handleEntityNotFound(_0x585196,null))[_0x2f8b('0xf')](respondWithResult(_0x585196,null))['catch'](handleError(_0x585196,null));};exports['getOpenContacts']=function(_0x7ded8e,_0x3bf354){return _0x7ded8e[_0x2f8b('0x55')][_0x2f8b('0x85')]({'where':{'type':_0x2f8b('0x68'),'dialActive':!![],'dialMethod':_0x2f8b('0x69')},'attributes':['id'],'raw':!![]})[_0x2f8b('0xf')](function(_0x1be1f5){if(_0x1be1f5&&_0x1be1f5['length']){return db[_0x2f8b('0x16')][_0x2f8b('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2f8b('0x58')](_0x2f8b('0x59'))},'VoiceQueueId':{'$in':_[_0x2f8b('0x3b')](_0x1be1f5,'id')},'$or':[{'UserId':null},{'UserId':_0x7ded8e[_0x2f8b('0x55')]['id']}]}});}return 0x0;})[_0x2f8b('0xf')](function(_0x4d0a73){if(!_[_0x2f8b('0x62')](_0x4d0a73)&&_['isNumber'](_0x4d0a73)){return _0x3bf354[_0x2f8b('0x7')](0xc8)[_0x2f8b('0x8')]({'contacts':_0x4d0a73});}else{logger['error'](_0x2f8b('0x86'),_0x2f8b('0x87'),0x194,_0x2f8b('0x88'));_0x3bf354[_0x2f8b('0x10')](0x194);}})[_0x2f8b('0x46')](handleError(_0x3bf354,null));};exports[_0x2f8b('0x89')]=function(_0x53fbfe,_0x1ba4d2){var _0x55dcc1=shared[_0x2f8b('0x8a')];var _0x5da15b=[];_['map'](_0x55dcc1,function(_0x260d55){_0x5da15b[_0x2f8b('0x8b')]({'id':_0x260d55[_0x2f8b('0x13')],'name':_0x260d55[_0x2f8b('0x13')],'utcOffset':_0x260d55[_0x2f8b('0x8c')]});});return _0x1ba4d2[_0x2f8b('0x7')](0xc8)[_0x2f8b('0x8')]({'tz':_0x5da15b});};exports[_0x2f8b('0x8d')]=function(_0x2cf869,_0x2deff8){var _0x405dd9=shared[_0x2f8b('0x8a')];var _0x3ddea8={};if(!_[_0x2f8b('0x62')](_0x405dd9[_0x2cf869[_0x2f8b('0x49')]['id']]))_0x3ddea8=_0x405dd9[_0x2cf869['body']['id']];return _0x2deff8[_0x2f8b('0x7')](0xc8)['json'](_0x3ddea8);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cc183e8..1a73421 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x53ec,0x192));var _0xc53e=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0x53ec[_0x18c8b5];return _0x358984;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x26456b,_0x3eec5f){var _0x47384c=function(_0x181298){while(--_0x181298){_0x26456b['push'](_0x26456b['shift']());}};_0x47384c(++_0x3eec5f);}(_0x7c09,0x102));var _0x97c0=function(_0x3d4eff,_0x5918b9){_0x3d4eff=_0x3d4eff-0x0;var _0x4a9369=_0x7c09[_0x3d4eff];return _0x4a9369;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 12b2de9..5fb65bd 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 _0xa72a=['order','LOCK','keys','User','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','create','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','map','include','model','then','info','debug','catch','message','error','find','raw','ShowCmHopper','CreateCmHopper','body','stringify','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x419fb7,_0x568091){var _0x34dd57=function(_0x2f3f20){while(--_0x2f3f20){_0x419fb7['push'](_0x419fb7['shift']());}};_0x34dd57(++_0x568091);}(_0xa72a,0xc8));var _0xaa72=function(_0x221a9f,_0x2a5e1c){_0x221a9f=_0x221a9f-0x0;var _0x5976c7=_0xa72a[_0x221a9f];return _0x5976c7;};'use strict';var _=require(_0xaa72('0x0'));var util=require('util');var moment=require(_0xaa72('0x1'));var BPromise=require(_0xaa72('0x2'));var db=require(_0xaa72('0x3'))['db'];var logger=require('../../config/logger')(_0xaa72('0x4'));exports[_0xaa72('0x5')]=function(_0xaa14c0){var _0x4d9bd6=this;return new Promise(function(_0x50133e,_0x8b8b1b){return db[_0xaa72('0x6')]['findAll']({'raw':_0xaa14c0['options']?_0xaa14c0[_0xaa72('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0xaa14c0[_0xaa72('0x7')]?_0xaa14c0[_0xaa72('0x7')][_0xaa72('0x8')]||null:null,'attributes':_0xaa14c0['options']?_0xaa14c0[_0xaa72('0x7')][_0xaa72('0x9')]||null:null,'limit':_0xaa14c0[_0xaa72('0x7')]?_0xaa14c0[_0xaa72('0x7')][_0xaa72('0xa')]||null:null,'include':_0xaa14c0[_0xaa72('0x7')]?_0xaa14c0[_0xaa72('0x7')]['include']?_[_0xaa72('0xb')](_0xaa14c0['options'][_0xaa72('0xc')],function(_0x4d8613){return{'model':db[_0x4d8613[_0xaa72('0xd')]],'as':_0x4d8613['as'],'attributes':_0x4d8613[_0xaa72('0x9')],'include':_0x4d8613[_0xaa72('0xc')]?_[_0xaa72('0xb')](_0x4d8613['include'],function(_0x3fa878){return{'model':db[_0x3fa878[_0xaa72('0xd')]],'as':_0x3fa878['as'],'attributes':_0x3fa878[_0xaa72('0x9')],'include':_0x3fa878[_0xaa72('0xc')]?_[_0xaa72('0xb')](_0x3fa878['include'],function(_0x3aa9ee){return{'model':db[_0x3aa9ee[_0xaa72('0xd')]],'as':_0x3aa9ee['as'],'attributes':_0x3aa9ee[_0xaa72('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaa72('0xe')](function(_0x3d78a2){logger[_0xaa72('0xf')]('GetCmHopper',_0xaa14c0);logger[_0xaa72('0x10')](_0xaa72('0x5'),_0xaa14c0,JSON['stringify'](_0x3d78a2));_0x50133e(_0x3d78a2);})[_0xaa72('0x11')](function(_0x56af80){logger['error'](_0xaa72('0x5'),_0x56af80[_0xaa72('0x12')],_0xaa14c0);_0x8b8b1b(_0x4d9bd6[_0xaa72('0x13')](0x1f4,_0x56af80[_0xaa72('0x12')]));});});};exports['ShowCmHopper']=function(_0x4ac74c){var _0x3b80e5=this;return new Promise(function(_0x2fc82e,_0x425725){return db['CmHopper'][_0xaa72('0x14')]({'raw':_0x4ac74c[_0xaa72('0x7')]?_0x4ac74c[_0xaa72('0x7')][_0xaa72('0x15')]===undefined?!![]:![]:!![],'where':_0x4ac74c['options']?_0x4ac74c['options'][_0xaa72('0x8')]||null:null,'attributes':_0x4ac74c[_0xaa72('0x7')]?_0x4ac74c['options']['attributes']||null:null,'include':_0x4ac74c[_0xaa72('0x7')]?_0x4ac74c['options'][_0xaa72('0xc')]?_['map'](_0x4ac74c[_0xaa72('0x7')][_0xaa72('0xc')],function(_0x10f9be){return{'model':db[_0x10f9be[_0xaa72('0xd')]],'as':_0x10f9be['as'],'attributes':_0x10f9be[_0xaa72('0x9')],'include':_0x10f9be[_0xaa72('0xc')]?_[_0xaa72('0xb')](_0x10f9be[_0xaa72('0xc')],function(_0x4493ca){return{'model':db[_0x4493ca[_0xaa72('0xd')]],'as':_0x4493ca['as'],'attributes':_0x4493ca['attributes'],'include':_0x4493ca['include']?_[_0xaa72('0xb')](_0x4493ca[_0xaa72('0xc')],function(_0x27df84){return{'model':db[_0x27df84[_0xaa72('0xd')]],'as':_0x27df84['as'],'attributes':_0x27df84['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa72('0xe')](function(_0x2f9cf9){logger['info'](_0xaa72('0x16'),_0x4ac74c);logger[_0xaa72('0x10')](_0xaa72('0x16'),_0x4ac74c,JSON['stringify'](_0x2f9cf9));_0x2fc82e(_0x2f9cf9);})[_0xaa72('0x11')](function(_0x1aa27d){logger[_0xaa72('0x13')](_0xaa72('0x16'),_0x1aa27d[_0xaa72('0x12')],_0x4ac74c);_0x425725(_0x3b80e5['error'](0x1f4,_0x1aa27d[_0xaa72('0x12')]));});});};exports[_0xaa72('0x17')]=function(_0xf10985){var _0x4f2306=this;return new Promise(function(_0x181abe,_0x34ac31){return db[_0xaa72('0x6')]['create'](_0xf10985[_0xaa72('0x18')],{'raw':_0xf10985['options']?_0xf10985['options'][_0xaa72('0x15')]===undefined?!![]:![]:!![]})[_0xaa72('0xe')](function(_0x5bba33){logger[_0xaa72('0xf')](_0xaa72('0x17'),_0xf10985);logger[_0xaa72('0x10')](_0xaa72('0x17'),_0xf10985,JSON[_0xaa72('0x19')](_0x5bba33));_0x181abe(_0x5bba33);})[_0xaa72('0x11')](function(_0x306e71){logger[_0xaa72('0x13')](_0xaa72('0x17'),_0x306e71[_0xaa72('0x12')],_0xf10985);_0x34ac31(_0x4f2306[_0xaa72('0x13')](0x1f4,_0x306e71[_0xaa72('0x12')]));});});};exports[_0xaa72('0x1a')]=function(_0x49c9db){var _0x27c8fa=this;return new Promise(function(_0x2ef12d,_0x11a77e){return db['CmHopper'][_0xaa72('0x1b')](_0x49c9db[_0xaa72('0x18')],{'raw':_0x49c9db[_0xaa72('0x7')]?_0x49c9db[_0xaa72('0x7')][_0xaa72('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c9db[_0xaa72('0x7')]?_0x49c9db[_0xaa72('0x7')][_0xaa72('0x8')]||null:null,'attributes':_0x49c9db['options']?_0x49c9db[_0xaa72('0x7')][_0xaa72('0x9')]||null:null,'limit':_0x49c9db[_0xaa72('0x7')]?_0x49c9db[_0xaa72('0x7')][_0xaa72('0xa')]||null:null})[_0xaa72('0xe')](function(_0x1f46f7){logger[_0xaa72('0xf')](_0xaa72('0x1a'),_0x49c9db);logger[_0xaa72('0xf')](_0xaa72('0x1c'),JSON[_0xaa72('0x19')](_0x49c9db[_0xaa72('0x7')][_0xaa72('0x8')]),_0x49c9db[_0xaa72('0x18')][_0xaa72('0x1d')]);logger['debug'](_0xaa72('0x1a'),_0x49c9db,JSON[_0xaa72('0x19')](_0x1f46f7));_0x2ef12d(_0x1f46f7);})['catch'](function(_0x5d1ec2){logger[_0xaa72('0x13')](_0xaa72('0x1a'),_0x5d1ec2[_0xaa72('0x12')],_0x49c9db);_0x11a77e(_0x27c8fa['error'](0x1f4,_0x5d1ec2[_0xaa72('0x12')]));});});};exports[_0xaa72('0x1e')]=function(_0x3c4694){var _0x46b2d1=this;return new Promise(function(_0x22b8d1,_0x3be8d8){return db[_0xaa72('0x6')][_0xaa72('0x1f')]({'where':_0x3c4694[_0xaa72('0x7')]?_0x3c4694['options']['where']||null:null})['then'](function(_0x54888c){logger['info']('DestroyCmHopper',_0x3c4694);logger['debug'](_0xaa72('0x1e'),_0x3c4694,JSON['stringify'](_0x54888c));_0x22b8d1(_0x54888c);})['catch'](function(_0x4a2f5f){logger[_0xaa72('0x13')]('DestroyCmHopper',_0x4a2f5f[_0xaa72('0x12')],_0x3c4694);_0x3be8d8(_0x46b2d1['error'](0x1f4,_0x4a2f5f[_0xaa72('0x12')]));});});};exports[_0xaa72('0x20')]=function(_0x107dbd){var _0x24602b=this;return new Promise(function(_0xee24d9,_0x3de0db){return db[_0xaa72('0x21')][_0xaa72('0x22')]()[_0xaa72('0xe')](function(_0x38f071){return db[_0xaa72('0x23')][_0xaa72('0x24')](function(_0x1cd01a){return db['CmHopper']['findAll']({'where':_0x107dbd[_0xaa72('0x7')]?_0x107dbd['options']['where']||null:null,'attributes':_0x107dbd[_0xaa72('0x7')]?_0x107dbd['options']['attributes']||null:null,'limit':_0x107dbd['options']?_0x107dbd['options'][_0xaa72('0xa')]||null:null,'order':_0x107dbd[_0xaa72('0x7')]?_0x107dbd[_0xaa72('0x7')][_0xaa72('0x25')]||null:null,'transaction':_0x1cd01a,'lock':_0x1cd01a[_0xaa72('0x26')]['UPDATE'],'include':[{'model':db[_0xaa72('0x21')],'as':'Contact','attributes':_[_0xaa72('0x27')](_0x38f071)},{'model':db[_0xaa72('0x28')],'as':'Agent','attributes':['id',_0xaa72('0x29'),_0xaa72('0x2a')]}]})[_0xaa72('0xe')](function(_0x26bc9e){var _0x3dc517=[];var _0x284a9c=[];for(var _0x29783c=0x0;_0x29783c<_0x26bc9e[_0xaa72('0x2b')];_0x29783c+=0x1){var _0x33b701=_0x26bc9e[_0x29783c][_0xaa72('0x2c')];if(_0x33b701===null){_0x3dc517[_0xaa72('0x2d')](_0x26bc9e[_0x29783c][_0xaa72('0x1b')](_0x107dbd['body'],{'transaction':_0x1cd01a}));}else if(!_0x284a9c[_0xaa72('0x2e')](_0x33b701)){_0x284a9c['push'](_0x33b701);_0x3dc517['push'](_0x26bc9e[_0x29783c]['update'](_0x107dbd['body'],{'transaction':_0x1cd01a}));}}return BPromise[_0xaa72('0x2f')](_0x3dc517);});})['then'](function(_0x135687){logger['info'](_0xaa72('0x20'),_0x107dbd);if(_0x135687[_0xaa72('0x2b')]>0x0){logger[_0xaa72('0xf')](_0xaa72('0x30'),_0x135687[0x0][_0xaa72('0x31')]['id'],_0x135687[0x0][_0xaa72('0x31')]['ContactId'],_0x135687[0x0][_0xaa72('0x31')]['active']);}logger[_0xaa72('0x10')](_0xaa72('0x20'),_0x107dbd,JSON[_0xaa72('0x19')](_0x135687));_0xee24d9(_0x135687);})[_0xaa72('0x11')](function(_0x355f3e){logger[_0xaa72('0x13')](_0xaa72('0x20'),_0x355f3e[_0xaa72('0x12')],_0x107dbd);_0x3de0db(_0x24602b[_0xaa72('0x13')](0x1f4,_0x355f3e[_0xaa72('0x12')]));});});});};exports[_0xaa72('0x32')]=function(_0x336e1d){var _0x544b5b=this;return new Promise(function(_0x5690f9,_0x302b0d){return db[_0xaa72('0x23')]['transaction'](function(_0xb9a4d2){return db['CmHopperFinal'][_0xaa72('0x33')](_0x336e1d[_0xaa72('0x18')],{'raw':_0x336e1d['options']?_0x336e1d[_0xaa72('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0xb9a4d2})['then'](function(){logger[_0xaa72('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xaa72('0x19')](_0x336e1d[_0xaa72('0x7')]['where']),_0x336e1d[_0xaa72('0x7')]['where'][_0xaa72('0x1d')]);return db[_0xaa72('0x6')][_0xaa72('0x1f')]({'where':_0x336e1d[_0xaa72('0x7')]?_0x336e1d[_0xaa72('0x7')][_0xaa72('0x8')]||null:null,'transaction':_0xb9a4d2});});})[_0xaa72('0xe')](function(_0x2fe3c0){logger['info'](_0xaa72('0x32'),_0x336e1d);logger[_0xaa72('0x10')](_0xaa72('0x32'),_0x336e1d,JSON['stringify'](_0x2fe3c0));_0x5690f9(_0x2fe3c0);})['catch'](function(_0x4e3fbd){logger[_0xaa72('0x13')]('MoveContactManagedDialer',_0x4e3fbd[_0xaa72('0x12')],_0x336e1d);_0x302b0d(_0x544b5b[_0xaa72('0x13')](0x1f4,_0x4e3fbd[_0xaa72('0x12')]));});});};exports[_0xaa72('0x34')]=function(_0x11e45a){var _0x1cfd2f=this;return new Promise(function(_0x29aecb,_0x49c59a){return db[_0xaa72('0x6')][_0xaa72('0x35')]({'raw':_0x11e45a['options']?_0x11e45a['options'][_0xaa72('0x15')]===undefined?!![]:![]:!![],'where':_0x11e45a['options']?_0x11e45a['options'][_0xaa72('0x8')]||null:null,'attributes':[[db[_0xaa72('0x23')]['fn'](_0xaa72('0x36'),db['sequelize']['fn']('IF',db[_0xaa72('0x23')][_0xaa72('0x37')](_0xaa72('0x38')+util[_0xaa72('0x39')](_0xaa72('0x3a'),moment()[_0xaa72('0x39')](_0xaa72('0x3b')))+_0xaa72('0x3c')))),_0xaa72('0x3d')]]})['then'](function(_0xaaf4ce){logger[_0xaa72('0xf')](_0xaa72('0x34'),_0x11e45a);logger[_0xaa72('0x10')](_0xaa72('0x34'),_0x11e45a,JSON[_0xaa72('0x19')](_0xaaf4ce));_0x29aecb(_0xaaf4ce);})[_0xaa72('0x11')](function(_0x4126e1){logger[_0xaa72('0x13')](_0xaa72('0x34'),_0x4126e1[_0xaa72('0x12')],_0x11e45a);_0x49c59a(_0x1cfd2f[_0xaa72('0x13')](0x1f4,_0x4126e1['message']));});});};exports[_0xaa72('0x3e')]=function(_0x4c48f8){var _0x17c981=this;return new Promise(function(_0xfa9393,_0xba82ea){return db['CmContact']['describe']()['then'](function(){return db[_0xaa72('0x23')]['transaction'](function(_0x34580e){return db[_0xaa72('0x6')][_0xaa72('0x35')]({'where':_0x4c48f8['options']?_0x4c48f8[_0xaa72('0x7')]['where']||null:null,'attributes':_0x4c48f8[_0xaa72('0x7')]?_0x4c48f8[_0xaa72('0x7')][_0xaa72('0x9')]||null:null,'limit':0x1,'order':_0x4c48f8[_0xaa72('0x7')]?_0x4c48f8[_0xaa72('0x7')][_0xaa72('0x25')]||null:null,'group':db[_0xaa72('0x6')]['UserId'],'transaction':_0x34580e,'lock':_0x34580e[_0xaa72('0x26')][_0xaa72('0x3f')],'include':_0x4c48f8[_0xaa72('0x7')]?_0x4c48f8[_0xaa72('0x7')][_0xaa72('0xc')]?_['map'](_0x4c48f8[_0xaa72('0x7')][_0xaa72('0xc')],function(_0x9d8b42){return{'model':db[_0x9d8b42['model']],'as':_0x9d8b42['as'],'attributes':_0x9d8b42[_0xaa72('0x9')],'include':_0x9d8b42[_0xaa72('0xc')]?_['map'](_0x9d8b42[_0xaa72('0xc')],function(_0x1b650d){return{'model':db[_0x1b650d[_0xaa72('0xd')]],'as':_0x1b650d['as'],'attributes':_0x1b650d[_0xaa72('0x9')],'include':_0x1b650d['include']?_[_0xaa72('0xb')](_0x1b650d[_0xaa72('0xc')],function(_0x312433){return{'model':db[_0x312433[_0xaa72('0xd')]],'as':_0x312433['as'],'attributes':_0x312433[_0xaa72('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaa72('0xe')](function(_0x2c83f0){var _0x37e9a1=[];for(var _0x2a6f8c=0x0;_0x2a6f8c<_0x2c83f0[_0xaa72('0x2b')];_0x2a6f8c+=0x1){_0x37e9a1[_0xaa72('0x2d')](_0x2c83f0[_0x2a6f8c][_0xaa72('0x1b')](_0x4c48f8['body'],{'transaction':_0x34580e}));}return BPromise[_0xaa72('0x2f')](_0x37e9a1);});})['then'](function(_0x5ccf2d){logger['info']('GetContactRecallMe',_0x4c48f8);logger['debug'](_0xaa72('0x3e'),_0x4c48f8,JSON[_0xaa72('0x19')](_0x5ccf2d));_0xfa9393(_0x5ccf2d);})['catch'](function(_0x5df3b7){logger[_0xaa72('0x13')]('GetContactRecallMe',_0x5df3b7['message'],_0x4c48f8);_0xba82ea(_0x17c981[_0xaa72('0x13')](0x1f4,_0x5df3b7[_0xaa72('0x12')]));});});});};exports[_0xaa72('0x40')]=function(_0x2da9ac){var _0x1b2cd9=this;return new Promise(function(_0x55d7b6,_0x22a1a2){db[_0xaa72('0x21')][_0xaa72('0x22')]()[_0xaa72('0xe')](function(_0xc29cd9){return db[_0xaa72('0x6')]['findAll']({'raw':_0x2da9ac['options']?_0x2da9ac[_0xaa72('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x2da9ac[_0xaa72('0x7')]?_0x2da9ac['options']['where']||null:null,'attributes':_0x2da9ac[_0xaa72('0x7')]?_0x2da9ac[_0xaa72('0x7')][_0xaa72('0x9')]||null:null,'limit':_0x2da9ac[_0xaa72('0x7')]?_0x2da9ac[_0xaa72('0x7')][_0xaa72('0xa')]||null:null,'include':_0x2da9ac['options']?_0x2da9ac[_0xaa72('0x7')]['include']?_[_0xaa72('0xb')](_0x2da9ac[_0xaa72('0x7')][_0xaa72('0xc')],function(_0x104ccd){return{'model':db[_0x104ccd['model']],'as':_0x104ccd['as'],'attributes':_0x104ccd['as']===_0xaa72('0x41')?_['keys'](_0xc29cd9):_0x104ccd[_0xaa72('0x9')],'include':_0x104ccd[_0xaa72('0xc')]?_['map'](_0x104ccd['include'],function(_0xc339c1){return{'model':db[_0xc339c1[_0xaa72('0xd')]],'as':_0xc339c1['as'],'attributes':_0xc339c1['attributes'],'include':_0xc339c1[_0xaa72('0xc')]?_['map'](_0xc339c1['include'],function(_0x380d8c){return{'model':db[_0x380d8c[_0xaa72('0xd')]],'as':_0x380d8c['as'],'attributes':_0x380d8c[_0xaa72('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaa72('0xe')](function(_0x3d9526){logger[_0xaa72('0xf')]('GetCmHopper',_0x2da9ac);logger['debug'](_0xaa72('0x5'),_0x2da9ac,JSON['stringify'](_0x3d9526));_0x55d7b6(_0x3d9526);})[_0xaa72('0x11')](function(_0x1c107c){logger[_0xaa72('0x13')](_0xaa72('0x5'),_0x1c107c[_0xaa72('0x12')],_0x2da9ac);_0x22a1a2(_0x1b2cd9[_0xaa72('0x13')](0x1f4,_0x1c107c[_0xaa72('0x12')]));});});});};exports[_0xaa72('0x42')]=function(_0x2dbdf9){var _0x2d5787=this;return new Promise(function(_0x5cf87d,_0x4caba2){return db[_0xaa72('0x21')][_0xaa72('0x43')]({'raw':!![],'where':{'phone':_0x2dbdf9['options'][_0xaa72('0x8')]['phone']},'attributes':['id',_0xaa72('0x44')],'order':[['id',_0xaa72('0x45')]]})['then'](function(_0x5699e4){logger['info'](_0xaa72('0x46'),_0x2dbdf9);logger[_0xaa72('0x10')](_0xaa72('0x46'),_0x2dbdf9,JSON[_0xaa72('0x19')](_0x5699e4));_0x5cf87d(_0x5699e4);})[_0xaa72('0x11')](function(_0x574be0){logger[_0xaa72('0x13')](_0xaa72('0x46'),_0x574be0[_0xaa72('0x12')],_0x2dbdf9);_0x4caba2(_0x2d5787['error'](0x1f4,_0x574be0[_0xaa72('0x12')]));});});};exports[_0xaa72('0x47')]=function(_0x193192){var _0x4bd5e7=this;return new Promise(function(_0x156e23,_0x274fd){return db[_0xaa72('0x23')][_0xaa72('0x24')](function(_0x4e5d0f){var _0x9d6a82=_0x193192[_0xaa72('0x7')]&&_0x193192[_0xaa72('0x7')]['where']?_0x193192[_0xaa72('0x7')]['where']:{};return db[_0xaa72('0x6')][_0xaa72('0x1b')](_0x193192[_0xaa72('0x18')],{'where':_0x9d6a82,'transaction':_0x4e5d0f})[_0xaa72('0xe')](function(_0x72c297){logger[_0xaa72('0xf')](_0xaa72('0x47'),_0x193192);logger[_0xaa72('0x10')](_0xaa72('0x47'),_0x193192,JSON['stringify'](_0x72c297));_0x156e23(_0x72c297);})[_0xaa72('0x11')](function(_0x3b9760){logger[_0xaa72('0x13')](_0xaa72('0x47'),_0x3b9760[_0xaa72('0x12')],_0x193192);_0x274fd(_0x4bd5e7['error'](0x1f4,_0x3b9760[_0xaa72('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1450ae){var _0x8cf34d=this;var _0x4cc050=_0x1450ae[_0xaa72('0x18')][_0xaa72('0x8')]['voiceQueueIds'];var _0x2a1a99=_0x1450ae[_0xaa72('0x18')][_0xaa72('0x8')][_0xaa72('0x48')];var _0x4949d5=_0x1450ae['body'][_0xaa72('0x8')]['availableAgentsIds'];return new Promise(function(_0x5ae3b7,_0x4d7914){return db[_0xaa72('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x4cc050},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xaa72('0x23')][_0xaa72('0x37')](_0xaa72('0x49')+_0x2a1a99+_0xaa72('0x4a')),'$gt':db[_0xaa72('0x23')][_0xaa72('0x37')](_0xaa72('0x4b'))}},'UserId':{'$in':_0x4949d5}},'include':[{'model':db['CmContact'],'as':_0xaa72('0x41')},{'model':db['User'],'as':'Agent','attributes':['id',_0xaa72('0x29'),_0xaa72('0x2a')]},{'model':db[_0xaa72('0x4c')],'as':_0xaa72('0x4d')}]})[_0xaa72('0xe')](function(_0xd61191){if(_0xd61191[_0xaa72('0x2b')]>0x0){return db[_0xaa72('0x23')]['transaction'](function(_0x356d22){return db[_0xaa72('0x6')]['update']({'recallmeNotifiedDate':db['sequelize'][_0xaa72('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0xaa72('0xb')](_0xd61191,'id')}},'transaction':_0x356d22})[_0xaa72('0xe')](function(){_0x5ae3b7(_0xd61191);})['catch'](function(_0x5830c9){logger['error'](_0xaa72('0x4e'),_0x5830c9['message'],_0x1450ae);_0x4d7914(_0x8cf34d[_0xaa72('0x13')](0x1f4,_0x5830c9['message']));});})[_0xaa72('0x11')](function(_0x447ab9){logger[_0xaa72('0x13')](_0xaa72('0x4e'),_0x447ab9['message'],_0x1450ae);_0x4d7914(_0x8cf34d[_0xaa72('0x13')](0x1f4,_0x447ab9[_0xaa72('0x12')]));});}else{_0x5ae3b7(_0xd61191);}});});}; \ No newline at end of file +var _0x6268=['\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','describe','order','UPDATE','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','bluebird','GetCmHopper','findAll','options','where','limit','include','map','model','attributes','then','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','raw','info','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','CmContact','Contact','keys','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x6268,0x101));var _0x8626=function(_0x1579d7,_0x505dcf){_0x1579d7=_0x1579d7-0x0;var _0x21b002=_0x6268[_0x1579d7];return _0x21b002;};'use strict';var _=require(_0x8626('0x0'));var util=require(_0x8626('0x1'));var moment=require('moment');var BPromise=require(_0x8626('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');exports[_0x8626('0x3')]=function(_0x199680){var _0x153b12=this;return new Promise(function(_0x2a1c8b,_0x25c2a5){return db['CmHopper'][_0x8626('0x4')]({'raw':_0x199680[_0x8626('0x5')]?_0x199680[_0x8626('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x199680['options']?_0x199680[_0x8626('0x5')][_0x8626('0x6')]||null:null,'attributes':_0x199680[_0x8626('0x5')]?_0x199680[_0x8626('0x5')]['attributes']||null:null,'limit':_0x199680[_0x8626('0x5')]?_0x199680[_0x8626('0x5')][_0x8626('0x7')]||null:null,'include':_0x199680[_0x8626('0x5')]?_0x199680[_0x8626('0x5')][_0x8626('0x8')]?_[_0x8626('0x9')](_0x199680[_0x8626('0x5')][_0x8626('0x8')],function(_0x169999){return{'model':db[_0x169999[_0x8626('0xa')]],'as':_0x169999['as'],'attributes':_0x169999[_0x8626('0xb')],'include':_0x169999[_0x8626('0x8')]?_[_0x8626('0x9')](_0x169999[_0x8626('0x8')],function(_0x4b70a8){return{'model':db[_0x4b70a8['model']],'as':_0x4b70a8['as'],'attributes':_0x4b70a8[_0x8626('0xb')],'include':_0x4b70a8[_0x8626('0x8')]?_['map'](_0x4b70a8['include'],function(_0x58161f){return{'model':db[_0x58161f[_0x8626('0xa')]],'as':_0x58161f['as'],'attributes':_0x58161f[_0x8626('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8626('0xc')](function(_0xadd61d){logger['info'](_0x8626('0x3'),_0x199680);logger[_0x8626('0xd')](_0x8626('0x3'),_0x199680,JSON[_0x8626('0xe')](_0xadd61d));_0x2a1c8b(_0xadd61d);})[_0x8626('0xf')](function(_0x561ca2){logger[_0x8626('0x10')](_0x8626('0x3'),_0x561ca2[_0x8626('0x11')],_0x199680);_0x25c2a5(_0x153b12[_0x8626('0x10')](0x1f4,_0x561ca2['message']));});});};exports[_0x8626('0x12')]=function(_0xbd58ac){var _0x5f4085=this;return new Promise(function(_0x8bb9d8,_0x54c11c){return db[_0x8626('0x13')]['find']({'raw':_0xbd58ac['options']?_0xbd58ac[_0x8626('0x5')][_0x8626('0x14')]===undefined?!![]:![]:!![],'where':_0xbd58ac[_0x8626('0x5')]?_0xbd58ac['options']['where']||null:null,'attributes':_0xbd58ac[_0x8626('0x5')]?_0xbd58ac[_0x8626('0x5')][_0x8626('0xb')]||null:null,'include':_0xbd58ac['options']?_0xbd58ac['options']['include']?_[_0x8626('0x9')](_0xbd58ac['options']['include'],function(_0x3b00c6){return{'model':db[_0x3b00c6[_0x8626('0xa')]],'as':_0x3b00c6['as'],'attributes':_0x3b00c6[_0x8626('0xb')],'include':_0x3b00c6[_0x8626('0x8')]?_['map'](_0x3b00c6[_0x8626('0x8')],function(_0x41461c){return{'model':db[_0x41461c['model']],'as':_0x41461c['as'],'attributes':_0x41461c['attributes'],'include':_0x41461c[_0x8626('0x8')]?_[_0x8626('0x9')](_0x41461c[_0x8626('0x8')],function(_0x230ffc){return{'model':db[_0x230ffc[_0x8626('0xa')]],'as':_0x230ffc['as'],'attributes':_0x230ffc[_0x8626('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8626('0xc')](function(_0x34a5e7){logger[_0x8626('0x15')](_0x8626('0x12'),_0xbd58ac);logger['debug'](_0x8626('0x12'),_0xbd58ac,JSON[_0x8626('0xe')](_0x34a5e7));_0x8bb9d8(_0x34a5e7);})[_0x8626('0xf')](function(_0x24324e){logger[_0x8626('0x10')](_0x8626('0x12'),_0x24324e['message'],_0xbd58ac);_0x54c11c(_0x5f4085[_0x8626('0x10')](0x1f4,_0x24324e[_0x8626('0x11')]));});});};exports['CreateCmHopper']=function(_0x3682d8){var _0x4b7722=this;return new Promise(function(_0x52d6a3,_0x2af350){return db[_0x8626('0x13')][_0x8626('0x16')](_0x3682d8[_0x8626('0x17')],{'raw':_0x3682d8['options']?_0x3682d8[_0x8626('0x5')][_0x8626('0x14')]===undefined?!![]:![]:!![]})[_0x8626('0xc')](function(_0x810cd1){logger[_0x8626('0x15')](_0x8626('0x18'),_0x3682d8);logger[_0x8626('0xd')](_0x8626('0x18'),_0x3682d8,JSON[_0x8626('0xe')](_0x810cd1));_0x52d6a3(_0x810cd1);})[_0x8626('0xf')](function(_0x40bf99){logger['error'](_0x8626('0x18'),_0x40bf99[_0x8626('0x11')],_0x3682d8);_0x2af350(_0x4b7722[_0x8626('0x10')](0x1f4,_0x40bf99[_0x8626('0x11')]));});});};exports['UpdateCmHopper']=function(_0x82dff5){var _0x288c47=this;return new Promise(function(_0x24eabc,_0x2393ad){return db[_0x8626('0x13')][_0x8626('0x19')](_0x82dff5['body'],{'raw':_0x82dff5[_0x8626('0x5')]?_0x82dff5['options'][_0x8626('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x82dff5['options']?_0x82dff5['options'][_0x8626('0x6')]||null:null,'attributes':_0x82dff5[_0x8626('0x5')]?_0x82dff5[_0x8626('0x5')]['attributes']||null:null,'limit':_0x82dff5[_0x8626('0x5')]?_0x82dff5['options'][_0x8626('0x7')]||null:null})[_0x8626('0xc')](function(_0x525394){logger[_0x8626('0x15')](_0x8626('0x1a'),_0x82dff5);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x8626('0xe')](_0x82dff5['options'][_0x8626('0x6')]),_0x82dff5[_0x8626('0x17')]['active']);logger['debug']('UpdateCmHopper',_0x82dff5,JSON[_0x8626('0xe')](_0x525394));_0x24eabc(_0x525394);})[_0x8626('0xf')](function(_0x16a125){logger[_0x8626('0x10')](_0x8626('0x1a'),_0x16a125[_0x8626('0x11')],_0x82dff5);_0x2393ad(_0x288c47[_0x8626('0x10')](0x1f4,_0x16a125['message']));});});};exports[_0x8626('0x1b')]=function(_0x50b105){var _0x2ee4d2=this;return new Promise(function(_0x180792,_0x4feb76){return db['CmHopper'][_0x8626('0x1c')]({'where':_0x50b105[_0x8626('0x5')]?_0x50b105['options']['where']||null:null})[_0x8626('0xc')](function(_0x40a943){logger['info'](_0x8626('0x1b'),_0x50b105);logger['debug'](_0x8626('0x1b'),_0x50b105,JSON[_0x8626('0xe')](_0x40a943));_0x180792(_0x40a943);})['catch'](function(_0x12abfd){logger[_0x8626('0x10')](_0x8626('0x1b'),_0x12abfd[_0x8626('0x11')],_0x50b105);_0x4feb76(_0x2ee4d2[_0x8626('0x10')](0x1f4,_0x12abfd['message']));});});};exports[_0x8626('0x1d')]=function(_0x1a3bd0){var _0x2e7558=this;return new Promise(function(_0x3b9eee,_0x266b09){return db['CmContact']['describe']()[_0x8626('0xc')](function(_0x5d4c34){return db[_0x8626('0x1e')][_0x8626('0x1f')](function(_0x215b33){return db[_0x8626('0x13')]['findAll']({'where':_0x1a3bd0['options']?_0x1a3bd0[_0x8626('0x5')]['where']||null:null,'attributes':_0x1a3bd0[_0x8626('0x5')]?_0x1a3bd0['options'][_0x8626('0xb')]||null:null,'limit':_0x1a3bd0[_0x8626('0x5')]?_0x1a3bd0['options']['limit']||null:null,'order':_0x1a3bd0[_0x8626('0x5')]?_0x1a3bd0['options']['order']||null:null,'transaction':_0x215b33,'lock':_0x215b33['LOCK']['UPDATE'],'include':[{'model':db[_0x8626('0x20')],'as':_0x8626('0x21'),'attributes':_[_0x8626('0x22')](_0x5d4c34)},{'model':db['User'],'as':_0x8626('0x23'),'attributes':['id',_0x8626('0x24'),_0x8626('0x25')]}]})[_0x8626('0xc')](function(_0x231d53){var _0x24c6b9=[];var _0x6579f7=[];for(var _0x21cba6=0x0;_0x21cba6<_0x231d53[_0x8626('0x26')];_0x21cba6+=0x1){var _0x3c65e7=_0x231d53[_0x21cba6][_0x8626('0x27')];if(_0x3c65e7===null){_0x24c6b9[_0x8626('0x28')](_0x231d53[_0x21cba6][_0x8626('0x19')](_0x1a3bd0[_0x8626('0x17')],{'transaction':_0x215b33}));}else if(!_0x6579f7[_0x8626('0x29')](_0x3c65e7)){_0x6579f7[_0x8626('0x28')](_0x3c65e7);_0x24c6b9[_0x8626('0x28')](_0x231d53[_0x21cba6][_0x8626('0x19')](_0x1a3bd0[_0x8626('0x17')],{'transaction':_0x215b33}));}}return BPromise[_0x8626('0x2a')](_0x24c6b9);});})['then'](function(_0x336dcb){logger[_0x8626('0x15')]('GetContactDialer',_0x1a3bd0);if(_0x336dcb['length']>0x0){logger['info'](_0x8626('0x2b'),_0x336dcb[0x0]['dataValues']['id'],_0x336dcb[0x0][_0x8626('0x2c')][_0x8626('0x2d')],_0x336dcb[0x0][_0x8626('0x2c')][_0x8626('0x2e')]);}logger[_0x8626('0xd')]('GetContactDialer',_0x1a3bd0,JSON[_0x8626('0xe')](_0x336dcb));_0x3b9eee(_0x336dcb);})[_0x8626('0xf')](function(_0x11b7b9){logger[_0x8626('0x10')]('GetContactDialer',_0x11b7b9[_0x8626('0x11')],_0x1a3bd0);_0x266b09(_0x2e7558[_0x8626('0x10')](0x1f4,_0x11b7b9[_0x8626('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0xb0ed00){var _0x1a0dd2=this;return new Promise(function(_0x2da46f,_0x26de30){return db[_0x8626('0x1e')][_0x8626('0x1f')](function(_0x5187eb){return db[_0x8626('0x2f')]['create'](_0xb0ed00['body'],{'raw':_0xb0ed00[_0x8626('0x5')]?_0xb0ed00[_0x8626('0x5')][_0x8626('0x14')]===undefined?!![]:![]:!![],'transaction':_0x5187eb})[_0x8626('0xc')](function(){logger['info'](_0x8626('0x30'),JSON[_0x8626('0xe')](_0xb0ed00[_0x8626('0x5')][_0x8626('0x6')]),_0xb0ed00[_0x8626('0x5')][_0x8626('0x6')][_0x8626('0x2e')]);return db[_0x8626('0x13')]['destroy']({'where':_0xb0ed00[_0x8626('0x5')]?_0xb0ed00[_0x8626('0x5')][_0x8626('0x6')]||null:null,'transaction':_0x5187eb});});})['then'](function(_0x2051f9){logger[_0x8626('0x15')](_0x8626('0x31'),_0xb0ed00);logger['debug'](_0x8626('0x31'),_0xb0ed00,JSON['stringify'](_0x2051f9));_0x2da46f(_0x2051f9);})[_0x8626('0xf')](function(_0x3c4ac2){logger[_0x8626('0x10')]('MoveContactManagedDialer',_0x3c4ac2[_0x8626('0x11')],_0xb0ed00);_0x26de30(_0x1a0dd2[_0x8626('0x10')](0x1f4,_0x3c4ac2[_0x8626('0x11')]));});});};exports[_0x8626('0x32')]=function(_0x4bdee1){var _0x38ea8e=this;return new Promise(function(_0x409591,_0x481bad){return db[_0x8626('0x13')][_0x8626('0x4')]({'raw':_0x4bdee1[_0x8626('0x5')]?_0x4bdee1['options'][_0x8626('0x14')]===undefined?!![]:![]:!![],'where':_0x4bdee1[_0x8626('0x5')]?_0x4bdee1['options'][_0x8626('0x6')]||null:null,'attributes':[[db[_0x8626('0x1e')]['fn'](_0x8626('0x33'),db[_0x8626('0x1e')]['fn']('IF',db[_0x8626('0x1e')][_0x8626('0x34')](_0x8626('0x35')+util[_0x8626('0x36')](_0x8626('0x37'),moment()[_0x8626('0x36')](_0x8626('0x38')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x8626('0xc')](function(_0x3003d9){logger[_0x8626('0x15')](_0x8626('0x32'),_0x4bdee1);logger[_0x8626('0xd')](_0x8626('0x32'),_0x4bdee1,JSON['stringify'](_0x3003d9));_0x409591(_0x3003d9);})['catch'](function(_0x2550ec){logger[_0x8626('0x10')]('CountReScheduled',_0x2550ec[_0x8626('0x11')],_0x4bdee1);_0x481bad(_0x38ea8e[_0x8626('0x10')](0x1f4,_0x2550ec['message']));});});};exports['GetContactRecallMe']=function(_0x1003e6){var _0x211fec=this;return new Promise(function(_0x3212bf,_0x117691){return db[_0x8626('0x20')][_0x8626('0x39')]()['then'](function(){return db[_0x8626('0x1e')]['transaction'](function(_0x1c8a17){return db['CmHopper'][_0x8626('0x4')]({'where':_0x1003e6[_0x8626('0x5')]?_0x1003e6[_0x8626('0x5')]['where']||null:null,'attributes':_0x1003e6[_0x8626('0x5')]?_0x1003e6['options'][_0x8626('0xb')]||null:null,'limit':0x1,'order':_0x1003e6[_0x8626('0x5')]?_0x1003e6[_0x8626('0x5')][_0x8626('0x3a')]||null:null,'group':db[_0x8626('0x13')][_0x8626('0x27')],'transaction':_0x1c8a17,'lock':_0x1c8a17['LOCK'][_0x8626('0x3b')],'include':_0x1003e6['options']?_0x1003e6[_0x8626('0x5')][_0x8626('0x8')]?_[_0x8626('0x9')](_0x1003e6[_0x8626('0x5')][_0x8626('0x8')],function(_0x490494){return{'model':db[_0x490494[_0x8626('0xa')]],'as':_0x490494['as'],'attributes':_0x490494[_0x8626('0xb')],'include':_0x490494['include']?_[_0x8626('0x9')](_0x490494['include'],function(_0x4fa4dc){return{'model':db[_0x4fa4dc[_0x8626('0xa')]],'as':_0x4fa4dc['as'],'attributes':_0x4fa4dc[_0x8626('0xb')],'include':_0x4fa4dc[_0x8626('0x8')]?_[_0x8626('0x9')](_0x4fa4dc['include'],function(_0x2f6509){return{'model':db[_0x2f6509['model']],'as':_0x2f6509['as'],'attributes':_0x2f6509[_0x8626('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8626('0xc')](function(_0x13b48e){var _0x1a3128=[];for(var _0x31f280=0x0;_0x31f280<_0x13b48e[_0x8626('0x26')];_0x31f280+=0x1){_0x1a3128[_0x8626('0x28')](_0x13b48e[_0x31f280]['update'](_0x1003e6[_0x8626('0x17')],{'transaction':_0x1c8a17}));}return BPromise[_0x8626('0x2a')](_0x1a3128);});})[_0x8626('0xc')](function(_0x54a5ef){logger[_0x8626('0x15')](_0x8626('0x3c'),_0x1003e6);logger['debug'](_0x8626('0x3c'),_0x1003e6,JSON[_0x8626('0xe')](_0x54a5ef));_0x3212bf(_0x54a5ef);})[_0x8626('0xf')](function(_0x2c85a0){logger[_0x8626('0x10')]('GetContactRecallMe',_0x2c85a0['message'],_0x1003e6);_0x117691(_0x211fec[_0x8626('0x10')](0x1f4,_0x2c85a0[_0x8626('0x11')]));});});});};exports[_0x8626('0x3d')]=function(_0x2351e9){var _0x2ad19e=this;return new Promise(function(_0x3ac910,_0x2d3085){db['CmContact']['describe']()[_0x8626('0xc')](function(_0x3e1a0f){return db[_0x8626('0x13')][_0x8626('0x4')]({'raw':_0x2351e9[_0x8626('0x5')]?_0x2351e9[_0x8626('0x5')][_0x8626('0x14')]===undefined?!![]:![]:!![],'where':_0x2351e9['options']?_0x2351e9[_0x8626('0x5')]['where']||null:null,'attributes':_0x2351e9[_0x8626('0x5')]?_0x2351e9['options'][_0x8626('0xb')]||null:null,'limit':_0x2351e9[_0x8626('0x5')]?_0x2351e9[_0x8626('0x5')][_0x8626('0x7')]||null:null,'include':_0x2351e9['options']?_0x2351e9['options'][_0x8626('0x8')]?_[_0x8626('0x9')](_0x2351e9[_0x8626('0x5')][_0x8626('0x8')],function(_0x1d8b29){return{'model':db[_0x1d8b29['model']],'as':_0x1d8b29['as'],'attributes':_0x1d8b29['as']===_0x8626('0x21')?_['keys'](_0x3e1a0f):_0x1d8b29['attributes'],'include':_0x1d8b29['include']?_[_0x8626('0x9')](_0x1d8b29[_0x8626('0x8')],function(_0x44d507){return{'model':db[_0x44d507[_0x8626('0xa')]],'as':_0x44d507['as'],'attributes':_0x44d507[_0x8626('0xb')],'include':_0x44d507[_0x8626('0x8')]?_[_0x8626('0x9')](_0x44d507[_0x8626('0x8')],function(_0x138ccc){return{'model':db[_0x138ccc[_0x8626('0xa')]],'as':_0x138ccc['as'],'attributes':_0x138ccc[_0x8626('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11839a){logger['info'](_0x8626('0x3'),_0x2351e9);logger[_0x8626('0xd')](_0x8626('0x3'),_0x2351e9,JSON[_0x8626('0xe')](_0x11839a));_0x3ac910(_0x11839a);})[_0x8626('0xf')](function(_0x11ce1f){logger[_0x8626('0x10')](_0x8626('0x3'),_0x11ce1f['message'],_0x2351e9);_0x2d3085(_0x2ad19e['error'](0x1f4,_0x11ce1f[_0x8626('0x11')]));});});});};exports[_0x8626('0x3e')]=function(_0x2bd8ac){var _0x819914=this;return new Promise(function(_0x2594f2,_0x409575){return db['CmContact'][_0x8626('0x3f')]({'raw':!![],'where':{'phone':_0x2bd8ac['options']['where'][_0x8626('0x40')]},'attributes':['id',_0x8626('0x41')],'order':[['id',_0x8626('0x42')]]})[_0x8626('0xc')](function(_0x130ff4){logger['info'](_0x8626('0x43'),_0x2bd8ac);logger[_0x8626('0xd')](_0x8626('0x43'),_0x2bd8ac,JSON[_0x8626('0xe')](_0x130ff4));_0x2594f2(_0x130ff4);})[_0x8626('0xf')](function(_0x4a1d23){logger[_0x8626('0x10')](_0x8626('0x43'),_0x4a1d23[_0x8626('0x11')],_0x2bd8ac);_0x409575(_0x819914['error'](0x1f4,_0x4a1d23['message']));});});};exports[_0x8626('0x44')]=function(_0xae1305){var _0x462b74=this;return new Promise(function(_0x47ad30,_0x317f74){return db[_0x8626('0x1e')]['transaction'](function(_0xfdc559){var _0x16565d=_0xae1305['options']&&_0xae1305[_0x8626('0x5')][_0x8626('0x6')]?_0xae1305['options'][_0x8626('0x6')]:{};return db['CmHopper'][_0x8626('0x19')](_0xae1305['body'],{'where':_0x16565d,'transaction':_0xfdc559})[_0x8626('0xc')](function(_0x495046){logger[_0x8626('0x15')](_0x8626('0x44'),_0xae1305);logger[_0x8626('0xd')](_0x8626('0x44'),_0xae1305,JSON['stringify'](_0x495046));_0x47ad30(_0x495046);})['catch'](function(_0x3ceb26){logger[_0x8626('0x10')]('ResetActiveCalls',_0x3ceb26[_0x8626('0x11')],_0xae1305);_0x317f74(_0x462b74[_0x8626('0x10')](0x1f4,_0x3ceb26[_0x8626('0x11')]));});});});};exports[_0x8626('0x45')]=function(_0x3b7215){var _0x2086a9=this;var _0xb4b987=_0x3b7215[_0x8626('0x17')]['where'][_0x8626('0x46')];var _0x35e515=_0x3b7215[_0x8626('0x17')]['where']['interval'];var _0x161455=_0x3b7215[_0x8626('0x17')]['where'][_0x8626('0x47')];return new Promise(function(_0x5157b9,_0x3058e7){return db[_0x8626('0x13')]['findAll']({'where':{'voiceQueueId':{'$in':_0xb4b987},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x8626('0x48')+_0x35e515+_0x8626('0x49')),'$gt':db[_0x8626('0x1e')][_0x8626('0x34')](_0x8626('0x4a'))}},'UserId':{'$in':_0x161455}},'include':[{'model':db[_0x8626('0x20')],'as':_0x8626('0x21')},{'model':db[_0x8626('0x4b')],'as':'Agent','attributes':['id',_0x8626('0x24'),_0x8626('0x25')]},{'model':db[_0x8626('0x4c')],'as':_0x8626('0x4d')}]})[_0x8626('0xc')](function(_0xc66063){if(_0xc66063[_0x8626('0x26')]>0x0){return db[_0x8626('0x1e')][_0x8626('0x1f')](function(_0x2a886f){return db['CmHopper'][_0x8626('0x19')]({'recallmeNotifiedDate':db[_0x8626('0x1e')][_0x8626('0x34')](_0x8626('0x4a'))},{'where':{'id':{'$in':_[_0x8626('0x9')](_0xc66063,'id')}},'transaction':_0x2a886f})[_0x8626('0xc')](function(){_0x5157b9(_0xc66063);})[_0x8626('0xf')](function(_0x586f9b){logger[_0x8626('0x10')](_0x8626('0x45'),_0x586f9b[_0x8626('0x11')],_0x3b7215);_0x3058e7(_0x2086a9[_0x8626('0x10')](0x1f4,_0x586f9b[_0x8626('0x11')]));});})[_0x8626('0xf')](function(_0x3f40fa){logger['error'](_0x8626('0x45'),_0x3f40fa[_0x8626('0x11')],_0x3b7215);_0x3058e7(_0x2086a9[_0x8626('0x10')](0x1f4,_0x3f40fa[_0x8626('0x11')]));});}else{_0x5157b9(_0xc66063);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b5999d3..fd2f1fd 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 _0x7095=['/preview','getPreview','getTimezone','put','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','describe','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7095,0x66));var _0x5709=function(_0x2cf6e7,_0xe43557){_0x2cf6e7=_0x2cf6e7-0x0;var _0x3caf4e=_0x7095[_0x2cf6e7];return _0x3caf4e;};'use strict';var express=require(_0x5709('0x0'));var router=express[_0x5709('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5709('0x2'));router[_0x5709('0x3')]('/',auth[_0x5709('0x4')](),controller['index']);router[_0x5709('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x5709('0x5')]);router[_0x5709('0x3')]('/opencontacts',auth[_0x5709('0x4')](),controller[_0x5709('0x6')]);router[_0x5709('0x3')](_0x5709('0x7'),auth[_0x5709('0x4')](),controller[_0x5709('0x8')]);router[_0x5709('0x3')](_0x5709('0x9'),auth[_0x5709('0x4')](),controller['show']);router['get'](_0x5709('0xa'),auth[_0x5709('0x4')](),controller['getPreviewRecall']);router[_0x5709('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5709('0xb')](_0x5709('0xc'),auth[_0x5709('0x4')](),controller[_0x5709('0xd')]);router[_0x5709('0xb')]('/timezone',auth['isAuthenticated'](),controller[_0x5709('0xe')]);router[_0x5709('0xf')](_0x5709('0x9'),auth[_0x5709('0x4')](),controller['update']);router[_0x5709('0x10')](_0x5709('0x9'),auth['isAuthenticated'](),controller[_0x5709('0x11')]);module[_0x5709('0x12')]=router; \ No newline at end of file +var _0x4f0f=['/:id/previewrecall','post','create','/preview','getPreview','/timezone','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show'];(function(_0x3a2c1b,_0x5171d1){var _0x3f42d1=function(_0x212aad){while(--_0x212aad){_0x3a2c1b['push'](_0x3a2c1b['shift']());}};_0x3f42d1(++_0x5171d1);}(_0x4f0f,0x18f));var _0xf4f0=function(_0x19ba6a,_0x805578){_0x19ba6a=_0x19ba6a-0x0;var _0x2f506a=_0x4f0f[_0x19ba6a];return _0x2f506a;};'use strict';var express=require(_0xf4f0('0x0'));var router=express[_0xf4f0('0x1')]();var auth=require(_0xf4f0('0x2'));var controller=require(_0xf4f0('0x3'));router['get']('/',auth[_0xf4f0('0x4')](),controller[_0xf4f0('0x5')]);router[_0xf4f0('0x6')](_0xf4f0('0x7'),auth[_0xf4f0('0x4')](),controller[_0xf4f0('0x8')]);router[_0xf4f0('0x6')](_0xf4f0('0x9'),auth[_0xf4f0('0x4')](),controller[_0xf4f0('0xa')]);router[_0xf4f0('0x6')](_0xf4f0('0xb'),auth[_0xf4f0('0x4')](),controller[_0xf4f0('0xc')]);router['get'](_0xf4f0('0xd'),auth[_0xf4f0('0x4')](),controller[_0xf4f0('0xe')]);router[_0xf4f0('0x6')](_0xf4f0('0xf'),auth[_0xf4f0('0x4')](),controller['getPreviewRecall']);router[_0xf4f0('0x10')]('/',auth[_0xf4f0('0x4')](),controller[_0xf4f0('0x11')]);router[_0xf4f0('0x10')](_0xf4f0('0x12'),auth['isAuthenticated'](),controller[_0xf4f0('0x13')]);router[_0xf4f0('0x10')](_0xf4f0('0x14'),auth[_0xf4f0('0x4')](),controller['getTimezone']);router['put'](_0xf4f0('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf4f0('0x15')]('/:id',auth[_0xf4f0('0x4')](),controller[_0xf4f0('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 860d19e..674710a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3b3=['exports','INTEGER','format','sequelize'];(function(_0x40b387,_0x38fba9){var _0x5afceb=function(_0x2bebbf){while(--_0x2bebbf){_0x40b387['push'](_0x40b387['shift']());}};_0x5afceb(++_0x38fba9);}(_0xe3b3,0x1d3));var _0x3e3b=function(_0x1a01fc,_0x5483cf){_0x1a01fc=_0x1a01fc-0x0;var _0x3e7c94=_0xe3b3[_0x1a01fc];return _0x3e7c94;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e3b('0x0'));module[_0x3e3b('0x1')]={'CmHopperId':{'type':Sequelize[_0x3e3b('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3e3b('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x3e3b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3e3b('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3e3b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3e3b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x499f=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x121504,_0x371cc3){var _0x54bc04=function(_0x2aa9b2){while(--_0x2aa9b2){_0x121504['push'](_0x121504['shift']());}};_0x54bc04(++_0x371cc3);}(_0x499f,0x1c7));var _0xf499=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x499f[_0x51ec61];return _0x223200;};'use strict';var moment=require(_0xf499('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xf499('0x1')]},'phone':{'type':Sequelize[_0xf499('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf499('0x3')],'defaultValue':moment()[_0xf499('0x4')](_0xf499('0x5'))},'countbusyretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf499('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 1d65f43..9caa544 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe30e=['fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x30c8ec,_0x46d5b7){var _0x482432=function(_0x3a78b5){while(--_0x3a78b5){_0x30c8ec['push'](_0x30c8ec['shift']());}};_0x482432(++_0x46d5b7);}(_0xe30e,0x158));var _0xee30=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe30e[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xee30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee30('0x1'));var jsonpatch=require(_0xee30('0x2'));var rp=require(_0xee30('0x3'));var moment=require(_0xee30('0x4'));var BPromise=require(_0xee30('0x5'));var Mustache=require(_0xee30('0x6'));var util=require(_0xee30('0x7'));var path=require(_0xee30('0x8'));var sox=require(_0xee30('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee30('0xa'));var squel=require('squel');var crypto=require(_0xee30('0xb'));var jsforce=require(_0xee30('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee30('0xd'));var Papa=require(_0xee30('0xe'));var Redis=require(_0xee30('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xee30('0x10'));var as=require(_0xee30('0x11'));var hardwareService=require(_0xee30('0x12'));var logger=require(_0xee30('0x13'))('api');var utils=require(_0xee30('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee30('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e07fe,_0x390dc0){_0x390dc0=_0x390dc0||0xcc;return function(_0x1a38d0){if(_0x1a38d0){return _0x4e07fe[_0xee30('0x16')](_0x390dc0);}return _0x4e07fe[_0xee30('0x17')](_0x390dc0)[_0xee30('0x18')]();};}function respondWithResult(_0x493f28,_0x420056){_0x420056=_0x420056||0xc8;return function(_0x3c6128){if(_0x3c6128){return _0x493f28['status'](_0x420056)[_0xee30('0x19')](_0x3c6128);}};}function respondWithFilteredResult(_0x2ad6cd,_0x13361b){return function(_0xb9664a){if(_0xb9664a){var _0x155207=typeof _0x13361b['offset']===_0xee30('0x1a')&&typeof _0x13361b[_0xee30('0x1b')]==='undefined';var _0x926b7f=_0xb9664a['count'];var _0x1beebd=_0x155207?0x0:_0x13361b[_0xee30('0x1c')];var _0x1fa601=_0x155207?_0xb9664a[_0xee30('0x1d')]:_0x13361b[_0xee30('0x1c')]+_0x13361b[_0xee30('0x1b')];var _0x5035de;if(_0x1fa601>=_0x926b7f){_0x1fa601=_0x926b7f;_0x5035de=0xc8;}else{_0x5035de=0xce;}_0x2ad6cd[_0xee30('0x17')](_0x5035de);return _0x2ad6cd[_0xee30('0x1e')](_0xee30('0x1f'),_0x1beebd+'-'+_0x1fa601+'/'+_0x926b7f)[_0xee30('0x19')](_0xb9664a);}return null;};}function patchUpdates(_0x469042){return function(_0x3b6cec){try{jsonpatch[_0xee30('0x20')](_0x3b6cec,_0x469042,!![]);}catch(_0x12f132){return BPromise[_0xee30('0x21')](_0x12f132);}return _0x3b6cec['save']();};}function saveUpdates(_0x21db62,_0x5274db){return function(_0x29a7d6){if(_0x29a7d6){return _0x29a7d6[_0xee30('0x22')](_0x21db62)[_0xee30('0x23')](function(_0x2e59d3){return _0x2e59d3;});}return null;};}function removeEntity(_0x3e52c6,_0x16db0f){return function(_0x2ad6ef){if(_0x2ad6ef){return _0x2ad6ef['destroy']()[_0xee30('0x23')](function(){var _0x305198=_0x2ad6ef[_0xee30('0x24')]({'plain':!![]});var _0x43e1b8=_0xee30('0x25');return db[_0xee30('0x26')][_0xee30('0x27')]({'where':{'type':_0x43e1b8,'resourceId':_0x305198['id']}})[_0xee30('0x23')](function(){return _0x2ad6ef;});})[_0xee30('0x23')](function(){_0x3e52c6[_0xee30('0x17')](0xcc)[_0xee30('0x18')]();});}};}function handleEntityNotFound(_0x11c699,_0x1c9d36){return function(_0x5dd1f1){if(!_0x5dd1f1){_0x11c699[_0xee30('0x16')](0x194);}return _0x5dd1f1;};}function handleError(_0x5ccbf0,_0x5069ae){_0x5069ae=_0x5069ae||0x1f4;return function(_0x3c7145){logger[_0xee30('0x28')](_0x3c7145[_0xee30('0x29')]);if(_0x3c7145[_0xee30('0x2a')]){delete _0x3c7145[_0xee30('0x2a')];}_0x5ccbf0[_0xee30('0x17')](_0x5069ae)[_0xee30('0x2b')](_0x3c7145);};}exports['index']=function(_0x3cf3bb,_0x5656cc){var _0x423c3f={},_0x3ef8bd={},_0x1af9bf={'count':0x0,'rows':[]};var _0x549e2b=_[_0xee30('0x2c')](db[_0xee30('0x2d')][_0xee30('0x2e')],function(_0x446778){return{'name':_0x446778[_0xee30('0x2f')],'type':_0x446778[_0xee30('0x30')][_0xee30('0x31')]};});_0x3ef8bd[_0xee30('0x32')]=_['map'](_0x549e2b,_0xee30('0x2a'));_0x3ef8bd[_0xee30('0x33')]=_[_0xee30('0x34')](_0x3cf3bb['query']);_0x3ef8bd[_0xee30('0x35')]=_['intersection'](_0x3ef8bd['model'],_0x3ef8bd['query']);_0x423c3f[_0xee30('0x36')]=_[_0xee30('0x37')](_0x3ef8bd[_0xee30('0x32')],qs['fields'](_0x3cf3bb['query'][_0xee30('0x38')]));_0x423c3f[_0xee30('0x36')]=_0x423c3f[_0xee30('0x36')][_0xee30('0x39')]?_0x423c3f[_0xee30('0x36')]:_0x3ef8bd[_0xee30('0x32')];if(!_0x3cf3bb['query'][_0xee30('0x3a')]('nolimit')){_0x423c3f[_0xee30('0x1b')]=qs[_0xee30('0x1b')](_0x3cf3bb['query']['limit']);_0x423c3f[_0xee30('0x1c')]=qs[_0xee30('0x1c')](_0x3cf3bb[_0xee30('0x33')][_0xee30('0x1c')]);}_0x423c3f[_0xee30('0x3b')]=qs[_0xee30('0x3c')](_0x3cf3bb[_0xee30('0x33')][_0xee30('0x3c')]);_0x423c3f['where']=qs[_0xee30('0x35')](_[_0xee30('0x3d')](_0x3cf3bb[_0xee30('0x33')],_0x3ef8bd[_0xee30('0x35')]),_0x549e2b);if(_0x3cf3bb[_0xee30('0x33')][_0xee30('0x3e')]){_0x423c3f[_0xee30('0x3f')]=_[_0xee30('0x40')](_0x423c3f['where'],{'$or':_[_0xee30('0x2c')](_0x549e2b,function(_0x44622a){if(_0x44622a[_0xee30('0x30')]!=='VIRTUAL'){var _0x43b4b3={};_0x43b4b3[_0x44622a['name']]={'$like':'%'+_0x3cf3bb[_0xee30('0x33')][_0xee30('0x3e')]+'%'};return _0x43b4b3;}})});}_0x423c3f=_[_0xee30('0x40')]({},_0x423c3f,_0x3cf3bb['options']);var _0x18104b={'where':_0x423c3f[_0xee30('0x3f')]};return db[_0xee30('0x2d')][_0xee30('0x1d')](_0x18104b)[_0xee30('0x23')](function(_0x3c5283){_0x1af9bf[_0xee30('0x1d')]=_0x3c5283;if(_0x3cf3bb[_0xee30('0x33')][_0xee30('0x41')]){_0x423c3f[_0xee30('0x42')]=[{'all':!![]}];}return db[_0xee30('0x2d')][_0xee30('0x43')](_0x423c3f);})['then'](function(_0x47d9c2){_0x1af9bf[_0xee30('0x44')]=_0x47d9c2;return _0x1af9bf;})['then'](respondWithFilteredResult(_0x5656cc,_0x423c3f))[_0xee30('0x45')](handleError(_0x5656cc,null));};exports[_0xee30('0x46')]=function(_0x1ed7de,_0x269530){var _0x129672={'raw':!![],'where':{'id':_0x1ed7de[_0xee30('0x47')]['id']}},_0x5d381e={};_0x5d381e['model']=_[_0xee30('0x34')](db[_0xee30('0x2d')][_0xee30('0x2e')]);_0x5d381e['query']=_[_0xee30('0x34')](_0x1ed7de[_0xee30('0x33')]);_0x5d381e[_0xee30('0x35')]=_[_0xee30('0x37')](_0x5d381e[_0xee30('0x32')],_0x5d381e['query']);_0x129672['attributes']=_['intersection'](_0x5d381e['model'],qs[_0xee30('0x38')](_0x1ed7de[_0xee30('0x33')][_0xee30('0x38')]));_0x129672[_0xee30('0x36')]=_0x129672[_0xee30('0x36')][_0xee30('0x39')]?_0x129672[_0xee30('0x36')]:_0x5d381e[_0xee30('0x32')];if(_0x1ed7de[_0xee30('0x33')][_0xee30('0x41')]){_0x129672[_0xee30('0x42')]=[{'all':!![]}];}_0x129672=_['merge']({},_0x129672,_0x1ed7de[_0xee30('0x48')]);return db[_0xee30('0x2d')][_0xee30('0x49')](_0x129672)[_0xee30('0x23')](handleEntityNotFound(_0x269530,null))[_0xee30('0x23')](respondWithResult(_0x269530,null))[_0xee30('0x45')](handleError(_0x269530,null));};exports['create']=function(_0x45905f,_0x25f564){return db[_0xee30('0x2d')][_0xee30('0x4a')](_0x45905f[_0xee30('0x4b')],{})[_0xee30('0x23')](function(_0x5f1dcd){var _0x663273=_0x45905f[_0xee30('0x4c')][_0xee30('0x24')]({'plain':!![]});if(!_0x663273)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x663273[_0xee30('0x4d')]===_0xee30('0x4c')){var _0x57eee4=_0x5f1dcd[_0xee30('0x24')]({'plain':!![]});var _0x2d8dd0=_0xee30('0x25');return db[_0xee30('0x4e')][_0xee30('0x49')]({'where':{'name':_0x2d8dd0,'userProfileId':_0x663273['userProfileId']},'raw':!![]})[_0xee30('0x23')](function(_0x45bf16){if(_0x45bf16&&_0x45bf16['autoAssociation']===0x0){return db[_0xee30('0x26')][_0xee30('0x4a')]({'name':_0x57eee4['name'],'resourceId':_0x57eee4['id'],'type':_0x45bf16['name'],'sectionId':_0x45bf16['id']},{})[_0xee30('0x23')](function(){return _0x5f1dcd;});}else{return _0x5f1dcd;}})[_0xee30('0x45')](function(_0x4beb2f){logger[_0xee30('0x28')](_0xee30('0x4f'),_0x4beb2f);throw _0x4beb2f;});}return _0x5f1dcd;})['then'](respondWithResult(_0x25f564,0xc9))['catch'](handleError(_0x25f564,null));};exports[_0xee30('0x22')]=function(_0x2e82db,_0x4047f0){if(_0x2e82db['body']['id']){delete _0x2e82db[_0xee30('0x4b')]['id'];}return db[_0xee30('0x2d')][_0xee30('0x49')]({'where':{'id':_0x2e82db[_0xee30('0x47')]['id']}})[_0xee30('0x23')](handleEntityNotFound(_0x4047f0,null))['then'](saveUpdates(_0x2e82db['body'],null))[_0xee30('0x23')](respondWithResult(_0x4047f0,null))[_0xee30('0x45')](handleError(_0x4047f0,null));};exports['destroy']=function(_0x345a5d,_0x44595a){return db['CmHopperAdditionalPhone'][_0xee30('0x49')]({'where':{'id':_0x345a5d[_0xee30('0x47')]['id']}})[_0xee30('0x23')](handleEntityNotFound(_0x44595a,null))[_0xee30('0x23')](removeEntity(_0x44595a,null))[_0xee30('0x45')](handleError(_0x44595a,null));}; \ No newline at end of file +var _0x4156=['map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','count','includeAll','include','findAll','rows','show','params','options','catch','create','body','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','json','apply','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send'];(function(_0x31f1f7,_0x796534){var _0x29d68e=function(_0x37d5a7){while(--_0x37d5a7){_0x31f1f7['push'](_0x31f1f7['shift']());}};_0x29d68e(++_0x796534);}(_0x4156,0x15c));var _0x6415=function(_0x4e93ce,_0x4c67d6){_0x4e93ce=_0x4e93ce-0x0;var _0x16954d=_0x4156[_0x4e93ce];return _0x16954d;};'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('bluebird');var Mustache=require(_0x6415('0x5'));var util=require(_0x6415('0x6'));var path=require(_0x6415('0x7'));var sox=require('sox');var csv=require(_0x6415('0x8'));var ejs=require(_0x6415('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6415('0xa'));var crypto=require('crypto');var jsforce=require(_0x6415('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6415('0xc'));var Redis=require('ioredis');var authService=require(_0x6415('0xd'));var qs=require(_0x6415('0xe'));var as=require(_0x6415('0xf'));var hardwareService=require(_0x6415('0x10'));var logger=require(_0x6415('0x11'))(_0x6415('0x12'));var utils=require(_0x6415('0x13'));var config=require(_0x6415('0x14'));var licenseUtil=require(_0x6415('0x15'));var db=require(_0x6415('0x16'))['db'];function respondWithStatusCode(_0x2d0b25,_0x35b190){_0x35b190=_0x35b190||0xcc;return function(_0x120f22){if(_0x120f22){return _0x2d0b25[_0x6415('0x17')](_0x35b190);}return _0x2d0b25[_0x6415('0x18')](_0x35b190)[_0x6415('0x19')]();};}function respondWithResult(_0x255bc3,_0x33c1ca){_0x33c1ca=_0x33c1ca||0xc8;return function(_0x4336dc){if(_0x4336dc){return _0x255bc3[_0x6415('0x18')](_0x33c1ca)['json'](_0x4336dc);}};}function respondWithFilteredResult(_0x3c9a50,_0x4f1143){return function(_0x428cc9){if(_0x428cc9){var _0x4001f3=typeof _0x4f1143[_0x6415('0x1a')]==='undefined'&&typeof _0x4f1143['limit']===_0x6415('0x1b');var _0x28c198=_0x428cc9['count'];var _0x27a49b=_0x4001f3?0x0:_0x4f1143['offset'];var _0x42f35a=_0x4001f3?_0x428cc9['count']:_0x4f1143['offset']+_0x4f1143['limit'];var _0x552531;if(_0x42f35a>=_0x28c198){_0x42f35a=_0x28c198;_0x552531=0xc8;}else{_0x552531=0xce;}_0x3c9a50[_0x6415('0x18')](_0x552531);return _0x3c9a50[_0x6415('0x1c')](_0x6415('0x1d'),_0x27a49b+'-'+_0x42f35a+'/'+_0x28c198)[_0x6415('0x1e')](_0x428cc9);}return null;};}function patchUpdates(_0x50a2e1){return function(_0x40ef96){try{jsonpatch[_0x6415('0x1f')](_0x40ef96,_0x50a2e1,!![]);}catch(_0xfd5e51){return BPromise['reject'](_0xfd5e51);}return _0x40ef96['save']();};}function saveUpdates(_0x3c8e89,_0x438716){return function(_0x534142){if(_0x534142){return _0x534142[_0x6415('0x20')](_0x3c8e89)[_0x6415('0x21')](function(_0x2fa88e){return _0x2fa88e;});}return null;};}function removeEntity(_0x5f00e9,_0x234e4e){return function(_0x246edd){if(_0x246edd){return _0x246edd[_0x6415('0x22')]()['then'](function(){var _0x130695=_0x246edd[_0x6415('0x23')]({'plain':!![]});var _0x48a0ac=_0x6415('0x24');return db[_0x6415('0x25')][_0x6415('0x22')]({'where':{'type':_0x48a0ac,'resourceId':_0x130695['id']}})[_0x6415('0x21')](function(){return _0x246edd;});})[_0x6415('0x21')](function(){_0x5f00e9[_0x6415('0x18')](0xcc)[_0x6415('0x19')]();});}};}function handleEntityNotFound(_0x2ce847,_0x19e2f0){return function(_0x4cb1c3){if(!_0x4cb1c3){_0x2ce847[_0x6415('0x17')](0x194);}return _0x4cb1c3;};}function handleError(_0x5cca,_0x5023da){_0x5023da=_0x5023da||0x1f4;return function(_0x312a45){logger[_0x6415('0x26')](_0x312a45[_0x6415('0x27')]);if(_0x312a45[_0x6415('0x28')]){delete _0x312a45[_0x6415('0x28')];}_0x5cca['status'](_0x5023da)[_0x6415('0x29')](_0x312a45);};}exports['index']=function(_0x869367,_0x1a1dba){var _0x3d7df9={},_0x1385fa={},_0x2f92ce={'count':0x0,'rows':[]};var _0x201561=_[_0x6415('0x2a')](db[_0x6415('0x2b')][_0x6415('0x2c')],function(_0x1c405d){return{'name':_0x1c405d[_0x6415('0x2d')],'type':_0x1c405d[_0x6415('0x2e')]['key']};});_0x1385fa['model']=_[_0x6415('0x2a')](_0x201561,_0x6415('0x28'));_0x1385fa[_0x6415('0x2f')]=_[_0x6415('0x30')](_0x869367[_0x6415('0x2f')]);_0x1385fa[_0x6415('0x31')]=_[_0x6415('0x32')](_0x1385fa[_0x6415('0x33')],_0x1385fa[_0x6415('0x2f')]);_0x3d7df9['attributes']=_[_0x6415('0x32')](_0x1385fa['model'],qs[_0x6415('0x34')](_0x869367[_0x6415('0x2f')][_0x6415('0x34')]));_0x3d7df9[_0x6415('0x35')]=_0x3d7df9[_0x6415('0x35')][_0x6415('0x36')]?_0x3d7df9['attributes']:_0x1385fa[_0x6415('0x33')];if(!_0x869367[_0x6415('0x2f')][_0x6415('0x37')](_0x6415('0x38'))){_0x3d7df9[_0x6415('0x39')]=qs[_0x6415('0x39')](_0x869367[_0x6415('0x2f')]['limit']);_0x3d7df9[_0x6415('0x1a')]=qs[_0x6415('0x1a')](_0x869367[_0x6415('0x2f')][_0x6415('0x1a')]);}_0x3d7df9['order']=qs['sort'](_0x869367[_0x6415('0x2f')][_0x6415('0x3a')]);_0x3d7df9[_0x6415('0x3b')]=qs['filters'](_[_0x6415('0x3c')](_0x869367[_0x6415('0x2f')],_0x1385fa[_0x6415('0x31')]),_0x201561);if(_0x869367[_0x6415('0x2f')]['filter']){_0x3d7df9[_0x6415('0x3b')]=_[_0x6415('0x3d')](_0x3d7df9[_0x6415('0x3b')],{'$or':_[_0x6415('0x2a')](_0x201561,function(_0x14fff3){if(_0x14fff3['type']!=='VIRTUAL'){var _0x2550d3={};_0x2550d3[_0x14fff3['name']]={'$like':'%'+_0x869367[_0x6415('0x2f')]['filter']+'%'};return _0x2550d3;}})});}_0x3d7df9=_[_0x6415('0x3d')]({},_0x3d7df9,_0x869367['options']);var _0x5923bd={'where':_0x3d7df9['where']};return db[_0x6415('0x2b')][_0x6415('0x3e')](_0x5923bd)[_0x6415('0x21')](function(_0x1f51a7){_0x2f92ce['count']=_0x1f51a7;if(_0x869367[_0x6415('0x2f')][_0x6415('0x3f')]){_0x3d7df9[_0x6415('0x40')]=[{'all':!![]}];}return db[_0x6415('0x2b')][_0x6415('0x41')](_0x3d7df9);})[_0x6415('0x21')](function(_0x22af6b){_0x2f92ce[_0x6415('0x42')]=_0x22af6b;return _0x2f92ce;})[_0x6415('0x21')](respondWithFilteredResult(_0x1a1dba,_0x3d7df9))['catch'](handleError(_0x1a1dba,null));};exports[_0x6415('0x43')]=function(_0xcc2dc,_0x40e4fd){var _0x32038e={'raw':!![],'where':{'id':_0xcc2dc[_0x6415('0x44')]['id']}},_0x4a8e11={};_0x4a8e11[_0x6415('0x33')]=_[_0x6415('0x30')](db[_0x6415('0x2b')][_0x6415('0x2c')]);_0x4a8e11[_0x6415('0x2f')]=_[_0x6415('0x30')](_0xcc2dc[_0x6415('0x2f')]);_0x4a8e11[_0x6415('0x31')]=_[_0x6415('0x32')](_0x4a8e11['model'],_0x4a8e11['query']);_0x32038e[_0x6415('0x35')]=_[_0x6415('0x32')](_0x4a8e11[_0x6415('0x33')],qs['fields'](_0xcc2dc['query'][_0x6415('0x34')]));_0x32038e[_0x6415('0x35')]=_0x32038e[_0x6415('0x35')][_0x6415('0x36')]?_0x32038e[_0x6415('0x35')]:_0x4a8e11[_0x6415('0x33')];if(_0xcc2dc['query']['includeAll']){_0x32038e[_0x6415('0x40')]=[{'all':!![]}];}_0x32038e=_[_0x6415('0x3d')]({},_0x32038e,_0xcc2dc[_0x6415('0x45')]);return db[_0x6415('0x2b')]['find'](_0x32038e)[_0x6415('0x21')](handleEntityNotFound(_0x40e4fd,null))['then'](respondWithResult(_0x40e4fd,null))[_0x6415('0x46')](handleError(_0x40e4fd,null));};exports[_0x6415('0x47')]=function(_0x52c943,_0x427795){return db['CmHopperAdditionalPhone'][_0x6415('0x47')](_0x52c943[_0x6415('0x48')],{})['then'](function(_0x247b99){var _0x19a2d3=_0x52c943['user'][_0x6415('0x23')]({'plain':!![]});if(!_0x19a2d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a2d3[_0x6415('0x49')]==='user'){var _0x3a11b0=_0x247b99[_0x6415('0x23')]({'plain':!![]});var _0x1ff4af='CmHopperAdditionalPhones';return db[_0x6415('0x4a')][_0x6415('0x4b')]({'where':{'name':_0x1ff4af,'userProfileId':_0x19a2d3[_0x6415('0x4c')]},'raw':!![]})[_0x6415('0x21')](function(_0x1f2533){if(_0x1f2533&&_0x1f2533['autoAssociation']===0x0){return db[_0x6415('0x25')]['create']({'name':_0x3a11b0[_0x6415('0x28')],'resourceId':_0x3a11b0['id'],'type':_0x1f2533['name'],'sectionId':_0x1f2533['id']},{})['then'](function(){return _0x247b99;});}else{return _0x247b99;}})[_0x6415('0x46')](function(_0x56819f){logger[_0x6415('0x26')](_0x6415('0x4d'),_0x56819f);throw _0x56819f;});}return _0x247b99;})[_0x6415('0x21')](respondWithResult(_0x427795,0xc9))['catch'](handleError(_0x427795,null));};exports[_0x6415('0x20')]=function(_0xba38fc,_0x29f41e){if(_0xba38fc[_0x6415('0x48')]['id']){delete _0xba38fc[_0x6415('0x48')]['id'];}return db[_0x6415('0x2b')][_0x6415('0x4b')]({'where':{'id':_0xba38fc[_0x6415('0x44')]['id']}})[_0x6415('0x21')](handleEntityNotFound(_0x29f41e,null))['then'](saveUpdates(_0xba38fc[_0x6415('0x48')],null))[_0x6415('0x21')](respondWithResult(_0x29f41e,null))[_0x6415('0x46')](handleError(_0x29f41e,null));};exports['destroy']=function(_0x2210f9,_0xe29720){return db['CmHopperAdditionalPhone'][_0x6415('0x4b')]({'where':{'id':_0x2210f9[_0x6415('0x44')]['id']}})['then'](handleEntityNotFound(_0xe29720,null))['then'](removeEntity(_0xe29720,null))[_0x6415('0x46')](handleError(_0xe29720,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f15599a..6976fb3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d7d=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x11ba07,_0x30d324){var _0x37b993=function(_0x35969a){while(--_0x35969a){_0x11ba07['push'](_0x11ba07['shift']());}};_0x37b993(++_0x30d324);}(_0x5d7d,0x182));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d7('0x0'));var util=require('util');var logger=require(_0xd5d7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd5d7('0x2'));var rp=require(_0xd5d7('0x3'));var fs=require('fs');var path=require(_0xd5d7('0x4'));var rimraf=require(_0xd5d7('0x5'));var config=require(_0xd5d7('0x6'));var attributes=require(_0xd5d7('0x7'));module[_0xd5d7('0x8')]=function(_0x211fe0,_0x116fca){return _0x211fe0[_0xd5d7('0x9')](_0xd5d7('0xa'),attributes,{'tableName':_0xd5d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe64a=['moment','bluebird','request-promise','path','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xe64a,0x1e0));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var logger=require(_0xae64('0x2'))(_0xae64('0x3'));var moment=require(_0xae64('0x4'));var BPromise=require(_0xae64('0x5'));var rp=require(_0xae64('0x6'));var fs=require('fs');var path=require(_0xae64('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x2b1046,_0x896007){return _0x2b1046[_0xae64('0x8')](_0xae64('0x9'),attributes,{'tableName':_0xae64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index c885dab..3550b78 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1655=['VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','findOne','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countbusyretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','isNil','add','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0x3eae0c,_0x33bc9e){var _0x1921ec=function(_0x1b444a){while(--_0x1b444a){_0x3eae0c['push'](_0x3eae0c['shift']());}};_0x1921ec(++_0x33bc9e);}(_0x1655,0x95));var _0x5165=function(_0x12dc14,_0x3d5794){_0x12dc14=_0x12dc14-0x0;var _0x542250=_0x1655[_0x12dc14];return _0x542250;};'use strict';var _=require('lodash');var util=require(_0x5165('0x0'));var moment=require('moment');var BPromise=require(_0x5165('0x1'));var rs=require(_0x5165('0x2'));var fs=require('fs');var Redis=require(_0x5165('0x3'));var db=require(_0x5165('0x4'))['db'];var utils=require(_0x5165('0x5'));var logger=require(_0x5165('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dae55,_0x51ff7e,_0x2fc5c3){return new BPromise(function(_0x25d38a,_0x909706){return client[_0x5165('0x8')](_0x1dae55,_0x2fc5c3)['then'](function(_0x5a12c3){logger['info'](_0x5165('0x9'),_0x51ff7e,'request\x20sent');logger[_0x5165('0xa')](_0x5165('0xb'),_0x51ff7e,_0x5165('0xc'),JSON[_0x5165('0xd')](_0x5a12c3));if(_0x5a12c3[_0x5165('0xe')]){if(_0x5a12c3['error'][_0x5165('0xf')]===0x1f4){logger[_0x5165('0xe')](_0x5165('0x9'),_0x51ff7e,_0x5a12c3[_0x5165('0xe')][_0x5165('0x10')]);return _0x909706(_0x5a12c3[_0x5165('0xe')][_0x5165('0x10')]);}logger[_0x5165('0xe')](_0x5165('0x9'),_0x51ff7e,_0x5a12c3[_0x5165('0xe')]['message']);return _0x25d38a(_0x5a12c3[_0x5165('0xe')][_0x5165('0x10')]);}else{logger[_0x5165('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51ff7e,_0x5165('0xc'));_0x25d38a(_0x5a12c3['result']['message']);}})[_0x5165('0x12')](function(_0x22e092){logger['error'](_0x5165('0x9'),_0x51ff7e,_0x22e092);_0x909706(_0x22e092);});});}exports[_0x5165('0x13')]=function(_0x59d3b5){var _0xf50857=this;return new Promise(function(_0x3e3e55,_0x367542){return db[_0x5165('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x59d3b5[_0x5165('0x15')][_0x5165('0x16')],'ListId':_0x59d3b5['body'][_0x5165('0x17')],'VoiceQueueId':_0x59d3b5['body'][_0x5165('0x18')]===undefined?null:_0x59d3b5[_0x5165('0x15')][_0x5165('0x18')],'CampaignId':_0x59d3b5[_0x5165('0x15')]['CampaignId']===undefined?null:_0x59d3b5[_0x5165('0x15')][_0x5165('0x19')]}})[_0x5165('0x1a')](function(_0xd1b56e){if(_0xd1b56e!=null){return db['CmHopperAdditionalPhone'][_0x5165('0x1b')]({'raw':!![],'where':{'CmHopperId':_0xd1b56e['id'],'OrderBy':{'$gt':_0xd1b56e[_0x5165('0x1c')]}},'order':[[_0x5165('0x1c'),_0x5165('0x1d')]]})['then'](function(_0xf97904){var _0x5d74bf=0x0;if(_0xf97904){if(_0xf97904['countbusyretry']+_0xf97904[_0x5165('0x1e')]+_0xf97904[_0x5165('0x1f')]+_0xf97904[_0x5165('0x20')]+_0xf97904[_0x5165('0x21')]+_0xf97904[_0x5165('0x22')]+_0xf97904[_0x5165('0x23')]+_0xf97904['countagentrejectretry']<_0x59d3b5['entity'][_0x5165('0x24')])_0x5d74bf=0x1;_0x3e3e55({'additional':_0x5d74bf});}else{return db[_0x5165('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xd1b56e['id']},'order':[[_0x5165('0x1c'),_0x5165('0x1d')]]})[_0x5165('0x1a')](function(_0x2ed2a1){var _0x2f0732=0x0;if(_0x2ed2a1){if(_0x2ed2a1[_0x5165('0x26')]+_0x2ed2a1['countcongestionretry']+_0x2ed2a1[_0x5165('0x1f')]+_0x2ed2a1['countnosuchnumberretry']+_0x2ed2a1['countdropretry']+_0x2ed2a1[_0x5165('0x22')]+_0x2ed2a1[_0x5165('0x23')]+_0x2ed2a1[_0x5165('0x27')]<_0x59d3b5['entity'][_0x5165('0x24')])_0x2f0732=0x1;_0x3e3e55({'additional':_0x2f0732});}else{_0x3e3e55({'additional':0x0});}})[_0x5165('0x12')](function(_0x33954c){logger[_0x5165('0xe')](_0x5165('0x13'),_0x33954c[_0x5165('0x10')]);_0x367542(_0xf50857[_0x5165('0xe')](0x1f4,_0x33954c[_0x5165('0x10')]));});}})['catch'](function(_0x4b9a20){logger[_0x5165('0xe')]('VerifyAdditionalPhones',_0x4b9a20[_0x5165('0x10')]);_0x367542(_0xf50857[_0x5165('0xe')](0x1f4,_0x4b9a20[_0x5165('0x10')]));});}else _0x3e3e55({'additional':0x0});});});};exports[_0x5165('0x28')]=function(_0x21192a){var _0x197dc6=this;return new Promise(function(_0x414135,_0x4745ec){return db['CmHopper'][_0x5165('0x1b')]({'raw':!![],'where':{'ContactId':_0x21192a[_0x5165('0x15')]['ContactId'],'ListId':_0x21192a['body'][_0x5165('0x17')],'VoiceQueueId':_0x21192a[_0x5165('0x15')][_0x5165('0x18')]===undefined?null:_0x21192a[_0x5165('0x15')][_0x5165('0x18')],'CampaignId':_0x21192a[_0x5165('0x15')]['CampaignId']===undefined?null:_0x21192a[_0x5165('0x15')]['CampaignId']}})['then'](function(_0x1d52f5){if(_0x1d52f5!=null){return db[_0x5165('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d52f5['id'],'OrderBy':{'$gte':_0x1d52f5['OrderBy']}},'order':[[_0x5165('0x1c'),_0x5165('0x1d')]]})[_0x5165('0x1a')](function(_0x1a57de){if(_0x1a57de)return activateAdditionalPhone(_0x1d52f5,_0x21192a['body'],_0x1a57de,_0x21192a[_0x5165('0x29')],_0x21192a[_0x5165('0x2a')])[_0x5165('0x1a')](function(_0x217f4d){_0x414135(_0x217f4d);});else{return db[_0x5165('0x25')][_0x5165('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x1d52f5['id']},'order':[[_0x5165('0x1c'),_0x5165('0x1d')]]})['then'](function(_0x3ed7d4){if(_0x3ed7d4)return activateAdditionalPhone(_0x1d52f5,_0x21192a[_0x5165('0x15')],_0x3ed7d4,_0x21192a[_0x5165('0x29')],_0x21192a['waitTime'])[_0x5165('0x1a')](function(_0x1f01fe){_0x414135(_0x1f01fe);});else{_0x414135({'id':_0x1d52f5['id'],'phone':''});}})[_0x5165('0x12')](function(_0x292789){logger[_0x5165('0xe')](_0x5165('0x13'),_0x292789[_0x5165('0x10')]);_0x4745ec(_0x197dc6[_0x5165('0xe')](0x1f4,_0x292789[_0x5165('0x10')]));});}})[_0x5165('0x12')](function(_0x236241){logger['error'](_0x5165('0x13'),_0x236241[_0x5165('0x10')]);_0x4745ec(_0x197dc6['error'](0x1f4,_0x236241[_0x5165('0x10')]));});}else _0x414135(0x1);});});};function activateAdditionalPhone(_0x269ac5,_0x57e16b,_0x596e90,_0x37313e,_0x5729f8){return new Promise(function(_0x246f34,_0x5a046a){var _0x3e062f;if(_['isNil'](_0x596e90[_0x5165('0x2b')])){_0x596e90[_0x5165('0x2b')]=moment();}if(moment()>moment(_0x596e90[_0x5165('0x2b')])){_0x3e062f=moment()['add'](_0x5729f8||0x3,'minutes');}else{if(_0x596e90[_0x5165('0x1c')]==0x0){_0x3e062f=moment(_0x596e90[_0x5165('0x2b')]);}else{_0x3e062f=moment()['add'](_0x5729f8||0x3,_0x5165('0x2c'));}}if(_[_0x5165('0x2d')](_0x3e062f)){_0x3e062f=moment()[_0x5165('0x2e')](_0x5729f8||0x3,'minutes');}var _0x5c45b1={'phone':_0x269ac5[_0x5165('0x2f')],'active':0x0,'OrderBy':_[_0x5165('0x2d')](_0x269ac5[_0x5165('0x1c')])?0x0:_0x269ac5[_0x5165('0x1c')],'scheduledat':moment()[_0x5165('0x2e')](_0x37313e||0x1,'minutes'),'countbusyretry':_0x57e16b['countbusyretry'],'countcongestionretry':_0x57e16b[_0x5165('0x1e')],'countnoanswerretry':_0x57e16b[_0x5165('0x1f')],'countnosuchnumberretry':_0x57e16b['countnosuchnumberretry'],'countdropretry':_0x57e16b[_0x5165('0x21')],'countabandonedretry':_0x57e16b[_0x5165('0x22')],'countmachineretry':_0x57e16b[_0x5165('0x23')],'countagentrejectretry':_0x57e16b['countagentrejectretry'],'createdAt':_0x57e16b['createdAt'],'updatedAt':_0x57e16b['updatedAt']};var _0x581172={'CmHopperId':_0x269ac5['id'],'phone':_0x596e90[_0x5165('0x2f')],'active':0x0,'OrderBy':_[_0x5165('0x2d')](_0x596e90['OrderBy'])?0x0:_0x596e90[_0x5165('0x1c')],'scheduledat':_0x3e062f,'countbusyretry':_0x596e90['countbusyretry'],'countcongestionretry':_0x596e90[_0x5165('0x1e')],'countnoanswerretry':_0x596e90['countnoanswerretry'],'countnosuchnumberretry':_0x596e90[_0x5165('0x20')],'countdropretry':_0x596e90[_0x5165('0x21')],'countabandonedretry':_0x596e90[_0x5165('0x22')],'countmachineretry':_0x596e90['countmachineretry'],'countagentrejectretry':_0x596e90['countagentrejectretry'],'createdAt':_0x596e90[_0x5165('0x30')],'updatedAt':_0x596e90[_0x5165('0x31')]};return db[_0x5165('0x32')][_0x5165('0x33')](function(_0x458263){return db['CmHopperAdditionalPhone']['update'](_0x5c45b1,{'where':{'id':_0x596e90['id']}},{'transaction':_0x458263})[_0x5165('0x1a')](function(){return db['CmHopper'][_0x5165('0x34')](_0x581172,{'where':{'id':_0x269ac5['id']}},{'transaction':_0x458263});});})['then'](function(_0x2979c0){_0x246f34({'id':_0x269ac5['id'],'phone':_0x596e90['phone']});})[_0x5165('0x12')](function(_0x43f685){logger[_0x5165('0xe')](_0x5165('0x35'),_0x43f685['message']);_0x5a046a({'error':_0x43f685[_0x5165('0x10')]});});});}exports[_0x5165('0x36')]=function(_0x21edeb){var _0x481c11=this;return new Promise(function(_0x34b915,_0x3075c2){return db[_0x5165('0x14')][_0x5165('0x34')](_0x21edeb[_0x5165('0x15')][_0x5165('0x37')],{'where':{'id':_0x21edeb['body']['id']}})['then'](function(_0x3dae56){_0x34b915(_0x3dae56);})[_0x5165('0x12')](function(_0x2dbc7e){logger[_0x5165('0xe')]('IncrementPreviewCounters',_0x2dbc7e['message']);_0x3075c2(_0x481c11[_0x5165('0xe')](0x1f4,_0x2dbc7e['message']));});});}; \ No newline at end of file +var _0x73f1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','countabandonedretry','countmachineretry','CmHopper','ContactId','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters'];(function(_0x208c54,_0x120a70){var _0x4b0116=function(_0x32be34){while(--_0x32be34){_0x208c54['push'](_0x208c54['shift']());}};_0x4b0116(++_0x120a70);}(_0x73f1,0x74));var _0x173f=function(_0x54508f,_0x112b5a){_0x54508f=_0x54508f-0x0;var _0x3ddd0b=_0x73f1[_0x54508f];return _0x3ddd0b;};'use strict';var _=require(_0x173f('0x0'));var util=require(_0x173f('0x1'));var moment=require(_0x173f('0x2'));var BPromise=require(_0x173f('0x3'));var rs=require(_0x173f('0x4'));var fs=require('fs');var Redis=require(_0x173f('0x5'));var db=require(_0x173f('0x6'))['db'];var utils=require(_0x173f('0x7'));var logger=require(_0x173f('0x8'))(_0x173f('0x9'));var config=require(_0x173f('0xa'));var jayson=require(_0x173f('0xb'));var client=jayson[_0x173f('0xc')][_0x173f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c268a,_0x175ab9,_0x332c99){return new BPromise(function(_0x5e8e1b,_0x39f261){return client[_0x173f('0xe')](_0x4c268a,_0x332c99)[_0x173f('0xf')](function(_0x2b3f04){logger[_0x173f('0x10')](_0x173f('0x11'),_0x175ab9,_0x173f('0x12'));logger[_0x173f('0x13')](_0x173f('0x14'),_0x175ab9,'request\x20sent',JSON[_0x173f('0x15')](_0x2b3f04));if(_0x2b3f04[_0x173f('0x16')]){if(_0x2b3f04[_0x173f('0x16')]['code']===0x1f4){logger[_0x173f('0x16')](_0x173f('0x11'),_0x175ab9,_0x2b3f04[_0x173f('0x16')][_0x173f('0x17')]);return _0x39f261(_0x2b3f04[_0x173f('0x16')]['message']);}logger[_0x173f('0x16')](_0x173f('0x11'),_0x175ab9,_0x2b3f04[_0x173f('0x16')][_0x173f('0x17')]);return _0x5e8e1b(_0x2b3f04[_0x173f('0x16')][_0x173f('0x17')]);}else{logger[_0x173f('0x10')](_0x173f('0x11'),_0x175ab9,_0x173f('0x12'));_0x5e8e1b(_0x2b3f04['result']['message']);}})[_0x173f('0x18')](function(_0x116459){logger[_0x173f('0x16')](_0x173f('0x11'),_0x175ab9,_0x116459);_0x39f261(_0x116459);});});}exports[_0x173f('0x19')]=function(_0x189a97){var _0x34c480=this;return new Promise(function(_0x54547b,_0xe92d6d){return db['CmHopper'][_0x173f('0x1a')]({'raw':!![],'where':{'ContactId':_0x189a97['body']['ContactId'],'ListId':_0x189a97[_0x173f('0x1b')][_0x173f('0x1c')],'VoiceQueueId':_0x189a97[_0x173f('0x1b')][_0x173f('0x1d')]===undefined?null:_0x189a97[_0x173f('0x1b')][_0x173f('0x1d')],'CampaignId':_0x189a97[_0x173f('0x1b')][_0x173f('0x1e')]===undefined?null:_0x189a97[_0x173f('0x1b')][_0x173f('0x1e')]}})['then'](function(_0x38311f){if(_0x38311f!=null){return db[_0x173f('0x1f')][_0x173f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x38311f['id'],'OrderBy':{'$gt':_0x38311f[_0x173f('0x20')]}},'order':[['OrderBy',_0x173f('0x21')]]})['then'](function(_0x452831){var _0x27b8a7=0x0;if(_0x452831){if(_0x452831[_0x173f('0x22')]+_0x452831[_0x173f('0x23')]+_0x452831[_0x173f('0x24')]+_0x452831[_0x173f('0x25')]+_0x452831[_0x173f('0x26')]+_0x452831['countabandonedretry']+_0x452831['countmachineretry']+_0x452831[_0x173f('0x27')]<_0x189a97[_0x173f('0x28')][_0x173f('0x29')])_0x27b8a7=0x1;_0x54547b({'additional':_0x27b8a7});}else{return db[_0x173f('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38311f['id']},'order':[[_0x173f('0x20'),'ASC']]})[_0x173f('0xf')](function(_0x815d88){var _0x43a882=0x0;if(_0x815d88){if(_0x815d88[_0x173f('0x22')]+_0x815d88['countcongestionretry']+_0x815d88[_0x173f('0x24')]+_0x815d88['countnosuchnumberretry']+_0x815d88['countdropretry']+_0x815d88[_0x173f('0x2a')]+_0x815d88[_0x173f('0x2b')]+_0x815d88[_0x173f('0x27')]<_0x189a97[_0x173f('0x28')][_0x173f('0x29')])_0x43a882=0x1;_0x54547b({'additional':_0x43a882});}else{_0x54547b({'additional':0x0});}})[_0x173f('0x18')](function(_0x1a3032){logger[_0x173f('0x16')](_0x173f('0x19'),_0x1a3032[_0x173f('0x17')]);_0xe92d6d(_0x34c480[_0x173f('0x16')](0x1f4,_0x1a3032[_0x173f('0x17')]));});}})['catch'](function(_0x2e1c86){logger[_0x173f('0x16')](_0x173f('0x19'),_0x2e1c86[_0x173f('0x17')]);_0xe92d6d(_0x34c480[_0x173f('0x16')](0x1f4,_0x2e1c86[_0x173f('0x17')]));});}else _0x54547b({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1e0655){var _0x15ad27=this;return new Promise(function(_0x339140,_0x4fb30d){return db[_0x173f('0x2c')][_0x173f('0x1a')]({'raw':!![],'where':{'ContactId':_0x1e0655[_0x173f('0x1b')][_0x173f('0x2d')],'ListId':_0x1e0655[_0x173f('0x1b')]['ListId'],'VoiceQueueId':_0x1e0655['body']['VoiceQueueId']===undefined?null:_0x1e0655[_0x173f('0x1b')][_0x173f('0x1d')],'CampaignId':_0x1e0655[_0x173f('0x1b')][_0x173f('0x1e')]===undefined?null:_0x1e0655[_0x173f('0x1b')][_0x173f('0x1e')]}})['then'](function(_0x192302){if(_0x192302!=null){return db[_0x173f('0x1f')][_0x173f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x192302['id'],'OrderBy':{'$gte':_0x192302[_0x173f('0x20')]}},'order':[['OrderBy',_0x173f('0x21')]]})['then'](function(_0x12144f){if(_0x12144f)return activateAdditionalPhone(_0x192302,_0x1e0655['body'],_0x12144f,_0x1e0655[_0x173f('0x2e')],_0x1e0655['waitTime'])[_0x173f('0xf')](function(_0x5a065d){_0x339140(_0x5a065d);});else{return db[_0x173f('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x192302['id']},'order':[[_0x173f('0x20'),_0x173f('0x21')]]})['then'](function(_0x29fdc6){if(_0x29fdc6)return activateAdditionalPhone(_0x192302,_0x1e0655[_0x173f('0x1b')],_0x29fdc6,_0x1e0655['duration'],_0x1e0655[_0x173f('0x2f')])[_0x173f('0xf')](function(_0x17755c){_0x339140(_0x17755c);});else{_0x339140({'id':_0x192302['id'],'phone':''});}})[_0x173f('0x18')](function(_0x3ce568){logger['error'](_0x173f('0x19'),_0x3ce568[_0x173f('0x17')]);_0x4fb30d(_0x15ad27[_0x173f('0x16')](0x1f4,_0x3ce568[_0x173f('0x17')]));});}})['catch'](function(_0x5b403e){logger[_0x173f('0x16')]('VerifyAdditionalPhones',_0x5b403e['message']);_0x4fb30d(_0x15ad27[_0x173f('0x16')](0x1f4,_0x5b403e[_0x173f('0x17')]));});}else _0x339140(0x1);});});};function activateAdditionalPhone(_0x5b0b0b,_0x24af6b,_0x5273a1,_0x5a2bb3,_0x20d4d9){return new Promise(function(_0x5b10b8,_0x200f2e){var _0x9caaa1;if(_['isNil'](_0x5273a1['scheduledat'])){_0x5273a1[_0x173f('0x30')]=moment();}if(moment()>moment(_0x5273a1[_0x173f('0x30')])){_0x9caaa1=moment()[_0x173f('0x31')](_0x20d4d9||0x3,_0x173f('0x32'));}else{if(_0x5273a1[_0x173f('0x20')]==0x0){_0x9caaa1=moment(_0x5273a1['scheduledat']);}else{_0x9caaa1=moment()['add'](_0x20d4d9||0x3,_0x173f('0x32'));}}if(_['isNil'](_0x9caaa1)){_0x9caaa1=moment()[_0x173f('0x31')](_0x20d4d9||0x3,'minutes');}var _0x28b47b={'phone':_0x5b0b0b[_0x173f('0x33')],'active':0x0,'OrderBy':_[_0x173f('0x34')](_0x5b0b0b[_0x173f('0x20')])?0x0:_0x5b0b0b[_0x173f('0x20')],'scheduledat':moment()[_0x173f('0x31')](_0x5a2bb3||0x1,'minutes'),'countbusyretry':_0x24af6b['countbusyretry'],'countcongestionretry':_0x24af6b[_0x173f('0x23')],'countnoanswerretry':_0x24af6b['countnoanswerretry'],'countnosuchnumberretry':_0x24af6b['countnosuchnumberretry'],'countdropretry':_0x24af6b[_0x173f('0x26')],'countabandonedretry':_0x24af6b[_0x173f('0x2a')],'countmachineretry':_0x24af6b[_0x173f('0x2b')],'countagentrejectretry':_0x24af6b['countagentrejectretry'],'createdAt':_0x24af6b[_0x173f('0x35')],'updatedAt':_0x24af6b[_0x173f('0x36')]};var _0x7be251={'CmHopperId':_0x5b0b0b['id'],'phone':_0x5273a1[_0x173f('0x33')],'active':0x0,'OrderBy':_[_0x173f('0x34')](_0x5273a1[_0x173f('0x20')])?0x0:_0x5273a1[_0x173f('0x20')],'scheduledat':_0x9caaa1,'countbusyretry':_0x5273a1[_0x173f('0x22')],'countcongestionretry':_0x5273a1[_0x173f('0x23')],'countnoanswerretry':_0x5273a1[_0x173f('0x24')],'countnosuchnumberretry':_0x5273a1['countnosuchnumberretry'],'countdropretry':_0x5273a1[_0x173f('0x26')],'countabandonedretry':_0x5273a1[_0x173f('0x2a')],'countmachineretry':_0x5273a1['countmachineretry'],'countagentrejectretry':_0x5273a1['countagentrejectretry'],'createdAt':_0x5273a1['createdAt'],'updatedAt':_0x5273a1[_0x173f('0x36')]};return db['sequelize']['transaction'](function(_0x4b79a3){return db[_0x173f('0x1f')][_0x173f('0x37')](_0x28b47b,{'where':{'id':_0x5273a1['id']}},{'transaction':_0x4b79a3})[_0x173f('0xf')](function(){return db[_0x173f('0x2c')]['update'](_0x7be251,{'where':{'id':_0x5b0b0b['id']}},{'transaction':_0x4b79a3});});})[_0x173f('0xf')](function(_0x568b66){_0x5b10b8({'id':_0x5b0b0b['id'],'phone':_0x5273a1[_0x173f('0x33')]});})[_0x173f('0x18')](function(_0x238a15){logger['error'](_0x173f('0x38'),_0x238a15[_0x173f('0x17')]);_0x200f2e({'error':_0x238a15['message']});});});}exports[_0x173f('0x39')]=function(_0x23a347){var _0x2001e5=this;return new Promise(function(_0x27c7a1,_0x12e62f){return db[_0x173f('0x2c')][_0x173f('0x37')](_0x23a347[_0x173f('0x1b')]['field'],{'where':{'id':_0x23a347[_0x173f('0x1b')]['id']}})['then'](function(_0x660ae5){_0x27c7a1(_0x660ae5);})['catch'](function(_0x542e38){logger['error'](_0x173f('0x39'),_0x542e38[_0x173f('0x17')]);_0x12e62f(_0x2001e5[_0x173f('0x16')](0x1f4,_0x542e38[_0x173f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7b9b1b9..60b5070 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','show','isAuthenticated','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xad));var _0xedac=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xdace[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xedac('0x0'));var util=require(_0xedac('0x1'));var path=require(_0xedac('0x2'));var timeout=require(_0xedac('0x3'));var express=require(_0xedac('0x4'));var router=express[_0xedac('0x5')]();var fs_extra=require(_0xedac('0x6'));var auth=require(_0xedac('0x7'));var interaction=require(_0xedac('0x8'));var config=require(_0xedac('0x9'));var controller=require(_0xedac('0xa'));router[_0xedac('0xb')]('/',auth['isAuthenticated'](),controller[_0xedac('0xc')]);router[_0xedac('0xb')](_0xedac('0xd'),auth['isAuthenticated'](),controller[_0xedac('0xe')]);router['post']('/',auth[_0xedac('0xf')](),controller['create']);router[_0xedac('0x10')](_0xedac('0xd'),auth['isAuthenticated'](),controller[_0xedac('0x11')]);router['delete'](_0xedac('0xd'),auth[_0xedac('0xf')](),controller[_0xedac('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcc65=['isAuthenticated','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','show','post'];(function(_0x1df530,_0x7b2772){var _0x2cc8d8=function(_0x1e3650){while(--_0x1e3650){_0x1df530['push'](_0x1df530['shift']());}};_0x2cc8d8(++_0x7b2772);}(_0xcc65,0x71));var _0x5cc6=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xcc65[_0x21b359];return _0x57b8e7;};'use strict';var multer=require(_0x5cc6('0x0'));var util=require('util');var path=require(_0x5cc6('0x1'));var timeout=require(_0x5cc6('0x2'));var express=require(_0x5cc6('0x3'));var router=express[_0x5cc6('0x4')]();var fs_extra=require(_0x5cc6('0x5'));var auth=require(_0x5cc6('0x6'));var interaction=require(_0x5cc6('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5cc6('0x8')]);router[_0x5cc6('0x9')](_0x5cc6('0xa'),auth['isAuthenticated'](),controller[_0x5cc6('0xb')]);router[_0x5cc6('0xc')]('/',auth[_0x5cc6('0xd')](),controller['create']);router[_0x5cc6('0xe')]('/:id',auth[_0x5cc6('0xd')](),controller[_0x5cc6('0xf')]);router[_0x5cc6('0x10')]('/:id',auth[_0x5cc6('0xd')](),controller['destroy']);module[_0x5cc6('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b54f1ba..f04e223 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 _0x0e50=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0e50,0x168));var _0x00e5=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x0e50[_0x599f41];return _0x2e4d58;};'use strict';var moment=require(_0x00e5('0x0'));var Sequelize=require(_0x00e5('0x1'));module[_0x00e5('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x00e5('0x3')],'unique':_0x00e5('0x4')},'ListId':{'type':Sequelize[_0x00e5('0x3')],'unique':_0x00e5('0x4')},'VoiceQueueId':{'type':Sequelize[_0x00e5('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xfc17=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x198e88,_0x1e4ebf){_0x198e88=_0x198e88-0x0;var _0x3ed988=_0xfc17[_0x198e88];return _0x3ed988;};'use strict';var moment=require(_0x7fc1('0x0'));var Sequelize=require(_0x7fc1('0x1'));module[_0x7fc1('0x2')]={'phone':{'type':Sequelize[_0x7fc1('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7fc1('0x4')},'ListId':{'type':Sequelize[_0x7fc1('0x5')],'unique':_0x7fc1('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7fc1('0x5')],'unique':_0x7fc1('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f7041df..3bebe3d 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 _0x4716=['api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','sendStatus','stack','name','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3a4b59,_0x10a215){var _0x410bb4=function(_0x43b012){while(--_0x43b012){_0x3a4b59['push'](_0x3a4b59['shift']());}};_0x410bb4(++_0x10a215);}(_0x4716,0x19b));var _0x6471=function(_0x4505cb,_0x135d7d){_0x4505cb=_0x4505cb-0x0;var _0x188f78=_0x4716[_0x4505cb];return _0x188f78;};'use strict';var emlformat=require(_0x6471('0x0'));var rimraf=require(_0x6471('0x1'));var zipdir=require(_0x6471('0x2'));var jsonpatch=require(_0x6471('0x3'));var rp=require(_0x6471('0x4'));var moment=require(_0x6471('0x5'));var BPromise=require(_0x6471('0x6'));var Mustache=require(_0x6471('0x7'));var util=require(_0x6471('0x8'));var path=require(_0x6471('0x9'));var sox=require(_0x6471('0xa'));var csv=require('to-csv');var ejs=require(_0x6471('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6471('0xc'));var jsforce=require(_0x6471('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6471('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6471('0xf'));var authService=require(_0x6471('0x10'));var qs=require(_0x6471('0x11'));var as=require(_0x6471('0x12'));var hardwareService=require(_0x6471('0x13'));var logger=require(_0x6471('0x14'))(_0x6471('0x15'));var utils=require(_0x6471('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6471('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d1229,_0x4c5093){_0x4c5093=_0x4c5093||0xcc;return function(_0x5f3d71){if(_0x5f3d71){return _0x2d1229['sendStatus'](_0x4c5093);}return _0x2d1229[_0x6471('0x18')](_0x4c5093)[_0x6471('0x19')]();};}function respondWithResult(_0x580978,_0x9e8c98){_0x9e8c98=_0x9e8c98||0xc8;return function(_0x1fb7eb){if(_0x1fb7eb){return _0x580978[_0x6471('0x18')](_0x9e8c98)[_0x6471('0x1a')](_0x1fb7eb);}};}function respondWithFilteredResult(_0x3af573,_0x5c701f){return function(_0x2bcf86){if(_0x2bcf86){var _0x278077=typeof _0x5c701f[_0x6471('0x1b')]===_0x6471('0x1c')&&typeof _0x5c701f['limit']===_0x6471('0x1c');var _0x4b4ed9=_0x2bcf86[_0x6471('0x1d')];var _0x18f3ea=_0x278077?0x0:_0x5c701f[_0x6471('0x1b')];var _0x1b28bd=_0x278077?_0x2bcf86[_0x6471('0x1d')]:_0x5c701f['offset']+_0x5c701f[_0x6471('0x1e')];var _0x1c9fc1;if(_0x1b28bd>=_0x4b4ed9){_0x1b28bd=_0x4b4ed9;_0x1c9fc1=0xc8;}else{_0x1c9fc1=0xce;}_0x3af573[_0x6471('0x18')](_0x1c9fc1);return _0x3af573[_0x6471('0x1f')]('Content-Range',_0x18f3ea+'-'+_0x1b28bd+'/'+_0x4b4ed9)['json'](_0x2bcf86);}return null;};}function patchUpdates(_0x3c6deb){return function(_0xea7f7){try{jsonpatch[_0x6471('0x20')](_0xea7f7,_0x3c6deb,!![]);}catch(_0x2b2720){return BPromise['reject'](_0x2b2720);}return _0xea7f7['save']();};}function saveUpdates(_0x476395,_0x489f3c){return function(_0x1837e6){if(_0x1837e6){return _0x1837e6[_0x6471('0x21')](_0x476395)[_0x6471('0x22')](function(_0x491c7c){return _0x491c7c;});}return null;};}function removeEntity(_0x46ea4f,_0x3fe6d){return function(_0x2fd19a){if(_0x2fd19a){return _0x2fd19a[_0x6471('0x23')]()[_0x6471('0x22')](function(){_0x46ea4f[_0x6471('0x18')](0xcc)[_0x6471('0x19')]();});}};}function handleEntityNotFound(_0x18253f,_0x465d0a){return function(_0x2eb4b0){if(!_0x2eb4b0){_0x18253f[_0x6471('0x24')](0x194);}return _0x2eb4b0;};}function handleError(_0x62abe4,_0x2a9be4){_0x2a9be4=_0x2a9be4||0x1f4;return function(_0x495b16){logger['error'](_0x495b16[_0x6471('0x25')]);if(_0x495b16[_0x6471('0x26')]){delete _0x495b16['name'];}_0x62abe4[_0x6471('0x18')](_0x2a9be4)['send'](_0x495b16);};}exports['index']=function(_0x33907b,_0x2547ed){var _0x47d6af={},_0x5ed776={},_0x3be61a={'count':0x0,'rows':[]};var _0xd20886=_[_0x6471('0x27')](db[_0x6471('0x28')]['rawAttributes'],function(_0x3d92af){return{'name':_0x3d92af[_0x6471('0x29')],'type':_0x3d92af[_0x6471('0x2a')][_0x6471('0x2b')]};});_0x5ed776[_0x6471('0x2c')]=_[_0x6471('0x27')](_0xd20886,_0x6471('0x26'));_0x5ed776[_0x6471('0x2d')]=_[_0x6471('0x2e')](_0x33907b['query']);_0x5ed776[_0x6471('0x2f')]=_['intersection'](_0x5ed776['model'],_0x5ed776[_0x6471('0x2d')]);_0x47d6af[_0x6471('0x30')]=_[_0x6471('0x31')](_0x5ed776[_0x6471('0x2c')],qs[_0x6471('0x32')](_0x33907b[_0x6471('0x2d')][_0x6471('0x32')]));_0x47d6af[_0x6471('0x30')]=_0x47d6af[_0x6471('0x30')][_0x6471('0x33')]?_0x47d6af[_0x6471('0x30')]:_0x5ed776[_0x6471('0x2c')];if(!_0x33907b[_0x6471('0x2d')][_0x6471('0x34')](_0x6471('0x35'))){_0x47d6af[_0x6471('0x1e')]=qs[_0x6471('0x1e')](_0x33907b['query']['limit']);_0x47d6af[_0x6471('0x1b')]=qs[_0x6471('0x1b')](_0x33907b[_0x6471('0x2d')]['offset']);}_0x47d6af[_0x6471('0x36')]=qs['sort'](_0x33907b[_0x6471('0x2d')][_0x6471('0x37')]);_0x47d6af['where']=qs[_0x6471('0x2f')](_[_0x6471('0x38')](_0x33907b[_0x6471('0x2d')],_0x5ed776['filters']),_0xd20886);if(_0x33907b['query']['filter']){_0x47d6af[_0x6471('0x39')]=_[_0x6471('0x3a')](_0x47d6af[_0x6471('0x39')],{'$or':_[_0x6471('0x27')](_0xd20886,function(_0x4853f7){if(_0x4853f7['type']!==_0x6471('0x3b')){var _0x2f4c74={};_0x2f4c74[_0x4853f7['name']]={'$like':'%'+_0x33907b[_0x6471('0x2d')][_0x6471('0x3c')]+'%'};return _0x2f4c74;}})});}_0x47d6af=_[_0x6471('0x3a')]({},_0x47d6af,_0x33907b[_0x6471('0x3d')]);var _0x398d08={'where':_0x47d6af[_0x6471('0x39')]};return db[_0x6471('0x28')][_0x6471('0x1d')](_0x398d08)['then'](function(_0x187cd2){_0x3be61a[_0x6471('0x1d')]=_0x187cd2;if(_0x33907b[_0x6471('0x2d')][_0x6471('0x3e')]){_0x47d6af[_0x6471('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6471('0x40')](_0x47d6af);})['then'](function(_0x3a595a){_0x3be61a[_0x6471('0x41')]=_0x3a595a;return _0x3be61a;})[_0x6471('0x22')](respondWithFilteredResult(_0x2547ed,_0x47d6af))[_0x6471('0x42')](handleError(_0x2547ed,null));};exports['show']=function(_0x588e5a,_0x11b4db){var _0x4653ec={'raw':!![],'where':{'id':_0x588e5a[_0x6471('0x43')]['id']}},_0x286edf={};_0x286edf[_0x6471('0x2c')]=_[_0x6471('0x2e')](db[_0x6471('0x28')][_0x6471('0x44')]);_0x286edf['query']=_[_0x6471('0x2e')](_0x588e5a['query']);_0x286edf[_0x6471('0x2f')]=_[_0x6471('0x31')](_0x286edf[_0x6471('0x2c')],_0x286edf['query']);_0x4653ec[_0x6471('0x30')]=_[_0x6471('0x31')](_0x286edf['model'],qs[_0x6471('0x32')](_0x588e5a[_0x6471('0x2d')][_0x6471('0x32')]));_0x4653ec[_0x6471('0x30')]=_0x4653ec[_0x6471('0x30')][_0x6471('0x33')]?_0x4653ec[_0x6471('0x30')]:_0x286edf[_0x6471('0x2c')];if(_0x588e5a[_0x6471('0x2d')][_0x6471('0x3e')]){_0x4653ec[_0x6471('0x3f')]=[{'all':!![]}];}_0x4653ec=_['merge']({},_0x4653ec,_0x588e5a[_0x6471('0x3d')]);return db[_0x6471('0x28')][_0x6471('0x45')](_0x4653ec)['then'](handleEntityNotFound(_0x11b4db,null))['then'](respondWithResult(_0x11b4db,null))[_0x6471('0x42')](handleError(_0x11b4db,null));};exports[_0x6471('0x21')]=function(_0x2bc00a,_0x1be652){if(_0x2bc00a['body']['id']){delete _0x2bc00a[_0x6471('0x46')]['id'];}return db[_0x6471('0x28')]['find']({'where':{'id':_0x2bc00a[_0x6471('0x43')]['id']}})[_0x6471('0x22')](handleEntityNotFound(_0x1be652,null))[_0x6471('0x22')](saveUpdates(_0x2bc00a[_0x6471('0x46')],null))[_0x6471('0x22')](respondWithResult(_0x1be652,null))[_0x6471('0x42')](handleError(_0x1be652,null));};exports[_0x6471('0x23')]=function(_0x4b84b4,_0x241926){return db[_0x6471('0x28')][_0x6471('0x45')]({'where':{'id':_0x4b84b4[_0x6471('0x43')]['id']}})[_0x6471('0x22')](handleEntityNotFound(_0x241926,null))[_0x6471('0x22')](removeEntity(_0x241926,null))['catch'](handleError(_0x241926,null));};exports[_0x6471('0x47')]=function(_0x250206,_0x3bdd8c){return db[_0x6471('0x28')][_0x6471('0x47')]()[_0x6471('0x22')](respondWithResult(_0x3bdd8c,null))[_0x6471('0x42')](handleError(_0x3bdd8c,null));}; \ No newline at end of file +var _0x056d=['stack','name','send','index','CmHopperBlack','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x056d,0xa6));var _0xd056=function(_0x23ace9,_0x2d4ed2){_0x23ace9=_0x23ace9-0x0;var _0x40a4fe=_0x056d[_0x23ace9];return _0x40a4fe;};'use strict';var emlformat=require(_0xd056('0x0'));var rimraf=require(_0xd056('0x1'));var zipdir=require(_0xd056('0x2'));var jsonpatch=require(_0xd056('0x3'));var rp=require(_0xd056('0x4'));var moment=require(_0xd056('0x5'));var BPromise=require(_0xd056('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd056('0x7'));var sox=require(_0xd056('0x8'));var csv=require(_0xd056('0x9'));var ejs=require(_0xd056('0xa'));var fs=require('fs');var fs_extra=require(_0xd056('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd056('0xc'));var jsforce=require(_0xd056('0xd'));var deskjs=require(_0xd056('0xe'));var toCsv=require(_0xd056('0x9'));var querystring=require(_0xd056('0xf'));var Papa=require('papaparse');var Redis=require(_0xd056('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd056('0x11'));var hardwareService=require(_0xd056('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd056('0x13'))['db'];function respondWithStatusCode(_0x3ff91f,_0x3ba811){_0x3ba811=_0x3ba811||0xcc;return function(_0xcb80ac){if(_0xcb80ac){return _0x3ff91f[_0xd056('0x14')](_0x3ba811);}return _0x3ff91f[_0xd056('0x15')](_0x3ba811)[_0xd056('0x16')]();};}function respondWithResult(_0x39b7d9,_0x44260e){_0x44260e=_0x44260e||0xc8;return function(_0x3e2f09){if(_0x3e2f09){return _0x39b7d9[_0xd056('0x15')](_0x44260e)[_0xd056('0x17')](_0x3e2f09);}};}function respondWithFilteredResult(_0x171bf7,_0x3d5ac2){return function(_0x30ff0e){if(_0x30ff0e){var _0x3f6bdf=typeof _0x3d5ac2[_0xd056('0x18')]===_0xd056('0x19')&&typeof _0x3d5ac2[_0xd056('0x1a')]===_0xd056('0x19');var _0x5b7430=_0x30ff0e['count'];var _0x291ad2=_0x3f6bdf?0x0:_0x3d5ac2[_0xd056('0x18')];var _0x4d187e=_0x3f6bdf?_0x30ff0e[_0xd056('0x1b')]:_0x3d5ac2[_0xd056('0x18')]+_0x3d5ac2['limit'];var _0x1ed921;if(_0x4d187e>=_0x5b7430){_0x4d187e=_0x5b7430;_0x1ed921=0xc8;}else{_0x1ed921=0xce;}_0x171bf7[_0xd056('0x15')](_0x1ed921);return _0x171bf7[_0xd056('0x1c')](_0xd056('0x1d'),_0x291ad2+'-'+_0x4d187e+'/'+_0x5b7430)[_0xd056('0x17')](_0x30ff0e);}return null;};}function patchUpdates(_0x135a8c){return function(_0x21107a){try{jsonpatch['apply'](_0x21107a,_0x135a8c,!![]);}catch(_0xd3a2f1){return BPromise['reject'](_0xd3a2f1);}return _0x21107a[_0xd056('0x1e')]();};}function saveUpdates(_0x8958f6,_0x370085){return function(_0x4406ea){if(_0x4406ea){return _0x4406ea[_0xd056('0x1f')](_0x8958f6)[_0xd056('0x20')](function(_0x944c0b){return _0x944c0b;});}return null;};}function removeEntity(_0x2fa0b5,_0x3b2f9f){return function(_0x5b8a3b){if(_0x5b8a3b){return _0x5b8a3b[_0xd056('0x21')]()[_0xd056('0x20')](function(){_0x2fa0b5[_0xd056('0x15')](0xcc)[_0xd056('0x16')]();});}};}function handleEntityNotFound(_0x44da3d,_0x3c1f1e){return function(_0x4c4bc3){if(!_0x4c4bc3){_0x44da3d[_0xd056('0x14')](0x194);}return _0x4c4bc3;};}function handleError(_0x3f3bc5,_0x56d78f){_0x56d78f=_0x56d78f||0x1f4;return function(_0x189512){logger[_0xd056('0x22')](_0x189512[_0xd056('0x23')]);if(_0x189512[_0xd056('0x24')]){delete _0x189512[_0xd056('0x24')];}_0x3f3bc5['status'](_0x56d78f)[_0xd056('0x25')](_0x189512);};}exports[_0xd056('0x26')]=function(_0x225376,_0x13a4ab){var _0x420cf5={},_0x440bae={},_0x50bf3c={'count':0x0,'rows':[]};var _0x14c18a=_['map'](db[_0xd056('0x27')][_0xd056('0x28')],function(_0x35b885){return{'name':_0x35b885['fieldName'],'type':_0x35b885[_0xd056('0x29')][_0xd056('0x2a')]};});_0x440bae['model']=_[_0xd056('0x2b')](_0x14c18a,_0xd056('0x24'));_0x440bae[_0xd056('0x2c')]=_[_0xd056('0x2d')](_0x225376[_0xd056('0x2c')]);_0x440bae[_0xd056('0x2e')]=_[_0xd056('0x2f')](_0x440bae['model'],_0x440bae['query']);_0x420cf5[_0xd056('0x30')]=_[_0xd056('0x2f')](_0x440bae[_0xd056('0x31')],qs['fields'](_0x225376['query'][_0xd056('0x32')]));_0x420cf5[_0xd056('0x30')]=_0x420cf5[_0xd056('0x30')][_0xd056('0x33')]?_0x420cf5[_0xd056('0x30')]:_0x440bae[_0xd056('0x31')];if(!_0x225376[_0xd056('0x2c')][_0xd056('0x34')]('nolimit')){_0x420cf5[_0xd056('0x1a')]=qs['limit'](_0x225376[_0xd056('0x2c')][_0xd056('0x1a')]);_0x420cf5[_0xd056('0x18')]=qs[_0xd056('0x18')](_0x225376['query'][_0xd056('0x18')]);}_0x420cf5[_0xd056('0x35')]=qs['sort'](_0x225376[_0xd056('0x2c')]['sort']);_0x420cf5[_0xd056('0x36')]=qs[_0xd056('0x2e')](_[_0xd056('0x37')](_0x225376[_0xd056('0x2c')],_0x440bae['filters']),_0x14c18a);if(_0x225376[_0xd056('0x2c')][_0xd056('0x38')]){_0x420cf5[_0xd056('0x36')]=_[_0xd056('0x39')](_0x420cf5[_0xd056('0x36')],{'$or':_[_0xd056('0x2b')](_0x14c18a,function(_0x5c54ef){if(_0x5c54ef[_0xd056('0x29')]!==_0xd056('0x3a')){var _0x4427b5={};_0x4427b5[_0x5c54ef[_0xd056('0x24')]]={'$like':'%'+_0x225376['query'][_0xd056('0x38')]+'%'};return _0x4427b5;}})});}_0x420cf5=_[_0xd056('0x39')]({},_0x420cf5,_0x225376[_0xd056('0x3b')]);var _0x4026da={'where':_0x420cf5['where']};return db[_0xd056('0x27')][_0xd056('0x1b')](_0x4026da)[_0xd056('0x20')](function(_0x5e0d59){_0x50bf3c[_0xd056('0x1b')]=_0x5e0d59;if(_0x225376[_0xd056('0x2c')]['includeAll']){_0x420cf5[_0xd056('0x3c')]=[{'all':!![]}];}return db[_0xd056('0x27')][_0xd056('0x3d')](_0x420cf5);})[_0xd056('0x20')](function(_0x2426e5){_0x50bf3c['rows']=_0x2426e5;return _0x50bf3c;})['then'](respondWithFilteredResult(_0x13a4ab,_0x420cf5))[_0xd056('0x3e')](handleError(_0x13a4ab,null));};exports['show']=function(_0x2fc7d9,_0x4a77e7){var _0x162b23={'raw':!![],'where':{'id':_0x2fc7d9[_0xd056('0x3f')]['id']}},_0x86c248={};_0x86c248[_0xd056('0x31')]=_[_0xd056('0x2d')](db[_0xd056('0x27')][_0xd056('0x28')]);_0x86c248[_0xd056('0x2c')]=_[_0xd056('0x2d')](_0x2fc7d9['query']);_0x86c248[_0xd056('0x2e')]=_['intersection'](_0x86c248[_0xd056('0x31')],_0x86c248['query']);_0x162b23[_0xd056('0x30')]=_[_0xd056('0x2f')](_0x86c248[_0xd056('0x31')],qs[_0xd056('0x32')](_0x2fc7d9[_0xd056('0x2c')][_0xd056('0x32')]));_0x162b23['attributes']=_0x162b23['attributes']['length']?_0x162b23['attributes']:_0x86c248[_0xd056('0x31')];if(_0x2fc7d9[_0xd056('0x2c')]['includeAll']){_0x162b23[_0xd056('0x3c')]=[{'all':!![]}];}_0x162b23=_[_0xd056('0x39')]({},_0x162b23,_0x2fc7d9['options']);return db['CmHopperBlack'][_0xd056('0x40')](_0x162b23)[_0xd056('0x20')](handleEntityNotFound(_0x4a77e7,null))[_0xd056('0x20')](respondWithResult(_0x4a77e7,null))[_0xd056('0x3e')](handleError(_0x4a77e7,null));};exports[_0xd056('0x1f')]=function(_0x2f82b4,_0x15cd2f){if(_0x2f82b4['body']['id']){delete _0x2f82b4[_0xd056('0x41')]['id'];}return db[_0xd056('0x27')][_0xd056('0x40')]({'where':{'id':_0x2f82b4['params']['id']}})['then'](handleEntityNotFound(_0x15cd2f,null))[_0xd056('0x20')](saveUpdates(_0x2f82b4['body'],null))[_0xd056('0x20')](respondWithResult(_0x15cd2f,null))['catch'](handleError(_0x15cd2f,null));};exports[_0xd056('0x21')]=function(_0x1c39a0,_0x5009fd){return db[_0xd056('0x27')][_0xd056('0x40')]({'where':{'id':_0x1c39a0[_0xd056('0x3f')]['id']}})[_0xd056('0x20')](handleEntityNotFound(_0x5009fd,null))['then'](removeEntity(_0x5009fd,null))[_0xd056('0x3e')](handleError(_0x5009fd,null));};exports[_0xd056('0x42')]=function(_0x1bfa32,_0x41582b){return db[_0xd056('0x27')][_0xd056('0x42')]()[_0xd056('0x20')](respondWithResult(_0x41582b,null))[_0xd056('0x3e')](handleError(_0x41582b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 02e0f5c..b5d4ef5 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 _0x985b=['cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x4796b7,_0x35bd4c){var _0x2e879a=function(_0x223b65){while(--_0x223b65){_0x4796b7['push'](_0x4796b7['shift']());}};_0x2e879a(++_0x35bd4c);}(_0x985b,0x10f));var _0xb985=function(_0x196809,_0x335bbd){_0x196809=_0x196809-0x0;var _0x59a3d1=_0x985b[_0x196809];return _0x59a3d1;};'use strict';var _=require(_0xb985('0x0'));var util=require(_0xb985('0x1'));var logger=require(_0xb985('0x2'))(_0xb985('0x3'));var moment=require(_0xb985('0x4'));var BPromise=require(_0xb985('0x5'));var rp=require(_0xb985('0x6'));var fs=require('fs');var path=require(_0xb985('0x7'));var rimraf=require(_0xb985('0x8'));var config=require(_0xb985('0x9'));var attributes=require(_0xb985('0xa'));module[_0xb985('0xb')]=function(_0x3a34b8,_0x27d89f){return _0x3a34b8[_0xb985('0xc')](_0xb985('0xd'),attributes,{'tableName':_0xb985('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca9=['util','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xeca9,0x103));var _0x9eca=function(_0x349aff,_0x4d6bcc){_0x349aff=_0x349aff-0x0;var _0x1b6bb6=_0xeca9[_0x349aff];return _0x1b6bb6;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require(_0x9eca('0x2'))(_0x9eca('0x3'));var moment=require(_0x9eca('0x4'));var BPromise=require(_0x9eca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eca('0x6'));var rimraf=require(_0x9eca('0x7'));var config=require('../../config/environment');var attributes=require(_0x9eca('0x8'));module[_0x9eca('0x9')]=function(_0x13138b,_0x4c61eb){return _0x13138b[_0x9eca('0xa')](_0x9eca('0xb'),attributes,{'tableName':_0x9eca('0xc'),'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 8393abc..e5ec115 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 _0x58a5=['where','limit','include','map','model','attributes','UpdateCmHopperBlack','body','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x4334c1,_0xef64f4){var _0x35fcda=function(_0x26c061){while(--_0x26c061){_0x4334c1['push'](_0x4334c1['shift']());}};_0x35fcda(++_0xef64f4);}(_0x58a5,0x129));var _0x558a=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x58a5[_0x403cff];return _0x5a7c56;};'use strict';var _=require(_0x558a('0x0'));var util=require('util');var moment=require(_0x558a('0x1'));var BPromise=require(_0x558a('0x2'));var rs=require(_0x558a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x558a('0x4'))['db'];var utils=require(_0x558a('0x5'));var logger=require(_0x558a('0x6'))('rpc');var config=require(_0x558a('0x7'));var jayson=require(_0x558a('0x8'));var client=jayson['client'][_0x558a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x79ec7a,_0x12b690,_0x85a5dd){return new BPromise(function(_0xbbd12f,_0x110710){return client['request'](_0x79ec7a,_0x85a5dd)[_0x558a('0xa')](function(_0x1852aa){logger[_0x558a('0xb')](_0x558a('0xc'),_0x12b690,_0x558a('0xd'));logger[_0x558a('0xe')](_0x558a('0xf'),_0x12b690,_0x558a('0xd'),JSON[_0x558a('0x10')](_0x1852aa));if(_0x1852aa[_0x558a('0x11')]){if(_0x1852aa[_0x558a('0x11')][_0x558a('0x12')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x12b690,_0x1852aa[_0x558a('0x11')][_0x558a('0x13')]);return _0x110710(_0x1852aa[_0x558a('0x11')][_0x558a('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x12b690,_0x1852aa[_0x558a('0x11')]['message']);return _0xbbd12f(_0x1852aa['error']['message']);}else{logger[_0x558a('0xb')](_0x558a('0xc'),_0x12b690,_0x558a('0xd'));_0xbbd12f(_0x1852aa[_0x558a('0x14')][_0x558a('0x13')]);}})[_0x558a('0x15')](function(_0x58a0ed){logger[_0x558a('0x11')](_0x558a('0xc'),_0x12b690,_0x58a0ed);_0x110710(_0x58a0ed);});});}exports[_0x558a('0x16')]=function(_0x3fc5b6){var _0x1a0873=this;return new Promise(function(_0x8a8b3b,_0x77076f){return db[_0x558a('0x17')][_0x558a('0x18')]({'raw':_0x3fc5b6['options']?_0x3fc5b6[_0x558a('0x19')][_0x558a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fc5b6[_0x558a('0x19')]?_0x3fc5b6[_0x558a('0x19')][_0x558a('0x1b')]||null:null,'attributes':_0x3fc5b6['options']?_0x3fc5b6[_0x558a('0x19')]['attributes']||null:null,'limit':_0x3fc5b6['options']?_0x3fc5b6[_0x558a('0x19')][_0x558a('0x1c')]||null:null,'include':_0x3fc5b6[_0x558a('0x19')]?_0x3fc5b6['options'][_0x558a('0x1d')]?_[_0x558a('0x1e')](_0x3fc5b6[_0x558a('0x19')][_0x558a('0x1d')],function(_0x5866c0){return{'model':db[_0x5866c0[_0x558a('0x1f')]],'as':_0x5866c0['as'],'attributes':_0x5866c0['attributes'],'include':_0x5866c0[_0x558a('0x1d')]?_[_0x558a('0x1e')](_0x5866c0[_0x558a('0x1d')],function(_0x51a9fb){return{'model':db[_0x51a9fb[_0x558a('0x1f')]],'as':_0x51a9fb['as'],'attributes':_0x51a9fb['attributes'],'include':_0x51a9fb[_0x558a('0x1d')]?_[_0x558a('0x1e')](_0x51a9fb['include'],function(_0xf1feb1){return{'model':db[_0xf1feb1[_0x558a('0x1f')]],'as':_0xf1feb1['as'],'attributes':_0xf1feb1[_0x558a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x558a('0xa')](function(_0x3f37a5){logger['info'](_0x558a('0x16'),_0x3fc5b6);logger[_0x558a('0xe')](_0x558a('0x16'),_0x3fc5b6,JSON[_0x558a('0x10')](_0x3f37a5));_0x8a8b3b(_0x3f37a5);})['catch'](function(_0x9957db){logger[_0x558a('0x11')](_0x558a('0x16'),_0x9957db[_0x558a('0x13')],_0x3fc5b6);_0x77076f(_0x1a0873['error'](0x1f4,_0x9957db[_0x558a('0x13')]));});});};exports[_0x558a('0x21')]=function(_0x3e051c){var _0x4f9bb3=this;return new Promise(function(_0x11dd61,_0x536010){return db[_0x558a('0x17')]['update'](_0x3e051c[_0x558a('0x22')],{'raw':_0x3e051c['options']?_0x3e051c[_0x558a('0x19')][_0x558a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e051c[_0x558a('0x19')]?_0x3e051c[_0x558a('0x19')][_0x558a('0x1b')]||null:null,'attributes':_0x3e051c[_0x558a('0x19')]?_0x3e051c[_0x558a('0x19')][_0x558a('0x20')]||null:null,'limit':_0x3e051c[_0x558a('0x19')]?_0x3e051c[_0x558a('0x19')][_0x558a('0x1c')]||null:null})[_0x558a('0xa')](function(_0x3144cf){logger[_0x558a('0xb')](_0x558a('0x21'),_0x3e051c);logger['debug'](_0x558a('0x21'),_0x3e051c,JSON[_0x558a('0x10')](_0x3144cf));_0x11dd61(_0x3144cf);})['catch'](function(_0x36e3ce){logger[_0x558a('0x11')]('UpdateCmHopperBlack',_0x36e3ce[_0x558a('0x13')],_0x3e051c);_0x536010(_0x4f9bb3[_0x558a('0x11')](0x1f4,_0x36e3ce[_0x558a('0x13')]));});});};exports[_0x558a('0x23')]=function(_0x52b820){var _0x4d3025=this;return new Promise(function(_0x5e87ce,_0x465b64){return db[_0x558a('0x17')]['destroy']({'where':_0x52b820[_0x558a('0x19')]?_0x52b820['options'][_0x558a('0x1b')]||null:null})[_0x558a('0xa')](function(_0x5cc2aa){logger[_0x558a('0xb')]('DestroyCmHopperBlack',_0x52b820);logger[_0x558a('0xe')](_0x558a('0x23'),_0x52b820,JSON[_0x558a('0x10')](_0x5cc2aa));_0x5e87ce(_0x5cc2aa);})[_0x558a('0x15')](function(_0x53ffdd){logger['error']('DestroyCmHopperBlack',_0x53ffdd[_0x558a('0x13')],_0x52b820);_0x465b64(_0x4d3025['error'](0x1f4,_0x53ffdd[_0x558a('0x13')]));});});}; \ No newline at end of file +var _0x05b3=['attributes','limit','map','model','include','GetCmHopperBlack','update','raw','UpdateCmHopperBlack','debug','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CmHopperBlack','options','where'];(function(_0x58eca9,_0x219608){var _0x25a12e=function(_0x1d3695){while(--_0x1d3695){_0x58eca9['push'](_0x58eca9['shift']());}};_0x25a12e(++_0x219608);}(_0x05b3,0x198));var _0x305b=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x05b3[_0x411e71];return _0x226ae3;};'use strict';var _=require(_0x305b('0x0'));var util=require('util');var moment=require(_0x305b('0x1'));var BPromise=require('bluebird');var rs=require(_0x305b('0x2'));var fs=require('fs');var Redis=require(_0x305b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x305b('0x4'));var logger=require(_0x305b('0x5'))(_0x305b('0x6'));var config=require(_0x305b('0x7'));var jayson=require(_0x305b('0x8'));var client=jayson[_0x305b('0x9')][_0x305b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x527645,_0x14659a,_0x12ba69){return new BPromise(function(_0x4f3663,_0x238855){return client[_0x305b('0xb')](_0x527645,_0x12ba69)[_0x305b('0xc')](function(_0x4f5d80){logger[_0x305b('0xd')](_0x305b('0xe'),_0x14659a,_0x305b('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x14659a,_0x305b('0xf'),JSON[_0x305b('0x10')](_0x4f5d80));if(_0x4f5d80['error']){if(_0x4f5d80[_0x305b('0x11')]['code']===0x1f4){logger[_0x305b('0x11')](_0x305b('0xe'),_0x14659a,_0x4f5d80[_0x305b('0x11')][_0x305b('0x12')]);return _0x238855(_0x4f5d80[_0x305b('0x11')]['message']);}logger[_0x305b('0x11')](_0x305b('0xe'),_0x14659a,_0x4f5d80['error'][_0x305b('0x12')]);return _0x4f3663(_0x4f5d80[_0x305b('0x11')][_0x305b('0x12')]);}else{logger[_0x305b('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x14659a,_0x305b('0xf'));_0x4f3663(_0x4f5d80[_0x305b('0x13')][_0x305b('0x12')]);}})[_0x305b('0x14')](function(_0x2873d6){logger[_0x305b('0x11')](_0x305b('0xe'),_0x14659a,_0x2873d6);_0x238855(_0x2873d6);});});}exports['GetCmHopperBlack']=function(_0x576768){var _0x470ed5=this;return new Promise(function(_0x34e8d9,_0x56b655){return db[_0x305b('0x15')]['findAll']({'raw':_0x576768[_0x305b('0x16')]?_0x576768[_0x305b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x576768[_0x305b('0x16')]?_0x576768['options'][_0x305b('0x17')]||null:null,'attributes':_0x576768[_0x305b('0x16')]?_0x576768[_0x305b('0x16')][_0x305b('0x18')]||null:null,'limit':_0x576768[_0x305b('0x16')]?_0x576768[_0x305b('0x16')][_0x305b('0x19')]||null:null,'include':_0x576768[_0x305b('0x16')]?_0x576768[_0x305b('0x16')]['include']?_[_0x305b('0x1a')](_0x576768[_0x305b('0x16')]['include'],function(_0x18c8f6){return{'model':db[_0x18c8f6[_0x305b('0x1b')]],'as':_0x18c8f6['as'],'attributes':_0x18c8f6[_0x305b('0x18')],'include':_0x18c8f6['include']?_[_0x305b('0x1a')](_0x18c8f6[_0x305b('0x1c')],function(_0x16b2a3){return{'model':db[_0x16b2a3[_0x305b('0x1b')]],'as':_0x16b2a3['as'],'attributes':_0x16b2a3[_0x305b('0x18')],'include':_0x16b2a3[_0x305b('0x1c')]?_[_0x305b('0x1a')](_0x16b2a3[_0x305b('0x1c')],function(_0x3ef2fd){return{'model':db[_0x3ef2fd[_0x305b('0x1b')]],'as':_0x3ef2fd['as'],'attributes':_0x3ef2fd[_0x305b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x305b('0xc')](function(_0x13331c){logger[_0x305b('0xd')](_0x305b('0x1d'),_0x576768);logger['debug'](_0x305b('0x1d'),_0x576768,JSON['stringify'](_0x13331c));_0x34e8d9(_0x13331c);})[_0x305b('0x14')](function(_0x4fc825){logger[_0x305b('0x11')](_0x305b('0x1d'),_0x4fc825[_0x305b('0x12')],_0x576768);_0x56b655(_0x470ed5['error'](0x1f4,_0x4fc825[_0x305b('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x2f1bcf){var _0x3f41ef=this;return new Promise(function(_0x550bdf,_0x4841db){return db[_0x305b('0x15')][_0x305b('0x1e')](_0x2f1bcf['body'],{'raw':_0x2f1bcf[_0x305b('0x16')]?_0x2f1bcf[_0x305b('0x16')][_0x305b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f1bcf[_0x305b('0x16')]?_0x2f1bcf['options']['where']||null:null,'attributes':_0x2f1bcf['options']?_0x2f1bcf[_0x305b('0x16')]['attributes']||null:null,'limit':_0x2f1bcf[_0x305b('0x16')]?_0x2f1bcf[_0x305b('0x16')]['limit']||null:null})[_0x305b('0xc')](function(_0x8b1c55){logger[_0x305b('0xd')](_0x305b('0x20'),_0x2f1bcf);logger[_0x305b('0x21')](_0x305b('0x20'),_0x2f1bcf,JSON[_0x305b('0x10')](_0x8b1c55));_0x550bdf(_0x8b1c55);})[_0x305b('0x14')](function(_0x2e7425){logger[_0x305b('0x11')]('UpdateCmHopperBlack',_0x2e7425[_0x305b('0x12')],_0x2f1bcf);_0x4841db(_0x3f41ef[_0x305b('0x11')](0x1f4,_0x2e7425['message']));});});};exports[_0x305b('0x22')]=function(_0x496eea){var _0x3f798c=this;return new Promise(function(_0x281ccc,_0x592052){return db['CmHopperBlack'][_0x305b('0x23')]({'where':_0x496eea['options']?_0x496eea[_0x305b('0x16')]['where']||null:null})['then'](function(_0x330f31){logger[_0x305b('0xd')](_0x305b('0x22'),_0x496eea);logger[_0x305b('0x21')](_0x305b('0x22'),_0x496eea,JSON['stringify'](_0x330f31));_0x281ccc(_0x330f31);})[_0x305b('0x14')](function(_0x273fd3){logger[_0x305b('0x11')](_0x305b('0x22'),_0x273fd3[_0x305b('0x12')],_0x496eea);_0x592052(_0x3f798c[_0x305b('0x11')](0x1f4,_0x273fd3[_0x305b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 94e7f99..e9a8e59 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 _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x3ba277,_0x2b9ecf){var _0x5c4326=function(_0x4e0d5e){while(--_0x4e0d5e){_0x3ba277['push'](_0x3ba277['shift']());}};_0x5c4326(++_0x2b9ecf);}(_0xed1c,0xe4));var _0xced1=function(_0x586bd5,_0x51353b){_0x586bd5=_0x586bd5-0x0;var _0x5b5704=_0xed1c[_0x586bd5];return _0x5b5704;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file +var _0xb016=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','put','/:id','destroy'];(function(_0x4b91c6,_0x56cc8b){var _0x39d324=function(_0x4813cc){while(--_0x4813cc){_0x4b91c6['push'](_0x4b91c6['shift']());}};_0x39d324(++_0x56cc8b);}(_0xb016,0x159));var _0x6b01=function(_0x810d8f,_0x3e7c80){_0x810d8f=_0x810d8f-0x0;var _0x5c94d5=_0xb016[_0x810d8f];return _0x5c94d5;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller['update']);router['delete'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 3b96d05..7ddd2ce 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 _0x636d=['followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x636d,0xc4));var _0xd636=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x636d[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xd636('0x0'));var moment=require(_0xd636('0x1'));module[_0xd636('0x2')]={'state':{'type':Sequelize[_0xd636('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd636('0x4')]},'scheduledat':{'type':Sequelize[_0xd636('0x5')]},'countbusyretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd636('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xd636('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd636('0x4')]},'calleridnum':{'type':Sequelize[_0xd636('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd636('0x5')]},'responsetime':{'type':Sequelize[_0xd636('0x5')]},'answertime':{'type':Sequelize[_0xd636('0x5')]},'droptime':{'type':Sequelize[_0xd636('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd636('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd636('0x4')]},'membername':{'type':Sequelize[_0xd636('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd636('0x4')]},'secondDisposition':{'type':Sequelize[_0xd636('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd636('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xb21d8f){var _0x2f9be9=this['getDataValue'](_0xd636('0x6'));if(_0x2f9be9&&_0xb21d8f){this[_0xd636('0x7')](_0xd636('0x8'),moment(_0xb21d8f)[_0xd636('0x9')](moment(_0x2f9be9),_0xd636('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd636('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd636('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd636('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd636('0x5')]},'callback':{'type':Sequelize[_0xd636('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd636('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd636('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd636('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd636('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaff6=['sequelize','moment','exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0xaff6,0xd8));var _0x6aff=function(_0x77b525,_0xd4dc1e){_0x77b525=_0x77b525-0x0;var _0xa83673=_0xaff6[_0x77b525];return _0xa83673;};'use strict';var Sequelize=require(_0x6aff('0x0'));var moment=require(_0x6aff('0x1'));module[_0x6aff('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6aff('0x3')]},'countbusyretry':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6aff('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6aff('0x5')]},'calleridname':{'type':Sequelize[_0x6aff('0x5')]},'starttime':{'type':Sequelize[_0x6aff('0x3')]},'responsetime':{'type':Sequelize[_0x6aff('0x3')]},'answertime':{'type':Sequelize[_0x6aff('0x3')]},'droptime':{'type':Sequelize[_0x6aff('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6aff('0x5')]},'campaign':{'type':Sequelize[_0x6aff('0x5')]},'campaigntype':{'type':Sequelize[_0x6aff('0x5')]},'membername':{'type':Sequelize[_0x6aff('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6aff('0x5')]},'secondDisposition':{'type':Sequelize[_0x6aff('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6aff('0x3')],'set':function(_0x39b16f){var _0x1f1ee0=this[_0x6aff('0x6')](_0x6aff('0x7'));if(_0x1f1ee0&&_0x39b16f){this[_0x6aff('0x8')](_0x6aff('0x9'),moment(_0x39b16f)[_0x6aff('0xa')](moment(_0x1f1ee0),'seconds'));}}},'amd':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6aff('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6aff('0x3')]},'recallme':{'type':Sequelize[_0x6aff('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6aff('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6aff('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6aff('0x4')],'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 d3fa224..258c0bc 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 _0x326f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','rows','catch','show','params','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','phone','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x43017a,_0x54e4df){_0x43017a=_0x43017a-0x0;var _0x447d9c=_0x326f[_0x43017a];return _0x447d9c;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}exports['index']=function(_0x4a9abf,_0x6a8e89){var _0x1ae23a={},_0x2fa28e={},_0x5dbe63={'count':0x0,'rows':[]};var _0xc115d9=_[_0xf326('0x28')](db['CmHopperFinal'][_0xf326('0x29')],function(_0x119ab8){return{'name':_0x119ab8[_0xf326('0x2a')],'type':_0x119ab8[_0xf326('0x2b')][_0xf326('0x2c')]};});_0x2fa28e[_0xf326('0x2d')]=_[_0xf326('0x28')](_0xc115d9,_0xf326('0x26'));_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x4a9abf['query']);_0x2fa28e[_0xf326('0x30')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],_0x2fa28e['query']);_0x1ae23a[_0xf326('0x32')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],qs['fields'](_0x4a9abf['query'][_0xf326('0x33')]));_0x1ae23a[_0xf326('0x32')]=_0x1ae23a[_0xf326('0x32')][_0xf326('0x34')]?_0x1ae23a[_0xf326('0x32')]:_0x2fa28e[_0xf326('0x2d')];if(!_0x4a9abf[_0xf326('0x2e')][_0xf326('0x35')]('nolimit')){_0x1ae23a[_0xf326('0x1c')]=qs[_0xf326('0x1c')](_0x4a9abf['query'][_0xf326('0x1c')]);_0x1ae23a['offset']=qs[_0xf326('0x1a')](_0x4a9abf['query']['offset']);}_0x1ae23a[_0xf326('0x36')]=qs['sort'](_0x4a9abf[_0xf326('0x2e')]['sort']);_0x1ae23a[_0xf326('0x37')]=qs[_0xf326('0x30')](_[_0xf326('0x38')](_0x4a9abf['query'],_0x2fa28e[_0xf326('0x30')]),_0xc115d9);if(_0x4a9abf[_0xf326('0x2e')]['filter']){_0x1ae23a[_0xf326('0x37')]=_[_0xf326('0x39')](_0x1ae23a[_0xf326('0x37')],{'$or':_[_0xf326('0x28')](_0xc115d9,function(_0x51076c){if(_0x51076c[_0xf326('0x2b')]!==_0xf326('0x3a')){var _0x1e69b1={};_0x1e69b1[_0x51076c[_0xf326('0x26')]]={'$like':'%'+_0x4a9abf[_0xf326('0x2e')]['filter']+'%'};return _0x1e69b1;}})});}_0x1ae23a=_[_0xf326('0x39')]({},_0x1ae23a,_0x4a9abf[_0xf326('0x3b')]);var _0x5cfb97={'where':_0x1ae23a['where']};return db[_0xf326('0x3c')]['count'](_0x5cfb97)['then'](function(_0x22d462){_0x5dbe63['count']=_0x22d462;if(_0x4a9abf[_0xf326('0x2e')][_0xf326('0x3d')]){_0x1ae23a[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x3c')]['findAll'](_0x1ae23a);})[_0xf326('0x24')](function(_0x45d344){_0x5dbe63[_0xf326('0x3f')]=_0x45d344;return _0x5dbe63;})[_0xf326('0x24')](respondWithFilteredResult(_0x6a8e89,_0x1ae23a))[_0xf326('0x40')](handleError(_0x6a8e89,null));};exports[_0xf326('0x41')]=function(_0x2ad841,_0x224a32){var _0x31283b={'raw':!![],'where':{'id':_0x2ad841[_0xf326('0x42')]['id']}},_0x1227d3={};_0x1227d3[_0xf326('0x2d')]=_['keys'](db[_0xf326('0x3c')][_0xf326('0x29')]);_0x1227d3[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x2ad841[_0xf326('0x2e')]);_0x1227d3[_0xf326('0x30')]=_['intersection'](_0x1227d3[_0xf326('0x2d')],_0x1227d3[_0xf326('0x2e')]);_0x31283b['attributes']=_[_0xf326('0x31')](_0x1227d3[_0xf326('0x2d')],qs[_0xf326('0x33')](_0x2ad841[_0xf326('0x2e')][_0xf326('0x33')]));_0x31283b['attributes']=_0x31283b['attributes'][_0xf326('0x34')]?_0x31283b[_0xf326('0x32')]:_0x1227d3['model'];if(_0x2ad841['query'][_0xf326('0x3d')]){_0x31283b[_0xf326('0x3e')]=[{'all':!![]}];}_0x31283b=_[_0xf326('0x39')]({},_0x31283b,_0x2ad841['options']);return db[_0xf326('0x3c')][_0xf326('0x43')](_0x31283b)[_0xf326('0x24')](handleEntityNotFound(_0x224a32,null))[_0xf326('0x24')](respondWithResult(_0x224a32,null))[_0xf326('0x40')](handleError(_0x224a32,null));};exports[_0xf326('0x44')]=function(_0x12792c,_0x3b90dc){return db[_0xf326('0x3c')][_0xf326('0x44')]()[_0xf326('0x24')](respondWithResult(_0x3b90dc,null))[_0xf326('0x40')](handleError(_0x3b90dc,null));};exports[_0xf326('0x22')]=function(_0x395b1e,_0xeac1a1){if(_0x395b1e['body'][_0xf326('0x45')]){delete _0x395b1e[_0xf326('0x46')][_0xf326('0x45')];}return db[_0xf326('0x3c')]['find']({'where':{'uniqueid':_0x395b1e[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x24')](saveUpdates(_0x395b1e[_0xf326('0x46')],null))['then'](respondWithResult(_0xeac1a1,null))[_0xf326('0x40')](handleError(_0xeac1a1,null));};exports[_0xf326('0x47')]=function(_0x145a77,_0x451ac7,_0x39ba25){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x145a77[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),'noSuchContacts'],[db['sequelize']['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x4c')))),_0xf326('0x4d')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4f')))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x51')))),'dropContacts'],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x53')))),'reCallContacts'],[db[_0xf326('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x54')))),_0xf326('0x55')]]})[_0xf326('0x24')](handleEntityNotFound(_0x451ac7,null))['then'](respondWithResult(_0x451ac7,null))['catch'](handleError(_0x451ac7,null));};exports[_0xf326('0x56')]=function(_0xa85a42,_0x33b259,_0x5d0177){return db[_0xf326('0x3c')]['findAll']({'raw':![],'where':{'CampaignId':_0xa85a42[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),_0xf326('0x57')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xf326('0x4d')],[db['sequelize']['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x51')))),_0xf326('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x59')))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')](_0xf326('0x53')))),_0xf326('0x5a')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db['sequelize']['literal'](_0xf326('0x54')))),'answeringMachine']]})[_0xf326('0x24')](handleEntityNotFound(_0x33b259,null))[_0xf326('0x24')](respondWithResult(_0x33b259,null))[_0xf326('0x40')](handleError(_0x33b259,null));};exports[_0xf326('0x5b')]=function(_0x17cd36,_0x541491,_0x4a053c){return db['VoiceQueue'][_0xf326('0x43')]({'where':{'id':_0x17cd36[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x541491,null))[_0xf326('0x24')](function(_0xec5857){var _0x5e874b;if(_0xec5857){_0x5e874b=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))['fromQuery'](['phone',_0xf326('0x5f'),_0xf326('0x60'),'ListId','VoiceQueueId',_0xf326('0x61'),'updatedAt'],squel[_0xf326('0x62')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x5f'))['field'](_0xf326('0x65'),_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x68'),_0xf326('0x69'))[_0xf326('0x63')]('NOW()',_0xf326('0x61'))['field'](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')]('cm_hopper_final')[_0xf326('0x37')](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id']['toString']())[_0xf326('0x37')](_0xf326('0x6d'),_0x17cd36[_0xf326('0x46')][_0xf326('0x6e')]['toString']())[_0xf326('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field']('phone')['from'](_0xf326('0x5e'))['where'](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id'][_0xf326('0x70')]()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field'](_0xf326('0x71'))[_0xf326('0x6b')]('cm_hopper_final')['where'](_0xf326('0x6c'),_0x17cd36['params']['id'][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x72')))[_0xf326('0x73')](_0xf326('0x60')))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x5e874b);}return[];})[_0xf326('0x24')](respondWithResult(_0x541491,null))['catch'](handleError(_0x541491,null));};exports[_0xf326('0x74')]=function(_0x26bbb1,_0x4ac90e,_0x3c82cf){return db['Campaign'][_0xf326('0x43')]({'where':{'id':_0x26bbb1[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x4ac90e,null))['then'](function(_0x2b4414){var _0x1c86c8;if(_0x2b4414){_0x1c86c8=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))[_0xf326('0x75')]([_0xf326('0x76'),_0xf326('0x5f'),_0xf326('0x60'),_0xf326('0x67'),_0xf326('0x77'),_0xf326('0x61'),_0xf326('0x6a')],squel[_0xf326('0x62')]()[_0xf326('0x63')]('ANY_VALUE(calleridnum)',_0xf326('0x76'))[_0xf326('0x63')]('NOW()',_0xf326('0x5f'))[_0xf326('0x63')]('ANY_VALUE(ContactId)',_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x78'),_0xf326('0x77'))['field'](_0xf326('0x64'),_0xf326('0x61'))[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')](_0xf326('0x79'))[_0xf326('0x37')]('CampaignId\x20=\x20?',_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where'](_0xf326('0x6d'),_0x26bbb1['body'][_0xf326('0x6e')][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x7a'))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x76'))[_0xf326('0x6b')](_0xf326('0x5e'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id']['toString']()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x71'))['from'](_0xf326('0x79'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where']('state\x20=\x204'))[_0xf326('0x73')]('ContactId'))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x1c86c8);}return[];})['then'](respondWithResult(_0x4ac90e,null))['catch'](handleError(_0x4ac90e,null));};exports[_0xf326('0x7c')]=function(_0x2d92e4,_0x167ac9,_0x34870c){return db[_0xf326('0x7d')]['findOne']({'where':{'VoiceQueueId':_0x2d92e4[_0xf326('0x46')][_0xf326('0x69')],'CampaignId':_0x2d92e4[_0xf326('0x46')]['CampaignId'],'ContactId':_0x2d92e4['body']['ContactId']}})[_0xf326('0x24')](handleEntityNotFound(_0x167ac9,null))[_0xf326('0x24')](function(_0x2d275d){if(_0x2d275d){return _0x2d275d;}return null;})[_0xf326('0x24')](respondWithResult(_0x167ac9,null))[_0xf326('0x40')](handleError(_0x167ac9,null));}; \ No newline at end of file +var _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','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','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x144856,_0x21f180){var _0x377cf9=function(_0xc5ac5a){while(--_0xc5ac5a){_0x144856['push'](_0x144856['shift']());}};_0x377cf9(++_0x21f180);}(_0x90b1,0x1bb));var _0x190b=function(_0x5e7361,_0x31140d){_0x5e7361=_0x5e7361-0x0;var _0x248a05=_0x90b1[_0x5e7361];return _0x248a05;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7902e6c..ce0fc9c 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 _0xae35=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','uniqueid','lodash'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xae35,0x1cd));var _0x5ae3=function(_0x536648,_0x662ae5){_0x536648=_0x536648-0x0;var _0x851401=_0xae35[_0x536648];return _0x851401;};'use strict';var _=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var logger=require(_0x5ae3('0x2'))(_0x5ae3('0x3'));var moment=require(_0x5ae3('0x4'));var BPromise=require(_0x5ae3('0x5'));var rp=require(_0x5ae3('0x6'));var fs=require('fs');var path=require(_0x5ae3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ae3('0x8'));module[_0x5ae3('0x9')]=function(_0x5ddc7c,_0x537f5d){return _0x5ddc7c[_0x5ae3('0xa')](_0x5ae3('0xb'),attributes,{'tableName':_0x5ae3('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x5ae3('0xd'),'fields':[_0x5ae3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77b0=['rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','bluebird','path'];(function(_0x6b5247,_0x4dd4e3){var _0x59d032=function(_0x56ad89){while(--_0x56ad89){_0x6b5247['push'](_0x6b5247['shift']());}};_0x59d032(++_0x4dd4e3);}(_0x77b0,0x104));var _0x077b=function(_0x3e075c,_0x213346){_0x3e075c=_0x3e075c-0x0;var _0x1e2eda=_0x77b0[_0x3e075c];return _0x1e2eda;};'use strict';var _=require(_0x077b('0x0'));var util=require(_0x077b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x077b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x077b('0x3'));var rimraf=require(_0x077b('0x4'));var config=require('../../config/environment');var attributes=require(_0x077b('0x5'));module[_0x077b('0x6')]=function(_0xbbf93a,_0x507f1f){return _0xbbf93a[_0x077b('0x7')](_0x077b('0x8'),attributes,{'tableName':_0x077b('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x077b('0xa')]},{'name':'uniqueid','fields':[_0x077b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index bebffd8..4427026 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x13f7ae,_0x37c67c){var _0x2d24b5=function(_0xfb6048){while(--_0xfb6048){_0x13f7ae['push'](_0x13f7ae['shift']());}};_0x2d24b5(++_0x37c67c);}(_0x7a54,0x106));var _0x47a5=function(_0x55e2ee,_0x3f268b){_0x55e2ee=_0x55e2ee-0x0;var _0x17093e=_0x7a54[_0x55e2ee];return _0x17093e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x51c9ea,_0x2ca0a2){var _0x545fbf=function(_0x2b51ab){while(--_0x2b51ab){_0x51c9ea['push'](_0x51c9ea['shift']());}};_0x545fbf(++_0x2ca0a2);}(_0xb10b,0x12a));var _0xbb10=function(_0x415302,_0x595773){_0x415302=_0x415302-0x0;var _0x810824=_0xb10b[_0x415302];return _0x810824;};'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 d05c65a..d1aa34c 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 _0xa319=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe'];(function(_0x1cd96a,_0x350afa){var _0x29cff4=function(_0x427e3c){while(--_0x427e3c){_0x1cd96a['push'](_0x1cd96a['shift']());}};_0x29cff4(++_0x350afa);}(_0xa319,0x179));var _0x9a31=function(_0x55eaee,_0x459926){_0x55eaee=_0x55eaee-0x0;var _0x37314d=_0xa319[_0x55eaee];return _0x37314d;};'use strict';var multer=require(_0x9a31('0x0'));var util=require(_0x9a31('0x1'));var path=require(_0x9a31('0x2'));var timeout=require(_0x9a31('0x3'));var express=require('express');var router=express[_0x9a31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a31('0x5'));var interaction=require(_0x9a31('0x6'));var config=require(_0x9a31('0x7'));var controller=require(_0x9a31('0x8'));router[_0x9a31('0x9')]('/',auth[_0x9a31('0xa')](),controller[_0x9a31('0xb')]);router['get']('/describe',auth[_0x9a31('0xa')](),controller[_0x9a31('0xc')]);router[_0x9a31('0x9')]('/:id',auth[_0x9a31('0xa')](),controller[_0x9a31('0xd')]);router[_0x9a31('0x9')](_0x9a31('0xe'),auth['isAuthenticated'](),controller[_0x9a31('0xf')]);router[_0x9a31('0x9')](_0x9a31('0x10'),auth[_0x9a31('0xa')](),controller[_0x9a31('0x11')]);router[_0x9a31('0x12')](_0x9a31('0x13'),auth[_0x9a31('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x9a31('0x14'),auth[_0x9a31('0xa')](),controller[_0x9a31('0x15')]);router['post']('/checkContactHopper',auth[_0x9a31('0xa')](),controller[_0x9a31('0x16')]);router[_0x9a31('0x17')]('/:id',auth[_0x9a31('0xa')](),controller[_0x9a31('0x18')]);module[_0x9a31('0x19')]=router; \ No newline at end of file +var _0x3025=['post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id'];(function(_0x2b1fde,_0x20c2ec){var _0xd3dc52=function(_0x3d4ac3){while(--_0x3d4ac3){_0x2b1fde['push'](_0x2b1fde['shift']());}};_0xd3dc52(++_0x20c2ec);}(_0x3025,0x1c7));var _0x5302=function(_0x368af6,_0x5a0aa1){_0x368af6=_0x368af6-0x0;var _0x1ed260=_0x3025[_0x368af6];return _0x1ed260;};'use strict';var multer=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var path=require(_0x5302('0x2'));var timeout=require(_0x5302('0x3'));var express=require(_0x5302('0x4'));var router=express[_0x5302('0x5')]();var fs_extra=require(_0x5302('0x6'));var auth=require(_0x5302('0x7'));var interaction=require(_0x5302('0x8'));var config=require('../../config/environment');var controller=require(_0x5302('0x9'));router[_0x5302('0xa')]('/',auth['isAuthenticated'](),controller[_0x5302('0xb')]);router['get'](_0x5302('0xc'),auth[_0x5302('0xd')](),controller['describe']);router[_0x5302('0xa')](_0x5302('0xe'),auth['isAuthenticated'](),controller[_0x5302('0xf')]);router[_0x5302('0xa')](_0x5302('0x10'),auth[_0x5302('0xd')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x5302('0xa')](_0x5302('0x11'),auth[_0x5302('0xd')](),controller[_0x5302('0x12')]);router['post'](_0x5302('0x13'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x5302('0x14')](_0x5302('0x15'),auth[_0x5302('0xd')](),controller[_0x5302('0x16')]);router['post']('/checkContactHopper',auth['isAuthenticated'](),controller[_0x5302('0x17')]);router[_0x5302('0x18')]('/:id',auth[_0x5302('0xd')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 419a5ce..a493972 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 _0xda6a=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x1b0482,_0x2167c7){var _0x35fa01=function(_0x4750b6){while(--_0x4750b6){_0x1b0482['push'](_0x1b0482['shift']());}};_0x35fa01(++_0x2167c7);}(_0xda6a,0x10d));var _0xada6=function(_0x2abfee,_0x487368){_0x2abfee=_0x2abfee-0x0;var _0x3fe259=_0xda6a[_0x2abfee];return _0x3fe259;};'use strict';var Sequelize=require(_0xada6('0x0'));module[_0xada6('0x1')]={'state':{'type':Sequelize[_0xada6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xada6('0x3')]},'scheduledat':{'type':Sequelize[_0xada6('0x4')]},'countbusyretry':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xada6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xada6('0x3')]},'originatecalleridname':{'type':Sequelize[_0xada6('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xada6('0x3')]},'starttime':{'type':Sequelize[_0xada6('0x4')]},'responsetime':{'type':Sequelize[_0xada6('0x4')]},'answertime':{'type':Sequelize[_0xada6('0x4')]},'droptime':{'type':Sequelize[_0xada6('0x4')]},'endtime':{'type':Sequelize[_0xada6('0x4')]},'ringtime':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xada6('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xada6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xada6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xada6('0x4')]},'edited':{'type':Sequelize[_0xada6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xada6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xada6('0x3')]}}; \ No newline at end of file +var _0x4a38=['STRING','INTEGER','DATE','BOOLEAN','sequelize','exports'];(function(_0x533b74,_0x55d520){var _0x1ddee1=function(_0x163b73){while(--_0x163b73){_0x533b74['push'](_0x533b74['shift']());}};_0x1ddee1(++_0x55d520);}(_0x4a38,0x1de));var _0x84a3=function(_0x2f883f,_0x307e53){_0x2f883f=_0x2f883f-0x0;var _0x565c41=_0x4a38[_0x2f883f];return _0x565c41;};'use strict';var Sequelize=require(_0x84a3('0x0'));module[_0x84a3('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x84a3('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x84a3('0x2')]},'originatecalleridname':{'type':Sequelize[_0x84a3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x84a3('0x2')]},'starttime':{'type':Sequelize[_0x84a3('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x84a3('0x4')]},'droptime':{'type':Sequelize[_0x84a3('0x4')]},'endtime':{'type':Sequelize[_0x84a3('0x4')]},'ringtime':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x84a3('0x2')]},'campaign':{'type':Sequelize[_0x84a3('0x2')]},'campaigntype':{'type':Sequelize[_0x84a3('0x2')]},'membername':{'type':Sequelize[_0x84a3('0x2')]},'reason':{'type':Sequelize[_0x84a3('0x2')]},'amd':{'type':Sequelize[_0x84a3('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x84a3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x84a3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x84a3('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x84a3('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x84a3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x84a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 6ba17ba..3c2183c 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 _0x7c78=['apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','options','create','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x7c78,0x1a1));var _0x87c7=function(_0x43c407,_0x128a36){_0x43c407=_0x43c407-0x0;var _0x2dfe3e=_0x7c78[_0x43c407];return _0x2dfe3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87c7('0x0'));var zipdir=require(_0x87c7('0x1'));var jsonpatch=require(_0x87c7('0x2'));var rp=require(_0x87c7('0x3'));var moment=require('moment');var BPromise=require(_0x87c7('0x4'));var Mustache=require(_0x87c7('0x5'));var util=require(_0x87c7('0x6'));var path=require(_0x87c7('0x7'));var sox=require('sox');var csv=require(_0x87c7('0x8'));var ejs=require(_0x87c7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87c7('0xa'));var squel=require(_0x87c7('0xb'));var crypto=require(_0x87c7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x87c7('0xd'));var toCsv=require(_0x87c7('0x8'));var querystring=require(_0x87c7('0xe'));var Papa=require('papaparse');var Redis=require(_0x87c7('0xf'));var authService=require(_0x87c7('0x10'));var qs=require(_0x87c7('0x11'));var as=require(_0x87c7('0x12'));var hardwareService=require(_0x87c7('0x13'));var logger=require('../../config/logger')(_0x87c7('0x14'));var utils=require(_0x87c7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x87c7('0x16'));var db=require(_0x87c7('0x17'))['db'];function respondWithStatusCode(_0x2be3f8,_0x57da53){_0x57da53=_0x57da53||0xcc;return function(_0x3e2df4){if(_0x3e2df4){return _0x2be3f8[_0x87c7('0x18')](_0x57da53);}return _0x2be3f8[_0x87c7('0x19')](_0x57da53)[_0x87c7('0x1a')]();};}function respondWithResult(_0x5e5e85,_0x46fdb0){_0x46fdb0=_0x46fdb0||0xc8;return function(_0x1a306a){if(_0x1a306a){return _0x5e5e85[_0x87c7('0x19')](_0x46fdb0)[_0x87c7('0x1b')](_0x1a306a);}};}function respondWithFilteredResult(_0x28c9a5,_0x2e1471){return function(_0x5e6cb1){if(_0x5e6cb1){var _0xc32bc0=typeof _0x2e1471[_0x87c7('0x1c')]===_0x87c7('0x1d')&&typeof _0x2e1471['limit']===_0x87c7('0x1d');var _0x53c992=_0x5e6cb1['count'];var _0x3a15b2=_0xc32bc0?0x0:_0x2e1471['offset'];var _0x18e1a1=_0xc32bc0?_0x5e6cb1[_0x87c7('0x1e')]:_0x2e1471[_0x87c7('0x1c')]+_0x2e1471['limit'];var _0x51c48d;if(_0x18e1a1>=_0x53c992){_0x18e1a1=_0x53c992;_0x51c48d=0xc8;}else{_0x51c48d=0xce;}_0x28c9a5[_0x87c7('0x19')](_0x51c48d);return _0x28c9a5[_0x87c7('0x1f')](_0x87c7('0x20'),_0x3a15b2+'-'+_0x18e1a1+'/'+_0x53c992)[_0x87c7('0x1b')](_0x5e6cb1);}return null;};}function patchUpdates(_0x289788){return function(_0x5bc4b0){try{jsonpatch[_0x87c7('0x21')](_0x5bc4b0,_0x289788,!![]);}catch(_0x33cbc5){return BPromise['reject'](_0x33cbc5);}return _0x5bc4b0[_0x87c7('0x22')]();};}function saveUpdates(_0x4c65b7,_0x3c5988){return function(_0x4cb372){if(_0x4cb372){return _0x4cb372[_0x87c7('0x23')](_0x4c65b7)[_0x87c7('0x24')](function(_0x382b9c){return _0x382b9c;});}return null;};}function removeEntity(_0x9fc6cc,_0x6020fd){return function(_0x6e4a98){if(_0x6e4a98){return _0x6e4a98[_0x87c7('0x25')]()[_0x87c7('0x24')](function(){_0x9fc6cc[_0x87c7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3361,_0x1af30b){return function(_0x371eaf){if(!_0x371eaf){_0x5b3361[_0x87c7('0x18')](0x194);}return _0x371eaf;};}function handleError(_0x24d6c3,_0x331f5a){_0x331f5a=_0x331f5a||0x1f4;return function(_0x26ba1a){logger['error'](_0x26ba1a[_0x87c7('0x26')]);if(_0x26ba1a[_0x87c7('0x27')]){delete _0x26ba1a[_0x87c7('0x27')];}_0x24d6c3[_0x87c7('0x19')](_0x331f5a)['send'](_0x26ba1a);};}exports[_0x87c7('0x28')]=function(_0x1cb180,_0x276056){var _0x237a34={},_0x2ad0ef={},_0x3eb3ef={'count':0x0,'rows':[]};var _0xfedfef=_[_0x87c7('0x29')](db['CmHopperHistory'][_0x87c7('0x2a')],function(_0x1d6017){return{'name':_0x1d6017[_0x87c7('0x2b')],'type':_0x1d6017[_0x87c7('0x2c')]['key']};});_0x2ad0ef[_0x87c7('0x2d')]=_[_0x87c7('0x29')](_0xfedfef,'name');_0x2ad0ef[_0x87c7('0x2e')]=_[_0x87c7('0x2f')](_0x1cb180[_0x87c7('0x2e')]);_0x2ad0ef[_0x87c7('0x30')]=_[_0x87c7('0x31')](_0x2ad0ef['model'],_0x2ad0ef[_0x87c7('0x2e')]);_0x237a34[_0x87c7('0x32')]=_[_0x87c7('0x31')](_0x2ad0ef[_0x87c7('0x2d')],qs[_0x87c7('0x33')](_0x1cb180['query'][_0x87c7('0x33')]));_0x237a34[_0x87c7('0x32')]=_0x237a34[_0x87c7('0x32')][_0x87c7('0x34')]?_0x237a34[_0x87c7('0x32')]:_0x2ad0ef[_0x87c7('0x2d')];if(!_0x1cb180[_0x87c7('0x2e')]['hasOwnProperty'](_0x87c7('0x35'))){_0x237a34[_0x87c7('0x36')]=qs['limit'](_0x1cb180[_0x87c7('0x2e')]['limit']);_0x237a34[_0x87c7('0x1c')]=qs['offset'](_0x1cb180[_0x87c7('0x2e')][_0x87c7('0x1c')]);}_0x237a34[_0x87c7('0x37')]=qs[_0x87c7('0x38')](_0x1cb180[_0x87c7('0x2e')][_0x87c7('0x38')]);_0x237a34['where']=qs['filters'](_[_0x87c7('0x39')](_0x1cb180[_0x87c7('0x2e')],_0x2ad0ef[_0x87c7('0x30')]),_0xfedfef);if(_0x1cb180[_0x87c7('0x2e')][_0x87c7('0x3a')]){_0x237a34[_0x87c7('0x3b')]=_[_0x87c7('0x3c')](_0x237a34[_0x87c7('0x3b')],{'$or':_[_0x87c7('0x29')](_0xfedfef,function(_0x380480){if(_0x380480[_0x87c7('0x2c')]!==_0x87c7('0x3d')){var _0x59266a={};_0x59266a[_0x380480['name']]={'$like':'%'+_0x1cb180[_0x87c7('0x2e')][_0x87c7('0x3a')]+'%'};return _0x59266a;}})});}_0x237a34=_[_0x87c7('0x3c')]({},_0x237a34,_0x1cb180['options']);var _0x33f9a7={'where':_0x237a34[_0x87c7('0x3b')]};return db[_0x87c7('0x3e')][_0x87c7('0x1e')](_0x33f9a7)[_0x87c7('0x24')](function(_0x219b7b){_0x3eb3ef[_0x87c7('0x1e')]=_0x219b7b;if(_0x1cb180[_0x87c7('0x2e')][_0x87c7('0x3f')]){_0x237a34[_0x87c7('0x40')]=[{'all':!![]}];}return db[_0x87c7('0x3e')][_0x87c7('0x41')](_0x237a34);})[_0x87c7('0x24')](function(_0x5d25d4){_0x3eb3ef[_0x87c7('0x42')]=_0x5d25d4;return _0x3eb3ef;})['then'](respondWithFilteredResult(_0x276056,_0x237a34))[_0x87c7('0x43')](handleError(_0x276056,null));};exports[_0x87c7('0x44')]=function(_0x4a6e83,_0x5354c8){var _0x1a7181={'raw':!![],'where':{'id':_0x4a6e83[_0x87c7('0x45')]['id']}},_0x310c1b={};_0x310c1b[_0x87c7('0x2d')]=_[_0x87c7('0x2f')](db[_0x87c7('0x3e')][_0x87c7('0x2a')]);_0x310c1b[_0x87c7('0x2e')]=_['keys'](_0x4a6e83['query']);_0x310c1b[_0x87c7('0x30')]=_[_0x87c7('0x31')](_0x310c1b[_0x87c7('0x2d')],_0x310c1b[_0x87c7('0x2e')]);_0x1a7181[_0x87c7('0x32')]=_[_0x87c7('0x31')](_0x310c1b[_0x87c7('0x2d')],qs[_0x87c7('0x33')](_0x4a6e83[_0x87c7('0x2e')]['fields']));_0x1a7181[_0x87c7('0x32')]=_0x1a7181[_0x87c7('0x32')][_0x87c7('0x34')]?_0x1a7181[_0x87c7('0x32')]:_0x310c1b[_0x87c7('0x2d')];if(_0x4a6e83['query'][_0x87c7('0x3f')]){_0x1a7181[_0x87c7('0x40')]=[{'all':!![]}];}_0x1a7181=_['merge']({},_0x1a7181,_0x4a6e83[_0x87c7('0x46')]);return db[_0x87c7('0x3e')]['find'](_0x1a7181)[_0x87c7('0x24')](handleEntityNotFound(_0x5354c8,null))[_0x87c7('0x24')](respondWithResult(_0x5354c8,null))['catch'](handleError(_0x5354c8,null));};exports[_0x87c7('0x47')]=function(_0x508fea,_0x2cbcaf){return db[_0x87c7('0x3e')][_0x87c7('0x47')](_0x508fea[_0x87c7('0x48')],{})['then'](respondWithResult(_0x2cbcaf,0xc9))[_0x87c7('0x43')](handleError(_0x2cbcaf,null));};exports['describe']=function(_0x299784,_0x2e3679){return db[_0x87c7('0x3e')][_0x87c7('0x49')]()[_0x87c7('0x24')](respondWithResult(_0x2e3679,null))[_0x87c7('0x43')](handleError(_0x2e3679,null));};exports[_0x87c7('0x23')]=function(_0x1ea771,_0x2983d7){if(_0x1ea771[_0x87c7('0x48')][_0x87c7('0x4a')]){delete _0x1ea771[_0x87c7('0x48')][_0x87c7('0x4a')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x1ea771[_0x87c7('0x45')]['id']}})[_0x87c7('0x24')](handleEntityNotFound(_0x2983d7,null))[_0x87c7('0x24')](saveUpdates(_0x1ea771[_0x87c7('0x48')],null))[_0x87c7('0x24')](respondWithResult(_0x2983d7,null))[_0x87c7('0x43')](handleError(_0x2983d7,null));}; \ No newline at end of file +var _0xa108=['index','CmHopperHistory','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','describe','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send'];(function(_0x4fb08a,_0x4c04dd){var _0x32aa19=function(_0x542426){while(--_0x542426){_0x4fb08a['push'](_0x4fb08a['shift']());}};_0x32aa19(++_0x4c04dd);}(_0xa108,0x112));var _0x8a10=function(_0x29b8ea,_0x1bfd3d){_0x29b8ea=_0x29b8ea-0x0;var _0x24ac0a=_0xa108[_0x29b8ea];return _0x24ac0a;};'use strict';var emlformat=require(_0x8a10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a10('0x1'));var jsonpatch=require(_0x8a10('0x2'));var rp=require(_0x8a10('0x3'));var moment=require(_0x8a10('0x4'));var BPromise=require(_0x8a10('0x5'));var Mustache=require(_0x8a10('0x6'));var util=require(_0x8a10('0x7'));var path=require(_0x8a10('0x8'));var sox=require(_0x8a10('0x9'));var csv=require(_0x8a10('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a10('0xb'));var squel=require(_0x8a10('0xc'));var crypto=require(_0x8a10('0xd'));var jsforce=require(_0x8a10('0xe'));var deskjs=require(_0x8a10('0xf'));var toCsv=require(_0x8a10('0xa'));var querystring=require(_0x8a10('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a10('0x11'));var authService=require(_0x8a10('0x12'));var qs=require(_0x8a10('0x13'));var as=require(_0x8a10('0x14'));var hardwareService=require(_0x8a10('0x15'));var logger=require(_0x8a10('0x16'))(_0x8a10('0x17'));var utils=require(_0x8a10('0x18'));var config=require(_0x8a10('0x19'));var licenseUtil=require(_0x8a10('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33245c,_0x55f66c){_0x55f66c=_0x55f66c||0xcc;return function(_0x2a90ff){if(_0x2a90ff){return _0x33245c['sendStatus'](_0x55f66c);}return _0x33245c[_0x8a10('0x1b')](_0x55f66c)[_0x8a10('0x1c')]();};}function respondWithResult(_0x30ecd1,_0x3b174c){_0x3b174c=_0x3b174c||0xc8;return function(_0x37edf9){if(_0x37edf9){return _0x30ecd1[_0x8a10('0x1b')](_0x3b174c)['json'](_0x37edf9);}};}function respondWithFilteredResult(_0x374ae2,_0x2ea070){return function(_0x90cd35){if(_0x90cd35){var _0x3de696=typeof _0x2ea070[_0x8a10('0x1d')]===_0x8a10('0x1e')&&typeof _0x2ea070['limit']===_0x8a10('0x1e');var _0x3677f3=_0x90cd35[_0x8a10('0x1f')];var _0x354238=_0x3de696?0x0:_0x2ea070['offset'];var _0x29e435=_0x3de696?_0x90cd35[_0x8a10('0x1f')]:_0x2ea070[_0x8a10('0x1d')]+_0x2ea070[_0x8a10('0x20')];var _0x1aa363;if(_0x29e435>=_0x3677f3){_0x29e435=_0x3677f3;_0x1aa363=0xc8;}else{_0x1aa363=0xce;}_0x374ae2[_0x8a10('0x1b')](_0x1aa363);return _0x374ae2[_0x8a10('0x21')](_0x8a10('0x22'),_0x354238+'-'+_0x29e435+'/'+_0x3677f3)[_0x8a10('0x23')](_0x90cd35);}return null;};}function patchUpdates(_0x425062){return function(_0x5284ee){try{jsonpatch[_0x8a10('0x24')](_0x5284ee,_0x425062,!![]);}catch(_0x59d4ad){return BPromise[_0x8a10('0x25')](_0x59d4ad);}return _0x5284ee[_0x8a10('0x26')]();};}function saveUpdates(_0x24c961,_0x19054e){return function(_0x3892e0){if(_0x3892e0){return _0x3892e0[_0x8a10('0x27')](_0x24c961)[_0x8a10('0x28')](function(_0x2cb74c){return _0x2cb74c;});}return null;};}function removeEntity(_0x170d17,_0x46484a){return function(_0x507c03){if(_0x507c03){return _0x507c03['destroy']()[_0x8a10('0x28')](function(){_0x170d17[_0x8a10('0x1b')](0xcc)[_0x8a10('0x1c')]();});}};}function handleEntityNotFound(_0x178753,_0x1bc5b6){return function(_0xdba658){if(!_0xdba658){_0x178753[_0x8a10('0x29')](0x194);}return _0xdba658;};}function handleError(_0x93fc4d,_0x573fd8){_0x573fd8=_0x573fd8||0x1f4;return function(_0x39406b){logger[_0x8a10('0x2a')](_0x39406b[_0x8a10('0x2b')]);if(_0x39406b[_0x8a10('0x2c')]){delete _0x39406b[_0x8a10('0x2c')];}_0x93fc4d[_0x8a10('0x1b')](_0x573fd8)[_0x8a10('0x2d')](_0x39406b);};}exports[_0x8a10('0x2e')]=function(_0xb5f0b3,_0xb27c2b){var _0x143a5c={},_0x32288f={},_0x55bc82={'count':0x0,'rows':[]};var _0x2a0572=_['map'](db[_0x8a10('0x2f')]['rawAttributes'],function(_0x5adbf7){return{'name':_0x5adbf7[_0x8a10('0x30')],'type':_0x5adbf7[_0x8a10('0x31')][_0x8a10('0x32')]};});_0x32288f[_0x8a10('0x33')]=_['map'](_0x2a0572,_0x8a10('0x2c'));_0x32288f[_0x8a10('0x34')]=_[_0x8a10('0x35')](_0xb5f0b3['query']);_0x32288f[_0x8a10('0x36')]=_[_0x8a10('0x37')](_0x32288f[_0x8a10('0x33')],_0x32288f[_0x8a10('0x34')]);_0x143a5c[_0x8a10('0x38')]=_[_0x8a10('0x37')](_0x32288f[_0x8a10('0x33')],qs[_0x8a10('0x39')](_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x39')]));_0x143a5c['attributes']=_0x143a5c[_0x8a10('0x38')][_0x8a10('0x3a')]?_0x143a5c['attributes']:_0x32288f[_0x8a10('0x33')];if(!_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x3b')](_0x8a10('0x3c'))){_0x143a5c[_0x8a10('0x20')]=qs[_0x8a10('0x20')](_0xb5f0b3['query']['limit']);_0x143a5c['offset']=qs[_0x8a10('0x1d')](_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x1d')]);}_0x143a5c['order']=qs[_0x8a10('0x3d')](_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x3d')]);_0x143a5c[_0x8a10('0x3e')]=qs[_0x8a10('0x36')](_[_0x8a10('0x3f')](_0xb5f0b3[_0x8a10('0x34')],_0x32288f['filters']),_0x2a0572);if(_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x40')]){_0x143a5c[_0x8a10('0x3e')]=_[_0x8a10('0x41')](_0x143a5c['where'],{'$or':_[_0x8a10('0x42')](_0x2a0572,function(_0x4586b6){if(_0x4586b6[_0x8a10('0x31')]!=='VIRTUAL'){var _0x556084={};_0x556084[_0x4586b6[_0x8a10('0x2c')]]={'$like':'%'+_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x40')]+'%'};return _0x556084;}})});}_0x143a5c=_['merge']({},_0x143a5c,_0xb5f0b3[_0x8a10('0x43')]);var _0x2c92ca={'where':_0x143a5c[_0x8a10('0x3e')]};return db[_0x8a10('0x2f')][_0x8a10('0x1f')](_0x2c92ca)[_0x8a10('0x28')](function(_0x2ceece){_0x55bc82[_0x8a10('0x1f')]=_0x2ceece;if(_0xb5f0b3[_0x8a10('0x34')][_0x8a10('0x44')]){_0x143a5c[_0x8a10('0x45')]=[{'all':!![]}];}return db[_0x8a10('0x2f')][_0x8a10('0x46')](_0x143a5c);})[_0x8a10('0x28')](function(_0x1c6c86){_0x55bc82[_0x8a10('0x47')]=_0x1c6c86;return _0x55bc82;})[_0x8a10('0x28')](respondWithFilteredResult(_0xb27c2b,_0x143a5c))[_0x8a10('0x48')](handleError(_0xb27c2b,null));};exports['show']=function(_0x239b57,_0x384f8e){var _0x4db42c={'raw':!![],'where':{'id':_0x239b57[_0x8a10('0x49')]['id']}},_0x4f63a0={};_0x4f63a0[_0x8a10('0x33')]=_[_0x8a10('0x35')](db[_0x8a10('0x2f')][_0x8a10('0x4a')]);_0x4f63a0[_0x8a10('0x34')]=_['keys'](_0x239b57[_0x8a10('0x34')]);_0x4f63a0['filters']=_[_0x8a10('0x37')](_0x4f63a0[_0x8a10('0x33')],_0x4f63a0[_0x8a10('0x34')]);_0x4db42c[_0x8a10('0x38')]=_['intersection'](_0x4f63a0[_0x8a10('0x33')],qs[_0x8a10('0x39')](_0x239b57[_0x8a10('0x34')]['fields']));_0x4db42c[_0x8a10('0x38')]=_0x4db42c[_0x8a10('0x38')][_0x8a10('0x3a')]?_0x4db42c[_0x8a10('0x38')]:_0x4f63a0[_0x8a10('0x33')];if(_0x239b57[_0x8a10('0x34')][_0x8a10('0x44')]){_0x4db42c[_0x8a10('0x45')]=[{'all':!![]}];}_0x4db42c=_[_0x8a10('0x41')]({},_0x4db42c,_0x239b57[_0x8a10('0x43')]);return db[_0x8a10('0x2f')][_0x8a10('0x4b')](_0x4db42c)[_0x8a10('0x28')](handleEntityNotFound(_0x384f8e,null))[_0x8a10('0x28')](respondWithResult(_0x384f8e,null))[_0x8a10('0x48')](handleError(_0x384f8e,null));};exports[_0x8a10('0x4c')]=function(_0x22682c,_0x1c96f4){return db[_0x8a10('0x2f')]['create'](_0x22682c['body'],{})['then'](respondWithResult(_0x1c96f4,0xc9))['catch'](handleError(_0x1c96f4,null));};exports[_0x8a10('0x4d')]=function(_0xa833b,_0xbf1cfd){return db[_0x8a10('0x2f')]['describe']()['then'](respondWithResult(_0xbf1cfd,null))[_0x8a10('0x48')](handleError(_0xbf1cfd,null));};exports['update']=function(_0x5b602f,_0x502475){if(_0x5b602f[_0x8a10('0x4e')][_0x8a10('0x4f')]){delete _0x5b602f[_0x8a10('0x4e')]['uniqueid'];}return db['CmHopperHistory'][_0x8a10('0x4b')]({'where':{'uniqueid':_0x5b602f['params']['id']}})[_0x8a10('0x28')](handleEntityNotFound(_0x502475,null))[_0x8a10('0x28')](saveUpdates(_0x5b602f['body'],null))[_0x8a10('0x28')](respondWithResult(_0x502475,null))['catch'](handleError(_0x502475,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f5e1391..42375e1 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 _0x6ac2=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','lodash','../../config/logger'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0x6ac2,0x184));var _0x26ac=function(_0x4d1cb2,_0x558095){_0x4d1cb2=_0x4d1cb2-0x0;var _0x4f83ce=_0x6ac2[_0x4d1cb2];return _0x4f83ce;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var logger=require(_0x26ac('0x1'))(_0x26ac('0x2'));var moment=require(_0x26ac('0x3'));var BPromise=require(_0x26ac('0x4'));var rp=require(_0x26ac('0x5'));var fs=require('fs');var path=require(_0x26ac('0x6'));var rimraf=require('rimraf');var config=require(_0x26ac('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x26ac('0x8')]=function(_0x4168ff,_0x1cc988){return _0x4168ff[_0x26ac('0x9')](_0x26ac('0xa'),attributes,{'tableName':_0x26ac('0xb'),'paranoid':![],'indexes':[{'name':_0x26ac('0xc'),'fields':[_0x26ac('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cda=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util'];(function(_0xa3d9a7,_0x1cf219){var _0x48080a=function(_0x43bead){while(--_0x43bead){_0xa3d9a7['push'](_0xa3d9a7['shift']());}};_0x48080a(++_0x1cf219);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var logger=require(_0xa8cd('0x1'))(_0xa8cd('0x2'));var moment=require(_0xa8cd('0x3'));var BPromise=require(_0xa8cd('0x4'));var rp=require(_0xa8cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8cd('0x6'));var config=require(_0xa8cd('0x7'));var attributes=require(_0xa8cd('0x8'));module['exports']=function(_0x80c199,_0x418e36){return _0x80c199[_0xa8cd('0x9')](_0xa8cd('0xa'),attributes,{'tableName':_0xa8cd('0xb'),'paranoid':![],'indexes':[{'name':_0xa8cd('0xc'),'fields':[_0xa8cd('0xc')]},{'name':_0xa8cd('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 fc581c9..32a16b2 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 _0x9e0d=['GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopperHistory','options','CreateCmHopperHistory','AvgHandleTime','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`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'];(function(_0x13ac0a,_0x4a2374){var _0x5400fd=function(_0x3b652f){while(--_0x3b652f){_0x13ac0a['push'](_0x13ac0a['shift']());}};_0x5400fd(++_0x4a2374);}(_0x9e0d,0xf7));var _0xd9e0=function(_0xc7ca44,_0x383f64){_0xc7ca44=_0xc7ca44-0x0;var _0x5154ff=_0x9e0d[_0xc7ca44];return _0x5154ff;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require(_0xd9e0('0x2'));var BPromise=require(_0xd9e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e0('0x4'));var db=require(_0xd9e0('0x5'))['db'];var utils=require(_0xd9e0('0x6'));var logger=require(_0xd9e0('0x7'))(_0xd9e0('0x8'));var config=require(_0xd9e0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce1e,_0x36d1c7,_0x3f8bb2){return new BPromise(function(_0x256df0,_0x3315d8){return client['request'](_0x28ce1e,_0x3f8bb2)[_0xd9e0('0xb')](function(_0x36e6e7){logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,_0xd9e0('0xe'));logger[_0xd9e0('0xf')](_0xd9e0('0x10'),_0x36d1c7,'request\x20sent',JSON[_0xd9e0('0x11')](_0x36e6e7));if(_0x36e6e7[_0xd9e0('0x12')]){if(_0x36e6e7['error'][_0xd9e0('0x13')]===0x1f4){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);return _0x3315d8(_0x36e6e7['error'][_0xd9e0('0x14')]);}logger['error'](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7['error'][_0xd9e0('0x14')]);return _0x256df0(_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);}else{logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,'request\x20sent');_0x256df0(_0x36e6e7['result']['message']);}})[_0xd9e0('0x15')](function(_0x386816){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x386816);_0x3315d8(_0x386816);});});}exports['CreateCmHopperHistory']=function(_0x209c04){var _0x56421e=this;return new Promise(function(_0x483b74,_0x2fcad6){return db[_0xd9e0('0x16')]['create'](_0x209c04['body'],{'raw':_0x209c04[_0xd9e0('0x17')]?_0x209c04[_0xd9e0('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd9e0('0xb')](function(_0x4cc3c9){logger[_0xd9e0('0xc')](_0xd9e0('0x18'),_0x209c04);logger[_0xd9e0('0xf')](_0xd9e0('0x18'),_0x209c04,JSON[_0xd9e0('0x11')](_0x4cc3c9));_0x483b74(_0x4cc3c9);})['catch'](function(_0x19534a){logger[_0xd9e0('0x12')]('CreateCmHopperHistory',_0x19534a[_0xd9e0('0x14')],_0x209c04);_0x2fcad6(_0x56421e[_0xd9e0('0x12')](0x1f4,_0x19534a['message']));});});};exports[_0xd9e0('0x19')]=function(_0x5e17d4){var _0x274815=this;return new Promise(function(_0x33a1ea,_0x48dbf9){return db[_0xd9e0('0x16')]['findAll']({'raw':_0x5e17d4['options']?_0x5e17d4['options'][_0xd9e0('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e17d4[_0xd9e0('0x17')]?_0x5e17d4[_0xd9e0('0x17')][_0xd9e0('0x1b')]||null:null,'attributes':[[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['col']('id')),_0xd9e0('0x1e')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x20')))),_0xd9e0('0x21')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db['sequelize'][_0xd9e0('0x1f')](_0xd9e0('0x22')))),_0xd9e0('0x23')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x24'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x25')))),_0xd9e0('0x26')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x24'),db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x27')))),_0xd9e0('0x28')]]})[_0xd9e0('0xb')](function(_0x514069){logger[_0xd9e0('0xc')](_0xd9e0('0x19'),_0x5e17d4);logger[_0xd9e0('0xf')](_0xd9e0('0x19'),_0x5e17d4,JSON['stringify'](_0x514069));_0x33a1ea(_0x514069);})[_0xd9e0('0x15')](function(_0x510829){logger[_0xd9e0('0x12')](_0xd9e0('0x19'),_0x510829[_0xd9e0('0x14')],_0x5e17d4);_0x48dbf9(_0x274815[_0xd9e0('0x12')](0x1f4,_0x510829[_0xd9e0('0x14')]));});});};exports[_0xd9e0('0x29')]=function(_0x19ff63){var _0x40a542=this;return new Promise(function(_0x4574fb,_0x5065f7){return db[_0xd9e0('0x16')][_0xd9e0('0x2a')]({'raw':_0x19ff63[_0xd9e0('0x17')]?_0x19ff63[_0xd9e0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19ff63[_0xd9e0('0x17')]?_0x19ff63[_0xd9e0('0x17')][_0xd9e0('0x1b')]||null:null,'attributes':[[_0xd9e0('0x2b'),_0xd9e0('0x2c')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x2d')))),_0xd9e0('0x2e')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')]['literal'](_0xd9e0('0x2f')))),_0xd9e0('0x30')],[db['sequelize']['fn'](_0xd9e0('0x1d'),db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x31')))),_0xd9e0('0x32')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xd9e0('0x1f')](_0xd9e0('0x33')))),_0xd9e0('0x34')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x35')))),_0xd9e0('0x36')],[db['sequelize']['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd9e0('0x37')],[db[_0xd9e0('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x38')))),_0xd9e0('0x39')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')]['literal'](_0xd9e0('0x3a')))),_0xd9e0('0x3b')],[db['sequelize']['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x3c')))),_0xd9e0('0x3d')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')](_0xd9e0('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')]['literal'](_0xd9e0('0x3f')))),_0xd9e0('0x40')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')][_0xd9e0('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0xd9e0('0x41')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db[_0xd9e0('0x1c')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xd9e0('0x40')],[db['sequelize']['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xd9e0('0x42')))),_0xd9e0('0x43')]],'group':[_0xd9e0('0x2b')]})['then'](function(_0x328d1a){logger['info'](_0xd9e0('0x29'),_0x19ff63);logger[_0xd9e0('0xf')](_0xd9e0('0x29'),_0x19ff63,JSON['stringify'](_0x328d1a));_0x4574fb(_0x328d1a);})[_0xd9e0('0x15')](function(_0x57d39d){logger[_0xd9e0('0x12')](_0xd9e0('0x29'),_0x57d39d['message'],_0x19ff63);_0x5065f7(_0x40a542[_0xd9e0('0x12')](0x1f4,_0x57d39d[_0xd9e0('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x43c7ad){var _0x35247f=this;return new Promise(function(_0x5adc9e,_0x2cc168){return db[_0xd9e0('0x16')]['findAll']({'raw':_0x43c7ad[_0xd9e0('0x17')]?_0x43c7ad[_0xd9e0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x43c7ad[_0xd9e0('0x17')]?_0x43c7ad[_0xd9e0('0x17')][_0xd9e0('0x1b')]||null:null,'attributes':[[_0xd9e0('0x2b'),_0xd9e0('0x2c')],[db[_0xd9e0('0x1c')]['fn'](_0xd9e0('0x1d'),db[_0xd9e0('0x1c')][_0xd9e0('0x44')]('id')),_0xd9e0('0x45')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd9e0('0x1c')]['literal'](_0xd9e0('0x31')))),_0xd9e0('0x46')]],'group':[_0xd9e0('0x2b')]})[_0xd9e0('0xb')](function(_0x5376f9){logger[_0xd9e0('0xc')](_0xd9e0('0x47'),_0x43c7ad);logger[_0xd9e0('0xf')](_0xd9e0('0x47'),_0x43c7ad,JSON[_0xd9e0('0x11')](_0x5376f9));_0x5adc9e(_0x5376f9);})['catch'](function(_0x202f56){logger[_0xd9e0('0x12')]('GetCampaignHopperHistory',_0x202f56[_0xd9e0('0x14')],_0x43c7ad);_0x2cc168(_0x35247f[_0xd9e0('0x12')](0x1f4,_0x202f56[_0xd9e0('0x14')]));});});}; \ No newline at end of file +var _0x0194=['name','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','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','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign'];(function(_0x2e5988,_0x482943){var _0x35080f=function(_0x56f09b){while(--_0x56f09b){_0x2e5988['push'](_0x2e5988['shift']());}};_0x35080f(++_0x482943);}(_0x0194,0xf1));var _0x4019=function(_0x4dcd50,_0x58dcef){_0x4dcd50=_0x4dcd50-0x0;var _0x4aac8f=_0x0194[_0x4dcd50];return _0x4aac8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4019('0x0'));var BPromise=require(_0x4019('0x1'));var rs=require(_0x4019('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4019('0x3'))['db'];var utils=require(_0x4019('0x4'));var logger=require(_0x4019('0x5'))(_0x4019('0x6'));var config=require(_0x4019('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4019('0x8')][_0x4019('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b47b6,_0x45b6d8,_0x5c4015){return new BPromise(function(_0x173f77,_0x598c33){return client[_0x4019('0xa')](_0x3b47b6,_0x5c4015)[_0x4019('0xb')](function(_0x2e09be){logger[_0x4019('0xc')](_0x4019('0xd'),_0x45b6d8,'request\x20sent');logger['debug'](_0x4019('0xe'),_0x45b6d8,_0x4019('0xf'),JSON[_0x4019('0x10')](_0x2e09be));if(_0x2e09be['error']){if(_0x2e09be['error'][_0x4019('0x11')]===0x1f4){logger[_0x4019('0x12')](_0x4019('0xd'),_0x45b6d8,_0x2e09be['error'][_0x4019('0x13')]);return _0x598c33(_0x2e09be[_0x4019('0x12')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x45b6d8,_0x2e09be[_0x4019('0x12')][_0x4019('0x13')]);return _0x173f77(_0x2e09be[_0x4019('0x12')]['message']);}else{logger[_0x4019('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x45b6d8,_0x4019('0xf'));_0x173f77(_0x2e09be['result']['message']);}})['catch'](function(_0x5f0371){logger[_0x4019('0x12')](_0x4019('0xd'),_0x45b6d8,_0x5f0371);_0x598c33(_0x5f0371);});});}exports[_0x4019('0x14')]=function(_0x4e28d1){var _0x439dac=this;return new Promise(function(_0x4b19ed,_0x2c7b18){return db[_0x4019('0x15')][_0x4019('0x16')](_0x4e28d1[_0x4019('0x17')],{'raw':_0x4e28d1[_0x4019('0x18')]?_0x4e28d1[_0x4019('0x18')][_0x4019('0x19')]===undefined?!![]:![]:!![]})[_0x4019('0xb')](function(_0x952060){logger[_0x4019('0xc')](_0x4019('0x14'),_0x4e28d1);logger[_0x4019('0x1a')](_0x4019('0x14'),_0x4e28d1,JSON[_0x4019('0x10')](_0x952060));_0x4b19ed(_0x952060);})[_0x4019('0x1b')](function(_0x123f61){logger[_0x4019('0x12')]('CreateCmHopperHistory',_0x123f61[_0x4019('0x13')],_0x4e28d1);_0x2c7b18(_0x439dac['error'](0x1f4,_0x123f61[_0x4019('0x13')]));});});};exports[_0x4019('0x1c')]=function(_0x492550){var _0x4b696f=this;return new Promise(function(_0x2083b2,_0x5f32c0){return db['CmHopperHistory']['findAll']({'raw':_0x492550[_0x4019('0x18')]?_0x492550[_0x4019('0x18')][_0x4019('0x19')]===undefined?!![]:![]:!![],'where':_0x492550[_0x4019('0x18')]?_0x492550[_0x4019('0x18')][_0x4019('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')][_0x4019('0x20')]('id')),_0x4019('0x21')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db['sequelize']['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x23')))),_0x4019('0x24')],[db[_0x4019('0x1f')]['fn']('COUNT',db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x4019('0x25')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x26')))),_0x4019('0x27')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x28'),db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x29')))),_0x4019('0x2a')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x28'),db[_0x4019('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x4019('0x2b')]]})[_0x4019('0xb')](function(_0x3cad04){logger[_0x4019('0xc')](_0x4019('0x1c'),_0x492550);logger[_0x4019('0x1a')](_0x4019('0x1c'),_0x492550,JSON['stringify'](_0x3cad04));_0x2083b2(_0x3cad04);})['catch'](function(_0x23be4e){logger[_0x4019('0x12')](_0x4019('0x1c'),_0x23be4e[_0x4019('0x13')],_0x492550);_0x5f32c0(_0x4b696f[_0x4019('0x12')](0x1f4,_0x23be4e[_0x4019('0x13')]));});});};exports[_0x4019('0x2c')]=function(_0x3d6757){var _0x536ad9=this;return new Promise(function(_0x3d7eb2,_0x2f6039){return db[_0x4019('0x15')][_0x4019('0x2d')]({'raw':_0x3d6757['options']?_0x3d6757['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d6757['options']?_0x3d6757[_0x4019('0x18')][_0x4019('0x1d')]||null:null,'attributes':[[_0x4019('0x2e'),_0x4019('0x2f')],[db['sequelize']['fn'](_0x4019('0x1e'),db['sequelize']['fn']('IF',db[_0x4019('0x1f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x30')))),'outboundNoAnswerCallsDay'],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x23')))),_0x4019('0x31')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db['sequelize'][_0x4019('0x22')](_0x4019('0x32')))),_0x4019('0x33')],[db['sequelize']['fn'](_0x4019('0x1e'),db['sequelize']['fn']('IF',db[_0x4019('0x1f')]['literal'](_0x4019('0x34')))),'outboundCongestionCallsDay'],[db[_0x4019('0x1f')]['fn']('COUNT',db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x35')))),_0x4019('0x36')],[db['sequelize']['fn']('COUNT',db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x37')))),_0x4019('0x38')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db['sequelize'][_0x4019('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x4019('0x39')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x3a')))),_0x4019('0x3b')],[db['sequelize']['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x3c')))),_0x4019('0x3d')],[db[_0x4019('0x1f')]['fn']('COUNT',db[_0x4019('0x1f')]['fn']('IF',db['sequelize'][_0x4019('0x22')](_0x4019('0x3e')))),_0x4019('0x3f')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db['sequelize'][_0x4019('0x22')](_0x4019('0x40')))),_0x4019('0x41')],[db[_0x4019('0x1f')]['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')]['fn']('IF',db['sequelize'][_0x4019('0x22')](_0x4019('0x42')))),_0x4019('0x3f')],[db[_0x4019('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4019('0x1f')][_0x4019('0x22')](_0x4019('0x43')))),_0x4019('0x44')]],'group':[_0x4019('0x2e')]})[_0x4019('0xb')](function(_0x229b9a){logger[_0x4019('0xc')]('GetVoiceQueueHopperHistory',_0x3d6757);logger[_0x4019('0x1a')](_0x4019('0x2c'),_0x3d6757,JSON['stringify'](_0x229b9a));_0x3d7eb2(_0x229b9a);})[_0x4019('0x1b')](function(_0x46fd78){logger[_0x4019('0x12')]('GetVoiceQueueHopperHistory',_0x46fd78[_0x4019('0x13')],_0x3d6757);_0x2f6039(_0x536ad9[_0x4019('0x12')](0x1f4,_0x46fd78['message']));});});};exports['GetCampaignHopperHistory']=function(_0x4a3736){var _0x35dff1=this;return new Promise(function(_0x5ae382,_0xbe8262){return db[_0x4019('0x15')][_0x4019('0x2d')]({'raw':_0x4a3736[_0x4019('0x18')]?_0x4a3736[_0x4019('0x18')][_0x4019('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3736[_0x4019('0x18')]?_0x4a3736[_0x4019('0x18')][_0x4019('0x1d')]||null:null,'attributes':[[_0x4019('0x2e'),_0x4019('0x2f')],[db['sequelize']['fn'](_0x4019('0x1e'),db[_0x4019('0x1f')][_0x4019('0x20')]('id')),_0x4019('0x45')],[db[_0x4019('0x1f')]['fn']('COUNT',db[_0x4019('0x1f')]['fn']('IF',db[_0x4019('0x1f')]['literal'](_0x4019('0x23')))),_0x4019('0x46')]],'group':['campaign']})[_0x4019('0xb')](function(_0x472f17){logger[_0x4019('0xc')](_0x4019('0x47'),_0x4a3736);logger[_0x4019('0x1a')]('GetCampaignHopperHistory',_0x4a3736,JSON[_0x4019('0x10')](_0x472f17));_0x5ae382(_0x472f17);})[_0x4019('0x1b')](function(_0x1c5ffc){logger['error'](_0x4019('0x47'),_0x1c5ffc[_0x4019('0x13')],_0x4a3736);_0xbe8262(_0x35dff1[_0x4019('0x12')](0x1f4,_0x1c5ffc[_0x4019('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 57eaa5c..62a4e0f 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 _0x858f=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','../../components/interaction/service','../../config/environment','get'];(function(_0x37184e,_0x432413){var _0xa78028=function(_0x1078d8){while(--_0x1078d8){_0x37184e['push'](_0x37184e['shift']());}};_0xa78028(++_0x432413);}(_0x858f,0x1e6));var _0xf858=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x858f[_0x316c42];return _0x2b38f7;};'use strict';var multer=require(_0xf858('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf858('0x1'));var config=require(_0xf858('0x2'));var controller=require('./cmHopperHistory.controller');router[_0xf858('0x3')]('/',auth[_0xf858('0x4')](),controller[_0xf858('0x5')]);router[_0xf858('0x3')](_0xf858('0x6'),auth[_0xf858('0x4')](),controller[_0xf858('0x7')]);router[_0xf858('0x3')](_0xf858('0x8'),auth[_0xf858('0x4')](),controller['show']);router[_0xf858('0x9')]('/',auth[_0xf858('0x4')](),controller[_0xf858('0xa')]);router[_0xf858('0xb')](_0xf858('0x8'),auth[_0xf858('0x4')](),controller[_0xf858('0xc')]);module[_0xf858('0xd')]=router; \ No newline at end of file +var _0x723c=['isAuthenticated','show','post','create','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./cmHopperHistory.controller','get','/describe','describe','/:id'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x723c,0x193));var _0xc723=function(_0x26c28c,_0x43e7ad){_0x26c28c=_0x26c28c-0x0;var _0x2ed205=_0x723c[_0x26c28c];return _0x2ed205;};'use strict';var multer=require('multer');var util=require(_0xc723('0x0'));var path=require(_0xc723('0x1'));var timeout=require(_0xc723('0x2'));var express=require('express');var router=express[_0xc723('0x3')]();var fs_extra=require(_0xc723('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc723('0x5'));var controller=require(_0xc723('0x6'));router[_0xc723('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc723('0x7')](_0xc723('0x8'),auth['isAuthenticated'](),controller[_0xc723('0x9')]);router[_0xc723('0x7')](_0xc723('0xa'),auth[_0xc723('0xb')](),controller[_0xc723('0xc')]);router[_0xc723('0xd')]('/',auth['isAuthenticated'](),controller[_0xc723('0xe')]);router[_0xc723('0xf')]('/:id',auth[_0xc723('0xb')](),controller[_0xc723('0x10')]);module[_0xc723('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 20733d3..79c6dc4 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 _0xeddd=['name','sequelize','exports','STRING'];(function(_0x495dc6,_0x35e571){var _0x2959e9=function(_0x1f6ebc){while(--_0x1f6ebc){_0x495dc6['push'](_0x495dc6['shift']());}};_0x2959e9(++_0x35e571);}(_0xeddd,0x69));var _0xdedd=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xeddd[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'name':{'type':Sequelize[_0xdedd('0x2')],'unique':_0xdedd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xdedd('0x2')]}}; \ No newline at end of file +var _0xfd0f=['sequelize','exports','name','STRING'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x4b5e7d,_0x1c30d5){_0x4b5e7d=_0x4b5e7d-0x0;var _0x3d4330=_0xfd0f[_0x4b5e7d];return _0x3d4330;};'use strict';var Sequelize=require(_0xffd0('0x0'));module[_0xffd0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xffd0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xffd0('0x3')]},'dialPrefix':{'type':Sequelize[_0xffd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 673ee83..def7691 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 _0x20b6=['format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','get','end','error','stack','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ListId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x20b6,0x17a));var _0x620b=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0x20b6[_0x20118a];return _0x538b5f;};'use strict';var emlformat=require(_0x620b('0x0'));var rimraf=require(_0x620b('0x1'));var zipdir=require(_0x620b('0x2'));var jsonpatch=require(_0x620b('0x3'));var rp=require(_0x620b('0x4'));var moment=require(_0x620b('0x5'));var BPromise=require(_0x620b('0x6'));var Mustache=require(_0x620b('0x7'));var util=require(_0x620b('0x8'));var path=require(_0x620b('0x9'));var sox=require(_0x620b('0xa'));var csv=require(_0x620b('0xb'));var ejs=require(_0x620b('0xc'));var fs=require('fs');var fs_extra=require(_0x620b('0xd'));var _=require(_0x620b('0xe'));var squel=require('squel');var crypto=require(_0x620b('0xf'));var jsforce=require(_0x620b('0x10'));var deskjs=require(_0x620b('0x11'));var toCsv=require(_0x620b('0xb'));var querystring=require(_0x620b('0x12'));var Papa=require(_0x620b('0x13'));var Redis=require(_0x620b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x620b('0x15'));var as=require(_0x620b('0x16'));var hardwareService=require(_0x620b('0x17'));var logger=require(_0x620b('0x18'))(_0x620b('0x19'));var utils=require(_0x620b('0x1a'));var config=require(_0x620b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x620b('0x1c'))['db'];var csv_results;config[_0x620b('0x1d')]=_[_0x620b('0x1e')](config[_0x620b('0x1d')],{'host':_0x620b('0x1f'),'port':0x18eb});var socket=require(_0x620b('0x20'))(new Redis(config[_0x620b('0x1d')]));require(_0x620b('0x21'))[_0x620b('0x22')](socket);function respondWithStatusCode(_0x32195a,_0x36f310){_0x36f310=_0x36f310||0xcc;return function(_0x12c46a){if(_0x12c46a){return _0x32195a[_0x620b('0x23')](_0x36f310);}return _0x32195a[_0x620b('0x24')](_0x36f310)['end']();};}function respondWithResult(_0x1a1f3c,_0x8e7679){_0x8e7679=_0x8e7679||0xc8;return function(_0x4c27f3){if(_0x4c27f3){return _0x1a1f3c[_0x620b('0x24')](_0x8e7679)['json'](_0x4c27f3);}};}function respondWithFilteredResult(_0x23ac2f,_0x15d351){return function(_0x36a4a2){if(_0x36a4a2){var _0x42ea3d=typeof _0x15d351[_0x620b('0x25')]===_0x620b('0x26')&&typeof _0x15d351[_0x620b('0x27')]===_0x620b('0x26');var _0x45f6d2=_0x36a4a2[_0x620b('0x28')];var _0x5817ea=_0x42ea3d?0x0:_0x15d351['offset'];var _0x426dcb=_0x42ea3d?_0x36a4a2[_0x620b('0x28')]:_0x15d351[_0x620b('0x25')]+_0x15d351[_0x620b('0x27')];var _0x19cdf2;if(_0x426dcb>=_0x45f6d2){_0x426dcb=_0x45f6d2;_0x19cdf2=0xc8;}else{_0x19cdf2=0xce;}_0x23ac2f[_0x620b('0x24')](_0x19cdf2);return _0x23ac2f[_0x620b('0x29')](_0x620b('0x2a'),_0x5817ea+'-'+_0x426dcb+'/'+_0x45f6d2)[_0x620b('0x2b')](_0x36a4a2);}return null;};}function patchUpdates(_0x3e3bbe){return function(_0x202aa0){try{jsonpatch['apply'](_0x202aa0,_0x3e3bbe,!![]);}catch(_0x5a469e){return BPromise[_0x620b('0x2c')](_0x5a469e);}return _0x202aa0[_0x620b('0x2d')]();};}function saveUpdates(_0x133eee,_0x4631a1){return function(_0x71dae3){if(_0x71dae3){return _0x71dae3['update'](_0x133eee)[_0x620b('0x2e')](function(_0x533c96){return _0x533c96;});}return null;};}function removeEntity(_0x3a29ce,_0x26c8ff){return function(_0x577aea){if(_0x577aea){return _0x577aea[_0x620b('0x2f')]()[_0x620b('0x2e')](function(){var _0x7f0857=_0x577aea[_0x620b('0x30')]({'plain':!![]});var _0x5f1c87='Lists';return db['UserProfileResource'][_0x620b('0x2f')]({'where':{'type':_0x5f1c87,'resourceId':_0x7f0857['id']}})[_0x620b('0x2e')](function(){return _0x577aea;});})['then'](function(){_0x3a29ce[_0x620b('0x24')](0xcc)[_0x620b('0x31')]();});}};}function handleEntityNotFound(_0x1df440,_0x40050f){return function(_0x4cd1db){if(!_0x4cd1db){_0x1df440['sendStatus'](0x194);}return _0x4cd1db;};}function handleError(_0xecd22a,_0x261ddd){_0x261ddd=_0x261ddd||0x1f4;return function(_0x20fd54){logger[_0x620b('0x32')](_0x20fd54[_0x620b('0x33')]);if(_0x20fd54['name']){delete _0x20fd54['name'];}_0xecd22a[_0x620b('0x24')](_0x261ddd)['send'](_0x20fd54);};}exports['index']=function(_0x5bdd8b,_0xa7e1a5){var _0x6bdc64={},_0x4ce5fb={},_0x4d0822={'count':0x0,'rows':[]};var _0x4d8e59=_[_0x620b('0x34')](db['CmList'][_0x620b('0x35')],function(_0x3fa94e){return{'name':_0x3fa94e[_0x620b('0x36')],'type':_0x3fa94e[_0x620b('0x37')][_0x620b('0x38')]};});_0x4ce5fb[_0x620b('0x39')]=_[_0x620b('0x34')](_0x4d8e59,_0x620b('0x3a'));_0x4ce5fb['query']=_[_0x620b('0x3b')](_0x5bdd8b[_0x620b('0x3c')]);_0x4ce5fb[_0x620b('0x3d')]=_[_0x620b('0x3e')](_0x4ce5fb['model'],_0x4ce5fb[_0x620b('0x3c')]);_0x6bdc64[_0x620b('0x3f')]=_[_0x620b('0x3e')](_0x4ce5fb[_0x620b('0x39')],qs['fields'](_0x5bdd8b['query'][_0x620b('0x40')]));_0x6bdc64[_0x620b('0x3f')]=_0x6bdc64[_0x620b('0x3f')]['length']?_0x6bdc64['attributes']:_0x4ce5fb[_0x620b('0x39')];if(!_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x41')](_0x620b('0x42'))){_0x6bdc64[_0x620b('0x27')]=qs['limit'](_0x5bdd8b[_0x620b('0x3c')]['limit']);_0x6bdc64[_0x620b('0x25')]=qs[_0x620b('0x25')](_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x25')]);}_0x6bdc64[_0x620b('0x43')]=qs[_0x620b('0x44')](_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x44')]);_0x6bdc64[_0x620b('0x45')]=qs[_0x620b('0x3d')](_[_0x620b('0x46')](_0x5bdd8b[_0x620b('0x3c')],_0x4ce5fb['filters']),_0x4d8e59);if(_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x47')]){_0x6bdc64[_0x620b('0x45')]=_[_0x620b('0x48')](_0x6bdc64[_0x620b('0x45')],{'$or':_[_0x620b('0x34')](_0x4d8e59,function(_0x4317ad){if(_0x4317ad[_0x620b('0x37')]!==_0x620b('0x49')){var _0x400420={};_0x400420[_0x4317ad[_0x620b('0x3a')]]={'$like':'%'+_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x47')]+'%'};return _0x400420;}})});}_0x6bdc64=_[_0x620b('0x48')]({},_0x6bdc64,_0x5bdd8b[_0x620b('0x4a')]);var _0x218f72={'where':_0x6bdc64[_0x620b('0x45')]};return db[_0x620b('0x4b')][_0x620b('0x28')](_0x218f72)['then'](function(_0x37cffb){_0x4d0822['count']=_0x37cffb;if(_0x5bdd8b[_0x620b('0x3c')][_0x620b('0x4c')]){_0x6bdc64[_0x620b('0x4d')]=[{'all':!![]}];}return db['CmList'][_0x620b('0x4e')](_0x6bdc64);})['then'](function(_0x23383f){_0x4d0822['rows']=_0x23383f;return _0x4d0822;})[_0x620b('0x2e')](respondWithFilteredResult(_0xa7e1a5,_0x6bdc64))[_0x620b('0x4f')](handleError(_0xa7e1a5,null));};exports[_0x620b('0x50')]=function(_0x3bc7e3,_0x4cdd9e){var _0x11b50b={'raw':![],'where':{'id':_0x3bc7e3[_0x620b('0x51')]['id']}},_0x154c2c={};_0x154c2c['model']=_[_0x620b('0x3b')](db[_0x620b('0x4b')][_0x620b('0x35')]);_0x154c2c[_0x620b('0x3c')]=_[_0x620b('0x3b')](_0x3bc7e3[_0x620b('0x3c')]);_0x154c2c['filters']=_[_0x620b('0x3e')](_0x154c2c[_0x620b('0x39')],_0x154c2c['query']);_0x11b50b[_0x620b('0x3f')]=_[_0x620b('0x3e')](_0x154c2c['model'],qs['fields'](_0x3bc7e3['query'][_0x620b('0x40')]));_0x11b50b[_0x620b('0x3f')]=_0x11b50b[_0x620b('0x3f')][_0x620b('0x52')]?_0x11b50b['attributes']:_0x154c2c[_0x620b('0x39')];if(_0x3bc7e3[_0x620b('0x3c')][_0x620b('0x4c')]){_0x11b50b[_0x620b('0x4d')]=[{'all':!![]}];}_0x11b50b=_[_0x620b('0x48')]({},_0x11b50b,_0x3bc7e3[_0x620b('0x4a')]);return db[_0x620b('0x4b')][_0x620b('0x53')](_0x11b50b)[_0x620b('0x2e')](handleEntityNotFound(_0x4cdd9e,null))[_0x620b('0x2e')](respondWithResult(_0x4cdd9e,null))[_0x620b('0x4f')](handleError(_0x4cdd9e,null));};exports[_0x620b('0x54')]=function(_0x4a5375,_0x24e316){return db[_0x620b('0x4b')][_0x620b('0x54')](_0x4a5375[_0x620b('0x55')],{})[_0x620b('0x2e')](function(_0x433d26){var _0x46ddfb=_0x4a5375[_0x620b('0x56')][_0x620b('0x30')]({'plain':!![]});if(!_0x46ddfb)throw new Error(_0x620b('0x57'));if(_0x46ddfb[_0x620b('0x58')]==='user'){var _0x288644=_0x433d26[_0x620b('0x30')]({'plain':!![]});var _0x53179b=_0x620b('0x59');return db[_0x620b('0x5a')]['find']({'where':{'name':_0x53179b,'userProfileId':_0x46ddfb[_0x620b('0x5b')]},'raw':!![]})['then'](function(_0x5ad8f7){if(_0x5ad8f7&&_0x5ad8f7['autoAssociation']===0x0){return db['UserProfileResource'][_0x620b('0x54')]({'name':_0x288644[_0x620b('0x3a')],'resourceId':_0x288644['id'],'type':_0x5ad8f7[_0x620b('0x3a')],'sectionId':_0x5ad8f7['id']},{})[_0x620b('0x2e')](function(){return _0x433d26;});}else{return _0x433d26;}})[_0x620b('0x4f')](function(_0x11a97e){logger[_0x620b('0x32')](_0x620b('0x5c'),_0x11a97e);throw _0x11a97e;});}return _0x433d26;})[_0x620b('0x2e')](respondWithResult(_0x24e316,0xc9))[_0x620b('0x4f')](handleError(_0x24e316,null));};exports[_0x620b('0x5d')]=function(_0x1d908c,_0x2b6e60){if(_0x1d908c[_0x620b('0x55')]['id']){delete _0x1d908c['body']['id'];}return db[_0x620b('0x4b')][_0x620b('0x53')]({'where':{'id':_0x1d908c[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x2b6e60,null))['then'](saveUpdates(_0x1d908c[_0x620b('0x55')],null))['then'](respondWithResult(_0x2b6e60,null))[_0x620b('0x4f')](handleError(_0x2b6e60,null));};exports[_0x620b('0x2f')]=function(_0x1f2a24,_0x1a2a57){return db[_0x620b('0x4b')]['find']({'where':{'id':_0x1f2a24[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x1a2a57,null))['then'](removeEntity(_0x1a2a57,null))[_0x620b('0x4f')](handleError(_0x1a2a57,null));};exports[_0x620b('0x5e')]=function(_0x153980,_0x139235){return db[_0x620b('0x4b')][_0x620b('0x5e')]()[_0x620b('0x2e')](respondWithResult(_0x139235,null))[_0x620b('0x4f')](handleError(_0x139235,null));};exports['addDisposition']=function(_0x35e051,_0x1da53d,_0x15ce8d){if(_0x35e051[_0x620b('0x55')]['id']){delete _0x35e051[_0x620b('0x55')]['id'];}return db['CmList'][_0x620b('0x53')]({'where':{'id':_0x35e051[_0x620b('0x51')]['id']}})['then'](handleEntityNotFound(_0x1da53d,null))[_0x620b('0x2e')](function(_0x77720a){if(_0x77720a){_0x35e051['body'][_0x620b('0x5f')]=_0x77720a['id'];return db[_0x620b('0x60')][_0x620b('0x54')](_0x35e051[_0x620b('0x55')]);}})[_0x620b('0x2e')](respondWithResult(_0x1da53d,null))['catch'](handleError(_0x1da53d,null));};exports[_0x620b('0x61')]=function(_0x136adc,_0x424007,_0x4215f2){var _0x357a1f={'raw':![],'where':{}};var _0x2334d3={};var _0x51c71c={'count':0x0,'rows':[]};return db[_0x620b('0x4b')][_0x620b('0x62')]({'where':{'id':_0x136adc[_0x620b('0x51')]['id']}})['then'](handleEntityNotFound(_0x424007,null))[_0x620b('0x2e')](function(_0x1f480c){if(_0x1f480c){_0x2334d3[_0x620b('0x39')]=_[_0x620b('0x3b')](db[_0x620b('0x60')][_0x620b('0x35')]);_0x2334d3[_0x620b('0x3c')]=_['keys'](_0x136adc['query']);_0x2334d3[_0x620b('0x3d')]=_[_0x620b('0x3e')](_0x2334d3[_0x620b('0x39')],_0x2334d3['query']);_0x357a1f[_0x620b('0x3f')]=_[_0x620b('0x3e')](_0x2334d3[_0x620b('0x39')],qs[_0x620b('0x40')](_0x136adc[_0x620b('0x3c')][_0x620b('0x40')]));_0x357a1f[_0x620b('0x3f')]=_0x357a1f[_0x620b('0x3f')][_0x620b('0x52')]?_0x357a1f[_0x620b('0x3f')]:_0x2334d3[_0x620b('0x39')];if(!_0x136adc[_0x620b('0x3c')]['hasOwnProperty'](_0x620b('0x42'))){_0x357a1f['limit']=qs[_0x620b('0x27')](_0x136adc['query'][_0x620b('0x27')]);_0x357a1f[_0x620b('0x25')]=qs['offset'](_0x136adc[_0x620b('0x3c')][_0x620b('0x25')]);}_0x357a1f['order']=qs[_0x620b('0x44')](_0x136adc[_0x620b('0x3c')]['sort']);_0x357a1f[_0x620b('0x45')]=qs[_0x620b('0x3d')](_[_0x620b('0x46')](_0x136adc[_0x620b('0x3c')],_0x2334d3[_0x620b('0x3d')]));_0x357a1f[_0x620b('0x45')][_0x620b('0x5f')]=_0x1f480c['id'];if(_0x136adc[_0x620b('0x3c')][_0x620b('0x47')]){_0x357a1f['where']=_[_0x620b('0x48')](_0x357a1f[_0x620b('0x45')],{'$or':_[_0x620b('0x34')](_0x357a1f[_0x620b('0x3f')],function(_0x54c71c){var _0x4c33a8={};_0x4c33a8[_0x54c71c]={'$like':'%'+_0x136adc[_0x620b('0x3c')]['filter']+'%'};return _0x4c33a8;})});}_0x357a1f=_[_0x620b('0x48')]({},_0x357a1f,_0x136adc[_0x620b('0x4a')]);return db[_0x620b('0x60')][_0x620b('0x28')]({'where':_0x357a1f[_0x620b('0x45')]})['then'](function(_0x139a80){_0x51c71c[_0x620b('0x28')]=_0x139a80;if(_0x136adc['query'][_0x620b('0x4c')]){_0x357a1f[_0x620b('0x4d')]=[{'all':!![]}];}return db[_0x620b('0x60')]['findAll'](_0x357a1f);})['then'](function(_0x46e5d0){_0x51c71c[_0x620b('0x63')]=_0x46e5d0;return _0x51c71c;});}})[_0x620b('0x2e')](respondWithFilteredResult(_0x424007,_0x357a1f))[_0x620b('0x4f')](handleError(_0x424007,null));};exports[_0x620b('0x64')]=function(_0x49257a,_0x40a396,_0xb6172a){return db[_0x620b('0x4b')][_0x620b('0x53')]({'where':{'id':_0x49257a[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x40a396,null))['then'](function(_0x4d05a3){if(_0x4d05a3){return _0x4d05a3[_0x620b('0x64')](_0x49257a[_0x620b('0x3c')][_0x620b('0x65')]);}})['then'](respondWithStatusCode(_0x40a396,null))['catch'](handleError(_0x40a396,null));};exports['addContacts']=function(_0x5efb9f,_0x532fb3,_0x42fd90){return db[_0x620b('0x4b')][_0x620b('0x53')]({'where':{'id':_0x5efb9f[_0x620b('0x51')]['id']}})['then'](handleEntityNotFound(_0x532fb3,null))[_0x620b('0x2e')](function(_0x2f35ea){if(_0x2f35ea){var _0x2b89f9=[];var _0x2f763f={'success':[],'errors':[]};return db[_0x620b('0x66')]['describe']()[_0x620b('0x2e')](function(_0x266f6b){if(_0x5efb9f[_0x620b('0x55')][_0x620b('0x67')]&&_[_0x620b('0x68')](_0x5efb9f[_0x620b('0x55')][_0x620b('0x67')])){if(_0x5efb9f[_0x620b('0x55')][_0x620b('0x67')]['length']){_0x5efb9f[_0x620b('0x55')]['tags']=_0x5efb9f[_0x620b('0x55')][_0x620b('0x67')][_0x620b('0x69')](';')+';';}else{_0x5efb9f[_0x620b('0x55')]['tags']=null;}}else{_0x5efb9f[_0x620b('0x55')][_0x620b('0x67')]=null;}if(_0x5efb9f[_0x620b('0x55')]&&_[_0x620b('0x68')](_0x5efb9f['body'])){for(var _0x3add4a=0x0;_0x3add4a<_0x5efb9f[_0x620b('0x55')][_0x620b('0x52')];_0x3add4a+=0x1){_0x5efb9f[_0x620b('0x55')][_0x3add4a][_0x620b('0x5f')]=_0x5efb9f[_0x620b('0x51')]['id'];_0x2b89f9[_0x620b('0x6a')](_0x5efb9f['body'][_0x3add4a]);}return BPromise[_0x620b('0x6b')](_0x2b89f9,function(_0xe7106f){return db[_0x620b('0x66')][_0x620b('0x54')](_[_0x620b('0x6c')](_0xe7106f,[_0x620b('0x65'),'id'])||{},{'fields':_[_0x620b('0x3b')](_0x266f6b),'raw':!![]})[_0x620b('0x2e')](function(_0x5cd233){_0x2f763f[_0x620b('0x6d')]['push'](_0x5cd233[_0x620b('0x6e')]);})[_0x620b('0x4f')](function(_0x543551){_0x2f763f[_0x620b('0x6f')][_0x620b('0x6a')]({'data':_0xe7106f,'error':_0x543551[_0x620b('0x70')]});});})['then'](function(_0x2f8e2f){return _0x2f763f;})[_0x620b('0x4f')](function(_0x251af3){return _0x251af3;});}else{_0x532fb3[_0x620b('0x24')](0x190)[_0x620b('0x2b')]({'message':_0x620b('0x71')});}});}})[_0x620b('0x2e')](respondWithResult(_0x532fb3,null))[_0x620b('0x4f')](handleError(_0x532fb3,null));};exports['getContacts']=function(_0x33e0cc,_0x3740e4,_0x5ea9f7){var _0x3b89fc;return db['CmList']['find']({'where':{'id':_0x33e0cc[_0x620b('0x51')]['id']},'include':[{'model':db[_0x620b('0x72')],'as':_0x620b('0x73')}]})[_0x620b('0x2e')](handleEntityNotFound(_0x3740e4,null))[_0x620b('0x2e')](function(_0x1fbf2e){if(_0x1fbf2e){_0x3b89fc=_0x1fbf2e;return db['CmContact'][_0x620b('0x35')];}})[_0x620b('0x2e')](function(_0x348828){if(_0x348828){var _0x41c5f6={};var _0x6f1ae2={};_0x6f1ae2[_0x620b('0x39')]=_[_0x620b('0x74')](_['keys'](_0x348828),_[_0x620b('0x34')](_0x3b89fc[_0x620b('0x73')],function(_0x314536){return util['format'](_0x620b('0x75'),_0x314536['id']);}));_0x6f1ae2[_0x620b('0x3c')]=_[_0x620b('0x3b')](_0x33e0cc['query']);_0x6f1ae2['filters']=_[_0x620b('0x3e')](_0x6f1ae2[_0x620b('0x39')],_0x6f1ae2[_0x620b('0x3c')]);_0x41c5f6[_0x620b('0x3f')]=_[_0x620b('0x3e')](_0x6f1ae2[_0x620b('0x39')],qs[_0x620b('0x40')](_0x33e0cc['query'][_0x620b('0x40')]));_0x41c5f6[_0x620b('0x3f')]=_0x41c5f6[_0x620b('0x3f')][_0x620b('0x52')]?_0x41c5f6[_0x620b('0x3f')]:_0x6f1ae2[_0x620b('0x39')];if(!_0x33e0cc[_0x620b('0x3c')]['hasOwnProperty'](_0x620b('0x42'))){_0x41c5f6[_0x620b('0x27')]=qs[_0x620b('0x27')](_0x33e0cc[_0x620b('0x3c')][_0x620b('0x27')]);_0x41c5f6[_0x620b('0x25')]=qs[_0x620b('0x25')](_0x33e0cc[_0x620b('0x3c')][_0x620b('0x25')]);}_0x41c5f6[_0x620b('0x43')]=qs[_0x620b('0x44')](_0x33e0cc[_0x620b('0x3c')]['sort']);_0x41c5f6[_0x620b('0x45')]=qs[_0x620b('0x3d')](_[_0x620b('0x46')](_0x33e0cc[_0x620b('0x3c')],_0x6f1ae2['filters']));_0x41c5f6[_0x620b('0x76')]=!![];if(_0x33e0cc[_0x620b('0x3c')][_0x620b('0x47')]){_0x41c5f6[_0x620b('0x45')]=_[_0x620b('0x48')](_0x41c5f6[_0x620b('0x45')],{'$or':_['map'](_0x41c5f6[_0x620b('0x3f')],function(_0x500498){var _0x221c9d={};_0x221c9d[_0x500498]={'$like':'%'+_0x33e0cc[_0x620b('0x3c')][_0x620b('0x47')]+'%'};return _0x221c9d;})});}_0x41c5f6=_[_0x620b('0x48')]({},_0x41c5f6,_0x33e0cc['options']);return _0x3b89fc['getContacts'](_0x41c5f6);}})['then'](respondWithResult(_0x3740e4,null))[_0x620b('0x4f')](handleError(_0x3740e4,null));};exports['getContactsCsv']=function(_0x4abdc8,_0x305f1a,_0x3c2a7c){var _0x8ef726;var _0x1cdfd3;var _0x1b1da1;var _0x8ceb5c=_0x4abdc8[_0x620b('0x51')]['id'];csv_results=[];return db[_0x620b('0x77')][_0x620b('0x4e')]({'attributes':['id','name'],'raw':!![],'order':[_0x620b('0x78')]})[_0x620b('0x2e')](function(_0x246db2){_0x8ef726=_0x246db2;var _0x501a41=_['keys'](db[_0x620b('0x66')]['rawAttributes']);return db[_0x620b('0x72')][_0x620b('0x4e')]({'raw':!![],'attributes':['id',_0x620b('0x79')]})[_0x620b('0x2e')](function(_0x43871a){_0x1cdfd3=_0x43871a;var _0x2a0a29=squel[_0x620b('0x7a')]()[_0x620b('0x40')](_0x501a41)[_0x620b('0x7b')](_0x620b('0x7c'),'c')['where'](_0x620b('0x7d'),_0x8ceb5c)[_0x620b('0x45')]('c.deletedAt\x20is\x20null')[_0x620b('0x7e')]();for(var _0x15c4ef=0x0;_0x15c4ef<_0x1cdfd3[_0x620b('0x52')];_0x15c4ef++){_0x2a0a29[_0x620b('0x7f')](_0x620b('0x80')+_0x1cdfd3[_0x15c4ef]['id'],'customField_'+_0x1cdfd3[_0x15c4ef]['alias']);}for(var _0x15c4ef=0x0;_0x15c4ef<_0x8ef726[_0x620b('0x52')];_0x15c4ef++){_0x2a0a29[_0x620b('0x7f')](squel[_0x620b('0x7a')]()[_0x620b('0x7f')](_0x620b('0x81'))[_0x620b('0x7b')](_0x620b('0x82'))[_0x620b('0x45')](_0x620b('0x83'),_0x8ef726[_0x15c4ef]['id'])['where']('CmContactId\x20=\x20c.id'),_0x620b('0x84')+_0x8ef726[_0x15c4ef][_0x620b('0x3a')]);_0x2a0a29[_0x620b('0x7f')](squel['select']()[_0x620b('0x7f')]('description')[_0x620b('0x7b')](_0x620b('0x82'))[_0x620b('0x45')](_0x620b('0x83'),_0x8ef726[_0x15c4ef]['id'])[_0x620b('0x45')](_0x620b('0x85')),_0x620b('0x86')+_0x8ef726[_0x15c4ef][_0x620b('0x3a')]);}var _0x55d5fb=[];_0x55d5fb[_0x620b('0x6a')](_0x2a0a29['toString']());BPromise['each'](_0x55d5fb,handleQuery)[_0x620b('0x2e')](function(_0x48fbbf){handleQuery(_0x2a0a29[_0x620b('0x87')]());var _0x41630a=csv_results[0x0];if(!_['isEmpty'](_0x41630a)){var _0x1adb44=toCsv(_0x41630a);var _0x4a9021=Date[_0x620b('0x88')]();fs[_0x620b('0x89')](util[_0x620b('0x8a')](_0x620b('0x8b'),_0x8ceb5c,_0x4a9021),_0x1adb44);_0x305f1a[_0x620b('0x8c')](_0x620b('0x8d'),_0x620b('0x8e')+util['format'](_0x620b('0x8f'),_0x8ceb5c,_0x4a9021));_0x305f1a[_0x620b('0x8c')](_0x620b('0x90'),_0x620b('0x91'));return _0x305f1a[_0x620b('0x92')](util[_0x620b('0x8a')]('/tmp/list_%d_%s.csv',_0x8ceb5c,_0x4a9021));}else{return _0x305f1a[_0x620b('0x23')](0xcc);}});});});};exports[_0x620b('0x93')]=function(_0x5af63b,_0x16d923,_0x3d015d){var _0x47db35;delete _0x5af63b['body']['id'];return db[_0x620b('0x4b')][_0x620b('0x62')]({'where':{'id':_0x5af63b[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x16d923,null))['then'](function(_0x4bb606){if(_0x4bb606){return db[_0x620b('0x94')][_0x620b('0x95')](function(_0x317613){return db[_0x620b('0x72')][_0x620b('0x54')](_0x5af63b[_0x620b('0x55')],{'transaction':_0x317613})[_0x620b('0x2e')](function(_0x21a44b){_0x47db35=_0x21a44b;return _0x4bb606['addCustomFields'](_0x21a44b,{'transaction':_0x317613});})[_0x620b('0x2e')](function(){var _0x2d5194={'type':db[_0x620b('0x96')][_0x620b('0x97')],'transaction':_0x317613};switch(_0x5af63b[_0x620b('0x55')][_0x620b('0x37')]){case _0x620b('0x98'):_0x2d5194[_0x620b('0x37')]=db['Sequelize'][_0x620b('0x97')];break;case _0x620b('0x99'):_0x2d5194[_0x620b('0x37')]=db[_0x620b('0x96')][_0x620b('0x9a')];break;case _0x620b('0x9b'):_0x2d5194[_0x620b('0x37')]=db['Sequelize'][_0x620b('0x9c')];_0x2d5194[_0x620b('0x9d')]=![];break;default:}return db['sequelize'][_0x620b('0x9e')][_0x620b('0x9f')]('cm_contacts',util[_0x620b('0x8a')](_0x620b('0xa0'),_0x47db35['id']),_0x2d5194);})[_0x620b('0x2e')](function(){return _0x47db35;});});}})['then'](respondWithResult(_0x16d923,null))[_0x620b('0x4f')](handleError(_0x16d923,null));};exports[_0x620b('0xa1')]=function(_0xc90149,_0x412155,_0x32dc2e){var _0x41fa74={};var _0x414d0f={};var _0x202680;var _0x234c95;return db['CmList']['findOne']({'where':{'id':_0xc90149[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x412155,null))[_0x620b('0x2e')](function(_0x2037f1){if(_0x2037f1){_0x202680=_0x2037f1;_0x414d0f[_0x620b('0x39')]=_[_0x620b('0x3b')](db['CmCustomField'][_0x620b('0x35')]);_0x414d0f['query']=_[_0x620b('0x3b')](_0xc90149[_0x620b('0x3c')]);_0x414d0f[_0x620b('0x3d')]=_[_0x620b('0x3e')](_0x414d0f[_0x620b('0x39')],_0x414d0f[_0x620b('0x3c')]);_0x41fa74[_0x620b('0x3f')]=_[_0x620b('0x3e')](_0x414d0f[_0x620b('0x39')],qs[_0x620b('0x40')](_0xc90149[_0x620b('0x3c')][_0x620b('0x40')]));_0x41fa74[_0x620b('0x3f')]=_0x41fa74[_0x620b('0x3f')][_0x620b('0x52')]?_0x41fa74['attributes']:_0x414d0f[_0x620b('0x39')];_0x41fa74[_0x620b('0x43')]=qs[_0x620b('0x44')](_0xc90149[_0x620b('0x3c')][_0x620b('0x44')]);_0x41fa74[_0x620b('0x45')]=qs[_0x620b('0x3d')](_[_0x620b('0x46')](_0xc90149[_0x620b('0x3c')],_0x414d0f[_0x620b('0x3d')]));_0x41fa74[_0x620b('0x45')]=_[_0x620b('0x48')](_0x41fa74['where'],{'$or':[{'ListId':_0x2037f1['id']},{'ListId':null}]});if(_0xc90149['query'][_0x620b('0x47')]){_0x41fa74[_0x620b('0x45')]=_[_0x620b('0x48')](_0x41fa74[_0x620b('0x45')],{'$or':_[_0x620b('0x34')](_0x41fa74['attributes'],function(_0x16c473){var _0x3b22b0={};_0x3b22b0[_0x16c473]={'$like':'%'+_0xc90149[_0x620b('0x3c')][_0x620b('0x47')]+'%'};return _0x3b22b0;})});}_0x41fa74=_[_0x620b('0x48')]({},_0x41fa74,_0xc90149[_0x620b('0x4a')]);return db[_0x620b('0x72')][_0x620b('0xa2')](_0x41fa74);}})[_0x620b('0x2e')](respondWithResult(_0x412155,null))['catch'](handleError(_0x412155,null));};exports['getGlobalCustomFields']=function(_0xbb8e30,_0x5db592){return db[_0x620b('0x72')][_0x620b('0xa2')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x5db592,null))[_0x620b('0x2e')](function(_0x16f77a){return _0x16f77a;})[_0x620b('0x2e')](respondWithResult(_0x5db592,null))[_0x620b('0x4f')](handleError(_0x5db592,null));};exports[_0x620b('0xa3')]=function(_0x5836ac,_0x490d5d,_0x979081){return db[_0x620b('0x4b')][_0x620b('0x53')]({'where':{'id':_0x5836ac[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x490d5d,null))[_0x620b('0x2e')](function(_0x255989){if(_0x255989){return _0x255989['addAgents'](_0x5836ac[_0x620b('0x55')]['ids'],_[_0x620b('0x6c')](_0x5836ac[_0x620b('0x55')],[_0x620b('0x65'),'id'])||{})['spread'](function(_0x43e7ba){for(var _0x466ea0=0x0;_0x466ea0<_0x5836ac['body'][_0x620b('0x65')]['length'];_0x466ea0+=0x1){socket[_0x620b('0xa4')](_0x620b('0xa5'),{'UserId':Number(_0x5836ac[_0x620b('0x55')][_0x620b('0x65')][_0x466ea0]),'CmListId':Number(_0x5836ac['params']['id'])});}return _0x43e7ba;});}})[_0x620b('0x2e')](respondWithResult(_0x490d5d,null))['catch'](handleError(_0x490d5d,null));};exports[_0x620b('0xa6')]=function(_0x74e013,_0x2cde0b,_0x31ee67){return db[_0x620b('0x4b')][_0x620b('0x53')]({'where':{'id':_0x74e013['params']['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x2cde0b,null))[_0x620b('0x2e')](function(_0x4b2267){if(_0x4b2267){return _0x4b2267[_0x620b('0xa6')](_0x74e013['query'][_0x620b('0x65')])[_0x620b('0x2e')](function(){if(_['isArray'](_0x74e013['query'][_0x620b('0x65')])){for(var _0x12dd74=0x0;_0x12dd74<_0x74e013['query'][_0x620b('0x65')][_0x620b('0x52')];_0x12dd74+=0x1){socket[_0x620b('0xa4')](_0x620b('0xa7'),{'UserId':Number(_0x74e013[_0x620b('0x3c')]['ids'][_0x12dd74]),'CmListId':Number(_0x74e013['params']['id'])});}}else{socket[_0x620b('0xa4')](_0x620b('0xa7'),{'UserId':Number(_0x74e013['query'][_0x620b('0x65')]),'CmListId':Number(_0x74e013[_0x620b('0x51')]['id'])});}});}})[_0x620b('0x2e')](respondWithStatusCode(_0x2cde0b,null))[_0x620b('0x4f')](handleError(_0x2cde0b,null));};exports[_0x620b('0xa8')]=function(_0x5bff93,_0x23da34,_0x4a11b7){var _0xc15c88={};var _0x49da6c={};var _0x284a00;var _0x26462f;return db[_0x620b('0x4b')][_0x620b('0x62')]({'where':{'id':_0x5bff93[_0x620b('0x51')]['id']}})[_0x620b('0x2e')](handleEntityNotFound(_0x23da34,null))['then'](function(_0x229b1d){if(_0x229b1d){_0x284a00=_0x229b1d;_0x49da6c['model']=_[_0x620b('0x3b')](db[_0x620b('0xa9')][_0x620b('0x35')]);_0x49da6c[_0x620b('0x3c')]=_[_0x620b('0x3b')](_0x5bff93['query']);_0x49da6c[_0x620b('0x3d')]=_['intersection'](_0x49da6c[_0x620b('0x39')],_0x49da6c[_0x620b('0x3c')]);_0xc15c88[_0x620b('0x3f')]=_['intersection'](_0x49da6c['model'],qs['fields'](_0x5bff93['query'][_0x620b('0x40')]));_0xc15c88[_0x620b('0x3f')]=_0xc15c88[_0x620b('0x3f')][_0x620b('0x52')]?_0xc15c88['attributes']:_0x49da6c['model'];_0xc15c88[_0x620b('0x43')]=qs[_0x620b('0x44')](_0x5bff93[_0x620b('0x3c')][_0x620b('0x44')]);_0xc15c88['where']=qs[_0x620b('0x3d')](_['pick'](_0x5bff93[_0x620b('0x3c')],_0x49da6c[_0x620b('0x3d')]));if(_0x5bff93[_0x620b('0x3c')]['filter']){_0xc15c88['where']=_[_0x620b('0x48')](_0xc15c88[_0x620b('0x45')],{'$or':_['map'](_0xc15c88[_0x620b('0x3f')],function(_0x106648){var _0x2b9318={};_0x2b9318[_0x106648]={'$like':'%'+_0x5bff93['query'][_0x620b('0x47')]+'%'};return _0x2b9318;})});}_0xc15c88=_[_0x620b('0x48')]({},_0xc15c88,_0x5bff93['options']);return _0x284a00[_0x620b('0xa8')](_0xc15c88);}})['then'](function(_0x26b2b8){if(_0x26b2b8){_0x26462f=_0x26b2b8[_0x620b('0x52')];if(!_0x5bff93[_0x620b('0x3c')][_0x620b('0x41')](_0x620b('0x42'))){_0xc15c88['limit']=qs[_0x620b('0x27')](_0x5bff93[_0x620b('0x3c')][_0x620b('0x27')]);_0xc15c88[_0x620b('0x25')]=qs['offset'](_0x5bff93['query']['offset']);}return _0x284a00[_0x620b('0xa8')](_0xc15c88);}})['then'](function(_0x2286c5){if(_0x2286c5){return _0x2286c5?{'count':_0x26462f,'rows':_0x2286c5}:null;}})[_0x620b('0x2e')](respondWithResult(_0x23da34,null))['catch'](handleError(_0x23da34,null));};function handleQuery(_0x57d44f){logger[_0x620b('0xaa')](_0x57d44f);return db['sequelize'][_0x620b('0x3c')](_0x57d44f)[_0x620b('0xab')](function(_0x590100){csv_results[_0x620b('0x6a')](_0x590100);})[_0x620b('0x4f')](function(_0x3f7ebd){logger['error'](_0x3f7ebd[_0x620b('0x70')]);});} \ No newline at end of file +var _0xf1e2=['TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','Disposition','ListId','ids','addContacts','CmContact','isArray','tags','join','omit','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize'];(function(_0x527eac,_0x22b019){var _0x4b28df=function(_0x15d8a3){while(--_0x15d8a3){_0x527eac['push'](_0x527eac['shift']());}};_0x4b28df(++_0x22b019);}(_0xf1e2,0xaf));var _0x2f1e=function(_0x1ca43b,_0x2bb220){_0x1ca43b=_0x1ca43b-0x0;var _0x4eda9=_0xf1e2[_0x1ca43b];return _0x4eda9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f1e('0x0'));var zipdir=require(_0x2f1e('0x1'));var jsonpatch=require(_0x2f1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f1e('0x3'));var path=require('path');var sox=require(_0x2f1e('0x4'));var csv=require(_0x2f1e('0x5'));var ejs=require(_0x2f1e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f1e('0x7'));var squel=require('squel');var crypto=require(_0x2f1e('0x8'));var jsforce=require(_0x2f1e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2f1e('0x5'));var querystring=require(_0x2f1e('0xa'));var Papa=require(_0x2f1e('0xb'));var Redis=require('ioredis');var authService=require(_0x2f1e('0xc'));var qs=require(_0x2f1e('0xd'));var as=require(_0x2f1e('0xe'));var hardwareService=require(_0x2f1e('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x2f1e('0x10'));var config=require(_0x2f1e('0x11'));var licenseUtil=require(_0x2f1e('0x12'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x2f1e('0x13')]=_[_0x2f1e('0x14')](config[_0x2f1e('0x13')],{'host':_0x2f1e('0x15'),'port':0x18eb});var socket=require(_0x2f1e('0x16'))(new Redis(config[_0x2f1e('0x13')]));require(_0x2f1e('0x17'))[_0x2f1e('0x18')](socket);function respondWithStatusCode(_0x3f65c8,_0x4deaf0){_0x4deaf0=_0x4deaf0||0xcc;return function(_0x4ae987){if(_0x4ae987){return _0x3f65c8[_0x2f1e('0x19')](_0x4deaf0);}return _0x3f65c8[_0x2f1e('0x1a')](_0x4deaf0)[_0x2f1e('0x1b')]();};}function respondWithResult(_0x475305,_0x4ac257){_0x4ac257=_0x4ac257||0xc8;return function(_0xb6bb6a){if(_0xb6bb6a){return _0x475305[_0x2f1e('0x1a')](_0x4ac257)[_0x2f1e('0x1c')](_0xb6bb6a);}};}function respondWithFilteredResult(_0x41278f,_0x2e30a9){return function(_0x5bc49d){if(_0x5bc49d){var _0x3b5d21=typeof _0x2e30a9[_0x2f1e('0x1d')]==='undefined'&&typeof _0x2e30a9[_0x2f1e('0x1e')]==='undefined';var _0x31de2c=_0x5bc49d['count'];var _0xea4c5d=_0x3b5d21?0x0:_0x2e30a9[_0x2f1e('0x1d')];var _0x1b109c=_0x3b5d21?_0x5bc49d[_0x2f1e('0x1f')]:_0x2e30a9[_0x2f1e('0x1d')]+_0x2e30a9['limit'];var _0x1b55dc;if(_0x1b109c>=_0x31de2c){_0x1b109c=_0x31de2c;_0x1b55dc=0xc8;}else{_0x1b55dc=0xce;}_0x41278f['status'](_0x1b55dc);return _0x41278f[_0x2f1e('0x20')](_0x2f1e('0x21'),_0xea4c5d+'-'+_0x1b109c+'/'+_0x31de2c)[_0x2f1e('0x1c')](_0x5bc49d);}return null;};}function patchUpdates(_0x13cf4d){return function(_0x1244e6){try{jsonpatch[_0x2f1e('0x22')](_0x1244e6,_0x13cf4d,!![]);}catch(_0x43bb72){return BPromise[_0x2f1e('0x23')](_0x43bb72);}return _0x1244e6[_0x2f1e('0x24')]();};}function saveUpdates(_0x509c2b,_0x501452){return function(_0x548811){if(_0x548811){return _0x548811[_0x2f1e('0x25')](_0x509c2b)['then'](function(_0x41c9a9){return _0x41c9a9;});}return null;};}function removeEntity(_0x52b574,_0x2802ad){return function(_0x99ec3e){if(_0x99ec3e){return _0x99ec3e['destroy']()[_0x2f1e('0x26')](function(){var _0x2f53cc=_0x99ec3e[_0x2f1e('0x27')]({'plain':!![]});var _0x5e9e94='Lists';return db[_0x2f1e('0x28')][_0x2f1e('0x29')]({'where':{'type':_0x5e9e94,'resourceId':_0x2f53cc['id']}})['then'](function(){return _0x99ec3e;});})['then'](function(){_0x52b574[_0x2f1e('0x1a')](0xcc)[_0x2f1e('0x1b')]();});}};}function handleEntityNotFound(_0x2214f9,_0x2e2abf){return function(_0x17229b){if(!_0x17229b){_0x2214f9[_0x2f1e('0x19')](0x194);}return _0x17229b;};}function handleError(_0x4237da,_0x2dc044){_0x2dc044=_0x2dc044||0x1f4;return function(_0x444f11){logger['error'](_0x444f11[_0x2f1e('0x2a')]);if(_0x444f11[_0x2f1e('0x2b')]){delete _0x444f11[_0x2f1e('0x2b')];}_0x4237da[_0x2f1e('0x1a')](_0x2dc044)[_0x2f1e('0x2c')](_0x444f11);};}exports['index']=function(_0x517429,_0x679f8a){var _0x19f84d={},_0x347b7a={},_0x388164={'count':0x0,'rows':[]};var _0x4605fc=_[_0x2f1e('0x2d')](db[_0x2f1e('0x2e')]['rawAttributes'],function(_0x177048){return{'name':_0x177048[_0x2f1e('0x2f')],'type':_0x177048[_0x2f1e('0x30')][_0x2f1e('0x31')]};});_0x347b7a[_0x2f1e('0x32')]=_['map'](_0x4605fc,_0x2f1e('0x2b'));_0x347b7a[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0x517429[_0x2f1e('0x33')]);_0x347b7a[_0x2f1e('0x35')]=_[_0x2f1e('0x36')](_0x347b7a[_0x2f1e('0x32')],_0x347b7a[_0x2f1e('0x33')]);_0x19f84d[_0x2f1e('0x37')]=_[_0x2f1e('0x36')](_0x347b7a[_0x2f1e('0x32')],qs['fields'](_0x517429[_0x2f1e('0x33')][_0x2f1e('0x38')]));_0x19f84d['attributes']=_0x19f84d[_0x2f1e('0x37')][_0x2f1e('0x39')]?_0x19f84d[_0x2f1e('0x37')]:_0x347b7a[_0x2f1e('0x32')];if(!_0x517429[_0x2f1e('0x33')][_0x2f1e('0x3a')](_0x2f1e('0x3b'))){_0x19f84d[_0x2f1e('0x1e')]=qs[_0x2f1e('0x1e')](_0x517429[_0x2f1e('0x33')]['limit']);_0x19f84d[_0x2f1e('0x1d')]=qs['offset'](_0x517429[_0x2f1e('0x33')][_0x2f1e('0x1d')]);}_0x19f84d[_0x2f1e('0x3c')]=qs[_0x2f1e('0x3d')](_0x517429[_0x2f1e('0x33')]['sort']);_0x19f84d[_0x2f1e('0x3e')]=qs['filters'](_[_0x2f1e('0x3f')](_0x517429[_0x2f1e('0x33')],_0x347b7a[_0x2f1e('0x35')]),_0x4605fc);if(_0x517429[_0x2f1e('0x33')][_0x2f1e('0x40')]){_0x19f84d[_0x2f1e('0x3e')]=_['merge'](_0x19f84d[_0x2f1e('0x3e')],{'$or':_[_0x2f1e('0x2d')](_0x4605fc,function(_0x1f66f8){if(_0x1f66f8[_0x2f1e('0x30')]!==_0x2f1e('0x41')){var _0x4fd8bc={};_0x4fd8bc[_0x1f66f8['name']]={'$like':'%'+_0x517429[_0x2f1e('0x33')][_0x2f1e('0x40')]+'%'};return _0x4fd8bc;}})});}_0x19f84d=_['merge']({},_0x19f84d,_0x517429[_0x2f1e('0x42')]);var _0x97d453={'where':_0x19f84d[_0x2f1e('0x3e')]};return db[_0x2f1e('0x2e')][_0x2f1e('0x1f')](_0x97d453)['then'](function(_0x4bc157){_0x388164['count']=_0x4bc157;if(_0x517429[_0x2f1e('0x33')][_0x2f1e('0x43')]){_0x19f84d[_0x2f1e('0x44')]=[{'all':!![]}];}return db[_0x2f1e('0x2e')][_0x2f1e('0x45')](_0x19f84d);})[_0x2f1e('0x26')](function(_0x48d083){_0x388164[_0x2f1e('0x46')]=_0x48d083;return _0x388164;})[_0x2f1e('0x26')](respondWithFilteredResult(_0x679f8a,_0x19f84d))[_0x2f1e('0x47')](handleError(_0x679f8a,null));};exports['show']=function(_0x438af9,_0x10fdc8){var _0x1de599={'raw':![],'where':{'id':_0x438af9[_0x2f1e('0x48')]['id']}},_0x10a924={};_0x10a924[_0x2f1e('0x32')]=_[_0x2f1e('0x34')](db[_0x2f1e('0x2e')][_0x2f1e('0x49')]);_0x10a924[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0x438af9[_0x2f1e('0x33')]);_0x10a924['filters']=_['intersection'](_0x10a924[_0x2f1e('0x32')],_0x10a924['query']);_0x1de599[_0x2f1e('0x37')]=_[_0x2f1e('0x36')](_0x10a924[_0x2f1e('0x32')],qs[_0x2f1e('0x38')](_0x438af9[_0x2f1e('0x33')][_0x2f1e('0x38')]));_0x1de599[_0x2f1e('0x37')]=_0x1de599[_0x2f1e('0x37')][_0x2f1e('0x39')]?_0x1de599['attributes']:_0x10a924['model'];if(_0x438af9[_0x2f1e('0x33')][_0x2f1e('0x43')]){_0x1de599[_0x2f1e('0x44')]=[{'all':!![]}];}_0x1de599=_[_0x2f1e('0x4a')]({},_0x1de599,_0x438af9['options']);return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')](_0x1de599)[_0x2f1e('0x26')](handleEntityNotFound(_0x10fdc8,null))[_0x2f1e('0x26')](respondWithResult(_0x10fdc8,null))[_0x2f1e('0x47')](handleError(_0x10fdc8,null));};exports[_0x2f1e('0x4c')]=function(_0x5178ac,_0x70b54e){return db[_0x2f1e('0x2e')][_0x2f1e('0x4c')](_0x5178ac[_0x2f1e('0x4d')],{})[_0x2f1e('0x26')](function(_0x2f106c){var _0x100756=_0x5178ac[_0x2f1e('0x4e')][_0x2f1e('0x27')]({'plain':!![]});if(!_0x100756)throw new Error(_0x2f1e('0x4f'));if(_0x100756[_0x2f1e('0x50')]===_0x2f1e('0x4e')){var _0x3f4e89=_0x2f106c['get']({'plain':!![]});var _0x104370=_0x2f1e('0x51');return db[_0x2f1e('0x52')][_0x2f1e('0x4b')]({'where':{'name':_0x104370,'userProfileId':_0x100756[_0x2f1e('0x53')]},'raw':!![]})['then'](function(_0x59ec6a){if(_0x59ec6a&&_0x59ec6a[_0x2f1e('0x54')]===0x0){return db[_0x2f1e('0x28')][_0x2f1e('0x4c')]({'name':_0x3f4e89['name'],'resourceId':_0x3f4e89['id'],'type':_0x59ec6a[_0x2f1e('0x2b')],'sectionId':_0x59ec6a['id']},{})['then'](function(){return _0x2f106c;});}else{return _0x2f106c;}})[_0x2f1e('0x47')](function(_0x1cbfc4){logger[_0x2f1e('0x55')](_0x2f1e('0x56'),_0x1cbfc4);throw _0x1cbfc4;});}return _0x2f106c;})[_0x2f1e('0x26')](respondWithResult(_0x70b54e,0xc9))['catch'](handleError(_0x70b54e,null));};exports[_0x2f1e('0x25')]=function(_0x19e299,_0x51f250){if(_0x19e299[_0x2f1e('0x4d')]['id']){delete _0x19e299[_0x2f1e('0x4d')]['id'];}return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')]({'where':{'id':_0x19e299[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x51f250,null))[_0x2f1e('0x26')](saveUpdates(_0x19e299['body'],null))[_0x2f1e('0x26')](respondWithResult(_0x51f250,null))[_0x2f1e('0x47')](handleError(_0x51f250,null));};exports[_0x2f1e('0x29')]=function(_0x2ce1e9,_0x344a43){return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')]({'where':{'id':_0x2ce1e9[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x344a43,null))[_0x2f1e('0x26')](removeEntity(_0x344a43,null))['catch'](handleError(_0x344a43,null));};exports[_0x2f1e('0x57')]=function(_0x3d6511,_0x476ba0){return db[_0x2f1e('0x2e')][_0x2f1e('0x57')]()[_0x2f1e('0x26')](respondWithResult(_0x476ba0,null))[_0x2f1e('0x47')](handleError(_0x476ba0,null));};exports['addDisposition']=function(_0x37776d,_0x35c359,_0x2a4af0){if(_0x37776d[_0x2f1e('0x4d')]['id']){delete _0x37776d[_0x2f1e('0x4d')]['id'];}return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')]({'where':{'id':_0x37776d[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x35c359,null))['then'](function(_0x3c5451){if(_0x3c5451){_0x37776d[_0x2f1e('0x4d')]['ListId']=_0x3c5451['id'];return db['Disposition'][_0x2f1e('0x4c')](_0x37776d[_0x2f1e('0x4d')]);}})['then'](respondWithResult(_0x35c359,null))[_0x2f1e('0x47')](handleError(_0x35c359,null));};exports[_0x2f1e('0x58')]=function(_0x680f9c,_0x5eb7b8,_0x21ed40){var _0x2ac070={'raw':![],'where':{}};var _0x5abf54={};var _0x49abad={'count':0x0,'rows':[]};return db[_0x2f1e('0x2e')]['findOne']({'where':{'id':_0x680f9c[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x5eb7b8,null))[_0x2f1e('0x26')](function(_0x40e0ff){if(_0x40e0ff){_0x5abf54[_0x2f1e('0x32')]=_[_0x2f1e('0x34')](db[_0x2f1e('0x59')][_0x2f1e('0x49')]);_0x5abf54[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0x680f9c[_0x2f1e('0x33')]);_0x5abf54[_0x2f1e('0x35')]=_[_0x2f1e('0x36')](_0x5abf54[_0x2f1e('0x32')],_0x5abf54[_0x2f1e('0x33')]);_0x2ac070[_0x2f1e('0x37')]=_[_0x2f1e('0x36')](_0x5abf54[_0x2f1e('0x32')],qs[_0x2f1e('0x38')](_0x680f9c[_0x2f1e('0x33')][_0x2f1e('0x38')]));_0x2ac070[_0x2f1e('0x37')]=_0x2ac070[_0x2f1e('0x37')][_0x2f1e('0x39')]?_0x2ac070[_0x2f1e('0x37')]:_0x5abf54[_0x2f1e('0x32')];if(!_0x680f9c[_0x2f1e('0x33')][_0x2f1e('0x3a')](_0x2f1e('0x3b'))){_0x2ac070[_0x2f1e('0x1e')]=qs['limit'](_0x680f9c[_0x2f1e('0x33')][_0x2f1e('0x1e')]);_0x2ac070[_0x2f1e('0x1d')]=qs['offset'](_0x680f9c['query'][_0x2f1e('0x1d')]);}_0x2ac070['order']=qs[_0x2f1e('0x3d')](_0x680f9c[_0x2f1e('0x33')][_0x2f1e('0x3d')]);_0x2ac070[_0x2f1e('0x3e')]=qs['filters'](_[_0x2f1e('0x3f')](_0x680f9c[_0x2f1e('0x33')],_0x5abf54[_0x2f1e('0x35')]));_0x2ac070[_0x2f1e('0x3e')][_0x2f1e('0x5a')]=_0x40e0ff['id'];if(_0x680f9c['query'][_0x2f1e('0x40')]){_0x2ac070[_0x2f1e('0x3e')]=_[_0x2f1e('0x4a')](_0x2ac070[_0x2f1e('0x3e')],{'$or':_[_0x2f1e('0x2d')](_0x2ac070[_0x2f1e('0x37')],function(_0x36c008){var _0x59ec78={};_0x59ec78[_0x36c008]={'$like':'%'+_0x680f9c[_0x2f1e('0x33')][_0x2f1e('0x40')]+'%'};return _0x59ec78;})});}_0x2ac070=_['merge']({},_0x2ac070,_0x680f9c[_0x2f1e('0x42')]);return db[_0x2f1e('0x59')][_0x2f1e('0x1f')]({'where':_0x2ac070[_0x2f1e('0x3e')]})[_0x2f1e('0x26')](function(_0x3e9315){_0x49abad[_0x2f1e('0x1f')]=_0x3e9315;if(_0x680f9c[_0x2f1e('0x33')]['includeAll']){_0x2ac070[_0x2f1e('0x44')]=[{'all':!![]}];}return db[_0x2f1e('0x59')][_0x2f1e('0x45')](_0x2ac070);})[_0x2f1e('0x26')](function(_0x69b0dc){_0x49abad[_0x2f1e('0x46')]=_0x69b0dc;return _0x49abad;});}})[_0x2f1e('0x26')](respondWithFilteredResult(_0x5eb7b8,_0x2ac070))[_0x2f1e('0x47')](handleError(_0x5eb7b8,null));};exports['removeDispositions']=function(_0x124c9c,_0x1970a1,_0xa40348){return db['CmList']['find']({'where':{'id':_0x124c9c[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x1970a1,null))['then'](function(_0x5a4876){if(_0x5a4876){return _0x5a4876['removeDispositions'](_0x124c9c[_0x2f1e('0x33')][_0x2f1e('0x5b')]);}})[_0x2f1e('0x26')](respondWithStatusCode(_0x1970a1,null))['catch'](handleError(_0x1970a1,null));};exports[_0x2f1e('0x5c')]=function(_0x2c1cc4,_0x328c25,_0x424c36){return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')]({'where':{'id':_0x2c1cc4[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x328c25,null))[_0x2f1e('0x26')](function(_0x31d49c){if(_0x31d49c){var _0x7fdc22=[];var _0x35bff5={'success':[],'errors':[]};return db[_0x2f1e('0x5d')][_0x2f1e('0x57')]()[_0x2f1e('0x26')](function(_0x3314b1){if(_0x2c1cc4[_0x2f1e('0x4d')]['tags']&&_[_0x2f1e('0x5e')](_0x2c1cc4['body'][_0x2f1e('0x5f')])){if(_0x2c1cc4['body'][_0x2f1e('0x5f')][_0x2f1e('0x39')]){_0x2c1cc4[_0x2f1e('0x4d')][_0x2f1e('0x5f')]=_0x2c1cc4['body'][_0x2f1e('0x5f')][_0x2f1e('0x60')](';')+';';}else{_0x2c1cc4[_0x2f1e('0x4d')][_0x2f1e('0x5f')]=null;}}else{_0x2c1cc4[_0x2f1e('0x4d')][_0x2f1e('0x5f')]=null;}if(_0x2c1cc4[_0x2f1e('0x4d')]&&_[_0x2f1e('0x5e')](_0x2c1cc4['body'])){for(var _0x1af6b0=0x0;_0x1af6b0<_0x2c1cc4[_0x2f1e('0x4d')][_0x2f1e('0x39')];_0x1af6b0+=0x1){_0x2c1cc4['body'][_0x1af6b0][_0x2f1e('0x5a')]=_0x2c1cc4[_0x2f1e('0x48')]['id'];_0x7fdc22['push'](_0x2c1cc4[_0x2f1e('0x4d')][_0x1af6b0]);}return BPromise['each'](_0x7fdc22,function(_0x223c5c){return db[_0x2f1e('0x5d')]['create'](_[_0x2f1e('0x61')](_0x223c5c,[_0x2f1e('0x5b'),'id'])||{},{'fields':_[_0x2f1e('0x34')](_0x3314b1),'raw':!![]})['then'](function(_0x3573a9){_0x35bff5[_0x2f1e('0x62')][_0x2f1e('0x63')](_0x3573a9[_0x2f1e('0x64')]);})['catch'](function(_0x22b22f){_0x35bff5['errors']['push']({'data':_0x223c5c,'error':_0x22b22f[_0x2f1e('0x65')]});});})['then'](function(_0x2ceb1d){return _0x35bff5;})[_0x2f1e('0x47')](function(_0xcc3cab){return _0xcc3cab;});}else{_0x328c25[_0x2f1e('0x1a')](0x190)[_0x2f1e('0x1c')]({'message':_0x2f1e('0x66')});}});}})[_0x2f1e('0x26')](respondWithResult(_0x328c25,null))[_0x2f1e('0x47')](handleError(_0x328c25,null));};exports[_0x2f1e('0x67')]=function(_0xcc4c1d,_0x1f8007,_0x34de38){var _0x2186cf;return db[_0x2f1e('0x2e')]['find']({'where':{'id':_0xcc4c1d[_0x2f1e('0x48')]['id']},'include':[{'model':db[_0x2f1e('0x68')],'as':_0x2f1e('0x69')}]})['then'](handleEntityNotFound(_0x1f8007,null))[_0x2f1e('0x26')](function(_0x47ceed){if(_0x47ceed){_0x2186cf=_0x47ceed;return db['CmContact'][_0x2f1e('0x49')];}})[_0x2f1e('0x26')](function(_0x26fc7d){if(_0x26fc7d){var _0x1b2e77={};var _0x12c061={};_0x12c061[_0x2f1e('0x32')]=_[_0x2f1e('0x6a')](_[_0x2f1e('0x34')](_0x26fc7d),_[_0x2f1e('0x2d')](_0x2186cf[_0x2f1e('0x69')],function(_0x15892b){return util['format'](_0x2f1e('0x6b'),_0x15892b['id']);}));_0x12c061[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0xcc4c1d[_0x2f1e('0x33')]);_0x12c061['filters']=_['intersection'](_0x12c061[_0x2f1e('0x32')],_0x12c061[_0x2f1e('0x33')]);_0x1b2e77['attributes']=_[_0x2f1e('0x36')](_0x12c061[_0x2f1e('0x32')],qs['fields'](_0xcc4c1d[_0x2f1e('0x33')][_0x2f1e('0x38')]));_0x1b2e77['attributes']=_0x1b2e77['attributes'][_0x2f1e('0x39')]?_0x1b2e77[_0x2f1e('0x37')]:_0x12c061[_0x2f1e('0x32')];if(!_0xcc4c1d[_0x2f1e('0x33')][_0x2f1e('0x3a')](_0x2f1e('0x3b'))){_0x1b2e77[_0x2f1e('0x1e')]=qs[_0x2f1e('0x1e')](_0xcc4c1d[_0x2f1e('0x33')][_0x2f1e('0x1e')]);_0x1b2e77[_0x2f1e('0x1d')]=qs[_0x2f1e('0x1d')](_0xcc4c1d['query']['offset']);}_0x1b2e77[_0x2f1e('0x3c')]=qs[_0x2f1e('0x3d')](_0xcc4c1d['query'][_0x2f1e('0x3d')]);_0x1b2e77[_0x2f1e('0x3e')]=qs[_0x2f1e('0x35')](_[_0x2f1e('0x3f')](_0xcc4c1d[_0x2f1e('0x33')],_0x12c061['filters']));_0x1b2e77[_0x2f1e('0x6c')]=!![];if(_0xcc4c1d['query'][_0x2f1e('0x40')]){_0x1b2e77['where']=_[_0x2f1e('0x4a')](_0x1b2e77[_0x2f1e('0x3e')],{'$or':_[_0x2f1e('0x2d')](_0x1b2e77[_0x2f1e('0x37')],function(_0x244b17){var _0x4448fb={};_0x4448fb[_0x244b17]={'$like':'%'+_0xcc4c1d[_0x2f1e('0x33')][_0x2f1e('0x40')]+'%'};return _0x4448fb;})});}_0x1b2e77=_[_0x2f1e('0x4a')]({},_0x1b2e77,_0xcc4c1d['options']);return _0x2186cf[_0x2f1e('0x67')](_0x1b2e77);}})[_0x2f1e('0x26')](respondWithResult(_0x1f8007,null))[_0x2f1e('0x47')](handleError(_0x1f8007,null));};exports[_0x2f1e('0x6d')]=function(_0x525fb5,_0x29397c,_0x58ba4b){var _0x2c4f6d;var _0x34afc5;var _0x7d8f60;var _0x147aa2=_0x525fb5[_0x2f1e('0x48')]['id'];csv_results=[];return db['ContactItemType'][_0x2f1e('0x45')]({'attributes':['id',_0x2f1e('0x2b')],'raw':!![],'order':[_0x2f1e('0x6e')]})[_0x2f1e('0x26')](function(_0x17c489){_0x2c4f6d=_0x17c489;var _0x56f2f9=_[_0x2f1e('0x34')](db[_0x2f1e('0x5d')][_0x2f1e('0x49')]);return db[_0x2f1e('0x68')][_0x2f1e('0x45')]({'raw':!![],'attributes':['id',_0x2f1e('0x6f')]})[_0x2f1e('0x26')](function(_0x288c62){_0x34afc5=_0x288c62;var _0x2a0518=squel[_0x2f1e('0x70')]()[_0x2f1e('0x38')](_0x56f2f9)[_0x2f1e('0x71')](_0x2f1e('0x72'),'c')[_0x2f1e('0x3e')]('c.ListId\x20=\x20?',_0x147aa2)['where'](_0x2f1e('0x73'))['distinct']();for(var _0x3563af=0x0;_0x3563af<_0x34afc5[_0x2f1e('0x39')];_0x3563af++){_0x2a0518[_0x2f1e('0x74')](_0x2f1e('0x75')+_0x34afc5[_0x3563af]['id'],_0x2f1e('0x76')+_0x34afc5[_0x3563af][_0x2f1e('0x6f')]);}for(var _0x3563af=0x0;_0x3563af<_0x2c4f6d[_0x2f1e('0x39')];_0x3563af++){_0x2a0518[_0x2f1e('0x74')](squel['select']()[_0x2f1e('0x74')]('item')[_0x2f1e('0x71')](_0x2f1e('0x77'))[_0x2f1e('0x3e')](_0x2f1e('0x78'),_0x2c4f6d[_0x3563af]['id'])['where'](_0x2f1e('0x79')),_0x2f1e('0x7a')+_0x2c4f6d[_0x3563af]['name']);_0x2a0518[_0x2f1e('0x74')](squel[_0x2f1e('0x70')]()[_0x2f1e('0x74')]('description')[_0x2f1e('0x71')](_0x2f1e('0x77'))['where'](_0x2f1e('0x78'),_0x2c4f6d[_0x3563af]['id'])['where'](_0x2f1e('0x79')),'description_additionalPhone_'+_0x2c4f6d[_0x3563af]['name']);}var _0x509ed9=[];_0x509ed9[_0x2f1e('0x63')](_0x2a0518[_0x2f1e('0x7b')]());BPromise['each'](_0x509ed9,handleQuery)[_0x2f1e('0x26')](function(_0x119c77){handleQuery(_0x2a0518['toString']());var _0x1da12d=csv_results[0x0];if(!_[_0x2f1e('0x7c')](_0x1da12d)){var _0x131fa4=toCsv(_0x1da12d);var _0x2b1774=Date[_0x2f1e('0x7d')]();fs[_0x2f1e('0x7e')](util[_0x2f1e('0x7f')](_0x2f1e('0x80'),_0x147aa2,_0x2b1774),_0x131fa4);_0x29397c['setHeader'](_0x2f1e('0x81'),'attachment;\x20filename='+util[_0x2f1e('0x7f')](_0x2f1e('0x82'),_0x147aa2,_0x2b1774));_0x29397c['setHeader'](_0x2f1e('0x83'),_0x2f1e('0x84'));return _0x29397c[_0x2f1e('0x85')](util[_0x2f1e('0x7f')](_0x2f1e('0x80'),_0x147aa2,_0x2b1774));}else{return _0x29397c[_0x2f1e('0x19')](0xcc);}});});});};exports['addCustomField']=function(_0x3cb4d2,_0x129a38,_0x151c04){var _0x56d1c1;delete _0x3cb4d2[_0x2f1e('0x4d')]['id'];return db['CmList'][_0x2f1e('0x86')]({'where':{'id':_0x3cb4d2[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x129a38,null))[_0x2f1e('0x26')](function(_0x5e1203){if(_0x5e1203){return db[_0x2f1e('0x87')][_0x2f1e('0x88')](function(_0x55251b){return db['CmCustomField'][_0x2f1e('0x4c')](_0x3cb4d2[_0x2f1e('0x4d')],{'transaction':_0x55251b})['then'](function(_0x13031a){_0x56d1c1=_0x13031a;return _0x5e1203[_0x2f1e('0x89')](_0x13031a,{'transaction':_0x55251b});})[_0x2f1e('0x26')](function(){var _0xb083c5={'type':db[_0x2f1e('0x8a')][_0x2f1e('0x8b')],'transaction':_0x55251b};switch(_0x3cb4d2['body']['type']){case _0x2f1e('0x8c'):_0xb083c5[_0x2f1e('0x30')]=db[_0x2f1e('0x8a')]['TEXT'];break;case'number':_0xb083c5[_0x2f1e('0x30')]=db[_0x2f1e('0x8a')][_0x2f1e('0x8d')];break;case _0x2f1e('0x8e'):_0xb083c5['type']=db[_0x2f1e('0x8a')][_0x2f1e('0x8f')];_0xb083c5[_0x2f1e('0x90')]=![];break;default:}return db[_0x2f1e('0x87')]['queryInterface'][_0x2f1e('0x91')](_0x2f1e('0x72'),util['format'](_0x2f1e('0x92'),_0x56d1c1['id']),_0xb083c5);})[_0x2f1e('0x26')](function(){return _0x56d1c1;});});}})[_0x2f1e('0x26')](respondWithResult(_0x129a38,null))[_0x2f1e('0x47')](handleError(_0x129a38,null));};exports['getCustomFields']=function(_0x4e6c61,_0x325308,_0x2cdee3){var _0x469929={};var _0x14ea1d={};var _0x5bfe52;var _0x1aeb60;return db['CmList'][_0x2f1e('0x86')]({'where':{'id':_0x4e6c61['params']['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x325308,null))[_0x2f1e('0x26')](function(_0x14f8c3){if(_0x14f8c3){_0x5bfe52=_0x14f8c3;_0x14ea1d[_0x2f1e('0x32')]=_[_0x2f1e('0x34')](db[_0x2f1e('0x68')][_0x2f1e('0x49')]);_0x14ea1d[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0x4e6c61[_0x2f1e('0x33')]);_0x14ea1d[_0x2f1e('0x35')]=_[_0x2f1e('0x36')](_0x14ea1d[_0x2f1e('0x32')],_0x14ea1d[_0x2f1e('0x33')]);_0x469929[_0x2f1e('0x37')]=_['intersection'](_0x14ea1d['model'],qs['fields'](_0x4e6c61['query'][_0x2f1e('0x38')]));_0x469929[_0x2f1e('0x37')]=_0x469929[_0x2f1e('0x37')][_0x2f1e('0x39')]?_0x469929[_0x2f1e('0x37')]:_0x14ea1d['model'];_0x469929['order']=qs[_0x2f1e('0x3d')](_0x4e6c61['query'][_0x2f1e('0x3d')]);_0x469929[_0x2f1e('0x3e')]=qs[_0x2f1e('0x35')](_[_0x2f1e('0x3f')](_0x4e6c61[_0x2f1e('0x33')],_0x14ea1d[_0x2f1e('0x35')]));_0x469929['where']=_['merge'](_0x469929[_0x2f1e('0x3e')],{'$or':[{'ListId':_0x14f8c3['id']},{'ListId':null}]});if(_0x4e6c61[_0x2f1e('0x33')][_0x2f1e('0x40')]){_0x469929[_0x2f1e('0x3e')]=_[_0x2f1e('0x4a')](_0x469929[_0x2f1e('0x3e')],{'$or':_[_0x2f1e('0x2d')](_0x469929[_0x2f1e('0x37')],function(_0x5e3b36){var _0x5eefe0={};_0x5eefe0[_0x5e3b36]={'$like':'%'+_0x4e6c61['query'][_0x2f1e('0x40')]+'%'};return _0x5eefe0;})});}_0x469929=_[_0x2f1e('0x4a')]({},_0x469929,_0x4e6c61[_0x2f1e('0x42')]);return db['CmCustomField'][_0x2f1e('0x93')](_0x469929);}})[_0x2f1e('0x26')](respondWithResult(_0x325308,null))[_0x2f1e('0x47')](handleError(_0x325308,null));};exports[_0x2f1e('0x94')]=function(_0x2c70c5,_0xc05663){return db[_0x2f1e('0x68')][_0x2f1e('0x93')]({'where':{'ListId':null}})[_0x2f1e('0x26')](handleEntityNotFound(_0xc05663,null))[_0x2f1e('0x26')](function(_0x42b528){return _0x42b528;})['then'](respondWithResult(_0xc05663,null))['catch'](handleError(_0xc05663,null));};exports['addAgents']=function(_0x2d58f7,_0x5435a8,_0x13570f){return db[_0x2f1e('0x2e')][_0x2f1e('0x4b')]({'where':{'id':_0x2d58f7[_0x2f1e('0x48')]['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0x5435a8,null))[_0x2f1e('0x26')](function(_0x2b7433){if(_0x2b7433){return _0x2b7433['addAgents'](_0x2d58f7[_0x2f1e('0x4d')][_0x2f1e('0x5b')],_[_0x2f1e('0x61')](_0x2d58f7[_0x2f1e('0x4d')],[_0x2f1e('0x5b'),'id'])||{})[_0x2f1e('0x95')](function(_0x179b8e){for(var _0x4bc892=0x0;_0x4bc892<_0x2d58f7['body'][_0x2f1e('0x5b')][_0x2f1e('0x39')];_0x4bc892+=0x1){socket[_0x2f1e('0x96')](_0x2f1e('0x97'),{'UserId':Number(_0x2d58f7[_0x2f1e('0x4d')][_0x2f1e('0x5b')][_0x4bc892]),'CmListId':Number(_0x2d58f7[_0x2f1e('0x48')]['id'])});}return _0x179b8e;});}})[_0x2f1e('0x26')](respondWithResult(_0x5435a8,null))[_0x2f1e('0x47')](handleError(_0x5435a8,null));};exports[_0x2f1e('0x98')]=function(_0x156cd2,_0x46b412,_0x21f968){return db['CmList'][_0x2f1e('0x4b')]({'where':{'id':_0x156cd2[_0x2f1e('0x48')]['id']}})['then'](handleEntityNotFound(_0x46b412,null))[_0x2f1e('0x26')](function(_0x42fbbd){if(_0x42fbbd){return _0x42fbbd['removeAgents'](_0x156cd2['query'][_0x2f1e('0x5b')])['then'](function(){if(_[_0x2f1e('0x5e')](_0x156cd2[_0x2f1e('0x33')]['ids'])){for(var _0x27176d=0x0;_0x27176d<_0x156cd2[_0x2f1e('0x33')][_0x2f1e('0x5b')][_0x2f1e('0x39')];_0x27176d+=0x1){socket[_0x2f1e('0x96')](_0x2f1e('0x99'),{'UserId':Number(_0x156cd2['query'][_0x2f1e('0x5b')][_0x27176d]),'CmListId':Number(_0x156cd2[_0x2f1e('0x48')]['id'])});}}else{socket[_0x2f1e('0x96')](_0x2f1e('0x99'),{'UserId':Number(_0x156cd2['query'][_0x2f1e('0x5b')]),'CmListId':Number(_0x156cd2[_0x2f1e('0x48')]['id'])});}});}})[_0x2f1e('0x26')](respondWithStatusCode(_0x46b412,null))[_0x2f1e('0x47')](handleError(_0x46b412,null));};exports[_0x2f1e('0x9a')]=function(_0x3212c5,_0xce851f,_0x1e1952){var _0x286cb0={};var _0x24c119={};var _0x59fe21;var _0x4afeb3;return db[_0x2f1e('0x2e')]['findOne']({'where':{'id':_0x3212c5['params']['id']}})[_0x2f1e('0x26')](handleEntityNotFound(_0xce851f,null))[_0x2f1e('0x26')](function(_0x143e8a){if(_0x143e8a){_0x59fe21=_0x143e8a;_0x24c119[_0x2f1e('0x32')]=_[_0x2f1e('0x34')](db[_0x2f1e('0x9b')][_0x2f1e('0x49')]);_0x24c119[_0x2f1e('0x33')]=_[_0x2f1e('0x34')](_0x3212c5[_0x2f1e('0x33')]);_0x24c119[_0x2f1e('0x35')]=_[_0x2f1e('0x36')](_0x24c119[_0x2f1e('0x32')],_0x24c119[_0x2f1e('0x33')]);_0x286cb0['attributes']=_[_0x2f1e('0x36')](_0x24c119['model'],qs[_0x2f1e('0x38')](_0x3212c5[_0x2f1e('0x33')]['fields']));_0x286cb0[_0x2f1e('0x37')]=_0x286cb0[_0x2f1e('0x37')][_0x2f1e('0x39')]?_0x286cb0[_0x2f1e('0x37')]:_0x24c119[_0x2f1e('0x32')];_0x286cb0[_0x2f1e('0x3c')]=qs['sort'](_0x3212c5['query'][_0x2f1e('0x3d')]);_0x286cb0[_0x2f1e('0x3e')]=qs['filters'](_[_0x2f1e('0x3f')](_0x3212c5[_0x2f1e('0x33')],_0x24c119[_0x2f1e('0x35')]));if(_0x3212c5[_0x2f1e('0x33')][_0x2f1e('0x40')]){_0x286cb0[_0x2f1e('0x3e')]=_[_0x2f1e('0x4a')](_0x286cb0[_0x2f1e('0x3e')],{'$or':_['map'](_0x286cb0[_0x2f1e('0x37')],function(_0x5c4fd8){var _0x3a3194={};_0x3a3194[_0x5c4fd8]={'$like':'%'+_0x3212c5[_0x2f1e('0x33')][_0x2f1e('0x40')]+'%'};return _0x3a3194;})});}_0x286cb0=_['merge']({},_0x286cb0,_0x3212c5[_0x2f1e('0x42')]);return _0x59fe21[_0x2f1e('0x9a')](_0x286cb0);}})[_0x2f1e('0x26')](function(_0x342dfd){if(_0x342dfd){_0x4afeb3=_0x342dfd[_0x2f1e('0x39')];if(!_0x3212c5[_0x2f1e('0x33')][_0x2f1e('0x3a')](_0x2f1e('0x3b'))){_0x286cb0[_0x2f1e('0x1e')]=qs[_0x2f1e('0x1e')](_0x3212c5[_0x2f1e('0x33')][_0x2f1e('0x1e')]);_0x286cb0['offset']=qs[_0x2f1e('0x1d')](_0x3212c5[_0x2f1e('0x33')][_0x2f1e('0x1d')]);}return _0x59fe21['getAgents'](_0x286cb0);}})['then'](function(_0x33005c){if(_0x33005c){return _0x33005c?{'count':_0x4afeb3,'rows':_0x33005c}:null;}})[_0x2f1e('0x26')](respondWithResult(_0xce851f,null))['catch'](handleError(_0xce851f,null));};function handleQuery(_0x2cefa6){logger[_0x2f1e('0x9c')](_0x2cefa6);return db[_0x2f1e('0x87')][_0x2f1e('0x33')](_0x2cefa6)[_0x2f1e('0x95')](function(_0x3776c8){csv_results['push'](_0x3776c8);})['catch'](function(_0x3efa95){logger[_0x2f1e('0x55')](_0x3efa95['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 68df82d..a15322a 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x55ca,0x126));var _0xa55c=function(_0x3dfea6,_0x5cd685){_0x3dfea6=_0x3dfea6-0x0;var _0x567aca=_0x55ca[_0x3dfea6];return _0x567aca;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x55ca,0x126));var _0xa55c=function(_0x117713,_0x1b3f0c){_0x117713=_0x117713-0x0;var _0x310d68=_0x55ca[_0x117713];return _0x310d68;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 021e789..9945735 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x3a8aa7,_0x12159b){var _0x1e0a11=function(_0x5f2fcc){while(--_0x5f2fcc){_0x3a8aa7['push'](_0x3a8aa7['shift']());}};_0x1e0a11(++_0x12159b);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3109f9,_0x4c2eb9){_0x3109f9=_0x3109f9-0x0;var _0x28f7a3=_0x5ff3[_0x3109f9];return _0x28f7a3;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x33eb89,_0x5517f1){var _0x531a2f=function(_0x1b24d5){while(--_0x1b24d5){_0x33eb89['push'](_0x33eb89['shift']());}};_0x531a2f(++_0x5517f1);}(_0x41bb,0xc5));var _0xb41b=function(_0x3a5a1b,_0x4a34a8){_0x3a5a1b=_0x3a5a1b-0x0;var _0x10927d=_0x41bb[_0x3a5a1b];return _0x10927d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('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 21b1613..3c1b7ff 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 _0x4fa8=['../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0x4fa8,0x126));var _0x84fa=function(_0x4841c9,_0x10e316){_0x4841c9=_0x4841c9-0x0;var _0x105137=_0x4fa8[_0x4841c9];return _0x105137;};'use strict';var _=require(_0x84fa('0x0'));var util=require(_0x84fa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84fa('0x2'));var fs=require('fs');var Redis=require(_0x84fa('0x3'));var db=require(_0x84fa('0x4'))['db'];var utils=require(_0x84fa('0x5'));var logger=require(_0x84fa('0x6'))('rpc');var config=require(_0x84fa('0x7'));var jayson=require(_0x84fa('0x8'));var client=jayson[_0x84fa('0x9')]['http']({'port':0x232a});config[_0x84fa('0xa')]=_[_0x84fa('0xb')](config[_0x84fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x84fa('0xc'))(new Redis(config[_0x84fa('0xa')]));require(_0x84fa('0xd'))[_0x84fa('0xe')](socket);function respondWithRpcPromise(_0x3a68c6,_0x5e735a,_0x1aad57){return new BPromise(function(_0x32ef78,_0x180e93){return client[_0x84fa('0xf')](_0x3a68c6,_0x1aad57)[_0x84fa('0x10')](function(_0x1eb34b){logger['info'](_0x84fa('0x11'),_0x5e735a,_0x84fa('0x12'));logger[_0x84fa('0x13')](_0x84fa('0x14'),_0x5e735a,_0x84fa('0x12'),JSON['stringify'](_0x1eb34b));if(_0x1eb34b[_0x84fa('0x15')]){if(_0x1eb34b[_0x84fa('0x15')][_0x84fa('0x16')]===0x1f4){logger['error'](_0x84fa('0x11'),_0x5e735a,_0x1eb34b[_0x84fa('0x15')][_0x84fa('0x17')]);return _0x180e93(_0x1eb34b[_0x84fa('0x15')][_0x84fa('0x17')]);}logger[_0x84fa('0x15')](_0x84fa('0x11'),_0x5e735a,_0x1eb34b[_0x84fa('0x15')][_0x84fa('0x17')]);return _0x32ef78(_0x1eb34b[_0x84fa('0x15')][_0x84fa('0x17')]);}else{logger['info'](_0x84fa('0x11'),_0x5e735a,_0x84fa('0x12'));_0x32ef78(_0x1eb34b[_0x84fa('0x18')]['message']);}})['catch'](function(_0x38160c){logger[_0x84fa('0x15')](_0x84fa('0x11'),_0x5e735a,_0x38160c);_0x180e93(_0x38160c);});});} \ No newline at end of file +var _0xec0b=['./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xec0b,0x15b));var _0xbec0=function(_0x53539c,_0x33ee38){_0x53539c=_0x53539c-0x0;var _0x25d812=_0xec0b[_0x53539c];return _0x25d812;};'use strict';var _=require(_0xbec0('0x0'));var util=require(_0xbec0('0x1'));var moment=require(_0xbec0('0x2'));var BPromise=require(_0xbec0('0x3'));var rs=require(_0xbec0('0x4'));var fs=require('fs');var Redis=require(_0xbec0('0x5'));var db=require(_0xbec0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbec0('0x7'))('rpc');var config=require(_0xbec0('0x8'));var jayson=require(_0xbec0('0x9'));var client=jayson['client'][_0xbec0('0xa')]({'port':0x232a});config[_0xbec0('0xb')]=_[_0xbec0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbec0('0xd'))['register'](socket);function respondWithRpcPromise(_0x564257,_0x430eb2,_0x178cfe){return new BPromise(function(_0x153622,_0x32ec56){return client[_0xbec0('0xe')](_0x564257,_0x178cfe)[_0xbec0('0xf')](function(_0x2966ae){logger['info'](_0xbec0('0x10'),_0x430eb2,_0xbec0('0x11'));logger['debug'](_0xbec0('0x12'),_0x430eb2,_0xbec0('0x11'),JSON['stringify'](_0x2966ae));if(_0x2966ae[_0xbec0('0x13')]){if(_0x2966ae['error'][_0xbec0('0x14')]===0x1f4){logger[_0xbec0('0x13')](_0xbec0('0x10'),_0x430eb2,_0x2966ae[_0xbec0('0x13')][_0xbec0('0x15')]);return _0x32ec56(_0x2966ae['error'][_0xbec0('0x15')]);}logger[_0xbec0('0x13')](_0xbec0('0x10'),_0x430eb2,_0x2966ae[_0xbec0('0x13')][_0xbec0('0x15')]);return _0x153622(_0x2966ae[_0xbec0('0x13')]['message']);}else{logger['info'](_0xbec0('0x10'),_0x430eb2,_0xbec0('0x11'));_0x153622(_0x2966ae[_0xbec0('0x16')][_0xbec0('0x15')]);}})[_0xbec0('0x17')](function(_0x3cd155){logger[_0xbec0('0x13')]('CmList,\x20%s,\x20%s',_0x430eb2,_0x3cd155);_0x32ec56(_0x3cd155);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 901b2e4..7877222 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 _0xb3ca=['register','length','cmList:','./cmList.events','save','remove','removeListener'];(function(_0x5050c5,_0x31e484){var _0x7dca49=function(_0xaf28d0){while(--_0xaf28d0){_0x5050c5['push'](_0x5050c5['shift']());}};_0x7dca49(++_0x31e484);}(_0xb3ca,0x1d8));var _0xab3c=function(_0x4db40c,_0x5aebda){_0x4db40c=_0x4db40c-0x0;var _0x572a4b=_0xb3ca[_0x4db40c];return _0x572a4b;};'use strict';var CmListEvents=require(_0xab3c('0x0'));var events=[_0xab3c('0x1'),_0xab3c('0x2'),'update'];function createListener(_0x2a16ad,_0x5e0ee6){return function(_0x78bf9d){_0x5e0ee6['emit'](_0x2a16ad,_0x78bf9d);};}function removeListener(_0x22875f,_0x5a066b){return function(){CmListEvents[_0xab3c('0x3')](_0x22875f,_0x5a066b);};}exports[_0xab3c('0x4')]=function(_0x1c0222){for(var _0x542c70=0x0,_0x147534=events[_0xab3c('0x5')];_0x542c70<_0x147534;_0x542c70++){var _0x1ffc62=events[_0x542c70];var _0x18e822=createListener(_0xab3c('0x6')+_0x1ffc62,_0x1c0222);CmListEvents['on'](_0x1ffc62,_0x18e822);}}; \ No newline at end of file +var _0x4711=['remove','update','emit','register','length','cmList:','save'];(function(_0x4f436c,_0x54b915){var _0x49d2a9=function(_0x3bce5b){while(--_0x3bce5b){_0x4f436c['push'](_0x4f436c['shift']());}};_0x49d2a9(++_0x54b915);}(_0x4711,0x1c6));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1471('0x0'),_0x1471('0x1'),_0x1471('0x2')];function createListener(_0x3e32df,_0x59f4d3){return function(_0x121406){_0x59f4d3[_0x1471('0x3')](_0x3e32df,_0x121406);};}function removeListener(_0x2bc5c8,_0x1a4004){return function(){CmListEvents['removeListener'](_0x2bc5c8,_0x1a4004);};}exports[_0x1471('0x4')]=function(_0x41e51a){for(var _0x5b770c=0x0,_0x5ef915=events[_0x1471('0x5')];_0x5b770c<_0x5ef915;_0x5b770c++){var _0x504916=events[_0x5b770c];var _0x114d8e=createListener(_0x1471('0x6')+_0x504916,_0x41e51a);CmListEvents['on'](_0x504916,_0x114d8e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fdd3eeb..991463b 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 _0xf5b7=['fs-extra','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x40ec6d,_0x579178){var _0x3cb980=function(_0x5326c5){while(--_0x5326c5){_0x40ec6d['push'](_0x40ec6d['shift']());}};_0x3cb980(++_0x579178);}(_0xf5b7,0xf7));var _0x7f5b=function(_0x526633,_0x3c249b){_0x526633=_0x526633-0x0;var _0x4ed61d=_0xf5b7[_0x526633];return _0x4ed61d;};'use strict';var multer=require('multer');var util=require(_0x7f5b('0x0'));var path=require(_0x7f5b('0x1'));var timeout=require(_0x7f5b('0x2'));var express=require(_0x7f5b('0x3'));var router=express[_0x7f5b('0x4')]();var fs_extra=require(_0x7f5b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7f5b('0x6'));var config=require('../../config/environment');var controller=require(_0x7f5b('0x7'));router[_0x7f5b('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f5b('0x9')]);router[_0x7f5b('0x8')](_0x7f5b('0xa'),auth[_0x7f5b('0xb')](),controller[_0x7f5b('0xc')]);router[_0x7f5b('0x8')](_0x7f5b('0xd'),auth[_0x7f5b('0xb')](),controller[_0x7f5b('0xe')]);router[_0x7f5b('0x8')](_0x7f5b('0xf'),auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x10')]);router[_0x7f5b('0x8')](_0x7f5b('0x11'),auth['isAuthenticated'](),controller[_0x7f5b('0x12')]);router[_0x7f5b('0x8')](_0x7f5b('0x13'),auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x14')]);router[_0x7f5b('0x8')]('/:id/contacts/csv',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x15')]);router[_0x7f5b('0x8')](_0x7f5b('0x16'),auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x17')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7f5b('0x18')]);router[_0x7f5b('0x19')]('/',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x1a')]);router[_0x7f5b('0x19')](_0x7f5b('0x11'),auth[_0x7f5b('0xb')](),controller['addDisposition']);router['post'](_0x7f5b('0x13'),auth['isAuthenticated'](),controller[_0x7f5b('0x1b')]);router[_0x7f5b('0x19')]('/:id/fields',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x1c')]);router['post']('/:id/users',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x1d')]);router[_0x7f5b('0x1e')]('/:id',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x1f')]);router[_0x7f5b('0x20')](_0x7f5b('0xf'),auth['isAuthenticated'](),controller[_0x7f5b('0x21')]);router['delete'](_0x7f5b('0x11'),auth[_0x7f5b('0xb')](),controller['removeDispositions']);router[_0x7f5b('0x20')]('/:id/users',auth[_0x7f5b('0xb')](),controller[_0x7f5b('0x22')]);module[_0x7f5b('0x23')]=router; \ No newline at end of file +var _0xddc8=['destroy','removeDispositions','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','get','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','/:id/contacts','addContacts','addAgents','put','update','delete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xddc8,0x87));var _0x8ddc=function(_0x4f475a,_0x23dc9f){_0x4f475a=_0x4f475a-0x0;var _0xd03e1b=_0xddc8[_0x4f475a];return _0xd03e1b;};'use strict';var multer=require('multer');var util=require(_0x8ddc('0x0'));var path=require(_0x8ddc('0x1'));var timeout=require(_0x8ddc('0x2'));var express=require(_0x8ddc('0x3'));var router=express[_0x8ddc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8ddc('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x7')]);router['get'](_0x8ddc('0x8'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x9')]);router['get'](_0x8ddc('0xa'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0xb')]);router[_0x8ddc('0xc')](_0x8ddc('0xd'),auth['isAuthenticated'](),controller[_0x8ddc('0xe')]);router['get'](_0x8ddc('0xf'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x10')]);router[_0x8ddc('0xc')]('/:id/contacts',auth[_0x8ddc('0x6')](),controller['getContacts']);router[_0x8ddc('0xc')](_0x8ddc('0x11'),auth[_0x8ddc('0x6')](),controller['getContactsCsv']);router['get'](_0x8ddc('0x12'),auth[_0x8ddc('0x6')](),controller['getCustomFields']);router[_0x8ddc('0xc')](_0x8ddc('0x13'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x14')]);router['post']('/',auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x15')]);router[_0x8ddc('0x16')](_0x8ddc('0xf'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x17')]);router[_0x8ddc('0x16')](_0x8ddc('0x18'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x19')]);router['post'](_0x8ddc('0x12'),auth[_0x8ddc('0x6')](),controller['addCustomField']);router['post'](_0x8ddc('0x13'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x1a')]);router[_0x8ddc('0x1b')](_0x8ddc('0xd'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x1c')]);router[_0x8ddc('0x1d')](_0x8ddc('0xd'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x1e')]);router[_0x8ddc('0x1d')](_0x8ddc('0xf'),auth[_0x8ddc('0x6')](),controller[_0x8ddc('0x1f')]);router[_0x8ddc('0x1d')]('/:id/users',auth[_0x8ddc('0x6')](),controller['removeAgents']);module[_0x8ddc('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 82ab833..cd40f08 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 _0xbf59=['STRING','exports','getDataValue','field'];(function(_0x283b46,_0x33587f){var _0x2afe48=function(_0x1d0a27){while(--_0x1d0a27){_0x283b46['push'](_0x283b46['shift']());}};_0x2afe48(++_0x33587f);}(_0xbf59,0x95));var _0x9bf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf59[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9bf5('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12c5cc){return this[_0x9bf5('0x1')](_0x9bf5('0x2'));}},'field':{'type':Sequelize[_0x9bf5('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9bf5('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x9bf5('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xa450=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x161648,_0x247a96){var _0x3f3e70=function(_0x6483d6){while(--_0x6483d6){_0x161648['push'](_0x161648['shift']());}};_0x3f3e70(++_0x247a96);}(_0xa450,0x6d));var _0x0a45=function(_0x168998,_0x21547e){_0x168998=_0x168998-0x0;var _0xbb7371=_0xa450[_0x168998];return _0xbb7371;};'use strict';var Sequelize=require(_0x0a45('0x0'));module[_0x0a45('0x1')]={'name':{'type':Sequelize[_0x0a45('0x2')],'get':function(_0x4ecaa2){return this['getDataValue'](_0x0a45('0x3'));}},'field':{'type':Sequelize[_0x0a45('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x0a45('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 656190c..e481862 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(_0x54770f,_0x1b8ab3){var _0x2e2230=function(_0x1c6356){while(--_0x1c6356){_0x54770f['push'](_0x54770f['shift']());}};_0x2e2230(++_0x1b8ab3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x380bc4,_0x44faa9){var _0x18e1ef=function(_0x2caac4){while(--_0x2caac4){_0x380bc4['push'](_0x380bc4['shift']());}};_0x18e1ef(++_0x44faa9);}(_0x7a54,0x106));var _0x47a5=function(_0x32a92d,_0x442235){_0x32a92d=_0x32a92d-0x0;var _0x1a0337=_0x7a54[_0x32a92d];return _0x1a0337;};'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 753a589..e04d839 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 _0x6a40=['Condition','tools_conditions','util','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x2310a3,_0x1c3796){var _0x2442b9=function(_0xd14435){while(--_0xd14435){_0x2310a3['push'](_0x2310a3['shift']());}};_0x2442b9(++_0x1c3796);}(_0x6a40,0x1f1));var _0x06a4=function(_0x3659ba,_0x5ba3cb){_0x3659ba=_0x3659ba-0x0;var _0x301b16=_0x6a40[_0x3659ba];return _0x301b16;};'use strict';var _=require('lodash');var util=require(_0x06a4('0x0'));var logger=require('../../config/logger')(_0x06a4('0x1'));var moment=require(_0x06a4('0x2'));var BPromise=require('bluebird');var rp=require(_0x06a4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06a4('0x4'));var config=require(_0x06a4('0x5'));var attributes=require(_0x06a4('0x6'));module[_0x06a4('0x7')]=function(_0x17d4e1,_0x3b10d0){return _0x17d4e1[_0x06a4('0x8')](_0x06a4('0x9'),attributes,{'tableName':_0x06a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47df=['exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x9b243f,_0x3f5ece){var _0x2a3d3b=function(_0x5aac39){while(--_0x5aac39){_0x9b243f['push'](_0x9b243f['shift']());}};_0x2a3d3b(++_0x3f5ece);}(_0x47df,0x177));var _0xf47d=function(_0x124c30,_0x552cc7){_0x124c30=_0x124c30-0x0;var _0x3f70de=_0x47df[_0x124c30];return _0x3f70de;};'use strict';var _=require(_0xf47d('0x0'));var util=require(_0xf47d('0x1'));var logger=require(_0xf47d('0x2'))(_0xf47d('0x3'));var moment=require('moment');var BPromise=require(_0xf47d('0x4'));var rp=require(_0xf47d('0x5'));var fs=require('fs');var path=require(_0xf47d('0x6'));var rimraf=require('rimraf');var config=require(_0xf47d('0x7'));var attributes=require(_0xf47d('0x8'));module[_0xf47d('0x9')]=function(_0x35a735,_0x46b9e7){return _0x35a735[_0xf47d('0xa')]('Condition',attributes,{'tableName':_0xf47d('0xb'),'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 cd783c0..035a7e7 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 _0x97a5=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0x97a5,0x1e6));var _0x597a=function(_0x392b07,_0x1ad240){_0x392b07=_0x392b07-0x0;var _0x15f106=_0x97a5[_0x392b07];return _0x15f106;};'use strict';var _=require(_0x597a('0x0'));var util=require('util');var moment=require(_0x597a('0x1'));var BPromise=require(_0x597a('0x2'));var rs=require(_0x597a('0x3'));var fs=require('fs');var Redis=require(_0x597a('0x4'));var db=require(_0x597a('0x5'))['db'];var utils=require(_0x597a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x597a('0x7'));var jayson=require(_0x597a('0x8'));var client=jayson[_0x597a('0x9')][_0x597a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b942,_0x59121d,_0x1356de){return new BPromise(function(_0x2946b3,_0x1b5fc0){return client['request'](_0x18b942,_0x1356de)[_0x597a('0xb')](function(_0x46e9ee){logger[_0x597a('0xc')](_0x597a('0xd'),_0x59121d,_0x597a('0xe'));logger[_0x597a('0xf')](_0x597a('0x10'),_0x59121d,_0x597a('0xe'),JSON[_0x597a('0x11')](_0x46e9ee));if(_0x46e9ee[_0x597a('0x12')]){if(_0x46e9ee[_0x597a('0x12')][_0x597a('0x13')]===0x1f4){logger[_0x597a('0x12')](_0x597a('0xd'),_0x59121d,_0x46e9ee[_0x597a('0x12')][_0x597a('0x14')]);return _0x1b5fc0(_0x46e9ee[_0x597a('0x12')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x59121d,_0x46e9ee['error'][_0x597a('0x14')]);return _0x2946b3(_0x46e9ee[_0x597a('0x12')][_0x597a('0x14')]);}else{logger['info'](_0x597a('0xd'),_0x59121d,_0x597a('0xe'));_0x2946b3(_0x46e9ee[_0x597a('0x15')][_0x597a('0x14')]);}})[_0x597a('0x16')](function(_0x1284cd){logger[_0x597a('0x12')]('Condition,\x20%s,\x20%s',_0x59121d,_0x1284cd);_0x1b5fc0(_0x1284cd);});});} \ No newline at end of file +var _0x7384=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x81ca42,_0x1c4809){var _0x59377d=function(_0x1ad32d){while(--_0x1ad32d){_0x81ca42['push'](_0x81ca42['shift']());}};_0x59377d(++_0x1c4809);}(_0x7384,0xdd));var _0x4738=function(_0x48b5e7,_0x5e249f){_0x48b5e7=_0x48b5e7-0x0;var _0x405730=_0x7384[_0x48b5e7];return _0x405730;};'use strict';var _=require(_0x4738('0x0'));var util=require(_0x4738('0x1'));var moment=require(_0x4738('0x2'));var BPromise=require(_0x4738('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4738('0x4'));var db=require(_0x4738('0x5'))['db'];var utils=require(_0x4738('0x6'));var logger=require('../../config/logger')(_0x4738('0x7'));var config=require(_0x4738('0x8'));var jayson=require(_0x4738('0x9'));var client=jayson[_0x4738('0xa')][_0x4738('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18aeeb,_0x3bcd76,_0xe0a3f9){return new BPromise(function(_0x203af1,_0x59d164){return client[_0x4738('0xc')](_0x18aeeb,_0xe0a3f9)[_0x4738('0xd')](function(_0xafe533){logger[_0x4738('0xe')](_0x4738('0xf'),_0x3bcd76,_0x4738('0x10'));logger[_0x4738('0x11')](_0x4738('0x12'),_0x3bcd76,_0x4738('0x10'),JSON[_0x4738('0x13')](_0xafe533));if(_0xafe533['error']){if(_0xafe533[_0x4738('0x14')]['code']===0x1f4){logger[_0x4738('0x14')]('Condition,\x20%s,\x20%s',_0x3bcd76,_0xafe533['error'][_0x4738('0x15')]);return _0x59d164(_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);}logger[_0x4738('0x14')](_0x4738('0xf'),_0x3bcd76,_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);return _0x203af1(_0xafe533[_0x4738('0x14')][_0x4738('0x15')]);}else{logger[_0x4738('0xe')](_0x4738('0xf'),_0x3bcd76,_0x4738('0x10'));_0x203af1(_0xafe533[_0x4738('0x16')][_0x4738('0x15')]);}})[_0x4738('0x17')](function(_0x4d2863){logger[_0x4738('0x14')](_0x4738('0xf'),_0x3bcd76,_0x4d2863);_0x59d164(_0x4d2863);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5d137c5..4ce0268 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 _0x7ef7=['exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy'];(function(_0x25d408,_0x45b469){var _0x323860=function(_0x484149){while(--_0x484149){_0x25d408['push'](_0x25d408['shift']());}};_0x323860(++_0x45b469);}(_0x7ef7,0x91));var _0x77ef=function(_0x442f45,_0x1f03f0){_0x442f45=_0x442f45-0x0;var _0x50c2ed=_0x7ef7[_0x442f45];return _0x50c2ed;};'use strict';var multer=require('multer');var util=require(_0x77ef('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77ef('0x1'));var router=express['Router']();var fs_extra=require(_0x77ef('0x2'));var auth=require(_0x77ef('0x3'));var interaction=require(_0x77ef('0x4'));var config=require(_0x77ef('0x5'));var controller=require(_0x77ef('0x6'));router[_0x77ef('0x7')](_0x77ef('0x8'),auth[_0x77ef('0x9')](),controller['update']);router['delete']('/:id',auth[_0x77ef('0x9')](),controller[_0x77ef('0xa')]);module[_0x77ef('0xb')]=router; \ No newline at end of file +var _0xe952=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','multer','util'];(function(_0x3634a6,_0x12da9a){var _0x19088a=function(_0x9f0d3d){while(--_0x9f0d3d){_0x3634a6['push'](_0x3634a6['shift']());}};_0x19088a(++_0x12da9a);}(_0xe952,0x184));var _0x2e95=function(_0xddb4b5,_0x7d4e00){_0xddb4b5=_0xddb4b5-0x0;var _0xc32cd7=_0xe952[_0xddb4b5];return _0xc32cd7;};'use strict';var multer=require(_0x2e95('0x0'));var util=require(_0x2e95('0x1'));var path=require(_0x2e95('0x2'));var timeout=require(_0x2e95('0x3'));var express=require(_0x2e95('0x4'));var router=express['Router']();var fs_extra=require(_0x2e95('0x5'));var auth=require(_0x2e95('0x6'));var interaction=require(_0x2e95('0x7'));var config=require(_0x2e95('0x8'));var controller=require(_0x2e95('0x9'));router[_0x2e95('0xa')](_0x2e95('0xb'),auth[_0x2e95('0xc')](),controller['update']);router[_0x2e95('0xd')](_0x2e95('0xb'),auth['isAuthenticated'](),controller[_0x2e95('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 53161b4..5836205 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5e6=['name','exports','STRING'];(function(_0xee8dc4,_0x35b4f8){var _0x1edef5=function(_0x4104b0){while(--_0x4104b0){_0xee8dc4['push'](_0xee8dc4['shift']());}};_0x1edef5(++_0x35b4f8);}(_0xd5e6,0x100));var _0x6d5e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd5e6[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');module[_0x6d5e('0x0')]={'name':{'type':Sequelize[_0x6d5e('0x1')],'allowNull':![],'unique':_0x6d5e('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6d5e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xedb6=['INTEGER','sequelize','STRING','name'];(function(_0x267f27,_0x60064){var _0x5cbe40=function(_0x46de63){while(--_0x46de63){_0x267f27['push'](_0x267f27['shift']());}};_0x5cbe40(++_0x60064);}(_0xedb6,0x18d));var _0x6edb=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0xedb6[_0x11b58d];return _0xc2811b;};'use strict';var Sequelize=require(_0x6edb('0x0'));module['exports']={'name':{'type':Sequelize[_0x6edb('0x1')],'allowNull':![],'unique':_0x6edb('0x2')},'OrderBy':{'type':Sequelize[_0x6edb('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6edb('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 25f7ce8..4d1fbef 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcbb=['find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','params','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','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0x2f94c0,_0x108c3b){var _0xffecec=function(_0x4da16f){while(--_0x4da16f){_0x2f94c0['push'](_0x2f94c0['shift']());}};_0xffecec(++_0x108c3b);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x55702c,_0x19d820){_0x55702c=_0x55702c-0x0;var _0x4d6132=_0xfcbb[_0x55702c];return _0x4d6132;};'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(){var _0x11f6f7=_0x19616c[_0xbfcb('0x28')]({'plain':!![]});var _0x1ca8c3=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x1ca8c3,'resourceId':_0x11f6f7['id']}})[_0xbfcb('0x26')](function(){return _0x19616c;});})[_0xbfcb('0x26')](function(){_0xd4d29['status'](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1a')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2b')](_0xf4b944[_0xbfcb('0x2c')]);if(_0xf4b944[_0xbfcb('0x2d')]){delete _0xf4b944[_0xbfcb('0x2d')];}_0x781773[_0xbfcb('0x1c')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x2e')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x2f')](db[_0xbfcb('0x30')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x31')],'type':_0x297f72[_0xbfcb('0x32')][_0xbfcb('0x33')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x2d'));_0x1f45fc[_0xbfcb('0x34')]=_[_0xbfcb('0x35')](_0x3aa3cd[_0xbfcb('0x34')]);_0x1f45fc[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1f45fc[_0xbfcb('0x38')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x38')],qs['fields'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3a')]?_0x43de3c[_0xbfcb('0x3b')]:_0x1f45fc[_0xbfcb('0x38')];if(!_0x3aa3cd[_0xbfcb('0x34')]['hasOwnProperty'](_0xbfcb('0x3c'))){_0x43de3c[_0xbfcb('0x20')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x20')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x1e')]);}_0x43de3c[_0xbfcb('0x3d')]=qs[_0xbfcb('0x3e')](_0x3aa3cd['query'][_0xbfcb('0x3e')]);_0x43de3c[_0xbfcb('0x3f')]=qs[_0xbfcb('0x36')](_[_0xbfcb('0x40')](_0x3aa3cd[_0xbfcb('0x34')],_0x1f45fc[_0xbfcb('0x36')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x41')]){_0x43de3c['where']=_[_0xbfcb('0x42')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x2f')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x32')]!==_0xbfcb('0x43')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x2d')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x41')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x42')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x44')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x3f')]};return db[_0xbfcb('0x30')]['count'](_0x55a95f)[_0xbfcb('0x26')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x21')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x45')]){_0x43de3c[_0xbfcb('0x46')]=[{'all':!![]}];}return db['ContactItemType'][_0xbfcb('0x47')](_0x43de3c);})[_0xbfcb('0x26')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x48')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x49')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':!![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x38')]=_[_0xbfcb('0x35')](db['ContactItemType'][_0xbfcb('0x4a')]);_0x58337d[_0xbfcb('0x34')]=_['keys'](_0x542d90[_0xbfcb('0x34')]);_0x58337d[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],_0x58337d[_0xbfcb('0x34')]);_0xd7cb39[_0xbfcb('0x3b')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],qs[_0xbfcb('0x39')](_0x542d90[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0xd7cb39[_0xbfcb('0x3b')]=_0xd7cb39['attributes'][_0xbfcb('0x3a')]?_0xd7cb39[_0xbfcb('0x3b')]:_0x58337d[_0xbfcb('0x38')];if(_0x542d90['query'][_0xbfcb('0x45')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x44')]);return db[_0xbfcb('0x30')][_0xbfcb('0x4b')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x26')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x30')][_0xbfcb('0x4c')](_0x33725a['body'],{})[_0xbfcb('0x26')](function(_0x5d942f){var _0x8347be=_0x33725a['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x8347be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8347be[_0xbfcb('0x4d')]===_0xbfcb('0x4e')){var _0x5efbe1=_0x5d942f[_0xbfcb('0x28')]({'plain':!![]});var _0x547169='ContactItemTypes';return db[_0xbfcb('0x4f')][_0xbfcb('0x4b')]({'where':{'name':_0x547169,'userProfileId':_0x8347be[_0xbfcb('0x50')]},'raw':!![]})['then'](function(_0x495c34){if(_0x495c34&&_0x495c34[_0xbfcb('0x51')]===0x0){return db[_0xbfcb('0x2a')][_0xbfcb('0x4c')]({'name':_0x5efbe1[_0xbfcb('0x2d')],'resourceId':_0x5efbe1['id'],'type':_0x495c34[_0xbfcb('0x2d')],'sectionId':_0x495c34['id']},{})['then'](function(){return _0x5d942f;});}else{return _0x5d942f;}})[_0xbfcb('0x48')](function(_0x37a7e8){logger[_0xbfcb('0x2b')](_0xbfcb('0x52'),_0x37a7e8);throw _0x37a7e8;});}return _0x5d942f;})['then'](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x25')]=function(_0x50f9f7,_0x9cc2bd){if(_0x50f9f7['body']['id']){delete _0x50f9f7['body']['id'];}return db[_0xbfcb('0x30')]['find']({'where':{'id':_0x50f9f7['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x9cc2bd,null))['then'](saveUpdates(_0x50f9f7[_0xbfcb('0x53')],null))['then'](respondWithResult(_0x9cc2bd,null))[_0xbfcb('0x48')](handleError(_0x9cc2bd,null));};exports[_0xbfcb('0x27')]=function(_0x593f4e,_0x35cd27){return db[_0xbfcb('0x30')][_0xbfcb('0x4b')]({'where':{'id':_0x593f4e['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x35cd27,null))[_0xbfcb('0x26')](db[_0xbfcb('0x54')][_0xbfcb('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x593f4e[_0xbfcb('0x55')]['id']}}))[_0xbfcb('0x26')](removeEntity(_0x35cd27,null))[_0xbfcb('0x48')](handleError(_0x35cd27,null));}; \ No newline at end of file +var _0xb44a=['where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ContactItemTypes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','CmContactHasItem','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','error','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x5465c0,_0x3786f7){var _0x45ff36=function(_0x593525){while(--_0x593525){_0x5465c0['push'](_0x5465c0['shift']());}};_0x45ff36(++_0x3786f7);}(_0xb44a,0x1c2));var _0xab44=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xb44a[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){var _0x1d4a2f=_0x43f1c6['get']({'plain':!![]});var _0x2439f3='ContactItemTypes';return db[_0xab44('0x24')]['destroy']({'where':{'type':_0x2439f3,'resourceId':_0x1d4a2f['id']}})['then'](function(){return _0x43f1c6;});})[_0xab44('0x23')](function(){_0x11f0b[_0xab44('0x18')](0xcc)[_0xab44('0x17')]();});}};}function handleEntityNotFound(_0x4620ed,_0x132bf6){return function(_0x4e820c){if(!_0x4e820c){_0x4620ed[_0xab44('0x16')](0x194);}return _0x4e820c;};}function handleError(_0x5587fe,_0x5071f3){_0x5071f3=_0x5071f3||0x1f4;return function(_0x887b0d){logger[_0xab44('0x25')](_0x887b0d[_0xab44('0x26')]);if(_0x887b0d[_0xab44('0x27')]){delete _0x887b0d[_0xab44('0x27')];}_0x5587fe[_0xab44('0x18')](_0x5071f3)['send'](_0x887b0d);};}exports[_0xab44('0x28')]=function(_0x43a42d,_0x36f9b6){var _0x47e1be={},_0x54cac8={},_0x106d3a={'count':0x0,'rows':[]};var _0x5082e4=_['map'](db[_0xab44('0x29')][_0xab44('0x2a')],function(_0x160177){return{'name':_0x160177[_0xab44('0x2b')],'type':_0x160177[_0xab44('0x2c')][_0xab44('0x2d')]};});_0x54cac8[_0xab44('0x2e')]=_[_0xab44('0x2f')](_0x5082e4,_0xab44('0x27'));_0x54cac8[_0xab44('0x30')]=_[_0xab44('0x31')](_0x43a42d[_0xab44('0x30')]);_0x54cac8[_0xab44('0x32')]=_[_0xab44('0x33')](_0x54cac8['model'],_0x54cac8['query']);_0x47e1be[_0xab44('0x34')]=_[_0xab44('0x33')](_0x54cac8['model'],qs[_0xab44('0x35')](_0x43a42d[_0xab44('0x30')][_0xab44('0x35')]));_0x47e1be[_0xab44('0x34')]=_0x47e1be[_0xab44('0x34')][_0xab44('0x36')]?_0x47e1be[_0xab44('0x34')]:_0x54cac8[_0xab44('0x2e')];if(!_0x43a42d[_0xab44('0x30')][_0xab44('0x37')](_0xab44('0x38'))){_0x47e1be[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x43a42d[_0xab44('0x30')][_0xab44('0x1c')]);_0x47e1be[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x43a42d[_0xab44('0x30')]['offset']);}_0x47e1be[_0xab44('0x39')]=qs[_0xab44('0x3a')](_0x43a42d[_0xab44('0x30')][_0xab44('0x3a')]);_0x47e1be['where']=qs[_0xab44('0x32')](_[_0xab44('0x3b')](_0x43a42d[_0xab44('0x30')],_0x54cac8[_0xab44('0x32')]),_0x5082e4);if(_0x43a42d[_0xab44('0x30')]['filter']){_0x47e1be[_0xab44('0x3c')]=_[_0xab44('0x3d')](_0x47e1be[_0xab44('0x3c')],{'$or':_['map'](_0x5082e4,function(_0x3ef5ea){if(_0x3ef5ea[_0xab44('0x2c')]!==_0xab44('0x3e')){var _0xf80acf={};_0xf80acf[_0x3ef5ea[_0xab44('0x27')]]={'$like':'%'+_0x43a42d['query'][_0xab44('0x3f')]+'%'};return _0xf80acf;}})});}_0x47e1be=_['merge']({},_0x47e1be,_0x43a42d[_0xab44('0x40')]);var _0x4f2b94={'where':_0x47e1be['where']};return db['ContactItemType']['count'](_0x4f2b94)['then'](function(_0x120585){_0x106d3a[_0xab44('0x1d')]=_0x120585;if(_0x43a42d[_0xab44('0x30')][_0xab44('0x41')]){_0x47e1be[_0xab44('0x42')]=[{'all':!![]}];}return db[_0xab44('0x29')][_0xab44('0x43')](_0x47e1be);})[_0xab44('0x23')](function(_0x4429e6){_0x106d3a[_0xab44('0x44')]=_0x4429e6;return _0x106d3a;})['then'](respondWithFilteredResult(_0x36f9b6,_0x47e1be))[_0xab44('0x45')](handleError(_0x36f9b6,null));};exports[_0xab44('0x46')]=function(_0x3cb9fc,_0x9a6da5){var _0x54f603={'raw':!![],'where':{'id':_0x3cb9fc[_0xab44('0x47')]['id']}},_0x3e9a79={};_0x3e9a79[_0xab44('0x2e')]=_[_0xab44('0x31')](db[_0xab44('0x29')][_0xab44('0x2a')]);_0x3e9a79['query']=_['keys'](_0x3cb9fc[_0xab44('0x30')]);_0x3e9a79[_0xab44('0x32')]=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],_0x3e9a79[_0xab44('0x30')]);_0x54f603['attributes']=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],qs[_0xab44('0x35')](_0x3cb9fc[_0xab44('0x30')]['fields']));_0x54f603[_0xab44('0x34')]=_0x54f603[_0xab44('0x34')][_0xab44('0x36')]?_0x54f603['attributes']:_0x3e9a79[_0xab44('0x2e')];if(_0x3cb9fc[_0xab44('0x30')][_0xab44('0x41')]){_0x54f603[_0xab44('0x42')]=[{'all':!![]}];}_0x54f603=_['merge']({},_0x54f603,_0x3cb9fc[_0xab44('0x40')]);return db['ContactItemType'][_0xab44('0x48')](_0x54f603)[_0xab44('0x23')](handleEntityNotFound(_0x9a6da5,null))[_0xab44('0x23')](respondWithResult(_0x9a6da5,null))[_0xab44('0x45')](handleError(_0x9a6da5,null));};exports['create']=function(_0x328891,_0x5497a3){return db[_0xab44('0x29')][_0xab44('0x49')](_0x328891[_0xab44('0x4a')],{})[_0xab44('0x23')](function(_0x14bd54){var _0x4eeef0=_0x328891[_0xab44('0x4b')]['get']({'plain':!![]});if(!_0x4eeef0)throw new Error(_0xab44('0x4c'));if(_0x4eeef0[_0xab44('0x4d')]===_0xab44('0x4b')){var _0x50b705=_0x14bd54[_0xab44('0x4e')]({'plain':!![]});var _0x105a89=_0xab44('0x4f');return db[_0xab44('0x50')][_0xab44('0x48')]({'where':{'name':_0x105a89,'userProfileId':_0x4eeef0['userProfileId']},'raw':!![]})['then'](function(_0xe5302b){if(_0xe5302b&&_0xe5302b[_0xab44('0x51')]===0x0){return db[_0xab44('0x24')]['create']({'name':_0x50b705[_0xab44('0x27')],'resourceId':_0x50b705['id'],'type':_0xe5302b[_0xab44('0x27')],'sectionId':_0xe5302b['id']},{})[_0xab44('0x23')](function(){return _0x14bd54;});}else{return _0x14bd54;}})[_0xab44('0x45')](function(_0x4eb2eb){logger['error'](_0xab44('0x52'),_0x4eb2eb);throw _0x4eb2eb;});}return _0x14bd54;})[_0xab44('0x23')](respondWithResult(_0x5497a3,0xc9))[_0xab44('0x45')](handleError(_0x5497a3,null));};exports[_0xab44('0x22')]=function(_0x109f38,_0x2234c0){if(_0x109f38[_0xab44('0x4a')]['id']){delete _0x109f38[_0xab44('0x4a')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x109f38[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x2234c0,null))[_0xab44('0x23')](saveUpdates(_0x109f38[_0xab44('0x4a')],null))[_0xab44('0x23')](respondWithResult(_0x2234c0,null))[_0xab44('0x45')](handleError(_0x2234c0,null));};exports[_0xab44('0x53')]=function(_0x411bac,_0x1e606b){return db['ContactItemType'][_0xab44('0x48')]({'where':{'id':_0x411bac[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x1e606b,null))[_0xab44('0x23')](db[_0xab44('0x54')][_0xab44('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x411bac[_0xab44('0x47')]['id']}}))[_0xab44('0x23')](removeEntity(_0x1e606b,null))['catch'](handleError(_0x1e606b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e9ab7e2..0f026c7 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x816b=['util','../../config/logger','api','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x816b,0xdc));var _0xb816=function(_0x290909,_0x3eb57c){_0x290909=_0x290909-0x0;var _0x41bc0b=_0x816b[_0x290909];return _0x41bc0b;};'use strict';var _=require('lodash');var util=require(_0xb816('0x0'));var logger=require(_0xb816('0x1'))(_0xb816('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb816('0x3'));var fs=require('fs');var path=require(_0xb816('0x4'));var rimraf=require(_0xb816('0x5'));var config=require('../../config/environment');var attributes=require(_0xb816('0x6'));module[_0xb816('0x7')]=function(_0x5b01dc,_0x2c3b3c){return _0x5b01dc[_0xb816('0x8')](_0xb816('0x9'),attributes,{'tableName':_0xb816('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f3=['path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e30c0,_0x534a76){var _0x5db594=function(_0x1832e7){while(--_0x1832e7){_0x4e30c0['push'](_0x4e30c0['shift']());}};_0x5db594(++_0x534a76);}(_0xa9f3,0x186));var _0x3a9f=function(_0x53ddbb,_0x3d5ef1){_0x53ddbb=_0x53ddbb-0x0;var _0x96de71=_0xa9f3[_0x53ddbb];return _0x96de71;};'use strict';var _=require(_0x3a9f('0x0'));var util=require('util');var logger=require(_0x3a9f('0x1'))(_0x3a9f('0x2'));var moment=require(_0x3a9f('0x3'));var BPromise=require(_0x3a9f('0x4'));var rp=require(_0x3a9f('0x5'));var fs=require('fs');var path=require(_0x3a9f('0x6'));var rimraf=require(_0x3a9f('0x7'));var config=require(_0x3a9f('0x8'));var attributes=require(_0x3a9f('0x9'));module['exports']=function(_0xfec7bc,_0x390be8){return _0xfec7bc['define'](_0x3a9f('0xa'),attributes,{'tableName':_0x3a9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 71e0ac3..35162e5 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1646=['info','request\x20sent','debug','stringify','error','ContactItemType,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x5e9e76,_0x3cb685){var _0x2bc580=function(_0x5a2bd3){while(--_0x5a2bd3){_0x5e9e76['push'](_0x5e9e76['shift']());}};_0x2bc580(++_0x3cb685);}(_0x1646,0x1bd));var _0x6164=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x1646[_0x2b5b44];return _0x32cb66;};'use strict';var _=require(_0x6164('0x0'));var util=require(_0x6164('0x1'));var moment=require(_0x6164('0x2'));var BPromise=require(_0x6164('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6164('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6164('0x5'));var logger=require('../../config/logger')(_0x6164('0x6'));var config=require('../../config/environment');var jayson=require(_0x6164('0x7'));var client=jayson[_0x6164('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45107a,_0x490e94,_0x2048a2){return new BPromise(function(_0x3d6867,_0x23636f){return client[_0x6164('0x9')](_0x45107a,_0x2048a2)[_0x6164('0xa')](function(_0x3ece0b){logger[_0x6164('0xb')]('ContactItemType,\x20%s,\x20%s',_0x490e94,_0x6164('0xc'));logger[_0x6164('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x490e94,_0x6164('0xc'),JSON[_0x6164('0xe')](_0x3ece0b));if(_0x3ece0b[_0x6164('0xf')]){if(_0x3ece0b[_0x6164('0xf')]['code']===0x1f4){logger[_0x6164('0xf')](_0x6164('0x10'),_0x490e94,_0x3ece0b[_0x6164('0xf')]['message']);return _0x23636f(_0x3ece0b[_0x6164('0xf')][_0x6164('0x11')]);}logger['error'](_0x6164('0x10'),_0x490e94,_0x3ece0b[_0x6164('0xf')]['message']);return _0x3d6867(_0x3ece0b[_0x6164('0xf')]['message']);}else{logger[_0x6164('0xb')](_0x6164('0x10'),_0x490e94,_0x6164('0xc'));_0x3d6867(_0x3ece0b[_0x6164('0x12')][_0x6164('0x11')]);}})['catch'](function(_0x14d729){logger[_0x6164('0xf')](_0x6164('0x10'),_0x490e94,_0x14d729);_0x23636f(_0x14d729);});});} \ No newline at end of file +var _0xe0e2=['http','request','then','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x44618e,_0x3f5074){var _0x4bb4dd=function(_0x20c1b8){while(--_0x20c1b8){_0x44618e['push'](_0x44618e['shift']());}};_0x4bb4dd(++_0x3f5074);}(_0xe0e2,0x13c));var _0x2e0e=function(_0x2cd061,_0x3fde39){_0x2cd061=_0x2cd061-0x0;var _0xee1f5f=_0xe0e2[_0x2cd061];return _0xee1f5f;};'use strict';var _=require(_0x2e0e('0x0'));var util=require('util');var moment=require(_0x2e0e('0x1'));var BPromise=require('bluebird');var rs=require(_0x2e0e('0x2'));var fs=require('fs');var Redis=require(_0x2e0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2e0e('0x4'));var config=require(_0x2e0e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2e0e('0x6')][_0x2e0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26449f,_0x53a5d7,_0x1a72ca){return new BPromise(function(_0x17b427,_0x1e1c2a){return client[_0x2e0e('0x8')](_0x26449f,_0x1a72ca)[_0x2e0e('0x9')](function(_0x47b2dc){logger['info'](_0x2e0e('0xa'),_0x53a5d7,'request\x20sent');logger['debug'](_0x2e0e('0xb'),_0x53a5d7,_0x2e0e('0xc'),JSON['stringify'](_0x47b2dc));if(_0x47b2dc['error']){if(_0x47b2dc[_0x2e0e('0xd')][_0x2e0e('0xe')]===0x1f4){logger[_0x2e0e('0xd')](_0x2e0e('0xa'),_0x53a5d7,_0x47b2dc[_0x2e0e('0xd')][_0x2e0e('0xf')]);return _0x1e1c2a(_0x47b2dc[_0x2e0e('0xd')][_0x2e0e('0xf')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x53a5d7,_0x47b2dc[_0x2e0e('0xd')][_0x2e0e('0xf')]);return _0x17b427(_0x47b2dc[_0x2e0e('0xd')][_0x2e0e('0xf')]);}else{logger[_0x2e0e('0x10')](_0x2e0e('0xa'),_0x53a5d7,_0x2e0e('0xc'));_0x17b427(_0x47b2dc[_0x2e0e('0x11')][_0x2e0e('0xf')]);}})[_0x2e0e('0x12')](function(_0x518d13){logger[_0x2e0e('0xd')]('ContactItemType,\x20%s,\x20%s',_0x53a5d7,_0x518d13);_0x1e1c2a(_0x518d13);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index d42e683..bdf867d 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x703a=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x219cc1,_0x3d03b5){var _0x177034=function(_0x45e0fe){while(--_0x45e0fe){_0x219cc1['push'](_0x219cc1['shift']());}};_0x177034(++_0x3d03b5);}(_0x703a,0xab));var _0xa703=function(_0x5b2c85,_0x52e01f){_0x5b2c85=_0x5b2c85-0x0;var _0x1e3134=_0x703a[_0x5b2c85];return _0x1e3134;};'use strict';var multer=require('multer');var util=require(_0xa703('0x0'));var path=require(_0xa703('0x1'));var timeout=require(_0xa703('0x2'));var express=require(_0xa703('0x3'));var router=express['Router']();var fs_extra=require(_0xa703('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa703('0x5'));var controller=require(_0xa703('0x6'));router[_0xa703('0x7')]('/',auth[_0xa703('0x8')](),controller[_0xa703('0x9')]);router[_0xa703('0x7')](_0xa703('0xa'),auth[_0xa703('0x8')](),controller['show']);router[_0xa703('0xb')]('/',auth[_0xa703('0x8')](),controller[_0xa703('0xc')]);router[_0xa703('0xd')]('/:id',auth[_0xa703('0x8')](),controller['update']);router[_0xa703('0xe')](_0xa703('0xa'),auth[_0xa703('0x8')](),controller['destroy']);module[_0xa703('0xf')]=router; \ No newline at end of file +var _0x33ec=['../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','post','create','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x191b8c,_0x6cc2e){var _0x1f231b=function(_0x339ee9){while(--_0x339ee9){_0x191b8c['push'](_0x191b8c['shift']());}};_0x1f231b(++_0x6cc2e);}(_0x33ec,0x1b3));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc33e('0x0'));var util=require(_0xc33e('0x1'));var path=require(_0xc33e('0x2'));var timeout=require('connect-timeout');var express=require(_0xc33e('0x3'));var router=express[_0xc33e('0x4')]();var fs_extra=require(_0xc33e('0x5'));var auth=require(_0xc33e('0x6'));var interaction=require(_0xc33e('0x7'));var config=require('../../config/environment');var controller=require(_0xc33e('0x8'));router[_0xc33e('0x9')]('/',auth[_0xc33e('0xa')](),controller['index']);router[_0xc33e('0x9')]('/:id',auth[_0xc33e('0xa')](),controller['show']);router[_0xc33e('0xb')]('/',auth[_0xc33e('0xa')](),controller[_0xc33e('0xc')]);router['put'](_0xc33e('0xd'),auth[_0xc33e('0xa')](),controller[_0xc33e('0xe')]);router[_0xc33e('0xf')](_0xc33e('0xd'),auth[_0xc33e('0xa')](),controller[_0xc33e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d412b20..a1d97bd 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 _0xb10b=['name','sequelize','STRING'];(function(_0x1fa586,_0x45aad9){var _0xd0fbd2=function(_0x464743){while(--_0x464743){_0x1fa586['push'](_0x1fa586['shift']());}};_0xd0fbd2(++_0x45aad9);}(_0xb10b,0x12a));var _0xbb10=function(_0xf5fbb7,_0xdb7f69){_0xf5fbb7=_0xf5fbb7-0x0;var _0x330d55=_0xb10b[_0xf5fbb7];return _0x330d55;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 616b5e9..b2e36f5 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 _0xddd8=['../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','show','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x55cb93,_0x299bc8){var _0x46fb5b=function(_0x462222){while(--_0x462222){_0x55cb93['push'](_0x55cb93['shift']());}};_0x46fb5b(++_0x299bc8);}(_0xddd8,0x6e));var _0x8ddd=function(_0x47c884,_0x365742){_0x47c884=_0x47c884-0x0;var _0x32210c=_0xddd8[_0x47c884];return _0x32210c;};'use strict';var emlformat=require(_0x8ddd('0x0'));var rimraf=require(_0x8ddd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ddd('0x2'));var moment=require(_0x8ddd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ddd('0x4'));var util=require(_0x8ddd('0x5'));var path=require(_0x8ddd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ddd('0x7'));var fs=require('fs');var fs_extra=require(_0x8ddd('0x8'));var _=require(_0x8ddd('0x9'));var squel=require(_0x8ddd('0xa'));var crypto=require(_0x8ddd('0xb'));var jsforce=require(_0x8ddd('0xc'));var deskjs=require(_0x8ddd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8ddd('0xe'));var Papa=require('papaparse');var Redis=require(_0x8ddd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ddd('0x10'));var logger=require(_0x8ddd('0x11'))(_0x8ddd('0x12'));var utils=require(_0x8ddd('0x13'));var config=require(_0x8ddd('0x14'));var licenseUtil=require(_0x8ddd('0x15'));var db=require('../../mysqldb')['db'];config[_0x8ddd('0x16')]=_[_0x8ddd('0x17')](config[_0x8ddd('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ddd('0x18'))(new Redis(config['redis']));require('./dashboard.socket')[_0x8ddd('0x19')](socket);function respondWithStatusCode(_0x4d23f7,_0x30fd65){_0x30fd65=_0x30fd65||0xcc;return function(_0x3910a0){if(_0x3910a0){return _0x4d23f7['sendStatus'](_0x30fd65);}return _0x4d23f7[_0x8ddd('0x1a')](_0x30fd65)['end']();};}function respondWithResult(_0x5a59d3,_0x36998b){_0x36998b=_0x36998b||0xc8;return function(_0x24f186){if(_0x24f186){return _0x5a59d3[_0x8ddd('0x1a')](_0x36998b)[_0x8ddd('0x1b')](_0x24f186);}};}function respondWithFilteredResult(_0x58f75c,_0x15de24){return function(_0x3703c7){if(_0x3703c7){var _0x3e18a2=typeof _0x15de24[_0x8ddd('0x1c')]===_0x8ddd('0x1d')&&typeof _0x15de24['limit']==='undefined';var _0x3fa32e=_0x3703c7[_0x8ddd('0x1e')];var _0x496199=_0x3e18a2?0x0:_0x15de24[_0x8ddd('0x1c')];var _0x202c9a=_0x3e18a2?_0x3703c7[_0x8ddd('0x1e')]:_0x15de24[_0x8ddd('0x1c')]+_0x15de24[_0x8ddd('0x1f')];var _0x27e136;if(_0x202c9a>=_0x3fa32e){_0x202c9a=_0x3fa32e;_0x27e136=0xc8;}else{_0x27e136=0xce;}_0x58f75c[_0x8ddd('0x1a')](_0x27e136);return _0x58f75c[_0x8ddd('0x20')](_0x8ddd('0x21'),_0x496199+'-'+_0x202c9a+'/'+_0x3fa32e)[_0x8ddd('0x1b')](_0x3703c7);}return null;};}function patchUpdates(_0x23f576){return function(_0x243a3d){try{jsonpatch[_0x8ddd('0x22')](_0x243a3d,_0x23f576,!![]);}catch(_0x5cae1e){return BPromise[_0x8ddd('0x23')](_0x5cae1e);}return _0x243a3d[_0x8ddd('0x24')]();};}function saveUpdates(_0x185ef6,_0x200b44){return function(_0x5c0a85){if(_0x5c0a85){return _0x5c0a85[_0x8ddd('0x25')](_0x185ef6)[_0x8ddd('0x26')](function(_0x5c058d){return _0x5c058d;});}return null;};}function removeEntity(_0x4c435b,_0x49306f){return function(_0x48552c){if(_0x48552c){return _0x48552c[_0x8ddd('0x27')]()[_0x8ddd('0x26')](function(){var _0x43f143=_0x48552c['get']({'plain':!![]});var _0x4f61d4=_0x8ddd('0x28');return db[_0x8ddd('0x29')][_0x8ddd('0x27')]({'where':{'type':_0x4f61d4,'resourceId':_0x43f143['id']}})['then'](function(){return _0x48552c;});})[_0x8ddd('0x26')](function(){_0x4c435b['status'](0xcc)[_0x8ddd('0x2a')]();});}};}function handleEntityNotFound(_0x24f909,_0x4b47e6){return function(_0x468c78){if(!_0x468c78){_0x24f909[_0x8ddd('0x2b')](0x194);}return _0x468c78;};}function handleError(_0x4a77ee,_0x12e8b6){_0x12e8b6=_0x12e8b6||0x1f4;return function(_0x74d8bb){logger[_0x8ddd('0x2c')](_0x74d8bb[_0x8ddd('0x2d')]);if(_0x74d8bb[_0x8ddd('0x2e')]){delete _0x74d8bb[_0x8ddd('0x2e')];}_0x4a77ee[_0x8ddd('0x1a')](_0x12e8b6)[_0x8ddd('0x2f')](_0x74d8bb);};}exports['index']=function(_0xd6e5a6,_0x47a8ba){var _0x2a052c={},_0x11602e={},_0x580e20={'count':0x0,'rows':[]};var _0x3a1f65=_[_0x8ddd('0x30')](db['Dashboard'][_0x8ddd('0x31')],function(_0x5affa0){return{'name':_0x5affa0[_0x8ddd('0x32')],'type':_0x5affa0[_0x8ddd('0x33')][_0x8ddd('0x34')]};});_0x11602e[_0x8ddd('0x35')]=_[_0x8ddd('0x30')](_0x3a1f65,_0x8ddd('0x2e'));_0x11602e['query']=_[_0x8ddd('0x36')](_0xd6e5a6[_0x8ddd('0x37')]);_0x11602e[_0x8ddd('0x38')]=_[_0x8ddd('0x39')](_0x11602e[_0x8ddd('0x35')],_0x11602e[_0x8ddd('0x37')]);_0x2a052c[_0x8ddd('0x3a')]=_[_0x8ddd('0x39')](_0x11602e[_0x8ddd('0x35')],qs['fields'](_0xd6e5a6['query']['fields']));_0x2a052c['attributes']=_0x2a052c[_0x8ddd('0x3a')][_0x8ddd('0x3b')]?_0x2a052c[_0x8ddd('0x3a')]:_0x11602e[_0x8ddd('0x35')];if(!_0xd6e5a6[_0x8ddd('0x37')][_0x8ddd('0x3c')](_0x8ddd('0x3d'))){_0x2a052c[_0x8ddd('0x1f')]=qs[_0x8ddd('0x1f')](_0xd6e5a6[_0x8ddd('0x37')][_0x8ddd('0x1f')]);_0x2a052c[_0x8ddd('0x1c')]=qs[_0x8ddd('0x1c')](_0xd6e5a6[_0x8ddd('0x37')]['offset']);}_0x2a052c[_0x8ddd('0x3e')]=qs[_0x8ddd('0x3f')](_0xd6e5a6[_0x8ddd('0x37')]['sort']);_0x2a052c[_0x8ddd('0x40')]=qs[_0x8ddd('0x38')](_[_0x8ddd('0x41')](_0xd6e5a6[_0x8ddd('0x37')],_0x11602e[_0x8ddd('0x38')]),_0x3a1f65);if(_0xd6e5a6['query'][_0x8ddd('0x42')]){_0x2a052c[_0x8ddd('0x40')]=_[_0x8ddd('0x43')](_0x2a052c['where'],{'$or':_[_0x8ddd('0x30')](_0x3a1f65,function(_0xdf2bd4){if(_0xdf2bd4[_0x8ddd('0x33')]!==_0x8ddd('0x44')){var _0x51eddd={};_0x51eddd[_0xdf2bd4[_0x8ddd('0x2e')]]={'$like':'%'+_0xd6e5a6['query'][_0x8ddd('0x42')]+'%'};return _0x51eddd;}})});}_0x2a052c=_[_0x8ddd('0x43')]({},_0x2a052c,_0xd6e5a6[_0x8ddd('0x45')]);var _0xe0df48={'where':_0x2a052c[_0x8ddd('0x40')]};return db[_0x8ddd('0x46')]['count'](_0xe0df48)['then'](function(_0x2c3d85){_0x580e20[_0x8ddd('0x1e')]=_0x2c3d85;if(_0xd6e5a6['query'][_0x8ddd('0x47')]){_0x2a052c[_0x8ddd('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x8ddd('0x49')](_0x2a052c);})['then'](function(_0x20eb2c){_0x580e20[_0x8ddd('0x4a')]=_0x20eb2c;return _0x580e20;})[_0x8ddd('0x26')](respondWithFilteredResult(_0x47a8ba,_0x2a052c))['catch'](handleError(_0x47a8ba,null));};exports[_0x8ddd('0x4b')]=function(_0x49266d,_0x28843e){var _0x37bedc={'raw':![],'where':{'id':_0x49266d[_0x8ddd('0x4c')]['id']}},_0x4b4346={};_0x4b4346[_0x8ddd('0x35')]=_[_0x8ddd('0x36')](db[_0x8ddd('0x46')][_0x8ddd('0x31')]);_0x4b4346['query']=_[_0x8ddd('0x36')](_0x49266d[_0x8ddd('0x37')]);_0x4b4346[_0x8ddd('0x38')]=_[_0x8ddd('0x39')](_0x4b4346['model'],_0x4b4346[_0x8ddd('0x37')]);_0x37bedc[_0x8ddd('0x3a')]=_[_0x8ddd('0x39')](_0x4b4346[_0x8ddd('0x35')],qs[_0x8ddd('0x4d')](_0x49266d[_0x8ddd('0x37')][_0x8ddd('0x4d')]));_0x37bedc[_0x8ddd('0x3a')]=_0x37bedc[_0x8ddd('0x3a')]['length']?_0x37bedc[_0x8ddd('0x3a')]:_0x4b4346[_0x8ddd('0x35')];if(_0x49266d[_0x8ddd('0x37')][_0x8ddd('0x47')]){_0x37bedc[_0x8ddd('0x48')]=[{'all':!![]}];}_0x37bedc=_[_0x8ddd('0x43')]({},_0x37bedc,_0x49266d['options']);return db[_0x8ddd('0x46')][_0x8ddd('0x4e')](_0x37bedc)[_0x8ddd('0x26')](handleEntityNotFound(_0x28843e,null))[_0x8ddd('0x26')](respondWithResult(_0x28843e,null))['catch'](handleError(_0x28843e,null));};exports[_0x8ddd('0x4f')]=function(_0x42f498,_0x77995b){return db['Dashboard']['create'](_0x42f498[_0x8ddd('0x50')],{})['then'](function(_0x4b8c06){var _0x4b2788=_0x42f498[_0x8ddd('0x51')][_0x8ddd('0x52')]({'plain':!![]});if(!_0x4b2788)throw new Error(_0x8ddd('0x53'));if(_0x4b2788[_0x8ddd('0x54')]==='user'){var _0x32dcf5=_0x4b8c06[_0x8ddd('0x52')]({'plain':!![]});var _0x164183=_0x8ddd('0x28');return db[_0x8ddd('0x55')][_0x8ddd('0x4e')]({'where':{'name':_0x164183,'userProfileId':_0x4b2788['userProfileId']},'raw':!![]})['then'](function(_0x30c243){if(_0x30c243&&_0x30c243[_0x8ddd('0x56')]===0x0){return db['UserProfileResource'][_0x8ddd('0x4f')]({'name':_0x32dcf5[_0x8ddd('0x2e')],'resourceId':_0x32dcf5['id'],'type':_0x30c243[_0x8ddd('0x2e')],'sectionId':_0x30c243['id']},{})[_0x8ddd('0x26')](function(){return _0x4b8c06;});}else{return _0x4b8c06;}})['catch'](function(_0xe79513){logger[_0x8ddd('0x2c')](_0x8ddd('0x57'),_0xe79513);throw _0xe79513;});}return _0x4b8c06;})[_0x8ddd('0x26')](respondWithResult(_0x77995b,0xc9))[_0x8ddd('0x58')](handleError(_0x77995b,null));};exports['clone']=function(_0x2b77b9,_0x3e872f){var _0x1a130f={'where':{'id':_0x2b77b9[_0x8ddd('0x4c')]['id']}},_0x46e5ff={};_0x46e5ff[_0x8ddd('0x35')]=_[_0x8ddd('0x36')](db['Dashboard'][_0x8ddd('0x31')]);_0x1a130f[_0x8ddd('0x3a')]=_[_0x8ddd('0x39')](_0x46e5ff[_0x8ddd('0x35')],qs[_0x8ddd('0x4d')](_0x2b77b9['query']['fields']));_0x1a130f[_0x8ddd('0x3a')]=_0x1a130f[_0x8ddd('0x3a')][_0x8ddd('0x3b')]?_0x1a130f[_0x8ddd('0x3a')]:_0x46e5ff['model'];if(_0x2b77b9[_0x8ddd('0x37')]['includeAll']){_0x1a130f[_0x8ddd('0x48')]=[{'all':!![]}];}_0x1a130f=_[_0x8ddd('0x43')]({},_0x1a130f,_0x2b77b9[_0x8ddd('0x45')]);return db[_0x8ddd('0x46')]['find'](_0x1a130f)[_0x8ddd('0x26')](handleEntityNotFound(_0x3e872f,null))[_0x8ddd('0x26')](function(_0x23b217){if(_0x23b217){var _0x71528=_0x23b217[_0x8ddd('0x52')]({'plain':!![]});_0x71528=qs[_0x8ddd('0x59')](_0x71528,['id',_0x8ddd('0x5a'),'updatedAt']);_0x2b77b9['body']=_[_0x8ddd('0x59')](_0x2b77b9[_0x8ddd('0x50')],['id','createdAt',_0x8ddd('0x5b')]);return db[_0x8ddd('0x46')][_0x8ddd('0x4f')](_['merge'](_0x71528,_0x2b77b9[_0x8ddd('0x50')]),{'include':_0x2b77b9['query'][_0x8ddd('0x47')]?[{'all':!![]}]:undefined})[_0x8ddd('0x26')](function(_0x4f894b){var _0x543c70=_0x2b77b9[_0x8ddd('0x51')]['get']({'plain':!![]});if(!_0x543c70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x543c70[_0x8ddd('0x54')]===_0x8ddd('0x51')){var _0x219258=_0x4f894b[_0x8ddd('0x52')]({'plain':!![]});var _0x51b005=_0x8ddd('0x28');return db[_0x8ddd('0x55')]['find']({'where':{'name':_0x51b005,'userProfileId':_0x543c70[_0x8ddd('0x5c')]},'raw':!![]})[_0x8ddd('0x26')](function(_0x3f7583){if(_0x3f7583&&_0x3f7583[_0x8ddd('0x56')]===0x0){return db[_0x8ddd('0x29')][_0x8ddd('0x4f')]({'name':_0x219258[_0x8ddd('0x2e')],'resourceId':_0x219258['id'],'type':_0x3f7583[_0x8ddd('0x2e')],'sectionId':_0x3f7583['id']},{})['then'](function(){return _0x4f894b;});}else{return _0x4f894b;}})['catch'](function(_0x9bd115){logger[_0x8ddd('0x2c')](_0x8ddd('0x57'),_0x9bd115);throw _0x9bd115;});}return _0x4f894b;});}})[_0x8ddd('0x26')](respondWithResult(_0x3e872f,0xc9))[_0x8ddd('0x58')](handleError(_0x3e872f,null));};exports[_0x8ddd('0x25')]=function(_0x106e35,_0x3be3f8){if(_0x106e35['body']['id']){delete _0x106e35[_0x8ddd('0x50')]['id'];}return db[_0x8ddd('0x46')][_0x8ddd('0x4e')]({'where':{'id':_0x106e35['params']['id']}})['then'](handleEntityNotFound(_0x3be3f8,null))[_0x8ddd('0x26')](saveUpdates(_0x106e35[_0x8ddd('0x50')],null))['then'](respondWithResult(_0x3be3f8,null))[_0x8ddd('0x58')](handleError(_0x3be3f8,null));};exports[_0x8ddd('0x27')]=function(_0x9fcc8e,_0x418cd1){return db[_0x8ddd('0x46')][_0x8ddd('0x4e')]({'where':{'id':_0x9fcc8e[_0x8ddd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x418cd1,null))['then'](removeEntity(_0x418cd1,null))[_0x8ddd('0x58')](handleError(_0x418cd1,null));};function widgetAttributes(_0x25226b){try{switch(_0x25226b[_0x8ddd('0x33')]){case _0x8ddd('0x5d'):return[{'name':_0x8ddd('0x5e'),'value':_0x25226b[_0x8ddd('0x5e')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0]['value']:undefined)||_0x8ddd('0x60')}];case _0x8ddd('0x61'):return[{'name':_0x8ddd('0x62'),'value':_0x25226b[_0x8ddd('0x62')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0][_0x8ddd('0x63')]:undefined)||''}];case'clock':return[{'name':_0x8ddd('0x64'),'value':_0x25226b[_0x8ddd('0x64')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x0]?_0x25226b['attrs'][0x0][_0x8ddd('0x63')]:undefined)||_0x8ddd('0x65')},{'name':'attrTimezone','value':_0x25226b[_0x8ddd('0x66')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x1]?_0x25226b[_0x8ddd('0x5f')][0x1][_0x8ddd('0x63')]:undefined)||_0x8ddd('0x67')},{'name':'attrFontSize','value':_0x25226b['attrFontSize']||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x2]?_0x25226b[_0x8ddd('0x5f')][0x2][_0x8ddd('0x63')]:undefined)||0xc}];case _0x8ddd('0x68'):return[{'name':_0x8ddd('0x69'),'value':_0x25226b[_0x8ddd('0x69')]||(_0x25226b['attrs']&&_0x25226b[_0x8ddd('0x5f')][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0]['value']:undefined)||_0x8ddd('0x6a')},{'name':_0x8ddd('0x6b'),'value':_0x25226b[_0x8ddd('0x6b')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x1]?_0x25226b['attrs'][0x1][_0x8ddd('0x63')]:undefined)||[]},{'name':_0x8ddd('0x6c'),'value':_0x25226b[_0x8ddd('0x6c')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x2]?_0x25226b[_0x8ddd('0x5f')][0x2][_0x8ddd('0x63')]:undefined)||0x14},{'name':_0x8ddd('0x6d'),'value':_0x25226b[_0x8ddd('0x6d')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x3]?_0x25226b[_0x8ddd('0x5f')][0x3][_0x8ddd('0x63')]:undefined)||_0x8ddd('0x6e')},{'name':_0x8ddd('0x6f'),'value':_0x25226b[_0x8ddd('0x6f')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x4]?_0x25226b[_0x8ddd('0x5f')][0x4][_0x8ddd('0x63')]:undefined)||''},{'name':_0x8ddd('0x70'),'value':_0x25226b['attrFaxAccounts']||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x5]?_0x25226b[_0x8ddd('0x5f')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x25226b[_0x8ddd('0x71')]||(_0x25226b['attrs']&&_0x25226b['attrs'][0x6]?_0x25226b[_0x8ddd('0x5f')][0x6][_0x8ddd('0x63')]:undefined)||''},{'name':_0x8ddd('0x72'),'value':_0x25226b[_0x8ddd('0x72')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x7]?_0x25226b[_0x8ddd('0x5f')][0x7][_0x8ddd('0x63')]:undefined)||''},{'name':_0x8ddd('0x73'),'value':_0x25226b[_0x8ddd('0x73')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x8]?_0x25226b['attrs'][0x8][_0x8ddd('0x63')]:undefined)||''},{'name':_0x8ddd('0x74'),'value':_0x25226b[_0x8ddd('0x74')]||(_0x25226b['attrs']&&_0x25226b[_0x8ddd('0x5f')][0x9]?_0x25226b[_0x8ddd('0x5f')][0x9][_0x8ddd('0x63')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x8ddd('0x75'),'value':_0x25226b[_0x8ddd('0x75')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0]['value']:undefined)||_0x8ddd('0x6a')},{'name':_0x8ddd('0x76'),'value':_0x25226b[_0x8ddd('0x76')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x1]?_0x25226b['attrs'][0x1][_0x8ddd('0x63')]:undefined)||null},{'name':_0x8ddd('0x77'),'value':_0x25226b[_0x8ddd('0x77')]||(_0x25226b['attrs']&&_0x25226b[_0x8ddd('0x5f')][0x2]?_0x25226b[_0x8ddd('0x5f')][0x2][_0x8ddd('0x63')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25226b[_0x8ddd('0x6b')]||(_0x25226b['attrs']&&_0x25226b[_0x8ddd('0x5f')][0x3]?_0x25226b[_0x8ddd('0x5f')][0x3][_0x8ddd('0x63')]:undefined)||[]},{'name':_0x8ddd('0x6d'),'value':_0x25226b[_0x8ddd('0x6d')]||(_0x25226b['attrs']&&_0x25226b['attrs'][0x4]?_0x25226b[_0x8ddd('0x5f')][0x4][_0x8ddd('0x63')]:undefined)||_0x8ddd('0x6e')},{'name':'attrEmailAccounts','value':_0x25226b[_0x8ddd('0x6f')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x5]?_0x25226b['attrs'][0x5][_0x8ddd('0x63')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x25226b['attrFaxAccounts']||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x6]?_0x25226b[_0x8ddd('0x5f')][0x6][_0x8ddd('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x25226b[_0x8ddd('0x71')]||(_0x25226b['attrs']&&_0x25226b[_0x8ddd('0x5f')][0x7]?_0x25226b['attrs'][0x7]['value']:undefined)||''},{'name':_0x8ddd('0x72'),'value':_0x25226b[_0x8ddd('0x72')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x8]?_0x25226b[_0x8ddd('0x5f')][0x8][_0x8ddd('0x63')]:undefined)||''},{'name':_0x8ddd('0x73'),'value':_0x25226b['attrWhatsappAccounts']||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x9]?_0x25226b[_0x8ddd('0x5f')][0x9][_0x8ddd('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x25226b[_0x8ddd('0x74')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0xa]?_0x25226b[_0x8ddd('0x5f')][0xa]['value']:undefined)||''}];case _0x8ddd('0x78'):return[{'name':_0x8ddd('0x79'),'type':_0x25226b[_0x8ddd('0x7a')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0][_0x8ddd('0x33')]:undefined)||null,'value':_0x25226b['attrReport']||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b['attrs'][0x0]?_0x25226b[_0x8ddd('0x5f')][0x0][_0x8ddd('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x25226b[_0x8ddd('0x7b')]||(_0x25226b[_0x8ddd('0x5f')]&&_0x25226b[_0x8ddd('0x5f')][0x1]?_0x25226b[_0x8ddd('0x5f')][0x1][_0x8ddd('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x37d458){logger[_0x8ddd('0x2c')](_0x8ddd('0x7c'),JSON[_0x8ddd('0x7d')](_0x37d458));return[];}}exports['addItem']=function(_0x5c810f,_0x48e793,_0x1f3396){if(_0x5c810f[_0x8ddd('0x50')]['id']){delete _0x5c810f[_0x8ddd('0x50')]['id'];}return db[_0x8ddd('0x46')][_0x8ddd('0x4e')]({'where':{'id':_0x5c810f[_0x8ddd('0x4c')]['id']}})[_0x8ddd('0x26')](handleEntityNotFound(_0x48e793,null))[_0x8ddd('0x26')](function(_0xeaaf30){if(_0xeaaf30){_0x5c810f[_0x8ddd('0x50')][_0x8ddd('0x7e')]=_0xeaaf30['id'];_0x5c810f['body'][_0x8ddd('0x5f')]=widgetAttributes(_0x5c810f[_0x8ddd('0x50')]);return db[_0x8ddd('0x7f')][_0x8ddd('0x4f')](_0x5c810f['body']);}})[_0x8ddd('0x26')](respondWithResult(_0x48e793,null))[_0x8ddd('0x58')](handleError(_0x48e793,null));};exports['getItems']=function(_0x4faa27,_0x5a9075,_0x5b5edc){var _0x37f161={};var _0xd3fa1b={};var _0x45e660;var _0x2c0ba3;return db['Dashboard'][_0x8ddd('0x80')]({'where':{'id':_0x4faa27[_0x8ddd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a9075,null))[_0x8ddd('0x26')](function(_0x4f0192){if(_0x4f0192){_0x45e660=_0x4f0192;_0xd3fa1b[_0x8ddd('0x35')]=_['keys'](db[_0x8ddd('0x7f')][_0x8ddd('0x31')]);_0xd3fa1b[_0x8ddd('0x37')]=_[_0x8ddd('0x36')](_0x4faa27[_0x8ddd('0x37')]);_0xd3fa1b[_0x8ddd('0x38')]=_[_0x8ddd('0x39')](_0xd3fa1b[_0x8ddd('0x35')],_0xd3fa1b['query']);_0x37f161['attributes']=_[_0x8ddd('0x39')](_0xd3fa1b[_0x8ddd('0x35')],qs['fields'](_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x4d')]));_0x37f161[_0x8ddd('0x3a')]=_0x37f161[_0x8ddd('0x3a')]['length']?_0x37f161[_0x8ddd('0x3a')]:_0xd3fa1b['model'];_0x37f161['order']=qs[_0x8ddd('0x3f')](_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x3f')]);_0x37f161[_0x8ddd('0x40')]=qs['filters'](_['pick'](_0x4faa27[_0x8ddd('0x37')],_0xd3fa1b['filters']));if(_0x4faa27[_0x8ddd('0x37')]['filter']){_0x37f161[_0x8ddd('0x40')]=_[_0x8ddd('0x43')](_0x37f161[_0x8ddd('0x40')],{'$or':_[_0x8ddd('0x30')](_0x37f161['attributes'],function(_0x516c93){var _0x14d908={};_0x14d908[_0x516c93]={'$like':'%'+_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x42')]+'%'};return _0x14d908;})});}_0x37f161=_['merge']({},_0x37f161,_0x4faa27[_0x8ddd('0x45')]);return _0x45e660['getItems'](_0x37f161);}})[_0x8ddd('0x26')](function(_0x5e34d1){if(_0x5e34d1){_0x2c0ba3=_0x5e34d1[_0x8ddd('0x3b')];if(!_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x3c')](_0x8ddd('0x3d'))){_0x37f161[_0x8ddd('0x1f')]=qs[_0x8ddd('0x1f')](_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x1f')]);_0x37f161[_0x8ddd('0x1c')]=qs[_0x8ddd('0x1c')](_0x4faa27[_0x8ddd('0x37')][_0x8ddd('0x1c')]);}return _0x45e660[_0x8ddd('0x81')](_0x37f161);}})['then'](function(_0x334ccc){if(_0x334ccc){return _0x334ccc?{'count':_0x2c0ba3,'rows':_0x334ccc}:null;}})['then'](respondWithResult(_0x5a9075,null))[_0x8ddd('0x58')](handleError(_0x5a9075,null));}; \ No newline at end of file +var _0x741f=['attrRefresh','widgetAttributes:\x20%s','stringify','getItems','DashboardItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType'];(function(_0x4a6379,_0x2ce744){var _0x5a99d4=function(_0x404e99){while(--_0x404e99){_0x4a6379['push'](_0x4a6379['shift']());}};_0x5a99d4(++_0x2ce744);}(_0x741f,0x82));var _0xf741=function(_0x5e96fe,_0x40b644){_0x5e96fe=_0x5e96fe-0x0;var _0x26e8cc=_0x741f[_0x5e96fe];return _0x26e8cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf741('0x0'));var zipdir=require(_0xf741('0x1'));var jsonpatch=require(_0xf741('0x2'));var rp=require(_0xf741('0x3'));var moment=require(_0xf741('0x4'));var BPromise=require(_0xf741('0x5'));var Mustache=require(_0xf741('0x6'));var util=require(_0xf741('0x7'));var path=require(_0xf741('0x8'));var sox=require(_0xf741('0x9'));var csv=require(_0xf741('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf741('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf741('0xc'));var jsforce=require(_0xf741('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf741('0xa'));var querystring=require(_0xf741('0xe'));var Papa=require('papaparse');var Redis=require(_0xf741('0xf'));var authService=require(_0xf741('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf741('0x11'));var logger=require(_0xf741('0x12'))(_0xf741('0x13'));var utils=require(_0xf741('0x14'));var config=require(_0xf741('0x15'));var licenseUtil=require(_0xf741('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf741('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf741('0x18')]));require(_0xf741('0x19'))[_0xf741('0x1a')](socket);function respondWithStatusCode(_0x58dd27,_0x323e9a){_0x323e9a=_0x323e9a||0xcc;return function(_0x49581b){if(_0x49581b){return _0x58dd27[_0xf741('0x1b')](_0x323e9a);}return _0x58dd27[_0xf741('0x1c')](_0x323e9a)[_0xf741('0x1d')]();};}function respondWithResult(_0x52e318,_0x29f8dc){_0x29f8dc=_0x29f8dc||0xc8;return function(_0x40b769){if(_0x40b769){return _0x52e318['status'](_0x29f8dc)[_0xf741('0x1e')](_0x40b769);}};}function respondWithFilteredResult(_0x3c110c,_0x20a6a3){return function(_0x1141c8){if(_0x1141c8){var _0xe6bd2a=typeof _0x20a6a3[_0xf741('0x1f')]===_0xf741('0x20')&&typeof _0x20a6a3[_0xf741('0x21')]===_0xf741('0x20');var _0x53970b=_0x1141c8[_0xf741('0x22')];var _0x1d2ab1=_0xe6bd2a?0x0:_0x20a6a3['offset'];var _0x281ac5=_0xe6bd2a?_0x1141c8['count']:_0x20a6a3['offset']+_0x20a6a3[_0xf741('0x21')];var _0x57d68b;if(_0x281ac5>=_0x53970b){_0x281ac5=_0x53970b;_0x57d68b=0xc8;}else{_0x57d68b=0xce;}_0x3c110c[_0xf741('0x1c')](_0x57d68b);return _0x3c110c[_0xf741('0x23')]('Content-Range',_0x1d2ab1+'-'+_0x281ac5+'/'+_0x53970b)[_0xf741('0x1e')](_0x1141c8);}return null;};}function patchUpdates(_0x4b3102){return function(_0x21d17d){try{jsonpatch[_0xf741('0x24')](_0x21d17d,_0x4b3102,!![]);}catch(_0x1bf922){return BPromise[_0xf741('0x25')](_0x1bf922);}return _0x21d17d[_0xf741('0x26')]();};}function saveUpdates(_0x1d8ad5,_0x5dd94c){return function(_0x3c7a23){if(_0x3c7a23){return _0x3c7a23['update'](_0x1d8ad5)[_0xf741('0x27')](function(_0x307a97){return _0x307a97;});}return null;};}function removeEntity(_0x292ee6,_0x2b0ee5){return function(_0x90c12d){if(_0x90c12d){return _0x90c12d[_0xf741('0x28')]()[_0xf741('0x27')](function(){var _0x5eaf14=_0x90c12d[_0xf741('0x29')]({'plain':!![]});var _0x1852af=_0xf741('0x2a');return db[_0xf741('0x2b')]['destroy']({'where':{'type':_0x1852af,'resourceId':_0x5eaf14['id']}})[_0xf741('0x27')](function(){return _0x90c12d;});})[_0xf741('0x27')](function(){_0x292ee6[_0xf741('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23f829,_0x5894c0){return function(_0x8e9f8c){if(!_0x8e9f8c){_0x23f829[_0xf741('0x1b')](0x194);}return _0x8e9f8c;};}function handleError(_0x3dbfca,_0x14c5f1){_0x14c5f1=_0x14c5f1||0x1f4;return function(_0x49f778){logger[_0xf741('0x2c')](_0x49f778[_0xf741('0x2d')]);if(_0x49f778[_0xf741('0x2e')]){delete _0x49f778[_0xf741('0x2e')];}_0x3dbfca['status'](_0x14c5f1)['send'](_0x49f778);};}exports[_0xf741('0x2f')]=function(_0x55d640,_0x3b758e){var _0x4aa080={},_0x4c46e0={},_0x195731={'count':0x0,'rows':[]};var _0x5e8742=_[_0xf741('0x30')](db[_0xf741('0x31')][_0xf741('0x32')],function(_0xf24227){return{'name':_0xf24227[_0xf741('0x33')],'type':_0xf24227[_0xf741('0x34')]['key']};});_0x4c46e0[_0xf741('0x35')]=_[_0xf741('0x30')](_0x5e8742,_0xf741('0x2e'));_0x4c46e0[_0xf741('0x36')]=_['keys'](_0x55d640[_0xf741('0x36')]);_0x4c46e0[_0xf741('0x37')]=_['intersection'](_0x4c46e0[_0xf741('0x35')],_0x4c46e0[_0xf741('0x36')]);_0x4aa080[_0xf741('0x38')]=_[_0xf741('0x39')](_0x4c46e0['model'],qs[_0xf741('0x3a')](_0x55d640[_0xf741('0x36')][_0xf741('0x3a')]));_0x4aa080[_0xf741('0x38')]=_0x4aa080[_0xf741('0x38')][_0xf741('0x3b')]?_0x4aa080[_0xf741('0x38')]:_0x4c46e0[_0xf741('0x35')];if(!_0x55d640[_0xf741('0x36')][_0xf741('0x3c')](_0xf741('0x3d'))){_0x4aa080['limit']=qs[_0xf741('0x21')](_0x55d640[_0xf741('0x36')][_0xf741('0x21')]);_0x4aa080[_0xf741('0x1f')]=qs['offset'](_0x55d640['query'][_0xf741('0x1f')]);}_0x4aa080[_0xf741('0x3e')]=qs['sort'](_0x55d640[_0xf741('0x36')][_0xf741('0x3f')]);_0x4aa080[_0xf741('0x40')]=qs['filters'](_[_0xf741('0x41')](_0x55d640[_0xf741('0x36')],_0x4c46e0[_0xf741('0x37')]),_0x5e8742);if(_0x55d640[_0xf741('0x36')][_0xf741('0x42')]){_0x4aa080[_0xf741('0x40')]=_[_0xf741('0x43')](_0x4aa080[_0xf741('0x40')],{'$or':_['map'](_0x5e8742,function(_0x5d0e35){if(_0x5d0e35[_0xf741('0x34')]!==_0xf741('0x44')){var _0x1626e7={};_0x1626e7[_0x5d0e35['name']]={'$like':'%'+_0x55d640[_0xf741('0x36')][_0xf741('0x42')]+'%'};return _0x1626e7;}})});}_0x4aa080=_[_0xf741('0x43')]({},_0x4aa080,_0x55d640[_0xf741('0x45')]);var _0x5f19fc={'where':_0x4aa080[_0xf741('0x40')]};return db[_0xf741('0x31')]['count'](_0x5f19fc)[_0xf741('0x27')](function(_0x1bb88c){_0x195731['count']=_0x1bb88c;if(_0x55d640[_0xf741('0x36')]['includeAll']){_0x4aa080[_0xf741('0x46')]=[{'all':!![]}];}return db[_0xf741('0x31')][_0xf741('0x47')](_0x4aa080);})[_0xf741('0x27')](function(_0x285163){_0x195731[_0xf741('0x48')]=_0x285163;return _0x195731;})[_0xf741('0x27')](respondWithFilteredResult(_0x3b758e,_0x4aa080))['catch'](handleError(_0x3b758e,null));};exports['show']=function(_0x2f93d9,_0x918dc2){var _0xfce6ab={'raw':![],'where':{'id':_0x2f93d9[_0xf741('0x49')]['id']}},_0xe2913d={};_0xe2913d[_0xf741('0x35')]=_[_0xf741('0x4a')](db['Dashboard'][_0xf741('0x32')]);_0xe2913d['query']=_[_0xf741('0x4a')](_0x2f93d9[_0xf741('0x36')]);_0xe2913d['filters']=_[_0xf741('0x39')](_0xe2913d[_0xf741('0x35')],_0xe2913d['query']);_0xfce6ab[_0xf741('0x38')]=_[_0xf741('0x39')](_0xe2913d[_0xf741('0x35')],qs[_0xf741('0x3a')](_0x2f93d9[_0xf741('0x36')][_0xf741('0x3a')]));_0xfce6ab['attributes']=_0xfce6ab[_0xf741('0x38')][_0xf741('0x3b')]?_0xfce6ab['attributes']:_0xe2913d['model'];if(_0x2f93d9[_0xf741('0x36')][_0xf741('0x4b')]){_0xfce6ab[_0xf741('0x46')]=[{'all':!![]}];}_0xfce6ab=_['merge']({},_0xfce6ab,_0x2f93d9['options']);return db[_0xf741('0x31')][_0xf741('0x4c')](_0xfce6ab)[_0xf741('0x27')](handleEntityNotFound(_0x918dc2,null))[_0xf741('0x27')](respondWithResult(_0x918dc2,null))['catch'](handleError(_0x918dc2,null));};exports['create']=function(_0x2666cb,_0x5f1d9d){return db['Dashboard'][_0xf741('0x4d')](_0x2666cb[_0xf741('0x4e')],{})['then'](function(_0x1de2e0){var _0x5076b5=_0x2666cb[_0xf741('0x4f')][_0xf741('0x29')]({'plain':!![]});if(!_0x5076b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5076b5[_0xf741('0x50')]==='user'){var _0x145316=_0x1de2e0[_0xf741('0x29')]({'plain':!![]});var _0x50683c='CustomDashboards';return db[_0xf741('0x51')]['find']({'where':{'name':_0x50683c,'userProfileId':_0x5076b5[_0xf741('0x52')]},'raw':!![]})[_0xf741('0x27')](function(_0x4c6374){if(_0x4c6374&&_0x4c6374[_0xf741('0x53')]===0x0){return db[_0xf741('0x2b')]['create']({'name':_0x145316[_0xf741('0x2e')],'resourceId':_0x145316['id'],'type':_0x4c6374[_0xf741('0x2e')],'sectionId':_0x4c6374['id']},{})['then'](function(){return _0x1de2e0;});}else{return _0x1de2e0;}})[_0xf741('0x54')](function(_0xc8a79c){logger[_0xf741('0x2c')](_0xf741('0x55'),_0xc8a79c);throw _0xc8a79c;});}return _0x1de2e0;})[_0xf741('0x27')](respondWithResult(_0x5f1d9d,0xc9))['catch'](handleError(_0x5f1d9d,null));};exports[_0xf741('0x56')]=function(_0x320120,_0x3ebfc3){var _0x543ec3={'where':{'id':_0x320120[_0xf741('0x49')]['id']}},_0x35019d={};_0x35019d[_0xf741('0x35')]=_[_0xf741('0x4a')](db['Dashboard'][_0xf741('0x32')]);_0x543ec3[_0xf741('0x38')]=_['intersection'](_0x35019d[_0xf741('0x35')],qs['fields'](_0x320120[_0xf741('0x36')][_0xf741('0x3a')]));_0x543ec3[_0xf741('0x38')]=_0x543ec3[_0xf741('0x38')][_0xf741('0x3b')]?_0x543ec3[_0xf741('0x38')]:_0x35019d[_0xf741('0x35')];if(_0x320120[_0xf741('0x36')][_0xf741('0x4b')]){_0x543ec3[_0xf741('0x46')]=[{'all':!![]}];}_0x543ec3=_[_0xf741('0x43')]({},_0x543ec3,_0x320120[_0xf741('0x45')]);return db[_0xf741('0x31')]['find'](_0x543ec3)[_0xf741('0x27')](handleEntityNotFound(_0x3ebfc3,null))[_0xf741('0x27')](function(_0x437275){if(_0x437275){var _0x55b9ad=_0x437275[_0xf741('0x29')]({'plain':!![]});_0x55b9ad=qs[_0xf741('0x57')](_0x55b9ad,['id',_0xf741('0x58'),_0xf741('0x59')]);_0x320120['body']=_[_0xf741('0x57')](_0x320120[_0xf741('0x4e')],['id','createdAt',_0xf741('0x59')]);return db[_0xf741('0x31')][_0xf741('0x4d')](_[_0xf741('0x43')](_0x55b9ad,_0x320120[_0xf741('0x4e')]),{'include':_0x320120[_0xf741('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xf741('0x27')](function(_0x526d04){var _0x1f3f0f=_0x320120[_0xf741('0x4f')][_0xf741('0x29')]({'plain':!![]});if(!_0x1f3f0f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f3f0f[_0xf741('0x50')]===_0xf741('0x4f')){var _0x1f970e=_0x526d04['get']({'plain':!![]});var _0x2c4f64='CustomDashboards';return db[_0xf741('0x51')][_0xf741('0x4c')]({'where':{'name':_0x2c4f64,'userProfileId':_0x1f3f0f[_0xf741('0x52')]},'raw':!![]})[_0xf741('0x27')](function(_0x9b6905){if(_0x9b6905&&_0x9b6905[_0xf741('0x53')]===0x0){return db[_0xf741('0x2b')][_0xf741('0x4d')]({'name':_0x1f970e[_0xf741('0x2e')],'resourceId':_0x1f970e['id'],'type':_0x9b6905[_0xf741('0x2e')],'sectionId':_0x9b6905['id']},{})[_0xf741('0x27')](function(){return _0x526d04;});}else{return _0x526d04;}})[_0xf741('0x54')](function(_0x4a80b6){logger[_0xf741('0x2c')](_0xf741('0x55'),_0x4a80b6);throw _0x4a80b6;});}return _0x526d04;});}})[_0xf741('0x27')](respondWithResult(_0x3ebfc3,0xc9))[_0xf741('0x54')](handleError(_0x3ebfc3,null));};exports[_0xf741('0x5a')]=function(_0x26dc36,_0x3ffae2){if(_0x26dc36[_0xf741('0x4e')]['id']){delete _0x26dc36['body']['id'];}return db['Dashboard'][_0xf741('0x4c')]({'where':{'id':_0x26dc36[_0xf741('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ffae2,null))[_0xf741('0x27')](saveUpdates(_0x26dc36[_0xf741('0x4e')],null))[_0xf741('0x27')](respondWithResult(_0x3ffae2,null))['catch'](handleError(_0x3ffae2,null));};exports[_0xf741('0x28')]=function(_0x4e067e,_0x2e638c){return db[_0xf741('0x31')][_0xf741('0x4c')]({'where':{'id':_0x4e067e[_0xf741('0x49')]['id']}})[_0xf741('0x27')](handleEntityNotFound(_0x2e638c,null))[_0xf741('0x27')](removeEntity(_0x2e638c,null))[_0xf741('0x54')](handleError(_0x2e638c,null));};function widgetAttributes(_0x1cd94d){try{switch(_0x1cd94d[_0xf741('0x34')]){case'iframe':return[{'name':_0xf741('0x5b'),'value':_0x1cd94d[_0xf741('0x5b')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x5d')]:undefined)||_0xf741('0x5e')}];case _0xf741('0x5f'):return[{'name':_0xf741('0x60'),'value':_0x1cd94d[_0xf741('0x60')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d['attrs'][0x0][_0xf741('0x5d')]:undefined)||''}];case _0xf741('0x61'):return[{'name':_0xf741('0x62'),'value':_0x1cd94d['attrHourFormat']||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x5d')]:undefined)||_0xf741('0x63')},{'name':'attrTimezone','value':_0x1cd94d['attrTimezone']||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x1]?_0x1cd94d[_0xf741('0x5c')][0x1][_0xf741('0x5d')]:undefined)||_0xf741('0x64')},{'name':'attrFontSize','value':_0x1cd94d[_0xf741('0x65')]||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x2]?_0x1cd94d[_0xf741('0x5c')][0x2][_0xf741('0x5d')]:undefined)||0xc}];case _0xf741('0x66'):return[{'name':_0xf741('0x67'),'value':_0x1cd94d['attrMetric']||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x5d')]:undefined)||_0xf741('0x68')},{'name':'attrVoiceQueues','value':_0x1cd94d[_0xf741('0x69')]||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x1]?_0x1cd94d[_0xf741('0x5c')][0x1]['value']:undefined)||[]},{'name':_0xf741('0x65'),'value':_0x1cd94d['attrFontSize']||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d['attrs'][0x2]?_0x1cd94d[_0xf741('0x5c')][0x2][_0xf741('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x1cd94d[_0xf741('0x6a')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x3]?_0x1cd94d[_0xf741('0x5c')][0x3]['value']:undefined)||_0xf741('0x6b')},{'name':_0xf741('0x6c'),'value':_0x1cd94d[_0xf741('0x6c')]||(_0x1cd94d['attrs']&&_0x1cd94d['attrs'][0x4]?_0x1cd94d[_0xf741('0x5c')][0x4][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x6d'),'value':_0x1cd94d[_0xf741('0x6d')]||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x5]?_0x1cd94d[_0xf741('0x5c')][0x5][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x6e'),'value':_0x1cd94d['attrSmsAccounts']||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x6]?_0x1cd94d[_0xf741('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1cd94d[_0xf741('0x6f')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x7]?_0x1cd94d[_0xf741('0x5c')][0x7][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x70'),'value':_0x1cd94d[_0xf741('0x70')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x8]?_0x1cd94d[_0xf741('0x5c')][0x8][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x71'),'value':_0x1cd94d[_0xf741('0x71')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d['attrs'][0x9]?_0x1cd94d['attrs'][0x9][_0xf741('0x5d')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xf741('0x72'),'value':_0x1cd94d[_0xf741('0x72')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x5d')]:undefined)||_0xf741('0x68')},{'name':_0xf741('0x73'),'value':_0x1cd94d['attrSerie2']||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x1]?_0x1cd94d[_0xf741('0x5c')][0x1][_0xf741('0x5d')]:undefined)||null},{'name':_0xf741('0x74'),'value':_0x1cd94d[_0xf741('0x74')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x2]?_0x1cd94d[_0xf741('0x5c')][0x2]['value']:undefined)||null},{'name':_0xf741('0x69'),'value':_0x1cd94d[_0xf741('0x69')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x3]?_0x1cd94d[_0xf741('0x5c')][0x3][_0xf741('0x5d')]:undefined)||[]},{'name':_0xf741('0x6a'),'value':_0x1cd94d[_0xf741('0x6a')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x4]?_0x1cd94d[_0xf741('0x5c')][0x4]['value']:undefined)||_0xf741('0x6b')},{'name':_0xf741('0x6c'),'value':_0x1cd94d[_0xf741('0x6c')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x5]?_0x1cd94d[_0xf741('0x5c')][0x5][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x6d'),'value':_0x1cd94d[_0xf741('0x6d')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x6]?_0x1cd94d[_0xf741('0x5c')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1cd94d['attrSmsAccounts']||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x7]?_0x1cd94d['attrs'][0x7][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x6f'),'value':_0x1cd94d[_0xf741('0x6f')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x8]?_0x1cd94d['attrs'][0x8][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x70'),'value':_0x1cd94d['attrWhatsappAccounts']||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x9]?_0x1cd94d[_0xf741('0x5c')][0x9][_0xf741('0x5d')]:undefined)||''},{'name':_0xf741('0x71'),'value':_0x1cd94d[_0xf741('0x71')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0xa]?_0x1cd94d[_0xf741('0x5c')][0xa][_0xf741('0x5d')]:undefined)||''}];case _0xf741('0x75'):return[{'name':_0xf741('0x76'),'type':_0x1cd94d[_0xf741('0x77')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x34')]:undefined)||null,'value':_0x1cd94d[_0xf741('0x76')]||(_0x1cd94d[_0xf741('0x5c')]&&_0x1cd94d[_0xf741('0x5c')][0x0]?_0x1cd94d[_0xf741('0x5c')][0x0][_0xf741('0x5d')]:undefined)||null},{'name':_0xf741('0x78'),'value':_0x1cd94d[_0xf741('0x78')]||(_0x1cd94d['attrs']&&_0x1cd94d[_0xf741('0x5c')][0x1]?_0x1cd94d[_0xf741('0x5c')][0x1][_0xf741('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3c7d9f){logger[_0xf741('0x2c')](_0xf741('0x79'),JSON[_0xf741('0x7a')](_0x3c7d9f));return[];}}exports['addItem']=function(_0x414e04,_0x375c99,_0x2941a1){if(_0x414e04['body']['id']){delete _0x414e04['body']['id'];}return db[_0xf741('0x31')]['find']({'where':{'id':_0x414e04[_0xf741('0x49')]['id']}})[_0xf741('0x27')](handleEntityNotFound(_0x375c99,null))['then'](function(_0x2d0065){if(_0x2d0065){_0x414e04[_0xf741('0x4e')]['DashboardId']=_0x2d0065['id'];_0x414e04['body'][_0xf741('0x5c')]=widgetAttributes(_0x414e04[_0xf741('0x4e')]);return db['DashboardItem'][_0xf741('0x4d')](_0x414e04[_0xf741('0x4e')]);}})[_0xf741('0x27')](respondWithResult(_0x375c99,null))[_0xf741('0x54')](handleError(_0x375c99,null));};exports[_0xf741('0x7b')]=function(_0x380d54,_0x4bee9f,_0x59a6ed){var _0x42554a={};var _0x30a65c={};var _0x3406d3;var _0x4611a6;return db[_0xf741('0x31')]['findOne']({'where':{'id':_0x380d54[_0xf741('0x49')]['id']}})[_0xf741('0x27')](handleEntityNotFound(_0x4bee9f,null))['then'](function(_0x38cad0){if(_0x38cad0){_0x3406d3=_0x38cad0;_0x30a65c[_0xf741('0x35')]=_['keys'](db[_0xf741('0x7c')][_0xf741('0x32')]);_0x30a65c[_0xf741('0x36')]=_[_0xf741('0x4a')](_0x380d54[_0xf741('0x36')]);_0x30a65c[_0xf741('0x37')]=_['intersection'](_0x30a65c[_0xf741('0x35')],_0x30a65c['query']);_0x42554a['attributes']=_[_0xf741('0x39')](_0x30a65c[_0xf741('0x35')],qs[_0xf741('0x3a')](_0x380d54['query'][_0xf741('0x3a')]));_0x42554a[_0xf741('0x38')]=_0x42554a[_0xf741('0x38')][_0xf741('0x3b')]?_0x42554a[_0xf741('0x38')]:_0x30a65c[_0xf741('0x35')];_0x42554a[_0xf741('0x3e')]=qs['sort'](_0x380d54[_0xf741('0x36')][_0xf741('0x3f')]);_0x42554a[_0xf741('0x40')]=qs[_0xf741('0x37')](_['pick'](_0x380d54['query'],_0x30a65c['filters']));if(_0x380d54[_0xf741('0x36')][_0xf741('0x42')]){_0x42554a[_0xf741('0x40')]=_['merge'](_0x42554a[_0xf741('0x40')],{'$or':_[_0xf741('0x30')](_0x42554a[_0xf741('0x38')],function(_0x333608){var _0x57872d={};_0x57872d[_0x333608]={'$like':'%'+_0x380d54[_0xf741('0x36')][_0xf741('0x42')]+'%'};return _0x57872d;})});}_0x42554a=_[_0xf741('0x43')]({},_0x42554a,_0x380d54[_0xf741('0x45')]);return _0x3406d3[_0xf741('0x7b')](_0x42554a);}})[_0xf741('0x27')](function(_0x532eb2){if(_0x532eb2){_0x4611a6=_0x532eb2[_0xf741('0x3b')];if(!_0x380d54[_0xf741('0x36')]['hasOwnProperty']('nolimit')){_0x42554a[_0xf741('0x21')]=qs['limit'](_0x380d54[_0xf741('0x36')]['limit']);_0x42554a[_0xf741('0x1f')]=qs[_0xf741('0x1f')](_0x380d54[_0xf741('0x36')][_0xf741('0x1f')]);}return _0x3406d3[_0xf741('0x7b')](_0x42554a);}})[_0xf741('0x27')](function(_0x3f91c3){if(_0x3f91c3){return _0x3f91c3?{'count':_0x4611a6,'rows':_0x3f91c3}:null;}})[_0xf741('0x27')](respondWithResult(_0x4bee9f,null))[_0xf741('0x54')](handleError(_0x4bee9f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a0ad933..dade453 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 _0x7bd9=['save','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd9,0xee));var _0x97bd=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7bd9[_0x1b349a];return _0x5d1f7c;};'use strict';var EventEmitter=require(_0x97bd('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x97bd('0x1')](0x0);var events={'afterCreate':_0x97bd('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb521e2){return function(_0x1ca13d,_0x45d8dd,_0x5d8d33){DashboardEvents['emit'](_0xb521e2+':'+_0x1ca13d['id'],_0x1ca13d);DashboardEvents[_0x97bd('0x3')](_0xb521e2,_0x1ca13d);_0x5d8d33(null);};}for(var e in events){if(events[_0x97bd('0x4')](e)){var event=events[e];Dashboard[_0x97bd('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xd59d=['Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4dfb1b,_0x26850a){var _0x4dc88=function(_0x367884){while(--_0x367884){_0x4dfb1b['push'](_0x4dfb1b['shift']());}};_0x4dc88(++_0x26850a);}(_0xd59d,0x81));var _0xdd59=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xd59d[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xdd59('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xdd59('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xdd59('0x2')](0x0);var events={'afterCreate':_0xdd59('0x3'),'afterUpdate':_0xdd59('0x4'),'afterDestroy':_0xdd59('0x5')};function emitEvent(_0x25ee97){return function(_0x5b3b2d,_0x1c65cb,_0x52dd03){DashboardEvents['emit'](_0x25ee97+':'+_0x5b3b2d['id'],_0x5b3b2d);DashboardEvents[_0xdd59('0x6')](_0x25ee97,_0x5b3b2d);_0x52dd03(null);};}for(var e in events){if(events[_0xdd59('0x7')](e)){var event=events[e];Dashboard[_0xdd59('0x8')](e,emitEvent(event));}}module[_0xdd59('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index db73cf4..215d1b1 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 _0x274e=['Dashboard','lodash','util','moment','bluebird','rimraf','exports','define'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x274e,0x1d1));var _0xe274=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x274e[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xe274('0x0'));var util=require(_0xe274('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe274('0x2'));var BPromise=require(_0xe274('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe274('0x4'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xe274('0x5')]=function(_0x2b0eb4,_0x4b4493){return _0x2b0eb4[_0xe274('0x6')](_0xe274('0x7'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5fb=['api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x48206e,_0x583832){var _0x5bdd6c=function(_0x23144a){while(--_0x23144a){_0x48206e['push'](_0x48206e['shift']());}};_0x5bdd6c(++_0x583832);}(_0xe5fb,0xce));var _0xbe5f=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xe5fb[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0xbe5f('0x0'));var util=require(_0xbe5f('0x1'));var logger=require('../../config/logger')(_0xbe5f('0x2'));var moment=require(_0xbe5f('0x3'));var BPromise=require(_0xbe5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe5f('0x5'));var rimraf=require(_0xbe5f('0x6'));var config=require(_0xbe5f('0x7'));var attributes=require(_0xbe5f('0x8'));module[_0xbe5f('0x9')]=function(_0x5b0452,_0x26347a){return _0x5b0452[_0xbe5f('0xa')](_0xbe5f('0xb'),attributes,{'tableName':_0xbe5f('0xc'),'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 a430f3d..2a71fda 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 _0x8da5=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0x408e4f,_0x38c7dc){var _0x3e5015=function(_0x4b7741){while(--_0x4b7741){_0x408e4f['push'](_0x408e4f['shift']());}};_0x3e5015(++_0x38c7dc);}(_0x8da5,0x71));var _0x58da=function(_0x2bcd4f,_0x485e47){_0x2bcd4f=_0x2bcd4f-0x0;var _0xceb524=_0x8da5[_0x2bcd4f];return _0xceb524;};'use strict';var _=require(_0x58da('0x0'));var util=require('util');var moment=require(_0x58da('0x1'));var BPromise=require('bluebird');var rs=require(_0x58da('0x2'));var fs=require('fs');var Redis=require(_0x58da('0x3'));var db=require(_0x58da('0x4'))['db'];var utils=require(_0x58da('0x5'));var logger=require(_0x58da('0x6'))(_0x58da('0x7'));var config=require('../../config/environment');var jayson=require(_0x58da('0x8'));var client=jayson[_0x58da('0x9')][_0x58da('0xa')]({'port':0x232a});config[_0x58da('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x58da('0xc'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4565b8,_0x3addc6,_0x3fa05c){return new BPromise(function(_0x34c7b6,_0x2b0419){return client['request'](_0x4565b8,_0x3fa05c)['then'](function(_0xcc4bf6){logger[_0x58da('0xd')](_0x58da('0xe'),_0x3addc6,_0x58da('0xf'));logger[_0x58da('0x10')](_0x58da('0x11'),_0x3addc6,_0x58da('0xf'),JSON['stringify'](_0xcc4bf6));if(_0xcc4bf6[_0x58da('0x12')]){if(_0xcc4bf6['error']['code']===0x1f4){logger[_0x58da('0x12')](_0x58da('0xe'),_0x3addc6,_0xcc4bf6[_0x58da('0x12')]['message']);return _0x2b0419(_0xcc4bf6[_0x58da('0x12')]['message']);}logger['error'](_0x58da('0xe'),_0x3addc6,_0xcc4bf6[_0x58da('0x12')][_0x58da('0x13')]);return _0x34c7b6(_0xcc4bf6[_0x58da('0x12')][_0x58da('0x13')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x3addc6,_0x58da('0xf'));_0x34c7b6(_0xcc4bf6[_0x58da('0x14')][_0x58da('0x13')]);}})['catch'](function(_0x2113da){logger[_0x58da('0x12')](_0x58da('0xe'),_0x3addc6,_0x2113da);_0x2b0419(_0x2113da);});});} \ No newline at end of file +var _0xa084=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0xa084,0x190));var _0x4a08=function(_0x14b561,_0x2ec2c7){_0x14b561=_0x14b561-0x0;var _0x428c9f=_0xa084[_0x14b561];return _0x428c9f;};'use strict';var _=require('lodash');var util=require(_0x4a08('0x0'));var moment=require(_0x4a08('0x1'));var BPromise=require(_0x4a08('0x2'));var rs=require(_0x4a08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a08('0x4'));var logger=require('../../config/logger')(_0x4a08('0x5'));var config=require(_0x4a08('0x6'));var jayson=require(_0x4a08('0x7'));var client=jayson['client'][_0x4a08('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4a08('0x9')],{'host':_0x4a08('0xa'),'port':0x18eb});var socket=require(_0x4a08('0xb'))(new Redis(config[_0x4a08('0x9')]));require('./dashboard.socket')[_0x4a08('0xc')](socket);function respondWithRpcPromise(_0x12e304,_0x288f21,_0x13eb41){return new BPromise(function(_0x1f97b1,_0x474ca5){return client[_0x4a08('0xd')](_0x12e304,_0x13eb41)[_0x4a08('0xe')](function(_0x1a9a00){logger[_0x4a08('0xf')](_0x4a08('0x10'),_0x288f21,_0x4a08('0x11'));logger[_0x4a08('0x12')](_0x4a08('0x13'),_0x288f21,_0x4a08('0x11'),JSON[_0x4a08('0x14')](_0x1a9a00));if(_0x1a9a00['error']){if(_0x1a9a00[_0x4a08('0x15')][_0x4a08('0x16')]===0x1f4){logger[_0x4a08('0x15')](_0x4a08('0x10'),_0x288f21,_0x1a9a00['error'][_0x4a08('0x17')]);return _0x474ca5(_0x1a9a00[_0x4a08('0x15')][_0x4a08('0x17')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x288f21,_0x1a9a00[_0x4a08('0x15')]['message']);return _0x1f97b1(_0x1a9a00[_0x4a08('0x15')][_0x4a08('0x17')]);}else{logger[_0x4a08('0xf')]('Dashboard,\x20%s,\x20%s',_0x288f21,_0x4a08('0x11'));_0x1f97b1(_0x1a9a00[_0x4a08('0x18')]['message']);}})[_0x4a08('0x19')](function(_0x26c30e){logger[_0x4a08('0x15')](_0x4a08('0x10'),_0x288f21,_0x26c30e);_0x474ca5(_0x26c30e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2e012b3..c3e18c8 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 _0x2abb=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0x26e593,_0x1a02d5){var _0x56bac9=function(_0x416bad){while(--_0x416bad){_0x26e593['push'](_0x26e593['shift']());}};_0x56bac9(++_0x1a02d5);}(_0x2abb,0xc8));var _0xb2ab=function(_0x273034,_0x41e8e8){_0x273034=_0x273034-0x0;var _0xf116ca=_0x2abb[_0x273034];return _0xf116ca;};'use strict';var DashboardEvents=require(_0xb2ab('0x0'));var events=[_0xb2ab('0x1'),_0xb2ab('0x2'),_0xb2ab('0x3')];function createListener(_0x4784ac,_0x1501db){return function(_0x223b5a){_0x1501db[_0xb2ab('0x4')](_0x4784ac,_0x223b5a);};}function removeListener(_0x45a950,_0x14fcce){return function(){DashboardEvents[_0xb2ab('0x5')](_0x45a950,_0x14fcce);};}exports['register']=function(_0x11db6d){for(var _0x461fde=0x0,_0x6bddab=events[_0xb2ab('0x6')];_0x461fde<_0x6bddab;_0x461fde++){var _0x29e5ac=events[_0x461fde];var _0x3779c3=createListener(_0xb2ab('0x7')+_0x29e5ac,_0x11db6d);DashboardEvents['on'](_0x29e5ac,_0x3779c3);}}; \ No newline at end of file +var _0xbde0=['emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x21c766,_0x47285c){var _0x260274=function(_0x50f83a){while(--_0x50f83a){_0x21c766['push'](_0x21c766['shift']());}};_0x260274(++_0x47285c);}(_0xbde0,0x1e4));var _0x0bde=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xbde0[_0x4ae6ef];return _0x3cbb4e;};'use strict';var DashboardEvents=require(_0x0bde('0x0'));var events=[_0x0bde('0x1'),'remove','update'];function createListener(_0x4c0436,_0x58be73){return function(_0x51268b){_0x58be73[_0x0bde('0x2')](_0x4c0436,_0x51268b);};}function removeListener(_0x36efdb,_0x50dd35){return function(){DashboardEvents['removeListener'](_0x36efdb,_0x50dd35);};}exports[_0x0bde('0x3')]=function(_0x113f9c){for(var _0x3e22a9=0x0,_0x3567e3=events[_0x0bde('0x4')];_0x3e22a9<_0x3567e3;_0x3e22a9++){var _0x31ee63=events[_0x3e22a9];var _0x360d28=createListener(_0x0bde('0x5')+_0x31ee63,_0x113f9c);DashboardEvents['on'](_0x31ee63,_0x360d28);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2553f99..d1aeb9e 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 _0xdc6f=['create','/:id/clone','addItem','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xdc6f,0xb0));var _0xfdc6=function(_0xb7fca7,_0x38ca46){_0xb7fca7=_0xb7fca7-0x0;var _0x3c0d34=_0xdc6f[_0xb7fca7];return _0x3c0d34;};'use strict';var multer=require(_0xfdc6('0x0'));var util=require('util');var path=require(_0xfdc6('0x1'));var timeout=require(_0xfdc6('0x2'));var express=require(_0xfdc6('0x3'));var router=express['Router']();var fs_extra=require(_0xfdc6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfdc6('0x5'));var controller=require('./dashboard.controller');router[_0xfdc6('0x6')]('/',auth[_0xfdc6('0x7')](),controller[_0xfdc6('0x8')]);router[_0xfdc6('0x6')](_0xfdc6('0x9'),auth[_0xfdc6('0x7')](),controller[_0xfdc6('0xa')]);router[_0xfdc6('0x6')](_0xfdc6('0xb'),auth[_0xfdc6('0x7')](),controller[_0xfdc6('0xc')]);router[_0xfdc6('0xd')]('/',auth[_0xfdc6('0x7')](),controller[_0xfdc6('0xe')]);router[_0xfdc6('0xd')](_0xfdc6('0xf'),auth[_0xfdc6('0x7')](),controller['clone']);router[_0xfdc6('0xd')](_0xfdc6('0xb'),auth['isAuthenticated'](),controller[_0xfdc6('0x10')]);router['put'](_0xfdc6('0x9'),auth[_0xfdc6('0x7')](),controller['update']);router[_0xfdc6('0x11')]('/:id',auth[_0xfdc6('0x7')](),controller[_0xfdc6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x35a8=['post','create','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems'];(function(_0x75dfe2,_0x14cf83){var _0x98432a=function(_0x4dc8dc){while(--_0x4dc8dc){_0x75dfe2['push'](_0x75dfe2['shift']());}};_0x98432a(++_0x14cf83);}(_0x35a8,0x19b));var _0x835a=function(_0x2db3db,_0x5445a6){_0x2db3db=_0x2db3db-0x0;var _0x14f320=_0x35a8[_0x2db3db];return _0x14f320;};'use strict';var multer=require(_0x835a('0x0'));var util=require(_0x835a('0x1'));var path=require(_0x835a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x835a('0x3')]();var fs_extra=require(_0x835a('0x4'));var auth=require(_0x835a('0x5'));var interaction=require(_0x835a('0x6'));var config=require('../../config/environment');var controller=require(_0x835a('0x7'));router[_0x835a('0x8')]('/',auth[_0x835a('0x9')](),controller[_0x835a('0xa')]);router['get'](_0x835a('0xb'),auth['isAuthenticated'](),controller[_0x835a('0xc')]);router[_0x835a('0x8')]('/:id/items',auth[_0x835a('0x9')](),controller[_0x835a('0xd')]);router[_0x835a('0xe')]('/',auth['isAuthenticated'](),controller[_0x835a('0xf')]);router[_0x835a('0xe')](_0x835a('0x10'),auth[_0x835a('0x9')](),controller[_0x835a('0x11')]);router['post'](_0x835a('0x12'),auth['isAuthenticated'](),controller[_0x835a('0x13')]);router[_0x835a('0x14')]('/:id',auth[_0x835a('0x9')](),controller[_0x835a('0x15')]);router[_0x835a('0x16')](_0x835a('0xb'),auth['isAuthenticated'](),controller[_0x835a('0x17')]);module[_0x835a('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 125c05f..6ff82c0 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 _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x2fe804,_0x619aaa){var _0x59340b=function(_0x4a0e46){while(--_0x4a0e46){_0x2fe804['push'](_0x2fe804['shift']());}};_0x59340b(++_0x619aaa);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2eb2[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x2542,0x169));var _0x2254=function(_0x4f37bc,_0x269366){_0x4f37bc=_0x4f37bc-0x0;var _0x259458=_0x2542[_0x4f37bc];return _0x259458;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 38c3c73..4f8a8ff 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 _0x34f2=['catch','find','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrReport','reportType','type','widgetAttributes:\x20%s','stringify','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','options'];(function(_0x2f2214,_0x59f1cc){var _0x2b7ff3=function(_0x58bfe9){while(--_0x58bfe9){_0x2f2214['push'](_0x2f2214['shift']());}};_0x2b7ff3(++_0x59f1cc);}(_0x34f2,0x15a));var _0x234f=function(_0x54d41d,_0x5a7a54){_0x54d41d=_0x54d41d-0x0;var _0xc12bcf=_0x34f2[_0x54d41d];return _0xc12bcf;};'use strict';var emlformat=require(_0x234f('0x0'));var rimraf=require(_0x234f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x234f('0x2'));var rp=require(_0x234f('0x3'));var moment=require(_0x234f('0x4'));var BPromise=require(_0x234f('0x5'));var Mustache=require(_0x234f('0x6'));var util=require(_0x234f('0x7'));var path=require(_0x234f('0x8'));var sox=require(_0x234f('0x9'));var csv=require(_0x234f('0xa'));var ejs=require(_0x234f('0xb'));var fs=require('fs');var fs_extra=require(_0x234f('0xc'));var _=require(_0x234f('0xd'));var squel=require(_0x234f('0xe'));var crypto=require(_0x234f('0xf'));var jsforce=require(_0x234f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x234f('0xa'));var querystring=require(_0x234f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x234f('0x12'));var qs=require(_0x234f('0x13'));var as=require(_0x234f('0x14'));var hardwareService=require(_0x234f('0x15'));var logger=require(_0x234f('0x16'))('api');var utils=require(_0x234f('0x17'));var config=require(_0x234f('0x18'));var licenseUtil=require(_0x234f('0x19'));var db=require(_0x234f('0x1a'))['db'];config['redis']=_[_0x234f('0x1b')](config['redis'],{'host':_0x234f('0x1c'),'port':0x18eb});var socket=require(_0x234f('0x1d'))(new Redis(config[_0x234f('0x1e')]));require(_0x234f('0x1f'))[_0x234f('0x20')](socket);function respondWithStatusCode(_0x10ee30,_0x296c3a){_0x296c3a=_0x296c3a||0xcc;return function(_0x533bd4){if(_0x533bd4){return _0x10ee30['sendStatus'](_0x296c3a);}return _0x10ee30[_0x234f('0x21')](_0x296c3a)[_0x234f('0x22')]();};}function respondWithResult(_0x5f0e9c,_0x14f879){_0x14f879=_0x14f879||0xc8;return function(_0x15fd64){if(_0x15fd64){return _0x5f0e9c[_0x234f('0x21')](_0x14f879)[_0x234f('0x23')](_0x15fd64);}};}function respondWithFilteredResult(_0x304c08,_0x1de6f3){return function(_0x144ea0){if(_0x144ea0){var _0x2ce5e1=typeof _0x1de6f3[_0x234f('0x24')]==='undefined'&&typeof _0x1de6f3[_0x234f('0x25')]===_0x234f('0x26');var _0x357ecb=_0x144ea0[_0x234f('0x27')];var _0x410977=_0x2ce5e1?0x0:_0x1de6f3[_0x234f('0x24')];var _0x470363=_0x2ce5e1?_0x144ea0[_0x234f('0x27')]:_0x1de6f3[_0x234f('0x24')]+_0x1de6f3['limit'];var _0x5e7edd;if(_0x470363>=_0x357ecb){_0x470363=_0x357ecb;_0x5e7edd=0xc8;}else{_0x5e7edd=0xce;}_0x304c08[_0x234f('0x21')](_0x5e7edd);return _0x304c08[_0x234f('0x28')]('Content-Range',_0x410977+'-'+_0x470363+'/'+_0x357ecb)[_0x234f('0x23')](_0x144ea0);}return null;};}function patchUpdates(_0x4ca657){return function(_0x395d16){try{jsonpatch[_0x234f('0x29')](_0x395d16,_0x4ca657,!![]);}catch(_0x17a23c){return BPromise[_0x234f('0x2a')](_0x17a23c);}return _0x395d16[_0x234f('0x2b')]();};}function saveUpdates(_0x434e9f,_0x2b585b){return function(_0x327f99){if(_0x327f99){return _0x327f99[_0x234f('0x2c')](_0x434e9f)[_0x234f('0x2d')](function(_0x758e8d){return _0x758e8d;});}return null;};}function removeEntity(_0xd8ffbf,_0x15de29){return function(_0x31d244){if(_0x31d244){return _0x31d244[_0x234f('0x2e')]()[_0x234f('0x2d')](function(){_0xd8ffbf[_0x234f('0x21')](0xcc)[_0x234f('0x22')]();});}};}function handleEntityNotFound(_0x1521b1,_0x2e7ff0){return function(_0xf16a84){if(!_0xf16a84){_0x1521b1[_0x234f('0x2f')](0x194);}return _0xf16a84;};}function handleError(_0x157b77,_0x5d3759){_0x5d3759=_0x5d3759||0x1f4;return function(_0x1f6032){logger[_0x234f('0x30')](_0x1f6032[_0x234f('0x31')]);if(_0x1f6032[_0x234f('0x32')]){delete _0x1f6032[_0x234f('0x32')];}_0x157b77[_0x234f('0x21')](_0x5d3759)[_0x234f('0x33')](_0x1f6032);};}exports[_0x234f('0x34')]=function(_0x43b338,_0x19f33b){var _0x5ecf4e={'raw':![],'where':{'id':_0x43b338['params']['id']}},_0x3eb02e={};_0x3eb02e[_0x234f('0x35')]=_[_0x234f('0x36')](db[_0x234f('0x37')][_0x234f('0x38')]);_0x3eb02e['query']=_[_0x234f('0x36')](_0x43b338[_0x234f('0x39')]);_0x3eb02e[_0x234f('0x3a')]=_['intersection'](_0x3eb02e['model'],_0x3eb02e[_0x234f('0x39')]);_0x5ecf4e[_0x234f('0x3b')]=_['intersection'](_0x3eb02e['model'],qs[_0x234f('0x3c')](_0x43b338['query']['fields']));_0x5ecf4e[_0x234f('0x3b')]=_0x5ecf4e['attributes'][_0x234f('0x3d')]?_0x5ecf4e[_0x234f('0x3b')]:_0x3eb02e[_0x234f('0x35')];if(_0x43b338[_0x234f('0x39')][_0x234f('0x3e')]){_0x5ecf4e[_0x234f('0x3f')]=[{'all':!![]}];}_0x5ecf4e=_[_0x234f('0x40')]({},_0x5ecf4e,_0x43b338[_0x234f('0x41')]);return db[_0x234f('0x37')]['find'](_0x5ecf4e)[_0x234f('0x2d')](handleEntityNotFound(_0x19f33b,null))[_0x234f('0x2d')](respondWithResult(_0x19f33b,null))[_0x234f('0x42')](handleError(_0x19f33b,null));};exports[_0x234f('0x2e')]=function(_0x34567c,_0x156f25){return db[_0x234f('0x37')][_0x234f('0x43')]({'where':{'id':_0x34567c['params']['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x156f25,null))[_0x234f('0x2d')](removeEntity(_0x156f25,null))[_0x234f('0x42')](handleError(_0x156f25,null));};function widgetAttributes(_0x21e2e5){try{switch(_0x21e2e5['type']){case'iframe':return[{'name':'attrUrl','value':_0x21e2e5[_0x234f('0x44')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5[_0x234f('0x45')][0x0][_0x234f('0x46')]:undefined)||_0x234f('0x47')}];case _0x234f('0x48'):return[{'name':_0x234f('0x49'),'value':_0x21e2e5[_0x234f('0x49')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5[_0x234f('0x45')][0x0][_0x234f('0x46')]:undefined)||''}];case _0x234f('0x4a'):return[{'name':_0x234f('0x4b'),'value':_0x21e2e5[_0x234f('0x4b')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5[_0x234f('0x45')][0x0][_0x234f('0x46')]:undefined)||_0x234f('0x4c')},{'name':'attrTimezone','value':_0x21e2e5[_0x234f('0x4d')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x1]?_0x21e2e5[_0x234f('0x45')][0x1][_0x234f('0x46')]:undefined)||_0x234f('0x4e')},{'name':_0x234f('0x4f'),'value':_0x21e2e5['attrFontSize']||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x2]?_0x21e2e5['attrs'][0x2][_0x234f('0x46')]:undefined)||0xc}];case _0x234f('0x50'):return[{'name':_0x234f('0x51'),'value':_0x21e2e5['attrMetric']||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5[_0x234f('0x45')][0x0][_0x234f('0x46')]:undefined)||_0x234f('0x52')},{'name':_0x234f('0x53'),'value':_0x21e2e5[_0x234f('0x53')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5['attrs'][0x1]?_0x21e2e5[_0x234f('0x45')][0x1]['value']:undefined)||[]},{'name':_0x234f('0x4f'),'value':_0x21e2e5[_0x234f('0x4f')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x2]?_0x21e2e5[_0x234f('0x45')][0x2]['value']:undefined)||0x14},{'name':_0x234f('0x54'),'value':_0x21e2e5[_0x234f('0x54')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5['attrs'][0x3]?_0x21e2e5[_0x234f('0x45')][0x3][_0x234f('0x46')]:undefined)||_0x234f('0x55')},{'name':'attrEmailAccounts','value':_0x21e2e5[_0x234f('0x56')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5['attrs'][0x4]?_0x21e2e5[_0x234f('0x45')][0x4][_0x234f('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x21e2e5[_0x234f('0x57')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x5]?_0x21e2e5[_0x234f('0x45')][0x5][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x58'),'value':_0x21e2e5[_0x234f('0x58')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x6]?_0x21e2e5[_0x234f('0x45')][0x6][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x59'),'value':_0x21e2e5[_0x234f('0x59')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x7]?_0x21e2e5[_0x234f('0x45')][0x7][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x5a'),'value':_0x21e2e5[_0x234f('0x5a')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x8]?_0x21e2e5[_0x234f('0x45')][0x8][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x5b'),'value':_0x21e2e5[_0x234f('0x5b')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x9]?_0x21e2e5[_0x234f('0x45')][0x9]['value']:undefined)||''}];case _0x234f('0x5c'):case'pie-chart':return[{'name':'attrSerie1','value':_0x21e2e5[_0x234f('0x5d')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5['attrs'][0x0][_0x234f('0x46')]:undefined)||_0x234f('0x52')},{'name':_0x234f('0x5e'),'value':_0x21e2e5[_0x234f('0x5e')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x1]?_0x21e2e5[_0x234f('0x45')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x21e2e5['attrSerie3']||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5['attrs'][0x2]?_0x21e2e5[_0x234f('0x45')][0x2]['value']:undefined)||null},{'name':_0x234f('0x53'),'value':_0x21e2e5[_0x234f('0x53')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5['attrs'][0x3]?_0x21e2e5['attrs'][0x3][_0x234f('0x46')]:undefined)||[]},{'name':_0x234f('0x54'),'value':_0x21e2e5[_0x234f('0x54')]||(_0x21e2e5['attrs']&&_0x21e2e5['attrs'][0x4]?_0x21e2e5[_0x234f('0x45')][0x4][_0x234f('0x46')]:undefined)||_0x234f('0x55')},{'name':_0x234f('0x56'),'value':_0x21e2e5[_0x234f('0x56')]||(_0x21e2e5['attrs']&&_0x21e2e5['attrs'][0x5]?_0x21e2e5[_0x234f('0x45')][0x5][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x57'),'value':_0x21e2e5[_0x234f('0x57')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x6]?_0x21e2e5[_0x234f('0x45')][0x6][_0x234f('0x46')]:undefined)||''},{'name':_0x234f('0x58'),'value':_0x21e2e5[_0x234f('0x58')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x7]?_0x21e2e5['attrs'][0x7][_0x234f('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x21e2e5[_0x234f('0x59')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x8]?_0x21e2e5[_0x234f('0x45')][0x8]['value']:undefined)||''},{'name':_0x234f('0x5a'),'value':_0x21e2e5[_0x234f('0x5a')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0x9]?_0x21e2e5[_0x234f('0x45')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x21e2e5[_0x234f('0x5b')]||(_0x21e2e5[_0x234f('0x45')]&&_0x21e2e5[_0x234f('0x45')][0xa]?_0x21e2e5[_0x234f('0x45')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x234f('0x5f'),'type':_0x21e2e5[_0x234f('0x60')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5[_0x234f('0x45')][0x0][_0x234f('0x61')]:undefined)||null,'value':_0x21e2e5[_0x234f('0x5f')]||(_0x21e2e5['attrs']&&_0x21e2e5[_0x234f('0x45')][0x0]?_0x21e2e5['attrs'][0x0][_0x234f('0x46')]:undefined)||null},{'name':'attrRefresh','value':_0x21e2e5['attrRefresh']||(_0x21e2e5['attrs']&&_0x21e2e5['attrs'][0x1]?_0x21e2e5[_0x234f('0x45')][0x1][_0x234f('0x46')]:undefined)||0x0}];default:return[];}}catch(_0xac24ff){logger[_0x234f('0x30')](_0x234f('0x62'),JSON[_0x234f('0x63')](_0xac24ff));return[];}}exports[_0x234f('0x64')]=function(_0x53f2b5,_0x31caa5){if(_0x53f2b5['body']){_0x53f2b5[_0x234f('0x65')][_0x234f('0x45')]=widgetAttributes(_0x53f2b5[_0x234f('0x65')]);}return db[_0x234f('0x37')][_0x234f('0x64')](_0x53f2b5[_0x234f('0x65')],{})['then'](respondWithResult(_0x31caa5,0xc9))[_0x234f('0x42')](handleError(_0x31caa5,null));};exports[_0x234f('0x2c')]=function(_0x2cfea7,_0x1f1016){if(_0x2cfea7['body']['id']){delete _0x2cfea7[_0x234f('0x65')]['id'];}_0x2cfea7['body'][_0x234f('0x45')]=widgetAttributes(_0x2cfea7[_0x234f('0x65')]);return db[_0x234f('0x37')][_0x234f('0x43')]({'where':{'id':_0x2cfea7[_0x234f('0x66')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x1f1016,null))['then'](saveUpdates(_0x2cfea7['body'],null))[_0x234f('0x2d')](respondWithResult(_0x1f1016,null))[_0x234f('0x42')](handleError(_0x1f1016,null));}; \ No newline at end of file +var _0x0024=['./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','find','iframe','attrUrl','value','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x2987b7,_0x2a79ea){var _0x3fd9d6=function(_0x3c5b54){while(--_0x3c5b54){_0x2987b7['push'](_0x2987b7['shift']());}};_0x3fd9d6(++_0x2a79ea);}(_0x0024,0xa8));var _0x4002=function(_0x88d3a,_0x5541d5){_0x88d3a=_0x88d3a-0x0;var _0x549872=_0x0024[_0x88d3a];return _0x549872;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4002('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4002('0x1'));var rp=require('request-promise');var moment=require(_0x4002('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4002('0x3'));var path=require(_0x4002('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4002('0x5'));var fs=require('fs');var fs_extra=require(_0x4002('0x6'));var _=require(_0x4002('0x7'));var squel=require(_0x4002('0x8'));var crypto=require('crypto');var jsforce=require(_0x4002('0x9'));var deskjs=require(_0x4002('0xa'));var toCsv=require(_0x4002('0xb'));var querystring=require(_0x4002('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4002('0xd'));var qs=require(_0x4002('0xe'));var as=require(_0x4002('0xf'));var hardwareService=require(_0x4002('0x10'));var logger=require(_0x4002('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4002('0x12'));var db=require(_0x4002('0x13'))['db'];config[_0x4002('0x14')]=_[_0x4002('0x15')](config['redis'],{'host':_0x4002('0x16'),'port':0x18eb});var socket=require(_0x4002('0x17'))(new Redis(config[_0x4002('0x14')]));require(_0x4002('0x18'))[_0x4002('0x19')](socket);function respondWithStatusCode(_0x50a1a8,_0x77b4c0){_0x77b4c0=_0x77b4c0||0xcc;return function(_0x4fe0b5){if(_0x4fe0b5){return _0x50a1a8[_0x4002('0x1a')](_0x77b4c0);}return _0x50a1a8[_0x4002('0x1b')](_0x77b4c0)[_0x4002('0x1c')]();};}function respondWithResult(_0x5813ff,_0x43a7e1){_0x43a7e1=_0x43a7e1||0xc8;return function(_0x5c4a33){if(_0x5c4a33){return _0x5813ff['status'](_0x43a7e1)[_0x4002('0x1d')](_0x5c4a33);}};}function respondWithFilteredResult(_0x3facc1,_0x4c0071){return function(_0x1b3401){if(_0x1b3401){var _0x4d5754=typeof _0x4c0071['offset']==='undefined'&&typeof _0x4c0071[_0x4002('0x1e')]===_0x4002('0x1f');var _0x283708=_0x1b3401[_0x4002('0x20')];var _0x514dfe=_0x4d5754?0x0:_0x4c0071[_0x4002('0x21')];var _0x1a5364=_0x4d5754?_0x1b3401[_0x4002('0x20')]:_0x4c0071['offset']+_0x4c0071[_0x4002('0x1e')];var _0x51b709;if(_0x1a5364>=_0x283708){_0x1a5364=_0x283708;_0x51b709=0xc8;}else{_0x51b709=0xce;}_0x3facc1[_0x4002('0x1b')](_0x51b709);return _0x3facc1[_0x4002('0x22')](_0x4002('0x23'),_0x514dfe+'-'+_0x1a5364+'/'+_0x283708)['json'](_0x1b3401);}return null;};}function patchUpdates(_0x52add8){return function(_0x447851){try{jsonpatch[_0x4002('0x24')](_0x447851,_0x52add8,!![]);}catch(_0x254b67){return BPromise['reject'](_0x254b67);}return _0x447851[_0x4002('0x25')]();};}function saveUpdates(_0x27732c,_0x18b000){return function(_0x23e917){if(_0x23e917){return _0x23e917[_0x4002('0x26')](_0x27732c)['then'](function(_0x3396d8){return _0x3396d8;});}return null;};}function removeEntity(_0x1dfb81,_0x385c35){return function(_0x425b3f){if(_0x425b3f){return _0x425b3f[_0x4002('0x27')]()[_0x4002('0x28')](function(){_0x1dfb81['status'](0xcc)[_0x4002('0x1c')]();});}};}function handleEntityNotFound(_0x2d148e,_0x49e273){return function(_0xf5ae88){if(!_0xf5ae88){_0x2d148e[_0x4002('0x1a')](0x194);}return _0xf5ae88;};}function handleError(_0x569154,_0xa7b46a){_0xa7b46a=_0xa7b46a||0x1f4;return function(_0x278907){logger[_0x4002('0x29')](_0x278907[_0x4002('0x2a')]);if(_0x278907[_0x4002('0x2b')]){delete _0x278907[_0x4002('0x2b')];}_0x569154[_0x4002('0x1b')](_0xa7b46a)['send'](_0x278907);};}exports[_0x4002('0x2c')]=function(_0x162173,_0x237704){var _0x598048={'raw':![],'where':{'id':_0x162173[_0x4002('0x2d')]['id']}},_0x52f488={};_0x52f488[_0x4002('0x2e')]=_[_0x4002('0x2f')](db[_0x4002('0x30')][_0x4002('0x31')]);_0x52f488[_0x4002('0x32')]=_[_0x4002('0x2f')](_0x162173[_0x4002('0x32')]);_0x52f488[_0x4002('0x33')]=_[_0x4002('0x34')](_0x52f488['model'],_0x52f488[_0x4002('0x32')]);_0x598048[_0x4002('0x35')]=_[_0x4002('0x34')](_0x52f488['model'],qs[_0x4002('0x36')](_0x162173[_0x4002('0x32')][_0x4002('0x36')]));_0x598048['attributes']=_0x598048[_0x4002('0x35')][_0x4002('0x37')]?_0x598048[_0x4002('0x35')]:_0x52f488[_0x4002('0x2e')];if(_0x162173[_0x4002('0x32')][_0x4002('0x38')]){_0x598048[_0x4002('0x39')]=[{'all':!![]}];}_0x598048=_['merge']({},_0x598048,_0x162173[_0x4002('0x3a')]);return db[_0x4002('0x30')]['find'](_0x598048)['then'](handleEntityNotFound(_0x237704,null))[_0x4002('0x28')](respondWithResult(_0x237704,null))[_0x4002('0x3b')](handleError(_0x237704,null));};exports[_0x4002('0x27')]=function(_0x5e412,_0x94ecc3){return db[_0x4002('0x30')][_0x4002('0x3c')]({'where':{'id':_0x5e412[_0x4002('0x2d')]['id']}})['then'](handleEntityNotFound(_0x94ecc3,null))[_0x4002('0x28')](removeEntity(_0x94ecc3,null))[_0x4002('0x3b')](handleError(_0x94ecc3,null));};function widgetAttributes(_0x3c1330){try{switch(_0x3c1330['type']){case _0x4002('0x3d'):return[{'name':'attrUrl','value':_0x3c1330[_0x4002('0x3e')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x3c1330[_0x4002('0x40')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||''}];case _0x4002('0x42'):return[{'name':_0x4002('0x43'),'value':_0x3c1330[_0x4002('0x43')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x44')},{'name':_0x4002('0x45'),'value':_0x3c1330[_0x4002('0x45')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x1]?_0x3c1330[_0x4002('0x41')][0x1]['value']:undefined)||_0x4002('0x46')},{'name':_0x4002('0x47'),'value':_0x3c1330['attrFontSize']||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330[_0x4002('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4002('0x48'),'value':_0x3c1330[_0x4002('0x48')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330[_0x4002('0x41')][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x49')},{'name':_0x4002('0x4a'),'value':_0x3c1330[_0x4002('0x4a')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x1]?_0x3c1330['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3c1330[_0x4002('0x47')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330['attrs'][0x2][_0x4002('0x3f')]:undefined)||0x14},{'name':_0x4002('0x4b'),'value':_0x3c1330[_0x4002('0x4b')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x3]?_0x3c1330['attrs'][0x3]['value']:undefined)||_0x4002('0x4c')},{'name':_0x4002('0x4d'),'value':_0x3c1330[_0x4002('0x4d')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x4]?_0x3c1330['attrs'][0x4][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4e'),'value':_0x3c1330[_0x4002('0x4e')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x5]?_0x3c1330['attrs'][0x5][_0x4002('0x3f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c1330['attrSmsAccounts']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x6]?_0x3c1330['attrs'][0x6][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4f'),'value':_0x3c1330[_0x4002('0x4f')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x7]?_0x3c1330['attrs'][0x7][_0x4002('0x3f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c1330['attrWhatsappAccounts']||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x8]?_0x3c1330[_0x4002('0x41')][0x8]['value']:undefined)||''},{'name':_0x4002('0x50'),'value':_0x3c1330[_0x4002('0x50')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x9]?_0x3c1330[_0x4002('0x41')][0x9][_0x4002('0x3f')]:undefined)||''}];case'multibar-chart':case _0x4002('0x51'):return[{'name':_0x4002('0x52'),'value':_0x3c1330['attrSerie1']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x49')},{'name':_0x4002('0x53'),'value':_0x3c1330[_0x4002('0x53')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x1]?_0x3c1330[_0x4002('0x41')][0x1][_0x4002('0x3f')]:undefined)||null},{'name':_0x4002('0x54'),'value':_0x3c1330[_0x4002('0x54')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330[_0x4002('0x41')][0x2][_0x4002('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3c1330[_0x4002('0x4a')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x3]?_0x3c1330[_0x4002('0x41')][0x3]['value']:undefined)||[]},{'name':_0x4002('0x4b'),'value':_0x3c1330[_0x4002('0x4b')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x4]?_0x3c1330[_0x4002('0x41')][0x4][_0x4002('0x3f')]:undefined)||_0x4002('0x4c')},{'name':_0x4002('0x4d'),'value':_0x3c1330[_0x4002('0x4d')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x5]?_0x3c1330[_0x4002('0x41')][0x5][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4e'),'value':_0x3c1330[_0x4002('0x4e')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x6]?_0x3c1330[_0x4002('0x41')][0x6][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x55'),'value':_0x3c1330[_0x4002('0x55')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x7]?_0x3c1330[_0x4002('0x41')][0x7][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4f'),'value':_0x3c1330[_0x4002('0x4f')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x8]?_0x3c1330[_0x4002('0x41')][0x8][_0x4002('0x3f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c1330[_0x4002('0x56')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x9]?_0x3c1330[_0x4002('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3c1330[_0x4002('0x50')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0xa]?_0x3c1330['attrs'][0xa]['value']:undefined)||''}];case _0x4002('0x57'):return[{'name':_0x4002('0x58'),'type':_0x3c1330[_0x4002('0x59')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x0]?_0x3c1330[_0x4002('0x41')][0x0][_0x4002('0x5a')]:undefined)||null,'value':_0x3c1330['attrReport']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330[_0x4002('0x41')][0x0]['value']:undefined)||null},{'name':_0x4002('0x5b'),'value':_0x3c1330[_0x4002('0x5b')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x1]?_0x3c1330[_0x4002('0x41')][0x1][_0x4002('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x51a951){logger[_0x4002('0x29')](_0x4002('0x5c'),JSON[_0x4002('0x5d')](_0x51a951));return[];}}exports[_0x4002('0x5e')]=function(_0x5d1c12,_0x57922d){if(_0x5d1c12[_0x4002('0x5f')]){_0x5d1c12['body'][_0x4002('0x41')]=widgetAttributes(_0x5d1c12[_0x4002('0x5f')]);}return db[_0x4002('0x30')][_0x4002('0x5e')](_0x5d1c12['body'],{})[_0x4002('0x28')](respondWithResult(_0x57922d,0xc9))['catch'](handleError(_0x57922d,null));};exports[_0x4002('0x26')]=function(_0x4f596d,_0x2c0af7){if(_0x4f596d['body']['id']){delete _0x4f596d[_0x4002('0x5f')]['id'];}_0x4f596d['body'][_0x4002('0x41')]=widgetAttributes(_0x4f596d[_0x4002('0x5f')]);return db[_0x4002('0x30')][_0x4002('0x3c')]({'where':{'id':_0x4f596d[_0x4002('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2c0af7,null))[_0x4002('0x28')](saveUpdates(_0x4f596d['body'],null))[_0x4002('0x28')](respondWithResult(_0x2c0af7,null))[_0x4002('0x3b')](handleError(_0x2c0af7,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0fd7ef6..12fd395 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 _0x7949=['events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x40dc85,_0x294be4){var _0x33eb9c=function(_0x4302a6){while(--_0x4302a6){_0x40dc85['push'](_0x40dc85['shift']());}};_0x33eb9c(++_0x294be4);}(_0x7949,0xfc));var _0x9794=function(_0x919a2c,_0x475496){_0x919a2c=_0x919a2c-0x0;var _0x1604b2=_0x7949[_0x919a2c];return _0x1604b2;};'use strict';var EventEmitter=require(_0x9794('0x0'));var DashboardItem=require(_0x9794('0x1'))['db'][_0x9794('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9794('0x3')](0x0);var events={'afterCreate':_0x9794('0x4'),'afterUpdate':'update','afterDestroy':_0x9794('0x5')};function emitEvent(_0x57d739){return function(_0x489a02,_0x2bdda7,_0x1c618d){DashboardItemEvents[_0x9794('0x6')](_0x57d739+':'+_0x489a02['id'],_0x489a02);DashboardItemEvents[_0x9794('0x6')](_0x57d739,_0x489a02);_0x1c618d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x9794('0x7')](e,emitEvent(event));}}module[_0x9794('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xd114=['events','../../mysqldb','DashboardItem','update','remove','emit','exports'];(function(_0x49aabc,_0x3385c6){var _0x574343=function(_0x4c4429){while(--_0x4c4429){_0x49aabc['push'](_0x49aabc['shift']());}};_0x574343(++_0x3385c6);}(_0xd114,0x157));var _0x4d11=function(_0x20cefc,_0x557f67){_0x20cefc=_0x20cefc-0x0;var _0x4a9cd8=_0xd114[_0x20cefc];return _0x4a9cd8;};'use strict';var EventEmitter=require(_0x4d11('0x0'));var DashboardItem=require(_0x4d11('0x1'))['db'][_0x4d11('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d11('0x3'),'afterDestroy':_0x4d11('0x4')};function emitEvent(_0x68e8b8){return function(_0x1c0c6f,_0x1d5b41,_0x388e41){DashboardItemEvents[_0x4d11('0x5')](_0x68e8b8+':'+_0x1c0c6f['id'],_0x1c0c6f);DashboardItemEvents[_0x4d11('0x5')](_0x68e8b8,_0x1c0c6f);_0x388e41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x4d11('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1f629b5..6c0dc51 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 _0x6460=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items'];(function(_0x364852,_0x17691e){var _0x2ec071=function(_0x5608a1){while(--_0x5608a1){_0x364852['push'](_0x364852['shift']());}};_0x2ec071(++_0x17691e);}(_0x6460,0xb4));var _0x0646=function(_0x15cef4,_0x448b97){_0x15cef4=_0x15cef4-0x0;var _0x384430=_0x6460[_0x15cef4];return _0x384430;};'use strict';var _=require(_0x0646('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0646('0x1'));var BPromise=require(_0x0646('0x2'));var rp=require(_0x0646('0x3'));var fs=require('fs');var path=require(_0x0646('0x4'));var rimraf=require(_0x0646('0x5'));var config=require(_0x0646('0x6'));var attributes=require(_0x0646('0x7'));module[_0x0646('0x8')]=function(_0x577663,_0x4a0b87){return _0x577663['define']('DashboardItem',attributes,{'tableName':_0x0646('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed7f=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','api','moment','bluebird','request-promise'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xed7f,0xd8));var _0xfed7=function(_0x1591b0,_0x31909f){_0x1591b0=_0x1591b0-0x0;var _0x29c8de=_0xed7f[_0x1591b0];return _0x29c8de;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfed7('0x0'));var moment=require(_0xfed7('0x1'));var BPromise=require(_0xfed7('0x2'));var rp=require(_0xfed7('0x3'));var fs=require('fs');var path=require(_0xfed7('0x4'));var rimraf=require(_0xfed7('0x5'));var config=require(_0xfed7('0x6'));var attributes=require(_0xfed7('0x7'));module[_0xfed7('0x8')]=function(_0x5abbf6,_0x585551){return _0x5abbf6[_0xfed7('0x9')](_0xfed7('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index bd943a8..fee7830 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 _0x6ee9=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3a4639,_0x42370a){var _0x17f851=function(_0x210a54){while(--_0x210a54){_0x3a4639['push'](_0x3a4639['shift']());}};_0x17f851(++_0x42370a);}(_0x6ee9,0x199));var _0x96ee=function(_0x3f7c98,_0x5f3fb7){_0x3f7c98=_0x3f7c98-0x0;var _0x2bc60e=_0x6ee9[_0x3f7c98];return _0x2bc60e;};'use strict';var _=require(_0x96ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x96ee('0x1'));var rs=require(_0x96ee('0x2'));var fs=require('fs');var Redis=require(_0x96ee('0x3'));var db=require(_0x96ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x96ee('0x5'))(_0x96ee('0x6'));var config=require(_0x96ee('0x7'));var jayson=require(_0x96ee('0x8'));var client=jayson[_0x96ee('0x9')]['http']({'port':0x232a});config[_0x96ee('0xa')]=_[_0x96ee('0xb')](config[_0x96ee('0xa')],{'host':_0x96ee('0xc'),'port':0x18eb});var socket=require(_0x96ee('0xd'))(new Redis(config[_0x96ee('0xa')]));require('./dashboardItem.socket')[_0x96ee('0xe')](socket);function respondWithRpcPromise(_0x336283,_0x279d63,_0x5354f5){return new BPromise(function(_0x2a451f,_0x4eac3a){return client[_0x96ee('0xf')](_0x336283,_0x5354f5)[_0x96ee('0x10')](function(_0x3b3ab9){logger[_0x96ee('0x11')](_0x96ee('0x12'),_0x279d63,_0x96ee('0x13'));logger[_0x96ee('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x279d63,_0x96ee('0x13'),JSON[_0x96ee('0x15')](_0x3b3ab9));if(_0x3b3ab9[_0x96ee('0x16')]){if(_0x3b3ab9[_0x96ee('0x16')][_0x96ee('0x17')]===0x1f4){logger[_0x96ee('0x16')](_0x96ee('0x12'),_0x279d63,_0x3b3ab9[_0x96ee('0x16')][_0x96ee('0x18')]);return _0x4eac3a(_0x3b3ab9[_0x96ee('0x16')][_0x96ee('0x18')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x279d63,_0x3b3ab9[_0x96ee('0x16')][_0x96ee('0x18')]);return _0x2a451f(_0x3b3ab9['error'][_0x96ee('0x18')]);}else{logger[_0x96ee('0x11')]('DashboardItem,\x20%s,\x20%s',_0x279d63,_0x96ee('0x13'));_0x2a451f(_0x3b3ab9['result']['message']);}})[_0x96ee('0x19')](function(_0x2388ee){logger['error'](_0x96ee('0x12'),_0x279d63,_0x2388ee);_0x4eac3a(_0x2388ee);});});} \ No newline at end of file +var _0x995c=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3297b8,_0x17ce35){var _0x2066de=function(_0x4750c3){while(--_0x4750c3){_0x3297b8['push'](_0x3297b8['shift']());}};_0x2066de(++_0x17ce35);}(_0x995c,0x142));var _0xc995=function(_0x5d0980,_0x26474b){_0x5d0980=_0x5d0980-0x0;var _0x3d6318=_0x995c[_0x5d0980];return _0x3d6318;};'use strict';var _=require(_0xc995('0x0'));var util=require(_0xc995('0x1'));var moment=require('moment');var BPromise=require(_0xc995('0x2'));var rs=require(_0xc995('0x3'));var fs=require('fs');var Redis=require(_0xc995('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc995('0x5'))(_0xc995('0x6'));var config=require(_0xc995('0x7'));var jayson=require(_0xc995('0x8'));var client=jayson[_0xc995('0x9')][_0xc995('0xa')]({'port':0x232a});config[_0xc995('0xb')]=_[_0xc995('0xc')](config[_0xc995('0xb')],{'host':_0xc995('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc995('0xb')]));require(_0xc995('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ce1d5,_0x247f63,_0x3a901a){return new BPromise(function(_0xc8b03a,_0x4567f7){return client[_0xc995('0xf')](_0x4ce1d5,_0x3a901a)[_0xc995('0x10')](function(_0x50ed4d){logger['info'](_0xc995('0x11'),_0x247f63,_0xc995('0x12'));logger[_0xc995('0x13')](_0xc995('0x14'),_0x247f63,_0xc995('0x12'),JSON[_0xc995('0x15')](_0x50ed4d));if(_0x50ed4d[_0xc995('0x16')]){if(_0x50ed4d[_0xc995('0x16')][_0xc995('0x17')]===0x1f4){logger[_0xc995('0x16')](_0xc995('0x11'),_0x247f63,_0x50ed4d[_0xc995('0x16')][_0xc995('0x18')]);return _0x4567f7(_0x50ed4d[_0xc995('0x16')][_0xc995('0x18')]);}logger[_0xc995('0x16')](_0xc995('0x11'),_0x247f63,_0x50ed4d[_0xc995('0x16')][_0xc995('0x18')]);return _0xc8b03a(_0x50ed4d[_0xc995('0x16')]['message']);}else{logger['info'](_0xc995('0x11'),_0x247f63,_0xc995('0x12'));_0xc8b03a(_0x50ed4d[_0xc995('0x19')][_0xc995('0x18')]);}})[_0xc995('0x1a')](function(_0x2ca40b){logger[_0xc995('0x16')](_0xc995('0x11'),_0x247f63,_0x2ca40b);_0x4567f7(_0x2ca40b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index eb6752e..87f5d43 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 _0xdf22=['length','./dashboardItem.events','update','emit','removeListener','register'];(function(_0x18322f,_0x41ac92){var _0x22ad42=function(_0x181aa5){while(--_0x181aa5){_0x18322f['push'](_0x18322f['shift']());}};_0x22ad42(++_0x41ac92);}(_0xdf22,0x139));var _0x2df2=function(_0x5d3a51,_0x1af182){_0x5d3a51=_0x5d3a51-0x0;var _0x63cb46=_0xdf22[_0x5d3a51];return _0x63cb46;};'use strict';var DashboardItemEvents=require(_0x2df2('0x0'));var events=['save','remove',_0x2df2('0x1')];function createListener(_0x44c93a,_0x1cbf7c){return function(_0x2ce6ff){_0x1cbf7c[_0x2df2('0x2')](_0x44c93a,_0x2ce6ff);};}function removeListener(_0x4720c9,_0x4fbe8d){return function(){DashboardItemEvents[_0x2df2('0x3')](_0x4720c9,_0x4fbe8d);};}exports[_0x2df2('0x4')]=function(_0x2fde49){for(var _0x6b8e78=0x0,_0x173b50=events[_0x2df2('0x5')];_0x6b8e78<_0x173b50;_0x6b8e78++){var _0x4707c3=events[_0x6b8e78];var _0x22548c=createListener('dashboardItem:'+_0x4707c3,_0x2fde49);DashboardItemEvents['on'](_0x4707c3,_0x22548c);}}; \ No newline at end of file +var _0x9f17=['save','update','removeListener','length','./dashboardItem.events'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0x9f17,0x1c1));var _0x79f1=function(_0x166b8f,_0x414e08){_0x166b8f=_0x166b8f-0x0;var _0x32a08d=_0x9f17[_0x166b8f];return _0x32a08d;};'use strict';var DashboardItemEvents=require(_0x79f1('0x0'));var events=[_0x79f1('0x1'),'remove',_0x79f1('0x2')];function createListener(_0x1e869a,_0x48ac39){return function(_0x20829a){_0x48ac39['emit'](_0x1e869a,_0x20829a);};}function removeListener(_0x35883b,_0x3c80e4){return function(){DashboardItemEvents[_0x79f1('0x3')](_0x35883b,_0x3c80e4);};}exports['register']=function(_0x25e315){for(var _0x15e291=0x0,_0x1352fc=events[_0x79f1('0x4')];_0x15e291<_0x1352fc;_0x15e291++){var _0x3e94bc=events[_0x15e291];var _0x235c89=createListener('dashboardItem:'+_0x3e94bc,_0x25e315);DashboardItemEvents['on'](_0x3e94bc,_0x235c89);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ac643ca..8ade27c 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 _0x5600=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c24be,_0x216414){var _0x8c4a3d=function(_0x2288f0){while(--_0x2288f0){_0x4c24be['push'](_0x4c24be['shift']());}};_0x8c4a3d(++_0x216414);}(_0x5600,0x64));var _0x0560=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x5600[_0x3f4dd9];return _0x31c54a;};'use strict';var multer=require(_0x0560('0x0'));var util=require('util');var path=require(_0x0560('0x1'));var timeout=require(_0x0560('0x2'));var express=require(_0x0560('0x3'));var router=express[_0x0560('0x4')]();var fs_extra=require(_0x0560('0x5'));var auth=require(_0x0560('0x6'));var interaction=require(_0x0560('0x7'));var config=require('../../config/environment');var controller=require(_0x0560('0x8'));router[_0x0560('0x9')](_0x0560('0xa'),auth[_0x0560('0xb')](),controller[_0x0560('0xc')]);router[_0x0560('0xd')]('/',auth[_0x0560('0xb')](),controller[_0x0560('0xe')]);router[_0x0560('0xf')](_0x0560('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x0560('0x10')](_0x0560('0xa'),auth[_0x0560('0xb')](),controller[_0x0560('0x11')]);module['exports']=router; \ No newline at end of file +var _0xecf3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','create','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x2317bb,_0x3aa554){var _0x57e984=function(_0x5c8e8e){while(--_0x5c8e8e){_0x2317bb['push'](_0x2317bb['shift']());}};_0x57e984(++_0x3aa554);}(_0xecf3,0x18b));var _0x3ecf=function(_0x3ab07e,_0x1f4e83){_0x3ab07e=_0x3ab07e-0x0;var _0x3ca832=_0xecf3[_0x3ab07e];return _0x3ca832;};'use strict';var multer=require(_0x3ecf('0x0'));var util=require(_0x3ecf('0x1'));var path=require(_0x3ecf('0x2'));var timeout=require(_0x3ecf('0x3'));var express=require(_0x3ecf('0x4'));var router=express[_0x3ecf('0x5')]();var fs_extra=require(_0x3ecf('0x6'));var auth=require(_0x3ecf('0x7'));var interaction=require(_0x3ecf('0x8'));var config=require('../../config/environment');var controller=require(_0x3ecf('0x9'));router[_0x3ecf('0xa')](_0x3ecf('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3ecf('0xc')]);router['put'](_0x3ecf('0xb'),auth[_0x3ecf('0xd')](),controller[_0x3ecf('0xe')]);router[_0x3ecf('0xf')]('/:id',auth[_0x3ecf('0xd')](),controller[_0x3ecf('0x10')]);module[_0x3ecf('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 92f292e..331e16d 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 _0xa119=['third','first','STRING','exports','ENUM','second'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa119,0xe7));var _0x9a11=function(_0x32dbd0,_0x17f660){_0x32dbd0=_0x32dbd0-0x0;var _0x38dd01=_0xa119[_0x32dbd0];return _0x38dd01;};'use strict';var Sequelize=require('sequelize');module[_0x9a11('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x9a11('0x1')]('first',_0x9a11('0x2'),_0x9a11('0x3')),'allowNull':![],'defaultValue':_0x9a11('0x4')},'description':{'type':Sequelize[_0x9a11('0x5')]}}; \ No newline at end of file +var _0xf7fc=['first','third','STRING','sequelize','exports'];(function(_0x53c506,_0x1c0fe8){var _0x165888=function(_0x46f0b6){while(--_0x46f0b6){_0x53c506['push'](_0x53c506['shift']());}};_0x165888(++_0x1c0fe8);}(_0xf7fc,0x1b6));var _0xcf7f=function(_0x5aac87,_0x5f497e){_0x5aac87=_0x5aac87-0x0;var _0x232a5b=_0xf7fc[_0x5aac87];return _0x232a5b;};'use strict';var Sequelize=require(_0xcf7f('0x0'));module[_0xcf7f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xcf7f('0x2'),'second',_0xcf7f('0x3')),'allowNull':![],'defaultValue':_0xcf7f('0x2')},'description':{'type':Sequelize[_0xcf7f('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7f3da0c..b14e724 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 _0x063a=['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','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','Disposition','include','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x1f66b4,_0x5f251c){var _0x50999e=function(_0x40e4f2){while(--_0x40e4f2){_0x1f66b4['push'](_0x1f66b4['shift']());}};_0x50999e(++_0x5f251c);}(_0x063a,0x1e0));var _0xa063=function(_0x1a32e2,_0x1c7d02){_0x1a32e2=_0x1a32e2-0x0;var _0x5af212=_0x063a[_0x1a32e2];return _0x5af212;};'use strict';var emlformat=require(_0xa063('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa063('0x1'));var rp=require('request-promise');var moment=require(_0xa063('0x2'));var BPromise=require(_0xa063('0x3'));var Mustache=require(_0xa063('0x4'));var util=require(_0xa063('0x5'));var path=require(_0xa063('0x6'));var sox=require('sox');var csv=require(_0xa063('0x7'));var ejs=require(_0xa063('0x8'));var fs=require('fs');var fs_extra=require(_0xa063('0x9'));var _=require('lodash');var squel=require(_0xa063('0xa'));var crypto=require(_0xa063('0xb'));var jsforce=require(_0xa063('0xc'));var deskjs=require(_0xa063('0xd'));var toCsv=require(_0xa063('0x7'));var querystring=require(_0xa063('0xe'));var Papa=require(_0xa063('0xf'));var Redis=require(_0xa063('0x10'));var authService=require(_0xa063('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa063('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa063('0x13'))(_0xa063('0x14'));var utils=require(_0xa063('0x15'));var config=require(_0xa063('0x16'));var licenseUtil=require(_0xa063('0x17'));var db=require(_0xa063('0x18'))['db'];function respondWithStatusCode(_0x45241f,_0x5d2d0d){_0x5d2d0d=_0x5d2d0d||0xcc;return function(_0x462dbd){if(_0x462dbd){return _0x45241f[_0xa063('0x19')](_0x5d2d0d);}return _0x45241f[_0xa063('0x1a')](_0x5d2d0d)['end']();};}function respondWithResult(_0x40521a,_0x1c58f1){_0x1c58f1=_0x1c58f1||0xc8;return function(_0x4a5edd){if(_0x4a5edd){return _0x40521a[_0xa063('0x1a')](_0x1c58f1)[_0xa063('0x1b')](_0x4a5edd);}};}function respondWithFilteredResult(_0x539852,_0x2d7819){return function(_0x48396e){if(_0x48396e){var _0x3b3f37=typeof _0x2d7819[_0xa063('0x1c')]===_0xa063('0x1d')&&typeof _0x2d7819[_0xa063('0x1e')]===_0xa063('0x1d');var _0x2fc768=_0x48396e[_0xa063('0x1f')];var _0x4aabc8=_0x3b3f37?0x0:_0x2d7819[_0xa063('0x1c')];var _0xc5b2ed=_0x3b3f37?_0x48396e[_0xa063('0x1f')]:_0x2d7819['offset']+_0x2d7819['limit'];var _0x59725f;if(_0xc5b2ed>=_0x2fc768){_0xc5b2ed=_0x2fc768;_0x59725f=0xc8;}else{_0x59725f=0xce;}_0x539852[_0xa063('0x1a')](_0x59725f);return _0x539852[_0xa063('0x20')](_0xa063('0x21'),_0x4aabc8+'-'+_0xc5b2ed+'/'+_0x2fc768)[_0xa063('0x1b')](_0x48396e);}return null;};}function patchUpdates(_0x4aba7d){return function(_0x53fe54){try{jsonpatch['apply'](_0x53fe54,_0x4aba7d,!![]);}catch(_0x4300d5){return BPromise[_0xa063('0x22')](_0x4300d5);}return _0x53fe54[_0xa063('0x23')]();};}function saveUpdates(_0x16d2dd,_0x4484bd){return function(_0x1106b4){if(_0x1106b4){return _0x1106b4[_0xa063('0x24')](_0x16d2dd)[_0xa063('0x25')](function(_0x426dc7){return _0x426dc7;});}return null;};}function removeEntity(_0x1f156a,_0x532d15){return function(_0x191051){if(_0x191051){return _0x191051[_0xa063('0x26')]()[_0xa063('0x25')](function(){var _0x22759d=_0x191051[_0xa063('0x27')]({'plain':!![]});var _0x904498='Dispositions';return db[_0xa063('0x28')][_0xa063('0x26')]({'where':{'type':_0x904498,'resourceId':_0x22759d['id']}})[_0xa063('0x25')](function(){return _0x191051;});})['then'](function(){_0x1f156a[_0xa063('0x1a')](0xcc)[_0xa063('0x29')]();});}};}function handleEntityNotFound(_0xcff237,_0x418fa1){return function(_0x1e0c24){if(!_0x1e0c24){_0xcff237['sendStatus'](0x194);}return _0x1e0c24;};}function handleError(_0x348eed,_0x2d60b4){_0x2d60b4=_0x2d60b4||0x1f4;return function(_0x385aba){logger[_0xa063('0x2a')](_0x385aba[_0xa063('0x2b')]);if(_0x385aba['name']){delete _0x385aba[_0xa063('0x2c')];}_0x348eed[_0xa063('0x1a')](_0x2d60b4)[_0xa063('0x2d')](_0x385aba);};}exports[_0xa063('0x2e')]=function(_0x3b1fb0,_0x2565d1){var _0x2f6663={},_0x3de7be={},_0x1f7b29={'count':0x0,'rows':[]};var _0x3e5e11=_[_0xa063('0x2f')](db['Disposition'][_0xa063('0x30')],function(_0x3b0ea1){return{'name':_0x3b0ea1[_0xa063('0x31')],'type':_0x3b0ea1[_0xa063('0x32')][_0xa063('0x33')]};});_0x3de7be[_0xa063('0x34')]=_[_0xa063('0x2f')](_0x3e5e11,_0xa063('0x2c'));_0x3de7be[_0xa063('0x35')]=_[_0xa063('0x36')](_0x3b1fb0['query']);_0x3de7be[_0xa063('0x37')]=_[_0xa063('0x38')](_0x3de7be['model'],_0x3de7be[_0xa063('0x35')]);_0x2f6663[_0xa063('0x39')]=_['intersection'](_0x3de7be[_0xa063('0x34')],qs[_0xa063('0x3a')](_0x3b1fb0[_0xa063('0x35')][_0xa063('0x3a')]));_0x2f6663[_0xa063('0x39')]=_0x2f6663['attributes'][_0xa063('0x3b')]?_0x2f6663[_0xa063('0x39')]:_0x3de7be[_0xa063('0x34')];if(!_0x3b1fb0[_0xa063('0x35')]['hasOwnProperty']('nolimit')){_0x2f6663[_0xa063('0x1e')]=qs[_0xa063('0x1e')](_0x3b1fb0[_0xa063('0x35')]['limit']);_0x2f6663['offset']=qs[_0xa063('0x1c')](_0x3b1fb0[_0xa063('0x35')]['offset']);}_0x2f6663[_0xa063('0x3c')]=qs[_0xa063('0x3d')](_0x3b1fb0[_0xa063('0x35')][_0xa063('0x3d')]);_0x2f6663[_0xa063('0x3e')]=qs[_0xa063('0x37')](_[_0xa063('0x3f')](_0x3b1fb0['query'],_0x3de7be[_0xa063('0x37')]),_0x3e5e11);if(_0x3b1fb0[_0xa063('0x35')][_0xa063('0x40')]){_0x2f6663[_0xa063('0x3e')]=_[_0xa063('0x41')](_0x2f6663[_0xa063('0x3e')],{'$or':_[_0xa063('0x2f')](_0x3e5e11,function(_0x1123b0){if(_0x1123b0['type']!=='VIRTUAL'){var _0x2a52b8={};_0x2a52b8[_0x1123b0[_0xa063('0x2c')]]={'$like':'%'+_0x3b1fb0[_0xa063('0x35')][_0xa063('0x40')]+'%'};return _0x2a52b8;}})});}_0x2f6663=_[_0xa063('0x41')]({},_0x2f6663,_0x3b1fb0[_0xa063('0x42')]);var _0xaadf8c={'where':_0x2f6663['where']};return db[_0xa063('0x43')]['count'](_0xaadf8c)['then'](function(_0x494dc7){_0x1f7b29[_0xa063('0x1f')]=_0x494dc7;if(_0x3b1fb0[_0xa063('0x35')]['includeAll']){_0x2f6663[_0xa063('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2f6663);})[_0xa063('0x25')](function(_0x5dc93e){_0x1f7b29[_0xa063('0x45')]=_0x5dc93e;return _0x1f7b29;})[_0xa063('0x25')](respondWithFilteredResult(_0x2565d1,_0x2f6663))[_0xa063('0x46')](handleError(_0x2565d1,null));};exports['show']=function(_0x193203,_0x509817){var _0xe6327e={'raw':!![],'where':{'id':_0x193203[_0xa063('0x47')]['id']}},_0x4dc4b1={};_0x4dc4b1[_0xa063('0x34')]=_['keys'](db[_0xa063('0x43')][_0xa063('0x30')]);_0x4dc4b1[_0xa063('0x35')]=_[_0xa063('0x36')](_0x193203[_0xa063('0x35')]);_0x4dc4b1[_0xa063('0x37')]=_[_0xa063('0x38')](_0x4dc4b1[_0xa063('0x34')],_0x4dc4b1[_0xa063('0x35')]);_0xe6327e[_0xa063('0x39')]=_[_0xa063('0x38')](_0x4dc4b1[_0xa063('0x34')],qs[_0xa063('0x3a')](_0x193203[_0xa063('0x35')]['fields']));_0xe6327e['attributes']=_0xe6327e[_0xa063('0x39')][_0xa063('0x3b')]?_0xe6327e[_0xa063('0x39')]:_0x4dc4b1['model'];if(_0x193203[_0xa063('0x35')][_0xa063('0x48')]){_0xe6327e['include']=[{'all':!![]}];}_0xe6327e=_[_0xa063('0x41')]({},_0xe6327e,_0x193203[_0xa063('0x42')]);return db[_0xa063('0x43')]['find'](_0xe6327e)[_0xa063('0x25')](handleEntityNotFound(_0x509817,null))[_0xa063('0x25')](respondWithResult(_0x509817,null))['catch'](handleError(_0x509817,null));};exports['create']=function(_0x2bec5d,_0x54e087){return db[_0xa063('0x43')][_0xa063('0x49')](_0x2bec5d[_0xa063('0x4a')],{})['then'](function(_0x44eee0){var _0x46e77d=_0x2bec5d[_0xa063('0x4b')][_0xa063('0x27')]({'plain':!![]});if(!_0x46e77d)throw new Error(_0xa063('0x4c'));if(_0x46e77d['role']===_0xa063('0x4b')){var _0x5649c0=_0x44eee0[_0xa063('0x27')]({'plain':!![]});var _0x2a16f6=_0xa063('0x4d');return db[_0xa063('0x4e')]['find']({'where':{'name':_0x2a16f6,'userProfileId':_0x46e77d['userProfileId']},'raw':!![]})['then'](function(_0x5928ca){if(_0x5928ca&&_0x5928ca[_0xa063('0x4f')]===0x0){return db[_0xa063('0x28')][_0xa063('0x49')]({'name':_0x5649c0[_0xa063('0x2c')],'resourceId':_0x5649c0['id'],'type':_0x5928ca[_0xa063('0x2c')],'sectionId':_0x5928ca['id']},{})['then'](function(){return _0x44eee0;});}else{return _0x44eee0;}})['catch'](function(_0x56e415){logger[_0xa063('0x2a')](_0xa063('0x50'),_0x56e415);throw _0x56e415;});}return _0x44eee0;})[_0xa063('0x25')](respondWithResult(_0x54e087,0xc9))[_0xa063('0x46')](handleError(_0x54e087,null));};exports[_0xa063('0x24')]=function(_0x18bbb5,_0x1419d4){if(_0x18bbb5[_0xa063('0x4a')]['id']){delete _0x18bbb5['body']['id'];}return db[_0xa063('0x43')][_0xa063('0x51')]({'where':{'id':_0x18bbb5['params']['id']}})['then'](handleEntityNotFound(_0x1419d4,null))['then'](saveUpdates(_0x18bbb5[_0xa063('0x4a')],null))['then'](respondWithResult(_0x1419d4,null))['catch'](handleError(_0x1419d4,null));};exports[_0xa063('0x26')]=function(_0x3fc8db,_0x4f8d91){return db['Disposition'][_0xa063('0x51')]({'where':{'id':_0x3fc8db['params']['id']}})[_0xa063('0x25')](handleEntityNotFound(_0x4f8d91,null))['then'](removeEntity(_0x4f8d91,null))[_0xa063('0x46')](handleError(_0x4f8d91,null));}; \ No newline at end of file +var _0xe574=['userProfileId','autoAssociation','UserProfileResource','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','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','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','get','Dispositions','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','params','include','options','find','create','body','user','role','UserProfileSection'];(function(_0x33b912,_0xd206d2){var _0x29cd8d=function(_0x4f5e40){while(--_0x4f5e40){_0x33b912['push'](_0x33b912['shift']());}};_0x29cd8d(++_0xd206d2);}(_0xe574,0x100));var _0x4e57=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe574[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x4e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e57('0x1'));var jsonpatch=require(_0x4e57('0x2'));var rp=require(_0x4e57('0x3'));var moment=require(_0x4e57('0x4'));var BPromise=require(_0x4e57('0x5'));var Mustache=require(_0x4e57('0x6'));var util=require(_0x4e57('0x7'));var path=require(_0x4e57('0x8'));var sox=require(_0x4e57('0x9'));var csv=require(_0x4e57('0xa'));var ejs=require(_0x4e57('0xb'));var fs=require('fs');var fs_extra=require(_0x4e57('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e57('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4e57('0xa'));var querystring=require(_0x4e57('0xe'));var Papa=require(_0x4e57('0xf'));var Redis=require(_0x4e57('0x10'));var authService=require(_0x4e57('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e57('0x12'));var hardwareService=require(_0x4e57('0x13'));var logger=require(_0x4e57('0x14'))(_0x4e57('0x15'));var utils=require(_0x4e57('0x16'));var config=require(_0x4e57('0x17'));var licenseUtil=require(_0x4e57('0x18'));var db=require(_0x4e57('0x19'))['db'];function respondWithStatusCode(_0xed8cbc,_0x40c8c8){_0x40c8c8=_0x40c8c8||0xcc;return function(_0x330868){if(_0x330868){return _0xed8cbc[_0x4e57('0x1a')](_0x40c8c8);}return _0xed8cbc[_0x4e57('0x1b')](_0x40c8c8)[_0x4e57('0x1c')]();};}function respondWithResult(_0x28f876,_0x2e9fa8){_0x2e9fa8=_0x2e9fa8||0xc8;return function(_0x4f088a){if(_0x4f088a){return _0x28f876[_0x4e57('0x1b')](_0x2e9fa8)['json'](_0x4f088a);}};}function respondWithFilteredResult(_0x254285,_0x4af0a6){return function(_0x3401c4){if(_0x3401c4){var _0x214957=typeof _0x4af0a6['offset']===_0x4e57('0x1d')&&typeof _0x4af0a6[_0x4e57('0x1e')]===_0x4e57('0x1d');var _0xb06d8=_0x3401c4['count'];var _0x2ed980=_0x214957?0x0:_0x4af0a6[_0x4e57('0x1f')];var _0x3c2978=_0x214957?_0x3401c4[_0x4e57('0x20')]:_0x4af0a6[_0x4e57('0x1f')]+_0x4af0a6['limit'];var _0x182286;if(_0x3c2978>=_0xb06d8){_0x3c2978=_0xb06d8;_0x182286=0xc8;}else{_0x182286=0xce;}_0x254285[_0x4e57('0x1b')](_0x182286);return _0x254285[_0x4e57('0x21')](_0x4e57('0x22'),_0x2ed980+'-'+_0x3c2978+'/'+_0xb06d8)['json'](_0x3401c4);}return null;};}function patchUpdates(_0x372295){return function(_0x59df7a){try{jsonpatch[_0x4e57('0x23')](_0x59df7a,_0x372295,!![]);}catch(_0x5b6127){return BPromise[_0x4e57('0x24')](_0x5b6127);}return _0x59df7a[_0x4e57('0x25')]();};}function saveUpdates(_0x427c6b,_0x43c9a7){return function(_0x45f9cd){if(_0x45f9cd){return _0x45f9cd['update'](_0x427c6b)['then'](function(_0x17e309){return _0x17e309;});}return null;};}function removeEntity(_0x58d6ea,_0x315f7c){return function(_0x4cfa0e){if(_0x4cfa0e){return _0x4cfa0e[_0x4e57('0x26')]()[_0x4e57('0x27')](function(){var _0x38bcaa=_0x4cfa0e[_0x4e57('0x28')]({'plain':!![]});var _0x29df93=_0x4e57('0x29');return db['UserProfileResource'][_0x4e57('0x26')]({'where':{'type':_0x29df93,'resourceId':_0x38bcaa['id']}})[_0x4e57('0x27')](function(){return _0x4cfa0e;});})['then'](function(){_0x58d6ea[_0x4e57('0x1b')](0xcc)[_0x4e57('0x1c')]();});}};}function handleEntityNotFound(_0x24b9b5,_0x2ccc1f){return function(_0x45aaf1){if(!_0x45aaf1){_0x24b9b5[_0x4e57('0x1a')](0x194);}return _0x45aaf1;};}function handleError(_0x1b0ce5,_0x548a92){_0x548a92=_0x548a92||0x1f4;return function(_0x1a26f6){logger[_0x4e57('0x2a')](_0x1a26f6[_0x4e57('0x2b')]);if(_0x1a26f6[_0x4e57('0x2c')]){delete _0x1a26f6[_0x4e57('0x2c')];}_0x1b0ce5['status'](_0x548a92)['send'](_0x1a26f6);};}exports[_0x4e57('0x2d')]=function(_0x59dd4e,_0x3ce391){var _0xb7c60={},_0x4bafa8={},_0xdbd90f={'count':0x0,'rows':[]};var _0x5ba48c=_[_0x4e57('0x2e')](db[_0x4e57('0x2f')][_0x4e57('0x30')],function(_0x5e2453){return{'name':_0x5e2453[_0x4e57('0x31')],'type':_0x5e2453[_0x4e57('0x32')]['key']};});_0x4bafa8[_0x4e57('0x33')]=_['map'](_0x5ba48c,'name');_0x4bafa8[_0x4e57('0x34')]=_[_0x4e57('0x35')](_0x59dd4e[_0x4e57('0x34')]);_0x4bafa8['filters']=_[_0x4e57('0x36')](_0x4bafa8['model'],_0x4bafa8[_0x4e57('0x34')]);_0xb7c60[_0x4e57('0x37')]=_[_0x4e57('0x36')](_0x4bafa8['model'],qs[_0x4e57('0x38')](_0x59dd4e[_0x4e57('0x34')][_0x4e57('0x38')]));_0xb7c60[_0x4e57('0x37')]=_0xb7c60[_0x4e57('0x37')][_0x4e57('0x39')]?_0xb7c60[_0x4e57('0x37')]:_0x4bafa8[_0x4e57('0x33')];if(!_0x59dd4e[_0x4e57('0x34')][_0x4e57('0x3a')](_0x4e57('0x3b'))){_0xb7c60['limit']=qs[_0x4e57('0x1e')](_0x59dd4e['query'][_0x4e57('0x1e')]);_0xb7c60[_0x4e57('0x1f')]=qs[_0x4e57('0x1f')](_0x59dd4e[_0x4e57('0x34')]['offset']);}_0xb7c60['order']=qs[_0x4e57('0x3c')](_0x59dd4e[_0x4e57('0x34')][_0x4e57('0x3c')]);_0xb7c60[_0x4e57('0x3d')]=qs[_0x4e57('0x3e')](_[_0x4e57('0x3f')](_0x59dd4e[_0x4e57('0x34')],_0x4bafa8[_0x4e57('0x3e')]),_0x5ba48c);if(_0x59dd4e[_0x4e57('0x34')]['filter']){_0xb7c60[_0x4e57('0x3d')]=_['merge'](_0xb7c60[_0x4e57('0x3d')],{'$or':_[_0x4e57('0x2e')](_0x5ba48c,function(_0x526ea6){if(_0x526ea6[_0x4e57('0x32')]!==_0x4e57('0x40')){var _0x7b4391={};_0x7b4391[_0x526ea6[_0x4e57('0x2c')]]={'$like':'%'+_0x59dd4e[_0x4e57('0x34')][_0x4e57('0x41')]+'%'};return _0x7b4391;}})});}_0xb7c60=_[_0x4e57('0x42')]({},_0xb7c60,_0x59dd4e['options']);var _0x9a449d={'where':_0xb7c60[_0x4e57('0x3d')]};return db['Disposition'][_0x4e57('0x20')](_0x9a449d)[_0x4e57('0x27')](function(_0x2ef995){_0xdbd90f[_0x4e57('0x20')]=_0x2ef995;if(_0x59dd4e[_0x4e57('0x34')][_0x4e57('0x43')]){_0xb7c60['include']=[{'all':!![]}];}return db[_0x4e57('0x2f')][_0x4e57('0x44')](_0xb7c60);})[_0x4e57('0x27')](function(_0x330da6){_0xdbd90f[_0x4e57('0x45')]=_0x330da6;return _0xdbd90f;})[_0x4e57('0x27')](respondWithFilteredResult(_0x3ce391,_0xb7c60))[_0x4e57('0x46')](handleError(_0x3ce391,null));};exports['show']=function(_0x4434ed,_0x3a86eb){var _0x97c403={'raw':!![],'where':{'id':_0x4434ed[_0x4e57('0x47')]['id']}},_0x1aefd2={};_0x1aefd2['model']=_[_0x4e57('0x35')](db[_0x4e57('0x2f')][_0x4e57('0x30')]);_0x1aefd2[_0x4e57('0x34')]=_[_0x4e57('0x35')](_0x4434ed[_0x4e57('0x34')]);_0x1aefd2[_0x4e57('0x3e')]=_[_0x4e57('0x36')](_0x1aefd2[_0x4e57('0x33')],_0x1aefd2[_0x4e57('0x34')]);_0x97c403['attributes']=_['intersection'](_0x1aefd2['model'],qs[_0x4e57('0x38')](_0x4434ed[_0x4e57('0x34')][_0x4e57('0x38')]));_0x97c403[_0x4e57('0x37')]=_0x97c403[_0x4e57('0x37')][_0x4e57('0x39')]?_0x97c403[_0x4e57('0x37')]:_0x1aefd2[_0x4e57('0x33')];if(_0x4434ed[_0x4e57('0x34')][_0x4e57('0x43')]){_0x97c403[_0x4e57('0x48')]=[{'all':!![]}];}_0x97c403=_[_0x4e57('0x42')]({},_0x97c403,_0x4434ed[_0x4e57('0x49')]);return db['Disposition'][_0x4e57('0x4a')](_0x97c403)[_0x4e57('0x27')](handleEntityNotFound(_0x3a86eb,null))[_0x4e57('0x27')](respondWithResult(_0x3a86eb,null))[_0x4e57('0x46')](handleError(_0x3a86eb,null));};exports[_0x4e57('0x4b')]=function(_0x41d476,_0x48869d){return db[_0x4e57('0x2f')][_0x4e57('0x4b')](_0x41d476[_0x4e57('0x4c')],{})[_0x4e57('0x27')](function(_0x3cdb3f){var _0x3bacfb=_0x41d476[_0x4e57('0x4d')][_0x4e57('0x28')]({'plain':!![]});if(!_0x3bacfb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bacfb[_0x4e57('0x4e')]==='user'){var _0x3deb47=_0x3cdb3f[_0x4e57('0x28')]({'plain':!![]});var _0x2e880f='Dispositions';return db[_0x4e57('0x4f')]['find']({'where':{'name':_0x2e880f,'userProfileId':_0x3bacfb[_0x4e57('0x50')]},'raw':!![]})[_0x4e57('0x27')](function(_0x243a7e){if(_0x243a7e&&_0x243a7e[_0x4e57('0x51')]===0x0){return db[_0x4e57('0x52')][_0x4e57('0x4b')]({'name':_0x3deb47[_0x4e57('0x2c')],'resourceId':_0x3deb47['id'],'type':_0x243a7e['name'],'sectionId':_0x243a7e['id']},{})['then'](function(){return _0x3cdb3f;});}else{return _0x3cdb3f;}})[_0x4e57('0x46')](function(_0x2e6a8f){logger[_0x4e57('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e6a8f);throw _0x2e6a8f;});}return _0x3cdb3f;})[_0x4e57('0x27')](respondWithResult(_0x48869d,0xc9))[_0x4e57('0x46')](handleError(_0x48869d,null));};exports[_0x4e57('0x53')]=function(_0x3d4714,_0x5b6817){if(_0x3d4714[_0x4e57('0x4c')]['id']){delete _0x3d4714['body']['id'];}return db['Disposition'][_0x4e57('0x4a')]({'where':{'id':_0x3d4714[_0x4e57('0x47')]['id']}})[_0x4e57('0x27')](handleEntityNotFound(_0x5b6817,null))[_0x4e57('0x27')](saveUpdates(_0x3d4714[_0x4e57('0x4c')],null))[_0x4e57('0x27')](respondWithResult(_0x5b6817,null))[_0x4e57('0x46')](handleError(_0x5b6817,null));};exports[_0x4e57('0x26')]=function(_0x279383,_0x454d02){return db[_0x4e57('0x2f')][_0x4e57('0x4a')]({'where':{'id':_0x279383[_0x4e57('0x47')]['id']}})['then'](handleEntityNotFound(_0x454d02,null))[_0x4e57('0x27')](removeEntity(_0x454d02,null))[_0x4e57('0x46')](handleError(_0x454d02,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7c352d9..889d7ab 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 _0x09f4=['OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel'];(function(_0x46e4ea,_0x571b3a){var _0x29fbac=function(_0x465af1){while(--_0x465af1){_0x46e4ea['push'](_0x46e4ea['shift']());}};_0x29fbac(++_0x571b3a);}(_0x09f4,0x120));var _0x409f=function(_0xb9631a,_0x5b02f8){_0xb9631a=_0xb9631a-0x0;var _0x491d8c=_0x09f4[_0xb9631a];return _0x491d8c;};'use strict';var _=require(_0x409f('0x0'));var util=require(_0x409f('0x1'));var logger=require(_0x409f('0x2'))(_0x409f('0x3'));var moment=require(_0x409f('0x4'));var BPromise=require(_0x409f('0x5'));var rp=require(_0x409f('0x6'));var fs=require('fs');var path=require(_0x409f('0x7'));var rimraf=require(_0x409f('0x8'));var config=require(_0x409f('0x9'));var attributes=require('./disposition.attributes');module['exports']=function(_0x5bef8e,_0x232d15){return _0x5bef8e['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x409f('0xa'),'fields':[_0x409f('0xb'),_0x409f('0xc')]},{'unique':!![],'name':_0x409f('0xd'),'fields':['name',_0x409f('0xe')]},{'unique':!![],'name':_0x409f('0xf'),'fields':[_0x409f('0xb'),_0x409f('0x10')]},{'unique':!![],'name':_0x409f('0x11'),'fields':[_0x409f('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x409f('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x409f('0x13'),'fields':['name',_0x409f('0x14')]},{'unique':!![],'name':_0x409f('0x15'),'fields':[_0x409f('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe4a=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1aaa36,_0x303ca3){var _0x52cbaa=function(_0x43a6ea){while(--_0x43a6ea){_0x1aaa36['push'](_0x1aaa36['shift']());}};_0x52cbaa(++_0x303ca3);}(_0xbe4a,0x1d8));var _0xabe4=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xbe4a[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0xabe4('0x0'));var util=require(_0xabe4('0x1'));var logger=require(_0xabe4('0x2'))(_0xabe4('0x3'));var moment=require('moment');var BPromise=require(_0xabe4('0x4'));var rp=require(_0xabe4('0x5'));var fs=require('fs');var path=require(_0xabe4('0x6'));var rimraf=require(_0xabe4('0x7'));var config=require('../../config/environment');var attributes=require(_0xabe4('0x8'));module[_0xabe4('0x9')]=function(_0x4cd200,_0x59d83c){return _0x4cd200[_0xabe4('0xa')](_0xabe4('0xb'),attributes,{'tableName':_0xabe4('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xabe4('0xd'),'fields':[_0xabe4('0xe'),_0xabe4('0xf')]},{'unique':!![],'name':_0xabe4('0x10'),'fields':[_0xabe4('0xe'),_0xabe4('0x11')]},{'unique':!![],'name':_0xabe4('0x12'),'fields':[_0xabe4('0xe'),'MailAccountId']},{'unique':!![],'name':_0xabe4('0x13'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xabe4('0x14'),'fields':['name',_0xabe4('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xabe4('0xe'),_0xabe4('0x16')]},{'unique':!![],'name':_0xabe4('0x17'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e277fa4..c4f10fd 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(_0x553b82,_0x7501c7){var _0x204382=function(_0x33fd26){while(--_0x33fd26){_0x553b82['push'](_0x553b82['shift']());}};_0x204382(++_0x7501c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x9cf19c,_0x5b2af2){var _0x252ec8=function(_0x56851a){while(--_0x56851a){_0x9cf19c['push'](_0x9cf19c['shift']());}};_0x252ec8(++_0x5b2af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 0497138..bb3c628 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 _0x3f5d=['connect-timeout','express','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','multer','path'];(function(_0xddfb3,_0x509f41){var _0x5cc06b=function(_0x5c5f5d){while(--_0x5c5f5d){_0xddfb3['push'](_0xddfb3['shift']());}};_0x5cc06b(++_0x509f41);}(_0x3f5d,0x15e));var _0xd3f5=function(_0x1cd096,_0x120619){_0x1cd096=_0x1cd096-0x0;var _0x195274=_0x3f5d[_0x1cd096];return _0x195274;};'use strict';var multer=require(_0xd3f5('0x0'));var util=require('util');var path=require(_0xd3f5('0x1'));var timeout=require(_0xd3f5('0x2'));var express=require(_0xd3f5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd3f5('0x4'));var config=require(_0xd3f5('0x5'));var controller=require(_0xd3f5('0x6'));router[_0xd3f5('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3f5('0x8')]);router[_0xd3f5('0x7')](_0xd3f5('0x9'),auth[_0xd3f5('0xa')](),controller['show']);router[_0xd3f5('0xb')]('/',auth[_0xd3f5('0xa')](),controller['create']);router[_0xd3f5('0xc')](_0xd3f5('0x9'),auth['isAuthenticated'](),controller[_0xd3f5('0xd')]);router[_0xd3f5('0xe')]('/:id',auth[_0xd3f5('0xa')](),controller[_0xd3f5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x79cd=['show','create','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0x79cd,0x17c));var _0xd79c=function(_0x5e299e,_0x44f590){_0x5e299e=_0x5e299e-0x0;var _0x473b88=_0x79cd[_0x5e299e];return _0x473b88;};'use strict';var multer=require('multer');var util=require(_0xd79c('0x0'));var path=require('path');var timeout=require(_0xd79c('0x1'));var express=require(_0xd79c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd79c('0x3'));var interaction=require(_0xd79c('0x4'));var config=require(_0xd79c('0x5'));var controller=require(_0xd79c('0x6'));router[_0xd79c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd79c('0x7')](_0xd79c('0x8'),auth[_0xd79c('0x9')](),controller[_0xd79c('0xa')]);router['post']('/',auth[_0xd79c('0x9')](),controller[_0xd79c('0xb')]);router['put'](_0xd79c('0x8'),auth[_0xd79c('0x9')](),controller[_0xd79c('0xc')]);router[_0xd79c('0xd')](_0xd79c('0x8'),auth[_0xd79c('0x9')](),controller[_0xd79c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ee8cc3c..b5573aa 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 _0x44e8=['IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','SIP'];(function(_0x2333b0,_0x2abf08){var _0x3470e3=function(_0x175897){while(--_0x175897){_0x2333b0['push'](_0x2333b0['shift']());}};_0x3470e3(++_0x2abf08);}(_0x44e8,0xd7));var _0x844e=function(_0x13ff04,_0x40f74e){_0x13ff04=_0x13ff04-0x0;var _0x4811ad=_0x44e8[_0x13ff04];return _0x4811ad;};'use strict';var Sequelize=require(_0x844e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x844e('0x1')]},'ecm':{'type':Sequelize[_0x844e('0x2')](_0x844e('0x3'),'no'),'defaultValue':_0x844e('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x844e('0x4')},'localstationid':{'type':Sequelize[_0x844e('0x1')],'unique':_0x844e('0x5')},'minrate':{'type':Sequelize[_0x844e('0x2')]('2400',_0x844e('0x6'),_0x844e('0x7'),_0x844e('0x8'),_0x844e('0x9'),'14400'),'defaultValue':_0x844e('0x6')},'maxrate':{'type':Sequelize[_0x844e('0x2')](_0x844e('0xa'),_0x844e('0x6'),_0x844e('0x7'),_0x844e('0x8'),'12000',_0x844e('0xb')),'defaultValue':_0x844e('0xb')},'modem':{'type':Sequelize[_0x844e('0x1')],'defaultValue':_0x844e('0xc')},'gateway':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x844e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x844e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x844e('0xe'),_0x844e('0xf'),'DADHI',_0x844e('0x10')),'defaultValue':_0x844e('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x844e('0x11')],'defaultValue':function(){return _0x844e('0x12');}},'notificationSound':{'type':Sequelize[_0x844e('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x844e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x844e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x844e('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x844e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x844e('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x844e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x844e('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x844e('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x844e('0x15'),'set':function(_0x56791b){if(!_0x56791b)this[_0x844e('0x16')]('mandatoryDispositionPauseId',null);this[_0x844e('0x16')]('mandatoryDisposition',_0x56791b);}}}; \ No newline at end of file +var _0x4351=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','9600','14400','INTEGER','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4351,0x1b5));var _0x1435=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4351[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x1435('0x0'));module[_0x1435('0x1')]={'name':{'type':Sequelize[_0x1435('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1435('0x2')]},'ecm':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x4'),'no'),'defaultValue':_0x1435('0x4')},'headerinfo':{'type':Sequelize[_0x1435('0x2')],'defaultValue':_0x1435('0x5')},'localstationid':{'type':Sequelize[_0x1435('0x2')],'unique':_0x1435('0x6')},'minrate':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),'9600',_0x1435('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x1435('0x3')](_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),_0x1435('0xb'),'12000',_0x1435('0xc')),'defaultValue':_0x1435('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1435('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[_0x1435('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x1435('0xe'),'IAX','DADHI','KHOMP'),'defaultValue':_0x1435('0xe')},'key':{'type':Sequelize[_0x1435('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1435('0xf')],'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[_0x1435('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1435('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1435('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x1435('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x1435('0x10')],'defaultValue':![],'comment':_0x1435('0x12'),'set':function(_0x189f4a){if(!_0x189f4a)this[_0x1435('0x13')](_0x1435('0x14'),null);this[_0x1435('0x13')](_0x1435('0x15'),_0x189f4a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bd6fc04..3694052 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 _0xbc11=['set','Content-Range','apply','reject','save','update','then','destroy','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','where','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','order','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','exten','localstationid','app','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','push','FAXOPT(','/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','addAccountApplications','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x1dafa1,_0x903f2f){var _0x25a133=function(_0x5e227a){while(--_0x5e227a){_0x1dafa1['push'](_0x1dafa1['shift']());}};_0x25a133(++_0x903f2f);}(_0xbc11,0x95));var _0x1bc1=function(_0x194e84,_0x5104ec){_0x194e84=_0x194e84-0x0;var _0x3952b7=_0xbc11[_0x194e84];return _0x3952b7;};'use strict';var emlformat=require(_0x1bc1('0x0'));var rimraf=require(_0x1bc1('0x1'));var zipdir=require(_0x1bc1('0x2'));var jsonpatch=require(_0x1bc1('0x3'));var rp=require(_0x1bc1('0x4'));var moment=require(_0x1bc1('0x5'));var BPromise=require(_0x1bc1('0x6'));var Mustache=require(_0x1bc1('0x7'));var util=require('util');var path=require(_0x1bc1('0x8'));var sox=require(_0x1bc1('0x9'));var csv=require(_0x1bc1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bc1('0xb'));var _=require('lodash');var squel=require(_0x1bc1('0xc'));var crypto=require(_0x1bc1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1bc1('0xe'));var toCsv=require(_0x1bc1('0xa'));var querystring=require(_0x1bc1('0xf'));var Papa=require(_0x1bc1('0x10'));var Redis=require('ioredis');var authService=require(_0x1bc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1bc1('0x12'));var hardwareService=require(_0x1bc1('0x13'));var logger=require(_0x1bc1('0x14'))(_0x1bc1('0x15'));var utils=require(_0x1bc1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1bc1('0x17'))['db'];config['redis']=_[_0x1bc1('0x18')](config[_0x1bc1('0x19')],{'host':_0x1bc1('0x1a'),'port':0x18eb});var socket=require(_0x1bc1('0x1b'))(new Redis(config[_0x1bc1('0x19')]));require(_0x1bc1('0x1c'))['register'](socket);var jayson=require(_0x1bc1('0x1d'));var client=jayson['client'][_0x1bc1('0x1e')]({'port':0x232c});var client9002=jayson[_0x1bc1('0x1f')][_0x1bc1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x37c648,_0x307c47,_0x284757,_0x33b798){return new BPromise(function(_0x184d81,_0x3af928){var _0xd5f276=_0x33b798||client;return _0xd5f276[_0x1bc1('0x20')](_0x37c648,_0x284757)['then'](function(_0x25c46a){logger[_0x1bc1('0x21')](_0x1bc1('0x22'),_0x307c47,_0x1bc1('0x23'));logger[_0x1bc1('0x24')](_0x1bc1('0x25'),_0x307c47,'request\x20sent',JSON[_0x1bc1('0x26')](_0x25c46a));if(_0x25c46a[_0x1bc1('0x27')]){if(_0x25c46a[_0x1bc1('0x27')][_0x1bc1('0x28')]===0x1f4){logger[_0x1bc1('0x27')]('FaxAccount,\x20%s,\x20%s',_0x307c47,_0x25c46a[_0x1bc1('0x27')][_0x1bc1('0x29')]);return _0x3af928(_0x25c46a[_0x1bc1('0x27')]['message']);}logger['error'](_0x1bc1('0x22'),_0x307c47,_0x25c46a['error'][_0x1bc1('0x29')]);return _0x184d81(_0x25c46a[_0x1bc1('0x27')]['message']);}else{logger[_0x1bc1('0x21')]('FaxAccount,\x20%s,\x20%s',_0x307c47,'request\x20sent');_0x184d81(_0x25c46a['result'][_0x1bc1('0x29')]);}})[_0x1bc1('0x2a')](function(_0x297379){logger['error'](_0x1bc1('0x22'),_0x307c47,_0x297379);_0x3af928(_0x297379);});});}function respondWithStatusCode(_0xe10a1c,_0x49187f){_0x49187f=_0x49187f||0xcc;return function(_0x2d1bf8){if(_0x2d1bf8){return _0xe10a1c[_0x1bc1('0x2b')](_0x49187f);}return _0xe10a1c[_0x1bc1('0x2c')](_0x49187f)['end']();};}function respondWithResult(_0x4f5215,_0x301b94){_0x301b94=_0x301b94||0xc8;return function(_0x35245a){if(_0x35245a){return _0x4f5215[_0x1bc1('0x2c')](_0x301b94)[_0x1bc1('0x2d')](_0x35245a);}};}function respondWithFilteredResult(_0x3c5f75,_0x4bc0f4){return function(_0x39d080){if(_0x39d080){var _0x4b8cab=typeof _0x4bc0f4[_0x1bc1('0x2e')]===_0x1bc1('0x2f')&&typeof _0x4bc0f4[_0x1bc1('0x30')]===_0x1bc1('0x2f');var _0x34fab8=_0x39d080['count'];var _0x1b1bae=_0x4b8cab?0x0:_0x4bc0f4[_0x1bc1('0x2e')];var _0x253bbd=_0x4b8cab?_0x39d080[_0x1bc1('0x31')]:_0x4bc0f4[_0x1bc1('0x2e')]+_0x4bc0f4['limit'];var _0x28e001;if(_0x253bbd>=_0x34fab8){_0x253bbd=_0x34fab8;_0x28e001=0xc8;}else{_0x28e001=0xce;}_0x3c5f75[_0x1bc1('0x2c')](_0x28e001);return _0x3c5f75[_0x1bc1('0x32')](_0x1bc1('0x33'),_0x1b1bae+'-'+_0x253bbd+'/'+_0x34fab8)[_0x1bc1('0x2d')](_0x39d080);}return null;};}function patchUpdates(_0x4f9480){return function(_0x4a7706){try{jsonpatch[_0x1bc1('0x34')](_0x4a7706,_0x4f9480,!![]);}catch(_0x42cb94){return BPromise[_0x1bc1('0x35')](_0x42cb94);}return _0x4a7706[_0x1bc1('0x36')]();};}function saveUpdates(_0x1ed109,_0x1b140b){return function(_0x5d08e5){if(_0x5d08e5){return _0x5d08e5[_0x1bc1('0x37')](_0x1ed109)[_0x1bc1('0x38')](function(_0x520d20){return _0x520d20;});}return null;};}function removeEntity(_0x5d38b6,_0x44d19a){return function(_0x41d2be){if(_0x41d2be){return _0x41d2be[_0x1bc1('0x39')]()[_0x1bc1('0x38')](function(){var _0x45dce7=_0x41d2be['get']({'plain':!![]});var _0x32bac9=_0x1bc1('0x3a');return db[_0x1bc1('0x3b')][_0x1bc1('0x39')]({'where':{'type':_0x32bac9,'resourceId':_0x45dce7['id']}})['then'](function(){return _0x41d2be;});})[_0x1bc1('0x38')](function(){_0x5d38b6[_0x1bc1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57e1ce,_0x5907fc){return function(_0x1d4d78){if(!_0x1d4d78){_0x57e1ce[_0x1bc1('0x2b')](0x194);}return _0x1d4d78;};}function handleError(_0x3f6cbc,_0x27d3fd){_0x27d3fd=_0x27d3fd||0x1f4;return function(_0x491a05){logger[_0x1bc1('0x27')](_0x491a05[_0x1bc1('0x3c')]);if(_0x491a05[_0x1bc1('0x3d')]){delete _0x491a05[_0x1bc1('0x3d')];}_0x3f6cbc[_0x1bc1('0x2c')](_0x27d3fd)['send'](_0x491a05);};}exports[_0x1bc1('0x3e')]=function(_0x4d72b1,_0x4d5d4b){var _0x34ff7b={'include':[{'model':db[_0x1bc1('0x3f')],'as':_0x1bc1('0x40')}]},_0x3e1262={},_0x57b15b={'count':0x0,'rows':[]};var _0x2ce3d1=_[_0x1bc1('0x41')](db[_0x1bc1('0x42')][_0x1bc1('0x43')],function(_0x2c6205){return{'name':_0x2c6205[_0x1bc1('0x44')],'type':_0x2c6205[_0x1bc1('0x45')]['key']};});_0x3e1262[_0x1bc1('0x46')]=_[_0x1bc1('0x41')](_0x2ce3d1,_0x1bc1('0x3d'));_0x3e1262[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x4d72b1[_0x1bc1('0x47')]);_0x3e1262[_0x1bc1('0x49')]=_[_0x1bc1('0x4a')](_0x3e1262[_0x1bc1('0x46')],_0x3e1262['query']);_0x34ff7b[_0x1bc1('0x4b')]=_['intersection'](_0x3e1262[_0x1bc1('0x46')],qs['fields'](_0x4d72b1[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0x34ff7b[_0x1bc1('0x4b')]=_0x34ff7b[_0x1bc1('0x4b')][_0x1bc1('0x4d')]?_0x34ff7b[_0x1bc1('0x4b')]:_0x3e1262[_0x1bc1('0x46')];if(!_0x4d72b1[_0x1bc1('0x47')][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0x34ff7b[_0x1bc1('0x30')]=qs[_0x1bc1('0x30')](_0x4d72b1[_0x1bc1('0x47')]['limit']);_0x34ff7b[_0x1bc1('0x2e')]=qs[_0x1bc1('0x2e')](_0x4d72b1['query'][_0x1bc1('0x2e')]);}_0x34ff7b['order']=qs[_0x1bc1('0x50')](_0x4d72b1['query']['sort']);_0x34ff7b['where']=qs[_0x1bc1('0x49')](_[_0x1bc1('0x51')](_0x4d72b1[_0x1bc1('0x47')],_0x3e1262[_0x1bc1('0x49')]),_0x2ce3d1);if(_0x4d72b1[_0x1bc1('0x47')][_0x1bc1('0x52')]){_0x34ff7b['where']=_['merge'](_0x34ff7b['where'],{'$or':_[_0x1bc1('0x41')](_0x2ce3d1,function(_0x3d1270){if(_0x3d1270[_0x1bc1('0x45')]!==_0x1bc1('0x53')){var _0x2ed37b={};_0x2ed37b[_0x3d1270[_0x1bc1('0x3d')]]={'$like':'%'+_0x4d72b1[_0x1bc1('0x47')][_0x1bc1('0x52')]+'%'};return _0x2ed37b;}})});}_0x34ff7b=_[_0x1bc1('0x54')]({},_0x34ff7b,_0x4d72b1[_0x1bc1('0x55')]);var _0x1e5059={'where':_0x34ff7b['where']};return db[_0x1bc1('0x42')]['count'](_0x1e5059)[_0x1bc1('0x38')](function(_0x452073){_0x57b15b[_0x1bc1('0x31')]=_0x452073;if(_0x4d72b1[_0x1bc1('0x47')][_0x1bc1('0x56')]){_0x34ff7b[_0x1bc1('0x57')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x34ff7b);})[_0x1bc1('0x38')](function(_0x1f90dd){_0x57b15b[_0x1bc1('0x58')]=_0x1f90dd;return _0x57b15b;})['then'](respondWithFilteredResult(_0x4d5d4b,_0x34ff7b))['catch'](handleError(_0x4d5d4b,null));};exports['show']=function(_0x2e0609,_0x3824e0){var _0xcd413f={'raw':![],'where':{'id':_0x2e0609[_0x1bc1('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xc592ac={};_0xc592ac[_0x1bc1('0x46')]=_['keys'](db[_0x1bc1('0x42')]['rawAttributes']);_0xc592ac[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x2e0609[_0x1bc1('0x47')]);_0xc592ac[_0x1bc1('0x49')]=_[_0x1bc1('0x4a')](_0xc592ac[_0x1bc1('0x46')],_0xc592ac['query']);_0xcd413f[_0x1bc1('0x4b')]=_['intersection'](_0xc592ac[_0x1bc1('0x46')],qs[_0x1bc1('0x4c')](_0x2e0609[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0xcd413f[_0x1bc1('0x4b')]=_0xcd413f[_0x1bc1('0x4b')][_0x1bc1('0x4d')]?_0xcd413f[_0x1bc1('0x4b')]:_0xc592ac[_0x1bc1('0x46')];if(_0x2e0609[_0x1bc1('0x47')][_0x1bc1('0x56')]){_0xcd413f[_0x1bc1('0x57')]=[{'all':!![]}];}_0xcd413f=_['merge']({},_0xcd413f,_0x2e0609[_0x1bc1('0x55')]);return db[_0x1bc1('0x42')][_0x1bc1('0x5a')](_0xcd413f)[_0x1bc1('0x38')](handleEntityNotFound(_0x3824e0,null))['then'](respondWithResult(_0x3824e0,null))[_0x1bc1('0x2a')](handleError(_0x3824e0,null));};exports[_0x1bc1('0x5b')]=function(_0x2a566e,_0xb73a6b){return db[_0x1bc1('0x42')][_0x1bc1('0x5b')](_0x2a566e[_0x1bc1('0x5c')],{})['then'](function(_0xee9b93){var _0x37db3e=_0x2a566e[_0x1bc1('0x5d')][_0x1bc1('0x5e')]({'plain':!![]});if(!_0x37db3e)throw new Error(_0x1bc1('0x5f'));if(_0x37db3e[_0x1bc1('0x60')]===_0x1bc1('0x5d')){var _0x59935f=_0xee9b93['get']({'plain':!![]});var _0x5b4d0c=_0x1bc1('0x3a');return db[_0x1bc1('0x61')][_0x1bc1('0x5a')]({'where':{'name':_0x5b4d0c,'userProfileId':_0x37db3e[_0x1bc1('0x62')]},'raw':!![]})['then'](function(_0x22f0b9){if(_0x22f0b9&&_0x22f0b9[_0x1bc1('0x63')]===0x0){return db[_0x1bc1('0x3b')][_0x1bc1('0x5b')]({'name':_0x59935f[_0x1bc1('0x3d')],'resourceId':_0x59935f['id'],'type':_0x22f0b9['name'],'sectionId':_0x22f0b9['id']},{})[_0x1bc1('0x38')](function(){return _0xee9b93;});}else{return _0xee9b93;}})[_0x1bc1('0x2a')](function(_0x56a930){logger[_0x1bc1('0x27')](_0x1bc1('0x64'),_0x56a930);throw _0x56a930;});}return _0xee9b93;})[_0x1bc1('0x38')](respondWithResult(_0xb73a6b,0xc9))[_0x1bc1('0x2a')](handleError(_0xb73a6b,null));};exports[_0x1bc1('0x37')]=function(_0x1be8fe,_0x5cb391){if(_0x1be8fe['body']['id']){delete _0x1be8fe['body']['id'];}return db[_0x1bc1('0x42')][_0x1bc1('0x5a')]({'where':{'id':_0x1be8fe['params']['id']},'include':[{'model':db[_0x1bc1('0x3f')],'as':_0x1bc1('0x40')}]})[_0x1bc1('0x38')](handleEntityNotFound(_0x5cb391,null))[_0x1bc1('0x38')](saveUpdates(_0x1be8fe['body'],null))[_0x1bc1('0x38')](respondWithResult(_0x5cb391,null))[_0x1bc1('0x2a')](handleError(_0x5cb391,null));};exports[_0x1bc1('0x39')]=function(_0x5df694,_0x4457c2){return db[_0x1bc1('0x42')]['find']({'where':{'id':_0x5df694[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x4457c2,null))[_0x1bc1('0x38')](removeEntity(_0x4457c2,null))[_0x1bc1('0x2a')](handleError(_0x4457c2,null));};exports[_0x1bc1('0x65')]=function(_0x11401c,_0x506351){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x506351,null))[_0x1bc1('0x2a')](handleError(_0x506351,null));};exports[_0x1bc1('0x66')]=function(_0x358f30,_0x4f0ded,_0x3d88cb){if(_0x358f30[_0x1bc1('0x5c')]['id']){delete _0x358f30[_0x1bc1('0x5c')]['id'];}return db['FaxAccount'][_0x1bc1('0x5a')]({'where':{'id':_0x358f30[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x4f0ded,null))[_0x1bc1('0x38')](function(_0x174e54){if(_0x174e54){_0x358f30[_0x1bc1('0x5c')][_0x1bc1('0x67')]=_0x174e54['id'];return db['Disposition'][_0x1bc1('0x5b')](_0x358f30[_0x1bc1('0x5c')]);}})[_0x1bc1('0x38')](respondWithResult(_0x4f0ded,null))['catch'](handleError(_0x4f0ded,null));};exports[_0x1bc1('0x68')]=function(_0x7cd325,_0x20477d,_0x2bf0f9){var _0x20948c={'raw':![],'where':{}};var _0x23ef36={};var _0xfcbddc={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1bc1('0x69')]({'where':{'id':_0x7cd325[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x20477d,null))[_0x1bc1('0x38')](function(_0x749948){if(_0x749948){_0x23ef36[_0x1bc1('0x46')]=_[_0x1bc1('0x48')](db['Disposition'][_0x1bc1('0x43')]);_0x23ef36[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x7cd325['query']);_0x23ef36[_0x1bc1('0x49')]=_[_0x1bc1('0x4a')](_0x23ef36['model'],_0x23ef36['query']);_0x20948c[_0x1bc1('0x4b')]=_['intersection'](_0x23ef36['model'],qs[_0x1bc1('0x4c')](_0x7cd325[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0x20948c[_0x1bc1('0x4b')]=_0x20948c[_0x1bc1('0x4b')]['length']?_0x20948c['attributes']:_0x23ef36[_0x1bc1('0x46')];if(!_0x7cd325[_0x1bc1('0x47')][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0x20948c[_0x1bc1('0x30')]=qs[_0x1bc1('0x30')](_0x7cd325[_0x1bc1('0x47')]['limit']);_0x20948c['offset']=qs[_0x1bc1('0x2e')](_0x7cd325[_0x1bc1('0x47')][_0x1bc1('0x2e')]);}_0x20948c['order']=qs[_0x1bc1('0x50')](_0x7cd325['query'][_0x1bc1('0x50')]);_0x20948c[_0x1bc1('0x6a')]=qs[_0x1bc1('0x49')](_[_0x1bc1('0x51')](_0x7cd325[_0x1bc1('0x47')],_0x23ef36['filters']));_0x20948c[_0x1bc1('0x6a')]['FaxAccountId']=_0x749948['id'];if(_0x7cd325['query']['filter']){_0x20948c['where']=_[_0x1bc1('0x54')](_0x20948c[_0x1bc1('0x6a')],{'$or':_[_0x1bc1('0x41')](_0x20948c[_0x1bc1('0x4b')],function(_0x4e70db){var _0x4c09fc={};_0x4c09fc[_0x4e70db]={'$like':'%'+_0x7cd325[_0x1bc1('0x47')]['filter']+'%'};return _0x4c09fc;})});}_0x20948c=_['merge']({},_0x20948c,_0x7cd325[_0x1bc1('0x55')]);return db[_0x1bc1('0x6b')][_0x1bc1('0x31')]({'where':_0x20948c[_0x1bc1('0x6a')]})[_0x1bc1('0x38')](function(_0x1d2ab8){_0xfcbddc[_0x1bc1('0x31')]=_0x1d2ab8;if(_0x7cd325[_0x1bc1('0x47')][_0x1bc1('0x56')]){_0x20948c['include']=[{'all':!![]}];}return db[_0x1bc1('0x6b')][_0x1bc1('0x6c')](_0x20948c);})[_0x1bc1('0x38')](function(_0x5405d8){_0xfcbddc[_0x1bc1('0x58')]=_0x5405d8;return _0xfcbddc;});}})[_0x1bc1('0x38')](respondWithFilteredResult(_0x20477d,_0x20948c))[_0x1bc1('0x2a')](handleError(_0x20477d,null));};exports[_0x1bc1('0x6d')]=function(_0x15f9c5,_0x32f934,_0x276b67){return db[_0x1bc1('0x42')][_0x1bc1('0x5a')]({'where':{'id':_0x15f9c5[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x32f934,null))[_0x1bc1('0x38')](function(_0x53e737){if(_0x53e737){return _0x53e737['removeDispositions'](_0x15f9c5[_0x1bc1('0x47')]['ids']);}})[_0x1bc1('0x38')](respondWithStatusCode(_0x32f934,null))['catch'](handleError(_0x32f934,null));};exports[_0x1bc1('0x6e')]=function(_0x506de2,_0x4ca99e,_0x3b32b5){if(_0x506de2['body']['id']){delete _0x506de2[_0x1bc1('0x5c')]['id'];}return db[_0x1bc1('0x42')][_0x1bc1('0x5a')]({'where':{'id':_0x506de2['params']['id']}})['then'](handleEntityNotFound(_0x4ca99e,null))[_0x1bc1('0x38')](function(_0x41e3ee){if(_0x41e3ee){_0x506de2['body'][_0x1bc1('0x67')]=_0x41e3ee['id'];return db[_0x1bc1('0x6f')]['create'](_0x506de2['body']);}})[_0x1bc1('0x38')](respondWithResult(_0x4ca99e,null))['catch'](handleError(_0x4ca99e,null));};exports['getAnswers']=function(_0x2f1569,_0x945f1b,_0x1b4fbc){var _0xbd696e={'raw':![],'where':{}};var _0x2421e7={};var _0x5d3528={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1bc1('0x69')]({'where':{'id':_0x2f1569['params']['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x945f1b,null))[_0x1bc1('0x38')](function(_0x115605){if(_0x115605){_0x2421e7[_0x1bc1('0x46')]=_[_0x1bc1('0x48')](db[_0x1bc1('0x6f')][_0x1bc1('0x43')]);_0x2421e7[_0x1bc1('0x47')]=_['keys'](_0x2f1569[_0x1bc1('0x47')]);_0x2421e7['filters']=_[_0x1bc1('0x4a')](_0x2421e7['model'],_0x2421e7[_0x1bc1('0x47')]);_0xbd696e[_0x1bc1('0x4b')]=_[_0x1bc1('0x4a')](_0x2421e7[_0x1bc1('0x46')],qs[_0x1bc1('0x4c')](_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0xbd696e[_0x1bc1('0x4b')]=_0xbd696e[_0x1bc1('0x4b')]['length']?_0xbd696e['attributes']:_0x2421e7[_0x1bc1('0x46')];if(!_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0xbd696e[_0x1bc1('0x30')]=qs[_0x1bc1('0x30')](_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x30')]);_0xbd696e[_0x1bc1('0x2e')]=qs[_0x1bc1('0x2e')](_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x2e')]);}_0xbd696e[_0x1bc1('0x70')]=qs[_0x1bc1('0x50')](_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x50')]);_0xbd696e[_0x1bc1('0x6a')]=qs['filters'](_[_0x1bc1('0x51')](_0x2f1569['query'],_0x2421e7[_0x1bc1('0x49')]));_0xbd696e[_0x1bc1('0x6a')][_0x1bc1('0x67')]=_0x115605['id'];if(_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x52')]){_0xbd696e[_0x1bc1('0x6a')]=_['merge'](_0xbd696e[_0x1bc1('0x6a')],{'$or':_['map'](_0xbd696e[_0x1bc1('0x4b')],function(_0x17ad44){var _0x436f79={};_0x436f79[_0x17ad44]={'$like':'%'+_0x2f1569[_0x1bc1('0x47')]['filter']+'%'};return _0x436f79;})});}_0xbd696e=_['merge']({},_0xbd696e,_0x2f1569['options']);return db['CannedAnswer']['count']({'where':_0xbd696e['where']})['then'](function(_0x315346){_0x5d3528[_0x1bc1('0x31')]=_0x315346;if(_0x2f1569[_0x1bc1('0x47')][_0x1bc1('0x56')]){_0xbd696e[_0x1bc1('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1bc1('0x6c')](_0xbd696e);})[_0x1bc1('0x38')](function(_0x8380d2){_0x5d3528[_0x1bc1('0x58')]=_0x8380d2;return _0x5d3528;});}})[_0x1bc1('0x38')](respondWithFilteredResult(_0x945f1b,_0xbd696e))[_0x1bc1('0x2a')](handleError(_0x945f1b,null));};exports[_0x1bc1('0x71')]=function(_0x96b297,_0x21232f,_0x40019c){return db[_0x1bc1('0x42')][_0x1bc1('0x5a')]({'where':{'id':_0x96b297[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x21232f,null))['then'](function(_0x1be66a){if(_0x1be66a){return _0x1be66a[_0x1bc1('0x71')](_0x96b297['query']['ids']);}})[_0x1bc1('0x38')](respondWithStatusCode(_0x21232f,null))[_0x1bc1('0x2a')](handleError(_0x21232f,null));};exports[_0x1bc1('0x72')]=function(_0x53faa3,_0x35232c,_0x1f2fa2){return db[_0x1bc1('0x73')]['find']({'where':{'id':_0x53faa3['params']['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x35232c,null))[_0x1bc1('0x38')](function(_0x39b68a){if(_0x39b68a){return _0x39b68a[_0x1bc1('0x72')](_0x53faa3['body'][_0x1bc1('0x74')],_[_0x1bc1('0x75')](_0x53faa3[_0x1bc1('0x5c')],[_0x1bc1('0x74'),'id'])||{});}})['then'](respondWithResult(_0x35232c,null))['catch'](handleError(_0x35232c,null));};exports[_0x1bc1('0x76')]=function(_0x38a610,_0x3f84d9,_0x5ec84d){var _0x513d9f={'raw':![],'where':{}};var _0x1d3109={};var _0x5b2b59={'count':0x0,'rows':[]};return db[_0x1bc1('0x42')]['findOne']({'where':{'id':_0x38a610[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x3f84d9,null))['then'](function(_0x4ad7cb){if(_0x4ad7cb){_0x1d3109['model']=_[_0x1bc1('0x48')](db['FaxInteraction'][_0x1bc1('0x43')]);_0x1d3109[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x38a610['query']);_0x1d3109[_0x1bc1('0x49')]=_[_0x1bc1('0x4a')](_0x1d3109[_0x1bc1('0x46')],_0x1d3109[_0x1bc1('0x47')]);_0x513d9f['attributes']=_[_0x1bc1('0x4a')](_0x1d3109['model'],qs['fields'](_0x38a610[_0x1bc1('0x47')]['fields']));_0x513d9f[_0x1bc1('0x4b')]=_0x513d9f[_0x1bc1('0x4b')][_0x1bc1('0x4d')]?_0x513d9f['attributes']:_0x1d3109[_0x1bc1('0x46')];if(!_0x38a610['query'][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0x513d9f['limit']=qs[_0x1bc1('0x30')](_0x38a610[_0x1bc1('0x47')][_0x1bc1('0x30')]);_0x513d9f[_0x1bc1('0x2e')]=qs[_0x1bc1('0x2e')](_0x38a610['query'][_0x1bc1('0x2e')]);}_0x513d9f[_0x1bc1('0x70')]=qs[_0x1bc1('0x50')](_0x38a610['query']['sort']);_0x513d9f[_0x1bc1('0x6a')]=qs[_0x1bc1('0x49')](_['pick'](_0x38a610[_0x1bc1('0x47')],_0x1d3109[_0x1bc1('0x49')]));_0x513d9f[_0x1bc1('0x6a')]['FaxAccountId']=_0x4ad7cb['id'];if(_0x38a610[_0x1bc1('0x47')][_0x1bc1('0x52')]){_0x513d9f[_0x1bc1('0x6a')]=_[_0x1bc1('0x54')](_0x513d9f[_0x1bc1('0x6a')],{'$or':_['map'](_0x513d9f[_0x1bc1('0x4b')],function(_0xd9170f){var _0x53d16e={};_0x53d16e[_0xd9170f]={'$like':'%'+_0x38a610[_0x1bc1('0x47')]['filter']+'%'};return _0x53d16e;})});}_0x513d9f=_[_0x1bc1('0x54')]({},_0x513d9f,_0x38a610[_0x1bc1('0x55')]);return db['FaxInteraction'][_0x1bc1('0x31')]({'where':_0x513d9f[_0x1bc1('0x6a')]})[_0x1bc1('0x38')](function(_0x52fc18){_0x5b2b59[_0x1bc1('0x31')]=_0x52fc18;if(_0x38a610[_0x1bc1('0x47')][_0x1bc1('0x56')]){_0x513d9f[_0x1bc1('0x57')]=[{'model':db[_0x1bc1('0x77')],'as':_0x1bc1('0x78'),'required':![]},{'model':db[_0x1bc1('0x79')],'as':_0x1bc1('0x7a'),'attributes':['name',_0x1bc1('0x7b'),_0x1bc1('0x7c')],'required':![]},{'model':db[_0x1bc1('0x7d')],'as':_0x1bc1('0x7e'),'attributes':['id',_0x1bc1('0x3d'),_0x1bc1('0x7f')],'where':_0x38a610[_0x1bc1('0x47')][_0x1bc1('0x80')]?{'id':_0x38a610['query'][_0x1bc1('0x80')]}:undefined,'required':_0x38a610['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0x1bc1('0x6c')](_0x513d9f);})[_0x1bc1('0x38')](function(_0x365085){_0x5b2b59['rows']=_0x365085;return _0x5b2b59;});}})[_0x1bc1('0x38')](respondWithFilteredResult(_0x3f84d9,_0x513d9f))['catch'](handleError(_0x3f84d9,null));};exports['addApplications']=function(_0x33706b,_0x1eb7bd){var _0x21ea7c=_0x33706b[_0x1bc1('0x59')]['id'];var _0x444112=_0x33706b[_0x1bc1('0x5c')];var _0x4df585=0xc8;var _0x2b0274=null;return db[_0x1bc1('0x81')][_0x1bc1('0x82')]({'isolationLevel':db[_0x1bc1('0x81')][_0x1bc1('0x83')][_0x1bc1('0x84')]['READ_COMMITTED']},function(_0x25801b){return db[_0x1bc1('0x42')][_0x1bc1('0x69')]({'where':{'id':_0x21ea7c},'transaction':_0x25801b})['then'](function(_0x23a40b){if(_0x23a40b){return db[_0x1bc1('0x85')][_0x1bc1('0x39')]({'where':{'FaxAccountId':_0x21ea7c},'transaction':_0x25801b})[_0x1bc1('0x38')](function(){var _0x243f0c=_[_0x1bc1('0x41')](_0x444112,function(_0x5d92e6){_0x5d92e6[_0x1bc1('0x67')]=_0x21ea7c;return _0x5d92e6;});return db[_0x1bc1('0x85')][_0x1bc1('0x86')](_0x243f0c,{'transaction':_0x25801b});});}else{_0x4df585=0x194;_0x2b0274=[];}});})[_0x1bc1('0x38')](function(){if(_0x4df585!==0x194){return db[_0x1bc1('0x85')][_0x1bc1('0x87')]({'where':{'FaxAccountId':_0x21ea7c},'order':_0x1bc1('0x88')})['then'](function(_0x2ffe38){_0x2b0274=_0x2ffe38;});}})[_0x1bc1('0x2a')](function(_0x43231e){_0x4df585=0x1f4;logger[_0x1bc1('0x27')](_0x43231e[_0x1bc1('0x3c')]);if(_0x43231e[_0x1bc1('0x3d')]){delete _0x43231e[_0x1bc1('0x3d')];}_0x2b0274=_0x43231e;})[_0x1bc1('0x89')](function(){if(_0x2b0274===null){_0x1eb7bd['sendStatus'](_0x4df585);}else{if(_0x4df585===0x1f4){_0x1eb7bd[_0x1bc1('0x2c')](_0x4df585)[_0x1bc1('0x8a')](_0x2b0274);}else{_0x1eb7bd[_0x1bc1('0x2c')](_0x4df585)[_0x1bc1('0x2d')](_0x2b0274);}}});};exports[_0x1bc1('0x8b')]=function(_0x272908,_0x1876bc,_0x2c4754){var _0x43a57a={};var _0x582026={};var _0x3ebdab;var _0x1eb50f;return db['FaxAccount'][_0x1bc1('0x69')]({'where':{'id':_0x272908['params']['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x1876bc,null))[_0x1bc1('0x38')](function(_0x1b9903){if(_0x1b9903){_0x3ebdab=_0x1b9903;_0x582026[_0x1bc1('0x46')]=_['keys'](db[_0x1bc1('0x85')][_0x1bc1('0x43')]);_0x582026[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x272908[_0x1bc1('0x47')]);_0x582026['filters']=_['intersection'](_0x582026[_0x1bc1('0x46')],_0x582026[_0x1bc1('0x47')]);_0x43a57a['attributes']=_[_0x1bc1('0x4a')](_0x582026[_0x1bc1('0x46')],qs[_0x1bc1('0x4c')](_0x272908[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0x43a57a[_0x1bc1('0x4b')]=_0x43a57a[_0x1bc1('0x4b')]['length']?_0x43a57a['attributes']:_0x582026[_0x1bc1('0x46')];_0x43a57a[_0x1bc1('0x70')]=qs[_0x1bc1('0x50')](_0x272908[_0x1bc1('0x47')]['sort']);_0x43a57a['where']=qs[_0x1bc1('0x49')](_[_0x1bc1('0x51')](_0x272908[_0x1bc1('0x47')],_0x582026[_0x1bc1('0x49')]));if(_0x272908[_0x1bc1('0x47')][_0x1bc1('0x52')]){_0x43a57a[_0x1bc1('0x6a')]=_[_0x1bc1('0x54')](_0x43a57a[_0x1bc1('0x6a')],{'$or':_[_0x1bc1('0x41')](_0x43a57a['attributes'],function(_0x493b7b){var _0x12d820={};_0x12d820[_0x493b7b]={'$like':'%'+_0x272908[_0x1bc1('0x47')][_0x1bc1('0x52')]+'%'};return _0x12d820;})});}_0x43a57a=_[_0x1bc1('0x54')]({},_0x43a57a,_0x272908['options']);return _0x3ebdab[_0x1bc1('0x8b')](_0x43a57a);}})[_0x1bc1('0x38')](function(_0x1a196e){if(_0x1a196e){_0x1eb50f=_0x1a196e[_0x1bc1('0x4d')];if(!_0x272908[_0x1bc1('0x47')][_0x1bc1('0x4e')]('nolimit')){_0x43a57a['limit']=qs[_0x1bc1('0x30')](_0x272908['query'][_0x1bc1('0x30')]);_0x43a57a[_0x1bc1('0x2e')]=qs[_0x1bc1('0x2e')](_0x272908[_0x1bc1('0x47')][_0x1bc1('0x2e')]);}return _0x3ebdab[_0x1bc1('0x8b')](_0x43a57a);}})[_0x1bc1('0x38')](function(_0x6c18bb){if(_0x6c18bb){return _0x6c18bb?{'count':_0x1eb50f,'rows':_0x6c18bb}:null;}})[_0x1bc1('0x38')](respondWithResult(_0x1876bc,null))[_0x1bc1('0x2a')](handleError(_0x1876bc,null));};function Extension(_0x3b9827,_0x25839a,_0x197f24,_0x503f19){this['context']='from-voip-provider';this[_0x1bc1('0x8c')]=_0x3b9827[_0x1bc1('0x8d')];this[_0x1bc1('0x8e')]=_0x503f19;this[_0x1bc1('0x45')]='system';this['description']=_0x1bc1('0x8f');this['FaxAccountId']=_0x3b9827['id'];this[_0x1bc1('0x88')]=_0x25839a;this[_0x1bc1('0x90')]=_0x197f24;}function createExtensionsReciveFax(_0x4b2a75){var _0x2c3624=0x1;var _0x122fba=[];_0x122fba['push'](new Extension(_0x4b2a75,_0x2c3624,'',_0x1bc1('0x91')));_0x2c3624+=0x1;_0x122fba['push'](new Extension(_0x4b2a75,_0x2c3624,_0x1bc1('0x92'),_0x1bc1('0x93')));_0x2c3624+=0x1;for(var _0x5e2e89 in _0x4b2a75){if(_0x4b2a75['hasOwnProperty'](_0x5e2e89)&&(_0x5e2e89===_0x1bc1('0x94')||_0x5e2e89==='localstationid'||_0x5e2e89===_0x1bc1('0x95')||_0x5e2e89===_0x1bc1('0x96')||_0x5e2e89==='headerinfo'||_0x5e2e89===_0x1bc1('0x97')||_0x5e2e89===_0x1bc1('0x98')||_0x5e2e89===_0x1bc1('0x99')||_0x5e2e89===_0x1bc1('0x9a'))){_0x122fba[_0x1bc1('0x9b')](new Extension(_0x4b2a75,_0x2c3624,_0x1bc1('0x9c')+_0x5e2e89+')='+_0x4b2a75[_0x5e2e89],_0x1bc1('0x93')));_0x2c3624+=0x1;}}_0x122fba[_0x1bc1('0x9b')](new Extension(_0x4b2a75,_0x2c3624,'6','Wait'));_0x2c3624+=0x1;_0x122fba[_0x1bc1('0x9b')](new Extension(_0x4b2a75,_0x2c3624,_0x1bc1('0x9d'),'ReceiveFax'));_0x2c3624=0x0;return _0x122fba;}exports[_0x1bc1('0x9e')]=function(_0x1f8025,_0x54cd00,_0x167961){var _0x948456;return db[_0x1bc1('0x81')][_0x1bc1('0x82')](function(_0x32eae7){return db[_0x1bc1('0x42')][_0x1bc1('0x5b')](_0x1f8025[_0x1bc1('0x5c')],{'transaction':_0x32eae7})[_0x1bc1('0x38')](function(_0x562d95){_0x948456=_0x562d95[_0x1bc1('0x5e')]({'plain':!![]});return db['VoiceExtension'][_0x1bc1('0x86')](createExtensionsReciveFax(_0x948456),{'transaction':_0x32eae7});});})[_0x1bc1('0x38')](function(){return _0x948456;})['then'](respondWithResult(_0x54cd00,null))['catch'](handleError(_0x54cd00,null));};exports[_0x1bc1('0x9f')]=function(_0x2892ac,_0x2b6d5c,_0x159801){var _0x4b6ae4;return db[_0x1bc1('0x81')][_0x1bc1('0x82')](function(_0x4c7ca6){return db[_0x1bc1('0x42')][_0x1bc1('0x37')](_0x2892ac[_0x1bc1('0x5c')],{'where':{'id':_0x2892ac[_0x1bc1('0x5c')]['id']},'transaction':_0x4c7ca6})[_0x1bc1('0x38')](function(_0x507474){return db[_0x1bc1('0xa0')][_0x1bc1('0x39')]({'where':{'FaxAccountId':_0x2892ac[_0x1bc1('0x5c')]['id']},'transaction':_0x4c7ca6})['then'](function(_0x1ae21d){return db[_0x1bc1('0xa0')][_0x1bc1('0x86')](createExtensionsReciveFax(_[_0x1bc1('0x75')](_0x2892ac[_0x1bc1('0x5c')],[_0x1bc1('0xa1'),'key','createdAt',_0x1bc1('0xa2'),_0x1bc1('0xa3'),_0x1bc1('0xa4')])),{'transaction':_0x4c7ca6});});});})[_0x1bc1('0x38')](function(){return db[_0x1bc1('0x42')][_0x1bc1('0xa5')](_0x2892ac['body']['id']);})['then'](respondWithResult(_0x2b6d5c,null))[_0x1bc1('0x2a')](handleError(_0x2b6d5c,null));};exports['getMessages']=function(_0x213861,_0x57d9f2,_0x3e58ee){var _0x12854b={'raw':!![],'where':{}};var _0x6edf61={};var _0x3a1768={'count':0x0,'rows':[]};return db[_0x1bc1('0x42')][_0x1bc1('0x69')]({'where':{'id':_0x213861[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x57d9f2,null))[_0x1bc1('0x38')](function(_0x168f01){if(_0x168f01){_0x6edf61['model']=_[_0x1bc1('0x48')](db[_0x1bc1('0xa6')][_0x1bc1('0x43')]);_0x6edf61[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x213861['query']);_0x6edf61[_0x1bc1('0x49')]=_['intersection'](_0x6edf61['model'],_0x6edf61[_0x1bc1('0x47')]);_0x12854b['attributes']=_['intersection'](_0x6edf61[_0x1bc1('0x46')],qs[_0x1bc1('0x4c')](_0x213861[_0x1bc1('0x47')][_0x1bc1('0x4c')]));_0x12854b['attributes']=_0x12854b['attributes']['length']?_0x12854b[_0x1bc1('0x4b')]:_0x6edf61['model'];if(!_0x213861[_0x1bc1('0x47')][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0x12854b[_0x1bc1('0x30')]=qs[_0x1bc1('0x30')](_0x213861[_0x1bc1('0x47')][_0x1bc1('0x30')]);_0x12854b['offset']=qs[_0x1bc1('0x2e')](_0x213861[_0x1bc1('0x47')][_0x1bc1('0x2e')]);}_0x12854b[_0x1bc1('0x70')]=qs[_0x1bc1('0x50')](_0x213861[_0x1bc1('0x47')][_0x1bc1('0x50')]);_0x12854b[_0x1bc1('0x6a')]=qs[_0x1bc1('0x49')](_['pick'](_0x213861[_0x1bc1('0x47')],_0x6edf61[_0x1bc1('0x49')]));_0x12854b['where'][_0x1bc1('0x67')]=_0x168f01['id'];if(_0x213861['query'][_0x1bc1('0x52')]){_0x12854b[_0x1bc1('0x6a')]=_[_0x1bc1('0x54')](_0x12854b[_0x1bc1('0x6a')],{'$or':_[_0x1bc1('0x41')](_0x12854b[_0x1bc1('0x4b')],function(_0x467d5a){var _0x108268={};_0x108268[_0x467d5a]={'$like':'%'+_0x213861['query'][_0x1bc1('0x52')]+'%'};return _0x108268;})});}if(_0x213861[_0x1bc1('0x47')][_0x1bc1('0xa7')]){var _0x5af7ee=_0x213861['query']['$gte']['split'](',');var _0x1d0dbe={};_0x1d0dbe[_0x5af7ee[0x0]]={'$gte':moment(_0x5af7ee[0x1])[_0x1bc1('0xa8')](_0x1bc1('0xa9'))};_0x12854b[_0x1bc1('0x6a')]=_[_0x1bc1('0x54')](_0x12854b['where'],_0x1d0dbe);}_0x12854b=_[_0x1bc1('0x54')]({},_0x12854b,_0x213861[_0x1bc1('0x55')]);return db[_0x1bc1('0xa6')][_0x1bc1('0x31')]({'where':_0x12854b[_0x1bc1('0x6a')]})[_0x1bc1('0x38')](function(_0x5df4db){_0x3a1768[_0x1bc1('0x31')]=_0x5df4db;if(_0x213861['query'][_0x1bc1('0x56')]){_0x12854b[_0x1bc1('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x1bc1('0x6c')](_0x12854b);})[_0x1bc1('0x38')](function(_0x395795){_0x3a1768['rows']=_0x395795;return _0x3a1768;});}})[_0x1bc1('0x38')](respondWithFilteredResult(_0x57d9f2,_0x12854b))['catch'](handleError(_0x57d9f2,null));};exports[_0x1bc1('0x8a')]=function(_0x1e1b1a,_0x50ab9c,_0x29e1d5){var _0x50f760,_0x20d2e8={},_0x325b99;if(_0x1e1b1a[_0x1bc1('0x5c')]['to']){_0x325b99=_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0];}return db['FaxAccount'][_0x1bc1('0x5a')]({'where':{'id':_0x1e1b1a[_0x1bc1('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x1bc1('0xaa'),'include':[{'model':db[_0x1bc1('0x77')],'as':_0x1bc1('0xab'),'where':{'fax':_0x325b99},'limit':0x1,'order':[[_0x1bc1('0xa2'),_0x1bc1('0xac')]]}]}]})[_0x1bc1('0x38')](handleEntityNotFound(_0x50ab9c,null))[_0x1bc1('0x38')](function(_0x4aa19f){_0x50f760=_0x4aa19f;if(_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')]&&_0x1e1b1a[_0x1bc1('0x5c')]['attachments'][_0x1bc1('0x4d')]){for(var _0xa23582=0x0;_0xa23582<_0x1e1b1a[_0x1bc1('0x5c')]['attachments'][_0x1bc1('0x4d')];_0xa23582+=0x1){_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][_0xa23582]={'filename':_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][_0xa23582][_0x1bc1('0x3d')],'id':_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][_0xa23582]['id'],'path':path[_0x1bc1('0xae')](config[_0x1bc1('0xaf')],_0x1bc1('0xb0'),_0x1e1b1a[_0x1bc1('0x5c')]['attachments'][_0xa23582][_0x1bc1('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend',_0x1bc1('0xb2'),{'FaxAccountId':_[_0x1bc1('0xb3')](_0x1e1b1a[_0x1bc1('0x59')]['id'])?undefined:_0x1e1b1a[_0x1bc1('0x59')]['id'],'path':_[_0x1bc1('0xb3')](_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0]['path'])?undefined:_0x1e1b1a['body'][_0x1bc1('0xad')][0x0][_0x1bc1('0x8')],'fax':_[_0x1bc1('0xb3')](_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0])?undefined:_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x50f760){if(_[_0x1bc1('0xb3')](_0x1e1b1a[_0x1bc1('0x5c')]['from'])){_0x1e1b1a['body'][_0x1bc1('0xb4')]=util[_0x1bc1('0xa8')](_0x1bc1('0xb5'),_0x50f760['name'],_0x50f760[_0x1bc1('0xb6')]);}if(_0x50f760[_0x1bc1('0xaa')]){if(_0x50f760[_0x1bc1('0xaa')]['Contacts'][_0x1bc1('0x4d')]){return _0x50f760[_0x1bc1('0xaa')][_0x1bc1('0xab')][0x0];}else{return db[_0x1bc1('0x77')][_0x1bc1('0x5b')](_['defaults'](_0x1e1b1a[_0x1bc1('0x5c')],{'firstName':_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0],'phone':_0x1e1b1a['body']['to'][0x0],'fax':_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0],'ListId':_0x50f760[_0x1bc1('0xa4')]}));}}else{throw new Error(_0x1bc1('0xb7'));}}else{throw new Error(_0x1bc1('0xb8'));}})[_0x1bc1('0x38')](function(_0x54e288){if(_0x54e288){return db[_0x1bc1('0x73')][_0x1bc1('0x5a')]({'where':{'ContactId':_0x54e288['id'],'closed':![],'FaxAccountId':_0x50f760['id']}})[_0x1bc1('0x38')](function(_0x1c2ed6){if(_0x1c2ed6){return[_0x1c2ed6,![]];}return db[_0x1bc1('0x73')][_0x1bc1('0x5b')]({'UserId':_0x1e1b1a[_0x1bc1('0x5d')]['id'],'ContactId':_0x54e288['id'],'FaxAccountId':_0x50f760['id'],'fax':_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1bc1('0x54')](_0x1e1b1a['body'],{'read':![],'body':_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0][_0x1bc1('0xb9')],'FaxAccountId':_0x50f760['id'],'UserId':_0x1e1b1a[_0x1bc1('0x5d')]['id'],'ContactId':_0x54e288['id'],'AttachmentId':_0x1e1b1a['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1bc1('0xba')}]})['then'](function(_0x504a27){return[_0x504a27,!![]];});});}else{throw new Error(_0x1bc1('0xbb'));}})[_0x1bc1('0xbc')](function(_0x27f344,_0x32d5ea){if(_0x32d5ea){return _0x27f344;}return db[_0x1bc1('0xa6')]['create']({'direction':'out','read':![],'body':_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0][_0x1bc1('0xb9')],'FaxAccountId':_0x50f760['id'],'FaxInteractionId':_0x27f344['id'],'UserId':_0x1e1b1a['user']['id'],'ContactId':_0x27f344[_0x1bc1('0xbd')],'AttachmentId':_0x1e1b1a[_0x1bc1('0x5c')]['attachments'][0x0]['id']})['then'](function(_0x38f223){_0x27f344['dataValues'][_0x1bc1('0xba')]=[];_0x27f344[_0x1bc1('0xbe')][_0x1bc1('0xba')]['push'](_0x38f223[_0x1bc1('0xbe')]);return _0x27f344;});})[_0x1bc1('0x38')](function(_0x367793){respondWithRpcPromise(_0x1bc1('0xbf'),_0x1bc1('0xbf'),{'FaxAccountId':_[_0x1bc1('0xb3')](_0x1e1b1a[_0x1bc1('0x59')]['id'])?undefined:_0x1e1b1a['params']['id'],'path':_['isNil'](_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0][_0x1bc1('0x8')])?undefined:_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0][_0x1bc1('0x8')],'fax':_['isNil'](_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0])?undefined:_0x1e1b1a[_0x1bc1('0x5c')]['to'][0x0],'AttachmentId':_0x1e1b1a[_0x1bc1('0x5c')][_0x1bc1('0xad')][0x0]['id']},client9002)['then'](function(_0x3dd7f0){logger['info'](_0x1bc1('0xc0'),_0x3dd7f0);})[_0x1bc1('0x2a')](function(_0x181726){logger[_0x1bc1('0x21')](_0x1bc1('0xc0'),_0x181726);});return _0x367793;})[_0x1bc1('0x38')](respondWithResult(_0x50ab9c,null))[_0x1bc1('0x2a')](handleError(_0x50ab9c,null));};exports[_0x1bc1('0xc1')]=function(_0x68bbde,_0x38f6f0,_0x322def){return db['FaxAccount'][_0x1bc1('0x5a')]({'where':{'id':_0x68bbde[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x38f6f0,null))[_0x1bc1('0x38')](function(_0x1e80ce){if(_0x1e80ce){return _0x1e80ce[_0x1bc1('0xc1')](_0x68bbde[_0x1bc1('0x5c')][_0x1bc1('0x74')],_[_0x1bc1('0x75')](_0x68bbde[_0x1bc1('0x5c')],[_0x1bc1('0x74'),'id'])||{})['spread'](function(_0x1b394e){for(var _0x2ec3d3=0x0;_0x2ec3d3<_0x68bbde[_0x1bc1('0x5c')][_0x1bc1('0x74')][_0x1bc1('0x4d')];_0x2ec3d3+=0x1){socket[_0x1bc1('0xc2')](_0x1bc1('0xc3'),{'UserId':Number(_0x68bbde['body'][_0x1bc1('0x74')][_0x2ec3d3]),'FaxAccountId':Number(_0x68bbde['params']['id'])});}return _0x1b394e;});}})[_0x1bc1('0x38')](respondWithResult(_0x38f6f0,null))['catch'](handleError(_0x38f6f0,null));};exports[_0x1bc1('0xc4')]=function(_0x8bb560,_0x24025e,_0x16d93e){return db[_0x1bc1('0x42')]['find']({'where':{'id':_0x8bb560[_0x1bc1('0x59')]['id']}})[_0x1bc1('0x38')](handleEntityNotFound(_0x24025e,null))[_0x1bc1('0x38')](function(_0x482cdc){if(_0x482cdc){return _0x482cdc[_0x1bc1('0xc4')](_0x8bb560[_0x1bc1('0x47')][_0x1bc1('0x74')])[_0x1bc1('0x38')](function(){if(_['isArray'](_0x8bb560[_0x1bc1('0x47')]['ids'])){for(var _0x18a7e4=0x0;_0x18a7e4<_0x8bb560[_0x1bc1('0x47')][_0x1bc1('0x74')][_0x1bc1('0x4d')];_0x18a7e4+=0x1){socket[_0x1bc1('0xc2')](_0x1bc1('0xc5'),{'UserId':Number(_0x8bb560[_0x1bc1('0x47')]['ids'][_0x18a7e4]),'FaxAccountId':Number(_0x8bb560[_0x1bc1('0x59')]['id'])});}}else{socket[_0x1bc1('0xc2')](_0x1bc1('0xc5'),{'UserId':Number(_0x8bb560[_0x1bc1('0x47')][_0x1bc1('0x74')]),'FaxAccountId':Number(_0x8bb560['params']['id'])});}});}})['then'](respondWithStatusCode(_0x24025e,null))['catch'](handleError(_0x24025e,null));};exports[_0x1bc1('0xc6')]=function(_0x227585,_0x3ba793,_0x56a20f){var _0x52c84a={};var _0xd3ec8d={};var _0x14c557;var _0x4124e5;return db[_0x1bc1('0x42')]['findOne']({'where':{'id':_0x227585[_0x1bc1('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ba793,null))[_0x1bc1('0x38')](function(_0x154d46){if(_0x154d46){_0x14c557=_0x154d46;_0xd3ec8d[_0x1bc1('0x46')]=_[_0x1bc1('0x48')](db[_0x1bc1('0x79')][_0x1bc1('0x43')]);_0xd3ec8d[_0x1bc1('0x47')]=_[_0x1bc1('0x48')](_0x227585[_0x1bc1('0x47')]);_0xd3ec8d[_0x1bc1('0x49')]=_[_0x1bc1('0x4a')](_0xd3ec8d['model'],_0xd3ec8d[_0x1bc1('0x47')]);_0x52c84a[_0x1bc1('0x4b')]=_[_0x1bc1('0x4a')](_0xd3ec8d[_0x1bc1('0x46')],qs['fields'](_0x227585[_0x1bc1('0x47')]['fields']));_0x52c84a['attributes']=_0x52c84a[_0x1bc1('0x4b')]['length']?_0x52c84a[_0x1bc1('0x4b')]:_0xd3ec8d[_0x1bc1('0x46')];_0x52c84a['order']=qs['sort'](_0x227585[_0x1bc1('0x47')]['sort']);_0x52c84a[_0x1bc1('0x6a')]=qs['filters'](_[_0x1bc1('0x51')](_0x227585[_0x1bc1('0x47')],_0xd3ec8d[_0x1bc1('0x49')]));if(_0x227585['query']['filter']){_0x52c84a[_0x1bc1('0x6a')]=_['merge'](_0x52c84a[_0x1bc1('0x6a')],{'$or':_[_0x1bc1('0x41')](_0x52c84a[_0x1bc1('0x4b')],function(_0x5637c7){var _0x4dbb24={};_0x4dbb24[_0x5637c7]={'$like':'%'+_0x227585[_0x1bc1('0x47')][_0x1bc1('0x52')]+'%'};return _0x4dbb24;})});}_0x52c84a=_['merge']({},_0x52c84a,_0x227585[_0x1bc1('0x55')]);return _0x14c557[_0x1bc1('0xc6')](_0x52c84a);}})['then'](function(_0x327bd5){if(_0x327bd5){_0x4124e5=_0x327bd5[_0x1bc1('0x4d')];if(!_0x227585['query'][_0x1bc1('0x4e')](_0x1bc1('0x4f'))){_0x52c84a[_0x1bc1('0x30')]=qs[_0x1bc1('0x30')](_0x227585[_0x1bc1('0x47')][_0x1bc1('0x30')]);_0x52c84a[_0x1bc1('0x2e')]=qs['offset'](_0x227585[_0x1bc1('0x47')][_0x1bc1('0x2e')]);}return _0x14c557[_0x1bc1('0xc6')](_0x52c84a);}})['then'](function(_0x3c8c9f){if(_0x3c8c9f){return _0x3c8c9f?{'count':_0x4124e5,'rows':_0x3c8c9f}:null;}})[_0x1bc1('0x38')](respondWithResult(_0x3ba793,null))[_0x1bc1('0x2a')](handleError(_0x3ba793,null));}; \ No newline at end of file +var _0xf204=['debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','FaxAccountId','Disposition','create','getDispositions','findOne','length','options','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','transaction','sequelize','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','json','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','updatedAt','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','spread','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf204,0x167));var _0x4f20=function(_0x2e12b8,_0xdb92fe){_0x2e12b8=_0x2e12b8-0x0;var _0x2f1213=_0xf204[_0x2e12b8];return _0x2f1213;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f20('0x0'));var zipdir=require(_0x4f20('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f20('0x2'));var moment=require(_0x4f20('0x3'));var BPromise=require(_0x4f20('0x4'));var Mustache=require(_0x4f20('0x5'));var util=require(_0x4f20('0x6'));var path=require('path');var sox=require(_0x4f20('0x7'));var csv=require('to-csv');var ejs=require(_0x4f20('0x8'));var fs=require('fs');var fs_extra=require(_0x4f20('0x9'));var _=require('lodash');var squel=require(_0x4f20('0xa'));var crypto=require(_0x4f20('0xb'));var jsforce=require(_0x4f20('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f20('0xd'));var querystring=require(_0x4f20('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f20('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4f20('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f20('0x11'))(_0x4f20('0x12'));var utils=require('../../config/utils');var config=require(_0x4f20('0x13'));var licenseUtil=require(_0x4f20('0x14'));var db=require(_0x4f20('0x15'))['db'];config[_0x4f20('0x16')]=_[_0x4f20('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f20('0x18'))(new Redis(config[_0x4f20('0x16')]));require(_0x4f20('0x19'))['register'](socket);var jayson=require(_0x4f20('0x1a'));var client=jayson[_0x4f20('0x1b')][_0x4f20('0x1c')]({'port':0x232c});var client9002=jayson[_0x4f20('0x1b')][_0x4f20('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x10f131,_0xc584d1,_0x5f0352,_0x26745e){return new BPromise(function(_0x25b799,_0x93f5a5){var _0x284839=_0x26745e||client;return _0x284839[_0x4f20('0x1d')](_0x10f131,_0x5f0352)[_0x4f20('0x1e')](function(_0x5bc149){logger[_0x4f20('0x1f')](_0x4f20('0x20'),_0xc584d1,'request\x20sent');logger[_0x4f20('0x21')](_0x4f20('0x22'),_0xc584d1,_0x4f20('0x23'),JSON['stringify'](_0x5bc149));if(_0x5bc149[_0x4f20('0x24')]){if(_0x5bc149['error']['code']===0x1f4){logger['error'](_0x4f20('0x20'),_0xc584d1,_0x5bc149['error']['message']);return _0x93f5a5(_0x5bc149[_0x4f20('0x24')][_0x4f20('0x25')]);}logger['error'](_0x4f20('0x20'),_0xc584d1,_0x5bc149[_0x4f20('0x24')][_0x4f20('0x25')]);return _0x25b799(_0x5bc149[_0x4f20('0x24')][_0x4f20('0x25')]);}else{logger[_0x4f20('0x1f')](_0x4f20('0x20'),_0xc584d1,'request\x20sent');_0x25b799(_0x5bc149[_0x4f20('0x26')][_0x4f20('0x25')]);}})[_0x4f20('0x27')](function(_0x7aa932){logger[_0x4f20('0x24')]('FaxAccount,\x20%s,\x20%s',_0xc584d1,_0x7aa932);_0x93f5a5(_0x7aa932);});});}function respondWithStatusCode(_0x528ae0,_0x3ced62){_0x3ced62=_0x3ced62||0xcc;return function(_0x54a4d7){if(_0x54a4d7){return _0x528ae0[_0x4f20('0x28')](_0x3ced62);}return _0x528ae0[_0x4f20('0x29')](_0x3ced62)[_0x4f20('0x2a')]();};}function respondWithResult(_0x153028,_0x3f7ed1){_0x3f7ed1=_0x3f7ed1||0xc8;return function(_0x3996c4){if(_0x3996c4){return _0x153028[_0x4f20('0x29')](_0x3f7ed1)['json'](_0x3996c4);}};}function respondWithFilteredResult(_0x245cac,_0x2adcfa){return function(_0x3d07b1){if(_0x3d07b1){var _0x2fcc6b=typeof _0x2adcfa[_0x4f20('0x2b')]===_0x4f20('0x2c')&&typeof _0x2adcfa[_0x4f20('0x2d')]===_0x4f20('0x2c');var _0x34ca6d=_0x3d07b1[_0x4f20('0x2e')];var _0x124bd6=_0x2fcc6b?0x0:_0x2adcfa[_0x4f20('0x2b')];var _0x4a7137=_0x2fcc6b?_0x3d07b1['count']:_0x2adcfa[_0x4f20('0x2b')]+_0x2adcfa[_0x4f20('0x2d')];var _0x1a7f4f;if(_0x4a7137>=_0x34ca6d){_0x4a7137=_0x34ca6d;_0x1a7f4f=0xc8;}else{_0x1a7f4f=0xce;}_0x245cac[_0x4f20('0x29')](_0x1a7f4f);return _0x245cac['set'](_0x4f20('0x2f'),_0x124bd6+'-'+_0x4a7137+'/'+_0x34ca6d)['json'](_0x3d07b1);}return null;};}function patchUpdates(_0x2a84dc){return function(_0xaec4a3){try{jsonpatch[_0x4f20('0x30')](_0xaec4a3,_0x2a84dc,!![]);}catch(_0x339446){return BPromise[_0x4f20('0x31')](_0x339446);}return _0xaec4a3[_0x4f20('0x32')]();};}function saveUpdates(_0x493525,_0x53ae8f){return function(_0x5803cf){if(_0x5803cf){return _0x5803cf[_0x4f20('0x33')](_0x493525)[_0x4f20('0x1e')](function(_0xaa889c){return _0xaa889c;});}return null;};}function removeEntity(_0x209e3d,_0xe08da7){return function(_0x53ee67){if(_0x53ee67){return _0x53ee67[_0x4f20('0x34')]()['then'](function(){var _0x26ed27=_0x53ee67[_0x4f20('0x35')]({'plain':!![]});var _0x5208ed=_0x4f20('0x36');return db[_0x4f20('0x37')][_0x4f20('0x34')]({'where':{'type':_0x5208ed,'resourceId':_0x26ed27['id']}})['then'](function(){return _0x53ee67;});})[_0x4f20('0x1e')](function(){_0x209e3d[_0x4f20('0x29')](0xcc)[_0x4f20('0x2a')]();});}};}function handleEntityNotFound(_0x4042b5,_0x1a21cd){return function(_0x1effcf){if(!_0x1effcf){_0x4042b5[_0x4f20('0x28')](0x194);}return _0x1effcf;};}function handleError(_0x3e5c55,_0x3d1860){_0x3d1860=_0x3d1860||0x1f4;return function(_0x205014){logger[_0x4f20('0x24')](_0x205014[_0x4f20('0x38')]);if(_0x205014[_0x4f20('0x39')]){delete _0x205014[_0x4f20('0x39')];}_0x3e5c55[_0x4f20('0x29')](_0x3d1860)['send'](_0x205014);};}exports['index']=function(_0x281689,_0x52c01f){var _0x3ab3bc={'include':[{'model':db[_0x4f20('0x3a')],'as':_0x4f20('0x3b')}]},_0x3a1ff2={},_0xb7b0e={'count':0x0,'rows':[]};var _0x369767=_[_0x4f20('0x3c')](db[_0x4f20('0x3d')]['rawAttributes'],function(_0x274fd4){return{'name':_0x274fd4['fieldName'],'type':_0x274fd4[_0x4f20('0x3e')][_0x4f20('0x3f')]};});_0x3a1ff2[_0x4f20('0x40')]=_[_0x4f20('0x3c')](_0x369767,_0x4f20('0x39'));_0x3a1ff2[_0x4f20('0x41')]=_[_0x4f20('0x42')](_0x281689[_0x4f20('0x41')]);_0x3a1ff2[_0x4f20('0x43')]=_['intersection'](_0x3a1ff2[_0x4f20('0x40')],_0x3a1ff2[_0x4f20('0x41')]);_0x3ab3bc[_0x4f20('0x44')]=_[_0x4f20('0x45')](_0x3a1ff2[_0x4f20('0x40')],qs['fields'](_0x281689['query'][_0x4f20('0x46')]));_0x3ab3bc['attributes']=_0x3ab3bc['attributes']['length']?_0x3ab3bc[_0x4f20('0x44')]:_0x3a1ff2[_0x4f20('0x40')];if(!_0x281689[_0x4f20('0x41')][_0x4f20('0x47')](_0x4f20('0x48'))){_0x3ab3bc['limit']=qs[_0x4f20('0x2d')](_0x281689[_0x4f20('0x41')][_0x4f20('0x2d')]);_0x3ab3bc['offset']=qs['offset'](_0x281689[_0x4f20('0x41')]['offset']);}_0x3ab3bc[_0x4f20('0x49')]=qs[_0x4f20('0x4a')](_0x281689[_0x4f20('0x41')]['sort']);_0x3ab3bc[_0x4f20('0x4b')]=qs[_0x4f20('0x43')](_[_0x4f20('0x4c')](_0x281689[_0x4f20('0x41')],_0x3a1ff2['filters']),_0x369767);if(_0x281689[_0x4f20('0x41')][_0x4f20('0x4d')]){_0x3ab3bc['where']=_[_0x4f20('0x4e')](_0x3ab3bc[_0x4f20('0x4b')],{'$or':_[_0x4f20('0x3c')](_0x369767,function(_0x1ac4bf){if(_0x1ac4bf[_0x4f20('0x3e')]!==_0x4f20('0x4f')){var _0x350687={};_0x350687[_0x1ac4bf[_0x4f20('0x39')]]={'$like':'%'+_0x281689['query'][_0x4f20('0x4d')]+'%'};return _0x350687;}})});}_0x3ab3bc=_['merge']({},_0x3ab3bc,_0x281689['options']);var _0x2b3555={'where':_0x3ab3bc[_0x4f20('0x4b')]};return db['FaxAccount']['count'](_0x2b3555)[_0x4f20('0x1e')](function(_0x5ca11e){_0xb7b0e['count']=_0x5ca11e;if(_0x281689['query']['includeAll']){_0x3ab3bc[_0x4f20('0x50')]=[{'all':!![]}];}return db['FaxAccount'][_0x4f20('0x51')](_0x3ab3bc);})[_0x4f20('0x1e')](function(_0x3a45e1){_0xb7b0e[_0x4f20('0x52')]=_0x3a45e1;return _0xb7b0e;})[_0x4f20('0x1e')](respondWithFilteredResult(_0x52c01f,_0x3ab3bc))[_0x4f20('0x27')](handleError(_0x52c01f,null));};exports[_0x4f20('0x53')]=function(_0x4911f0,_0xce99df){var _0x1b5b22={'raw':![],'where':{'id':_0x4911f0[_0x4f20('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4c6011={};_0x4c6011[_0x4f20('0x40')]=_[_0x4f20('0x42')](db[_0x4f20('0x3d')][_0x4f20('0x55')]);_0x4c6011[_0x4f20('0x41')]=_['keys'](_0x4911f0['query']);_0x4c6011[_0x4f20('0x43')]=_[_0x4f20('0x45')](_0x4c6011[_0x4f20('0x40')],_0x4c6011[_0x4f20('0x41')]);_0x1b5b22[_0x4f20('0x44')]=_['intersection'](_0x4c6011[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x4911f0['query'][_0x4f20('0x46')]));_0x1b5b22[_0x4f20('0x44')]=_0x1b5b22['attributes']['length']?_0x1b5b22[_0x4f20('0x44')]:_0x4c6011[_0x4f20('0x40')];if(_0x4911f0[_0x4f20('0x41')]['includeAll']){_0x1b5b22[_0x4f20('0x50')]=[{'all':!![]}];}_0x1b5b22=_['merge']({},_0x1b5b22,_0x4911f0['options']);return db['FaxAccount'][_0x4f20('0x56')](_0x1b5b22)[_0x4f20('0x1e')](handleEntityNotFound(_0xce99df,null))[_0x4f20('0x1e')](respondWithResult(_0xce99df,null))[_0x4f20('0x27')](handleError(_0xce99df,null));};exports['create']=function(_0x4a2460,_0x3d7dc8){return db[_0x4f20('0x3d')]['create'](_0x4a2460['body'],{})[_0x4f20('0x1e')](function(_0x405d8c){var _0x1712d6=_0x4a2460[_0x4f20('0x57')][_0x4f20('0x35')]({'plain':!![]});if(!_0x1712d6)throw new Error(_0x4f20('0x58'));if(_0x1712d6[_0x4f20('0x59')]===_0x4f20('0x57')){var _0x58f90b=_0x405d8c[_0x4f20('0x35')]({'plain':!![]});var _0x39dcb0='FaxAccounts';return db[_0x4f20('0x5a')]['find']({'where':{'name':_0x39dcb0,'userProfileId':_0x1712d6[_0x4f20('0x5b')]},'raw':!![]})[_0x4f20('0x1e')](function(_0x44794f){if(_0x44794f&&_0x44794f[_0x4f20('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x58f90b['name'],'resourceId':_0x58f90b['id'],'type':_0x44794f[_0x4f20('0x39')],'sectionId':_0x44794f['id']},{})['then'](function(){return _0x405d8c;});}else{return _0x405d8c;}})[_0x4f20('0x27')](function(_0x41df92){logger[_0x4f20('0x24')](_0x4f20('0x5d'),_0x41df92);throw _0x41df92;});}return _0x405d8c;})[_0x4f20('0x1e')](respondWithResult(_0x3d7dc8,0xc9))[_0x4f20('0x27')](handleError(_0x3d7dc8,null));};exports['update']=function(_0x395d2c,_0x14e0bc){if(_0x395d2c[_0x4f20('0x5e')]['id']){delete _0x395d2c['body']['id'];}return db[_0x4f20('0x3d')]['find']({'where':{'id':_0x395d2c[_0x4f20('0x54')]['id']},'include':[{'model':db[_0x4f20('0x3a')],'as':_0x4f20('0x3b')}]})[_0x4f20('0x1e')](handleEntityNotFound(_0x14e0bc,null))[_0x4f20('0x1e')](saveUpdates(_0x395d2c[_0x4f20('0x5e')],null))[_0x4f20('0x1e')](respondWithResult(_0x14e0bc,null))[_0x4f20('0x27')](handleError(_0x14e0bc,null));};exports[_0x4f20('0x34')]=function(_0x9aa453,_0xcc954e){return db[_0x4f20('0x3d')][_0x4f20('0x56')]({'where':{'id':_0x9aa453[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0xcc954e,null))[_0x4f20('0x1e')](removeEntity(_0xcc954e,null))['catch'](handleError(_0xcc954e,null));};exports['describe']=function(_0x42c73e,_0x383040){return db[_0x4f20('0x3d')]['describe']()[_0x4f20('0x1e')](respondWithResult(_0x383040,null))['catch'](handleError(_0x383040,null));};exports['addDisposition']=function(_0x91b6ac,_0x14fecd,_0x12b396){if(_0x91b6ac[_0x4f20('0x5e')]['id']){delete _0x91b6ac['body']['id'];}return db[_0x4f20('0x3d')][_0x4f20('0x56')]({'where':{'id':_0x91b6ac[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x14fecd,null))[_0x4f20('0x1e')](function(_0xe14e96){if(_0xe14e96){_0x91b6ac[_0x4f20('0x5e')][_0x4f20('0x5f')]=_0xe14e96['id'];return db[_0x4f20('0x60')][_0x4f20('0x61')](_0x91b6ac['body']);}})[_0x4f20('0x1e')](respondWithResult(_0x14fecd,null))['catch'](handleError(_0x14fecd,null));};exports[_0x4f20('0x62')]=function(_0x4df427,_0x4480f4,_0x10738c){var _0x101949={'raw':![],'where':{}};var _0x3e0f64={};var _0x31cae6={'count':0x0,'rows':[]};return db[_0x4f20('0x3d')][_0x4f20('0x63')]({'where':{'id':_0x4df427[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x4480f4,null))[_0x4f20('0x1e')](function(_0x431e81){if(_0x431e81){_0x3e0f64[_0x4f20('0x40')]=_[_0x4f20('0x42')](db['Disposition']['rawAttributes']);_0x3e0f64[_0x4f20('0x41')]=_[_0x4f20('0x42')](_0x4df427[_0x4f20('0x41')]);_0x3e0f64[_0x4f20('0x43')]=_[_0x4f20('0x45')](_0x3e0f64['model'],_0x3e0f64['query']);_0x101949[_0x4f20('0x44')]=_[_0x4f20('0x45')](_0x3e0f64[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x4df427['query'][_0x4f20('0x46')]));_0x101949['attributes']=_0x101949[_0x4f20('0x44')][_0x4f20('0x64')]?_0x101949[_0x4f20('0x44')]:_0x3e0f64[_0x4f20('0x40')];if(!_0x4df427[_0x4f20('0x41')][_0x4f20('0x47')](_0x4f20('0x48'))){_0x101949[_0x4f20('0x2d')]=qs['limit'](_0x4df427[_0x4f20('0x41')][_0x4f20('0x2d')]);_0x101949[_0x4f20('0x2b')]=qs[_0x4f20('0x2b')](_0x4df427[_0x4f20('0x41')]['offset']);}_0x101949[_0x4f20('0x49')]=qs['sort'](_0x4df427[_0x4f20('0x41')]['sort']);_0x101949['where']=qs[_0x4f20('0x43')](_[_0x4f20('0x4c')](_0x4df427[_0x4f20('0x41')],_0x3e0f64[_0x4f20('0x43')]));_0x101949['where'][_0x4f20('0x5f')]=_0x431e81['id'];if(_0x4df427[_0x4f20('0x41')]['filter']){_0x101949['where']=_[_0x4f20('0x4e')](_0x101949['where'],{'$or':_['map'](_0x101949['attributes'],function(_0x7dc56d){var _0x41bf82={};_0x41bf82[_0x7dc56d]={'$like':'%'+_0x4df427[_0x4f20('0x41')][_0x4f20('0x4d')]+'%'};return _0x41bf82;})});}_0x101949=_[_0x4f20('0x4e')]({},_0x101949,_0x4df427[_0x4f20('0x65')]);return db['Disposition'][_0x4f20('0x2e')]({'where':_0x101949[_0x4f20('0x4b')]})[_0x4f20('0x1e')](function(_0x56ee8e){_0x31cae6[_0x4f20('0x2e')]=_0x56ee8e;if(_0x4df427[_0x4f20('0x41')][_0x4f20('0x66')]){_0x101949['include']=[{'all':!![]}];}return db['Disposition'][_0x4f20('0x51')](_0x101949);})[_0x4f20('0x1e')](function(_0x2fb5d2){_0x31cae6[_0x4f20('0x52')]=_0x2fb5d2;return _0x31cae6;});}})[_0x4f20('0x1e')](respondWithFilteredResult(_0x4480f4,_0x101949))[_0x4f20('0x27')](handleError(_0x4480f4,null));};exports[_0x4f20('0x67')]=function(_0x34a8c7,_0x3a9259,_0x3c9756){return db['FaxAccount'][_0x4f20('0x56')]({'where':{'id':_0x34a8c7[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x3a9259,null))[_0x4f20('0x1e')](function(_0x5cc2ef){if(_0x5cc2ef){return _0x5cc2ef[_0x4f20('0x67')](_0x34a8c7[_0x4f20('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x3a9259,null))[_0x4f20('0x27')](handleError(_0x3a9259,null));};exports[_0x4f20('0x68')]=function(_0x34bdef,_0x71aefe,_0x1a71c8){if(_0x34bdef['body']['id']){delete _0x34bdef[_0x4f20('0x5e')]['id'];}return db[_0x4f20('0x3d')][_0x4f20('0x56')]({'where':{'id':_0x34bdef[_0x4f20('0x54')]['id']}})['then'](handleEntityNotFound(_0x71aefe,null))[_0x4f20('0x1e')](function(_0x1c158a){if(_0x1c158a){_0x34bdef[_0x4f20('0x5e')]['FaxAccountId']=_0x1c158a['id'];return db[_0x4f20('0x69')][_0x4f20('0x61')](_0x34bdef[_0x4f20('0x5e')]);}})['then'](respondWithResult(_0x71aefe,null))['catch'](handleError(_0x71aefe,null));};exports[_0x4f20('0x6a')]=function(_0x175d3d,_0x6dea82,_0x3ae57e){var _0x2b7bae={'raw':![],'where':{}};var _0xcd87fc={};var _0xea2ea7={'count':0x0,'rows':[]};return db[_0x4f20('0x3d')][_0x4f20('0x63')]({'where':{'id':_0x175d3d['params']['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x6dea82,null))[_0x4f20('0x1e')](function(_0x519f79){if(_0x519f79){_0xcd87fc[_0x4f20('0x40')]=_[_0x4f20('0x42')](db[_0x4f20('0x69')]['rawAttributes']);_0xcd87fc[_0x4f20('0x41')]=_[_0x4f20('0x42')](_0x175d3d[_0x4f20('0x41')]);_0xcd87fc[_0x4f20('0x43')]=_[_0x4f20('0x45')](_0xcd87fc['model'],_0xcd87fc[_0x4f20('0x41')]);_0x2b7bae[_0x4f20('0x44')]=_[_0x4f20('0x45')](_0xcd87fc[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x175d3d['query'][_0x4f20('0x46')]));_0x2b7bae['attributes']=_0x2b7bae[_0x4f20('0x44')][_0x4f20('0x64')]?_0x2b7bae[_0x4f20('0x44')]:_0xcd87fc[_0x4f20('0x40')];if(!_0x175d3d[_0x4f20('0x41')][_0x4f20('0x47')]('nolimit')){_0x2b7bae[_0x4f20('0x2d')]=qs[_0x4f20('0x2d')](_0x175d3d[_0x4f20('0x41')]['limit']);_0x2b7bae[_0x4f20('0x2b')]=qs[_0x4f20('0x2b')](_0x175d3d['query'][_0x4f20('0x2b')]);}_0x2b7bae['order']=qs[_0x4f20('0x4a')](_0x175d3d[_0x4f20('0x41')]['sort']);_0x2b7bae[_0x4f20('0x4b')]=qs[_0x4f20('0x43')](_[_0x4f20('0x4c')](_0x175d3d['query'],_0xcd87fc[_0x4f20('0x43')]));_0x2b7bae[_0x4f20('0x4b')][_0x4f20('0x5f')]=_0x519f79['id'];if(_0x175d3d['query'][_0x4f20('0x4d')]){_0x2b7bae['where']=_['merge'](_0x2b7bae[_0x4f20('0x4b')],{'$or':_['map'](_0x2b7bae[_0x4f20('0x44')],function(_0x7b473a){var _0x35fc27={};_0x35fc27[_0x7b473a]={'$like':'%'+_0x175d3d[_0x4f20('0x41')][_0x4f20('0x4d')]+'%'};return _0x35fc27;})});}_0x2b7bae=_[_0x4f20('0x4e')]({},_0x2b7bae,_0x175d3d[_0x4f20('0x65')]);return db[_0x4f20('0x69')][_0x4f20('0x2e')]({'where':_0x2b7bae[_0x4f20('0x4b')]})[_0x4f20('0x1e')](function(_0x516a8f){_0xea2ea7[_0x4f20('0x2e')]=_0x516a8f;if(_0x175d3d[_0x4f20('0x41')][_0x4f20('0x66')]){_0x2b7bae[_0x4f20('0x50')]=[{'all':!![]}];}return db[_0x4f20('0x69')][_0x4f20('0x51')](_0x2b7bae);})[_0x4f20('0x1e')](function(_0x1b3f38){_0xea2ea7[_0x4f20('0x52')]=_0x1b3f38;return _0xea2ea7;});}})[_0x4f20('0x1e')](respondWithFilteredResult(_0x6dea82,_0x2b7bae))[_0x4f20('0x27')](handleError(_0x6dea82,null));};exports[_0x4f20('0x6b')]=function(_0x5ca77b,_0x12f865,_0x19f37c){return db[_0x4f20('0x3d')]['find']({'where':{'id':_0x5ca77b[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x12f865,null))['then'](function(_0x4089ca){if(_0x4089ca){return _0x4089ca['removeAnswers'](_0x5ca77b[_0x4f20('0x41')][_0x4f20('0x6c')]);}})[_0x4f20('0x1e')](respondWithStatusCode(_0x12f865,null))[_0x4f20('0x27')](handleError(_0x12f865,null));};exports[_0x4f20('0x6d')]=function(_0x5ec17d,_0x57d74f,_0x9dabb0){return db[_0x4f20('0x6e')][_0x4f20('0x56')]({'where':{'id':_0x5ec17d[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x57d74f,null))[_0x4f20('0x1e')](function(_0xb6e92c){if(_0xb6e92c){return _0xb6e92c[_0x4f20('0x6d')](_0x5ec17d['body'][_0x4f20('0x6c')],_[_0x4f20('0x6f')](_0x5ec17d[_0x4f20('0x5e')],[_0x4f20('0x6c'),'id'])||{});}})[_0x4f20('0x1e')](respondWithResult(_0x57d74f,null))[_0x4f20('0x27')](handleError(_0x57d74f,null));};exports[_0x4f20('0x70')]=function(_0x550e3f,_0x49e76c,_0x4a8e9a){var _0x5b5822={'raw':![],'where':{}};var _0x518d77={};var _0x416af1={'count':0x0,'rows':[]};return db[_0x4f20('0x3d')][_0x4f20('0x63')]({'where':{'id':_0x550e3f['params']['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x49e76c,null))[_0x4f20('0x1e')](function(_0x4e1677){if(_0x4e1677){_0x518d77[_0x4f20('0x40')]=_['keys'](db[_0x4f20('0x6e')][_0x4f20('0x55')]);_0x518d77[_0x4f20('0x41')]=_[_0x4f20('0x42')](_0x550e3f[_0x4f20('0x41')]);_0x518d77[_0x4f20('0x43')]=_[_0x4f20('0x45')](_0x518d77[_0x4f20('0x40')],_0x518d77[_0x4f20('0x41')]);_0x5b5822[_0x4f20('0x44')]=_[_0x4f20('0x45')](_0x518d77[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x550e3f['query'][_0x4f20('0x46')]));_0x5b5822[_0x4f20('0x44')]=_0x5b5822['attributes'][_0x4f20('0x64')]?_0x5b5822[_0x4f20('0x44')]:_0x518d77[_0x4f20('0x40')];if(!_0x550e3f[_0x4f20('0x41')][_0x4f20('0x47')](_0x4f20('0x48'))){_0x5b5822[_0x4f20('0x2d')]=qs[_0x4f20('0x2d')](_0x550e3f['query'][_0x4f20('0x2d')]);_0x5b5822[_0x4f20('0x2b')]=qs[_0x4f20('0x2b')](_0x550e3f[_0x4f20('0x41')][_0x4f20('0x2b')]);}_0x5b5822[_0x4f20('0x49')]=qs[_0x4f20('0x4a')](_0x550e3f[_0x4f20('0x41')][_0x4f20('0x4a')]);_0x5b5822[_0x4f20('0x4b')]=qs['filters'](_[_0x4f20('0x4c')](_0x550e3f[_0x4f20('0x41')],_0x518d77[_0x4f20('0x43')]));_0x5b5822['where']['FaxAccountId']=_0x4e1677['id'];if(_0x550e3f[_0x4f20('0x41')][_0x4f20('0x4d')]){_0x5b5822['where']=_[_0x4f20('0x4e')](_0x5b5822[_0x4f20('0x4b')],{'$or':_[_0x4f20('0x3c')](_0x5b5822[_0x4f20('0x44')],function(_0x15eb05){var _0x2454e9={};_0x2454e9[_0x15eb05]={'$like':'%'+_0x550e3f[_0x4f20('0x41')][_0x4f20('0x4d')]+'%'};return _0x2454e9;})});}_0x5b5822=_[_0x4f20('0x4e')]({},_0x5b5822,_0x550e3f[_0x4f20('0x65')]);return db[_0x4f20('0x6e')][_0x4f20('0x2e')]({'where':_0x5b5822[_0x4f20('0x4b')]})[_0x4f20('0x1e')](function(_0x39c395){_0x416af1[_0x4f20('0x2e')]=_0x39c395;if(_0x550e3f[_0x4f20('0x41')][_0x4f20('0x66')]){_0x5b5822[_0x4f20('0x50')]=[{'model':db[_0x4f20('0x71')],'as':_0x4f20('0x72'),'required':![]},{'model':db[_0x4f20('0x73')],'as':_0x4f20('0x74'),'attributes':[_0x4f20('0x39'),_0x4f20('0x75'),'internal'],'required':![]},{'model':db[_0x4f20('0x76')],'as':'Tags','attributes':['id',_0x4f20('0x39'),_0x4f20('0x77')],'where':_0x550e3f[_0x4f20('0x41')][_0x4f20('0x78')]?{'id':_0x550e3f[_0x4f20('0x41')][_0x4f20('0x78')]}:undefined,'required':_0x550e3f[_0x4f20('0x41')][_0x4f20('0x78')]?!![]:![]}];}return db[_0x4f20('0x6e')][_0x4f20('0x51')](_0x5b5822);})[_0x4f20('0x1e')](function(_0x540fdb){_0x416af1['rows']=_0x540fdb;return _0x416af1;});}})['then'](respondWithFilteredResult(_0x49e76c,_0x5b5822))['catch'](handleError(_0x49e76c,null));};exports[_0x4f20('0x79')]=function(_0x1e39f7,_0x141e79){var _0x1c8ce6=_0x1e39f7[_0x4f20('0x54')]['id'];var _0x105fca=_0x1e39f7[_0x4f20('0x5e')];var _0xb30c6d=0xc8;var _0x83682f=null;return db['sequelize'][_0x4f20('0x7a')]({'isolationLevel':db[_0x4f20('0x7b')]['Transaction']['ISOLATION_LEVELS'][_0x4f20('0x7c')]},function(_0x284e5e){return db[_0x4f20('0x3d')]['findOne']({'where':{'id':_0x1c8ce6},'transaction':_0x284e5e})[_0x4f20('0x1e')](function(_0x1502fc){if(_0x1502fc){return db[_0x4f20('0x7d')][_0x4f20('0x34')]({'where':{'FaxAccountId':_0x1c8ce6},'transaction':_0x284e5e})[_0x4f20('0x1e')](function(){var _0x58dac1=_['map'](_0x105fca,function(_0x533a36){_0x533a36[_0x4f20('0x5f')]=_0x1c8ce6;return _0x533a36;});return db[_0x4f20('0x7d')][_0x4f20('0x7e')](_0x58dac1,{'transaction':_0x284e5e});});}else{_0xb30c6d=0x194;_0x83682f=[];}});})[_0x4f20('0x1e')](function(){if(_0xb30c6d!==0x194){return db[_0x4f20('0x7d')][_0x4f20('0x7f')]({'where':{'FaxAccountId':_0x1c8ce6},'order':_0x4f20('0x80')})['then'](function(_0x358a61){_0x83682f=_0x358a61;});}})['catch'](function(_0x4a7773){_0xb30c6d=0x1f4;logger[_0x4f20('0x24')](_0x4a7773['stack']);if(_0x4a7773[_0x4f20('0x39')]){delete _0x4a7773[_0x4f20('0x39')];}_0x83682f=_0x4a7773;})[_0x4f20('0x81')](function(){if(_0x83682f===null){_0x141e79[_0x4f20('0x28')](_0xb30c6d);}else{if(_0xb30c6d===0x1f4){_0x141e79[_0x4f20('0x29')](_0xb30c6d)[_0x4f20('0x82')](_0x83682f);}else{_0x141e79['status'](_0xb30c6d)[_0x4f20('0x83')](_0x83682f);}}});};exports[_0x4f20('0x84')]=function(_0x30030a,_0x58b76a,_0x3e0eb3){var _0x353097={};var _0x4aee4f={};var _0x4f6d7b;var _0x107961;return db[_0x4f20('0x3d')][_0x4f20('0x63')]({'where':{'id':_0x30030a['params']['id']}})['then'](handleEntityNotFound(_0x58b76a,null))[_0x4f20('0x1e')](function(_0x5892aa){if(_0x5892aa){_0x4f6d7b=_0x5892aa;_0x4aee4f[_0x4f20('0x40')]=_['keys'](db[_0x4f20('0x7d')][_0x4f20('0x55')]);_0x4aee4f[_0x4f20('0x41')]=_[_0x4f20('0x42')](_0x30030a['query']);_0x4aee4f[_0x4f20('0x43')]=_['intersection'](_0x4aee4f[_0x4f20('0x40')],_0x4aee4f[_0x4f20('0x41')]);_0x353097['attributes']=_['intersection'](_0x4aee4f['model'],qs[_0x4f20('0x46')](_0x30030a[_0x4f20('0x41')]['fields']));_0x353097[_0x4f20('0x44')]=_0x353097[_0x4f20('0x44')][_0x4f20('0x64')]?_0x353097[_0x4f20('0x44')]:_0x4aee4f[_0x4f20('0x40')];_0x353097['order']=qs['sort'](_0x30030a[_0x4f20('0x41')][_0x4f20('0x4a')]);_0x353097[_0x4f20('0x4b')]=qs[_0x4f20('0x43')](_['pick'](_0x30030a[_0x4f20('0x41')],_0x4aee4f[_0x4f20('0x43')]));if(_0x30030a['query'][_0x4f20('0x4d')]){_0x353097[_0x4f20('0x4b')]=_['merge'](_0x353097[_0x4f20('0x4b')],{'$or':_[_0x4f20('0x3c')](_0x353097[_0x4f20('0x44')],function(_0x23a9b7){var _0x53f67e={};_0x53f67e[_0x23a9b7]={'$like':'%'+_0x30030a[_0x4f20('0x41')][_0x4f20('0x4d')]+'%'};return _0x53f67e;})});}_0x353097=_[_0x4f20('0x4e')]({},_0x353097,_0x30030a[_0x4f20('0x65')]);return _0x4f6d7b['getApplications'](_0x353097);}})['then'](function(_0x1c670d){if(_0x1c670d){_0x107961=_0x1c670d['length'];if(!_0x30030a[_0x4f20('0x41')][_0x4f20('0x47')](_0x4f20('0x48'))){_0x353097[_0x4f20('0x2d')]=qs['limit'](_0x30030a[_0x4f20('0x41')][_0x4f20('0x2d')]);_0x353097[_0x4f20('0x2b')]=qs[_0x4f20('0x2b')](_0x30030a[_0x4f20('0x41')][_0x4f20('0x2b')]);}return _0x4f6d7b[_0x4f20('0x84')](_0x353097);}})['then'](function(_0x3e5797){if(_0x3e5797){return _0x3e5797?{'count':_0x107961,'rows':_0x3e5797}:null;}})[_0x4f20('0x1e')](respondWithResult(_0x58b76a,null))[_0x4f20('0x27')](handleError(_0x58b76a,null));};function Extension(_0x588f84,_0x4e1a4d,_0x2f69ef,_0x178f6d){this[_0x4f20('0x85')]=_0x4f20('0x86');this[_0x4f20('0x87')]=_0x588f84[_0x4f20('0x88')];this[_0x4f20('0x89')]=_0x178f6d;this[_0x4f20('0x3e')]=_0x4f20('0x8a');this[_0x4f20('0x8b')]=_0x4f20('0x8c');this[_0x4f20('0x5f')]=_0x588f84['id'];this[_0x4f20('0x80')]=_0x4e1a4d;this[_0x4f20('0x8d')]=_0x2f69ef;}function createExtensionsReciveFax(_0x45c574){var _0x5ec4c9=0x1;var _0x1ea725=[];_0x1ea725[_0x4f20('0x8e')](new Extension(_0x45c574,_0x5ec4c9,'','Answer'));_0x5ec4c9+=0x1;_0x1ea725['push'](new Extension(_0x45c574,_0x5ec4c9,_0x4f20('0x8f'),'Set'));_0x5ec4c9+=0x1;for(var _0x10c8d5 in _0x45c574){if(_0x45c574['hasOwnProperty'](_0x10c8d5)&&(_0x10c8d5===_0x4f20('0x90')||_0x10c8d5===_0x4f20('0x88')||_0x10c8d5===_0x4f20('0x91')||_0x10c8d5==='faxdetect'||_0x10c8d5===_0x4f20('0x92')||_0x10c8d5===_0x4f20('0x93')||_0x10c8d5===_0x4f20('0x94')||_0x10c8d5==='modem'||_0x10c8d5===_0x4f20('0x95'))){_0x1ea725[_0x4f20('0x8e')](new Extension(_0x45c574,_0x5ec4c9,_0x4f20('0x96')+_0x10c8d5+')='+_0x45c574[_0x10c8d5],'Set'));_0x5ec4c9+=0x1;}}_0x1ea725[_0x4f20('0x8e')](new Extension(_0x45c574,_0x5ec4c9,'6',_0x4f20('0x97')));_0x5ec4c9+=0x1;_0x1ea725[_0x4f20('0x8e')](new Extension(_0x45c574,_0x5ec4c9,_0x4f20('0x98'),_0x4f20('0x99')));_0x5ec4c9=0x0;return _0x1ea725;}exports[_0x4f20('0x9a')]=function(_0x1a6ebf,_0x48d457,_0x2b15e5){var _0x11ca78;return db['sequelize'][_0x4f20('0x7a')](function(_0x43166e){return db[_0x4f20('0x3d')][_0x4f20('0x61')](_0x1a6ebf[_0x4f20('0x5e')],{'transaction':_0x43166e})[_0x4f20('0x1e')](function(_0x380eb8){_0x11ca78=_0x380eb8[_0x4f20('0x35')]({'plain':!![]});return db[_0x4f20('0x9b')][_0x4f20('0x7e')](createExtensionsReciveFax(_0x11ca78),{'transaction':_0x43166e});});})[_0x4f20('0x1e')](function(){return _0x11ca78;})[_0x4f20('0x1e')](respondWithResult(_0x48d457,null))[_0x4f20('0x27')](handleError(_0x48d457,null));};exports[_0x4f20('0x9c')]=function(_0x471ad5,_0x5bc76c,_0x2779db){var _0x26a9f3;return db[_0x4f20('0x7b')][_0x4f20('0x7a')](function(_0x136ed6){return db['FaxAccount']['update'](_0x471ad5[_0x4f20('0x5e')],{'where':{'id':_0x471ad5['body']['id']},'transaction':_0x136ed6})[_0x4f20('0x1e')](function(_0x3925f5){return db[_0x4f20('0x9b')]['destroy']({'where':{'FaxAccountId':_0x471ad5[_0x4f20('0x5e')]['id']},'transaction':_0x136ed6})[_0x4f20('0x1e')](function(_0x39aaf4){return db[_0x4f20('0x9b')][_0x4f20('0x7e')](createExtensionsReciveFax(_[_0x4f20('0x6f')](_0x471ad5[_0x4f20('0x5e')],[_0x4f20('0x9d'),_0x4f20('0x3f'),_0x4f20('0x9e'),'updatedAt',_0x4f20('0x9f'),_0x4f20('0xa0')])),{'transaction':_0x136ed6});});});})[_0x4f20('0x1e')](function(){return db[_0x4f20('0x3d')][_0x4f20('0xa1')](_0x471ad5['body']['id']);})[_0x4f20('0x1e')](respondWithResult(_0x5bc76c,null))[_0x4f20('0x27')](handleError(_0x5bc76c,null));};exports[_0x4f20('0xa2')]=function(_0x4046e3,_0x1ed6f8,_0x31440a){var _0x1ada15={'raw':!![],'where':{}};var _0x1bb100={};var _0x8f6cae={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4f20('0x63')]({'where':{'id':_0x4046e3[_0x4f20('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ed6f8,null))[_0x4f20('0x1e')](function(_0x539d1b){if(_0x539d1b){_0x1bb100[_0x4f20('0x40')]=_[_0x4f20('0x42')](db[_0x4f20('0xa3')]['rawAttributes']);_0x1bb100[_0x4f20('0x41')]=_['keys'](_0x4046e3[_0x4f20('0x41')]);_0x1bb100['filters']=_['intersection'](_0x1bb100[_0x4f20('0x40')],_0x1bb100[_0x4f20('0x41')]);_0x1ada15[_0x4f20('0x44')]=_[_0x4f20('0x45')](_0x1bb100[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x4046e3[_0x4f20('0x41')][_0x4f20('0x46')]));_0x1ada15[_0x4f20('0x44')]=_0x1ada15['attributes'][_0x4f20('0x64')]?_0x1ada15['attributes']:_0x1bb100[_0x4f20('0x40')];if(!_0x4046e3['query'][_0x4f20('0x47')]('nolimit')){_0x1ada15[_0x4f20('0x2d')]=qs[_0x4f20('0x2d')](_0x4046e3[_0x4f20('0x41')][_0x4f20('0x2d')]);_0x1ada15['offset']=qs['offset'](_0x4046e3[_0x4f20('0x41')][_0x4f20('0x2b')]);}_0x1ada15['order']=qs[_0x4f20('0x4a')](_0x4046e3[_0x4f20('0x41')][_0x4f20('0x4a')]);_0x1ada15['where']=qs['filters'](_[_0x4f20('0x4c')](_0x4046e3['query'],_0x1bb100['filters']));_0x1ada15['where'][_0x4f20('0x5f')]=_0x539d1b['id'];if(_0x4046e3[_0x4f20('0x41')][_0x4f20('0x4d')]){_0x1ada15[_0x4f20('0x4b')]=_[_0x4f20('0x4e')](_0x1ada15[_0x4f20('0x4b')],{'$or':_['map'](_0x1ada15[_0x4f20('0x44')],function(_0x4b009d){var _0x4d9ea7={};_0x4d9ea7[_0x4b009d]={'$like':'%'+_0x4046e3['query'][_0x4f20('0x4d')]+'%'};return _0x4d9ea7;})});}if(_0x4046e3[_0x4f20('0x41')]['$gte']){var _0x2de1b4=_0x4046e3[_0x4f20('0x41')][_0x4f20('0xa4')][_0x4f20('0xa5')](',');var _0x3203ce={};_0x3203ce[_0x2de1b4[0x0]]={'$gte':moment(_0x2de1b4[0x1])[_0x4f20('0xa6')](_0x4f20('0xa7'))};_0x1ada15['where']=_[_0x4f20('0x4e')](_0x1ada15[_0x4f20('0x4b')],_0x3203ce);}_0x1ada15=_['merge']({},_0x1ada15,_0x4046e3['options']);return db[_0x4f20('0xa3')]['count']({'where':_0x1ada15[_0x4f20('0x4b')]})[_0x4f20('0x1e')](function(_0x3e0df7){_0x8f6cae['count']=_0x3e0df7;if(_0x4046e3['query'][_0x4f20('0x66')]){_0x1ada15[_0x4f20('0x50')]=[{'all':!![]}];}return db[_0x4f20('0xa3')][_0x4f20('0x51')](_0x1ada15);})[_0x4f20('0x1e')](function(_0x4b3365){_0x8f6cae[_0x4f20('0x52')]=_0x4b3365;return _0x8f6cae;});}})['then'](respondWithFilteredResult(_0x1ed6f8,_0x1ada15))[_0x4f20('0x27')](handleError(_0x1ed6f8,null));};exports[_0x4f20('0x82')]=function(_0x349108,_0x534630,_0x1fe1e0){var _0x4f8bbd,_0x4e4820={},_0x58337c;if(_0x349108[_0x4f20('0x5e')]['to']){_0x58337c=_0x349108[_0x4f20('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x4f20('0x56')]({'where':{'id':_0x349108[_0x4f20('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x4f20('0xa8'),'include':[{'model':db[_0x4f20('0x71')],'as':'Contacts','where':{'fax':_0x58337c},'limit':0x1,'order':[[_0x4f20('0xa9'),'DESC']]}]}]})[_0x4f20('0x1e')](handleEntityNotFound(_0x534630,null))['then'](function(_0x74e13b){_0x4f8bbd=_0x74e13b;if(_0x349108[_0x4f20('0x5e')]['attachments']&&_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][_0x4f20('0x64')]){for(var _0x622ab2=0x0;_0x622ab2<_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')]['length'];_0x622ab2+=0x1){_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][_0x622ab2]={'filename':_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][_0x622ab2][_0x4f20('0x39')],'id':_0x349108[_0x4f20('0x5e')]['attachments'][_0x622ab2]['id'],'path':path[_0x4f20('0xab')](config['root'],_0x4f20('0xac'),_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][_0x622ab2][_0x4f20('0xad')])};}}return respondWithRpcPromise(_0x4f20('0xae'),_0x4f20('0xae'),{'FaxAccountId':_[_0x4f20('0xaf')](_0x349108[_0x4f20('0x54')]['id'])?undefined:_0x349108['params']['id'],'path':_['isNil'](_0x349108['body']['attachments'][0x0][_0x4f20('0xb0')])?undefined:_0x349108[_0x4f20('0x5e')]['attachments'][0x0][_0x4f20('0xb0')],'fax':_[_0x4f20('0xaf')](_0x349108[_0x4f20('0x5e')]['to'][0x0])?undefined:_0x349108[_0x4f20('0x5e')]['to'][0x0]},client9002);})[_0x4f20('0x1e')](function(){if(_0x4f8bbd){if(_[_0x4f20('0xaf')](_0x349108['body']['from'])){_0x349108[_0x4f20('0x5e')][_0x4f20('0xb1')]=util[_0x4f20('0xa6')]('\x22%s\x22\x20<%s>',_0x4f8bbd['name'],_0x4f8bbd[_0x4f20('0xb2')]);}if(_0x4f8bbd[_0x4f20('0xa8')]){if(_0x4f8bbd[_0x4f20('0xa8')][_0x4f20('0xb3')][_0x4f20('0x64')]){return _0x4f8bbd[_0x4f20('0xa8')][_0x4f20('0xb3')][0x0];}else{return db[_0x4f20('0x71')][_0x4f20('0x61')](_['defaults'](_0x349108[_0x4f20('0x5e')],{'firstName':_0x349108['body']['to'][0x0],'phone':_0x349108['body']['to'][0x0],'fax':_0x349108['body']['to'][0x0],'ListId':_0x4f8bbd[_0x4f20('0xa0')]}));}}else{throw new Error(_0x4f20('0xb4'));}}else{throw new Error(_0x4f20('0xb5'));}})[_0x4f20('0x1e')](function(_0x5ee433){if(_0x5ee433){return db[_0x4f20('0x6e')][_0x4f20('0x56')]({'where':{'ContactId':_0x5ee433['id'],'closed':![],'FaxAccountId':_0x4f8bbd['id']}})['then'](function(_0xfdc424){if(_0xfdc424){return[_0xfdc424,![]];}return db['FaxInteraction'][_0x4f20('0x61')]({'UserId':_0x349108[_0x4f20('0x57')]['id'],'ContactId':_0x5ee433['id'],'FaxAccountId':_0x4f8bbd['id'],'fax':_0x349108[_0x4f20('0x5e')]['to'][0x0],'firstMsgDirection':_0x4f20('0xb6'),'Messages':[_[_0x4f20('0x4e')](_0x349108['body'],{'read':![],'body':_0x349108['body'][_0x4f20('0xaa')][0x0][_0x4f20('0xb7')],'FaxAccountId':_0x4f8bbd['id'],'UserId':_0x349108[_0x4f20('0x57')]['id'],'ContactId':_0x5ee433['id'],'AttachmentId':_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x4f20('0xa3')],'as':'Messages'}]})[_0x4f20('0x1e')](function(_0x311651){return[_0x311651,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4f20('0xb8')](function(_0x2bc01c,_0x46c6a6){if(_0x46c6a6){return _0x2bc01c;}return db['FaxMessage']['create']({'direction':_0x4f20('0xb6'),'read':![],'body':_0x349108['body'][_0x4f20('0xaa')][0x0][_0x4f20('0xb7')],'FaxAccountId':_0x4f8bbd['id'],'FaxInteractionId':_0x2bc01c['id'],'UserId':_0x349108[_0x4f20('0x57')]['id'],'ContactId':_0x2bc01c['ContactId'],'AttachmentId':_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][0x0]['id']})[_0x4f20('0x1e')](function(_0x3fd6f4){_0x2bc01c['dataValues'][_0x4f20('0xb9')]=[];_0x2bc01c['dataValues'][_0x4f20('0xb9')][_0x4f20('0x8e')](_0x3fd6f4[_0x4f20('0xba')]);return _0x2bc01c;});})[_0x4f20('0x1e')](function(_0x432aed){respondWithRpcPromise(_0x4f20('0xbb'),_0x4f20('0xbb'),{'FaxAccountId':_['isNil'](_0x349108[_0x4f20('0x54')]['id'])?undefined:_0x349108[_0x4f20('0x54')]['id'],'path':_[_0x4f20('0xaf')](_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][0x0][_0x4f20('0xb0')])?undefined:_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][0x0][_0x4f20('0xb0')],'fax':_['isNil'](_0x349108[_0x4f20('0x5e')]['to'][0x0])?undefined:_0x349108[_0x4f20('0x5e')]['to'][0x0],'AttachmentId':_0x349108[_0x4f20('0x5e')][_0x4f20('0xaa')][0x0]['id']},client9002)['then'](function(_0x31b529){logger[_0x4f20('0x1f')]('SendFaxRpc,\x20%s',_0x31b529);})[_0x4f20('0x27')](function(_0x5657dd){logger[_0x4f20('0x1f')](_0x4f20('0xbc'),_0x5657dd);});return _0x432aed;})['then'](respondWithResult(_0x534630,null))[_0x4f20('0x27')](handleError(_0x534630,null));};exports['addAgents']=function(_0x46da63,_0x3d6c4a,_0x5bf26e){return db['FaxAccount'][_0x4f20('0x56')]({'where':{'id':_0x46da63[_0x4f20('0x54')]['id']}})['then'](handleEntityNotFound(_0x3d6c4a,null))[_0x4f20('0x1e')](function(_0x4cdb34){if(_0x4cdb34){return _0x4cdb34[_0x4f20('0xbd')](_0x46da63[_0x4f20('0x5e')][_0x4f20('0x6c')],_[_0x4f20('0x6f')](_0x46da63[_0x4f20('0x5e')],[_0x4f20('0x6c'),'id'])||{})[_0x4f20('0xb8')](function(_0x1b1e9f){for(var _0x314e70=0x0;_0x314e70<_0x46da63[_0x4f20('0x5e')]['ids'][_0x4f20('0x64')];_0x314e70+=0x1){socket[_0x4f20('0xbe')](_0x4f20('0xbf'),{'UserId':Number(_0x46da63[_0x4f20('0x5e')]['ids'][_0x314e70]),'FaxAccountId':Number(_0x46da63[_0x4f20('0x54')]['id'])});}return _0x1b1e9f;});}})['then'](respondWithResult(_0x3d6c4a,null))[_0x4f20('0x27')](handleError(_0x3d6c4a,null));};exports[_0x4f20('0xc0')]=function(_0x1ca453,_0x2dfa97,_0x50ae84){return db[_0x4f20('0x3d')]['find']({'where':{'id':_0x1ca453['params']['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x2dfa97,null))[_0x4f20('0x1e')](function(_0x27f284){if(_0x27f284){return _0x27f284[_0x4f20('0xc0')](_0x1ca453[_0x4f20('0x41')][_0x4f20('0x6c')])[_0x4f20('0x1e')](function(){if(_[_0x4f20('0xc1')](_0x1ca453[_0x4f20('0x41')]['ids'])){for(var _0x595cf9=0x0;_0x595cf9<_0x1ca453['query'][_0x4f20('0x6c')][_0x4f20('0x64')];_0x595cf9+=0x1){socket['emit'](_0x4f20('0xc2'),{'UserId':Number(_0x1ca453[_0x4f20('0x41')][_0x4f20('0x6c')][_0x595cf9]),'FaxAccountId':Number(_0x1ca453[_0x4f20('0x54')]['id'])});}}else{socket['emit'](_0x4f20('0xc2'),{'UserId':Number(_0x1ca453[_0x4f20('0x41')]['ids']),'FaxAccountId':Number(_0x1ca453[_0x4f20('0x54')]['id'])});}});}})[_0x4f20('0x1e')](respondWithStatusCode(_0x2dfa97,null))[_0x4f20('0x27')](handleError(_0x2dfa97,null));};exports['getAgents']=function(_0x51397c,_0x4e50ab,_0x1a506b){var _0x3509b7={};var _0x2fbf21={};var _0x2986f4;var _0x20554d;return db[_0x4f20('0x3d')][_0x4f20('0x63')]({'where':{'id':_0x51397c[_0x4f20('0x54')]['id']}})[_0x4f20('0x1e')](handleEntityNotFound(_0x4e50ab,null))[_0x4f20('0x1e')](function(_0x1865a9){if(_0x1865a9){_0x2986f4=_0x1865a9;_0x2fbf21[_0x4f20('0x40')]=_['keys'](db[_0x4f20('0x73')][_0x4f20('0x55')]);_0x2fbf21[_0x4f20('0x41')]=_['keys'](_0x51397c[_0x4f20('0x41')]);_0x2fbf21['filters']=_['intersection'](_0x2fbf21[_0x4f20('0x40')],_0x2fbf21['query']);_0x3509b7[_0x4f20('0x44')]=_['intersection'](_0x2fbf21[_0x4f20('0x40')],qs[_0x4f20('0x46')](_0x51397c[_0x4f20('0x41')]['fields']));_0x3509b7[_0x4f20('0x44')]=_0x3509b7[_0x4f20('0x44')][_0x4f20('0x64')]?_0x3509b7[_0x4f20('0x44')]:_0x2fbf21[_0x4f20('0x40')];_0x3509b7['order']=qs[_0x4f20('0x4a')](_0x51397c[_0x4f20('0x41')][_0x4f20('0x4a')]);_0x3509b7[_0x4f20('0x4b')]=qs[_0x4f20('0x43')](_[_0x4f20('0x4c')](_0x51397c[_0x4f20('0x41')],_0x2fbf21[_0x4f20('0x43')]));if(_0x51397c['query'][_0x4f20('0x4d')]){_0x3509b7['where']=_['merge'](_0x3509b7['where'],{'$or':_[_0x4f20('0x3c')](_0x3509b7[_0x4f20('0x44')],function(_0x73f32d){var _0x2486dc={};_0x2486dc[_0x73f32d]={'$like':'%'+_0x51397c[_0x4f20('0x41')][_0x4f20('0x4d')]+'%'};return _0x2486dc;})});}_0x3509b7=_['merge']({},_0x3509b7,_0x51397c[_0x4f20('0x65')]);return _0x2986f4[_0x4f20('0xc3')](_0x3509b7);}})['then'](function(_0x138ba1){if(_0x138ba1){_0x20554d=_0x138ba1[_0x4f20('0x64')];if(!_0x51397c[_0x4f20('0x41')]['hasOwnProperty']('nolimit')){_0x3509b7[_0x4f20('0x2d')]=qs[_0x4f20('0x2d')](_0x51397c[_0x4f20('0x41')][_0x4f20('0x2d')]);_0x3509b7[_0x4f20('0x2b')]=qs['offset'](_0x51397c['query'][_0x4f20('0x2b')]);}return _0x2986f4[_0x4f20('0xc3')](_0x3509b7);}})['then'](function(_0x38d8e2){if(_0x38d8e2){return _0x38d8e2?{'count':_0x20554d,'rows':_0x38d8e2}:null;}})[_0x4f20('0x1e')](respondWithResult(_0x4e50ab,null))[_0x4f20('0x27')](handleError(_0x4e50ab,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e6e2877..344d809 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 _0x1ebb=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x20ba62,_0x539a35){var _0x4cf2d0=function(_0x4686db){while(--_0x4686db){_0x20ba62['push'](_0x20ba62['shift']());}};_0x4cf2d0(++_0x539a35);}(_0x1ebb,0x1d2));var _0xb1eb=function(_0x58cca2,_0x293cec){_0x58cca2=_0x58cca2-0x0;var _0x162d66=_0x1ebb[_0x58cca2];return _0x162d66;};'use strict';var EventEmitter=require(_0xb1eb('0x0'));var FaxAccount=require(_0xb1eb('0x1'))['db'][_0xb1eb('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb1eb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb1eb('0x4'),'afterDestroy':_0xb1eb('0x5')};function emitEvent(_0x22de5){return function(_0x2ed2a7,_0x196068,_0x307ce3){FaxAccountEvents[_0xb1eb('0x6')](_0x22de5+':'+_0x2ed2a7['id'],_0x2ed2a7);FaxAccountEvents[_0xb1eb('0x6')](_0x22de5,_0x2ed2a7);_0x307ce3(null);};}for(var e in events){if(events[_0xb1eb('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xb1eb('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x6b19=['remove','emit','hook','exports','events','FaxAccount','setMaxListeners','update'];(function(_0x7380e0,_0x75deb6){var _0x1ffff1=function(_0xf172b8){while(--_0xf172b8){_0x7380e0['push'](_0x7380e0['shift']());}};_0x1ffff1(++_0x75deb6);}(_0x6b19,0xf4));var _0x96b1=function(_0x25bcec,_0x4418f1){_0x25bcec=_0x25bcec-0x0;var _0x3e3e22=_0x6b19[_0x25bcec];return _0x3e3e22;};'use strict';var EventEmitter=require(_0x96b1('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x96b1('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x96b1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96b1('0x3'),'afterDestroy':_0x96b1('0x4')};function emitEvent(_0x31c877){return function(_0x30aef8,_0x5e84f7,_0x84bd21){FaxAccountEvents[_0x96b1('0x5')](_0x31c877+':'+_0x30aef8['id'],_0x30aef8);FaxAccountEvents['emit'](_0x31c877,_0x30aef8);_0x84bd21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x96b1('0x6')](e,emitEvent(event));}}module[_0x96b1('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 609a7cd..9bc8204 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 _0x37da=['./faxAccount.attributes','exports','FaxAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2d5ba8,_0x16b612){var _0x2a0a90=function(_0xa9ce24){while(--_0xa9ce24){_0x2d5ba8['push'](_0x2d5ba8['shift']());}};_0x2a0a90(++_0x16b612);}(_0x37da,0x142));var _0xa37d=function(_0x32b681,_0x3a62f2){_0x32b681=_0x32b681-0x0;var _0x51776e=_0x37da[_0x32b681];return _0x51776e;};'use strict';var _=require(_0xa37d('0x0'));var util=require(_0xa37d('0x1'));var logger=require(_0xa37d('0x2'))(_0xa37d('0x3'));var moment=require(_0xa37d('0x4'));var BPromise=require('bluebird');var rp=require(_0xa37d('0x5'));var fs=require('fs');var path=require(_0xa37d('0x6'));var rimraf=require(_0xa37d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa37d('0x8'));module[_0xa37d('0x9')]=function(_0x3fd700,_0x27e825){return _0x3fd700['define'](_0xa37d('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f7e=['FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x4b8553,_0x1da94d){var _0x4e86c8=function(_0x3bdde1){while(--_0x3bdde1){_0x4b8553['push'](_0x4b8553['shift']());}};_0x4e86c8(++_0x1da94d);}(_0x0f7e,0x194));var _0xe0f7=function(_0x2508b5,_0x482f01){_0x2508b5=_0x2508b5-0x0;var _0x127baf=_0x0f7e[_0x2508b5];return _0x127baf;};'use strict';var _=require(_0xe0f7('0x0'));var util=require(_0xe0f7('0x1'));var logger=require(_0xe0f7('0x2'))(_0xe0f7('0x3'));var moment=require(_0xe0f7('0x4'));var BPromise=require(_0xe0f7('0x5'));var rp=require(_0xe0f7('0x6'));var fs=require('fs');var path=require(_0xe0f7('0x7'));var rimraf=require(_0xe0f7('0x8'));var config=require(_0xe0f7('0x9'));var attributes=require(_0xe0f7('0xa'));module[_0xe0f7('0xb')]=function(_0x405605,_0x2a6424){return _0x405605['define'](_0xe0f7('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 62b2d19..185434f 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 _0xc954=['Contacts','DESC','Applications','get','applications','list','orderBy','priority','asc','length','defaults','contact','FaxInteraction','find','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List'];(function(_0x31cd79,_0xbfb3fc){var _0x47f395=function(_0x596e98){while(--_0x596e98){_0x31cd79['push'](_0x31cd79['shift']());}};_0x47f395(++_0xbfb3fc);}(_0xc954,0x87));var _0x4c95=function(_0x22195,_0x27aeae){_0x22195=_0x22195-0x0;var _0x3dc2d9=_0xc954[_0x22195];return _0x3dc2d9;};'use strict';var _=require(_0x4c95('0x0'));var util=require(_0x4c95('0x1'));var moment=require(_0x4c95('0x2'));var BPromise=require(_0x4c95('0x3'));var rs=require(_0x4c95('0x4'));var fs=require('fs');var Redis=require(_0x4c95('0x5'));var db=require(_0x4c95('0x6'))['db'];var utils=require(_0x4c95('0x7'));var logger=require(_0x4c95('0x8'))(_0x4c95('0x9'));var config=require('../../config/environment');var jayson=require(_0x4c95('0xa'));var client=jayson['client'][_0x4c95('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0x4c95('0xc')],{'host':_0x4c95('0xd'),'port':0x18eb});var socket=require(_0x4c95('0xe'))(new Redis(config['redis']));require(_0x4c95('0xf'))['register'](socket);function respondWithRpcPromise(_0x28d664,_0x5ce1f3,_0x27eb5d){return new BPromise(function(_0x3ffb25,_0xa39237){return client['request'](_0x28d664,_0x27eb5d)[_0x4c95('0x10')](function(_0x687372){logger['info'](_0x4c95('0x11'),_0x5ce1f3,_0x4c95('0x12'));logger[_0x4c95('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5ce1f3,_0x4c95('0x12'),JSON[_0x4c95('0x14')](_0x687372));if(_0x687372[_0x4c95('0x15')]){if(_0x687372[_0x4c95('0x15')][_0x4c95('0x16')]===0x1f4){logger[_0x4c95('0x15')](_0x4c95('0x11'),_0x5ce1f3,_0x687372['error'][_0x4c95('0x17')]);return _0xa39237(_0x687372[_0x4c95('0x15')][_0x4c95('0x17')]);}logger[_0x4c95('0x15')](_0x4c95('0x11'),_0x5ce1f3,_0x687372[_0x4c95('0x15')][_0x4c95('0x17')]);return _0x3ffb25(_0x687372[_0x4c95('0x15')][_0x4c95('0x17')]);}else{logger['info'](_0x4c95('0x11'),_0x5ce1f3,_0x4c95('0x12'));_0x3ffb25(_0x687372[_0x4c95('0x18')][_0x4c95('0x17')]);}})[_0x4c95('0x19')](function(_0x440381){logger[_0x4c95('0x15')](_0x4c95('0x11'),_0x5ce1f3,_0x440381);_0xa39237(_0x440381);});});}exports[_0x4c95('0x1a')]=function(_0x2d18a1){var _0x2f2083=this;return new Promise(function(_0x401e38,_0x5db8da){return db['FaxAccount'][_0x4c95('0x1b')]({'raw':_0x2d18a1[_0x4c95('0x1c')]?_0x2d18a1['options'][_0x4c95('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d18a1['options']?_0x2d18a1['options'][_0x4c95('0x1e')]||null:null,'attributes':_0x2d18a1[_0x4c95('0x1c')]?_0x2d18a1[_0x4c95('0x1c')][_0x4c95('0x1f')]||null:null,'limit':_0x2d18a1['options']?_0x2d18a1[_0x4c95('0x1c')][_0x4c95('0x20')]||null:null,'include':_0x2d18a1[_0x4c95('0x1c')]?_0x2d18a1[_0x4c95('0x1c')][_0x4c95('0x21')]?_[_0x4c95('0x22')](_0x2d18a1[_0x4c95('0x1c')]['include'],function(_0x2b1683){return{'model':db[_0x2b1683['model']],'as':_0x2b1683['as'],'attributes':_0x2b1683['attributes'],'include':_0x2b1683['include']?_[_0x4c95('0x22')](_0x2b1683[_0x4c95('0x21')],function(_0x385e85){return{'model':db[_0x385e85[_0x4c95('0x23')]],'as':_0x385e85['as'],'attributes':_0x385e85['attributes'],'include':_0x385e85[_0x4c95('0x21')]?_['map'](_0x385e85[_0x4c95('0x21')],function(_0x3f3cb5){return{'model':db[_0x3f3cb5[_0x4c95('0x23')]],'as':_0x3f3cb5['as'],'attributes':_0x3f3cb5['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c95('0x10')](function(_0x58cb1f){logger[_0x4c95('0x24')](_0x4c95('0x1a'),_0x2d18a1);logger[_0x4c95('0x13')](_0x4c95('0x1a'),_0x2d18a1,JSON[_0x4c95('0x14')](_0x58cb1f));_0x401e38(_0x58cb1f);})[_0x4c95('0x19')](function(_0x28bcd0){logger[_0x4c95('0x15')]('GetFaxAccount',_0x28bcd0['message'],_0x2d18a1);_0x5db8da(_0x2f2083['error'](0x1f4,_0x28bcd0[_0x4c95('0x17')]));});});};exports[_0x4c95('0x25')]=function(_0x758ed9,_0x19b10c,_0x106244){var _0x3fe5e4=this;return new Promise(function(_0x36e204,_0x13701c){var _0x42c371={'body':_0x758ed9[_0x4c95('0x26')],'channel':_0x4c95('0x27')};var _0x502e40=[];var _0x497248=[];var _0x319f5a={};return db[_0x4c95('0x28')][_0x4c95('0x29')]()[_0x4c95('0x10')](function(_0x4f897c){if(!_0x4f897c){throw new db[(_0x4c95('0x2a'))]['ValidationError'](_0x4c95('0x2b'));}_0x502e40=_[_0x4c95('0x2c')](_[_0x4c95('0x2d')](_0x4f897c),[_0x4c95('0x2e'),_0x4c95('0x2f')]);_0x497248=_['difference'](_[_0x4c95('0x2d')](_0x4f897c),['createdAt',_0x4c95('0x2f'),_0x4c95('0x30'),_0x4c95('0x31')]);if(_0x758ed9[_0x4c95('0x26')]['id']){delete _0x758ed9[_0x4c95('0x26')]['id'];}if(_[_0x4c95('0x32')](_0x758ed9[_0x4c95('0x26')]['from'])){throw new db[(_0x4c95('0x2a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4c95('0x32')](_0x758ed9[_0x4c95('0x26')][_0x4c95('0x26')])||_0x758ed9[_0x4c95('0x26')][_0x4c95('0x26')]===''){throw new db['Sequelize'][(_0x4c95('0x33'))](_0x4c95('0x34'));}if(_['isNil'](_0x758ed9['body'][_0x4c95('0x35')])){throw new db[(_0x4c95('0x2a'))][(_0x4c95('0x33'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x497248);}if(!_[_0x4c95('0x36')](_0x497248,_0x758ed9[_0x4c95('0x26')]['mapKey'])){throw new db[(_0x4c95('0x2a'))][(_0x4c95('0x33'))](_0x4c95('0x37')+_0x497248);}_0x319f5a[_0x758ed9[_0x4c95('0x26')][_0x4c95('0x35')]]=_0x758ed9['body'][_0x4c95('0x38')];})[_0x4c95('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x758ed9[_0x4c95('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x4c95('0x3a'),'include':[{'model':db[_0x4c95('0x28')],'as':_0x4c95('0x3b'),'where':_0x319f5a,'limit':0x1,'order':[[_0x4c95('0x2f'),_0x4c95('0x3c')]]}]},{'model':db['FaxApplication'],'as':_0x4c95('0x3d')}]});})[_0x4c95('0x10')](function(_0x6c10e7){if(_0x6c10e7&&_0x6c10e7['List']){var _0x3c374c=_0x6c10e7[_0x4c95('0x3e')]({'plain':!![]});_0x42c371[_0x4c95('0x39')]=_0x3c374c;_0x42c371[_0x4c95('0x3f')]=_0x3c374c[_0x4c95('0x3d')];_0x42c371[_0x4c95('0x40')]=_0x3c374c[_0x4c95('0x3a')];_0x42c371[_0x4c95('0x3f')]=_[_0x4c95('0x41')](_0x42c371['applications'],[_0x4c95('0x42')],[_0x4c95('0x43')]);if(_0x42c371[_0x4c95('0x39')][_0x4c95('0x3d')]){delete _0x42c371[_0x4c95('0x39')]['Applications'];}if(_0x42c371[_0x4c95('0x39')][_0x4c95('0x3a')]&&_0x42c371['account']['List'][_0x4c95('0x3b')][_0x4c95('0x44')]){return _0x42c371[_0x4c95('0x39')]['List'][_0x4c95('0x3b')][0x0];}var _0x509e07=_[_0x4c95('0x45')](_0x758ed9[_0x4c95('0x26')],{'firstName':_0x758ed9[_0x4c95('0x26')][_0x4c95('0x38')],'ListId':_0x3c374c[_0x4c95('0x31')]});_0x509e07[_0x758ed9[_0x4c95('0x26')][_0x4c95('0x35')]]=_0x758ed9[_0x4c95('0x26')][_0x4c95('0x38')];return db[_0x4c95('0x28')]['create'](_0x509e07,{'fields':_0x502e40,'raw':!![]});}})[_0x4c95('0x10')](function(_0x27d472){_0x42c371[_0x4c95('0x46')]=_0x27d472;if(_0x27d472){var _0x1e6dcc={'ContactId':_0x27d472['id'],'FaxAccountId':_0x758ed9['account']['id'],'fax':_0x27d472[_0x4c95('0x27')]};return db[_0x4c95('0x47')][_0x4c95('0x48')]({'where':{'ContactId':_0x27d472['id'],'closed':![],'FaxAccountId':_0x758ed9[_0x4c95('0x39')]['id']}})[_0x4c95('0x10')](function(_0x3deafa){if(_0x3deafa){return[_0x3deafa,![]];}return db[_0x4c95('0x47')][_0x4c95('0x49')](_0x1e6dcc)[_0x4c95('0x10')](function(_0x527000){return[_0x527000,!![]];});});}else{throw new Error(_0x4c95('0x4a'));}})[_0x4c95('0x4b')](function(_0x429f5a,_0x2ef9e5){var _0xa33f93=_0x429f5a['get']({'plain':!![]});if(_0x2ef9e5){if(_0x42c371[_0x4c95('0x39')][_0x4c95('0x4c')]){_0x42c371[_0x4c95('0x3f')][_0x4c95('0x4d')]({'id':0x0,'priority':_0x42c371['applications'][_0x4c95('0x44')]+0x1,'app':_0x4c95('0x4e'),'appdata':_0x4c95('0x4f'),'interval':_0x4c95('0x50')});}_0xa33f93[_0x4c95('0x51')]=!![];}else{_0xa33f93[_0x4c95('0x51')]=![];}_0x42c371[_0x4c95('0x52')]=_0xa33f93;return db[_0x4c95('0x53')]['create']({'body':_0x758ed9[_0x4c95('0x26')][_0x4c95('0x26')],'FaxAccountId':_0x758ed9[_0x4c95('0x39')]['id'],'FaxInteractionId':_0x429f5a['id'],'direction':'in','ContactId':_0x429f5a['ContactId'],'AttachmentId':_0x758ed9[_0x4c95('0x26')][_0x4c95('0x54')]});})[_0x4c95('0x10')](function(_0x440c72){_0x42c371[_0x4c95('0x17')]=_0x440c72;if(!_0x42c371[_0x4c95('0x52')][_0x4c95('0x55')])return;return db[_0x4c95('0x56')][_0x4c95('0x48')]({'attributes':['id',_0x4c95('0x57')],'where':{'id':_0x42c371[_0x4c95('0x52')][_0x4c95('0x55')]}});})['then'](function(_0x30d4f8){if(_0x30d4f8){_0x42c371[_0x4c95('0x3f')][_0x4c95('0x58')]({'id':0x0,'priority':0x0,'app':_0x4c95('0x59'),'appdata':_0x30d4f8[_0x4c95('0x57')]+','+(_0x42c371[_0x4c95('0x39')][_0x4c95('0x5a')]||0xa),'interval':_0x4c95('0x50')});}if(!_0x42c371[_0x4c95('0x52')][_0x4c95('0x5b')])return;return db[_0x4c95('0x5c')][_0x4c95('0x48')]({'attributes':['id','name'],'where':{'id':_0x42c371[_0x4c95('0x52')][_0x4c95('0x5b')]}});})[_0x4c95('0x10')](function(_0x1b9d3b){if(_0x1b9d3b){_0x42c371[_0x4c95('0x3f')][_0x4c95('0x58')]({'id':0x0,'priority':0x1,'app':_0x4c95('0x5d'),'appdata':_0x1b9d3b[_0x4c95('0x57')]+','+(_0x42c371['account'][_0x4c95('0x5e')]||0x12c),'interval':_0x4c95('0x50')});}return respondWithRpcPromise(_0x4c95('0x5f'),_0x4c95('0x60'),_0x42c371);})['then'](function(_0x252828){_0x36e204(_0x252828);})[_0x4c95('0x19')](function(_0x3ac646){_0x13701c(_0x3fe5e4['error'](0x1f4,_0x3ac646[_0x4c95('0x17')]));});});}; \ No newline at end of file +var _0x7467=['CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','keys','CompanyId','ListId','from','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','find','List','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc','length','Contacts','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','NotifyFaxAccount','body','fax'];(function(_0xf5d377,_0x1a5780){var _0x24c5aa=function(_0x4b81ce){while(--_0x4b81ce){_0xf5d377['push'](_0xf5d377['shift']());}};_0x24c5aa(++_0x1a5780);}(_0x7467,0x16e));var _0x7746=function(_0x269719,_0x446d80){_0x269719=_0x269719-0x0;var _0x48946f=_0x7467[_0x269719];return _0x48946f;};'use strict';var _=require(_0x7746('0x0'));var util=require(_0x7746('0x1'));var moment=require(_0x7746('0x2'));var BPromise=require(_0x7746('0x3'));var rs=require(_0x7746('0x4'));var fs=require('fs');var Redis=require(_0x7746('0x5'));var db=require(_0x7746('0x6'))['db'];var utils=require(_0x7746('0x7'));var logger=require(_0x7746('0x8'))(_0x7746('0x9'));var config=require(_0x7746('0xa'));var jayson=require(_0x7746('0xb'));var client=jayson[_0x7746('0xc')][_0x7746('0xd')]({'port':0x232c});config[_0x7746('0xe')]=_[_0x7746('0xf')](config[_0x7746('0xe')],{'host':_0x7746('0x10'),'port':0x18eb});var socket=require(_0x7746('0x11'))(new Redis(config[_0x7746('0xe')]));require(_0x7746('0x12'))[_0x7746('0x13')](socket);function respondWithRpcPromise(_0x576220,_0x3e990b,_0x43314e){return new BPromise(function(_0x378dea,_0x1cdbc3){return client[_0x7746('0x14')](_0x576220,_0x43314e)[_0x7746('0x15')](function(_0x2cf6fc){logger[_0x7746('0x16')](_0x7746('0x17'),_0x3e990b,_0x7746('0x18'));logger[_0x7746('0x19')](_0x7746('0x1a'),_0x3e990b,_0x7746('0x18'),JSON['stringify'](_0x2cf6fc));if(_0x2cf6fc['error']){if(_0x2cf6fc['error'][_0x7746('0x1b')]===0x1f4){logger['error'](_0x7746('0x17'),_0x3e990b,_0x2cf6fc[_0x7746('0x1c')][_0x7746('0x1d')]);return _0x1cdbc3(_0x2cf6fc['error']['message']);}logger[_0x7746('0x1c')](_0x7746('0x17'),_0x3e990b,_0x2cf6fc['error'][_0x7746('0x1d')]);return _0x378dea(_0x2cf6fc['error'][_0x7746('0x1d')]);}else{logger['info'](_0x7746('0x17'),_0x3e990b,_0x7746('0x18'));_0x378dea(_0x2cf6fc[_0x7746('0x1e')][_0x7746('0x1d')]);}})[_0x7746('0x1f')](function(_0x1be917){logger[_0x7746('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x3e990b,_0x1be917);_0x1cdbc3(_0x1be917);});});}exports[_0x7746('0x20')]=function(_0x405734){var _0x24e715=this;return new Promise(function(_0x4108b9,_0x21081d){return db[_0x7746('0x21')][_0x7746('0x22')]({'raw':_0x405734[_0x7746('0x23')]?_0x405734[_0x7746('0x23')][_0x7746('0x24')]===undefined?!![]:![]:!![],'where':_0x405734['options']?_0x405734['options']['where']||null:null,'attributes':_0x405734[_0x7746('0x23')]?_0x405734[_0x7746('0x23')][_0x7746('0x25')]||null:null,'limit':_0x405734['options']?_0x405734['options'][_0x7746('0x26')]||null:null,'include':_0x405734[_0x7746('0x23')]?_0x405734[_0x7746('0x23')]['include']?_['map'](_0x405734[_0x7746('0x23')]['include'],function(_0x40d874){return{'model':db[_0x40d874['model']],'as':_0x40d874['as'],'attributes':_0x40d874[_0x7746('0x25')],'include':_0x40d874['include']?_[_0x7746('0x27')](_0x40d874[_0x7746('0x28')],function(_0x4bbd02){return{'model':db[_0x4bbd02[_0x7746('0x29')]],'as':_0x4bbd02['as'],'attributes':_0x4bbd02[_0x7746('0x25')],'include':_0x4bbd02[_0x7746('0x28')]?_[_0x7746('0x27')](_0x4bbd02[_0x7746('0x28')],function(_0x28e45a){return{'model':db[_0x28e45a[_0x7746('0x29')]],'as':_0x28e45a['as'],'attributes':_0x28e45a[_0x7746('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7746('0x15')](function(_0x452d8e){logger[_0x7746('0x16')](_0x7746('0x20'),_0x405734);logger['debug'](_0x7746('0x20'),_0x405734,JSON[_0x7746('0x2a')](_0x452d8e));_0x4108b9(_0x452d8e);})['catch'](function(_0x46dd0f){logger[_0x7746('0x1c')](_0x7746('0x20'),_0x46dd0f[_0x7746('0x1d')],_0x405734);_0x21081d(_0x24e715[_0x7746('0x1c')](0x1f4,_0x46dd0f['message']));});});};exports[_0x7746('0x2b')]=function(_0x1ae272,_0x53f662,_0x2115ee){var _0x2b68d8=this;return new Promise(function(_0x37a1ac,_0x24b6b){var _0x10684e={'body':_0x1ae272[_0x7746('0x2c')],'channel':_0x7746('0x2d')};var _0x59d1dd=[];var _0x276fa1=[];var _0x1ddeb8={};return db[_0x7746('0x2e')]['describe']()['then'](function(_0x18d482){if(!_0x18d482){throw new db[(_0x7746('0x2f'))][(_0x7746('0x30'))]('no\x20available\x20attributes');}_0x59d1dd=_['difference'](_['keys'](_0x18d482),[_0x7746('0x31'),_0x7746('0x32')]);_0x276fa1=_[_0x7746('0x33')](_[_0x7746('0x34')](_0x18d482),[_0x7746('0x31'),'updatedAt',_0x7746('0x35'),_0x7746('0x36')]);if(_0x1ae272[_0x7746('0x2c')]['id']){delete _0x1ae272[_0x7746('0x2c')]['id'];}if(_['isNil'](_0x1ae272[_0x7746('0x2c')][_0x7746('0x37')])){throw new db[(_0x7746('0x2f'))][(_0x7746('0x30'))](_0x7746('0x38'));}if(_[_0x7746('0x39')](_0x1ae272['body'][_0x7746('0x2c')])||_0x1ae272[_0x7746('0x2c')][_0x7746('0x2c')]===''){throw new db[(_0x7746('0x2f'))][(_0x7746('0x30'))](_0x7746('0x3a'));}if(_[_0x7746('0x39')](_0x1ae272[_0x7746('0x2c')][_0x7746('0x3b')])){throw new db['Sequelize'][(_0x7746('0x30'))](_0x7746('0x3c')+_0x276fa1);}if(!_[_0x7746('0x3d')](_0x276fa1,_0x1ae272['body'][_0x7746('0x3b')])){throw new db[(_0x7746('0x2f'))][(_0x7746('0x30'))](_0x7746('0x3e')+_0x276fa1);}_0x1ddeb8[_0x1ae272[_0x7746('0x2c')][_0x7746('0x3b')]]=_0x1ae272[_0x7746('0x2c')]['from'];})[_0x7746('0x15')](function(){return db[_0x7746('0x21')][_0x7746('0x3f')]({'where':{'id':_0x1ae272['account']['id']},'include':[{'model':db['CmList'],'as':_0x7746('0x40'),'include':[{'model':db[_0x7746('0x2e')],'as':'Contacts','where':_0x1ddeb8,'limit':0x1,'order':[[_0x7746('0x32'),_0x7746('0x41')]]}]},{'model':db[_0x7746('0x42')],'as':_0x7746('0x43')}]});})['then'](function(_0x294bf3){if(_0x294bf3&&_0x294bf3[_0x7746('0x40')]){var _0x36f459=_0x294bf3[_0x7746('0x44')]({'plain':!![]});_0x10684e[_0x7746('0x45')]=_0x36f459;_0x10684e[_0x7746('0x46')]=_0x36f459[_0x7746('0x43')];_0x10684e[_0x7746('0x47')]=_0x36f459[_0x7746('0x40')];_0x10684e[_0x7746('0x46')]=_[_0x7746('0x48')](_0x10684e['applications'],[_0x7746('0x49')],[_0x7746('0x4a')]);if(_0x10684e[_0x7746('0x45')]['Applications']){delete _0x10684e['account']['Applications'];}if(_0x10684e[_0x7746('0x45')][_0x7746('0x40')]&&_0x10684e['account'][_0x7746('0x40')]['Contacts'][_0x7746('0x4b')]){return _0x10684e[_0x7746('0x45')][_0x7746('0x40')][_0x7746('0x4c')][0x0];}var _0x3beeb2=_[_0x7746('0xf')](_0x1ae272[_0x7746('0x2c')],{'firstName':_0x1ae272[_0x7746('0x2c')][_0x7746('0x37')],'ListId':_0x36f459[_0x7746('0x36')]});_0x3beeb2[_0x1ae272[_0x7746('0x2c')][_0x7746('0x3b')]]=_0x1ae272['body'][_0x7746('0x37')];return db['CmContact']['create'](_0x3beeb2,{'fields':_0x59d1dd,'raw':!![]});}})[_0x7746('0x15')](function(_0x1ea785){_0x10684e[_0x7746('0x4d')]=_0x1ea785;if(_0x1ea785){var _0xca75b6={'ContactId':_0x1ea785['id'],'FaxAccountId':_0x1ae272[_0x7746('0x45')]['id'],'fax':_0x1ea785[_0x7746('0x2d')]};return db['FaxInteraction'][_0x7746('0x3f')]({'where':{'ContactId':_0x1ea785['id'],'closed':![],'FaxAccountId':_0x1ae272['account']['id']}})[_0x7746('0x15')](function(_0x4bdf53){if(_0x4bdf53){return[_0x4bdf53,![]];}return db[_0x7746('0x4e')][_0x7746('0x4f')](_0xca75b6)[_0x7746('0x15')](function(_0x339ba4){return[_0x339ba4,!![]];});});}else{throw new Error(_0x7746('0x50'));}})[_0x7746('0x51')](function(_0x254c5a,_0x575671){var _0x8e41b=_0x254c5a[_0x7746('0x44')]({'plain':!![]});if(_0x575671){if(_0x10684e['account'][_0x7746('0x52')]){_0x10684e[_0x7746('0x46')][_0x7746('0x53')]({'id':0x0,'priority':_0x10684e[_0x7746('0x46')][_0x7746('0x4b')]+0x1,'app':_0x7746('0x54'),'appdata':_0x7746('0x55'),'interval':_0x7746('0x56')});}_0x8e41b[_0x7746('0x57')]=!![];}else{_0x8e41b[_0x7746('0x57')]=![];}_0x10684e['interaction']=_0x8e41b;return db[_0x7746('0x58')]['create']({'body':_0x1ae272['body']['body'],'FaxAccountId':_0x1ae272[_0x7746('0x45')]['id'],'FaxInteractionId':_0x254c5a['id'],'direction':'in','ContactId':_0x254c5a[_0x7746('0x59')],'AttachmentId':_0x1ae272[_0x7746('0x2c')][_0x7746('0x5a')]});})[_0x7746('0x15')](function(_0x194446){_0x10684e[_0x7746('0x1d')]=_0x194446;if(!_0x10684e[_0x7746('0x5b')][_0x7746('0x5c')])return;return db['User'][_0x7746('0x3f')]({'attributes':['id',_0x7746('0x5d')],'where':{'id':_0x10684e[_0x7746('0x5b')][_0x7746('0x5c')]}});})['then'](function(_0x2f531f){if(_0x2f531f){_0x10684e[_0x7746('0x46')][_0x7746('0x5e')]({'id':0x0,'priority':0x0,'app':_0x7746('0x5f'),'appdata':_0x2f531f[_0x7746('0x5d')]+','+(_0x10684e[_0x7746('0x45')][_0x7746('0x60')]||0xa),'interval':_0x7746('0x56')});}if(!_0x10684e[_0x7746('0x5b')][_0x7746('0x61')])return;return db[_0x7746('0x62')][_0x7746('0x3f')]({'attributes':['id',_0x7746('0x5d')],'where':{'id':_0x10684e[_0x7746('0x5b')][_0x7746('0x61')]}});})[_0x7746('0x15')](function(_0x580b1c){if(_0x580b1c){_0x10684e[_0x7746('0x46')][_0x7746('0x5e')]({'id':0x0,'priority':0x1,'app':_0x7746('0x63'),'appdata':_0x580b1c['name']+','+(_0x10684e['account'][_0x7746('0x64')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7746('0x65'),_0x7746('0x66'),_0x10684e);})[_0x7746('0x15')](function(_0x3c28fb){_0x37a1ac(_0x3c28fb);})['catch'](function(_0x2f9851){_0x24b6b(_0x2b68d8[_0x7746('0x1c')](0x1f4,_0x2f9851[_0x7746('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9924016..3b7449d 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 _0x9f6c=['./faxAccount.events','save','remove','update','removeListener','register','length','faxAccount:'];(function(_0x11aed3,_0x1b6698){var _0x5a3570=function(_0x3d5eba){while(--_0x3d5eba){_0x11aed3['push'](_0x11aed3['shift']());}};_0x5a3570(++_0x1b6698);}(_0x9f6c,0x128));var _0xc9f6=function(_0x43e840,_0x197fd3){_0x43e840=_0x43e840-0x0;var _0x550115=_0x9f6c[_0x43e840];return _0x550115;};'use strict';var FaxAccountEvents=require(_0xc9f6('0x0'));var events=[_0xc9f6('0x1'),_0xc9f6('0x2'),_0xc9f6('0x3')];function createListener(_0xdc40f9,_0x1ab4bf){return function(_0x5227b9){_0x1ab4bf['emit'](_0xdc40f9,_0x5227b9);};}function removeListener(_0x1553d3,_0x1785e9){return function(){FaxAccountEvents[_0xc9f6('0x4')](_0x1553d3,_0x1785e9);};}exports[_0xc9f6('0x5')]=function(_0x2364e6){for(var _0x551e4b=0x0,_0x49eb85=events[_0xc9f6('0x6')];_0x551e4b<_0x49eb85;_0x551e4b++){var _0x16a63a=events[_0x551e4b];var _0x5d2849=createListener(_0xc9f6('0x7')+_0x16a63a,_0x2364e6);FaxAccountEvents['on'](_0x16a63a,_0x5d2849);}}; \ No newline at end of file +var _0xc408=['length','faxAccount:','./faxAccount.events','save','emit','removeListener','register'];(function(_0xa223ad,_0x5a574b){var _0x306d47=function(_0x4b19ab){while(--_0x4b19ab){_0xa223ad['push'](_0xa223ad['shift']());}};_0x306d47(++_0x5a574b);}(_0xc408,0x87));var _0x8c40=function(_0x56f097,_0x2e4a11){_0x56f097=_0x56f097-0x0;var _0x104bfe=_0xc408[_0x56f097];return _0x104bfe;};'use strict';var FaxAccountEvents=require(_0x8c40('0x0'));var events=[_0x8c40('0x1'),'remove','update'];function createListener(_0x16a05a,_0x2aad54){return function(_0x152722){_0x2aad54[_0x8c40('0x2')](_0x16a05a,_0x152722);};}function removeListener(_0x1a59c5,_0x215960){return function(){FaxAccountEvents[_0x8c40('0x3')](_0x1a59c5,_0x215960);};}exports[_0x8c40('0x4')]=function(_0x31db32){for(var _0xef1110=0x0,_0x4c974=events[_0x8c40('0x5')];_0xef1110<_0x4c974;_0xef1110++){var _0x15e2b4=events[_0xef1110];var _0x1944c1=createListener(_0x8c40('0x6')+_0x15e2b4,_0x31db32);FaxAccountEvents['on'](_0x15e2b4,_0x1944c1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0899a97..9958977 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 _0x803c=['addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','/:id/canned_answers','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications'];(function(_0x263664,_0x4779c9){var _0x44e79a=function(_0x456ff5){while(--_0x456ff5){_0x263664['push'](_0x263664['shift']());}};_0x44e79a(++_0x4779c9);}(_0x803c,0x189));var _0xc803=function(_0x4b3308,_0x593e7b){_0x4b3308=_0x4b3308-0x0;var _0x1d07be=_0x803c[_0x4b3308];return _0x1d07be;};'use strict';var multer=require('multer');var util=require(_0xc803('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc803('0x1'));var auth=require(_0xc803('0x2'));var interaction=require(_0xc803('0x3'));var config=require(_0xc803('0x4'));var controller=require('./faxAccount.controller');router[_0xc803('0x5')]('/',auth[_0xc803('0x6')](),controller[_0xc803('0x7')]);router['get'](_0xc803('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xc803('0x5')](_0xc803('0x9'),auth[_0xc803('0x6')](),controller['show']);router[_0xc803('0x5')](_0xc803('0xa'),auth[_0xc803('0x6')](),controller[_0xc803('0xb')]);router[_0xc803('0x5')]('/:id/canned_answers',auth[_0xc803('0x6')](),controller[_0xc803('0xc')]);router[_0xc803('0x5')](_0xc803('0xd'),auth[_0xc803('0x6')](),controller['getInteractions']);router['get'](_0xc803('0xe'),auth[_0xc803('0x6')](),controller[_0xc803('0xf')]);router['get']('/:id/messages',auth[_0xc803('0x6')](),controller[_0xc803('0x10')]);router[_0xc803('0x5')](_0xc803('0x11'),auth['isAuthenticated'](),controller[_0xc803('0x12')]);router[_0xc803('0x13')]('/',auth[_0xc803('0x6')](),controller[_0xc803('0x14')]);router[_0xc803('0x13')](_0xc803('0xa'),auth[_0xc803('0x6')](),controller['addDisposition']);router[_0xc803('0x13')]('/:id/canned_answers',auth[_0xc803('0x6')](),controller[_0xc803('0x15')]);router[_0xc803('0x13')](_0xc803('0xd'),auth['isAuthenticated'](),controller[_0xc803('0x16')]);router[_0xc803('0x13')](_0xc803('0xe'),auth[_0xc803('0x6')](),controller[_0xc803('0x17')]);router[_0xc803('0x13')](_0xc803('0x18'),auth[_0xc803('0x6')](),controller[_0xc803('0x19')]);router[_0xc803('0x13')](_0xc803('0x1a'),auth['isAuthenticated'](),controller[_0xc803('0x1b')]);router[_0xc803('0x13')](_0xc803('0x1c'),auth[_0xc803('0x6')](),controller[_0xc803('0x1d')]);router['post'](_0xc803('0x11'),auth['isAuthenticated'](),controller[_0xc803('0x1e')]);router[_0xc803('0x1f')]('/:id',auth[_0xc803('0x6')](),controller[_0xc803('0x20')]);router[_0xc803('0x21')]('/:id',auth[_0xc803('0x6')](),controller[_0xc803('0x22')]);router[_0xc803('0x21')]('/:id/dispositions',auth[_0xc803('0x6')](),controller[_0xc803('0x23')]);router[_0xc803('0x21')](_0xc803('0x24'),auth[_0xc803('0x6')](),controller['removeAnswers']);router[_0xc803('0x21')]('/:id/users',auth[_0xc803('0x6')](),controller['removeAgents']);module[_0xc803('0x25')]=router; \ No newline at end of file +var _0xa8c3=['/:id/applications','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions'];(function(_0x396f22,_0x4d87a8){var _0x7aeaa6=function(_0x430844){while(--_0x430844){_0x396f22['push'](_0x396f22['shift']());}};_0x7aeaa6(++_0x4d87a8);}(_0xa8c3,0x1ad));var _0x3a8c=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xa8c3[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0x3a8c('0x0'));var util=require(_0x3a8c('0x1'));var path=require(_0x3a8c('0x2'));var timeout=require(_0x3a8c('0x3'));var express=require(_0x3a8c('0x4'));var router=express[_0x3a8c('0x5')]();var fs_extra=require(_0x3a8c('0x6'));var auth=require(_0x3a8c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3a8c('0x8'));var controller=require(_0x3a8c('0x9'));router[_0x3a8c('0xa')]('/',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xc')]);router[_0x3a8c('0xa')]('/describe',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xd')]);router[_0x3a8c('0xa')](_0x3a8c('0xe'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xf')]);router[_0x3a8c('0xa')]('/:id/dispositions',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x10')]);router['get'](_0x3a8c('0x11'),auth['isAuthenticated'](),controller[_0x3a8c('0x12')]);router['get'](_0x3a8c('0x13'),auth['isAuthenticated'](),controller[_0x3a8c('0x14')]);router[_0x3a8c('0xa')](_0x3a8c('0x15'),auth[_0x3a8c('0xb')](),controller['getApplications']);router[_0x3a8c('0xa')]('/:id/messages',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x16')]);router[_0x3a8c('0xa')](_0x3a8c('0x17'),auth['isAuthenticated'](),controller[_0x3a8c('0x18')]);router[_0x3a8c('0x19')]('/',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x1a')]);router[_0x3a8c('0x19')]('/:id/dispositions',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x1b')]);router[_0x3a8c('0x19')](_0x3a8c('0x11'),auth['isAuthenticated'](),controller[_0x3a8c('0x1c')]);router[_0x3a8c('0x19')](_0x3a8c('0x13'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x1d')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x3a8c('0x1e')]);router[_0x3a8c('0x19')](_0x3a8c('0x1f'),auth[_0x3a8c('0xb')](),controller['addAccountApplications']);router[_0x3a8c('0x19')](_0x3a8c('0x20'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x21')]);router[_0x3a8c('0x19')](_0x3a8c('0x22'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x23')]);router[_0x3a8c('0x19')]('/:id/users',auth[_0x3a8c('0xb')](),controller['addAgents']);router[_0x3a8c('0x24')](_0x3a8c('0xe'),auth['isAuthenticated'](),controller[_0x3a8c('0x25')]);router[_0x3a8c('0x26')]('/:id',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x27')]);router['delete'](_0x3a8c('0x28'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x29')]);router[_0x3a8c('0x26')]('/:id/canned_answers',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x2a')]);router[_0x3a8c('0x26')](_0x3a8c('0x17'),auth['isAuthenticated'](),controller[_0x3a8c('0x2b')]);module[_0x3a8c('0x2c')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6da435e..4c06a9f 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 _0xb31a=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x38bc11,_0x24839b){var _0x11f0df=function(_0x4ffa66){while(--_0x4ffa66){_0x38bc11['push'](_0x38bc11['shift']());}};_0x11f0df(++_0x24839b);}(_0xb31a,0xb8));var _0xab31=function(_0x44d96d,_0x3a80c3){_0x44d96d=_0x44d96d-0x0;var _0x3709eb=_0xb31a[_0x44d96d];return _0x3709eb;};'use strict';var Sequelize=require(_0xab31('0x0'));module[_0xab31('0x1')]={'priority':{'type':Sequelize[_0xab31('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xab31('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xab31('0x4')]()},'description':{'type':Sequelize[_0xab31('0x3')]},'interval':{'type':Sequelize[_0xab31('0x3')],'defaultValue':_0xab31('0x5')}}; \ No newline at end of file +var _0x9e66=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9e66,0xcd));var _0x69e6=function(_0xcd3e6d,_0x466d93){_0xcd3e6d=_0xcd3e6d-0x0;var _0x786f01=_0x9e66[_0xcd3e6d];return _0x786f01;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x69e6('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x69e6('0x1')],'allowNull':![],'defaultValue':_0x69e6('0x2')},'appdata':{'type':Sequelize[_0x69e6('0x3')]()},'description':{'type':Sequelize[_0x69e6('0x1')]},'interval':{'type':Sequelize[_0x69e6('0x1')],'defaultValue':_0x69e6('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index bd36927..aa9db56 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 _0x0366=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x30a815,_0x22cdc7){var _0x2f3432=function(_0x2957de){while(--_0x2957de){_0x30a815['push'](_0x30a815['shift']());}};_0x2f3432(++_0x22cdc7);}(_0x0366,0xcf));var _0x6036=function(_0x48ceb3,_0x4ac50e){_0x48ceb3=_0x48ceb3-0x0;var _0x31e325=_0x0366[_0x48ceb3];return _0x31e325;};'use strict';var emlformat=require(_0x6036('0x0'));var rimraf=require(_0x6036('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6036('0x2'));var rp=require(_0x6036('0x3'));var moment=require(_0x6036('0x4'));var BPromise=require(_0x6036('0x5'));var Mustache=require(_0x6036('0x6'));var util=require(_0x6036('0x7'));var path=require(_0x6036('0x8'));var sox=require(_0x6036('0x9'));var csv=require('to-csv');var ejs=require(_0x6036('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6036('0xb'));var squel=require(_0x6036('0xc'));var crypto=require(_0x6036('0xd'));var jsforce=require(_0x6036('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6036('0xf'));var querystring=require(_0x6036('0x10'));var Papa=require(_0x6036('0x11'));var Redis=require(_0x6036('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6036('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6036('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6036('0x15'));var config=require(_0x6036('0x16'));var licenseUtil=require(_0x6036('0x17'));var db=require(_0x6036('0x18'))['db'];function respondWithStatusCode(_0x46b635,_0x188c9a){_0x188c9a=_0x188c9a||0xcc;return function(_0x7fffd8){if(_0x7fffd8){return _0x46b635['sendStatus'](_0x188c9a);}return _0x46b635['status'](_0x188c9a)[_0x6036('0x19')]();};}function respondWithResult(_0x147314,_0x345e77){_0x345e77=_0x345e77||0xc8;return function(_0x57690d){if(_0x57690d){return _0x147314[_0x6036('0x1a')](_0x345e77)[_0x6036('0x1b')](_0x57690d);}};}function respondWithFilteredResult(_0x57648b,_0x3def3f){return function(_0x1f60ed){if(_0x1f60ed){var _0x9e02ef=typeof _0x3def3f[_0x6036('0x1c')]===_0x6036('0x1d')&&typeof _0x3def3f[_0x6036('0x1e')]===_0x6036('0x1d');var _0x5d92d9=_0x1f60ed[_0x6036('0x1f')];var _0x436a5c=_0x9e02ef?0x0:_0x3def3f[_0x6036('0x1c')];var _0x519d95=_0x9e02ef?_0x1f60ed['count']:_0x3def3f[_0x6036('0x1c')]+_0x3def3f['limit'];var _0x16ca49;if(_0x519d95>=_0x5d92d9){_0x519d95=_0x5d92d9;_0x16ca49=0xc8;}else{_0x16ca49=0xce;}_0x57648b[_0x6036('0x1a')](_0x16ca49);return _0x57648b['set'](_0x6036('0x20'),_0x436a5c+'-'+_0x519d95+'/'+_0x5d92d9)['json'](_0x1f60ed);}return null;};}function patchUpdates(_0x3851ae){return function(_0x9837d4){try{jsonpatch[_0x6036('0x21')](_0x9837d4,_0x3851ae,!![]);}catch(_0x56a59a){return BPromise[_0x6036('0x22')](_0x56a59a);}return _0x9837d4[_0x6036('0x23')]();};}function saveUpdates(_0x25aa13,_0x448b31){return function(_0x43f0fd){if(_0x43f0fd){return _0x43f0fd[_0x6036('0x24')](_0x25aa13)[_0x6036('0x25')](function(_0x5f3218){return _0x5f3218;});}return null;};}function removeEntity(_0x5569cb,_0x4cc189){return function(_0x44c09d){if(_0x44c09d){return _0x44c09d[_0x6036('0x26')]()[_0x6036('0x25')](function(){_0x5569cb['status'](0xcc)[_0x6036('0x19')]();});}};}function handleEntityNotFound(_0x1605d8,_0x4ff2bb){return function(_0x1ba570){if(!_0x1ba570){_0x1605d8[_0x6036('0x27')](0x194);}return _0x1ba570;};}function handleError(_0x2b2356,_0x44744c){_0x44744c=_0x44744c||0x1f4;return function(_0x201fad){logger[_0x6036('0x28')](_0x201fad[_0x6036('0x29')]);if(_0x201fad[_0x6036('0x2a')]){delete _0x201fad[_0x6036('0x2a')];}_0x2b2356[_0x6036('0x1a')](_0x44744c)[_0x6036('0x2b')](_0x201fad);};}exports[_0x6036('0x2c')]=function(_0x5d250f,_0xae8648){var _0x4465a1={},_0x4a1ac5={},_0x28a34c={'count':0x0,'rows':[]};var _0x401228=_[_0x6036('0x2d')](db['FaxApplication'][_0x6036('0x2e')],function(_0x5639af){return{'name':_0x5639af[_0x6036('0x2f')],'type':_0x5639af[_0x6036('0x30')][_0x6036('0x31')]};});_0x4a1ac5['model']=_[_0x6036('0x2d')](_0x401228,_0x6036('0x2a'));_0x4a1ac5[_0x6036('0x32')]=_[_0x6036('0x33')](_0x5d250f['query']);_0x4a1ac5['filters']=_['intersection'](_0x4a1ac5[_0x6036('0x34')],_0x4a1ac5[_0x6036('0x32')]);_0x4465a1[_0x6036('0x35')]=_[_0x6036('0x36')](_0x4a1ac5[_0x6036('0x34')],qs[_0x6036('0x37')](_0x5d250f[_0x6036('0x32')][_0x6036('0x37')]));_0x4465a1[_0x6036('0x35')]=_0x4465a1['attributes'][_0x6036('0x38')]?_0x4465a1['attributes']:_0x4a1ac5[_0x6036('0x34')];if(!_0x5d250f['query'][_0x6036('0x39')]('nolimit')){_0x4465a1[_0x6036('0x1e')]=qs['limit'](_0x5d250f[_0x6036('0x32')][_0x6036('0x1e')]);_0x4465a1[_0x6036('0x1c')]=qs['offset'](_0x5d250f[_0x6036('0x32')]['offset']);}_0x4465a1[_0x6036('0x3a')]=qs['sort'](_0x5d250f[_0x6036('0x32')][_0x6036('0x3b')]);_0x4465a1[_0x6036('0x3c')]=qs['filters'](_['pick'](_0x5d250f[_0x6036('0x32')],_0x4a1ac5[_0x6036('0x3d')]),_0x401228);if(_0x5d250f[_0x6036('0x32')][_0x6036('0x3e')]){_0x4465a1['where']=_[_0x6036('0x3f')](_0x4465a1[_0x6036('0x3c')],{'$or':_['map'](_0x401228,function(_0x34dd0f){if(_0x34dd0f['type']!=='VIRTUAL'){var _0x7c9c6d={};_0x7c9c6d[_0x34dd0f['name']]={'$like':'%'+_0x5d250f['query']['filter']+'%'};return _0x7c9c6d;}})});}_0x4465a1=_[_0x6036('0x3f')]({},_0x4465a1,_0x5d250f[_0x6036('0x40')]);var _0x294c3f={'where':_0x4465a1[_0x6036('0x3c')]};return db[_0x6036('0x41')][_0x6036('0x1f')](_0x294c3f)['then'](function(_0x2dfcad){_0x28a34c['count']=_0x2dfcad;if(_0x5d250f['query'][_0x6036('0x42')]){_0x4465a1[_0x6036('0x43')]=[{'all':!![]}];}return db[_0x6036('0x41')][_0x6036('0x44')](_0x4465a1);})[_0x6036('0x25')](function(_0xc7bdad){_0x28a34c[_0x6036('0x45')]=_0xc7bdad;return _0x28a34c;})[_0x6036('0x25')](respondWithFilteredResult(_0xae8648,_0x4465a1))[_0x6036('0x46')](handleError(_0xae8648,null));};exports[_0x6036('0x47')]=function(_0x22cd50,_0x2e0a24){var _0x482874={'raw':!![],'where':{'id':_0x22cd50[_0x6036('0x48')]['id']}},_0x20848d={};_0x20848d[_0x6036('0x34')]=_[_0x6036('0x33')](db[_0x6036('0x41')]['rawAttributes']);_0x20848d[_0x6036('0x32')]=_[_0x6036('0x33')](_0x22cd50[_0x6036('0x32')]);_0x20848d['filters']=_[_0x6036('0x36')](_0x20848d['model'],_0x20848d[_0x6036('0x32')]);_0x482874[_0x6036('0x35')]=_[_0x6036('0x36')](_0x20848d[_0x6036('0x34')],qs[_0x6036('0x37')](_0x22cd50[_0x6036('0x32')][_0x6036('0x37')]));_0x482874['attributes']=_0x482874[_0x6036('0x35')]['length']?_0x482874[_0x6036('0x35')]:_0x20848d[_0x6036('0x34')];if(_0x22cd50[_0x6036('0x32')][_0x6036('0x42')]){_0x482874[_0x6036('0x43')]=[{'all':!![]}];}_0x482874=_['merge']({},_0x482874,_0x22cd50[_0x6036('0x40')]);return db[_0x6036('0x41')][_0x6036('0x49')](_0x482874)['then'](handleEntityNotFound(_0x2e0a24,null))[_0x6036('0x25')](respondWithResult(_0x2e0a24,null))[_0x6036('0x46')](handleError(_0x2e0a24,null));};exports[_0x6036('0x4a')]=function(_0x4f3296,_0x1a26a7){return db[_0x6036('0x41')][_0x6036('0x4a')](_0x4f3296['body'],{})['then'](respondWithResult(_0x1a26a7,0xc9))[_0x6036('0x46')](handleError(_0x1a26a7,null));};exports[_0x6036('0x24')]=function(_0x44f913,_0x23445c){if(_0x44f913[_0x6036('0x4b')]['id']){delete _0x44f913[_0x6036('0x4b')]['id'];}return db[_0x6036('0x41')][_0x6036('0x49')]({'where':{'id':_0x44f913['params']['id']}})['then'](handleEntityNotFound(_0x23445c,null))[_0x6036('0x25')](saveUpdates(_0x44f913[_0x6036('0x4b')],null))[_0x6036('0x25')](respondWithResult(_0x23445c,null))[_0x6036('0x46')](handleError(_0x23445c,null));};exports[_0x6036('0x26')]=function(_0x4ed6bf,_0x3177fd){return db[_0x6036('0x41')][_0x6036('0x49')]({'where':{'id':_0x4ed6bf['params']['id']}})[_0x6036('0x25')](handleEntityNotFound(_0x3177fd,null))[_0x6036('0x25')](removeEntity(_0x3177fd,null))[_0x6036('0x46')](handleError(_0x3177fd,null));}; \ No newline at end of file +var _0x64fc=['sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','create','body','find','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','sendStatus','error','name','send','index','map','FaxApplication','key','model','intersection','query','attributes','fields','length'];(function(_0x29bd71,_0x25921a){var _0x3c316b=function(_0x56fa83){while(--_0x56fa83){_0x29bd71['push'](_0x29bd71['shift']());}};_0x3c316b(++_0x25921a);}(_0x64fc,0x129));var _0xc64f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x64fc[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc64f('0x0'));var jsonpatch=require(_0xc64f('0x1'));var rp=require(_0xc64f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc64f('0x3'));var util=require(_0xc64f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc64f('0x5'));var ejs=require(_0xc64f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc64f('0x7'));var squel=require(_0xc64f('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc64f('0x9'));var toCsv=require(_0xc64f('0x5'));var querystring=require(_0xc64f('0xa'));var Papa=require(_0xc64f('0xb'));var Redis=require(_0xc64f('0xc'));var authService=require(_0xc64f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc64f('0xe'));var hardwareService=require(_0xc64f('0xf'));var logger=require(_0xc64f('0x10'))(_0xc64f('0x11'));var utils=require(_0xc64f('0x12'));var config=require(_0xc64f('0x13'));var licenseUtil=require(_0xc64f('0x14'));var db=require(_0xc64f('0x15'))['db'];function respondWithStatusCode(_0x3a335f,_0x400446){_0x400446=_0x400446||0xcc;return function(_0xa7c600){if(_0xa7c600){return _0x3a335f['sendStatus'](_0x400446);}return _0x3a335f[_0xc64f('0x16')](_0x400446)[_0xc64f('0x17')]();};}function respondWithResult(_0x2248d7,_0x5c16c7){_0x5c16c7=_0x5c16c7||0xc8;return function(_0x35ebe2){if(_0x35ebe2){return _0x2248d7[_0xc64f('0x16')](_0x5c16c7)[_0xc64f('0x18')](_0x35ebe2);}};}function respondWithFilteredResult(_0x2eddb8,_0x18f9d8){return function(_0x345361){if(_0x345361){var _0x943a16=typeof _0x18f9d8['offset']==='undefined'&&typeof _0x18f9d8['limit']===_0xc64f('0x19');var _0x494bf4=_0x345361[_0xc64f('0x1a')];var _0x1fb562=_0x943a16?0x0:_0x18f9d8['offset'];var _0x1ac2ca=_0x943a16?_0x345361[_0xc64f('0x1a')]:_0x18f9d8[_0xc64f('0x1b')]+_0x18f9d8[_0xc64f('0x1c')];var _0x4dd3c2;if(_0x1ac2ca>=_0x494bf4){_0x1ac2ca=_0x494bf4;_0x4dd3c2=0xc8;}else{_0x4dd3c2=0xce;}_0x2eddb8[_0xc64f('0x16')](_0x4dd3c2);return _0x2eddb8[_0xc64f('0x1d')](_0xc64f('0x1e'),_0x1fb562+'-'+_0x1ac2ca+'/'+_0x494bf4)['json'](_0x345361);}return null;};}function patchUpdates(_0x2a13c0){return function(_0x3d668d){try{jsonpatch['apply'](_0x3d668d,_0x2a13c0,!![]);}catch(_0xb383e5){return BPromise[_0xc64f('0x1f')](_0xb383e5);}return _0x3d668d['save']();};}function saveUpdates(_0x4d7160,_0x18f868){return function(_0x40f64b){if(_0x40f64b){return _0x40f64b[_0xc64f('0x20')](_0x4d7160)[_0xc64f('0x21')](function(_0x2ea4eb){return _0x2ea4eb;});}return null;};}function removeEntity(_0x5d391f,_0x2d64d1){return function(_0x14fb38){if(_0x14fb38){return _0x14fb38['destroy']()[_0xc64f('0x21')](function(){_0x5d391f[_0xc64f('0x16')](0xcc)[_0xc64f('0x17')]();});}};}function handleEntityNotFound(_0x3c919a,_0x6b42d7){return function(_0x3a9495){if(!_0x3a9495){_0x3c919a[_0xc64f('0x22')](0x194);}return _0x3a9495;};}function handleError(_0x406ce0,_0x1b386b){_0x1b386b=_0x1b386b||0x1f4;return function(_0x37f8d7){logger[_0xc64f('0x23')](_0x37f8d7['stack']);if(_0x37f8d7[_0xc64f('0x24')]){delete _0x37f8d7[_0xc64f('0x24')];}_0x406ce0[_0xc64f('0x16')](_0x1b386b)[_0xc64f('0x25')](_0x37f8d7);};}exports[_0xc64f('0x26')]=function(_0x5ada75,_0xb4cdb2){var _0x3c880f={},_0x41cb02={},_0x3868e6={'count':0x0,'rows':[]};var _0x923676=_[_0xc64f('0x27')](db[_0xc64f('0x28')]['rawAttributes'],function(_0x2f6923){return{'name':_0x2f6923['fieldName'],'type':_0x2f6923['type'][_0xc64f('0x29')]};});_0x41cb02[_0xc64f('0x2a')]=_[_0xc64f('0x27')](_0x923676,'name');_0x41cb02['query']=_['keys'](_0x5ada75['query']);_0x41cb02['filters']=_[_0xc64f('0x2b')](_0x41cb02[_0xc64f('0x2a')],_0x41cb02[_0xc64f('0x2c')]);_0x3c880f[_0xc64f('0x2d')]=_[_0xc64f('0x2b')](_0x41cb02['model'],qs[_0xc64f('0x2e')](_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x2e')]));_0x3c880f[_0xc64f('0x2d')]=_0x3c880f[_0xc64f('0x2d')][_0xc64f('0x2f')]?_0x3c880f[_0xc64f('0x2d')]:_0x41cb02[_0xc64f('0x2a')];if(!_0x5ada75['query']['hasOwnProperty']('nolimit')){_0x3c880f['limit']=qs[_0xc64f('0x1c')](_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x1c')]);_0x3c880f['offset']=qs[_0xc64f('0x1b')](_0x5ada75[_0xc64f('0x2c')]['offset']);}_0x3c880f['order']=qs[_0xc64f('0x30')](_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x30')]);_0x3c880f[_0xc64f('0x31')]=qs[_0xc64f('0x32')](_[_0xc64f('0x33')](_0x5ada75[_0xc64f('0x2c')],_0x41cb02['filters']),_0x923676);if(_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x34')]){_0x3c880f[_0xc64f('0x31')]=_[_0xc64f('0x35')](_0x3c880f[_0xc64f('0x31')],{'$or':_[_0xc64f('0x27')](_0x923676,function(_0x193ca5){if(_0x193ca5[_0xc64f('0x36')]!==_0xc64f('0x37')){var _0x1433b4={};_0x1433b4[_0x193ca5['name']]={'$like':'%'+_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x34')]+'%'};return _0x1433b4;}})});}_0x3c880f=_['merge']({},_0x3c880f,_0x5ada75[_0xc64f('0x38')]);var _0x5c5452={'where':_0x3c880f['where']};return db[_0xc64f('0x28')][_0xc64f('0x1a')](_0x5c5452)[_0xc64f('0x21')](function(_0x5e4b1d){_0x3868e6['count']=_0x5e4b1d;if(_0x5ada75[_0xc64f('0x2c')][_0xc64f('0x39')]){_0x3c880f[_0xc64f('0x3a')]=[{'all':!![]}];}return db[_0xc64f('0x28')][_0xc64f('0x3b')](_0x3c880f);})['then'](function(_0x39c456){_0x3868e6['rows']=_0x39c456;return _0x3868e6;})['then'](respondWithFilteredResult(_0xb4cdb2,_0x3c880f))[_0xc64f('0x3c')](handleError(_0xb4cdb2,null));};exports[_0xc64f('0x3d')]=function(_0x15aa69,_0xcf3a69){var _0x590c61={'raw':!![],'where':{'id':_0x15aa69[_0xc64f('0x3e')]['id']}},_0x5de8f8={};_0x5de8f8[_0xc64f('0x2a')]=_[_0xc64f('0x3f')](db[_0xc64f('0x28')][_0xc64f('0x40')]);_0x5de8f8[_0xc64f('0x2c')]=_[_0xc64f('0x3f')](_0x15aa69['query']);_0x5de8f8[_0xc64f('0x32')]=_[_0xc64f('0x2b')](_0x5de8f8[_0xc64f('0x2a')],_0x5de8f8[_0xc64f('0x2c')]);_0x590c61[_0xc64f('0x2d')]=_[_0xc64f('0x2b')](_0x5de8f8[_0xc64f('0x2a')],qs[_0xc64f('0x2e')](_0x15aa69['query'][_0xc64f('0x2e')]));_0x590c61['attributes']=_0x590c61['attributes'][_0xc64f('0x2f')]?_0x590c61['attributes']:_0x5de8f8[_0xc64f('0x2a')];if(_0x15aa69[_0xc64f('0x2c')][_0xc64f('0x39')]){_0x590c61[_0xc64f('0x3a')]=[{'all':!![]}];}_0x590c61=_[_0xc64f('0x35')]({},_0x590c61,_0x15aa69[_0xc64f('0x38')]);return db[_0xc64f('0x28')]['find'](_0x590c61)[_0xc64f('0x21')](handleEntityNotFound(_0xcf3a69,null))['then'](respondWithResult(_0xcf3a69,null))[_0xc64f('0x3c')](handleError(_0xcf3a69,null));};exports[_0xc64f('0x41')]=function(_0x50f728,_0x2edf68){return db[_0xc64f('0x28')][_0xc64f('0x41')](_0x50f728[_0xc64f('0x42')],{})[_0xc64f('0x21')](respondWithResult(_0x2edf68,0xc9))[_0xc64f('0x3c')](handleError(_0x2edf68,null));};exports[_0xc64f('0x20')]=function(_0x27ea7b,_0x50ac54){if(_0x27ea7b[_0xc64f('0x42')]['id']){delete _0x27ea7b[_0xc64f('0x42')]['id'];}return db['FaxApplication'][_0xc64f('0x43')]({'where':{'id':_0x27ea7b[_0xc64f('0x3e')]['id']}})[_0xc64f('0x21')](handleEntityNotFound(_0x50ac54,null))[_0xc64f('0x21')](saveUpdates(_0x27ea7b[_0xc64f('0x42')],null))[_0xc64f('0x21')](respondWithResult(_0x50ac54,null))['catch'](handleError(_0x50ac54,null));};exports[_0xc64f('0x44')]=function(_0x5e7160,_0x34ec78){return db[_0xc64f('0x28')][_0xc64f('0x43')]({'where':{'id':_0x5e7160[_0xc64f('0x3e')]['id']}})[_0xc64f('0x21')](handleEntityNotFound(_0x34ec78,null))[_0xc64f('0x21')](removeEntity(_0x34ec78,null))['catch'](handleError(_0x34ec78,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fb5be95..9494175 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 _0x8ba5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ba5,0x150));var _0x58ba=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0x8ba5[_0x53f715];return _0x16c757;};'use strict';var _=require('lodash');var util=require(_0x58ba('0x0'));var logger=require(_0x58ba('0x1'))(_0x58ba('0x2'));var moment=require(_0x58ba('0x3'));var BPromise=require(_0x58ba('0x4'));var rp=require(_0x58ba('0x5'));var fs=require('fs');var path=require(_0x58ba('0x6'));var rimraf=require(_0x58ba('0x7'));var config=require('../../config/environment');var attributes=require(_0x58ba('0x8'));module['exports']=function(_0x152a21,_0x585293){return _0x152a21[_0x58ba('0x9')](_0x58ba('0xa'),attributes,{'tableName':_0x58ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ba('0xc'),'collate':_0x58ba('0xd')});}; \ No newline at end of file +var _0xaf2c=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x51c6df,_0xdf895a){var _0x47efb7=function(_0x19ccfd){while(--_0x19ccfd){_0x51c6df['push'](_0x51c6df['shift']());}};_0x47efb7(++_0xdf895a);}(_0xaf2c,0x69));var _0xcaf2=function(_0x271a7e,_0x59e9df){_0x271a7e=_0x271a7e-0x0;var _0x3f1eaa=_0xaf2c[_0x271a7e];return _0x3f1eaa;};'use strict';var _=require(_0xcaf2('0x0'));var util=require('util');var logger=require(_0xcaf2('0x1'))(_0xcaf2('0x2'));var moment=require(_0xcaf2('0x3'));var BPromise=require(_0xcaf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf2('0x5'));var config=require(_0xcaf2('0x6'));var attributes=require('./faxApplication.attributes');module[_0xcaf2('0x7')]=function(_0x3ccec0,_0x53a130){return _0x3ccec0[_0xcaf2('0x8')](_0xcaf2('0x9'),attributes,{'tableName':_0xcaf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaf2('0xb'),'collate':_0xcaf2('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ea5dcc6..cb77762 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 _0x3d40=['jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxApplication','body','raw','options','where','attributes','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x3d40,0x10d));var _0x03d4=function(_0x38c9bf,_0x126bc7){_0x38c9bf=_0x38c9bf-0x0;var _0x32618d=_0x3d40[_0x38c9bf];return _0x32618d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03d4('0x0'));var fs=require('fs');var Redis=require(_0x03d4('0x1'));var db=require(_0x03d4('0x2'))['db'];var utils=require(_0x03d4('0x3'));var logger=require(_0x03d4('0x4'))(_0x03d4('0x5'));var config=require('../../config/environment');var jayson=require(_0x03d4('0x6'));var client=jayson[_0x03d4('0x7')][_0x03d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59b88c,_0x47675d,_0x33c9f3){return new BPromise(function(_0x22a9ee,_0x134ba2){return client['request'](_0x59b88c,_0x33c9f3)[_0x03d4('0x9')](function(_0x48951e){logger['info'](_0x03d4('0xa'),_0x47675d,_0x03d4('0xb'));logger[_0x03d4('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x47675d,_0x03d4('0xb'),JSON[_0x03d4('0xd')](_0x48951e));if(_0x48951e[_0x03d4('0xe')]){if(_0x48951e[_0x03d4('0xe')]['code']===0x1f4){logger[_0x03d4('0xe')](_0x03d4('0xa'),_0x47675d,_0x48951e[_0x03d4('0xe')]['message']);return _0x134ba2(_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);}logger[_0x03d4('0xe')](_0x03d4('0xa'),_0x47675d,_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);return _0x22a9ee(_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);}else{logger[_0x03d4('0x10')](_0x03d4('0xa'),_0x47675d,_0x03d4('0xb'));_0x22a9ee(_0x48951e[_0x03d4('0x11')]['message']);}})[_0x03d4('0x12')](function(_0x543280){logger['error'](_0x03d4('0xa'),_0x47675d,_0x543280);_0x134ba2(_0x543280);});});}exports[_0x03d4('0x13')]=function(_0x3bf411){var _0x472a5a=this;return new Promise(function(_0x5780f6,_0x35fd53){return db['FaxApplication']['update'](_0x3bf411[_0x03d4('0x14')],{'raw':_0x3bf411['options']?_0x3bf411['options'][_0x03d4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf411[_0x03d4('0x16')]?_0x3bf411[_0x03d4('0x16')][_0x03d4('0x17')]||null:null,'attributes':_0x3bf411[_0x03d4('0x16')]?_0x3bf411['options'][_0x03d4('0x18')]||null:null,'limit':_0x3bf411['options']?_0x3bf411['options']['limit']||null:null})[_0x03d4('0x9')](function(_0x4693a2){logger[_0x03d4('0x10')]('UpdateFaxApplication',_0x3bf411);logger[_0x03d4('0xc')](_0x03d4('0x13'),_0x3bf411,JSON[_0x03d4('0xd')](_0x4693a2));_0x5780f6(_0x4693a2);})['catch'](function(_0x34007d){logger['error'](_0x03d4('0x13'),_0x34007d[_0x03d4('0xf')],_0x3bf411);_0x35fd53(_0x472a5a[_0x03d4('0xe')](0x1f4,_0x34007d[_0x03d4('0xf')]));});});}; \ No newline at end of file +var _0x3d40=['jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxApplication','body','raw','options','where','attributes','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x3d40,0x10d));var _0x03d4=function(_0x300ddd,_0xf3c704){_0x300ddd=_0x300ddd-0x0;var _0x1b9a61=_0x3d40[_0x300ddd];return _0x1b9a61;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03d4('0x0'));var fs=require('fs');var Redis=require(_0x03d4('0x1'));var db=require(_0x03d4('0x2'))['db'];var utils=require(_0x03d4('0x3'));var logger=require(_0x03d4('0x4'))(_0x03d4('0x5'));var config=require('../../config/environment');var jayson=require(_0x03d4('0x6'));var client=jayson[_0x03d4('0x7')][_0x03d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59b88c,_0x47675d,_0x33c9f3){return new BPromise(function(_0x22a9ee,_0x134ba2){return client['request'](_0x59b88c,_0x33c9f3)[_0x03d4('0x9')](function(_0x48951e){logger['info'](_0x03d4('0xa'),_0x47675d,_0x03d4('0xb'));logger[_0x03d4('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x47675d,_0x03d4('0xb'),JSON[_0x03d4('0xd')](_0x48951e));if(_0x48951e[_0x03d4('0xe')]){if(_0x48951e[_0x03d4('0xe')]['code']===0x1f4){logger[_0x03d4('0xe')](_0x03d4('0xa'),_0x47675d,_0x48951e[_0x03d4('0xe')]['message']);return _0x134ba2(_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);}logger[_0x03d4('0xe')](_0x03d4('0xa'),_0x47675d,_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);return _0x22a9ee(_0x48951e[_0x03d4('0xe')][_0x03d4('0xf')]);}else{logger[_0x03d4('0x10')](_0x03d4('0xa'),_0x47675d,_0x03d4('0xb'));_0x22a9ee(_0x48951e[_0x03d4('0x11')]['message']);}})[_0x03d4('0x12')](function(_0x543280){logger['error'](_0x03d4('0xa'),_0x47675d,_0x543280);_0x134ba2(_0x543280);});});}exports[_0x03d4('0x13')]=function(_0x3bf411){var _0x472a5a=this;return new Promise(function(_0x5780f6,_0x35fd53){return db['FaxApplication']['update'](_0x3bf411[_0x03d4('0x14')],{'raw':_0x3bf411['options']?_0x3bf411['options'][_0x03d4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf411[_0x03d4('0x16')]?_0x3bf411[_0x03d4('0x16')][_0x03d4('0x17')]||null:null,'attributes':_0x3bf411[_0x03d4('0x16')]?_0x3bf411['options'][_0x03d4('0x18')]||null:null,'limit':_0x3bf411['options']?_0x3bf411['options']['limit']||null:null})[_0x03d4('0x9')](function(_0x4693a2){logger[_0x03d4('0x10')]('UpdateFaxApplication',_0x3bf411);logger[_0x03d4('0xc')](_0x03d4('0x13'),_0x3bf411,JSON[_0x03d4('0xd')](_0x4693a2));_0x5780f6(_0x4693a2);})['catch'](function(_0x34007d){logger['error'](_0x03d4('0x13'),_0x34007d[_0x03d4('0xf')],_0x3bf411);_0x35fd53(_0x472a5a[_0x03d4('0xe')](0x1f4,_0x34007d[_0x03d4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cae6f09..9a329f4 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x3a4064,_0x12a8e8){var _0x4c40c6=function(_0x231abf){while(--_0x231abf){_0x3a4064['push'](_0x3a4064['shift']());}};_0x4c40c6(++_0x12a8e8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x4cf8=['show','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x4cf8[_0x514bd1];return _0x58a281;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0xe')]);router['put'](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router[_0x84cf('0x11')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2117676..5167feb 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 _0x2a07=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x17ef3a,_0x59959b){var _0x42204b=function(_0x31ca3e){while(--_0x31ca3e){_0x17ef3a['push'](_0x17ef3a['shift']());}};_0x42204b(++_0x59959b);}(_0x2a07,0x74));var _0x72a0=function(_0x3ed4d7,_0x3783e0){_0x3ed4d7=_0x3ed4d7-0x0;var _0x2be1a4=_0x2a07[_0x3ed4d7];return _0x2be1a4;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'closed':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72a0('0x3')]},'disposition':{'type':Sequelize[_0x72a0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x72a0('0x4')]},'note':{'type':Sequelize[_0x72a0('0x4')]},'read1stAt':{'type':Sequelize[_0x72a0('0x3')]},'fax':{'type':Sequelize[_0x72a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72a0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x72a0('0x7')]}}; \ No newline at end of file +var _0x32b6=['ENUM','out','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x321575,_0x458292){var _0x147fc3=function(_0x55d3a6){while(--_0x55d3a6){_0x321575['push'](_0x321575['shift']());}};_0x147fc3(++_0x458292);}(_0x32b6,0x1d1));var _0x632b=function(_0x30c109,_0x10c856){_0x30c109=_0x30c109-0x0;var _0x5dd8d0=_0x32b6[_0x30c109];return _0x5dd8d0;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x632b('0x2')]},'disposition':{'type':Sequelize[_0x632b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x632b('0x3')]},'read1stAt':{'type':Sequelize[_0x632b('0x2')]},'fax':{'type':Sequelize[_0x632b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x632b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x632b('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9a1891b..b60938a 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 _0x6bd7=['filter','$gte','split','format','rows','addTags','setTags','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','count','limit','set','then','sendStatus','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','show','params','model','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','create','body','update','find','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId'];(function(_0x3b7cb6,_0x2e2e6c){var _0x2ab75d=function(_0x1c0ac8){while(--_0x1c0ac8){_0x3b7cb6['push'](_0x3b7cb6['shift']());}};_0x2ab75d(++_0x2e2e6c);}(_0x6bd7,0x1c1));var _0x76bd=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0x6bd7[_0x17dab8];return _0x336fb5;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x76bd('0x0'));var moment=require(_0x76bd('0x1'));var BPromise=require(_0x76bd('0x2'));var util=require(_0x76bd('0x3'));var path=require(_0x76bd('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x76bd('0x5'));var qs=require(_0x76bd('0x6'));var logger=require(_0x76bd('0x7'))(_0x76bd('0x8'));var config=require(_0x76bd('0x9'));var db=require(_0x76bd('0xa'))['db'];config['redis']=_['defaults'](config[_0x76bd('0xb')],{'host':_0x76bd('0xc'),'port':0x18eb});var socket=require(_0x76bd('0xd'))(new Redis(config[_0x76bd('0xb')]));require(_0x76bd('0xe'))[_0x76bd('0xf')](socket);function respondWithStatusCode(_0x27fe4e,_0x14f49f){_0x14f49f=_0x14f49f||0xcc;return function(_0x3aab8f){if(_0x3aab8f){return _0x27fe4e['sendStatus'](_0x14f49f);}return _0x27fe4e['status'](_0x14f49f)['end']();};}function respondWithResult(_0x491303,_0x236183){_0x236183=_0x236183||0xc8;return function(_0x5bf384){if(_0x5bf384){return _0x491303[_0x76bd('0x10')](_0x236183)[_0x76bd('0x11')](_0x5bf384);}};}function respondWithFilteredResult(_0x4b945b,_0x29bcc2){return function(_0x146f2e){if(_0x146f2e){var _0x541322=typeof _0x29bcc2[_0x76bd('0x12')]===_0x76bd('0x13')&&typeof _0x29bcc2['limit']==='undefined';var _0x2fc7f5=_0x146f2e[_0x76bd('0x14')];var _0x36f6ba=_0x541322?0x0:_0x29bcc2[_0x76bd('0x12')];var _0x185638=_0x541322?_0x146f2e['count']:_0x29bcc2[_0x76bd('0x12')]+_0x29bcc2[_0x76bd('0x15')];var _0x5f16b0;if(_0x185638>=_0x2fc7f5){_0x185638=_0x2fc7f5;_0x5f16b0=0xc8;}else{_0x5f16b0=0xce;}_0x4b945b[_0x76bd('0x10')](_0x5f16b0);return _0x4b945b[_0x76bd('0x16')]('Content-Range',_0x36f6ba+'-'+_0x185638+'/'+_0x2fc7f5)[_0x76bd('0x11')](_0x146f2e);}return null;};}function saveUpdates(_0x533749){return function(_0x9d593f){if(_0x9d593f){return _0x9d593f['update'](_0x533749)['then'](function(_0x4c511b){return _0x4c511b;});}return null;};}function removeEntity(_0x38656e){return function(_0x4e7513){if(_0x4e7513){return _0x4e7513['destroy']()[_0x76bd('0x17')](function(){_0x38656e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6b13){return function(_0x258fff){if(!_0x258fff){_0x3c6b13[_0x76bd('0x18')](0x194);}return _0x258fff;};}function handleError(_0x5bab02,_0x59084f){_0x59084f=_0x59084f||0x1f4;return function(_0x19ed35){logger[_0x76bd('0x19')](_0x19ed35[_0x76bd('0x1a')]);if(_0x19ed35[_0x76bd('0x1b')]){delete _0x19ed35['name'];}_0x5bab02[_0x76bd('0x10')](_0x59084f)[_0x76bd('0x1c')](_0x19ed35);};}exports[_0x76bd('0x1d')]=function(_0x43d521,_0x3feaff){var _0x29bc9d={};var _0x3b1c8f=_[_0x76bd('0x1e')](db[_0x76bd('0x1f')][_0x76bd('0x20')],function(_0x59627f){return{'name':_0x59627f[_0x76bd('0x21')],'type':_0x59627f[_0x76bd('0x22')][_0x76bd('0x23')]};});_0x29bc9d=qs[_0x76bd('0x24')](_0x3b1c8f,_0x43d521);return interaction[_0x76bd('0x25')](_0x76bd('0x26'),_0x43d521['query'],_0x43d521[_0x76bd('0x27')],_0x29bc9d,_0x3b1c8f)[_0x76bd('0x17')](respondWithFilteredResult(_0x3feaff,_0x29bc9d))[_0x76bd('0x28')](handleError(_0x3feaff,null));};exports[_0x76bd('0x29')]=function(_0x1fd564,_0x314850){var _0x1060a3={'raw':![],'where':{'id':_0x1fd564[_0x76bd('0x2a')]['id']}},_0x5727fe={};_0x5727fe[_0x76bd('0x2b')]=_['keys'](db[_0x76bd('0x1f')][_0x76bd('0x20')]);_0x5727fe[_0x76bd('0x2c')]=_[_0x76bd('0x2d')](_0x1fd564[_0x76bd('0x2c')]);_0x5727fe[_0x76bd('0x2e')]=_['intersection'](_0x5727fe[_0x76bd('0x2b')],_0x5727fe[_0x76bd('0x2c')]);_0x1060a3[_0x76bd('0x2f')]=_[_0x76bd('0x30')](_0x5727fe[_0x76bd('0x2b')],qs[_0x76bd('0x31')](_0x1fd564[_0x76bd('0x2c')]['fields']));_0x1060a3[_0x76bd('0x2f')]=_0x1060a3[_0x76bd('0x2f')][_0x76bd('0x32')]?_0x1060a3['attributes']:_0x5727fe[_0x76bd('0x2b')];if(_0x1fd564[_0x76bd('0x2c')][_0x76bd('0x33')]){_0x1060a3['include']=[{'all':!![]}];}_0x1060a3=_[_0x76bd('0x34')]({},_0x1060a3,_0x1fd564[_0x76bd('0x35')]);return db[_0x76bd('0x1f')]['find'](_0x1060a3)['then'](handleEntityNotFound(_0x314850,null))[_0x76bd('0x17')](respondWithResult(_0x314850,null))['catch'](handleError(_0x314850,null));};exports[_0x76bd('0x36')]=function(_0x22e80a,_0x1b9977){return db[_0x76bd('0x1f')]['create'](_0x22e80a[_0x76bd('0x37')],{})['then'](respondWithResult(_0x1b9977,0xc9))[_0x76bd('0x28')](handleError(_0x1b9977,null));};exports[_0x76bd('0x38')]=function(_0x3893d6,_0x1a4ab9){if(_0x3893d6[_0x76bd('0x37')]['id']){delete _0x3893d6[_0x76bd('0x37')]['id'];}return db[_0x76bd('0x1f')][_0x76bd('0x39')]({'where':{'id':_0x3893d6['params']['id']}})[_0x76bd('0x17')](handleEntityNotFound(_0x1a4ab9,null))[_0x76bd('0x17')](saveUpdates(_0x3893d6[_0x76bd('0x37')],null))[_0x76bd('0x17')](respondWithResult(_0x1a4ab9,null))[_0x76bd('0x28')](handleError(_0x1a4ab9,null));};exports['destroy']=function(_0x44973b,_0x30f6aa){return db[_0x76bd('0x1f')][_0x76bd('0x39')]({'where':{'id':_0x44973b['params']['id']}})['then'](handleEntityNotFound(_0x30f6aa,null))[_0x76bd('0x17')](removeEntity(_0x30f6aa,null))[_0x76bd('0x28')](handleError(_0x30f6aa,null));};exports['describe']=function(_0x30eef3,_0x41e06f){return db[_0x76bd('0x1f')][_0x76bd('0x3a')]()['then'](respondWithResult(_0x41e06f,null))[_0x76bd('0x28')](handleError(_0x41e06f,null));};exports[_0x76bd('0x3b')]=function(_0x399b6d,_0x39f466){return db['FaxMessage'][_0x76bd('0x39')]({'where':{'id':_0x399b6d[_0x76bd('0x2a')]['id']}})[_0x76bd('0x17')](handleEntityNotFound(_0x39f466,null))['then'](function(_0x3fc4f1){if(_0x3fc4f1){return _0x3fc4f1[_0x76bd('0x3b')](_0x399b6d[_0x76bd('0x37')]['ids'],_[_0x76bd('0x3c')](_0x399b6d[_0x76bd('0x37')],[_0x76bd('0x3d'),'id'])||{});}})[_0x76bd('0x17')](respondWithResult(_0x39f466,null))[_0x76bd('0x28')](handleError(_0x39f466,null));};exports[_0x76bd('0x3e')]=function(_0x55d0c3,_0x3f42f3){var _0x383a15={'raw':![],'where':{}};var _0x522356={};var _0x55af52={'count':0x0,'rows':[]};return db[_0x76bd('0x1f')][_0x76bd('0x3f')]({'where':{'id':_0x55d0c3['params']['id']}})[_0x76bd('0x17')](handleEntityNotFound(_0x3f42f3,null))[_0x76bd('0x17')](function(_0x2ec37a){if(_0x2ec37a){_0x522356[_0x76bd('0x2b')]=_[_0x76bd('0x2d')](db[_0x76bd('0x40')][_0x76bd('0x20')]);_0x522356['query']=_['keys'](_0x55d0c3[_0x76bd('0x2c')]);_0x522356[_0x76bd('0x2e')]=_[_0x76bd('0x30')](_0x522356[_0x76bd('0x2b')],_0x522356[_0x76bd('0x2c')]);_0x383a15[_0x76bd('0x2f')]=_[_0x76bd('0x30')](_0x522356[_0x76bd('0x2b')],qs[_0x76bd('0x31')](_0x55d0c3[_0x76bd('0x2c')]['fields']));_0x383a15[_0x76bd('0x2f')]=_0x383a15['attributes']['length']?_0x383a15[_0x76bd('0x2f')]:_0x522356['model'];if(!_0x55d0c3[_0x76bd('0x2c')][_0x76bd('0x41')](_0x76bd('0x42'))){_0x383a15['limit']=qs['limit'](_0x55d0c3[_0x76bd('0x2c')][_0x76bd('0x15')]);_0x383a15[_0x76bd('0x12')]=qs[_0x76bd('0x12')](_0x55d0c3[_0x76bd('0x2c')][_0x76bd('0x12')]);}_0x383a15[_0x76bd('0x43')]=qs[_0x76bd('0x44')](_0x55d0c3[_0x76bd('0x2c')]['sort']);_0x383a15[_0x76bd('0x45')]=qs[_0x76bd('0x2e')](_['pick'](_0x55d0c3['query'],_0x522356[_0x76bd('0x2e')]));_0x383a15[_0x76bd('0x45')][_0x76bd('0x46')]=_0x2ec37a['id'];if(_0x55d0c3[_0x76bd('0x2c')]['filter']){_0x383a15[_0x76bd('0x45')]=_[_0x76bd('0x34')](_0x383a15[_0x76bd('0x45')],{'$or':_[_0x76bd('0x1e')](_0x383a15[_0x76bd('0x2f')],function(_0x1244d8){var _0x523392={};_0x523392[_0x1244d8]={'$like':'%'+_0x55d0c3[_0x76bd('0x2c')][_0x76bd('0x47')]+'%'};return _0x523392;})});}if(_0x55d0c3[_0x76bd('0x2c')]['$gte']){var _0x26173b=_0x55d0c3['query'][_0x76bd('0x48')][_0x76bd('0x49')](',');var _0x536a20={};_0x536a20[_0x26173b[0x0]]={'$gte':moment(_0x26173b[0x1])[_0x76bd('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x383a15[_0x76bd('0x45')]=_['merge'](_0x383a15[_0x76bd('0x45')],_0x536a20);}_0x383a15=_[_0x76bd('0x34')]({},_0x383a15,_0x55d0c3[_0x76bd('0x35')]);return db[_0x76bd('0x40')]['count']({'where':_0x383a15[_0x76bd('0x45')]})[_0x76bd('0x17')](function(_0x1070ee){_0x55af52[_0x76bd('0x14')]=_0x1070ee;if(_0x55d0c3['query']['includeAll']){_0x383a15['include']=[{'all':!![]}];}return db[_0x76bd('0x40')][_0x76bd('0x25')](_0x383a15);})[_0x76bd('0x17')](function(_0x73a0ff){_0x55af52[_0x76bd('0x4b')]=_0x73a0ff;return _0x55af52;});}})[_0x76bd('0x17')](respondWithFilteredResult(_0x3f42f3,_0x383a15))['catch'](handleError(_0x3f42f3,null));};exports[_0x76bd('0x4c')]=function(_0x25b525,_0x34d529){return db['FaxInteraction'][_0x76bd('0x39')]({'where':{'id':_0x25b525['params']['id']}})[_0x76bd('0x17')](handleEntityNotFound(_0x34d529,null))['then'](function(_0x4cacdd){if(_0x4cacdd){return _0x4cacdd[_0x76bd('0x4d')](_0x25b525[_0x76bd('0x37')][_0x76bd('0x3d')],_[_0x76bd('0x3c')](_0x25b525[_0x76bd('0x37')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x76bd('0x25')]({'attributes':['id',_0x76bd('0x1b'),_0x76bd('0x4e')],'where':{'id':_0x25b525['body'][_0x76bd('0x3d')]}});})[_0x76bd('0x17')](function(_0xf059fe){socket[_0x76bd('0x4f')]('faxInteractionTags:save',{'id':Number(_0x25b525['params']['id']),'tags':_0xf059fe||[]});return{'id':Number(_0x25b525[_0x76bd('0x2a')]['id']),'tags':_0xf059fe||[]};});}})[_0x76bd('0x17')](respondWithResult(_0x34d529,null))[_0x76bd('0x28')](handleError(_0x34d529,null));};exports[_0x76bd('0x50')]=function(_0x149007,_0xed1764){return db[_0x76bd('0x1f')]['find']({'where':{'id':_0x149007['params']['id']}})[_0x76bd('0x17')](handleEntityNotFound(_0xed1764,null))[_0x76bd('0x17')](function(_0x5920e2){if(_0x5920e2){return _0x5920e2[_0x76bd('0x50')](_0x149007['query'][_0x76bd('0x3d')]);}})[_0x76bd('0x17')](respondWithStatusCode(_0xed1764,null))[_0x76bd('0x28')](handleError(_0xed1764,null));};exports['download']=function(_0x228f14,_0x220100){var _0x2a6ea9=moment()[_0x76bd('0x51')]()[_0x76bd('0x52')]();var _0x4bd8f6=path[_0x76bd('0x53')](config[_0x76bd('0x54')],_0x76bd('0x55'),_0x76bd('0x56'),_0x76bd('0x57'));var _0x4f966c=path[_0x76bd('0x53')](config['root'],'server',_0x76bd('0x56'),_0x76bd('0x58'));var _0x3cb04e=path['join'](_0x4bd8f6,_0x2a6ea9);var _0x55c434=util[_0x76bd('0x4a')](_0x76bd('0x59'),_0x228f14['params']['id'],_0x2a6ea9);var _0x36a4af=path[_0x76bd('0x53')](_0x4bd8f6,_0x55c434);var _0x4b81b2=[];_0x4b81b2[_0x76bd('0x5a')]({'model':db[_0x76bd('0x5b')],'as':_0x76bd('0x5b'),'raw':!![]});var _0x344c94=[{'model':db[_0x76bd('0x40')],'as':_0x76bd('0x5c'),'attributes':['id',_0x76bd('0x37'),_0x76bd('0x5d')],'include':_0x4b81b2}];return db[_0x76bd('0x1f')]['find']({'where':{'id':_0x228f14['params']['id']},'include':_0x344c94})[_0x76bd('0x17')](handleEntityNotFound(_0x220100,null))['then'](function(_0x59e172){if(_0x59e172&&_0x59e172['Messages']){var _0x10e553=_0x59e172['get']({'plain':!![]});fs[_0x76bd('0x5e')](_0x3cb04e);for(var _0x483cdf=0x0;_0x483cdf<_0x10e553[_0x76bd('0x5c')][_0x76bd('0x32')];_0x483cdf++){var _0x22ed39=_0x10e553[_0x76bd('0x5c')][_0x483cdf][_0x76bd('0x5b')];if(_0x22ed39){var _0x1720d9=path[_0x76bd('0x53')](_0x4f966c,_0x22ed39[_0x76bd('0x5f')]);if(fs[_0x76bd('0x60')](_0x1720d9)){fs[_0x76bd('0x61')](_0x1720d9)[_0x76bd('0x62')](fs[_0x76bd('0x63')](path[_0x76bd('0x53')](_0x3cb04e,_0x22ed39[_0x76bd('0x5f')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x1682c2,_0x540993){zipdir(_0x3cb04e,{'saveTo':_0x36a4af},function(_0x160455,_0xc93e92){if(_0x160455)return _0x540993(_0x160455);return _0x1682c2(_0xc93e92);});})[_0x76bd('0x17')](function(){return new BPromise(function(_0x1c2d5c,_0x3b37f8){rimraf(_0x3cb04e,function(_0x5bdc2b){if(_0x5bdc2b)_0x3b37f8(_0x5bdc2b);return _0x1c2d5c();});});})[_0x76bd('0x17')](function(){return _0x220100[_0x76bd('0x64')](_0x36a4af,_0x55c434,function(_0x57dce9){if(_0x57dce9){console[_0x76bd('0x65')](_0x76bd('0x66'),_0x57dce9);}else{fs[_0x76bd('0x67')](_0x36a4af);}});});});}else{return _0x220100[_0x76bd('0x18')](0xc8);}})[_0x76bd('0x28')](handleError(_0x220100,null));}; \ No newline at end of file +var _0x73ed=['nolimit','order','sort','where','FaxInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','spread','Tag','color','removeTags','download','unix','join','root','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','err','unlinkSync','zip-dir','bluebird','util','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','index','map','FaxInteraction','type','key','findAll','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','include','merge','options','create','body','update','find','destroy','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x73ed,0x19d));var _0xd73e=function(_0x4d5ae7,_0xba6ca7){_0x4d5ae7=_0x4d5ae7-0x0;var _0x3bdbb1=_0x73ed[_0x4d5ae7];return _0x3bdbb1;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd73e('0x0'));var moment=require('moment');var BPromise=require(_0xd73e('0x1'));var util=require(_0xd73e('0x2'));var path=require(_0xd73e('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd73e('0x4'));var interaction=require(_0xd73e('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xd73e('0x6'))(_0xd73e('0x7'));var config=require(_0xd73e('0x8'));var db=require(_0xd73e('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd73e('0xa'),'port':0x18eb});var socket=require(_0xd73e('0xb'))(new Redis(config[_0xd73e('0xc')]));require(_0xd73e('0xd'))[_0xd73e('0xe')](socket);function respondWithStatusCode(_0x2b95f5,_0x45248c){_0x45248c=_0x45248c||0xcc;return function(_0x1dc451){if(_0x1dc451){return _0x2b95f5[_0xd73e('0xf')](_0x45248c);}return _0x2b95f5['status'](_0x45248c)[_0xd73e('0x10')]();};}function respondWithResult(_0xed1404,_0x4e3e01){_0x4e3e01=_0x4e3e01||0xc8;return function(_0x418594){if(_0x418594){return _0xed1404[_0xd73e('0x11')](_0x4e3e01)[_0xd73e('0x12')](_0x418594);}};}function respondWithFilteredResult(_0x1863db,_0x4a7bb0){return function(_0x484e64){if(_0x484e64){var _0x5d40d7=typeof _0x4a7bb0[_0xd73e('0x13')]===_0xd73e('0x14')&&typeof _0x4a7bb0[_0xd73e('0x15')]==='undefined';var _0x27b1f6=_0x484e64[_0xd73e('0x16')];var _0x5a4fdd=_0x5d40d7?0x0:_0x4a7bb0[_0xd73e('0x13')];var _0x559a20=_0x5d40d7?_0x484e64[_0xd73e('0x16')]:_0x4a7bb0[_0xd73e('0x13')]+_0x4a7bb0[_0xd73e('0x15')];var _0x311fd0;if(_0x559a20>=_0x27b1f6){_0x559a20=_0x27b1f6;_0x311fd0=0xc8;}else{_0x311fd0=0xce;}_0x1863db[_0xd73e('0x11')](_0x311fd0);return _0x1863db[_0xd73e('0x17')](_0xd73e('0x18'),_0x5a4fdd+'-'+_0x559a20+'/'+_0x27b1f6)[_0xd73e('0x12')](_0x484e64);}return null;};}function saveUpdates(_0x26012d){return function(_0x15a9ef){if(_0x15a9ef){return _0x15a9ef['update'](_0x26012d)[_0xd73e('0x19')](function(_0x47e750){return _0x47e750;});}return null;};}function removeEntity(_0x10eef2){return function(_0x4bd895){if(_0x4bd895){return _0x4bd895['destroy']()[_0xd73e('0x19')](function(){_0x10eef2[_0xd73e('0x11')](0xcc)[_0xd73e('0x10')]();});}};}function handleEntityNotFound(_0x523765){return function(_0x38f004){if(!_0x38f004){_0x523765[_0xd73e('0xf')](0x194);}return _0x38f004;};}function handleError(_0xbf5cf5,_0x79b1d5){_0x79b1d5=_0x79b1d5||0x1f4;return function(_0x5a9281){logger[_0xd73e('0x1a')](_0x5a9281[_0xd73e('0x1b')]);if(_0x5a9281['name']){delete _0x5a9281[_0xd73e('0x1c')];}_0xbf5cf5[_0xd73e('0x11')](_0x79b1d5)['send'](_0x5a9281);};}exports[_0xd73e('0x1d')]=function(_0x3c2743,_0x4538b0){var _0x3f9aac={};var _0x2aad0d=_[_0xd73e('0x1e')](db[_0xd73e('0x1f')]['rawAttributes'],function(_0x54e2d5){return{'name':_0x54e2d5['fieldName'],'type':_0x54e2d5[_0xd73e('0x20')][_0xd73e('0x21')]};});_0x3f9aac=qs['getOptions'](_0x2aad0d,_0x3c2743);return interaction[_0xd73e('0x22')]('fax',_0x3c2743[_0xd73e('0x23')],_0x3c2743[_0xd73e('0x24')],_0x3f9aac,_0x2aad0d)[_0xd73e('0x19')](respondWithFilteredResult(_0x4538b0,_0x3f9aac))[_0xd73e('0x25')](handleError(_0x4538b0,null));};exports[_0xd73e('0x26')]=function(_0x27c42f,_0x1d92ad){var _0x1ea777={'raw':![],'where':{'id':_0x27c42f[_0xd73e('0x27')]['id']}},_0x2af974={};_0x2af974[_0xd73e('0x28')]=_[_0xd73e('0x29')](db[_0xd73e('0x1f')][_0xd73e('0x2a')]);_0x2af974[_0xd73e('0x23')]=_[_0xd73e('0x29')](_0x27c42f[_0xd73e('0x23')]);_0x2af974[_0xd73e('0x2b')]=_[_0xd73e('0x2c')](_0x2af974[_0xd73e('0x28')],_0x2af974[_0xd73e('0x23')]);_0x1ea777[_0xd73e('0x2d')]=_['intersection'](_0x2af974[_0xd73e('0x28')],qs[_0xd73e('0x2e')](_0x27c42f[_0xd73e('0x23')][_0xd73e('0x2e')]));_0x1ea777[_0xd73e('0x2d')]=_0x1ea777[_0xd73e('0x2d')][_0xd73e('0x2f')]?_0x1ea777[_0xd73e('0x2d')]:_0x2af974[_0xd73e('0x28')];if(_0x27c42f['query']['includeAll']){_0x1ea777[_0xd73e('0x30')]=[{'all':!![]}];}_0x1ea777=_[_0xd73e('0x31')]({},_0x1ea777,_0x27c42f[_0xd73e('0x32')]);return db[_0xd73e('0x1f')]['find'](_0x1ea777)[_0xd73e('0x19')](handleEntityNotFound(_0x1d92ad,null))[_0xd73e('0x19')](respondWithResult(_0x1d92ad,null))[_0xd73e('0x25')](handleError(_0x1d92ad,null));};exports[_0xd73e('0x33')]=function(_0x3f6d1d,_0x1e9c4f){return db[_0xd73e('0x1f')][_0xd73e('0x33')](_0x3f6d1d[_0xd73e('0x34')],{})[_0xd73e('0x19')](respondWithResult(_0x1e9c4f,0xc9))[_0xd73e('0x25')](handleError(_0x1e9c4f,null));};exports[_0xd73e('0x35')]=function(_0xba7636,_0x15ef7e){if(_0xba7636[_0xd73e('0x34')]['id']){delete _0xba7636[_0xd73e('0x34')]['id'];}return db[_0xd73e('0x1f')][_0xd73e('0x36')]({'where':{'id':_0xba7636[_0xd73e('0x27')]['id']}})[_0xd73e('0x19')](handleEntityNotFound(_0x15ef7e,null))[_0xd73e('0x19')](saveUpdates(_0xba7636[_0xd73e('0x34')],null))['then'](respondWithResult(_0x15ef7e,null))[_0xd73e('0x25')](handleError(_0x15ef7e,null));};exports[_0xd73e('0x37')]=function(_0x28e719,_0x4a7403){return db[_0xd73e('0x1f')]['find']({'where':{'id':_0x28e719[_0xd73e('0x27')]['id']}})['then'](handleEntityNotFound(_0x4a7403,null))['then'](removeEntity(_0x4a7403,null))[_0xd73e('0x25')](handleError(_0x4a7403,null));};exports['describe']=function(_0x2bb574,_0x29ab07){return db[_0xd73e('0x1f')]['describe']()[_0xd73e('0x19')](respondWithResult(_0x29ab07,null))['catch'](handleError(_0x29ab07,null));};exports['addMessage']=function(_0x1eaaed,_0x4172bd){return db[_0xd73e('0x38')][_0xd73e('0x36')]({'where':{'id':_0x1eaaed[_0xd73e('0x27')]['id']}})[_0xd73e('0x19')](handleEntityNotFound(_0x4172bd,null))[_0xd73e('0x19')](function(_0x95548f){if(_0x95548f){return _0x95548f['addMessage'](_0x1eaaed[_0xd73e('0x34')][_0xd73e('0x39')],_[_0xd73e('0x3a')](_0x1eaaed[_0xd73e('0x34')],[_0xd73e('0x39'),'id'])||{});}})['then'](respondWithResult(_0x4172bd,null))[_0xd73e('0x25')](handleError(_0x4172bd,null));};exports[_0xd73e('0x3b')]=function(_0x2cfd6f,_0x559d58){var _0x2deed8={'raw':![],'where':{}};var _0x43a4e4={};var _0x2694ea={'count':0x0,'rows':[]};return db[_0xd73e('0x1f')][_0xd73e('0x3c')]({'where':{'id':_0x2cfd6f[_0xd73e('0x27')]['id']}})[_0xd73e('0x19')](handleEntityNotFound(_0x559d58,null))[_0xd73e('0x19')](function(_0x41c876){if(_0x41c876){_0x43a4e4[_0xd73e('0x28')]=_['keys'](db[_0xd73e('0x38')]['rawAttributes']);_0x43a4e4['query']=_[_0xd73e('0x29')](_0x2cfd6f['query']);_0x43a4e4[_0xd73e('0x2b')]=_[_0xd73e('0x2c')](_0x43a4e4[_0xd73e('0x28')],_0x43a4e4['query']);_0x2deed8[_0xd73e('0x2d')]=_[_0xd73e('0x2c')](_0x43a4e4['model'],qs['fields'](_0x2cfd6f[_0xd73e('0x23')][_0xd73e('0x2e')]));_0x2deed8[_0xd73e('0x2d')]=_0x2deed8['attributes'][_0xd73e('0x2f')]?_0x2deed8[_0xd73e('0x2d')]:_0x43a4e4['model'];if(!_0x2cfd6f['query'][_0xd73e('0x3d')](_0xd73e('0x3e'))){_0x2deed8[_0xd73e('0x15')]=qs[_0xd73e('0x15')](_0x2cfd6f[_0xd73e('0x23')][_0xd73e('0x15')]);_0x2deed8['offset']=qs['offset'](_0x2cfd6f['query'][_0xd73e('0x13')]);}_0x2deed8[_0xd73e('0x3f')]=qs[_0xd73e('0x40')](_0x2cfd6f['query'][_0xd73e('0x40')]);_0x2deed8[_0xd73e('0x41')]=qs[_0xd73e('0x2b')](_['pick'](_0x2cfd6f[_0xd73e('0x23')],_0x43a4e4[_0xd73e('0x2b')]));_0x2deed8[_0xd73e('0x41')][_0xd73e('0x42')]=_0x41c876['id'];if(_0x2cfd6f[_0xd73e('0x23')]['filter']){_0x2deed8[_0xd73e('0x41')]=_[_0xd73e('0x31')](_0x2deed8[_0xd73e('0x41')],{'$or':_[_0xd73e('0x1e')](_0x2deed8[_0xd73e('0x2d')],function(_0xc21c8a){var _0x3bd269={};_0x3bd269[_0xc21c8a]={'$like':'%'+_0x2cfd6f[_0xd73e('0x23')]['filter']+'%'};return _0x3bd269;})});}if(_0x2cfd6f[_0xd73e('0x23')][_0xd73e('0x43')]){var _0x151ffe=_0x2cfd6f[_0xd73e('0x23')][_0xd73e('0x43')][_0xd73e('0x44')](',');var _0x2c6d31={};_0x2c6d31[_0x151ffe[0x0]]={'$gte':moment(_0x151ffe[0x1])['format'](_0xd73e('0x45'))};_0x2deed8[_0xd73e('0x41')]=_[_0xd73e('0x31')](_0x2deed8[_0xd73e('0x41')],_0x2c6d31);}_0x2deed8=_[_0xd73e('0x31')]({},_0x2deed8,_0x2cfd6f[_0xd73e('0x32')]);return db[_0xd73e('0x38')][_0xd73e('0x16')]({'where':_0x2deed8[_0xd73e('0x41')]})[_0xd73e('0x19')](function(_0x49622b){_0x2694ea[_0xd73e('0x16')]=_0x49622b;if(_0x2cfd6f['query']['includeAll']){_0x2deed8[_0xd73e('0x30')]=[{'all':!![]}];}return db['FaxMessage'][_0xd73e('0x22')](_0x2deed8);})[_0xd73e('0x19')](function(_0x34123f){_0x2694ea[_0xd73e('0x46')]=_0x34123f;return _0x2694ea;});}})[_0xd73e('0x19')](respondWithFilteredResult(_0x559d58,_0x2deed8))[_0xd73e('0x25')](handleError(_0x559d58,null));};exports['addTags']=function(_0x39f474,_0x937fa5){return db[_0xd73e('0x1f')][_0xd73e('0x36')]({'where':{'id':_0x39f474[_0xd73e('0x27')]['id']}})[_0xd73e('0x19')](handleEntityNotFound(_0x937fa5,null))[_0xd73e('0x19')](function(_0x418fb9){if(_0x418fb9){return _0x418fb9['setTags'](_0x39f474[_0xd73e('0x34')][_0xd73e('0x39')],_[_0xd73e('0x3a')](_0x39f474[_0xd73e('0x34')],[_0xd73e('0x39'),'id'])||{})[_0xd73e('0x47')](function(){return db[_0xd73e('0x48')][_0xd73e('0x22')]({'attributes':['id',_0xd73e('0x1c'),_0xd73e('0x49')],'where':{'id':_0x39f474[_0xd73e('0x34')][_0xd73e('0x39')]}});})[_0xd73e('0x19')](function(_0x5cba98){socket['emit']('faxInteractionTags:save',{'id':Number(_0x39f474['params']['id']),'tags':_0x5cba98||[]});return{'id':Number(_0x39f474[_0xd73e('0x27')]['id']),'tags':_0x5cba98||[]};});}})[_0xd73e('0x19')](respondWithResult(_0x937fa5,null))[_0xd73e('0x25')](handleError(_0x937fa5,null));};exports[_0xd73e('0x4a')]=function(_0x205371,_0x561586){return db[_0xd73e('0x1f')][_0xd73e('0x36')]({'where':{'id':_0x205371[_0xd73e('0x27')]['id']}})[_0xd73e('0x19')](handleEntityNotFound(_0x561586,null))[_0xd73e('0x19')](function(_0x458e22){if(_0x458e22){return _0x458e22[_0xd73e('0x4a')](_0x205371['query'][_0xd73e('0x39')]);}})['then'](respondWithStatusCode(_0x561586,null))[_0xd73e('0x25')](handleError(_0x561586,null));};exports[_0xd73e('0x4b')]=function(_0x8b83b4,_0x298d6f){var _0x171677=moment()[_0xd73e('0x4c')]()['toString']();var _0x10a2c4=path[_0xd73e('0x4d')](config[_0xd73e('0x4e')],'server','files',_0xd73e('0x4f'));var _0xb3afd5=path[_0xd73e('0x4d')](config[_0xd73e('0x4e')],'server','files',_0xd73e('0x50'));var _0x4e04cf=path['join'](_0x10a2c4,_0x171677);var _0x93442=util[_0xd73e('0x51')](_0xd73e('0x52'),_0x8b83b4[_0xd73e('0x27')]['id'],_0x171677);var _0x20e70a=path[_0xd73e('0x4d')](_0x10a2c4,_0x93442);var _0xea024c=[];_0xea024c[_0xd73e('0x53')]({'model':db[_0xd73e('0x54')],'as':'Attachment','raw':!![]});var _0x2438c1=[{'model':db[_0xd73e('0x38')],'as':_0xd73e('0x55'),'attributes':['id',_0xd73e('0x34'),_0xd73e('0x56')],'include':_0xea024c}];return db[_0xd73e('0x1f')]['find']({'where':{'id':_0x8b83b4['params']['id']},'include':_0x2438c1})['then'](handleEntityNotFound(_0x298d6f,null))[_0xd73e('0x19')](function(_0x287bec){if(_0x287bec&&_0x287bec['Messages']){var _0x27caf1=_0x287bec[_0xd73e('0x57')]({'plain':!![]});fs[_0xd73e('0x58')](_0x4e04cf);for(var _0x32412d=0x0;_0x32412d<_0x27caf1[_0xd73e('0x55')][_0xd73e('0x2f')];_0x32412d++){var _0x4c0497=_0x27caf1[_0xd73e('0x55')][_0x32412d][_0xd73e('0x54')];if(_0x4c0497){var _0x5bfaeb=path[_0xd73e('0x4d')](_0xb3afd5,_0x4c0497[_0xd73e('0x59')]);if(fs[_0xd73e('0x5a')](_0x5bfaeb)){fs['createReadStream'](_0x5bfaeb)[_0xd73e('0x5b')](fs[_0xd73e('0x5c')](path[_0xd73e('0x4d')](_0x4e04cf,_0x4c0497[_0xd73e('0x59')])));}}}return BPromise['resolve']()[_0xd73e('0x19')](function(){return new BPromise(function(_0x16384b,_0x352be3){zipdir(_0x4e04cf,{'saveTo':_0x20e70a},function(_0x5ec56d,_0x5d9183){if(_0x5ec56d)return _0x352be3(_0x5ec56d);return _0x16384b(_0x5d9183);});})[_0xd73e('0x19')](function(){return new BPromise(function(_0x471cd9,_0x685996){rimraf(_0x4e04cf,function(_0x1912a6){if(_0x1912a6)_0x685996(_0x1912a6);return _0x471cd9();});});})[_0xd73e('0x19')](function(){return _0x298d6f['download'](_0x20e70a,_0x93442,function(_0x2b8ae3){if(_0x2b8ae3){console['log'](_0xd73e('0x5d'),_0x2b8ae3);}else{fs[_0xd73e('0x5e')](_0x20e70a);}});});});}else{return _0x298d6f[_0xd73e('0xf')](0xc8);}})['catch'](handleError(_0x298d6f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3861422..857a6df 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 _0xa3c9=['setMaxListeners','save','update','remove','setDataValue','Users','findAll','then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x2769e5,_0x26444b){var _0x3150fb=function(_0x5cc337){while(--_0x5cc337){_0x2769e5['push'](_0x2769e5['shift']());}};_0x3150fb(++_0x26444b);}(_0xa3c9,0x161));var _0x9a3c=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xa3c9[_0xcaf223];return _0x17e00d;};'use strict';var EventEmitter=require(_0x9a3c('0x0'));var FaxInteraction=require(_0x9a3c('0x1'))['db'][_0x9a3c('0x2')];var FaxMessage=require(_0x9a3c('0x1'))['db'][_0x9a3c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9a3c('0x4')](0x0);var events={'afterCreate':_0x9a3c('0x5'),'afterUpdate':_0x9a3c('0x6'),'afterDestroy':_0x9a3c('0x7')};function emitEvent(_0x2d5099){return function(_0x35a1c9,_0xa8d72,_0x94afea){_0x35a1c9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x209246){_0x35a1c9[_0x9a3c('0x8')](_0x9a3c('0x9'),_0x209246['map'](function(_0x371f5e){return{'id':_0x371f5e['id']};}));return FaxMessage[_0x9a3c('0xa')]({'where':{'FaxInteractionId':_0x35a1c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a3c('0xb')](function(_0x3598e1){_0x35a1c9[_0x9a3c('0x8')]('unreadMessages',_0x3598e1[_0x9a3c('0xc')]);FaxInteractionEvents[_0x9a3c('0xd')](_0x2d5099+':'+_0x35a1c9['id'],_0x35a1c9);FaxInteractionEvents['emit'](_0x2d5099,_0x35a1c9);_0x94afea(null);})[_0x9a3c('0xe')](_0x94afea(null));};}for(var e in events){if(events[_0x9a3c('0xf')](e)){var event=events[e];FaxInteraction[_0x9a3c('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x2e21=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x5df394,_0x34981a){var _0x2584c8=function(_0x25a714){while(--_0x25a714){_0x5df394['push'](_0x5df394['shift']());}};_0x2584c8(++_0x34981a);}(_0x2e21,0x1d0));var _0x12e2=function(_0x2fa37b,_0x423dea){_0x2fa37b=_0x2fa37b-0x0;var _0x17581b=_0x2e21[_0x2fa37b];return _0x17581b;};'use strict';var EventEmitter=require(_0x12e2('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x12e2('0x1')];var FaxMessage=require(_0x12e2('0x2'))['db'][_0x12e2('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x12e2('0x4')](0x0);var events={'afterCreate':_0x12e2('0x5'),'afterUpdate':_0x12e2('0x6'),'afterDestroy':_0x12e2('0x7')};function emitEvent(_0x17663f){return function(_0x1bed26,_0x2a4cb1,_0x2f8ad8){_0x1bed26[_0x12e2('0x8')]({'attributes':['id'],'raw':!![]})[_0x12e2('0x9')](function(_0x1ab93e){_0x1bed26[_0x12e2('0xa')](_0x12e2('0xb'),_0x1ab93e[_0x12e2('0xc')](function(_0x6849f5){return{'id':_0x6849f5['id']};}));return FaxMessage[_0x12e2('0xd')]({'where':{'FaxInteractionId':_0x1bed26['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xb6fea8){_0x1bed26[_0x12e2('0xa')]('unreadMessages',_0xb6fea8[_0x12e2('0xe')]);FaxInteractionEvents[_0x12e2('0xf')](_0x17663f+':'+_0x1bed26['id'],_0x1bed26);FaxInteractionEvents[_0x12e2('0xf')](_0x17663f,_0x1bed26);_0x2f8ad8(null);})[_0x12e2('0x10')](_0x2f8ad8(null));};}for(var e in events){if(events[_0x12e2('0x11')](e)){var event=events[e];FaxInteraction[_0x12e2('0x12')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index eb20fcf..0b77c7c 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 _0x4ec4=['FaxInteraction','fax_interactions','changed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x4ec4,0x125));var _0x44ec=function(_0x2593bc,_0x443a54){_0x2593bc=_0x2593bc-0x0;var _0x257e86=_0x4ec4[_0x2593bc];return _0x257e86;};'use strict';var _=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var logger=require(_0x44ec('0x2'))('api');var moment=require(_0x44ec('0x3'));var BPromise=require(_0x44ec('0x4'));var rp=require(_0x44ec('0x5'));var fs=require('fs');var path=require(_0x44ec('0x6'));var rimraf=require(_0x44ec('0x7'));var config=require(_0x44ec('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x44ec('0x9')]=function(_0x16b97d,_0x525902){return _0x16b97d[_0x44ec('0xa')](_0x44ec('0xb'),attributes,{'tableName':_0x44ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x217427,_0x111a61,_0x750cac){if(_0x217427[_0x44ec('0xd')]('closed')){_0x217427[_0x44ec('0xe')]=moment()[_0x44ec('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x750cac(null,_0x217427);}}});}; \ No newline at end of file +var _0x6c2c=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x524744,_0x5e6d95){var _0x16a38c=function(_0x44c698){while(--_0x44c698){_0x524744['push'](_0x524744['shift']());}};_0x16a38c(++_0x5e6d95);}(_0x6c2c,0x158));var _0xc6c2=function(_0x596b07,_0x5795fd){_0x596b07=_0x596b07-0x0;var _0xecb3bb=_0x6c2c[_0x596b07];return _0xecb3bb;};'use strict';var _=require('lodash');var util=require(_0xc6c2('0x0'));var logger=require(_0xc6c2('0x1'))(_0xc6c2('0x2'));var moment=require(_0xc6c2('0x3'));var BPromise=require(_0xc6c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6c2('0x5'));var rimraf=require(_0xc6c2('0x6'));var config=require(_0xc6c2('0x7'));var attributes=require(_0xc6c2('0x8'));module[_0xc6c2('0x9')]=function(_0x30ad0b,_0x2433ad){return _0x30ad0b[_0xc6c2('0xa')](_0xc6c2('0xb'),attributes,{'tableName':_0xc6c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x490e12,_0x2f1609,_0x178763){if(_0x490e12[_0xc6c2('0xd')](_0xc6c2('0xe'))){_0x490e12[_0xc6c2('0xf')]=moment()[_0xc6c2('0x10')](_0xc6c2('0x11'));}_0x178763(null,_0x490e12);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c8385ba..26b57fa 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 _0x0f8c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateFaxInteraction','update','options','raw','limit','stringify','catch','AddTagsToFaxInteraction','FaxInteraction','where','addTags','body','ids','omit','spread','AddTags','lodash','util'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x0f8c,0xb2));var _0xc0f8=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x0f8c[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require(_0xc0f8('0x0'));var util=require(_0xc0f8('0x1'));var moment=require('moment');var BPromise=require(_0xc0f8('0x2'));var rs=require(_0xc0f8('0x3'));var fs=require('fs');var Redis=require(_0xc0f8('0x4'));var db=require(_0xc0f8('0x5'))['db'];var utils=require(_0xc0f8('0x6'));var logger=require(_0xc0f8('0x7'))(_0xc0f8('0x8'));var config=require(_0xc0f8('0x9'));var jayson=require(_0xc0f8('0xa'));var client=jayson[_0xc0f8('0xb')][_0xc0f8('0xc')]({'port':0x232a});config[_0xc0f8('0xd')]=_[_0xc0f8('0xe')](config[_0xc0f8('0xd')],{'host':_0xc0f8('0xf'),'port':0x18eb});var socket=require(_0xc0f8('0x10'))(new Redis(config[_0xc0f8('0xd')]));require(_0xc0f8('0x11'))[_0xc0f8('0x12')](socket);function respondWithRpcPromise(_0x275058,_0x379259,_0x1411d3){return new BPromise(function(_0x54dd37,_0x4bb1fa){return client[_0xc0f8('0x13')](_0x275058,_0x1411d3)[_0xc0f8('0x14')](function(_0x433236){logger[_0xc0f8('0x15')](_0xc0f8('0x16'),_0x379259,'request\x20sent');logger[_0xc0f8('0x17')](_0xc0f8('0x18'),_0x379259,_0xc0f8('0x19'),JSON['stringify'](_0x433236));if(_0x433236[_0xc0f8('0x1a')]){if(_0x433236[_0xc0f8('0x1a')]['code']===0x1f4){logger[_0xc0f8('0x1a')](_0xc0f8('0x16'),_0x379259,_0x433236[_0xc0f8('0x1a')]['message']);return _0x4bb1fa(_0x433236[_0xc0f8('0x1a')][_0xc0f8('0x1b')]);}logger[_0xc0f8('0x1a')](_0xc0f8('0x16'),_0x379259,_0x433236[_0xc0f8('0x1a')][_0xc0f8('0x1b')]);return _0x54dd37(_0x433236['error'][_0xc0f8('0x1b')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x379259,_0xc0f8('0x19'));_0x54dd37(_0x433236[_0xc0f8('0x1c')][_0xc0f8('0x1b')]);}})['catch'](function(_0x1db195){logger['error'](_0xc0f8('0x16'),_0x379259,_0x1db195);_0x4bb1fa(_0x1db195);});});}exports[_0xc0f8('0x1d')]=function(_0x3ddbad){var _0x51ac67=this;return new Promise(function(_0x4e1213,_0x196fb6){return db['FaxInteraction'][_0xc0f8('0x1e')](_0x3ddbad['body'],{'raw':_0x3ddbad[_0xc0f8('0x1f')]?_0x3ddbad[_0xc0f8('0x1f')][_0xc0f8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ddbad[_0xc0f8('0x1f')]?_0x3ddbad['options']['where']||null:null,'attributes':_0x3ddbad['options']?_0x3ddbad[_0xc0f8('0x1f')]['attributes']||null:null,'limit':_0x3ddbad['options']?_0x3ddbad[_0xc0f8('0x1f')][_0xc0f8('0x21')]||null:null})['then'](function(_0x584216){logger[_0xc0f8('0x15')](_0xc0f8('0x1d'),_0x3ddbad);logger[_0xc0f8('0x17')](_0xc0f8('0x1d'),_0x3ddbad,JSON[_0xc0f8('0x22')](_0x584216));_0x4e1213(_0x584216);})[_0xc0f8('0x23')](function(_0x3fd16b){logger[_0xc0f8('0x1a')](_0xc0f8('0x1d'),_0x3fd16b[_0xc0f8('0x1b')],_0x3ddbad);_0x196fb6(_0x51ac67[_0xc0f8('0x1a')](0x1f4,_0x3fd16b[_0xc0f8('0x1b')]));});});};exports[_0xc0f8('0x24')]=function(_0xe52568){return new Promise(function(_0x4c49b2,_0x205332){return db[_0xc0f8('0x25')]['find']({'where':_0xe52568['options']?_0xe52568[_0xc0f8('0x1f')][_0xc0f8('0x26')]||null:null})['then'](function(_0x1a23ce){if(_0x1a23ce){return _0x1a23ce[_0xc0f8('0x27')](_0xe52568[_0xc0f8('0x28')][_0xc0f8('0x29')],_[_0xc0f8('0x2a')](_0xe52568[_0xc0f8('0x28')],['ids','id'])||{});}})[_0xc0f8('0x2b')](function(_0x211e67){logger[_0xc0f8('0x15')](_0xc0f8('0x2c'),_0xe52568);logger['debug'](_0xc0f8('0x2c'),_0xe52568,JSON[_0xc0f8('0x22')](_0x211e67));_0x4c49b2(_0x211e67);})[_0xc0f8('0x23')](function(_0x4f3d51){logger[_0xc0f8('0x1a')](_0xc0f8('0x2c'),_0x4f3d51['message'],_0xe52568);_0x205332(_this[_0xc0f8('0x1a')](0x1f4,_0x4f3d51[_0xc0f8('0x1b')]));});});}; \ No newline at end of file +var _0x505a=['ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','find'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x505a,0x144));var _0xa505=function(_0x3535f2,_0x9ef189){_0x3535f2=_0x3535f2-0x0;var _0x51f83e=_0x505a[_0x3535f2];return _0x51f83e;};'use strict';var _=require(_0xa505('0x0'));var util=require(_0xa505('0x1'));var moment=require('moment');var BPromise=require(_0xa505('0x2'));var rs=require(_0xa505('0x3'));var fs=require('fs');var Redis=require(_0xa505('0x4'));var db=require(_0xa505('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa505('0x6'));var jayson=require(_0xa505('0x7'));var client=jayson[_0xa505('0x8')][_0xa505('0x9')]({'port':0x232a});config[_0xa505('0xa')]=_[_0xa505('0xb')](config[_0xa505('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa505('0xc'))(new Redis(config[_0xa505('0xa')]));require('./faxInteraction.socket')[_0xa505('0xd')](socket);function respondWithRpcPromise(_0x8bbc51,_0x2a3276,_0x3dfede){return new BPromise(function(_0x534b3d,_0x3fa219){return client[_0xa505('0xe')](_0x8bbc51,_0x3dfede)[_0xa505('0xf')](function(_0x4230c9){logger[_0xa505('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x2a3276,'request\x20sent');logger[_0xa505('0x11')](_0xa505('0x12'),_0x2a3276,'request\x20sent',JSON['stringify'](_0x4230c9));if(_0x4230c9['error']){if(_0x4230c9[_0xa505('0x13')][_0xa505('0x14')]===0x1f4){logger[_0xa505('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x2a3276,_0x4230c9[_0xa505('0x13')][_0xa505('0x15')]);return _0x3fa219(_0x4230c9[_0xa505('0x13')][_0xa505('0x15')]);}logger[_0xa505('0x13')](_0xa505('0x16'),_0x2a3276,_0x4230c9[_0xa505('0x13')][_0xa505('0x15')]);return _0x534b3d(_0x4230c9[_0xa505('0x13')][_0xa505('0x15')]);}else{logger[_0xa505('0x10')](_0xa505('0x16'),_0x2a3276,'request\x20sent');_0x534b3d(_0x4230c9[_0xa505('0x17')][_0xa505('0x15')]);}})[_0xa505('0x18')](function(_0x2e3031){logger[_0xa505('0x13')](_0xa505('0x16'),_0x2a3276,_0x2e3031);_0x3fa219(_0x2e3031);});});}exports['UpdateFaxInteraction']=function(_0x3fa4c1){var _0xcaac5a=this;return new Promise(function(_0x4795ae,_0x1f25d8){return db[_0xa505('0x19')][_0xa505('0x1a')](_0x3fa4c1[_0xa505('0x1b')],{'raw':_0x3fa4c1['options']?_0x3fa4c1[_0xa505('0x1c')][_0xa505('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fa4c1['options']?_0x3fa4c1['options'][_0xa505('0x1e')]||null:null,'attributes':_0x3fa4c1[_0xa505('0x1c')]?_0x3fa4c1[_0xa505('0x1c')][_0xa505('0x1f')]||null:null,'limit':_0x3fa4c1[_0xa505('0x1c')]?_0x3fa4c1[_0xa505('0x1c')][_0xa505('0x20')]||null:null})[_0xa505('0xf')](function(_0x42974e){logger[_0xa505('0x10')](_0xa505('0x21'),_0x3fa4c1);logger[_0xa505('0x11')]('UpdateFaxInteraction',_0x3fa4c1,JSON[_0xa505('0x22')](_0x42974e));_0x4795ae(_0x42974e);})[_0xa505('0x18')](function(_0x55984f){logger[_0xa505('0x13')](_0xa505('0x21'),_0x55984f[_0xa505('0x15')],_0x3fa4c1);_0x1f25d8(_0xcaac5a[_0xa505('0x13')](0x1f4,_0x55984f[_0xa505('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x496dc8){return new Promise(function(_0x3b0dc8,_0x22068e){return db[_0xa505('0x19')][_0xa505('0x23')]({'where':_0x496dc8[_0xa505('0x1c')]?_0x496dc8['options'][_0xa505('0x1e')]||null:null})[_0xa505('0xf')](function(_0x256f9f){if(_0x256f9f){return _0x256f9f['addTags'](_0x496dc8[_0xa505('0x1b')][_0xa505('0x24')],_[_0xa505('0x25')](_0x496dc8['body'],['ids','id'])||{});}})[_0xa505('0x26')](function(_0x3c22c4){logger[_0xa505('0x10')](_0xa505('0x27'),_0x496dc8);logger[_0xa505('0x11')]('AddTags',_0x496dc8,JSON['stringify'](_0x3c22c4));_0x3b0dc8(_0x3c22c4);})[_0xa505('0x18')](function(_0x4b8425){logger[_0xa505('0x13')](_0xa505('0x27'),_0x4b8425[_0xa505('0x15')],_0x496dc8);_0x22068e(_this[_0xa505('0x13')](0x1f4,_0x4b8425[_0xa505('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 63b9312..f9b533c 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 _0xb583=['register','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb583,0x98));var _0x3b58=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb583[_0x167cc1];return _0x10bc4b;};'use strict';var FaxInteractionEvents=require(_0x3b58('0x0'));var events=['save',_0x3b58('0x1'),_0x3b58('0x2')];function createListener(_0x250b36,_0x52a58a){return function(_0xa6cab){_0x52a58a['emit'](_0x250b36,_0xa6cab);};}function removeListener(_0x1619b1,_0x1dbc78){return function(){FaxInteractionEvents['removeListener'](_0x1619b1,_0x1dbc78);};}exports[_0x3b58('0x3')]=function(_0x49361d){for(var _0x11b210=0x0,_0x5dc019=events['length'];_0x11b210<_0x5dc019;_0x11b210++){var _0x18efb0=events[_0x11b210];var _0x257f78=createListener(_0x3b58('0x4')+_0x18efb0,_0x49361d);FaxInteractionEvents['on'](_0x18efb0,_0x257f78);}}; \ No newline at end of file +var _0xf7c0=['save','emit','removeListener','register','length','faxInteraction:'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xf7c0,0x1a4));var _0x0f7c=function(_0x28881b,_0x16e4c3){_0x28881b=_0x28881b-0x0;var _0x31b0c0=_0xf7c0[_0x28881b];return _0x31b0c0;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0f7c('0x0'),'remove','update'];function createListener(_0x3646a2,_0x5d3c52){return function(_0x1ea4aa){_0x5d3c52[_0x0f7c('0x1')](_0x3646a2,_0x1ea4aa);};}function removeListener(_0x67364,_0xab7ea2){return function(){FaxInteractionEvents[_0x0f7c('0x2')](_0x67364,_0xab7ea2);};}exports[_0x0f7c('0x3')]=function(_0x4e132c){for(var _0xf4cf30=0x0,_0x18b6c9=events[_0x0f7c('0x4')];_0xf4cf30<_0x18b6c9;_0xf4cf30++){var _0x390113=events[_0xf4cf30];var _0x745189=createListener(_0x0f7c('0x5')+_0x390113,_0x4e132c);FaxInteractionEvents['on'](_0x390113,_0x745189);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 79aa695..4ed54d9 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 _0x06ce=['/:id','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','describe','isAuthenticated','getMessages','download','create','post','/:id/messages','/:id/tags','tracked','faxinteraction:addtags','addTags','put'];(function(_0xb15637,_0x87eb64){var _0x1802d5=function(_0x33ea4){while(--_0x33ea4){_0xb15637['push'](_0xb15637['shift']());}};_0x1802d5(++_0x87eb64);}(_0x06ce,0xf7));var _0xe06c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x06ce[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xe06c('0x0'));var util=require(_0xe06c('0x1'));var path=require(_0xe06c('0x2'));var timeout=require(_0xe06c('0x3'));var express=require('express');var router=express[_0xe06c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe06c('0x5'));var config=require(_0xe06c('0x6'));var controller=require(_0xe06c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe06c('0x8')]);router[_0xe06c('0x9')](_0xe06c('0xa'),auth['isAuthenticated'](),controller[_0xe06c('0xb')]);router['get']('/:id',auth[_0xe06c('0xc')](),controller['show']);router['get']('/:id/messages',auth[_0xe06c('0xc')](),controller[_0xe06c('0xd')]);router[_0xe06c('0x9')]('/:id/download',auth[_0xe06c('0xc')](),controller[_0xe06c('0xe')]);router['post']('/',auth[_0xe06c('0xc')](),controller[_0xe06c('0xf')]);router[_0xe06c('0x10')](_0xe06c('0x11'),auth[_0xe06c('0xc')](),controller['addMessage']);router[_0xe06c('0x10')](_0xe06c('0x12'),auth[_0xe06c('0xc')](),interaction[_0xe06c('0x13')]('fax',_0xe06c('0x14')),controller[_0xe06c('0x15')]);router[_0xe06c('0x16')](_0xe06c('0x17'),auth[_0xe06c('0xc')](),interaction[_0xe06c('0x13')]('fax',_0xe06c('0x18')),controller[_0xe06c('0x19')]);router[_0xe06c('0x1a')](_0xe06c('0x17'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xe06c('0x1b')),controller['destroy']);router[_0xe06c('0x1a')](_0xe06c('0x12'),auth[_0xe06c('0xc')](),controller[_0xe06c('0x1c')]);module[_0xe06c('0x1d')]=router; \ No newline at end of file +var _0x3c14=['/:id/tags','tracked','fax','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/:id/messages','/:id/download','download','create'];(function(_0x5eadb8,_0x208a41){var _0x30d042=function(_0x472766){while(--_0x472766){_0x5eadb8['push'](_0x5eadb8['shift']());}};_0x30d042(++_0x208a41);}(_0x3c14,0x186));var _0x43c1=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x3c14[_0x32f9ca];return _0x52e083;};'use strict';var multer=require(_0x43c1('0x0'));var util=require('util');var path=require(_0x43c1('0x1'));var timeout=require(_0x43c1('0x2'));var express=require(_0x43c1('0x3'));var router=express['Router']();var fs_extra=require(_0x43c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x43c1('0x5'));var config=require(_0x43c1('0x6'));var controller=require(_0x43c1('0x7'));router[_0x43c1('0x8')]('/',auth[_0x43c1('0x9')](),controller[_0x43c1('0xa')]);router[_0x43c1('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x43c1('0x9')](),controller['show']);router['get'](_0x43c1('0xb'),auth[_0x43c1('0x9')](),controller['getMessages']);router['get'](_0x43c1('0xc'),auth[_0x43c1('0x9')](),controller[_0x43c1('0xd')]);router['post']('/',auth[_0x43c1('0x9')](),controller[_0x43c1('0xe')]);router['post']('/:id/messages',auth[_0x43c1('0x9')](),controller['addMessage']);router['post'](_0x43c1('0xf'),auth[_0x43c1('0x9')](),interaction[_0x43c1('0x10')](_0x43c1('0x11'),'faxinteraction:addtags'),controller[_0x43c1('0x12')]);router[_0x43c1('0x13')](_0x43c1('0x14'),auth['isAuthenticated'](),interaction[_0x43c1('0x10')](_0x43c1('0x11'),_0x43c1('0x15')),controller[_0x43c1('0x16')]);router[_0x43c1('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x43c1('0x10')](_0x43c1('0x11'),_0x43c1('0x18')),controller[_0x43c1('0x19')]);router[_0x43c1('0x17')]('/:id/tags',auth[_0x43c1('0x9')](),controller['removeTags']);module[_0x43c1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bc6efd1..c4acd6f 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 _0xcc73=['TEXT','ENUM','out','exports'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xcc73[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x3cc7('0x0')]={'body':{'type':Sequelize[_0x3cc7('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3cc7('0x2')]('in','out'),'defaultValue':_0x3cc7('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xedd9=['exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xedd9,0xfc));var _0x9edd=function(_0x24bcaa,_0x254634){_0x24bcaa=_0x24bcaa-0x0;var _0x16de50=_0xedd9[_0x24bcaa];return _0x16de50;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'body':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9edd('0x4')]('in',_0x9edd('0x5')),'defaultValue':_0x9edd('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9edd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7765eb3..8c3b4db 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 _0x2773=['isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','nolimit','order','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','params','intersection','length','find','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','User','SIP/%s','rejectmessage','create','CmContact','findOne'];(function(_0x154b4c,_0xa38e2){var _0x100586=function(_0x2912a8){while(--_0x2912a8){_0x154b4c['push'](_0x154b4c['shift']());}};_0x100586(++_0xa38e2);}(_0x2773,0x1c9));var _0x3277=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2773[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x3277('0x0'));var rimraf=require(_0x3277('0x1'));var zipdir=require(_0x3277('0x2'));var jsonpatch=require(_0x3277('0x3'));var rp=require(_0x3277('0x4'));var moment=require(_0x3277('0x5'));var BPromise=require(_0x3277('0x6'));var Mustache=require(_0x3277('0x7'));var util=require(_0x3277('0x8'));var path=require(_0x3277('0x9'));var sox=require(_0x3277('0xa'));var csv=require(_0x3277('0xb'));var ejs=require(_0x3277('0xc'));var fs=require('fs');var fs_extra=require(_0x3277('0xd'));var _=require(_0x3277('0xe'));var squel=require(_0x3277('0xf'));var crypto=require(_0x3277('0x10'));var jsforce=require(_0x3277('0x11'));var deskjs=require(_0x3277('0x12'));var toCsv=require('to-csv');var querystring=require(_0x3277('0x13'));var Papa=require(_0x3277('0x14'));var Redis=require(_0x3277('0x15'));var authService=require(_0x3277('0x16'));var qs=require(_0x3277('0x17'));var as=require(_0x3277('0x18'));var hardwareService=require(_0x3277('0x19'));var logger=require(_0x3277('0x1a'))('api');var utils=require(_0x3277('0x1b'));var config=require(_0x3277('0x1c'));var licenseUtil=require(_0x3277('0x1d'));var db=require(_0x3277('0x1e'))['db'];config[_0x3277('0x1f')]=_[_0x3277('0x20')](config['redis'],{'host':_0x3277('0x21'),'port':0x18eb});var socket=require(_0x3277('0x22'))(new Redis(config['redis']));require(_0x3277('0x23'))[_0x3277('0x24')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3277('0x25')][_0x3277('0x26')]({'port':0x232c});var client9002=jayson[_0x3277('0x25')][_0x3277('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x192eab,_0x2684e6,_0x20cfa7,_0x53dd04){return new BPromise(function(_0x20d241,_0x355bfe){var _0xf24e44=_0x53dd04||client;return _0xf24e44[_0x3277('0x27')](_0x192eab,_0x20cfa7)[_0x3277('0x28')](function(_0x2a884c){logger[_0x3277('0x29')](_0x3277('0x2a'),_0x2684e6,_0x3277('0x2b'));logger[_0x3277('0x2c')](_0x3277('0x2d'),_0x2684e6,_0x3277('0x2b'),JSON[_0x3277('0x2e')](_0x2a884c));if(_0x2a884c['error']){if(_0x2a884c['error'][_0x3277('0x2f')]===0x1f4){logger[_0x3277('0x30')](_0x3277('0x2a'),_0x2684e6,_0x2a884c['error'][_0x3277('0x31')]);return _0x355bfe(_0x2a884c['error'][_0x3277('0x31')]);}logger['error'](_0x3277('0x2a'),_0x2684e6,_0x2a884c[_0x3277('0x30')][_0x3277('0x31')]);return _0x20d241(_0x2a884c[_0x3277('0x30')][_0x3277('0x31')]);}else{logger['info'](_0x3277('0x2a'),_0x2684e6,_0x3277('0x2b'));_0x20d241(_0x2a884c[_0x3277('0x32')]['message']);}})[_0x3277('0x33')](function(_0x1ff00d){logger[_0x3277('0x30')](_0x3277('0x2a'),_0x2684e6,_0x1ff00d);_0x355bfe(_0x1ff00d);});});}function respondWithStatusCode(_0x287115,_0x9e7bda){_0x9e7bda=_0x9e7bda||0xcc;return function(_0x90ac28){if(_0x90ac28){return _0x287115['sendStatus'](_0x9e7bda);}return _0x287115[_0x3277('0x34')](_0x9e7bda)['end']();};}function respondWithResult(_0x420fd2,_0x34efcd){_0x34efcd=_0x34efcd||0xc8;return function(_0x1c2cb3){if(_0x1c2cb3){return _0x420fd2['status'](_0x34efcd)[_0x3277('0x35')](_0x1c2cb3);}};}function respondWithFilteredResult(_0x5d64e7,_0x686869){return function(_0x14cabb){if(_0x14cabb){var _0x2d419b=typeof _0x686869[_0x3277('0x36')]===_0x3277('0x37')&&typeof _0x686869[_0x3277('0x38')]===_0x3277('0x37');var _0x2d99ef=_0x14cabb[_0x3277('0x39')];var _0x2ef1c5=_0x2d419b?0x0:_0x686869[_0x3277('0x36')];var _0x43ca3f=_0x2d419b?_0x14cabb['count']:_0x686869[_0x3277('0x36')]+_0x686869[_0x3277('0x38')];var _0x1c6815;if(_0x43ca3f>=_0x2d99ef){_0x43ca3f=_0x2d99ef;_0x1c6815=0xc8;}else{_0x1c6815=0xce;}_0x5d64e7[_0x3277('0x34')](_0x1c6815);return _0x5d64e7['set'](_0x3277('0x3a'),_0x2ef1c5+'-'+_0x43ca3f+'/'+_0x2d99ef)[_0x3277('0x35')](_0x14cabb);}return null;};}function patchUpdates(_0x5225e7){return function(_0x2e2c55){try{jsonpatch['apply'](_0x2e2c55,_0x5225e7,!![]);}catch(_0x1251f1){return BPromise[_0x3277('0x3b')](_0x1251f1);}return _0x2e2c55[_0x3277('0x3c')]();};}function saveUpdates(_0x3d748a,_0x378978){return function(_0x23717e){if(_0x23717e){return _0x23717e[_0x3277('0x3d')](_0x3d748a)[_0x3277('0x28')](function(_0x148669){return _0x148669;});}return null;};}function removeEntity(_0x511a43,_0x119a3c){return function(_0x5164a6){if(_0x5164a6){return _0x5164a6[_0x3277('0x3e')]()[_0x3277('0x28')](function(){_0x511a43[_0x3277('0x34')](0xcc)[_0x3277('0x3f')]();});}};}function handleEntityNotFound(_0x337fac,_0x2e9f64){return function(_0x16d4f6){if(!_0x16d4f6){_0x337fac[_0x3277('0x40')](0x194);}return _0x16d4f6;};}function handleError(_0x56ea39,_0x300ff7){_0x300ff7=_0x300ff7||0x1f4;return function(_0x4716d1){logger[_0x3277('0x30')](_0x4716d1[_0x3277('0x41')]);if(_0x4716d1['name']){delete _0x4716d1[_0x3277('0x42')];}_0x56ea39[_0x3277('0x34')](_0x300ff7)[_0x3277('0x43')](_0x4716d1);};}exports['index']=function(_0x94ea4b,_0x5178b4){var _0x4da385={},_0x52c2e2={},_0x1b80a1={'count':0x0,'rows':[]};var _0x375945=_[_0x3277('0x44')](db[_0x3277('0x45')][_0x3277('0x46')],function(_0x366885){return{'name':_0x366885[_0x3277('0x47')],'type':_0x366885['type'][_0x3277('0x48')]};});_0x52c2e2[_0x3277('0x49')]=_[_0x3277('0x44')](_0x375945,_0x3277('0x42'));_0x52c2e2[_0x3277('0x4a')]=_[_0x3277('0x4b')](_0x94ea4b[_0x3277('0x4a')]);_0x52c2e2[_0x3277('0x4c')]=_['intersection'](_0x52c2e2['model'],_0x52c2e2[_0x3277('0x4a')]);_0x4da385[_0x3277('0x4d')]=_['intersection'](_0x52c2e2[_0x3277('0x49')],qs[_0x3277('0x4e')](_0x94ea4b[_0x3277('0x4a')][_0x3277('0x4e')]));_0x4da385[_0x3277('0x4d')]=_0x4da385[_0x3277('0x4d')]['length']?_0x4da385['attributes']:_0x52c2e2[_0x3277('0x49')];if(!_0x94ea4b[_0x3277('0x4a')]['hasOwnProperty'](_0x3277('0x4f'))){_0x4da385[_0x3277('0x38')]=qs['limit'](_0x94ea4b[_0x3277('0x4a')]['limit']);_0x4da385[_0x3277('0x36')]=qs[_0x3277('0x36')](_0x94ea4b[_0x3277('0x4a')][_0x3277('0x36')]);}_0x4da385[_0x3277('0x50')]=qs['sort'](_0x94ea4b['query']['sort']);_0x4da385['where']=qs['filters'](_['pick'](_0x94ea4b[_0x3277('0x4a')],_0x52c2e2[_0x3277('0x4c')]),_0x375945);if(_0x94ea4b[_0x3277('0x4a')][_0x3277('0x51')]){_0x4da385[_0x3277('0x52')]=_[_0x3277('0x53')](_0x4da385[_0x3277('0x52')],{'$or':_[_0x3277('0x44')](_0x375945,function(_0x2a581a){if(_0x2a581a[_0x3277('0x54')]!==_0x3277('0x55')){var _0x2655ce={};_0x2655ce[_0x2a581a[_0x3277('0x42')]]={'$like':'%'+_0x94ea4b[_0x3277('0x4a')]['filter']+'%'};return _0x2655ce;}})});}_0x4da385=_[_0x3277('0x53')]({},_0x4da385,_0x94ea4b[_0x3277('0x56')]);var _0xc7942d={'where':_0x4da385[_0x3277('0x52')]};return db['FaxMessage'][_0x3277('0x39')](_0xc7942d)[_0x3277('0x28')](function(_0x2badb1){_0x1b80a1[_0x3277('0x39')]=_0x2badb1;if(_0x94ea4b[_0x3277('0x4a')][_0x3277('0x57')]){_0x4da385[_0x3277('0x58')]=[{'all':!![]}];}return db[_0x3277('0x45')]['findAll'](_0x4da385);})[_0x3277('0x28')](function(_0x2e7cb7){_0x1b80a1[_0x3277('0x59')]=_0x2e7cb7;return _0x1b80a1;})[_0x3277('0x28')](respondWithFilteredResult(_0x5178b4,_0x4da385))[_0x3277('0x33')](handleError(_0x5178b4,null));};exports['show']=function(_0xd3c656,_0x1561bc){var _0x1e3e62={'raw':!![],'where':{'id':_0xd3c656[_0x3277('0x5a')]['id']}},_0x4081e9={};_0x4081e9[_0x3277('0x49')]=_[_0x3277('0x4b')](db[_0x3277('0x45')][_0x3277('0x46')]);_0x4081e9[_0x3277('0x4a')]=_['keys'](_0xd3c656[_0x3277('0x4a')]);_0x4081e9['filters']=_[_0x3277('0x5b')](_0x4081e9[_0x3277('0x49')],_0x4081e9[_0x3277('0x4a')]);_0x1e3e62['attributes']=_[_0x3277('0x5b')](_0x4081e9[_0x3277('0x49')],qs[_0x3277('0x4e')](_0xd3c656[_0x3277('0x4a')]['fields']));_0x1e3e62[_0x3277('0x4d')]=_0x1e3e62['attributes'][_0x3277('0x5c')]?_0x1e3e62[_0x3277('0x4d')]:_0x4081e9[_0x3277('0x49')];if(_0xd3c656['query'][_0x3277('0x57')]){_0x1e3e62['include']=[{'all':!![]}];}_0x1e3e62=_[_0x3277('0x53')]({},_0x1e3e62,_0xd3c656[_0x3277('0x56')]);return db[_0x3277('0x45')][_0x3277('0x5d')](_0x1e3e62)[_0x3277('0x28')](handleEntityNotFound(_0x1561bc,null))[_0x3277('0x28')](respondWithResult(_0x1561bc,null))['catch'](handleError(_0x1561bc,null));};exports[_0x3277('0x3d')]=function(_0x1424e7,_0x2a384e){if(_0x1424e7[_0x3277('0x5e')]['id']){delete _0x1424e7['body']['id'];}return db['FaxMessage'][_0x3277('0x5d')]({'where':{'id':_0x1424e7[_0x3277('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a384e,null))[_0x3277('0x28')](saveUpdates(_0x1424e7[_0x3277('0x5e')],null))['then'](respondWithResult(_0x2a384e,null))[_0x3277('0x33')](handleError(_0x2a384e,null));};exports['destroy']=function(_0x510ebc,_0x3f5e66){return db[_0x3277('0x45')]['find']({'where':{'id':_0x510ebc[_0x3277('0x5a')]['id']}})[_0x3277('0x28')](handleEntityNotFound(_0x3f5e66,null))[_0x3277('0x28')](removeEntity(_0x3f5e66,null))['catch'](handleError(_0x3f5e66,null));};exports[_0x3277('0x5f')]=function(_0x5d0691,_0x3cad97){return db[_0x3277('0x45')][_0x3277('0x5f')]()[_0x3277('0x28')](respondWithResult(_0x3cad97,null))['catch'](handleError(_0x3cad97,null));};var interaction_log=require(_0x3277('0x1a'))('fax-interactions');exports[_0x3277('0x60')]=function(_0x37b9e3,_0x7d8ee1,_0x12ef06){var _0x2e71ce={'agent':{},'channel':_0x3277('0x61')};if(_0x37b9e3[_0x3277('0x5e')]['id']){delete _0x37b9e3['body']['id'];}_0x37b9e3[_0x3277('0x5e')][_0x3277('0x62')]=!![];_0x37b9e3['body'][_0x3277('0x63')]=moment()[_0x3277('0x64')](_0x3277('0x65'));_0x37b9e3[_0x3277('0x5e')][_0x3277('0x66')]=_0x37b9e3[_0x3277('0x5e')][_0x3277('0x66')]||_0x37b9e3[_0x3277('0x67')]['id'];_0x2e71ce[_0x3277('0x68')]['id']=_0x37b9e3[_0x3277('0x5e')][_0x3277('0x66')];return db[_0x3277('0x45')][_0x3277('0x5d')]({'where':{'id':_0x37b9e3[_0x3277('0x5a')]['id'],'UserId':null}})[_0x3277('0x28')](handleEntityNotFound(_0x7d8ee1,null))[_0x3277('0x28')](saveUpdates(_0x37b9e3['body'],null))['then'](function(_0x478bfb){if(_0x478bfb){_0x2e71ce[_0x3277('0x31')]=_0x478bfb[_0x3277('0x69')]({'plain':!![]});return db[_0x3277('0x6a')][_0x3277('0x5d')]({'where':{'id':_0x478bfb[_0x3277('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x7d8ee1,null))[_0x3277('0x28')](function(_0x4bb914){if(_0x4bb914){return _0x4bb914[_0x3277('0x3d')]({'UserId':_0x37b9e3['body'][_0x3277('0x66')],'read1stAt':_['isNil'](_0x4bb914[_0x3277('0x6c')])?moment()[_0x3277('0x64')](_0x3277('0x65')):undefined});}return null;})[_0x3277('0x28')](function(_0x204cc6){if(_0x204cc6){_0x2e71ce[_0x3277('0x6d')]=_0x204cc6[_0x3277('0x69')]({'plain':!![]});interaction_log[_0x3277('0x29')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37b9e3[_0x3277('0x67')]['id'],_0x37b9e3['user'][_0x3277('0x42')],_0x37b9e3[_0x3277('0x67')][_0x3277('0x6e')],_0x2e71ce[_0x3277('0x6d')]['id'],_0x37b9e3[_0x3277('0x5e')]?JSON[_0x3277('0x2e')](_0x37b9e3['body']):'null');return respondWithRpcPromise(_0x3277('0x6f'),_0x3277('0x70'),_0x2e71ce);}return null;})['then'](function(_0x15d973){var _0x471547=_0x3277('0x71')+_0x15d973['message']['ContactId'];return db[_0x3277('0x72')]['query'](_0x471547,{'type':db[_0x3277('0x73')]['QueryTypes'][_0x3277('0x74')],'raw':!![]})[_0x3277('0x28')](function(_0x6e1c80){return _0x6e1c80;});})['then'](function(_0x350f61){if(_0x350f61){_0x2e71ce[_0x3277('0x31')][_0x3277('0x75')]=_0x350f61[0x0];if(!_0x37b9e3[_0x3277('0x5e')]['UserId'])return;return db['User'][_0x3277('0x5d')]({'where':{'id':_0x37b9e3[_0x3277('0x5e')][_0x3277('0x66')],'role':_0x3277('0x68')},'attributes':['id',_0x3277('0x42'),_0x3277('0x76'),_0x3277('0x77'),_0x3277('0x78')],'raw':!![]});}return null;})[_0x3277('0x28')](function(_0x6a6b43){if(!_0x6a6b43)return null;_0x2e71ce[_0x3277('0x31')][_0x3277('0x68')]=_0x6a6b43;return _0x2e71ce;})['then'](function(_0x1fd9e6){if(_0x1fd9e6){if(_0x37b9e3[_0x3277('0x5e')][_0x3277('0x79')]){_0x2e71ce[_0x3277('0x31')][_0x3277('0x7a')]=util['format']('SIP/%s',_0x37b9e3[_0x3277('0x67')]['name']);_0x2e71ce[_0x3277('0x31')]['channel']=_0x2e71ce[_0x3277('0x7b')];_0x2e71ce[_0x3277('0x31')][_0x3277('0x7c')]=_0x2e71ce['channel'];_0x2e71ce[_0x3277('0x31')][_0x3277('0x7d')]=_0x3277('0x60');return respondWithRpcPromise(_0x3277('0x7e'),_0x3277('0x7e'),{'event':'acceptmessage','message':_0x2e71ce['message']},client9002)[_0x3277('0x28')](function(){return _0x2e71ce;});}return _0x2e71ce;}return null;})[_0x3277('0x28')](respondWithResult(_0x7d8ee1,null))['catch'](handleError(_0x7d8ee1,null));};var interaction_log=require('../../config/logger')(_0x3277('0x7f'));exports[_0x3277('0x3b')]=function(_0x1ab654,_0x24287b,_0x99c94f){var _0xbb7dfe={'agent':{},'channel':_0x3277('0x61')};if(_0x1ab654['body']['id']){delete _0x1ab654[_0x3277('0x5e')]['id'];}_0x1ab654['body']['UserId']=_0x1ab654[_0x3277('0x5e')]['UserId']||_0x1ab654[_0x3277('0x67')]['id'];_0xbb7dfe[_0x3277('0x68')]['id']=_0x1ab654[_0x3277('0x5e')][_0x3277('0x66')];return db[_0x3277('0x45')][_0x3277('0x5d')]({'where':{'id':_0x1ab654[_0x3277('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24287b,null))[_0x3277('0x28')](function(_0x3d0dba){if(_0x3d0dba){_0xbb7dfe[_0x3277('0x31')]=_0x3d0dba['get']({'plain':!![]});return db[_0x3277('0x6a')][_0x3277('0x5d')]({'where':{'id':_0x3d0dba[_0x3277('0x6b')]}});}return null;})[_0x3277('0x28')](handleEntityNotFound(_0x24287b,null))[_0x3277('0x28')](function(_0x598f05){if(_0x598f05){_0xbb7dfe['interaction']=_0x598f05[_0x3277('0x69')]({'plain':!![]});interaction_log[_0x3277('0x29')](_0x3277('0x80'),_0x1ab654['user']['id'],_0x1ab654[_0x3277('0x67')][_0x3277('0x42')],_0x1ab654['user']['role'],_0xbb7dfe['interaction']['id'],_0x1ab654[_0x3277('0x5e')]?JSON['stringify'](_0x1ab654[_0x3277('0x5e')]):_0x3277('0x81'));return respondWithRpcPromise(_0x3277('0x82'),_0x3277('0x83'),_0xbb7dfe);}return null;})[_0x3277('0x28')](function(_0xcc9805){var _0x318fdb=_0x3277('0x71')+_0xcc9805['message'][_0x3277('0x84')];return db['sequelize']['query'](_0x318fdb,{'type':db[_0x3277('0x73')]['QueryTypes'][_0x3277('0x74')],'raw':!![]})[_0x3277('0x28')](function(_0x15a64d){return _0x15a64d;});})[_0x3277('0x28')](function(_0x494265){if(_0x494265){_0xbb7dfe['message'][_0x3277('0x75')]=_0x494265[0x0];if(!_0x1ab654[_0x3277('0x5e')][_0x3277('0x66')])return;return db[_0x3277('0x85')][_0x3277('0x5d')]({'where':{'id':_0x1ab654[_0x3277('0x5e')]['UserId'],'role':_0x3277('0x68')},'attributes':['id',_0x3277('0x42'),'fullname','email',_0x3277('0x78')],'raw':!![]});}return null;})[_0x3277('0x28')](function(_0x5e1ea4){if(!_0x5e1ea4)return null;_0xbb7dfe['message'][_0x3277('0x68')]=_0x5e1ea4;return _0xbb7dfe;})[_0x3277('0x28')](function(_0x3b16df){if(_0x3b16df){_0x3b16df[_0x3277('0x31')][_0x3277('0x7a')]=util[_0x3277('0x64')](_0x3277('0x86'),_0x1ab654[_0x3277('0x67')]['name']);_0x3b16df[_0x3277('0x31')][_0x3277('0x7b')]=_0xbb7dfe[_0x3277('0x7b')];_0x3b16df['message'][_0x3277('0x7c')]=_0xbb7dfe[_0x3277('0x7b')];_0x3b16df[_0x3277('0x31')][_0x3277('0x7d')]=_0x3277('0x3b');respondWithRpcPromise('EventManager',_0x3277('0x7e'),{'event':_0x3277('0x87'),'message':_0x3b16df[_0x3277('0x31')]},client9002);return _0xbb7dfe;}return null;})['then'](respondWithResult(_0x24287b,null))[_0x3277('0x33')](handleError(_0x24287b,null));};exports[_0x3277('0x88')]=function(_0x49ddb0,_0x1d8382){var _0x4b8430;return db[_0x3277('0x45')]['create'](_0x49ddb0[_0x3277('0x5e')],{})[_0x3277('0x28')](function(_0x1e4a92){_0x4b8430=_0x1e4a92;return db[_0x3277('0x89')][_0x3277('0x8a')]({'where':{'id':_0x4b8430['ContactId']}});})[_0x3277('0x28')](function(_0xb9511c){if(_[_0x3277('0x8b')](_0xb9511c)){return;}else{_0x4b8430[_0x3277('0x61')]=_0xb9511c[_0x3277('0x61')];return db[_0x3277('0x8c')][_0x3277('0x8a')]({'where':{'id':_0x4b8430[_0x3277('0x8d')]}});}})[_0x3277('0x28')](function(_0x30dfeb){return respondWithRpcPromise(_0x3277('0x8e'),_0x3277('0x8e'),{'FaxAccountId':_['isNil'](_0x49ddb0[_0x3277('0x5e')])?undefined:_0x49ddb0[_0x3277('0x5e')][_0x3277('0x8f')],'path':_['isNil'](_0x30dfeb)?undefined:util[_0x3277('0x64')](_0x3277('0x90'),_0x30dfeb[_0x3277('0x91')]),'fax':_[_0x3277('0x8b')](_0x4b8430[_0x3277('0x61')])?undefined:_0x4b8430[_0x3277('0x61')],'AttachmentId':_0x4b8430[_0x3277('0x8d')]},client9002);})['then'](respondWithResult(_0x1d8382,0xc9))[_0x3277('0x33')](handleError(_0x1d8382,null));};exports['download']=function(_0x1e9c9f,_0x26a0db){var _0x427b8f=path[_0x3277('0x92')](config['root'],_0x3277('0x93'),'files','attachments');return db['FaxMessage'][_0x3277('0x5d')]({'where':{'id':_0x1e9c9f[_0x3277('0x5a')]['id']},'include':[{'model':db[_0x3277('0x8c')],'as':_0x3277('0x8c')}]})[_0x3277('0x28')](handleEntityNotFound(_0x26a0db,null))['then'](function(_0x59510e){if(_0x59510e){return _0x26a0db[_0x3277('0x94')](path['join'](_0x427b8f,_0x59510e['Attachment']['basename']));}})[_0x3277('0x33')](handleError(_0x26a0db,null));}; \ No newline at end of file +var _0x6a12=['describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','user','role','interaction','stringify','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','FaxInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','fullname','internal','rejectmessage','create','findOne','AttachmentId','SendFax','basename','download','join','root','server','files','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','FaxMessage','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','fields','include','find','body'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6a12,0x1ed));var _0x26a1=function(_0x5e4db3,_0x2f53ee){_0x5e4db3=_0x5e4db3-0x0;var _0x5806de=_0x6a12[_0x5e4db3];return _0x5806de;};'use strict';var emlformat=require(_0x26a1('0x0'));var rimraf=require(_0x26a1('0x1'));var zipdir=require(_0x26a1('0x2'));var jsonpatch=require(_0x26a1('0x3'));var rp=require(_0x26a1('0x4'));var moment=require(_0x26a1('0x5'));var BPromise=require(_0x26a1('0x6'));var Mustache=require('mustache');var util=require(_0x26a1('0x7'));var path=require(_0x26a1('0x8'));var sox=require(_0x26a1('0x9'));var csv=require(_0x26a1('0xa'));var ejs=require(_0x26a1('0xb'));var fs=require('fs');var fs_extra=require(_0x26a1('0xc'));var _=require('lodash');var squel=require(_0x26a1('0xd'));var crypto=require(_0x26a1('0xe'));var jsforce=require(_0x26a1('0xf'));var deskjs=require(_0x26a1('0x10'));var toCsv=require(_0x26a1('0xa'));var querystring=require(_0x26a1('0x11'));var Papa=require(_0x26a1('0x12'));var Redis=require(_0x26a1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x26a1('0x14'));var as=require(_0x26a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26a1('0x16'))(_0x26a1('0x17'));var utils=require(_0x26a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x26a1('0x19'));var db=require(_0x26a1('0x1a'))['db'];config[_0x26a1('0x1b')]=_[_0x26a1('0x1c')](config[_0x26a1('0x1b')],{'host':_0x26a1('0x1d'),'port':0x18eb});var socket=require(_0x26a1('0x1e'))(new Redis(config[_0x26a1('0x1b')]));require(_0x26a1('0x1f'))[_0x26a1('0x20')](socket);var jayson=require(_0x26a1('0x21'));var client=jayson[_0x26a1('0x22')][_0x26a1('0x23')]({'port':0x232c});var client9002=jayson[_0x26a1('0x22')][_0x26a1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x9ac17,_0x412981,_0x5348bb,_0x4d2d1a){return new BPromise(function(_0x414431,_0x207118){var _0x3bdfb6=_0x4d2d1a||client;return _0x3bdfb6[_0x26a1('0x24')](_0x9ac17,_0x5348bb)['then'](function(_0x33a968){logger[_0x26a1('0x25')](_0x26a1('0x26'),_0x412981,'request\x20sent');logger[_0x26a1('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x412981,_0x26a1('0x28'),JSON['stringify'](_0x33a968));if(_0x33a968[_0x26a1('0x29')]){if(_0x33a968[_0x26a1('0x29')][_0x26a1('0x2a')]===0x1f4){logger[_0x26a1('0x29')](_0x26a1('0x26'),_0x412981,_0x33a968[_0x26a1('0x29')][_0x26a1('0x2b')]);return _0x207118(_0x33a968[_0x26a1('0x29')]['message']);}logger[_0x26a1('0x29')](_0x26a1('0x26'),_0x412981,_0x33a968[_0x26a1('0x29')]['message']);return _0x414431(_0x33a968[_0x26a1('0x29')][_0x26a1('0x2b')]);}else{logger[_0x26a1('0x25')](_0x26a1('0x26'),_0x412981,_0x26a1('0x28'));_0x414431(_0x33a968[_0x26a1('0x2c')]['message']);}})['catch'](function(_0x318a19){logger[_0x26a1('0x29')](_0x26a1('0x26'),_0x412981,_0x318a19);_0x207118(_0x318a19);});});}function respondWithStatusCode(_0x3c7490,_0x5ec649){_0x5ec649=_0x5ec649||0xcc;return function(_0x2d38de){if(_0x2d38de){return _0x3c7490[_0x26a1('0x2d')](_0x5ec649);}return _0x3c7490[_0x26a1('0x2e')](_0x5ec649)[_0x26a1('0x2f')]();};}function respondWithResult(_0x3dd0de,_0x449412){_0x449412=_0x449412||0xc8;return function(_0x2b41b9){if(_0x2b41b9){return _0x3dd0de[_0x26a1('0x2e')](_0x449412)[_0x26a1('0x30')](_0x2b41b9);}};}function respondWithFilteredResult(_0x4c482b,_0x1e2be8){return function(_0x31e2c5){if(_0x31e2c5){var _0x3b996a=typeof _0x1e2be8[_0x26a1('0x31')]===_0x26a1('0x32')&&typeof _0x1e2be8[_0x26a1('0x33')]===_0x26a1('0x32');var _0x316946=_0x31e2c5[_0x26a1('0x34')];var _0x341392=_0x3b996a?0x0:_0x1e2be8['offset'];var _0x16364e=_0x3b996a?_0x31e2c5['count']:_0x1e2be8['offset']+_0x1e2be8[_0x26a1('0x33')];var _0x3c4fad;if(_0x16364e>=_0x316946){_0x16364e=_0x316946;_0x3c4fad=0xc8;}else{_0x3c4fad=0xce;}_0x4c482b['status'](_0x3c4fad);return _0x4c482b[_0x26a1('0x35')](_0x26a1('0x36'),_0x341392+'-'+_0x16364e+'/'+_0x316946)[_0x26a1('0x30')](_0x31e2c5);}return null;};}function patchUpdates(_0x565c52){return function(_0x597909){try{jsonpatch[_0x26a1('0x37')](_0x597909,_0x565c52,!![]);}catch(_0x1a3478){return BPromise[_0x26a1('0x38')](_0x1a3478);}return _0x597909[_0x26a1('0x39')]();};}function saveUpdates(_0x1ef350,_0x30d11b){return function(_0x48d712){if(_0x48d712){return _0x48d712[_0x26a1('0x3a')](_0x1ef350)[_0x26a1('0x3b')](function(_0x111d6f){return _0x111d6f;});}return null;};}function removeEntity(_0x2817e0,_0xdc8616){return function(_0x204bab){if(_0x204bab){return _0x204bab[_0x26a1('0x3c')]()[_0x26a1('0x3b')](function(){_0x2817e0[_0x26a1('0x2e')](0xcc)[_0x26a1('0x2f')]();});}};}function handleEntityNotFound(_0x4974be,_0x2b6789){return function(_0x1b8b0a){if(!_0x1b8b0a){_0x4974be[_0x26a1('0x2d')](0x194);}return _0x1b8b0a;};}function handleError(_0x44b8e2,_0x29cdf9){_0x29cdf9=_0x29cdf9||0x1f4;return function(_0x451af3){logger[_0x26a1('0x29')](_0x451af3['stack']);if(_0x451af3[_0x26a1('0x3d')]){delete _0x451af3['name'];}_0x44b8e2[_0x26a1('0x2e')](_0x29cdf9)[_0x26a1('0x3e')](_0x451af3);};}exports['index']=function(_0x413569,_0x525bb3){var _0x22af39={},_0x95574d={},_0x133d78={'count':0x0,'rows':[]};var _0x477c33=_['map'](db[_0x26a1('0x3f')]['rawAttributes'],function(_0x3319b5){return{'name':_0x3319b5[_0x26a1('0x40')],'type':_0x3319b5[_0x26a1('0x41')][_0x26a1('0x42')]};});_0x95574d[_0x26a1('0x43')]=_['map'](_0x477c33,'name');_0x95574d[_0x26a1('0x44')]=_[_0x26a1('0x45')](_0x413569[_0x26a1('0x44')]);_0x95574d['filters']=_[_0x26a1('0x46')](_0x95574d[_0x26a1('0x43')],_0x95574d[_0x26a1('0x44')]);_0x22af39[_0x26a1('0x47')]=_[_0x26a1('0x46')](_0x95574d[_0x26a1('0x43')],qs['fields'](_0x413569['query']['fields']));_0x22af39[_0x26a1('0x47')]=_0x22af39[_0x26a1('0x47')][_0x26a1('0x48')]?_0x22af39['attributes']:_0x95574d['model'];if(!_0x413569[_0x26a1('0x44')][_0x26a1('0x49')](_0x26a1('0x4a'))){_0x22af39['limit']=qs['limit'](_0x413569[_0x26a1('0x44')][_0x26a1('0x33')]);_0x22af39['offset']=qs[_0x26a1('0x31')](_0x413569[_0x26a1('0x44')][_0x26a1('0x31')]);}_0x22af39[_0x26a1('0x4b')]=qs['sort'](_0x413569[_0x26a1('0x44')][_0x26a1('0x4c')]);_0x22af39[_0x26a1('0x4d')]=qs[_0x26a1('0x4e')](_[_0x26a1('0x4f')](_0x413569['query'],_0x95574d[_0x26a1('0x4e')]),_0x477c33);if(_0x413569[_0x26a1('0x44')]['filter']){_0x22af39[_0x26a1('0x4d')]=_[_0x26a1('0x50')](_0x22af39[_0x26a1('0x4d')],{'$or':_[_0x26a1('0x51')](_0x477c33,function(_0x3f8102){if(_0x3f8102[_0x26a1('0x41')]!==_0x26a1('0x52')){var _0x93d5a={};_0x93d5a[_0x3f8102[_0x26a1('0x3d')]]={'$like':'%'+_0x413569[_0x26a1('0x44')][_0x26a1('0x53')]+'%'};return _0x93d5a;}})});}_0x22af39=_[_0x26a1('0x50')]({},_0x22af39,_0x413569[_0x26a1('0x54')]);var _0x3e596a={'where':_0x22af39[_0x26a1('0x4d')]};return db[_0x26a1('0x3f')][_0x26a1('0x34')](_0x3e596a)['then'](function(_0x4bf234){_0x133d78['count']=_0x4bf234;if(_0x413569[_0x26a1('0x44')][_0x26a1('0x55')]){_0x22af39['include']=[{'all':!![]}];}return db[_0x26a1('0x3f')][_0x26a1('0x56')](_0x22af39);})['then'](function(_0x1617ef){_0x133d78[_0x26a1('0x57')]=_0x1617ef;return _0x133d78;})[_0x26a1('0x3b')](respondWithFilteredResult(_0x525bb3,_0x22af39))[_0x26a1('0x58')](handleError(_0x525bb3,null));};exports['show']=function(_0x524971,_0xf091e4){var _0x3234b2={'raw':!![],'where':{'id':_0x524971[_0x26a1('0x59')]['id']}},_0x4b5c86={};_0x4b5c86[_0x26a1('0x43')]=_[_0x26a1('0x45')](db[_0x26a1('0x3f')][_0x26a1('0x5a')]);_0x4b5c86['query']=_[_0x26a1('0x45')](_0x524971['query']);_0x4b5c86['filters']=_[_0x26a1('0x46')](_0x4b5c86[_0x26a1('0x43')],_0x4b5c86[_0x26a1('0x44')]);_0x3234b2['attributes']=_[_0x26a1('0x46')](_0x4b5c86['model'],qs['fields'](_0x524971[_0x26a1('0x44')][_0x26a1('0x5b')]));_0x3234b2[_0x26a1('0x47')]=_0x3234b2[_0x26a1('0x47')][_0x26a1('0x48')]?_0x3234b2[_0x26a1('0x47')]:_0x4b5c86[_0x26a1('0x43')];if(_0x524971[_0x26a1('0x44')]['includeAll']){_0x3234b2[_0x26a1('0x5c')]=[{'all':!![]}];}_0x3234b2=_['merge']({},_0x3234b2,_0x524971[_0x26a1('0x54')]);return db[_0x26a1('0x3f')][_0x26a1('0x5d')](_0x3234b2)[_0x26a1('0x3b')](handleEntityNotFound(_0xf091e4,null))[_0x26a1('0x3b')](respondWithResult(_0xf091e4,null))[_0x26a1('0x58')](handleError(_0xf091e4,null));};exports['update']=function(_0x5ddc8b,_0x1f0a53){if(_0x5ddc8b[_0x26a1('0x5e')]['id']){delete _0x5ddc8b[_0x26a1('0x5e')]['id'];}return db[_0x26a1('0x3f')][_0x26a1('0x5d')]({'where':{'id':_0x5ddc8b['params']['id']}})['then'](handleEntityNotFound(_0x1f0a53,null))[_0x26a1('0x3b')](saveUpdates(_0x5ddc8b[_0x26a1('0x5e')],null))[_0x26a1('0x3b')](respondWithResult(_0x1f0a53,null))[_0x26a1('0x58')](handleError(_0x1f0a53,null));};exports[_0x26a1('0x3c')]=function(_0x1066ae,_0x419c7f){return db['FaxMessage'][_0x26a1('0x5d')]({'where':{'id':_0x1066ae[_0x26a1('0x59')]['id']}})[_0x26a1('0x3b')](handleEntityNotFound(_0x419c7f,null))['then'](removeEntity(_0x419c7f,null))[_0x26a1('0x58')](handleError(_0x419c7f,null));};exports['describe']=function(_0x6091d1,_0x270b1e){return db[_0x26a1('0x3f')][_0x26a1('0x5f')]()[_0x26a1('0x3b')](respondWithResult(_0x270b1e,null))[_0x26a1('0x58')](handleError(_0x270b1e,null));};var interaction_log=require('../../config/logger')(_0x26a1('0x60'));exports[_0x26a1('0x61')]=function(_0x5e9ebb,_0x75ac49,_0x7d524c){var _0x3edcd3={'agent':{},'channel':'fax'};if(_0x5e9ebb[_0x26a1('0x5e')]['id']){delete _0x5e9ebb[_0x26a1('0x5e')]['id'];}_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x62')]=!![];_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x63')]=moment()[_0x26a1('0x64')](_0x26a1('0x65'));_0x5e9ebb[_0x26a1('0x5e')]['UserId']=_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x66')]||_0x5e9ebb['user']['id'];_0x3edcd3[_0x26a1('0x67')]['id']=_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x66')];return db[_0x26a1('0x3f')]['find']({'where':{'id':_0x5e9ebb[_0x26a1('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x75ac49,null))['then'](saveUpdates(_0x5e9ebb[_0x26a1('0x5e')],null))['then'](function(_0x255f09){if(_0x255f09){_0x3edcd3[_0x26a1('0x2b')]=_0x255f09[_0x26a1('0x68')]({'plain':!![]});return db['FaxInteraction'][_0x26a1('0x5d')]({'where':{'id':_0x255f09['FaxInteractionId']}});}return null;})[_0x26a1('0x3b')](handleEntityNotFound(_0x75ac49,null))['then'](function(_0x51f0b7){if(_0x51f0b7){return _0x51f0b7[_0x26a1('0x3a')]({'UserId':_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x66')],'read1stAt':_[_0x26a1('0x69')](_0x51f0b7[_0x26a1('0x6a')])?moment()[_0x26a1('0x64')](_0x26a1('0x65')):undefined});}return null;})[_0x26a1('0x3b')](function(_0x4ad3fa){if(_0x4ad3fa){_0x3edcd3['interaction']=_0x4ad3fa[_0x26a1('0x68')]({'plain':!![]});interaction_log[_0x26a1('0x25')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e9ebb[_0x26a1('0x6b')]['id'],_0x5e9ebb['user']['name'],_0x5e9ebb[_0x26a1('0x6b')][_0x26a1('0x6c')],_0x3edcd3[_0x26a1('0x6d')]['id'],_0x5e9ebb[_0x26a1('0x5e')]?JSON[_0x26a1('0x6e')](_0x5e9ebb['body']):_0x26a1('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x26a1('0x70'),_0x3edcd3);}return null;})[_0x26a1('0x3b')](function(_0xd19289){var _0x463fa5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd19289[_0x26a1('0x2b')][_0x26a1('0x71')];return db[_0x26a1('0x72')][_0x26a1('0x44')](_0x463fa5,{'type':db[_0x26a1('0x73')]['QueryTypes'][_0x26a1('0x74')],'raw':!![]})[_0x26a1('0x3b')](function(_0x427eb1){return _0x427eb1;});})[_0x26a1('0x3b')](function(_0x47fae4){if(_0x47fae4){_0x3edcd3['message'][_0x26a1('0x75')]=_0x47fae4[0x0];if(!_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x66')])return;return db[_0x26a1('0x76')][_0x26a1('0x5d')]({'where':{'id':_0x5e9ebb['body']['UserId'],'role':_0x26a1('0x67')},'attributes':['id','name','fullname',_0x26a1('0x77'),'internal'],'raw':!![]});}return null;})[_0x26a1('0x3b')](function(_0x220c15){if(!_0x220c15)return null;_0x3edcd3[_0x26a1('0x2b')][_0x26a1('0x67')]=_0x220c15;return _0x3edcd3;})[_0x26a1('0x3b')](function(_0x4a71fa){if(_0x4a71fa){if(_0x5e9ebb[_0x26a1('0x5e')][_0x26a1('0x78')]){_0x3edcd3[_0x26a1('0x2b')][_0x26a1('0x79')]=util['format'](_0x26a1('0x7a'),_0x5e9ebb[_0x26a1('0x6b')][_0x26a1('0x3d')]);_0x3edcd3[_0x26a1('0x2b')]['channel']=_0x3edcd3[_0x26a1('0x7b')];_0x3edcd3[_0x26a1('0x2b')][_0x26a1('0x7c')]=_0x3edcd3[_0x26a1('0x7b')];_0x3edcd3[_0x26a1('0x2b')][_0x26a1('0x7d')]=_0x26a1('0x61');return respondWithRpcPromise(_0x26a1('0x7e'),'EventManager',{'event':'acceptmessage','message':_0x3edcd3['message']},client9002)['then'](function(){return _0x3edcd3;});}return _0x3edcd3;}return null;})[_0x26a1('0x3b')](respondWithResult(_0x75ac49,null))[_0x26a1('0x58')](handleError(_0x75ac49,null));};var interaction_log=require('../../config/logger')(_0x26a1('0x60'));exports[_0x26a1('0x38')]=function(_0x599ded,_0x3ca72b,_0x3cded3){var _0x4a9cd9={'agent':{},'channel':_0x26a1('0x7f')};if(_0x599ded[_0x26a1('0x5e')]['id']){delete _0x599ded[_0x26a1('0x5e')]['id'];}_0x599ded['body']['UserId']=_0x599ded[_0x26a1('0x5e')][_0x26a1('0x66')]||_0x599ded[_0x26a1('0x6b')]['id'];_0x4a9cd9[_0x26a1('0x67')]['id']=_0x599ded[_0x26a1('0x5e')]['UserId'];return db['FaxMessage'][_0x26a1('0x5d')]({'where':{'id':_0x599ded[_0x26a1('0x59')]['id'],'UserId':null}})[_0x26a1('0x3b')](handleEntityNotFound(_0x3ca72b,null))[_0x26a1('0x3b')](function(_0x174db7){if(_0x174db7){_0x4a9cd9[_0x26a1('0x2b')]=_0x174db7[_0x26a1('0x68')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x174db7[_0x26a1('0x80')]}});}return null;})[_0x26a1('0x3b')](handleEntityNotFound(_0x3ca72b,null))[_0x26a1('0x3b')](function(_0xe0757f){if(_0xe0757f){_0x4a9cd9['interaction']=_0xe0757f[_0x26a1('0x68')]({'plain':!![]});interaction_log[_0x26a1('0x25')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x599ded[_0x26a1('0x6b')]['id'],_0x599ded[_0x26a1('0x6b')][_0x26a1('0x3d')],_0x599ded['user'][_0x26a1('0x6c')],_0x4a9cd9[_0x26a1('0x6d')]['id'],_0x599ded[_0x26a1('0x5e')]?JSON['stringify'](_0x599ded[_0x26a1('0x5e')]):'null');return respondWithRpcPromise(_0x26a1('0x81'),_0x26a1('0x82'),_0x4a9cd9);}return null;})[_0x26a1('0x3b')](function(_0x5c2f8e){var _0x56a434=_0x26a1('0x83')+_0x5c2f8e[_0x26a1('0x2b')][_0x26a1('0x71')];return db[_0x26a1('0x72')][_0x26a1('0x44')](_0x56a434,{'type':db[_0x26a1('0x73')][_0x26a1('0x84')][_0x26a1('0x74')],'raw':!![]})[_0x26a1('0x3b')](function(_0xb0c09e){return _0xb0c09e;});})[_0x26a1('0x3b')](function(_0x5411af){if(_0x5411af){_0x4a9cd9['message'][_0x26a1('0x75')]=_0x5411af[0x0];if(!_0x599ded[_0x26a1('0x5e')][_0x26a1('0x66')])return;return db[_0x26a1('0x76')][_0x26a1('0x5d')]({'where':{'id':_0x599ded[_0x26a1('0x5e')]['UserId'],'role':_0x26a1('0x67')},'attributes':['id',_0x26a1('0x3d'),_0x26a1('0x85'),_0x26a1('0x77'),_0x26a1('0x86')],'raw':!![]});}return null;})[_0x26a1('0x3b')](function(_0x1a241b){if(!_0x1a241b)return null;_0x4a9cd9['message'][_0x26a1('0x67')]=_0x1a241b;return _0x4a9cd9;})[_0x26a1('0x3b')](function(_0x531065){if(_0x531065){_0x531065[_0x26a1('0x2b')]['interface']=util[_0x26a1('0x64')](_0x26a1('0x7a'),_0x599ded['user']['name']);_0x531065['message'][_0x26a1('0x7b')]=_0x4a9cd9[_0x26a1('0x7b')];_0x531065['message']['motionChannel']=_0x4a9cd9['channel'];_0x531065['message'][_0x26a1('0x7d')]='reject';respondWithRpcPromise('EventManager',_0x26a1('0x7e'),{'event':_0x26a1('0x87'),'message':_0x531065[_0x26a1('0x2b')]},client9002);return _0x4a9cd9;}return null;})[_0x26a1('0x3b')](respondWithResult(_0x3ca72b,null))[_0x26a1('0x58')](handleError(_0x3ca72b,null));};exports[_0x26a1('0x88')]=function(_0x47d1db,_0x3a1c2b){var _0x55da94;return db['FaxMessage'][_0x26a1('0x88')](_0x47d1db['body'],{})['then'](function(_0x41cccb){_0x55da94=_0x41cccb;return db['CmContact']['findOne']({'where':{'id':_0x55da94['ContactId']}});})[_0x26a1('0x3b')](function(_0x1a56f9){if(_[_0x26a1('0x69')](_0x1a56f9)){return;}else{_0x55da94[_0x26a1('0x7f')]=_0x1a56f9[_0x26a1('0x7f')];return db['Attachment'][_0x26a1('0x89')]({'where':{'id':_0x55da94[_0x26a1('0x8a')]}});}})[_0x26a1('0x3b')](function(_0x13678d){return respondWithRpcPromise(_0x26a1('0x8b'),_0x26a1('0x8b'),{'FaxAccountId':_[_0x26a1('0x69')](_0x47d1db[_0x26a1('0x5e')])?undefined:_0x47d1db['body']['FaxAccountId'],'path':_[_0x26a1('0x69')](_0x13678d)?undefined:util[_0x26a1('0x64')]('/var/opt/motion2/server/files/attachments/%s',_0x13678d[_0x26a1('0x8c')]),'fax':_['isNil'](_0x55da94['fax'])?undefined:_0x55da94[_0x26a1('0x7f')],'AttachmentId':_0x55da94[_0x26a1('0x8a')]},client9002);})[_0x26a1('0x3b')](respondWithResult(_0x3a1c2b,0xc9))[_0x26a1('0x58')](handleError(_0x3a1c2b,null));};exports[_0x26a1('0x8d')]=function(_0x49b416,_0x2dce93){var _0x9ff5f5=path[_0x26a1('0x8e')](config[_0x26a1('0x8f')],_0x26a1('0x90'),_0x26a1('0x91'),'attachments');return db[_0x26a1('0x3f')][_0x26a1('0x5d')]({'where':{'id':_0x49b416[_0x26a1('0x59')]['id']},'include':[{'model':db[_0x26a1('0x92')],'as':_0x26a1('0x92')}]})['then'](handleEntityNotFound(_0x2dce93,null))[_0x26a1('0x3b')](function(_0x2ae05b){if(_0x2ae05b){return _0x2dce93['download'](path[_0x26a1('0x8e')](_0x9ff5f5,_0x2ae05b[_0x26a1('0x92')][_0x26a1('0x8c')]));}})[_0x26a1('0x58')](handleError(_0x2dce93,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index f98e0d6..72f7201 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 _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update'];(function(_0x11d284,_0x3e67ef){var _0x275a7b=function(_0x5bb042){while(--_0x5bb042){_0x11d284['push'](_0x11d284['shift']());}};_0x275a7b(++_0x3e67ef);}(_0x41d0,0x1c6));var _0x041d=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0x41d0[_0x5555c6];return _0x5e8dc5;};'use strict';var EventEmitter=require(_0x041d('0x0'));var FaxMessage=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){FaxMessageEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);FaxMessageEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xbe2c=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x53ea04,_0x1546cc){var _0x46ad81=function(_0x1fbac9){while(--_0x1fbac9){_0x53ea04['push'](_0x53ea04['shift']());}};_0x46ad81(++_0x1546cc);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x4cc776,_0xc7ae00){_0x4cc776=_0x4cc776-0x0;var _0x223327=_0xbe2c[_0x4cc776];return _0x223327;};'use strict';var EventEmitter=require(_0xcbe2('0x0'));var FaxMessage=require(_0xcbe2('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xcbe2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbe2('0x3'),'afterDestroy':_0xcbe2('0x4')};function emitEvent(_0x107914){return function(_0x42c28d,_0x3f9f67,_0x59afb2){FaxMessageEvents[_0xcbe2('0x5')](_0x107914+':'+_0x42c28d['id'],_0x42c28d);FaxMessageEvents[_0xcbe2('0x5')](_0x107914,_0x42c28d);_0x59afb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xcbe2('0x6')](e,emitEvent(event));}}module[_0xcbe2('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index df6843d..f4f53f2 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 _0xa67d=['direction','toLowerCase','secret','isNil','UserId','findOne','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get'];(function(_0x46e23f,_0xda33d6){var _0x34e1ab=function(_0xfb25c4){while(--_0xfb25c4){_0x46e23f['push'](_0x46e23f['shift']());}};_0x34e1ab(++_0xda33d6);}(_0xa67d,0x143));var _0xda67=function(_0x5a36dd,_0x5b2d2c){_0x5a36dd=_0x5a36dd-0x0;var _0x15503d=_0xa67d[_0x5a36dd];return _0x15503d;};'use strict';var _=require(_0xda67('0x0'));var util=require(_0xda67('0x1'));var logger=require(_0xda67('0x2'))('api');var moment=require(_0xda67('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda67('0x4'));var rimraf=require(_0xda67('0x5'));var config=require(_0xda67('0x6'));var attributes=require('./faxMessage.attributes');module[_0xda67('0x7')]=function(_0x48b866,_0x2384e8){return _0x48b866[_0xda67('0x8')](_0xda67('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xda67('0xa'),'fields':[_0xda67('0xb')],'type':_0xda67('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x259512,_0x4d3c19,_0x56ec52){var _0x5032fa=_0x48b866[_0xda67('0xd')];var _0xc98a44=_0x259512[_0xda67('0xe')]({'plain':!![]});if(_0xc98a44[_0xda67('0xf')][_0xda67('0x10')]()==='in'||_0xc98a44['direction']['toLowerCase']()==='out'&&!_0xc98a44[_0xda67('0x11')]&&!_[_0xda67('0x12')](_0xc98a44[_0xda67('0x13')])){_0x5032fa['FaxInteraction'][_0xda67('0x14')]({'where':{'id':_0xc98a44['FaxInteractionId']}})[_0xda67('0x15')](function(_0x1502b9){if(_0x1502b9){_0x1502b9['update']({'lastMsgAt':_0xc98a44[_0xda67('0x16')],'lastMsgDirection':_0xc98a44[_0xda67('0xf')][_0xda67('0x10')]()});}})['catch'](function(_0x51ad36){console[_0xda67('0x17')](_0x51ad36);});}_0x56ec52();}},'charset':_0xda67('0x18'),'collate':_0xda67('0x19')});}; \ No newline at end of file +var _0x1aa3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','update','direction','catch','error'];(function(_0x5445a1,_0x1ba385){var _0x3bf175=function(_0x3e999a){while(--_0x3e999a){_0x5445a1['push'](_0x5445a1['shift']());}};_0x3bf175(++_0x1ba385);}(_0x1aa3,0x1a2));var _0x31aa=function(_0x3c0b76,_0x170065){_0x3c0b76=_0x3c0b76-0x0;var _0x51906d=_0x1aa3[_0x3c0b76];return _0x51906d;};'use strict';var _=require(_0x31aa('0x0'));var util=require(_0x31aa('0x1'));var logger=require(_0x31aa('0x2'))('api');var moment=require(_0x31aa('0x3'));var BPromise=require(_0x31aa('0x4'));var rp=require(_0x31aa('0x5'));var fs=require('fs');var path=require(_0x31aa('0x6'));var rimraf=require('rimraf');var config=require(_0x31aa('0x7'));var attributes=require(_0x31aa('0x8'));module['exports']=function(_0x37425f,_0x4b485e){return _0x37425f[_0x31aa('0x9')](_0x31aa('0xa'),attributes,{'tableName':_0x31aa('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x31aa('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cdf27,_0x2de6aa,_0x45869d){var _0x430101=_0x37425f['models'];var _0x3f5cd4=_0x4cdf27['get']({'plain':!![]});if(_0x3f5cd4['direction'][_0x31aa('0xd')]()==='in'||_0x3f5cd4['direction'][_0x31aa('0xd')]()===_0x31aa('0xe')&&!_0x3f5cd4[_0x31aa('0xf')]&&!_[_0x31aa('0x10')](_0x3f5cd4[_0x31aa('0x11')])){_0x430101['FaxInteraction'][_0x31aa('0x12')]({'where':{'id':_0x3f5cd4[_0x31aa('0x13')]}})['then'](function(_0x5cbeb4){if(_0x5cbeb4){_0x5cbeb4[_0x31aa('0x14')]({'lastMsgAt':_0x3f5cd4['createdAt'],'lastMsgDirection':_0x3f5cd4[_0x31aa('0x15')][_0x31aa('0xd')]()});}})[_0x31aa('0x16')](function(_0x241ba0){console[_0x31aa('0x17')](_0x241ba0);});}_0x45869d();}},'charset':_0x31aa('0x18'),'collate':_0x31aa('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1f8afa2..a8bd371 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 _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5c12,0x188));var _0x25c1=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x5c12[_0x459a0a];return _0x4ab46c;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file +var _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x518fd9,_0x455856){var _0x4ebf2d=function(_0x24e590){while(--_0x24e590){_0x518fd9['push'](_0x518fd9['shift']());}};_0x4ebf2d(++_0x455856);}(_0xeec6,0x1c2));var _0x6eec=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xeec6[_0x52096b];return _0x2b1cc7;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ccc7522..261d9c1 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 _0x2abb=['save','update','removeListener','faxMessage:'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0x2abb,0x194));var _0xb2ab=function(_0x1cfcb1,_0x2421a8){_0x1cfcb1=_0x1cfcb1-0x0;var _0xe30fff=_0x2abb[_0x1cfcb1];return _0xe30fff;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb2ab('0x0'),'remove',_0xb2ab('0x1')];function createListener(_0xb67a07,_0x482a0c){return function(_0x32e3b0){_0x482a0c['emit'](_0xb67a07,_0x32e3b0);};}function removeListener(_0x17efc7,_0xe4505f){return function(){FaxMessageEvents[_0xb2ab('0x2')](_0x17efc7,_0xe4505f);};}exports['register']=function(_0x675780){for(var _0x49f750=0x0,_0x5f00b5=events['length'];_0x49f750<_0x5f00b5;_0x49f750++){var _0x58c8dc=events[_0x49f750];var _0x1a5492=createListener(_0xb2ab('0x3')+_0x58c8dc,_0x675780);FaxMessageEvents['on'](_0x58c8dc,_0x1a5492);}}; \ No newline at end of file +var _0xab7c=['faxMessage:','./faxMessage.events','remove','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab7c,0xc9));var _0xcab7=function(_0x26b175,_0x39cd17){_0x26b175=_0x26b175-0x0;var _0xca7d26=_0xab7c[_0x26b175];return _0xca7d26;};'use strict';var FaxMessageEvents=require(_0xcab7('0x0'));var events=['save',_0xcab7('0x1'),'update'];function createListener(_0x2c1671,_0x40097a){return function(_0x28af28){_0x40097a['emit'](_0x2c1671,_0x28af28);};}function removeListener(_0x37bd90,_0x4117de){return function(){FaxMessageEvents[_0xcab7('0x2')](_0x37bd90,_0x4117de);};}exports['register']=function(_0x98267d){for(var _0x562fe5=0x0,_0x65f1c8=events[_0xcab7('0x3')];_0x562fe5<_0x65f1c8;_0x562fe5++){var _0x4c6a9a=events[_0x562fe5];var _0x31e03c=createListener(_0xcab7('0x4')+_0x4c6a9a,_0x98267d);FaxMessageEvents['on'](_0x4c6a9a,_0x31e03c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9356389..5d59d43 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 _0x9aea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express'];(function(_0x10a97c,_0x2565e7){var _0x5da79a=function(_0x1e5ec2){while(--_0x1e5ec2){_0x10a97c['push'](_0x10a97c['shift']());}};_0x5da79a(++_0x2565e7);}(_0x9aea,0xdd));var _0xa9ae=function(_0x5e9d2f,_0x1192ef){_0x5e9d2f=_0x5e9d2f-0x0;var _0xd52cd1=_0x9aea[_0x5e9d2f];return _0xd52cd1;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ae('0x4'));var interaction=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var controller=require(_0xa9ae('0x7'));router[_0xa9ae('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0x8')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0x8')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0x8')](_0xa9ae('0xf'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x10')]);router['post']('/',auth[_0xa9ae('0xd')](),interaction['tracked'](_0xa9ae('0x11'),_0xa9ae('0x12')),controller[_0xa9ae('0x13')]);router[_0xa9ae('0x14')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x15')]);router[_0xa9ae('0x14')]('/:id/accept',auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x16')]);router[_0xa9ae('0x14')](_0xa9ae('0x17'),auth['isAuthenticated'](),controller[_0xa9ae('0x18')]);router[_0xa9ae('0x19')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x1a')]);module[_0xa9ae('0x1b')]=router; \ No newline at end of file +var _0x9354=['describe','/:id','show','/:id/download','download','post','fax','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x5a0d79,_0x17aed4){var _0x5bee8d=function(_0x12a468){while(--_0x12a468){_0x5a0d79['push'](_0x5a0d79['shift']());}};_0x5bee8d(++_0x17aed4);}(_0x9354,0x96));var _0x4935=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x9354[_0x2a558d];return _0xa7bc9c;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4935('0x12'),'faxmessage:create'),controller['create']);router[_0x4935('0x13')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);router[_0x4935('0x13')](_0x4935('0x17'),auth[_0x4935('0x9')](),controller[_0x4935('0x18')]);router[_0x4935('0x19')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9d5662a..d20c1bc 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 _0xc029=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc029,0x1df));var _0x9c02=function(_0x1385f0,_0x5550bb){_0x1385f0=_0x1385f0-0x0;var _0x36ca00=_0xc029[_0x1385f0];return _0x36ca00;};'use strict';var Sequelize=require(_0x9c02('0x0'));module[_0x9c02('0x1')]={'name':{'type':Sequelize[_0x9c02('0x2')],'unique':_0x9c02('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c02('0x2')]},'timeout':{'type':Sequelize[_0x9c02('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c02('0x5')](_0x9c02('0x6'),_0x9c02('0x7'),_0x9c02('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c02('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4306=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x1fcea0,_0x5cecef){var _0x2fe4e8=function(_0x19c0cd){while(--_0x19c0cd){_0x1fcea0['push'](_0x1fcea0['shift']());}};_0x2fe4e8(++_0x5cecef);}(_0x4306,0x7b));var _0x6430=function(_0x4e7da5,_0x10ca38){_0x4e7da5=_0x4e7da5-0x0;var _0x3ee903=_0x4306[_0x4e7da5];return _0x3ee903;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6430('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6430('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6430('0x2')](_0x6430('0x3'),_0x6430('0x4'),_0x6430('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6430('0x1')],'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 5ea23c8..4c72598 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','FaxQueueId','merge','UserFaxQueue','User','findAndCountAll','map','UserId','agent','faxPause','updatedAt','createdAt','format'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xadb5,0xad));var _0x5adb=function(_0x5391c2,_0x493df6){_0x5391c2=_0x5391c2-0x0;var _0x286cd2=_0xadb5[_0x5391c2];return _0x286cd2;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserFaxQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'FaxQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['FaxQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['FaxQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'FaxQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'FaxQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'FaxQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'FaxQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['FaxQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'FaxQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'FaxQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0xb7f0=['undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','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','catch','describe','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','order','FaxQueueId','filter','User','UserId','createdAt','format','%s/%s','SIP','faxPause','updatedAt','getTeams','Team','sort','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset'];(function(_0x73c7c4,_0x4c96c7){var _0x15af15=function(_0x207b32){while(--_0x207b32){_0x73c7c4['push'](_0x73c7c4['shift']());}};_0x15af15(++_0x4c96c7);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x573ea2,_0x1517e4){_0x573ea2=_0x573ea2-0x0;var _0x2dc6ab=_0xb7f0[_0x573ea2];return _0x2dc6ab;};'use strict';var BPromise=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var _=require(_0x0b7f('0x2'));var squel=require(_0x0b7f('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0b7f('0x4'))(_0x0b7f('0x5'));var config=require(_0x0b7f('0x6'));var db=require(_0x0b7f('0x7'))['db'];config[_0x0b7f('0x8')]=_[_0x0b7f('0x9')](config[_0x0b7f('0x8')],{'host':_0x0b7f('0xa'),'port':0x18eb});var socket=require(_0x0b7f('0xb'))(new Redis(config[_0x0b7f('0x8')]));require('./faxQueue.socket')[_0x0b7f('0xc')](socket);function respondWithStatusCode(_0x65287,_0x5ed192){_0x5ed192=_0x5ed192||0xcc;return function(_0x1332d4){if(_0x1332d4){return _0x65287[_0x0b7f('0xd')](_0x5ed192);}return _0x65287['status'](_0x5ed192)['end']();};}function respondWithResult(_0x596c5a,_0x255197){_0x255197=_0x255197||0xc8;return function(_0x1e8f0a){if(_0x1e8f0a){return _0x596c5a[_0x0b7f('0xe')](_0x255197)[_0x0b7f('0xf')](_0x1e8f0a);}};}function respondWithFilteredResult(_0x43114c,_0xc7fa85){return function(_0x23a0b4){if(_0x23a0b4){var _0x1ed8aa=typeof _0xc7fa85[_0x0b7f('0x10')]===_0x0b7f('0x11')&&typeof _0xc7fa85[_0x0b7f('0x12')]==='undefined';var _0x38808d=_0x23a0b4[_0x0b7f('0x13')];var _0x1e3f86=_0x1ed8aa?0x0:_0xc7fa85[_0x0b7f('0x10')];var _0x294db5=_0x1ed8aa?_0x23a0b4[_0x0b7f('0x13')]:_0xc7fa85[_0x0b7f('0x10')]+_0xc7fa85[_0x0b7f('0x12')];var _0x5a2b0b;if(_0x294db5>=_0x38808d){_0x294db5=_0x38808d;_0x5a2b0b=0xc8;}else{_0x5a2b0b=0xce;}_0x43114c[_0x0b7f('0xe')](_0x5a2b0b);return _0x43114c[_0x0b7f('0x14')](_0x0b7f('0x15'),_0x1e3f86+'-'+_0x294db5+'/'+_0x38808d)[_0x0b7f('0xf')](_0x23a0b4);}return null;};}function saveUpdates(_0x58c901){return function(_0x355fdd){if(_0x355fdd){return _0x355fdd[_0x0b7f('0x16')](_0x58c901)[_0x0b7f('0x17')](function(_0x168e7e){return _0x168e7e;});}return null;};}function removeEntity(_0x166520){return function(_0x50cee2){if(_0x50cee2){return _0x50cee2[_0x0b7f('0x18')]()['then'](function(){var _0x5b9062=_0x50cee2[_0x0b7f('0x19')]({'plain':!![]});var _0x30a8b2=_0x0b7f('0x1a');return db[_0x0b7f('0x1b')][_0x0b7f('0x18')]({'where':{'type':_0x30a8b2,'resourceId':_0x5b9062['id']}})['then'](function(){return _0x50cee2;});})['then'](function(){_0x166520[_0x0b7f('0xe')](0xcc)[_0x0b7f('0x1c')]();});}};}function handleEntityNotFound(_0x282634){return function(_0x5eec54){if(!_0x5eec54){_0x282634[_0x0b7f('0xd')](0x194);}return _0x5eec54;};}function handleError(_0x1ec1d3,_0x26f974){_0x26f974=_0x26f974||0x1f4;return function(_0x47736b){logger[_0x0b7f('0x1d')](_0x47736b[_0x0b7f('0x1e')]);if(_0x47736b[_0x0b7f('0x1f')]){delete _0x47736b[_0x0b7f('0x1f')];}_0x1ec1d3[_0x0b7f('0xe')](_0x26f974)['send'](_0x47736b);};}exports[_0x0b7f('0x20')]=function(_0x2ce9fa,_0x57ce74){var _0x50776a={};var _0x4a2841={'count':0x0,'rows':[]};var _0x37a5e5=_[_0x0b7f('0x21')](db['FaxQueue'][_0x0b7f('0x22')],function(_0x3cda59){return{'name':_0x3cda59[_0x0b7f('0x23')],'type':_0x3cda59[_0x0b7f('0x24')][_0x0b7f('0x25')]};});_0x50776a=qs[_0x0b7f('0x26')](_0x37a5e5,_0x2ce9fa);var _0x1b8e19={'where':_0x50776a[_0x0b7f('0x27')]};return db[_0x0b7f('0x28')]['count'](_0x1b8e19)['then'](function(_0x4ada58){_0x4a2841[_0x0b7f('0x13')]=_0x4ada58;_0x50776a['include']=qs[_0x0b7f('0x29')](_0x2ce9fa[_0x0b7f('0x2a')]);return db[_0x0b7f('0x28')][_0x0b7f('0x2b')](_0x50776a);})[_0x0b7f('0x17')](function(_0x2df0c6){_0x4a2841[_0x0b7f('0x2c')]=_0x2df0c6;return _0x4a2841;})['then'](respondWithFilteredResult(_0x57ce74,_0x50776a))['catch'](handleError(_0x57ce74,null));};exports[_0x0b7f('0x2d')]=function(_0x5dcf8f,_0x1201a8){var _0x2a4298={'raw':!![],'where':{'id':_0x5dcf8f[_0x0b7f('0x2e')]['id']}},_0x1dc84b={};_0x1dc84b[_0x0b7f('0x2f')]=_[_0x0b7f('0x30')](db[_0x0b7f('0x28')][_0x0b7f('0x22')]);_0x1dc84b[_0x0b7f('0x2a')]=_['keys'](_0x5dcf8f['query']);_0x1dc84b[_0x0b7f('0x31')]=_[_0x0b7f('0x32')](_0x1dc84b[_0x0b7f('0x2f')],_0x1dc84b[_0x0b7f('0x2a')]);_0x2a4298[_0x0b7f('0x33')]=_[_0x0b7f('0x32')](_0x1dc84b[_0x0b7f('0x2f')],qs[_0x0b7f('0x34')](_0x5dcf8f[_0x0b7f('0x2a')]['fields']));_0x2a4298['attributes']=_0x2a4298[_0x0b7f('0x33')]['length']?_0x2a4298[_0x0b7f('0x33')]:_0x1dc84b['model'];if(_0x5dcf8f[_0x0b7f('0x2a')][_0x0b7f('0x35')]){_0x2a4298[_0x0b7f('0x29')]=[{'all':!![]}];}_0x2a4298=_[_0x0b7f('0x36')]({},_0x2a4298,_0x5dcf8f[_0x0b7f('0x37')]);return db[_0x0b7f('0x28')][_0x0b7f('0x38')](_0x2a4298)[_0x0b7f('0x17')](handleEntityNotFound(_0x1201a8,null))[_0x0b7f('0x17')](respondWithResult(_0x1201a8,null))['catch'](handleError(_0x1201a8,null));};exports['create']=function(_0x5e0bd3,_0x17e7f7){return db['FaxQueue'][_0x0b7f('0x39')](_0x5e0bd3[_0x0b7f('0x3a')],{})[_0x0b7f('0x17')](function(_0x30d35e){var _0x1e2f6c=_0x5e0bd3['user'][_0x0b7f('0x19')]({'plain':!![]});if(!_0x1e2f6c)throw new Error(_0x0b7f('0x3b'));if(_0x1e2f6c[_0x0b7f('0x3c')]===_0x0b7f('0x3d')){var _0x40298c=_0x30d35e['get']({'plain':!![]});var _0x46ac32=_0x0b7f('0x1a');return db[_0x0b7f('0x3e')][_0x0b7f('0x38')]({'where':{'name':_0x46ac32,'userProfileId':_0x1e2f6c[_0x0b7f('0x3f')]},'raw':!![]})[_0x0b7f('0x17')](function(_0x40b1c5){if(_0x40b1c5&&_0x40b1c5[_0x0b7f('0x40')]===0x0){return db[_0x0b7f('0x1b')][_0x0b7f('0x39')]({'name':_0x40298c[_0x0b7f('0x1f')],'resourceId':_0x40298c['id'],'type':_0x40b1c5[_0x0b7f('0x1f')],'sectionId':_0x40b1c5['id']},{})[_0x0b7f('0x17')](function(){return _0x30d35e;});}else{return _0x30d35e;}})['catch'](function(_0x4aaf15){logger[_0x0b7f('0x1d')](_0x0b7f('0x41'),_0x4aaf15);throw _0x4aaf15;});}return _0x30d35e;})[_0x0b7f('0x17')](respondWithResult(_0x17e7f7,0xc9))[_0x0b7f('0x42')](handleError(_0x17e7f7,null));};exports[_0x0b7f('0x16')]=function(_0x230c6b,_0x57c147){if(_0x230c6b[_0x0b7f('0x3a')]['id']){delete _0x230c6b[_0x0b7f('0x3a')]['id'];}return db[_0x0b7f('0x28')][_0x0b7f('0x38')]({'where':{'id':_0x230c6b['params']['id']}})[_0x0b7f('0x17')](handleEntityNotFound(_0x57c147,null))['then'](saveUpdates(_0x230c6b[_0x0b7f('0x3a')],null))[_0x0b7f('0x17')](respondWithResult(_0x57c147,null))[_0x0b7f('0x42')](handleError(_0x57c147,null));};exports[_0x0b7f('0x18')]=function(_0x1429c4,_0x47c56b){return db[_0x0b7f('0x28')][_0x0b7f('0x38')]({'where':{'id':_0x1429c4[_0x0b7f('0x2e')]['id']}})[_0x0b7f('0x17')](handleEntityNotFound(_0x47c56b,null))[_0x0b7f('0x17')](removeEntity(_0x47c56b,null))[_0x0b7f('0x42')](handleError(_0x47c56b,null));};exports[_0x0b7f('0x43')]=function(_0x384b42,_0x39a5c5){return db[_0x0b7f('0x28')][_0x0b7f('0x43')]()[_0x0b7f('0x17')](respondWithResult(_0x39a5c5,null))[_0x0b7f('0x42')](handleError(_0x39a5c5,null));};exports['getMembers']=function(_0x2d3921,_0x444c00){var _0x46fae4={'raw':!![],'where':{}},_0x12fd2={},_0x2d765b;return db[_0x0b7f('0x28')][_0x0b7f('0x44')]({'where':{'id':_0x2d3921['params']['id']}})['then'](handleEntityNotFound(_0x444c00,null))['then'](function(_0x16b41b){if(_0x16b41b){_0x2d765b=_0x16b41b[_0x0b7f('0x19')]({'plain':!![]});_0x12fd2['model']=_[_0x0b7f('0x30')](db[_0x0b7f('0x45')]['rawAttributes']);_0x12fd2[_0x0b7f('0x2a')]=_['keys'](_0x2d3921[_0x0b7f('0x2a')]);_0x12fd2['filters']=_[_0x0b7f('0x32')](_0x12fd2[_0x0b7f('0x2f')],_0x12fd2[_0x0b7f('0x2a')]);_0x46fae4[_0x0b7f('0x33')]=_[_0x0b7f('0x32')](_0x12fd2[_0x0b7f('0x2f')],qs[_0x0b7f('0x34')](_0x2d3921[_0x0b7f('0x2a')][_0x0b7f('0x34')]));_0x46fae4[_0x0b7f('0x33')]=_0x46fae4[_0x0b7f('0x33')][_0x0b7f('0x46')]?_0x46fae4[_0x0b7f('0x33')]:_0x12fd2[_0x0b7f('0x2f')];if(!_0x2d3921['query'][_0x0b7f('0x47')](_0x0b7f('0x48'))){_0x46fae4[_0x0b7f('0x12')]=qs[_0x0b7f('0x12')](_0x2d3921[_0x0b7f('0x2a')][_0x0b7f('0x12')]);_0x46fae4['offset']=qs[_0x0b7f('0x10')](_0x2d3921['query']['offset']);}_0x46fae4[_0x0b7f('0x49')]=qs['sort'](_0x2d3921['query']['sort']);_0x46fae4[_0x0b7f('0x27')]=qs[_0x0b7f('0x31')](_['pick'](_0x2d3921['query'],_0x12fd2[_0x0b7f('0x31')]));_0x46fae4[_0x0b7f('0x27')][_0x0b7f('0x4a')]=_0x16b41b['id'];if(_0x2d3921[_0x0b7f('0x2a')][_0x0b7f('0x4b')]){_0x46fae4[_0x0b7f('0x27')]=_[_0x0b7f('0x36')](_0x46fae4['where'],{'$or':_['map'](_0x46fae4['attributes'],function(_0x343a12){var _0x2d06de={};_0x2d06de[_0x343a12]={'$like':'%'+_0x2d3921[_0x0b7f('0x2a')][_0x0b7f('0x4b')]+'%'};return _0x2d06de;})});}_0x46fae4=_[_0x0b7f('0x36')]({},_0x46fae4,_0x2d3921[_0x0b7f('0x37')]);return db[_0x0b7f('0x45')][_0x0b7f('0x2b')](_0x46fae4);}})[_0x0b7f('0x17')](function(_0x54a1cc){if(_0x54a1cc){return db[_0x0b7f('0x4c')]['findAndCountAll']({'where':{'id':_[_0x0b7f('0x21')](_0x54a1cc,_0x0b7f('0x4d')),'role':'agent'},'attributes':['id',_0x0b7f('0x1f'),'faxPause','updatedAt',_0x0b7f('0x4e')]});}})[_0x0b7f('0x17')](function(_0x15d70c){if(_0x15d70c){return{'count':_0x15d70c[_0x0b7f('0x13')],'rows':_[_0x0b7f('0x21')](_0x15d70c[_0x0b7f('0x2c')],function(_0x2afc9b){return{'membername':_0x2afc9b[_0x0b7f('0x1f')],'UserId':_0x2afc9b['id'],'queue_name':_0x2d765b[_0x0b7f('0x1f')],'FaxQueueId':_0x2d765b['id'],'interface':util[_0x0b7f('0x4f')](_0x0b7f('0x50'),_0x0b7f('0x51'),_0x2afc9b[_0x0b7f('0x1f')]),'penalty':0x0,'paused':_0x2afc9b[_0x0b7f('0x52')],'createdAt':_0x2afc9b[_0x0b7f('0x4e')],'updatedAt':_0x2afc9b[_0x0b7f('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b7f('0x17')](respondWithFilteredResult(_0x444c00,_0x46fae4))[_0x0b7f('0x42')](handleError(_0x444c00,null));};exports[_0x0b7f('0x54')]=function(_0x48f434,_0x1476cf){var _0x43b607={};var _0x5f456a={};var _0x2cc10e;var _0xebf333;return db['FaxQueue'][_0x0b7f('0x44')]({'where':{'id':_0x48f434['params']['id']}})[_0x0b7f('0x17')](handleEntityNotFound(_0x1476cf,null))[_0x0b7f('0x17')](function(_0xb7fa33){if(_0xb7fa33){_0x2cc10e=_0xb7fa33;_0x5f456a[_0x0b7f('0x2f')]=_['keys'](db[_0x0b7f('0x55')][_0x0b7f('0x22')]);_0x5f456a['query']=_['keys'](_0x48f434[_0x0b7f('0x2a')]);_0x5f456a[_0x0b7f('0x31')]=_[_0x0b7f('0x32')](_0x5f456a[_0x0b7f('0x2f')],_0x5f456a[_0x0b7f('0x2a')]);_0x43b607[_0x0b7f('0x33')]=_[_0x0b7f('0x32')](_0x5f456a[_0x0b7f('0x2f')],qs[_0x0b7f('0x34')](_0x48f434[_0x0b7f('0x2a')][_0x0b7f('0x34')]));_0x43b607['attributes']=_0x43b607[_0x0b7f('0x33')][_0x0b7f('0x46')]?_0x43b607['attributes']:_0x5f456a[_0x0b7f('0x2f')];_0x43b607['order']=qs[_0x0b7f('0x56')](_0x48f434['query']['sort']);_0x43b607['where']=qs[_0x0b7f('0x31')](_['pick'](_0x48f434['query'],_0x5f456a[_0x0b7f('0x31')]));if(_0x48f434[_0x0b7f('0x2a')][_0x0b7f('0x4b')]){_0x43b607[_0x0b7f('0x27')]=_[_0x0b7f('0x36')](_0x43b607[_0x0b7f('0x27')],{'$or':_[_0x0b7f('0x21')](_0x43b607[_0x0b7f('0x33')],function(_0x27777f){var _0x3ed83b={};_0x3ed83b[_0x27777f]={'$like':'%'+_0x48f434[_0x0b7f('0x2a')][_0x0b7f('0x4b')]+'%'};return _0x3ed83b;})});}_0x43b607=_[_0x0b7f('0x36')]({},_0x43b607,_0x48f434['options']);return _0x2cc10e[_0x0b7f('0x54')](_0x43b607);}})[_0x0b7f('0x17')](function(_0x2317ba){if(_0x2317ba){_0xebf333=_0x2317ba[_0x0b7f('0x46')];if(!_0x48f434[_0x0b7f('0x2a')][_0x0b7f('0x47')](_0x0b7f('0x48'))){_0x43b607['limit']=qs[_0x0b7f('0x12')](_0x48f434[_0x0b7f('0x2a')]['limit']);_0x43b607['offset']=qs['offset'](_0x48f434['query'][_0x0b7f('0x10')]);}return _0x2cc10e[_0x0b7f('0x54')](_0x43b607);}})[_0x0b7f('0x17')](function(_0x11c39d){if(_0x11c39d){return _0x11c39d?{'count':_0xebf333,'rows':_0x11c39d}:null;}})[_0x0b7f('0x17')](respondWithResult(_0x1476cf,null))[_0x0b7f('0x42')](handleError(_0x1476cf,null));};exports['addTeams']=function(_0x5296d9,_0x3ad3b6){var _0x146e75=_0x5296d9[_0x0b7f('0x3a')][_0x0b7f('0x57')];return db['Team']['findAll']({'where':{'id':_0x146e75},'attributes':['id'],'include':[{'model':db[_0x0b7f('0x4c')],'as':_0x0b7f('0x58'),'attributes':['id',_0x0b7f('0x1f'),_0x0b7f('0x59'),_0x0b7f('0x5a'),_0x0b7f('0x5b')],'raw':!![]}]})[_0x0b7f('0x17')](function(_0xd7aae9){if(_0xd7aae9){var _0x41423f=_[_0x0b7f('0x5c')](_0xd7aae9,function(_0x24a9fd){var _0x120e4b=_0x24a9fd['get']({'plain':!![]});return _0x120e4b['Agents'];});return db[_0x0b7f('0x28')]['find']({'where':{'id':_0x5296d9['params']['id']}})['then'](function(_0x2c7f2b){return db[_0x0b7f('0x5d')]['transaction'](function(_0x21522c){return _0x2c7f2b[_0x0b7f('0x5e')](_0x146e75,{'transaction':_0x21522c})[_0x0b7f('0x17')](function(){return BPromise[_0x0b7f('0x5f')](_0x41423f,function(_0xee415c){return db[_0x0b7f('0x45')][_0x0b7f('0x60')]({'where':{'UserId':_0xee415c['id'],'FaxQueueId':_0x5296d9[_0x0b7f('0x2e')]['id']},'transaction':_0x21522c});});})[_0x0b7f('0x17')](function(){_0x41423f[_0x0b7f('0x61')](function(_0x4582a6){socket[_0x0b7f('0x62')](_0x0b7f('0x63'),{'UserId':_0x4582a6['id'],'FaxQueueId':_0x2c7f2b['id']});});});});});}})[_0x0b7f('0x17')](respondWithStatusCode(_0x3ad3b6,null))[_0x0b7f('0x42')](handleError(_0x3ad3b6,null));};exports[_0x0b7f('0x64')]=function(_0x3d896a,_0x185f7f){return db[_0x0b7f('0x55')]['findAll']({'where':{'id':_0x3d896a['query'][_0x0b7f('0x57')]},'attributes':['id'],'include':[{'model':db[_0x0b7f('0x4c')],'as':_0x0b7f('0x58'),'attributes':['id'],'raw':!![]}]})[_0x0b7f('0x17')](handleEntityNotFound(_0x185f7f,null))['then'](function(_0x54531d){var _0x55714e=_[_0x0b7f('0x21')](_0x54531d,'id');var _0x4ac551=[];var _0x3f6479=[];var _0x431bcf=squel['select']();_0x431bcf[_0x0b7f('0x65')](_0x0b7f('0x66'))['from'](_0x0b7f('0x67'),'tq')['join'](_0x0b7f('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0b7f('0x27')](_0x0b7f('0x69'),_0x3d896a[_0x0b7f('0x2e')]['id']);for(var _0x44979a=0x0;_0x44979a<_0x54531d[_0x0b7f('0x46')];_0x44979a+=0x1){let _0x3928a4=_0x54531d[_0x44979a];for(var _0x3abe26=0x0;_0x3abe26<_0x3928a4['Agents'][_0x0b7f('0x46')];_0x3abe26+=0x1){let _0xc4e2d4=_0x3928a4['Agents'][_0x3abe26];var _0x61f8d4=_0x431bcf[_0x0b7f('0x6a')]();_0x61f8d4['where'](_0x0b7f('0x6b'),_0xc4e2d4['id']);_0x3f6479[_0x0b7f('0x6c')](db['sequelize']['query'](_0x61f8d4[_0x0b7f('0x6d')](),{'type':db['sequelize'][_0x0b7f('0x6e')][_0x0b7f('0x6f')]})[_0x0b7f('0x17')](function(_0x147289){if(_0x147289['length']===0x1){return _0xc4e2d4['id'];}else{var _0x34ee5a=_[_0x0b7f('0x70')](_[_0x0b7f('0x21')](_0x147289,_0x0b7f('0x71')),function(_0x4a628f){return _[_0x0b7f('0x72')](_0x55714e,_0x4a628f);});if(_0x34ee5a){return _0xc4e2d4['id'];}}}));}}return BPromise[_0x0b7f('0x73')](_0x3f6479)['then'](function(_0x2b4693){_0x4ac551=_(_0x4ac551)[_0x0b7f('0x74')](_0x2b4693)['compact']()[_0x0b7f('0x75')]();return db[_0x0b7f('0x28')][_0x0b7f('0x38')]({'where':{'id':_0x3d896a[_0x0b7f('0x2e')]['id']}})[_0x0b7f('0x17')](function(_0x4dc00a){return db[_0x0b7f('0x5d')][_0x0b7f('0x76')](function(_0x5f365){return _0x4dc00a['removeTeams'](_0x3d896a['query'][_0x0b7f('0x57')],{'transaction':_0x5f365})['then'](function(){if(!_[_0x0b7f('0x77')](_0x4ac551)){return _0x4dc00a['removeAgents'](_0x4ac551,{'transaction':_0x5f365});}})['then'](function(){_0x4ac551[_0x0b7f('0x61')](function(_0x566042){socket[_0x0b7f('0x62')]('userFaxQueue:remove',{'UserId':_0x566042,'FaxQueueId':_0x4dc00a['id']});});});});});});})[_0x0b7f('0x17')](respondWithStatusCode(_0x185f7f,null))[_0x0b7f('0x42')](handleError(_0x185f7f,null));};exports[_0x0b7f('0x78')]=function(_0x2a9cb5,_0x3c2311){return db[_0x0b7f('0x28')]['find']({'where':{'id':_0x2a9cb5[_0x0b7f('0x2e')]['id']}})[_0x0b7f('0x17')](handleEntityNotFound(_0x3c2311,null))[_0x0b7f('0x17')](function(_0x3f3c0a){if(_0x3f3c0a){return _0x3f3c0a[_0x0b7f('0x78')](_0x2a9cb5[_0x0b7f('0x3a')][_0x0b7f('0x57')],_[_0x0b7f('0x79')](_0x2a9cb5['body'],['ids','id'])||{})[_0x0b7f('0x7a')](function(_0x3da116){for(var _0x229687=0x0;_0x229687<_0x2a9cb5['body'][_0x0b7f('0x57')][_0x0b7f('0x46')];_0x229687+=0x1){socket['emit'](_0x0b7f('0x63'),{'UserId':Number(_0x2a9cb5[_0x0b7f('0x3a')][_0x0b7f('0x57')][_0x229687]),'FaxQueueId':Number(_0x2a9cb5[_0x0b7f('0x2e')]['id'])});}return _0x3da116;});}})[_0x0b7f('0x17')](respondWithResult(_0x3c2311,null))[_0x0b7f('0x42')](handleError(_0x3c2311,null));};exports[_0x0b7f('0x7b')]=function(_0x1b37b3,_0x30c146){return db[_0x0b7f('0x28')][_0x0b7f('0x38')]({'where':{'id':_0x1b37b3[_0x0b7f('0x2e')]['id']}})['then'](handleEntityNotFound(_0x30c146,null))[_0x0b7f('0x17')](function(_0x380c63){if(_0x380c63){return _0x380c63[_0x0b7f('0x7b')](_0x1b37b3[_0x0b7f('0x2a')][_0x0b7f('0x57')])['then'](function(){if(_[_0x0b7f('0x7c')](_0x1b37b3[_0x0b7f('0x2a')][_0x0b7f('0x57')])){for(var _0x267691=0x0;_0x267691<_0x1b37b3[_0x0b7f('0x2a')][_0x0b7f('0x57')]['length'];_0x267691+=0x1){socket[_0x0b7f('0x62')](_0x0b7f('0x7d'),{'UserId':Number(_0x1b37b3[_0x0b7f('0x2a')][_0x0b7f('0x57')][_0x267691]),'FaxQueueId':Number(_0x1b37b3['params']['id'])});}}else{socket['emit'](_0x0b7f('0x7d'),{'UserId':Number(_0x1b37b3['query'][_0x0b7f('0x57')]),'FaxQueueId':Number(_0x1b37b3[_0x0b7f('0x2e')]['id'])});}});}})[_0x0b7f('0x17')](respondWithStatusCode(_0x30c146,null))[_0x0b7f('0x42')](handleError(_0x30c146,null));};exports[_0x0b7f('0x7e')]=function(_0x48992c,_0x3b65d5){var _0x532915={};var _0x2f9949={};var _0x3f0bce;var _0x4783b0;return db[_0x0b7f('0x28')][_0x0b7f('0x44')]({'where':{'id':_0x48992c[_0x0b7f('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3b65d5,null))[_0x0b7f('0x17')](function(_0x100e6a){if(_0x100e6a){_0x3f0bce=_0x100e6a;_0x2f9949[_0x0b7f('0x2f')]=_[_0x0b7f('0x30')](db['User'][_0x0b7f('0x22')]);_0x2f9949[_0x0b7f('0x2a')]=_[_0x0b7f('0x30')](_0x48992c[_0x0b7f('0x2a')]);_0x2f9949[_0x0b7f('0x31')]=_['intersection'](_0x2f9949[_0x0b7f('0x2f')],_0x2f9949[_0x0b7f('0x2a')]);_0x532915[_0x0b7f('0x33')]=_['intersection'](_0x2f9949['model'],qs[_0x0b7f('0x34')](_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x34')]));_0x532915[_0x0b7f('0x33')]=_0x532915[_0x0b7f('0x33')]['length']?_0x532915[_0x0b7f('0x33')]:_0x2f9949[_0x0b7f('0x2f')];_0x532915[_0x0b7f('0x49')]=qs[_0x0b7f('0x56')](_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x56')]);_0x532915['where']=qs['filters'](_['pick'](_0x48992c[_0x0b7f('0x2a')],_0x2f9949[_0x0b7f('0x31')]));if(_0x48992c['query'][_0x0b7f('0x4b')]){_0x532915[_0x0b7f('0x27')]=_[_0x0b7f('0x36')](_0x532915[_0x0b7f('0x27')],{'$or':_['map'](_0x532915[_0x0b7f('0x33')],function(_0x4522bc){var _0x2312e5={};_0x2312e5[_0x4522bc]={'$like':'%'+_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x4b')]+'%'};return _0x2312e5;})});}_0x532915=_[_0x0b7f('0x36')]({},_0x532915,_0x48992c[_0x0b7f('0x37')]);return _0x3f0bce[_0x0b7f('0x7e')](_0x532915);}})[_0x0b7f('0x17')](function(_0x14a0dd){if(_0x14a0dd){_0x4783b0=_0x14a0dd['length'];if(!_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x47')](_0x0b7f('0x48'))){_0x532915[_0x0b7f('0x12')]=qs[_0x0b7f('0x12')](_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x12')]);_0x532915[_0x0b7f('0x10')]=qs[_0x0b7f('0x10')](_0x48992c[_0x0b7f('0x2a')][_0x0b7f('0x10')]);}return _0x3f0bce[_0x0b7f('0x7e')](_0x532915);}})[_0x0b7f('0x17')](function(_0x251792){if(_0x251792){return _0x251792?{'count':_0x4783b0,'rows':_0x251792}:null;}})[_0x0b7f('0x17')](respondWithResult(_0x3b65d5,null))[_0x0b7f('0x42')](handleError(_0x3b65d5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 575504a..2397912 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 _0xbfea=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xbfea,0xe3));var _0xabfe=function(_0xac333b,_0x5de319){_0xac333b=_0xac333b-0x0;var _0x105e7a=_0xbfea[_0xac333b];return _0x105e7a;};'use strict';var EventEmitter=require(_0xabfe('0x0'));var FaxQueue=require(_0xabfe('0x1'))['db'][_0xabfe('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xabfe('0x3')](0x0);var events={'afterCreate':_0xabfe('0x4'),'afterUpdate':_0xabfe('0x5'),'afterDestroy':_0xabfe('0x6')};function emitEvent(_0x3a247d){return function(_0x4a4d64,_0x25fd6c,_0x15e625){FaxQueueEvents[_0xabfe('0x7')](_0x3a247d+':'+_0x4a4d64['id'],_0x4a4d64);FaxQueueEvents['emit'](_0x3a247d,_0x4a4d64);_0x15e625(null);};}for(var e in events){if(events[_0xabfe('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xabfe('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x016d=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x016d,0xf9));var _0xd016=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x016d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xd016('0x0'));var FaxQueue=require(_0xd016('0x1'))['db'][_0xd016('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd016('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd016('0x4'),'afterDestroy':_0xd016('0x5')};function emitEvent(_0x3676c4){return function(_0x2d5920,_0x42fb4e,_0x1f8e86){FaxQueueEvents[_0xd016('0x6')](_0x3676c4+':'+_0x2d5920['id'],_0x2d5920);FaxQueueEvents[_0xd016('0x6')](_0x3676c4,_0x2d5920);_0x1f8e86(null);};}for(var e in events){if(events[_0xd016('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xd016('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c2746b2..75293c4 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 _0x197e=['api','moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x197e,0x19d));var _0xe197=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x197e[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xe197('0x0'));var util=require(_0xe197('0x1'));var logger=require(_0xe197('0x2'))(_0xe197('0x3'));var moment=require(_0xe197('0x4'));var BPromise=require(_0xe197('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe197('0x6'));var rimraf=require('rimraf');var config=require(_0xe197('0x7'));var attributes=require(_0xe197('0x8'));module[_0xe197('0x9')]=function(_0x2bee37,_0x5c5e5b){return _0x2bee37[_0xe197('0xa')](_0xe197('0xb'),attributes,{'tableName':_0xe197('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd1c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0xc64699,_0x1b3076){var _0x40732e=function(_0x23d369){while(--_0x23d369){_0xc64699['push'](_0xc64699['shift']());}};_0x40732e(++_0x1b3076);}(_0xfd1c,0xf0));var _0xcfd1=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xfd1c[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require('lodash');var util=require(_0xcfd1('0x0'));var logger=require(_0xcfd1('0x1'))(_0xcfd1('0x2'));var moment=require('moment');var BPromise=require(_0xcfd1('0x3'));var rp=require(_0xcfd1('0x4'));var fs=require('fs');var path=require(_0xcfd1('0x5'));var rimraf=require(_0xcfd1('0x6'));var config=require(_0xcfd1('0x7'));var attributes=require(_0xcfd1('0x8'));module['exports']=function(_0x1b436b,_0x541e04){return _0x1b436b[_0xcfd1('0x9')](_0xcfd1('0xa'),attributes,{'tableName':_0xcfd1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index e1b12b0..37816c5 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 _0xb3f5=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','request'];(function(_0x52326b,_0x50e99c){var _0x3b695f=function(_0x5cb88e){while(--_0x5cb88e){_0x52326b['push'](_0x52326b['shift']());}};_0x3b695f(++_0x50e99c);}(_0xb3f5,0xeb));var _0x5b3f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb3f5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5b3f('0x0'));var util=require(_0x5b3f('0x1'));var moment=require(_0x5b3f('0x2'));var BPromise=require(_0x5b3f('0x3'));var rs=require(_0x5b3f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b3f('0x6'))(_0x5b3f('0x7'));var config=require(_0x5b3f('0x8'));var jayson=require(_0x5b3f('0x9'));var client=jayson[_0x5b3f('0xa')][_0x5b3f('0xb')]({'port':0x232a});config[_0x5b3f('0xc')]=_['defaults'](config['redis'],{'host':_0x5b3f('0xd'),'port':0x18eb});var socket=require(_0x5b3f('0xe'))(new Redis(config[_0x5b3f('0xc')]));require(_0x5b3f('0xf'))['register'](socket);function respondWithRpcPromise(_0x3693ab,_0x266b13,_0xab8b47){return new BPromise(function(_0x2fa512,_0x2ce194){return client[_0x5b3f('0x10')](_0x3693ab,_0xab8b47)[_0x5b3f('0x11')](function(_0x2ae328){logger[_0x5b3f('0x12')](_0x5b3f('0x13'),_0x266b13,_0x5b3f('0x14'));logger[_0x5b3f('0x15')](_0x5b3f('0x16'),_0x266b13,'request\x20sent',JSON[_0x5b3f('0x17')](_0x2ae328));if(_0x2ae328[_0x5b3f('0x18')]){if(_0x2ae328['error'][_0x5b3f('0x19')]===0x1f4){logger[_0x5b3f('0x18')](_0x5b3f('0x13'),_0x266b13,_0x2ae328[_0x5b3f('0x18')][_0x5b3f('0x1a')]);return _0x2ce194(_0x2ae328['error'][_0x5b3f('0x1a')]);}logger[_0x5b3f('0x18')](_0x5b3f('0x13'),_0x266b13,_0x2ae328[_0x5b3f('0x18')][_0x5b3f('0x1a')]);return _0x2fa512(_0x2ae328[_0x5b3f('0x18')][_0x5b3f('0x1a')]);}else{logger[_0x5b3f('0x12')](_0x5b3f('0x13'),_0x266b13,'request\x20sent');_0x2fa512(_0x2ae328[_0x5b3f('0x1b')][_0x5b3f('0x1a')]);}})[_0x5b3f('0x1c')](function(_0x5bb8e0){logger[_0x5b3f('0x18')](_0x5b3f('0x13'),_0x266b13,_0x5bb8e0);_0x2ce194(_0x5bb8e0);});});}exports[_0x5b3f('0x1d')]=function(_0x50c07e){var _0x32dbd1=this;return new Promise(function(_0x304bc2,_0x1d44c0){return db[_0x5b3f('0x1e')][_0x5b3f('0x1f')]({'raw':_0x50c07e[_0x5b3f('0x20')]?_0x50c07e['options'][_0x5b3f('0x21')]===undefined?!![]:![]:!![],'where':_0x50c07e['options']?_0x50c07e['options'][_0x5b3f('0x22')]||null:null,'attributes':_0x50c07e[_0x5b3f('0x20')]?_0x50c07e[_0x5b3f('0x20')][_0x5b3f('0x23')]||null:null,'limit':_0x50c07e['options']?_0x50c07e[_0x5b3f('0x20')][_0x5b3f('0x24')]||null:null,'include':_0x50c07e['options']?_0x50c07e['options'][_0x5b3f('0x25')]?_[_0x5b3f('0x26')](_0x50c07e[_0x5b3f('0x20')][_0x5b3f('0x25')],function(_0x436328){return{'model':db[_0x436328[_0x5b3f('0x27')]],'as':_0x436328['as'],'attributes':_0x436328[_0x5b3f('0x23')],'include':_0x436328[_0x5b3f('0x25')]?_['map'](_0x436328[_0x5b3f('0x25')],function(_0x40cafe){return{'model':db[_0x40cafe[_0x5b3f('0x27')]],'as':_0x40cafe['as'],'attributes':_0x40cafe[_0x5b3f('0x23')],'include':_0x40cafe[_0x5b3f('0x25')]?_['map'](_0x40cafe[_0x5b3f('0x25')],function(_0x2a9664){return{'model':db[_0x2a9664[_0x5b3f('0x27')]],'as':_0x2a9664['as'],'attributes':_0x2a9664[_0x5b3f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x535e4d){logger[_0x5b3f('0x12')]('GetFaxQueue',_0x50c07e);logger['debug'](_0x5b3f('0x1d'),_0x50c07e,JSON[_0x5b3f('0x17')](_0x535e4d));_0x304bc2(_0x535e4d);})[_0x5b3f('0x1c')](function(_0x13afd2){logger[_0x5b3f('0x18')]('GetFaxQueue',_0x13afd2[_0x5b3f('0x1a')],_0x50c07e);_0x1d44c0(_0x32dbd1['error'](0x1f4,_0x13afd2[_0x5b3f('0x1a')]));});});};exports[_0x5b3f('0x28')]=function(_0x3da258){var _0x26a62b=this;return new Promise(function(_0x313c67,_0x588221){return db[_0x5b3f('0x1e')][_0x5b3f('0x29')]({'raw':_0x3da258[_0x5b3f('0x20')]?_0x3da258[_0x5b3f('0x20')][_0x5b3f('0x21')]===undefined?!![]:![]:!![],'where':_0x3da258[_0x5b3f('0x20')]?_0x3da258[_0x5b3f('0x20')]['where']||null:null,'attributes':_0x3da258['options']?_0x3da258[_0x5b3f('0x20')]['attributes']||null:null,'include':_0x3da258[_0x5b3f('0x20')]?_0x3da258['options'][_0x5b3f('0x25')]?_[_0x5b3f('0x26')](_0x3da258['options'][_0x5b3f('0x25')],function(_0x5ee033){return{'model':db[_0x5ee033[_0x5b3f('0x27')]],'as':_0x5ee033['as'],'attributes':_0x5ee033[_0x5b3f('0x23')],'include':_0x5ee033[_0x5b3f('0x25')]?_[_0x5b3f('0x26')](_0x5ee033[_0x5b3f('0x25')],function(_0x46e72a){return{'model':db[_0x46e72a[_0x5b3f('0x27')]],'as':_0x46e72a['as'],'attributes':_0x46e72a[_0x5b3f('0x23')],'include':_0x46e72a[_0x5b3f('0x25')]?_[_0x5b3f('0x26')](_0x46e72a[_0x5b3f('0x25')],function(_0x42defc){return{'model':db[_0x42defc[_0x5b3f('0x27')]],'as':_0x42defc['as'],'attributes':_0x42defc[_0x5b3f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5b3f('0x11')](function(_0x17d4b5){logger[_0x5b3f('0x12')](_0x5b3f('0x28'),_0x3da258);logger[_0x5b3f('0x15')](_0x5b3f('0x28'),_0x3da258,JSON[_0x5b3f('0x17')](_0x17d4b5));_0x313c67(_0x17d4b5);})[_0x5b3f('0x1c')](function(_0x678531){logger[_0x5b3f('0x18')](_0x5b3f('0x28'),_0x678531['message'],_0x3da258);_0x588221(_0x26a62b[_0x5b3f('0x18')](0x1f4,_0x678531[_0x5b3f('0x1a')]));});});}; \ No newline at end of file +var _0xa890=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0xe323e3,_0x110473){var _0x208a43=function(_0x18695c){while(--_0x18695c){_0xe323e3['push'](_0xe323e3['shift']());}};_0x208a43(++_0x110473);}(_0xa890,0x163));var _0x0a89=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xa890[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x0a89('0x0'));var util=require(_0x0a89('0x1'));var moment=require(_0x0a89('0x2'));var BPromise=require(_0x0a89('0x3'));var rs=require(_0x0a89('0x4'));var fs=require('fs');var Redis=require(_0x0a89('0x5'));var db=require(_0x0a89('0x6'))['db'];var utils=require(_0x0a89('0x7'));var logger=require('../../config/logger')(_0x0a89('0x8'));var config=require(_0x0a89('0x9'));var jayson=require(_0x0a89('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0a89('0xb')]=_[_0x0a89('0xc')](config[_0x0a89('0xb')],{'host':_0x0a89('0xd'),'port':0x18eb});var socket=require(_0x0a89('0xe'))(new Redis(config[_0x0a89('0xb')]));require(_0x0a89('0xf'))['register'](socket);function respondWithRpcPromise(_0x425041,_0x223eee,_0x1e657a){return new BPromise(function(_0x193729,_0xa7db8d){return client[_0x0a89('0x10')](_0x425041,_0x1e657a)['then'](function(_0x46570c){logger[_0x0a89('0x11')](_0x0a89('0x12'),_0x223eee,_0x0a89('0x13'));logger[_0x0a89('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x223eee,'request\x20sent',JSON['stringify'](_0x46570c));if(_0x46570c['error']){if(_0x46570c[_0x0a89('0x15')][_0x0a89('0x16')]===0x1f4){logger[_0x0a89('0x15')](_0x0a89('0x12'),_0x223eee,_0x46570c['error'][_0x0a89('0x17')]);return _0xa7db8d(_0x46570c[_0x0a89('0x15')][_0x0a89('0x17')]);}logger[_0x0a89('0x15')](_0x0a89('0x12'),_0x223eee,_0x46570c['error']['message']);return _0x193729(_0x46570c['error']['message']);}else{logger[_0x0a89('0x11')](_0x0a89('0x12'),_0x223eee,'request\x20sent');_0x193729(_0x46570c[_0x0a89('0x18')][_0x0a89('0x17')]);}})[_0x0a89('0x19')](function(_0xc14c66){logger[_0x0a89('0x15')]('FaxQueue,\x20%s,\x20%s',_0x223eee,_0xc14c66);_0xa7db8d(_0xc14c66);});});}exports[_0x0a89('0x1a')]=function(_0x21ee87){var _0x509d19=this;return new Promise(function(_0x2c869b,_0x103ce5){return db[_0x0a89('0x1b')][_0x0a89('0x1c')]({'raw':_0x21ee87['options']?_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x1e')]===undefined?!![]:![]:!![],'where':_0x21ee87[_0x0a89('0x1d')]?_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x1f')]||null:null,'attributes':_0x21ee87[_0x0a89('0x1d')]?_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x20')]||null:null,'limit':_0x21ee87[_0x0a89('0x1d')]?_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x21')]||null:null,'include':_0x21ee87[_0x0a89('0x1d')]?_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x22')]?_['map'](_0x21ee87[_0x0a89('0x1d')][_0x0a89('0x22')],function(_0x4ac68b){return{'model':db[_0x4ac68b[_0x0a89('0x23')]],'as':_0x4ac68b['as'],'attributes':_0x4ac68b[_0x0a89('0x20')],'include':_0x4ac68b[_0x0a89('0x22')]?_[_0x0a89('0x24')](_0x4ac68b['include'],function(_0x296803){return{'model':db[_0x296803[_0x0a89('0x23')]],'as':_0x296803['as'],'attributes':_0x296803[_0x0a89('0x20')],'include':_0x296803['include']?_[_0x0a89('0x24')](_0x296803[_0x0a89('0x22')],function(_0x4e1289){return{'model':db[_0x4e1289[_0x0a89('0x23')]],'as':_0x4e1289['as'],'attributes':_0x4e1289[_0x0a89('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41f084){logger[_0x0a89('0x11')]('GetFaxQueue',_0x21ee87);logger[_0x0a89('0x14')]('GetFaxQueue',_0x21ee87,JSON[_0x0a89('0x25')](_0x41f084));_0x2c869b(_0x41f084);})['catch'](function(_0x3fc2bf){logger[_0x0a89('0x15')](_0x0a89('0x1a'),_0x3fc2bf[_0x0a89('0x17')],_0x21ee87);_0x103ce5(_0x509d19[_0x0a89('0x15')](0x1f4,_0x3fc2bf['message']));});});};exports[_0x0a89('0x26')]=function(_0x5ca765){var _0x46cd3=this;return new Promise(function(_0x39f9c4,_0x244835){return db['FaxQueue'][_0x0a89('0x27')]({'raw':_0x5ca765[_0x0a89('0x1d')]?_0x5ca765['options'][_0x0a89('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ca765['options']?_0x5ca765['options'][_0x0a89('0x1f')]||null:null,'attributes':_0x5ca765['options']?_0x5ca765[_0x0a89('0x1d')][_0x0a89('0x20')]||null:null,'include':_0x5ca765[_0x0a89('0x1d')]?_0x5ca765[_0x0a89('0x1d')][_0x0a89('0x22')]?_[_0x0a89('0x24')](_0x5ca765['options'][_0x0a89('0x22')],function(_0x41c65d){return{'model':db[_0x41c65d['model']],'as':_0x41c65d['as'],'attributes':_0x41c65d[_0x0a89('0x20')],'include':_0x41c65d['include']?_[_0x0a89('0x24')](_0x41c65d['include'],function(_0x51fbfc){return{'model':db[_0x51fbfc[_0x0a89('0x23')]],'as':_0x51fbfc['as'],'attributes':_0x51fbfc['attributes'],'include':_0x51fbfc[_0x0a89('0x22')]?_[_0x0a89('0x24')](_0x51fbfc[_0x0a89('0x22')],function(_0x5770d2){return{'model':db[_0x5770d2[_0x0a89('0x23')]],'as':_0x5770d2['as'],'attributes':_0x5770d2[_0x0a89('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29445b){logger['info']('ShowFaxQueue',_0x5ca765);logger[_0x0a89('0x14')](_0x0a89('0x26'),_0x5ca765,JSON['stringify'](_0x29445b));_0x39f9c4(_0x29445b);})[_0x0a89('0x19')](function(_0x13369e){logger[_0x0a89('0x15')](_0x0a89('0x26'),_0x13369e[_0x0a89('0x17')],_0x5ca765);_0x244835(_0x46cd3['error'](0x1f4,_0x13369e[_0x0a89('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5363bf6..767f662 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 _0xdc8c=['length','faxQueue:','./faxQueue.events','save','removeListener'];(function(_0x4b358c,_0x5564ea){var _0x48bb60=function(_0x5f18c1){while(--_0x5f18c1){_0x4b358c['push'](_0x4b358c['shift']());}};_0x48bb60(++_0x5564ea);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x29dc1d,_0x1b9640){_0x29dc1d=_0x29dc1d-0x0;var _0x42bf1c=_0xdc8c[_0x29dc1d];return _0x42bf1c;};'use strict';var FaxQueueEvents=require(_0xcdc8('0x0'));var events=[_0xcdc8('0x1'),'remove','update'];function createListener(_0x2480d5,_0x55ebc3){return function(_0xbf2050){_0x55ebc3['emit'](_0x2480d5,_0xbf2050);};}function removeListener(_0x1ea31e,_0x3adbf0){return function(){FaxQueueEvents[_0xcdc8('0x2')](_0x1ea31e,_0x3adbf0);};}exports['register']=function(_0x2808b1){for(var _0x36e0db=0x0,_0x2feede=events[_0xcdc8('0x3')];_0x36e0db<_0x2feede;_0x36e0db++){var _0x1f6292=events[_0x36e0db];var _0x1830d2=createListener(_0xcdc8('0x4')+_0x1f6292,_0x2808b1);FaxQueueEvents['on'](_0x1f6292,_0x1830d2);}}; \ No newline at end of file +var _0xac12=['update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xac12,0x7c));var _0x2ac1=function(_0x34b66e,_0x32c6a0){_0x34b66e=_0x34b66e-0x0;var _0x3bd12a=_0xac12[_0x34b66e];return _0x3bd12a;};'use strict';var FaxQueueEvents=require(_0x2ac1('0x0'));var events=[_0x2ac1('0x1'),'remove',_0x2ac1('0x2')];function createListener(_0x7ff374,_0x54ae5b){return function(_0x941015){_0x54ae5b[_0x2ac1('0x3')](_0x7ff374,_0x941015);};}function removeListener(_0x5a84ea,_0x2c4d54){return function(){FaxQueueEvents[_0x2ac1('0x4')](_0x5a84ea,_0x2c4d54);};}exports['register']=function(_0x393bf3){for(var _0x4c167a=0x0,_0x265f20=events[_0x2ac1('0x5')];_0x4c167a<_0x265f20;_0x4c167a++){var _0x2b7053=events[_0x4c167a];var _0x2f2594=createListener(_0x2ac1('0x6')+_0x2b7053,_0x393bf3);FaxQueueEvents['on'](_0x2b7053,_0x2f2594);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e9da61c..e1ba65d 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 _0xb46f=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x2863c0,_0x4cc0d9){var _0x152c27=function(_0x208807){while(--_0x208807){_0x2863c0['push'](_0x2863c0['shift']());}};_0x152c27(++_0x4cc0d9);}(_0xb46f,0xb6));var _0xfb46=function(_0x5d9f26,_0x3aa76c){_0x5d9f26=_0x5d9f26-0x0;var _0xf8441f=_0xb46f[_0x5d9f26];return _0xf8441f;};'use strict';var multer=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var path=require('path');var timeout=require(_0xfb46('0x2'));var express=require(_0xfb46('0x3'));var router=express[_0xfb46('0x4')]();var fs_extra=require(_0xfb46('0x5'));var auth=require(_0xfb46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb46('0x7'));var controller=require('./faxQueue.controller');router[_0xfb46('0x8')]('/',auth[_0xfb46('0x9')](),controller[_0xfb46('0xa')]);router[_0xfb46('0x8')](_0xfb46('0xb'),auth['isAuthenticated'](),controller[_0xfb46('0xc')]);router[_0xfb46('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xfb46('0xd'),auth['isAuthenticated'](),controller[_0xfb46('0xe')]);router[_0xfb46('0x8')](_0xfb46('0xf'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x10')]);router[_0xfb46('0x8')](_0xfb46('0x11'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x12')]);router[_0xfb46('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb46('0x13')]('/:id/teams',auth[_0xfb46('0x9')](),controller[_0xfb46('0x14')]);router['post'](_0xfb46('0x11'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x15')]);router[_0xfb46('0x16')]('/:id',auth[_0xfb46('0x9')](),controller[_0xfb46('0x17')]);router[_0xfb46('0x18')]('/:id',auth[_0xfb46('0x9')](),controller[_0xfb46('0x19')]);router['delete']('/:id/teams',auth[_0xfb46('0x9')](),controller[_0xfb46('0x1a')]);router[_0xfb46('0x18')](_0xfb46('0x11'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x1b')]);module[_0xfb46('0x1c')]=router; \ No newline at end of file +var _0xef17=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','describe','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','put','update','destroy'];(function(_0x14ec75,_0x56a3d4){var _0x40b9e9=function(_0x4d2f39){while(--_0x4d2f39){_0x14ec75['push'](_0x14ec75['shift']());}};_0x40b9e9(++_0x56a3d4);}(_0xef17,0x136));var _0x7ef1=function(_0x48cfe5,_0x16a475){_0x48cfe5=_0x48cfe5-0x0;var _0x3f373a=_0xef17[_0x48cfe5];return _0x3f373a;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xb')](_0x7ef1('0xe'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xf')]);router[_0x7ef1('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ef1('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7ef1('0x11')]);router['post']('/',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0x14'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x13')](_0x7ef1('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7ef1('0x17')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x19')]);router['delete'](_0x7ef1('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7ef1('0x16'),auth['isAuthenticated'](),controller[_0x7ef1('0x1a')]);module[_0x7ef1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 45a59ce..d2f7155 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 _0xdcbb=['DATE','moment','sequelize','exports','STRING'];(function(_0x10faf,_0x45c106){var _0x38985f=function(_0x5c9e34){while(--_0x5c9e34){_0x10faf['push'](_0x10faf['shift']());}};_0x38985f(++_0x45c106);}(_0xdcbb,0x18c));var _0xbdcb=function(_0x248b81,_0x439449){_0x248b81=_0x248b81-0x0;var _0x3f6b9d=_0xdcbb[_0x248b81];return _0x3f6b9d;};'use strict';var moment=require(_0xbdcb('0x0'));var Sequelize=require(_0xbdcb('0x1'));module[_0xbdcb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbdcb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbdcb('0x4')]},'acceptAt':{'type':Sequelize[_0xbdcb('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4434=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f010c,_0x4adcd8){var _0x3cca72=function(_0x2538c7){while(--_0x2538c7){_0x1f010c['push'](_0x1f010c['shift']());}};_0x3cca72(++_0x4adcd8);}(_0x4434,0xb4));var _0x4443=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4434[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x4443('0x0'));var Sequelize=require(_0x4443('0x1'));module[_0x4443('0x2')]={'uniqueid':{'type':Sequelize[_0x4443('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4443('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4443('0x4')]},'acceptAt':{'type':Sequelize[_0x4443('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4443('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7e061f3..b247dc7 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 _0xdeb3=['filter','merge','options','FaxQueueReport','count','includeAll','rows','catch','show','keys','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x19154d,_0x282c59){var _0x5608ef=function(_0x13032d){while(--_0x13032d){_0x19154d['push'](_0x19154d['shift']());}};_0x5608ef(++_0x282c59);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require(_0x3deb('0x3'));var rp=require(_0x3deb('0x4'));var moment=require(_0x3deb('0x5'));var BPromise=require(_0x3deb('0x6'));var Mustache=require(_0x3deb('0x7'));var util=require(_0x3deb('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3deb('0x9'));var fs=require('fs');var fs_extra=require(_0x3deb('0xa'));var _=require(_0x3deb('0xb'));var squel=require(_0x3deb('0xc'));var crypto=require(_0x3deb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3deb('0xe'));var querystring=require(_0x3deb('0xf'));var Papa=require(_0x3deb('0x10'));var Redis=require(_0x3deb('0x11'));var authService=require(_0x3deb('0x12'));var qs=require(_0x3deb('0x13'));var as=require(_0x3deb('0x14'));var hardwareService=require(_0x3deb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3deb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0x21f596,_0x78aa81){_0x78aa81=_0x78aa81||0xcc;return function(_0x1055dc){if(_0x1055dc){return _0x21f596['sendStatus'](_0x78aa81);}return _0x21f596[_0x3deb('0x18')](_0x78aa81)[_0x3deb('0x19')]();};}function respondWithResult(_0x1a651d,_0x228e23){_0x228e23=_0x228e23||0xc8;return function(_0x329f3a){if(_0x329f3a){return _0x1a651d[_0x3deb('0x18')](_0x228e23)[_0x3deb('0x1a')](_0x329f3a);}};}function respondWithFilteredResult(_0xa25716,_0x4a291e){return function(_0x428f90){if(_0x428f90){var _0xa45605=typeof _0x4a291e['offset']===_0x3deb('0x1b')&&typeof _0x4a291e[_0x3deb('0x1c')]==='undefined';var _0x5cd9db=_0x428f90['count'];var _0x2a8ec4=_0xa45605?0x0:_0x4a291e[_0x3deb('0x1d')];var _0x4adbaa=_0xa45605?_0x428f90['count']:_0x4a291e[_0x3deb('0x1d')]+_0x4a291e[_0x3deb('0x1c')];var _0xb6be32;if(_0x4adbaa>=_0x5cd9db){_0x4adbaa=_0x5cd9db;_0xb6be32=0xc8;}else{_0xb6be32=0xce;}_0xa25716[_0x3deb('0x18')](_0xb6be32);return _0xa25716['set'](_0x3deb('0x1e'),_0x2a8ec4+'-'+_0x4adbaa+'/'+_0x5cd9db)[_0x3deb('0x1a')](_0x428f90);}return null;};}function patchUpdates(_0xbd82de){return function(_0x4ceab2){try{jsonpatch[_0x3deb('0x1f')](_0x4ceab2,_0xbd82de,!![]);}catch(_0x144671){return BPromise[_0x3deb('0x20')](_0x144671);}return _0x4ceab2[_0x3deb('0x21')]();};}function saveUpdates(_0x22ea80,_0x543014){return function(_0x35843b){if(_0x35843b){return _0x35843b[_0x3deb('0x22')](_0x22ea80)[_0x3deb('0x23')](function(_0x428869){return _0x428869;});}return null;};}function removeEntity(_0x12f415,_0x385e2a){return function(_0x3f3d52){if(_0x3f3d52){return _0x3f3d52[_0x3deb('0x24')]()['then'](function(){_0x12f415[_0x3deb('0x18')](0xcc)[_0x3deb('0x19')]();});}};}function handleEntityNotFound(_0x1aacbd,_0x427f9f){return function(_0x472a46){if(!_0x472a46){_0x1aacbd['sendStatus'](0x194);}return _0x472a46;};}function handleError(_0x1185dd,_0x225ea9){_0x225ea9=_0x225ea9||0x1f4;return function(_0x474878){logger[_0x3deb('0x25')](_0x474878[_0x3deb('0x26')]);if(_0x474878[_0x3deb('0x27')]){delete _0x474878[_0x3deb('0x27')];}_0x1185dd['status'](_0x225ea9)['send'](_0x474878);};}exports[_0x3deb('0x28')]=function(_0x520f24,_0x2efb59){var _0x28a4ca={},_0x2bd20f={},_0x492ca0={'count':0x0,'rows':[]};var _0x460512=_['map'](db['FaxQueueReport'][_0x3deb('0x29')],function(_0x205c22){return{'name':_0x205c22[_0x3deb('0x2a')],'type':_0x205c22[_0x3deb('0x2b')]['key']};});_0x2bd20f['model']=_[_0x3deb('0x2c')](_0x460512,_0x3deb('0x27'));_0x2bd20f['query']=_['keys'](_0x520f24[_0x3deb('0x2d')]);_0x2bd20f[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x2bd20f['model'],_0x2bd20f[_0x3deb('0x2d')]);_0x28a4ca['attributes']=_[_0x3deb('0x2f')](_0x2bd20f[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x28a4ca[_0x3deb('0x32')]=_0x28a4ca[_0x3deb('0x32')][_0x3deb('0x33')]?_0x28a4ca[_0x3deb('0x32')]:_0x2bd20f[_0x3deb('0x30')];if(!_0x520f24['query'][_0x3deb('0x34')](_0x3deb('0x35'))){_0x28a4ca[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x28a4ca[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1d')]);}_0x28a4ca[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x28a4ca[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x520f24['query'],_0x2bd20f[_0x3deb('0x2e')]),_0x460512);if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x28a4ca['where']=_[_0x3deb('0x3a')](_0x28a4ca['where'],{'$or':_[_0x3deb('0x2c')](_0x460512,function(_0x53525c){if(_0x53525c[_0x3deb('0x2b')]!=='VIRTUAL'){var _0x3103c5={};_0x3103c5[_0x53525c[_0x3deb('0x27')]]={'$like':'%'+_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x3103c5;}})});}_0x28a4ca=_['merge']({},_0x28a4ca,_0x520f24[_0x3deb('0x3b')]);var _0x53fdef={'where':_0x28a4ca[_0x3deb('0x38')]};return db[_0x3deb('0x3c')][_0x3deb('0x3d')](_0x53fdef)[_0x3deb('0x23')](function(_0x3c9310){_0x492ca0[_0x3deb('0x3d')]=_0x3c9310;if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x28a4ca['include']=[{'all':!![]}];}return db[_0x3deb('0x3c')]['findAll'](_0x28a4ca);})['then'](function(_0x5bbbfa){_0x492ca0[_0x3deb('0x3f')]=_0x5bbbfa;return _0x492ca0;})[_0x3deb('0x23')](respondWithFilteredResult(_0x2efb59,_0x28a4ca))[_0x3deb('0x40')](handleError(_0x2efb59,null));};exports[_0x3deb('0x41')]=function(_0x27a64e,_0x7e7374){var _0x2e2c03={'raw':!![],'where':{'id':_0x27a64e['params']['id']}},_0x4eed4a={};_0x4eed4a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x3c')][_0x3deb('0x29')]);_0x4eed4a[_0x3deb('0x2d')]=_['keys'](_0x27a64e[_0x3deb('0x2d')]);_0x4eed4a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x4eed4a['model'],_0x4eed4a[_0x3deb('0x2d')]);_0x2e2c03[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x4eed4a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x27a64e['query'][_0x3deb('0x31')]));_0x2e2c03[_0x3deb('0x32')]=_0x2e2c03[_0x3deb('0x32')]['length']?_0x2e2c03['attributes']:_0x4eed4a[_0x3deb('0x30')];if(_0x27a64e[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x2e2c03[_0x3deb('0x43')]=[{'all':!![]}];}_0x2e2c03=_[_0x3deb('0x3a')]({},_0x2e2c03,_0x27a64e['options']);return db[_0x3deb('0x3c')][_0x3deb('0x44')](_0x2e2c03)[_0x3deb('0x23')](handleEntityNotFound(_0x7e7374,null))[_0x3deb('0x23')](respondWithResult(_0x7e7374,null))[_0x3deb('0x40')](handleError(_0x7e7374,null));};exports[_0x3deb('0x45')]=function(_0x524ac8,_0x384788){return db[_0x3deb('0x3c')]['create'](_0x524ac8[_0x3deb('0x46')],{})[_0x3deb('0x23')](respondWithResult(_0x384788,0xc9))[_0x3deb('0x40')](handleError(_0x384788,null));};exports[_0x3deb('0x22')]=function(_0x448505,_0x4b3cd6){if(_0x448505[_0x3deb('0x46')]['id']){delete _0x448505[_0x3deb('0x46')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x448505['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x4b3cd6,null))[_0x3deb('0x23')](saveUpdates(_0x448505['body'],null))['then'](respondWithResult(_0x4b3cd6,null))[_0x3deb('0x40')](handleError(_0x4b3cd6,null));};exports[_0x3deb('0x24')]=function(_0x8aabc0,_0x3b4688){return db['FaxQueueReport'][_0x3deb('0x44')]({'where':{'id':_0x8aabc0[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x3b4688,null))[_0x3deb('0x23')](removeEntity(_0x3b4688,null))[_0x3deb('0x40')](handleError(_0x3b4688,null));};exports[_0x3deb('0x48')]=function(_0x19a1d7,_0x662ee6){return db['FaxQueueReport']['describe']()[_0x3deb('0x23')](respondWithResult(_0x662ee6,null))[_0x3deb('0x40')](handleError(_0x662ee6,null));}; \ No newline at end of file +var _0x81d5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81d5,0x1ab));var _0x581d=function(_0x1520a8,_0x2a9639){_0x1520a8=_0x1520a8-0x0;var _0x47891d=_0x81d5[_0x1520a8];return _0x47891d;};'use strict';var emlformat=require(_0x581d('0x0'));var rimraf=require(_0x581d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x581d('0x2'));var rp=require(_0x581d('0x3'));var moment=require(_0x581d('0x4'));var BPromise=require(_0x581d('0x5'));var Mustache=require(_0x581d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x581d('0x7'));var csv=require(_0x581d('0x8'));var ejs=require(_0x581d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x581d('0xa'));var squel=require(_0x581d('0xb'));var crypto=require(_0x581d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x581d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x581d('0xe'));var authService=require(_0x581d('0xf'));var qs=require(_0x581d('0x10'));var as=require(_0x581d('0x11'));var hardwareService=require(_0x581d('0x12'));var logger=require('../../config/logger')(_0x581d('0x13'));var utils=require(_0x581d('0x14'));var config=require(_0x581d('0x15'));var licenseUtil=require(_0x581d('0x16'));var db=require(_0x581d('0x17'))['db'];function respondWithStatusCode(_0x271bd1,_0x1fb6ed){_0x1fb6ed=_0x1fb6ed||0xcc;return function(_0x3329cc){if(_0x3329cc){return _0x271bd1[_0x581d('0x18')](_0x1fb6ed);}return _0x271bd1[_0x581d('0x19')](_0x1fb6ed)['end']();};}function respondWithResult(_0x338c88,_0xfab29f){_0xfab29f=_0xfab29f||0xc8;return function(_0x51a035){if(_0x51a035){return _0x338c88['status'](_0xfab29f)['json'](_0x51a035);}};}function respondWithFilteredResult(_0x4deffa,_0x110e13){return function(_0x550365){if(_0x550365){var _0x1d609f=typeof _0x110e13[_0x581d('0x1a')]==='undefined'&&typeof _0x110e13[_0x581d('0x1b')]==='undefined';var _0x3172f6=_0x550365[_0x581d('0x1c')];var _0x1e059d=_0x1d609f?0x0:_0x110e13[_0x581d('0x1a')];var _0x1f790f=_0x1d609f?_0x550365[_0x581d('0x1c')]:_0x110e13[_0x581d('0x1a')]+_0x110e13['limit'];var _0x2be45b;if(_0x1f790f>=_0x3172f6){_0x1f790f=_0x3172f6;_0x2be45b=0xc8;}else{_0x2be45b=0xce;}_0x4deffa[_0x581d('0x19')](_0x2be45b);return _0x4deffa[_0x581d('0x1d')](_0x581d('0x1e'),_0x1e059d+'-'+_0x1f790f+'/'+_0x3172f6)[_0x581d('0x1f')](_0x550365);}return null;};}function patchUpdates(_0x2a2aba){return function(_0x4635a8){try{jsonpatch[_0x581d('0x20')](_0x4635a8,_0x2a2aba,!![]);}catch(_0x468543){return BPromise[_0x581d('0x21')](_0x468543);}return _0x4635a8[_0x581d('0x22')]();};}function saveUpdates(_0xf74d2b,_0x5add13){return function(_0xb96c3d){if(_0xb96c3d){return _0xb96c3d[_0x581d('0x23')](_0xf74d2b)[_0x581d('0x24')](function(_0x2a4cd9){return _0x2a4cd9;});}return null;};}function removeEntity(_0x2addd8,_0x4f7420){return function(_0x36cc8a){if(_0x36cc8a){return _0x36cc8a[_0x581d('0x25')]()['then'](function(){_0x2addd8[_0x581d('0x19')](0xcc)[_0x581d('0x26')]();});}};}function handleEntityNotFound(_0x2c8fdb,_0x5a3fd7){return function(_0x190545){if(!_0x190545){_0x2c8fdb[_0x581d('0x18')](0x194);}return _0x190545;};}function handleError(_0x146323,_0xc270bc){_0xc270bc=_0xc270bc||0x1f4;return function(_0x38f213){logger[_0x581d('0x27')](_0x38f213['stack']);if(_0x38f213[_0x581d('0x28')]){delete _0x38f213[_0x581d('0x28')];}_0x146323[_0x581d('0x19')](_0xc270bc)['send'](_0x38f213);};}exports['index']=function(_0x504f71,_0x489682){var _0x355efe={},_0x266a2b={},_0x337361={'count':0x0,'rows':[]};var _0x408cce=_[_0x581d('0x29')](db[_0x581d('0x2a')][_0x581d('0x2b')],function(_0x298953){return{'name':_0x298953[_0x581d('0x2c')],'type':_0x298953[_0x581d('0x2d')][_0x581d('0x2e')]};});_0x266a2b['model']=_[_0x581d('0x29')](_0x408cce,'name');_0x266a2b[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x504f71[_0x581d('0x2f')]);_0x266a2b[_0x581d('0x31')]=_[_0x581d('0x32')](_0x266a2b[_0x581d('0x33')],_0x266a2b['query']);_0x355efe[_0x581d('0x34')]=_[_0x581d('0x32')](_0x266a2b['model'],qs['fields'](_0x504f71['query'][_0x581d('0x35')]));_0x355efe[_0x581d('0x34')]=_0x355efe[_0x581d('0x34')][_0x581d('0x36')]?_0x355efe[_0x581d('0x34')]:_0x266a2b[_0x581d('0x33')];if(!_0x504f71[_0x581d('0x2f')]['hasOwnProperty'](_0x581d('0x37'))){_0x355efe[_0x581d('0x1b')]=qs['limit'](_0x504f71[_0x581d('0x2f')][_0x581d('0x1b')]);_0x355efe[_0x581d('0x1a')]=qs[_0x581d('0x1a')](_0x504f71[_0x581d('0x2f')]['offset']);}_0x355efe[_0x581d('0x38')]=qs['sort'](_0x504f71[_0x581d('0x2f')][_0x581d('0x39')]);_0x355efe['where']=qs['filters'](_['pick'](_0x504f71['query'],_0x266a2b[_0x581d('0x31')]),_0x408cce);if(_0x504f71['query'][_0x581d('0x3a')]){_0x355efe['where']=_[_0x581d('0x3b')](_0x355efe[_0x581d('0x3c')],{'$or':_[_0x581d('0x29')](_0x408cce,function(_0x393b2e){if(_0x393b2e[_0x581d('0x2d')]!==_0x581d('0x3d')){var _0x28f091={};_0x28f091[_0x393b2e[_0x581d('0x28')]]={'$like':'%'+_0x504f71[_0x581d('0x2f')][_0x581d('0x3a')]+'%'};return _0x28f091;}})});}_0x355efe=_['merge']({},_0x355efe,_0x504f71['options']);var _0x47668c={'where':_0x355efe[_0x581d('0x3c')]};return db[_0x581d('0x2a')]['count'](_0x47668c)[_0x581d('0x24')](function(_0x1b6aee){_0x337361[_0x581d('0x1c')]=_0x1b6aee;if(_0x504f71['query'][_0x581d('0x3e')]){_0x355efe[_0x581d('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x581d('0x40')](_0x355efe);})[_0x581d('0x24')](function(_0x211c64){_0x337361[_0x581d('0x41')]=_0x211c64;return _0x337361;})[_0x581d('0x24')](respondWithFilteredResult(_0x489682,_0x355efe))[_0x581d('0x42')](handleError(_0x489682,null));};exports[_0x581d('0x43')]=function(_0x5550b4,_0x3cadb3){var _0x283743={'raw':!![],'where':{'id':_0x5550b4['params']['id']}},_0x20fbf1={};_0x20fbf1[_0x581d('0x33')]=_[_0x581d('0x30')](db['FaxQueueReport']['rawAttributes']);_0x20fbf1[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x5550b4[_0x581d('0x2f')]);_0x20fbf1['filters']=_[_0x581d('0x32')](_0x20fbf1[_0x581d('0x33')],_0x20fbf1['query']);_0x283743[_0x581d('0x34')]=_['intersection'](_0x20fbf1[_0x581d('0x33')],qs['fields'](_0x5550b4[_0x581d('0x2f')]['fields']));_0x283743['attributes']=_0x283743[_0x581d('0x34')]['length']?_0x283743['attributes']:_0x20fbf1['model'];if(_0x5550b4[_0x581d('0x2f')][_0x581d('0x3e')]){_0x283743[_0x581d('0x3f')]=[{'all':!![]}];}_0x283743=_['merge']({},_0x283743,_0x5550b4[_0x581d('0x44')]);return db[_0x581d('0x2a')]['find'](_0x283743)['then'](handleEntityNotFound(_0x3cadb3,null))[_0x581d('0x24')](respondWithResult(_0x3cadb3,null))['catch'](handleError(_0x3cadb3,null));};exports[_0x581d('0x45')]=function(_0x5a5c30,_0x32eed9){return db[_0x581d('0x2a')]['create'](_0x5a5c30[_0x581d('0x46')],{})[_0x581d('0x24')](respondWithResult(_0x32eed9,0xc9))[_0x581d('0x42')](handleError(_0x32eed9,null));};exports[_0x581d('0x23')]=function(_0x3b8b5e,_0x4dca9e){if(_0x3b8b5e[_0x581d('0x46')]['id']){delete _0x3b8b5e[_0x581d('0x46')]['id'];}return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3b8b5e[_0x581d('0x48')]['id']}})[_0x581d('0x24')](handleEntityNotFound(_0x4dca9e,null))[_0x581d('0x24')](saveUpdates(_0x3b8b5e['body'],null))[_0x581d('0x24')](respondWithResult(_0x4dca9e,null))[_0x581d('0x42')](handleError(_0x4dca9e,null));};exports[_0x581d('0x25')]=function(_0x3e95c6,_0xba6b00){return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3e95c6['params']['id']}})[_0x581d('0x24')](handleEntityNotFound(_0xba6b00,null))[_0x581d('0x24')](removeEntity(_0xba6b00,null))['catch'](handleError(_0xba6b00,null));};exports[_0x581d('0x49')]=function(_0x508d4c,_0x29f36e){return db[_0x581d('0x2a')][_0x581d('0x49')]()[_0x581d('0x24')](respondWithResult(_0x29f36e,null))['catch'](handleError(_0x29f36e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e4ae979..b25ef38 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x54b745,_0x5a9d1c){var _0x476fc0=function(_0x486966){while(--_0x486966){_0x54b745['push'](_0x54b745['shift']());}};_0x476fc0(++_0x5a9d1c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e3fa9,_0x57068a){var _0x39067b=function(_0x1fa12d){while(--_0x1fa12d){_0x4e3fa9['push'](_0x4e3fa9['shift']());}};_0x39067b(++_0x57068a);}(_0x4975,0x86));var _0x5497=function(_0x1bb1fd,_0x45295c){_0x1bb1fd=_0x1bb1fd-0x0;var _0x527ba9=_0x4975[_0x1bb1fd];return _0x527ba9;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 30188f5..d746617 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 _0x7708=['FaxQueueReport','create','body','options','stringify','catch','UpdateFaxQueueReport','update','attributes','limit','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7708,0x83));var _0x8770=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x7708[_0x54a2e4];return _0x4742d0;};'use strict';var _=require(_0x8770('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8770('0x1'));var rs=require(_0x8770('0x2'));var fs=require('fs');var Redis=require(_0x8770('0x3'));var db=require(_0x8770('0x4'))['db'];var utils=require(_0x8770('0x5'));var logger=require('../../config/logger')(_0x8770('0x6'));var config=require(_0x8770('0x7'));var jayson=require(_0x8770('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d288b,_0x1795bc,_0x38c855){return new BPromise(function(_0x42e8f8,_0x20a583){return client[_0x8770('0x9')](_0x2d288b,_0x38c855)['then'](function(_0x134579){logger[_0x8770('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x1795bc,_0x8770('0xb'));logger[_0x8770('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1795bc,_0x8770('0xb'),JSON['stringify'](_0x134579));if(_0x134579[_0x8770('0xd')]){if(_0x134579['error'][_0x8770('0xe')]===0x1f4){logger[_0x8770('0xd')](_0x8770('0xf'),_0x1795bc,_0x134579['error'][_0x8770('0x10')]);return _0x20a583(_0x134579[_0x8770('0xd')]['message']);}logger[_0x8770('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1795bc,_0x134579[_0x8770('0xd')][_0x8770('0x10')]);return _0x42e8f8(_0x134579['error'][_0x8770('0x10')]);}else{logger[_0x8770('0xa')](_0x8770('0xf'),_0x1795bc,_0x8770('0xb'));_0x42e8f8(_0x134579[_0x8770('0x11')][_0x8770('0x10')]);}})['catch'](function(_0x1fd63b){logger[_0x8770('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1795bc,_0x1fd63b);_0x20a583(_0x1fd63b);});});}exports[_0x8770('0x12')]=function(_0x233f3a){var _0x10e927=this;return new Promise(function(_0x1b0bcc,_0x2a46eb){return db[_0x8770('0x13')][_0x8770('0x14')](_0x233f3a[_0x8770('0x15')],{'raw':_0x233f3a[_0x8770('0x16')]?_0x233f3a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x39765c){logger[_0x8770('0xa')](_0x8770('0x12'),_0x233f3a);logger[_0x8770('0xc')](_0x8770('0x12'),_0x233f3a,JSON[_0x8770('0x17')](_0x39765c));_0x1b0bcc(_0x39765c);})[_0x8770('0x18')](function(_0x2f1049){logger[_0x8770('0xd')]('CreateFaxQueueReport',_0x2f1049['message'],_0x233f3a);_0x2a46eb(_0x10e927[_0x8770('0xd')](0x1f4,_0x2f1049[_0x8770('0x10')]));});});};exports[_0x8770('0x19')]=function(_0x1e0ade){var _0x3a6eef=this;return new Promise(function(_0x278543,_0x58f32c){return db[_0x8770('0x13')][_0x8770('0x1a')](_0x1e0ade[_0x8770('0x15')],{'raw':_0x1e0ade[_0x8770('0x16')]?_0x1e0ade['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0ade[_0x8770('0x16')]?_0x1e0ade['options']['where']||null:null,'attributes':_0x1e0ade['options']?_0x1e0ade['options'][_0x8770('0x1b')]||null:null,'limit':_0x1e0ade[_0x8770('0x16')]?_0x1e0ade[_0x8770('0x16')][_0x8770('0x1c')]||null:null})[_0x8770('0x1d')](function(_0x273027){logger['info'](_0x8770('0x19'),_0x1e0ade);logger[_0x8770('0xc')](_0x8770('0x19'),_0x1e0ade,JSON['stringify'](_0x273027));_0x278543(_0x273027);})[_0x8770('0x18')](function(_0x35049e){logger[_0x8770('0xd')](_0x8770('0x19'),_0x35049e[_0x8770('0x10')],_0x1e0ade);_0x58f32c(_0x3a6eef['error'](0x1f4,_0x35049e[_0x8770('0x10')]));});});}; \ No newline at end of file +var _0xfd9c=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','update','body'];(function(_0x222fa4,_0x3efe2e){var _0x12fce4=function(_0x2526c0){while(--_0x2526c0){_0x222fa4['push'](_0x222fa4['shift']());}};_0x12fce4(++_0x3efe2e);}(_0xfd9c,0xf0));var _0xcfd9=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xfd9c[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0xcfd9('0x0'));var util=require(_0xcfd9('0x1'));var moment=require(_0xcfd9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfd9('0x3'));var db=require(_0xcfd9('0x4'))['db'];var utils=require(_0xcfd9('0x5'));var logger=require(_0xcfd9('0x6'))(_0xcfd9('0x7'));var config=require(_0xcfd9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcfd9('0x9')][_0xcfd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37a78d,_0x748d3,_0x39556a){return new BPromise(function(_0x32be4d,_0x25f1d){return client['request'](_0x37a78d,_0x39556a)[_0xcfd9('0xb')](function(_0x546593){logger['info'](_0xcfd9('0xc'),_0x748d3,_0xcfd9('0xd'));logger[_0xcfd9('0xe')](_0xcfd9('0xf'),_0x748d3,_0xcfd9('0xd'),JSON[_0xcfd9('0x10')](_0x546593));if(_0x546593[_0xcfd9('0x11')]){if(_0x546593[_0xcfd9('0x11')][_0xcfd9('0x12')]===0x1f4){logger[_0xcfd9('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x748d3,_0x546593[_0xcfd9('0x11')][_0xcfd9('0x13')]);return _0x25f1d(_0x546593[_0xcfd9('0x11')][_0xcfd9('0x13')]);}logger[_0xcfd9('0x11')](_0xcfd9('0xc'),_0x748d3,_0x546593[_0xcfd9('0x11')][_0xcfd9('0x13')]);return _0x32be4d(_0x546593['error'][_0xcfd9('0x13')]);}else{logger[_0xcfd9('0x14')](_0xcfd9('0xc'),_0x748d3,'request\x20sent');_0x32be4d(_0x546593[_0xcfd9('0x15')]['message']);}})[_0xcfd9('0x16')](function(_0x190c9a){logger[_0xcfd9('0x11')](_0xcfd9('0xc'),_0x748d3,_0x190c9a);_0x25f1d(_0x190c9a);});});}exports[_0xcfd9('0x17')]=function(_0x17e25f){var _0x1ff6b7=this;return new Promise(function(_0x4d8a8e,_0x55713d){return db[_0xcfd9('0x18')]['create'](_0x17e25f['body'],{'raw':_0x17e25f[_0xcfd9('0x19')]?_0x17e25f[_0xcfd9('0x19')][_0xcfd9('0x1a')]===undefined?!![]:![]:!![]})[_0xcfd9('0xb')](function(_0x5b4f02){logger['info'](_0xcfd9('0x17'),_0x17e25f);logger['debug'](_0xcfd9('0x17'),_0x17e25f,JSON[_0xcfd9('0x10')](_0x5b4f02));_0x4d8a8e(_0x5b4f02);})[_0xcfd9('0x16')](function(_0x659424){logger[_0xcfd9('0x11')](_0xcfd9('0x17'),_0x659424['message'],_0x17e25f);_0x55713d(_0x1ff6b7[_0xcfd9('0x11')](0x1f4,_0x659424[_0xcfd9('0x13')]));});});};exports[_0xcfd9('0x1b')]=function(_0xd8704a){var _0x28c499=this;return new Promise(function(_0x2ecae0,_0x2085aa){return db['FaxQueueReport'][_0xcfd9('0x1c')](_0xd8704a[_0xcfd9('0x1d')],{'raw':_0xd8704a[_0xcfd9('0x19')]?_0xd8704a[_0xcfd9('0x19')][_0xcfd9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd8704a['options']?_0xd8704a[_0xcfd9('0x19')]['where']||null:null,'attributes':_0xd8704a['options']?_0xd8704a['options']['attributes']||null:null,'limit':_0xd8704a['options']?_0xd8704a[_0xcfd9('0x19')]['limit']||null:null})[_0xcfd9('0xb')](function(_0x423c59){logger[_0xcfd9('0x14')]('UpdateFaxQueueReport',_0xd8704a);logger[_0xcfd9('0xe')](_0xcfd9('0x1b'),_0xd8704a,JSON[_0xcfd9('0x10')](_0x423c59));_0x2ecae0(_0x423c59);})[_0xcfd9('0x16')](function(_0x5e7722){logger[_0xcfd9('0x11')](_0xcfd9('0x1b'),_0x5e7722['message'],_0xd8704a);_0x2085aa(_0x28c499[_0xcfd9('0x11')](0x1f4,_0x5e7722[_0xcfd9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 78f6eaa..ecb8b89 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 _0x1433=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','update','destroy','exports','multer'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x1433,0x13f));var _0x3143=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1433[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var path=require('path');var timeout=require(_0x3143('0x2'));var express=require(_0x3143('0x3'));var router=express[_0x3143('0x4')]();var fs_extra=require(_0x3143('0x5'));var auth=require(_0x3143('0x6'));var interaction=require(_0x3143('0x7'));var config=require('../../config/environment');var controller=require(_0x3143('0x8'));router[_0x3143('0x9')]('/',auth['isAuthenticated'](),controller[_0x3143('0xa')]);router[_0x3143('0x9')](_0x3143('0xb'),auth['isAuthenticated'](),controller[_0x3143('0xc')]);router[_0x3143('0x9')](_0x3143('0xd'),auth[_0x3143('0xe')](),controller[_0x3143('0xf')]);router[_0x3143('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3143('0xd'),auth[_0x3143('0xe')](),controller[_0x3143('0x11')]);router['delete'](_0x3143('0xd'),auth['isAuthenticated'](),controller[_0x3143('0x12')]);module[_0x3143('0x13')]=router; \ No newline at end of file +var _0x977a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x977a,0x79));var _0xa977=function(_0x5c99e6,_0x2b3d2e){_0x5c99e6=_0x5c99e6-0x0;var _0x39f6c3=_0x977a[_0x5c99e6];return _0x39f6c3;};'use strict';var multer=require(_0xa977('0x0'));var util=require(_0xa977('0x1'));var path=require(_0xa977('0x2'));var timeout=require(_0xa977('0x3'));var express=require(_0xa977('0x4'));var router=express[_0xa977('0x5')]();var fs_extra=require(_0xa977('0x6'));var auth=require(_0xa977('0x7'));var interaction=require(_0xa977('0x8'));var config=require(_0xa977('0x9'));var controller=require(_0xa977('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xa977('0xb')]);router[_0xa977('0xc')](_0xa977('0xd'),auth[_0xa977('0xe')](),controller[_0xa977('0xf')]);router[_0xa977('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa977('0x10')]('/',auth['isAuthenticated'](),controller[_0xa977('0x11')]);router[_0xa977('0x12')](_0xa977('0x13'),auth[_0xa977('0xe')](),controller[_0xa977('0x14')]);router[_0xa977('0x15')](_0xa977('0x13'),auth[_0xa977('0xe')](),controller[_0xa977('0x16')]);module[_0xa977('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 541f549..15e0410 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x22046b,_0x44ab78){var _0xc3808d=function(_0x362a83){while(--_0x362a83){_0x22046b['push'](_0x22046b['shift']());}};_0xc3808d(++_0x44ab78);}(_0x70e0,0x17b));var _0x070e=function(_0x2cb825,_0x3788bf){_0x2cb825=_0x2cb825-0x0;var _0x315c53=_0x70e0[_0x2cb825];return _0x315c53;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3044e3,_0x255336){var _0x389181=function(_0x4aac71){while(--_0x4aac71){_0x3044e3['push'](_0x3044e3['shift']());}};_0x389181(++_0x255336);}(_0x008c,0x188));var _0xc008=function(_0x3a83c8,_0x489ffd){_0x3a83c8=_0x3a83c8-0x0;var _0x5c89db=_0x008c[_0x3a83c8];return _0x5c89db;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 14a2ef3..ee288f2 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 _0x1d08=['util','sox','to-csv','ejs','fs-extra','crypto','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','status','end','json','offset','undefined','limit','count','set','reject','save','then','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','filter','type','merge','where','includeAll','include','catch','show','params','intersection','length','options','find','create','body','update','describe','eml-format','fast-json-patch','request-promise'];(function(_0x220504,_0x462414){var _0x4778ee=function(_0x1e4099){while(--_0x1e4099){_0x220504['push'](_0x220504['shift']());}};_0x4778ee(++_0x462414);}(_0x1d08,0x1e0));var _0x81d0=function(_0x5ab89f,_0x1b21ea){_0x5ab89f=_0x5ab89f-0x0;var _0x7b6011=_0x1d08[_0x5ab89f];return _0x7b6011;};'use strict';var emlformat=require(_0x81d0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x81d0('0x1'));var rp=require(_0x81d0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81d0('0x3'));var path=require('path');var sox=require(_0x81d0('0x4'));var csv=require(_0x81d0('0x5'));var ejs=require(_0x81d0('0x6'));var fs=require('fs');var fs_extra=require(_0x81d0('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x81d0('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x81d0('0x5'));var querystring=require(_0x81d0('0x9'));var Papa=require(_0x81d0('0xa'));var Redis=require(_0x81d0('0xb'));var authService=require(_0x81d0('0xc'));var qs=require(_0x81d0('0xd'));var as=require(_0x81d0('0xe'));var hardwareService=require(_0x81d0('0xf'));var logger=require(_0x81d0('0x10'))(_0x81d0('0x11'));var utils=require(_0x81d0('0x12'));var config=require(_0x81d0('0x13'));var licenseUtil=require(_0x81d0('0x14'));var db=require(_0x81d0('0x15'))['db'];function respondWithStatusCode(_0x37c0f2,_0x5ddcf4){_0x5ddcf4=_0x5ddcf4||0xcc;return function(_0x4a8e37){if(_0x4a8e37){return _0x37c0f2['sendStatus'](_0x5ddcf4);}return _0x37c0f2[_0x81d0('0x16')](_0x5ddcf4)[_0x81d0('0x17')]();};}function respondWithResult(_0x481079,_0x2a237f){_0x2a237f=_0x2a237f||0xc8;return function(_0x3dbf8f){if(_0x3dbf8f){return _0x481079['status'](_0x2a237f)[_0x81d0('0x18')](_0x3dbf8f);}};}function respondWithFilteredResult(_0x55e729,_0x5b5297){return function(_0x4fa9bd){if(_0x4fa9bd){var _0x4495e0=typeof _0x5b5297[_0x81d0('0x19')]===_0x81d0('0x1a')&&typeof _0x5b5297[_0x81d0('0x1b')]===_0x81d0('0x1a');var _0x341c63=_0x4fa9bd[_0x81d0('0x1c')];var _0x1f2c90=_0x4495e0?0x0:_0x5b5297[_0x81d0('0x19')];var _0x4ca7fd=_0x4495e0?_0x4fa9bd[_0x81d0('0x1c')]:_0x5b5297[_0x81d0('0x19')]+_0x5b5297[_0x81d0('0x1b')];var _0x151d74;if(_0x4ca7fd>=_0x341c63){_0x4ca7fd=_0x341c63;_0x151d74=0xc8;}else{_0x151d74=0xce;}_0x55e729[_0x81d0('0x16')](_0x151d74);return _0x55e729[_0x81d0('0x1d')]('Content-Range',_0x1f2c90+'-'+_0x4ca7fd+'/'+_0x341c63)[_0x81d0('0x18')](_0x4fa9bd);}return null;};}function patchUpdates(_0x54cd3a){return function(_0x15c1be){try{jsonpatch['apply'](_0x15c1be,_0x54cd3a,!![]);}catch(_0x27824d){return BPromise[_0x81d0('0x1e')](_0x27824d);}return _0x15c1be[_0x81d0('0x1f')]();};}function saveUpdates(_0x1202d9,_0x2d939d){return function(_0x498c38){if(_0x498c38){return _0x498c38['update'](_0x1202d9)['then'](function(_0x2d0691){return _0x2d0691;});}return null;};}function removeEntity(_0x202662,_0x471026){return function(_0x143eeb){if(_0x143eeb){return _0x143eeb['destroy']()[_0x81d0('0x20')](function(){_0x202662[_0x81d0('0x16')](0xcc)[_0x81d0('0x17')]();});}};}function handleEntityNotFound(_0x521500,_0x5ede88){return function(_0x148ea2){if(!_0x148ea2){_0x521500[_0x81d0('0x21')](0x194);}return _0x148ea2;};}function handleError(_0x2e8b97,_0x124050){_0x124050=_0x124050||0x1f4;return function(_0x2afeef){logger[_0x81d0('0x22')](_0x2afeef[_0x81d0('0x23')]);if(_0x2afeef[_0x81d0('0x24')]){delete _0x2afeef[_0x81d0('0x24')];}_0x2e8b97[_0x81d0('0x16')](_0x124050)[_0x81d0('0x25')](_0x2afeef);};}exports[_0x81d0('0x26')]=function(_0x3560eb,_0xa754e6){var _0x30cd59={},_0x4d15f1={},_0x1f7499={'count':0x0,'rows':[]};var _0x1d5e61=_[_0x81d0('0x27')](db[_0x81d0('0x28')][_0x81d0('0x29')],function(_0x4e4705){return{'name':_0x4e4705[_0x81d0('0x2a')],'type':_0x4e4705['type']['key']};});_0x4d15f1[_0x81d0('0x2b')]=_[_0x81d0('0x27')](_0x1d5e61,_0x81d0('0x24'));_0x4d15f1[_0x81d0('0x2c')]=_[_0x81d0('0x2d')](_0x3560eb[_0x81d0('0x2c')]);_0x4d15f1[_0x81d0('0x2e')]=_['intersection'](_0x4d15f1[_0x81d0('0x2b')],_0x4d15f1[_0x81d0('0x2c')]);_0x30cd59[_0x81d0('0x2f')]=_['intersection'](_0x4d15f1[_0x81d0('0x2b')],qs['fields'](_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x30')]));_0x30cd59[_0x81d0('0x2f')]=_0x30cd59[_0x81d0('0x2f')]['length']?_0x30cd59[_0x81d0('0x2f')]:_0x4d15f1[_0x81d0('0x2b')];if(!_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x31')](_0x81d0('0x32'))){_0x30cd59[_0x81d0('0x1b')]=qs[_0x81d0('0x1b')](_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x1b')]);_0x30cd59[_0x81d0('0x19')]=qs['offset'](_0x3560eb['query'][_0x81d0('0x19')]);}_0x30cd59['order']=qs['sort'](_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x33')]);_0x30cd59['where']=qs['filters'](_['pick'](_0x3560eb[_0x81d0('0x2c')],_0x4d15f1[_0x81d0('0x2e')]),_0x1d5e61);if(_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x34')]){_0x30cd59['where']=_['merge'](_0x30cd59['where'],{'$or':_['map'](_0x1d5e61,function(_0x420e7b){if(_0x420e7b[_0x81d0('0x35')]!=='VIRTUAL'){var _0x55f9be={};_0x55f9be[_0x420e7b[_0x81d0('0x24')]]={'$like':'%'+_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x34')]+'%'};return _0x55f9be;}})});}_0x30cd59=_[_0x81d0('0x36')]({},_0x30cd59,_0x3560eb['options']);var _0x1984d2={'where':_0x30cd59[_0x81d0('0x37')]};return db['FaxTransferReport'][_0x81d0('0x1c')](_0x1984d2)[_0x81d0('0x20')](function(_0x4a2988){_0x1f7499[_0x81d0('0x1c')]=_0x4a2988;if(_0x3560eb[_0x81d0('0x2c')][_0x81d0('0x38')]){_0x30cd59[_0x81d0('0x39')]=[{'all':!![]}];}return db[_0x81d0('0x28')]['findAll'](_0x30cd59);})[_0x81d0('0x20')](function(_0x55e781){_0x1f7499['rows']=_0x55e781;return _0x1f7499;})[_0x81d0('0x20')](respondWithFilteredResult(_0xa754e6,_0x30cd59))[_0x81d0('0x3a')](handleError(_0xa754e6,null));};exports[_0x81d0('0x3b')]=function(_0x5c25a9,_0x37bfe5){var _0x45ccc4={'raw':!![],'where':{'id':_0x5c25a9[_0x81d0('0x3c')]['id']}},_0x20d781={};_0x20d781[_0x81d0('0x2b')]=_[_0x81d0('0x2d')](db[_0x81d0('0x28')][_0x81d0('0x29')]);_0x20d781[_0x81d0('0x2c')]=_[_0x81d0('0x2d')](_0x5c25a9['query']);_0x20d781[_0x81d0('0x2e')]=_[_0x81d0('0x3d')](_0x20d781[_0x81d0('0x2b')],_0x20d781[_0x81d0('0x2c')]);_0x45ccc4[_0x81d0('0x2f')]=_[_0x81d0('0x3d')](_0x20d781[_0x81d0('0x2b')],qs['fields'](_0x5c25a9['query'][_0x81d0('0x30')]));_0x45ccc4[_0x81d0('0x2f')]=_0x45ccc4[_0x81d0('0x2f')][_0x81d0('0x3e')]?_0x45ccc4['attributes']:_0x20d781['model'];if(_0x5c25a9[_0x81d0('0x2c')]['includeAll']){_0x45ccc4[_0x81d0('0x39')]=[{'all':!![]}];}_0x45ccc4=_['merge']({},_0x45ccc4,_0x5c25a9[_0x81d0('0x3f')]);return db[_0x81d0('0x28')][_0x81d0('0x40')](_0x45ccc4)[_0x81d0('0x20')](handleEntityNotFound(_0x37bfe5,null))[_0x81d0('0x20')](respondWithResult(_0x37bfe5,null))[_0x81d0('0x3a')](handleError(_0x37bfe5,null));};exports[_0x81d0('0x41')]=function(_0xa3b81d,_0x202f7d){return db[_0x81d0('0x28')][_0x81d0('0x41')](_0xa3b81d[_0x81d0('0x42')],{})[_0x81d0('0x20')](respondWithResult(_0x202f7d,0xc9))[_0x81d0('0x3a')](handleError(_0x202f7d,null));};exports[_0x81d0('0x43')]=function(_0xc4add,_0x43d2a0){if(_0xc4add[_0x81d0('0x42')]['id']){delete _0xc4add[_0x81d0('0x42')]['id'];}return db['FaxTransferReport'][_0x81d0('0x40')]({'where':{'id':_0xc4add[_0x81d0('0x3c')]['id']}})[_0x81d0('0x20')](handleEntityNotFound(_0x43d2a0,null))[_0x81d0('0x20')](saveUpdates(_0xc4add[_0x81d0('0x42')],null))[_0x81d0('0x20')](respondWithResult(_0x43d2a0,null))[_0x81d0('0x3a')](handleError(_0x43d2a0,null));};exports['destroy']=function(_0x115fee,_0x629186){return db['FaxTransferReport'][_0x81d0('0x40')]({'where':{'id':_0x115fee['params']['id']}})[_0x81d0('0x20')](handleEntityNotFound(_0x629186,null))[_0x81d0('0x20')](removeEntity(_0x629186,null))[_0x81d0('0x3a')](handleError(_0x629186,null));};exports['describe']=function(_0x3dee00,_0xe108f1){return db[_0x81d0('0x28')][_0x81d0('0x44')]()[_0x81d0('0x20')](respondWithResult(_0xe108f1,null))[_0x81d0('0x3a')](handleError(_0xe108f1,null));}; \ No newline at end of file +var _0xa4ce=['includeAll','findAll','rows','params','keys','include','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','options','FaxTransferReport'];(function(_0x30ffe7,_0x4af92d){var _0x23de6b=function(_0xd5fb95){while(--_0xd5fb95){_0x30ffe7['push'](_0x30ffe7['shift']());}};_0x23de6b(++_0x4af92d);}(_0xa4ce,0x90));var _0xea4c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa4ce[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0xea4c('0x0'));var rimraf=require(_0xea4c('0x1'));var zipdir=require(_0xea4c('0x2'));var jsonpatch=require(_0xea4c('0x3'));var rp=require(_0xea4c('0x4'));var moment=require(_0xea4c('0x5'));var BPromise=require(_0xea4c('0x6'));var Mustache=require(_0xea4c('0x7'));var util=require(_0xea4c('0x8'));var path=require('path');var sox=require(_0xea4c('0x9'));var csv=require(_0xea4c('0xa'));var ejs=require(_0xea4c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea4c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea4c('0xd'));var Papa=require('papaparse');var Redis=require(_0xea4c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea4c('0xf'));var utils=require(_0xea4c('0x10'));var config=require(_0xea4c('0x11'));var licenseUtil=require(_0xea4c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b887,_0x7274e4){_0x7274e4=_0x7274e4||0xcc;return function(_0x1df95b){if(_0x1df95b){return _0x52b887[_0xea4c('0x13')](_0x7274e4);}return _0x52b887['status'](_0x7274e4)[_0xea4c('0x14')]();};}function respondWithResult(_0x2bdc25,_0x1202cf){_0x1202cf=_0x1202cf||0xc8;return function(_0x3fbb74){if(_0x3fbb74){return _0x2bdc25['status'](_0x1202cf)['json'](_0x3fbb74);}};}function respondWithFilteredResult(_0x241a30,_0x58714b){return function(_0x455a41){if(_0x455a41){var _0x21acda=typeof _0x58714b[_0xea4c('0x15')]===_0xea4c('0x16')&&typeof _0x58714b[_0xea4c('0x17')]===_0xea4c('0x16');var _0x5501b8=_0x455a41[_0xea4c('0x18')];var _0x62602=_0x21acda?0x0:_0x58714b[_0xea4c('0x15')];var _0x4adb1b=_0x21acda?_0x455a41[_0xea4c('0x18')]:_0x58714b[_0xea4c('0x15')]+_0x58714b[_0xea4c('0x17')];var _0x1eb45b;if(_0x4adb1b>=_0x5501b8){_0x4adb1b=_0x5501b8;_0x1eb45b=0xc8;}else{_0x1eb45b=0xce;}_0x241a30[_0xea4c('0x19')](_0x1eb45b);return _0x241a30[_0xea4c('0x1a')]('Content-Range',_0x62602+'-'+_0x4adb1b+'/'+_0x5501b8)['json'](_0x455a41);}return null;};}function patchUpdates(_0x97075c){return function(_0x48dc95){try{jsonpatch[_0xea4c('0x1b')](_0x48dc95,_0x97075c,!![]);}catch(_0xff7772){return BPromise['reject'](_0xff7772);}return _0x48dc95[_0xea4c('0x1c')]();};}function saveUpdates(_0x1a1431,_0x4a635e){return function(_0x2e34a1){if(_0x2e34a1){return _0x2e34a1[_0xea4c('0x1d')](_0x1a1431)[_0xea4c('0x1e')](function(_0x5b5a0c){return _0x5b5a0c;});}return null;};}function removeEntity(_0x54d251,_0x5561d2){return function(_0x18874c){if(_0x18874c){return _0x18874c['destroy']()[_0xea4c('0x1e')](function(){_0x54d251[_0xea4c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa8e7,_0x2d4183){return function(_0x95fe19){if(!_0x95fe19){_0x4aa8e7[_0xea4c('0x13')](0x194);}return _0x95fe19;};}function handleError(_0x10a676,_0x40f316){_0x40f316=_0x40f316||0x1f4;return function(_0x5247fd){logger[_0xea4c('0x1f')](_0x5247fd[_0xea4c('0x20')]);if(_0x5247fd['name']){delete _0x5247fd[_0xea4c('0x21')];}_0x10a676[_0xea4c('0x19')](_0x40f316)['send'](_0x5247fd);};}exports[_0xea4c('0x22')]=function(_0xbc7871,_0xaed282){var _0x2fac90={},_0x5b83e1={},_0x558d9a={'count':0x0,'rows':[]};var _0x144fef=_[_0xea4c('0x23')](db['FaxTransferReport'][_0xea4c('0x24')],function(_0x33bca3){return{'name':_0x33bca3[_0xea4c('0x25')],'type':_0x33bca3[_0xea4c('0x26')][_0xea4c('0x27')]};});_0x5b83e1[_0xea4c('0x28')]=_['map'](_0x144fef,_0xea4c('0x21'));_0x5b83e1[_0xea4c('0x29')]=_['keys'](_0xbc7871[_0xea4c('0x29')]);_0x5b83e1[_0xea4c('0x2a')]=_[_0xea4c('0x2b')](_0x5b83e1[_0xea4c('0x28')],_0x5b83e1['query']);_0x2fac90[_0xea4c('0x2c')]=_['intersection'](_0x5b83e1['model'],qs['fields'](_0xbc7871[_0xea4c('0x29')][_0xea4c('0x2d')]));_0x2fac90['attributes']=_0x2fac90[_0xea4c('0x2c')][_0xea4c('0x2e')]?_0x2fac90[_0xea4c('0x2c')]:_0x5b83e1['model'];if(!_0xbc7871[_0xea4c('0x29')]['hasOwnProperty']('nolimit')){_0x2fac90[_0xea4c('0x17')]=qs[_0xea4c('0x17')](_0xbc7871[_0xea4c('0x29')][_0xea4c('0x17')]);_0x2fac90[_0xea4c('0x15')]=qs['offset'](_0xbc7871['query'][_0xea4c('0x15')]);}_0x2fac90[_0xea4c('0x2f')]=qs['sort'](_0xbc7871['query']['sort']);_0x2fac90[_0xea4c('0x30')]=qs[_0xea4c('0x2a')](_[_0xea4c('0x31')](_0xbc7871[_0xea4c('0x29')],_0x5b83e1[_0xea4c('0x2a')]),_0x144fef);if(_0xbc7871['query']['filter']){_0x2fac90[_0xea4c('0x30')]=_['merge'](_0x2fac90[_0xea4c('0x30')],{'$or':_['map'](_0x144fef,function(_0x13525d){if(_0x13525d[_0xea4c('0x26')]!=='VIRTUAL'){var _0x15b2d4={};_0x15b2d4[_0x13525d['name']]={'$like':'%'+_0xbc7871[_0xea4c('0x29')][_0xea4c('0x32')]+'%'};return _0x15b2d4;}})});}_0x2fac90=_[_0xea4c('0x33')]({},_0x2fac90,_0xbc7871[_0xea4c('0x34')]);var _0x1b698d={'where':_0x2fac90[_0xea4c('0x30')]};return db[_0xea4c('0x35')][_0xea4c('0x18')](_0x1b698d)[_0xea4c('0x1e')](function(_0x20d61a){_0x558d9a['count']=_0x20d61a;if(_0xbc7871[_0xea4c('0x29')][_0xea4c('0x36')]){_0x2fac90['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xea4c('0x37')](_0x2fac90);})[_0xea4c('0x1e')](function(_0x2897f3){_0x558d9a[_0xea4c('0x38')]=_0x2897f3;return _0x558d9a;})[_0xea4c('0x1e')](respondWithFilteredResult(_0xaed282,_0x2fac90))['catch'](handleError(_0xaed282,null));};exports['show']=function(_0x17f20e,_0x463e9c){var _0x4923f5={'raw':!![],'where':{'id':_0x17f20e[_0xea4c('0x39')]['id']}},_0x3adb0e={};_0x3adb0e[_0xea4c('0x28')]=_['keys'](db[_0xea4c('0x35')][_0xea4c('0x24')]);_0x3adb0e['query']=_[_0xea4c('0x3a')](_0x17f20e[_0xea4c('0x29')]);_0x3adb0e[_0xea4c('0x2a')]=_[_0xea4c('0x2b')](_0x3adb0e['model'],_0x3adb0e['query']);_0x4923f5['attributes']=_[_0xea4c('0x2b')](_0x3adb0e[_0xea4c('0x28')],qs[_0xea4c('0x2d')](_0x17f20e[_0xea4c('0x29')][_0xea4c('0x2d')]));_0x4923f5[_0xea4c('0x2c')]=_0x4923f5['attributes'][_0xea4c('0x2e')]?_0x4923f5[_0xea4c('0x2c')]:_0x3adb0e[_0xea4c('0x28')];if(_0x17f20e[_0xea4c('0x29')][_0xea4c('0x36')]){_0x4923f5[_0xea4c('0x3b')]=[{'all':!![]}];}_0x4923f5=_[_0xea4c('0x33')]({},_0x4923f5,_0x17f20e[_0xea4c('0x34')]);return db[_0xea4c('0x35')][_0xea4c('0x3c')](_0x4923f5)['then'](handleEntityNotFound(_0x463e9c,null))[_0xea4c('0x1e')](respondWithResult(_0x463e9c,null))['catch'](handleError(_0x463e9c,null));};exports[_0xea4c('0x3d')]=function(_0x5a59c2,_0x35f5a9){return db['FaxTransferReport']['create'](_0x5a59c2[_0xea4c('0x3e')],{})[_0xea4c('0x1e')](respondWithResult(_0x35f5a9,0xc9))[_0xea4c('0x3f')](handleError(_0x35f5a9,null));};exports[_0xea4c('0x1d')]=function(_0x130a77,_0x78baab){if(_0x130a77[_0xea4c('0x3e')]['id']){delete _0x130a77[_0xea4c('0x3e')]['id'];}return db[_0xea4c('0x35')][_0xea4c('0x3c')]({'where':{'id':_0x130a77[_0xea4c('0x39')]['id']}})['then'](handleEntityNotFound(_0x78baab,null))[_0xea4c('0x1e')](saveUpdates(_0x130a77[_0xea4c('0x3e')],null))[_0xea4c('0x1e')](respondWithResult(_0x78baab,null))['catch'](handleError(_0x78baab,null));};exports[_0xea4c('0x40')]=function(_0x1f6a5a,_0x118d47){return db['FaxTransferReport'][_0xea4c('0x3c')]({'where':{'id':_0x1f6a5a[_0xea4c('0x39')]['id']}})[_0xea4c('0x1e')](handleEntityNotFound(_0x118d47,null))['then'](removeEntity(_0x118d47,null))[_0xea4c('0x3f')](handleError(_0x118d47,null));};exports[_0xea4c('0x41')]=function(_0x8e29f1,_0x47e308){return db[_0xea4c('0x35')][_0xea4c('0x41')]()[_0xea4c('0x1e')](respondWithResult(_0x47e308,null))['catch'](handleError(_0x47e308,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1cb7821..31b938c 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 _0xd547=['moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3fe2b1,_0x967d3b){var _0xeff4db=function(_0x23f480){while(--_0x23f480){_0x3fe2b1['push'](_0x3fe2b1['shift']());}};_0xeff4db(++_0x967d3b);}(_0xd547,0x1a9));var _0x7d54=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd547[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var logger=require(_0x7d54('0x2'))(_0x7d54('0x3'));var moment=require(_0x7d54('0x4'));var BPromise=require(_0x7d54('0x5'));var rp=require(_0x7d54('0x6'));var fs=require('fs');var path=require(_0x7d54('0x7'));var rimraf=require(_0x7d54('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x9'));module[_0x7d54('0xa')]=function(_0x28d24a,_0x128523){return _0x28d24a['define'](_0x7d54('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7d54('0xc'),'fields':[_0x7d54('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2671=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2671,0xfc));var _0x1267=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0x2671[_0x5c7e53];return _0x1c9af9;};'use strict';var _=require(_0x1267('0x0'));var util=require(_0x1267('0x1'));var logger=require(_0x1267('0x2'))(_0x1267('0x3'));var moment=require(_0x1267('0x4'));var BPromise=require(_0x1267('0x5'));var rp=require(_0x1267('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1267('0x7'));var config=require(_0x1267('0x8'));var attributes=require(_0x1267('0x9'));module[_0x1267('0xa')]=function(_0x1b05dd,_0x46a80a){return _0x1b05dd['define'](_0x1267('0xb'),attributes,{'tableName':_0x1267('0xc'),'paranoid':![],'indexes':[{'name':_0x1267('0xd'),'fields':[_0x1267('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6c1fe1f..0e6f77f 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 _0x0bd6=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4cf59a,_0x3d3fb0){var _0x513f00=function(_0x4c4ef9){while(--_0x4c4ef9){_0x4cf59a['push'](_0x4cf59a['shift']());}};_0x513f00(++_0x3d3fb0);}(_0x0bd6,0xcd));var _0x60bd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0bd6[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x60bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60bd('0x1'));var rs=require(_0x60bd('0x2'));var fs=require('fs');var Redis=require(_0x60bd('0x3'));var db=require(_0x60bd('0x4'))['db'];var utils=require(_0x60bd('0x5'));var logger=require(_0x60bd('0x6'))(_0x60bd('0x7'));var config=require(_0x60bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x60bd('0x9')][_0x60bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x989cf0,_0x42473c,_0x3752b4){return new BPromise(function(_0x55a568,_0x5e281e){return client['request'](_0x989cf0,_0x3752b4)[_0x60bd('0xb')](function(_0x2e78c2){logger['info'](_0x60bd('0xc'),_0x42473c,_0x60bd('0xd'));logger[_0x60bd('0xe')](_0x60bd('0xf'),_0x42473c,'request\x20sent',JSON[_0x60bd('0x10')](_0x2e78c2));if(_0x2e78c2[_0x60bd('0x11')]){if(_0x2e78c2[_0x60bd('0x11')][_0x60bd('0x12')]===0x1f4){logger[_0x60bd('0x11')](_0x60bd('0xc'),_0x42473c,_0x2e78c2['error'][_0x60bd('0x13')]);return _0x5e281e(_0x2e78c2[_0x60bd('0x11')][_0x60bd('0x13')]);}logger[_0x60bd('0x11')](_0x60bd('0xc'),_0x42473c,_0x2e78c2[_0x60bd('0x11')][_0x60bd('0x13')]);return _0x55a568(_0x2e78c2[_0x60bd('0x11')][_0x60bd('0x13')]);}else{logger[_0x60bd('0x14')](_0x60bd('0xc'),_0x42473c,_0x60bd('0xd'));_0x55a568(_0x2e78c2['result'][_0x60bd('0x13')]);}})[_0x60bd('0x15')](function(_0xe6d744){logger[_0x60bd('0x11')](_0x60bd('0xc'),_0x42473c,_0xe6d744);_0x5e281e(_0xe6d744);});});} \ No newline at end of file +var _0xd71c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd71c,0x13a));var _0xcd71=function(_0x41ba35,_0x2dfbe8){_0x41ba35=_0x41ba35-0x0;var _0x4e10a0=_0xd71c[_0x41ba35];return _0x4e10a0;};'use strict';var _=require('lodash');var util=require(_0xcd71('0x0'));var moment=require('moment');var BPromise=require(_0xcd71('0x1'));var rs=require(_0xcd71('0x2'));var fs=require('fs');var Redis=require(_0xcd71('0x3'));var db=require(_0xcd71('0x4'))['db'];var utils=require(_0xcd71('0x5'));var logger=require('../../config/logger')(_0xcd71('0x6'));var config=require(_0xcd71('0x7'));var jayson=require(_0xcd71('0x8'));var client=jayson[_0xcd71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c618c,_0x1cec71,_0x53954c){return new BPromise(function(_0x1b1fcb,_0x54e953){return client[_0xcd71('0xa')](_0x3c618c,_0x53954c)[_0xcd71('0xb')](function(_0x2aae48){logger['info'](_0xcd71('0xc'),_0x1cec71,_0xcd71('0xd'));logger[_0xcd71('0xe')](_0xcd71('0xf'),_0x1cec71,_0xcd71('0xd'),JSON[_0xcd71('0x10')](_0x2aae48));if(_0x2aae48[_0xcd71('0x11')]){if(_0x2aae48[_0xcd71('0x11')][_0xcd71('0x12')]===0x1f4){logger[_0xcd71('0x11')](_0xcd71('0xc'),_0x1cec71,_0x2aae48[_0xcd71('0x11')][_0xcd71('0x13')]);return _0x54e953(_0x2aae48[_0xcd71('0x11')][_0xcd71('0x13')]);}logger[_0xcd71('0x11')](_0xcd71('0xc'),_0x1cec71,_0x2aae48[_0xcd71('0x11')][_0xcd71('0x13')]);return _0x1b1fcb(_0x2aae48['error']['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x1cec71,'request\x20sent');_0x1b1fcb(_0x2aae48[_0xcd71('0x14')][_0xcd71('0x13')]);}})['catch'](function(_0x52cb18){logger[_0xcd71('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1cec71,_0x52cb18);_0x54e953(_0x52cb18);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4b7fa92..1c85dee 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 _0x5e32=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','util','path','connect-timeout'];(function(_0x326eb4,_0x19a7f3){var _0x756fec=function(_0xeb6fac){while(--_0xeb6fac){_0x326eb4['push'](_0x326eb4['shift']());}};_0x756fec(++_0x19a7f3);}(_0x5e32,0x173));var _0x25e3=function(_0x26de78,_0x1c8d08){_0x26de78=_0x26de78-0x0;var _0x1b6fee=_0x5e32[_0x26de78];return _0x1b6fee;};'use strict';var multer=require('multer');var util=require(_0x25e3('0x0'));var path=require(_0x25e3('0x1'));var timeout=require(_0x25e3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x25e3('0x3'));var config=require(_0x25e3('0x4'));var controller=require(_0x25e3('0x5'));router[_0x25e3('0x6')]('/',auth[_0x25e3('0x7')](),controller[_0x25e3('0x8')]);router[_0x25e3('0x6')](_0x25e3('0x9'),auth[_0x25e3('0x7')](),controller[_0x25e3('0xa')]);router[_0x25e3('0x6')](_0x25e3('0xb'),auth[_0x25e3('0x7')](),controller['show']);router[_0x25e3('0xc')]('/',auth[_0x25e3('0x7')](),controller[_0x25e3('0xd')]);router[_0x25e3('0xe')](_0x25e3('0xb'),auth[_0x25e3('0x7')](),controller[_0x25e3('0xf')]);router['delete'](_0x25e3('0xb'),auth[_0x25e3('0x7')](),controller['destroy']);module[_0x25e3('0x10')]=router; \ No newline at end of file +var _0xbd97=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xbd97,0x164));var _0x7bd9=function(_0x2220e1,_0x5c5537){_0x2220e1=_0x2220e1-0x0;var _0x10314c=_0xbd97[_0x2220e1];return _0x10314c;};'use strict';var multer=require('multer');var util=require(_0x7bd9('0x0'));var path=require(_0x7bd9('0x1'));var timeout=require(_0x7bd9('0x2'));var express=require(_0x7bd9('0x3'));var router=express[_0x7bd9('0x4')]();var fs_extra=require(_0x7bd9('0x5'));var auth=require(_0x7bd9('0x6'));var interaction=require(_0x7bd9('0x7'));var config=require(_0x7bd9('0x8'));var controller=require(_0x7bd9('0x9'));router['get']('/',auth[_0x7bd9('0xa')](),controller['index']);router[_0x7bd9('0xb')]('/describe',auth[_0x7bd9('0xa')](),controller['describe']);router[_0x7bd9('0xb')](_0x7bd9('0xc'),auth[_0x7bd9('0xa')](),controller[_0x7bd9('0xd')]);router[_0x7bd9('0xe')]('/',auth['isAuthenticated'](),controller[_0x7bd9('0xf')]);router[_0x7bd9('0x10')]('/:id',auth[_0x7bd9('0xa')](),controller[_0x7bd9('0x11')]);router['delete'](_0x7bd9('0xc'),auth[_0x7bd9('0xa')](),controller[_0x7bd9('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 8ed2251..975e7c7 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 _0x5b07=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','get','/:id/configurations','getConfigurations','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x5b07,0x121));var _0x75b0=function(_0x5d1ade,_0x260055){_0x5d1ade=_0x5d1ade-0x0;var _0x219d29=_0x5b07[_0x5d1ade];return _0x219d29;};'use strict';var multer=require(_0x75b0('0x0'));var util=require(_0x75b0('0x1'));var path=require(_0x75b0('0x2'));var timeout=require(_0x75b0('0x3'));var express=require('express');var router=express[_0x75b0('0x4')]();var fs_extra=require(_0x75b0('0x5'));var auth=require(_0x75b0('0x6'));var interaction=require(_0x75b0('0x7'));var config=require(_0x75b0('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x75b0('0x9')]);router['get']('/:id',auth[_0x75b0('0xa')](),controller[_0x75b0('0xb')]);router[_0x75b0('0xc')](_0x75b0('0xd'),auth[_0x75b0('0xa')](),controller[_0x75b0('0xe')]);router[_0x75b0('0xc')]('/:id/fields',auth[_0x75b0('0xa')](),controller['getFields']);router[_0x75b0('0xf')]('/',auth['isAuthenticated'](),controller[_0x75b0('0x10')]);router[_0x75b0('0xf')](_0x75b0('0xd'),auth[_0x75b0('0xa')](),controller['addConfiguration']);router[_0x75b0('0x11')](_0x75b0('0x12'),auth[_0x75b0('0xa')](),controller[_0x75b0('0x13')]);router[_0x75b0('0x14')](_0x75b0('0x12'),auth[_0x75b0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf6e1=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','create','/:id/configurations','addConfiguration','put'];(function(_0x41a6b1,_0x33302b){var _0x26a187=function(_0x4fa33f){while(--_0x4fa33f){_0x41a6b1['push'](_0x41a6b1['shift']());}};_0x26a187(++_0x33302b);}(_0xf6e1,0x183));var _0x1f6e=function(_0x8a7891,_0x3d62da){_0x8a7891=_0x8a7891-0x0;var _0x3af84b=_0xf6e1[_0x8a7891];return _0x3af84b;};'use strict';var multer=require(_0x1f6e('0x0'));var util=require(_0x1f6e('0x1'));var path=require(_0x1f6e('0x2'));var timeout=require(_0x1f6e('0x3'));var express=require(_0x1f6e('0x4'));var router=express[_0x1f6e('0x5')]();var fs_extra=require(_0x1f6e('0x6'));var auth=require(_0x1f6e('0x7'));var interaction=require(_0x1f6e('0x8'));var config=require(_0x1f6e('0x9'));var controller=require('./intDeskAccount.controller');router[_0x1f6e('0xa')]('/',auth[_0x1f6e('0xb')](),controller[_0x1f6e('0xc')]);router[_0x1f6e('0xa')](_0x1f6e('0xd'),auth[_0x1f6e('0xb')](),controller[_0x1f6e('0xe')]);router['get']('/:id/configurations',auth[_0x1f6e('0xb')](),controller[_0x1f6e('0xf')]);router[_0x1f6e('0xa')]('/:id/fields',auth[_0x1f6e('0xb')](),controller[_0x1f6e('0x10')]);router['post']('/',auth[_0x1f6e('0xb')](),controller[_0x1f6e('0x11')]);router['post'](_0x1f6e('0x12'),auth[_0x1f6e('0xb')](),controller[_0x1f6e('0x13')]);router[_0x1f6e('0x14')]('/:id',auth[_0x1f6e('0xb')](),controller[_0x1f6e('0x15')]);router[_0x1f6e('0x16')](_0x1f6e('0xd'),auth[_0x1f6e('0xb')](),controller[_0x1f6e('0x17')]);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 47b35f1..7f62241 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 _0x58c8=['ENUM','integrationTab','exports','STRING'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x58c8,0x1b6));var _0x858c=function(_0x4998f7,_0x4c0a5f){_0x4998f7=_0x4998f7-0x0;var _0xdd9537=_0x58c8[_0x4998f7];return _0xdd9537;};'use strict';var Sequelize=require('sequelize');module[_0x858c('0x0')]={'name':{'type':Sequelize[_0x858c('0x1')]},'description':{'type':Sequelize[_0x858c('0x1')]},'username':{'type':Sequelize[_0x858c('0x1')]},'remoteUri':{'type':Sequelize[_0x858c('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x858c('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x858c('0x1')]},'token':{'type':Sequelize[_0x858c('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x858c('0x2')]('integrationTab','newTab'),'defaultValue':_0x858c('0x3')}}; \ No newline at end of file +var _0xc34d=['exports','STRING','ENUM','basic','newTab','integrationTab','sequelize'];(function(_0x1a7567,_0x58e148){var _0xc9b41d=function(_0x17da59){while(--_0x17da59){_0x1a7567['push'](_0x1a7567['shift']());}};_0xc9b41d(++_0x58e148);}(_0xc34d,0xd8));var _0xdc34=function(_0x1b3a86,_0x4096a2){_0x1b3a86=_0x1b3a86-0x0;var _0x488108=_0xc34d[_0x1b3a86];return _0x488108;};'use strict';var Sequelize=require(_0xdc34('0x0'));module[_0xdc34('0x1')]={'name':{'type':Sequelize[_0xdc34('0x2')]},'description':{'type':Sequelize[_0xdc34('0x2')]},'username':{'type':Sequelize[_0xdc34('0x2')]},'remoteUri':{'type':Sequelize[_0xdc34('0x2')]},'authType':{'type':Sequelize[_0xdc34('0x3')](_0xdc34('0x4')),'defaultValue':_0xdc34('0x4')},'password':{'type':Sequelize[_0xdc34('0x2')]},'consumerKey':{'type':Sequelize[_0xdc34('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xdc34('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdc34('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdc34('0x3')]('integrationTab',_0xdc34('0x5')),'defaultValue':_0xdc34('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8ce2064..1f19e95 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 _0xc4d1=['stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','base64','concat','active','label','test','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x11ac13,_0x4e3d72){var _0x4f37df=function(_0x15f708){while(--_0x15f708){_0x11ac13['push'](_0x11ac13['shift']());}};_0x4f37df(++_0x4e3d72);}(_0xc4d1,0x1ce));var _0x1c4d=function(_0x175a46,_0x467177){_0x175a46=_0x175a46-0x0;var _0x4050a7=_0xc4d1[_0x175a46];return _0x4050a7;};'use strict';var emlformat=require(_0x1c4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c4d('0x1'));var jsonpatch=require(_0x1c4d('0x2'));var rp=require(_0x1c4d('0x3'));var moment=require(_0x1c4d('0x4'));var BPromise=require(_0x1c4d('0x5'));var Mustache=require(_0x1c4d('0x6'));var util=require(_0x1c4d('0x7'));var path=require(_0x1c4d('0x8'));var sox=require(_0x1c4d('0x9'));var csv=require('to-csv');var ejs=require(_0x1c4d('0xa'));var fs=require('fs');var fs_extra=require(_0x1c4d('0xb'));var _=require(_0x1c4d('0xc'));var squel=require(_0x1c4d('0xd'));var crypto=require(_0x1c4d('0xe'));var jsforce=require(_0x1c4d('0xf'));var deskjs=require(_0x1c4d('0x10'));var toCsv=require(_0x1c4d('0x11'));var querystring=require(_0x1c4d('0x12'));var Papa=require('papaparse');var Redis=require(_0x1c4d('0x13'));var authService=require(_0x1c4d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1c4d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c4d('0x16'))(_0x1c4d('0x17'));var utils=require(_0x1c4d('0x18'));var config=require(_0x1c4d('0x19'));var licenseUtil=require(_0x1c4d('0x1a'));var db=require(_0x1c4d('0x1b'))['db'];var integrations=require(_0x1c4d('0x1c'));function respondWithStatusCode(_0x261864,_0x58660d){_0x58660d=_0x58660d||0xcc;return function(_0x814aa4){if(_0x814aa4){return _0x261864[_0x1c4d('0x1d')](_0x58660d);}return _0x261864[_0x1c4d('0x1e')](_0x58660d)[_0x1c4d('0x1f')]();};}function respondWithResult(_0x2a901e,_0x3fea0e){_0x3fea0e=_0x3fea0e||0xc8;return function(_0x3316d6){if(_0x3316d6){return _0x2a901e[_0x1c4d('0x1e')](_0x3fea0e)[_0x1c4d('0x20')](_0x3316d6);}};}function respondWithFilteredResult(_0x308a0d,_0x75eedb){return function(_0x2adbbe){if(_0x2adbbe){var _0x15e3c4=typeof _0x75eedb[_0x1c4d('0x21')]==='undefined'&&typeof _0x75eedb[_0x1c4d('0x22')]===_0x1c4d('0x23');var _0x14cc6c=_0x2adbbe[_0x1c4d('0x24')];var _0x3533b7=_0x15e3c4?0x0:_0x75eedb[_0x1c4d('0x21')];var _0x54e6c3=_0x15e3c4?_0x2adbbe[_0x1c4d('0x24')]:_0x75eedb[_0x1c4d('0x21')]+_0x75eedb[_0x1c4d('0x22')];var _0x3e9d8c;if(_0x54e6c3>=_0x14cc6c){_0x54e6c3=_0x14cc6c;_0x3e9d8c=0xc8;}else{_0x3e9d8c=0xce;}_0x308a0d[_0x1c4d('0x1e')](_0x3e9d8c);return _0x308a0d[_0x1c4d('0x25')](_0x1c4d('0x26'),_0x3533b7+'-'+_0x54e6c3+'/'+_0x14cc6c)['json'](_0x2adbbe);}return null;};}function patchUpdates(_0x5362b9){return function(_0x3ccd4a){try{jsonpatch[_0x1c4d('0x27')](_0x3ccd4a,_0x5362b9,!![]);}catch(_0x47f141){return BPromise['reject'](_0x47f141);}return _0x3ccd4a[_0x1c4d('0x28')]();};}function saveUpdates(_0x241c7,_0x9ee03f){return function(_0x142978){if(_0x142978){return _0x142978[_0x1c4d('0x29')](_0x241c7)['then'](function(_0x4e3ba5){return _0x4e3ba5;});}return null;};}function removeEntity(_0x48c476,_0x4b02c7){return function(_0x3ecf6d){if(_0x3ecf6d){return _0x3ecf6d[_0x1c4d('0x2a')]()['then'](function(){_0x48c476[_0x1c4d('0x1e')](0xcc)[_0x1c4d('0x1f')]();});}};}function handleEntityNotFound(_0x4ec51e,_0x3095a8){return function(_0x510d08){if(!_0x510d08){_0x4ec51e[_0x1c4d('0x1d')](0x194);}return _0x510d08;};}function handleError(_0xa27275,_0x36db5e){_0x36db5e=_0x36db5e||0x1f4;return function(_0x353bbc){logger[_0x1c4d('0x2b')](_0x353bbc[_0x1c4d('0x2c')]);if(_0x353bbc[_0x1c4d('0x2d')]){delete _0x353bbc[_0x1c4d('0x2d')];}_0xa27275[_0x1c4d('0x1e')](_0x36db5e)[_0x1c4d('0x2e')](_0x353bbc);};}exports[_0x1c4d('0x2f')]=function(_0x4469a3,_0x44b993){var _0x526ab2={},_0x503265={},_0x4f820c={'count':0x0,'rows':[]};var _0x38c3d4=_[_0x1c4d('0x30')](db[_0x1c4d('0x31')][_0x1c4d('0x32')],function(_0x3e0efb){return{'name':_0x3e0efb[_0x1c4d('0x33')],'type':_0x3e0efb[_0x1c4d('0x34')][_0x1c4d('0x35')]};});_0x503265[_0x1c4d('0x36')]=_[_0x1c4d('0x30')](_0x38c3d4,_0x1c4d('0x2d'));_0x503265[_0x1c4d('0x37')]=_[_0x1c4d('0x38')](_0x4469a3[_0x1c4d('0x37')]);_0x503265[_0x1c4d('0x39')]=_[_0x1c4d('0x3a')](_0x503265['model'],_0x503265['query']);_0x526ab2[_0x1c4d('0x3b')]=_[_0x1c4d('0x3a')](_0x503265[_0x1c4d('0x36')],qs[_0x1c4d('0x3c')](_0x4469a3[_0x1c4d('0x37')]['fields']));_0x526ab2['attributes']=_0x526ab2[_0x1c4d('0x3b')][_0x1c4d('0x3d')]?_0x526ab2[_0x1c4d('0x3b')]:_0x503265['model'];if(!_0x4469a3['query']['hasOwnProperty'](_0x1c4d('0x3e'))){_0x526ab2[_0x1c4d('0x22')]=qs[_0x1c4d('0x22')](_0x4469a3[_0x1c4d('0x37')][_0x1c4d('0x22')]);_0x526ab2[_0x1c4d('0x21')]=qs[_0x1c4d('0x21')](_0x4469a3[_0x1c4d('0x37')][_0x1c4d('0x21')]);}_0x526ab2[_0x1c4d('0x3f')]=qs[_0x1c4d('0x40')](_0x4469a3['query'][_0x1c4d('0x40')]);_0x526ab2[_0x1c4d('0x41')]=qs[_0x1c4d('0x39')](_['pick'](_0x4469a3[_0x1c4d('0x37')],_0x503265['filters']),_0x38c3d4);if(_0x4469a3['query'][_0x1c4d('0x42')]){_0x526ab2[_0x1c4d('0x41')]=_[_0x1c4d('0x43')](_0x526ab2[_0x1c4d('0x41')],{'$or':_[_0x1c4d('0x30')](_0x38c3d4,function(_0x28d5e6){if(_0x28d5e6[_0x1c4d('0x34')]!=='VIRTUAL'){var _0x177299={};_0x177299[_0x28d5e6['name']]={'$like':'%'+_0x4469a3['query'][_0x1c4d('0x42')]+'%'};return _0x177299;}})});}_0x526ab2=_[_0x1c4d('0x43')]({},_0x526ab2,_0x4469a3[_0x1c4d('0x44')]);var _0x2b2e7a={'where':_0x526ab2['where']};return db[_0x1c4d('0x31')][_0x1c4d('0x24')](_0x2b2e7a)[_0x1c4d('0x45')](function(_0x2232bd){_0x4f820c[_0x1c4d('0x24')]=_0x2232bd;if(_0x4469a3[_0x1c4d('0x37')][_0x1c4d('0x46')]){_0x526ab2[_0x1c4d('0x47')]=[{'all':!![]}];}return db['DeskAccount'][_0x1c4d('0x48')](_0x526ab2);})[_0x1c4d('0x45')](function(_0x193ef7){_0x4f820c[_0x1c4d('0x49')]=_0x193ef7;return _0x4f820c;})[_0x1c4d('0x45')](respondWithFilteredResult(_0x44b993,_0x526ab2))[_0x1c4d('0x4a')](handleError(_0x44b993,null));};exports[_0x1c4d('0x4b')]=function(_0x24706c,_0x626288){var _0x236ad7={'raw':![],'where':{'id':_0x24706c[_0x1c4d('0x4c')]['id']}},_0x3483a5={};_0x3483a5[_0x1c4d('0x36')]=_['keys'](db[_0x1c4d('0x31')][_0x1c4d('0x32')]);_0x3483a5[_0x1c4d('0x37')]=_[_0x1c4d('0x38')](_0x24706c[_0x1c4d('0x37')]);_0x3483a5[_0x1c4d('0x39')]=_[_0x1c4d('0x3a')](_0x3483a5[_0x1c4d('0x36')],_0x3483a5[_0x1c4d('0x37')]);_0x236ad7[_0x1c4d('0x3b')]=_['intersection'](_0x3483a5['model'],qs['fields'](_0x24706c[_0x1c4d('0x37')][_0x1c4d('0x3c')]));_0x236ad7['attributes']=_0x236ad7[_0x1c4d('0x3b')][_0x1c4d('0x3d')]?_0x236ad7[_0x1c4d('0x3b')]:_0x3483a5[_0x1c4d('0x36')];if(_0x24706c['query'][_0x1c4d('0x46')]){_0x236ad7['include']=[{'all':!![]}];}_0x236ad7=_[_0x1c4d('0x43')]({},_0x236ad7,_0x24706c[_0x1c4d('0x44')]);return db[_0x1c4d('0x31')]['find'](_0x236ad7)[_0x1c4d('0x45')](handleEntityNotFound(_0x626288,null))[_0x1c4d('0x45')](respondWithResult(_0x626288,null))[_0x1c4d('0x4a')](handleError(_0x626288,null));};exports['create']=function(_0x23232c,_0x15d091){return db[_0x1c4d('0x31')][_0x1c4d('0x4d')](_0x23232c[_0x1c4d('0x4e')],{})[_0x1c4d('0x45')](respondWithResult(_0x15d091,0xc9))[_0x1c4d('0x4a')](handleError(_0x15d091,null));};exports[_0x1c4d('0x29')]=function(_0x238ade,_0x12d29a){if(_0x238ade['body']['id']){delete _0x238ade['body']['id'];}return db['DeskAccount'][_0x1c4d('0x4f')]({'where':{'id':_0x238ade[_0x1c4d('0x4c')]['id']}})[_0x1c4d('0x45')](handleEntityNotFound(_0x12d29a,null))[_0x1c4d('0x45')](saveUpdates(_0x238ade[_0x1c4d('0x4e')],null))['then'](respondWithResult(_0x12d29a,null))[_0x1c4d('0x4a')](handleError(_0x12d29a,null));};exports['destroy']=function(_0x8c4b09,_0x206065){return db[_0x1c4d('0x31')][_0x1c4d('0x4f')]({'where':{'id':_0x8c4b09[_0x1c4d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x206065,null))[_0x1c4d('0x45')](removeEntity(_0x206065,null))[_0x1c4d('0x4a')](handleError(_0x206065,null));};exports[_0x1c4d('0x50')]=function(_0x4b797d,_0x5dd686,_0x49932d){var _0x181f36={};var _0x1c7013={};var _0x356ccb;var _0x2c4124;return db[_0x1c4d('0x31')][_0x1c4d('0x51')]({'where':{'id':_0x4b797d[_0x1c4d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5dd686,null))[_0x1c4d('0x45')](function(_0x14436a){if(_0x14436a){_0x356ccb=_0x14436a;_0x1c7013[_0x1c4d('0x36')]=_[_0x1c4d('0x38')](db['DeskConfiguration'][_0x1c4d('0x32')]);_0x1c7013[_0x1c4d('0x37')]=_['keys'](_0x4b797d[_0x1c4d('0x37')]);_0x1c7013[_0x1c4d('0x39')]=_[_0x1c4d('0x3a')](_0x1c7013[_0x1c4d('0x36')],_0x1c7013[_0x1c4d('0x37')]);_0x181f36[_0x1c4d('0x3b')]=_[_0x1c4d('0x3a')](_0x1c7013[_0x1c4d('0x36')],qs[_0x1c4d('0x3c')](_0x4b797d['query'][_0x1c4d('0x3c')]));_0x181f36[_0x1c4d('0x3b')]=_0x181f36[_0x1c4d('0x3b')][_0x1c4d('0x3d')]?_0x181f36[_0x1c4d('0x3b')]:_0x1c7013['model'];_0x181f36[_0x1c4d('0x3f')]=qs['sort'](_0x4b797d['query'][_0x1c4d('0x40')]);_0x181f36[_0x1c4d('0x41')]=qs[_0x1c4d('0x39')](_['pick'](_0x4b797d['query'],_0x1c7013[_0x1c4d('0x39')]));if(_0x4b797d['query'][_0x1c4d('0x42')]){_0x181f36['where']=_[_0x1c4d('0x43')](_0x181f36[_0x1c4d('0x41')],{'$or':_[_0x1c4d('0x30')](_0x181f36['attributes'],function(_0x40e3e4){var _0x2d170b={};_0x2d170b[_0x40e3e4]={'$like':'%'+_0x4b797d[_0x1c4d('0x37')][_0x1c4d('0x42')]+'%'};return _0x2d170b;})});}_0x181f36=_['merge']({},_0x181f36,_0x4b797d[_0x1c4d('0x44')]);return _0x356ccb['getConfigurations'](_0x181f36);}})[_0x1c4d('0x45')](function(_0x451706){if(_0x451706){_0x2c4124=_0x451706[_0x1c4d('0x3d')];if(!_0x4b797d['query'][_0x1c4d('0x52')](_0x1c4d('0x3e'))){_0x181f36[_0x1c4d('0x22')]=qs[_0x1c4d('0x22')](_0x4b797d[_0x1c4d('0x37')][_0x1c4d('0x22')]);_0x181f36[_0x1c4d('0x21')]=qs[_0x1c4d('0x21')](_0x4b797d[_0x1c4d('0x37')]['offset']);}return _0x356ccb[_0x1c4d('0x50')](_0x181f36);}})[_0x1c4d('0x45')](function(_0x1eeb45){if(_0x1eeb45){return _0x1eeb45?{'count':_0x2c4124,'rows':_0x1eeb45}:null;}})[_0x1c4d('0x45')](respondWithResult(_0x5dd686,null))[_0x1c4d('0x4a')](handleError(_0x5dd686,null));};exports['addConfiguration']=function(_0x515ba1,_0x2f3e88,_0x279ac7){if(_0x515ba1[_0x1c4d('0x4e')]['id']){delete _0x515ba1['body']['id'];}return db[_0x1c4d('0x31')][_0x1c4d('0x51')]({'where':{'id':_0x515ba1[_0x1c4d('0x4c')]['id']}})[_0x1c4d('0x45')](handleEntityNotFound(_0x2f3e88,null))[_0x1c4d('0x45')](function(_0x2a08b4){if(_0x2a08b4){_0x515ba1['body'][_0x1c4d('0x53')]=_0x2a08b4['id'];_0x515ba1[_0x1c4d('0x4e')]['Subjects']=integrations[_0x1c4d('0x54')](_0x515ba1[_0x1c4d('0x4e')][_0x1c4d('0x55')],_0x515ba1[_0x1c4d('0x4e')]['type']);_0x515ba1[_0x1c4d('0x4e')][_0x1c4d('0x56')]=integrations['getDescriptions'](_0x515ba1[_0x1c4d('0x4e')][_0x1c4d('0x55')],_0x515ba1['body']['type']);return db['DeskConfiguration'][_0x1c4d('0x4d')](_0x515ba1[_0x1c4d('0x4e')],{'include':[{'model':db[_0x1c4d('0x57')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x1c4d('0x56')}]});}return null;})[_0x1c4d('0x45')](respondWithResult(_0x2f3e88,null))[_0x1c4d('0x4a')](handleError(_0x2f3e88,null));};exports[_0x1c4d('0x58')]=function(_0x596f36,_0x135661,_0x35c289){var _0x35c6b1=[{'name':_0x1c4d('0x59'),'label':_0x1c4d('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1bbe34='';return db['DeskAccount'][_0x1c4d('0x51')]({'where':{'id':_0x596f36[_0x1c4d('0x4c')]['id']},'attributes':['id',_0x1c4d('0x5a'),_0x1c4d('0x5b'),_0x1c4d('0x5c'),_0x1c4d('0x5d'),_0x1c4d('0x5e'),'consumerSecret',_0x1c4d('0x5f'),_0x1c4d('0x60')]})[_0x1c4d('0x45')](handleEntityNotFound(_0x135661,null))['then'](function(_0x3f066c){if(_0x3f066c){_0x1bbe34=_0x3f066c['remoteUri'];var _0x4cae61=_0x1bbe34[_0x1c4d('0x61')](-0x1);if(_0x4cae61==='/'){_0x1bbe34=_0x1bbe34[_0x1c4d('0x62')](0x0,_0x1bbe34[_0x1c4d('0x63')](_0x4cae61));}var _0x43b58b={'method':'GET','uri':util[_0x1c4d('0x64')](_0x1c4d('0x65'),_0x1bbe34),'headers':{'Content-Type':_0x1c4d('0x66'),'Accept':_0x1c4d('0x66')},'json':!![]};if(_0x3f066c[_0x1c4d('0x5b')]===_0x1c4d('0x67')){_0x43b58b[_0x1c4d('0x68')]['Authorization']=util[_0x1c4d('0x64')](_0x1c4d('0x69'),new Buffer(util[_0x1c4d('0x64')](_0x1c4d('0x6a'),_0x3f066c[_0x1c4d('0x5c')],_0x3f066c['password']))['toString'](_0x1c4d('0x6b')));}return rp(_0x43b58b)['then'](function(_0x2188c1){return _0x35c6b1[_0x1c4d('0x6c')](_[_0x1c4d('0x30')](_0x2188c1['_embedded']['entries'],function(_0x14fa5c){return{'id':_0x14fa5c[_0x1c4d('0x2d')],'name':_0x14fa5c[_0x1c4d('0x2d')],'type':_0x14fa5c[_0x1c4d('0x34')],'active':_0x14fa5c[_0x1c4d('0x6d')],'label':_0x14fa5c[_0x1c4d('0x6e')],'custom':!![]};}));});}})['then'](function(_0x545b26){return{'count':_0x545b26[_0x1c4d('0x3d')],'rows':_0x545b26};})[_0x1c4d('0x45')](respondWithResult(_0x135661,null))[_0x1c4d('0x4a')](function(_0x1b1bc2){var _0x42c8c1=_0x596f36[_0x1c4d('0x37')][_0x1c4d('0x6f')]?0x1f4:_0x1b1bc2['statusCode']||0x1f4;logger[_0x1c4d('0x2b')](_0x1c4d('0x70'),_0x1c4d('0x58'),_0x42c8c1,JSON[_0x1c4d('0x71')](_0x1b1bc2));delete _0x1b1bc2[_0x1c4d('0x2d')];if(_0x42c8c1===0x191){_0x42c8c1=0x190;}_0x135661[_0x1c4d('0x1e')](_0x42c8c1)[_0x1c4d('0x2e')](_0x596f36['query'][_0x1c4d('0x6f')]?{'message':_0x1c4d('0x72'),'statusCode':_0x1b1bc2['statusCode']}:_0x1b1bc2);});}; \ No newline at end of file +var _0xf735=['sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','DeskAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','getConfigurations','findOne','filter','hasOwnProperty','AccountId','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','remoteUri','consumerKey','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','headers','%s:%s','username','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x4e0d09,_0x54477b){var _0xe1d961=function(_0xbcaed4){while(--_0xbcaed4){_0x4e0d09['push'](_0x4e0d09['shift']());}};_0xe1d961(++_0x54477b);}(_0xf735,0x129));var _0x5f73=function(_0x24239a,_0x26c856){_0x24239a=_0x24239a-0x0;var _0x343eb6=_0xf735[_0x24239a];return _0x343eb6;};'use strict';var emlformat=require(_0x5f73('0x0'));var rimraf=require(_0x5f73('0x1'));var zipdir=require(_0x5f73('0x2'));var jsonpatch=require(_0x5f73('0x3'));var rp=require(_0x5f73('0x4'));var moment=require('moment');var BPromise=require(_0x5f73('0x5'));var Mustache=require('mustache');var util=require(_0x5f73('0x6'));var path=require(_0x5f73('0x7'));var sox=require(_0x5f73('0x8'));var csv=require(_0x5f73('0x9'));var ejs=require(_0x5f73('0xa'));var fs=require('fs');var fs_extra=require(_0x5f73('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f73('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5f73('0xd'));var toCsv=require(_0x5f73('0x9'));var querystring=require(_0x5f73('0xe'));var Papa=require(_0x5f73('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f73('0x10'));var as=require(_0x5f73('0x11'));var hardwareService=require(_0x5f73('0x12'));var logger=require('../../config/logger')(_0x5f73('0x13'));var utils=require(_0x5f73('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f73('0x15'));var db=require(_0x5f73('0x16'))['db'];var integrations=require(_0x5f73('0x17'));function respondWithStatusCode(_0x5c7996,_0x44bc90){_0x44bc90=_0x44bc90||0xcc;return function(_0xd71fdb){if(_0xd71fdb){return _0x5c7996[_0x5f73('0x18')](_0x44bc90);}return _0x5c7996[_0x5f73('0x19')](_0x44bc90)[_0x5f73('0x1a')]();};}function respondWithResult(_0x4c22cf,_0x5bcd06){_0x5bcd06=_0x5bcd06||0xc8;return function(_0x47c798){if(_0x47c798){return _0x4c22cf[_0x5f73('0x19')](_0x5bcd06)[_0x5f73('0x1b')](_0x47c798);}};}function respondWithFilteredResult(_0x20a2fd,_0x16528b){return function(_0x417a10){if(_0x417a10){var _0x8fe342=typeof _0x16528b['offset']===_0x5f73('0x1c')&&typeof _0x16528b['limit']===_0x5f73('0x1c');var _0x45f527=_0x417a10['count'];var _0x290713=_0x8fe342?0x0:_0x16528b[_0x5f73('0x1d')];var _0x546a28=_0x8fe342?_0x417a10[_0x5f73('0x1e')]:_0x16528b[_0x5f73('0x1d')]+_0x16528b[_0x5f73('0x1f')];var _0x35b5ae;if(_0x546a28>=_0x45f527){_0x546a28=_0x45f527;_0x35b5ae=0xc8;}else{_0x35b5ae=0xce;}_0x20a2fd[_0x5f73('0x19')](_0x35b5ae);return _0x20a2fd['set'](_0x5f73('0x20'),_0x290713+'-'+_0x546a28+'/'+_0x45f527)[_0x5f73('0x1b')](_0x417a10);}return null;};}function patchUpdates(_0x3b60df){return function(_0x468623){try{jsonpatch[_0x5f73('0x21')](_0x468623,_0x3b60df,!![]);}catch(_0x498663){return BPromise[_0x5f73('0x22')](_0x498663);}return _0x468623['save']();};}function saveUpdates(_0x561dd9,_0x62162f){return function(_0xde92ad){if(_0xde92ad){return _0xde92ad['update'](_0x561dd9)[_0x5f73('0x23')](function(_0x3a477b){return _0x3a477b;});}return null;};}function removeEntity(_0x98dbc4,_0x43a8c8){return function(_0x1db59d){if(_0x1db59d){return _0x1db59d[_0x5f73('0x24')]()[_0x5f73('0x23')](function(){_0x98dbc4['status'](0xcc)[_0x5f73('0x1a')]();});}};}function handleEntityNotFound(_0x1fa895,_0x1ab12c){return function(_0x1fb689){if(!_0x1fb689){_0x1fa895[_0x5f73('0x18')](0x194);}return _0x1fb689;};}function handleError(_0x446258,_0x262bc3){_0x262bc3=_0x262bc3||0x1f4;return function(_0x418a7c){logger[_0x5f73('0x25')](_0x418a7c[_0x5f73('0x26')]);if(_0x418a7c['name']){delete _0x418a7c[_0x5f73('0x27')];}_0x446258[_0x5f73('0x19')](_0x262bc3)[_0x5f73('0x28')](_0x418a7c);};}exports['index']=function(_0x537507,_0x43a5cc){var _0x3258f0={},_0x357592={},_0x438f16={'count':0x0,'rows':[]};var _0x3f4b48=_[_0x5f73('0x29')](db[_0x5f73('0x2a')][_0x5f73('0x2b')],function(_0x154909){return{'name':_0x154909['fieldName'],'type':_0x154909[_0x5f73('0x2c')][_0x5f73('0x2d')]};});_0x357592['model']=_[_0x5f73('0x29')](_0x3f4b48,_0x5f73('0x27'));_0x357592[_0x5f73('0x2e')]=_[_0x5f73('0x2f')](_0x537507[_0x5f73('0x2e')]);_0x357592[_0x5f73('0x30')]=_[_0x5f73('0x31')](_0x357592['model'],_0x357592[_0x5f73('0x2e')]);_0x3258f0['attributes']=_[_0x5f73('0x31')](_0x357592[_0x5f73('0x32')],qs[_0x5f73('0x33')](_0x537507[_0x5f73('0x2e')]['fields']));_0x3258f0['attributes']=_0x3258f0[_0x5f73('0x34')][_0x5f73('0x35')]?_0x3258f0[_0x5f73('0x34')]:_0x357592[_0x5f73('0x32')];if(!_0x537507[_0x5f73('0x2e')]['hasOwnProperty'](_0x5f73('0x36'))){_0x3258f0[_0x5f73('0x1f')]=qs['limit'](_0x537507['query']['limit']);_0x3258f0[_0x5f73('0x1d')]=qs[_0x5f73('0x1d')](_0x537507[_0x5f73('0x2e')][_0x5f73('0x1d')]);}_0x3258f0[_0x5f73('0x37')]=qs[_0x5f73('0x38')](_0x537507[_0x5f73('0x2e')][_0x5f73('0x38')]);_0x3258f0['where']=qs[_0x5f73('0x30')](_['pick'](_0x537507[_0x5f73('0x2e')],_0x357592['filters']),_0x3f4b48);if(_0x537507[_0x5f73('0x2e')]['filter']){_0x3258f0[_0x5f73('0x39')]=_['merge'](_0x3258f0[_0x5f73('0x39')],{'$or':_[_0x5f73('0x29')](_0x3f4b48,function(_0x2d7969){if(_0x2d7969[_0x5f73('0x2c')]!==_0x5f73('0x3a')){var _0x1b55cc={};_0x1b55cc[_0x2d7969['name']]={'$like':'%'+_0x537507['query']['filter']+'%'};return _0x1b55cc;}})});}_0x3258f0=_[_0x5f73('0x3b')]({},_0x3258f0,_0x537507['options']);var _0x169a01={'where':_0x3258f0[_0x5f73('0x39')]};return db[_0x5f73('0x2a')][_0x5f73('0x1e')](_0x169a01)[_0x5f73('0x23')](function(_0x484f07){_0x438f16[_0x5f73('0x1e')]=_0x484f07;if(_0x537507[_0x5f73('0x2e')][_0x5f73('0x3c')]){_0x3258f0[_0x5f73('0x3d')]=[{'all':!![]}];}return db[_0x5f73('0x2a')][_0x5f73('0x3e')](_0x3258f0);})[_0x5f73('0x23')](function(_0x53b43a){_0x438f16['rows']=_0x53b43a;return _0x438f16;})['then'](respondWithFilteredResult(_0x43a5cc,_0x3258f0))[_0x5f73('0x3f')](handleError(_0x43a5cc,null));};exports[_0x5f73('0x40')]=function(_0x4e8605,_0x52a29f){var _0x4602d7={'raw':![],'where':{'id':_0x4e8605['params']['id']}},_0x1e22e6={};_0x1e22e6[_0x5f73('0x32')]=_['keys'](db[_0x5f73('0x2a')]['rawAttributes']);_0x1e22e6[_0x5f73('0x2e')]=_[_0x5f73('0x2f')](_0x4e8605['query']);_0x1e22e6[_0x5f73('0x30')]=_[_0x5f73('0x31')](_0x1e22e6['model'],_0x1e22e6['query']);_0x4602d7[_0x5f73('0x34')]=_['intersection'](_0x1e22e6[_0x5f73('0x32')],qs[_0x5f73('0x33')](_0x4e8605[_0x5f73('0x2e')][_0x5f73('0x33')]));_0x4602d7[_0x5f73('0x34')]=_0x4602d7['attributes'][_0x5f73('0x35')]?_0x4602d7[_0x5f73('0x34')]:_0x1e22e6[_0x5f73('0x32')];if(_0x4e8605[_0x5f73('0x2e')][_0x5f73('0x3c')]){_0x4602d7[_0x5f73('0x3d')]=[{'all':!![]}];}_0x4602d7=_[_0x5f73('0x3b')]({},_0x4602d7,_0x4e8605[_0x5f73('0x41')]);return db['DeskAccount'][_0x5f73('0x42')](_0x4602d7)[_0x5f73('0x23')](handleEntityNotFound(_0x52a29f,null))[_0x5f73('0x23')](respondWithResult(_0x52a29f,null))[_0x5f73('0x3f')](handleError(_0x52a29f,null));};exports[_0x5f73('0x43')]=function(_0x2c85f6,_0x298bf8){return db['DeskAccount']['create'](_0x2c85f6[_0x5f73('0x44')],{})[_0x5f73('0x23')](respondWithResult(_0x298bf8,0xc9))[_0x5f73('0x3f')](handleError(_0x298bf8,null));};exports['update']=function(_0x4d1cf0,_0x5bca5b){if(_0x4d1cf0['body']['id']){delete _0x4d1cf0[_0x5f73('0x44')]['id'];}return db[_0x5f73('0x2a')][_0x5f73('0x42')]({'where':{'id':_0x4d1cf0[_0x5f73('0x45')]['id']}})[_0x5f73('0x23')](handleEntityNotFound(_0x5bca5b,null))[_0x5f73('0x23')](saveUpdates(_0x4d1cf0['body'],null))[_0x5f73('0x23')](respondWithResult(_0x5bca5b,null))[_0x5f73('0x3f')](handleError(_0x5bca5b,null));};exports[_0x5f73('0x24')]=function(_0x10f369,_0x2816be){return db['DeskAccount'][_0x5f73('0x42')]({'where':{'id':_0x10f369['params']['id']}})[_0x5f73('0x23')](handleEntityNotFound(_0x2816be,null))[_0x5f73('0x23')](removeEntity(_0x2816be,null))['catch'](handleError(_0x2816be,null));};exports[_0x5f73('0x46')]=function(_0x5b08a7,_0x4a9138,_0x5e5696){var _0x3331ec={};var _0x48ccc9={};var _0x2c629d;var _0x3a8b22;return db[_0x5f73('0x2a')][_0x5f73('0x47')]({'where':{'id':_0x5b08a7[_0x5f73('0x45')]['id']}})[_0x5f73('0x23')](handleEntityNotFound(_0x4a9138,null))[_0x5f73('0x23')](function(_0x1f3bbd){if(_0x1f3bbd){_0x2c629d=_0x1f3bbd;_0x48ccc9[_0x5f73('0x32')]=_['keys'](db['DeskConfiguration'][_0x5f73('0x2b')]);_0x48ccc9[_0x5f73('0x2e')]=_[_0x5f73('0x2f')](_0x5b08a7[_0x5f73('0x2e')]);_0x48ccc9[_0x5f73('0x30')]=_['intersection'](_0x48ccc9['model'],_0x48ccc9[_0x5f73('0x2e')]);_0x3331ec['attributes']=_[_0x5f73('0x31')](_0x48ccc9[_0x5f73('0x32')],qs[_0x5f73('0x33')](_0x5b08a7['query'][_0x5f73('0x33')]));_0x3331ec[_0x5f73('0x34')]=_0x3331ec['attributes']['length']?_0x3331ec['attributes']:_0x48ccc9[_0x5f73('0x32')];_0x3331ec[_0x5f73('0x37')]=qs[_0x5f73('0x38')](_0x5b08a7[_0x5f73('0x2e')][_0x5f73('0x38')]);_0x3331ec[_0x5f73('0x39')]=qs[_0x5f73('0x30')](_['pick'](_0x5b08a7['query'],_0x48ccc9[_0x5f73('0x30')]));if(_0x5b08a7[_0x5f73('0x2e')][_0x5f73('0x48')]){_0x3331ec[_0x5f73('0x39')]=_['merge'](_0x3331ec[_0x5f73('0x39')],{'$or':_[_0x5f73('0x29')](_0x3331ec['attributes'],function(_0x389632){var _0x55b150={};_0x55b150[_0x389632]={'$like':'%'+_0x5b08a7[_0x5f73('0x2e')][_0x5f73('0x48')]+'%'};return _0x55b150;})});}_0x3331ec=_[_0x5f73('0x3b')]({},_0x3331ec,_0x5b08a7[_0x5f73('0x41')]);return _0x2c629d[_0x5f73('0x46')](_0x3331ec);}})['then'](function(_0x538ccd){if(_0x538ccd){_0x3a8b22=_0x538ccd[_0x5f73('0x35')];if(!_0x5b08a7['query'][_0x5f73('0x49')](_0x5f73('0x36'))){_0x3331ec[_0x5f73('0x1f')]=qs[_0x5f73('0x1f')](_0x5b08a7[_0x5f73('0x2e')][_0x5f73('0x1f')]);_0x3331ec['offset']=qs[_0x5f73('0x1d')](_0x5b08a7[_0x5f73('0x2e')]['offset']);}return _0x2c629d['getConfigurations'](_0x3331ec);}})[_0x5f73('0x23')](function(_0x59c229){if(_0x59c229){return _0x59c229?{'count':_0x3a8b22,'rows':_0x59c229}:null;}})[_0x5f73('0x23')](respondWithResult(_0x4a9138,null))[_0x5f73('0x3f')](handleError(_0x4a9138,null));};exports['addConfiguration']=function(_0x507e96,_0xc60a58,_0x30fa78){if(_0x507e96['body']['id']){delete _0x507e96['body']['id'];}return db[_0x5f73('0x2a')][_0x5f73('0x47')]({'where':{'id':_0x507e96[_0x5f73('0x45')]['id']}})['then'](handleEntityNotFound(_0xc60a58,null))[_0x5f73('0x23')](function(_0x32be7d){if(_0x32be7d){_0x507e96[_0x5f73('0x44')][_0x5f73('0x4a')]=_0x32be7d['id'];_0x507e96['body'][_0x5f73('0x4b')]=integrations[_0x5f73('0x4c')](_0x507e96[_0x5f73('0x44')]['channel'],_0x507e96['body']['type']);_0x507e96['body']['Descriptions']=integrations[_0x5f73('0x4d')](_0x507e96[_0x5f73('0x44')][_0x5f73('0x4e')],_0x507e96[_0x5f73('0x44')][_0x5f73('0x2c')]);return db['DeskConfiguration'][_0x5f73('0x43')](_0x507e96['body'],{'include':[{'model':db['DeskField'],'as':_0x5f73('0x4b')},{'model':db[_0x5f73('0x4f')],'as':_0x5f73('0x50')}]});}return null;})[_0x5f73('0x23')](respondWithResult(_0xc60a58,null))[_0x5f73('0x3f')](handleError(_0xc60a58,null));};exports[_0x5f73('0x51')]=function(_0x127e0e,_0x4c3d85,_0x2b9e40){var _0x5d4e5e=[{'name':_0x5f73('0x52'),'label':_0x5f73('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 _0x16031b='';return db[_0x5f73('0x2a')]['findOne']({'where':{'id':_0x127e0e[_0x5f73('0x45')]['id']},'attributes':['id',_0x5f73('0x53'),'authType','username','password',_0x5f73('0x54'),_0x5f73('0x55'),'token','tokenSecret']})[_0x5f73('0x23')](handleEntityNotFound(_0x4c3d85,null))['then'](function(_0x921fdb){if(_0x921fdb){_0x16031b=_0x921fdb['remoteUri'];var _0x44e73a=_0x16031b[_0x5f73('0x56')](-0x1);if(_0x44e73a==='/'){_0x16031b=_0x16031b[_0x5f73('0x57')](0x0,_0x16031b[_0x5f73('0x58')](_0x44e73a));}var _0x1a22de={'method':_0x5f73('0x59'),'uri':util[_0x5f73('0x5a')](_0x5f73('0x5b'),_0x16031b),'headers':{'Content-Type':_0x5f73('0x5c'),'Accept':'application/json'},'json':!![]};if(_0x921fdb[_0x5f73('0x5d')]==='basic'){_0x1a22de[_0x5f73('0x5e')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0x5f73('0x5a')](_0x5f73('0x5f'),_0x921fdb[_0x5f73('0x60')],_0x921fdb['password']))['toString'](_0x5f73('0x61')));}return rp(_0x1a22de)[_0x5f73('0x23')](function(_0x4d0282){return _0x5d4e5e[_0x5f73('0x62')](_[_0x5f73('0x29')](_0x4d0282['_embedded'][_0x5f73('0x63')],function(_0x44c66f){return{'id':_0x44c66f[_0x5f73('0x27')],'name':_0x44c66f[_0x5f73('0x27')],'type':_0x44c66f['type'],'active':_0x44c66f[_0x5f73('0x64')],'label':_0x44c66f[_0x5f73('0x65')],'custom':!![]};}));});}})[_0x5f73('0x23')](function(_0x3f6b00){return{'count':_0x3f6b00['length'],'rows':_0x3f6b00};})['then'](respondWithResult(_0x4c3d85,null))[_0x5f73('0x3f')](function(_0x22e0a4){var _0x15e9cb=_0x127e0e[_0x5f73('0x2e')][_0x5f73('0x66')]?0x1f4:_0x22e0a4[_0x5f73('0x67')]||0x1f4;logger[_0x5f73('0x25')](_0x5f73('0x68'),_0x5f73('0x51'),_0x15e9cb,JSON[_0x5f73('0x69')](_0x22e0a4));delete _0x22e0a4[_0x5f73('0x27')];if(_0x15e9cb===0x191){_0x15e9cb=0x190;}_0x4c3d85[_0x5f73('0x19')](_0x15e9cb)['send'](_0x127e0e[_0x5f73('0x2e')]['test']?{'message':_0x5f73('0x6a'),'statusCode':_0x22e0a4[_0x5f73('0x67')]}:_0x22e0a4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1875ba2..49ceecc 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 _0x2ce8=['path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','bluebird','request-promise'];(function(_0x194e18,_0x5d5f3a){var _0x5e41f2=function(_0x5ea3ac){while(--_0x5ea3ac){_0x194e18['push'](_0x194e18['shift']());}};_0x5e41f2(++_0x5d5f3a);}(_0x2ce8,0xee));var _0x82ce=function(_0x33c3d3,_0x51eed3){_0x33c3d3=_0x33c3d3-0x0;var _0xf3a17f=_0x2ce8[_0x33c3d3];return _0xf3a17f;};'use strict';var _=require(_0x82ce('0x0'));var util=require('util');var logger=require(_0x82ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0x82ce('0x2'));var rp=require(_0x82ce('0x3'));var fs=require('fs');var path=require(_0x82ce('0x4'));var rimraf=require('rimraf');var config=require(_0x82ce('0x5'));var attributes=require(_0x82ce('0x6'));var integrations=require(_0x82ce('0x7'));module[_0x82ce('0x8')]=function(_0x3fcd4e,_0x2c031f){return _0x3fcd4e['define'](_0x82ce('0x9'),attributes,{'tableName':_0x82ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d8e=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount'];(function(_0xa1947d,_0xeb1015){var _0xccc41a=function(_0x976139){while(--_0x976139){_0xa1947d['push'](_0xa1947d['shift']());}};_0xccc41a(++_0xeb1015);}(_0x7d8e,0x6a));var _0xe7d8=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x7d8e[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0xe7d8('0x0'));var util=require(_0xe7d8('0x1'));var logger=require(_0xe7d8('0x2'))(_0xe7d8('0x3'));var moment=require(_0xe7d8('0x4'));var BPromise=require(_0xe7d8('0x5'));var rp=require(_0xe7d8('0x6'));var fs=require('fs');var path=require(_0xe7d8('0x7'));var rimraf=require(_0xe7d8('0x8'));var config=require(_0xe7d8('0x9'));var attributes=require(_0xe7d8('0xa'));var integrations=require(_0xe7d8('0xb'));module[_0xe7d8('0xc')]=function(_0x17ee44,_0x13ed17){return _0x17ee44['define'](_0xe7d8('0xd'),attributes,{'tableName':_0xe7d8('0xe'),'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 6c12924..2e60813 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 _0xdb60=['attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','findAll','options','where'];(function(_0x40104f,_0x3f1223){var _0x37d5ed=function(_0x452938){while(--_0x452938){_0x40104f['push'](_0x40104f['shift']());}};_0x37d5ed(++_0x3f1223);}(_0xdb60,0x188));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0db6('0x0'));var util=require(_0x0db6('0x1'));var moment=require(_0x0db6('0x2'));var BPromise=require(_0x0db6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0db6('0x4'));var db=require(_0x0db6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0db6('0x6'))(_0x0db6('0x7'));var config=require(_0x0db6('0x8'));var jayson=require(_0x0db6('0x9'));var client=jayson['client'][_0x0db6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b697c,_0x163465,_0x42196b){return new BPromise(function(_0x1173a2,_0x1fba1f){return client[_0x0db6('0xb')](_0x2b697c,_0x42196b)[_0x0db6('0xc')](function(_0x455896){logger[_0x0db6('0xd')]('DeskAccount,\x20%s,\x20%s',_0x163465,'request\x20sent');logger[_0x0db6('0xe')](_0x0db6('0xf'),_0x163465,_0x0db6('0x10'),JSON[_0x0db6('0x11')](_0x455896));if(_0x455896[_0x0db6('0x12')]){if(_0x455896[_0x0db6('0x12')][_0x0db6('0x13')]===0x1f4){logger[_0x0db6('0x12')](_0x0db6('0x14'),_0x163465,_0x455896['error']['message']);return _0x1fba1f(_0x455896[_0x0db6('0x12')][_0x0db6('0x15')]);}logger[_0x0db6('0x12')](_0x0db6('0x14'),_0x163465,_0x455896['error'][_0x0db6('0x15')]);return _0x1173a2(_0x455896[_0x0db6('0x12')][_0x0db6('0x15')]);}else{logger[_0x0db6('0xd')](_0x0db6('0x14'),_0x163465,_0x0db6('0x10'));_0x1173a2(_0x455896['result'][_0x0db6('0x15')]);}})[_0x0db6('0x16')](function(_0x3a06b9){logger[_0x0db6('0x12')](_0x0db6('0x14'),_0x163465,_0x3a06b9);_0x1fba1f(_0x3a06b9);});});}exports[_0x0db6('0x17')]=function(_0x2b0ca2){var _0x591b40=this;return new Promise(function(_0x55707c,_0x156898){return db[_0x0db6('0x18')][_0x0db6('0x19')]({'raw':_0x2b0ca2[_0x0db6('0x1a')]?_0x2b0ca2[_0x0db6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0ca2['options']?_0x2b0ca2[_0x0db6('0x1a')][_0x0db6('0x1b')]||null:null,'attributes':_0x2b0ca2['options']?_0x2b0ca2[_0x0db6('0x1a')][_0x0db6('0x1c')]||null:null,'limit':_0x2b0ca2[_0x0db6('0x1a')]?_0x2b0ca2[_0x0db6('0x1a')][_0x0db6('0x1d')]||null:null,'include':_0x2b0ca2[_0x0db6('0x1a')]?_0x2b0ca2['options'][_0x0db6('0x1e')]?_[_0x0db6('0x1f')](_0x2b0ca2[_0x0db6('0x1a')][_0x0db6('0x1e')],function(_0x1bc4f0){return{'model':db[_0x1bc4f0[_0x0db6('0x20')]],'as':_0x1bc4f0['as'],'attributes':_0x1bc4f0['attributes'],'include':_0x1bc4f0['include']?_['map'](_0x1bc4f0[_0x0db6('0x1e')],function(_0x328787){return{'model':db[_0x328787[_0x0db6('0x20')]],'as':_0x328787['as'],'attributes':_0x328787['attributes'],'include':_0x328787['include']?_[_0x0db6('0x1f')](_0x328787[_0x0db6('0x1e')],function(_0x51f507){return{'model':db[_0x51f507[_0x0db6('0x20')]],'as':_0x51f507['as'],'attributes':_0x51f507[_0x0db6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0db6('0xc')](function(_0x5475c4){logger[_0x0db6('0xd')](_0x0db6('0x17'),_0x2b0ca2);logger[_0x0db6('0xe')](_0x0db6('0x17'),_0x2b0ca2,JSON[_0x0db6('0x11')](_0x5475c4));_0x55707c(_0x5475c4);})['catch'](function(_0x350a52){logger[_0x0db6('0x12')](_0x0db6('0x17'),_0x350a52[_0x0db6('0x15')],_0x2b0ca2);_0x156898(_0x591b40['error'](0x1f4,_0x350a52[_0x0db6('0x15')]));});});};exports[_0x0db6('0x21')]=function(_0x36b97a){var _0x208597=this;return new Promise(function(_0x5619e2,_0x30f65b){return db[_0x0db6('0x18')][_0x0db6('0x22')]({'raw':_0x36b97a[_0x0db6('0x1a')]?_0x36b97a[_0x0db6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x36b97a[_0x0db6('0x1a')]?_0x36b97a[_0x0db6('0x1a')][_0x0db6('0x1b')]||null:null,'attributes':_0x36b97a[_0x0db6('0x1a')]?_0x36b97a[_0x0db6('0x1a')][_0x0db6('0x1c')]||null:null,'include':_0x36b97a[_0x0db6('0x1a')]?_0x36b97a['options'][_0x0db6('0x1e')]?_[_0x0db6('0x1f')](_0x36b97a[_0x0db6('0x1a')][_0x0db6('0x1e')],function(_0x49d2d9){return{'model':db[_0x49d2d9[_0x0db6('0x20')]],'as':_0x49d2d9['as'],'attributes':_0x49d2d9['attributes'],'include':_0x49d2d9[_0x0db6('0x1e')]?_[_0x0db6('0x1f')](_0x49d2d9[_0x0db6('0x1e')],function(_0xe2400a){return{'model':db[_0xe2400a[_0x0db6('0x20')]],'as':_0xe2400a['as'],'attributes':_0xe2400a['attributes'],'include':_0xe2400a[_0x0db6('0x1e')]?_[_0x0db6('0x1f')](_0xe2400a[_0x0db6('0x1e')],function(_0xb1aa23){return{'model':db[_0xb1aa23[_0x0db6('0x20')]],'as':_0xb1aa23['as'],'attributes':_0xb1aa23[_0x0db6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0db6('0xc')](function(_0x40997c){logger[_0x0db6('0xd')](_0x0db6('0x21'),_0x36b97a);logger['debug'](_0x0db6('0x21'),_0x36b97a,JSON[_0x0db6('0x11')](_0x40997c));_0x5619e2(_0x40997c);})['catch'](function(_0x111a9f){logger[_0x0db6('0x12')](_0x0db6('0x21'),_0x111a9f[_0x0db6('0x15')],_0x36b97a);_0x30f65b(_0x208597[_0x0db6('0x12')](0x1f4,_0x111a9f[_0x0db6('0x15')]));});});}; \ No newline at end of file +var _0x1002=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','DeskAccount','findAll','options','where','attributes','include','map','model','GetDeskAccount','stringify','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x3f9f8d,_0x499006){var _0xbe5c62=function(_0x3cf180){while(--_0x3cf180){_0x3f9f8d['push'](_0x3f9f8d['shift']());}};_0xbe5c62(++_0x499006);}(_0x1002,0x8d));var _0x2100=function(_0x41bbd0,_0x296de6){_0x41bbd0=_0x41bbd0-0x0;var _0x519942=_0x1002[_0x41bbd0];return _0x519942;};'use strict';var _=require(_0x2100('0x0'));var util=require('util');var moment=require(_0x2100('0x1'));var BPromise=require('bluebird');var rs=require(_0x2100('0x2'));var fs=require('fs');var Redis=require(_0x2100('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2100('0x4'));var logger=require(_0x2100('0x5'))(_0x2100('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2100('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2ae1,_0x119941,_0x5e7290){return new BPromise(function(_0x1cef7a,_0x4da309){return client[_0x2100('0x8')](_0x2d2ae1,_0x5e7290)[_0x2100('0x9')](function(_0x3e5ce6){logger[_0x2100('0xa')](_0x2100('0xb'),_0x119941,_0x2100('0xc'));logger[_0x2100('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x119941,_0x2100('0xc'),JSON['stringify'](_0x3e5ce6));if(_0x3e5ce6[_0x2100('0xe')]){if(_0x3e5ce6['error'][_0x2100('0xf')]===0x1f4){logger[_0x2100('0xe')](_0x2100('0xb'),_0x119941,_0x3e5ce6['error']['message']);return _0x4da309(_0x3e5ce6[_0x2100('0xe')][_0x2100('0x10')]);}logger[_0x2100('0xe')](_0x2100('0xb'),_0x119941,_0x3e5ce6['error'][_0x2100('0x10')]);return _0x1cef7a(_0x3e5ce6[_0x2100('0xe')][_0x2100('0x10')]);}else{logger[_0x2100('0xa')]('DeskAccount,\x20%s,\x20%s',_0x119941,_0x2100('0xc'));_0x1cef7a(_0x3e5ce6[_0x2100('0x11')][_0x2100('0x10')]);}})[_0x2100('0x12')](function(_0x4365c4){logger[_0x2100('0xe')](_0x2100('0xb'),_0x119941,_0x4365c4);_0x4da309(_0x4365c4);});});}exports['GetDeskAccount']=function(_0x2a185a){var _0x2f3004=this;return new Promise(function(_0x16125f,_0x2713b1){return db[_0x2100('0x13')][_0x2100('0x14')]({'raw':_0x2a185a[_0x2100('0x15')]?_0x2a185a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a185a[_0x2100('0x15')]?_0x2a185a['options'][_0x2100('0x16')]||null:null,'attributes':_0x2a185a[_0x2100('0x15')]?_0x2a185a[_0x2100('0x15')][_0x2100('0x17')]||null:null,'limit':_0x2a185a[_0x2100('0x15')]?_0x2a185a[_0x2100('0x15')]['limit']||null:null,'include':_0x2a185a[_0x2100('0x15')]?_0x2a185a[_0x2100('0x15')][_0x2100('0x18')]?_[_0x2100('0x19')](_0x2a185a[_0x2100('0x15')][_0x2100('0x18')],function(_0x20b6d1){return{'model':db[_0x20b6d1[_0x2100('0x1a')]],'as':_0x20b6d1['as'],'attributes':_0x20b6d1[_0x2100('0x17')],'include':_0x20b6d1[_0x2100('0x18')]?_[_0x2100('0x19')](_0x20b6d1[_0x2100('0x18')],function(_0x4bdd44){return{'model':db[_0x4bdd44[_0x2100('0x1a')]],'as':_0x4bdd44['as'],'attributes':_0x4bdd44[_0x2100('0x17')],'include':_0x4bdd44[_0x2100('0x18')]?_[_0x2100('0x19')](_0x4bdd44[_0x2100('0x18')],function(_0x1d960f){return{'model':db[_0x1d960f[_0x2100('0x1a')]],'as':_0x1d960f['as'],'attributes':_0x1d960f[_0x2100('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2100('0x9')](function(_0x1db496){logger[_0x2100('0xa')](_0x2100('0x1b'),_0x2a185a);logger['debug'](_0x2100('0x1b'),_0x2a185a,JSON[_0x2100('0x1c')](_0x1db496));_0x16125f(_0x1db496);})[_0x2100('0x12')](function(_0x4576e2){logger['error'](_0x2100('0x1b'),_0x4576e2[_0x2100('0x10')],_0x2a185a);_0x2713b1(_0x2f3004[_0x2100('0xe')](0x1f4,_0x4576e2[_0x2100('0x10')]));});});};exports[_0x2100('0x1d')]=function(_0x17e27e){var _0x1885e7=this;return new Promise(function(_0x3eb9a2,_0x26bbdd){return db[_0x2100('0x13')]['find']({'raw':_0x17e27e['options']?_0x17e27e[_0x2100('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17e27e[_0x2100('0x15')]?_0x17e27e[_0x2100('0x15')]['where']||null:null,'attributes':_0x17e27e[_0x2100('0x15')]?_0x17e27e['options'][_0x2100('0x17')]||null:null,'include':_0x17e27e[_0x2100('0x15')]?_0x17e27e[_0x2100('0x15')][_0x2100('0x18')]?_[_0x2100('0x19')](_0x17e27e[_0x2100('0x15')][_0x2100('0x18')],function(_0x10a32e){return{'model':db[_0x10a32e[_0x2100('0x1a')]],'as':_0x10a32e['as'],'attributes':_0x10a32e[_0x2100('0x17')],'include':_0x10a32e[_0x2100('0x18')]?_[_0x2100('0x19')](_0x10a32e[_0x2100('0x18')],function(_0x477c57){return{'model':db[_0x477c57['model']],'as':_0x477c57['as'],'attributes':_0x477c57[_0x2100('0x17')],'include':_0x477c57['include']?_[_0x2100('0x19')](_0x477c57[_0x2100('0x18')],function(_0x3713e5){return{'model':db[_0x3713e5[_0x2100('0x1a')]],'as':_0x3713e5['as'],'attributes':_0x3713e5[_0x2100('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4570a8){logger[_0x2100('0xa')](_0x2100('0x1d'),_0x17e27e);logger[_0x2100('0xd')](_0x2100('0x1d'),_0x17e27e,JSON[_0x2100('0x1c')](_0x4570a8));_0x3eb9a2(_0x4570a8);})[_0x2100('0x12')](function(_0x54e2d4){logger[_0x2100('0xe')](_0x2100('0x1d'),_0x54e2d4[_0x2100('0x10')],_0x17e27e);_0x26bbdd(_0x1885e7[_0x2100('0xe')](0x1f4,_0x54e2d4[_0x2100('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a75e80f..c3e1ba9 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x314831,_0x2a49da){var _0x90851d=function(_0x3fcdb2){while(--_0x3fcdb2){_0x314831['push'](_0x314831['shift']());}};_0x90851d(++_0x2a49da);}(_0x008c,0x188));var _0xc008=function(_0x24594d,_0x18cfaa){_0x24594d=_0x24594d-0x0;var _0x215d28=_0x008c[_0x24594d];return _0x215d28;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x120529,_0x258749){var _0x35748d=function(_0x1c58d7){while(--_0x1c58d7){_0x120529['push'](_0x120529['shift']());}};_0x35748d(++_0x258749);}(_0x008c,0x188));var _0xc008=function(_0xee741b,_0x10cf16){_0xee741b=_0xee741b-0x0;var _0x9ce0a2=_0x008c[_0xee741b];return _0x9ce0a2;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 21d025d..9cad87c 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 _0xec69=['STRING','sequelize','exports'];(function(_0x3c2e0c,_0x62ca5f){var _0xa67634=function(_0x7fe4b5){while(--_0x7fe4b5){_0x3c2e0c['push'](_0x3c2e0c['shift']());}};_0xa67634(++_0x62ca5f);}(_0xec69,0x8e));var _0x9ec6=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xec69[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x9ec6('0x0'));module[_0x9ec6('0x1')]={'name':{'type':Sequelize[_0x9ec6('0x2')]},'description':{'type':Sequelize[_0x9ec6('0x2')]}}; \ No newline at end of file +var _0x23d2=['exports','STRING','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x23d2,0x137));var _0x223d=function(_0x18c2ed,_0x116ba1){_0x18c2ed=_0x18c2ed-0x0;var _0x2621fb=_0x23d2[_0x18c2ed];return _0x2621fb;};'use strict';var Sequelize=require(_0x223d('0x0'));module[_0x223d('0x1')]={'name':{'type':Sequelize[_0x223d('0x2')]},'description':{'type':Sequelize[_0x223d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index abf041c..b47102f 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 _0x689d=['query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','update','getFields','findOne','DeskField','length','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','index','DeskConfiguration','fieldName','type','key','model'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x689d,0x17f));var _0xd689=function(_0x175bda,_0x3afa11){_0x175bda=_0x175bda-0x0;var _0x1537d9=_0x689d[_0x175bda];return _0x1537d9;};'use strict';var emlformat=require(_0xd689('0x0'));var rimraf=require(_0xd689('0x1'));var zipdir=require(_0xd689('0x2'));var jsonpatch=require(_0xd689('0x3'));var rp=require(_0xd689('0x4'));var moment=require(_0xd689('0x5'));var BPromise=require(_0xd689('0x6'));var Mustache=require(_0xd689('0x7'));var util=require(_0xd689('0x8'));var path=require(_0xd689('0x9'));var sox=require(_0xd689('0xa'));var csv=require(_0xd689('0xb'));var ejs=require(_0xd689('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd689('0xd'));var squel=require(_0xd689('0xe'));var crypto=require(_0xd689('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd689('0x10'));var toCsv=require(_0xd689('0xb'));var querystring=require('querystring');var Papa=require(_0xd689('0x11'));var Redis=require(_0xd689('0x12'));var authService=require(_0xd689('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd689('0x14'));var logger=require(_0xd689('0x15'))(_0xd689('0x16'));var utils=require(_0xd689('0x17'));var config=require(_0xd689('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd689('0x19'))['db'];function respondWithStatusCode(_0x599a3b,_0x3ca66b){_0x3ca66b=_0x3ca66b||0xcc;return function(_0x3f28b4){if(_0x3f28b4){return _0x599a3b[_0xd689('0x1a')](_0x3ca66b);}return _0x599a3b[_0xd689('0x1b')](_0x3ca66b)['end']();};}function respondWithResult(_0x136cde,_0x322ebb){_0x322ebb=_0x322ebb||0xc8;return function(_0x3e3004){if(_0x3e3004){return _0x136cde[_0xd689('0x1b')](_0x322ebb)['json'](_0x3e3004);}};}function respondWithFilteredResult(_0x231303,_0x3dcf42){return function(_0x537ee5){if(_0x537ee5){var _0x256944=typeof _0x3dcf42['offset']===_0xd689('0x1c')&&typeof _0x3dcf42['limit']==='undefined';var _0x3dc9c7=_0x537ee5[_0xd689('0x1d')];var _0x3bb50f=_0x256944?0x0:_0x3dcf42[_0xd689('0x1e')];var _0x2f46f7=_0x256944?_0x537ee5['count']:_0x3dcf42[_0xd689('0x1e')]+_0x3dcf42['limit'];var _0x25137d;if(_0x2f46f7>=_0x3dc9c7){_0x2f46f7=_0x3dc9c7;_0x25137d=0xc8;}else{_0x25137d=0xce;}_0x231303[_0xd689('0x1b')](_0x25137d);return _0x231303[_0xd689('0x1f')](_0xd689('0x20'),_0x3bb50f+'-'+_0x2f46f7+'/'+_0x3dc9c7)[_0xd689('0x21')](_0x537ee5);}return null;};}function patchUpdates(_0x37097d){return function(_0x55a9bd){try{jsonpatch[_0xd689('0x22')](_0x55a9bd,_0x37097d,!![]);}catch(_0x3d24f3){return BPromise[_0xd689('0x23')](_0x3d24f3);}return _0x55a9bd[_0xd689('0x24')]();};}function saveUpdates(_0x575e23,_0x340955){return function(_0x472e63){if(_0x472e63){return _0x472e63['update'](_0x575e23)['then'](function(_0x1e5488){return _0x1e5488;});}return null;};}function removeEntity(_0x407711,_0x1aaec7){return function(_0x188674){if(_0x188674){return _0x188674[_0xd689('0x25')]()[_0xd689('0x26')](function(){_0x407711[_0xd689('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcedb36,_0x3cf253){return function(_0x7ee7fe){if(!_0x7ee7fe){_0xcedb36[_0xd689('0x1a')](0x194);}return _0x7ee7fe;};}function handleError(_0x3e4ebb,_0x48ec03){_0x48ec03=_0x48ec03||0x1f4;return function(_0x357061){logger['error'](_0x357061[_0xd689('0x27')]);if(_0x357061[_0xd689('0x28')]){delete _0x357061[_0xd689('0x28')];}_0x3e4ebb[_0xd689('0x1b')](_0x48ec03)['send'](_0x357061);};}exports[_0xd689('0x29')]=function(_0x1ed5b5,_0x1009be){var _0xfdcd61={},_0x4dc697={},_0x2dc9da={'count':0x0,'rows':[]};var _0x107daa=_['map'](db[_0xd689('0x2a')]['rawAttributes'],function(_0x3bc45e){return{'name':_0x3bc45e[_0xd689('0x2b')],'type':_0x3bc45e[_0xd689('0x2c')][_0xd689('0x2d')]};});_0x4dc697[_0xd689('0x2e')]=_['map'](_0x107daa,_0xd689('0x28'));_0x4dc697[_0xd689('0x2f')]=_[_0xd689('0x30')](_0x1ed5b5[_0xd689('0x2f')]);_0x4dc697['filters']=_[_0xd689('0x31')](_0x4dc697[_0xd689('0x2e')],_0x4dc697[_0xd689('0x2f')]);_0xfdcd61[_0xd689('0x32')]=_[_0xd689('0x31')](_0x4dc697[_0xd689('0x2e')],qs[_0xd689('0x33')](_0x1ed5b5[_0xd689('0x2f')][_0xd689('0x33')]));_0xfdcd61[_0xd689('0x32')]=_0xfdcd61[_0xd689('0x32')]['length']?_0xfdcd61[_0xd689('0x32')]:_0x4dc697[_0xd689('0x2e')];if(!_0x1ed5b5['query']['hasOwnProperty'](_0xd689('0x34'))){_0xfdcd61[_0xd689('0x35')]=qs['limit'](_0x1ed5b5[_0xd689('0x2f')][_0xd689('0x35')]);_0xfdcd61[_0xd689('0x1e')]=qs[_0xd689('0x1e')](_0x1ed5b5['query'][_0xd689('0x1e')]);}_0xfdcd61[_0xd689('0x36')]=qs[_0xd689('0x37')](_0x1ed5b5['query']['sort']);_0xfdcd61[_0xd689('0x38')]=qs[_0xd689('0x39')](_[_0xd689('0x3a')](_0x1ed5b5['query'],_0x4dc697[_0xd689('0x39')]),_0x107daa);if(_0x1ed5b5[_0xd689('0x2f')][_0xd689('0x3b')]){_0xfdcd61['where']=_['merge'](_0xfdcd61[_0xd689('0x38')],{'$or':_[_0xd689('0x3c')](_0x107daa,function(_0x24e9b9){if(_0x24e9b9[_0xd689('0x2c')]!==_0xd689('0x3d')){var _0x3b2010={};_0x3b2010[_0x24e9b9[_0xd689('0x28')]]={'$like':'%'+_0x1ed5b5['query']['filter']+'%'};return _0x3b2010;}})});}_0xfdcd61=_[_0xd689('0x3e')]({},_0xfdcd61,_0x1ed5b5[_0xd689('0x3f')]);var _0x5474e8={'where':_0xfdcd61[_0xd689('0x38')]};return db['DeskConfiguration'][_0xd689('0x1d')](_0x5474e8)[_0xd689('0x26')](function(_0x437ad3){_0x2dc9da[_0xd689('0x1d')]=_0x437ad3;if(_0x1ed5b5[_0xd689('0x2f')][_0xd689('0x40')]){_0xfdcd61['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xd689('0x41')](_0xfdcd61);})[_0xd689('0x26')](function(_0x4efdd2){_0x2dc9da['rows']=_0x4efdd2;return _0x2dc9da;})[_0xd689('0x26')](respondWithFilteredResult(_0x1009be,_0xfdcd61))[_0xd689('0x42')](handleError(_0x1009be,null));};exports[_0xd689('0x43')]=function(_0x133e2f,_0x26f0d9){var _0x5cae06={'raw':![],'where':{'id':_0x133e2f[_0xd689('0x44')]['id']}},_0x1b4219={};_0x1b4219[_0xd689('0x2e')]=_[_0xd689('0x30')](db[_0xd689('0x2a')][_0xd689('0x45')]);_0x1b4219[_0xd689('0x2f')]=_[_0xd689('0x30')](_0x133e2f['query']);_0x1b4219['filters']=_[_0xd689('0x31')](_0x1b4219['model'],_0x1b4219[_0xd689('0x2f')]);_0x5cae06[_0xd689('0x32')]=_[_0xd689('0x31')](_0x1b4219[_0xd689('0x2e')],qs[_0xd689('0x33')](_0x133e2f['query']['fields']));_0x5cae06[_0xd689('0x32')]=_0x5cae06['attributes']['length']?_0x5cae06[_0xd689('0x32')]:_0x1b4219[_0xd689('0x2e')];if(_0x133e2f[_0xd689('0x2f')][_0xd689('0x40')]){_0x5cae06[_0xd689('0x46')]=[{'all':!![]}];}_0x5cae06=_[_0xd689('0x3e')]({},_0x5cae06,_0x133e2f[_0xd689('0x3f')]);return db[_0xd689('0x2a')][_0xd689('0x47')](_0x5cae06)['then'](handleEntityNotFound(_0x26f0d9,null))[_0xd689('0x26')](respondWithResult(_0x26f0d9,null))[_0xd689('0x42')](handleError(_0x26f0d9,null));};exports[_0xd689('0x48')]=function(_0x2662ab,_0xc71223){return db[_0xd689('0x2a')]['create'](_0x2662ab[_0xd689('0x49')],{})[_0xd689('0x26')](respondWithResult(_0xc71223,0xc9))[_0xd689('0x42')](handleError(_0xc71223,null));};exports[_0xd689('0x4a')]=function(_0x154932,_0x33b118){if(_0x154932[_0xd689('0x49')]['id']){delete _0x154932[_0xd689('0x49')]['id'];}return db['DeskConfiguration'][_0xd689('0x47')]({'where':{'id':_0x154932[_0xd689('0x44')]['id']}})['then'](handleEntityNotFound(_0x33b118,null))[_0xd689('0x26')](saveUpdates(_0x154932[_0xd689('0x49')],null))[_0xd689('0x26')](respondWithResult(_0x33b118,null))[_0xd689('0x42')](handleError(_0x33b118,null));};exports['destroy']=function(_0x56e2ca,_0x46e90f){return db[_0xd689('0x2a')][_0xd689('0x47')]({'where':{'id':_0x56e2ca[_0xd689('0x44')]['id']}})[_0xd689('0x26')](handleEntityNotFound(_0x46e90f,null))[_0xd689('0x26')](removeEntity(_0x46e90f,null))[_0xd689('0x42')](handleError(_0x46e90f,null));};exports[_0xd689('0x4b')]=function(_0x306119,_0x5ea628,_0x1a4944){var _0x460112={};var _0x1e0cf9={};var _0x19857a;var _0x4b8677;return db[_0xd689('0x2a')][_0xd689('0x4c')]({'where':{'id':_0x306119[_0xd689('0x44')]['id']}})[_0xd689('0x26')](handleEntityNotFound(_0x5ea628,null))[_0xd689('0x26')](function(_0x4a1b54){if(_0x4a1b54){_0x19857a=_0x4a1b54;_0x1e0cf9[_0xd689('0x2e')]=_[_0xd689('0x30')](db[_0xd689('0x4d')][_0xd689('0x45')]);_0x1e0cf9[_0xd689('0x2f')]=_['keys'](_0x306119['query']);_0x1e0cf9[_0xd689('0x39')]=_[_0xd689('0x31')](_0x1e0cf9[_0xd689('0x2e')],_0x1e0cf9[_0xd689('0x2f')]);_0x460112['attributes']=_[_0xd689('0x31')](_0x1e0cf9[_0xd689('0x2e')],qs[_0xd689('0x33')](_0x306119[_0xd689('0x2f')][_0xd689('0x33')]));_0x460112[_0xd689('0x32')]=_0x460112[_0xd689('0x32')]['length']?_0x460112[_0xd689('0x32')]:_0x1e0cf9[_0xd689('0x2e')];_0x460112[_0xd689('0x36')]=qs[_0xd689('0x37')](_0x306119[_0xd689('0x2f')]['sort']);_0x460112['where']=qs['filters'](_[_0xd689('0x3a')](_0x306119['query'],_0x1e0cf9[_0xd689('0x39')]));if(_0x306119[_0xd689('0x2f')][_0xd689('0x3b')]){_0x460112[_0xd689('0x38')]=_['merge'](_0x460112[_0xd689('0x38')],{'$or':_[_0xd689('0x3c')](_0x460112['attributes'],function(_0x3e292b){var _0x43f466={};_0x43f466[_0x3e292b]={'$like':'%'+_0x306119[_0xd689('0x2f')][_0xd689('0x3b')]+'%'};return _0x43f466;})});}_0x460112=_[_0xd689('0x3e')]({},_0x460112,_0x306119[_0xd689('0x3f')]);return _0x19857a['getFields'](_0x460112);}})['then'](function(_0x42538b){if(_0x42538b){_0x4b8677=_0x42538b[_0xd689('0x4e')];if(!_0x306119[_0xd689('0x2f')][_0xd689('0x4f')](_0xd689('0x34'))){_0x460112[_0xd689('0x35')]=qs[_0xd689('0x35')](_0x306119['query'][_0xd689('0x35')]);_0x460112[_0xd689('0x1e')]=qs[_0xd689('0x1e')](_0x306119['query'][_0xd689('0x1e')]);}return _0x19857a[_0xd689('0x4b')](_0x460112);}})[_0xd689('0x26')](function(_0x25c6a6){if(_0x25c6a6){return _0x25c6a6?{'count':_0x4b8677,'rows':_0x25c6a6}:null;}})[_0xd689('0x26')](respondWithResult(_0x5ea628,null))[_0xd689('0x42')](handleError(_0x5ea628,null));};exports[_0xd689('0x50')]=function(_0x3a34f1,_0x2e634c,_0x4f7bd4){var _0x5d8824={};var _0x2e9579={};var _0x2b6e06;var _0x3f9541;return db['DeskConfiguration'][_0xd689('0x4c')]({'where':{'id':_0x3a34f1['params']['id']}})[_0xd689('0x26')](handleEntityNotFound(_0x2e634c,null))[_0xd689('0x26')](function(_0x1ef136){if(_0x1ef136){_0x2b6e06=_0x1ef136;_0x2e9579['model']=_[_0xd689('0x30')](db[_0xd689('0x4d')][_0xd689('0x45')]);_0x2e9579[_0xd689('0x2f')]=_[_0xd689('0x30')](_0x3a34f1[_0xd689('0x2f')]);_0x2e9579[_0xd689('0x39')]=_[_0xd689('0x31')](_0x2e9579['model'],_0x2e9579[_0xd689('0x2f')]);_0x5d8824[_0xd689('0x32')]=_[_0xd689('0x31')](_0x2e9579[_0xd689('0x2e')],qs[_0xd689('0x33')](_0x3a34f1['query'][_0xd689('0x33')]));_0x5d8824[_0xd689('0x32')]=_0x5d8824[_0xd689('0x32')]['length']?_0x5d8824[_0xd689('0x32')]:_0x2e9579[_0xd689('0x2e')];_0x5d8824[_0xd689('0x36')]=qs[_0xd689('0x37')](_0x3a34f1[_0xd689('0x2f')]['sort']);_0x5d8824['where']=qs[_0xd689('0x39')](_[_0xd689('0x3a')](_0x3a34f1[_0xd689('0x2f')],_0x2e9579[_0xd689('0x39')]));if(_0x3a34f1[_0xd689('0x2f')][_0xd689('0x3b')]){_0x5d8824[_0xd689('0x38')]=_[_0xd689('0x3e')](_0x5d8824[_0xd689('0x38')],{'$or':_['map'](_0x5d8824[_0xd689('0x32')],function(_0x18adf7){var _0x2bb79d={};_0x2bb79d[_0x18adf7]={'$like':'%'+_0x3a34f1[_0xd689('0x2f')][_0xd689('0x3b')]+'%'};return _0x2bb79d;})});}_0x5d8824=_[_0xd689('0x3e')]({},_0x5d8824,_0x3a34f1['options']);return _0x2b6e06['getSubjects'](_0x5d8824);}})['then'](function(_0x257f96){if(_0x257f96){_0x3f9541=_0x257f96[_0xd689('0x4e')];if(!_0x3a34f1[_0xd689('0x2f')][_0xd689('0x4f')]('nolimit')){_0x5d8824['limit']=qs['limit'](_0x3a34f1[_0xd689('0x2f')]['limit']);_0x5d8824[_0xd689('0x1e')]=qs[_0xd689('0x1e')](_0x3a34f1[_0xd689('0x2f')][_0xd689('0x1e')]);}return _0x2b6e06['getSubjects'](_0x5d8824);}})['then'](function(_0x3affce){if(_0x3affce){return _0x3affce?{'count':_0x3f9541,'rows':_0x3affce}:null;}})[_0xd689('0x26')](respondWithResult(_0x2e634c,null))[_0xd689('0x42')](handleError(_0x2e634c,null));};exports[_0xd689('0x51')]=function(_0x3afa4a,_0x332b76,_0x2fc0c3){var _0x41377d={};var _0x43aa97={};var _0x5857f8;var _0x4d15fa;return db[_0xd689('0x2a')][_0xd689('0x4c')]({'where':{'id':_0x3afa4a[_0xd689('0x44')]['id']}})[_0xd689('0x26')](handleEntityNotFound(_0x332b76,null))['then'](function(_0x58b48e){if(_0x58b48e){_0x5857f8=_0x58b48e;_0x43aa97['model']=_[_0xd689('0x30')](db[_0xd689('0x4d')][_0xd689('0x45')]);_0x43aa97[_0xd689('0x2f')]=_[_0xd689('0x30')](_0x3afa4a['query']);_0x43aa97[_0xd689('0x39')]=_[_0xd689('0x31')](_0x43aa97[_0xd689('0x2e')],_0x43aa97[_0xd689('0x2f')]);_0x41377d[_0xd689('0x32')]=_[_0xd689('0x31')](_0x43aa97['model'],qs[_0xd689('0x33')](_0x3afa4a[_0xd689('0x2f')][_0xd689('0x33')]));_0x41377d[_0xd689('0x32')]=_0x41377d[_0xd689('0x32')][_0xd689('0x4e')]?_0x41377d['attributes']:_0x43aa97[_0xd689('0x2e')];_0x41377d[_0xd689('0x36')]=qs[_0xd689('0x37')](_0x3afa4a[_0xd689('0x2f')][_0xd689('0x37')]);_0x41377d['where']=qs[_0xd689('0x39')](_[_0xd689('0x3a')](_0x3afa4a[_0xd689('0x2f')],_0x43aa97['filters']));if(_0x3afa4a[_0xd689('0x2f')][_0xd689('0x3b')]){_0x41377d[_0xd689('0x38')]=_[_0xd689('0x3e')](_0x41377d[_0xd689('0x38')],{'$or':_[_0xd689('0x3c')](_0x41377d[_0xd689('0x32')],function(_0x461070){var _0x141c58={};_0x141c58[_0x461070]={'$like':'%'+_0x3afa4a['query']['filter']+'%'};return _0x141c58;})});}_0x41377d=_['merge']({},_0x41377d,_0x3afa4a[_0xd689('0x3f')]);return _0x5857f8[_0xd689('0x51')](_0x41377d);}})[_0xd689('0x26')](function(_0x1c9d62){if(_0x1c9d62){_0x4d15fa=_0x1c9d62[_0xd689('0x4e')];if(!_0x3afa4a['query'][_0xd689('0x4f')]('nolimit')){_0x41377d[_0xd689('0x35')]=qs[_0xd689('0x35')](_0x3afa4a[_0xd689('0x2f')][_0xd689('0x35')]);_0x41377d[_0xd689('0x1e')]=qs[_0xd689('0x1e')](_0x3afa4a['query']['offset']);}return _0x5857f8[_0xd689('0x51')](_0x41377d);}})[_0xd689('0x26')](function(_0x3d8082){if(_0x3d8082){return _0x3d8082?{'count':_0x4d15fa,'rows':_0x3d8082}:null;}})['then'](respondWithResult(_0x332b76,null))[_0xd689('0x42')](handleError(_0x332b76,null));};exports['getTags']=function(_0x1defd5,_0x21869e,_0xb7dd0){var _0x10bd91={};var _0x82debb={};var _0x17e50c;var _0x2252d1;return db[_0xd689('0x2a')][_0xd689('0x4c')]({'where':{'id':_0x1defd5[_0xd689('0x44')]['id']}})['then'](handleEntityNotFound(_0x21869e,null))[_0xd689('0x26')](function(_0x5d77b2){if(_0x5d77b2){_0x17e50c=_0x5d77b2;_0x82debb[_0xd689('0x2e')]=_[_0xd689('0x30')](db[_0xd689('0x52')][_0xd689('0x45')]);_0x82debb['query']=_[_0xd689('0x30')](_0x1defd5['query']);_0x82debb[_0xd689('0x39')]=_[_0xd689('0x31')](_0x82debb[_0xd689('0x2e')],_0x82debb['query']);_0x10bd91['attributes']=_[_0xd689('0x31')](_0x82debb[_0xd689('0x2e')],qs[_0xd689('0x33')](_0x1defd5['query'][_0xd689('0x33')]));_0x10bd91[_0xd689('0x32')]=_0x10bd91['attributes'][_0xd689('0x4e')]?_0x10bd91['attributes']:_0x82debb[_0xd689('0x2e')];_0x10bd91[_0xd689('0x36')]=qs[_0xd689('0x37')](_0x1defd5[_0xd689('0x2f')][_0xd689('0x37')]);_0x10bd91[_0xd689('0x38')]=qs[_0xd689('0x39')](_[_0xd689('0x3a')](_0x1defd5['query'],_0x82debb[_0xd689('0x39')]));if(_0x1defd5[_0xd689('0x2f')][_0xd689('0x3b')]){_0x10bd91[_0xd689('0x38')]=_[_0xd689('0x3e')](_0x10bd91[_0xd689('0x38')],{'$or':_['map'](_0x10bd91[_0xd689('0x32')],function(_0x6e0e2a){var _0x27f11b={};_0x27f11b[_0x6e0e2a]={'$like':'%'+_0x1defd5[_0xd689('0x2f')]['filter']+'%'};return _0x27f11b;})});}_0x10bd91=_[_0xd689('0x3e')]({},_0x10bd91,_0x1defd5['options']);return _0x17e50c[_0xd689('0x53')](_0x10bd91);}})['then'](function(_0x443a0a){if(_0x443a0a){_0x2252d1=_0x443a0a[_0xd689('0x4e')];if(!_0x1defd5[_0xd689('0x2f')][_0xd689('0x4f')](_0xd689('0x34'))){_0x10bd91[_0xd689('0x35')]=qs[_0xd689('0x35')](_0x1defd5[_0xd689('0x2f')][_0xd689('0x35')]);_0x10bd91['offset']=qs[_0xd689('0x1e')](_0x1defd5[_0xd689('0x2f')][_0xd689('0x1e')]);}return _0x17e50c[_0xd689('0x53')](_0x10bd91);}})['then'](function(_0x2228a0){if(_0x2228a0){return _0x2228a0?{'count':_0x2252d1,'rows':_0x2228a0}:null;}})['then'](respondWithResult(_0x21869e,null))['catch'](handleError(_0x21869e,null));};exports[_0xd689('0x54')]=function(_0x15fad0,_0x50f676,_0x5cec0a){if(_0x15fad0[_0xd689('0x49')]['id']){delete _0x15fad0[_0xd689('0x49')]['id'];}return db[_0xd689('0x2a')][_0xd689('0x4c')]({'where':{'id':_0x15fad0['params']['id']}})[_0xd689('0x26')](handleEntityNotFound(_0x50f676,null))['then'](function(_0x5e3dda){if(_0x5e3dda){return _0x5e3dda[_0xd689('0x54')](_0x15fad0[_0xd689('0x49')][_0xd689('0x55')]||[]);}return null;})[_0xd689('0x26')](respondWithResult(_0x50f676,null))[_0xd689('0x42')](handleError(_0x50f676,null));}; \ No newline at end of file +var _0x9afa=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','length','includeAll','options','find','catch','create','body','params','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x59f4e3,_0x48650b){var _0x2756e2=function(_0x10a7c4){while(--_0x10a7c4){_0x59f4e3['push'](_0x59f4e3['shift']());}};_0x2756e2(++_0x48650b);}(_0x9afa,0x14c));var _0xa9af=function(_0x356d05,_0x5d6088){_0x356d05=_0x356d05-0x0;var _0x4c0755=_0x9afa[_0x356d05];return _0x4c0755;};'use strict';var emlformat=require(_0xa9af('0x0'));var rimraf=require(_0xa9af('0x1'));var zipdir=require(_0xa9af('0x2'));var jsonpatch=require(_0xa9af('0x3'));var rp=require(_0xa9af('0x4'));var moment=require('moment');var BPromise=require(_0xa9af('0x5'));var Mustache=require(_0xa9af('0x6'));var util=require(_0xa9af('0x7'));var path=require(_0xa9af('0x8'));var sox=require(_0xa9af('0x9'));var csv=require(_0xa9af('0xa'));var ejs=require(_0xa9af('0xb'));var fs=require('fs');var fs_extra=require(_0xa9af('0xc'));var _=require(_0xa9af('0xd'));var squel=require(_0xa9af('0xe'));var crypto=require('crypto');var jsforce=require(_0xa9af('0xf'));var deskjs=require(_0xa9af('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9af('0x11'));var Redis=require(_0xa9af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa9af('0x13'));var as=require(_0xa9af('0x14'));var hardwareService=require(_0xa9af('0x15'));var logger=require(_0xa9af('0x16'))(_0xa9af('0x17'));var utils=require(_0xa9af('0x18'));var config=require(_0xa9af('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56cfa9,_0x2109fc){_0x2109fc=_0x2109fc||0xcc;return function(_0x3b265a){if(_0x3b265a){return _0x56cfa9[_0xa9af('0x1a')](_0x2109fc);}return _0x56cfa9[_0xa9af('0x1b')](_0x2109fc)[_0xa9af('0x1c')]();};}function respondWithResult(_0x236212,_0x3dde74){_0x3dde74=_0x3dde74||0xc8;return function(_0x4922d4){if(_0x4922d4){return _0x236212['status'](_0x3dde74)['json'](_0x4922d4);}};}function respondWithFilteredResult(_0x254602,_0x5dabbc){return function(_0x14d85d){if(_0x14d85d){var _0x2b54f5=typeof _0x5dabbc[_0xa9af('0x1d')]==='undefined'&&typeof _0x5dabbc[_0xa9af('0x1e')]===_0xa9af('0x1f');var _0xa9ffc=_0x14d85d[_0xa9af('0x20')];var _0x15fa27=_0x2b54f5?0x0:_0x5dabbc[_0xa9af('0x1d')];var _0x473935=_0x2b54f5?_0x14d85d[_0xa9af('0x20')]:_0x5dabbc[_0xa9af('0x1d')]+_0x5dabbc[_0xa9af('0x1e')];var _0x5ac6fa;if(_0x473935>=_0xa9ffc){_0x473935=_0xa9ffc;_0x5ac6fa=0xc8;}else{_0x5ac6fa=0xce;}_0x254602[_0xa9af('0x1b')](_0x5ac6fa);return _0x254602[_0xa9af('0x21')](_0xa9af('0x22'),_0x15fa27+'-'+_0x473935+'/'+_0xa9ffc)['json'](_0x14d85d);}return null;};}function patchUpdates(_0x368ba2){return function(_0x330aae){try{jsonpatch[_0xa9af('0x23')](_0x330aae,_0x368ba2,!![]);}catch(_0xba3877){return BPromise[_0xa9af('0x24')](_0xba3877);}return _0x330aae[_0xa9af('0x25')]();};}function saveUpdates(_0x3d85dc,_0x28f58d){return function(_0x3ed518){if(_0x3ed518){return _0x3ed518[_0xa9af('0x26')](_0x3d85dc)[_0xa9af('0x27')](function(_0x4a90cc){return _0x4a90cc;});}return null;};}function removeEntity(_0xf90048,_0x36e284){return function(_0x1b5da0){if(_0x1b5da0){return _0x1b5da0[_0xa9af('0x28')]()[_0xa9af('0x27')](function(){_0xf90048[_0xa9af('0x1b')](0xcc)[_0xa9af('0x1c')]();});}};}function handleEntityNotFound(_0xb9f1e2,_0x2315bc){return function(_0x265873){if(!_0x265873){_0xb9f1e2['sendStatus'](0x194);}return _0x265873;};}function handleError(_0x207b55,_0x12456c){_0x12456c=_0x12456c||0x1f4;return function(_0x2d49ef){logger['error'](_0x2d49ef[_0xa9af('0x29')]);if(_0x2d49ef[_0xa9af('0x2a')]){delete _0x2d49ef[_0xa9af('0x2a')];}_0x207b55[_0xa9af('0x1b')](_0x12456c)[_0xa9af('0x2b')](_0x2d49ef);};}exports[_0xa9af('0x2c')]=function(_0x229579,_0x443543){var _0x3f6e20={},_0x523071={},_0x3f9ca8={'count':0x0,'rows':[]};var _0x3af679=_[_0xa9af('0x2d')](db[_0xa9af('0x2e')][_0xa9af('0x2f')],function(_0xea7731){return{'name':_0xea7731[_0xa9af('0x30')],'type':_0xea7731[_0xa9af('0x31')][_0xa9af('0x32')]};});_0x523071[_0xa9af('0x33')]=_[_0xa9af('0x2d')](_0x3af679,_0xa9af('0x2a'));_0x523071[_0xa9af('0x34')]=_[_0xa9af('0x35')](_0x229579['query']);_0x523071[_0xa9af('0x36')]=_[_0xa9af('0x37')](_0x523071[_0xa9af('0x33')],_0x523071['query']);_0x3f6e20['attributes']=_[_0xa9af('0x37')](_0x523071['model'],qs[_0xa9af('0x38')](_0x229579[_0xa9af('0x34')][_0xa9af('0x38')]));_0x3f6e20[_0xa9af('0x39')]=_0x3f6e20[_0xa9af('0x39')]['length']?_0x3f6e20[_0xa9af('0x39')]:_0x523071[_0xa9af('0x33')];if(!_0x229579[_0xa9af('0x34')][_0xa9af('0x3a')](_0xa9af('0x3b'))){_0x3f6e20[_0xa9af('0x1e')]=qs[_0xa9af('0x1e')](_0x229579[_0xa9af('0x34')][_0xa9af('0x1e')]);_0x3f6e20[_0xa9af('0x1d')]=qs[_0xa9af('0x1d')](_0x229579['query']['offset']);}_0x3f6e20[_0xa9af('0x3c')]=qs['sort'](_0x229579['query'][_0xa9af('0x3d')]);_0x3f6e20[_0xa9af('0x3e')]=qs[_0xa9af('0x36')](_[_0xa9af('0x3f')](_0x229579[_0xa9af('0x34')],_0x523071[_0xa9af('0x36')]),_0x3af679);if(_0x229579[_0xa9af('0x34')][_0xa9af('0x40')]){_0x3f6e20[_0xa9af('0x3e')]=_[_0xa9af('0x41')](_0x3f6e20[_0xa9af('0x3e')],{'$or':_[_0xa9af('0x2d')](_0x3af679,function(_0x6c438c){if(_0x6c438c[_0xa9af('0x31')]!=='VIRTUAL'){var _0x3f1cf8={};_0x3f1cf8[_0x6c438c[_0xa9af('0x2a')]]={'$like':'%'+_0x229579[_0xa9af('0x34')][_0xa9af('0x40')]+'%'};return _0x3f1cf8;}})});}_0x3f6e20=_[_0xa9af('0x41')]({},_0x3f6e20,_0x229579['options']);var _0x41ad19={'where':_0x3f6e20[_0xa9af('0x3e')]};return db[_0xa9af('0x2e')][_0xa9af('0x20')](_0x41ad19)[_0xa9af('0x27')](function(_0x565a5b){_0x3f9ca8['count']=_0x565a5b;if(_0x229579[_0xa9af('0x34')]['includeAll']){_0x3f6e20[_0xa9af('0x42')]=[{'all':!![]}];}return db[_0xa9af('0x2e')][_0xa9af('0x43')](_0x3f6e20);})[_0xa9af('0x27')](function(_0x326ff3){_0x3f9ca8['rows']=_0x326ff3;return _0x3f9ca8;})['then'](respondWithFilteredResult(_0x443543,_0x3f6e20))['catch'](handleError(_0x443543,null));};exports['show']=function(_0x1d0974,_0x118dae){var _0x42c349={'raw':![],'where':{'id':_0x1d0974['params']['id']}},_0x58b63a={};_0x58b63a['model']=_[_0xa9af('0x35')](db[_0xa9af('0x2e')]['rawAttributes']);_0x58b63a[_0xa9af('0x34')]=_['keys'](_0x1d0974[_0xa9af('0x34')]);_0x58b63a[_0xa9af('0x36')]=_[_0xa9af('0x37')](_0x58b63a[_0xa9af('0x33')],_0x58b63a[_0xa9af('0x34')]);_0x42c349[_0xa9af('0x39')]=_['intersection'](_0x58b63a[_0xa9af('0x33')],qs[_0xa9af('0x38')](_0x1d0974['query'][_0xa9af('0x38')]));_0x42c349[_0xa9af('0x39')]=_0x42c349[_0xa9af('0x39')][_0xa9af('0x44')]?_0x42c349[_0xa9af('0x39')]:_0x58b63a[_0xa9af('0x33')];if(_0x1d0974[_0xa9af('0x34')][_0xa9af('0x45')]){_0x42c349[_0xa9af('0x42')]=[{'all':!![]}];}_0x42c349=_[_0xa9af('0x41')]({},_0x42c349,_0x1d0974[_0xa9af('0x46')]);return db[_0xa9af('0x2e')][_0xa9af('0x47')](_0x42c349)[_0xa9af('0x27')](handleEntityNotFound(_0x118dae,null))[_0xa9af('0x27')](respondWithResult(_0x118dae,null))[_0xa9af('0x48')](handleError(_0x118dae,null));};exports['create']=function(_0x3b93a4,_0x392398){return db[_0xa9af('0x2e')][_0xa9af('0x49')](_0x3b93a4['body'],{})[_0xa9af('0x27')](respondWithResult(_0x392398,0xc9))[_0xa9af('0x48')](handleError(_0x392398,null));};exports[_0xa9af('0x26')]=function(_0x31f6e7,_0x1a0141){if(_0x31f6e7[_0xa9af('0x4a')]['id']){delete _0x31f6e7[_0xa9af('0x4a')]['id'];}return db[_0xa9af('0x2e')][_0xa9af('0x47')]({'where':{'id':_0x31f6e7['params']['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x1a0141,null))[_0xa9af('0x27')](saveUpdates(_0x31f6e7[_0xa9af('0x4a')],null))[_0xa9af('0x27')](respondWithResult(_0x1a0141,null))[_0xa9af('0x48')](handleError(_0x1a0141,null));};exports[_0xa9af('0x28')]=function(_0x266b2a,_0x584347){return db['DeskConfiguration'][_0xa9af('0x47')]({'where':{'id':_0x266b2a[_0xa9af('0x4b')]['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x584347,null))[_0xa9af('0x27')](removeEntity(_0x584347,null))[_0xa9af('0x48')](handleError(_0x584347,null));};exports['getFields']=function(_0x1999ba,_0x5a38f7,_0x323c17){var _0x583004={};var _0x1c0e0d={};var _0x5001d7;var _0x426b74;return db['DeskConfiguration'][_0xa9af('0x4c')]({'where':{'id':_0x1999ba[_0xa9af('0x4b')]['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x5a38f7,null))[_0xa9af('0x27')](function(_0x190a7e){if(_0x190a7e){_0x5001d7=_0x190a7e;_0x1c0e0d[_0xa9af('0x33')]=_[_0xa9af('0x35')](db[_0xa9af('0x4d')][_0xa9af('0x2f')]);_0x1c0e0d[_0xa9af('0x34')]=_[_0xa9af('0x35')](_0x1999ba[_0xa9af('0x34')]);_0x1c0e0d['filters']=_[_0xa9af('0x37')](_0x1c0e0d[_0xa9af('0x33')],_0x1c0e0d[_0xa9af('0x34')]);_0x583004[_0xa9af('0x39')]=_[_0xa9af('0x37')](_0x1c0e0d['model'],qs[_0xa9af('0x38')](_0x1999ba[_0xa9af('0x34')][_0xa9af('0x38')]));_0x583004[_0xa9af('0x39')]=_0x583004[_0xa9af('0x39')]['length']?_0x583004['attributes']:_0x1c0e0d['model'];_0x583004[_0xa9af('0x3c')]=qs[_0xa9af('0x3d')](_0x1999ba[_0xa9af('0x34')][_0xa9af('0x3d')]);_0x583004['where']=qs[_0xa9af('0x36')](_['pick'](_0x1999ba['query'],_0x1c0e0d[_0xa9af('0x36')]));if(_0x1999ba[_0xa9af('0x34')][_0xa9af('0x40')]){_0x583004[_0xa9af('0x3e')]=_[_0xa9af('0x41')](_0x583004['where'],{'$or':_[_0xa9af('0x2d')](_0x583004[_0xa9af('0x39')],function(_0xb26266){var _0x1e8f01={};_0x1e8f01[_0xb26266]={'$like':'%'+_0x1999ba[_0xa9af('0x34')][_0xa9af('0x40')]+'%'};return _0x1e8f01;})});}_0x583004=_[_0xa9af('0x41')]({},_0x583004,_0x1999ba[_0xa9af('0x46')]);return _0x5001d7[_0xa9af('0x4e')](_0x583004);}})['then'](function(_0x3077ae){if(_0x3077ae){_0x426b74=_0x3077ae[_0xa9af('0x44')];if(!_0x1999ba[_0xa9af('0x34')]['hasOwnProperty'](_0xa9af('0x3b'))){_0x583004[_0xa9af('0x1e')]=qs['limit'](_0x1999ba[_0xa9af('0x34')][_0xa9af('0x1e')]);_0x583004[_0xa9af('0x1d')]=qs['offset'](_0x1999ba[_0xa9af('0x34')][_0xa9af('0x1d')]);}return _0x5001d7[_0xa9af('0x4e')](_0x583004);}})[_0xa9af('0x27')](function(_0x23381c){if(_0x23381c){return _0x23381c?{'count':_0x426b74,'rows':_0x23381c}:null;}})[_0xa9af('0x27')](respondWithResult(_0x5a38f7,null))[_0xa9af('0x48')](handleError(_0x5a38f7,null));};exports[_0xa9af('0x4f')]=function(_0x4f1504,_0x455345,_0x4a6512){var _0x13ece4={};var _0x1d5983={};var _0x5a0cbc;var _0x5101fe;return db[_0xa9af('0x2e')][_0xa9af('0x4c')]({'where':{'id':_0x4f1504[_0xa9af('0x4b')]['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x455345,null))[_0xa9af('0x27')](function(_0x2943a5){if(_0x2943a5){_0x5a0cbc=_0x2943a5;_0x1d5983[_0xa9af('0x33')]=_['keys'](db['DeskField'][_0xa9af('0x2f')]);_0x1d5983[_0xa9af('0x34')]=_[_0xa9af('0x35')](_0x4f1504[_0xa9af('0x34')]);_0x1d5983[_0xa9af('0x36')]=_[_0xa9af('0x37')](_0x1d5983[_0xa9af('0x33')],_0x1d5983[_0xa9af('0x34')]);_0x13ece4[_0xa9af('0x39')]=_[_0xa9af('0x37')](_0x1d5983['model'],qs['fields'](_0x4f1504['query'][_0xa9af('0x38')]));_0x13ece4['attributes']=_0x13ece4[_0xa9af('0x39')][_0xa9af('0x44')]?_0x13ece4['attributes']:_0x1d5983[_0xa9af('0x33')];_0x13ece4[_0xa9af('0x3c')]=qs[_0xa9af('0x3d')](_0x4f1504[_0xa9af('0x34')]['sort']);_0x13ece4['where']=qs['filters'](_[_0xa9af('0x3f')](_0x4f1504[_0xa9af('0x34')],_0x1d5983[_0xa9af('0x36')]));if(_0x4f1504['query']['filter']){_0x13ece4['where']=_[_0xa9af('0x41')](_0x13ece4[_0xa9af('0x3e')],{'$or':_[_0xa9af('0x2d')](_0x13ece4['attributes'],function(_0x270b3f){var _0x400191={};_0x400191[_0x270b3f]={'$like':'%'+_0x4f1504[_0xa9af('0x34')]['filter']+'%'};return _0x400191;})});}_0x13ece4=_[_0xa9af('0x41')]({},_0x13ece4,_0x4f1504[_0xa9af('0x46')]);return _0x5a0cbc[_0xa9af('0x4f')](_0x13ece4);}})[_0xa9af('0x27')](function(_0x31973c){if(_0x31973c){_0x5101fe=_0x31973c[_0xa9af('0x44')];if(!_0x4f1504[_0xa9af('0x34')][_0xa9af('0x3a')]('nolimit')){_0x13ece4['limit']=qs['limit'](_0x4f1504['query'][_0xa9af('0x1e')]);_0x13ece4['offset']=qs[_0xa9af('0x1d')](_0x4f1504[_0xa9af('0x34')][_0xa9af('0x1d')]);}return _0x5a0cbc[_0xa9af('0x4f')](_0x13ece4);}})[_0xa9af('0x27')](function(_0x9a1f32){if(_0x9a1f32){return _0x9a1f32?{'count':_0x5101fe,'rows':_0x9a1f32}:null;}})[_0xa9af('0x27')](respondWithResult(_0x455345,null))[_0xa9af('0x48')](handleError(_0x455345,null));};exports[_0xa9af('0x50')]=function(_0x5ba67f,_0x5999cd,_0x4f2315){var _0x5bb53c={};var _0x4c1255={};var _0x15c588;var _0x1e49da;return db[_0xa9af('0x2e')][_0xa9af('0x4c')]({'where':{'id':_0x5ba67f[_0xa9af('0x4b')]['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x5999cd,null))['then'](function(_0x23fde3){if(_0x23fde3){_0x15c588=_0x23fde3;_0x4c1255[_0xa9af('0x33')]=_['keys'](db[_0xa9af('0x4d')][_0xa9af('0x2f')]);_0x4c1255['query']=_[_0xa9af('0x35')](_0x5ba67f[_0xa9af('0x34')]);_0x4c1255[_0xa9af('0x36')]=_[_0xa9af('0x37')](_0x4c1255[_0xa9af('0x33')],_0x4c1255['query']);_0x5bb53c[_0xa9af('0x39')]=_[_0xa9af('0x37')](_0x4c1255[_0xa9af('0x33')],qs[_0xa9af('0x38')](_0x5ba67f[_0xa9af('0x34')]['fields']));_0x5bb53c[_0xa9af('0x39')]=_0x5bb53c[_0xa9af('0x39')][_0xa9af('0x44')]?_0x5bb53c[_0xa9af('0x39')]:_0x4c1255['model'];_0x5bb53c[_0xa9af('0x3c')]=qs[_0xa9af('0x3d')](_0x5ba67f[_0xa9af('0x34')][_0xa9af('0x3d')]);_0x5bb53c['where']=qs[_0xa9af('0x36')](_[_0xa9af('0x3f')](_0x5ba67f[_0xa9af('0x34')],_0x4c1255[_0xa9af('0x36')]));if(_0x5ba67f['query'][_0xa9af('0x40')]){_0x5bb53c[_0xa9af('0x3e')]=_['merge'](_0x5bb53c[_0xa9af('0x3e')],{'$or':_[_0xa9af('0x2d')](_0x5bb53c[_0xa9af('0x39')],function(_0xb57d2c){var _0xab0f2a={};_0xab0f2a[_0xb57d2c]={'$like':'%'+_0x5ba67f[_0xa9af('0x34')][_0xa9af('0x40')]+'%'};return _0xab0f2a;})});}_0x5bb53c=_[_0xa9af('0x41')]({},_0x5bb53c,_0x5ba67f[_0xa9af('0x46')]);return _0x15c588['getDescriptions'](_0x5bb53c);}})['then'](function(_0x56846a){if(_0x56846a){_0x1e49da=_0x56846a['length'];if(!_0x5ba67f[_0xa9af('0x34')]['hasOwnProperty'](_0xa9af('0x3b'))){_0x5bb53c[_0xa9af('0x1e')]=qs[_0xa9af('0x1e')](_0x5ba67f[_0xa9af('0x34')][_0xa9af('0x1e')]);_0x5bb53c[_0xa9af('0x1d')]=qs[_0xa9af('0x1d')](_0x5ba67f[_0xa9af('0x34')][_0xa9af('0x1d')]);}return _0x15c588['getDescriptions'](_0x5bb53c);}})[_0xa9af('0x27')](function(_0x36e6fb){if(_0x36e6fb){return _0x36e6fb?{'count':_0x1e49da,'rows':_0x36e6fb}:null;}})[_0xa9af('0x27')](respondWithResult(_0x5999cd,null))['catch'](handleError(_0x5999cd,null));};exports[_0xa9af('0x51')]=function(_0x476765,_0x135bb7,_0xa8199e){var _0x488a7a={};var _0x4a8357={};var _0x16dbbb;var _0x5a82b6;return db[_0xa9af('0x2e')][_0xa9af('0x4c')]({'where':{'id':_0x476765['params']['id']}})[_0xa9af('0x27')](handleEntityNotFound(_0x135bb7,null))['then'](function(_0x575780){if(_0x575780){_0x16dbbb=_0x575780;_0x4a8357['model']=_['keys'](db['Tag'][_0xa9af('0x2f')]);_0x4a8357[_0xa9af('0x34')]=_['keys'](_0x476765[_0xa9af('0x34')]);_0x4a8357[_0xa9af('0x36')]=_[_0xa9af('0x37')](_0x4a8357['model'],_0x4a8357[_0xa9af('0x34')]);_0x488a7a[_0xa9af('0x39')]=_[_0xa9af('0x37')](_0x4a8357[_0xa9af('0x33')],qs[_0xa9af('0x38')](_0x476765['query'][_0xa9af('0x38')]));_0x488a7a['attributes']=_0x488a7a[_0xa9af('0x39')][_0xa9af('0x44')]?_0x488a7a[_0xa9af('0x39')]:_0x4a8357[_0xa9af('0x33')];_0x488a7a[_0xa9af('0x3c')]=qs[_0xa9af('0x3d')](_0x476765['query']['sort']);_0x488a7a[_0xa9af('0x3e')]=qs[_0xa9af('0x36')](_[_0xa9af('0x3f')](_0x476765['query'],_0x4a8357[_0xa9af('0x36')]));if(_0x476765[_0xa9af('0x34')][_0xa9af('0x40')]){_0x488a7a['where']=_[_0xa9af('0x41')](_0x488a7a[_0xa9af('0x3e')],{'$or':_[_0xa9af('0x2d')](_0x488a7a[_0xa9af('0x39')],function(_0x167d04){var _0x5c968a={};_0x5c968a[_0x167d04]={'$like':'%'+_0x476765[_0xa9af('0x34')][_0xa9af('0x40')]+'%'};return _0x5c968a;})});}_0x488a7a=_[_0xa9af('0x41')]({},_0x488a7a,_0x476765[_0xa9af('0x46')]);return _0x16dbbb[_0xa9af('0x51')](_0x488a7a);}})[_0xa9af('0x27')](function(_0x4816f4){if(_0x4816f4){_0x5a82b6=_0x4816f4[_0xa9af('0x44')];if(!_0x476765[_0xa9af('0x34')][_0xa9af('0x3a')]('nolimit')){_0x488a7a[_0xa9af('0x1e')]=qs[_0xa9af('0x1e')](_0x476765['query'][_0xa9af('0x1e')]);_0x488a7a[_0xa9af('0x1d')]=qs['offset'](_0x476765['query'][_0xa9af('0x1d')]);}return _0x16dbbb[_0xa9af('0x51')](_0x488a7a);}})[_0xa9af('0x27')](function(_0x2e100){if(_0x2e100){return _0x2e100?{'count':_0x5a82b6,'rows':_0x2e100}:null;}})[_0xa9af('0x27')](respondWithResult(_0x135bb7,null))[_0xa9af('0x48')](handleError(_0x135bb7,null));};exports[_0xa9af('0x52')]=function(_0x3e52ee,_0x42982e,_0x544f08){if(_0x3e52ee[_0xa9af('0x4a')]['id']){delete _0x3e52ee[_0xa9af('0x4a')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x3e52ee[_0xa9af('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42982e,null))[_0xa9af('0x27')](function(_0x5a02fb){if(_0x5a02fb){return _0x5a02fb[_0xa9af('0x52')](_0x3e52ee[_0xa9af('0x4a')][_0xa9af('0x53')]||[]);}return null;})[_0xa9af('0x27')](respondWithResult(_0x42982e,null))[_0xa9af('0x48')](handleError(_0x42982e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ec4793e..a947dd4 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 _0xc196=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x1edc64,_0x1aaad3){var _0x4cb4bb=function(_0x15f956){while(--_0x15f956){_0x1edc64['push'](_0x1edc64['shift']());}};_0x4cb4bb(++_0x1aaad3);}(_0xc196,0x1bc));var _0x6c19=function(_0x443d77,_0x34e687){_0x443d77=_0x443d77-0x0;var _0x132cc5=_0xc196[_0x443d77];return _0x132cc5;};'use strict';var _=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var logger=require(_0x6c19('0x2'))(_0x6c19('0x3'));var moment=require(_0x6c19('0x4'));var BPromise=require(_0x6c19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c19('0x6'));var config=require(_0x6c19('0x7'));var attributes=require(_0x6c19('0x8'));module[_0x6c19('0x9')]=function(_0x448488,_0x589fd3){return _0x448488[_0x6c19('0xa')](_0x6c19('0xb'),attributes,{'tableName':_0x6c19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cfa=['../../config/logger','../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash'];(function(_0x272cb2,_0x3d388f){var _0x3c7b14=function(_0x283e7e){while(--_0x283e7e){_0x272cb2['push'](_0x272cb2['shift']());}};_0x3c7b14(++_0x3d388f);}(_0x5cfa,0x12b));var _0xa5cf=function(_0xe59043,_0x2539c6){_0xe59043=_0xe59043-0x0;var _0x67e54=_0x5cfa[_0xe59043];return _0x67e54;};'use strict';var _=require(_0xa5cf('0x0'));var util=require('util');var logger=require(_0xa5cf('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa5cf('0x2'));var attributes=require(_0xa5cf('0x3'));module['exports']=function(_0x2d68a8,_0x38a403){return _0x2d68a8[_0xa5cf('0x4')]('DeskConfiguration',attributes,{'tableName':_0xa5cf('0x5'),'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 decd617..8a5b935 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 _0xfdbf=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x21268b,_0x530c67){var _0x31c8f4=function(_0x107af5){while(--_0x107af5){_0x21268b['push'](_0x21268b['shift']());}};_0x31c8f4(++_0x530c67);}(_0xfdbf,0xb5));var _0xffdb=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xfdbf[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xffdb('0x0'));var util=require(_0xffdb('0x1'));var moment=require(_0xffdb('0x2'));var BPromise=require('bluebird');var rs=require(_0xffdb('0x3'));var fs=require('fs');var Redis=require(_0xffdb('0x4'));var db=require(_0xffdb('0x5'))['db'];var utils=require(_0xffdb('0x6'));var logger=require('../../config/logger')(_0xffdb('0x7'));var config=require('../../config/environment');var jayson=require(_0xffdb('0x8'));var client=jayson[_0xffdb('0x9')][_0xffdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb05d77,_0x39c233,_0x1b024a){return new BPromise(function(_0xd4c378,_0x2e25cf){return client[_0xffdb('0xb')](_0xb05d77,_0x1b024a)[_0xffdb('0xc')](function(_0x2d5f34){logger[_0xffdb('0xd')](_0xffdb('0xe'),_0x39c233,_0xffdb('0xf'));logger[_0xffdb('0x10')](_0xffdb('0x11'),_0x39c233,'request\x20sent',JSON[_0xffdb('0x12')](_0x2d5f34));if(_0x2d5f34[_0xffdb('0x13')]){if(_0x2d5f34['error']['code']===0x1f4){logger[_0xffdb('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x39c233,_0x2d5f34['error'][_0xffdb('0x14')]);return _0x2e25cf(_0x2d5f34[_0xffdb('0x13')][_0xffdb('0x14')]);}logger[_0xffdb('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x39c233,_0x2d5f34['error'][_0xffdb('0x14')]);return _0xd4c378(_0x2d5f34[_0xffdb('0x13')]['message']);}else{logger[_0xffdb('0xd')](_0xffdb('0xe'),_0x39c233,_0xffdb('0xf'));_0xd4c378(_0x2d5f34[_0xffdb('0x15')]['message']);}})[_0xffdb('0x16')](function(_0x515e97){logger['error'](_0xffdb('0xe'),_0x39c233,_0x515e97);_0x2e25cf(_0x515e97);});});} \ No newline at end of file +var _0x3823=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x3823,0xb0));var _0x3382=function(_0x4e941c,_0x56a570){_0x4e941c=_0x4e941c-0x0;var _0x1ddd3c=_0x3823[_0x4e941c];return _0x1ddd3c;};'use strict';var _=require('lodash');var util=require(_0x3382('0x0'));var moment=require(_0x3382('0x1'));var BPromise=require(_0x3382('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3382('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3382('0x4'));var logger=require(_0x3382('0x5'))(_0x3382('0x6'));var config=require(_0x3382('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3382('0x8')][_0x3382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22edec,_0x40d699,_0xcc9ae6){return new BPromise(function(_0xb690b6,_0x3dd5bb){return client[_0x3382('0xa')](_0x22edec,_0xcc9ae6)[_0x3382('0xb')](function(_0xba6fb3){logger[_0x3382('0xc')](_0x3382('0xd'),_0x40d699,_0x3382('0xe'));logger[_0x3382('0xf')](_0x3382('0x10'),_0x40d699,_0x3382('0xe'),JSON['stringify'](_0xba6fb3));if(_0xba6fb3['error']){if(_0xba6fb3[_0x3382('0x11')][_0x3382('0x12')]===0x1f4){logger[_0x3382('0x11')](_0x3382('0xd'),_0x40d699,_0xba6fb3[_0x3382('0x11')][_0x3382('0x13')]);return _0x3dd5bb(_0xba6fb3['error']['message']);}logger[_0x3382('0x11')](_0x3382('0xd'),_0x40d699,_0xba6fb3[_0x3382('0x11')][_0x3382('0x13')]);return _0xb690b6(_0xba6fb3[_0x3382('0x11')][_0x3382('0x13')]);}else{logger[_0x3382('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x40d699,_0x3382('0xe'));_0xb690b6(_0xba6fb3['result'][_0x3382('0x13')]);}})[_0x3382('0x14')](function(_0x2e9361){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x40d699,_0x2e9361);_0x3dd5bb(_0x2e9361);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7b7f3bf..70ea41e 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 _0x3c12=['Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util','path','express'];(function(_0x5b9d68,_0x384d59){var _0x251da4=function(_0x4a5dca){while(--_0x4a5dca){_0x5b9d68['push'](_0x5b9d68['shift']());}};_0x251da4(++_0x384d59);}(_0x3c12,0x161));var _0x23c1=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x3c12[_0x15106b];return _0x521203;};'use strict';var multer=require(_0x23c1('0x0'));var util=require(_0x23c1('0x1'));var path=require(_0x23c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x23c1('0x3'));var router=express[_0x23c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x23c1('0x5'));var interaction=require(_0x23c1('0x6'));var config=require('../../config/environment');var controller=require(_0x23c1('0x7'));router[_0x23c1('0x8')]('/',auth[_0x23c1('0x9')](),controller[_0x23c1('0xa')]);router[_0x23c1('0x8')](_0x23c1('0xb'),auth['isAuthenticated'](),controller[_0x23c1('0xc')]);router[_0x23c1('0xd')]('/',auth[_0x23c1('0x9')](),controller[_0x23c1('0xe')]);router['put'](_0x23c1('0xb'),auth[_0x23c1('0x9')](),controller['update']);router[_0x23c1('0xf')](_0x23c1('0xb'),auth[_0x23c1('0x9')](),controller[_0x23c1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6c79=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','exports','multer','util','path'];(function(_0x7be23c,_0x368608){var _0x46b4f5=function(_0xc05c0f){while(--_0xc05c0f){_0x7be23c['push'](_0x7be23c['shift']());}};_0x46b4f5(++_0x368608);}(_0x6c79,0x184));var _0x96c7=function(_0x1f8184,_0x59e343){_0x1f8184=_0x1f8184-0x0;var _0x3e19d8=_0x6c79[_0x1f8184];return _0x3e19d8;};'use strict';var multer=require(_0x96c7('0x0'));var util=require(_0x96c7('0x1'));var path=require(_0x96c7('0x2'));var timeout=require(_0x96c7('0x3'));var express=require(_0x96c7('0x4'));var router=express['Router']();var fs_extra=require(_0x96c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96c7('0x6'));var config=require(_0x96c7('0x7'));var controller=require(_0x96c7('0x8'));router[_0x96c7('0x9')]('/',auth[_0x96c7('0xa')](),controller['index']);router[_0x96c7('0x9')](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller[_0x96c7('0xc')]);router[_0x96c7('0xd')]('/',auth['isAuthenticated'](),controller[_0x96c7('0xe')]);router[_0x96c7('0xf')](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller['update']);router['delete'](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller['destroy']);module[_0x96c7('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1a17d27..6337adc 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 _0x1582=['string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x4438fd,_0x598f9a){var _0x2044ec=function(_0x1a2bf8){while(--_0x1a2bf8){_0x4438fd['push'](_0x4438fd['shift']());}};_0x2044ec(++_0x598f9a);}(_0x1582,0x117));var _0x2158=function(_0x38b255,_0x3fd343){_0x38b255=_0x38b255-0x0;var _0x26f9bb=_0x1582[_0x38b255];return _0x26f9bb;};'use strict';var Sequelize=require(_0x2158('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x2158('0x1'),_0x2158('0x2'),_0x2158('0x3'),'keyValue',_0x2158('0x4')),'defaultValue':_0x2158('0x1')},'content':{'type':Sequelize[_0x2158('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2158('0x6')]('string','variable',_0x2158('0x3'))},'keyContent':{'type':Sequelize[_0x2158('0x5')]},'idField':{'type':Sequelize[_0x2158('0x5')]},'nameField':{'type':Sequelize[_0x2158('0x5')]},'customField':{'type':Sequelize[_0x2158('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa622=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa622,0x138));var _0x2a62=function(_0x48242d,_0x1faf90){_0x48242d=_0x48242d-0x0;var _0x2948e8=_0xa622[_0x48242d];return _0x2948e8;};'use strict';var Sequelize=require(_0x2a62('0x0'));module[_0x2a62('0x1')]={'type':{'type':Sequelize[_0x2a62('0x2')]('string',_0x2a62('0x3'),_0x2a62('0x4'),_0x2a62('0x5'),_0x2a62('0x6')),'defaultValue':_0x2a62('0x7')},'content':{'type':Sequelize[_0x2a62('0x8')]},'key':{'type':Sequelize[_0x2a62('0x8')]},'keyType':{'type':Sequelize[_0x2a62('0x2')]('string',_0x2a62('0x3'),_0x2a62('0x4'))},'keyContent':{'type':Sequelize[_0x2a62('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2a62('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a62('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8e5b1d7..1c15ca5 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 _0x0f9f=['merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick'];(function(_0x79c6de,_0x10de94){var _0x321a56=function(_0x2e313e){while(--_0x2e313e){_0x79c6de['push'](_0x79c6de['shift']());}};_0x321a56(++_0x10de94);}(_0x0f9f,0xae));var _0xf0f9=function(_0x8d68ce,_0x135a7f){_0x8d68ce=_0x8d68ce-0x0;var _0x2e1f64=_0x0f9f[_0x8d68ce];return _0x2e1f64;};'use strict';var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require(_0xf0f9('0x2'));var jsonpatch=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var moment=require(_0xf0f9('0x5'));var BPromise=require(_0xf0f9('0x6'));var Mustache=require(_0xf0f9('0x7'));var util=require(_0xf0f9('0x8'));var path=require(_0xf0f9('0x9'));var sox=require(_0xf0f9('0xa'));var csv=require('to-csv');var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xc'));var _=require('lodash');var squel=require(_0xf0f9('0xd'));var crypto=require(_0xf0f9('0xe'));var jsforce=require(_0xf0f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x10'));var querystring=require(_0xf0f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0f9('0x12'));var authService=require(_0xf0f9('0x13'));var qs=require(_0xf0f9('0x14'));var as=require(_0xf0f9('0x15'));var hardwareService=require(_0xf0f9('0x16'));var logger=require(_0xf0f9('0x17'))(_0xf0f9('0x18'));var utils=require(_0xf0f9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f9('0x1a'));var db=require(_0xf0f9('0x1b'))['db'];function respondWithStatusCode(_0xc23039,_0x458e1c){_0x458e1c=_0x458e1c||0xcc;return function(_0x5b0fa7){if(_0x5b0fa7){return _0xc23039[_0xf0f9('0x1c')](_0x458e1c);}return _0xc23039[_0xf0f9('0x1d')](_0x458e1c)['end']();};}function respondWithResult(_0x334c39,_0x519adf){_0x519adf=_0x519adf||0xc8;return function(_0x538864){if(_0x538864){return _0x334c39[_0xf0f9('0x1d')](_0x519adf)['json'](_0x538864);}};}function respondWithFilteredResult(_0x3e1587,_0x516717){return function(_0x3c23ec){if(_0x3c23ec){var _0x336483=typeof _0x516717[_0xf0f9('0x1e')]===_0xf0f9('0x1f')&&typeof _0x516717[_0xf0f9('0x20')]===_0xf0f9('0x1f');var _0x10dae6=_0x3c23ec['count'];var _0x44d248=_0x336483?0x0:_0x516717[_0xf0f9('0x1e')];var _0x43de16=_0x336483?_0x3c23ec[_0xf0f9('0x21')]:_0x516717[_0xf0f9('0x1e')]+_0x516717[_0xf0f9('0x20')];var _0x1765ad;if(_0x43de16>=_0x10dae6){_0x43de16=_0x10dae6;_0x1765ad=0xc8;}else{_0x1765ad=0xce;}_0x3e1587[_0xf0f9('0x1d')](_0x1765ad);return _0x3e1587['set'](_0xf0f9('0x22'),_0x44d248+'-'+_0x43de16+'/'+_0x10dae6)['json'](_0x3c23ec);}return null;};}function patchUpdates(_0x3664ff){return function(_0x510119){try{jsonpatch[_0xf0f9('0x23')](_0x510119,_0x3664ff,!![]);}catch(_0x1d5965){return BPromise[_0xf0f9('0x24')](_0x1d5965);}return _0x510119[_0xf0f9('0x25')]();};}function saveUpdates(_0xaff53c,_0x1b9740){return function(_0x49bddc){if(_0x49bddc){return _0x49bddc[_0xf0f9('0x26')](_0xaff53c)['then'](function(_0x2cb8f8){return _0x2cb8f8;});}return null;};}function removeEntity(_0x21dd05,_0x55ba89){return function(_0x217a15){if(_0x217a15){return _0x217a15[_0xf0f9('0x27')]()['then'](function(){_0x21dd05[_0xf0f9('0x1d')](0xcc)[_0xf0f9('0x28')]();});}};}function handleEntityNotFound(_0xa0b46e,_0x27defc){return function(_0x3ce34a){if(!_0x3ce34a){_0xa0b46e[_0xf0f9('0x1c')](0x194);}return _0x3ce34a;};}function handleError(_0x4c7c7c,_0x1849f0){_0x1849f0=_0x1849f0||0x1f4;return function(_0x4c31f2){logger[_0xf0f9('0x29')](_0x4c31f2[_0xf0f9('0x2a')]);if(_0x4c31f2[_0xf0f9('0x2b')]){delete _0x4c31f2[_0xf0f9('0x2b')];}_0x4c7c7c['status'](_0x1849f0)[_0xf0f9('0x2c')](_0x4c31f2);};}exports[_0xf0f9('0x2d')]=function(_0x477eb0,_0x5a435d){var _0x3bcd66={},_0x1cafc0={},_0x5957b1={'count':0x0,'rows':[]};var _0xfd5593=_['map'](db[_0xf0f9('0x2e')][_0xf0f9('0x2f')],function(_0x280681){return{'name':_0x280681[_0xf0f9('0x30')],'type':_0x280681[_0xf0f9('0x31')][_0xf0f9('0x32')]};});_0x1cafc0[_0xf0f9('0x33')]=_[_0xf0f9('0x34')](_0xfd5593,_0xf0f9('0x2b'));_0x1cafc0[_0xf0f9('0x35')]=_['keys'](_0x477eb0[_0xf0f9('0x35')]);_0x1cafc0[_0xf0f9('0x36')]=_['intersection'](_0x1cafc0['model'],_0x1cafc0[_0xf0f9('0x35')]);_0x3bcd66[_0xf0f9('0x37')]=_[_0xf0f9('0x38')](_0x1cafc0[_0xf0f9('0x33')],qs[_0xf0f9('0x39')](_0x477eb0[_0xf0f9('0x35')][_0xf0f9('0x39')]));_0x3bcd66['attributes']=_0x3bcd66[_0xf0f9('0x37')]['length']?_0x3bcd66[_0xf0f9('0x37')]:_0x1cafc0[_0xf0f9('0x33')];if(!_0x477eb0[_0xf0f9('0x35')]['hasOwnProperty'](_0xf0f9('0x3a'))){_0x3bcd66['limit']=qs[_0xf0f9('0x20')](_0x477eb0['query']['limit']);_0x3bcd66[_0xf0f9('0x1e')]=qs[_0xf0f9('0x1e')](_0x477eb0[_0xf0f9('0x35')][_0xf0f9('0x1e')]);}_0x3bcd66[_0xf0f9('0x3b')]=qs[_0xf0f9('0x3c')](_0x477eb0['query']['sort']);_0x3bcd66[_0xf0f9('0x3d')]=qs[_0xf0f9('0x36')](_[_0xf0f9('0x3e')](_0x477eb0['query'],_0x1cafc0['filters']),_0xfd5593);if(_0x477eb0[_0xf0f9('0x35')]['filter']){_0x3bcd66[_0xf0f9('0x3d')]=_[_0xf0f9('0x3f')](_0x3bcd66[_0xf0f9('0x3d')],{'$or':_[_0xf0f9('0x34')](_0xfd5593,function(_0x5b19b2){if(_0x5b19b2[_0xf0f9('0x31')]!==_0xf0f9('0x40')){var _0x11ea8f={};_0x11ea8f[_0x5b19b2[_0xf0f9('0x2b')]]={'$like':'%'+_0x477eb0['query']['filter']+'%'};return _0x11ea8f;}})});}_0x3bcd66=_['merge']({},_0x3bcd66,_0x477eb0[_0xf0f9('0x41')]);var _0x458810={'where':_0x3bcd66[_0xf0f9('0x3d')]};return db[_0xf0f9('0x2e')][_0xf0f9('0x21')](_0x458810)[_0xf0f9('0x42')](function(_0xcf598f){_0x5957b1['count']=_0xcf598f;if(_0x477eb0[_0xf0f9('0x35')][_0xf0f9('0x43')]){_0x3bcd66[_0xf0f9('0x44')]=[{'all':!![]}];}return db[_0xf0f9('0x2e')][_0xf0f9('0x45')](_0x3bcd66);})[_0xf0f9('0x42')](function(_0x4eb772){_0x5957b1[_0xf0f9('0x46')]=_0x4eb772;return _0x5957b1;})['then'](respondWithFilteredResult(_0x5a435d,_0x3bcd66))[_0xf0f9('0x47')](handleError(_0x5a435d,null));};exports[_0xf0f9('0x48')]=function(_0x290849,_0x181ed0){var _0x294e57={'raw':!![],'where':{'id':_0x290849[_0xf0f9('0x49')]['id']}},_0x574364={};_0x574364['model']=_[_0xf0f9('0x4a')](db[_0xf0f9('0x2e')][_0xf0f9('0x2f')]);_0x574364[_0xf0f9('0x35')]=_[_0xf0f9('0x4a')](_0x290849[_0xf0f9('0x35')]);_0x574364['filters']=_[_0xf0f9('0x38')](_0x574364[_0xf0f9('0x33')],_0x574364[_0xf0f9('0x35')]);_0x294e57['attributes']=_[_0xf0f9('0x38')](_0x574364['model'],qs[_0xf0f9('0x39')](_0x290849['query']['fields']));_0x294e57['attributes']=_0x294e57['attributes'][_0xf0f9('0x4b')]?_0x294e57['attributes']:_0x574364[_0xf0f9('0x33')];if(_0x290849[_0xf0f9('0x35')]['includeAll']){_0x294e57[_0xf0f9('0x44')]=[{'all':!![]}];}_0x294e57=_[_0xf0f9('0x3f')]({},_0x294e57,_0x290849[_0xf0f9('0x41')]);return db[_0xf0f9('0x2e')][_0xf0f9('0x4c')](_0x294e57)['then'](handleEntityNotFound(_0x181ed0,null))[_0xf0f9('0x42')](respondWithResult(_0x181ed0,null))[_0xf0f9('0x47')](handleError(_0x181ed0,null));};exports[_0xf0f9('0x4d')]=function(_0x3512d5,_0x5601ca){return db[_0xf0f9('0x2e')][_0xf0f9('0x4d')](_0x3512d5[_0xf0f9('0x4e')],{})[_0xf0f9('0x42')](respondWithResult(_0x5601ca,0xc9))[_0xf0f9('0x47')](handleError(_0x5601ca,null));};exports[_0xf0f9('0x26')]=function(_0x3dd389,_0x299cec){if(_0x3dd389[_0xf0f9('0x4e')]['id']){delete _0x3dd389[_0xf0f9('0x4e')]['id'];}return db[_0xf0f9('0x2e')][_0xf0f9('0x4c')]({'where':{'id':_0x3dd389['params']['id']}})[_0xf0f9('0x42')](handleEntityNotFound(_0x299cec,null))[_0xf0f9('0x42')](saveUpdates(_0x3dd389[_0xf0f9('0x4e')],null))['then'](respondWithResult(_0x299cec,null))[_0xf0f9('0x47')](handleError(_0x299cec,null));};exports[_0xf0f9('0x27')]=function(_0xa003e7,_0x1fe3b7){return db[_0xf0f9('0x2e')][_0xf0f9('0x4c')]({'where':{'id':_0xa003e7[_0xf0f9('0x49')]['id']}})[_0xf0f9('0x42')](handleEntityNotFound(_0x1fe3b7,null))['then'](removeEntity(_0x1fe3b7,null))[_0xf0f9('0x47')](handleError(_0x1fe3b7,null));}; \ No newline at end of file +var _0x720e=['options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x5e5421,_0x498c0f){var _0x5b1883=function(_0x46e4d4){while(--_0x46e4d4){_0x5e5421['push'](_0x5e5421['shift']());}};_0x5b1883(++_0x498c0f);}(_0x720e,0x18c));var _0xe720=function(_0x4c8833,_0x14e755){_0x4c8833=_0x4c8833-0x0;var _0x30df54=_0x720e[_0x4c8833];return _0x30df54;};'use strict';var emlformat=require(_0xe720('0x0'));var rimraf=require(_0xe720('0x1'));var zipdir=require(_0xe720('0x2'));var jsonpatch=require(_0xe720('0x3'));var rp=require(_0xe720('0x4'));var moment=require(_0xe720('0x5'));var BPromise=require(_0xe720('0x6'));var Mustache=require(_0xe720('0x7'));var util=require(_0xe720('0x8'));var path=require(_0xe720('0x9'));var sox=require('sox');var csv=require(_0xe720('0xa'));var ejs=require(_0xe720('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe720('0xc'));var squel=require('squel');var crypto=require(_0xe720('0xd'));var jsforce=require(_0xe720('0xe'));var deskjs=require(_0xe720('0xf'));var toCsv=require(_0xe720('0xa'));var querystring=require(_0xe720('0x10'));var Papa=require('papaparse');var Redis=require(_0xe720('0x11'));var authService=require(_0xe720('0x12'));var qs=require(_0xe720('0x13'));var as=require(_0xe720('0x14'));var hardwareService=require(_0xe720('0x15'));var logger=require('../../config/logger')(_0xe720('0x16'));var utils=require(_0xe720('0x17'));var config=require(_0xe720('0x18'));var licenseUtil=require(_0xe720('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e30f3,_0x15a7a9){_0x15a7a9=_0x15a7a9||0xcc;return function(_0x1c2022){if(_0x1c2022){return _0x9e30f3['sendStatus'](_0x15a7a9);}return _0x9e30f3['status'](_0x15a7a9)[_0xe720('0x1a')]();};}function respondWithResult(_0x2e0106,_0x15bc5e){_0x15bc5e=_0x15bc5e||0xc8;return function(_0x67bd20){if(_0x67bd20){return _0x2e0106[_0xe720('0x1b')](_0x15bc5e)[_0xe720('0x1c')](_0x67bd20);}};}function respondWithFilteredResult(_0x211ddf,_0x4f9340){return function(_0x110663){if(_0x110663){var _0x55a3ab=typeof _0x4f9340[_0xe720('0x1d')]===_0xe720('0x1e')&&typeof _0x4f9340[_0xe720('0x1f')]==='undefined';var _0x264767=_0x110663['count'];var _0x4009f4=_0x55a3ab?0x0:_0x4f9340[_0xe720('0x1d')];var _0x199567=_0x55a3ab?_0x110663[_0xe720('0x20')]:_0x4f9340[_0xe720('0x1d')]+_0x4f9340[_0xe720('0x1f')];var _0x46cbc6;if(_0x199567>=_0x264767){_0x199567=_0x264767;_0x46cbc6=0xc8;}else{_0x46cbc6=0xce;}_0x211ddf[_0xe720('0x1b')](_0x46cbc6);return _0x211ddf[_0xe720('0x21')](_0xe720('0x22'),_0x4009f4+'-'+_0x199567+'/'+_0x264767)[_0xe720('0x1c')](_0x110663);}return null;};}function patchUpdates(_0x59b6d0){return function(_0x237e4b){try{jsonpatch[_0xe720('0x23')](_0x237e4b,_0x59b6d0,!![]);}catch(_0xbdbb05){return BPromise[_0xe720('0x24')](_0xbdbb05);}return _0x237e4b['save']();};}function saveUpdates(_0x423a75,_0x29b3c7){return function(_0x3284ef){if(_0x3284ef){return _0x3284ef[_0xe720('0x25')](_0x423a75)['then'](function(_0x2a115b){return _0x2a115b;});}return null;};}function removeEntity(_0x390e32,_0xd88d67){return function(_0x4aa468){if(_0x4aa468){return _0x4aa468[_0xe720('0x26')]()[_0xe720('0x27')](function(){_0x390e32[_0xe720('0x1b')](0xcc)[_0xe720('0x1a')]();});}};}function handleEntityNotFound(_0x33bc3e,_0x255ace){return function(_0x4d6091){if(!_0x4d6091){_0x33bc3e[_0xe720('0x28')](0x194);}return _0x4d6091;};}function handleError(_0x562d1c,_0x149820){_0x149820=_0x149820||0x1f4;return function(_0x3f0b2e){logger['error'](_0x3f0b2e[_0xe720('0x29')]);if(_0x3f0b2e[_0xe720('0x2a')]){delete _0x3f0b2e['name'];}_0x562d1c['status'](_0x149820)[_0xe720('0x2b')](_0x3f0b2e);};}exports[_0xe720('0x2c')]=function(_0x46a906,_0x5513d1){var _0x1fbdaf={},_0x323547={},_0x42111b={'count':0x0,'rows':[]};var _0x343f50=_[_0xe720('0x2d')](db[_0xe720('0x2e')][_0xe720('0x2f')],function(_0x335f22){return{'name':_0x335f22['fieldName'],'type':_0x335f22[_0xe720('0x30')][_0xe720('0x31')]};});_0x323547[_0xe720('0x32')]=_[_0xe720('0x2d')](_0x343f50,_0xe720('0x2a'));_0x323547[_0xe720('0x33')]=_['keys'](_0x46a906[_0xe720('0x33')]);_0x323547[_0xe720('0x34')]=_[_0xe720('0x35')](_0x323547[_0xe720('0x32')],_0x323547['query']);_0x1fbdaf['attributes']=_['intersection'](_0x323547[_0xe720('0x32')],qs['fields'](_0x46a906['query'][_0xe720('0x36')]));_0x1fbdaf['attributes']=_0x1fbdaf[_0xe720('0x37')][_0xe720('0x38')]?_0x1fbdaf[_0xe720('0x37')]:_0x323547[_0xe720('0x32')];if(!_0x46a906[_0xe720('0x33')][_0xe720('0x39')](_0xe720('0x3a'))){_0x1fbdaf[_0xe720('0x1f')]=qs[_0xe720('0x1f')](_0x46a906[_0xe720('0x33')][_0xe720('0x1f')]);_0x1fbdaf['offset']=qs[_0xe720('0x1d')](_0x46a906[_0xe720('0x33')][_0xe720('0x1d')]);}_0x1fbdaf[_0xe720('0x3b')]=qs['sort'](_0x46a906[_0xe720('0x33')][_0xe720('0x3c')]);_0x1fbdaf['where']=qs[_0xe720('0x34')](_[_0xe720('0x3d')](_0x46a906[_0xe720('0x33')],_0x323547[_0xe720('0x34')]),_0x343f50);if(_0x46a906[_0xe720('0x33')][_0xe720('0x3e')]){_0x1fbdaf[_0xe720('0x3f')]=_[_0xe720('0x40')](_0x1fbdaf[_0xe720('0x3f')],{'$or':_[_0xe720('0x2d')](_0x343f50,function(_0x136f39){if(_0x136f39[_0xe720('0x30')]!==_0xe720('0x41')){var _0xc90a71={};_0xc90a71[_0x136f39[_0xe720('0x2a')]]={'$like':'%'+_0x46a906[_0xe720('0x33')]['filter']+'%'};return _0xc90a71;}})});}_0x1fbdaf=_[_0xe720('0x40')]({},_0x1fbdaf,_0x46a906[_0xe720('0x42')]);var _0x16163f={'where':_0x1fbdaf[_0xe720('0x3f')]};return db[_0xe720('0x2e')]['count'](_0x16163f)[_0xe720('0x27')](function(_0x3b204b){_0x42111b['count']=_0x3b204b;if(_0x46a906[_0xe720('0x33')][_0xe720('0x43')]){_0x1fbdaf[_0xe720('0x44')]=[{'all':!![]}];}return db[_0xe720('0x2e')][_0xe720('0x45')](_0x1fbdaf);})[_0xe720('0x27')](function(_0x44eaca){_0x42111b[_0xe720('0x46')]=_0x44eaca;return _0x42111b;})[_0xe720('0x27')](respondWithFilteredResult(_0x5513d1,_0x1fbdaf))[_0xe720('0x47')](handleError(_0x5513d1,null));};exports['show']=function(_0x54cf99,_0x1a6822){var _0x51bd22={'raw':!![],'where':{'id':_0x54cf99['params']['id']}},_0x3941e7={};_0x3941e7['model']=_[_0xe720('0x48')](db[_0xe720('0x2e')][_0xe720('0x2f')]);_0x3941e7[_0xe720('0x33')]=_[_0xe720('0x48')](_0x54cf99[_0xe720('0x33')]);_0x3941e7['filters']=_[_0xe720('0x35')](_0x3941e7['model'],_0x3941e7[_0xe720('0x33')]);_0x51bd22[_0xe720('0x37')]=_['intersection'](_0x3941e7[_0xe720('0x32')],qs['fields'](_0x54cf99[_0xe720('0x33')][_0xe720('0x36')]));_0x51bd22['attributes']=_0x51bd22['attributes'][_0xe720('0x38')]?_0x51bd22[_0xe720('0x37')]:_0x3941e7['model'];if(_0x54cf99[_0xe720('0x33')][_0xe720('0x43')]){_0x51bd22[_0xe720('0x44')]=[{'all':!![]}];}_0x51bd22=_[_0xe720('0x40')]({},_0x51bd22,_0x54cf99[_0xe720('0x42')]);return db['DeskField'][_0xe720('0x49')](_0x51bd22)[_0xe720('0x27')](handleEntityNotFound(_0x1a6822,null))[_0xe720('0x27')](respondWithResult(_0x1a6822,null))[_0xe720('0x47')](handleError(_0x1a6822,null));};exports[_0xe720('0x4a')]=function(_0x697ecf,_0x461292){return db['DeskField']['create'](_0x697ecf[_0xe720('0x4b')],{})[_0xe720('0x27')](respondWithResult(_0x461292,0xc9))['catch'](handleError(_0x461292,null));};exports[_0xe720('0x25')]=function(_0x434fa1,_0x54d150){if(_0x434fa1[_0xe720('0x4b')]['id']){delete _0x434fa1[_0xe720('0x4b')]['id'];}return db[_0xe720('0x2e')][_0xe720('0x49')]({'where':{'id':_0x434fa1[_0xe720('0x4c')]['id']}})[_0xe720('0x27')](handleEntityNotFound(_0x54d150,null))[_0xe720('0x27')](saveUpdates(_0x434fa1['body'],null))['then'](respondWithResult(_0x54d150,null))[_0xe720('0x47')](handleError(_0x54d150,null));};exports['destroy']=function(_0x291723,_0x375ac8){return db[_0xe720('0x2e')][_0xe720('0x49')]({'where':{'id':_0x291723['params']['id']}})[_0xe720('0x27')](handleEntityNotFound(_0x375ac8,null))[_0xe720('0x27')](removeEntity(_0x375ac8,null))[_0xe720('0x47')](handleError(_0x375ac8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 280f002..4dd74ed 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 _0x1816=['request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','util','api','moment','bluebird'];(function(_0x794014,_0x54d763){var _0x443048=function(_0x4e3a35){while(--_0x4e3a35){_0x794014['push'](_0x794014['shift']());}};_0x443048(++_0x54d763);}(_0x1816,0x1ea));var _0x6181=function(_0x1eafa9,_0x5791b6){_0x1eafa9=_0x1eafa9-0x0;var _0x7bb048=_0x1816[_0x1eafa9];return _0x7bb048;};'use strict';var _=require('lodash');var util=require(_0x6181('0x0'));var logger=require('../../config/logger')(_0x6181('0x1'));var moment=require(_0x6181('0x2'));var BPromise=require(_0x6181('0x3'));var rp=require(_0x6181('0x4'));var fs=require('fs');var path=require(_0x6181('0x5'));var rimraf=require(_0x6181('0x6'));var config=require(_0x6181('0x7'));var attributes=require('./intDeskField.attributes');module[_0x6181('0x8')]=function(_0x515968,_0x2be0e7){return _0x515968[_0x6181('0x9')](_0x6181('0xa'),attributes,{'tableName':_0x6181('0xb'),'paranoid':![],'indexes':[{'name':_0x6181('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa14a=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','lodash','../../config/logger','api','moment','request-promise'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa14a,0xe9));var _0xaa14=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xa14a[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xaa14('0x0'));var util=require('util');var logger=require(_0xaa14('0x1'))(_0xaa14('0x2'));var moment=require(_0xaa14('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa14('0x4'));var fs=require('fs');var path=require(_0xaa14('0x5'));var rimraf=require(_0xaa14('0x6'));var config=require(_0xaa14('0x7'));var attributes=require(_0xaa14('0x8'));module[_0xaa14('0x9')]=function(_0x3b71b2,_0x120c51){return _0x3b71b2[_0xaa14('0xa')](_0xaa14('0xb'),attributes,{'tableName':_0xaa14('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xaa14('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 928a88e..4e4a0c6 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 _0x1648=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s'];(function(_0x3a4cba,_0x369ccc){var _0x54ec19=function(_0x401eaf){while(--_0x401eaf){_0x3a4cba['push'](_0x3a4cba['shift']());}};_0x54ec19(++_0x369ccc);}(_0x1648,0x114));var _0x8164=function(_0x4a118b,_0x4ec38c){_0x4a118b=_0x4a118b-0x0;var _0x27c88e=_0x1648[_0x4a118b];return _0x27c88e;};'use strict';var _=require('lodash');var util=require(_0x8164('0x0'));var moment=require(_0x8164('0x1'));var BPromise=require(_0x8164('0x2'));var rs=require(_0x8164('0x3'));var fs=require('fs');var Redis=require(_0x8164('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8164('0x5'));var logger=require('../../config/logger')(_0x8164('0x6'));var config=require(_0x8164('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8164('0x8')][_0x8164('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x257092,_0x45b4b1,_0x56dec5){return new BPromise(function(_0x1460c2,_0x217338){return client[_0x8164('0xa')](_0x257092,_0x56dec5)['then'](function(_0x1177da){logger['info']('DeskField,\x20%s,\x20%s',_0x45b4b1,_0x8164('0xb'));logger[_0x8164('0xc')](_0x8164('0xd'),_0x45b4b1,_0x8164('0xb'),JSON[_0x8164('0xe')](_0x1177da));if(_0x1177da['error']){if(_0x1177da[_0x8164('0xf')][_0x8164('0x10')]===0x1f4){logger['error'](_0x8164('0x11'),_0x45b4b1,_0x1177da[_0x8164('0xf')][_0x8164('0x12')]);return _0x217338(_0x1177da[_0x8164('0xf')][_0x8164('0x12')]);}logger[_0x8164('0xf')](_0x8164('0x11'),_0x45b4b1,_0x1177da[_0x8164('0xf')][_0x8164('0x12')]);return _0x1460c2(_0x1177da[_0x8164('0xf')][_0x8164('0x12')]);}else{logger[_0x8164('0x13')](_0x8164('0x11'),_0x45b4b1,_0x8164('0xb'));_0x1460c2(_0x1177da['result'][_0x8164('0x12')]);}})[_0x8164('0x14')](function(_0x43c869){logger[_0x8164('0xf')](_0x8164('0x11'),_0x45b4b1,_0x43c869);_0x217338(_0x43c869);});});} \ No newline at end of file +var _0x2c2a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x372731,_0x1fc3e8){var _0x37dca6=function(_0x12e4d4){while(--_0x12e4d4){_0x372731['push'](_0x372731['shift']());}};_0x37dca6(++_0x1fc3e8);}(_0x2c2a,0x199));var _0xa2c2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c2a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa2c2('0x0'));var util=require('util');var moment=require(_0xa2c2('0x1'));var BPromise=require(_0xa2c2('0x2'));var rs=require(_0xa2c2('0x3'));var fs=require('fs');var Redis=require(_0xa2c2('0x4'));var db=require(_0xa2c2('0x5'))['db'];var utils=require(_0xa2c2('0x6'));var logger=require(_0xa2c2('0x7'))(_0xa2c2('0x8'));var config=require(_0xa2c2('0x9'));var jayson=require(_0xa2c2('0xa'));var client=jayson[_0xa2c2('0xb')][_0xa2c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dc214,_0x1afde3,_0x27f93f){return new BPromise(function(_0x2f2181,_0x385b9e){return client[_0xa2c2('0xd')](_0x5dc214,_0x27f93f)['then'](function(_0x1561ad){logger['info'](_0xa2c2('0xe'),_0x1afde3,_0xa2c2('0xf'));logger[_0xa2c2('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1afde3,_0xa2c2('0xf'),JSON[_0xa2c2('0x11')](_0x1561ad));if(_0x1561ad[_0xa2c2('0x12')]){if(_0x1561ad[_0xa2c2('0x12')]['code']===0x1f4){logger[_0xa2c2('0x12')](_0xa2c2('0xe'),_0x1afde3,_0x1561ad['error'][_0xa2c2('0x13')]);return _0x385b9e(_0x1561ad[_0xa2c2('0x12')][_0xa2c2('0x13')]);}logger[_0xa2c2('0x12')](_0xa2c2('0xe'),_0x1afde3,_0x1561ad[_0xa2c2('0x12')][_0xa2c2('0x13')]);return _0x2f2181(_0x1561ad[_0xa2c2('0x12')][_0xa2c2('0x13')]);}else{logger[_0xa2c2('0x14')](_0xa2c2('0xe'),_0x1afde3,_0xa2c2('0xf'));_0x2f2181(_0x1561ad[_0xa2c2('0x15')][_0xa2c2('0x13')]);}})[_0xa2c2('0x16')](function(_0x396086){logger[_0xa2c2('0x12')]('DeskField,\x20%s,\x20%s',_0x1afde3,_0x396086);_0x385b9e(_0x396086);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 53a61b8..d4ae2f5 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 _0x32a3=['index','/:id','isAuthenticated','/:id/fields','create','post','/:id/configurations','addConfiguration','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x3da728,_0x3e9f29){var _0xa531a9=function(_0x15a32e){while(--_0x15a32e){_0x3da728['push'](_0x3da728['shift']());}};_0xa531a9(++_0x3e9f29);}(_0x32a3,0xe7));var _0x332a=function(_0x4fd87c,_0x13b74c){_0x4fd87c=_0x4fd87c-0x0;var _0x1510bb=_0x32a3[_0x4fd87c];return _0x1510bb;};'use strict';var multer=require(_0x332a('0x0'));var util=require('util');var path=require(_0x332a('0x1'));var timeout=require(_0x332a('0x2'));var express=require(_0x332a('0x3'));var router=express[_0x332a('0x4')]();var fs_extra=require(_0x332a('0x5'));var auth=require(_0x332a('0x6'));var interaction=require(_0x332a('0x7'));var config=require(_0x332a('0x8'));var controller=require(_0x332a('0x9'));router[_0x332a('0xa')]('/',auth['isAuthenticated'](),controller[_0x332a('0xb')]);router[_0x332a('0xa')](_0x332a('0xc'),auth[_0x332a('0xd')](),controller['show']);router[_0x332a('0xa')]('/:id/configurations',auth[_0x332a('0xd')](),controller['getConfigurations']);router[_0x332a('0xa')](_0x332a('0xe'),auth[_0x332a('0xd')](),controller['getFields']);router['post']('/',auth[_0x332a('0xd')](),controller[_0x332a('0xf')]);router[_0x332a('0x10')](_0x332a('0x11'),auth[_0x332a('0xd')](),controller[_0x332a('0x12')]);router['put']('/:id',auth[_0x332a('0xd')](),controller[_0x332a('0x13')]);router[_0x332a('0x14')](_0x332a('0xc'),auth[_0x332a('0xd')](),controller['destroy']);module[_0x332a('0x15')]=router; \ No newline at end of file +var _0xc336=['../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getFields','create','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc336,0x144));var _0x6c33=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xc336[_0x202c61];return _0x540691;};'use strict';var multer=require(_0x6c33('0x0'));var util=require('util');var path=require(_0x6c33('0x1'));var timeout=require(_0x6c33('0x2'));var express=require(_0x6c33('0x3'));var router=express['Router']();var fs_extra=require(_0x6c33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6c33('0x5'));var config=require(_0x6c33('0x6'));var controller=require(_0x6c33('0x7'));router[_0x6c33('0x8')]('/',auth[_0x6c33('0x9')](),controller[_0x6c33('0xa')]);router[_0x6c33('0x8')](_0x6c33('0xb'),auth[_0x6c33('0x9')](),controller[_0x6c33('0xc')]);router[_0x6c33('0x8')]('/:id/configurations',auth[_0x6c33('0x9')](),controller['getConfigurations']);router[_0x6c33('0x8')]('/:id/fields',auth[_0x6c33('0x9')](),controller[_0x6c33('0xd')]);router['post']('/',auth[_0x6c33('0x9')](),controller[_0x6c33('0xe')]);router[_0x6c33('0xf')](_0x6c33('0x10'),auth['isAuthenticated'](),controller[_0x6c33('0x11')]);router[_0x6c33('0x12')]('/:id',auth[_0x6c33('0x9')](),controller[_0x6c33('0x13')]);router['delete'](_0x6c33('0xb'),auth['isAuthenticated'](),controller[_0x6c33('0x14')]);module[_0x6c33('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3298f02..a997f32 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 _0x254a=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x254a,0x138));var _0xa254=function(_0x2d6d0f,_0x3cf2a5){_0x2d6d0f=_0x2d6d0f-0x0;var _0xd2bee6=_0x254a[_0x2d6d0f];return _0xd2bee6;};'use strict';var Sequelize=require(_0xa254('0x0'));module[_0xa254('0x1')]={'name':{'type':Sequelize[_0xa254('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa254('0x2')]},'remoteUri':{'type':Sequelize[_0xa254('0x2')]},'tenantId':{'type':Sequelize[_0xa254('0x2')]},'clientId':{'type':Sequelize[_0xa254('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa254('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa254('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4553=['STRING','BOOLEAN','exports'];(function(_0x4d0353,_0x3fe980){var _0x1a0580=function(_0xa0b55a){while(--_0xa0b55a){_0x4d0353['push'](_0x4d0353['shift']());}};_0x1a0580(++_0x3fe980);}(_0x4553,0x1be));var _0x3455=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x4553[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module[_0x3455('0x0')]={'name':{'type':Sequelize[_0x3455('0x1')]},'username':{'type':Sequelize[_0x3455('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3455('0x1')]},'clientId':{'type':Sequelize[_0x3455('0x1')]},'clientSecret':{'type':Sequelize[_0x3455('0x1')]},'serverUrl':{'type':Sequelize[_0x3455('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3455('0x1')]},'modernAuthentication':{'type':Sequelize[_0x3455('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index be5a7bc..a6773fb 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 _0x672e=['actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','stack','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','name','send','index','map','Dynamics365Account','fieldName','type','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','create','body','find','params','destroy','findOne','Dynamics365Configuration','sort','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame'];(function(_0x15296c,_0x24126c){var _0x2a46a1=function(_0x119677){while(--_0x119677){_0x15296c['push'](_0x15296c['shift']());}};_0x2a46a1(++_0x24126c);}(_0x672e,0x1e2));var _0xe672=function(_0x232c55,_0x51d83d){_0x232c55=_0x232c55-0x0;var _0x1a4275=_0x672e[_0x232c55];return _0x1a4275;};'use strict';var rp=require(_0xe672('0x0'));var util=require('util');var _=require(_0xe672('0x1'));var qs=require(_0xe672('0x2'));var logger=require(_0xe672('0x3'))(_0xe672('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe672('0x5'));function respondWithResult(_0x5c0dc5,_0xe89db8){_0xe89db8=_0xe89db8||0xc8;return function(_0x251724){if(_0x251724){return _0x5c0dc5[_0xe672('0x6')](_0xe89db8)['json'](_0x251724);}};}function respondWithFilteredResult(_0x37c809,_0x15420d){return function(_0x36cc93){if(_0x36cc93){var _0x1781fc=typeof _0x15420d[_0xe672('0x7')]===_0xe672('0x8')&&typeof _0x15420d[_0xe672('0x9')]==='undefined';var _0x508c2b=_0x36cc93['count'];var _0xfc486c=_0x1781fc?0x0:_0x15420d[_0xe672('0x7')];var _0x5ceb7d=_0x1781fc?_0x36cc93[_0xe672('0xa')]:_0x15420d[_0xe672('0x7')]+_0x15420d['limit'];var _0x37885e;if(_0x5ceb7d>=_0x508c2b){_0x5ceb7d=_0x508c2b;_0x37885e=0xc8;}else{_0x37885e=0xce;}_0x37c809[_0xe672('0x6')](_0x37885e);return _0x37c809[_0xe672('0xb')](_0xe672('0xc'),_0xfc486c+'-'+_0x5ceb7d+'/'+_0x508c2b)[_0xe672('0xd')](_0x36cc93);}return null;};}function saveUpdates(_0x2f0e99){return function(_0x204ae1){if(_0x204ae1){return _0x204ae1[_0xe672('0xe')](_0x2f0e99)[_0xe672('0xf')](function(_0x1e58d7){return _0x1e58d7;});}return null;};}function removeEntity(_0x10918c){return function(_0x128a22){if(_0x128a22){return _0x128a22['destroy']()[_0xe672('0xf')](function(){_0x10918c[_0xe672('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x330789){return function(_0x4b74d5){if(!_0x4b74d5){_0x330789[_0xe672('0x10')](0x194);}return _0x4b74d5;};}function handleError(_0x2744dd,_0x2273b7){_0x2273b7=_0x2273b7||0x1f4;return function(_0x491989){logger['error'](_0x491989['stack']);if(_0x491989[_0xe672('0x11')]){delete _0x491989[_0xe672('0x11')];}_0x2744dd['status'](_0x2273b7)[_0xe672('0x12')](_0x491989);};}exports[_0xe672('0x13')]=function(_0x51abb5,_0x23628e){var _0x2935e0={},_0x1ef7f4={},_0x500b68={'count':0x0,'rows':[]};var _0x4b32e9=_[_0xe672('0x14')](db[_0xe672('0x15')]['rawAttributes'],function(_0x46775d){return{'name':_0x46775d[_0xe672('0x16')],'type':_0x46775d[_0xe672('0x17')]['key']};});_0x1ef7f4['model']=_[_0xe672('0x14')](_0x4b32e9,_0xe672('0x11'));_0x1ef7f4['query']=_[_0xe672('0x18')](_0x51abb5[_0xe672('0x19')]);_0x1ef7f4[_0xe672('0x1a')]=_['intersection'](_0x1ef7f4[_0xe672('0x1b')],_0x1ef7f4['query']);_0x2935e0[_0xe672('0x1c')]=_[_0xe672('0x1d')](_0x1ef7f4[_0xe672('0x1b')],qs[_0xe672('0x1e')](_0x51abb5[_0xe672('0x19')][_0xe672('0x1e')]));_0x2935e0[_0xe672('0x1c')]=_0x2935e0[_0xe672('0x1c')]['length']?_0x2935e0[_0xe672('0x1c')]:_0x1ef7f4[_0xe672('0x1b')];if(!_0x51abb5['query'][_0xe672('0x1f')](_0xe672('0x20'))){_0x2935e0['limit']=qs[_0xe672('0x9')](_0x51abb5[_0xe672('0x19')]['limit']);_0x2935e0[_0xe672('0x7')]=qs[_0xe672('0x7')](_0x51abb5[_0xe672('0x19')][_0xe672('0x7')]);}_0x2935e0['order']=qs['sort'](_0x51abb5[_0xe672('0x19')]['sort']);_0x2935e0[_0xe672('0x21')]=qs[_0xe672('0x1a')](_['pick'](_0x51abb5[_0xe672('0x19')],_0x1ef7f4['filters']),_0x4b32e9);if(_0x51abb5[_0xe672('0x19')][_0xe672('0x22')]){_0x2935e0[_0xe672('0x21')]=_[_0xe672('0x23')](_0x2935e0[_0xe672('0x21')],{'$or':_[_0xe672('0x14')](_0x4b32e9,function(_0x2e10b3){if(_0x2e10b3[_0xe672('0x17')]!==_0xe672('0x24')){var _0x24a8fa={};_0x24a8fa[_0x2e10b3[_0xe672('0x11')]]={'$like':'%'+_0x51abb5[_0xe672('0x19')][_0xe672('0x22')]+'%'};return _0x24a8fa;}})});}_0x2935e0=_[_0xe672('0x23')]({},_0x2935e0,_0x51abb5[_0xe672('0x25')]);var _0x598b88={'where':_0x2935e0['where']};return db[_0xe672('0x15')][_0xe672('0xa')](_0x598b88)['then'](function(_0x35a133){_0x500b68[_0xe672('0xa')]=_0x35a133;if(_0x51abb5['query'][_0xe672('0x26')]){_0x2935e0['include']=[{'all':!![]}];}return db[_0xe672('0x15')][_0xe672('0x27')](_0x2935e0);})[_0xe672('0xf')](function(_0x52e66e){_0x500b68[_0xe672('0x28')]=_0x52e66e;return _0x500b68;})[_0xe672('0xf')](respondWithFilteredResult(_0x23628e,_0x2935e0))[_0xe672('0x29')](handleError(_0x23628e,null));};exports[_0xe672('0x2a')]=function(_0x38d423,_0x26c01d){var _0x22b262={'raw':![],'where':{'id':_0x38d423['params']['id']}},_0x1cb460={};_0x1cb460['model']=_[_0xe672('0x18')](db[_0xe672('0x15')][_0xe672('0x2b')]);_0x1cb460['query']=_[_0xe672('0x18')](_0x38d423[_0xe672('0x19')]);_0x1cb460[_0xe672('0x1a')]=_[_0xe672('0x1d')](_0x1cb460[_0xe672('0x1b')],_0x1cb460['query']);_0x22b262['attributes']=_['intersection'](_0x1cb460['model'],qs['fields'](_0x38d423[_0xe672('0x19')]['fields']));_0x22b262[_0xe672('0x1c')]=_0x22b262[_0xe672('0x1c')][_0xe672('0x2c')]?_0x22b262['attributes']:_0x1cb460[_0xe672('0x1b')];if(_0x38d423[_0xe672('0x19')]['includeAll']){_0x22b262[_0xe672('0x2d')]=[{'all':!![]}];}_0x22b262=_[_0xe672('0x23')]({},_0x22b262,_0x38d423['options']);return db[_0xe672('0x15')]['find'](_0x22b262)[_0xe672('0xf')](handleEntityNotFound(_0x26c01d,null))[_0xe672('0xf')](respondWithResult(_0x26c01d,null))['catch'](handleError(_0x26c01d,null));};exports[_0xe672('0x2e')]=function(_0x1f01cf,_0x54b900){return db['Dynamics365Account'][_0xe672('0x2e')](_0x1f01cf[_0xe672('0x2f')],{})['then'](respondWithResult(_0x54b900,0xc9))[_0xe672('0x29')](handleError(_0x54b900,null));};exports[_0xe672('0xe')]=function(_0xfd3940,_0x2debd0){if(_0xfd3940[_0xe672('0x2f')]['id']){delete _0xfd3940[_0xe672('0x2f')]['id'];}return db[_0xe672('0x15')][_0xe672('0x30')]({'where':{'id':_0xfd3940[_0xe672('0x31')]['id']}})[_0xe672('0xf')](handleEntityNotFound(_0x2debd0,null))[_0xe672('0xf')](saveUpdates(_0xfd3940['body'],null))[_0xe672('0xf')](respondWithResult(_0x2debd0,null))[_0xe672('0x29')](handleError(_0x2debd0,null));};exports[_0xe672('0x32')]=function(_0x51e3dc,_0x3937b5){return db['Dynamics365Account'][_0xe672('0x30')]({'where':{'id':_0x51e3dc[_0xe672('0x31')]['id']}})['then'](handleEntityNotFound(_0x3937b5,null))[_0xe672('0xf')](removeEntity(_0x3937b5,null))[_0xe672('0x29')](handleError(_0x3937b5,null));};exports['getConfigurations']=function(_0x556098,_0x323c09){var _0x163d08={};var _0x599a66={};var _0x177570;var _0xd650c0;return db[_0xe672('0x15')][_0xe672('0x33')]({'where':{'id':_0x556098[_0xe672('0x31')]['id']}})['then'](handleEntityNotFound(_0x323c09,null))[_0xe672('0xf')](function(_0x3ef1ab){if(_0x3ef1ab){_0x177570=_0x3ef1ab;_0x599a66[_0xe672('0x1b')]=_['keys'](db[_0xe672('0x34')][_0xe672('0x2b')]);_0x599a66[_0xe672('0x19')]=_[_0xe672('0x18')](_0x556098[_0xe672('0x19')]);_0x599a66[_0xe672('0x1a')]=_[_0xe672('0x1d')](_0x599a66[_0xe672('0x1b')],_0x599a66['query']);_0x163d08[_0xe672('0x1c')]=_[_0xe672('0x1d')](_0x599a66[_0xe672('0x1b')],qs[_0xe672('0x1e')](_0x556098['query'][_0xe672('0x1e')]));_0x163d08[_0xe672('0x1c')]=_0x163d08[_0xe672('0x1c')]['length']?_0x163d08[_0xe672('0x1c')]:_0x599a66[_0xe672('0x1b')];_0x163d08['order']=qs[_0xe672('0x35')](_0x556098[_0xe672('0x19')][_0xe672('0x35')]);_0x163d08[_0xe672('0x21')]=qs['filters'](_[_0xe672('0x36')](_0x556098[_0xe672('0x19')],_0x599a66[_0xe672('0x1a')]));if(_0x556098[_0xe672('0x19')][_0xe672('0x22')]){_0x163d08[_0xe672('0x21')]=_[_0xe672('0x23')](_0x163d08[_0xe672('0x21')],{'$or':_['map'](_0x163d08[_0xe672('0x1c')],function(_0x57a5e7){var _0x467333={};_0x467333[_0x57a5e7]={'$like':'%'+_0x556098[_0xe672('0x19')][_0xe672('0x22')]+'%'};return _0x467333;})});}_0x163d08=_[_0xe672('0x23')]({},_0x163d08,_0x556098[_0xe672('0x25')]);return _0x177570[_0xe672('0x37')](_0x163d08);}})[_0xe672('0xf')](function(_0xeac7c){if(_0xeac7c){_0xd650c0=_0xeac7c[_0xe672('0x2c')];if(!_0x556098[_0xe672('0x19')][_0xe672('0x1f')](_0xe672('0x20'))){_0x163d08[_0xe672('0x9')]=qs[_0xe672('0x9')](_0x556098[_0xe672('0x19')][_0xe672('0x9')]);_0x163d08[_0xe672('0x7')]=qs['offset'](_0x556098[_0xe672('0x19')][_0xe672('0x7')]);}return _0x177570[_0xe672('0x37')](_0x163d08);}})[_0xe672('0xf')](function(_0x2dc066){if(_0x2dc066){return _0x2dc066?{'count':_0xd650c0,'rows':_0x2dc066}:null;}})[_0xe672('0xf')](respondWithResult(_0x323c09,null))[_0xe672('0x29')](handleError(_0x323c09,null));};exports[_0xe672('0x38')]=function(_0x50e132,_0x4c6793){if(_0x50e132[_0xe672('0x2f')]['id']){delete _0x50e132[_0xe672('0x2f')]['id'];}return db[_0xe672('0x15')]['findOne']({'where':{'id':_0x50e132[_0xe672('0x31')]['id']}})[_0xe672('0xf')](handleEntityNotFound(_0x4c6793,null))[_0xe672('0xf')](function(_0x4cb384){if(_0x4cb384){_0x50e132[_0xe672('0x2f')][_0xe672('0x39')]=_0x4cb384['id'];_0x50e132[_0xe672('0x2f')][_0xe672('0x3a')]=integrations[_0xe672('0x3b')](_0x50e132[_0xe672('0x2f')]['channel'],_0x50e132['body'][_0xe672('0x17')]);_0x50e132[_0xe672('0x2f')]['Descriptions']=integrations[_0xe672('0x3c')](_0x50e132[_0xe672('0x2f')]['channel'],_0x50e132[_0xe672('0x2f')][_0xe672('0x17')]);return db[_0xe672('0x34')]['create'](_0x50e132[_0xe672('0x2f')],{'include':[{'model':db[_0xe672('0x3d')],'as':_0xe672('0x3a')},{'model':db[_0xe672('0x3d')],'as':'Descriptions'}]});}return null;})[_0xe672('0xf')](respondWithResult(_0x4c6793,null))[_0xe672('0x29')](handleError(_0x4c6793,null));};function sanitizeRemoteUri(_0x5bfaac){var _0x5f238a=_0x5bfaac[_0xe672('0x3e')](-0x1);if(_0x5f238a==='/')return _0x5bfaac[_0xe672('0x3f')](0x0,_0x5bfaac[_0xe672('0x40')](_0x5f238a));return _0x5bfaac;}function getWebApiUrl(_0x35d6dd){return util['format'](_0xe672('0x41'),_0x35d6dd);}exports[_0xe672('0x42')]=function(_0xda1274,_0xc3181b){var _0x34af17=_0xda1274[_0xe672('0x19')][_0xe672('0x43')];var _0x48329f=_0x34af17===_0xe672('0x44')?_0xe672('0x45'):_0xe672('0x46');var _0x1b94bb='';var _0xe0beb9='';var _0x2542fe='';var _0x322998='';var _0x50753f='';var _0x5c113b='';var _0x399105='';var _0x24f268='';var _0x176aff=[_0xe672('0x47'),_0xe672('0x48'),_0xe672('0x49'),_0xe672('0x4a'),_0xe672('0x4b'),_0xe672('0x4c'),_0xe672('0x4d'),_0xe672('0x4e'),_0xe672('0x4f'),_0xe672('0x50')];var _0x1a582b=['accountidname',_0xe672('0x51'),_0xe672('0x52'),'billedserviceunits',_0xe672('0x53'),_0xe672('0x54'),'contractdetailidname',_0xe672('0x55'),_0xe672('0x56'),'createdbyexternalpartyyominame',_0xe672('0x57'),_0xe672('0x58'),'createdon',_0xe672('0x59'),_0xe672('0x5a'),_0xe672('0x5b'),_0xe672('0x5c'),_0xe672('0x5d'),_0xe672('0x5e'),'entitlementidname',_0xe672('0x5f'),'entityimage_url','escalatedon','exchangerate',_0xe672('0x60'),_0xe672('0x61'),_0xe672('0x62'),_0xe672('0x63'),_0xe672('0x64'),_0xe672('0x65'),_0xe672('0x66'),_0xe672('0x67'),_0xe672('0x68'),_0xe672('0x69'),'modifiedbyyominame',_0xe672('0x6a'),_0xe672('0x6b'),_0xe672('0x6c'),_0xe672('0x6d'),_0xe672('0x6e'),_0xe672('0x6f'),'onholdtime',_0xe672('0x70'),'owneridname',_0xe672('0x71'),_0xe672('0x72'),_0xe672('0x73'),_0xe672('0x74'),'primarycontactidyominame',_0xe672('0x75'),'productidname','productserialnumber',_0xe672('0x76'),_0xe672('0x77'),_0xe672('0x78'),'responsiblecontactidname',_0xe672('0x79'),_0xe672('0x7a'),_0xe672('0x7b'),'slaname',_0xe672('0x7c'),_0xe672('0x7d'),'statuscode','subjectidname','ticketnumber',_0xe672('0x7e'),_0xe672('0x7f'),_0xe672('0x80'),_0xe672('0x81'),'versionnumber'];var _0x333c29=_0x176aff[_0xe672('0x82')](_0x1a582b);return db[_0xe672('0x15')][_0xe672('0x33')]({'where':{'id':_0xda1274['params']['id']},'attributes':['id',_0xe672('0x83'),_0xe672('0x84'),_0xe672('0x85'),_0xe672('0x86'),_0xe672('0x87'),_0xe672('0x88'),_0xe672('0x89')],'include':[{'model':db[_0xe672('0x8a')],'as':_0xe672('0x8a'),'attributes':['id',_0xe672('0x8b'),_0xe672('0x8c')]}]})[_0xe672('0xf')](handleEntityNotFound(_0xc3181b,null))['then'](function(_0x313dcf){if(_0x313dcf){if(_0x313dcf[_0xe672('0x89')]){_0x313dcf['access_token']=_0x313dcf['CloudProvider']['data5'];_0x24f268=sanitizeRemoteUri(_0x313dcf[_0xe672('0x8a')][_0xe672('0x8c')]);_0x399105=getWebApiUrl(_0x24f268);return _0x313dcf;}_0x24f268=sanitizeRemoteUri(_0x313dcf[_0xe672('0x85')]);_0x399105=getWebApiUrl(_0x24f268);var _0x358332={'method':_0xe672('0x8d'),'uri':'https://login.microsoftonline.com/'+_0x313dcf[_0xe672('0x86')]+'/oauth2/token','form':{'client_id':_0x313dcf['clientId'],'resource':_0x24f268,'username':_0x313dcf[_0xe672('0x83')],'password':_0x313dcf[_0xe672('0x84')],'grant_type':_0xe672('0x84'),'client_secret':_0x313dcf[_0xe672('0x88')]},'json':!![]};return rp(_0x358332);}})[_0xe672('0xf')](function(_0x1a5ff3){_0x5c113b=_0x1a5ff3['access_token'];var _0x549d06={'method':'GET','uri':encodeURI(_0x399105+_0xe672('0x8e')+_0x48329f+'\x27'),'headers':{'Authorization':_0xe672('0x8f')+_0x5c113b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x549d06);})['then'](function(_0x52b532){var _0x3b5171=_0x52b532[_0xe672('0x90')][0x0];var _0x4d8001=_0x3b5171['MetadataId'];var _0x265d63={'method':_0xe672('0x91'),'uri':_0x399105+_0xe672('0x92')+_0x4d8001+_0xe672('0x93'),'headers':{'Authorization':'Bearer\x20'+_0x5c113b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x265d63);})['then'](function(_0x5cf32f){_0x1b94bb=_0x5cf32f;_0xe0beb9=_0x1b94bb[_0xe672('0x94')];_0xe0beb9=_[_0xe672('0x95')](_0xe0beb9,function(_0x4cdb68){return!_0x333c29[_0xe672('0x96')](_0x4cdb68[_0xe672('0x97')]);});var _0x449d41=[];var _0x3a5406=[];_0xe0beb9['forEach'](function(_0x25ec2c){if(_0x25ec2c[_0xe672('0x98')]){var _0xc6a96e=_0x25ec2c[_0xe672('0x98')]['substring'](_0x25ec2c['@odata.type']['lastIndexOf']('.')+0x1);if(_0xc6a96e===_0xe672('0x99')){_0x449d41[_0xe672('0x9a')](getSelectList(_0x399105,_0x34af17,_0x3a5406,_0x1b94bb[_0xe672('0x9b')],_0x25ec2c[_0xe672('0x9b')],_0x5c113b));}}});return Promise['all'](_0x449d41);})[_0xe672('0xf')](function(_0x17036d){_0x2542fe=_0x17036d[0x0];var _0x4435ac=[];var _0x19faff=[];_0xe0beb9[_0xe672('0x9c')](function(_0x574399){if(!_['isNil'](_0x574399[_0xe672('0x98')])){var _0x271708=_0x574399['@odata.type']['substring'](_0x574399[_0xe672('0x98')][_0xe672('0x40')]('.')+0x1);if(_0x271708===_0xe672('0x9d')){_0x4435ac['push'](getBooleanList(_0x399105,_0x34af17,_0x19faff,_0x1b94bb['MetadataId'],_0x574399[_0xe672('0x9b')],_0x5c113b));}}});return Promise['all'](_0x4435ac);})[_0xe672('0xf')](function(_0x106778){_0x322998=_0x106778[0x0];var _0x556e08=[];var _0x371abe=[];_0xe0beb9[_0xe672('0x9c')](function(_0x3dff4e){if(_0x3dff4e[_0xe672('0x98')]){var _0x11486=_0x3dff4e[_0xe672('0x98')][_0xe672('0x3f')](_0x3dff4e[_0xe672('0x98')]['lastIndexOf']('.')+0x1);if(_0x11486===_0xe672('0x9e')||_0x11486===_0xe672('0x9f')||_0x11486===_0xe672('0xa0')||_0x11486===_0xe672('0xa1')||_0x11486===_0xe672('0xa2')||_0x11486===_0xe672('0xa3')||_0x11486===_0xe672('0xa4')||_0x11486===_0xe672('0xa5')||_0x11486===_0xe672('0xa6')||_0x11486===_0xe672('0xa7')){_0x556e08[_0xe672('0x9a')](getInputList(_0x399105,_0x34af17,_0x11486,_0x371abe,_0x1b94bb[_0xe672('0x9b')],_0x3dff4e['MetadataId'],_0x5c113b));}}});return Promise['all'](_0x556e08);})['then'](function(_0x59232e){_0x50753f=_0x59232e[0x0];var _0xc945f7=_0x2542fe['concat'](_0x322998)[_0xe672('0x82')](_0x50753f);var _0x43d027={'count':_0xc945f7[_0xe672('0x2c')],'rows':_0xc945f7};return _0x43d027;})[_0xe672('0xf')](respondWithResult(_0xc3181b,null))[_0xe672('0x29')](function(_0x36fb7f){var _0x1a4864=_0xda1274['query'][_0xe672('0xa8')]?0x1f4:_0x36fb7f['statusCode']||0x1f4;logger['error'](_0x36fb7f[_0xe672('0xa9')]);delete _0x36fb7f[_0xe672('0x11')];if(_0x1a4864===0x191){_0x1a4864=0x190;}_0xc3181b[_0xe672('0x6')](_0x1a4864)[_0xe672('0x12')](_0xda1274['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x36fb7f[_0xe672('0xaa')]}:_0x36fb7f);});};function getSelectList(_0x363ec6,_0x5bcb29,_0x408676,_0x38d690,_0x1c1766,_0x1a2119){var _0x3d11e1={'method':_0xe672('0x91'),'uri':_0x363ec6+'EntityDefinitions('+_0x38d690+_0xe672('0xab')+_0x1c1766+_0xe672('0xac')+_0xe672('0xad'),'headers':{'Authorization':_0xe672('0x8f')+_0x1a2119,'If-None-Match':null,'OData-Version':_0xe672('0xae')},'json':!![]};return rp(_0x3d11e1)['then'](function(_0x355f2d){var _0x7ded30=[];var _0x2b0d72=_0x355f2d[_0xe672('0xaf')][_0xe672('0xb0')];_0x2b0d72[_0xe672('0x9c')](function(_0x5ee30d){_0x7ded30['push']({'name':_0x5ee30d[_0xe672('0xb1')][_0xe672('0xb2')][_0xe672('0xb1')],'value':String(_0x5ee30d[_0xe672('0xb3')])});});var _0x4bb574={'id':_0x5bcb29+'_'+_0x355f2d[_0xe672('0x97')],'name':_0x355f2d[_0xe672('0xb4')]['UserLocalizedLabel'][_0xe672('0xb1')],'custom':![],'options':_0x7ded30};_0x408676[_0xe672('0x9a')](_0x4bb574);return _0x408676;});}function getBooleanList(_0x228f23,_0xa22301,_0x19f745,_0x57bbf4,_0x14aa27,_0x299564){var _0x273e8a={'method':_0xe672('0x91'),'uri':_0x228f23+_0xe672('0x92')+_0x57bbf4+_0xe672('0xab')+_0x14aa27+_0xe672('0xb5'),'headers':{'Authorization':_0xe672('0x8f')+_0x299564,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x273e8a)[_0xe672('0xf')](function(_0x1a94a8){var _0x1b6d5a=[];_0x1b6d5a['push']({'name':_0x1a94a8[_0xe672('0xaf')][_0xe672('0xb6')]['Label']['UserLocalizedLabel'][_0xe672('0xb1')],'value':_0xe672('0xb7')},{'name':_0x1a94a8[_0xe672('0xaf')][_0xe672('0xb8')][_0xe672('0xb1')][_0xe672('0xb2')]['Label'],'value':_0xe672('0xb9')});var _0x5ca957={'id':_0xa22301+'_'+_0x1a94a8[_0xe672('0x97')],'name':_0x1a94a8[_0xe672('0xb4')][_0xe672('0xb2')][_0xe672('0xb1')],'custom':![],'options':_0x1b6d5a};_0x19f745['push'](_0x5ca957);return _0x19f745;});}function getInputList(_0x402ec7,_0x309eea,_0x55bc62,_0x11a042,_0x375648,_0x10326c,_0x2a07a4){var _0x265246={'method':'GET','uri':_0x402ec7+_0xe672('0x92')+_0x375648+_0xe672('0xab')+_0x10326c+_0xe672('0xba')+_0x55bc62+_0xe672('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x2a07a4,'If-None-Match':null,'OData-Version':_0xe672('0xae')},'json':!![]};return rp(_0x265246)[_0xe672('0xf')](function(_0x50f1c7){var _0x462e77={'id':_0x309eea+'_'+_0x50f1c7[_0xe672('0x97')],'name':_0x50f1c7[_0xe672('0xb4')][_0xe672('0xb2')]?_0x50f1c7[_0xe672('0xb4')]['UserLocalizedLabel']['Label']:_0x50f1c7[_0xe672('0x97')],'custom':![],'options':[]};_0x11a042['push'](_0x462e77);return _0x11a042;});} \ No newline at end of file +var _0xb49e=['filter','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','update','getConfigurations','Dynamics365Configuration','merge','options','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','emailaddress','entitlementidname','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','POST','/oauth2/token','clientId','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','LogicalName','@odata.type','PicklistAttributeMetadata','push','forEach','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','sendStatus','error','name','send','index','Dynamics365Account','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type'];(function(_0x5a3126,_0x46cdad){var _0x2eb593=function(_0x165981){while(--_0x165981){_0x5a3126['push'](_0x5a3126['shift']());}};_0x2eb593(++_0x46cdad);}(_0xb49e,0x84));var _0xeb49=function(_0x5e7bed,_0x2a3ea7){_0x5e7bed=_0x5e7bed-0x0;var _0x5b492e=_0xb49e[_0x5e7bed];return _0x5b492e;};'use strict';var rp=require(_0xeb49('0x0'));var util=require(_0xeb49('0x1'));var _=require(_0xeb49('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xeb49('0x3'))(_0xeb49('0x4'));var db=require(_0xeb49('0x5'))['db'];var integrations=require(_0xeb49('0x6'));function respondWithResult(_0x258d16,_0x4715d9){_0x4715d9=_0x4715d9||0xc8;return function(_0x2232a6){if(_0x2232a6){return _0x258d16[_0xeb49('0x7')](_0x4715d9)[_0xeb49('0x8')](_0x2232a6);}};}function respondWithFilteredResult(_0x2be28c,_0x1a6e30){return function(_0x366b45){if(_0x366b45){var _0x12973c=typeof _0x1a6e30[_0xeb49('0x9')]==='undefined'&&typeof _0x1a6e30[_0xeb49('0xa')]===_0xeb49('0xb');var _0x120b5f=_0x366b45[_0xeb49('0xc')];var _0x383293=_0x12973c?0x0:_0x1a6e30[_0xeb49('0x9')];var _0x339113=_0x12973c?_0x366b45[_0xeb49('0xc')]:_0x1a6e30[_0xeb49('0x9')]+_0x1a6e30[_0xeb49('0xa')];var _0x1f2e84;if(_0x339113>=_0x120b5f){_0x339113=_0x120b5f;_0x1f2e84=0xc8;}else{_0x1f2e84=0xce;}_0x2be28c[_0xeb49('0x7')](_0x1f2e84);return _0x2be28c[_0xeb49('0xd')](_0xeb49('0xe'),_0x383293+'-'+_0x339113+'/'+_0x120b5f)[_0xeb49('0x8')](_0x366b45);}return null;};}function saveUpdates(_0x2a973d){return function(_0x91cbbb){if(_0x91cbbb){return _0x91cbbb['update'](_0x2a973d)[_0xeb49('0xf')](function(_0xe95367){return _0xe95367;});}return null;};}function removeEntity(_0x5a18d6){return function(_0x596612){if(_0x596612){return _0x596612[_0xeb49('0x10')]()[_0xeb49('0xf')](function(){_0x5a18d6[_0xeb49('0x7')](0xcc)[_0xeb49('0x11')]();});}};}function handleEntityNotFound(_0x2cee27){return function(_0x3ca756){if(!_0x3ca756){_0x2cee27[_0xeb49('0x12')](0x194);}return _0x3ca756;};}function handleError(_0x520da9,_0x10ad5d){_0x10ad5d=_0x10ad5d||0x1f4;return function(_0x1ea69f){logger[_0xeb49('0x13')](_0x1ea69f['stack']);if(_0x1ea69f[_0xeb49('0x14')]){delete _0x1ea69f[_0xeb49('0x14')];}_0x520da9[_0xeb49('0x7')](_0x10ad5d)[_0xeb49('0x15')](_0x1ea69f);};}exports[_0xeb49('0x16')]=function(_0x1bff6d,_0x8357c9){var _0x13c6eb={},_0x4d2628={},_0x1baafa={'count':0x0,'rows':[]};var _0x46f8d9=_['map'](db[_0xeb49('0x17')]['rawAttributes'],function(_0x492063){return{'name':_0x492063[_0xeb49('0x18')],'type':_0x492063['type'][_0xeb49('0x19')]};});_0x4d2628[_0xeb49('0x1a')]=_[_0xeb49('0x1b')](_0x46f8d9,'name');_0x4d2628[_0xeb49('0x1c')]=_[_0xeb49('0x1d')](_0x1bff6d['query']);_0x4d2628[_0xeb49('0x1e')]=_[_0xeb49('0x1f')](_0x4d2628['model'],_0x4d2628[_0xeb49('0x1c')]);_0x13c6eb[_0xeb49('0x20')]=_[_0xeb49('0x1f')](_0x4d2628['model'],qs[_0xeb49('0x21')](_0x1bff6d[_0xeb49('0x1c')][_0xeb49('0x21')]));_0x13c6eb[_0xeb49('0x20')]=_0x13c6eb[_0xeb49('0x20')][_0xeb49('0x22')]?_0x13c6eb['attributes']:_0x4d2628['model'];if(!_0x1bff6d[_0xeb49('0x1c')][_0xeb49('0x23')](_0xeb49('0x24'))){_0x13c6eb[_0xeb49('0xa')]=qs[_0xeb49('0xa')](_0x1bff6d[_0xeb49('0x1c')][_0xeb49('0xa')]);_0x13c6eb[_0xeb49('0x9')]=qs[_0xeb49('0x9')](_0x1bff6d[_0xeb49('0x1c')][_0xeb49('0x9')]);}_0x13c6eb[_0xeb49('0x25')]=qs[_0xeb49('0x26')](_0x1bff6d['query'][_0xeb49('0x26')]);_0x13c6eb[_0xeb49('0x27')]=qs[_0xeb49('0x1e')](_[_0xeb49('0x28')](_0x1bff6d['query'],_0x4d2628['filters']),_0x46f8d9);if(_0x1bff6d[_0xeb49('0x1c')]['filter']){_0x13c6eb[_0xeb49('0x27')]=_['merge'](_0x13c6eb[_0xeb49('0x27')],{'$or':_['map'](_0x46f8d9,function(_0x3d47f4){if(_0x3d47f4[_0xeb49('0x29')]!=='VIRTUAL'){var _0x551636={};_0x551636[_0x3d47f4[_0xeb49('0x14')]]={'$like':'%'+_0x1bff6d[_0xeb49('0x1c')][_0xeb49('0x2a')]+'%'};return _0x551636;}})});}_0x13c6eb=_['merge']({},_0x13c6eb,_0x1bff6d['options']);var _0x7c2cc2={'where':_0x13c6eb[_0xeb49('0x27')]};return db[_0xeb49('0x17')][_0xeb49('0xc')](_0x7c2cc2)[_0xeb49('0xf')](function(_0x50999a){_0x1baafa['count']=_0x50999a;if(_0x1bff6d['query'][_0xeb49('0x2b')]){_0x13c6eb['include']=[{'all':!![]}];}return db[_0xeb49('0x17')][_0xeb49('0x2c')](_0x13c6eb);})[_0xeb49('0xf')](function(_0x5e4964){_0x1baafa[_0xeb49('0x2d')]=_0x5e4964;return _0x1baafa;})[_0xeb49('0xf')](respondWithFilteredResult(_0x8357c9,_0x13c6eb))[_0xeb49('0x2e')](handleError(_0x8357c9,null));};exports['show']=function(_0x557c8e,_0xd06a83){var _0xe4fda2={'raw':![],'where':{'id':_0x557c8e[_0xeb49('0x2f')]['id']}},_0x199415={};_0x199415[_0xeb49('0x1a')]=_[_0xeb49('0x1d')](db[_0xeb49('0x17')][_0xeb49('0x30')]);_0x199415[_0xeb49('0x1c')]=_[_0xeb49('0x1d')](_0x557c8e['query']);_0x199415[_0xeb49('0x1e')]=_[_0xeb49('0x1f')](_0x199415[_0xeb49('0x1a')],_0x199415['query']);_0xe4fda2[_0xeb49('0x20')]=_['intersection'](_0x199415[_0xeb49('0x1a')],qs['fields'](_0x557c8e['query'][_0xeb49('0x21')]));_0xe4fda2['attributes']=_0xe4fda2[_0xeb49('0x20')][_0xeb49('0x22')]?_0xe4fda2[_0xeb49('0x20')]:_0x199415['model'];if(_0x557c8e[_0xeb49('0x1c')][_0xeb49('0x2b')]){_0xe4fda2[_0xeb49('0x31')]=[{'all':!![]}];}_0xe4fda2=_['merge']({},_0xe4fda2,_0x557c8e['options']);return db[_0xeb49('0x17')][_0xeb49('0x32')](_0xe4fda2)[_0xeb49('0xf')](handleEntityNotFound(_0xd06a83,null))['then'](respondWithResult(_0xd06a83,null))[_0xeb49('0x2e')](handleError(_0xd06a83,null));};exports[_0xeb49('0x33')]=function(_0x5ea88f,_0x5131ad){return db[_0xeb49('0x17')][_0xeb49('0x33')](_0x5ea88f[_0xeb49('0x34')],{})[_0xeb49('0xf')](respondWithResult(_0x5131ad,0xc9))['catch'](handleError(_0x5131ad,null));};exports[_0xeb49('0x35')]=function(_0x2a8008,_0x5de81c){if(_0x2a8008[_0xeb49('0x34')]['id']){delete _0x2a8008[_0xeb49('0x34')]['id'];}return db[_0xeb49('0x17')]['find']({'where':{'id':_0x2a8008[_0xeb49('0x2f')]['id']}})[_0xeb49('0xf')](handleEntityNotFound(_0x5de81c,null))[_0xeb49('0xf')](saveUpdates(_0x2a8008[_0xeb49('0x34')],null))['then'](respondWithResult(_0x5de81c,null))[_0xeb49('0x2e')](handleError(_0x5de81c,null));};exports[_0xeb49('0x10')]=function(_0x52fa0e,_0xd875dd){return db[_0xeb49('0x17')][_0xeb49('0x32')]({'where':{'id':_0x52fa0e['params']['id']}})[_0xeb49('0xf')](handleEntityNotFound(_0xd875dd,null))[_0xeb49('0xf')](removeEntity(_0xd875dd,null))[_0xeb49('0x2e')](handleError(_0xd875dd,null));};exports[_0xeb49('0x36')]=function(_0x26ad13,_0x48ab48){var _0x21b553={};var _0x40b6b5={};var _0x5eac45;var _0x7c46ea;return db['Dynamics365Account']['findOne']({'where':{'id':_0x26ad13[_0xeb49('0x2f')]['id']}})[_0xeb49('0xf')](handleEntityNotFound(_0x48ab48,null))[_0xeb49('0xf')](function(_0x4b3954){if(_0x4b3954){_0x5eac45=_0x4b3954;_0x40b6b5['model']=_[_0xeb49('0x1d')](db[_0xeb49('0x37')][_0xeb49('0x30')]);_0x40b6b5[_0xeb49('0x1c')]=_[_0xeb49('0x1d')](_0x26ad13['query']);_0x40b6b5['filters']=_['intersection'](_0x40b6b5[_0xeb49('0x1a')],_0x40b6b5[_0xeb49('0x1c')]);_0x21b553[_0xeb49('0x20')]=_[_0xeb49('0x1f')](_0x40b6b5[_0xeb49('0x1a')],qs[_0xeb49('0x21')](_0x26ad13[_0xeb49('0x1c')]['fields']));_0x21b553[_0xeb49('0x20')]=_0x21b553[_0xeb49('0x20')]['length']?_0x21b553[_0xeb49('0x20')]:_0x40b6b5[_0xeb49('0x1a')];_0x21b553[_0xeb49('0x25')]=qs[_0xeb49('0x26')](_0x26ad13['query']['sort']);_0x21b553[_0xeb49('0x27')]=qs['filters'](_[_0xeb49('0x28')](_0x26ad13[_0xeb49('0x1c')],_0x40b6b5[_0xeb49('0x1e')]));if(_0x26ad13['query'][_0xeb49('0x2a')]){_0x21b553[_0xeb49('0x27')]=_[_0xeb49('0x38')](_0x21b553[_0xeb49('0x27')],{'$or':_[_0xeb49('0x1b')](_0x21b553[_0xeb49('0x20')],function(_0x58ab73){var _0x37e168={};_0x37e168[_0x58ab73]={'$like':'%'+_0x26ad13[_0xeb49('0x1c')]['filter']+'%'};return _0x37e168;})});}_0x21b553=_[_0xeb49('0x38')]({},_0x21b553,_0x26ad13[_0xeb49('0x39')]);return _0x5eac45['getConfigurations'](_0x21b553);}})[_0xeb49('0xf')](function(_0x59c6a3){if(_0x59c6a3){_0x7c46ea=_0x59c6a3['length'];if(!_0x26ad13['query'][_0xeb49('0x23')](_0xeb49('0x24'))){_0x21b553[_0xeb49('0xa')]=qs[_0xeb49('0xa')](_0x26ad13[_0xeb49('0x1c')][_0xeb49('0xa')]);_0x21b553[_0xeb49('0x9')]=qs[_0xeb49('0x9')](_0x26ad13[_0xeb49('0x1c')][_0xeb49('0x9')]);}return _0x5eac45['getConfigurations'](_0x21b553);}})['then'](function(_0x1ec832){if(_0x1ec832){return _0x1ec832?{'count':_0x7c46ea,'rows':_0x1ec832}:null;}})['then'](respondWithResult(_0x48ab48,null))[_0xeb49('0x2e')](handleError(_0x48ab48,null));};exports['addConfiguration']=function(_0x1072c9,_0x3efe22){if(_0x1072c9[_0xeb49('0x34')]['id']){delete _0x1072c9[_0xeb49('0x34')]['id'];}return db[_0xeb49('0x17')][_0xeb49('0x3a')]({'where':{'id':_0x1072c9[_0xeb49('0x2f')]['id']}})[_0xeb49('0xf')](handleEntityNotFound(_0x3efe22,null))[_0xeb49('0xf')](function(_0x199653){if(_0x199653){_0x1072c9[_0xeb49('0x34')]['AccountId']=_0x199653['id'];_0x1072c9['body'][_0xeb49('0x3b')]=integrations[_0xeb49('0x3c')](_0x1072c9[_0xeb49('0x34')]['channel'],_0x1072c9[_0xeb49('0x34')][_0xeb49('0x29')]);_0x1072c9[_0xeb49('0x34')][_0xeb49('0x3d')]=integrations[_0xeb49('0x3e')](_0x1072c9['body'][_0xeb49('0x3f')],_0x1072c9['body'][_0xeb49('0x29')]);return db[_0xeb49('0x37')][_0xeb49('0x33')](_0x1072c9['body'],{'include':[{'model':db[_0xeb49('0x40')],'as':_0xeb49('0x3b')},{'model':db[_0xeb49('0x40')],'as':_0xeb49('0x3d')}]});}return null;})[_0xeb49('0xf')](respondWithResult(_0x3efe22,null))[_0xeb49('0x2e')](handleError(_0x3efe22,null));};function sanitizeRemoteUri(_0x5a87af){var _0x5e813f=_0x5a87af['slice'](-0x1);if(_0x5e813f==='/')return _0x5a87af[_0xeb49('0x41')](0x0,_0x5a87af[_0xeb49('0x42')](_0x5e813f));return _0x5a87af;}function getWebApiUrl(_0x50afc3){return util[_0xeb49('0x43')](_0xeb49('0x44'),_0x50afc3);}exports[_0xeb49('0x45')]=function(_0x19b6ce,_0x54f329){var _0x4ef48e=_0x19b6ce['query'][_0xeb49('0x46')];var _0x40aeb2=_0x4ef48e===_0xeb49('0x47')?_0xeb49('0x48'):_0xeb49('0x49');var _0x3988c8='';var _0x26645f='';var _0x5c06ac='';var _0x563604='';var _0x59796d='';var _0x21a36f='';var _0x53fbd2='';var _0x58b4ba='';var _0x34498d=['title','description',_0xeb49('0x4a'),_0xeb49('0x4b'),_0xeb49('0x4c'),_0xeb49('0x4d'),_0xeb49('0x4e'),'regardingobjectid','directioncode',_0xeb49('0x4f')];var _0xe86771=['accountidname',_0xeb49('0x50'),_0xeb49('0x51'),'billedserviceunits','contactidname',_0xeb49('0x52'),'contractdetailidname',_0xeb49('0x53'),_0xeb49('0x54'),_0xeb49('0x55'),_0xeb49('0x56'),_0xeb49('0x57'),'createdon',_0xeb49('0x58'),'createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame',_0xeb49('0x59'),_0xeb49('0x5a'),'entityimage_timestamp','entityimage_url','escalatedon',_0xeb49('0x5b'),'firstresponsebykpiidname',_0xeb49('0x5c'),'importsequencenumber',_0xeb49('0x5d'),_0xeb49('0x5e'),_0xeb49('0x5f'),_0xeb49('0x60'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xeb49('0x61'),'modifiedbyyominame',_0xeb49('0x62'),_0xeb49('0x63'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xeb49('0x64'),'numberofchildincidents',_0xeb49('0x65'),_0xeb49('0x66'),_0xeb49('0x67'),_0xeb49('0x68'),_0xeb49('0x69'),_0xeb49('0x6a'),_0xeb49('0x6b'),_0xeb49('0x6c'),_0xeb49('0x6d'),_0xeb49('0x6e'),_0xeb49('0x6f'),'resolveby',_0xeb49('0x70'),'responseby',_0xeb49('0x71'),'responsiblecontactidyominame','sentimentvalue',_0xeb49('0x72'),_0xeb49('0x73'),_0xeb49('0x74'),_0xeb49('0x75'),_0xeb49('0x76'),_0xeb49('0x77'),_0xeb49('0x78'),'timezoneruleversionnumber',_0xeb49('0x79'),'traversedpath',_0xeb49('0x7a'),_0xeb49('0x7b')];var _0x3ba500=_0x34498d[_0xeb49('0x7c')](_0xe86771);return db[_0xeb49('0x17')]['findOne']({'where':{'id':_0x19b6ce[_0xeb49('0x2f')]['id']},'attributes':['id',_0xeb49('0x7d'),_0xeb49('0x7e'),_0xeb49('0x7f'),_0xeb49('0x80'),'clientId',_0xeb49('0x81'),'modernAuthentication'],'include':[{'model':db[_0xeb49('0x82')],'as':_0xeb49('0x82'),'attributes':['id',_0xeb49('0x83'),_0xeb49('0x84')]}]})[_0xeb49('0xf')](handleEntityNotFound(_0x54f329,null))[_0xeb49('0xf')](function(_0x3cafaf){if(_0x3cafaf){if(_0x3cafaf[_0xeb49('0x85')]){_0x3cafaf[_0xeb49('0x86')]=_0x3cafaf['CloudProvider']['data5'];_0x58b4ba=sanitizeRemoteUri(_0x3cafaf['CloudProvider']['data7']);_0x53fbd2=getWebApiUrl(_0x58b4ba);return _0x3cafaf;}_0x58b4ba=sanitizeRemoteUri(_0x3cafaf[_0xeb49('0x7f')]);_0x53fbd2=getWebApiUrl(_0x58b4ba);var _0x55d4d2={'method':_0xeb49('0x87'),'uri':'https://login.microsoftonline.com/'+_0x3cafaf[_0xeb49('0x80')]+_0xeb49('0x88'),'form':{'client_id':_0x3cafaf[_0xeb49('0x89')],'resource':_0x58b4ba,'username':_0x3cafaf['username'],'password':_0x3cafaf[_0xeb49('0x7e')],'grant_type':_0xeb49('0x7e'),'client_secret':_0x3cafaf[_0xeb49('0x81')]},'json':!![]};return rp(_0x55d4d2);}})[_0xeb49('0xf')](function(_0x226cbf){_0x21a36f=_0x226cbf[_0xeb49('0x86')];var _0xfb4161={'method':_0xeb49('0x8a'),'uri':encodeURI(_0x53fbd2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x40aeb2+'\x27'),'headers':{'Authorization':_0xeb49('0x8b')+_0x21a36f,'If-None-Match':null,'OData-Version':_0xeb49('0x8c')},'json':!![]};return rp(_0xfb4161);})[_0xeb49('0xf')](function(_0x790c0a){var _0x558d40=_0x790c0a[_0xeb49('0x8d')][0x0];var _0x2351f6=_0x558d40[_0xeb49('0x8e')];var _0x18729d={'method':_0xeb49('0x8a'),'uri':_0x53fbd2+_0xeb49('0x8f')+_0x2351f6+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xeb49('0x8b')+_0x21a36f,'If-None-Match':null,'OData-Version':_0xeb49('0x8c')},'json':!![]};return rp(_0x18729d);})['then'](function(_0x2e4198){_0x3988c8=_0x2e4198;_0x26645f=_0x3988c8['Attributes'];_0x26645f=_['remove'](_0x26645f,function(_0x1284d6){return!_0x3ba500['includes'](_0x1284d6[_0xeb49('0x90')]);});var _0x9bf262=[];var _0x1f6d7f=[];_0x26645f['forEach'](function(_0x30b2ec){if(_0x30b2ec[_0xeb49('0x91')]){var _0x4e905b=_0x30b2ec[_0xeb49('0x91')][_0xeb49('0x41')](_0x30b2ec[_0xeb49('0x91')][_0xeb49('0x42')]('.')+0x1);if(_0x4e905b===_0xeb49('0x92')){_0x9bf262[_0xeb49('0x93')](getSelectList(_0x53fbd2,_0x4ef48e,_0x1f6d7f,_0x3988c8[_0xeb49('0x8e')],_0x30b2ec[_0xeb49('0x8e')],_0x21a36f));}}});return Promise['all'](_0x9bf262);})['then'](function(_0x441d55){_0x5c06ac=_0x441d55[0x0];var _0x7b6cd4=[];var _0x127aeb=[];_0x26645f[_0xeb49('0x94')](function(_0x1df96c){if(!_['isNil'](_0x1df96c[_0xeb49('0x91')])){var _0x3e310c=_0x1df96c[_0xeb49('0x91')][_0xeb49('0x41')](_0x1df96c[_0xeb49('0x91')][_0xeb49('0x42')]('.')+0x1);if(_0x3e310c===_0xeb49('0x95')){_0x7b6cd4[_0xeb49('0x93')](getBooleanList(_0x53fbd2,_0x4ef48e,_0x127aeb,_0x3988c8[_0xeb49('0x8e')],_0x1df96c[_0xeb49('0x8e')],_0x21a36f));}}});return Promise[_0xeb49('0x96')](_0x7b6cd4);})[_0xeb49('0xf')](function(_0x445aec){_0x563604=_0x445aec[0x0];var _0x143cdf=[];var _0x5f412f=[];_0x26645f['forEach'](function(_0x18065c){if(_0x18065c[_0xeb49('0x91')]){var _0x5ae0ae=_0x18065c['@odata.type'][_0xeb49('0x41')](_0x18065c['@odata.type'][_0xeb49('0x42')]('.')+0x1);if(_0x5ae0ae==='StringAttributeMetadata'||_0x5ae0ae===_0xeb49('0x97')||_0x5ae0ae===_0xeb49('0x98')||_0x5ae0ae==='IntegerAttributeMetadata'||_0x5ae0ae===_0xeb49('0x99')||_0x5ae0ae===_0xeb49('0x9a')||_0x5ae0ae==='StatusAttributeMetadata'||_0x5ae0ae===_0xeb49('0x9b')||_0x5ae0ae==='StateAttributeMetadata'||_0x5ae0ae===_0xeb49('0x9c')){_0x143cdf[_0xeb49('0x93')](getInputList(_0x53fbd2,_0x4ef48e,_0x5ae0ae,_0x5f412f,_0x3988c8[_0xeb49('0x8e')],_0x18065c[_0xeb49('0x8e')],_0x21a36f));}}});return Promise[_0xeb49('0x96')](_0x143cdf);})['then'](function(_0x459194){_0x59796d=_0x459194[0x0];var _0x2fd9fb=_0x5c06ac[_0xeb49('0x7c')](_0x563604)[_0xeb49('0x7c')](_0x59796d);var _0x1b2eee={'count':_0x2fd9fb[_0xeb49('0x22')],'rows':_0x2fd9fb};return _0x1b2eee;})[_0xeb49('0xf')](respondWithResult(_0x54f329,null))['catch'](function(_0x4c207a){var _0x4bd013=_0x19b6ce[_0xeb49('0x1c')][_0xeb49('0x9d')]?0x1f4:_0x4c207a[_0xeb49('0x9e')]||0x1f4;logger['error'](_0x4c207a[_0xeb49('0x9f')]);delete _0x4c207a[_0xeb49('0x14')];if(_0x4bd013===0x191){_0x4bd013=0x190;}_0x54f329[_0xeb49('0x7')](_0x4bd013)['send'](_0x19b6ce[_0xeb49('0x1c')][_0xeb49('0x9d')]?{'message':_0xeb49('0xa0'),'statusCode':_0x4c207a[_0xeb49('0x9e')]}:_0x4c207a);});};function getSelectList(_0x38a1b6,_0x243ccd,_0x1aa1a1,_0x71c982,_0xd41def,_0x102ecc){var _0x2ec177={'method':_0xeb49('0x8a'),'uri':_0x38a1b6+_0xeb49('0x8f')+_0x71c982+_0xeb49('0xa1')+_0xd41def+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xeb49('0x8b')+_0x102ecc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2ec177)[_0xeb49('0xf')](function(_0x36866c){var _0x1b30c4=[];var _0x4552fc=_0x36866c[_0xeb49('0xa2')][_0xeb49('0xa3')];_0x4552fc[_0xeb49('0x94')](function(_0x5063ec){_0x1b30c4[_0xeb49('0x93')]({'name':_0x5063ec[_0xeb49('0xa4')][_0xeb49('0xa5')][_0xeb49('0xa4')],'value':String(_0x5063ec[_0xeb49('0xa6')])});});var _0x4f6ed9={'id':_0x243ccd+'_'+_0x36866c['LogicalName'],'name':_0x36866c[_0xeb49('0xa7')][_0xeb49('0xa5')][_0xeb49('0xa4')],'custom':![],'options':_0x1b30c4};_0x1aa1a1[_0xeb49('0x93')](_0x4f6ed9);return _0x1aa1a1;});}function getBooleanList(_0x9f6b6c,_0x19b397,_0x18595c,_0x249343,_0x3d887b,_0xf85d4d){var _0xb7aef6={'method':_0xeb49('0x8a'),'uri':_0x9f6b6c+'EntityDefinitions('+_0x249343+_0xeb49('0xa1')+_0x3d887b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xeb49('0x8b')+_0xf85d4d,'If-None-Match':null,'OData-Version':_0xeb49('0x8c')},'json':!![]};return rp(_0xb7aef6)[_0xeb49('0xf')](function(_0x538b0d){var _0x33d127=[];_0x33d127[_0xeb49('0x93')]({'name':_0x538b0d[_0xeb49('0xa2')][_0xeb49('0xa8')]['Label']['UserLocalizedLabel']['Label'],'value':_0xeb49('0xa9')},{'name':_0x538b0d[_0xeb49('0xa2')][_0xeb49('0xaa')][_0xeb49('0xa4')][_0xeb49('0xa5')][_0xeb49('0xa4')],'value':_0xeb49('0xab')});var _0x2bc3c7={'id':_0x19b397+'_'+_0x538b0d[_0xeb49('0x90')],'name':_0x538b0d[_0xeb49('0xa7')][_0xeb49('0xa5')][_0xeb49('0xa4')],'custom':![],'options':_0x33d127};_0x18595c[_0xeb49('0x93')](_0x2bc3c7);return _0x18595c;});}function getInputList(_0x340f36,_0x1a62f1,_0x3cda35,_0x12a56c,_0x512eef,_0x3ffed4,_0x2cc51a){var _0x4968c3={'method':_0xeb49('0x8a'),'uri':_0x340f36+'EntityDefinitions('+_0x512eef+')/Attributes('+_0x3ffed4+_0xeb49('0xac')+_0x3cda35+_0xeb49('0xad'),'headers':{'Authorization':'Bearer\x20'+_0x2cc51a,'If-None-Match':null,'OData-Version':_0xeb49('0x8c')},'json':!![]};return rp(_0x4968c3)[_0xeb49('0xf')](function(_0x23ff96){var _0x1f43b7={'id':_0x1a62f1+'_'+_0x23ff96[_0xeb49('0x90')],'name':_0x23ff96[_0xeb49('0xa7')][_0xeb49('0xa5')]?_0x23ff96[_0xeb49('0xa7')]['UserLocalizedLabel'][_0xeb49('0xa4')]:_0x23ff96[_0xeb49('0x90')],'custom':![],'options':[]};_0x12a56c[_0xeb49('0x93')](_0x1f43b7);return _0x12a56c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 39b476b..f4546a6 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(_0x308b7d,_0x579a87){var _0x4e5993=function(_0x101d8c){while(--_0x101d8c){_0x308b7d['push'](_0x308b7d['shift']());}};_0x4e5993(++_0x579a87);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5c0d88,_0x447999){var _0x3f9cef=function(_0x327cad){while(--_0x327cad){_0x5c0d88['push'](_0x5c0d88['shift']());}};_0x3f9cef(++_0x447999);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 92d1d79..4cb03bd 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 _0x16aa=['info','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x16aa,0x1c8));var _0xa16a=function(_0x1936af,_0x5338e7){_0x1936af=_0x1936af-0x0;var _0x5d5ae8=_0x16aa[_0x1936af];return _0x5d5ae8;};'use strict';var _=require(_0xa16a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa16a('0x1'));var rs=require(_0xa16a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa16a('0x3'));var logger=require(_0xa16a('0x4'))(_0xa16a('0x5'));var config=require(_0xa16a('0x6'));var jayson=require(_0xa16a('0x7'));var client=jayson[_0xa16a('0x8')][_0xa16a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db69d,_0x317b80,_0x47ec0f){return new BPromise(function(_0x2c4c67,_0x1a318e){return client[_0xa16a('0xa')](_0x3db69d,_0x47ec0f)[_0xa16a('0xb')](function(_0x149c47){logger['info'](_0xa16a('0xc'),_0x317b80,_0xa16a('0xd'));logger[_0xa16a('0xe')](_0xa16a('0xf'),_0x317b80,'request\x20sent',JSON[_0xa16a('0x10')](_0x149c47));if(_0x149c47[_0xa16a('0x11')]){if(_0x149c47[_0xa16a('0x11')][_0xa16a('0x12')]===0x1f4){logger['error'](_0xa16a('0xc'),_0x317b80,_0x149c47[_0xa16a('0x11')][_0xa16a('0x13')]);return _0x1a318e(_0x149c47[_0xa16a('0x11')][_0xa16a('0x13')]);}logger['error'](_0xa16a('0xc'),_0x317b80,_0x149c47[_0xa16a('0x11')][_0xa16a('0x13')]);return _0x2c4c67(_0x149c47['error'][_0xa16a('0x13')]);}else{logger[_0xa16a('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x317b80,'request\x20sent');_0x2c4c67(_0x149c47['result']['message']);}})[_0xa16a('0x15')](function(_0x1478ba){logger[_0xa16a('0x11')](_0xa16a('0xc'),_0x317b80,_0x1478ba);_0x1a318e(_0x1478ba);});});}exports[_0xa16a('0x16')]=function(_0x1f7dc6){var _0x31be68=this;return new Promise(function(_0x51875f,_0x5d1efb){return db['Dynamics365Account'][_0xa16a('0x17')]({'raw':_0x1f7dc6[_0xa16a('0x18')]?_0x1f7dc6['options'][_0xa16a('0x19')]===undefined?!![]:![]:!![],'where':_0x1f7dc6[_0xa16a('0x18')]?_0x1f7dc6['options'][_0xa16a('0x1a')]||null:null,'attributes':_0x1f7dc6[_0xa16a('0x18')]?_0x1f7dc6[_0xa16a('0x18')][_0xa16a('0x1b')]||null:null,'limit':_0x1f7dc6['options']?_0x1f7dc6[_0xa16a('0x18')][_0xa16a('0x1c')]||null:null,'include':_0x1f7dc6[_0xa16a('0x18')]?_0x1f7dc6[_0xa16a('0x18')][_0xa16a('0x1d')]?_['map'](_0x1f7dc6[_0xa16a('0x18')][_0xa16a('0x1d')],function(_0x3adcb8){return{'model':db[_0x3adcb8['model']],'as':_0x3adcb8['as'],'attributes':_0x3adcb8[_0xa16a('0x1b')],'include':_0x3adcb8['include']?_[_0xa16a('0x1e')](_0x3adcb8['include'],function(_0x127b5b){return{'model':db[_0x127b5b[_0xa16a('0x1f')]],'as':_0x127b5b['as'],'attributes':_0x127b5b[_0xa16a('0x1b')],'include':_0x127b5b[_0xa16a('0x1d')]?_[_0xa16a('0x1e')](_0x127b5b[_0xa16a('0x1d')],function(_0xfb2ace){return{'model':db[_0xfb2ace[_0xa16a('0x1f')]],'as':_0xfb2ace['as'],'attributes':_0xfb2ace[_0xa16a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa16a('0xb')](function(_0x3a1410){logger[_0xa16a('0x14')](_0xa16a('0x16'),_0x1f7dc6);logger[_0xa16a('0xe')](_0xa16a('0x16'),_0x1f7dc6,JSON[_0xa16a('0x10')](_0x3a1410));_0x51875f(_0x3a1410);})['catch'](function(_0x8c0c99){logger[_0xa16a('0x11')](_0xa16a('0x16'),_0x8c0c99['message'],_0x1f7dc6);_0x5d1efb(_0x31be68[_0xa16a('0x11')](0x1f4,_0x8c0c99['message']));});});};exports[_0xa16a('0x20')]=function(_0x36a21c){var _0x182c28=this;return new Promise(function(_0x519806,_0x2bfe1d){return db['Dynamics365Account'][_0xa16a('0x21')]({'raw':_0x36a21c[_0xa16a('0x18')]?_0x36a21c[_0xa16a('0x18')][_0xa16a('0x19')]===undefined?!![]:![]:!![],'where':_0x36a21c[_0xa16a('0x18')]?_0x36a21c[_0xa16a('0x18')]['where']||null:null,'attributes':_0x36a21c[_0xa16a('0x18')]?_0x36a21c['options'][_0xa16a('0x1b')]||null:null,'include':_0x36a21c[_0xa16a('0x18')]?_0x36a21c[_0xa16a('0x18')]['include']?_['map'](_0x36a21c[_0xa16a('0x18')][_0xa16a('0x1d')],function(_0x43cc1f){return{'model':db[_0x43cc1f['model']],'as':_0x43cc1f['as'],'attributes':_0x43cc1f['attributes'],'include':_0x43cc1f['include']?_[_0xa16a('0x1e')](_0x43cc1f[_0xa16a('0x1d')],function(_0x493245){return{'model':db[_0x493245['model']],'as':_0x493245['as'],'attributes':_0x493245[_0xa16a('0x1b')],'include':_0x493245[_0xa16a('0x1d')]?_['map'](_0x493245[_0xa16a('0x1d')],function(_0x1eb206){return{'model':db[_0x1eb206[_0xa16a('0x1f')]],'as':_0x1eb206['as'],'attributes':_0x1eb206['attributes']};}):[]};}):[]};}):[]:[]})[_0xa16a('0xb')](function(_0x3fb15c){logger[_0xa16a('0x14')](_0xa16a('0x20'),_0x36a21c);logger['debug'](_0xa16a('0x20'),_0x36a21c,JSON['stringify'](_0x3fb15c));_0x519806(_0x3fb15c);})[_0xa16a('0x15')](function(_0x19e08f){logger[_0xa16a('0x11')](_0xa16a('0x20'),_0x19e08f[_0xa16a('0x13')],_0x36a21c);_0x2bfe1d(_0x182c28[_0xa16a('0x11')](0x1f4,_0x19e08f[_0xa16a('0x13')]));});});}; \ No newline at end of file +var _0x9a98=['error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','map','include','model','stringify','ShowDynamics365Account','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5d7d6c,_0x7eefd0){var _0x3c195c=function(_0x497b7e){while(--_0x497b7e){_0x5d7d6c['push'](_0x5d7d6c['shift']());}};_0x3c195c(++_0x7eefd0);}(_0x9a98,0x9a));var _0x89a9=function(_0x11d729,_0x29e576){_0x11d729=_0x11d729-0x0;var _0x327a67=_0x9a98[_0x11d729];return _0x327a67;};'use strict';var _=require(_0x89a9('0x0'));var util=require(_0x89a9('0x1'));var moment=require('moment');var BPromise=require(_0x89a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a9('0x3'));var db=require(_0x89a9('0x4'))['db'];var utils=require(_0x89a9('0x5'));var logger=require(_0x89a9('0x6'))(_0x89a9('0x7'));var config=require('../../config/environment');var jayson=require(_0x89a9('0x8'));var client=jayson[_0x89a9('0x9')][_0x89a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc22151,_0x419fc0,_0x26aac3){return new BPromise(function(_0x4550b1,_0x47b71f){return client[_0x89a9('0xb')](_0xc22151,_0x26aac3)[_0x89a9('0xc')](function(_0x97a771){logger[_0x89a9('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x419fc0,'request\x20sent');logger[_0x89a9('0xe')](_0x89a9('0xf'),_0x419fc0,'request\x20sent',JSON['stringify'](_0x97a771));if(_0x97a771[_0x89a9('0x10')]){if(_0x97a771['error'][_0x89a9('0x11')]===0x1f4){logger[_0x89a9('0x10')](_0x89a9('0x12'),_0x419fc0,_0x97a771[_0x89a9('0x10')][_0x89a9('0x13')]);return _0x47b71f(_0x97a771[_0x89a9('0x10')][_0x89a9('0x13')]);}logger[_0x89a9('0x10')](_0x89a9('0x12'),_0x419fc0,_0x97a771['error'][_0x89a9('0x13')]);return _0x4550b1(_0x97a771[_0x89a9('0x10')][_0x89a9('0x13')]);}else{logger[_0x89a9('0xd')](_0x89a9('0x12'),_0x419fc0,'request\x20sent');_0x4550b1(_0x97a771[_0x89a9('0x14')][_0x89a9('0x13')]);}})[_0x89a9('0x15')](function(_0x347987){logger[_0x89a9('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x419fc0,_0x347987);_0x47b71f(_0x347987);});});}exports[_0x89a9('0x16')]=function(_0x207613){var _0xd6189b=this;return new Promise(function(_0x499dd6,_0x180f0e){return db[_0x89a9('0x17')][_0x89a9('0x18')]({'raw':_0x207613[_0x89a9('0x19')]?_0x207613['options'][_0x89a9('0x1a')]===undefined?!![]:![]:!![],'where':_0x207613['options']?_0x207613[_0x89a9('0x19')]['where']||null:null,'attributes':_0x207613[_0x89a9('0x19')]?_0x207613[_0x89a9('0x19')][_0x89a9('0x1b')]||null:null,'limit':_0x207613[_0x89a9('0x19')]?_0x207613[_0x89a9('0x19')]['limit']||null:null,'include':_0x207613[_0x89a9('0x19')]?_0x207613[_0x89a9('0x19')]['include']?_[_0x89a9('0x1c')](_0x207613[_0x89a9('0x19')][_0x89a9('0x1d')],function(_0x302813){return{'model':db[_0x302813[_0x89a9('0x1e')]],'as':_0x302813['as'],'attributes':_0x302813[_0x89a9('0x1b')],'include':_0x302813[_0x89a9('0x1d')]?_[_0x89a9('0x1c')](_0x302813['include'],function(_0x5af903){return{'model':db[_0x5af903[_0x89a9('0x1e')]],'as':_0x5af903['as'],'attributes':_0x5af903[_0x89a9('0x1b')],'include':_0x5af903[_0x89a9('0x1d')]?_[_0x89a9('0x1c')](_0x5af903[_0x89a9('0x1d')],function(_0x48c1e5){return{'model':db[_0x48c1e5[_0x89a9('0x1e')]],'as':_0x48c1e5['as'],'attributes':_0x48c1e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x89a9('0xc')](function(_0x46d662){logger[_0x89a9('0xd')](_0x89a9('0x16'),_0x207613);logger[_0x89a9('0xe')](_0x89a9('0x16'),_0x207613,JSON[_0x89a9('0x1f')](_0x46d662));_0x499dd6(_0x46d662);})['catch'](function(_0x1967e1){logger[_0x89a9('0x10')](_0x89a9('0x16'),_0x1967e1[_0x89a9('0x13')],_0x207613);_0x180f0e(_0xd6189b[_0x89a9('0x10')](0x1f4,_0x1967e1[_0x89a9('0x13')]));});});};exports[_0x89a9('0x20')]=function(_0x29f994){var _0x16ca00=this;return new Promise(function(_0x4e4ec9,_0x2b8cb0){return db['Dynamics365Account'][_0x89a9('0x21')]({'raw':_0x29f994[_0x89a9('0x19')]?_0x29f994[_0x89a9('0x19')][_0x89a9('0x1a')]===undefined?!![]:![]:!![],'where':_0x29f994[_0x89a9('0x19')]?_0x29f994[_0x89a9('0x19')]['where']||null:null,'attributes':_0x29f994[_0x89a9('0x19')]?_0x29f994[_0x89a9('0x19')][_0x89a9('0x1b')]||null:null,'include':_0x29f994[_0x89a9('0x19')]?_0x29f994[_0x89a9('0x19')][_0x89a9('0x1d')]?_[_0x89a9('0x1c')](_0x29f994[_0x89a9('0x19')]['include'],function(_0x37354d){return{'model':db[_0x37354d[_0x89a9('0x1e')]],'as':_0x37354d['as'],'attributes':_0x37354d[_0x89a9('0x1b')],'include':_0x37354d[_0x89a9('0x1d')]?_[_0x89a9('0x1c')](_0x37354d[_0x89a9('0x1d')],function(_0x4d4d1f){return{'model':db[_0x4d4d1f[_0x89a9('0x1e')]],'as':_0x4d4d1f['as'],'attributes':_0x4d4d1f[_0x89a9('0x1b')],'include':_0x4d4d1f['include']?_[_0x89a9('0x1c')](_0x4d4d1f['include'],function(_0x3817a3){return{'model':db[_0x3817a3['model']],'as':_0x3817a3['as'],'attributes':_0x3817a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x89a9('0xc')](function(_0x529a7b){logger[_0x89a9('0xd')]('ShowDynamics365Account',_0x29f994);logger[_0x89a9('0xe')]('ShowDynamics365Account',_0x29f994,JSON['stringify'](_0x529a7b));_0x4e4ec9(_0x529a7b);})[_0x89a9('0x15')](function(_0xa0647b){logger['error']('ShowDynamics365Account',_0xa0647b[_0x89a9('0x13')],_0x29f994);_0x2b8cb0(_0x16ca00[_0x89a9('0x10')](0x1f4,_0xa0647b[_0x89a9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8ec22e3..6521f50 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 _0x43a5=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x43a5,0xb0));var _0x543a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43a5[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x543a('0x0'));var util=require(_0x543a('0x1'));var path=require(_0x543a('0x2'));var timeout=require(_0x543a('0x3'));var express=require(_0x543a('0x4'));var router=express[_0x543a('0x5')]();var fs_extra=require(_0x543a('0x6'));var auth=require(_0x543a('0x7'));var interaction=require(_0x543a('0x8'));var config=require(_0x543a('0x9'));var controller=require(_0x543a('0xa'));router[_0x543a('0xb')]('/',auth['isAuthenticated'](),controller[_0x543a('0xc')]);router[_0x543a('0xb')](_0x543a('0xd'),auth[_0x543a('0xe')](),controller[_0x543a('0xf')]);router[_0x543a('0xb')](_0x543a('0x10'),auth[_0x543a('0xe')](),controller['getFields']);router['get'](_0x543a('0x11'),auth[_0x543a('0xe')](),controller['getSubjects']);router[_0x543a('0xb')](_0x543a('0x12'),auth['isAuthenticated'](),controller[_0x543a('0x13')]);router[_0x543a('0x14')]('/',auth[_0x543a('0xe')](),controller['create']);router['put'](_0x543a('0xd'),auth[_0x543a('0xe')](),controller[_0x543a('0x15')]);router[_0x543a('0x16')](_0x543a('0xd'),auth['isAuthenticated'](),controller[_0x543a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xaf60=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','/:id','update','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x4e61e8,_0xd686b0){var _0x6b8776=function(_0x1eaf5b){while(--_0x1eaf5b){_0x4e61e8['push'](_0x4e61e8['shift']());}};_0x6b8776(++_0xd686b0);}(_0xaf60,0x82));var _0x0af6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf60[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var path=require(_0x0af6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0af6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var controller=require(_0x0af6('0x6'));router[_0x0af6('0x7')]('/',auth[_0x0af6('0x8')](),controller[_0x0af6('0x9')]);router[_0x0af6('0x7')]('/:id',auth[_0x0af6('0x8')](),controller[_0x0af6('0xa')]);router['get'](_0x0af6('0xb'),auth[_0x0af6('0x8')](),controller[_0x0af6('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x0af6('0xd')]);router['get'](_0x0af6('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0af6('0xf')]('/',auth[_0x0af6('0x8')](),controller[_0x0af6('0x10')]);router['put'](_0x0af6('0x11'),auth[_0x0af6('0x8')](),controller[_0x0af6('0x12')]);router['delete'](_0x0af6('0x11'),auth['isAuthenticated'](),controller[_0x0af6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 87780ae..023025e 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 _0xb2cb=['nothing','BOOLEAN','exports','ENUM','incident','contact'];(function(_0x265cf6,_0x26f1d8){var _0x3f2737=function(_0x3d095f){while(--_0x3d095f){_0x265cf6['push'](_0x265cf6['shift']());}};_0x3f2737(++_0x26f1d8);}(_0xb2cb,0x13a));var _0xbb2c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xb2cb[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require('sequelize');module[_0xbb2c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xbb2c('0x1')](_0xbb2c('0x2'),'phonecall'),'defaultValue':_0xbb2c('0x2')},'moduleCreate':{'type':Sequelize[_0xbb2c('0x1')](_0xbb2c('0x3'),_0xbb2c('0x4')),'defaultValue':_0xbb2c('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xbb2c('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9a95=['contact','nothing','exports','incident','phonecall','ENUM'];(function(_0x5163ba,_0x5e841e){var _0x562e78=function(_0x2f3139){while(--_0x2f3139){_0x5163ba['push'](_0x5163ba['shift']());}};_0x562e78(++_0x5e841e);}(_0x9a95,0x1ac));var _0x59a9=function(_0x387b1e,_0x5e49af){_0x387b1e=_0x387b1e-0x0;var _0x46e159=_0x9a95[_0x387b1e];return _0x46e159;};'use strict';var Sequelize=require('sequelize');module[_0x59a9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x59a9('0x1'),_0x59a9('0x2')),'defaultValue':_0x59a9('0x1')},'moduleCreate':{'type':Sequelize[_0x59a9('0x3')](_0x59a9('0x4'),_0x59a9('0x5')),'defaultValue':_0x59a9('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b371033..92c6dc7 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 _0x85f6=['rows','show','params','length','merge','find','catch','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','set','Content-Range','json','reject','save','update','then','status','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Dynamics365Configuration','count'];(function(_0x3a1a7e,_0x40c366){var _0xd25f96=function(_0x5db72f){while(--_0x5db72f){_0x3a1a7e['push'](_0x3a1a7e['shift']());}};_0xd25f96(++_0x40c366);}(_0x85f6,0xa8));var _0x685f=function(_0x5b100b,_0xf84f9e){_0x5b100b=_0x5b100b-0x0;var _0x682aa6=_0x85f6[_0x5b100b];return _0x682aa6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x685f('0x0'));var zipdir=require(_0x685f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x685f('0x2'));var BPromise=require(_0x685f('0x3'));var Mustache=require(_0x685f('0x4'));var util=require('util');var path=require(_0x685f('0x5'));var sox=require(_0x685f('0x6'));var csv=require(_0x685f('0x7'));var ejs=require(_0x685f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x685f('0x9'));var squel=require(_0x685f('0xa'));var crypto=require(_0x685f('0xb'));var jsforce=require(_0x685f('0xc'));var deskjs=require(_0x685f('0xd'));var toCsv=require(_0x685f('0x7'));var querystring=require('querystring');var Papa=require(_0x685f('0xe'));var Redis=require(_0x685f('0xf'));var authService=require(_0x685f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x685f('0x11'));var logger=require(_0x685f('0x12'))(_0x685f('0x13'));var utils=require('../../config/utils');var config=require(_0x685f('0x14'));var licenseUtil=require(_0x685f('0x15'));var db=require(_0x685f('0x16'))['db'];function respondWithStatusCode(_0x5a2e36,_0x522dc9){_0x522dc9=_0x522dc9||0xcc;return function(_0x24eb60){if(_0x24eb60){return _0x5a2e36[_0x685f('0x17')](_0x522dc9);}return _0x5a2e36['status'](_0x522dc9)[_0x685f('0x18')]();};}function respondWithResult(_0x75e49,_0x10d75f){_0x10d75f=_0x10d75f||0xc8;return function(_0x12aff5){if(_0x12aff5){return _0x75e49['status'](_0x10d75f)['json'](_0x12aff5);}};}function respondWithFilteredResult(_0x1358a9,_0x2f8da1){return function(_0x224cf5){if(_0x224cf5){var _0x35e613=typeof _0x2f8da1[_0x685f('0x19')]==='undefined'&&typeof _0x2f8da1[_0x685f('0x1a')]===_0x685f('0x1b');var _0x5a22e7=_0x224cf5['count'];var _0x4938da=_0x35e613?0x0:_0x2f8da1['offset'];var _0x1f2c57=_0x35e613?_0x224cf5['count']:_0x2f8da1[_0x685f('0x19')]+_0x2f8da1[_0x685f('0x1a')];var _0x51f018;if(_0x1f2c57>=_0x5a22e7){_0x1f2c57=_0x5a22e7;_0x51f018=0xc8;}else{_0x51f018=0xce;}_0x1358a9['status'](_0x51f018);return _0x1358a9[_0x685f('0x1c')](_0x685f('0x1d'),_0x4938da+'-'+_0x1f2c57+'/'+_0x5a22e7)[_0x685f('0x1e')](_0x224cf5);}return null;};}function patchUpdates(_0x397d17){return function(_0x3fbe6b){try{jsonpatch['apply'](_0x3fbe6b,_0x397d17,!![]);}catch(_0x56bbda){return BPromise[_0x685f('0x1f')](_0x56bbda);}return _0x3fbe6b[_0x685f('0x20')]();};}function saveUpdates(_0x2a58a8,_0x5d1530){return function(_0x4a5d3b){if(_0x4a5d3b){return _0x4a5d3b[_0x685f('0x21')](_0x2a58a8)[_0x685f('0x22')](function(_0x453fb5){return _0x453fb5;});}return null;};}function removeEntity(_0xe85dbf,_0x44f061){return function(_0x34ae6e){if(_0x34ae6e){return _0x34ae6e['destroy']()['then'](function(){_0xe85dbf[_0x685f('0x23')](0xcc)[_0x685f('0x18')]();});}};}function handleEntityNotFound(_0x49bb5f,_0x179d34){return function(_0x4c4a57){if(!_0x4c4a57){_0x49bb5f['sendStatus'](0x194);}return _0x4c4a57;};}function handleError(_0x3db400,_0x8501dc){_0x8501dc=_0x8501dc||0x1f4;return function(_0x30bd8c){logger[_0x685f('0x24')](_0x30bd8c[_0x685f('0x25')]);if(_0x30bd8c[_0x685f('0x26')]){delete _0x30bd8c['name'];}_0x3db400[_0x685f('0x23')](_0x8501dc)[_0x685f('0x27')](_0x30bd8c);};}exports[_0x685f('0x28')]=function(_0x4b4fa1,_0x16482d){var _0x5c0d0a={},_0x44d68e={},_0x1309fe={'count':0x0,'rows':[]};var _0x397dd8=_['map'](db['Dynamics365Configuration'][_0x685f('0x29')],function(_0x2be7ba){return{'name':_0x2be7ba[_0x685f('0x2a')],'type':_0x2be7ba[_0x685f('0x2b')]['key']};});_0x44d68e[_0x685f('0x2c')]=_[_0x685f('0x2d')](_0x397dd8,_0x685f('0x26'));_0x44d68e[_0x685f('0x2e')]=_[_0x685f('0x2f')](_0x4b4fa1[_0x685f('0x2e')]);_0x44d68e[_0x685f('0x30')]=_[_0x685f('0x31')](_0x44d68e[_0x685f('0x2c')],_0x44d68e[_0x685f('0x2e')]);_0x5c0d0a['attributes']=_[_0x685f('0x31')](_0x44d68e['model'],qs[_0x685f('0x32')](_0x4b4fa1['query'][_0x685f('0x32')]));_0x5c0d0a['attributes']=_0x5c0d0a[_0x685f('0x33')]['length']?_0x5c0d0a['attributes']:_0x44d68e['model'];if(!_0x4b4fa1[_0x685f('0x2e')][_0x685f('0x34')](_0x685f('0x35'))){_0x5c0d0a['limit']=qs[_0x685f('0x1a')](_0x4b4fa1[_0x685f('0x2e')][_0x685f('0x1a')]);_0x5c0d0a[_0x685f('0x19')]=qs[_0x685f('0x19')](_0x4b4fa1[_0x685f('0x2e')][_0x685f('0x19')]);}_0x5c0d0a[_0x685f('0x36')]=qs[_0x685f('0x37')](_0x4b4fa1['query']['sort']);_0x5c0d0a[_0x685f('0x38')]=qs[_0x685f('0x30')](_[_0x685f('0x39')](_0x4b4fa1[_0x685f('0x2e')],_0x44d68e['filters']),_0x397dd8);if(_0x4b4fa1[_0x685f('0x2e')][_0x685f('0x3a')]){_0x5c0d0a[_0x685f('0x38')]=_['merge'](_0x5c0d0a[_0x685f('0x38')],{'$or':_[_0x685f('0x2d')](_0x397dd8,function(_0x2b6ed6){if(_0x2b6ed6[_0x685f('0x2b')]!==_0x685f('0x3b')){var _0x602d49={};_0x602d49[_0x2b6ed6['name']]={'$like':'%'+_0x4b4fa1[_0x685f('0x2e')][_0x685f('0x3a')]+'%'};return _0x602d49;}})});}_0x5c0d0a=_['merge']({},_0x5c0d0a,_0x4b4fa1[_0x685f('0x3c')]);var _0x188211={'where':_0x5c0d0a[_0x685f('0x38')]};return db[_0x685f('0x3d')][_0x685f('0x3e')](_0x188211)[_0x685f('0x22')](function(_0x50a3b6){_0x1309fe[_0x685f('0x3e')]=_0x50a3b6;if(_0x4b4fa1[_0x685f('0x2e')]['includeAll']){_0x5c0d0a['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x5c0d0a);})[_0x685f('0x22')](function(_0x4d3974){_0x1309fe[_0x685f('0x3f')]=_0x4d3974;return _0x1309fe;})['then'](respondWithFilteredResult(_0x16482d,_0x5c0d0a))['catch'](handleError(_0x16482d,null));};exports[_0x685f('0x40')]=function(_0x578b38,_0x139db2){var _0x14ebea={'raw':![],'where':{'id':_0x578b38[_0x685f('0x41')]['id']}},_0x1390fa={};_0x1390fa[_0x685f('0x2c')]=_[_0x685f('0x2f')](db['Dynamics365Configuration']['rawAttributes']);_0x1390fa[_0x685f('0x2e')]=_['keys'](_0x578b38[_0x685f('0x2e')]);_0x1390fa[_0x685f('0x30')]=_[_0x685f('0x31')](_0x1390fa['model'],_0x1390fa[_0x685f('0x2e')]);_0x14ebea[_0x685f('0x33')]=_[_0x685f('0x31')](_0x1390fa[_0x685f('0x2c')],qs['fields'](_0x578b38[_0x685f('0x2e')][_0x685f('0x32')]));_0x14ebea[_0x685f('0x33')]=_0x14ebea[_0x685f('0x33')][_0x685f('0x42')]?_0x14ebea[_0x685f('0x33')]:_0x1390fa[_0x685f('0x2c')];if(_0x578b38[_0x685f('0x2e')]['includeAll']){_0x14ebea['include']=[{'all':!![]}];}_0x14ebea=_[_0x685f('0x43')]({},_0x14ebea,_0x578b38[_0x685f('0x3c')]);return db['Dynamics365Configuration'][_0x685f('0x44')](_0x14ebea)[_0x685f('0x22')](handleEntityNotFound(_0x139db2,null))[_0x685f('0x22')](respondWithResult(_0x139db2,null))[_0x685f('0x45')](handleError(_0x139db2,null));};exports[_0x685f('0x46')]=function(_0xc0b13b,_0x54b09f){return db[_0x685f('0x3d')][_0x685f('0x46')](_0xc0b13b[_0x685f('0x47')],{})[_0x685f('0x22')](respondWithResult(_0x54b09f,0xc9))[_0x685f('0x45')](handleError(_0x54b09f,null));};exports['update']=function(_0x213a9f,_0xb85608){if(_0x213a9f[_0x685f('0x47')]['id']){delete _0x213a9f['body']['id'];}return db[_0x685f('0x3d')][_0x685f('0x44')]({'where':{'id':_0x213a9f[_0x685f('0x41')]['id']}})[_0x685f('0x22')](handleEntityNotFound(_0xb85608,null))[_0x685f('0x22')](saveUpdates(_0x213a9f[_0x685f('0x47')],null))[_0x685f('0x22')](respondWithResult(_0xb85608,null))[_0x685f('0x45')](handleError(_0xb85608,null));};exports['destroy']=function(_0x10f346,_0x27f17a){return db['Dynamics365Configuration'][_0x685f('0x44')]({'where':{'id':_0x10f346['params']['id']}})['then'](handleEntityNotFound(_0x27f17a,null))[_0x685f('0x22')](removeEntity(_0x27f17a,null))['catch'](handleError(_0x27f17a,null));};exports[_0x685f('0x48')]=function(_0x18ed7b,_0x12f6d8,_0x2c47e8){var _0x1a6f4b={};var _0x1ffb10={};var _0x48edb5;var _0x263a69;return db[_0x685f('0x3d')][_0x685f('0x49')]({'where':{'id':_0x18ed7b[_0x685f('0x41')]['id']}})[_0x685f('0x22')](handleEntityNotFound(_0x12f6d8,null))['then'](function(_0x147223){if(_0x147223){_0x48edb5=_0x147223;_0x1ffb10[_0x685f('0x2c')]=_['keys'](db[_0x685f('0x4a')]['rawAttributes']);_0x1ffb10[_0x685f('0x2e')]=_[_0x685f('0x2f')](_0x18ed7b['query']);_0x1ffb10['filters']=_[_0x685f('0x31')](_0x1ffb10[_0x685f('0x2c')],_0x1ffb10['query']);_0x1a6f4b['attributes']=_[_0x685f('0x31')](_0x1ffb10['model'],qs[_0x685f('0x32')](_0x18ed7b[_0x685f('0x2e')]['fields']));_0x1a6f4b[_0x685f('0x33')]=_0x1a6f4b[_0x685f('0x33')][_0x685f('0x42')]?_0x1a6f4b[_0x685f('0x33')]:_0x1ffb10[_0x685f('0x2c')];_0x1a6f4b[_0x685f('0x36')]=qs[_0x685f('0x37')](_0x18ed7b[_0x685f('0x2e')][_0x685f('0x37')]);_0x1a6f4b[_0x685f('0x38')]=qs[_0x685f('0x30')](_[_0x685f('0x39')](_0x18ed7b['query'],_0x1ffb10['filters']));if(_0x18ed7b[_0x685f('0x2e')]['filter']){_0x1a6f4b[_0x685f('0x38')]=_[_0x685f('0x43')](_0x1a6f4b[_0x685f('0x38')],{'$or':_[_0x685f('0x2d')](_0x1a6f4b[_0x685f('0x33')],function(_0x4f2d03){var _0x1a2fdb={};_0x1a2fdb[_0x4f2d03]={'$like':'%'+_0x18ed7b[_0x685f('0x2e')][_0x685f('0x3a')]+'%'};return _0x1a2fdb;})});}_0x1a6f4b=_[_0x685f('0x43')]({},_0x1a6f4b,_0x18ed7b['options']);return _0x48edb5[_0x685f('0x48')](_0x1a6f4b);}})[_0x685f('0x22')](function(_0x1802d1){if(_0x1802d1){_0x263a69=_0x1802d1[_0x685f('0x42')];if(!_0x18ed7b[_0x685f('0x2e')][_0x685f('0x34')](_0x685f('0x35'))){_0x1a6f4b[_0x685f('0x1a')]=qs[_0x685f('0x1a')](_0x18ed7b[_0x685f('0x2e')][_0x685f('0x1a')]);_0x1a6f4b[_0x685f('0x19')]=qs[_0x685f('0x19')](_0x18ed7b[_0x685f('0x2e')][_0x685f('0x19')]);}return _0x48edb5[_0x685f('0x48')](_0x1a6f4b);}})[_0x685f('0x22')](function(_0x119785){if(_0x119785){return _0x119785?{'count':_0x263a69,'rows':_0x119785}:null;}})[_0x685f('0x22')](respondWithResult(_0x12f6d8,null))[_0x685f('0x45')](handleError(_0x12f6d8,null));};exports['getSubjects']=function(_0x2ebbe1,_0x19edf6,_0x4bcbba){var _0x295e8f={};var _0x4b0d41={};var _0x2abd95;var _0x4afc16;return db['Dynamics365Configuration'][_0x685f('0x49')]({'where':{'id':_0x2ebbe1[_0x685f('0x41')]['id']}})[_0x685f('0x22')](handleEntityNotFound(_0x19edf6,null))['then'](function(_0x36f864){if(_0x36f864){_0x2abd95=_0x36f864;_0x4b0d41[_0x685f('0x2c')]=_[_0x685f('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x4b0d41[_0x685f('0x2e')]=_[_0x685f('0x2f')](_0x2ebbe1[_0x685f('0x2e')]);_0x4b0d41[_0x685f('0x30')]=_['intersection'](_0x4b0d41[_0x685f('0x2c')],_0x4b0d41[_0x685f('0x2e')]);_0x295e8f[_0x685f('0x33')]=_['intersection'](_0x4b0d41[_0x685f('0x2c')],qs[_0x685f('0x32')](_0x2ebbe1[_0x685f('0x2e')][_0x685f('0x32')]));_0x295e8f[_0x685f('0x33')]=_0x295e8f[_0x685f('0x33')][_0x685f('0x42')]?_0x295e8f[_0x685f('0x33')]:_0x4b0d41['model'];_0x295e8f[_0x685f('0x36')]=qs['sort'](_0x2ebbe1[_0x685f('0x2e')][_0x685f('0x37')]);_0x295e8f['where']=qs[_0x685f('0x30')](_['pick'](_0x2ebbe1['query'],_0x4b0d41[_0x685f('0x30')]));if(_0x2ebbe1[_0x685f('0x2e')][_0x685f('0x3a')]){_0x295e8f[_0x685f('0x38')]=_[_0x685f('0x43')](_0x295e8f[_0x685f('0x38')],{'$or':_[_0x685f('0x2d')](_0x295e8f[_0x685f('0x33')],function(_0x265db9){var _0x4cc773={};_0x4cc773[_0x265db9]={'$like':'%'+_0x2ebbe1[_0x685f('0x2e')][_0x685f('0x3a')]+'%'};return _0x4cc773;})});}_0x295e8f=_[_0x685f('0x43')]({},_0x295e8f,_0x2ebbe1[_0x685f('0x3c')]);return _0x2abd95[_0x685f('0x4b')](_0x295e8f);}})[_0x685f('0x22')](function(_0x23d0c5){if(_0x23d0c5){_0x4afc16=_0x23d0c5['length'];if(!_0x2ebbe1['query'][_0x685f('0x34')](_0x685f('0x35'))){_0x295e8f['limit']=qs[_0x685f('0x1a')](_0x2ebbe1[_0x685f('0x2e')][_0x685f('0x1a')]);_0x295e8f[_0x685f('0x19')]=qs[_0x685f('0x19')](_0x2ebbe1['query'][_0x685f('0x19')]);}return _0x2abd95[_0x685f('0x4b')](_0x295e8f);}})[_0x685f('0x22')](function(_0x30e68a){if(_0x30e68a){return _0x30e68a?{'count':_0x4afc16,'rows':_0x30e68a}:null;}})[_0x685f('0x22')](respondWithResult(_0x19edf6,null))[_0x685f('0x45')](handleError(_0x19edf6,null));};exports[_0x685f('0x4c')]=function(_0x24d371,_0x151541,_0x580d55){var _0x3a67cb={};var _0xe1ba99={};var _0x282029;var _0x5d5a9d;return db[_0x685f('0x3d')][_0x685f('0x49')]({'where':{'id':_0x24d371[_0x685f('0x41')]['id']}})[_0x685f('0x22')](handleEntityNotFound(_0x151541,null))[_0x685f('0x22')](function(_0x3a5f5d){if(_0x3a5f5d){_0x282029=_0x3a5f5d;_0xe1ba99[_0x685f('0x2c')]=_['keys'](db[_0x685f('0x4a')][_0x685f('0x29')]);_0xe1ba99[_0x685f('0x2e')]=_[_0x685f('0x2f')](_0x24d371[_0x685f('0x2e')]);_0xe1ba99['filters']=_['intersection'](_0xe1ba99[_0x685f('0x2c')],_0xe1ba99[_0x685f('0x2e')]);_0x3a67cb[_0x685f('0x33')]=_['intersection'](_0xe1ba99[_0x685f('0x2c')],qs[_0x685f('0x32')](_0x24d371[_0x685f('0x2e')][_0x685f('0x32')]));_0x3a67cb[_0x685f('0x33')]=_0x3a67cb['attributes'][_0x685f('0x42')]?_0x3a67cb[_0x685f('0x33')]:_0xe1ba99['model'];_0x3a67cb[_0x685f('0x36')]=qs[_0x685f('0x37')](_0x24d371[_0x685f('0x2e')][_0x685f('0x37')]);_0x3a67cb[_0x685f('0x38')]=qs[_0x685f('0x30')](_[_0x685f('0x39')](_0x24d371[_0x685f('0x2e')],_0xe1ba99[_0x685f('0x30')]));if(_0x24d371[_0x685f('0x2e')][_0x685f('0x3a')]){_0x3a67cb[_0x685f('0x38')]=_[_0x685f('0x43')](_0x3a67cb[_0x685f('0x38')],{'$or':_[_0x685f('0x2d')](_0x3a67cb[_0x685f('0x33')],function(_0x5ebeeb){var _0x582091={};_0x582091[_0x5ebeeb]={'$like':'%'+_0x24d371[_0x685f('0x2e')][_0x685f('0x3a')]+'%'};return _0x582091;})});}_0x3a67cb=_[_0x685f('0x43')]({},_0x3a67cb,_0x24d371[_0x685f('0x3c')]);return _0x282029[_0x685f('0x4c')](_0x3a67cb);}})[_0x685f('0x22')](function(_0x1273d0){if(_0x1273d0){_0x5d5a9d=_0x1273d0[_0x685f('0x42')];if(!_0x24d371[_0x685f('0x2e')][_0x685f('0x34')](_0x685f('0x35'))){_0x3a67cb[_0x685f('0x1a')]=qs[_0x685f('0x1a')](_0x24d371[_0x685f('0x2e')][_0x685f('0x1a')]);_0x3a67cb[_0x685f('0x19')]=qs['offset'](_0x24d371[_0x685f('0x2e')]['offset']);}return _0x282029[_0x685f('0x4c')](_0x3a67cb);}})[_0x685f('0x22')](function(_0x446bc1){if(_0x446bc1){return _0x446bc1?{'count':_0x5d5a9d,'rows':_0x446bc1}:null;}})['then'](respondWithResult(_0x151541,null))['catch'](handleError(_0x151541,null));}; \ No newline at end of file +var _0x8c28=['body','getFields','Dynamics365Field','length','nolimit','getSubjects','findOne','params','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','Dynamics365Configuration','catch','show','rawAttributes','includeAll','find','create'];(function(_0x1624f5,_0xa2f147){var _0x23b431=function(_0x5393d4){while(--_0x5393d4){_0x1624f5['push'](_0x1624f5['shift']());}};_0x23b431(++_0xa2f147);}(_0x8c28,0xa9));var _0x88c2=function(_0x137003,_0x131321){_0x137003=_0x137003-0x0;var _0x27bf65=_0x8c28[_0x137003];return _0x27bf65;};'use strict';var emlformat=require(_0x88c2('0x0'));var rimraf=require(_0x88c2('0x1'));var zipdir=require(_0x88c2('0x2'));var jsonpatch=require(_0x88c2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x88c2('0x4'));var Mustache=require(_0x88c2('0x5'));var util=require(_0x88c2('0x6'));var path=require(_0x88c2('0x7'));var sox=require(_0x88c2('0x8'));var csv=require(_0x88c2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88c2('0xa'));var _=require(_0x88c2('0xb'));var squel=require(_0x88c2('0xc'));var crypto=require(_0x88c2('0xd'));var jsforce=require(_0x88c2('0xe'));var deskjs=require(_0x88c2('0xf'));var toCsv=require(_0x88c2('0x9'));var querystring=require(_0x88c2('0x10'));var Papa=require(_0x88c2('0x11'));var Redis=require(_0x88c2('0x12'));var authService=require(_0x88c2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88c2('0x14'));var logger=require(_0x88c2('0x15'))(_0x88c2('0x16'));var utils=require(_0x88c2('0x17'));var config=require(_0x88c2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x88c2('0x19'))['db'];function respondWithStatusCode(_0x4a31b2,_0x24da6b){_0x24da6b=_0x24da6b||0xcc;return function(_0x16aedb){if(_0x16aedb){return _0x4a31b2['sendStatus'](_0x24da6b);}return _0x4a31b2['status'](_0x24da6b)['end']();};}function respondWithResult(_0x20c45c,_0x50ea38){_0x50ea38=_0x50ea38||0xc8;return function(_0x13ad60){if(_0x13ad60){return _0x20c45c[_0x88c2('0x1a')](_0x50ea38)[_0x88c2('0x1b')](_0x13ad60);}};}function respondWithFilteredResult(_0x11f325,_0x4848bc){return function(_0x35d818){if(_0x35d818){var _0x57b14a=typeof _0x4848bc['offset']===_0x88c2('0x1c')&&typeof _0x4848bc['limit']===_0x88c2('0x1c');var _0x30446d=_0x35d818['count'];var _0x12005f=_0x57b14a?0x0:_0x4848bc[_0x88c2('0x1d')];var _0x3b6b34=_0x57b14a?_0x35d818[_0x88c2('0x1e')]:_0x4848bc[_0x88c2('0x1d')]+_0x4848bc[_0x88c2('0x1f')];var _0x59fa02;if(_0x3b6b34>=_0x30446d){_0x3b6b34=_0x30446d;_0x59fa02=0xc8;}else{_0x59fa02=0xce;}_0x11f325[_0x88c2('0x1a')](_0x59fa02);return _0x11f325['set'](_0x88c2('0x20'),_0x12005f+'-'+_0x3b6b34+'/'+_0x30446d)[_0x88c2('0x1b')](_0x35d818);}return null;};}function patchUpdates(_0x4d28d4){return function(_0x1fd889){try{jsonpatch[_0x88c2('0x21')](_0x1fd889,_0x4d28d4,!![]);}catch(_0x16504b){return BPromise[_0x88c2('0x22')](_0x16504b);}return _0x1fd889[_0x88c2('0x23')]();};}function saveUpdates(_0x4c732a,_0x9ffa77){return function(_0x2c2468){if(_0x2c2468){return _0x2c2468[_0x88c2('0x24')](_0x4c732a)[_0x88c2('0x25')](function(_0x11b4de){return _0x11b4de;});}return null;};}function removeEntity(_0xd78f0e,_0x5309ba){return function(_0x469fd6){if(_0x469fd6){return _0x469fd6[_0x88c2('0x26')]()[_0x88c2('0x25')](function(){_0xd78f0e[_0x88c2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57806f,_0x32182d){return function(_0x554761){if(!_0x554761){_0x57806f[_0x88c2('0x27')](0x194);}return _0x554761;};}function handleError(_0x102a5a,_0x5d7b7a){_0x5d7b7a=_0x5d7b7a||0x1f4;return function(_0x8cb7f0){logger[_0x88c2('0x28')](_0x8cb7f0[_0x88c2('0x29')]);if(_0x8cb7f0[_0x88c2('0x2a')]){delete _0x8cb7f0['name'];}_0x102a5a[_0x88c2('0x1a')](_0x5d7b7a)['send'](_0x8cb7f0);};}exports[_0x88c2('0x2b')]=function(_0x20ab85,_0x222bd4){var _0x2193e9={},_0xd4f022={},_0x1ce6a5={'count':0x0,'rows':[]};var _0x29d12b=_[_0x88c2('0x2c')](db['Dynamics365Configuration']['rawAttributes'],function(_0x5c32ef){return{'name':_0x5c32ef[_0x88c2('0x2d')],'type':_0x5c32ef['type']['key']};});_0xd4f022[_0x88c2('0x2e')]=_[_0x88c2('0x2c')](_0x29d12b,'name');_0xd4f022[_0x88c2('0x2f')]=_[_0x88c2('0x30')](_0x20ab85[_0x88c2('0x2f')]);_0xd4f022[_0x88c2('0x31')]=_[_0x88c2('0x32')](_0xd4f022['model'],_0xd4f022[_0x88c2('0x2f')]);_0x2193e9['attributes']=_[_0x88c2('0x32')](_0xd4f022[_0x88c2('0x2e')],qs[_0x88c2('0x33')](_0x20ab85['query'][_0x88c2('0x33')]));_0x2193e9[_0x88c2('0x34')]=_0x2193e9[_0x88c2('0x34')]['length']?_0x2193e9[_0x88c2('0x34')]:_0xd4f022[_0x88c2('0x2e')];if(!_0x20ab85['query'][_0x88c2('0x35')]('nolimit')){_0x2193e9[_0x88c2('0x1f')]=qs[_0x88c2('0x1f')](_0x20ab85[_0x88c2('0x2f')]['limit']);_0x2193e9[_0x88c2('0x1d')]=qs[_0x88c2('0x1d')](_0x20ab85['query']['offset']);}_0x2193e9[_0x88c2('0x36')]=qs[_0x88c2('0x37')](_0x20ab85['query'][_0x88c2('0x37')]);_0x2193e9['where']=qs['filters'](_[_0x88c2('0x38')](_0x20ab85[_0x88c2('0x2f')],_0xd4f022[_0x88c2('0x31')]),_0x29d12b);if(_0x20ab85[_0x88c2('0x2f')][_0x88c2('0x39')]){_0x2193e9[_0x88c2('0x3a')]=_[_0x88c2('0x3b')](_0x2193e9[_0x88c2('0x3a')],{'$or':_[_0x88c2('0x2c')](_0x29d12b,function(_0x45e24e){if(_0x45e24e[_0x88c2('0x3c')]!==_0x88c2('0x3d')){var _0x5d61c4={};_0x5d61c4[_0x45e24e[_0x88c2('0x2a')]]={'$like':'%'+_0x20ab85[_0x88c2('0x2f')][_0x88c2('0x39')]+'%'};return _0x5d61c4;}})});}_0x2193e9=_[_0x88c2('0x3b')]({},_0x2193e9,_0x20ab85[_0x88c2('0x3e')]);var _0x520fc9={'where':_0x2193e9[_0x88c2('0x3a')]};return db['Dynamics365Configuration'][_0x88c2('0x1e')](_0x520fc9)[_0x88c2('0x25')](function(_0x4dd3b7){_0x1ce6a5['count']=_0x4dd3b7;if(_0x20ab85['query']['includeAll']){_0x2193e9[_0x88c2('0x3f')]=[{'all':!![]}];}return db[_0x88c2('0x40')]['findAll'](_0x2193e9);})[_0x88c2('0x25')](function(_0x2a206e){_0x1ce6a5['rows']=_0x2a206e;return _0x1ce6a5;})[_0x88c2('0x25')](respondWithFilteredResult(_0x222bd4,_0x2193e9))[_0x88c2('0x41')](handleError(_0x222bd4,null));};exports[_0x88c2('0x42')]=function(_0x25a949,_0x553186){var _0x20e3e9={'raw':![],'where':{'id':_0x25a949['params']['id']}},_0x3ccb7e={};_0x3ccb7e[_0x88c2('0x2e')]=_[_0x88c2('0x30')](db['Dynamics365Configuration'][_0x88c2('0x43')]);_0x3ccb7e[_0x88c2('0x2f')]=_[_0x88c2('0x30')](_0x25a949['query']);_0x3ccb7e[_0x88c2('0x31')]=_['intersection'](_0x3ccb7e[_0x88c2('0x2e')],_0x3ccb7e[_0x88c2('0x2f')]);_0x20e3e9['attributes']=_[_0x88c2('0x32')](_0x3ccb7e[_0x88c2('0x2e')],qs['fields'](_0x25a949[_0x88c2('0x2f')]['fields']));_0x20e3e9[_0x88c2('0x34')]=_0x20e3e9[_0x88c2('0x34')]['length']?_0x20e3e9[_0x88c2('0x34')]:_0x3ccb7e[_0x88c2('0x2e')];if(_0x25a949[_0x88c2('0x2f')][_0x88c2('0x44')]){_0x20e3e9['include']=[{'all':!![]}];}_0x20e3e9=_[_0x88c2('0x3b')]({},_0x20e3e9,_0x25a949[_0x88c2('0x3e')]);return db[_0x88c2('0x40')][_0x88c2('0x45')](_0x20e3e9)[_0x88c2('0x25')](handleEntityNotFound(_0x553186,null))['then'](respondWithResult(_0x553186,null))[_0x88c2('0x41')](handleError(_0x553186,null));};exports[_0x88c2('0x46')]=function(_0x23bd67,_0xda6a33){return db['Dynamics365Configuration'][_0x88c2('0x46')](_0x23bd67['body'],{})[_0x88c2('0x25')](respondWithResult(_0xda6a33,0xc9))['catch'](handleError(_0xda6a33,null));};exports[_0x88c2('0x24')]=function(_0x5a0915,_0x345b6c){if(_0x5a0915[_0x88c2('0x47')]['id']){delete _0x5a0915[_0x88c2('0x47')]['id'];}return db[_0x88c2('0x40')][_0x88c2('0x45')]({'where':{'id':_0x5a0915['params']['id']}})[_0x88c2('0x25')](handleEntityNotFound(_0x345b6c,null))[_0x88c2('0x25')](saveUpdates(_0x5a0915[_0x88c2('0x47')],null))[_0x88c2('0x25')](respondWithResult(_0x345b6c,null))[_0x88c2('0x41')](handleError(_0x345b6c,null));};exports[_0x88c2('0x26')]=function(_0x5bbbf1,_0x55a464){return db[_0x88c2('0x40')]['find']({'where':{'id':_0x5bbbf1['params']['id']}})[_0x88c2('0x25')](handleEntityNotFound(_0x55a464,null))[_0x88c2('0x25')](removeEntity(_0x55a464,null))['catch'](handleError(_0x55a464,null));};exports[_0x88c2('0x48')]=function(_0x4beedf,_0x4eea56,_0x1bc12a){var _0x2dcce6={};var _0x553aef={};var _0x1e669c;var _0x3df778;return db[_0x88c2('0x40')]['findOne']({'where':{'id':_0x4beedf['params']['id']}})[_0x88c2('0x25')](handleEntityNotFound(_0x4eea56,null))['then'](function(_0x411359){if(_0x411359){_0x1e669c=_0x411359;_0x553aef[_0x88c2('0x2e')]=_[_0x88c2('0x30')](db[_0x88c2('0x49')][_0x88c2('0x43')]);_0x553aef[_0x88c2('0x2f')]=_[_0x88c2('0x30')](_0x4beedf[_0x88c2('0x2f')]);_0x553aef[_0x88c2('0x31')]=_[_0x88c2('0x32')](_0x553aef[_0x88c2('0x2e')],_0x553aef['query']);_0x2dcce6[_0x88c2('0x34')]=_[_0x88c2('0x32')](_0x553aef['model'],qs['fields'](_0x4beedf['query']['fields']));_0x2dcce6[_0x88c2('0x34')]=_0x2dcce6[_0x88c2('0x34')][_0x88c2('0x4a')]?_0x2dcce6[_0x88c2('0x34')]:_0x553aef[_0x88c2('0x2e')];_0x2dcce6[_0x88c2('0x36')]=qs['sort'](_0x4beedf['query'][_0x88c2('0x37')]);_0x2dcce6[_0x88c2('0x3a')]=qs[_0x88c2('0x31')](_[_0x88c2('0x38')](_0x4beedf['query'],_0x553aef['filters']));if(_0x4beedf[_0x88c2('0x2f')][_0x88c2('0x39')]){_0x2dcce6[_0x88c2('0x3a')]=_['merge'](_0x2dcce6[_0x88c2('0x3a')],{'$or':_[_0x88c2('0x2c')](_0x2dcce6['attributes'],function(_0x2ec17c){var _0x526bec={};_0x526bec[_0x2ec17c]={'$like':'%'+_0x4beedf[_0x88c2('0x2f')][_0x88c2('0x39')]+'%'};return _0x526bec;})});}_0x2dcce6=_['merge']({},_0x2dcce6,_0x4beedf['options']);return _0x1e669c[_0x88c2('0x48')](_0x2dcce6);}})[_0x88c2('0x25')](function(_0x2badf3){if(_0x2badf3){_0x3df778=_0x2badf3[_0x88c2('0x4a')];if(!_0x4beedf[_0x88c2('0x2f')][_0x88c2('0x35')](_0x88c2('0x4b'))){_0x2dcce6[_0x88c2('0x1f')]=qs[_0x88c2('0x1f')](_0x4beedf[_0x88c2('0x2f')][_0x88c2('0x1f')]);_0x2dcce6[_0x88c2('0x1d')]=qs[_0x88c2('0x1d')](_0x4beedf[_0x88c2('0x2f')][_0x88c2('0x1d')]);}return _0x1e669c[_0x88c2('0x48')](_0x2dcce6);}})[_0x88c2('0x25')](function(_0x3529e7){if(_0x3529e7){return _0x3529e7?{'count':_0x3df778,'rows':_0x3529e7}:null;}})['then'](respondWithResult(_0x4eea56,null))[_0x88c2('0x41')](handleError(_0x4eea56,null));};exports[_0x88c2('0x4c')]=function(_0x1928f8,_0x1a4b71,_0x42b604){var _0x269e0c={};var _0x57d005={};var _0x228712;var _0x38f57d;return db[_0x88c2('0x40')][_0x88c2('0x4d')]({'where':{'id':_0x1928f8[_0x88c2('0x4e')]['id']}})[_0x88c2('0x25')](handleEntityNotFound(_0x1a4b71,null))[_0x88c2('0x25')](function(_0x317d7e){if(_0x317d7e){_0x228712=_0x317d7e;_0x57d005[_0x88c2('0x2e')]=_['keys'](db[_0x88c2('0x49')][_0x88c2('0x43')]);_0x57d005[_0x88c2('0x2f')]=_[_0x88c2('0x30')](_0x1928f8[_0x88c2('0x2f')]);_0x57d005['filters']=_[_0x88c2('0x32')](_0x57d005[_0x88c2('0x2e')],_0x57d005[_0x88c2('0x2f')]);_0x269e0c['attributes']=_[_0x88c2('0x32')](_0x57d005['model'],qs[_0x88c2('0x33')](_0x1928f8[_0x88c2('0x2f')][_0x88c2('0x33')]));_0x269e0c[_0x88c2('0x34')]=_0x269e0c['attributes'][_0x88c2('0x4a')]?_0x269e0c['attributes']:_0x57d005[_0x88c2('0x2e')];_0x269e0c[_0x88c2('0x36')]=qs['sort'](_0x1928f8['query'][_0x88c2('0x37')]);_0x269e0c[_0x88c2('0x3a')]=qs[_0x88c2('0x31')](_['pick'](_0x1928f8[_0x88c2('0x2f')],_0x57d005[_0x88c2('0x31')]));if(_0x1928f8[_0x88c2('0x2f')][_0x88c2('0x39')]){_0x269e0c[_0x88c2('0x3a')]=_[_0x88c2('0x3b')](_0x269e0c[_0x88c2('0x3a')],{'$or':_[_0x88c2('0x2c')](_0x269e0c['attributes'],function(_0x5e1c48){var _0x4a3de3={};_0x4a3de3[_0x5e1c48]={'$like':'%'+_0x1928f8['query'][_0x88c2('0x39')]+'%'};return _0x4a3de3;})});}_0x269e0c=_[_0x88c2('0x3b')]({},_0x269e0c,_0x1928f8[_0x88c2('0x3e')]);return _0x228712[_0x88c2('0x4c')](_0x269e0c);}})['then'](function(_0x29c8a8){if(_0x29c8a8){_0x38f57d=_0x29c8a8[_0x88c2('0x4a')];if(!_0x1928f8[_0x88c2('0x2f')][_0x88c2('0x35')](_0x88c2('0x4b'))){_0x269e0c[_0x88c2('0x1f')]=qs[_0x88c2('0x1f')](_0x1928f8[_0x88c2('0x2f')]['limit']);_0x269e0c[_0x88c2('0x1d')]=qs[_0x88c2('0x1d')](_0x1928f8[_0x88c2('0x2f')][_0x88c2('0x1d')]);}return _0x228712[_0x88c2('0x4c')](_0x269e0c);}})['then'](function(_0xcb9377){if(_0xcb9377){return _0xcb9377?{'count':_0x38f57d,'rows':_0xcb9377}:null;}})[_0x88c2('0x25')](respondWithResult(_0x1a4b71,null))[_0x88c2('0x41')](handleError(_0x1a4b71,null));};exports['getDescriptions']=function(_0x2b71d3,_0x28e24d,_0x5bf65b){var _0x32a22a={};var _0x2ca6f3={};var _0x32492c;var _0x3d9041;return db[_0x88c2('0x40')][_0x88c2('0x4d')]({'where':{'id':_0x2b71d3[_0x88c2('0x4e')]['id']}})[_0x88c2('0x25')](handleEntityNotFound(_0x28e24d,null))[_0x88c2('0x25')](function(_0x38d512){if(_0x38d512){_0x32492c=_0x38d512;_0x2ca6f3['model']=_[_0x88c2('0x30')](db[_0x88c2('0x49')]['rawAttributes']);_0x2ca6f3[_0x88c2('0x2f')]=_[_0x88c2('0x30')](_0x2b71d3[_0x88c2('0x2f')]);_0x2ca6f3[_0x88c2('0x31')]=_[_0x88c2('0x32')](_0x2ca6f3[_0x88c2('0x2e')],_0x2ca6f3[_0x88c2('0x2f')]);_0x32a22a[_0x88c2('0x34')]=_['intersection'](_0x2ca6f3[_0x88c2('0x2e')],qs['fields'](_0x2b71d3[_0x88c2('0x2f')]['fields']));_0x32a22a[_0x88c2('0x34')]=_0x32a22a[_0x88c2('0x34')][_0x88c2('0x4a')]?_0x32a22a[_0x88c2('0x34')]:_0x2ca6f3[_0x88c2('0x2e')];_0x32a22a[_0x88c2('0x36')]=qs['sort'](_0x2b71d3[_0x88c2('0x2f')][_0x88c2('0x37')]);_0x32a22a['where']=qs[_0x88c2('0x31')](_['pick'](_0x2b71d3[_0x88c2('0x2f')],_0x2ca6f3[_0x88c2('0x31')]));if(_0x2b71d3['query'][_0x88c2('0x39')]){_0x32a22a[_0x88c2('0x3a')]=_[_0x88c2('0x3b')](_0x32a22a[_0x88c2('0x3a')],{'$or':_[_0x88c2('0x2c')](_0x32a22a[_0x88c2('0x34')],function(_0x1c1be1){var _0x1bb32e={};_0x1bb32e[_0x1c1be1]={'$like':'%'+_0x2b71d3[_0x88c2('0x2f')][_0x88c2('0x39')]+'%'};return _0x1bb32e;})});}_0x32a22a=_[_0x88c2('0x3b')]({},_0x32a22a,_0x2b71d3[_0x88c2('0x3e')]);return _0x32492c[_0x88c2('0x4f')](_0x32a22a);}})[_0x88c2('0x25')](function(_0x2b89f1){if(_0x2b89f1){_0x3d9041=_0x2b89f1[_0x88c2('0x4a')];if(!_0x2b71d3[_0x88c2('0x2f')][_0x88c2('0x35')](_0x88c2('0x4b'))){_0x32a22a[_0x88c2('0x1f')]=qs[_0x88c2('0x1f')](_0x2b71d3[_0x88c2('0x2f')][_0x88c2('0x1f')]);_0x32a22a[_0x88c2('0x1d')]=qs[_0x88c2('0x1d')](_0x2b71d3[_0x88c2('0x2f')][_0x88c2('0x1d')]);}return _0x32492c[_0x88c2('0x4f')](_0x32a22a);}})[_0x88c2('0x25')](function(_0x276916){if(_0x276916){return _0x276916?{'count':_0x3d9041,'rows':_0x276916}:null;}})[_0x88c2('0x25')](respondWithResult(_0x28e24d,null))[_0x88c2('0x41')](handleError(_0x28e24d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2f6fc05..12bdfbc 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x2b1cdd,_0x1c47ef){var _0xc554f2=function(_0x4ad4e8){while(--_0x4ad4e8){_0x2b1cdd['push'](_0x2b1cdd['shift']());}};_0xc554f2(++_0x1c47ef);}(_0x3e74,0x175));var _0x43e7=function(_0x475d99,_0x17162a){_0x475d99=_0x475d99-0x0;var _0x92a3ad=_0x3e74[_0x475d99];return _0x92a3ad;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x3fe51e,_0x34060e){var _0xf53951=function(_0xfb680f){while(--_0xfb680f){_0x3fe51e['push'](_0x3fe51e['shift']());}};_0xf53951(++_0x34060e);}(_0xa41a,0x6b));var _0xaa41=function(_0x5ac0d9,_0x5463df){_0x5ac0d9=_0x5ac0d9-0x0;var _0x28e7d6=_0xa41a[_0x5ac0d9];return _0x28e7d6;};'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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 8aa85e1..ac0ad14 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 _0x90ed=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x59bcbf,_0x16bf47){var _0x42bec3=function(_0x290b72){while(--_0x290b72){_0x59bcbf['push'](_0x59bcbf['shift']());}};_0x42bec3(++_0x16bf47);}(_0x90ed,0x6e));var _0xd90e=function(_0x196478,_0x9dfb92){_0x196478=_0x196478-0x0;var _0x1e8251=_0x90ed[_0x196478];return _0x1e8251;};'use strict';var _=require('lodash');var util=require(_0xd90e('0x0'));var moment=require(_0xd90e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd90e('0x2'));var db=require(_0xd90e('0x3'))['db'];var utils=require(_0xd90e('0x4'));var logger=require(_0xd90e('0x5'))(_0xd90e('0x6'));var config=require(_0xd90e('0x7'));var jayson=require(_0xd90e('0x8'));var client=jayson[_0xd90e('0x9')][_0xd90e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x122730,_0x3ba834,_0x4d4157){return new BPromise(function(_0x18ab64,_0x37e3bc){return client[_0xd90e('0xb')](_0x122730,_0x4d4157)[_0xd90e('0xc')](function(_0xf8a529){logger[_0xd90e('0xd')](_0xd90e('0xe'),_0x3ba834,_0xd90e('0xf'));logger[_0xd90e('0x10')](_0xd90e('0x11'),_0x3ba834,'request\x20sent',JSON[_0xd90e('0x12')](_0xf8a529));if(_0xf8a529[_0xd90e('0x13')]){if(_0xf8a529[_0xd90e('0x13')][_0xd90e('0x14')]===0x1f4){logger[_0xd90e('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ba834,_0xf8a529[_0xd90e('0x13')][_0xd90e('0x15')]);return _0x37e3bc(_0xf8a529[_0xd90e('0x13')]['message']);}logger[_0xd90e('0x13')](_0xd90e('0xe'),_0x3ba834,_0xf8a529['error'][_0xd90e('0x15')]);return _0x18ab64(_0xf8a529[_0xd90e('0x13')][_0xd90e('0x15')]);}else{logger[_0xd90e('0xd')](_0xd90e('0xe'),_0x3ba834,_0xd90e('0xf'));_0x18ab64(_0xf8a529[_0xd90e('0x16')][_0xd90e('0x15')]);}})[_0xd90e('0x17')](function(_0x474bf0){logger[_0xd90e('0x13')](_0xd90e('0xe'),_0x3ba834,_0x474bf0);_0x37e3bc(_0x474bf0);});});} \ No newline at end of file +var _0xf41f=['catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x141683,_0x439c14){var _0x233d2e=function(_0x487347){while(--_0x487347){_0x141683['push'](_0x141683['shift']());}};_0x233d2e(++_0x439c14);}(_0xf41f,0x155));var _0xff41=function(_0x4757c6,_0x2bb129){_0x4757c6=_0x4757c6-0x0;var _0x327df8=_0xf41f[_0x4757c6];return _0x327df8;};'use strict';var _=require('lodash');var util=require(_0xff41('0x0'));var moment=require(_0xff41('0x1'));var BPromise=require('bluebird');var rs=require(_0xff41('0x2'));var fs=require('fs');var Redis=require(_0xff41('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff41('0x4'));var logger=require(_0xff41('0x5'))(_0xff41('0x6'));var config=require(_0xff41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff41('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab555,_0x2303dc,_0x177a44){return new BPromise(function(_0x4eca09,_0x3cbec5){return client[_0xff41('0x9')](_0x1ab555,_0x177a44)['then'](function(_0x5167bf){logger[_0xff41('0xa')](_0xff41('0xb'),_0x2303dc,_0xff41('0xc'));logger[_0xff41('0xd')](_0xff41('0xe'),_0x2303dc,_0xff41('0xc'),JSON['stringify'](_0x5167bf));if(_0x5167bf[_0xff41('0xf')]){if(_0x5167bf[_0xff41('0xf')][_0xff41('0x10')]===0x1f4){logger[_0xff41('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2303dc,_0x5167bf[_0xff41('0xf')]['message']);return _0x3cbec5(_0x5167bf[_0xff41('0xf')][_0xff41('0x11')]);}logger[_0xff41('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2303dc,_0x5167bf['error'][_0xff41('0x11')]);return _0x4eca09(_0x5167bf[_0xff41('0xf')]['message']);}else{logger[_0xff41('0xa')](_0xff41('0xb'),_0x2303dc,_0xff41('0xc'));_0x4eca09(_0x5167bf[_0xff41('0x12')][_0xff41('0x11')]);}})[_0xff41('0x13')](function(_0x1056cc){logger[_0xff41('0xf')](_0xff41('0xb'),_0x2303dc,_0x1056cc);_0x3cbec5(_0x1056cc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f5e6aa3..003eb9c 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 _0xbe6f=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','delete'];(function(_0x3a0d6b,_0x5f7469){var _0x3eca23=function(_0x187ee5){while(--_0x187ee5){_0x3a0d6b['push'](_0x3a0d6b['shift']());}};_0x3eca23(++_0x5f7469);}(_0xbe6f,0xcd));var _0xfbe6=function(_0x1d5c80,_0x70efa3){_0x1d5c80=_0x1d5c80-0x0;var _0x22e006=_0xbe6f[_0x1d5c80];return _0x22e006;};'use strict';var multer=require(_0xfbe6('0x0'));var util=require(_0xfbe6('0x1'));var path=require(_0xfbe6('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbe6('0x3'));var router=express[_0xfbe6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbe6('0x5'));var interaction=require(_0xfbe6('0x6'));var config=require('../../config/environment');var controller=require(_0xfbe6('0x7'));router[_0xfbe6('0x8')]('/',auth[_0xfbe6('0x9')](),controller[_0xfbe6('0xa')]);router[_0xfbe6('0x8')](_0xfbe6('0xb'),auth['isAuthenticated'](),controller[_0xfbe6('0xc')]);router[_0xfbe6('0xd')]('/',auth[_0xfbe6('0x9')](),controller['create']);router[_0xfbe6('0xe')](_0xfbe6('0xb'),auth[_0xfbe6('0x9')](),controller['update']);router[_0xfbe6('0xf')]('/:id',auth[_0xfbe6('0x9')](),controller['destroy']);module[_0xfbe6('0x10')]=router; \ No newline at end of file +var _0xe6c8=['show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x1ee7a7,_0x2478b0){var _0x291a52=function(_0x54718c){while(--_0x54718c){_0x1ee7a7['push'](_0x1ee7a7['shift']());}};_0x291a52(++_0x2478b0);}(_0xe6c8,0x1e6));var _0x8e6c=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe6c8[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x8e6c('0x0'));var util=require(_0x8e6c('0x1'));var path=require(_0x8e6c('0x2'));var timeout=require(_0x8e6c('0x3'));var express=require(_0x8e6c('0x4'));var router=express[_0x8e6c('0x5')]();var fs_extra=require(_0x8e6c('0x6'));var auth=require(_0x8e6c('0x7'));var interaction=require(_0x8e6c('0x8'));var config=require('../../config/environment');var controller=require(_0x8e6c('0x9'));router[_0x8e6c('0xa')]('/',auth[_0x8e6c('0xb')](),controller[_0x8e6c('0xc')]);router[_0x8e6c('0xa')](_0x8e6c('0xd'),auth[_0x8e6c('0xb')](),controller[_0x8e6c('0xe')]);router[_0x8e6c('0xf')]('/',auth[_0x8e6c('0xb')](),controller[_0x8e6c('0x10')]);router[_0x8e6c('0x11')](_0x8e6c('0xd'),auth[_0x8e6c('0xb')](),controller['update']);router[_0x8e6c('0x12')](_0x8e6c('0xd'),auth[_0x8e6c('0xb')](),controller['destroy']);module[_0x8e6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d498ca3..0d3b1cf 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 _0x25ba=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','customVariable'];(function(_0x44d09c,_0x4a8c0f){var _0x24fcf5=function(_0x46a023){while(--_0x46a023){_0x44d09c['push'](_0x44d09c['shift']());}};_0x24fcf5(++_0x4a8c0f);}(_0x25ba,0x18d));var _0xa25b=function(_0x38502b,_0x393d71){_0x38502b=_0x38502b-0x0;var _0x1d0cee=_0x25ba[_0x38502b];return _0x1d0cee;};'use strict';var Sequelize=require(_0xa25b('0x0'));module[_0xa25b('0x1')]={'type':{'type':Sequelize[_0xa25b('0x2')](_0xa25b('0x3'),'variable','customVariable',_0xa25b('0x4'),_0xa25b('0x5')),'defaultValue':_0xa25b('0x3')},'content':{'type':Sequelize[_0xa25b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa25b('0x2')](_0xa25b('0x3'),'variable',_0xa25b('0x7'))},'keyContent':{'type':Sequelize[_0xa25b('0x6')]},'idField':{'type':Sequelize[_0xa25b('0x6')]},'nameField':{'type':Sequelize[_0xa25b('0x6')]},'customField':{'type':Sequelize[_0xa25b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa25b('0x6')]}}; \ No newline at end of file +var _0xb371=['variable','picklist','string','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x52b0e2,_0x24aad0){var _0xc8d52a=function(_0x1507fc){while(--_0x1507fc){_0x52b0e2['push'](_0x52b0e2['shift']());}};_0xc8d52a(++_0x24aad0);}(_0xb371,0xe6));var _0x1b37=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb371[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1b37('0x0')]('string',_0x1b37('0x1'),'customVariable','keyValue',_0x1b37('0x2')),'defaultValue':_0x1b37('0x3')},'content':{'type':Sequelize[_0x1b37('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1b37('0x0')]('string','variable',_0x1b37('0x5'))},'keyContent':{'type':Sequelize[_0x1b37('0x4')]},'idField':{'type':Sequelize[_0x1b37('0x4')]},'nameField':{'type':Sequelize[_0x1b37('0x4')]},'customField':{'type':Sequelize[_0x1b37('0x6')],'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 a44bcb1..0b7b1e4 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 _0xecc5=['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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','Dynamics365Field','includeAll','findAll','show','params','include','create','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xecc5,0x124));var _0x5ecc=function(_0x3efcab,_0x228866){_0x3efcab=_0x3efcab-0x0;var _0x5d2621=_0xecc5[_0x3efcab];return _0x5d2621;};'use strict';var emlformat=require(_0x5ecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ecc('0x1'));var jsonpatch=require(_0x5ecc('0x2'));var rp=require(_0x5ecc('0x3'));var moment=require(_0x5ecc('0x4'));var BPromise=require(_0x5ecc('0x5'));var Mustache=require(_0x5ecc('0x6'));var util=require(_0x5ecc('0x7'));var path=require(_0x5ecc('0x8'));var sox=require(_0x5ecc('0x9'));var csv=require(_0x5ecc('0xa'));var ejs=require(_0x5ecc('0xb'));var fs=require('fs');var fs_extra=require(_0x5ecc('0xc'));var _=require(_0x5ecc('0xd'));var squel=require(_0x5ecc('0xe'));var crypto=require(_0x5ecc('0xf'));var jsforce=require(_0x5ecc('0x10'));var deskjs=require(_0x5ecc('0x11'));var toCsv=require(_0x5ecc('0xa'));var querystring=require(_0x5ecc('0x12'));var Papa=require(_0x5ecc('0x13'));var Redis=require(_0x5ecc('0x14'));var authService=require(_0x5ecc('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5ecc('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ecc('0x17'))(_0x5ecc('0x18'));var utils=require(_0x5ecc('0x19'));var config=require(_0x5ecc('0x1a'));var licenseUtil=require(_0x5ecc('0x1b'));var db=require(_0x5ecc('0x1c'))['db'];function respondWithStatusCode(_0x247561,_0x257d99){_0x257d99=_0x257d99||0xcc;return function(_0x1af534){if(_0x1af534){return _0x247561[_0x5ecc('0x1d')](_0x257d99);}return _0x247561[_0x5ecc('0x1e')](_0x257d99)[_0x5ecc('0x1f')]();};}function respondWithResult(_0x2f74be,_0x4ec0e4){_0x4ec0e4=_0x4ec0e4||0xc8;return function(_0x1b2d65){if(_0x1b2d65){return _0x2f74be[_0x5ecc('0x1e')](_0x4ec0e4)[_0x5ecc('0x20')](_0x1b2d65);}};}function respondWithFilteredResult(_0x33af8b,_0x1b3696){return function(_0x438222){if(_0x438222){var _0x13e935=typeof _0x1b3696[_0x5ecc('0x21')]===_0x5ecc('0x22')&&typeof _0x1b3696[_0x5ecc('0x23')]===_0x5ecc('0x22');var _0x2824c9=_0x438222[_0x5ecc('0x24')];var _0x50ecfa=_0x13e935?0x0:_0x1b3696[_0x5ecc('0x21')];var _0x593f30=_0x13e935?_0x438222['count']:_0x1b3696['offset']+_0x1b3696[_0x5ecc('0x23')];var _0x2c3b8e;if(_0x593f30>=_0x2824c9){_0x593f30=_0x2824c9;_0x2c3b8e=0xc8;}else{_0x2c3b8e=0xce;}_0x33af8b['status'](_0x2c3b8e);return _0x33af8b[_0x5ecc('0x25')](_0x5ecc('0x26'),_0x50ecfa+'-'+_0x593f30+'/'+_0x2824c9)[_0x5ecc('0x20')](_0x438222);}return null;};}function patchUpdates(_0x3d15ed){return function(_0x174702){try{jsonpatch[_0x5ecc('0x27')](_0x174702,_0x3d15ed,!![]);}catch(_0x5adafb){return BPromise[_0x5ecc('0x28')](_0x5adafb);}return _0x174702[_0x5ecc('0x29')]();};}function saveUpdates(_0x48a074,_0x4c9842){return function(_0xdfc5b7){if(_0xdfc5b7){return _0xdfc5b7[_0x5ecc('0x2a')](_0x48a074)['then'](function(_0x390cec){return _0x390cec;});}return null;};}function removeEntity(_0x3441ec,_0xf5ae34){return function(_0x2ee55f){if(_0x2ee55f){return _0x2ee55f[_0x5ecc('0x2b')]()[_0x5ecc('0x2c')](function(){_0x3441ec[_0x5ecc('0x1e')](0xcc)[_0x5ecc('0x1f')]();});}};}function handleEntityNotFound(_0x132903,_0x2c4669){return function(_0x1e8694){if(!_0x1e8694){_0x132903[_0x5ecc('0x1d')](0x194);}return _0x1e8694;};}function handleError(_0x1bcbc9,_0x2b3d1c){_0x2b3d1c=_0x2b3d1c||0x1f4;return function(_0xaab535){logger['error'](_0xaab535[_0x5ecc('0x2d')]);if(_0xaab535[_0x5ecc('0x2e')]){delete _0xaab535[_0x5ecc('0x2e')];}_0x1bcbc9[_0x5ecc('0x1e')](_0x2b3d1c)[_0x5ecc('0x2f')](_0xaab535);};}exports['index']=function(_0x269f8c,_0x28abaf){var _0x3eadad={},_0x42ecd1={},_0x72eb0b={'count':0x0,'rows':[]};var _0x5393a9=_[_0x5ecc('0x30')](db['Dynamics365Field'][_0x5ecc('0x31')],function(_0x42a441){return{'name':_0x42a441[_0x5ecc('0x32')],'type':_0x42a441[_0x5ecc('0x33')][_0x5ecc('0x34')]};});_0x42ecd1[_0x5ecc('0x35')]=_[_0x5ecc('0x30')](_0x5393a9,_0x5ecc('0x2e'));_0x42ecd1[_0x5ecc('0x36')]=_[_0x5ecc('0x37')](_0x269f8c[_0x5ecc('0x36')]);_0x42ecd1[_0x5ecc('0x38')]=_['intersection'](_0x42ecd1[_0x5ecc('0x35')],_0x42ecd1[_0x5ecc('0x36')]);_0x3eadad['attributes']=_[_0x5ecc('0x39')](_0x42ecd1['model'],qs['fields'](_0x269f8c[_0x5ecc('0x36')][_0x5ecc('0x3a')]));_0x3eadad[_0x5ecc('0x3b')]=_0x3eadad[_0x5ecc('0x3b')][_0x5ecc('0x3c')]?_0x3eadad['attributes']:_0x42ecd1[_0x5ecc('0x35')];if(!_0x269f8c[_0x5ecc('0x36')]['hasOwnProperty'](_0x5ecc('0x3d'))){_0x3eadad['limit']=qs[_0x5ecc('0x23')](_0x269f8c[_0x5ecc('0x36')]['limit']);_0x3eadad[_0x5ecc('0x21')]=qs[_0x5ecc('0x21')](_0x269f8c[_0x5ecc('0x36')]['offset']);}_0x3eadad[_0x5ecc('0x3e')]=qs[_0x5ecc('0x3f')](_0x269f8c[_0x5ecc('0x36')]['sort']);_0x3eadad[_0x5ecc('0x40')]=qs[_0x5ecc('0x38')](_['pick'](_0x269f8c[_0x5ecc('0x36')],_0x42ecd1[_0x5ecc('0x38')]),_0x5393a9);if(_0x269f8c[_0x5ecc('0x36')]['filter']){_0x3eadad[_0x5ecc('0x40')]=_[_0x5ecc('0x41')](_0x3eadad[_0x5ecc('0x40')],{'$or':_[_0x5ecc('0x30')](_0x5393a9,function(_0x2fd21b){if(_0x2fd21b[_0x5ecc('0x33')]!==_0x5ecc('0x42')){var _0x1982fe={};_0x1982fe[_0x2fd21b[_0x5ecc('0x2e')]]={'$like':'%'+_0x269f8c['query']['filter']+'%'};return _0x1982fe;}})});}_0x3eadad=_[_0x5ecc('0x41')]({},_0x3eadad,_0x269f8c['options']);var _0x2f7730={'where':_0x3eadad[_0x5ecc('0x40')]};return db[_0x5ecc('0x43')][_0x5ecc('0x24')](_0x2f7730)[_0x5ecc('0x2c')](function(_0x536c37){_0x72eb0b['count']=_0x536c37;if(_0x269f8c['query'][_0x5ecc('0x44')]){_0x3eadad['include']=[{'all':!![]}];}return db[_0x5ecc('0x43')][_0x5ecc('0x45')](_0x3eadad);})[_0x5ecc('0x2c')](function(_0x4463aa){_0x72eb0b['rows']=_0x4463aa;return _0x72eb0b;})[_0x5ecc('0x2c')](respondWithFilteredResult(_0x28abaf,_0x3eadad))['catch'](handleError(_0x28abaf,null));};exports[_0x5ecc('0x46')]=function(_0x430b0d,_0x45542d){var _0x30a11c={'raw':!![],'where':{'id':_0x430b0d[_0x5ecc('0x47')]['id']}},_0x2898a1={};_0x2898a1[_0x5ecc('0x35')]=_['keys'](db['Dynamics365Field'][_0x5ecc('0x31')]);_0x2898a1[_0x5ecc('0x36')]=_[_0x5ecc('0x37')](_0x430b0d[_0x5ecc('0x36')]);_0x2898a1[_0x5ecc('0x38')]=_[_0x5ecc('0x39')](_0x2898a1[_0x5ecc('0x35')],_0x2898a1[_0x5ecc('0x36')]);_0x30a11c[_0x5ecc('0x3b')]=_[_0x5ecc('0x39')](_0x2898a1['model'],qs['fields'](_0x430b0d[_0x5ecc('0x36')][_0x5ecc('0x3a')]));_0x30a11c[_0x5ecc('0x3b')]=_0x30a11c[_0x5ecc('0x3b')]['length']?_0x30a11c['attributes']:_0x2898a1[_0x5ecc('0x35')];if(_0x430b0d[_0x5ecc('0x36')][_0x5ecc('0x44')]){_0x30a11c[_0x5ecc('0x48')]=[{'all':!![]}];}_0x30a11c=_[_0x5ecc('0x41')]({},_0x30a11c,_0x430b0d['options']);return db[_0x5ecc('0x43')]['find'](_0x30a11c)[_0x5ecc('0x2c')](handleEntityNotFound(_0x45542d,null))[_0x5ecc('0x2c')](respondWithResult(_0x45542d,null))['catch'](handleError(_0x45542d,null));};exports['create']=function(_0x2fe64b,_0x368264){return db['Dynamics365Field'][_0x5ecc('0x49')](_0x2fe64b['body'],{})['then'](respondWithResult(_0x368264,0xc9))[_0x5ecc('0x4a')](handleError(_0x368264,null));};exports[_0x5ecc('0x2a')]=function(_0xe33133,_0x25f59c){if(_0xe33133[_0x5ecc('0x4b')]['id']){delete _0xe33133[_0x5ecc('0x4b')]['id'];}return db['Dynamics365Field'][_0x5ecc('0x4c')]({'where':{'id':_0xe33133['params']['id']}})['then'](handleEntityNotFound(_0x25f59c,null))[_0x5ecc('0x2c')](saveUpdates(_0xe33133[_0x5ecc('0x4b')],null))[_0x5ecc('0x2c')](respondWithResult(_0x25f59c,null))[_0x5ecc('0x4a')](handleError(_0x25f59c,null));};exports[_0x5ecc('0x2b')]=function(_0x4894eb,_0x3ab111){return db[_0x5ecc('0x43')][_0x5ecc('0x4c')]({'where':{'id':_0x4894eb[_0x5ecc('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ab111,null))[_0x5ecc('0x2c')](removeEntity(_0x3ab111,null))[_0x5ecc('0x4a')](handleError(_0x3ab111,null));}; \ No newline at end of file +var _0x1e3a=['Dynamics365Field','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','rows','catch','params','rawAttributes','length','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x26a1dc,_0x380fb3){var _0x529678=function(_0x2c8c14){while(--_0x2c8c14){_0x26a1dc['push'](_0x26a1dc['shift']());}};_0x529678(++_0x380fb3);}(_0x1e3a,0xb1));var _0xa1e3=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0x1e3a[_0x3388d8];return _0x2bbe73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1e3('0x0'));var zipdir=require(_0xa1e3('0x1'));var jsonpatch=require(_0xa1e3('0x2'));var rp=require(_0xa1e3('0x3'));var moment=require(_0xa1e3('0x4'));var BPromise=require(_0xa1e3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa1e3('0x6'));var sox=require(_0xa1e3('0x7'));var csv=require(_0xa1e3('0x8'));var ejs=require(_0xa1e3('0x9'));var fs=require('fs');var fs_extra=require(_0xa1e3('0xa'));var _=require('lodash');var squel=require(_0xa1e3('0xb'));var crypto=require(_0xa1e3('0xc'));var jsforce=require(_0xa1e3('0xd'));var deskjs=require(_0xa1e3('0xe'));var toCsv=require(_0xa1e3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa1e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1e3('0x11'));var logger=require(_0xa1e3('0x12'))(_0xa1e3('0x13'));var utils=require(_0xa1e3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa1e3('0x15'))['db'];function respondWithStatusCode(_0x10a1b5,_0x15faf2){_0x15faf2=_0x15faf2||0xcc;return function(_0x117bc9){if(_0x117bc9){return _0x10a1b5[_0xa1e3('0x16')](_0x15faf2);}return _0x10a1b5[_0xa1e3('0x17')](_0x15faf2)[_0xa1e3('0x18')]();};}function respondWithResult(_0x39e27f,_0x2127bf){_0x2127bf=_0x2127bf||0xc8;return function(_0x468211){if(_0x468211){return _0x39e27f['status'](_0x2127bf)[_0xa1e3('0x19')](_0x468211);}};}function respondWithFilteredResult(_0x47c86b,_0x579631){return function(_0x6ef5ed){if(_0x6ef5ed){var _0x3085d2=typeof _0x579631[_0xa1e3('0x1a')]===_0xa1e3('0x1b')&&typeof _0x579631[_0xa1e3('0x1c')]===_0xa1e3('0x1b');var _0x32affc=_0x6ef5ed[_0xa1e3('0x1d')];var _0x5ab4ed=_0x3085d2?0x0:_0x579631[_0xa1e3('0x1a')];var _0x5b1493=_0x3085d2?_0x6ef5ed[_0xa1e3('0x1d')]:_0x579631[_0xa1e3('0x1a')]+_0x579631[_0xa1e3('0x1c')];var _0x1c0b2c;if(_0x5b1493>=_0x32affc){_0x5b1493=_0x32affc;_0x1c0b2c=0xc8;}else{_0x1c0b2c=0xce;}_0x47c86b[_0xa1e3('0x17')](_0x1c0b2c);return _0x47c86b[_0xa1e3('0x1e')](_0xa1e3('0x1f'),_0x5ab4ed+'-'+_0x5b1493+'/'+_0x32affc)[_0xa1e3('0x19')](_0x6ef5ed);}return null;};}function patchUpdates(_0x3f290e){return function(_0x173e36){try{jsonpatch[_0xa1e3('0x20')](_0x173e36,_0x3f290e,!![]);}catch(_0x471d62){return BPromise[_0xa1e3('0x21')](_0x471d62);}return _0x173e36[_0xa1e3('0x22')]();};}function saveUpdates(_0x3f3a43,_0x414336){return function(_0x3bead1){if(_0x3bead1){return _0x3bead1['update'](_0x3f3a43)[_0xa1e3('0x23')](function(_0x5cc24e){return _0x5cc24e;});}return null;};}function removeEntity(_0x3502bd,_0x25e6be){return function(_0x282e1e){if(_0x282e1e){return _0x282e1e[_0xa1e3('0x24')]()[_0xa1e3('0x23')](function(){_0x3502bd[_0xa1e3('0x17')](0xcc)[_0xa1e3('0x18')]();});}};}function handleEntityNotFound(_0x3aceea,_0x4095c2){return function(_0x3e4d10){if(!_0x3e4d10){_0x3aceea['sendStatus'](0x194);}return _0x3e4d10;};}function handleError(_0x3e98bb,_0x1c9872){_0x1c9872=_0x1c9872||0x1f4;return function(_0x16563c){logger[_0xa1e3('0x25')](_0x16563c[_0xa1e3('0x26')]);if(_0x16563c[_0xa1e3('0x27')]){delete _0x16563c[_0xa1e3('0x27')];}_0x3e98bb[_0xa1e3('0x17')](_0x1c9872)[_0xa1e3('0x28')](_0x16563c);};}exports[_0xa1e3('0x29')]=function(_0x104db2,_0x2add17){var _0x576688={},_0x20038b={},_0x3fd2c1={'count':0x0,'rows':[]};var _0x3c3d13=_['map'](db[_0xa1e3('0x2a')]['rawAttributes'],function(_0x3e3c7f){return{'name':_0x3e3c7f[_0xa1e3('0x2b')],'type':_0x3e3c7f[_0xa1e3('0x2c')][_0xa1e3('0x2d')]};});_0x20038b[_0xa1e3('0x2e')]=_[_0xa1e3('0x2f')](_0x3c3d13,_0xa1e3('0x27'));_0x20038b[_0xa1e3('0x30')]=_[_0xa1e3('0x31')](_0x104db2[_0xa1e3('0x30')]);_0x20038b['filters']=_[_0xa1e3('0x32')](_0x20038b[_0xa1e3('0x2e')],_0x20038b[_0xa1e3('0x30')]);_0x576688['attributes']=_['intersection'](_0x20038b[_0xa1e3('0x2e')],qs[_0xa1e3('0x33')](_0x104db2[_0xa1e3('0x30')][_0xa1e3('0x33')]));_0x576688[_0xa1e3('0x34')]=_0x576688[_0xa1e3('0x34')]['length']?_0x576688[_0xa1e3('0x34')]:_0x20038b[_0xa1e3('0x2e')];if(!_0x104db2[_0xa1e3('0x30')][_0xa1e3('0x35')](_0xa1e3('0x36'))){_0x576688[_0xa1e3('0x1c')]=qs['limit'](_0x104db2[_0xa1e3('0x30')][_0xa1e3('0x1c')]);_0x576688['offset']=qs[_0xa1e3('0x1a')](_0x104db2[_0xa1e3('0x30')]['offset']);}_0x576688[_0xa1e3('0x37')]=qs[_0xa1e3('0x38')](_0x104db2[_0xa1e3('0x30')]['sort']);_0x576688['where']=qs[_0xa1e3('0x39')](_['pick'](_0x104db2[_0xa1e3('0x30')],_0x20038b[_0xa1e3('0x39')]),_0x3c3d13);if(_0x104db2['query'][_0xa1e3('0x3a')]){_0x576688[_0xa1e3('0x3b')]=_[_0xa1e3('0x3c')](_0x576688[_0xa1e3('0x3b')],{'$or':_[_0xa1e3('0x2f')](_0x3c3d13,function(_0x328142){if(_0x328142[_0xa1e3('0x2c')]!=='VIRTUAL'){var _0xfebd5d={};_0xfebd5d[_0x328142[_0xa1e3('0x27')]]={'$like':'%'+_0x104db2[_0xa1e3('0x30')]['filter']+'%'};return _0xfebd5d;}})});}_0x576688=_[_0xa1e3('0x3c')]({},_0x576688,_0x104db2[_0xa1e3('0x3d')]);var _0x655976={'where':_0x576688[_0xa1e3('0x3b')]};return db[_0xa1e3('0x2a')][_0xa1e3('0x1d')](_0x655976)[_0xa1e3('0x23')](function(_0x5826f5){_0x3fd2c1['count']=_0x5826f5;if(_0x104db2[_0xa1e3('0x30')][_0xa1e3('0x3e')]){_0x576688['include']=[{'all':!![]}];}return db[_0xa1e3('0x2a')]['findAll'](_0x576688);})[_0xa1e3('0x23')](function(_0x2e1691){_0x3fd2c1[_0xa1e3('0x3f')]=_0x2e1691;return _0x3fd2c1;})[_0xa1e3('0x23')](respondWithFilteredResult(_0x2add17,_0x576688))[_0xa1e3('0x40')](handleError(_0x2add17,null));};exports['show']=function(_0x3d55da,_0x18a70d){var _0x4538ef={'raw':!![],'where':{'id':_0x3d55da[_0xa1e3('0x41')]['id']}},_0x429f0d={};_0x429f0d[_0xa1e3('0x2e')]=_[_0xa1e3('0x31')](db[_0xa1e3('0x2a')][_0xa1e3('0x42')]);_0x429f0d[_0xa1e3('0x30')]=_[_0xa1e3('0x31')](_0x3d55da['query']);_0x429f0d[_0xa1e3('0x39')]=_[_0xa1e3('0x32')](_0x429f0d['model'],_0x429f0d['query']);_0x4538ef['attributes']=_[_0xa1e3('0x32')](_0x429f0d['model'],qs[_0xa1e3('0x33')](_0x3d55da[_0xa1e3('0x30')][_0xa1e3('0x33')]));_0x4538ef[_0xa1e3('0x34')]=_0x4538ef['attributes'][_0xa1e3('0x43')]?_0x4538ef[_0xa1e3('0x34')]:_0x429f0d[_0xa1e3('0x2e')];if(_0x3d55da[_0xa1e3('0x30')][_0xa1e3('0x3e')]){_0x4538ef[_0xa1e3('0x44')]=[{'all':!![]}];}_0x4538ef=_[_0xa1e3('0x3c')]({},_0x4538ef,_0x3d55da['options']);return db[_0xa1e3('0x2a')][_0xa1e3('0x45')](_0x4538ef)[_0xa1e3('0x23')](handleEntityNotFound(_0x18a70d,null))['then'](respondWithResult(_0x18a70d,null))[_0xa1e3('0x40')](handleError(_0x18a70d,null));};exports['create']=function(_0x1e96e0,_0x257a5d){return db[_0xa1e3('0x2a')][_0xa1e3('0x46')](_0x1e96e0[_0xa1e3('0x47')],{})['then'](respondWithResult(_0x257a5d,0xc9))[_0xa1e3('0x40')](handleError(_0x257a5d,null));};exports[_0xa1e3('0x48')]=function(_0x2df96c,_0x4c870b){if(_0x2df96c[_0xa1e3('0x47')]['id']){delete _0x2df96c[_0xa1e3('0x47')]['id'];}return db[_0xa1e3('0x2a')][_0xa1e3('0x45')]({'where':{'id':_0x2df96c['params']['id']}})['then'](handleEntityNotFound(_0x4c870b,null))[_0xa1e3('0x23')](saveUpdates(_0x2df96c['body'],null))['then'](respondWithResult(_0x4c870b,null))[_0xa1e3('0x40')](handleError(_0x4c870b,null));};exports[_0xa1e3('0x24')]=function(_0x4ec7ac,_0x2e4a0e){return db[_0xa1e3('0x2a')]['find']({'where':{'id':_0x4ec7ac[_0xa1e3('0x41')]['id']}})[_0xa1e3('0x23')](handleEntityNotFound(_0x2e4a0e,null))[_0xa1e3('0x23')](removeEntity(_0x2e4a0e,null))['catch'](handleError(_0x2e4a0e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 44793a3..51079ac 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 _0xfa60=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x365143,_0x46fd86){var _0x45bb49=function(_0x20bb4b){while(--_0x20bb4b){_0x365143['push'](_0x365143['shift']());}};_0x45bb49(++_0x46fd86);}(_0xfa60,0x16f));var _0x0fa6=function(_0x241437,_0x25cc06){_0x241437=_0x241437-0x0;var _0x26fadf=_0xfa60[_0x241437];return _0x26fadf;};'use strict';var _=require(_0x0fa6('0x0'));var util=require(_0x0fa6('0x1'));var logger=require(_0x0fa6('0x2'))('api');var moment=require(_0x0fa6('0x3'));var BPromise=require('bluebird');var rp=require(_0x0fa6('0x4'));var fs=require('fs');var path=require(_0x0fa6('0x5'));var rimraf=require(_0x0fa6('0x6'));var config=require(_0x0fa6('0x7'));var attributes=require(_0x0fa6('0x8'));module[_0x0fa6('0x9')]=function(_0x9bf77,_0x5dcaf9){return _0x9bf77[_0x0fa6('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0fa6('0xb'),'fields':[_0x0fa6('0xc'),_0x0fa6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x339c=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x4494bd,_0x5d4c66){var _0x49ede9=function(_0x360670){while(--_0x360670){_0x4494bd['push'](_0x4494bd['shift']());}};_0x49ede9(++_0x5d4c66);}(_0x339c,0x175));var _0xc339=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x339c[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0xc339('0x0'));var util=require(_0xc339('0x1'));var logger=require('../../config/logger')(_0xc339('0x2'));var moment=require(_0xc339('0x3'));var BPromise=require(_0xc339('0x4'));var rp=require(_0xc339('0x5'));var fs=require('fs');var path=require(_0xc339('0x6'));var rimraf=require(_0xc339('0x7'));var config=require('../../config/environment');var attributes=require(_0xc339('0x8'));module[_0xc339('0x9')]=function(_0x2f2083,_0x4f331d){return _0x2f2083[_0xc339('0xa')](_0xc339('0xb'),attributes,{'tableName':_0xc339('0xc'),'paranoid':![],'indexes':[{'name':_0xc339('0xd'),'fields':[_0xc339('0xe'),_0xc339('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2702e0e..857bda6 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 _0xa699=['stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x458172,_0x15c780){var _0x14aba1=function(_0x3976a7){while(--_0x3976a7){_0x458172['push'](_0x458172['shift']());}};_0x14aba1(++_0x15c780);}(_0xa699,0xc6));var _0x9a69=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xa699[_0x39ffd1];return _0x31267e;};'use strict';var _=require('lodash');var util=require(_0x9a69('0x0'));var moment=require(_0x9a69('0x1'));var BPromise=require(_0x9a69('0x2'));var rs=require(_0x9a69('0x3'));var fs=require('fs');var Redis=require(_0x9a69('0x4'));var db=require(_0x9a69('0x5'))['db'];var utils=require(_0x9a69('0x6'));var logger=require(_0x9a69('0x7'))(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9a69('0xa')][_0x9a69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6025e3,_0x30624a,_0x5204ed){return new BPromise(function(_0x3a987f,_0x46f98b){return client[_0x9a69('0xc')](_0x6025e3,_0x5204ed)[_0x9a69('0xd')](function(_0x2409e6){logger['info'](_0x9a69('0xe'),_0x30624a,_0x9a69('0xf'));logger[_0x9a69('0x10')](_0x9a69('0x11'),_0x30624a,_0x9a69('0xf'),JSON[_0x9a69('0x12')](_0x2409e6));if(_0x2409e6[_0x9a69('0x13')]){if(_0x2409e6[_0x9a69('0x13')][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')](_0x9a69('0xe'),_0x30624a,_0x2409e6[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x46f98b(_0x2409e6[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x30624a,_0x2409e6[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x3a987f(_0x2409e6['error'][_0x9a69('0x15')]);}else{logger[_0x9a69('0x16')](_0x9a69('0xe'),_0x30624a,_0x9a69('0xf'));_0x3a987f(_0x2409e6['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x729c51){logger[_0x9a69('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x30624a,_0x729c51);_0x46f98b(_0x729c51);});});} \ No newline at end of file +var _0xb8d2=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message'];(function(_0x175136,_0x5cefc5){var _0x5931cc=function(_0x46aab7){while(--_0x46aab7){_0x175136['push'](_0x175136['shift']());}};_0x5931cc(++_0x5cefc5);}(_0xb8d2,0x15a));var _0x2b8d=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0xb8d2[_0x208749];return _0x3e0042;};'use strict';var _=require(_0x2b8d('0x0'));var util=require(_0x2b8d('0x1'));var moment=require(_0x2b8d('0x2'));var BPromise=require(_0x2b8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b8d('0x4'));var db=require(_0x2b8d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b8d('0x6'))(_0x2b8d('0x7'));var config=require(_0x2b8d('0x8'));var jayson=require(_0x2b8d('0x9'));var client=jayson[_0x2b8d('0xa')][_0x2b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x728d13,_0xf3bd2c,_0x417209){return new BPromise(function(_0x1cc8fd,_0x500e5e){return client[_0x2b8d('0xc')](_0x728d13,_0x417209)[_0x2b8d('0xd')](function(_0x5aa683){logger[_0x2b8d('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0xf3bd2c,'request\x20sent');logger[_0x2b8d('0xf')](_0x2b8d('0x10'),_0xf3bd2c,'request\x20sent',JSON[_0x2b8d('0x11')](_0x5aa683));if(_0x5aa683[_0x2b8d('0x12')]){if(_0x5aa683[_0x2b8d('0x12')][_0x2b8d('0x13')]===0x1f4){logger['error'](_0x2b8d('0x14'),_0xf3bd2c,_0x5aa683[_0x2b8d('0x12')]['message']);return _0x500e5e(_0x5aa683[_0x2b8d('0x12')][_0x2b8d('0x15')]);}logger['error'](_0x2b8d('0x14'),_0xf3bd2c,_0x5aa683[_0x2b8d('0x12')][_0x2b8d('0x15')]);return _0x1cc8fd(_0x5aa683[_0x2b8d('0x12')][_0x2b8d('0x15')]);}else{logger[_0x2b8d('0xe')](_0x2b8d('0x14'),_0xf3bd2c,'request\x20sent');_0x1cc8fd(_0x5aa683[_0x2b8d('0x16')][_0x2b8d('0x15')]);}})['catch'](function(_0x32525){logger[_0x2b8d('0x12')](_0x2b8d('0x14'),_0xf3bd2c,_0x32525);_0x500e5e(_0x32525);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f093413..3a48820 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 _0xefa4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','update','destroy','multer','util','path'];(function(_0x4780dc,_0x24dd9a){var _0x5cdc2c=function(_0x5e63ac){while(--_0x5e63ac){_0x4780dc['push'](_0x4780dc['shift']());}};_0x5cdc2c(++_0x24dd9a);}(_0xefa4,0x19f));var _0x4efa=function(_0x239094,_0x19d8ff){_0x239094=_0x239094-0x0;var _0x2aba33=_0xefa4[_0x239094];return _0x2aba33;};'use strict';var multer=require(_0x4efa('0x0'));var util=require(_0x4efa('0x1'));var path=require(_0x4efa('0x2'));var timeout=require(_0x4efa('0x3'));var express=require(_0x4efa('0x4'));var router=express[_0x4efa('0x5')]();var fs_extra=require(_0x4efa('0x6'));var auth=require(_0x4efa('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x4efa('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4efa('0x8')](_0x4efa('0x9'),auth[_0x4efa('0xa')](),controller[_0x4efa('0xb')]);router[_0x4efa('0x8')]('/:id/configurations',auth[_0x4efa('0xa')](),controller[_0x4efa('0xc')]);router[_0x4efa('0x8')](_0x4efa('0xd'),auth[_0x4efa('0xa')](),controller[_0x4efa('0xe')]);router['post']('/',auth[_0x4efa('0xa')](),controller['create']);router[_0x4efa('0xf')](_0x4efa('0x10'),auth[_0x4efa('0xa')](),controller['addConfiguration']);router['put'](_0x4efa('0x9'),auth[_0x4efa('0xa')](),controller[_0x4efa('0x11')]);router['delete']('/:id',auth[_0x4efa('0xa')](),controller[_0x4efa('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdc94=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','getConfigurations','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','exports','multer','path','connect-timeout'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xdc94,0xad));var _0x4dc9=function(_0x202388,_0x48d6c8){_0x202388=_0x202388-0x0;var _0x316e54=_0xdc94[_0x202388];return _0x316e54;};'use strict';var multer=require(_0x4dc9('0x0'));var util=require('util');var path=require(_0x4dc9('0x1'));var timeout=require(_0x4dc9('0x2'));var express=require(_0x4dc9('0x3'));var router=express[_0x4dc9('0x4')]();var fs_extra=require(_0x4dc9('0x5'));var auth=require(_0x4dc9('0x6'));var interaction=require(_0x4dc9('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x4dc9('0x8')](),controller['index']);router['get'](_0x4dc9('0x9'),auth[_0x4dc9('0x8')](),controller[_0x4dc9('0xa')]);router['get']('/:id/configurations',auth[_0x4dc9('0x8')](),controller[_0x4dc9('0xb')]);router[_0x4dc9('0xc')](_0x4dc9('0xd'),auth['isAuthenticated'](),controller[_0x4dc9('0xe')]);router[_0x4dc9('0xf')]('/',auth[_0x4dc9('0x8')](),controller[_0x4dc9('0x10')]);router[_0x4dc9('0xf')](_0x4dc9('0x11'),auth[_0x4dc9('0x8')](),controller[_0x4dc9('0x12')]);router[_0x4dc9('0x13')]('/:id',auth[_0x4dc9('0x8')](),controller[_0x4dc9('0x14')]);router['delete'](_0x4dc9('0x9'),auth[_0x4dc9('0x8')](),controller['destroy']);module[_0x4dc9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0c2a9c3..762d2df 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 _0x1a85=['STRING','remoteUri'];(function(_0x3520a3,_0x585b4e){var _0x266257=function(_0x4d763a){while(--_0x4d763a){_0x3520a3['push'](_0x3520a3['shift']());}};_0x266257(++_0x585b4e);}(_0x1a85,0x178));var _0x51a8=function(_0x953a55,_0x736d43){_0x953a55=_0x953a55-0x0;var _0x43fa9a=_0x1a85[_0x953a55];return _0x43fa9a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x5ccd30,_0x29f984){var _0x509096=function(_0x527c0e){while(--_0x527c0e){_0x5ccd30['push'](_0x5ccd30['shift']());}};_0x509096(++_0x29f984);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0b0e[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 14654e8..0ed7a93 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 _0x2e31=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','merge','options','includeAll','include','FreshdeskAccount','findAll','rows','show','params','keys','create','body','catch','find','getConfigurations','findOne','FreshdeskConfiguration','order','pick','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','format','apiKey','toString','base64','requester','subject','agent','description','priority','source','group','remove','includes','custom_text','custom_dropdown','default','choices','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x31ed63,_0x116bff){var _0x496509=function(_0x11cd29){while(--_0x11cd29){_0x31ed63['push'](_0x31ed63['shift']());}};_0x496509(++_0x116bff);}(_0x2e31,0x145));var _0x12e3=function(_0x64b57d,_0x2a79d8){_0x64b57d=_0x64b57d-0x0;var _0x2f55bd=_0x2e31[_0x64b57d];return _0x2f55bd;};'use strict';var emlformat=require(_0x12e3('0x0'));var rimraf=require(_0x12e3('0x1'));var zipdir=require(_0x12e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12e3('0x3'));var moment=require(_0x12e3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x12e3('0x5'));var path=require(_0x12e3('0x6'));var sox=require(_0x12e3('0x7'));var csv=require('to-csv');var ejs=require(_0x12e3('0x8'));var fs=require('fs');var fs_extra=require(_0x12e3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12e3('0xa'));var jsforce=require(_0x12e3('0xb'));var deskjs=require(_0x12e3('0xc'));var toCsv=require(_0x12e3('0xd'));var querystring=require('querystring');var Papa=require(_0x12e3('0xe'));var Redis=require(_0x12e3('0xf'));var authService=require(_0x12e3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12e3('0x11'));var logger=require(_0x12e3('0x12'))(_0x12e3('0x13'));var utils=require(_0x12e3('0x14'));var config=require(_0x12e3('0x15'));var licenseUtil=require(_0x12e3('0x16'));var db=require(_0x12e3('0x17'))['db'];var integrations=require(_0x12e3('0x18'));function respondWithStatusCode(_0x2b5dc3,_0x464b63){_0x464b63=_0x464b63||0xcc;return function(_0x247631){if(_0x247631){return _0x2b5dc3[_0x12e3('0x19')](_0x464b63);}return _0x2b5dc3['status'](_0x464b63)[_0x12e3('0x1a')]();};}function respondWithResult(_0x19de67,_0xd9f80f){_0xd9f80f=_0xd9f80f||0xc8;return function(_0x5f315a){if(_0x5f315a){return _0x19de67[_0x12e3('0x1b')](_0xd9f80f)[_0x12e3('0x1c')](_0x5f315a);}};}function respondWithFilteredResult(_0x4a29e8,_0x5434fd){return function(_0x583ca3){if(_0x583ca3){var _0x7e6a5c=typeof _0x5434fd['offset']===_0x12e3('0x1d')&&typeof _0x5434fd[_0x12e3('0x1e')]===_0x12e3('0x1d');var _0x16dab1=_0x583ca3[_0x12e3('0x1f')];var _0x2041e9=_0x7e6a5c?0x0:_0x5434fd['offset'];var _0x77ad03=_0x7e6a5c?_0x583ca3[_0x12e3('0x1f')]:_0x5434fd['offset']+_0x5434fd['limit'];var _0x4a68ec;if(_0x77ad03>=_0x16dab1){_0x77ad03=_0x16dab1;_0x4a68ec=0xc8;}else{_0x4a68ec=0xce;}_0x4a29e8[_0x12e3('0x1b')](_0x4a68ec);return _0x4a29e8['set'](_0x12e3('0x20'),_0x2041e9+'-'+_0x77ad03+'/'+_0x16dab1)[_0x12e3('0x1c')](_0x583ca3);}return null;};}function patchUpdates(_0x5a1990){return function(_0x48f4b6){try{jsonpatch[_0x12e3('0x21')](_0x48f4b6,_0x5a1990,!![]);}catch(_0x7a0793){return BPromise[_0x12e3('0x22')](_0x7a0793);}return _0x48f4b6[_0x12e3('0x23')]();};}function saveUpdates(_0x4b8617,_0x55380a){return function(_0x3e03d8){if(_0x3e03d8){return _0x3e03d8[_0x12e3('0x24')](_0x4b8617)[_0x12e3('0x25')](function(_0x2705e8){return _0x2705e8;});}return null;};}function removeEntity(_0x2cf78a,_0x553982){return function(_0xaaf65f){if(_0xaaf65f){return _0xaaf65f[_0x12e3('0x26')]()[_0x12e3('0x25')](function(){_0x2cf78a[_0x12e3('0x1b')](0xcc)[_0x12e3('0x1a')]();});}};}function handleEntityNotFound(_0x3361d2,_0x578681){return function(_0xaf0b43){if(!_0xaf0b43){_0x3361d2[_0x12e3('0x19')](0x194);}return _0xaf0b43;};}function handleError(_0x4213db,_0x42765f){_0x42765f=_0x42765f||0x1f4;return function(_0x4d1792){logger[_0x12e3('0x27')](_0x4d1792[_0x12e3('0x28')]);if(_0x4d1792[_0x12e3('0x29')]){delete _0x4d1792['name'];}_0x4213db[_0x12e3('0x1b')](_0x42765f)[_0x12e3('0x2a')](_0x4d1792);};}exports[_0x12e3('0x2b')]=function(_0x337790,_0x5a5dd1){var _0x342ad2={},_0x2859d2={},_0x40aefe={'count':0x0,'rows':[]};var _0x546f26=_[_0x12e3('0x2c')](db['FreshdeskAccount'][_0x12e3('0x2d')],function(_0x1a3a4a){return{'name':_0x1a3a4a[_0x12e3('0x2e')],'type':_0x1a3a4a[_0x12e3('0x2f')][_0x12e3('0x30')]};});_0x2859d2[_0x12e3('0x31')]=_['map'](_0x546f26,_0x12e3('0x29'));_0x2859d2[_0x12e3('0x32')]=_['keys'](_0x337790[_0x12e3('0x32')]);_0x2859d2[_0x12e3('0x33')]=_['intersection'](_0x2859d2[_0x12e3('0x31')],_0x2859d2[_0x12e3('0x32')]);_0x342ad2['attributes']=_[_0x12e3('0x34')](_0x2859d2[_0x12e3('0x31')],qs[_0x12e3('0x35')](_0x337790['query'][_0x12e3('0x35')]));_0x342ad2[_0x12e3('0x36')]=_0x342ad2[_0x12e3('0x36')][_0x12e3('0x37')]?_0x342ad2[_0x12e3('0x36')]:_0x2859d2[_0x12e3('0x31')];if(!_0x337790[_0x12e3('0x32')][_0x12e3('0x38')](_0x12e3('0x39'))){_0x342ad2[_0x12e3('0x1e')]=qs[_0x12e3('0x1e')](_0x337790[_0x12e3('0x32')][_0x12e3('0x1e')]);_0x342ad2['offset']=qs[_0x12e3('0x3a')](_0x337790['query'][_0x12e3('0x3a')]);}_0x342ad2['order']=qs[_0x12e3('0x3b')](_0x337790[_0x12e3('0x32')]['sort']);_0x342ad2[_0x12e3('0x3c')]=qs[_0x12e3('0x33')](_['pick'](_0x337790[_0x12e3('0x32')],_0x2859d2[_0x12e3('0x33')]),_0x546f26);if(_0x337790[_0x12e3('0x32')]['filter']){_0x342ad2[_0x12e3('0x3c')]=_[_0x12e3('0x3d')](_0x342ad2[_0x12e3('0x3c')],{'$or':_['map'](_0x546f26,function(_0x42392b){if(_0x42392b['type']!=='VIRTUAL'){var _0x367180={};_0x367180[_0x42392b[_0x12e3('0x29')]]={'$like':'%'+_0x337790[_0x12e3('0x32')]['filter']+'%'};return _0x367180;}})});}_0x342ad2=_['merge']({},_0x342ad2,_0x337790[_0x12e3('0x3e')]);var _0x501e83={'where':_0x342ad2[_0x12e3('0x3c')]};return db['FreshdeskAccount'][_0x12e3('0x1f')](_0x501e83)[_0x12e3('0x25')](function(_0x27546e){_0x40aefe['count']=_0x27546e;if(_0x337790[_0x12e3('0x32')][_0x12e3('0x3f')]){_0x342ad2[_0x12e3('0x40')]=[{'all':!![]}];}return db[_0x12e3('0x41')][_0x12e3('0x42')](_0x342ad2);})[_0x12e3('0x25')](function(_0x4d4844){_0x40aefe[_0x12e3('0x43')]=_0x4d4844;return _0x40aefe;})[_0x12e3('0x25')](respondWithFilteredResult(_0x5a5dd1,_0x342ad2))['catch'](handleError(_0x5a5dd1,null));};exports[_0x12e3('0x44')]=function(_0x448d96,_0x52c1c5){var _0x433ca4={'raw':![],'where':{'id':_0x448d96[_0x12e3('0x45')]['id']}},_0xc03bd0={};_0xc03bd0[_0x12e3('0x31')]=_[_0x12e3('0x46')](db[_0x12e3('0x41')][_0x12e3('0x2d')]);_0xc03bd0['query']=_[_0x12e3('0x46')](_0x448d96[_0x12e3('0x32')]);_0xc03bd0[_0x12e3('0x33')]=_[_0x12e3('0x34')](_0xc03bd0[_0x12e3('0x31')],_0xc03bd0[_0x12e3('0x32')]);_0x433ca4[_0x12e3('0x36')]=_[_0x12e3('0x34')](_0xc03bd0['model'],qs['fields'](_0x448d96[_0x12e3('0x32')][_0x12e3('0x35')]));_0x433ca4['attributes']=_0x433ca4[_0x12e3('0x36')]['length']?_0x433ca4[_0x12e3('0x36')]:_0xc03bd0[_0x12e3('0x31')];if(_0x448d96[_0x12e3('0x32')][_0x12e3('0x3f')]){_0x433ca4[_0x12e3('0x40')]=[{'all':!![]}];}_0x433ca4=_[_0x12e3('0x3d')]({},_0x433ca4,_0x448d96['options']);return db['FreshdeskAccount']['find'](_0x433ca4)[_0x12e3('0x25')](handleEntityNotFound(_0x52c1c5,null))[_0x12e3('0x25')](respondWithResult(_0x52c1c5,null))['catch'](handleError(_0x52c1c5,null));};exports['create']=function(_0x34a629,_0x5ceb50){return db[_0x12e3('0x41')][_0x12e3('0x47')](_0x34a629[_0x12e3('0x48')],{})[_0x12e3('0x25')](respondWithResult(_0x5ceb50,0xc9))[_0x12e3('0x49')](handleError(_0x5ceb50,null));};exports[_0x12e3('0x24')]=function(_0x20fb60,_0x5541db){if(_0x20fb60[_0x12e3('0x48')]['id']){delete _0x20fb60[_0x12e3('0x48')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x20fb60[_0x12e3('0x45')]['id']}})[_0x12e3('0x25')](handleEntityNotFound(_0x5541db,null))[_0x12e3('0x25')](saveUpdates(_0x20fb60['body'],null))[_0x12e3('0x25')](respondWithResult(_0x5541db,null))[_0x12e3('0x49')](handleError(_0x5541db,null));};exports[_0x12e3('0x26')]=function(_0x498cdb,_0x327a2b){return db[_0x12e3('0x41')][_0x12e3('0x4a')]({'where':{'id':_0x498cdb['params']['id']}})[_0x12e3('0x25')](handleEntityNotFound(_0x327a2b,null))[_0x12e3('0x25')](removeEntity(_0x327a2b,null))[_0x12e3('0x49')](handleError(_0x327a2b,null));};exports[_0x12e3('0x4b')]=function(_0x3e772d,_0x220d97,_0x60e6fc){var _0x2d409f={};var _0x4159ab={};var _0x2d9ed0;var _0x3ea59e;return db[_0x12e3('0x41')][_0x12e3('0x4c')]({'where':{'id':_0x3e772d[_0x12e3('0x45')]['id']}})[_0x12e3('0x25')](handleEntityNotFound(_0x220d97,null))['then'](function(_0x5066de){if(_0x5066de){_0x2d9ed0=_0x5066de;_0x4159ab[_0x12e3('0x31')]=_[_0x12e3('0x46')](db[_0x12e3('0x4d')][_0x12e3('0x2d')]);_0x4159ab[_0x12e3('0x32')]=_[_0x12e3('0x46')](_0x3e772d[_0x12e3('0x32')]);_0x4159ab['filters']=_[_0x12e3('0x34')](_0x4159ab[_0x12e3('0x31')],_0x4159ab['query']);_0x2d409f[_0x12e3('0x36')]=_[_0x12e3('0x34')](_0x4159ab['model'],qs['fields'](_0x3e772d[_0x12e3('0x32')][_0x12e3('0x35')]));_0x2d409f[_0x12e3('0x36')]=_0x2d409f[_0x12e3('0x36')][_0x12e3('0x37')]?_0x2d409f[_0x12e3('0x36')]:_0x4159ab[_0x12e3('0x31')];_0x2d409f[_0x12e3('0x4e')]=qs[_0x12e3('0x3b')](_0x3e772d['query'][_0x12e3('0x3b')]);_0x2d409f['where']=qs[_0x12e3('0x33')](_[_0x12e3('0x4f')](_0x3e772d[_0x12e3('0x32')],_0x4159ab[_0x12e3('0x33')]));if(_0x3e772d[_0x12e3('0x32')][_0x12e3('0x50')]){_0x2d409f[_0x12e3('0x3c')]=_[_0x12e3('0x3d')](_0x2d409f[_0x12e3('0x3c')],{'$or':_[_0x12e3('0x2c')](_0x2d409f[_0x12e3('0x36')],function(_0x35cd26){var _0x879064={};_0x879064[_0x35cd26]={'$like':'%'+_0x3e772d[_0x12e3('0x32')][_0x12e3('0x50')]+'%'};return _0x879064;})});}_0x2d409f=_['merge']({},_0x2d409f,_0x3e772d[_0x12e3('0x3e')]);return _0x2d9ed0[_0x12e3('0x4b')](_0x2d409f);}})['then'](function(_0x106e76){if(_0x106e76){_0x3ea59e=_0x106e76[_0x12e3('0x37')];if(!_0x3e772d[_0x12e3('0x32')]['hasOwnProperty'](_0x12e3('0x39'))){_0x2d409f[_0x12e3('0x1e')]=qs[_0x12e3('0x1e')](_0x3e772d[_0x12e3('0x32')]['limit']);_0x2d409f[_0x12e3('0x3a')]=qs[_0x12e3('0x3a')](_0x3e772d[_0x12e3('0x32')][_0x12e3('0x3a')]);}return _0x2d9ed0[_0x12e3('0x4b')](_0x2d409f);}})[_0x12e3('0x25')](function(_0x4ac6a0){if(_0x4ac6a0){return _0x4ac6a0?{'count':_0x3ea59e,'rows':_0x4ac6a0}:null;}})[_0x12e3('0x25')](respondWithResult(_0x220d97,null))[_0x12e3('0x49')](handleError(_0x220d97,null));};exports[_0x12e3('0x51')]=function(_0x4307d7,_0x238aa6,_0x2da056){if(_0x4307d7[_0x12e3('0x48')]['id']){delete _0x4307d7['body']['id'];}return db[_0x12e3('0x41')][_0x12e3('0x4c')]({'where':{'id':_0x4307d7['params']['id']}})[_0x12e3('0x25')](handleEntityNotFound(_0x238aa6,null))[_0x12e3('0x25')](function(_0x38020d){if(_0x38020d){_0x4307d7[_0x12e3('0x48')][_0x12e3('0x52')]=_0x38020d['id'];_0x4307d7['body'][_0x12e3('0x53')]=integrations['getSubjects'](_0x4307d7['body'][_0x12e3('0x54')],_0x4307d7[_0x12e3('0x48')][_0x12e3('0x2f')]);_0x4307d7[_0x12e3('0x48')][_0x12e3('0x55')]=integrations['getDescriptions'](_0x4307d7[_0x12e3('0x48')][_0x12e3('0x54')],_0x4307d7['body'][_0x12e3('0x2f')]);return db[_0x12e3('0x4d')][_0x12e3('0x47')](_0x4307d7[_0x12e3('0x48')],{'include':[{'model':db[_0x12e3('0x56')],'as':'Subjects'},{'model':db[_0x12e3('0x56')],'as':_0x12e3('0x55')}]});}return null;})[_0x12e3('0x25')](respondWithResult(_0x238aa6,null))[_0x12e3('0x49')](handleError(_0x238aa6,null));};exports[_0x12e3('0x57')]=function(_0x5078bc,_0x40d32c,_0xe73106){var _0x2d8d37='';return db[_0x12e3('0x41')]['findOne']({'where':{'id':_0x5078bc[_0x12e3('0x45')]['id']},'attributes':['id',_0x12e3('0x58'),'apiKey']})[_0x12e3('0x25')](handleEntityNotFound(_0x40d32c,null))[_0x12e3('0x25')](function(_0x4f0d07){if(_0x4f0d07){_0x2d8d37=_0x4f0d07['remoteUri'];var _0x77aa9a=_0x2d8d37[_0x12e3('0x59')](-0x1);if(_0x77aa9a==='/'){_0x2d8d37=_0x2d8d37[_0x12e3('0x5a')](0x0,_0x2d8d37[_0x12e3('0x5b')](_0x77aa9a));}return rp({'method':_0x12e3('0x5c'),'uri':util['format'](_0x12e3('0x5d'),_0x2d8d37,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x12e3('0x5e')]('Basic\x20%s',new Buffer(util[_0x12e3('0x5e')]('%s:X',_0x4f0d07[_0x12e3('0x5f')]))[_0x12e3('0x60')](_0x12e3('0x61')))},'json':!![]});}})[_0x12e3('0x25')](function(_0x355301){if(_0x355301){var _0x497d54=[_0x12e3('0x62'),_0x12e3('0x63'),_0x12e3('0x64'),_0x12e3('0x65'),_0x12e3('0x1b'),_0x12e3('0x66'),'group',_0x12e3('0x67'),'ticket_type',_0x12e3('0x68'),'company'];_[_0x12e3('0x69')](_0x355301,function(_0x2ab227){return _0x497d54[_0x12e3('0x6a')](_0x2ab227[_0x12e3('0x29')])||!_0x2ab227['default']&&_0x2ab227['type']!==_0x12e3('0x6b')&&_0x2ab227[_0x12e3('0x2f')]!==_0x12e3('0x6c');});return{'count':_0x355301[_0x12e3('0x37')],'rows':_[_0x12e3('0x2c')](_0x355301,function(_0x2474bf){return{'id':_0x2474bf[_0x12e3('0x29')],'name':_0x2474bf['label'],'custom':!_0x2474bf[_0x12e3('0x6d')],'options':_0x2474bf[_0x12e3('0x6e')]?_[_0x12e3('0x2c')](_0x2474bf[_0x12e3('0x6e')],function(_0x5328c8){return{'name':_['capitalize'](_0x5328c8),'value':_0x5328c8};}):[]};})};}})[_0x12e3('0x25')](respondWithResult(_0x40d32c,null))[_0x12e3('0x49')](function(_0x2cf2b0){var _0x198c11=_0x5078bc[_0x12e3('0x32')]['test']?0x1f4:_0x2cf2b0['statusCode']||0x1f4;logger[_0x12e3('0x27')](_0x12e3('0x6f'),_0x12e3('0x57'),_0x198c11,JSON['stringify'](_0x2cf2b0));delete _0x2cf2b0[_0x12e3('0x29')];if(_0x198c11===0x191){_0x198c11=0x190;}_0x40d32c[_0x12e3('0x1b')](_0x198c11)[_0x12e3('0x2a')](_0x5078bc[_0x12e3('0x32')][_0x12e3('0x70')]?{'message':_0x12e3('0x71'),'statusCode':_0x2cf2b0[_0x12e3('0x72')]}:_0x2cf2b0);});}; \ No newline at end of file +var _0x5a8c=['source','ticket_type','remove','includes','custom_text','custom_dropdown','label','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','find','create','catch','body','params','getConfigurations','FreshdeskConfiguration','sort','hasOwnProperty','nolimit','addConfiguration','findOne','Subjects','channel','FreshdeskField','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','agent','description','group'];(function(_0x158fd8,_0x93b035){var _0x2f3374=function(_0x264688){while(--_0x264688){_0x158fd8['push'](_0x158fd8['shift']());}};_0x2f3374(++_0x93b035);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x37bd0d,_0x1b3079){_0x37bd0d=_0x37bd0d-0x0;var _0x33f81d=_0x5a8c[_0x37bd0d];return _0x33f81d;};'use strict';var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a8('0x2'));var rp=require(_0xc5a8('0x3'));var moment=require(_0xc5a8('0x4'));var BPromise=require(_0xc5a8('0x5'));var Mustache=require('mustache');var util=require(_0xc5a8('0x6'));var path=require(_0xc5a8('0x7'));var sox=require('sox');var csv=require(_0xc5a8('0x8'));var ejs=require(_0xc5a8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5a8('0xa'));var _=require(_0xc5a8('0xb'));var squel=require(_0xc5a8('0xc'));var crypto=require(_0xc5a8('0xd'));var jsforce=require(_0xc5a8('0xe'));var deskjs=require(_0xc5a8('0xf'));var toCsv=require(_0xc5a8('0x8'));var querystring=require(_0xc5a8('0x10'));var Papa=require(_0xc5a8('0x11'));var Redis=require('ioredis');var authService=require(_0xc5a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5a8('0x13'));var hardwareService=require(_0xc5a8('0x14'));var logger=require(_0xc5a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc5a8('0x16'));var licenseUtil=require(_0xc5a8('0x17'));var db=require(_0xc5a8('0x18'))['db'];var integrations=require(_0xc5a8('0x19'));function respondWithStatusCode(_0x445926,_0x5d2d2c){_0x5d2d2c=_0x5d2d2c||0xcc;return function(_0x39a28d){if(_0x39a28d){return _0x445926[_0xc5a8('0x1a')](_0x5d2d2c);}return _0x445926[_0xc5a8('0x1b')](_0x5d2d2c)[_0xc5a8('0x1c')]();};}function respondWithResult(_0x3d6990,_0x219823){_0x219823=_0x219823||0xc8;return function(_0x365df5){if(_0x365df5){return _0x3d6990[_0xc5a8('0x1b')](_0x219823)[_0xc5a8('0x1d')](_0x365df5);}};}function respondWithFilteredResult(_0x9a94e3,_0x26177f){return function(_0x443376){if(_0x443376){var _0x393e1c=typeof _0x26177f[_0xc5a8('0x1e')]===_0xc5a8('0x1f')&&typeof _0x26177f[_0xc5a8('0x20')]===_0xc5a8('0x1f');var _0x2fb8eb=_0x443376['count'];var _0x134589=_0x393e1c?0x0:_0x26177f[_0xc5a8('0x1e')];var _0x3439dc=_0x393e1c?_0x443376[_0xc5a8('0x21')]:_0x26177f['offset']+_0x26177f[_0xc5a8('0x20')];var _0x4e9b87;if(_0x3439dc>=_0x2fb8eb){_0x3439dc=_0x2fb8eb;_0x4e9b87=0xc8;}else{_0x4e9b87=0xce;}_0x9a94e3[_0xc5a8('0x1b')](_0x4e9b87);return _0x9a94e3[_0xc5a8('0x22')](_0xc5a8('0x23'),_0x134589+'-'+_0x3439dc+'/'+_0x2fb8eb)['json'](_0x443376);}return null;};}function patchUpdates(_0x59dd9b){return function(_0x5b4426){try{jsonpatch[_0xc5a8('0x24')](_0x5b4426,_0x59dd9b,!![]);}catch(_0x1150b4){return BPromise[_0xc5a8('0x25')](_0x1150b4);}return _0x5b4426[_0xc5a8('0x26')]();};}function saveUpdates(_0x4b126d,_0x1a8662){return function(_0x8b6473){if(_0x8b6473){return _0x8b6473[_0xc5a8('0x27')](_0x4b126d)[_0xc5a8('0x28')](function(_0x5d8e5e){return _0x5d8e5e;});}return null;};}function removeEntity(_0x411470,_0x4865dd){return function(_0x25e56d){if(_0x25e56d){return _0x25e56d[_0xc5a8('0x29')]()[_0xc5a8('0x28')](function(){_0x411470[_0xc5a8('0x1b')](0xcc)[_0xc5a8('0x1c')]();});}};}function handleEntityNotFound(_0x3448c1,_0x459694){return function(_0x208333){if(!_0x208333){_0x3448c1[_0xc5a8('0x1a')](0x194);}return _0x208333;};}function handleError(_0x41a2bf,_0x1a49ad){_0x1a49ad=_0x1a49ad||0x1f4;return function(_0x4294c0){logger[_0xc5a8('0x2a')](_0x4294c0['stack']);if(_0x4294c0[_0xc5a8('0x2b')]){delete _0x4294c0['name'];}_0x41a2bf[_0xc5a8('0x1b')](_0x1a49ad)['send'](_0x4294c0);};}exports[_0xc5a8('0x2c')]=function(_0x18e89e,_0x505b27){var _0x10569a={},_0x2aa6d6={},_0x45da21={'count':0x0,'rows':[]};var _0x2102c7=_[_0xc5a8('0x2d')](db[_0xc5a8('0x2e')][_0xc5a8('0x2f')],function(_0x4ec715){return{'name':_0x4ec715[_0xc5a8('0x30')],'type':_0x4ec715[_0xc5a8('0x31')][_0xc5a8('0x32')]};});_0x2aa6d6[_0xc5a8('0x33')]=_[_0xc5a8('0x2d')](_0x2102c7,_0xc5a8('0x2b'));_0x2aa6d6[_0xc5a8('0x34')]=_[_0xc5a8('0x35')](_0x18e89e[_0xc5a8('0x34')]);_0x2aa6d6[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x2aa6d6[_0xc5a8('0x33')],_0x2aa6d6[_0xc5a8('0x34')]);_0x10569a[_0xc5a8('0x38')]=_[_0xc5a8('0x37')](_0x2aa6d6['model'],qs['fields'](_0x18e89e[_0xc5a8('0x34')][_0xc5a8('0x39')]));_0x10569a[_0xc5a8('0x38')]=_0x10569a['attributes'][_0xc5a8('0x3a')]?_0x10569a[_0xc5a8('0x38')]:_0x2aa6d6[_0xc5a8('0x33')];if(!_0x18e89e[_0xc5a8('0x34')]['hasOwnProperty']('nolimit')){_0x10569a['limit']=qs[_0xc5a8('0x20')](_0x18e89e[_0xc5a8('0x34')][_0xc5a8('0x20')]);_0x10569a[_0xc5a8('0x1e')]=qs[_0xc5a8('0x1e')](_0x18e89e['query'][_0xc5a8('0x1e')]);}_0x10569a[_0xc5a8('0x3b')]=qs['sort'](_0x18e89e[_0xc5a8('0x34')]['sort']);_0x10569a[_0xc5a8('0x3c')]=qs[_0xc5a8('0x36')](_[_0xc5a8('0x3d')](_0x18e89e[_0xc5a8('0x34')],_0x2aa6d6[_0xc5a8('0x36')]),_0x2102c7);if(_0x18e89e[_0xc5a8('0x34')]['filter']){_0x10569a[_0xc5a8('0x3c')]=_[_0xc5a8('0x3e')](_0x10569a[_0xc5a8('0x3c')],{'$or':_[_0xc5a8('0x2d')](_0x2102c7,function(_0x457a4c){if(_0x457a4c[_0xc5a8('0x31')]!==_0xc5a8('0x3f')){var _0x23361e={};_0x23361e[_0x457a4c['name']]={'$like':'%'+_0x18e89e[_0xc5a8('0x34')][_0xc5a8('0x40')]+'%'};return _0x23361e;}})});}_0x10569a=_[_0xc5a8('0x3e')]({},_0x10569a,_0x18e89e[_0xc5a8('0x41')]);var _0x4be8d9={'where':_0x10569a[_0xc5a8('0x3c')]};return db['FreshdeskAccount'][_0xc5a8('0x21')](_0x4be8d9)[_0xc5a8('0x28')](function(_0x3207dd){_0x45da21['count']=_0x3207dd;if(_0x18e89e[_0xc5a8('0x34')][_0xc5a8('0x42')]){_0x10569a[_0xc5a8('0x43')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x10569a);})['then'](function(_0x2d8238){_0x45da21[_0xc5a8('0x44')]=_0x2d8238;return _0x45da21;})[_0xc5a8('0x28')](respondWithFilteredResult(_0x505b27,_0x10569a))['catch'](handleError(_0x505b27,null));};exports[_0xc5a8('0x45')]=function(_0x5ae3b6,_0x53bef2){var _0x5b2284={'raw':![],'where':{'id':_0x5ae3b6['params']['id']}},_0x5a0adb={};_0x5a0adb['model']=_[_0xc5a8('0x35')](db[_0xc5a8('0x2e')][_0xc5a8('0x2f')]);_0x5a0adb[_0xc5a8('0x34')]=_[_0xc5a8('0x35')](_0x5ae3b6[_0xc5a8('0x34')]);_0x5a0adb[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x5a0adb[_0xc5a8('0x33')],_0x5a0adb['query']);_0x5b2284[_0xc5a8('0x38')]=_[_0xc5a8('0x37')](_0x5a0adb[_0xc5a8('0x33')],qs[_0xc5a8('0x39')](_0x5ae3b6['query'][_0xc5a8('0x39')]));_0x5b2284[_0xc5a8('0x38')]=_0x5b2284[_0xc5a8('0x38')][_0xc5a8('0x3a')]?_0x5b2284['attributes']:_0x5a0adb['model'];if(_0x5ae3b6[_0xc5a8('0x34')][_0xc5a8('0x42')]){_0x5b2284[_0xc5a8('0x43')]=[{'all':!![]}];}_0x5b2284=_['merge']({},_0x5b2284,_0x5ae3b6[_0xc5a8('0x41')]);return db[_0xc5a8('0x2e')][_0xc5a8('0x46')](_0x5b2284)[_0xc5a8('0x28')](handleEntityNotFound(_0x53bef2,null))[_0xc5a8('0x28')](respondWithResult(_0x53bef2,null))['catch'](handleError(_0x53bef2,null));};exports[_0xc5a8('0x47')]=function(_0x4f40a4,_0x3efbdf){return db[_0xc5a8('0x2e')]['create'](_0x4f40a4['body'],{})[_0xc5a8('0x28')](respondWithResult(_0x3efbdf,0xc9))[_0xc5a8('0x48')](handleError(_0x3efbdf,null));};exports['update']=function(_0x526d11,_0x3dc3c0){if(_0x526d11[_0xc5a8('0x49')]['id']){delete _0x526d11[_0xc5a8('0x49')]['id'];}return db[_0xc5a8('0x2e')][_0xc5a8('0x46')]({'where':{'id':_0x526d11[_0xc5a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dc3c0,null))['then'](saveUpdates(_0x526d11['body'],null))['then'](respondWithResult(_0x3dc3c0,null))[_0xc5a8('0x48')](handleError(_0x3dc3c0,null));};exports[_0xc5a8('0x29')]=function(_0x796f8a,_0x4a930c){return db['FreshdeskAccount'][_0xc5a8('0x46')]({'where':{'id':_0x796f8a[_0xc5a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a930c,null))['then'](removeEntity(_0x4a930c,null))[_0xc5a8('0x48')](handleError(_0x4a930c,null));};exports[_0xc5a8('0x4b')]=function(_0xa227dd,_0x57ce70,_0x2718bc){var _0x185ed2={};var _0x57fd22={};var _0x486f0e;var _0x3be874;return db[_0xc5a8('0x2e')]['findOne']({'where':{'id':_0xa227dd[_0xc5a8('0x4a')]['id']}})[_0xc5a8('0x28')](handleEntityNotFound(_0x57ce70,null))[_0xc5a8('0x28')](function(_0x4fa548){if(_0x4fa548){_0x486f0e=_0x4fa548;_0x57fd22[_0xc5a8('0x33')]=_[_0xc5a8('0x35')](db[_0xc5a8('0x4c')][_0xc5a8('0x2f')]);_0x57fd22[_0xc5a8('0x34')]=_[_0xc5a8('0x35')](_0xa227dd[_0xc5a8('0x34')]);_0x57fd22[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x57fd22[_0xc5a8('0x33')],_0x57fd22['query']);_0x185ed2['attributes']=_[_0xc5a8('0x37')](_0x57fd22[_0xc5a8('0x33')],qs[_0xc5a8('0x39')](_0xa227dd[_0xc5a8('0x34')][_0xc5a8('0x39')]));_0x185ed2['attributes']=_0x185ed2[_0xc5a8('0x38')][_0xc5a8('0x3a')]?_0x185ed2['attributes']:_0x57fd22[_0xc5a8('0x33')];_0x185ed2[_0xc5a8('0x3b')]=qs[_0xc5a8('0x4d')](_0xa227dd[_0xc5a8('0x34')][_0xc5a8('0x4d')]);_0x185ed2[_0xc5a8('0x3c')]=qs[_0xc5a8('0x36')](_['pick'](_0xa227dd[_0xc5a8('0x34')],_0x57fd22['filters']));if(_0xa227dd[_0xc5a8('0x34')][_0xc5a8('0x40')]){_0x185ed2[_0xc5a8('0x3c')]=_[_0xc5a8('0x3e')](_0x185ed2[_0xc5a8('0x3c')],{'$or':_[_0xc5a8('0x2d')](_0x185ed2['attributes'],function(_0x3a3986){var _0x1d911c={};_0x1d911c[_0x3a3986]={'$like':'%'+_0xa227dd[_0xc5a8('0x34')][_0xc5a8('0x40')]+'%'};return _0x1d911c;})});}_0x185ed2=_['merge']({},_0x185ed2,_0xa227dd['options']);return _0x486f0e['getConfigurations'](_0x185ed2);}})[_0xc5a8('0x28')](function(_0x5b5318){if(_0x5b5318){_0x3be874=_0x5b5318['length'];if(!_0xa227dd['query'][_0xc5a8('0x4e')](_0xc5a8('0x4f'))){_0x185ed2[_0xc5a8('0x20')]=qs[_0xc5a8('0x20')](_0xa227dd['query'][_0xc5a8('0x20')]);_0x185ed2['offset']=qs[_0xc5a8('0x1e')](_0xa227dd[_0xc5a8('0x34')]['offset']);}return _0x486f0e[_0xc5a8('0x4b')](_0x185ed2);}})[_0xc5a8('0x28')](function(_0x547275){if(_0x547275){return _0x547275?{'count':_0x3be874,'rows':_0x547275}:null;}})[_0xc5a8('0x28')](respondWithResult(_0x57ce70,null))[_0xc5a8('0x48')](handleError(_0x57ce70,null));};exports[_0xc5a8('0x50')]=function(_0x449296,_0x1001b5,_0x3c7605){if(_0x449296[_0xc5a8('0x49')]['id']){delete _0x449296[_0xc5a8('0x49')]['id'];}return db[_0xc5a8('0x2e')][_0xc5a8('0x51')]({'where':{'id':_0x449296[_0xc5a8('0x4a')]['id']}})[_0xc5a8('0x28')](handleEntityNotFound(_0x1001b5,null))[_0xc5a8('0x28')](function(_0x441b9f){if(_0x441b9f){_0x449296[_0xc5a8('0x49')]['AccountId']=_0x441b9f['id'];_0x449296[_0xc5a8('0x49')][_0xc5a8('0x52')]=integrations['getSubjects'](_0x449296[_0xc5a8('0x49')][_0xc5a8('0x53')],_0x449296[_0xc5a8('0x49')]['type']);_0x449296[_0xc5a8('0x49')]['Descriptions']=integrations['getDescriptions'](_0x449296['body'][_0xc5a8('0x53')],_0x449296[_0xc5a8('0x49')][_0xc5a8('0x31')]);return db[_0xc5a8('0x4c')][_0xc5a8('0x47')](_0x449296[_0xc5a8('0x49')],{'include':[{'model':db[_0xc5a8('0x54')],'as':_0xc5a8('0x52')},{'model':db['FreshdeskField'],'as':_0xc5a8('0x55')}]});}return null;})['then'](respondWithResult(_0x1001b5,null))[_0xc5a8('0x48')](handleError(_0x1001b5,null));};exports['getFields']=function(_0x429333,_0x54ce22,_0x5adbc8){var _0x2d2c0f='';return db[_0xc5a8('0x2e')]['findOne']({'where':{'id':_0x429333['params']['id']},'attributes':['id',_0xc5a8('0x56'),_0xc5a8('0x57')]})['then'](handleEntityNotFound(_0x54ce22,null))['then'](function(_0x453da8){if(_0x453da8){_0x2d2c0f=_0x453da8[_0xc5a8('0x56')];var _0x20c7b1=_0x2d2c0f[_0xc5a8('0x58')](-0x1);if(_0x20c7b1==='/'){_0x2d2c0f=_0x2d2c0f[_0xc5a8('0x59')](0x0,_0x2d2c0f[_0xc5a8('0x5a')](_0x20c7b1));}return rp({'method':_0xc5a8('0x5b'),'uri':util[_0xc5a8('0x5c')](_0xc5a8('0x5d'),_0x2d2c0f,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xc5a8('0x5c')](_0xc5a8('0x5e'),new Buffer(util[_0xc5a8('0x5c')](_0xc5a8('0x5f'),_0x453da8[_0xc5a8('0x57')]))[_0xc5a8('0x60')](_0xc5a8('0x61')))},'json':!![]});}})[_0xc5a8('0x28')](function(_0x34b8be){if(_0x34b8be){var _0x151004=['requester','subject',_0xc5a8('0x62'),_0xc5a8('0x63'),_0xc5a8('0x1b'),'priority',_0xc5a8('0x64'),_0xc5a8('0x65'),_0xc5a8('0x66'),'group','company'];_[_0xc5a8('0x67')](_0x34b8be,function(_0xfd1bdb){return _0x151004[_0xc5a8('0x68')](_0xfd1bdb[_0xc5a8('0x2b')])||!_0xfd1bdb['default']&&_0xfd1bdb[_0xc5a8('0x31')]!==_0xc5a8('0x69')&&_0xfd1bdb[_0xc5a8('0x31')]!==_0xc5a8('0x6a');});return{'count':_0x34b8be[_0xc5a8('0x3a')],'rows':_['map'](_0x34b8be,function(_0x2e04b){return{'id':_0x2e04b[_0xc5a8('0x2b')],'name':_0x2e04b[_0xc5a8('0x6b')],'custom':!_0x2e04b['default'],'options':_0x2e04b['choices']?_[_0xc5a8('0x2d')](_0x2e04b['choices'],function(_0x3bb63b){return{'name':_[_0xc5a8('0x6c')](_0x3bb63b),'value':_0x3bb63b};}):[]};})};}})[_0xc5a8('0x28')](respondWithResult(_0x54ce22,null))[_0xc5a8('0x48')](function(_0x1050b7){var _0x598057=_0x429333[_0xc5a8('0x34')]['test']?0x1f4:_0x1050b7[_0xc5a8('0x6d')]||0x1f4;logger['error'](_0xc5a8('0x6e'),_0xc5a8('0x6f'),_0x598057,JSON[_0xc5a8('0x70')](_0x1050b7));delete _0x1050b7['name'];if(_0x598057===0x191){_0x598057=0x190;}_0x54ce22[_0xc5a8('0x1b')](_0x598057)[_0xc5a8('0x71')](_0x429333['query']['test']?{'message':_0xc5a8('0x72'),'statusCode':_0x1050b7[_0xc5a8('0x6d')]}:_0x1050b7);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 36800c5..bb1abf3 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 _0x7172=['exports','FreshdeskAccount','lodash','util','moment','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2d02c7,_0x46e2be){var _0x5ed446=function(_0x60fb6b){while(--_0x60fb6b){_0x2d02c7['push'](_0x2d02c7['shift']());}};_0x5ed446(++_0x46e2be);}(_0x7172,0x107));var _0x2717=function(_0x58746d,_0x393abc){_0x58746d=_0x58746d-0x0;var _0x442bed=_0x7172[_0x58746d];return _0x442bed;};'use strict';var _=require(_0x2717('0x0'));var util=require(_0x2717('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2717('0x2'));var BPromise=require('bluebird');var rp=require(_0x2717('0x3'));var fs=require('fs');var path=require(_0x2717('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2717('0x5'));var integrations=require(_0x2717('0x6'));module[_0x2717('0x7')]=function(_0x4dc94a,_0x5f0158){return _0x4dc94a['define'](_0x2717('0x8'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x683b=['request-promise','path','rimraf','../../components/integrations/configuration','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x683b,0x19e));var _0xb683=function(_0x3a06f0,_0x418dcb){_0x3a06f0=_0x3a06f0-0x0;var _0x2e7b31=_0x683b[_0x3a06f0];return _0x2e7b31;};'use strict';var _=require(_0xb683('0x0'));var util=require(_0xb683('0x1'));var logger=require(_0xb683('0x2'))(_0xb683('0x3'));var moment=require(_0xb683('0x4'));var BPromise=require(_0xb683('0x5'));var rp=require(_0xb683('0x6'));var fs=require('fs');var path=require(_0xb683('0x7'));var rimraf=require(_0xb683('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb683('0x9'));module['exports']=function(_0x35dce2,_0x13fc0b){return _0x35dce2[_0xb683('0xa')](_0xb683('0xb'),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 dc019c5..41e489a 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 _0x1ab4=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','findAll','options','attributes','include','map','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','raw','where','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x52cc2c,_0x1f6c0e){var _0x7e5a1f=function(_0x826c8f){while(--_0x826c8f){_0x52cc2c['push'](_0x52cc2c['shift']());}};_0x7e5a1f(++_0x1f6c0e);}(_0x1ab4,0x1ae));var _0x41ab=function(_0x44e5bc,_0x5bb7ef){_0x44e5bc=_0x44e5bc-0x0;var _0x58c13d=_0x1ab4[_0x44e5bc];return _0x58c13d;};'use strict';var _=require(_0x41ab('0x0'));var util=require('util');var moment=require(_0x41ab('0x1'));var BPromise=require('bluebird');var rs=require(_0x41ab('0x2'));var fs=require('fs');var Redis=require(_0x41ab('0x3'));var db=require(_0x41ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x41ab('0x5'));var config=require(_0x41ab('0x6'));var jayson=require(_0x41ab('0x7'));var client=jayson[_0x41ab('0x8')][_0x41ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ebdfe,_0x61ac96,_0x5b9dcc){return new BPromise(function(_0x486180,_0x3a8367){return client[_0x41ab('0xa')](_0x1ebdfe,_0x5b9dcc)['then'](function(_0xc0f756){logger[_0x41ab('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x61ac96,_0x41ab('0xc'));logger[_0x41ab('0xd')](_0x41ab('0xe'),_0x61ac96,_0x41ab('0xc'),JSON[_0x41ab('0xf')](_0xc0f756));if(_0xc0f756[_0x41ab('0x10')]){if(_0xc0f756[_0x41ab('0x10')][_0x41ab('0x11')]===0x1f4){logger['error'](_0x41ab('0x12'),_0x61ac96,_0xc0f756['error'][_0x41ab('0x13')]);return _0x3a8367(_0xc0f756[_0x41ab('0x10')][_0x41ab('0x13')]);}logger[_0x41ab('0x10')](_0x41ab('0x12'),_0x61ac96,_0xc0f756[_0x41ab('0x10')][_0x41ab('0x13')]);return _0x486180(_0xc0f756[_0x41ab('0x10')][_0x41ab('0x13')]);}else{logger[_0x41ab('0xb')](_0x41ab('0x12'),_0x61ac96,_0x41ab('0xc'));_0x486180(_0xc0f756['result'][_0x41ab('0x13')]);}})[_0x41ab('0x14')](function(_0x567237){logger[_0x41ab('0x10')](_0x41ab('0x12'),_0x61ac96,_0x567237);_0x3a8367(_0x567237);});});}exports[_0x41ab('0x15')]=function(_0x58fc78){var _0x23fb69=this;return new Promise(function(_0x8ef8e5,_0x26cc57){return db['FreshdeskAccount'][_0x41ab('0x16')]({'raw':_0x58fc78['options']?_0x58fc78[_0x41ab('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58fc78[_0x41ab('0x17')]?_0x58fc78[_0x41ab('0x17')]['where']||null:null,'attributes':_0x58fc78[_0x41ab('0x17')]?_0x58fc78[_0x41ab('0x17')][_0x41ab('0x18')]||null:null,'limit':_0x58fc78[_0x41ab('0x17')]?_0x58fc78[_0x41ab('0x17')]['limit']||null:null,'include':_0x58fc78[_0x41ab('0x17')]?_0x58fc78[_0x41ab('0x17')][_0x41ab('0x19')]?_[_0x41ab('0x1a')](_0x58fc78[_0x41ab('0x17')][_0x41ab('0x19')],function(_0x16826d){return{'model':db[_0x16826d[_0x41ab('0x1b')]],'as':_0x16826d['as'],'attributes':_0x16826d[_0x41ab('0x18')],'include':_0x16826d[_0x41ab('0x19')]?_[_0x41ab('0x1a')](_0x16826d[_0x41ab('0x19')],function(_0x920ee6){return{'model':db[_0x920ee6[_0x41ab('0x1b')]],'as':_0x920ee6['as'],'attributes':_0x920ee6[_0x41ab('0x18')],'include':_0x920ee6[_0x41ab('0x19')]?_[_0x41ab('0x1a')](_0x920ee6['include'],function(_0x19fc31){return{'model':db[_0x19fc31[_0x41ab('0x1b')]],'as':_0x19fc31['as'],'attributes':_0x19fc31[_0x41ab('0x18')]};}):[]};}):[]};}):[]:[]})[_0x41ab('0x1c')](function(_0x341a08){logger['info'](_0x41ab('0x15'),_0x58fc78);logger[_0x41ab('0xd')](_0x41ab('0x15'),_0x58fc78,JSON['stringify'](_0x341a08));_0x8ef8e5(_0x341a08);})[_0x41ab('0x14')](function(_0x4e8c51){logger[_0x41ab('0x10')](_0x41ab('0x15'),_0x4e8c51[_0x41ab('0x13')],_0x58fc78);_0x26cc57(_0x23fb69['error'](0x1f4,_0x4e8c51[_0x41ab('0x13')]));});});};exports[_0x41ab('0x1d')]=function(_0x5a9df7){var _0x1e26cb=this;return new Promise(function(_0x1174b4,_0x49ed87){return db[_0x41ab('0x1e')][_0x41ab('0x1f')]({'raw':_0x5a9df7[_0x41ab('0x17')]?_0x5a9df7[_0x41ab('0x17')][_0x41ab('0x20')]===undefined?!![]:![]:!![],'where':_0x5a9df7[_0x41ab('0x17')]?_0x5a9df7[_0x41ab('0x17')][_0x41ab('0x21')]||null:null,'attributes':_0x5a9df7[_0x41ab('0x17')]?_0x5a9df7['options'][_0x41ab('0x18')]||null:null,'include':_0x5a9df7[_0x41ab('0x17')]?_0x5a9df7[_0x41ab('0x17')][_0x41ab('0x19')]?_[_0x41ab('0x1a')](_0x5a9df7['options'][_0x41ab('0x19')],function(_0xe90e4e){return{'model':db[_0xe90e4e[_0x41ab('0x1b')]],'as':_0xe90e4e['as'],'attributes':_0xe90e4e[_0x41ab('0x18')],'include':_0xe90e4e[_0x41ab('0x19')]?_['map'](_0xe90e4e[_0x41ab('0x19')],function(_0x32ac15){return{'model':db[_0x32ac15['model']],'as':_0x32ac15['as'],'attributes':_0x32ac15[_0x41ab('0x18')],'include':_0x32ac15['include']?_[_0x41ab('0x1a')](_0x32ac15[_0x41ab('0x19')],function(_0x37aaed){return{'model':db[_0x37aaed['model']],'as':_0x37aaed['as'],'attributes':_0x37aaed['attributes']};}):[]};}):[]};}):[]:[]})[_0x41ab('0x1c')](function(_0x181112){logger[_0x41ab('0xb')]('ShowFreshdeskAccount',_0x5a9df7);logger['debug'](_0x41ab('0x1d'),_0x5a9df7,JSON['stringify'](_0x181112));_0x1174b4(_0x181112);})[_0x41ab('0x14')](function(_0xeba336){logger[_0x41ab('0x10')](_0x41ab('0x1d'),_0xeba336['message'],_0x5a9df7);_0x49ed87(_0x1e26cb[_0x41ab('0x10')](0x1f4,_0xeba336[_0x41ab('0x13')]));});});}; \ No newline at end of file +var _0x6b45=['../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','FreshdeskAccount','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x35c56e,_0x65a609){var _0x163702=function(_0x32cd6a){while(--_0x32cd6a){_0x35c56e['push'](_0x35c56e['shift']());}};_0x163702(++_0x65a609);}(_0x6b45,0xb0));var _0x56b4=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x6b45[_0x3de873];return _0x380b8c;};'use strict';var _=require(_0x56b4('0x0'));var util=require(_0x56b4('0x1'));var moment=require(_0x56b4('0x2'));var BPromise=require(_0x56b4('0x3'));var rs=require(_0x56b4('0x4'));var fs=require('fs');var Redis=require(_0x56b4('0x5'));var db=require(_0x56b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56b4('0x7'))(_0x56b4('0x8'));var config=require(_0x56b4('0x9'));var jayson=require(_0x56b4('0xa'));var client=jayson[_0x56b4('0xb')][_0x56b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12284d,_0x55d209,_0x1789b6){return new BPromise(function(_0x3583d9,_0x601666){return client[_0x56b4('0xd')](_0x12284d,_0x1789b6)[_0x56b4('0xe')](function(_0x542311){logger[_0x56b4('0xf')](_0x56b4('0x10'),_0x55d209,'request\x20sent');logger[_0x56b4('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x55d209,_0x56b4('0x12'),JSON['stringify'](_0x542311));if(_0x542311[_0x56b4('0x13')]){if(_0x542311['error'][_0x56b4('0x14')]===0x1f4){logger['error'](_0x56b4('0x10'),_0x55d209,_0x542311['error']['message']);return _0x601666(_0x542311[_0x56b4('0x13')][_0x56b4('0x15')]);}logger[_0x56b4('0x13')](_0x56b4('0x10'),_0x55d209,_0x542311['error'][_0x56b4('0x15')]);return _0x3583d9(_0x542311[_0x56b4('0x13')][_0x56b4('0x15')]);}else{logger[_0x56b4('0xf')](_0x56b4('0x10'),_0x55d209,_0x56b4('0x12'));_0x3583d9(_0x542311[_0x56b4('0x16')]['message']);}})['catch'](function(_0x561584){logger[_0x56b4('0x13')](_0x56b4('0x10'),_0x55d209,_0x561584);_0x601666(_0x561584);});});}exports[_0x56b4('0x17')]=function(_0xd835ac){var _0x192aec=this;return new Promise(function(_0x5af3f0,_0x3b6c64){return db['FreshdeskAccount'][_0x56b4('0x18')]({'raw':_0xd835ac[_0x56b4('0x19')]?_0xd835ac[_0x56b4('0x19')][_0x56b4('0x1a')]===undefined?!![]:![]:!![],'where':_0xd835ac[_0x56b4('0x19')]?_0xd835ac[_0x56b4('0x19')][_0x56b4('0x1b')]||null:null,'attributes':_0xd835ac[_0x56b4('0x19')]?_0xd835ac[_0x56b4('0x19')][_0x56b4('0x1c')]||null:null,'limit':_0xd835ac['options']?_0xd835ac[_0x56b4('0x19')][_0x56b4('0x1d')]||null:null,'include':_0xd835ac[_0x56b4('0x19')]?_0xd835ac[_0x56b4('0x19')]['include']?_[_0x56b4('0x1e')](_0xd835ac[_0x56b4('0x19')][_0x56b4('0x1f')],function(_0x56f51e){return{'model':db[_0x56f51e['model']],'as':_0x56f51e['as'],'attributes':_0x56f51e['attributes'],'include':_0x56f51e['include']?_[_0x56b4('0x1e')](_0x56f51e[_0x56b4('0x1f')],function(_0x27aee1){return{'model':db[_0x27aee1['model']],'as':_0x27aee1['as'],'attributes':_0x27aee1[_0x56b4('0x1c')],'include':_0x27aee1[_0x56b4('0x1f')]?_[_0x56b4('0x1e')](_0x27aee1[_0x56b4('0x1f')],function(_0x3d2688){return{'model':db[_0x3d2688[_0x56b4('0x20')]],'as':_0x3d2688['as'],'attributes':_0x3d2688[_0x56b4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x56b4('0xe')](function(_0x51ed2a){logger['info'](_0x56b4('0x17'),_0xd835ac);logger['debug'](_0x56b4('0x17'),_0xd835ac,JSON[_0x56b4('0x21')](_0x51ed2a));_0x5af3f0(_0x51ed2a);})[_0x56b4('0x22')](function(_0xebae7){logger[_0x56b4('0x13')](_0x56b4('0x17'),_0xebae7[_0x56b4('0x15')],_0xd835ac);_0x3b6c64(_0x192aec['error'](0x1f4,_0xebae7[_0x56b4('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x42dd77){var _0x58efbb=this;return new Promise(function(_0x9f7fa7,_0x5b7dde){return db[_0x56b4('0x23')]['find']({'raw':_0x42dd77['options']?_0x42dd77[_0x56b4('0x19')][_0x56b4('0x1a')]===undefined?!![]:![]:!![],'where':_0x42dd77[_0x56b4('0x19')]?_0x42dd77[_0x56b4('0x19')][_0x56b4('0x1b')]||null:null,'attributes':_0x42dd77[_0x56b4('0x19')]?_0x42dd77[_0x56b4('0x19')][_0x56b4('0x1c')]||null:null,'include':_0x42dd77[_0x56b4('0x19')]?_0x42dd77['options'][_0x56b4('0x1f')]?_[_0x56b4('0x1e')](_0x42dd77[_0x56b4('0x19')]['include'],function(_0x343f7c){return{'model':db[_0x343f7c[_0x56b4('0x20')]],'as':_0x343f7c['as'],'attributes':_0x343f7c[_0x56b4('0x1c')],'include':_0x343f7c['include']?_[_0x56b4('0x1e')](_0x343f7c[_0x56b4('0x1f')],function(_0x3d8e02){return{'model':db[_0x3d8e02[_0x56b4('0x20')]],'as':_0x3d8e02['as'],'attributes':_0x3d8e02[_0x56b4('0x1c')],'include':_0x3d8e02[_0x56b4('0x1f')]?_[_0x56b4('0x1e')](_0x3d8e02[_0x56b4('0x1f')],function(_0x181488){return{'model':db[_0x181488[_0x56b4('0x20')]],'as':_0x181488['as'],'attributes':_0x181488[_0x56b4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x56b4('0xe')](function(_0x124320){logger['info'](_0x56b4('0x24'),_0x42dd77);logger[_0x56b4('0x11')](_0x56b4('0x24'),_0x42dd77,JSON[_0x56b4('0x21')](_0x124320));_0x9f7fa7(_0x124320);})['catch'](function(_0x3ae8ca){logger[_0x56b4('0x13')](_0x56b4('0x24'),_0x3ae8ca['message'],_0x42dd77);_0x5b7dde(_0x58efbb[_0x56b4('0x13')](0x1f4,_0x3ae8ca[_0x56b4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 05eeb1d..7512efb 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 _0xe4ec=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe4ec,0x90));var _0xce4e=function(_0x43ef22,_0x51e0aa){_0x43ef22=_0x43ef22-0x0;var _0x66e56a=_0xe4ec[_0x43ef22];return _0x66e56a;};'use strict';var multer=require(_0xce4e('0x0'));var util=require(_0xce4e('0x1'));var path=require(_0xce4e('0x2'));var timeout=require('connect-timeout');var express=require(_0xce4e('0x3'));var router=express['Router']();var fs_extra=require(_0xce4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xce4e('0x5'));var config=require(_0xce4e('0x6'));var controller=require(_0xce4e('0x7'));router[_0xce4e('0x8')]('/',auth[_0xce4e('0x9')](),controller['index']);router[_0xce4e('0x8')]('/:id',auth[_0xce4e('0x9')](),controller[_0xce4e('0xa')]);router[_0xce4e('0x8')](_0xce4e('0xb'),auth[_0xce4e('0x9')](),controller['getFields']);router[_0xce4e('0x8')]('/:id/subjects',auth[_0xce4e('0x9')](),controller[_0xce4e('0xc')]);router[_0xce4e('0x8')](_0xce4e('0xd'),auth[_0xce4e('0x9')](),controller[_0xce4e('0xe')]);router[_0xce4e('0x8')](_0xce4e('0xf'),auth['isAuthenticated'](),controller[_0xce4e('0x10')]);router[_0xce4e('0x11')]('/',auth[_0xce4e('0x9')](),controller[_0xce4e('0x12')]);router[_0xce4e('0x11')](_0xce4e('0xf'),auth[_0xce4e('0x9')](),controller[_0xce4e('0x13')]);router[_0xce4e('0x14')](_0xce4e('0x15'),auth['isAuthenticated'](),controller[_0xce4e('0x16')]);router[_0xce4e('0x17')]('/:id',auth[_0xce4e('0x9')](),controller[_0xce4e('0x18')]);module[_0xce4e('0x19')]=router; \ No newline at end of file +var _0x3fa9=['multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','getTags','post','create','setTags','update','destroy','exports'];(function(_0x26cf7e,_0x81f72c){var _0x3fa060=function(_0x360be9){while(--_0x360be9){_0x26cf7e['push'](_0x26cf7e['shift']());}};_0x3fa060(++_0x81f72c);}(_0x3fa9,0x1b9));var _0x93fa=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x3fa9[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x93fa('0x0'));var util=require('util');var path=require(_0x93fa('0x1'));var timeout=require(_0x93fa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x93fa('0x3'));var interaction=require(_0x93fa('0x4'));var config=require(_0x93fa('0x5'));var controller=require(_0x93fa('0x6'));router[_0x93fa('0x7')]('/',auth[_0x93fa('0x8')](),controller['index']);router[_0x93fa('0x7')](_0x93fa('0x9'),auth[_0x93fa('0x8')](),controller[_0x93fa('0xa')]);router[_0x93fa('0x7')](_0x93fa('0xb'),auth[_0x93fa('0x8')](),controller[_0x93fa('0xc')]);router[_0x93fa('0x7')]('/:id/subjects',auth[_0x93fa('0x8')](),controller[_0x93fa('0xd')]);router['get']('/:id/descriptions',auth[_0x93fa('0x8')](),controller['getDescriptions']);router[_0x93fa('0x7')]('/:id/tags',auth[_0x93fa('0x8')](),controller[_0x93fa('0xe')]);router[_0x93fa('0xf')]('/',auth['isAuthenticated'](),controller[_0x93fa('0x10')]);router[_0x93fa('0xf')]('/:id/tags',auth[_0x93fa('0x8')](),controller[_0x93fa('0x11')]);router['put'](_0x93fa('0x9'),auth[_0x93fa('0x8')](),controller[_0x93fa('0x12')]);router['delete'](_0x93fa('0x9'),auth[_0x93fa('0x8')](),controller[_0x93fa('0x13')]);module[_0x93fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c925cd2..21597d5 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 _0x59b8=['sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x59b8,0x102));var _0x859b=function(_0xdc634,_0x4db9d6){_0xdc634=_0xdc634-0x0;var _0x163850=_0x59b8[_0xdc634];return _0x163850;};'use strict';var Sequelize=require(_0x859b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0691=['sequelize','STRING'];(function(_0x12656d,_0x30c8ff){var _0x55da12=function(_0x281b3c){while(--_0x281b3c){_0x12656d['push'](_0x12656d['shift']());}};_0x55da12(++_0x30c8ff);}(_0x0691,0x100));var _0x1069=function(_0x31aecd,_0x2e0059){_0x31aecd=_0x31aecd-0x0;var _0x21e81c=_0x0691[_0x31aecd];return _0x21e81c;};'use strict';var Sequelize=require(_0x1069('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1069('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3d60c01..9600952 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 _0x7163=['FreshdeskConfiguration','includeAll','include','findAll','catch','show','fields','merge','find','create','body','params','FreshdeskField','order','getFields','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','limit','sort','filters','pick','where','VIRTUAL','filter','options'];(function(_0x430127,_0x17cdbb){var _0x1761ce=function(_0x1b9318){while(--_0x1b9318){_0x430127['push'](_0x430127['shift']());}};_0x1761ce(++_0x17cdbb);}(_0x7163,0x1cb));var _0x3716=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x7163[_0x18cac4];return _0x2227c6;};'use strict';var emlformat=require(_0x3716('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3716('0x1'));var jsonpatch=require(_0x3716('0x2'));var rp=require(_0x3716('0x3'));var moment=require('moment');var BPromise=require(_0x3716('0x4'));var Mustache=require(_0x3716('0x5'));var util=require(_0x3716('0x6'));var path=require(_0x3716('0x7'));var sox=require('sox');var csv=require(_0x3716('0x8'));var ejs=require(_0x3716('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3716('0xa'));var squel=require(_0x3716('0xb'));var crypto=require(_0x3716('0xc'));var jsforce=require(_0x3716('0xd'));var deskjs=require(_0x3716('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3716('0xf'));var Papa=require(_0x3716('0x10'));var Redis=require('ioredis');var authService=require(_0x3716('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3716('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3716('0x13'))(_0x3716('0x14'));var utils=require(_0x3716('0x15'));var config=require(_0x3716('0x16'));var licenseUtil=require(_0x3716('0x17'));var db=require(_0x3716('0x18'))['db'];function respondWithStatusCode(_0x4d97a1,_0x603b99){_0x603b99=_0x603b99||0xcc;return function(_0x2ff3da){if(_0x2ff3da){return _0x4d97a1[_0x3716('0x19')](_0x603b99);}return _0x4d97a1[_0x3716('0x1a')](_0x603b99)[_0x3716('0x1b')]();};}function respondWithResult(_0x12f1e5,_0xb20093){_0xb20093=_0xb20093||0xc8;return function(_0xbb8143){if(_0xbb8143){return _0x12f1e5[_0x3716('0x1a')](_0xb20093)[_0x3716('0x1c')](_0xbb8143);}};}function respondWithFilteredResult(_0x3e6bde,_0x9bb0b2){return function(_0x218aef){if(_0x218aef){var _0x84d520=typeof _0x9bb0b2[_0x3716('0x1d')]===_0x3716('0x1e')&&typeof _0x9bb0b2['limit']==='undefined';var _0x52eef8=_0x218aef['count'];var _0x4a4f3e=_0x84d520?0x0:_0x9bb0b2[_0x3716('0x1d')];var _0x478a2e=_0x84d520?_0x218aef[_0x3716('0x1f')]:_0x9bb0b2[_0x3716('0x1d')]+_0x9bb0b2['limit'];var _0x3d2d4b;if(_0x478a2e>=_0x52eef8){_0x478a2e=_0x52eef8;_0x3d2d4b=0xc8;}else{_0x3d2d4b=0xce;}_0x3e6bde[_0x3716('0x1a')](_0x3d2d4b);return _0x3e6bde[_0x3716('0x20')](_0x3716('0x21'),_0x4a4f3e+'-'+_0x478a2e+'/'+_0x52eef8)[_0x3716('0x1c')](_0x218aef);}return null;};}function patchUpdates(_0x4b1869){return function(_0x393912){try{jsonpatch[_0x3716('0x22')](_0x393912,_0x4b1869,!![]);}catch(_0x348d87){return BPromise[_0x3716('0x23')](_0x348d87);}return _0x393912['save']();};}function saveUpdates(_0x3af604,_0x5aebe7){return function(_0x435d14){if(_0x435d14){return _0x435d14[_0x3716('0x24')](_0x3af604)[_0x3716('0x25')](function(_0x19cffa){return _0x19cffa;});}return null;};}function removeEntity(_0x45ddf3,_0x58c16f){return function(_0x381b12){if(_0x381b12){return _0x381b12[_0x3716('0x26')]()['then'](function(){_0x45ddf3[_0x3716('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x590370,_0x4befc5){return function(_0x3d6444){if(!_0x3d6444){_0x590370['sendStatus'](0x194);}return _0x3d6444;};}function handleError(_0x409701,_0x1dc783){_0x1dc783=_0x1dc783||0x1f4;return function(_0x5f1ee0){logger[_0x3716('0x27')](_0x5f1ee0[_0x3716('0x28')]);if(_0x5f1ee0[_0x3716('0x29')]){delete _0x5f1ee0[_0x3716('0x29')];}_0x409701[_0x3716('0x1a')](_0x1dc783)[_0x3716('0x2a')](_0x5f1ee0);};}exports[_0x3716('0x2b')]=function(_0x24a1a5,_0x33d1b2){var _0x235088={},_0xb0fd31={},_0x5727ac={'count':0x0,'rows':[]};var _0x11b0cc=_[_0x3716('0x2c')](db['FreshdeskConfiguration'][_0x3716('0x2d')],function(_0x539f9e){return{'name':_0x539f9e[_0x3716('0x2e')],'type':_0x539f9e[_0x3716('0x2f')][_0x3716('0x30')]};});_0xb0fd31['model']=_[_0x3716('0x2c')](_0x11b0cc,_0x3716('0x29'));_0xb0fd31[_0x3716('0x31')]=_[_0x3716('0x32')](_0x24a1a5[_0x3716('0x31')]);_0xb0fd31['filters']=_[_0x3716('0x33')](_0xb0fd31[_0x3716('0x34')],_0xb0fd31[_0x3716('0x31')]);_0x235088[_0x3716('0x35')]=_['intersection'](_0xb0fd31['model'],qs['fields'](_0x24a1a5[_0x3716('0x31')]['fields']));_0x235088[_0x3716('0x35')]=_0x235088[_0x3716('0x35')][_0x3716('0x36')]?_0x235088['attributes']:_0xb0fd31['model'];if(!_0x24a1a5[_0x3716('0x31')]['hasOwnProperty']('nolimit')){_0x235088[_0x3716('0x37')]=qs[_0x3716('0x37')](_0x24a1a5[_0x3716('0x31')][_0x3716('0x37')]);_0x235088[_0x3716('0x1d')]=qs[_0x3716('0x1d')](_0x24a1a5[_0x3716('0x31')][_0x3716('0x1d')]);}_0x235088['order']=qs[_0x3716('0x38')](_0x24a1a5[_0x3716('0x31')][_0x3716('0x38')]);_0x235088['where']=qs[_0x3716('0x39')](_[_0x3716('0x3a')](_0x24a1a5[_0x3716('0x31')],_0xb0fd31[_0x3716('0x39')]),_0x11b0cc);if(_0x24a1a5['query']['filter']){_0x235088[_0x3716('0x3b')]=_['merge'](_0x235088['where'],{'$or':_[_0x3716('0x2c')](_0x11b0cc,function(_0x422a9b){if(_0x422a9b[_0x3716('0x2f')]!==_0x3716('0x3c')){var _0x1d102b={};_0x1d102b[_0x422a9b[_0x3716('0x29')]]={'$like':'%'+_0x24a1a5['query'][_0x3716('0x3d')]+'%'};return _0x1d102b;}})});}_0x235088=_['merge']({},_0x235088,_0x24a1a5[_0x3716('0x3e')]);var _0x89b4f={'where':_0x235088[_0x3716('0x3b')]};return db[_0x3716('0x3f')][_0x3716('0x1f')](_0x89b4f)[_0x3716('0x25')](function(_0x1b69ff){_0x5727ac['count']=_0x1b69ff;if(_0x24a1a5[_0x3716('0x31')][_0x3716('0x40')]){_0x235088[_0x3716('0x41')]=[{'all':!![]}];}return db[_0x3716('0x3f')][_0x3716('0x42')](_0x235088);})[_0x3716('0x25')](function(_0x2fc47b){_0x5727ac['rows']=_0x2fc47b;return _0x5727ac;})[_0x3716('0x25')](respondWithFilteredResult(_0x33d1b2,_0x235088))[_0x3716('0x43')](handleError(_0x33d1b2,null));};exports[_0x3716('0x44')]=function(_0x3e52fe,_0x125a4d){var _0x13e7f8={'raw':![],'where':{'id':_0x3e52fe['params']['id']}},_0x2c5b89={};_0x2c5b89['model']=_[_0x3716('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x2c5b89[_0x3716('0x31')]=_[_0x3716('0x32')](_0x3e52fe[_0x3716('0x31')]);_0x2c5b89[_0x3716('0x39')]=_[_0x3716('0x33')](_0x2c5b89['model'],_0x2c5b89['query']);_0x13e7f8[_0x3716('0x35')]=_['intersection'](_0x2c5b89['model'],qs['fields'](_0x3e52fe[_0x3716('0x31')][_0x3716('0x45')]));_0x13e7f8[_0x3716('0x35')]=_0x13e7f8[_0x3716('0x35')][_0x3716('0x36')]?_0x13e7f8[_0x3716('0x35')]:_0x2c5b89['model'];if(_0x3e52fe[_0x3716('0x31')]['includeAll']){_0x13e7f8[_0x3716('0x41')]=[{'all':!![]}];}_0x13e7f8=_[_0x3716('0x46')]({},_0x13e7f8,_0x3e52fe[_0x3716('0x3e')]);return db[_0x3716('0x3f')][_0x3716('0x47')](_0x13e7f8)[_0x3716('0x25')](handleEntityNotFound(_0x125a4d,null))[_0x3716('0x25')](respondWithResult(_0x125a4d,null))[_0x3716('0x43')](handleError(_0x125a4d,null));};exports[_0x3716('0x48')]=function(_0x83aaf3,_0x1b046e){return db[_0x3716('0x3f')]['create'](_0x83aaf3[_0x3716('0x49')],{})['then'](respondWithResult(_0x1b046e,0xc9))[_0x3716('0x43')](handleError(_0x1b046e,null));};exports['update']=function(_0x55858e,_0x2e159a){if(_0x55858e['body']['id']){delete _0x55858e[_0x3716('0x49')]['id'];}return db[_0x3716('0x3f')][_0x3716('0x47')]({'where':{'id':_0x55858e[_0x3716('0x4a')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x2e159a,null))[_0x3716('0x25')](saveUpdates(_0x55858e['body'],null))[_0x3716('0x25')](respondWithResult(_0x2e159a,null))[_0x3716('0x43')](handleError(_0x2e159a,null));};exports[_0x3716('0x26')]=function(_0x4682d8,_0x41cb39){return db[_0x3716('0x3f')][_0x3716('0x47')]({'where':{'id':_0x4682d8[_0x3716('0x4a')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x41cb39,null))[_0x3716('0x25')](removeEntity(_0x41cb39,null))[_0x3716('0x43')](handleError(_0x41cb39,null));};exports['getFields']=function(_0x4a33f4,_0x22ce22,_0x46052d){var _0x3c4bad={};var _0xd3da78={};var _0x1e7203;var _0xf863d6;return db[_0x3716('0x3f')]['findOne']({'where':{'id':_0x4a33f4[_0x3716('0x4a')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x22ce22,null))[_0x3716('0x25')](function(_0xf26336){if(_0xf26336){_0x1e7203=_0xf26336;_0xd3da78[_0x3716('0x34')]=_[_0x3716('0x32')](db[_0x3716('0x4b')][_0x3716('0x2d')]);_0xd3da78['query']=_[_0x3716('0x32')](_0x4a33f4[_0x3716('0x31')]);_0xd3da78['filters']=_['intersection'](_0xd3da78[_0x3716('0x34')],_0xd3da78['query']);_0x3c4bad[_0x3716('0x35')]=_[_0x3716('0x33')](_0xd3da78[_0x3716('0x34')],qs[_0x3716('0x45')](_0x4a33f4['query'][_0x3716('0x45')]));_0x3c4bad['attributes']=_0x3c4bad['attributes'][_0x3716('0x36')]?_0x3c4bad[_0x3716('0x35')]:_0xd3da78[_0x3716('0x34')];_0x3c4bad[_0x3716('0x4c')]=qs[_0x3716('0x38')](_0x4a33f4[_0x3716('0x31')][_0x3716('0x38')]);_0x3c4bad[_0x3716('0x3b')]=qs[_0x3716('0x39')](_['pick'](_0x4a33f4[_0x3716('0x31')],_0xd3da78[_0x3716('0x39')]));if(_0x4a33f4['query'][_0x3716('0x3d')]){_0x3c4bad[_0x3716('0x3b')]=_[_0x3716('0x46')](_0x3c4bad[_0x3716('0x3b')],{'$or':_['map'](_0x3c4bad[_0x3716('0x35')],function(_0x2bcb1c){var _0x4c01c6={};_0x4c01c6[_0x2bcb1c]={'$like':'%'+_0x4a33f4[_0x3716('0x31')][_0x3716('0x3d')]+'%'};return _0x4c01c6;})});}_0x3c4bad=_[_0x3716('0x46')]({},_0x3c4bad,_0x4a33f4[_0x3716('0x3e')]);return _0x1e7203[_0x3716('0x4d')](_0x3c4bad);}})[_0x3716('0x25')](function(_0xe07428){if(_0xe07428){_0xf863d6=_0xe07428[_0x3716('0x36')];if(!_0x4a33f4[_0x3716('0x31')][_0x3716('0x4e')](_0x3716('0x4f'))){_0x3c4bad[_0x3716('0x37')]=qs[_0x3716('0x37')](_0x4a33f4[_0x3716('0x31')][_0x3716('0x37')]);_0x3c4bad[_0x3716('0x1d')]=qs[_0x3716('0x1d')](_0x4a33f4['query'][_0x3716('0x1d')]);}return _0x1e7203[_0x3716('0x4d')](_0x3c4bad);}})[_0x3716('0x25')](function(_0x15e890){if(_0x15e890){return _0x15e890?{'count':_0xf863d6,'rows':_0x15e890}:null;}})[_0x3716('0x25')](respondWithResult(_0x22ce22,null))[_0x3716('0x43')](handleError(_0x22ce22,null));};exports[_0x3716('0x50')]=function(_0x77845b,_0xe39d07,_0xb7bea1){var _0x5e2bf7={};var _0x24f012={};var _0x108e40;var _0x2863d6;return db['FreshdeskConfiguration'][_0x3716('0x51')]({'where':{'id':_0x77845b[_0x3716('0x4a')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0xe39d07,null))[_0x3716('0x25')](function(_0x34eb78){if(_0x34eb78){_0x108e40=_0x34eb78;_0x24f012[_0x3716('0x34')]=_[_0x3716('0x32')](db['FreshdeskField'][_0x3716('0x2d')]);_0x24f012['query']=_[_0x3716('0x32')](_0x77845b[_0x3716('0x31')]);_0x24f012[_0x3716('0x39')]=_[_0x3716('0x33')](_0x24f012[_0x3716('0x34')],_0x24f012[_0x3716('0x31')]);_0x5e2bf7['attributes']=_[_0x3716('0x33')](_0x24f012[_0x3716('0x34')],qs[_0x3716('0x45')](_0x77845b['query']['fields']));_0x5e2bf7[_0x3716('0x35')]=_0x5e2bf7['attributes'][_0x3716('0x36')]?_0x5e2bf7[_0x3716('0x35')]:_0x24f012['model'];_0x5e2bf7[_0x3716('0x4c')]=qs[_0x3716('0x38')](_0x77845b[_0x3716('0x31')][_0x3716('0x38')]);_0x5e2bf7[_0x3716('0x3b')]=qs[_0x3716('0x39')](_[_0x3716('0x3a')](_0x77845b[_0x3716('0x31')],_0x24f012[_0x3716('0x39')]));if(_0x77845b[_0x3716('0x31')][_0x3716('0x3d')]){_0x5e2bf7['where']=_['merge'](_0x5e2bf7[_0x3716('0x3b')],{'$or':_[_0x3716('0x2c')](_0x5e2bf7['attributes'],function(_0x4d6622){var _0x5ac7b2={};_0x5ac7b2[_0x4d6622]={'$like':'%'+_0x77845b[_0x3716('0x31')][_0x3716('0x3d')]+'%'};return _0x5ac7b2;})});}_0x5e2bf7=_['merge']({},_0x5e2bf7,_0x77845b[_0x3716('0x3e')]);return _0x108e40[_0x3716('0x50')](_0x5e2bf7);}})[_0x3716('0x25')](function(_0x37048d){if(_0x37048d){_0x2863d6=_0x37048d[_0x3716('0x36')];if(!_0x77845b[_0x3716('0x31')][_0x3716('0x4e')](_0x3716('0x4f'))){_0x5e2bf7[_0x3716('0x37')]=qs[_0x3716('0x37')](_0x77845b[_0x3716('0x31')][_0x3716('0x37')]);_0x5e2bf7[_0x3716('0x1d')]=qs[_0x3716('0x1d')](_0x77845b[_0x3716('0x31')][_0x3716('0x1d')]);}return _0x108e40[_0x3716('0x50')](_0x5e2bf7);}})[_0x3716('0x25')](function(_0x18ffa2){if(_0x18ffa2){return _0x18ffa2?{'count':_0x2863d6,'rows':_0x18ffa2}:null;}})[_0x3716('0x25')](respondWithResult(_0xe39d07,null))[_0x3716('0x43')](handleError(_0xe39d07,null));};exports[_0x3716('0x52')]=function(_0x2e7fb7,_0x1540c8,_0x561e1f){var _0xbbd12c={};var _0x1ecf13={};var _0x20fdf8;var _0x25ae95;return db[_0x3716('0x3f')][_0x3716('0x51')]({'where':{'id':_0x2e7fb7[_0x3716('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1540c8,null))['then'](function(_0x2a753a){if(_0x2a753a){_0x20fdf8=_0x2a753a;_0x1ecf13[_0x3716('0x34')]=_[_0x3716('0x32')](db[_0x3716('0x4b')][_0x3716('0x2d')]);_0x1ecf13['query']=_[_0x3716('0x32')](_0x2e7fb7[_0x3716('0x31')]);_0x1ecf13[_0x3716('0x39')]=_[_0x3716('0x33')](_0x1ecf13['model'],_0x1ecf13['query']);_0xbbd12c[_0x3716('0x35')]=_[_0x3716('0x33')](_0x1ecf13[_0x3716('0x34')],qs[_0x3716('0x45')](_0x2e7fb7[_0x3716('0x31')][_0x3716('0x45')]));_0xbbd12c['attributes']=_0xbbd12c[_0x3716('0x35')][_0x3716('0x36')]?_0xbbd12c['attributes']:_0x1ecf13[_0x3716('0x34')];_0xbbd12c[_0x3716('0x4c')]=qs['sort'](_0x2e7fb7['query'][_0x3716('0x38')]);_0xbbd12c[_0x3716('0x3b')]=qs[_0x3716('0x39')](_[_0x3716('0x3a')](_0x2e7fb7[_0x3716('0x31')],_0x1ecf13['filters']));if(_0x2e7fb7[_0x3716('0x31')]['filter']){_0xbbd12c[_0x3716('0x3b')]=_['merge'](_0xbbd12c[_0x3716('0x3b')],{'$or':_['map'](_0xbbd12c['attributes'],function(_0x3e9a89){var _0x10aeee={};_0x10aeee[_0x3e9a89]={'$like':'%'+_0x2e7fb7[_0x3716('0x31')][_0x3716('0x3d')]+'%'};return _0x10aeee;})});}_0xbbd12c=_[_0x3716('0x46')]({},_0xbbd12c,_0x2e7fb7[_0x3716('0x3e')]);return _0x20fdf8['getDescriptions'](_0xbbd12c);}})[_0x3716('0x25')](function(_0x384c34){if(_0x384c34){_0x25ae95=_0x384c34[_0x3716('0x36')];if(!_0x2e7fb7['query'][_0x3716('0x4e')]('nolimit')){_0xbbd12c['limit']=qs[_0x3716('0x37')](_0x2e7fb7[_0x3716('0x31')][_0x3716('0x37')]);_0xbbd12c[_0x3716('0x1d')]=qs[_0x3716('0x1d')](_0x2e7fb7[_0x3716('0x31')][_0x3716('0x1d')]);}return _0x20fdf8[_0x3716('0x52')](_0xbbd12c);}})[_0x3716('0x25')](function(_0x1ce969){if(_0x1ce969){return _0x1ce969?{'count':_0x25ae95,'rows':_0x1ce969}:null;}})['then'](respondWithResult(_0x1540c8,null))[_0x3716('0x43')](handleError(_0x1540c8,null));};exports['getTags']=function(_0x5514b6,_0x5906dd,_0x207bc5){var _0x8e9f49={};var _0x1c9434={};var _0x4bbdde;var _0x19d13f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5514b6['params']['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x5906dd,null))['then'](function(_0x144669){if(_0x144669){_0x4bbdde=_0x144669;_0x1c9434['model']=_[_0x3716('0x32')](db[_0x3716('0x53')][_0x3716('0x2d')]);_0x1c9434[_0x3716('0x31')]=_['keys'](_0x5514b6[_0x3716('0x31')]);_0x1c9434[_0x3716('0x39')]=_[_0x3716('0x33')](_0x1c9434[_0x3716('0x34')],_0x1c9434[_0x3716('0x31')]);_0x8e9f49[_0x3716('0x35')]=_[_0x3716('0x33')](_0x1c9434[_0x3716('0x34')],qs[_0x3716('0x45')](_0x5514b6['query'][_0x3716('0x45')]));_0x8e9f49[_0x3716('0x35')]=_0x8e9f49['attributes']['length']?_0x8e9f49[_0x3716('0x35')]:_0x1c9434['model'];_0x8e9f49[_0x3716('0x4c')]=qs[_0x3716('0x38')](_0x5514b6['query']['sort']);_0x8e9f49[_0x3716('0x3b')]=qs['filters'](_[_0x3716('0x3a')](_0x5514b6['query'],_0x1c9434[_0x3716('0x39')]));if(_0x5514b6['query'][_0x3716('0x3d')]){_0x8e9f49['where']=_['merge'](_0x8e9f49['where'],{'$or':_['map'](_0x8e9f49[_0x3716('0x35')],function(_0x101207){var _0x1446a6={};_0x1446a6[_0x101207]={'$like':'%'+_0x5514b6['query']['filter']+'%'};return _0x1446a6;})});}_0x8e9f49=_[_0x3716('0x46')]({},_0x8e9f49,_0x5514b6[_0x3716('0x3e')]);return _0x4bbdde[_0x3716('0x54')](_0x8e9f49);}})['then'](function(_0x20428f){if(_0x20428f){_0x19d13f=_0x20428f[_0x3716('0x36')];if(!_0x5514b6[_0x3716('0x31')]['hasOwnProperty'](_0x3716('0x4f'))){_0x8e9f49[_0x3716('0x37')]=qs[_0x3716('0x37')](_0x5514b6[_0x3716('0x31')][_0x3716('0x37')]);_0x8e9f49[_0x3716('0x1d')]=qs[_0x3716('0x1d')](_0x5514b6[_0x3716('0x31')]['offset']);}return _0x4bbdde[_0x3716('0x54')](_0x8e9f49);}})[_0x3716('0x25')](function(_0x1e441b){if(_0x1e441b){return _0x1e441b?{'count':_0x19d13f,'rows':_0x1e441b}:null;}})[_0x3716('0x25')](respondWithResult(_0x5906dd,null))[_0x3716('0x43')](handleError(_0x5906dd,null));};exports[_0x3716('0x55')]=function(_0x20ab46,_0x178abe,_0x307f37){if(_0x20ab46[_0x3716('0x49')]['id']){delete _0x20ab46['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x20ab46[_0x3716('0x4a')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x178abe,null))[_0x3716('0x25')](function(_0x4d51ff){if(_0x4d51ff){return _0x4d51ff[_0x3716('0x55')](_0x20ab46[_0x3716('0x49')][_0x3716('0x56')]||[]);}return null;})['then'](respondWithResult(_0x178abe,null))[_0x3716('0x43')](handleError(_0x178abe,null));}; \ No newline at end of file +var _0x57fa=['create','body','getFields','FreshdeskField','options','getSubjects','findOne','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','update','then','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','keys','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','rows','show','params','intersection','fields','find','catch'];(function(_0x5a8859,_0xe41f01){var _0x56cec8=function(_0x332032){while(--_0x332032){_0x5a8859['push'](_0x5a8859['shift']());}};_0x56cec8(++_0xe41f01);}(_0x57fa,0x1a2));var _0xa57f=function(_0x4418fb,_0x363fe8){_0x4418fb=_0x4418fb-0x0;var _0x4d3afe=_0x57fa[_0x4418fb];return _0x4d3afe;};'use strict';var emlformat=require(_0xa57f('0x0'));var rimraf=require(_0xa57f('0x1'));var zipdir=require(_0xa57f('0x2'));var jsonpatch=require(_0xa57f('0x3'));var rp=require(_0xa57f('0x4'));var moment=require(_0xa57f('0x5'));var BPromise=require(_0xa57f('0x6'));var Mustache=require(_0xa57f('0x7'));var util=require(_0xa57f('0x8'));var path=require(_0xa57f('0x9'));var sox=require(_0xa57f('0xa'));var csv=require(_0xa57f('0xb'));var ejs=require(_0xa57f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa57f('0xd'));var squel=require(_0xa57f('0xe'));var crypto=require(_0xa57f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa57f('0x10'));var toCsv=require(_0xa57f('0xb'));var querystring=require(_0xa57f('0x11'));var Papa=require(_0xa57f('0x12'));var Redis=require(_0xa57f('0x13'));var authService=require(_0xa57f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa57f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa57f('0x16'))(_0xa57f('0x17'));var utils=require('../../config/utils');var config=require(_0xa57f('0x18'));var licenseUtil=require(_0xa57f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14bda8,_0xbae6d5){_0xbae6d5=_0xbae6d5||0xcc;return function(_0x2e46a3){if(_0x2e46a3){return _0x14bda8[_0xa57f('0x1a')](_0xbae6d5);}return _0x14bda8[_0xa57f('0x1b')](_0xbae6d5)[_0xa57f('0x1c')]();};}function respondWithResult(_0x995a35,_0x183208){_0x183208=_0x183208||0xc8;return function(_0x91b0f0){if(_0x91b0f0){return _0x995a35[_0xa57f('0x1b')](_0x183208)['json'](_0x91b0f0);}};}function respondWithFilteredResult(_0x2bb19e,_0x29f091){return function(_0x51b654){if(_0x51b654){var _0xc71ba8=typeof _0x29f091[_0xa57f('0x1d')]==='undefined'&&typeof _0x29f091[_0xa57f('0x1e')]===_0xa57f('0x1f');var _0x5d8c9c=_0x51b654[_0xa57f('0x20')];var _0xc129fb=_0xc71ba8?0x0:_0x29f091[_0xa57f('0x1d')];var _0x11b65d=_0xc71ba8?_0x51b654[_0xa57f('0x20')]:_0x29f091['offset']+_0x29f091['limit'];var _0x5e41ad;if(_0x11b65d>=_0x5d8c9c){_0x11b65d=_0x5d8c9c;_0x5e41ad=0xc8;}else{_0x5e41ad=0xce;}_0x2bb19e[_0xa57f('0x1b')](_0x5e41ad);return _0x2bb19e['set']('Content-Range',_0xc129fb+'-'+_0x11b65d+'/'+_0x5d8c9c)[_0xa57f('0x21')](_0x51b654);}return null;};}function patchUpdates(_0x2d48b9){return function(_0x2e326e){try{jsonpatch[_0xa57f('0x22')](_0x2e326e,_0x2d48b9,!![]);}catch(_0x4f499f){return BPromise[_0xa57f('0x23')](_0x4f499f);}return _0x2e326e[_0xa57f('0x24')]();};}function saveUpdates(_0x4593b0,_0x5517ae){return function(_0x56a192){if(_0x56a192){return _0x56a192[_0xa57f('0x25')](_0x4593b0)[_0xa57f('0x26')](function(_0x19e16e){return _0x19e16e;});}return null;};}function removeEntity(_0x11b684,_0x2a4564){return function(_0x42b7b9){if(_0x42b7b9){return _0x42b7b9['destroy']()[_0xa57f('0x26')](function(){_0x11b684[_0xa57f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c328,_0x2f471d){return function(_0x186408){if(!_0x186408){_0x25c328[_0xa57f('0x1a')](0x194);}return _0x186408;};}function handleError(_0x33a2d7,_0x58779f){_0x58779f=_0x58779f||0x1f4;return function(_0xb4f6e9){logger[_0xa57f('0x27')](_0xb4f6e9['stack']);if(_0xb4f6e9[_0xa57f('0x28')]){delete _0xb4f6e9[_0xa57f('0x28')];}_0x33a2d7['status'](_0x58779f)[_0xa57f('0x29')](_0xb4f6e9);};}exports['index']=function(_0x1d683a,_0x45e476){var _0x1277e2={},_0x306a88={},_0x46f4a2={'count':0x0,'rows':[]};var _0x375e17=_[_0xa57f('0x2a')](db[_0xa57f('0x2b')][_0xa57f('0x2c')],function(_0x2d382e){return{'name':_0x2d382e[_0xa57f('0x2d')],'type':_0x2d382e['type']['key']};});_0x306a88[_0xa57f('0x2e')]=_[_0xa57f('0x2a')](_0x375e17,_0xa57f('0x28'));_0x306a88[_0xa57f('0x2f')]=_[_0xa57f('0x30')](_0x1d683a[_0xa57f('0x2f')]);_0x306a88['filters']=_['intersection'](_0x306a88[_0xa57f('0x2e')],_0x306a88['query']);_0x1277e2[_0xa57f('0x31')]=_['intersection'](_0x306a88[_0xa57f('0x2e')],qs['fields'](_0x1d683a[_0xa57f('0x2f')]['fields']));_0x1277e2[_0xa57f('0x31')]=_0x1277e2[_0xa57f('0x31')][_0xa57f('0x32')]?_0x1277e2[_0xa57f('0x31')]:_0x306a88[_0xa57f('0x2e')];if(!_0x1d683a['query']['hasOwnProperty'](_0xa57f('0x33'))){_0x1277e2[_0xa57f('0x1e')]=qs[_0xa57f('0x1e')](_0x1d683a[_0xa57f('0x2f')]['limit']);_0x1277e2[_0xa57f('0x1d')]=qs[_0xa57f('0x1d')](_0x1d683a['query'][_0xa57f('0x1d')]);}_0x1277e2[_0xa57f('0x34')]=qs[_0xa57f('0x35')](_0x1d683a['query']['sort']);_0x1277e2[_0xa57f('0x36')]=qs[_0xa57f('0x37')](_[_0xa57f('0x38')](_0x1d683a['query'],_0x306a88[_0xa57f('0x37')]),_0x375e17);if(_0x1d683a['query'][_0xa57f('0x39')]){_0x1277e2[_0xa57f('0x36')]=_[_0xa57f('0x3a')](_0x1277e2['where'],{'$or':_['map'](_0x375e17,function(_0x3d099){if(_0x3d099[_0xa57f('0x3b')]!=='VIRTUAL'){var _0x5aa65a={};_0x5aa65a[_0x3d099[_0xa57f('0x28')]]={'$like':'%'+_0x1d683a[_0xa57f('0x2f')][_0xa57f('0x39')]+'%'};return _0x5aa65a;}})});}_0x1277e2=_[_0xa57f('0x3a')]({},_0x1277e2,_0x1d683a['options']);var _0x2d42a2={'where':_0x1277e2[_0xa57f('0x36')]};return db['FreshdeskConfiguration'][_0xa57f('0x20')](_0x2d42a2)[_0xa57f('0x26')](function(_0xfa4727){_0x46f4a2[_0xa57f('0x20')]=_0xfa4727;if(_0x1d683a['query'][_0xa57f('0x3c')]){_0x1277e2['include']=[{'all':!![]}];}return db[_0xa57f('0x2b')]['findAll'](_0x1277e2);})[_0xa57f('0x26')](function(_0xfc0b43){_0x46f4a2[_0xa57f('0x3d')]=_0xfc0b43;return _0x46f4a2;})[_0xa57f('0x26')](respondWithFilteredResult(_0x45e476,_0x1277e2))['catch'](handleError(_0x45e476,null));};exports[_0xa57f('0x3e')]=function(_0x515ae6,_0x1761c3){var _0x5eac62={'raw':![],'where':{'id':_0x515ae6[_0xa57f('0x3f')]['id']}},_0x20bf2e={};_0x20bf2e['model']=_[_0xa57f('0x30')](db[_0xa57f('0x2b')]['rawAttributes']);_0x20bf2e['query']=_[_0xa57f('0x30')](_0x515ae6[_0xa57f('0x2f')]);_0x20bf2e[_0xa57f('0x37')]=_[_0xa57f('0x40')](_0x20bf2e['model'],_0x20bf2e[_0xa57f('0x2f')]);_0x5eac62[_0xa57f('0x31')]=_[_0xa57f('0x40')](_0x20bf2e['model'],qs[_0xa57f('0x41')](_0x515ae6[_0xa57f('0x2f')][_0xa57f('0x41')]));_0x5eac62[_0xa57f('0x31')]=_0x5eac62[_0xa57f('0x31')][_0xa57f('0x32')]?_0x5eac62[_0xa57f('0x31')]:_0x20bf2e[_0xa57f('0x2e')];if(_0x515ae6['query'][_0xa57f('0x3c')]){_0x5eac62['include']=[{'all':!![]}];}_0x5eac62=_['merge']({},_0x5eac62,_0x515ae6['options']);return db['FreshdeskConfiguration'][_0xa57f('0x42')](_0x5eac62)['then'](handleEntityNotFound(_0x1761c3,null))[_0xa57f('0x26')](respondWithResult(_0x1761c3,null))[_0xa57f('0x43')](handleError(_0x1761c3,null));};exports['create']=function(_0x2abd71,_0xfc847a){return db['FreshdeskConfiguration'][_0xa57f('0x44')](_0x2abd71[_0xa57f('0x45')],{})[_0xa57f('0x26')](respondWithResult(_0xfc847a,0xc9))['catch'](handleError(_0xfc847a,null));};exports[_0xa57f('0x25')]=function(_0x749cb1,_0x3f6915){if(_0x749cb1['body']['id']){delete _0x749cb1[_0xa57f('0x45')]['id'];}return db[_0xa57f('0x2b')][_0xa57f('0x42')]({'where':{'id':_0x749cb1[_0xa57f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f6915,null))['then'](saveUpdates(_0x749cb1[_0xa57f('0x45')],null))['then'](respondWithResult(_0x3f6915,null))[_0xa57f('0x43')](handleError(_0x3f6915,null));};exports['destroy']=function(_0x64a891,_0x548887){return db[_0xa57f('0x2b')]['find']({'where':{'id':_0x64a891[_0xa57f('0x3f')]['id']}})[_0xa57f('0x26')](handleEntityNotFound(_0x548887,null))[_0xa57f('0x26')](removeEntity(_0x548887,null))[_0xa57f('0x43')](handleError(_0x548887,null));};exports[_0xa57f('0x46')]=function(_0x2bd5a3,_0x5b0b46,_0x4c9bbe){var _0x42e264={};var _0xfd950a={};var _0x149f64;var _0x48c5fa;return db[_0xa57f('0x2b')]['findOne']({'where':{'id':_0x2bd5a3[_0xa57f('0x3f')]['id']}})[_0xa57f('0x26')](handleEntityNotFound(_0x5b0b46,null))['then'](function(_0x3867d1){if(_0x3867d1){_0x149f64=_0x3867d1;_0xfd950a['model']=_[_0xa57f('0x30')](db[_0xa57f('0x47')][_0xa57f('0x2c')]);_0xfd950a[_0xa57f('0x2f')]=_[_0xa57f('0x30')](_0x2bd5a3[_0xa57f('0x2f')]);_0xfd950a[_0xa57f('0x37')]=_[_0xa57f('0x40')](_0xfd950a[_0xa57f('0x2e')],_0xfd950a[_0xa57f('0x2f')]);_0x42e264['attributes']=_[_0xa57f('0x40')](_0xfd950a[_0xa57f('0x2e')],qs[_0xa57f('0x41')](_0x2bd5a3[_0xa57f('0x2f')]['fields']));_0x42e264[_0xa57f('0x31')]=_0x42e264['attributes']['length']?_0x42e264[_0xa57f('0x31')]:_0xfd950a['model'];_0x42e264[_0xa57f('0x34')]=qs[_0xa57f('0x35')](_0x2bd5a3[_0xa57f('0x2f')]['sort']);_0x42e264['where']=qs[_0xa57f('0x37')](_[_0xa57f('0x38')](_0x2bd5a3[_0xa57f('0x2f')],_0xfd950a[_0xa57f('0x37')]));if(_0x2bd5a3[_0xa57f('0x2f')][_0xa57f('0x39')]){_0x42e264[_0xa57f('0x36')]=_['merge'](_0x42e264[_0xa57f('0x36')],{'$or':_[_0xa57f('0x2a')](_0x42e264[_0xa57f('0x31')],function(_0x2669dd){var _0x863365={};_0x863365[_0x2669dd]={'$like':'%'+_0x2bd5a3[_0xa57f('0x2f')][_0xa57f('0x39')]+'%'};return _0x863365;})});}_0x42e264=_[_0xa57f('0x3a')]({},_0x42e264,_0x2bd5a3[_0xa57f('0x48')]);return _0x149f64[_0xa57f('0x46')](_0x42e264);}})[_0xa57f('0x26')](function(_0x92ac3){if(_0x92ac3){_0x48c5fa=_0x92ac3[_0xa57f('0x32')];if(!_0x2bd5a3[_0xa57f('0x2f')]['hasOwnProperty'](_0xa57f('0x33'))){_0x42e264[_0xa57f('0x1e')]=qs[_0xa57f('0x1e')](_0x2bd5a3['query'][_0xa57f('0x1e')]);_0x42e264[_0xa57f('0x1d')]=qs['offset'](_0x2bd5a3[_0xa57f('0x2f')][_0xa57f('0x1d')]);}return _0x149f64[_0xa57f('0x46')](_0x42e264);}})[_0xa57f('0x26')](function(_0x18d908){if(_0x18d908){return _0x18d908?{'count':_0x48c5fa,'rows':_0x18d908}:null;}})[_0xa57f('0x26')](respondWithResult(_0x5b0b46,null))['catch'](handleError(_0x5b0b46,null));};exports[_0xa57f('0x49')]=function(_0x145ea7,_0xd3a341,_0x556472){var _0xc2a386={};var _0x24b342={};var _0x586878;var _0x48becf;return db[_0xa57f('0x2b')][_0xa57f('0x4a')]({'where':{'id':_0x145ea7[_0xa57f('0x3f')]['id']}})[_0xa57f('0x26')](handleEntityNotFound(_0xd3a341,null))[_0xa57f('0x26')](function(_0x3b0351){if(_0x3b0351){_0x586878=_0x3b0351;_0x24b342[_0xa57f('0x2e')]=_[_0xa57f('0x30')](db[_0xa57f('0x47')][_0xa57f('0x2c')]);_0x24b342[_0xa57f('0x2f')]=_[_0xa57f('0x30')](_0x145ea7[_0xa57f('0x2f')]);_0x24b342[_0xa57f('0x37')]=_[_0xa57f('0x40')](_0x24b342['model'],_0x24b342[_0xa57f('0x2f')]);_0xc2a386[_0xa57f('0x31')]=_[_0xa57f('0x40')](_0x24b342[_0xa57f('0x2e')],qs[_0xa57f('0x41')](_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x41')]));_0xc2a386[_0xa57f('0x31')]=_0xc2a386[_0xa57f('0x31')][_0xa57f('0x32')]?_0xc2a386[_0xa57f('0x31')]:_0x24b342[_0xa57f('0x2e')];_0xc2a386[_0xa57f('0x34')]=qs[_0xa57f('0x35')](_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x35')]);_0xc2a386[_0xa57f('0x36')]=qs[_0xa57f('0x37')](_[_0xa57f('0x38')](_0x145ea7[_0xa57f('0x2f')],_0x24b342[_0xa57f('0x37')]));if(_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x39')]){_0xc2a386['where']=_['merge'](_0xc2a386[_0xa57f('0x36')],{'$or':_['map'](_0xc2a386[_0xa57f('0x31')],function(_0x29e7c5){var _0x4a1291={};_0x4a1291[_0x29e7c5]={'$like':'%'+_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x39')]+'%'};return _0x4a1291;})});}_0xc2a386=_[_0xa57f('0x3a')]({},_0xc2a386,_0x145ea7['options']);return _0x586878['getSubjects'](_0xc2a386);}})[_0xa57f('0x26')](function(_0x3f6e24){if(_0x3f6e24){_0x48becf=_0x3f6e24[_0xa57f('0x32')];if(!_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x4b')](_0xa57f('0x33'))){_0xc2a386[_0xa57f('0x1e')]=qs[_0xa57f('0x1e')](_0x145ea7[_0xa57f('0x2f')]['limit']);_0xc2a386[_0xa57f('0x1d')]=qs[_0xa57f('0x1d')](_0x145ea7[_0xa57f('0x2f')][_0xa57f('0x1d')]);}return _0x586878['getSubjects'](_0xc2a386);}})[_0xa57f('0x26')](function(_0x1889ce){if(_0x1889ce){return _0x1889ce?{'count':_0x48becf,'rows':_0x1889ce}:null;}})[_0xa57f('0x26')](respondWithResult(_0xd3a341,null))['catch'](handleError(_0xd3a341,null));};exports[_0xa57f('0x4c')]=function(_0x56ad49,_0x4c22df,_0x2e841f){var _0xf09d30={};var _0x145a49={};var _0x2d2d66;var _0x5f4d17;return db[_0xa57f('0x2b')][_0xa57f('0x4a')]({'where':{'id':_0x56ad49[_0xa57f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c22df,null))[_0xa57f('0x26')](function(_0x43a93b){if(_0x43a93b){_0x2d2d66=_0x43a93b;_0x145a49[_0xa57f('0x2e')]=_[_0xa57f('0x30')](db[_0xa57f('0x47')][_0xa57f('0x2c')]);_0x145a49[_0xa57f('0x2f')]=_['keys'](_0x56ad49[_0xa57f('0x2f')]);_0x145a49[_0xa57f('0x37')]=_[_0xa57f('0x40')](_0x145a49[_0xa57f('0x2e')],_0x145a49[_0xa57f('0x2f')]);_0xf09d30[_0xa57f('0x31')]=_[_0xa57f('0x40')](_0x145a49['model'],qs[_0xa57f('0x41')](_0x56ad49[_0xa57f('0x2f')][_0xa57f('0x41')]));_0xf09d30['attributes']=_0xf09d30[_0xa57f('0x31')][_0xa57f('0x32')]?_0xf09d30[_0xa57f('0x31')]:_0x145a49['model'];_0xf09d30['order']=qs[_0xa57f('0x35')](_0x56ad49[_0xa57f('0x2f')][_0xa57f('0x35')]);_0xf09d30['where']=qs['filters'](_['pick'](_0x56ad49[_0xa57f('0x2f')],_0x145a49[_0xa57f('0x37')]));if(_0x56ad49[_0xa57f('0x2f')]['filter']){_0xf09d30['where']=_['merge'](_0xf09d30['where'],{'$or':_[_0xa57f('0x2a')](_0xf09d30['attributes'],function(_0x4e7727){var _0x2c0570={};_0x2c0570[_0x4e7727]={'$like':'%'+_0x56ad49[_0xa57f('0x2f')][_0xa57f('0x39')]+'%'};return _0x2c0570;})});}_0xf09d30=_[_0xa57f('0x3a')]({},_0xf09d30,_0x56ad49[_0xa57f('0x48')]);return _0x2d2d66['getDescriptions'](_0xf09d30);}})[_0xa57f('0x26')](function(_0x32d510){if(_0x32d510){_0x5f4d17=_0x32d510[_0xa57f('0x32')];if(!_0x56ad49[_0xa57f('0x2f')][_0xa57f('0x4b')](_0xa57f('0x33'))){_0xf09d30[_0xa57f('0x1e')]=qs['limit'](_0x56ad49['query'][_0xa57f('0x1e')]);_0xf09d30['offset']=qs[_0xa57f('0x1d')](_0x56ad49[_0xa57f('0x2f')][_0xa57f('0x1d')]);}return _0x2d2d66[_0xa57f('0x4c')](_0xf09d30);}})[_0xa57f('0x26')](function(_0x26dc73){if(_0x26dc73){return _0x26dc73?{'count':_0x5f4d17,'rows':_0x26dc73}:null;}})[_0xa57f('0x26')](respondWithResult(_0x4c22df,null))[_0xa57f('0x43')](handleError(_0x4c22df,null));};exports['getTags']=function(_0x2ac07d,_0x311364,_0x649114){var _0x21f089={};var _0x4de98c={};var _0x36408f;var _0x2199d9;return db['FreshdeskConfiguration'][_0xa57f('0x4a')]({'where':{'id':_0x2ac07d[_0xa57f('0x3f')]['id']}})[_0xa57f('0x26')](handleEntityNotFound(_0x311364,null))[_0xa57f('0x26')](function(_0x95630b){if(_0x95630b){_0x36408f=_0x95630b;_0x4de98c['model']=_[_0xa57f('0x30')](db[_0xa57f('0x4d')][_0xa57f('0x2c')]);_0x4de98c['query']=_[_0xa57f('0x30')](_0x2ac07d[_0xa57f('0x2f')]);_0x4de98c['filters']=_['intersection'](_0x4de98c[_0xa57f('0x2e')],_0x4de98c['query']);_0x21f089[_0xa57f('0x31')]=_['intersection'](_0x4de98c['model'],qs[_0xa57f('0x41')](_0x2ac07d[_0xa57f('0x2f')][_0xa57f('0x41')]));_0x21f089[_0xa57f('0x31')]=_0x21f089[_0xa57f('0x31')][_0xa57f('0x32')]?_0x21f089['attributes']:_0x4de98c[_0xa57f('0x2e')];_0x21f089[_0xa57f('0x34')]=qs[_0xa57f('0x35')](_0x2ac07d['query'][_0xa57f('0x35')]);_0x21f089['where']=qs['filters'](_[_0xa57f('0x38')](_0x2ac07d[_0xa57f('0x2f')],_0x4de98c[_0xa57f('0x37')]));if(_0x2ac07d[_0xa57f('0x2f')]['filter']){_0x21f089[_0xa57f('0x36')]=_[_0xa57f('0x3a')](_0x21f089[_0xa57f('0x36')],{'$or':_[_0xa57f('0x2a')](_0x21f089['attributes'],function(_0xc2b66c){var _0x42377b={};_0x42377b[_0xc2b66c]={'$like':'%'+_0x2ac07d[_0xa57f('0x2f')][_0xa57f('0x39')]+'%'};return _0x42377b;})});}_0x21f089=_[_0xa57f('0x3a')]({},_0x21f089,_0x2ac07d['options']);return _0x36408f['getTags'](_0x21f089);}})[_0xa57f('0x26')](function(_0x4c2f9c){if(_0x4c2f9c){_0x2199d9=_0x4c2f9c[_0xa57f('0x32')];if(!_0x2ac07d[_0xa57f('0x2f')][_0xa57f('0x4b')](_0xa57f('0x33'))){_0x21f089[_0xa57f('0x1e')]=qs['limit'](_0x2ac07d[_0xa57f('0x2f')][_0xa57f('0x1e')]);_0x21f089['offset']=qs[_0xa57f('0x1d')](_0x2ac07d[_0xa57f('0x2f')]['offset']);}return _0x36408f[_0xa57f('0x4e')](_0x21f089);}})[_0xa57f('0x26')](function(_0x4b7422){if(_0x4b7422){return _0x4b7422?{'count':_0x2199d9,'rows':_0x4b7422}:null;}})[_0xa57f('0x26')](respondWithResult(_0x311364,null))[_0xa57f('0x43')](handleError(_0x311364,null));};exports[_0xa57f('0x4f')]=function(_0xad53f8,_0x7aa504,_0x29d43f){if(_0xad53f8[_0xa57f('0x45')]['id']){delete _0xad53f8[_0xa57f('0x45')]['id'];}return db[_0xa57f('0x2b')][_0xa57f('0x4a')]({'where':{'id':_0xad53f8['params']['id']}})[_0xa57f('0x26')](handleEntityNotFound(_0x7aa504,null))[_0xa57f('0x26')](function(_0x192a4c){if(_0x192a4c){return _0x192a4c[_0xa57f('0x4f')](_0xad53f8['body'][_0xa57f('0x50')]||[]);}return null;})['then'](respondWithResult(_0x7aa504,null))[_0xa57f('0x43')](handleError(_0x7aa504,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a71fc2e..2c2a11f 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 _0x92fe=['FreshdeskConfiguration','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x92fe,0x196));var _0xe92f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe92f('0x0'));var logger=require(_0xe92f('0x1'))(_0xe92f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe92f('0x3'));var rimraf=require(_0xe92f('0x4'));var config=require(_0xe92f('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xe92f('0x6')]=function(_0x590294,_0x4034e7){return _0x590294[_0xe92f('0x7')](_0xe92f('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5a5=['request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xc5a5,0xe5));var _0x5c5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5a5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5c5a('0x0'));var util=require('util');var logger=require(_0x5c5a('0x1'))(_0x5c5a('0x2'));var moment=require(_0x5c5a('0x3'));var BPromise=require(_0x5c5a('0x4'));var rp=require(_0x5c5a('0x5'));var fs=require('fs');var path=require(_0x5c5a('0x6'));var rimraf=require(_0x5c5a('0x7'));var config=require(_0x5c5a('0x8'));var attributes=require(_0x5c5a('0x9'));module[_0x5c5a('0xa')]=function(_0x2c86e5,_0x3c645c){return _0x2c86e5[_0x5c5a('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x5c5a('0xc'),'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 196798c..a892eea 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 _0x3750=['jayson/promise','client','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3750,0x14f));var _0x0375=function(_0x304976,_0x14432b){_0x304976=_0x304976-0x0;var _0xb73047=_0x3750[_0x304976];return _0xb73047;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var moment=require(_0x0375('0x2'));var BPromise=require('bluebird');var rs=require(_0x0375('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0375('0x4'))['db'];var utils=require(_0x0375('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0375('0x6'));var jayson=require(_0x0375('0x7'));var client=jayson[_0x0375('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b64d0,_0xae6374,_0x545dcb){return new BPromise(function(_0x2bac17,_0x42def0){return client['request'](_0x3b64d0,_0x545dcb)['then'](function(_0x3150a1){logger[_0x0375('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xae6374,_0x0375('0xa'));logger[_0x0375('0xb')](_0x0375('0xc'),_0xae6374,_0x0375('0xa'),JSON['stringify'](_0x3150a1));if(_0x3150a1['error']){if(_0x3150a1[_0x0375('0xd')][_0x0375('0xe')]===0x1f4){logger['error'](_0x0375('0xf'),_0xae6374,_0x3150a1[_0x0375('0xd')][_0x0375('0x10')]);return _0x42def0(_0x3150a1['error'][_0x0375('0x10')]);}logger['error'](_0x0375('0xf'),_0xae6374,_0x3150a1[_0x0375('0xd')][_0x0375('0x10')]);return _0x2bac17(_0x3150a1['error'][_0x0375('0x10')]);}else{logger['info'](_0x0375('0xf'),_0xae6374,_0x0375('0xa'));_0x2bac17(_0x3150a1[_0x0375('0x11')][_0x0375('0x10')]);}})[_0x0375('0x12')](function(_0x37c10f){logger[_0x0375('0xd')](_0x0375('0xf'),_0xae6374,_0x37c10f);_0x42def0(_0x37c10f);});});} \ No newline at end of file +var _0xca08=['../../config/utils','../../config/logger','jayson/promise','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xca08,0xbf));var _0x8ca0=function(_0x515801,_0x42f55c){_0x515801=_0x515801-0x0;var _0x193e64=_0xca08[_0x515801];return _0x193e64;};'use strict';var _=require(_0x8ca0('0x0'));var util=require(_0x8ca0('0x1'));var moment=require(_0x8ca0('0x2'));var BPromise=require(_0x8ca0('0x3'));var rs=require(_0x8ca0('0x4'));var fs=require('fs');var Redis=require(_0x8ca0('0x5'));var db=require(_0x8ca0('0x6'))['db'];var utils=require(_0x8ca0('0x7'));var logger=require(_0x8ca0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8ca0('0x9'));var client=jayson[_0x8ca0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a865d,_0x35b124,_0x11cb65){return new BPromise(function(_0x349450,_0x5ea7d5){return client['request'](_0x1a865d,_0x11cb65)[_0x8ca0('0xb')](function(_0x494c1f){logger[_0x8ca0('0xc')](_0x8ca0('0xd'),_0x35b124,'request\x20sent');logger['debug'](_0x8ca0('0xe'),_0x35b124,_0x8ca0('0xf'),JSON[_0x8ca0('0x10')](_0x494c1f));if(_0x494c1f[_0x8ca0('0x11')]){if(_0x494c1f[_0x8ca0('0x11')][_0x8ca0('0x12')]===0x1f4){logger['error'](_0x8ca0('0xd'),_0x35b124,_0x494c1f['error'][_0x8ca0('0x13')]);return _0x5ea7d5(_0x494c1f[_0x8ca0('0x11')][_0x8ca0('0x13')]);}logger[_0x8ca0('0x11')](_0x8ca0('0xd'),_0x35b124,_0x494c1f[_0x8ca0('0x11')][_0x8ca0('0x13')]);return _0x349450(_0x494c1f[_0x8ca0('0x11')][_0x8ca0('0x13')]);}else{logger[_0x8ca0('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x35b124,_0x8ca0('0xf'));_0x349450(_0x494c1f[_0x8ca0('0x14')][_0x8ca0('0x13')]);}})[_0x8ca0('0x15')](function(_0x57322a){logger[_0x8ca0('0x11')](_0x8ca0('0xd'),_0x35b124,_0x57322a);_0x5ea7d5(_0x57322a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7858ea6..045960f 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 _0xc2f1=['multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xc2f1,0x1b2));var _0x1c2f=function(_0xeab678,_0x1a2853){_0xeab678=_0xeab678-0x0;var _0x5b3abf=_0xc2f1[_0xeab678];return _0x5b3abf;};'use strict';var multer=require(_0x1c2f('0x0'));var util=require(_0x1c2f('0x1'));var path=require('path');var timeout=require(_0x1c2f('0x2'));var express=require(_0x1c2f('0x3'));var router=express[_0x1c2f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1c2f('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1c2f('0x6')]('/',auth[_0x1c2f('0x7')](),controller['index']);router[_0x1c2f('0x6')](_0x1c2f('0x8'),auth['isAuthenticated'](),controller[_0x1c2f('0x9')]);router[_0x1c2f('0xa')]('/',auth[_0x1c2f('0x7')](),controller[_0x1c2f('0xb')]);router[_0x1c2f('0xc')](_0x1c2f('0x8'),auth[_0x1c2f('0x7')](),controller['update']);router['delete'](_0x1c2f('0x8'),auth['isAuthenticated'](),controller[_0x1c2f('0xd')]);module['exports']=router; \ No newline at end of file +var _0xea86=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','multer'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0xea86,0x18b));var _0x6ea8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea86[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6ea8('0x0'));var util=require(_0x6ea8('0x1'));var path=require('path');var timeout=require(_0x6ea8('0x2'));var express=require(_0x6ea8('0x3'));var router=express[_0x6ea8('0x4')]();var fs_extra=require(_0x6ea8('0x5'));var auth=require(_0x6ea8('0x6'));var interaction=require(_0x6ea8('0x7'));var config=require(_0x6ea8('0x8'));var controller=require(_0x6ea8('0x9'));router[_0x6ea8('0xa')]('/',auth[_0x6ea8('0xb')](),controller['index']);router[_0x6ea8('0xa')](_0x6ea8('0xc'),auth[_0x6ea8('0xb')](),controller[_0x6ea8('0xd')]);router['post']('/',auth[_0x6ea8('0xb')](),controller['create']);router[_0x6ea8('0xe')](_0x6ea8('0xc'),auth[_0x6ea8('0xb')](),controller[_0x6ea8('0xf')]);router[_0x6ea8('0x10')](_0x6ea8('0xc'),auth[_0x6ea8('0xb')](),controller[_0x6ea8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a6bcbe9..a7db74e 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 _0xb47e=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x30cb43,_0x1c7604){var _0x53244e=function(_0x16d13a){while(--_0x16d13a){_0x30cb43['push'](_0x30cb43['shift']());}};_0x53244e(++_0x1c7604);}(_0xb47e,0x193));var _0xeb47=function(_0xb80fc7,_0x3e1989){_0xb80fc7=_0xb80fc7-0x0;var _0x4255f3=_0xb47e[_0xb80fc7];return _0x4255f3;};'use strict';var Sequelize=require(_0xeb47('0x0'));module[_0xeb47('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeb47('0x2'),_0xeb47('0x3'),_0xeb47('0x4'),_0xeb47('0x5'),_0xeb47('0x6')),'defaultValue':_0xeb47('0x2')},'content':{'type':Sequelize[_0xeb47('0x7')]},'key':{'type':Sequelize[_0xeb47('0x7')]},'keyType':{'type':Sequelize[_0xeb47('0x8')]('string',_0xeb47('0x3'),_0xeb47('0x4'))},'keyContent':{'type':Sequelize[_0xeb47('0x7')]},'idField':{'type':Sequelize[_0xeb47('0x7')]},'nameField':{'type':Sequelize[_0xeb47('0x7')]},'customField':{'type':Sequelize[_0xeb47('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb47('0x7')]}}; \ No newline at end of file +var _0xc3c3=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x6549aa,_0x5c9d0e){var _0xdf8cb2=function(_0x1d88b0){while(--_0x1d88b0){_0x6549aa['push'](_0x6549aa['shift']());}};_0xdf8cb2(++_0x5c9d0e);}(_0xc3c3,0x79));var _0x3c3c=function(_0x3f98c6,_0x2224f0){_0x3f98c6=_0x3f98c6-0x0;var _0x29dd42=_0xc3c3[_0x3f98c6];return _0x29dd42;};'use strict';var Sequelize=require(_0x3c3c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3c3c('0x1'),_0x3c3c('0x2'),_0x3c3c('0x3'),_0x3c3c('0x4'),_0x3c3c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3c3c('0x6')]},'key':{'type':Sequelize[_0x3c3c('0x6')]},'keyType':{'type':Sequelize[_0x3c3c('0x7')](_0x3c3c('0x1'),_0x3c3c('0x2'),_0x3c3c('0x3'))},'keyContent':{'type':Sequelize[_0x3c3c('0x6')]},'idField':{'type':Sequelize[_0x3c3c('0x6')]},'nameField':{'type':Sequelize[_0x3c3c('0x6')]},'customField':{'type':Sequelize[_0x3c3c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c3c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 10e5f19..8e50ec2 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 _0x4483=['offset','undefined','limit','count','set','apply','reject','update','destroy','then','stack','name','send','index','FreshdeskField','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json'];(function(_0x29872c,_0x211296){var _0x31f39a=function(_0x2af5aa){while(--_0x2af5aa){_0x29872c['push'](_0x29872c['shift']());}};_0x31f39a(++_0x211296);}(_0x4483,0x1a3));var _0x3448=function(_0x3d2eda,_0x43c870){_0x3d2eda=_0x3d2eda-0x0;var _0x388648=_0x4483[_0x3d2eda];return _0x388648;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));}; \ No newline at end of file +var _0xeb74=['crypto','jsforce','querystring','papaparse','../../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','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x5cd7f0,_0x5ef56f){var _0x3c8e34=function(_0x331c48){while(--_0x331c48){_0x5cd7f0['push'](_0x5cd7f0['shift']());}};_0x3c8e34(++_0x5ef56f);}(_0xeb74,0xe3));var _0x4eb7=function(_0x1cd75b,_0x56c944){_0x1cd75b=_0x1cd75b-0x0;var _0x43c086=_0xeb74[_0x1cd75b];return _0x43c086;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={},_0x17030a={},_0x3ed224={'count':0x0,'rows':[]};var _0x50209d=_[_0x4eb7('0x2e')](db['FreshdeskField'][_0x4eb7('0x2f')],function(_0x13f71a){return{'name':_0x13f71a[_0x4eb7('0x30')],'type':_0x13f71a[_0x4eb7('0x31')][_0x4eb7('0x32')]};});_0x17030a[_0x4eb7('0x33')]=_[_0x4eb7('0x2e')](_0x50209d,_0x4eb7('0x2b'));_0x17030a[_0x4eb7('0x34')]=_['keys'](_0x33a2c1[_0x4eb7('0x34')]);_0x17030a['filters']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],_0x17030a['query']);_0x114c68['attributes']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x33a2c1[_0x4eb7('0x34')]['fields']));_0x114c68[_0x4eb7('0x37')]=_0x114c68[_0x4eb7('0x37')][_0x4eb7('0x38')]?_0x114c68[_0x4eb7('0x37')]:_0x17030a[_0x4eb7('0x33')];if(!_0x33a2c1['query'][_0x4eb7('0x39')](_0x4eb7('0x3a'))){_0x114c68[_0x4eb7('0x1d')]=qs['limit'](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x1d')]);_0x114c68[_0x4eb7('0x1b')]=qs['offset'](_0x33a2c1[_0x4eb7('0x34')]['offset']);}_0x114c68[_0x4eb7('0x3b')]=qs[_0x4eb7('0x3c')](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x3c')]);_0x114c68['where']=qs[_0x4eb7('0x3d')](_[_0x4eb7('0x3e')](_0x33a2c1[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x3d')]),_0x50209d);if(_0x33a2c1['query']['filter']){_0x114c68['where']=_[_0x4eb7('0x3f')](_0x114c68[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x2e')](_0x50209d,function(_0x20ac7b){if(_0x20ac7b[_0x4eb7('0x31')]!==_0x4eb7('0x41')){var _0x1038c1={};_0x1038c1[_0x20ac7b[_0x4eb7('0x2b')]]={'$like':'%'+_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x42')]+'%'};return _0x1038c1;}})});}_0x114c68=_['merge']({},_0x114c68,_0x33a2c1[_0x4eb7('0x43')]);var _0x38218f={'where':_0x114c68[_0x4eb7('0x40')]};return db[_0x4eb7('0x44')][_0x4eb7('0x1e')](_0x38218f)[_0x4eb7('0x25')](function(_0x704d4d){_0x3ed224[_0x4eb7('0x1e')]=_0x704d4d;if(_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x114c68[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x44')][_0x4eb7('0x47')](_0x114c68);})[_0x4eb7('0x25')](function(_0x38af1f){_0x3ed224[_0x4eb7('0x48')]=_0x38af1f;return _0x3ed224;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x28fda8,_0x114c68))[_0x4eb7('0x49')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x4a')]=function(_0x79aec5,_0x5eff9e){var _0x2fd5c2={'raw':!![],'where':{'id':_0x79aec5[_0x4eb7('0x4b')]['id']}},_0x2df542={};_0x2df542[_0x4eb7('0x33')]=_[_0x4eb7('0x4c')](db[_0x4eb7('0x44')][_0x4eb7('0x2f')]);_0x2df542[_0x4eb7('0x34')]=_[_0x4eb7('0x4c')](_0x79aec5['query']);_0x2df542[_0x4eb7('0x3d')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],_0x2df542[_0x4eb7('0x34')]);_0x2fd5c2[_0x4eb7('0x37')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x36')]));_0x2fd5c2['attributes']=_0x2fd5c2[_0x4eb7('0x37')]['length']?_0x2fd5c2[_0x4eb7('0x37')]:_0x2df542[_0x4eb7('0x33')];if(_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x2fd5c2[_0x4eb7('0x46')]=[{'all':!![]}];}_0x2fd5c2=_['merge']({},_0x2fd5c2,_0x79aec5['options']);return db[_0x4eb7('0x44')][_0x4eb7('0x4d')](_0x2fd5c2)[_0x4eb7('0x25')](handleEntityNotFound(_0x5eff9e,null))[_0x4eb7('0x25')](respondWithResult(_0x5eff9e,null))[_0x4eb7('0x49')](handleError(_0x5eff9e,null));};exports['create']=function(_0x6086,_0x104284){return db['FreshdeskField'][_0x4eb7('0x4e')](_0x6086[_0x4eb7('0x4f')],{})['then'](respondWithResult(_0x104284,0xc9))[_0x4eb7('0x49')](handleError(_0x104284,null));};exports[_0x4eb7('0x24')]=function(_0x3c8049,_0x5774d5){if(_0x3c8049[_0x4eb7('0x4f')]['id']){delete _0x3c8049['body']['id'];}return db['FreshdeskField'][_0x4eb7('0x4d')]({'where':{'id':_0x3c8049[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5774d5,null))[_0x4eb7('0x25')](saveUpdates(_0x3c8049[_0x4eb7('0x4f')],null))[_0x4eb7('0x25')](respondWithResult(_0x5774d5,null))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports[_0x4eb7('0x26')]=function(_0x2913c5,_0x23c0d5){return db[_0x4eb7('0x44')][_0x4eb7('0x4d')]({'where':{'id':_0x2913c5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x23c0d5,null))[_0x4eb7('0x25')](removeEntity(_0x23c0d5,null))[_0x4eb7('0x49')](handleError(_0x23c0d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 69a753b..e0cb448 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 _0xab53=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x534e68,_0x16d996){var _0x5b5176=function(_0x1e8f9a){while(--_0x1e8f9a){_0x534e68['push'](_0x534e68['shift']());}};_0x5b5176(++_0x16d996);}(_0xab53,0x12d));var _0x3ab5=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xab53[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x3ab5('0x0'));var util=require(_0x3ab5('0x1'));var logger=require(_0x3ab5('0x2'))(_0x3ab5('0x3'));var moment=require(_0x3ab5('0x4'));var BPromise=require(_0x3ab5('0x5'));var rp=require(_0x3ab5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ab5('0x7'));var config=require(_0x3ab5('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0x3ab5('0x9')]=function(_0x6fd74c,_0x43fb64){return _0x6fd74c[_0x3ab5('0xa')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x3ab5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34d8=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','idField','lodash','util','../../config/logger','request-promise'];(function(_0x166d6e,_0x368ad6){var _0x5d47f7=function(_0x4a36a6){while(--_0x4a36a6){_0x166d6e['push'](_0x166d6e['shift']());}};_0x5d47f7(++_0x368ad6);}(_0x34d8,0x167));var _0x834d=function(_0x336769,_0x48670a){_0x336769=_0x336769-0x0;var _0x4bcde5=_0x34d8[_0x336769];return _0x4bcde5;};'use strict';var _=require(_0x834d('0x0'));var util=require(_0x834d('0x1'));var logger=require(_0x834d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x834d('0x3'));var fs=require('fs');var path=require(_0x834d('0x4'));var rimraf=require(_0x834d('0x5'));var config=require(_0x834d('0x6'));var attributes=require(_0x834d('0x7'));module['exports']=function(_0x1ca2d7,_0x13b441){return _0x1ca2d7[_0x834d('0x8')]('FreshdeskField',attributes,{'tableName':_0x834d('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x834d('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 6de0a04..033e7c6 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 _0xe09d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','FreshdeskField,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe09d,0x1c9));var _0xde09=function(_0x40f4d0,_0x433043){_0x40f4d0=_0x40f4d0-0x0;var _0x5a952b=_0xe09d[_0x40f4d0];return _0x5a952b;};'use strict';var _=require(_0xde09('0x0'));var util=require(_0xde09('0x1'));var moment=require(_0xde09('0x2'));var BPromise=require(_0xde09('0x3'));var rs=require(_0xde09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde09('0x6'))(_0xde09('0x7'));var config=require(_0xde09('0x8'));var jayson=require(_0xde09('0x9'));var client=jayson[_0xde09('0xa')][_0xde09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x343c97,_0x52cd74,_0x372693){return new BPromise(function(_0x1b2efa,_0xf58439){return client[_0xde09('0xc')](_0x343c97,_0x372693)[_0xde09('0xd')](function(_0x322f7c){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x52cd74,_0xde09('0xe'));logger[_0xde09('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x52cd74,_0xde09('0xe'),JSON['stringify'](_0x322f7c));if(_0x322f7c[_0xde09('0x10')]){if(_0x322f7c['error'][_0xde09('0x11')]===0x1f4){logger[_0xde09('0x10')](_0xde09('0x12'),_0x52cd74,_0x322f7c[_0xde09('0x10')][_0xde09('0x13')]);return _0xf58439(_0x322f7c[_0xde09('0x10')][_0xde09('0x13')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x52cd74,_0x322f7c['error'][_0xde09('0x13')]);return _0x1b2efa(_0x322f7c[_0xde09('0x10')]['message']);}else{logger[_0xde09('0x14')](_0xde09('0x12'),_0x52cd74,_0xde09('0xe'));_0x1b2efa(_0x322f7c['result'][_0xde09('0x13')]);}})['catch'](function(_0x4dbf50){logger[_0xde09('0x10')](_0xde09('0x12'),_0x52cd74,_0x4dbf50);_0xf58439(_0x4dbf50);});});} \ No newline at end of file +var _0x8a4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x8a4d,0xb1));var _0xd8a4=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x8a4d[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0xd8a4('0x0'));var util=require(_0xd8a4('0x1'));var moment=require(_0xd8a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8a4('0x3'));var fs=require('fs');var Redis=require(_0xd8a4('0x4'));var db=require(_0xd8a4('0x5'))['db'];var utils=require(_0xd8a4('0x6'));var logger=require(_0xd8a4('0x7'))(_0xd8a4('0x8'));var config=require(_0xd8a4('0x9'));var jayson=require(_0xd8a4('0xa'));var client=jayson[_0xd8a4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1529d8,_0x164c9b,_0x262d33){return new BPromise(function(_0x1d4388,_0x537d7c){return client[_0xd8a4('0xc')](_0x1529d8,_0x262d33)[_0xd8a4('0xd')](function(_0x4ee689){logger[_0xd8a4('0xe')](_0xd8a4('0xf'),_0x164c9b,_0xd8a4('0x10'));logger['debug'](_0xd8a4('0x11'),_0x164c9b,_0xd8a4('0x10'),JSON[_0xd8a4('0x12')](_0x4ee689));if(_0x4ee689[_0xd8a4('0x13')]){if(_0x4ee689[_0xd8a4('0x13')][_0xd8a4('0x14')]===0x1f4){logger['error'](_0xd8a4('0xf'),_0x164c9b,_0x4ee689[_0xd8a4('0x13')]['message']);return _0x537d7c(_0x4ee689[_0xd8a4('0x13')]['message']);}logger[_0xd8a4('0x13')](_0xd8a4('0xf'),_0x164c9b,_0x4ee689[_0xd8a4('0x13')][_0xd8a4('0x15')]);return _0x1d4388(_0x4ee689[_0xd8a4('0x13')][_0xd8a4('0x15')]);}else{logger[_0xd8a4('0xe')](_0xd8a4('0xf'),_0x164c9b,_0xd8a4('0x10'));_0x1d4388(_0x4ee689['result'][_0xd8a4('0x15')]);}})[_0xd8a4('0x16')](function(_0x23cea1){logger[_0xd8a4('0x13')](_0xd8a4('0xf'),_0x164c9b,_0x23cea1);_0x537d7c(_0x23cea1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b9960bb..485d529 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 _0x34b7=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x34b7,0x196));var _0x734b=function(_0x1ba57f,_0xb81938){_0x1ba57f=_0x1ba57f-0x0;var _0x5a7f02=_0x34b7[_0x1ba57f];return _0x5a7f02;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x734b('0x7')]('/:id/fields',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xd')](_0x734b('0xf'),auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0x11')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0x13')]('/:id',auth[_0x734b('0x8')](),controller[_0x734b('0x14')]);module[_0x734b('0x15')]=router; \ No newline at end of file +var _0xb574=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util'];(function(_0x16740a,_0x11a37b){var _0x38d6c3=function(_0x72a835){while(--_0x72a835){_0x16740a['push'](_0x16740a['shift']());}};_0x38d6c3(++_0x11a37b);}(_0xb574,0x106));var _0x4b57=function(_0x13f34a,_0x47c9b4){_0x13f34a=_0x13f34a-0x0;var _0x5c73de=_0xb574[_0x13f34a];return _0x5c73de;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require('path');var timeout=require(_0x4b57('0x2'));var express=require(_0x4b57('0x3'));var router=express['Router']();var fs_extra=require(_0x4b57('0x4'));var auth=require(_0x4b57('0x5'));var interaction=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var controller=require(_0x4b57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4b57('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b57('0xa')](_0x4b57('0xb'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xd')]);router[_0x4b57('0xa')](_0x4b57('0xe'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xf')]);router['post']('/',auth[_0x4b57('0xc')](),controller[_0x4b57('0x10')]);router[_0x4b57('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4b57('0x12')]);router[_0x4b57('0x13')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x15')]);router[_0x4b57('0x16')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x17')]);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 28f3fc9..b48ee2b 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 _0x958a=['sequelize','exports','STRING','username'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x958a,0x128));var _0xa958=function(_0x3df36a,_0x49a4c7){_0x3df36a=_0x3df36a-0x0;var _0x163709=_0x958a[_0x3df36a];return _0x163709;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x324ec4,_0x1a4cab){var _0x6dee56=function(_0x426d41){while(--_0x426d41){_0x324ec4['push'](_0x324ec4['shift']());}};_0x6dee56(++_0x1a4cab);}(_0x9582,0x95));var _0x2958=function(_0x3d76f0,_0x56f2d3){_0x3d76f0=_0x3d76f0-0x0;var _0x128dfa=_0x9582[_0x3d76f0];return _0x128dfa;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d9bf04b..21d3a18 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 _0x17ae=['getDescriptions','FreshsalesField','Subjects','getFields','username','apiKey','remoteUri','substring','lastIndexOf','format','Token\x20token=','users','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','findOne','FreshsalesConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Descriptions'];(function(_0x3cd6cb,_0x1d6687){var _0x1fd7f7=function(_0x43f021){while(--_0x43f021){_0x3cd6cb['push'](_0x3cd6cb['shift']());}};_0x1fd7f7(++_0x1d6687);}(_0x17ae,0x198));var _0xe17a=function(_0x594fd7,_0x530b70){_0x594fd7=_0x594fd7-0x0;var _0x1d3a1b=_0x17ae[_0x594fd7];return _0x1d3a1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe17a('0x0'));var zipdir=require(_0xe17a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe17a('0x2'));var moment=require(_0xe17a('0x3'));var BPromise=require(_0xe17a('0x4'));var Mustache=require(_0xe17a('0x5'));var util=require(_0xe17a('0x6'));var path=require('path');var sox=require(_0xe17a('0x7'));var csv=require(_0xe17a('0x8'));var ejs=require(_0xe17a('0x9'));var fs=require('fs');var fs_extra=require(_0xe17a('0xa'));var _=require(_0xe17a('0xb'));var squel=require(_0xe17a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe17a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe17a('0xe'));var Papa=require('papaparse');var Redis=require(_0xe17a('0xf'));var authService=require(_0xe17a('0x10'));var qs=require(_0xe17a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe17a('0x12'));var logger=require(_0xe17a('0x13'))('api');var utils=require(_0xe17a('0x14'));var config=require(_0xe17a('0x15'));var licenseUtil=require(_0xe17a('0x16'));var db=require(_0xe17a('0x17'))['db'];var integrations=require(_0xe17a('0x18'));function respondWithStatusCode(_0x2cedf3,_0x23a24e){_0x23a24e=_0x23a24e||0xcc;return function(_0x58f600){if(_0x58f600){return _0x2cedf3['sendStatus'](_0x23a24e);}return _0x2cedf3[_0xe17a('0x19')](_0x23a24e)['end']();};}function respondWithResult(_0xc87e7f,_0x38e429){_0x38e429=_0x38e429||0xc8;return function(_0x1d7299){if(_0x1d7299){return _0xc87e7f[_0xe17a('0x19')](_0x38e429)[_0xe17a('0x1a')](_0x1d7299);}};}function respondWithFilteredResult(_0xb97bd8,_0x61c51a){return function(_0xb8444f){if(_0xb8444f){var _0x80181c=typeof _0x61c51a['offset']===_0xe17a('0x1b')&&typeof _0x61c51a[_0xe17a('0x1c')]===_0xe17a('0x1b');var _0x585896=_0xb8444f[_0xe17a('0x1d')];var _0x29c9ba=_0x80181c?0x0:_0x61c51a[_0xe17a('0x1e')];var _0x1476f1=_0x80181c?_0xb8444f[_0xe17a('0x1d')]:_0x61c51a[_0xe17a('0x1e')]+_0x61c51a[_0xe17a('0x1c')];var _0xa0b064;if(_0x1476f1>=_0x585896){_0x1476f1=_0x585896;_0xa0b064=0xc8;}else{_0xa0b064=0xce;}_0xb97bd8[_0xe17a('0x19')](_0xa0b064);return _0xb97bd8[_0xe17a('0x1f')](_0xe17a('0x20'),_0x29c9ba+'-'+_0x1476f1+'/'+_0x585896)[_0xe17a('0x1a')](_0xb8444f);}return null;};}function patchUpdates(_0x2b1abe){return function(_0x5b5334){try{jsonpatch[_0xe17a('0x21')](_0x5b5334,_0x2b1abe,!![]);}catch(_0x3faf54){return BPromise[_0xe17a('0x22')](_0x3faf54);}return _0x5b5334['save']();};}function saveUpdates(_0x4694c1,_0x2d5441){return function(_0x55f746){if(_0x55f746){return _0x55f746[_0xe17a('0x23')](_0x4694c1)[_0xe17a('0x24')](function(_0x3af2a7){return _0x3af2a7;});}return null;};}function removeEntity(_0x59923d,_0x1fa0d5){return function(_0x609405){if(_0x609405){return _0x609405[_0xe17a('0x25')]()[_0xe17a('0x24')](function(){_0x59923d['status'](0xcc)[_0xe17a('0x26')]();});}};}function handleEntityNotFound(_0x2eb65a,_0x41f58d){return function(_0x280faa){if(!_0x280faa){_0x2eb65a['sendStatus'](0x194);}return _0x280faa;};}function handleError(_0x4bab38,_0x4eef18){_0x4eef18=_0x4eef18||0x1f4;return function(_0x3ff974){logger[_0xe17a('0x27')](_0x3ff974[_0xe17a('0x28')]);if(_0x3ff974[_0xe17a('0x29')]){delete _0x3ff974[_0xe17a('0x29')];}_0x4bab38[_0xe17a('0x19')](_0x4eef18)[_0xe17a('0x2a')](_0x3ff974);};}exports[_0xe17a('0x2b')]=function(_0xd28089,_0xb839c3){var _0x2a71c4={},_0x1bfa9a={},_0x5135cb={'count':0x0,'rows':[]};var _0x527b3f=_[_0xe17a('0x2c')](db[_0xe17a('0x2d')][_0xe17a('0x2e')],function(_0x3dc213){return{'name':_0x3dc213[_0xe17a('0x2f')],'type':_0x3dc213['type'][_0xe17a('0x30')]};});_0x1bfa9a[_0xe17a('0x31')]=_[_0xe17a('0x2c')](_0x527b3f,_0xe17a('0x29'));_0x1bfa9a[_0xe17a('0x32')]=_['keys'](_0xd28089[_0xe17a('0x32')]);_0x1bfa9a[_0xe17a('0x33')]=_[_0xe17a('0x34')](_0x1bfa9a['model'],_0x1bfa9a['query']);_0x2a71c4[_0xe17a('0x35')]=_[_0xe17a('0x34')](_0x1bfa9a[_0xe17a('0x31')],qs['fields'](_0xd28089[_0xe17a('0x32')][_0xe17a('0x36')]));_0x2a71c4[_0xe17a('0x35')]=_0x2a71c4['attributes']['length']?_0x2a71c4['attributes']:_0x1bfa9a[_0xe17a('0x31')];if(!_0xd28089[_0xe17a('0x32')]['hasOwnProperty'](_0xe17a('0x37'))){_0x2a71c4[_0xe17a('0x1c')]=qs[_0xe17a('0x1c')](_0xd28089['query'][_0xe17a('0x1c')]);_0x2a71c4[_0xe17a('0x1e')]=qs[_0xe17a('0x1e')](_0xd28089[_0xe17a('0x32')][_0xe17a('0x1e')]);}_0x2a71c4['order']=qs[_0xe17a('0x38')](_0xd28089[_0xe17a('0x32')][_0xe17a('0x38')]);_0x2a71c4[_0xe17a('0x39')]=qs[_0xe17a('0x33')](_[_0xe17a('0x3a')](_0xd28089['query'],_0x1bfa9a[_0xe17a('0x33')]),_0x527b3f);if(_0xd28089['query']['filter']){_0x2a71c4['where']=_[_0xe17a('0x3b')](_0x2a71c4['where'],{'$or':_['map'](_0x527b3f,function(_0x5a4a11){if(_0x5a4a11[_0xe17a('0x3c')]!==_0xe17a('0x3d')){var _0x34e4eb={};_0x34e4eb[_0x5a4a11['name']]={'$like':'%'+_0xd28089[_0xe17a('0x32')][_0xe17a('0x3e')]+'%'};return _0x34e4eb;}})});}_0x2a71c4=_[_0xe17a('0x3b')]({},_0x2a71c4,_0xd28089[_0xe17a('0x3f')]);var _0x5da49b={'where':_0x2a71c4[_0xe17a('0x39')]};return db[_0xe17a('0x2d')][_0xe17a('0x1d')](_0x5da49b)[_0xe17a('0x24')](function(_0xf266de){_0x5135cb['count']=_0xf266de;if(_0xd28089[_0xe17a('0x32')][_0xe17a('0x40')]){_0x2a71c4[_0xe17a('0x41')]=[{'all':!![]}];}return db[_0xe17a('0x2d')][_0xe17a('0x42')](_0x2a71c4);})[_0xe17a('0x24')](function(_0x337cb4){_0x5135cb[_0xe17a('0x43')]=_0x337cb4;return _0x5135cb;})['then'](respondWithFilteredResult(_0xb839c3,_0x2a71c4))[_0xe17a('0x44')](handleError(_0xb839c3,null));};exports['show']=function(_0x574aa9,_0x41fb13){var _0x251e3f={'raw':![],'where':{'id':_0x574aa9[_0xe17a('0x45')]['id']}},_0x5ac9c9={};_0x5ac9c9[_0xe17a('0x31')]=_[_0xe17a('0x46')](db[_0xe17a('0x2d')][_0xe17a('0x2e')]);_0x5ac9c9['query']=_[_0xe17a('0x46')](_0x574aa9[_0xe17a('0x32')]);_0x5ac9c9['filters']=_['intersection'](_0x5ac9c9[_0xe17a('0x31')],_0x5ac9c9['query']);_0x251e3f[_0xe17a('0x35')]=_['intersection'](_0x5ac9c9[_0xe17a('0x31')],qs[_0xe17a('0x36')](_0x574aa9[_0xe17a('0x32')][_0xe17a('0x36')]));_0x251e3f[_0xe17a('0x35')]=_0x251e3f[_0xe17a('0x35')][_0xe17a('0x47')]?_0x251e3f[_0xe17a('0x35')]:_0x5ac9c9['model'];if(_0x574aa9[_0xe17a('0x32')][_0xe17a('0x40')]){_0x251e3f['include']=[{'all':!![]}];}_0x251e3f=_['merge']({},_0x251e3f,_0x574aa9[_0xe17a('0x3f')]);return db[_0xe17a('0x2d')]['find'](_0x251e3f)[_0xe17a('0x24')](handleEntityNotFound(_0x41fb13,null))['then'](respondWithResult(_0x41fb13,null))[_0xe17a('0x44')](handleError(_0x41fb13,null));};exports['create']=function(_0x1f7411,_0x58f391){return db[_0xe17a('0x2d')][_0xe17a('0x48')](_0x1f7411[_0xe17a('0x49')],{})['then'](respondWithResult(_0x58f391,0xc9))['catch'](handleError(_0x58f391,null));};exports['update']=function(_0x50c9fa,_0x1c03d6){if(_0x50c9fa[_0xe17a('0x49')]['id']){delete _0x50c9fa['body']['id'];}return db[_0xe17a('0x2d')][_0xe17a('0x4a')]({'where':{'id':_0x50c9fa[_0xe17a('0x45')]['id']}})[_0xe17a('0x24')](handleEntityNotFound(_0x1c03d6,null))[_0xe17a('0x24')](saveUpdates(_0x50c9fa[_0xe17a('0x49')],null))['then'](respondWithResult(_0x1c03d6,null))['catch'](handleError(_0x1c03d6,null));};exports[_0xe17a('0x25')]=function(_0xdd751d,_0x5550eb){return db[_0xe17a('0x2d')][_0xe17a('0x4a')]({'where':{'id':_0xdd751d[_0xe17a('0x45')]['id']}})[_0xe17a('0x24')](handleEntityNotFound(_0x5550eb,null))[_0xe17a('0x24')](removeEntity(_0x5550eb,null))['catch'](handleError(_0x5550eb,null));};exports['getConfigurations']=function(_0x44c5b7,_0x34c47c,_0x410c0b){var _0x3bd826={};var _0x372504={};var _0x4afba9;var _0x1a1ecd;return db[_0xe17a('0x2d')][_0xe17a('0x4b')]({'where':{'id':_0x44c5b7[_0xe17a('0x45')]['id']}})['then'](handleEntityNotFound(_0x34c47c,null))['then'](function(_0x39f273){if(_0x39f273){_0x4afba9=_0x39f273;_0x372504['model']=_[_0xe17a('0x46')](db[_0xe17a('0x4c')]['rawAttributes']);_0x372504['query']=_[_0xe17a('0x46')](_0x44c5b7[_0xe17a('0x32')]);_0x372504[_0xe17a('0x33')]=_['intersection'](_0x372504[_0xe17a('0x31')],_0x372504[_0xe17a('0x32')]);_0x3bd826['attributes']=_[_0xe17a('0x34')](_0x372504[_0xe17a('0x31')],qs[_0xe17a('0x36')](_0x44c5b7[_0xe17a('0x32')][_0xe17a('0x36')]));_0x3bd826[_0xe17a('0x35')]=_0x3bd826['attributes'][_0xe17a('0x47')]?_0x3bd826[_0xe17a('0x35')]:_0x372504[_0xe17a('0x31')];_0x3bd826[_0xe17a('0x4d')]=qs[_0xe17a('0x38')](_0x44c5b7[_0xe17a('0x32')][_0xe17a('0x38')]);_0x3bd826[_0xe17a('0x39')]=qs['filters'](_['pick'](_0x44c5b7[_0xe17a('0x32')],_0x372504[_0xe17a('0x33')]));if(_0x44c5b7[_0xe17a('0x32')][_0xe17a('0x3e')]){_0x3bd826[_0xe17a('0x39')]=_['merge'](_0x3bd826[_0xe17a('0x39')],{'$or':_[_0xe17a('0x2c')](_0x3bd826[_0xe17a('0x35')],function(_0x3766f9){var _0x4b7646={};_0x4b7646[_0x3766f9]={'$like':'%'+_0x44c5b7['query'][_0xe17a('0x3e')]+'%'};return _0x4b7646;})});}_0x3bd826=_[_0xe17a('0x3b')]({},_0x3bd826,_0x44c5b7[_0xe17a('0x3f')]);return _0x4afba9[_0xe17a('0x4e')](_0x3bd826);}})[_0xe17a('0x24')](function(_0x1e0ee7){if(_0x1e0ee7){_0x1a1ecd=_0x1e0ee7[_0xe17a('0x47')];if(!_0x44c5b7['query'][_0xe17a('0x4f')](_0xe17a('0x37'))){_0x3bd826[_0xe17a('0x1c')]=qs[_0xe17a('0x1c')](_0x44c5b7[_0xe17a('0x32')][_0xe17a('0x1c')]);_0x3bd826[_0xe17a('0x1e')]=qs['offset'](_0x44c5b7[_0xe17a('0x32')][_0xe17a('0x1e')]);}return _0x4afba9[_0xe17a('0x4e')](_0x3bd826);}})[_0xe17a('0x24')](function(_0xfe8909){if(_0xfe8909){return _0xfe8909?{'count':_0x1a1ecd,'rows':_0xfe8909}:null;}})[_0xe17a('0x24')](respondWithResult(_0x34c47c,null))[_0xe17a('0x44')](handleError(_0x34c47c,null));};exports['addConfiguration']=function(_0x304b14,_0x34ea41,_0xb59980){if(_0x304b14['body']['id']){delete _0x304b14[_0xe17a('0x49')]['id'];}return db[_0xe17a('0x2d')][_0xe17a('0x4b')]({'where':{'id':_0x304b14['params']['id']}})[_0xe17a('0x24')](handleEntityNotFound(_0x34ea41,null))[_0xe17a('0x24')](function(_0x3abab3){if(_0x3abab3){_0x304b14[_0xe17a('0x49')][_0xe17a('0x50')]=_0x3abab3['id'];_0x304b14['body']['Subjects']=integrations['getSubjects'](_0x304b14[_0xe17a('0x49')]['channel'],_0x304b14['body'][_0xe17a('0x3c')]);_0x304b14[_0xe17a('0x49')][_0xe17a('0x51')]=integrations[_0xe17a('0x52')](_0x304b14[_0xe17a('0x49')]['channel'],_0x304b14['body']['type']);return db[_0xe17a('0x4c')][_0xe17a('0x48')](_0x304b14['body'],{'include':[{'model':db[_0xe17a('0x53')],'as':_0xe17a('0x54')},{'model':db[_0xe17a('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x34ea41,null))[_0xe17a('0x44')](handleError(_0x34ea41,null));};exports[_0xe17a('0x55')]=function(_0x112f0b,_0x14c6d4,_0x5242a2){var _0x5a1624='';var _0xe7f6b2='';return db[_0xe17a('0x2d')][_0xe17a('0x4b')]({'where':{'id':_0x112f0b[_0xe17a('0x45')]['id']},'attributes':['id',_0xe17a('0x56'),'remoteUri',_0xe17a('0x57')]})[_0xe17a('0x24')](handleEntityNotFound(_0x14c6d4,null))[_0xe17a('0x24')](function(_0x1415ca){if(_0x1415ca){_0xe7f6b2=_0x1415ca['username'];_0x5a1624=_0x1415ca['remoteUri'];var _0x2c09d8=_0x1415ca[_0xe17a('0x58')]['slice'](-0x1);if(_0x2c09d8==='/'){_0x5a1624=_0x5a1624[_0xe17a('0x59')](0x0,_0x5a1624[_0xe17a('0x5a')](_0x2c09d8));}return rp({'method':'GET','uri':util[_0xe17a('0x5b')]('%s%s',_0x5a1624,'/api/selector/owners'),'headers':{'Authorization':_0xe17a('0x5c')+_0x1415ca['apiKey']},'json':!![]});}})[_0xe17a('0x24')](function(_0x1a0b79){if(_0x1a0b79){var _0x58bc61=_0x1a0b79[_0xe17a('0x5d')];var _0x4a4e1c=![];var _0x4a16ba=null;for(_0x4a16ba=0x0;_0x4a16ba<_0x58bc61[_0xe17a('0x47')];_0x4a16ba++){if(_0x58bc61[_0x4a16ba]['email']===_0xe7f6b2){_0x4a4e1c=!![];}}if(_0x4a4e1c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xe17a('0x24')](respondWithResult(_0x14c6d4,null))[_0xe17a('0x44')](function(_0x4cc682){var _0x78b75b=_0x112f0b['query'][_0xe17a('0x5e')]?0x1f4:_0x4cc682['statusCode']||0x1f4;logger[_0xe17a('0x27')](_0xe17a('0x5f'),_0xe17a('0x55'),_0x78b75b,JSON['stringify'](_0x4cc682));delete _0x4cc682[_0xe17a('0x29')];if(_0x78b75b===0x191){_0x78b75b=0x190;}_0x14c6d4[_0xe17a('0x19')](_0x78b75b)['send'](_0x112f0b[_0xe17a('0x32')][_0xe17a('0x5e')]?{'message':_0xe17a('0x60'),'statusCode':_0x4cc682[_0xe17a('0x61')]}:_0x4cc682);});}; \ No newline at end of file +var _0x01f1=['fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','lastIndexOf','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','send','map','FreshsalesAccount','fieldName','type','key','query','keys','intersection','model','attributes'];(function(_0x549332,_0x5abfdb){var _0x324f24=function(_0x3afdf0){while(--_0x3afdf0){_0x549332['push'](_0x549332['shift']());}};_0x324f24(++_0x5abfdb);}(_0x01f1,0xf9));var _0x101f=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x01f1[_0x36909d];return _0x1fd29d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x101f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x101f('0x1'));var moment=require(_0x101f('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x101f('0x3'));var path=require(_0x101f('0x4'));var sox=require(_0x101f('0x5'));var csv=require(_0x101f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x101f('0x7'));var _=require(_0x101f('0x8'));var squel=require(_0x101f('0x9'));var crypto=require(_0x101f('0xa'));var jsforce=require(_0x101f('0xb'));var deskjs=require(_0x101f('0xc'));var toCsv=require(_0x101f('0x6'));var querystring=require(_0x101f('0xd'));var Papa=require(_0x101f('0xe'));var Redis=require(_0x101f('0xf'));var authService=require(_0x101f('0x10'));var qs=require(_0x101f('0x11'));var as=require(_0x101f('0x12'));var hardwareService=require(_0x101f('0x13'));var logger=require(_0x101f('0x14'))(_0x101f('0x15'));var utils=require('../../config/utils');var config=require(_0x101f('0x16'));var licenseUtil=require(_0x101f('0x17'));var db=require(_0x101f('0x18'))['db'];var integrations=require(_0x101f('0x19'));function respondWithStatusCode(_0x43bf2f,_0xda2c80){_0xda2c80=_0xda2c80||0xcc;return function(_0x323f12){if(_0x323f12){return _0x43bf2f['sendStatus'](_0xda2c80);}return _0x43bf2f[_0x101f('0x1a')](_0xda2c80)[_0x101f('0x1b')]();};}function respondWithResult(_0x22af58,_0x49efea){_0x49efea=_0x49efea||0xc8;return function(_0x5075b0){if(_0x5075b0){return _0x22af58['status'](_0x49efea)[_0x101f('0x1c')](_0x5075b0);}};}function respondWithFilteredResult(_0x26f414,_0x7cf23b){return function(_0x48c815){if(_0x48c815){var _0x45ce97=typeof _0x7cf23b['offset']==='undefined'&&typeof _0x7cf23b['limit']===_0x101f('0x1d');var _0x19582e=_0x48c815[_0x101f('0x1e')];var _0x51de3b=_0x45ce97?0x0:_0x7cf23b['offset'];var _0x1a17b5=_0x45ce97?_0x48c815['count']:_0x7cf23b[_0x101f('0x1f')]+_0x7cf23b['limit'];var _0xbef2da;if(_0x1a17b5>=_0x19582e){_0x1a17b5=_0x19582e;_0xbef2da=0xc8;}else{_0xbef2da=0xce;}_0x26f414['status'](_0xbef2da);return _0x26f414[_0x101f('0x20')](_0x101f('0x21'),_0x51de3b+'-'+_0x1a17b5+'/'+_0x19582e)['json'](_0x48c815);}return null;};}function patchUpdates(_0xc25ea6){return function(_0x30e434){try{jsonpatch['apply'](_0x30e434,_0xc25ea6,!![]);}catch(_0x3cc721){return BPromise[_0x101f('0x22')](_0x3cc721);}return _0x30e434[_0x101f('0x23')]();};}function saveUpdates(_0x9b8599,_0x481957){return function(_0x3f6902){if(_0x3f6902){return _0x3f6902[_0x101f('0x24')](_0x9b8599)[_0x101f('0x25')](function(_0x32e971){return _0x32e971;});}return null;};}function removeEntity(_0x1ce4fb,_0xef3d50){return function(_0x1f3ed0){if(_0x1f3ed0){return _0x1f3ed0[_0x101f('0x26')]()[_0x101f('0x25')](function(){_0x1ce4fb['status'](0xcc)[_0x101f('0x1b')]();});}};}function handleEntityNotFound(_0x45654c,_0x18d548){return function(_0x1685f8){if(!_0x1685f8){_0x45654c[_0x101f('0x27')](0x194);}return _0x1685f8;};}function handleError(_0x5c550f,_0x43807a){_0x43807a=_0x43807a||0x1f4;return function(_0x512caa){logger['error'](_0x512caa['stack']);if(_0x512caa['name']){delete _0x512caa['name'];}_0x5c550f[_0x101f('0x1a')](_0x43807a)[_0x101f('0x28')](_0x512caa);};}exports['index']=function(_0xde439,_0x43eb07){var _0x45c1f1={},_0x143d43={},_0x1ca7c7={'count':0x0,'rows':[]};var _0xa6baa4=_[_0x101f('0x29')](db[_0x101f('0x2a')]['rawAttributes'],function(_0x4907ce){return{'name':_0x4907ce[_0x101f('0x2b')],'type':_0x4907ce[_0x101f('0x2c')][_0x101f('0x2d')]};});_0x143d43['model']=_[_0x101f('0x29')](_0xa6baa4,'name');_0x143d43[_0x101f('0x2e')]=_[_0x101f('0x2f')](_0xde439[_0x101f('0x2e')]);_0x143d43['filters']=_[_0x101f('0x30')](_0x143d43[_0x101f('0x31')],_0x143d43['query']);_0x45c1f1[_0x101f('0x32')]=_['intersection'](_0x143d43[_0x101f('0x31')],qs['fields'](_0xde439[_0x101f('0x2e')][_0x101f('0x33')]));_0x45c1f1[_0x101f('0x32')]=_0x45c1f1['attributes'][_0x101f('0x34')]?_0x45c1f1['attributes']:_0x143d43[_0x101f('0x31')];if(!_0xde439[_0x101f('0x2e')][_0x101f('0x35')]('nolimit')){_0x45c1f1[_0x101f('0x36')]=qs[_0x101f('0x36')](_0xde439[_0x101f('0x2e')]['limit']);_0x45c1f1[_0x101f('0x1f')]=qs[_0x101f('0x1f')](_0xde439[_0x101f('0x2e')][_0x101f('0x1f')]);}_0x45c1f1[_0x101f('0x37')]=qs['sort'](_0xde439[_0x101f('0x2e')][_0x101f('0x38')]);_0x45c1f1[_0x101f('0x39')]=qs['filters'](_[_0x101f('0x3a')](_0xde439[_0x101f('0x2e')],_0x143d43[_0x101f('0x3b')]),_0xa6baa4);if(_0xde439[_0x101f('0x2e')][_0x101f('0x3c')]){_0x45c1f1['where']=_[_0x101f('0x3d')](_0x45c1f1['where'],{'$or':_[_0x101f('0x29')](_0xa6baa4,function(_0x1363ab){if(_0x1363ab[_0x101f('0x2c')]!==_0x101f('0x3e')){var _0x2a7933={};_0x2a7933[_0x1363ab[_0x101f('0x3f')]]={'$like':'%'+_0xde439['query'][_0x101f('0x3c')]+'%'};return _0x2a7933;}})});}_0x45c1f1=_[_0x101f('0x3d')]({},_0x45c1f1,_0xde439[_0x101f('0x40')]);var _0x172127={'where':_0x45c1f1[_0x101f('0x39')]};return db[_0x101f('0x2a')][_0x101f('0x1e')](_0x172127)[_0x101f('0x25')](function(_0x41cd4f){_0x1ca7c7['count']=_0x41cd4f;if(_0xde439[_0x101f('0x2e')][_0x101f('0x41')]){_0x45c1f1[_0x101f('0x42')]=[{'all':!![]}];}return db[_0x101f('0x2a')][_0x101f('0x43')](_0x45c1f1);})[_0x101f('0x25')](function(_0x52c167){_0x1ca7c7[_0x101f('0x44')]=_0x52c167;return _0x1ca7c7;})['then'](respondWithFilteredResult(_0x43eb07,_0x45c1f1))[_0x101f('0x45')](handleError(_0x43eb07,null));};exports['show']=function(_0x44c884,_0x122f40){var _0x55c08c={'raw':![],'where':{'id':_0x44c884[_0x101f('0x46')]['id']}},_0x5cc507={};_0x5cc507[_0x101f('0x31')]=_[_0x101f('0x2f')](db[_0x101f('0x2a')][_0x101f('0x47')]);_0x5cc507['query']=_[_0x101f('0x2f')](_0x44c884[_0x101f('0x2e')]);_0x5cc507[_0x101f('0x3b')]=_[_0x101f('0x30')](_0x5cc507['model'],_0x5cc507['query']);_0x55c08c[_0x101f('0x32')]=_[_0x101f('0x30')](_0x5cc507[_0x101f('0x31')],qs[_0x101f('0x33')](_0x44c884[_0x101f('0x2e')][_0x101f('0x33')]));_0x55c08c[_0x101f('0x32')]=_0x55c08c[_0x101f('0x32')][_0x101f('0x34')]?_0x55c08c[_0x101f('0x32')]:_0x5cc507['model'];if(_0x44c884[_0x101f('0x2e')][_0x101f('0x41')]){_0x55c08c[_0x101f('0x42')]=[{'all':!![]}];}_0x55c08c=_[_0x101f('0x3d')]({},_0x55c08c,_0x44c884[_0x101f('0x40')]);return db[_0x101f('0x2a')][_0x101f('0x48')](_0x55c08c)['then'](handleEntityNotFound(_0x122f40,null))['then'](respondWithResult(_0x122f40,null))[_0x101f('0x45')](handleError(_0x122f40,null));};exports[_0x101f('0x49')]=function(_0x35382f,_0x2614b9){return db[_0x101f('0x2a')][_0x101f('0x49')](_0x35382f['body'],{})['then'](respondWithResult(_0x2614b9,0xc9))[_0x101f('0x45')](handleError(_0x2614b9,null));};exports[_0x101f('0x24')]=function(_0x1b5daa,_0x3aa01c){if(_0x1b5daa[_0x101f('0x4a')]['id']){delete _0x1b5daa['body']['id'];}return db[_0x101f('0x2a')]['find']({'where':{'id':_0x1b5daa['params']['id']}})[_0x101f('0x25')](handleEntityNotFound(_0x3aa01c,null))['then'](saveUpdates(_0x1b5daa[_0x101f('0x4a')],null))[_0x101f('0x25')](respondWithResult(_0x3aa01c,null))[_0x101f('0x45')](handleError(_0x3aa01c,null));};exports['destroy']=function(_0x18bd2f,_0x76e866){return db[_0x101f('0x2a')]['find']({'where':{'id':_0x18bd2f[_0x101f('0x46')]['id']}})[_0x101f('0x25')](handleEntityNotFound(_0x76e866,null))[_0x101f('0x25')](removeEntity(_0x76e866,null))[_0x101f('0x45')](handleError(_0x76e866,null));};exports[_0x101f('0x4b')]=function(_0x4356dc,_0x1870af,_0x495bde){var _0xa4bcc8={};var _0x3cfa8={};var _0x381493;var _0x19d039;return db[_0x101f('0x2a')][_0x101f('0x4c')]({'where':{'id':_0x4356dc[_0x101f('0x46')]['id']}})[_0x101f('0x25')](handleEntityNotFound(_0x1870af,null))['then'](function(_0x13b5f6){if(_0x13b5f6){_0x381493=_0x13b5f6;_0x3cfa8['model']=_[_0x101f('0x2f')](db[_0x101f('0x4d')][_0x101f('0x47')]);_0x3cfa8['query']=_[_0x101f('0x2f')](_0x4356dc[_0x101f('0x2e')]);_0x3cfa8['filters']=_[_0x101f('0x30')](_0x3cfa8[_0x101f('0x31')],_0x3cfa8[_0x101f('0x2e')]);_0xa4bcc8[_0x101f('0x32')]=_['intersection'](_0x3cfa8[_0x101f('0x31')],qs['fields'](_0x4356dc[_0x101f('0x2e')][_0x101f('0x33')]));_0xa4bcc8[_0x101f('0x32')]=_0xa4bcc8[_0x101f('0x32')][_0x101f('0x34')]?_0xa4bcc8[_0x101f('0x32')]:_0x3cfa8['model'];_0xa4bcc8['order']=qs[_0x101f('0x38')](_0x4356dc[_0x101f('0x2e')][_0x101f('0x38')]);_0xa4bcc8[_0x101f('0x39')]=qs['filters'](_[_0x101f('0x3a')](_0x4356dc[_0x101f('0x2e')],_0x3cfa8[_0x101f('0x3b')]));if(_0x4356dc['query'][_0x101f('0x3c')]){_0xa4bcc8[_0x101f('0x39')]=_[_0x101f('0x3d')](_0xa4bcc8['where'],{'$or':_[_0x101f('0x29')](_0xa4bcc8[_0x101f('0x32')],function(_0x19198f){var _0xbb756b={};_0xbb756b[_0x19198f]={'$like':'%'+_0x4356dc[_0x101f('0x2e')][_0x101f('0x3c')]+'%'};return _0xbb756b;})});}_0xa4bcc8=_[_0x101f('0x3d')]({},_0xa4bcc8,_0x4356dc[_0x101f('0x40')]);return _0x381493[_0x101f('0x4b')](_0xa4bcc8);}})[_0x101f('0x25')](function(_0x17cd0c){if(_0x17cd0c){_0x19d039=_0x17cd0c[_0x101f('0x34')];if(!_0x4356dc[_0x101f('0x2e')][_0x101f('0x35')](_0x101f('0x4e'))){_0xa4bcc8[_0x101f('0x36')]=qs[_0x101f('0x36')](_0x4356dc[_0x101f('0x2e')][_0x101f('0x36')]);_0xa4bcc8[_0x101f('0x1f')]=qs[_0x101f('0x1f')](_0x4356dc[_0x101f('0x2e')][_0x101f('0x1f')]);}return _0x381493[_0x101f('0x4b')](_0xa4bcc8);}})[_0x101f('0x25')](function(_0x4d3994){if(_0x4d3994){return _0x4d3994?{'count':_0x19d039,'rows':_0x4d3994}:null;}})['then'](respondWithResult(_0x1870af,null))['catch'](handleError(_0x1870af,null));};exports[_0x101f('0x4f')]=function(_0xfd0628,_0x15e01f,_0x7da474){if(_0xfd0628['body']['id']){delete _0xfd0628[_0x101f('0x4a')]['id'];}return db[_0x101f('0x2a')][_0x101f('0x4c')]({'where':{'id':_0xfd0628[_0x101f('0x46')]['id']}})[_0x101f('0x25')](handleEntityNotFound(_0x15e01f,null))[_0x101f('0x25')](function(_0x2be26f){if(_0x2be26f){_0xfd0628[_0x101f('0x4a')][_0x101f('0x50')]=_0x2be26f['id'];_0xfd0628['body'][_0x101f('0x51')]=integrations[_0x101f('0x52')](_0xfd0628[_0x101f('0x4a')][_0x101f('0x53')],_0xfd0628[_0x101f('0x4a')][_0x101f('0x2c')]);_0xfd0628['body'][_0x101f('0x54')]=integrations[_0x101f('0x55')](_0xfd0628[_0x101f('0x4a')][_0x101f('0x53')],_0xfd0628['body'][_0x101f('0x2c')]);return db[_0x101f('0x4d')][_0x101f('0x49')](_0xfd0628[_0x101f('0x4a')],{'include':[{'model':db[_0x101f('0x56')],'as':_0x101f('0x51')},{'model':db[_0x101f('0x56')],'as':'Descriptions'}]});}return null;})[_0x101f('0x25')](respondWithResult(_0x15e01f,null))[_0x101f('0x45')](handleError(_0x15e01f,null));};exports[_0x101f('0x57')]=function(_0x3cbe10,_0x108340,_0x48c316){var _0x51a754='';var _0x258d23='';return db[_0x101f('0x2a')][_0x101f('0x4c')]({'where':{'id':_0x3cbe10[_0x101f('0x46')]['id']},'attributes':['id',_0x101f('0x58'),'remoteUri',_0x101f('0x59')]})['then'](handleEntityNotFound(_0x108340,null))[_0x101f('0x25')](function(_0x3164a4){if(_0x3164a4){_0x258d23=_0x3164a4[_0x101f('0x58')];_0x51a754=_0x3164a4[_0x101f('0x5a')];var _0x172315=_0x3164a4[_0x101f('0x5a')][_0x101f('0x5b')](-0x1);if(_0x172315==='/'){_0x51a754=_0x51a754['substring'](0x0,_0x51a754[_0x101f('0x5c')](_0x172315));}return rp({'method':'GET','uri':util['format'](_0x101f('0x5d'),_0x51a754,_0x101f('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x3164a4[_0x101f('0x59')]},'json':!![]});}})['then'](function(_0x426604){if(_0x426604){var _0xb1a33d=_0x426604[_0x101f('0x5f')];var _0x1a7f4c=![];var _0x417301=null;for(_0x417301=0x0;_0x417301<_0xb1a33d[_0x101f('0x34')];_0x417301++){if(_0xb1a33d[_0x417301][_0x101f('0x60')]===_0x258d23){_0x1a7f4c=!![];}}if(_0x1a7f4c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x101f('0x61')});}}})[_0x101f('0x25')](respondWithResult(_0x108340,null))[_0x101f('0x45')](function(_0x46b3d3){var _0xacf76=_0x3cbe10[_0x101f('0x2e')][_0x101f('0x62')]?0x1f4:_0x46b3d3[_0x101f('0x63')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x101f('0x57'),_0xacf76,JSON['stringify'](_0x46b3d3));delete _0x46b3d3[_0x101f('0x3f')];if(_0xacf76===0x191){_0xacf76=0x190;}_0x108340[_0x101f('0x1a')](_0xacf76)[_0x101f('0x28')](_0x3cbe10[_0x101f('0x2e')][_0x101f('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x46b3d3[_0x101f('0x63')]}:_0x46b3d3);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index fa6d2c0..0ac2606 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 _0xc2c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_freshsales_accounts'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0xc2c7,0x134));var _0x7c2c=function(_0x312a8b,_0x3d90ab){_0x312a8b=_0x312a8b-0x0;var _0x2231dc=_0xc2c7[_0x312a8b];return _0x2231dc;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x7c2c('0x8'));module[_0x7c2c('0x9')]=function(_0x23c038,_0x54f027){return _0x23c038['define']('FreshsalesAccount',attributes,{'tableName':_0x7c2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xadb5,0xad));var _0x5adb=function(_0x5a2612,_0x56006e){_0x5a2612=_0x5a2612-0x0;var _0x3869a6=_0xadb5[_0x5a2612];return _0x3869a6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5adb('0x7'));module[_0x5adb('0x8')]=function(_0x3e2555,_0x3213e8){return _0x3e2555[_0x5adb('0x9')](_0x5adb('0xa'),attributes,{'tableName':_0x5adb('0xb'),'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 5434797..45807ff 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 _0x687b=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','raw','lodash','util','moment'];(function(_0x3ef5bb,_0x27e3ac){var _0x59d620=function(_0x46cd45){while(--_0x46cd45){_0x3ef5bb['push'](_0x3ef5bb['shift']());}};_0x59d620(++_0x27e3ac);}(_0x687b,0x14a));var _0xb687=function(_0x2aa323,_0x1c492b){_0x2aa323=_0x2aa323-0x0;var _0x17fcab=_0x687b[_0x2aa323];return _0x17fcab;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});}exports[_0xb687('0x18')]=function(_0x30d370){var _0x5eb9b9=this;return new Promise(function(_0x48958d,_0x12eff1){return db[_0xb687('0x19')][_0xb687('0x1a')]({'raw':_0x30d370['options']?_0x30d370[_0xb687('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x30d370[_0xb687('0x1b')]?_0x30d370[_0xb687('0x1b')][_0xb687('0x1c')]||null:null,'attributes':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1d')]||null:null,'limit':_0x30d370['options']?_0x30d370[_0xb687('0x1b')][_0xb687('0x1e')]||null:null,'include':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1f')]?_[_0xb687('0x20')](_0x30d370[_0xb687('0x1b')][_0xb687('0x1f')],function(_0xbf6c58){return{'model':db[_0xbf6c58[_0xb687('0x21')]],'as':_0xbf6c58['as'],'attributes':_0xbf6c58[_0xb687('0x1d')],'include':_0xbf6c58[_0xb687('0x1f')]?_['map'](_0xbf6c58[_0xb687('0x1f')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x21')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1d')],'include':_0x129347[_0xb687('0x1f')]?_[_0xb687('0x20')](_0x129347[_0xb687('0x1f')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x21')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3712cf){logger[_0xb687('0xd')](_0xb687('0x18'),_0x30d370);logger[_0xb687('0x10')](_0xb687('0x18'),_0x30d370,JSON[_0xb687('0x12')](_0x3712cf));_0x48958d(_0x3712cf);})['catch'](function(_0x28b69a){logger['error'](_0xb687('0x18'),_0x28b69a[_0xb687('0x15')],_0x30d370);_0x12eff1(_0x5eb9b9[_0xb687('0x13')](0x1f4,_0x28b69a[_0xb687('0x15')]));});});};exports[_0xb687('0x22')]=function(_0x43d20d){var _0xf1f0dd=this;return new Promise(function(_0x556815,_0x3da2be){return db[_0xb687('0x19')][_0xb687('0x23')]({'raw':_0x43d20d[_0xb687('0x1b')]?_0x43d20d[_0xb687('0x1b')][_0xb687('0x24')]===undefined?!![]:![]:!![],'where':_0x43d20d[_0xb687('0x1b')]?_0x43d20d[_0xb687('0x1b')][_0xb687('0x1c')]||null:null,'attributes':_0x43d20d[_0xb687('0x1b')]?_0x43d20d[_0xb687('0x1b')]['attributes']||null:null,'include':_0x43d20d['options']?_0x43d20d[_0xb687('0x1b')][_0xb687('0x1f')]?_[_0xb687('0x20')](_0x43d20d[_0xb687('0x1b')]['include'],function(_0x4f0b28){return{'model':db[_0x4f0b28[_0xb687('0x21')]],'as':_0x4f0b28['as'],'attributes':_0x4f0b28[_0xb687('0x1d')],'include':_0x4f0b28['include']?_[_0xb687('0x20')](_0x4f0b28[_0xb687('0x1f')],function(_0x548b83){return{'model':db[_0x548b83[_0xb687('0x21')]],'as':_0x548b83['as'],'attributes':_0x548b83['attributes'],'include':_0x548b83[_0xb687('0x1f')]?_[_0xb687('0x20')](_0x548b83[_0xb687('0x1f')],function(_0x3e146a){return{'model':db[_0x3e146a[_0xb687('0x21')]],'as':_0x3e146a['as'],'attributes':_0x3e146a[_0xb687('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x529b1a){logger[_0xb687('0xd')](_0xb687('0x22'),_0x43d20d);logger[_0xb687('0x10')]('ShowFreshsalesAccount',_0x43d20d,JSON[_0xb687('0x12')](_0x529b1a));_0x556815(_0x529b1a);})[_0xb687('0x17')](function(_0x1f1c88){logger[_0xb687('0x13')](_0xb687('0x22'),_0x1f1c88['message'],_0x43d20d);_0x3da2be(_0xf1f0dd[_0xb687('0x13')](0x1f4,_0x1f1c88[_0xb687('0x15')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5bcf9b,_0x3fcc1a){_0x5bcf9b=_0x5bcf9b-0x0;var _0x513620=_0x5f2f[_0x5bcf9b];return _0x513620;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetFreshsalesAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetFreshsalesAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowFreshsalesAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowFreshsalesAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowFreshsalesAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2a76970..7942058 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 _0x6974=['getSubjects','/:id/descriptions','/:id/fields','post','create','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x6974,0x1aa));var _0x4697=function(_0x138202,_0x50356b){_0x138202=_0x138202-0x0;var _0x3f21fd=_0x6974[_0x138202];return _0x3f21fd;};'use strict';var multer=require(_0x4697('0x0'));var util=require(_0x4697('0x1'));var path=require(_0x4697('0x2'));var timeout=require('connect-timeout');var express=require(_0x4697('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4697('0x4'));var interaction=require(_0x4697('0x5'));var config=require(_0x4697('0x6'));var controller=require(_0x4697('0x7'));router[_0x4697('0x8')]('/',auth['isAuthenticated'](),controller[_0x4697('0x9')]);router[_0x4697('0x8')](_0x4697('0xa'),auth[_0x4697('0xb')](),controller[_0x4697('0xc')]);router[_0x4697('0x8')](_0x4697('0xd'),auth[_0x4697('0xb')](),controller[_0x4697('0xe')]);router[_0x4697('0x8')](_0x4697('0xf'),auth[_0x4697('0xb')](),controller['getDescriptions']);router[_0x4697('0x8')](_0x4697('0x10'),auth[_0x4697('0xb')](),controller['getFields']);router[_0x4697('0x11')]('/',auth['isAuthenticated'](),controller[_0x4697('0x12')]);router['put'](_0x4697('0xa'),auth[_0x4697('0xb')](),controller[_0x4697('0x13')]);router[_0x4697('0x14')](_0x4697('0xa'),auth['isAuthenticated'](),controller[_0x4697('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1637=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x259d84,_0x99d2a1){var _0x28b1c1=function(_0x3a76a4){while(--_0x3a76a4){_0x259d84['push'](_0x259d84['shift']());}};_0x28b1c1(++_0x99d2a1);}(_0x1637,0x1da));var _0x7163=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x1637[_0x44268d];return _0x4be92d;};'use strict';var multer=require(_0x7163('0x0'));var util=require(_0x7163('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7163('0x2'));var router=express[_0x7163('0x3')]();var fs_extra=require(_0x7163('0x4'));var auth=require(_0x7163('0x5'));var interaction=require(_0x7163('0x6'));var config=require(_0x7163('0x7'));var controller=require(_0x7163('0x8'));router[_0x7163('0x9')]('/',auth[_0x7163('0xa')](),controller[_0x7163('0xb')]);router['get'](_0x7163('0xc'),auth[_0x7163('0xa')](),controller[_0x7163('0xd')]);router[_0x7163('0x9')](_0x7163('0xe'),auth[_0x7163('0xa')](),controller['getSubjects']);router[_0x7163('0x9')]('/:id/descriptions',auth[_0x7163('0xa')](),controller[_0x7163('0xf')]);router[_0x7163('0x9')](_0x7163('0x10'),auth[_0x7163('0xa')](),controller[_0x7163('0x11')]);router[_0x7163('0x12')]('/',auth[_0x7163('0xa')](),controller[_0x7163('0x13')]);router[_0x7163('0x14')](_0x7163('0xc'),auth['isAuthenticated'](),controller[_0x7163('0x15')]);router['delete'](_0x7163('0xc'),auth[_0x7163('0xa')](),controller[_0x7163('0x16')]);module[_0x7163('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d535821..82bf8c9 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 _0x3778=['exports','STRING','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3778,0x7a));var _0x8377=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3778[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8377('0x0'));module[_0x8377('0x1')]={'name':{'type':Sequelize[_0x8377('0x2')]},'description':{'type':Sequelize[_0x8377('0x2')]}}; \ No newline at end of file +var _0xb093=['STRING','sequelize','exports'];(function(_0x5ed928,_0x2dbbdc){var _0x2effcc=function(_0x19ba45){while(--_0x19ba45){_0x5ed928['push'](_0x5ed928['shift']());}};_0x2effcc(++_0x2dbbdc);}(_0xb093,0xc4));var _0x3b09=function(_0x3bbe0f,_0x47e915){_0x3bbe0f=_0x3bbe0f-0x0;var _0x5c60fb=_0xb093[_0x3bbe0f];return _0x5c60fb;};'use strict';var Sequelize=require(_0x3b09('0x0'));module[_0x3b09('0x1')]={'name':{'type':Sequelize[_0x3b09('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c20bde8..71078a7 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 _0x4551=['save','update','then','stack','name','map','FreshsalesConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','destroy','findOne','FreshsalesField','order','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject'];(function(_0x4d1cc5,_0x5cf765){var _0x5e3fe5=function(_0x1e96ef){while(--_0x1e96ef){_0x4d1cc5['push'](_0x4d1cc5['shift']());}};_0x5e3fe5(++_0x5cf765);}(_0x4551,0x15d));var _0x1455=function(_0x130011,_0x4e9d3e){_0x130011=_0x130011-0x0;var _0x4f0423=_0x4551[_0x130011];return _0x4f0423;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1455('0x0'));var zipdir=require(_0x1455('0x1'));var jsonpatch=require(_0x1455('0x2'));var rp=require(_0x1455('0x3'));var moment=require(_0x1455('0x4'));var BPromise=require(_0x1455('0x5'));var Mustache=require('mustache');var util=require(_0x1455('0x6'));var path=require(_0x1455('0x7'));var sox=require('sox');var csv=require(_0x1455('0x8'));var ejs=require(_0x1455('0x9'));var fs=require('fs');var fs_extra=require(_0x1455('0xa'));var _=require('lodash');var squel=require(_0x1455('0xb'));var crypto=require(_0x1455('0xc'));var jsforce=require(_0x1455('0xd'));var deskjs=require(_0x1455('0xe'));var toCsv=require(_0x1455('0x8'));var querystring=require(_0x1455('0xf'));var Papa=require(_0x1455('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1455('0x11'));var as=require(_0x1455('0x12'));var hardwareService=require(_0x1455('0x13'));var logger=require(_0x1455('0x14'))(_0x1455('0x15'));var utils=require(_0x1455('0x16'));var config=require(_0x1455('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1455('0x18'))['db'];function respondWithStatusCode(_0x2ef952,_0xfc4fde){_0xfc4fde=_0xfc4fde||0xcc;return function(_0x1257a8){if(_0x1257a8){return _0x2ef952[_0x1455('0x19')](_0xfc4fde);}return _0x2ef952[_0x1455('0x1a')](_0xfc4fde)[_0x1455('0x1b')]();};}function respondWithResult(_0x3ec800,_0x3e84c3){_0x3e84c3=_0x3e84c3||0xc8;return function(_0xb9fdb6){if(_0xb9fdb6){return _0x3ec800[_0x1455('0x1a')](_0x3e84c3)[_0x1455('0x1c')](_0xb9fdb6);}};}function respondWithFilteredResult(_0x17e55b,_0x5eef4f){return function(_0x55f085){if(_0x55f085){var _0x15f3e3=typeof _0x5eef4f[_0x1455('0x1d')]==='undefined'&&typeof _0x5eef4f['limit']===_0x1455('0x1e');var _0x2991f2=_0x55f085[_0x1455('0x1f')];var _0x150d74=_0x15f3e3?0x0:_0x5eef4f['offset'];var _0x4b7240=_0x15f3e3?_0x55f085[_0x1455('0x1f')]:_0x5eef4f[_0x1455('0x1d')]+_0x5eef4f[_0x1455('0x20')];var _0x4c457a;if(_0x4b7240>=_0x2991f2){_0x4b7240=_0x2991f2;_0x4c457a=0xc8;}else{_0x4c457a=0xce;}_0x17e55b[_0x1455('0x1a')](_0x4c457a);return _0x17e55b[_0x1455('0x21')](_0x1455('0x22'),_0x150d74+'-'+_0x4b7240+'/'+_0x2991f2)[_0x1455('0x1c')](_0x55f085);}return null;};}function patchUpdates(_0x3114ae){return function(_0x205c14){try{jsonpatch['apply'](_0x205c14,_0x3114ae,!![]);}catch(_0x286d56){return BPromise[_0x1455('0x23')](_0x286d56);}return _0x205c14[_0x1455('0x24')]();};}function saveUpdates(_0x4911c0,_0x597817){return function(_0x32cf64){if(_0x32cf64){return _0x32cf64[_0x1455('0x25')](_0x4911c0)[_0x1455('0x26')](function(_0x5ea81d){return _0x5ea81d;});}return null;};}function removeEntity(_0x5d87b7,_0x1f6528){return function(_0x2965d7){if(_0x2965d7){return _0x2965d7['destroy']()['then'](function(){_0x5d87b7[_0x1455('0x1a')](0xcc)[_0x1455('0x1b')]();});}};}function handleEntityNotFound(_0xdee7d7,_0x5a6316){return function(_0x2e84dd){if(!_0x2e84dd){_0xdee7d7['sendStatus'](0x194);}return _0x2e84dd;};}function handleError(_0x24e8fd,_0x10fc4a){_0x10fc4a=_0x10fc4a||0x1f4;return function(_0x4d29de){logger['error'](_0x4d29de[_0x1455('0x27')]);if(_0x4d29de['name']){delete _0x4d29de[_0x1455('0x28')];}_0x24e8fd[_0x1455('0x1a')](_0x10fc4a)['send'](_0x4d29de);};}exports['index']=function(_0x5000bc,_0x4a7a3e){var _0x3cf118={},_0xd83917={},_0x4f4752={'count':0x0,'rows':[]};var _0x34ab96=_[_0x1455('0x29')](db[_0x1455('0x2a')][_0x1455('0x2b')],function(_0x656463){return{'name':_0x656463['fieldName'],'type':_0x656463[_0x1455('0x2c')]['key']};});_0xd83917[_0x1455('0x2d')]=_[_0x1455('0x29')](_0x34ab96,_0x1455('0x28'));_0xd83917[_0x1455('0x2e')]=_[_0x1455('0x2f')](_0x5000bc['query']);_0xd83917[_0x1455('0x30')]=_[_0x1455('0x31')](_0xd83917['model'],_0xd83917['query']);_0x3cf118[_0x1455('0x32')]=_[_0x1455('0x31')](_0xd83917[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x5000bc['query'][_0x1455('0x33')]));_0x3cf118[_0x1455('0x32')]=_0x3cf118[_0x1455('0x32')][_0x1455('0x34')]?_0x3cf118['attributes']:_0xd83917['model'];if(!_0x5000bc[_0x1455('0x2e')][_0x1455('0x35')](_0x1455('0x36'))){_0x3cf118[_0x1455('0x20')]=qs[_0x1455('0x20')](_0x5000bc[_0x1455('0x2e')]['limit']);_0x3cf118[_0x1455('0x1d')]=qs[_0x1455('0x1d')](_0x5000bc[_0x1455('0x2e')][_0x1455('0x1d')]);}_0x3cf118['order']=qs[_0x1455('0x37')](_0x5000bc['query'][_0x1455('0x37')]);_0x3cf118[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x5000bc[_0x1455('0x2e')],_0xd83917[_0x1455('0x30')]),_0x34ab96);if(_0x5000bc[_0x1455('0x2e')][_0x1455('0x3a')]){_0x3cf118['where']=_['merge'](_0x3cf118[_0x1455('0x38')],{'$or':_['map'](_0x34ab96,function(_0x386411){if(_0x386411[_0x1455('0x2c')]!==_0x1455('0x3b')){var _0x3fa46b={};_0x3fa46b[_0x386411[_0x1455('0x28')]]={'$like':'%'+_0x5000bc[_0x1455('0x2e')][_0x1455('0x3a')]+'%'};return _0x3fa46b;}})});}_0x3cf118=_[_0x1455('0x3c')]({},_0x3cf118,_0x5000bc[_0x1455('0x3d')]);var _0x2ec0a9={'where':_0x3cf118[_0x1455('0x38')]};return db[_0x1455('0x2a')]['count'](_0x2ec0a9)[_0x1455('0x26')](function(_0x43dae5){_0x4f4752['count']=_0x43dae5;if(_0x5000bc[_0x1455('0x2e')][_0x1455('0x3e')]){_0x3cf118[_0x1455('0x3f')]=[{'all':!![]}];}return db[_0x1455('0x2a')][_0x1455('0x40')](_0x3cf118);})[_0x1455('0x26')](function(_0x5ecd30){_0x4f4752['rows']=_0x5ecd30;return _0x4f4752;})[_0x1455('0x26')](respondWithFilteredResult(_0x4a7a3e,_0x3cf118))['catch'](handleError(_0x4a7a3e,null));};exports[_0x1455('0x41')]=function(_0x363856,_0x2accc7){var _0x16f9a3={'raw':![],'where':{'id':_0x363856[_0x1455('0x42')]['id']}},_0x2da102={};_0x2da102[_0x1455('0x2d')]=_['keys'](db[_0x1455('0x2a')][_0x1455('0x2b')]);_0x2da102['query']=_[_0x1455('0x2f')](_0x363856['query']);_0x2da102[_0x1455('0x30')]=_[_0x1455('0x31')](_0x2da102[_0x1455('0x2d')],_0x2da102[_0x1455('0x2e')]);_0x16f9a3[_0x1455('0x32')]=_[_0x1455('0x31')](_0x2da102[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x363856[_0x1455('0x2e')][_0x1455('0x33')]));_0x16f9a3[_0x1455('0x32')]=_0x16f9a3[_0x1455('0x32')][_0x1455('0x34')]?_0x16f9a3[_0x1455('0x32')]:_0x2da102[_0x1455('0x2d')];if(_0x363856[_0x1455('0x2e')][_0x1455('0x3e')]){_0x16f9a3['include']=[{'all':!![]}];}_0x16f9a3=_[_0x1455('0x3c')]({},_0x16f9a3,_0x363856['options']);return db['FreshsalesConfiguration'][_0x1455('0x43')](_0x16f9a3)[_0x1455('0x26')](handleEntityNotFound(_0x2accc7,null))[_0x1455('0x26')](respondWithResult(_0x2accc7,null))[_0x1455('0x44')](handleError(_0x2accc7,null));};exports[_0x1455('0x45')]=function(_0x3badf7,_0x1930ff){return db[_0x1455('0x2a')]['create'](_0x3badf7[_0x1455('0x46')],{})['then'](respondWithResult(_0x1930ff,0xc9))[_0x1455('0x44')](handleError(_0x1930ff,null));};exports[_0x1455('0x25')]=function(_0x195913,_0x261063){if(_0x195913['body']['id']){delete _0x195913[_0x1455('0x46')]['id'];}return db[_0x1455('0x2a')][_0x1455('0x43')]({'where':{'id':_0x195913['params']['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x261063,null))['then'](saveUpdates(_0x195913['body'],null))['then'](respondWithResult(_0x261063,null))['catch'](handleError(_0x261063,null));};exports[_0x1455('0x47')]=function(_0xe05ac4,_0x27fae5){return db[_0x1455('0x2a')][_0x1455('0x43')]({'where':{'id':_0xe05ac4[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x27fae5,null))[_0x1455('0x26')](removeEntity(_0x27fae5,null))[_0x1455('0x44')](handleError(_0x27fae5,null));};exports['getSubjects']=function(_0x138168,_0x1207f7,_0x25f227){var _0x53f9b9={};var _0x1283e0={};var _0x28680a;var _0x23cc94;return db['FreshsalesConfiguration'][_0x1455('0x48')]({'where':{'id':_0x138168[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x1207f7,null))['then'](function(_0x3fe191){if(_0x3fe191){_0x28680a=_0x3fe191;_0x1283e0[_0x1455('0x2d')]=_['keys'](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x1283e0['query']=_[_0x1455('0x2f')](_0x138168[_0x1455('0x2e')]);_0x1283e0[_0x1455('0x30')]=_[_0x1455('0x31')](_0x1283e0[_0x1455('0x2d')],_0x1283e0[_0x1455('0x2e')]);_0x53f9b9['attributes']=_[_0x1455('0x31')](_0x1283e0[_0x1455('0x2d')],qs['fields'](_0x138168[_0x1455('0x2e')][_0x1455('0x33')]));_0x53f9b9[_0x1455('0x32')]=_0x53f9b9[_0x1455('0x32')]['length']?_0x53f9b9[_0x1455('0x32')]:_0x1283e0[_0x1455('0x2d')];_0x53f9b9[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x138168[_0x1455('0x2e')][_0x1455('0x37')]);_0x53f9b9[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x138168[_0x1455('0x2e')],_0x1283e0[_0x1455('0x30')]));if(_0x138168[_0x1455('0x2e')][_0x1455('0x3a')]){_0x53f9b9[_0x1455('0x38')]=_[_0x1455('0x3c')](_0x53f9b9['where'],{'$or':_[_0x1455('0x29')](_0x53f9b9[_0x1455('0x32')],function(_0x46df03){var _0x2cd608={};_0x2cd608[_0x46df03]={'$like':'%'+_0x138168[_0x1455('0x2e')][_0x1455('0x3a')]+'%'};return _0x2cd608;})});}_0x53f9b9=_[_0x1455('0x3c')]({},_0x53f9b9,_0x138168['options']);return _0x28680a['getSubjects'](_0x53f9b9);}})[_0x1455('0x26')](function(_0x2ebc7d){if(_0x2ebc7d){_0x23cc94=_0x2ebc7d[_0x1455('0x34')];if(!_0x138168[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x53f9b9['limit']=qs[_0x1455('0x20')](_0x138168[_0x1455('0x2e')][_0x1455('0x20')]);_0x53f9b9[_0x1455('0x1d')]=qs[_0x1455('0x1d')](_0x138168[_0x1455('0x2e')][_0x1455('0x1d')]);}return _0x28680a['getSubjects'](_0x53f9b9);}})[_0x1455('0x26')](function(_0x187ee7){if(_0x187ee7){return _0x187ee7?{'count':_0x23cc94,'rows':_0x187ee7}:null;}})[_0x1455('0x26')](respondWithResult(_0x1207f7,null))[_0x1455('0x44')](handleError(_0x1207f7,null));};exports['getDescriptions']=function(_0x2a973b,_0x172ba7,_0x21b3ce){var _0x588b2f={};var _0x420880={};var _0x1711e1;var _0x18c302;return db[_0x1455('0x2a')][_0x1455('0x48')]({'where':{'id':_0x2a973b[_0x1455('0x42')]['id']}})[_0x1455('0x26')](handleEntityNotFound(_0x172ba7,null))['then'](function(_0x51320e){if(_0x51320e){_0x1711e1=_0x51320e;_0x420880['model']=_['keys'](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x420880[_0x1455('0x2e')]=_[_0x1455('0x2f')](_0x2a973b['query']);_0x420880[_0x1455('0x30')]=_[_0x1455('0x31')](_0x420880[_0x1455('0x2d')],_0x420880[_0x1455('0x2e')]);_0x588b2f[_0x1455('0x32')]=_['intersection'](_0x420880['model'],qs[_0x1455('0x33')](_0x2a973b[_0x1455('0x2e')]['fields']));_0x588b2f[_0x1455('0x32')]=_0x588b2f[_0x1455('0x32')][_0x1455('0x34')]?_0x588b2f[_0x1455('0x32')]:_0x420880[_0x1455('0x2d')];_0x588b2f[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x2a973b[_0x1455('0x2e')]['sort']);_0x588b2f[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x2a973b['query'],_0x420880[_0x1455('0x30')]));if(_0x2a973b[_0x1455('0x2e')]['filter']){_0x588b2f['where']=_[_0x1455('0x3c')](_0x588b2f['where'],{'$or':_['map'](_0x588b2f[_0x1455('0x32')],function(_0x2ff46a){var _0x4c62dd={};_0x4c62dd[_0x2ff46a]={'$like':'%'+_0x2a973b[_0x1455('0x2e')]['filter']+'%'};return _0x4c62dd;})});}_0x588b2f=_[_0x1455('0x3c')]({},_0x588b2f,_0x2a973b[_0x1455('0x3d')]);return _0x1711e1[_0x1455('0x4b')](_0x588b2f);}})['then'](function(_0xab2cf6){if(_0xab2cf6){_0x18c302=_0xab2cf6[_0x1455('0x34')];if(!_0x2a973b[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x588b2f['limit']=qs[_0x1455('0x20')](_0x2a973b['query'][_0x1455('0x20')]);_0x588b2f['offset']=qs[_0x1455('0x1d')](_0x2a973b['query'][_0x1455('0x1d')]);}return _0x1711e1[_0x1455('0x4b')](_0x588b2f);}})[_0x1455('0x26')](function(_0xd9ef57){if(_0xd9ef57){return _0xd9ef57?{'count':_0x18c302,'rows':_0xd9ef57}:null;}})[_0x1455('0x26')](respondWithResult(_0x172ba7,null))[_0x1455('0x44')](handleError(_0x172ba7,null));};exports[_0x1455('0x4c')]=function(_0x18b5b1,_0x2def3d,_0x2eb65f){var _0x18e6dd={};var _0x396f58={};var _0x30995d;var _0x1ada4d;return db[_0x1455('0x2a')][_0x1455('0x48')]({'where':{'id':_0x18b5b1[_0x1455('0x42')]['id']}})['then'](handleEntityNotFound(_0x2def3d,null))['then'](function(_0x378416){if(_0x378416){_0x30995d=_0x378416;_0x396f58['model']=_[_0x1455('0x2f')](db[_0x1455('0x49')][_0x1455('0x2b')]);_0x396f58['query']=_[_0x1455('0x2f')](_0x18b5b1[_0x1455('0x2e')]);_0x396f58[_0x1455('0x30')]=_['intersection'](_0x396f58[_0x1455('0x2d')],_0x396f58[_0x1455('0x2e')]);_0x18e6dd['attributes']=_['intersection'](_0x396f58[_0x1455('0x2d')],qs[_0x1455('0x33')](_0x18b5b1[_0x1455('0x2e')][_0x1455('0x33')]));_0x18e6dd[_0x1455('0x32')]=_0x18e6dd['attributes'][_0x1455('0x34')]?_0x18e6dd[_0x1455('0x32')]:_0x396f58[_0x1455('0x2d')];_0x18e6dd[_0x1455('0x4a')]=qs[_0x1455('0x37')](_0x18b5b1['query'][_0x1455('0x37')]);_0x18e6dd[_0x1455('0x38')]=qs[_0x1455('0x30')](_[_0x1455('0x39')](_0x18b5b1['query'],_0x396f58['filters']));if(_0x18b5b1[_0x1455('0x2e')][_0x1455('0x3a')]){_0x18e6dd[_0x1455('0x38')]=_[_0x1455('0x3c')](_0x18e6dd['where'],{'$or':_[_0x1455('0x29')](_0x18e6dd[_0x1455('0x32')],function(_0x33b0e7){var _0x4bc078={};_0x4bc078[_0x33b0e7]={'$like':'%'+_0x18b5b1[_0x1455('0x2e')]['filter']+'%'};return _0x4bc078;})});}_0x18e6dd=_[_0x1455('0x3c')]({},_0x18e6dd,_0x18b5b1['options']);return _0x30995d[_0x1455('0x4c')](_0x18e6dd);}})[_0x1455('0x26')](function(_0x5cc317){if(_0x5cc317){_0x1ada4d=_0x5cc317[_0x1455('0x34')];if(!_0x18b5b1[_0x1455('0x2e')][_0x1455('0x35')]('nolimit')){_0x18e6dd['limit']=qs[_0x1455('0x20')](_0x18b5b1[_0x1455('0x2e')][_0x1455('0x20')]);_0x18e6dd['offset']=qs['offset'](_0x18b5b1[_0x1455('0x2e')]['offset']);}return _0x30995d[_0x1455('0x4c')](_0x18e6dd);}})[_0x1455('0x26')](function(_0x5d1307){if(_0x5d1307){return _0x5d1307?{'count':_0x1ada4d,'rows':_0x5d1307}:null;}})[_0x1455('0x26')](respondWithResult(_0x2def3d,null))[_0x1455('0x44')](handleError(_0x2def3d,null));}; \ No newline at end of file +var _0xaf57=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','params','find','create','body','getSubjects','findOne','FreshsalesField','merge','getDescriptions','getFields'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaf57,0x148));var _0x7af5=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xaf57[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require(_0x7af5('0x0'));var rimraf=require(_0x7af5('0x1'));var zipdir=require(_0x7af5('0x2'));var jsonpatch=require(_0x7af5('0x3'));var rp=require(_0x7af5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7af5('0x5'));var util=require(_0x7af5('0x6'));var path=require(_0x7af5('0x7'));var sox=require(_0x7af5('0x8'));var csv=require(_0x7af5('0x9'));var ejs=require(_0x7af5('0xa'));var fs=require('fs');var fs_extra=require(_0x7af5('0xb'));var _=require('lodash');var squel=require(_0x7af5('0xc'));var crypto=require(_0x7af5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7af5('0xe'));var toCsv=require(_0x7af5('0x9'));var querystring=require(_0x7af5('0xf'));var Papa=require(_0x7af5('0x10'));var Redis=require('ioredis');var authService=require(_0x7af5('0x11'));var qs=require(_0x7af5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7af5('0x13'));var logger=require(_0x7af5('0x14'))(_0x7af5('0x15'));var utils=require(_0x7af5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7af5('0x17'));var db=require(_0x7af5('0x18'))['db'];function respondWithStatusCode(_0x4ea0e1,_0x45e235){_0x45e235=_0x45e235||0xcc;return function(_0x2353bb){if(_0x2353bb){return _0x4ea0e1[_0x7af5('0x19')](_0x45e235);}return _0x4ea0e1[_0x7af5('0x1a')](_0x45e235)['end']();};}function respondWithResult(_0x383eed,_0x211df0){_0x211df0=_0x211df0||0xc8;return function(_0x4fdba4){if(_0x4fdba4){return _0x383eed[_0x7af5('0x1a')](_0x211df0)[_0x7af5('0x1b')](_0x4fdba4);}};}function respondWithFilteredResult(_0x72db6e,_0x39c054){return function(_0x468dc6){if(_0x468dc6){var _0x55a273=typeof _0x39c054[_0x7af5('0x1c')]===_0x7af5('0x1d')&&typeof _0x39c054['limit']==='undefined';var _0x52a4c7=_0x468dc6['count'];var _0x5b7d4b=_0x55a273?0x0:_0x39c054[_0x7af5('0x1c')];var _0x1a61a5=_0x55a273?_0x468dc6[_0x7af5('0x1e')]:_0x39c054[_0x7af5('0x1c')]+_0x39c054[_0x7af5('0x1f')];var _0x2077fd;if(_0x1a61a5>=_0x52a4c7){_0x1a61a5=_0x52a4c7;_0x2077fd=0xc8;}else{_0x2077fd=0xce;}_0x72db6e[_0x7af5('0x1a')](_0x2077fd);return _0x72db6e[_0x7af5('0x20')](_0x7af5('0x21'),_0x5b7d4b+'-'+_0x1a61a5+'/'+_0x52a4c7)['json'](_0x468dc6);}return null;};}function patchUpdates(_0x92f236){return function(_0x321bc9){try{jsonpatch[_0x7af5('0x22')](_0x321bc9,_0x92f236,!![]);}catch(_0xba7029){return BPromise['reject'](_0xba7029);}return _0x321bc9['save']();};}function saveUpdates(_0xf543c9,_0x239c47){return function(_0x512abc){if(_0x512abc){return _0x512abc[_0x7af5('0x23')](_0xf543c9)[_0x7af5('0x24')](function(_0x1de000){return _0x1de000;});}return null;};}function removeEntity(_0x595667,_0x4292e6){return function(_0x3d9582){if(_0x3d9582){return _0x3d9582[_0x7af5('0x25')]()['then'](function(){_0x595667[_0x7af5('0x1a')](0xcc)[_0x7af5('0x26')]();});}};}function handleEntityNotFound(_0x304bf6,_0xdeca9b){return function(_0x2fa361){if(!_0x2fa361){_0x304bf6[_0x7af5('0x19')](0x194);}return _0x2fa361;};}function handleError(_0x57b638,_0x2ef0f9){_0x2ef0f9=_0x2ef0f9||0x1f4;return function(_0x3cf2d7){logger[_0x7af5('0x27')](_0x3cf2d7[_0x7af5('0x28')]);if(_0x3cf2d7[_0x7af5('0x29')]){delete _0x3cf2d7[_0x7af5('0x29')];}_0x57b638[_0x7af5('0x1a')](_0x2ef0f9)[_0x7af5('0x2a')](_0x3cf2d7);};}exports[_0x7af5('0x2b')]=function(_0x1d073b,_0xbb206a){var _0xd34767={},_0xf0dba2={},_0x1a90d4={'count':0x0,'rows':[]};var _0x46fe4c=_['map'](db['FreshsalesConfiguration'][_0x7af5('0x2c')],function(_0x3587de){return{'name':_0x3587de[_0x7af5('0x2d')],'type':_0x3587de['type'][_0x7af5('0x2e')]};});_0xf0dba2[_0x7af5('0x2f')]=_[_0x7af5('0x30')](_0x46fe4c,_0x7af5('0x29'));_0xf0dba2[_0x7af5('0x31')]=_[_0x7af5('0x32')](_0x1d073b['query']);_0xf0dba2[_0x7af5('0x33')]=_[_0x7af5('0x34')](_0xf0dba2[_0x7af5('0x2f')],_0xf0dba2[_0x7af5('0x31')]);_0xd34767[_0x7af5('0x35')]=_[_0x7af5('0x34')](_0xf0dba2[_0x7af5('0x2f')],qs[_0x7af5('0x36')](_0x1d073b['query'][_0x7af5('0x36')]));_0xd34767['attributes']=_0xd34767[_0x7af5('0x35')][_0x7af5('0x37')]?_0xd34767[_0x7af5('0x35')]:_0xf0dba2[_0x7af5('0x2f')];if(!_0x1d073b['query'][_0x7af5('0x38')](_0x7af5('0x39'))){_0xd34767[_0x7af5('0x1f')]=qs['limit'](_0x1d073b[_0x7af5('0x31')]['limit']);_0xd34767[_0x7af5('0x1c')]=qs[_0x7af5('0x1c')](_0x1d073b[_0x7af5('0x31')][_0x7af5('0x1c')]);}_0xd34767[_0x7af5('0x3a')]=qs[_0x7af5('0x3b')](_0x1d073b[_0x7af5('0x31')][_0x7af5('0x3b')]);_0xd34767[_0x7af5('0x3c')]=qs['filters'](_[_0x7af5('0x3d')](_0x1d073b[_0x7af5('0x31')],_0xf0dba2['filters']),_0x46fe4c);if(_0x1d073b[_0x7af5('0x31')][_0x7af5('0x3e')]){_0xd34767[_0x7af5('0x3c')]=_['merge'](_0xd34767['where'],{'$or':_['map'](_0x46fe4c,function(_0x1ad7e4){if(_0x1ad7e4[_0x7af5('0x3f')]!==_0x7af5('0x40')){var _0x325bf5={};_0x325bf5[_0x1ad7e4['name']]={'$like':'%'+_0x1d073b[_0x7af5('0x31')][_0x7af5('0x3e')]+'%'};return _0x325bf5;}})});}_0xd34767=_['merge']({},_0xd34767,_0x1d073b[_0x7af5('0x41')]);var _0x3fa93f={'where':_0xd34767['where']};return db[_0x7af5('0x42')][_0x7af5('0x1e')](_0x3fa93f)[_0x7af5('0x24')](function(_0x773f3e){_0x1a90d4[_0x7af5('0x1e')]=_0x773f3e;if(_0x1d073b[_0x7af5('0x31')][_0x7af5('0x43')]){_0xd34767[_0x7af5('0x44')]=[{'all':!![]}];}return db[_0x7af5('0x42')][_0x7af5('0x45')](_0xd34767);})[_0x7af5('0x24')](function(_0x2794a9){_0x1a90d4[_0x7af5('0x46')]=_0x2794a9;return _0x1a90d4;})[_0x7af5('0x24')](respondWithFilteredResult(_0xbb206a,_0xd34767))[_0x7af5('0x47')](handleError(_0xbb206a,null));};exports['show']=function(_0x574c56,_0x105205){var _0x347fbc={'raw':![],'where':{'id':_0x574c56[_0x7af5('0x48')]['id']}},_0x4aa1f4={};_0x4aa1f4[_0x7af5('0x2f')]=_[_0x7af5('0x32')](db[_0x7af5('0x42')][_0x7af5('0x2c')]);_0x4aa1f4['query']=_[_0x7af5('0x32')](_0x574c56['query']);_0x4aa1f4[_0x7af5('0x33')]=_['intersection'](_0x4aa1f4[_0x7af5('0x2f')],_0x4aa1f4[_0x7af5('0x31')]);_0x347fbc[_0x7af5('0x35')]=_[_0x7af5('0x34')](_0x4aa1f4[_0x7af5('0x2f')],qs[_0x7af5('0x36')](_0x574c56['query'][_0x7af5('0x36')]));_0x347fbc[_0x7af5('0x35')]=_0x347fbc[_0x7af5('0x35')]['length']?_0x347fbc['attributes']:_0x4aa1f4[_0x7af5('0x2f')];if(_0x574c56['query']['includeAll']){_0x347fbc[_0x7af5('0x44')]=[{'all':!![]}];}_0x347fbc=_['merge']({},_0x347fbc,_0x574c56['options']);return db[_0x7af5('0x42')][_0x7af5('0x49')](_0x347fbc)[_0x7af5('0x24')](handleEntityNotFound(_0x105205,null))[_0x7af5('0x24')](respondWithResult(_0x105205,null))[_0x7af5('0x47')](handleError(_0x105205,null));};exports['create']=function(_0x19e8d3,_0x3056cf){return db['FreshsalesConfiguration'][_0x7af5('0x4a')](_0x19e8d3[_0x7af5('0x4b')],{})['then'](respondWithResult(_0x3056cf,0xc9))['catch'](handleError(_0x3056cf,null));};exports[_0x7af5('0x23')]=function(_0x2ebc96,_0x499805){if(_0x2ebc96['body']['id']){delete _0x2ebc96[_0x7af5('0x4b')]['id'];}return db[_0x7af5('0x42')][_0x7af5('0x49')]({'where':{'id':_0x2ebc96[_0x7af5('0x48')]['id']}})[_0x7af5('0x24')](handleEntityNotFound(_0x499805,null))[_0x7af5('0x24')](saveUpdates(_0x2ebc96[_0x7af5('0x4b')],null))['then'](respondWithResult(_0x499805,null))['catch'](handleError(_0x499805,null));};exports[_0x7af5('0x25')]=function(_0x4d0f44,_0x580689){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4d0f44[_0x7af5('0x48')]['id']}})[_0x7af5('0x24')](handleEntityNotFound(_0x580689,null))[_0x7af5('0x24')](removeEntity(_0x580689,null))[_0x7af5('0x47')](handleError(_0x580689,null));};exports[_0x7af5('0x4c')]=function(_0x134912,_0x3ad53f,_0x466188){var _0x561491={};var _0x48268a={};var _0x4445fd;var _0x3a2f32;return db[_0x7af5('0x42')][_0x7af5('0x4d')]({'where':{'id':_0x134912['params']['id']}})[_0x7af5('0x24')](handleEntityNotFound(_0x3ad53f,null))[_0x7af5('0x24')](function(_0x45b4f7){if(_0x45b4f7){_0x4445fd=_0x45b4f7;_0x48268a[_0x7af5('0x2f')]=_[_0x7af5('0x32')](db[_0x7af5('0x4e')][_0x7af5('0x2c')]);_0x48268a['query']=_[_0x7af5('0x32')](_0x134912[_0x7af5('0x31')]);_0x48268a[_0x7af5('0x33')]=_[_0x7af5('0x34')](_0x48268a[_0x7af5('0x2f')],_0x48268a[_0x7af5('0x31')]);_0x561491['attributes']=_['intersection'](_0x48268a[_0x7af5('0x2f')],qs[_0x7af5('0x36')](_0x134912['query'][_0x7af5('0x36')]));_0x561491[_0x7af5('0x35')]=_0x561491['attributes'][_0x7af5('0x37')]?_0x561491[_0x7af5('0x35')]:_0x48268a[_0x7af5('0x2f')];_0x561491[_0x7af5('0x3a')]=qs[_0x7af5('0x3b')](_0x134912[_0x7af5('0x31')]['sort']);_0x561491[_0x7af5('0x3c')]=qs[_0x7af5('0x33')](_['pick'](_0x134912[_0x7af5('0x31')],_0x48268a[_0x7af5('0x33')]));if(_0x134912[_0x7af5('0x31')][_0x7af5('0x3e')]){_0x561491[_0x7af5('0x3c')]=_['merge'](_0x561491['where'],{'$or':_[_0x7af5('0x30')](_0x561491[_0x7af5('0x35')],function(_0x2b3b9d){var _0x4ea391={};_0x4ea391[_0x2b3b9d]={'$like':'%'+_0x134912[_0x7af5('0x31')]['filter']+'%'};return _0x4ea391;})});}_0x561491=_[_0x7af5('0x4f')]({},_0x561491,_0x134912[_0x7af5('0x41')]);return _0x4445fd[_0x7af5('0x4c')](_0x561491);}})[_0x7af5('0x24')](function(_0x2ff41a){if(_0x2ff41a){_0x3a2f32=_0x2ff41a['length'];if(!_0x134912[_0x7af5('0x31')][_0x7af5('0x38')](_0x7af5('0x39'))){_0x561491[_0x7af5('0x1f')]=qs[_0x7af5('0x1f')](_0x134912['query'][_0x7af5('0x1f')]);_0x561491['offset']=qs[_0x7af5('0x1c')](_0x134912[_0x7af5('0x31')][_0x7af5('0x1c')]);}return _0x4445fd[_0x7af5('0x4c')](_0x561491);}})[_0x7af5('0x24')](function(_0x20fad2){if(_0x20fad2){return _0x20fad2?{'count':_0x3a2f32,'rows':_0x20fad2}:null;}})[_0x7af5('0x24')](respondWithResult(_0x3ad53f,null))['catch'](handleError(_0x3ad53f,null));};exports[_0x7af5('0x50')]=function(_0x1563b8,_0x27e4b8,_0x31904c){var _0x2f2e74={};var _0x1b4b1a={};var _0x437d2b;var _0x62d9e1;return db[_0x7af5('0x42')][_0x7af5('0x4d')]({'where':{'id':_0x1563b8[_0x7af5('0x48')]['id']}})[_0x7af5('0x24')](handleEntityNotFound(_0x27e4b8,null))[_0x7af5('0x24')](function(_0x13869f){if(_0x13869f){_0x437d2b=_0x13869f;_0x1b4b1a[_0x7af5('0x2f')]=_['keys'](db['FreshsalesField'][_0x7af5('0x2c')]);_0x1b4b1a[_0x7af5('0x31')]=_['keys'](_0x1563b8[_0x7af5('0x31')]);_0x1b4b1a['filters']=_[_0x7af5('0x34')](_0x1b4b1a[_0x7af5('0x2f')],_0x1b4b1a[_0x7af5('0x31')]);_0x2f2e74[_0x7af5('0x35')]=_[_0x7af5('0x34')](_0x1b4b1a[_0x7af5('0x2f')],qs['fields'](_0x1563b8['query'][_0x7af5('0x36')]));_0x2f2e74[_0x7af5('0x35')]=_0x2f2e74['attributes']['length']?_0x2f2e74['attributes']:_0x1b4b1a['model'];_0x2f2e74[_0x7af5('0x3a')]=qs[_0x7af5('0x3b')](_0x1563b8[_0x7af5('0x31')]['sort']);_0x2f2e74[_0x7af5('0x3c')]=qs[_0x7af5('0x33')](_[_0x7af5('0x3d')](_0x1563b8['query'],_0x1b4b1a['filters']));if(_0x1563b8[_0x7af5('0x31')][_0x7af5('0x3e')]){_0x2f2e74[_0x7af5('0x3c')]=_[_0x7af5('0x4f')](_0x2f2e74['where'],{'$or':_[_0x7af5('0x30')](_0x2f2e74[_0x7af5('0x35')],function(_0x45b129){var _0x2e905c={};_0x2e905c[_0x45b129]={'$like':'%'+_0x1563b8[_0x7af5('0x31')]['filter']+'%'};return _0x2e905c;})});}_0x2f2e74=_[_0x7af5('0x4f')]({},_0x2f2e74,_0x1563b8[_0x7af5('0x41')]);return _0x437d2b[_0x7af5('0x50')](_0x2f2e74);}})[_0x7af5('0x24')](function(_0x302c51){if(_0x302c51){_0x62d9e1=_0x302c51['length'];if(!_0x1563b8[_0x7af5('0x31')]['hasOwnProperty']('nolimit')){_0x2f2e74[_0x7af5('0x1f')]=qs['limit'](_0x1563b8[_0x7af5('0x31')][_0x7af5('0x1f')]);_0x2f2e74[_0x7af5('0x1c')]=qs['offset'](_0x1563b8['query'][_0x7af5('0x1c')]);}return _0x437d2b[_0x7af5('0x50')](_0x2f2e74);}})['then'](function(_0x3f9a94){if(_0x3f9a94){return _0x3f9a94?{'count':_0x62d9e1,'rows':_0x3f9a94}:null;}})['then'](respondWithResult(_0x27e4b8,null))[_0x7af5('0x47')](handleError(_0x27e4b8,null));};exports[_0x7af5('0x51')]=function(_0x2c4223,_0x1c75a3,_0x5d559b){var _0x5eb84a={};var _0x4b8ce0={};var _0x29e9d3;var _0x302959;return db['FreshsalesConfiguration'][_0x7af5('0x4d')]({'where':{'id':_0x2c4223[_0x7af5('0x48')]['id']}})[_0x7af5('0x24')](handleEntityNotFound(_0x1c75a3,null))[_0x7af5('0x24')](function(_0x324db1){if(_0x324db1){_0x29e9d3=_0x324db1;_0x4b8ce0[_0x7af5('0x2f')]=_[_0x7af5('0x32')](db[_0x7af5('0x4e')][_0x7af5('0x2c')]);_0x4b8ce0[_0x7af5('0x31')]=_[_0x7af5('0x32')](_0x2c4223[_0x7af5('0x31')]);_0x4b8ce0[_0x7af5('0x33')]=_['intersection'](_0x4b8ce0[_0x7af5('0x2f')],_0x4b8ce0[_0x7af5('0x31')]);_0x5eb84a[_0x7af5('0x35')]=_[_0x7af5('0x34')](_0x4b8ce0[_0x7af5('0x2f')],qs[_0x7af5('0x36')](_0x2c4223[_0x7af5('0x31')][_0x7af5('0x36')]));_0x5eb84a[_0x7af5('0x35')]=_0x5eb84a['attributes'][_0x7af5('0x37')]?_0x5eb84a[_0x7af5('0x35')]:_0x4b8ce0[_0x7af5('0x2f')];_0x5eb84a[_0x7af5('0x3a')]=qs[_0x7af5('0x3b')](_0x2c4223[_0x7af5('0x31')][_0x7af5('0x3b')]);_0x5eb84a['where']=qs[_0x7af5('0x33')](_[_0x7af5('0x3d')](_0x2c4223['query'],_0x4b8ce0[_0x7af5('0x33')]));if(_0x2c4223[_0x7af5('0x31')]['filter']){_0x5eb84a[_0x7af5('0x3c')]=_['merge'](_0x5eb84a[_0x7af5('0x3c')],{'$or':_[_0x7af5('0x30')](_0x5eb84a[_0x7af5('0x35')],function(_0x137f03){var _0xc3aba0={};_0xc3aba0[_0x137f03]={'$like':'%'+_0x2c4223[_0x7af5('0x31')]['filter']+'%'};return _0xc3aba0;})});}_0x5eb84a=_['merge']({},_0x5eb84a,_0x2c4223['options']);return _0x29e9d3[_0x7af5('0x51')](_0x5eb84a);}})[_0x7af5('0x24')](function(_0x3c1fee){if(_0x3c1fee){_0x302959=_0x3c1fee[_0x7af5('0x37')];if(!_0x2c4223[_0x7af5('0x31')][_0x7af5('0x38')]('nolimit')){_0x5eb84a[_0x7af5('0x1f')]=qs['limit'](_0x2c4223['query'][_0x7af5('0x1f')]);_0x5eb84a['offset']=qs[_0x7af5('0x1c')](_0x2c4223['query'][_0x7af5('0x1c')]);}return _0x29e9d3[_0x7af5('0x51')](_0x5eb84a);}})[_0x7af5('0x24')](function(_0x2de822){if(_0x2de822){return _0x2de822?{'count':_0x302959,'rows':_0x2de822}:null;}})[_0x7af5('0x24')](respondWithResult(_0x1c75a3,null))[_0x7af5('0x47')](handleError(_0x1c75a3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e0bb757..573f981 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 _0x72e7=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x45e505,_0x1bf5b3){var _0x52001f=function(_0x12114b){while(--_0x12114b){_0x45e505['push'](_0x45e505['shift']());}};_0x52001f(++_0x1bf5b3);}(_0x72e7,0x1e3));var _0x772e=function(_0x4b5c65,_0x391efa){_0x4b5c65=_0x4b5c65-0x0;var _0x1e79b5=_0x72e7[_0x4b5c65];return _0x1e79b5;};'use strict';var _=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var logger=require(_0x772e('0x2'))(_0x772e('0x3'));var moment=require(_0x772e('0x4'));var BPromise=require(_0x772e('0x5'));var rp=require(_0x772e('0x6'));var fs=require('fs');var path=require(_0x772e('0x7'));var rimraf=require(_0x772e('0x8'));var config=require(_0x772e('0x9'));var attributes=require(_0x772e('0xa'));module[_0x772e('0xb')]=function(_0x25452e,_0x5b6b00){return _0x25452e[_0x772e('0xc')](_0x772e('0xd'),attributes,{'tableName':_0x772e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x414b=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird'];(function(_0x9fc88c,_0x18fbd2){var _0x9e6473=function(_0x3e4adb){while(--_0x3e4adb){_0x9fc88c['push'](_0x9fc88c['shift']());}};_0x9e6473(++_0x18fbd2);}(_0x414b,0x1c4));var _0xb414=function(_0x5b7b9c,_0x1b7f14){_0x5b7b9c=_0x5b7b9c-0x0;var _0x134213=_0x414b[_0x5b7b9c];return _0x134213;};'use strict';var _=require('lodash');var util=require(_0xb414('0x0'));var logger=require(_0xb414('0x1'))('api');var moment=require(_0xb414('0x2'));var BPromise=require(_0xb414('0x3'));var rp=require(_0xb414('0x4'));var fs=require('fs');var path=require(_0xb414('0x5'));var rimraf=require(_0xb414('0x6'));var config=require(_0xb414('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xb414('0x8')]=function(_0x39358f,_0x270775){return _0x39358f[_0xb414('0x9')](_0xb414('0xa'),attributes,{'tableName':_0xb414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 88df399..19c3ca8 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 _0xa43d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x440593,_0x58be0f){var _0x28ba9a=function(_0x40a13c){while(--_0x40a13c){_0x440593['push'](_0x440593['shift']());}};_0x28ba9a(++_0x58be0f);}(_0xa43d,0x1da));var _0xda43=function(_0x59c233,_0xe0627e){_0x59c233=_0x59c233-0x0;var _0x26e0ef=_0xa43d[_0x59c233];return _0x26e0ef;};'use strict';var _=require(_0xda43('0x0'));var util=require(_0xda43('0x1'));var moment=require(_0xda43('0x2'));var BPromise=require(_0xda43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xda43('0x5'));var logger=require(_0xda43('0x6'))(_0xda43('0x7'));var config=require(_0xda43('0x8'));var jayson=require(_0xda43('0x9'));var client=jayson[_0xda43('0xa')][_0xda43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a4128,_0x2bd611,_0x4b969f){return new BPromise(function(_0x5af674,_0x42c1fa){return client[_0xda43('0xc')](_0x1a4128,_0x4b969f)[_0xda43('0xd')](function(_0x3a29dd){logger[_0xda43('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2bd611,'request\x20sent');logger[_0xda43('0xf')](_0xda43('0x10'),_0x2bd611,_0xda43('0x11'),JSON[_0xda43('0x12')](_0x3a29dd));if(_0x3a29dd[_0xda43('0x13')]){if(_0x3a29dd[_0xda43('0x13')][_0xda43('0x14')]===0x1f4){logger[_0xda43('0x13')](_0xda43('0x15'),_0x2bd611,_0x3a29dd['error'][_0xda43('0x16')]);return _0x42c1fa(_0x3a29dd[_0xda43('0x13')][_0xda43('0x16')]);}logger['error'](_0xda43('0x15'),_0x2bd611,_0x3a29dd[_0xda43('0x13')][_0xda43('0x16')]);return _0x5af674(_0x3a29dd[_0xda43('0x13')][_0xda43('0x16')]);}else{logger[_0xda43('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2bd611,'request\x20sent');_0x5af674(_0x3a29dd[_0xda43('0x17')][_0xda43('0x16')]);}})[_0xda43('0x18')](function(_0x557760){logger[_0xda43('0x13')](_0xda43('0x15'),_0x2bd611,_0x557760);_0x42c1fa(_0x557760);});});} \ No newline at end of file +var _0x94f5=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5d39ea,_0x46afdd){var _0x17b40e=function(_0x2c51d6){while(--_0x2c51d6){_0x5d39ea['push'](_0x5d39ea['shift']());}};_0x17b40e(++_0x46afdd);}(_0x94f5,0xdf));var _0x594f=function(_0x50e250,_0x2d3b0b){_0x50e250=_0x50e250-0x0;var _0x355df3=_0x94f5[_0x50e250];return _0x355df3;};'use strict';var _=require(_0x594f('0x0'));var util=require(_0x594f('0x1'));var moment=require(_0x594f('0x2'));var BPromise=require(_0x594f('0x3'));var rs=require(_0x594f('0x4'));var fs=require('fs');var Redis=require(_0x594f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x594f('0x6'));var logger=require(_0x594f('0x7'))(_0x594f('0x8'));var config=require(_0x594f('0x9'));var jayson=require(_0x594f('0xa'));var client=jayson[_0x594f('0xb')][_0x594f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57333e,_0x1da3a9,_0x5c64bc){return new BPromise(function(_0x5a39fb,_0x3b2d43){return client[_0x594f('0xd')](_0x57333e,_0x5c64bc)['then'](function(_0x140734){logger[_0x594f('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1da3a9,_0x594f('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1da3a9,_0x594f('0xf'),JSON[_0x594f('0x10')](_0x140734));if(_0x140734['error']){if(_0x140734[_0x594f('0x11')]['code']===0x1f4){logger[_0x594f('0x11')](_0x594f('0x12'),_0x1da3a9,_0x140734[_0x594f('0x11')][_0x594f('0x13')]);return _0x3b2d43(_0x140734[_0x594f('0x11')]['message']);}logger[_0x594f('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1da3a9,_0x140734[_0x594f('0x11')]['message']);return _0x5a39fb(_0x140734['error'][_0x594f('0x13')]);}else{logger[_0x594f('0xe')](_0x594f('0x12'),_0x1da3a9,_0x594f('0xf'));_0x5a39fb(_0x140734[_0x594f('0x14')][_0x594f('0x13')]);}})['catch'](function(_0x125cfe){logger[_0x594f('0x11')](_0x594f('0x12'),_0x1da3a9,_0x125cfe);_0x3b2d43(_0x125cfe);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a0db20f..562d8be 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 _0xf6fb=['isAuthenticated','index','/:id','show','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshsalesField.controller','get'];(function(_0x12be89,_0x32459e){var _0x1d0b3d=function(_0x1f560b){while(--_0x1f560b){_0x12be89['push'](_0x12be89['shift']());}};_0x1d0b3d(++_0x32459e);}(_0xf6fb,0x111));var _0xbf6f=function(_0x1ac526,_0x28cb90){_0x1ac526=_0x1ac526-0x0;var _0xc34d87=_0xf6fb[_0x1ac526];return _0xc34d87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf6f('0x0'));var timeout=require(_0xbf6f('0x1'));var express=require('express');var router=express[_0xbf6f('0x2')]();var fs_extra=require(_0xbf6f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbf6f('0x4'));var config=require('../../config/environment');var controller=require(_0xbf6f('0x5'));router[_0xbf6f('0x6')]('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0x8')]);router[_0xbf6f('0x6')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xa')]);router['post']('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xb')]);router[_0xbf6f('0xc')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller['update']);router['delete'](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x049e=['show','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x560375,_0x5c597b){var _0xf0df57=function(_0x8d88b){while(--_0x8d88b){_0x560375['push'](_0x560375['shift']());}};_0xf0df57(++_0x5c597b);}(_0x049e,0x16a));var _0xe049=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x049e[_0xb7a459];return _0x104ab5;};'use strict';var multer=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var path=require('path');var timeout=require(_0xe049('0x2'));var express=require('express');var router=express[_0xe049('0x3')]();var fs_extra=require(_0xe049('0x4'));var auth=require(_0xe049('0x5'));var interaction=require(_0xe049('0x6'));var config=require(_0xe049('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xe049('0x8')]('/',auth[_0xe049('0x9')](),controller[_0xe049('0xa')]);router[_0xe049('0x8')](_0xe049('0xb'),auth[_0xe049('0x9')](),controller[_0xe049('0xc')]);router['post']('/',auth[_0xe049('0x9')](),controller[_0xe049('0xd')]);router[_0xe049('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe049('0xf')]);router[_0xe049('0x10')](_0xe049('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4ad8f93..1755b32 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 _0x1933=['ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x3b0e0c,_0x5e4814){var _0x3efb86=function(_0x82a918){while(--_0x82a918){_0x3b0e0c['push'](_0x3b0e0c['shift']());}};_0x3efb86(++_0x5e4814);}(_0x1933,0x10a));var _0x3193=function(_0x3d32d6,_0x25c147){_0x3d32d6=_0x3d32d6-0x0;var _0x3db593=_0x1933[_0x3d32d6];return _0x3db593;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3193('0x0')]('string',_0x3193('0x1'),_0x3193('0x2'),_0x3193('0x3'),_0x3193('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3193('0x5')]},'key':{'type':Sequelize[_0x3193('0x5')]},'keyType':{'type':Sequelize[_0x3193('0x0')](_0x3193('0x6'),_0x3193('0x1'),_0x3193('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3193('0x5')]},'nameField':{'type':Sequelize[_0x3193('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5422=['customVariable','picklist','STRING','string','exports','ENUM','variable'];(function(_0x4fdc5f,_0x425bfe){var _0x4c10c7=function(_0x3f4c3d){while(--_0x3f4c3d){_0x4fdc5f['push'](_0x4fdc5f['shift']());}};_0x4c10c7(++_0x425bfe);}(_0x5422,0xc1));var _0x2542=function(_0x58db20,_0xb7f9e){_0x58db20=_0x58db20-0x0;var _0x2dc5a2=_0x5422[_0x58db20];return _0x2dc5a2;};'use strict';var Sequelize=require('sequelize');module[_0x2542('0x0')]={'type':{'type':Sequelize[_0x2542('0x1')]('string',_0x2542('0x2'),_0x2542('0x3'),'keyValue',_0x2542('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2542('0x5')]},'key':{'type':Sequelize[_0x2542('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x2542('0x6'),_0x2542('0x2'),_0x2542('0x3'))},'keyContent':{'type':Sequelize[_0x2542('0x5')]},'idField':{'type':Sequelize[_0x2542('0x5')]},'nameField':{'type':Sequelize[_0x2542('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2542('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 110e088..1458ccf 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 _0x65d3=['moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','limit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','count','include','findAll','rows','catch','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x37ee6b,_0x33a85f){var _0x4061e1=function(_0x239a3e){while(--_0x239a3e){_0x37ee6b['push'](_0x37ee6b['shift']());}};_0x4061e1(++_0x33a85f);}(_0x65d3,0x1b1));var _0x365d=function(_0x424a30,_0x4c71e3){_0x424a30=_0x424a30-0x0;var _0x31cc90=_0x65d3[_0x424a30];return _0x31cc90;};'use strict';var emlformat=require(_0x365d('0x0'));var rimraf=require(_0x365d('0x1'));var zipdir=require(_0x365d('0x2'));var jsonpatch=require(_0x365d('0x3'));var rp=require(_0x365d('0x4'));var moment=require(_0x365d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x365d('0x6'));var sox=require(_0x365d('0x7'));var csv=require(_0x365d('0x8'));var ejs=require(_0x365d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x365d('0xa'));var squel=require(_0x365d('0xb'));var crypto=require(_0x365d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x365d('0xd'));var toCsv=require(_0x365d('0x8'));var querystring=require(_0x365d('0xe'));var Papa=require(_0x365d('0xf'));var Redis=require(_0x365d('0x10'));var authService=require(_0x365d('0x11'));var qs=require(_0x365d('0x12'));var as=require(_0x365d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x365d('0x14'))(_0x365d('0x15'));var utils=require(_0x365d('0x16'));var config=require(_0x365d('0x17'));var licenseUtil=require(_0x365d('0x18'));var db=require(_0x365d('0x19'))['db'];function respondWithStatusCode(_0x3de863,_0x5e79a1){_0x5e79a1=_0x5e79a1||0xcc;return function(_0x5170b6){if(_0x5170b6){return _0x3de863[_0x365d('0x1a')](_0x5e79a1);}return _0x3de863[_0x365d('0x1b')](_0x5e79a1)[_0x365d('0x1c')]();};}function respondWithResult(_0x54f02d,_0x3951b4){_0x3951b4=_0x3951b4||0xc8;return function(_0x2718bb){if(_0x2718bb){return _0x54f02d['status'](_0x3951b4)[_0x365d('0x1d')](_0x2718bb);}};}function respondWithFilteredResult(_0x2403cf,_0x3a355a){return function(_0x2112c7){if(_0x2112c7){var _0x5b4f30=typeof _0x3a355a['offset']===_0x365d('0x1e')&&typeof _0x3a355a['limit']===_0x365d('0x1e');var _0x40c698=_0x2112c7['count'];var _0x11d8fd=_0x5b4f30?0x0:_0x3a355a[_0x365d('0x1f')];var _0x497876=_0x5b4f30?_0x2112c7['count']:_0x3a355a[_0x365d('0x1f')]+_0x3a355a['limit'];var _0x503512;if(_0x497876>=_0x40c698){_0x497876=_0x40c698;_0x503512=0xc8;}else{_0x503512=0xce;}_0x2403cf[_0x365d('0x1b')](_0x503512);return _0x2403cf['set'](_0x365d('0x20'),_0x11d8fd+'-'+_0x497876+'/'+_0x40c698)['json'](_0x2112c7);}return null;};}function patchUpdates(_0x137d6e){return function(_0x1351a6){try{jsonpatch[_0x365d('0x21')](_0x1351a6,_0x137d6e,!![]);}catch(_0x5197ae){return BPromise[_0x365d('0x22')](_0x5197ae);}return _0x1351a6[_0x365d('0x23')]();};}function saveUpdates(_0x3e9e2c,_0xf1f68c){return function(_0x1895b6){if(_0x1895b6){return _0x1895b6[_0x365d('0x24')](_0x3e9e2c)['then'](function(_0x5c55cd){return _0x5c55cd;});}return null;};}function removeEntity(_0x52dd21,_0x53e027){return function(_0x365fda){if(_0x365fda){return _0x365fda[_0x365d('0x25')]()[_0x365d('0x26')](function(){_0x52dd21[_0x365d('0x1b')](0xcc)[_0x365d('0x1c')]();});}};}function handleEntityNotFound(_0x5caef2,_0x421bed){return function(_0x1a6007){if(!_0x1a6007){_0x5caef2[_0x365d('0x1a')](0x194);}return _0x1a6007;};}function handleError(_0x29e517,_0x1fcd78){_0x1fcd78=_0x1fcd78||0x1f4;return function(_0x1cd077){logger[_0x365d('0x27')](_0x1cd077['stack']);if(_0x1cd077[_0x365d('0x28')]){delete _0x1cd077[_0x365d('0x28')];}_0x29e517[_0x365d('0x1b')](_0x1fcd78)['send'](_0x1cd077);};}exports[_0x365d('0x29')]=function(_0x224df0,_0x3b3ae4){var _0x4ae522={},_0xdbf1cb={},_0x2d29d8={'count':0x0,'rows':[]};var _0x4b92d4=_[_0x365d('0x2a')](db['FreshsalesField'][_0x365d('0x2b')],function(_0x2f525f){return{'name':_0x2f525f['fieldName'],'type':_0x2f525f[_0x365d('0x2c')][_0x365d('0x2d')]};});_0xdbf1cb[_0x365d('0x2e')]=_['map'](_0x4b92d4,_0x365d('0x28'));_0xdbf1cb['query']=_[_0x365d('0x2f')](_0x224df0[_0x365d('0x30')]);_0xdbf1cb[_0x365d('0x31')]=_[_0x365d('0x32')](_0xdbf1cb[_0x365d('0x2e')],_0xdbf1cb[_0x365d('0x30')]);_0x4ae522[_0x365d('0x33')]=_['intersection'](_0xdbf1cb[_0x365d('0x2e')],qs[_0x365d('0x34')](_0x224df0[_0x365d('0x30')][_0x365d('0x34')]));_0x4ae522[_0x365d('0x33')]=_0x4ae522[_0x365d('0x33')]['length']?_0x4ae522[_0x365d('0x33')]:_0xdbf1cb[_0x365d('0x2e')];if(!_0x224df0[_0x365d('0x30')]['hasOwnProperty']('nolimit')){_0x4ae522[_0x365d('0x35')]=qs[_0x365d('0x35')](_0x224df0[_0x365d('0x30')]['limit']);_0x4ae522['offset']=qs[_0x365d('0x1f')](_0x224df0['query'][_0x365d('0x1f')]);}_0x4ae522[_0x365d('0x36')]=qs[_0x365d('0x37')](_0x224df0[_0x365d('0x30')][_0x365d('0x37')]);_0x4ae522[_0x365d('0x38')]=qs[_0x365d('0x31')](_['pick'](_0x224df0[_0x365d('0x30')],_0xdbf1cb[_0x365d('0x31')]),_0x4b92d4);if(_0x224df0[_0x365d('0x30')][_0x365d('0x39')]){_0x4ae522[_0x365d('0x38')]=_[_0x365d('0x3a')](_0x4ae522['where'],{'$or':_['map'](_0x4b92d4,function(_0x3fdbb0){if(_0x3fdbb0[_0x365d('0x2c')]!==_0x365d('0x3b')){var _0x275880={};_0x275880[_0x3fdbb0['name']]={'$like':'%'+_0x224df0[_0x365d('0x30')][_0x365d('0x39')]+'%'};return _0x275880;}})});}_0x4ae522=_[_0x365d('0x3a')]({},_0x4ae522,_0x224df0[_0x365d('0x3c')]);var _0x5c391d={'where':_0x4ae522[_0x365d('0x38')]};return db[_0x365d('0x3d')][_0x365d('0x3e')](_0x5c391d)['then'](function(_0x55ed4c){_0x2d29d8[_0x365d('0x3e')]=_0x55ed4c;if(_0x224df0['query']['includeAll']){_0x4ae522[_0x365d('0x3f')]=[{'all':!![]}];}return db[_0x365d('0x3d')][_0x365d('0x40')](_0x4ae522);})['then'](function(_0x9c82bb){_0x2d29d8[_0x365d('0x41')]=_0x9c82bb;return _0x2d29d8;})[_0x365d('0x26')](respondWithFilteredResult(_0x3b3ae4,_0x4ae522))[_0x365d('0x42')](handleError(_0x3b3ae4,null));};exports['show']=function(_0x3bd2c5,_0x182869){var _0x488678={'raw':!![],'where':{'id':_0x3bd2c5[_0x365d('0x43')]['id']}},_0x4eb416={};_0x4eb416['model']=_['keys'](db['FreshsalesField'][_0x365d('0x2b')]);_0x4eb416[_0x365d('0x30')]=_[_0x365d('0x2f')](_0x3bd2c5[_0x365d('0x30')]);_0x4eb416[_0x365d('0x31')]=_[_0x365d('0x32')](_0x4eb416['model'],_0x4eb416[_0x365d('0x30')]);_0x488678[_0x365d('0x33')]=_[_0x365d('0x32')](_0x4eb416[_0x365d('0x2e')],qs[_0x365d('0x34')](_0x3bd2c5[_0x365d('0x30')][_0x365d('0x34')]));_0x488678[_0x365d('0x33')]=_0x488678[_0x365d('0x33')][_0x365d('0x44')]?_0x488678[_0x365d('0x33')]:_0x4eb416[_0x365d('0x2e')];if(_0x3bd2c5[_0x365d('0x30')][_0x365d('0x45')]){_0x488678['include']=[{'all':!![]}];}_0x488678=_[_0x365d('0x3a')]({},_0x488678,_0x3bd2c5[_0x365d('0x3c')]);return db[_0x365d('0x3d')][_0x365d('0x46')](_0x488678)[_0x365d('0x26')](handleEntityNotFound(_0x182869,null))[_0x365d('0x26')](respondWithResult(_0x182869,null))['catch'](handleError(_0x182869,null));};exports[_0x365d('0x47')]=function(_0x2b97b3,_0xcf3789){return db[_0x365d('0x3d')]['create'](_0x2b97b3[_0x365d('0x48')],{})[_0x365d('0x26')](respondWithResult(_0xcf3789,0xc9))[_0x365d('0x42')](handleError(_0xcf3789,null));};exports[_0x365d('0x24')]=function(_0x5926fb,_0x21ec1a){if(_0x5926fb[_0x365d('0x48')]['id']){delete _0x5926fb['body']['id'];}return db[_0x365d('0x3d')][_0x365d('0x46')]({'where':{'id':_0x5926fb[_0x365d('0x43')]['id']}})[_0x365d('0x26')](handleEntityNotFound(_0x21ec1a,null))[_0x365d('0x26')](saveUpdates(_0x5926fb[_0x365d('0x48')],null))[_0x365d('0x26')](respondWithResult(_0x21ec1a,null))['catch'](handleError(_0x21ec1a,null));};exports[_0x365d('0x25')]=function(_0x70b60c,_0x165676){return db[_0x365d('0x3d')][_0x365d('0x46')]({'where':{'id':_0x70b60c[_0x365d('0x43')]['id']}})['then'](handleEntityNotFound(_0x165676,null))[_0x365d('0x26')](removeEntity(_0x165676,null))['catch'](handleError(_0x165676,null));}; \ No newline at end of file +var _0xf7f0=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','name','send','index','FreshsalesField','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x339711,_0x29c2bb){var _0x121590=function(_0x4e62dc){while(--_0x4e62dc){_0x339711['push'](_0x339711['shift']());}};_0x121590(++_0x29c2bb);}(_0xf7f0,0x113));var _0x0f7f=function(_0x59bed0,_0xad50a5){_0x59bed0=_0x59bed0-0x0;var _0x2e5d4c=_0xf7f0[_0x59bed0];return _0x2e5d4c;};'use strict';var emlformat=require(_0x0f7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f7f('0x1'));var moment=require(_0x0f7f('0x2'));var BPromise=require(_0x0f7f('0x3'));var Mustache=require(_0x0f7f('0x4'));var util=require(_0x0f7f('0x5'));var path=require(_0x0f7f('0x6'));var sox=require(_0x0f7f('0x7'));var csv=require(_0x0f7f('0x8'));var ejs=require(_0x0f7f('0x9'));var fs=require('fs');var fs_extra=require(_0x0f7f('0xa'));var _=require(_0x0f7f('0xb'));var squel=require(_0x0f7f('0xc'));var crypto=require(_0x0f7f('0xd'));var jsforce=require(_0x0f7f('0xe'));var deskjs=require(_0x0f7f('0xf'));var toCsv=require(_0x0f7f('0x8'));var querystring=require(_0x0f7f('0x10'));var Papa=require(_0x0f7f('0x11'));var Redis=require('ioredis');var authService=require(_0x0f7f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f7f('0x13'));var hardwareService=require(_0x0f7f('0x14'));var logger=require(_0x0f7f('0x15'))('api');var utils=require(_0x0f7f('0x16'));var config=require(_0x0f7f('0x17'));var licenseUtil=require(_0x0f7f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579c65,_0x481961){_0x481961=_0x481961||0xcc;return function(_0x413ba3){if(_0x413ba3){return _0x579c65[_0x0f7f('0x19')](_0x481961);}return _0x579c65[_0x0f7f('0x1a')](_0x481961)[_0x0f7f('0x1b')]();};}function respondWithResult(_0x36c535,_0x280464){_0x280464=_0x280464||0xc8;return function(_0x5df588){if(_0x5df588){return _0x36c535[_0x0f7f('0x1a')](_0x280464)[_0x0f7f('0x1c')](_0x5df588);}};}function respondWithFilteredResult(_0x2d612b,_0x443c73){return function(_0x3aa7cf){if(_0x3aa7cf){var _0x17d24d=typeof _0x443c73['offset']===_0x0f7f('0x1d')&&typeof _0x443c73[_0x0f7f('0x1e')]===_0x0f7f('0x1d');var _0x479050=_0x3aa7cf[_0x0f7f('0x1f')];var _0x5b8769=_0x17d24d?0x0:_0x443c73[_0x0f7f('0x20')];var _0x3604d3=_0x17d24d?_0x3aa7cf[_0x0f7f('0x1f')]:_0x443c73[_0x0f7f('0x20')]+_0x443c73[_0x0f7f('0x1e')];var _0x17e0fe;if(_0x3604d3>=_0x479050){_0x3604d3=_0x479050;_0x17e0fe=0xc8;}else{_0x17e0fe=0xce;}_0x2d612b[_0x0f7f('0x1a')](_0x17e0fe);return _0x2d612b[_0x0f7f('0x21')]('Content-Range',_0x5b8769+'-'+_0x3604d3+'/'+_0x479050)[_0x0f7f('0x1c')](_0x3aa7cf);}return null;};}function patchUpdates(_0x425392){return function(_0x21c43e){try{jsonpatch[_0x0f7f('0x22')](_0x21c43e,_0x425392,!![]);}catch(_0x284843){return BPromise[_0x0f7f('0x23')](_0x284843);}return _0x21c43e[_0x0f7f('0x24')]();};}function saveUpdates(_0x5d7023,_0x104ec0){return function(_0xc2625){if(_0xc2625){return _0xc2625[_0x0f7f('0x25')](_0x5d7023)['then'](function(_0x3d562b){return _0x3d562b;});}return null;};}function removeEntity(_0x430326,_0x5a93df){return function(_0x3ca422){if(_0x3ca422){return _0x3ca422[_0x0f7f('0x26')]()[_0x0f7f('0x27')](function(){_0x430326['status'](0xcc)[_0x0f7f('0x1b')]();});}};}function handleEntityNotFound(_0x23f034,_0x124603){return function(_0x22dab4){if(!_0x22dab4){_0x23f034[_0x0f7f('0x19')](0x194);}return _0x22dab4;};}function handleError(_0x228237,_0x27b000){_0x27b000=_0x27b000||0x1f4;return function(_0xe5b7f8){logger['error'](_0xe5b7f8['stack']);if(_0xe5b7f8[_0x0f7f('0x28')]){delete _0xe5b7f8[_0x0f7f('0x28')];}_0x228237['status'](_0x27b000)[_0x0f7f('0x29')](_0xe5b7f8);};}exports[_0x0f7f('0x2a')]=function(_0x124616,_0x5892d1){var _0x4130c3={},_0x2cbdec={},_0x143e24={'count':0x0,'rows':[]};var _0x19c813=_['map'](db[_0x0f7f('0x2b')][_0x0f7f('0x2c')],function(_0x38eea2){return{'name':_0x38eea2[_0x0f7f('0x2d')],'type':_0x38eea2[_0x0f7f('0x2e')]['key']};});_0x2cbdec['model']=_['map'](_0x19c813,'name');_0x2cbdec[_0x0f7f('0x2f')]=_['keys'](_0x124616[_0x0f7f('0x2f')]);_0x2cbdec[_0x0f7f('0x30')]=_['intersection'](_0x2cbdec[_0x0f7f('0x31')],_0x2cbdec[_0x0f7f('0x2f')]);_0x4130c3['attributes']=_[_0x0f7f('0x32')](_0x2cbdec[_0x0f7f('0x31')],qs[_0x0f7f('0x33')](_0x124616[_0x0f7f('0x2f')][_0x0f7f('0x33')]));_0x4130c3[_0x0f7f('0x34')]=_0x4130c3[_0x0f7f('0x34')][_0x0f7f('0x35')]?_0x4130c3[_0x0f7f('0x34')]:_0x2cbdec[_0x0f7f('0x31')];if(!_0x124616[_0x0f7f('0x2f')]['hasOwnProperty'](_0x0f7f('0x36'))){_0x4130c3[_0x0f7f('0x1e')]=qs[_0x0f7f('0x1e')](_0x124616[_0x0f7f('0x2f')][_0x0f7f('0x1e')]);_0x4130c3[_0x0f7f('0x20')]=qs[_0x0f7f('0x20')](_0x124616[_0x0f7f('0x2f')]['offset']);}_0x4130c3[_0x0f7f('0x37')]=qs['sort'](_0x124616[_0x0f7f('0x2f')][_0x0f7f('0x38')]);_0x4130c3['where']=qs[_0x0f7f('0x30')](_['pick'](_0x124616[_0x0f7f('0x2f')],_0x2cbdec[_0x0f7f('0x30')]),_0x19c813);if(_0x124616[_0x0f7f('0x2f')][_0x0f7f('0x39')]){_0x4130c3[_0x0f7f('0x3a')]=_[_0x0f7f('0x3b')](_0x4130c3[_0x0f7f('0x3a')],{'$or':_['map'](_0x19c813,function(_0x3f4513){if(_0x3f4513['type']!==_0x0f7f('0x3c')){var _0x24e24c={};_0x24e24c[_0x3f4513[_0x0f7f('0x28')]]={'$like':'%'+_0x124616['query']['filter']+'%'};return _0x24e24c;}})});}_0x4130c3=_[_0x0f7f('0x3b')]({},_0x4130c3,_0x124616[_0x0f7f('0x3d')]);var _0x4fb171={'where':_0x4130c3['where']};return db[_0x0f7f('0x2b')]['count'](_0x4fb171)[_0x0f7f('0x27')](function(_0x4a3746){_0x143e24[_0x0f7f('0x1f')]=_0x4a3746;if(_0x124616[_0x0f7f('0x2f')]['includeAll']){_0x4130c3[_0x0f7f('0x3e')]=[{'all':!![]}];}return db[_0x0f7f('0x2b')][_0x0f7f('0x3f')](_0x4130c3);})[_0x0f7f('0x27')](function(_0x38e211){_0x143e24[_0x0f7f('0x40')]=_0x38e211;return _0x143e24;})[_0x0f7f('0x27')](respondWithFilteredResult(_0x5892d1,_0x4130c3))[_0x0f7f('0x41')](handleError(_0x5892d1,null));};exports[_0x0f7f('0x42')]=function(_0x89bc74,_0x5c6c3a){var _0x17d8b8={'raw':!![],'where':{'id':_0x89bc74[_0x0f7f('0x43')]['id']}},_0x1f33cd={};_0x1f33cd['model']=_[_0x0f7f('0x44')](db[_0x0f7f('0x2b')][_0x0f7f('0x2c')]);_0x1f33cd[_0x0f7f('0x2f')]=_[_0x0f7f('0x44')](_0x89bc74[_0x0f7f('0x2f')]);_0x1f33cd[_0x0f7f('0x30')]=_['intersection'](_0x1f33cd[_0x0f7f('0x31')],_0x1f33cd[_0x0f7f('0x2f')]);_0x17d8b8[_0x0f7f('0x34')]=_[_0x0f7f('0x32')](_0x1f33cd[_0x0f7f('0x31')],qs[_0x0f7f('0x33')](_0x89bc74[_0x0f7f('0x2f')][_0x0f7f('0x33')]));_0x17d8b8['attributes']=_0x17d8b8[_0x0f7f('0x34')][_0x0f7f('0x35')]?_0x17d8b8['attributes']:_0x1f33cd[_0x0f7f('0x31')];if(_0x89bc74['query'][_0x0f7f('0x45')]){_0x17d8b8[_0x0f7f('0x3e')]=[{'all':!![]}];}_0x17d8b8=_[_0x0f7f('0x3b')]({},_0x17d8b8,_0x89bc74['options']);return db[_0x0f7f('0x2b')][_0x0f7f('0x46')](_0x17d8b8)[_0x0f7f('0x27')](handleEntityNotFound(_0x5c6c3a,null))[_0x0f7f('0x27')](respondWithResult(_0x5c6c3a,null))['catch'](handleError(_0x5c6c3a,null));};exports[_0x0f7f('0x47')]=function(_0x3eaa55,_0x3dd83f){return db[_0x0f7f('0x2b')]['create'](_0x3eaa55[_0x0f7f('0x48')],{})[_0x0f7f('0x27')](respondWithResult(_0x3dd83f,0xc9))[_0x0f7f('0x41')](handleError(_0x3dd83f,null));};exports[_0x0f7f('0x25')]=function(_0x7558fe,_0x2d93bf){if(_0x7558fe[_0x0f7f('0x48')]['id']){delete _0x7558fe[_0x0f7f('0x48')]['id'];}return db[_0x0f7f('0x2b')][_0x0f7f('0x46')]({'where':{'id':_0x7558fe[_0x0f7f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d93bf,null))[_0x0f7f('0x27')](saveUpdates(_0x7558fe['body'],null))[_0x0f7f('0x27')](respondWithResult(_0x2d93bf,null))['catch'](handleError(_0x2d93bf,null));};exports['destroy']=function(_0x270eb3,_0xf857da){return db[_0x0f7f('0x2b')][_0x0f7f('0x46')]({'where':{'id':_0x270eb3['params']['id']}})[_0x0f7f('0x27')](handleEntityNotFound(_0xf857da,null))[_0x0f7f('0x27')](removeEntity(_0xf857da,null))['catch'](handleError(_0xf857da,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 448b6f2..2bc2930 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 _0x23a3=['exports','FreshsalesField','int_freshsales_fields','idField','FieldId','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x174661,_0x4ea43a){var _0x53c5e9=function(_0x2bf9a){while(--_0x2bf9a){_0x174661['push'](_0x174661['shift']());}};_0x53c5e9(++_0x4ea43a);}(_0x23a3,0x131));var _0x323a=function(_0x34cbdb,_0xa53f6){_0x34cbdb=_0x34cbdb-0x0;var _0x2fc43d=_0x23a3[_0x34cbdb];return _0x2fc43d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x323a('0x0'));var moment=require('moment');var BPromise=require(_0x323a('0x1'));var rp=require(_0x323a('0x2'));var fs=require('fs');var path=require(_0x323a('0x3'));var rimraf=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var attributes=require(_0x323a('0x6'));module[_0x323a('0x7')]=function(_0x3c1648,_0x14a418){return _0x3c1648['define'](_0x323a('0x8'),attributes,{'tableName':_0x323a('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x323a('0xa'),_0x323a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb875=['moment','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash'];(function(_0x4c536a,_0x54577c){var _0x38bbd4=function(_0x5c2f48){while(--_0x5c2f48){_0x4c536a['push'](_0x4c536a['shift']());}};_0x38bbd4(++_0x54577c);}(_0xb875,0x167));var _0x5b87=function(_0x24ff61,_0x549c55){_0x24ff61=_0x24ff61-0x0;var _0x3e9fe2=_0xb875[_0x24ff61];return _0x3e9fe2;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b87('0x1'));var BPromise=require('bluebird');var rp=require(_0x5b87('0x2'));var fs=require('fs');var path=require(_0x5b87('0x3'));var rimraf=require('rimraf');var config=require(_0x5b87('0x4'));var attributes=require(_0x5b87('0x5'));module[_0x5b87('0x6')]=function(_0x32ed83,_0x253d91){return _0x32ed83[_0x5b87('0x7')](_0x5b87('0x8'),attributes,{'tableName':_0x5b87('0x9'),'paranoid':![],'indexes':[{'name':_0x5b87('0xa'),'fields':[_0x5b87('0xb'),'FieldId'],'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 78678cb..10865ad 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 _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x61c914,_0x5f3a96){_0x61c914=_0x61c914-0x0;var _0x4e75cf=_0xbd51[_0x61c914];return _0x4e75cf;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xfcf0[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d2eb8ea..198f594 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x41b164,_0x48d6f1){var _0x635742=function(_0x182dcc){while(--_0x182dcc){_0x41b164['push'](_0x41b164['shift']());}};_0x635742(++_0x48d6f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x51f2bc,_0x394c29){var _0x60c7fd=function(_0x44b188){while(--_0x44b188){_0x51f2bc['push'](_0x51f2bc['shift']());}};_0x60c7fd(++_0x394c29);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 9858aca..6c4999a 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 _0xc110=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0xc110,0x1c1));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c11('0x0'));module[_0x0c11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c11('0x2')]},'username':{'type':Sequelize[_0x0c11('0x2')],'unique':_0x0c11('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0c11('0x2')]},'clientId':{'type':Sequelize[_0x0c11('0x2')]},'clientSecret':{'type':Sequelize[_0x0c11('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0c11('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0c11('0x4')](_0x0c11('0x5'),_0x0c11('0x6')),'defaultValue':_0x0c11('0x5')}}; \ No newline at end of file +var _0xe558=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x4a9ac6,_0x300ffe){var _0x88b87e=function(_0x4a18de){while(--_0x4a18de){_0x4a9ac6['push'](_0x4a9ac6['shift']());}};_0x88b87e(++_0x300ffe);}(_0xe558,0x70));var _0x8e55=function(_0x32e59a,_0x31d7ee){_0x32e59a=_0x32e59a-0x0;var _0x37c349=_0xe558[_0x32e59a];return _0x37c349;};'use strict';var Sequelize=require(_0x8e55('0x0'));module[_0x8e55('0x1')]={'name':{'type':Sequelize[_0x8e55('0x2')]},'description':{'type':Sequelize[_0x8e55('0x2')]},'username':{'type':Sequelize[_0x8e55('0x2')],'unique':_0x8e55('0x3')},'remoteUri':{'type':Sequelize[_0x8e55('0x2')]},'password':{'type':Sequelize[_0x8e55('0x2')]},'clientId':{'type':Sequelize[_0x8e55('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8e55('0x2')]},'serverUrl':{'type':Sequelize[_0x8e55('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8e55('0x4')](_0x8e55('0x5'),_0x8e55('0x6')),'defaultValue':_0x8e55('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b7b30a2..5264a97 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 _0xc81e=['../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','attributes','fields','hasOwnProperty','sort','pick','filters','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','keys','intersection','length','find','create','body','params','SalesforceConfiguration','order','options','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','False','false','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x453ab3,_0x4461dd){var _0x5898c6=function(_0x2c135e){while(--_0x2c135e){_0x453ab3['push'](_0x453ab3['shift']());}};_0x5898c6(++_0x4461dd);}(_0xc81e,0x1dd));var _0xec81=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xc81e[_0x2389bc];return _0x170548;};'use strict';var emlformat=require(_0xec81('0x0'));var rimraf=require(_0xec81('0x1'));var zipdir=require(_0xec81('0x2'));var jsonpatch=require(_0xec81('0x3'));var rp=require(_0xec81('0x4'));var moment=require('moment');var BPromise=require(_0xec81('0x5'));var Mustache=require(_0xec81('0x6'));var util=require(_0xec81('0x7'));var path=require('path');var sox=require(_0xec81('0x8'));var csv=require(_0xec81('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec81('0xa'));var _=require(_0xec81('0xb'));var squel=require('squel');var crypto=require(_0xec81('0xc'));var jsforce=require(_0xec81('0xd'));var deskjs=require(_0xec81('0xe'));var toCsv=require(_0xec81('0x9'));var querystring=require('querystring');var Papa=require(_0xec81('0xf'));var Redis=require(_0xec81('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xec81('0x11'));var as=require(_0xec81('0x12'));var hardwareService=require(_0xec81('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xec81('0x14'));var licenseUtil=require(_0xec81('0x15'));var db=require(_0xec81('0x16'))['db'];var integrations=require(_0xec81('0x17'));function respondWithStatusCode(_0x83f31c,_0x10caaa){_0x10caaa=_0x10caaa||0xcc;return function(_0x15fe1b){if(_0x15fe1b){return _0x83f31c[_0xec81('0x18')](_0x10caaa);}return _0x83f31c[_0xec81('0x19')](_0x10caaa)[_0xec81('0x1a')]();};}function respondWithResult(_0x3c4756,_0x118ea4){_0x118ea4=_0x118ea4||0xc8;return function(_0x1484e4){if(_0x1484e4){return _0x3c4756[_0xec81('0x19')](_0x118ea4)[_0xec81('0x1b')](_0x1484e4);}};}function respondWithFilteredResult(_0x2dc3cc,_0x1faddd){return function(_0x409b83){if(_0x409b83){var _0x393949=typeof _0x1faddd[_0xec81('0x1c')]===_0xec81('0x1d')&&typeof _0x1faddd[_0xec81('0x1e')]===_0xec81('0x1d');var _0x42badd=_0x409b83[_0xec81('0x1f')];var _0x1d576b=_0x393949?0x0:_0x1faddd[_0xec81('0x1c')];var _0x49b961=_0x393949?_0x409b83[_0xec81('0x1f')]:_0x1faddd[_0xec81('0x1c')]+_0x1faddd['limit'];var _0x58c6b7;if(_0x49b961>=_0x42badd){_0x49b961=_0x42badd;_0x58c6b7=0xc8;}else{_0x58c6b7=0xce;}_0x2dc3cc[_0xec81('0x19')](_0x58c6b7);return _0x2dc3cc[_0xec81('0x20')](_0xec81('0x21'),_0x1d576b+'-'+_0x49b961+'/'+_0x42badd)[_0xec81('0x1b')](_0x409b83);}return null;};}function patchUpdates(_0x4c19ba){return function(_0x1b7a93){try{jsonpatch[_0xec81('0x22')](_0x1b7a93,_0x4c19ba,!![]);}catch(_0x4fd9ae){return BPromise[_0xec81('0x23')](_0x4fd9ae);}return _0x1b7a93[_0xec81('0x24')]();};}function saveUpdates(_0x3445ad,_0x16d0a4){return function(_0xfa7d76){if(_0xfa7d76){return _0xfa7d76[_0xec81('0x25')](_0x3445ad)[_0xec81('0x26')](function(_0x32e193){return _0x32e193;});}return null;};}function removeEntity(_0x2758da,_0x144157){return function(_0x3ea134){if(_0x3ea134){return _0x3ea134['destroy']()[_0xec81('0x26')](function(){_0x2758da[_0xec81('0x19')](0xcc)[_0xec81('0x1a')]();});}};}function handleEntityNotFound(_0x36f435,_0x419f49){return function(_0x581384){if(!_0x581384){_0x36f435[_0xec81('0x18')](0x194);}return _0x581384;};}function handleError(_0x5f0bf5,_0x35bba8){_0x35bba8=_0x35bba8||0x1f4;return function(_0x4fbfa8){logger['error'](_0x4fbfa8[_0xec81('0x27')]);if(_0x4fbfa8[_0xec81('0x28')]){delete _0x4fbfa8[_0xec81('0x28')];}_0x5f0bf5[_0xec81('0x19')](_0x35bba8)['send'](_0x4fbfa8);};}exports[_0xec81('0x29')]=function(_0x3d9a02,_0x4c674f){var _0x492837={},_0x4fe6ec={},_0x37470d={'count':0x0,'rows':[]};var _0x3cfc43=_[_0xec81('0x2a')](db[_0xec81('0x2b')][_0xec81('0x2c')],function(_0x51fc80){return{'name':_0x51fc80[_0xec81('0x2d')],'type':_0x51fc80[_0xec81('0x2e')]['key']};});_0x4fe6ec[_0xec81('0x2f')]=_['map'](_0x3cfc43,_0xec81('0x28'));_0x4fe6ec[_0xec81('0x30')]=_['keys'](_0x3d9a02[_0xec81('0x30')]);_0x4fe6ec['filters']=_['intersection'](_0x4fe6ec[_0xec81('0x2f')],_0x4fe6ec[_0xec81('0x30')]);_0x492837[_0xec81('0x31')]=_['intersection'](_0x4fe6ec[_0xec81('0x2f')],qs[_0xec81('0x32')](_0x3d9a02[_0xec81('0x30')][_0xec81('0x32')]));_0x492837[_0xec81('0x31')]=_0x492837[_0xec81('0x31')]['length']?_0x492837[_0xec81('0x31')]:_0x4fe6ec[_0xec81('0x2f')];if(!_0x3d9a02['query'][_0xec81('0x33')]('nolimit')){_0x492837[_0xec81('0x1e')]=qs[_0xec81('0x1e')](_0x3d9a02[_0xec81('0x30')]['limit']);_0x492837[_0xec81('0x1c')]=qs['offset'](_0x3d9a02[_0xec81('0x30')][_0xec81('0x1c')]);}_0x492837['order']=qs[_0xec81('0x34')](_0x3d9a02[_0xec81('0x30')][_0xec81('0x34')]);_0x492837['where']=qs['filters'](_[_0xec81('0x35')](_0x3d9a02[_0xec81('0x30')],_0x4fe6ec[_0xec81('0x36')]),_0x3cfc43);if(_0x3d9a02[_0xec81('0x30')][_0xec81('0x37')]){_0x492837['where']=_['merge'](_0x492837[_0xec81('0x38')],{'$or':_['map'](_0x3cfc43,function(_0x37bd9c){if(_0x37bd9c['type']!==_0xec81('0x39')){var _0x9314f1={};_0x9314f1[_0x37bd9c['name']]={'$like':'%'+_0x3d9a02[_0xec81('0x30')][_0xec81('0x37')]+'%'};return _0x9314f1;}})});}_0x492837=_[_0xec81('0x3a')]({},_0x492837,_0x3d9a02['options']);var _0x5bb736={'where':_0x492837[_0xec81('0x38')]};return db['SalesforceAccount'][_0xec81('0x1f')](_0x5bb736)[_0xec81('0x26')](function(_0x7e54a1){_0x37470d[_0xec81('0x1f')]=_0x7e54a1;if(_0x3d9a02['query'][_0xec81('0x3b')]){_0x492837[_0xec81('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xec81('0x3d')](_0x492837);})[_0xec81('0x26')](function(_0x454e97){_0x37470d['rows']=_0x454e97;return _0x37470d;})['then'](respondWithFilteredResult(_0x4c674f,_0x492837))[_0xec81('0x3e')](handleError(_0x4c674f,null));};exports[_0xec81('0x3f')]=function(_0x541abd,_0x536ef7){var _0x2f659c={'raw':![],'where':{'id':_0x541abd['params']['id']}},_0x4193cc={};_0x4193cc[_0xec81('0x2f')]=_[_0xec81('0x40')](db['SalesforceAccount']['rawAttributes']);_0x4193cc['query']=_['keys'](_0x541abd[_0xec81('0x30')]);_0x4193cc['filters']=_[_0xec81('0x41')](_0x4193cc['model'],_0x4193cc['query']);_0x2f659c['attributes']=_['intersection'](_0x4193cc[_0xec81('0x2f')],qs[_0xec81('0x32')](_0x541abd[_0xec81('0x30')][_0xec81('0x32')]));_0x2f659c[_0xec81('0x31')]=_0x2f659c[_0xec81('0x31')][_0xec81('0x42')]?_0x2f659c['attributes']:_0x4193cc[_0xec81('0x2f')];if(_0x541abd[_0xec81('0x30')][_0xec81('0x3b')]){_0x2f659c['include']=[{'all':!![]}];}_0x2f659c=_[_0xec81('0x3a')]({},_0x2f659c,_0x541abd['options']);return db['SalesforceAccount'][_0xec81('0x43')](_0x2f659c)['then'](handleEntityNotFound(_0x536ef7,null))['then'](respondWithResult(_0x536ef7,null))[_0xec81('0x3e')](handleError(_0x536ef7,null));};exports['create']=function(_0x21b5b7,_0x36ee60){return db[_0xec81('0x2b')][_0xec81('0x44')](_0x21b5b7[_0xec81('0x45')],{})[_0xec81('0x26')](respondWithResult(_0x36ee60,0xc9))['catch'](handleError(_0x36ee60,null));};exports['update']=function(_0x4efcb3,_0x22c7ab){if(_0x4efcb3[_0xec81('0x45')]['id']){delete _0x4efcb3[_0xec81('0x45')]['id'];}return db[_0xec81('0x2b')]['find']({'where':{'id':_0x4efcb3[_0xec81('0x46')]['id']}})[_0xec81('0x26')](handleEntityNotFound(_0x22c7ab,null))[_0xec81('0x26')](saveUpdates(_0x4efcb3[_0xec81('0x45')],null))['then'](respondWithResult(_0x22c7ab,null))[_0xec81('0x3e')](handleError(_0x22c7ab,null));};exports['destroy']=function(_0x16a33b,_0x2ed4a3){return db['SalesforceAccount']['find']({'where':{'id':_0x16a33b['params']['id']}})[_0xec81('0x26')](handleEntityNotFound(_0x2ed4a3,null))['then'](removeEntity(_0x2ed4a3,null))[_0xec81('0x3e')](handleError(_0x2ed4a3,null));};exports['getConfigurations']=function(_0x3dfa6e,_0xe1bca,_0xc73c2e){var _0x3b4d63={};var _0x357df2={};var _0xc10557;var _0x1b449b;return db[_0xec81('0x2b')]['findOne']({'where':{'id':_0x3dfa6e[_0xec81('0x46')]['id']}})[_0xec81('0x26')](handleEntityNotFound(_0xe1bca,null))['then'](function(_0x51e7d2){if(_0x51e7d2){_0xc10557=_0x51e7d2;_0x357df2[_0xec81('0x2f')]=_[_0xec81('0x40')](db[_0xec81('0x47')][_0xec81('0x2c')]);_0x357df2[_0xec81('0x30')]=_['keys'](_0x3dfa6e['query']);_0x357df2[_0xec81('0x36')]=_['intersection'](_0x357df2[_0xec81('0x2f')],_0x357df2[_0xec81('0x30')]);_0x3b4d63[_0xec81('0x31')]=_[_0xec81('0x41')](_0x357df2['model'],qs[_0xec81('0x32')](_0x3dfa6e[_0xec81('0x30')][_0xec81('0x32')]));_0x3b4d63['attributes']=_0x3b4d63[_0xec81('0x31')]['length']?_0x3b4d63['attributes']:_0x357df2[_0xec81('0x2f')];_0x3b4d63[_0xec81('0x48')]=qs[_0xec81('0x34')](_0x3dfa6e[_0xec81('0x30')][_0xec81('0x34')]);_0x3b4d63[_0xec81('0x38')]=qs['filters'](_[_0xec81('0x35')](_0x3dfa6e[_0xec81('0x30')],_0x357df2['filters']));if(_0x3dfa6e[_0xec81('0x30')]['filter']){_0x3b4d63['where']=_[_0xec81('0x3a')](_0x3b4d63['where'],{'$or':_[_0xec81('0x2a')](_0x3b4d63[_0xec81('0x31')],function(_0x28cdb5){var _0x4ba771={};_0x4ba771[_0x28cdb5]={'$like':'%'+_0x3dfa6e[_0xec81('0x30')]['filter']+'%'};return _0x4ba771;})});}_0x3b4d63=_[_0xec81('0x3a')]({},_0x3b4d63,_0x3dfa6e[_0xec81('0x49')]);return _0xc10557[_0xec81('0x4a')](_0x3b4d63);}})['then'](function(_0x539323){if(_0x539323){_0x1b449b=_0x539323[_0xec81('0x42')];if(!_0x3dfa6e[_0xec81('0x30')]['hasOwnProperty'](_0xec81('0x4b'))){_0x3b4d63[_0xec81('0x1e')]=qs['limit'](_0x3dfa6e[_0xec81('0x30')]['limit']);_0x3b4d63[_0xec81('0x1c')]=qs[_0xec81('0x1c')](_0x3dfa6e[_0xec81('0x30')][_0xec81('0x1c')]);}return _0xc10557[_0xec81('0x4a')](_0x3b4d63);}})[_0xec81('0x26')](function(_0x2accef){if(_0x2accef){return _0x2accef?{'count':_0x1b449b,'rows':_0x2accef}:null;}})[_0xec81('0x26')](respondWithResult(_0xe1bca,null))[_0xec81('0x3e')](handleError(_0xe1bca,null));};exports[_0xec81('0x4c')]=function(_0x5db25a,_0x28c63b,_0x68312d){if(_0x5db25a[_0xec81('0x45')]['id']){delete _0x5db25a['body']['id'];}return db[_0xec81('0x2b')][_0xec81('0x4d')]({'where':{'id':_0x5db25a['params']['id']}})['then'](handleEntityNotFound(_0x28c63b,null))[_0xec81('0x26')](function(_0x1a1947){if(_0x1a1947){_0x5db25a['body'][_0xec81('0x4e')]=_0x1a1947['id'];_0x5db25a[_0xec81('0x45')][_0xec81('0x4f')]=integrations[_0xec81('0x50')](_0x5db25a['body'][_0xec81('0x51')],_0x5db25a[_0xec81('0x45')][_0xec81('0x2e')]);_0x5db25a['body'][_0xec81('0x52')]=integrations['getDescriptions'](_0x5db25a[_0xec81('0x45')][_0xec81('0x51')],_0x5db25a[_0xec81('0x45')][_0xec81('0x2e')]);return db[_0xec81('0x47')][_0xec81('0x44')](_0x5db25a['body'],{'include':[{'model':db[_0xec81('0x53')],'as':'Subjects'},{'model':db[_0xec81('0x53')],'as':_0xec81('0x52')}]});}return null;})[_0xec81('0x26')](respondWithResult(_0x28c63b,null))[_0xec81('0x3e')](handleError(_0x28c63b,null));};exports[_0xec81('0x54')]=function(_0x50a3a3,_0x2ff485,_0x218dd7){var _0x180898;var _0x54b0c5='';var _0x119c89=_0xec81('0x55');return db[_0xec81('0x2b')][_0xec81('0x4d')]({'where':{'id':_0x50a3a3[_0xec81('0x46')]['id']},'attributes':['id',_0xec81('0x56'),_0xec81('0x57'),_0xec81('0x58'),_0xec81('0x59'),_0xec81('0x5a'),'securityToken']})[_0xec81('0x26')](handleEntityNotFound(_0x2ff485,null))[_0xec81('0x26')](function(_0x55d1e0){if(_0x55d1e0){_0x54b0c5=_0x55d1e0['remoteUri'];var _0x297930=_0x54b0c5[_0xec81('0x5b')](-0x1);if(_0x297930==='/'){_0x54b0c5=_0x54b0c5[_0xec81('0x5c')](0x0,_0x54b0c5[_0xec81('0x5d')](_0x297930));}_0x180898=new jsforce[(_0xec81('0x5e'))]({'oauth2':{'loginUrl':_0x54b0c5,'clientId':_0x55d1e0[_0xec81('0x57')],'clientSecret':_0x55d1e0[_0xec81('0x58')]}});return _0x180898[_0xec81('0x5f')](_0x55d1e0[_0xec81('0x59')],_0x55d1e0[_0xec81('0x5a')][_0xec81('0x60')](_0x55d1e0[_0xec81('0x61')]));}})[_0xec81('0x26')](function(_0x32f23a){if(_0x32f23a){if(!_['isNil'](_0x50a3a3[_0xec81('0x30')][_0xec81('0x62')])){_0x119c89=_0x50a3a3[_0xec81('0x30')][_0xec81('0x62')];}return _0x180898[_0xec81('0x63')](_0x119c89)[_0xec81('0x64')]();}})[_0xec81('0x26')](function(_0x236b6f){var _0x2f9e29=[_0xec81('0x65'),_0xec81('0x66'),_0xec81('0x67'),'IsRecurrence',_0xec81('0x68'),_0xec81('0x69')];var _0x5b673c=['string',_0xec81('0x6a'),_0xec81('0x6b'),_0xec81('0x6c'),_0xec81('0x6d'),_0xec81('0x6e'),_0xec81('0x6f')];if(_0x236b6f){_[_0xec81('0x70')](_0x236b6f['fields'],function(_0x1cc267){return _0x2f9e29[_0xec81('0x71')](_0x1cc267[_0xec81('0x28')])||!_0x5b673c['includes'](_0x1cc267[_0xec81('0x2e')]);});return{'count':_0x236b6f[_0xec81('0x32')][_0xec81('0x42')],'rows':_[_0xec81('0x2a')](_0x236b6f['fields'],function(_0x306223){return{'id':_0x306223['name'],'name':_0x306223[_0xec81('0x72')],'custom':_0x306223[_0xec81('0x73')],'options':_0x306223[_0xec81('0x74')][_0xec81('0x42')]>0x0?_['map'](_0x306223[_0xec81('0x74')],function(_0x2f94ee){return{'name':_0x2f94ee[_0xec81('0x72')],'value':_0x2f94ee['value']};}):_0x306223[_0xec81('0x2e')]==_0xec81('0x6c')?[{'name':_0xec81('0x75'),'value':'true'},{'name':_0xec81('0x76'),'value':_0xec81('0x77')}]:[]};})};}})[_0xec81('0x26')](respondWithResult(_0x2ff485,null))[_0xec81('0x3e')](function(_0x1bce4f){var _0x4380f7=_0x50a3a3[_0xec81('0x30')][_0xec81('0x78')]?0x1f4:_0x1bce4f[_0xec81('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4380f7,JSON['stringify'](_0x1bce4f));delete _0x1bce4f[_0xec81('0x28')];if(_0x4380f7===0x191){_0x4380f7=0x190;}_0x2ff485[_0xec81('0x19')](_0x4380f7)[_0xec81('0x7a')](_0x50a3a3[_0xec81('0x30')][_0xec81('0x78')]?{'message':_0xec81('0x7b'),'statusCode':_0x1bce4f[_0xec81('0x79')]}:_0x1bce4f);});}; \ No newline at end of file +var _0xb7c9=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceAccount','count','include','catch','params','keys','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x31db69,_0xe8384c){var _0x27c34b=function(_0x568650){while(--_0x568650){_0x31db69['push'](_0x31db69['shift']());}};_0x27c34b(++_0xe8384c);}(_0xb7c9,0x6c));var _0x9b7c=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7c9[_0x45f951];return _0x24756c;};'use strict';var emlformat=require(_0x9b7c('0x0'));var rimraf=require(_0x9b7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b7c('0x2'));var moment=require('moment');var BPromise=require(_0x9b7c('0x3'));var Mustache=require(_0x9b7c('0x4'));var util=require(_0x9b7c('0x5'));var path=require('path');var sox=require(_0x9b7c('0x6'));var csv=require(_0x9b7c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9b7c('0x8'));var crypto=require(_0x9b7c('0x9'));var jsforce=require(_0x9b7c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9b7c('0x7'));var querystring=require(_0x9b7c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b7c('0xc'));var qs=require(_0x9b7c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b7c('0xe'));var logger=require(_0x9b7c('0xf'))(_0x9b7c('0x10'));var utils=require('../../config/utils');var config=require(_0x9b7c('0x11'));var licenseUtil=require(_0x9b7c('0x12'));var db=require(_0x9b7c('0x13'))['db'];var integrations=require(_0x9b7c('0x14'));function respondWithStatusCode(_0xff9c45,_0x20d913){_0x20d913=_0x20d913||0xcc;return function(_0x17bcfd){if(_0x17bcfd){return _0xff9c45[_0x9b7c('0x15')](_0x20d913);}return _0xff9c45[_0x9b7c('0x16')](_0x20d913)[_0x9b7c('0x17')]();};}function respondWithResult(_0x461b9c,_0x3f7144){_0x3f7144=_0x3f7144||0xc8;return function(_0xdfa5b7){if(_0xdfa5b7){return _0x461b9c['status'](_0x3f7144)['json'](_0xdfa5b7);}};}function respondWithFilteredResult(_0x3b6175,_0x381ce1){return function(_0x178111){if(_0x178111){var _0x31cc23=typeof _0x381ce1[_0x9b7c('0x18')]==='undefined'&&typeof _0x381ce1['limit']===_0x9b7c('0x19');var _0x4dc621=_0x178111['count'];var _0x5f58c1=_0x31cc23?0x0:_0x381ce1[_0x9b7c('0x18')];var _0x53fa5e=_0x31cc23?_0x178111['count']:_0x381ce1[_0x9b7c('0x18')]+_0x381ce1[_0x9b7c('0x1a')];var _0x213816;if(_0x53fa5e>=_0x4dc621){_0x53fa5e=_0x4dc621;_0x213816=0xc8;}else{_0x213816=0xce;}_0x3b6175[_0x9b7c('0x16')](_0x213816);return _0x3b6175[_0x9b7c('0x1b')](_0x9b7c('0x1c'),_0x5f58c1+'-'+_0x53fa5e+'/'+_0x4dc621)[_0x9b7c('0x1d')](_0x178111);}return null;};}function patchUpdates(_0x2b8ded){return function(_0x133440){try{jsonpatch[_0x9b7c('0x1e')](_0x133440,_0x2b8ded,!![]);}catch(_0x2466dc){return BPromise[_0x9b7c('0x1f')](_0x2466dc);}return _0x133440[_0x9b7c('0x20')]();};}function saveUpdates(_0x5ccb90,_0x2d15b1){return function(_0x2b677c){if(_0x2b677c){return _0x2b677c[_0x9b7c('0x21')](_0x5ccb90)[_0x9b7c('0x22')](function(_0x1a00d8){return _0x1a00d8;});}return null;};}function removeEntity(_0x4462bb,_0x3727df){return function(_0x470cfd){if(_0x470cfd){return _0x470cfd[_0x9b7c('0x23')]()[_0x9b7c('0x22')](function(){_0x4462bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ca27,_0x334423){return function(_0x4ac6b3){if(!_0x4ac6b3){_0x34ca27['sendStatus'](0x194);}return _0x4ac6b3;};}function handleError(_0x1347a5,_0x49bbe1){_0x49bbe1=_0x49bbe1||0x1f4;return function(_0x56e7c9){logger[_0x9b7c('0x24')](_0x56e7c9[_0x9b7c('0x25')]);if(_0x56e7c9[_0x9b7c('0x26')]){delete _0x56e7c9[_0x9b7c('0x26')];}_0x1347a5[_0x9b7c('0x16')](_0x49bbe1)[_0x9b7c('0x27')](_0x56e7c9);};}exports[_0x9b7c('0x28')]=function(_0x28a8ff,_0x4fd9b5){var _0x31158f={},_0xa0f417={},_0x9b7145={'count':0x0,'rows':[]};var _0xe794b1=_[_0x9b7c('0x29')](db['SalesforceAccount'][_0x9b7c('0x2a')],function(_0x3a5dd4){return{'name':_0x3a5dd4['fieldName'],'type':_0x3a5dd4[_0x9b7c('0x2b')][_0x9b7c('0x2c')]};});_0xa0f417[_0x9b7c('0x2d')]=_[_0x9b7c('0x29')](_0xe794b1,_0x9b7c('0x26'));_0xa0f417[_0x9b7c('0x2e')]=_['keys'](_0x28a8ff[_0x9b7c('0x2e')]);_0xa0f417['filters']=_[_0x9b7c('0x2f')](_0xa0f417[_0x9b7c('0x2d')],_0xa0f417[_0x9b7c('0x2e')]);_0x31158f['attributes']=_[_0x9b7c('0x2f')](_0xa0f417['model'],qs[_0x9b7c('0x30')](_0x28a8ff[_0x9b7c('0x2e')]['fields']));_0x31158f[_0x9b7c('0x31')]=_0x31158f[_0x9b7c('0x31')]['length']?_0x31158f['attributes']:_0xa0f417[_0x9b7c('0x2d')];if(!_0x28a8ff[_0x9b7c('0x2e')][_0x9b7c('0x32')]('nolimit')){_0x31158f[_0x9b7c('0x1a')]=qs['limit'](_0x28a8ff['query'][_0x9b7c('0x1a')]);_0x31158f['offset']=qs[_0x9b7c('0x18')](_0x28a8ff[_0x9b7c('0x2e')][_0x9b7c('0x18')]);}_0x31158f[_0x9b7c('0x33')]=qs[_0x9b7c('0x34')](_0x28a8ff[_0x9b7c('0x2e')][_0x9b7c('0x34')]);_0x31158f[_0x9b7c('0x35')]=qs[_0x9b7c('0x36')](_[_0x9b7c('0x37')](_0x28a8ff[_0x9b7c('0x2e')],_0xa0f417[_0x9b7c('0x36')]),_0xe794b1);if(_0x28a8ff[_0x9b7c('0x2e')][_0x9b7c('0x38')]){_0x31158f[_0x9b7c('0x35')]=_[_0x9b7c('0x39')](_0x31158f[_0x9b7c('0x35')],{'$or':_[_0x9b7c('0x29')](_0xe794b1,function(_0x56ded4){if(_0x56ded4[_0x9b7c('0x2b')]!==_0x9b7c('0x3a')){var _0x170052={};_0x170052[_0x56ded4['name']]={'$like':'%'+_0x28a8ff['query']['filter']+'%'};return _0x170052;}})});}_0x31158f=_['merge']({},_0x31158f,_0x28a8ff[_0x9b7c('0x3b')]);var _0x2081d5={'where':_0x31158f['where']};return db[_0x9b7c('0x3c')][_0x9b7c('0x3d')](_0x2081d5)[_0x9b7c('0x22')](function(_0x317b35){_0x9b7145[_0x9b7c('0x3d')]=_0x317b35;if(_0x28a8ff[_0x9b7c('0x2e')]['includeAll']){_0x31158f[_0x9b7c('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x31158f);})[_0x9b7c('0x22')](function(_0x2c09cf){_0x9b7145['rows']=_0x2c09cf;return _0x9b7145;})['then'](respondWithFilteredResult(_0x4fd9b5,_0x31158f))[_0x9b7c('0x3f')](handleError(_0x4fd9b5,null));};exports['show']=function(_0x38efa7,_0x5c654f){var _0x360513={'raw':![],'where':{'id':_0x38efa7[_0x9b7c('0x40')]['id']}},_0x163593={};_0x163593['model']=_[_0x9b7c('0x41')](db['SalesforceAccount'][_0x9b7c('0x2a')]);_0x163593[_0x9b7c('0x2e')]=_[_0x9b7c('0x41')](_0x38efa7[_0x9b7c('0x2e')]);_0x163593[_0x9b7c('0x36')]=_[_0x9b7c('0x2f')](_0x163593[_0x9b7c('0x2d')],_0x163593['query']);_0x360513['attributes']=_[_0x9b7c('0x2f')](_0x163593['model'],qs['fields'](_0x38efa7[_0x9b7c('0x2e')][_0x9b7c('0x30')]));_0x360513[_0x9b7c('0x31')]=_0x360513['attributes'][_0x9b7c('0x42')]?_0x360513[_0x9b7c('0x31')]:_0x163593['model'];if(_0x38efa7[_0x9b7c('0x2e')]['includeAll']){_0x360513[_0x9b7c('0x3e')]=[{'all':!![]}];}_0x360513=_[_0x9b7c('0x39')]({},_0x360513,_0x38efa7[_0x9b7c('0x3b')]);return db['SalesforceAccount'][_0x9b7c('0x43')](_0x360513)['then'](handleEntityNotFound(_0x5c654f,null))[_0x9b7c('0x22')](respondWithResult(_0x5c654f,null))[_0x9b7c('0x3f')](handleError(_0x5c654f,null));};exports[_0x9b7c('0x44')]=function(_0x458bb5,_0x3bfe7b){return db['SalesforceAccount'][_0x9b7c('0x44')](_0x458bb5[_0x9b7c('0x45')],{})[_0x9b7c('0x22')](respondWithResult(_0x3bfe7b,0xc9))[_0x9b7c('0x3f')](handleError(_0x3bfe7b,null));};exports[_0x9b7c('0x21')]=function(_0x3bbe49,_0x1bd9ae){if(_0x3bbe49[_0x9b7c('0x45')]['id']){delete _0x3bbe49[_0x9b7c('0x45')]['id'];}return db[_0x9b7c('0x3c')]['find']({'where':{'id':_0x3bbe49[_0x9b7c('0x40')]['id']}})[_0x9b7c('0x22')](handleEntityNotFound(_0x1bd9ae,null))['then'](saveUpdates(_0x3bbe49[_0x9b7c('0x45')],null))[_0x9b7c('0x22')](respondWithResult(_0x1bd9ae,null))[_0x9b7c('0x3f')](handleError(_0x1bd9ae,null));};exports[_0x9b7c('0x23')]=function(_0x174247,_0x1f45f8){return db[_0x9b7c('0x3c')][_0x9b7c('0x43')]({'where':{'id':_0x174247[_0x9b7c('0x40')]['id']}})[_0x9b7c('0x22')](handleEntityNotFound(_0x1f45f8,null))[_0x9b7c('0x22')](removeEntity(_0x1f45f8,null))[_0x9b7c('0x3f')](handleError(_0x1f45f8,null));};exports[_0x9b7c('0x46')]=function(_0x32408f,_0x5975d7,_0x25ca8e){var _0x44d4e4={};var _0x2c8237={};var _0x491d93;var _0x56b281;return db['SalesforceAccount'][_0x9b7c('0x47')]({'where':{'id':_0x32408f[_0x9b7c('0x40')]['id']}})[_0x9b7c('0x22')](handleEntityNotFound(_0x5975d7,null))[_0x9b7c('0x22')](function(_0x1b45ec){if(_0x1b45ec){_0x491d93=_0x1b45ec;_0x2c8237[_0x9b7c('0x2d')]=_[_0x9b7c('0x41')](db[_0x9b7c('0x48')]['rawAttributes']);_0x2c8237['query']=_['keys'](_0x32408f[_0x9b7c('0x2e')]);_0x2c8237[_0x9b7c('0x36')]=_[_0x9b7c('0x2f')](_0x2c8237[_0x9b7c('0x2d')],_0x2c8237['query']);_0x44d4e4[_0x9b7c('0x31')]=_[_0x9b7c('0x2f')](_0x2c8237[_0x9b7c('0x2d')],qs[_0x9b7c('0x30')](_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x30')]));_0x44d4e4[_0x9b7c('0x31')]=_0x44d4e4[_0x9b7c('0x31')]['length']?_0x44d4e4['attributes']:_0x2c8237[_0x9b7c('0x2d')];_0x44d4e4[_0x9b7c('0x33')]=qs[_0x9b7c('0x34')](_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x34')]);_0x44d4e4[_0x9b7c('0x35')]=qs[_0x9b7c('0x36')](_[_0x9b7c('0x37')](_0x32408f[_0x9b7c('0x2e')],_0x2c8237[_0x9b7c('0x36')]));if(_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x38')]){_0x44d4e4[_0x9b7c('0x35')]=_[_0x9b7c('0x39')](_0x44d4e4[_0x9b7c('0x35')],{'$or':_[_0x9b7c('0x29')](_0x44d4e4['attributes'],function(_0x4e3d1e){var _0x3c4b43={};_0x3c4b43[_0x4e3d1e]={'$like':'%'+_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x38')]+'%'};return _0x3c4b43;})});}_0x44d4e4=_['merge']({},_0x44d4e4,_0x32408f[_0x9b7c('0x3b')]);return _0x491d93['getConfigurations'](_0x44d4e4);}})[_0x9b7c('0x22')](function(_0x51044f){if(_0x51044f){_0x56b281=_0x51044f[_0x9b7c('0x42')];if(!_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x32')](_0x9b7c('0x49'))){_0x44d4e4[_0x9b7c('0x1a')]=qs['limit'](_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x1a')]);_0x44d4e4[_0x9b7c('0x18')]=qs[_0x9b7c('0x18')](_0x32408f[_0x9b7c('0x2e')][_0x9b7c('0x18')]);}return _0x491d93[_0x9b7c('0x46')](_0x44d4e4);}})[_0x9b7c('0x22')](function(_0x1fa052){if(_0x1fa052){return _0x1fa052?{'count':_0x56b281,'rows':_0x1fa052}:null;}})[_0x9b7c('0x22')](respondWithResult(_0x5975d7,null))[_0x9b7c('0x3f')](handleError(_0x5975d7,null));};exports[_0x9b7c('0x4a')]=function(_0x30ee36,_0x254ff9,_0x1630bf){if(_0x30ee36[_0x9b7c('0x45')]['id']){delete _0x30ee36[_0x9b7c('0x45')]['id'];}return db[_0x9b7c('0x3c')][_0x9b7c('0x47')]({'where':{'id':_0x30ee36[_0x9b7c('0x40')]['id']}})[_0x9b7c('0x22')](handleEntityNotFound(_0x254ff9,null))['then'](function(_0x521b7b){if(_0x521b7b){_0x30ee36[_0x9b7c('0x45')][_0x9b7c('0x4b')]=_0x521b7b['id'];_0x30ee36[_0x9b7c('0x45')]['Subjects']=integrations[_0x9b7c('0x4c')](_0x30ee36[_0x9b7c('0x45')]['channel'],_0x30ee36[_0x9b7c('0x45')][_0x9b7c('0x2b')]);_0x30ee36[_0x9b7c('0x45')][_0x9b7c('0x4d')]=integrations[_0x9b7c('0x4e')](_0x30ee36[_0x9b7c('0x45')][_0x9b7c('0x4f')],_0x30ee36['body'][_0x9b7c('0x2b')]);return db[_0x9b7c('0x48')][_0x9b7c('0x44')](_0x30ee36['body'],{'include':[{'model':db[_0x9b7c('0x50')],'as':'Subjects'},{'model':db[_0x9b7c('0x50')],'as':_0x9b7c('0x4d')}]});}return null;})[_0x9b7c('0x22')](respondWithResult(_0x254ff9,null))[_0x9b7c('0x3f')](handleError(_0x254ff9,null));};exports['getFields']=function(_0x1c6fce,_0x3ea4e3,_0x14c6ba){var _0x402070;var _0x18ca89='';var _0x4a4f23=_0x9b7c('0x51');return db[_0x9b7c('0x3c')][_0x9b7c('0x47')]({'where':{'id':_0x1c6fce[_0x9b7c('0x40')]['id']},'attributes':['id','remoteUri',_0x9b7c('0x52'),_0x9b7c('0x53'),_0x9b7c('0x54'),_0x9b7c('0x55'),_0x9b7c('0x56')]})[_0x9b7c('0x22')](handleEntityNotFound(_0x3ea4e3,null))[_0x9b7c('0x22')](function(_0xaaac67){if(_0xaaac67){_0x18ca89=_0xaaac67[_0x9b7c('0x57')];var _0x31e656=_0x18ca89[_0x9b7c('0x58')](-0x1);if(_0x31e656==='/'){_0x18ca89=_0x18ca89['substring'](0x0,_0x18ca89[_0x9b7c('0x59')](_0x31e656));}_0x402070=new jsforce['Connection']({'oauth2':{'loginUrl':_0x18ca89,'clientId':_0xaaac67[_0x9b7c('0x52')],'clientSecret':_0xaaac67['clientSecret']}});return _0x402070[_0x9b7c('0x5a')](_0xaaac67[_0x9b7c('0x54')],_0xaaac67[_0x9b7c('0x55')][_0x9b7c('0x5b')](_0xaaac67[_0x9b7c('0x56')]));}})[_0x9b7c('0x22')](function(_0x21ca74){if(_0x21ca74){if(!_[_0x9b7c('0x5c')](_0x1c6fce['query'][_0x9b7c('0x5d')])){_0x4a4f23=_0x1c6fce['query']['ticketType'];}return _0x402070[_0x9b7c('0x5e')](_0x4a4f23)[_0x9b7c('0x5f')]();}})[_0x9b7c('0x22')](function(_0xda64d7){var _0x1ba02f=[_0x9b7c('0x60'),_0x9b7c('0x61'),_0x9b7c('0x62'),_0x9b7c('0x63'),_0x9b7c('0x64'),_0x9b7c('0x65')];var _0x5b7610=[_0x9b7c('0x66'),_0x9b7c('0x67'),_0x9b7c('0x68'),_0x9b7c('0x69'),_0x9b7c('0x6a'),_0x9b7c('0x6b'),_0x9b7c('0x6c')];if(_0xda64d7){_[_0x9b7c('0x6d')](_0xda64d7[_0x9b7c('0x30')],function(_0x373d39){return _0x1ba02f[_0x9b7c('0x6e')](_0x373d39[_0x9b7c('0x26')])||!_0x5b7610[_0x9b7c('0x6e')](_0x373d39[_0x9b7c('0x2b')]);});return{'count':_0xda64d7[_0x9b7c('0x30')]['length'],'rows':_[_0x9b7c('0x29')](_0xda64d7[_0x9b7c('0x30')],function(_0xfcc83d){return{'id':_0xfcc83d[_0x9b7c('0x26')],'name':_0xfcc83d['label'],'custom':_0xfcc83d[_0x9b7c('0x6f')],'options':_0xfcc83d[_0x9b7c('0x70')]['length']>0x0?_[_0x9b7c('0x29')](_0xfcc83d['picklistValues'],function(_0xc2cd8d){return{'name':_0xc2cd8d[_0x9b7c('0x71')],'value':_0xc2cd8d[_0x9b7c('0x72')]};}):_0xfcc83d[_0x9b7c('0x2b')]==_0x9b7c('0x69')?[{'name':_0x9b7c('0x73'),'value':_0x9b7c('0x74')},{'name':'False','value':_0x9b7c('0x75')}]:[]};})};}})['then'](respondWithResult(_0x3ea4e3,null))[_0x9b7c('0x3f')](function(_0x5bc7ec){var _0xe8183=_0x1c6fce['query'][_0x9b7c('0x76')]?0x1f4:_0x5bc7ec[_0x9b7c('0x77')]||0x1f4;logger[_0x9b7c('0x24')](_0x9b7c('0x78'),_0x9b7c('0x79'),_0xe8183,JSON['stringify'](_0x5bc7ec));delete _0x5bc7ec[_0x9b7c('0x26')];if(_0xe8183===0x191){_0xe8183=0x190;}_0x3ea4e3[_0x9b7c('0x16')](_0xe8183)[_0x9b7c('0x27')](_0x1c6fce['query'][_0x9b7c('0x76')]?{'message':_0x9b7c('0x7a'),'statusCode':_0x5bc7ec[_0x9b7c('0x77')]}:_0x5bc7ec);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2934cde..0d5ce35 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 _0x25dc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x194018,_0x37680b){var _0x12d656=function(_0x26f6fe){while(--_0x26f6fe){_0x194018['push'](_0x194018['shift']());}};_0x12d656(++_0x37680b);}(_0x25dc,0x135));var _0xc25d=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x25dc[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0xc25d('0x0'));var util=require(_0xc25d('0x1'));var logger=require(_0xc25d('0x2'))(_0xc25d('0x3'));var moment=require(_0xc25d('0x4'));var BPromise=require(_0xc25d('0x5'));var rp=require(_0xc25d('0x6'));var fs=require('fs');var path=require(_0xc25d('0x7'));var rimraf=require(_0xc25d('0x8'));var config=require(_0xc25d('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xc25d('0xa')]=function(_0x15b425,_0x145f45){return _0x15b425[_0xc25d('0xb')]('SalesforceAccount',attributes,{'tableName':_0xc25d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24cb=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','lodash','util','../../config/logger','api','moment'];(function(_0x2b7065,_0x4a5a1c){var _0x1fb959=function(_0x28026b){while(--_0x28026b){_0x2b7065['push'](_0x2b7065['shift']());}};_0x1fb959(++_0x4a5a1c);}(_0x24cb,0x11b));var _0xb24c=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x24cb[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0xb24c('0x0'));var util=require(_0xb24c('0x1'));var logger=require(_0xb24c('0x2'))(_0xb24c('0x3'));var moment=require(_0xb24c('0x4'));var BPromise=require(_0xb24c('0x5'));var rp=require(_0xb24c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb24c('0x7'));var config=require(_0xb24c('0x8'));var attributes=require(_0xb24c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xb24c('0xa')]=function(_0xe11821,_0x375c38){return _0xe11821['define'](_0xb24c('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c33aeb0..7f78c91 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 _0x2adc=['map','model','attributes','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x2adc,0x135));var _0xc2ad=function(_0x1b25ea,_0x4f980d){_0x1b25ea=_0x1b25ea-0x0;var _0x3dc653=_0x2adc[_0x1b25ea];return _0x3dc653;};'use strict';var _=require('lodash');var util=require(_0xc2ad('0x0'));var moment=require(_0xc2ad('0x1'));var BPromise=require(_0xc2ad('0x2'));var rs=require(_0xc2ad('0x3'));var fs=require('fs');var Redis=require(_0xc2ad('0x4'));var db=require(_0xc2ad('0x5'))['db'];var utils=require(_0xc2ad('0x6'));var logger=require('../../config/logger')(_0xc2ad('0x7'));var config=require(_0xc2ad('0x8'));var jayson=require(_0xc2ad('0x9'));var client=jayson[_0xc2ad('0xa')][_0xc2ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa15c47,_0x80a1e2,_0x381f87){return new BPromise(function(_0x1b731d,_0x48ce75){return client[_0xc2ad('0xc')](_0xa15c47,_0x381f87)[_0xc2ad('0xd')](function(_0x33db27){logger[_0xc2ad('0xe')](_0xc2ad('0xf'),_0x80a1e2,'request\x20sent');logger[_0xc2ad('0x10')](_0xc2ad('0x11'),_0x80a1e2,_0xc2ad('0x12'),JSON[_0xc2ad('0x13')](_0x33db27));if(_0x33db27[_0xc2ad('0x14')]){if(_0x33db27[_0xc2ad('0x14')][_0xc2ad('0x15')]===0x1f4){logger[_0xc2ad('0x14')](_0xc2ad('0xf'),_0x80a1e2,_0x33db27[_0xc2ad('0x14')][_0xc2ad('0x16')]);return _0x48ce75(_0x33db27[_0xc2ad('0x14')][_0xc2ad('0x16')]);}logger['error'](_0xc2ad('0xf'),_0x80a1e2,_0x33db27[_0xc2ad('0x14')][_0xc2ad('0x16')]);return _0x1b731d(_0x33db27['error'][_0xc2ad('0x16')]);}else{logger[_0xc2ad('0xe')](_0xc2ad('0xf'),_0x80a1e2,_0xc2ad('0x12'));_0x1b731d(_0x33db27[_0xc2ad('0x17')][_0xc2ad('0x16')]);}})[_0xc2ad('0x18')](function(_0x107e6f){logger[_0xc2ad('0x14')](_0xc2ad('0xf'),_0x80a1e2,_0x107e6f);_0x48ce75(_0x107e6f);});});}exports[_0xc2ad('0x19')]=function(_0x45ab78){var _0x5c7618=this;return new Promise(function(_0x315c3f,_0x49a995){return db[_0xc2ad('0x1a')][_0xc2ad('0x1b')]({'raw':_0x45ab78[_0xc2ad('0x1c')]?_0x45ab78['options'][_0xc2ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x45ab78['options']?_0x45ab78[_0xc2ad('0x1c')][_0xc2ad('0x1e')]||null:null,'attributes':_0x45ab78[_0xc2ad('0x1c')]?_0x45ab78['options']['attributes']||null:null,'limit':_0x45ab78[_0xc2ad('0x1c')]?_0x45ab78[_0xc2ad('0x1c')][_0xc2ad('0x1f')]||null:null,'include':_0x45ab78['options']?_0x45ab78[_0xc2ad('0x1c')][_0xc2ad('0x20')]?_[_0xc2ad('0x21')](_0x45ab78[_0xc2ad('0x1c')][_0xc2ad('0x20')],function(_0x3a1e80){return{'model':db[_0x3a1e80[_0xc2ad('0x22')]],'as':_0x3a1e80['as'],'attributes':_0x3a1e80[_0xc2ad('0x23')],'include':_0x3a1e80[_0xc2ad('0x20')]?_[_0xc2ad('0x21')](_0x3a1e80[_0xc2ad('0x20')],function(_0x1d02a4){return{'model':db[_0x1d02a4['model']],'as':_0x1d02a4['as'],'attributes':_0x1d02a4[_0xc2ad('0x23')],'include':_0x1d02a4['include']?_['map'](_0x1d02a4[_0xc2ad('0x20')],function(_0x194af5){return{'model':db[_0x194af5[_0xc2ad('0x22')]],'as':_0x194af5['as'],'attributes':_0x194af5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2ad('0xd')](function(_0x204431){logger[_0xc2ad('0xe')](_0xc2ad('0x19'),_0x45ab78);logger['debug'](_0xc2ad('0x19'),_0x45ab78,JSON['stringify'](_0x204431));_0x315c3f(_0x204431);})[_0xc2ad('0x18')](function(_0x2ca1a1){logger['error'](_0xc2ad('0x19'),_0x2ca1a1['message'],_0x45ab78);_0x49a995(_0x5c7618[_0xc2ad('0x14')](0x1f4,_0x2ca1a1['message']));});});};exports['ShowSalesforceAccount']=function(_0x2f215b){var _0x3042f5=this;return new Promise(function(_0x1f9ddc,_0x427b69){return db[_0xc2ad('0x1a')][_0xc2ad('0x24')]({'raw':_0x2f215b[_0xc2ad('0x1c')]?_0x2f215b[_0xc2ad('0x1c')][_0xc2ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x2f215b[_0xc2ad('0x1c')]?_0x2f215b[_0xc2ad('0x1c')][_0xc2ad('0x1e')]||null:null,'attributes':_0x2f215b['options']?_0x2f215b['options'][_0xc2ad('0x23')]||null:null,'include':_0x2f215b['options']?_0x2f215b['options'][_0xc2ad('0x20')]?_[_0xc2ad('0x21')](_0x2f215b[_0xc2ad('0x1c')]['include'],function(_0x22061d){return{'model':db[_0x22061d[_0xc2ad('0x22')]],'as':_0x22061d['as'],'attributes':_0x22061d[_0xc2ad('0x23')],'include':_0x22061d['include']?_[_0xc2ad('0x21')](_0x22061d['include'],function(_0x3a1ac6){return{'model':db[_0x3a1ac6[_0xc2ad('0x22')]],'as':_0x3a1ac6['as'],'attributes':_0x3a1ac6[_0xc2ad('0x23')],'include':_0x3a1ac6[_0xc2ad('0x20')]?_[_0xc2ad('0x21')](_0x3a1ac6[_0xc2ad('0x20')],function(_0x44d876){return{'model':db[_0x44d876[_0xc2ad('0x22')]],'as':_0x44d876['as'],'attributes':_0x44d876[_0xc2ad('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5934f5){logger[_0xc2ad('0xe')](_0xc2ad('0x25'),_0x2f215b);logger[_0xc2ad('0x10')]('ShowSalesforceAccount',_0x2f215b,JSON[_0xc2ad('0x13')](_0x5934f5));_0x1f9ddc(_0x5934f5);})[_0xc2ad('0x18')](function(_0x36c869){logger['error']('ShowSalesforceAccount',_0x36c869[_0xc2ad('0x16')],_0x2f215b);_0x427b69(_0x3042f5['error'](0x1f4,_0x36c869[_0xc2ad('0x16')]));});});}; \ No newline at end of file +var _0x275b=['where','attributes','limit','include','map','debug','find','model','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x5d8fa1,_0x48f172){var _0x53a280=function(_0x256d98){while(--_0x256d98){_0x5d8fa1['push'](_0x5d8fa1['shift']());}};_0x53a280(++_0x48f172);}(_0x275b,0x1a1));var _0xb275=function(_0x40f32c,_0x31a77d){_0x40f32c=_0x40f32c-0x0;var _0x3f3815=_0x275b[_0x40f32c];return _0x3f3815;};'use strict';var _=require('lodash');var util=require(_0xb275('0x0'));var moment=require(_0xb275('0x1'));var BPromise=require('bluebird');var rs=require(_0xb275('0x2'));var fs=require('fs');var Redis=require(_0xb275('0x3'));var db=require(_0xb275('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb275('0x5'));var config=require(_0xb275('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb275('0x7')][_0xb275('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2489a5,_0x2a475d,_0x3a2483){return new BPromise(function(_0x203210,_0x2c6a1d){return client[_0xb275('0x9')](_0x2489a5,_0x3a2483)[_0xb275('0xa')](function(_0x364cb8){logger[_0xb275('0xb')](_0xb275('0xc'),_0x2a475d,_0xb275('0xd'));logger['debug'](_0xb275('0xe'),_0x2a475d,_0xb275('0xd'),JSON[_0xb275('0xf')](_0x364cb8));if(_0x364cb8[_0xb275('0x10')]){if(_0x364cb8[_0xb275('0x10')][_0xb275('0x11')]===0x1f4){logger[_0xb275('0x10')](_0xb275('0xc'),_0x2a475d,_0x364cb8[_0xb275('0x10')][_0xb275('0x12')]);return _0x2c6a1d(_0x364cb8[_0xb275('0x10')][_0xb275('0x12')]);}logger[_0xb275('0x10')](_0xb275('0xc'),_0x2a475d,_0x364cb8[_0xb275('0x10')]['message']);return _0x203210(_0x364cb8[_0xb275('0x10')][_0xb275('0x12')]);}else{logger[_0xb275('0xb')](_0xb275('0xc'),_0x2a475d,_0xb275('0xd'));_0x203210(_0x364cb8['result'][_0xb275('0x12')]);}})[_0xb275('0x13')](function(_0x31705d){logger[_0xb275('0x10')](_0xb275('0xc'),_0x2a475d,_0x31705d);_0x2c6a1d(_0x31705d);});});}exports[_0xb275('0x14')]=function(_0x5e5020){var _0x5e22dd=this;return new Promise(function(_0x5d24a3,_0x345c92){return db[_0xb275('0x15')][_0xb275('0x16')]({'raw':_0x5e5020[_0xb275('0x17')]?_0x5e5020['options'][_0xb275('0x18')]===undefined?!![]:![]:!![],'where':_0x5e5020[_0xb275('0x17')]?_0x5e5020[_0xb275('0x17')][_0xb275('0x19')]||null:null,'attributes':_0x5e5020[_0xb275('0x17')]?_0x5e5020[_0xb275('0x17')][_0xb275('0x1a')]||null:null,'limit':_0x5e5020['options']?_0x5e5020['options'][_0xb275('0x1b')]||null:null,'include':_0x5e5020[_0xb275('0x17')]?_0x5e5020['options'][_0xb275('0x1c')]?_[_0xb275('0x1d')](_0x5e5020['options'][_0xb275('0x1c')],function(_0x2e2a43){return{'model':db[_0x2e2a43['model']],'as':_0x2e2a43['as'],'attributes':_0x2e2a43[_0xb275('0x1a')],'include':_0x2e2a43[_0xb275('0x1c')]?_['map'](_0x2e2a43[_0xb275('0x1c')],function(_0x17aabd){return{'model':db[_0x17aabd['model']],'as':_0x17aabd['as'],'attributes':_0x17aabd[_0xb275('0x1a')],'include':_0x17aabd[_0xb275('0x1c')]?_[_0xb275('0x1d')](_0x17aabd[_0xb275('0x1c')],function(_0x327a5a){return{'model':db[_0x327a5a['model']],'as':_0x327a5a['as'],'attributes':_0x327a5a[_0xb275('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb275('0xa')](function(_0x572b8b){logger['info']('GetSalesforceAccount',_0x5e5020);logger[_0xb275('0x1e')]('GetSalesforceAccount',_0x5e5020,JSON[_0xb275('0xf')](_0x572b8b));_0x5d24a3(_0x572b8b);})['catch'](function(_0x231de8){logger[_0xb275('0x10')](_0xb275('0x14'),_0x231de8['message'],_0x5e5020);_0x345c92(_0x5e22dd[_0xb275('0x10')](0x1f4,_0x231de8[_0xb275('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0xf735a4){var _0x286e0d=this;return new Promise(function(_0x550f8f,_0x24a3e2){return db[_0xb275('0x15')][_0xb275('0x1f')]({'raw':_0xf735a4[_0xb275('0x17')]?_0xf735a4[_0xb275('0x17')][_0xb275('0x18')]===undefined?!![]:![]:!![],'where':_0xf735a4['options']?_0xf735a4[_0xb275('0x17')][_0xb275('0x19')]||null:null,'attributes':_0xf735a4[_0xb275('0x17')]?_0xf735a4[_0xb275('0x17')][_0xb275('0x1a')]||null:null,'include':_0xf735a4[_0xb275('0x17')]?_0xf735a4[_0xb275('0x17')][_0xb275('0x1c')]?_['map'](_0xf735a4[_0xb275('0x17')][_0xb275('0x1c')],function(_0x38b79f){return{'model':db[_0x38b79f[_0xb275('0x20')]],'as':_0x38b79f['as'],'attributes':_0x38b79f[_0xb275('0x1a')],'include':_0x38b79f[_0xb275('0x1c')]?_[_0xb275('0x1d')](_0x38b79f[_0xb275('0x1c')],function(_0x4eda92){return{'model':db[_0x4eda92[_0xb275('0x20')]],'as':_0x4eda92['as'],'attributes':_0x4eda92[_0xb275('0x1a')],'include':_0x4eda92[_0xb275('0x1c')]?_[_0xb275('0x1d')](_0x4eda92['include'],function(_0x2094d1){return{'model':db[_0x2094d1[_0xb275('0x20')]],'as':_0x2094d1['as'],'attributes':_0x2094d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xb275('0xa')](function(_0x2c3e0a){logger[_0xb275('0xb')](_0xb275('0x21'),_0xf735a4);logger[_0xb275('0x1e')](_0xb275('0x21'),_0xf735a4,JSON[_0xb275('0xf')](_0x2c3e0a));_0x550f8f(_0x2c3e0a);})[_0xb275('0x13')](function(_0x5e61d2){logger['error']('ShowSalesforceAccount',_0x5e61d2[_0xb275('0x12')],_0xf735a4);_0x24a3e2(_0x286e0d['error'](0x1f4,_0x5e61d2['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 06ac887..20b8f3f 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x144627,_0x18993c){var _0x2bb874=function(_0x464375){while(--_0x464375){_0x144627['push'](_0x144627['shift']());}};_0x2bb874(++_0x18993c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x46a1aa,_0x4e1dc5){var _0xbf6aed=function(_0x2be96b){while(--_0x2be96b){_0x46a1aa['push'](_0x46a1aa['shift']());}};_0xbf6aed(++_0x4e1dc5);}(_0xadb5,0xad));var _0x5adb=function(_0x3a8768,_0x392a32){_0x3a8768=_0x3a8768-0x0;var _0x18f9fc=_0xadb5[_0x3a8768];return _0x18f9fc;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3521f8d..6a12a3a 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 _0x0cc0=['sequelize','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x1b2cf0,_0x3e1559){var _0x566935=function(_0x5d2b27){while(--_0x5d2b27){_0x1b2cf0['push'](_0x1b2cf0['shift']());}};_0x566935(++_0x3e1559);}(_0x0cc0,0x11e));var _0x00cc=function(_0x20957f,_0x223b01){_0x20957f=_0x20957f-0x0;var _0x131779=_0x0cc0[_0x20957f];return _0x131779;};'use strict';var Sequelize=require(_0x00cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x00cc('0x1')]},'description':{'type':Sequelize[_0x00cc('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x00cc('0x2'),_0x00cc('0x3')),'defaultValue':_0x00cc('0x2')},'moduleSearch':{'type':Sequelize[_0x00cc('0x4')](_0x00cc('0x5'),_0x00cc('0x6'),_0x00cc('0x7'),_0x00cc('0x8'),_0x00cc('0x9')),'defaultValue':_0x00cc('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x00cc('0xa'),_0x00cc('0x6'),_0x00cc('0x7'),_0x00cc('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x00cc('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x00cc('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x06f2=['account','sequelize','STRING','ENUM','Task','Case','account_contact_lead','contact_lead','contact','lead'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x06f2,0x137));var _0x206f=function(_0x17e4f3,_0x38b1a7){_0x17e4f3=_0x17e4f3-0x0;var _0x387977=_0x06f2[_0x17e4f3];return _0x387977;};'use strict';var Sequelize=require(_0x206f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x206f('0x1')]},'ticketType':{'type':Sequelize[_0x206f('0x2')](_0x206f('0x3'),_0x206f('0x4')),'defaultValue':_0x206f('0x3')},'moduleSearch':{'type':Sequelize[_0x206f('0x2')]('contact_lead','contact','lead',_0x206f('0x5'),'account'),'defaultValue':_0x206f('0x6')},'moduleCreate':{'type':Sequelize[_0x206f('0x2')]('nothing',_0x206f('0x7'),_0x206f('0x8'),_0x206f('0x9')),'defaultValue':_0x206f('0x8')},'leadId':{'type':Sequelize[_0x206f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x206f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x206f('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 674e708..d7280aa 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 _0x8f9e=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','params','fields','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack'];(function(_0x4c8e4a,_0x3b220d){var _0x1b9077=function(_0x18b38d){while(--_0x18b38d){_0x4c8e4a['push'](_0x4c8e4a['shift']());}};_0x1b9077(++_0x3b220d);}(_0x8f9e,0x160));var _0xe8f9=function(_0x1f79f8,_0x4b68e7){_0x1f79f8=_0x1f79f8-0x0;var _0x21baa6=_0x8f9e[_0x1f79f8];return _0x21baa6;};'use strict';var emlformat=require(_0xe8f9('0x0'));var rimraf=require(_0xe8f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8f9('0x2'));var rp=require(_0xe8f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8f9('0x4'));var path=require('path');var sox=require(_0xe8f9('0x5'));var csv=require(_0xe8f9('0x6'));var ejs=require(_0xe8f9('0x7'));var fs=require('fs');var fs_extra=require(_0xe8f9('0x8'));var _=require(_0xe8f9('0x9'));var squel=require(_0xe8f9('0xa'));var crypto=require('crypto');var jsforce=require(_0xe8f9('0xb'));var deskjs=require(_0xe8f9('0xc'));var toCsv=require(_0xe8f9('0x6'));var querystring=require(_0xe8f9('0xd'));var Papa=require(_0xe8f9('0xe'));var Redis=require('ioredis');var authService=require(_0xe8f9('0xf'));var qs=require(_0xe8f9('0x10'));var as=require(_0xe8f9('0x11'));var hardwareService=require(_0xe8f9('0x12'));var logger=require(_0xe8f9('0x13'))(_0xe8f9('0x14'));var utils=require('../../config/utils');var config=require(_0xe8f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8f9('0x16'))['db'];function respondWithStatusCode(_0xc9a1db,_0x227665){_0x227665=_0x227665||0xcc;return function(_0x577a22){if(_0x577a22){return _0xc9a1db[_0xe8f9('0x17')](_0x227665);}return _0xc9a1db[_0xe8f9('0x18')](_0x227665)['end']();};}function respondWithResult(_0x2a8550,_0x5c4d41){_0x5c4d41=_0x5c4d41||0xc8;return function(_0x358f78){if(_0x358f78){return _0x2a8550['status'](_0x5c4d41)[_0xe8f9('0x19')](_0x358f78);}};}function respondWithFilteredResult(_0xd67bb3,_0x8d80cd){return function(_0xc30c73){if(_0xc30c73){var _0x363515=typeof _0x8d80cd[_0xe8f9('0x1a')]===_0xe8f9('0x1b')&&typeof _0x8d80cd[_0xe8f9('0x1c')]===_0xe8f9('0x1b');var _0xa76ab3=_0xc30c73[_0xe8f9('0x1d')];var _0x3a5e3f=_0x363515?0x0:_0x8d80cd[_0xe8f9('0x1a')];var _0x41c3f4=_0x363515?_0xc30c73[_0xe8f9('0x1d')]:_0x8d80cd[_0xe8f9('0x1a')]+_0x8d80cd['limit'];var _0xa29795;if(_0x41c3f4>=_0xa76ab3){_0x41c3f4=_0xa76ab3;_0xa29795=0xc8;}else{_0xa29795=0xce;}_0xd67bb3[_0xe8f9('0x18')](_0xa29795);return _0xd67bb3[_0xe8f9('0x1e')](_0xe8f9('0x1f'),_0x3a5e3f+'-'+_0x41c3f4+'/'+_0xa76ab3)['json'](_0xc30c73);}return null;};}function patchUpdates(_0x5696e6){return function(_0x56a8be){try{jsonpatch['apply'](_0x56a8be,_0x5696e6,!![]);}catch(_0x481633){return BPromise['reject'](_0x481633);}return _0x56a8be[_0xe8f9('0x20')]();};}function saveUpdates(_0x44ed82,_0x5d5c0b){return function(_0x485cc8){if(_0x485cc8){return _0x485cc8[_0xe8f9('0x21')](_0x44ed82)[_0xe8f9('0x22')](function(_0x5888cb){return _0x5888cb;});}return null;};}function removeEntity(_0x2a43ff,_0x13bc83){return function(_0x5939ce){if(_0x5939ce){return _0x5939ce[_0xe8f9('0x23')]()[_0xe8f9('0x22')](function(){_0x2a43ff[_0xe8f9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c88eb,_0x233654){return function(_0x283118){if(!_0x283118){_0x1c88eb[_0xe8f9('0x17')](0x194);}return _0x283118;};}function handleError(_0x520455,_0x33ba8c){_0x33ba8c=_0x33ba8c||0x1f4;return function(_0x282404){logger[_0xe8f9('0x24')](_0x282404[_0xe8f9('0x25')]);if(_0x282404[_0xe8f9('0x26')]){delete _0x282404[_0xe8f9('0x26')];}_0x520455[_0xe8f9('0x18')](_0x33ba8c)[_0xe8f9('0x27')](_0x282404);};}exports[_0xe8f9('0x28')]=function(_0x51810d,_0x46c798){var _0x3a1fb6={},_0x40d5b8={},_0x3f7725={'count':0x0,'rows':[]};var _0x26af41=_[_0xe8f9('0x29')](db['SalesforceConfiguration'][_0xe8f9('0x2a')],function(_0x28bba5){return{'name':_0x28bba5[_0xe8f9('0x2b')],'type':_0x28bba5[_0xe8f9('0x2c')]['key']};});_0x40d5b8[_0xe8f9('0x2d')]=_[_0xe8f9('0x29')](_0x26af41,_0xe8f9('0x26'));_0x40d5b8[_0xe8f9('0x2e')]=_[_0xe8f9('0x2f')](_0x51810d[_0xe8f9('0x2e')]);_0x40d5b8[_0xe8f9('0x30')]=_[_0xe8f9('0x31')](_0x40d5b8[_0xe8f9('0x2d')],_0x40d5b8['query']);_0x3a1fb6[_0xe8f9('0x32')]=_[_0xe8f9('0x31')](_0x40d5b8[_0xe8f9('0x2d')],qs['fields'](_0x51810d[_0xe8f9('0x2e')]['fields']));_0x3a1fb6['attributes']=_0x3a1fb6[_0xe8f9('0x32')][_0xe8f9('0x33')]?_0x3a1fb6[_0xe8f9('0x32')]:_0x40d5b8[_0xe8f9('0x2d')];if(!_0x51810d[_0xe8f9('0x2e')]['hasOwnProperty'](_0xe8f9('0x34'))){_0x3a1fb6[_0xe8f9('0x1c')]=qs[_0xe8f9('0x1c')](_0x51810d[_0xe8f9('0x2e')][_0xe8f9('0x1c')]);_0x3a1fb6['offset']=qs['offset'](_0x51810d[_0xe8f9('0x2e')][_0xe8f9('0x1a')]);}_0x3a1fb6[_0xe8f9('0x35')]=qs[_0xe8f9('0x36')](_0x51810d[_0xe8f9('0x2e')][_0xe8f9('0x36')]);_0x3a1fb6[_0xe8f9('0x37')]=qs[_0xe8f9('0x30')](_[_0xe8f9('0x38')](_0x51810d[_0xe8f9('0x2e')],_0x40d5b8[_0xe8f9('0x30')]),_0x26af41);if(_0x51810d[_0xe8f9('0x2e')][_0xe8f9('0x39')]){_0x3a1fb6['where']=_['merge'](_0x3a1fb6['where'],{'$or':_[_0xe8f9('0x29')](_0x26af41,function(_0x23791f){if(_0x23791f['type']!==_0xe8f9('0x3a')){var _0x260892={};_0x260892[_0x23791f[_0xe8f9('0x26')]]={'$like':'%'+_0x51810d[_0xe8f9('0x2e')]['filter']+'%'};return _0x260892;}})});}_0x3a1fb6=_[_0xe8f9('0x3b')]({},_0x3a1fb6,_0x51810d[_0xe8f9('0x3c')]);var _0x82f308={'where':_0x3a1fb6[_0xe8f9('0x37')]};return db[_0xe8f9('0x3d')][_0xe8f9('0x1d')](_0x82f308)[_0xe8f9('0x22')](function(_0x58380c){_0x3f7725[_0xe8f9('0x1d')]=_0x58380c;if(_0x51810d[_0xe8f9('0x2e')][_0xe8f9('0x3e')]){_0x3a1fb6[_0xe8f9('0x3f')]=[{'all':!![]}];}return db[_0xe8f9('0x3d')][_0xe8f9('0x40')](_0x3a1fb6);})['then'](function(_0x5b9ef7){_0x3f7725[_0xe8f9('0x41')]=_0x5b9ef7;return _0x3f7725;})[_0xe8f9('0x22')](respondWithFilteredResult(_0x46c798,_0x3a1fb6))[_0xe8f9('0x42')](handleError(_0x46c798,null));};exports['show']=function(_0x251dae,_0x1fe550){var _0x41d003={'raw':![],'where':{'id':_0x251dae[_0xe8f9('0x43')]['id']}},_0x4c6a11={};_0x4c6a11[_0xe8f9('0x2d')]=_[_0xe8f9('0x2f')](db['SalesforceConfiguration'][_0xe8f9('0x2a')]);_0x4c6a11['query']=_[_0xe8f9('0x2f')](_0x251dae[_0xe8f9('0x2e')]);_0x4c6a11['filters']=_['intersection'](_0x4c6a11['model'],_0x4c6a11[_0xe8f9('0x2e')]);_0x41d003['attributes']=_[_0xe8f9('0x31')](_0x4c6a11['model'],qs['fields'](_0x251dae['query'][_0xe8f9('0x44')]));_0x41d003['attributes']=_0x41d003['attributes']['length']?_0x41d003['attributes']:_0x4c6a11['model'];if(_0x251dae[_0xe8f9('0x2e')][_0xe8f9('0x3e')]){_0x41d003[_0xe8f9('0x3f')]=[{'all':!![]}];}_0x41d003=_['merge']({},_0x41d003,_0x251dae[_0xe8f9('0x3c')]);return db[_0xe8f9('0x3d')][_0xe8f9('0x45')](_0x41d003)['then'](handleEntityNotFound(_0x1fe550,null))[_0xe8f9('0x22')](respondWithResult(_0x1fe550,null))[_0xe8f9('0x42')](handleError(_0x1fe550,null));};exports[_0xe8f9('0x46')]=function(_0x4df7b3,_0x28630a){return db[_0xe8f9('0x3d')]['create'](_0x4df7b3[_0xe8f9('0x47')],{})[_0xe8f9('0x22')](respondWithResult(_0x28630a,0xc9))[_0xe8f9('0x42')](handleError(_0x28630a,null));};exports[_0xe8f9('0x21')]=function(_0x1b4a80,_0x407e67){if(_0x1b4a80['body']['id']){delete _0x1b4a80['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x1b4a80[_0xe8f9('0x43')]['id']}})[_0xe8f9('0x22')](handleEntityNotFound(_0x407e67,null))[_0xe8f9('0x22')](saveUpdates(_0x1b4a80[_0xe8f9('0x47')],null))[_0xe8f9('0x22')](respondWithResult(_0x407e67,null))[_0xe8f9('0x42')](handleError(_0x407e67,null));};exports['destroy']=function(_0x44c0cd,_0x3bce85){return db['SalesforceConfiguration'][_0xe8f9('0x45')]({'where':{'id':_0x44c0cd[_0xe8f9('0x43')]['id']}})[_0xe8f9('0x22')](handleEntityNotFound(_0x3bce85,null))[_0xe8f9('0x22')](removeEntity(_0x3bce85,null))[_0xe8f9('0x42')](handleError(_0x3bce85,null));};exports[_0xe8f9('0x48')]=function(_0x51c6d4,_0x2abbb1,_0x565f34){var _0x78d845={};var _0x286588={};var _0x4bff86;var _0x4ac731;return db[_0xe8f9('0x3d')][_0xe8f9('0x49')]({'where':{'id':_0x51c6d4[_0xe8f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2abbb1,null))[_0xe8f9('0x22')](function(_0x2eaec5){if(_0x2eaec5){_0x4bff86=_0x2eaec5;_0x286588[_0xe8f9('0x2d')]=_[_0xe8f9('0x2f')](db[_0xe8f9('0x4a')][_0xe8f9('0x2a')]);_0x286588['query']=_['keys'](_0x51c6d4['query']);_0x286588[_0xe8f9('0x30')]=_[_0xe8f9('0x31')](_0x286588[_0xe8f9('0x2d')],_0x286588[_0xe8f9('0x2e')]);_0x78d845[_0xe8f9('0x32')]=_['intersection'](_0x286588[_0xe8f9('0x2d')],qs[_0xe8f9('0x44')](_0x51c6d4[_0xe8f9('0x2e')][_0xe8f9('0x44')]));_0x78d845[_0xe8f9('0x32')]=_0x78d845[_0xe8f9('0x32')][_0xe8f9('0x33')]?_0x78d845[_0xe8f9('0x32')]:_0x286588[_0xe8f9('0x2d')];_0x78d845[_0xe8f9('0x35')]=qs[_0xe8f9('0x36')](_0x51c6d4['query'][_0xe8f9('0x36')]);_0x78d845[_0xe8f9('0x37')]=qs[_0xe8f9('0x30')](_[_0xe8f9('0x38')](_0x51c6d4['query'],_0x286588[_0xe8f9('0x30')]));if(_0x51c6d4[_0xe8f9('0x2e')][_0xe8f9('0x39')]){_0x78d845[_0xe8f9('0x37')]=_[_0xe8f9('0x3b')](_0x78d845[_0xe8f9('0x37')],{'$or':_[_0xe8f9('0x29')](_0x78d845[_0xe8f9('0x32')],function(_0x2f0b03){var _0xcdbffc={};_0xcdbffc[_0x2f0b03]={'$like':'%'+_0x51c6d4[_0xe8f9('0x2e')][_0xe8f9('0x39')]+'%'};return _0xcdbffc;})});}_0x78d845=_['merge']({},_0x78d845,_0x51c6d4[_0xe8f9('0x3c')]);return _0x4bff86[_0xe8f9('0x48')](_0x78d845);}})['then'](function(_0x385d91){if(_0x385d91){_0x4ac731=_0x385d91[_0xe8f9('0x33')];if(!_0x51c6d4['query']['hasOwnProperty'](_0xe8f9('0x34'))){_0x78d845[_0xe8f9('0x1c')]=qs[_0xe8f9('0x1c')](_0x51c6d4[_0xe8f9('0x2e')]['limit']);_0x78d845[_0xe8f9('0x1a')]=qs['offset'](_0x51c6d4[_0xe8f9('0x2e')][_0xe8f9('0x1a')]);}return _0x4bff86['getFields'](_0x78d845);}})[_0xe8f9('0x22')](function(_0x5f5097){if(_0x5f5097){return _0x5f5097?{'count':_0x4ac731,'rows':_0x5f5097}:null;}})[_0xe8f9('0x22')](respondWithResult(_0x2abbb1,null))[_0xe8f9('0x42')](handleError(_0x2abbb1,null));};exports['getSubjects']=function(_0x2a6288,_0x294671,_0x2a2b0c){var _0x3645d8={};var _0x125479={};var _0x3897ef;var _0x490c2e;return db['SalesforceConfiguration'][_0xe8f9('0x49')]({'where':{'id':_0x2a6288[_0xe8f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x294671,null))[_0xe8f9('0x22')](function(_0x3c443f){if(_0x3c443f){_0x3897ef=_0x3c443f;_0x125479[_0xe8f9('0x2d')]=_[_0xe8f9('0x2f')](db[_0xe8f9('0x4a')][_0xe8f9('0x2a')]);_0x125479['query']=_[_0xe8f9('0x2f')](_0x2a6288['query']);_0x125479[_0xe8f9('0x30')]=_['intersection'](_0x125479[_0xe8f9('0x2d')],_0x125479['query']);_0x3645d8[_0xe8f9('0x32')]=_['intersection'](_0x125479[_0xe8f9('0x2d')],qs[_0xe8f9('0x44')](_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x44')]));_0x3645d8['attributes']=_0x3645d8[_0xe8f9('0x32')][_0xe8f9('0x33')]?_0x3645d8[_0xe8f9('0x32')]:_0x125479[_0xe8f9('0x2d')];_0x3645d8[_0xe8f9('0x35')]=qs[_0xe8f9('0x36')](_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x36')]);_0x3645d8['where']=qs[_0xe8f9('0x30')](_['pick'](_0x2a6288['query'],_0x125479[_0xe8f9('0x30')]));if(_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x39')]){_0x3645d8['where']=_[_0xe8f9('0x3b')](_0x3645d8['where'],{'$or':_[_0xe8f9('0x29')](_0x3645d8[_0xe8f9('0x32')],function(_0x5e4078){var _0x495bb6={};_0x495bb6[_0x5e4078]={'$like':'%'+_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x39')]+'%'};return _0x495bb6;})});}_0x3645d8=_['merge']({},_0x3645d8,_0x2a6288[_0xe8f9('0x3c')]);return _0x3897ef[_0xe8f9('0x4b')](_0x3645d8);}})[_0xe8f9('0x22')](function(_0x2bc07b){if(_0x2bc07b){_0x490c2e=_0x2bc07b[_0xe8f9('0x33')];if(!_0x2a6288[_0xe8f9('0x2e')]['hasOwnProperty'](_0xe8f9('0x34'))){_0x3645d8[_0xe8f9('0x1c')]=qs[_0xe8f9('0x1c')](_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x1c')]);_0x3645d8[_0xe8f9('0x1a')]=qs[_0xe8f9('0x1a')](_0x2a6288[_0xe8f9('0x2e')][_0xe8f9('0x1a')]);}return _0x3897ef[_0xe8f9('0x4b')](_0x3645d8);}})[_0xe8f9('0x22')](function(_0x239ce4){if(_0x239ce4){return _0x239ce4?{'count':_0x490c2e,'rows':_0x239ce4}:null;}})[_0xe8f9('0x22')](respondWithResult(_0x294671,null))['catch'](handleError(_0x294671,null));};exports[_0xe8f9('0x4c')]=function(_0x4df62f,_0x156edb,_0x434657){var _0x544430={};var _0x27f4fb={};var _0x57963e;var _0x517226;return db[_0xe8f9('0x3d')][_0xe8f9('0x49')]({'where':{'id':_0x4df62f['params']['id']}})[_0xe8f9('0x22')](handleEntityNotFound(_0x156edb,null))['then'](function(_0x1ad87d){if(_0x1ad87d){_0x57963e=_0x1ad87d;_0x27f4fb['model']=_[_0xe8f9('0x2f')](db[_0xe8f9('0x4a')][_0xe8f9('0x2a')]);_0x27f4fb[_0xe8f9('0x2e')]=_[_0xe8f9('0x2f')](_0x4df62f['query']);_0x27f4fb[_0xe8f9('0x30')]=_['intersection'](_0x27f4fb['model'],_0x27f4fb[_0xe8f9('0x2e')]);_0x544430['attributes']=_[_0xe8f9('0x31')](_0x27f4fb[_0xe8f9('0x2d')],qs[_0xe8f9('0x44')](_0x4df62f[_0xe8f9('0x2e')][_0xe8f9('0x44')]));_0x544430[_0xe8f9('0x32')]=_0x544430[_0xe8f9('0x32')][_0xe8f9('0x33')]?_0x544430['attributes']:_0x27f4fb[_0xe8f9('0x2d')];_0x544430[_0xe8f9('0x35')]=qs[_0xe8f9('0x36')](_0x4df62f[_0xe8f9('0x2e')][_0xe8f9('0x36')]);_0x544430[_0xe8f9('0x37')]=qs[_0xe8f9('0x30')](_['pick'](_0x4df62f[_0xe8f9('0x2e')],_0x27f4fb[_0xe8f9('0x30')]));if(_0x4df62f[_0xe8f9('0x2e')][_0xe8f9('0x39')]){_0x544430[_0xe8f9('0x37')]=_[_0xe8f9('0x3b')](_0x544430[_0xe8f9('0x37')],{'$or':_[_0xe8f9('0x29')](_0x544430[_0xe8f9('0x32')],function(_0xdea43a){var _0x198c4d={};_0x198c4d[_0xdea43a]={'$like':'%'+_0x4df62f[_0xe8f9('0x2e')]['filter']+'%'};return _0x198c4d;})});}_0x544430=_['merge']({},_0x544430,_0x4df62f['options']);return _0x57963e['getDescriptions'](_0x544430);}})['then'](function(_0xb87e6c){if(_0xb87e6c){_0x517226=_0xb87e6c[_0xe8f9('0x33')];if(!_0x4df62f['query'][_0xe8f9('0x4d')](_0xe8f9('0x34'))){_0x544430[_0xe8f9('0x1c')]=qs[_0xe8f9('0x1c')](_0x4df62f[_0xe8f9('0x2e')][_0xe8f9('0x1c')]);_0x544430[_0xe8f9('0x1a')]=qs[_0xe8f9('0x1a')](_0x4df62f[_0xe8f9('0x2e')][_0xe8f9('0x1a')]);}return _0x57963e[_0xe8f9('0x4c')](_0x544430);}})[_0xe8f9('0x22')](function(_0x33e203){if(_0x33e203){return _0x33e203?{'count':_0x517226,'rows':_0x33e203}:null;}})[_0xe8f9('0x22')](respondWithResult(_0x156edb,null))[_0xe8f9('0x42')](handleError(_0x156edb,null));}; \ No newline at end of file +var _0xb90d=['path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','end','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','body','find','getFields','SalesforceField','order','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb90d,0x17a));var _0xdb90=function(_0x14ec9d,_0x45d283){_0x14ec9d=_0x14ec9d-0x0;var _0x3636df=_0xb90d[_0x14ec9d];return _0x3636df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb90('0x0'));var zipdir=require(_0xdb90('0x1'));var jsonpatch=require(_0xdb90('0x2'));var rp=require(_0xdb90('0x3'));var moment=require(_0xdb90('0x4'));var BPromise=require(_0xdb90('0x5'));var Mustache=require('mustache');var util=require(_0xdb90('0x6'));var path=require(_0xdb90('0x7'));var sox=require(_0xdb90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb90('0x9'));var _=require(_0xdb90('0xa'));var squel=require(_0xdb90('0xb'));var crypto=require(_0xdb90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb90('0xd'));var toCsv=require(_0xdb90('0xe'));var querystring=require(_0xdb90('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb90('0x10'));var authService=require(_0xdb90('0x11'));var qs=require(_0xdb90('0x12'));var as=require(_0xdb90('0x13'));var hardwareService=require(_0xdb90('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb90('0x15'));var licenseUtil=require(_0xdb90('0x16'));var db=require(_0xdb90('0x17'))['db'];function respondWithStatusCode(_0xb5ea64,_0xdc179e){_0xdc179e=_0xdc179e||0xcc;return function(_0x113659){if(_0x113659){return _0xb5ea64['sendStatus'](_0xdc179e);}return _0xb5ea64['status'](_0xdc179e)['end']();};}function respondWithResult(_0x511592,_0x569d40){_0x569d40=_0x569d40||0xc8;return function(_0x5eb6ef){if(_0x5eb6ef){return _0x511592[_0xdb90('0x18')](_0x569d40)[_0xdb90('0x19')](_0x5eb6ef);}};}function respondWithFilteredResult(_0x5b93b1,_0x19b02e){return function(_0x1cde0d){if(_0x1cde0d){var _0x4db002=typeof _0x19b02e['offset']===_0xdb90('0x1a')&&typeof _0x19b02e[_0xdb90('0x1b')]===_0xdb90('0x1a');var _0x5101e9=_0x1cde0d[_0xdb90('0x1c')];var _0x13f6df=_0x4db002?0x0:_0x19b02e[_0xdb90('0x1d')];var _0x44d4d4=_0x4db002?_0x1cde0d[_0xdb90('0x1c')]:_0x19b02e[_0xdb90('0x1d')]+_0x19b02e[_0xdb90('0x1b')];var _0x1838ed;if(_0x44d4d4>=_0x5101e9){_0x44d4d4=_0x5101e9;_0x1838ed=0xc8;}else{_0x1838ed=0xce;}_0x5b93b1[_0xdb90('0x18')](_0x1838ed);return _0x5b93b1[_0xdb90('0x1e')]('Content-Range',_0x13f6df+'-'+_0x44d4d4+'/'+_0x5101e9)['json'](_0x1cde0d);}return null;};}function patchUpdates(_0x4110c7){return function(_0x1c2dbe){try{jsonpatch[_0xdb90('0x1f')](_0x1c2dbe,_0x4110c7,!![]);}catch(_0x13f84d){return BPromise[_0xdb90('0x20')](_0x13f84d);}return _0x1c2dbe['save']();};}function saveUpdates(_0x31f9df,_0x922395){return function(_0x590e6a){if(_0x590e6a){return _0x590e6a[_0xdb90('0x21')](_0x31f9df)['then'](function(_0x185b08){return _0x185b08;});}return null;};}function removeEntity(_0x2fdb1b,_0x1fe5ab){return function(_0x463199){if(_0x463199){return _0x463199[_0xdb90('0x22')]()[_0xdb90('0x23')](function(){_0x2fdb1b[_0xdb90('0x18')](0xcc)[_0xdb90('0x24')]();});}};}function handleEntityNotFound(_0x1ef44a,_0x1fed39){return function(_0x64268c){if(!_0x64268c){_0x1ef44a['sendStatus'](0x194);}return _0x64268c;};}function handleError(_0x1a27c3,_0xedb1a6){_0xedb1a6=_0xedb1a6||0x1f4;return function(_0x3fcafd){logger['error'](_0x3fcafd['stack']);if(_0x3fcafd[_0xdb90('0x25')]){delete _0x3fcafd[_0xdb90('0x25')];}_0x1a27c3[_0xdb90('0x18')](_0xedb1a6)[_0xdb90('0x26')](_0x3fcafd);};}exports[_0xdb90('0x27')]=function(_0x321efc,_0x46f743){var _0x67aebc={},_0x554d8f={},_0x3c8671={'count':0x0,'rows':[]};var _0x204f8a=_[_0xdb90('0x28')](db[_0xdb90('0x29')][_0xdb90('0x2a')],function(_0x66ecd3){return{'name':_0x66ecd3[_0xdb90('0x2b')],'type':_0x66ecd3[_0xdb90('0x2c')][_0xdb90('0x2d')]};});_0x554d8f[_0xdb90('0x2e')]=_[_0xdb90('0x28')](_0x204f8a,_0xdb90('0x25'));_0x554d8f[_0xdb90('0x2f')]=_[_0xdb90('0x30')](_0x321efc['query']);_0x554d8f[_0xdb90('0x31')]=_[_0xdb90('0x32')](_0x554d8f[_0xdb90('0x2e')],_0x554d8f[_0xdb90('0x2f')]);_0x67aebc[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x554d8f[_0xdb90('0x2e')],qs[_0xdb90('0x34')](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x34')]));_0x67aebc['attributes']=_0x67aebc[_0xdb90('0x33')][_0xdb90('0x35')]?_0x67aebc['attributes']:_0x554d8f[_0xdb90('0x2e')];if(!_0x321efc[_0xdb90('0x2f')][_0xdb90('0x36')](_0xdb90('0x37'))){_0x67aebc[_0xdb90('0x1b')]=qs['limit'](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x1b')]);_0x67aebc[_0xdb90('0x1d')]=qs['offset'](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x1d')]);}_0x67aebc['order']=qs[_0xdb90('0x38')](_0x321efc[_0xdb90('0x2f')][_0xdb90('0x38')]);_0x67aebc[_0xdb90('0x39')]=qs['filters'](_[_0xdb90('0x3a')](_0x321efc[_0xdb90('0x2f')],_0x554d8f['filters']),_0x204f8a);if(_0x321efc['query'][_0xdb90('0x3b')]){_0x67aebc[_0xdb90('0x39')]=_[_0xdb90('0x3c')](_0x67aebc[_0xdb90('0x39')],{'$or':_['map'](_0x204f8a,function(_0x13ae1b){if(_0x13ae1b['type']!=='VIRTUAL'){var _0x5676db={};_0x5676db[_0x13ae1b[_0xdb90('0x25')]]={'$like':'%'+_0x321efc[_0xdb90('0x2f')][_0xdb90('0x3b')]+'%'};return _0x5676db;}})});}_0x67aebc=_[_0xdb90('0x3c')]({},_0x67aebc,_0x321efc[_0xdb90('0x3d')]);var _0x57ba6b={'where':_0x67aebc[_0xdb90('0x39')]};return db['SalesforceConfiguration'][_0xdb90('0x1c')](_0x57ba6b)[_0xdb90('0x23')](function(_0x5afca9){_0x3c8671['count']=_0x5afca9;if(_0x321efc[_0xdb90('0x2f')]['includeAll']){_0x67aebc[_0xdb90('0x3e')]=[{'all':!![]}];}return db[_0xdb90('0x29')][_0xdb90('0x3f')](_0x67aebc);})['then'](function(_0x300d70){_0x3c8671[_0xdb90('0x40')]=_0x300d70;return _0x3c8671;})['then'](respondWithFilteredResult(_0x46f743,_0x67aebc))[_0xdb90('0x41')](handleError(_0x46f743,null));};exports[_0xdb90('0x42')]=function(_0x2eec66,_0x68e9e5){var _0x1e2e7f={'raw':![],'where':{'id':_0x2eec66[_0xdb90('0x43')]['id']}},_0x284342={};_0x284342[_0xdb90('0x2e')]=_['keys'](db[_0xdb90('0x29')]['rawAttributes']);_0x284342['query']=_['keys'](_0x2eec66[_0xdb90('0x2f')]);_0x284342['filters']=_['intersection'](_0x284342[_0xdb90('0x2e')],_0x284342[_0xdb90('0x2f')]);_0x1e2e7f[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x284342['model'],qs[_0xdb90('0x34')](_0x2eec66[_0xdb90('0x2f')][_0xdb90('0x34')]));_0x1e2e7f[_0xdb90('0x33')]=_0x1e2e7f[_0xdb90('0x33')][_0xdb90('0x35')]?_0x1e2e7f[_0xdb90('0x33')]:_0x284342[_0xdb90('0x2e')];if(_0x2eec66[_0xdb90('0x2f')][_0xdb90('0x44')]){_0x1e2e7f[_0xdb90('0x3e')]=[{'all':!![]}];}_0x1e2e7f=_[_0xdb90('0x3c')]({},_0x1e2e7f,_0x2eec66[_0xdb90('0x3d')]);return db['SalesforceConfiguration']['find'](_0x1e2e7f)['then'](handleEntityNotFound(_0x68e9e5,null))['then'](respondWithResult(_0x68e9e5,null))[_0xdb90('0x41')](handleError(_0x68e9e5,null));};exports['create']=function(_0x56fef9,_0x4ba023){return db[_0xdb90('0x29')]['create'](_0x56fef9[_0xdb90('0x45')],{})[_0xdb90('0x23')](respondWithResult(_0x4ba023,0xc9))[_0xdb90('0x41')](handleError(_0x4ba023,null));};exports[_0xdb90('0x21')]=function(_0x16888b,_0x21c540){if(_0x16888b[_0xdb90('0x45')]['id']){delete _0x16888b[_0xdb90('0x45')]['id'];}return db['SalesforceConfiguration'][_0xdb90('0x46')]({'where':{'id':_0x16888b[_0xdb90('0x43')]['id']}})['then'](handleEntityNotFound(_0x21c540,null))['then'](saveUpdates(_0x16888b[_0xdb90('0x45')],null))[_0xdb90('0x23')](respondWithResult(_0x21c540,null))[_0xdb90('0x41')](handleError(_0x21c540,null));};exports['destroy']=function(_0x3ebe50,_0x13be35){return db[_0xdb90('0x29')][_0xdb90('0x46')]({'where':{'id':_0x3ebe50[_0xdb90('0x43')]['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x13be35,null))[_0xdb90('0x23')](removeEntity(_0x13be35,null))[_0xdb90('0x41')](handleError(_0x13be35,null));};exports[_0xdb90('0x47')]=function(_0x507d6e,_0x1aa695,_0x24726e){var _0x54a4ca={};var _0x58dcff={};var _0x5c0f70;var _0x3befa9;return db[_0xdb90('0x29')]['findOne']({'where':{'id':_0x507d6e['params']['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x1aa695,null))[_0xdb90('0x23')](function(_0x28606a){if(_0x28606a){_0x5c0f70=_0x28606a;_0x58dcff[_0xdb90('0x2e')]=_['keys'](db[_0xdb90('0x48')][_0xdb90('0x2a')]);_0x58dcff['query']=_['keys'](_0x507d6e[_0xdb90('0x2f')]);_0x58dcff[_0xdb90('0x31')]=_[_0xdb90('0x32')](_0x58dcff[_0xdb90('0x2e')],_0x58dcff[_0xdb90('0x2f')]);_0x54a4ca[_0xdb90('0x33')]=_['intersection'](_0x58dcff['model'],qs[_0xdb90('0x34')](_0x507d6e[_0xdb90('0x2f')]['fields']));_0x54a4ca[_0xdb90('0x33')]=_0x54a4ca[_0xdb90('0x33')][_0xdb90('0x35')]?_0x54a4ca[_0xdb90('0x33')]:_0x58dcff['model'];_0x54a4ca[_0xdb90('0x49')]=qs['sort'](_0x507d6e[_0xdb90('0x2f')][_0xdb90('0x38')]);_0x54a4ca[_0xdb90('0x39')]=qs[_0xdb90('0x31')](_[_0xdb90('0x3a')](_0x507d6e['query'],_0x58dcff['filters']));if(_0x507d6e[_0xdb90('0x2f')][_0xdb90('0x3b')]){_0x54a4ca[_0xdb90('0x39')]=_[_0xdb90('0x3c')](_0x54a4ca['where'],{'$or':_[_0xdb90('0x28')](_0x54a4ca[_0xdb90('0x33')],function(_0x443d13){var _0x318382={};_0x318382[_0x443d13]={'$like':'%'+_0x507d6e[_0xdb90('0x2f')][_0xdb90('0x3b')]+'%'};return _0x318382;})});}_0x54a4ca=_['merge']({},_0x54a4ca,_0x507d6e[_0xdb90('0x3d')]);return _0x5c0f70[_0xdb90('0x47')](_0x54a4ca);}})[_0xdb90('0x23')](function(_0x38702d){if(_0x38702d){_0x3befa9=_0x38702d[_0xdb90('0x35')];if(!_0x507d6e[_0xdb90('0x2f')][_0xdb90('0x36')]('nolimit')){_0x54a4ca[_0xdb90('0x1b')]=qs[_0xdb90('0x1b')](_0x507d6e[_0xdb90('0x2f')][_0xdb90('0x1b')]);_0x54a4ca[_0xdb90('0x1d')]=qs[_0xdb90('0x1d')](_0x507d6e['query'][_0xdb90('0x1d')]);}return _0x5c0f70[_0xdb90('0x47')](_0x54a4ca);}})['then'](function(_0x30cf1a){if(_0x30cf1a){return _0x30cf1a?{'count':_0x3befa9,'rows':_0x30cf1a}:null;}})[_0xdb90('0x23')](respondWithResult(_0x1aa695,null))[_0xdb90('0x41')](handleError(_0x1aa695,null));};exports[_0xdb90('0x4a')]=function(_0x2fc237,_0x5ec05f,_0x379480){var _0x5c3676={};var _0x157841={};var _0x20fbf5;var _0x29e13f;return db[_0xdb90('0x29')][_0xdb90('0x4b')]({'where':{'id':_0x2fc237[_0xdb90('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ec05f,null))[_0xdb90('0x23')](function(_0x2c9107){if(_0x2c9107){_0x20fbf5=_0x2c9107;_0x157841['model']=_['keys'](db[_0xdb90('0x48')][_0xdb90('0x2a')]);_0x157841[_0xdb90('0x2f')]=_[_0xdb90('0x30')](_0x2fc237['query']);_0x157841[_0xdb90('0x31')]=_[_0xdb90('0x32')](_0x157841['model'],_0x157841[_0xdb90('0x2f')]);_0x5c3676[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x157841[_0xdb90('0x2e')],qs[_0xdb90('0x34')](_0x2fc237['query'][_0xdb90('0x34')]));_0x5c3676[_0xdb90('0x33')]=_0x5c3676['attributes'][_0xdb90('0x35')]?_0x5c3676[_0xdb90('0x33')]:_0x157841[_0xdb90('0x2e')];_0x5c3676['order']=qs[_0xdb90('0x38')](_0x2fc237[_0xdb90('0x2f')][_0xdb90('0x38')]);_0x5c3676[_0xdb90('0x39')]=qs['filters'](_[_0xdb90('0x3a')](_0x2fc237[_0xdb90('0x2f')],_0x157841['filters']));if(_0x2fc237['query'][_0xdb90('0x3b')]){_0x5c3676[_0xdb90('0x39')]=_['merge'](_0x5c3676['where'],{'$or':_[_0xdb90('0x28')](_0x5c3676[_0xdb90('0x33')],function(_0x6b94aa){var _0x8220a={};_0x8220a[_0x6b94aa]={'$like':'%'+_0x2fc237[_0xdb90('0x2f')][_0xdb90('0x3b')]+'%'};return _0x8220a;})});}_0x5c3676=_[_0xdb90('0x3c')]({},_0x5c3676,_0x2fc237['options']);return _0x20fbf5[_0xdb90('0x4a')](_0x5c3676);}})[_0xdb90('0x23')](function(_0x59798e){if(_0x59798e){_0x29e13f=_0x59798e['length'];if(!_0x2fc237[_0xdb90('0x2f')]['hasOwnProperty'](_0xdb90('0x37'))){_0x5c3676['limit']=qs[_0xdb90('0x1b')](_0x2fc237[_0xdb90('0x2f')][_0xdb90('0x1b')]);_0x5c3676['offset']=qs[_0xdb90('0x1d')](_0x2fc237[_0xdb90('0x2f')][_0xdb90('0x1d')]);}return _0x20fbf5[_0xdb90('0x4a')](_0x5c3676);}})['then'](function(_0x5214b7){if(_0x5214b7){return _0x5214b7?{'count':_0x29e13f,'rows':_0x5214b7}:null;}})[_0xdb90('0x23')](respondWithResult(_0x5ec05f,null))['catch'](handleError(_0x5ec05f,null));};exports[_0xdb90('0x4c')]=function(_0x4b5079,_0x257eeb,_0x39677b){var _0x5aafaf={};var _0x2e5bcd={};var _0x1bbe49;var _0x5d4a14;return db['SalesforceConfiguration'][_0xdb90('0x4b')]({'where':{'id':_0x4b5079[_0xdb90('0x43')]['id']}})[_0xdb90('0x23')](handleEntityNotFound(_0x257eeb,null))[_0xdb90('0x23')](function(_0x54bd6b){if(_0x54bd6b){_0x1bbe49=_0x54bd6b;_0x2e5bcd[_0xdb90('0x2e')]=_[_0xdb90('0x30')](db['SalesforceField'][_0xdb90('0x2a')]);_0x2e5bcd['query']=_[_0xdb90('0x30')](_0x4b5079[_0xdb90('0x2f')]);_0x2e5bcd[_0xdb90('0x31')]=_[_0xdb90('0x32')](_0x2e5bcd['model'],_0x2e5bcd['query']);_0x5aafaf[_0xdb90('0x33')]=_[_0xdb90('0x32')](_0x2e5bcd['model'],qs[_0xdb90('0x34')](_0x4b5079[_0xdb90('0x2f')][_0xdb90('0x34')]));_0x5aafaf[_0xdb90('0x33')]=_0x5aafaf[_0xdb90('0x33')][_0xdb90('0x35')]?_0x5aafaf[_0xdb90('0x33')]:_0x2e5bcd[_0xdb90('0x2e')];_0x5aafaf['order']=qs[_0xdb90('0x38')](_0x4b5079[_0xdb90('0x2f')][_0xdb90('0x38')]);_0x5aafaf[_0xdb90('0x39')]=qs['filters'](_[_0xdb90('0x3a')](_0x4b5079['query'],_0x2e5bcd[_0xdb90('0x31')]));if(_0x4b5079[_0xdb90('0x2f')]['filter']){_0x5aafaf[_0xdb90('0x39')]=_[_0xdb90('0x3c')](_0x5aafaf[_0xdb90('0x39')],{'$or':_[_0xdb90('0x28')](_0x5aafaf[_0xdb90('0x33')],function(_0x4d5822){var _0x239979={};_0x239979[_0x4d5822]={'$like':'%'+_0x4b5079[_0xdb90('0x2f')][_0xdb90('0x3b')]+'%'};return _0x239979;})});}_0x5aafaf=_[_0xdb90('0x3c')]({},_0x5aafaf,_0x4b5079[_0xdb90('0x3d')]);return _0x1bbe49[_0xdb90('0x4c')](_0x5aafaf);}})[_0xdb90('0x23')](function(_0x30ff5d){if(_0x30ff5d){_0x5d4a14=_0x30ff5d[_0xdb90('0x35')];if(!_0x4b5079[_0xdb90('0x2f')][_0xdb90('0x36')](_0xdb90('0x37'))){_0x5aafaf[_0xdb90('0x1b')]=qs[_0xdb90('0x1b')](_0x4b5079['query']['limit']);_0x5aafaf['offset']=qs[_0xdb90('0x1d')](_0x4b5079[_0xdb90('0x2f')][_0xdb90('0x1d')]);}return _0x1bbe49[_0xdb90('0x4c')](_0x5aafaf);}})[_0xdb90('0x23')](function(_0x669840){if(_0x669840){return _0x669840?{'count':_0x5d4a14,'rows':_0x669840}:null;}})[_0xdb90('0x23')](respondWithResult(_0x257eeb,null))[_0xdb90('0x41')](handleError(_0x257eeb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 5eecfe7..3739397 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 _0x6f5a=['moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x472bf4,_0x5117a3){var _0x12ca6b=function(_0x29ace0){while(--_0x29ace0){_0x472bf4['push'](_0x472bf4['shift']());}};_0x12ca6b(++_0x5117a3);}(_0x6f5a,0x1cb));var _0xa6f5=function(_0xb8d639,_0x1fadbe){_0xb8d639=_0xb8d639-0x0;var _0x1d5e19=_0x6f5a[_0xb8d639];return _0x1d5e19;};'use strict';var _=require(_0xa6f5('0x0'));var util=require(_0xa6f5('0x1'));var logger=require(_0xa6f5('0x2'))('api');var moment=require(_0xa6f5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6f5('0x4'));var rimraf=require(_0xa6f5('0x5'));var config=require(_0xa6f5('0x6'));var attributes=require(_0xa6f5('0x7'));module[_0xa6f5('0x8')]=function(_0x4cf735,_0x21be4d){return _0x4cf735[_0xa6f5('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xa6f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02d1=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x126b99,_0x4b4f6a){var _0x183f95=function(_0x502642){while(--_0x502642){_0x126b99['push'](_0x126b99['shift']());}};_0x183f95(++_0x4b4f6a);}(_0x02d1,0xa9));var _0x102d=function(_0x4306a1,_0x1a1d8a){_0x4306a1=_0x4306a1-0x0;var _0x134a66=_0x02d1[_0x4306a1];return _0x134a66;};'use strict';var _=require(_0x102d('0x0'));var util=require('util');var logger=require(_0x102d('0x1'))(_0x102d('0x2'));var moment=require(_0x102d('0x3'));var BPromise=require(_0x102d('0x4'));var rp=require(_0x102d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x102d('0x6'));var attributes=require(_0x102d('0x7'));module[_0x102d('0x8')]=function(_0x7524fd,_0x207a00){return _0x7524fd[_0x102d('0x9')](_0x102d('0xa'),attributes,{'tableName':_0x102d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a31f13d..f82b515 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 _0x5147=['client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7468ea,_0x32443e){var _0x5ee951=function(_0xfa242e){while(--_0xfa242e){_0x7468ea['push'](_0x7468ea['shift']());}};_0x5ee951(++_0x32443e);}(_0x5147,0xbf));var _0x7514=function(_0x3b4d32,_0x38e24b){_0x3b4d32=_0x3b4d32-0x0;var _0x6feb4c=_0x5147[_0x3b4d32];return _0x6feb4c;};'use strict';var _=require(_0x7514('0x0'));var util=require(_0x7514('0x1'));var moment=require('moment');var BPromise=require(_0x7514('0x2'));var rs=require(_0x7514('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7514('0x4'));var logger=require(_0x7514('0x5'))(_0x7514('0x6'));var config=require(_0x7514('0x7'));var jayson=require(_0x7514('0x8'));var client=jayson[_0x7514('0x9')][_0x7514('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2efee1,_0x4c1f91,_0x4eec40){return new BPromise(function(_0x1e8414,_0x2b684e){return client['request'](_0x2efee1,_0x4eec40)[_0x7514('0xb')](function(_0x42e714){logger[_0x7514('0xc')](_0x7514('0xd'),_0x4c1f91,_0x7514('0xe'));logger[_0x7514('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4c1f91,_0x7514('0xe'),JSON[_0x7514('0x10')](_0x42e714));if(_0x42e714[_0x7514('0x11')]){if(_0x42e714[_0x7514('0x11')]['code']===0x1f4){logger[_0x7514('0x11')](_0x7514('0xd'),_0x4c1f91,_0x42e714[_0x7514('0x11')]['message']);return _0x2b684e(_0x42e714[_0x7514('0x11')][_0x7514('0x12')]);}logger[_0x7514('0x11')](_0x7514('0xd'),_0x4c1f91,_0x42e714[_0x7514('0x11')][_0x7514('0x12')]);return _0x1e8414(_0x42e714['error'][_0x7514('0x12')]);}else{logger[_0x7514('0xc')](_0x7514('0xd'),_0x4c1f91,_0x7514('0xe'));_0x1e8414(_0x42e714['result'][_0x7514('0x12')]);}})[_0x7514('0x13')](function(_0x63a494){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4c1f91,_0x63a494);_0x2b684e(_0x63a494);});});} \ No newline at end of file +var _0xe352=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x21b077,_0x3d75bb){var _0x417e98=function(_0x2e3b92){while(--_0x2e3b92){_0x21b077['push'](_0x21b077['shift']());}};_0x417e98(++_0x3d75bb);}(_0xe352,0x6e));var _0x2e35=function(_0x129c93,_0xb1f51b){_0x129c93=_0x129c93-0x0;var _0x1a2e1d=_0xe352[_0x129c93];return _0x1a2e1d;};'use strict';var _=require(_0x2e35('0x0'));var util=require('util');var moment=require(_0x2e35('0x1'));var BPromise=require(_0x2e35('0x2'));var rs=require(_0x2e35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e35('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e35('0x5'))(_0x2e35('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e35('0x7'));var client=jayson[_0x2e35('0x8')][_0x2e35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5403d7,_0x2cb507,_0x514aeb){return new BPromise(function(_0x4255c4,_0x362bfd){return client['request'](_0x5403d7,_0x514aeb)[_0x2e35('0xa')](function(_0x3d724f){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2cb507,_0x2e35('0xb'));logger['debug'](_0x2e35('0xc'),_0x2cb507,_0x2e35('0xb'),JSON['stringify'](_0x3d724f));if(_0x3d724f['error']){if(_0x3d724f[_0x2e35('0xd')][_0x2e35('0xe')]===0x1f4){logger[_0x2e35('0xd')](_0x2e35('0xf'),_0x2cb507,_0x3d724f[_0x2e35('0xd')]['message']);return _0x362bfd(_0x3d724f['error']['message']);}logger[_0x2e35('0xd')](_0x2e35('0xf'),_0x2cb507,_0x3d724f[_0x2e35('0xd')][_0x2e35('0x10')]);return _0x4255c4(_0x3d724f[_0x2e35('0xd')][_0x2e35('0x10')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2cb507,_0x2e35('0xb'));_0x4255c4(_0x3d724f[_0x2e35('0x11')][_0x2e35('0x10')]);}})['catch'](function(_0x1caea8){logger[_0x2e35('0xd')](_0x2e35('0xf'),_0x2cb507,_0x1caea8);_0x362bfd(_0x1caea8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 751371a..142513e 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 _0xa9ce=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x3af114,_0x372d13){var _0xa89ba9=function(_0x4eefa8){while(--_0x4eefa8){_0x3af114['push'](_0x3af114['shift']());}};_0xa89ba9(++_0x372d13);}(_0xa9ce,0x1cc));var _0xea9c=function(_0x33a174,_0x459c53){_0x33a174=_0x33a174-0x0;var _0x26b90d=_0xa9ce[_0x33a174];return _0x26b90d;};'use strict';var multer=require(_0xea9c('0x0'));var util=require(_0xea9c('0x1'));var path=require(_0xea9c('0x2'));var timeout=require(_0xea9c('0x3'));var express=require('express');var router=express[_0xea9c('0x4')]();var fs_extra=require(_0xea9c('0x5'));var auth=require(_0xea9c('0x6'));var interaction=require(_0xea9c('0x7'));var config=require(_0xea9c('0x8'));var controller=require(_0xea9c('0x9'));router[_0xea9c('0xa')]('/',auth[_0xea9c('0xb')](),controller[_0xea9c('0xc')]);router[_0xea9c('0xa')]('/:id',auth[_0xea9c('0xb')](),controller[_0xea9c('0xd')]);router[_0xea9c('0xe')]('/',auth[_0xea9c('0xb')](),controller[_0xea9c('0xf')]);router[_0xea9c('0x10')](_0xea9c('0x11'),auth[_0xea9c('0xb')](),controller[_0xea9c('0x12')]);router[_0xea9c('0x13')](_0xea9c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xea9c('0x14')]=router; \ No newline at end of file +var _0xecb1=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update'];(function(_0x41112f,_0x4de0e9){var _0x524faa=function(_0x1070f4){while(--_0x1070f4){_0x41112f['push'](_0x41112f['shift']());}};_0x524faa(++_0x4de0e9);}(_0xecb1,0x7a));var _0x1ecb=function(_0x236e28,_0x3f3e73){_0x236e28=_0x236e28-0x0;var _0x279130=_0xecb1[_0x236e28];return _0x279130;};'use strict';var multer=require(_0x1ecb('0x0'));var util=require(_0x1ecb('0x1'));var path=require('path');var timeout=require(_0x1ecb('0x2'));var express=require(_0x1ecb('0x3'));var router=express[_0x1ecb('0x4')]();var fs_extra=require(_0x1ecb('0x5'));var auth=require(_0x1ecb('0x6'));var interaction=require(_0x1ecb('0x7'));var config=require('../../config/environment');var controller=require(_0x1ecb('0x8'));router['get']('/',auth[_0x1ecb('0x9')](),controller[_0x1ecb('0xa')]);router[_0x1ecb('0xb')]('/:id',auth[_0x1ecb('0x9')](),controller[_0x1ecb('0xc')]);router[_0x1ecb('0xd')]('/',auth['isAuthenticated'](),controller[_0x1ecb('0xe')]);router[_0x1ecb('0xf')](_0x1ecb('0x10'),auth[_0x1ecb('0x9')](),controller[_0x1ecb('0x11')]);router[_0x1ecb('0x12')]('/:id',auth[_0x1ecb('0x9')](),controller['destroy']);module[_0x1ecb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 04cbfc7..72c9d52 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 _0x7ea1=['exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x7ea1,0xbd));var _0x17ea=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x7ea1[_0x1b2422];return _0x376573;};'use strict';var Sequelize=require('sequelize');module[_0x17ea('0x0')]={'type':{'type':Sequelize[_0x17ea('0x1')](_0x17ea('0x2'),_0x17ea('0x3'),'customVariable','keyValue',_0x17ea('0x4')),'defaultValue':_0x17ea('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x17ea('0x5')]},'keyType':{'type':Sequelize[_0x17ea('0x1')](_0x17ea('0x2'),_0x17ea('0x3'),_0x17ea('0x6'))},'keyContent':{'type':Sequelize[_0x17ea('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e53=['exports','string','customVariable','STRING','ENUM','variable','sequelize'];(function(_0x5cd33c,_0x151e9b){var _0x3ca5b7=function(_0x20abcc){while(--_0x20abcc){_0x5cd33c['push'](_0x5cd33c['shift']());}};_0x3ca5b7(++_0x151e9b);}(_0x0e53,0x13a));var _0x30e5=function(_0x3da6bc,_0x1b1203){_0x3da6bc=_0x3da6bc-0x0;var _0x4493ed=_0x0e53[_0x3da6bc];return _0x4493ed;};'use strict';var Sequelize=require(_0x30e5('0x0'));module[_0x30e5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x30e5('0x2'),'variable',_0x30e5('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x30e5('0x4')]},'key':{'type':Sequelize[_0x30e5('0x4')]},'keyType':{'type':Sequelize[_0x30e5('0x5')]('string',_0x30e5('0x6'),_0x30e5('0x3'))},'keyContent':{'type':Sequelize[_0x30e5('0x4')]},'idField':{'type':Sequelize[_0x30e5('0x4')]},'variableName':{'type':Sequelize[_0x30e5('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index dfec016..599740e 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 _0x19dd=['VIRTUAL','name','merge','options','SalesforceField','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','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/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','Content-Range','reject','save','update','then','destroy','error','stack','send','map','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x1b4081,_0x2fa14c){var _0x1bd6d8=function(_0xf83646){while(--_0xf83646){_0x1b4081['push'](_0x1b4081['shift']());}};_0x1bd6d8(++_0x2fa14c);}(_0x19dd,0x19a));var _0xd19d=function(_0x250774,_0x4d905c){_0x250774=_0x250774-0x0;var _0x793820=_0x19dd[_0x250774];return _0x793820;};'use strict';var emlformat=require(_0xd19d('0x0'));var rimraf=require(_0xd19d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd19d('0x2'));var rp=require(_0xd19d('0x3'));var moment=require(_0xd19d('0x4'));var BPromise=require(_0xd19d('0x5'));var Mustache=require(_0xd19d('0x6'));var util=require(_0xd19d('0x7'));var path=require(_0xd19d('0x8'));var sox=require(_0xd19d('0x9'));var csv=require(_0xd19d('0xa'));var ejs=require(_0xd19d('0xb'));var fs=require('fs');var fs_extra=require(_0xd19d('0xc'));var _=require(_0xd19d('0xd'));var squel=require(_0xd19d('0xe'));var crypto=require(_0xd19d('0xf'));var jsforce=require(_0xd19d('0x10'));var deskjs=require(_0xd19d('0x11'));var toCsv=require(_0xd19d('0xa'));var querystring=require(_0xd19d('0x12'));var Papa=require(_0xd19d('0x13'));var Redis=require(_0xd19d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd19d('0x15'));var as=require(_0xd19d('0x16'));var hardwareService=require(_0xd19d('0x17'));var logger=require(_0xd19d('0x18'))('api');var utils=require(_0xd19d('0x19'));var config=require(_0xd19d('0x1a'));var licenseUtil=require(_0xd19d('0x1b'));var db=require(_0xd19d('0x1c'))['db'];function respondWithStatusCode(_0x4661af,_0x351db9){_0x351db9=_0x351db9||0xcc;return function(_0x4df319){if(_0x4df319){return _0x4661af[_0xd19d('0x1d')](_0x351db9);}return _0x4661af[_0xd19d('0x1e')](_0x351db9)[_0xd19d('0x1f')]();};}function respondWithResult(_0x37088e,_0x572348){_0x572348=_0x572348||0xc8;return function(_0xf96267){if(_0xf96267){return _0x37088e[_0xd19d('0x1e')](_0x572348)[_0xd19d('0x20')](_0xf96267);}};}function respondWithFilteredResult(_0x3b9d43,_0x2d3789){return function(_0x672b08){if(_0x672b08){var _0x5a621a=typeof _0x2d3789[_0xd19d('0x21')]===_0xd19d('0x22')&&typeof _0x2d3789[_0xd19d('0x23')]===_0xd19d('0x22');var _0x15f65e=_0x672b08[_0xd19d('0x24')];var _0x52f280=_0x5a621a?0x0:_0x2d3789[_0xd19d('0x21')];var _0x2f7700=_0x5a621a?_0x672b08[_0xd19d('0x24')]:_0x2d3789[_0xd19d('0x21')]+_0x2d3789[_0xd19d('0x23')];var _0xe383d3;if(_0x2f7700>=_0x15f65e){_0x2f7700=_0x15f65e;_0xe383d3=0xc8;}else{_0xe383d3=0xce;}_0x3b9d43[_0xd19d('0x1e')](_0xe383d3);return _0x3b9d43['set'](_0xd19d('0x25'),_0x52f280+'-'+_0x2f7700+'/'+_0x15f65e)[_0xd19d('0x20')](_0x672b08);}return null;};}function patchUpdates(_0x9ff645){return function(_0x21dcbe){try{jsonpatch['apply'](_0x21dcbe,_0x9ff645,!![]);}catch(_0x2f562c){return BPromise[_0xd19d('0x26')](_0x2f562c);}return _0x21dcbe[_0xd19d('0x27')]();};}function saveUpdates(_0x1abe5d,_0x2d2c71){return function(_0x2b0b79){if(_0x2b0b79){return _0x2b0b79[_0xd19d('0x28')](_0x1abe5d)[_0xd19d('0x29')](function(_0x497607){return _0x497607;});}return null;};}function removeEntity(_0x2d8262,_0x252dc6){return function(_0x52e249){if(_0x52e249){return _0x52e249[_0xd19d('0x2a')]()[_0xd19d('0x29')](function(){_0x2d8262[_0xd19d('0x1e')](0xcc)[_0xd19d('0x1f')]();});}};}function handleEntityNotFound(_0x2a6c85,_0xd93957){return function(_0x50c91b){if(!_0x50c91b){_0x2a6c85[_0xd19d('0x1d')](0x194);}return _0x50c91b;};}function handleError(_0x58838e,_0x1a8148){_0x1a8148=_0x1a8148||0x1f4;return function(_0x5301d2){logger[_0xd19d('0x2b')](_0x5301d2[_0xd19d('0x2c')]);if(_0x5301d2['name']){delete _0x5301d2['name'];}_0x58838e[_0xd19d('0x1e')](_0x1a8148)[_0xd19d('0x2d')](_0x5301d2);};}exports['index']=function(_0x3e14f0,_0x4e6298){var _0x133f5e={},_0x4ed64a={},_0x2d6ecf={'count':0x0,'rows':[]};var _0x41dc50=_[_0xd19d('0x2e')](db['SalesforceField']['rawAttributes'],function(_0x202bcb){return{'name':_0x202bcb[_0xd19d('0x2f')],'type':_0x202bcb[_0xd19d('0x30')][_0xd19d('0x31')]};});_0x4ed64a[_0xd19d('0x32')]=_[_0xd19d('0x2e')](_0x41dc50,'name');_0x4ed64a['query']=_[_0xd19d('0x33')](_0x3e14f0['query']);_0x4ed64a[_0xd19d('0x34')]=_[_0xd19d('0x35')](_0x4ed64a[_0xd19d('0x32')],_0x4ed64a['query']);_0x133f5e[_0xd19d('0x36')]=_[_0xd19d('0x35')](_0x4ed64a['model'],qs[_0xd19d('0x37')](_0x3e14f0['query']['fields']));_0x133f5e[_0xd19d('0x36')]=_0x133f5e['attributes'][_0xd19d('0x38')]?_0x133f5e['attributes']:_0x4ed64a[_0xd19d('0x32')];if(!_0x3e14f0[_0xd19d('0x39')][_0xd19d('0x3a')](_0xd19d('0x3b'))){_0x133f5e[_0xd19d('0x23')]=qs['limit'](_0x3e14f0[_0xd19d('0x39')][_0xd19d('0x23')]);_0x133f5e[_0xd19d('0x21')]=qs[_0xd19d('0x21')](_0x3e14f0[_0xd19d('0x39')][_0xd19d('0x21')]);}_0x133f5e[_0xd19d('0x3c')]=qs[_0xd19d('0x3d')](_0x3e14f0[_0xd19d('0x39')][_0xd19d('0x3d')]);_0x133f5e['where']=qs[_0xd19d('0x34')](_['pick'](_0x3e14f0[_0xd19d('0x39')],_0x4ed64a['filters']),_0x41dc50);if(_0x3e14f0['query'][_0xd19d('0x3e')]){_0x133f5e['where']=_['merge'](_0x133f5e[_0xd19d('0x3f')],{'$or':_[_0xd19d('0x2e')](_0x41dc50,function(_0x24077f){if(_0x24077f['type']!==_0xd19d('0x40')){var _0x54fce6={};_0x54fce6[_0x24077f[_0xd19d('0x41')]]={'$like':'%'+_0x3e14f0['query'][_0xd19d('0x3e')]+'%'};return _0x54fce6;}})});}_0x133f5e=_[_0xd19d('0x42')]({},_0x133f5e,_0x3e14f0[_0xd19d('0x43')]);var _0x32e3da={'where':_0x133f5e['where']};return db[_0xd19d('0x44')]['count'](_0x32e3da)[_0xd19d('0x29')](function(_0x4c3d44){_0x2d6ecf[_0xd19d('0x24')]=_0x4c3d44;if(_0x3e14f0[_0xd19d('0x39')][_0xd19d('0x45')]){_0x133f5e['include']=[{'all':!![]}];}return db[_0xd19d('0x44')][_0xd19d('0x46')](_0x133f5e);})[_0xd19d('0x29')](function(_0x6fb30f){_0x2d6ecf[_0xd19d('0x47')]=_0x6fb30f;return _0x2d6ecf;})[_0xd19d('0x29')](respondWithFilteredResult(_0x4e6298,_0x133f5e))[_0xd19d('0x48')](handleError(_0x4e6298,null));};exports[_0xd19d('0x49')]=function(_0xec9987,_0x3a78ab){var _0x1729a6={'raw':!![],'where':{'id':_0xec9987['params']['id']}},_0x489a47={};_0x489a47[_0xd19d('0x32')]=_[_0xd19d('0x33')](db[_0xd19d('0x44')][_0xd19d('0x4a')]);_0x489a47['query']=_[_0xd19d('0x33')](_0xec9987[_0xd19d('0x39')]);_0x489a47[_0xd19d('0x34')]=_['intersection'](_0x489a47['model'],_0x489a47[_0xd19d('0x39')]);_0x1729a6[_0xd19d('0x36')]=_[_0xd19d('0x35')](_0x489a47[_0xd19d('0x32')],qs[_0xd19d('0x37')](_0xec9987[_0xd19d('0x39')][_0xd19d('0x37')]));_0x1729a6['attributes']=_0x1729a6['attributes'][_0xd19d('0x38')]?_0x1729a6[_0xd19d('0x36')]:_0x489a47[_0xd19d('0x32')];if(_0xec9987['query']['includeAll']){_0x1729a6['include']=[{'all':!![]}];}_0x1729a6=_[_0xd19d('0x42')]({},_0x1729a6,_0xec9987['options']);return db['SalesforceField'][_0xd19d('0x4b')](_0x1729a6)[_0xd19d('0x29')](handleEntityNotFound(_0x3a78ab,null))[_0xd19d('0x29')](respondWithResult(_0x3a78ab,null))['catch'](handleError(_0x3a78ab,null));};exports['create']=function(_0x3126fa,_0x20ce58){return db['SalesforceField'][_0xd19d('0x4c')](_0x3126fa[_0xd19d('0x4d')],{})[_0xd19d('0x29')](respondWithResult(_0x20ce58,0xc9))['catch'](handleError(_0x20ce58,null));};exports[_0xd19d('0x28')]=function(_0x19c988,_0x2db37c){if(_0x19c988[_0xd19d('0x4d')]['id']){delete _0x19c988[_0xd19d('0x4d')]['id'];}return db[_0xd19d('0x44')][_0xd19d('0x4b')]({'where':{'id':_0x19c988[_0xd19d('0x4e')]['id']}})[_0xd19d('0x29')](handleEntityNotFound(_0x2db37c,null))[_0xd19d('0x29')](saveUpdates(_0x19c988[_0xd19d('0x4d')],null))[_0xd19d('0x29')](respondWithResult(_0x2db37c,null))['catch'](handleError(_0x2db37c,null));};exports[_0xd19d('0x2a')]=function(_0x30c4a6,_0x30fd26){return db['SalesforceField']['find']({'where':{'id':_0x30c4a6['params']['id']}})['then'](handleEntityNotFound(_0x30fd26,null))['then'](removeEntity(_0x30fd26,null))[_0xd19d('0x48')](handleError(_0x30fd26,null));}; \ No newline at end of file +var _0xefe7=['apply','reject','save','update','then','destroy','status','end','error','stack','name','index','fieldName','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','include','SalesforceField','rows','catch','model','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2c0380,_0x1f7c57){var _0x321502=function(_0x1e36ad){while(--_0x1e36ad){_0x2c0380['push'](_0x2c0380['shift']());}};_0x321502(++_0x1f7c57);}(_0xefe7,0xb9));var _0x7efe=function(_0x42c941,_0x13fd1e){_0x42c941=_0x42c941-0x0;var _0x25e7c0=_0xefe7[_0x42c941];return _0x25e7c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7efe('0x0'));var zipdir=require(_0x7efe('0x1'));var jsonpatch=require(_0x7efe('0x2'));var rp=require(_0x7efe('0x3'));var moment=require(_0x7efe('0x4'));var BPromise=require(_0x7efe('0x5'));var Mustache=require(_0x7efe('0x6'));var util=require(_0x7efe('0x7'));var path=require(_0x7efe('0x8'));var sox=require(_0x7efe('0x9'));var csv=require(_0x7efe('0xa'));var ejs=require(_0x7efe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7efe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7efe('0xd'));var toCsv=require(_0x7efe('0xa'));var querystring=require('querystring');var Papa=require(_0x7efe('0xe'));var Redis=require(_0x7efe('0xf'));var authService=require(_0x7efe('0x10'));var qs=require(_0x7efe('0x11'));var as=require(_0x7efe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7efe('0x13'));var utils=require(_0x7efe('0x14'));var config=require(_0x7efe('0x15'));var licenseUtil=require(_0x7efe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2890a3,_0x176a6d){_0x176a6d=_0x176a6d||0xcc;return function(_0x2a76a9){if(_0x2a76a9){return _0x2890a3[_0x7efe('0x17')](_0x176a6d);}return _0x2890a3['status'](_0x176a6d)['end']();};}function respondWithResult(_0x3a2995,_0x5e300c){_0x5e300c=_0x5e300c||0xc8;return function(_0x595bd6){if(_0x595bd6){return _0x3a2995['status'](_0x5e300c)[_0x7efe('0x18')](_0x595bd6);}};}function respondWithFilteredResult(_0x3f91bb,_0x31be6b){return function(_0x15959c){if(_0x15959c){var _0x1e99d2=typeof _0x31be6b[_0x7efe('0x19')]===_0x7efe('0x1a')&&typeof _0x31be6b[_0x7efe('0x1b')]===_0x7efe('0x1a');var _0x167c8d=_0x15959c[_0x7efe('0x1c')];var _0xe7446e=_0x1e99d2?0x0:_0x31be6b[_0x7efe('0x19')];var _0x5eb3d1=_0x1e99d2?_0x15959c[_0x7efe('0x1c')]:_0x31be6b[_0x7efe('0x19')]+_0x31be6b[_0x7efe('0x1b')];var _0x2566c9;if(_0x5eb3d1>=_0x167c8d){_0x5eb3d1=_0x167c8d;_0x2566c9=0xc8;}else{_0x2566c9=0xce;}_0x3f91bb['status'](_0x2566c9);return _0x3f91bb[_0x7efe('0x1d')](_0x7efe('0x1e'),_0xe7446e+'-'+_0x5eb3d1+'/'+_0x167c8d)[_0x7efe('0x18')](_0x15959c);}return null;};}function patchUpdates(_0x50d985){return function(_0x3739ca){try{jsonpatch[_0x7efe('0x1f')](_0x3739ca,_0x50d985,!![]);}catch(_0x3843e0){return BPromise[_0x7efe('0x20')](_0x3843e0);}return _0x3739ca[_0x7efe('0x21')]();};}function saveUpdates(_0x1f4361,_0xbbf84e){return function(_0x55c001){if(_0x55c001){return _0x55c001[_0x7efe('0x22')](_0x1f4361)[_0x7efe('0x23')](function(_0x516691){return _0x516691;});}return null;};}function removeEntity(_0x243fe3,_0x53c711){return function(_0x56b08f){if(_0x56b08f){return _0x56b08f[_0x7efe('0x24')]()[_0x7efe('0x23')](function(){_0x243fe3[_0x7efe('0x25')](0xcc)[_0x7efe('0x26')]();});}};}function handleEntityNotFound(_0x1cd7e6,_0x14f3ef){return function(_0x64485f){if(!_0x64485f){_0x1cd7e6[_0x7efe('0x17')](0x194);}return _0x64485f;};}function handleError(_0x1d5569,_0x535c7c){_0x535c7c=_0x535c7c||0x1f4;return function(_0x415c9d){logger[_0x7efe('0x27')](_0x415c9d[_0x7efe('0x28')]);if(_0x415c9d['name']){delete _0x415c9d[_0x7efe('0x29')];}_0x1d5569['status'](_0x535c7c)['send'](_0x415c9d);};}exports[_0x7efe('0x2a')]=function(_0x50b41e,_0x4043a2){var _0xb8c25c={},_0x405b11={},_0x121fc8={'count':0x0,'rows':[]};var _0x152e9e=_['map'](db['SalesforceField']['rawAttributes'],function(_0x13e1d9){return{'name':_0x13e1d9[_0x7efe('0x2b')],'type':_0x13e1d9['type']['key']};});_0x405b11['model']=_[_0x7efe('0x2c')](_0x152e9e,'name');_0x405b11['query']=_[_0x7efe('0x2d')](_0x50b41e[_0x7efe('0x2e')]);_0x405b11[_0x7efe('0x2f')]=_[_0x7efe('0x30')](_0x405b11['model'],_0x405b11[_0x7efe('0x2e')]);_0xb8c25c[_0x7efe('0x31')]=_['intersection'](_0x405b11['model'],qs[_0x7efe('0x32')](_0x50b41e[_0x7efe('0x2e')][_0x7efe('0x32')]));_0xb8c25c[_0x7efe('0x31')]=_0xb8c25c[_0x7efe('0x31')][_0x7efe('0x33')]?_0xb8c25c[_0x7efe('0x31')]:_0x405b11['model'];if(!_0x50b41e['query'][_0x7efe('0x34')](_0x7efe('0x35'))){_0xb8c25c[_0x7efe('0x1b')]=qs[_0x7efe('0x1b')](_0x50b41e['query'][_0x7efe('0x1b')]);_0xb8c25c[_0x7efe('0x19')]=qs[_0x7efe('0x19')](_0x50b41e[_0x7efe('0x2e')]['offset']);}_0xb8c25c[_0x7efe('0x36')]=qs[_0x7efe('0x37')](_0x50b41e[_0x7efe('0x2e')]['sort']);_0xb8c25c[_0x7efe('0x38')]=qs[_0x7efe('0x2f')](_[_0x7efe('0x39')](_0x50b41e[_0x7efe('0x2e')],_0x405b11[_0x7efe('0x2f')]),_0x152e9e);if(_0x50b41e[_0x7efe('0x2e')][_0x7efe('0x3a')]){_0xb8c25c['where']=_['merge'](_0xb8c25c[_0x7efe('0x38')],{'$or':_['map'](_0x152e9e,function(_0x41cf51){if(_0x41cf51[_0x7efe('0x3b')]!=='VIRTUAL'){var _0x55f94e={};_0x55f94e[_0x41cf51[_0x7efe('0x29')]]={'$like':'%'+_0x50b41e[_0x7efe('0x2e')]['filter']+'%'};return _0x55f94e;}})});}_0xb8c25c=_[_0x7efe('0x3c')]({},_0xb8c25c,_0x50b41e['options']);var _0x1622d8={'where':_0xb8c25c[_0x7efe('0x38')]};return db['SalesforceField'][_0x7efe('0x1c')](_0x1622d8)[_0x7efe('0x23')](function(_0x1cf345){_0x121fc8[_0x7efe('0x1c')]=_0x1cf345;if(_0x50b41e['query'][_0x7efe('0x3d')]){_0xb8c25c[_0x7efe('0x3e')]=[{'all':!![]}];}return db[_0x7efe('0x3f')]['findAll'](_0xb8c25c);})[_0x7efe('0x23')](function(_0x328fb6){_0x121fc8[_0x7efe('0x40')]=_0x328fb6;return _0x121fc8;})['then'](respondWithFilteredResult(_0x4043a2,_0xb8c25c))[_0x7efe('0x41')](handleError(_0x4043a2,null));};exports['show']=function(_0x5ceff3,_0x2c5f39){var _0x555759={'raw':!![],'where':{'id':_0x5ceff3['params']['id']}},_0x1e9fda={};_0x1e9fda[_0x7efe('0x42')]=_[_0x7efe('0x2d')](db[_0x7efe('0x3f')]['rawAttributes']);_0x1e9fda[_0x7efe('0x2e')]=_[_0x7efe('0x2d')](_0x5ceff3[_0x7efe('0x2e')]);_0x1e9fda['filters']=_['intersection'](_0x1e9fda[_0x7efe('0x42')],_0x1e9fda['query']);_0x555759[_0x7efe('0x31')]=_[_0x7efe('0x30')](_0x1e9fda['model'],qs['fields'](_0x5ceff3[_0x7efe('0x2e')][_0x7efe('0x32')]));_0x555759[_0x7efe('0x31')]=_0x555759[_0x7efe('0x31')]['length']?_0x555759[_0x7efe('0x31')]:_0x1e9fda[_0x7efe('0x42')];if(_0x5ceff3[_0x7efe('0x2e')][_0x7efe('0x3d')]){_0x555759[_0x7efe('0x3e')]=[{'all':!![]}];}_0x555759=_[_0x7efe('0x3c')]({},_0x555759,_0x5ceff3[_0x7efe('0x43')]);return db[_0x7efe('0x3f')]['find'](_0x555759)[_0x7efe('0x23')](handleEntityNotFound(_0x2c5f39,null))[_0x7efe('0x23')](respondWithResult(_0x2c5f39,null))[_0x7efe('0x41')](handleError(_0x2c5f39,null));};exports['create']=function(_0x10d66f,_0x3d27fc){return db[_0x7efe('0x3f')][_0x7efe('0x44')](_0x10d66f[_0x7efe('0x45')],{})[_0x7efe('0x23')](respondWithResult(_0x3d27fc,0xc9))['catch'](handleError(_0x3d27fc,null));};exports[_0x7efe('0x22')]=function(_0x4714a4,_0x5d2d44){if(_0x4714a4['body']['id']){delete _0x4714a4[_0x7efe('0x45')]['id'];}return db[_0x7efe('0x3f')]['find']({'where':{'id':_0x4714a4['params']['id']}})[_0x7efe('0x23')](handleEntityNotFound(_0x5d2d44,null))[_0x7efe('0x23')](saveUpdates(_0x4714a4['body'],null))[_0x7efe('0x23')](respondWithResult(_0x5d2d44,null))[_0x7efe('0x41')](handleError(_0x5d2d44,null));};exports[_0x7efe('0x24')]=function(_0x46a647,_0x5f400e){return db[_0x7efe('0x3f')][_0x7efe('0x46')]({'where':{'id':_0x46a647[_0x7efe('0x47')]['id']}})[_0x7efe('0x23')](handleEntityNotFound(_0x5f400e,null))[_0x7efe('0x23')](removeEntity(_0x5f400e,null))[_0x7efe('0x41')](handleError(_0x5f400e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index babf8ad..ef8a337 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 _0xfe18=['rimraf','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfe18,0x86));var _0x8fe1=function(_0x26b338,_0x25a4ad){_0x26b338=_0x26b338-0x0;var _0x3e6872=_0xfe18[_0x26b338];return _0x3e6872;};'use strict';var _=require(_0x8fe1('0x0'));var util=require('util');var logger=require(_0x8fe1('0x1'))(_0x8fe1('0x2'));var moment=require(_0x8fe1('0x3'));var BPromise=require(_0x8fe1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fe1('0x5'));var rimraf=require(_0x8fe1('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x8fe1('0x7')]=function(_0x1d507c,_0x44c860){return _0x1d507c[_0x8fe1('0x8')](_0x8fe1('0x9'),attributes,{'tableName':_0x8fe1('0xa'),'paranoid':![],'indexes':[{'name':_0x8fe1('0xb'),'fields':[_0x8fe1('0xc'),_0x8fe1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b2c=['int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x3b2c,0x14d));var _0xc3b2=function(_0x280947,_0x42d339){_0x280947=_0x280947-0x0;var _0x5b77ce=_0x3b2c[_0x280947];return _0x5b77ce;};'use strict';var _=require(_0xc3b2('0x0'));var util=require(_0xc3b2('0x1'));var logger=require(_0xc3b2('0x2'))(_0xc3b2('0x3'));var moment=require('moment');var BPromise=require(_0xc3b2('0x4'));var rp=require(_0xc3b2('0x5'));var fs=require('fs');var path=require(_0xc3b2('0x6'));var rimraf=require(_0xc3b2('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3b2('0x8'));module[_0xc3b2('0x9')]=function(_0x127c28,_0x25dcb8){return _0x127c28[_0xc3b2('0xa')](_0xc3b2('0xb'),attributes,{'tableName':_0xc3b2('0xc'),'paranoid':![],'indexes':[{'name':_0xc3b2('0xd'),'fields':['idField',_0xc3b2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 9db9f89..e27481b 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 _0x7a81=['jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2f103d,_0x41a701){var _0xa52466=function(_0x4fb90e){while(--_0x4fb90e){_0x2f103d['push'](_0x2f103d['shift']());}};_0xa52466(++_0x41a701);}(_0x7a81,0x13a));var _0x17a8=function(_0x10601d,_0x56868a){_0x10601d=_0x10601d-0x0;var _0x35474a=_0x7a81[_0x10601d];return _0x35474a;};'use strict';var _=require(_0x17a8('0x0'));var util=require(_0x17a8('0x1'));var moment=require(_0x17a8('0x2'));var BPromise=require(_0x17a8('0x3'));var rs=require(_0x17a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x17a8('0x5'));var logger=require(_0x17a8('0x6'))('rpc');var config=require(_0x17a8('0x7'));var jayson=require(_0x17a8('0x8'));var client=jayson[_0x17a8('0x9')][_0x17a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56cb2f,_0x1e8222,_0x29c06d){return new BPromise(function(_0x53896b,_0x2e28e1){return client[_0x17a8('0xb')](_0x56cb2f,_0x29c06d)[_0x17a8('0xc')](function(_0xd9af9c){logger['info'](_0x17a8('0xd'),_0x1e8222,_0x17a8('0xe'));logger[_0x17a8('0xf')](_0x17a8('0x10'),_0x1e8222,_0x17a8('0xe'),JSON[_0x17a8('0x11')](_0xd9af9c));if(_0xd9af9c[_0x17a8('0x12')]){if(_0xd9af9c[_0x17a8('0x12')][_0x17a8('0x13')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1e8222,_0xd9af9c[_0x17a8('0x12')][_0x17a8('0x14')]);return _0x2e28e1(_0xd9af9c[_0x17a8('0x12')][_0x17a8('0x14')]);}logger[_0x17a8('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1e8222,_0xd9af9c['error'][_0x17a8('0x14')]);return _0x53896b(_0xd9af9c[_0x17a8('0x12')][_0x17a8('0x14')]);}else{logger['info'](_0x17a8('0xd'),_0x1e8222,_0x17a8('0xe'));_0x53896b(_0xd9af9c[_0x17a8('0x15')][_0x17a8('0x14')]);}})[_0x17a8('0x16')](function(_0x3e82eb){logger[_0x17a8('0x12')](_0x17a8('0xd'),_0x1e8222,_0x3e82eb);_0x2e28e1(_0x3e82eb);});});} \ No newline at end of file +var _0x22fe=['code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4da862,_0xca9180){var _0x292f46=function(_0x1789a9){while(--_0x1789a9){_0x4da862['push'](_0x4da862['shift']());}};_0x292f46(++_0xca9180);}(_0x22fe,0xae));var _0xe22f=function(_0x1109c5,_0x185c3f){_0x1109c5=_0x1109c5-0x0;var _0x3ea2ad=_0x22fe[_0x1109c5];return _0x3ea2ad;};'use strict';var _=require(_0xe22f('0x0'));var util=require('util');var moment=require(_0xe22f('0x1'));var BPromise=require(_0xe22f('0x2'));var rs=require(_0xe22f('0x3'));var fs=require('fs');var Redis=require(_0xe22f('0x4'));var db=require(_0xe22f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe22f('0x6'));var config=require(_0xe22f('0x7'));var jayson=require(_0xe22f('0x8'));var client=jayson[_0xe22f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b29c8,_0x18ede3,_0x5c1e39){return new BPromise(function(_0x28a5a3,_0xa219b5){return client[_0xe22f('0xa')](_0x3b29c8,_0x5c1e39)[_0xe22f('0xb')](function(_0x4d7df6){logger[_0xe22f('0xc')](_0xe22f('0xd'),_0x18ede3,_0xe22f('0xe'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x18ede3,_0xe22f('0xe'),JSON['stringify'](_0x4d7df6));if(_0x4d7df6[_0xe22f('0xf')]){if(_0x4d7df6[_0xe22f('0xf')][_0xe22f('0x10')]===0x1f4){logger[_0xe22f('0xf')](_0xe22f('0xd'),_0x18ede3,_0x4d7df6[_0xe22f('0xf')][_0xe22f('0x11')]);return _0xa219b5(_0x4d7df6[_0xe22f('0xf')]['message']);}logger['error'](_0xe22f('0xd'),_0x18ede3,_0x4d7df6[_0xe22f('0xf')][_0xe22f('0x11')]);return _0x28a5a3(_0x4d7df6[_0xe22f('0xf')][_0xe22f('0x11')]);}else{logger[_0xe22f('0xc')](_0xe22f('0xd'),_0x18ede3,_0xe22f('0xe'));_0x28a5a3(_0x4d7df6['result'][_0xe22f('0x11')]);}})[_0xe22f('0x12')](function(_0x447717){logger[_0xe22f('0xf')](_0xe22f('0xd'),_0x18ede3,_0x447717);_0xa219b5(_0x447717);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2b84f51..024f712 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 _0x4db1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create','post','addConfiguration','put','destroy','exports','multer','util','path','express'];(function(_0x3197ef,_0x70de54){var _0x1d2b65=function(_0x4d1258){while(--_0x4d1258){_0x3197ef['push'](_0x3197ef['shift']());}};_0x1d2b65(++_0x70de54);}(_0x4db1,0x19a));var _0x14db=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x4db1[_0x25e109];return _0xc0f7d6;};'use strict';var multer=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var path=require(_0x14db('0x2'));var timeout=require('connect-timeout');var express=require(_0x14db('0x3'));var router=express[_0x14db('0x4')]();var fs_extra=require(_0x14db('0x5'));var auth=require(_0x14db('0x6'));var interaction=require(_0x14db('0x7'));var config=require(_0x14db('0x8'));var controller=require(_0x14db('0x9'));router[_0x14db('0xa')]('/',auth['isAuthenticated'](),controller[_0x14db('0xb')]);router[_0x14db('0xa')](_0x14db('0xc'),auth[_0x14db('0xd')](),controller[_0x14db('0xe')]);router[_0x14db('0xa')]('/:id/configurations',auth[_0x14db('0xd')](),controller[_0x14db('0xf')]);router[_0x14db('0xa')]('/:id/fields',auth[_0x14db('0xd')](),controller[_0x14db('0x10')]);router['post']('/',auth[_0x14db('0xd')](),controller[_0x14db('0x11')]);router[_0x14db('0x12')]('/:id/configurations',auth[_0x14db('0xd')](),controller[_0x14db('0x13')]);router[_0x14db('0x14')](_0x14db('0xc'),auth[_0x14db('0xd')](),controller['update']);router['delete'](_0x14db('0xc'),auth[_0x14db('0xd')](),controller[_0x14db('0x15')]);module[_0x14db('0x16')]=router; \ No newline at end of file +var _0x28eb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28eb,0x105));var _0xb28e=function(_0x3fd928,_0x58fd13){_0x3fd928=_0x3fd928-0x0;var _0x2cd537=_0x28eb[_0x3fd928];return _0x2cd537;};'use strict';var multer=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var path=require(_0xb28e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb28e('0x3'));var router=express[_0xb28e('0x4')]();var fs_extra=require(_0xb28e('0x5'));var auth=require(_0xb28e('0x6'));var interaction=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var controller=require(_0xb28e('0x9'));router['get']('/',auth[_0xb28e('0xa')](),controller[_0xb28e('0xb')]);router[_0xb28e('0xc')](_0xb28e('0xd'),auth['isAuthenticated'](),controller[_0xb28e('0xe')]);router['get'](_0xb28e('0xf'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x10')]);router[_0xb28e('0xc')]('/:id/fields',auth[_0xb28e('0xa')](),controller[_0xb28e('0x11')]);router['post']('/',auth[_0xb28e('0xa')](),controller[_0xb28e('0x12')]);router['post'](_0xb28e('0xf'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x13')]);router[_0xb28e('0x14')](_0xb28e('0xd'),auth['isAuthenticated'](),controller[_0xb28e('0x15')]);router['delete'](_0xb28e('0xd'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x16')]);module[_0xb28e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6ba034f..ec14615 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 _0x3185=['STRING','username','remoteUri','sequelize'];(function(_0x4b0503,_0x15ef22){var _0x276965=function(_0x3b9916){while(--_0x3b9916){_0x4b0503['push'](_0x4b0503['shift']());}};_0x276965(++_0x15ef22);}(_0x3185,0xab));var _0x5318=function(_0x568691,_0x523d52){_0x568691=_0x568691-0x0;var _0x12add=_0x3185[_0x568691];return _0x12add;};'use strict';var Sequelize=require(_0x5318('0x0'));module['exports']={'name':{'type':Sequelize[_0x5318('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x5318('0x2')},'password':{'type':Sequelize[_0x5318('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5318('0x1')],'unique':_0x5318('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x64b1=['STRING','username','remoteUri','exports'];(function(_0x52ad41,_0x43a14d){var _0x5b568f=function(_0x22a90e){while(--_0x22a90e){_0x52ad41['push'](_0x52ad41['shift']());}};_0x5b568f(++_0x43a14d);}(_0x64b1,0x1ab));var _0x164b=function(_0x3e50b9,_0x2d6fa1){_0x3e50b9=_0x3e50b9-0x0;var _0x21a5c1=_0x64b1[_0x3e50b9];return _0x21a5c1;};'use strict';var Sequelize=require('sequelize');module[_0x164b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x164b('0x1')],'unique':_0x164b('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x164b('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x164b('0x3')},'serverUrl':{'type':Sequelize[_0x164b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e5ab3c9..1344935 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 _0x5efe=['AccountId','Subjects','getDescriptions','Descriptions','getFields','made_sla','knowledge','subcategory','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','inactive','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','ServicenowAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration'];(function(_0x533933,_0x46eba1){var _0x5100ae=function(_0xd37def){while(--_0xd37def){_0x533933['push'](_0x533933['shift']());}};_0x5100ae(++_0x46eba1);}(_0x5efe,0x1ec));var _0xe5ef=function(_0x1b7b64,_0x288a90){_0x1b7b64=_0x1b7b64-0x0;var _0x3fdf98=_0x5efe[_0x1b7b64];return _0x3fdf98;};'use strict';var emlformat=require(_0xe5ef('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe5ef('0x1'));var rp=require(_0xe5ef('0x2'));var moment=require(_0xe5ef('0x3'));var BPromise=require(_0xe5ef('0x4'));var Mustache=require(_0xe5ef('0x5'));var util=require(_0xe5ef('0x6'));var path=require(_0xe5ef('0x7'));var sox=require('sox');var csv=require(_0xe5ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5ef('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe5ef('0xa'));var jsforce=require(_0xe5ef('0xb'));var deskjs=require(_0xe5ef('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe5ef('0xd'));var Papa=require(_0xe5ef('0xe'));var Redis=require(_0xe5ef('0xf'));var authService=require(_0xe5ef('0x10'));var qs=require(_0xe5ef('0x11'));var as=require(_0xe5ef('0x12'));var hardwareService=require(_0xe5ef('0x13'));var logger=require(_0xe5ef('0x14'))(_0xe5ef('0x15'));var utils=require(_0xe5ef('0x16'));var config=require(_0xe5ef('0x17'));var licenseUtil=require(_0xe5ef('0x18'));var db=require(_0xe5ef('0x19'))['db'];var integrations=require(_0xe5ef('0x1a'));function respondWithStatusCode(_0x3cf5f6,_0x34ca5f){_0x34ca5f=_0x34ca5f||0xcc;return function(_0x31a399){if(_0x31a399){return _0x3cf5f6['sendStatus'](_0x34ca5f);}return _0x3cf5f6[_0xe5ef('0x1b')](_0x34ca5f)['end']();};}function respondWithResult(_0x34d5f3,_0x1a6ae8){_0x1a6ae8=_0x1a6ae8||0xc8;return function(_0x398caf){if(_0x398caf){return _0x34d5f3[_0xe5ef('0x1b')](_0x1a6ae8)[_0xe5ef('0x1c')](_0x398caf);}};}function respondWithFilteredResult(_0x576e08,_0x113a05){return function(_0x55e76e){if(_0x55e76e){var _0x5c2f11=typeof _0x113a05[_0xe5ef('0x1d')]===_0xe5ef('0x1e')&&typeof _0x113a05[_0xe5ef('0x1f')]===_0xe5ef('0x1e');var _0xcce036=_0x55e76e[_0xe5ef('0x20')];var _0x5502aa=_0x5c2f11?0x0:_0x113a05[_0xe5ef('0x1d')];var _0x540a05=_0x5c2f11?_0x55e76e[_0xe5ef('0x20')]:_0x113a05[_0xe5ef('0x1d')]+_0x113a05['limit'];var _0x11e297;if(_0x540a05>=_0xcce036){_0x540a05=_0xcce036;_0x11e297=0xc8;}else{_0x11e297=0xce;}_0x576e08[_0xe5ef('0x1b')](_0x11e297);return _0x576e08[_0xe5ef('0x21')](_0xe5ef('0x22'),_0x5502aa+'-'+_0x540a05+'/'+_0xcce036)[_0xe5ef('0x1c')](_0x55e76e);}return null;};}function patchUpdates(_0x8c4aeb){return function(_0x4fe6c3){try{jsonpatch[_0xe5ef('0x23')](_0x4fe6c3,_0x8c4aeb,!![]);}catch(_0x568a0e){return BPromise[_0xe5ef('0x24')](_0x568a0e);}return _0x4fe6c3['save']();};}function saveUpdates(_0x5b4f58,_0x4d3915){return function(_0x27bf09){if(_0x27bf09){return _0x27bf09[_0xe5ef('0x25')](_0x5b4f58)[_0xe5ef('0x26')](function(_0x46c0aa){return _0x46c0aa;});}return null;};}function removeEntity(_0x266908,_0x241e1d){return function(_0x411047){if(_0x411047){return _0x411047['destroy']()[_0xe5ef('0x26')](function(){_0x266908[_0xe5ef('0x1b')](0xcc)[_0xe5ef('0x27')]();});}};}function handleEntityNotFound(_0x3954dc,_0x32b297){return function(_0x56c07a){if(!_0x56c07a){_0x3954dc[_0xe5ef('0x28')](0x194);}return _0x56c07a;};}function handleError(_0x6142c,_0x100a9c){_0x100a9c=_0x100a9c||0x1f4;return function(_0x169491){logger[_0xe5ef('0x29')](_0x169491[_0xe5ef('0x2a')]);if(_0x169491[_0xe5ef('0x2b')]){delete _0x169491[_0xe5ef('0x2b')];}_0x6142c[_0xe5ef('0x1b')](_0x100a9c)[_0xe5ef('0x2c')](_0x169491);};}exports['index']=function(_0x49702f,_0x434b2b){var _0x3ece45={},_0x2364c1={},_0x28359c={'count':0x0,'rows':[]};var _0x4bd939=_['map'](db[_0xe5ef('0x2d')][_0xe5ef('0x2e')],function(_0x595206){return{'name':_0x595206[_0xe5ef('0x2f')],'type':_0x595206['type'][_0xe5ef('0x30')]};});_0x2364c1[_0xe5ef('0x31')]=_[_0xe5ef('0x32')](_0x4bd939,'name');_0x2364c1[_0xe5ef('0x33')]=_[_0xe5ef('0x34')](_0x49702f[_0xe5ef('0x33')]);_0x2364c1[_0xe5ef('0x35')]=_[_0xe5ef('0x36')](_0x2364c1[_0xe5ef('0x31')],_0x2364c1[_0xe5ef('0x33')]);_0x3ece45[_0xe5ef('0x37')]=_[_0xe5ef('0x36')](_0x2364c1['model'],qs[_0xe5ef('0x38')](_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x38')]));_0x3ece45[_0xe5ef('0x37')]=_0x3ece45[_0xe5ef('0x37')][_0xe5ef('0x39')]?_0x3ece45[_0xe5ef('0x37')]:_0x2364c1['model'];if(!_0x49702f[_0xe5ef('0x33')]['hasOwnProperty'](_0xe5ef('0x3a'))){_0x3ece45['limit']=qs[_0xe5ef('0x1f')](_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x1f')]);_0x3ece45[_0xe5ef('0x1d')]=qs[_0xe5ef('0x1d')](_0x49702f['query']['offset']);}_0x3ece45['order']=qs[_0xe5ef('0x3b')](_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x3b')]);_0x3ece45[_0xe5ef('0x3c')]=qs[_0xe5ef('0x35')](_[_0xe5ef('0x3d')](_0x49702f[_0xe5ef('0x33')],_0x2364c1[_0xe5ef('0x35')]),_0x4bd939);if(_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x3e')]){_0x3ece45['where']=_[_0xe5ef('0x3f')](_0x3ece45['where'],{'$or':_[_0xe5ef('0x32')](_0x4bd939,function(_0x2b5085){if(_0x2b5085[_0xe5ef('0x40')]!==_0xe5ef('0x41')){var _0x1d135d={};_0x1d135d[_0x2b5085[_0xe5ef('0x2b')]]={'$like':'%'+_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x3e')]+'%'};return _0x1d135d;}})});}_0x3ece45=_[_0xe5ef('0x3f')]({},_0x3ece45,_0x49702f[_0xe5ef('0x42')]);var _0x35888e={'where':_0x3ece45[_0xe5ef('0x3c')]};return db[_0xe5ef('0x2d')][_0xe5ef('0x20')](_0x35888e)['then'](function(_0x2fcd84){_0x28359c[_0xe5ef('0x20')]=_0x2fcd84;if(_0x49702f[_0xe5ef('0x33')][_0xe5ef('0x43')]){_0x3ece45[_0xe5ef('0x44')]=[{'all':!![]}];}return db[_0xe5ef('0x2d')][_0xe5ef('0x45')](_0x3ece45);})[_0xe5ef('0x26')](function(_0xcaa0a5){_0x28359c[_0xe5ef('0x46')]=_0xcaa0a5;return _0x28359c;})[_0xe5ef('0x26')](respondWithFilteredResult(_0x434b2b,_0x3ece45))[_0xe5ef('0x47')](handleError(_0x434b2b,null));};exports[_0xe5ef('0x48')]=function(_0x53e1fd,_0x31b5de){var _0x543cc4={'raw':![],'where':{'id':_0x53e1fd[_0xe5ef('0x49')]['id']}},_0x1bb14c={};_0x1bb14c['model']=_[_0xe5ef('0x34')](db['ServicenowAccount']['rawAttributes']);_0x1bb14c[_0xe5ef('0x33')]=_['keys'](_0x53e1fd[_0xe5ef('0x33')]);_0x1bb14c[_0xe5ef('0x35')]=_[_0xe5ef('0x36')](_0x1bb14c[_0xe5ef('0x31')],_0x1bb14c[_0xe5ef('0x33')]);_0x543cc4[_0xe5ef('0x37')]=_[_0xe5ef('0x36')](_0x1bb14c[_0xe5ef('0x31')],qs[_0xe5ef('0x38')](_0x53e1fd['query'][_0xe5ef('0x38')]));_0x543cc4[_0xe5ef('0x37')]=_0x543cc4['attributes'][_0xe5ef('0x39')]?_0x543cc4['attributes']:_0x1bb14c[_0xe5ef('0x31')];if(_0x53e1fd['query'][_0xe5ef('0x43')]){_0x543cc4[_0xe5ef('0x44')]=[{'all':!![]}];}_0x543cc4=_[_0xe5ef('0x3f')]({},_0x543cc4,_0x53e1fd[_0xe5ef('0x42')]);return db[_0xe5ef('0x2d')][_0xe5ef('0x4a')](_0x543cc4)[_0xe5ef('0x26')](handleEntityNotFound(_0x31b5de,null))[_0xe5ef('0x26')](respondWithResult(_0x31b5de,null))['catch'](handleError(_0x31b5de,null));};exports[_0xe5ef('0x4b')]=function(_0x40196e,_0x51e27a){return db[_0xe5ef('0x2d')][_0xe5ef('0x4b')](_0x40196e[_0xe5ef('0x4c')],{})[_0xe5ef('0x26')](respondWithResult(_0x51e27a,0xc9))['catch'](handleError(_0x51e27a,null));};exports[_0xe5ef('0x25')]=function(_0x1cfec0,_0x2400e5){if(_0x1cfec0[_0xe5ef('0x4c')]['id']){delete _0x1cfec0['body']['id'];}return db['ServicenowAccount'][_0xe5ef('0x4a')]({'where':{'id':_0x1cfec0[_0xe5ef('0x49')]['id']}})[_0xe5ef('0x26')](handleEntityNotFound(_0x2400e5,null))[_0xe5ef('0x26')](saveUpdates(_0x1cfec0['body'],null))['then'](respondWithResult(_0x2400e5,null))[_0xe5ef('0x47')](handleError(_0x2400e5,null));};exports[_0xe5ef('0x4d')]=function(_0x28ef49,_0x39ce66){return db[_0xe5ef('0x2d')][_0xe5ef('0x4a')]({'where':{'id':_0x28ef49[_0xe5ef('0x49')]['id']}})[_0xe5ef('0x26')](handleEntityNotFound(_0x39ce66,null))[_0xe5ef('0x26')](removeEntity(_0x39ce66,null))[_0xe5ef('0x47')](handleError(_0x39ce66,null));};exports[_0xe5ef('0x4e')]=function(_0x1e654b,_0x1505e9,_0x909d89){var _0x13b787={};var _0x5e80ae={};var _0x2e3c1f;var _0x1fca7e;return db[_0xe5ef('0x2d')][_0xe5ef('0x4f')]({'where':{'id':_0x1e654b[_0xe5ef('0x49')]['id']}})[_0xe5ef('0x26')](handleEntityNotFound(_0x1505e9,null))[_0xe5ef('0x26')](function(_0x5cbe7e){if(_0x5cbe7e){_0x2e3c1f=_0x5cbe7e;_0x5e80ae[_0xe5ef('0x31')]=_[_0xe5ef('0x34')](db[_0xe5ef('0x50')]['rawAttributes']);_0x5e80ae[_0xe5ef('0x33')]=_['keys'](_0x1e654b[_0xe5ef('0x33')]);_0x5e80ae[_0xe5ef('0x35')]=_[_0xe5ef('0x36')](_0x5e80ae[_0xe5ef('0x31')],_0x5e80ae['query']);_0x13b787['attributes']=_[_0xe5ef('0x36')](_0x5e80ae[_0xe5ef('0x31')],qs[_0xe5ef('0x38')](_0x1e654b[_0xe5ef('0x33')][_0xe5ef('0x38')]));_0x13b787[_0xe5ef('0x37')]=_0x13b787[_0xe5ef('0x37')]['length']?_0x13b787[_0xe5ef('0x37')]:_0x5e80ae['model'];_0x13b787[_0xe5ef('0x51')]=qs[_0xe5ef('0x3b')](_0x1e654b[_0xe5ef('0x33')][_0xe5ef('0x3b')]);_0x13b787[_0xe5ef('0x3c')]=qs[_0xe5ef('0x35')](_[_0xe5ef('0x3d')](_0x1e654b[_0xe5ef('0x33')],_0x5e80ae[_0xe5ef('0x35')]));if(_0x1e654b[_0xe5ef('0x33')][_0xe5ef('0x3e')]){_0x13b787[_0xe5ef('0x3c')]=_[_0xe5ef('0x3f')](_0x13b787['where'],{'$or':_['map'](_0x13b787['attributes'],function(_0x139d40){var _0x507613={};_0x507613[_0x139d40]={'$like':'%'+_0x1e654b[_0xe5ef('0x33')]['filter']+'%'};return _0x507613;})});}_0x13b787=_[_0xe5ef('0x3f')]({},_0x13b787,_0x1e654b[_0xe5ef('0x42')]);return _0x2e3c1f['getConfigurations'](_0x13b787);}})[_0xe5ef('0x26')](function(_0x58f141){if(_0x58f141){_0x1fca7e=_0x58f141[_0xe5ef('0x39')];if(!_0x1e654b['query'][_0xe5ef('0x52')]('nolimit')){_0x13b787[_0xe5ef('0x1f')]=qs['limit'](_0x1e654b[_0xe5ef('0x33')][_0xe5ef('0x1f')]);_0x13b787['offset']=qs['offset'](_0x1e654b[_0xe5ef('0x33')][_0xe5ef('0x1d')]);}return _0x2e3c1f[_0xe5ef('0x4e')](_0x13b787);}})[_0xe5ef('0x26')](function(_0x1ede6f){if(_0x1ede6f){return _0x1ede6f?{'count':_0x1fca7e,'rows':_0x1ede6f}:null;}})[_0xe5ef('0x26')](respondWithResult(_0x1505e9,null))[_0xe5ef('0x47')](handleError(_0x1505e9,null));};exports[_0xe5ef('0x53')]=function(_0x2c015e,_0x249cf1,_0x40c85b){if(_0x2c015e[_0xe5ef('0x4c')]['id']){delete _0x2c015e['body']['id'];}return db['ServicenowAccount'][_0xe5ef('0x4f')]({'where':{'id':_0x2c015e[_0xe5ef('0x49')]['id']}})[_0xe5ef('0x26')](handleEntityNotFound(_0x249cf1,null))[_0xe5ef('0x26')](function(_0x580aaa){if(_0x580aaa){_0x2c015e['body'][_0xe5ef('0x54')]=_0x580aaa['id'];_0x2c015e[_0xe5ef('0x4c')][_0xe5ef('0x55')]=integrations['getSubjects'](_0x2c015e[_0xe5ef('0x4c')]['channel'],_0x2c015e[_0xe5ef('0x4c')][_0xe5ef('0x40')]);_0x2c015e[_0xe5ef('0x4c')]['Descriptions']=integrations[_0xe5ef('0x56')](_0x2c015e[_0xe5ef('0x4c')]['channel'],_0x2c015e[_0xe5ef('0x4c')]['type']);return db[_0xe5ef('0x50')][_0xe5ef('0x4b')](_0x2c015e['body'],{'include':[{'model':db['ServicenowField'],'as':_0xe5ef('0x55')},{'model':db['ServicenowField'],'as':_0xe5ef('0x57')}]});}return null;})['then'](respondWithResult(_0x249cf1,null))[_0xe5ef('0x47')](handleError(_0x249cf1,null));};exports[_0xe5ef('0x58')]=function(_0x145bbd,_0x480df7,_0x570d3a){var _0x4d93fb=[_0xe5ef('0x59'),'hold_reason',_0xe5ef('0x5a'),_0xe5ef('0x5b'),'close_code','notify',_0xe5ef('0x5c'),_0xe5ef('0x5d'),'category'];var _0x52aa29=[_0xe5ef('0x5e'),_0xe5ef('0x59'),_0xe5ef('0x5f'),'watch_list',_0xe5ef('0x60'),_0xe5ef('0x61'),_0xe5ef('0x62'),_0xe5ef('0x63'),_0xe5ef('0x64'),_0xe5ef('0x65'),_0xe5ef('0x66'),'sys_updated_by',_0xe5ef('0x67'),_0xe5ef('0x68'),_0xe5ef('0x69'),_0xe5ef('0x6a'),_0xe5ef('0x6b'),'sys_created_by',_0xe5ef('0x5a'),_0xe5ef('0x51'),'calendar_stc','closed_at',_0xe5ef('0x6c'),_0xe5ef('0x6d'),_0xe5ef('0x6e'),'active',_0xe5ef('0x6f'),_0xe5ef('0x70'),_0xe5ef('0x71'),_0xe5ef('0x72'),_0xe5ef('0x73'),_0xe5ef('0x74'),_0xe5ef('0x75'),_0xe5ef('0x76'),'business_duration',_0xe5ef('0x77'),_0xe5ef('0x78'),_0xe5ef('0x79'),_0xe5ef('0x7a'),_0xe5ef('0x7b'),_0xe5ef('0x7c'),_0xe5ef('0x5b'),_0xe5ef('0x7d'),_0xe5ef('0x7e'),_0xe5ef('0x7f'),_0xe5ef('0x80'),_0xe5ef('0x81'),_0xe5ef('0x82'),_0xe5ef('0x83'),_0xe5ef('0x84'),_0xe5ef('0x85'),_0xe5ef('0x86'),_0xe5ef('0x87'),_0xe5ef('0x88'),_0xe5ef('0x89'),_0xe5ef('0x8a'),_0xe5ef('0x8b'),_0xe5ef('0x8c'),_0xe5ef('0x8d'),_0xe5ef('0x8e'),'contact_type',_0xe5ef('0x8f'),_0xe5ef('0x5c'),'urgency',_0xe5ef('0x90'),_0xe5ef('0x91'),_0xe5ef('0x92'),_0xe5ef('0x93'),_0xe5ef('0x94'),'severity',_0xe5ef('0x95'),_0xe5ef('0x96'),_0xe5ef('0x97'),_0xe5ef('0x98'),'due_date',_0xe5ef('0x99'),_0xe5ef('0x9a'),_0xe5ef('0x9b'),_0xe5ef('0x9c'),_0xe5ef('0x9d'),_0xe5ef('0x9e'),_0xe5ef('0x9f'),'category'];var _0x2bc969='';var _0x255834='';var _0x20f158=[];var _0x27927a='';var _0x1ba919='';var _0x4ebdc7=[];var _0x5a202c='';var _0x1f61e0='';var _0x3c89c5={};var _0x47148b='';return db[_0xe5ef('0x2d')]['findOne']({'where':{'id':_0x145bbd[_0xe5ef('0x49')]['id']},'attributes':['id',_0xe5ef('0xa0'),_0xe5ef('0xa1'),_0xe5ef('0xa2'),_0xe5ef('0xa3'),'serverUrl']})['then'](handleEntityNotFound(_0x480df7,null))[_0xe5ef('0x26')](function(_0x1f33fd){if(_0x1f33fd){_0x47148b=_0x1f33fd[_0xe5ef('0xa3')];var _0x52f675=_0x47148b[_0xe5ef('0xa4')](-0x1);if(_0x52f675==='/'){_0x47148b=_0x47148b['substring'](0x0,_0x47148b[_0xe5ef('0xa5')](_0x52f675));}_0x1f61e0=util['format'](_0xe5ef('0xa6'),_0x47148b);_0x5a202c=util[_0xe5ef('0xa7')](_0xe5ef('0xa8'),_0x47148b);_0x3c89c5={'user':_0x1f33fd[_0xe5ef('0xa0')],'pass':_0x1f33fd['password']};var _0x2d3def={'method':_0xe5ef('0xa9'),'uri':_0x1f61e0+'incident?sysparm_display_value=all','auth':_0x3c89c5,'json':!![]};return rp(_0x2d3def);}})[_0xe5ef('0x26')](function(_0x15c1b9){if(_0x15c1b9[_0xe5ef('0xaa')][_0xe5ef('0x39')]>0x0){_0x2bc969=_0x15c1b9['result'];}console[_0xe5ef('0xab')](_0xe5ef('0xac'),_0x2bc969);_0x4ebdc7=[];_0x255834=Object['assign']([],_0x2bc969);_[_0xe5ef('0xad')](_0x255834,function(_0x21b7fa){return!_0x4d93fb[_0xe5ef('0xae')](_0x21b7fa['name']);});_0x255834[_0xe5ef('0xaf')](function(_0x1dcc11){var _0x2154e8=createFieldObject(_0x5a202c,_0x3c89c5,_0x1dcc11[_0xe5ef('0xb0')],_0x1dcc11[_0xe5ef('0x2b')],_0x1dcc11[_0xe5ef('0xb1')],![]);_0x4ebdc7['push'](_0x2154e8);});return Promise[_0xe5ef('0xb2')](_0x4ebdc7);})[_0xe5ef('0x26')](function(_0x43ab4b){_0x20f158=_0x43ab4b;_0x27927a=Object[_0xe5ef('0xb3')]([],_0x2bc969);console['log']('TCL:\x20_object',_0x2bc969);_['remove'](_0x27927a,function(_0x410eaf){return _0x52aa29[_0xe5ef('0xae')](_0x410eaf[_0xe5ef('0x2b')]);});console[_0xe5ef('0xab')](_0xe5ef('0xb4'),_0x27927a);_0x4ebdc7=[];_0x27927a['forEach'](function(_0x7b04bd){var _0x46d908=createFieldObject(_0x5a202c,_0x3c89c5,_0x7b04bd[_0xe5ef('0xb0')],_0x7b04bd['name'],_0x7b04bd[_0xe5ef('0xb1')],!![]);_0x4ebdc7[_0xe5ef('0xb5')](_0x46d908);});return Promise[_0xe5ef('0xb2')](_0x4ebdc7);})['then'](function(_0x43c66f){_0x1ba919=_0x43c66f;var _0x82e669=_0x20f158['concat'](_0x1ba919);return{'count':_0x82e669['length'],'rows':_0x82e669};})[_0xe5ef('0x26')](respondWithResult(_0x480df7,null))[_0xe5ef('0x47')](function(_0x2cabdb){console[_0xe5ef('0xab')](_0xe5ef('0xb6')+_0x2cabdb);var _0xa4f9ce=_0x145bbd[_0xe5ef('0x33')][_0xe5ef('0xb7')]?0x1f4:_0x2cabdb['statusCode']||0x1f4;logger[_0xe5ef('0x29')](_0x2cabdb[_0xe5ef('0x2a')]);delete _0x2cabdb[_0xe5ef('0x2b')];if(_0xa4f9ce===0x191){_0xa4f9ce=0x190;}_0x480df7[_0xe5ef('0x1b')](_0xa4f9ce)[_0xe5ef('0x2c')](_0x145bbd['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2cabdb[_0xe5ef('0xb8')]}:_0x2cabdb);});};function createFieldObject(_0x2ce3fe,_0x40b1b6,_0xaf8051,_0x1c188f,_0x2ad2c4,_0x748ad1){return new Promise(function(_0x2f9046,_0x53a4d0){var _0x175d4e={'id':_0x1c188f,'name':_0x2ad2c4,'custom':_0x748ad1};if(_0xaf8051===_0xe5ef('0xb9')){_0x175d4e[_0xe5ef('0x42')]=[{'name':_0xe5ef('0xba'),'value':_0xe5ef('0xbb')},{'name':_0xe5ef('0xbc'),'value':_0xe5ef('0xbd')}];_0x2f9046(_0x175d4e);}else{var _0xb61bc6={'method':_0xe5ef('0xa9'),'uri':_0x2ce3fe+'sys_choice?sysparm_query=name=incident^element='+_0x1c188f,'auth':_0x40b1b6,'json':!![]};return rp(_0xb61bc6)[_0xe5ef('0x26')](function(_0x1ffdc6){var _0x2dd2ad=[];if(_0x1ffdc6[_0xe5ef('0xaa')]['length']>0x0){_0x1ffdc6[_0xe5ef('0xaa')][_0xe5ef('0xaf')](function(_0x12b01e){if(_0x12b01e[_0xe5ef('0xbe')]===_0xe5ef('0xbd')){var _0x3350aa={'name':_0x12b01e['label'],'value':_0x12b01e[_0xe5ef('0xbf')]};_0x2dd2ad[_0xe5ef('0xb5')](_0x3350aa);}});}_0x175d4e['options']=_0x2dd2ad;if(_0x175d4e[_0xe5ef('0x42')][_0xe5ef('0x39')]>0x0){_0x2f9046(_0x175d4e);}else{if(_0x748ad1==![]){_0x2f9046();}else{_0x2f9046(_0x175d4e);}}});}});} \ No newline at end of file +var _0x4388=['closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','push','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','statusCode','send','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','end','error','stack','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','findAll','fields','include','options','find','catch','create','body','params','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','work_end','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x4388,0x199));var _0x8438=function(_0x16a24b,_0x1a4ebc){_0x16a24b=_0x16a24b-0x0;var _0x4d4e9a=_0x4388[_0x16a24b];return _0x4d4e9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8438('0x0'));var zipdir=require(_0x8438('0x1'));var jsonpatch=require(_0x8438('0x2'));var rp=require('request-promise');var moment=require(_0x8438('0x3'));var BPromise=require(_0x8438('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8438('0x5'));var sox=require(_0x8438('0x6'));var csv=require(_0x8438('0x7'));var ejs=require(_0x8438('0x8'));var fs=require('fs');var fs_extra=require(_0x8438('0x9'));var _=require(_0x8438('0xa'));var squel=require('squel');var crypto=require(_0x8438('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8438('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8438('0xd'));var Papa=require(_0x8438('0xe'));var Redis=require('ioredis');var authService=require(_0x8438('0xf'));var qs=require(_0x8438('0x10'));var as=require(_0x8438('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8438('0x12'));var utils=require(_0x8438('0x13'));var config=require(_0x8438('0x14'));var licenseUtil=require(_0x8438('0x15'));var db=require(_0x8438('0x16'))['db'];var integrations=require(_0x8438('0x17'));function respondWithStatusCode(_0x531af5,_0x2a7305){_0x2a7305=_0x2a7305||0xcc;return function(_0x3cc140){if(_0x3cc140){return _0x531af5[_0x8438('0x18')](_0x2a7305);}return _0x531af5[_0x8438('0x19')](_0x2a7305)['end']();};}function respondWithResult(_0x38d690,_0x4b5afe){_0x4b5afe=_0x4b5afe||0xc8;return function(_0x40cc2a){if(_0x40cc2a){return _0x38d690['status'](_0x4b5afe)[_0x8438('0x1a')](_0x40cc2a);}};}function respondWithFilteredResult(_0x33d70b,_0x3b5e9a){return function(_0x8abe58){if(_0x8abe58){var _0x4d9030=typeof _0x3b5e9a[_0x8438('0x1b')]===_0x8438('0x1c')&&typeof _0x3b5e9a['limit']===_0x8438('0x1c');var _0x339ea6=_0x8abe58[_0x8438('0x1d')];var _0x476598=_0x4d9030?0x0:_0x3b5e9a[_0x8438('0x1b')];var _0x4a5887=_0x4d9030?_0x8abe58['count']:_0x3b5e9a[_0x8438('0x1b')]+_0x3b5e9a[_0x8438('0x1e')];var _0x33dbca;if(_0x4a5887>=_0x339ea6){_0x4a5887=_0x339ea6;_0x33dbca=0xc8;}else{_0x33dbca=0xce;}_0x33d70b[_0x8438('0x19')](_0x33dbca);return _0x33d70b[_0x8438('0x1f')]('Content-Range',_0x476598+'-'+_0x4a5887+'/'+_0x339ea6)[_0x8438('0x1a')](_0x8abe58);}return null;};}function patchUpdates(_0x5d5a4e){return function(_0x2b8f0f){try{jsonpatch['apply'](_0x2b8f0f,_0x5d5a4e,!![]);}catch(_0x385b19){return BPromise[_0x8438('0x20')](_0x385b19);}return _0x2b8f0f['save']();};}function saveUpdates(_0x1294e8,_0x2553d6){return function(_0x263f21){if(_0x263f21){return _0x263f21[_0x8438('0x21')](_0x1294e8)[_0x8438('0x22')](function(_0x1a7622){return _0x1a7622;});}return null;};}function removeEntity(_0x158b73,_0xf84835){return function(_0x33ff9a){if(_0x33ff9a){return _0x33ff9a[_0x8438('0x23')]()[_0x8438('0x22')](function(){_0x158b73[_0x8438('0x19')](0xcc)[_0x8438('0x24')]();});}};}function handleEntityNotFound(_0x241ab7,_0x13a8dd){return function(_0x1e7c75){if(!_0x1e7c75){_0x241ab7[_0x8438('0x18')](0x194);}return _0x1e7c75;};}function handleError(_0x262649,_0x4f78bd){_0x4f78bd=_0x4f78bd||0x1f4;return function(_0x55999d){logger[_0x8438('0x25')](_0x55999d[_0x8438('0x26')]);if(_0x55999d[_0x8438('0x27')]){delete _0x55999d['name'];}_0x262649[_0x8438('0x19')](_0x4f78bd)['send'](_0x55999d);};}exports[_0x8438('0x28')]=function(_0x2832c2,_0x4d919a){var _0x5868d5={},_0x29c0b2={},_0x388cf0={'count':0x0,'rows':[]};var _0x2fc3b6=_['map'](db[_0x8438('0x29')][_0x8438('0x2a')],function(_0x1c8f81){return{'name':_0x1c8f81[_0x8438('0x2b')],'type':_0x1c8f81[_0x8438('0x2c')][_0x8438('0x2d')]};});_0x29c0b2[_0x8438('0x2e')]=_[_0x8438('0x2f')](_0x2fc3b6,_0x8438('0x27'));_0x29c0b2[_0x8438('0x30')]=_[_0x8438('0x31')](_0x2832c2[_0x8438('0x30')]);_0x29c0b2[_0x8438('0x32')]=_[_0x8438('0x33')](_0x29c0b2[_0x8438('0x2e')],_0x29c0b2[_0x8438('0x30')]);_0x5868d5[_0x8438('0x34')]=_[_0x8438('0x33')](_0x29c0b2[_0x8438('0x2e')],qs['fields'](_0x2832c2['query']['fields']));_0x5868d5[_0x8438('0x34')]=_0x5868d5[_0x8438('0x34')][_0x8438('0x35')]?_0x5868d5[_0x8438('0x34')]:_0x29c0b2[_0x8438('0x2e')];if(!_0x2832c2['query'][_0x8438('0x36')](_0x8438('0x37'))){_0x5868d5[_0x8438('0x1e')]=qs[_0x8438('0x1e')](_0x2832c2['query'][_0x8438('0x1e')]);_0x5868d5[_0x8438('0x1b')]=qs[_0x8438('0x1b')](_0x2832c2['query'][_0x8438('0x1b')]);}_0x5868d5[_0x8438('0x38')]=qs[_0x8438('0x39')](_0x2832c2[_0x8438('0x30')][_0x8438('0x39')]);_0x5868d5[_0x8438('0x3a')]=qs[_0x8438('0x32')](_[_0x8438('0x3b')](_0x2832c2[_0x8438('0x30')],_0x29c0b2[_0x8438('0x32')]),_0x2fc3b6);if(_0x2832c2['query']['filter']){_0x5868d5['where']=_[_0x8438('0x3c')](_0x5868d5[_0x8438('0x3a')],{'$or':_[_0x8438('0x2f')](_0x2fc3b6,function(_0x3c78ac){if(_0x3c78ac[_0x8438('0x2c')]!=='VIRTUAL'){var _0x328b82={};_0x328b82[_0x3c78ac[_0x8438('0x27')]]={'$like':'%'+_0x2832c2[_0x8438('0x30')]['filter']+'%'};return _0x328b82;}})});}_0x5868d5=_[_0x8438('0x3c')]({},_0x5868d5,_0x2832c2['options']);var _0x29a16b={'where':_0x5868d5['where']};return db[_0x8438('0x29')][_0x8438('0x1d')](_0x29a16b)['then'](function(_0x4160ed){_0x388cf0[_0x8438('0x1d')]=_0x4160ed;if(_0x2832c2[_0x8438('0x30')]['includeAll']){_0x5868d5['include']=[{'all':!![]}];}return db[_0x8438('0x29')][_0x8438('0x3d')](_0x5868d5);})[_0x8438('0x22')](function(_0x4a7b36){_0x388cf0['rows']=_0x4a7b36;return _0x388cf0;})[_0x8438('0x22')](respondWithFilteredResult(_0x4d919a,_0x5868d5))['catch'](handleError(_0x4d919a,null));};exports['show']=function(_0x404633,_0x5eec9e){var _0x3fbbd1={'raw':![],'where':{'id':_0x404633['params']['id']}},_0x575e={};_0x575e[_0x8438('0x2e')]=_[_0x8438('0x31')](db[_0x8438('0x29')][_0x8438('0x2a')]);_0x575e[_0x8438('0x30')]=_[_0x8438('0x31')](_0x404633[_0x8438('0x30')]);_0x575e['filters']=_['intersection'](_0x575e['model'],_0x575e[_0x8438('0x30')]);_0x3fbbd1[_0x8438('0x34')]=_[_0x8438('0x33')](_0x575e['model'],qs[_0x8438('0x3e')](_0x404633['query'][_0x8438('0x3e')]));_0x3fbbd1['attributes']=_0x3fbbd1[_0x8438('0x34')][_0x8438('0x35')]?_0x3fbbd1[_0x8438('0x34')]:_0x575e[_0x8438('0x2e')];if(_0x404633['query']['includeAll']){_0x3fbbd1[_0x8438('0x3f')]=[{'all':!![]}];}_0x3fbbd1=_[_0x8438('0x3c')]({},_0x3fbbd1,_0x404633[_0x8438('0x40')]);return db[_0x8438('0x29')][_0x8438('0x41')](_0x3fbbd1)[_0x8438('0x22')](handleEntityNotFound(_0x5eec9e,null))[_0x8438('0x22')](respondWithResult(_0x5eec9e,null))[_0x8438('0x42')](handleError(_0x5eec9e,null));};exports[_0x8438('0x43')]=function(_0x5f3350,_0x3251b9){return db[_0x8438('0x29')][_0x8438('0x43')](_0x5f3350[_0x8438('0x44')],{})['then'](respondWithResult(_0x3251b9,0xc9))[_0x8438('0x42')](handleError(_0x3251b9,null));};exports['update']=function(_0xc7886,_0x365106){if(_0xc7886[_0x8438('0x44')]['id']){delete _0xc7886[_0x8438('0x44')]['id'];}return db[_0x8438('0x29')][_0x8438('0x41')]({'where':{'id':_0xc7886[_0x8438('0x45')]['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x365106,null))['then'](saveUpdates(_0xc7886[_0x8438('0x44')],null))[_0x8438('0x22')](respondWithResult(_0x365106,null))[_0x8438('0x42')](handleError(_0x365106,null));};exports['destroy']=function(_0x19ffbe,_0x5a297b){return db['ServicenowAccount']['find']({'where':{'id':_0x19ffbe[_0x8438('0x45')]['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x5a297b,null))[_0x8438('0x22')](removeEntity(_0x5a297b,null))[_0x8438('0x42')](handleError(_0x5a297b,null));};exports[_0x8438('0x46')]=function(_0x52bac9,_0x407b6f,_0x45aeec){var _0x1a3227={};var _0x504291={};var _0x10078a;var _0xd680d8;return db['ServicenowAccount'][_0x8438('0x47')]({'where':{'id':_0x52bac9[_0x8438('0x45')]['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x407b6f,null))[_0x8438('0x22')](function(_0x4d9e73){if(_0x4d9e73){_0x10078a=_0x4d9e73;_0x504291[_0x8438('0x2e')]=_['keys'](db[_0x8438('0x48')][_0x8438('0x2a')]);_0x504291[_0x8438('0x30')]=_['keys'](_0x52bac9[_0x8438('0x30')]);_0x504291['filters']=_['intersection'](_0x504291[_0x8438('0x2e')],_0x504291[_0x8438('0x30')]);_0x1a3227[_0x8438('0x34')]=_[_0x8438('0x33')](_0x504291[_0x8438('0x2e')],qs[_0x8438('0x3e')](_0x52bac9[_0x8438('0x30')][_0x8438('0x3e')]));_0x1a3227[_0x8438('0x34')]=_0x1a3227[_0x8438('0x34')]['length']?_0x1a3227[_0x8438('0x34')]:_0x504291[_0x8438('0x2e')];_0x1a3227['order']=qs[_0x8438('0x39')](_0x52bac9[_0x8438('0x30')]['sort']);_0x1a3227['where']=qs[_0x8438('0x32')](_[_0x8438('0x3b')](_0x52bac9[_0x8438('0x30')],_0x504291[_0x8438('0x32')]));if(_0x52bac9[_0x8438('0x30')][_0x8438('0x49')]){_0x1a3227[_0x8438('0x3a')]=_[_0x8438('0x3c')](_0x1a3227[_0x8438('0x3a')],{'$or':_[_0x8438('0x2f')](_0x1a3227['attributes'],function(_0xc832a5){var _0x3fbb35={};_0x3fbb35[_0xc832a5]={'$like':'%'+_0x52bac9['query'][_0x8438('0x49')]+'%'};return _0x3fbb35;})});}_0x1a3227=_[_0x8438('0x3c')]({},_0x1a3227,_0x52bac9['options']);return _0x10078a[_0x8438('0x46')](_0x1a3227);}})['then'](function(_0x531c43){if(_0x531c43){_0xd680d8=_0x531c43[_0x8438('0x35')];if(!_0x52bac9[_0x8438('0x30')][_0x8438('0x36')](_0x8438('0x37'))){_0x1a3227[_0x8438('0x1e')]=qs[_0x8438('0x1e')](_0x52bac9['query'][_0x8438('0x1e')]);_0x1a3227[_0x8438('0x1b')]=qs['offset'](_0x52bac9[_0x8438('0x30')]['offset']);}return _0x10078a[_0x8438('0x46')](_0x1a3227);}})['then'](function(_0x45d4ab){if(_0x45d4ab){return _0x45d4ab?{'count':_0xd680d8,'rows':_0x45d4ab}:null;}})['then'](respondWithResult(_0x407b6f,null))[_0x8438('0x42')](handleError(_0x407b6f,null));};exports[_0x8438('0x4a')]=function(_0x6ff780,_0x4c499e,_0x5d27f1){if(_0x6ff780[_0x8438('0x44')]['id']){delete _0x6ff780[_0x8438('0x44')]['id'];}return db[_0x8438('0x29')][_0x8438('0x47')]({'where':{'id':_0x6ff780[_0x8438('0x45')]['id']}})[_0x8438('0x22')](handleEntityNotFound(_0x4c499e,null))['then'](function(_0x332a98){if(_0x332a98){_0x6ff780['body'][_0x8438('0x4b')]=_0x332a98['id'];_0x6ff780[_0x8438('0x44')][_0x8438('0x4c')]=integrations[_0x8438('0x4d')](_0x6ff780[_0x8438('0x44')][_0x8438('0x4e')],_0x6ff780[_0x8438('0x44')]['type']);_0x6ff780[_0x8438('0x44')][_0x8438('0x4f')]=integrations['getDescriptions'](_0x6ff780[_0x8438('0x44')]['channel'],_0x6ff780['body'][_0x8438('0x2c')]);return db[_0x8438('0x48')][_0x8438('0x43')](_0x6ff780[_0x8438('0x44')],{'include':[{'model':db['ServicenowField'],'as':_0x8438('0x4c')},{'model':db[_0x8438('0x50')],'as':_0x8438('0x4f')}]});}return null;})[_0x8438('0x22')](respondWithResult(_0x4c499e,null))[_0x8438('0x42')](handleError(_0x4c499e,null));};exports[_0x8438('0x51')]=function(_0x598bd6,_0x3a6ef3,_0x3ecbcc){var _0x3c1754=[_0x8438('0x52'),_0x8438('0x53'),'knowledge',_0x8438('0x54'),_0x8438('0x55'),'notify',_0x8438('0x56'),_0x8438('0x57'),_0x8438('0x58')];var _0x5914f3=[_0x8438('0x59'),_0x8438('0x52'),'caused_by',_0x8438('0x5a'),_0x8438('0x5b'),_0x8438('0x5c'),_0x8438('0x5d'),_0x8438('0x53'),'approval_history',_0x8438('0x5e'),_0x8438('0x5f'),'sys_updated_by','opened_by',_0x8438('0x60'),_0x8438('0x61'),_0x8438('0x62'),'state',_0x8438('0x63'),'knowledge',_0x8438('0x38'),'calendar_stc',_0x8438('0x64'),_0x8438('0x65'),_0x8438('0x66'),_0x8438('0x67'),_0x8438('0x68'),_0x8438('0x69'),_0x8438('0x6a'),_0x8438('0x6b'),_0x8438('0x6c'),_0x8438('0x6d'),'time_worked',_0x8438('0x6e'),_0x8438('0x6f'),'business_duration','group_list',_0x8438('0x70'),'reopened_time',_0x8438('0x71'),_0x8438('0x72'),'approval_set','subcategory',_0x8438('0x73'),_0x8438('0x74'),'close_code',_0x8438('0x75'),_0x8438('0x76'),_0x8438('0x77'),_0x8438('0x78'),_0x8438('0x79'),_0x8438('0x7a'),'description',_0x8438('0x7b'),_0x8438('0x7c'),'sys_class_name','close_notes',_0x8438('0x7d'),_0x8438('0x7e'),_0x8438('0x7f'),'sys_id',_0x8438('0x80'),_0x8438('0x81'),_0x8438('0x56'),_0x8438('0x82'),_0x8438('0x83'),_0x8438('0x84'),_0x8438('0x85'),_0x8438('0x86'),'assigned_to',_0x8438('0x57'),_0x8438('0x87'),'sla_due',_0x8438('0x88'),_0x8438('0x89'),_0x8438('0x8a'),_0x8438('0x8b'),_0x8438('0x8c'),_0x8438('0x8d'),_0x8438('0x8e'),'upon_approval',_0x8438('0x8f'),'location',_0x8438('0x58')];var _0x28621d='';var _0x5b1a7b='';var _0x5dca46=[];var _0x577f0d='';var _0x4aa7d6='';var _0x549ecc=[];var _0x6ddde9='';var _0x57a64e='';var _0x1c4aed={};var _0x5c3fcd='';return db[_0x8438('0x29')]['findOne']({'where':{'id':_0x598bd6[_0x8438('0x45')]['id']},'attributes':['id',_0x8438('0x90'),_0x8438('0x91'),_0x8438('0x92'),_0x8438('0x93'),_0x8438('0x94')]})[_0x8438('0x22')](handleEntityNotFound(_0x3a6ef3,null))[_0x8438('0x22')](function(_0x35fd2d){if(_0x35fd2d){_0x5c3fcd=_0x35fd2d['remoteUri'];var _0x39ae55=_0x5c3fcd[_0x8438('0x95')](-0x1);if(_0x39ae55==='/'){_0x5c3fcd=_0x5c3fcd[_0x8438('0x96')](0x0,_0x5c3fcd[_0x8438('0x97')](_0x39ae55));}_0x57a64e=util[_0x8438('0x98')](_0x8438('0x99'),_0x5c3fcd);_0x6ddde9=util['format'](_0x8438('0x9a'),_0x5c3fcd);_0x1c4aed={'user':_0x35fd2d[_0x8438('0x90')],'pass':_0x35fd2d[_0x8438('0x91')]};var _0x3ada93={'method':_0x8438('0x9b'),'uri':_0x57a64e+_0x8438('0x9c'),'auth':_0x1c4aed,'json':!![]};return rp(_0x3ada93);}})['then'](function(_0x2cba1c){if(_0x2cba1c[_0x8438('0x9d')][_0x8438('0x35')]>0x0){_0x28621d=_0x2cba1c[_0x8438('0x9d')];}console[_0x8438('0x9e')]('incident\x20table\x20objects',_0x28621d);_0x549ecc=[];_0x5b1a7b=Object['assign']([],_0x28621d);_[_0x8438('0x9f')](_0x5b1a7b,function(_0x284767){return!_0x3c1754[_0x8438('0xa0')](_0x284767[_0x8438('0x27')]);});_0x5b1a7b[_0x8438('0xa1')](function(_0x49b4bb){var _0x3b6c8d=createFieldObject(_0x6ddde9,_0x1c4aed,_0x49b4bb[_0x8438('0xa2')],_0x49b4bb[_0x8438('0x27')],_0x49b4bb['label'],![]);_0x549ecc[_0x8438('0xa3')](_0x3b6c8d);});return Promise[_0x8438('0xa4')](_0x549ecc);})['then'](function(_0x3add61){_0x5dca46=_0x3add61;_0x577f0d=Object[_0x8438('0xa5')]([],_0x28621d);console['log']('TCL:\x20_object',_0x28621d);_[_0x8438('0x9f')](_0x577f0d,function(_0x528bcb){return _0x5914f3[_0x8438('0xa0')](_0x528bcb[_0x8438('0x27')]);});console[_0x8438('0x9e')](_0x8438('0xa6'),_0x577f0d);_0x549ecc=[];_0x577f0d['forEach'](function(_0x441ec1){var _0x55c158=createFieldObject(_0x6ddde9,_0x1c4aed,_0x441ec1[_0x8438('0xa2')],_0x441ec1[_0x8438('0x27')],_0x441ec1[_0x8438('0xa7')],!![]);_0x549ecc[_0x8438('0xa3')](_0x55c158);});return Promise[_0x8438('0xa4')](_0x549ecc);})['then'](function(_0x7d2729){_0x4aa7d6=_0x7d2729;var _0xc2269a=_0x5dca46['concat'](_0x4aa7d6);return{'count':_0xc2269a['length'],'rows':_0xc2269a};})[_0x8438('0x22')](respondWithResult(_0x3a6ef3,null))[_0x8438('0x42')](function(_0x3f01d4){console[_0x8438('0x9e')](_0x8438('0xa8')+_0x3f01d4);var _0x312a99=_0x598bd6[_0x8438('0x30')][_0x8438('0xa9')]?0x1f4:_0x3f01d4[_0x8438('0xaa')]||0x1f4;logger[_0x8438('0x25')](_0x3f01d4[_0x8438('0x26')]);delete _0x3f01d4[_0x8438('0x27')];if(_0x312a99===0x191){_0x312a99=0x190;}_0x3a6ef3[_0x8438('0x19')](_0x312a99)[_0x8438('0xab')](_0x598bd6[_0x8438('0x30')][_0x8438('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x3f01d4[_0x8438('0xaa')]}:_0x3f01d4);});};function createFieldObject(_0x36f421,_0x3646a1,_0x1c3b7f,_0x5f1c6a,_0x42cd00,_0x16e801){return new Promise(function(_0x34f455,_0x478c61){var _0x44f072={'id':_0x5f1c6a,'name':_0x42cd00,'custom':_0x16e801};if(_0x1c3b7f===_0x8438('0xac')){_0x44f072[_0x8438('0x40')]=[{'name':_0x8438('0xad'),'value':_0x8438('0xae')},{'name':_0x8438('0xaf'),'value':'false'}];_0x34f455(_0x44f072);}else{var _0x662944={'method':'GET','uri':_0x36f421+_0x8438('0xb0')+_0x5f1c6a,'auth':_0x3646a1,'json':!![]};return rp(_0x662944)[_0x8438('0x22')](function(_0x20eb87){var _0x207461=[];if(_0x20eb87['result']['length']>0x0){_0x20eb87[_0x8438('0x9d')][_0x8438('0xa1')](function(_0x53e477){if(_0x53e477[_0x8438('0xb1')]==='false'){var _0xc4f552={'name':_0x53e477[_0x8438('0xa7')],'value':_0x53e477['value']};_0x207461[_0x8438('0xa3')](_0xc4f552);}});}_0x44f072[_0x8438('0x40')]=_0x207461;if(_0x44f072[_0x8438('0x40')][_0x8438('0x35')]>0x0){_0x34f455(_0x44f072);}else{if(_0x16e801==![]){_0x34f455();}else{_0x34f455(_0x44f072);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7a9be3a..801b853 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 _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0x387d19,_0x3f290e){var _0x27fd4b=function(_0x5db852){while(--_0x5db852){_0x387d19['push'](_0x387d19['shift']());}};_0x27fd4b(++_0x3f290e);}(_0x2675,0x75));var _0x5267=function(_0x37b670,_0x19f70b){_0x37b670=_0x37b670-0x0;var _0x14c3a6=_0x2675[_0x37b670];return _0x14c3a6;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x118bd1,_0x159fac){var _0x324864=function(_0x22c06f){while(--_0x22c06f){_0x118bd1['push'](_0x118bd1['shift']());}};_0x324864(++_0x159fac);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2bbaba,_0x4b208b){_0x2bbaba=_0x2bbaba-0x0;var _0x271a81=_0xd8fb[_0x2bbaba];return _0x271a81;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'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 763f962..1390f2e 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 _0xe809=['lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','model','include','stringify','catch','map','ShowServicenowAccount'];(function(_0x3e4077,_0x48d561){var _0x4a35d3=function(_0x3b639c){while(--_0x3b639c){_0x3e4077['push'](_0x3e4077['shift']());}};_0x4a35d3(++_0x48d561);}(_0xe809,0x180));var _0x9e80=function(_0x1ccb42,_0x6dd89e){_0x1ccb42=_0x1ccb42-0x0;var _0x1e3d57=_0xe809[_0x1ccb42];return _0x1e3d57;};'use strict';var _=require(_0x9e80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e80('0x1'));var rs=require(_0x9e80('0x2'));var fs=require('fs');var Redis=require(_0x9e80('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e80('0x4'));var config=require(_0x9e80('0x5'));var jayson=require(_0x9e80('0x6'));var client=jayson[_0x9e80('0x7')][_0x9e80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1459f6,_0x3e1c68,_0x164a53){return new BPromise(function(_0x24c538,_0x20172c){return client[_0x9e80('0x9')](_0x1459f6,_0x164a53)[_0x9e80('0xa')](function(_0x2179fe){logger[_0x9e80('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x3e1c68,_0x9e80('0xc'));logger[_0x9e80('0xd')](_0x9e80('0xe'),_0x3e1c68,_0x9e80('0xc'),JSON['stringify'](_0x2179fe));if(_0x2179fe[_0x9e80('0xf')]){if(_0x2179fe[_0x9e80('0xf')][_0x9e80('0x10')]===0x1f4){logger[_0x9e80('0xf')](_0x9e80('0x11'),_0x3e1c68,_0x2179fe[_0x9e80('0xf')]['message']);return _0x20172c(_0x2179fe['error'][_0x9e80('0x12')]);}logger[_0x9e80('0xf')](_0x9e80('0x11'),_0x3e1c68,_0x2179fe[_0x9e80('0xf')]['message']);return _0x24c538(_0x2179fe['error'][_0x9e80('0x12')]);}else{logger[_0x9e80('0xb')](_0x9e80('0x11'),_0x3e1c68,_0x9e80('0xc'));_0x24c538(_0x2179fe[_0x9e80('0x13')][_0x9e80('0x12')]);}})['catch'](function(_0x1c4516){logger['error'](_0x9e80('0x11'),_0x3e1c68,_0x1c4516);_0x20172c(_0x1c4516);});});}exports[_0x9e80('0x14')]=function(_0x28b0d4){var _0x8ad220=this;return new Promise(function(_0x2a9b28,_0x51ba00){return db[_0x9e80('0x15')]['findAll']({'raw':_0x28b0d4['options']?_0x28b0d4[_0x9e80('0x16')][_0x9e80('0x17')]===undefined?!![]:![]:!![],'where':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')]['where']||null:null,'attributes':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4['options'][_0x9e80('0x18')]||null:null,'limit':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')][_0x9e80('0x19')]||null:null,'include':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')]['include']?_['map'](_0x28b0d4[_0x9e80('0x16')]['include'],function(_0x56dc41){return{'model':db[_0x56dc41[_0x9e80('0x1a')]],'as':_0x56dc41['as'],'attributes':_0x56dc41[_0x9e80('0x18')],'include':_0x56dc41[_0x9e80('0x1b')]?_['map'](_0x56dc41[_0x9e80('0x1b')],function(_0xefa33a){return{'model':db[_0xefa33a[_0x9e80('0x1a')]],'as':_0xefa33a['as'],'attributes':_0xefa33a['attributes'],'include':_0xefa33a[_0x9e80('0x1b')]?_['map'](_0xefa33a[_0x9e80('0x1b')],function(_0x4d9f9a){return{'model':db[_0x4d9f9a['model']],'as':_0x4d9f9a['as'],'attributes':_0x4d9f9a[_0x9e80('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0xa')](function(_0x4fb85b){logger[_0x9e80('0xb')]('GetServicenowAccount',_0x28b0d4);logger['debug'](_0x9e80('0x14'),_0x28b0d4,JSON[_0x9e80('0x1c')](_0x4fb85b));_0x2a9b28(_0x4fb85b);})[_0x9e80('0x1d')](function(_0x21f2e9){logger[_0x9e80('0xf')](_0x9e80('0x14'),_0x21f2e9[_0x9e80('0x12')],_0x28b0d4);_0x51ba00(_0x8ad220['error'](0x1f4,_0x21f2e9['message']));});});};exports['ShowServicenowAccount']=function(_0x51125c){var _0x3cf399=this;return new Promise(function(_0x207dce,_0x1c51fe){return db['ServicenowAccount']['find']({'raw':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')]['where']||null:null,'attributes':_0x51125c['options']?_0x51125c[_0x9e80('0x16')][_0x9e80('0x18')]||null:null,'include':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')][_0x9e80('0x1b')]?_['map'](_0x51125c['options']['include'],function(_0x367346){return{'model':db[_0x367346[_0x9e80('0x1a')]],'as':_0x367346['as'],'attributes':_0x367346['attributes'],'include':_0x367346[_0x9e80('0x1b')]?_[_0x9e80('0x1e')](_0x367346['include'],function(_0x530e47){return{'model':db[_0x530e47[_0x9e80('0x1a')]],'as':_0x530e47['as'],'attributes':_0x530e47[_0x9e80('0x18')],'include':_0x530e47[_0x9e80('0x1b')]?_[_0x9e80('0x1e')](_0x530e47[_0x9e80('0x1b')],function(_0x3082f6){return{'model':db[_0x3082f6[_0x9e80('0x1a')]],'as':_0x3082f6['as'],'attributes':_0x3082f6[_0x9e80('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0xa')](function(_0x200449){logger[_0x9e80('0xb')]('ShowServicenowAccount',_0x51125c);logger[_0x9e80('0xd')](_0x9e80('0x1f'),_0x51125c,JSON[_0x9e80('0x1c')](_0x200449));_0x207dce(_0x200449);})[_0x9e80('0x1d')](function(_0xdf4619){logger[_0x9e80('0xf')]('ShowServicenowAccount',_0xdf4619[_0x9e80('0x12')],_0x51125c);_0x1c51fe(_0x3cf399[_0x9e80('0xf')](0x1f4,_0xdf4619[_0x9e80('0x12')]));});});}; \ No newline at end of file +var _0x010d=['request\x20sent','debug','error','code','message','result','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','catch','find','raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x46e198,_0xbdd317){var _0x878d4f=function(_0x24610d){while(--_0x24610d){_0x46e198['push'](_0x46e198['shift']());}};_0x878d4f(++_0xbdd317);}(_0x010d,0xed));var _0xd010=function(_0x35a785,_0x1da0bc){_0x35a785=_0x35a785-0x0;var _0x54d270=_0x010d[_0x35a785];return _0x54d270;};'use strict';var _=require(_0xd010('0x0'));var util=require(_0xd010('0x1'));var moment=require(_0xd010('0x2'));var BPromise=require(_0xd010('0x3'));var rs=require(_0xd010('0x4'));var fs=require('fs');var Redis=require(_0xd010('0x5'));var db=require(_0xd010('0x6'))['db'];var utils=require(_0xd010('0x7'));var logger=require(_0xd010('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd010('0x9')][_0xd010('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34cda9,_0xd7f2ab,_0x1be1ac){return new BPromise(function(_0x3c5189,_0x140df7){return client[_0xd010('0xb')](_0x34cda9,_0x1be1ac)[_0xd010('0xc')](function(_0x13f810){logger[_0xd010('0xd')](_0xd010('0xe'),_0xd7f2ab,_0xd010('0xf'));logger[_0xd010('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xd7f2ab,_0xd010('0xf'),JSON['stringify'](_0x13f810));if(_0x13f810['error']){if(_0x13f810[_0xd010('0x11')][_0xd010('0x12')]===0x1f4){logger['error'](_0xd010('0xe'),_0xd7f2ab,_0x13f810[_0xd010('0x11')]['message']);return _0x140df7(_0x13f810[_0xd010('0x11')][_0xd010('0x13')]);}logger[_0xd010('0x11')](_0xd010('0xe'),_0xd7f2ab,_0x13f810['error'][_0xd010('0x13')]);return _0x3c5189(_0x13f810['error'][_0xd010('0x13')]);}else{logger[_0xd010('0xd')](_0xd010('0xe'),_0xd7f2ab,_0xd010('0xf'));_0x3c5189(_0x13f810[_0xd010('0x14')]['message']);}})['catch'](function(_0x3d312b){logger[_0xd010('0x11')](_0xd010('0xe'),_0xd7f2ab,_0x3d312b);_0x140df7(_0x3d312b);});});}exports['GetServicenowAccount']=function(_0x646d8d){var _0x1ade65=this;return new Promise(function(_0x1980ed,_0x322326){return db[_0xd010('0x15')][_0xd010('0x16')]({'raw':_0x646d8d[_0xd010('0x17')]?_0x646d8d[_0xd010('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x646d8d[_0xd010('0x17')]?_0x646d8d[_0xd010('0x17')][_0xd010('0x18')]||null:null,'attributes':_0x646d8d['options']?_0x646d8d[_0xd010('0x17')][_0xd010('0x19')]||null:null,'limit':_0x646d8d[_0xd010('0x17')]?_0x646d8d[_0xd010('0x17')][_0xd010('0x1a')]||null:null,'include':_0x646d8d[_0xd010('0x17')]?_0x646d8d[_0xd010('0x17')][_0xd010('0x1b')]?_[_0xd010('0x1c')](_0x646d8d[_0xd010('0x17')]['include'],function(_0x4d0037){return{'model':db[_0x4d0037[_0xd010('0x1d')]],'as':_0x4d0037['as'],'attributes':_0x4d0037[_0xd010('0x19')],'include':_0x4d0037[_0xd010('0x1b')]?_[_0xd010('0x1c')](_0x4d0037['include'],function(_0x11d345){return{'model':db[_0x11d345['model']],'as':_0x11d345['as'],'attributes':_0x11d345['attributes'],'include':_0x11d345[_0xd010('0x1b')]?_[_0xd010('0x1c')](_0x11d345[_0xd010('0x1b')],function(_0x2d4e58){return{'model':db[_0x2d4e58[_0xd010('0x1d')]],'as':_0x2d4e58['as'],'attributes':_0x2d4e58['attributes']};}):[]};}):[]};}):[]:[]})[_0xd010('0xc')](function(_0x4343ee){logger[_0xd010('0xd')](_0xd010('0x1e'),_0x646d8d);logger['debug']('GetServicenowAccount',_0x646d8d,JSON[_0xd010('0x1f')](_0x4343ee));_0x1980ed(_0x4343ee);})[_0xd010('0x20')](function(_0x226ad6){logger['error'](_0xd010('0x1e'),_0x226ad6[_0xd010('0x13')],_0x646d8d);_0x322326(_0x1ade65[_0xd010('0x11')](0x1f4,_0x226ad6['message']));});});};exports['ShowServicenowAccount']=function(_0x178646){var _0x34d0bb=this;return new Promise(function(_0x182b78,_0x5c4284){return db[_0xd010('0x15')][_0xd010('0x21')]({'raw':_0x178646[_0xd010('0x17')]?_0x178646['options'][_0xd010('0x22')]===undefined?!![]:![]:!![],'where':_0x178646[_0xd010('0x17')]?_0x178646['options']['where']||null:null,'attributes':_0x178646['options']?_0x178646[_0xd010('0x17')][_0xd010('0x19')]||null:null,'include':_0x178646[_0xd010('0x17')]?_0x178646['options']['include']?_['map'](_0x178646[_0xd010('0x17')][_0xd010('0x1b')],function(_0x7e12a5){return{'model':db[_0x7e12a5[_0xd010('0x1d')]],'as':_0x7e12a5['as'],'attributes':_0x7e12a5['attributes'],'include':_0x7e12a5[_0xd010('0x1b')]?_[_0xd010('0x1c')](_0x7e12a5['include'],function(_0x2bb177){return{'model':db[_0x2bb177[_0xd010('0x1d')]],'as':_0x2bb177['as'],'attributes':_0x2bb177[_0xd010('0x19')],'include':_0x2bb177[_0xd010('0x1b')]?_['map'](_0x2bb177['include'],function(_0x58b287){return{'model':db[_0x58b287[_0xd010('0x1d')]],'as':_0x58b287['as'],'attributes':_0x58b287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd010('0xc')](function(_0x3beed6){logger[_0xd010('0xd')](_0xd010('0x23'),_0x178646);logger[_0xd010('0x10')](_0xd010('0x23'),_0x178646,JSON[_0xd010('0x1f')](_0x3beed6));_0x182b78(_0x3beed6);})['catch'](function(_0x159a78){logger['error'](_0xd010('0x23'),_0x159a78[_0xd010('0x13')],_0x178646);_0x5c4284(_0x34d0bb['error'](0x1f4,_0x159a78[_0xd010('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3b621ae..68fb4ac 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 _0x6973=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','destroy','exports'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x6973,0x1e0));var _0x3697=function(_0xbb9c12,_0x15883a){_0xbb9c12=_0xbb9c12-0x0;var _0x200e05=_0x6973[_0xbb9c12];return _0x200e05;};'use strict';var multer=require(_0x3697('0x0'));var util=require(_0x3697('0x1'));var path=require(_0x3697('0x2'));var timeout=require('connect-timeout');var express=require(_0x3697('0x3'));var router=express['Router']();var fs_extra=require(_0x3697('0x4'));var auth=require(_0x3697('0x5'));var interaction=require(_0x3697('0x6'));var config=require(_0x3697('0x7'));var controller=require(_0x3697('0x8'));router[_0x3697('0x9')]('/',auth[_0x3697('0xa')](),controller['index']);router[_0x3697('0x9')](_0x3697('0xb'),auth[_0x3697('0xa')](),controller[_0x3697('0xc')]);router[_0x3697('0x9')](_0x3697('0xd'),auth[_0x3697('0xa')](),controller[_0x3697('0xe')]);router[_0x3697('0x9')](_0x3697('0xf'),auth[_0x3697('0xa')](),controller[_0x3697('0x10')]);router[_0x3697('0x9')]('/:id/descriptions',auth[_0x3697('0xa')](),controller[_0x3697('0x11')]);router[_0x3697('0x12')]('/',auth['isAuthenticated'](),controller[_0x3697('0x13')]);router[_0x3697('0x14')](_0x3697('0xb'),auth[_0x3697('0xa')](),controller[_0x3697('0x15')]);router['delete'](_0x3697('0xb'),auth['isAuthenticated'](),controller[_0x3697('0x16')]);module[_0x3697('0x17')]=router; \ No newline at end of file +var _0xcc94=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcc94,0x184));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4cc9('0x0'));var util=require('util');var path=require(_0x4cc9('0x1'));var timeout=require(_0x4cc9('0x2'));var express=require('express');var router=express[_0x4cc9('0x3')]();var fs_extra=require(_0x4cc9('0x4'));var auth=require(_0x4cc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4cc9('0x6'));var controller=require(_0x4cc9('0x7'));router[_0x4cc9('0x8')]('/',auth[_0x4cc9('0x9')](),controller[_0x4cc9('0xa')]);router[_0x4cc9('0x8')]('/:id',auth[_0x4cc9('0x9')](),controller[_0x4cc9('0xb')]);router[_0x4cc9('0x8')](_0x4cc9('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x4cc9('0x8')](_0x4cc9('0xd'),auth['isAuthenticated'](),controller[_0x4cc9('0xe')]);router[_0x4cc9('0x8')](_0x4cc9('0xf'),auth['isAuthenticated'](),controller[_0x4cc9('0x10')]);router[_0x4cc9('0x11')]('/',auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x12')]);router[_0x4cc9('0x13')](_0x4cc9('0x14'),auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x15')]);router[_0x4cc9('0x16')](_0x4cc9('0x14'),auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x17')]);module[_0x4cc9('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6bccb22..c343d86 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 _0x7374=['sequelize','exports'];(function(_0x2274e9,_0x35e858){var _0x10af77=function(_0x1941cd){while(--_0x1941cd){_0x2274e9['push'](_0x2274e9['shift']());}};_0x10af77(++_0x35e858);}(_0x7374,0x90));var _0x4737=function(_0x5200fc,_0x2727bc){_0x5200fc=_0x5200fc-0x0;var _0x5b2d3b=_0x7374[_0x5200fc];return _0x5b2d3b;};'use strict';var Sequelize=require(_0x4737('0x0'));module[_0x4737('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x940d=['exports','STRING'];(function(_0x4d4ad7,_0x363a45){var _0x5365a2=function(_0x5ec385){while(--_0x5ec385){_0x4d4ad7['push'](_0x4d4ad7['shift']());}};_0x5365a2(++_0x363a45);}(_0x940d,0x1a2));var _0xd940=function(_0x4afb16,_0x347a4e){_0x4afb16=_0x4afb16-0x0;var _0x2bb64c=_0x940d[_0x4afb16];return _0x2bb64c;};'use strict';var Sequelize=require('sequelize');module[_0xd940('0x0')]={'name':{'type':Sequelize[_0xd940('0x1')]},'description':{'type':Sequelize[_0xd940('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5f7c429..4212a2b 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 _0x4b6b=['error','stack','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','name','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then'];(function(_0x3d9105,_0x11d562){var _0x1fd3f6=function(_0x257d41){while(--_0x257d41){_0x3d9105['push'](_0x3d9105['shift']());}};_0x1fd3f6(++_0x11d562);}(_0x4b6b,0x16c));var _0xb4b6=function(_0x4e265f,_0x37b10a){_0x4e265f=_0x4e265f-0x0;var _0x29d678=_0x4b6b[_0x4e265f];return _0x29d678;};'use strict';var emlformat=require(_0xb4b6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb4b6('0x1'));var rp=require(_0xb4b6('0x2'));var moment=require(_0xb4b6('0x3'));var BPromise=require(_0xb4b6('0x4'));var Mustache=require(_0xb4b6('0x5'));var util=require(_0xb4b6('0x6'));var path=require(_0xb4b6('0x7'));var sox=require(_0xb4b6('0x8'));var csv=require('to-csv');var ejs=require(_0xb4b6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4b6('0xa'));var squel=require(_0xb4b6('0xb'));var crypto=require(_0xb4b6('0xc'));var jsforce=require(_0xb4b6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4b6('0xe'));var querystring=require(_0xb4b6('0xf'));var Papa=require(_0xb4b6('0x10'));var Redis=require(_0xb4b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb4b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4b6('0x13'));var logger=require(_0xb4b6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb4b6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4b6('0x16'))['db'];function respondWithStatusCode(_0x36e2b0,_0x236ea1){_0x236ea1=_0x236ea1||0xcc;return function(_0x4e45bf){if(_0x4e45bf){return _0x36e2b0[_0xb4b6('0x17')](_0x236ea1);}return _0x36e2b0['status'](_0x236ea1)[_0xb4b6('0x18')]();};}function respondWithResult(_0x11b83a,_0x1cdb54){_0x1cdb54=_0x1cdb54||0xc8;return function(_0x9979bc){if(_0x9979bc){return _0x11b83a[_0xb4b6('0x19')](_0x1cdb54)[_0xb4b6('0x1a')](_0x9979bc);}};}function respondWithFilteredResult(_0x4c4862,_0x2be105){return function(_0x760d23){if(_0x760d23){var _0x380db6=typeof _0x2be105[_0xb4b6('0x1b')]===_0xb4b6('0x1c')&&typeof _0x2be105['limit']===_0xb4b6('0x1c');var _0x2f517b=_0x760d23[_0xb4b6('0x1d')];var _0x47d623=_0x380db6?0x0:_0x2be105[_0xb4b6('0x1b')];var _0xf83736=_0x380db6?_0x760d23['count']:_0x2be105[_0xb4b6('0x1b')]+_0x2be105['limit'];var _0x49b55d;if(_0xf83736>=_0x2f517b){_0xf83736=_0x2f517b;_0x49b55d=0xc8;}else{_0x49b55d=0xce;}_0x4c4862[_0xb4b6('0x19')](_0x49b55d);return _0x4c4862[_0xb4b6('0x1e')](_0xb4b6('0x1f'),_0x47d623+'-'+_0xf83736+'/'+_0x2f517b)[_0xb4b6('0x1a')](_0x760d23);}return null;};}function patchUpdates(_0x23c5db){return function(_0x19f4bc){try{jsonpatch[_0xb4b6('0x20')](_0x19f4bc,_0x23c5db,!![]);}catch(_0x20ca77){return BPromise[_0xb4b6('0x21')](_0x20ca77);}return _0x19f4bc['save']();};}function saveUpdates(_0xeaa168,_0x5b6e4a){return function(_0x50f6e7){if(_0x50f6e7){return _0x50f6e7[_0xb4b6('0x22')](_0xeaa168)['then'](function(_0x477b1f){return _0x477b1f;});}return null;};}function removeEntity(_0x328a63,_0x1c4a14){return function(_0x252f0b){if(_0x252f0b){return _0x252f0b['destroy']()[_0xb4b6('0x23')](function(){_0x328a63['status'](0xcc)[_0xb4b6('0x18')]();});}};}function handleEntityNotFound(_0xfa7519,_0x230190){return function(_0x3b6ff5){if(!_0x3b6ff5){_0xfa7519[_0xb4b6('0x17')](0x194);}return _0x3b6ff5;};}function handleError(_0x28030d,_0x5526e6){_0x5526e6=_0x5526e6||0x1f4;return function(_0xd93776){logger[_0xb4b6('0x24')](_0xd93776[_0xb4b6('0x25')]);if(_0xd93776['name']){delete _0xd93776['name'];}_0x28030d[_0xb4b6('0x19')](_0x5526e6)['send'](_0xd93776);};}exports[_0xb4b6('0x26')]=function(_0x126dbb,_0x4c790c){var _0x5624a9={},_0x50dab2={},_0x4a6e15={'count':0x0,'rows':[]};var _0x149dda=_[_0xb4b6('0x27')](db[_0xb4b6('0x28')][_0xb4b6('0x29')],function(_0xe0793b){return{'name':_0xe0793b[_0xb4b6('0x2a')],'type':_0xe0793b[_0xb4b6('0x2b')][_0xb4b6('0x2c')]};});_0x50dab2['model']=_[_0xb4b6('0x27')](_0x149dda,_0xb4b6('0x2d'));_0x50dab2['query']=_[_0xb4b6('0x2e')](_0x126dbb[_0xb4b6('0x2f')]);_0x50dab2['filters']=_['intersection'](_0x50dab2[_0xb4b6('0x30')],_0x50dab2[_0xb4b6('0x2f')]);_0x5624a9[_0xb4b6('0x31')]=_[_0xb4b6('0x32')](_0x50dab2[_0xb4b6('0x30')],qs[_0xb4b6('0x33')](_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x33')]));_0x5624a9[_0xb4b6('0x31')]=_0x5624a9[_0xb4b6('0x31')][_0xb4b6('0x34')]?_0x5624a9[_0xb4b6('0x31')]:_0x50dab2[_0xb4b6('0x30')];if(!_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x35')]('nolimit')){_0x5624a9[_0xb4b6('0x36')]=qs['limit'](_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x36')]);_0x5624a9['offset']=qs['offset'](_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x1b')]);}_0x5624a9[_0xb4b6('0x37')]=qs[_0xb4b6('0x38')](_0x126dbb['query']['sort']);_0x5624a9[_0xb4b6('0x39')]=qs[_0xb4b6('0x3a')](_[_0xb4b6('0x3b')](_0x126dbb[_0xb4b6('0x2f')],_0x50dab2[_0xb4b6('0x3a')]),_0x149dda);if(_0x126dbb['query']['filter']){_0x5624a9[_0xb4b6('0x39')]=_[_0xb4b6('0x3c')](_0x5624a9[_0xb4b6('0x39')],{'$or':_[_0xb4b6('0x27')](_0x149dda,function(_0x3c3845){if(_0x3c3845[_0xb4b6('0x2b')]!==_0xb4b6('0x3d')){var _0x54b645={};_0x54b645[_0x3c3845[_0xb4b6('0x2d')]]={'$like':'%'+_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x3e')]+'%'};return _0x54b645;}})});}_0x5624a9=_[_0xb4b6('0x3c')]({},_0x5624a9,_0x126dbb[_0xb4b6('0x3f')]);var _0x1abf3a={'where':_0x5624a9['where']};return db['ServicenowConfiguration'][_0xb4b6('0x1d')](_0x1abf3a)[_0xb4b6('0x23')](function(_0x52aa66){_0x4a6e15['count']=_0x52aa66;if(_0x126dbb[_0xb4b6('0x2f')][_0xb4b6('0x40')]){_0x5624a9[_0xb4b6('0x41')]=[{'all':!![]}];}return db[_0xb4b6('0x28')][_0xb4b6('0x42')](_0x5624a9);})[_0xb4b6('0x23')](function(_0x107b3b){_0x4a6e15[_0xb4b6('0x43')]=_0x107b3b;return _0x4a6e15;})[_0xb4b6('0x23')](respondWithFilteredResult(_0x4c790c,_0x5624a9))[_0xb4b6('0x44')](handleError(_0x4c790c,null));};exports[_0xb4b6('0x45')]=function(_0x50fc75,_0x2d9653){var _0x2f2b49={'raw':![],'where':{'id':_0x50fc75[_0xb4b6('0x46')]['id']}},_0x1b6434={};_0x1b6434[_0xb4b6('0x30')]=_[_0xb4b6('0x2e')](db['ServicenowConfiguration'][_0xb4b6('0x29')]);_0x1b6434[_0xb4b6('0x2f')]=_[_0xb4b6('0x2e')](_0x50fc75[_0xb4b6('0x2f')]);_0x1b6434['filters']=_['intersection'](_0x1b6434[_0xb4b6('0x30')],_0x1b6434[_0xb4b6('0x2f')]);_0x2f2b49[_0xb4b6('0x31')]=_[_0xb4b6('0x32')](_0x1b6434[_0xb4b6('0x30')],qs[_0xb4b6('0x33')](_0x50fc75[_0xb4b6('0x2f')]['fields']));_0x2f2b49[_0xb4b6('0x31')]=_0x2f2b49[_0xb4b6('0x31')][_0xb4b6('0x34')]?_0x2f2b49[_0xb4b6('0x31')]:_0x1b6434[_0xb4b6('0x30')];if(_0x50fc75['query'][_0xb4b6('0x40')]){_0x2f2b49[_0xb4b6('0x41')]=[{'all':!![]}];}_0x2f2b49=_['merge']({},_0x2f2b49,_0x50fc75[_0xb4b6('0x3f')]);return db[_0xb4b6('0x28')]['find'](_0x2f2b49)[_0xb4b6('0x23')](handleEntityNotFound(_0x2d9653,null))[_0xb4b6('0x23')](respondWithResult(_0x2d9653,null))[_0xb4b6('0x44')](handleError(_0x2d9653,null));};exports[_0xb4b6('0x47')]=function(_0x105b25,_0x1e4a85){return db[_0xb4b6('0x28')][_0xb4b6('0x47')](_0x105b25[_0xb4b6('0x48')],{})[_0xb4b6('0x23')](respondWithResult(_0x1e4a85,0xc9))[_0xb4b6('0x44')](handleError(_0x1e4a85,null));};exports[_0xb4b6('0x22')]=function(_0x133155,_0x466b5d){if(_0x133155['body']['id']){delete _0x133155[_0xb4b6('0x48')]['id'];}return db[_0xb4b6('0x28')][_0xb4b6('0x49')]({'where':{'id':_0x133155[_0xb4b6('0x46')]['id']}})[_0xb4b6('0x23')](handleEntityNotFound(_0x466b5d,null))[_0xb4b6('0x23')](saveUpdates(_0x133155[_0xb4b6('0x48')],null))[_0xb4b6('0x23')](respondWithResult(_0x466b5d,null))[_0xb4b6('0x44')](handleError(_0x466b5d,null));};exports['destroy']=function(_0x3caca0,_0x4ef029){return db['ServicenowConfiguration'][_0xb4b6('0x49')]({'where':{'id':_0x3caca0[_0xb4b6('0x46')]['id']}})[_0xb4b6('0x23')](handleEntityNotFound(_0x4ef029,null))[_0xb4b6('0x23')](removeEntity(_0x4ef029,null))['catch'](handleError(_0x4ef029,null));};exports[_0xb4b6('0x4a')]=function(_0x44a699,_0x4c2964,_0x5d4ba6){var _0x31a37a={};var _0x114b3a={};var _0x368ae9;var _0x24d4f2;return db[_0xb4b6('0x28')][_0xb4b6('0x4b')]({'where':{'id':_0x44a699[_0xb4b6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c2964,null))[_0xb4b6('0x23')](function(_0x364a07){if(_0x364a07){_0x368ae9=_0x364a07;_0x114b3a[_0xb4b6('0x30')]=_[_0xb4b6('0x2e')](db['ServicenowField'][_0xb4b6('0x29')]);_0x114b3a[_0xb4b6('0x2f')]=_['keys'](_0x44a699[_0xb4b6('0x2f')]);_0x114b3a['filters']=_[_0xb4b6('0x32')](_0x114b3a[_0xb4b6('0x30')],_0x114b3a[_0xb4b6('0x2f')]);_0x31a37a[_0xb4b6('0x31')]=_[_0xb4b6('0x32')](_0x114b3a[_0xb4b6('0x30')],qs[_0xb4b6('0x33')](_0x44a699[_0xb4b6('0x2f')][_0xb4b6('0x33')]));_0x31a37a[_0xb4b6('0x31')]=_0x31a37a[_0xb4b6('0x31')][_0xb4b6('0x34')]?_0x31a37a[_0xb4b6('0x31')]:_0x114b3a[_0xb4b6('0x30')];_0x31a37a[_0xb4b6('0x37')]=qs[_0xb4b6('0x38')](_0x44a699['query']['sort']);_0x31a37a[_0xb4b6('0x39')]=qs['filters'](_[_0xb4b6('0x3b')](_0x44a699[_0xb4b6('0x2f')],_0x114b3a[_0xb4b6('0x3a')]));if(_0x44a699['query'][_0xb4b6('0x3e')]){_0x31a37a[_0xb4b6('0x39')]=_['merge'](_0x31a37a['where'],{'$or':_['map'](_0x31a37a[_0xb4b6('0x31')],function(_0x5c856e){var _0x419bd7={};_0x419bd7[_0x5c856e]={'$like':'%'+_0x44a699[_0xb4b6('0x2f')][_0xb4b6('0x3e')]+'%'};return _0x419bd7;})});}_0x31a37a=_[_0xb4b6('0x3c')]({},_0x31a37a,_0x44a699[_0xb4b6('0x3f')]);return _0x368ae9[_0xb4b6('0x4a')](_0x31a37a);}})['then'](function(_0x1894a0){if(_0x1894a0){_0x24d4f2=_0x1894a0[_0xb4b6('0x34')];if(!_0x44a699[_0xb4b6('0x2f')][_0xb4b6('0x35')](_0xb4b6('0x4c'))){_0x31a37a[_0xb4b6('0x36')]=qs[_0xb4b6('0x36')](_0x44a699[_0xb4b6('0x2f')][_0xb4b6('0x36')]);_0x31a37a[_0xb4b6('0x1b')]=qs['offset'](_0x44a699['query'][_0xb4b6('0x1b')]);}return _0x368ae9['getFields'](_0x31a37a);}})[_0xb4b6('0x23')](function(_0x53427d){if(_0x53427d){return _0x53427d?{'count':_0x24d4f2,'rows':_0x53427d}:null;}})[_0xb4b6('0x23')](respondWithResult(_0x4c2964,null))[_0xb4b6('0x44')](handleError(_0x4c2964,null));};exports[_0xb4b6('0x4d')]=function(_0x214f24,_0xdaea6a,_0x5baa91){var _0x4efb5c={};var _0x57a202={};var _0x22a296;var _0x30143a;return db[_0xb4b6('0x28')][_0xb4b6('0x4b')]({'where':{'id':_0x214f24[_0xb4b6('0x46')]['id']}})['then'](handleEntityNotFound(_0xdaea6a,null))[_0xb4b6('0x23')](function(_0x5adde7){if(_0x5adde7){_0x22a296=_0x5adde7;_0x57a202[_0xb4b6('0x30')]=_['keys'](db[_0xb4b6('0x4e')]['rawAttributes']);_0x57a202['query']=_['keys'](_0x214f24['query']);_0x57a202[_0xb4b6('0x3a')]=_[_0xb4b6('0x32')](_0x57a202[_0xb4b6('0x30')],_0x57a202[_0xb4b6('0x2f')]);_0x4efb5c['attributes']=_[_0xb4b6('0x32')](_0x57a202[_0xb4b6('0x30')],qs[_0xb4b6('0x33')](_0x214f24['query']['fields']));_0x4efb5c[_0xb4b6('0x31')]=_0x4efb5c[_0xb4b6('0x31')]['length']?_0x4efb5c[_0xb4b6('0x31')]:_0x57a202[_0xb4b6('0x30')];_0x4efb5c[_0xb4b6('0x37')]=qs[_0xb4b6('0x38')](_0x214f24[_0xb4b6('0x2f')][_0xb4b6('0x38')]);_0x4efb5c[_0xb4b6('0x39')]=qs['filters'](_[_0xb4b6('0x3b')](_0x214f24[_0xb4b6('0x2f')],_0x57a202['filters']));if(_0x214f24[_0xb4b6('0x2f')]['filter']){_0x4efb5c[_0xb4b6('0x39')]=_[_0xb4b6('0x3c')](_0x4efb5c['where'],{'$or':_[_0xb4b6('0x27')](_0x4efb5c['attributes'],function(_0xb03d47){var _0x456a96={};_0x456a96[_0xb03d47]={'$like':'%'+_0x214f24['query'][_0xb4b6('0x3e')]+'%'};return _0x456a96;})});}_0x4efb5c=_[_0xb4b6('0x3c')]({},_0x4efb5c,_0x214f24[_0xb4b6('0x3f')]);return _0x22a296[_0xb4b6('0x4d')](_0x4efb5c);}})[_0xb4b6('0x23')](function(_0x52e634){if(_0x52e634){_0x30143a=_0x52e634[_0xb4b6('0x34')];if(!_0x214f24[_0xb4b6('0x2f')][_0xb4b6('0x35')](_0xb4b6('0x4c'))){_0x4efb5c[_0xb4b6('0x36')]=qs[_0xb4b6('0x36')](_0x214f24[_0xb4b6('0x2f')][_0xb4b6('0x36')]);_0x4efb5c['offset']=qs[_0xb4b6('0x1b')](_0x214f24[_0xb4b6('0x2f')]['offset']);}return _0x22a296[_0xb4b6('0x4d')](_0x4efb5c);}})[_0xb4b6('0x23')](function(_0x14179d){if(_0x14179d){return _0x14179d?{'count':_0x30143a,'rows':_0x14179d}:null;}})['then'](respondWithResult(_0xdaea6a,null))[_0xb4b6('0x44')](handleError(_0xdaea6a,null));};exports[_0xb4b6('0x4f')]=function(_0x532af3,_0x25a040,_0x3795e0){var _0x2a973d={};var _0x113510={};var _0x54f0c9;var _0x53e25b;return db[_0xb4b6('0x28')][_0xb4b6('0x4b')]({'where':{'id':_0x532af3[_0xb4b6('0x46')]['id']}})[_0xb4b6('0x23')](handleEntityNotFound(_0x25a040,null))[_0xb4b6('0x23')](function(_0x33c8e9){if(_0x33c8e9){_0x54f0c9=_0x33c8e9;_0x113510[_0xb4b6('0x30')]=_['keys'](db[_0xb4b6('0x4e')][_0xb4b6('0x29')]);_0x113510['query']=_['keys'](_0x532af3[_0xb4b6('0x2f')]);_0x113510['filters']=_[_0xb4b6('0x32')](_0x113510[_0xb4b6('0x30')],_0x113510[_0xb4b6('0x2f')]);_0x2a973d[_0xb4b6('0x31')]=_[_0xb4b6('0x32')](_0x113510['model'],qs[_0xb4b6('0x33')](_0x532af3['query'][_0xb4b6('0x33')]));_0x2a973d[_0xb4b6('0x31')]=_0x2a973d[_0xb4b6('0x31')]['length']?_0x2a973d['attributes']:_0x113510[_0xb4b6('0x30')];_0x2a973d[_0xb4b6('0x37')]=qs['sort'](_0x532af3['query'][_0xb4b6('0x38')]);_0x2a973d[_0xb4b6('0x39')]=qs['filters'](_[_0xb4b6('0x3b')](_0x532af3['query'],_0x113510['filters']));if(_0x532af3[_0xb4b6('0x2f')][_0xb4b6('0x3e')]){_0x2a973d['where']=_[_0xb4b6('0x3c')](_0x2a973d[_0xb4b6('0x39')],{'$or':_[_0xb4b6('0x27')](_0x2a973d[_0xb4b6('0x31')],function(_0x46aa07){var _0x528f27={};_0x528f27[_0x46aa07]={'$like':'%'+_0x532af3[_0xb4b6('0x2f')][_0xb4b6('0x3e')]+'%'};return _0x528f27;})});}_0x2a973d=_[_0xb4b6('0x3c')]({},_0x2a973d,_0x532af3[_0xb4b6('0x3f')]);return _0x54f0c9[_0xb4b6('0x4f')](_0x2a973d);}})[_0xb4b6('0x23')](function(_0x42932d){if(_0x42932d){_0x53e25b=_0x42932d['length'];if(!_0x532af3[_0xb4b6('0x2f')]['hasOwnProperty'](_0xb4b6('0x4c'))){_0x2a973d[_0xb4b6('0x36')]=qs[_0xb4b6('0x36')](_0x532af3['query'][_0xb4b6('0x36')]);_0x2a973d[_0xb4b6('0x1b')]=qs['offset'](_0x532af3[_0xb4b6('0x2f')]['offset']);}return _0x54f0c9[_0xb4b6('0x4f')](_0x2a973d);}})[_0xb4b6('0x23')](function(_0xde89a6){if(_0xde89a6){return _0xde89a6?{'count':_0x53e25b,'rows':_0xde89a6}:null;}})[_0xb4b6('0x23')](respondWithResult(_0x25a040,null))[_0xb4b6('0x44')](handleError(_0x25a040,null));}; \ No newline at end of file +var _0x2bcb=['undefined','limit','count','apply','reject','save','update','destroy','then','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','include','findAll','rows','params','keys','find','catch','create','body','getFields','findOne','order','pick','hasOwnProperty','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x205a6e,_0x571a14){var _0x43adb6=function(_0xb71d8b){while(--_0xb71d8b){_0x205a6e['push'](_0x205a6e['shift']());}};_0x43adb6(++_0x571a14);}(_0x2bcb,0x16a));var _0xb2bc=function(_0x122b82,_0x7f0e23){_0x122b82=_0x122b82-0x0;var _0x20ad2d=_0x2bcb[_0x122b82];return _0x20ad2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2bc('0x0'));var zipdir=require(_0xb2bc('0x1'));var jsonpatch=require(_0xb2bc('0x2'));var rp=require(_0xb2bc('0x3'));var moment=require(_0xb2bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb2bc('0x5'));var util=require(_0xb2bc('0x6'));var path=require('path');var sox=require(_0xb2bc('0x7'));var csv=require(_0xb2bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2bc('0x9'));var _=require(_0xb2bc('0xa'));var squel=require(_0xb2bc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb2bc('0xc'));var deskjs=require(_0xb2bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb2bc('0xe'));var Papa=require(_0xb2bc('0xf'));var Redis=require('ioredis');var authService=require(_0xb2bc('0x10'));var qs=require(_0xb2bc('0x11'));var as=require(_0xb2bc('0x12'));var hardwareService=require(_0xb2bc('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb2bc('0x14'));var licenseUtil=require(_0xb2bc('0x15'));var db=require(_0xb2bc('0x16'))['db'];function respondWithStatusCode(_0x5441ca,_0x3878d9){_0x3878d9=_0x3878d9||0xcc;return function(_0x2f66c9){if(_0x2f66c9){return _0x5441ca[_0xb2bc('0x17')](_0x3878d9);}return _0x5441ca['status'](_0x3878d9)[_0xb2bc('0x18')]();};}function respondWithResult(_0x458f95,_0x41835d){_0x41835d=_0x41835d||0xc8;return function(_0x10aa57){if(_0x10aa57){return _0x458f95[_0xb2bc('0x19')](_0x41835d)[_0xb2bc('0x1a')](_0x10aa57);}};}function respondWithFilteredResult(_0x5aa706,_0x2dbbd7){return function(_0x2c9d47){if(_0x2c9d47){var _0x207acc=typeof _0x2dbbd7[_0xb2bc('0x1b')]===_0xb2bc('0x1c')&&typeof _0x2dbbd7[_0xb2bc('0x1d')]===_0xb2bc('0x1c');var _0x76ba0d=_0x2c9d47[_0xb2bc('0x1e')];var _0x2ade3e=_0x207acc?0x0:_0x2dbbd7['offset'];var _0x57aa78=_0x207acc?_0x2c9d47[_0xb2bc('0x1e')]:_0x2dbbd7[_0xb2bc('0x1b')]+_0x2dbbd7[_0xb2bc('0x1d')];var _0x2ba866;if(_0x57aa78>=_0x76ba0d){_0x57aa78=_0x76ba0d;_0x2ba866=0xc8;}else{_0x2ba866=0xce;}_0x5aa706[_0xb2bc('0x19')](_0x2ba866);return _0x5aa706['set']('Content-Range',_0x2ade3e+'-'+_0x57aa78+'/'+_0x76ba0d)[_0xb2bc('0x1a')](_0x2c9d47);}return null;};}function patchUpdates(_0x5bc4d6){return function(_0x4aabb7){try{jsonpatch[_0xb2bc('0x1f')](_0x4aabb7,_0x5bc4d6,!![]);}catch(_0x2ff860){return BPromise[_0xb2bc('0x20')](_0x2ff860);}return _0x4aabb7[_0xb2bc('0x21')]();};}function saveUpdates(_0x3f4d13,_0x4bf784){return function(_0x384c93){if(_0x384c93){return _0x384c93[_0xb2bc('0x22')](_0x3f4d13)['then'](function(_0x191cdc){return _0x191cdc;});}return null;};}function removeEntity(_0x39afc7,_0x4ade04){return function(_0xf529bf){if(_0xf529bf){return _0xf529bf[_0xb2bc('0x23')]()[_0xb2bc('0x24')](function(){_0x39afc7['status'](0xcc)[_0xb2bc('0x18')]();});}};}function handleEntityNotFound(_0x1840af,_0x5a81c7){return function(_0x4ec561){if(!_0x4ec561){_0x1840af[_0xb2bc('0x17')](0x194);}return _0x4ec561;};}function handleError(_0x15dd55,_0x180db0){_0x180db0=_0x180db0||0x1f4;return function(_0x6dd0c2){logger['error'](_0x6dd0c2[_0xb2bc('0x25')]);if(_0x6dd0c2[_0xb2bc('0x26')]){delete _0x6dd0c2['name'];}_0x15dd55['status'](_0x180db0)['send'](_0x6dd0c2);};}exports[_0xb2bc('0x27')]=function(_0x16e561,_0x4bdfc1){var _0x314a2c={},_0xa24d81={},_0x5f28ed={'count':0x0,'rows':[]};var _0x402502=_['map'](db['ServicenowConfiguration'][_0xb2bc('0x28')],function(_0x5b3ec6){return{'name':_0x5b3ec6[_0xb2bc('0x29')],'type':_0x5b3ec6[_0xb2bc('0x2a')][_0xb2bc('0x2b')]};});_0xa24d81[_0xb2bc('0x2c')]=_[_0xb2bc('0x2d')](_0x402502,_0xb2bc('0x26'));_0xa24d81[_0xb2bc('0x2e')]=_['keys'](_0x16e561[_0xb2bc('0x2e')]);_0xa24d81[_0xb2bc('0x2f')]=_[_0xb2bc('0x30')](_0xa24d81[_0xb2bc('0x2c')],_0xa24d81[_0xb2bc('0x2e')]);_0x314a2c[_0xb2bc('0x31')]=_['intersection'](_0xa24d81[_0xb2bc('0x2c')],qs[_0xb2bc('0x32')](_0x16e561['query']['fields']));_0x314a2c['attributes']=_0x314a2c['attributes'][_0xb2bc('0x33')]?_0x314a2c['attributes']:_0xa24d81[_0xb2bc('0x2c')];if(!_0x16e561[_0xb2bc('0x2e')]['hasOwnProperty'](_0xb2bc('0x34'))){_0x314a2c['limit']=qs['limit'](_0x16e561['query'][_0xb2bc('0x1d')]);_0x314a2c[_0xb2bc('0x1b')]=qs[_0xb2bc('0x1b')](_0x16e561[_0xb2bc('0x2e')][_0xb2bc('0x1b')]);}_0x314a2c['order']=qs[_0xb2bc('0x35')](_0x16e561[_0xb2bc('0x2e')][_0xb2bc('0x35')]);_0x314a2c[_0xb2bc('0x36')]=qs[_0xb2bc('0x2f')](_['pick'](_0x16e561[_0xb2bc('0x2e')],_0xa24d81[_0xb2bc('0x2f')]),_0x402502);if(_0x16e561['query']['filter']){_0x314a2c['where']=_[_0xb2bc('0x37')](_0x314a2c['where'],{'$or':_[_0xb2bc('0x2d')](_0x402502,function(_0x3bd575){if(_0x3bd575[_0xb2bc('0x2a')]!==_0xb2bc('0x38')){var _0x493e98={};_0x493e98[_0x3bd575['name']]={'$like':'%'+_0x16e561[_0xb2bc('0x2e')][_0xb2bc('0x39')]+'%'};return _0x493e98;}})});}_0x314a2c=_[_0xb2bc('0x37')]({},_0x314a2c,_0x16e561[_0xb2bc('0x3a')]);var _0x2d487c={'where':_0x314a2c[_0xb2bc('0x36')]};return db[_0xb2bc('0x3b')][_0xb2bc('0x1e')](_0x2d487c)[_0xb2bc('0x24')](function(_0x543f71){_0x5f28ed['count']=_0x543f71;if(_0x16e561[_0xb2bc('0x2e')][_0xb2bc('0x3c')]){_0x314a2c[_0xb2bc('0x3d')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xb2bc('0x3e')](_0x314a2c);})[_0xb2bc('0x24')](function(_0x1c42e8){_0x5f28ed[_0xb2bc('0x3f')]=_0x1c42e8;return _0x5f28ed;})[_0xb2bc('0x24')](respondWithFilteredResult(_0x4bdfc1,_0x314a2c))['catch'](handleError(_0x4bdfc1,null));};exports['show']=function(_0x320439,_0x3688bf){var _0x3efcf1={'raw':![],'where':{'id':_0x320439[_0xb2bc('0x40')]['id']}},_0x3ecb00={};_0x3ecb00['model']=_[_0xb2bc('0x41')](db[_0xb2bc('0x3b')]['rawAttributes']);_0x3ecb00[_0xb2bc('0x2e')]=_[_0xb2bc('0x41')](_0x320439[_0xb2bc('0x2e')]);_0x3ecb00[_0xb2bc('0x2f')]=_['intersection'](_0x3ecb00['model'],_0x3ecb00['query']);_0x3efcf1[_0xb2bc('0x31')]=_['intersection'](_0x3ecb00['model'],qs[_0xb2bc('0x32')](_0x320439[_0xb2bc('0x2e')]['fields']));_0x3efcf1[_0xb2bc('0x31')]=_0x3efcf1[_0xb2bc('0x31')][_0xb2bc('0x33')]?_0x3efcf1[_0xb2bc('0x31')]:_0x3ecb00[_0xb2bc('0x2c')];if(_0x320439['query'][_0xb2bc('0x3c')]){_0x3efcf1[_0xb2bc('0x3d')]=[{'all':!![]}];}_0x3efcf1=_[_0xb2bc('0x37')]({},_0x3efcf1,_0x320439[_0xb2bc('0x3a')]);return db[_0xb2bc('0x3b')][_0xb2bc('0x42')](_0x3efcf1)[_0xb2bc('0x24')](handleEntityNotFound(_0x3688bf,null))[_0xb2bc('0x24')](respondWithResult(_0x3688bf,null))[_0xb2bc('0x43')](handleError(_0x3688bf,null));};exports[_0xb2bc('0x44')]=function(_0x409a52,_0xa5dd13){return db[_0xb2bc('0x3b')][_0xb2bc('0x44')](_0x409a52[_0xb2bc('0x45')],{})[_0xb2bc('0x24')](respondWithResult(_0xa5dd13,0xc9))[_0xb2bc('0x43')](handleError(_0xa5dd13,null));};exports[_0xb2bc('0x22')]=function(_0x420566,_0x17d83b){if(_0x420566[_0xb2bc('0x45')]['id']){delete _0x420566[_0xb2bc('0x45')]['id'];}return db[_0xb2bc('0x3b')][_0xb2bc('0x42')]({'where':{'id':_0x420566[_0xb2bc('0x40')]['id']}})['then'](handleEntityNotFound(_0x17d83b,null))[_0xb2bc('0x24')](saveUpdates(_0x420566[_0xb2bc('0x45')],null))[_0xb2bc('0x24')](respondWithResult(_0x17d83b,null))['catch'](handleError(_0x17d83b,null));};exports['destroy']=function(_0x35abd2,_0xfdc57a){return db['ServicenowConfiguration'][_0xb2bc('0x42')]({'where':{'id':_0x35abd2[_0xb2bc('0x40')]['id']}})[_0xb2bc('0x24')](handleEntityNotFound(_0xfdc57a,null))['then'](removeEntity(_0xfdc57a,null))['catch'](handleError(_0xfdc57a,null));};exports[_0xb2bc('0x46')]=function(_0x21f2dc,_0x52ac31,_0x3c155b){var _0x221556={};var _0x4f56d0={};var _0x413836;var _0x52b8fa;return db[_0xb2bc('0x3b')][_0xb2bc('0x47')]({'where':{'id':_0x21f2dc[_0xb2bc('0x40')]['id']}})['then'](handleEntityNotFound(_0x52ac31,null))[_0xb2bc('0x24')](function(_0x18931c){if(_0x18931c){_0x413836=_0x18931c;_0x4f56d0[_0xb2bc('0x2c')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x4f56d0['query']=_[_0xb2bc('0x41')](_0x21f2dc[_0xb2bc('0x2e')]);_0x4f56d0[_0xb2bc('0x2f')]=_['intersection'](_0x4f56d0[_0xb2bc('0x2c')],_0x4f56d0[_0xb2bc('0x2e')]);_0x221556[_0xb2bc('0x31')]=_[_0xb2bc('0x30')](_0x4f56d0[_0xb2bc('0x2c')],qs[_0xb2bc('0x32')](_0x21f2dc['query'][_0xb2bc('0x32')]));_0x221556['attributes']=_0x221556[_0xb2bc('0x31')][_0xb2bc('0x33')]?_0x221556[_0xb2bc('0x31')]:_0x4f56d0[_0xb2bc('0x2c')];_0x221556[_0xb2bc('0x48')]=qs['sort'](_0x21f2dc['query'][_0xb2bc('0x35')]);_0x221556[_0xb2bc('0x36')]=qs[_0xb2bc('0x2f')](_[_0xb2bc('0x49')](_0x21f2dc[_0xb2bc('0x2e')],_0x4f56d0['filters']));if(_0x21f2dc['query'][_0xb2bc('0x39')]){_0x221556[_0xb2bc('0x36')]=_[_0xb2bc('0x37')](_0x221556['where'],{'$or':_['map'](_0x221556[_0xb2bc('0x31')],function(_0x34d179){var _0x31eb22={};_0x31eb22[_0x34d179]={'$like':'%'+_0x21f2dc[_0xb2bc('0x2e')][_0xb2bc('0x39')]+'%'};return _0x31eb22;})});}_0x221556=_['merge']({},_0x221556,_0x21f2dc[_0xb2bc('0x3a')]);return _0x413836['getFields'](_0x221556);}})['then'](function(_0x475ab8){if(_0x475ab8){_0x52b8fa=_0x475ab8[_0xb2bc('0x33')];if(!_0x21f2dc['query'][_0xb2bc('0x4a')]('nolimit')){_0x221556[_0xb2bc('0x1d')]=qs[_0xb2bc('0x1d')](_0x21f2dc[_0xb2bc('0x2e')][_0xb2bc('0x1d')]);_0x221556[_0xb2bc('0x1b')]=qs[_0xb2bc('0x1b')](_0x21f2dc['query'][_0xb2bc('0x1b')]);}return _0x413836['getFields'](_0x221556);}})[_0xb2bc('0x24')](function(_0x483c9e){if(_0x483c9e){return _0x483c9e?{'count':_0x52b8fa,'rows':_0x483c9e}:null;}})[_0xb2bc('0x24')](respondWithResult(_0x52ac31,null))[_0xb2bc('0x43')](handleError(_0x52ac31,null));};exports['getSubjects']=function(_0x45c2fc,_0x30e02f,_0x1d18c9){var _0x178757={};var _0x4b9364={};var _0x467c1b;var _0x5f2c2f;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x45c2fc[_0xb2bc('0x40')]['id']}})[_0xb2bc('0x24')](handleEntityNotFound(_0x30e02f,null))[_0xb2bc('0x24')](function(_0x483371){if(_0x483371){_0x467c1b=_0x483371;_0x4b9364[_0xb2bc('0x2c')]=_['keys'](db[_0xb2bc('0x4b')][_0xb2bc('0x28')]);_0x4b9364[_0xb2bc('0x2e')]=_[_0xb2bc('0x41')](_0x45c2fc[_0xb2bc('0x2e')]);_0x4b9364[_0xb2bc('0x2f')]=_[_0xb2bc('0x30')](_0x4b9364['model'],_0x4b9364[_0xb2bc('0x2e')]);_0x178757[_0xb2bc('0x31')]=_[_0xb2bc('0x30')](_0x4b9364[_0xb2bc('0x2c')],qs[_0xb2bc('0x32')](_0x45c2fc[_0xb2bc('0x2e')]['fields']));_0x178757[_0xb2bc('0x31')]=_0x178757[_0xb2bc('0x31')][_0xb2bc('0x33')]?_0x178757[_0xb2bc('0x31')]:_0x4b9364[_0xb2bc('0x2c')];_0x178757['order']=qs[_0xb2bc('0x35')](_0x45c2fc[_0xb2bc('0x2e')][_0xb2bc('0x35')]);_0x178757[_0xb2bc('0x36')]=qs['filters'](_[_0xb2bc('0x49')](_0x45c2fc[_0xb2bc('0x2e')],_0x4b9364[_0xb2bc('0x2f')]));if(_0x45c2fc[_0xb2bc('0x2e')][_0xb2bc('0x39')]){_0x178757['where']=_[_0xb2bc('0x37')](_0x178757[_0xb2bc('0x36')],{'$or':_[_0xb2bc('0x2d')](_0x178757['attributes'],function(_0x71a06){var _0x1df42f={};_0x1df42f[_0x71a06]={'$like':'%'+_0x45c2fc[_0xb2bc('0x2e')][_0xb2bc('0x39')]+'%'};return _0x1df42f;})});}_0x178757=_['merge']({},_0x178757,_0x45c2fc[_0xb2bc('0x3a')]);return _0x467c1b[_0xb2bc('0x4c')](_0x178757);}})[_0xb2bc('0x24')](function(_0x3295bb){if(_0x3295bb){_0x5f2c2f=_0x3295bb[_0xb2bc('0x33')];if(!_0x45c2fc[_0xb2bc('0x2e')][_0xb2bc('0x4a')](_0xb2bc('0x34'))){_0x178757[_0xb2bc('0x1d')]=qs[_0xb2bc('0x1d')](_0x45c2fc[_0xb2bc('0x2e')]['limit']);_0x178757[_0xb2bc('0x1b')]=qs[_0xb2bc('0x1b')](_0x45c2fc[_0xb2bc('0x2e')][_0xb2bc('0x1b')]);}return _0x467c1b[_0xb2bc('0x4c')](_0x178757);}})[_0xb2bc('0x24')](function(_0x55d542){if(_0x55d542){return _0x55d542?{'count':_0x5f2c2f,'rows':_0x55d542}:null;}})[_0xb2bc('0x24')](respondWithResult(_0x30e02f,null))['catch'](handleError(_0x30e02f,null));};exports[_0xb2bc('0x4d')]=function(_0x11867a,_0x117516,_0x41dda3){var _0x1e4634={};var _0x3e83f1={};var _0x471873;var _0x581e72;return db[_0xb2bc('0x3b')][_0xb2bc('0x47')]({'where':{'id':_0x11867a[_0xb2bc('0x40')]['id']}})[_0xb2bc('0x24')](handleEntityNotFound(_0x117516,null))[_0xb2bc('0x24')](function(_0x39bcd8){if(_0x39bcd8){_0x471873=_0x39bcd8;_0x3e83f1[_0xb2bc('0x2c')]=_[_0xb2bc('0x41')](db['ServicenowField'][_0xb2bc('0x28')]);_0x3e83f1[_0xb2bc('0x2e')]=_['keys'](_0x11867a['query']);_0x3e83f1[_0xb2bc('0x2f')]=_[_0xb2bc('0x30')](_0x3e83f1['model'],_0x3e83f1[_0xb2bc('0x2e')]);_0x1e4634[_0xb2bc('0x31')]=_['intersection'](_0x3e83f1[_0xb2bc('0x2c')],qs[_0xb2bc('0x32')](_0x11867a[_0xb2bc('0x2e')][_0xb2bc('0x32')]));_0x1e4634[_0xb2bc('0x31')]=_0x1e4634[_0xb2bc('0x31')][_0xb2bc('0x33')]?_0x1e4634[_0xb2bc('0x31')]:_0x3e83f1[_0xb2bc('0x2c')];_0x1e4634[_0xb2bc('0x48')]=qs[_0xb2bc('0x35')](_0x11867a[_0xb2bc('0x2e')][_0xb2bc('0x35')]);_0x1e4634[_0xb2bc('0x36')]=qs[_0xb2bc('0x2f')](_[_0xb2bc('0x49')](_0x11867a['query'],_0x3e83f1[_0xb2bc('0x2f')]));if(_0x11867a[_0xb2bc('0x2e')][_0xb2bc('0x39')]){_0x1e4634[_0xb2bc('0x36')]=_[_0xb2bc('0x37')](_0x1e4634['where'],{'$or':_[_0xb2bc('0x2d')](_0x1e4634[_0xb2bc('0x31')],function(_0x459a50){var _0xd53741={};_0xd53741[_0x459a50]={'$like':'%'+_0x11867a['query'][_0xb2bc('0x39')]+'%'};return _0xd53741;})});}_0x1e4634=_[_0xb2bc('0x37')]({},_0x1e4634,_0x11867a[_0xb2bc('0x3a')]);return _0x471873['getDescriptions'](_0x1e4634);}})[_0xb2bc('0x24')](function(_0x59a4dd){if(_0x59a4dd){_0x581e72=_0x59a4dd[_0xb2bc('0x33')];if(!_0x11867a[_0xb2bc('0x2e')][_0xb2bc('0x4a')](_0xb2bc('0x34'))){_0x1e4634[_0xb2bc('0x1d')]=qs['limit'](_0x11867a[_0xb2bc('0x2e')]['limit']);_0x1e4634[_0xb2bc('0x1b')]=qs['offset'](_0x11867a[_0xb2bc('0x2e')][_0xb2bc('0x1b')]);}return _0x471873[_0xb2bc('0x4d')](_0x1e4634);}})['then'](function(_0x1728ec){if(_0x1728ec){return _0x1728ec?{'count':_0x581e72,'rows':_0x1728ec}:null;}})[_0xb2bc('0x24')](respondWithResult(_0x117516,null))[_0xb2bc('0x43')](handleError(_0x117516,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index aa2ae61..e0f9cf6 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 _0x4a1d=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x1352f0,_0x4cd565){var _0x1c2a82=function(_0x2a9b63){while(--_0x2a9b63){_0x1352f0['push'](_0x1352f0['shift']());}};_0x1c2a82(++_0x4cd565);}(_0x4a1d,0x77));var _0xd4a1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4a1d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var logger=require(_0xd4a1('0x2'))(_0xd4a1('0x3'));var moment=require(_0xd4a1('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4a1('0x5'));var fs=require('fs');var path=require(_0xd4a1('0x6'));var rimraf=require(_0xd4a1('0x7'));var config=require(_0xd4a1('0x8'));var attributes=require(_0xd4a1('0x9'));module[_0xd4a1('0xa')]=function(_0x11fa5c,_0x1855b7){return _0x11fa5c['define'](_0xd4a1('0xb'),attributes,{'tableName':_0xd4a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6b=['path','rimraf','../../config/environment','exports','ServicenowConfiguration','lodash','util','api','request-promise'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9e6b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'int_servicenow_configurations','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 4ab4bda..d755ab8 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 _0x15b8=['code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x15b8,0x69));var _0x815b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x15b8[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x815b('0x0'));var util=require(_0x815b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x815b('0x2'))(_0x815b('0x3'));var config=require(_0x815b('0x4'));var jayson=require(_0x815b('0x5'));var client=jayson[_0x815b('0x6')][_0x815b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e212d,_0x49fead,_0x1f3a6b){return new BPromise(function(_0x5945e7,_0x527d18){return client[_0x815b('0x8')](_0x3e212d,_0x1f3a6b)[_0x815b('0x9')](function(_0x1612bd){logger[_0x815b('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49fead,_0x815b('0xb'));logger[_0x815b('0xc')](_0x815b('0xd'),_0x49fead,_0x815b('0xb'),JSON['stringify'](_0x1612bd));if(_0x1612bd[_0x815b('0xe')]){if(_0x1612bd[_0x815b('0xe')][_0x815b('0xf')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49fead,_0x1612bd[_0x815b('0xe')][_0x815b('0x10')]);return _0x527d18(_0x1612bd['error']['message']);}logger[_0x815b('0xe')](_0x815b('0x11'),_0x49fead,_0x1612bd[_0x815b('0xe')]['message']);return _0x5945e7(_0x1612bd[_0x815b('0xe')][_0x815b('0x10')]);}else{logger[_0x815b('0xa')](_0x815b('0x11'),_0x49fead,_0x815b('0xb'));_0x5945e7(_0x1612bd[_0x815b('0x12')][_0x815b('0x10')]);}})[_0x815b('0x13')](function(_0x9b747f){logger['error'](_0x815b('0x11'),_0x49fead,_0x9b747f);_0x527d18(_0x9b747f);});});} \ No newline at end of file +var _0xd21f=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xd21f,0xf7));var _0xfd21=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0xd21f[_0x44cd28];return _0x39356e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd21('0x0'));var BPromise=require(_0xfd21('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd21('0x2'));var db=require(_0xfd21('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd21('0x4'))(_0xfd21('0x5'));var config=require(_0xfd21('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd21('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1507f1,_0x14b496,_0x23fc92){return new BPromise(function(_0x54088d,_0x22668a){return client[_0xfd21('0x8')](_0x1507f1,_0x23fc92)[_0xfd21('0x9')](function(_0x1e989c){logger[_0xfd21('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x14b496,_0xfd21('0xb'));logger[_0xfd21('0xc')](_0xfd21('0xd'),_0x14b496,_0xfd21('0xb'),JSON[_0xfd21('0xe')](_0x1e989c));if(_0x1e989c[_0xfd21('0xf')]){if(_0x1e989c[_0xfd21('0xf')]['code']===0x1f4){logger[_0xfd21('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x14b496,_0x1e989c[_0xfd21('0xf')]['message']);return _0x22668a(_0x1e989c['error']['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x14b496,_0x1e989c[_0xfd21('0xf')][_0xfd21('0x10')]);return _0x54088d(_0x1e989c['error'][_0xfd21('0x10')]);}else{logger['info'](_0xfd21('0x11'),_0x14b496,'request\x20sent');_0x54088d(_0x1e989c[_0xfd21('0x12')]['message']);}})['catch'](function(_0x2a4362){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x14b496,_0x2a4362);_0x22668a(_0x2a4362);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9d5aee5..db97c32 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 _0x285f=['./intServicenowField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xf9153d,_0x1a33ed){var _0x348313=function(_0x571b5e){while(--_0x571b5e){_0xf9153d['push'](_0xf9153d['shift']());}};_0x348313(++_0x1a33ed);}(_0x285f,0x102));var _0xf285=function(_0x9a10f7,_0x5b2f67){_0x9a10f7=_0x9a10f7-0x0;var _0xfb8f00=_0x285f[_0x9a10f7];return _0xfb8f00;};'use strict';var multer=require(_0xf285('0x0'));var util=require(_0xf285('0x1'));var path=require(_0xf285('0x2'));var timeout=require(_0xf285('0x3'));var express=require(_0xf285('0x4'));var router=express['Router']();var fs_extra=require(_0xf285('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf285('0x6'));var config=require(_0xf285('0x7'));var controller=require(_0xf285('0x8'));router[_0xf285('0x9')]('/',auth['isAuthenticated'](),controller[_0xf285('0xa')]);router[_0xf285('0x9')](_0xf285('0xb'),auth[_0xf285('0xc')](),controller[_0xf285('0xd')]);router['post']('/',auth[_0xf285('0xc')](),controller[_0xf285('0xe')]);router[_0xf285('0xf')](_0xf285('0xb'),auth[_0xf285('0xc')](),controller[_0xf285('0x10')]);router[_0xf285('0x11')](_0xf285('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf285('0x12')]=router; \ No newline at end of file +var _0x6363=['delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','show','create'];(function(_0x20fc62,_0x12c41b){var _0x81b57d=function(_0x200912){while(--_0x200912){_0x20fc62['push'](_0x20fc62['shift']());}};_0x81b57d(++_0x12c41b);}(_0x6363,0x1d2));var _0x3636=function(_0x1f3794,_0x560bb8){_0x1f3794=_0x1f3794-0x0;var _0xf4cea5=_0x6363[_0x1f3794];return _0xf4cea5;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3636('0x1'));var express=require(_0x3636('0x2'));var router=express['Router']();var fs_extra=require(_0x3636('0x3'));var auth=require(_0x3636('0x4'));var interaction=require(_0x3636('0x5'));var config=require(_0x3636('0x6'));var controller=require(_0x3636('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3636('0x8')]);router[_0x3636('0x9')](_0x3636('0xa'),auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router['post']('/',auth[_0x3636('0xb')](),controller[_0x3636('0xd')]);router['put']('/:id',auth[_0x3636('0xb')](),controller['update']);router[_0x3636('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3636('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d3b8ba7..3e249d3 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 _0xa812=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0xfd09ba,_0x168daa){var _0x545447=function(_0x59a090){while(--_0x59a090){_0xfd09ba['push'](_0xfd09ba['shift']());}};_0x545447(++_0x168daa);}(_0xa812,0x9f));var _0x2a81=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa812[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x2a81('0x0'));module[_0x2a81('0x1')]={'type':{'type':Sequelize[_0x2a81('0x2')](_0x2a81('0x3'),_0x2a81('0x4'),_0x2a81('0x5'),_0x2a81('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a81('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a81('0x2')](_0x2a81('0x3'),_0x2a81('0x4'),_0x2a81('0x5'))},'keyContent':{'type':Sequelize[_0x2a81('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2a81('0x7')]},'customField':{'type':Sequelize[_0x2a81('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a81('0x7')]}}; \ No newline at end of file +var _0x617a=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x207b53,_0x4e02dc){var _0x4519db=function(_0x6f9552){while(--_0x6f9552){_0x207b53['push'](_0x207b53['shift']());}};_0x4519db(++_0x4e02dc);}(_0x617a,0x184));var _0xa617=function(_0x36b0d7,_0x3044c7){_0x36b0d7=_0x36b0d7-0x0;var _0x3ec0c9=_0x617a[_0x36b0d7];return _0x3ec0c9;};'use strict';var Sequelize=require(_0xa617('0x0'));module['exports']={'type':{'type':Sequelize[_0xa617('0x1')]('string',_0xa617('0x2'),_0xa617('0x3'),_0xa617('0x4'),_0xa617('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa617('0x6')]},'keyType':{'type':Sequelize[_0xa617('0x1')](_0xa617('0x7'),'variable',_0xa617('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa617('0x6')]},'nameField':{'type':Sequelize[_0xa617('0x6')]},'customField':{'type':Sequelize[_0xa617('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa617('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e4c0fb7..033772b 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 _0x7e8f=['map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ServicenowField','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x7e8f,0x14d));var _0xf7e8=function(_0x4b75a9,_0x42d2f4){_0x4b75a9=_0x4b75a9-0x0;var _0x2f90b1=_0x7e8f[_0x4b75a9];return _0x2f90b1;};'use strict';var emlformat=require(_0xf7e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7e8('0x2'));var moment=require('moment');var BPromise=require(_0xf7e8('0x3'));var Mustache=require(_0xf7e8('0x4'));var util=require(_0xf7e8('0x5'));var path=require(_0xf7e8('0x6'));var sox=require(_0xf7e8('0x7'));var csv=require('to-csv');var ejs=require(_0xf7e8('0x8'));var fs=require('fs');var fs_extra=require(_0xf7e8('0x9'));var _=require('lodash');var squel=require(_0xf7e8('0xa'));var crypto=require(_0xf7e8('0xb'));var jsforce=require(_0xf7e8('0xc'));var deskjs=require(_0xf7e8('0xd'));var toCsv=require(_0xf7e8('0xe'));var querystring=require('querystring');var Papa=require(_0xf7e8('0xf'));var Redis=require(_0xf7e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf7e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7e8('0x12'));var logger=require('../../config/logger')(_0xf7e8('0x13'));var utils=require(_0xf7e8('0x14'));var config=require(_0xf7e8('0x15'));var licenseUtil=require(_0xf7e8('0x16'));var db=require(_0xf7e8('0x17'))['db'];function respondWithStatusCode(_0x3f0075,_0x15cef3){_0x15cef3=_0x15cef3||0xcc;return function(_0x1c044b){if(_0x1c044b){return _0x3f0075[_0xf7e8('0x18')](_0x15cef3);}return _0x3f0075[_0xf7e8('0x19')](_0x15cef3)[_0xf7e8('0x1a')]();};}function respondWithResult(_0x5bed33,_0x1de137){_0x1de137=_0x1de137||0xc8;return function(_0x5c7ea3){if(_0x5c7ea3){return _0x5bed33[_0xf7e8('0x19')](_0x1de137)[_0xf7e8('0x1b')](_0x5c7ea3);}};}function respondWithFilteredResult(_0x576f88,_0x638d6e){return function(_0x43f2ee){if(_0x43f2ee){var _0x2b8ebb=typeof _0x638d6e[_0xf7e8('0x1c')]==='undefined'&&typeof _0x638d6e['limit']===_0xf7e8('0x1d');var _0x14e3d9=_0x43f2ee[_0xf7e8('0x1e')];var _0x21f00d=_0x2b8ebb?0x0:_0x638d6e[_0xf7e8('0x1c')];var _0x37a253=_0x2b8ebb?_0x43f2ee[_0xf7e8('0x1e')]:_0x638d6e[_0xf7e8('0x1c')]+_0x638d6e[_0xf7e8('0x1f')];var _0x46da58;if(_0x37a253>=_0x14e3d9){_0x37a253=_0x14e3d9;_0x46da58=0xc8;}else{_0x46da58=0xce;}_0x576f88[_0xf7e8('0x19')](_0x46da58);return _0x576f88[_0xf7e8('0x20')](_0xf7e8('0x21'),_0x21f00d+'-'+_0x37a253+'/'+_0x14e3d9)[_0xf7e8('0x1b')](_0x43f2ee);}return null;};}function patchUpdates(_0xa3eef2){return function(_0x3d502b){try{jsonpatch[_0xf7e8('0x22')](_0x3d502b,_0xa3eef2,!![]);}catch(_0x520bfc){return BPromise[_0xf7e8('0x23')](_0x520bfc);}return _0x3d502b['save']();};}function saveUpdates(_0x2f0973,_0x5018ba){return function(_0x2c3aa5){if(_0x2c3aa5){return _0x2c3aa5[_0xf7e8('0x24')](_0x2f0973)[_0xf7e8('0x25')](function(_0x47d485){return _0x47d485;});}return null;};}function removeEntity(_0x8472c7,_0x4f55c0){return function(_0x243fc2){if(_0x243fc2){return _0x243fc2[_0xf7e8('0x26')]()[_0xf7e8('0x25')](function(){_0x8472c7['status'](0xcc)[_0xf7e8('0x1a')]();});}};}function handleEntityNotFound(_0x7cbffb,_0x33ce56){return function(_0x270892){if(!_0x270892){_0x7cbffb[_0xf7e8('0x18')](0x194);}return _0x270892;};}function handleError(_0x1a6ffe,_0x191e3b){_0x191e3b=_0x191e3b||0x1f4;return function(_0x5379c5){logger['error'](_0x5379c5[_0xf7e8('0x27')]);if(_0x5379c5[_0xf7e8('0x28')]){delete _0x5379c5[_0xf7e8('0x28')];}_0x1a6ffe[_0xf7e8('0x19')](_0x191e3b)['send'](_0x5379c5);};}exports[_0xf7e8('0x29')]=function(_0x537da1,_0x24e087){var _0x2fc2ba={},_0x30aa8e={},_0x1622e3={'count':0x0,'rows':[]};var _0x50274c=_[_0xf7e8('0x2a')](db['ServicenowField'][_0xf7e8('0x2b')],function(_0x33b89a){return{'name':_0x33b89a[_0xf7e8('0x2c')],'type':_0x33b89a[_0xf7e8('0x2d')][_0xf7e8('0x2e')]};});_0x30aa8e[_0xf7e8('0x2f')]=_['map'](_0x50274c,'name');_0x30aa8e['query']=_['keys'](_0x537da1[_0xf7e8('0x30')]);_0x30aa8e['filters']=_[_0xf7e8('0x31')](_0x30aa8e[_0xf7e8('0x2f')],_0x30aa8e[_0xf7e8('0x30')]);_0x2fc2ba[_0xf7e8('0x32')]=_[_0xf7e8('0x31')](_0x30aa8e[_0xf7e8('0x2f')],qs[_0xf7e8('0x33')](_0x537da1[_0xf7e8('0x30')][_0xf7e8('0x33')]));_0x2fc2ba[_0xf7e8('0x32')]=_0x2fc2ba[_0xf7e8('0x32')][_0xf7e8('0x34')]?_0x2fc2ba[_0xf7e8('0x32')]:_0x30aa8e[_0xf7e8('0x2f')];if(!_0x537da1[_0xf7e8('0x30')][_0xf7e8('0x35')]('nolimit')){_0x2fc2ba['limit']=qs[_0xf7e8('0x1f')](_0x537da1['query'][_0xf7e8('0x1f')]);_0x2fc2ba[_0xf7e8('0x1c')]=qs['offset'](_0x537da1[_0xf7e8('0x30')][_0xf7e8('0x1c')]);}_0x2fc2ba[_0xf7e8('0x36')]=qs['sort'](_0x537da1[_0xf7e8('0x30')][_0xf7e8('0x37')]);_0x2fc2ba[_0xf7e8('0x38')]=qs[_0xf7e8('0x39')](_[_0xf7e8('0x3a')](_0x537da1['query'],_0x30aa8e[_0xf7e8('0x39')]),_0x50274c);if(_0x537da1['query']['filter']){_0x2fc2ba['where']=_[_0xf7e8('0x3b')](_0x2fc2ba[_0xf7e8('0x38')],{'$or':_[_0xf7e8('0x2a')](_0x50274c,function(_0x33116a){if(_0x33116a[_0xf7e8('0x2d')]!==_0xf7e8('0x3c')){var _0x77f7a3={};_0x77f7a3[_0x33116a[_0xf7e8('0x28')]]={'$like':'%'+_0x537da1[_0xf7e8('0x30')][_0xf7e8('0x3d')]+'%'};return _0x77f7a3;}})});}_0x2fc2ba=_['merge']({},_0x2fc2ba,_0x537da1[_0xf7e8('0x3e')]);var _0x3a3a50={'where':_0x2fc2ba[_0xf7e8('0x38')]};return db[_0xf7e8('0x3f')][_0xf7e8('0x1e')](_0x3a3a50)[_0xf7e8('0x25')](function(_0x231e2d){_0x1622e3[_0xf7e8('0x1e')]=_0x231e2d;if(_0x537da1[_0xf7e8('0x30')]['includeAll']){_0x2fc2ba[_0xf7e8('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0xf7e8('0x41')](_0x2fc2ba);})[_0xf7e8('0x25')](function(_0x2e4f54){_0x1622e3[_0xf7e8('0x42')]=_0x2e4f54;return _0x1622e3;})[_0xf7e8('0x25')](respondWithFilteredResult(_0x24e087,_0x2fc2ba))[_0xf7e8('0x43')](handleError(_0x24e087,null));};exports[_0xf7e8('0x44')]=function(_0x5b1644,_0x197d05){var _0x2187c7={'raw':!![],'where':{'id':_0x5b1644[_0xf7e8('0x45')]['id']}},_0x1d9449={};_0x1d9449['model']=_['keys'](db['ServicenowField'][_0xf7e8('0x2b')]);_0x1d9449[_0xf7e8('0x30')]=_[_0xf7e8('0x46')](_0x5b1644[_0xf7e8('0x30')]);_0x1d9449['filters']=_['intersection'](_0x1d9449['model'],_0x1d9449[_0xf7e8('0x30')]);_0x2187c7[_0xf7e8('0x32')]=_[_0xf7e8('0x31')](_0x1d9449[_0xf7e8('0x2f')],qs[_0xf7e8('0x33')](_0x5b1644[_0xf7e8('0x30')][_0xf7e8('0x33')]));_0x2187c7['attributes']=_0x2187c7[_0xf7e8('0x32')]['length']?_0x2187c7[_0xf7e8('0x32')]:_0x1d9449[_0xf7e8('0x2f')];if(_0x5b1644[_0xf7e8('0x30')][_0xf7e8('0x47')]){_0x2187c7[_0xf7e8('0x40')]=[{'all':!![]}];}_0x2187c7=_[_0xf7e8('0x3b')]({},_0x2187c7,_0x5b1644[_0xf7e8('0x3e')]);return db[_0xf7e8('0x3f')][_0xf7e8('0x48')](_0x2187c7)[_0xf7e8('0x25')](handleEntityNotFound(_0x197d05,null))[_0xf7e8('0x25')](respondWithResult(_0x197d05,null))['catch'](handleError(_0x197d05,null));};exports[_0xf7e8('0x49')]=function(_0x241115,_0x5a4d6a){return db[_0xf7e8('0x3f')][_0xf7e8('0x49')](_0x241115['body'],{})[_0xf7e8('0x25')](respondWithResult(_0x5a4d6a,0xc9))[_0xf7e8('0x43')](handleError(_0x5a4d6a,null));};exports[_0xf7e8('0x24')]=function(_0x45cc09,_0x202d4e){if(_0x45cc09[_0xf7e8('0x4a')]['id']){delete _0x45cc09[_0xf7e8('0x4a')]['id'];}return db[_0xf7e8('0x3f')][_0xf7e8('0x48')]({'where':{'id':_0x45cc09[_0xf7e8('0x45')]['id']}})[_0xf7e8('0x25')](handleEntityNotFound(_0x202d4e,null))['then'](saveUpdates(_0x45cc09[_0xf7e8('0x4a')],null))['then'](respondWithResult(_0x202d4e,null))['catch'](handleError(_0x202d4e,null));};exports[_0xf7e8('0x26')]=function(_0x15bfea,_0x1ff6cf){return db[_0xf7e8('0x3f')]['find']({'where':{'id':_0x15bfea[_0xf7e8('0x45')]['id']}})[_0xf7e8('0x25')](handleEntityNotFound(_0x1ff6cf,null))[_0xf7e8('0x25')](removeEntity(_0x1ff6cf,null))['catch'](handleError(_0x1ff6cf,null));}; \ No newline at end of file +var _0x20cf=['eml-format','fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body'];(function(_0xddc709,_0x17b64c){var _0xa4af8e=function(_0x4abe98){while(--_0x4abe98){_0xddc709['push'](_0xddc709['shift']());}};_0xa4af8e(++_0x17b64c);}(_0x20cf,0xe7));var _0xf20c=function(_0x296431,_0x18bd9f){_0x296431=_0x296431-0x0;var _0x2cf5bb=_0x20cf[_0x296431];return _0x2cf5bb;};'use strict';var emlformat=require(_0xf20c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf20c('0x1'));var rp=require(_0xf20c('0x2'));var moment=require(_0xf20c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf20c('0x4'));var path=require(_0xf20c('0x5'));var sox=require(_0xf20c('0x6'));var csv=require(_0xf20c('0x7'));var ejs=require(_0xf20c('0x8'));var fs=require('fs');var fs_extra=require(_0xf20c('0x9'));var _=require(_0xf20c('0xa'));var squel=require(_0xf20c('0xb'));var crypto=require(_0xf20c('0xc'));var jsforce=require(_0xf20c('0xd'));var deskjs=require(_0xf20c('0xe'));var toCsv=require(_0xf20c('0x7'));var querystring=require(_0xf20c('0xf'));var Papa=require(_0xf20c('0x10'));var Redis=require(_0xf20c('0x11'));var authService=require(_0xf20c('0x12'));var qs=require(_0xf20c('0x13'));var as=require(_0xf20c('0x14'));var hardwareService=require(_0xf20c('0x15'));var logger=require(_0xf20c('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf20c('0x17'));var db=require(_0xf20c('0x18'))['db'];function respondWithStatusCode(_0x2045c6,_0x6d4b4d){_0x6d4b4d=_0x6d4b4d||0xcc;return function(_0x15770e){if(_0x15770e){return _0x2045c6[_0xf20c('0x19')](_0x6d4b4d);}return _0x2045c6['status'](_0x6d4b4d)[_0xf20c('0x1a')]();};}function respondWithResult(_0x15029c,_0xa1232f){_0xa1232f=_0xa1232f||0xc8;return function(_0x5cf15d){if(_0x5cf15d){return _0x15029c[_0xf20c('0x1b')](_0xa1232f)[_0xf20c('0x1c')](_0x5cf15d);}};}function respondWithFilteredResult(_0x2de73c,_0x1a1695){return function(_0x59d5b0){if(_0x59d5b0){var _0x23e900=typeof _0x1a1695['offset']==='undefined'&&typeof _0x1a1695['limit']===_0xf20c('0x1d');var _0x4c0e0d=_0x59d5b0[_0xf20c('0x1e')];var _0x21c4d2=_0x23e900?0x0:_0x1a1695[_0xf20c('0x1f')];var _0x20189d=_0x23e900?_0x59d5b0['count']:_0x1a1695[_0xf20c('0x1f')]+_0x1a1695[_0xf20c('0x20')];var _0x3d41c3;if(_0x20189d>=_0x4c0e0d){_0x20189d=_0x4c0e0d;_0x3d41c3=0xc8;}else{_0x3d41c3=0xce;}_0x2de73c['status'](_0x3d41c3);return _0x2de73c[_0xf20c('0x21')](_0xf20c('0x22'),_0x21c4d2+'-'+_0x20189d+'/'+_0x4c0e0d)['json'](_0x59d5b0);}return null;};}function patchUpdates(_0x41c8ad){return function(_0x3972f2){try{jsonpatch[_0xf20c('0x23')](_0x3972f2,_0x41c8ad,!![]);}catch(_0x2e70e0){return BPromise[_0xf20c('0x24')](_0x2e70e0);}return _0x3972f2[_0xf20c('0x25')]();};}function saveUpdates(_0x5dda0c,_0x444660){return function(_0x500224){if(_0x500224){return _0x500224[_0xf20c('0x26')](_0x5dda0c)[_0xf20c('0x27')](function(_0x48e87e){return _0x48e87e;});}return null;};}function removeEntity(_0x17c250,_0x292c99){return function(_0x4eedcf){if(_0x4eedcf){return _0x4eedcf[_0xf20c('0x28')]()[_0xf20c('0x27')](function(){_0x17c250[_0xf20c('0x1b')](0xcc)[_0xf20c('0x1a')]();});}};}function handleEntityNotFound(_0xbc0b4e,_0x3a0894){return function(_0x14baa8){if(!_0x14baa8){_0xbc0b4e['sendStatus'](0x194);}return _0x14baa8;};}function handleError(_0x354b4e,_0x4645f1){_0x4645f1=_0x4645f1||0x1f4;return function(_0x1b370c){logger[_0xf20c('0x29')](_0x1b370c[_0xf20c('0x2a')]);if(_0x1b370c[_0xf20c('0x2b')]){delete _0x1b370c[_0xf20c('0x2b')];}_0x354b4e[_0xf20c('0x1b')](_0x4645f1)[_0xf20c('0x2c')](_0x1b370c);};}exports[_0xf20c('0x2d')]=function(_0x41031f,_0x46b863){var _0x3d10fc={},_0xfa6a96={},_0x2dbbb5={'count':0x0,'rows':[]};var _0x36dc03=_[_0xf20c('0x2e')](db[_0xf20c('0x2f')]['rawAttributes'],function(_0xa3a6b6){return{'name':_0xa3a6b6['fieldName'],'type':_0xa3a6b6[_0xf20c('0x30')][_0xf20c('0x31')]};});_0xfa6a96['model']=_[_0xf20c('0x2e')](_0x36dc03,'name');_0xfa6a96[_0xf20c('0x32')]=_[_0xf20c('0x33')](_0x41031f[_0xf20c('0x32')]);_0xfa6a96[_0xf20c('0x34')]=_[_0xf20c('0x35')](_0xfa6a96[_0xf20c('0x36')],_0xfa6a96[_0xf20c('0x32')]);_0x3d10fc['attributes']=_[_0xf20c('0x35')](_0xfa6a96[_0xf20c('0x36')],qs[_0xf20c('0x37')](_0x41031f[_0xf20c('0x32')]['fields']));_0x3d10fc[_0xf20c('0x38')]=_0x3d10fc['attributes'][_0xf20c('0x39')]?_0x3d10fc[_0xf20c('0x38')]:_0xfa6a96[_0xf20c('0x36')];if(!_0x41031f[_0xf20c('0x32')][_0xf20c('0x3a')](_0xf20c('0x3b'))){_0x3d10fc[_0xf20c('0x20')]=qs['limit'](_0x41031f[_0xf20c('0x32')][_0xf20c('0x20')]);_0x3d10fc[_0xf20c('0x1f')]=qs['offset'](_0x41031f[_0xf20c('0x32')][_0xf20c('0x1f')]);}_0x3d10fc[_0xf20c('0x3c')]=qs[_0xf20c('0x3d')](_0x41031f['query'][_0xf20c('0x3d')]);_0x3d10fc[_0xf20c('0x3e')]=qs['filters'](_['pick'](_0x41031f[_0xf20c('0x32')],_0xfa6a96[_0xf20c('0x34')]),_0x36dc03);if(_0x41031f['query']['filter']){_0x3d10fc['where']=_['merge'](_0x3d10fc[_0xf20c('0x3e')],{'$or':_['map'](_0x36dc03,function(_0x4e1b71){if(_0x4e1b71[_0xf20c('0x30')]!==_0xf20c('0x3f')){var _0x1d43b0={};_0x1d43b0[_0x4e1b71[_0xf20c('0x2b')]]={'$like':'%'+_0x41031f['query'][_0xf20c('0x40')]+'%'};return _0x1d43b0;}})});}_0x3d10fc=_[_0xf20c('0x41')]({},_0x3d10fc,_0x41031f['options']);var _0x2a2bd1={'where':_0x3d10fc[_0xf20c('0x3e')]};return db[_0xf20c('0x2f')][_0xf20c('0x1e')](_0x2a2bd1)[_0xf20c('0x27')](function(_0x7078bb){_0x2dbbb5[_0xf20c('0x1e')]=_0x7078bb;if(_0x41031f[_0xf20c('0x32')][_0xf20c('0x42')]){_0x3d10fc[_0xf20c('0x43')]=[{'all':!![]}];}return db[_0xf20c('0x2f')][_0xf20c('0x44')](_0x3d10fc);})[_0xf20c('0x27')](function(_0xdbf964){_0x2dbbb5['rows']=_0xdbf964;return _0x2dbbb5;})[_0xf20c('0x27')](respondWithFilteredResult(_0x46b863,_0x3d10fc))[_0xf20c('0x45')](handleError(_0x46b863,null));};exports[_0xf20c('0x46')]=function(_0x3c305f,_0x43f780){var _0x3e2c9b={'raw':!![],'where':{'id':_0x3c305f[_0xf20c('0x47')]['id']}},_0x1a23ed={};_0x1a23ed[_0xf20c('0x36')]=_[_0xf20c('0x33')](db['ServicenowField'][_0xf20c('0x48')]);_0x1a23ed[_0xf20c('0x32')]=_[_0xf20c('0x33')](_0x3c305f['query']);_0x1a23ed[_0xf20c('0x34')]=_['intersection'](_0x1a23ed[_0xf20c('0x36')],_0x1a23ed[_0xf20c('0x32')]);_0x3e2c9b[_0xf20c('0x38')]=_[_0xf20c('0x35')](_0x1a23ed[_0xf20c('0x36')],qs[_0xf20c('0x37')](_0x3c305f[_0xf20c('0x32')][_0xf20c('0x37')]));_0x3e2c9b[_0xf20c('0x38')]=_0x3e2c9b['attributes'][_0xf20c('0x39')]?_0x3e2c9b[_0xf20c('0x38')]:_0x1a23ed[_0xf20c('0x36')];if(_0x3c305f[_0xf20c('0x32')][_0xf20c('0x42')]){_0x3e2c9b[_0xf20c('0x43')]=[{'all':!![]}];}_0x3e2c9b=_[_0xf20c('0x41')]({},_0x3e2c9b,_0x3c305f[_0xf20c('0x49')]);return db['ServicenowField'][_0xf20c('0x4a')](_0x3e2c9b)[_0xf20c('0x27')](handleEntityNotFound(_0x43f780,null))[_0xf20c('0x27')](respondWithResult(_0x43f780,null))[_0xf20c('0x45')](handleError(_0x43f780,null));};exports[_0xf20c('0x4b')]=function(_0x5c14bb,_0x2a35a6){return db[_0xf20c('0x2f')][_0xf20c('0x4b')](_0x5c14bb[_0xf20c('0x4c')],{})[_0xf20c('0x27')](respondWithResult(_0x2a35a6,0xc9))[_0xf20c('0x45')](handleError(_0x2a35a6,null));};exports[_0xf20c('0x26')]=function(_0x1fb6c0,_0x40a6d2){if(_0x1fb6c0['body']['id']){delete _0x1fb6c0['body']['id'];}return db['ServicenowField'][_0xf20c('0x4a')]({'where':{'id':_0x1fb6c0[_0xf20c('0x47')]['id']}})[_0xf20c('0x27')](handleEntityNotFound(_0x40a6d2,null))['then'](saveUpdates(_0x1fb6c0[_0xf20c('0x4c')],null))['then'](respondWithResult(_0x40a6d2,null))['catch'](handleError(_0x40a6d2,null));};exports[_0xf20c('0x28')]=function(_0x5326ee,_0x5d2c41){return db[_0xf20c('0x2f')][_0xf20c('0x4a')]({'where':{'id':_0x5326ee[_0xf20c('0x47')]['id']}})[_0xf20c('0x27')](handleEntityNotFound(_0x5d2c41,null))['then'](removeEntity(_0x5d2c41,null))[_0xf20c('0x45')](handleError(_0x5d2c41,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8dcd727..b433597 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 _0x1b27=['idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x35e124,_0x1d85e2){var _0x53c482=function(_0x5afd39){while(--_0x5afd39){_0x35e124['push'](_0x35e124['shift']());}};_0x53c482(++_0x1d85e2);}(_0x1b27,0x91));var _0x71b2=function(_0x2d60a3,_0x2bb42a){_0x2d60a3=_0x2d60a3-0x0;var _0x1b43df=_0x1b27[_0x2d60a3];return _0x1b43df;};'use strict';var _=require(_0x71b2('0x0'));var util=require(_0x71b2('0x1'));var logger=require(_0x71b2('0x2'))(_0x71b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71b2('0x4'));var fs=require('fs');var path=require(_0x71b2('0x5'));var rimraf=require('rimraf');var config=require(_0x71b2('0x6'));var attributes=require('./intServicenowField.attributes');module[_0x71b2('0x7')]=function(_0x42181c,_0x5a20f){return _0x42181c['define'](_0x71b2('0x8'),attributes,{'tableName':_0x71b2('0x9'),'paranoid':![],'indexes':[{'name':_0x71b2('0xa'),'fields':[_0x71b2('0xb'),_0x71b2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02ff=['bluebird','path','rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x5c5921,_0x333609){var _0x3870cf=function(_0x53f3fd){while(--_0x53f3fd){_0x5c5921['push'](_0x5c5921['shift']());}};_0x3870cf(++_0x333609);}(_0x02ff,0x183));var _0xf02f=function(_0x5f0d26,_0x41fe72){_0x5f0d26=_0x5f0d26-0x0;var _0x1c66cc=_0x02ff[_0x5f0d26];return _0x1c66cc;};'use strict';var _=require(_0xf02f('0x0'));var util=require(_0xf02f('0x1'));var logger=require(_0xf02f('0x2'))(_0xf02f('0x3'));var moment=require(_0xf02f('0x4'));var BPromise=require(_0xf02f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf02f('0x6'));var rimraf=require(_0xf02f('0x7'));var config=require(_0xf02f('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xf02f('0x9')]=function(_0x4031b6,_0xdadd9){return _0x4031b6['define'](_0xf02f('0xa'),attributes,{'tableName':_0xf02f('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xf02f('0xc'),_0xf02f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 4a3216f..61d96ab 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(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xda3f,0xec));var _0xfda3=function(_0x2c82ff,_0x21b57f){_0x2c82ff=_0x2c82ff-0x0;var _0x585297=_0xda3f[_0x2c82ff];return _0x585297;};'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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x59ce4a,_0x2e81fd){var _0xdbae10=function(_0x1cc6eb){while(--_0x1cc6eb){_0x59ce4a['push'](_0x59ce4a['shift']());}};_0xdbae10(++_0x2e81fd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 18d8e3a..ad55abf 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(_0x8b7a25,_0x18039b){var _0x58cbec=function(_0xd9796b){while(--_0xd9796b){_0x8b7a25['push'](_0x8b7a25['shift']());}};_0x58cbec(++_0x18039b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_0x25bdbe,_0x42ffac){var _0x28b7ac=function(_0x1c948c){while(--_0x1c948c){_0x25bdbe['push'](_0x25bdbe['shift']());}};_0x28b7ac(++_0x42ffac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 b6dc569..32bb8bd 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(_0x4048a6,_0x2a32b0){var _0x28e887=function(_0x76685c){while(--_0x76685c){_0x4048a6['push'](_0x4048a6['shift']());}};_0x28e887(++_0x2a32b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x3242a9,_0x419edc){var _0x5017c3=function(_0x8586e8){while(--_0x8586e8){_0x3242a9['push'](_0x3242a9['shift']());}};_0x5017c3(++_0x419edc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 9e96db3..52c31e9 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 _0xc94a=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','SugarcrmAccount','include','rows','params','keys','rawAttributes','attributes','find','create','body','catch','getConfigurations','findOne','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','JSON','values','remove','includes','label','value','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc94a,0x14a));var _0xac94=function(_0x36a5f0,_0x3f0ecf){_0x36a5f0=_0x36a5f0-0x0;var _0xdf5cae=_0xc94a[_0x36a5f0];return _0xdf5cae;};'use strict';var emlformat=require(_0xac94('0x0'));var rimraf=require(_0xac94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac94('0x2'));var rp=require(_0xac94('0x3'));var moment=require(_0xac94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac94('0x5'));var util=require(_0xac94('0x6'));var path=require(_0xac94('0x7'));var sox=require(_0xac94('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac94('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac94('0xa'));var jsforce=require(_0xac94('0xb'));var deskjs=require(_0xac94('0xc'));var toCsv=require(_0xac94('0xd'));var querystring=require(_0xac94('0xe'));var Papa=require(_0xac94('0xf'));var Redis=require(_0xac94('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac94('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac94('0x12'));var logger=require(_0xac94('0x13'))(_0xac94('0x14'));var utils=require('../../config/utils');var config=require(_0xac94('0x15'));var licenseUtil=require(_0xac94('0x16'));var db=require(_0xac94('0x17'))['db'];var integrations=require(_0xac94('0x18'));function respondWithStatusCode(_0x7959b6,_0xe6eac3){_0xe6eac3=_0xe6eac3||0xcc;return function(_0x3256b2){if(_0x3256b2){return _0x7959b6['sendStatus'](_0xe6eac3);}return _0x7959b6[_0xac94('0x19')](_0xe6eac3)[_0xac94('0x1a')]();};}function respondWithResult(_0x3a57b6,_0x5ab15b){_0x5ab15b=_0x5ab15b||0xc8;return function(_0x37ddea){if(_0x37ddea){return _0x3a57b6[_0xac94('0x19')](_0x5ab15b)[_0xac94('0x1b')](_0x37ddea);}};}function respondWithFilteredResult(_0x191612,_0x8b4e3a){return function(_0x1ee53a){if(_0x1ee53a){var _0x2b67d7=typeof _0x8b4e3a[_0xac94('0x1c')]===_0xac94('0x1d')&&typeof _0x8b4e3a[_0xac94('0x1e')]===_0xac94('0x1d');var _0x24fffc=_0x1ee53a[_0xac94('0x1f')];var _0x425e1d=_0x2b67d7?0x0:_0x8b4e3a[_0xac94('0x1c')];var _0x37323d=_0x2b67d7?_0x1ee53a[_0xac94('0x1f')]:_0x8b4e3a[_0xac94('0x1c')]+_0x8b4e3a['limit'];var _0x1f5488;if(_0x37323d>=_0x24fffc){_0x37323d=_0x24fffc;_0x1f5488=0xc8;}else{_0x1f5488=0xce;}_0x191612[_0xac94('0x19')](_0x1f5488);return _0x191612[_0xac94('0x20')](_0xac94('0x21'),_0x425e1d+'-'+_0x37323d+'/'+_0x24fffc)['json'](_0x1ee53a);}return null;};}function patchUpdates(_0x2fd852){return function(_0x4e9e4f){try{jsonpatch[_0xac94('0x22')](_0x4e9e4f,_0x2fd852,!![]);}catch(_0x299ec4){return BPromise[_0xac94('0x23')](_0x299ec4);}return _0x4e9e4f['save']();};}function saveUpdates(_0x6cb0cd,_0x2d3389){return function(_0x4ac66b){if(_0x4ac66b){return _0x4ac66b[_0xac94('0x24')](_0x6cb0cd)[_0xac94('0x25')](function(_0xdb2a56){return _0xdb2a56;});}return null;};}function removeEntity(_0x218a29,_0x3be116){return function(_0x5da979){if(_0x5da979){return _0x5da979[_0xac94('0x26')]()[_0xac94('0x25')](function(){_0x218a29[_0xac94('0x19')](0xcc)[_0xac94('0x1a')]();});}};}function handleEntityNotFound(_0x42ee7d,_0x38b3c5){return function(_0x4687b8){if(!_0x4687b8){_0x42ee7d[_0xac94('0x27')](0x194);}return _0x4687b8;};}function handleError(_0x39e639,_0x450f21){_0x450f21=_0x450f21||0x1f4;return function(_0x505258){logger['error'](_0x505258[_0xac94('0x28')]);if(_0x505258[_0xac94('0x29')]){delete _0x505258[_0xac94('0x29')];}_0x39e639[_0xac94('0x19')](_0x450f21)[_0xac94('0x2a')](_0x505258);};}exports[_0xac94('0x2b')]=function(_0xf5b4c9,_0x340211){var _0x5c78f2={},_0x5e00ea={},_0x5bbd3a={'count':0x0,'rows':[]};var _0x406d78=_['map'](db['SugarcrmAccount']['rawAttributes'],function(_0xb49997){return{'name':_0xb49997[_0xac94('0x2c')],'type':_0xb49997[_0xac94('0x2d')][_0xac94('0x2e')]};});_0x5e00ea[_0xac94('0x2f')]=_[_0xac94('0x30')](_0x406d78,_0xac94('0x29'));_0x5e00ea[_0xac94('0x31')]=_['keys'](_0xf5b4c9[_0xac94('0x31')]);_0x5e00ea[_0xac94('0x32')]=_[_0xac94('0x33')](_0x5e00ea['model'],_0x5e00ea[_0xac94('0x31')]);_0x5c78f2['attributes']=_['intersection'](_0x5e00ea['model'],qs['fields'](_0xf5b4c9[_0xac94('0x31')][_0xac94('0x34')]));_0x5c78f2['attributes']=_0x5c78f2['attributes'][_0xac94('0x35')]?_0x5c78f2['attributes']:_0x5e00ea[_0xac94('0x2f')];if(!_0xf5b4c9[_0xac94('0x31')]['hasOwnProperty'](_0xac94('0x36'))){_0x5c78f2[_0xac94('0x1e')]=qs[_0xac94('0x1e')](_0xf5b4c9[_0xac94('0x31')]['limit']);_0x5c78f2[_0xac94('0x1c')]=qs[_0xac94('0x1c')](_0xf5b4c9[_0xac94('0x31')][_0xac94('0x1c')]);}_0x5c78f2[_0xac94('0x37')]=qs['sort'](_0xf5b4c9[_0xac94('0x31')][_0xac94('0x38')]);_0x5c78f2[_0xac94('0x39')]=qs[_0xac94('0x32')](_[_0xac94('0x3a')](_0xf5b4c9['query'],_0x5e00ea['filters']),_0x406d78);if(_0xf5b4c9[_0xac94('0x31')][_0xac94('0x3b')]){_0x5c78f2[_0xac94('0x39')]=_[_0xac94('0x3c')](_0x5c78f2[_0xac94('0x39')],{'$or':_[_0xac94('0x30')](_0x406d78,function(_0x4d0fb0){if(_0x4d0fb0['type']!=='VIRTUAL'){var _0x35ffa3={};_0x35ffa3[_0x4d0fb0[_0xac94('0x29')]]={'$like':'%'+_0xf5b4c9[_0xac94('0x31')]['filter']+'%'};return _0x35ffa3;}})});}_0x5c78f2=_['merge']({},_0x5c78f2,_0xf5b4c9[_0xac94('0x3d')]);var _0x28791f={'where':_0x5c78f2[_0xac94('0x39')]};return db[_0xac94('0x3e')][_0xac94('0x1f')](_0x28791f)[_0xac94('0x25')](function(_0x1224d9){_0x5bbd3a[_0xac94('0x1f')]=_0x1224d9;if(_0xf5b4c9['query']['includeAll']){_0x5c78f2[_0xac94('0x3f')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x5c78f2);})['then'](function(_0x15951d){_0x5bbd3a[_0xac94('0x40')]=_0x15951d;return _0x5bbd3a;})[_0xac94('0x25')](respondWithFilteredResult(_0x340211,_0x5c78f2))['catch'](handleError(_0x340211,null));};exports['show']=function(_0x2ab4e3,_0x5c294a){var _0x5185e6={'raw':![],'where':{'id':_0x2ab4e3[_0xac94('0x41')]['id']}},_0x222175={};_0x222175[_0xac94('0x2f')]=_[_0xac94('0x42')](db['SugarcrmAccount'][_0xac94('0x43')]);_0x222175[_0xac94('0x31')]=_[_0xac94('0x42')](_0x2ab4e3['query']);_0x222175[_0xac94('0x32')]=_['intersection'](_0x222175[_0xac94('0x2f')],_0x222175[_0xac94('0x31')]);_0x5185e6[_0xac94('0x44')]=_[_0xac94('0x33')](_0x222175['model'],qs[_0xac94('0x34')](_0x2ab4e3[_0xac94('0x31')][_0xac94('0x34')]));_0x5185e6[_0xac94('0x44')]=_0x5185e6[_0xac94('0x44')][_0xac94('0x35')]?_0x5185e6[_0xac94('0x44')]:_0x222175[_0xac94('0x2f')];if(_0x2ab4e3[_0xac94('0x31')]['includeAll']){_0x5185e6[_0xac94('0x3f')]=[{'all':!![]}];}_0x5185e6=_[_0xac94('0x3c')]({},_0x5185e6,_0x2ab4e3[_0xac94('0x3d')]);return db[_0xac94('0x3e')][_0xac94('0x45')](_0x5185e6)['then'](handleEntityNotFound(_0x5c294a,null))['then'](respondWithResult(_0x5c294a,null))['catch'](handleError(_0x5c294a,null));};exports[_0xac94('0x46')]=function(_0x21e4d8,_0x1c97e3){return db[_0xac94('0x3e')][_0xac94('0x46')](_0x21e4d8[_0xac94('0x47')],{})[_0xac94('0x25')](respondWithResult(_0x1c97e3,0xc9))[_0xac94('0x48')](handleError(_0x1c97e3,null));};exports[_0xac94('0x24')]=function(_0x2129b6,_0x14314d){if(_0x2129b6[_0xac94('0x47')]['id']){delete _0x2129b6[_0xac94('0x47')]['id'];}return db['SugarcrmAccount'][_0xac94('0x45')]({'where':{'id':_0x2129b6[_0xac94('0x41')]['id']}})[_0xac94('0x25')](handleEntityNotFound(_0x14314d,null))[_0xac94('0x25')](saveUpdates(_0x2129b6[_0xac94('0x47')],null))[_0xac94('0x25')](respondWithResult(_0x14314d,null))[_0xac94('0x48')](handleError(_0x14314d,null));};exports[_0xac94('0x26')]=function(_0x18534b,_0x21bc45){return db[_0xac94('0x3e')][_0xac94('0x45')]({'where':{'id':_0x18534b[_0xac94('0x41')]['id']}})['then'](handleEntityNotFound(_0x21bc45,null))[_0xac94('0x25')](removeEntity(_0x21bc45,null))['catch'](handleError(_0x21bc45,null));};exports[_0xac94('0x49')]=function(_0x22e04b,_0x547081,_0xca0de0){var _0x1ad681={};var _0x10f592={};var _0x9e1c94;var _0x48e189;return db['SugarcrmAccount'][_0xac94('0x4a')]({'where':{'id':_0x22e04b[_0xac94('0x41')]['id']}})['then'](handleEntityNotFound(_0x547081,null))[_0xac94('0x25')](function(_0x2f1dfa){if(_0x2f1dfa){_0x9e1c94=_0x2f1dfa;_0x10f592[_0xac94('0x2f')]=_[_0xac94('0x42')](db['SugarcrmConfiguration']['rawAttributes']);_0x10f592['query']=_[_0xac94('0x42')](_0x22e04b[_0xac94('0x31')]);_0x10f592[_0xac94('0x32')]=_[_0xac94('0x33')](_0x10f592[_0xac94('0x2f')],_0x10f592[_0xac94('0x31')]);_0x1ad681[_0xac94('0x44')]=_[_0xac94('0x33')](_0x10f592[_0xac94('0x2f')],qs['fields'](_0x22e04b['query']['fields']));_0x1ad681[_0xac94('0x44')]=_0x1ad681[_0xac94('0x44')][_0xac94('0x35')]?_0x1ad681[_0xac94('0x44')]:_0x10f592[_0xac94('0x2f')];_0x1ad681[_0xac94('0x37')]=qs[_0xac94('0x38')](_0x22e04b['query'][_0xac94('0x38')]);_0x1ad681[_0xac94('0x39')]=qs[_0xac94('0x32')](_[_0xac94('0x3a')](_0x22e04b[_0xac94('0x31')],_0x10f592['filters']));if(_0x22e04b[_0xac94('0x31')]['filter']){_0x1ad681[_0xac94('0x39')]=_[_0xac94('0x3c')](_0x1ad681[_0xac94('0x39')],{'$or':_[_0xac94('0x30')](_0x1ad681[_0xac94('0x44')],function(_0x38fe34){var _0x465461={};_0x465461[_0x38fe34]={'$like':'%'+_0x22e04b[_0xac94('0x31')][_0xac94('0x3b')]+'%'};return _0x465461;})});}_0x1ad681=_[_0xac94('0x3c')]({},_0x1ad681,_0x22e04b[_0xac94('0x3d')]);return _0x9e1c94[_0xac94('0x49')](_0x1ad681);}})[_0xac94('0x25')](function(_0x52c311){if(_0x52c311){_0x48e189=_0x52c311['length'];if(!_0x22e04b[_0xac94('0x31')]['hasOwnProperty'](_0xac94('0x36'))){_0x1ad681[_0xac94('0x1e')]=qs['limit'](_0x22e04b[_0xac94('0x31')][_0xac94('0x1e')]);_0x1ad681['offset']=qs[_0xac94('0x1c')](_0x22e04b[_0xac94('0x31')][_0xac94('0x1c')]);}return _0x9e1c94['getConfigurations'](_0x1ad681);}})[_0xac94('0x25')](function(_0xc5c428){if(_0xc5c428){return _0xc5c428?{'count':_0x48e189,'rows':_0xc5c428}:null;}})[_0xac94('0x25')](respondWithResult(_0x547081,null))[_0xac94('0x48')](handleError(_0x547081,null));};exports['addConfiguration']=function(_0x38ea8e,_0x555400,_0x4db844){if(_0x38ea8e['body']['id']){delete _0x38ea8e[_0xac94('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x38ea8e[_0xac94('0x41')]['id']}})['then'](handleEntityNotFound(_0x555400,null))[_0xac94('0x25')](function(_0x300cd0){if(_0x300cd0){_0x38ea8e[_0xac94('0x47')]['AccountId']=_0x300cd0['id'];_0x38ea8e['body']['Subjects']=integrations['getSubjects'](_0x38ea8e['body'][_0xac94('0x4b')],_0x38ea8e[_0xac94('0x47')][_0xac94('0x2d')]);_0x38ea8e[_0xac94('0x47')]['Descriptions']=integrations[_0xac94('0x4c')](_0x38ea8e[_0xac94('0x47')][_0xac94('0x4b')],_0x38ea8e[_0xac94('0x47')][_0xac94('0x2d')]);return db[_0xac94('0x4d')][_0xac94('0x46')](_0x38ea8e[_0xac94('0x47')],{'include':[{'model':db[_0xac94('0x4e')],'as':'Subjects'},{'model':db[_0xac94('0x4e')],'as':_0xac94('0x4f')}]});}return null;})['then'](respondWithResult(_0x555400,null))[_0xac94('0x48')](handleError(_0x555400,null));};exports[_0xac94('0x50')]=function(_0x41566a,_0x34e63b,_0x505814){var _0x2e3202='';var _0x373e59=['id',_0xac94('0x29'),_0xac94('0x51'),_0xac94('0x52'),_0xac94('0x53'),'date_start',_0xac94('0x54'),'duration_minutes',_0xac94('0x55'),_0xac94('0x56'),_0xac94('0x57'),_0xac94('0x58')];return db[_0xac94('0x3e')]['findOne']({'where':{'id':_0x41566a['params']['id']},'attributes':['id',_0xac94('0x59'),_0xac94('0x5a'),_0xac94('0x5b')]})[_0xac94('0x25')](handleEntityNotFound(_0x34e63b,null))[_0xac94('0x25')](function(_0x2fbc7b){if(_0x2fbc7b){_0x2e3202=_0x2fbc7b[_0xac94('0x5b')];var _0x1c46a1=_0x2e3202['slice'](-0x1);if(_0x1c46a1==='/'){_0x2e3202=_0x2e3202[_0xac94('0x5c')](0x0,_0x2e3202[_0xac94('0x5d')](_0x1c46a1));}return rp({'method':_0xac94('0x5e'),'uri':util[_0xac94('0x5f')](_0xac94('0x60'),_0x2e3202,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xac94('0x61'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xac94('0x62')]({'user_auth':{'user_name':_0x2fbc7b[_0xac94('0x59')],'password':_0x2fbc7b['password'],'encryption':_0xac94('0x63')},'application':_0xac94('0x64')})}});}})[_0xac94('0x25')](function(_0x395a72){if(_0x395a72&&_0x395a72['name']!==_0xac94('0x65')&&_0x395a72[_0xac94('0x29')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format'](_0xac94('0x60'),_0x2e3202,_0xac94('0x66')),'json':!![],'form':{'method':_0xac94('0x67'),'input_type':_0xac94('0x68'),'response_type':'JSON','rest_data':JSON[_0xac94('0x62')]({'session':_0x395a72['id'],'module_name':'Calls'})}})[_0xac94('0x25')](function(_0x4bc895){if(_0x4bc895){var _0x145c6e=_[_0xac94('0x69')](_0x4bc895['module_fields']);_[_0xac94('0x6a')](_0x145c6e,function(_0x55190e){return _0x373e59[_0xac94('0x6b')](_0x55190e[_0xac94('0x29')]);});return{'count':_0x145c6e[_0xac94('0x35')],'rows':_[_0xac94('0x30')](_0x145c6e,function(_0x2d3bd8){return{'id':_0x2d3bd8[_0xac94('0x29')],'name':_0x2d3bd8[_0xac94('0x6c')],'custom':_['endsWith'](_0x2d3bd8[_0xac94('0x29')],'_c')?!![]:![],'options':_0x2d3bd8['options']?_['map'](_['values'](_0x2d3bd8[_0xac94('0x3d')]),function(_0x11afd8){return{'name':_0x11afd8[_0xac94('0x6d')],'value':_0x11afd8[_0xac94('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x34e63b,null))[_0xac94('0x48')](function(_0x117abc){var _0x2f15e0=_0x41566a[_0xac94('0x31')]['test']?0x1f4:_0x117abc['statusCode']||0x1f4;logger[_0xac94('0x6e')](_0xac94('0x6f'),_0xac94('0x50'),_0x2f15e0,JSON['stringify'](_0x117abc));delete _0x117abc['name'];if(_0x2f15e0===0x191){_0x2f15e0=0x190;}_0x34e63b[_0xac94('0x19')](_0x2f15e0)[_0xac94('0x2a')](_0x41566a[_0xac94('0x31')][_0xac94('0x70')]?{'message':_0xac94('0x71'),'statusCode':_0x117abc['statusCode']}:_0x117abc);});}else{var _0x564438=0x1f4;_0x34e63b['status'](_0x564438)[_0xac94('0x2a')]({'message':_0xac94('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe41d=['endsWith','values','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','show','intersection','length','includeAll','catch','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','module_fields','remove','includes','label'];(function(_0x3e00f5,_0xa17b54){var _0x4e2fc1=function(_0x39435b){while(--_0x39435b){_0x3e00f5['push'](_0x3e00f5['shift']());}};_0x4e2fc1(++_0xa17b54);}(_0xe41d,0x169));var _0xde41=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe41d[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xde41('0x0'));var rimraf=require(_0xde41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde41('0x2'));var rp=require(_0xde41('0x3'));var moment=require('moment');var BPromise=require(_0xde41('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde41('0x5'));var sox=require(_0xde41('0x6'));var csv=require(_0xde41('0x7'));var ejs=require(_0xde41('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde41('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde41('0x7'));var querystring=require(_0xde41('0xa'));var Papa=require(_0xde41('0xb'));var Redis=require('ioredis');var authService=require(_0xde41('0xc'));var qs=require(_0xde41('0xd'));var as=require(_0xde41('0xe'));var hardwareService=require(_0xde41('0xf'));var logger=require(_0xde41('0x10'))(_0xde41('0x11'));var utils=require('../../config/utils');var config=require(_0xde41('0x12'));var licenseUtil=require(_0xde41('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xde41('0x14'));function respondWithStatusCode(_0x5c6122,_0xaf3d9c){_0xaf3d9c=_0xaf3d9c||0xcc;return function(_0x332d13){if(_0x332d13){return _0x5c6122[_0xde41('0x15')](_0xaf3d9c);}return _0x5c6122[_0xde41('0x16')](_0xaf3d9c)[_0xde41('0x17')]();};}function respondWithResult(_0x5d0329,_0x112193){_0x112193=_0x112193||0xc8;return function(_0x26a496){if(_0x26a496){return _0x5d0329[_0xde41('0x16')](_0x112193)[_0xde41('0x18')](_0x26a496);}};}function respondWithFilteredResult(_0x34415c,_0x34ebb4){return function(_0x40e752){if(_0x40e752){var _0x5ca82b=typeof _0x34ebb4[_0xde41('0x19')]===_0xde41('0x1a')&&typeof _0x34ebb4[_0xde41('0x1b')]===_0xde41('0x1a');var _0x110a25=_0x40e752['count'];var _0x2a4c67=_0x5ca82b?0x0:_0x34ebb4[_0xde41('0x19')];var _0x3cb13e=_0x5ca82b?_0x40e752[_0xde41('0x1c')]:_0x34ebb4[_0xde41('0x19')]+_0x34ebb4[_0xde41('0x1b')];var _0x594b39;if(_0x3cb13e>=_0x110a25){_0x3cb13e=_0x110a25;_0x594b39=0xc8;}else{_0x594b39=0xce;}_0x34415c[_0xde41('0x16')](_0x594b39);return _0x34415c[_0xde41('0x1d')](_0xde41('0x1e'),_0x2a4c67+'-'+_0x3cb13e+'/'+_0x110a25)[_0xde41('0x18')](_0x40e752);}return null;};}function patchUpdates(_0x3c6c0d){return function(_0x10e08a){try{jsonpatch['apply'](_0x10e08a,_0x3c6c0d,!![]);}catch(_0x28585a){return BPromise[_0xde41('0x1f')](_0x28585a);}return _0x10e08a[_0xde41('0x20')]();};}function saveUpdates(_0x6845a2,_0xc537c2){return function(_0xd05a84){if(_0xd05a84){return _0xd05a84[_0xde41('0x21')](_0x6845a2)[_0xde41('0x22')](function(_0x1f24a8){return _0x1f24a8;});}return null;};}function removeEntity(_0x493df5,_0x566bb6){return function(_0x401111){if(_0x401111){return _0x401111[_0xde41('0x23')]()['then'](function(){_0x493df5[_0xde41('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3ba8,_0xa3871e){return function(_0x316fd9){if(!_0x316fd9){_0xf3ba8[_0xde41('0x15')](0x194);}return _0x316fd9;};}function handleError(_0x5a428f,_0x5e3b6d){_0x5e3b6d=_0x5e3b6d||0x1f4;return function(_0x507420){logger['error'](_0x507420['stack']);if(_0x507420[_0xde41('0x24')]){delete _0x507420[_0xde41('0x24')];}_0x5a428f[_0xde41('0x16')](_0x5e3b6d)[_0xde41('0x25')](_0x507420);};}exports[_0xde41('0x26')]=function(_0x4330a4,_0x52e4bb){var _0x347f0a={},_0x450204={},_0x497de8={'count':0x0,'rows':[]};var _0x4d56e5=_[_0xde41('0x27')](db[_0xde41('0x28')][_0xde41('0x29')],function(_0x4eee2f){return{'name':_0x4eee2f['fieldName'],'type':_0x4eee2f[_0xde41('0x2a')]['key']};});_0x450204[_0xde41('0x2b')]=_['map'](_0x4d56e5,_0xde41('0x24'));_0x450204[_0xde41('0x2c')]=_[_0xde41('0x2d')](_0x4330a4[_0xde41('0x2c')]);_0x450204[_0xde41('0x2e')]=_['intersection'](_0x450204[_0xde41('0x2b')],_0x450204['query']);_0x347f0a[_0xde41('0x2f')]=_['intersection'](_0x450204[_0xde41('0x2b')],qs[_0xde41('0x30')](_0x4330a4[_0xde41('0x2c')][_0xde41('0x30')]));_0x347f0a[_0xde41('0x2f')]=_0x347f0a[_0xde41('0x2f')]['length']?_0x347f0a[_0xde41('0x2f')]:_0x450204['model'];if(!_0x4330a4['query'][_0xde41('0x31')](_0xde41('0x32'))){_0x347f0a['limit']=qs[_0xde41('0x1b')](_0x4330a4[_0xde41('0x2c')][_0xde41('0x1b')]);_0x347f0a[_0xde41('0x19')]=qs[_0xde41('0x19')](_0x4330a4[_0xde41('0x2c')][_0xde41('0x19')]);}_0x347f0a[_0xde41('0x33')]=qs[_0xde41('0x34')](_0x4330a4[_0xde41('0x2c')][_0xde41('0x34')]);_0x347f0a['where']=qs[_0xde41('0x2e')](_[_0xde41('0x35')](_0x4330a4['query'],_0x450204['filters']),_0x4d56e5);if(_0x4330a4[_0xde41('0x2c')][_0xde41('0x36')]){_0x347f0a['where']=_[_0xde41('0x37')](_0x347f0a[_0xde41('0x38')],{'$or':_[_0xde41('0x27')](_0x4d56e5,function(_0x3cd6f5){if(_0x3cd6f5[_0xde41('0x2a')]!==_0xde41('0x39')){var _0x323555={};_0x323555[_0x3cd6f5[_0xde41('0x24')]]={'$like':'%'+_0x4330a4[_0xde41('0x2c')][_0xde41('0x36')]+'%'};return _0x323555;}})});}_0x347f0a=_[_0xde41('0x37')]({},_0x347f0a,_0x4330a4[_0xde41('0x3a')]);var _0x1c4968={'where':_0x347f0a[_0xde41('0x38')]};return db['SugarcrmAccount'][_0xde41('0x1c')](_0x1c4968)[_0xde41('0x22')](function(_0x5a4524){_0x497de8['count']=_0x5a4524;if(_0x4330a4['query']['includeAll']){_0x347f0a[_0xde41('0x3b')]=[{'all':!![]}];}return db[_0xde41('0x28')][_0xde41('0x3c')](_0x347f0a);})[_0xde41('0x22')](function(_0x348c71){_0x497de8[_0xde41('0x3d')]=_0x348c71;return _0x497de8;})[_0xde41('0x22')](respondWithFilteredResult(_0x52e4bb,_0x347f0a))['catch'](handleError(_0x52e4bb,null));};exports[_0xde41('0x3e')]=function(_0x2058da,_0x31582e){var _0x2f2e2e={'raw':![],'where':{'id':_0x2058da['params']['id']}},_0x2c8e94={};_0x2c8e94[_0xde41('0x2b')]=_[_0xde41('0x2d')](db['SugarcrmAccount'][_0xde41('0x29')]);_0x2c8e94[_0xde41('0x2c')]=_[_0xde41('0x2d')](_0x2058da[_0xde41('0x2c')]);_0x2c8e94['filters']=_[_0xde41('0x3f')](_0x2c8e94[_0xde41('0x2b')],_0x2c8e94[_0xde41('0x2c')]);_0x2f2e2e[_0xde41('0x2f')]=_[_0xde41('0x3f')](_0x2c8e94[_0xde41('0x2b')],qs['fields'](_0x2058da[_0xde41('0x2c')][_0xde41('0x30')]));_0x2f2e2e['attributes']=_0x2f2e2e[_0xde41('0x2f')][_0xde41('0x40')]?_0x2f2e2e[_0xde41('0x2f')]:_0x2c8e94[_0xde41('0x2b')];if(_0x2058da[_0xde41('0x2c')][_0xde41('0x41')]){_0x2f2e2e[_0xde41('0x3b')]=[{'all':!![]}];}_0x2f2e2e=_[_0xde41('0x37')]({},_0x2f2e2e,_0x2058da['options']);return db['SugarcrmAccount']['find'](_0x2f2e2e)[_0xde41('0x22')](handleEntityNotFound(_0x31582e,null))[_0xde41('0x22')](respondWithResult(_0x31582e,null))[_0xde41('0x42')](handleError(_0x31582e,null));};exports[_0xde41('0x43')]=function(_0x519914,_0x129a74){return db[_0xde41('0x28')][_0xde41('0x43')](_0x519914[_0xde41('0x44')],{})[_0xde41('0x22')](respondWithResult(_0x129a74,0xc9))[_0xde41('0x42')](handleError(_0x129a74,null));};exports[_0xde41('0x21')]=function(_0x34f1be,_0x35ad64){if(_0x34f1be[_0xde41('0x44')]['id']){delete _0x34f1be[_0xde41('0x44')]['id'];}return db[_0xde41('0x28')][_0xde41('0x45')]({'where':{'id':_0x34f1be[_0xde41('0x46')]['id']}})[_0xde41('0x22')](handleEntityNotFound(_0x35ad64,null))['then'](saveUpdates(_0x34f1be[_0xde41('0x44')],null))[_0xde41('0x22')](respondWithResult(_0x35ad64,null))[_0xde41('0x42')](handleError(_0x35ad64,null));};exports[_0xde41('0x23')]=function(_0x483851,_0x1cc72c){return db[_0xde41('0x28')][_0xde41('0x45')]({'where':{'id':_0x483851[_0xde41('0x46')]['id']}})[_0xde41('0x22')](handleEntityNotFound(_0x1cc72c,null))['then'](removeEntity(_0x1cc72c,null))[_0xde41('0x42')](handleError(_0x1cc72c,null));};exports[_0xde41('0x47')]=function(_0x4ec40f,_0x1ed275,_0x3cec29){var _0x43e991={};var _0x38c286={};var _0x15618c;var _0x43ec9b;return db[_0xde41('0x28')][_0xde41('0x48')]({'where':{'id':_0x4ec40f[_0xde41('0x46')]['id']}})[_0xde41('0x22')](handleEntityNotFound(_0x1ed275,null))[_0xde41('0x22')](function(_0x2f048f){if(_0x2f048f){_0x15618c=_0x2f048f;_0x38c286[_0xde41('0x2b')]=_[_0xde41('0x2d')](db[_0xde41('0x49')][_0xde41('0x29')]);_0x38c286[_0xde41('0x2c')]=_[_0xde41('0x2d')](_0x4ec40f['query']);_0x38c286['filters']=_['intersection'](_0x38c286[_0xde41('0x2b')],_0x38c286[_0xde41('0x2c')]);_0x43e991[_0xde41('0x2f')]=_[_0xde41('0x3f')](_0x38c286['model'],qs[_0xde41('0x30')](_0x4ec40f[_0xde41('0x2c')][_0xde41('0x30')]));_0x43e991[_0xde41('0x2f')]=_0x43e991[_0xde41('0x2f')]['length']?_0x43e991[_0xde41('0x2f')]:_0x38c286[_0xde41('0x2b')];_0x43e991[_0xde41('0x33')]=qs['sort'](_0x4ec40f[_0xde41('0x2c')][_0xde41('0x34')]);_0x43e991[_0xde41('0x38')]=qs[_0xde41('0x2e')](_[_0xde41('0x35')](_0x4ec40f['query'],_0x38c286[_0xde41('0x2e')]));if(_0x4ec40f[_0xde41('0x2c')][_0xde41('0x36')]){_0x43e991['where']=_[_0xde41('0x37')](_0x43e991[_0xde41('0x38')],{'$or':_[_0xde41('0x27')](_0x43e991[_0xde41('0x2f')],function(_0x3a5db7){var _0x33d712={};_0x33d712[_0x3a5db7]={'$like':'%'+_0x4ec40f[_0xde41('0x2c')][_0xde41('0x36')]+'%'};return _0x33d712;})});}_0x43e991=_[_0xde41('0x37')]({},_0x43e991,_0x4ec40f[_0xde41('0x3a')]);return _0x15618c[_0xde41('0x47')](_0x43e991);}})[_0xde41('0x22')](function(_0x16be62){if(_0x16be62){_0x43ec9b=_0x16be62['length'];if(!_0x4ec40f['query'][_0xde41('0x31')](_0xde41('0x32'))){_0x43e991['limit']=qs[_0xde41('0x1b')](_0x4ec40f['query'][_0xde41('0x1b')]);_0x43e991[_0xde41('0x19')]=qs[_0xde41('0x19')](_0x4ec40f[_0xde41('0x2c')][_0xde41('0x19')]);}return _0x15618c['getConfigurations'](_0x43e991);}})['then'](function(_0x23d850){if(_0x23d850){return _0x23d850?{'count':_0x43ec9b,'rows':_0x23d850}:null;}})[_0xde41('0x22')](respondWithResult(_0x1ed275,null))[_0xde41('0x42')](handleError(_0x1ed275,null));};exports[_0xde41('0x4a')]=function(_0x28fadd,_0x50a56b,_0x562313){if(_0x28fadd['body']['id']){delete _0x28fadd[_0xde41('0x44')]['id'];}return db[_0xde41('0x28')][_0xde41('0x48')]({'where':{'id':_0x28fadd['params']['id']}})[_0xde41('0x22')](handleEntityNotFound(_0x50a56b,null))[_0xde41('0x22')](function(_0xeba3e9){if(_0xeba3e9){_0x28fadd['body'][_0xde41('0x4b')]=_0xeba3e9['id'];_0x28fadd[_0xde41('0x44')]['Subjects']=integrations[_0xde41('0x4c')](_0x28fadd['body'][_0xde41('0x4d')],_0x28fadd[_0xde41('0x44')][_0xde41('0x2a')]);_0x28fadd[_0xde41('0x44')][_0xde41('0x4e')]=integrations[_0xde41('0x4f')](_0x28fadd[_0xde41('0x44')]['channel'],_0x28fadd[_0xde41('0x44')][_0xde41('0x2a')]);return db[_0xde41('0x49')][_0xde41('0x43')](_0x28fadd[_0xde41('0x44')],{'include':[{'model':db[_0xde41('0x50')],'as':_0xde41('0x51')},{'model':db[_0xde41('0x50')],'as':_0xde41('0x4e')}]});}return null;})[_0xde41('0x22')](respondWithResult(_0x50a56b,null))['catch'](handleError(_0x50a56b,null));};exports[_0xde41('0x52')]=function(_0x40ab9e,_0x2703c0,_0x1f7a3f){var _0x541e1e='';var _0x51ccda=['id',_0xde41('0x24'),_0xde41('0x53'),_0xde41('0x54'),'description',_0xde41('0x55'),_0xde41('0x56'),_0xde41('0x57'),_0xde41('0x58'),_0xde41('0x59'),_0xde41('0x5a'),'direction'];return db[_0xde41('0x28')][_0xde41('0x48')]({'where':{'id':_0x40ab9e[_0xde41('0x46')]['id']},'attributes':['id','username',_0xde41('0x5b'),_0xde41('0x5c')]})[_0xde41('0x22')](handleEntityNotFound(_0x2703c0,null))[_0xde41('0x22')](function(_0x56bd93){if(_0x56bd93){_0x541e1e=_0x56bd93[_0xde41('0x5c')];var _0x193f7e=_0x541e1e[_0xde41('0x5d')](-0x1);if(_0x193f7e==='/'){_0x541e1e=_0x541e1e[_0xde41('0x5e')](0x0,_0x541e1e['lastIndexOf'](_0x193f7e));}return rp({'method':_0xde41('0x5f'),'uri':util[_0xde41('0x60')]('%s%s',_0x541e1e,_0xde41('0x61')),'json':!![],'form':{'method':'login','input_type':_0xde41('0x62'),'response_type':_0xde41('0x62'),'rest_data':JSON[_0xde41('0x63')]({'user_auth':{'user_name':_0x56bd93['username'],'password':_0x56bd93['password'],'encryption':_0xde41('0x64')},'application':_0xde41('0x65')})}});}})[_0xde41('0x22')](function(_0x400068){if(_0x400068&&_0x400068[_0xde41('0x24')]!==_0xde41('0x66')&&_0x400068['name']!==_0xde41('0x67')){return rp({'method':_0xde41('0x5f'),'uri':util[_0xde41('0x60')](_0xde41('0x68'),_0x541e1e,_0xde41('0x61')),'json':!![],'form':{'method':_0xde41('0x69'),'input_type':'JSON','response_type':_0xde41('0x62'),'rest_data':JSON[_0xde41('0x63')]({'session':_0x400068['id'],'module_name':_0xde41('0x6a')})}})[_0xde41('0x22')](function(_0xd6aae0){if(_0xd6aae0){var _0x764a66=_['values'](_0xd6aae0[_0xde41('0x6b')]);_[_0xde41('0x6c')](_0x764a66,function(_0x12b6f8){return _0x51ccda[_0xde41('0x6d')](_0x12b6f8[_0xde41('0x24')]);});return{'count':_0x764a66['length'],'rows':_[_0xde41('0x27')](_0x764a66,function(_0x166309){return{'id':_0x166309[_0xde41('0x24')],'name':_0x166309[_0xde41('0x6e')],'custom':_[_0xde41('0x6f')](_0x166309[_0xde41('0x24')],'_c')?!![]:![],'options':_0x166309['options']?_[_0xde41('0x27')](_[_0xde41('0x70')](_0x166309[_0xde41('0x3a')]),function(_0x855d22){return{'name':_0x855d22['value'],'value':_0x855d22['name']};}):[]};})};}})[_0xde41('0x22')](respondWithResult(_0x2703c0,null))[_0xde41('0x42')](function(_0x38057a){var _0x6bd52f=_0x40ab9e[_0xde41('0x2c')][_0xde41('0x71')]?0x1f4:_0x38057a[_0xde41('0x72')]||0x1f4;logger[_0xde41('0x73')](_0xde41('0x74'),_0xde41('0x52'),_0x6bd52f,JSON[_0xde41('0x63')](_0x38057a));delete _0x38057a[_0xde41('0x24')];if(_0x6bd52f===0x191){_0x6bd52f=0x190;}_0x2703c0['status'](_0x6bd52f)[_0xde41('0x25')](_0x40ab9e['query'][_0xde41('0x71')]?{'message':_0xde41('0x75'),'statusCode':_0x38057a[_0xde41('0x72')]}:_0x38057a);});}else{var _0x487d9e=0x1f4;_0x2703c0['status'](_0x487d9e)['send']({'message':_0xde41('0x75'),'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 d24b8df..be1a237 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 _0x2ab3=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','path','rimraf'];(function(_0x518816,_0x4db921){var _0x1ac83e=function(_0x5834c9){while(--_0x5834c9){_0x518816['push'](_0x518816['shift']());}};_0x1ac83e(++_0x4db921);}(_0x2ab3,0x162));var _0x32ab=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x2ab3[_0x602ca8];return _0x26e8ab;};'use strict';var _=require(_0x32ab('0x0'));var util=require(_0x32ab('0x1'));var logger=require('../../config/logger')(_0x32ab('0x2'));var moment=require(_0x32ab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ab('0x4'));var rimraf=require(_0x32ab('0x5'));var config=require(_0x32ab('0x6'));var attributes=require(_0x32ab('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x32ab('0x8')]=function(_0x166335,_0x120976){return _0x166335[_0x32ab('0x9')](_0x32ab('0xa'),attributes,{'tableName':_0x32ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc2d=['SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x1340fd,_0xb32df6){var _0x45b191=function(_0x2d03b0){while(--_0x2d03b0){_0x1340fd['push'](_0x1340fd['shift']());}};_0x45b191(++_0xb32df6);}(_0xbc2d,0x1c4));var _0xdbc2=function(_0x2fd681,_0x970d7){_0x2fd681=_0x2fd681-0x0;var _0x2b6c89=_0xbc2d[_0x2fd681];return _0x2b6c89;};'use strict';var _=require('lodash');var util=require(_0xdbc2('0x0'));var logger=require(_0xdbc2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdbc2('0x2'));var rp=require(_0xdbc2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbc2('0x4'));var config=require(_0xdbc2('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xdbc2('0x6')]=function(_0x14e396,_0x29b3cf){return _0x14e396[_0xdbc2('0x7')](_0xdbc2('0x8'),attributes,{'tableName':_0xdbc2('0x9'),'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 ce2ed6f..7a31063 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 _0x79cf=['debug','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','model','ShowSugarcrmAccount','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x79cf,0x1cf));var _0xf79c=function(_0x2a103a,_0x1c7b47){_0x2a103a=_0x2a103a-0x0;var _0x30f073=_0x79cf[_0x2a103a];return _0x30f073;};'use strict';var _=require(_0xf79c('0x0'));var util=require(_0xf79c('0x1'));var moment=require(_0xf79c('0x2'));var BPromise=require(_0xf79c('0x3'));var rs=require(_0xf79c('0x4'));var fs=require('fs');var Redis=require(_0xf79c('0x5'));var db=require(_0xf79c('0x6'))['db'];var utils=require(_0xf79c('0x7'));var logger=require(_0xf79c('0x8'))(_0xf79c('0x9'));var config=require(_0xf79c('0xa'));var jayson=require(_0xf79c('0xb'));var client=jayson[_0xf79c('0xc')][_0xf79c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x77f03d,_0x2b6c34,_0x13857e){return new BPromise(function(_0x74e553,_0x50c37c){return client[_0xf79c('0xe')](_0x77f03d,_0x13857e)[_0xf79c('0xf')](function(_0x33c0d9){logger[_0xf79c('0x10')](_0xf79c('0x11'),_0x2b6c34,'request\x20sent');logger[_0xf79c('0x12')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2b6c34,_0xf79c('0x13'),JSON[_0xf79c('0x14')](_0x33c0d9));if(_0x33c0d9['error']){if(_0x33c0d9[_0xf79c('0x15')][_0xf79c('0x16')]===0x1f4){logger[_0xf79c('0x15')](_0xf79c('0x11'),_0x2b6c34,_0x33c0d9[_0xf79c('0x15')][_0xf79c('0x17')]);return _0x50c37c(_0x33c0d9[_0xf79c('0x15')]['message']);}logger[_0xf79c('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x2b6c34,_0x33c0d9[_0xf79c('0x15')][_0xf79c('0x17')]);return _0x74e553(_0x33c0d9['error'][_0xf79c('0x17')]);}else{logger['info'](_0xf79c('0x11'),_0x2b6c34,'request\x20sent');_0x74e553(_0x33c0d9[_0xf79c('0x18')][_0xf79c('0x17')]);}})[_0xf79c('0x19')](function(_0x26f5c3){logger[_0xf79c('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x2b6c34,_0x26f5c3);_0x50c37c(_0x26f5c3);});});}exports[_0xf79c('0x1a')]=function(_0x38beaa){var _0x327fca=this;return new Promise(function(_0x182b4c,_0x1b1e07){return db[_0xf79c('0x1b')][_0xf79c('0x1c')]({'raw':_0x38beaa[_0xf79c('0x1d')]?_0x38beaa[_0xf79c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x38beaa['options']?_0x38beaa[_0xf79c('0x1d')][_0xf79c('0x1e')]||null:null,'attributes':_0x38beaa[_0xf79c('0x1d')]?_0x38beaa[_0xf79c('0x1d')][_0xf79c('0x1f')]||null:null,'limit':_0x38beaa['options']?_0x38beaa[_0xf79c('0x1d')][_0xf79c('0x20')]||null:null,'include':_0x38beaa['options']?_0x38beaa[_0xf79c('0x1d')][_0xf79c('0x21')]?_['map'](_0x38beaa['options'][_0xf79c('0x21')],function(_0x4f71a4){return{'model':db[_0x4f71a4[_0xf79c('0x22')]],'as':_0x4f71a4['as'],'attributes':_0x4f71a4[_0xf79c('0x1f')],'include':_0x4f71a4[_0xf79c('0x21')]?_['map'](_0x4f71a4[_0xf79c('0x21')],function(_0x3a3658){return{'model':db[_0x3a3658[_0xf79c('0x22')]],'as':_0x3a3658['as'],'attributes':_0x3a3658[_0xf79c('0x1f')],'include':_0x3a3658[_0xf79c('0x21')]?_['map'](_0x3a3658['include'],function(_0x4e44f0){return{'model':db[_0x4e44f0[_0xf79c('0x22')]],'as':_0x4e44f0['as'],'attributes':_0x4e44f0[_0xf79c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x495d25){logger[_0xf79c('0x10')](_0xf79c('0x1a'),_0x38beaa);logger[_0xf79c('0x12')](_0xf79c('0x1a'),_0x38beaa,JSON[_0xf79c('0x14')](_0x495d25));_0x182b4c(_0x495d25);})[_0xf79c('0x19')](function(_0x26a0a1){logger[_0xf79c('0x15')](_0xf79c('0x1a'),_0x26a0a1[_0xf79c('0x17')],_0x38beaa);_0x1b1e07(_0x327fca[_0xf79c('0x15')](0x1f4,_0x26a0a1['message']));});});};exports[_0xf79c('0x23')]=function(_0x290de5){var _0x1c4d0e=this;return new Promise(function(_0x30ef12,_0x77b532){return db[_0xf79c('0x1b')]['find']({'raw':_0x290de5[_0xf79c('0x1d')]?_0x290de5[_0xf79c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x290de5['options']?_0x290de5['options'][_0xf79c('0x1e')]||null:null,'attributes':_0x290de5[_0xf79c('0x1d')]?_0x290de5[_0xf79c('0x1d')][_0xf79c('0x1f')]||null:null,'include':_0x290de5[_0xf79c('0x1d')]?_0x290de5[_0xf79c('0x1d')][_0xf79c('0x21')]?_[_0xf79c('0x24')](_0x290de5[_0xf79c('0x1d')]['include'],function(_0x32593b){return{'model':db[_0x32593b[_0xf79c('0x22')]],'as':_0x32593b['as'],'attributes':_0x32593b[_0xf79c('0x1f')],'include':_0x32593b[_0xf79c('0x21')]?_[_0xf79c('0x24')](_0x32593b[_0xf79c('0x21')],function(_0x391403){return{'model':db[_0x391403[_0xf79c('0x22')]],'as':_0x391403['as'],'attributes':_0x391403[_0xf79c('0x1f')],'include':_0x391403[_0xf79c('0x21')]?_[_0xf79c('0x24')](_0x391403['include'],function(_0x514987){return{'model':db[_0x514987['model']],'as':_0x514987['as'],'attributes':_0x514987['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12c1d9){logger[_0xf79c('0x10')](_0xf79c('0x23'),_0x290de5);logger[_0xf79c('0x12')]('ShowSugarcrmAccount',_0x290de5,JSON[_0xf79c('0x14')](_0x12c1d9));_0x30ef12(_0x12c1d9);})[_0xf79c('0x19')](function(_0x9ef31a){logger[_0xf79c('0x15')](_0xf79c('0x23'),_0x9ef31a[_0xf79c('0x17')],_0x290de5);_0x77b532(_0x1c4d0e['error'](0x1f4,_0x9ef31a[_0xf79c('0x17')]));});});}; \ No newline at end of file +var _0xc60a=['findAll','options','raw','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc60a,0xc9));var _0xac60=function(_0x3090a4,_0x2a4438){_0x3090a4=_0x3090a4-0x0;var _0x3a548=_0xc60a[_0x3090a4];return _0x3a548;};'use strict';var _=require(_0xac60('0x0'));var util=require(_0xac60('0x1'));var moment=require('moment');var BPromise=require(_0xac60('0x2'));var rs=require(_0xac60('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac60('0x4'))['db'];var utils=require(_0xac60('0x5'));var logger=require(_0xac60('0x6'))(_0xac60('0x7'));var config=require(_0xac60('0x8'));var jayson=require(_0xac60('0x9'));var client=jayson[_0xac60('0xa')][_0xac60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb263dc,_0x14e8a7,_0x4ea4ae){return new BPromise(function(_0x353c25,_0x2ac405){return client[_0xac60('0xc')](_0xb263dc,_0x4ea4ae)[_0xac60('0xd')](function(_0x159691){logger[_0xac60('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x14e8a7,_0xac60('0xf'));logger[_0xac60('0x10')](_0xac60('0x11'),_0x14e8a7,_0xac60('0xf'),JSON[_0xac60('0x12')](_0x159691));if(_0x159691[_0xac60('0x13')]){if(_0x159691[_0xac60('0x13')][_0xac60('0x14')]===0x1f4){logger[_0xac60('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x14e8a7,_0x159691[_0xac60('0x13')][_0xac60('0x15')]);return _0x2ac405(_0x159691[_0xac60('0x13')]['message']);}logger[_0xac60('0x13')](_0xac60('0x16'),_0x14e8a7,_0x159691[_0xac60('0x13')]['message']);return _0x353c25(_0x159691['error'][_0xac60('0x15')]);}else{logger[_0xac60('0xe')](_0xac60('0x16'),_0x14e8a7,_0xac60('0xf'));_0x353c25(_0x159691[_0xac60('0x17')][_0xac60('0x15')]);}})[_0xac60('0x18')](function(_0x1b2544){logger['error'](_0xac60('0x16'),_0x14e8a7,_0x1b2544);_0x2ac405(_0x1b2544);});});}exports[_0xac60('0x19')]=function(_0x1cec53){var _0x1aa10e=this;return new Promise(function(_0x153d43,_0x53e8bf){return db[_0xac60('0x1a')][_0xac60('0x1b')]({'raw':_0x1cec53[_0xac60('0x1c')]?_0x1cec53['options'][_0xac60('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cec53[_0xac60('0x1c')]?_0x1cec53[_0xac60('0x1c')][_0xac60('0x1e')]||null:null,'attributes':_0x1cec53[_0xac60('0x1c')]?_0x1cec53[_0xac60('0x1c')][_0xac60('0x1f')]||null:null,'limit':_0x1cec53[_0xac60('0x1c')]?_0x1cec53[_0xac60('0x1c')][_0xac60('0x20')]||null:null,'include':_0x1cec53['options']?_0x1cec53[_0xac60('0x1c')]['include']?_[_0xac60('0x21')](_0x1cec53[_0xac60('0x1c')][_0xac60('0x22')],function(_0x1f4def){return{'model':db[_0x1f4def[_0xac60('0x23')]],'as':_0x1f4def['as'],'attributes':_0x1f4def[_0xac60('0x1f')],'include':_0x1f4def[_0xac60('0x22')]?_[_0xac60('0x21')](_0x1f4def[_0xac60('0x22')],function(_0x229b64){return{'model':db[_0x229b64['model']],'as':_0x229b64['as'],'attributes':_0x229b64[_0xac60('0x1f')],'include':_0x229b64['include']?_[_0xac60('0x21')](_0x229b64['include'],function(_0x7173ca){return{'model':db[_0x7173ca['model']],'as':_0x7173ca['as'],'attributes':_0x7173ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xac60('0xd')](function(_0x340a6a){logger[_0xac60('0xe')](_0xac60('0x19'),_0x1cec53);logger[_0xac60('0x10')](_0xac60('0x19'),_0x1cec53,JSON['stringify'](_0x340a6a));_0x153d43(_0x340a6a);})['catch'](function(_0x1158e9){logger[_0xac60('0x13')]('GetSugarcrmAccount',_0x1158e9[_0xac60('0x15')],_0x1cec53);_0x53e8bf(_0x1aa10e['error'](0x1f4,_0x1158e9['message']));});});};exports[_0xac60('0x24')]=function(_0x5cdf23){var _0x3d60f8=this;return new Promise(function(_0x3ee635,_0x3ba86b){return db[_0xac60('0x1a')][_0xac60('0x25')]({'raw':_0x5cdf23[_0xac60('0x1c')]?_0x5cdf23[_0xac60('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5cdf23[_0xac60('0x1c')]?_0x5cdf23[_0xac60('0x1c')][_0xac60('0x1e')]||null:null,'attributes':_0x5cdf23[_0xac60('0x1c')]?_0x5cdf23[_0xac60('0x1c')]['attributes']||null:null,'include':_0x5cdf23[_0xac60('0x1c')]?_0x5cdf23[_0xac60('0x1c')][_0xac60('0x22')]?_[_0xac60('0x21')](_0x5cdf23['options'][_0xac60('0x22')],function(_0x1cbfb3){return{'model':db[_0x1cbfb3['model']],'as':_0x1cbfb3['as'],'attributes':_0x1cbfb3[_0xac60('0x1f')],'include':_0x1cbfb3['include']?_[_0xac60('0x21')](_0x1cbfb3['include'],function(_0x2fe933){return{'model':db[_0x2fe933['model']],'as':_0x2fe933['as'],'attributes':_0x2fe933[_0xac60('0x1f')],'include':_0x2fe933['include']?_['map'](_0x2fe933[_0xac60('0x22')],function(_0xea5936){return{'model':db[_0xea5936[_0xac60('0x23')]],'as':_0xea5936['as'],'attributes':_0xea5936[_0xac60('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xac60('0xd')](function(_0x28d432){logger['info']('ShowSugarcrmAccount',_0x5cdf23);logger[_0xac60('0x10')](_0xac60('0x24'),_0x5cdf23,JSON[_0xac60('0x12')](_0x28d432));_0x3ee635(_0x28d432);})[_0xac60('0x18')](function(_0x22e4f4){logger[_0xac60('0x13')]('ShowSugarcrmAccount',_0x22e4f4[_0xac60('0x15')],_0x5cdf23);_0x3ba86b(_0x3d60f8[_0xac60('0x13')](0x1f4,_0x22e4f4['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c124e9a..64dda4e 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 _0xa2d1=['../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','create','put','update','/:id','destroy','exports','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa2d1,0x19f));var _0x1a2d=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xa2d1[_0x20f96d];return _0x9a7524;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a2d('0x0'));var router=express[_0x1a2d('0x1')]();var fs_extra=require(_0x1a2d('0x2'));var auth=require(_0x1a2d('0x3'));var interaction=require(_0x1a2d('0x4'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x1a2d('0x5')]('/',auth['isAuthenticated'](),controller[_0x1a2d('0x6')]);router[_0x1a2d('0x5')]('/:id',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x8')]);router['get'](_0x1a2d('0x9'),auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xa')]);router[_0x1a2d('0x5')]('/:id/subjects',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xb')]);router[_0x1a2d('0x5')]('/:id/descriptions',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a2d('0xd')]);router[_0x1a2d('0xe')]('/:id',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xf')]);router['delete'](_0x1a2d('0x10'),auth['isAuthenticated'](),controller[_0x1a2d('0x11')]);module[_0x1a2d('0x12')]=router; \ No newline at end of file +var _0x5403=['getDescriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x54bcfc,_0x4309e2){var _0x4ed9f8=function(_0x2075e1){while(--_0x2075e1){_0x54bcfc['push'](_0x54bcfc['shift']());}};_0x4ed9f8(++_0x4309e2);}(_0x5403,0x1ea));var _0x3540=function(_0xa17a0c,_0x5b96fd){_0xa17a0c=_0xa17a0c-0x0;var _0x3e2a9b=_0x5403[_0xa17a0c];return _0x3e2a9b;};'use strict';var multer=require(_0x3540('0x0'));var util=require(_0x3540('0x1'));var path=require(_0x3540('0x2'));var timeout=require(_0x3540('0x3'));var express=require('express');var router=express[_0x3540('0x4')]();var fs_extra=require(_0x3540('0x5'));var auth=require(_0x3540('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3540('0x7'));router[_0x3540('0x8')]('/',auth[_0x3540('0x9')](),controller['index']);router[_0x3540('0x8')](_0x3540('0xa'),auth[_0x3540('0x9')](),controller[_0x3540('0xb')]);router[_0x3540('0x8')](_0x3540('0xc'),auth[_0x3540('0x9')](),controller[_0x3540('0xd')]);router[_0x3540('0x8')](_0x3540('0xe'),auth[_0x3540('0x9')](),controller['getSubjects']);router[_0x3540('0x8')](_0x3540('0xf'),auth[_0x3540('0x9')](),controller[_0x3540('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3540('0x11')]);router['put'](_0x3540('0xa'),auth[_0x3540('0x9')](),controller[_0x3540('0x12')]);router[_0x3540('0x13')](_0x3540('0xa'),auth[_0x3540('0x9')](),controller[_0x3540('0x14')]);module[_0x3540('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b9beea8..7e7d46b 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 _0x417b=['STRING','sequelize','exports'];(function(_0x20bf74,_0x77d8b4){var _0x582833=function(_0x4a3a56){while(--_0x4a3a56){_0x20bf74['push'](_0x20bf74['shift']());}};_0x582833(++_0x77d8b4);}(_0x417b,0xdf));var _0xb417=function(_0x1cdc6a,_0x574795){_0x1cdc6a=_0x1cdc6a-0x0;var _0xabf9ac=_0x417b[_0x1cdc6a];return _0xabf9ac;};'use strict';var Sequelize=require(_0xb417('0x0'));module[_0xb417('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb417('0x2')]}}; \ No newline at end of file +var _0x8f03=['STRING','sequelize'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x8f03,0x165));var _0x38f0=function(_0xb5a041,_0x394f01){_0xb5a041=_0xb5a041-0x0;var _0x187974=_0x8f03[_0xb5a041];return _0x187974;};'use strict';var Sequelize=require(_0x38f0('0x0'));module['exports']={'name':{'type':Sequelize[_0x38f0('0x1')]},'description':{'type':Sequelize[_0x38f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6feebe0..bf2ab45 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 _0x5a3e=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','getFields','findOne','SugarcrmField','length','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5da5b6,_0x1234f3){var _0x1bde08=function(_0x4abbcf){while(--_0x4abbcf){_0x5da5b6['push'](_0x5da5b6['shift']());}};_0x1bde08(++_0x1234f3);}(_0x5a3e,0x156));var _0xe5a3=function(_0x2c99d4,_0x443b4f){_0x2c99d4=_0x2c99d4-0x0;var _0x122776=_0x5a3e[_0x2c99d4];return _0x122776;};'use strict';var emlformat=require(_0xe5a3('0x0'));var rimraf=require(_0xe5a3('0x1'));var zipdir=require(_0xe5a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5a3('0x3'));var moment=require('moment');var BPromise=require(_0xe5a3('0x4'));var Mustache=require(_0xe5a3('0x5'));var util=require(_0xe5a3('0x6'));var path=require(_0xe5a3('0x7'));var sox=require(_0xe5a3('0x8'));var csv=require(_0xe5a3('0x9'));var ejs=require(_0xe5a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5a3('0xb'));var squel=require(_0xe5a3('0xc'));var crypto=require('crypto');var jsforce=require(_0xe5a3('0xd'));var deskjs=require(_0xe5a3('0xe'));var toCsv=require(_0xe5a3('0x9'));var querystring=require(_0xe5a3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5a3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe5a3('0x11'));var hardwareService=require(_0xe5a3('0x12'));var logger=require(_0xe5a3('0x13'))(_0xe5a3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe5a3('0x15'));var db=require(_0xe5a3('0x16'))['db'];function respondWithStatusCode(_0x4f7b24,_0x71b2d1){_0x71b2d1=_0x71b2d1||0xcc;return function(_0x1e37dd){if(_0x1e37dd){return _0x4f7b24['sendStatus'](_0x71b2d1);}return _0x4f7b24[_0xe5a3('0x17')](_0x71b2d1)[_0xe5a3('0x18')]();};}function respondWithResult(_0x19c2cc,_0x3e7485){_0x3e7485=_0x3e7485||0xc8;return function(_0x16e149){if(_0x16e149){return _0x19c2cc[_0xe5a3('0x17')](_0x3e7485)[_0xe5a3('0x19')](_0x16e149);}};}function respondWithFilteredResult(_0x2f4aa7,_0x430e68){return function(_0x427065){if(_0x427065){var _0x4449d5=typeof _0x430e68['offset']===_0xe5a3('0x1a')&&typeof _0x430e68[_0xe5a3('0x1b')]===_0xe5a3('0x1a');var _0x10a5f8=_0x427065['count'];var _0x49af65=_0x4449d5?0x0:_0x430e68[_0xe5a3('0x1c')];var _0xd66196=_0x4449d5?_0x427065['count']:_0x430e68[_0xe5a3('0x1c')]+_0x430e68['limit'];var _0x54e181;if(_0xd66196>=_0x10a5f8){_0xd66196=_0x10a5f8;_0x54e181=0xc8;}else{_0x54e181=0xce;}_0x2f4aa7[_0xe5a3('0x17')](_0x54e181);return _0x2f4aa7[_0xe5a3('0x1d')](_0xe5a3('0x1e'),_0x49af65+'-'+_0xd66196+'/'+_0x10a5f8)[_0xe5a3('0x19')](_0x427065);}return null;};}function patchUpdates(_0x170497){return function(_0x4b7787){try{jsonpatch[_0xe5a3('0x1f')](_0x4b7787,_0x170497,!![]);}catch(_0x479fad){return BPromise[_0xe5a3('0x20')](_0x479fad);}return _0x4b7787[_0xe5a3('0x21')]();};}function saveUpdates(_0x2e31b4,_0x168784){return function(_0x174505){if(_0x174505){return _0x174505[_0xe5a3('0x22')](_0x2e31b4)[_0xe5a3('0x23')](function(_0xa61593){return _0xa61593;});}return null;};}function removeEntity(_0x3be21a,_0x5a4f03){return function(_0x1fc9e4){if(_0x1fc9e4){return _0x1fc9e4[_0xe5a3('0x24')]()[_0xe5a3('0x23')](function(){_0x3be21a[_0xe5a3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x122967,_0x3986ea){return function(_0x1a66e2){if(!_0x1a66e2){_0x122967[_0xe5a3('0x25')](0x194);}return _0x1a66e2;};}function handleError(_0x41db8d,_0x339fba){_0x339fba=_0x339fba||0x1f4;return function(_0x5ede2c){logger['error'](_0x5ede2c['stack']);if(_0x5ede2c[_0xe5a3('0x26')]){delete _0x5ede2c[_0xe5a3('0x26')];}_0x41db8d[_0xe5a3('0x17')](_0x339fba)[_0xe5a3('0x27')](_0x5ede2c);};}exports[_0xe5a3('0x28')]=function(_0xd9dfbb,_0x39614c){var _0x50834d={},_0x550682={},_0x3ce754={'count':0x0,'rows':[]};var _0x79a4e3=_[_0xe5a3('0x29')](db[_0xe5a3('0x2a')]['rawAttributes'],function(_0x188028){return{'name':_0x188028[_0xe5a3('0x2b')],'type':_0x188028[_0xe5a3('0x2c')][_0xe5a3('0x2d')]};});_0x550682[_0xe5a3('0x2e')]=_[_0xe5a3('0x29')](_0x79a4e3,_0xe5a3('0x26'));_0x550682[_0xe5a3('0x2f')]=_[_0xe5a3('0x30')](_0xd9dfbb[_0xe5a3('0x2f')]);_0x550682[_0xe5a3('0x31')]=_[_0xe5a3('0x32')](_0x550682['model'],_0x550682[_0xe5a3('0x2f')]);_0x50834d[_0xe5a3('0x33')]=_[_0xe5a3('0x32')](_0x550682[_0xe5a3('0x2e')],qs[_0xe5a3('0x34')](_0xd9dfbb['query']['fields']));_0x50834d[_0xe5a3('0x33')]=_0x50834d[_0xe5a3('0x33')]['length']?_0x50834d[_0xe5a3('0x33')]:_0x550682['model'];if(!_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x35')](_0xe5a3('0x36'))){_0x50834d[_0xe5a3('0x1b')]=qs[_0xe5a3('0x1b')](_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x1b')]);_0x50834d['offset']=qs[_0xe5a3('0x1c')](_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x1c')]);}_0x50834d['order']=qs[_0xe5a3('0x37')](_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x37')]);_0x50834d[_0xe5a3('0x38')]=qs['filters'](_[_0xe5a3('0x39')](_0xd9dfbb[_0xe5a3('0x2f')],_0x550682[_0xe5a3('0x31')]),_0x79a4e3);if(_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x3a')]){_0x50834d[_0xe5a3('0x38')]=_[_0xe5a3('0x3b')](_0x50834d['where'],{'$or':_[_0xe5a3('0x29')](_0x79a4e3,function(_0x3c164a){if(_0x3c164a[_0xe5a3('0x2c')]!==_0xe5a3('0x3c')){var _0x46b018={};_0x46b018[_0x3c164a[_0xe5a3('0x26')]]={'$like':'%'+_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x3a')]+'%'};return _0x46b018;}})});}_0x50834d=_[_0xe5a3('0x3b')]({},_0x50834d,_0xd9dfbb[_0xe5a3('0x3d')]);var _0x420d20={'where':_0x50834d[_0xe5a3('0x38')]};return db[_0xe5a3('0x2a')][_0xe5a3('0x3e')](_0x420d20)[_0xe5a3('0x23')](function(_0x28ffde){_0x3ce754[_0xe5a3('0x3e')]=_0x28ffde;if(_0xd9dfbb[_0xe5a3('0x2f')][_0xe5a3('0x3f')]){_0x50834d[_0xe5a3('0x40')]=[{'all':!![]}];}return db[_0xe5a3('0x2a')][_0xe5a3('0x41')](_0x50834d);})[_0xe5a3('0x23')](function(_0x59218b){_0x3ce754[_0xe5a3('0x42')]=_0x59218b;return _0x3ce754;})['then'](respondWithFilteredResult(_0x39614c,_0x50834d))[_0xe5a3('0x43')](handleError(_0x39614c,null));};exports['show']=function(_0x43623d,_0x3987b9){var _0x2bd94e={'raw':![],'where':{'id':_0x43623d[_0xe5a3('0x44')]['id']}},_0xecdfc5={};_0xecdfc5[_0xe5a3('0x2e')]=_[_0xe5a3('0x30')](db['SugarcrmConfiguration'][_0xe5a3('0x45')]);_0xecdfc5['query']=_['keys'](_0x43623d[_0xe5a3('0x2f')]);_0xecdfc5[_0xe5a3('0x31')]=_['intersection'](_0xecdfc5['model'],_0xecdfc5[_0xe5a3('0x2f')]);_0x2bd94e['attributes']=_[_0xe5a3('0x32')](_0xecdfc5[_0xe5a3('0x2e')],qs[_0xe5a3('0x34')](_0x43623d[_0xe5a3('0x2f')][_0xe5a3('0x34')]));_0x2bd94e[_0xe5a3('0x33')]=_0x2bd94e[_0xe5a3('0x33')]['length']?_0x2bd94e['attributes']:_0xecdfc5[_0xe5a3('0x2e')];if(_0x43623d[_0xe5a3('0x2f')][_0xe5a3('0x3f')]){_0x2bd94e[_0xe5a3('0x40')]=[{'all':!![]}];}_0x2bd94e=_['merge']({},_0x2bd94e,_0x43623d[_0xe5a3('0x3d')]);return db[_0xe5a3('0x2a')][_0xe5a3('0x46')](_0x2bd94e)[_0xe5a3('0x23')](handleEntityNotFound(_0x3987b9,null))[_0xe5a3('0x23')](respondWithResult(_0x3987b9,null))[_0xe5a3('0x43')](handleError(_0x3987b9,null));};exports['create']=function(_0x1babff,_0x15df07){return db[_0xe5a3('0x2a')]['create'](_0x1babff[_0xe5a3('0x47')],{})[_0xe5a3('0x23')](respondWithResult(_0x15df07,0xc9))['catch'](handleError(_0x15df07,null));};exports[_0xe5a3('0x22')]=function(_0x487a9f,_0x17c21c){if(_0x487a9f['body']['id']){delete _0x487a9f['body']['id'];}return db['SugarcrmConfiguration'][_0xe5a3('0x46')]({'where':{'id':_0x487a9f['params']['id']}})[_0xe5a3('0x23')](handleEntityNotFound(_0x17c21c,null))['then'](saveUpdates(_0x487a9f['body'],null))['then'](respondWithResult(_0x17c21c,null))[_0xe5a3('0x43')](handleError(_0x17c21c,null));};exports[_0xe5a3('0x24')]=function(_0x1b47a6,_0x2dafee){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1b47a6['params']['id']}})[_0xe5a3('0x23')](handleEntityNotFound(_0x2dafee,null))['then'](removeEntity(_0x2dafee,null))[_0xe5a3('0x43')](handleError(_0x2dafee,null));};exports[_0xe5a3('0x48')]=function(_0x28092b,_0x2936a0,_0x509cfe){var _0x4bb4a6={};var _0x4a421d={};var _0x356582;var _0x1ad319;return db['SugarcrmConfiguration'][_0xe5a3('0x49')]({'where':{'id':_0x28092b['params']['id']}})[_0xe5a3('0x23')](handleEntityNotFound(_0x2936a0,null))[_0xe5a3('0x23')](function(_0x1bb3c0){if(_0x1bb3c0){_0x356582=_0x1bb3c0;_0x4a421d['model']=_['keys'](db[_0xe5a3('0x4a')][_0xe5a3('0x45')]);_0x4a421d['query']=_[_0xe5a3('0x30')](_0x28092b[_0xe5a3('0x2f')]);_0x4a421d[_0xe5a3('0x31')]=_[_0xe5a3('0x32')](_0x4a421d[_0xe5a3('0x2e')],_0x4a421d[_0xe5a3('0x2f')]);_0x4bb4a6[_0xe5a3('0x33')]=_[_0xe5a3('0x32')](_0x4a421d['model'],qs[_0xe5a3('0x34')](_0x28092b[_0xe5a3('0x2f')][_0xe5a3('0x34')]));_0x4bb4a6['attributes']=_0x4bb4a6[_0xe5a3('0x33')][_0xe5a3('0x4b')]?_0x4bb4a6[_0xe5a3('0x33')]:_0x4a421d['model'];_0x4bb4a6[_0xe5a3('0x4c')]=qs[_0xe5a3('0x37')](_0x28092b[_0xe5a3('0x2f')][_0xe5a3('0x37')]);_0x4bb4a6['where']=qs['filters'](_[_0xe5a3('0x39')](_0x28092b[_0xe5a3('0x2f')],_0x4a421d[_0xe5a3('0x31')]));if(_0x28092b['query'][_0xe5a3('0x3a')]){_0x4bb4a6[_0xe5a3('0x38')]=_[_0xe5a3('0x3b')](_0x4bb4a6[_0xe5a3('0x38')],{'$or':_[_0xe5a3('0x29')](_0x4bb4a6[_0xe5a3('0x33')],function(_0x55ef2f){var _0x3ec21f={};_0x3ec21f[_0x55ef2f]={'$like':'%'+_0x28092b['query'][_0xe5a3('0x3a')]+'%'};return _0x3ec21f;})});}_0x4bb4a6=_[_0xe5a3('0x3b')]({},_0x4bb4a6,_0x28092b['options']);return _0x356582['getFields'](_0x4bb4a6);}})[_0xe5a3('0x23')](function(_0x8359c5){if(_0x8359c5){_0x1ad319=_0x8359c5[_0xe5a3('0x4b')];if(!_0x28092b['query'][_0xe5a3('0x35')](_0xe5a3('0x36'))){_0x4bb4a6['limit']=qs['limit'](_0x28092b[_0xe5a3('0x2f')][_0xe5a3('0x1b')]);_0x4bb4a6[_0xe5a3('0x1c')]=qs['offset'](_0x28092b['query'][_0xe5a3('0x1c')]);}return _0x356582[_0xe5a3('0x48')](_0x4bb4a6);}})[_0xe5a3('0x23')](function(_0x5cf161){if(_0x5cf161){return _0x5cf161?{'count':_0x1ad319,'rows':_0x5cf161}:null;}})[_0xe5a3('0x23')](respondWithResult(_0x2936a0,null))['catch'](handleError(_0x2936a0,null));};exports[_0xe5a3('0x4d')]=function(_0x3b31bb,_0x30e986,_0x4145d1){var _0x294f5a={};var _0x227963={};var _0x7d9022;var _0xd45625;return db[_0xe5a3('0x2a')][_0xe5a3('0x49')]({'where':{'id':_0x3b31bb[_0xe5a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x30e986,null))['then'](function(_0x306652){if(_0x306652){_0x7d9022=_0x306652;_0x227963[_0xe5a3('0x2e')]=_[_0xe5a3('0x30')](db[_0xe5a3('0x4a')][_0xe5a3('0x45')]);_0x227963[_0xe5a3('0x2f')]=_['keys'](_0x3b31bb[_0xe5a3('0x2f')]);_0x227963[_0xe5a3('0x31')]=_[_0xe5a3('0x32')](_0x227963[_0xe5a3('0x2e')],_0x227963[_0xe5a3('0x2f')]);_0x294f5a[_0xe5a3('0x33')]=_['intersection'](_0x227963[_0xe5a3('0x2e')],qs[_0xe5a3('0x34')](_0x3b31bb['query'][_0xe5a3('0x34')]));_0x294f5a['attributes']=_0x294f5a[_0xe5a3('0x33')][_0xe5a3('0x4b')]?_0x294f5a[_0xe5a3('0x33')]:_0x227963[_0xe5a3('0x2e')];_0x294f5a['order']=qs[_0xe5a3('0x37')](_0x3b31bb[_0xe5a3('0x2f')][_0xe5a3('0x37')]);_0x294f5a[_0xe5a3('0x38')]=qs[_0xe5a3('0x31')](_['pick'](_0x3b31bb[_0xe5a3('0x2f')],_0x227963[_0xe5a3('0x31')]));if(_0x3b31bb['query'][_0xe5a3('0x3a')]){_0x294f5a['where']=_['merge'](_0x294f5a[_0xe5a3('0x38')],{'$or':_['map'](_0x294f5a[_0xe5a3('0x33')],function(_0x5f0900){var _0x8b538d={};_0x8b538d[_0x5f0900]={'$like':'%'+_0x3b31bb[_0xe5a3('0x2f')][_0xe5a3('0x3a')]+'%'};return _0x8b538d;})});}_0x294f5a=_[_0xe5a3('0x3b')]({},_0x294f5a,_0x3b31bb['options']);return _0x7d9022['getSubjects'](_0x294f5a);}})[_0xe5a3('0x23')](function(_0x5f52e4){if(_0x5f52e4){_0xd45625=_0x5f52e4[_0xe5a3('0x4b')];if(!_0x3b31bb['query'][_0xe5a3('0x35')](_0xe5a3('0x36'))){_0x294f5a['limit']=qs[_0xe5a3('0x1b')](_0x3b31bb[_0xe5a3('0x2f')][_0xe5a3('0x1b')]);_0x294f5a['offset']=qs['offset'](_0x3b31bb[_0xe5a3('0x2f')][_0xe5a3('0x1c')]);}return _0x7d9022[_0xe5a3('0x4d')](_0x294f5a);}})[_0xe5a3('0x23')](function(_0xeca42){if(_0xeca42){return _0xeca42?{'count':_0xd45625,'rows':_0xeca42}:null;}})['then'](respondWithResult(_0x30e986,null))[_0xe5a3('0x43')](handleError(_0x30e986,null));};exports[_0xe5a3('0x4e')]=function(_0xa696,_0x4acd82,_0x51851d){var _0x1ba323={};var _0x3ad3ee={};var _0x54e2e4;var _0x224f30;return db['SugarcrmConfiguration'][_0xe5a3('0x49')]({'where':{'id':_0xa696[_0xe5a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x4acd82,null))['then'](function(_0x254bc7){if(_0x254bc7){_0x54e2e4=_0x254bc7;_0x3ad3ee[_0xe5a3('0x2e')]=_[_0xe5a3('0x30')](db[_0xe5a3('0x4a')]['rawAttributes']);_0x3ad3ee[_0xe5a3('0x2f')]=_[_0xe5a3('0x30')](_0xa696[_0xe5a3('0x2f')]);_0x3ad3ee['filters']=_[_0xe5a3('0x32')](_0x3ad3ee[_0xe5a3('0x2e')],_0x3ad3ee['query']);_0x1ba323[_0xe5a3('0x33')]=_[_0xe5a3('0x32')](_0x3ad3ee['model'],qs['fields'](_0xa696[_0xe5a3('0x2f')][_0xe5a3('0x34')]));_0x1ba323[_0xe5a3('0x33')]=_0x1ba323['attributes'][_0xe5a3('0x4b')]?_0x1ba323[_0xe5a3('0x33')]:_0x3ad3ee[_0xe5a3('0x2e')];_0x1ba323[_0xe5a3('0x4c')]=qs[_0xe5a3('0x37')](_0xa696[_0xe5a3('0x2f')]['sort']);_0x1ba323['where']=qs['filters'](_[_0xe5a3('0x39')](_0xa696[_0xe5a3('0x2f')],_0x3ad3ee[_0xe5a3('0x31')]));if(_0xa696['query'][_0xe5a3('0x3a')]){_0x1ba323[_0xe5a3('0x38')]=_['merge'](_0x1ba323[_0xe5a3('0x38')],{'$or':_['map'](_0x1ba323[_0xe5a3('0x33')],function(_0xe24a7e){var _0x10265b={};_0x10265b[_0xe24a7e]={'$like':'%'+_0xa696[_0xe5a3('0x2f')][_0xe5a3('0x3a')]+'%'};return _0x10265b;})});}_0x1ba323=_[_0xe5a3('0x3b')]({},_0x1ba323,_0xa696[_0xe5a3('0x3d')]);return _0x54e2e4[_0xe5a3('0x4e')](_0x1ba323);}})[_0xe5a3('0x23')](function(_0x28b576){if(_0x28b576){_0x224f30=_0x28b576[_0xe5a3('0x4b')];if(!_0xa696[_0xe5a3('0x2f')][_0xe5a3('0x35')](_0xe5a3('0x36'))){_0x1ba323['limit']=qs[_0xe5a3('0x1b')](_0xa696['query'][_0xe5a3('0x1b')]);_0x1ba323[_0xe5a3('0x1c')]=qs[_0xe5a3('0x1c')](_0xa696['query'][_0xe5a3('0x1c')]);}return _0x54e2e4['getDescriptions'](_0x1ba323);}})[_0xe5a3('0x23')](function(_0x133470){if(_0x133470){return _0x133470?{'count':_0x224f30,'rows':_0x133470}:null;}})[_0xe5a3('0x23')](respondWithResult(_0x4acd82,null))['catch'](handleError(_0x4acd82,null));}; \ No newline at end of file +var _0xfb75=['params','SugarcrmField','getSubjects','findOne','getDescriptions','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/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','save','update','destroy','then','error','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','getFields'];(function(_0x6059ed,_0x8ea3d2){var _0x5824ff=function(_0x18430d){while(--_0x18430d){_0x6059ed['push'](_0x6059ed['shift']());}};_0x5824ff(++_0x8ea3d2);}(_0xfb75,0x10a));var _0x5fb7=function(_0x209a55,_0x41429f){_0x209a55=_0x209a55-0x0;var _0x219f1a=_0xfb75[_0x209a55];return _0x219f1a;};'use strict';var emlformat=require(_0x5fb7('0x0'));var rimraf=require(_0x5fb7('0x1'));var zipdir=require(_0x5fb7('0x2'));var jsonpatch=require(_0x5fb7('0x3'));var rp=require(_0x5fb7('0x4'));var moment=require(_0x5fb7('0x5'));var BPromise=require(_0x5fb7('0x6'));var Mustache=require(_0x5fb7('0x7'));var util=require(_0x5fb7('0x8'));var path=require('path');var sox=require(_0x5fb7('0x9'));var csv=require(_0x5fb7('0xa'));var ejs=require(_0x5fb7('0xb'));var fs=require('fs');var fs_extra=require(_0x5fb7('0xc'));var _=require(_0x5fb7('0xd'));var squel=require(_0x5fb7('0xe'));var crypto=require(_0x5fb7('0xf'));var jsforce=require(_0x5fb7('0x10'));var deskjs=require(_0x5fb7('0x11'));var toCsv=require(_0x5fb7('0xa'));var querystring=require(_0x5fb7('0x12'));var Papa=require(_0x5fb7('0x13'));var Redis=require(_0x5fb7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x5fb7('0x15'));var as=require(_0x5fb7('0x16'));var hardwareService=require(_0x5fb7('0x17'));var logger=require(_0x5fb7('0x18'))(_0x5fb7('0x19'));var utils=require(_0x5fb7('0x1a'));var config=require(_0x5fb7('0x1b'));var licenseUtil=require(_0x5fb7('0x1c'));var db=require(_0x5fb7('0x1d'))['db'];function respondWithStatusCode(_0x1be3aa,_0x27f5d4){_0x27f5d4=_0x27f5d4||0xcc;return function(_0x466dd6){if(_0x466dd6){return _0x1be3aa[_0x5fb7('0x1e')](_0x27f5d4);}return _0x1be3aa[_0x5fb7('0x1f')](_0x27f5d4)[_0x5fb7('0x20')]();};}function respondWithResult(_0x482ce9,_0x232a79){_0x232a79=_0x232a79||0xc8;return function(_0x2bfd4a){if(_0x2bfd4a){return _0x482ce9[_0x5fb7('0x1f')](_0x232a79)[_0x5fb7('0x21')](_0x2bfd4a);}};}function respondWithFilteredResult(_0x4ea6f0,_0x316667){return function(_0x1cfbac){if(_0x1cfbac){var _0x5a85b2=typeof _0x316667[_0x5fb7('0x22')]===_0x5fb7('0x23')&&typeof _0x316667[_0x5fb7('0x24')]===_0x5fb7('0x23');var _0x5670d7=_0x1cfbac[_0x5fb7('0x25')];var _0x5ac87c=_0x5a85b2?0x0:_0x316667[_0x5fb7('0x22')];var _0xec8084=_0x5a85b2?_0x1cfbac[_0x5fb7('0x25')]:_0x316667['offset']+_0x316667[_0x5fb7('0x24')];var _0x5a73b2;if(_0xec8084>=_0x5670d7){_0xec8084=_0x5670d7;_0x5a73b2=0xc8;}else{_0x5a73b2=0xce;}_0x4ea6f0[_0x5fb7('0x1f')](_0x5a73b2);return _0x4ea6f0[_0x5fb7('0x26')](_0x5fb7('0x27'),_0x5ac87c+'-'+_0xec8084+'/'+_0x5670d7)[_0x5fb7('0x21')](_0x1cfbac);}return null;};}function patchUpdates(_0xd41526){return function(_0x17ce95){try{jsonpatch[_0x5fb7('0x28')](_0x17ce95,_0xd41526,!![]);}catch(_0x539e9b){return BPromise[_0x5fb7('0x29')](_0x539e9b);}return _0x17ce95[_0x5fb7('0x2a')]();};}function saveUpdates(_0x3c189c,_0x52c95f){return function(_0x29da7d){if(_0x29da7d){return _0x29da7d[_0x5fb7('0x2b')](_0x3c189c)['then'](function(_0x545fa8){return _0x545fa8;});}return null;};}function removeEntity(_0x3b1661,_0x44fbfe){return function(_0x3a533a){if(_0x3a533a){return _0x3a533a[_0x5fb7('0x2c')]()[_0x5fb7('0x2d')](function(){_0x3b1661[_0x5fb7('0x1f')](0xcc)[_0x5fb7('0x20')]();});}};}function handleEntityNotFound(_0x394ba8,_0x56c86f){return function(_0x2fff35){if(!_0x2fff35){_0x394ba8[_0x5fb7('0x1e')](0x194);}return _0x2fff35;};}function handleError(_0x527813,_0x3a1a63){_0x3a1a63=_0x3a1a63||0x1f4;return function(_0x2846eb){logger[_0x5fb7('0x2e')](_0x2846eb['stack']);if(_0x2846eb[_0x5fb7('0x2f')]){delete _0x2846eb['name'];}_0x527813[_0x5fb7('0x1f')](_0x3a1a63)['send'](_0x2846eb);};}exports[_0x5fb7('0x30')]=function(_0x549cbb,_0x5923a2){var _0x558dd0={},_0x568673={},_0x2d560d={'count':0x0,'rows':[]};var _0xfc8ab9=_[_0x5fb7('0x31')](db[_0x5fb7('0x32')][_0x5fb7('0x33')],function(_0x38089f){return{'name':_0x38089f[_0x5fb7('0x34')],'type':_0x38089f[_0x5fb7('0x35')][_0x5fb7('0x36')]};});_0x568673[_0x5fb7('0x37')]=_['map'](_0xfc8ab9,_0x5fb7('0x2f'));_0x568673[_0x5fb7('0x38')]=_[_0x5fb7('0x39')](_0x549cbb['query']);_0x568673[_0x5fb7('0x3a')]=_[_0x5fb7('0x3b')](_0x568673[_0x5fb7('0x37')],_0x568673[_0x5fb7('0x38')]);_0x558dd0[_0x5fb7('0x3c')]=_['intersection'](_0x568673[_0x5fb7('0x37')],qs[_0x5fb7('0x3d')](_0x549cbb[_0x5fb7('0x38')][_0x5fb7('0x3d')]));_0x558dd0[_0x5fb7('0x3c')]=_0x558dd0[_0x5fb7('0x3c')][_0x5fb7('0x3e')]?_0x558dd0['attributes']:_0x568673['model'];if(!_0x549cbb['query'][_0x5fb7('0x3f')](_0x5fb7('0x40'))){_0x558dd0[_0x5fb7('0x24')]=qs['limit'](_0x549cbb[_0x5fb7('0x38')][_0x5fb7('0x24')]);_0x558dd0['offset']=qs['offset'](_0x549cbb[_0x5fb7('0x38')]['offset']);}_0x558dd0[_0x5fb7('0x41')]=qs[_0x5fb7('0x42')](_0x549cbb[_0x5fb7('0x38')][_0x5fb7('0x42')]);_0x558dd0[_0x5fb7('0x43')]=qs['filters'](_[_0x5fb7('0x44')](_0x549cbb[_0x5fb7('0x38')],_0x568673[_0x5fb7('0x3a')]),_0xfc8ab9);if(_0x549cbb[_0x5fb7('0x38')][_0x5fb7('0x45')]){_0x558dd0[_0x5fb7('0x43')]=_[_0x5fb7('0x46')](_0x558dd0[_0x5fb7('0x43')],{'$or':_['map'](_0xfc8ab9,function(_0x4cecce){if(_0x4cecce[_0x5fb7('0x35')]!=='VIRTUAL'){var _0x1cf07b={};_0x1cf07b[_0x4cecce['name']]={'$like':'%'+_0x549cbb[_0x5fb7('0x38')]['filter']+'%'};return _0x1cf07b;}})});}_0x558dd0=_[_0x5fb7('0x46')]({},_0x558dd0,_0x549cbb[_0x5fb7('0x47')]);var _0x5d1d4e={'where':_0x558dd0[_0x5fb7('0x43')]};return db[_0x5fb7('0x32')]['count'](_0x5d1d4e)[_0x5fb7('0x2d')](function(_0x347926){_0x2d560d[_0x5fb7('0x25')]=_0x347926;if(_0x549cbb[_0x5fb7('0x38')]['includeAll']){_0x558dd0[_0x5fb7('0x48')]=[{'all':!![]}];}return db[_0x5fb7('0x32')][_0x5fb7('0x49')](_0x558dd0);})[_0x5fb7('0x2d')](function(_0x7fcdeb){_0x2d560d[_0x5fb7('0x4a')]=_0x7fcdeb;return _0x2d560d;})[_0x5fb7('0x2d')](respondWithFilteredResult(_0x5923a2,_0x558dd0))[_0x5fb7('0x4b')](handleError(_0x5923a2,null));};exports[_0x5fb7('0x4c')]=function(_0x255227,_0x24d469){var _0x142d17={'raw':![],'where':{'id':_0x255227['params']['id']}},_0x32fbe5={};_0x32fbe5[_0x5fb7('0x37')]=_[_0x5fb7('0x39')](db[_0x5fb7('0x32')]['rawAttributes']);_0x32fbe5[_0x5fb7('0x38')]=_['keys'](_0x255227['query']);_0x32fbe5['filters']=_[_0x5fb7('0x3b')](_0x32fbe5[_0x5fb7('0x37')],_0x32fbe5[_0x5fb7('0x38')]);_0x142d17['attributes']=_[_0x5fb7('0x3b')](_0x32fbe5[_0x5fb7('0x37')],qs[_0x5fb7('0x3d')](_0x255227[_0x5fb7('0x38')]['fields']));_0x142d17[_0x5fb7('0x3c')]=_0x142d17[_0x5fb7('0x3c')][_0x5fb7('0x3e')]?_0x142d17[_0x5fb7('0x3c')]:_0x32fbe5[_0x5fb7('0x37')];if(_0x255227['query'][_0x5fb7('0x4d')]){_0x142d17[_0x5fb7('0x48')]=[{'all':!![]}];}_0x142d17=_[_0x5fb7('0x46')]({},_0x142d17,_0x255227['options']);return db['SugarcrmConfiguration'][_0x5fb7('0x4e')](_0x142d17)['then'](handleEntityNotFound(_0x24d469,null))[_0x5fb7('0x2d')](respondWithResult(_0x24d469,null))[_0x5fb7('0x4b')](handleError(_0x24d469,null));};exports['create']=function(_0x34fb85,_0xed8724){return db[_0x5fb7('0x32')][_0x5fb7('0x4f')](_0x34fb85[_0x5fb7('0x50')],{})[_0x5fb7('0x2d')](respondWithResult(_0xed8724,0xc9))[_0x5fb7('0x4b')](handleError(_0xed8724,null));};exports[_0x5fb7('0x2b')]=function(_0x5ece3e,_0x3f21ae){if(_0x5ece3e['body']['id']){delete _0x5ece3e[_0x5fb7('0x50')]['id'];}return db[_0x5fb7('0x32')][_0x5fb7('0x4e')]({'where':{'id':_0x5ece3e['params']['id']}})[_0x5fb7('0x2d')](handleEntityNotFound(_0x3f21ae,null))[_0x5fb7('0x2d')](saveUpdates(_0x5ece3e[_0x5fb7('0x50')],null))['then'](respondWithResult(_0x3f21ae,null))[_0x5fb7('0x4b')](handleError(_0x3f21ae,null));};exports[_0x5fb7('0x2c')]=function(_0x1d964b,_0x392fdd){return db['SugarcrmConfiguration'][_0x5fb7('0x4e')]({'where':{'id':_0x1d964b['params']['id']}})['then'](handleEntityNotFound(_0x392fdd,null))[_0x5fb7('0x2d')](removeEntity(_0x392fdd,null))[_0x5fb7('0x4b')](handleError(_0x392fdd,null));};exports[_0x5fb7('0x51')]=function(_0x5c2927,_0x5addf5,_0x65d489){var _0x1f04a4={};var _0x27b8de={};var _0x47f85b;var _0x14b478;return db[_0x5fb7('0x32')]['findOne']({'where':{'id':_0x5c2927[_0x5fb7('0x52')]['id']}})[_0x5fb7('0x2d')](handleEntityNotFound(_0x5addf5,null))[_0x5fb7('0x2d')](function(_0x27582c){if(_0x27582c){_0x47f85b=_0x27582c;_0x27b8de['model']=_[_0x5fb7('0x39')](db[_0x5fb7('0x53')]['rawAttributes']);_0x27b8de[_0x5fb7('0x38')]=_[_0x5fb7('0x39')](_0x5c2927[_0x5fb7('0x38')]);_0x27b8de[_0x5fb7('0x3a')]=_[_0x5fb7('0x3b')](_0x27b8de[_0x5fb7('0x37')],_0x27b8de['query']);_0x1f04a4[_0x5fb7('0x3c')]=_[_0x5fb7('0x3b')](_0x27b8de[_0x5fb7('0x37')],qs['fields'](_0x5c2927[_0x5fb7('0x38')][_0x5fb7('0x3d')]));_0x1f04a4['attributes']=_0x1f04a4[_0x5fb7('0x3c')][_0x5fb7('0x3e')]?_0x1f04a4['attributes']:_0x27b8de[_0x5fb7('0x37')];_0x1f04a4[_0x5fb7('0x41')]=qs[_0x5fb7('0x42')](_0x5c2927['query'][_0x5fb7('0x42')]);_0x1f04a4[_0x5fb7('0x43')]=qs[_0x5fb7('0x3a')](_['pick'](_0x5c2927[_0x5fb7('0x38')],_0x27b8de[_0x5fb7('0x3a')]));if(_0x5c2927[_0x5fb7('0x38')][_0x5fb7('0x45')]){_0x1f04a4[_0x5fb7('0x43')]=_['merge'](_0x1f04a4[_0x5fb7('0x43')],{'$or':_['map'](_0x1f04a4['attributes'],function(_0x33ca5f){var _0x312437={};_0x312437[_0x33ca5f]={'$like':'%'+_0x5c2927[_0x5fb7('0x38')][_0x5fb7('0x45')]+'%'};return _0x312437;})});}_0x1f04a4=_[_0x5fb7('0x46')]({},_0x1f04a4,_0x5c2927[_0x5fb7('0x47')]);return _0x47f85b[_0x5fb7('0x51')](_0x1f04a4);}})[_0x5fb7('0x2d')](function(_0xc70b4c){if(_0xc70b4c){_0x14b478=_0xc70b4c['length'];if(!_0x5c2927[_0x5fb7('0x38')]['hasOwnProperty']('nolimit')){_0x1f04a4['limit']=qs[_0x5fb7('0x24')](_0x5c2927['query'][_0x5fb7('0x24')]);_0x1f04a4[_0x5fb7('0x22')]=qs[_0x5fb7('0x22')](_0x5c2927[_0x5fb7('0x38')][_0x5fb7('0x22')]);}return _0x47f85b[_0x5fb7('0x51')](_0x1f04a4);}})[_0x5fb7('0x2d')](function(_0x319b91){if(_0x319b91){return _0x319b91?{'count':_0x14b478,'rows':_0x319b91}:null;}})[_0x5fb7('0x2d')](respondWithResult(_0x5addf5,null))[_0x5fb7('0x4b')](handleError(_0x5addf5,null));};exports[_0x5fb7('0x54')]=function(_0x5080b9,_0x34b292,_0x23c479){var _0x1f6095={};var _0x543e42={};var _0x872d4a;var _0x26b315;return db[_0x5fb7('0x32')][_0x5fb7('0x55')]({'where':{'id':_0x5080b9['params']['id']}})[_0x5fb7('0x2d')](handleEntityNotFound(_0x34b292,null))['then'](function(_0xec29ab){if(_0xec29ab){_0x872d4a=_0xec29ab;_0x543e42[_0x5fb7('0x37')]=_['keys'](db[_0x5fb7('0x53')][_0x5fb7('0x33')]);_0x543e42[_0x5fb7('0x38')]=_[_0x5fb7('0x39')](_0x5080b9[_0x5fb7('0x38')]);_0x543e42['filters']=_[_0x5fb7('0x3b')](_0x543e42['model'],_0x543e42['query']);_0x1f6095[_0x5fb7('0x3c')]=_['intersection'](_0x543e42[_0x5fb7('0x37')],qs[_0x5fb7('0x3d')](_0x5080b9[_0x5fb7('0x38')]['fields']));_0x1f6095['attributes']=_0x1f6095[_0x5fb7('0x3c')][_0x5fb7('0x3e')]?_0x1f6095[_0x5fb7('0x3c')]:_0x543e42['model'];_0x1f6095[_0x5fb7('0x41')]=qs['sort'](_0x5080b9[_0x5fb7('0x38')][_0x5fb7('0x42')]);_0x1f6095[_0x5fb7('0x43')]=qs[_0x5fb7('0x3a')](_[_0x5fb7('0x44')](_0x5080b9['query'],_0x543e42['filters']));if(_0x5080b9[_0x5fb7('0x38')][_0x5fb7('0x45')]){_0x1f6095[_0x5fb7('0x43')]=_[_0x5fb7('0x46')](_0x1f6095[_0x5fb7('0x43')],{'$or':_[_0x5fb7('0x31')](_0x1f6095['attributes'],function(_0x181449){var _0x134e9f={};_0x134e9f[_0x181449]={'$like':'%'+_0x5080b9[_0x5fb7('0x38')][_0x5fb7('0x45')]+'%'};return _0x134e9f;})});}_0x1f6095=_['merge']({},_0x1f6095,_0x5080b9[_0x5fb7('0x47')]);return _0x872d4a[_0x5fb7('0x54')](_0x1f6095);}})[_0x5fb7('0x2d')](function(_0x3de547){if(_0x3de547){_0x26b315=_0x3de547[_0x5fb7('0x3e')];if(!_0x5080b9[_0x5fb7('0x38')][_0x5fb7('0x3f')](_0x5fb7('0x40'))){_0x1f6095[_0x5fb7('0x24')]=qs['limit'](_0x5080b9[_0x5fb7('0x38')][_0x5fb7('0x24')]);_0x1f6095[_0x5fb7('0x22')]=qs[_0x5fb7('0x22')](_0x5080b9['query'][_0x5fb7('0x22')]);}return _0x872d4a['getSubjects'](_0x1f6095);}})[_0x5fb7('0x2d')](function(_0x3e224a){if(_0x3e224a){return _0x3e224a?{'count':_0x26b315,'rows':_0x3e224a}:null;}})[_0x5fb7('0x2d')](respondWithResult(_0x34b292,null))['catch'](handleError(_0x34b292,null));};exports['getDescriptions']=function(_0x31efa6,_0x1fa4c6,_0x36086e){var _0x2a3ce3={};var _0x53e018={};var _0x484b1a;var _0x189ff3;return db[_0x5fb7('0x32')]['findOne']({'where':{'id':_0x31efa6[_0x5fb7('0x52')]['id']}})[_0x5fb7('0x2d')](handleEntityNotFound(_0x1fa4c6,null))['then'](function(_0x1f166e){if(_0x1f166e){_0x484b1a=_0x1f166e;_0x53e018[_0x5fb7('0x37')]=_[_0x5fb7('0x39')](db[_0x5fb7('0x53')][_0x5fb7('0x33')]);_0x53e018['query']=_[_0x5fb7('0x39')](_0x31efa6[_0x5fb7('0x38')]);_0x53e018[_0x5fb7('0x3a')]=_[_0x5fb7('0x3b')](_0x53e018[_0x5fb7('0x37')],_0x53e018[_0x5fb7('0x38')]);_0x2a3ce3[_0x5fb7('0x3c')]=_[_0x5fb7('0x3b')](_0x53e018[_0x5fb7('0x37')],qs[_0x5fb7('0x3d')](_0x31efa6[_0x5fb7('0x38')][_0x5fb7('0x3d')]));_0x2a3ce3[_0x5fb7('0x3c')]=_0x2a3ce3[_0x5fb7('0x3c')][_0x5fb7('0x3e')]?_0x2a3ce3[_0x5fb7('0x3c')]:_0x53e018[_0x5fb7('0x37')];_0x2a3ce3[_0x5fb7('0x41')]=qs[_0x5fb7('0x42')](_0x31efa6[_0x5fb7('0x38')][_0x5fb7('0x42')]);_0x2a3ce3[_0x5fb7('0x43')]=qs[_0x5fb7('0x3a')](_[_0x5fb7('0x44')](_0x31efa6[_0x5fb7('0x38')],_0x53e018[_0x5fb7('0x3a')]));if(_0x31efa6[_0x5fb7('0x38')]['filter']){_0x2a3ce3[_0x5fb7('0x43')]=_['merge'](_0x2a3ce3[_0x5fb7('0x43')],{'$or':_[_0x5fb7('0x31')](_0x2a3ce3['attributes'],function(_0x31dcd1){var _0x4a522f={};_0x4a522f[_0x31dcd1]={'$like':'%'+_0x31efa6[_0x5fb7('0x38')][_0x5fb7('0x45')]+'%'};return _0x4a522f;})});}_0x2a3ce3=_[_0x5fb7('0x46')]({},_0x2a3ce3,_0x31efa6[_0x5fb7('0x47')]);return _0x484b1a[_0x5fb7('0x56')](_0x2a3ce3);}})['then'](function(_0x218af0){if(_0x218af0){_0x189ff3=_0x218af0[_0x5fb7('0x3e')];if(!_0x31efa6[_0x5fb7('0x38')][_0x5fb7('0x3f')]('nolimit')){_0x2a3ce3[_0x5fb7('0x24')]=qs[_0x5fb7('0x24')](_0x31efa6[_0x5fb7('0x38')]['limit']);_0x2a3ce3[_0x5fb7('0x22')]=qs['offset'](_0x31efa6['query'][_0x5fb7('0x22')]);}return _0x484b1a[_0x5fb7('0x56')](_0x2a3ce3);}})[_0x5fb7('0x2d')](function(_0x1976c8){if(_0x1976c8){return _0x1976c8?{'count':_0x189ff3,'rows':_0x1976c8}:null;}})['then'](respondWithResult(_0x1fa4c6,null))['catch'](handleError(_0x1fa4c6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a54bf1d..c21e32e 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 _0xb88c=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44a7af,_0x26bcf5){var _0x293b71=function(_0x592359){while(--_0x592359){_0x44a7af['push'](_0x44a7af['shift']());}};_0x293b71(++_0x26bcf5);}(_0xb88c,0x14b));var _0xcb88=function(_0x28369b,_0x2db6f0){_0x28369b=_0x28369b-0x0;var _0xe4d707=_0xb88c[_0x28369b];return _0xe4d707;};'use strict';var _=require('lodash');var util=require(_0xcb88('0x0'));var logger=require('../../config/logger')(_0xcb88('0x1'));var moment=require(_0xcb88('0x2'));var BPromise=require(_0xcb88('0x3'));var rp=require(_0xcb88('0x4'));var fs=require('fs');var path=require(_0xcb88('0x5'));var rimraf=require(_0xcb88('0x6'));var config=require(_0xcb88('0x7'));var attributes=require(_0xcb88('0x8'));module[_0xcb88('0x9')]=function(_0x398b38,_0x33ac15){return _0x398b38[_0xcb88('0xa')](_0xcb88('0xb'),attributes,{'tableName':_0xcb88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda01=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','../../config/logger','api','bluebird'];(function(_0x485359,_0x16dbe4){var _0x238dc0=function(_0x57f814){while(--_0x57f814){_0x485359['push'](_0x485359['shift']());}};_0x238dc0(++_0x16dbe4);}(_0xda01,0xbb));var _0x1da0=function(_0x206e49,_0x367f5a){_0x206e49=_0x206e49-0x0;var _0x18e07c=_0xda01[_0x206e49];return _0x18e07c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1da0('0x0'))(_0x1da0('0x1'));var moment=require('moment');var BPromise=require(_0x1da0('0x2'));var rp=require(_0x1da0('0x3'));var fs=require('fs');var path=require(_0x1da0('0x4'));var rimraf=require(_0x1da0('0x5'));var config=require(_0x1da0('0x6'));var attributes=require(_0x1da0('0x7'));module['exports']=function(_0x45eee7,_0x12514b){return _0x45eee7[_0x1da0('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0x1da0('0x9'),'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 ebe7f46..92d318e 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 _0x44ec=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x500be5,_0x380187){var _0x19d644=function(_0x38b462){while(--_0x38b462){_0x500be5['push'](_0x500be5['shift']());}};_0x19d644(++_0x380187);}(_0x44ec,0x1f3));var _0xc44e=function(_0x3b6275,_0x13324a){_0x3b6275=_0x3b6275-0x0;var _0x59b306=_0x44ec[_0x3b6275];return _0x59b306;};'use strict';var _=require(_0xc44e('0x0'));var util=require(_0xc44e('0x1'));var moment=require('moment');var BPromise=require(_0xc44e('0x2'));var rs=require(_0xc44e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc44e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc44e('0x5'));var config=require(_0xc44e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc44e('0x7')][_0xc44e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x237dd1,_0x38b0a0,_0x40d3e3){return new BPromise(function(_0x307564,_0x4b39b2){return client[_0xc44e('0x9')](_0x237dd1,_0x40d3e3)[_0xc44e('0xa')](function(_0x37911a){logger[_0xc44e('0xb')](_0xc44e('0xc'),_0x38b0a0,_0xc44e('0xd'));logger[_0xc44e('0xe')](_0xc44e('0xf'),_0x38b0a0,_0xc44e('0xd'),JSON['stringify'](_0x37911a));if(_0x37911a[_0xc44e('0x10')]){if(_0x37911a[_0xc44e('0x10')][_0xc44e('0x11')]===0x1f4){logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x37911a['error'][_0xc44e('0x12')]);return _0x4b39b2(_0x37911a[_0xc44e('0x10')][_0xc44e('0x12')]);}logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x37911a[_0xc44e('0x10')][_0xc44e('0x12')]);return _0x307564(_0x37911a['error']['message']);}else{logger[_0xc44e('0xb')](_0xc44e('0xc'),_0x38b0a0,_0xc44e('0xd'));_0x307564(_0x37911a['result'][_0xc44e('0x12')]);}})['catch'](function(_0x372628){logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x372628);_0x4b39b2(_0x372628);});});} \ No newline at end of file +var _0x38c0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3e9845,_0x30a9c5){var _0x4f3ee6=function(_0x24abf5){while(--_0x24abf5){_0x3e9845['push'](_0x3e9845['shift']());}};_0x4f3ee6(++_0x30a9c5);}(_0x38c0,0x7a));var _0x038c=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x38c0[_0x560448];return _0x550276;};'use strict';var _=require(_0x038c('0x0'));var util=require(_0x038c('0x1'));var moment=require(_0x038c('0x2'));var BPromise=require(_0x038c('0x3'));var rs=require(_0x038c('0x4'));var fs=require('fs');var Redis=require(_0x038c('0x5'));var db=require(_0x038c('0x6'))['db'];var utils=require(_0x038c('0x7'));var logger=require(_0x038c('0x8'))(_0x038c('0x9'));var config=require(_0x038c('0xa'));var jayson=require(_0x038c('0xb'));var client=jayson[_0x038c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304474,_0x119741,_0x34ee6b){return new BPromise(function(_0x4909fc,_0x29aa8b){return client[_0x038c('0xd')](_0x304474,_0x34ee6b)[_0x038c('0xe')](function(_0x575fa1){logger['info'](_0x038c('0xf'),_0x119741,_0x038c('0x10'));logger[_0x038c('0x11')](_0x038c('0x12'),_0x119741,_0x038c('0x10'),JSON[_0x038c('0x13')](_0x575fa1));if(_0x575fa1[_0x038c('0x14')]){if(_0x575fa1[_0x038c('0x14')][_0x038c('0x15')]===0x1f4){logger['error'](_0x038c('0xf'),_0x119741,_0x575fa1[_0x038c('0x14')][_0x038c('0x16')]);return _0x29aa8b(_0x575fa1[_0x038c('0x14')][_0x038c('0x16')]);}logger[_0x038c('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x119741,_0x575fa1['error'][_0x038c('0x16')]);return _0x4909fc(_0x575fa1[_0x038c('0x14')][_0x038c('0x16')]);}else{logger[_0x038c('0x17')](_0x038c('0xf'),_0x119741,_0x038c('0x10'));_0x4909fc(_0x575fa1[_0x038c('0x18')][_0x038c('0x16')]);}})[_0x038c('0x19')](function(_0x5373ed){logger[_0x038c('0x14')](_0x038c('0xf'),_0x119741,_0x5373ed);_0x29aa8b(_0x5373ed);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 22fe803..b861955 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 _0xbdfd=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','delete','exports','multer'];(function(_0xaa1a60,_0x1dcf7a){var _0x134681=function(_0x55e5fe){while(--_0x55e5fe){_0xaa1a60['push'](_0xaa1a60['shift']());}};_0x134681(++_0x1dcf7a);}(_0xbdfd,0x99));var _0xdbdf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbdfd[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xdbdf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdbdf('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbdf('0x2'));var auth=require(_0xdbdf('0x3'));var interaction=require(_0xdbdf('0x4'));var config=require(_0xdbdf('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdbdf('0x6')]('/:id',auth[_0xdbdf('0x7')](),controller[_0xdbdf('0x8')]);router['post']('/',auth[_0xdbdf('0x7')](),controller[_0xdbdf('0x9')]);router[_0xdbdf('0xa')](_0xdbdf('0xb'),auth[_0xdbdf('0x7')](),controller['update']);router[_0xdbdf('0xc')](_0xdbdf('0xb'),auth[_0xdbdf('0x7')](),controller['destroy']);module[_0xdbdf('0xd')]=router; \ No newline at end of file +var _0x9da9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x9da9,0xe0));var _0x99da=function(_0x3e7653,_0x414e83){_0x3e7653=_0x3e7653-0x0;var _0x2d518d=_0x9da9[_0x3e7653];return _0x2d518d;};'use strict';var multer=require(_0x99da('0x0'));var util=require(_0x99da('0x1'));var path=require(_0x99da('0x2'));var timeout=require(_0x99da('0x3'));var express=require(_0x99da('0x4'));var router=express[_0x99da('0x5')]();var fs_extra=require(_0x99da('0x6'));var auth=require(_0x99da('0x7'));var interaction=require(_0x99da('0x8'));var config=require('../../config/environment');var controller=require(_0x99da('0x9'));router[_0x99da('0xa')]('/',auth[_0x99da('0xb')](),controller[_0x99da('0xc')]);router[_0x99da('0xa')](_0x99da('0xd'),auth[_0x99da('0xb')](),controller['show']);router[_0x99da('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x99da('0xd'),auth[_0x99da('0xb')](),controller[_0x99da('0xf')]);router[_0x99da('0x10')](_0x99da('0xd'),auth[_0x99da('0xb')](),controller[_0x99da('0x11')]);module[_0x99da('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0b259f3..03d12aa 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 _0x1a3a=['variable','customVariable','picklist','string','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x1a3a,0x187));var _0xa1a3=function(_0x124b8d,_0x2e2afb){_0x124b8d=_0x124b8d-0x0;var _0x3b8120=_0x1a3a[_0x124b8d];return _0x3b8120;};'use strict';var Sequelize=require(_0xa1a3('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xa1a3('0x1'),_0xa1a3('0x2'),'keyValue',_0xa1a3('0x3')),'defaultValue':_0xa1a3('0x4')},'content':{'type':Sequelize[_0xa1a3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa1a3('0x6')](_0xa1a3('0x4'),_0xa1a3('0x1'),_0xa1a3('0x2'))},'keyContent':{'type':Sequelize[_0xa1a3('0x5')]},'idField':{'type':Sequelize[_0xa1a3('0x5')]},'nameField':{'type':Sequelize[_0xa1a3('0x5')]},'customField':{'type':Sequelize[_0xa1a3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa1a3('0x5')]}}; \ No newline at end of file +var _0xd2e8=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x335022,_0x1b4896){var _0x37498f=function(_0x2b7893){while(--_0x2b7893){_0x335022['push'](_0x335022['shift']());}};_0x37498f(++_0x1b4896);}(_0xd2e8,0x18c));var _0x8d2e=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0xd2e8[_0x4b3300];return _0x2d26d3;};'use strict';var Sequelize=require(_0x8d2e('0x0'));module['exports']={'type':{'type':Sequelize[_0x8d2e('0x1')](_0x8d2e('0x2'),_0x8d2e('0x3'),'customVariable',_0x8d2e('0x4'),_0x8d2e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8d2e('0x2'),_0x8d2e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8d2e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8d2e('0x6')]},'customField':{'type':Sequelize[_0x8d2e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8d2e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index bfca676..1a72154 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 _0x0398=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0398,0x16d));var _0x8039=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x0398[_0x5a6de2];return _0x2c0525;};'use strict';var emlformat=require(_0x8039('0x0'));var rimraf=require(_0x8039('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8039('0x2'));var moment=require(_0x8039('0x3'));var BPromise=require(_0x8039('0x4'));var Mustache=require(_0x8039('0x5'));var util=require(_0x8039('0x6'));var path=require(_0x8039('0x7'));var sox=require(_0x8039('0x8'));var csv=require(_0x8039('0x9'));var ejs=require(_0x8039('0xa'));var fs=require('fs');var fs_extra=require(_0x8039('0xb'));var _=require(_0x8039('0xc'));var squel=require(_0x8039('0xd'));var crypto=require('crypto');var jsforce=require(_0x8039('0xe'));var deskjs=require(_0x8039('0xf'));var toCsv=require(_0x8039('0x9'));var querystring=require(_0x8039('0x10'));var Papa=require(_0x8039('0x11'));var Redis=require(_0x8039('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8039('0x13'));var hardwareService=require(_0x8039('0x14'));var logger=require('../../config/logger')(_0x8039('0x15'));var utils=require(_0x8039('0x16'));var config=require(_0x8039('0x17'));var licenseUtil=require(_0x8039('0x18'));var db=require(_0x8039('0x19'))['db'];function respondWithStatusCode(_0x5f4cab,_0xd080d3){_0xd080d3=_0xd080d3||0xcc;return function(_0x48ecff){if(_0x48ecff){return _0x5f4cab['sendStatus'](_0xd080d3);}return _0x5f4cab[_0x8039('0x1a')](_0xd080d3)['end']();};}function respondWithResult(_0x1f0834,_0xb52c85){_0xb52c85=_0xb52c85||0xc8;return function(_0xa373e3){if(_0xa373e3){return _0x1f0834['status'](_0xb52c85)[_0x8039('0x1b')](_0xa373e3);}};}function respondWithFilteredResult(_0x5c657a,_0x4c271a){return function(_0x503f48){if(_0x503f48){var _0x537117=typeof _0x4c271a[_0x8039('0x1c')]===_0x8039('0x1d')&&typeof _0x4c271a[_0x8039('0x1e')]===_0x8039('0x1d');var _0x9bf450=_0x503f48[_0x8039('0x1f')];var _0x5435db=_0x537117?0x0:_0x4c271a[_0x8039('0x1c')];var _0x293126=_0x537117?_0x503f48[_0x8039('0x1f')]:_0x4c271a[_0x8039('0x1c')]+_0x4c271a[_0x8039('0x1e')];var _0xc74460;if(_0x293126>=_0x9bf450){_0x293126=_0x9bf450;_0xc74460=0xc8;}else{_0xc74460=0xce;}_0x5c657a[_0x8039('0x1a')](_0xc74460);return _0x5c657a['set']('Content-Range',_0x5435db+'-'+_0x293126+'/'+_0x9bf450)[_0x8039('0x1b')](_0x503f48);}return null;};}function patchUpdates(_0x70d2e0){return function(_0x57e4ff){try{jsonpatch[_0x8039('0x20')](_0x57e4ff,_0x70d2e0,!![]);}catch(_0x4881f0){return BPromise[_0x8039('0x21')](_0x4881f0);}return _0x57e4ff['save']();};}function saveUpdates(_0x8e30b6,_0x546742){return function(_0xc1230f){if(_0xc1230f){return _0xc1230f[_0x8039('0x22')](_0x8e30b6)[_0x8039('0x23')](function(_0x56b97c){return _0x56b97c;});}return null;};}function removeEntity(_0x55cf15,_0x5d138a){return function(_0x18efab){if(_0x18efab){return _0x18efab[_0x8039('0x24')]()[_0x8039('0x23')](function(){_0x55cf15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d827,_0x23e04e){return function(_0x22c5b9){if(!_0x22c5b9){_0x13d827['sendStatus'](0x194);}return _0x22c5b9;};}function handleError(_0xcc08c6,_0x3535f0){_0x3535f0=_0x3535f0||0x1f4;return function(_0x511aa2){logger[_0x8039('0x25')](_0x511aa2[_0x8039('0x26')]);if(_0x511aa2[_0x8039('0x27')]){delete _0x511aa2[_0x8039('0x27')];}_0xcc08c6[_0x8039('0x1a')](_0x3535f0)[_0x8039('0x28')](_0x511aa2);};}exports['index']=function(_0x3f7e4e,_0xd6abef){var _0x4548a9={},_0x4b307b={},_0x2b9f3e={'count':0x0,'rows':[]};var _0x2f4738=_[_0x8039('0x29')](db[_0x8039('0x2a')]['rawAttributes'],function(_0xf832cf){return{'name':_0xf832cf['fieldName'],'type':_0xf832cf[_0x8039('0x2b')][_0x8039('0x2c')]};});_0x4b307b[_0x8039('0x2d')]=_[_0x8039('0x29')](_0x2f4738,_0x8039('0x27'));_0x4b307b[_0x8039('0x2e')]=_[_0x8039('0x2f')](_0x3f7e4e['query']);_0x4b307b[_0x8039('0x30')]=_[_0x8039('0x31')](_0x4b307b['model'],_0x4b307b[_0x8039('0x2e')]);_0x4548a9[_0x8039('0x32')]=_[_0x8039('0x31')](_0x4b307b['model'],qs[_0x8039('0x33')](_0x3f7e4e[_0x8039('0x2e')][_0x8039('0x33')]));_0x4548a9['attributes']=_0x4548a9['attributes'][_0x8039('0x34')]?_0x4548a9[_0x8039('0x32')]:_0x4b307b[_0x8039('0x2d')];if(!_0x3f7e4e[_0x8039('0x2e')][_0x8039('0x35')](_0x8039('0x36'))){_0x4548a9['limit']=qs[_0x8039('0x1e')](_0x3f7e4e[_0x8039('0x2e')][_0x8039('0x1e')]);_0x4548a9['offset']=qs[_0x8039('0x1c')](_0x3f7e4e[_0x8039('0x2e')]['offset']);}_0x4548a9[_0x8039('0x37')]=qs[_0x8039('0x38')](_0x3f7e4e[_0x8039('0x2e')][_0x8039('0x38')]);_0x4548a9[_0x8039('0x39')]=qs['filters'](_[_0x8039('0x3a')](_0x3f7e4e['query'],_0x4b307b[_0x8039('0x30')]),_0x2f4738);if(_0x3f7e4e['query']['filter']){_0x4548a9[_0x8039('0x39')]=_[_0x8039('0x3b')](_0x4548a9['where'],{'$or':_[_0x8039('0x29')](_0x2f4738,function(_0x39da06){if(_0x39da06[_0x8039('0x2b')]!==_0x8039('0x3c')){var _0x8aedca={};_0x8aedca[_0x39da06[_0x8039('0x27')]]={'$like':'%'+_0x3f7e4e[_0x8039('0x2e')][_0x8039('0x3d')]+'%'};return _0x8aedca;}})});}_0x4548a9=_[_0x8039('0x3b')]({},_0x4548a9,_0x3f7e4e[_0x8039('0x3e')]);var _0x49b297={'where':_0x4548a9[_0x8039('0x39')]};return db[_0x8039('0x2a')][_0x8039('0x1f')](_0x49b297)[_0x8039('0x23')](function(_0x48db9a){_0x2b9f3e[_0x8039('0x1f')]=_0x48db9a;if(_0x3f7e4e[_0x8039('0x2e')]['includeAll']){_0x4548a9[_0x8039('0x3f')]=[{'all':!![]}];}return db[_0x8039('0x2a')]['findAll'](_0x4548a9);})[_0x8039('0x23')](function(_0x582b51){_0x2b9f3e[_0x8039('0x40')]=_0x582b51;return _0x2b9f3e;})[_0x8039('0x23')](respondWithFilteredResult(_0xd6abef,_0x4548a9))['catch'](handleError(_0xd6abef,null));};exports[_0x8039('0x41')]=function(_0x38e29c,_0x16384c){var _0x5327ac={'raw':!![],'where':{'id':_0x38e29c[_0x8039('0x42')]['id']}},_0x3f69a1={};_0x3f69a1[_0x8039('0x2d')]=_[_0x8039('0x2f')](db[_0x8039('0x2a')][_0x8039('0x43')]);_0x3f69a1[_0x8039('0x2e')]=_[_0x8039('0x2f')](_0x38e29c[_0x8039('0x2e')]);_0x3f69a1['filters']=_[_0x8039('0x31')](_0x3f69a1[_0x8039('0x2d')],_0x3f69a1[_0x8039('0x2e')]);_0x5327ac[_0x8039('0x32')]=_[_0x8039('0x31')](_0x3f69a1['model'],qs[_0x8039('0x33')](_0x38e29c[_0x8039('0x2e')][_0x8039('0x33')]));_0x5327ac['attributes']=_0x5327ac[_0x8039('0x32')][_0x8039('0x34')]?_0x5327ac[_0x8039('0x32')]:_0x3f69a1[_0x8039('0x2d')];if(_0x38e29c[_0x8039('0x2e')][_0x8039('0x44')]){_0x5327ac[_0x8039('0x3f')]=[{'all':!![]}];}_0x5327ac=_[_0x8039('0x3b')]({},_0x5327ac,_0x38e29c[_0x8039('0x3e')]);return db[_0x8039('0x2a')][_0x8039('0x45')](_0x5327ac)[_0x8039('0x23')](handleEntityNotFound(_0x16384c,null))[_0x8039('0x23')](respondWithResult(_0x16384c,null))[_0x8039('0x46')](handleError(_0x16384c,null));};exports[_0x8039('0x47')]=function(_0x216974,_0xfd51cd){return db[_0x8039('0x2a')][_0x8039('0x47')](_0x216974[_0x8039('0x48')],{})[_0x8039('0x23')](respondWithResult(_0xfd51cd,0xc9))[_0x8039('0x46')](handleError(_0xfd51cd,null));};exports[_0x8039('0x22')]=function(_0x237ac0,_0x10f053){if(_0x237ac0[_0x8039('0x48')]['id']){delete _0x237ac0['body']['id'];}return db[_0x8039('0x2a')][_0x8039('0x45')]({'where':{'id':_0x237ac0['params']['id']}})['then'](handleEntityNotFound(_0x10f053,null))['then'](saveUpdates(_0x237ac0[_0x8039('0x48')],null))[_0x8039('0x23')](respondWithResult(_0x10f053,null))[_0x8039('0x46')](handleError(_0x10f053,null));};exports[_0x8039('0x24')]=function(_0x41d425,_0x5bb971){return db[_0x8039('0x2a')]['find']({'where':{'id':_0x41d425[_0x8039('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bb971,null))[_0x8039('0x23')](removeEntity(_0x5bb971,null))[_0x8039('0x46')](handleError(_0x5bb971,null));}; \ No newline at end of file +var _0x616a=['catch','show','params','keys','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','SugarcrmField','includeAll','include','findAll','rows'];(function(_0x7c2276,_0x3c148c){var _0x9dbe6c=function(_0x2f7ea9){while(--_0x2f7ea9){_0x7c2276['push'](_0x7c2276['shift']());}};_0x9dbe6c(++_0x3c148c);}(_0x616a,0xf4));var _0xa616=function(_0x1c4279,_0x2d7c69){_0x1c4279=_0x1c4279-0x0;var _0x4565a9=_0x616a[_0x1c4279];return _0x4565a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa616('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa616('0x1'));var rp=require(_0xa616('0x2'));var moment=require(_0xa616('0x3'));var BPromise=require(_0xa616('0x4'));var Mustache=require(_0xa616('0x5'));var util=require('util');var path=require(_0xa616('0x6'));var sox=require('sox');var csv=require(_0xa616('0x7'));var ejs=require(_0xa616('0x8'));var fs=require('fs');var fs_extra=require(_0xa616('0x9'));var _=require(_0xa616('0xa'));var squel=require(_0xa616('0xb'));var crypto=require(_0xa616('0xc'));var jsforce=require(_0xa616('0xd'));var deskjs=require(_0xa616('0xe'));var toCsv=require(_0xa616('0x7'));var querystring=require(_0xa616('0xf'));var Papa=require(_0xa616('0x10'));var Redis=require(_0xa616('0x11'));var authService=require(_0xa616('0x12'));var qs=require(_0xa616('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa616('0x14'));var logger=require('../../config/logger')(_0xa616('0x15'));var utils=require(_0xa616('0x16'));var config=require(_0xa616('0x17'));var licenseUtil=require(_0xa616('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151216,_0x5d930b){_0x5d930b=_0x5d930b||0xcc;return function(_0x5232aa){if(_0x5232aa){return _0x151216[_0xa616('0x19')](_0x5d930b);}return _0x151216['status'](_0x5d930b)[_0xa616('0x1a')]();};}function respondWithResult(_0x1f0b9f,_0xe75fe3){_0xe75fe3=_0xe75fe3||0xc8;return function(_0x2e18c4){if(_0x2e18c4){return _0x1f0b9f[_0xa616('0x1b')](_0xe75fe3)[_0xa616('0x1c')](_0x2e18c4);}};}function respondWithFilteredResult(_0x3c60d9,_0x2f32ff){return function(_0x51e4a3){if(_0x51e4a3){var _0x41f2cd=typeof _0x2f32ff['offset']===_0xa616('0x1d')&&typeof _0x2f32ff[_0xa616('0x1e')]===_0xa616('0x1d');var _0xddba50=_0x51e4a3['count'];var _0x2dfdac=_0x41f2cd?0x0:_0x2f32ff[_0xa616('0x1f')];var _0x2bff0f=_0x41f2cd?_0x51e4a3[_0xa616('0x20')]:_0x2f32ff[_0xa616('0x1f')]+_0x2f32ff['limit'];var _0x13c4e9;if(_0x2bff0f>=_0xddba50){_0x2bff0f=_0xddba50;_0x13c4e9=0xc8;}else{_0x13c4e9=0xce;}_0x3c60d9['status'](_0x13c4e9);return _0x3c60d9['set'](_0xa616('0x21'),_0x2dfdac+'-'+_0x2bff0f+'/'+_0xddba50)[_0xa616('0x1c')](_0x51e4a3);}return null;};}function patchUpdates(_0x5b47ec){return function(_0x1f55d9){try{jsonpatch[_0xa616('0x22')](_0x1f55d9,_0x5b47ec,!![]);}catch(_0x32dc40){return BPromise[_0xa616('0x23')](_0x32dc40);}return _0x1f55d9[_0xa616('0x24')]();};}function saveUpdates(_0x57ab5e,_0x118587){return function(_0x116670){if(_0x116670){return _0x116670[_0xa616('0x25')](_0x57ab5e)[_0xa616('0x26')](function(_0x35d2a4){return _0x35d2a4;});}return null;};}function removeEntity(_0x1cb20c,_0x58b1d3){return function(_0x41891e){if(_0x41891e){return _0x41891e[_0xa616('0x27')]()[_0xa616('0x26')](function(){_0x1cb20c[_0xa616('0x1b')](0xcc)[_0xa616('0x1a')]();});}};}function handleEntityNotFound(_0x58cce1,_0xd917ee){return function(_0xcdb959){if(!_0xcdb959){_0x58cce1[_0xa616('0x19')](0x194);}return _0xcdb959;};}function handleError(_0x5a75e0,_0x53af5a){_0x53af5a=_0x53af5a||0x1f4;return function(_0x2095a6){logger[_0xa616('0x28')](_0x2095a6[_0xa616('0x29')]);if(_0x2095a6[_0xa616('0x2a')]){delete _0x2095a6[_0xa616('0x2a')];}_0x5a75e0['status'](_0x53af5a)[_0xa616('0x2b')](_0x2095a6);};}exports[_0xa616('0x2c')]=function(_0x5ddb86,_0xe351b8){var _0x175319={},_0x3f0911={},_0x30b9cd={'count':0x0,'rows':[]};var _0x382364=_[_0xa616('0x2d')](db['SugarcrmField'][_0xa616('0x2e')],function(_0xaec6b0){return{'name':_0xaec6b0[_0xa616('0x2f')],'type':_0xaec6b0[_0xa616('0x30')][_0xa616('0x31')]};});_0x3f0911[_0xa616('0x32')]=_[_0xa616('0x2d')](_0x382364,_0xa616('0x2a'));_0x3f0911['query']=_['keys'](_0x5ddb86[_0xa616('0x33')]);_0x3f0911[_0xa616('0x34')]=_[_0xa616('0x35')](_0x3f0911[_0xa616('0x32')],_0x3f0911[_0xa616('0x33')]);_0x175319['attributes']=_['intersection'](_0x3f0911[_0xa616('0x32')],qs[_0xa616('0x36')](_0x5ddb86[_0xa616('0x33')][_0xa616('0x36')]));_0x175319['attributes']=_0x175319[_0xa616('0x37')][_0xa616('0x38')]?_0x175319['attributes']:_0x3f0911[_0xa616('0x32')];if(!_0x5ddb86[_0xa616('0x33')][_0xa616('0x39')](_0xa616('0x3a'))){_0x175319[_0xa616('0x1e')]=qs[_0xa616('0x1e')](_0x5ddb86[_0xa616('0x33')][_0xa616('0x1e')]);_0x175319[_0xa616('0x1f')]=qs[_0xa616('0x1f')](_0x5ddb86[_0xa616('0x33')][_0xa616('0x1f')]);}_0x175319[_0xa616('0x3b')]=qs['sort'](_0x5ddb86['query'][_0xa616('0x3c')]);_0x175319['where']=qs[_0xa616('0x34')](_[_0xa616('0x3d')](_0x5ddb86['query'],_0x3f0911[_0xa616('0x34')]),_0x382364);if(_0x5ddb86[_0xa616('0x33')][_0xa616('0x3e')]){_0x175319['where']=_['merge'](_0x175319[_0xa616('0x3f')],{'$or':_[_0xa616('0x2d')](_0x382364,function(_0x5f0be6){if(_0x5f0be6[_0xa616('0x30')]!==_0xa616('0x40')){var _0x369302={};_0x369302[_0x5f0be6[_0xa616('0x2a')]]={'$like':'%'+_0x5ddb86[_0xa616('0x33')][_0xa616('0x3e')]+'%'};return _0x369302;}})});}_0x175319=_[_0xa616('0x41')]({},_0x175319,_0x5ddb86[_0xa616('0x42')]);var _0x324ded={'where':_0x175319[_0xa616('0x3f')]};return db[_0xa616('0x43')]['count'](_0x324ded)[_0xa616('0x26')](function(_0x6390ef){_0x30b9cd['count']=_0x6390ef;if(_0x5ddb86[_0xa616('0x33')][_0xa616('0x44')]){_0x175319[_0xa616('0x45')]=[{'all':!![]}];}return db[_0xa616('0x43')][_0xa616('0x46')](_0x175319);})[_0xa616('0x26')](function(_0x2bcf4f){_0x30b9cd[_0xa616('0x47')]=_0x2bcf4f;return _0x30b9cd;})[_0xa616('0x26')](respondWithFilteredResult(_0xe351b8,_0x175319))[_0xa616('0x48')](handleError(_0xe351b8,null));};exports[_0xa616('0x49')]=function(_0x2bdb5d,_0x32d1e7){var _0x1d8a88={'raw':!![],'where':{'id':_0x2bdb5d[_0xa616('0x4a')]['id']}},_0x44a7af={};_0x44a7af[_0xa616('0x32')]=_[_0xa616('0x4b')](db[_0xa616('0x43')][_0xa616('0x2e')]);_0x44a7af[_0xa616('0x33')]=_[_0xa616('0x4b')](_0x2bdb5d['query']);_0x44a7af[_0xa616('0x34')]=_[_0xa616('0x35')](_0x44a7af['model'],_0x44a7af[_0xa616('0x33')]);_0x1d8a88[_0xa616('0x37')]=_[_0xa616('0x35')](_0x44a7af[_0xa616('0x32')],qs['fields'](_0x2bdb5d[_0xa616('0x33')][_0xa616('0x36')]));_0x1d8a88[_0xa616('0x37')]=_0x1d8a88[_0xa616('0x37')][_0xa616('0x38')]?_0x1d8a88['attributes']:_0x44a7af[_0xa616('0x32')];if(_0x2bdb5d['query'][_0xa616('0x44')]){_0x1d8a88[_0xa616('0x45')]=[{'all':!![]}];}_0x1d8a88=_['merge']({},_0x1d8a88,_0x2bdb5d['options']);return db[_0xa616('0x43')]['find'](_0x1d8a88)[_0xa616('0x26')](handleEntityNotFound(_0x32d1e7,null))['then'](respondWithResult(_0x32d1e7,null))[_0xa616('0x48')](handleError(_0x32d1e7,null));};exports[_0xa616('0x4c')]=function(_0x1b641f,_0x205eba){return db[_0xa616('0x43')][_0xa616('0x4c')](_0x1b641f[_0xa616('0x4d')],{})[_0xa616('0x26')](respondWithResult(_0x205eba,0xc9))[_0xa616('0x48')](handleError(_0x205eba,null));};exports[_0xa616('0x25')]=function(_0x4f84d1,_0x3357dd){if(_0x4f84d1['body']['id']){delete _0x4f84d1['body']['id'];}return db[_0xa616('0x43')]['find']({'where':{'id':_0x4f84d1[_0xa616('0x4a')]['id']}})[_0xa616('0x26')](handleEntityNotFound(_0x3357dd,null))['then'](saveUpdates(_0x4f84d1[_0xa616('0x4d')],null))[_0xa616('0x26')](respondWithResult(_0x3357dd,null))[_0xa616('0x48')](handleError(_0x3357dd,null));};exports['destroy']=function(_0x127ef2,_0x52458c){return db['SugarcrmField'][_0xa616('0x4e')]({'where':{'id':_0x127ef2[_0xa616('0x4a')]['id']}})[_0xa616('0x26')](handleEntityNotFound(_0x52458c,null))[_0xa616('0x26')](removeEntity(_0x52458c,null))['catch'](handleError(_0x52458c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 02aea0b..2c919ac 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 _0xd569=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1c0817,_0x1095bc){var _0x20c06b=function(_0x3f739f){while(--_0x3f739f){_0x1c0817['push'](_0x1c0817['shift']());}};_0x20c06b(++_0x1095bc);}(_0xd569,0xbe));var _0x9d56=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xd569[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x9d56('0x0'));var util=require(_0x9d56('0x1'));var logger=require(_0x9d56('0x2'))(_0x9d56('0x3'));var moment=require(_0x9d56('0x4'));var BPromise=require('bluebird');var rp=require(_0x9d56('0x5'));var fs=require('fs');var path=require(_0x9d56('0x6'));var rimraf=require(_0x9d56('0x7'));var config=require(_0x9d56('0x8'));var attributes=require(_0x9d56('0x9'));module['exports']=function(_0x52a998,_0x48a7b0){return _0x52a998['define'](_0x9d56('0xa'),attributes,{'tableName':_0x9d56('0xb'),'paranoid':![],'indexes':[{'name':_0x9d56('0xc'),'fields':[_0x9d56('0xd'),_0x9d56('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe79=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbe79,0x13f));var _0x9be7=function(_0x279001,_0x42a92f){_0x279001=_0x279001-0x0;var _0x2d731f=_0xbe79[_0x279001];return _0x2d731f;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9be7('0x2'));var BPromise=require(_0x9be7('0x3'));var rp=require(_0x9be7('0x4'));var fs=require('fs');var path=require(_0x9be7('0x5'));var rimraf=require(_0x9be7('0x6'));var config=require(_0x9be7('0x7'));var attributes=require(_0x9be7('0x8'));module[_0x9be7('0x9')]=function(_0x1a9645,_0x18c9e1){return _0x1a9645['define'](_0x9be7('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x9be7('0xb'),'fields':[_0x9be7('0xc'),'FieldId'],'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 4d284f0..2b85883 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 _0xa402=['then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0xecf626,_0x31d164){var _0x17ed8e=function(_0x38dc02){while(--_0x38dc02){_0xecf626['push'](_0xecf626['shift']());}};_0x17ed8e(++_0x31d164);}(_0xa402,0x1f0));var _0x2a40=function(_0x153d3f,_0x242877){_0x153d3f=_0x153d3f-0x0;var _0x3e78a5=_0xa402[_0x153d3f];return _0x3e78a5;};'use strict';var _=require(_0x2a40('0x0'));var util=require('util');var moment=require(_0x2a40('0x1'));var BPromise=require(_0x2a40('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a40('0x3'));var db=require(_0x2a40('0x4'))['db'];var utils=require(_0x2a40('0x5'));var logger=require('../../config/logger')(_0x2a40('0x6'));var config=require(_0x2a40('0x7'));var jayson=require(_0x2a40('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x521ae8,_0x2db996,_0x5394f0){return new BPromise(function(_0x11fa6e,_0x37ebb0){return client[_0x2a40('0x9')](_0x521ae8,_0x5394f0)[_0x2a40('0xa')](function(_0x343515){logger[_0x2a40('0xb')](_0x2a40('0xc'),_0x2db996,'request\x20sent');logger[_0x2a40('0xd')](_0x2a40('0xe'),_0x2db996,'request\x20sent',JSON[_0x2a40('0xf')](_0x343515));if(_0x343515[_0x2a40('0x10')]){if(_0x343515['error'][_0x2a40('0x11')]===0x1f4){logger[_0x2a40('0x10')](_0x2a40('0xc'),_0x2db996,_0x343515[_0x2a40('0x10')][_0x2a40('0x12')]);return _0x37ebb0(_0x343515[_0x2a40('0x10')]['message']);}logger[_0x2a40('0x10')](_0x2a40('0xc'),_0x2db996,_0x343515[_0x2a40('0x10')][_0x2a40('0x12')]);return _0x11fa6e(_0x343515['error']['message']);}else{logger[_0x2a40('0xb')](_0x2a40('0xc'),_0x2db996,_0x2a40('0x13'));_0x11fa6e(_0x343515[_0x2a40('0x14')][_0x2a40('0x12')]);}})[_0x2a40('0x15')](function(_0x21c64f){logger[_0x2a40('0x10')](_0x2a40('0xc'),_0x2db996,_0x21c64f);_0x37ebb0(_0x21c64f);});});} \ No newline at end of file +var _0xf547=['client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4af495,_0x19dc86){var _0x5c1aeb=function(_0x3a7cae){while(--_0x3a7cae){_0x4af495['push'](_0x4af495['shift']());}};_0x5c1aeb(++_0x19dc86);}(_0xf547,0x1ed));var _0x7f54=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xf547[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x7f54('0x0'));var util=require('util');var moment=require(_0x7f54('0x1'));var BPromise=require(_0x7f54('0x2'));var rs=require(_0x7f54('0x3'));var fs=require('fs');var Redis=require(_0x7f54('0x4'));var db=require(_0x7f54('0x5'))['db'];var utils=require(_0x7f54('0x6'));var logger=require(_0x7f54('0x7'))(_0x7f54('0x8'));var config=require(_0x7f54('0x9'));var jayson=require(_0x7f54('0xa'));var client=jayson[_0x7f54('0xb')][_0x7f54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34945f,_0x4899b4,_0x36634a){return new BPromise(function(_0x4e700e,_0x3f43ef){return client[_0x7f54('0xd')](_0x34945f,_0x36634a)[_0x7f54('0xe')](function(_0x57e0d0){logger[_0x7f54('0xf')](_0x7f54('0x10'),_0x4899b4,_0x7f54('0x11'));logger['debug'](_0x7f54('0x12'),_0x4899b4,_0x7f54('0x11'),JSON['stringify'](_0x57e0d0));if(_0x57e0d0[_0x7f54('0x13')]){if(_0x57e0d0[_0x7f54('0x13')][_0x7f54('0x14')]===0x1f4){logger[_0x7f54('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x4899b4,_0x57e0d0[_0x7f54('0x13')][_0x7f54('0x15')]);return _0x3f43ef(_0x57e0d0['error'][_0x7f54('0x15')]);}logger[_0x7f54('0x13')](_0x7f54('0x10'),_0x4899b4,_0x57e0d0['error'][_0x7f54('0x15')]);return _0x4e700e(_0x57e0d0[_0x7f54('0x13')][_0x7f54('0x15')]);}else{logger[_0x7f54('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4899b4,'request\x20sent');_0x4e700e(_0x57e0d0[_0x7f54('0x16')][_0x7f54('0x15')]);}})[_0x7f54('0x17')](function(_0x4b1a6d){logger[_0x7f54('0x13')](_0x7f54('0x10'),_0x4899b4,_0x4b1a6d);_0x3f43ef(_0x4b1a6d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 24abe32..e82a9c8 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 _0x79d3=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x79d3,0x15f));var _0x379d=function(_0x160f99,_0x8de3ad){_0x160f99=_0x160f99-0x0;var _0x405e09=_0x79d3[_0x160f99];return _0x405e09;};'use strict';var multer=require(_0x379d('0x0'));var util=require('util');var path=require(_0x379d('0x1'));var timeout=require('connect-timeout');var express=require(_0x379d('0x2'));var router=express[_0x379d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x379d('0x4'));var interaction=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var controller=require(_0x379d('0x7'));router[_0x379d('0x8')]('/',auth[_0x379d('0x9')](),controller[_0x379d('0xa')]);router['get'](_0x379d('0xb'),auth['isAuthenticated'](),controller[_0x379d('0xc')]);router[_0x379d('0x8')](_0x379d('0xd'),auth['isAuthenticated'](),controller[_0x379d('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x379d('0xf')]);router[_0x379d('0x10')]('/',auth[_0x379d('0x9')](),controller['create']);router[_0x379d('0x10')](_0x379d('0xd'),auth[_0x379d('0x9')](),controller[_0x379d('0x11')]);router['put'](_0x379d('0xb'),auth[_0x379d('0x9')](),controller[_0x379d('0x12')]);router[_0x379d('0x13')](_0x379d('0xb'),auth[_0x379d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xae4a=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports'];(function(_0x18dfea,_0x43d571){var _0x5222e3=function(_0x3484ae){while(--_0x3484ae){_0x18dfea['push'](_0x18dfea['shift']());}};_0x5222e3(++_0x43d571);}(_0xae4a,0x68));var _0xaae4=function(_0x42e6c3,_0x348bad){_0x42e6c3=_0x42e6c3-0x0;var _0x48ab67=_0xae4a[_0x42e6c3];return _0x48ab67;};'use strict';var multer=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var path=require('path');var timeout=require(_0xaae4('0x2'));var express=require(_0xaae4('0x3'));var router=express['Router']();var fs_extra=require(_0xaae4('0x4'));var auth=require(_0xaae4('0x5'));var interaction=require(_0xaae4('0x6'));var config=require(_0xaae4('0x7'));var controller=require(_0xaae4('0x8'));router[_0xaae4('0x9')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0xb')]);router[_0xaae4('0x9')](_0xaae4('0xc'),auth[_0xaae4('0xa')](),controller[_0xaae4('0xd')]);router[_0xaae4('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaae4('0xe')]);router[_0xaae4('0x9')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x10')]);router[_0xaae4('0x11')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0x12')]);router[_0xaae4('0x11')](_0xaae4('0x13'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x14')]);router[_0xaae4('0x15')](_0xaae4('0xc'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x16')]);router[_0xaae4('0x17')](_0xaae4('0xc'),auth['isAuthenticated'](),controller[_0xaae4('0x18')]);module[_0xaae4('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ceccad0..8f5d649 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 _0xa312=['sequelize','STRING'];(function(_0x1ca5f7,_0x55d6d5){var _0x4660a1=function(_0x24bbee){while(--_0x24bbee){_0x1ca5f7['push'](_0x1ca5f7['shift']());}};_0x4660a1(++_0x55d6d5);}(_0xa312,0x186));var _0x2a31=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xa312[_0x1b64dd];return _0xeb464c;};'use strict';var Sequelize=require(_0x2a31('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2a31('0x1')]},'username':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2a31('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd722=['STRING','HelpDesk','sequelize'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xd722,0x152));var _0x2d72=function(_0x21a91e,_0x5e3cde){_0x21a91e=_0x21a91e-0x0;var _0x3e27e7=_0xd722[_0x21a91e];return _0x3e27e7;};'use strict';var Sequelize=require(_0x2d72('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d72('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2d72('0x1')]},'username':{'type':Sequelize[_0x2d72('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2d72('0x1')],'allowNull':![],'defaultValue':_0x2d72('0x2')},'remoteUri':{'type':Sequelize[_0x2d72('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2d72('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2d72('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 2ba10f0..6285c18 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 _0x56ff=['end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','map','VtigerAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getConfigurations','VtigerConfiguration','order','options','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','format','getchallenge','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','editable','false','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x56ff,0x1c1));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf56f('0x0'));var rimraf=require(_0xf56f('0x1'));var zipdir=require(_0xf56f('0x2'));var jsonpatch=require(_0xf56f('0x3'));var rp=require(_0xf56f('0x4'));var moment=require(_0xf56f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf56f('0x6'));var util=require('util');var path=require(_0xf56f('0x7'));var sox=require(_0xf56f('0x8'));var csv=require(_0xf56f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf56f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf56f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf56f('0xc'));var toCsv=require(_0xf56f('0x9'));var querystring=require('querystring');var Papa=require(_0xf56f('0xd'));var Redis=require(_0xf56f('0xe'));var authService=require(_0xf56f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf56f('0x10'));var hardwareService=require(_0xf56f('0x11'));var logger=require('../../config/logger')(_0xf56f('0x12'));var utils=require(_0xf56f('0x13'));var config=require(_0xf56f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf56f('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xe6f8a6,_0x3438d1){_0x3438d1=_0x3438d1||0xcc;return function(_0x1a7e03){if(_0x1a7e03){return _0xe6f8a6['sendStatus'](_0x3438d1);}return _0xe6f8a6[_0xf56f('0x16')](_0x3438d1)[_0xf56f('0x17')]();};}function respondWithResult(_0x16d9fc,_0x5f4289){_0x5f4289=_0x5f4289||0xc8;return function(_0x38e7c9){if(_0x38e7c9){return _0x16d9fc['status'](_0x5f4289)[_0xf56f('0x18')](_0x38e7c9);}};}function respondWithFilteredResult(_0x5eb7aa,_0x4ffe33){return function(_0x394806){if(_0x394806){var _0x34757b=typeof _0x4ffe33['offset']===_0xf56f('0x19')&&typeof _0x4ffe33[_0xf56f('0x1a')]===_0xf56f('0x19');var _0x545055=_0x394806[_0xf56f('0x1b')];var _0x244d42=_0x34757b?0x0:_0x4ffe33[_0xf56f('0x1c')];var _0x4170d8=_0x34757b?_0x394806[_0xf56f('0x1b')]:_0x4ffe33[_0xf56f('0x1c')]+_0x4ffe33[_0xf56f('0x1a')];var _0x5af50a;if(_0x4170d8>=_0x545055){_0x4170d8=_0x545055;_0x5af50a=0xc8;}else{_0x5af50a=0xce;}_0x5eb7aa['status'](_0x5af50a);return _0x5eb7aa['set'](_0xf56f('0x1d'),_0x244d42+'-'+_0x4170d8+'/'+_0x545055)[_0xf56f('0x18')](_0x394806);}return null;};}function patchUpdates(_0x5aafbe){return function(_0x4df198){try{jsonpatch[_0xf56f('0x1e')](_0x4df198,_0x5aafbe,!![]);}catch(_0x271d87){return BPromise[_0xf56f('0x1f')](_0x271d87);}return _0x4df198[_0xf56f('0x20')]();};}function saveUpdates(_0x43e688,_0xaecdda){return function(_0x3479e0){if(_0x3479e0){return _0x3479e0[_0xf56f('0x21')](_0x43e688)['then'](function(_0x295453){return _0x295453;});}return null;};}function removeEntity(_0x3ef58a,_0x152506){return function(_0x4c62c){if(_0x4c62c){return _0x4c62c[_0xf56f('0x22')]()['then'](function(){_0x3ef58a['status'](0xcc)[_0xf56f('0x17')]();});}};}function handleEntityNotFound(_0xd57b1b,_0x3aee6e){return function(_0x3f543f){if(!_0x3f543f){_0xd57b1b[_0xf56f('0x23')](0x194);}return _0x3f543f;};}function handleError(_0x3f4066,_0x414ef3){_0x414ef3=_0x414ef3||0x1f4;return function(_0x50ac91){logger[_0xf56f('0x24')](_0x50ac91[_0xf56f('0x25')]);if(_0x50ac91['name']){delete _0x50ac91[_0xf56f('0x26')];}_0x3f4066[_0xf56f('0x16')](_0x414ef3)['send'](_0x50ac91);};}exports['index']=function(_0x1eac39,_0x263254){var _0x30c85c={},_0x14923a={},_0x32cad0={'count':0x0,'rows':[]};var _0x1039f5=_[_0xf56f('0x27')](db[_0xf56f('0x28')]['rawAttributes'],function(_0x1f9bae){return{'name':_0x1f9bae[_0xf56f('0x29')],'type':_0x1f9bae[_0xf56f('0x2a')][_0xf56f('0x2b')]};});_0x14923a['model']=_['map'](_0x1039f5,_0xf56f('0x26'));_0x14923a[_0xf56f('0x2c')]=_[_0xf56f('0x2d')](_0x1eac39[_0xf56f('0x2c')]);_0x14923a[_0xf56f('0x2e')]=_[_0xf56f('0x2f')](_0x14923a['model'],_0x14923a['query']);_0x30c85c['attributes']=_[_0xf56f('0x2f')](_0x14923a[_0xf56f('0x30')],qs[_0xf56f('0x31')](_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x31')]));_0x30c85c[_0xf56f('0x32')]=_0x30c85c[_0xf56f('0x32')][_0xf56f('0x33')]?_0x30c85c[_0xf56f('0x32')]:_0x14923a[_0xf56f('0x30')];if(!_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x34')]('nolimit')){_0x30c85c[_0xf56f('0x1a')]=qs[_0xf56f('0x1a')](_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x1a')]);_0x30c85c[_0xf56f('0x1c')]=qs[_0xf56f('0x1c')](_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x1c')]);}_0x30c85c['order']=qs[_0xf56f('0x35')](_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x35')]);_0x30c85c['where']=qs[_0xf56f('0x2e')](_[_0xf56f('0x36')](_0x1eac39['query'],_0x14923a['filters']),_0x1039f5);if(_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x37')]){_0x30c85c[_0xf56f('0x38')]=_[_0xf56f('0x39')](_0x30c85c['where'],{'$or':_[_0xf56f('0x27')](_0x1039f5,function(_0x3078db){if(_0x3078db['type']!==_0xf56f('0x3a')){var _0x24cee3={};_0x24cee3[_0x3078db[_0xf56f('0x26')]]={'$like':'%'+_0x1eac39['query'][_0xf56f('0x37')]+'%'};return _0x24cee3;}})});}_0x30c85c=_['merge']({},_0x30c85c,_0x1eac39['options']);var _0x10ecce={'where':_0x30c85c[_0xf56f('0x38')]};return db[_0xf56f('0x28')][_0xf56f('0x1b')](_0x10ecce)[_0xf56f('0x3b')](function(_0x2742b2){_0x32cad0[_0xf56f('0x1b')]=_0x2742b2;if(_0x1eac39[_0xf56f('0x2c')][_0xf56f('0x3c')]){_0x30c85c[_0xf56f('0x3d')]=[{'all':!![]}];}return db['VtigerAccount'][_0xf56f('0x3e')](_0x30c85c);})['then'](function(_0x1f56e0){_0x32cad0[_0xf56f('0x3f')]=_0x1f56e0;return _0x32cad0;})[_0xf56f('0x3b')](respondWithFilteredResult(_0x263254,_0x30c85c))[_0xf56f('0x40')](handleError(_0x263254,null));};exports[_0xf56f('0x41')]=function(_0x22f597,_0x114be9){var _0x360902={'raw':![],'where':{'id':_0x22f597['params']['id']}},_0x290aeb={};_0x290aeb[_0xf56f('0x30')]=_[_0xf56f('0x2d')](db[_0xf56f('0x28')][_0xf56f('0x42')]);_0x290aeb[_0xf56f('0x2c')]=_[_0xf56f('0x2d')](_0x22f597['query']);_0x290aeb[_0xf56f('0x2e')]=_[_0xf56f('0x2f')](_0x290aeb['model'],_0x290aeb[_0xf56f('0x2c')]);_0x360902[_0xf56f('0x32')]=_[_0xf56f('0x2f')](_0x290aeb[_0xf56f('0x30')],qs[_0xf56f('0x31')](_0x22f597[_0xf56f('0x2c')][_0xf56f('0x31')]));_0x360902[_0xf56f('0x32')]=_0x360902[_0xf56f('0x32')][_0xf56f('0x33')]?_0x360902[_0xf56f('0x32')]:_0x290aeb[_0xf56f('0x30')];if(_0x22f597[_0xf56f('0x2c')][_0xf56f('0x3c')]){_0x360902[_0xf56f('0x3d')]=[{'all':!![]}];}_0x360902=_['merge']({},_0x360902,_0x22f597['options']);return db[_0xf56f('0x28')][_0xf56f('0x43')](_0x360902)['then'](handleEntityNotFound(_0x114be9,null))[_0xf56f('0x3b')](respondWithResult(_0x114be9,null))['catch'](handleError(_0x114be9,null));};exports[_0xf56f('0x44')]=function(_0x41ed1a,_0x1f5034){return db[_0xf56f('0x28')][_0xf56f('0x44')](_0x41ed1a[_0xf56f('0x45')],{})[_0xf56f('0x3b')](respondWithResult(_0x1f5034,0xc9))[_0xf56f('0x40')](handleError(_0x1f5034,null));};exports[_0xf56f('0x21')]=function(_0x489377,_0x4fd38c){if(_0x489377[_0xf56f('0x45')]['id']){delete _0x489377[_0xf56f('0x45')]['id'];}return db[_0xf56f('0x28')]['find']({'where':{'id':_0x489377['params']['id']}})[_0xf56f('0x3b')](handleEntityNotFound(_0x4fd38c,null))[_0xf56f('0x3b')](saveUpdates(_0x489377[_0xf56f('0x45')],null))[_0xf56f('0x3b')](respondWithResult(_0x4fd38c,null))[_0xf56f('0x40')](handleError(_0x4fd38c,null));};exports[_0xf56f('0x22')]=function(_0x20b6a2,_0x4e5476){return db['VtigerAccount'][_0xf56f('0x43')]({'where':{'id':_0x20b6a2[_0xf56f('0x46')]['id']}})[_0xf56f('0x3b')](handleEntityNotFound(_0x4e5476,null))[_0xf56f('0x3b')](removeEntity(_0x4e5476,null))[_0xf56f('0x40')](handleError(_0x4e5476,null));};exports[_0xf56f('0x47')]=function(_0x403b4a,_0x260757,_0x5782ca){var _0x1a9b51={};var _0x3fd23b={};var _0x301f49;var _0x1781d7;return db[_0xf56f('0x28')]['findOne']({'where':{'id':_0x403b4a[_0xf56f('0x46')]['id']}})['then'](handleEntityNotFound(_0x260757,null))[_0xf56f('0x3b')](function(_0xdf435a){if(_0xdf435a){_0x301f49=_0xdf435a;_0x3fd23b['model']=_[_0xf56f('0x2d')](db[_0xf56f('0x48')][_0xf56f('0x42')]);_0x3fd23b[_0xf56f('0x2c')]=_[_0xf56f('0x2d')](_0x403b4a['query']);_0x3fd23b[_0xf56f('0x2e')]=_[_0xf56f('0x2f')](_0x3fd23b['model'],_0x3fd23b[_0xf56f('0x2c')]);_0x1a9b51[_0xf56f('0x32')]=_['intersection'](_0x3fd23b[_0xf56f('0x30')],qs['fields'](_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x31')]));_0x1a9b51[_0xf56f('0x32')]=_0x1a9b51[_0xf56f('0x32')][_0xf56f('0x33')]?_0x1a9b51['attributes']:_0x3fd23b[_0xf56f('0x30')];_0x1a9b51[_0xf56f('0x49')]=qs[_0xf56f('0x35')](_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x35')]);_0x1a9b51[_0xf56f('0x38')]=qs[_0xf56f('0x2e')](_[_0xf56f('0x36')](_0x403b4a[_0xf56f('0x2c')],_0x3fd23b[_0xf56f('0x2e')]));if(_0x403b4a[_0xf56f('0x2c')]['filter']){_0x1a9b51['where']=_['merge'](_0x1a9b51['where'],{'$or':_[_0xf56f('0x27')](_0x1a9b51[_0xf56f('0x32')],function(_0x4d63a5){var _0x4a3748={};_0x4a3748[_0x4d63a5]={'$like':'%'+_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x37')]+'%'};return _0x4a3748;})});}_0x1a9b51=_[_0xf56f('0x39')]({},_0x1a9b51,_0x403b4a[_0xf56f('0x4a')]);return _0x301f49[_0xf56f('0x47')](_0x1a9b51);}})[_0xf56f('0x3b')](function(_0x4c9664){if(_0x4c9664){_0x1781d7=_0x4c9664[_0xf56f('0x33')];if(!_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x34')]('nolimit')){_0x1a9b51[_0xf56f('0x1a')]=qs[_0xf56f('0x1a')](_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x1a')]);_0x1a9b51['offset']=qs['offset'](_0x403b4a[_0xf56f('0x2c')][_0xf56f('0x1c')]);}return _0x301f49[_0xf56f('0x47')](_0x1a9b51);}})[_0xf56f('0x3b')](function(_0x3e0e5f){if(_0x3e0e5f){return _0x3e0e5f?{'count':_0x1781d7,'rows':_0x3e0e5f}:null;}})[_0xf56f('0x3b')](respondWithResult(_0x260757,null))[_0xf56f('0x40')](handleError(_0x260757,null));};exports[_0xf56f('0x4b')]=function(_0x50fd46,_0x12400d,_0x1f81ef){if(_0x50fd46[_0xf56f('0x45')]['id']){delete _0x50fd46[_0xf56f('0x45')]['id'];}return db[_0xf56f('0x28')][_0xf56f('0x4c')]({'where':{'id':_0x50fd46[_0xf56f('0x46')]['id']}})['then'](handleEntityNotFound(_0x12400d,null))['then'](function(_0x21db49){if(_0x21db49){_0x50fd46['body'][_0xf56f('0x4d')]=_0x21db49['id'];_0x50fd46[_0xf56f('0x45')]['Subjects']=integrations[_0xf56f('0x4e')](_0x50fd46[_0xf56f('0x45')][_0xf56f('0x4f')],_0x50fd46['body'][_0xf56f('0x2a')]);_0x50fd46[_0xf56f('0x45')][_0xf56f('0x50')]=integrations[_0xf56f('0x51')](_0x50fd46['body'][_0xf56f('0x4f')],_0x50fd46[_0xf56f('0x45')][_0xf56f('0x2a')]);return db[_0xf56f('0x48')][_0xf56f('0x44')](_0x50fd46[_0xf56f('0x45')],{'include':[{'model':db[_0xf56f('0x52')],'as':'Subjects'},{'model':db[_0xf56f('0x52')],'as':_0xf56f('0x50')}]});}return null;})[_0xf56f('0x3b')](respondWithResult(_0x12400d,null))['catch'](handleError(_0x12400d,null));};var md5=require(_0xf56f('0x53'));exports[_0xf56f('0x54')]=function(_0x364d97,_0x1bfe5b,_0x5cbda2){var _0x57b6f1=null;var _0x9f2052=null;var _0x494d32=null;var _0x419e01=null;var _0x3ff58f='';return db[_0xf56f('0x28')][_0xf56f('0x4c')]({'where':{'id':_0x364d97[_0xf56f('0x46')]['id']},'attributes':['id',_0xf56f('0x26'),'username',_0xf56f('0x55'),_0xf56f('0x56'),'remoteUri',_0xf56f('0x57'),_0xf56f('0x58')]})[_0xf56f('0x3b')](handleEntityNotFound(_0x1bfe5b,null))['then'](function(_0x2cea5a){if(_0x2cea5a){_0x57b6f1=_0x2cea5a[_0xf56f('0x59')];_0x9f2052=_0x2cea5a[_0xf56f('0x58')];_0x494d32=_0x2cea5a[_0xf56f('0x56')];_0x3ff58f=_0x2cea5a[_0xf56f('0x5a')];var _0x471485=_0x3ff58f[_0xf56f('0x5b')](-0x1);if(_0x471485==='/'){_0x3ff58f=_0x3ff58f[_0xf56f('0x5c')](0x0,_0x3ff58f[_0xf56f('0x5d')](_0x471485));}_0x419e01=util[_0xf56f('0x5e')]('%s/webservice.php',_0x3ff58f);var _0x29affd={'method':'GET','uri':_0x419e01,'qs':{'operation':_0xf56f('0x5f'),'username':_0x2cea5a['username']},'json':!![]};return rp(_0x29affd);}})[_0xf56f('0x3b')](function(_0x1ef8f3){if(_0x1ef8f3['success']){var _0x39c57b={'method':_0xf56f('0x60'),'uri':_0x419e01,'form':{'operation':_0xf56f('0x61'),'username':_0x57b6f1,'accessKey':md5(_0x1ef8f3[_0xf56f('0x62')][_0xf56f('0x63')]+_0x9f2052)},'json':!![]};return rp(_0x39c57b);}})[_0xf56f('0x3b')](function(_0x363afd){if(_0x363afd[_0xf56f('0x64')]){var _0x51c9f7={'method':'GET','uri':_0x419e01,'qs':{'operation':'describe','username':_0x57b6f1,'sessionName':_0x363afd[_0xf56f('0x62')][_0xf56f('0x65')],'elementType':_0x494d32},'json':!![]};return rp(_0x51c9f7);}})[_0xf56f('0x3b')](function(_0x5f377d){if(_0x5f377d[_0xf56f('0x64')]){var _0x4743a3=[_0xf56f('0x66'),_0xf56f('0x67'),_0xf56f('0x68')];_[_0xf56f('0x69')](_0x5f377d[_0xf56f('0x62')]['fields'],function(_0x2bad03){return _0x4743a3['includes'](_0x2bad03[_0xf56f('0x2a')][_0xf56f('0x26')]);});_['remove'](_0x5f377d[_0xf56f('0x62')][_0xf56f('0x31')],function(_0x45e7c6){return _0x45e7c6[_0xf56f('0x6a')]===_0xf56f('0x6b');});return{'count':_0x5f377d[_0xf56f('0x62')][_0xf56f('0x31')]['length'],'rows':_['map'](_0x5f377d['result'][_0xf56f('0x31')],function(_0x428915){return{'id':_0x428915['name'],'name':_0x428915['label'],'custom':_[_0xf56f('0x6c')](_0x428915['name'],'cf_')?!![]:![],'options':_0x428915[_0xf56f('0x2a')][_0xf56f('0x26')]===_0xf56f('0x6d')&&_0x428915[_0xf56f('0x2a')]['picklistValues'][_0xf56f('0x33')]>0x0?_[_0xf56f('0x27')](_0x428915[_0xf56f('0x2a')][_0xf56f('0x6e')],function(_0x48291d){return{'name':_0x48291d['label'],'value':_0x48291d[_0xf56f('0x6f')]};}):[]};})};}})[_0xf56f('0x3b')](respondWithResult(_0x1bfe5b,null))[_0xf56f('0x40')](function(_0x70a6e9){console[_0xf56f('0x70')](_0xf56f('0x71')+_0x70a6e9);var _0x15859a=_0x364d97[_0xf56f('0x2c')][_0xf56f('0x72')]?0x1f4:_0x70a6e9[_0xf56f('0x73')]||0x1f4;logger[_0xf56f('0x24')](_0xf56f('0x74'),'getFields',_0x15859a,JSON[_0xf56f('0x75')](_0x70a6e9));delete _0x70a6e9[_0xf56f('0x26')];if(_0x15859a===0x191){_0x15859a=0x190;}_0x1bfe5b[_0xf56f('0x16')](_0x15859a)['send'](_0x364d97['query'][_0xf56f('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x70a6e9[_0xf56f('0x73')]}:_0x70a6e9);});}; \ No newline at end of file +var _0x609e=['undefined','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','map','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','VtigerAccount','includeAll','include','rows','catch','show','params','rawAttributes','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','remoteUri','serverUrl','accessKey','username','moduleName','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','editable','label','startsWith','picklist','picklistValues','vTiger\x20error:\x20','statusCode','stringify','send','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset'];(function(_0x3d589a,_0x565094){var _0x5bb9f5=function(_0x547574){while(--_0x547574){_0x3d589a['push'](_0x3d589a['shift']());}};_0x5bb9f5(++_0x565094);}(_0x609e,0xd0));var _0xe609=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x609e[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0xe609('0x0'));var rimraf=require(_0xe609('0x1'));var zipdir=require(_0xe609('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe609('0x3'));var moment=require(_0xe609('0x4'));var BPromise=require(_0xe609('0x5'));var Mustache=require(_0xe609('0x6'));var util=require(_0xe609('0x7'));var path=require(_0xe609('0x8'));var sox=require(_0xe609('0x9'));var csv=require(_0xe609('0xa'));var ejs=require(_0xe609('0xb'));var fs=require('fs');var fs_extra=require(_0xe609('0xc'));var _=require(_0xe609('0xd'));var squel=require(_0xe609('0xe'));var crypto=require(_0xe609('0xf'));var jsforce=require(_0xe609('0x10'));var deskjs=require(_0xe609('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe609('0x12'));var Papa=require('papaparse');var Redis=require(_0xe609('0x13'));var authService=require(_0xe609('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe609('0x15'));var hardwareService=require(_0xe609('0x16'));var logger=require('../../config/logger')(_0xe609('0x17'));var utils=require(_0xe609('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe609('0x19'));var db=require(_0xe609('0x1a'))['db'];var integrations=require(_0xe609('0x1b'));function respondWithStatusCode(_0x5d5b95,_0x5d18ec){_0x5d18ec=_0x5d18ec||0xcc;return function(_0x4349b8){if(_0x4349b8){return _0x5d5b95['sendStatus'](_0x5d18ec);}return _0x5d5b95[_0xe609('0x1c')](_0x5d18ec)[_0xe609('0x1d')]();};}function respondWithResult(_0x533be1,_0x3f2ae4){_0x3f2ae4=_0x3f2ae4||0xc8;return function(_0x42f7be){if(_0x42f7be){return _0x533be1['status'](_0x3f2ae4)[_0xe609('0x1e')](_0x42f7be);}};}function respondWithFilteredResult(_0x1e43c7,_0x18cdb9){return function(_0x1cb870){if(_0x1cb870){var _0xb8091=typeof _0x18cdb9[_0xe609('0x1f')]===_0xe609('0x20')&&typeof _0x18cdb9[_0xe609('0x21')]===_0xe609('0x20');var _0x2c97ec=_0x1cb870[_0xe609('0x22')];var _0x21debd=_0xb8091?0x0:_0x18cdb9[_0xe609('0x1f')];var _0x5f2da5=_0xb8091?_0x1cb870['count']:_0x18cdb9[_0xe609('0x1f')]+_0x18cdb9['limit'];var _0x7755e;if(_0x5f2da5>=_0x2c97ec){_0x5f2da5=_0x2c97ec;_0x7755e=0xc8;}else{_0x7755e=0xce;}_0x1e43c7['status'](_0x7755e);return _0x1e43c7['set'](_0xe609('0x23'),_0x21debd+'-'+_0x5f2da5+'/'+_0x2c97ec)[_0xe609('0x1e')](_0x1cb870);}return null;};}function patchUpdates(_0x56ac47){return function(_0x551823){try{jsonpatch['apply'](_0x551823,_0x56ac47,!![]);}catch(_0x217fa8){return BPromise[_0xe609('0x24')](_0x217fa8);}return _0x551823[_0xe609('0x25')]();};}function saveUpdates(_0x1f8bab,_0x4fff02){return function(_0x184da0){if(_0x184da0){return _0x184da0[_0xe609('0x26')](_0x1f8bab)['then'](function(_0x297d67){return _0x297d67;});}return null;};}function removeEntity(_0x1b1bf4,_0x33e620){return function(_0x5c0a46){if(_0x5c0a46){return _0x5c0a46[_0xe609('0x27')]()[_0xe609('0x28')](function(){_0x1b1bf4[_0xe609('0x1c')](0xcc)[_0xe609('0x1d')]();});}};}function handleEntityNotFound(_0x171cd7,_0x308278){return function(_0x3c467e){if(!_0x3c467e){_0x171cd7[_0xe609('0x29')](0x194);}return _0x3c467e;};}function handleError(_0x51c5f9,_0x36dc41){_0x36dc41=_0x36dc41||0x1f4;return function(_0x26a0d9){logger[_0xe609('0x2a')](_0x26a0d9[_0xe609('0x2b')]);if(_0x26a0d9[_0xe609('0x2c')]){delete _0x26a0d9[_0xe609('0x2c')];}_0x51c5f9['status'](_0x36dc41)['send'](_0x26a0d9);};}exports['index']=function(_0x55ba8e,_0x27bed8){var _0x66fa7d={},_0x14512e={},_0x3ac234={'count':0x0,'rows':[]};var _0x1acb23=_[_0xe609('0x2d')](db['VtigerAccount']['rawAttributes'],function(_0x2084f1){return{'name':_0x2084f1[_0xe609('0x2e')],'type':_0x2084f1[_0xe609('0x2f')][_0xe609('0x30')]};});_0x14512e['model']=_[_0xe609('0x2d')](_0x1acb23,_0xe609('0x2c'));_0x14512e['query']=_[_0xe609('0x31')](_0x55ba8e[_0xe609('0x32')]);_0x14512e[_0xe609('0x33')]=_['intersection'](_0x14512e[_0xe609('0x34')],_0x14512e['query']);_0x66fa7d['attributes']=_[_0xe609('0x35')](_0x14512e[_0xe609('0x34')],qs[_0xe609('0x36')](_0x55ba8e[_0xe609('0x32')]['fields']));_0x66fa7d['attributes']=_0x66fa7d[_0xe609('0x37')][_0xe609('0x38')]?_0x66fa7d[_0xe609('0x37')]:_0x14512e[_0xe609('0x34')];if(!_0x55ba8e['query'][_0xe609('0x39')]('nolimit')){_0x66fa7d['limit']=qs[_0xe609('0x21')](_0x55ba8e[_0xe609('0x32')]['limit']);_0x66fa7d[_0xe609('0x1f')]=qs['offset'](_0x55ba8e[_0xe609('0x32')][_0xe609('0x1f')]);}_0x66fa7d[_0xe609('0x3a')]=qs[_0xe609('0x3b')](_0x55ba8e[_0xe609('0x32')][_0xe609('0x3b')]);_0x66fa7d[_0xe609('0x3c')]=qs['filters'](_[_0xe609('0x3d')](_0x55ba8e[_0xe609('0x32')],_0x14512e[_0xe609('0x33')]),_0x1acb23);if(_0x55ba8e[_0xe609('0x32')]['filter']){_0x66fa7d[_0xe609('0x3c')]=_[_0xe609('0x3e')](_0x66fa7d[_0xe609('0x3c')],{'$or':_[_0xe609('0x2d')](_0x1acb23,function(_0x20942a){if(_0x20942a[_0xe609('0x2f')]!==_0xe609('0x3f')){var _0x4a2499={};_0x4a2499[_0x20942a[_0xe609('0x2c')]]={'$like':'%'+_0x55ba8e[_0xe609('0x32')][_0xe609('0x40')]+'%'};return _0x4a2499;}})});}_0x66fa7d=_[_0xe609('0x3e')]({},_0x66fa7d,_0x55ba8e[_0xe609('0x41')]);var _0x3d30e9={'where':_0x66fa7d[_0xe609('0x3c')]};return db[_0xe609('0x42')][_0xe609('0x22')](_0x3d30e9)[_0xe609('0x28')](function(_0x27bb14){_0x3ac234[_0xe609('0x22')]=_0x27bb14;if(_0x55ba8e[_0xe609('0x32')][_0xe609('0x43')]){_0x66fa7d[_0xe609('0x44')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x66fa7d);})[_0xe609('0x28')](function(_0x322b73){_0x3ac234[_0xe609('0x45')]=_0x322b73;return _0x3ac234;})[_0xe609('0x28')](respondWithFilteredResult(_0x27bed8,_0x66fa7d))[_0xe609('0x46')](handleError(_0x27bed8,null));};exports[_0xe609('0x47')]=function(_0x19e05b,_0x4c8274){var _0x22d259={'raw':![],'where':{'id':_0x19e05b[_0xe609('0x48')]['id']}},_0x424a4e={};_0x424a4e[_0xe609('0x34')]=_[_0xe609('0x31')](db[_0xe609('0x42')][_0xe609('0x49')]);_0x424a4e['query']=_[_0xe609('0x31')](_0x19e05b['query']);_0x424a4e[_0xe609('0x33')]=_[_0xe609('0x35')](_0x424a4e['model'],_0x424a4e[_0xe609('0x32')]);_0x22d259[_0xe609('0x37')]=_[_0xe609('0x35')](_0x424a4e[_0xe609('0x34')],qs['fields'](_0x19e05b['query'][_0xe609('0x36')]));_0x22d259[_0xe609('0x37')]=_0x22d259[_0xe609('0x37')]['length']?_0x22d259[_0xe609('0x37')]:_0x424a4e[_0xe609('0x34')];if(_0x19e05b[_0xe609('0x32')][_0xe609('0x43')]){_0x22d259[_0xe609('0x44')]=[{'all':!![]}];}_0x22d259=_[_0xe609('0x3e')]({},_0x22d259,_0x19e05b[_0xe609('0x41')]);return db[_0xe609('0x42')]['find'](_0x22d259)['then'](handleEntityNotFound(_0x4c8274,null))[_0xe609('0x28')](respondWithResult(_0x4c8274,null))[_0xe609('0x46')](handleError(_0x4c8274,null));};exports['create']=function(_0x2106d9,_0x4c8500){return db[_0xe609('0x42')]['create'](_0x2106d9[_0xe609('0x4a')],{})[_0xe609('0x28')](respondWithResult(_0x4c8500,0xc9))[_0xe609('0x46')](handleError(_0x4c8500,null));};exports[_0xe609('0x26')]=function(_0x140ed0,_0x55586f){if(_0x140ed0[_0xe609('0x4a')]['id']){delete _0x140ed0['body']['id'];}return db[_0xe609('0x42')][_0xe609('0x4b')]({'where':{'id':_0x140ed0[_0xe609('0x48')]['id']}})[_0xe609('0x28')](handleEntityNotFound(_0x55586f,null))[_0xe609('0x28')](saveUpdates(_0x140ed0[_0xe609('0x4a')],null))[_0xe609('0x28')](respondWithResult(_0x55586f,null))[_0xe609('0x46')](handleError(_0x55586f,null));};exports['destroy']=function(_0x4490be,_0x270172){return db['VtigerAccount'][_0xe609('0x4b')]({'where':{'id':_0x4490be[_0xe609('0x48')]['id']}})['then'](handleEntityNotFound(_0x270172,null))[_0xe609('0x28')](removeEntity(_0x270172,null))['catch'](handleError(_0x270172,null));};exports[_0xe609('0x4c')]=function(_0x5d7976,_0x539b8b,_0x4118d6){var _0x84b8ca={};var _0x50a2a7={};var _0x907334;var _0x85238f;return db[_0xe609('0x42')][_0xe609('0x4d')]({'where':{'id':_0x5d7976[_0xe609('0x48')]['id']}})['then'](handleEntityNotFound(_0x539b8b,null))[_0xe609('0x28')](function(_0x2eb369){if(_0x2eb369){_0x907334=_0x2eb369;_0x50a2a7['model']=_[_0xe609('0x31')](db[_0xe609('0x4e')][_0xe609('0x49')]);_0x50a2a7['query']=_['keys'](_0x5d7976[_0xe609('0x32')]);_0x50a2a7['filters']=_['intersection'](_0x50a2a7[_0xe609('0x34')],_0x50a2a7['query']);_0x84b8ca[_0xe609('0x37')]=_[_0xe609('0x35')](_0x50a2a7[_0xe609('0x34')],qs[_0xe609('0x36')](_0x5d7976[_0xe609('0x32')]['fields']));_0x84b8ca[_0xe609('0x37')]=_0x84b8ca['attributes']['length']?_0x84b8ca[_0xe609('0x37')]:_0x50a2a7[_0xe609('0x34')];_0x84b8ca['order']=qs[_0xe609('0x3b')](_0x5d7976['query'][_0xe609('0x3b')]);_0x84b8ca[_0xe609('0x3c')]=qs['filters'](_[_0xe609('0x3d')](_0x5d7976[_0xe609('0x32')],_0x50a2a7[_0xe609('0x33')]));if(_0x5d7976[_0xe609('0x32')][_0xe609('0x40')]){_0x84b8ca[_0xe609('0x3c')]=_['merge'](_0x84b8ca['where'],{'$or':_['map'](_0x84b8ca['attributes'],function(_0x24676b){var _0x2f827a={};_0x2f827a[_0x24676b]={'$like':'%'+_0x5d7976[_0xe609('0x32')]['filter']+'%'};return _0x2f827a;})});}_0x84b8ca=_[_0xe609('0x3e')]({},_0x84b8ca,_0x5d7976['options']);return _0x907334['getConfigurations'](_0x84b8ca);}})[_0xe609('0x28')](function(_0x4e53cc){if(_0x4e53cc){_0x85238f=_0x4e53cc[_0xe609('0x38')];if(!_0x5d7976['query']['hasOwnProperty']('nolimit')){_0x84b8ca[_0xe609('0x21')]=qs['limit'](_0x5d7976[_0xe609('0x32')][_0xe609('0x21')]);_0x84b8ca['offset']=qs[_0xe609('0x1f')](_0x5d7976['query'][_0xe609('0x1f')]);}return _0x907334['getConfigurations'](_0x84b8ca);}})[_0xe609('0x28')](function(_0x3a46ec){if(_0x3a46ec){return _0x3a46ec?{'count':_0x85238f,'rows':_0x3a46ec}:null;}})[_0xe609('0x28')](respondWithResult(_0x539b8b,null))[_0xe609('0x46')](handleError(_0x539b8b,null));};exports[_0xe609('0x4f')]=function(_0x1ecedd,_0x2cf62f,_0x113acf){if(_0x1ecedd[_0xe609('0x4a')]['id']){delete _0x1ecedd[_0xe609('0x4a')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x1ecedd[_0xe609('0x48')]['id']}})[_0xe609('0x28')](handleEntityNotFound(_0x2cf62f,null))['then'](function(_0x3abc6c){if(_0x3abc6c){_0x1ecedd[_0xe609('0x4a')][_0xe609('0x50')]=_0x3abc6c['id'];_0x1ecedd[_0xe609('0x4a')]['Subjects']=integrations[_0xe609('0x51')](_0x1ecedd[_0xe609('0x4a')][_0xe609('0x52')],_0x1ecedd['body'][_0xe609('0x2f')]);_0x1ecedd[_0xe609('0x4a')][_0xe609('0x53')]=integrations[_0xe609('0x54')](_0x1ecedd[_0xe609('0x4a')][_0xe609('0x52')],_0x1ecedd[_0xe609('0x4a')][_0xe609('0x2f')]);return db[_0xe609('0x4e')]['create'](_0x1ecedd[_0xe609('0x4a')],{'include':[{'model':db[_0xe609('0x55')],'as':_0xe609('0x56')},{'model':db[_0xe609('0x55')],'as':_0xe609('0x53')}]});}return null;})[_0xe609('0x28')](respondWithResult(_0x2cf62f,null))[_0xe609('0x46')](handleError(_0x2cf62f,null));};var md5=require(_0xe609('0x57'));exports[_0xe609('0x58')]=function(_0x54e3b5,_0x4d305f,_0x3d2cb3){var _0x4e58dc=null;var _0x486a21=null;var _0x1964b8=null;var _0x328538=null;var _0x37106e='';return db['VtigerAccount'][_0xe609('0x4d')]({'where':{'id':_0x54e3b5['params']['id']},'attributes':['id',_0xe609('0x2c'),'username','description','moduleName',_0xe609('0x59'),_0xe609('0x5a'),_0xe609('0x5b')]})[_0xe609('0x28')](handleEntityNotFound(_0x4d305f,null))[_0xe609('0x28')](function(_0x24c9aa){if(_0x24c9aa){_0x4e58dc=_0x24c9aa[_0xe609('0x5c')];_0x486a21=_0x24c9aa[_0xe609('0x5b')];_0x1964b8=_0x24c9aa[_0xe609('0x5d')];_0x37106e=_0x24c9aa[_0xe609('0x59')];var _0x34e560=_0x37106e[_0xe609('0x5e')](-0x1);if(_0x34e560==='/'){_0x37106e=_0x37106e[_0xe609('0x5f')](0x0,_0x37106e[_0xe609('0x60')](_0x34e560));}_0x328538=util['format'](_0xe609('0x61'),_0x37106e);var _0x29720b={'method':_0xe609('0x62'),'uri':_0x328538,'qs':{'operation':_0xe609('0x63'),'username':_0x24c9aa[_0xe609('0x5c')]},'json':!![]};return rp(_0x29720b);}})['then'](function(_0x1a0b93){if(_0x1a0b93[_0xe609('0x64')]){var _0xe3af28={'method':_0xe609('0x65'),'uri':_0x328538,'form':{'operation':_0xe609('0x66'),'username':_0x4e58dc,'accessKey':md5(_0x1a0b93[_0xe609('0x67')][_0xe609('0x68')]+_0x486a21)},'json':!![]};return rp(_0xe3af28);}})[_0xe609('0x28')](function(_0x58dfbc){if(_0x58dfbc[_0xe609('0x64')]){var _0xedc04d={'method':_0xe609('0x62'),'uri':_0x328538,'qs':{'operation':_0xe609('0x69'),'username':_0x4e58dc,'sessionName':_0x58dfbc[_0xe609('0x67')][_0xe609('0x6a')],'elementType':_0x1964b8},'json':!![]};return rp(_0xedc04d);}})[_0xe609('0x28')](function(_0x2f859a){if(_0x2f859a[_0xe609('0x64')]){var _0x39c0df=[_0xe609('0x6b'),'reference',_0xe609('0x6c')];_[_0xe609('0x6d')](_0x2f859a['result'][_0xe609('0x36')],function(_0x2a5bea){return _0x39c0df['includes'](_0x2a5bea[_0xe609('0x2f')][_0xe609('0x2c')]);});_[_0xe609('0x6d')](_0x2f859a[_0xe609('0x67')]['fields'],function(_0x1ae358){return _0x1ae358[_0xe609('0x6e')]==='false';});return{'count':_0x2f859a[_0xe609('0x67')][_0xe609('0x36')]['length'],'rows':_[_0xe609('0x2d')](_0x2f859a[_0xe609('0x67')][_0xe609('0x36')],function(_0x51cf87){return{'id':_0x51cf87[_0xe609('0x2c')],'name':_0x51cf87[_0xe609('0x6f')],'custom':_[_0xe609('0x70')](_0x51cf87['name'],'cf_')?!![]:![],'options':_0x51cf87['type'][_0xe609('0x2c')]===_0xe609('0x71')&&_0x51cf87[_0xe609('0x2f')][_0xe609('0x72')][_0xe609('0x38')]>0x0?_['map'](_0x51cf87['type'][_0xe609('0x72')],function(_0x3f09e7){return{'name':_0x3f09e7[_0xe609('0x6f')],'value':_0x3f09e7['value']};}):[]};})};}})[_0xe609('0x28')](respondWithResult(_0x4d305f,null))['catch'](function(_0x4a104b){console['log'](_0xe609('0x73')+_0x4a104b);var _0x17209a=_0x54e3b5[_0xe609('0x32')]['test']?0x1f4:_0x4a104b[_0xe609('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x17209a,JSON[_0xe609('0x75')](_0x4a104b));delete _0x4a104b[_0xe609('0x2c')];if(_0x17209a===0x191){_0x17209a=0x190;}_0x4d305f[_0xe609('0x1c')](_0x17209a)[_0xe609('0x76')](_0x54e3b5['query']['test']?{'message':_0xe609('0x77'),'statusCode':_0x4a104b[_0xe609('0x74')]}:_0x4a104b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 23fcdb1..6d2321f 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 _0xcee4=['util','../../config/logger','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','lodash'];(function(_0x56a561,_0x4d6275){var _0x691adf=function(_0x22e733){while(--_0x22e733){_0x56a561['push'](_0x56a561['shift']());}};_0x691adf(++_0x4d6275);}(_0xcee4,0x1af));var _0x4cee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcee4[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x4cee('0x0'));var util=require(_0x4cee('0x1'));var logger=require(_0x4cee('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4cee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cee('0x4'));var config=require(_0x4cee('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4cee('0x6'));module['exports']=function(_0x13ced6,_0x17d9e0){return _0x13ced6[_0x4cee('0x7')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf5=['define','int_vtiger_accounts','util','../../config/logger','api','bluebird','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3ab47f,_0x441b32){var _0x1221fe=function(_0x5176b6){while(--_0x5176b6){_0x3ab47f['push'](_0x3ab47f['shift']());}};_0x1221fe(++_0x441b32);}(_0xaaf5,0x66));var _0x5aaf=function(_0x284ed6,_0x2a7a0d){_0x284ed6=_0x284ed6-0x0;var _0x4965cf=_0xaaf5[_0x284ed6];return _0x4965cf;};'use strict';var _=require('lodash');var util=require(_0x5aaf('0x0'));var logger=require(_0x5aaf('0x1'))(_0x5aaf('0x2'));var moment=require('moment');var BPromise=require(_0x5aaf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aaf('0x4'));var rimraf=require('rimraf');var config=require(_0x5aaf('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x5aaf('0x6'));module[_0x5aaf('0x7')]=function(_0xd8d9d,_0x45a8e2){return _0xd8d9d[_0x5aaf('0x8')]('VtigerAccount',attributes,{'tableName':_0x5aaf('0x9'),'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 c926c2d..1e34298 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 _0x7072=['model','then','ShowVtigerAccount','VtigerAccount','find','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','include'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7072,0x138));var _0x2707=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7072[_0x1eda20];return _0x31b953;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});}exports[_0x2707('0x15')]=function(_0x4a8b7f){var _0x119ac4=this;return new Promise(function(_0x449a61,_0x4009f3){return db['VtigerAccount']['findAll']({'raw':_0x4a8b7f['options']?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x19')]||null:null,'limit':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1a')]||null:null,'include':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')]?_['map'](_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')],function(_0x46259e){return{'model':db[_0x46259e[_0x2707('0x1c')]],'as':_0x46259e['as'],'attributes':_0x46259e[_0x2707('0x19')],'include':_0x46259e[_0x2707('0x1b')]?_['map'](_0x46259e[_0x2707('0x1b')],function(_0x3f6976){return{'model':db[_0x3f6976[_0x2707('0x1c')]],'as':_0x3f6976['as'],'attributes':_0x3f6976[_0x2707('0x19')],'include':_0x3f6976[_0x2707('0x1b')]?_['map'](_0x3f6976[_0x2707('0x1b')],function(_0x4ca05d){return{'model':db[_0x4ca05d[_0x2707('0x1c')]],'as':_0x4ca05d['as'],'attributes':_0x4ca05d[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x57da26){logger[_0x2707('0xb')](_0x2707('0x15'),_0x4a8b7f);logger[_0x2707('0xe')]('GetVtigerAccount',_0x4a8b7f,JSON[_0x2707('0x10')](_0x57da26));_0x449a61(_0x57da26);})[_0x2707('0x14')](function(_0x4a99ce){logger[_0x2707('0x11')]('GetVtigerAccount',_0x4a99ce['message'],_0x4a8b7f);_0x4009f3(_0x119ac4[_0x2707('0x11')](0x1f4,_0x4a99ce['message']));});});};exports[_0x2707('0x1e')]=function(_0x3f153d){var _0x417a97=this;return new Promise(function(_0x36b2e9,_0x48832b){return db[_0x2707('0x1f')][_0x2707('0x20')]({'raw':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options'][_0x2707('0x19')]||null:null,'include':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options']['include']?_['map'](_0x3f153d['options']['include'],function(_0x137e04){return{'model':db[_0x137e04['model']],'as':_0x137e04['as'],'attributes':_0x137e04['attributes'],'include':_0x137e04[_0x2707('0x1b')]?_[_0x2707('0x21')](_0x137e04['include'],function(_0x473954){return{'model':db[_0x473954[_0x2707('0x1c')]],'as':_0x473954['as'],'attributes':_0x473954['attributes'],'include':_0x473954['include']?_[_0x2707('0x21')](_0x473954[_0x2707('0x1b')],function(_0x521edb){return{'model':db[_0x521edb['model']],'as':_0x521edb['as'],'attributes':_0x521edb[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x5a18b0){logger[_0x2707('0xb')](_0x2707('0x1e'),_0x3f153d);logger[_0x2707('0xe')](_0x2707('0x1e'),_0x3f153d,JSON[_0x2707('0x10')](_0x5a18b0));_0x36b2e9(_0x5a18b0);})[_0x2707('0x14')](function(_0x5bd2e5){logger[_0x2707('0x11')](_0x2707('0x1e'),_0x5bd2e5[_0x2707('0x13')],_0x3f153d);_0x48832b(_0x417a97[_0x2707('0x11')](0x1f4,_0x5bd2e5[_0x2707('0x13')]));});});}; \ No newline at end of file +var _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x52cbea,_0x193a8f){var _0x1761f4=function(_0x4c9edb){while(--_0x4c9edb){_0x52cbea['push'](_0x52cbea['shift']());}};_0x1761f4(++_0x193a8f);}(_0x6c76,0x184));var _0x66c7=function(_0x3f1915,_0x274383){_0x3f1915=_0x3f1915-0x0;var _0x1d41e5=_0x6c76[_0x3f1915];return _0x1d41e5;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 198bfda..1b146c5 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 _0xdbc9=['show','get','/:id/fields','/:id/subjects','getDescriptions','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','/:id'];(function(_0x1bbb7e,_0x4b24ef){var _0x4ea13e=function(_0x4faeb6){while(--_0x4faeb6){_0x1bbb7e['push'](_0x1bbb7e['shift']());}};_0x4ea13e(++_0x4b24ef);}(_0xdbc9,0x1c2));var _0x9dbc=function(_0x52228c,_0x3cae48){_0x52228c=_0x52228c-0x0;var _0x4cf5f4=_0xdbc9[_0x52228c];return _0x4cf5f4;};'use strict';var multer=require(_0x9dbc('0x0'));var util=require(_0x9dbc('0x1'));var path=require(_0x9dbc('0x2'));var timeout=require(_0x9dbc('0x3'));var express=require(_0x9dbc('0x4'));var router=express[_0x9dbc('0x5')]();var fs_extra=require(_0x9dbc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9dbc('0x7'));var config=require('../../config/environment');var controller=require(_0x9dbc('0x8'));router['get']('/',auth[_0x9dbc('0x9')](),controller[_0x9dbc('0xa')]);router['get'](_0x9dbc('0xb'),auth[_0x9dbc('0x9')](),controller[_0x9dbc('0xc')]);router[_0x9dbc('0xd')](_0x9dbc('0xe'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x9dbc('0xf'),auth[_0x9dbc('0x9')](),controller['getSubjects']);router[_0x9dbc('0xd')]('/:id/descriptions',auth[_0x9dbc('0x9')](),controller[_0x9dbc('0x10')]);router[_0x9dbc('0x11')]('/',auth['isAuthenticated'](),controller[_0x9dbc('0x12')]);router[_0x9dbc('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9dbc('0x14')]);router['delete']('/:id',auth[_0x9dbc('0x9')](),controller['destroy']);module[_0x9dbc('0x15')]=router; \ No newline at end of file +var _0x3eeb=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete'];(function(_0x21f4ec,_0x10230a){var _0x8b6a3f=function(_0x12123e){while(--_0x12123e){_0x21f4ec['push'](_0x21f4ec['shift']());}};_0x8b6a3f(++_0x10230a);}(_0x3eeb,0x1a3));var _0xb3ee=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3eeb[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xb3ee('0x0'));var util=require(_0xb3ee('0x1'));var path=require(_0xb3ee('0x2'));var timeout=require(_0xb3ee('0x3'));var express=require(_0xb3ee('0x4'));var router=express[_0xb3ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb3ee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ee('0x7'));var controller=require(_0xb3ee('0x8'));router[_0xb3ee('0x9')]('/',auth['isAuthenticated'](),controller[_0xb3ee('0xa')]);router['get']('/:id',auth[_0xb3ee('0xb')](),controller[_0xb3ee('0xc')]);router[_0xb3ee('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb3ee('0xd')]);router[_0xb3ee('0x9')](_0xb3ee('0xe'),auth[_0xb3ee('0xb')](),controller['getSubjects']);router['get'](_0xb3ee('0xf'),auth[_0xb3ee('0xb')](),controller['getDescriptions']);router[_0xb3ee('0x10')]('/',auth[_0xb3ee('0xb')](),controller[_0xb3ee('0x11')]);router[_0xb3ee('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb3ee('0x13')]);router[_0xb3ee('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb3ee('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b4d6002..3f11127 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 _0x7729=['exports','STRING','sequelize'];(function(_0x5eb071,_0x32cc8a){var _0x106c63=function(_0x2e6f82){while(--_0x2e6f82){_0x5eb071['push'](_0x5eb071['shift']());}};_0x106c63(++_0x32cc8a);}(_0x7729,0x1e8));var _0x9772=function(_0x4b3a03,_0x595239){_0x4b3a03=_0x4b3a03-0x0;var _0x2b0bbe=_0x7729[_0x4b3a03];return _0x2b0bbe;};'use strict';var Sequelize=require(_0x9772('0x0'));module[_0x9772('0x1')]={'name':{'type':Sequelize[_0x9772('0x2')]},'description':{'type':Sequelize[_0x9772('0x2')]}}; \ No newline at end of file +var _0x8c54=['sequelize','exports','STRING'];(function(_0xe24d25,_0x37bb1c){var _0x1be9ee=function(_0x22e4a4){while(--_0x22e4a4){_0xe24d25['push'](_0xe24d25['shift']());}};_0x1be9ee(++_0x37bb1c);}(_0x8c54,0x6c));var _0x48c5=function(_0xc5439c,_0xbc5fe3){_0xc5439c=_0xc5439c-0x0;var _0x35d758=_0x8c54[_0xc5439c];return _0x35d758;};'use strict';var Sequelize=require(_0x48c5('0x0'));module[_0x48c5('0x1')]={'name':{'type':Sequelize[_0x48c5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 03cad1e..49f5dcd 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 _0x732c=['getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','VtigerConfiguration','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','pick','getSubjects'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x732c,0x151));var _0xc732=function(_0x1737d7,_0x2d273e){_0x1737d7=_0x1737d7-0x0;var _0x474418=_0x732c[_0x1737d7];return _0x474418;};'use strict';var emlformat=require(_0xc732('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc732('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc732('0x2'));var moment=require('moment');var BPromise=require(_0xc732('0x3'));var Mustache=require(_0xc732('0x4'));var util=require('util');var path=require(_0xc732('0x5'));var sox=require(_0xc732('0x6'));var csv=require(_0xc732('0x7'));var ejs=require(_0xc732('0x8'));var fs=require('fs');var fs_extra=require(_0xc732('0x9'));var _=require(_0xc732('0xa'));var squel=require('squel');var crypto=require(_0xc732('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc732('0xc'));var toCsv=require(_0xc732('0x7'));var querystring=require(_0xc732('0xd'));var Papa=require(_0xc732('0xe'));var Redis=require(_0xc732('0xf'));var authService=require(_0xc732('0x10'));var qs=require(_0xc732('0x11'));var as=require(_0xc732('0x12'));var hardwareService=require(_0xc732('0x13'));var logger=require(_0xc732('0x14'))(_0xc732('0x15'));var utils=require(_0xc732('0x16'));var config=require(_0xc732('0x17'));var licenseUtil=require(_0xc732('0x18'));var db=require(_0xc732('0x19'))['db'];function respondWithStatusCode(_0xe32b56,_0x550b46){_0x550b46=_0x550b46||0xcc;return function(_0x1cc00b){if(_0x1cc00b){return _0xe32b56[_0xc732('0x1a')](_0x550b46);}return _0xe32b56[_0xc732('0x1b')](_0x550b46)['end']();};}function respondWithResult(_0xab6e7,_0x2eefa2){_0x2eefa2=_0x2eefa2||0xc8;return function(_0x5f29e9){if(_0x5f29e9){return _0xab6e7[_0xc732('0x1b')](_0x2eefa2)['json'](_0x5f29e9);}};}function respondWithFilteredResult(_0x11e601,_0x137d8e){return function(_0x372159){if(_0x372159){var _0x254d20=typeof _0x137d8e['offset']===_0xc732('0x1c')&&typeof _0x137d8e[_0xc732('0x1d')]===_0xc732('0x1c');var _0x3624af=_0x372159[_0xc732('0x1e')];var _0x349903=_0x254d20?0x0:_0x137d8e['offset'];var _0x58922d=_0x254d20?_0x372159['count']:_0x137d8e[_0xc732('0x1f')]+_0x137d8e['limit'];var _0x59755c;if(_0x58922d>=_0x3624af){_0x58922d=_0x3624af;_0x59755c=0xc8;}else{_0x59755c=0xce;}_0x11e601[_0xc732('0x1b')](_0x59755c);return _0x11e601[_0xc732('0x20')](_0xc732('0x21'),_0x349903+'-'+_0x58922d+'/'+_0x3624af)[_0xc732('0x22')](_0x372159);}return null;};}function patchUpdates(_0x5d9146){return function(_0x1881cd){try{jsonpatch[_0xc732('0x23')](_0x1881cd,_0x5d9146,!![]);}catch(_0x5c1d6b){return BPromise['reject'](_0x5c1d6b);}return _0x1881cd[_0xc732('0x24')]();};}function saveUpdates(_0x5b4428,_0x55030c){return function(_0x3326ca){if(_0x3326ca){return _0x3326ca[_0xc732('0x25')](_0x5b4428)[_0xc732('0x26')](function(_0x48cf2e){return _0x48cf2e;});}return null;};}function removeEntity(_0x35cf02,_0x51e736){return function(_0x3f7583){if(_0x3f7583){return _0x3f7583[_0xc732('0x27')]()['then'](function(){_0x35cf02['status'](0xcc)[_0xc732('0x28')]();});}};}function handleEntityNotFound(_0x4e0d75,_0x3f07bb){return function(_0x3a1eb1){if(!_0x3a1eb1){_0x4e0d75[_0xc732('0x1a')](0x194);}return _0x3a1eb1;};}function handleError(_0x21c2b6,_0x122aeb){_0x122aeb=_0x122aeb||0x1f4;return function(_0x28ea31){logger[_0xc732('0x29')](_0x28ea31[_0xc732('0x2a')]);if(_0x28ea31[_0xc732('0x2b')]){delete _0x28ea31[_0xc732('0x2b')];}_0x21c2b6[_0xc732('0x1b')](_0x122aeb)[_0xc732('0x2c')](_0x28ea31);};}exports[_0xc732('0x2d')]=function(_0x1449d1,_0x12ff37){var _0x18eac9={},_0x53f493={},_0x73b26f={'count':0x0,'rows':[]};var _0x1e22a4=_[_0xc732('0x2e')](db['VtigerConfiguration'][_0xc732('0x2f')],function(_0x19088a){return{'name':_0x19088a[_0xc732('0x30')],'type':_0x19088a[_0xc732('0x31')][_0xc732('0x32')]};});_0x53f493['model']=_[_0xc732('0x2e')](_0x1e22a4,_0xc732('0x2b'));_0x53f493[_0xc732('0x33')]=_[_0xc732('0x34')](_0x1449d1[_0xc732('0x33')]);_0x53f493['filters']=_[_0xc732('0x35')](_0x53f493[_0xc732('0x36')],_0x53f493[_0xc732('0x33')]);_0x18eac9[_0xc732('0x37')]=_[_0xc732('0x35')](_0x53f493[_0xc732('0x36')],qs[_0xc732('0x38')](_0x1449d1[_0xc732('0x33')]['fields']));_0x18eac9[_0xc732('0x37')]=_0x18eac9[_0xc732('0x37')][_0xc732('0x39')]?_0x18eac9[_0xc732('0x37')]:_0x53f493[_0xc732('0x36')];if(!_0x1449d1['query'][_0xc732('0x3a')](_0xc732('0x3b'))){_0x18eac9[_0xc732('0x1d')]=qs[_0xc732('0x1d')](_0x1449d1[_0xc732('0x33')][_0xc732('0x1d')]);_0x18eac9[_0xc732('0x1f')]=qs[_0xc732('0x1f')](_0x1449d1[_0xc732('0x33')][_0xc732('0x1f')]);}_0x18eac9[_0xc732('0x3c')]=qs['sort'](_0x1449d1[_0xc732('0x33')][_0xc732('0x3d')]);_0x18eac9[_0xc732('0x3e')]=qs[_0xc732('0x3f')](_['pick'](_0x1449d1[_0xc732('0x33')],_0x53f493['filters']),_0x1e22a4);if(_0x1449d1[_0xc732('0x33')][_0xc732('0x40')]){_0x18eac9[_0xc732('0x3e')]=_[_0xc732('0x41')](_0x18eac9['where'],{'$or':_[_0xc732('0x2e')](_0x1e22a4,function(_0x571ede){if(_0x571ede[_0xc732('0x31')]!==_0xc732('0x42')){var _0x4772e3={};_0x4772e3[_0x571ede[_0xc732('0x2b')]]={'$like':'%'+_0x1449d1[_0xc732('0x33')][_0xc732('0x40')]+'%'};return _0x4772e3;}})});}_0x18eac9=_[_0xc732('0x41')]({},_0x18eac9,_0x1449d1[_0xc732('0x43')]);var _0x29a816={'where':_0x18eac9[_0xc732('0x3e')]};return db['VtigerConfiguration'][_0xc732('0x1e')](_0x29a816)[_0xc732('0x26')](function(_0x16fe8a){_0x73b26f[_0xc732('0x1e')]=_0x16fe8a;if(_0x1449d1['query']['includeAll']){_0x18eac9[_0xc732('0x44')]=[{'all':!![]}];}return db[_0xc732('0x45')][_0xc732('0x46')](_0x18eac9);})['then'](function(_0x2950ee){_0x73b26f[_0xc732('0x47')]=_0x2950ee;return _0x73b26f;})[_0xc732('0x26')](respondWithFilteredResult(_0x12ff37,_0x18eac9))[_0xc732('0x48')](handleError(_0x12ff37,null));};exports[_0xc732('0x49')]=function(_0x22d995,_0x1fe223){var _0x431e68={'raw':![],'where':{'id':_0x22d995[_0xc732('0x4a')]['id']}},_0x50b02a={};_0x50b02a[_0xc732('0x36')]=_[_0xc732('0x34')](db[_0xc732('0x45')][_0xc732('0x2f')]);_0x50b02a[_0xc732('0x33')]=_[_0xc732('0x34')](_0x22d995[_0xc732('0x33')]);_0x50b02a[_0xc732('0x3f')]=_[_0xc732('0x35')](_0x50b02a[_0xc732('0x36')],_0x50b02a[_0xc732('0x33')]);_0x431e68['attributes']=_[_0xc732('0x35')](_0x50b02a[_0xc732('0x36')],qs[_0xc732('0x38')](_0x22d995['query'][_0xc732('0x38')]));_0x431e68[_0xc732('0x37')]=_0x431e68[_0xc732('0x37')][_0xc732('0x39')]?_0x431e68[_0xc732('0x37')]:_0x50b02a[_0xc732('0x36')];if(_0x22d995[_0xc732('0x33')]['includeAll']){_0x431e68['include']=[{'all':!![]}];}_0x431e68=_['merge']({},_0x431e68,_0x22d995['options']);return db[_0xc732('0x45')][_0xc732('0x4b')](_0x431e68)[_0xc732('0x26')](handleEntityNotFound(_0x1fe223,null))['then'](respondWithResult(_0x1fe223,null))[_0xc732('0x48')](handleError(_0x1fe223,null));};exports[_0xc732('0x4c')]=function(_0x20b8a9,_0x58bf6d){return db[_0xc732('0x45')][_0xc732('0x4c')](_0x20b8a9[_0xc732('0x4d')],{})['then'](respondWithResult(_0x58bf6d,0xc9))[_0xc732('0x48')](handleError(_0x58bf6d,null));};exports['update']=function(_0x5c74a2,_0x5e9e4d){if(_0x5c74a2[_0xc732('0x4d')]['id']){delete _0x5c74a2[_0xc732('0x4d')]['id'];}return db[_0xc732('0x45')]['find']({'where':{'id':_0x5c74a2[_0xc732('0x4a')]['id']}})[_0xc732('0x26')](handleEntityNotFound(_0x5e9e4d,null))[_0xc732('0x26')](saveUpdates(_0x5c74a2[_0xc732('0x4d')],null))[_0xc732('0x26')](respondWithResult(_0x5e9e4d,null))[_0xc732('0x48')](handleError(_0x5e9e4d,null));};exports[_0xc732('0x27')]=function(_0x5ded73,_0x1c5230){return db[_0xc732('0x45')][_0xc732('0x4b')]({'where':{'id':_0x5ded73['params']['id']}})[_0xc732('0x26')](handleEntityNotFound(_0x1c5230,null))[_0xc732('0x26')](removeEntity(_0x1c5230,null))['catch'](handleError(_0x1c5230,null));};exports[_0xc732('0x4e')]=function(_0x3d1b4c,_0x25bc41,_0x3ae4b8){var _0x48e14d={};var _0xbae137={};var _0x126b17;var _0x21b35e;return db[_0xc732('0x45')][_0xc732('0x4f')]({'where':{'id':_0x3d1b4c[_0xc732('0x4a')]['id']}})[_0xc732('0x26')](handleEntityNotFound(_0x25bc41,null))[_0xc732('0x26')](function(_0x32b152){if(_0x32b152){_0x126b17=_0x32b152;_0xbae137[_0xc732('0x36')]=_[_0xc732('0x34')](db[_0xc732('0x50')][_0xc732('0x2f')]);_0xbae137[_0xc732('0x33')]=_[_0xc732('0x34')](_0x3d1b4c[_0xc732('0x33')]);_0xbae137[_0xc732('0x3f')]=_['intersection'](_0xbae137['model'],_0xbae137[_0xc732('0x33')]);_0x48e14d['attributes']=_['intersection'](_0xbae137[_0xc732('0x36')],qs[_0xc732('0x38')](_0x3d1b4c[_0xc732('0x33')]['fields']));_0x48e14d[_0xc732('0x37')]=_0x48e14d['attributes'][_0xc732('0x39')]?_0x48e14d[_0xc732('0x37')]:_0xbae137['model'];_0x48e14d[_0xc732('0x3c')]=qs['sort'](_0x3d1b4c['query'][_0xc732('0x3d')]);_0x48e14d[_0xc732('0x3e')]=qs['filters'](_[_0xc732('0x51')](_0x3d1b4c[_0xc732('0x33')],_0xbae137['filters']));if(_0x3d1b4c['query'][_0xc732('0x40')]){_0x48e14d[_0xc732('0x3e')]=_[_0xc732('0x41')](_0x48e14d[_0xc732('0x3e')],{'$or':_[_0xc732('0x2e')](_0x48e14d[_0xc732('0x37')],function(_0x145be6){var _0x447afd={};_0x447afd[_0x145be6]={'$like':'%'+_0x3d1b4c['query']['filter']+'%'};return _0x447afd;})});}_0x48e14d=_[_0xc732('0x41')]({},_0x48e14d,_0x3d1b4c[_0xc732('0x43')]);return _0x126b17[_0xc732('0x4e')](_0x48e14d);}})[_0xc732('0x26')](function(_0x105c0c){if(_0x105c0c){_0x21b35e=_0x105c0c[_0xc732('0x39')];if(!_0x3d1b4c[_0xc732('0x33')][_0xc732('0x3a')]('nolimit')){_0x48e14d[_0xc732('0x1d')]=qs[_0xc732('0x1d')](_0x3d1b4c[_0xc732('0x33')][_0xc732('0x1d')]);_0x48e14d['offset']=qs['offset'](_0x3d1b4c[_0xc732('0x33')][_0xc732('0x1f')]);}return _0x126b17[_0xc732('0x4e')](_0x48e14d);}})[_0xc732('0x26')](function(_0x33759b){if(_0x33759b){return _0x33759b?{'count':_0x21b35e,'rows':_0x33759b}:null;}})['then'](respondWithResult(_0x25bc41,null))[_0xc732('0x48')](handleError(_0x25bc41,null));};exports['getSubjects']=function(_0x337844,_0x2a4b68,_0x33025e){var _0xc22e6b={};var _0x265009={};var _0x4b5a78;var _0x53ff87;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x337844['params']['id']}})[_0xc732('0x26')](handleEntityNotFound(_0x2a4b68,null))[_0xc732('0x26')](function(_0x2502c4){if(_0x2502c4){_0x4b5a78=_0x2502c4;_0x265009[_0xc732('0x36')]=_['keys'](db[_0xc732('0x50')][_0xc732('0x2f')]);_0x265009[_0xc732('0x33')]=_[_0xc732('0x34')](_0x337844[_0xc732('0x33')]);_0x265009[_0xc732('0x3f')]=_[_0xc732('0x35')](_0x265009['model'],_0x265009['query']);_0xc22e6b[_0xc732('0x37')]=_[_0xc732('0x35')](_0x265009[_0xc732('0x36')],qs['fields'](_0x337844[_0xc732('0x33')][_0xc732('0x38')]));_0xc22e6b['attributes']=_0xc22e6b['attributes'][_0xc732('0x39')]?_0xc22e6b[_0xc732('0x37')]:_0x265009[_0xc732('0x36')];_0xc22e6b[_0xc732('0x3c')]=qs[_0xc732('0x3d')](_0x337844[_0xc732('0x33')][_0xc732('0x3d')]);_0xc22e6b['where']=qs[_0xc732('0x3f')](_['pick'](_0x337844[_0xc732('0x33')],_0x265009[_0xc732('0x3f')]));if(_0x337844[_0xc732('0x33')][_0xc732('0x40')]){_0xc22e6b['where']=_[_0xc732('0x41')](_0xc22e6b[_0xc732('0x3e')],{'$or':_[_0xc732('0x2e')](_0xc22e6b['attributes'],function(_0x4fb99b){var _0x2e8f62={};_0x2e8f62[_0x4fb99b]={'$like':'%'+_0x337844['query'][_0xc732('0x40')]+'%'};return _0x2e8f62;})});}_0xc22e6b=_[_0xc732('0x41')]({},_0xc22e6b,_0x337844['options']);return _0x4b5a78[_0xc732('0x52')](_0xc22e6b);}})[_0xc732('0x26')](function(_0x284c77){if(_0x284c77){_0x53ff87=_0x284c77['length'];if(!_0x337844['query'][_0xc732('0x3a')]('nolimit')){_0xc22e6b[_0xc732('0x1d')]=qs[_0xc732('0x1d')](_0x337844[_0xc732('0x33')][_0xc732('0x1d')]);_0xc22e6b[_0xc732('0x1f')]=qs[_0xc732('0x1f')](_0x337844[_0xc732('0x33')][_0xc732('0x1f')]);}return _0x4b5a78[_0xc732('0x52')](_0xc22e6b);}})[_0xc732('0x26')](function(_0x844a69){if(_0x844a69){return _0x844a69?{'count':_0x53ff87,'rows':_0x844a69}:null;}})[_0xc732('0x26')](respondWithResult(_0x2a4b68,null))[_0xc732('0x48')](handleError(_0x2a4b68,null));};exports[_0xc732('0x53')]=function(_0x23ab12,_0x52ef34,_0x54580f){var _0x135161={};var _0x52b5e7={};var _0x2b5308;var _0x17af0f;return db[_0xc732('0x45')][_0xc732('0x4f')]({'where':{'id':_0x23ab12[_0xc732('0x4a')]['id']}})[_0xc732('0x26')](handleEntityNotFound(_0x52ef34,null))[_0xc732('0x26')](function(_0x38e163){if(_0x38e163){_0x2b5308=_0x38e163;_0x52b5e7[_0xc732('0x36')]=_[_0xc732('0x34')](db[_0xc732('0x50')][_0xc732('0x2f')]);_0x52b5e7[_0xc732('0x33')]=_[_0xc732('0x34')](_0x23ab12['query']);_0x52b5e7[_0xc732('0x3f')]=_[_0xc732('0x35')](_0x52b5e7[_0xc732('0x36')],_0x52b5e7[_0xc732('0x33')]);_0x135161[_0xc732('0x37')]=_[_0xc732('0x35')](_0x52b5e7[_0xc732('0x36')],qs['fields'](_0x23ab12[_0xc732('0x33')][_0xc732('0x38')]));_0x135161['attributes']=_0x135161['attributes'][_0xc732('0x39')]?_0x135161[_0xc732('0x37')]:_0x52b5e7[_0xc732('0x36')];_0x135161['order']=qs[_0xc732('0x3d')](_0x23ab12[_0xc732('0x33')][_0xc732('0x3d')]);_0x135161['where']=qs[_0xc732('0x3f')](_[_0xc732('0x51')](_0x23ab12[_0xc732('0x33')],_0x52b5e7[_0xc732('0x3f')]));if(_0x23ab12['query']['filter']){_0x135161[_0xc732('0x3e')]=_[_0xc732('0x41')](_0x135161['where'],{'$or':_[_0xc732('0x2e')](_0x135161[_0xc732('0x37')],function(_0x38cfd7){var _0x213689={};_0x213689[_0x38cfd7]={'$like':'%'+_0x23ab12[_0xc732('0x33')][_0xc732('0x40')]+'%'};return _0x213689;})});}_0x135161=_[_0xc732('0x41')]({},_0x135161,_0x23ab12[_0xc732('0x43')]);return _0x2b5308[_0xc732('0x53')](_0x135161);}})[_0xc732('0x26')](function(_0x2d224d){if(_0x2d224d){_0x17af0f=_0x2d224d['length'];if(!_0x23ab12[_0xc732('0x33')][_0xc732('0x3a')]('nolimit')){_0x135161['limit']=qs[_0xc732('0x1d')](_0x23ab12[_0xc732('0x33')][_0xc732('0x1d')]);_0x135161[_0xc732('0x1f')]=qs[_0xc732('0x1f')](_0x23ab12['query'][_0xc732('0x1f')]);}return _0x2b5308[_0xc732('0x53')](_0x135161);}})['then'](function(_0x27e8f2){if(_0x27e8f2){return _0x27e8f2?{'count':_0x17af0f,'rows':_0x27e8f2}:null;}})[_0xc732('0x26')](respondWithResult(_0x52ef34,null))[_0xc732('0x48')](handleError(_0x52ef34,null));}; \ No newline at end of file +var _0x6cfc=['find','create','body','update','params','findOne','VtigerField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','count','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','keys','options'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6cfc,0x14a));var _0xc6cf=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x6cfc[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6cf('0x0'));var zipdir=require(_0xc6cf('0x1'));var jsonpatch=require(_0xc6cf('0x2'));var rp=require(_0xc6cf('0x3'));var moment=require(_0xc6cf('0x4'));var BPromise=require(_0xc6cf('0x5'));var Mustache=require('mustache');var util=require(_0xc6cf('0x6'));var path=require('path');var sox=require(_0xc6cf('0x7'));var csv=require(_0xc6cf('0x8'));var ejs=require(_0xc6cf('0x9'));var fs=require('fs');var fs_extra=require(_0xc6cf('0xa'));var _=require('lodash');var squel=require(_0xc6cf('0xb'));var crypto=require(_0xc6cf('0xc'));var jsforce=require(_0xc6cf('0xd'));var deskjs=require(_0xc6cf('0xe'));var toCsv=require(_0xc6cf('0x8'));var querystring=require(_0xc6cf('0xf'));var Papa=require(_0xc6cf('0x10'));var Redis=require('ioredis');var authService=require(_0xc6cf('0x11'));var qs=require(_0xc6cf('0x12'));var as=require(_0xc6cf('0x13'));var hardwareService=require(_0xc6cf('0x14'));var logger=require(_0xc6cf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc6cf('0x16'));var licenseUtil=require(_0xc6cf('0x17'));var db=require(_0xc6cf('0x18'))['db'];function respondWithStatusCode(_0x464561,_0x53e0eb){_0x53e0eb=_0x53e0eb||0xcc;return function(_0x4d2993){if(_0x4d2993){return _0x464561['sendStatus'](_0x53e0eb);}return _0x464561[_0xc6cf('0x19')](_0x53e0eb)[_0xc6cf('0x1a')]();};}function respondWithResult(_0x2276a8,_0x2e4a8e){_0x2e4a8e=_0x2e4a8e||0xc8;return function(_0x1d7b16){if(_0x1d7b16){return _0x2276a8[_0xc6cf('0x19')](_0x2e4a8e)['json'](_0x1d7b16);}};}function respondWithFilteredResult(_0x77674b,_0x245917){return function(_0x175452){if(_0x175452){var _0x2f3c14=typeof _0x245917['offset']==='undefined'&&typeof _0x245917[_0xc6cf('0x1b')]===_0xc6cf('0x1c');var _0x18412b=_0x175452['count'];var _0x36c984=_0x2f3c14?0x0:_0x245917[_0xc6cf('0x1d')];var _0x18a7dc=_0x2f3c14?_0x175452[_0xc6cf('0x1e')]:_0x245917['offset']+_0x245917[_0xc6cf('0x1b')];var _0x5bb87a;if(_0x18a7dc>=_0x18412b){_0x18a7dc=_0x18412b;_0x5bb87a=0xc8;}else{_0x5bb87a=0xce;}_0x77674b[_0xc6cf('0x19')](_0x5bb87a);return _0x77674b['set'](_0xc6cf('0x1f'),_0x36c984+'-'+_0x18a7dc+'/'+_0x18412b)[_0xc6cf('0x20')](_0x175452);}return null;};}function patchUpdates(_0x134e43){return function(_0x5965c2){try{jsonpatch['apply'](_0x5965c2,_0x134e43,!![]);}catch(_0x487697){return BPromise[_0xc6cf('0x21')](_0x487697);}return _0x5965c2[_0xc6cf('0x22')]();};}function saveUpdates(_0x3194d5,_0x25ba2d){return function(_0x3ad7df){if(_0x3ad7df){return _0x3ad7df['update'](_0x3194d5)[_0xc6cf('0x23')](function(_0xfcb496){return _0xfcb496;});}return null;};}function removeEntity(_0x3bbd1d,_0x2f5bbc){return function(_0x25382e){if(_0x25382e){return _0x25382e[_0xc6cf('0x24')]()[_0xc6cf('0x23')](function(){_0x3bbd1d['status'](0xcc)[_0xc6cf('0x1a')]();});}};}function handleEntityNotFound(_0x1bd5d3,_0x415a2b){return function(_0x68c439){if(!_0x68c439){_0x1bd5d3[_0xc6cf('0x25')](0x194);}return _0x68c439;};}function handleError(_0x3bd3a0,_0x36c045){_0x36c045=_0x36c045||0x1f4;return function(_0x590a83){logger[_0xc6cf('0x26')](_0x590a83[_0xc6cf('0x27')]);if(_0x590a83['name']){delete _0x590a83[_0xc6cf('0x28')];}_0x3bd3a0[_0xc6cf('0x19')](_0x36c045)[_0xc6cf('0x29')](_0x590a83);};}exports['index']=function(_0x180207,_0x4e8d1c){var _0x11212d={},_0x19ce8b={},_0x2a1049={'count':0x0,'rows':[]};var _0x33675f=_[_0xc6cf('0x2a')](db[_0xc6cf('0x2b')][_0xc6cf('0x2c')],function(_0x172b46){return{'name':_0x172b46[_0xc6cf('0x2d')],'type':_0x172b46[_0xc6cf('0x2e')][_0xc6cf('0x2f')]};});_0x19ce8b[_0xc6cf('0x30')]=_[_0xc6cf('0x2a')](_0x33675f,_0xc6cf('0x28'));_0x19ce8b[_0xc6cf('0x31')]=_['keys'](_0x180207['query']);_0x19ce8b[_0xc6cf('0x32')]=_[_0xc6cf('0x33')](_0x19ce8b[_0xc6cf('0x30')],_0x19ce8b[_0xc6cf('0x31')]);_0x11212d['attributes']=_[_0xc6cf('0x33')](_0x19ce8b[_0xc6cf('0x30')],qs[_0xc6cf('0x34')](_0x180207[_0xc6cf('0x31')][_0xc6cf('0x34')]));_0x11212d[_0xc6cf('0x35')]=_0x11212d[_0xc6cf('0x35')][_0xc6cf('0x36')]?_0x11212d['attributes']:_0x19ce8b[_0xc6cf('0x30')];if(!_0x180207[_0xc6cf('0x31')][_0xc6cf('0x37')](_0xc6cf('0x38'))){_0x11212d[_0xc6cf('0x1b')]=qs['limit'](_0x180207[_0xc6cf('0x31')]['limit']);_0x11212d[_0xc6cf('0x1d')]=qs[_0xc6cf('0x1d')](_0x180207[_0xc6cf('0x31')][_0xc6cf('0x1d')]);}_0x11212d[_0xc6cf('0x39')]=qs['sort'](_0x180207[_0xc6cf('0x31')][_0xc6cf('0x3a')]);_0x11212d[_0xc6cf('0x3b')]=qs[_0xc6cf('0x32')](_[_0xc6cf('0x3c')](_0x180207[_0xc6cf('0x31')],_0x19ce8b['filters']),_0x33675f);if(_0x180207[_0xc6cf('0x31')][_0xc6cf('0x3d')]){_0x11212d['where']=_['merge'](_0x11212d[_0xc6cf('0x3b')],{'$or':_[_0xc6cf('0x2a')](_0x33675f,function(_0x1ef816){if(_0x1ef816['type']!=='VIRTUAL'){var _0x7db649={};_0x7db649[_0x1ef816['name']]={'$like':'%'+_0x180207[_0xc6cf('0x31')][_0xc6cf('0x3d')]+'%'};return _0x7db649;}})});}_0x11212d=_[_0xc6cf('0x3e')]({},_0x11212d,_0x180207['options']);var _0x25a7a3={'where':_0x11212d['where']};return db[_0xc6cf('0x2b')][_0xc6cf('0x1e')](_0x25a7a3)['then'](function(_0x457797){_0x2a1049['count']=_0x457797;if(_0x180207[_0xc6cf('0x31')][_0xc6cf('0x3f')]){_0x11212d[_0xc6cf('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x11212d);})['then'](function(_0x1d7ff7){_0x2a1049[_0xc6cf('0x41')]=_0x1d7ff7;return _0x2a1049;})['then'](respondWithFilteredResult(_0x4e8d1c,_0x11212d))[_0xc6cf('0x42')](handleError(_0x4e8d1c,null));};exports[_0xc6cf('0x43')]=function(_0x210338,_0x3fd7e0){var _0x4cab5d={'raw':![],'where':{'id':_0x210338['params']['id']}},_0x21c04d={};_0x21c04d[_0xc6cf('0x30')]=_[_0xc6cf('0x44')](db[_0xc6cf('0x2b')][_0xc6cf('0x2c')]);_0x21c04d['query']=_[_0xc6cf('0x44')](_0x210338[_0xc6cf('0x31')]);_0x21c04d[_0xc6cf('0x32')]=_[_0xc6cf('0x33')](_0x21c04d[_0xc6cf('0x30')],_0x21c04d[_0xc6cf('0x31')]);_0x4cab5d[_0xc6cf('0x35')]=_['intersection'](_0x21c04d[_0xc6cf('0x30')],qs[_0xc6cf('0x34')](_0x210338[_0xc6cf('0x31')][_0xc6cf('0x34')]));_0x4cab5d[_0xc6cf('0x35')]=_0x4cab5d[_0xc6cf('0x35')][_0xc6cf('0x36')]?_0x4cab5d[_0xc6cf('0x35')]:_0x21c04d[_0xc6cf('0x30')];if(_0x210338[_0xc6cf('0x31')][_0xc6cf('0x3f')]){_0x4cab5d[_0xc6cf('0x40')]=[{'all':!![]}];}_0x4cab5d=_[_0xc6cf('0x3e')]({},_0x4cab5d,_0x210338[_0xc6cf('0x45')]);return db[_0xc6cf('0x2b')][_0xc6cf('0x46')](_0x4cab5d)[_0xc6cf('0x23')](handleEntityNotFound(_0x3fd7e0,null))[_0xc6cf('0x23')](respondWithResult(_0x3fd7e0,null))['catch'](handleError(_0x3fd7e0,null));};exports[_0xc6cf('0x47')]=function(_0x10de44,_0x194e7e){return db['VtigerConfiguration'][_0xc6cf('0x47')](_0x10de44[_0xc6cf('0x48')],{})[_0xc6cf('0x23')](respondWithResult(_0x194e7e,0xc9))['catch'](handleError(_0x194e7e,null));};exports[_0xc6cf('0x49')]=function(_0x3c9c3a,_0x46b017){if(_0x3c9c3a[_0xc6cf('0x48')]['id']){delete _0x3c9c3a['body']['id'];}return db[_0xc6cf('0x2b')][_0xc6cf('0x46')]({'where':{'id':_0x3c9c3a[_0xc6cf('0x4a')]['id']}})[_0xc6cf('0x23')](handleEntityNotFound(_0x46b017,null))[_0xc6cf('0x23')](saveUpdates(_0x3c9c3a[_0xc6cf('0x48')],null))['then'](respondWithResult(_0x46b017,null))[_0xc6cf('0x42')](handleError(_0x46b017,null));};exports['destroy']=function(_0x3790dc,_0x5bd324){return db['VtigerConfiguration'][_0xc6cf('0x46')]({'where':{'id':_0x3790dc['params']['id']}})[_0xc6cf('0x23')](handleEntityNotFound(_0x5bd324,null))['then'](removeEntity(_0x5bd324,null))[_0xc6cf('0x42')](handleError(_0x5bd324,null));};exports['getFields']=function(_0x1e8b0e,_0x1f74b2,_0x513a54){var _0x19514e={};var _0x277c25={};var _0x1b5019;var _0x26dba8;return db[_0xc6cf('0x2b')][_0xc6cf('0x4b')]({'where':{'id':_0x1e8b0e['params']['id']}})['then'](handleEntityNotFound(_0x1f74b2,null))[_0xc6cf('0x23')](function(_0x4f981a){if(_0x4f981a){_0x1b5019=_0x4f981a;_0x277c25[_0xc6cf('0x30')]=_['keys'](db[_0xc6cf('0x4c')]['rawAttributes']);_0x277c25[_0xc6cf('0x31')]=_[_0xc6cf('0x44')](_0x1e8b0e['query']);_0x277c25['filters']=_[_0xc6cf('0x33')](_0x277c25[_0xc6cf('0x30')],_0x277c25[_0xc6cf('0x31')]);_0x19514e[_0xc6cf('0x35')]=_[_0xc6cf('0x33')](_0x277c25[_0xc6cf('0x30')],qs['fields'](_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x34')]));_0x19514e['attributes']=_0x19514e['attributes']['length']?_0x19514e['attributes']:_0x277c25[_0xc6cf('0x30')];_0x19514e['order']=qs['sort'](_0x1e8b0e['query']['sort']);_0x19514e[_0xc6cf('0x3b')]=qs['filters'](_['pick'](_0x1e8b0e[_0xc6cf('0x31')],_0x277c25[_0xc6cf('0x32')]));if(_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x3d')]){_0x19514e[_0xc6cf('0x3b')]=_[_0xc6cf('0x3e')](_0x19514e[_0xc6cf('0x3b')],{'$or':_[_0xc6cf('0x2a')](_0x19514e[_0xc6cf('0x35')],function(_0xa6dc0b){var _0x18bc54={};_0x18bc54[_0xa6dc0b]={'$like':'%'+_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x3d')]+'%'};return _0x18bc54;})});}_0x19514e=_[_0xc6cf('0x3e')]({},_0x19514e,_0x1e8b0e[_0xc6cf('0x45')]);return _0x1b5019[_0xc6cf('0x4d')](_0x19514e);}})[_0xc6cf('0x23')](function(_0x47eb7e){if(_0x47eb7e){_0x26dba8=_0x47eb7e['length'];if(!_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x37')](_0xc6cf('0x38'))){_0x19514e[_0xc6cf('0x1b')]=qs[_0xc6cf('0x1b')](_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x1b')]);_0x19514e[_0xc6cf('0x1d')]=qs['offset'](_0x1e8b0e[_0xc6cf('0x31')][_0xc6cf('0x1d')]);}return _0x1b5019[_0xc6cf('0x4d')](_0x19514e);}})[_0xc6cf('0x23')](function(_0x499a6a){if(_0x499a6a){return _0x499a6a?{'count':_0x26dba8,'rows':_0x499a6a}:null;}})[_0xc6cf('0x23')](respondWithResult(_0x1f74b2,null))['catch'](handleError(_0x1f74b2,null));};exports['getSubjects']=function(_0x437877,_0x4edfd5,_0x1f3915){var _0x2eb5fc={};var _0x135bf4={};var _0x449ef1;var _0x526746;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x437877['params']['id']}})[_0xc6cf('0x23')](handleEntityNotFound(_0x4edfd5,null))[_0xc6cf('0x23')](function(_0x4cb84d){if(_0x4cb84d){_0x449ef1=_0x4cb84d;_0x135bf4[_0xc6cf('0x30')]=_[_0xc6cf('0x44')](db[_0xc6cf('0x4c')][_0xc6cf('0x2c')]);_0x135bf4['query']=_['keys'](_0x437877[_0xc6cf('0x31')]);_0x135bf4[_0xc6cf('0x32')]=_['intersection'](_0x135bf4[_0xc6cf('0x30')],_0x135bf4[_0xc6cf('0x31')]);_0x2eb5fc['attributes']=_[_0xc6cf('0x33')](_0x135bf4['model'],qs[_0xc6cf('0x34')](_0x437877[_0xc6cf('0x31')][_0xc6cf('0x34')]));_0x2eb5fc[_0xc6cf('0x35')]=_0x2eb5fc[_0xc6cf('0x35')][_0xc6cf('0x36')]?_0x2eb5fc[_0xc6cf('0x35')]:_0x135bf4[_0xc6cf('0x30')];_0x2eb5fc[_0xc6cf('0x39')]=qs['sort'](_0x437877['query'][_0xc6cf('0x3a')]);_0x2eb5fc[_0xc6cf('0x3b')]=qs[_0xc6cf('0x32')](_[_0xc6cf('0x3c')](_0x437877['query'],_0x135bf4['filters']));if(_0x437877[_0xc6cf('0x31')][_0xc6cf('0x3d')]){_0x2eb5fc['where']=_['merge'](_0x2eb5fc[_0xc6cf('0x3b')],{'$or':_['map'](_0x2eb5fc[_0xc6cf('0x35')],function(_0x89c24f){var _0x166fb7={};_0x166fb7[_0x89c24f]={'$like':'%'+_0x437877['query'][_0xc6cf('0x3d')]+'%'};return _0x166fb7;})});}_0x2eb5fc=_[_0xc6cf('0x3e')]({},_0x2eb5fc,_0x437877['options']);return _0x449ef1[_0xc6cf('0x4e')](_0x2eb5fc);}})[_0xc6cf('0x23')](function(_0x403fdf){if(_0x403fdf){_0x526746=_0x403fdf[_0xc6cf('0x36')];if(!_0x437877[_0xc6cf('0x31')][_0xc6cf('0x37')]('nolimit')){_0x2eb5fc[_0xc6cf('0x1b')]=qs[_0xc6cf('0x1b')](_0x437877[_0xc6cf('0x31')][_0xc6cf('0x1b')]);_0x2eb5fc['offset']=qs[_0xc6cf('0x1d')](_0x437877[_0xc6cf('0x31')]['offset']);}return _0x449ef1['getSubjects'](_0x2eb5fc);}})[_0xc6cf('0x23')](function(_0x2b5bad){if(_0x2b5bad){return _0x2b5bad?{'count':_0x526746,'rows':_0x2b5bad}:null;}})[_0xc6cf('0x23')](respondWithResult(_0x4edfd5,null))[_0xc6cf('0x42')](handleError(_0x4edfd5,null));};exports['getDescriptions']=function(_0xfaa8eb,_0x56ea3b,_0x46677f){var _0x100594={};var _0x4f5b8a={};var _0x585302;var _0x4f7f32;return db[_0xc6cf('0x2b')]['findOne']({'where':{'id':_0xfaa8eb[_0xc6cf('0x4a')]['id']}})[_0xc6cf('0x23')](handleEntityNotFound(_0x56ea3b,null))['then'](function(_0x5ca9b6){if(_0x5ca9b6){_0x585302=_0x5ca9b6;_0x4f5b8a[_0xc6cf('0x30')]=_[_0xc6cf('0x44')](db[_0xc6cf('0x4c')][_0xc6cf('0x2c')]);_0x4f5b8a[_0xc6cf('0x31')]=_[_0xc6cf('0x44')](_0xfaa8eb[_0xc6cf('0x31')]);_0x4f5b8a['filters']=_['intersection'](_0x4f5b8a['model'],_0x4f5b8a[_0xc6cf('0x31')]);_0x100594[_0xc6cf('0x35')]=_['intersection'](_0x4f5b8a['model'],qs['fields'](_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x34')]));_0x100594['attributes']=_0x100594[_0xc6cf('0x35')][_0xc6cf('0x36')]?_0x100594[_0xc6cf('0x35')]:_0x4f5b8a[_0xc6cf('0x30')];_0x100594[_0xc6cf('0x39')]=qs[_0xc6cf('0x3a')](_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x3a')]);_0x100594['where']=qs['filters'](_[_0xc6cf('0x3c')](_0xfaa8eb[_0xc6cf('0x31')],_0x4f5b8a['filters']));if(_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x3d')]){_0x100594[_0xc6cf('0x3b')]=_[_0xc6cf('0x3e')](_0x100594[_0xc6cf('0x3b')],{'$or':_[_0xc6cf('0x2a')](_0x100594[_0xc6cf('0x35')],function(_0x33e51f){var _0x50d5aa={};_0x50d5aa[_0x33e51f]={'$like':'%'+_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x3d')]+'%'};return _0x50d5aa;})});}_0x100594=_['merge']({},_0x100594,_0xfaa8eb[_0xc6cf('0x45')]);return _0x585302[_0xc6cf('0x4f')](_0x100594);}})[_0xc6cf('0x23')](function(_0x327a93){if(_0x327a93){_0x4f7f32=_0x327a93[_0xc6cf('0x36')];if(!_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x37')](_0xc6cf('0x38'))){_0x100594['limit']=qs['limit'](_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x1b')]);_0x100594[_0xc6cf('0x1d')]=qs[_0xc6cf('0x1d')](_0xfaa8eb[_0xc6cf('0x31')][_0xc6cf('0x1d')]);}return _0x585302[_0xc6cf('0x4f')](_0x100594);}})[_0xc6cf('0x23')](function(_0x278aa6){if(_0x278aa6){return _0x278aa6?{'count':_0x4f7f32,'rows':_0x278aa6}:null;}})[_0xc6cf('0x23')](respondWithResult(_0x56ea3b,null))[_0xc6cf('0x42')](handleError(_0x56ea3b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f5a8023..5cdc9d8 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 _0x751d=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4bad13,_0x1c576b){var _0x3789e4=function(_0x45d9c2){while(--_0x45d9c2){_0x4bad13['push'](_0x4bad13['shift']());}};_0x3789e4(++_0x1c576b);}(_0x751d,0x6d));var _0xd751=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0x751d[_0x1ca93c];return _0x185169;};'use strict';var _=require(_0xd751('0x0'));var util=require(_0xd751('0x1'));var logger=require(_0xd751('0x2'))(_0xd751('0x3'));var moment=require(_0xd751('0x4'));var BPromise=require(_0xd751('0x5'));var rp=require(_0xd751('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd751('0x7'));var config=require(_0xd751('0x8'));var attributes=require(_0xd751('0x9'));module[_0xd751('0xa')]=function(_0x249898,_0x352f7e){return _0x249898[_0xd751('0xb')]('VtigerConfiguration',attributes,{'tableName':_0xd751('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdda9=['api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x55442f,_0x1d99dc){var _0x359be8=function(_0x49d9d0){while(--_0x49d9d0){_0x55442f['push'](_0x55442f['shift']());}};_0x359be8(++_0x1d99dc);}(_0xdda9,0x196));var _0x9dda=function(_0x22f878,_0x7dd76c){_0x22f878=_0x22f878-0x0;var _0x5582d3=_0xdda9[_0x22f878];return _0x5582d3;};'use strict';var _=require('lodash');var util=require(_0x9dda('0x0'));var logger=require(_0x9dda('0x1'))(_0x9dda('0x2'));var moment=require('moment');var BPromise=require(_0x9dda('0x3'));var rp=require(_0x9dda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dda('0x5'));var config=require(_0x9dda('0x6'));var attributes=require(_0x9dda('0x7'));module[_0x9dda('0x8')]=function(_0x235e36,_0x29ec7e){return _0x235e36[_0x9dda('0x9')](_0x9dda('0xa'),attributes,{'tableName':_0x9dda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 8b10e85..2965e98 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 _0x6a5a=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0xfea7,_0x39de55){var _0xd17809=function(_0x3005c8){while(--_0x3005c8){_0xfea7['push'](_0xfea7['shift']());}};_0xd17809(++_0x39de55);}(_0x6a5a,0x17d));var _0xa6a5=function(_0x274902,_0x25f86d){_0x274902=_0x274902-0x0;var _0x12c633=_0x6a5a[_0x274902];return _0x12c633;};'use strict';var _=require(_0xa6a5('0x0'));var util=require(_0xa6a5('0x1'));var moment=require(_0xa6a5('0x2'));var BPromise=require(_0xa6a5('0x3'));var rs=require(_0xa6a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6a5('0x6'))('rpc');var config=require(_0xa6a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa6a5('0x8')][_0xa6a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xadd24d,_0x4b8583,_0x26e31a){return new BPromise(function(_0x508f33,_0x1de4ab){return client[_0xa6a5('0xa')](_0xadd24d,_0x26e31a)[_0xa6a5('0xb')](function(_0x2cc51c){logger[_0xa6a5('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b8583,_0xa6a5('0xd'));logger[_0xa6a5('0xe')](_0xa6a5('0xf'),_0x4b8583,'request\x20sent',JSON['stringify'](_0x2cc51c));if(_0x2cc51c[_0xa6a5('0x10')]){if(_0x2cc51c['error'][_0xa6a5('0x11')]===0x1f4){logger[_0xa6a5('0x10')](_0xa6a5('0x12'),_0x4b8583,_0x2cc51c[_0xa6a5('0x10')]['message']);return _0x1de4ab(_0x2cc51c[_0xa6a5('0x10')][_0xa6a5('0x13')]);}logger[_0xa6a5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b8583,_0x2cc51c[_0xa6a5('0x10')][_0xa6a5('0x13')]);return _0x508f33(_0x2cc51c[_0xa6a5('0x10')][_0xa6a5('0x13')]);}else{logger[_0xa6a5('0xc')](_0xa6a5('0x12'),_0x4b8583,_0xa6a5('0xd'));_0x508f33(_0x2cc51c[_0xa6a5('0x14')][_0xa6a5('0x13')]);}})[_0xa6a5('0x15')](function(_0x3a2ddb){logger['error'](_0xa6a5('0x12'),_0x4b8583,_0x3a2ddb);_0x1de4ab(_0x3a2ddb);});});} \ No newline at end of file +var _0x2e6e=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x82583,_0x4f7dea){var _0x4ec2d5=function(_0x108f93){while(--_0x108f93){_0x82583['push'](_0x82583['shift']());}};_0x4ec2d5(++_0x4f7dea);}(_0x2e6e,0xa2));var _0xe2e6=function(_0x1f42bc,_0x208463){_0x1f42bc=_0x1f42bc-0x0;var _0x23f159=_0x2e6e[_0x1f42bc];return _0x23f159;};'use strict';var _=require(_0xe2e6('0x0'));var util=require(_0xe2e6('0x1'));var moment=require('moment');var BPromise=require(_0xe2e6('0x2'));var rs=require(_0xe2e6('0x3'));var fs=require('fs');var Redis=require(_0xe2e6('0x4'));var db=require(_0xe2e6('0x5'))['db'];var utils=require(_0xe2e6('0x6'));var logger=require(_0xe2e6('0x7'))('rpc');var config=require(_0xe2e6('0x8'));var jayson=require(_0xe2e6('0x9'));var client=jayson['client'][_0xe2e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212a40,_0x24d67e,_0x1bd2de){return new BPromise(function(_0x403bd6,_0x36923a){return client['request'](_0x212a40,_0x1bd2de)[_0xe2e6('0xb')](function(_0x3f1c14){logger[_0xe2e6('0xc')](_0xe2e6('0xd'),_0x24d67e,_0xe2e6('0xe'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x24d67e,_0xe2e6('0xe'),JSON[_0xe2e6('0xf')](_0x3f1c14));if(_0x3f1c14[_0xe2e6('0x10')]){if(_0x3f1c14[_0xe2e6('0x10')][_0xe2e6('0x11')]===0x1f4){logger[_0xe2e6('0x10')](_0xe2e6('0xd'),_0x24d67e,_0x3f1c14[_0xe2e6('0x10')][_0xe2e6('0x12')]);return _0x36923a(_0x3f1c14['error'][_0xe2e6('0x12')]);}logger[_0xe2e6('0x10')](_0xe2e6('0xd'),_0x24d67e,_0x3f1c14[_0xe2e6('0x10')][_0xe2e6('0x12')]);return _0x403bd6(_0x3f1c14[_0xe2e6('0x10')][_0xe2e6('0x12')]);}else{logger[_0xe2e6('0xc')](_0xe2e6('0xd'),_0x24d67e,_0xe2e6('0xe'));_0x403bd6(_0x3f1c14['result'][_0xe2e6('0x12')]);}})[_0xe2e6('0x13')](function(_0x4f39d1){logger[_0xe2e6('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x24d67e,_0x4f39d1);_0x36923a(_0x4f39d1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7b10edc..f283ab5 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 _0xb3ad=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','path','connect-timeout'];(function(_0xa5bd84,_0x287943){var _0x22bcca=function(_0x13f6f4){while(--_0x13f6f4){_0xa5bd84['push'](_0xa5bd84['shift']());}};_0x22bcca(++_0x287943);}(_0xb3ad,0x1a7));var _0xdb3a=function(_0x433b60,_0x1e8ef9){_0x433b60=_0x433b60-0x0;var _0x3acd19=_0xb3ad[_0x433b60];return _0x3acd19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb3a('0x0'));var timeout=require(_0xdb3a('0x1'));var express=require('express');var router=express[_0xdb3a('0x2')]();var fs_extra=require(_0xdb3a('0x3'));var auth=require(_0xdb3a('0x4'));var interaction=require(_0xdb3a('0x5'));var config=require(_0xdb3a('0x6'));var controller=require(_0xdb3a('0x7'));router[_0xdb3a('0x8')]('/',auth[_0xdb3a('0x9')](),controller[_0xdb3a('0xa')]);router[_0xdb3a('0x8')](_0xdb3a('0xb'),auth['isAuthenticated'](),controller[_0xdb3a('0xc')]);router['post']('/',auth[_0xdb3a('0x9')](),controller[_0xdb3a('0xd')]);router[_0xdb3a('0xe')](_0xdb3a('0xb'),auth[_0xdb3a('0x9')](),controller[_0xdb3a('0xf')]);router['delete'](_0xdb3a('0xb'),auth[_0xdb3a('0x9')](),controller['destroy']);module[_0xdb3a('0x10')]=router; \ No newline at end of file +var _0x72c9=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72c9,0x1a6));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x972c('0x0'));var util=require(_0x972c('0x1'));var path=require('path');var timeout=require(_0x972c('0x2'));var express=require(_0x972c('0x3'));var router=express[_0x972c('0x4')]();var fs_extra=require(_0x972c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x972c('0x6'));var controller=require(_0x972c('0x7'));router['get']('/',auth[_0x972c('0x8')](),controller[_0x972c('0x9')]);router[_0x972c('0xa')](_0x972c('0xb'),auth[_0x972c('0x8')](),controller[_0x972c('0xc')]);router[_0x972c('0xd')]('/',auth[_0x972c('0x8')](),controller[_0x972c('0xe')]);router[_0x972c('0xf')](_0x972c('0xb'),auth['isAuthenticated'](),controller[_0x972c('0x10')]);router[_0x972c('0x11')]('/:id',auth[_0x972c('0x8')](),controller[_0x972c('0x12')]);module[_0x972c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 743ce56..2c1df44 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 _0x9fee=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x13c436,_0x2d6d22){var _0x31cac5=function(_0x391288){while(--_0x391288){_0x13c436['push'](_0x13c436['shift']());}};_0x31cac5(++_0x2d6d22);}(_0x9fee,0x1ee));var _0xe9fe=function(_0x5ccdf1,_0x3f4000){_0x5ccdf1=_0x5ccdf1-0x0;var _0x7e5593=_0x9fee[_0x5ccdf1];return _0x7e5593;};'use strict';var Sequelize=require(_0xe9fe('0x0'));module[_0xe9fe('0x1')]={'type':{'type':Sequelize[_0xe9fe('0x2')](_0xe9fe('0x3'),_0xe9fe('0x4'),_0xe9fe('0x5'),_0xe9fe('0x6'),_0xe9fe('0x7')),'defaultValue':_0xe9fe('0x3')},'content':{'type':Sequelize[_0xe9fe('0x8')]},'key':{'type':Sequelize[_0xe9fe('0x8')]},'keyType':{'type':Sequelize[_0xe9fe('0x2')](_0xe9fe('0x3'),_0xe9fe('0x4'),_0xe9fe('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe9fe('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8099=['ENUM','string','variable','customVariable','picklist','STRING','exports'];(function(_0x47bb19,_0x17a096){var _0x4ef57a=function(_0x9f35cd){while(--_0x9f35cd){_0x47bb19['push'](_0x47bb19['shift']());}};_0x4ef57a(++_0x17a096);}(_0x8099,0xa7));var _0x9809=function(_0x13482e,_0x32bb80){_0x13482e=_0x13482e-0x0;var _0x3bec51=_0x8099[_0x13482e];return _0x3bec51;};'use strict';var Sequelize=require('sequelize');module[_0x9809('0x0')]={'type':{'type':Sequelize[_0x9809('0x1')](_0x9809('0x2'),_0x9809('0x3'),_0x9809('0x4'),'keyValue',_0x9809('0x5')),'defaultValue':_0x9809('0x2')},'content':{'type':Sequelize[_0x9809('0x6')]},'key':{'type':Sequelize[_0x9809('0x6')]},'keyType':{'type':Sequelize[_0x9809('0x1')]('string',_0x9809('0x3'),_0x9809('0x4'))},'keyContent':{'type':Sequelize[_0x9809('0x6')]},'idField':{'type':Sequelize[_0x9809('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9809('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9faa6eb..f1da55c 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 _0xde4c=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerField','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xde4c,0x11e));var _0xcde4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcde4('0x0'));var rimraf=require(_0xcde4('0x1'));var zipdir=require(_0xcde4('0x2'));var jsonpatch=require(_0xcde4('0x3'));var rp=require(_0xcde4('0x4'));var moment=require(_0xcde4('0x5'));var BPromise=require(_0xcde4('0x6'));var Mustache=require(_0xcde4('0x7'));var util=require(_0xcde4('0x8'));var path=require(_0xcde4('0x9'));var sox=require(_0xcde4('0xa'));var csv=require(_0xcde4('0xb'));var ejs=require(_0xcde4('0xc'));var fs=require('fs');var fs_extra=require(_0xcde4('0xd'));var _=require(_0xcde4('0xe'));var squel=require(_0xcde4('0xf'));var crypto=require(_0xcde4('0x10'));var jsforce=require(_0xcde4('0x11'));var deskjs=require(_0xcde4('0x12'));var toCsv=require(_0xcde4('0xb'));var querystring=require(_0xcde4('0x13'));var Papa=require(_0xcde4('0x14'));var Redis=require(_0xcde4('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xcde4('0x16'));var as=require(_0xcde4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcde4('0x18'));var utils=require(_0xcde4('0x19'));var config=require(_0xcde4('0x1a'));var licenseUtil=require(_0xcde4('0x1b'));var db=require(_0xcde4('0x1c'))['db'];function respondWithStatusCode(_0x4a7658,_0x1fda51){_0x1fda51=_0x1fda51||0xcc;return function(_0x4f8e60){if(_0x4f8e60){return _0x4a7658['sendStatus'](_0x1fda51);}return _0x4a7658[_0xcde4('0x1d')](_0x1fda51)['end']();};}function respondWithResult(_0x1f9f8c,_0x170c06){_0x170c06=_0x170c06||0xc8;return function(_0x38b634){if(_0x38b634){return _0x1f9f8c[_0xcde4('0x1d')](_0x170c06)[_0xcde4('0x1e')](_0x38b634);}};}function respondWithFilteredResult(_0x15f388,_0x3b652e){return function(_0x33b974){if(_0x33b974){var _0x40ffef=typeof _0x3b652e[_0xcde4('0x1f')]===_0xcde4('0x20')&&typeof _0x3b652e['limit']==='undefined';var _0x89bbbf=_0x33b974[_0xcde4('0x21')];var _0xf2e58d=_0x40ffef?0x0:_0x3b652e[_0xcde4('0x1f')];var _0x2653a2=_0x40ffef?_0x33b974[_0xcde4('0x21')]:_0x3b652e[_0xcde4('0x1f')]+_0x3b652e[_0xcde4('0x22')];var _0x1c4c5f;if(_0x2653a2>=_0x89bbbf){_0x2653a2=_0x89bbbf;_0x1c4c5f=0xc8;}else{_0x1c4c5f=0xce;}_0x15f388[_0xcde4('0x1d')](_0x1c4c5f);return _0x15f388[_0xcde4('0x23')](_0xcde4('0x24'),_0xf2e58d+'-'+_0x2653a2+'/'+_0x89bbbf)[_0xcde4('0x1e')](_0x33b974);}return null;};}function patchUpdates(_0x1e2ef3){return function(_0x552889){try{jsonpatch[_0xcde4('0x25')](_0x552889,_0x1e2ef3,!![]);}catch(_0x52cafd){return BPromise[_0xcde4('0x26')](_0x52cafd);}return _0x552889['save']();};}function saveUpdates(_0xc4ae12,_0x16cb88){return function(_0x54da2a){if(_0x54da2a){return _0x54da2a[_0xcde4('0x27')](_0xc4ae12)[_0xcde4('0x28')](function(_0x24bc96){return _0x24bc96;});}return null;};}function removeEntity(_0x5f0ceb,_0x473dbc){return function(_0x40bbf6){if(_0x40bbf6){return _0x40bbf6[_0xcde4('0x29')]()[_0xcde4('0x28')](function(){_0x5f0ceb[_0xcde4('0x1d')](0xcc)[_0xcde4('0x2a')]();});}};}function handleEntityNotFound(_0x3a5ffe,_0xb4b1a3){return function(_0x901694){if(!_0x901694){_0x3a5ffe[_0xcde4('0x2b')](0x194);}return _0x901694;};}function handleError(_0x20b255,_0x408e21){_0x408e21=_0x408e21||0x1f4;return function(_0x57fa8a){logger[_0xcde4('0x2c')](_0x57fa8a[_0xcde4('0x2d')]);if(_0x57fa8a[_0xcde4('0x2e')]){delete _0x57fa8a[_0xcde4('0x2e')];}_0x20b255[_0xcde4('0x1d')](_0x408e21)[_0xcde4('0x2f')](_0x57fa8a);};}exports[_0xcde4('0x30')]=function(_0x2ef036,_0x23c504){var _0x575c72={},_0x518107={},_0xab9238={'count':0x0,'rows':[]};var _0x17123d=_['map'](db[_0xcde4('0x31')][_0xcde4('0x32')],function(_0x431728){return{'name':_0x431728['fieldName'],'type':_0x431728[_0xcde4('0x33')][_0xcde4('0x34')]};});_0x518107[_0xcde4('0x35')]=_[_0xcde4('0x36')](_0x17123d,_0xcde4('0x2e'));_0x518107['query']=_['keys'](_0x2ef036[_0xcde4('0x37')]);_0x518107['filters']=_[_0xcde4('0x38')](_0x518107[_0xcde4('0x35')],_0x518107[_0xcde4('0x37')]);_0x575c72['attributes']=_[_0xcde4('0x38')](_0x518107[_0xcde4('0x35')],qs[_0xcde4('0x39')](_0x2ef036['query'][_0xcde4('0x39')]));_0x575c72['attributes']=_0x575c72[_0xcde4('0x3a')][_0xcde4('0x3b')]?_0x575c72['attributes']:_0x518107[_0xcde4('0x35')];if(!_0x2ef036['query'][_0xcde4('0x3c')](_0xcde4('0x3d'))){_0x575c72[_0xcde4('0x22')]=qs['limit'](_0x2ef036[_0xcde4('0x37')][_0xcde4('0x22')]);_0x575c72[_0xcde4('0x1f')]=qs['offset'](_0x2ef036[_0xcde4('0x37')][_0xcde4('0x1f')]);}_0x575c72[_0xcde4('0x3e')]=qs[_0xcde4('0x3f')](_0x2ef036[_0xcde4('0x37')][_0xcde4('0x3f')]);_0x575c72[_0xcde4('0x40')]=qs['filters'](_[_0xcde4('0x41')](_0x2ef036[_0xcde4('0x37')],_0x518107[_0xcde4('0x42')]),_0x17123d);if(_0x2ef036[_0xcde4('0x37')][_0xcde4('0x43')]){_0x575c72['where']=_[_0xcde4('0x44')](_0x575c72[_0xcde4('0x40')],{'$or':_[_0xcde4('0x36')](_0x17123d,function(_0x4ff50b){if(_0x4ff50b[_0xcde4('0x33')]!=='VIRTUAL'){var _0x582b43={};_0x582b43[_0x4ff50b[_0xcde4('0x2e')]]={'$like':'%'+_0x2ef036[_0xcde4('0x37')]['filter']+'%'};return _0x582b43;}})});}_0x575c72=_[_0xcde4('0x44')]({},_0x575c72,_0x2ef036[_0xcde4('0x45')]);var _0xf225e0={'where':_0x575c72[_0xcde4('0x40')]};return db[_0xcde4('0x31')]['count'](_0xf225e0)[_0xcde4('0x28')](function(_0x2e4471){_0xab9238['count']=_0x2e4471;if(_0x2ef036[_0xcde4('0x37')][_0xcde4('0x46')]){_0x575c72[_0xcde4('0x47')]=[{'all':!![]}];}return db[_0xcde4('0x31')][_0xcde4('0x48')](_0x575c72);})[_0xcde4('0x28')](function(_0x6072b9){_0xab9238['rows']=_0x6072b9;return _0xab9238;})[_0xcde4('0x28')](respondWithFilteredResult(_0x23c504,_0x575c72))[_0xcde4('0x49')](handleError(_0x23c504,null));};exports['show']=function(_0xc222cd,_0x4eea54){var _0x54b428={'raw':!![],'where':{'id':_0xc222cd[_0xcde4('0x4a')]['id']}},_0x416a97={};_0x416a97['model']=_[_0xcde4('0x4b')](db[_0xcde4('0x31')]['rawAttributes']);_0x416a97[_0xcde4('0x37')]=_[_0xcde4('0x4b')](_0xc222cd['query']);_0x416a97[_0xcde4('0x42')]=_[_0xcde4('0x38')](_0x416a97[_0xcde4('0x35')],_0x416a97[_0xcde4('0x37')]);_0x54b428[_0xcde4('0x3a')]=_[_0xcde4('0x38')](_0x416a97[_0xcde4('0x35')],qs['fields'](_0xc222cd[_0xcde4('0x37')][_0xcde4('0x39')]));_0x54b428[_0xcde4('0x3a')]=_0x54b428[_0xcde4('0x3a')]['length']?_0x54b428[_0xcde4('0x3a')]:_0x416a97[_0xcde4('0x35')];if(_0xc222cd[_0xcde4('0x37')]['includeAll']){_0x54b428['include']=[{'all':!![]}];}_0x54b428=_[_0xcde4('0x44')]({},_0x54b428,_0xc222cd['options']);return db[_0xcde4('0x31')][_0xcde4('0x4c')](_0x54b428)['then'](handleEntityNotFound(_0x4eea54,null))['then'](respondWithResult(_0x4eea54,null))[_0xcde4('0x49')](handleError(_0x4eea54,null));};exports[_0xcde4('0x4d')]=function(_0xbc580a,_0x44fc75){return db[_0xcde4('0x31')][_0xcde4('0x4d')](_0xbc580a[_0xcde4('0x4e')],{})[_0xcde4('0x28')](respondWithResult(_0x44fc75,0xc9))[_0xcde4('0x49')](handleError(_0x44fc75,null));};exports['update']=function(_0x5567b5,_0x2f8a44){if(_0x5567b5[_0xcde4('0x4e')]['id']){delete _0x5567b5['body']['id'];}return db[_0xcde4('0x31')][_0xcde4('0x4c')]({'where':{'id':_0x5567b5[_0xcde4('0x4a')]['id']}})[_0xcde4('0x28')](handleEntityNotFound(_0x2f8a44,null))[_0xcde4('0x28')](saveUpdates(_0x5567b5[_0xcde4('0x4e')],null))['then'](respondWithResult(_0x2f8a44,null))['catch'](handleError(_0x2f8a44,null));};exports[_0xcde4('0x29')]=function(_0x39210a,_0x343978){return db[_0xcde4('0x31')][_0xcde4('0x4c')]({'where':{'id':_0x39210a[_0xcde4('0x4a')]['id']}})[_0xcde4('0x28')](handleEntityNotFound(_0x343978,null))[_0xcde4('0x28')](removeEntity(_0x343978,null))['catch'](handleError(_0x343978,null));}; \ No newline at end of file +var _0x2d41=['attributes','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','fields','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','name','query','keys'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x2d41,0x183));var _0x12d4=function(_0x5d984f,_0x1eb3ed){_0x5d984f=_0x5d984f-0x0;var _0x4cb980=_0x2d41[_0x5d984f];return _0x4cb980;};'use strict';var emlformat=require(_0x12d4('0x0'));var rimraf=require(_0x12d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12d4('0x2'));var rp=require(_0x12d4('0x3'));var moment=require(_0x12d4('0x4'));var BPromise=require(_0x12d4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x12d4('0x6'));var sox=require(_0x12d4('0x7'));var csv=require(_0x12d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12d4('0x9'));var _=require(_0x12d4('0xa'));var squel=require(_0x12d4('0xb'));var crypto=require(_0x12d4('0xc'));var jsforce=require(_0x12d4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x12d4('0x8'));var querystring=require('querystring');var Papa=require(_0x12d4('0xe'));var Redis=require('ioredis');var authService=require(_0x12d4('0xf'));var qs=require(_0x12d4('0x10'));var as=require(_0x12d4('0x11'));var hardwareService=require(_0x12d4('0x12'));var logger=require(_0x12d4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x12d4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x12d4('0x15'))['db'];function respondWithStatusCode(_0x4dfb73,_0x98362e){_0x98362e=_0x98362e||0xcc;return function(_0x168880){if(_0x168880){return _0x4dfb73['sendStatus'](_0x98362e);}return _0x4dfb73[_0x12d4('0x16')](_0x98362e)[_0x12d4('0x17')]();};}function respondWithResult(_0x4f510a,_0x39b012){_0x39b012=_0x39b012||0xc8;return function(_0x10ef2a){if(_0x10ef2a){return _0x4f510a[_0x12d4('0x16')](_0x39b012)[_0x12d4('0x18')](_0x10ef2a);}};}function respondWithFilteredResult(_0x8a8a8a,_0x5c38da){return function(_0x525397){if(_0x525397){var _0x193460=typeof _0x5c38da[_0x12d4('0x19')]===_0x12d4('0x1a')&&typeof _0x5c38da[_0x12d4('0x1b')]===_0x12d4('0x1a');var _0x46b681=_0x525397[_0x12d4('0x1c')];var _0x1a9cf8=_0x193460?0x0:_0x5c38da[_0x12d4('0x19')];var _0x34ea8c=_0x193460?_0x525397[_0x12d4('0x1c')]:_0x5c38da[_0x12d4('0x19')]+_0x5c38da['limit'];var _0x3c0e21;if(_0x34ea8c>=_0x46b681){_0x34ea8c=_0x46b681;_0x3c0e21=0xc8;}else{_0x3c0e21=0xce;}_0x8a8a8a[_0x12d4('0x16')](_0x3c0e21);return _0x8a8a8a[_0x12d4('0x1d')](_0x12d4('0x1e'),_0x1a9cf8+'-'+_0x34ea8c+'/'+_0x46b681)[_0x12d4('0x18')](_0x525397);}return null;};}function patchUpdates(_0x2eeeeb){return function(_0x4594d2){try{jsonpatch[_0x12d4('0x1f')](_0x4594d2,_0x2eeeeb,!![]);}catch(_0x2ff082){return BPromise[_0x12d4('0x20')](_0x2ff082);}return _0x4594d2[_0x12d4('0x21')]();};}function saveUpdates(_0x155ebd,_0x11be3d){return function(_0x55b453){if(_0x55b453){return _0x55b453[_0x12d4('0x22')](_0x155ebd)[_0x12d4('0x23')](function(_0x5226eb){return _0x5226eb;});}return null;};}function removeEntity(_0x47a68d,_0x923e7){return function(_0x13d968){if(_0x13d968){return _0x13d968[_0x12d4('0x24')]()[_0x12d4('0x23')](function(){_0x47a68d[_0x12d4('0x16')](0xcc)[_0x12d4('0x17')]();});}};}function handleEntityNotFound(_0x310263,_0x447d5b){return function(_0xf79d8d){if(!_0xf79d8d){_0x310263[_0x12d4('0x25')](0x194);}return _0xf79d8d;};}function handleError(_0x2bdd25,_0xeee6cb){_0xeee6cb=_0xeee6cb||0x1f4;return function(_0x5024e7){logger['error'](_0x5024e7[_0x12d4('0x26')]);if(_0x5024e7['name']){delete _0x5024e7['name'];}_0x2bdd25['status'](_0xeee6cb)[_0x12d4('0x27')](_0x5024e7);};}exports[_0x12d4('0x28')]=function(_0x3a5e40,_0x1ca163){var _0x2e440c={},_0x37a689={},_0x4999ce={'count':0x0,'rows':[]};var _0x10bf58=_[_0x12d4('0x29')](db[_0x12d4('0x2a')][_0x12d4('0x2b')],function(_0x428471){return{'name':_0x428471[_0x12d4('0x2c')],'type':_0x428471[_0x12d4('0x2d')][_0x12d4('0x2e')]};});_0x37a689[_0x12d4('0x2f')]=_[_0x12d4('0x29')](_0x10bf58,_0x12d4('0x30'));_0x37a689[_0x12d4('0x31')]=_[_0x12d4('0x32')](_0x3a5e40['query']);_0x37a689['filters']=_['intersection'](_0x37a689[_0x12d4('0x2f')],_0x37a689['query']);_0x2e440c[_0x12d4('0x33')]=_['intersection'](_0x37a689['model'],qs['fields'](_0x3a5e40[_0x12d4('0x31')]['fields']));_0x2e440c['attributes']=_0x2e440c[_0x12d4('0x33')]['length']?_0x2e440c['attributes']:_0x37a689[_0x12d4('0x2f')];if(!_0x3a5e40[_0x12d4('0x31')][_0x12d4('0x34')]('nolimit')){_0x2e440c[_0x12d4('0x1b')]=qs[_0x12d4('0x1b')](_0x3a5e40['query'][_0x12d4('0x1b')]);_0x2e440c[_0x12d4('0x19')]=qs[_0x12d4('0x19')](_0x3a5e40[_0x12d4('0x31')][_0x12d4('0x19')]);}_0x2e440c[_0x12d4('0x35')]=qs[_0x12d4('0x36')](_0x3a5e40[_0x12d4('0x31')][_0x12d4('0x36')]);_0x2e440c[_0x12d4('0x37')]=qs[_0x12d4('0x38')](_['pick'](_0x3a5e40[_0x12d4('0x31')],_0x37a689[_0x12d4('0x38')]),_0x10bf58);if(_0x3a5e40['query']['filter']){_0x2e440c[_0x12d4('0x37')]=_[_0x12d4('0x39')](_0x2e440c[_0x12d4('0x37')],{'$or':_['map'](_0x10bf58,function(_0x5b3d0b){if(_0x5b3d0b[_0x12d4('0x2d')]!==_0x12d4('0x3a')){var _0x5d0b09={};_0x5d0b09[_0x5b3d0b[_0x12d4('0x30')]]={'$like':'%'+_0x3a5e40[_0x12d4('0x31')][_0x12d4('0x3b')]+'%'};return _0x5d0b09;}})});}_0x2e440c=_[_0x12d4('0x39')]({},_0x2e440c,_0x3a5e40[_0x12d4('0x3c')]);var _0x3b4956={'where':_0x2e440c[_0x12d4('0x37')]};return db['VtigerField'][_0x12d4('0x1c')](_0x3b4956)[_0x12d4('0x23')](function(_0xd80525){_0x4999ce['count']=_0xd80525;if(_0x3a5e40[_0x12d4('0x31')][_0x12d4('0x3d')]){_0x2e440c[_0x12d4('0x3e')]=[{'all':!![]}];}return db[_0x12d4('0x2a')][_0x12d4('0x3f')](_0x2e440c);})[_0x12d4('0x23')](function(_0x3b78bf){_0x4999ce['rows']=_0x3b78bf;return _0x4999ce;})['then'](respondWithFilteredResult(_0x1ca163,_0x2e440c))[_0x12d4('0x40')](handleError(_0x1ca163,null));};exports[_0x12d4('0x41')]=function(_0xd674bd,_0x295ed1){var _0x592178={'raw':!![],'where':{'id':_0xd674bd[_0x12d4('0x42')]['id']}},_0x31ddc0={};_0x31ddc0[_0x12d4('0x2f')]=_[_0x12d4('0x32')](db['VtigerField'][_0x12d4('0x2b')]);_0x31ddc0[_0x12d4('0x31')]=_[_0x12d4('0x32')](_0xd674bd[_0x12d4('0x31')]);_0x31ddc0['filters']=_[_0x12d4('0x43')](_0x31ddc0['model'],_0x31ddc0[_0x12d4('0x31')]);_0x592178[_0x12d4('0x33')]=_['intersection'](_0x31ddc0[_0x12d4('0x2f')],qs[_0x12d4('0x44')](_0xd674bd[_0x12d4('0x31')]['fields']));_0x592178[_0x12d4('0x33')]=_0x592178['attributes'][_0x12d4('0x45')]?_0x592178[_0x12d4('0x33')]:_0x31ddc0[_0x12d4('0x2f')];if(_0xd674bd[_0x12d4('0x31')]['includeAll']){_0x592178[_0x12d4('0x3e')]=[{'all':!![]}];}_0x592178=_[_0x12d4('0x39')]({},_0x592178,_0xd674bd['options']);return db[_0x12d4('0x2a')][_0x12d4('0x46')](_0x592178)[_0x12d4('0x23')](handleEntityNotFound(_0x295ed1,null))[_0x12d4('0x23')](respondWithResult(_0x295ed1,null))[_0x12d4('0x40')](handleError(_0x295ed1,null));};exports[_0x12d4('0x47')]=function(_0x573b05,_0x3283ff){return db[_0x12d4('0x2a')][_0x12d4('0x47')](_0x573b05['body'],{})[_0x12d4('0x23')](respondWithResult(_0x3283ff,0xc9))['catch'](handleError(_0x3283ff,null));};exports['update']=function(_0x466211,_0x49a6e2){if(_0x466211[_0x12d4('0x48')]['id']){delete _0x466211[_0x12d4('0x48')]['id'];}return db[_0x12d4('0x2a')][_0x12d4('0x46')]({'where':{'id':_0x466211[_0x12d4('0x42')]['id']}})[_0x12d4('0x23')](handleEntityNotFound(_0x49a6e2,null))[_0x12d4('0x23')](saveUpdates(_0x466211[_0x12d4('0x48')],null))[_0x12d4('0x23')](respondWithResult(_0x49a6e2,null))[_0x12d4('0x40')](handleError(_0x49a6e2,null));};exports['destroy']=function(_0x499de6,_0x301f76){return db['VtigerField'][_0x12d4('0x46')]({'where':{'id':_0x499de6['params']['id']}})[_0x12d4('0x23')](handleEntityNotFound(_0x301f76,null))['then'](removeEntity(_0x301f76,null))[_0x12d4('0x40')](handleError(_0x301f76,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c27faa0..cabde4d 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 _0x2094=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','FieldId','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x2c24d5,_0x3ca9c6){var _0x5e4726=function(_0x18431b){while(--_0x18431b){_0x2c24d5['push'](_0x2c24d5['shift']());}};_0x5e4726(++_0x3ca9c6);}(_0x2094,0x19d));var _0x4209=function(_0x33c2e0,_0x28ec08){_0x33c2e0=_0x33c2e0-0x0;var _0x387d39=_0x2094[_0x33c2e0];return _0x387d39;};'use strict';var _=require(_0x4209('0x0'));var util=require('util');var logger=require(_0x4209('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4209('0x2'));var fs=require('fs');var path=require(_0x4209('0x3'));var rimraf=require(_0x4209('0x4'));var config=require(_0x4209('0x5'));var attributes=require(_0x4209('0x6'));module[_0x4209('0x7')]=function(_0x593661,_0x29ab82){return _0x593661['define'](_0x4209('0x8'),attributes,{'tableName':_0x4209('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x4209('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x08ac=['./intVtigerField.attributes','exports','define','VtigerField','idField','FieldId','lodash','util','moment','bluebird','../../config/environment'];(function(_0x4f2106,_0x3fb5bc){var _0x13d490=function(_0x1b978a){while(--_0x1b978a){_0x4f2106['push'](_0x4f2106['shift']());}};_0x13d490(++_0x3fb5bc);}(_0x08ac,0x95));var _0xc08a=function(_0x4c71d5,_0x206ce4){_0x4c71d5=_0x4c71d5-0x0;var _0x1be35e=_0x08ac[_0x4c71d5];return _0x1be35e;};'use strict';var _=require(_0xc08a('0x0'));var util=require(_0xc08a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc08a('0x2'));var BPromise=require(_0xc08a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc08a('0x4'));var attributes=require(_0xc08a('0x5'));module[_0xc08a('0x6')]=function(_0x31e3b8,_0x434fe9){return _0x31e3b8[_0xc08a('0x7')](_0xc08a('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xc08a('0x9'),_0xc08a('0xa')],'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 51788a7..77f71d5 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 _0xd910=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x198226,_0x4890c5){var _0x31f6db=function(_0x279419){while(--_0x279419){_0x198226['push'](_0x198226['shift']());}};_0x31f6db(++_0x4890c5);}(_0xd910,0xe2));var _0x0d91=function(_0x32a34f,_0x48007){_0x32a34f=_0x32a34f-0x0;var _0x5ea3b8=_0xd910[_0x32a34f];return _0x5ea3b8;};'use strict';var _=require('lodash');var util=require(_0x0d91('0x0'));var moment=require(_0x0d91('0x1'));var BPromise=require(_0x0d91('0x2'));var rs=require(_0x0d91('0x3'));var fs=require('fs');var Redis=require(_0x0d91('0x4'));var db=require(_0x0d91('0x5'))['db'];var utils=require(_0x0d91('0x6'));var logger=require(_0x0d91('0x7'))('rpc');var config=require(_0x0d91('0x8'));var jayson=require(_0x0d91('0x9'));var client=jayson[_0x0d91('0xa')][_0x0d91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18776d,_0x57d08b,_0x4eb9a4){return new BPromise(function(_0x523145,_0x2ffed4){return client[_0x0d91('0xc')](_0x18776d,_0x4eb9a4)[_0x0d91('0xd')](function(_0x5c8e1f){logger[_0x0d91('0xe')]('VtigerField,\x20%s,\x20%s',_0x57d08b,_0x0d91('0xf'));logger[_0x0d91('0x10')](_0x0d91('0x11'),_0x57d08b,_0x0d91('0xf'),JSON['stringify'](_0x5c8e1f));if(_0x5c8e1f[_0x0d91('0x12')]){if(_0x5c8e1f[_0x0d91('0x12')][_0x0d91('0x13')]===0x1f4){logger[_0x0d91('0x12')](_0x0d91('0x14'),_0x57d08b,_0x5c8e1f[_0x0d91('0x12')][_0x0d91('0x15')]);return _0x2ffed4(_0x5c8e1f['error'][_0x0d91('0x15')]);}logger[_0x0d91('0x12')](_0x0d91('0x14'),_0x57d08b,_0x5c8e1f['error']['message']);return _0x523145(_0x5c8e1f['error'][_0x0d91('0x15')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x57d08b,'request\x20sent');_0x523145(_0x5c8e1f['result'][_0x0d91('0x15')]);}})[_0x0d91('0x16')](function(_0x34d5b6){logger[_0x0d91('0x12')](_0x0d91('0x14'),_0x57d08b,_0x34d5b6);_0x2ffed4(_0x34d5b6);});});} \ No newline at end of file +var _0xef6d=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5026a2,_0x3f608b){var _0x56055e=function(_0x8fc65c){while(--_0x8fc65c){_0x5026a2['push'](_0x5026a2['shift']());}};_0x56055e(++_0x3f608b);}(_0xef6d,0x13f));var _0xdef6=function(_0x587a8e,_0x33ae0a){_0x587a8e=_0x587a8e-0x0;var _0x3e8682=_0xef6d[_0x587a8e];return _0x3e8682;};'use strict';var _=require(_0xdef6('0x0'));var util=require('util');var moment=require(_0xdef6('0x1'));var BPromise=require(_0xdef6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdef6('0x3'));var db=require(_0xdef6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdef6('0x5'))(_0xdef6('0x6'));var config=require(_0xdef6('0x7'));var jayson=require(_0xdef6('0x8'));var client=jayson[_0xdef6('0x9')][_0xdef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc5c9,_0x54702a,_0x9231cf){return new BPromise(function(_0x19e36d,_0x47202d){return client[_0xdef6('0xb')](_0x2bc5c9,_0x9231cf)[_0xdef6('0xc')](function(_0x201a7d){logger[_0xdef6('0xd')](_0xdef6('0xe'),_0x54702a,_0xdef6('0xf'));logger[_0xdef6('0x10')](_0xdef6('0x11'),_0x54702a,_0xdef6('0xf'),JSON['stringify'](_0x201a7d));if(_0x201a7d['error']){if(_0x201a7d[_0xdef6('0x12')][_0xdef6('0x13')]===0x1f4){logger[_0xdef6('0x12')](_0xdef6('0xe'),_0x54702a,_0x201a7d[_0xdef6('0x12')][_0xdef6('0x14')]);return _0x47202d(_0x201a7d[_0xdef6('0x12')][_0xdef6('0x14')]);}logger[_0xdef6('0x12')]('VtigerField,\x20%s,\x20%s',_0x54702a,_0x201a7d['error'][_0xdef6('0x14')]);return _0x19e36d(_0x201a7d['error'][_0xdef6('0x14')]);}else{logger[_0xdef6('0xd')](_0xdef6('0xe'),_0x54702a,_0xdef6('0xf'));_0x19e36d(_0x201a7d[_0xdef6('0x15')][_0xdef6('0x14')]);}})['catch'](function(_0x540e40){logger[_0xdef6('0x12')](_0xdef6('0xe'),_0x54702a,_0x540e40);_0x47202d(_0x540e40);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cd6ab0a..f2c543e 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 _0x9fe9=['get','index','/:id','show','/:id/configurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9fe9,0x184));var _0x99fe=function(_0x41368b,_0x1fa82d){_0x41368b=_0x41368b-0x0;var _0x251fcc=_0x9fe9[_0x41368b];return _0x251fcc;};'use strict';var multer=require(_0x99fe('0x0'));var util=require(_0x99fe('0x1'));var path=require(_0x99fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x99fe('0x3'));var router=express[_0x99fe('0x4')]();var fs_extra=require(_0x99fe('0x5'));var auth=require(_0x99fe('0x6'));var interaction=require(_0x99fe('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x99fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x99fe('0x9')]);router['get'](_0x99fe('0xa'),auth['isAuthenticated'](),controller[_0x99fe('0xb')]);router[_0x99fe('0x8')](_0x99fe('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x99fe('0x8')](_0x99fe('0xd'),auth[_0x99fe('0xe')](),controller[_0x99fe('0xf')]);router[_0x99fe('0x10')]('/',auth[_0x99fe('0xe')](),controller[_0x99fe('0x11')]);router['post'](_0x99fe('0xc'),auth['isAuthenticated'](),controller[_0x99fe('0x12')]);router[_0x99fe('0x13')](_0x99fe('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x99fe('0x14')](_0x99fe('0xa'),auth[_0x99fe('0xe')](),controller['destroy']);module[_0x99fe('0x15')]=router; \ No newline at end of file +var _0x7bb4=['exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','destroy'];(function(_0x2e4c2e,_0x1df99e){var _0xf5d858=function(_0x3367c7){while(--_0x3367c7){_0x2e4c2e['push'](_0x2e4c2e['shift']());}};_0xf5d858(++_0x1df99e);}(_0x7bb4,0x191));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x47bb('0x0'));var path=require(_0x47bb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47bb('0x2')]();var fs_extra=require(_0x47bb('0x3'));var auth=require(_0x47bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47bb('0x5'));var controller=require(_0x47bb('0x6'));router['get']('/',auth[_0x47bb('0x7')](),controller[_0x47bb('0x8')]);router['get'](_0x47bb('0x9'),auth[_0x47bb('0x7')](),controller[_0x47bb('0xa')]);router[_0x47bb('0xb')](_0x47bb('0xc'),auth[_0x47bb('0x7')](),controller[_0x47bb('0xd')]);router[_0x47bb('0xb')]('/:id/fields',auth[_0x47bb('0x7')](),controller['getFields']);router[_0x47bb('0xe')]('/',auth[_0x47bb('0x7')](),controller['create']);router['post'](_0x47bb('0xc'),auth[_0x47bb('0x7')](),controller[_0x47bb('0xf')]);router[_0x47bb('0x10')](_0x47bb('0x9'),auth[_0x47bb('0x7')](),controller['update']);router[_0x47bb('0x11')](_0x47bb('0x9'),auth[_0x47bb('0x7')](),controller[_0x47bb('0x12')]);module[_0x47bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d0d2229..27ddda3 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 _0x01d9=['sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab','newTab'];(function(_0x1fd292,_0x20dbb4){var _0x210c35=function(_0x30b8cd){while(--_0x30b8cd){_0x1fd292['push'](_0x1fd292['shift']());}};_0x210c35(++_0x20dbb4);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')]},'description':{'type':Sequelize[_0x901d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x901d('0x3')},'password':{'type':Sequelize[_0x901d('0x2')]},'token':{'type':Sequelize[_0x901d('0x2')]},'remoteUri':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x4')},'authType':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6'),'token'),'defaultValue':_0x901d('0x6')},'serverUrl':{'type':Sequelize[_0x901d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x7'),_0x901d('0x8')),'defaultValue':_0x901d('0x7')}}; \ No newline at end of file +var _0x1122=['newTab','sequelize','STRING','username','remoteUri','password','token','ENUM','integrationTab'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2112('0x0'));module['exports']={'name':{'type':Sequelize[_0x2112('0x1')]},'description':{'type':Sequelize[_0x2112('0x1')]},'username':{'type':Sequelize[_0x2112('0x1')],'unique':_0x2112('0x2')},'password':{'type':Sequelize[_0x2112('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2112('0x3')},'authType':{'type':Sequelize['ENUM'](_0x2112('0x4'),_0x2112('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x2112('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2112('0x6')](_0x2112('0x7'),_0x2112('0x8')),'defaultValue':_0x2112('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b75ca21..a669671 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 _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(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xe706,0xa3));var _0x6e70=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0xe706[_0x5d9c37];return _0x1ba9eb;};'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 +var _0x6c76=['findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','subject','description','group','ticket_fields','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','ZendeskAccount','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration'];(function(_0x10b33e,_0x31e699){var _0x2d6ee0=function(_0x5a06c7){while(--_0x5a06c7){_0x10b33e['push'](_0x10b33e['shift']());}};_0x2d6ee0(++_0x31e699);}(_0x6c76,0x184));var _0x66c7=function(_0x44c7ca,_0x37a9ed){_0x44c7ca=_0x44c7ca-0x0;var _0x51b2c1=_0x6c76[_0x44c7ca];return _0x51b2c1;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18c309,_0x760e36){_0x760e36=_0x760e36||0xcc;return function(_0x35cbc2){if(_0x35cbc2){return _0x18c309[_0x66c7('0x17')](_0x760e36);}return _0x18c309[_0x66c7('0x18')](_0x760e36)[_0x66c7('0x19')]();};}function respondWithResult(_0x618bd7,_0xf3b04){_0xf3b04=_0xf3b04||0xc8;return function(_0x6400fe){if(_0x6400fe){return _0x618bd7['status'](_0xf3b04)[_0x66c7('0x1a')](_0x6400fe);}};}function respondWithFilteredResult(_0x4dd902,_0x208010){return function(_0x39f951){if(_0x39f951){var _0x3c81c0=typeof _0x208010[_0x66c7('0x1b')]===_0x66c7('0x1c')&&typeof _0x208010['limit']==='undefined';var _0x53fb36=_0x39f951['count'];var _0x8ad572=_0x3c81c0?0x0:_0x208010[_0x66c7('0x1b')];var _0x47a299=_0x3c81c0?_0x39f951['count']:_0x208010[_0x66c7('0x1b')]+_0x208010[_0x66c7('0x1d')];var _0x4756f7;if(_0x47a299>=_0x53fb36){_0x47a299=_0x53fb36;_0x4756f7=0xc8;}else{_0x4756f7=0xce;}_0x4dd902[_0x66c7('0x18')](_0x4756f7);return _0x4dd902['set']('Content-Range',_0x8ad572+'-'+_0x47a299+'/'+_0x53fb36)[_0x66c7('0x1a')](_0x39f951);}return null;};}function patchUpdates(_0x237177){return function(_0xf30f9){try{jsonpatch[_0x66c7('0x1e')](_0xf30f9,_0x237177,!![]);}catch(_0x465457){return BPromise[_0x66c7('0x1f')](_0x465457);}return _0xf30f9['save']();};}function saveUpdates(_0x4ddbd2,_0x366e9b){return function(_0x4a2b90){if(_0x4a2b90){return _0x4a2b90[_0x66c7('0x20')](_0x4ddbd2)[_0x66c7('0x21')](function(_0x44bdef){return _0x44bdef;});}return null;};}function removeEntity(_0x1fc9d3,_0x5bfaf6){return function(_0x2736df){if(_0x2736df){return _0x2736df[_0x66c7('0x22')]()['then'](function(){_0x1fc9d3[_0x66c7('0x18')](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x2bb86d,_0x2ef6a2){return function(_0x2af0a3){if(!_0x2af0a3){_0x2bb86d['sendStatus'](0x194);}return _0x2af0a3;};}function handleError(_0x5bc4e6,_0x4e514a){_0x4e514a=_0x4e514a||0x1f4;return function(_0x2dd131){logger[_0x66c7('0x23')](_0x2dd131['stack']);if(_0x2dd131[_0x66c7('0x24')]){delete _0x2dd131[_0x66c7('0x24')];}_0x5bc4e6[_0x66c7('0x18')](_0x4e514a)[_0x66c7('0x25')](_0x2dd131);};}exports[_0x66c7('0x26')]=function(_0x27be81,_0x570f0d){var _0xccefb2={},_0x2e2560={},_0xc4b2bf={'count':0x0,'rows':[]};var _0x33be23=_[_0x66c7('0x27')](db['ZendeskAccount'][_0x66c7('0x28')],function(_0x4f1a34){return{'name':_0x4f1a34[_0x66c7('0x29')],'type':_0x4f1a34['type'][_0x66c7('0x2a')]};});_0x2e2560[_0x66c7('0x2b')]=_[_0x66c7('0x27')](_0x33be23,_0x66c7('0x24'));_0x2e2560[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x27be81['query']);_0x2e2560['filters']=_[_0x66c7('0x2e')](_0x2e2560[_0x66c7('0x2b')],_0x2e2560[_0x66c7('0x2c')]);_0xccefb2[_0x66c7('0x2f')]=_[_0x66c7('0x2e')](_0x2e2560[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x30')]));_0xccefb2[_0x66c7('0x2f')]=_0xccefb2[_0x66c7('0x2f')][_0x66c7('0x31')]?_0xccefb2['attributes']:_0x2e2560['model'];if(!_0x27be81[_0x66c7('0x2c')][_0x66c7('0x32')](_0x66c7('0x33'))){_0xccefb2[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x1d')]);_0xccefb2['offset']=qs[_0x66c7('0x1b')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x1b')]);}_0xccefb2[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x35')]);_0xccefb2[_0x66c7('0x36')]=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0x27be81[_0x66c7('0x2c')],_0x2e2560['filters']),_0x33be23);if(_0x27be81['query'][_0x66c7('0x39')]){_0xccefb2[_0x66c7('0x36')]=_[_0x66c7('0x3a')](_0xccefb2['where'],{'$or':_['map'](_0x33be23,function(_0x2e31b8){if(_0x2e31b8[_0x66c7('0x3b')]!=='VIRTUAL'){var _0x2d98e4={};_0x2d98e4[_0x2e31b8[_0x66c7('0x24')]]={'$like':'%'+_0x27be81[_0x66c7('0x2c')]['filter']+'%'};return _0x2d98e4;}})});}_0xccefb2=_[_0x66c7('0x3a')]({},_0xccefb2,_0x27be81[_0x66c7('0x3c')]);var _0x9f6ca8={'where':_0xccefb2[_0x66c7('0x36')]};return db[_0x66c7('0x3d')][_0x66c7('0x3e')](_0x9f6ca8)[_0x66c7('0x21')](function(_0x279d27){_0xc4b2bf[_0x66c7('0x3e')]=_0x279d27;if(_0x27be81['query'][_0x66c7('0x3f')]){_0xccefb2[_0x66c7('0x40')]=[{'all':!![]}];}return db[_0x66c7('0x3d')][_0x66c7('0x41')](_0xccefb2);})[_0x66c7('0x21')](function(_0x28983c){_0xc4b2bf[_0x66c7('0x42')]=_0x28983c;return _0xc4b2bf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x570f0d,_0xccefb2))[_0x66c7('0x43')](handleError(_0x570f0d,null));};exports[_0x66c7('0x44')]=function(_0x513317,_0x5bb5fc){var _0x528f5c={'raw':![],'where':{'id':_0x513317[_0x66c7('0x45')]['id']}},_0x209f58={};_0x209f58['model']=_['keys'](db[_0x66c7('0x3d')][_0x66c7('0x28')]);_0x209f58[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x513317[_0x66c7('0x2c')]);_0x209f58['filters']=_[_0x66c7('0x2e')](_0x209f58['model'],_0x209f58['query']);_0x528f5c[_0x66c7('0x2f')]=_[_0x66c7('0x2e')](_0x209f58[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x513317['query']['fields']));_0x528f5c[_0x66c7('0x2f')]=_0x528f5c['attributes']['length']?_0x528f5c[_0x66c7('0x2f')]:_0x209f58[_0x66c7('0x2b')];if(_0x513317[_0x66c7('0x2c')][_0x66c7('0x3f')]){_0x528f5c['include']=[{'all':!![]}];}_0x528f5c=_[_0x66c7('0x3a')]({},_0x528f5c,_0x513317[_0x66c7('0x3c')]);return db[_0x66c7('0x3d')]['find'](_0x528f5c)[_0x66c7('0x21')](handleEntityNotFound(_0x5bb5fc,null))[_0x66c7('0x21')](respondWithResult(_0x5bb5fc,null))[_0x66c7('0x43')](handleError(_0x5bb5fc,null));};exports[_0x66c7('0x46')]=function(_0x1b78a6,_0x3b4f34){return db[_0x66c7('0x3d')][_0x66c7('0x46')](_0x1b78a6['body'],{})[_0x66c7('0x21')](respondWithResult(_0x3b4f34,0xc9))[_0x66c7('0x43')](handleError(_0x3b4f34,null));};exports[_0x66c7('0x20')]=function(_0x1386a2,_0x208a15){if(_0x1386a2[_0x66c7('0x47')]['id']){delete _0x1386a2[_0x66c7('0x47')]['id'];}return db[_0x66c7('0x3d')][_0x66c7('0x48')]({'where':{'id':_0x1386a2[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x208a15,null))[_0x66c7('0x21')](saveUpdates(_0x1386a2[_0x66c7('0x47')],null))[_0x66c7('0x21')](respondWithResult(_0x208a15,null))['catch'](handleError(_0x208a15,null));};exports[_0x66c7('0x22')]=function(_0x225fb6,_0x27070b){return db[_0x66c7('0x3d')]['find']({'where':{'id':_0x225fb6[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x27070b,null))['then'](removeEntity(_0x27070b,null))[_0x66c7('0x43')](handleError(_0x27070b,null));};exports[_0x66c7('0x49')]=function(_0xe4304c,_0x3dee16,_0x17670c){var _0x1c88c0={};var _0x1ed21e={};var _0x5cd4e9;var _0x933dd6;return db[_0x66c7('0x3d')]['findOne']({'where':{'id':_0xe4304c[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x3dee16,null))[_0x66c7('0x21')](function(_0x5df6d1){if(_0x5df6d1){_0x5cd4e9=_0x5df6d1;_0x1ed21e[_0x66c7('0x2b')]=_[_0x66c7('0x2d')](db[_0x66c7('0x4a')][_0x66c7('0x28')]);_0x1ed21e[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0xe4304c[_0x66c7('0x2c')]);_0x1ed21e[_0x66c7('0x37')]=_['intersection'](_0x1ed21e[_0x66c7('0x2b')],_0x1ed21e[_0x66c7('0x2c')]);_0x1c88c0['attributes']=_[_0x66c7('0x2e')](_0x1ed21e[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0xe4304c['query']['fields']));_0x1c88c0[_0x66c7('0x2f')]=_0x1c88c0['attributes'][_0x66c7('0x31')]?_0x1c88c0[_0x66c7('0x2f')]:_0x1ed21e[_0x66c7('0x2b')];_0x1c88c0[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0xe4304c[_0x66c7('0x2c')]['sort']);_0x1c88c0['where']=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0xe4304c['query'],_0x1ed21e['filters']));if(_0xe4304c[_0x66c7('0x2c')]['filter']){_0x1c88c0[_0x66c7('0x36')]=_[_0x66c7('0x3a')](_0x1c88c0[_0x66c7('0x36')],{'$or':_[_0x66c7('0x27')](_0x1c88c0['attributes'],function(_0x3b26ac){var _0x1dc6e6={};_0x1dc6e6[_0x3b26ac]={'$like':'%'+_0xe4304c[_0x66c7('0x2c')][_0x66c7('0x39')]+'%'};return _0x1dc6e6;})});}_0x1c88c0=_[_0x66c7('0x3a')]({},_0x1c88c0,_0xe4304c[_0x66c7('0x3c')]);return _0x5cd4e9['getConfigurations'](_0x1c88c0);}})[_0x66c7('0x21')](function(_0x39c18e){if(_0x39c18e){_0x933dd6=_0x39c18e[_0x66c7('0x31')];if(!_0xe4304c['query'][_0x66c7('0x32')]('nolimit')){_0x1c88c0[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0xe4304c[_0x66c7('0x2c')][_0x66c7('0x1d')]);_0x1c88c0[_0x66c7('0x1b')]=qs[_0x66c7('0x1b')](_0xe4304c['query'][_0x66c7('0x1b')]);}return _0x5cd4e9[_0x66c7('0x49')](_0x1c88c0);}})[_0x66c7('0x21')](function(_0x3b24d9){if(_0x3b24d9){return _0x3b24d9?{'count':_0x933dd6,'rows':_0x3b24d9}:null;}})[_0x66c7('0x21')](respondWithResult(_0x3dee16,null))['catch'](handleError(_0x3dee16,null));};exports[_0x66c7('0x4b')]=function(_0x1cb5ef,_0x429096,_0x37f244){if(_0x1cb5ef[_0x66c7('0x47')]['id']){delete _0x1cb5ef[_0x66c7('0x47')]['id'];}return db[_0x66c7('0x3d')][_0x66c7('0x4c')]({'where':{'id':_0x1cb5ef[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x429096,null))[_0x66c7('0x21')](function(_0x43b582){if(_0x43b582){_0x1cb5ef['body'][_0x66c7('0x4d')]=_0x43b582['id'];_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x4e')]=integrations[_0x66c7('0x4f')](_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x50')],_0x1cb5ef[_0x66c7('0x47')]['type']);_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x51')]=integrations[_0x66c7('0x52')](_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x50')],_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x3b')]);return db[_0x66c7('0x4a')][_0x66c7('0x46')](_0x1cb5ef[_0x66c7('0x47')],{'include':[{'model':db[_0x66c7('0x53')],'as':_0x66c7('0x4e')},{'model':db[_0x66c7('0x53')],'as':_0x66c7('0x51')}]});}return null;})[_0x66c7('0x21')](respondWithResult(_0x429096,null))[_0x66c7('0x43')](handleError(_0x429096,null));};exports['getFields']=function(_0x16d404,_0x31bc19,_0x43a623){var _0x153714='';return db[_0x66c7('0x3d')][_0x66c7('0x4c')]({'where':{'id':_0x16d404[_0x66c7('0x45')]['id']},'attributes':['id',_0x66c7('0x54'),_0x66c7('0x55'),_0x66c7('0x56'),_0x66c7('0x57'),_0x66c7('0x58')]})[_0x66c7('0x21')](handleEntityNotFound(_0x31bc19,null))[_0x66c7('0x21')](function(_0x3263ab){if(_0x3263ab){_0x153714=_0x3263ab[_0x66c7('0x58')];var _0x32a428=_0x153714['slice'](-0x1);if(_0x32a428==='/'){_0x153714=_0x153714[_0x66c7('0x59')](0x0,_0x153714[_0x66c7('0x5a')](_0x32a428));}var _0x188d9c={'method':_0x66c7('0x5b'),'uri':util[_0x66c7('0x5c')](_0x66c7('0x5d'),_0x153714,'ticket_fields'),'json':!![]};switch(_0x3263ab['authType']){case _0x66c7('0x55'):_0x188d9c['headers']={'Authorization':util[_0x66c7('0x5c')](_0x66c7('0x5e'),new Buffer(util[_0x66c7('0x5c')](_0x66c7('0x5f'),_0x3263ab[_0x66c7('0x54')],_0x3263ab[_0x66c7('0x55')]))[_0x66c7('0x60')](_0x66c7('0x61')))};break;case _0x66c7('0x56'):_0x188d9c[_0x66c7('0x62')]={'Authorization':util[_0x66c7('0x5c')](_0x66c7('0x5e'),new Buffer(util['format'](_0x66c7('0x63'),_0x3263ab[_0x66c7('0x54')],_0x3263ab[_0x66c7('0x56')]))[_0x66c7('0x60')]('base64'))};break;default:throw new db[(_0x66c7('0x64'))][(_0x66c7('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x188d9c);}})[_0x66c7('0x21')](function(_0x3a4fe1){if(_0x3a4fe1){var _0x3f25c0=[_0x66c7('0x66'),_0x66c7('0x67'),_0x66c7('0x68'),'assignee'];_['remove'](_0x3a4fe1[_0x66c7('0x69')],function(_0x549b15){return _0x3f25c0['includes'](_0x549b15[_0x66c7('0x3b')]);});return{'count':_0x3a4fe1[_0x66c7('0x69')][_0x66c7('0x31')],'rows':_[_0x66c7('0x27')](_0x3a4fe1[_0x66c7('0x69')],function(_0x536764){return{'id':_0x536764['id'],'name':_0x536764[_0x66c7('0x6a')]>0x7?_0x536764[_0x66c7('0x6b')]:_0x536764['type'],'custom':_0x536764[_0x66c7('0x6a')]>0x7?!![]:![],'options':_0x536764[_0x66c7('0x6c')]?_0x536764[_0x66c7('0x6c')]:_0x536764[_0x66c7('0x6d')]?_0x536764[_0x66c7('0x6d')]:[]};})};}})[_0x66c7('0x21')](respondWithResult(_0x31bc19,null))[_0x66c7('0x43')](function(_0x44a672){var _0x46b54f=_0x16d404[_0x66c7('0x2c')][_0x66c7('0x6e')]?0x1f4:_0x44a672[_0x66c7('0x6f')]||0x1f4;logger[_0x66c7('0x23')](_0x66c7('0x70'),_0x66c7('0x71'),_0x46b54f,JSON[_0x66c7('0x72')](_0x44a672));delete _0x44a672[_0x66c7('0x24')];if(_0x46b54f===0x191){_0x46b54f=0x190;}_0x31bc19[_0x66c7('0x18')](_0x46b54f)[_0x66c7('0x25')](_0x16d404[_0x66c7('0x2c')][_0x66c7('0x6e')]?{'message':_0x66c7('0x73'),'statusCode':_0x44a672[_0x66c7('0x6f')]}:_0x44a672);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e9e5384..aa04c7b 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 _0xc84d=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x9beac5,_0x47172c){var _0x318754=function(_0x63f29){while(--_0x63f29){_0x9beac5['push'](_0x9beac5['shift']());}};_0x318754(++_0x47172c);}(_0xc84d,0x114));var _0xdc84=function(_0x587543,_0x4bff1b){_0x587543=_0x587543-0x0;var _0x1fb87d=_0xc84d[_0x587543];return _0x1fb87d;};'use strict';var _=require(_0xdc84('0x0'));var util=require(_0xdc84('0x1'));var logger=require('../../config/logger')(_0xdc84('0x2'));var moment=require(_0xdc84('0x3'));var BPromise=require(_0xdc84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc84('0x5'));var rimraf=require('rimraf');var config=require(_0xdc84('0x6'));var attributes=require(_0xdc84('0x7'));var integrations=require(_0xdc84('0x8'));module[_0xdc84('0x9')]=function(_0x23f045,_0x51c45f){return _0x23f045[_0xdc84('0xa')](_0xdc84('0xb'),attributes,{'tableName':_0xdc84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ccb=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x1ccb,0x1d9));var _0xb1cc=function(_0xc7c0ee,_0x1a0e94){_0xc7c0ee=_0xc7c0ee-0x0;var _0x2c9209=_0x1ccb[_0xc7c0ee];return _0x2c9209;};'use strict';var _=require(_0xb1cc('0x0'));var util=require(_0xb1cc('0x1'));var logger=require(_0xb1cc('0x2'))('api');var moment=require(_0xb1cc('0x3'));var BPromise=require(_0xb1cc('0x4'));var rp=require(_0xb1cc('0x5'));var fs=require('fs');var path=require(_0xb1cc('0x6'));var rimraf=require(_0xb1cc('0x7'));var config=require(_0xb1cc('0x8'));var attributes=require(_0xb1cc('0x9'));var integrations=require(_0xb1cc('0xa'));module[_0xb1cc('0xb')]=function(_0x425aff,_0x2ac6dc){return _0x425aff[_0xb1cc('0xc')](_0xb1cc('0xd'),attributes,{'tableName':_0xb1cc('0xe'),'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 8e6a25f..9bfefad 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 _0x7e3e=['info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x24e364,_0x22c22c){var _0x3921b0=function(_0x4f15d9){while(--_0x4f15d9){_0x24e364['push'](_0x24e364['shift']());}};_0x3921b0(++_0x22c22c);}(_0x7e3e,0x126));var _0xe7e3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7e3e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe7e3('0x0'));var util=require('util');var moment=require(_0xe7e3('0x1'));var BPromise=require(_0xe7e3('0x2'));var rs=require(_0xe7e3('0x3'));var fs=require('fs');var Redis=require(_0xe7e3('0x4'));var db=require(_0xe7e3('0x5'))['db'];var utils=require(_0xe7e3('0x6'));var logger=require(_0xe7e3('0x7'))(_0xe7e3('0x8'));var config=require(_0xe7e3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x416828,_0x1551aa,_0x202718){return new BPromise(function(_0x49470f,_0x45ac24){return client[_0xe7e3('0xa')](_0x416828,_0x202718)[_0xe7e3('0xb')](function(_0x1f114c){logger[_0xe7e3('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x1551aa,_0xe7e3('0xd'));logger[_0xe7e3('0xe')](_0xe7e3('0xf'),_0x1551aa,_0xe7e3('0xd'),JSON['stringify'](_0x1f114c));if(_0x1f114c[_0xe7e3('0x10')]){if(_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x11')]===0x1f4){logger[_0xe7e3('0x10')](_0xe7e3('0x12'),_0x1551aa,_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x13')]);return _0x45ac24(_0x1f114c[_0xe7e3('0x10')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1551aa,_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x13')]);return _0x49470f(_0x1f114c[_0xe7e3('0x10')]['message']);}else{logger[_0xe7e3('0xc')](_0xe7e3('0x12'),_0x1551aa,_0xe7e3('0xd'));_0x49470f(_0x1f114c[_0xe7e3('0x14')][_0xe7e3('0x13')]);}})['catch'](function(_0x1c3878){logger[_0xe7e3('0x10')](_0xe7e3('0x12'),_0x1551aa,_0x1c3878);_0x45ac24(_0x1c3878);});});}exports['GetZendeskAccount']=function(_0x25e3b9){var _0x5c34c5=this;return new Promise(function(_0x364d3d,_0x7ef16){return db[_0xe7e3('0x15')]['findAll']({'raw':_0x25e3b9[_0xe7e3('0x16')]?_0x25e3b9['options'][_0xe7e3('0x17')]===undefined?!![]:![]:!![],'where':_0x25e3b9[_0xe7e3('0x16')]?_0x25e3b9['options'][_0xe7e3('0x18')]||null:null,'attributes':_0x25e3b9['options']?_0x25e3b9[_0xe7e3('0x16')][_0xe7e3('0x19')]||null:null,'limit':_0x25e3b9[_0xe7e3('0x16')]?_0x25e3b9['options'][_0xe7e3('0x1a')]||null:null,'include':_0x25e3b9[_0xe7e3('0x16')]?_0x25e3b9[_0xe7e3('0x16')][_0xe7e3('0x1b')]?_[_0xe7e3('0x1c')](_0x25e3b9[_0xe7e3('0x16')]['include'],function(_0x2127a8){return{'model':db[_0x2127a8[_0xe7e3('0x1d')]],'as':_0x2127a8['as'],'attributes':_0x2127a8['attributes'],'include':_0x2127a8[_0xe7e3('0x1b')]?_['map'](_0x2127a8[_0xe7e3('0x1b')],function(_0x15417d){return{'model':db[_0x15417d[_0xe7e3('0x1d')]],'as':_0x15417d['as'],'attributes':_0x15417d[_0xe7e3('0x19')],'include':_0x15417d[_0xe7e3('0x1b')]?_[_0xe7e3('0x1c')](_0x15417d[_0xe7e3('0x1b')],function(_0x1054da){return{'model':db[_0x1054da[_0xe7e3('0x1d')]],'as':_0x1054da['as'],'attributes':_0x1054da[_0xe7e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe7e3('0xb')](function(_0xacae31){logger[_0xe7e3('0xc')](_0xe7e3('0x1e'),_0x25e3b9);logger[_0xe7e3('0xe')](_0xe7e3('0x1e'),_0x25e3b9,JSON[_0xe7e3('0x1f')](_0xacae31));_0x364d3d(_0xacae31);})['catch'](function(_0x42e1df){logger[_0xe7e3('0x10')]('GetZendeskAccount',_0x42e1df['message'],_0x25e3b9);_0x7ef16(_0x5c34c5[_0xe7e3('0x10')](0x1f4,_0x42e1df[_0xe7e3('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x250144){var _0x27d995=this;return new Promise(function(_0x4f5291,_0x426b72){return db[_0xe7e3('0x15')]['find']({'raw':_0x250144[_0xe7e3('0x16')]?_0x250144['options'][_0xe7e3('0x17')]===undefined?!![]:![]:!![],'where':_0x250144[_0xe7e3('0x16')]?_0x250144['options'][_0xe7e3('0x18')]||null:null,'attributes':_0x250144[_0xe7e3('0x16')]?_0x250144['options'][_0xe7e3('0x19')]||null:null,'include':_0x250144[_0xe7e3('0x16')]?_0x250144['options']['include']?_[_0xe7e3('0x1c')](_0x250144[_0xe7e3('0x16')][_0xe7e3('0x1b')],function(_0x11ee03){return{'model':db[_0x11ee03[_0xe7e3('0x1d')]],'as':_0x11ee03['as'],'attributes':_0x11ee03[_0xe7e3('0x19')],'include':_0x11ee03['include']?_[_0xe7e3('0x1c')](_0x11ee03['include'],function(_0x2c0b25){return{'model':db[_0x2c0b25['model']],'as':_0x2c0b25['as'],'attributes':_0x2c0b25[_0xe7e3('0x19')],'include':_0x2c0b25['include']?_[_0xe7e3('0x1c')](_0x2c0b25[_0xe7e3('0x1b')],function(_0x4e42ed){return{'model':db[_0x4e42ed[_0xe7e3('0x1d')]],'as':_0x4e42ed['as'],'attributes':_0x4e42ed[_0xe7e3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55a4a9){logger['info'](_0xe7e3('0x20'),_0x250144);logger[_0xe7e3('0xe')](_0xe7e3('0x20'),_0x250144,JSON[_0xe7e3('0x1f')](_0x55a4a9));_0x4f5291(_0x55a4a9);})[_0xe7e3('0x21')](function(_0x36c02d){logger[_0xe7e3('0x10')](_0xe7e3('0x20'),_0x36c02d[_0xe7e3('0x13')],_0x250144);_0x426b72(_0x27d995[_0xe7e3('0x10')](0x1f4,_0x36c02d['message']));});});}; \ No newline at end of file +var _0x2ce3=['client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xf4e030,_0x131199){var _0x30f392=function(_0x584802){while(--_0x584802){_0xf4e030['push'](_0xf4e030['shift']());}};_0x30f392(++_0x131199);}(_0x2ce3,0x87));var _0x32ce=function(_0x117a44,_0xc457e1){_0x117a44=_0x117a44-0x0;var _0x4dacc4=_0x2ce3[_0x117a44];return _0x4dacc4;};'use strict';var _=require(_0x32ce('0x0'));var util=require('util');var moment=require(_0x32ce('0x1'));var BPromise=require(_0x32ce('0x2'));var rs=require(_0x32ce('0x3'));var fs=require('fs');var Redis=require(_0x32ce('0x4'));var db=require(_0x32ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32ce('0x6'))(_0x32ce('0x7'));var config=require('../../config/environment');var jayson=require(_0x32ce('0x8'));var client=jayson[_0x32ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2da1c8,_0x448fb8,_0xf768fb){return new BPromise(function(_0x46acd0,_0x1214a6){return client[_0x32ce('0xa')](_0x2da1c8,_0xf768fb)[_0x32ce('0xb')](function(_0x2b9f67){logger[_0x32ce('0xc')](_0x32ce('0xd'),_0x448fb8,_0x32ce('0xe'));logger[_0x32ce('0xf')](_0x32ce('0x10'),_0x448fb8,_0x32ce('0xe'),JSON[_0x32ce('0x11')](_0x2b9f67));if(_0x2b9f67[_0x32ce('0x12')]){if(_0x2b9f67[_0x32ce('0x12')][_0x32ce('0x13')]===0x1f4){logger['error'](_0x32ce('0xd'),_0x448fb8,_0x2b9f67[_0x32ce('0x12')][_0x32ce('0x14')]);return _0x1214a6(_0x2b9f67[_0x32ce('0x12')][_0x32ce('0x14')]);}logger['error'](_0x32ce('0xd'),_0x448fb8,_0x2b9f67[_0x32ce('0x12')]['message']);return _0x46acd0(_0x2b9f67[_0x32ce('0x12')][_0x32ce('0x14')]);}else{logger['info'](_0x32ce('0xd'),_0x448fb8,_0x32ce('0xe'));_0x46acd0(_0x2b9f67[_0x32ce('0x15')]['message']);}})[_0x32ce('0x16')](function(_0x1b28f6){logger[_0x32ce('0x12')](_0x32ce('0xd'),_0x448fb8,_0x1b28f6);_0x1214a6(_0x1b28f6);});});}exports[_0x32ce('0x17')]=function(_0x54d966){var _0x3e01e8=this;return new Promise(function(_0x21406c,_0x3813e9){return db[_0x32ce('0x18')][_0x32ce('0x19')]({'raw':_0x54d966[_0x32ce('0x1a')]?_0x54d966[_0x32ce('0x1a')][_0x32ce('0x1b')]===undefined?!![]:![]:!![],'where':_0x54d966[_0x32ce('0x1a')]?_0x54d966['options'][_0x32ce('0x1c')]||null:null,'attributes':_0x54d966[_0x32ce('0x1a')]?_0x54d966[_0x32ce('0x1a')][_0x32ce('0x1d')]||null:null,'limit':_0x54d966[_0x32ce('0x1a')]?_0x54d966[_0x32ce('0x1a')][_0x32ce('0x1e')]||null:null,'include':_0x54d966[_0x32ce('0x1a')]?_0x54d966[_0x32ce('0x1a')][_0x32ce('0x1f')]?_['map'](_0x54d966[_0x32ce('0x1a')][_0x32ce('0x1f')],function(_0x1c269d){return{'model':db[_0x1c269d['model']],'as':_0x1c269d['as'],'attributes':_0x1c269d[_0x32ce('0x1d')],'include':_0x1c269d[_0x32ce('0x1f')]?_[_0x32ce('0x20')](_0x1c269d[_0x32ce('0x1f')],function(_0x1a8d23){return{'model':db[_0x1a8d23[_0x32ce('0x21')]],'as':_0x1a8d23['as'],'attributes':_0x1a8d23[_0x32ce('0x1d')],'include':_0x1a8d23[_0x32ce('0x1f')]?_[_0x32ce('0x20')](_0x1a8d23[_0x32ce('0x1f')],function(_0x5d275){return{'model':db[_0x5d275[_0x32ce('0x21')]],'as':_0x5d275['as'],'attributes':_0x5d275[_0x32ce('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ea0c2){logger[_0x32ce('0xc')](_0x32ce('0x17'),_0x54d966);logger[_0x32ce('0xf')](_0x32ce('0x17'),_0x54d966,JSON[_0x32ce('0x11')](_0x4ea0c2));_0x21406c(_0x4ea0c2);})['catch'](function(_0x45c742){logger[_0x32ce('0x12')](_0x32ce('0x17'),_0x45c742[_0x32ce('0x14')],_0x54d966);_0x3813e9(_0x3e01e8[_0x32ce('0x12')](0x1f4,_0x45c742[_0x32ce('0x14')]));});});};exports[_0x32ce('0x22')]=function(_0x287961){var _0x5d71dd=this;return new Promise(function(_0x53d16b,_0x1f0af5){return db[_0x32ce('0x18')][_0x32ce('0x23')]({'raw':_0x287961[_0x32ce('0x1a')]?_0x287961[_0x32ce('0x1a')][_0x32ce('0x1b')]===undefined?!![]:![]:!![],'where':_0x287961[_0x32ce('0x1a')]?_0x287961[_0x32ce('0x1a')][_0x32ce('0x1c')]||null:null,'attributes':_0x287961[_0x32ce('0x1a')]?_0x287961['options'][_0x32ce('0x1d')]||null:null,'include':_0x287961[_0x32ce('0x1a')]?_0x287961[_0x32ce('0x1a')][_0x32ce('0x1f')]?_['map'](_0x287961[_0x32ce('0x1a')][_0x32ce('0x1f')],function(_0x8e62c){return{'model':db[_0x8e62c['model']],'as':_0x8e62c['as'],'attributes':_0x8e62c[_0x32ce('0x1d')],'include':_0x8e62c[_0x32ce('0x1f')]?_['map'](_0x8e62c[_0x32ce('0x1f')],function(_0x22a6ef){return{'model':db[_0x22a6ef[_0x32ce('0x21')]],'as':_0x22a6ef['as'],'attributes':_0x22a6ef[_0x32ce('0x1d')],'include':_0x22a6ef[_0x32ce('0x1f')]?_['map'](_0x22a6ef['include'],function(_0xcc1c0a){return{'model':db[_0xcc1c0a[_0x32ce('0x21')]],'as':_0xcc1c0a['as'],'attributes':_0xcc1c0a[_0x32ce('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x32ce('0xb')](function(_0x339366){logger[_0x32ce('0xc')](_0x32ce('0x22'),_0x287961);logger[_0x32ce('0xf')](_0x32ce('0x22'),_0x287961,JSON[_0x32ce('0x11')](_0x339366));_0x53d16b(_0x339366);})['catch'](function(_0x2448df){logger[_0x32ce('0x12')]('ShowZendeskAccount',_0x2448df[_0x32ce('0x14')],_0x287961);_0x1f0af5(_0x5d71dd[_0x32ce('0x12')](0x1f4,_0x2448df[_0x32ce('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c01f4bc..41d3609 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0xb688,0xcf));var _0x8b68=function(_0x388cf8,_0x5f0ba3){_0x388cf8=_0x388cf8-0x0;var _0xbe7acf=_0xb688[_0x388cf8];return _0xbe7acf;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x4ea850,_0x2ce4d4){var _0x49a903=function(_0x5ab5c4){while(--_0x5ab5c4){_0x4ea850['push'](_0x4ea850['shift']());}};_0x49a903(++_0x2ce4d4);}(_0x91a7,0xe7));var _0x791a=function(_0xd24275,_0x537b5f){_0xd24275=_0xd24275-0x0;var _0x4735bb=_0x91a7[_0xd24275];return _0x4735bb;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 40262ba..733fd8d 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 _0xbfdf=['exports','STRING','sequelize'];(function(_0x26d173,_0x5d93f4){var _0x5efd81=function(_0x6c8a40){while(--_0x6c8a40){_0x26d173['push'](_0x26d173['shift']());}};_0x5efd81(++_0x5d93f4);}(_0xbfdf,0x1a6));var _0xfbfd=function(_0x55eee0,_0x5d1492){_0x55eee0=_0x55eee0-0x0;var _0x283f98=_0xbfdf[_0x55eee0];return _0x283f98;};'use strict';var Sequelize=require(_0xfbfd('0x0'));module[_0xfbfd('0x1')]={'name':{'type':Sequelize[_0xfbfd('0x2')]},'description':{'type':Sequelize[_0xfbfd('0x2')]}}; \ No newline at end of file +var _0xe0a4=['exports','STRING'];(function(_0x34a161,_0x52a77b){var _0x4412a1=function(_0x32e665){while(--_0x32e665){_0x34a161['push'](_0x34a161['shift']());}};_0x4412a1(++_0x52a77b);}(_0xe0a4,0x16e));var _0x4e0a=function(_0x4be073,_0x1cadcf){_0x4be073=_0x4be073-0x0;var _0x270989=_0xe0a4[_0x4be073];return _0x270989;};'use strict';var Sequelize=require('sequelize');module[_0x4e0a('0x0')]={'name':{'type':Sequelize[_0x4e0a('0x1')]},'description':{'type':Sequelize[_0x4e0a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4d826d3..5c82690 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 _0x6fd9=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','getFields','findOne','ZendeskField','order','pick','getSubjects','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','name','index','map','ZendeskConfiguration','type','model'];(function(_0x185327,_0x3e0451){var _0x13ac92=function(_0x1124e6){while(--_0x1124e6){_0x185327['push'](_0x185327['shift']());}};_0x13ac92(++_0x3e0451);}(_0x6fd9,0x10c));var _0x96fd=function(_0x42e4c8,_0x405d81){_0x42e4c8=_0x42e4c8-0x0;var _0x4286fa=_0x6fd9[_0x42e4c8];return _0x4286fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96fd('0x0'));var zipdir=require(_0x96fd('0x1'));var jsonpatch=require(_0x96fd('0x2'));var rp=require(_0x96fd('0x3'));var moment=require(_0x96fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96fd('0x5'));var util=require(_0x96fd('0x6'));var path=require(_0x96fd('0x7'));var sox=require(_0x96fd('0x8'));var csv=require(_0x96fd('0x9'));var ejs=require(_0x96fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x96fd('0xb'));var crypto=require(_0x96fd('0xc'));var jsforce=require(_0x96fd('0xd'));var deskjs=require(_0x96fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x96fd('0xf'));var Papa=require('papaparse');var Redis=require(_0x96fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x96fd('0x11'));var as=require(_0x96fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x96fd('0x13'));var utils=require(_0x96fd('0x14'));var config=require(_0x96fd('0x15'));var licenseUtil=require(_0x96fd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x389ad2,_0x91ad6b){_0x91ad6b=_0x91ad6b||0xcc;return function(_0x51aacd){if(_0x51aacd){return _0x389ad2[_0x96fd('0x17')](_0x91ad6b);}return _0x389ad2[_0x96fd('0x18')](_0x91ad6b)['end']();};}function respondWithResult(_0x5226b9,_0x4b51c7){_0x4b51c7=_0x4b51c7||0xc8;return function(_0x4c9f35){if(_0x4c9f35){return _0x5226b9[_0x96fd('0x18')](_0x4b51c7)['json'](_0x4c9f35);}};}function respondWithFilteredResult(_0x2a7f6c,_0x2baae8){return function(_0x3c97b5){if(_0x3c97b5){var _0x6610c6=typeof _0x2baae8[_0x96fd('0x19')]==='undefined'&&typeof _0x2baae8[_0x96fd('0x1a')]==='undefined';var _0x46b9ee=_0x3c97b5[_0x96fd('0x1b')];var _0x11467f=_0x6610c6?0x0:_0x2baae8[_0x96fd('0x19')];var _0x1949f3=_0x6610c6?_0x3c97b5[_0x96fd('0x1b')]:_0x2baae8[_0x96fd('0x19')]+_0x2baae8[_0x96fd('0x1a')];var _0x2e2788;if(_0x1949f3>=_0x46b9ee){_0x1949f3=_0x46b9ee;_0x2e2788=0xc8;}else{_0x2e2788=0xce;}_0x2a7f6c[_0x96fd('0x18')](_0x2e2788);return _0x2a7f6c[_0x96fd('0x1c')](_0x96fd('0x1d'),_0x11467f+'-'+_0x1949f3+'/'+_0x46b9ee)[_0x96fd('0x1e')](_0x3c97b5);}return null;};}function patchUpdates(_0x252b2f){return function(_0x14440d){try{jsonpatch['apply'](_0x14440d,_0x252b2f,!![]);}catch(_0x1041ae){return BPromise[_0x96fd('0x1f')](_0x1041ae);}return _0x14440d[_0x96fd('0x20')]();};}function saveUpdates(_0x3512a7,_0x379178){return function(_0x3c4d6d){if(_0x3c4d6d){return _0x3c4d6d[_0x96fd('0x21')](_0x3512a7)['then'](function(_0x585678){return _0x585678;});}return null;};}function removeEntity(_0x568d55,_0x3dd342){return function(_0x5882a2){if(_0x5882a2){return _0x5882a2[_0x96fd('0x22')]()[_0x96fd('0x23')](function(){_0x568d55['status'](0xcc)[_0x96fd('0x24')]();});}};}function handleEntityNotFound(_0x6a2d41,_0x4b6a3e){return function(_0x577502){if(!_0x577502){_0x6a2d41['sendStatus'](0x194);}return _0x577502;};}function handleError(_0x3ba211,_0x4a5b17){_0x4a5b17=_0x4a5b17||0x1f4;return function(_0x136f2c){logger[_0x96fd('0x25')](_0x136f2c['stack']);if(_0x136f2c[_0x96fd('0x26')]){delete _0x136f2c[_0x96fd('0x26')];}_0x3ba211[_0x96fd('0x18')](_0x4a5b17)['send'](_0x136f2c);};}exports[_0x96fd('0x27')]=function(_0x1db6fd,_0x2d4299){var _0x34aad4={},_0x412f1e={},_0x45b932={'count':0x0,'rows':[]};var _0x2f76cc=_[_0x96fd('0x28')](db[_0x96fd('0x29')]['rawAttributes'],function(_0x31bcf8){return{'name':_0x31bcf8['fieldName'],'type':_0x31bcf8[_0x96fd('0x2a')]['key']};});_0x412f1e[_0x96fd('0x2b')]=_['map'](_0x2f76cc,'name');_0x412f1e[_0x96fd('0x2c')]=_[_0x96fd('0x2d')](_0x1db6fd[_0x96fd('0x2c')]);_0x412f1e[_0x96fd('0x2e')]=_[_0x96fd('0x2f')](_0x412f1e[_0x96fd('0x2b')],_0x412f1e[_0x96fd('0x2c')]);_0x34aad4['attributes']=_[_0x96fd('0x2f')](_0x412f1e[_0x96fd('0x2b')],qs[_0x96fd('0x30')](_0x1db6fd[_0x96fd('0x2c')]['fields']));_0x34aad4[_0x96fd('0x31')]=_0x34aad4[_0x96fd('0x31')]['length']?_0x34aad4[_0x96fd('0x31')]:_0x412f1e[_0x96fd('0x2b')];if(!_0x1db6fd[_0x96fd('0x2c')][_0x96fd('0x32')](_0x96fd('0x33'))){_0x34aad4['limit']=qs['limit'](_0x1db6fd[_0x96fd('0x2c')]['limit']);_0x34aad4[_0x96fd('0x19')]=qs[_0x96fd('0x19')](_0x1db6fd['query'][_0x96fd('0x19')]);}_0x34aad4['order']=qs['sort'](_0x1db6fd[_0x96fd('0x2c')][_0x96fd('0x34')]);_0x34aad4['where']=qs[_0x96fd('0x2e')](_['pick'](_0x1db6fd[_0x96fd('0x2c')],_0x412f1e[_0x96fd('0x2e')]),_0x2f76cc);if(_0x1db6fd[_0x96fd('0x2c')][_0x96fd('0x35')]){_0x34aad4[_0x96fd('0x36')]=_[_0x96fd('0x37')](_0x34aad4[_0x96fd('0x36')],{'$or':_[_0x96fd('0x28')](_0x2f76cc,function(_0xef7c0a){if(_0xef7c0a[_0x96fd('0x2a')]!=='VIRTUAL'){var _0x5535b6={};_0x5535b6[_0xef7c0a[_0x96fd('0x26')]]={'$like':'%'+_0x1db6fd[_0x96fd('0x2c')][_0x96fd('0x35')]+'%'};return _0x5535b6;}})});}_0x34aad4=_['merge']({},_0x34aad4,_0x1db6fd['options']);var _0x85740={'where':_0x34aad4[_0x96fd('0x36')]};return db['ZendeskConfiguration'][_0x96fd('0x1b')](_0x85740)[_0x96fd('0x23')](function(_0x20d139){_0x45b932[_0x96fd('0x1b')]=_0x20d139;if(_0x1db6fd['query'][_0x96fd('0x38')]){_0x34aad4[_0x96fd('0x39')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x96fd('0x3a')](_0x34aad4);})[_0x96fd('0x23')](function(_0x49abdc){_0x45b932['rows']=_0x49abdc;return _0x45b932;})[_0x96fd('0x23')](respondWithFilteredResult(_0x2d4299,_0x34aad4))[_0x96fd('0x3b')](handleError(_0x2d4299,null));};exports[_0x96fd('0x3c')]=function(_0x2eb0f1,_0x578976){var _0x43baf3={'raw':![],'where':{'id':_0x2eb0f1[_0x96fd('0x3d')]['id']}},_0x2505a4={};_0x2505a4[_0x96fd('0x2b')]=_['keys'](db[_0x96fd('0x29')][_0x96fd('0x3e')]);_0x2505a4['query']=_[_0x96fd('0x2d')](_0x2eb0f1[_0x96fd('0x2c')]);_0x2505a4[_0x96fd('0x2e')]=_[_0x96fd('0x2f')](_0x2505a4[_0x96fd('0x2b')],_0x2505a4[_0x96fd('0x2c')]);_0x43baf3[_0x96fd('0x31')]=_[_0x96fd('0x2f')](_0x2505a4[_0x96fd('0x2b')],qs[_0x96fd('0x30')](_0x2eb0f1[_0x96fd('0x2c')][_0x96fd('0x30')]));_0x43baf3['attributes']=_0x43baf3[_0x96fd('0x31')][_0x96fd('0x3f')]?_0x43baf3['attributes']:_0x2505a4[_0x96fd('0x2b')];if(_0x2eb0f1[_0x96fd('0x2c')][_0x96fd('0x38')]){_0x43baf3[_0x96fd('0x39')]=[{'all':!![]}];}_0x43baf3=_[_0x96fd('0x37')]({},_0x43baf3,_0x2eb0f1[_0x96fd('0x40')]);return db[_0x96fd('0x29')][_0x96fd('0x41')](_0x43baf3)['then'](handleEntityNotFound(_0x578976,null))['then'](respondWithResult(_0x578976,null))[_0x96fd('0x3b')](handleError(_0x578976,null));};exports[_0x96fd('0x42')]=function(_0x7a272,_0x23d233){return db[_0x96fd('0x29')][_0x96fd('0x42')](_0x7a272[_0x96fd('0x43')],{})['then'](respondWithResult(_0x23d233,0xc9))[_0x96fd('0x3b')](handleError(_0x23d233,null));};exports['update']=function(_0x157e7b,_0x4132a9){if(_0x157e7b[_0x96fd('0x43')]['id']){delete _0x157e7b[_0x96fd('0x43')]['id'];}return db[_0x96fd('0x29')][_0x96fd('0x41')]({'where':{'id':_0x157e7b[_0x96fd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4132a9,null))['then'](saveUpdates(_0x157e7b[_0x96fd('0x43')],null))[_0x96fd('0x23')](respondWithResult(_0x4132a9,null))[_0x96fd('0x3b')](handleError(_0x4132a9,null));};exports[_0x96fd('0x22')]=function(_0x339973,_0x6e56e8){return db['ZendeskConfiguration']['find']({'where':{'id':_0x339973[_0x96fd('0x3d')]['id']}})[_0x96fd('0x23')](handleEntityNotFound(_0x6e56e8,null))[_0x96fd('0x23')](removeEntity(_0x6e56e8,null))[_0x96fd('0x3b')](handleError(_0x6e56e8,null));};exports[_0x96fd('0x44')]=function(_0x4ceeec,_0x1766b1,_0x3a17bf){var _0x6d6f1a={};var _0x33dc18={};var _0x139e13;var _0x576f4e;return db['ZendeskConfiguration'][_0x96fd('0x45')]({'where':{'id':_0x4ceeec['params']['id']}})[_0x96fd('0x23')](handleEntityNotFound(_0x1766b1,null))['then'](function(_0xfb8d9a){if(_0xfb8d9a){_0x139e13=_0xfb8d9a;_0x33dc18[_0x96fd('0x2b')]=_[_0x96fd('0x2d')](db[_0x96fd('0x46')][_0x96fd('0x3e')]);_0x33dc18[_0x96fd('0x2c')]=_[_0x96fd('0x2d')](_0x4ceeec[_0x96fd('0x2c')]);_0x33dc18[_0x96fd('0x2e')]=_[_0x96fd('0x2f')](_0x33dc18[_0x96fd('0x2b')],_0x33dc18['query']);_0x6d6f1a[_0x96fd('0x31')]=_[_0x96fd('0x2f')](_0x33dc18['model'],qs[_0x96fd('0x30')](_0x4ceeec[_0x96fd('0x2c')][_0x96fd('0x30')]));_0x6d6f1a[_0x96fd('0x31')]=_0x6d6f1a[_0x96fd('0x31')][_0x96fd('0x3f')]?_0x6d6f1a['attributes']:_0x33dc18[_0x96fd('0x2b')];_0x6d6f1a[_0x96fd('0x47')]=qs[_0x96fd('0x34')](_0x4ceeec['query'][_0x96fd('0x34')]);_0x6d6f1a[_0x96fd('0x36')]=qs['filters'](_[_0x96fd('0x48')](_0x4ceeec[_0x96fd('0x2c')],_0x33dc18[_0x96fd('0x2e')]));if(_0x4ceeec[_0x96fd('0x2c')][_0x96fd('0x35')]){_0x6d6f1a['where']=_['merge'](_0x6d6f1a[_0x96fd('0x36')],{'$or':_[_0x96fd('0x28')](_0x6d6f1a[_0x96fd('0x31')],function(_0x142432){var _0x89ac06={};_0x89ac06[_0x142432]={'$like':'%'+_0x4ceeec[_0x96fd('0x2c')][_0x96fd('0x35')]+'%'};return _0x89ac06;})});}_0x6d6f1a=_[_0x96fd('0x37')]({},_0x6d6f1a,_0x4ceeec[_0x96fd('0x40')]);return _0x139e13[_0x96fd('0x44')](_0x6d6f1a);}})[_0x96fd('0x23')](function(_0x19ad59){if(_0x19ad59){_0x576f4e=_0x19ad59[_0x96fd('0x3f')];if(!_0x4ceeec['query'][_0x96fd('0x32')](_0x96fd('0x33'))){_0x6d6f1a[_0x96fd('0x1a')]=qs['limit'](_0x4ceeec[_0x96fd('0x2c')][_0x96fd('0x1a')]);_0x6d6f1a[_0x96fd('0x19')]=qs['offset'](_0x4ceeec[_0x96fd('0x2c')][_0x96fd('0x19')]);}return _0x139e13['getFields'](_0x6d6f1a);}})['then'](function(_0x260c9a){if(_0x260c9a){return _0x260c9a?{'count':_0x576f4e,'rows':_0x260c9a}:null;}})[_0x96fd('0x23')](respondWithResult(_0x1766b1,null))[_0x96fd('0x3b')](handleError(_0x1766b1,null));};exports[_0x96fd('0x49')]=function(_0x36a355,_0xd40b97,_0x31617d){var _0x1400e0={};var _0x20521b={};var _0x15078b;var _0x42f975;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x36a355[_0x96fd('0x3d')]['id']}})[_0x96fd('0x23')](handleEntityNotFound(_0xd40b97,null))[_0x96fd('0x23')](function(_0x47851d){if(_0x47851d){_0x15078b=_0x47851d;_0x20521b['model']=_[_0x96fd('0x2d')](db[_0x96fd('0x46')]['rawAttributes']);_0x20521b[_0x96fd('0x2c')]=_[_0x96fd('0x2d')](_0x36a355[_0x96fd('0x2c')]);_0x20521b[_0x96fd('0x2e')]=_[_0x96fd('0x2f')](_0x20521b[_0x96fd('0x2b')],_0x20521b[_0x96fd('0x2c')]);_0x1400e0[_0x96fd('0x31')]=_['intersection'](_0x20521b[_0x96fd('0x2b')],qs[_0x96fd('0x30')](_0x36a355[_0x96fd('0x2c')][_0x96fd('0x30')]));_0x1400e0[_0x96fd('0x31')]=_0x1400e0[_0x96fd('0x31')]['length']?_0x1400e0[_0x96fd('0x31')]:_0x20521b[_0x96fd('0x2b')];_0x1400e0[_0x96fd('0x47')]=qs['sort'](_0x36a355[_0x96fd('0x2c')][_0x96fd('0x34')]);_0x1400e0['where']=qs[_0x96fd('0x2e')](_['pick'](_0x36a355[_0x96fd('0x2c')],_0x20521b['filters']));if(_0x36a355[_0x96fd('0x2c')][_0x96fd('0x35')]){_0x1400e0[_0x96fd('0x36')]=_[_0x96fd('0x37')](_0x1400e0[_0x96fd('0x36')],{'$or':_['map'](_0x1400e0[_0x96fd('0x31')],function(_0x154332){var _0x2b6ec9={};_0x2b6ec9[_0x154332]={'$like':'%'+_0x36a355[_0x96fd('0x2c')]['filter']+'%'};return _0x2b6ec9;})});}_0x1400e0=_[_0x96fd('0x37')]({},_0x1400e0,_0x36a355[_0x96fd('0x40')]);return _0x15078b[_0x96fd('0x49')](_0x1400e0);}})[_0x96fd('0x23')](function(_0x1968c3){if(_0x1968c3){_0x42f975=_0x1968c3[_0x96fd('0x3f')];if(!_0x36a355['query'][_0x96fd('0x32')](_0x96fd('0x33'))){_0x1400e0[_0x96fd('0x1a')]=qs['limit'](_0x36a355[_0x96fd('0x2c')][_0x96fd('0x1a')]);_0x1400e0[_0x96fd('0x19')]=qs[_0x96fd('0x19')](_0x36a355[_0x96fd('0x2c')]['offset']);}return _0x15078b[_0x96fd('0x49')](_0x1400e0);}})[_0x96fd('0x23')](function(_0x27c5c4){if(_0x27c5c4){return _0x27c5c4?{'count':_0x42f975,'rows':_0x27c5c4}:null;}})['then'](respondWithResult(_0xd40b97,null))['catch'](handleError(_0xd40b97,null));};exports[_0x96fd('0x4a')]=function(_0x9df5a8,_0x279e2,_0x1a1882){var _0x290cc7={};var _0x254b37={};var _0x1087ca;var _0x353fd0;return db[_0x96fd('0x29')]['findOne']({'where':{'id':_0x9df5a8[_0x96fd('0x3d')]['id']}})[_0x96fd('0x23')](handleEntityNotFound(_0x279e2,null))[_0x96fd('0x23')](function(_0x351b7b){if(_0x351b7b){_0x1087ca=_0x351b7b;_0x254b37[_0x96fd('0x2b')]=_[_0x96fd('0x2d')](db['ZendeskField'][_0x96fd('0x3e')]);_0x254b37[_0x96fd('0x2c')]=_[_0x96fd('0x2d')](_0x9df5a8[_0x96fd('0x2c')]);_0x254b37[_0x96fd('0x2e')]=_['intersection'](_0x254b37[_0x96fd('0x2b')],_0x254b37[_0x96fd('0x2c')]);_0x290cc7[_0x96fd('0x31')]=_[_0x96fd('0x2f')](_0x254b37[_0x96fd('0x2b')],qs['fields'](_0x9df5a8[_0x96fd('0x2c')][_0x96fd('0x30')]));_0x290cc7[_0x96fd('0x31')]=_0x290cc7[_0x96fd('0x31')][_0x96fd('0x3f')]?_0x290cc7[_0x96fd('0x31')]:_0x254b37['model'];_0x290cc7[_0x96fd('0x47')]=qs[_0x96fd('0x34')](_0x9df5a8['query'][_0x96fd('0x34')]);_0x290cc7[_0x96fd('0x36')]=qs[_0x96fd('0x2e')](_[_0x96fd('0x48')](_0x9df5a8[_0x96fd('0x2c')],_0x254b37[_0x96fd('0x2e')]));if(_0x9df5a8[_0x96fd('0x2c')][_0x96fd('0x35')]){_0x290cc7[_0x96fd('0x36')]=_[_0x96fd('0x37')](_0x290cc7[_0x96fd('0x36')],{'$or':_[_0x96fd('0x28')](_0x290cc7[_0x96fd('0x31')],function(_0x553d13){var _0x367585={};_0x367585[_0x553d13]={'$like':'%'+_0x9df5a8[_0x96fd('0x2c')][_0x96fd('0x35')]+'%'};return _0x367585;})});}_0x290cc7=_[_0x96fd('0x37')]({},_0x290cc7,_0x9df5a8[_0x96fd('0x40')]);return _0x1087ca[_0x96fd('0x4a')](_0x290cc7);}})[_0x96fd('0x23')](function(_0x138b43){if(_0x138b43){_0x353fd0=_0x138b43[_0x96fd('0x3f')];if(!_0x9df5a8['query'][_0x96fd('0x32')]('nolimit')){_0x290cc7[_0x96fd('0x1a')]=qs['limit'](_0x9df5a8['query']['limit']);_0x290cc7['offset']=qs[_0x96fd('0x19')](_0x9df5a8['query'][_0x96fd('0x19')]);}return _0x1087ca['getDescriptions'](_0x290cc7);}})[_0x96fd('0x23')](function(_0x9cbacf){if(_0x9cbacf){return _0x9cbacf?{'count':_0x353fd0,'rows':_0x9cbacf}:null;}})[_0x96fd('0x23')](respondWithResult(_0x279e2,null))[_0x96fd('0x3b')](handleError(_0x279e2,null));};exports['getTags']=function(_0x508416,_0x570fa7,_0x220a8f){var _0x1536b8={};var _0x475f35={};var _0x5c51aa;var _0x94740d;return db[_0x96fd('0x29')][_0x96fd('0x45')]({'where':{'id':_0x508416['params']['id']}})[_0x96fd('0x23')](handleEntityNotFound(_0x570fa7,null))[_0x96fd('0x23')](function(_0x3da834){if(_0x3da834){_0x5c51aa=_0x3da834;_0x475f35[_0x96fd('0x2b')]=_['keys'](db[_0x96fd('0x4b')][_0x96fd('0x3e')]);_0x475f35['query']=_[_0x96fd('0x2d')](_0x508416[_0x96fd('0x2c')]);_0x475f35[_0x96fd('0x2e')]=_['intersection'](_0x475f35[_0x96fd('0x2b')],_0x475f35[_0x96fd('0x2c')]);_0x1536b8['attributes']=_[_0x96fd('0x2f')](_0x475f35[_0x96fd('0x2b')],qs[_0x96fd('0x30')](_0x508416[_0x96fd('0x2c')][_0x96fd('0x30')]));_0x1536b8[_0x96fd('0x31')]=_0x1536b8['attributes'][_0x96fd('0x3f')]?_0x1536b8[_0x96fd('0x31')]:_0x475f35['model'];_0x1536b8['order']=qs[_0x96fd('0x34')](_0x508416[_0x96fd('0x2c')]['sort']);_0x1536b8['where']=qs[_0x96fd('0x2e')](_['pick'](_0x508416[_0x96fd('0x2c')],_0x475f35[_0x96fd('0x2e')]));if(_0x508416[_0x96fd('0x2c')][_0x96fd('0x35')]){_0x1536b8[_0x96fd('0x36')]=_['merge'](_0x1536b8[_0x96fd('0x36')],{'$or':_[_0x96fd('0x28')](_0x1536b8[_0x96fd('0x31')],function(_0x54aea0){var _0x10d149={};_0x10d149[_0x54aea0]={'$like':'%'+_0x508416[_0x96fd('0x2c')]['filter']+'%'};return _0x10d149;})});}_0x1536b8=_[_0x96fd('0x37')]({},_0x1536b8,_0x508416[_0x96fd('0x40')]);return _0x5c51aa[_0x96fd('0x4c')](_0x1536b8);}})['then'](function(_0x127ecf){if(_0x127ecf){_0x94740d=_0x127ecf['length'];if(!_0x508416[_0x96fd('0x2c')][_0x96fd('0x32')](_0x96fd('0x33'))){_0x1536b8[_0x96fd('0x1a')]=qs[_0x96fd('0x1a')](_0x508416['query']['limit']);_0x1536b8[_0x96fd('0x19')]=qs[_0x96fd('0x19')](_0x508416[_0x96fd('0x2c')][_0x96fd('0x19')]);}return _0x5c51aa[_0x96fd('0x4c')](_0x1536b8);}})[_0x96fd('0x23')](function(_0xafcdaf){if(_0xafcdaf){return _0xafcdaf?{'count':_0x94740d,'rows':_0xafcdaf}:null;}})['then'](respondWithResult(_0x570fa7,null))[_0x96fd('0x3b')](handleError(_0x570fa7,null));};exports[_0x96fd('0x4d')]=function(_0x5adfc6,_0x4ebb11,_0x384c65){if(_0x5adfc6[_0x96fd('0x43')]['id']){delete _0x5adfc6[_0x96fd('0x43')]['id'];}return db[_0x96fd('0x29')][_0x96fd('0x45')]({'where':{'id':_0x5adfc6['params']['id']}})['then'](handleEntityNotFound(_0x4ebb11,null))[_0x96fd('0x23')](function(_0x1ced9e){if(_0x1ced9e){return _0x1ced9e[_0x96fd('0x4d')](_0x5adfc6[_0x96fd('0x43')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4ebb11,null))[_0x96fd('0x3b')](handleError(_0x4ebb11,null));}; \ No newline at end of file +var _0x18c7=['pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','ZendeskField','hasOwnProperty','getSubjects','order','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where'];(function(_0x589c5d,_0x3b6d37){var _0x1f2c6d=function(_0x1d2d24){while(--_0x1d2d24){_0x589c5d['push'](_0x589c5d['shift']());}};_0x1f2c6d(++_0x3b6d37);}(_0x18c7,0x116));var _0x718c=function(_0x5d79a5,_0x23262b){_0x5d79a5=_0x5d79a5-0x0;var _0x3c7ec6=_0x18c7[_0x5d79a5];return _0x3c7ec6;};'use strict';var emlformat=require(_0x718c('0x0'));var rimraf=require(_0x718c('0x1'));var zipdir=require(_0x718c('0x2'));var jsonpatch=require(_0x718c('0x3'));var rp=require(_0x718c('0x4'));var moment=require(_0x718c('0x5'));var BPromise=require(_0x718c('0x6'));var Mustache=require(_0x718c('0x7'));var util=require(_0x718c('0x8'));var path=require('path');var sox=require(_0x718c('0x9'));var csv=require(_0x718c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x718c('0xb'));var squel=require('squel');var crypto=require(_0x718c('0xc'));var jsforce=require(_0x718c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x718c('0xe'));var Papa=require(_0x718c('0xf'));var Redis=require(_0x718c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x718c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x718c('0x12'));var logger=require(_0x718c('0x13'))(_0x718c('0x14'));var utils=require(_0x718c('0x15'));var config=require(_0x718c('0x16'));var licenseUtil=require(_0x718c('0x17'));var db=require(_0x718c('0x18'))['db'];function respondWithStatusCode(_0x41f0a9,_0x354b3e){_0x354b3e=_0x354b3e||0xcc;return function(_0x673a7a){if(_0x673a7a){return _0x41f0a9[_0x718c('0x19')](_0x354b3e);}return _0x41f0a9[_0x718c('0x1a')](_0x354b3e)['end']();};}function respondWithResult(_0x52d955,_0x15030f){_0x15030f=_0x15030f||0xc8;return function(_0x2b1958){if(_0x2b1958){return _0x52d955[_0x718c('0x1a')](_0x15030f)['json'](_0x2b1958);}};}function respondWithFilteredResult(_0x138c9f,_0x7a5368){return function(_0x257dd1){if(_0x257dd1){var _0x4e42e9=typeof _0x7a5368[_0x718c('0x1b')]===_0x718c('0x1c')&&typeof _0x7a5368['limit']===_0x718c('0x1c');var _0x5dff61=_0x257dd1[_0x718c('0x1d')];var _0x17173f=_0x4e42e9?0x0:_0x7a5368['offset'];var _0x24ceb6=_0x4e42e9?_0x257dd1['count']:_0x7a5368[_0x718c('0x1b')]+_0x7a5368[_0x718c('0x1e')];var _0x362db1;if(_0x24ceb6>=_0x5dff61){_0x24ceb6=_0x5dff61;_0x362db1=0xc8;}else{_0x362db1=0xce;}_0x138c9f['status'](_0x362db1);return _0x138c9f[_0x718c('0x1f')](_0x718c('0x20'),_0x17173f+'-'+_0x24ceb6+'/'+_0x5dff61)[_0x718c('0x21')](_0x257dd1);}return null;};}function patchUpdates(_0x206771){return function(_0x1dda66){try{jsonpatch[_0x718c('0x22')](_0x1dda66,_0x206771,!![]);}catch(_0x4afe98){return BPromise['reject'](_0x4afe98);}return _0x1dda66[_0x718c('0x23')]();};}function saveUpdates(_0x2bc86c,_0x503c14){return function(_0x3647ad){if(_0x3647ad){return _0x3647ad[_0x718c('0x24')](_0x2bc86c)[_0x718c('0x25')](function(_0x20102c){return _0x20102c;});}return null;};}function removeEntity(_0x43f74a,_0x167822){return function(_0xc6d976){if(_0xc6d976){return _0xc6d976[_0x718c('0x26')]()[_0x718c('0x25')](function(){_0x43f74a[_0x718c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15437e,_0x781d40){return function(_0x23f6a1){if(!_0x23f6a1){_0x15437e[_0x718c('0x19')](0x194);}return _0x23f6a1;};}function handleError(_0x94b314,_0x708381){_0x708381=_0x708381||0x1f4;return function(_0x51179c){logger['error'](_0x51179c[_0x718c('0x27')]);if(_0x51179c['name']){delete _0x51179c[_0x718c('0x28')];}_0x94b314['status'](_0x708381)[_0x718c('0x29')](_0x51179c);};}exports[_0x718c('0x2a')]=function(_0x11c725,_0x440016){var _0x3077ec={},_0x5e0304={},_0x2d8e68={'count':0x0,'rows':[]};var _0x458929=_['map'](db[_0x718c('0x2b')][_0x718c('0x2c')],function(_0x2674da){return{'name':_0x2674da[_0x718c('0x2d')],'type':_0x2674da['type']['key']};});_0x5e0304[_0x718c('0x2e')]=_[_0x718c('0x2f')](_0x458929,_0x718c('0x28'));_0x5e0304[_0x718c('0x30')]=_[_0x718c('0x31')](_0x11c725[_0x718c('0x30')]);_0x5e0304[_0x718c('0x32')]=_[_0x718c('0x33')](_0x5e0304[_0x718c('0x2e')],_0x5e0304[_0x718c('0x30')]);_0x3077ec[_0x718c('0x34')]=_['intersection'](_0x5e0304[_0x718c('0x2e')],qs[_0x718c('0x35')](_0x11c725['query'][_0x718c('0x35')]));_0x3077ec[_0x718c('0x34')]=_0x3077ec['attributes'][_0x718c('0x36')]?_0x3077ec[_0x718c('0x34')]:_0x5e0304[_0x718c('0x2e')];if(!_0x11c725[_0x718c('0x30')]['hasOwnProperty'](_0x718c('0x37'))){_0x3077ec[_0x718c('0x1e')]=qs[_0x718c('0x1e')](_0x11c725[_0x718c('0x30')]['limit']);_0x3077ec[_0x718c('0x1b')]=qs[_0x718c('0x1b')](_0x11c725[_0x718c('0x30')][_0x718c('0x1b')]);}_0x3077ec['order']=qs[_0x718c('0x38')](_0x11c725[_0x718c('0x30')][_0x718c('0x38')]);_0x3077ec[_0x718c('0x39')]=qs[_0x718c('0x32')](_[_0x718c('0x3a')](_0x11c725['query'],_0x5e0304[_0x718c('0x32')]),_0x458929);if(_0x11c725['query'][_0x718c('0x3b')]){_0x3077ec['where']=_['merge'](_0x3077ec[_0x718c('0x39')],{'$or':_['map'](_0x458929,function(_0x4f01f8){if(_0x4f01f8[_0x718c('0x3c')]!=='VIRTUAL'){var _0x47d400={};_0x47d400[_0x4f01f8[_0x718c('0x28')]]={'$like':'%'+_0x11c725[_0x718c('0x30')][_0x718c('0x3b')]+'%'};return _0x47d400;}})});}_0x3077ec=_[_0x718c('0x3d')]({},_0x3077ec,_0x11c725[_0x718c('0x3e')]);var _0x508bdf={'where':_0x3077ec['where']};return db['ZendeskConfiguration']['count'](_0x508bdf)[_0x718c('0x25')](function(_0xcd99ba){_0x2d8e68[_0x718c('0x1d')]=_0xcd99ba;if(_0x11c725[_0x718c('0x30')][_0x718c('0x3f')]){_0x3077ec[_0x718c('0x40')]=[{'all':!![]}];}return db[_0x718c('0x2b')][_0x718c('0x41')](_0x3077ec);})[_0x718c('0x25')](function(_0x2131d8){_0x2d8e68[_0x718c('0x42')]=_0x2131d8;return _0x2d8e68;})[_0x718c('0x25')](respondWithFilteredResult(_0x440016,_0x3077ec))[_0x718c('0x43')](handleError(_0x440016,null));};exports[_0x718c('0x44')]=function(_0x13c6b6,_0xe7c5c9){var _0x278418={'raw':![],'where':{'id':_0x13c6b6[_0x718c('0x45')]['id']}},_0xc3d43={};_0xc3d43[_0x718c('0x2e')]=_[_0x718c('0x31')](db['ZendeskConfiguration'][_0x718c('0x2c')]);_0xc3d43['query']=_[_0x718c('0x31')](_0x13c6b6['query']);_0xc3d43[_0x718c('0x32')]=_[_0x718c('0x33')](_0xc3d43[_0x718c('0x2e')],_0xc3d43[_0x718c('0x30')]);_0x278418[_0x718c('0x34')]=_[_0x718c('0x33')](_0xc3d43['model'],qs[_0x718c('0x35')](_0x13c6b6[_0x718c('0x30')][_0x718c('0x35')]));_0x278418[_0x718c('0x34')]=_0x278418['attributes'][_0x718c('0x36')]?_0x278418[_0x718c('0x34')]:_0xc3d43['model'];if(_0x13c6b6['query'][_0x718c('0x3f')]){_0x278418[_0x718c('0x40')]=[{'all':!![]}];}_0x278418=_['merge']({},_0x278418,_0x13c6b6[_0x718c('0x3e')]);return db['ZendeskConfiguration'][_0x718c('0x46')](_0x278418)['then'](handleEntityNotFound(_0xe7c5c9,null))[_0x718c('0x25')](respondWithResult(_0xe7c5c9,null))[_0x718c('0x43')](handleError(_0xe7c5c9,null));};exports['create']=function(_0x1b1dc9,_0x28c043){return db['ZendeskConfiguration'][_0x718c('0x47')](_0x1b1dc9[_0x718c('0x48')],{})[_0x718c('0x25')](respondWithResult(_0x28c043,0xc9))['catch'](handleError(_0x28c043,null));};exports['update']=function(_0x4ecf9e,_0x3e9a5c){if(_0x4ecf9e[_0x718c('0x48')]['id']){delete _0x4ecf9e['body']['id'];}return db[_0x718c('0x2b')][_0x718c('0x46')]({'where':{'id':_0x4ecf9e['params']['id']}})[_0x718c('0x25')](handleEntityNotFound(_0x3e9a5c,null))[_0x718c('0x25')](saveUpdates(_0x4ecf9e['body'],null))[_0x718c('0x25')](respondWithResult(_0x3e9a5c,null))[_0x718c('0x43')](handleError(_0x3e9a5c,null));};exports['destroy']=function(_0x2eb2e3,_0x3e1edd){return db[_0x718c('0x2b')][_0x718c('0x46')]({'where':{'id':_0x2eb2e3[_0x718c('0x45')]['id']}})[_0x718c('0x25')](handleEntityNotFound(_0x3e1edd,null))[_0x718c('0x25')](removeEntity(_0x3e1edd,null))[_0x718c('0x43')](handleError(_0x3e1edd,null));};exports[_0x718c('0x49')]=function(_0x182277,_0x5804db,_0x216ae0){var _0x302cf1={};var _0x26d77e={};var _0x5ceb31;var _0x24050e;return db[_0x718c('0x2b')]['findOne']({'where':{'id':_0x182277[_0x718c('0x45')]['id']}})['then'](handleEntityNotFound(_0x5804db,null))[_0x718c('0x25')](function(_0xa769f6){if(_0xa769f6){_0x5ceb31=_0xa769f6;_0x26d77e[_0x718c('0x2e')]=_['keys'](db[_0x718c('0x4a')][_0x718c('0x2c')]);_0x26d77e[_0x718c('0x30')]=_[_0x718c('0x31')](_0x182277['query']);_0x26d77e[_0x718c('0x32')]=_[_0x718c('0x33')](_0x26d77e[_0x718c('0x2e')],_0x26d77e[_0x718c('0x30')]);_0x302cf1[_0x718c('0x34')]=_[_0x718c('0x33')](_0x26d77e[_0x718c('0x2e')],qs[_0x718c('0x35')](_0x182277[_0x718c('0x30')][_0x718c('0x35')]));_0x302cf1['attributes']=_0x302cf1[_0x718c('0x34')][_0x718c('0x36')]?_0x302cf1[_0x718c('0x34')]:_0x26d77e[_0x718c('0x2e')];_0x302cf1['order']=qs['sort'](_0x182277[_0x718c('0x30')]['sort']);_0x302cf1[_0x718c('0x39')]=qs['filters'](_[_0x718c('0x3a')](_0x182277['query'],_0x26d77e[_0x718c('0x32')]));if(_0x182277[_0x718c('0x30')][_0x718c('0x3b')]){_0x302cf1[_0x718c('0x39')]=_[_0x718c('0x3d')](_0x302cf1[_0x718c('0x39')],{'$or':_[_0x718c('0x2f')](_0x302cf1[_0x718c('0x34')],function(_0x37aeff){var _0x3a4c86={};_0x3a4c86[_0x37aeff]={'$like':'%'+_0x182277[_0x718c('0x30')][_0x718c('0x3b')]+'%'};return _0x3a4c86;})});}_0x302cf1=_[_0x718c('0x3d')]({},_0x302cf1,_0x182277[_0x718c('0x3e')]);return _0x5ceb31[_0x718c('0x49')](_0x302cf1);}})[_0x718c('0x25')](function(_0x4faead){if(_0x4faead){_0x24050e=_0x4faead[_0x718c('0x36')];if(!_0x182277['query'][_0x718c('0x4b')](_0x718c('0x37'))){_0x302cf1[_0x718c('0x1e')]=qs[_0x718c('0x1e')](_0x182277[_0x718c('0x30')][_0x718c('0x1e')]);_0x302cf1[_0x718c('0x1b')]=qs[_0x718c('0x1b')](_0x182277[_0x718c('0x30')]['offset']);}return _0x5ceb31[_0x718c('0x49')](_0x302cf1);}})[_0x718c('0x25')](function(_0x4f3640){if(_0x4f3640){return _0x4f3640?{'count':_0x24050e,'rows':_0x4f3640}:null;}})[_0x718c('0x25')](respondWithResult(_0x5804db,null))[_0x718c('0x43')](handleError(_0x5804db,null));};exports[_0x718c('0x4c')]=function(_0x258d27,_0x50487b,_0x1547a5){var _0x4a3232={};var _0x55647c={};var _0x318f9e;var _0x4a93b7;return db[_0x718c('0x2b')]['findOne']({'where':{'id':_0x258d27[_0x718c('0x45')]['id']}})['then'](handleEntityNotFound(_0x50487b,null))[_0x718c('0x25')](function(_0x3049bf){if(_0x3049bf){_0x318f9e=_0x3049bf;_0x55647c[_0x718c('0x2e')]=_['keys'](db[_0x718c('0x4a')]['rawAttributes']);_0x55647c[_0x718c('0x30')]=_['keys'](_0x258d27['query']);_0x55647c[_0x718c('0x32')]=_[_0x718c('0x33')](_0x55647c[_0x718c('0x2e')],_0x55647c[_0x718c('0x30')]);_0x4a3232[_0x718c('0x34')]=_[_0x718c('0x33')](_0x55647c[_0x718c('0x2e')],qs[_0x718c('0x35')](_0x258d27[_0x718c('0x30')][_0x718c('0x35')]));_0x4a3232[_0x718c('0x34')]=_0x4a3232[_0x718c('0x34')][_0x718c('0x36')]?_0x4a3232[_0x718c('0x34')]:_0x55647c['model'];_0x4a3232[_0x718c('0x4d')]=qs[_0x718c('0x38')](_0x258d27['query']['sort']);_0x4a3232[_0x718c('0x39')]=qs['filters'](_['pick'](_0x258d27[_0x718c('0x30')],_0x55647c[_0x718c('0x32')]));if(_0x258d27[_0x718c('0x30')][_0x718c('0x3b')]){_0x4a3232['where']=_[_0x718c('0x3d')](_0x4a3232[_0x718c('0x39')],{'$or':_[_0x718c('0x2f')](_0x4a3232[_0x718c('0x34')],function(_0x404537){var _0xec3be7={};_0xec3be7[_0x404537]={'$like':'%'+_0x258d27['query'][_0x718c('0x3b')]+'%'};return _0xec3be7;})});}_0x4a3232=_[_0x718c('0x3d')]({},_0x4a3232,_0x258d27['options']);return _0x318f9e[_0x718c('0x4c')](_0x4a3232);}})['then'](function(_0x55139e){if(_0x55139e){_0x4a93b7=_0x55139e[_0x718c('0x36')];if(!_0x258d27[_0x718c('0x30')][_0x718c('0x4b')]('nolimit')){_0x4a3232[_0x718c('0x1e')]=qs[_0x718c('0x1e')](_0x258d27[_0x718c('0x30')][_0x718c('0x1e')]);_0x4a3232[_0x718c('0x1b')]=qs[_0x718c('0x1b')](_0x258d27[_0x718c('0x30')]['offset']);}return _0x318f9e[_0x718c('0x4c')](_0x4a3232);}})[_0x718c('0x25')](function(_0x189e20){if(_0x189e20){return _0x189e20?{'count':_0x4a93b7,'rows':_0x189e20}:null;}})[_0x718c('0x25')](respondWithResult(_0x50487b,null))[_0x718c('0x43')](handleError(_0x50487b,null));};exports[_0x718c('0x4e')]=function(_0x2ade62,_0x52f857,_0x5e2bdb){var _0x2c3115={};var _0x36bd98={};var _0x4edc4b;var _0x163c30;return db[_0x718c('0x2b')]['findOne']({'where':{'id':_0x2ade62[_0x718c('0x45')]['id']}})[_0x718c('0x25')](handleEntityNotFound(_0x52f857,null))[_0x718c('0x25')](function(_0x2d196e){if(_0x2d196e){_0x4edc4b=_0x2d196e;_0x36bd98[_0x718c('0x2e')]=_[_0x718c('0x31')](db['ZendeskField'][_0x718c('0x2c')]);_0x36bd98[_0x718c('0x30')]=_[_0x718c('0x31')](_0x2ade62[_0x718c('0x30')]);_0x36bd98[_0x718c('0x32')]=_[_0x718c('0x33')](_0x36bd98['model'],_0x36bd98[_0x718c('0x30')]);_0x2c3115[_0x718c('0x34')]=_['intersection'](_0x36bd98[_0x718c('0x2e')],qs[_0x718c('0x35')](_0x2ade62[_0x718c('0x30')][_0x718c('0x35')]));_0x2c3115[_0x718c('0x34')]=_0x2c3115[_0x718c('0x34')]['length']?_0x2c3115[_0x718c('0x34')]:_0x36bd98[_0x718c('0x2e')];_0x2c3115[_0x718c('0x4d')]=qs['sort'](_0x2ade62[_0x718c('0x30')][_0x718c('0x38')]);_0x2c3115[_0x718c('0x39')]=qs[_0x718c('0x32')](_['pick'](_0x2ade62[_0x718c('0x30')],_0x36bd98[_0x718c('0x32')]));if(_0x2ade62[_0x718c('0x30')][_0x718c('0x3b')]){_0x2c3115[_0x718c('0x39')]=_['merge'](_0x2c3115[_0x718c('0x39')],{'$or':_['map'](_0x2c3115['attributes'],function(_0x19d2f0){var _0x602c53={};_0x602c53[_0x19d2f0]={'$like':'%'+_0x2ade62[_0x718c('0x30')][_0x718c('0x3b')]+'%'};return _0x602c53;})});}_0x2c3115=_[_0x718c('0x3d')]({},_0x2c3115,_0x2ade62[_0x718c('0x3e')]);return _0x4edc4b[_0x718c('0x4e')](_0x2c3115);}})[_0x718c('0x25')](function(_0x326b25){if(_0x326b25){_0x163c30=_0x326b25[_0x718c('0x36')];if(!_0x2ade62[_0x718c('0x30')][_0x718c('0x4b')](_0x718c('0x37'))){_0x2c3115[_0x718c('0x1e')]=qs[_0x718c('0x1e')](_0x2ade62[_0x718c('0x30')][_0x718c('0x1e')]);_0x2c3115[_0x718c('0x1b')]=qs[_0x718c('0x1b')](_0x2ade62[_0x718c('0x30')][_0x718c('0x1b')]);}return _0x4edc4b['getDescriptions'](_0x2c3115);}})[_0x718c('0x25')](function(_0x1b3bd8){if(_0x1b3bd8){return _0x1b3bd8?{'count':_0x163c30,'rows':_0x1b3bd8}:null;}})['then'](respondWithResult(_0x52f857,null))['catch'](handleError(_0x52f857,null));};exports[_0x718c('0x4f')]=function(_0x37cc83,_0x35e933,_0x2902e0){var _0x5b887f={};var _0x1c5ba3={};var _0x787002;var _0x211870;return db['ZendeskConfiguration'][_0x718c('0x50')]({'where':{'id':_0x37cc83[_0x718c('0x45')]['id']}})['then'](handleEntityNotFound(_0x35e933,null))[_0x718c('0x25')](function(_0x24812f){if(_0x24812f){_0x787002=_0x24812f;_0x1c5ba3[_0x718c('0x2e')]=_[_0x718c('0x31')](db[_0x718c('0x51')][_0x718c('0x2c')]);_0x1c5ba3[_0x718c('0x30')]=_[_0x718c('0x31')](_0x37cc83[_0x718c('0x30')]);_0x1c5ba3[_0x718c('0x32')]=_['intersection'](_0x1c5ba3[_0x718c('0x2e')],_0x1c5ba3[_0x718c('0x30')]);_0x5b887f[_0x718c('0x34')]=_[_0x718c('0x33')](_0x1c5ba3[_0x718c('0x2e')],qs[_0x718c('0x35')](_0x37cc83[_0x718c('0x30')][_0x718c('0x35')]));_0x5b887f[_0x718c('0x34')]=_0x5b887f[_0x718c('0x34')][_0x718c('0x36')]?_0x5b887f['attributes']:_0x1c5ba3[_0x718c('0x2e')];_0x5b887f['order']=qs[_0x718c('0x38')](_0x37cc83[_0x718c('0x30')][_0x718c('0x38')]);_0x5b887f['where']=qs[_0x718c('0x32')](_[_0x718c('0x3a')](_0x37cc83[_0x718c('0x30')],_0x1c5ba3['filters']));if(_0x37cc83[_0x718c('0x30')]['filter']){_0x5b887f[_0x718c('0x39')]=_['merge'](_0x5b887f[_0x718c('0x39')],{'$or':_['map'](_0x5b887f[_0x718c('0x34')],function(_0x38eb4e){var _0x1b3f4e={};_0x1b3f4e[_0x38eb4e]={'$like':'%'+_0x37cc83[_0x718c('0x30')][_0x718c('0x3b')]+'%'};return _0x1b3f4e;})});}_0x5b887f=_[_0x718c('0x3d')]({},_0x5b887f,_0x37cc83[_0x718c('0x3e')]);return _0x787002[_0x718c('0x4f')](_0x5b887f);}})[_0x718c('0x25')](function(_0x113cb9){if(_0x113cb9){_0x211870=_0x113cb9[_0x718c('0x36')];if(!_0x37cc83['query'][_0x718c('0x4b')](_0x718c('0x37'))){_0x5b887f[_0x718c('0x1e')]=qs['limit'](_0x37cc83['query'][_0x718c('0x1e')]);_0x5b887f['offset']=qs[_0x718c('0x1b')](_0x37cc83[_0x718c('0x30')][_0x718c('0x1b')]);}return _0x787002[_0x718c('0x4f')](_0x5b887f);}})[_0x718c('0x25')](function(_0x3fa91c){if(_0x3fa91c){return _0x3fa91c?{'count':_0x211870,'rows':_0x3fa91c}:null;}})['then'](respondWithResult(_0x35e933,null))[_0x718c('0x43')](handleError(_0x35e933,null));};exports[_0x718c('0x52')]=function(_0x3b6332,_0xdfd4da,_0x59e6e9){if(_0x3b6332[_0x718c('0x48')]['id']){delete _0x3b6332[_0x718c('0x48')]['id'];}return db[_0x718c('0x2b')][_0x718c('0x50')]({'where':{'id':_0x3b6332['params']['id']}})[_0x718c('0x25')](handleEntityNotFound(_0xdfd4da,null))[_0x718c('0x25')](function(_0x3a6dd9){if(_0x3a6dd9){return _0x3a6dd9[_0x718c('0x52')](_0x3b6332[_0x718c('0x48')][_0x718c('0x53')]||[]);}return null;})[_0x718c('0x25')](respondWithResult(_0xdfd4da,null))[_0x718c('0x43')](handleError(_0xdfd4da,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7ea8d82..5181f92 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 _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x5763bf,_0x4d1df5){var _0xfa90d1=function(_0x24a9eb){while(--_0x24a9eb){_0x5763bf['push'](_0x5763bf['shift']());}};_0xfa90d1(++_0x4d1df5);}(_0xaebd,0x1e9));var _0xdaeb=function(_0xbb139f,_0x5f1d3c){_0xbb139f=_0xbb139f-0x0;var _0x5c0809=_0xaebd[_0xbb139f];return _0x5c0809;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x588906,_0xcbb563){var _0x358f21=function(_0x3ab376){while(--_0x3ab376){_0x588906['push'](_0x588906['shift']());}};_0x358f21(++_0xcbb563);}(_0x8603,0x190));var _0x3860=function(_0x495eba,_0x523820){_0x495eba=_0x495eba-0x0;var _0x564c76=_0x8603[_0x495eba];return _0x564c76;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index bd68dea..ee4e0f0 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 _0x5ffa=['result','catch','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','http','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x79324e,_0x4af67e){var _0x555666=function(_0x15d9c2){while(--_0x15d9c2){_0x79324e['push'](_0x79324e['shift']());}};_0x555666(++_0x4af67e);}(_0x5ffa,0x16a));var _0xa5ff=function(_0x84bf4d,_0x2d6bba){_0x84bf4d=_0x84bf4d-0x0;var _0x93769e=_0x5ffa[_0x84bf4d];return _0x93769e;};'use strict';var _=require('lodash');var util=require(_0xa5ff('0x0'));var moment=require(_0xa5ff('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5ff('0x2'));var fs=require('fs');var Redis=require(_0xa5ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5ff('0x4'))('rpc');var config=require(_0xa5ff('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa5ff('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1231df,_0x458ac6,_0xa070b8){return new BPromise(function(_0x13c364,_0x1a2cf6){return client['request'](_0x1231df,_0xa070b8)[_0xa5ff('0x7')](function(_0x18cbef){logger[_0xa5ff('0x8')]('ZendeskConfiguration,\x20%s,\x20%s',_0x458ac6,_0xa5ff('0x9'));logger['debug'](_0xa5ff('0xa'),_0x458ac6,_0xa5ff('0x9'),JSON[_0xa5ff('0xb')](_0x18cbef));if(_0x18cbef['error']){if(_0x18cbef[_0xa5ff('0xc')][_0xa5ff('0xd')]===0x1f4){logger[_0xa5ff('0xc')](_0xa5ff('0xe'),_0x458ac6,_0x18cbef[_0xa5ff('0xc')][_0xa5ff('0xf')]);return _0x1a2cf6(_0x18cbef['error'][_0xa5ff('0xf')]);}logger[_0xa5ff('0xc')](_0xa5ff('0xe'),_0x458ac6,_0x18cbef[_0xa5ff('0xc')][_0xa5ff('0xf')]);return _0x13c364(_0x18cbef['error'][_0xa5ff('0xf')]);}else{logger[_0xa5ff('0x8')](_0xa5ff('0xe'),_0x458ac6,_0xa5ff('0x9'));_0x13c364(_0x18cbef[_0xa5ff('0x10')][_0xa5ff('0xf')]);}})[_0xa5ff('0x11')](function(_0x5d05d1){logger[_0xa5ff('0xc')](_0xa5ff('0xe'),_0x458ac6,_0x5d05d1);_0x1a2cf6(_0x5d05d1);});});} \ No newline at end of file +var _0x4fed=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2113d8,_0x5a3232){var _0x1c8538=function(_0x4fc12d){while(--_0x4fc12d){_0x2113d8['push'](_0x2113d8['shift']());}};_0x1c8538(++_0x5a3232);}(_0x4fed,0x12f));var _0xd4fe=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x4fed[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0xd4fe('0x0'));var util=require('util');var moment=require(_0xd4fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xd4fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4fe('0x3'))['db'];var utils=require(_0xd4fe('0x4'));var logger=require(_0xd4fe('0x5'))('rpc');var config=require(_0xd4fe('0x6'));var jayson=require(_0xd4fe('0x7'));var client=jayson[_0xd4fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xff2733,_0x29de19,_0x3d9b82){return new BPromise(function(_0x1ff3ba,_0x41d953){return client[_0xd4fe('0x9')](_0xff2733,_0x3d9b82)[_0xd4fe('0xa')](function(_0x3ead36){logger[_0xd4fe('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29de19,'request\x20sent');logger[_0xd4fe('0xc')](_0xd4fe('0xd'),_0x29de19,_0xd4fe('0xe'),JSON[_0xd4fe('0xf')](_0x3ead36));if(_0x3ead36[_0xd4fe('0x10')]){if(_0x3ead36[_0xd4fe('0x10')][_0xd4fe('0x11')]===0x1f4){logger[_0xd4fe('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29de19,_0x3ead36[_0xd4fe('0x10')][_0xd4fe('0x12')]);return _0x41d953(_0x3ead36[_0xd4fe('0x10')][_0xd4fe('0x12')]);}logger[_0xd4fe('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29de19,_0x3ead36['error'][_0xd4fe('0x12')]);return _0x1ff3ba(_0x3ead36[_0xd4fe('0x10')][_0xd4fe('0x12')]);}else{logger['info'](_0xd4fe('0x13'),_0x29de19,'request\x20sent');_0x1ff3ba(_0x3ead36['result'][_0xd4fe('0x12')]);}})[_0xd4fe('0x14')](function(_0x26de86){logger[_0xd4fe('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29de19,_0x26de86);_0x41d953(_0x26de86);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 133283b..201e766 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 _0x7b69=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4a00f7,_0x5b8351){var _0x4ac3f4=function(_0x5ce2dc){while(--_0x5ce2dc){_0x4a00f7['push'](_0x4a00f7['shift']());}};_0x4ac3f4(++_0x5b8351);}(_0x7b69,0x9b));var _0x97b6=function(_0x1bcbd0,_0x46e061){_0x1bcbd0=_0x1bcbd0-0x0;var _0xcee627=_0x7b69[_0x1bcbd0];return _0xcee627;};'use strict';var multer=require('multer');var util=require(_0x97b6('0x0'));var path=require(_0x97b6('0x1'));var timeout=require(_0x97b6('0x2'));var express=require(_0x97b6('0x3'));var router=express['Router']();var fs_extra=require(_0x97b6('0x4'));var auth=require(_0x97b6('0x5'));var interaction=require(_0x97b6('0x6'));var config=require(_0x97b6('0x7'));var controller=require(_0x97b6('0x8'));router[_0x97b6('0x9')]('/',auth[_0x97b6('0xa')](),controller[_0x97b6('0xb')]);router[_0x97b6('0x9')]('/:id',auth[_0x97b6('0xa')](),controller[_0x97b6('0xc')]);router['post']('/',auth[_0x97b6('0xa')](),controller[_0x97b6('0xd')]);router[_0x97b6('0xe')]('/:id',auth[_0x97b6('0xa')](),controller[_0x97b6('0xf')]);router[_0x97b6('0x10')](_0x97b6('0x11'),auth[_0x97b6('0xa')](),controller[_0x97b6('0x12')]);module[_0x97b6('0x13')]=router; \ No newline at end of file +var _0xef44=['create','put','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x531fde,_0x33597c){var _0x28c7aa=function(_0x359fb6){while(--_0x359fb6){_0x531fde['push'](_0x531fde['shift']());}};_0x28c7aa(++_0x33597c);}(_0xef44,0x1ce));var _0x4ef4=function(_0x5a5a0d,_0x49dc6c){_0x5a5a0d=_0x5a5a0d-0x0;var _0x44c8a6=_0xef44[_0x5a5a0d];return _0x44c8a6;};'use strict';var multer=require(_0x4ef4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ef4('0x1'));var express=require(_0x4ef4('0x2'));var router=express[_0x4ef4('0x3')]();var fs_extra=require(_0x4ef4('0x4'));var auth=require(_0x4ef4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ef4('0x6'));var controller=require(_0x4ef4('0x7'));router[_0x4ef4('0x8')]('/',auth[_0x4ef4('0x9')](),controller[_0x4ef4('0xa')]);router[_0x4ef4('0x8')](_0x4ef4('0xb'),auth['isAuthenticated'](),controller[_0x4ef4('0xc')]);router[_0x4ef4('0xd')]('/',auth['isAuthenticated'](),controller[_0x4ef4('0xe')]);router[_0x4ef4('0xf')](_0x4ef4('0xb'),auth[_0x4ef4('0x9')](),controller['update']);router['delete'](_0x4ef4('0xb'),auth['isAuthenticated'](),controller[_0x4ef4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4d5a26f..58c7473 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 _0x00d5=['sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x00d5,0x172));var _0x500d=function(_0x7fc3bc,_0x32e792){_0x7fc3bc=_0x7fc3bc-0x0;var _0x8134d5=_0x00d5[_0x7fc3bc];return _0x8134d5;};'use strict';var Sequelize=require(_0x500d('0x0'));module[_0x500d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x500d('0x2'),_0x500d('0x3'),'customVariable',_0x500d('0x4'),_0x500d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x500d('0x6')]},'key':{'type':Sequelize[_0x500d('0x6')]},'keyType':{'type':Sequelize[_0x500d('0x7')]('string','variable',_0x500d('0x8'))},'keyContent':{'type':Sequelize[_0x500d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x500d('0x6')]},'customField':{'type':Sequelize[_0x500d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x607f=['BOOLEAN','sequelize','exports','variable','customVariable','picklist','string','STRING','ENUM'];(function(_0x2133a5,_0x221371){var _0x3065fa=function(_0x1acd5d){while(--_0x1acd5d){_0x2133a5['push'](_0x2133a5['shift']());}};_0x3065fa(++_0x221371);}(_0x607f,0x14e));var _0xf607=function(_0xe91974,_0x2c1424){_0xe91974=_0xe91974-0x0;var _0x56740e=_0x607f[_0xe91974];return _0x56740e;};'use strict';var Sequelize=require(_0xf607('0x0'));module[_0xf607('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf607('0x2'),_0xf607('0x3'),'keyValue',_0xf607('0x4')),'defaultValue':_0xf607('0x5')},'content':{'type':Sequelize[_0xf607('0x6')]},'key':{'type':Sequelize[_0xf607('0x6')]},'keyType':{'type':Sequelize[_0xf607('0x7')](_0xf607('0x5'),'variable',_0xf607('0x3'))},'keyContent':{'type':Sequelize[_0xf607('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf607('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf607('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 98f2f84..13826f3 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 _0x35ca=['../../config/license/util','sendStatus','json','offset','undefined','limit','status','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','then','rows','show','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3d4085,_0x7558d5){var _0x27a386=function(_0x6ed9d7){while(--_0x6ed9d7){_0x3d4085['push'](_0x3d4085['shift']());}};_0x27a386(++_0x7558d5);}(_0x35ca,0x10a));var _0xa35c=function(_0x84c76,_0x253c82){_0x84c76=_0x84c76-0x0;var _0x328f68=_0x35ca[_0x84c76];return _0x328f68;};'use strict';var emlformat=require(_0xa35c('0x0'));var rimraf=require(_0xa35c('0x1'));var zipdir=require(_0xa35c('0x2'));var jsonpatch=require(_0xa35c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa35c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa35c('0x5'));var sox=require('sox');var csv=require(_0xa35c('0x6'));var ejs=require(_0xa35c('0x7'));var fs=require('fs');var fs_extra=require(_0xa35c('0x8'));var _=require(_0xa35c('0x9'));var squel=require('squel');var crypto=require(_0xa35c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa35c('0x6'));var querystring=require(_0xa35c('0xb'));var Papa=require(_0xa35c('0xc'));var Redis=require(_0xa35c('0xd'));var authService=require(_0xa35c('0xe'));var qs=require(_0xa35c('0xf'));var as=require(_0xa35c('0x10'));var hardwareService=require(_0xa35c('0x11'));var logger=require(_0xa35c('0x12'))(_0xa35c('0x13'));var utils=require(_0xa35c('0x14'));var config=require(_0xa35c('0x15'));var licenseUtil=require(_0xa35c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4777fa,_0x238c36){_0x238c36=_0x238c36||0xcc;return function(_0x483a73){if(_0x483a73){return _0x4777fa[_0xa35c('0x17')](_0x238c36);}return _0x4777fa['status'](_0x238c36)['end']();};}function respondWithResult(_0x254470,_0x3d19d0){_0x3d19d0=_0x3d19d0||0xc8;return function(_0x4bac85){if(_0x4bac85){return _0x254470['status'](_0x3d19d0)[_0xa35c('0x18')](_0x4bac85);}};}function respondWithFilteredResult(_0x595c7f,_0x7463d5){return function(_0x2cb5ae){if(_0x2cb5ae){var _0x22439b=typeof _0x7463d5[_0xa35c('0x19')]===_0xa35c('0x1a')&&typeof _0x7463d5[_0xa35c('0x1b')]===_0xa35c('0x1a');var _0x228456=_0x2cb5ae['count'];var _0x9f761b=_0x22439b?0x0:_0x7463d5[_0xa35c('0x19')];var _0xdbfaae=_0x22439b?_0x2cb5ae['count']:_0x7463d5[_0xa35c('0x19')]+_0x7463d5['limit'];var _0x288dba;if(_0xdbfaae>=_0x228456){_0xdbfaae=_0x228456;_0x288dba=0xc8;}else{_0x288dba=0xce;}_0x595c7f[_0xa35c('0x1c')](_0x288dba);return _0x595c7f['set'](_0xa35c('0x1d'),_0x9f761b+'-'+_0xdbfaae+'/'+_0x228456)[_0xa35c('0x18')](_0x2cb5ae);}return null;};}function patchUpdates(_0x146419){return function(_0x337b8b){try{jsonpatch[_0xa35c('0x1e')](_0x337b8b,_0x146419,!![]);}catch(_0x560179){return BPromise[_0xa35c('0x1f')](_0x560179);}return _0x337b8b['save']();};}function saveUpdates(_0x3b3048,_0x198b12){return function(_0x2598c3){if(_0x2598c3){return _0x2598c3[_0xa35c('0x20')](_0x3b3048)['then'](function(_0x20dfc8){return _0x20dfc8;});}return null;};}function removeEntity(_0x1021c3,_0xa8baa2){return function(_0x4fb272){if(_0x4fb272){return _0x4fb272[_0xa35c('0x21')]()['then'](function(){_0x1021c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc980,_0x3c0623){return function(_0x59542e){if(!_0x59542e){_0x5bc980[_0xa35c('0x17')](0x194);}return _0x59542e;};}function handleError(_0x1ca421,_0x710ce3){_0x710ce3=_0x710ce3||0x1f4;return function(_0x24c215){logger[_0xa35c('0x22')](_0x24c215[_0xa35c('0x23')]);if(_0x24c215[_0xa35c('0x24')]){delete _0x24c215[_0xa35c('0x24')];}_0x1ca421[_0xa35c('0x1c')](_0x710ce3)[_0xa35c('0x25')](_0x24c215);};}exports[_0xa35c('0x26')]=function(_0x270eae,_0xc0fdea){var _0x5e57b0={},_0x21ac30={},_0xd4164f={'count':0x0,'rows':[]};var _0x4a22c2=_[_0xa35c('0x27')](db[_0xa35c('0x28')][_0xa35c('0x29')],function(_0x500715){return{'name':_0x500715[_0xa35c('0x2a')],'type':_0x500715[_0xa35c('0x2b')][_0xa35c('0x2c')]};});_0x21ac30[_0xa35c('0x2d')]=_[_0xa35c('0x27')](_0x4a22c2,'name');_0x21ac30[_0xa35c('0x2e')]=_[_0xa35c('0x2f')](_0x270eae[_0xa35c('0x2e')]);_0x21ac30[_0xa35c('0x30')]=_[_0xa35c('0x31')](_0x21ac30['model'],_0x21ac30['query']);_0x5e57b0[_0xa35c('0x32')]=_[_0xa35c('0x31')](_0x21ac30['model'],qs['fields'](_0x270eae[_0xa35c('0x2e')][_0xa35c('0x33')]));_0x5e57b0['attributes']=_0x5e57b0[_0xa35c('0x32')][_0xa35c('0x34')]?_0x5e57b0[_0xa35c('0x32')]:_0x21ac30[_0xa35c('0x2d')];if(!_0x270eae['query'][_0xa35c('0x35')](_0xa35c('0x36'))){_0x5e57b0['limit']=qs['limit'](_0x270eae['query'][_0xa35c('0x1b')]);_0x5e57b0[_0xa35c('0x19')]=qs[_0xa35c('0x19')](_0x270eae[_0xa35c('0x2e')][_0xa35c('0x19')]);}_0x5e57b0['order']=qs[_0xa35c('0x37')](_0x270eae['query'][_0xa35c('0x37')]);_0x5e57b0[_0xa35c('0x38')]=qs['filters'](_[_0xa35c('0x39')](_0x270eae[_0xa35c('0x2e')],_0x21ac30[_0xa35c('0x30')]),_0x4a22c2);if(_0x270eae['query'][_0xa35c('0x3a')]){_0x5e57b0[_0xa35c('0x38')]=_[_0xa35c('0x3b')](_0x5e57b0['where'],{'$or':_['map'](_0x4a22c2,function(_0xd1bb2c){if(_0xd1bb2c[_0xa35c('0x2b')]!=='VIRTUAL'){var _0x69a156={};_0x69a156[_0xd1bb2c[_0xa35c('0x24')]]={'$like':'%'+_0x270eae['query'][_0xa35c('0x3a')]+'%'};return _0x69a156;}})});}_0x5e57b0=_[_0xa35c('0x3b')]({},_0x5e57b0,_0x270eae[_0xa35c('0x3c')]);var _0x134d42={'where':_0x5e57b0['where']};return db[_0xa35c('0x28')][_0xa35c('0x3d')](_0x134d42)['then'](function(_0x26db32){_0xd4164f[_0xa35c('0x3d')]=_0x26db32;if(_0x270eae['query'][_0xa35c('0x3e')]){_0x5e57b0[_0xa35c('0x3f')]=[{'all':!![]}];}return db[_0xa35c('0x28')][_0xa35c('0x40')](_0x5e57b0);})[_0xa35c('0x41')](function(_0x4e17de){_0xd4164f[_0xa35c('0x42')]=_0x4e17de;return _0xd4164f;})['then'](respondWithFilteredResult(_0xc0fdea,_0x5e57b0))['catch'](handleError(_0xc0fdea,null));};exports[_0xa35c('0x43')]=function(_0x404f4d,_0x298d8b){var _0x2e7f4e={'raw':!![],'where':{'id':_0x404f4d['params']['id']}},_0x241a5c={};_0x241a5c[_0xa35c('0x2d')]=_[_0xa35c('0x2f')](db[_0xa35c('0x28')]['rawAttributes']);_0x241a5c['query']=_['keys'](_0x404f4d[_0xa35c('0x2e')]);_0x241a5c[_0xa35c('0x30')]=_[_0xa35c('0x31')](_0x241a5c[_0xa35c('0x2d')],_0x241a5c[_0xa35c('0x2e')]);_0x2e7f4e[_0xa35c('0x32')]=_[_0xa35c('0x31')](_0x241a5c[_0xa35c('0x2d')],qs[_0xa35c('0x33')](_0x404f4d[_0xa35c('0x2e')][_0xa35c('0x33')]));_0x2e7f4e['attributes']=_0x2e7f4e[_0xa35c('0x32')]['length']?_0x2e7f4e[_0xa35c('0x32')]:_0x241a5c[_0xa35c('0x2d')];if(_0x404f4d['query'][_0xa35c('0x3e')]){_0x2e7f4e[_0xa35c('0x3f')]=[{'all':!![]}];}_0x2e7f4e=_[_0xa35c('0x3b')]({},_0x2e7f4e,_0x404f4d[_0xa35c('0x3c')]);return db[_0xa35c('0x28')]['find'](_0x2e7f4e)[_0xa35c('0x41')](handleEntityNotFound(_0x298d8b,null))[_0xa35c('0x41')](respondWithResult(_0x298d8b,null))['catch'](handleError(_0x298d8b,null));};exports[_0xa35c('0x44')]=function(_0x3c8323,_0x2e2f65){return db[_0xa35c('0x28')][_0xa35c('0x44')](_0x3c8323['body'],{})['then'](respondWithResult(_0x2e2f65,0xc9))[_0xa35c('0x45')](handleError(_0x2e2f65,null));};exports[_0xa35c('0x20')]=function(_0x28b13c,_0x2f017f){if(_0x28b13c[_0xa35c('0x46')]['id']){delete _0x28b13c[_0xa35c('0x46')]['id'];}return db[_0xa35c('0x28')]['find']({'where':{'id':_0x28b13c[_0xa35c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f017f,null))[_0xa35c('0x41')](saveUpdates(_0x28b13c[_0xa35c('0x46')],null))[_0xa35c('0x41')](respondWithResult(_0x2f017f,null))[_0xa35c('0x45')](handleError(_0x2f017f,null));};exports[_0xa35c('0x21')]=function(_0x4be807,_0x41849a){return db['ZendeskField']['find']({'where':{'id':_0x4be807[_0xa35c('0x47')]['id']}})[_0xa35c('0x41')](handleEntityNotFound(_0x41849a,null))[_0xa35c('0x41')](removeEntity(_0x41849a,null))[_0xa35c('0x45')](handleError(_0x41849a,null));}; \ No newline at end of file +var _0xae8d=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZendeskField','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','find','destroy','zip-dir','fast-json-patch'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xae8d,0x94));var _0xdae8=function(_0x2deeee,_0x49d4fd){_0x2deeee=_0x2deeee-0x0;var _0x4d3a33=_0xae8d[_0x2deeee];return _0x4d3a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdae8('0x0'));var jsonpatch=require(_0xdae8('0x1'));var rp=require(_0xdae8('0x2'));var moment=require(_0xdae8('0x3'));var BPromise=require(_0xdae8('0x4'));var Mustache=require(_0xdae8('0x5'));var util=require(_0xdae8('0x6'));var path=require(_0xdae8('0x7'));var sox=require(_0xdae8('0x8'));var csv=require(_0xdae8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdae8('0xa'));var _=require(_0xdae8('0xb'));var squel=require(_0xdae8('0xc'));var crypto=require('crypto');var jsforce=require(_0xdae8('0xd'));var deskjs=require(_0xdae8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdae8('0xf'));var Papa=require(_0xdae8('0x10'));var Redis=require(_0xdae8('0x11'));var authService=require(_0xdae8('0x12'));var qs=require(_0xdae8('0x13'));var as=require(_0xdae8('0x14'));var hardwareService=require(_0xdae8('0x15'));var logger=require(_0xdae8('0x16'))(_0xdae8('0x17'));var utils=require(_0xdae8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdae8('0x19'));var db=require(_0xdae8('0x1a'))['db'];function respondWithStatusCode(_0x3872f8,_0x39bf2c){_0x39bf2c=_0x39bf2c||0xcc;return function(_0x2d0783){if(_0x2d0783){return _0x3872f8['sendStatus'](_0x39bf2c);}return _0x3872f8[_0xdae8('0x1b')](_0x39bf2c)[_0xdae8('0x1c')]();};}function respondWithResult(_0x31784e,_0x46a6ea){_0x46a6ea=_0x46a6ea||0xc8;return function(_0x1a20f5){if(_0x1a20f5){return _0x31784e[_0xdae8('0x1b')](_0x46a6ea)[_0xdae8('0x1d')](_0x1a20f5);}};}function respondWithFilteredResult(_0x2d1ab6,_0x301f67){return function(_0x5016af){if(_0x5016af){var _0x58e9ed=typeof _0x301f67[_0xdae8('0x1e')]===_0xdae8('0x1f')&&typeof _0x301f67[_0xdae8('0x20')]===_0xdae8('0x1f');var _0x13e266=_0x5016af[_0xdae8('0x21')];var _0x1a7d42=_0x58e9ed?0x0:_0x301f67[_0xdae8('0x1e')];var _0x1b4225=_0x58e9ed?_0x5016af['count']:_0x301f67[_0xdae8('0x1e')]+_0x301f67['limit'];var _0x514f5e;if(_0x1b4225>=_0x13e266){_0x1b4225=_0x13e266;_0x514f5e=0xc8;}else{_0x514f5e=0xce;}_0x2d1ab6[_0xdae8('0x1b')](_0x514f5e);return _0x2d1ab6['set'](_0xdae8('0x22'),_0x1a7d42+'-'+_0x1b4225+'/'+_0x13e266)[_0xdae8('0x1d')](_0x5016af);}return null;};}function patchUpdates(_0x3413c2){return function(_0x57e69c){try{jsonpatch['apply'](_0x57e69c,_0x3413c2,!![]);}catch(_0x2d7030){return BPromise[_0xdae8('0x23')](_0x2d7030);}return _0x57e69c[_0xdae8('0x24')]();};}function saveUpdates(_0x2aa4ac,_0x55945e){return function(_0x1d8003){if(_0x1d8003){return _0x1d8003[_0xdae8('0x25')](_0x2aa4ac)[_0xdae8('0x26')](function(_0x4986dd){return _0x4986dd;});}return null;};}function removeEntity(_0x11a090,_0x1293c4){return function(_0x461ca3){if(_0x461ca3){return _0x461ca3['destroy']()[_0xdae8('0x26')](function(){_0x11a090[_0xdae8('0x1b')](0xcc)[_0xdae8('0x1c')]();});}};}function handleEntityNotFound(_0x2c3831,_0x38de0b){return function(_0xadd91f){if(!_0xadd91f){_0x2c3831[_0xdae8('0x27')](0x194);}return _0xadd91f;};}function handleError(_0x1be877,_0x1fa137){_0x1fa137=_0x1fa137||0x1f4;return function(_0x1ce801){logger[_0xdae8('0x28')](_0x1ce801[_0xdae8('0x29')]);if(_0x1ce801[_0xdae8('0x2a')]){delete _0x1ce801[_0xdae8('0x2a')];}_0x1be877[_0xdae8('0x1b')](_0x1fa137)[_0xdae8('0x2b')](_0x1ce801);};}exports[_0xdae8('0x2c')]=function(_0x3f9401,_0x447246){var _0x2076c2={},_0x582f3a={},_0x487d24={'count':0x0,'rows':[]};var _0x4010b4=_[_0xdae8('0x2d')](db[_0xdae8('0x2e')]['rawAttributes'],function(_0x168c47){return{'name':_0x168c47[_0xdae8('0x2f')],'type':_0x168c47['type'][_0xdae8('0x30')]};});_0x582f3a[_0xdae8('0x31')]=_['map'](_0x4010b4,'name');_0x582f3a[_0xdae8('0x32')]=_[_0xdae8('0x33')](_0x3f9401[_0xdae8('0x32')]);_0x582f3a['filters']=_['intersection'](_0x582f3a[_0xdae8('0x31')],_0x582f3a['query']);_0x2076c2[_0xdae8('0x34')]=_[_0xdae8('0x35')](_0x582f3a[_0xdae8('0x31')],qs['fields'](_0x3f9401['query'][_0xdae8('0x36')]));_0x2076c2[_0xdae8('0x34')]=_0x2076c2[_0xdae8('0x34')]['length']?_0x2076c2['attributes']:_0x582f3a[_0xdae8('0x31')];if(!_0x3f9401['query'][_0xdae8('0x37')](_0xdae8('0x38'))){_0x2076c2['limit']=qs['limit'](_0x3f9401[_0xdae8('0x32')][_0xdae8('0x20')]);_0x2076c2['offset']=qs[_0xdae8('0x1e')](_0x3f9401[_0xdae8('0x32')][_0xdae8('0x1e')]);}_0x2076c2['order']=qs[_0xdae8('0x39')](_0x3f9401[_0xdae8('0x32')]['sort']);_0x2076c2[_0xdae8('0x3a')]=qs[_0xdae8('0x3b')](_[_0xdae8('0x3c')](_0x3f9401[_0xdae8('0x32')],_0x582f3a[_0xdae8('0x3b')]),_0x4010b4);if(_0x3f9401['query'][_0xdae8('0x3d')]){_0x2076c2['where']=_[_0xdae8('0x3e')](_0x2076c2[_0xdae8('0x3a')],{'$or':_['map'](_0x4010b4,function(_0x3ae529){if(_0x3ae529['type']!==_0xdae8('0x3f')){var _0x13eaa9={};_0x13eaa9[_0x3ae529[_0xdae8('0x2a')]]={'$like':'%'+_0x3f9401['query'][_0xdae8('0x3d')]+'%'};return _0x13eaa9;}})});}_0x2076c2=_['merge']({},_0x2076c2,_0x3f9401[_0xdae8('0x40')]);var _0x381b8a={'where':_0x2076c2[_0xdae8('0x3a')]};return db[_0xdae8('0x2e')][_0xdae8('0x21')](_0x381b8a)[_0xdae8('0x26')](function(_0x2cd7cf){_0x487d24[_0xdae8('0x21')]=_0x2cd7cf;if(_0x3f9401[_0xdae8('0x32')][_0xdae8('0x41')]){_0x2076c2[_0xdae8('0x42')]=[{'all':!![]}];}return db[_0xdae8('0x2e')]['findAll'](_0x2076c2);})[_0xdae8('0x26')](function(_0x51caed){_0x487d24['rows']=_0x51caed;return _0x487d24;})[_0xdae8('0x26')](respondWithFilteredResult(_0x447246,_0x2076c2))[_0xdae8('0x43')](handleError(_0x447246,null));};exports[_0xdae8('0x44')]=function(_0x5cc52d,_0x1dabc5){var _0x313691={'raw':!![],'where':{'id':_0x5cc52d[_0xdae8('0x45')]['id']}},_0x2f8f69={};_0x2f8f69[_0xdae8('0x31')]=_[_0xdae8('0x33')](db[_0xdae8('0x2e')]['rawAttributes']);_0x2f8f69[_0xdae8('0x32')]=_[_0xdae8('0x33')](_0x5cc52d['query']);_0x2f8f69['filters']=_['intersection'](_0x2f8f69[_0xdae8('0x31')],_0x2f8f69['query']);_0x313691['attributes']=_[_0xdae8('0x35')](_0x2f8f69[_0xdae8('0x31')],qs['fields'](_0x5cc52d['query']['fields']));_0x313691[_0xdae8('0x34')]=_0x313691['attributes'][_0xdae8('0x46')]?_0x313691['attributes']:_0x2f8f69[_0xdae8('0x31')];if(_0x5cc52d[_0xdae8('0x32')][_0xdae8('0x41')]){_0x313691[_0xdae8('0x42')]=[{'all':!![]}];}_0x313691=_['merge']({},_0x313691,_0x5cc52d[_0xdae8('0x40')]);return db['ZendeskField']['find'](_0x313691)[_0xdae8('0x26')](handleEntityNotFound(_0x1dabc5,null))[_0xdae8('0x26')](respondWithResult(_0x1dabc5,null))['catch'](handleError(_0x1dabc5,null));};exports[_0xdae8('0x47')]=function(_0x4598f5,_0x1559fe){return db['ZendeskField'][_0xdae8('0x47')](_0x4598f5[_0xdae8('0x48')],{})[_0xdae8('0x26')](respondWithResult(_0x1559fe,0xc9))[_0xdae8('0x43')](handleError(_0x1559fe,null));};exports[_0xdae8('0x25')]=function(_0x2d0e50,_0x4ccaf9){if(_0x2d0e50[_0xdae8('0x48')]['id']){delete _0x2d0e50[_0xdae8('0x48')]['id'];}return db[_0xdae8('0x2e')][_0xdae8('0x49')]({'where':{'id':_0x2d0e50['params']['id']}})[_0xdae8('0x26')](handleEntityNotFound(_0x4ccaf9,null))['then'](saveUpdates(_0x2d0e50[_0xdae8('0x48')],null))['then'](respondWithResult(_0x4ccaf9,null))[_0xdae8('0x43')](handleError(_0x4ccaf9,null));};exports[_0xdae8('0x4a')]=function(_0x3f13a9,_0x596663){return db[_0xdae8('0x2e')][_0xdae8('0x49')]({'where':{'id':_0x3f13a9[_0xdae8('0x45')]['id']}})[_0xdae8('0x26')](handleEntityNotFound(_0x596663,null))['then'](removeEntity(_0x596663,null))[_0xdae8('0x43')](handleError(_0x596663,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a9087b1..3690b88 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 _0x3685=['rimraf','./intZendeskField.attributes','exports','define','lodash','util','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3685,0x136));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require(_0x5368('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5368('0x2'));var rp=require(_0x5368('0x3'));var fs=require('fs');var path=require(_0x5368('0x4'));var rimraf=require(_0x5368('0x5'));var config=require('../../config/environment');var attributes=require(_0x5368('0x6'));module[_0x5368('0x7')]=function(_0x15c878,_0x25c4a5){return _0x15c878[_0x5368('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0531=['ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x5f416b,_0x2d8810){var _0x14c815=function(_0x1fd5d2){while(--_0x1fd5d2){_0x5f416b['push'](_0x5f416b['shift']());}};_0x14c815(++_0x2d8810);}(_0x0531,0x93));var _0x1053=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x0531[_0x3a19d4];return _0x5b858b;};'use strict';var _=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1053('0x2'));var BPromise=require(_0x1053('0x3'));var rp=require(_0x1053('0x4'));var fs=require('fs');var path=require(_0x1053('0x5'));var rimraf=require(_0x1053('0x6'));var config=require(_0x1053('0x7'));var attributes=require(_0x1053('0x8'));module['exports']=function(_0x2d87e5,_0x318ddb){return _0x2d87e5['define'](_0x1053('0x9'),attributes,{'tableName':_0x1053('0xa'),'paranoid':![],'indexes':[{'name':_0x1053('0xb'),'fields':['idField',_0x1053('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 9a5612f..2e84037 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 _0xa9b5=['catch','moment','bluebird','../../config/utils','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3cd336,_0x2fe53f){var _0x5e6421=function(_0x4dde3e){while(--_0x4dde3e){_0x3cd336['push'](_0x3cd336['shift']());}};_0x5e6421(++_0x2fe53f);}(_0xa9b5,0x131));var _0x5a9b=function(_0x26463e,_0x293add){_0x26463e=_0x26463e-0x0;var _0xceee2a=_0xa9b5[_0x26463e];return _0xceee2a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a9b('0x0'));var BPromise=require(_0x5a9b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5a9b('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5a9b('0x3')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310983,_0x20df5d,_0x38d804){return new BPromise(function(_0x4f0e8b,_0x2dbb10){return client[_0x5a9b('0x4')](_0x310983,_0x38d804)[_0x5a9b('0x5')](function(_0x392e62){logger['info'](_0x5a9b('0x6'),_0x20df5d,_0x5a9b('0x7'));logger[_0x5a9b('0x8')](_0x5a9b('0x9'),_0x20df5d,_0x5a9b('0x7'),JSON[_0x5a9b('0xa')](_0x392e62));if(_0x392e62[_0x5a9b('0xb')]){if(_0x392e62[_0x5a9b('0xb')][_0x5a9b('0xc')]===0x1f4){logger[_0x5a9b('0xb')](_0x5a9b('0x6'),_0x20df5d,_0x392e62[_0x5a9b('0xb')][_0x5a9b('0xd')]);return _0x2dbb10(_0x392e62[_0x5a9b('0xb')][_0x5a9b('0xd')]);}logger[_0x5a9b('0xb')]('ZendeskField,\x20%s,\x20%s',_0x20df5d,_0x392e62[_0x5a9b('0xb')][_0x5a9b('0xd')]);return _0x4f0e8b(_0x392e62[_0x5a9b('0xb')][_0x5a9b('0xd')]);}else{logger['info'](_0x5a9b('0x6'),_0x20df5d,_0x5a9b('0x7'));_0x4f0e8b(_0x392e62[_0x5a9b('0xe')][_0x5a9b('0xd')]);}})[_0x5a9b('0xf')](function(_0x31e9a0){logger[_0x5a9b('0xb')](_0x5a9b('0x6'),_0x20df5d,_0x31e9a0);_0x2dbb10(_0x31e9a0);});});} \ No newline at end of file +var _0xe3be=['message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2e8909,_0x224f3e){var _0x25b3c3=function(_0x27b2dd){while(--_0x27b2dd){_0x2e8909['push'](_0x2e8909['shift']());}};_0x25b3c3(++_0x224f3e);}(_0xe3be,0x1e3));var _0xee3b=function(_0x415704,_0x541d05){_0x415704=_0x415704-0x0;var _0x4e3047=_0xe3be[_0x415704];return _0x4e3047;};'use strict';var _=require('lodash');var util=require(_0xee3b('0x0'));var moment=require('moment');var BPromise=require(_0xee3b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee3b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee3b('0x3'));var logger=require(_0xee3b('0x4'))(_0xee3b('0x5'));var config=require(_0xee3b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xee3b('0x7')][_0xee3b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa4ac5d,_0x359307,_0x3a2b2d){return new BPromise(function(_0x4454e9,_0x8cc8f9){return client[_0xee3b('0x9')](_0xa4ac5d,_0x3a2b2d)[_0xee3b('0xa')](function(_0x5be974){logger[_0xee3b('0xb')](_0xee3b('0xc'),_0x359307,_0xee3b('0xd'));logger[_0xee3b('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x359307,_0xee3b('0xd'),JSON[_0xee3b('0xf')](_0x5be974));if(_0x5be974[_0xee3b('0x10')]){if(_0x5be974['error']['code']===0x1f4){logger[_0xee3b('0x10')](_0xee3b('0xc'),_0x359307,_0x5be974[_0xee3b('0x10')][_0xee3b('0x11')]);return _0x8cc8f9(_0x5be974[_0xee3b('0x10')][_0xee3b('0x11')]);}logger['error'](_0xee3b('0xc'),_0x359307,_0x5be974[_0xee3b('0x10')][_0xee3b('0x11')]);return _0x4454e9(_0x5be974['error'][_0xee3b('0x11')]);}else{logger[_0xee3b('0xb')](_0xee3b('0xc'),_0x359307,_0xee3b('0xd'));_0x4454e9(_0x5be974[_0xee3b('0x12')][_0xee3b('0x11')]);}})[_0xee3b('0x13')](function(_0x1720e0){logger[_0xee3b('0x10')](_0xee3b('0xc'),_0x359307,_0x1720e0);_0x8cc8f9(_0x1720e0);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fbefef7..d3f76ef 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 _0xad7b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','destroy','exports','multer','util','path'];(function(_0xb04cb1,_0x13b8e3){var _0x309445=function(_0x21422b){while(--_0x21422b){_0xb04cb1['push'](_0xb04cb1['shift']());}};_0x309445(++_0x13b8e3);}(_0xad7b,0xed));var _0xbad7=function(_0x36f5e1,_0x47efa2){_0x36f5e1=_0x36f5e1-0x0;var _0x289a7d=_0xad7b[_0x36f5e1];return _0x289a7d;};'use strict';var multer=require(_0xbad7('0x0'));var util=require(_0xbad7('0x1'));var path=require(_0xbad7('0x2'));var timeout=require(_0xbad7('0x3'));var express=require('express');var router=express[_0xbad7('0x4')]();var fs_extra=require(_0xbad7('0x5'));var auth=require(_0xbad7('0x6'));var interaction=require(_0xbad7('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xbad7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbad7('0x8')](_0xbad7('0x9'),auth[_0xbad7('0xa')](),controller[_0xbad7('0xb')]);router[_0xbad7('0x8')](_0xbad7('0xc'),auth['isAuthenticated'](),controller[_0xbad7('0xd')]);router[_0xbad7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbad7('0xe')]);router[_0xbad7('0xf')]('/',auth[_0xbad7('0xa')](),controller['create']);router[_0xbad7('0xf')](_0xbad7('0xc'),auth['isAuthenticated'](),controller[_0xbad7('0x10')]);router[_0xbad7('0x11')](_0xbad7('0x9'),auth[_0xbad7('0xa')](),controller['update']);router['delete'](_0xbad7('0x9'),auth[_0xbad7('0xa')](),controller[_0xbad7('0x12')]);module[_0xbad7('0x13')]=router; \ No newline at end of file +var _0x9655=['post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x371d83,_0xda8af3){var _0xd33c14=function(_0x42ae77){while(--_0x42ae77){_0x371d83['push'](_0x371d83['shift']());}};_0xd33c14(++_0xda8af3);}(_0x9655,0x10f));var _0x5965=function(_0x3a913b,_0x247a82){_0x3a913b=_0x3a913b-0x0;var _0x48f063=_0x9655[_0x3a913b];return _0x48f063;};'use strict';var multer=require(_0x5965('0x0'));var util=require(_0x5965('0x1'));var path=require(_0x5965('0x2'));var timeout=require('connect-timeout');var express=require(_0x5965('0x3'));var router=express['Router']();var fs_extra=require(_0x5965('0x4'));var auth=require(_0x5965('0x5'));var interaction=require(_0x5965('0x6'));var config=require(_0x5965('0x7'));var controller=require(_0x5965('0x8'));router['get']('/',auth[_0x5965('0x9')](),controller[_0x5965('0xa')]);router['get'](_0x5965('0xb'),auth[_0x5965('0x9')](),controller[_0x5965('0xc')]);router[_0x5965('0xd')](_0x5965('0xe'),auth[_0x5965('0x9')](),controller[_0x5965('0xf')]);router[_0x5965('0xd')](_0x5965('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x5965('0x11')]('/',auth['isAuthenticated'](),controller[_0x5965('0x12')]);router[_0x5965('0x11')](_0x5965('0xe'),auth[_0x5965('0x9')](),controller[_0x5965('0x13')]);router['put']('/:id',auth[_0x5965('0x9')](),controller[_0x5965('0x14')]);router[_0x5965('0x15')]('/:id',auth[_0x5965('0x9')](),controller[_0x5965('0x16')]);module[_0x5965('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 988acc1..9c96b82 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 _0x54ef=['STRING','sequelize','exports'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0x54ef,0x112));var _0xf54e=function(_0x30aa46,_0x26f7bd){_0x30aa46=_0x30aa46-0x0;var _0x51fc2e=_0x54ef[_0x30aa46];return _0x51fc2e;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0xaa88=['exports','STRING','sequelize'];(function(_0x23863e,_0x31f426){var _0x1620ed=function(_0x1d6a71){while(--_0x1d6a71){_0x23863e['push'](_0x23863e['shift']());}};_0x1620ed(++_0x31f426);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xaa88[_0x3f465d];return _0x121ad1;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ec93431..90d86f6 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 _0x8ec4=['clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','zoho.eu','com','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','push','display_label','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','catch','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','channel','Descriptions','ZohoField','Subjects','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x8ec4,0x186));var _0x48ec=function(_0x232a7a,_0x50516e){_0x232a7a=_0x232a7a-0x0;var _0x5f090a=_0x8ec4[_0x232a7a];return _0x5f090a;};'use strict';var emlformat=require(_0x48ec('0x0'));var rimraf=require(_0x48ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48ec('0x2'));var BPromise=require(_0x48ec('0x3'));var Mustache=require(_0x48ec('0x4'));var util=require(_0x48ec('0x5'));var path=require(_0x48ec('0x6'));var sox=require('sox');var csv=require(_0x48ec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48ec('0x8'));var squel=require(_0x48ec('0x9'));var crypto=require('crypto');var jsforce=require(_0x48ec('0xa'));var deskjs=require(_0x48ec('0xb'));var toCsv=require(_0x48ec('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48ec('0xc'));var authService=require(_0x48ec('0xd'));var qs=require(_0x48ec('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x48ec('0xf'))(_0x48ec('0x10'));var utils=require(_0x48ec('0x11'));var config=require(_0x48ec('0x12'));var licenseUtil=require(_0x48ec('0x13'));var db=require(_0x48ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x472878,_0x5d0786){_0x5d0786=_0x5d0786||0xcc;return function(_0x4d4985){if(_0x4d4985){return _0x472878[_0x48ec('0x15')](_0x5d0786);}return _0x472878[_0x48ec('0x16')](_0x5d0786)[_0x48ec('0x17')]();};}function respondWithResult(_0x17c6e2,_0x2e5d69){_0x2e5d69=_0x2e5d69||0xc8;return function(_0x1bb5f3){if(_0x1bb5f3){return _0x17c6e2[_0x48ec('0x16')](_0x2e5d69)['json'](_0x1bb5f3);}};}function respondWithFilteredResult(_0x1d813f,_0x592cb2){return function(_0x101faa){if(_0x101faa){var _0x59f945=typeof _0x592cb2[_0x48ec('0x18')]==='undefined'&&typeof _0x592cb2[_0x48ec('0x19')]==='undefined';var _0x517117=_0x101faa[_0x48ec('0x1a')];var _0x809158=_0x59f945?0x0:_0x592cb2['offset'];var _0x359310=_0x59f945?_0x101faa[_0x48ec('0x1a')]:_0x592cb2[_0x48ec('0x18')]+_0x592cb2[_0x48ec('0x19')];var _0x582da6;if(_0x359310>=_0x517117){_0x359310=_0x517117;_0x582da6=0xc8;}else{_0x582da6=0xce;}_0x1d813f[_0x48ec('0x16')](_0x582da6);return _0x1d813f[_0x48ec('0x1b')](_0x48ec('0x1c'),_0x809158+'-'+_0x359310+'/'+_0x517117)['json'](_0x101faa);}return null;};}function patchUpdates(_0x18e263){return function(_0x5d120d){try{jsonpatch[_0x48ec('0x1d')](_0x5d120d,_0x18e263,!![]);}catch(_0x327194){return BPromise[_0x48ec('0x1e')](_0x327194);}return _0x5d120d['save']();};}function saveUpdates(_0x4e855f,_0x19ff29){return function(_0x4e6115){if(_0x4e6115){return _0x4e6115[_0x48ec('0x1f')](_0x4e855f)['then'](function(_0x1bd007){return _0x1bd007;});}return null;};}function removeEntity(_0x190e7e,_0x30e08a){return function(_0x226295){if(_0x226295){return _0x226295[_0x48ec('0x20')]()[_0x48ec('0x21')](function(){_0x190e7e[_0x48ec('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504787,_0x52b9a6){return function(_0x2a82db){if(!_0x2a82db){_0x504787[_0x48ec('0x15')](0x194);}return _0x2a82db;};}function handleError(_0xb9ae51,_0x3ddd61){_0x3ddd61=_0x3ddd61||0x1f4;return function(_0x45d9ff){logger[_0x48ec('0x22')](_0x45d9ff[_0x48ec('0x23')]);if(_0x45d9ff[_0x48ec('0x24')]){delete _0x45d9ff[_0x48ec('0x24')];}_0xb9ae51[_0x48ec('0x16')](_0x3ddd61)[_0x48ec('0x25')](_0x45d9ff);};}exports['index']=function(_0xcb16fa,_0x1ec204){var _0x13c835={},_0x1afc05={},_0x3aa8ea={'count':0x0,'rows':[]};var _0x391e13=_[_0x48ec('0x26')](db[_0x48ec('0x27')][_0x48ec('0x28')],function(_0x7012ae){return{'name':_0x7012ae[_0x48ec('0x29')],'type':_0x7012ae[_0x48ec('0x2a')][_0x48ec('0x2b')]};});_0x1afc05[_0x48ec('0x2c')]=_[_0x48ec('0x26')](_0x391e13,'name');_0x1afc05[_0x48ec('0x2d')]=_[_0x48ec('0x2e')](_0xcb16fa['query']);_0x1afc05[_0x48ec('0x2f')]=_[_0x48ec('0x30')](_0x1afc05[_0x48ec('0x2c')],_0x1afc05[_0x48ec('0x2d')]);_0x13c835[_0x48ec('0x31')]=_[_0x48ec('0x30')](_0x1afc05[_0x48ec('0x2c')],qs[_0x48ec('0x32')](_0xcb16fa['query']['fields']));_0x13c835[_0x48ec('0x31')]=_0x13c835[_0x48ec('0x31')][_0x48ec('0x33')]?_0x13c835[_0x48ec('0x31')]:_0x1afc05[_0x48ec('0x2c')];if(!_0xcb16fa[_0x48ec('0x2d')][_0x48ec('0x34')]('nolimit')){_0x13c835[_0x48ec('0x19')]=qs[_0x48ec('0x19')](_0xcb16fa[_0x48ec('0x2d')][_0x48ec('0x19')]);_0x13c835[_0x48ec('0x18')]=qs['offset'](_0xcb16fa[_0x48ec('0x2d')][_0x48ec('0x18')]);}_0x13c835[_0x48ec('0x35')]=qs[_0x48ec('0x36')](_0xcb16fa['query']['sort']);_0x13c835[_0x48ec('0x37')]=qs['filters'](_[_0x48ec('0x38')](_0xcb16fa[_0x48ec('0x2d')],_0x1afc05[_0x48ec('0x2f')]),_0x391e13);if(_0xcb16fa['query'][_0x48ec('0x39')]){_0x13c835[_0x48ec('0x37')]=_[_0x48ec('0x3a')](_0x13c835[_0x48ec('0x37')],{'$or':_[_0x48ec('0x26')](_0x391e13,function(_0x45966c){if(_0x45966c[_0x48ec('0x2a')]!==_0x48ec('0x3b')){var _0x41a12e={};_0x41a12e[_0x45966c[_0x48ec('0x24')]]={'$like':'%'+_0xcb16fa[_0x48ec('0x2d')][_0x48ec('0x39')]+'%'};return _0x41a12e;}})});}_0x13c835=_[_0x48ec('0x3a')]({},_0x13c835,_0xcb16fa[_0x48ec('0x3c')]);var _0x4650f9={'where':_0x13c835[_0x48ec('0x37')]};return db[_0x48ec('0x27')][_0x48ec('0x1a')](_0x4650f9)[_0x48ec('0x21')](function(_0x2f3960){_0x3aa8ea[_0x48ec('0x1a')]=_0x2f3960;if(_0xcb16fa[_0x48ec('0x2d')][_0x48ec('0x3d')]){_0x13c835[_0x48ec('0x3e')]=[{'all':!![]}];}return db[_0x48ec('0x27')]['findAll'](_0x13c835);})[_0x48ec('0x21')](function(_0x4cdf99){_0x3aa8ea[_0x48ec('0x3f')]=_0x4cdf99;return _0x3aa8ea;})[_0x48ec('0x21')](respondWithFilteredResult(_0x1ec204,_0x13c835))['catch'](handleError(_0x1ec204,null));};exports['show']=function(_0x50eb5f,_0x428ed4){var _0x25476e={'raw':![],'where':{'id':_0x50eb5f[_0x48ec('0x40')]['id']}},_0x5c477d={};_0x5c477d[_0x48ec('0x2c')]=_[_0x48ec('0x2e')](db[_0x48ec('0x27')][_0x48ec('0x28')]);_0x5c477d['query']=_[_0x48ec('0x2e')](_0x50eb5f[_0x48ec('0x2d')]);_0x5c477d[_0x48ec('0x2f')]=_[_0x48ec('0x30')](_0x5c477d[_0x48ec('0x2c')],_0x5c477d[_0x48ec('0x2d')]);_0x25476e[_0x48ec('0x31')]=_[_0x48ec('0x30')](_0x5c477d['model'],qs['fields'](_0x50eb5f['query']['fields']));_0x25476e[_0x48ec('0x31')]=_0x25476e['attributes'][_0x48ec('0x33')]?_0x25476e[_0x48ec('0x31')]:_0x5c477d[_0x48ec('0x2c')];if(_0x50eb5f[_0x48ec('0x2d')][_0x48ec('0x3d')]){_0x25476e[_0x48ec('0x3e')]=[{'all':!![]}];}_0x25476e=_[_0x48ec('0x3a')]({},_0x25476e,_0x50eb5f[_0x48ec('0x3c')]);return db[_0x48ec('0x27')][_0x48ec('0x41')](_0x25476e)[_0x48ec('0x21')](handleEntityNotFound(_0x428ed4,null))['then'](respondWithResult(_0x428ed4,null))['catch'](handleError(_0x428ed4,null));};exports['create']=function(_0x523bd2,_0x37c9c0){return db['ZohoAccount'][_0x48ec('0x42')](_0x523bd2['body'],{})[_0x48ec('0x21')](respondWithResult(_0x37c9c0,0xc9))['catch'](handleError(_0x37c9c0,null));};exports[_0x48ec('0x1f')]=function(_0xa3ea02,_0x3a6749){if(_0xa3ea02['body']['id']){delete _0xa3ea02[_0x48ec('0x43')]['id'];}return db[_0x48ec('0x27')][_0x48ec('0x41')]({'where':{'id':_0xa3ea02[_0x48ec('0x40')]['id']}})[_0x48ec('0x21')](handleEntityNotFound(_0x3a6749,null))[_0x48ec('0x21')](saveUpdates(_0xa3ea02[_0x48ec('0x43')],null))[_0x48ec('0x21')](respondWithResult(_0x3a6749,null))[_0x48ec('0x44')](handleError(_0x3a6749,null));};exports[_0x48ec('0x20')]=function(_0x1dc32e,_0x27a64e){return db[_0x48ec('0x27')][_0x48ec('0x41')]({'where':{'id':_0x1dc32e[_0x48ec('0x40')]['id']}})[_0x48ec('0x21')](handleEntityNotFound(_0x27a64e,null))[_0x48ec('0x21')](removeEntity(_0x27a64e,null))[_0x48ec('0x44')](handleError(_0x27a64e,null));};exports['getConfigurations']=function(_0x4f2199,_0x28d607,_0x772521){var _0x1e3912={};var _0x4578bf={};var _0x59487e;var _0x553458;return db['ZohoAccount'][_0x48ec('0x45')]({'where':{'id':_0x4f2199['params']['id']}})[_0x48ec('0x21')](handleEntityNotFound(_0x28d607,null))['then'](function(_0x435ccc){if(_0x435ccc){_0x59487e=_0x435ccc;_0x4578bf[_0x48ec('0x2c')]=_[_0x48ec('0x2e')](db[_0x48ec('0x46')]['rawAttributes']);_0x4578bf[_0x48ec('0x2d')]=_[_0x48ec('0x2e')](_0x4f2199['query']);_0x4578bf['filters']=_[_0x48ec('0x30')](_0x4578bf['model'],_0x4578bf[_0x48ec('0x2d')]);_0x1e3912[_0x48ec('0x31')]=_['intersection'](_0x4578bf[_0x48ec('0x2c')],qs['fields'](_0x4f2199[_0x48ec('0x2d')][_0x48ec('0x32')]));_0x1e3912[_0x48ec('0x31')]=_0x1e3912[_0x48ec('0x31')][_0x48ec('0x33')]?_0x1e3912[_0x48ec('0x31')]:_0x4578bf[_0x48ec('0x2c')];_0x1e3912[_0x48ec('0x35')]=qs['sort'](_0x4f2199[_0x48ec('0x2d')][_0x48ec('0x36')]);_0x1e3912[_0x48ec('0x37')]=qs[_0x48ec('0x2f')](_[_0x48ec('0x38')](_0x4f2199['query'],_0x4578bf[_0x48ec('0x2f')]));if(_0x4f2199[_0x48ec('0x2d')][_0x48ec('0x39')]){_0x1e3912[_0x48ec('0x37')]=_[_0x48ec('0x3a')](_0x1e3912[_0x48ec('0x37')],{'$or':_[_0x48ec('0x26')](_0x1e3912['attributes'],function(_0x5c0484){var _0x124790={};_0x124790[_0x5c0484]={'$like':'%'+_0x4f2199[_0x48ec('0x2d')][_0x48ec('0x39')]+'%'};return _0x124790;})});}_0x1e3912=_['merge']({},_0x1e3912,_0x4f2199['options']);return _0x59487e[_0x48ec('0x47')](_0x1e3912);}})[_0x48ec('0x21')](function(_0x17de31){if(_0x17de31){_0x553458=_0x17de31[_0x48ec('0x33')];if(!_0x4f2199['query'][_0x48ec('0x34')]('nolimit')){_0x1e3912[_0x48ec('0x19')]=qs[_0x48ec('0x19')](_0x4f2199['query'][_0x48ec('0x19')]);_0x1e3912[_0x48ec('0x18')]=qs['offset'](_0x4f2199['query'][_0x48ec('0x18')]);}return _0x59487e['getConfigurations'](_0x1e3912);}})[_0x48ec('0x21')](function(_0x58a028){if(_0x58a028){return _0x58a028?{'count':_0x553458,'rows':_0x58a028}:null;}})['then'](respondWithResult(_0x28d607,null))[_0x48ec('0x44')](handleError(_0x28d607,null));};exports[_0x48ec('0x48')]=function(_0x595d8d,_0x41e000,_0x596e4d){if(_0x595d8d[_0x48ec('0x43')]['id']){delete _0x595d8d['body']['id'];}return db[_0x48ec('0x27')][_0x48ec('0x45')]({'where':{'id':_0x595d8d[_0x48ec('0x40')]['id']}})[_0x48ec('0x21')](handleEntityNotFound(_0x41e000,null))[_0x48ec('0x21')](function(_0x4e31a0){if(_0x4e31a0){_0x595d8d['body'][_0x48ec('0x49')]=_0x4e31a0['id'];_0x595d8d[_0x48ec('0x43')]['Subjects']=integrations['getSubjects'](_0x595d8d['body'][_0x48ec('0x4a')],_0x595d8d[_0x48ec('0x43')][_0x48ec('0x2a')]);_0x595d8d['body'][_0x48ec('0x4b')]=integrations['getDescriptions'](_0x595d8d['body'][_0x48ec('0x4a')],_0x595d8d['body'][_0x48ec('0x2a')]);return db[_0x48ec('0x46')][_0x48ec('0x42')](_0x595d8d[_0x48ec('0x43')],{'include':[{'model':db[_0x48ec('0x4c')],'as':_0x48ec('0x4d')},{'model':db[_0x48ec('0x4c')],'as':_0x48ec('0x4b')}]});}return null;})['then'](respondWithResult(_0x41e000,null))[_0x48ec('0x44')](handleError(_0x41e000,null));};function getAccessToken(_0xb5d9ab){return new Promise(function(_0x17daf7,_0x32969f){var _0x3c6beb;switch(_0xb5d9ab[_0x48ec('0x4e')]){case'US':_0x3c6beb='https://accounts.zoho.com';break;case'AU':_0x3c6beb='https://accounts.zoho.com.au';break;case'EU':_0x3c6beb=_0x48ec('0x4f');break;case'IN':_0x3c6beb=_0x48ec('0x50');break;case'CN':_0x3c6beb=_0x48ec('0x51');break;default:_0x3c6beb=_0x48ec('0x4f');break;}var _0x532adf={'method':_0x48ec('0x52'),'uri':_0x3c6beb+_0x48ec('0x53'),'qs':{'refresh_token':_0xb5d9ab[_0x48ec('0x54')],'client_id':_0xb5d9ab[_0x48ec('0x55')],'client_secret':_0xb5d9ab[_0x48ec('0x56')],'grant_type':_0x48ec('0x57')},'json':!![]};return rp(_0x532adf)[_0x48ec('0x21')](function(_0x4cd896){if(_0x4cd896['access_token']){_0x17daf7(_0x4cd896[_0x48ec('0x58')]);}else{_0x32969f(_0x48ec('0x59'));}})[_0x48ec('0x44')](function(_0x177aef){_0x32969f(_0x177aef);});});}exports[_0x48ec('0x5a')]=function(_0x1f1b33,_0x576dae,_0x25e26f){var _0x23bd32,_0x31f7f6,_0x108ed1,_0x1f10e8,_0x233126;return db[_0x48ec('0x27')][_0x48ec('0x45')]({'where':{'id':_0x1f1b33['params']['id']},'attributes':['id','host',_0x48ec('0x4e'),_0x48ec('0x55'),_0x48ec('0x56'),_0x48ec('0x5b'),_0x48ec('0x5c'),_0x48ec('0x54')]})['then'](handleEntityNotFound(_0x576dae,null))[_0x48ec('0x21')](function(_0x24f0d0){_0x233126=_0x24f0d0;_0x23bd32=_0x233126[_0x48ec('0x5d')];_0x31f7f6=_0x23bd32===_0x48ec('0x5e')?'eu':_0x48ec('0x5f');_0x108ed1=_0x233126[_0x48ec('0x5b')];var _0x38d649=_0x108ed1['slice'](-0x1);if(_0x38d649==='/'||_0x38d649==='\x5c'||_0x38d649===':'){_0x108ed1=_0x108ed1[_0x48ec('0x60')](0x0,_0x108ed1['lastIndexOf'](_0x38d649));}if(!_0x233126[_0x48ec('0x54')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x233126);})[_0x48ec('0x21')](function(_0x11219a){if(_0x11219a){return rp({'method':_0x48ec('0x61'),'uri':util[_0x48ec('0x62')](_0x48ec('0x63'),_0x31f7f6),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x11219a},'json':!![]});}})[_0x48ec('0x21')](function(_0x2bf47b){if(_0x2bf47b){if(_0x2bf47b[_0x48ec('0x64')]&&_0x2bf47b[_0x48ec('0x64')]['error']){throw new Error(_0x2bf47b[_0x48ec('0x64')]['error'][_0x48ec('0x65')]);}var _0x5af79e=[];var _0x30e3be=[];var _0x216ebf=['Owner',_0x48ec('0x66'),_0x48ec('0x67'),_0x48ec('0x68'),_0x48ec('0x69'),'Call_Result',_0x48ec('0x6a'),_0x48ec('0x6b')];_0x30e3be=_[_0x48ec('0x6c')](_0x2bf47b[_0x48ec('0x32')],function(_0x56065f){return _0x216ebf[_0x48ec('0x6d')](_0x56065f['api_name']);});for(var _0xc24d19=0x0;_0xc24d19<_0x30e3be[_0x48ec('0x33')];_0xc24d19++){if(_0x30e3be[_0xc24d19]['system_mandatory']===![]){_0x5af79e[_0x48ec('0x6e')]({'id':_0x30e3be[_0xc24d19]['id'],'name':_0x30e3be[_0xc24d19][_0x48ec('0x6f')],'custom':_0x30e3be[_0xc24d19]['custom_field'],'options':_0x30e3be[_0xc24d19]['data_type']===_0x48ec('0x70')&&_0x30e3be[_0xc24d19][_0x48ec('0x71')][_0x48ec('0x33')]>-0x1?_[_0x48ec('0x26')](_0x30e3be[_0xc24d19]['pick_list_values'],function(_0x193a06){return{'name':_0x193a06,'value':_0x193a06};}):[]});}}return{'count':_0x5af79e[_0x48ec('0x33')],'rows':_0x5af79e};}else{return{'count':0x0,'rows':[]};}})[_0x48ec('0x21')](respondWithResult(_0x576dae,null))[_0x48ec('0x44')](function(_0x32776a){var _0x3b15ff=_0x1f1b33[_0x48ec('0x2d')][_0x48ec('0x72')]?0x1f4:_0x32776a[_0x48ec('0x73')]||0x1f4;logger[_0x48ec('0x22')](_0x48ec('0x74'),'getFields',_0x3b15ff,JSON[_0x48ec('0x75')](_0x32776a));delete _0x32776a[_0x48ec('0x24')];if(_0x3b15ff===0x191){_0x3b15ff=0x190;}_0x576dae[_0x48ec('0x16')](_0x3b15ff)[_0x48ec('0x25')](_0x1f1b33[_0x48ec('0x2d')][_0x48ec('0x72')]?{'message':_0x48ec('0x76'),'statusCode':_0x32776a[_0x48ec('0x73')]}:_0x32776a);});}; \ No newline at end of file +var _0x0d4f=['format','response','message','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','save','destroy','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ZohoAccount','includeAll','include','findAll','then','rows','catch','show','params','create','body','update','find','getConfigurations','ZohoConfiguration','addConfiguration','findOne','channel','getDescriptions','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x0d4f,0x112));var _0xf0d4=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x0d4f[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0d4('0x0'));var zipdir=require(_0xf0d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0d4('0x2'));var moment=require(_0xf0d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0d4('0x4'));var util=require(_0xf0d4('0x5'));var path=require(_0xf0d4('0x6'));var sox=require(_0xf0d4('0x7'));var csv=require(_0xf0d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0d4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf0d4('0xa'));var deskjs=require(_0xf0d4('0xb'));var toCsv=require(_0xf0d4('0x8'));var querystring=require(_0xf0d4('0xc'));var Papa=require(_0xf0d4('0xd'));var Redis=require(_0xf0d4('0xe'));var authService=require(_0xf0d4('0xf'));var qs=require(_0xf0d4('0x10'));var as=require(_0xf0d4('0x11'));var hardwareService=require(_0xf0d4('0x12'));var logger=require('../../config/logger')(_0xf0d4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0d4('0x14'));var db=require(_0xf0d4('0x15'))['db'];var integrations=require(_0xf0d4('0x16'));function respondWithStatusCode(_0x10b42f,_0x1903e4){_0x1903e4=_0x1903e4||0xcc;return function(_0x4496ba){if(_0x4496ba){return _0x10b42f[_0xf0d4('0x17')](_0x1903e4);}return _0x10b42f[_0xf0d4('0x18')](_0x1903e4)[_0xf0d4('0x19')]();};}function respondWithResult(_0x1f6526,_0x44e234){_0x44e234=_0x44e234||0xc8;return function(_0x2dca92){if(_0x2dca92){return _0x1f6526['status'](_0x44e234)['json'](_0x2dca92);}};}function respondWithFilteredResult(_0x12c821,_0x426144){return function(_0x39a04e){if(_0x39a04e){var _0x3dbd6e=typeof _0x426144[_0xf0d4('0x1a')]==='undefined'&&typeof _0x426144[_0xf0d4('0x1b')]==='undefined';var _0x5dcc73=_0x39a04e[_0xf0d4('0x1c')];var _0x44a4a6=_0x3dbd6e?0x0:_0x426144['offset'];var _0x53da97=_0x3dbd6e?_0x39a04e[_0xf0d4('0x1c')]:_0x426144[_0xf0d4('0x1a')]+_0x426144['limit'];var _0x2f285c;if(_0x53da97>=_0x5dcc73){_0x53da97=_0x5dcc73;_0x2f285c=0xc8;}else{_0x2f285c=0xce;}_0x12c821[_0xf0d4('0x18')](_0x2f285c);return _0x12c821['set'](_0xf0d4('0x1d'),_0x44a4a6+'-'+_0x53da97+'/'+_0x5dcc73)[_0xf0d4('0x1e')](_0x39a04e);}return null;};}function patchUpdates(_0x19aa0a){return function(_0x22a398){try{jsonpatch[_0xf0d4('0x1f')](_0x22a398,_0x19aa0a,!![]);}catch(_0x26dede){return BPromise['reject'](_0x26dede);}return _0x22a398[_0xf0d4('0x20')]();};}function saveUpdates(_0x5cf7ca,_0x104b89){return function(_0x274f5e){if(_0x274f5e){return _0x274f5e['update'](_0x5cf7ca)['then'](function(_0x35e5d0){return _0x35e5d0;});}return null;};}function removeEntity(_0x1f0fd0,_0x2f5744){return function(_0x44d629){if(_0x44d629){return _0x44d629[_0xf0d4('0x21')]()['then'](function(){_0x1f0fd0[_0xf0d4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b698c,_0x552b4c){return function(_0x3b90da){if(!_0x3b90da){_0x5b698c[_0xf0d4('0x17')](0x194);}return _0x3b90da;};}function handleError(_0x33fb7a,_0x556ef6){_0x556ef6=_0x556ef6||0x1f4;return function(_0x3f23bc){logger[_0xf0d4('0x22')](_0x3f23bc['stack']);if(_0x3f23bc[_0xf0d4('0x23')]){delete _0x3f23bc[_0xf0d4('0x23')];}_0x33fb7a[_0xf0d4('0x18')](_0x556ef6)['send'](_0x3f23bc);};}exports[_0xf0d4('0x24')]=function(_0xed741e,_0x5cb6d4){var _0x255f5f={},_0x448339={},_0x72958a={'count':0x0,'rows':[]};var _0x36dfde=_[_0xf0d4('0x25')](db['ZohoAccount'][_0xf0d4('0x26')],function(_0x5a41e3){return{'name':_0x5a41e3[_0xf0d4('0x27')],'type':_0x5a41e3[_0xf0d4('0x28')][_0xf0d4('0x29')]};});_0x448339['model']=_[_0xf0d4('0x25')](_0x36dfde,_0xf0d4('0x23'));_0x448339[_0xf0d4('0x2a')]=_[_0xf0d4('0x2b')](_0xed741e[_0xf0d4('0x2a')]);_0x448339[_0xf0d4('0x2c')]=_['intersection'](_0x448339[_0xf0d4('0x2d')],_0x448339[_0xf0d4('0x2a')]);_0x255f5f[_0xf0d4('0x2e')]=_[_0xf0d4('0x2f')](_0x448339['model'],qs[_0xf0d4('0x30')](_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x30')]));_0x255f5f[_0xf0d4('0x2e')]=_0x255f5f[_0xf0d4('0x2e')][_0xf0d4('0x31')]?_0x255f5f['attributes']:_0x448339[_0xf0d4('0x2d')];if(!_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x32')](_0xf0d4('0x33'))){_0x255f5f['limit']=qs[_0xf0d4('0x1b')](_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x1b')]);_0x255f5f[_0xf0d4('0x1a')]=qs['offset'](_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x1a')]);}_0x255f5f[_0xf0d4('0x34')]=qs[_0xf0d4('0x35')](_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x35')]);_0x255f5f[_0xf0d4('0x36')]=qs[_0xf0d4('0x2c')](_[_0xf0d4('0x37')](_0xed741e['query'],_0x448339[_0xf0d4('0x2c')]),_0x36dfde);if(_0xed741e[_0xf0d4('0x2a')]['filter']){_0x255f5f['where']=_['merge'](_0x255f5f[_0xf0d4('0x36')],{'$or':_['map'](_0x36dfde,function(_0x27e536){if(_0x27e536[_0xf0d4('0x28')]!==_0xf0d4('0x38')){var _0x45b2b7={};_0x45b2b7[_0x27e536[_0xf0d4('0x23')]]={'$like':'%'+_0xed741e['query'][_0xf0d4('0x39')]+'%'};return _0x45b2b7;}})});}_0x255f5f=_[_0xf0d4('0x3a')]({},_0x255f5f,_0xed741e[_0xf0d4('0x3b')]);var _0x503535={'where':_0x255f5f[_0xf0d4('0x36')]};return db[_0xf0d4('0x3c')][_0xf0d4('0x1c')](_0x503535)['then'](function(_0x434eb5){_0x72958a[_0xf0d4('0x1c')]=_0x434eb5;if(_0xed741e[_0xf0d4('0x2a')][_0xf0d4('0x3d')]){_0x255f5f[_0xf0d4('0x3e')]=[{'all':!![]}];}return db[_0xf0d4('0x3c')][_0xf0d4('0x3f')](_0x255f5f);})[_0xf0d4('0x40')](function(_0x2e31a8){_0x72958a[_0xf0d4('0x41')]=_0x2e31a8;return _0x72958a;})['then'](respondWithFilteredResult(_0x5cb6d4,_0x255f5f))[_0xf0d4('0x42')](handleError(_0x5cb6d4,null));};exports[_0xf0d4('0x43')]=function(_0x5d824e,_0x3139e4){var _0xb0935={'raw':![],'where':{'id':_0x5d824e[_0xf0d4('0x44')]['id']}},_0x289e26={};_0x289e26['model']=_['keys'](db[_0xf0d4('0x3c')][_0xf0d4('0x26')]);_0x289e26[_0xf0d4('0x2a')]=_[_0xf0d4('0x2b')](_0x5d824e[_0xf0d4('0x2a')]);_0x289e26['filters']=_[_0xf0d4('0x2f')](_0x289e26[_0xf0d4('0x2d')],_0x289e26['query']);_0xb0935[_0xf0d4('0x2e')]=_[_0xf0d4('0x2f')](_0x289e26[_0xf0d4('0x2d')],qs['fields'](_0x5d824e[_0xf0d4('0x2a')][_0xf0d4('0x30')]));_0xb0935['attributes']=_0xb0935[_0xf0d4('0x2e')][_0xf0d4('0x31')]?_0xb0935['attributes']:_0x289e26['model'];if(_0x5d824e[_0xf0d4('0x2a')][_0xf0d4('0x3d')]){_0xb0935['include']=[{'all':!![]}];}_0xb0935=_['merge']({},_0xb0935,_0x5d824e[_0xf0d4('0x3b')]);return db[_0xf0d4('0x3c')]['find'](_0xb0935)[_0xf0d4('0x40')](handleEntityNotFound(_0x3139e4,null))['then'](respondWithResult(_0x3139e4,null))[_0xf0d4('0x42')](handleError(_0x3139e4,null));};exports[_0xf0d4('0x45')]=function(_0x4d322b,_0x5c853e){return db[_0xf0d4('0x3c')][_0xf0d4('0x45')](_0x4d322b[_0xf0d4('0x46')],{})[_0xf0d4('0x40')](respondWithResult(_0x5c853e,0xc9))[_0xf0d4('0x42')](handleError(_0x5c853e,null));};exports[_0xf0d4('0x47')]=function(_0x33bff9,_0x2d9866){if(_0x33bff9[_0xf0d4('0x46')]['id']){delete _0x33bff9[_0xf0d4('0x46')]['id'];}return db[_0xf0d4('0x3c')][_0xf0d4('0x48')]({'where':{'id':_0x33bff9[_0xf0d4('0x44')]['id']}})[_0xf0d4('0x40')](handleEntityNotFound(_0x2d9866,null))[_0xf0d4('0x40')](saveUpdates(_0x33bff9[_0xf0d4('0x46')],null))[_0xf0d4('0x40')](respondWithResult(_0x2d9866,null))[_0xf0d4('0x42')](handleError(_0x2d9866,null));};exports['destroy']=function(_0x49b967,_0x513ad5){return db['ZohoAccount'][_0xf0d4('0x48')]({'where':{'id':_0x49b967[_0xf0d4('0x44')]['id']}})[_0xf0d4('0x40')](handleEntityNotFound(_0x513ad5,null))[_0xf0d4('0x40')](removeEntity(_0x513ad5,null))[_0xf0d4('0x42')](handleError(_0x513ad5,null));};exports[_0xf0d4('0x49')]=function(_0x9f0967,_0xfdb099,_0x581517){var _0x3e86da={};var _0x5b1c5={};var _0x3c49e2;var _0xce39c;return db[_0xf0d4('0x3c')]['findOne']({'where':{'id':_0x9f0967[_0xf0d4('0x44')]['id']}})['then'](handleEntityNotFound(_0xfdb099,null))[_0xf0d4('0x40')](function(_0x23fa89){if(_0x23fa89){_0x3c49e2=_0x23fa89;_0x5b1c5['model']=_[_0xf0d4('0x2b')](db[_0xf0d4('0x4a')][_0xf0d4('0x26')]);_0x5b1c5[_0xf0d4('0x2a')]=_[_0xf0d4('0x2b')](_0x9f0967[_0xf0d4('0x2a')]);_0x5b1c5[_0xf0d4('0x2c')]=_['intersection'](_0x5b1c5[_0xf0d4('0x2d')],_0x5b1c5[_0xf0d4('0x2a')]);_0x3e86da[_0xf0d4('0x2e')]=_[_0xf0d4('0x2f')](_0x5b1c5[_0xf0d4('0x2d')],qs['fields'](_0x9f0967['query'][_0xf0d4('0x30')]));_0x3e86da[_0xf0d4('0x2e')]=_0x3e86da['attributes'][_0xf0d4('0x31')]?_0x3e86da[_0xf0d4('0x2e')]:_0x5b1c5[_0xf0d4('0x2d')];_0x3e86da[_0xf0d4('0x34')]=qs[_0xf0d4('0x35')](_0x9f0967[_0xf0d4('0x2a')][_0xf0d4('0x35')]);_0x3e86da['where']=qs[_0xf0d4('0x2c')](_['pick'](_0x9f0967[_0xf0d4('0x2a')],_0x5b1c5[_0xf0d4('0x2c')]));if(_0x9f0967[_0xf0d4('0x2a')]['filter']){_0x3e86da[_0xf0d4('0x36')]=_['merge'](_0x3e86da['where'],{'$or':_[_0xf0d4('0x25')](_0x3e86da[_0xf0d4('0x2e')],function(_0x782d97){var _0xa480ac={};_0xa480ac[_0x782d97]={'$like':'%'+_0x9f0967[_0xf0d4('0x2a')]['filter']+'%'};return _0xa480ac;})});}_0x3e86da=_[_0xf0d4('0x3a')]({},_0x3e86da,_0x9f0967[_0xf0d4('0x3b')]);return _0x3c49e2['getConfigurations'](_0x3e86da);}})[_0xf0d4('0x40')](function(_0x53a00e){if(_0x53a00e){_0xce39c=_0x53a00e[_0xf0d4('0x31')];if(!_0x9f0967['query'][_0xf0d4('0x32')](_0xf0d4('0x33'))){_0x3e86da[_0xf0d4('0x1b')]=qs[_0xf0d4('0x1b')](_0x9f0967['query']['limit']);_0x3e86da[_0xf0d4('0x1a')]=qs['offset'](_0x9f0967[_0xf0d4('0x2a')][_0xf0d4('0x1a')]);}return _0x3c49e2[_0xf0d4('0x49')](_0x3e86da);}})[_0xf0d4('0x40')](function(_0x661345){if(_0x661345){return _0x661345?{'count':_0xce39c,'rows':_0x661345}:null;}})[_0xf0d4('0x40')](respondWithResult(_0xfdb099,null))[_0xf0d4('0x42')](handleError(_0xfdb099,null));};exports[_0xf0d4('0x4b')]=function(_0x1c26a0,_0x260386,_0x4514b5){if(_0x1c26a0['body']['id']){delete _0x1c26a0['body']['id'];}return db[_0xf0d4('0x3c')][_0xf0d4('0x4c')]({'where':{'id':_0x1c26a0[_0xf0d4('0x44')]['id']}})['then'](handleEntityNotFound(_0x260386,null))['then'](function(_0x49bd6a){if(_0x49bd6a){_0x1c26a0['body']['AccountId']=_0x49bd6a['id'];_0x1c26a0[_0xf0d4('0x46')]['Subjects']=integrations['getSubjects'](_0x1c26a0[_0xf0d4('0x46')][_0xf0d4('0x4d')],_0x1c26a0[_0xf0d4('0x46')][_0xf0d4('0x28')]);_0x1c26a0['body']['Descriptions']=integrations[_0xf0d4('0x4e')](_0x1c26a0[_0xf0d4('0x46')][_0xf0d4('0x4d')],_0x1c26a0[_0xf0d4('0x46')]['type']);return db['ZohoConfiguration'][_0xf0d4('0x45')](_0x1c26a0['body'],{'include':[{'model':db[_0xf0d4('0x4f')],'as':'Subjects'},{'model':db[_0xf0d4('0x4f')],'as':_0xf0d4('0x50')}]});}return null;})[_0xf0d4('0x40')](respondWithResult(_0x260386,null))[_0xf0d4('0x42')](handleError(_0x260386,null));};function getAccessToken(_0x9ef3fe){return new Promise(function(_0x3b691b,_0x5d14be){var _0x1dd9c;switch(_0x9ef3fe['zone']){case'US':_0x1dd9c=_0xf0d4('0x51');break;case'AU':_0x1dd9c='https://accounts.zoho.com.au';break;case'EU':_0x1dd9c='https://accounts.zoho.eu';break;case'IN':_0x1dd9c=_0xf0d4('0x52');break;case'CN':_0x1dd9c=_0xf0d4('0x53');break;default:_0x1dd9c=_0xf0d4('0x54');break;}var _0x1744c6={'method':_0xf0d4('0x55'),'uri':_0x1dd9c+_0xf0d4('0x56'),'qs':{'refresh_token':_0x9ef3fe[_0xf0d4('0x57')],'client_id':_0x9ef3fe[_0xf0d4('0x58')],'client_secret':_0x9ef3fe[_0xf0d4('0x59')],'grant_type':_0xf0d4('0x5a')},'json':!![]};return rp(_0x1744c6)['then'](function(_0x5f4f62){if(_0x5f4f62[_0xf0d4('0x5b')]){_0x3b691b(_0x5f4f62['access_token']);}else{_0x5d14be(_0xf0d4('0x5c'));}})['catch'](function(_0x3956b4){_0x5d14be(_0x3956b4);});});}exports[_0xf0d4('0x5d')]=function(_0x218ae5,_0x470a02,_0x12db81){var _0x3e0fb7,_0x2d12bf,_0x4b9cfe,_0x526859,_0x3bea30;return db['ZohoAccount']['findOne']({'where':{'id':_0x218ae5[_0xf0d4('0x44')]['id']},'attributes':['id',_0xf0d4('0x5e'),_0xf0d4('0x5f'),_0xf0d4('0x58'),_0xf0d4('0x59'),_0xf0d4('0x60'),_0xf0d4('0x61'),_0xf0d4('0x57')]})[_0xf0d4('0x40')](handleEntityNotFound(_0x470a02,null))[_0xf0d4('0x40')](function(_0xf3627a){_0x3bea30=_0xf3627a;_0x3e0fb7=_0x3bea30[_0xf0d4('0x5e')];_0x2d12bf=_0x3e0fb7===_0xf0d4('0x62')?'eu':_0xf0d4('0x63');_0x4b9cfe=_0x3bea30[_0xf0d4('0x60')];var _0x80d547=_0x4b9cfe[_0xf0d4('0x64')](-0x1);if(_0x80d547==='/'||_0x80d547==='\x5c'||_0x80d547===':'){_0x4b9cfe=_0x4b9cfe['substring'](0x0,_0x4b9cfe[_0xf0d4('0x65')](_0x80d547));}if(!_0x3bea30[_0xf0d4('0x57')]){throw new Error(_0xf0d4('0x66'));}return getAccessToken(_0x3bea30);})[_0xf0d4('0x40')](function(_0x171649){if(_0x171649){return rp({'method':_0xf0d4('0x67'),'uri':util[_0xf0d4('0x68')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2d12bf),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x171649},'json':!![]});}})['then'](function(_0x3beaf1){if(_0x3beaf1){if(_0x3beaf1[_0xf0d4('0x69')]&&_0x3beaf1[_0xf0d4('0x69')][_0xf0d4('0x22')]){throw new Error(_0x3beaf1['response'][_0xf0d4('0x22')][_0xf0d4('0x6a')]);}var _0x45563a=[];var _0x3fb57a=[];var _0x4c4119=['Owner',_0xf0d4('0x6b'),'Description',_0xf0d4('0x6c'),_0xf0d4('0x6d'),_0xf0d4('0x6e'),_0xf0d4('0x6f'),_0xf0d4('0x70')];_0x3fb57a=_[_0xf0d4('0x71')](_0x3beaf1[_0xf0d4('0x30')],function(_0x290a6d){return _0x4c4119[_0xf0d4('0x72')](_0x290a6d[_0xf0d4('0x73')]);});for(var _0x31476e=0x0;_0x31476e<_0x3fb57a['length'];_0x31476e++){if(_0x3fb57a[_0x31476e]['system_mandatory']===![]){_0x45563a['push']({'id':_0x3fb57a[_0x31476e]['id'],'name':_0x3fb57a[_0x31476e][_0xf0d4('0x74')],'custom':_0x3fb57a[_0x31476e][_0xf0d4('0x75')],'options':_0x3fb57a[_0x31476e][_0xf0d4('0x76')]==='picklist'&&_0x3fb57a[_0x31476e][_0xf0d4('0x77')]['length']>-0x1?_[_0xf0d4('0x25')](_0x3fb57a[_0x31476e][_0xf0d4('0x77')],function(_0x5136fe){return{'name':_0x5136fe,'value':_0x5136fe};}):[]});}}return{'count':_0x45563a[_0xf0d4('0x31')],'rows':_0x45563a};}else{return{'count':0x0,'rows':[]};}})[_0xf0d4('0x40')](respondWithResult(_0x470a02,null))[_0xf0d4('0x42')](function(_0x3c8340){var _0x566383=_0x218ae5[_0xf0d4('0x2a')][_0xf0d4('0x78')]?0x1f4:_0x3c8340[_0xf0d4('0x79')]||0x1f4;logger[_0xf0d4('0x22')](_0xf0d4('0x7a'),_0xf0d4('0x5d'),_0x566383,JSON[_0xf0d4('0x7b')](_0x3c8340));delete _0x3c8340['name'];if(_0x566383===0x191){_0x566383=0x190;}_0x470a02[_0xf0d4('0x18')](_0x566383)[_0xf0d4('0x7c')](_0x218ae5['query'][_0xf0d4('0x78')]?{'message':_0xf0d4('0x7d'),'statusCode':_0x3c8340[_0xf0d4('0x79')]}:_0x3c8340);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1b79b4b..1e1ac62 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 _0x017c=['../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','zone','clientSecret','https://accounts.zoho.in','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a6772,_0x6c05d0){var _0x21a255=function(_0x189c41){while(--_0x189c41){_0x3a6772['push'](_0x3a6772['shift']());}};_0x21a255(++_0x6c05d0);}(_0x017c,0x151));var _0xc017=function(_0x124da8,_0x2f4adf){_0x124da8=_0x124da8-0x0;var _0x470b89=_0x017c[_0x124da8];return _0x470b89;};'use strict';var _=require(_0xc017('0x0'));var util=require(_0xc017('0x1'));var logger=require(_0xc017('0x2'))(_0xc017('0x3'));var moment=require(_0xc017('0x4'));var BPromise=require(_0xc017('0x5'));var rp=require(_0xc017('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc017('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xc017('0x8')]=function(_0x47e6bc,_0x2f86c5){return _0x47e6bc[_0xc017('0x9')](_0xc017('0xa'),attributes,{'tableName':_0xc017('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24a545,_0x35b9c6,_0x5a7f3d){if(_0x24a545[_0xc017('0xc')]('zone')||_0x24a545[_0xc017('0xc')]('serverUrl')||_0x24a545[_0xc017('0xc')]('clientId')||_0x24a545[_0xc017('0xc')]('clientSecret')||_0x24a545[_0xc017('0xc')](_0xc017('0xd'))||_0x24a545[_0xc017('0xc')](_0xc017('0xe'))){var _0x140a39,_0x48dcfc;_0x140a39=_0x24a545[_0xc017('0xf')];var _0xbcad1b=_0x140a39[_0xc017('0x10')](-0x1);if(_0xbcad1b==='/'||_0xbcad1b==='\x5c'||_0xbcad1b===':'){_0x140a39=_0x140a39[_0xc017('0x11')](0x0,_0x140a39[_0xc017('0x12')](_0xbcad1b));}switch(_0x24a545['zone']){case'US':_0x48dcfc=_0xc017('0x13');break;case'AU':_0x48dcfc=_0xc017('0x14');break;case'IN':_0x48dcfc='https://accounts.zoho.in';break;case'CN':_0x48dcfc=_0xc017('0x15');break;default:_0x48dcfc=_0xc017('0x16');break;}var _0x373413={'method':_0xc017('0x17'),'uri':_0x48dcfc+_0xc017('0x18'),'form':{'grant_type':_0xc017('0x19'),'client_id':_0x24a545[_0xc017('0x1a')],'client_secret':_0x24a545['clientSecret'],'redirect_uri':_0x24a545[_0xc017('0xf')],'code':_0x24a545[_0xc017('0xd')]},'headers':{'Content-Type':_0xc017('0x1b')}};return rp(_0x373413)[_0xc017('0x1c')](function(_0x389867){var _0x44e069=JSON[_0xc017('0x1d')](_0x389867);if(_0x44e069[_0xc017('0x1e')]){_0x24a545[_0xc017('0x1f')]=_0x44e069[_0xc017('0x1e')];logger[_0xc017('0x20')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x24a545['name'],_0x24a545['id']));}else{logger['error'](util[_0xc017('0x21')](_0xc017('0x22'),_0x24a545[_0xc017('0x23')],_0x24a545['id']),util[_0xc017('0x24')](_0x44e069,{'showHidden':![],'depth':null}));}return _0x5a7f3d(null,_0x35b9c6);})['catch'](function(_0x18516f){logger[_0xc017('0x25')](util[_0xc017('0x21')](_0xc017('0x22'),_0x24a545['name'],_0x24a545['id']),util[_0xc017('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a7f3d(_0x18516f);});}else{return _0x5a7f3d(null,_0x35b9c6);}},'beforeUpdate':function(_0x41abbb,_0x2fdff1,_0x5de2d6){if(_0x41abbb['changed'](_0xc017('0x26'))||_0x41abbb[_0xc017('0xc')]('serverUrl')||_0x41abbb[_0xc017('0xc')](_0xc017('0x1a'))||_0x41abbb[_0xc017('0xc')](_0xc017('0x27'))||_0x41abbb[_0xc017('0xc')](_0xc017('0xd'))||_0x41abbb[_0xc017('0xc')]('host')){var _0x16e6fb,_0x312f0f;_0x16e6fb=_0x41abbb[_0xc017('0xf')];var _0x45a104=_0x16e6fb[_0xc017('0x10')](-0x1);if(_0x45a104==='/'||_0x45a104==='\x5c'||_0x45a104===':'){_0x16e6fb=_0x16e6fb[_0xc017('0x11')](0x0,_0x16e6fb[_0xc017('0x12')](_0x45a104));}switch(_0x41abbb[_0xc017('0x26')]){case'US':_0x312f0f=_0xc017('0x13');break;case'AU':_0x312f0f=_0xc017('0x14');break;case'IN':_0x312f0f=_0xc017('0x28');break;case'CN':_0x312f0f='https://accounts.zoho.com.cn';break;default:_0x312f0f=_0xc017('0x16');break;}var _0x3747c6={'method':_0xc017('0x17'),'uri':_0x312f0f+_0xc017('0x18'),'form':{'grant_type':_0xc017('0x19'),'client_id':_0x41abbb['clientId'],'client_secret':_0x41abbb['clientSecret'],'redirect_uri':_0x41abbb[_0xc017('0xf')],'code':_0x41abbb[_0xc017('0xd')]},'headers':{'Content-Type':_0xc017('0x1b')}};return rp(_0x3747c6)[_0xc017('0x1c')](function(_0x3db484){var _0x23d375=JSON[_0xc017('0x1d')](_0x3db484);if(_0x23d375[_0xc017('0x1e')]){_0x41abbb[_0xc017('0x1f')]=_0x23d375[_0xc017('0x1e')];logger[_0xc017('0x20')](util['format'](_0xc017('0x29'),_0x41abbb[_0xc017('0x23')],_0x41abbb['id']));}else{logger[_0xc017('0x25')](util[_0xc017('0x21')](_0xc017('0x22'),_0x41abbb['name'],_0x41abbb['id']),util[_0xc017('0x24')](_0x23d375,{'showHidden':![],'depth':null}));}return _0x5de2d6(null,_0x2fdff1);})[_0xc017('0x2a')](function(_0x5cf4a9){logger['error'](util[_0xc017('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41abbb[_0xc017('0x23')],_0x41abbb['id']),util[_0xc017('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5de2d6(_0x5cf4a9);});}else{return _0x5de2d6(null,_0x2fdff1);}}}});}; \ No newline at end of file +var _0xbd23=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','changed','zone','serverUrl','clientId','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','substring','/oauth/v2/token','then','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x42e229,_0x456ecc){var _0x1c27d1=function(_0x3b1edd){while(--_0x3b1edd){_0x42e229['push'](_0x42e229['shift']());}};_0x1c27d1(++_0x456ecc);}(_0xbd23,0x9d));var _0x3bd2=function(_0x1e8194,_0x119f3d){_0x1e8194=_0x1e8194-0x0;var _0x1493e1=_0xbd23[_0x1e8194];return _0x1493e1;};'use strict';var _=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var logger=require('../../config/logger')(_0x3bd2('0x2'));var moment=require('moment');var BPromise=require(_0x3bd2('0x3'));var rp=require(_0x3bd2('0x4'));var fs=require('fs');var path=require(_0x3bd2('0x5'));var rimraf=require(_0x3bd2('0x6'));var config=require(_0x3bd2('0x7'));var attributes=require(_0x3bd2('0x8'));var integrations=require(_0x3bd2('0x9'));module[_0x3bd2('0xa')]=function(_0x46eaac,_0x26a33b){return _0x46eaac['define'](_0x3bd2('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25b5fa,_0x42f9a7,_0x4023a2){if(_0x25b5fa[_0x3bd2('0xc')](_0x3bd2('0xd'))||_0x25b5fa[_0x3bd2('0xc')](_0x3bd2('0xe'))||_0x25b5fa[_0x3bd2('0xc')](_0x3bd2('0xf'))||_0x25b5fa[_0x3bd2('0xc')]('clientSecret')||_0x25b5fa['changed'](_0x3bd2('0x10'))||_0x25b5fa['changed'](_0x3bd2('0x11'))){var _0xfd09f6,_0x1fa26d;_0xfd09f6=_0x25b5fa['serverUrl'];var _0x474e58=_0xfd09f6['slice'](-0x1);if(_0x474e58==='/'||_0x474e58==='\x5c'||_0x474e58===':'){_0xfd09f6=_0xfd09f6['substring'](0x0,_0xfd09f6[_0x3bd2('0x12')](_0x474e58));}switch(_0x25b5fa['zone']){case'US':_0x1fa26d=_0x3bd2('0x13');break;case'AU':_0x1fa26d=_0x3bd2('0x14');break;case'IN':_0x1fa26d=_0x3bd2('0x15');break;case'CN':_0x1fa26d=_0x3bd2('0x16');break;default:_0x1fa26d=_0x3bd2('0x17');break;}var _0x57c78d={'method':_0x3bd2('0x18'),'uri':_0x1fa26d+'/oauth/v2/token','form':{'grant_type':_0x3bd2('0x19'),'client_id':_0x25b5fa[_0x3bd2('0xf')],'client_secret':_0x25b5fa[_0x3bd2('0x1a')],'redirect_uri':_0x25b5fa[_0x3bd2('0xe')],'code':_0x25b5fa['code']},'headers':{'Content-Type':_0x3bd2('0x1b')}};return rp(_0x57c78d)['then'](function(_0x2dee1d){var _0x4b88f9=JSON['parse'](_0x2dee1d);if(_0x4b88f9[_0x3bd2('0x1c')]){_0x25b5fa[_0x3bd2('0x1d')]=_0x4b88f9[_0x3bd2('0x1c')];logger[_0x3bd2('0x1e')](util[_0x3bd2('0x1f')](_0x3bd2('0x20'),_0x25b5fa[_0x3bd2('0x21')],_0x25b5fa['id']));}else{logger[_0x3bd2('0x22')](util['format'](_0x3bd2('0x23'),_0x25b5fa[_0x3bd2('0x21')],_0x25b5fa['id']),util['inspect'](_0x4b88f9,{'showHidden':![],'depth':null}));}return _0x4023a2(null,_0x42f9a7);})[_0x3bd2('0x24')](function(_0x48dd87){logger['error'](util['format'](_0x3bd2('0x23'),_0x25b5fa['name'],_0x25b5fa['id']),util[_0x3bd2('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4023a2(_0x48dd87);});}else{return _0x4023a2(null,_0x42f9a7);}},'beforeUpdate':function(_0x5614de,_0x32020c,_0x2a9fab){if(_0x5614de[_0x3bd2('0xc')](_0x3bd2('0xd'))||_0x5614de[_0x3bd2('0xc')]('serverUrl')||_0x5614de[_0x3bd2('0xc')](_0x3bd2('0xf'))||_0x5614de[_0x3bd2('0xc')](_0x3bd2('0x1a'))||_0x5614de['changed'](_0x3bd2('0x10'))||_0x5614de[_0x3bd2('0xc')](_0x3bd2('0x11'))){var _0x577d23,_0x3eb0a5;_0x577d23=_0x5614de[_0x3bd2('0xe')];var _0x2cf8ef=_0x577d23['slice'](-0x1);if(_0x2cf8ef==='/'||_0x2cf8ef==='\x5c'||_0x2cf8ef===':'){_0x577d23=_0x577d23[_0x3bd2('0x26')](0x0,_0x577d23[_0x3bd2('0x12')](_0x2cf8ef));}switch(_0x5614de[_0x3bd2('0xd')]){case'US':_0x3eb0a5=_0x3bd2('0x13');break;case'AU':_0x3eb0a5=_0x3bd2('0x14');break;case'IN':_0x3eb0a5='https://accounts.zoho.in';break;case'CN':_0x3eb0a5=_0x3bd2('0x16');break;default:_0x3eb0a5='https://accounts.zoho.eu';break;}var _0x173df0={'method':'POST','uri':_0x3eb0a5+_0x3bd2('0x27'),'form':{'grant_type':_0x3bd2('0x19'),'client_id':_0x5614de[_0x3bd2('0xf')],'client_secret':_0x5614de[_0x3bd2('0x1a')],'redirect_uri':_0x5614de['serverUrl'],'code':_0x5614de[_0x3bd2('0x10')]},'headers':{'Content-Type':_0x3bd2('0x1b')}};return rp(_0x173df0)[_0x3bd2('0x28')](function(_0x398b3b){var _0x464eb2=JSON['parse'](_0x398b3b);if(_0x464eb2[_0x3bd2('0x1c')]){_0x5614de['refreshToken']=_0x464eb2[_0x3bd2('0x1c')];logger[_0x3bd2('0x1e')](util[_0x3bd2('0x1f')](_0x3bd2('0x20'),_0x5614de[_0x3bd2('0x21')],_0x5614de['id']));}else{logger[_0x3bd2('0x22')](util[_0x3bd2('0x1f')](_0x3bd2('0x23'),_0x5614de[_0x3bd2('0x21')],_0x5614de['id']),util['inspect'](_0x464eb2,{'showHidden':![],'depth':null}));}return _0x2a9fab(null,_0x32020c);})['catch'](function(_0x43cd88){logger[_0x3bd2('0x22')](util[_0x3bd2('0x1f')](_0x3bd2('0x23'),_0x5614de[_0x3bd2('0x21')],_0x5614de['id']),util[_0x3bd2('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2a9fab(_0x43cd88);});}else{return _0x2a9fab(null,_0x32020c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2030bce..42e23d8 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 _0xd070=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','raw','options','limit','include','model','map','attributes','GetZohoAccount','ShowZohoAccount','ZohoAccount','find','lodash','moment'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xd070,0x8e));var _0x0d07=function(_0x36ed77,_0x100474){_0x36ed77=_0x36ed77-0x0;var _0x43c0cc=_0xd070[_0x36ed77];return _0x43c0cc;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['GetZohoAccount']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['ZohoAccount'][_0x0d07('0x18')]({'raw':_0x187df2['options']?_0x187df2['options'][_0x0d07('0x19')]===undefined?!![]:![]:!![],'where':_0x187df2['options']?_0x187df2[_0x0d07('0x1a')]['where']||null:null,'attributes':_0x187df2[_0x0d07('0x1a')]?_0x187df2['options']['attributes']||null:null,'limit':_0x187df2[_0x0d07('0x1a')]?_0x187df2[_0x0d07('0x1a')][_0x0d07('0x1b')]||null:null,'include':_0x187df2['options']?_0x187df2[_0x0d07('0x1a')]['include']?_['map'](_0x187df2[_0x0d07('0x1a')][_0x0d07('0x1c')],function(_0xd42245){return{'model':db[_0xd42245[_0x0d07('0x1d')]],'as':_0xd42245['as'],'attributes':_0xd42245['attributes'],'include':_0xd42245['include']?_[_0x0d07('0x1e')](_0xd42245['include'],function(_0x43c7ac){return{'model':db[_0x43c7ac[_0x0d07('0x1d')]],'as':_0x43c7ac['as'],'attributes':_0x43c7ac['attributes'],'include':_0x43c7ac[_0x0d07('0x1c')]?_['map'](_0x43c7ac['include'],function(_0x5da34f){return{'model':db[_0x5da34f[_0x0d07('0x1d')]],'as':_0x5da34f['as'],'attributes':_0x5da34f[_0x0d07('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0d07('0xd')](function(_0x25633b){logger[_0x0d07('0xe')](_0x0d07('0x20'),_0x187df2);logger[_0x0d07('0x11')](_0x0d07('0x20'),_0x187df2,JSON['stringify'](_0x25633b));_0x52cb4b(_0x25633b);})['catch'](function(_0x282468){logger[_0x0d07('0x13')](_0x0d07('0x20'),_0x282468[_0x0d07('0x15')],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x282468[_0x0d07('0x15')]));});});};exports[_0x0d07('0x21')]=function(_0x314916){var _0x240dc0=this;return new Promise(function(_0xa0c281,_0x3d0663){return db[_0x0d07('0x22')][_0x0d07('0x23')]({'raw':_0x314916[_0x0d07('0x1a')]?_0x314916[_0x0d07('0x1a')][_0x0d07('0x19')]===undefined?!![]:![]:!![],'where':_0x314916[_0x0d07('0x1a')]?_0x314916[_0x0d07('0x1a')]['where']||null:null,'attributes':_0x314916['options']?_0x314916['options'][_0x0d07('0x1f')]||null:null,'include':_0x314916[_0x0d07('0x1a')]?_0x314916['options'][_0x0d07('0x1c')]?_[_0x0d07('0x1e')](_0x314916[_0x0d07('0x1a')][_0x0d07('0x1c')],function(_0x5e847a){return{'model':db[_0x5e847a[_0x0d07('0x1d')]],'as':_0x5e847a['as'],'attributes':_0x5e847a['attributes'],'include':_0x5e847a[_0x0d07('0x1c')]?_['map'](_0x5e847a['include'],function(_0x63f32c){return{'model':db[_0x63f32c['model']],'as':_0x63f32c['as'],'attributes':_0x63f32c['attributes'],'include':_0x63f32c[_0x0d07('0x1c')]?_[_0x0d07('0x1e')](_0x63f32c[_0x0d07('0x1c')],function(_0x3b6af9){return{'model':db[_0x3b6af9[_0x0d07('0x1d')]],'as':_0x3b6af9['as'],'attributes':_0x3b6af9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5547bb){logger[_0x0d07('0xe')](_0x0d07('0x21'),_0x314916);logger[_0x0d07('0x11')](_0x0d07('0x21'),_0x314916,JSON[_0x0d07('0x12')](_0x5547bb));_0xa0c281(_0x5547bb);})[_0x0d07('0x17')](function(_0x3ab9d6){logger[_0x0d07('0x13')](_0x0d07('0x21'),_0x3ab9d6['message'],_0x314916);_0x3d0663(_0x240dc0['error'](0x1f4,_0x3ab9d6[_0x0d07('0x15')]));});});}; \ No newline at end of file +var _0x4d68=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','limit','include','attributes','map','model','ShowZohoAccount','find','raw','then','lodash','util','moment','bluebird'];(function(_0x641503,_0x170746){var _0x4fb9c1=function(_0x10d299){while(--_0x10d299){_0x641503['push'](_0x641503['shift']());}};_0x4fb9c1(++_0x170746);}(_0x4d68,0x1c3));var _0x84d6=function(_0xdbb6cb,_0x3b8fda){_0xdbb6cb=_0xdbb6cb-0x0;var _0x476b50=_0x4d68[_0xdbb6cb];return _0x476b50;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require(_0x84d6('0x3'));var rs=require(_0x84d6('0x4'));var fs=require('fs');var Redis=require(_0x84d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x6'));var logger=require('../../config/logger')(_0x84d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x84d6('0x8'));var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539e34,_0x561dd8,_0x218daf){return new BPromise(function(_0xa64ed3,_0x260859){return client[_0x84d6('0xb')](_0x539e34,_0x218daf)['then'](function(_0x411c7f){logger['info'](_0x84d6('0xc'),_0x561dd8,_0x84d6('0xd'));logger[_0x84d6('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x561dd8,'request\x20sent',JSON[_0x84d6('0xf')](_0x411c7f));if(_0x411c7f['error']){if(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x11')]===0x1f4){logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')]['message']);return _0x260859(_0x411c7f[_0x84d6('0x10')]['message']);}logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);return _0xa64ed3(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);}else{logger[_0x84d6('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x561dd8,_0x84d6('0xd'));_0xa64ed3(_0x411c7f[_0x84d6('0x14')][_0x84d6('0x12')]);}})[_0x84d6('0x15')](function(_0x385e2b){logger['error'](_0x84d6('0xc'),_0x561dd8,_0x385e2b);_0x260859(_0x385e2b);});});}exports[_0x84d6('0x16')]=function(_0x579aa8){var _0x1bd84a=this;return new Promise(function(_0x47a884,_0x309f26){return db[_0x84d6('0x17')][_0x84d6('0x18')]({'raw':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['where']||null:null,'attributes':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')]['attributes']||null:null,'limit':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')][_0x84d6('0x1a')]||null:null,'include':_0x579aa8[_0x84d6('0x19')]?_0x579aa8['options'][_0x84d6('0x1b')]?_['map'](_0x579aa8['options'][_0x84d6('0x1b')],function(_0x1b86f2){return{'model':db[_0x1b86f2['model']],'as':_0x1b86f2['as'],'attributes':_0x1b86f2[_0x84d6('0x1c')],'include':_0x1b86f2[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x1b86f2[_0x84d6('0x1b')],function(_0x5deaa5){return{'model':db[_0x5deaa5[_0x84d6('0x1e')]],'as':_0x5deaa5['as'],'attributes':_0x5deaa5['attributes'],'include':_0x5deaa5[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x5deaa5['include'],function(_0x500a81){return{'model':db[_0x500a81[_0x84d6('0x1e')]],'as':_0x500a81['as'],'attributes':_0x500a81['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14eec8){logger['info'](_0x84d6('0x16'),_0x579aa8);logger['debug'](_0x84d6('0x16'),_0x579aa8,JSON[_0x84d6('0xf')](_0x14eec8));_0x47a884(_0x14eec8);})[_0x84d6('0x15')](function(_0x37adf9){logger[_0x84d6('0x10')](_0x84d6('0x16'),_0x37adf9[_0x84d6('0x12')],_0x579aa8);_0x309f26(_0x1bd84a[_0x84d6('0x10')](0x1f4,_0x37adf9[_0x84d6('0x12')]));});});};exports[_0x84d6('0x1f')]=function(_0x20c27b){var _0x1fa278=this;return new Promise(function(_0x56bc23,_0x2f60f1){return db[_0x84d6('0x17')][_0x84d6('0x20')]({'raw':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')][_0x84d6('0x21')]===undefined?!![]:![]:!![],'where':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')]['where']||null:null,'attributes':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1c')]||null:null,'include':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x20c27b['options'][_0x84d6('0x1b')],function(_0x6c3a2a){return{'model':db[_0x6c3a2a[_0x84d6('0x1e')]],'as':_0x6c3a2a['as'],'attributes':_0x6c3a2a[_0x84d6('0x1c')],'include':_0x6c3a2a[_0x84d6('0x1b')]?_['map'](_0x6c3a2a[_0x84d6('0x1b')],function(_0xf8d313){return{'model':db[_0xf8d313[_0x84d6('0x1e')]],'as':_0xf8d313['as'],'attributes':_0xf8d313['attributes'],'include':_0xf8d313[_0x84d6('0x1b')]?_['map'](_0xf8d313[_0x84d6('0x1b')],function(_0x525b56){return{'model':db[_0x525b56['model']],'as':_0x525b56['as'],'attributes':_0x525b56[_0x84d6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x84d6('0x22')](function(_0x45b55f){logger['info'](_0x84d6('0x1f'),_0x20c27b);logger[_0x84d6('0xe')](_0x84d6('0x1f'),_0x20c27b,JSON['stringify'](_0x45b55f));_0x56bc23(_0x45b55f);})['catch'](function(_0x531a49){logger[_0x84d6('0x10')](_0x84d6('0x1f'),_0x531a49[_0x84d6('0x12')],_0x20c27b);_0x2f60f1(_0x1fa278[_0x84d6('0x10')](0x1f4,_0x531a49[_0x84d6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f524b73..7e6d313 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 _0x2c0a=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14074b,_0x527cb9){var _0x508226=function(_0x31c5c1){while(--_0x31c5c1){_0x14074b['push'](_0x14074b['shift']());}};_0x508226(++_0x527cb9);}(_0x2c0a,0xd5));var _0xa2c0=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x2c0a[_0x152121];return _0x592a85;};'use strict';var multer=require(_0xa2c0('0x0'));var util=require(_0xa2c0('0x1'));var path=require(_0xa2c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2c0('0x3'));var router=express[_0xa2c0('0x4')]();var fs_extra=require(_0xa2c0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa2c0('0x6'));var config=require(_0xa2c0('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xa2c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xa2c0('0x9')]);router[_0xa2c0('0x8')](_0xa2c0('0xa'),auth[_0xa2c0('0xb')](),controller[_0xa2c0('0xc')]);router[_0xa2c0('0x8')](_0xa2c0('0xd'),auth[_0xa2c0('0xb')](),controller['getFields']);router[_0xa2c0('0x8')](_0xa2c0('0xe'),auth[_0xa2c0('0xb')](),controller['getSubjects']);router[_0xa2c0('0x8')](_0xa2c0('0xf'),auth[_0xa2c0('0xb')](),controller[_0xa2c0('0x10')]);router[_0xa2c0('0x11')]('/',auth[_0xa2c0('0xb')](),controller[_0xa2c0('0x12')]);router[_0xa2c0('0x13')](_0xa2c0('0xa'),auth[_0xa2c0('0xb')](),controller['update']);router['delete'](_0xa2c0('0xa'),auth[_0xa2c0('0xb')](),controller[_0xa2c0('0x14')]);module[_0xa2c0('0x15')]=router; \ No newline at end of file +var _0xc64e=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy'];(function(_0x56ddec,_0x527169){var _0x24d44b=function(_0x4e9b44){while(--_0x4e9b44){_0x56ddec['push'](_0x56ddec['shift']());}};_0x24d44b(++_0x527169);}(_0xc64e,0x15a));var _0xec64=function(_0x548f5e,_0x200e33){_0x548f5e=_0x548f5e-0x0;var _0x307750=_0xc64e[_0x548f5e];return _0x307750;};'use strict';var multer=require(_0xec64('0x0'));var util=require(_0xec64('0x1'));var path=require(_0xec64('0x2'));var timeout=require(_0xec64('0x3'));var express=require('express');var router=express[_0xec64('0x4')]();var fs_extra=require(_0xec64('0x5'));var auth=require(_0xec64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xec64('0x7'));var controller=require(_0xec64('0x8'));router[_0xec64('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec64('0x9')](_0xec64('0xa'),auth[_0xec64('0xb')](),controller[_0xec64('0xc')]);router[_0xec64('0x9')](_0xec64('0xd'),auth[_0xec64('0xb')](),controller[_0xec64('0xe')]);router[_0xec64('0x9')](_0xec64('0xf'),auth['isAuthenticated'](),controller[_0xec64('0x10')]);router[_0xec64('0x9')](_0xec64('0x11'),auth[_0xec64('0xb')](),controller[_0xec64('0x12')]);router['post']('/',auth[_0xec64('0xb')](),controller[_0xec64('0x13')]);router['put'](_0xec64('0xa'),auth['isAuthenticated'](),controller[_0xec64('0x14')]);router['delete']('/:id',auth[_0xec64('0xb')](),controller[_0xec64('0x15')]);module[_0xec64('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 1ed5754..cc8eaad 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 _0x8e52=['STRING','ENUM','lead','contact','nothing','contact_lead','exports'];(function(_0x346597,_0x275261){var _0x4a375a=function(_0x31e083){while(--_0x31e083){_0x346597['push'](_0x346597['shift']());}};_0x4a375a(++_0x275261);}(_0x8e52,0x1c6));var _0x28e5=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x8e52[_0x21c2c8];return _0x4dd745;};'use strict';var Sequelize=require('sequelize');module[_0x28e5('0x0')]={'name':{'type':Sequelize[_0x28e5('0x1')]},'moduleCreate':{'type':Sequelize[_0x28e5('0x2')](_0x28e5('0x3'),_0x28e5('0x4'),_0x28e5('0x5')),'defaultValue':_0x28e5('0x3')},'moduleSearch':{'type':Sequelize[_0x28e5('0x2')](_0x28e5('0x6'),_0x28e5('0x4'),_0x28e5('0x3')),'defaultValue':_0x28e5('0x6')},'description':{'type':Sequelize[_0x28e5('0x1')]}}; \ No newline at end of file +var _0xa970=['exports','STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa970,0x1c7));var _0x0a97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa970[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a97('0x0'));module[_0x0a97('0x1')]={'name':{'type':Sequelize[_0x0a97('0x2')]},'moduleCreate':{'type':Sequelize[_0x0a97('0x3')](_0x0a97('0x4'),_0x0a97('0x5'),_0x0a97('0x6')),'defaultValue':_0x0a97('0x4')},'moduleSearch':{'type':Sequelize[_0x0a97('0x3')](_0x0a97('0x7'),_0x0a97('0x5'),_0x0a97('0x4')),'defaultValue':_0x0a97('0x7')},'description':{'type':Sequelize[_0x0a97('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fc77687..98ef1f4 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 _0x42ee=['ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','ZohoConfiguration','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','update','find','getFields','findOne','getSubjects','getDescriptions','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x227eec,_0x4a4027){var _0x2ee592=function(_0x3cfa11){while(--_0x3cfa11){_0x227eec['push'](_0x227eec['shift']());}};_0x2ee592(++_0x4a4027);}(_0x42ee,0x1ce));var _0xe42e=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x42ee[_0x213518];return _0x1baf75;};'use strict';var emlformat=require(_0xe42e('0x0'));var rimraf=require(_0xe42e('0x1'));var zipdir=require(_0xe42e('0x2'));var jsonpatch=require(_0xe42e('0x3'));var rp=require(_0xe42e('0x4'));var moment=require(_0xe42e('0x5'));var BPromise=require(_0xe42e('0x6'));var Mustache=require(_0xe42e('0x7'));var util=require(_0xe42e('0x8'));var path=require(_0xe42e('0x9'));var sox=require(_0xe42e('0xa'));var csv=require(_0xe42e('0xb'));var ejs=require(_0xe42e('0xc'));var fs=require('fs');var fs_extra=require(_0xe42e('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe42e('0xe'));var jsforce=require(_0xe42e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe42e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe42e('0x10'));var authService=require(_0xe42e('0x11'));var qs=require(_0xe42e('0x12'));var as=require(_0xe42e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe42e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe42e('0x15'));var db=require(_0xe42e('0x16'))['db'];function respondWithStatusCode(_0xa0f3ec,_0x3015af){_0x3015af=_0x3015af||0xcc;return function(_0x5f0855){if(_0x5f0855){return _0xa0f3ec[_0xe42e('0x17')](_0x3015af);}return _0xa0f3ec[_0xe42e('0x18')](_0x3015af)[_0xe42e('0x19')]();};}function respondWithResult(_0x56002b,_0x11dc0d){_0x11dc0d=_0x11dc0d||0xc8;return function(_0x1974ac){if(_0x1974ac){return _0x56002b[_0xe42e('0x18')](_0x11dc0d)['json'](_0x1974ac);}};}function respondWithFilteredResult(_0x33c680,_0x46e15f){return function(_0x2c8cd9){if(_0x2c8cd9){var _0x41c9b5=typeof _0x46e15f['offset']==='undefined'&&typeof _0x46e15f[_0xe42e('0x1a')]==='undefined';var _0x54a516=_0x2c8cd9[_0xe42e('0x1b')];var _0xdc5b33=_0x41c9b5?0x0:_0x46e15f['offset'];var _0x493445=_0x41c9b5?_0x2c8cd9[_0xe42e('0x1b')]:_0x46e15f[_0xe42e('0x1c')]+_0x46e15f[_0xe42e('0x1a')];var _0x18022a;if(_0x493445>=_0x54a516){_0x493445=_0x54a516;_0x18022a=0xc8;}else{_0x18022a=0xce;}_0x33c680[_0xe42e('0x18')](_0x18022a);return _0x33c680[_0xe42e('0x1d')]('Content-Range',_0xdc5b33+'-'+_0x493445+'/'+_0x54a516)[_0xe42e('0x1e')](_0x2c8cd9);}return null;};}function patchUpdates(_0x20da9b){return function(_0x2e9a6d){try{jsonpatch[_0xe42e('0x1f')](_0x2e9a6d,_0x20da9b,!![]);}catch(_0x4c16ec){return BPromise[_0xe42e('0x20')](_0x4c16ec);}return _0x2e9a6d[_0xe42e('0x21')]();};}function saveUpdates(_0x58a9ac,_0x5abf4a){return function(_0x44bb41){if(_0x44bb41){return _0x44bb41['update'](_0x58a9ac)[_0xe42e('0x22')](function(_0x1af1e6){return _0x1af1e6;});}return null;};}function removeEntity(_0x5d9426,_0x5585ba){return function(_0x2ec681){if(_0x2ec681){return _0x2ec681[_0xe42e('0x23')]()[_0xe42e('0x22')](function(){_0x5d9426[_0xe42e('0x18')](0xcc)[_0xe42e('0x19')]();});}};}function handleEntityNotFound(_0x306467,_0x4e4878){return function(_0x49f54a){if(!_0x49f54a){_0x306467[_0xe42e('0x17')](0x194);}return _0x49f54a;};}function handleError(_0x33949d,_0x1ee787){_0x1ee787=_0x1ee787||0x1f4;return function(_0x95d712){logger[_0xe42e('0x24')](_0x95d712[_0xe42e('0x25')]);if(_0x95d712[_0xe42e('0x26')]){delete _0x95d712[_0xe42e('0x26')];}_0x33949d[_0xe42e('0x18')](_0x1ee787)['send'](_0x95d712);};}exports[_0xe42e('0x27')]=function(_0x49781f,_0x586791){var _0x500a04={},_0x30c458={},_0x4527db={'count':0x0,'rows':[]};var _0x1494ed=_[_0xe42e('0x28')](db[_0xe42e('0x29')]['rawAttributes'],function(_0x56f0c6){return{'name':_0x56f0c6[_0xe42e('0x2a')],'type':_0x56f0c6['type'][_0xe42e('0x2b')]};});_0x30c458['model']=_[_0xe42e('0x28')](_0x1494ed,'name');_0x30c458['query']=_['keys'](_0x49781f[_0xe42e('0x2c')]);_0x30c458[_0xe42e('0x2d')]=_[_0xe42e('0x2e')](_0x30c458[_0xe42e('0x2f')],_0x30c458['query']);_0x500a04[_0xe42e('0x30')]=_[_0xe42e('0x2e')](_0x30c458['model'],qs[_0xe42e('0x31')](_0x49781f['query'][_0xe42e('0x31')]));_0x500a04[_0xe42e('0x30')]=_0x500a04['attributes'][_0xe42e('0x32')]?_0x500a04[_0xe42e('0x30')]:_0x30c458[_0xe42e('0x2f')];if(!_0x49781f['query'][_0xe42e('0x33')](_0xe42e('0x34'))){_0x500a04['limit']=qs[_0xe42e('0x1a')](_0x49781f[_0xe42e('0x2c')][_0xe42e('0x1a')]);_0x500a04[_0xe42e('0x1c')]=qs[_0xe42e('0x1c')](_0x49781f[_0xe42e('0x2c')][_0xe42e('0x1c')]);}_0x500a04[_0xe42e('0x35')]=qs[_0xe42e('0x36')](_0x49781f['query'][_0xe42e('0x36')]);_0x500a04[_0xe42e('0x37')]=qs['filters'](_[_0xe42e('0x38')](_0x49781f[_0xe42e('0x2c')],_0x30c458[_0xe42e('0x2d')]),_0x1494ed);if(_0x49781f[_0xe42e('0x2c')][_0xe42e('0x39')]){_0x500a04[_0xe42e('0x37')]=_['merge'](_0x500a04[_0xe42e('0x37')],{'$or':_[_0xe42e('0x28')](_0x1494ed,function(_0x1f1630){if(_0x1f1630[_0xe42e('0x3a')]!==_0xe42e('0x3b')){var _0xf0c51={};_0xf0c51[_0x1f1630[_0xe42e('0x26')]]={'$like':'%'+_0x49781f[_0xe42e('0x2c')][_0xe42e('0x39')]+'%'};return _0xf0c51;}})});}_0x500a04=_[_0xe42e('0x3c')]({},_0x500a04,_0x49781f[_0xe42e('0x3d')]);var _0x1e1f3e={'where':_0x500a04['where']};return db[_0xe42e('0x29')][_0xe42e('0x1b')](_0x1e1f3e)[_0xe42e('0x22')](function(_0x473435){_0x4527db[_0xe42e('0x1b')]=_0x473435;if(_0x49781f[_0xe42e('0x2c')][_0xe42e('0x3e')]){_0x500a04[_0xe42e('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xe42e('0x40')](_0x500a04);})[_0xe42e('0x22')](function(_0x312179){_0x4527db[_0xe42e('0x41')]=_0x312179;return _0x4527db;})['then'](respondWithFilteredResult(_0x586791,_0x500a04))[_0xe42e('0x42')](handleError(_0x586791,null));};exports['show']=function(_0x354783,_0x49d87c){var _0x4e3866={'raw':![],'where':{'id':_0x354783[_0xe42e('0x43')]['id']}},_0x313386={};_0x313386[_0xe42e('0x2f')]=_[_0xe42e('0x44')](db[_0xe42e('0x29')][_0xe42e('0x45')]);_0x313386['query']=_[_0xe42e('0x44')](_0x354783[_0xe42e('0x2c')]);_0x313386[_0xe42e('0x2d')]=_[_0xe42e('0x2e')](_0x313386['model'],_0x313386['query']);_0x4e3866[_0xe42e('0x30')]=_[_0xe42e('0x2e')](_0x313386[_0xe42e('0x2f')],qs[_0xe42e('0x31')](_0x354783[_0xe42e('0x2c')]['fields']));_0x4e3866[_0xe42e('0x30')]=_0x4e3866['attributes'][_0xe42e('0x32')]?_0x4e3866['attributes']:_0x313386['model'];if(_0x354783['query'][_0xe42e('0x3e')]){_0x4e3866[_0xe42e('0x3f')]=[{'all':!![]}];}_0x4e3866=_[_0xe42e('0x3c')]({},_0x4e3866,_0x354783[_0xe42e('0x3d')]);return db[_0xe42e('0x29')]['find'](_0x4e3866)['then'](handleEntityNotFound(_0x49d87c,null))['then'](respondWithResult(_0x49d87c,null))[_0xe42e('0x42')](handleError(_0x49d87c,null));};exports[_0xe42e('0x46')]=function(_0xe40272,_0x273b7b){return db[_0xe42e('0x29')][_0xe42e('0x46')](_0xe40272[_0xe42e('0x47')],{})[_0xe42e('0x22')](respondWithResult(_0x273b7b,0xc9))[_0xe42e('0x42')](handleError(_0x273b7b,null));};exports[_0xe42e('0x48')]=function(_0x158313,_0x3e005b){if(_0x158313[_0xe42e('0x47')]['id']){delete _0x158313[_0xe42e('0x47')]['id'];}return db[_0xe42e('0x29')]['find']({'where':{'id':_0x158313['params']['id']}})['then'](handleEntityNotFound(_0x3e005b,null))['then'](saveUpdates(_0x158313[_0xe42e('0x47')],null))[_0xe42e('0x22')](respondWithResult(_0x3e005b,null))[_0xe42e('0x42')](handleError(_0x3e005b,null));};exports['destroy']=function(_0x23651e,_0x5487fb){return db['ZohoConfiguration'][_0xe42e('0x49')]({'where':{'id':_0x23651e[_0xe42e('0x43')]['id']}})[_0xe42e('0x22')](handleEntityNotFound(_0x5487fb,null))[_0xe42e('0x22')](removeEntity(_0x5487fb,null))[_0xe42e('0x42')](handleError(_0x5487fb,null));};exports[_0xe42e('0x4a')]=function(_0x224f1c,_0x232a13,_0x22a3b2){var _0x2879b2={};var _0x23a0f2={};var _0x60f49a;var _0x3a90af;return db['ZohoConfiguration'][_0xe42e('0x4b')]({'where':{'id':_0x224f1c[_0xe42e('0x43')]['id']}})[_0xe42e('0x22')](handleEntityNotFound(_0x232a13,null))[_0xe42e('0x22')](function(_0x5bbe8f){if(_0x5bbe8f){_0x60f49a=_0x5bbe8f;_0x23a0f2['model']=_[_0xe42e('0x44')](db['ZohoField'][_0xe42e('0x45')]);_0x23a0f2[_0xe42e('0x2c')]=_[_0xe42e('0x44')](_0x224f1c['query']);_0x23a0f2[_0xe42e('0x2d')]=_['intersection'](_0x23a0f2[_0xe42e('0x2f')],_0x23a0f2[_0xe42e('0x2c')]);_0x2879b2[_0xe42e('0x30')]=_[_0xe42e('0x2e')](_0x23a0f2[_0xe42e('0x2f')],qs[_0xe42e('0x31')](_0x224f1c[_0xe42e('0x2c')]['fields']));_0x2879b2['attributes']=_0x2879b2[_0xe42e('0x30')][_0xe42e('0x32')]?_0x2879b2['attributes']:_0x23a0f2[_0xe42e('0x2f')];_0x2879b2['order']=qs['sort'](_0x224f1c[_0xe42e('0x2c')][_0xe42e('0x36')]);_0x2879b2['where']=qs['filters'](_[_0xe42e('0x38')](_0x224f1c[_0xe42e('0x2c')],_0x23a0f2['filters']));if(_0x224f1c[_0xe42e('0x2c')]['filter']){_0x2879b2['where']=_[_0xe42e('0x3c')](_0x2879b2[_0xe42e('0x37')],{'$or':_['map'](_0x2879b2['attributes'],function(_0x1f6265){var _0xfbe79d={};_0xfbe79d[_0x1f6265]={'$like':'%'+_0x224f1c[_0xe42e('0x2c')][_0xe42e('0x39')]+'%'};return _0xfbe79d;})});}_0x2879b2=_[_0xe42e('0x3c')]({},_0x2879b2,_0x224f1c['options']);return _0x60f49a[_0xe42e('0x4a')](_0x2879b2);}})[_0xe42e('0x22')](function(_0xfeee3c){if(_0xfeee3c){_0x3a90af=_0xfeee3c[_0xe42e('0x32')];if(!_0x224f1c[_0xe42e('0x2c')][_0xe42e('0x33')]('nolimit')){_0x2879b2['limit']=qs[_0xe42e('0x1a')](_0x224f1c[_0xe42e('0x2c')]['limit']);_0x2879b2[_0xe42e('0x1c')]=qs[_0xe42e('0x1c')](_0x224f1c[_0xe42e('0x2c')][_0xe42e('0x1c')]);}return _0x60f49a[_0xe42e('0x4a')](_0x2879b2);}})[_0xe42e('0x22')](function(_0x96f781){if(_0x96f781){return _0x96f781?{'count':_0x3a90af,'rows':_0x96f781}:null;}})[_0xe42e('0x22')](respondWithResult(_0x232a13,null))[_0xe42e('0x42')](handleError(_0x232a13,null));};exports[_0xe42e('0x4c')]=function(_0xd0cc74,_0x35cf91,_0x1b3be0){var _0x5ca1a2={};var _0x2ccf3a={};var _0x33ad9a;var _0x2fba93;return db['ZohoConfiguration'][_0xe42e('0x4b')]({'where':{'id':_0xd0cc74[_0xe42e('0x43')]['id']}})[_0xe42e('0x22')](handleEntityNotFound(_0x35cf91,null))[_0xe42e('0x22')](function(_0x4ba20b){if(_0x4ba20b){_0x33ad9a=_0x4ba20b;_0x2ccf3a['model']=_[_0xe42e('0x44')](db['ZohoField'][_0xe42e('0x45')]);_0x2ccf3a[_0xe42e('0x2c')]=_[_0xe42e('0x44')](_0xd0cc74[_0xe42e('0x2c')]);_0x2ccf3a[_0xe42e('0x2d')]=_[_0xe42e('0x2e')](_0x2ccf3a['model'],_0x2ccf3a['query']);_0x5ca1a2[_0xe42e('0x30')]=_[_0xe42e('0x2e')](_0x2ccf3a[_0xe42e('0x2f')],qs['fields'](_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x31')]));_0x5ca1a2[_0xe42e('0x30')]=_0x5ca1a2[_0xe42e('0x30')][_0xe42e('0x32')]?_0x5ca1a2[_0xe42e('0x30')]:_0x2ccf3a[_0xe42e('0x2f')];_0x5ca1a2['order']=qs[_0xe42e('0x36')](_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x36')]);_0x5ca1a2[_0xe42e('0x37')]=qs[_0xe42e('0x2d')](_[_0xe42e('0x38')](_0xd0cc74[_0xe42e('0x2c')],_0x2ccf3a['filters']));if(_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x39')]){_0x5ca1a2['where']=_[_0xe42e('0x3c')](_0x5ca1a2[_0xe42e('0x37')],{'$or':_[_0xe42e('0x28')](_0x5ca1a2[_0xe42e('0x30')],function(_0x4b3ee0){var _0x289c55={};_0x289c55[_0x4b3ee0]={'$like':'%'+_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x39')]+'%'};return _0x289c55;})});}_0x5ca1a2=_[_0xe42e('0x3c')]({},_0x5ca1a2,_0xd0cc74[_0xe42e('0x3d')]);return _0x33ad9a[_0xe42e('0x4c')](_0x5ca1a2);}})[_0xe42e('0x22')](function(_0x15cc7e){if(_0x15cc7e){_0x2fba93=_0x15cc7e[_0xe42e('0x32')];if(!_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x33')](_0xe42e('0x34'))){_0x5ca1a2[_0xe42e('0x1a')]=qs[_0xe42e('0x1a')](_0xd0cc74[_0xe42e('0x2c')][_0xe42e('0x1a')]);_0x5ca1a2['offset']=qs[_0xe42e('0x1c')](_0xd0cc74['query'][_0xe42e('0x1c')]);}return _0x33ad9a[_0xe42e('0x4c')](_0x5ca1a2);}})[_0xe42e('0x22')](function(_0x3de56d){if(_0x3de56d){return _0x3de56d?{'count':_0x2fba93,'rows':_0x3de56d}:null;}})[_0xe42e('0x22')](respondWithResult(_0x35cf91,null))[_0xe42e('0x42')](handleError(_0x35cf91,null));};exports[_0xe42e('0x4d')]=function(_0x1cb875,_0x31d4f2,_0x3a90db){var _0x212b5c={};var _0x2a1936={};var _0x1fbf52;var _0x325cc5;return db[_0xe42e('0x29')][_0xe42e('0x4b')]({'where':{'id':_0x1cb875[_0xe42e('0x43')]['id']}})[_0xe42e('0x22')](handleEntityNotFound(_0x31d4f2,null))['then'](function(_0x7a584c){if(_0x7a584c){_0x1fbf52=_0x7a584c;_0x2a1936[_0xe42e('0x2f')]=_[_0xe42e('0x44')](db[_0xe42e('0x4e')]['rawAttributes']);_0x2a1936['query']=_[_0xe42e('0x44')](_0x1cb875[_0xe42e('0x2c')]);_0x2a1936[_0xe42e('0x2d')]=_[_0xe42e('0x2e')](_0x2a1936['model'],_0x2a1936[_0xe42e('0x2c')]);_0x212b5c['attributes']=_[_0xe42e('0x2e')](_0x2a1936['model'],qs['fields'](_0x1cb875[_0xe42e('0x2c')][_0xe42e('0x31')]));_0x212b5c[_0xe42e('0x30')]=_0x212b5c[_0xe42e('0x30')][_0xe42e('0x32')]?_0x212b5c[_0xe42e('0x30')]:_0x2a1936[_0xe42e('0x2f')];_0x212b5c[_0xe42e('0x35')]=qs[_0xe42e('0x36')](_0x1cb875[_0xe42e('0x2c')][_0xe42e('0x36')]);_0x212b5c[_0xe42e('0x37')]=qs['filters'](_[_0xe42e('0x38')](_0x1cb875[_0xe42e('0x2c')],_0x2a1936[_0xe42e('0x2d')]));if(_0x1cb875['query']['filter']){_0x212b5c[_0xe42e('0x37')]=_['merge'](_0x212b5c[_0xe42e('0x37')],{'$or':_[_0xe42e('0x28')](_0x212b5c[_0xe42e('0x30')],function(_0x13e37b){var _0x50c54c={};_0x50c54c[_0x13e37b]={'$like':'%'+_0x1cb875[_0xe42e('0x2c')]['filter']+'%'};return _0x50c54c;})});}_0x212b5c=_[_0xe42e('0x3c')]({},_0x212b5c,_0x1cb875[_0xe42e('0x3d')]);return _0x1fbf52['getDescriptions'](_0x212b5c);}})[_0xe42e('0x22')](function(_0x10f170){if(_0x10f170){_0x325cc5=_0x10f170['length'];if(!_0x1cb875[_0xe42e('0x2c')][_0xe42e('0x33')](_0xe42e('0x34'))){_0x212b5c[_0xe42e('0x1a')]=qs['limit'](_0x1cb875['query'][_0xe42e('0x1a')]);_0x212b5c['offset']=qs[_0xe42e('0x1c')](_0x1cb875['query'][_0xe42e('0x1c')]);}return _0x1fbf52[_0xe42e('0x4d')](_0x212b5c);}})[_0xe42e('0x22')](function(_0x5a29a8){if(_0x5a29a8){return _0x5a29a8?{'count':_0x325cc5,'rows':_0x5a29a8}:null;}})[_0xe42e('0x22')](respondWithResult(_0x31d4f2,null))[_0xe42e('0x42')](handleError(_0x31d4f2,null));}; \ No newline at end of file +var _0x4a76=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','params','includeAll','find','create','body','getFields','findOne','nolimit','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x98c64,_0x5d246d){var _0x1201e8=function(_0x4b6f3e){while(--_0x4b6f3e){_0x98c64['push'](_0x98c64['shift']());}};_0x1201e8(++_0x5d246d);}(_0x4a76,0x1cf));var _0x64a7=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4a76[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0x64a7('0x0'));var rimraf=require(_0x64a7('0x1'));var zipdir=require(_0x64a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64a7('0x3'));var moment=require('moment');var BPromise=require(_0x64a7('0x4'));var Mustache=require('mustache');var util=require(_0x64a7('0x5'));var path=require(_0x64a7('0x6'));var sox=require(_0x64a7('0x7'));var csv=require(_0x64a7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64a7('0x9'));var _=require(_0x64a7('0xa'));var squel=require(_0x64a7('0xb'));var crypto=require(_0x64a7('0xc'));var jsforce=require(_0x64a7('0xd'));var deskjs=require(_0x64a7('0xe'));var toCsv=require(_0x64a7('0x8'));var querystring=require(_0x64a7('0xf'));var Papa=require('papaparse');var Redis=require(_0x64a7('0x10'));var authService=require(_0x64a7('0x11'));var qs=require(_0x64a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64a7('0x13'));var logger=require(_0x64a7('0x14'))(_0x64a7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x64a7('0x16'));var db=require(_0x64a7('0x17'))['db'];function respondWithStatusCode(_0x105d11,_0x3d13eb){_0x3d13eb=_0x3d13eb||0xcc;return function(_0x518711){if(_0x518711){return _0x105d11['sendStatus'](_0x3d13eb);}return _0x105d11[_0x64a7('0x18')](_0x3d13eb)[_0x64a7('0x19')]();};}function respondWithResult(_0x504285,_0x382aaf){_0x382aaf=_0x382aaf||0xc8;return function(_0x1675cc){if(_0x1675cc){return _0x504285[_0x64a7('0x18')](_0x382aaf)[_0x64a7('0x1a')](_0x1675cc);}};}function respondWithFilteredResult(_0xcce44a,_0x39229a){return function(_0x2359c6){if(_0x2359c6){var _0x2aa98a=typeof _0x39229a[_0x64a7('0x1b')]===_0x64a7('0x1c')&&typeof _0x39229a[_0x64a7('0x1d')]==='undefined';var _0x35a254=_0x2359c6[_0x64a7('0x1e')];var _0x3dbe86=_0x2aa98a?0x0:_0x39229a[_0x64a7('0x1b')];var _0x43db08=_0x2aa98a?_0x2359c6[_0x64a7('0x1e')]:_0x39229a['offset']+_0x39229a[_0x64a7('0x1d')];var _0x472fae;if(_0x43db08>=_0x35a254){_0x43db08=_0x35a254;_0x472fae=0xc8;}else{_0x472fae=0xce;}_0xcce44a[_0x64a7('0x18')](_0x472fae);return _0xcce44a[_0x64a7('0x1f')](_0x64a7('0x20'),_0x3dbe86+'-'+_0x43db08+'/'+_0x35a254)['json'](_0x2359c6);}return null;};}function patchUpdates(_0x239693){return function(_0xb58bfb){try{jsonpatch[_0x64a7('0x21')](_0xb58bfb,_0x239693,!![]);}catch(_0x321764){return BPromise[_0x64a7('0x22')](_0x321764);}return _0xb58bfb[_0x64a7('0x23')]();};}function saveUpdates(_0xa2a7ca,_0x17697a){return function(_0x5c5048){if(_0x5c5048){return _0x5c5048[_0x64a7('0x24')](_0xa2a7ca)[_0x64a7('0x25')](function(_0x1227a4){return _0x1227a4;});}return null;};}function removeEntity(_0x5b9fb5,_0xbaa6ea){return function(_0x19d141){if(_0x19d141){return _0x19d141[_0x64a7('0x26')]()['then'](function(){_0x5b9fb5[_0x64a7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee6f0,_0x41ed3a){return function(_0x4166c0){if(!_0x4166c0){_0x2ee6f0[_0x64a7('0x27')](0x194);}return _0x4166c0;};}function handleError(_0x301e3c,_0x57430c){_0x57430c=_0x57430c||0x1f4;return function(_0x50b290){logger['error'](_0x50b290[_0x64a7('0x28')]);if(_0x50b290[_0x64a7('0x29')]){delete _0x50b290[_0x64a7('0x29')];}_0x301e3c[_0x64a7('0x18')](_0x57430c)['send'](_0x50b290);};}exports[_0x64a7('0x2a')]=function(_0x5e5269,_0x1e7301){var _0x13da72={},_0x5efb30={},_0x123860={'count':0x0,'rows':[]};var _0x5514bd=_[_0x64a7('0x2b')](db[_0x64a7('0x2c')][_0x64a7('0x2d')],function(_0x3f9988){return{'name':_0x3f9988[_0x64a7('0x2e')],'type':_0x3f9988['type']['key']};});_0x5efb30[_0x64a7('0x2f')]=_[_0x64a7('0x2b')](_0x5514bd,_0x64a7('0x29'));_0x5efb30['query']=_[_0x64a7('0x30')](_0x5e5269[_0x64a7('0x31')]);_0x5efb30['filters']=_[_0x64a7('0x32')](_0x5efb30['model'],_0x5efb30['query']);_0x13da72[_0x64a7('0x33')]=_['intersection'](_0x5efb30['model'],qs[_0x64a7('0x34')](_0x5e5269[_0x64a7('0x31')][_0x64a7('0x34')]));_0x13da72[_0x64a7('0x33')]=_0x13da72[_0x64a7('0x33')][_0x64a7('0x35')]?_0x13da72[_0x64a7('0x33')]:_0x5efb30[_0x64a7('0x2f')];if(!_0x5e5269[_0x64a7('0x31')][_0x64a7('0x36')]('nolimit')){_0x13da72[_0x64a7('0x1d')]=qs[_0x64a7('0x1d')](_0x5e5269[_0x64a7('0x31')][_0x64a7('0x1d')]);_0x13da72[_0x64a7('0x1b')]=qs['offset'](_0x5e5269[_0x64a7('0x31')][_0x64a7('0x1b')]);}_0x13da72[_0x64a7('0x37')]=qs[_0x64a7('0x38')](_0x5e5269[_0x64a7('0x31')]['sort']);_0x13da72[_0x64a7('0x39')]=qs[_0x64a7('0x3a')](_[_0x64a7('0x3b')](_0x5e5269['query'],_0x5efb30[_0x64a7('0x3a')]),_0x5514bd);if(_0x5e5269['query']['filter']){_0x13da72[_0x64a7('0x39')]=_[_0x64a7('0x3c')](_0x13da72[_0x64a7('0x39')],{'$or':_['map'](_0x5514bd,function(_0x5a10bf){if(_0x5a10bf[_0x64a7('0x3d')]!==_0x64a7('0x3e')){var _0x3d9efb={};_0x3d9efb[_0x5a10bf['name']]={'$like':'%'+_0x5e5269[_0x64a7('0x31')][_0x64a7('0x3f')]+'%'};return _0x3d9efb;}})});}_0x13da72=_[_0x64a7('0x3c')]({},_0x13da72,_0x5e5269[_0x64a7('0x40')]);var _0x24d43f={'where':_0x13da72[_0x64a7('0x39')]};return db['ZohoConfiguration']['count'](_0x24d43f)[_0x64a7('0x25')](function(_0x2629be){_0x123860[_0x64a7('0x1e')]=_0x2629be;if(_0x5e5269[_0x64a7('0x31')]['includeAll']){_0x13da72[_0x64a7('0x41')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x64a7('0x42')](_0x13da72);})[_0x64a7('0x25')](function(_0x3f58c3){_0x123860['rows']=_0x3f58c3;return _0x123860;})['then'](respondWithFilteredResult(_0x1e7301,_0x13da72))[_0x64a7('0x43')](handleError(_0x1e7301,null));};exports['show']=function(_0x49faa0,_0x51b378){var _0x43e1ff={'raw':![],'where':{'id':_0x49faa0[_0x64a7('0x44')]['id']}},_0x31c2c1={};_0x31c2c1['model']=_[_0x64a7('0x30')](db[_0x64a7('0x2c')]['rawAttributes']);_0x31c2c1[_0x64a7('0x31')]=_['keys'](_0x49faa0['query']);_0x31c2c1[_0x64a7('0x3a')]=_['intersection'](_0x31c2c1[_0x64a7('0x2f')],_0x31c2c1[_0x64a7('0x31')]);_0x43e1ff['attributes']=_[_0x64a7('0x32')](_0x31c2c1['model'],qs[_0x64a7('0x34')](_0x49faa0[_0x64a7('0x31')][_0x64a7('0x34')]));_0x43e1ff[_0x64a7('0x33')]=_0x43e1ff[_0x64a7('0x33')]['length']?_0x43e1ff['attributes']:_0x31c2c1[_0x64a7('0x2f')];if(_0x49faa0[_0x64a7('0x31')][_0x64a7('0x45')]){_0x43e1ff[_0x64a7('0x41')]=[{'all':!![]}];}_0x43e1ff=_[_0x64a7('0x3c')]({},_0x43e1ff,_0x49faa0[_0x64a7('0x40')]);return db[_0x64a7('0x2c')][_0x64a7('0x46')](_0x43e1ff)[_0x64a7('0x25')](handleEntityNotFound(_0x51b378,null))['then'](respondWithResult(_0x51b378,null))[_0x64a7('0x43')](handleError(_0x51b378,null));};exports[_0x64a7('0x47')]=function(_0x255d6b,_0x6ab145){return db['ZohoConfiguration'][_0x64a7('0x47')](_0x255d6b['body'],{})['then'](respondWithResult(_0x6ab145,0xc9))[_0x64a7('0x43')](handleError(_0x6ab145,null));};exports[_0x64a7('0x24')]=function(_0x5475d4,_0x4ec98a){if(_0x5475d4[_0x64a7('0x48')]['id']){delete _0x5475d4[_0x64a7('0x48')]['id'];}return db[_0x64a7('0x2c')][_0x64a7('0x46')]({'where':{'id':_0x5475d4[_0x64a7('0x44')]['id']}})[_0x64a7('0x25')](handleEntityNotFound(_0x4ec98a,null))['then'](saveUpdates(_0x5475d4[_0x64a7('0x48')],null))[_0x64a7('0x25')](respondWithResult(_0x4ec98a,null))[_0x64a7('0x43')](handleError(_0x4ec98a,null));};exports[_0x64a7('0x26')]=function(_0x9e77df,_0xbfb827){return db[_0x64a7('0x2c')][_0x64a7('0x46')]({'where':{'id':_0x9e77df['params']['id']}})[_0x64a7('0x25')](handleEntityNotFound(_0xbfb827,null))[_0x64a7('0x25')](removeEntity(_0xbfb827,null))[_0x64a7('0x43')](handleError(_0xbfb827,null));};exports[_0x64a7('0x49')]=function(_0x477d1d,_0x503f6d,_0x1eddf4){var _0x1be5f8={};var _0x510d3c={};var _0x5baf53;var _0x88c7e6;return db[_0x64a7('0x2c')][_0x64a7('0x4a')]({'where':{'id':_0x477d1d['params']['id']}})['then'](handleEntityNotFound(_0x503f6d,null))['then'](function(_0x5e563f){if(_0x5e563f){_0x5baf53=_0x5e563f;_0x510d3c[_0x64a7('0x2f')]=_[_0x64a7('0x30')](db['ZohoField'][_0x64a7('0x2d')]);_0x510d3c['query']=_['keys'](_0x477d1d[_0x64a7('0x31')]);_0x510d3c[_0x64a7('0x3a')]=_['intersection'](_0x510d3c['model'],_0x510d3c[_0x64a7('0x31')]);_0x1be5f8['attributes']=_['intersection'](_0x510d3c[_0x64a7('0x2f')],qs[_0x64a7('0x34')](_0x477d1d[_0x64a7('0x31')][_0x64a7('0x34')]));_0x1be5f8[_0x64a7('0x33')]=_0x1be5f8[_0x64a7('0x33')][_0x64a7('0x35')]?_0x1be5f8['attributes']:_0x510d3c[_0x64a7('0x2f')];_0x1be5f8[_0x64a7('0x37')]=qs[_0x64a7('0x38')](_0x477d1d[_0x64a7('0x31')][_0x64a7('0x38')]);_0x1be5f8[_0x64a7('0x39')]=qs['filters'](_[_0x64a7('0x3b')](_0x477d1d[_0x64a7('0x31')],_0x510d3c[_0x64a7('0x3a')]));if(_0x477d1d[_0x64a7('0x31')][_0x64a7('0x3f')]){_0x1be5f8[_0x64a7('0x39')]=_['merge'](_0x1be5f8[_0x64a7('0x39')],{'$or':_['map'](_0x1be5f8['attributes'],function(_0x56b7ab){var _0x4c1a2b={};_0x4c1a2b[_0x56b7ab]={'$like':'%'+_0x477d1d['query'][_0x64a7('0x3f')]+'%'};return _0x4c1a2b;})});}_0x1be5f8=_['merge']({},_0x1be5f8,_0x477d1d[_0x64a7('0x40')]);return _0x5baf53[_0x64a7('0x49')](_0x1be5f8);}})[_0x64a7('0x25')](function(_0x361459){if(_0x361459){_0x88c7e6=_0x361459[_0x64a7('0x35')];if(!_0x477d1d[_0x64a7('0x31')][_0x64a7('0x36')](_0x64a7('0x4b'))){_0x1be5f8['limit']=qs[_0x64a7('0x1d')](_0x477d1d[_0x64a7('0x31')][_0x64a7('0x1d')]);_0x1be5f8[_0x64a7('0x1b')]=qs['offset'](_0x477d1d[_0x64a7('0x31')]['offset']);}return _0x5baf53[_0x64a7('0x49')](_0x1be5f8);}})[_0x64a7('0x25')](function(_0x11b168){if(_0x11b168){return _0x11b168?{'count':_0x88c7e6,'rows':_0x11b168}:null;}})[_0x64a7('0x25')](respondWithResult(_0x503f6d,null))[_0x64a7('0x43')](handleError(_0x503f6d,null));};exports[_0x64a7('0x4c')]=function(_0x32a17c,_0x496e14,_0x1b8ceb){var _0x2c784a={};var _0x5d683c={};var _0x34b9ef;var _0x378955;return db[_0x64a7('0x2c')][_0x64a7('0x4a')]({'where':{'id':_0x32a17c[_0x64a7('0x44')]['id']}})[_0x64a7('0x25')](handleEntityNotFound(_0x496e14,null))[_0x64a7('0x25')](function(_0x432e2c){if(_0x432e2c){_0x34b9ef=_0x432e2c;_0x5d683c['model']=_[_0x64a7('0x30')](db[_0x64a7('0x4d')][_0x64a7('0x2d')]);_0x5d683c[_0x64a7('0x31')]=_['keys'](_0x32a17c['query']);_0x5d683c[_0x64a7('0x3a')]=_['intersection'](_0x5d683c[_0x64a7('0x2f')],_0x5d683c['query']);_0x2c784a[_0x64a7('0x33')]=_[_0x64a7('0x32')](_0x5d683c['model'],qs['fields'](_0x32a17c[_0x64a7('0x31')][_0x64a7('0x34')]));_0x2c784a[_0x64a7('0x33')]=_0x2c784a[_0x64a7('0x33')]['length']?_0x2c784a['attributes']:_0x5d683c[_0x64a7('0x2f')];_0x2c784a['order']=qs[_0x64a7('0x38')](_0x32a17c[_0x64a7('0x31')]['sort']);_0x2c784a['where']=qs['filters'](_[_0x64a7('0x3b')](_0x32a17c[_0x64a7('0x31')],_0x5d683c['filters']));if(_0x32a17c[_0x64a7('0x31')]['filter']){_0x2c784a[_0x64a7('0x39')]=_[_0x64a7('0x3c')](_0x2c784a[_0x64a7('0x39')],{'$or':_[_0x64a7('0x2b')](_0x2c784a['attributes'],function(_0x1fb194){var _0x1cb2d2={};_0x1cb2d2[_0x1fb194]={'$like':'%'+_0x32a17c[_0x64a7('0x31')]['filter']+'%'};return _0x1cb2d2;})});}_0x2c784a=_[_0x64a7('0x3c')]({},_0x2c784a,_0x32a17c[_0x64a7('0x40')]);return _0x34b9ef['getSubjects'](_0x2c784a);}})[_0x64a7('0x25')](function(_0x5bf234){if(_0x5bf234){_0x378955=_0x5bf234[_0x64a7('0x35')];if(!_0x32a17c['query'][_0x64a7('0x36')]('nolimit')){_0x2c784a[_0x64a7('0x1d')]=qs[_0x64a7('0x1d')](_0x32a17c[_0x64a7('0x31')]['limit']);_0x2c784a['offset']=qs[_0x64a7('0x1b')](_0x32a17c[_0x64a7('0x31')][_0x64a7('0x1b')]);}return _0x34b9ef[_0x64a7('0x4c')](_0x2c784a);}})[_0x64a7('0x25')](function(_0x19620b){if(_0x19620b){return _0x19620b?{'count':_0x378955,'rows':_0x19620b}:null;}})[_0x64a7('0x25')](respondWithResult(_0x496e14,null))[_0x64a7('0x43')](handleError(_0x496e14,null));};exports[_0x64a7('0x4e')]=function(_0x1bb092,_0x318d78,_0x44b11d){var _0x3a4d61={};var _0x508d3b={};var _0x32a422;var _0x26ac43;return db[_0x64a7('0x2c')]['findOne']({'where':{'id':_0x1bb092['params']['id']}})[_0x64a7('0x25')](handleEntityNotFound(_0x318d78,null))['then'](function(_0x37f688){if(_0x37f688){_0x32a422=_0x37f688;_0x508d3b[_0x64a7('0x2f')]=_[_0x64a7('0x30')](db[_0x64a7('0x4d')][_0x64a7('0x2d')]);_0x508d3b[_0x64a7('0x31')]=_['keys'](_0x1bb092[_0x64a7('0x31')]);_0x508d3b[_0x64a7('0x3a')]=_[_0x64a7('0x32')](_0x508d3b['model'],_0x508d3b[_0x64a7('0x31')]);_0x3a4d61[_0x64a7('0x33')]=_[_0x64a7('0x32')](_0x508d3b[_0x64a7('0x2f')],qs[_0x64a7('0x34')](_0x1bb092['query'][_0x64a7('0x34')]));_0x3a4d61[_0x64a7('0x33')]=_0x3a4d61[_0x64a7('0x33')]['length']?_0x3a4d61[_0x64a7('0x33')]:_0x508d3b[_0x64a7('0x2f')];_0x3a4d61[_0x64a7('0x37')]=qs[_0x64a7('0x38')](_0x1bb092[_0x64a7('0x31')][_0x64a7('0x38')]);_0x3a4d61['where']=qs[_0x64a7('0x3a')](_[_0x64a7('0x3b')](_0x1bb092[_0x64a7('0x31')],_0x508d3b['filters']));if(_0x1bb092[_0x64a7('0x31')][_0x64a7('0x3f')]){_0x3a4d61[_0x64a7('0x39')]=_['merge'](_0x3a4d61['where'],{'$or':_['map'](_0x3a4d61[_0x64a7('0x33')],function(_0x106f9e){var _0x1c14b0={};_0x1c14b0[_0x106f9e]={'$like':'%'+_0x1bb092[_0x64a7('0x31')]['filter']+'%'};return _0x1c14b0;})});}_0x3a4d61=_['merge']({},_0x3a4d61,_0x1bb092['options']);return _0x32a422[_0x64a7('0x4e')](_0x3a4d61);}})[_0x64a7('0x25')](function(_0x63128f){if(_0x63128f){_0x26ac43=_0x63128f[_0x64a7('0x35')];if(!_0x1bb092[_0x64a7('0x31')][_0x64a7('0x36')](_0x64a7('0x4b'))){_0x3a4d61[_0x64a7('0x1d')]=qs[_0x64a7('0x1d')](_0x1bb092[_0x64a7('0x31')][_0x64a7('0x1d')]);_0x3a4d61[_0x64a7('0x1b')]=qs['offset'](_0x1bb092[_0x64a7('0x31')][_0x64a7('0x1b')]);}return _0x32a422[_0x64a7('0x4e')](_0x3a4d61);}})[_0x64a7('0x25')](function(_0x2e53ec){if(_0x2e53ec){return _0x2e53ec?{'count':_0x26ac43,'rows':_0x2e53ec}:null;}})['then'](respondWithResult(_0x318d78,null))[_0x64a7('0x43')](handleError(_0x318d78,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c47a13a..797b95a 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 _0xa16b=['path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0xa16b,0x15c));var _0xba16=function(_0x3c2943,_0x4ce5d3){_0x3c2943=_0x3c2943-0x0;var _0x24dbb2=_0xa16b[_0x3c2943];return _0x24dbb2;};'use strict';var _=require(_0xba16('0x0'));var util=require(_0xba16('0x1'));var logger=require('../../config/logger')(_0xba16('0x2'));var moment=require(_0xba16('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba16('0x4'));var rimraf=require('rimraf');var config=require(_0xba16('0x5'));var attributes=require(_0xba16('0x6'));module[_0xba16('0x7')]=function(_0x3118d2,_0x5c86a2){return _0x3118d2[_0xba16('0x8')](_0xba16('0x9'),attributes,{'tableName':_0xba16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce0c=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xce0c,0xe8));var _0xcce0=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xce0c[_0x1e8bea];return _0x29f756;};'use strict';var _=require(_0xcce0('0x0'));var util=require(_0xcce0('0x1'));var logger=require(_0xcce0('0x2'))(_0xcce0('0x3'));var moment=require(_0xcce0('0x4'));var BPromise=require(_0xcce0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcce0('0x6'));var attributes=require(_0xcce0('0x7'));module[_0xcce0('0x8')]=function(_0x238cd2,_0xf6e1fc){return _0x238cd2[_0xcce0('0x9')]('ZohoConfiguration',attributes,{'tableName':_0xcce0('0xa'),'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 7bf27be..85fda2c 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 _0x2fc5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x30ff32,_0x2e47e9){var _0x355cce=function(_0x12f6a0){while(--_0x12f6a0){_0x30ff32['push'](_0x30ff32['shift']());}};_0x355cce(++_0x2e47e9);}(_0x2fc5,0x11c));var _0x52fc=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x2fc5[_0x21f931];return _0x3f083c;};'use strict';var _=require('lodash');var util=require(_0x52fc('0x0'));var moment=require(_0x52fc('0x1'));var BPromise=require(_0x52fc('0x2'));var rs=require(_0x52fc('0x3'));var fs=require('fs');var Redis=require(_0x52fc('0x4'));var db=require(_0x52fc('0x5'))['db'];var utils=require(_0x52fc('0x6'));var logger=require(_0x52fc('0x7'))(_0x52fc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x52fc('0x9')][_0x52fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x303a5c,_0x541918,_0x3d5765){return new BPromise(function(_0x4e581e,_0x358f4e){return client[_0x52fc('0xb')](_0x303a5c,_0x3d5765)[_0x52fc('0xc')](function(_0x436b50){logger[_0x52fc('0xd')](_0x52fc('0xe'),_0x541918,_0x52fc('0xf'));logger[_0x52fc('0x10')](_0x52fc('0x11'),_0x541918,'request\x20sent',JSON[_0x52fc('0x12')](_0x436b50));if(_0x436b50[_0x52fc('0x13')]){if(_0x436b50[_0x52fc('0x13')][_0x52fc('0x14')]===0x1f4){logger[_0x52fc('0x13')](_0x52fc('0xe'),_0x541918,_0x436b50[_0x52fc('0x13')][_0x52fc('0x15')]);return _0x358f4e(_0x436b50[_0x52fc('0x13')][_0x52fc('0x15')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x541918,_0x436b50[_0x52fc('0x13')][_0x52fc('0x15')]);return _0x4e581e(_0x436b50['error']['message']);}else{logger[_0x52fc('0xd')](_0x52fc('0xe'),_0x541918,_0x52fc('0xf'));_0x4e581e(_0x436b50[_0x52fc('0x16')][_0x52fc('0x15')]);}})[_0x52fc('0x17')](function(_0x4babae){logger[_0x52fc('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x541918,_0x4babae);_0x358f4e(_0x4babae);});});} \ No newline at end of file +var _0x2b82=['client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8c845,_0x39ded0){var _0x3a9f4a=function(_0x47dae5){while(--_0x47dae5){_0x8c845['push'](_0x8c845['shift']());}};_0x3a9f4a(++_0x39ded0);}(_0x2b82,0x147));var _0x22b8=function(_0x5f4add,_0x4280ae){_0x5f4add=_0x5f4add-0x0;var _0x3f1414=_0x2b82[_0x5f4add];return _0x3f1414;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x22b8('0x0'));var BPromise=require(_0x22b8('0x1'));var rs=require(_0x22b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22b8('0x3'))['db'];var utils=require(_0x22b8('0x4'));var logger=require(_0x22b8('0x5'))(_0x22b8('0x6'));var config=require(_0x22b8('0x7'));var jayson=require(_0x22b8('0x8'));var client=jayson[_0x22b8('0x9')][_0x22b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4fb4,_0x7f04e4,_0x364bc5){return new BPromise(function(_0x16fb02,_0x42a10c){return client[_0x22b8('0xb')](_0x1b4fb4,_0x364bc5)['then'](function(_0x179363){logger[_0x22b8('0xc')](_0x22b8('0xd'),_0x7f04e4,_0x22b8('0xe'));logger['debug'](_0x22b8('0xf'),_0x7f04e4,'request\x20sent',JSON[_0x22b8('0x10')](_0x179363));if(_0x179363['error']){if(_0x179363['error'][_0x22b8('0x11')]===0x1f4){logger[_0x22b8('0x12')](_0x22b8('0xd'),_0x7f04e4,_0x179363['error'][_0x22b8('0x13')]);return _0x42a10c(_0x179363['error']['message']);}logger[_0x22b8('0x12')](_0x22b8('0xd'),_0x7f04e4,_0x179363[_0x22b8('0x12')][_0x22b8('0x13')]);return _0x16fb02(_0x179363[_0x22b8('0x12')]['message']);}else{logger[_0x22b8('0xc')](_0x22b8('0xd'),_0x7f04e4,_0x22b8('0xe'));_0x16fb02(_0x179363['result'][_0x22b8('0x13')]);}})[_0x22b8('0x14')](function(_0x3882ab){logger['error'](_0x22b8('0xd'),_0x7f04e4,_0x3882ab);_0x42a10c(_0x3882ab);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9139a16..3af1ff2 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 _0xe504=['exports','multer','util','path','express','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe504,0x144));var _0x4e50=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe504[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x4e50('0x0'));var util=require(_0x4e50('0x1'));var path=require(_0x4e50('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e50('0x3'));var router=express['Router']();var fs_extra=require(_0x4e50('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e50('0x5'));var controller=require(_0x4e50('0x6'));router[_0x4e50('0x7')]('/',auth[_0x4e50('0x8')](),controller[_0x4e50('0x9')]);router[_0x4e50('0x7')](_0x4e50('0xa'),auth[_0x4e50('0x8')](),controller['show']);router[_0x4e50('0xb')]('/',auth[_0x4e50('0x8')](),controller[_0x4e50('0xc')]);router['put'](_0x4e50('0xa'),auth['isAuthenticated'](),controller[_0x4e50('0xd')]);router[_0x4e50('0xe')](_0x4e50('0xa'),auth[_0x4e50('0x8')](),controller[_0x4e50('0xf')]);module[_0x4e50('0x10')]=router; \ No newline at end of file +var _0x4ddc=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','show','post','isAuthenticated','update','delete','exports','multer','util'];(function(_0x3e616a,_0x87cb5c){var _0x15f6bf=function(_0x2f066b){while(--_0x2f066b){_0x3e616a['push'](_0x3e616a['shift']());}};_0x15f6bf(++_0x87cb5c);}(_0x4ddc,0x1de));var _0xc4dd=function(_0x3b79c5,_0x269033){_0x3b79c5=_0x3b79c5-0x0;var _0x487e5=_0x4ddc[_0x3b79c5];return _0x487e5;};'use strict';var multer=require(_0xc4dd('0x0'));var util=require(_0xc4dd('0x1'));var path=require('path');var timeout=require(_0xc4dd('0x2'));var express=require(_0xc4dd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc4dd('0x4'));var interaction=require(_0xc4dd('0x5'));var config=require(_0xc4dd('0x6'));var controller=require(_0xc4dd('0x7'));router[_0xc4dd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc4dd('0x8')](_0xc4dd('0x9'),auth['isAuthenticated'](),controller[_0xc4dd('0xa')]);router[_0xc4dd('0xb')]('/',auth[_0xc4dd('0xc')](),controller['create']);router['put'](_0xc4dd('0x9'),auth['isAuthenticated'](),controller[_0xc4dd('0xd')]);router[_0xc4dd('0xe')](_0xc4dd('0x9'),auth[_0xc4dd('0xc')](),controller['destroy']);module[_0xc4dd('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b1238c5..0062163 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 _0xbd71=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0xae193,_0x48a21e){var _0x17a04f=function(_0x101147){while(--_0x101147){_0xae193['push'](_0xae193['shift']());}};_0x17a04f(++_0x48a21e);}(_0xbd71,0x174));var _0x1bd7=function(_0x20f0be,_0x3085c0){_0x20f0be=_0x20f0be-0x0;var _0x71eb9=_0xbd71[_0x20f0be];return _0x71eb9;};'use strict';var Sequelize=require('sequelize');module[_0x1bd7('0x0')]={'type':{'type':Sequelize[_0x1bd7('0x1')](_0x1bd7('0x2'),_0x1bd7('0x3'),_0x1bd7('0x4'),_0x1bd7('0x5'),_0x1bd7('0x6')),'defaultValue':_0x1bd7('0x2')},'content':{'type':Sequelize[_0x1bd7('0x7')]},'key':{'type':Sequelize[_0x1bd7('0x7')]},'keyType':{'type':Sequelize[_0x1bd7('0x1')](_0x1bd7('0x2'),'variable',_0x1bd7('0x4'))},'keyContent':{'type':Sequelize[_0x1bd7('0x7')]},'idField':{'type':Sequelize[_0x1bd7('0x7')]},'nameField':{'type':Sequelize[_0x1bd7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bd7('0x7')]}}; \ No newline at end of file +var _0xd504=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd504,0x1ac));var _0x4d50=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xd504[_0x29c261];return _0x1a9335;};'use strict';var Sequelize=require('sequelize');module[_0x4d50('0x0')]={'type':{'type':Sequelize[_0x4d50('0x1')](_0x4d50('0x2'),_0x4d50('0x3'),_0x4d50('0x4'),_0x4d50('0x5'),'picklist'),'defaultValue':_0x4d50('0x2')},'content':{'type':Sequelize[_0x4d50('0x6')]},'key':{'type':Sequelize[_0x4d50('0x6')]},'keyType':{'type':Sequelize[_0x4d50('0x1')](_0x4d50('0x2'),_0x4d50('0x3'),_0x4d50('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4d50('0x6')]},'nameField':{'type':Sequelize[_0x4d50('0x6')]},'customField':{'type':Sequelize[_0x4d50('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4d50('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 587b622..af59a02 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 _0xcceb=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x21b907,_0x29f43f){var _0xaf56b5=function(_0x19d25c){while(--_0x19d25c){_0x21b907['push'](_0x21b907['shift']());}};_0xaf56b5(++_0x29f43f);}(_0xcceb,0x79));var _0xbcce=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0xcceb[_0x9e7f3a];return _0x5ab145;};'use strict';var emlformat=require(_0xbcce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcce('0x1'));var jsonpatch=require(_0xbcce('0x2'));var rp=require(_0xbcce('0x3'));var moment=require(_0xbcce('0x4'));var BPromise=require(_0xbcce('0x5'));var Mustache=require(_0xbcce('0x6'));var util=require(_0xbcce('0x7'));var path=require(_0xbcce('0x8'));var sox=require(_0xbcce('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcce('0xa'));var squel=require('squel');var crypto=require(_0xbcce('0xb'));var jsforce=require(_0xbcce('0xc'));var deskjs=require(_0xbcce('0xd'));var toCsv=require(_0xbcce('0xe'));var querystring=require('querystring');var Papa=require(_0xbcce('0xf'));var Redis=require(_0xbcce('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbcce('0x11'));var as=require(_0xbcce('0x12'));var hardwareService=require(_0xbcce('0x13'));var logger=require(_0xbcce('0x14'))('api');var utils=require(_0xbcce('0x15'));var config=require(_0xbcce('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcce('0x17'))['db'];function respondWithStatusCode(_0x394f7d,_0x1e0888){_0x1e0888=_0x1e0888||0xcc;return function(_0x22f3f2){if(_0x22f3f2){return _0x394f7d[_0xbcce('0x18')](_0x1e0888);}return _0x394f7d[_0xbcce('0x19')](_0x1e0888)['end']();};}function respondWithResult(_0x102d83,_0x2cb81a){_0x2cb81a=_0x2cb81a||0xc8;return function(_0x587a4e){if(_0x587a4e){return _0x102d83[_0xbcce('0x19')](_0x2cb81a)['json'](_0x587a4e);}};}function respondWithFilteredResult(_0x4b8291,_0x3fcf06){return function(_0x3288c7){if(_0x3288c7){var _0x445cfc=typeof _0x3fcf06[_0xbcce('0x1a')]===_0xbcce('0x1b')&&typeof _0x3fcf06['limit']===_0xbcce('0x1b');var _0x43adfe=_0x3288c7['count'];var _0x12bade=_0x445cfc?0x0:_0x3fcf06[_0xbcce('0x1a')];var _0x10067f=_0x445cfc?_0x3288c7[_0xbcce('0x1c')]:_0x3fcf06[_0xbcce('0x1a')]+_0x3fcf06[_0xbcce('0x1d')];var _0x2b800c;if(_0x10067f>=_0x43adfe){_0x10067f=_0x43adfe;_0x2b800c=0xc8;}else{_0x2b800c=0xce;}_0x4b8291[_0xbcce('0x19')](_0x2b800c);return _0x4b8291[_0xbcce('0x1e')]('Content-Range',_0x12bade+'-'+_0x10067f+'/'+_0x43adfe)['json'](_0x3288c7);}return null;};}function patchUpdates(_0x2ed255){return function(_0x160c7d){try{jsonpatch[_0xbcce('0x1f')](_0x160c7d,_0x2ed255,!![]);}catch(_0x5d29f0){return BPromise[_0xbcce('0x20')](_0x5d29f0);}return _0x160c7d['save']();};}function saveUpdates(_0x48ba85,_0x35f216){return function(_0x3fe48e){if(_0x3fe48e){return _0x3fe48e[_0xbcce('0x21')](_0x48ba85)[_0xbcce('0x22')](function(_0x1c0dd0){return _0x1c0dd0;});}return null;};}function removeEntity(_0x506f33,_0x100cfc){return function(_0x553da3){if(_0x553da3){return _0x553da3[_0xbcce('0x23')]()[_0xbcce('0x22')](function(){_0x506f33[_0xbcce('0x19')](0xcc)[_0xbcce('0x24')]();});}};}function handleEntityNotFound(_0x4a6b9f,_0x1332dd){return function(_0x1364f3){if(!_0x1364f3){_0x4a6b9f['sendStatus'](0x194);}return _0x1364f3;};}function handleError(_0x10a284,_0x5c9c8a){_0x5c9c8a=_0x5c9c8a||0x1f4;return function(_0x5ca875){logger[_0xbcce('0x25')](_0x5ca875[_0xbcce('0x26')]);if(_0x5ca875[_0xbcce('0x27')]){delete _0x5ca875['name'];}_0x10a284[_0xbcce('0x19')](_0x5c9c8a)[_0xbcce('0x28')](_0x5ca875);};}exports['index']=function(_0x1f62c5,_0xfe7657){var _0x406814={},_0x277e7b={},_0x51685d={'count':0x0,'rows':[]};var _0x5102aa=_[_0xbcce('0x29')](db[_0xbcce('0x2a')][_0xbcce('0x2b')],function(_0x1cd8aa){return{'name':_0x1cd8aa[_0xbcce('0x2c')],'type':_0x1cd8aa[_0xbcce('0x2d')][_0xbcce('0x2e')]};});_0x277e7b['model']=_[_0xbcce('0x29')](_0x5102aa,'name');_0x277e7b[_0xbcce('0x2f')]=_[_0xbcce('0x30')](_0x1f62c5[_0xbcce('0x2f')]);_0x277e7b[_0xbcce('0x31')]=_['intersection'](_0x277e7b[_0xbcce('0x32')],_0x277e7b['query']);_0x406814['attributes']=_[_0xbcce('0x33')](_0x277e7b[_0xbcce('0x32')],qs[_0xbcce('0x34')](_0x1f62c5['query']['fields']));_0x406814[_0xbcce('0x35')]=_0x406814[_0xbcce('0x35')][_0xbcce('0x36')]?_0x406814[_0xbcce('0x35')]:_0x277e7b['model'];if(!_0x1f62c5[_0xbcce('0x2f')][_0xbcce('0x37')](_0xbcce('0x38'))){_0x406814[_0xbcce('0x1d')]=qs[_0xbcce('0x1d')](_0x1f62c5['query'][_0xbcce('0x1d')]);_0x406814[_0xbcce('0x1a')]=qs[_0xbcce('0x1a')](_0x1f62c5[_0xbcce('0x2f')][_0xbcce('0x1a')]);}_0x406814['order']=qs[_0xbcce('0x39')](_0x1f62c5[_0xbcce('0x2f')][_0xbcce('0x39')]);_0x406814[_0xbcce('0x3a')]=qs[_0xbcce('0x31')](_[_0xbcce('0x3b')](_0x1f62c5[_0xbcce('0x2f')],_0x277e7b[_0xbcce('0x31')]),_0x5102aa);if(_0x1f62c5['query'][_0xbcce('0x3c')]){_0x406814[_0xbcce('0x3a')]=_[_0xbcce('0x3d')](_0x406814['where'],{'$or':_[_0xbcce('0x29')](_0x5102aa,function(_0x107e01){if(_0x107e01[_0xbcce('0x2d')]!=='VIRTUAL'){var _0x45644c={};_0x45644c[_0x107e01[_0xbcce('0x27')]]={'$like':'%'+_0x1f62c5[_0xbcce('0x2f')][_0xbcce('0x3c')]+'%'};return _0x45644c;}})});}_0x406814=_[_0xbcce('0x3d')]({},_0x406814,_0x1f62c5['options']);var _0x5e9c13={'where':_0x406814[_0xbcce('0x3a')]};return db[_0xbcce('0x2a')][_0xbcce('0x1c')](_0x5e9c13)[_0xbcce('0x22')](function(_0xfbd9e1){_0x51685d[_0xbcce('0x1c')]=_0xfbd9e1;if(_0x1f62c5[_0xbcce('0x2f')][_0xbcce('0x3e')]){_0x406814[_0xbcce('0x3f')]=[{'all':!![]}];}return db[_0xbcce('0x2a')]['findAll'](_0x406814);})[_0xbcce('0x22')](function(_0x2be5fa){_0x51685d[_0xbcce('0x40')]=_0x2be5fa;return _0x51685d;})['then'](respondWithFilteredResult(_0xfe7657,_0x406814))[_0xbcce('0x41')](handleError(_0xfe7657,null));};exports[_0xbcce('0x42')]=function(_0x10c69f,_0x2990e7){var _0x11bca1={'raw':!![],'where':{'id':_0x10c69f[_0xbcce('0x43')]['id']}},_0x1dc298={};_0x1dc298[_0xbcce('0x32')]=_[_0xbcce('0x30')](db[_0xbcce('0x2a')]['rawAttributes']);_0x1dc298[_0xbcce('0x2f')]=_[_0xbcce('0x30')](_0x10c69f[_0xbcce('0x2f')]);_0x1dc298[_0xbcce('0x31')]=_[_0xbcce('0x33')](_0x1dc298['model'],_0x1dc298['query']);_0x11bca1[_0xbcce('0x35')]=_[_0xbcce('0x33')](_0x1dc298[_0xbcce('0x32')],qs['fields'](_0x10c69f[_0xbcce('0x2f')]['fields']));_0x11bca1['attributes']=_0x11bca1['attributes'][_0xbcce('0x36')]?_0x11bca1[_0xbcce('0x35')]:_0x1dc298[_0xbcce('0x32')];if(_0x10c69f['query'][_0xbcce('0x3e')]){_0x11bca1[_0xbcce('0x3f')]=[{'all':!![]}];}_0x11bca1=_[_0xbcce('0x3d')]({},_0x11bca1,_0x10c69f['options']);return db['ZohoField']['find'](_0x11bca1)[_0xbcce('0x22')](handleEntityNotFound(_0x2990e7,null))[_0xbcce('0x22')](respondWithResult(_0x2990e7,null))[_0xbcce('0x41')](handleError(_0x2990e7,null));};exports[_0xbcce('0x44')]=function(_0x43344,_0x1b7f59){return db[_0xbcce('0x2a')][_0xbcce('0x44')](_0x43344['body'],{})[_0xbcce('0x22')](respondWithResult(_0x1b7f59,0xc9))[_0xbcce('0x41')](handleError(_0x1b7f59,null));};exports[_0xbcce('0x21')]=function(_0x4d4864,_0x576ca6){if(_0x4d4864[_0xbcce('0x45')]['id']){delete _0x4d4864['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x4d4864[_0xbcce('0x43')]['id']}})[_0xbcce('0x22')](handleEntityNotFound(_0x576ca6,null))['then'](saveUpdates(_0x4d4864[_0xbcce('0x45')],null))[_0xbcce('0x22')](respondWithResult(_0x576ca6,null))[_0xbcce('0x41')](handleError(_0x576ca6,null));};exports[_0xbcce('0x23')]=function(_0x3da55f,_0x27d581){return db[_0xbcce('0x2a')][_0xbcce('0x46')]({'where':{'id':_0x3da55f[_0xbcce('0x43')]['id']}})[_0xbcce('0x22')](handleEntityNotFound(_0x27d581,null))[_0xbcce('0x22')](removeEntity(_0x27d581,null))[_0xbcce('0x41')](handleError(_0x27d581,null));}; \ No newline at end of file +var _0x098c=['options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ZohoField','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL'];(function(_0x288f73,_0x5d378b){var _0x417fe3=function(_0x2ebdc3){while(--_0x2ebdc3){_0x288f73['push'](_0x288f73['shift']());}};_0x417fe3(++_0x5d378b);}(_0x098c,0x133));var _0xc098=function(_0x237b69,_0x221eb2){_0x237b69=_0x237b69-0x0;var _0x4dee15=_0x098c[_0x237b69];return _0x4dee15;};'use strict';var emlformat=require(_0xc098('0x0'));var rimraf=require(_0xc098('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc098('0x2'));var rp=require('request-promise');var moment=require(_0xc098('0x3'));var BPromise=require(_0xc098('0x4'));var Mustache=require(_0xc098('0x5'));var util=require(_0xc098('0x6'));var path=require(_0xc098('0x7'));var sox=require('sox');var csv=require(_0xc098('0x8'));var ejs=require(_0xc098('0x9'));var fs=require('fs');var fs_extra=require(_0xc098('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc098('0xb'));var deskjs=require(_0xc098('0xc'));var toCsv=require(_0xc098('0x8'));var querystring=require(_0xc098('0xd'));var Papa=require(_0xc098('0xe'));var Redis=require(_0xc098('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc098('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc098('0x11'));var logger=require(_0xc098('0x12'))(_0xc098('0x13'));var utils=require(_0xc098('0x14'));var config=require(_0xc098('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc098('0x16'))['db'];function respondWithStatusCode(_0x27295c,_0x4420c1){_0x4420c1=_0x4420c1||0xcc;return function(_0x24c0a5){if(_0x24c0a5){return _0x27295c[_0xc098('0x17')](_0x4420c1);}return _0x27295c['status'](_0x4420c1)['end']();};}function respondWithResult(_0x1ea3b8,_0x3b6ade){_0x3b6ade=_0x3b6ade||0xc8;return function(_0x396420){if(_0x396420){return _0x1ea3b8[_0xc098('0x18')](_0x3b6ade)[_0xc098('0x19')](_0x396420);}};}function respondWithFilteredResult(_0x50bde3,_0xf11043){return function(_0x1b6150){if(_0x1b6150){var _0x34d6a0=typeof _0xf11043[_0xc098('0x1a')]==='undefined'&&typeof _0xf11043[_0xc098('0x1b')]===_0xc098('0x1c');var _0x390255=_0x1b6150[_0xc098('0x1d')];var _0x4ccef9=_0x34d6a0?0x0:_0xf11043[_0xc098('0x1a')];var _0x813b1f=_0x34d6a0?_0x1b6150[_0xc098('0x1d')]:_0xf11043[_0xc098('0x1a')]+_0xf11043['limit'];var _0x426fc5;if(_0x813b1f>=_0x390255){_0x813b1f=_0x390255;_0x426fc5=0xc8;}else{_0x426fc5=0xce;}_0x50bde3['status'](_0x426fc5);return _0x50bde3[_0xc098('0x1e')](_0xc098('0x1f'),_0x4ccef9+'-'+_0x813b1f+'/'+_0x390255)[_0xc098('0x19')](_0x1b6150);}return null;};}function patchUpdates(_0x315bf9){return function(_0x139736){try{jsonpatch[_0xc098('0x20')](_0x139736,_0x315bf9,!![]);}catch(_0x11c8fc){return BPromise[_0xc098('0x21')](_0x11c8fc);}return _0x139736['save']();};}function saveUpdates(_0x4d0328,_0x267891){return function(_0x49fae0){if(_0x49fae0){return _0x49fae0[_0xc098('0x22')](_0x4d0328)[_0xc098('0x23')](function(_0x3ea1f4){return _0x3ea1f4;});}return null;};}function removeEntity(_0x4bd14e,_0x1bbc10){return function(_0x4fd9f8){if(_0x4fd9f8){return _0x4fd9f8[_0xc098('0x24')]()[_0xc098('0x23')](function(){_0x4bd14e[_0xc098('0x18')](0xcc)[_0xc098('0x25')]();});}};}function handleEntityNotFound(_0x5087d0,_0x84405e){return function(_0x3daf22){if(!_0x3daf22){_0x5087d0[_0xc098('0x17')](0x194);}return _0x3daf22;};}function handleError(_0x3b93dc,_0x3986de){_0x3986de=_0x3986de||0x1f4;return function(_0x2e9899){logger[_0xc098('0x26')](_0x2e9899[_0xc098('0x27')]);if(_0x2e9899[_0xc098('0x28')]){delete _0x2e9899['name'];}_0x3b93dc[_0xc098('0x18')](_0x3986de)[_0xc098('0x29')](_0x2e9899);};}exports[_0xc098('0x2a')]=function(_0x37abb0,_0x50b04f){var _0xd06bfa={},_0x487d18={},_0x561cf8={'count':0x0,'rows':[]};var _0x285dfb=_[_0xc098('0x2b')](db[_0xc098('0x2c')]['rawAttributes'],function(_0x277227){return{'name':_0x277227[_0xc098('0x2d')],'type':_0x277227[_0xc098('0x2e')][_0xc098('0x2f')]};});_0x487d18['model']=_[_0xc098('0x2b')](_0x285dfb,_0xc098('0x28'));_0x487d18[_0xc098('0x30')]=_[_0xc098('0x31')](_0x37abb0[_0xc098('0x30')]);_0x487d18[_0xc098('0x32')]=_[_0xc098('0x33')](_0x487d18['model'],_0x487d18[_0xc098('0x30')]);_0xd06bfa['attributes']=_[_0xc098('0x33')](_0x487d18['model'],qs[_0xc098('0x34')](_0x37abb0[_0xc098('0x30')][_0xc098('0x34')]));_0xd06bfa[_0xc098('0x35')]=_0xd06bfa[_0xc098('0x35')][_0xc098('0x36')]?_0xd06bfa[_0xc098('0x35')]:_0x487d18[_0xc098('0x37')];if(!_0x37abb0[_0xc098('0x30')][_0xc098('0x38')]('nolimit')){_0xd06bfa[_0xc098('0x1b')]=qs[_0xc098('0x1b')](_0x37abb0[_0xc098('0x30')][_0xc098('0x1b')]);_0xd06bfa[_0xc098('0x1a')]=qs['offset'](_0x37abb0['query'][_0xc098('0x1a')]);}_0xd06bfa[_0xc098('0x39')]=qs['sort'](_0x37abb0['query']['sort']);_0xd06bfa[_0xc098('0x3a')]=qs[_0xc098('0x32')](_[_0xc098('0x3b')](_0x37abb0[_0xc098('0x30')],_0x487d18['filters']),_0x285dfb);if(_0x37abb0[_0xc098('0x30')][_0xc098('0x3c')]){_0xd06bfa[_0xc098('0x3a')]=_[_0xc098('0x3d')](_0xd06bfa[_0xc098('0x3a')],{'$or':_[_0xc098('0x2b')](_0x285dfb,function(_0x4ff5f2){if(_0x4ff5f2['type']!==_0xc098('0x3e')){var _0x1cacae={};_0x1cacae[_0x4ff5f2[_0xc098('0x28')]]={'$like':'%'+_0x37abb0[_0xc098('0x30')][_0xc098('0x3c')]+'%'};return _0x1cacae;}})});}_0xd06bfa=_[_0xc098('0x3d')]({},_0xd06bfa,_0x37abb0[_0xc098('0x3f')]);var _0x338cba={'where':_0xd06bfa['where']};return db[_0xc098('0x2c')][_0xc098('0x1d')](_0x338cba)[_0xc098('0x23')](function(_0xefc1d3){_0x561cf8['count']=_0xefc1d3;if(_0x37abb0[_0xc098('0x30')][_0xc098('0x40')]){_0xd06bfa[_0xc098('0x41')]=[{'all':!![]}];}return db[_0xc098('0x2c')]['findAll'](_0xd06bfa);})['then'](function(_0x5257a5){_0x561cf8[_0xc098('0x42')]=_0x5257a5;return _0x561cf8;})[_0xc098('0x23')](respondWithFilteredResult(_0x50b04f,_0xd06bfa))['catch'](handleError(_0x50b04f,null));};exports[_0xc098('0x43')]=function(_0x635b9e,_0x5d40d5){var _0x391663={'raw':!![],'where':{'id':_0x635b9e[_0xc098('0x44')]['id']}},_0x28c783={};_0x28c783[_0xc098('0x37')]=_[_0xc098('0x31')](db[_0xc098('0x2c')][_0xc098('0x45')]);_0x28c783[_0xc098('0x30')]=_['keys'](_0x635b9e[_0xc098('0x30')]);_0x28c783['filters']=_[_0xc098('0x33')](_0x28c783['model'],_0x28c783[_0xc098('0x30')]);_0x391663['attributes']=_[_0xc098('0x33')](_0x28c783[_0xc098('0x37')],qs[_0xc098('0x34')](_0x635b9e['query']['fields']));_0x391663[_0xc098('0x35')]=_0x391663[_0xc098('0x35')][_0xc098('0x36')]?_0x391663[_0xc098('0x35')]:_0x28c783['model'];if(_0x635b9e[_0xc098('0x30')]['includeAll']){_0x391663[_0xc098('0x41')]=[{'all':!![]}];}_0x391663=_['merge']({},_0x391663,_0x635b9e['options']);return db['ZohoField'][_0xc098('0x46')](_0x391663)[_0xc098('0x23')](handleEntityNotFound(_0x5d40d5,null))['then'](respondWithResult(_0x5d40d5,null))[_0xc098('0x47')](handleError(_0x5d40d5,null));};exports['create']=function(_0x5056e2,_0x4328f1){return db[_0xc098('0x2c')][_0xc098('0x48')](_0x5056e2[_0xc098('0x49')],{})[_0xc098('0x23')](respondWithResult(_0x4328f1,0xc9))[_0xc098('0x47')](handleError(_0x4328f1,null));};exports['update']=function(_0x2c6e69,_0x25982f){if(_0x2c6e69['body']['id']){delete _0x2c6e69['body']['id'];}return db[_0xc098('0x2c')][_0xc098('0x46')]({'where':{'id':_0x2c6e69[_0xc098('0x44')]['id']}})[_0xc098('0x23')](handleEntityNotFound(_0x25982f,null))[_0xc098('0x23')](saveUpdates(_0x2c6e69[_0xc098('0x49')],null))['then'](respondWithResult(_0x25982f,null))['catch'](handleError(_0x25982f,null));};exports[_0xc098('0x24')]=function(_0x5824ee,_0x17615e){return db[_0xc098('0x2c')]['find']({'where':{'id':_0x5824ee[_0xc098('0x44')]['id']}})['then'](handleEntityNotFound(_0x17615e,null))[_0xc098('0x23')](removeEntity(_0x17615e,null))[_0xc098('0x47')](handleError(_0x17615e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index fd51690..7fa46a7 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x4e3b13,_0xdde621){var _0x30dbfa=function(_0x330318){while(--_0x330318){_0x4e3b13['push'](_0x4e3b13['shift']());}};_0x30dbfa(++_0xdde621);}(_0x5fab,0x177));var _0xb5fa=function(_0x55a777,_0x2c95f7){_0x55a777=_0x55a777-0x0;var _0x8ca6a1=_0x5fab[_0x55a777];return _0x8ca6a1;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9582=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash'];(function(_0xcd939d,_0x237853){var _0x87311c=function(_0x583a80){while(--_0x583a80){_0xcd939d['push'](_0xcd939d['shift']());}};_0x87311c(++_0x237853);}(_0x9582,0x95));var _0x2958=function(_0x37725c,_0x28d081){_0x37725c=_0x37725c-0x0;var _0x116628=_0x9582[_0x37725c];return _0x116628;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x2958('0xe')],'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 b3460f1..e0b8e10 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 _0x1d4a=['jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\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'];(function(_0x1cc04c,_0x409d3e){var _0x4642c8=function(_0x135c4a){while(--_0x135c4a){_0x1cc04c['push'](_0x1cc04c['shift']());}};_0x4642c8(++_0x409d3e);}(_0x1d4a,0x12d));var _0xa1d4=function(_0x29a662,_0x7202bc){_0x29a662=_0x29a662-0x0;var _0x14ec68=_0x1d4a[_0x29a662];return _0x14ec68;};'use strict';var _=require(_0xa1d4('0x0'));var util=require(_0xa1d4('0x1'));var moment=require(_0xa1d4('0x2'));var BPromise=require(_0xa1d4('0x3'));var rs=require(_0xa1d4('0x4'));var fs=require('fs');var Redis=require(_0xa1d4('0x5'));var db=require(_0xa1d4('0x6'))['db'];var utils=require(_0xa1d4('0x7'));var logger=require(_0xa1d4('0x8'))(_0xa1d4('0x9'));var config=require(_0xa1d4('0xa'));var jayson=require(_0xa1d4('0xb'));var client=jayson['client'][_0xa1d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xafbacc,_0x20ac2a,_0x34bdf6){return new BPromise(function(_0x5ee0f8,_0x5a63a5){return client[_0xa1d4('0xd')](_0xafbacc,_0x34bdf6)[_0xa1d4('0xe')](function(_0x42e823){logger[_0xa1d4('0xf')](_0xa1d4('0x10'),_0x20ac2a,_0xa1d4('0x11'));logger[_0xa1d4('0x12')](_0xa1d4('0x13'),_0x20ac2a,_0xa1d4('0x11'),JSON[_0xa1d4('0x14')](_0x42e823));if(_0x42e823[_0xa1d4('0x15')]){if(_0x42e823[_0xa1d4('0x15')][_0xa1d4('0x16')]===0x1f4){logger[_0xa1d4('0x15')](_0xa1d4('0x10'),_0x20ac2a,_0x42e823[_0xa1d4('0x15')][_0xa1d4('0x17')]);return _0x5a63a5(_0x42e823[_0xa1d4('0x15')][_0xa1d4('0x17')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x20ac2a,_0x42e823[_0xa1d4('0x15')][_0xa1d4('0x17')]);return _0x5ee0f8(_0x42e823[_0xa1d4('0x15')][_0xa1d4('0x17')]);}else{logger[_0xa1d4('0xf')]('ZohoField,\x20%s,\x20%s',_0x20ac2a,'request\x20sent');_0x5ee0f8(_0x42e823[_0xa1d4('0x18')][_0xa1d4('0x17')]);}})[_0xa1d4('0x19')](function(_0x2cb2a0){logger[_0xa1d4('0x15')](_0xa1d4('0x10'),_0x20ac2a,_0x2cb2a0);_0x5a63a5(_0x2cb2a0);});});} \ No newline at end of file +var _0xb19e=['debug','stringify','error','code','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x5af851,_0x3bd741){var _0x34017d=function(_0xad419e){while(--_0xad419e){_0x5af851['push'](_0x5af851['shift']());}};_0x34017d(++_0x3bd741);}(_0xb19e,0x1f2));var _0xeb19=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xb19e[_0x40927b];return _0x2635e8;};'use strict';var _=require(_0xeb19('0x0'));var util=require(_0xeb19('0x1'));var moment=require('moment');var BPromise=require(_0xeb19('0x2'));var rs=require(_0xeb19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb19('0x4'));var logger=require(_0xeb19('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb19('0x6'));var client=jayson['client'][_0xeb19('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f67ea,_0x58ca0d,_0x18a287){return new BPromise(function(_0x2c4eb3,_0x341336){return client[_0xeb19('0x8')](_0x2f67ea,_0x18a287)['then'](function(_0x4d0438){logger[_0xeb19('0x9')](_0xeb19('0xa'),_0x58ca0d,_0xeb19('0xb'));logger[_0xeb19('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x58ca0d,_0xeb19('0xb'),JSON[_0xeb19('0xd')](_0x4d0438));if(_0x4d0438[_0xeb19('0xe')]){if(_0x4d0438[_0xeb19('0xe')][_0xeb19('0xf')]===0x1f4){logger[_0xeb19('0xe')](_0xeb19('0xa'),_0x58ca0d,_0x4d0438[_0xeb19('0xe')][_0xeb19('0x10')]);return _0x341336(_0x4d0438['error'][_0xeb19('0x10')]);}logger[_0xeb19('0xe')]('ZohoField,\x20%s,\x20%s',_0x58ca0d,_0x4d0438[_0xeb19('0xe')][_0xeb19('0x10')]);return _0x2c4eb3(_0x4d0438[_0xeb19('0xe')][_0xeb19('0x10')]);}else{logger[_0xeb19('0x9')]('ZohoField,\x20%s,\x20%s',_0x58ca0d,_0xeb19('0xb'));_0x2c4eb3(_0x4d0438['result'][_0xeb19('0x10')]);}})['catch'](function(_0x137240){logger[_0xeb19('0xe')](_0xeb19('0xa'),_0x58ca0d,_0x137240);_0x341336(_0x137240);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 78f24bf..41271d0 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa369e0,_0x15ec2f){var _0x5052b0=function(_0x32388d){while(--_0x32388d){_0xa369e0['push'](_0xa369e0['shift']());}};_0x5052b0(++_0x15ec2f);}(_0xe706,0xa3));var _0x6e70=function(_0xff5684,_0xfe6e00){_0xff5684=_0xff5684-0x0;var _0x41e374=_0xe706[_0xff5684];return _0x41e374;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x345710,_0x4d3a23){var _0x25ee01=function(_0x57a037){while(--_0x57a037){_0x345710['push'](_0x345710['shift']());}};_0x25ee01(++_0x4d3a23);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8f9dc09..7c120ed 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 _0x42cb=['STRING','app.js','BOOLEAN','state'];(function(_0x41e34b,_0x115bbd){var _0x407e74=function(_0x383411){while(--_0x383411){_0x41e34b['push'](_0x41e34b['shift']());}};_0x407e74(++_0x115bbd);}(_0x42cb,0x178));var _0xb42c=function(_0x125336,_0x55839d){_0x125336=_0x125336-0x0;var _0xfa79c2=_0x42cb[_0x125336];return _0xfa79c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb42c('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xb42c('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb42c('0x0')],'defaultValue':_0xb42c('0x1')},'filename':{'type':Sequelize[_0xb42c('0x0')]},'path':{'type':Sequelize[_0xb42c('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xb42c('0x2')],'defaultValue':![]},'author':{'type':Sequelize[_0xb42c('0x0')]},'logo':{'type':Sequelize[_0xb42c('0x0')]},'state':{'type':Sequelize[_0xb42c('0x0')],'unique':_0xb42c('0x3')},'description':{'type':Sequelize[_0xb42c('0x0')]},'title':{'type':Sequelize[_0xb42c('0x0')]},'remoteUri':{'type':Sequelize[_0xb42c('0x0')]},'link':{'type':Sequelize[_0xb42c('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0xfa20=['exports','STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x2de66b,_0x33ae0c){var _0x19c1ea=function(_0x2965d6){while(--_0x2965d6){_0x2de66b['push'](_0x2de66b['shift']());}};_0x19c1ea(++_0x33ae0c);}(_0xfa20,0x141));var _0x0fa2=function(_0x56eefb,_0x1a1c6d){_0x56eefb=_0x56eefb-0x0;var _0x13ed78=_0xfa20[_0x56eefb];return _0x13ed78;};'use strict';var Sequelize=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]={'name':{'type':Sequelize[_0x0fa2('0x2')],'allowNull':![],'unique':_0x0fa2('0x3')},'version':{'type':Sequelize[_0x0fa2('0x2')],'allowNull':![],'unique':_0x0fa2('0x3')},'main':{'type':Sequelize[_0x0fa2('0x2')],'defaultValue':_0x0fa2('0x4')},'filename':{'type':Sequelize[_0x0fa2('0x2')]},'path':{'type':Sequelize[_0x0fa2('0x2')]},'type':{'type':Sequelize[_0x0fa2('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0fa2('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0fa2('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x0fa2('0x2')],'unique':_0x0fa2('0x6')},'description':{'type':Sequelize[_0x0fa2('0x2')]},'title':{'type':Sequelize[_0x0fa2('0x2')]},'remoteUri':{'type':Sequelize[_0x0fa2('0x2')]},'link':{'type':Sequelize[_0x0fa2('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 86495e4..5af337d 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 _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x4864ea,_0x7764ed){var _0x12e74f=function(_0x3fe41d){while(--_0x3fe41d){_0x4864ea['push'](_0x4864ea['shift']());}};_0x12e74f(++_0x7764ed);}(_0x9582,0x95));var _0x2958=function(_0x3762de,_0x446e8d){_0x3762de=_0x3762de-0x0;var _0x17667c=_0x9582[_0x3762de];return _0x17667c;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file +var _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x9536[_0x4b6830];return _0x239e4a;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cc29f9d..eb2c42d 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 _0xbc1d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Integration','integrations','lodash','util','api','moment'];(function(_0x3af2d9,_0x4a95fe){var _0x3bdac2=function(_0x58b6e4){while(--_0x58b6e4){_0x3af2d9['push'](_0x3af2d9['shift']());}};_0x3bdac2(++_0x4a95fe);}(_0xbc1d,0x98));var _0xdbc1=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xbc1d[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var logger=require('../../config/logger')(_0xdbc1('0x2'));var moment=require(_0xdbc1('0x3'));var BPromise=require(_0xdbc1('0x4'));var rp=require(_0xdbc1('0x5'));var fs=require('fs');var path=require(_0xdbc1('0x6'));var rimraf=require(_0xdbc1('0x7'));var config=require(_0xdbc1('0x8'));var attributes=require('./integration.attributes');module[_0xdbc1('0x9')]=function(_0x126f16,_0x1c2e8f){return _0x126f16['define'](_0xdbc1('0xa'),attributes,{'tableName':_0xdbc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3d7=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0xc3398f,_0x2c3d4b){var _0x18615f=function(_0x5cbd60){while(--_0x5cbd60){_0xc3398f['push'](_0xc3398f['shift']());}};_0x18615f(++_0x2c3d4b);}(_0xa3d7,0x1ec));var _0x7a3d=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xa3d7[_0x2eec1f];return _0x543075;};'use strict';var _=require(_0x7a3d('0x0'));var util=require(_0x7a3d('0x1'));var logger=require('../../config/logger')(_0x7a3d('0x2'));var moment=require(_0x7a3d('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a3d('0x5'));var config=require(_0x7a3d('0x6'));var attributes=require(_0x7a3d('0x7'));module[_0x7a3d('0x8')]=function(_0x5881c3,_0x43bc2d){return _0x5881c3[_0x7a3d('0x9')](_0x7a3d('0xa'),attributes,{'tableName':_0x7a3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1b0799a..f4c717c 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x46435d,_0x37dce7){var _0x1c26dd=function(_0x3a3f01){while(--_0x3a3f01){_0x46435d['push'](_0x46435d['shift']());}};_0x1c26dd(++_0x37dce7);}(_0x1a85,0x178));var _0x51a8=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0x1a85[_0x530804];return _0x3c0f69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1f4619,_0x570e15){_0x1f4619=_0x1f4619-0x0;var _0x17f358=_0xc2c7[_0x1f4619];return _0x17f358;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 92a5c49..a80e41e 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x985714,_0x5b668c){var _0x190698=function(_0xea24ec){while(--_0xea24ec){_0x985714['push'](_0x985714['shift']());}};_0x190698(++_0x5b668c);}(_0x4975,0x86));var _0x5497=function(_0x5366ff,_0x36c411){_0x5366ff=_0x5366ff-0x0;var _0x347247=_0x4975[_0x5366ff];return _0x347247;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x896e,0x1e9));var _0xe896=function(_0x6ff5a6,_0x3261b8){_0x6ff5a6=_0x6ff5a6-0x0;var _0x382aeb=_0x896e[_0x6ff5a6];return _0x382aeb;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3c5f9b4..67f2972 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 _0xd757=['SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x41f614,_0x38a379){var _0x57256d=function(_0x2288ec){while(--_0x2288ec){_0x41f614['push'](_0x41f614['shift']());}};_0x57256d(++_0x38a379);}(_0xd757,0xfb));var _0x7d75=function(_0x19d88b,_0x31558d){_0x19d88b=_0x19d88b-0x0;var _0x5cda43=_0xd757[_0x19d88b];return _0x5cda43;};'use strict';var Sequelize=require(_0x7d75('0x0'));module[_0x7d75('0x1')]={'integration':{'type':Sequelize[_0x7d75('0x2')]},'eventChannel':{'type':Sequelize[_0x7d75('0x2')]},'exitStatus':{'type':Sequelize[_0x7d75('0x2')]},'ticketId':{'type':Sequelize[_0x7d75('0x2')]},'integrationId':{'type':Sequelize[_0x7d75('0x3')]},'contacts':{'type':Sequelize[_0x7d75('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7d75('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7d75('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7d75('0x3')]},'agentacw':{'type':Sequelize[_0x7d75('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7d75('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x7d75('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7d75('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x7d75('0x2')]},'channel':{'type':Sequelize[_0x7d75('0x2')]},'channelstate':{'type':Sequelize[_0x7d75('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7d75('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7d75('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7d75('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7d75('0x2')]},'exten':{'type':Sequelize[_0x7d75('0x2')]},'priority':{'type':Sequelize[_0x7d75('0x2')]},'destchannel':{'type':Sequelize[_0x7d75('0x2')]},'destchannelstate':{'type':Sequelize[_0x7d75('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7d75('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7d75('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7d75('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7d75('0x2')]},'destlanguage':{'type':Sequelize[_0x7d75('0x2')]},'destaccountcode':{'type':Sequelize[_0x7d75('0x2')]},'destcontext':{'type':Sequelize[_0x7d75('0x2')]},'destexten':{'type':Sequelize[_0x7d75('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7d75('0x2')]},'subject':{'type':Sequelize[_0x7d75('0x2')]},'from':{'type':Sequelize[_0x7d75('0x2')]},'to':{'type':Sequelize[_0x7d75('0x2')]},'cc':{'type':Sequelize[_0x7d75('0x2')]},'attachment':{'type':Sequelize[_0x7d75('0x6')]},'html':{'type':Sequelize[_0x7d75('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x7d75('0x7')](_0x7d75('0x8'),_0x7d75('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x7d75('0x2')]},'app':{'type':Sequelize[_0x7d75('0x2')]},'appdata':{'type':Sequelize[_0x7d75('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5fa3=['SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0xc431a4,_0xbdd953){var _0x2654ed=function(_0x5c9279){while(--_0x5c9279){_0xc431a4['push'](_0xc431a4['shift']());}};_0x2654ed(++_0xbdd953);}(_0x5fa3,0x192));var _0x35fa=function(_0x33a9d9,_0x1f5c33){_0x33a9d9=_0x33a9d9-0x0;var _0x990b81=_0x5fa3[_0x33a9d9];return _0x990b81;};'use strict';var Sequelize=require(_0x35fa('0x0'));module[_0x35fa('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x35fa('0x2')]},'ticketId':{'type':Sequelize[_0x35fa('0x2')]},'integrationId':{'type':Sequelize[_0x35fa('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35fa('0x2')]},'calleridnum':{'type':Sequelize[_0x35fa('0x2')]},'calleridname':{'type':Sequelize[_0x35fa('0x2')]},'queue':{'type':Sequelize[_0x35fa('0x2')]},'interface':{'type':Sequelize[_0x35fa('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x35fa('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x35fa('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x35fa('0x4')]},'talktime':{'type':Sequelize[_0x35fa('0x3')]},'agentacw':{'type':Sequelize[_0x35fa('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x35fa('0x3')]},'reason':{'type':Sequelize[_0x35fa('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x35fa('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x35fa('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x35fa('0x2')]},'channelstate':{'type':Sequelize[_0x35fa('0x3')]},'channelstatedesc':{'type':Sequelize[_0x35fa('0x2')]},'connectedlinenum':{'type':Sequelize[_0x35fa('0x2')]},'connectedlinename':{'type':Sequelize[_0x35fa('0x2')]},'language':{'type':Sequelize[_0x35fa('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x35fa('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x35fa('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x35fa('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x35fa('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x35fa('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x35fa('0x2')]},'destexten':{'type':Sequelize[_0x35fa('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x35fa('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x35fa('0x2')]},'from':{'type':Sequelize[_0x35fa('0x2')]},'to':{'type':Sequelize[_0x35fa('0x2')]},'cc':{'type':Sequelize[_0x35fa('0x2')]},'attachment':{'type':Sequelize[_0x35fa('0x6')]},'html':{'type':Sequelize[_0x35fa('0x6')]},'text':{'type':Sequelize[_0x35fa('0x6')]},'status':{'type':Sequelize[_0x35fa('0x7')]('SENT',_0x35fa('0x8'),'RECEIVED',_0x35fa('0x9'))},'url':{'type':Sequelize[_0x35fa('0x2')]},'app':{'type':Sequelize[_0x35fa('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x35fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9381a43..e325129 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 _0x8832=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','length','options','find','catch','create','body','update','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x343874,_0x325d1b){var _0x40053c=function(_0x3cd2cd){while(--_0x3cd2cd){_0x343874['push'](_0x343874['shift']());}};_0x40053c(++_0x325d1b);}(_0x8832,0x16d));var _0x2883=function(_0x59166d,_0x415c2d){_0x59166d=_0x59166d-0x0;var _0x2184e1=_0x8832[_0x59166d];return _0x2184e1;};'use strict';var emlformat=require(_0x2883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2883('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2883('0x2'));var moment=require(_0x2883('0x3'));var BPromise=require(_0x2883('0x4'));var Mustache=require(_0x2883('0x5'));var util=require(_0x2883('0x6'));var path=require(_0x2883('0x7'));var sox=require(_0x2883('0x8'));var csv=require(_0x2883('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2883('0xa'));var jsforce=require(_0x2883('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2883('0x9'));var querystring=require(_0x2883('0xc'));var Papa=require(_0x2883('0xd'));var Redis=require(_0x2883('0xe'));var authService=require(_0x2883('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2883('0x10'));var hardwareService=require(_0x2883('0x11'));var logger=require('../../config/logger')(_0x2883('0x12'));var utils=require(_0x2883('0x13'));var config=require(_0x2883('0x14'));var licenseUtil=require(_0x2883('0x15'));var db=require(_0x2883('0x16'))['db'];function respondWithStatusCode(_0x13378a,_0x14c996){_0x14c996=_0x14c996||0xcc;return function(_0x405cf6){if(_0x405cf6){return _0x13378a[_0x2883('0x17')](_0x14c996);}return _0x13378a['status'](_0x14c996)[_0x2883('0x18')]();};}function respondWithResult(_0x48e496,_0x151bfe){_0x151bfe=_0x151bfe||0xc8;return function(_0xfd8a){if(_0xfd8a){return _0x48e496[_0x2883('0x19')](_0x151bfe)[_0x2883('0x1a')](_0xfd8a);}};}function respondWithFilteredResult(_0x71901c,_0x21bd02){return function(_0x4d1274){if(_0x4d1274){var _0x4ee284=typeof _0x21bd02[_0x2883('0x1b')]===_0x2883('0x1c')&&typeof _0x21bd02[_0x2883('0x1d')]===_0x2883('0x1c');var _0x281029=_0x4d1274[_0x2883('0x1e')];var _0x2c5dd2=_0x4ee284?0x0:_0x21bd02[_0x2883('0x1b')];var _0x1fb14a=_0x4ee284?_0x4d1274['count']:_0x21bd02[_0x2883('0x1b')]+_0x21bd02['limit'];var _0x1e187a;if(_0x1fb14a>=_0x281029){_0x1fb14a=_0x281029;_0x1e187a=0xc8;}else{_0x1e187a=0xce;}_0x71901c[_0x2883('0x19')](_0x1e187a);return _0x71901c['set'](_0x2883('0x1f'),_0x2c5dd2+'-'+_0x1fb14a+'/'+_0x281029)[_0x2883('0x1a')](_0x4d1274);}return null;};}function patchUpdates(_0x464664){return function(_0x440a26){try{jsonpatch[_0x2883('0x20')](_0x440a26,_0x464664,!![]);}catch(_0x562151){return BPromise[_0x2883('0x21')](_0x562151);}return _0x440a26['save']();};}function saveUpdates(_0xcb068,_0x2ecadb){return function(_0x4fa496){if(_0x4fa496){return _0x4fa496['update'](_0xcb068)[_0x2883('0x22')](function(_0x40808d){return _0x40808d;});}return null;};}function removeEntity(_0x29fbb1,_0x454bd5){return function(_0x4e8de0){if(_0x4e8de0){return _0x4e8de0[_0x2883('0x23')]()['then'](function(){_0x29fbb1[_0x2883('0x19')](0xcc)[_0x2883('0x18')]();});}};}function handleEntityNotFound(_0x5a674d,_0x377bac){return function(_0x5e3940){if(!_0x5e3940){_0x5a674d[_0x2883('0x17')](0x194);}return _0x5e3940;};}function handleError(_0x47d8b1,_0x182a21){_0x182a21=_0x182a21||0x1f4;return function(_0x1c06d3){logger[_0x2883('0x24')](_0x1c06d3[_0x2883('0x25')]);if(_0x1c06d3[_0x2883('0x26')]){delete _0x1c06d3[_0x2883('0x26')];}_0x47d8b1[_0x2883('0x19')](_0x182a21)[_0x2883('0x27')](_0x1c06d3);};}exports[_0x2883('0x28')]=function(_0x53950d,_0x40b0f5){var _0x20b8b2={},_0xc634b5={},_0x8e7ef6={'count':0x0,'rows':[]};var _0x3ccc9a=_[_0x2883('0x29')](db[_0x2883('0x2a')][_0x2883('0x2b')],function(_0x3ecdd4){return{'name':_0x3ecdd4[_0x2883('0x2c')],'type':_0x3ecdd4[_0x2883('0x2d')][_0x2883('0x2e')]};});_0xc634b5[_0x2883('0x2f')]=_[_0x2883('0x29')](_0x3ccc9a,_0x2883('0x26'));_0xc634b5['query']=_[_0x2883('0x30')](_0x53950d[_0x2883('0x31')]);_0xc634b5[_0x2883('0x32')]=_[_0x2883('0x33')](_0xc634b5[_0x2883('0x2f')],_0xc634b5[_0x2883('0x31')]);_0x20b8b2[_0x2883('0x34')]=_[_0x2883('0x33')](_0xc634b5['model'],qs[_0x2883('0x35')](_0x53950d['query']['fields']));_0x20b8b2[_0x2883('0x34')]=_0x20b8b2[_0x2883('0x34')]['length']?_0x20b8b2[_0x2883('0x34')]:_0xc634b5[_0x2883('0x2f')];if(!_0x53950d[_0x2883('0x31')][_0x2883('0x36')]('nolimit')){_0x20b8b2[_0x2883('0x1d')]=qs[_0x2883('0x1d')](_0x53950d[_0x2883('0x31')][_0x2883('0x1d')]);_0x20b8b2[_0x2883('0x1b')]=qs[_0x2883('0x1b')](_0x53950d[_0x2883('0x31')][_0x2883('0x1b')]);}_0x20b8b2[_0x2883('0x37')]=qs[_0x2883('0x38')](_0x53950d[_0x2883('0x31')][_0x2883('0x38')]);_0x20b8b2['where']=qs[_0x2883('0x32')](_[_0x2883('0x39')](_0x53950d[_0x2883('0x31')],_0xc634b5[_0x2883('0x32')]),_0x3ccc9a);if(_0x53950d[_0x2883('0x31')][_0x2883('0x3a')]){_0x20b8b2[_0x2883('0x3b')]=_[_0x2883('0x3c')](_0x20b8b2[_0x2883('0x3b')],{'$or':_[_0x2883('0x29')](_0x3ccc9a,function(_0x4d80b9){if(_0x4d80b9[_0x2883('0x2d')]!==_0x2883('0x3d')){var _0x4abd1f={};_0x4abd1f[_0x4d80b9[_0x2883('0x26')]]={'$like':'%'+_0x53950d[_0x2883('0x31')][_0x2883('0x3a')]+'%'};return _0x4abd1f;}})});}_0x20b8b2=_[_0x2883('0x3c')]({},_0x20b8b2,_0x53950d['options']);var _0x16c69d={'where':_0x20b8b2[_0x2883('0x3b')]};return db[_0x2883('0x2a')][_0x2883('0x1e')](_0x16c69d)[_0x2883('0x22')](function(_0x3c37cc){_0x8e7ef6[_0x2883('0x1e')]=_0x3c37cc;if(_0x53950d[_0x2883('0x31')][_0x2883('0x3e')]){_0x20b8b2[_0x2883('0x3f')]=[{'all':!![]}];}return db[_0x2883('0x2a')]['findAll'](_0x20b8b2);})['then'](function(_0x4c3f53){_0x8e7ef6[_0x2883('0x40')]=_0x4c3f53;return _0x8e7ef6;})[_0x2883('0x22')](respondWithFilteredResult(_0x40b0f5,_0x20b8b2))['catch'](handleError(_0x40b0f5,null));};exports[_0x2883('0x41')]=function(_0x4ec100,_0x2086e2){var _0x58ff76={'raw':![],'where':{'id':_0x4ec100['params']['id']}},_0x27ac61={};_0x27ac61[_0x2883('0x2f')]=_['keys'](db[_0x2883('0x2a')][_0x2883('0x2b')]);_0x27ac61[_0x2883('0x31')]=_['keys'](_0x4ec100['query']);_0x27ac61[_0x2883('0x32')]=_['intersection'](_0x27ac61[_0x2883('0x2f')],_0x27ac61[_0x2883('0x31')]);_0x58ff76['attributes']=_[_0x2883('0x33')](_0x27ac61[_0x2883('0x2f')],qs['fields'](_0x4ec100['query']['fields']));_0x58ff76[_0x2883('0x34')]=_0x58ff76[_0x2883('0x34')][_0x2883('0x42')]?_0x58ff76[_0x2883('0x34')]:_0x27ac61['model'];if(_0x4ec100[_0x2883('0x31')][_0x2883('0x3e')]){_0x58ff76['include']=[{'all':!![]}];}_0x58ff76=_['merge']({},_0x58ff76,_0x4ec100[_0x2883('0x43')]);return db[_0x2883('0x2a')][_0x2883('0x44')](_0x58ff76)[_0x2883('0x22')](handleEntityNotFound(_0x2086e2,null))[_0x2883('0x22')](respondWithResult(_0x2086e2,null))[_0x2883('0x45')](handleError(_0x2086e2,null));};exports[_0x2883('0x46')]=function(_0x396a0e,_0x53944d){return db[_0x2883('0x2a')][_0x2883('0x46')](_0x396a0e[_0x2883('0x47')],{})[_0x2883('0x22')](respondWithResult(_0x53944d,0xc9))[_0x2883('0x45')](handleError(_0x53944d,null));};exports[_0x2883('0x48')]=function(_0x5cedf1,_0x25cdff){if(_0x5cedf1[_0x2883('0x47')]['id']){delete _0x5cedf1[_0x2883('0x47')]['id'];}return db[_0x2883('0x2a')][_0x2883('0x44')]({'where':{'id':_0x5cedf1[_0x2883('0x49')]['id']}})[_0x2883('0x22')](handleEntityNotFound(_0x25cdff,null))['then'](saveUpdates(_0x5cedf1[_0x2883('0x47')],null))['then'](respondWithResult(_0x25cdff,null))[_0x2883('0x45')](handleError(_0x25cdff,null));};exports[_0x2883('0x23')]=function(_0x40cd17,_0x2b3a00){return db[_0x2883('0x2a')][_0x2883('0x44')]({'where':{'id':_0x40cd17[_0x2883('0x49')]['id']}})[_0x2883('0x22')](handleEntityNotFound(_0x2b3a00,null))[_0x2883('0x22')](removeEntity(_0x2b3a00,null))[_0x2883('0x45')](handleError(_0x2b3a00,null));};exports[_0x2883('0x4a')]=function(_0x15e490,_0x5c167e){return db[_0x2883('0x2a')]['describe']()['then'](respondWithResult(_0x5c167e,null))[_0x2883('0x45')](handleError(_0x5c167e,null));}; \ No newline at end of file +var _0xd030=['end','json','offset','undefined','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0xb14fa0,_0x1390d1){var _0xd30f3a=function(_0x10fe9c){while(--_0x10fe9c){_0xb14fa0['push'](_0xb14fa0['shift']());}};_0xd30f3a(++_0x1390d1);}(_0xd030,0x168));var _0x0d03=function(_0x2f4e4b,_0x1bbbdb){_0x2f4e4b=_0x2f4e4b-0x0;var _0x31d9f7=_0xd030[_0x2f4e4b];return _0x31d9f7;};'use strict';var emlformat=require(_0x0d03('0x0'));var rimraf=require(_0x0d03('0x1'));var zipdir=require(_0x0d03('0x2'));var jsonpatch=require(_0x0d03('0x3'));var rp=require(_0x0d03('0x4'));var moment=require('moment');var BPromise=require(_0x0d03('0x5'));var Mustache=require('mustache');var util=require(_0x0d03('0x6'));var path=require('path');var sox=require(_0x0d03('0x7'));var csv=require(_0x0d03('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d03('0x9'));var _=require(_0x0d03('0xa'));var squel=require(_0x0d03('0xb'));var crypto=require(_0x0d03('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d03('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0d03('0xe'));var Papa=require(_0x0d03('0xf'));var Redis=require(_0x0d03('0x10'));var authService=require(_0x0d03('0x11'));var qs=require(_0x0d03('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d03('0x13'));var logger=require('../../config/logger')(_0x0d03('0x14'));var utils=require(_0x0d03('0x15'));var config=require(_0x0d03('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d09f3,_0x50f682){_0x50f682=_0x50f682||0xcc;return function(_0xa0e443){if(_0xa0e443){return _0x1d09f3[_0x0d03('0x17')](_0x50f682);}return _0x1d09f3[_0x0d03('0x18')](_0x50f682)[_0x0d03('0x19')]();};}function respondWithResult(_0x49ea7d,_0x8f3396){_0x8f3396=_0x8f3396||0xc8;return function(_0x33554a){if(_0x33554a){return _0x49ea7d[_0x0d03('0x18')](_0x8f3396)[_0x0d03('0x1a')](_0x33554a);}};}function respondWithFilteredResult(_0x2e2b44,_0x49b88a){return function(_0x1ccf13){if(_0x1ccf13){var _0x1975e3=typeof _0x49b88a[_0x0d03('0x1b')]===_0x0d03('0x1c')&&typeof _0x49b88a['limit']===_0x0d03('0x1c');var _0x4afaff=_0x1ccf13['count'];var _0x462568=_0x1975e3?0x0:_0x49b88a['offset'];var _0x42b120=_0x1975e3?_0x1ccf13['count']:_0x49b88a[_0x0d03('0x1b')]+_0x49b88a['limit'];var _0x2a8bc8;if(_0x42b120>=_0x4afaff){_0x42b120=_0x4afaff;_0x2a8bc8=0xc8;}else{_0x2a8bc8=0xce;}_0x2e2b44[_0x0d03('0x18')](_0x2a8bc8);return _0x2e2b44[_0x0d03('0x1d')](_0x0d03('0x1e'),_0x462568+'-'+_0x42b120+'/'+_0x4afaff)[_0x0d03('0x1a')](_0x1ccf13);}return null;};}function patchUpdates(_0x45bcdb){return function(_0x25a1a3){try{jsonpatch[_0x0d03('0x1f')](_0x25a1a3,_0x45bcdb,!![]);}catch(_0x3c41d7){return BPromise['reject'](_0x3c41d7);}return _0x25a1a3[_0x0d03('0x20')]();};}function saveUpdates(_0x516000,_0x43cdae){return function(_0xcafd97){if(_0xcafd97){return _0xcafd97[_0x0d03('0x21')](_0x516000)[_0x0d03('0x22')](function(_0x5edfd7){return _0x5edfd7;});}return null;};}function removeEntity(_0x532f86,_0x2cddaf){return function(_0x2dd7b6){if(_0x2dd7b6){return _0x2dd7b6[_0x0d03('0x23')]()[_0x0d03('0x22')](function(){_0x532f86[_0x0d03('0x18')](0xcc)[_0x0d03('0x19')]();});}};}function handleEntityNotFound(_0x1ffaac,_0x4875d4){return function(_0x4ed8df){if(!_0x4ed8df){_0x1ffaac[_0x0d03('0x17')](0x194);}return _0x4ed8df;};}function handleError(_0x50512f,_0x1ab047){_0x1ab047=_0x1ab047||0x1f4;return function(_0xcb9a21){logger[_0x0d03('0x24')](_0xcb9a21[_0x0d03('0x25')]);if(_0xcb9a21['name']){delete _0xcb9a21[_0x0d03('0x26')];}_0x50512f[_0x0d03('0x18')](_0x1ab047)[_0x0d03('0x27')](_0xcb9a21);};}exports[_0x0d03('0x28')]=function(_0x3cc597,_0x529810){var _0x152eb3={},_0x32e222={},_0xfc3a1b={'count':0x0,'rows':[]};var _0x432160=_['map'](db[_0x0d03('0x29')][_0x0d03('0x2a')],function(_0x1b0fa8){return{'name':_0x1b0fa8[_0x0d03('0x2b')],'type':_0x1b0fa8['type'][_0x0d03('0x2c')]};});_0x32e222['model']=_[_0x0d03('0x2d')](_0x432160,_0x0d03('0x26'));_0x32e222[_0x0d03('0x2e')]=_['keys'](_0x3cc597[_0x0d03('0x2e')]);_0x32e222[_0x0d03('0x2f')]=_[_0x0d03('0x30')](_0x32e222[_0x0d03('0x31')],_0x32e222[_0x0d03('0x2e')]);_0x152eb3[_0x0d03('0x32')]=_[_0x0d03('0x30')](_0x32e222['model'],qs['fields'](_0x3cc597[_0x0d03('0x2e')][_0x0d03('0x33')]));_0x152eb3['attributes']=_0x152eb3[_0x0d03('0x32')][_0x0d03('0x34')]?_0x152eb3[_0x0d03('0x32')]:_0x32e222[_0x0d03('0x31')];if(!_0x3cc597[_0x0d03('0x2e')][_0x0d03('0x35')](_0x0d03('0x36'))){_0x152eb3['limit']=qs[_0x0d03('0x37')](_0x3cc597['query'][_0x0d03('0x37')]);_0x152eb3[_0x0d03('0x1b')]=qs['offset'](_0x3cc597[_0x0d03('0x2e')][_0x0d03('0x1b')]);}_0x152eb3[_0x0d03('0x38')]=qs[_0x0d03('0x39')](_0x3cc597[_0x0d03('0x2e')]['sort']);_0x152eb3[_0x0d03('0x3a')]=qs[_0x0d03('0x2f')](_['pick'](_0x3cc597[_0x0d03('0x2e')],_0x32e222[_0x0d03('0x2f')]),_0x432160);if(_0x3cc597[_0x0d03('0x2e')][_0x0d03('0x3b')]){_0x152eb3['where']=_['merge'](_0x152eb3[_0x0d03('0x3a')],{'$or':_[_0x0d03('0x2d')](_0x432160,function(_0x3b0ac8){if(_0x3b0ac8[_0x0d03('0x3c')]!==_0x0d03('0x3d')){var _0x5611e5={};_0x5611e5[_0x3b0ac8[_0x0d03('0x26')]]={'$like':'%'+_0x3cc597[_0x0d03('0x2e')]['filter']+'%'};return _0x5611e5;}})});}_0x152eb3=_['merge']({},_0x152eb3,_0x3cc597[_0x0d03('0x3e')]);var _0x592e1d={'where':_0x152eb3['where']};return db['IntegrationReport'][_0x0d03('0x3f')](_0x592e1d)['then'](function(_0x19dd31){_0xfc3a1b[_0x0d03('0x3f')]=_0x19dd31;if(_0x3cc597[_0x0d03('0x2e')][_0x0d03('0x40')]){_0x152eb3[_0x0d03('0x41')]=[{'all':!![]}];}return db[_0x0d03('0x29')][_0x0d03('0x42')](_0x152eb3);})['then'](function(_0x3bbd2c){_0xfc3a1b[_0x0d03('0x43')]=_0x3bbd2c;return _0xfc3a1b;})['then'](respondWithFilteredResult(_0x529810,_0x152eb3))[_0x0d03('0x44')](handleError(_0x529810,null));};exports[_0x0d03('0x45')]=function(_0x2f827c,_0x2ec694){var _0x2e9ce4={'raw':![],'where':{'id':_0x2f827c[_0x0d03('0x46')]['id']}},_0x23fb71={};_0x23fb71['model']=_[_0x0d03('0x47')](db[_0x0d03('0x29')][_0x0d03('0x2a')]);_0x23fb71[_0x0d03('0x2e')]=_[_0x0d03('0x47')](_0x2f827c[_0x0d03('0x2e')]);_0x23fb71[_0x0d03('0x2f')]=_[_0x0d03('0x30')](_0x23fb71[_0x0d03('0x31')],_0x23fb71['query']);_0x2e9ce4[_0x0d03('0x32')]=_[_0x0d03('0x30')](_0x23fb71[_0x0d03('0x31')],qs[_0x0d03('0x33')](_0x2f827c[_0x0d03('0x2e')][_0x0d03('0x33')]));_0x2e9ce4['attributes']=_0x2e9ce4['attributes'][_0x0d03('0x34')]?_0x2e9ce4['attributes']:_0x23fb71[_0x0d03('0x31')];if(_0x2f827c[_0x0d03('0x2e')][_0x0d03('0x40')]){_0x2e9ce4[_0x0d03('0x41')]=[{'all':!![]}];}_0x2e9ce4=_[_0x0d03('0x48')]({},_0x2e9ce4,_0x2f827c[_0x0d03('0x3e')]);return db[_0x0d03('0x29')][_0x0d03('0x49')](_0x2e9ce4)['then'](handleEntityNotFound(_0x2ec694,null))[_0x0d03('0x22')](respondWithResult(_0x2ec694,null))['catch'](handleError(_0x2ec694,null));};exports[_0x0d03('0x4a')]=function(_0x45a111,_0x2f6fcb){return db[_0x0d03('0x29')][_0x0d03('0x4a')](_0x45a111[_0x0d03('0x4b')],{})[_0x0d03('0x22')](respondWithResult(_0x2f6fcb,0xc9))[_0x0d03('0x44')](handleError(_0x2f6fcb,null));};exports['update']=function(_0x125270,_0x556de9){if(_0x125270[_0x0d03('0x4b')]['id']){delete _0x125270[_0x0d03('0x4b')]['id'];}return db[_0x0d03('0x29')][_0x0d03('0x49')]({'where':{'id':_0x125270[_0x0d03('0x46')]['id']}})[_0x0d03('0x22')](handleEntityNotFound(_0x556de9,null))[_0x0d03('0x22')](saveUpdates(_0x125270['body'],null))[_0x0d03('0x22')](respondWithResult(_0x556de9,null))[_0x0d03('0x44')](handleError(_0x556de9,null));};exports[_0x0d03('0x23')]=function(_0x2d2979,_0x29de3f){return db['IntegrationReport'][_0x0d03('0x49')]({'where':{'id':_0x2d2979[_0x0d03('0x46')]['id']}})[_0x0d03('0x22')](handleEntityNotFound(_0x29de3f,null))['then'](removeEntity(_0x29de3f,null))['catch'](handleError(_0x29de3f,null));};exports[_0x0d03('0x4c')]=function(_0x38ea30,_0x48d57f){return db[_0x0d03('0x29')][_0x0d03('0x4c')]()[_0x0d03('0x22')](respondWithResult(_0x48d57f,null))[_0x0d03('0x44')](handleError(_0x48d57f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index dca90b0..c62df32 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 _0x2554=['IntegrationReport','report_integration','../../config/logger','api','bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports'];(function(_0x8398a9,_0x510eef){var _0x175a1e=function(_0x187466){while(--_0x187466){_0x8398a9['push'](_0x8398a9['shift']());}};_0x175a1e(++_0x510eef);}(_0x2554,0x146));var _0x4255=function(_0x17f66a,_0x31423e){_0x17f66a=_0x17f66a-0x0;var _0x508a47=_0x2554[_0x17f66a];return _0x508a47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4255('0x0'))(_0x4255('0x1'));var moment=require('moment');var BPromise=require(_0x4255('0x2'));var rp=require(_0x4255('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4255('0x4'));var attributes=require(_0x4255('0x5'));module[_0x4255('0x6')]=function(_0x313e65,_0x18e619){return _0x313e65['define'](_0x4255('0x7'),attributes,{'tableName':_0x4255('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa266=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41ab73,_0xdc4501){var _0x33c1be=function(_0xc288a6){while(--_0xc288a6){_0x41ab73['push'](_0x41ab73['shift']());}};_0x33c1be(++_0xdc4501);}(_0xa266,0x1ab));var _0x6a26=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0xa266[_0x4fbb86];return _0xb141fe;};'use strict';var _=require(_0x6a26('0x0'));var util=require(_0x6a26('0x1'));var logger=require(_0x6a26('0x2'))(_0x6a26('0x3'));var moment=require(_0x6a26('0x4'));var BPromise=require(_0x6a26('0x5'));var rp=require(_0x6a26('0x6'));var fs=require('fs');var path=require(_0x6a26('0x7'));var rimraf=require(_0x6a26('0x8'));var config=require(_0x6a26('0x9'));var attributes=require(_0x6a26('0xa'));module[_0x6a26('0xb')]=function(_0x380541,_0x52bf5d){return _0x380541['define'](_0x6a26('0xc'),attributes,{'tableName':_0x6a26('0xd'),'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 6b6160d..0a1681b 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'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')]('IntegrationReport,\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);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x20aa35,_0x1241b9){var _0x3d0293=function(_0x5e4a92){while(--_0x5e4a92){_0x20aa35['push'](_0x20aa35['shift']());}};_0x3d0293(++_0x1241b9);}(_0x1261,0x144));var _0x1126=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x1261[_0x5216e0];return _0x5b3f40;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index acd40e4..e92927d 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 _0x8c45=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','create','post','/:id/sub_intervals/create_many','put','update','delete'];(function(_0x524e4d,_0x48ebd7){var _0x39748d=function(_0x4cae32){while(--_0x4cae32){_0x524e4d['push'](_0x524e4d['shift']());}};_0x39748d(++_0x48ebd7);}(_0x8c45,0xda));var _0x58c4=function(_0x4ed625,_0x384757){_0x4ed625=_0x4ed625-0x0;var _0x5b4bad=_0x8c45[_0x4ed625];return _0x5b4bad;};'use strict';var multer=require(_0x58c4('0x0'));var util=require(_0x58c4('0x1'));var path=require(_0x58c4('0x2'));var timeout=require(_0x58c4('0x3'));var express=require(_0x58c4('0x4'));var router=express[_0x58c4('0x5')]();var fs_extra=require(_0x58c4('0x6'));var auth=require(_0x58c4('0x7'));var interaction=require(_0x58c4('0x8'));var config=require(_0x58c4('0x9'));var controller=require('./interval.controller');router[_0x58c4('0xa')]('/',auth[_0x58c4('0xb')](),controller[_0x58c4('0xc')]);router['get'](_0x58c4('0xd'),auth[_0x58c4('0xb')](),controller[_0x58c4('0xe')]);router['get'](_0x58c4('0xf'),auth[_0x58c4('0xb')](),controller['getIntervals']);router['post']('/',auth['isAuthenticated'](),controller[_0x58c4('0x10')]);router[_0x58c4('0x11')](_0x58c4('0xf'),auth['isAuthenticated'](),controller['addInterval']);router[_0x58c4('0x11')](_0x58c4('0x12'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x58c4('0x13')](_0x58c4('0xd'),auth['isAuthenticated'](),controller[_0x58c4('0x14')]);router[_0x58c4('0x15')]('/:id',auth[_0x58c4('0xb')](),controller[_0x58c4('0x16')]);module[_0x58c4('0x17')]=router; \ No newline at end of file +var _0x8185=['destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','update'];(function(_0x263d33,_0x590918){var _0x2aaaad=function(_0x2a83b3){while(--_0x2a83b3){_0x263d33['push'](_0x263d33['shift']());}};_0x2aaaad(++_0x590918);}(_0x8185,0x127));var _0x5818=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8185[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var path=require('path');var timeout=require(_0x5818('0x2'));var express=require(_0x5818('0x3'));var router=express[_0x5818('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5818('0x5'));var config=require(_0x5818('0x6'));var controller=require(_0x5818('0x7'));router[_0x5818('0x8')]('/',auth[_0x5818('0x9')](),controller[_0x5818('0xa')]);router[_0x5818('0x8')](_0x5818('0xb'),auth[_0x5818('0x9')](),controller[_0x5818('0xc')]);router[_0x5818('0x8')](_0x5818('0xd'),auth[_0x5818('0x9')](),controller[_0x5818('0xe')]);router[_0x5818('0xf')]('/',auth[_0x5818('0x9')](),controller['create']);router[_0x5818('0xf')](_0x5818('0xd'),auth[_0x5818('0x9')](),controller[_0x5818('0x10')]);router[_0x5818('0xf')](_0x5818('0x11'),auth[_0x5818('0x9')](),controller[_0x5818('0x12')]);router['put'](_0x5818('0xb'),auth['isAuthenticated'](),controller[_0x5818('0x13')]);router['delete'](_0x5818('0xb'),auth[_0x5818('0x9')](),controller[_0x5818('0x14')]);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 d3e49cd..81fe691 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 _0x8c12=['exports','STRING'];(function(_0x2df04c,_0x4466fc){var _0x23dbff=function(_0xd28c37){while(--_0xd28c37){_0x2df04c['push'](_0x2df04c['shift']());}};_0x23dbff(++_0x4466fc);}(_0x8c12,0x146));var _0x28c1=function(_0x5c6819,_0x2a82f5){_0x5c6819=_0x5c6819-0x0;var _0x103875=_0x8c12[_0x5c6819];return _0x103875;};'use strict';var Sequelize=require('sequelize');module[_0x28c1('0x0')]={'name':{'type':Sequelize[_0x28c1('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xe563=['exports','STRING','sequelize'];(function(_0x47ccab,_0x1092b2){var _0x3b9cf2=function(_0x1eb4ac){while(--_0x1eb4ac){_0x47ccab['push'](_0x47ccab['shift']());}};_0x3b9cf2(++_0x1092b2);}(_0xe563,0x113));var _0x3e56=function(_0x1a20b5,_0x59dd38){_0x1a20b5=_0x1a20b5-0x0;var _0x29d373=_0xe563[_0x1a20b5];return _0x29d373;};'use strict';var Sequelize=require(_0x3e56('0x0'));module[_0x3e56('0x1')]={'name':{'type':Sequelize[_0x3e56('0x2')]},'description':{'type':Sequelize[_0x3e56('0x2')]},'interval':{'type':Sequelize[_0x3e56('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index dd7a9b0..574fe08 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 _0x40ee=['update','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','Interval','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','findOne','rawAttributes','getIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../components/extensions/rewrite','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x8973a5,_0x2914ca){var _0x573205=function(_0x51c775){while(--_0x51c775){_0x8973a5['push'](_0x8973a5['shift']());}};_0x573205(++_0x2914ca);}(_0x40ee,0xfa));var _0xe40e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x40ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xe40e('0x0'));var rimraf=require(_0xe40e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe40e('0x2'));var rp=require(_0xe40e('0x3'));var moment=require(_0xe40e('0x4'));var BPromise=require(_0xe40e('0x5'));var Mustache=require(_0xe40e('0x6'));var util=require(_0xe40e('0x7'));var path=require(_0xe40e('0x8'));var sox=require(_0xe40e('0x9'));var csv=require(_0xe40e('0xa'));var ejs=require(_0xe40e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe40e('0xc'));var squel=require(_0xe40e('0xd'));var crypto=require(_0xe40e('0xe'));var jsforce=require(_0xe40e('0xf'));var deskjs=require(_0xe40e('0x10'));var toCsv=require(_0xe40e('0xa'));var querystring=require(_0xe40e('0x11'));var Papa=require(_0xe40e('0x12'));var Redis=require(_0xe40e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe40e('0x14'));var as=require(_0xe40e('0x15'));var hardwareService=require(_0xe40e('0x16'));var logger=require(_0xe40e('0x17'))(_0xe40e('0x18'));var utils=require(_0xe40e('0x19'));var config=require(_0xe40e('0x1a'));var licenseUtil=require(_0xe40e('0x1b'));var db=require('../../mysqldb')['db'];var extensions=require(_0xe40e('0x1c'));function respondWithStatusCode(_0x101460,_0x173dfc){_0x173dfc=_0x173dfc||0xcc;return function(_0x50feb1){if(_0x50feb1){return _0x101460['sendStatus'](_0x173dfc);}return _0x101460[_0xe40e('0x1d')](_0x173dfc)[_0xe40e('0x1e')]();};}function respondWithResult(_0x806935,_0xf77e6){_0xf77e6=_0xf77e6||0xc8;return function(_0x17c56b){if(_0x17c56b){return _0x806935['status'](_0xf77e6)['json'](_0x17c56b);}};}function respondWithFilteredResult(_0x5ca9fb,_0x2aa588){return function(_0x18dfe6){if(_0x18dfe6){var _0x55efc5=typeof _0x2aa588['offset']===_0xe40e('0x1f')&&typeof _0x2aa588[_0xe40e('0x20')]===_0xe40e('0x1f');var _0x2a0985=_0x18dfe6[_0xe40e('0x21')];var _0x34a084=_0x55efc5?0x0:_0x2aa588[_0xe40e('0x22')];var _0x3ded40=_0x55efc5?_0x18dfe6['count']:_0x2aa588['offset']+_0x2aa588[_0xe40e('0x20')];var _0x1d89a9;if(_0x3ded40>=_0x2a0985){_0x3ded40=_0x2a0985;_0x1d89a9=0xc8;}else{_0x1d89a9=0xce;}_0x5ca9fb[_0xe40e('0x1d')](_0x1d89a9);return _0x5ca9fb[_0xe40e('0x23')](_0xe40e('0x24'),_0x34a084+'-'+_0x3ded40+'/'+_0x2a0985)[_0xe40e('0x25')](_0x18dfe6);}return null;};}function patchUpdates(_0x1edbf1){return function(_0xb4ca2a){try{jsonpatch['apply'](_0xb4ca2a,_0x1edbf1,!![]);}catch(_0x242808){return BPromise['reject'](_0x242808);}return _0xb4ca2a['save']();};}function saveUpdates(_0x240da8,_0x4dbb09){return function(_0x799470){if(_0x799470){return _0x799470[_0xe40e('0x26')](_0x240da8)['then'](function(_0x4a8a8){return _0x4a8a8;});}return null;};}function removeEntity(_0x548908,_0x13812c){return function(_0x39c1ca){if(_0x39c1ca){return _0x39c1ca[_0xe40e('0x27')]()[_0xe40e('0x28')](function(){var _0x700a0a=_0x39c1ca[_0xe40e('0x29')]({'plain':!![]});var _0xbe6466=_0xe40e('0x2a');return db[_0xe40e('0x2b')][_0xe40e('0x27')]({'where':{'type':_0xbe6466,'resourceId':_0x700a0a['id']}})[_0xe40e('0x28')](function(){return _0x39c1ca;});})['then'](function(){_0x548908[_0xe40e('0x1d')](0xcc)[_0xe40e('0x1e')]();});}};}function handleEntityNotFound(_0x49d22a,_0x47a931){return function(_0x51094e){if(!_0x51094e){_0x49d22a[_0xe40e('0x2c')](0x194);}return _0x51094e;};}function handleError(_0x402543,_0x4ad94a){_0x4ad94a=_0x4ad94a||0x1f4;return function(_0x5b0f54){logger[_0xe40e('0x2d')](_0x5b0f54[_0xe40e('0x2e')]);if(_0x5b0f54[_0xe40e('0x2f')]){delete _0x5b0f54[_0xe40e('0x2f')];}_0x402543['status'](_0x4ad94a)[_0xe40e('0x30')](_0x5b0f54);};}exports[_0xe40e('0x31')]=function(_0x486efe,_0x413054){var _0xa14a9d={},_0xde1df8={},_0x1c6f90={'count':0x0,'rows':[]};var _0x5cf95e=_['map'](db['Interval']['rawAttributes'],function(_0x470c92){return{'name':_0x470c92[_0xe40e('0x32')],'type':_0x470c92[_0xe40e('0x33')][_0xe40e('0x34')]};});_0xde1df8['model']=_[_0xe40e('0x35')](_0x5cf95e,_0xe40e('0x2f'));_0xde1df8[_0xe40e('0x36')]=_['keys'](_0x486efe['query']);_0xde1df8[_0xe40e('0x37')]=_[_0xe40e('0x38')](_0xde1df8[_0xe40e('0x39')],_0xde1df8[_0xe40e('0x36')]);_0xa14a9d[_0xe40e('0x3a')]=_[_0xe40e('0x38')](_0xde1df8['model'],qs['fields'](_0x486efe[_0xe40e('0x36')][_0xe40e('0x3b')]));_0xa14a9d['attributes']=_0xa14a9d[_0xe40e('0x3a')][_0xe40e('0x3c')]?_0xa14a9d[_0xe40e('0x3a')]:_0xde1df8[_0xe40e('0x39')];if(!_0x486efe[_0xe40e('0x36')][_0xe40e('0x3d')](_0xe40e('0x3e'))){_0xa14a9d['limit']=qs[_0xe40e('0x20')](_0x486efe[_0xe40e('0x36')][_0xe40e('0x20')]);_0xa14a9d[_0xe40e('0x22')]=qs[_0xe40e('0x22')](_0x486efe['query'][_0xe40e('0x22')]);}_0xa14a9d[_0xe40e('0x3f')]=qs['sort'](_0x486efe[_0xe40e('0x36')][_0xe40e('0x40')]);_0xa14a9d[_0xe40e('0x41')]=qs['filters'](_[_0xe40e('0x42')](_0x486efe[_0xe40e('0x36')],_0xde1df8['filters']),_0x5cf95e);if(_0x486efe['query'][_0xe40e('0x43')]){_0xa14a9d[_0xe40e('0x41')]=_[_0xe40e('0x44')](_0xa14a9d[_0xe40e('0x41')],{'$or':_[_0xe40e('0x35')](_0x5cf95e,function(_0x59ba01){if(_0x59ba01[_0xe40e('0x33')]!==_0xe40e('0x45')){var _0x1765b2={};_0x1765b2[_0x59ba01[_0xe40e('0x2f')]]={'$like':'%'+_0x486efe['query']['filter']+'%'};return _0x1765b2;}})});}_0xa14a9d=_[_0xe40e('0x44')]({},_0xa14a9d,_0x486efe[_0xe40e('0x46')]);var _0x2ff272={'where':_0xa14a9d[_0xe40e('0x41')]};return db['Interval']['count'](_0x2ff272)[_0xe40e('0x28')](function(_0x1aa2e5){_0x1c6f90['count']=_0x1aa2e5;if(_0x486efe['query']['includeAll']){_0xa14a9d['include']=[{'all':!![]}];}return db['Interval'][_0xe40e('0x47')](_0xa14a9d);})[_0xe40e('0x28')](function(_0x56176b){_0x1c6f90[_0xe40e('0x48')]=_0x56176b;return _0x1c6f90;})[_0xe40e('0x28')](respondWithFilteredResult(_0x413054,_0xa14a9d))['catch'](handleError(_0x413054,null));};exports[_0xe40e('0x49')]=function(_0x3769e9,_0x2a4afc){var _0x4fd194={'raw':!![],'where':{'id':_0x3769e9['params']['id']}},_0x44d9fe={};_0x44d9fe['model']=_['keys'](db[_0xe40e('0x4a')]['rawAttributes']);_0x44d9fe[_0xe40e('0x36')]=_[_0xe40e('0x4b')](_0x3769e9[_0xe40e('0x36')]);_0x44d9fe[_0xe40e('0x37')]=_['intersection'](_0x44d9fe[_0xe40e('0x39')],_0x44d9fe[_0xe40e('0x36')]);_0x4fd194[_0xe40e('0x3a')]=_[_0xe40e('0x38')](_0x44d9fe[_0xe40e('0x39')],qs[_0xe40e('0x3b')](_0x3769e9[_0xe40e('0x36')][_0xe40e('0x3b')]));_0x4fd194[_0xe40e('0x3a')]=_0x4fd194['attributes'][_0xe40e('0x3c')]?_0x4fd194[_0xe40e('0x3a')]:_0x44d9fe[_0xe40e('0x39')];if(_0x3769e9[_0xe40e('0x36')]['includeAll']){_0x4fd194[_0xe40e('0x4c')]=[{'all':!![]}];}_0x4fd194=_[_0xe40e('0x44')]({},_0x4fd194,_0x3769e9['options']);return db['Interval'][_0xe40e('0x4d')](_0x4fd194)['then'](handleEntityNotFound(_0x2a4afc,null))[_0xe40e('0x28')](respondWithResult(_0x2a4afc,null))[_0xe40e('0x4e')](handleError(_0x2a4afc,null));};exports[_0xe40e('0x4f')]=function(_0x3403c3,_0x5203e9){return db[_0xe40e('0x4a')][_0xe40e('0x4f')](_0x3403c3[_0xe40e('0x50')],{})[_0xe40e('0x28')](function(_0x56ff62){var _0x28f852=_0x3403c3[_0xe40e('0x51')][_0xe40e('0x29')]({'plain':!![]});if(!_0x28f852)throw new Error(_0xe40e('0x52'));if(_0x28f852[_0xe40e('0x53')]===_0xe40e('0x51')){var _0xe3296e=_0x56ff62[_0xe40e('0x29')]({'plain':!![]});var _0x4d7651=_0xe40e('0x2a');return db['UserProfileSection'][_0xe40e('0x4d')]({'where':{'name':_0x4d7651,'userProfileId':_0x28f852[_0xe40e('0x54')]},'raw':!![]})['then'](function(_0x2f4845){if(_0x2f4845&&_0x2f4845[_0xe40e('0x55')]===0x0){return db[_0xe40e('0x2b')]['create']({'name':_0xe3296e[_0xe40e('0x2f')],'resourceId':_0xe3296e['id'],'type':_0x2f4845[_0xe40e('0x2f')],'sectionId':_0x2f4845['id']},{})['then'](function(){return _0x56ff62;});}else{return _0x56ff62;}})[_0xe40e('0x4e')](function(_0x1a6dd7){logger[_0xe40e('0x2d')](_0xe40e('0x56'),_0x1a6dd7);throw _0x1a6dd7;});}return _0x56ff62;})[_0xe40e('0x28')](respondWithResult(_0x5203e9,0xc9))[_0xe40e('0x4e')](handleError(_0x5203e9,null));};exports[_0xe40e('0x26')]=function(_0x320e74,_0x35c062){if(_0x320e74[_0xe40e('0x50')]['id']){delete _0x320e74[_0xe40e('0x50')]['id'];}return db[_0xe40e('0x4a')][_0xe40e('0x4d')]({'where':{'id':_0x320e74[_0xe40e('0x57')]['id']}})['then'](handleEntityNotFound(_0x35c062,null))[_0xe40e('0x28')](saveUpdates(_0x320e74['body'],null))[_0xe40e('0x28')](respondWithResult(_0x35c062,null))[_0xe40e('0x4e')](handleError(_0x35c062,null));};exports[_0xe40e('0x27')]=function(_0x56d30e,_0x579b85){return db[_0xe40e('0x4a')][_0xe40e('0x4d')]({'where':{'id':_0x56d30e[_0xe40e('0x57')]['id']}})[_0xe40e('0x28')](handleEntityNotFound(_0x579b85,null))[_0xe40e('0x28')](removeEntity(_0x579b85,null))[_0xe40e('0x4e')](handleError(_0x579b85,null));};exports[_0xe40e('0x58')]=function(_0x58563f,_0x10a918,_0x3ee901){if(_0x58563f[_0xe40e('0x50')]['id']){delete _0x58563f[_0xe40e('0x50')]['id'];}return db[_0xe40e('0x4a')][_0xe40e('0x4d')]({'where':{'id':_0x58563f[_0xe40e('0x57')]['id']}})[_0xe40e('0x28')](handleEntityNotFound(_0x10a918,null))[_0xe40e('0x28')](function(_0x515e5b){if(_0x515e5b){_0x58563f['body']['IntervalId']=_0x515e5b['id'];return db[_0xe40e('0x4a')][_0xe40e('0x4f')](_0x58563f[_0xe40e('0x50')]);}})[_0xe40e('0x28')](respondWithResult(_0x10a918,null))['catch'](handleError(_0x10a918,null));};exports['getIntervals']=function(_0x120c1e,_0x58229c,_0x58d53b){var _0x12fe8e={};var _0x3dc3a3={};var _0x491486;var _0x6cfd53;return db[_0xe40e('0x4a')][_0xe40e('0x59')]({'where':{'id':_0x120c1e[_0xe40e('0x57')]['id']}})[_0xe40e('0x28')](handleEntityNotFound(_0x58229c,null))[_0xe40e('0x28')](function(_0x1c18c5){if(_0x1c18c5){_0x491486=_0x1c18c5;_0x3dc3a3[_0xe40e('0x39')]=_[_0xe40e('0x4b')](db['Interval'][_0xe40e('0x5a')]);_0x3dc3a3[_0xe40e('0x36')]=_[_0xe40e('0x4b')](_0x120c1e['query']);_0x3dc3a3[_0xe40e('0x37')]=_[_0xe40e('0x38')](_0x3dc3a3[_0xe40e('0x39')],_0x3dc3a3[_0xe40e('0x36')]);_0x12fe8e[_0xe40e('0x3a')]=_['intersection'](_0x3dc3a3[_0xe40e('0x39')],qs[_0xe40e('0x3b')](_0x120c1e[_0xe40e('0x36')][_0xe40e('0x3b')]));_0x12fe8e['attributes']=_0x12fe8e[_0xe40e('0x3a')][_0xe40e('0x3c')]?_0x12fe8e[_0xe40e('0x3a')]:_0x3dc3a3[_0xe40e('0x39')];_0x12fe8e[_0xe40e('0x3f')]=qs[_0xe40e('0x40')](_0x120c1e['query']['sort']);_0x12fe8e[_0xe40e('0x41')]=qs[_0xe40e('0x37')](_[_0xe40e('0x42')](_0x120c1e[_0xe40e('0x36')],_0x3dc3a3[_0xe40e('0x37')]));if(_0x120c1e[_0xe40e('0x36')]['filter']){_0x12fe8e[_0xe40e('0x41')]=_[_0xe40e('0x44')](_0x12fe8e[_0xe40e('0x41')],{'$or':_['map'](_0x12fe8e[_0xe40e('0x3a')],function(_0x53c2d6){var _0x528ab6={};_0x528ab6[_0x53c2d6]={'$like':'%'+_0x120c1e[_0xe40e('0x36')][_0xe40e('0x43')]+'%'};return _0x528ab6;})});}_0x12fe8e=_[_0xe40e('0x44')]({},_0x12fe8e,_0x120c1e[_0xe40e('0x46')]);return _0x491486[_0xe40e('0x5b')](_0x12fe8e);}})['then'](function(_0x1ee38b){if(_0x1ee38b){_0x6cfd53=_0x1ee38b['length'];if(!_0x120c1e[_0xe40e('0x36')]['hasOwnProperty'](_0xe40e('0x3e'))){_0x12fe8e[_0xe40e('0x20')]=qs[_0xe40e('0x20')](_0x120c1e['query']['limit']);_0x12fe8e['offset']=qs[_0xe40e('0x22')](_0x120c1e[_0xe40e('0x36')][_0xe40e('0x22')]);}return _0x491486['getIntervals'](_0x12fe8e);}})[_0xe40e('0x28')](function(_0x34397d){if(_0x34397d){return _0x34397d?{'count':_0x6cfd53,'rows':_0x34397d}:null;}})[_0xe40e('0x28')](respondWithResult(_0x58229c,null))[_0xe40e('0x4e')](handleError(_0x58229c,null));};exports['addIntervals']=function(_0x346b1c,_0x136355,_0x43e172){return db[_0xe40e('0x4a')][_0xe40e('0x59')]({'where':{'id':_0x346b1c['params']['id']}})[_0xe40e('0x28')](handleEntityNotFound(_0x136355,null))[_0xe40e('0x28')](function(_0xee83dc){if(_0xee83dc){return db[_0xe40e('0x5c')][_0xe40e('0x5d')](function(_0x1f2b52){return db['Interval'][_0xe40e('0x27')]({'where':{'IntervalId':_0x346b1c[_0xe40e('0x57')]['id']},'transaction':_0x1f2b52})[_0xe40e('0x28')](function(_0x159c14){var _0x28b068=_[_0xe40e('0x35')](_0x346b1c[_0xe40e('0x50')],function(_0x5b7a43){delete _0x5b7a43['id'];_0x5b7a43[_0xe40e('0x5e')]=_0x346b1c[_0xe40e('0x57')]['id'];return _0x5b7a43;});return db[_0xe40e('0x4a')][_0xe40e('0x5f')](_0x28b068,{'transaction':_0x1f2b52});});})[_0xe40e('0x28')](function(){return db[_0xe40e('0x4a')]['findAll']({'where':{'IntervalId':_0x346b1c[_0xe40e('0x57')]['id']}});});}})[_0xe40e('0x28')](respondWithResult(_0x136355,null))[_0xe40e('0x4e')](handleError(_0x136355,null));}; \ No newline at end of file +var _0x970e=['sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','limit','undefined','json','apply','save','update','destroy','then','get','Intervals','UserProfileResource','end','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','params','getIntervals','nolimit','addIntervals','findOne'];(function(_0x5958d1,_0x2a674f){var _0x45c028=function(_0x107a52){while(--_0x107a52){_0x5958d1['push'](_0x5958d1['shift']());}};_0x45c028(++_0x2a674f);}(_0x970e,0x114));var _0xe970=function(_0x498b60,_0x86568a){_0x498b60=_0x498b60-0x0;var _0x24beab=_0x970e[_0x498b60];return _0x24beab;};'use strict';var emlformat=require(_0xe970('0x0'));var rimraf=require(_0xe970('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe970('0x2'));var rp=require('request-promise');var moment=require(_0xe970('0x3'));var BPromise=require(_0xe970('0x4'));var Mustache=require(_0xe970('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe970('0x6'));var csv=require(_0xe970('0x7'));var ejs=require(_0xe970('0x8'));var fs=require('fs');var fs_extra=require(_0xe970('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe970('0xa'));var jsforce=require(_0xe970('0xb'));var deskjs=require(_0xe970('0xc'));var toCsv=require(_0xe970('0x7'));var querystring=require('querystring');var Papa=require(_0xe970('0xd'));var Redis=require('ioredis');var authService=require(_0xe970('0xe'));var qs=require(_0xe970('0xf'));var as=require(_0xe970('0x10'));var hardwareService=require(_0xe970('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe970('0x12'));var config=require(_0xe970('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe970('0x14'))['db'];var extensions=require(_0xe970('0x15'));function respondWithStatusCode(_0xedf345,_0x133d9d){_0x133d9d=_0x133d9d||0xcc;return function(_0x47070d){if(_0x47070d){return _0xedf345[_0xe970('0x16')](_0x133d9d);}return _0xedf345[_0xe970('0x17')](_0x133d9d)['end']();};}function respondWithResult(_0x2b0105,_0x183840){_0x183840=_0x183840||0xc8;return function(_0x1d0b09){if(_0x1d0b09){return _0x2b0105[_0xe970('0x17')](_0x183840)['json'](_0x1d0b09);}};}function respondWithFilteredResult(_0x59ad31,_0x261231){return function(_0x548e0b){if(_0x548e0b){var _0x3aef8e=typeof _0x261231[_0xe970('0x18')]==='undefined'&&typeof _0x261231[_0xe970('0x19')]===_0xe970('0x1a');var _0x53e036=_0x548e0b['count'];var _0xe41ad2=_0x3aef8e?0x0:_0x261231[_0xe970('0x18')];var _0x48419b=_0x3aef8e?_0x548e0b['count']:_0x261231['offset']+_0x261231[_0xe970('0x19')];var _0x2bb352;if(_0x48419b>=_0x53e036){_0x48419b=_0x53e036;_0x2bb352=0xc8;}else{_0x2bb352=0xce;}_0x59ad31[_0xe970('0x17')](_0x2bb352);return _0x59ad31['set']('Content-Range',_0xe41ad2+'-'+_0x48419b+'/'+_0x53e036)[_0xe970('0x1b')](_0x548e0b);}return null;};}function patchUpdates(_0x49eb57){return function(_0x4a4cde){try{jsonpatch[_0xe970('0x1c')](_0x4a4cde,_0x49eb57,!![]);}catch(_0x1125c2){return BPromise['reject'](_0x1125c2);}return _0x4a4cde[_0xe970('0x1d')]();};}function saveUpdates(_0x19a1d5,_0x1472ea){return function(_0x365d37){if(_0x365d37){return _0x365d37[_0xe970('0x1e')](_0x19a1d5)['then'](function(_0x41dceb){return _0x41dceb;});}return null;};}function removeEntity(_0x1e738c,_0xfa1b3f){return function(_0x4d020e){if(_0x4d020e){return _0x4d020e[_0xe970('0x1f')]()[_0xe970('0x20')](function(){var _0x253e1f=_0x4d020e[_0xe970('0x21')]({'plain':!![]});var _0x54e060=_0xe970('0x22');return db[_0xe970('0x23')][_0xe970('0x1f')]({'where':{'type':_0x54e060,'resourceId':_0x253e1f['id']}})[_0xe970('0x20')](function(){return _0x4d020e;});})[_0xe970('0x20')](function(){_0x1e738c[_0xe970('0x17')](0xcc)[_0xe970('0x24')]();});}};}function handleEntityNotFound(_0x10c58c,_0x4edd31){return function(_0x142bb0){if(!_0x142bb0){_0x10c58c[_0xe970('0x16')](0x194);}return _0x142bb0;};}function handleError(_0x20a2ef,_0x2a792a){_0x2a792a=_0x2a792a||0x1f4;return function(_0x2ba6a9){logger['error'](_0x2ba6a9[_0xe970('0x25')]);if(_0x2ba6a9['name']){delete _0x2ba6a9[_0xe970('0x26')];}_0x20a2ef['status'](_0x2a792a)[_0xe970('0x27')](_0x2ba6a9);};}exports[_0xe970('0x28')]=function(_0x77fbd8,_0x5a49bf){var _0x4d3816={},_0x470ef8={},_0x12b0ac={'count':0x0,'rows':[]};var _0xb1ed7f=_[_0xe970('0x29')](db[_0xe970('0x2a')][_0xe970('0x2b')],function(_0x493c91){return{'name':_0x493c91[_0xe970('0x2c')],'type':_0x493c91[_0xe970('0x2d')][_0xe970('0x2e')]};});_0x470ef8[_0xe970('0x2f')]=_[_0xe970('0x29')](_0xb1ed7f,_0xe970('0x26'));_0x470ef8['query']=_[_0xe970('0x30')](_0x77fbd8[_0xe970('0x31')]);_0x470ef8['filters']=_[_0xe970('0x32')](_0x470ef8[_0xe970('0x2f')],_0x470ef8['query']);_0x4d3816[_0xe970('0x33')]=_['intersection'](_0x470ef8[_0xe970('0x2f')],qs['fields'](_0x77fbd8[_0xe970('0x31')]['fields']));_0x4d3816['attributes']=_0x4d3816[_0xe970('0x33')][_0xe970('0x34')]?_0x4d3816[_0xe970('0x33')]:_0x470ef8['model'];if(!_0x77fbd8[_0xe970('0x31')][_0xe970('0x35')]('nolimit')){_0x4d3816[_0xe970('0x19')]=qs['limit'](_0x77fbd8[_0xe970('0x31')]['limit']);_0x4d3816['offset']=qs[_0xe970('0x18')](_0x77fbd8[_0xe970('0x31')][_0xe970('0x18')]);}_0x4d3816[_0xe970('0x36')]=qs[_0xe970('0x37')](_0x77fbd8[_0xe970('0x31')][_0xe970('0x37')]);_0x4d3816[_0xe970('0x38')]=qs[_0xe970('0x39')](_[_0xe970('0x3a')](_0x77fbd8[_0xe970('0x31')],_0x470ef8[_0xe970('0x39')]),_0xb1ed7f);if(_0x77fbd8[_0xe970('0x31')][_0xe970('0x3b')]){_0x4d3816['where']=_[_0xe970('0x3c')](_0x4d3816[_0xe970('0x38')],{'$or':_[_0xe970('0x29')](_0xb1ed7f,function(_0xc5ad25){if(_0xc5ad25[_0xe970('0x2d')]!==_0xe970('0x3d')){var _0x31c6d3={};_0x31c6d3[_0xc5ad25[_0xe970('0x26')]]={'$like':'%'+_0x77fbd8[_0xe970('0x31')][_0xe970('0x3b')]+'%'};return _0x31c6d3;}})});}_0x4d3816=_[_0xe970('0x3c')]({},_0x4d3816,_0x77fbd8[_0xe970('0x3e')]);var _0x3afe04={'where':_0x4d3816[_0xe970('0x38')]};return db[_0xe970('0x2a')][_0xe970('0x3f')](_0x3afe04)['then'](function(_0x4a03cb){_0x12b0ac[_0xe970('0x3f')]=_0x4a03cb;if(_0x77fbd8[_0xe970('0x31')][_0xe970('0x40')]){_0x4d3816[_0xe970('0x41')]=[{'all':!![]}];}return db['Interval'][_0xe970('0x42')](_0x4d3816);})[_0xe970('0x20')](function(_0x85dce0){_0x12b0ac[_0xe970('0x43')]=_0x85dce0;return _0x12b0ac;})[_0xe970('0x20')](respondWithFilteredResult(_0x5a49bf,_0x4d3816))[_0xe970('0x44')](handleError(_0x5a49bf,null));};exports[_0xe970('0x45')]=function(_0x11a8b5,_0x151ad9){var _0x4d55b7={'raw':!![],'where':{'id':_0x11a8b5['params']['id']}},_0x5670f4={};_0x5670f4[_0xe970('0x2f')]=_[_0xe970('0x30')](db[_0xe970('0x2a')][_0xe970('0x2b')]);_0x5670f4[_0xe970('0x31')]=_['keys'](_0x11a8b5[_0xe970('0x31')]);_0x5670f4['filters']=_[_0xe970('0x32')](_0x5670f4[_0xe970('0x2f')],_0x5670f4['query']);_0x4d55b7['attributes']=_[_0xe970('0x32')](_0x5670f4[_0xe970('0x2f')],qs[_0xe970('0x46')](_0x11a8b5['query'][_0xe970('0x46')]));_0x4d55b7[_0xe970('0x33')]=_0x4d55b7[_0xe970('0x33')][_0xe970('0x34')]?_0x4d55b7[_0xe970('0x33')]:_0x5670f4[_0xe970('0x2f')];if(_0x11a8b5['query']['includeAll']){_0x4d55b7[_0xe970('0x41')]=[{'all':!![]}];}_0x4d55b7=_['merge']({},_0x4d55b7,_0x11a8b5[_0xe970('0x3e')]);return db[_0xe970('0x2a')]['find'](_0x4d55b7)[_0xe970('0x20')](handleEntityNotFound(_0x151ad9,null))[_0xe970('0x20')](respondWithResult(_0x151ad9,null))[_0xe970('0x44')](handleError(_0x151ad9,null));};exports[_0xe970('0x47')]=function(_0x5878e0,_0x4eb33f){return db[_0xe970('0x2a')][_0xe970('0x47')](_0x5878e0[_0xe970('0x48')],{})['then'](function(_0x337997){var _0x39fdd1=_0x5878e0[_0xe970('0x49')][_0xe970('0x21')]({'plain':!![]});if(!_0x39fdd1)throw new Error(_0xe970('0x4a'));if(_0x39fdd1[_0xe970('0x4b')]===_0xe970('0x49')){var _0x2d7eec=_0x337997[_0xe970('0x21')]({'plain':!![]});var _0x13277c='Intervals';return db[_0xe970('0x4c')][_0xe970('0x4d')]({'where':{'name':_0x13277c,'userProfileId':_0x39fdd1['userProfileId']},'raw':!![]})[_0xe970('0x20')](function(_0xfb706a){if(_0xfb706a&&_0xfb706a[_0xe970('0x4e')]===0x0){return db[_0xe970('0x23')][_0xe970('0x47')]({'name':_0x2d7eec['name'],'resourceId':_0x2d7eec['id'],'type':_0xfb706a['name'],'sectionId':_0xfb706a['id']},{})[_0xe970('0x20')](function(){return _0x337997;});}else{return _0x337997;}})[_0xe970('0x44')](function(_0x181c50){logger[_0xe970('0x4f')](_0xe970('0x50'),_0x181c50);throw _0x181c50;});}return _0x337997;})[_0xe970('0x20')](respondWithResult(_0x4eb33f,0xc9))[_0xe970('0x44')](handleError(_0x4eb33f,null));};exports[_0xe970('0x1e')]=function(_0x56a837,_0x448e0c){if(_0x56a837[_0xe970('0x48')]['id']){delete _0x56a837[_0xe970('0x48')]['id'];}return db[_0xe970('0x2a')][_0xe970('0x4d')]({'where':{'id':_0x56a837['params']['id']}})[_0xe970('0x20')](handleEntityNotFound(_0x448e0c,null))['then'](saveUpdates(_0x56a837[_0xe970('0x48')],null))[_0xe970('0x20')](respondWithResult(_0x448e0c,null))[_0xe970('0x44')](handleError(_0x448e0c,null));};exports['destroy']=function(_0x47795f,_0x2ef745){return db[_0xe970('0x2a')][_0xe970('0x4d')]({'where':{'id':_0x47795f['params']['id']}})[_0xe970('0x20')](handleEntityNotFound(_0x2ef745,null))[_0xe970('0x20')](removeEntity(_0x2ef745,null))[_0xe970('0x44')](handleError(_0x2ef745,null));};exports[_0xe970('0x51')]=function(_0x29b0f2,_0x3d62c0,_0x58a812){if(_0x29b0f2[_0xe970('0x48')]['id']){delete _0x29b0f2['body']['id'];}return db[_0xe970('0x2a')][_0xe970('0x4d')]({'where':{'id':_0x29b0f2['params']['id']}})[_0xe970('0x20')](handleEntityNotFound(_0x3d62c0,null))[_0xe970('0x20')](function(_0x292aca){if(_0x292aca){_0x29b0f2['body'][_0xe970('0x52')]=_0x292aca['id'];return db[_0xe970('0x2a')][_0xe970('0x47')](_0x29b0f2['body']);}})['then'](respondWithResult(_0x3d62c0,null))[_0xe970('0x44')](handleError(_0x3d62c0,null));};exports['getIntervals']=function(_0x2199be,_0x157c3,_0x356ed4){var _0x4ba2b2={};var _0x45bf0e={};var _0x443e3d;var _0x4e6b44;return db[_0xe970('0x2a')]['findOne']({'where':{'id':_0x2199be[_0xe970('0x53')]['id']}})[_0xe970('0x20')](handleEntityNotFound(_0x157c3,null))[_0xe970('0x20')](function(_0x46d421){if(_0x46d421){_0x443e3d=_0x46d421;_0x45bf0e['model']=_[_0xe970('0x30')](db[_0xe970('0x2a')]['rawAttributes']);_0x45bf0e[_0xe970('0x31')]=_[_0xe970('0x30')](_0x2199be[_0xe970('0x31')]);_0x45bf0e[_0xe970('0x39')]=_[_0xe970('0x32')](_0x45bf0e[_0xe970('0x2f')],_0x45bf0e[_0xe970('0x31')]);_0x4ba2b2['attributes']=_[_0xe970('0x32')](_0x45bf0e[_0xe970('0x2f')],qs[_0xe970('0x46')](_0x2199be[_0xe970('0x31')]['fields']));_0x4ba2b2[_0xe970('0x33')]=_0x4ba2b2['attributes'][_0xe970('0x34')]?_0x4ba2b2[_0xe970('0x33')]:_0x45bf0e[_0xe970('0x2f')];_0x4ba2b2[_0xe970('0x36')]=qs[_0xe970('0x37')](_0x2199be[_0xe970('0x31')][_0xe970('0x37')]);_0x4ba2b2[_0xe970('0x38')]=qs['filters'](_[_0xe970('0x3a')](_0x2199be[_0xe970('0x31')],_0x45bf0e[_0xe970('0x39')]));if(_0x2199be[_0xe970('0x31')][_0xe970('0x3b')]){_0x4ba2b2[_0xe970('0x38')]=_[_0xe970('0x3c')](_0x4ba2b2[_0xe970('0x38')],{'$or':_[_0xe970('0x29')](_0x4ba2b2[_0xe970('0x33')],function(_0x4c45e5){var _0x19cf1c={};_0x19cf1c[_0x4c45e5]={'$like':'%'+_0x2199be[_0xe970('0x31')]['filter']+'%'};return _0x19cf1c;})});}_0x4ba2b2=_[_0xe970('0x3c')]({},_0x4ba2b2,_0x2199be[_0xe970('0x3e')]);return _0x443e3d[_0xe970('0x54')](_0x4ba2b2);}})['then'](function(_0x898359){if(_0x898359){_0x4e6b44=_0x898359[_0xe970('0x34')];if(!_0x2199be[_0xe970('0x31')][_0xe970('0x35')](_0xe970('0x55'))){_0x4ba2b2['limit']=qs[_0xe970('0x19')](_0x2199be[_0xe970('0x31')][_0xe970('0x19')]);_0x4ba2b2[_0xe970('0x18')]=qs[_0xe970('0x18')](_0x2199be[_0xe970('0x31')]['offset']);}return _0x443e3d[_0xe970('0x54')](_0x4ba2b2);}})[_0xe970('0x20')](function(_0x189abd){if(_0x189abd){return _0x189abd?{'count':_0x4e6b44,'rows':_0x189abd}:null;}})[_0xe970('0x20')](respondWithResult(_0x157c3,null))['catch'](handleError(_0x157c3,null));};exports[_0xe970('0x56')]=function(_0x4d9ddd,_0x5f45dd,_0x21c3a6){return db[_0xe970('0x2a')][_0xe970('0x57')]({'where':{'id':_0x4d9ddd[_0xe970('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f45dd,null))[_0xe970('0x20')](function(_0x2c6232){if(_0x2c6232){return db[_0xe970('0x58')][_0xe970('0x59')](function(_0x39a4c8){return db[_0xe970('0x2a')][_0xe970('0x1f')]({'where':{'IntervalId':_0x4d9ddd['params']['id']},'transaction':_0x39a4c8})[_0xe970('0x20')](function(_0x1bea1c){var _0x3b70b4=_[_0xe970('0x29')](_0x4d9ddd[_0xe970('0x48')],function(_0x1da304){delete _0x1da304['id'];_0x1da304[_0xe970('0x52')]=_0x4d9ddd[_0xe970('0x53')]['id'];return _0x1da304;});return db['Interval'][_0xe970('0x5a')](_0x3b70b4,{'transaction':_0x39a4c8});});})[_0xe970('0x20')](function(){return db['Interval'][_0xe970('0x42')]({'where':{'IntervalId':_0x4d9ddd[_0xe970('0x53')]['id']}});});}})[_0xe970('0x20')](respondWithResult(_0x5f45dd,null))['catch'](handleError(_0x5f45dd,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 729b22b..c7c3a93 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 _0x63b9=['interval','getIntervals','then','all','reduce','../../components/extensions/rewrite','iftime','define','Interval','rewrite'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x63b9,0x159));var _0x963b=function(_0x4f30c5,_0x5414b2){_0x4f30c5=_0x4f30c5-0x0;var _0x1eabaa=_0x63b9[_0x4f30c5];return _0x1eabaa;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x963b('0x0'));var iftime=require('../../utils/iftime')[_0x963b('0x1')];module['exports']=function(_0x5db281){return _0x5db281[_0x963b('0x2')](_0x963b('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45d8cd){extensions[_0x963b('0x4')](_0x5db281,_0x45d8cd);},'afterBulkCreate':function(_0x2daa77,_0x400e94,_0x5237ea){_0x5237ea();extensions[_0x963b('0x4')](_0x5db281,_0x2daa77[0x0]);},'afterUpdate':function(_0x16465){extensions[_0x963b('0x4')](_0x5db281,_0x16465);},'afterDestroy':function(_0x367668){extensions[_0x963b('0x4')](_0x5db281,_0x367668);}},'instanceMethods':{'ifTime':function(_0x431c79=undefined,_0x55f931=new Date()){if(typeof this[_0x963b('0x5')]==='string'){return iftime(this[_0x963b('0x5')],_0x431c79,_0x55f931);}else{return this[_0x963b('0x6')]()[_0x963b('0x7')](function(_0x30d748){return Promise[_0x963b('0x8')](_0x30d748['map'](function(_0x3d9b6f){return _0x3d9b6f['ifTime'](_0x431c79,_0x55f931);}));})[_0x963b('0x7')](function(_0x1664b0){return _0x1664b0[_0x963b('0x9')](function(_0x58b427,_0x39572c){return _0x58b427||_0x39572c;},![]);});}}}});}; \ No newline at end of file +var _0x9922=['interval','string','getIntervals','then','all','./interval.attributes','iftime','exports','define','Interval','rewrite'];(function(_0x432bfe,_0x30c884){var _0x571a52=function(_0x17c4c8){while(--_0x17c4c8){_0x432bfe['push'](_0x432bfe['shift']());}};_0x571a52(++_0x30c884);}(_0x9922,0x170));var _0x2992=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9922[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x2992('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x2992('0x1')];module[_0x2992('0x2')]=function(_0x19f1a5){return _0x19f1a5[_0x2992('0x3')](_0x2992('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x329d62){extensions['rewrite'](_0x19f1a5,_0x329d62);},'afterBulkCreate':function(_0x66dd28,_0x213c36,_0x57ed15){_0x57ed15();extensions[_0x2992('0x5')](_0x19f1a5,_0x66dd28[0x0]);},'afterUpdate':function(_0x5110a0){extensions['rewrite'](_0x19f1a5,_0x5110a0);},'afterDestroy':function(_0x55d9ae){extensions[_0x2992('0x5')](_0x19f1a5,_0x55d9ae);}},'instanceMethods':{'ifTime':function(_0x3f0f5c=undefined,_0x2d1e4a=new Date()){if(typeof this[_0x2992('0x6')]===_0x2992('0x7')){return iftime(this[_0x2992('0x6')],_0x3f0f5c,_0x2d1e4a);}else{return this[_0x2992('0x8')]()[_0x2992('0x9')](function(_0x1dc7c7){return Promise[_0x2992('0xa')](_0x1dc7c7['map'](function(_0x48d39f){return _0x48d39f['ifTime'](_0x3f0f5c,_0x2d1e4a);}));})[_0x2992('0x9')](function(_0x58be13){return _0x58be13['reduce'](function(_0x3a0253,_0x292922){return _0x3a0253||_0x292922;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a5adf1d..f963054 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 _0xb9b3=['map','attributes','model','info','debug','stringify','catch','error','message','ShowInterval','find','then','all','ifTime','reduce','format','findById','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','where','limit','include'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb9b3,0x10b));var _0x3b9b=function(_0x16d068,_0x3be4e3){_0x16d068=_0x16d068-0x0;var _0x1c17ad=_0xb9b3[_0x16d068];return _0x1c17ad;};'use strict';var _=require(_0x3b9b('0x0'));var util=require(_0x3b9b('0x1'));var db=require(_0x3b9b('0x2'))['db'];var iftime=require(_0x3b9b('0x3'))[_0x3b9b('0x4')];var logger=require('../../config/logger')(_0x3b9b('0x5'));exports[_0x3b9b('0x6')]=function(_0x2804b0){var _0x59e7f9=this;return new Promise(function(_0x49e959,_0x3079f1){return db[_0x3b9b('0x7')][_0x3b9b('0x8')]({'raw':_0x2804b0[_0x3b9b('0x9')]?_0x2804b0[_0x3b9b('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2804b0['options']?_0x2804b0[_0x3b9b('0x9')][_0x3b9b('0xa')]||null:null,'attributes':_0x2804b0['options']?_0x2804b0[_0x3b9b('0x9')]['attributes']||null:null,'limit':_0x2804b0[_0x3b9b('0x9')]?_0x2804b0[_0x3b9b('0x9')][_0x3b9b('0xb')]||null:null,'include':_0x2804b0[_0x3b9b('0x9')]?_0x2804b0[_0x3b9b('0x9')][_0x3b9b('0xc')]?_[_0x3b9b('0xd')](_0x2804b0['options'][_0x3b9b('0xc')],function(_0x4b5f68){return{'model':db[_0x4b5f68['model']],'as':_0x4b5f68['as'],'attributes':_0x4b5f68[_0x3b9b('0xe')],'include':_0x4b5f68['include']?_[_0x3b9b('0xd')](_0x4b5f68['include'],function(_0x1926c2){return{'model':db[_0x1926c2[_0x3b9b('0xf')]],'as':_0x1926c2['as'],'attributes':_0x1926c2[_0x3b9b('0xe')],'include':_0x1926c2[_0x3b9b('0xc')]?_[_0x3b9b('0xd')](_0x1926c2[_0x3b9b('0xc')],function(_0xa7427f){return{'model':db[_0xa7427f[_0x3b9b('0xf')]],'as':_0xa7427f['as'],'attributes':_0xa7427f[_0x3b9b('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ed4cb){logger[_0x3b9b('0x10')](_0x3b9b('0x6'),_0x2804b0);logger[_0x3b9b('0x11')](_0x3b9b('0x6'),_0x2804b0,JSON[_0x3b9b('0x12')](_0x3ed4cb));_0x49e959(_0x3ed4cb);})[_0x3b9b('0x13')](function(_0xd3861b){logger[_0x3b9b('0x14')](_0x3b9b('0x6'),_0xd3861b[_0x3b9b('0x15')],_0x2804b0);_0x3079f1(_0x59e7f9['error'](0x1f4,_0xd3861b['message']));});});};exports[_0x3b9b('0x16')]=function(_0x4470da){var _0x39f71d=this;return new Promise(function(_0x52cdcf,_0x555d6d){return db[_0x3b9b('0x7')][_0x3b9b('0x17')]({'raw':_0x4470da['options']?_0x4470da[_0x3b9b('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x4470da[_0x3b9b('0x9')]?_0x4470da[_0x3b9b('0x9')][_0x3b9b('0xa')]||null:null,'attributes':_0x4470da['options']?_0x4470da[_0x3b9b('0x9')][_0x3b9b('0xe')]||null:null,'include':_0x4470da[_0x3b9b('0x9')]?_0x4470da[_0x3b9b('0x9')][_0x3b9b('0xc')]?_[_0x3b9b('0xd')](_0x4470da[_0x3b9b('0x9')][_0x3b9b('0xc')],function(_0x455f01){return{'model':db[_0x455f01['model']],'as':_0x455f01['as'],'attributes':_0x455f01[_0x3b9b('0xe')],'include':_0x455f01[_0x3b9b('0xc')]?_[_0x3b9b('0xd')](_0x455f01['include'],function(_0x3dd01f){return{'model':db[_0x3dd01f[_0x3b9b('0xf')]],'as':_0x3dd01f['as'],'attributes':_0x3dd01f['attributes'],'include':_0x3dd01f['include']?_[_0x3b9b('0xd')](_0x3dd01f[_0x3b9b('0xc')],function(_0x5b9f20){return{'model':db[_0x5b9f20[_0x3b9b('0xf')]],'as':_0x5b9f20['as'],'attributes':_0x5b9f20[_0x3b9b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x3b9b('0x18')](function(_0xf1ce8d){logger[_0x3b9b('0x10')]('ShowInterval',_0x4470da);logger['debug'](_0x3b9b('0x16'),_0x4470da,JSON[_0x3b9b('0x12')](_0xf1ce8d));_0x52cdcf(_0xf1ce8d);})[_0x3b9b('0x13')](function(_0x577742){logger[_0x3b9b('0x14')](_0x3b9b('0x16'),_0x577742[_0x3b9b('0x15')],_0x4470da);_0x555d6d(_0x39f71d['error'](0x1f4,_0x577742[_0x3b9b('0x15')]));});});};function checkArrayOfIntervals(_0x46c899,_0x5516e3){var _0x251d49=[];return db[_0x3b9b('0x7')]['findAll']({'where':{'id':_0x46c899}})[_0x3b9b('0x18')](function(_0x397305){_0x251d49=_0x397305;return Promise[_0x3b9b('0x19')](_0x251d49['map'](function(_0x39faaf){return _0x39faaf[_0x3b9b('0x1a')](_0x5516e3);}));})[_0x3b9b('0x18')](function(_0x32333d){var _0x2fa6a8=_0x32333d[_0x3b9b('0x1b')](function(_0x3e503f,_0xb37ceb){return _0x3e503f||_0xb37ceb;},![]);logger[_0x3b9b('0x10')](util[_0x3b9b('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x251d49['map'](function(_0x54ec0a){return _0x54ec0a['name'];})['join'](',\x20'),_0x251d49[_0x3b9b('0xd')](function(_0x2950a2){return _0x2950a2['id'];})['join'](',\x20')));return _0x2fa6a8;});}function checkSingleInterval(_0x45198c,_0x4f7b33){return db['Interval'][_0x3b9b('0x1d')](_0x45198c)['then'](function(_0x48db9e){if(_0x48db9e){logger[_0x3b9b('0x10')](util[_0x3b9b('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x48db9e['name'],_0x48db9e['id']));return _0x48db9e[_0x3b9b('0x1a')](_0x4f7b33);}});}exports[_0x3b9b('0x1e')]=function(_0x239537){var _0x5b4215=_0x239537[_0x3b9b('0x1f')];var _0x4f6d30=Array[_0x3b9b('0x20')](_0x239537[_0x3b9b('0x21')])?_0x239537[_0x3b9b('0x21')]:typeof _0x239537[_0x3b9b('0x21')]===_0x3b9b('0x22')?[_0x239537[_0x3b9b('0x21')]]:[];var _0x5c8459=_0x239537['timezone']||undefined;var _0x397daa=![];if(_0x4f6d30[_0x3b9b('0x23')]){logger[_0x3b9b('0x10')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x4f6d30['join'](';\x20')));}if(_0x5c8459){logger[_0x3b9b('0x10')](util['format'](_0x3b9b('0x24'),_0x5c8459));}logger['debug'](_0x3b9b('0x25'),_0x397daa);logger[_0x3b9b('0x26')]('IntervalIftime',_0x239537);return Promise[_0x3b9b('0x27')]()[_0x3b9b('0x18')](function(){if(Array[_0x3b9b('0x20')](_0x5b4215)){return checkArrayOfIntervals(_0x5b4215,_0x5c8459);}else if(_0x5b4215){return checkSingleInterval(_0x5b4215,_0x5c8459);}})['then'](function(_0x37ef81){var _0x4fb260=_0x4f6d30[_0x3b9b('0x1b')](function(_0x237ab3,_0x43c82c){return _0x237ab3||iftime(_0x43c82c,_0x5c8459);},![]);_0x397daa=_0x37ef81||_0x4fb260;return _0x397daa;})[_0x3b9b('0x13')](function(_0x41629e){logger[_0x3b9b('0x14')](_0x3b9b('0x1e'),_0x239537,_0x41629e);throw this[_0x3b9b('0x14')](0x1f4,_0x41629e[_0x3b9b('0x15')]);});}; \ No newline at end of file +var _0x5093=['IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','then','util','../../mysqldb','../../utils/iftime','rpc','findAll','options','where','limit','include','model','map','attributes','info','GetInterval','catch','error','message','ShowInterval','find','raw','debug','stringify','Interval','all','ifTime','reduce','format','join'];(function(_0x41426b,_0x50113b){var _0x1ec1e2=function(_0x834964){while(--_0x834964){_0x41426b['push'](_0x41426b['shift']());}};_0x1ec1e2(++_0x50113b);}(_0x5093,0x78));var _0x3509=function(_0x53d2d4,_0x1f63eb){_0x53d2d4=_0x53d2d4-0x0;var _0x2128d2=_0x5093[_0x53d2d4];return _0x2128d2;};'use strict';var _=require('lodash');var util=require(_0x3509('0x0'));var db=require(_0x3509('0x1'))['db'];var iftime=require(_0x3509('0x2'))['iftime'];var logger=require('../../config/logger')(_0x3509('0x3'));exports['GetInterval']=function(_0x5c6e29){var _0x2e386a=this;return new Promise(function(_0x38d237,_0x145ae0){return db['Interval'][_0x3509('0x4')]({'raw':_0x5c6e29[_0x3509('0x5')]?_0x5c6e29['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c6e29[_0x3509('0x5')]?_0x5c6e29[_0x3509('0x5')][_0x3509('0x6')]||null:null,'attributes':_0x5c6e29[_0x3509('0x5')]?_0x5c6e29[_0x3509('0x5')]['attributes']||null:null,'limit':_0x5c6e29[_0x3509('0x5')]?_0x5c6e29[_0x3509('0x5')][_0x3509('0x7')]||null:null,'include':_0x5c6e29[_0x3509('0x5')]?_0x5c6e29[_0x3509('0x5')][_0x3509('0x8')]?_['map'](_0x5c6e29['options'][_0x3509('0x8')],function(_0x25288b){return{'model':db[_0x25288b[_0x3509('0x9')]],'as':_0x25288b['as'],'attributes':_0x25288b['attributes'],'include':_0x25288b['include']?_[_0x3509('0xa')](_0x25288b['include'],function(_0x3ce856){return{'model':db[_0x3ce856[_0x3509('0x9')]],'as':_0x3ce856['as'],'attributes':_0x3ce856[_0x3509('0xb')],'include':_0x3ce856[_0x3509('0x8')]?_[_0x3509('0xa')](_0x3ce856['include'],function(_0x12b58d){return{'model':db[_0x12b58d[_0x3509('0x9')]],'as':_0x12b58d['as'],'attributes':_0x12b58d[_0x3509('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4961c9){logger[_0x3509('0xc')](_0x3509('0xd'),_0x5c6e29);logger['debug'](_0x3509('0xd'),_0x5c6e29,JSON['stringify'](_0x4961c9));_0x38d237(_0x4961c9);})[_0x3509('0xe')](function(_0x3d1c74){logger[_0x3509('0xf')]('GetInterval',_0x3d1c74[_0x3509('0x10')],_0x5c6e29);_0x145ae0(_0x2e386a[_0x3509('0xf')](0x1f4,_0x3d1c74['message']));});});};exports[_0x3509('0x11')]=function(_0x56d9b1){var _0x37389f=this;return new Promise(function(_0x12b04d,_0x14b5ca){return db['Interval'][_0x3509('0x12')]({'raw':_0x56d9b1[_0x3509('0x5')]?_0x56d9b1[_0x3509('0x5')][_0x3509('0x13')]===undefined?!![]:![]:!![],'where':_0x56d9b1['options']?_0x56d9b1['options'][_0x3509('0x6')]||null:null,'attributes':_0x56d9b1[_0x3509('0x5')]?_0x56d9b1['options'][_0x3509('0xb')]||null:null,'include':_0x56d9b1[_0x3509('0x5')]?_0x56d9b1[_0x3509('0x5')][_0x3509('0x8')]?_[_0x3509('0xa')](_0x56d9b1[_0x3509('0x5')][_0x3509('0x8')],function(_0x29abde){return{'model':db[_0x29abde[_0x3509('0x9')]],'as':_0x29abde['as'],'attributes':_0x29abde[_0x3509('0xb')],'include':_0x29abde[_0x3509('0x8')]?_[_0x3509('0xa')](_0x29abde['include'],function(_0x3388bb){return{'model':db[_0x3388bb[_0x3509('0x9')]],'as':_0x3388bb['as'],'attributes':_0x3388bb[_0x3509('0xb')],'include':_0x3388bb[_0x3509('0x8')]?_[_0x3509('0xa')](_0x3388bb['include'],function(_0xc60381){return{'model':db[_0xc60381['model']],'as':_0xc60381['as'],'attributes':_0xc60381[_0x3509('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c5f79){logger['info']('ShowInterval',_0x56d9b1);logger[_0x3509('0x14')](_0x3509('0x11'),_0x56d9b1,JSON[_0x3509('0x15')](_0x1c5f79));_0x12b04d(_0x1c5f79);})[_0x3509('0xe')](function(_0x39ed11){logger[_0x3509('0xf')](_0x3509('0x11'),_0x39ed11['message'],_0x56d9b1);_0x14b5ca(_0x37389f[_0x3509('0xf')](0x1f4,_0x39ed11[_0x3509('0x10')]));});});};function checkArrayOfIntervals(_0x34752b,_0x3653b4){var _0x61a4f9=[];return db[_0x3509('0x16')][_0x3509('0x4')]({'where':{'id':_0x34752b}})['then'](function(_0x79d692){_0x61a4f9=_0x79d692;return Promise[_0x3509('0x17')](_0x61a4f9[_0x3509('0xa')](function(_0x3ba395){return _0x3ba395[_0x3509('0x18')](_0x3653b4);}));})['then'](function(_0x55e085){var _0x5a9a72=_0x55e085[_0x3509('0x19')](function(_0xb68dd8,_0x5ccc2f){return _0xb68dd8||_0x5ccc2f;},![]);logger['info'](util[_0x3509('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x61a4f9[_0x3509('0xa')](function(_0x458620){return _0x458620['name'];})[_0x3509('0x1b')](',\x20'),_0x61a4f9[_0x3509('0xa')](function(_0x1294ee){return _0x1294ee['id'];})[_0x3509('0x1b')](',\x20')));return _0x5a9a72;});}function checkSingleInterval(_0x1787d0,_0x2d6346){return db['Interval']['findById'](_0x1787d0)['then'](function(_0x106628){if(_0x106628){logger['info'](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x106628['name'],_0x106628['id']));return _0x106628[_0x3509('0x18')](_0x2d6346);}});}exports[_0x3509('0x1c')]=function(_0x26fa10){var _0x1d0de7=_0x26fa10[_0x3509('0x1d')];var _0x436865=Array['isArray'](_0x26fa10[_0x3509('0x1e')])?_0x26fa10['intervals']:typeof _0x26fa10[_0x3509('0x1e')]===_0x3509('0x1f')?[_0x26fa10[_0x3509('0x1e')]]:[];var _0x404cc2=_0x26fa10['timezone']||undefined;var _0x1d831e=![];if(_0x436865[_0x3509('0x20')]){logger[_0x3509('0xc')](util[_0x3509('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x436865['join'](';\x20')));}if(_0x404cc2){logger[_0x3509('0xc')](util[_0x3509('0x1a')](_0x3509('0x21'),_0x404cc2));}logger[_0x3509('0x14')](_0x3509('0x22'),_0x1d831e);logger[_0x3509('0x23')](_0x3509('0x1c'),_0x26fa10);return Promise['resolve']()[_0x3509('0x24')](function(){if(Array['isArray'](_0x1d0de7)){return checkArrayOfIntervals(_0x1d0de7,_0x404cc2);}else if(_0x1d0de7){return checkSingleInterval(_0x1d0de7,_0x404cc2);}})[_0x3509('0x24')](function(_0x2d0d64){var _0x48b68c=_0x436865[_0x3509('0x19')](function(_0x18e980,_0x37f6e9){return _0x18e980||iftime(_0x37f6e9,_0x404cc2);},![]);_0x1d831e=_0x2d0d64||_0x48b68c;return _0x1d831e;})[_0x3509('0xe')](function(_0x4ff7a3){logger[_0x3509('0xf')](_0x3509('0x1c'),_0x26fa10,_0x4ff7a3);throw this['error'](0x1f4,_0x4ff7a3[_0x3509('0x10')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c917070..2d0890e 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1773d2,_0x3dcf49){var _0x1b850d=function(_0x127a0d){while(--_0x127a0d){_0x1773d2['push'](_0x1773d2['shift']());}};_0x1b850d(++_0x3dcf49);}(_0x2ef3,0xba));var _0x32ef=function(_0x4cd4b0,_0x10d16f){_0x4cd4b0=_0x4cd4b0-0x0;var _0x3d9b63=_0x2ef3[_0x4cd4b0];return _0x3d9b63;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1114dc,_0x50aed4){var _0x164894=function(_0x40ec33){while(--_0x40ec33){_0x1114dc['push'](_0x1114dc['shift']());}};_0x164894(++_0x50aed4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f3193,_0x500f84){_0x4f3193=_0x4f3193-0x0;var _0x5f53fa=_0x5f2f[_0x4f3193];return _0x5f53fa;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f104798..dcd17b6 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 _0x8031=['end','openIssue','send','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','issuetype','fields','customfield_11500','customfield_11502','newToken','customfield_11503','reason','customfield_10102','/rest/api/2/issue','toString','base64','stringify','request','setEncoding','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8031,0x170));var _0x1803=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x8031[_0x3070dc];return _0x431489;};'use strict';var BPromise=require(_0x1803('0x0'));var https=require(_0x1803('0x1'));var logger=require(_0x1803('0x2'))('api');var USERNAME=_0x1803('0x3');var PASSWORD=_0x1803('0x4');function openIssue(_0xde8d4f,_0x54599d){var _0x2c2242={'fields':{'project':{'key':_0xde8d4f[_0x1803('0x5')]||_0x1803('0x6')},'summary':(_0xde8d4f[_0x1803('0x7')]||'Report')+_0x1803('0x8')+_0xde8d4f['ip'],'description':_0xde8d4f[_0x1803('0x9')]||JSON['stringify'](_0xde8d4f),'issuetype':{'name':_0xde8d4f[_0x1803('0xa')]||'Bug'}}};_0x2c2242[_0x1803('0xb')][_0x1803('0xc')]=_0xde8d4f['email'];_0x2c2242[_0x1803('0xb')]['customfield_11501']=_0xde8d4f['oldToken'];_0x2c2242['fields'][_0x1803('0xd')]=_0xde8d4f[_0x1803('0xe')];_0x2c2242[_0x1803('0xb')][_0x1803('0xf')]=_0xde8d4f['name'];_0x2c2242[_0x1803('0xb')]['customfield_11504']=_0xde8d4f[_0x1803('0x10')];_0x2c2242[_0x1803('0xb')][_0x1803('0x11')]=_0xde8d4f['ip'];var _0x1e3ccb={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x1803('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1803('0x13')](_0x1803('0x14'))}};var _0x373c9e=JSON[_0x1803('0x15')](_0x2c2242);var _0x58fb7f=https[_0x1803('0x16')](_0x1e3ccb,function(_0x1ae7b7){_0x1ae7b7[_0x1803('0x17')](_0x1803('0x18'));var _0x32db28='';_0x1ae7b7['on']('data',function(_0x2f25f8){_0x32db28+=_0x2f25f8;});_0x1ae7b7['on']('end',function(){if(_0x54599d){return _0x54599d[_0x1803('0x19')](_0x1ae7b7[_0x1803('0x1a')])[_0x1803('0x1b')](JSON[_0x1803('0x1c')](_0x32db28));}});});_0x58fb7f['on'](_0x1803('0x1d'),function(_0x542f77){if(_0x54599d){return _0x54599d[_0x1803('0x19')](0x1f4)[_0x1803('0x1b')]({'errors':[{'message':_0x1803('0x1e'),'type':_0x1803('0x1f')}]});}});_0x58fb7f['write'](_0x373c9e);_0x58fb7f[_0x1803('0x20')]();}exports[_0x1803('0x21')]=openIssue;exports[_0x1803('0x22')]=function(_0x2968e1,_0x1f5fe6){_0x2968e1['body']['ip']=_0x2968e1['headers'][_0x1803('0x23')]||_0x2968e1[_0x1803('0x24')]['remoteAddress']||_0x2968e1[_0x1803('0x25')][_0x1803('0x26')]||_0x2968e1[_0x1803('0x24')][_0x1803('0x25')][_0x1803('0x26')];return openIssue(_0x2968e1[_0x1803('0x27')],_0x1f5fe6);}; \ No newline at end of file +var _0xfd67=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird'];(function(_0x33a0bd,_0x2bc749){var _0x1f3187=function(_0x6ceda7){while(--_0x6ceda7){_0x33a0bd['push'](_0x33a0bd['shift']());}};_0x1f3187(++_0x2bc749);}(_0xfd67,0xaf));var _0x7fd6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xfd67[_0x19950b];return _0x3c6b41;};'use strict';var BPromise=require(_0x7fd6('0x0'));var https=require('https');var logger=require(_0x7fd6('0x1'))(_0x7fd6('0x2'));var USERNAME=_0x7fd6('0x3');var PASSWORD=_0x7fd6('0x4');function openIssue(_0x128da7,_0x44759b){var _0x51aa30={'fields':{'project':{'key':_0x128da7['key']||_0x7fd6('0x5')},'summary':(_0x128da7[_0x7fd6('0x6')]||_0x7fd6('0x7'))+'\x20from\x20'+_0x128da7['ip'],'description':_0x128da7[_0x7fd6('0x8')]||JSON[_0x7fd6('0x9')](_0x128da7),'issuetype':{'name':_0x128da7[_0x7fd6('0xa')]||_0x7fd6('0xb')}}};_0x51aa30[_0x7fd6('0xc')][_0x7fd6('0xd')]=_0x128da7[_0x7fd6('0xe')];_0x51aa30['fields'][_0x7fd6('0xf')]=_0x128da7['oldToken'];_0x51aa30[_0x7fd6('0xc')][_0x7fd6('0x10')]=_0x128da7[_0x7fd6('0x11')];_0x51aa30['fields']['customfield_11503']=_0x128da7[_0x7fd6('0x12')];_0x51aa30[_0x7fd6('0xc')][_0x7fd6('0x13')]=_0x128da7[_0x7fd6('0x14')];_0x51aa30[_0x7fd6('0xc')]['customfield_10102']=_0x128da7['ip'];var _0x71f32e={'host':_0x7fd6('0x15'),'port':0x1bb,'path':_0x7fd6('0x16'),'method':_0x7fd6('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x7fd6('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x7fd6('0x19')](_0x7fd6('0x1a'))}};var _0x1ed938=JSON[_0x7fd6('0x9')](_0x51aa30);var _0x58aebe=https[_0x7fd6('0x1b')](_0x71f32e,function(_0x29f25a){_0x29f25a[_0x7fd6('0x1c')](_0x7fd6('0x1d'));var _0x224fe1='';_0x29f25a['on'](_0x7fd6('0x1e'),function(_0x4cc7e5){_0x224fe1+=_0x4cc7e5;});_0x29f25a['on'](_0x7fd6('0x1f'),function(){if(_0x44759b){return _0x44759b[_0x7fd6('0x20')](_0x29f25a['statusCode'])[_0x7fd6('0x21')](JSON[_0x7fd6('0x22')](_0x224fe1));}});});_0x58aebe['on']('error',function(_0x250407){if(_0x44759b){return _0x44759b[_0x7fd6('0x20')](0x1f4)[_0x7fd6('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x58aebe[_0x7fd6('0x23')](_0x1ed938);_0x58aebe[_0x7fd6('0x1f')]();}exports[_0x7fd6('0x24')]=openIssue;exports[_0x7fd6('0x25')]=function(_0x164e68,_0xc834a7){_0x164e68['body']['ip']=_0x164e68[_0x7fd6('0x26')][_0x7fd6('0x27')]||_0x164e68[_0x7fd6('0x28')][_0x7fd6('0x29')]||_0x164e68[_0x7fd6('0x2a')][_0x7fd6('0x29')]||_0x164e68[_0x7fd6('0x28')][_0x7fd6('0x2a')][_0x7fd6('0x29')];return openIssue(_0x164e68[_0x7fd6('0x2b')],_0xc834a7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0f2d440..a022453 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 _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0x2f91ad,_0x4c5495){var _0x5d25ed=function(_0x318192){while(--_0x318192){_0x2f91ad['push'](_0x2f91ad['shift']());}};_0x5d25ed(++_0x4c5495);}(_0x0bb5,0x148));var _0x50bb=function(_0x850fec,_0x4e0948){_0x850fec=_0x850fec-0x0;var _0x9164b7=_0x0bb5[_0x850fec];return _0x9164b7;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x535082,_0x52f0a8){var _0x32cdc9=function(_0x354f40){while(--_0x354f40){_0x535082['push'](_0x535082['shift']());}};_0x32cdc9(++_0x52f0a8);}(_0x5b02,0xe9));var _0x25b0=function(_0x6a87f0,_0x4fa8a9){_0x6a87f0=_0x6a87f0-0x0;var _0x2f7e01=_0x5b02[_0x6a87f0];return _0x2f7e01;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index dfa686f..527bdc6 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x17a74e,_0x187f3f){_0x17a74e=_0x17a74e-0x0;var _0x4af833=_0x7a54[_0x17a74e];return _0x4af833;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x24732a,_0x4204d5){_0x24732a=_0x24732a-0x0;var _0x1232b0=_0x7a54[_0x24732a];return _0x1232b0;};'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 d32b7c4..fa5b223 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 _0x1354=['moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5a8531,_0x30ca48){var _0x578028=function(_0xb2108c){while(--_0xb2108c){_0x5a8531['push'](_0x5a8531['shift']());}};_0x578028(++_0x30ca48);}(_0x1354,0x95));var _0x4135=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0x1354[_0x390752];return _0x5eca55;};'use strict';var emlformat=require(_0x4135('0x0'));var rimraf=require(_0x4135('0x1'));var zipdir=require(_0x4135('0x2'));var jsonpatch=require(_0x4135('0x3'));var rp=require(_0x4135('0x4'));var moment=require(_0x4135('0x5'));var BPromise=require(_0x4135('0x6'));var Mustache=require('mustache');var util=require(_0x4135('0x7'));var path=require(_0x4135('0x8'));var sox=require(_0x4135('0x9'));var csv=require('to-csv');var ejs=require(_0x4135('0xa'));var fs=require('fs');var fs_extra=require(_0x4135('0xb'));var _=require('lodash');var squel=require(_0x4135('0xc'));var crypto=require(_0x4135('0xd'));var jsforce=require(_0x4135('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4135('0xf'));var querystring=require('querystring');var Papa=require(_0x4135('0x10'));var Redis=require(_0x4135('0x11'));var authService=require(_0x4135('0x12'));var qs=require(_0x4135('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4135('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4135('0x15'));var config=require(_0x4135('0x16'));var licenseUtil=require(_0x4135('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307e6f,_0x838d6f){_0x838d6f=_0x838d6f||0xcc;return function(_0xb825cb){if(_0xb825cb){return _0x307e6f[_0x4135('0x18')](_0x838d6f);}return _0x307e6f[_0x4135('0x19')](_0x838d6f)[_0x4135('0x1a')]();};}function respondWithResult(_0x54f954,_0x50dd01){_0x50dd01=_0x50dd01||0xc8;return function(_0x249c86){if(_0x249c86){return _0x54f954[_0x4135('0x19')](_0x50dd01)[_0x4135('0x1b')](_0x249c86);}};}function respondWithFilteredResult(_0x17179a,_0x4b7609){return function(_0x34fd82){if(_0x34fd82){var _0x2e8733=typeof _0x4b7609['offset']==='undefined'&&typeof _0x4b7609[_0x4135('0x1c')]==='undefined';var _0x2f2600=_0x34fd82['count'];var _0x53f54e=_0x2e8733?0x0:_0x4b7609['offset'];var _0x53f5a7=_0x2e8733?_0x34fd82[_0x4135('0x1d')]:_0x4b7609['offset']+_0x4b7609[_0x4135('0x1c')];var _0xf81757;if(_0x53f5a7>=_0x2f2600){_0x53f5a7=_0x2f2600;_0xf81757=0xc8;}else{_0xf81757=0xce;}_0x17179a[_0x4135('0x19')](_0xf81757);return _0x17179a['set'](_0x4135('0x1e'),_0x53f54e+'-'+_0x53f5a7+'/'+_0x2f2600)[_0x4135('0x1b')](_0x34fd82);}return null;};}function patchUpdates(_0x398294){return function(_0x485395){try{jsonpatch[_0x4135('0x1f')](_0x485395,_0x398294,!![]);}catch(_0x58bdb1){return BPromise[_0x4135('0x20')](_0x58bdb1);}return _0x485395[_0x4135('0x21')]();};}function saveUpdates(_0x314f11,_0x188707){return function(_0x5a3777){if(_0x5a3777){return _0x5a3777[_0x4135('0x22')](_0x314f11)[_0x4135('0x23')](function(_0x32dcf6){return _0x32dcf6;});}return null;};}function removeEntity(_0x3912e9,_0x83a794){return function(_0x2c604b){if(_0x2c604b){return _0x2c604b[_0x4135('0x24')]()[_0x4135('0x23')](function(){_0x3912e9[_0x4135('0x19')](0xcc)[_0x4135('0x1a')]();});}};}function handleEntityNotFound(_0x12a9fd,_0x192126){return function(_0x212228){if(!_0x212228){_0x12a9fd[_0x4135('0x18')](0x194);}return _0x212228;};}function handleError(_0x4b448f,_0x1a3d30){_0x1a3d30=_0x1a3d30||0x1f4;return function(_0x3e40bc){logger[_0x4135('0x25')](_0x3e40bc[_0x4135('0x26')]);if(_0x3e40bc[_0x4135('0x27')]){delete _0x3e40bc[_0x4135('0x27')];}_0x4b448f['status'](_0x1a3d30)[_0x4135('0x28')](_0x3e40bc);};}exports[_0x4135('0x29')]=function(_0x31b508,_0x2c06d0){var _0x284121={},_0x511fce={},_0x411ee0={'count':0x0,'rows':[]};var _0x381e86=_['map'](db[_0x4135('0x2a')]['rawAttributes'],function(_0x2438d2){return{'name':_0x2438d2[_0x4135('0x2b')],'type':_0x2438d2[_0x4135('0x2c')][_0x4135('0x2d')]};});_0x511fce['model']=_[_0x4135('0x2e')](_0x381e86,_0x4135('0x27'));_0x511fce[_0x4135('0x2f')]=_[_0x4135('0x30')](_0x31b508[_0x4135('0x2f')]);_0x511fce[_0x4135('0x31')]=_['intersection'](_0x511fce[_0x4135('0x32')],_0x511fce[_0x4135('0x2f')]);_0x284121['attributes']=_[_0x4135('0x33')](_0x511fce['model'],qs[_0x4135('0x34')](_0x31b508[_0x4135('0x2f')]['fields']));_0x284121['attributes']=_0x284121[_0x4135('0x35')][_0x4135('0x36')]?_0x284121[_0x4135('0x35')]:_0x511fce['model'];if(!_0x31b508[_0x4135('0x2f')][_0x4135('0x37')](_0x4135('0x38'))){_0x284121['limit']=qs[_0x4135('0x1c')](_0x31b508[_0x4135('0x2f')]['limit']);_0x284121[_0x4135('0x39')]=qs[_0x4135('0x39')](_0x31b508['query'][_0x4135('0x39')]);}_0x284121['order']=qs[_0x4135('0x3a')](_0x31b508[_0x4135('0x2f')][_0x4135('0x3a')]);_0x284121[_0x4135('0x3b')]=qs[_0x4135('0x31')](_[_0x4135('0x3c')](_0x31b508['query'],_0x511fce[_0x4135('0x31')]),_0x381e86);if(_0x31b508[_0x4135('0x2f')]['filter']){_0x284121[_0x4135('0x3b')]=_['merge'](_0x284121[_0x4135('0x3b')],{'$or':_[_0x4135('0x2e')](_0x381e86,function(_0x14f353){if(_0x14f353[_0x4135('0x2c')]!==_0x4135('0x3d')){var _0x41ce9e={};_0x41ce9e[_0x14f353[_0x4135('0x27')]]={'$like':'%'+_0x31b508[_0x4135('0x2f')][_0x4135('0x3e')]+'%'};return _0x41ce9e;}})});}_0x284121=_[_0x4135('0x3f')]({},_0x284121,_0x31b508[_0x4135('0x40')]);var _0x53689f={'where':_0x284121['where']};return db[_0x4135('0x2a')][_0x4135('0x1d')](_0x53689f)[_0x4135('0x23')](function(_0x2dfd11){_0x411ee0[_0x4135('0x1d')]=_0x2dfd11;if(_0x31b508['query'][_0x4135('0x41')]){_0x284121[_0x4135('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4135('0x43')](_0x284121);})[_0x4135('0x23')](function(_0x1ddad4){_0x411ee0[_0x4135('0x44')]=_0x1ddad4;return _0x411ee0;})['then'](respondWithFilteredResult(_0x2c06d0,_0x284121))['catch'](handleError(_0x2c06d0,null));};exports[_0x4135('0x45')]=function(_0x58c6e1,_0x166ecb){var _0x5894fb={'raw':!![],'where':{'id':_0x58c6e1['params']['id']}},_0x25d1c4={};_0x25d1c4[_0x4135('0x32')]=_['keys'](db[_0x4135('0x2a')][_0x4135('0x46')]);_0x25d1c4[_0x4135('0x2f')]=_['keys'](_0x58c6e1[_0x4135('0x2f')]);_0x25d1c4[_0x4135('0x31')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],_0x25d1c4[_0x4135('0x2f')]);_0x5894fb[_0x4135('0x35')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],qs[_0x4135('0x34')](_0x58c6e1[_0x4135('0x2f')]['fields']));_0x5894fb[_0x4135('0x35')]=_0x5894fb[_0x4135('0x35')][_0x4135('0x36')]?_0x5894fb[_0x4135('0x35')]:_0x25d1c4[_0x4135('0x32')];if(_0x58c6e1['query'][_0x4135('0x41')]){_0x5894fb['include']=[{'all':!![]}];}_0x5894fb=_['merge']({},_0x5894fb,_0x58c6e1[_0x4135('0x40')]);return db[_0x4135('0x2a')][_0x4135('0x47')](_0x5894fb)[_0x4135('0x23')](handleEntityNotFound(_0x166ecb,null))[_0x4135('0x23')](respondWithResult(_0x166ecb,null))[_0x4135('0x48')](handleError(_0x166ecb,null));};exports[_0x4135('0x49')]=function(_0x18aed5,_0x13f1f1){return db[_0x4135('0x2a')][_0x4135('0x49')](_0x18aed5[_0x4135('0x4a')],{})[_0x4135('0x23')](respondWithResult(_0x13f1f1,0xc9))[_0x4135('0x48')](handleError(_0x13f1f1,null));};exports[_0x4135('0x22')]=function(_0x74a924,_0x540029){if(_0x74a924[_0x4135('0x4a')]['id']){delete _0x74a924['body']['id'];}return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x74a924[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x540029,null))[_0x4135('0x23')](saveUpdates(_0x74a924[_0x4135('0x4a')],null))[_0x4135('0x23')](respondWithResult(_0x540029,null))['catch'](handleError(_0x540029,null));};exports['destroy']=function(_0x1b98e8,_0x5b6255){return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x1b98e8[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5b6255,null))[_0x4135('0x23')](removeEntity(_0x5b6255,null))[_0x4135('0x48')](handleError(_0x5b6255,null));};exports['describe']=function(_0x1c4049,_0x31c532){return db[_0x4135('0x2a')][_0x4135('0x4c')]()[_0x4135('0x23')](respondWithResult(_0x31c532,null))[_0x4135('0x48')](handleError(_0x31c532,null));}; \ No newline at end of file +var _0x0734=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','set'];(function(_0x29aa6a,_0x337825){var _0x10d518=function(_0x3cd73a){while(--_0x3cd73a){_0x29aa6a['push'](_0x29aa6a['shift']());}};_0x10d518(++_0x337825);}(_0x0734,0xba));var _0x4073=function(_0x1d9615,_0x3f6e94){_0x1d9615=_0x1d9615-0x0;var _0xcc8025=_0x0734[_0x1d9615];return _0xcc8025;};'use strict';var emlformat=require(_0x4073('0x0'));var rimraf=require(_0x4073('0x1'));var zipdir=require(_0x4073('0x2'));var jsonpatch=require(_0x4073('0x3'));var rp=require(_0x4073('0x4'));var moment=require('moment');var BPromise=require(_0x4073('0x5'));var Mustache=require(_0x4073('0x6'));var util=require(_0x4073('0x7'));var path=require(_0x4073('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4073('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4073('0xa'));var squel=require(_0x4073('0xb'));var crypto=require(_0x4073('0xc'));var jsforce=require(_0x4073('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4073('0xe'));var querystring=require('querystring');var Papa=require(_0x4073('0xf'));var Redis=require(_0x4073('0x10'));var authService=require(_0x4073('0x11'));var qs=require(_0x4073('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4073('0x13'))(_0x4073('0x14'));var utils=require('../../config/utils');var config=require(_0x4073('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4073('0x16'))['db'];function respondWithStatusCode(_0x4c496c,_0x1778d8){_0x1778d8=_0x1778d8||0xcc;return function(_0x48e6eb){if(_0x48e6eb){return _0x4c496c['sendStatus'](_0x1778d8);}return _0x4c496c[_0x4073('0x17')](_0x1778d8)[_0x4073('0x18')]();};}function respondWithResult(_0x565576,_0x416322){_0x416322=_0x416322||0xc8;return function(_0x1355f5){if(_0x1355f5){return _0x565576[_0x4073('0x17')](_0x416322)[_0x4073('0x19')](_0x1355f5);}};}function respondWithFilteredResult(_0x3e29e9,_0x45238f){return function(_0x592c8c){if(_0x592c8c){var _0x2bc7c5=typeof _0x45238f['offset']===_0x4073('0x1a')&&typeof _0x45238f[_0x4073('0x1b')]==='undefined';var _0x1339b2=_0x592c8c[_0x4073('0x1c')];var _0x7a6e37=_0x2bc7c5?0x0:_0x45238f['offset'];var _0x35e397=_0x2bc7c5?_0x592c8c[_0x4073('0x1c')]:_0x45238f['offset']+_0x45238f['limit'];var _0x44aa71;if(_0x35e397>=_0x1339b2){_0x35e397=_0x1339b2;_0x44aa71=0xc8;}else{_0x44aa71=0xce;}_0x3e29e9['status'](_0x44aa71);return _0x3e29e9[_0x4073('0x1d')](_0x4073('0x1e'),_0x7a6e37+'-'+_0x35e397+'/'+_0x1339b2)[_0x4073('0x19')](_0x592c8c);}return null;};}function patchUpdates(_0x56d196){return function(_0xa87289){try{jsonpatch[_0x4073('0x1f')](_0xa87289,_0x56d196,!![]);}catch(_0x37b4f3){return BPromise[_0x4073('0x20')](_0x37b4f3);}return _0xa87289[_0x4073('0x21')]();};}function saveUpdates(_0x523c11,_0x1b36b7){return function(_0x5b5977){if(_0x5b5977){return _0x5b5977['update'](_0x523c11)[_0x4073('0x22')](function(_0x3dfed2){return _0x3dfed2;});}return null;};}function removeEntity(_0x37fd2d,_0x531bf4){return function(_0x48c8eb){if(_0x48c8eb){return _0x48c8eb[_0x4073('0x23')]()[_0x4073('0x22')](function(){_0x37fd2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x765754,_0x477cf6){return function(_0x259234){if(!_0x259234){_0x765754[_0x4073('0x24')](0x194);}return _0x259234;};}function handleError(_0x19a118,_0x20d4a8){_0x20d4a8=_0x20d4a8||0x1f4;return function(_0xf3faf4){logger[_0x4073('0x25')](_0xf3faf4['stack']);if(_0xf3faf4[_0x4073('0x26')]){delete _0xf3faf4[_0x4073('0x26')];}_0x19a118[_0x4073('0x17')](_0x20d4a8)['send'](_0xf3faf4);};}exports[_0x4073('0x27')]=function(_0x35b8d5,_0x512f69){var _0x57fcfd={},_0x465c67={},_0x429f8d={'count':0x0,'rows':[]};var _0x5e958d=_[_0x4073('0x28')](db[_0x4073('0x29')][_0x4073('0x2a')],function(_0x45a36e){return{'name':_0x45a36e['fieldName'],'type':_0x45a36e[_0x4073('0x2b')][_0x4073('0x2c')]};});_0x465c67[_0x4073('0x2d')]=_['map'](_0x5e958d,_0x4073('0x26'));_0x465c67[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x35b8d5[_0x4073('0x2e')]);_0x465c67[_0x4073('0x30')]=_['intersection'](_0x465c67[_0x4073('0x2d')],_0x465c67[_0x4073('0x2e')]);_0x57fcfd[_0x4073('0x31')]=_[_0x4073('0x32')](_0x465c67[_0x4073('0x2d')],qs['fields'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x33')]));_0x57fcfd[_0x4073('0x31')]=_0x57fcfd[_0x4073('0x31')][_0x4073('0x34')]?_0x57fcfd[_0x4073('0x31')]:_0x465c67[_0x4073('0x2d')];if(!_0x35b8d5['query'][_0x4073('0x35')](_0x4073('0x36'))){_0x57fcfd[_0x4073('0x1b')]=qs[_0x4073('0x1b')](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x1b')]);_0x57fcfd['offset']=qs['offset'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x37')]);}_0x57fcfd['order']=qs['sort'](_0x35b8d5['query'][_0x4073('0x38')]);_0x57fcfd[_0x4073('0x39')]=qs['filters'](_[_0x4073('0x3a')](_0x35b8d5[_0x4073('0x2e')],_0x465c67[_0x4073('0x30')]),_0x5e958d);if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3b')]){_0x57fcfd[_0x4073('0x39')]=_[_0x4073('0x3c')](_0x57fcfd[_0x4073('0x39')],{'$or':_[_0x4073('0x28')](_0x5e958d,function(_0x4e93a6){if(_0x4e93a6[_0x4073('0x2b')]!==_0x4073('0x3d')){var _0xce192c={};_0xce192c[_0x4e93a6['name']]={'$like':'%'+_0x35b8d5['query'][_0x4073('0x3b')]+'%'};return _0xce192c;}})});}_0x57fcfd=_[_0x4073('0x3c')]({},_0x57fcfd,_0x35b8d5['options']);var _0x5eb108={'where':_0x57fcfd[_0x4073('0x39')]};return db['JscriptyAnswerReport'][_0x4073('0x1c')](_0x5eb108)[_0x4073('0x22')](function(_0x4499ad){_0x429f8d[_0x4073('0x1c')]=_0x4499ad;if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3e')]){_0x57fcfd[_0x4073('0x3f')]=[{'all':!![]}];}return db[_0x4073('0x29')][_0x4073('0x40')](_0x57fcfd);})[_0x4073('0x22')](function(_0x214635){_0x429f8d['rows']=_0x214635;return _0x429f8d;})[_0x4073('0x22')](respondWithFilteredResult(_0x512f69,_0x57fcfd))[_0x4073('0x41')](handleError(_0x512f69,null));};exports[_0x4073('0x42')]=function(_0x288055,_0x4d026c){var _0x4d4baf={'raw':!![],'where':{'id':_0x288055[_0x4073('0x43')]['id']}},_0x2d577e={};_0x2d577e[_0x4073('0x2d')]=_[_0x4073('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0x2d577e[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x288055[_0x4073('0x2e')]);_0x2d577e[_0x4073('0x30')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],_0x2d577e[_0x4073('0x2e')]);_0x4d4baf[_0x4073('0x31')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],qs['fields'](_0x288055[_0x4073('0x2e')][_0x4073('0x33')]));_0x4d4baf[_0x4073('0x31')]=_0x4d4baf[_0x4073('0x31')][_0x4073('0x34')]?_0x4d4baf['attributes']:_0x2d577e[_0x4073('0x2d')];if(_0x288055[_0x4073('0x2e')][_0x4073('0x3e')]){_0x4d4baf[_0x4073('0x3f')]=[{'all':!![]}];}_0x4d4baf=_[_0x4073('0x3c')]({},_0x4d4baf,_0x288055['options']);return db[_0x4073('0x29')]['find'](_0x4d4baf)[_0x4073('0x22')](handleEntityNotFound(_0x4d026c,null))[_0x4073('0x22')](respondWithResult(_0x4d026c,null))[_0x4073('0x41')](handleError(_0x4d026c,null));};exports[_0x4073('0x44')]=function(_0x51093e,_0x5a0143){return db['JscriptyAnswerReport'][_0x4073('0x44')](_0x51093e[_0x4073('0x45')],{})[_0x4073('0x22')](respondWithResult(_0x5a0143,0xc9))[_0x4073('0x41')](handleError(_0x5a0143,null));};exports['update']=function(_0x4deee7,_0x49b366){if(_0x4deee7[_0x4073('0x45')]['id']){delete _0x4deee7[_0x4073('0x45')]['id'];}return db[_0x4073('0x29')]['find']({'where':{'id':_0x4deee7[_0x4073('0x43')]['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x49b366,null))[_0x4073('0x22')](saveUpdates(_0x4deee7[_0x4073('0x45')],null))[_0x4073('0x22')](respondWithResult(_0x49b366,null))['catch'](handleError(_0x49b366,null));};exports['destroy']=function(_0x45fd98,_0x104983){return db[_0x4073('0x29')][_0x4073('0x46')]({'where':{'id':_0x45fd98['params']['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x104983,null))[_0x4073('0x22')](removeEntity(_0x104983,null))[_0x4073('0x41')](handleError(_0x104983,null));};exports[_0x4073('0x47')]=function(_0x4ad4ee,_0x58588c){return db['JscriptyAnswerReport'][_0x4073('0x47')]()[_0x4073('0x22')](respondWithResult(_0x58588c,null))[_0x4073('0x41')](handleError(_0x58588c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 677a3cc..d3069ff 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 _0x0ff9=['define','report_jscripty_answers','lodash','moment','bluebird','request-promise','path','./jscriptyAnswerReport.attributes','exports'];(function(_0x2c7451,_0x17c2dc){var _0x1e3a2e=function(_0x5d10f4){while(--_0x5d10f4){_0x2c7451['push'](_0x2c7451['shift']());}};_0x1e3a2e(++_0x17c2dc);}(_0x0ff9,0x77));var _0x90ff=function(_0x22daaf,_0x2761a7){_0x22daaf=_0x22daaf-0x0;var _0x3192a8=_0x0ff9[_0x22daaf];return _0x3192a8;};'use strict';var _=require(_0x90ff('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90ff('0x1'));var BPromise=require(_0x90ff('0x2'));var rp=require(_0x90ff('0x3'));var fs=require('fs');var path=require(_0x90ff('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90ff('0x5'));module[_0x90ff('0x6')]=function(_0x251b1c,_0x4f8245){return _0x251b1c[_0x90ff('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0x90ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b97=['../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4b97,0x15e));var _0x74b9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4b97[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x74b9('0x0'));var util=require(_0x74b9('0x1'));var logger=require(_0x74b9('0x2'))(_0x74b9('0x3'));var moment=require('moment');var BPromise=require(_0x74b9('0x4'));var rp=require(_0x74b9('0x5'));var fs=require('fs');var path=require(_0x74b9('0x6'));var rimraf=require(_0x74b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x74b9('0x8'));module['exports']=function(_0x441533,_0x849f52){return _0x441533[_0x74b9('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x74b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fefca35..8221fe2 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 _0xfe4f=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e23d0,_0x373112){var _0xee1975=function(_0x595fe1){while(--_0x595fe1){_0x5e23d0['push'](_0x5e23d0['shift']());}};_0xee1975(++_0x373112);}(_0xfe4f,0xe4));var _0xffe4=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xfe4f[_0x53c4f8];return _0x416458;};'use strict';var _=require(_0xffe4('0x0'));var util=require(_0xffe4('0x1'));var moment=require(_0xffe4('0x2'));var BPromise=require(_0xffe4('0x3'));var rs=require(_0xffe4('0x4'));var fs=require('fs');var Redis=require(_0xffe4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffe4('0x6'))(_0xffe4('0x7'));var config=require(_0xffe4('0x8'));var jayson=require(_0xffe4('0x9'));var client=jayson[_0xffe4('0xa')][_0xffe4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57ea7b,_0x1039fb,_0x23abe5){return new BPromise(function(_0x2bab8,_0x4b8c93){return client['request'](_0x57ea7b,_0x23abe5)[_0xffe4('0xc')](function(_0x56cf04){logger[_0xffe4('0xd')](_0xffe4('0xe'),_0x1039fb,_0xffe4('0xf'));logger[_0xffe4('0x10')](_0xffe4('0x11'),_0x1039fb,_0xffe4('0xf'),JSON[_0xffe4('0x12')](_0x56cf04));if(_0x56cf04[_0xffe4('0x13')]){if(_0x56cf04['error'][_0xffe4('0x14')]===0x1f4){logger[_0xffe4('0x13')](_0xffe4('0xe'),_0x1039fb,_0x56cf04['error'][_0xffe4('0x15')]);return _0x4b8c93(_0x56cf04['error'][_0xffe4('0x15')]);}logger['error'](_0xffe4('0xe'),_0x1039fb,_0x56cf04[_0xffe4('0x13')][_0xffe4('0x15')]);return _0x2bab8(_0x56cf04[_0xffe4('0x13')][_0xffe4('0x15')]);}else{logger[_0xffe4('0xd')](_0xffe4('0xe'),_0x1039fb,_0xffe4('0xf'));_0x2bab8(_0x56cf04[_0xffe4('0x16')][_0xffe4('0x15')]);}})[_0xffe4('0x17')](function(_0x36f739){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1039fb,_0x36f739);_0x4b8c93(_0x36f739);});});} \ No newline at end of file +var _0x6f02=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x6f02,0x92));var _0x26f0=function(_0x523973,_0x69c009){_0x523973=_0x523973-0x0;var _0x546838=_0x6f02[_0x523973];return _0x546838;};'use strict';var _=require('lodash');var util=require(_0x26f0('0x0'));var moment=require(_0x26f0('0x1'));var BPromise=require(_0x26f0('0x2'));var rs=require(_0x26f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26f0('0x4'))['db'];var utils=require(_0x26f0('0x5'));var logger=require('../../config/logger')(_0x26f0('0x6'));var config=require(_0x26f0('0x7'));var jayson=require(_0x26f0('0x8'));var client=jayson[_0x26f0('0x9')][_0x26f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209297,_0x321732,_0x2e6f61){return new BPromise(function(_0x162fb1,_0xc95b8e){return client[_0x26f0('0xb')](_0x209297,_0x2e6f61)[_0x26f0('0xc')](function(_0x316955){logger[_0x26f0('0xd')](_0x26f0('0xe'),_0x321732,'request\x20sent');logger[_0x26f0('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x321732,_0x26f0('0x10'),JSON[_0x26f0('0x11')](_0x316955));if(_0x316955[_0x26f0('0x12')]){if(_0x316955[_0x26f0('0x12')][_0x26f0('0x13')]===0x1f4){logger[_0x26f0('0x12')](_0x26f0('0xe'),_0x321732,_0x316955[_0x26f0('0x12')]['message']);return _0xc95b8e(_0x316955[_0x26f0('0x12')]['message']);}logger[_0x26f0('0x12')](_0x26f0('0xe'),_0x321732,_0x316955[_0x26f0('0x12')][_0x26f0('0x14')]);return _0x162fb1(_0x316955[_0x26f0('0x12')][_0x26f0('0x14')]);}else{logger['info'](_0x26f0('0xe'),_0x321732,_0x26f0('0x10'));_0x162fb1(_0x316955[_0x26f0('0x15')]['message']);}})['catch'](function(_0x3e3194){logger['error'](_0x26f0('0xe'),_0x321732,_0x3e3194);_0xc95b8e(_0x3e3194);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ee73708..a8a2382 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 _0x2d55=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','30s','getSummary','create','post','/:id/clone','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xb527ad,_0xa9bd87){var _0x5d7448=function(_0x276021){while(--_0x276021){_0xb527ad['push'](_0xb527ad['shift']());}};_0x5d7448(++_0xa9bd87);}(_0x2d55,0xea));var _0x52d5=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2d55[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x52d5('0x0'));var util=require(_0x52d5('0x1'));var path=require('path');var timeout=require(_0x52d5('0x2'));var express=require(_0x52d5('0x3'));var router=express[_0x52d5('0x4')]();var fs_extra=require(_0x52d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x52d5('0x6'));var config=require(_0x52d5('0x7'));var controller=require('./jscriptyProject.controller');router[_0x52d5('0x8')]('/',auth[_0x52d5('0x9')](),controller[_0x52d5('0xa')]);router[_0x52d5('0x8')](_0x52d5('0xb'),auth[_0x52d5('0x9')](),controller[_0x52d5('0xc')]);router[_0x52d5('0x8')](_0x52d5('0xd'),auth[_0x52d5('0x9')](),controller['getSessions']);router[_0x52d5('0x8')](_0x52d5('0xe'),auth['isAuthenticated'](),controller[_0x52d5('0xf')]);router[_0x52d5('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x52d5('0x10')),controller[_0x52d5('0x11')]);router['post']('/',auth[_0x52d5('0x9')](),controller[_0x52d5('0x12')]);router[_0x52d5('0x13')](_0x52d5('0x14'),auth[_0x52d5('0x9')](),controller['clone']);router[_0x52d5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x52d5('0x16')]);router['delete'](_0x52d5('0xb'),auth[_0x52d5('0x9')](),controller[_0x52d5('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf4bc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','isAuthenticated','get','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util'];(function(_0x61afed,_0x3210ce){var _0x371ba2=function(_0x1fb4d4){while(--_0x1fb4d4){_0x61afed['push'](_0x61afed['shift']());}};_0x371ba2(++_0x3210ce);}(_0xf4bc,0xad));var _0xcf4b=function(_0x2d648c,_0x29282a){_0x2d648c=_0x2d648c-0x0;var _0x8d2edb=_0xf4bc[_0x2d648c];return _0x8d2edb;};'use strict';var multer=require(_0xcf4b('0x0'));var util=require(_0xcf4b('0x1'));var path=require('path');var timeout=require(_0xcf4b('0x2'));var express=require(_0xcf4b('0x3'));var router=express[_0xcf4b('0x4')]();var fs_extra=require(_0xcf4b('0x5'));var auth=require(_0xcf4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcf4b('0x7'));router['get']('/',auth[_0xcf4b('0x8')](),controller['index']);router[_0xcf4b('0x9')](_0xcf4b('0xa'),auth[_0xcf4b('0x8')](),controller[_0xcf4b('0xb')]);router[_0xcf4b('0x9')](_0xcf4b('0xc'),auth[_0xcf4b('0x8')](),controller[_0xcf4b('0xd')]);router['get'](_0xcf4b('0xe'),auth[_0xcf4b('0x8')](),controller['getAnswers']);router[_0xcf4b('0x9')](_0xcf4b('0xf'),auth[_0xcf4b('0x8')](),timeout('30s'),controller['getSummary']);router[_0xcf4b('0x10')]('/',auth[_0xcf4b('0x8')](),controller[_0xcf4b('0x11')]);router['post'](_0xcf4b('0x12'),auth[_0xcf4b('0x8')](),controller[_0xcf4b('0x13')]);router[_0xcf4b('0x14')]('/:id',auth[_0xcf4b('0x8')](),controller[_0xcf4b('0x15')]);router[_0xcf4b('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xcf4b('0x17')]);module[_0xcf4b('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1726352..827ed83 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 _0x3de0=['setDataValue','formData','isString','format','description','BOOLEAN','lodash','util','exports','name','STRING','TEXT','long'];(function(_0xac6558,_0x13eaee){var _0x56d29a=function(_0x59f4de){while(--_0x59f4de){_0xac6558['push'](_0xac6558['shift']());}};_0x56d29a(++_0x13eaee);}(_0x3de0,0xbc));var _0x03de=function(_0x5f58d5,_0x5468ad){_0x5f58d5=_0x5f58d5-0x0;var _0x28787e=_0x3de0[_0x5f58d5];return _0x28787e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x03de('0x0'));var util=require(_0x03de('0x1'));module[_0x03de('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x03de('0x3')},'description':{'type':Sequelize[_0x03de('0x4')]},'formData':{'type':Sequelize[_0x03de('0x5')](_0x03de('0x6')),'set':function(_0x37bf03){if(_['isObjectLike'](_0x37bf03)){this[_0x03de('0x7')](_0x03de('0x8'),JSON['stringify'](_0x37bf03));}else if(_[_0x03de('0x9')](_0x37bf03)){this[_0x03de('0x7')](_0x03de('0x8'),_0x37bf03);}else{this[_0x03de('0x7')]('formData',util[_0x03de('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x03de('0x3'))||'',this['getDataValue'](_0x03de('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x03de('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x03de('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x9bbd=['getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','formData','isString','setDataValue','format'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x9bbd,0x1b5));var _0xd9bb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9bbd[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xd9bb('0x0'));var _=require(_0xd9bb('0x1'));var util=require(_0xd9bb('0x2'));module[_0xd9bb('0x3')]={'name':{'type':Sequelize[_0xd9bb('0x4')],'unique':_0xd9bb('0x5')},'description':{'type':Sequelize[_0xd9bb('0x4')]},'formData':{'type':Sequelize[_0xd9bb('0x6')]('long'),'set':function(_0x281958){if(_['isObjectLike'](_0x281958)){this['setDataValue'](_0xd9bb('0x7'),JSON['stringify'](_0x281958));}else if(_[_0xd9bb('0x8')](_0x281958)){this[_0xd9bb('0x9')](_0xd9bb('0x7'),_0x281958);}else{this[_0xd9bb('0x9')]('formData',util[_0xd9bb('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this[_0xd9bb('0xb')](_0xd9bb('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd9bb('0xd')],'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 a33b0b0..b3d1629 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 _0x8814=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','json','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','index','map','JscriptyProject','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','find','userProfileId','catch','clone','params','rawAttributes','omit','createdAt','UserProfileSection','autoAssociation','update','getSessions','JscriptySessionReport','ProjectId','count','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x1339fe,_0x5bb1c9){var _0x2aa6cc=function(_0x5edc40){while(--_0x5edc40){_0x1339fe['push'](_0x1339fe['shift']());}};_0x2aa6cc(++_0x5bb1c9);}(_0x8814,0x1b8));var _0x4881=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x8814[_0x164af1];return _0x5d81a2;};'use strict';var emlformat=require(_0x4881('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4881('0x1'));var rp=require('request-promise');var moment=require(_0x4881('0x2'));var BPromise=require(_0x4881('0x3'));var Mustache=require(_0x4881('0x4'));var util=require(_0x4881('0x5'));var path=require('path');var sox=require(_0x4881('0x6'));var csv=require(_0x4881('0x7'));var ejs=require(_0x4881('0x8'));var fs=require('fs');var fs_extra=require(_0x4881('0x9'));var _=require('lodash');var squel=require(_0x4881('0xa'));var crypto=require('crypto');var jsforce=require(_0x4881('0xb'));var deskjs=require(_0x4881('0xc'));var toCsv=require(_0x4881('0x7'));var querystring=require(_0x4881('0xd'));var Papa=require('papaparse');var Redis=require(_0x4881('0xe'));var authService=require(_0x4881('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4881('0x10'));var hardwareService=require(_0x4881('0x11'));var logger=require(_0x4881('0x12'))(_0x4881('0x13'));var utils=require(_0x4881('0x14'));var config=require(_0x4881('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4881('0x16'))['db'];function respondWithStatusCode(_0x1aa300,_0x42454b){_0x42454b=_0x42454b||0xcc;return function(_0x2794fe){if(_0x2794fe){return _0x1aa300['sendStatus'](_0x42454b);}return _0x1aa300[_0x4881('0x17')](_0x42454b)[_0x4881('0x18')]();};}function respondWithResult(_0x20357a,_0x44b25b){_0x44b25b=_0x44b25b||0xc8;return function(_0x1b409f){if(_0x1b409f){return _0x20357a[_0x4881('0x17')](_0x44b25b)['json'](_0x1b409f);}};}function respondWithFilteredResult(_0x4bdffa,_0x527762){return function(_0x5ad538){if(_0x5ad538){var _0x22df92=typeof _0x527762[_0x4881('0x19')]==='undefined'&&typeof _0x527762[_0x4881('0x1a')]===_0x4881('0x1b');var _0x3e1b6c=_0x5ad538['count'];var _0x4f7f4e=_0x22df92?0x0:_0x527762['offset'];var _0x333305=_0x22df92?_0x5ad538['count']:_0x527762[_0x4881('0x19')]+_0x527762[_0x4881('0x1a')];var _0x513bd1;if(_0x333305>=_0x3e1b6c){_0x333305=_0x3e1b6c;_0x513bd1=0xc8;}else{_0x513bd1=0xce;}_0x4bdffa['status'](_0x513bd1);return _0x4bdffa['set']('Content-Range',_0x4f7f4e+'-'+_0x333305+'/'+_0x3e1b6c)[_0x4881('0x1c')](_0x5ad538);}return null;};}function patchUpdates(_0x543c5e){return function(_0x4dc126){try{jsonpatch[_0x4881('0x1d')](_0x4dc126,_0x543c5e,!![]);}catch(_0x20bc72){return BPromise[_0x4881('0x1e')](_0x20bc72);}return _0x4dc126[_0x4881('0x1f')]();};}function saveUpdates(_0x347b35,_0x33b74a){return function(_0x5a514d){if(_0x5a514d){return _0x5a514d['update'](_0x347b35)['then'](function(_0x15aebc){return _0x15aebc;});}return null;};}function removeEntity(_0x2727c4,_0xb965c9){return function(_0x470df9){if(_0x470df9){return _0x470df9[_0x4881('0x20')]()[_0x4881('0x21')](function(){var _0x4cf5c3=_0x470df9[_0x4881('0x22')]({'plain':!![]});var _0x383c70='Projects';return db[_0x4881('0x23')][_0x4881('0x20')]({'where':{'type':_0x383c70,'resourceId':_0x4cf5c3['id']}})[_0x4881('0x21')](function(){return _0x470df9;});})[_0x4881('0x21')](function(){_0x2727c4[_0x4881('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x658ec9,_0x2bf637){return function(_0x41b83f){if(!_0x41b83f){_0x658ec9['sendStatus'](0x194);}return _0x41b83f;};}function handleError(_0x339600,_0xcd1152){_0xcd1152=_0xcd1152||0x1f4;return function(_0x5bcb74){logger[_0x4881('0x24')](_0x5bcb74[_0x4881('0x25')]);if(_0x5bcb74[_0x4881('0x26')]){delete _0x5bcb74[_0x4881('0x26')];}_0x339600[_0x4881('0x17')](_0xcd1152)['send'](_0x5bcb74);};}exports[_0x4881('0x27')]=function(_0x3de7c2,_0x373c7e){var _0x42fc74={},_0x1bfd97={},_0x144c63={'count':0x0,'rows':[]};var _0xa21343=_[_0x4881('0x28')](db[_0x4881('0x29')]['rawAttributes'],function(_0x5ad603){return{'name':_0x5ad603[_0x4881('0x2a')],'type':_0x5ad603[_0x4881('0x2b')]['key']};});_0x1bfd97[_0x4881('0x2c')]=_[_0x4881('0x28')](_0xa21343,'name');_0x1bfd97[_0x4881('0x2d')]=_[_0x4881('0x2e')](_0x3de7c2[_0x4881('0x2d')]);_0x1bfd97['filters']=_['intersection'](_0x1bfd97[_0x4881('0x2c')],_0x1bfd97[_0x4881('0x2d')]);_0x42fc74[_0x4881('0x2f')]=_['intersection'](_0x1bfd97[_0x4881('0x2c')],qs[_0x4881('0x30')](_0x3de7c2[_0x4881('0x2d')]['fields']));_0x42fc74[_0x4881('0x2f')]=_0x42fc74[_0x4881('0x2f')][_0x4881('0x31')]?_0x42fc74[_0x4881('0x2f')]:_0x1bfd97[_0x4881('0x2c')];if(!_0x3de7c2['query'][_0x4881('0x32')](_0x4881('0x33'))){_0x42fc74['limit']=qs[_0x4881('0x1a')](_0x3de7c2[_0x4881('0x2d')][_0x4881('0x1a')]);_0x42fc74[_0x4881('0x19')]=qs[_0x4881('0x19')](_0x3de7c2['query'][_0x4881('0x19')]);}_0x42fc74[_0x4881('0x34')]=qs['sort'](_0x3de7c2[_0x4881('0x2d')][_0x4881('0x35')]);_0x42fc74[_0x4881('0x36')]=qs['filters'](_[_0x4881('0x37')](_0x3de7c2[_0x4881('0x2d')],_0x1bfd97[_0x4881('0x38')]),_0xa21343);if(_0x3de7c2[_0x4881('0x2d')][_0x4881('0x39')]){_0x42fc74['where']=_[_0x4881('0x3a')](_0x42fc74[_0x4881('0x36')],{'$or':_['map'](_0xa21343,function(_0x52a198){if(_0x52a198['type']!==_0x4881('0x3b')){var _0x5dc0e6={};_0x5dc0e6[_0x52a198[_0x4881('0x26')]]={'$like':'%'+_0x3de7c2['query'][_0x4881('0x39')]+'%'};return _0x5dc0e6;}})});}_0x42fc74=_[_0x4881('0x3a')]({},_0x42fc74,_0x3de7c2[_0x4881('0x3c')]);var _0x1808c4={'where':_0x42fc74['where']};return db[_0x4881('0x29')]['count'](_0x1808c4)[_0x4881('0x21')](function(_0x497baa){_0x144c63['count']=_0x497baa;if(_0x3de7c2[_0x4881('0x2d')][_0x4881('0x3d')]){_0x42fc74[_0x4881('0x3e')]=[{'all':!![]}];}return db[_0x4881('0x29')][_0x4881('0x3f')](_0x42fc74);})[_0x4881('0x21')](function(_0x3b06ad){_0x144c63[_0x4881('0x40')]=_0x3b06ad;return _0x144c63;})[_0x4881('0x21')](respondWithFilteredResult(_0x373c7e,_0x42fc74))['catch'](handleError(_0x373c7e,null));};exports[_0x4881('0x41')]=function(_0x1df1a9,_0x40bb4b){var _0x3b5f2a={'raw':![],'where':{'id':_0x1df1a9['params']['id']}},_0x352ab7={};_0x352ab7[_0x4881('0x2c')]=_['keys'](db[_0x4881('0x29')]['rawAttributes']);_0x352ab7['query']=_[_0x4881('0x2e')](_0x1df1a9[_0x4881('0x2d')]);_0x352ab7[_0x4881('0x38')]=_[_0x4881('0x42')](_0x352ab7[_0x4881('0x2c')],_0x352ab7[_0x4881('0x2d')]);_0x3b5f2a[_0x4881('0x2f')]=_['intersection'](_0x352ab7['model'],qs[_0x4881('0x30')](_0x1df1a9['query']['fields']));_0x3b5f2a[_0x4881('0x2f')]=_0x3b5f2a[_0x4881('0x2f')]['length']?_0x3b5f2a[_0x4881('0x2f')]:_0x352ab7[_0x4881('0x2c')];if(_0x1df1a9[_0x4881('0x2d')][_0x4881('0x3d')]){_0x3b5f2a[_0x4881('0x3e')]=[{'all':!![]}];}_0x3b5f2a=_[_0x4881('0x3a')]({},_0x3b5f2a,_0x1df1a9['options']);return db[_0x4881('0x29')]['find'](_0x3b5f2a)[_0x4881('0x21')](handleEntityNotFound(_0x40bb4b,null))[_0x4881('0x21')](respondWithResult(_0x40bb4b,null))['catch'](handleError(_0x40bb4b,null));};exports['create']=function(_0x18bb78,_0x58f9ac){return db[_0x4881('0x29')][_0x4881('0x43')](_0x18bb78[_0x4881('0x44')],{})[_0x4881('0x21')](function(_0xfdc77c){var _0x9b18cb=_0x18bb78[_0x4881('0x45')][_0x4881('0x22')]({'plain':!![]});if(!_0x9b18cb)throw new Error(_0x4881('0x46'));if(_0x9b18cb[_0x4881('0x47')]===_0x4881('0x45')){var _0x4186bb=_0xfdc77c[_0x4881('0x22')]({'plain':!![]});var _0x3baa84=_0x4881('0x48');return db['UserProfileSection'][_0x4881('0x49')]({'where':{'name':_0x3baa84,'userProfileId':_0x9b18cb[_0x4881('0x4a')]},'raw':!![]})['then'](function(_0x553819){if(_0x553819&&_0x553819['autoAssociation']===0x0){return db['UserProfileResource'][_0x4881('0x43')]({'name':_0x4186bb[_0x4881('0x26')],'resourceId':_0x4186bb['id'],'type':_0x553819['name'],'sectionId':_0x553819['id']},{})[_0x4881('0x21')](function(){return _0xfdc77c;});}else{return _0xfdc77c;}})[_0x4881('0x4b')](function(_0x3c05ab){logger[_0x4881('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c05ab);throw _0x3c05ab;});}return _0xfdc77c;})[_0x4881('0x21')](respondWithResult(_0x58f9ac,0xc9))[_0x4881('0x4b')](handleError(_0x58f9ac,null));};exports[_0x4881('0x4c')]=function(_0x252736,_0x1042eb){var _0x540e1e={'where':{'id':_0x252736[_0x4881('0x4d')]['id']}},_0x4612b9={};_0x4612b9['model']=_[_0x4881('0x2e')](db[_0x4881('0x29')][_0x4881('0x4e')]);_0x540e1e[_0x4881('0x2f')]=_[_0x4881('0x42')](_0x4612b9[_0x4881('0x2c')],qs[_0x4881('0x30')](_0x252736[_0x4881('0x2d')]['fields']));_0x540e1e[_0x4881('0x2f')]=_0x540e1e[_0x4881('0x2f')][_0x4881('0x31')]?_0x540e1e[_0x4881('0x2f')]:_0x4612b9['model'];if(_0x252736['query'][_0x4881('0x3d')]){_0x540e1e[_0x4881('0x3e')]=[{'all':!![]}];}_0x540e1e=_[_0x4881('0x3a')]({},_0x540e1e,_0x252736[_0x4881('0x3c')]);return db[_0x4881('0x29')][_0x4881('0x49')](_0x540e1e)[_0x4881('0x21')](handleEntityNotFound(_0x1042eb,null))[_0x4881('0x21')](function(_0x121262){if(_0x121262){var _0x3480a2=_0x121262[_0x4881('0x22')]({'plain':!![]});_0x3480a2=qs[_0x4881('0x4f')](_0x3480a2,['id',_0x4881('0x50'),'updatedAt']);_0x252736[_0x4881('0x44')]=_[_0x4881('0x4f')](_0x252736[_0x4881('0x44')],['id',_0x4881('0x50'),'updatedAt']);return db[_0x4881('0x29')][_0x4881('0x43')](_[_0x4881('0x3a')](_0x3480a2,_0x252736[_0x4881('0x44')]),{'include':_0x252736[_0x4881('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x4881('0x21')](function(_0x4dedea){var _0x4dc903=_0x252736[_0x4881('0x45')][_0x4881('0x22')]({'plain':!![]});if(!_0x4dc903)throw new Error(_0x4881('0x46'));if(_0x4dc903['role']===_0x4881('0x45')){var _0x4f33fe=_0x4dedea['get']({'plain':!![]});var _0x3254a0=_0x4881('0x48');return db[_0x4881('0x51')]['find']({'where':{'name':_0x3254a0,'userProfileId':_0x4dc903[_0x4881('0x4a')]},'raw':!![]})[_0x4881('0x21')](function(_0x212f0d){if(_0x212f0d&&_0x212f0d[_0x4881('0x52')]===0x0){return db[_0x4881('0x23')][_0x4881('0x43')]({'name':_0x4f33fe[_0x4881('0x26')],'resourceId':_0x4f33fe['id'],'type':_0x212f0d[_0x4881('0x26')],'sectionId':_0x212f0d['id']},{})['then'](function(){return _0x4dedea;});}else{return _0x4dedea;}})[_0x4881('0x4b')](function(_0x3b112c){logger[_0x4881('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b112c);throw _0x3b112c;});}return _0x4dedea;});}})['then'](respondWithResult(_0x1042eb,0xc9))['catch'](handleError(_0x1042eb,null));};exports[_0x4881('0x53')]=function(_0x3b6e17,_0x422623){if(_0x3b6e17[_0x4881('0x44')]['id']){delete _0x3b6e17[_0x4881('0x44')]['id'];}return db['JscriptyProject'][_0x4881('0x49')]({'where':{'id':_0x3b6e17[_0x4881('0x4d')]['id']}})[_0x4881('0x21')](handleEntityNotFound(_0x422623,null))[_0x4881('0x21')](saveUpdates(_0x3b6e17['body'],null))[_0x4881('0x21')](respondWithResult(_0x422623,null))[_0x4881('0x4b')](handleError(_0x422623,null));};exports[_0x4881('0x20')]=function(_0x499a61,_0x5a0688){return db[_0x4881('0x29')][_0x4881('0x49')]({'where':{'id':_0x499a61[_0x4881('0x4d')]['id']}})[_0x4881('0x21')](handleEntityNotFound(_0x5a0688,null))[_0x4881('0x21')](removeEntity(_0x5a0688,null))['catch'](handleError(_0x5a0688,null));};exports[_0x4881('0x54')]=function(_0x2e9e65,_0x4a6d56,_0x300cf6){var _0x316ed1={'raw':!![],'where':{}};var _0x567f56={};var _0x694c67={'count':0x0,'rows':[]};return db[_0x4881('0x29')]['findOne']({'where':{'id':_0x2e9e65['params']['id']}})['then'](handleEntityNotFound(_0x4a6d56,null))[_0x4881('0x21')](function(_0x2b1b59){if(_0x2b1b59){_0x567f56[_0x4881('0x2c')]=_[_0x4881('0x2e')](db[_0x4881('0x55')]['rawAttributes']);_0x567f56[_0x4881('0x2d')]=_[_0x4881('0x2e')](_0x2e9e65[_0x4881('0x2d')]);_0x567f56[_0x4881('0x38')]=_[_0x4881('0x42')](_0x567f56[_0x4881('0x2c')],_0x567f56[_0x4881('0x2d')]);_0x316ed1['attributes']=_[_0x4881('0x42')](_0x567f56['model'],qs[_0x4881('0x30')](_0x2e9e65['query']['fields']));_0x316ed1['attributes']=_0x316ed1[_0x4881('0x2f')][_0x4881('0x31')]?_0x316ed1[_0x4881('0x2f')]:_0x567f56[_0x4881('0x2c')];if(!_0x2e9e65['query'][_0x4881('0x32')](_0x4881('0x33'))){_0x316ed1['limit']=qs[_0x4881('0x1a')](_0x2e9e65[_0x4881('0x2d')][_0x4881('0x1a')]);_0x316ed1[_0x4881('0x19')]=qs[_0x4881('0x19')](_0x2e9e65[_0x4881('0x2d')]['offset']);}_0x316ed1[_0x4881('0x34')]=qs[_0x4881('0x35')](_0x2e9e65[_0x4881('0x2d')]['sort']);_0x316ed1[_0x4881('0x36')]=qs[_0x4881('0x38')](_[_0x4881('0x37')](_0x2e9e65[_0x4881('0x2d')],_0x567f56[_0x4881('0x38')]));_0x316ed1['where'][_0x4881('0x56')]=_0x2b1b59['id'];if(_0x2e9e65[_0x4881('0x2d')]['filter']){_0x316ed1['where']=_['merge'](_0x316ed1[_0x4881('0x36')],{'$or':_[_0x4881('0x28')](_0x316ed1[_0x4881('0x2f')],function(_0x246c4a){var _0x43872d={};_0x43872d[_0x246c4a]={'$like':'%'+_0x2e9e65[_0x4881('0x2d')][_0x4881('0x39')]+'%'};return _0x43872d;})});}_0x316ed1=_[_0x4881('0x3a')]({},_0x316ed1,_0x2e9e65[_0x4881('0x3c')]);return db[_0x4881('0x55')]['count']({'where':_0x316ed1['where']})[_0x4881('0x21')](function(_0x51fbd6){_0x694c67[_0x4881('0x57')]=_0x51fbd6;if(_0x2e9e65[_0x4881('0x2d')][_0x4881('0x3d')]){_0x316ed1[_0x4881('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x316ed1);})['then'](function(_0x549ae0){_0x694c67['rows']=_0x549ae0;return _0x694c67;});}})[_0x4881('0x21')](respondWithFilteredResult(_0x4a6d56,_0x316ed1))[_0x4881('0x4b')](handleError(_0x4a6d56,null));};exports['getAnswers']=function(_0xf557a4,_0x1fcb57,_0x599fa1){var _0x1e1574={'raw':!![],'where':{}};var _0x362acf={};var _0x12064d={'count':0x0,'rows':[]};return db[_0x4881('0x29')]['findOne']({'where':{'id':_0xf557a4[_0x4881('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1fcb57,null))[_0x4881('0x21')](function(_0x567b15){if(_0x567b15){_0x362acf['model']=_['keys'](db[_0x4881('0x58')][_0x4881('0x4e')]);_0x362acf['query']=_[_0x4881('0x2e')](_0xf557a4[_0x4881('0x2d')]);_0x362acf[_0x4881('0x38')]=_[_0x4881('0x42')](_0x362acf[_0x4881('0x2c')],_0x362acf['query']);_0x1e1574[_0x4881('0x2f')]=_[_0x4881('0x42')](_0x362acf[_0x4881('0x2c')],qs[_0x4881('0x30')](_0xf557a4[_0x4881('0x2d')][_0x4881('0x30')]));_0x1e1574[_0x4881('0x2f')]=_0x1e1574[_0x4881('0x2f')][_0x4881('0x31')]?_0x1e1574['attributes']:_0x362acf['model'];if(!_0xf557a4['query'][_0x4881('0x32')](_0x4881('0x33'))){_0x1e1574[_0x4881('0x1a')]=qs[_0x4881('0x1a')](_0xf557a4[_0x4881('0x2d')]['limit']);_0x1e1574[_0x4881('0x19')]=qs[_0x4881('0x19')](_0xf557a4['query'][_0x4881('0x19')]);}_0x1e1574['order']=qs[_0x4881('0x35')](_0xf557a4[_0x4881('0x2d')]['sort']);_0x1e1574[_0x4881('0x36')]=qs[_0x4881('0x38')](_[_0x4881('0x37')](_0xf557a4[_0x4881('0x2d')],_0x362acf[_0x4881('0x38')]));_0x1e1574[_0x4881('0x36')][_0x4881('0x56')]=_0x567b15['id'];if(_0xf557a4[_0x4881('0x2d')][_0x4881('0x39')]){_0x1e1574[_0x4881('0x36')]=_[_0x4881('0x3a')](_0x1e1574['where'],{'$or':_[_0x4881('0x28')](_0x1e1574['attributes'],function(_0x540ba7){var _0x4d4fb4={};_0x4d4fb4[_0x540ba7]={'$like':'%'+_0xf557a4['query'][_0x4881('0x39')]+'%'};return _0x4d4fb4;})});}_0x1e1574=_[_0x4881('0x3a')]({},_0x1e1574,_0xf557a4[_0x4881('0x3c')]);return db[_0x4881('0x58')][_0x4881('0x57')]({'where':_0x1e1574['where']})[_0x4881('0x21')](function(_0x4f786c){_0x12064d[_0x4881('0x57')]=_0x4f786c;if(_0xf557a4[_0x4881('0x2d')]['includeAll']){_0x1e1574[_0x4881('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4881('0x3f')](_0x1e1574);})[_0x4881('0x21')](function(_0x2b2bf7){_0x12064d[_0x4881('0x40')]=_0x2b2bf7;return _0x12064d;});}})[_0x4881('0x21')](respondWithFilteredResult(_0x1fcb57,_0x1e1574))['catch'](handleError(_0x1fcb57,null));};function char(_0x2023d8){return _0x4881('0x59')===typeof _0x2023d8?String[_0x4881('0x5a')][_0x4881('0x1d')](null,arguments):_0x2023d8;}function needsEncapsulation(_0xc4d47){return!!_0xc4d47&&(_0xc4d47['toString']()['indexOf'](char(0xd))>=0x0||_0xc4d47['toString']()[_0x4881('0x5b')](char(0xa))>=0x0||_0xc4d47[_0x4881('0x5c')]()[_0x4881('0x5b')](char(0x2c))>=0x0||_0xc4d47[_0x4881('0x5c')]()[_0x4881('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x1cf802){var _0x22bbbc=char(0x22),_0x2ea108='\x5c'+char(0x22),_0xdeaf0a=_0x1cf802[_0x4881('0x5c')]()[_0x4881('0x5d')](new RegExp(_0x22bbbc,'g'),_0x2ea108);return _0x22bbbc+_0xdeaf0a+_0x22bbbc;}exports['getSummary']=function(_0x20abef,_0x5547e2,_0x2ae93f){var _0x356dc7,_0x14268b;var _0x2a522e={'where':{'ProjectId':_0x20abef[_0x4881('0x4d')]['id']}};if(_0x20abef[_0x4881('0x2d')][_0x4881('0x5e')]){_0x2a522e['where'][_0x4881('0x5f')]=JSON[_0x4881('0x60')](_0x20abef['query'][_0x4881('0x5e')]);}return db['JscriptySessionReport'][_0x4881('0x3f')](_0x2a522e)['then'](handleEntityNotFound(_0x5547e2,null))[_0x4881('0x21')](function(_0x1b97db){if(_0x1b97db){_0x356dc7=_0x1b97db;return db[_0x4881('0x61')][_0x4881('0x3f')]({'where':{'SessionId':{'$in':_[_0x4881('0x28')](_0x356dc7,'id')},'ProjectId':_0x20abef['params']['id']},'order':'-createdAt'});}})[_0x4881('0x21')](handleEntityNotFound(_0x5547e2,null))['then'](function(_0x19fc94){if(_0x19fc94){_0x14268b=_0x19fc94;var _0x1b0192={};for(var _0x2543d1=0x0,_0x36f86f=_0x14268b[_0x4881('0x31')];_0x2543d1<_0x36f86f;_0x2543d1++){if(!_0x1b0192[_0x4881('0x32')](_0x14268b[_0x2543d1]['questionId'])){_0x1b0192[_0x14268b[_0x2543d1][_0x4881('0x62')]]=needsEncapsulation(_0x14268b[_0x2543d1][_0x4881('0x63')])?encapsulate(_0x14268b[_0x2543d1][_0x4881('0x63')]):_0x14268b[_0x2543d1][_0x4881('0x63')];}}var _0x47abca=[],_0x1f669e={};for(var _0x164654=0x0,_0x27cb8a=_0x356dc7['length'];_0x164654<_0x27cb8a;_0x164654++){_0x1f669e={'ProjectId':_0x20abef[_0x4881('0x4d')]['id'],'SessionId':_0x356dc7[_0x164654]['id'],'StartTime':moment(_0x356dc7[_0x164654][_0x4881('0x5f')])[_0x4881('0x64')](_0x4881('0x65'))};for(var _0xfa66b2=0x0,_0x48325d=_0x14268b[_0x4881('0x31')];_0xfa66b2<_0x48325d;_0xfa66b2++){if(_0x14268b[_0xfa66b2][_0x4881('0x66')]==_0x356dc7[_0x164654]['id']&&_0x1b0192[_0x4881('0x32')](_0x14268b[_0xfa66b2]['questionId'])){_0x1f669e[_0x1b0192[_0x14268b[_0xfa66b2][_0x4881('0x62')]]]=_0x14268b[_0xfa66b2][_0x4881('0x67')];}}for(var _0x4399d7 in _0x1b0192){if(!_0x1f669e['hasOwnProperty'](_0x1b0192[_0x4399d7])){_0x1f669e[_0x1b0192[_0x4399d7]]=null;}}_0x47abca[_0x4881('0x68')](_0x1f669e);}return _0x47abca;}})[_0x4881('0x21')](function(_0x47c459){if(!_[_0x4881('0x69')](_0x47c459)){var _0x397b46=toCsv(_0x47c459);var _0xe01fbf=Date[_0x4881('0x6a')]();fs[_0x4881('0x6b')](util[_0x4881('0x64')](_0x4881('0x6c'),_0x20abef[_0x4881('0x4d')]['id'],_0xe01fbf),_0x397b46);_0x5547e2[_0x4881('0x6d')](_0x4881('0x6e'),_0x4881('0x6f')+util[_0x4881('0x64')](_0x4881('0x70'),_0x20abef['params']['id'],_0xe01fbf));_0x5547e2[_0x4881('0x6d')]('Content-type',_0x4881('0x71'));return _0x5547e2['download'](util[_0x4881('0x64')](_0x4881('0x6c'),_0x20abef[_0x4881('0x4d')]['id'],_0xe01fbf));}else{return _0x5547e2['sendStatus'](0xcc);}})[_0x4881('0x4b')](handleError(_0x5547e2,null));}; \ No newline at end of file +var _0x98b7=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','rawAttributes','length','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','omit','updatedAt','UserProfileSection','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','fieldName','type','key','model'];(function(_0x57869f,_0xc43df4){var _0x4fa1bc=function(_0xb5d076){while(--_0xb5d076){_0x57869f['push'](_0x57869f['shift']());}};_0x4fa1bc(++_0xc43df4);}(_0x98b7,0xc1));var _0x798b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x98b7[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x798b('0x0'));var rimraf=require(_0x798b('0x1'));var zipdir=require(_0x798b('0x2'));var jsonpatch=require(_0x798b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x798b('0x4'));var util=require(_0x798b('0x5'));var path=require(_0x798b('0x6'));var sox=require(_0x798b('0x7'));var csv=require(_0x798b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x798b('0x9'));var _=require('lodash');var squel=require(_0x798b('0xa'));var crypto=require(_0x798b('0xb'));var jsforce=require(_0x798b('0xc'));var deskjs=require(_0x798b('0xd'));var toCsv=require(_0x798b('0x8'));var querystring=require('querystring');var Papa=require(_0x798b('0xe'));var Redis=require('ioredis');var authService=require(_0x798b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x798b('0x10'));var hardwareService=require(_0x798b('0x11'));var logger=require(_0x798b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x798b('0x13'));var licenseUtil=require(_0x798b('0x14'));var db=require(_0x798b('0x15'))['db'];function respondWithStatusCode(_0x5455a7,_0x18057f){_0x18057f=_0x18057f||0xcc;return function(_0x53b5f1){if(_0x53b5f1){return _0x5455a7[_0x798b('0x16')](_0x18057f);}return _0x5455a7['status'](_0x18057f)[_0x798b('0x17')]();};}function respondWithResult(_0x2aacd7,_0x33cf2e){_0x33cf2e=_0x33cf2e||0xc8;return function(_0x213973){if(_0x213973){return _0x2aacd7[_0x798b('0x18')](_0x33cf2e)[_0x798b('0x19')](_0x213973);}};}function respondWithFilteredResult(_0x36425f,_0x5936fd){return function(_0x511dd3){if(_0x511dd3){var _0x1039fe=typeof _0x5936fd[_0x798b('0x1a')]===_0x798b('0x1b')&&typeof _0x5936fd[_0x798b('0x1c')]===_0x798b('0x1b');var _0x46c7c5=_0x511dd3[_0x798b('0x1d')];var _0x2fa3f6=_0x1039fe?0x0:_0x5936fd[_0x798b('0x1a')];var _0x1af73a=_0x1039fe?_0x511dd3[_0x798b('0x1d')]:_0x5936fd[_0x798b('0x1a')]+_0x5936fd[_0x798b('0x1c')];var _0x327312;if(_0x1af73a>=_0x46c7c5){_0x1af73a=_0x46c7c5;_0x327312=0xc8;}else{_0x327312=0xce;}_0x36425f[_0x798b('0x18')](_0x327312);return _0x36425f['set'](_0x798b('0x1e'),_0x2fa3f6+'-'+_0x1af73a+'/'+_0x46c7c5)[_0x798b('0x19')](_0x511dd3);}return null;};}function patchUpdates(_0x2c36d5){return function(_0x2cb76e){try{jsonpatch[_0x798b('0x1f')](_0x2cb76e,_0x2c36d5,!![]);}catch(_0x2cb7a5){return BPromise[_0x798b('0x20')](_0x2cb7a5);}return _0x2cb76e[_0x798b('0x21')]();};}function saveUpdates(_0x4c1817,_0x2de542){return function(_0x3babb5){if(_0x3babb5){return _0x3babb5[_0x798b('0x22')](_0x4c1817)[_0x798b('0x23')](function(_0x50f66c){return _0x50f66c;});}return null;};}function removeEntity(_0x397092,_0x32c926){return function(_0x36920a){if(_0x36920a){return _0x36920a[_0x798b('0x24')]()['then'](function(){var _0x325c3d=_0x36920a['get']({'plain':!![]});var _0x202398=_0x798b('0x25');return db[_0x798b('0x26')]['destroy']({'where':{'type':_0x202398,'resourceId':_0x325c3d['id']}})[_0x798b('0x23')](function(){return _0x36920a;});})[_0x798b('0x23')](function(){_0x397092[_0x798b('0x18')](0xcc)[_0x798b('0x17')]();});}};}function handleEntityNotFound(_0x2aa507,_0x251d8f){return function(_0x186f26){if(!_0x186f26){_0x2aa507['sendStatus'](0x194);}return _0x186f26;};}function handleError(_0x63c6ed,_0x5a7266){_0x5a7266=_0x5a7266||0x1f4;return function(_0x2ad7b8){logger[_0x798b('0x27')](_0x2ad7b8[_0x798b('0x28')]);if(_0x2ad7b8[_0x798b('0x29')]){delete _0x2ad7b8[_0x798b('0x29')];}_0x63c6ed['status'](_0x5a7266)['send'](_0x2ad7b8);};}exports[_0x798b('0x2a')]=function(_0x40b229,_0x228c44){var _0x1194e6={},_0x5832cc={},_0x27a40d={'count':0x0,'rows':[]};var _0x2c562b=_[_0x798b('0x2b')](db[_0x798b('0x2c')]['rawAttributes'],function(_0x1661e9){return{'name':_0x1661e9[_0x798b('0x2d')],'type':_0x1661e9[_0x798b('0x2e')][_0x798b('0x2f')]};});_0x5832cc[_0x798b('0x30')]=_[_0x798b('0x2b')](_0x2c562b,_0x798b('0x29'));_0x5832cc[_0x798b('0x31')]=_[_0x798b('0x32')](_0x40b229['query']);_0x5832cc[_0x798b('0x33')]=_[_0x798b('0x34')](_0x5832cc[_0x798b('0x30')],_0x5832cc[_0x798b('0x31')]);_0x1194e6['attributes']=_['intersection'](_0x5832cc[_0x798b('0x30')],qs[_0x798b('0x35')](_0x40b229[_0x798b('0x31')][_0x798b('0x35')]));_0x1194e6[_0x798b('0x36')]=_0x1194e6['attributes']['length']?_0x1194e6[_0x798b('0x36')]:_0x5832cc[_0x798b('0x30')];if(!_0x40b229[_0x798b('0x31')][_0x798b('0x37')](_0x798b('0x38'))){_0x1194e6[_0x798b('0x1c')]=qs[_0x798b('0x1c')](_0x40b229[_0x798b('0x31')][_0x798b('0x1c')]);_0x1194e6[_0x798b('0x1a')]=qs[_0x798b('0x1a')](_0x40b229[_0x798b('0x31')][_0x798b('0x1a')]);}_0x1194e6[_0x798b('0x39')]=qs[_0x798b('0x3a')](_0x40b229[_0x798b('0x31')][_0x798b('0x3a')]);_0x1194e6[_0x798b('0x3b')]=qs[_0x798b('0x33')](_[_0x798b('0x3c')](_0x40b229[_0x798b('0x31')],_0x5832cc[_0x798b('0x33')]),_0x2c562b);if(_0x40b229[_0x798b('0x31')][_0x798b('0x3d')]){_0x1194e6[_0x798b('0x3b')]=_[_0x798b('0x3e')](_0x1194e6[_0x798b('0x3b')],{'$or':_[_0x798b('0x2b')](_0x2c562b,function(_0xb63d9c){if(_0xb63d9c[_0x798b('0x2e')]!==_0x798b('0x3f')){var _0x1c34ef={};_0x1c34ef[_0xb63d9c[_0x798b('0x29')]]={'$like':'%'+_0x40b229['query'][_0x798b('0x3d')]+'%'};return _0x1c34ef;}})});}_0x1194e6=_[_0x798b('0x3e')]({},_0x1194e6,_0x40b229['options']);var _0x79daaa={'where':_0x1194e6[_0x798b('0x3b')]};return db[_0x798b('0x2c')]['count'](_0x79daaa)[_0x798b('0x23')](function(_0x2e6148){_0x27a40d[_0x798b('0x1d')]=_0x2e6148;if(_0x40b229[_0x798b('0x31')]['includeAll']){_0x1194e6['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x798b('0x40')](_0x1194e6);})[_0x798b('0x23')](function(_0xdaaf91){_0x27a40d[_0x798b('0x41')]=_0xdaaf91;return _0x27a40d;})['then'](respondWithFilteredResult(_0x228c44,_0x1194e6))['catch'](handleError(_0x228c44,null));};exports[_0x798b('0x42')]=function(_0x4446bd,_0x113d57){var _0x51aa3f={'raw':![],'where':{'id':_0x4446bd['params']['id']}},_0x337c33={};_0x337c33['model']=_['keys'](db[_0x798b('0x2c')][_0x798b('0x43')]);_0x337c33[_0x798b('0x31')]=_['keys'](_0x4446bd[_0x798b('0x31')]);_0x337c33['filters']=_['intersection'](_0x337c33['model'],_0x337c33[_0x798b('0x31')]);_0x51aa3f[_0x798b('0x36')]=_['intersection'](_0x337c33[_0x798b('0x30')],qs[_0x798b('0x35')](_0x4446bd['query'][_0x798b('0x35')]));_0x51aa3f[_0x798b('0x36')]=_0x51aa3f[_0x798b('0x36')][_0x798b('0x44')]?_0x51aa3f['attributes']:_0x337c33[_0x798b('0x30')];if(_0x4446bd[_0x798b('0x31')][_0x798b('0x45')]){_0x51aa3f['include']=[{'all':!![]}];}_0x51aa3f=_[_0x798b('0x3e')]({},_0x51aa3f,_0x4446bd[_0x798b('0x46')]);return db[_0x798b('0x2c')][_0x798b('0x47')](_0x51aa3f)[_0x798b('0x23')](handleEntityNotFound(_0x113d57,null))[_0x798b('0x23')](respondWithResult(_0x113d57,null))[_0x798b('0x48')](handleError(_0x113d57,null));};exports[_0x798b('0x49')]=function(_0x457b60,_0x44007c){return db[_0x798b('0x2c')][_0x798b('0x49')](_0x457b60[_0x798b('0x4a')],{})['then'](function(_0x3451b4){var _0x4b6798=_0x457b60[_0x798b('0x4b')]['get']({'plain':!![]});if(!_0x4b6798)throw new Error(_0x798b('0x4c'));if(_0x4b6798[_0x798b('0x4d')]===_0x798b('0x4b')){var _0x47732f=_0x3451b4[_0x798b('0x4e')]({'plain':!![]});var _0x2c5ba5=_0x798b('0x25');return db['UserProfileSection'][_0x798b('0x47')]({'where':{'name':_0x2c5ba5,'userProfileId':_0x4b6798[_0x798b('0x4f')]},'raw':!![]})[_0x798b('0x23')](function(_0x5dbdd8){if(_0x5dbdd8&&_0x5dbdd8[_0x798b('0x50')]===0x0){return db['UserProfileResource'][_0x798b('0x49')]({'name':_0x47732f[_0x798b('0x29')],'resourceId':_0x47732f['id'],'type':_0x5dbdd8[_0x798b('0x29')],'sectionId':_0x5dbdd8['id']},{})[_0x798b('0x23')](function(){return _0x3451b4;});}else{return _0x3451b4;}})[_0x798b('0x48')](function(_0x45d178){logger[_0x798b('0x27')](_0x798b('0x51'),_0x45d178);throw _0x45d178;});}return _0x3451b4;})[_0x798b('0x23')](respondWithResult(_0x44007c,0xc9))[_0x798b('0x48')](handleError(_0x44007c,null));};exports[_0x798b('0x52')]=function(_0x3ba997,_0x38b576){var _0x16a7d7={'where':{'id':_0x3ba997[_0x798b('0x53')]['id']}},_0x577429={};_0x577429[_0x798b('0x30')]=_[_0x798b('0x32')](db[_0x798b('0x2c')][_0x798b('0x43')]);_0x16a7d7['attributes']=_[_0x798b('0x34')](_0x577429[_0x798b('0x30')],qs['fields'](_0x3ba997[_0x798b('0x31')]['fields']));_0x16a7d7[_0x798b('0x36')]=_0x16a7d7['attributes'][_0x798b('0x44')]?_0x16a7d7[_0x798b('0x36')]:_0x577429[_0x798b('0x30')];if(_0x3ba997[_0x798b('0x31')][_0x798b('0x45')]){_0x16a7d7[_0x798b('0x54')]=[{'all':!![]}];}_0x16a7d7=_[_0x798b('0x3e')]({},_0x16a7d7,_0x3ba997[_0x798b('0x46')]);return db['JscriptyProject'][_0x798b('0x47')](_0x16a7d7)['then'](handleEntityNotFound(_0x38b576,null))[_0x798b('0x23')](function(_0x2c49fe){if(_0x2c49fe){var _0x1f7e69=_0x2c49fe[_0x798b('0x4e')]({'plain':!![]});_0x1f7e69=qs[_0x798b('0x55')](_0x1f7e69,['id','createdAt',_0x798b('0x56')]);_0x3ba997['body']=_[_0x798b('0x55')](_0x3ba997[_0x798b('0x4a')],['id','createdAt','updatedAt']);return db[_0x798b('0x2c')]['create'](_[_0x798b('0x3e')](_0x1f7e69,_0x3ba997[_0x798b('0x4a')]),{'include':_0x3ba997[_0x798b('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x798b('0x23')](function(_0x53ad6d){var _0x2ec2a6=_0x3ba997[_0x798b('0x4b')][_0x798b('0x4e')]({'plain':!![]});if(!_0x2ec2a6)throw new Error(_0x798b('0x4c'));if(_0x2ec2a6['role']===_0x798b('0x4b')){var _0x1ca33a=_0x53ad6d[_0x798b('0x4e')]({'plain':!![]});var _0x44a4a5='Projects';return db[_0x798b('0x57')][_0x798b('0x47')]({'where':{'name':_0x44a4a5,'userProfileId':_0x2ec2a6[_0x798b('0x4f')]},'raw':!![]})[_0x798b('0x23')](function(_0xadcf7c){if(_0xadcf7c&&_0xadcf7c[_0x798b('0x50')]===0x0){return db['UserProfileResource'][_0x798b('0x49')]({'name':_0x1ca33a[_0x798b('0x29')],'resourceId':_0x1ca33a['id'],'type':_0xadcf7c[_0x798b('0x29')],'sectionId':_0xadcf7c['id']},{})[_0x798b('0x23')](function(){return _0x53ad6d;});}else{return _0x53ad6d;}})[_0x798b('0x48')](function(_0x5b4986){logger[_0x798b('0x27')](_0x798b('0x51'),_0x5b4986);throw _0x5b4986;});}return _0x53ad6d;});}})[_0x798b('0x23')](respondWithResult(_0x38b576,0xc9))[_0x798b('0x48')](handleError(_0x38b576,null));};exports[_0x798b('0x22')]=function(_0x324308,_0x5d3559){if(_0x324308[_0x798b('0x4a')]['id']){delete _0x324308[_0x798b('0x4a')]['id'];}return db[_0x798b('0x2c')][_0x798b('0x47')]({'where':{'id':_0x324308['params']['id']}})[_0x798b('0x23')](handleEntityNotFound(_0x5d3559,null))[_0x798b('0x23')](saveUpdates(_0x324308['body'],null))[_0x798b('0x23')](respondWithResult(_0x5d3559,null))[_0x798b('0x48')](handleError(_0x5d3559,null));};exports[_0x798b('0x24')]=function(_0x1a95ef,_0xa422c){return db['JscriptyProject'][_0x798b('0x47')]({'where':{'id':_0x1a95ef[_0x798b('0x53')]['id']}})[_0x798b('0x23')](handleEntityNotFound(_0xa422c,null))['then'](removeEntity(_0xa422c,null))[_0x798b('0x48')](handleError(_0xa422c,null));};exports[_0x798b('0x58')]=function(_0x272a76,_0x100509,_0x57a8a1){var _0xcf57f={'raw':!![],'where':{}};var _0x5057fc={};var _0x140aa4={'count':0x0,'rows':[]};return db[_0x798b('0x2c')][_0x798b('0x59')]({'where':{'id':_0x272a76[_0x798b('0x53')]['id']}})[_0x798b('0x23')](handleEntityNotFound(_0x100509,null))['then'](function(_0x411bce){if(_0x411bce){_0x5057fc[_0x798b('0x30')]=_['keys'](db[_0x798b('0x5a')][_0x798b('0x43')]);_0x5057fc[_0x798b('0x31')]=_[_0x798b('0x32')](_0x272a76['query']);_0x5057fc[_0x798b('0x33')]=_[_0x798b('0x34')](_0x5057fc[_0x798b('0x30')],_0x5057fc['query']);_0xcf57f['attributes']=_['intersection'](_0x5057fc[_0x798b('0x30')],qs['fields'](_0x272a76['query'][_0x798b('0x35')]));_0xcf57f[_0x798b('0x36')]=_0xcf57f[_0x798b('0x36')][_0x798b('0x44')]?_0xcf57f[_0x798b('0x36')]:_0x5057fc['model'];if(!_0x272a76[_0x798b('0x31')][_0x798b('0x37')](_0x798b('0x38'))){_0xcf57f[_0x798b('0x1c')]=qs[_0x798b('0x1c')](_0x272a76[_0x798b('0x31')][_0x798b('0x1c')]);_0xcf57f[_0x798b('0x1a')]=qs[_0x798b('0x1a')](_0x272a76['query'][_0x798b('0x1a')]);}_0xcf57f[_0x798b('0x39')]=qs[_0x798b('0x3a')](_0x272a76[_0x798b('0x31')][_0x798b('0x3a')]);_0xcf57f[_0x798b('0x3b')]=qs[_0x798b('0x33')](_['pick'](_0x272a76[_0x798b('0x31')],_0x5057fc[_0x798b('0x33')]));_0xcf57f[_0x798b('0x3b')]['ProjectId']=_0x411bce['id'];if(_0x272a76[_0x798b('0x31')][_0x798b('0x3d')]){_0xcf57f['where']=_[_0x798b('0x3e')](_0xcf57f['where'],{'$or':_[_0x798b('0x2b')](_0xcf57f[_0x798b('0x36')],function(_0x5e191f){var _0x4c86d8={};_0x4c86d8[_0x5e191f]={'$like':'%'+_0x272a76['query'][_0x798b('0x3d')]+'%'};return _0x4c86d8;})});}_0xcf57f=_[_0x798b('0x3e')]({},_0xcf57f,_0x272a76[_0x798b('0x46')]);return db[_0x798b('0x5a')][_0x798b('0x1d')]({'where':_0xcf57f[_0x798b('0x3b')]})[_0x798b('0x23')](function(_0x754404){_0x140aa4[_0x798b('0x1d')]=_0x754404;if(_0x272a76['query']['includeAll']){_0xcf57f[_0x798b('0x54')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x798b('0x40')](_0xcf57f);})[_0x798b('0x23')](function(_0x136595){_0x140aa4['rows']=_0x136595;return _0x140aa4;});}})[_0x798b('0x23')](respondWithFilteredResult(_0x100509,_0xcf57f))[_0x798b('0x48')](handleError(_0x100509,null));};exports[_0x798b('0x5b')]=function(_0x4b8752,_0x54d32e,_0x2f19da){var _0x1cf156={'raw':!![],'where':{}};var _0x437fbb={};var _0xb6abe5={'count':0x0,'rows':[]};return db[_0x798b('0x2c')][_0x798b('0x59')]({'where':{'id':_0x4b8752[_0x798b('0x53')]['id']}})[_0x798b('0x23')](handleEntityNotFound(_0x54d32e,null))['then'](function(_0x3ec70c){if(_0x3ec70c){_0x437fbb[_0x798b('0x30')]=_[_0x798b('0x32')](db[_0x798b('0x5c')][_0x798b('0x43')]);_0x437fbb['query']=_[_0x798b('0x32')](_0x4b8752['query']);_0x437fbb[_0x798b('0x33')]=_[_0x798b('0x34')](_0x437fbb[_0x798b('0x30')],_0x437fbb[_0x798b('0x31')]);_0x1cf156[_0x798b('0x36')]=_[_0x798b('0x34')](_0x437fbb['model'],qs[_0x798b('0x35')](_0x4b8752[_0x798b('0x31')]['fields']));_0x1cf156['attributes']=_0x1cf156['attributes'][_0x798b('0x44')]?_0x1cf156[_0x798b('0x36')]:_0x437fbb[_0x798b('0x30')];if(!_0x4b8752[_0x798b('0x31')][_0x798b('0x37')](_0x798b('0x38'))){_0x1cf156['limit']=qs[_0x798b('0x1c')](_0x4b8752['query'][_0x798b('0x1c')]);_0x1cf156[_0x798b('0x1a')]=qs['offset'](_0x4b8752[_0x798b('0x31')][_0x798b('0x1a')]);}_0x1cf156[_0x798b('0x39')]=qs[_0x798b('0x3a')](_0x4b8752[_0x798b('0x31')][_0x798b('0x3a')]);_0x1cf156[_0x798b('0x3b')]=qs[_0x798b('0x33')](_[_0x798b('0x3c')](_0x4b8752[_0x798b('0x31')],_0x437fbb[_0x798b('0x33')]));_0x1cf156[_0x798b('0x3b')][_0x798b('0x5d')]=_0x3ec70c['id'];if(_0x4b8752['query']['filter']){_0x1cf156[_0x798b('0x3b')]=_[_0x798b('0x3e')](_0x1cf156['where'],{'$or':_[_0x798b('0x2b')](_0x1cf156[_0x798b('0x36')],function(_0x3948af){var _0x3d4507={};_0x3d4507[_0x3948af]={'$like':'%'+_0x4b8752[_0x798b('0x31')][_0x798b('0x3d')]+'%'};return _0x3d4507;})});}_0x1cf156=_[_0x798b('0x3e')]({},_0x1cf156,_0x4b8752['options']);return db[_0x798b('0x5c')][_0x798b('0x1d')]({'where':_0x1cf156['where']})[_0x798b('0x23')](function(_0x33d0f2){_0xb6abe5[_0x798b('0x1d')]=_0x33d0f2;if(_0x4b8752['query'][_0x798b('0x45')]){_0x1cf156[_0x798b('0x54')]=[{'all':!![]}];}return db[_0x798b('0x5c')][_0x798b('0x40')](_0x1cf156);})['then'](function(_0x3826e6){_0xb6abe5['rows']=_0x3826e6;return _0xb6abe5;});}})['then'](respondWithFilteredResult(_0x54d32e,_0x1cf156))[_0x798b('0x48')](handleError(_0x54d32e,null));};function char(_0x32e9b9){return _0x798b('0x5e')===typeof _0x32e9b9?String[_0x798b('0x5f')][_0x798b('0x1f')](null,arguments):_0x32e9b9;}function needsEncapsulation(_0x4e3f1){return!!_0x4e3f1&&(_0x4e3f1[_0x798b('0x60')]()[_0x798b('0x61')](char(0xd))>=0x0||_0x4e3f1[_0x798b('0x60')]()['indexOf'](char(0xa))>=0x0||_0x4e3f1[_0x798b('0x60')]()[_0x798b('0x61')](char(0x2c))>=0x0||_0x4e3f1[_0x798b('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4494cb){var _0x381c26=char(0x22),_0x344404='\x5c'+char(0x22),_0x19efc3=_0x4494cb[_0x798b('0x60')]()[_0x798b('0x62')](new RegExp(_0x381c26,'g'),_0x344404);return _0x381c26+_0x19efc3+_0x381c26;}exports[_0x798b('0x63')]=function(_0x12feca,_0x102490,_0x4fd5e9){var _0x51a08a,_0x57d60b;var _0x25d7f8={'where':{'ProjectId':_0x12feca[_0x798b('0x53')]['id']}};if(_0x12feca[_0x798b('0x31')][_0x798b('0x64')]){_0x25d7f8[_0x798b('0x3b')]['starttime']=JSON[_0x798b('0x65')](_0x12feca[_0x798b('0x31')][_0x798b('0x64')]);}return db[_0x798b('0x5a')]['findAll'](_0x25d7f8)[_0x798b('0x23')](handleEntityNotFound(_0x102490,null))[_0x798b('0x23')](function(_0x4cfe9f){if(_0x4cfe9f){_0x51a08a=_0x4cfe9f;return db[_0x798b('0x66')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x51a08a,'id')},'ProjectId':_0x12feca[_0x798b('0x53')]['id']},'order':_0x798b('0x67')});}})[_0x798b('0x23')](handleEntityNotFound(_0x102490,null))[_0x798b('0x23')](function(_0x53b0a1){if(_0x53b0a1){_0x57d60b=_0x53b0a1;var _0x5e96e4={};for(var _0x23e8c0=0x0,_0x566e55=_0x57d60b[_0x798b('0x44')];_0x23e8c0<_0x566e55;_0x23e8c0++){if(!_0x5e96e4[_0x798b('0x37')](_0x57d60b[_0x23e8c0][_0x798b('0x68')])){_0x5e96e4[_0x57d60b[_0x23e8c0][_0x798b('0x68')]]=needsEncapsulation(_0x57d60b[_0x23e8c0][_0x798b('0x69')])?encapsulate(_0x57d60b[_0x23e8c0][_0x798b('0x69')]):_0x57d60b[_0x23e8c0][_0x798b('0x69')];}}var _0x1ba649=[],_0x22013c={};for(var _0x37c068=0x0,_0x5cd286=_0x51a08a[_0x798b('0x44')];_0x37c068<_0x5cd286;_0x37c068++){_0x22013c={'ProjectId':_0x12feca[_0x798b('0x53')]['id'],'SessionId':_0x51a08a[_0x37c068]['id'],'StartTime':moment(_0x51a08a[_0x37c068][_0x798b('0x6a')])['format'](_0x798b('0x6b'))};for(var _0x210cac=0x0,_0x18dc4b=_0x57d60b[_0x798b('0x44')];_0x210cac<_0x18dc4b;_0x210cac++){if(_0x57d60b[_0x210cac][_0x798b('0x6c')]==_0x51a08a[_0x37c068]['id']&&_0x5e96e4[_0x798b('0x37')](_0x57d60b[_0x210cac][_0x798b('0x68')])){_0x22013c[_0x5e96e4[_0x57d60b[_0x210cac][_0x798b('0x68')]]]=_0x57d60b[_0x210cac][_0x798b('0x6d')];}}for(var _0x32165d in _0x5e96e4){if(!_0x22013c[_0x798b('0x37')](_0x5e96e4[_0x32165d])){_0x22013c[_0x5e96e4[_0x32165d]]=null;}}_0x1ba649[_0x798b('0x6e')](_0x22013c);}return _0x1ba649;}})[_0x798b('0x23')](function(_0x3b50c8){if(!_['isEmpty'](_0x3b50c8)){var _0x135051=toCsv(_0x3b50c8);var _0x26c312=Date[_0x798b('0x6f')]();fs[_0x798b('0x70')](util[_0x798b('0x71')](_0x798b('0x72'),_0x12feca[_0x798b('0x53')]['id'],_0x26c312),_0x135051);_0x102490['setHeader'](_0x798b('0x73'),_0x798b('0x74')+util[_0x798b('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x12feca[_0x798b('0x53')]['id'],_0x26c312));_0x102490[_0x798b('0x75')](_0x798b('0x76'),_0x798b('0x77'));return _0x102490[_0x798b('0x78')](util['format'](_0x798b('0x72'),_0x12feca['params']['id'],_0x26c312));}else{return _0x102490[_0x798b('0x16')](0xcc);}})['catch'](handleError(_0x102490,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4df91e6..4ed8bfb 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 _0x826a=['request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','api','bluebird'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x826a,0x1aa));var _0xa826=function(_0x495470,_0x4d1949){_0x495470=_0x495470-0x0;var _0x385acc=_0x826a[_0x495470];return _0x385acc;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var logger=require('../../config/logger')(_0xa826('0x1'));var moment=require('moment');var BPromise=require(_0xa826('0x2'));var rp=require(_0xa826('0x3'));var fs=require('fs');var path=require(_0xa826('0x4'));var rimraf=require(_0xa826('0x5'));var config=require('../../config/environment');var attributes=require(_0xa826('0x6'));module[_0xa826('0x7')]=function(_0x3929d4,_0x34327b){return _0x3929d4[_0xa826('0x8')](_0xa826('0x9'),attributes,{'tableName':_0xa826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['./jscriptyProject.attributes','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58a0cb,_0x3db763){var _0x5b8051=function(_0x166a7e){while(--_0x166a7e){_0x58a0cb['push'](_0x58a0cb['shift']());}};_0x5b8051(++_0x3db763);}(_0xf2cf,0xf5));var _0xff2c=function(_0x50fa25,_0x479f71){_0x50fa25=_0x50fa25-0x0;var _0x496129=_0xf2cf[_0x50fa25];return _0x496129;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('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 9b19cf9..bc29c4b 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0xda3f,0xec));var _0xfda3=function(_0x53996f,_0x5ead0f){_0x53996f=_0x53996f-0x0;var _0xa6eca5=_0xda3f[_0x53996f];return _0xa6eca5;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\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 _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x5a854c,_0xbaad5e){var _0x3324af=function(_0x57fd1c){while(--_0x57fd1c){_0x5a854c['push'](_0x5a854c['shift']());}};_0x3324af(++_0xbaad5e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a1b1e32..80f5462 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 _0x4766=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra'];(function(_0x6d8b10,_0x3287f1){var _0x20e4b3=function(_0x3fc88f){while(--_0x3fc88f){_0x6d8b10['push'](_0x6d8b10['shift']());}};_0x20e4b3(++_0x3287f1);}(_0x4766,0xd8));var _0x6476=function(_0x288415,_0x115d49){_0x288415=_0x288415-0x0;var _0x2c43fe=_0x4766[_0x288415];return _0x2c43fe;};'use strict';var multer=require('multer');var util=require(_0x6476('0x0'));var path=require('path');var timeout=require(_0x6476('0x1'));var express=require(_0x6476('0x2'));var router=express['Router']();var fs_extra=require(_0x6476('0x3'));var auth=require(_0x6476('0x4'));var interaction=require(_0x6476('0x5'));var config=require(_0x6476('0x6'));var controller=require(_0x6476('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6476('0x8')]);router[_0x6476('0x9')](_0x6476('0xa'),auth[_0x6476('0xb')](),controller['describe']);router[_0x6476('0x9')](_0x6476('0xc'),auth[_0x6476('0xb')](),controller['show']);router[_0x6476('0xd')]('/',auth[_0x6476('0xb')](),controller[_0x6476('0xe')]);router[_0x6476('0xf')]('/:id',auth[_0x6476('0xb')](),controller[_0x6476('0x10')]);router[_0x6476('0x11')](_0x6476('0xc'),auth[_0x6476('0xb')](),controller[_0x6476('0x12')]);module[_0x6476('0x13')]=router; \ No newline at end of file +var _0x342b=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x5432c9,_0x14de80){var _0x4bb173=function(_0x1367ac){while(--_0x1367ac){_0x5432c9['push'](_0x5432c9['shift']());}};_0x4bb173(++_0x14de80);}(_0x342b,0x155));var _0xb342=function(_0x30542b,_0x23ef43){_0x30542b=_0x30542b-0x0;var _0x3ac05f=_0x342b[_0x30542b];return _0x3ac05f;};'use strict';var multer=require(_0xb342('0x0'));var util=require(_0xb342('0x1'));var path=require('path');var timeout=require(_0xb342('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb342('0x3'));var auth=require(_0xb342('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb342('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb342('0x6')]('/',auth[_0xb342('0x7')](),controller['index']);router['get'](_0xb342('0x8'),auth['isAuthenticated'](),controller[_0xb342('0x9')]);router[_0xb342('0x6')](_0xb342('0xa'),auth[_0xb342('0x7')](),controller['show']);router['post']('/',auth[_0xb342('0x7')](),controller[_0xb342('0xb')]);router[_0xb342('0xc')](_0xb342('0xa'),auth['isAuthenticated'](),controller[_0xb342('0xd')]);router['delete']('/:id',auth[_0xb342('0x7')](),controller[_0xb342('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5f4cf35..01d053d 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x17e10e,_0x46fc31){_0x17e10e=_0x17e10e-0x0;var _0x3df1cb=_0x7a54[_0x17e10e];return _0x3df1cb;};'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(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x3cd272,_0x3e4d86){_0x3cd272=_0x3cd272-0x0;var _0x38f99d=_0x7a54[_0x3cd272];return _0x38f99d;};'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 2002a5c..6b78ac6 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 _0x3871=['filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','end','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x5e076d,_0x4b3151){var _0x1f5b85=function(_0x1c7695){while(--_0x1c7695){_0x5e076d['push'](_0x5e076d['shift']());}};_0x1f5b85(++_0x4b3151);}(_0x3871,0x137));var _0x1387=function(_0x351dea,_0x29bdee){_0x351dea=_0x351dea-0x0;var _0x3aefab=_0x3871[_0x351dea];return _0x3aefab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1387('0x0'));var zipdir=require(_0x1387('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1387('0x2'));var moment=require(_0x1387('0x3'));var BPromise=require(_0x1387('0x4'));var Mustache=require('mustache');var util=require(_0x1387('0x5'));var path=require(_0x1387('0x6'));var sox=require(_0x1387('0x7'));var csv=require(_0x1387('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1387('0x9'));var _=require(_0x1387('0xa'));var squel=require(_0x1387('0xb'));var crypto=require(_0x1387('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1387('0xd'));var toCsv=require(_0x1387('0x8'));var querystring=require(_0x1387('0xe'));var Papa=require(_0x1387('0xf'));var Redis=require(_0x1387('0x10'));var authService=require(_0x1387('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1387('0x12'));var hardwareService=require(_0x1387('0x13'));var logger=require(_0x1387('0x14'))(_0x1387('0x15'));var utils=require(_0x1387('0x16'));var config=require(_0x1387('0x17'));var licenseUtil=require(_0x1387('0x18'));var db=require(_0x1387('0x19'))['db'];function respondWithStatusCode(_0x4e9df9,_0x3fd012){_0x3fd012=_0x3fd012||0xcc;return function(_0x28a109){if(_0x28a109){return _0x4e9df9['sendStatus'](_0x3fd012);}return _0x4e9df9[_0x1387('0x1a')](_0x3fd012)['end']();};}function respondWithResult(_0x44c356,_0x9d56c){_0x9d56c=_0x9d56c||0xc8;return function(_0x423058){if(_0x423058){return _0x44c356['status'](_0x9d56c)['json'](_0x423058);}};}function respondWithFilteredResult(_0x330e55,_0x246f2a){return function(_0x31fe91){if(_0x31fe91){var _0x524e4d=typeof _0x246f2a[_0x1387('0x1b')]===_0x1387('0x1c')&&typeof _0x246f2a[_0x1387('0x1d')]==='undefined';var _0xb6af7e=_0x31fe91[_0x1387('0x1e')];var _0x14a341=_0x524e4d?0x0:_0x246f2a['offset'];var _0x13c1f0=_0x524e4d?_0x31fe91[_0x1387('0x1e')]:_0x246f2a[_0x1387('0x1b')]+_0x246f2a[_0x1387('0x1d')];var _0x9b9f0f;if(_0x13c1f0>=_0xb6af7e){_0x13c1f0=_0xb6af7e;_0x9b9f0f=0xc8;}else{_0x9b9f0f=0xce;}_0x330e55['status'](_0x9b9f0f);return _0x330e55['set'](_0x1387('0x1f'),_0x14a341+'-'+_0x13c1f0+'/'+_0xb6af7e)[_0x1387('0x20')](_0x31fe91);}return null;};}function patchUpdates(_0x2cc440){return function(_0x27e729){try{jsonpatch['apply'](_0x27e729,_0x2cc440,!![]);}catch(_0x2d5418){return BPromise[_0x1387('0x21')](_0x2d5418);}return _0x27e729['save']();};}function saveUpdates(_0x53207c,_0x520f11){return function(_0x34b9c4){if(_0x34b9c4){return _0x34b9c4[_0x1387('0x22')](_0x53207c)['then'](function(_0x3fe682){return _0x3fe682;});}return null;};}function removeEntity(_0x56977a,_0x58757b){return function(_0x3fa2d5){if(_0x3fa2d5){return _0x3fa2d5['destroy']()[_0x1387('0x23')](function(){_0x56977a['status'](0xcc)[_0x1387('0x24')]();});}};}function handleEntityNotFound(_0x496348,_0x4142e8){return function(_0x16d836){if(!_0x16d836){_0x496348[_0x1387('0x25')](0x194);}return _0x16d836;};}function handleError(_0x3970c8,_0x3cf634){_0x3cf634=_0x3cf634||0x1f4;return function(_0x260d8e){logger[_0x1387('0x26')](_0x260d8e[_0x1387('0x27')]);if(_0x260d8e[_0x1387('0x28')]){delete _0x260d8e[_0x1387('0x28')];}_0x3970c8[_0x1387('0x1a')](_0x3cf634)[_0x1387('0x29')](_0x260d8e);};}exports[_0x1387('0x2a')]=function(_0x5b1fab,_0x4628b3){var _0x38d391={},_0x129c48={},_0x1e8982={'count':0x0,'rows':[]};var _0x250fc7=_[_0x1387('0x2b')](db[_0x1387('0x2c')]['rawAttributes'],function(_0x37bb38){return{'name':_0x37bb38[_0x1387('0x2d')],'type':_0x37bb38[_0x1387('0x2e')][_0x1387('0x2f')]};});_0x129c48[_0x1387('0x30')]=_[_0x1387('0x2b')](_0x250fc7,_0x1387('0x28'));_0x129c48['query']=_[_0x1387('0x31')](_0x5b1fab[_0x1387('0x32')]);_0x129c48['filters']=_[_0x1387('0x33')](_0x129c48[_0x1387('0x30')],_0x129c48[_0x1387('0x32')]);_0x38d391[_0x1387('0x34')]=_[_0x1387('0x33')](_0x129c48[_0x1387('0x30')],qs[_0x1387('0x35')](_0x5b1fab['query'][_0x1387('0x35')]));_0x38d391[_0x1387('0x34')]=_0x38d391[_0x1387('0x34')][_0x1387('0x36')]?_0x38d391[_0x1387('0x34')]:_0x129c48['model'];if(!_0x5b1fab[_0x1387('0x32')]['hasOwnProperty'](_0x1387('0x37'))){_0x38d391[_0x1387('0x1d')]=qs[_0x1387('0x1d')](_0x5b1fab[_0x1387('0x32')][_0x1387('0x1d')]);_0x38d391[_0x1387('0x1b')]=qs['offset'](_0x5b1fab[_0x1387('0x32')]['offset']);}_0x38d391[_0x1387('0x38')]=qs[_0x1387('0x39')](_0x5b1fab[_0x1387('0x32')]['sort']);_0x38d391[_0x1387('0x3a')]=qs['filters'](_['pick'](_0x5b1fab[_0x1387('0x32')],_0x129c48[_0x1387('0x3b')]),_0x250fc7);if(_0x5b1fab['query'][_0x1387('0x3c')]){_0x38d391[_0x1387('0x3a')]=_['merge'](_0x38d391[_0x1387('0x3a')],{'$or':_[_0x1387('0x2b')](_0x250fc7,function(_0x3f12ca){if(_0x3f12ca['type']!=='VIRTUAL'){var _0x3bc831={};_0x3bc831[_0x3f12ca[_0x1387('0x28')]]={'$like':'%'+_0x5b1fab[_0x1387('0x32')][_0x1387('0x3c')]+'%'};return _0x3bc831;}})});}_0x38d391=_[_0x1387('0x3d')]({},_0x38d391,_0x5b1fab[_0x1387('0x3e')]);var _0x4c94b0={'where':_0x38d391[_0x1387('0x3a')]};return db[_0x1387('0x2c')][_0x1387('0x1e')](_0x4c94b0)['then'](function(_0x23433d){_0x1e8982[_0x1387('0x1e')]=_0x23433d;if(_0x5b1fab['query'][_0x1387('0x3f')]){_0x38d391['include']=[{'all':!![]}];}return db[_0x1387('0x2c')][_0x1387('0x40')](_0x38d391);})[_0x1387('0x23')](function(_0x127783){_0x1e8982[_0x1387('0x41')]=_0x127783;return _0x1e8982;})[_0x1387('0x23')](respondWithFilteredResult(_0x4628b3,_0x38d391))[_0x1387('0x42')](handleError(_0x4628b3,null));};exports[_0x1387('0x43')]=function(_0x7a5de1,_0x382066){var _0x21abed={'raw':!![],'where':{'id':_0x7a5de1[_0x1387('0x44')]['id']}},_0x5e51c0={};_0x5e51c0['model']=_[_0x1387('0x31')](db[_0x1387('0x2c')][_0x1387('0x45')]);_0x5e51c0[_0x1387('0x32')]=_[_0x1387('0x31')](_0x7a5de1[_0x1387('0x32')]);_0x5e51c0[_0x1387('0x3b')]=_[_0x1387('0x33')](_0x5e51c0[_0x1387('0x30')],_0x5e51c0[_0x1387('0x32')]);_0x21abed[_0x1387('0x34')]=_[_0x1387('0x33')](_0x5e51c0[_0x1387('0x30')],qs[_0x1387('0x35')](_0x7a5de1[_0x1387('0x32')]['fields']));_0x21abed['attributes']=_0x21abed[_0x1387('0x34')][_0x1387('0x36')]?_0x21abed[_0x1387('0x34')]:_0x5e51c0[_0x1387('0x30')];if(_0x7a5de1[_0x1387('0x32')][_0x1387('0x3f')]){_0x21abed['include']=[{'all':!![]}];}_0x21abed=_['merge']({},_0x21abed,_0x7a5de1[_0x1387('0x3e')]);return db['JscriptyQuestionReport'][_0x1387('0x46')](_0x21abed)[_0x1387('0x23')](handleEntityNotFound(_0x382066,null))['then'](respondWithResult(_0x382066,null))[_0x1387('0x42')](handleError(_0x382066,null));};exports[_0x1387('0x47')]=function(_0xeb1abb,_0x834716){return db[_0x1387('0x2c')][_0x1387('0x47')](_0xeb1abb[_0x1387('0x48')],{})[_0x1387('0x23')](respondWithResult(_0x834716,0xc9))[_0x1387('0x42')](handleError(_0x834716,null));};exports[_0x1387('0x22')]=function(_0x4a3cfc,_0xd3c584){if(_0x4a3cfc[_0x1387('0x48')]['id']){delete _0x4a3cfc[_0x1387('0x48')]['id'];}return db[_0x1387('0x2c')][_0x1387('0x46')]({'where':{'id':_0x4a3cfc[_0x1387('0x44')]['id']}})['then'](handleEntityNotFound(_0xd3c584,null))['then'](saveUpdates(_0x4a3cfc[_0x1387('0x48')],null))[_0x1387('0x23')](respondWithResult(_0xd3c584,null))[_0x1387('0x42')](handleError(_0xd3c584,null));};exports[_0x1387('0x49')]=function(_0x3c61c4,_0xd99110){return db['JscriptyQuestionReport'][_0x1387('0x46')]({'where':{'id':_0x3c61c4[_0x1387('0x44')]['id']}})['then'](handleEntityNotFound(_0xd99110,null))[_0x1387('0x23')](removeEntity(_0xd99110,null))['catch'](handleError(_0xd99110,null));};exports['describe']=function(_0x4fa61c,_0x3e4483){return db['JscriptyQuestionReport']['describe']()[_0x1387('0x23')](respondWithResult(_0x3e4483,null))[_0x1387('0x42')](handleError(_0x3e4483,null));}; \ No newline at end of file +var _0x48b6=['offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x843096,_0x3e7d12){var _0x15e168=function(_0x1af764){while(--_0x1af764){_0x843096['push'](_0x843096['shift']());}};_0x15e168(++_0x3e7d12);}(_0x48b6,0x1b2));var _0x648b=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x48b6[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0x648b('0x0'));var rimraf=require(_0x648b('0x1'));var zipdir=require(_0x648b('0x2'));var jsonpatch=require(_0x648b('0x3'));var rp=require('request-promise');var moment=require(_0x648b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x648b('0x5'));var path=require(_0x648b('0x6'));var sox=require(_0x648b('0x7'));var csv=require(_0x648b('0x8'));var ejs=require(_0x648b('0x9'));var fs=require('fs');var fs_extra=require(_0x648b('0xa'));var _=require(_0x648b('0xb'));var squel=require(_0x648b('0xc'));var crypto=require(_0x648b('0xd'));var jsforce=require(_0x648b('0xe'));var deskjs=require(_0x648b('0xf'));var toCsv=require(_0x648b('0x8'));var querystring=require(_0x648b('0x10'));var Papa=require('papaparse');var Redis=require(_0x648b('0x11'));var authService=require(_0x648b('0x12'));var qs=require(_0x648b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x648b('0x14'));var logger=require(_0x648b('0x15'))(_0x648b('0x16'));var utils=require(_0x648b('0x17'));var config=require(_0x648b('0x18'));var licenseUtil=require(_0x648b('0x19'));var db=require(_0x648b('0x1a'))['db'];function respondWithStatusCode(_0x5ab29d,_0x188c7a){_0x188c7a=_0x188c7a||0xcc;return function(_0xdcb314){if(_0xdcb314){return _0x5ab29d[_0x648b('0x1b')](_0x188c7a);}return _0x5ab29d[_0x648b('0x1c')](_0x188c7a)[_0x648b('0x1d')]();};}function respondWithResult(_0x1350db,_0x4beb68){_0x4beb68=_0x4beb68||0xc8;return function(_0x5e1232){if(_0x5e1232){return _0x1350db['status'](_0x4beb68)[_0x648b('0x1e')](_0x5e1232);}};}function respondWithFilteredResult(_0x37e489,_0x3852db){return function(_0x46d077){if(_0x46d077){var _0x10567d=typeof _0x3852db['offset']===_0x648b('0x1f')&&typeof _0x3852db[_0x648b('0x20')]===_0x648b('0x1f');var _0x508747=_0x46d077[_0x648b('0x21')];var _0x2a9bc4=_0x10567d?0x0:_0x3852db[_0x648b('0x22')];var _0x3cede8=_0x10567d?_0x46d077[_0x648b('0x21')]:_0x3852db[_0x648b('0x22')]+_0x3852db[_0x648b('0x20')];var _0x20298b;if(_0x3cede8>=_0x508747){_0x3cede8=_0x508747;_0x20298b=0xc8;}else{_0x20298b=0xce;}_0x37e489[_0x648b('0x1c')](_0x20298b);return _0x37e489[_0x648b('0x23')](_0x648b('0x24'),_0x2a9bc4+'-'+_0x3cede8+'/'+_0x508747)[_0x648b('0x1e')](_0x46d077);}return null;};}function patchUpdates(_0x40eee8){return function(_0x26d839){try{jsonpatch[_0x648b('0x25')](_0x26d839,_0x40eee8,!![]);}catch(_0x2f9b50){return BPromise[_0x648b('0x26')](_0x2f9b50);}return _0x26d839[_0x648b('0x27')]();};}function saveUpdates(_0x504acc,_0x3747df){return function(_0x5a7b45){if(_0x5a7b45){return _0x5a7b45[_0x648b('0x28')](_0x504acc)[_0x648b('0x29')](function(_0x2c6785){return _0x2c6785;});}return null;};}function removeEntity(_0x2b221f,_0x2e7e7a){return function(_0x49e74e){if(_0x49e74e){return _0x49e74e['destroy']()[_0x648b('0x29')](function(){_0x2b221f['status'](0xcc)[_0x648b('0x1d')]();});}};}function handleEntityNotFound(_0x143253,_0x41b794){return function(_0x4b6685){if(!_0x4b6685){_0x143253[_0x648b('0x1b')](0x194);}return _0x4b6685;};}function handleError(_0x17f34,_0xa91597){_0xa91597=_0xa91597||0x1f4;return function(_0x5a7c7f){logger[_0x648b('0x2a')](_0x5a7c7f['stack']);if(_0x5a7c7f['name']){delete _0x5a7c7f[_0x648b('0x2b')];}_0x17f34['status'](_0xa91597)['send'](_0x5a7c7f);};}exports[_0x648b('0x2c')]=function(_0xea5bd1,_0x3187b5){var _0x3aa169={},_0x4effd3={},_0xd53f44={'count':0x0,'rows':[]};var _0x5aebf9=_[_0x648b('0x2d')](db[_0x648b('0x2e')][_0x648b('0x2f')],function(_0x416b3a){return{'name':_0x416b3a[_0x648b('0x30')],'type':_0x416b3a[_0x648b('0x31')][_0x648b('0x32')]};});_0x4effd3[_0x648b('0x33')]=_[_0x648b('0x2d')](_0x5aebf9,_0x648b('0x2b'));_0x4effd3[_0x648b('0x34')]=_[_0x648b('0x35')](_0xea5bd1[_0x648b('0x34')]);_0x4effd3[_0x648b('0x36')]=_[_0x648b('0x37')](_0x4effd3['model'],_0x4effd3[_0x648b('0x34')]);_0x3aa169[_0x648b('0x38')]=_[_0x648b('0x37')](_0x4effd3['model'],qs[_0x648b('0x39')](_0xea5bd1[_0x648b('0x34')][_0x648b('0x39')]));_0x3aa169[_0x648b('0x38')]=_0x3aa169[_0x648b('0x38')]['length']?_0x3aa169[_0x648b('0x38')]:_0x4effd3[_0x648b('0x33')];if(!_0xea5bd1[_0x648b('0x34')][_0x648b('0x3a')]('nolimit')){_0x3aa169[_0x648b('0x20')]=qs['limit'](_0xea5bd1[_0x648b('0x34')][_0x648b('0x20')]);_0x3aa169['offset']=qs['offset'](_0xea5bd1[_0x648b('0x34')][_0x648b('0x22')]);}_0x3aa169[_0x648b('0x3b')]=qs['sort'](_0xea5bd1['query']['sort']);_0x3aa169[_0x648b('0x3c')]=qs['filters'](_[_0x648b('0x3d')](_0xea5bd1[_0x648b('0x34')],_0x4effd3[_0x648b('0x36')]),_0x5aebf9);if(_0xea5bd1[_0x648b('0x34')][_0x648b('0x3e')]){_0x3aa169['where']=_['merge'](_0x3aa169['where'],{'$or':_[_0x648b('0x2d')](_0x5aebf9,function(_0x426b18){if(_0x426b18[_0x648b('0x31')]!==_0x648b('0x3f')){var _0x49ee10={};_0x49ee10[_0x426b18['name']]={'$like':'%'+_0xea5bd1['query']['filter']+'%'};return _0x49ee10;}})});}_0x3aa169=_['merge']({},_0x3aa169,_0xea5bd1[_0x648b('0x40')]);var _0x38a2d1={'where':_0x3aa169[_0x648b('0x3c')]};return db['JscriptyQuestionReport'][_0x648b('0x21')](_0x38a2d1)[_0x648b('0x29')](function(_0x28dcc7){_0xd53f44[_0x648b('0x21')]=_0x28dcc7;if(_0xea5bd1['query'][_0x648b('0x41')]){_0x3aa169[_0x648b('0x42')]=[{'all':!![]}];}return db[_0x648b('0x2e')]['findAll'](_0x3aa169);})[_0x648b('0x29')](function(_0x3e0040){_0xd53f44[_0x648b('0x43')]=_0x3e0040;return _0xd53f44;})[_0x648b('0x29')](respondWithFilteredResult(_0x3187b5,_0x3aa169))[_0x648b('0x44')](handleError(_0x3187b5,null));};exports[_0x648b('0x45')]=function(_0x1918f2,_0x209c31){var _0x318b8a={'raw':!![],'where':{'id':_0x1918f2[_0x648b('0x46')]['id']}},_0x5ba25e={};_0x5ba25e['model']=_['keys'](db[_0x648b('0x2e')][_0x648b('0x2f')]);_0x5ba25e[_0x648b('0x34')]=_[_0x648b('0x35')](_0x1918f2['query']);_0x5ba25e[_0x648b('0x36')]=_['intersection'](_0x5ba25e[_0x648b('0x33')],_0x5ba25e['query']);_0x318b8a[_0x648b('0x38')]=_[_0x648b('0x37')](_0x5ba25e[_0x648b('0x33')],qs[_0x648b('0x39')](_0x1918f2[_0x648b('0x34')][_0x648b('0x39')]));_0x318b8a['attributes']=_0x318b8a[_0x648b('0x38')][_0x648b('0x47')]?_0x318b8a[_0x648b('0x38')]:_0x5ba25e['model'];if(_0x1918f2[_0x648b('0x34')][_0x648b('0x41')]){_0x318b8a[_0x648b('0x42')]=[{'all':!![]}];}_0x318b8a=_[_0x648b('0x48')]({},_0x318b8a,_0x1918f2[_0x648b('0x40')]);return db[_0x648b('0x2e')][_0x648b('0x49')](_0x318b8a)[_0x648b('0x29')](handleEntityNotFound(_0x209c31,null))[_0x648b('0x29')](respondWithResult(_0x209c31,null))[_0x648b('0x44')](handleError(_0x209c31,null));};exports[_0x648b('0x4a')]=function(_0x5cdd8c,_0x5f4ac6){return db['JscriptyQuestionReport'][_0x648b('0x4a')](_0x5cdd8c[_0x648b('0x4b')],{})[_0x648b('0x29')](respondWithResult(_0x5f4ac6,0xc9))[_0x648b('0x44')](handleError(_0x5f4ac6,null));};exports[_0x648b('0x28')]=function(_0x54fba6,_0x1d0036){if(_0x54fba6['body']['id']){delete _0x54fba6[_0x648b('0x4b')]['id'];}return db[_0x648b('0x2e')][_0x648b('0x49')]({'where':{'id':_0x54fba6[_0x648b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d0036,null))[_0x648b('0x29')](saveUpdates(_0x54fba6[_0x648b('0x4b')],null))[_0x648b('0x29')](respondWithResult(_0x1d0036,null))[_0x648b('0x44')](handleError(_0x1d0036,null));};exports[_0x648b('0x4c')]=function(_0x1d669e,_0x49c36e){return db[_0x648b('0x2e')][_0x648b('0x49')]({'where':{'id':_0x1d669e[_0x648b('0x46')]['id']}})[_0x648b('0x29')](handleEntityNotFound(_0x49c36e,null))['then'](removeEntity(_0x49c36e,null))[_0x648b('0x44')](handleError(_0x49c36e,null));};exports[_0x648b('0x4d')]=function(_0x338cd4,_0x3661c2){return db[_0x648b('0x2e')]['describe']()['then'](respondWithResult(_0x3661c2,null))['catch'](handleError(_0x3661c2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ffbb3a9..6f341d0 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 _0x8022=['define','report_jscripty_questions','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8022,0x70));var _0x2802=function(_0x3d3bd2,_0x5aad60){_0x3d3bd2=_0x3d3bd2-0x0;var _0x4c795e=_0x8022[_0x3d3bd2];return _0x4c795e;};'use strict';var _=require(_0x2802('0x0'));var util=require(_0x2802('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2802('0x2'));var BPromise=require(_0x2802('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2802('0x4'));var rimraf=require(_0x2802('0x5'));var config=require(_0x2802('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2802('0x7')]=function(_0x569b12,_0x10b47e){return _0x569b12[_0x2802('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x2802('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3600=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x111327,_0x470199){var _0x44e4b4=function(_0x4da178){while(--_0x4da178){_0x111327['push'](_0x111327['shift']());}};_0x44e4b4(++_0x470199);}(_0x3600,0x1e4));var _0x0360=function(_0x33e831,_0x5ec236){_0x33e831=_0x33e831-0x0;var _0x3e64f7=_0x3600[_0x33e831];return _0x3e64f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0360('0x0'));var moment=require(_0x0360('0x1'));var BPromise=require(_0x0360('0x2'));var rp=require(_0x0360('0x3'));var fs=require('fs');var path=require(_0x0360('0x4'));var rimraf=require('rimraf');var config=require(_0x0360('0x5'));var attributes=require(_0x0360('0x6'));module[_0x0360('0x7')]=function(_0x58bd11,_0x30b38a){return _0x58bd11[_0x0360('0x8')](_0x0360('0x9'),attributes,{'tableName':_0x0360('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index d320c9d..1644eee 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 _0x9e5b=['message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9e5b,0x18e));var _0xb9e5=function(_0x211594,_0x1f4a00){_0x211594=_0x211594-0x0;var _0x8be26c=_0x9e5b[_0x211594];return _0x8be26c;};'use strict';var _=require('lodash');var util=require(_0xb9e5('0x0'));var moment=require(_0xb9e5('0x1'));var BPromise=require(_0xb9e5('0x2'));var rs=require(_0xb9e5('0x3'));var fs=require('fs');var Redis=require(_0xb9e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9e5('0x5'));var logger=require(_0xb9e5('0x6'))(_0xb9e5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb9e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ac41,_0x26a0a7,_0x21e4af){return new BPromise(function(_0x392976,_0x2e9969){return client[_0xb9e5('0x9')](_0x45ac41,_0x21e4af)[_0xb9e5('0xa')](function(_0x55ffa5){logger[_0xb9e5('0xb')](_0xb9e5('0xc'),_0x26a0a7,_0xb9e5('0xd'));logger[_0xb9e5('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x26a0a7,'request\x20sent',JSON['stringify'](_0x55ffa5));if(_0x55ffa5[_0xb9e5('0xf')]){if(_0x55ffa5[_0xb9e5('0xf')]['code']===0x1f4){logger[_0xb9e5('0xf')](_0xb9e5('0xc'),_0x26a0a7,_0x55ffa5[_0xb9e5('0xf')][_0xb9e5('0x10')]);return _0x2e9969(_0x55ffa5[_0xb9e5('0xf')]['message']);}logger[_0xb9e5('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x26a0a7,_0x55ffa5[_0xb9e5('0xf')]['message']);return _0x392976(_0x55ffa5[_0xb9e5('0xf')][_0xb9e5('0x10')]);}else{logger['info'](_0xb9e5('0xc'),_0x26a0a7,'request\x20sent');_0x392976(_0x55ffa5[_0xb9e5('0x11')][_0xb9e5('0x10')]);}})['catch'](function(_0x53de24){logger[_0xb9e5('0xf')](_0xb9e5('0xc'),_0x26a0a7,_0x53de24);_0x2e9969(_0x53de24);});});} \ No newline at end of file +var _0x5a31=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3709d,_0x43bf53){var _0x418d74=function(_0x2cd092){while(--_0x2cd092){_0x3709d['push'](_0x3709d['shift']());}};_0x418d74(++_0x43bf53);}(_0x5a31,0x1e3));var _0x15a3=function(_0x5e334b,_0x2aa45f){_0x5e334b=_0x5e334b-0x0;var _0x2c59f8=_0x5a31[_0x5e334b];return _0x2c59f8;};'use strict';var _=require(_0x15a3('0x0'));var util=require('util');var moment=require(_0x15a3('0x1'));var BPromise=require(_0x15a3('0x2'));var rs=require(_0x15a3('0x3'));var fs=require('fs');var Redis=require(_0x15a3('0x4'));var db=require(_0x15a3('0x5'))['db'];var utils=require(_0x15a3('0x6'));var logger=require(_0x15a3('0x7'))(_0x15a3('0x8'));var config=require(_0x15a3('0x9'));var jayson=require(_0x15a3('0xa'));var client=jayson[_0x15a3('0xb')][_0x15a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x599afe,_0x33abdf,_0x234d5b){return new BPromise(function(_0x3d4b83,_0x36473b){return client[_0x15a3('0xd')](_0x599afe,_0x234d5b)[_0x15a3('0xe')](function(_0xf1aa52){logger[_0x15a3('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33abdf,_0x15a3('0x10'));logger[_0x15a3('0x11')](_0x15a3('0x12'),_0x33abdf,_0x15a3('0x10'),JSON[_0x15a3('0x13')](_0xf1aa52));if(_0xf1aa52[_0x15a3('0x14')]){if(_0xf1aa52[_0x15a3('0x14')]['code']===0x1f4){logger[_0x15a3('0x14')](_0x15a3('0x15'),_0x33abdf,_0xf1aa52[_0x15a3('0x14')]['message']);return _0x36473b(_0xf1aa52[_0x15a3('0x14')][_0x15a3('0x16')]);}logger['error'](_0x15a3('0x15'),_0x33abdf,_0xf1aa52['error']['message']);return _0x3d4b83(_0xf1aa52[_0x15a3('0x14')]['message']);}else{logger[_0x15a3('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33abdf,_0x15a3('0x10'));_0x3d4b83(_0xf1aa52[_0x15a3('0x17')]['message']);}})[_0x15a3('0x18')](function(_0x143463){logger['error'](_0x15a3('0x15'),_0x33abdf,_0x143463);_0x36473b(_0x143463);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2358d38..bc200bc 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 _0xfdf2=['update','destroy','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','getQuestions','post','put','/:id'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xfdf2,0xe7));var _0x2fdf=function(_0x3c8247,_0x237054){_0x3c8247=_0x3c8247-0x0;var _0x47ca00=_0xfdf2[_0x3c8247];return _0x47ca00;};'use strict';var multer=require(_0x2fdf('0x0'));var util=require(_0x2fdf('0x1'));var path=require('path');var timeout=require(_0x2fdf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2fdf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2fdf('0x4'));var controller=require(_0x2fdf('0x5'));router[_0x2fdf('0x6')]('/',auth[_0x2fdf('0x7')](),controller[_0x2fdf('0x8')]);router[_0x2fdf('0x6')](_0x2fdf('0x9'),auth['isAuthenticated'](),controller[_0x2fdf('0xa')]);router[_0x2fdf('0x6')]('/:id',auth[_0x2fdf('0x7')](),controller[_0x2fdf('0xb')]);router[_0x2fdf('0x6')]('/:id/questions',auth[_0x2fdf('0x7')](),controller[_0x2fdf('0xc')]);router[_0x2fdf('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2fdf('0xe')](_0x2fdf('0xf'),auth['isAuthenticated'](),controller[_0x2fdf('0x10')]);router['delete']('/:id',auth[_0x2fdf('0x7')](),controller[_0x2fdf('0x11')]);module[_0x2fdf('0x12')]=router; \ No newline at end of file +var _0x722a=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','show','/:id/questions','getQuestions','post','put','/:id','update','delete'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0x722a,0x1a0));var _0xa722=function(_0x11077d,_0x17024a){_0x11077d=_0x11077d-0x0;var _0x40aa3c=_0x722a[_0x11077d];return _0x40aa3c;};'use strict';var multer=require(_0xa722('0x0'));var util=require(_0xa722('0x1'));var path=require('path');var timeout=require(_0xa722('0x2'));var express=require('express');var router=express[_0xa722('0x3')]();var fs_extra=require(_0xa722('0x4'));var auth=require(_0xa722('0x5'));var interaction=require(_0xa722('0x6'));var config=require(_0xa722('0x7'));var controller=require(_0xa722('0x8'));router[_0xa722('0x9')]('/',auth[_0xa722('0xa')](),controller[_0xa722('0xb')]);router['get']('/describe',auth[_0xa722('0xa')](),controller[_0xa722('0xc')]);router['get']('/:id',auth[_0xa722('0xa')](),controller[_0xa722('0xd')]);router['get'](_0xa722('0xe'),auth[_0xa722('0xa')](),controller[_0xa722('0xf')]);router[_0xa722('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa722('0x11')](_0xa722('0x12'),auth[_0xa722('0xa')](),controller[_0xa722('0x13')]);router[_0xa722('0x14')](_0xa722('0x12'),auth[_0xa722('0xa')](),controller[_0xa722('0x15')]);module[_0xa722('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9d49b83..416eaf8 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 _0x9a4d=['exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x17ea60,_0x26adcc){var _0x172545=function(_0x209f2a){while(--_0x209f2a){_0x17ea60['push'](_0x17ea60['shift']());}};_0x172545(++_0x26adcc);}(_0x9a4d,0xa8));var _0xd9a4=function(_0x50c5fd,_0x4d9f10){_0x50c5fd=_0x50c5fd-0x0;var _0x547eb7=_0x9a4d[_0x50c5fd];return _0x547eb7;};'use strict';var moment=require(_0xd9a4('0x0'));var Sequelize=require(_0xd9a4('0x1'));module[_0xd9a4('0x2')]={'starttime':{'type':Sequelize[_0xd9a4('0x3')],'set':function(_0x4ef43e){this['setDataValue']('starttime',_0x4ef43e);this[_0xd9a4('0x4')](_0xd9a4('0x5'),moment()[_0xd9a4('0x6')](_0xd9a4('0x7')));}},'endtime':{'type':Sequelize[_0xd9a4('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xd9a4('0x8')]},'queue':{'type':Sequelize[_0xd9a4('0x8')]},'uniqueid':{'type':Sequelize[_0xd9a4('0x8')]},'calleridname':{'type':Sequelize[_0xd9a4('0x8')]},'calleridnum':{'type':Sequelize[_0xd9a4('0x8')]},'completed':{'type':Sequelize[_0xd9a4('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xfc89=['setDataValue','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','exports','starttime'];(function(_0x4e1d3c,_0x4f9988){var _0x5177b2=function(_0x26109f){while(--_0x26109f){_0x4e1d3c['push'](_0x4e1d3c['shift']());}};_0x5177b2(++_0x4f9988);}(_0xfc89,0xf3));var _0x9fc8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xfc89[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9fc8('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3bb8e0){this['setDataValue'](_0x9fc8('0x1'),_0x3bb8e0);this[_0x9fc8('0x2')]('endtime',moment()['format'](_0x9fc8('0x3')));}},'endtime':{'type':Sequelize[_0x9fc8('0x4')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9fc8('0x5')]},'uniqueid':{'type':Sequelize[_0x9fc8('0x5')]},'calleridname':{'type':Sequelize[_0x9fc8('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x9fc8('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index effad74..2843efe 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 _0x1e91=['send','index','map','JscriptySessionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x1e91,0x168));var _0x11e9=function(_0x2b5587,_0x2de0c0){_0x2b5587=_0x2b5587-0x0;var _0x317e3a=_0x1e91[_0x2b5587];return _0x317e3a;};'use strict';var emlformat=require(_0x11e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11e9('0x1'));var jsonpatch=require(_0x11e9('0x2'));var rp=require(_0x11e9('0x3'));var moment=require(_0x11e9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11e9('0x5'));var path=require(_0x11e9('0x6'));var sox=require(_0x11e9('0x7'));var csv=require(_0x11e9('0x8'));var ejs=require(_0x11e9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11e9('0xa'));var squel=require(_0x11e9('0xb'));var crypto=require('crypto');var jsforce=require(_0x11e9('0xc'));var deskjs=require(_0x11e9('0xd'));var toCsv=require(_0x11e9('0x8'));var querystring=require(_0x11e9('0xe'));var Papa=require(_0x11e9('0xf'));var Redis=require(_0x11e9('0x10'));var authService=require(_0x11e9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x11e9('0x12'));var hardwareService=require(_0x11e9('0x13'));var logger=require(_0x11e9('0x14'))(_0x11e9('0x15'));var utils=require(_0x11e9('0x16'));var config=require(_0x11e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x11e9('0x18'))['db'];function respondWithStatusCode(_0x5ac226,_0x1aea3e){_0x1aea3e=_0x1aea3e||0xcc;return function(_0x1ef1ce){if(_0x1ef1ce){return _0x5ac226[_0x11e9('0x19')](_0x1aea3e);}return _0x5ac226[_0x11e9('0x1a')](_0x1aea3e)[_0x11e9('0x1b')]();};}function respondWithResult(_0x400078,_0x2a829b){_0x2a829b=_0x2a829b||0xc8;return function(_0x1d931a){if(_0x1d931a){return _0x400078[_0x11e9('0x1a')](_0x2a829b)[_0x11e9('0x1c')](_0x1d931a);}};}function respondWithFilteredResult(_0x11fec0,_0x5e9757){return function(_0x38f5d1){if(_0x38f5d1){var _0x5a8cbd=typeof _0x5e9757[_0x11e9('0x1d')]==='undefined'&&typeof _0x5e9757['limit']===_0x11e9('0x1e');var _0x2c01db=_0x38f5d1['count'];var _0x412e68=_0x5a8cbd?0x0:_0x5e9757[_0x11e9('0x1d')];var _0x3d92df=_0x5a8cbd?_0x38f5d1['count']:_0x5e9757[_0x11e9('0x1d')]+_0x5e9757[_0x11e9('0x1f')];var _0xe89191;if(_0x3d92df>=_0x2c01db){_0x3d92df=_0x2c01db;_0xe89191=0xc8;}else{_0xe89191=0xce;}_0x11fec0['status'](_0xe89191);return _0x11fec0[_0x11e9('0x20')](_0x11e9('0x21'),_0x412e68+'-'+_0x3d92df+'/'+_0x2c01db)[_0x11e9('0x1c')](_0x38f5d1);}return null;};}function patchUpdates(_0xdcf407){return function(_0x572e9f){try{jsonpatch['apply'](_0x572e9f,_0xdcf407,!![]);}catch(_0x483f8e){return BPromise['reject'](_0x483f8e);}return _0x572e9f['save']();};}function saveUpdates(_0x112479,_0x1ea50f){return function(_0x141322){if(_0x141322){return _0x141322[_0x11e9('0x22')](_0x112479)[_0x11e9('0x23')](function(_0x4e3a71){return _0x4e3a71;});}return null;};}function removeEntity(_0x4f5ae1,_0x2cd44b){return function(_0xf13fa7){if(_0xf13fa7){return _0xf13fa7[_0x11e9('0x24')]()[_0x11e9('0x23')](function(){_0x4f5ae1[_0x11e9('0x1a')](0xcc)[_0x11e9('0x1b')]();});}};}function handleEntityNotFound(_0x167e02,_0x15d1ed){return function(_0xf75817){if(!_0xf75817){_0x167e02[_0x11e9('0x19')](0x194);}return _0xf75817;};}function handleError(_0x410c27,_0x532b08){_0x532b08=_0x532b08||0x1f4;return function(_0x2bc9c9){logger[_0x11e9('0x25')](_0x2bc9c9[_0x11e9('0x26')]);if(_0x2bc9c9[_0x11e9('0x27')]){delete _0x2bc9c9[_0x11e9('0x27')];}_0x410c27[_0x11e9('0x1a')](_0x532b08)[_0x11e9('0x28')](_0x2bc9c9);};}exports[_0x11e9('0x29')]=function(_0x3ffa2d,_0x462366){var _0x3e8c02={},_0x586422={},_0xf293cc={'count':0x0,'rows':[]};var _0x2f02bb=_[_0x11e9('0x2a')](db[_0x11e9('0x2b')]['rawAttributes'],function(_0x245bb7){return{'name':_0x245bb7[_0x11e9('0x2c')],'type':_0x245bb7[_0x11e9('0x2d')]['key']};});_0x586422[_0x11e9('0x2e')]=_['map'](_0x2f02bb,_0x11e9('0x27'));_0x586422[_0x11e9('0x2f')]=_[_0x11e9('0x30')](_0x3ffa2d[_0x11e9('0x2f')]);_0x586422[_0x11e9('0x31')]=_[_0x11e9('0x32')](_0x586422[_0x11e9('0x2e')],_0x586422[_0x11e9('0x2f')]);_0x3e8c02[_0x11e9('0x33')]=_[_0x11e9('0x32')](_0x586422[_0x11e9('0x2e')],qs['fields'](_0x3ffa2d[_0x11e9('0x2f')][_0x11e9('0x34')]));_0x3e8c02[_0x11e9('0x33')]=_0x3e8c02[_0x11e9('0x33')]['length']?_0x3e8c02[_0x11e9('0x33')]:_0x586422[_0x11e9('0x2e')];if(!_0x3ffa2d['query'][_0x11e9('0x35')](_0x11e9('0x36'))){_0x3e8c02[_0x11e9('0x1f')]=qs[_0x11e9('0x1f')](_0x3ffa2d[_0x11e9('0x2f')][_0x11e9('0x1f')]);_0x3e8c02[_0x11e9('0x1d')]=qs['offset'](_0x3ffa2d[_0x11e9('0x2f')]['offset']);}_0x3e8c02[_0x11e9('0x37')]=qs[_0x11e9('0x38')](_0x3ffa2d[_0x11e9('0x2f')][_0x11e9('0x38')]);_0x3e8c02[_0x11e9('0x39')]=qs[_0x11e9('0x31')](_[_0x11e9('0x3a')](_0x3ffa2d[_0x11e9('0x2f')],_0x586422[_0x11e9('0x31')]),_0x2f02bb);if(_0x3ffa2d[_0x11e9('0x2f')]['filter']){_0x3e8c02[_0x11e9('0x39')]=_[_0x11e9('0x3b')](_0x3e8c02['where'],{'$or':_[_0x11e9('0x2a')](_0x2f02bb,function(_0x4dfa5e){if(_0x4dfa5e[_0x11e9('0x2d')]!=='VIRTUAL'){var _0x5321bd={};_0x5321bd[_0x4dfa5e[_0x11e9('0x27')]]={'$like':'%'+_0x3ffa2d['query'][_0x11e9('0x3c')]+'%'};return _0x5321bd;}})});}_0x3e8c02=_[_0x11e9('0x3b')]({},_0x3e8c02,_0x3ffa2d[_0x11e9('0x3d')]);var _0x916d52={'where':_0x3e8c02[_0x11e9('0x39')]};return db[_0x11e9('0x2b')][_0x11e9('0x3e')](_0x916d52)[_0x11e9('0x23')](function(_0x17bc75){_0xf293cc['count']=_0x17bc75;if(_0x3ffa2d[_0x11e9('0x2f')][_0x11e9('0x3f')]){_0x3e8c02[_0x11e9('0x40')]=[{'all':!![]}];}return db[_0x11e9('0x2b')][_0x11e9('0x41')](_0x3e8c02);})[_0x11e9('0x23')](function(_0x54af87){_0xf293cc[_0x11e9('0x42')]=_0x54af87;return _0xf293cc;})['then'](respondWithFilteredResult(_0x462366,_0x3e8c02))[_0x11e9('0x43')](handleError(_0x462366,null));};exports[_0x11e9('0x44')]=function(_0x368956,_0x3be318){var _0x3dc712={'raw':!![],'where':{'id':_0x368956[_0x11e9('0x45')]['id']}},_0x51a9a9={};_0x51a9a9['model']=_['keys'](db[_0x11e9('0x2b')]['rawAttributes']);_0x51a9a9[_0x11e9('0x2f')]=_['keys'](_0x368956['query']);_0x51a9a9[_0x11e9('0x31')]=_['intersection'](_0x51a9a9[_0x11e9('0x2e')],_0x51a9a9[_0x11e9('0x2f')]);_0x3dc712[_0x11e9('0x33')]=_[_0x11e9('0x32')](_0x51a9a9[_0x11e9('0x2e')],qs[_0x11e9('0x34')](_0x368956[_0x11e9('0x2f')]['fields']));_0x3dc712['attributes']=_0x3dc712[_0x11e9('0x33')][_0x11e9('0x46')]?_0x3dc712[_0x11e9('0x33')]:_0x51a9a9['model'];if(_0x368956[_0x11e9('0x2f')]['includeAll']){_0x3dc712[_0x11e9('0x40')]=[{'all':!![]}];}_0x3dc712=_[_0x11e9('0x3b')]({},_0x3dc712,_0x368956['options']);return db[_0x11e9('0x2b')][_0x11e9('0x47')](_0x3dc712)[_0x11e9('0x23')](handleEntityNotFound(_0x3be318,null))[_0x11e9('0x23')](respondWithResult(_0x3be318,null))[_0x11e9('0x43')](handleError(_0x3be318,null));};exports[_0x11e9('0x48')]=function(_0x1144ea,_0x55e0b8){return db[_0x11e9('0x2b')]['create'](_0x1144ea['body'],{})['then'](respondWithResult(_0x55e0b8,0xc9))[_0x11e9('0x43')](handleError(_0x55e0b8,null));};exports['update']=function(_0x35e3aa,_0x2c1e89){if(_0x35e3aa[_0x11e9('0x49')]['id']){delete _0x35e3aa[_0x11e9('0x49')]['id'];}return db[_0x11e9('0x2b')][_0x11e9('0x47')]({'where':{'id':_0x35e3aa[_0x11e9('0x45')]['id']}})[_0x11e9('0x23')](handleEntityNotFound(_0x2c1e89,null))[_0x11e9('0x23')](saveUpdates(_0x35e3aa['body'],null))[_0x11e9('0x23')](respondWithResult(_0x2c1e89,null))[_0x11e9('0x43')](handleError(_0x2c1e89,null));};exports[_0x11e9('0x24')]=function(_0x20c3ac,_0x33b7be){return db['JscriptySessionReport'][_0x11e9('0x47')]({'where':{'id':_0x20c3ac[_0x11e9('0x45')]['id']}})[_0x11e9('0x23')](handleEntityNotFound(_0x33b7be,null))[_0x11e9('0x23')](removeEntity(_0x33b7be,null))[_0x11e9('0x43')](handleError(_0x33b7be,null));};exports[_0x11e9('0x4a')]=function(_0x1feb6e,_0x16e6e2){return db[_0x11e9('0x2b')][_0x11e9('0x4a')]()[_0x11e9('0x23')](respondWithResult(_0x16e6e2,null))['catch'](handleError(_0x16e6e2,null));};exports[_0x11e9('0x4b')]=function(_0xf1461a,_0x434155,_0x44392f){var _0xbec6c2={'raw':!![],'where':{}};var _0x2ae6e4={};var _0x5cc014={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x11e9('0x4c')]({'where':{'id':_0xf1461a[_0x11e9('0x45')]['id']}})[_0x11e9('0x23')](handleEntityNotFound(_0x434155,null))[_0x11e9('0x23')](function(_0x533daa){if(_0x533daa){_0x2ae6e4[_0x11e9('0x2e')]=_['keys'](db[_0x11e9('0x4d')][_0x11e9('0x4e')]);_0x2ae6e4[_0x11e9('0x2f')]=_[_0x11e9('0x30')](_0xf1461a[_0x11e9('0x2f')]);_0x2ae6e4[_0x11e9('0x31')]=_['intersection'](_0x2ae6e4[_0x11e9('0x2e')],_0x2ae6e4[_0x11e9('0x2f')]);_0xbec6c2[_0x11e9('0x33')]=_[_0x11e9('0x32')](_0x2ae6e4[_0x11e9('0x2e')],qs[_0x11e9('0x34')](_0xf1461a['query'][_0x11e9('0x34')]));_0xbec6c2[_0x11e9('0x33')]=_0xbec6c2['attributes']['length']?_0xbec6c2['attributes']:_0x2ae6e4[_0x11e9('0x2e')];if(!_0xf1461a[_0x11e9('0x2f')]['hasOwnProperty'](_0x11e9('0x36'))){_0xbec6c2[_0x11e9('0x1f')]=qs[_0x11e9('0x1f')](_0xf1461a[_0x11e9('0x2f')][_0x11e9('0x1f')]);_0xbec6c2[_0x11e9('0x1d')]=qs[_0x11e9('0x1d')](_0xf1461a[_0x11e9('0x2f')][_0x11e9('0x1d')]);}_0xbec6c2[_0x11e9('0x37')]=qs[_0x11e9('0x38')](_0xf1461a[_0x11e9('0x2f')][_0x11e9('0x38')]);_0xbec6c2[_0x11e9('0x39')]=qs['filters'](_['pick'](_0xf1461a[_0x11e9('0x2f')],_0x2ae6e4[_0x11e9('0x31')]));_0xbec6c2['where'][_0x11e9('0x4f')]=_0x533daa['id'];if(_0xf1461a['query'][_0x11e9('0x3c')]){_0xbec6c2[_0x11e9('0x39')]=_['merge'](_0xbec6c2[_0x11e9('0x39')],{'$or':_[_0x11e9('0x2a')](_0xbec6c2['attributes'],function(_0x3c480a){var _0x58f4a5={};_0x58f4a5[_0x3c480a]={'$like':'%'+_0xf1461a[_0x11e9('0x2f')]['filter']+'%'};return _0x58f4a5;})});}_0xbec6c2=_[_0x11e9('0x3b')]({},_0xbec6c2,_0xf1461a[_0x11e9('0x3d')]);return db[_0x11e9('0x4d')][_0x11e9('0x3e')]({'where':_0xbec6c2['where']})[_0x11e9('0x23')](function(_0x579776){_0x5cc014[_0x11e9('0x3e')]=_0x579776;if(_0xf1461a['query'][_0x11e9('0x3f')]){_0xbec6c2[_0x11e9('0x40')]=[{'all':!![]}];}return db[_0x11e9('0x4d')][_0x11e9('0x41')](_0xbec6c2);})['then'](function(_0x4d5297){_0x5cc014['rows']=_0x4d5297;return _0x5cc014;});}})[_0x11e9('0x23')](respondWithFilteredResult(_0x434155,_0xbec6c2))[_0x11e9('0x43')](handleError(_0x434155,null));}; \ No newline at end of file +var _0xf178=['map','JscriptySessionReport','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','catch','show','params','rawAttributes','include','find','create','body','update','describe','findOne','JscriptyQuestionReport','nolimit','SessionId','includeAll','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index'];(function(_0x427c54,_0x42c11e){var _0x2b8846=function(_0x1c7942){while(--_0x1c7942){_0x427c54['push'](_0x427c54['shift']());}};_0x2b8846(++_0x42c11e);}(_0xf178,0xcb));var _0x8f17=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0xf178[_0x54f3e8];return _0x267b37;};'use strict';var emlformat=require(_0x8f17('0x0'));var rimraf=require(_0x8f17('0x1'));var zipdir=require(_0x8f17('0x2'));var jsonpatch=require(_0x8f17('0x3'));var rp=require(_0x8f17('0x4'));var moment=require(_0x8f17('0x5'));var BPromise=require(_0x8f17('0x6'));var Mustache=require(_0x8f17('0x7'));var util=require(_0x8f17('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8f17('0x9'));var ejs=require(_0x8f17('0xa'));var fs=require('fs');var fs_extra=require(_0x8f17('0xb'));var _=require('lodash');var squel=require(_0x8f17('0xc'));var crypto=require(_0x8f17('0xd'));var jsforce=require(_0x8f17('0xe'));var deskjs=require(_0x8f17('0xf'));var toCsv=require(_0x8f17('0x9'));var querystring=require('querystring');var Papa=require(_0x8f17('0x10'));var Redis=require(_0x8f17('0x11'));var authService=require(_0x8f17('0x12'));var qs=require(_0x8f17('0x13'));var as=require(_0x8f17('0x14'));var hardwareService=require(_0x8f17('0x15'));var logger=require(_0x8f17('0x16'))(_0x8f17('0x17'));var utils=require(_0x8f17('0x18'));var config=require(_0x8f17('0x19'));var licenseUtil=require(_0x8f17('0x1a'));var db=require(_0x8f17('0x1b'))['db'];function respondWithStatusCode(_0x5458d5,_0x1f93fb){_0x1f93fb=_0x1f93fb||0xcc;return function(_0x840445){if(_0x840445){return _0x5458d5[_0x8f17('0x1c')](_0x1f93fb);}return _0x5458d5[_0x8f17('0x1d')](_0x1f93fb)['end']();};}function respondWithResult(_0x5cdab0,_0x4b4bff){_0x4b4bff=_0x4b4bff||0xc8;return function(_0xc1e16c){if(_0xc1e16c){return _0x5cdab0[_0x8f17('0x1d')](_0x4b4bff)[_0x8f17('0x1e')](_0xc1e16c);}};}function respondWithFilteredResult(_0x5a0140,_0xfd7535){return function(_0x2e20ad){if(_0x2e20ad){var _0x2ef106=typeof _0xfd7535[_0x8f17('0x1f')]===_0x8f17('0x20')&&typeof _0xfd7535[_0x8f17('0x21')]===_0x8f17('0x20');var _0x3e26c1=_0x2e20ad[_0x8f17('0x22')];var _0x5b771c=_0x2ef106?0x0:_0xfd7535[_0x8f17('0x1f')];var _0x11fec1=_0x2ef106?_0x2e20ad[_0x8f17('0x22')]:_0xfd7535[_0x8f17('0x1f')]+_0xfd7535['limit'];var _0x416b5e;if(_0x11fec1>=_0x3e26c1){_0x11fec1=_0x3e26c1;_0x416b5e=0xc8;}else{_0x416b5e=0xce;}_0x5a0140[_0x8f17('0x1d')](_0x416b5e);return _0x5a0140[_0x8f17('0x23')](_0x8f17('0x24'),_0x5b771c+'-'+_0x11fec1+'/'+_0x3e26c1)[_0x8f17('0x1e')](_0x2e20ad);}return null;};}function patchUpdates(_0x16d646){return function(_0x4a6082){try{jsonpatch[_0x8f17('0x25')](_0x4a6082,_0x16d646,!![]);}catch(_0x4df3e7){return BPromise[_0x8f17('0x26')](_0x4df3e7);}return _0x4a6082[_0x8f17('0x27')]();};}function saveUpdates(_0x3d87de,_0x182b8e){return function(_0xc78363){if(_0xc78363){return _0xc78363['update'](_0x3d87de)[_0x8f17('0x28')](function(_0x561803){return _0x561803;});}return null;};}function removeEntity(_0x2a9557,_0x4a470e){return function(_0x12889d){if(_0x12889d){return _0x12889d[_0x8f17('0x29')]()[_0x8f17('0x28')](function(){_0x2a9557[_0x8f17('0x1d')](0xcc)[_0x8f17('0x2a')]();});}};}function handleEntityNotFound(_0x314e00,_0x45c80d){return function(_0xff67f0){if(!_0xff67f0){_0x314e00[_0x8f17('0x1c')](0x194);}return _0xff67f0;};}function handleError(_0x3a532f,_0x41a92a){_0x41a92a=_0x41a92a||0x1f4;return function(_0x9cc085){logger['error'](_0x9cc085['stack']);if(_0x9cc085['name']){delete _0x9cc085[_0x8f17('0x2b')];}_0x3a532f[_0x8f17('0x1d')](_0x41a92a)[_0x8f17('0x2c')](_0x9cc085);};}exports[_0x8f17('0x2d')]=function(_0x559050,_0x44e396){var _0x1ab28f={},_0x2c96c7={},_0x2b6fd0={'count':0x0,'rows':[]};var _0x33561c=_[_0x8f17('0x2e')](db[_0x8f17('0x2f')]['rawAttributes'],function(_0x2bf256){return{'name':_0x2bf256[_0x8f17('0x30')],'type':_0x2bf256[_0x8f17('0x31')]['key']};});_0x2c96c7[_0x8f17('0x32')]=_[_0x8f17('0x2e')](_0x33561c,_0x8f17('0x2b'));_0x2c96c7[_0x8f17('0x33')]=_[_0x8f17('0x34')](_0x559050['query']);_0x2c96c7['filters']=_['intersection'](_0x2c96c7['model'],_0x2c96c7['query']);_0x1ab28f[_0x8f17('0x35')]=_[_0x8f17('0x36')](_0x2c96c7['model'],qs[_0x8f17('0x37')](_0x559050[_0x8f17('0x33')]['fields']));_0x1ab28f['attributes']=_0x1ab28f[_0x8f17('0x35')][_0x8f17('0x38')]?_0x1ab28f['attributes']:_0x2c96c7[_0x8f17('0x32')];if(!_0x559050[_0x8f17('0x33')][_0x8f17('0x39')]('nolimit')){_0x1ab28f[_0x8f17('0x21')]=qs[_0x8f17('0x21')](_0x559050[_0x8f17('0x33')][_0x8f17('0x21')]);_0x1ab28f['offset']=qs[_0x8f17('0x1f')](_0x559050[_0x8f17('0x33')][_0x8f17('0x1f')]);}_0x1ab28f[_0x8f17('0x3a')]=qs[_0x8f17('0x3b')](_0x559050[_0x8f17('0x33')][_0x8f17('0x3b')]);_0x1ab28f[_0x8f17('0x3c')]=qs[_0x8f17('0x3d')](_['pick'](_0x559050['query'],_0x2c96c7['filters']),_0x33561c);if(_0x559050[_0x8f17('0x33')][_0x8f17('0x3e')]){_0x1ab28f[_0x8f17('0x3c')]=_[_0x8f17('0x3f')](_0x1ab28f[_0x8f17('0x3c')],{'$or':_[_0x8f17('0x2e')](_0x33561c,function(_0x504027){if(_0x504027[_0x8f17('0x31')]!==_0x8f17('0x40')){var _0x4de71c={};_0x4de71c[_0x504027[_0x8f17('0x2b')]]={'$like':'%'+_0x559050[_0x8f17('0x33')][_0x8f17('0x3e')]+'%'};return _0x4de71c;}})});}_0x1ab28f=_[_0x8f17('0x3f')]({},_0x1ab28f,_0x559050[_0x8f17('0x41')]);var _0x4b8ae3={'where':_0x1ab28f[_0x8f17('0x3c')]};return db[_0x8f17('0x2f')]['count'](_0x4b8ae3)[_0x8f17('0x28')](function(_0x2ca819){_0x2b6fd0[_0x8f17('0x22')]=_0x2ca819;if(_0x559050[_0x8f17('0x33')]['includeAll']){_0x1ab28f['include']=[{'all':!![]}];}return db[_0x8f17('0x2f')]['findAll'](_0x1ab28f);})[_0x8f17('0x28')](function(_0x49afca){_0x2b6fd0['rows']=_0x49afca;return _0x2b6fd0;})[_0x8f17('0x28')](respondWithFilteredResult(_0x44e396,_0x1ab28f))[_0x8f17('0x42')](handleError(_0x44e396,null));};exports[_0x8f17('0x43')]=function(_0x41bb17,_0x57966e){var _0x4368d5={'raw':!![],'where':{'id':_0x41bb17[_0x8f17('0x44')]['id']}},_0x29a0bf={};_0x29a0bf['model']=_[_0x8f17('0x34')](db[_0x8f17('0x2f')][_0x8f17('0x45')]);_0x29a0bf[_0x8f17('0x33')]=_[_0x8f17('0x34')](_0x41bb17[_0x8f17('0x33')]);_0x29a0bf[_0x8f17('0x3d')]=_[_0x8f17('0x36')](_0x29a0bf[_0x8f17('0x32')],_0x29a0bf[_0x8f17('0x33')]);_0x4368d5[_0x8f17('0x35')]=_[_0x8f17('0x36')](_0x29a0bf[_0x8f17('0x32')],qs[_0x8f17('0x37')](_0x41bb17['query'][_0x8f17('0x37')]));_0x4368d5[_0x8f17('0x35')]=_0x4368d5[_0x8f17('0x35')][_0x8f17('0x38')]?_0x4368d5[_0x8f17('0x35')]:_0x29a0bf[_0x8f17('0x32')];if(_0x41bb17['query']['includeAll']){_0x4368d5[_0x8f17('0x46')]=[{'all':!![]}];}_0x4368d5=_[_0x8f17('0x3f')]({},_0x4368d5,_0x41bb17[_0x8f17('0x41')]);return db['JscriptySessionReport'][_0x8f17('0x47')](_0x4368d5)['then'](handleEntityNotFound(_0x57966e,null))[_0x8f17('0x28')](respondWithResult(_0x57966e,null))[_0x8f17('0x42')](handleError(_0x57966e,null));};exports[_0x8f17('0x48')]=function(_0x39e95d,_0x5e3d11){return db[_0x8f17('0x2f')][_0x8f17('0x48')](_0x39e95d[_0x8f17('0x49')],{})['then'](respondWithResult(_0x5e3d11,0xc9))['catch'](handleError(_0x5e3d11,null));};exports[_0x8f17('0x4a')]=function(_0xc29657,_0x335f21){if(_0xc29657[_0x8f17('0x49')]['id']){delete _0xc29657[_0x8f17('0x49')]['id'];}return db['JscriptySessionReport'][_0x8f17('0x47')]({'where':{'id':_0xc29657['params']['id']}})['then'](handleEntityNotFound(_0x335f21,null))['then'](saveUpdates(_0xc29657[_0x8f17('0x49')],null))[_0x8f17('0x28')](respondWithResult(_0x335f21,null))['catch'](handleError(_0x335f21,null));};exports[_0x8f17('0x29')]=function(_0xaa617c,_0x42adbb){return db[_0x8f17('0x2f')][_0x8f17('0x47')]({'where':{'id':_0xaa617c[_0x8f17('0x44')]['id']}})[_0x8f17('0x28')](handleEntityNotFound(_0x42adbb,null))['then'](removeEntity(_0x42adbb,null))['catch'](handleError(_0x42adbb,null));};exports[_0x8f17('0x4b')]=function(_0x2a472e,_0x1a882e){return db['JscriptySessionReport'][_0x8f17('0x4b')]()[_0x8f17('0x28')](respondWithResult(_0x1a882e,null))['catch'](handleError(_0x1a882e,null));};exports['getQuestions']=function(_0x5a1792,_0xf9f4e2,_0x142d1e){var _0x4cc2ec={'raw':!![],'where':{}};var _0xcc41ae={};var _0x5cc416={'count':0x0,'rows':[]};return db[_0x8f17('0x2f')][_0x8f17('0x4c')]({'where':{'id':_0x5a1792[_0x8f17('0x44')]['id']}})[_0x8f17('0x28')](handleEntityNotFound(_0xf9f4e2,null))[_0x8f17('0x28')](function(_0x5661c0){if(_0x5661c0){_0xcc41ae[_0x8f17('0x32')]=_[_0x8f17('0x34')](db[_0x8f17('0x4d')][_0x8f17('0x45')]);_0xcc41ae[_0x8f17('0x33')]=_[_0x8f17('0x34')](_0x5a1792[_0x8f17('0x33')]);_0xcc41ae['filters']=_['intersection'](_0xcc41ae[_0x8f17('0x32')],_0xcc41ae['query']);_0x4cc2ec['attributes']=_[_0x8f17('0x36')](_0xcc41ae[_0x8f17('0x32')],qs[_0x8f17('0x37')](_0x5a1792['query'][_0x8f17('0x37')]));_0x4cc2ec['attributes']=_0x4cc2ec[_0x8f17('0x35')][_0x8f17('0x38')]?_0x4cc2ec[_0x8f17('0x35')]:_0xcc41ae[_0x8f17('0x32')];if(!_0x5a1792[_0x8f17('0x33')][_0x8f17('0x39')](_0x8f17('0x4e'))){_0x4cc2ec[_0x8f17('0x21')]=qs['limit'](_0x5a1792[_0x8f17('0x33')][_0x8f17('0x21')]);_0x4cc2ec['offset']=qs[_0x8f17('0x1f')](_0x5a1792[_0x8f17('0x33')]['offset']);}_0x4cc2ec[_0x8f17('0x3a')]=qs[_0x8f17('0x3b')](_0x5a1792[_0x8f17('0x33')][_0x8f17('0x3b')]);_0x4cc2ec[_0x8f17('0x3c')]=qs[_0x8f17('0x3d')](_['pick'](_0x5a1792[_0x8f17('0x33')],_0xcc41ae[_0x8f17('0x3d')]));_0x4cc2ec[_0x8f17('0x3c')][_0x8f17('0x4f')]=_0x5661c0['id'];if(_0x5a1792[_0x8f17('0x33')]['filter']){_0x4cc2ec[_0x8f17('0x3c')]=_[_0x8f17('0x3f')](_0x4cc2ec[_0x8f17('0x3c')],{'$or':_[_0x8f17('0x2e')](_0x4cc2ec[_0x8f17('0x35')],function(_0x3cf3af){var _0x11805c={};_0x11805c[_0x3cf3af]={'$like':'%'+_0x5a1792[_0x8f17('0x33')][_0x8f17('0x3e')]+'%'};return _0x11805c;})});}_0x4cc2ec=_[_0x8f17('0x3f')]({},_0x4cc2ec,_0x5a1792['options']);return db['JscriptyQuestionReport'][_0x8f17('0x22')]({'where':_0x4cc2ec[_0x8f17('0x3c')]})[_0x8f17('0x28')](function(_0x484a19){_0x5cc416[_0x8f17('0x22')]=_0x484a19;if(_0x5a1792[_0x8f17('0x33')][_0x8f17('0x50')]){_0x4cc2ec[_0x8f17('0x46')]=[{'all':!![]}];}return db[_0x8f17('0x4d')][_0x8f17('0x51')](_0x4cc2ec);})[_0x8f17('0x28')](function(_0xd8c94a){_0x5cc416[_0x8f17('0x52')]=_0xd8c94a;return _0x5cc416;});}})['then'](respondWithFilteredResult(_0xf9f4e2,_0x4cc2ec))[_0x8f17('0x42')](handleError(_0xf9f4e2,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 155ddaa..33a906b 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0x233c38,_0x51ad0f){var _0x52e16f=function(_0x404370){while(--_0x404370){_0x233c38['push'](_0x233c38['shift']());}};_0x52e16f(++_0x51ad0f);}(_0xabce,0x103));var _0xeabc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xabce[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x5cdb4e,_0x4233b2){var _0x30a04d=function(_0x1b5c6a){while(--_0x1b5c6a){_0x5cdb4e['push'](_0x5cdb4e['shift']());}};_0x30a04d(++_0x4233b2);}(_0x323f,0x1ee));var _0xf323=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x323f[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'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 a0d4293..b3420df 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 _0x781d=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x425344,_0x2ddadc){var _0x5ef751=function(_0x3fb583){while(--_0x3fb583){_0x425344['push'](_0x425344['shift']());}};_0x5ef751(++_0x2ddadc);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file +var _0x4745=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x16ec7f,_0x55d7fe){var _0x41dde3=function(_0x474dab){while(--_0x474dab){_0x16ec7f['push'](_0x16ec7f['shift']());}};_0x41dde3(++_0x55d7fe);}(_0x4745,0x1e7));var _0x5474=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x4745[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2b40e5f..04c7e6a 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 _0xcfcc=['../../components/auth/service','../../config/environment','./license.controller','get','index','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x8cdb08,_0x59062f){var _0xd348c3=function(_0x585252){while(--_0x585252){_0x8cdb08['push'](_0x8cdb08['shift']());}};_0xd348c3(++_0x59062f);}(_0xcfcc,0x1cd));var _0xccfc=function(_0x335397,_0x1286b8){_0x335397=_0x335397-0x0;var _0x27c688=_0xcfcc[_0x335397];return _0x27c688;};'use strict';var multer=require(_0xccfc('0x0'));var util=require(_0xccfc('0x1'));var path=require(_0xccfc('0x2'));var timeout=require(_0xccfc('0x3'));var express=require(_0xccfc('0x4'));var router=express[_0xccfc('0x5')]();var fs_extra=require(_0xccfc('0x6'));var auth=require(_0xccfc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xccfc('0x8'));var controller=require(_0xccfc('0x9'));router[_0xccfc('0xa')]('/',controller[_0xccfc('0xb')]);router['put'](_0xccfc('0xc'),auth['isAuthenticated'](),controller[_0xccfc('0xd')]);router[_0xccfc('0xa')](_0xccfc('0xe'),auth[_0xccfc('0xf')](),controller[_0xccfc('0x10')]);module[_0xccfc('0x11')]=router; \ No newline at end of file +var _0x51b5=['isAuthenticated','get','downloadLogFile','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','put','/:id'];(function(_0xeb7c4b,_0x278027){var _0x110149=function(_0x399cb3){while(--_0x399cb3){_0xeb7c4b['push'](_0xeb7c4b['shift']());}};_0x110149(++_0x278027);}(_0x51b5,0x115));var _0x551b=function(_0x54e1b4,_0xe01f37){_0x54e1b4=_0x54e1b4-0x0;var _0x3f55cd=_0x51b5[_0x54e1b4];return _0x3f55cd;};'use strict';var multer=require(_0x551b('0x0'));var util=require(_0x551b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x551b('0x2'));var router=express['Router']();var fs_extra=require(_0x551b('0x3'));var auth=require(_0x551b('0x4'));var interaction=require(_0x551b('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x551b('0x6')]);router[_0x551b('0x7')](_0x551b('0x8'),auth[_0x551b('0x9')](),controller['update']);router[_0x551b('0xa')]('/download_log_file',auth[_0x551b('0x9')](),controller[_0x551b('0xb')]);module[_0x551b('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 682ac0a..0793c8b 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 _0x7cff=['TEXT','STRING','INTEGER','exports'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x7cff,0x6f));var _0xf7cf=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x7cff[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0xf7cf('0x0')]={'license':{'type':Sequelize[_0xf7cf('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xf7cf('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf7cf('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeff7=['sequelize','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeff7,0xd2));var _0x7eff=function(_0x988781,_0x26c696){_0x988781=_0x988781-0x0;var _0x1d33a7=_0xeff7[_0x988781];return _0x1d33a7;};'use strict';var Sequelize=require(_0x7eff('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x7eff('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7eff('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 76a09f1..4c9685e 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 _0x564a=['model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','key','license-info.log','join','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','name','index'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x564a,0x1b0));var _0xa564=function(_0x181631,_0x26f8e0){_0x181631=_0x181631-0x0;var _0x4f2077=_0x564a[_0x181631];return _0x4f2077;};'use strict';var emlformat=require(_0xa564('0x0'));var rimraf=require(_0xa564('0x1'));var zipdir=require(_0xa564('0x2'));var jsonpatch=require(_0xa564('0x3'));var rp=require('request-promise');var moment=require(_0xa564('0x4'));var BPromise=require(_0xa564('0x5'));var Mustache=require('mustache');var util=require(_0xa564('0x6'));var path=require(_0xa564('0x7'));var sox=require(_0xa564('0x8'));var csv=require(_0xa564('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa564('0xa'));var _=require('lodash');var squel=require(_0xa564('0xb'));var crypto=require(_0xa564('0xc'));var jsforce=require(_0xa564('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa564('0x9'));var querystring=require('querystring');var Papa=require(_0xa564('0xe'));var Redis=require(_0xa564('0xf'));var authService=require(_0xa564('0x10'));var qs=require(_0xa564('0x11'));var as=require(_0xa564('0x12'));var hardwareService=require(_0xa564('0x13'));var logger=require(_0xa564('0x14'))(_0xa564('0x15'));var utils=require(_0xa564('0x16'));var config=require(_0xa564('0x17'));var licenseUtil=require(_0xa564('0x18'));var db=require(_0xa564('0x19'))['db'];function respondWithStatusCode(_0x457942,_0x484bb9){_0x484bb9=_0x484bb9||0xcc;return function(_0x25d687){if(_0x25d687){return _0x457942[_0xa564('0x1a')](_0x484bb9);}return _0x457942[_0xa564('0x1b')](_0x484bb9)[_0xa564('0x1c')]();};}function respondWithResult(_0x4bc76e,_0x4eb579){_0x4eb579=_0x4eb579||0xc8;return function(_0x53a718){if(_0x53a718){return _0x4bc76e['status'](_0x4eb579)[_0xa564('0x1d')](_0x53a718);}};}function respondWithFilteredResult(_0x150e12,_0x10c68c){return function(_0x3487fa){if(_0x3487fa){var _0x294698=typeof _0x10c68c[_0xa564('0x1e')]===_0xa564('0x1f')&&typeof _0x10c68c['limit']==='undefined';var _0x451645=_0x3487fa['count'];var _0x574f6=_0x294698?0x0:_0x10c68c['offset'];var _0x1dfac4=_0x294698?_0x3487fa[_0xa564('0x20')]:_0x10c68c[_0xa564('0x1e')]+_0x10c68c[_0xa564('0x21')];var _0x41e716;if(_0x1dfac4>=_0x451645){_0x1dfac4=_0x451645;_0x41e716=0xc8;}else{_0x41e716=0xce;}_0x150e12['status'](_0x41e716);return _0x150e12[_0xa564('0x22')]('Content-Range',_0x574f6+'-'+_0x1dfac4+'/'+_0x451645)[_0xa564('0x1d')](_0x3487fa);}return null;};}function patchUpdates(_0x2bb245){return function(_0x3c4943){try{jsonpatch[_0xa564('0x23')](_0x3c4943,_0x2bb245,!![]);}catch(_0x132822){return BPromise[_0xa564('0x24')](_0x132822);}return _0x3c4943[_0xa564('0x25')]();};}function saveUpdates(_0x306976,_0x38743a){return function(_0x16e253){if(_0x16e253){return _0x16e253[_0xa564('0x26')](_0x306976)[_0xa564('0x27')](function(_0x13a8da){return _0x13a8da;});}return null;};}function removeEntity(_0x4dc1ab,_0xa98af1){return function(_0x1b2d62){if(_0x1b2d62){return _0x1b2d62[_0xa564('0x28')]()['then'](function(){_0x4dc1ab[_0xa564('0x1b')](0xcc)[_0xa564('0x1c')]();});}};}function handleEntityNotFound(_0x23fd63,_0x24f93d){return function(_0x2b8ad0){if(!_0x2b8ad0){_0x23fd63[_0xa564('0x1a')](0x194);}return _0x2b8ad0;};}function handleError(_0x3e3f07,_0x1ef1fa){_0x1ef1fa=_0x1ef1fa||0x1f4;return function(_0x35a4a1){logger[_0xa564('0x29')](_0x35a4a1['stack']);if(_0x35a4a1[_0xa564('0x2a')]){delete _0x35a4a1[_0xa564('0x2a')];}_0x3e3f07['status'](_0x1ef1fa)['send'](_0x35a4a1);};}var utilLicense=require(_0xa564('0x18'));exports[_0xa564('0x2b')]=function(_0x59785d,_0x1f24ad){var _0xd4c934={'raw':!![],'where':{'id':0x1}},_0x316ec0={};_0x316ec0[_0xa564('0x2c')]=_[_0xa564('0x2d')](db[_0xa564('0x2e')][_0xa564('0x2f')]);_0x316ec0['query']=_[_0xa564('0x2d')](_0x59785d[_0xa564('0x30')]);_0x316ec0['filters']=_[_0xa564('0x31')](_0x316ec0['model'],_0x316ec0[_0xa564('0x30')]);_0xd4c934[_0xa564('0x32')]=_[_0xa564('0x31')](_0x316ec0[_0xa564('0x2c')],qs['fields'](_0x59785d[_0xa564('0x30')][_0xa564('0x33')]));_0xd4c934[_0xa564('0x32')]=_0xd4c934[_0xa564('0x32')][_0xa564('0x34')]?_0xd4c934[_0xa564('0x32')]:_0x316ec0[_0xa564('0x2c')];_0xd4c934=_[_0xa564('0x35')]({},_0xd4c934,_0x59785d[_0xa564('0x36')]);return utilLicense[_0xa564('0x37')](_0xd4c934)['then'](respondWithResult(_0x1f24ad,null))[_0xa564('0x38')](handleError(_0x1f24ad,null));};exports[_0xa564('0x26')]=function(_0x595cdf,_0xc74518){if(_0x595cdf[_0xa564('0x39')]['id']){delete _0x595cdf['body']['id'];}return db[_0xa564('0x2e')][_0xa564('0x3a')]({'where':{'id':_0x595cdf[_0xa564('0x3b')]['id']}})[_0xa564('0x27')](handleEntityNotFound(_0xc74518,null))[_0xa564('0x27')](function(_0x5bf656){var _0xeff5fe=_0x5bf656['get']({'plain':!![]});return utilLicense['checkLicense'](_0xeff5fe,_0x595cdf[_0xa564('0x39')][_0xa564('0x3c')]);})['then'](function(_0x33e8f4){if(!_0x33e8f4['demo']){return saveUpdates(_0x595cdf[_0xa564('0x39')],null);}return _0x33e8f4;})[_0xa564('0x27')](respondWithResult(_0xc74518,null))[_0xa564('0x38')](handleError(_0xc74518,null));};exports['downloadLogFile']=function(_0x188691,_0x2c334b){var _0x56b2c3=_0xa564('0x3d');var _0x134871=path[_0xa564('0x3e')]('/var','log','xcally',_0x56b2c3);_0x2c334b[_0xa564('0x3f')](_0xa564('0x40'),_0xa564('0x41')+_0x56b2c3);_0x2c334b['set'](_0xa564('0x42'),_0xa564('0x43'));_0x2c334b['download'](_0x134871);}; \ No newline at end of file +var _0x40ad=['checkLicense','demo','catch','downloadLogFile','license-info.log','join','/var','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','stack','name','send','../../config/license/util','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','body','find','params'];(function(_0x45b6d4,_0x2ec49d){var _0x456012=function(_0x428e93){while(--_0x428e93){_0x45b6d4['push'](_0x45b6d4['shift']());}};_0x456012(++_0x2ec49d);}(_0x40ad,0x18d));var _0xd40a=function(_0x1a393d,_0x203e50){_0x1a393d=_0x1a393d-0x0;var _0x35aecb=_0x40ad[_0x1a393d];return _0x35aecb;};'use strict';var emlformat=require(_0xd40a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd40a('0x1'));var jsonpatch=require(_0xd40a('0x2'));var rp=require(_0xd40a('0x3'));var moment=require(_0xd40a('0x4'));var BPromise=require(_0xd40a('0x5'));var Mustache=require(_0xd40a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd40a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd40a('0x8'));var _=require('lodash');var squel=require(_0xd40a('0x9'));var crypto=require('crypto');var jsforce=require(_0xd40a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd40a('0x7'));var querystring=require('querystring');var Papa=require(_0xd40a('0xb'));var Redis=require(_0xd40a('0xc'));var authService=require(_0xd40a('0xd'));var qs=require(_0xd40a('0xe'));var as=require(_0xd40a('0xf'));var hardwareService=require(_0xd40a('0x10'));var logger=require(_0xd40a('0x11'))(_0xd40a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a112b,_0x468a18){_0x468a18=_0x468a18||0xcc;return function(_0x24db40){if(_0x24db40){return _0x5a112b[_0xd40a('0x13')](_0x468a18);}return _0x5a112b[_0xd40a('0x14')](_0x468a18)['end']();};}function respondWithResult(_0x26345d,_0x470c3c){_0x470c3c=_0x470c3c||0xc8;return function(_0x8c508b){if(_0x8c508b){return _0x26345d[_0xd40a('0x14')](_0x470c3c)[_0xd40a('0x15')](_0x8c508b);}};}function respondWithFilteredResult(_0x290ee4,_0x4d7e3f){return function(_0x3673bd){if(_0x3673bd){var _0x56c92d=typeof _0x4d7e3f[_0xd40a('0x16')]==='undefined'&&typeof _0x4d7e3f['limit']===_0xd40a('0x17');var _0x2e301f=_0x3673bd['count'];var _0x19d729=_0x56c92d?0x0:_0x4d7e3f[_0xd40a('0x16')];var _0x52d734=_0x56c92d?_0x3673bd['count']:_0x4d7e3f[_0xd40a('0x16')]+_0x4d7e3f['limit'];var _0x100115;if(_0x52d734>=_0x2e301f){_0x52d734=_0x2e301f;_0x100115=0xc8;}else{_0x100115=0xce;}_0x290ee4[_0xd40a('0x14')](_0x100115);return _0x290ee4['set'](_0xd40a('0x18'),_0x19d729+'-'+_0x52d734+'/'+_0x2e301f)[_0xd40a('0x15')](_0x3673bd);}return null;};}function patchUpdates(_0x35d403){return function(_0x4ad37d){try{jsonpatch[_0xd40a('0x19')](_0x4ad37d,_0x35d403,!![]);}catch(_0x270a2b){return BPromise[_0xd40a('0x1a')](_0x270a2b);}return _0x4ad37d[_0xd40a('0x1b')]();};}function saveUpdates(_0x37a6d1,_0x4a5356){return function(_0x18dbfe){if(_0x18dbfe){return _0x18dbfe[_0xd40a('0x1c')](_0x37a6d1)[_0xd40a('0x1d')](function(_0xe0b8f7){return _0xe0b8f7;});}return null;};}function removeEntity(_0x401f0d,_0x167f00){return function(_0x55f1da){if(_0x55f1da){return _0x55f1da['destroy']()[_0xd40a('0x1d')](function(){_0x401f0d[_0xd40a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212749,_0x2e46a3){return function(_0x2f882d){if(!_0x2f882d){_0x212749[_0xd40a('0x13')](0x194);}return _0x2f882d;};}function handleError(_0x3af3c5,_0x4bf74d){_0x4bf74d=_0x4bf74d||0x1f4;return function(_0x5541bb){logger[_0xd40a('0x1e')](_0x5541bb[_0xd40a('0x1f')]);if(_0x5541bb['name']){delete _0x5541bb[_0xd40a('0x20')];}_0x3af3c5['status'](_0x4bf74d)[_0xd40a('0x21')](_0x5541bb);};}var utilLicense=require(_0xd40a('0x22'));exports['index']=function(_0x27a6ea,_0x3d2453){var _0x2808ba={'raw':!![],'where':{'id':0x1}},_0x16b9ac={};_0x16b9ac[_0xd40a('0x23')]=_[_0xd40a('0x24')](db[_0xd40a('0x25')][_0xd40a('0x26')]);_0x16b9ac[_0xd40a('0x27')]=_[_0xd40a('0x24')](_0x27a6ea[_0xd40a('0x27')]);_0x16b9ac[_0xd40a('0x28')]=_['intersection'](_0x16b9ac[_0xd40a('0x23')],_0x16b9ac[_0xd40a('0x27')]);_0x2808ba[_0xd40a('0x29')]=_[_0xd40a('0x2a')](_0x16b9ac[_0xd40a('0x23')],qs[_0xd40a('0x2b')](_0x27a6ea[_0xd40a('0x27')][_0xd40a('0x2b')]));_0x2808ba[_0xd40a('0x29')]=_0x2808ba[_0xd40a('0x29')][_0xd40a('0x2c')]?_0x2808ba['attributes']:_0x16b9ac[_0xd40a('0x23')];_0x2808ba=_[_0xd40a('0x2d')]({},_0x2808ba,_0x27a6ea[_0xd40a('0x2e')]);return utilLicense[_0xd40a('0x2f')](_0x2808ba)[_0xd40a('0x1d')](respondWithResult(_0x3d2453,null))['catch'](handleError(_0x3d2453,null));};exports['update']=function(_0x463f0d,_0x5203c3){if(_0x463f0d[_0xd40a('0x30')]['id']){delete _0x463f0d[_0xd40a('0x30')]['id'];}return db[_0xd40a('0x25')][_0xd40a('0x31')]({'where':{'id':_0x463f0d[_0xd40a('0x32')]['id']}})[_0xd40a('0x1d')](handleEntityNotFound(_0x5203c3,null))[_0xd40a('0x1d')](function(_0x4b6bfb){var _0x34dac3=_0x4b6bfb['get']({'plain':!![]});return utilLicense[_0xd40a('0x33')](_0x34dac3,_0x463f0d['body']['key']);})[_0xd40a('0x1d')](function(_0xf9cff0){if(!_0xf9cff0[_0xd40a('0x34')]){return saveUpdates(_0x463f0d['body'],null);}return _0xf9cff0;})['then'](respondWithResult(_0x5203c3,null))[_0xd40a('0x35')](handleError(_0x5203c3,null));};exports[_0xd40a('0x36')]=function(_0x198cc4,_0x43cb31){var _0x4b08f9=_0xd40a('0x37');var _0x4a17bf=path[_0xd40a('0x38')](_0xd40a('0x39'),'log','xcally',_0x4b08f9);_0x43cb31[_0xd40a('0x3a')](_0xd40a('0x3b'),_0xd40a('0x3c')+_0x4b08f9);_0x43cb31['set'](_0xd40a('0x3d'),_0xd40a('0x3e'));_0x43cb31[_0xd40a('0x3f')](_0x4a17bf);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ff16fcd..46cf556 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 _0x250e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','license','lodash'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x250e,0x1e9));var _0xe250=function(_0x37331f,_0x29399e){_0x37331f=_0x37331f-0x0;var _0x54e379=_0x250e[_0x37331f];return _0x54e379;};'use strict';var _=require(_0xe250('0x0'));var util=require(_0xe250('0x1'));var logger=require(_0xe250('0x2'))(_0xe250('0x3'));var moment=require(_0xe250('0x4'));var BPromise=require(_0xe250('0x5'));var rp=require(_0xe250('0x6'));var fs=require('fs');var path=require(_0xe250('0x7'));var rimraf=require(_0xe250('0x8'));var config=require('../../config/environment');var attributes=require(_0xe250('0x9'));module[_0xe250('0xa')]=function(_0x1ef28c,_0x3da29e){return _0x1ef28c[_0xe250('0xb')](_0xe250('0xc'),attributes,{'tableName':_0xe250('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9156=['License','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define'];(function(_0x52f6f9,_0x3bbb5d){var _0x4f4e22=function(_0x3782fb){while(--_0x3782fb){_0x52f6f9['push'](_0x52f6f9['shift']());}};_0x4f4e22(++_0x3bbb5d);}(_0x9156,0x155));var _0x6915=function(_0x59fb00,_0x22b38e){_0x59fb00=_0x59fb00-0x0;var _0x8d627c=_0x9156[_0x59fb00];return _0x8d627c;};'use strict';var _=require(_0x6915('0x0'));var util=require(_0x6915('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6915('0x2'));var BPromise=require('bluebird');var rp=require(_0x6915('0x3'));var fs=require('fs');var path=require(_0x6915('0x4'));var rimraf=require(_0x6915('0x5'));var config=require(_0x6915('0x6'));var attributes=require(_0x6915('0x7'));module['exports']=function(_0x5eec15,_0x44951f){return _0x5eec15[_0x6915('0x8')](_0x6915('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5f133b4..6f465cf 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 _0x361a=['jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x25160e,_0x4b8e52){var _0x54b20d=function(_0x219192){while(--_0x219192){_0x25160e['push'](_0x25160e['shift']());}};_0x54b20d(++_0x4b8e52);}(_0x361a,0x1ad));var _0xa361=function(_0x268d22,_0x25b765){_0x268d22=_0x268d22-0x0;var _0x4db9ec=_0x361a[_0x268d22];return _0x4db9ec;};'use strict';var _=require(_0xa361('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa361('0x1'));var rs=require(_0xa361('0x2'));var fs=require('fs');var Redis=require(_0xa361('0x3'));var db=require(_0xa361('0x4'))['db'];var utils=require(_0xa361('0x5'));var logger=require(_0xa361('0x6'))(_0xa361('0x7'));var config=require('../../config/environment');var jayson=require(_0xa361('0x8'));var client=jayson['client'][_0xa361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2271e4,_0x22e06f,_0x4e61d5){return new BPromise(function(_0x4eefc3,_0x2642cb){return client[_0xa361('0xa')](_0x2271e4,_0x4e61d5)[_0xa361('0xb')](function(_0x8e39c9){logger[_0xa361('0xc')](_0xa361('0xd'),_0x22e06f,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x22e06f,_0xa361('0xe'),JSON[_0xa361('0xf')](_0x8e39c9));if(_0x8e39c9[_0xa361('0x10')]){if(_0x8e39c9[_0xa361('0x10')]['code']===0x1f4){logger['error'](_0xa361('0xd'),_0x22e06f,_0x8e39c9[_0xa361('0x10')][_0xa361('0x11')]);return _0x2642cb(_0x8e39c9[_0xa361('0x10')][_0xa361('0x11')]);}logger[_0xa361('0x10')]('License,\x20%s,\x20%s',_0x22e06f,_0x8e39c9[_0xa361('0x10')][_0xa361('0x11')]);return _0x4eefc3(_0x8e39c9[_0xa361('0x10')][_0xa361('0x11')]);}else{logger[_0xa361('0xc')](_0xa361('0xd'),_0x22e06f,'request\x20sent');_0x4eefc3(_0x8e39c9['result']['message']);}})[_0xa361('0x12')](function(_0x169ac1){logger[_0xa361('0x10')](_0xa361('0xd'),_0x22e06f,_0x169ac1);_0x2642cb(_0x169ac1);});});} \ No newline at end of file +var _0x468b=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x354cb7,_0x158fb7){var _0x1f7fcf=function(_0x38d062){while(--_0x38d062){_0x354cb7['push'](_0x354cb7['shift']());}};_0x1f7fcf(++_0x158fb7);}(_0x468b,0x1a1));var _0xb468=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x468b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb468('0x0'));var util=require(_0xb468('0x1'));var moment=require(_0xb468('0x2'));var BPromise=require('bluebird');var rs=require(_0xb468('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb468('0x4'));var logger=require(_0xb468('0x5'))(_0xb468('0x6'));var config=require(_0xb468('0x7'));var jayson=require(_0xb468('0x8'));var client=jayson['client'][_0xb468('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b0cb0,_0x33d6bf,_0x22f569){return new BPromise(function(_0x111a75,_0x36c7fd){return client[_0xb468('0xa')](_0x5b0cb0,_0x22f569)['then'](function(_0x154e9c){logger[_0xb468('0xb')](_0xb468('0xc'),_0x33d6bf,_0xb468('0xd'));logger[_0xb468('0xe')](_0xb468('0xf'),_0x33d6bf,_0xb468('0xd'),JSON[_0xb468('0x10')](_0x154e9c));if(_0x154e9c[_0xb468('0x11')]){if(_0x154e9c[_0xb468('0x11')][_0xb468('0x12')]===0x1f4){logger[_0xb468('0x11')](_0xb468('0xc'),_0x33d6bf,_0x154e9c[_0xb468('0x11')][_0xb468('0x13')]);return _0x36c7fd(_0x154e9c[_0xb468('0x11')][_0xb468('0x13')]);}logger['error'](_0xb468('0xc'),_0x33d6bf,_0x154e9c[_0xb468('0x11')][_0xb468('0x13')]);return _0x111a75(_0x154e9c[_0xb468('0x11')][_0xb468('0x13')]);}else{logger[_0xb468('0xb')](_0xb468('0xc'),_0x33d6bf,_0xb468('0xd'));_0x111a75(_0x154e9c[_0xb468('0x14')][_0xb468('0x13')]);}})[_0xb468('0x15')](function(_0x58af2c){logger[_0xb468('0x11')]('License,\x20%s,\x20%s',_0x33d6bf,_0x58af2c);_0x36c7fd(_0x58af2c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3ecceab..f43c0d0 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 _0x5ef3=['isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','post','addAnswer','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x515e58,_0x489bd5){var _0xb8e84e=function(_0x180236){while(--_0x180236){_0x515e58['push'](_0x515e58['shift']());}};_0xb8e84e(++_0x489bd5);}(_0x5ef3,0x80));var _0x35ef=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x5ef3[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0x35ef('0x0'));var util=require(_0x35ef('0x1'));var path=require(_0x35ef('0x2'));var timeout=require(_0x35ef('0x3'));var express=require(_0x35ef('0x4'));var router=express['Router']();var fs_extra=require(_0x35ef('0x5'));var auth=require(_0x35ef('0x6'));var interaction=require(_0x35ef('0x7'));var config=require(_0x35ef('0x8'));var controller=require(_0x35ef('0x9'));router['get']('/',auth[_0x35ef('0xa')](),controller[_0x35ef('0xb')]);router[_0x35ef('0xc')](_0x35ef('0xd'),auth[_0x35ef('0xa')](),controller[_0x35ef('0xe')]);router[_0x35ef('0xc')](_0x35ef('0xf'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x10')]);router[_0x35ef('0xc')]('/:id/dispositions',auth[_0x35ef('0xa')](),controller[_0x35ef('0x11')]);router[_0x35ef('0xc')](_0x35ef('0x12'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x13')]);router[_0x35ef('0xc')](_0x35ef('0x14'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x15')]);router['get'](_0x35ef('0x16'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x17')]);router[_0x35ef('0xc')]('/:id/interactions',auth[_0x35ef('0xa')](),controller[_0x35ef('0x18')]);router[_0x35ef('0xc')](_0x35ef('0x19'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x1a')]);router[_0x35ef('0xc')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x35ef('0xc')](_0x35ef('0x1b'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x1c')]);router['get'](_0x35ef('0x1d'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x1e')]);router['post'](_0x35ef('0x1f'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x35ef('0x20')](_0x35ef('0x12'),auth['isAuthenticated'](),controller[_0x35ef('0x21')]);router[_0x35ef('0x20')]('/',auth[_0x35ef('0xa')](),controller['create']);router[_0x35ef('0x20')](_0x35ef('0x14'),auth[_0x35ef('0xa')](),controller['addImap']);router[_0x35ef('0x20')](_0x35ef('0x16'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x35ef('0x20')]('/:id/interactions',auth[_0x35ef('0xa')](),controller['addInteraction']);router[_0x35ef('0x20')](_0x35ef('0x19'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x22')]);router[_0x35ef('0x20')](_0x35ef('0x23'),auth[_0x35ef('0xa')](),controller['send']);router[_0x35ef('0x20')](_0x35ef('0x1d'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x24')]);router[_0x35ef('0x25')](_0x35ef('0xf'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x26')]);router[_0x35ef('0x27')](_0x35ef('0x1f'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x28')]);router[_0x35ef('0x27')](_0x35ef('0x12'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x29')]);router['delete'](_0x35ef('0x14'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x2a')]);router[_0x35ef('0x27')](_0x35ef('0x16'),auth[_0x35ef('0xa')](),controller[_0x35ef('0x2b')]);router[_0x35ef('0x27')](_0x35ef('0xf'),auth[_0x35ef('0xa')](),controller['destroy']);router['delete'](_0x35ef('0x1d'),auth['isAuthenticated'](),controller[_0x35ef('0x2c')]);module[_0x35ef('0x2d')]=router; \ No newline at end of file +var _0xcd6f=['getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xcd6f,0x112));var _0xfcd6=function(_0x257c25,_0x3a7007){_0x257c25=_0x257c25-0x0;var _0x2eac3e=_0xcd6f[_0x257c25];return _0x2eac3e;};'use strict';var multer=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var path=require(_0xfcd6('0x2'));var timeout=require(_0xfcd6('0x3'));var express=require('express');var router=express[_0xfcd6('0x4')]();var fs_extra=require(_0xfcd6('0x5'));var auth=require(_0xfcd6('0x6'));var interaction=require(_0xfcd6('0x7'));var config=require(_0xfcd6('0x8'));var controller=require(_0xfcd6('0x9'));router[_0xfcd6('0xa')]('/',auth[_0xfcd6('0xb')](),controller[_0xfcd6('0xc')]);router[_0xfcd6('0xa')](_0xfcd6('0xd'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0xe')]);router[_0xfcd6('0xa')](_0xfcd6('0xf'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x10')]);router['get'](_0xfcd6('0x11'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x12')]);router['get']('/:id/canned_answers',auth[_0xfcd6('0xb')](),controller['getAnswers']);router[_0xfcd6('0xa')](_0xfcd6('0x13'),auth['isAuthenticated'](),controller[_0xfcd6('0x14')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xfcd6('0x15')]);router[_0xfcd6('0xa')]('/:id/interactions',auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x16')]);router['get'](_0xfcd6('0x17'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x18')]);router['get'](_0xfcd6('0x19'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x1a')]);router[_0xfcd6('0xa')]('/:id/verify',auth['isAuthenticated'](),controller[_0xfcd6('0x1b')]);router[_0xfcd6('0xa')](_0xfcd6('0x1c'),auth[_0xfcd6('0xb')](),controller['getAgents']);router[_0xfcd6('0x1d')](_0xfcd6('0x11'),auth[_0xfcd6('0xb')](),controller['addDisposition']);router['post'](_0xfcd6('0x1e'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x1f')]);router[_0xfcd6('0x1d')]('/',auth['isAuthenticated'](),controller[_0xfcd6('0x20')]);router[_0xfcd6('0x1d')](_0xfcd6('0x13'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x21')]);router['post'](_0xfcd6('0x22'),auth['isAuthenticated'](),controller[_0xfcd6('0x23')]);router['post'](_0xfcd6('0x24'),auth['isAuthenticated'](),controller[_0xfcd6('0x25')]);router['post'](_0xfcd6('0x17'),auth['isAuthenticated'](),controller[_0xfcd6('0x26')]);router['post'](_0xfcd6('0x27'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x28')]);router['post'](_0xfcd6('0x1c'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x29')]);router[_0xfcd6('0x2a')](_0xfcd6('0xf'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x2b')]);router['delete'](_0xfcd6('0x11'),auth['isAuthenticated'](),controller[_0xfcd6('0x2c')]);router[_0xfcd6('0x2d')]('/:id/canned_answers',auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x2e')]);router['delete'](_0xfcd6('0x13'),auth['isAuthenticated'](),controller['removeImap']);router[_0xfcd6('0x2d')]('/:id/out_servers',auth[_0xfcd6('0xb')](),controller['removeSmtp']);router[_0xfcd6('0x2d')](_0xfcd6('0xf'),auth[_0xfcd6('0xb')](),controller[_0xfcd6('0x2f')]);router[_0xfcd6('0x2d')](_0xfcd6('0x1c'),auth[_0xfcd6('0xb')](),controller['removeAgents']);module[_0xfcd6('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8f6cdcb..4b07912 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 _0x7553=['ENUM','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x529222,_0x4a234e){var _0xa47ab0=function(_0x3da9e1){while(--_0x3da9e1){_0x529222['push'](_0x529222['shift']());}};_0xa47ab0(++_0x4a234e);}(_0x7553,0xde));var _0x3755=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x7553[_0x525af9];return _0x129fbf;};'use strict';var Sequelize=require(_0x3755('0x0'));module[_0x3755('0x1')]={'description':{'type':Sequelize[_0x3755('0x2')]},'name':{'type':Sequelize[_0x3755('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3755('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3755('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x3755('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x3755('0x4')]},'markAsUnread':{'type':Sequelize[_0x3755('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3755('0x2')],'allowNull':![],'defaultValue':_0x3755('0x5')},'fontSize':{'type':Sequelize[_0x3755('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3755('0x4')],'defaultValue':function(){return _0x3755('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3755('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3755('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3755('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3755('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3755('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3755('0x6')],'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[_0x3755('0x3')],'defaultValue':![],'comment':_0x3755('0x8'),'set':function(_0x1df88c){if(!_0x1df88c)this['setDataValue'](_0x3755('0x9'),null);this[_0x3755('0xa')](_0x3755('0xb'),_0x1df88c);}},'provider':{'type':Sequelize[_0x3755('0xc')]('gmail',_0x3755('0xd'),_0x3755('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x432b35=this[_0x3755('0xf')](_0x3755('0x10'));return _0x432b35||_0x3755('0x11');},'set':function(_0x4ad0b1){if(_0x4ad0b1===_0x3755('0x11')){_0x4ad0b1=null;}return this[_0x3755('0xa')](_0x3755('0x10'),_0x4ad0b1);}}}; \ No newline at end of file +var _0x5fb3=['custom','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','getDataValue'];(function(_0x28b038,_0x49c0e5){var _0x1fc023=function(_0x248190){while(--_0x248190){_0x28b038['push'](_0x28b038['shift']());}};_0x1fc023(++_0x49c0e5);}(_0x5fb3,0x1a0));var _0x35fb=function(_0x597a09,_0x505d07){_0x597a09=_0x597a09-0x0;var _0x49fb54=_0x5fb3[_0x597a09];return _0x49fb54;};'use strict';var Sequelize=require(_0x35fb('0x0'));module[_0x35fb('0x1')]={'description':{'type':Sequelize[_0x35fb('0x2')]},'name':{'type':Sequelize[_0x35fb('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x35fb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35fb('0x4')},'fontSize':{'type':Sequelize[_0x35fb('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x35fb('0x6')],'defaultValue':function(){return _0x35fb('0x7');}},'notificationSound':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x35fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x35fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x35fb('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x35fb('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x35fb('0x3')],'defaultValue':![],'comment':_0x35fb('0x9'),'set':function(_0x45297c){if(!_0x45297c)this[_0x35fb('0xa')](_0x35fb('0xb'),null);this[_0x35fb('0xa')](_0x35fb('0xc'),_0x45297c);}},'provider':{'type':Sequelize[_0x35fb('0xd')](_0x35fb('0xe'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x434098=this[_0x35fb('0xf')]('provider');return _0x434098||_0x35fb('0x10');},'set':function(_0x30166c){if(_0x30166c===_0x35fb('0x10')){_0x30166c=null;}return this[_0x35fb('0xa')](_0x35fb('0x11'),_0x30166c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1c99d65..d6bc141 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 _0x320b=['MailAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','show','keys','options','find','body','provider','secure','params','MailServerOut','Mail\x20Account\x20not\x20found','update','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','hasOwnProperty','MailInteraction','User','Owner','Tag','color','tag','findAll','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','Contacts','defaults','ListId','messageId','attach','out','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','getAgents','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','json','destroy','get','MailAccounts','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map'];(function(_0x3e6de5,_0x1e1c83){var _0x1a4d79=function(_0x61bb7a){while(--_0x61bb7a){_0x3e6de5['push'](_0x3e6de5['shift']());}};_0x1a4d79(++_0x1e1c83);}(_0x320b,0x137));var _0xb320=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x320b[_0x50007c];return _0x5c1ec7;};'use strict';var moment=require(_0xb320('0x0'));var BPromise=require(_0xb320('0x1'));var util=require(_0xb320('0x2'));var path=require('path');var _=require(_0xb320('0x3'));var juice=require('juice');var Redis=require(_0xb320('0x4'));var qs=require(_0xb320('0x5'));var logger=require(_0xb320('0x6'))(_0xb320('0x7'));var config=require(_0xb320('0x8'));var db=require('../../mysqldb')['db'];config[_0xb320('0x9')]=_['defaults'](config[_0xb320('0x9')],{'host':_0xb320('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb320('0x9')]));require(_0xb320('0xb'))[_0xb320('0xc')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x4b26fd,_0x428007,_0x3730c7,_0x39dbb5){return new BPromise(function(_0x35fb10,_0x566136){var _0x1c74b3=_0x39dbb5||client;return _0x1c74b3[_0xb320('0xd')](_0x4b26fd,_0x3730c7)[_0xb320('0xe')](function(_0x4f855c){logger[_0xb320('0xf')]('MailAccount,\x20%s,\x20%s',_0x428007,_0xb320('0x10'));logger[_0xb320('0x11')](_0xb320('0x12'),_0x428007,_0xb320('0x10'),JSON[_0xb320('0x13')](_0x4f855c));if(_0x4f855c[_0xb320('0x14')]){if(_0x4f855c[_0xb320('0x14')][_0xb320('0x15')]===0x1f4){logger[_0xb320('0x14')](_0xb320('0x16'),_0x428007,_0x4f855c[_0xb320('0x14')][_0xb320('0x17')]);return _0x566136(_0x4f855c['error'][_0xb320('0x17')]);}logger['error'](_0xb320('0x16'),_0x428007,_0x4f855c['error'][_0xb320('0x17')]);return _0x35fb10(_0x4f855c[_0xb320('0x14')][_0xb320('0x17')]);}else{logger[_0xb320('0xf')]('MailAccount,\x20%s,\x20%s',_0x428007,_0xb320('0x10'));_0x35fb10(_0x4f855c[_0xb320('0x18')]['message']);}})[_0xb320('0x19')](function(_0x5289f7){logger['error'](_0xb320('0x16'),_0x428007,_0x5289f7);_0x566136(_0x5289f7);});});}function respondWithStatusCode(_0x14dfb6,_0x4aa264){_0x4aa264=_0x4aa264||0xcc;return function(_0x54e005){if(_0x54e005){return _0x14dfb6[_0xb320('0x1a')](_0x4aa264);}return _0x14dfb6[_0xb320('0x1b')](_0x4aa264)['end']();};}function respondWithResult(_0x4230f7,_0x5c5977){_0x5c5977=_0x5c5977||0xc8;return function(_0x1105d3){if(_0x1105d3){return _0x4230f7[_0xb320('0x1b')](_0x5c5977)['json'](_0x1105d3);}};}function respondWithFilteredResult(_0x50c846,_0x117e38){return function(_0x415fb7){if(_0x415fb7){var _0x507adf=typeof _0x117e38[_0xb320('0x1c')]===_0xb320('0x1d')&&typeof _0x117e38[_0xb320('0x1e')]===_0xb320('0x1d');var _0x8637c5=_0x415fb7[_0xb320('0x1f')];var _0x2c4d75=_0x507adf?0x0:_0x117e38['offset'];var _0x541ab9=_0x507adf?_0x415fb7[_0xb320('0x1f')]:_0x117e38[_0xb320('0x1c')]+_0x117e38[_0xb320('0x1e')];var _0xcf0006;if(_0x541ab9>=_0x8637c5){_0x541ab9=_0x8637c5;_0xcf0006=0xc8;}else{_0xcf0006=0xce;}_0x50c846[_0xb320('0x1b')](_0xcf0006);return _0x50c846['set']('Content-Range',_0x2c4d75+'-'+_0x541ab9+'/'+_0x8637c5)[_0xb320('0x20')](_0x415fb7);}return null;};}function saveUpdates(_0x527123){return function(_0x3c0731){if(_0x3c0731){return _0x3c0731['update'](_0x527123)[_0xb320('0xe')](function(_0x18c9c6){return _0x18c9c6;});}return null;};}function removeEntity(_0x3eaff2){return function(_0x5769da){if(_0x5769da){return _0x5769da[_0xb320('0x21')]()[_0xb320('0xe')](function(){var _0x354113=_0x5769da[_0xb320('0x22')]({'plain':!![]});var _0x5efdfd=_0xb320('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efdfd,'resourceId':_0x354113['id']}})[_0xb320('0xe')](function(){return _0x5769da;});})[_0xb320('0xe')](function(){_0x3eaff2[_0xb320('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ae42){return function(_0x2f726c){if(!_0x2f726c){_0x46ae42[_0xb320('0x1a')](0x194);}return _0x2f726c;};}function handleError(_0x552d03,_0x14dc88){_0x14dc88=_0x14dc88||0x1f4;return function(_0x59bdb3){logger['error'](_0x59bdb3[_0xb320('0x24')]);if(_0x59bdb3[_0xb320('0x25')]){delete _0x59bdb3[_0xb320('0x25')];}_0x552d03[_0xb320('0x1b')](_0x14dc88)[_0xb320('0x26')](_0x59bdb3);};}function getImapHost(_0x37eb87){switch(_0x37eb87){case'gmail':return _0xb320('0x27');case _0xb320('0x28'):return _0xb320('0x29');case _0xb320('0x2a'):return _0xb320('0x2b');case'outlook365':return _0xb320('0x2c');}throw new Error(_0xb320('0x2d'),_0x37eb87);}function getSmtpHost(_0x478899){switch(_0x478899){case _0xb320('0x2e'):return _0xb320('0x2f');case _0xb320('0x28'):return _0xb320('0x30');case _0xb320('0x2a'):return _0xb320('0x31');case _0xb320('0x32'):return _0xb320('0x33');}throw new Error(_0xb320('0x2d'),_0x478899);}function getAuthenticationOptions(_0x2ab695,_0x3ec88c){var _0x3a41e4={};var _0x5a7384={};if(_0x2ab695){_0x3a41e4[_0xb320('0x34')]=_0x5a7384['user']=_0x3ec88c[_0xb320('0x35')];_0x3a41e4[_0xb320('0x36')]=_0x5a7384[_0xb320('0x37')]=_0x3ec88c[_0xb320('0x36')];if(_0x3ec88c['modernAuthentication']){_0x3a41e4[_0xb320('0x38')]=_0x5a7384[_0xb320('0x38')]=!![];_0x3a41e4[_0xb320('0x39')]=_0x5a7384[_0xb320('0x39')]=_0x3ec88c[_0xb320('0x39')];_0x3a41e4[_0xb320('0x36')]=_0x5a7384['pass']=null;}else{_0x3a41e4[_0xb320('0x39')]=_0x5a7384[_0xb320('0x39')]=null;}_0x3a41e4['host']=getImapHost(_0x2ab695);_0x3a41e4[_0xb320('0x3a')]=0x3e1;_0x5a7384[_0xb320('0x3b')]=getSmtpHost(_0x2ab695);_0x5a7384[_0xb320('0x3a')]=0x24b;_0x5a7384['secure']=![];_0x3a41e4['service']=_0x5a7384[_0xb320('0x3c')]=null;}else{if(_0x3ec88c[_0xb320('0x3d')]){_0x3a41e4[_0xb320('0x34')]=_0x5a7384[_0xb320('0x34')]=_0x3ec88c['username'];_0x3a41e4[_0xb320('0x36')]=_0x5a7384['pass']=_0x3ec88c[_0xb320('0x36')];}else{_0x3a41e4[_0xb320('0x3d')]=_0x5a7384['authentication']=![];_0x3a41e4['user']=_0x5a7384[_0xb320('0x34')]=null;_0x3a41e4[_0xb320('0x36')]=_0x5a7384[_0xb320('0x37')]=null;}_0x3a41e4[_0xb320('0x3b')]=_0x3ec88c['Imap']['host'];_0x3a41e4[_0xb320('0x3a')]=_0x3ec88c[_0xb320('0x3e')][_0xb320('0x3a')];_0x5a7384['host']=_0x3ec88c[_0xb320('0x3f')][_0xb320('0x3b')];_0x5a7384[_0xb320('0x3a')]=_0x3ec88c[_0xb320('0x3f')]['port'];}return{'Imap':_0x3a41e4,'Smtp':_0x5a7384};}exports[_0xb320('0x40')]=function(_0x1f8769,_0x8d55b6){var _0x22f14f={'include':[{'model':db[_0xb320('0x41')],'as':_0xb320('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xb320('0x42')],'as':_0xb320('0x43')}]},_0x5ee901={},_0x21d6da={'count':0x0,'rows':[]};var _0x444e96=_[_0xb320('0x44')](db[_0xb320('0x45')][_0xb320('0x46')],function(_0xd65d01){return{'name':_0xd65d01[_0xb320('0x47')],'type':_0xd65d01[_0xb320('0x48')][_0xb320('0x49')]};});_0x5ee901['model']=_[_0xb320('0x44')](_0x444e96,_0xb320('0x25'));_0x5ee901[_0xb320('0x4a')]=_['keys'](_0x1f8769[_0xb320('0x4a')]);_0x5ee901[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x5ee901[_0xb320('0x4d')],_0x5ee901[_0xb320('0x4a')]);_0x22f14f[_0xb320('0x4e')]=_[_0xb320('0x4c')](_0x5ee901['model'],qs[_0xb320('0x4f')](_0x1f8769['query'][_0xb320('0x4f')]));_0x22f14f['attributes']=_0x22f14f[_0xb320('0x4e')][_0xb320('0x50')]?_0x22f14f['attributes']:_0x5ee901[_0xb320('0x4d')];if(!_0x1f8769['query']['hasOwnProperty'](_0xb320('0x51'))){_0x22f14f[_0xb320('0x1e')]=qs[_0xb320('0x1e')](_0x1f8769[_0xb320('0x4a')][_0xb320('0x1e')]);_0x22f14f[_0xb320('0x1c')]=qs[_0xb320('0x1c')](_0x1f8769[_0xb320('0x4a')][_0xb320('0x1c')]);}_0x22f14f[_0xb320('0x52')]=qs['sort'](_0x1f8769[_0xb320('0x4a')][_0xb320('0x53')]);_0x22f14f[_0xb320('0x54')]=qs[_0xb320('0x4b')](_[_0xb320('0x55')](_0x1f8769[_0xb320('0x4a')],_0x5ee901[_0xb320('0x4b')]),_0x444e96);if(_0x1f8769[_0xb320('0x4a')][_0xb320('0x56')]){_0x22f14f['where']=_['merge'](_0x22f14f[_0xb320('0x54')],{'$or':_['map'](_0x444e96,function(_0x1e739f){if(_0x1e739f[_0xb320('0x48')]!==_0xb320('0x57')){var _0x3362c9={};_0x3362c9[_0x1e739f['name']]={'$like':'%'+_0x1f8769[_0xb320('0x4a')]['filter']+'%'};return _0x3362c9;}})});}_0x22f14f=_[_0xb320('0x58')]({},_0x22f14f,_0x1f8769['options']);var _0x493b95={'where':_0x22f14f[_0xb320('0x54')]};return db[_0xb320('0x45')][_0xb320('0x1f')](_0x493b95)[_0xb320('0xe')](function(_0x405b23){_0x21d6da[_0xb320('0x1f')]=_0x405b23;if(_0x1f8769['query']['includeAll']){_0x22f14f[_0xb320('0x59')]=[{'all':!![]}];}return db[_0xb320('0x45')]['findAll'](_0x22f14f);})['then'](function(_0x572a0a){_0x21d6da['rows']=_0x572a0a;return _0x21d6da;})[_0xb320('0xe')](respondWithFilteredResult(_0x8d55b6,_0x22f14f))[_0xb320('0x19')](handleError(_0x8d55b6,null));};exports[_0xb320('0x5a')]=function(_0x542eb6,_0xd11633){var _0x215ce1={'raw':![],'where':{'id':_0x542eb6['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xb320('0x3e')},{'model':db['MailServerOut'],'as':_0xb320('0x3f')},{'model':db['Pause'],'as':_0xb320('0x43')}]},_0x1da662={};_0x1da662['model']=_[_0xb320('0x5b')](db['MailAccount'][_0xb320('0x46')]);_0x1da662[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x542eb6['query']);_0x1da662['filters']=_['intersection'](_0x1da662[_0xb320('0x4d')],_0x1da662[_0xb320('0x4a')]);_0x215ce1[_0xb320('0x4e')]=_['intersection'](_0x1da662[_0xb320('0x4d')],qs['fields'](_0x542eb6[_0xb320('0x4a')][_0xb320('0x4f')]));_0x215ce1[_0xb320('0x4e')]=_0x215ce1[_0xb320('0x4e')]['length']?_0x215ce1[_0xb320('0x4e')]:_0x1da662[_0xb320('0x4d')];if(_0x542eb6[_0xb320('0x4a')]['includeAll']){_0x215ce1[_0xb320('0x59')]=[{'all':!![]}];}_0x215ce1=_[_0xb320('0x58')]({},_0x215ce1,_0x542eb6[_0xb320('0x5c')]);return db[_0xb320('0x45')][_0xb320('0x5d')](_0x215ce1)[_0xb320('0xe')](handleEntityNotFound(_0xd11633,null))[_0xb320('0xe')](respondWithResult(_0xd11633,null))[_0xb320('0x19')](handleError(_0xd11633,null));};exports['update']=function(_0x1af4ca,_0x3777fb){if(_0x1af4ca[_0xb320('0x5e')]['id']){delete _0x1af4ca['body']['id'];}var _0x2d61c3=_0x1af4ca[_0xb320('0x5e')][_0xb320('0x5f')]==='custom'?null:_0x1af4ca[_0xb320('0x5e')][_0xb320('0x5f')];var _0xcc4c40=_0x1af4ca[_0xb320('0x5e')][_0xb320('0x3e')]||{};var _0x29bbc2=_0x1af4ca[_0xb320('0x5e')]['Smtp']||{};if(_0x2d61c3){_0xcc4c40[_0xb320('0x3b')]=getImapHost(_0x2d61c3);_0xcc4c40[_0xb320('0x3a')]=0x3e1;_0x29bbc2[_0xb320('0x3b')]=getSmtpHost(_0x2d61c3);_0x29bbc2[_0xb320('0x3a')]=0x24b;_0x29bbc2[_0xb320('0x60')]=![];}if(_0x29bbc2['modernAuthentication']){_0x29bbc2[_0xb320('0x60')]=![];}else{_0x29bbc2[_0xb320('0x39')]=null;}if(!_0xcc4c40[_0xb320('0x38')])_0xcc4c40['CloudProviderId']=null;_0x1af4ca[_0xb320('0x5e')][_0xb320('0x3e')]=_0xcc4c40;_0x1af4ca[_0xb320('0x5e')][_0xb320('0x3f')]=_0x29bbc2;return db[_0xb320('0x45')][_0xb320('0x5d')]({'where':{'id':_0x1af4ca[_0xb320('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb320('0x3e')},{'model':db[_0xb320('0x62')],'as':'Smtp'},{'model':db['Pause'],'as':_0xb320('0x43')}]})[_0xb320('0xe')](handleEntityNotFound(_0x3777fb,null))[_0xb320('0xe')](function(_0x54e4cf){if(!_0x54e4cf)throw new Error(_0xb320('0x63'));if(_0x54e4cf[_0xb320('0x3c')])delete _0x1af4ca[_0xb320('0x5e')]['Imap'];return _0x54e4cf;})['then'](saveUpdates(_0x1af4ca['body'],null))[_0xb320('0xe')](function(_0xfb042e){if(!_0x1af4ca[_0xb320('0x5e')][_0xb320('0x3e')])return _0xfb042e;return db[_0xb320('0x41')][_0xb320('0x64')](_0x1af4ca[_0xb320('0x5e')][_0xb320('0x3e')],{'where':{'MailAccountId':_0xfb042e['id']}})[_0xb320('0xe')](function(){return _0xfb042e;});})[_0xb320('0xe')](function(_0x58567d){if(!_0x1af4ca['body'][_0xb320('0x3f')])return _0x58567d;return db['MailServerOut'][_0xb320('0x64')](_0x1af4ca[_0xb320('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x58567d['id']}})[_0xb320('0xe')](function(){return _0x58567d;});})[_0xb320('0xe')](respondWithResult(_0x3777fb,null))[_0xb320('0x19')](handleError(_0x3777fb,null));};exports[_0xb320('0x65')]=function(_0x121c26,_0x31fed2){return db[_0xb320('0x45')]['describe']()['then'](respondWithResult(_0x31fed2,null))[_0xb320('0x19')](handleError(_0x31fed2,null));};exports[_0xb320('0x66')]=function(_0x46bf76,_0x3a535e){if(_0x46bf76[_0xb320('0x5e')]['id']){delete _0x46bf76[_0xb320('0x5e')]['id'];}return db[_0xb320('0x45')]['find']({'where':{'id':_0x46bf76[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x3a535e,null))[_0xb320('0xe')](function(_0x32c789){if(_0x32c789){_0x46bf76['body']['MailAccountId']=_0x32c789['id'];return db[_0xb320('0x67')][_0xb320('0x68')](_0x46bf76[_0xb320('0x5e')]);}})[_0xb320('0xe')](respondWithResult(_0x3a535e,null))[_0xb320('0x19')](handleError(_0x3a535e,null));};exports[_0xb320('0x69')]=function(_0x3bd48a,_0x57da75){var _0x1aceea={'raw':![],'where':{}};var _0x62acc4={};var _0x270e77={'count':0x0,'rows':[]};return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x3bd48a[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x57da75,null))[_0xb320('0xe')](function(_0x4f3040){if(_0x4f3040){_0x62acc4[_0xb320('0x4d')]=_['keys'](db[_0xb320('0x67')]['rawAttributes']);_0x62acc4[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x3bd48a[_0xb320('0x4a')]);_0x62acc4[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x62acc4[_0xb320('0x4d')],_0x62acc4[_0xb320('0x4a')]);_0x1aceea['attributes']=_[_0xb320('0x4c')](_0x62acc4[_0xb320('0x4d')],qs[_0xb320('0x4f')](_0x3bd48a[_0xb320('0x4a')][_0xb320('0x4f')]));_0x1aceea[_0xb320('0x4e')]=_0x1aceea[_0xb320('0x4e')][_0xb320('0x50')]?_0x1aceea['attributes']:_0x62acc4[_0xb320('0x4d')];if(!_0x3bd48a[_0xb320('0x4a')]['hasOwnProperty']('nolimit')){_0x1aceea[_0xb320('0x1e')]=qs['limit'](_0x3bd48a[_0xb320('0x4a')][_0xb320('0x1e')]);_0x1aceea[_0xb320('0x1c')]=qs[_0xb320('0x1c')](_0x3bd48a[_0xb320('0x4a')][_0xb320('0x1c')]);}_0x1aceea[_0xb320('0x52')]=qs[_0xb320('0x53')](_0x3bd48a['query'][_0xb320('0x53')]);_0x1aceea['where']=qs[_0xb320('0x4b')](_['pick'](_0x3bd48a[_0xb320('0x4a')],_0x62acc4['filters']));_0x1aceea['where'][_0xb320('0x6b')]=_0x4f3040['id'];if(_0x3bd48a[_0xb320('0x4a')][_0xb320('0x56')]){_0x1aceea['where']=_[_0xb320('0x58')](_0x1aceea[_0xb320('0x54')],{'$or':_[_0xb320('0x44')](_0x1aceea[_0xb320('0x4e')],function(_0x194fc6){var _0x45b75f={};_0x45b75f[_0x194fc6]={'$like':'%'+_0x3bd48a[_0xb320('0x4a')]['filter']+'%'};return _0x45b75f;})});}_0x1aceea=_['merge']({},_0x1aceea,_0x3bd48a['options']);return db[_0xb320('0x67')]['count']({'where':_0x1aceea[_0xb320('0x54')]})[_0xb320('0xe')](function(_0x283b32){_0x270e77['count']=_0x283b32;if(_0x3bd48a[_0xb320('0x4a')][_0xb320('0x6c')]){_0x1aceea['include']=[{'all':!![]}];}return db[_0xb320('0x67')]['findAll'](_0x1aceea);})[_0xb320('0xe')](function(_0x2c52c3){_0x270e77[_0xb320('0x6d')]=_0x2c52c3;return _0x270e77;});}})['then'](respondWithFilteredResult(_0x57da75,_0x1aceea))['catch'](handleError(_0x57da75,null));};exports[_0xb320('0x6e')]=function(_0x197bc7,_0x291029){return db[_0xb320('0x45')]['find']({'where':{'id':_0x197bc7['params']['id']}})['then'](handleEntityNotFound(_0x291029,null))[_0xb320('0xe')](function(_0x262fd1){if(_0x262fd1){return _0x262fd1[_0xb320('0x6e')](_0x197bc7['query'][_0xb320('0x6f')]);}})[_0xb320('0xe')](respondWithStatusCode(_0x291029,null))[_0xb320('0x19')](handleError(_0x291029,null));};exports[_0xb320('0x70')]=function(_0x5421d7,_0x3ebb71){if(_0x5421d7[_0xb320('0x5e')]['id']){delete _0x5421d7[_0xb320('0x5e')]['id'];}return db[_0xb320('0x45')][_0xb320('0x5d')]({'where':{'id':_0x5421d7[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x3ebb71,null))['then'](function(_0x286ff8){if(_0x286ff8){_0x5421d7[_0xb320('0x5e')]['MailAccountId']=_0x286ff8['id'];return db[_0xb320('0x71')][_0xb320('0x68')](_0x5421d7[_0xb320('0x5e')]);}})['then'](respondWithResult(_0x3ebb71,null))[_0xb320('0x19')](handleError(_0x3ebb71,null));};exports[_0xb320('0x72')]=function(_0x2fa173,_0x15ec80){var _0xd717d1={'raw':![],'where':{}};var _0x4cf81a={};var _0x20be41={'count':0x0,'rows':[]};return db[_0xb320('0x45')]['findOne']({'where':{'id':_0x2fa173['params']['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x15ec80,null))[_0xb320('0xe')](function(_0x200392){if(_0x200392){_0x4cf81a[_0xb320('0x4d')]=_[_0xb320('0x5b')](db['CannedAnswer'][_0xb320('0x46')]);_0x4cf81a[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x2fa173[_0xb320('0x4a')]);_0x4cf81a[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x4cf81a['model'],_0x4cf81a[_0xb320('0x4a')]);_0xd717d1[_0xb320('0x4e')]=_[_0xb320('0x4c')](_0x4cf81a[_0xb320('0x4d')],qs[_0xb320('0x4f')](_0x2fa173[_0xb320('0x4a')][_0xb320('0x4f')]));_0xd717d1['attributes']=_0xd717d1[_0xb320('0x4e')][_0xb320('0x50')]?_0xd717d1[_0xb320('0x4e')]:_0x4cf81a[_0xb320('0x4d')];if(!_0x2fa173[_0xb320('0x4a')]['hasOwnProperty'](_0xb320('0x51'))){_0xd717d1[_0xb320('0x1e')]=qs[_0xb320('0x1e')](_0x2fa173[_0xb320('0x4a')][_0xb320('0x1e')]);_0xd717d1[_0xb320('0x1c')]=qs['offset'](_0x2fa173['query'][_0xb320('0x1c')]);}_0xd717d1[_0xb320('0x52')]=qs[_0xb320('0x53')](_0x2fa173[_0xb320('0x4a')][_0xb320('0x53')]);_0xd717d1[_0xb320('0x54')]=qs[_0xb320('0x4b')](_[_0xb320('0x55')](_0x2fa173[_0xb320('0x4a')],_0x4cf81a[_0xb320('0x4b')]));_0xd717d1[_0xb320('0x54')][_0xb320('0x6b')]=_0x200392['id'];if(_0x2fa173['query'][_0xb320('0x56')]){_0xd717d1[_0xb320('0x54')]=_[_0xb320('0x58')](_0xd717d1[_0xb320('0x54')],{'$or':_['map'](_0xd717d1[_0xb320('0x4e')],function(_0x457e03){var _0x382398={};_0x382398[_0x457e03]={'$like':'%'+_0x2fa173[_0xb320('0x4a')]['filter']+'%'};return _0x382398;})});}_0xd717d1=_['merge']({},_0xd717d1,_0x2fa173[_0xb320('0x5c')]);return db[_0xb320('0x71')][_0xb320('0x1f')]({'where':_0xd717d1['where']})['then'](function(_0x37e6af){_0x20be41[_0xb320('0x1f')]=_0x37e6af;if(_0x2fa173['query'][_0xb320('0x6c')]){_0xd717d1['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xd717d1);})[_0xb320('0xe')](function(_0xc7b386){_0x20be41[_0xb320('0x6d')]=_0xc7b386;return _0x20be41;});}})[_0xb320('0xe')](respondWithFilteredResult(_0x15ec80,_0xd717d1))[_0xb320('0x19')](handleError(_0x15ec80,null));};exports[_0xb320('0x73')]=function(_0x224107,_0x4bb3a5){return db[_0xb320('0x45')]['find']({'where':{'id':_0x224107[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x4bb3a5,null))['then'](function(_0x2b729b){if(_0x2b729b){return _0x2b729b[_0xb320('0x73')](_0x224107[_0xb320('0x4a')][_0xb320('0x6f')]);}})[_0xb320('0xe')](respondWithStatusCode(_0x4bb3a5,null))[_0xb320('0x19')](handleError(_0x4bb3a5,null));};exports[_0xb320('0x68')]=function(_0x563a6c,_0x4dafc6){var _0x1e0505={'name':_0x563a6c[_0xb320('0x5e')][_0xb320('0x25')],'key':_0x563a6c['body'][_0xb320('0x49')],'provider':_0x563a6c[_0xb320('0x5e')][_0xb320('0x5f')]==='custom'?null:_0x563a6c[_0xb320('0x5e')][_0xb320('0x5f')],'email':_0x563a6c[_0xb320('0x5e')][_0xb320('0x74')],'ListId':_0x563a6c[_0xb320('0x5e')]['ListId'],'active':!_[_0xb320('0x75')](_0x563a6c[_0xb320('0x5e')][_0xb320('0x76')])?_0x563a6c[_0xb320('0x5e')][_0xb320('0x76')]:!![],'description':_0x563a6c[_0xb320('0x5e')]['description']||null};var _0x5cce08=getAuthenticationOptions(_0x1e0505[_0xb320('0x5f')],_0x563a6c['body']);_0x1e0505[_0xb320('0x3e')]=_0x5cce08[_0xb320('0x3e')];_0x1e0505['Smtp']=_0x5cce08[_0xb320('0x3f')];return db['MailAccount'][_0xb320('0x68')](_0x1e0505,{'include':[{'model':db[_0xb320('0x62')],'as':_0xb320('0x3f')},{'model':db[_0xb320('0x41')],'as':_0xb320('0x3e')}]})[_0xb320('0xe')](function(_0x224e35){var _0x3b2d95=_0x563a6c['user'][_0xb320('0x22')]({'plain':!![]});if(!_0x3b2d95)throw new Error(_0xb320('0x77'));if(_0x3b2d95[_0xb320('0x78')]===_0xb320('0x34')){var _0x385c21=_0x224e35[_0xb320('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xb320('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x3b2d95['userProfileId']},'raw':!![]})[_0xb320('0xe')](function(_0x3b45ae){if(_0x3b45ae&&_0x3b45ae['autoAssociation']===0x0){return db[_0xb320('0x79')][_0xb320('0x68')]({'name':_0x385c21[_0xb320('0x25')],'resourceId':_0x385c21['id'],'type':_0x3b45ae['name'],'sectionId':_0x3b45ae['id']},{})['then'](function(){return _0x224e35;});}else{return _0x224e35;}})[_0xb320('0x19')](function(_0x31ff76){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31ff76);throw _0x31ff76;});}return _0x224e35;})[_0xb320('0xe')](respondWithResult(_0x4dafc6,0xc9))[_0xb320('0x19')](handleError(_0x4dafc6,null));};exports[_0xb320('0x7a')]=function(_0x56f03d,_0x23bf34){return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x56f03d[_0xb320('0x61')]['id']}})['then'](handleEntityNotFound(_0x23bf34,null))[_0xb320('0xe')](function(_0x1728ab){if(_0x1728ab){return _0x1728ab[_0xb320('0x7a')]();}return null;})[_0xb320('0xe')](respondWithResult(_0x23bf34,null))[_0xb320('0x19')](handleError(_0x23bf34,null));};exports[_0xb320('0x7b')]=function(_0x28cca7,_0x2d3176){if(_0x28cca7['body']['id']){delete _0x28cca7[_0xb320('0x5e')]['id'];}return db[_0xb320('0x45')][_0xb320('0x5d')]({'where':{'id':_0x28cca7[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x2d3176,null))['then'](function(_0x250990){if(_0x250990){_0x28cca7[_0xb320('0x5e')][_0xb320('0x6b')]=_0x250990['id'];return db[_0xb320('0x41')][_0xb320('0x68')](_0x28cca7[_0xb320('0x5e')]);}})[_0xb320('0xe')](respondWithResult(_0x2d3176,null))[_0xb320('0x19')](handleError(_0x2d3176,null));};exports['removeImap']=function(_0x5e2c1e,_0x1587b2){return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x5e2c1e[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x1587b2,null))['then'](function(_0x420ec9){if(_0x420ec9){return _0x420ec9[_0xb320('0x7c')](null);}return null;})[_0xb320('0xe')](respondWithStatusCode(_0x1587b2,null))[_0xb320('0x19')](handleError(_0x1587b2,null));};exports[_0xb320('0x7d')]=function(_0x4351b0,_0x51e48c){return db['MailAccount'][_0xb320('0x6a')]({'where':{'id':_0x4351b0[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x51e48c,null))['then'](function(_0x128c6e){if(_0x128c6e){return _0x128c6e['getSmtp']();}return null;})[_0xb320('0xe')](respondWithResult(_0x51e48c,null))[_0xb320('0x19')](handleError(_0x51e48c,null));};exports['addSmtp']=function(_0x2eaa2c,_0x370d4f){if(_0x2eaa2c[_0xb320('0x5e')]['id']){delete _0x2eaa2c[_0xb320('0x5e')]['id'];}return db[_0xb320('0x45')][_0xb320('0x5d')]({'where':{'id':_0x2eaa2c['params']['id']}})['then'](handleEntityNotFound(_0x370d4f,null))[_0xb320('0xe')](function(_0x1b2110){if(_0x1b2110){_0x2eaa2c[_0xb320('0x5e')][_0xb320('0x6b')]=_0x1b2110['id'];return db[_0xb320('0x62')]['create'](_0x2eaa2c[_0xb320('0x5e')]);}})[_0xb320('0xe')](respondWithResult(_0x370d4f,null))[_0xb320('0x19')](handleError(_0x370d4f,null));};exports[_0xb320('0x7e')]=function(_0x4cf97b,_0x6e4e42){return db['MailAccount'][_0xb320('0x6a')]({'where':{'id':_0x4cf97b['params']['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x6e4e42,null))['then'](function(_0xef8fc){if(_0xef8fc){return _0xef8fc[_0xb320('0x7f')](null);}return null;})[_0xb320('0xe')](respondWithStatusCode(_0x6e4e42,null))[_0xb320('0x19')](handleError(_0x6e4e42,null));};exports[_0xb320('0x80')]=function(_0x24e70d,_0x1127de){return db['MailInteraction'][_0xb320('0x5d')]({'where':{'id':_0x24e70d['params']['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x1127de,null))['then'](function(_0x2c2df5){if(_0x2c2df5){return _0x2c2df5['addInteraction'](_0x24e70d['body']['ids'],_[_0xb320('0x81')](_0x24e70d['body'],['ids','id'])||{});}})[_0xb320('0xe')](respondWithResult(_0x1127de,null))[_0xb320('0x19')](handleError(_0x1127de,null));};exports[_0xb320('0x82')]=function(_0x4e5722,_0x4813a5){var _0x23d27b={'raw':![],'where':{}};var _0x1dab60={};var _0x5614d4={'count':0x0,'rows':[]};return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x4e5722[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x4813a5,null))[_0xb320('0xe')](function(_0x4e27d5){if(_0x4e27d5){_0x1dab60[_0xb320('0x4d')]=_[_0xb320('0x5b')](db['MailInteraction'][_0xb320('0x46')]);_0x1dab60[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x4e5722[_0xb320('0x4a')]);_0x1dab60[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x1dab60[_0xb320('0x4d')],_0x1dab60['query']);_0x23d27b[_0xb320('0x4e')]=_['intersection'](_0x1dab60[_0xb320('0x4d')],qs[_0xb320('0x4f')](_0x4e5722[_0xb320('0x4a')][_0xb320('0x4f')]));_0x23d27b[_0xb320('0x4e')]=_0x23d27b['attributes'][_0xb320('0x50')]?_0x23d27b[_0xb320('0x4e')]:_0x1dab60['model'];if(!_0x4e5722[_0xb320('0x4a')][_0xb320('0x83')](_0xb320('0x51'))){_0x23d27b[_0xb320('0x1e')]=qs[_0xb320('0x1e')](_0x4e5722['query'][_0xb320('0x1e')]);_0x23d27b[_0xb320('0x1c')]=qs['offset'](_0x4e5722[_0xb320('0x4a')][_0xb320('0x1c')]);}_0x23d27b[_0xb320('0x52')]=qs[_0xb320('0x53')](_0x4e5722[_0xb320('0x4a')]['sort']);_0x23d27b[_0xb320('0x54')]=qs['filters'](_[_0xb320('0x55')](_0x4e5722['query'],_0x1dab60[_0xb320('0x4b')]));_0x23d27b['where'][_0xb320('0x6b')]=_0x4e27d5['id'];if(_0x4e5722[_0xb320('0x4a')][_0xb320('0x56')]){_0x23d27b[_0xb320('0x54')]=_['merge'](_0x23d27b[_0xb320('0x54')],{'$or':_['map'](_0x23d27b['attributes'],function(_0x46594c){var _0x327dd1={};_0x327dd1[_0x46594c]={'$like':'%'+_0x4e5722[_0xb320('0x4a')]['filter']+'%'};return _0x327dd1;})});}_0x23d27b=_[_0xb320('0x58')]({},_0x23d27b,_0x4e5722[_0xb320('0x5c')]);return db[_0xb320('0x84')]['count']({'where':_0x23d27b[_0xb320('0x54')]})['then'](function(_0x64606f){_0x5614d4['count']=_0x64606f;if(_0x4e5722['query']['includeAll']){_0x23d27b[_0xb320('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xb320('0x85')],'as':_0xb320('0x86'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xb320('0x87')],'as':'Tags','attributes':['id','name',_0xb320('0x88')],'where':_0x4e5722[_0xb320('0x4a')][_0xb320('0x89')]?{'id':_0x4e5722['query'][_0xb320('0x89')]}:undefined,'required':_0x4e5722[_0xb320('0x4a')][_0xb320('0x89')]?!![]:![]}];}return db['MailInteraction'][_0xb320('0x8a')](_0x23d27b);})[_0xb320('0xe')](function(_0x1522b9){_0x5614d4[_0xb320('0x6d')]=_0x1522b9;return _0x5614d4;});}})[_0xb320('0xe')](respondWithFilteredResult(_0x4813a5,_0x23d27b))[_0xb320('0x19')](handleError(_0x4813a5,null));};exports[_0xb320('0x8b')]=function addApplications(_0x2d2c00,_0x3be9f0){var _0xfc6d3a=_0x2d2c00[_0xb320('0x61')]['id'];var _0x3341f8=_0x2d2c00[_0xb320('0x5e')];var _0x27890d=0xc8;var _0x331b0f=null;return db[_0xb320('0x8c')]['transaction']({'isolationLevel':db[_0xb320('0x8c')][_0xb320('0x8d')][_0xb320('0x8e')][_0xb320('0x8f')]},function(_0x2f6585){return db[_0xb320('0x45')]['findOne']({'where':{'id':_0xfc6d3a},'transaction':_0x2f6585})['then'](function(_0x5e8876){if(_0x5e8876){return db[_0xb320('0x90')][_0xb320('0x21')]({'where':{'MailAccountId':_0xfc6d3a},'transaction':_0x2f6585})[_0xb320('0xe')](function(){var _0x3f5f71=_['map'](_0x3341f8,function(_0x110105){_0x110105[_0xb320('0x6b')]=_0xfc6d3a;return _0x110105;});return db[_0xb320('0x90')]['bulkCreate'](_0x3f5f71,{'transaction':_0x2f6585});});}else{_0x27890d=0x194;_0x331b0f=[];}});})['then'](function(){if(_0x27890d!==0x194){return db[_0xb320('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0xfc6d3a},'order':_0xb320('0x91')})[_0xb320('0xe')](function(_0x5abf1f){_0x331b0f=_0x5abf1f;});}})['catch'](function(_0x29dc3e){_0x27890d=0x1f4;logger[_0xb320('0x14')](_0x29dc3e[_0xb320('0x24')]);if(_0x29dc3e['name']){delete _0x29dc3e[_0xb320('0x25')];}_0x331b0f=_0x29dc3e;})[_0xb320('0x92')](function(){if(_0x331b0f===null){_0x3be9f0[_0xb320('0x1a')](_0x27890d);}else{if(_0x27890d===0x1f4){_0x3be9f0[_0xb320('0x1b')](_0x27890d)[_0xb320('0x26')](_0x331b0f);}else{_0x3be9f0[_0xb320('0x1b')](_0x27890d)[_0xb320('0x20')](_0x331b0f);}}});};exports[_0xb320('0x93')]=function(_0x50f0f5,_0x373bd0){var _0x50b6ba={};var _0x273d5f={};var _0x1efc7f;var _0x107ff8;return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x50f0f5[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x373bd0,null))[_0xb320('0xe')](function(_0x1389ba){if(_0x1389ba){_0x1efc7f=_0x1389ba;_0x273d5f[_0xb320('0x4d')]=_[_0xb320('0x5b')](db[_0xb320('0x90')][_0xb320('0x46')]);_0x273d5f[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x50f0f5[_0xb320('0x4a')]);_0x273d5f[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x273d5f[_0xb320('0x4d')],_0x273d5f[_0xb320('0x4a')]);_0x50b6ba[_0xb320('0x4e')]=_[_0xb320('0x4c')](_0x273d5f[_0xb320('0x4d')],qs[_0xb320('0x4f')](_0x50f0f5[_0xb320('0x4a')]['fields']));_0x50b6ba[_0xb320('0x4e')]=_0x50b6ba['attributes'][_0xb320('0x50')]?_0x50b6ba[_0xb320('0x4e')]:_0x273d5f['model'];_0x50b6ba[_0xb320('0x52')]=qs['sort'](_0x50f0f5['query']['sort']);_0x50b6ba[_0xb320('0x54')]=qs['filters'](_[_0xb320('0x55')](_0x50f0f5[_0xb320('0x4a')],_0x273d5f[_0xb320('0x4b')]));if(_0x50f0f5['query'][_0xb320('0x56')]){_0x50b6ba[_0xb320('0x54')]=_[_0xb320('0x58')](_0x50b6ba['where'],{'$or':_[_0xb320('0x44')](_0x50b6ba[_0xb320('0x4e')],function(_0x156d27){var _0x340669={};_0x340669[_0x156d27]={'$like':'%'+_0x50f0f5[_0xb320('0x4a')][_0xb320('0x56')]+'%'};return _0x340669;})});}_0x50b6ba=_['merge']({},_0x50b6ba,_0x50f0f5['options']);return _0x1efc7f['getApplications'](_0x50b6ba);}})[_0xb320('0xe')](function(_0x35b254){if(_0x35b254){_0x107ff8=_0x35b254['length'];if(!_0x50f0f5[_0xb320('0x4a')]['hasOwnProperty'](_0xb320('0x51'))){_0x50b6ba[_0xb320('0x1e')]=qs['limit'](_0x50f0f5[_0xb320('0x4a')][_0xb320('0x1e')]);_0x50b6ba[_0xb320('0x1c')]=qs[_0xb320('0x1c')](_0x50f0f5[_0xb320('0x4a')][_0xb320('0x1c')]);}return _0x1efc7f['getApplications'](_0x50b6ba);}})[_0xb320('0xe')](function(_0x22174c){if(_0x22174c){return _0x22174c?{'count':_0x107ff8,'rows':_0x22174c}:null;}})['then'](respondWithResult(_0x373bd0,null))['catch'](handleError(_0x373bd0,null));};exports[_0xb320('0x94')]=function(_0x424f08,_0x4acd66){var _0x3c49be={'raw':!![],'where':{}};var _0x29bb64={};var _0x5f0155={'count':0x0,'rows':[]};return db['MailAccount'][_0xb320('0x6a')]({'where':{'id':_0x424f08['params']['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x4acd66,null))[_0xb320('0xe')](function(_0x41cae4){if(_0x41cae4){_0x29bb64[_0xb320('0x4d')]=_['keys'](db[_0xb320('0x95')][_0xb320('0x46')]);_0x29bb64['query']=_['keys'](_0x424f08[_0xb320('0x4a')]);_0x29bb64['filters']=_[_0xb320('0x4c')](_0x29bb64['model'],_0x29bb64[_0xb320('0x4a')]);_0x3c49be['attributes']=_[_0xb320('0x4c')](_0x29bb64['model'],qs[_0xb320('0x4f')](_0x424f08[_0xb320('0x4a')][_0xb320('0x4f')]));_0x3c49be[_0xb320('0x4e')]=_0x3c49be[_0xb320('0x4e')][_0xb320('0x50')]?_0x3c49be[_0xb320('0x4e')]:_0x29bb64[_0xb320('0x4d')];if(!_0x424f08['query'][_0xb320('0x83')](_0xb320('0x51'))){_0x3c49be[_0xb320('0x1e')]=qs[_0xb320('0x1e')](_0x424f08[_0xb320('0x4a')][_0xb320('0x1e')]);_0x3c49be['offset']=qs['offset'](_0x424f08[_0xb320('0x4a')]['offset']);}_0x3c49be[_0xb320('0x52')]=qs['sort'](_0x424f08[_0xb320('0x4a')][_0xb320('0x53')]);_0x3c49be[_0xb320('0x54')]=qs['filters'](_[_0xb320('0x55')](_0x424f08[_0xb320('0x4a')],_0x29bb64[_0xb320('0x4b')]));_0x3c49be[_0xb320('0x54')]['MailAccountId']=_0x41cae4['id'];if(_0x424f08[_0xb320('0x4a')][_0xb320('0x56')]){_0x3c49be[_0xb320('0x54')]=_[_0xb320('0x58')](_0x3c49be[_0xb320('0x54')],{'$or':_[_0xb320('0x44')](_0x3c49be[_0xb320('0x4e')],function(_0xbf75ab){var _0x174a36={};_0x174a36[_0xbf75ab]={'$like':'%'+_0x424f08['query']['filter']+'%'};return _0x174a36;})});}if(_0x424f08[_0xb320('0x4a')][_0xb320('0x96')]){var _0x15da98=_0x424f08[_0xb320('0x4a')][_0xb320('0x96')][_0xb320('0x97')](',');var _0x431283={};_0x431283[_0x15da98[0x0]]={'$gte':moment(_0x15da98[0x1])[_0xb320('0x98')](_0xb320('0x99'))};_0x3c49be[_0xb320('0x54')]=_[_0xb320('0x58')](_0x3c49be[_0xb320('0x54')],_0x431283);}_0x3c49be=_[_0xb320('0x58')]({},_0x3c49be,_0x424f08[_0xb320('0x5c')]);return db[_0xb320('0x95')]['count']({'where':_0x3c49be[_0xb320('0x54')]})['then'](function(_0x433cd3){_0x5f0155[_0xb320('0x1f')]=_0x433cd3;if(_0x424f08[_0xb320('0x4a')]['includeAll']){_0x3c49be['include']=[{'all':!![]}];}return db[_0xb320('0x95')][_0xb320('0x8a')](_0x3c49be);})['then'](function(_0x3ab8f1){if(_0x424f08[_0xb320('0x4a')][_0xb320('0x9a')]===_0xb320('0x9b')){for(var _0x134638=0x0;_0x134638<_0x3ab8f1[_0xb320('0x50')];_0x134638++){_0x3ab8f1[_0x134638][_0xb320('0x5e')]=juice(_0x3ab8f1[_0x134638][_0xb320('0x5e')]);}}_0x5f0155[_0xb320('0x6d')]=_0x3ab8f1;return _0x5f0155;});}})[_0xb320('0xe')](respondWithFilteredResult(_0x4acd66,_0x3c49be))['catch'](handleError(_0x4acd66,null));};exports[_0xb320('0x26')]=function(_0xa81456,_0x354ddb){var _0x2c1713,_0x205c39={},_0x27a176;if(_0xa81456[_0xb320('0x5e')]['to']){_0x27a176=_0xa81456[_0xb320('0x5e')]['to'][_0xb320('0x97')](',')[0x0];}return db['MailAccount'][_0xb320('0x5d')]({'where':{'id':_0xa81456[_0xb320('0x61')]['id']},'include':[{'model':db[_0xb320('0x9c')],'as':_0xb320('0x9d'),'include':[{'model':db[_0xb320('0x9e')],'as':'Contacts','where':{'email':_0x27a176},'limit':0x1,'order':[[_0xb320('0x9f'),_0xb320('0xa0')]]}]},{'model':db[_0xb320('0x62')],'as':_0xb320('0x3f'),'raw':!![],'include':[{'model':db[_0xb320('0xa1')],'as':_0xb320('0xa1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x354ddb,null))[_0xb320('0xe')](function(_0x4b5bc3){if(!_0x4b5bc3)return;_0x2c1713=_0x4b5bc3;if(!_0x4b5bc3[_0xb320('0x3f')])throw new Error(_0xb320('0xa2'));if(_[_0xb320('0x75')](_0xa81456[_0xb320('0x5e')][_0xb320('0xa3')])){_0xa81456['body'][_0xb320('0xa3')]=util[_0xb320('0x98')]('%s\x20<%s>',_0x4b5bc3[_0xb320('0x25')],_0x4b5bc3['email']||_0x4b5bc3['Smtp'][_0xb320('0x34')]);}if(_0xa81456[_0xb320('0x5e')]['attachments']&&_0xa81456[_0xb320('0x5e')][_0xb320('0xa4')][_0xb320('0x50')]){for(var _0x15cc36=0x0;_0x15cc36<_0xa81456[_0xb320('0x5e')]['attachments']['length'];_0x15cc36+=0x1){_0xa81456[_0xb320('0x5e')][_0xb320('0xa4')][_0x15cc36]={'filename':_0xa81456[_0xb320('0x5e')][_0xb320('0xa4')][_0x15cc36]['name'],'path':path[_0xb320('0xa5')](config[_0xb320('0xa6')],_0xb320('0xa7'),_0xa81456[_0xb320('0x5e')][_0xb320('0xa4')][_0x15cc36][_0xb320('0xa8')])};}}var _0x47ac27=_0x4b5bc3[_0xb320('0xa9')]();return respondWithRpcPromise(_0xb320('0xaa'),_0xb320('0xab'),{'account':_0x47ac27,'message':_0xa81456[_0xb320('0x5e')]});})[_0xb320('0xe')](function(_0x5e8bf7){if(!_0x5e8bf7)return;_0x205c39=_0x5e8bf7;if(!_0x2c1713['List'])throw new Error('List\x20not\x20found');if(_0x2c1713[_0xb320('0x9d')]['Contacts'][_0xb320('0x50')])return _0x2c1713[_0xb320('0x9d')][_0xb320('0xac')][0x0];return db[_0xb320('0x9e')][_0xb320('0x68')](_[_0xb320('0xad')](_0xa81456[_0xb320('0x5e')],{'firstName':_0xa81456['body']['to'],'email':_0xa81456['body']['to'],'phone':_0xa81456['body']['to'],'ListId':_0x2c1713[_0xb320('0xae')]}));})['then'](function(_0x444764){if(!_0x444764)return;var _0x32b42a={'UserId':_0xa81456[_0xb320('0x34')]['id'],'ContactId':_0x444764['id'],'MailAccountId':_0x2c1713['id'],'inReplyTo':_0x205c39[_0xb320('0xaf')],'to':_0xa81456[_0xb320('0x5e')][_0xb320('0xa3')],'cc':_0xa81456[_0xb320('0x5e')]['cc'],'subject':_0xa81456[_0xb320('0x5e')]['subject'],'attach':_0xa81456['body'][_0xb320('0xb0')],'firstMsgDirection':_0xb320('0xb1'),'lastMsgAt':moment()[_0xb320('0x98')](_0xb320('0x99')),'lastMsgDirection':'out','Messages':[_[_0xb320('0x58')](_0xa81456[_0xb320('0x5e')],{'messageId':_0x205c39[_0xb320('0xaf')],'sentAt':moment()[_0xb320('0x98')](_0xb320('0x99')),'read':!![],'MailAccountId':_0x2c1713['id'],'UserId':_0xa81456['user']['id'],'ContactId':_0x444764['id']})]};if(_0xa81456[_0xb320('0x5e')]['Interaction']){_0x32b42a=_[_0xb320('0x58')](_0x32b42a,_0xa81456[_0xb320('0x5e')]['Interaction']);}return db[_0xb320('0x84')][_0xb320('0x68')](_0x32b42a,{'include':[{'model':db[_0xb320('0x95')],'as':_0xb320('0xb2')}]});})[_0xb320('0xe')](respondWithResult(_0x354ddb,null))['catch'](handleError(_0x354ddb,null));};exports['verifySmtp']=function(_0x12febd,_0x4b4ee1){return db[_0xb320('0x45')][_0xb320('0x5d')]({'where':{'id':_0x12febd[_0xb320('0x61')]['id']},'include':[{'model':db[_0xb320('0x62')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb320('0xa1')],'as':_0xb320('0xa1'),'raw':!![]}]}]})[_0xb320('0xe')](handleEntityNotFound(_0x4b4ee1,null))[_0xb320('0xe')](function(_0x18d8d5){if(!_0x18d8d5['Smtp'])return;var _0x501df2=_0x18d8d5[_0xb320('0xa9')]();return respondWithRpcPromise(_0xb320('0xb3'),_0xb320('0xb4'),{'account':_0x501df2});})[_0xb320('0xe')](respondWithResult(_0x4b4ee1,null))[_0xb320('0x19')](handleError(_0x4b4ee1,null));};exports[_0xb320('0x21')]=function(_0x5a2df1,_0x7fe0e7){return db['MailAccount'][_0xb320('0x5d')]({'where':{'id':_0x5a2df1[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x7fe0e7,null))[_0xb320('0xe')](function(_0x5150f0){if(_0x5150f0&&_0x5150f0[_0xb320('0x3c')]){throw new db[(_0xb320('0xb5'))][(_0xb320('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5150f0;})['then'](removeEntity(_0x7fe0e7,null))['catch'](handleError(_0x7fe0e7,null));};exports['addAgents']=function(_0x2b6a7d,_0x84d641){return db['MailAccount'][_0xb320('0x5d')]({'where':{'id':_0x2b6a7d[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x84d641,null))[_0xb320('0xe')](function(_0x591c8a){if(_0x591c8a){return _0x591c8a[_0xb320('0xb7')](_0x2b6a7d[_0xb320('0x5e')][_0xb320('0x6f')],_['omit'](_0x2b6a7d[_0xb320('0x5e')],[_0xb320('0x6f'),'id'])||{})[_0xb320('0xb8')](function(_0x57809e){for(var _0x52495f=0x0;_0x52495f<_0x2b6a7d[_0xb320('0x5e')][_0xb320('0x6f')][_0xb320('0x50')];_0x52495f+=0x1){socket['emit'](_0xb320('0xb9'),{'UserId':Number(_0x2b6a7d[_0xb320('0x5e')][_0xb320('0x6f')][_0x52495f]),'MailAccountId':Number(_0x2b6a7d['params']['id'])});}return _0x57809e;});}})[_0xb320('0xe')](respondWithResult(_0x84d641,null))[_0xb320('0x19')](handleError(_0x84d641,null));};exports[_0xb320('0xba')]=function(_0xce9a29,_0x2cd508){return db[_0xb320('0x45')]['find']({'where':{'id':_0xce9a29[_0xb320('0x61')]['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x2cd508,null))['then'](function(_0x29981c){if(_0x29981c){return _0x29981c[_0xb320('0xba')](_0xce9a29[_0xb320('0x4a')][_0xb320('0x6f')])[_0xb320('0xe')](function(){if(_[_0xb320('0xbb')](_0xce9a29['query'][_0xb320('0x6f')])){for(var _0x5886a1=0x0;_0x5886a1<_0xce9a29[_0xb320('0x4a')][_0xb320('0x6f')][_0xb320('0x50')];_0x5886a1+=0x1){socket[_0xb320('0xbc')]('userMailAccount:remove',{'UserId':Number(_0xce9a29['query'][_0xb320('0x6f')][_0x5886a1]),'MailAccountId':Number(_0xce9a29[_0xb320('0x61')]['id'])});}}else{socket[_0xb320('0xbc')]('userMailAccount:remove',{'UserId':Number(_0xce9a29[_0xb320('0x4a')][_0xb320('0x6f')]),'MailAccountId':Number(_0xce9a29['params']['id'])});}});}})[_0xb320('0xe')](respondWithStatusCode(_0x2cd508,null))[_0xb320('0x19')](handleError(_0x2cd508,null));};exports['getAgents']=function(_0x3e3a72,_0x2ab48){var _0x5f4747={};var _0x3c837e={};var _0x53a4b1;var _0x1973d2;return db[_0xb320('0x45')][_0xb320('0x6a')]({'where':{'id':_0x3e3a72['params']['id']}})[_0xb320('0xe')](handleEntityNotFound(_0x2ab48,null))['then'](function(_0x299d1f){if(_0x299d1f){_0x53a4b1=_0x299d1f;_0x3c837e['model']=_['keys'](db['User'][_0xb320('0x46')]);_0x3c837e[_0xb320('0x4a')]=_[_0xb320('0x5b')](_0x3e3a72[_0xb320('0x4a')]);_0x3c837e[_0xb320('0x4b')]=_[_0xb320('0x4c')](_0x3c837e[_0xb320('0x4d')],_0x3c837e['query']);_0x5f4747[_0xb320('0x4e')]=_[_0xb320('0x4c')](_0x3c837e['model'],qs[_0xb320('0x4f')](_0x3e3a72[_0xb320('0x4a')][_0xb320('0x4f')]));_0x5f4747['attributes']=_0x5f4747[_0xb320('0x4e')][_0xb320('0x50')]?_0x5f4747[_0xb320('0x4e')]:_0x3c837e['model'];_0x5f4747[_0xb320('0x52')]=qs[_0xb320('0x53')](_0x3e3a72['query'][_0xb320('0x53')]);_0x5f4747[_0xb320('0x54')]=qs['filters'](_['pick'](_0x3e3a72['query'],_0x3c837e['filters']));if(_0x3e3a72[_0xb320('0x4a')][_0xb320('0x56')]){_0x5f4747[_0xb320('0x54')]=_['merge'](_0x5f4747[_0xb320('0x54')],{'$or':_[_0xb320('0x44')](_0x5f4747[_0xb320('0x4e')],function(_0x21a5b4){var _0x2cbb02={};_0x2cbb02[_0x21a5b4]={'$like':'%'+_0x3e3a72['query']['filter']+'%'};return _0x2cbb02;})});}_0x5f4747=_[_0xb320('0x58')]({},_0x5f4747,_0x3e3a72[_0xb320('0x5c')]);return _0x53a4b1[_0xb320('0xbd')](_0x5f4747);}})[_0xb320('0xe')](function(_0xf68dd3){if(_0xf68dd3){_0x1973d2=_0xf68dd3[_0xb320('0x50')];if(!_0x3e3a72['query'][_0xb320('0x83')](_0xb320('0x51'))){_0x5f4747[_0xb320('0x1e')]=qs[_0xb320('0x1e')](_0x3e3a72['query']['limit']);_0x5f4747[_0xb320('0x1c')]=qs[_0xb320('0x1c')](_0x3e3a72[_0xb320('0x4a')][_0xb320('0x1c')]);}return _0x53a4b1['getAgents'](_0x5f4747);}})['then'](function(_0x24f6eb){if(_0x24f6eb){return _0x24f6eb?{'count':_0x1973d2,'rows':_0x24f6eb}:null;}})[_0xb320('0xe')](respondWithResult(_0x2ab48,null))[_0xb320('0x19')](handleError(_0x2ab48,null));}; \ No newline at end of file +var _0x8648=['spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','hotmail','Unknown\x20email\x20service\x20provider','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','findAll','rows','show','params','MailServerOut','Pause','find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','pick','MailAccountId','filter','include','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','List','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit'];(function(_0x1b0aa0,_0x4b00ab){var _0x5abafe=function(_0x1a72fe){while(--_0x1a72fe){_0x1b0aa0['push'](_0x1b0aa0['shift']());}};_0x5abafe(++_0x4b00ab);}(_0x8648,0xd1));var _0x8864=function(_0x10e252,_0x30722){_0x10e252=_0x10e252-0x0;var _0x1a7b0f=_0x8648[_0x10e252];return _0x1a7b0f;};'use strict';var moment=require('moment');var BPromise=require(_0x8864('0x0'));var util=require(_0x8864('0x1'));var path=require(_0x8864('0x2'));var _=require('lodash');var juice=require(_0x8864('0x3'));var Redis=require(_0x8864('0x4'));var qs=require(_0x8864('0x5'));var logger=require(_0x8864('0x6'))(_0x8864('0x7'));var config=require(_0x8864('0x8'));var db=require(_0x8864('0x9'))['db'];config['redis']=_[_0x8864('0xa')](config[_0x8864('0xb')],{'host':_0x8864('0xc'),'port':0x18eb});var socket=require(_0x8864('0xd'))(new Redis(config['redis']));require(_0x8864('0xe'))[_0x8864('0xf')](socket);var jayson=require(_0x8864('0x10'));var client=jayson[_0x8864('0x11')][_0x8864('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x5a85e2,_0x47a642,_0x1b5ad6,_0x16351a){return new BPromise(function(_0xc22667,_0x1df210){var _0x380453=_0x16351a||client;return _0x380453[_0x8864('0x13')](_0x5a85e2,_0x1b5ad6)[_0x8864('0x14')](function(_0x22861f){logger[_0x8864('0x15')](_0x8864('0x16'),_0x47a642,_0x8864('0x17'));logger['debug'](_0x8864('0x18'),_0x47a642,_0x8864('0x17'),JSON['stringify'](_0x22861f));if(_0x22861f[_0x8864('0x19')]){if(_0x22861f[_0x8864('0x19')][_0x8864('0x1a')]===0x1f4){logger[_0x8864('0x19')](_0x8864('0x16'),_0x47a642,_0x22861f[_0x8864('0x19')]['message']);return _0x1df210(_0x22861f[_0x8864('0x19')]['message']);}logger[_0x8864('0x19')](_0x8864('0x16'),_0x47a642,_0x22861f['error'][_0x8864('0x1b')]);return _0xc22667(_0x22861f[_0x8864('0x19')]['message']);}else{logger[_0x8864('0x15')]('MailAccount,\x20%s,\x20%s',_0x47a642,'request\x20sent');_0xc22667(_0x22861f[_0x8864('0x1c')][_0x8864('0x1b')]);}})[_0x8864('0x1d')](function(_0x11675c){logger[_0x8864('0x19')](_0x8864('0x16'),_0x47a642,_0x11675c);_0x1df210(_0x11675c);});});}function respondWithStatusCode(_0x4167db,_0x57ffdb){_0x57ffdb=_0x57ffdb||0xcc;return function(_0x5e0744){if(_0x5e0744){return _0x4167db[_0x8864('0x1e')](_0x57ffdb);}return _0x4167db[_0x8864('0x1f')](_0x57ffdb)[_0x8864('0x20')]();};}function respondWithResult(_0x185e00,_0x571791){_0x571791=_0x571791||0xc8;return function(_0x51a244){if(_0x51a244){return _0x185e00['status'](_0x571791)[_0x8864('0x21')](_0x51a244);}};}function respondWithFilteredResult(_0x169773,_0x326f48){return function(_0x12956f){if(_0x12956f){var _0x528d31=typeof _0x326f48['offset']===_0x8864('0x22')&&typeof _0x326f48['limit']===_0x8864('0x22');var _0x29e152=_0x12956f[_0x8864('0x23')];var _0x5557e8=_0x528d31?0x0:_0x326f48[_0x8864('0x24')];var _0x3a489d=_0x528d31?_0x12956f[_0x8864('0x23')]:_0x326f48['offset']+_0x326f48[_0x8864('0x25')];var _0x89a02;if(_0x3a489d>=_0x29e152){_0x3a489d=_0x29e152;_0x89a02=0xc8;}else{_0x89a02=0xce;}_0x169773['status'](_0x89a02);return _0x169773[_0x8864('0x26')](_0x8864('0x27'),_0x5557e8+'-'+_0x3a489d+'/'+_0x29e152)[_0x8864('0x21')](_0x12956f);}return null;};}function saveUpdates(_0x57a03){return function(_0x1bdb76){if(_0x1bdb76){return _0x1bdb76['update'](_0x57a03)['then'](function(_0x3fb73c){return _0x3fb73c;});}return null;};}function removeEntity(_0xd25cd6){return function(_0x59fe94){if(_0x59fe94){return _0x59fe94[_0x8864('0x28')]()[_0x8864('0x14')](function(){var _0x597876=_0x59fe94[_0x8864('0x29')]({'plain':!![]});var _0x38dec0=_0x8864('0x2a');return db[_0x8864('0x2b')][_0x8864('0x28')]({'where':{'type':_0x38dec0,'resourceId':_0x597876['id']}})[_0x8864('0x14')](function(){return _0x59fe94;});})[_0x8864('0x14')](function(){_0xd25cd6['status'](0xcc)[_0x8864('0x20')]();});}};}function handleEntityNotFound(_0x1a797f){return function(_0x50f6fd){if(!_0x50f6fd){_0x1a797f[_0x8864('0x1e')](0x194);}return _0x50f6fd;};}function handleError(_0x3f69cf,_0x443b86){_0x443b86=_0x443b86||0x1f4;return function(_0xd77840){logger[_0x8864('0x19')](_0xd77840[_0x8864('0x2c')]);if(_0xd77840[_0x8864('0x2d')]){delete _0xd77840[_0x8864('0x2d')];}_0x3f69cf[_0x8864('0x1f')](_0x443b86)[_0x8864('0x2e')](_0xd77840);};}function getImapHost(_0x226636){switch(_0x226636){case _0x8864('0x2f'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x8864('0x30'):return'imap-mail.outlook.com';case'outlook365':return'outlook.office365.com';}throw new Error(_0x8864('0x31'),_0x226636);}function getSmtpHost(_0x7b48da){switch(_0x7b48da){case'gmail':return'smtp.gmail.com';case _0x8864('0x32'):return _0x8864('0x33');case'hotmail':return _0x8864('0x34');case _0x8864('0x35'):return _0x8864('0x36');}throw new Error(_0x8864('0x31'),_0x7b48da);}function getAuthenticationOptions(_0x1c6305,_0x2a47dc){var _0xc547fa={};var _0x19fda0={};if(_0x1c6305){_0xc547fa['user']=_0x19fda0[_0x8864('0x37')]=_0x2a47dc[_0x8864('0x38')];_0xc547fa[_0x8864('0x39')]=_0x19fda0['pass']=_0x2a47dc[_0x8864('0x39')];if(_0x2a47dc['modernAuthentication']){_0xc547fa[_0x8864('0x3a')]=_0x19fda0[_0x8864('0x3a')]=!![];_0xc547fa[_0x8864('0x3b')]=_0x19fda0[_0x8864('0x3b')]=_0x2a47dc[_0x8864('0x3b')];_0xc547fa[_0x8864('0x39')]=_0x19fda0[_0x8864('0x3c')]=null;}else{_0xc547fa[_0x8864('0x3b')]=_0x19fda0[_0x8864('0x3b')]=null;}_0xc547fa[_0x8864('0x3d')]=getImapHost(_0x1c6305);_0xc547fa[_0x8864('0x3e')]=0x3e1;_0x19fda0[_0x8864('0x3d')]=getSmtpHost(_0x1c6305);_0x19fda0[_0x8864('0x3e')]=0x24b;_0x19fda0[_0x8864('0x3f')]=![];_0xc547fa[_0x8864('0x40')]=_0x19fda0[_0x8864('0x40')]=null;}else{if(_0x2a47dc[_0x8864('0x41')]){_0xc547fa[_0x8864('0x37')]=_0x19fda0[_0x8864('0x37')]=_0x2a47dc[_0x8864('0x38')];_0xc547fa[_0x8864('0x39')]=_0x19fda0[_0x8864('0x3c')]=_0x2a47dc['password'];}else{_0xc547fa[_0x8864('0x41')]=_0x19fda0[_0x8864('0x41')]=![];_0xc547fa['user']=_0x19fda0[_0x8864('0x37')]=null;_0xc547fa['password']=_0x19fda0[_0x8864('0x3c')]=null;}_0xc547fa[_0x8864('0x3d')]=_0x2a47dc[_0x8864('0x42')][_0x8864('0x3d')];_0xc547fa[_0x8864('0x3e')]=_0x2a47dc[_0x8864('0x42')][_0x8864('0x3e')];_0x19fda0[_0x8864('0x3d')]=_0x2a47dc[_0x8864('0x43')][_0x8864('0x3d')];_0x19fda0[_0x8864('0x3e')]=_0x2a47dc[_0x8864('0x43')][_0x8864('0x3e')];}return{'Imap':_0xc547fa,'Smtp':_0x19fda0};}exports[_0x8864('0x44')]=function(_0x4da316,_0x259dbf){var _0x169348={'include':[{'model':db[_0x8864('0x45')],'as':_0x8864('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x8864('0x46')}]},_0x468719={},_0x2edf9f={'count':0x0,'rows':[]};var _0x3b90ec=_[_0x8864('0x47')](db[_0x8864('0x48')][_0x8864('0x49')],function(_0x90bdf6){return{'name':_0x90bdf6[_0x8864('0x4a')],'type':_0x90bdf6[_0x8864('0x4b')][_0x8864('0x4c')]};});_0x468719['model']=_[_0x8864('0x47')](_0x3b90ec,_0x8864('0x2d'));_0x468719[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x4da316[_0x8864('0x4d')]);_0x468719[_0x8864('0x4f')]=_[_0x8864('0x50')](_0x468719['model'],_0x468719[_0x8864('0x4d')]);_0x169348['attributes']=_[_0x8864('0x50')](_0x468719['model'],qs[_0x8864('0x51')](_0x4da316[_0x8864('0x4d')][_0x8864('0x51')]));_0x169348['attributes']=_0x169348[_0x8864('0x52')][_0x8864('0x53')]?_0x169348[_0x8864('0x52')]:_0x468719[_0x8864('0x54')];if(!_0x4da316['query'][_0x8864('0x55')](_0x8864('0x56'))){_0x169348[_0x8864('0x25')]=qs['limit'](_0x4da316['query']['limit']);_0x169348['offset']=qs[_0x8864('0x24')](_0x4da316['query'][_0x8864('0x24')]);}_0x169348[_0x8864('0x57')]=qs[_0x8864('0x58')](_0x4da316[_0x8864('0x4d')]['sort']);_0x169348[_0x8864('0x59')]=qs[_0x8864('0x4f')](_['pick'](_0x4da316['query'],_0x468719[_0x8864('0x4f')]),_0x3b90ec);if(_0x4da316[_0x8864('0x4d')]['filter']){_0x169348[_0x8864('0x59')]=_[_0x8864('0x5a')](_0x169348[_0x8864('0x59')],{'$or':_[_0x8864('0x47')](_0x3b90ec,function(_0x4b92c6){if(_0x4b92c6[_0x8864('0x4b')]!=='VIRTUAL'){var _0x1c642d={};_0x1c642d[_0x4b92c6[_0x8864('0x2d')]]={'$like':'%'+_0x4da316[_0x8864('0x4d')]['filter']+'%'};return _0x1c642d;}})});}_0x169348=_[_0x8864('0x5a')]({},_0x169348,_0x4da316[_0x8864('0x5b')]);var _0x5dd795={'where':_0x169348['where']};return db[_0x8864('0x48')][_0x8864('0x23')](_0x5dd795)[_0x8864('0x14')](function(_0x1946d9){_0x2edf9f[_0x8864('0x23')]=_0x1946d9;if(_0x4da316[_0x8864('0x4d')][_0x8864('0x5c')]){_0x169348['include']=[{'all':!![]}];}return db[_0x8864('0x48')][_0x8864('0x5d')](_0x169348);})[_0x8864('0x14')](function(_0x4089c0){_0x2edf9f[_0x8864('0x5e')]=_0x4089c0;return _0x2edf9f;})[_0x8864('0x14')](respondWithFilteredResult(_0x259dbf,_0x169348))['catch'](handleError(_0x259dbf,null));};exports[_0x8864('0x5f')]=function(_0x47eea0,_0x261c7f){var _0x56e49c={'raw':![],'where':{'id':_0x47eea0[_0x8864('0x60')]['id']},'include':[{'model':db[_0x8864('0x45')],'as':_0x8864('0x42')},{'model':db[_0x8864('0x61')],'as':_0x8864('0x43')},{'model':db[_0x8864('0x62')],'as':_0x8864('0x46')}]},_0x6ed6fb={};_0x6ed6fb[_0x8864('0x54')]=_['keys'](db[_0x8864('0x48')][_0x8864('0x49')]);_0x6ed6fb[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x47eea0[_0x8864('0x4d')]);_0x6ed6fb[_0x8864('0x4f')]=_[_0x8864('0x50')](_0x6ed6fb[_0x8864('0x54')],_0x6ed6fb[_0x8864('0x4d')]);_0x56e49c[_0x8864('0x52')]=_[_0x8864('0x50')](_0x6ed6fb['model'],qs[_0x8864('0x51')](_0x47eea0[_0x8864('0x4d')][_0x8864('0x51')]));_0x56e49c[_0x8864('0x52')]=_0x56e49c[_0x8864('0x52')][_0x8864('0x53')]?_0x56e49c[_0x8864('0x52')]:_0x6ed6fb[_0x8864('0x54')];if(_0x47eea0[_0x8864('0x4d')]['includeAll']){_0x56e49c['include']=[{'all':!![]}];}_0x56e49c=_['merge']({},_0x56e49c,_0x47eea0[_0x8864('0x5b')]);return db[_0x8864('0x48')][_0x8864('0x63')](_0x56e49c)[_0x8864('0x14')](handleEntityNotFound(_0x261c7f,null))[_0x8864('0x14')](respondWithResult(_0x261c7f,null))[_0x8864('0x1d')](handleError(_0x261c7f,null));};exports[_0x8864('0x64')]=function(_0x31ece4,_0x1a8894){if(_0x31ece4['body']['id']){delete _0x31ece4['body']['id'];}var _0x3554ae=_0x31ece4[_0x8864('0x65')][_0x8864('0x66')]===_0x8864('0x67')?null:_0x31ece4[_0x8864('0x65')]['provider'];var _0x18c2d5=_0x31ece4[_0x8864('0x65')]['Imap']||{};var _0x13baea=_0x31ece4['body'][_0x8864('0x43')]||{};if(_0x3554ae){_0x18c2d5[_0x8864('0x3d')]=getImapHost(_0x3554ae);_0x18c2d5[_0x8864('0x3e')]=0x3e1;_0x13baea['host']=getSmtpHost(_0x3554ae);_0x13baea['port']=0x24b;_0x13baea[_0x8864('0x3f')]=![];}if(_0x13baea[_0x8864('0x3a')]){_0x13baea['secure']=![];}else{_0x13baea['CloudProviderId']=null;}if(!_0x18c2d5[_0x8864('0x3a')])_0x18c2d5[_0x8864('0x3b')]=null;_0x31ece4[_0x8864('0x65')]['Imap']=_0x18c2d5;_0x31ece4['body'][_0x8864('0x43')]=_0x13baea;return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x31ece4[_0x8864('0x60')]['id']},'include':[{'model':db[_0x8864('0x45')],'as':_0x8864('0x42')},{'model':db[_0x8864('0x61')],'as':_0x8864('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1a8894,null))[_0x8864('0x14')](function(_0x42bed5){if(!_0x42bed5)throw new Error(_0x8864('0x68'));if(_0x42bed5[_0x8864('0x40')])delete _0x31ece4[_0x8864('0x65')][_0x8864('0x42')];return _0x42bed5;})['then'](saveUpdates(_0x31ece4['body'],null))['then'](function(_0x1b1c16){if(!_0x31ece4['body'][_0x8864('0x42')])return _0x1b1c16;return db[_0x8864('0x45')][_0x8864('0x64')](_0x31ece4[_0x8864('0x65')][_0x8864('0x42')],{'where':{'MailAccountId':_0x1b1c16['id']}})['then'](function(){return _0x1b1c16;});})[_0x8864('0x14')](function(_0x50f808){if(!_0x31ece4[_0x8864('0x65')][_0x8864('0x43')])return _0x50f808;return db[_0x8864('0x61')]['update'](_0x31ece4['body'][_0x8864('0x43')],{'where':{'MailAccountId':_0x50f808['id']}})[_0x8864('0x14')](function(){return _0x50f808;});})[_0x8864('0x14')](respondWithResult(_0x1a8894,null))[_0x8864('0x1d')](handleError(_0x1a8894,null));};exports[_0x8864('0x69')]=function(_0x5e8caf,_0x4585f6){return db[_0x8864('0x48')]['describe']()[_0x8864('0x14')](respondWithResult(_0x4585f6,null))['catch'](handleError(_0x4585f6,null));};exports[_0x8864('0x6a')]=function(_0x4caeea,_0x36e7fb){if(_0x4caeea[_0x8864('0x65')]['id']){delete _0x4caeea['body']['id'];}return db[_0x8864('0x48')]['find']({'where':{'id':_0x4caeea['params']['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x36e7fb,null))['then'](function(_0x4ba70f){if(_0x4ba70f){_0x4caeea['body']['MailAccountId']=_0x4ba70f['id'];return db[_0x8864('0x6b')]['create'](_0x4caeea[_0x8864('0x65')]);}})[_0x8864('0x14')](respondWithResult(_0x36e7fb,null))['catch'](handleError(_0x36e7fb,null));};exports[_0x8864('0x6c')]=function(_0x4db141,_0x831028){var _0xc8647e={'raw':![],'where':{}};var _0x21bba4={};var _0x1b497b={'count':0x0,'rows':[]};return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x4db141[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x831028,null))[_0x8864('0x14')](function(_0x14031a){if(_0x14031a){_0x21bba4[_0x8864('0x54')]=_[_0x8864('0x4e')](db[_0x8864('0x6b')][_0x8864('0x49')]);_0x21bba4[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x4db141[_0x8864('0x4d')]);_0x21bba4[_0x8864('0x4f')]=_['intersection'](_0x21bba4[_0x8864('0x54')],_0x21bba4[_0x8864('0x4d')]);_0xc8647e[_0x8864('0x52')]=_['intersection'](_0x21bba4[_0x8864('0x54')],qs['fields'](_0x4db141[_0x8864('0x4d')][_0x8864('0x51')]));_0xc8647e[_0x8864('0x52')]=_0xc8647e['attributes'][_0x8864('0x53')]?_0xc8647e['attributes']:_0x21bba4['model'];if(!_0x4db141[_0x8864('0x4d')][_0x8864('0x55')]('nolimit')){_0xc8647e[_0x8864('0x25')]=qs[_0x8864('0x25')](_0x4db141[_0x8864('0x4d')][_0x8864('0x25')]);_0xc8647e[_0x8864('0x24')]=qs[_0x8864('0x24')](_0x4db141['query']['offset']);}_0xc8647e['order']=qs[_0x8864('0x58')](_0x4db141[_0x8864('0x4d')][_0x8864('0x58')]);_0xc8647e[_0x8864('0x59')]=qs[_0x8864('0x4f')](_[_0x8864('0x6e')](_0x4db141['query'],_0x21bba4['filters']));_0xc8647e[_0x8864('0x59')][_0x8864('0x6f')]=_0x14031a['id'];if(_0x4db141[_0x8864('0x4d')][_0x8864('0x70')]){_0xc8647e[_0x8864('0x59')]=_['merge'](_0xc8647e[_0x8864('0x59')],{'$or':_['map'](_0xc8647e[_0x8864('0x52')],function(_0x20e4dc){var _0x12410f={};_0x12410f[_0x20e4dc]={'$like':'%'+_0x4db141[_0x8864('0x4d')][_0x8864('0x70')]+'%'};return _0x12410f;})});}_0xc8647e=_[_0x8864('0x5a')]({},_0xc8647e,_0x4db141[_0x8864('0x5b')]);return db['Disposition'][_0x8864('0x23')]({'where':_0xc8647e[_0x8864('0x59')]})['then'](function(_0x2e7dd5){_0x1b497b['count']=_0x2e7dd5;if(_0x4db141[_0x8864('0x4d')][_0x8864('0x5c')]){_0xc8647e[_0x8864('0x71')]=[{'all':!![]}];}return db[_0x8864('0x6b')][_0x8864('0x5d')](_0xc8647e);})[_0x8864('0x14')](function(_0x2ba036){_0x1b497b[_0x8864('0x5e')]=_0x2ba036;return _0x1b497b;});}})[_0x8864('0x14')](respondWithFilteredResult(_0x831028,_0xc8647e))['catch'](handleError(_0x831028,null));};exports[_0x8864('0x72')]=function(_0x1abf1e,_0x109a39){return db['MailAccount']['find']({'where':{'id':_0x1abf1e['params']['id']}})['then'](handleEntityNotFound(_0x109a39,null))[_0x8864('0x14')](function(_0x154aeb){if(_0x154aeb){return _0x154aeb[_0x8864('0x72')](_0x1abf1e['query'][_0x8864('0x73')]);}})['then'](respondWithStatusCode(_0x109a39,null))[_0x8864('0x1d')](handleError(_0x109a39,null));};exports[_0x8864('0x74')]=function(_0x26e29a,_0x5286f7){if(_0x26e29a[_0x8864('0x65')]['id']){delete _0x26e29a[_0x8864('0x65')]['id'];}return db['MailAccount'][_0x8864('0x63')]({'where':{'id':_0x26e29a[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x5286f7,null))[_0x8864('0x14')](function(_0x30b09e){if(_0x30b09e){_0x26e29a[_0x8864('0x65')][_0x8864('0x6f')]=_0x30b09e['id'];return db[_0x8864('0x75')][_0x8864('0x76')](_0x26e29a['body']);}})[_0x8864('0x14')](respondWithResult(_0x5286f7,null))['catch'](handleError(_0x5286f7,null));};exports[_0x8864('0x77')]=function(_0x3afead,_0x22a0a7){var _0x554d68={'raw':![],'where':{}};var _0x473b98={};var _0x352d84={'count':0x0,'rows':[]};return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x3afead['params']['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x22a0a7,null))[_0x8864('0x14')](function(_0x31080c){if(_0x31080c){_0x473b98[_0x8864('0x54')]=_[_0x8864('0x4e')](db[_0x8864('0x75')]['rawAttributes']);_0x473b98[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x3afead[_0x8864('0x4d')]);_0x473b98[_0x8864('0x4f')]=_[_0x8864('0x50')](_0x473b98[_0x8864('0x54')],_0x473b98[_0x8864('0x4d')]);_0x554d68[_0x8864('0x52')]=_[_0x8864('0x50')](_0x473b98[_0x8864('0x54')],qs[_0x8864('0x51')](_0x3afead['query']['fields']));_0x554d68['attributes']=_0x554d68[_0x8864('0x52')][_0x8864('0x53')]?_0x554d68[_0x8864('0x52')]:_0x473b98[_0x8864('0x54')];if(!_0x3afead[_0x8864('0x4d')][_0x8864('0x55')](_0x8864('0x56'))){_0x554d68[_0x8864('0x25')]=qs['limit'](_0x3afead[_0x8864('0x4d')]['limit']);_0x554d68[_0x8864('0x24')]=qs[_0x8864('0x24')](_0x3afead[_0x8864('0x4d')]['offset']);}_0x554d68[_0x8864('0x57')]=qs[_0x8864('0x58')](_0x3afead['query'][_0x8864('0x58')]);_0x554d68['where']=qs['filters'](_[_0x8864('0x6e')](_0x3afead[_0x8864('0x4d')],_0x473b98[_0x8864('0x4f')]));_0x554d68[_0x8864('0x59')][_0x8864('0x6f')]=_0x31080c['id'];if(_0x3afead['query'][_0x8864('0x70')]){_0x554d68[_0x8864('0x59')]=_[_0x8864('0x5a')](_0x554d68['where'],{'$or':_[_0x8864('0x47')](_0x554d68[_0x8864('0x52')],function(_0x3a1566){var _0x230a3d={};_0x230a3d[_0x3a1566]={'$like':'%'+_0x3afead[_0x8864('0x4d')][_0x8864('0x70')]+'%'};return _0x230a3d;})});}_0x554d68=_[_0x8864('0x5a')]({},_0x554d68,_0x3afead[_0x8864('0x5b')]);return db[_0x8864('0x75')]['count']({'where':_0x554d68[_0x8864('0x59')]})[_0x8864('0x14')](function(_0x4bf4e7){_0x352d84[_0x8864('0x23')]=_0x4bf4e7;if(_0x3afead['query']['includeAll']){_0x554d68[_0x8864('0x71')]=[{'all':!![]}];}return db[_0x8864('0x75')][_0x8864('0x5d')](_0x554d68);})[_0x8864('0x14')](function(_0x34c071){_0x352d84[_0x8864('0x5e')]=_0x34c071;return _0x352d84;});}})[_0x8864('0x14')](respondWithFilteredResult(_0x22a0a7,_0x554d68))[_0x8864('0x1d')](handleError(_0x22a0a7,null));};exports['removeAnswers']=function(_0x27e937,_0x3df7a6){return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x27e937[_0x8864('0x60')]['id']}})['then'](handleEntityNotFound(_0x3df7a6,null))[_0x8864('0x14')](function(_0xa73a59){if(_0xa73a59){return _0xa73a59[_0x8864('0x78')](_0x27e937[_0x8864('0x4d')][_0x8864('0x73')]);}})[_0x8864('0x14')](respondWithStatusCode(_0x3df7a6,null))[_0x8864('0x1d')](handleError(_0x3df7a6,null));};exports[_0x8864('0x76')]=function(_0x33843a,_0x9b99d4){var _0xba984e={'name':_0x33843a[_0x8864('0x65')][_0x8864('0x2d')],'key':_0x33843a[_0x8864('0x65')][_0x8864('0x4c')],'provider':_0x33843a[_0x8864('0x65')][_0x8864('0x66')]===_0x8864('0x67')?null:_0x33843a[_0x8864('0x65')][_0x8864('0x66')],'email':_0x33843a[_0x8864('0x65')][_0x8864('0x79')],'ListId':_0x33843a['body']['ListId'],'active':!_['isNil'](_0x33843a[_0x8864('0x65')]['active'])?_0x33843a['body'][_0x8864('0x7a')]:!![],'description':_0x33843a[_0x8864('0x65')][_0x8864('0x7b')]||null};var _0x44a0ce=getAuthenticationOptions(_0xba984e[_0x8864('0x66')],_0x33843a[_0x8864('0x65')]);_0xba984e[_0x8864('0x42')]=_0x44a0ce[_0x8864('0x42')];_0xba984e[_0x8864('0x43')]=_0x44a0ce[_0x8864('0x43')];return db[_0x8864('0x48')]['create'](_0xba984e,{'include':[{'model':db[_0x8864('0x61')],'as':_0x8864('0x43')},{'model':db['MailServerIn'],'as':_0x8864('0x42')}]})[_0x8864('0x14')](function(_0x3da964){var _0x85bfaf=_0x33843a[_0x8864('0x37')][_0x8864('0x29')]({'plain':!![]});if(!_0x85bfaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x85bfaf[_0x8864('0x7c')]==='user'){var _0x313d1c=_0x3da964[_0x8864('0x29')]({'plain':!![]});return db[_0x8864('0x7d')][_0x8864('0x63')]({'where':{'name':_0x8864('0x2a'),'userProfileId':_0x85bfaf[_0x8864('0x7e')]},'raw':!![]})['then'](function(_0x1e65e2){if(_0x1e65e2&&_0x1e65e2[_0x8864('0x7f')]===0x0){return db[_0x8864('0x2b')][_0x8864('0x76')]({'name':_0x313d1c['name'],'resourceId':_0x313d1c['id'],'type':_0x1e65e2[_0x8864('0x2d')],'sectionId':_0x1e65e2['id']},{})['then'](function(){return _0x3da964;});}else{return _0x3da964;}})[_0x8864('0x1d')](function(_0x294626){logger[_0x8864('0x19')](_0x8864('0x80'),_0x294626);throw _0x294626;});}return _0x3da964;})[_0x8864('0x14')](respondWithResult(_0x9b99d4,0xc9))[_0x8864('0x1d')](handleError(_0x9b99d4,null));};exports['getImap']=function(_0xc4b1e7,_0x5780a9){return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0xc4b1e7[_0x8864('0x60')]['id']}})['then'](handleEntityNotFound(_0x5780a9,null))['then'](function(_0x3f39ac){if(_0x3f39ac){return _0x3f39ac[_0x8864('0x81')]();}return null;})[_0x8864('0x14')](respondWithResult(_0x5780a9,null))[_0x8864('0x1d')](handleError(_0x5780a9,null));};exports[_0x8864('0x82')]=function(_0x353505,_0x1ef4ff){if(_0x353505[_0x8864('0x65')]['id']){delete _0x353505['body']['id'];}return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x353505[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x1ef4ff,null))[_0x8864('0x14')](function(_0x561a72){if(_0x561a72){_0x353505['body'][_0x8864('0x6f')]=_0x561a72['id'];return db[_0x8864('0x45')][_0x8864('0x76')](_0x353505[_0x8864('0x65')]);}})['then'](respondWithResult(_0x1ef4ff,null))[_0x8864('0x1d')](handleError(_0x1ef4ff,null));};exports[_0x8864('0x83')]=function(_0x44176b,_0x2d7f37){return db['MailAccount'][_0x8864('0x6d')]({'where':{'id':_0x44176b[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x2d7f37,null))[_0x8864('0x14')](function(_0x497edd){if(_0x497edd){return _0x497edd[_0x8864('0x84')](null);}return null;})[_0x8864('0x14')](respondWithStatusCode(_0x2d7f37,null))[_0x8864('0x1d')](handleError(_0x2d7f37,null));};exports[_0x8864('0x85')]=function(_0x3ae961,_0x14ebb1){return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x3ae961[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x14ebb1,null))[_0x8864('0x14')](function(_0x322364){if(_0x322364){return _0x322364[_0x8864('0x85')]();}return null;})[_0x8864('0x14')](respondWithResult(_0x14ebb1,null))[_0x8864('0x1d')](handleError(_0x14ebb1,null));};exports[_0x8864('0x86')]=function(_0x356106,_0x40bf82){if(_0x356106[_0x8864('0x65')]['id']){delete _0x356106[_0x8864('0x65')]['id'];}return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x356106[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x40bf82,null))[_0x8864('0x14')](function(_0x313cd8){if(_0x313cd8){_0x356106[_0x8864('0x65')]['MailAccountId']=_0x313cd8['id'];return db[_0x8864('0x61')][_0x8864('0x76')](_0x356106['body']);}})[_0x8864('0x14')](respondWithResult(_0x40bf82,null))['catch'](handleError(_0x40bf82,null));};exports[_0x8864('0x87')]=function(_0x67d16d,_0x3c2a0d){return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x67d16d[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x3c2a0d,null))[_0x8864('0x14')](function(_0x3423b6){if(_0x3423b6){return _0x3423b6['setSmtp'](null);}return null;})[_0x8864('0x14')](respondWithStatusCode(_0x3c2a0d,null))['catch'](handleError(_0x3c2a0d,null));};exports['addInteraction']=function(_0x3e4126,_0x2ed48f){return db[_0x8864('0x88')][_0x8864('0x63')]({'where':{'id':_0x3e4126[_0x8864('0x60')]['id']}})['then'](handleEntityNotFound(_0x2ed48f,null))[_0x8864('0x14')](function(_0x37f908){if(_0x37f908){return _0x37f908[_0x8864('0x89')](_0x3e4126[_0x8864('0x65')][_0x8864('0x73')],_['omit'](_0x3e4126[_0x8864('0x65')],[_0x8864('0x73'),'id'])||{});}})[_0x8864('0x14')](respondWithResult(_0x2ed48f,null))[_0x8864('0x1d')](handleError(_0x2ed48f,null));};exports[_0x8864('0x8a')]=function(_0x56a8d1,_0x23231a){var _0x2db09a={'raw':![],'where':{}};var _0x3c32c5={};var _0x31e2cf={'count':0x0,'rows':[]};return db['MailAccount'][_0x8864('0x6d')]({'where':{'id':_0x56a8d1['params']['id']}})['then'](handleEntityNotFound(_0x23231a,null))[_0x8864('0x14')](function(_0xd791df){if(_0xd791df){_0x3c32c5[_0x8864('0x54')]=_['keys'](db[_0x8864('0x88')]['rawAttributes']);_0x3c32c5[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x56a8d1['query']);_0x3c32c5[_0x8864('0x4f')]=_[_0x8864('0x50')](_0x3c32c5[_0x8864('0x54')],_0x3c32c5['query']);_0x2db09a['attributes']=_[_0x8864('0x50')](_0x3c32c5[_0x8864('0x54')],qs[_0x8864('0x51')](_0x56a8d1[_0x8864('0x4d')][_0x8864('0x51')]));_0x2db09a[_0x8864('0x52')]=_0x2db09a['attributes'][_0x8864('0x53')]?_0x2db09a[_0x8864('0x52')]:_0x3c32c5[_0x8864('0x54')];if(!_0x56a8d1[_0x8864('0x4d')]['hasOwnProperty'](_0x8864('0x56'))){_0x2db09a[_0x8864('0x25')]=qs[_0x8864('0x25')](_0x56a8d1['query'][_0x8864('0x25')]);_0x2db09a[_0x8864('0x24')]=qs['offset'](_0x56a8d1[_0x8864('0x4d')][_0x8864('0x24')]);}_0x2db09a['order']=qs[_0x8864('0x58')](_0x56a8d1['query']['sort']);_0x2db09a[_0x8864('0x59')]=qs[_0x8864('0x4f')](_[_0x8864('0x6e')](_0x56a8d1[_0x8864('0x4d')],_0x3c32c5[_0x8864('0x4f')]));_0x2db09a['where'][_0x8864('0x6f')]=_0xd791df['id'];if(_0x56a8d1[_0x8864('0x4d')][_0x8864('0x70')]){_0x2db09a[_0x8864('0x59')]=_[_0x8864('0x5a')](_0x2db09a[_0x8864('0x59')],{'$or':_[_0x8864('0x47')](_0x2db09a[_0x8864('0x52')],function(_0x269c0a){var _0x12589d={};_0x12589d[_0x269c0a]={'$like':'%'+_0x56a8d1[_0x8864('0x4d')][_0x8864('0x70')]+'%'};return _0x12589d;})});}_0x2db09a=_['merge']({},_0x2db09a,_0x56a8d1[_0x8864('0x5b')]);return db[_0x8864('0x88')]['count']({'where':_0x2db09a[_0x8864('0x59')]})[_0x8864('0x14')](function(_0x1b1c48){_0x31e2cf[_0x8864('0x23')]=_0x1b1c48;if(_0x56a8d1[_0x8864('0x4d')][_0x8864('0x5c')]){_0x2db09a['include']=[{'model':db[_0x8864('0x8b')],'as':_0x8864('0x8c'),'required':![]},{'model':db[_0x8864('0x8d')],'as':_0x8864('0x8e'),'attributes':[_0x8864('0x2d'),_0x8864('0x8f'),_0x8864('0x90')],'required':![]},{'model':db[_0x8864('0x91')],'as':_0x8864('0x92'),'attributes':['id','name',_0x8864('0x93')],'where':_0x56a8d1['query'][_0x8864('0x94')]?{'id':_0x56a8d1['query'][_0x8864('0x94')]}:undefined,'required':_0x56a8d1['query'][_0x8864('0x94')]?!![]:![]}];}return db[_0x8864('0x88')][_0x8864('0x5d')](_0x2db09a);})[_0x8864('0x14')](function(_0x1e72cb){_0x31e2cf[_0x8864('0x5e')]=_0x1e72cb;return _0x31e2cf;});}})[_0x8864('0x14')](respondWithFilteredResult(_0x23231a,_0x2db09a))['catch'](handleError(_0x23231a,null));};exports[_0x8864('0x95')]=function addApplications(_0x10a2d6,_0x18cf3a){var _0x8b43c2=_0x10a2d6[_0x8864('0x60')]['id'];var _0x124665=_0x10a2d6[_0x8864('0x65')];var _0x2a32ab=0xc8;var _0x273d41=null;return db[_0x8864('0x96')][_0x8864('0x97')]({'isolationLevel':db[_0x8864('0x96')][_0x8864('0x98')][_0x8864('0x99')][_0x8864('0x9a')]},function(_0xa0325e){return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x8b43c2},'transaction':_0xa0325e})['then'](function(_0x347b78){if(_0x347b78){return db['MailApplication'][_0x8864('0x28')]({'where':{'MailAccountId':_0x8b43c2},'transaction':_0xa0325e})[_0x8864('0x14')](function(){var _0x2ebed6=_[_0x8864('0x47')](_0x124665,function(_0x1b4a49){_0x1b4a49[_0x8864('0x6f')]=_0x8b43c2;return _0x1b4a49;});return db['MailApplication']['bulkCreate'](_0x2ebed6,{'transaction':_0xa0325e});});}else{_0x2a32ab=0x194;_0x273d41=[];}});})[_0x8864('0x14')](function(){if(_0x2a32ab!==0x194){return db[_0x8864('0x9b')][_0x8864('0x9c')]({'where':{'MailAccountId':_0x8b43c2},'order':_0x8864('0x9d')})[_0x8864('0x14')](function(_0xac856b){_0x273d41=_0xac856b;});}})[_0x8864('0x1d')](function(_0x49f1be){_0x2a32ab=0x1f4;logger[_0x8864('0x19')](_0x49f1be['stack']);if(_0x49f1be[_0x8864('0x2d')]){delete _0x49f1be[_0x8864('0x2d')];}_0x273d41=_0x49f1be;})[_0x8864('0x9e')](function(){if(_0x273d41===null){_0x18cf3a['sendStatus'](_0x2a32ab);}else{if(_0x2a32ab===0x1f4){_0x18cf3a[_0x8864('0x1f')](_0x2a32ab)[_0x8864('0x2e')](_0x273d41);}else{_0x18cf3a[_0x8864('0x1f')](_0x2a32ab)[_0x8864('0x21')](_0x273d41);}}});};exports[_0x8864('0x9f')]=function(_0x127332,_0x4fda9b){var _0x4d8a70={};var _0x289559={};var _0xc109e8;var _0x5e6f0a;return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x127332[_0x8864('0x60')]['id']}})['then'](handleEntityNotFound(_0x4fda9b,null))['then'](function(_0x5a3d8c){if(_0x5a3d8c){_0xc109e8=_0x5a3d8c;_0x289559['model']=_['keys'](db['MailApplication'][_0x8864('0x49')]);_0x289559['query']=_[_0x8864('0x4e')](_0x127332[_0x8864('0x4d')]);_0x289559['filters']=_[_0x8864('0x50')](_0x289559[_0x8864('0x54')],_0x289559['query']);_0x4d8a70[_0x8864('0x52')]=_[_0x8864('0x50')](_0x289559[_0x8864('0x54')],qs[_0x8864('0x51')](_0x127332[_0x8864('0x4d')]['fields']));_0x4d8a70[_0x8864('0x52')]=_0x4d8a70[_0x8864('0x52')][_0x8864('0x53')]?_0x4d8a70[_0x8864('0x52')]:_0x289559['model'];_0x4d8a70['order']=qs[_0x8864('0x58')](_0x127332[_0x8864('0x4d')]['sort']);_0x4d8a70[_0x8864('0x59')]=qs[_0x8864('0x4f')](_[_0x8864('0x6e')](_0x127332[_0x8864('0x4d')],_0x289559[_0x8864('0x4f')]));if(_0x127332[_0x8864('0x4d')]['filter']){_0x4d8a70['where']=_[_0x8864('0x5a')](_0x4d8a70[_0x8864('0x59')],{'$or':_['map'](_0x4d8a70[_0x8864('0x52')],function(_0x23bf64){var _0x4debb1={};_0x4debb1[_0x23bf64]={'$like':'%'+_0x127332['query']['filter']+'%'};return _0x4debb1;})});}_0x4d8a70=_['merge']({},_0x4d8a70,_0x127332[_0x8864('0x5b')]);return _0xc109e8[_0x8864('0x9f')](_0x4d8a70);}})[_0x8864('0x14')](function(_0x36e9a8){if(_0x36e9a8){_0x5e6f0a=_0x36e9a8['length'];if(!_0x127332['query'][_0x8864('0x55')](_0x8864('0x56'))){_0x4d8a70[_0x8864('0x25')]=qs[_0x8864('0x25')](_0x127332[_0x8864('0x4d')][_0x8864('0x25')]);_0x4d8a70[_0x8864('0x24')]=qs['offset'](_0x127332[_0x8864('0x4d')][_0x8864('0x24')]);}return _0xc109e8[_0x8864('0x9f')](_0x4d8a70);}})[_0x8864('0x14')](function(_0x184900){if(_0x184900){return _0x184900?{'count':_0x5e6f0a,'rows':_0x184900}:null;}})[_0x8864('0x14')](respondWithResult(_0x4fda9b,null))[_0x8864('0x1d')](handleError(_0x4fda9b,null));};exports[_0x8864('0xa0')]=function(_0x5634dc,_0x59cd57){var _0x27c2f0={'raw':!![],'where':{}};var _0x1f7b58={};var _0x2b8d33={'count':0x0,'rows':[]};return db['MailAccount'][_0x8864('0x6d')]({'where':{'id':_0x5634dc[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x59cd57,null))[_0x8864('0x14')](function(_0x2bfc8c){if(_0x2bfc8c){_0x1f7b58[_0x8864('0x54')]=_[_0x8864('0x4e')](db[_0x8864('0xa1')][_0x8864('0x49')]);_0x1f7b58[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x5634dc['query']);_0x1f7b58['filters']=_[_0x8864('0x50')](_0x1f7b58[_0x8864('0x54')],_0x1f7b58[_0x8864('0x4d')]);_0x27c2f0[_0x8864('0x52')]=_[_0x8864('0x50')](_0x1f7b58[_0x8864('0x54')],qs[_0x8864('0x51')](_0x5634dc[_0x8864('0x4d')]['fields']));_0x27c2f0[_0x8864('0x52')]=_0x27c2f0[_0x8864('0x52')]['length']?_0x27c2f0['attributes']:_0x1f7b58[_0x8864('0x54')];if(!_0x5634dc[_0x8864('0x4d')][_0x8864('0x55')](_0x8864('0x56'))){_0x27c2f0['limit']=qs[_0x8864('0x25')](_0x5634dc[_0x8864('0x4d')][_0x8864('0x25')]);_0x27c2f0[_0x8864('0x24')]=qs['offset'](_0x5634dc[_0x8864('0x4d')][_0x8864('0x24')]);}_0x27c2f0['order']=qs[_0x8864('0x58')](_0x5634dc['query']['sort']);_0x27c2f0[_0x8864('0x59')]=qs[_0x8864('0x4f')](_['pick'](_0x5634dc['query'],_0x1f7b58[_0x8864('0x4f')]));_0x27c2f0[_0x8864('0x59')][_0x8864('0x6f')]=_0x2bfc8c['id'];if(_0x5634dc[_0x8864('0x4d')][_0x8864('0x70')]){_0x27c2f0[_0x8864('0x59')]=_[_0x8864('0x5a')](_0x27c2f0[_0x8864('0x59')],{'$or':_[_0x8864('0x47')](_0x27c2f0['attributes'],function(_0x5925eb){var _0x195049={};_0x195049[_0x5925eb]={'$like':'%'+_0x5634dc['query'][_0x8864('0x70')]+'%'};return _0x195049;})});}if(_0x5634dc[_0x8864('0x4d')][_0x8864('0xa2')]){var _0x51e4c6=_0x5634dc[_0x8864('0x4d')][_0x8864('0xa2')][_0x8864('0xa3')](',');var _0x570ebf={};_0x570ebf[_0x51e4c6[0x0]]={'$gte':moment(_0x51e4c6[0x1])[_0x8864('0xa4')](_0x8864('0xa5'))};_0x27c2f0['where']=_[_0x8864('0x5a')](_0x27c2f0[_0x8864('0x59')],_0x570ebf);}_0x27c2f0=_[_0x8864('0x5a')]({},_0x27c2f0,_0x5634dc[_0x8864('0x5b')]);return db[_0x8864('0xa1')][_0x8864('0x23')]({'where':_0x27c2f0[_0x8864('0x59')]})[_0x8864('0x14')](function(_0x54d98a){_0x2b8d33['count']=_0x54d98a;if(_0x5634dc['query'][_0x8864('0x5c')]){_0x27c2f0['include']=[{'all':!![]}];}return db['MailMessage'][_0x8864('0x5d')](_0x27c2f0);})[_0x8864('0x14')](function(_0x31ca0f){if(_0x5634dc[_0x8864('0x4d')][_0x8864('0xa6')]===_0x8864('0xa7')){for(var _0x3b1b62=0x0;_0x3b1b62<_0x31ca0f[_0x8864('0x53')];_0x3b1b62++){_0x31ca0f[_0x3b1b62][_0x8864('0x65')]=juice(_0x31ca0f[_0x3b1b62][_0x8864('0x65')]);}}_0x2b8d33[_0x8864('0x5e')]=_0x31ca0f;return _0x2b8d33;});}})[_0x8864('0x14')](respondWithFilteredResult(_0x59cd57,_0x27c2f0))[_0x8864('0x1d')](handleError(_0x59cd57,null));};exports[_0x8864('0x2e')]=function(_0x5ea76b,_0x245e5f){var _0x2ec445,_0x1b5399={},_0x502af3;if(_0x5ea76b['body']['to']){_0x502af3=_0x5ea76b[_0x8864('0x65')]['to'][_0x8864('0xa3')](',')[0x0];}return db['MailAccount'][_0x8864('0x63')]({'where':{'id':_0x5ea76b['params']['id']},'include':[{'model':db[_0x8864('0xa8')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8864('0xa9'),'where':{'email':_0x502af3},'limit':0x1,'order':[[_0x8864('0xaa'),'DESC']]}]},{'model':db[_0x8864('0x61')],'as':_0x8864('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x245e5f,null))[_0x8864('0x14')](function(_0x248c2a){if(!_0x248c2a)return;_0x2ec445=_0x248c2a;if(!_0x248c2a[_0x8864('0x43')])throw new Error(_0x8864('0xab'));if(_[_0x8864('0xac')](_0x5ea76b[_0x8864('0x65')][_0x8864('0xad')])){_0x5ea76b[_0x8864('0x65')][_0x8864('0xad')]=util[_0x8864('0xa4')](_0x8864('0xae'),_0x248c2a[_0x8864('0x2d')],_0x248c2a[_0x8864('0x79')]||_0x248c2a[_0x8864('0x43')][_0x8864('0x37')]);}if(_0x5ea76b[_0x8864('0x65')][_0x8864('0xaf')]&&_0x5ea76b['body'][_0x8864('0xaf')][_0x8864('0x53')]){for(var _0x5ed2a8=0x0;_0x5ed2a8<_0x5ea76b[_0x8864('0x65')][_0x8864('0xaf')][_0x8864('0x53')];_0x5ed2a8+=0x1){_0x5ea76b[_0x8864('0x65')][_0x8864('0xaf')][_0x5ed2a8]={'filename':_0x5ea76b['body'][_0x8864('0xaf')][_0x5ed2a8]['name'],'path':path[_0x8864('0xb0')](config[_0x8864('0xb1')],_0x8864('0xb2'),_0x5ea76b[_0x8864('0x65')][_0x8864('0xaf')][_0x5ed2a8][_0x8864('0xb3')])};}}var _0x3befc5=_0x248c2a['getSmtpOptions']();return respondWithRpcPromise(_0x8864('0xb4'),'sendMail',{'account':_0x3befc5,'message':_0x5ea76b[_0x8864('0x65')]});})[_0x8864('0x14')](function(_0x5412d4){if(!_0x5412d4)return;_0x1b5399=_0x5412d4;if(!_0x2ec445[_0x8864('0xb5')])throw new Error(_0x8864('0xb6'));if(_0x2ec445[_0x8864('0xb5')][_0x8864('0xa9')]['length'])return _0x2ec445[_0x8864('0xb5')]['Contacts'][0x0];return db['CmContact'][_0x8864('0x76')](_['defaults'](_0x5ea76b['body'],{'firstName':_0x5ea76b[_0x8864('0x65')]['to'],'email':_0x5ea76b[_0x8864('0x65')]['to'],'phone':_0x5ea76b[_0x8864('0x65')]['to'],'ListId':_0x2ec445['ListId']}));})['then'](function(_0x28bb06){if(!_0x28bb06)return;var _0x359de0={'UserId':_0x5ea76b['user']['id'],'ContactId':_0x28bb06['id'],'MailAccountId':_0x2ec445['id'],'inReplyTo':_0x1b5399[_0x8864('0xb7')],'to':_0x5ea76b[_0x8864('0x65')][_0x8864('0xad')],'cc':_0x5ea76b[_0x8864('0x65')]['cc'],'subject':_0x5ea76b[_0x8864('0x65')][_0x8864('0xb8')],'attach':_0x5ea76b[_0x8864('0x65')][_0x8864('0xb9')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8864('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x8864('0xba'),'Messages':[_['merge'](_0x5ea76b[_0x8864('0x65')],{'messageId':_0x1b5399['messageId'],'sentAt':moment()[_0x8864('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2ec445['id'],'UserId':_0x5ea76b[_0x8864('0x37')]['id'],'ContactId':_0x28bb06['id']})]};if(_0x5ea76b[_0x8864('0x65')][_0x8864('0xbb')]){_0x359de0=_[_0x8864('0x5a')](_0x359de0,_0x5ea76b[_0x8864('0x65')][_0x8864('0xbb')]);}return db[_0x8864('0x88')]['create'](_0x359de0,{'include':[{'model':db[_0x8864('0xa1')],'as':_0x8864('0xbc')}]});})[_0x8864('0x14')](respondWithResult(_0x245e5f,null))[_0x8864('0x1d')](handleError(_0x245e5f,null));};exports[_0x8864('0xbd')]=function(_0x1d02f0,_0x40aaa3){return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x1d02f0['params']['id']},'include':[{'model':db[_0x8864('0x61')],'as':_0x8864('0x43'),'raw':!![],'include':[{'model':db[_0x8864('0xbe')],'as':_0x8864('0xbe'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x40aaa3,null))['then'](function(_0x24971b){if(!_0x24971b[_0x8864('0x43')])return;var _0x10fd2c=_0x24971b[_0x8864('0xbf')]();return respondWithRpcPromise(_0x8864('0xc0'),'verifySmtp',{'account':_0x10fd2c});})[_0x8864('0x14')](respondWithResult(_0x40aaa3,null))[_0x8864('0x1d')](handleError(_0x40aaa3,null));};exports[_0x8864('0x28')]=function(_0x25c70b,_0x191fce){return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x25c70b[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x191fce,null))[_0x8864('0x14')](function(_0x411420){if(_0x411420&&_0x411420['service']){throw new db[(_0x8864('0xc1'))]['ValidationError'](_0x8864('0xc2'));}return _0x411420;})[_0x8864('0x14')](removeEntity(_0x191fce,null))[_0x8864('0x1d')](handleError(_0x191fce,null));};exports[_0x8864('0xc3')]=function(_0x3438b0,_0x2f0c05){return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x3438b0[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0x2f0c05,null))[_0x8864('0x14')](function(_0x3dd7a4){if(_0x3dd7a4){return _0x3dd7a4[_0x8864('0xc3')](_0x3438b0[_0x8864('0x65')]['ids'],_[_0x8864('0xc4')](_0x3438b0[_0x8864('0x65')],[_0x8864('0x73'),'id'])||{})[_0x8864('0xc5')](function(_0x1d4ed2){for(var _0x5c1bcc=0x0;_0x5c1bcc<_0x3438b0['body']['ids']['length'];_0x5c1bcc+=0x1){socket[_0x8864('0xc6')](_0x8864('0xc7'),{'UserId':Number(_0x3438b0['body']['ids'][_0x5c1bcc]),'MailAccountId':Number(_0x3438b0[_0x8864('0x60')]['id'])});}return _0x1d4ed2;});}})[_0x8864('0x14')](respondWithResult(_0x2f0c05,null))[_0x8864('0x1d')](handleError(_0x2f0c05,null));};exports[_0x8864('0xc8')]=function(_0x4adec6,_0x3dd3e2){return db[_0x8864('0x48')][_0x8864('0x63')]({'where':{'id':_0x4adec6[_0x8864('0x60')]['id']}})['then'](handleEntityNotFound(_0x3dd3e2,null))[_0x8864('0x14')](function(_0x2980d1){if(_0x2980d1){return _0x2980d1[_0x8864('0xc8')](_0x4adec6[_0x8864('0x4d')]['ids'])[_0x8864('0x14')](function(){if(_['isArray'](_0x4adec6[_0x8864('0x4d')][_0x8864('0x73')])){for(var _0x1f999a=0x0;_0x1f999a<_0x4adec6[_0x8864('0x4d')][_0x8864('0x73')]['length'];_0x1f999a+=0x1){socket[_0x8864('0xc6')](_0x8864('0xc9'),{'UserId':Number(_0x4adec6[_0x8864('0x4d')][_0x8864('0x73')][_0x1f999a]),'MailAccountId':Number(_0x4adec6[_0x8864('0x60')]['id'])});}}else{socket['emit'](_0x8864('0xc9'),{'UserId':Number(_0x4adec6['query'][_0x8864('0x73')]),'MailAccountId':Number(_0x4adec6[_0x8864('0x60')]['id'])});}});}})[_0x8864('0x14')](respondWithStatusCode(_0x3dd3e2,null))[_0x8864('0x1d')](handleError(_0x3dd3e2,null));};exports[_0x8864('0xca')]=function(_0x5bf0d5,_0xb24df1){var _0x2ff2ed={};var _0x320744={};var _0x4ef0f5;var _0x4e596a;return db[_0x8864('0x48')][_0x8864('0x6d')]({'where':{'id':_0x5bf0d5[_0x8864('0x60')]['id']}})[_0x8864('0x14')](handleEntityNotFound(_0xb24df1,null))['then'](function(_0x4225e3){if(_0x4225e3){_0x4ef0f5=_0x4225e3;_0x320744[_0x8864('0x54')]=_[_0x8864('0x4e')](db[_0x8864('0x8d')][_0x8864('0x49')]);_0x320744[_0x8864('0x4d')]=_[_0x8864('0x4e')](_0x5bf0d5[_0x8864('0x4d')]);_0x320744[_0x8864('0x4f')]=_[_0x8864('0x50')](_0x320744[_0x8864('0x54')],_0x320744[_0x8864('0x4d')]);_0x2ff2ed[_0x8864('0x52')]=_['intersection'](_0x320744['model'],qs[_0x8864('0x51')](_0x5bf0d5['query'][_0x8864('0x51')]));_0x2ff2ed[_0x8864('0x52')]=_0x2ff2ed[_0x8864('0x52')][_0x8864('0x53')]?_0x2ff2ed[_0x8864('0x52')]:_0x320744[_0x8864('0x54')];_0x2ff2ed[_0x8864('0x57')]=qs['sort'](_0x5bf0d5[_0x8864('0x4d')][_0x8864('0x58')]);_0x2ff2ed[_0x8864('0x59')]=qs[_0x8864('0x4f')](_[_0x8864('0x6e')](_0x5bf0d5[_0x8864('0x4d')],_0x320744[_0x8864('0x4f')]));if(_0x5bf0d5[_0x8864('0x4d')][_0x8864('0x70')]){_0x2ff2ed[_0x8864('0x59')]=_[_0x8864('0x5a')](_0x2ff2ed[_0x8864('0x59')],{'$or':_['map'](_0x2ff2ed[_0x8864('0x52')],function(_0x100683){var _0x27f6f2={};_0x27f6f2[_0x100683]={'$like':'%'+_0x5bf0d5['query'][_0x8864('0x70')]+'%'};return _0x27f6f2;})});}_0x2ff2ed=_[_0x8864('0x5a')]({},_0x2ff2ed,_0x5bf0d5[_0x8864('0x5b')]);return _0x4ef0f5[_0x8864('0xca')](_0x2ff2ed);}})[_0x8864('0x14')](function(_0x280579){if(_0x280579){_0x4e596a=_0x280579[_0x8864('0x53')];if(!_0x5bf0d5[_0x8864('0x4d')]['hasOwnProperty'](_0x8864('0x56'))){_0x2ff2ed['limit']=qs['limit'](_0x5bf0d5[_0x8864('0x4d')][_0x8864('0x25')]);_0x2ff2ed[_0x8864('0x24')]=qs[_0x8864('0x24')](_0x5bf0d5[_0x8864('0x4d')][_0x8864('0x24')]);}return _0x4ef0f5[_0x8864('0xca')](_0x2ff2ed);}})[_0x8864('0x14')](function(_0x37e5de){if(_0x37e5de){return _0x37e5de?{'count':_0x4e596a,'rows':_0x37e5de}:null;}})['then'](respondWithResult(_0xb24df1,null))['catch'](handleError(_0xb24df1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3181995..506d2be 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 _0xacc6=['emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0x4f5fbc,_0x74cb4e){var _0x486e0e=function(_0x306829){while(--_0x306829){_0x4f5fbc['push'](_0x4f5fbc['shift']());}};_0x486e0e(++_0x74cb4e);}(_0xacc6,0x150));var _0x6acc=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xacc6[_0x211fef];return _0x5447bf;};'use strict';var EventEmitter=require(_0x6acc('0x0'));var MailAccount=require(_0x6acc('0x1'))['db'][_0x6acc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6acc('0x3')](0x0);var events={'afterCreate':_0x6acc('0x4'),'afterUpdate':'update','afterDestroy':_0x6acc('0x5')};function emitEvent(_0x14a0d1){return function(_0x2ff2ff,_0x53dcdb,_0x148455){MailAccountEvents['emit'](_0x14a0d1+':'+_0x2ff2ff['id'],_0x2ff2ff);MailAccountEvents[_0x6acc('0x6')](_0x14a0d1,_0x2ff2ff);_0x148455(null);};}for(var e in events){if(events[_0x6acc('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x6acc('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x8c25=['save','update','emit','hasOwnProperty','../../mysqldb','setMaxListeners'];(function(_0x1002f9,_0x11fc2d){var _0x94fbc=function(_0x17bbc5){while(--_0x17bbc5){_0x1002f9['push'](_0x1002f9['shift']());}};_0x94fbc(++_0x11fc2d);}(_0x8c25,0xe2));var _0x58c2=function(_0x3ef010,_0x4350a3){_0x3ef010=_0x3ef010-0x0;var _0x520e9d=_0x8c25[_0x3ef010];return _0x520e9d;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x58c2('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x58c2('0x1')](0x0);var events={'afterCreate':_0x58c2('0x2'),'afterUpdate':_0x58c2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4e5048){return function(_0x42cae6,_0xa7d84d,_0x2af6b8){MailAccountEvents['emit'](_0x4e5048+':'+_0x42cae6['id'],_0x42cae6);MailAccountEvents[_0x58c2('0x4')](_0x4e5048,_0x42cae6);_0x2af6b8(null);};}for(var e in events){if(events[_0x58c2('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6e8c9f8..6ce3197 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 _0xc120=['authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure'];(function(_0x119920,_0x18be73){var _0x14140a=function(_0x1c2dde){while(--_0x1c2dde){_0x119920['push'](_0x119920['shift']());}};_0x14140a(++_0x18be73);}(_0xc120,0x15e));var _0x0c12=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc120[_0x19e35c];return _0x3e1fe8;};'use strict';var attributes=require(_0x0c12('0x0'));module['exports']=function(_0x2876af){return _0x2876af[_0x0c12('0x1')](_0x0c12('0x2'),attributes,{'tableName':_0x0c12('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1742c1=this;var _0x1ebbe8={'id':_0x1742c1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1742c1[_0x0c12('0x4')]!=='custom'){_0x1ebbe8[_0x0c12('0x5')]=_0x1742c1[_0x0c12('0x4')];}else{_0x1ebbe8[_0x0c12('0x6')]=_0x1742c1[_0x0c12('0x7')][_0x0c12('0x6')];_0x1ebbe8['port']=_0x1742c1[_0x0c12('0x7')][_0x0c12('0x8')];_0x1ebbe8[_0x0c12('0x9')]=_0x1742c1[_0x0c12('0x7')][_0x0c12('0x9')];}if(_0x1742c1[_0x0c12('0x7')][_0x0c12('0xa')]){if(_0x1742c1[_0x0c12('0x7')][_0x0c12('0xb')]){if(!_0x1742c1['Smtp'][_0x0c12('0xc')])throw new Error(_0x0c12('0xd'));_0x1ebbe8[_0x0c12('0xe')]={'type':_0x0c12('0xf'),'user':_0x1742c1[_0x0c12('0x7')][_0x0c12('0x10')],'accessToken':_0x1742c1[_0x0c12('0x7')][_0x0c12('0xc')][_0x0c12('0x11')]};}else{_0x1ebbe8[_0x0c12('0xe')]={'user':_0x1742c1[_0x0c12('0x7')][_0x0c12('0x10')],'pass':_0x1742c1[_0x0c12('0x7')]['pass']};}}return _0x1ebbe8;}}});}; \ No newline at end of file +var _0x601a=['provider','custom','service','host','Smtp','port','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','exports','define','MailAccount','mail_accounts'];(function(_0x3b38f4,_0x1458e4){var _0x5a56b9=function(_0x404d28){while(--_0x404d28){_0x3b38f4['push'](_0x3b38f4['shift']());}};_0x5a56b9(++_0x1458e4);}(_0x601a,0x81));var _0xa601=function(_0x41b94b,_0x252e4e){_0x41b94b=_0x41b94b-0x0;var _0xb78bf9=_0x601a[_0x41b94b];return _0xb78bf9;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa601('0x0')]=function(_0x1f947a){return _0x1f947a[_0xa601('0x1')](_0xa601('0x2'),attributes,{'tableName':_0xa601('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x11d213=this;var _0x880aa1={'id':_0x11d213['id'],'tls':{'rejectUnauthorized':![]}};if(_0x11d213[_0xa601('0x4')]!==_0xa601('0x5')){_0x880aa1[_0xa601('0x6')]=_0x11d213[_0xa601('0x4')];}else{_0x880aa1[_0xa601('0x7')]=_0x11d213[_0xa601('0x8')][_0xa601('0x7')];_0x880aa1['port']=_0x11d213['Smtp'][_0xa601('0x9')];_0x880aa1['secure']=_0x11d213[_0xa601('0x8')]['secure'];}if(_0x11d213['Smtp'][_0xa601('0xa')]){if(_0x11d213[_0xa601('0x8')][_0xa601('0xb')]){if(!_0x11d213[_0xa601('0x8')][_0xa601('0xc')])throw new Error(_0xa601('0xd'));_0x880aa1['auth']={'type':_0xa601('0xe'),'user':_0x11d213[_0xa601('0x8')][_0xa601('0xf')],'accessToken':_0x11d213['Smtp'][_0xa601('0xc')][_0xa601('0x10')]};}else{_0x880aa1[_0xa601('0x11')]={'user':_0x11d213[_0xa601('0x8')][_0xa601('0xf')],'pass':_0x11d213[_0xa601('0x8')][_0xa601('0x12')]};}}return _0x880aa1;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 308eb7f..3a0a850 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 _0xee3c=['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','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','update','attach','interaction','get','created','MailMessage','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x24d8a5,_0x4e62b7){var _0x1d1657=function(_0x2d99a6){while(--_0x2d99a6){_0x24d8a5['push'](_0x24d8a5['shift']());}};_0x1d1657(++_0x4e62b7);}(_0xee3c,0x14a));var _0xcee3=function(_0x7a0592,_0x468c96){_0x7a0592=_0x7a0592-0x0;var _0x53eb05=_0xee3c[_0x7a0592];return _0x53eb05;};'use strict';var _=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));var BPromise=require(_0xcee3('0x2'));var rs=require(_0xcee3('0x3'));var Redis=require(_0xcee3('0x4'));var db=require(_0xcee3('0x5'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xcee3('0x6'));var jayson=require(_0xcee3('0x7'));var client=jayson[_0xcee3('0x8')][_0xcee3('0x9')]({'port':0x232c});config[_0xcee3('0xa')]=_[_0xcee3('0xb')](config[_0xcee3('0xa')],{'host':_0xcee3('0xc'),'port':0x18eb});var socket=require(_0xcee3('0xd'))(new Redis(config[_0xcee3('0xa')]));require(_0xcee3('0xe'))[_0xcee3('0xf')](socket);function respondWithRpcPromise(_0x861421,_0x81de8e,_0x15d2af){return new BPromise(function(_0x507d8c,_0x1ed6a6){return client[_0xcee3('0x10')](_0x861421,_0x15d2af)[_0xcee3('0x11')](function(_0x2790ba){logger[_0xcee3('0x12')](_0xcee3('0x13'),_0x81de8e,'request\x20sent');logger[_0xcee3('0x14')](_0xcee3('0x15'),_0x81de8e,_0xcee3('0x16'),JSON[_0xcee3('0x17')](_0x2790ba));if(_0x2790ba[_0xcee3('0x18')]){if(_0x2790ba['error'][_0xcee3('0x19')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x1ed6a6(_0x2790ba[_0xcee3('0x18')]['message']);}logger['error'](_0xcee3('0x13'),_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x507d8c(_0x2790ba['error'][_0xcee3('0x1a')]);}else{logger[_0xcee3('0x12')]('MailAccount,\x20%s,\x20%s',_0x81de8e,_0xcee3('0x16'));_0x507d8c(_0x2790ba[_0xcee3('0x1b')][_0xcee3('0x1a')]);}})[_0xcee3('0x1c')](function(_0x50bf6e){logger[_0xcee3('0x18')](_0xcee3('0x13'),_0x81de8e,_0x50bf6e);_0x1ed6a6(_0x50bf6e);});});}exports[_0xcee3('0x1d')]=function(_0x11bf37){var _0x52f4d7=this;return new Promise(function(_0x254de7,_0xf2f32){return db[_0xcee3('0x1e')][_0xcee3('0x1f')]({'raw':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x22')]||null:null,'attributes':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'limit':_0x11bf37['options']?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x24')]||null:null,'include':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x11bf37['options'][_0xcee3('0x25')],function(_0x5b92ba){return{'model':db[_0x5b92ba['model']],'as':_0x5b92ba['as'],'attributes':_0x5b92ba[_0xcee3('0x23')],'include':_0x5b92ba['include']?_[_0xcee3('0x26')](_0x5b92ba[_0xcee3('0x25')],function(_0x19a15e){return{'model':db[_0x19a15e['model']],'as':_0x19a15e['as'],'attributes':_0x19a15e[_0xcee3('0x23')],'include':_0x19a15e['include']?_[_0xcee3('0x26')](_0x19a15e['include'],function(_0x2c2d48){return{'model':db[_0x2c2d48[_0xcee3('0x27')]],'as':_0x2c2d48['as'],'attributes':_0x2c2d48['attributes']};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x1efb1b){logger['info'](_0xcee3('0x1d'),_0x11bf37);logger['debug']('GetMailAccount',_0x11bf37,JSON[_0xcee3('0x17')](_0x1efb1b));_0x254de7(_0x1efb1b);})['catch'](function(_0x22e342){logger[_0xcee3('0x18')](_0xcee3('0x1d'),_0x22e342[_0xcee3('0x1a')],_0x11bf37);_0xf2f32(_0x52f4d7[_0xcee3('0x18')](0x1f4,_0x22e342[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x28')]=function(_0x5ce5be){var _0x298a29=this;return new Promise(function(_0x56f705,_0x74019c){return db[_0xcee3('0x1e')][_0xcee3('0x29')]({'raw':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')]['where']||null:null,'attributes':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'include':_0x5ce5be['options']?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x5ce5be[_0xcee3('0x20')]['include'],function(_0x2a4996){return{'model':db[_0x2a4996['model']],'as':_0x2a4996['as'],'attributes':_0x2a4996['attributes'],'include':_0x2a4996[_0xcee3('0x25')]?_['map'](_0x2a4996[_0xcee3('0x25')],function(_0x322e05){return{'model':db[_0x322e05[_0xcee3('0x27')]],'as':_0x322e05['as'],'attributes':_0x322e05[_0xcee3('0x23')],'include':_0x322e05['include']?_['map'](_0x322e05[_0xcee3('0x25')],function(_0x45feca){return{'model':db[_0x45feca['model']],'as':_0x45feca['as'],'attributes':_0x45feca[_0xcee3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x55081a){if(_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x2a')]===!![])_0x55081a[_0xcee3('0x2b')](_0xcee3('0x2c'),_0x55081a[_0xcee3('0x2d')]());logger[_0xcee3('0x12')]('ShowMailAccount',_0x5ce5be);logger[_0xcee3('0x14')](_0xcee3('0x28'),_0x5ce5be,JSON[_0xcee3('0x17')](_0x55081a));_0x56f705(_0x55081a);})[_0xcee3('0x1c')](function(_0x3ea90f){logger[_0xcee3('0x18')](_0xcee3('0x28'),_0x3ea90f['message'],_0x5ce5be);_0x74019c(_0x298a29[_0xcee3('0x18')](0x1f4,_0x3ea90f[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x2e')]=function(_0x51aae6){var _0x45dab9=this;return new Promise(function(_0x436961,_0x5a7c9f){var _0x305bfa={'body':_0x51aae6[_0xcee3('0x2f')],'channel':_0xcee3('0x30')};var _0x5b4b40=_[_0xcee3('0x31')](_[_0xcee3('0x32')](db[_0xcee3('0x33')][_0xcee3('0x34')]),[_0xcee3('0x35'),'updatedAt','CompanyId',_0xcee3('0x36')]);var _0x41cd61=![];if(_0x51aae6[_0xcee3('0x2f')]['id']){delete _0x51aae6[_0xcee3('0x2f')]['id'];}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')])||_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')]===''){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x39')));}if(_['isNil'](_0x51aae6[_0xcee3('0x2f')]['mapKey'])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3a')+_0x5b4b40));}if(!_['includes'](_0x5b4b40,_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3c')+_0x5b4b40));}var _0x12d32e={};_0x12d32e[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x1e')]['find']({'where':{'id':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db[_0xcee3('0x3e')],'as':'List','include':[{'model':db[_0xcee3('0x33')],'as':_0xcee3('0x3f'),'where':_0x12d32e,'limit':0x1,'order':[[_0xcee3('0x40'),_0xcee3('0x41')]]}]},{'model':db[_0xcee3('0x42')],'as':_0xcee3('0x43')},{'model':db[_0xcee3('0x44')],'as':'Smtp','include':[{'model':db[_0xcee3('0x45')],'as':_0xcee3('0x45')}]}]})[_0xcee3('0x11')](function(_0x27022b){if(_0x27022b&&_0x27022b[_0xcee3('0x46')]){var _0x2a0b71=_0x27022b['get']({'plain':!![]});_0x305bfa[_0xcee3('0x3d')]=_['omit'](_0x2a0b71,[_0xcee3('0x43'),_0xcee3('0x46')]);_0x305bfa[_0xcee3('0x3d')]['smtpOptions']=_0x27022b['getSmtpOptions']();_0x305bfa[_0xcee3('0x47')]=_0x2a0b71[_0xcee3('0x43')];_0x305bfa['list']=_0x2a0b71[_0xcee3('0x46')];_0x305bfa['applications']=_[_0xcee3('0x48')](_0x305bfa[_0xcee3('0x47')],[_0xcee3('0x49')],[_0xcee3('0x4a')]);if(_0x305bfa['account']&&_0x305bfa['account']['autoclose']){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x4b')]({'id':0x0,'priority':_0x305bfa[_0xcee3('0x47')]['length']+0x1,'app':_0xcee3('0x4c'),'appdata':_0xcee3('0x4d'),'interval':_0xcee3('0x4e')});}if(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')]){delete _0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')];}if(_0x305bfa['account']['List']){delete _0x305bfa[_0xcee3('0x3d')]['List'];}if(_0x2a0b71['List']['Contacts'][_0xcee3('0x4f')]){return _0x2a0b71[_0xcee3('0x46')][_0xcee3('0x3f')][0x0];}var _0x295451=_[_0xcee3('0xb')](_0x51aae6['body'],{'firstName':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')],'ListId':_0x2a0b71[_0xcee3('0x36')]});_0x295451[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x33')][_0xcee3('0x50')](_0x295451);}else{throw new Error('List\x20not\x20found');}})[_0xcee3('0x11')](function(_0x2e7a8d){_0x305bfa[_0xcee3('0x51')]=_0x2e7a8d;if(_0x2e7a8d){if(!_0x51aae6['body'][_0xcee3('0x1a')]['messageId']){_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')]=rs[_0xcee3('0x53')]()+'\x20'+_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x38')];}var _0x46f817={'ContactId':_0x2e7a8d['id'],'MailAccountId':_0x51aae6['account']['id'],'inReplyTo':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x38')],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6['body']['message']['attach'],'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0xcee3('0x57'),'attributes':[_0xcee3('0x52')],'where':{'messageId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x58')]}}]})[_0xcee3('0x11')](function(_0x1b5d89){if(_0x1b5d89){return[_0x1b5d89,![]];}return db['MailInteraction']['create'](_0x46f817)[_0xcee3('0x11')](function(_0x9d6ffd){return[_0x9d6ffd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x22e6b9,_0x3ce8ad){if(_0x22e6b9){_0x41cd61=_0x3ce8ad;if(!_0x3ce8ad){return _0x22e6b9[_0xcee3('0x59')]({'inReplyTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x54')],'attach':_0x22e6b9[_0xcee3('0x5a')]?_0x22e6b9['attach']:_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x5a')],'substatus':null,'substatusAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'});}else{return _0x22e6b9;}}})[_0xcee3('0x11')](function(_0x1cb05d){_0x305bfa[_0xcee3('0x5b')]=_0x1cb05d[_0xcee3('0x5c')]({'plain':!![]});_0x305bfa['interaction'][_0xcee3('0x5d')]=_0x41cd61;return db[_0xcee3('0x5e')][_0xcee3('0x50')]({'body':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')],'MailAccountId':_0x51aae6['account']['id'],'MailInteractionId':_0x1cb05d['id'],'direction':'in','ContactId':_0x305bfa[_0xcee3('0x51')]['id'],'messageId':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'from':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'to':_0x51aae6['body'][_0xcee3('0x1a')]['to'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6[_0xcee3('0x2f')]['message']['attach'],'Attachments':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x5f')],'originTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x60')],'originCc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['originCc'],'bcc':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x61')],'ChatWebsiteId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x62')]||null,'originChannel':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x63')]||_0xcee3('0x64'),'ChatOfflineMessageId':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x65')]||null},{'include':[{'model':db[_0xcee3('0x66')],'as':'Attachments'}]});})['then'](function(_0x23cd22){_0x305bfa[_0xcee3('0x1a')]=_0x23cd22;if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x67')]){return;}return db[_0xcee3('0x68')]['find']({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction']['UserId']}});})['then'](function(_0x237a9d){if(_0x237a9d){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x237a9d[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6b')]||0xa),'interval':_0xcee3('0x4e')});}if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x6c')]){return;}return db[_0xcee3('0x6d')][_0xcee3('0x29')]({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction'][_0xcee3('0x6c')]}});})[_0xcee3('0x11')](function(_0x513fce){if(_0x513fce){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x1,'app':_0xcee3('0x6e'),'appdata':_0x513fce[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6f')]||0x12c),'interval':_0xcee3('0x4e')});}return respondWithRpcPromise(_0xcee3('0x70'),_0xcee3('0x71'),_0x305bfa);})[_0xcee3('0x11')](function(_0x17cb5c){_0x436961(_0x17cb5c);})[_0xcee3('0x1c')](function(_0x51d3cf){_0x5a7c9f(_0x45dab9['error'](0x1f4,_0x51d3cf['message']));});});}; \ No newline at end of file +var _0xbd51=['message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','CompanyId','ListId','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','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','get','omit','account','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','defaults','from','create','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','Contact\x20not\x20found','update','subject','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3de8d6,_0xfd3225){_0x3de8d6=_0x3de8d6-0x0;var _0x56c117=_0xbd51[_0x3de8d6];return _0x56c117;};'use strict';var _=require(_0x1bd5('0x0'));var moment=require('moment');var BPromise=require(_0x1bd5('0x1'));var rs=require(_0x1bd5('0x2'));var Redis=require(_0x1bd5('0x3'));var db=require(_0x1bd5('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232c});config[_0x1bd5('0x7')]=_['defaults'](config[_0x1bd5('0x7')],{'host':_0x1bd5('0x8'),'port':0x18eb});var socket=require(_0x1bd5('0x9'))(new Redis(config[_0x1bd5('0x7')]));require(_0x1bd5('0xa'))['register'](socket);function respondWithRpcPromise(_0x36ef1a,_0x5c8e0d,_0x2bd975){return new BPromise(function(_0x28df8e,_0x3b868a){return client[_0x1bd5('0xb')](_0x36ef1a,_0x2bd975)[_0x1bd5('0xc')](function(_0x3e3d06){logger['info'](_0x1bd5('0xd'),_0x5c8e0d,'request\x20sent');logger[_0x1bd5('0xe')](_0x1bd5('0xf'),_0x5c8e0d,_0x1bd5('0x10'),JSON[_0x1bd5('0x11')](_0x3e3d06));if(_0x3e3d06[_0x1bd5('0x12')]){if(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x5c8e0d,_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);return _0x3b868a(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5c8e0d,_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);return _0x28df8e(_0x3e3d06[_0x1bd5('0x12')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xd'),_0x5c8e0d,_0x1bd5('0x10'));_0x28df8e(_0x3e3d06[_0x1bd5('0x16')][_0x1bd5('0x14')]);}})['catch'](function(_0x53ad5e){logger[_0x1bd5('0x12')](_0x1bd5('0xd'),_0x5c8e0d,_0x53ad5e);_0x3b868a(_0x53ad5e);});});}exports[_0x1bd5('0x17')]=function(_0xb95d4e){var _0x459649=this;return new Promise(function(_0x2ff39a,_0x3fbb39){return db[_0x1bd5('0x18')][_0x1bd5('0x19')]({'raw':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1b')]===undefined?!![]:![]:!![],'where':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1c')]||null:null,'attributes':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1d')]||null:null,'limit':_0xb95d4e['options']?_0xb95d4e[_0x1bd5('0x1a')]['limit']||null:null,'include':_0xb95d4e[_0x1bd5('0x1a')]?_0xb95d4e[_0x1bd5('0x1a')][_0x1bd5('0x1e')]?_['map'](_0xb95d4e[_0x1bd5('0x1a')]['include'],function(_0x2ed551){return{'model':db[_0x2ed551[_0x1bd5('0x1f')]],'as':_0x2ed551['as'],'attributes':_0x2ed551[_0x1bd5('0x1d')],'include':_0x2ed551[_0x1bd5('0x1e')]?_['map'](_0x2ed551[_0x1bd5('0x1e')],function(_0x69bb17){return{'model':db[_0x69bb17[_0x1bd5('0x1f')]],'as':_0x69bb17['as'],'attributes':_0x69bb17[_0x1bd5('0x1d')],'include':_0x69bb17['include']?_[_0x1bd5('0x20')](_0x69bb17[_0x1bd5('0x1e')],function(_0x3595e9){return{'model':db[_0x3595e9[_0x1bd5('0x1f')]],'as':_0x3595e9['as'],'attributes':_0x3595e9[_0x1bd5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bd5('0xc')](function(_0x4e72b2){logger[_0x1bd5('0x15')](_0x1bd5('0x17'),_0xb95d4e);logger[_0x1bd5('0xe')]('GetMailAccount',_0xb95d4e,JSON[_0x1bd5('0x11')](_0x4e72b2));_0x2ff39a(_0x4e72b2);})[_0x1bd5('0x21')](function(_0x345181){logger[_0x1bd5('0x12')](_0x1bd5('0x17'),_0x345181[_0x1bd5('0x14')],_0xb95d4e);_0x3fbb39(_0x459649['error'](0x1f4,_0x345181['message']));});});};exports[_0x1bd5('0x22')]=function(_0x305126){var _0x5542aa=this;return new Promise(function(_0x36649d,_0x198b88){return db[_0x1bd5('0x18')][_0x1bd5('0x23')]({'raw':_0x305126['options']?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1b')]===undefined?!![]:![]:!![],'where':_0x305126[_0x1bd5('0x1a')]?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1c')]||null:null,'attributes':_0x305126[_0x1bd5('0x1a')]?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1d')]||null:null,'include':_0x305126['options']?_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1e')]?_[_0x1bd5('0x20')](_0x305126[_0x1bd5('0x1a')][_0x1bd5('0x1e')],function(_0x18a9db){return{'model':db[_0x18a9db[_0x1bd5('0x1f')]],'as':_0x18a9db['as'],'attributes':_0x18a9db['attributes'],'include':_0x18a9db[_0x1bd5('0x1e')]?_[_0x1bd5('0x20')](_0x18a9db[_0x1bd5('0x1e')],function(_0x2f5a48){return{'model':db[_0x2f5a48[_0x1bd5('0x1f')]],'as':_0x2f5a48['as'],'attributes':_0x2f5a48[_0x1bd5('0x1d')],'include':_0x2f5a48[_0x1bd5('0x1e')]?_['map'](_0x2f5a48['include'],function(_0x155e4c){return{'model':db[_0x155e4c[_0x1bd5('0x1f')]],'as':_0x155e4c['as'],'attributes':_0x155e4c[_0x1bd5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4595a0){if(_0x305126['options'][_0x1bd5('0x24')]===!![])_0x4595a0[_0x1bd5('0x25')](_0x1bd5('0x26'),_0x4595a0[_0x1bd5('0x27')]());logger[_0x1bd5('0x15')](_0x1bd5('0x22'),_0x305126);logger[_0x1bd5('0xe')](_0x1bd5('0x22'),_0x305126,JSON['stringify'](_0x4595a0));_0x36649d(_0x4595a0);})[_0x1bd5('0x21')](function(_0x2978d8){logger['error'](_0x1bd5('0x22'),_0x2978d8[_0x1bd5('0x14')],_0x305126);_0x198b88(_0x5542aa[_0x1bd5('0x12')](0x1f4,_0x2978d8['message']));});});};exports[_0x1bd5('0x28')]=function(_0x53482){var _0x2997a2=this;return new Promise(function(_0x4074f1,_0x4e8ff7){var _0x305720={'body':_0x53482[_0x1bd5('0x29')],'channel':_0x1bd5('0x2a')};var _0x11e996=_['difference'](_['keys'](db[_0x1bd5('0x2b')][_0x1bd5('0x2c')]),[_0x1bd5('0x2d'),'updatedAt',_0x1bd5('0x2e'),_0x1bd5('0x2f')]);var _0x574d95=![];if(_0x53482[_0x1bd5('0x29')]['id']){delete _0x53482['body']['id'];}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')]['from'])){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x31')));}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')])||_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')]===''){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x32')));}if(_[_0x1bd5('0x30')](_0x53482[_0x1bd5('0x29')][_0x1bd5('0x33')])){return _0x4e8ff7(_0x2997a2['error'](0x1f4,_0x1bd5('0x34')+_0x11e996));}if(!_[_0x1bd5('0x35')](_0x11e996,_0x53482[_0x1bd5('0x29')]['mapKey'])){return _0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x1bd5('0x36')+_0x11e996));}var _0x5bb8a6={};_0x5bb8a6[_0x53482[_0x1bd5('0x29')]['mapKey']]=_0x53482[_0x1bd5('0x29')]['from'];return db[_0x1bd5('0x18')][_0x1bd5('0x23')]({'where':{'id':_0x53482['account']['id']},'include':[{'model':db[_0x1bd5('0x37')],'as':'List','include':[{'model':db[_0x1bd5('0x2b')],'as':_0x1bd5('0x38'),'where':_0x5bb8a6,'limit':0x1,'order':[[_0x1bd5('0x39'),_0x1bd5('0x3a')]]}]},{'model':db[_0x1bd5('0x3b')],'as':_0x1bd5('0x3c')},{'model':db[_0x1bd5('0x3d')],'as':_0x1bd5('0x3e'),'include':[{'model':db['CloudProvider'],'as':_0x1bd5('0x3f')}]}]})[_0x1bd5('0xc')](function(_0x2a1ece){if(_0x2a1ece&&_0x2a1ece[_0x1bd5('0x40')]){var _0x34452a=_0x2a1ece[_0x1bd5('0x41')]({'plain':!![]});_0x305720['account']=_[_0x1bd5('0x42')](_0x34452a,[_0x1bd5('0x3c'),_0x1bd5('0x40')]);_0x305720[_0x1bd5('0x43')][_0x1bd5('0x26')]=_0x2a1ece[_0x1bd5('0x27')]();_0x305720[_0x1bd5('0x44')]=_0x34452a['Applications'];_0x305720['list']=_0x34452a[_0x1bd5('0x40')];_0x305720[_0x1bd5('0x44')]=_[_0x1bd5('0x45')](_0x305720['applications'],[_0x1bd5('0x46')],[_0x1bd5('0x47')]);if(_0x305720[_0x1bd5('0x43')]&&_0x305720[_0x1bd5('0x43')][_0x1bd5('0x48')]){_0x305720[_0x1bd5('0x44')][_0x1bd5('0x49')]({'id':0x0,'priority':_0x305720['applications'][_0x1bd5('0x4a')]+0x1,'app':_0x1bd5('0x4b'),'appdata':'autoclose','interval':_0x1bd5('0x4c')});}if(_0x305720['account'][_0x1bd5('0x3c')]){delete _0x305720['account'][_0x1bd5('0x3c')];}if(_0x305720[_0x1bd5('0x43')]['List']){delete _0x305720[_0x1bd5('0x43')][_0x1bd5('0x40')];}if(_0x34452a[_0x1bd5('0x40')][_0x1bd5('0x38')][_0x1bd5('0x4a')]){return _0x34452a[_0x1bd5('0x40')][_0x1bd5('0x38')][0x0];}var _0x51aebe=_[_0x1bd5('0x4d')](_0x53482['body'],{'firstName':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x4e')],'ListId':_0x34452a[_0x1bd5('0x2f')]});_0x51aebe[_0x53482['body']['mapKey']]=_0x53482[_0x1bd5('0x29')][_0x1bd5('0x4e')];return db[_0x1bd5('0x2b')][_0x1bd5('0x4f')](_0x51aebe);}else{throw new Error(_0x1bd5('0x50'));}})[_0x1bd5('0xc')](function(_0x46e36c){_0x305720[_0x1bd5('0x51')]=_0x46e36c;if(_0x46e36c){if(!_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['messageId']){_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x52')]=rs[_0x1bd5('0x53')]()+'\x20'+_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x4e')];}var _0x17b3a9={'ContactId':_0x46e36c['id'],'MailAccountId':_0x53482[_0x1bd5('0x43')]['id'],'inReplyTo':_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x52')],'to':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['from'],'cc':_0x53482['body'][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['subject'],'attach':_0x53482['body'][_0x1bd5('0x14')]['attach'],'lastMsgAt':moment()[_0x1bd5('0x54')](_0x1bd5('0x55')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1bd5('0x23')]({'where':{'closed':![],'MailAccountId':_0x53482['account']['id']},'include':[{'model':db[_0x1bd5('0x56')],'as':'Messages','attributes':[_0x1bd5('0x52')],'where':{'messageId':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x57')]}}]})[_0x1bd5('0xc')](function(_0x47ca3f){if(_0x47ca3f){return[_0x47ca3f,![]];}return db['MailInteraction'][_0x1bd5('0x4f')](_0x17b3a9)[_0x1bd5('0xc')](function(_0x1a9ad2){return[_0x1a9ad2,!![]];});});}else{throw new Error(_0x1bd5('0x58'));}})['spread'](function(_0x551f22,_0x14dd41){if(_0x551f22){_0x574d95=_0x14dd41;if(!_0x14dd41){return _0x551f22[_0x1bd5('0x59')]({'inReplyTo':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x52')],'to':_0x53482[_0x1bd5('0x29')]['message']['from'],'cc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5a')],'attach':_0x551f22['attach']?_0x551f22[_0x1bd5('0x5b')]:_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x5b')],'substatus':null,'substatusAt':moment()[_0x1bd5('0x54')](_0x1bd5('0x55')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x551f22;}}})[_0x1bd5('0xc')](function(_0x36d62e){_0x305720[_0x1bd5('0x5c')]=_0x36d62e[_0x1bd5('0x41')]({'plain':!![]});_0x305720[_0x1bd5('0x5c')][_0x1bd5('0x5d')]=_0x574d95;return db[_0x1bd5('0x56')][_0x1bd5('0x4f')]({'body':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x29')],'MailAccountId':_0x53482[_0x1bd5('0x43')]['id'],'MailInteractionId':_0x36d62e['id'],'direction':'in','ContactId':_0x305720[_0x1bd5('0x51')]['id'],'messageId':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x52')],'from':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x4e')],'to':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['to'],'cc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['cc'],'subject':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['subject'],'attach':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5b')],'Attachments':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x5e')],'originTo':_0x53482[_0x1bd5('0x29')]['message'][_0x1bd5('0x5f')],'originCc':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x60')],'bcc':_0x53482['body'][_0x1bd5('0x14')][_0x1bd5('0x61')],'ChatWebsiteId':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')][_0x1bd5('0x62')]||null,'originChannel':_0x53482[_0x1bd5('0x29')][_0x1bd5('0x14')]['originChannel']||_0x1bd5('0x63'),'ChatOfflineMessageId':_0x53482['body']['message'][_0x1bd5('0x64')]||null},{'include':[{'model':db['Attachment'],'as':_0x1bd5('0x65')}]});})[_0x1bd5('0xc')](function(_0x560f20){_0x305720[_0x1bd5('0x14')]=_0x560f20;if(!_0x305720[_0x1bd5('0x5c')][_0x1bd5('0x66')]){return;}return db[_0x1bd5('0x67')][_0x1bd5('0x23')]({'attributes':['id',_0x1bd5('0x68')],'where':{'id':_0x305720['interaction'][_0x1bd5('0x66')]}});})[_0x1bd5('0xc')](function(_0xdd5183){if(_0xdd5183){_0x305720[_0x1bd5('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xdd5183[_0x1bd5('0x68')]+','+(_0x305720[_0x1bd5('0x43')][_0x1bd5('0x69')]||0xa),'interval':_0x1bd5('0x4c')});}if(!_0x305720['interaction'][_0x1bd5('0x6a')]){return;}return db['MailQueue']['find']({'attributes':['id',_0x1bd5('0x68')],'where':{'id':_0x305720['interaction'][_0x1bd5('0x6a')]}});})[_0x1bd5('0xc')](function(_0x231556){if(_0x231556){_0x305720[_0x1bd5('0x44')][_0x1bd5('0x6b')]({'id':0x0,'priority':0x1,'app':_0x1bd5('0x6c'),'appdata':_0x231556[_0x1bd5('0x68')]+','+(_0x305720[_0x1bd5('0x43')][_0x1bd5('0x6d')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1bd5('0x6e'),'startRouting',_0x305720);})['then'](function(_0x59b491){_0x4074f1(_0x59b491);})[_0x1bd5('0x21')](function(_0x524b86){_0x4e8ff7(_0x2997a2[_0x1bd5('0x12')](0x1f4,_0x524b86[_0x1bd5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f06e721..48a1d35 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 _0xc224=['save','remove','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x32ed23,_0x36e53c){var _0x15c3ab=function(_0x110dec){while(--_0x110dec){_0x32ed23['push'](_0x32ed23['shift']());}};_0x15c3ab(++_0x36e53c);}(_0xc224,0x1af));var _0x4c22=function(_0x548234,_0x1f77bd){_0x548234=_0x548234-0x0;var _0x2b8582=_0xc224[_0x548234];return _0x2b8582;};'use strict';var MailAccountEvents=require(_0x4c22('0x0'));var events=[_0x4c22('0x1'),_0x4c22('0x2'),'update'];function createListener(_0x2e2f0e,_0x3e65a2){return function(_0x3b252b){_0x3e65a2[_0x4c22('0x3')](_0x2e2f0e,_0x3b252b);};}function removeListener(_0x369842,_0x313fb9){return function(){MailAccountEvents[_0x4c22('0x4')](_0x369842,_0x313fb9);};}exports[_0x4c22('0x5')]=function(_0x576de1){for(var _0x5d036f=0x0,_0x49f782=events[_0x4c22('0x6')];_0x5d036f<_0x49f782;_0x5d036f++){var _0x3a6191=events[_0x5d036f];var _0x45397c=createListener(_0x4c22('0x7')+_0x3a6191,_0x576de1);MailAccountEvents['on'](_0x3a6191,_0x45397c);}}; \ No newline at end of file +var _0x3f74=['mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x53a82e,_0x4be9d0){var _0x5394b5=function(_0x563b69){while(--_0x563b69){_0x53a82e['push'](_0x53a82e['shift']());}};_0x5394b5(++_0x4be9d0);}(_0x3f74,0x121));var _0x43f7=function(_0x380ae6,_0x595c84){_0x380ae6=_0x380ae6-0x0;var _0x2c9324=_0x3f74[_0x380ae6];return _0x2c9324;};'use strict';var MailAccountEvents=require(_0x43f7('0x0'));var events=[_0x43f7('0x1'),_0x43f7('0x2'),_0x43f7('0x3')];function createListener(_0x20bda0,_0x90cc42){return function(_0x19286c){_0x90cc42[_0x43f7('0x4')](_0x20bda0,_0x19286c);};}function removeListener(_0x591452,_0x1f5e13){return function(){MailAccountEvents[_0x43f7('0x5')](_0x591452,_0x1f5e13);};}exports['register']=function(_0x4fa0e1){for(var _0x37e991=0x0,_0x4f64a6=events[_0x43f7('0x6')];_0x37e991<_0x4f64a6;_0x37e991++){var _0x574b8a=events[_0x37e991];var _0x115f89=createListener(_0x43f7('0x7')+_0x574b8a,_0x4fa0e1);MailAccountEvents['on'](_0x574b8a,_0x115f89);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 46bc6bf..10ae706 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 _0xe4a0=['destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','put','isAuthenticated','update','delete'];(function(_0x2f91a6,_0x4e44ff){var _0x324cb5=function(_0x452102){while(--_0x452102){_0x2f91a6['push'](_0x2f91a6['shift']());}};_0x324cb5(++_0x4e44ff);}(_0xe4a0,0xc5));var _0x0e4a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe4a0[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x0e4a('0x0'));var util=require(_0x0e4a('0x1'));var path=require('path');var timeout=require(_0x0e4a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e4a('0x3'));var auth=require(_0x0e4a('0x4'));var interaction=require(_0x0e4a('0x5'));var config=require('../../config/environment');var controller=require(_0x0e4a('0x6'));router[_0x0e4a('0x7')](_0x0e4a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0e4a('0x9')](_0x0e4a('0x8'),auth[_0x0e4a('0xa')](),controller[_0x0e4a('0xb')]);router[_0x0e4a('0xc')](_0x0e4a('0x8'),auth['isAuthenticated'](),controller[_0x0e4a('0xd')]);module[_0x0e4a('0xe')]=router; \ No newline at end of file +var _0xc5b8=['connect-timeout','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0xc5b8,0x8e));var _0x8c5b=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xc5b8[_0x14e27a];return _0x288688;};'use strict';var multer=require(_0x8c5b('0x0'));var util=require('util');var path=require(_0x8c5b('0x1'));var timeout=require(_0x8c5b('0x2'));var express=require(_0x8c5b('0x3'));var router=express[_0x8c5b('0x4')]();var fs_extra=require(_0x8c5b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c5b('0x6'));var controller=require(_0x8c5b('0x7'));router[_0x8c5b('0x8')](_0x8c5b('0x9'),auth[_0x8c5b('0xa')](),controller[_0x8c5b('0xb')]);router[_0x8c5b('0xc')](_0x8c5b('0x9'),auth[_0x8c5b('0xa')](),controller[_0x8c5b('0xd')]);router['delete'](_0x8c5b('0x9'),auth[_0x8c5b('0xa')](),controller[_0x8c5b('0xe')]);module[_0x8c5b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 15fc5af..afa1a8e 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 _0x0e3a=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x12db55,_0x293a54){var _0x1bc5f5=function(_0x43801b){while(--_0x43801b){_0x12db55['push'](_0x12db55['shift']());}};_0x1bc5f5(++_0x293a54);}(_0x0e3a,0x16b));var _0xa0e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0e3a[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xa0e3('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xa0e3('0x1')],'allowNull':![],'defaultValue':_0xa0e3('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa0e3('0x1')]},'interval':{'type':Sequelize[_0xa0e3('0x1')],'defaultValue':_0xa0e3('0x3')}}; \ No newline at end of file +var _0x9c4d=['STRING','sequelize','exports','INTEGER'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x9c4d,0xd1));var _0xd9c4=function(_0x1d94b7,_0xacda53){_0x1d94b7=_0x1d94b7-0x0;var _0xa0e293=_0x9c4d[_0x1d94b7];return _0xa0e293;};'use strict';var Sequelize=require(_0xd9c4('0x0'));module[_0xd9c4('0x1')]={'priority':{'type':Sequelize[_0xd9c4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd9c4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd9c4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2cc3348..8524a9d 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x2f3104,_0x133bea){var _0x3f0eb7=function(_0x2fe31d){while(--_0x2fe31d){_0x2f3104['push'](_0x2f3104['shift']());}};_0x3f0eb7(++_0x133bea);}(_0xda3f,0xec));var _0xfda3=function(_0x238128,_0x29e2d6){_0x238128=_0x238128-0x0;var _0x41a7f6=_0xda3f[_0x238128];return _0x41a7f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x41642e,_0x97f901){var _0x39ec15=function(_0x2056b9){while(--_0x2056b9){_0x41642e['push'](_0x41642e['shift']());}};_0x39ec15(++_0x97f901);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4f0f377..677324c 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 _0xf53f=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x2195da,_0x567f27){var _0x229a0a=function(_0x2779cd){while(--_0x2779cd){_0x2195da['push'](_0x2195da['shift']());}};_0x229a0a(++_0x567f27);}(_0xf53f,0x191));var _0xff53=function(_0x1c1205,_0x450ea6){_0x1c1205=_0x1c1205-0x0;var _0x5da119=_0xf53f[_0x1c1205];return _0x5da119;};'use strict';var _=require(_0xff53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff53('0x1'));var moment=require('moment');var BPromise=require(_0xff53('0x2'));var rp=require(_0xff53('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff53('0x4'));var config=require(_0xff53('0x5'));var attributes=require(_0xff53('0x6'));module[_0xff53('0x7')]=function(_0x445c67,_0x4918cd){return _0x445c67[_0xff53('0x8')](_0xff53('0x9'),attributes,{'tableName':_0xff53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff53('0xb'),'collate':_0xff53('0xc')});}; \ No newline at end of file +var _0x4680=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','utf8mb4','util'];(function(_0x54f102,_0x546c8d){var _0x138b8c=function(_0x58f93a){while(--_0x58f93a){_0x54f102['push'](_0x54f102['shift']());}};_0x138b8c(++_0x546c8d);}(_0x4680,0xc5));var _0x0468=function(_0x84906e,_0x40c110){_0x84906e=_0x84906e-0x0;var _0x5cfe6a=_0x4680[_0x84906e];return _0x5cfe6a;};'use strict';var _=require('lodash');var util=require(_0x0468('0x0'));var logger=require(_0x0468('0x1'))(_0x0468('0x2'));var moment=require(_0x0468('0x3'));var BPromise=require(_0x0468('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0468('0x5'));var rimraf=require('rimraf');var config=require(_0x0468('0x6'));var attributes=require('./mailApplication.attributes');module[_0x0468('0x7')]=function(_0xeef4ae,_0x49dae9){return _0xeef4ae['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0468('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index deeeea3..e93536a 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 _0x5264=['options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update','body'];(function(_0x2be070,_0x39cf2e){var _0x37eb4a=function(_0x22f28d){while(--_0x22f28d){_0x2be070['push'](_0x2be070['shift']());}};_0x37eb4a(++_0x39cf2e);}(_0x5264,0x81));var _0x4526=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5264[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4526('0x0'));var util=require(_0x4526('0x1'));var moment=require(_0x4526('0x2'));var BPromise=require('bluebird');var rs=require(_0x4526('0x3'));var fs=require('fs');var Redis=require(_0x4526('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4526('0x5'));var logger=require(_0x4526('0x6'))(_0x4526('0x7'));var config=require(_0x4526('0x8'));var jayson=require(_0x4526('0x9'));var client=jayson[_0x4526('0xa')][_0x4526('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6f94,_0x27eb5e,_0x5c99bf){return new BPromise(function(_0x17e721,_0x55b028){return client['request'](_0x3a6f94,_0x5c99bf)[_0x4526('0xc')](function(_0x4c728f){logger[_0x4526('0xd')]('MailApplication,\x20%s,\x20%s',_0x27eb5e,_0x4526('0xe'));logger[_0x4526('0xf')](_0x4526('0x10'),_0x27eb5e,_0x4526('0xe'),JSON['stringify'](_0x4c728f));if(_0x4c728f[_0x4526('0x11')]){if(_0x4c728f[_0x4526('0x11')][_0x4526('0x12')]===0x1f4){logger[_0x4526('0x11')](_0x4526('0x13'),_0x27eb5e,_0x4c728f['error'][_0x4526('0x14')]);return _0x55b028(_0x4c728f[_0x4526('0x11')][_0x4526('0x14')]);}logger[_0x4526('0x11')]('MailApplication,\x20%s,\x20%s',_0x27eb5e,_0x4c728f[_0x4526('0x11')]['message']);return _0x17e721(_0x4c728f['error'][_0x4526('0x14')]);}else{logger[_0x4526('0xd')]('MailApplication,\x20%s,\x20%s',_0x27eb5e,_0x4526('0xe'));_0x17e721(_0x4c728f[_0x4526('0x15')][_0x4526('0x14')]);}})[_0x4526('0x16')](function(_0x5966ae){logger[_0x4526('0x11')]('MailApplication,\x20%s,\x20%s',_0x27eb5e,_0x5966ae);_0x55b028(_0x5966ae);});});}exports[_0x4526('0x17')]=function(_0x334866){var _0x539033=this;return new Promise(function(_0x69b4e,_0x417526){return db['MailApplication'][_0x4526('0x18')](_0x334866[_0x4526('0x19')],{'raw':_0x334866[_0x4526('0x1a')]?_0x334866[_0x4526('0x1a')][_0x4526('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334866['options']?_0x334866[_0x4526('0x1a')][_0x4526('0x1c')]||null:null,'attributes':_0x334866[_0x4526('0x1a')]?_0x334866[_0x4526('0x1a')][_0x4526('0x1d')]||null:null,'limit':_0x334866[_0x4526('0x1a')]?_0x334866[_0x4526('0x1a')][_0x4526('0x1e')]||null:null})[_0x4526('0xc')](function(_0x3eb1d2){logger[_0x4526('0xd')](_0x4526('0x17'),_0x334866);logger[_0x4526('0xf')](_0x4526('0x17'),_0x334866,JSON['stringify'](_0x3eb1d2));_0x69b4e(_0x3eb1d2);})[_0x4526('0x16')](function(_0xd3a152){logger[_0x4526('0x11')](_0x4526('0x17'),_0xd3a152[_0x4526('0x14')],_0x334866);_0x417526(_0x539033['error'](0x1f4,_0xd3a152[_0x4526('0x14')]));});});}; \ No newline at end of file +var _0x13b1=['then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x15b7a9,_0x2fd84a){var _0x1ae32d=function(_0x508191){while(--_0x508191){_0x15b7a9['push'](_0x15b7a9['shift']());}};_0x1ae32d(++_0x2fd84a);}(_0x13b1,0xda));var _0x113b=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x13b1[_0x146a97];return _0x259d5c;};'use strict';var _=require('lodash');var util=require(_0x113b('0x0'));var moment=require(_0x113b('0x1'));var BPromise=require('bluebird');var rs=require(_0x113b('0x2'));var fs=require('fs');var Redis=require(_0x113b('0x3'));var db=require(_0x113b('0x4'))['db'];var utils=require(_0x113b('0x5'));var logger=require(_0x113b('0x6'))(_0x113b('0x7'));var config=require(_0x113b('0x8'));var jayson=require(_0x113b('0x9'));var client=jayson[_0x113b('0xa')][_0x113b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x473bd6,_0xd05115,_0x122fe2){return new BPromise(function(_0x306f99,_0x42d4da){return client[_0x113b('0xc')](_0x473bd6,_0x122fe2)[_0x113b('0xd')](function(_0x5473da){logger[_0x113b('0xe')](_0x113b('0xf'),_0xd05115,_0x113b('0x10'));logger[_0x113b('0x11')](_0x113b('0x12'),_0xd05115,_0x113b('0x10'),JSON[_0x113b('0x13')](_0x5473da));if(_0x5473da[_0x113b('0x14')]){if(_0x5473da[_0x113b('0x14')][_0x113b('0x15')]===0x1f4){logger[_0x113b('0x14')]('MailApplication,\x20%s,\x20%s',_0xd05115,_0x5473da['error'][_0x113b('0x16')]);return _0x42d4da(_0x5473da[_0x113b('0x14')][_0x113b('0x16')]);}logger[_0x113b('0x14')](_0x113b('0xf'),_0xd05115,_0x5473da[_0x113b('0x14')]['message']);return _0x306f99(_0x5473da[_0x113b('0x14')]['message']);}else{logger[_0x113b('0xe')]('MailApplication,\x20%s,\x20%s',_0xd05115,'request\x20sent');_0x306f99(_0x5473da[_0x113b('0x17')]['message']);}})[_0x113b('0x18')](function(_0x4380a2){logger['error'](_0x113b('0xf'),_0xd05115,_0x4380a2);_0x42d4da(_0x4380a2);});});}exports[_0x113b('0x19')]=function(_0xb63175){var _0x1e9ddd=this;return new Promise(function(_0x40d938,_0x59883a){return db['MailApplication'][_0x113b('0x1a')](_0xb63175[_0x113b('0x1b')],{'raw':_0xb63175[_0x113b('0x1c')]?_0xb63175[_0x113b('0x1c')][_0x113b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb63175[_0x113b('0x1c')]?_0xb63175['options'][_0x113b('0x1e')]||null:null,'attributes':_0xb63175['options']?_0xb63175[_0x113b('0x1c')][_0x113b('0x1f')]||null:null,'limit':_0xb63175[_0x113b('0x1c')]?_0xb63175[_0x113b('0x1c')][_0x113b('0x20')]||null:null})[_0x113b('0xd')](function(_0x23cc6e){logger['info'](_0x113b('0x19'),_0xb63175);logger['debug']('UpdateMailApplication',_0xb63175,JSON[_0x113b('0x13')](_0x23cc6e));_0x40d938(_0x23cc6e);})[_0x113b('0x18')](function(_0x5c171a){logger[_0x113b('0x14')](_0x113b('0x19'),_0x5c171a[_0x113b('0x16')],_0xb63175);_0x59883a(_0x1e9ddd[_0x113b('0x14')](0x1f4,_0x5c171a[_0x113b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3360b4f..b39659e 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 _0x092a=['../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','addTags','put','tracked','mail','update','delete','mailinteraction:destroy','destroy','express','Router','../../components/auth/service'];(function(_0x624727,_0x42f874){var _0x5ac512=function(_0x2a45b3){while(--_0x2a45b3){_0x624727['push'](_0x624727['shift']());}};_0x5ac512(++_0x42f874);}(_0x092a,0x18d));var _0xa092=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0x092a[_0x3446af];return _0x252b14;};'use strict';var express=require(_0xa092('0x0'));var router=express[_0xa092('0x1')]();var auth=require(_0xa092('0x2'));var interaction=require(_0xa092('0x3'));var controller=require(_0xa092('0x4'));router[_0xa092('0x5')]('/',auth[_0xa092('0x6')](),controller[_0xa092('0x7')]);router['get'](_0xa092('0x8'),auth['isAuthenticated'](),controller[_0xa092('0x9')]);router[_0xa092('0x5')](_0xa092('0xa'),auth[_0xa092('0x6')](),controller['show']);router[_0xa092('0x5')](_0xa092('0xb'),auth[_0xa092('0x6')](),controller['getMessages']);router['get'](_0xa092('0xc'),auth[_0xa092('0x6')](),controller[_0xa092('0xd')]);router[_0xa092('0xe')]('/',auth[_0xa092('0x6')](),controller['create']);router[_0xa092('0xe')](_0xa092('0xb'),auth[_0xa092('0x6')](),controller[_0xa092('0xf')]);router[_0xa092('0xe')](_0xa092('0x10'),auth[_0xa092('0x6')](),interaction['tracked']('mail','mailinteraction:addtags'),controller[_0xa092('0x11')]);router[_0xa092('0x12')](_0xa092('0xa'),auth[_0xa092('0x6')](),interaction[_0xa092('0x13')](_0xa092('0x14'),'mailinteraction:update'),controller[_0xa092('0x15')]);router[_0xa092('0x16')]('/:id',auth[_0xa092('0x6')](),interaction['tracked'](_0xa092('0x14'),_0xa092('0x17')),controller[_0xa092('0x18')]);router[_0xa092('0x16')](_0xa092('0x10'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xaa0d=['put','mailinteraction:update','update','delete','mail','mailinteraction:destroy','destroy','exports','express','Router','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','mailinteraction:addtags','addTags'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaa0d,0x19d));var _0xdaa0=function(_0xe2e71a,_0x12a51e){_0xe2e71a=_0xe2e71a-0x0;var _0x5e535b=_0xaa0d[_0xe2e71a];return _0x5e535b;};'use strict';var express=require(_0xdaa0('0x0'));var router=express[_0xdaa0('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xdaa0('0x2'));router[_0xdaa0('0x3')]('/',auth[_0xdaa0('0x4')](),controller[_0xdaa0('0x5')]);router[_0xdaa0('0x3')](_0xdaa0('0x6'),auth[_0xdaa0('0x4')](),controller['describe']);router['get'](_0xdaa0('0x7'),auth[_0xdaa0('0x4')](),controller[_0xdaa0('0x8')]);router[_0xdaa0('0x3')](_0xdaa0('0x9'),auth[_0xdaa0('0x4')](),controller[_0xdaa0('0xa')]);router[_0xdaa0('0x3')](_0xdaa0('0xb'),auth[_0xdaa0('0x4')](),controller[_0xdaa0('0xc')]);router['post']('/',auth[_0xdaa0('0x4')](),controller[_0xdaa0('0xd')]);router[_0xdaa0('0xe')]('/:id/messages',auth[_0xdaa0('0x4')](),controller['addMessage']);router[_0xdaa0('0xe')](_0xdaa0('0xf'),auth[_0xdaa0('0x4')](),interaction[_0xdaa0('0x10')]('mail',_0xdaa0('0x11')),controller[_0xdaa0('0x12')]);router[_0xdaa0('0x13')]('/:id',auth[_0xdaa0('0x4')](),interaction[_0xdaa0('0x10')]('mail',_0xdaa0('0x14')),controller[_0xdaa0('0x15')]);router[_0xdaa0('0x16')]('/:id',auth[_0xdaa0('0x4')](),interaction[_0xdaa0('0x10')](_0xdaa0('0x17'),_0xdaa0('0x18')),controller[_0xdaa0('0x19')]);router['delete'](_0xdaa0('0xf'),auth['isAuthenticated'](),controller['removeTags']);module[_0xdaa0('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 9c48d23..3912d59 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 _0x2357=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x2357,0xc1));var _0x7235=function(_0x511f28,_0x172aad){_0x511f28=_0x511f28-0x0;var _0x55a3ee=_0x2357[_0x511f28];return _0x55a3ee;};'use strict';var Sequelize=require(_0x7235('0x0'));var iconv=require('iconv');module[_0x7235('0x1')]={'closed':{'type':Sequelize[_0x7235('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7235('0x3')]},'disposition':{'type':Sequelize[_0x7235('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7235('0x4')](0x1fe)},'to':{'type':Sequelize[_0x7235('0x4')]},'cc':{'type':Sequelize[_0x7235('0x5')](_0x7235('0x6'))},'subject':{'type':Sequelize[_0x7235('0x5')]()},'attach':{'type':Sequelize[_0x7235('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7235('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x7235('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7235('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7235('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7235('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7235('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7235('0x9')]}}; \ No newline at end of file +var _0xc6b1=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM'];(function(_0x703492,_0x46e583){var _0xfe28da=function(_0x575e9b){while(--_0x575e9b){_0x703492['push'](_0x703492['shift']());}};_0xfe28da(++_0x46e583);}(_0xc6b1,0xb5));var _0x1c6b=function(_0x4d3157,_0x318604){_0x4d3157=_0x4d3157-0x0;var _0x56ef95=_0xc6b1[_0x4d3157];return _0x56ef95;};'use strict';var Sequelize=require(_0x1c6b('0x0'));var iconv=require(_0x1c6b('0x1'));module[_0x1c6b('0x2')]={'closed':{'type':Sequelize[_0x1c6b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1c6b('0x4')]},'disposition':{'type':Sequelize[_0x1c6b('0x5')]},'secondDisposition':{'type':Sequelize[_0x1c6b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1c6b('0x5')]},'note':{'type':Sequelize[_0x1c6b('0x5')]},'inReplyTo':{'type':Sequelize[_0x1c6b('0x5')](0x1fe)},'to':{'type':Sequelize[_0x1c6b('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x1c6b('0x6'))},'subject':{'type':Sequelize[_0x1c6b('0x7')]()},'attach':{'type':Sequelize[_0x1c6b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x1c6b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1c6b('0x8')]('in',_0x1c6b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1c6b('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4f4413c..fdbb848 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 _0xd78d=['findOne','length','nolimit','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','bcc','createdAt','mkdirSync','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','error','stack','name','send','index','map','fieldName','type','key','getOptions','mail','query','then','catch','show','params','model','keys','MailInteraction','rawAttributes','filters','intersection','fields','attributes','includeAll','include','merge','options','create','body','update','find','describe','addMessage','MailMessage','ids','getMessages'];(function(_0x1e7429,_0x21d4da){var _0x24a2ab=function(_0x1fcb4d){while(--_0x1fcb4d){_0x1e7429['push'](_0x1e7429['shift']());}};_0x24a2ab(++_0x21d4da);}(_0xd78d,0x116));var _0xdd78=function(_0x24ea68,_0x1bd197){_0x24ea68=_0x24ea68-0x0;var _0x464b4c=_0xd78d[_0x24ea68];return _0x464b4c;};'use strict';var emlformat=require(_0xdd78('0x0'));var rimraf=require(_0xdd78('0x1'));var zipdir=require(_0xdd78('0x2'));var moment=require(_0xdd78('0x3'));var BPromise=require(_0xdd78('0x4'));var util=require(_0xdd78('0x5'));var path=require(_0xdd78('0x6'));var fs=require('fs');var _=require(_0xdd78('0x7'));var juice=require(_0xdd78('0x8'));var Redis=require(_0xdd78('0x9'));var interaction=require(_0xdd78('0xa'));var qs=require(_0xdd78('0xb'));var logger=require('../../config/logger')(_0xdd78('0xc'));var config=require(_0xdd78('0xd'));var db=require(_0xdd78('0xe'))['db'];var htmlEntities=require(_0xdd78('0xf'));config[_0xdd78('0x10')]=_[_0xdd78('0x11')](config[_0xdd78('0x10')],{'host':_0xdd78('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x12b0d1,_0x5be555){_0x5be555=_0x5be555||0xcc;return function(_0x282b12){if(_0x282b12){return _0x12b0d1[_0xdd78('0x13')](_0x5be555);}return _0x12b0d1[_0xdd78('0x14')](_0x5be555)[_0xdd78('0x15')]();};}function respondWithResult(_0x4e196c,_0xd0f170){_0xd0f170=_0xd0f170||0xc8;return function(_0x3e1ce6){if(_0x3e1ce6){return _0x4e196c['status'](_0xd0f170)[_0xdd78('0x16')](_0x3e1ce6);}};}function respondWithFilteredResult(_0x515c6a,_0xec5dc){return function(_0x5dd992){if(_0x5dd992){var _0x57a75e=typeof _0xec5dc[_0xdd78('0x17')]===_0xdd78('0x18')&&typeof _0xec5dc[_0xdd78('0x19')]===_0xdd78('0x18');var _0x129935=_0x5dd992[_0xdd78('0x1a')];var _0x435e7b=_0x57a75e?0x0:_0xec5dc[_0xdd78('0x17')];var _0x42c4b5=_0x57a75e?_0x5dd992[_0xdd78('0x1a')]:_0xec5dc[_0xdd78('0x17')]+_0xec5dc[_0xdd78('0x19')];var _0x565eaf;if(_0x42c4b5>=_0x129935){_0x42c4b5=_0x129935;_0x565eaf=0xc8;}else{_0x565eaf=0xce;}_0x515c6a['status'](_0x565eaf);return _0x515c6a[_0xdd78('0x1b')](_0xdd78('0x1c'),_0x435e7b+'-'+_0x42c4b5+'/'+_0x129935)[_0xdd78('0x16')](_0x5dd992);}return null;};}function saveUpdates(_0x3710c1){return function(_0x3b7c92){if(_0x3b7c92){return _0x3b7c92['update'](_0x3710c1)['then'](function(_0x4b4542){return _0x4b4542;});}return null;};}function removeEntity(_0x785216){return function(_0x3c750d){if(_0x3c750d){return _0x3c750d[_0xdd78('0x1d')]()['then'](function(){_0x785216[_0xdd78('0x14')](0xcc)[_0xdd78('0x15')]();});}};}function handleEntityNotFound(_0xf40e47){return function(_0x179844){if(!_0x179844){_0xf40e47[_0xdd78('0x13')](0x194);}return _0x179844;};}function handleError(_0x288431,_0x4d171e){_0x4d171e=_0x4d171e||0x1f4;return function(_0x5c5d9d){logger[_0xdd78('0x1e')](_0x5c5d9d[_0xdd78('0x1f')]);if(_0x5c5d9d[_0xdd78('0x20')]){delete _0x5c5d9d[_0xdd78('0x20')];}_0x288431[_0xdd78('0x14')](_0x4d171e)[_0xdd78('0x21')](_0x5c5d9d);};}exports[_0xdd78('0x22')]=function(_0x402cb5,_0x235315){var _0x299362={};var _0x404207=_[_0xdd78('0x23')](db['MailInteraction']['rawAttributes'],function(_0x36f3a8){return{'name':_0x36f3a8[_0xdd78('0x24')],'type':_0x36f3a8[_0xdd78('0x25')][_0xdd78('0x26')]};});_0x299362=qs[_0xdd78('0x27')](_0x404207,_0x402cb5);return interaction['findAll'](_0xdd78('0x28'),_0x402cb5[_0xdd78('0x29')],_0x402cb5['user'],_0x299362,_0x404207)[_0xdd78('0x2a')](respondWithFilteredResult(_0x235315,_0x299362))[_0xdd78('0x2b')](handleError(_0x235315,null));};exports[_0xdd78('0x2c')]=function(_0x284099,_0x46fe82){var _0x3ac9db={'raw':![],'where':{'id':_0x284099[_0xdd78('0x2d')]['id']}},_0x371b88={};_0x371b88[_0xdd78('0x2e')]=_[_0xdd78('0x2f')](db[_0xdd78('0x30')][_0xdd78('0x31')]);_0x371b88[_0xdd78('0x29')]=_['keys'](_0x284099['query']);_0x371b88[_0xdd78('0x32')]=_[_0xdd78('0x33')](_0x371b88[_0xdd78('0x2e')],_0x371b88[_0xdd78('0x29')]);_0x3ac9db['attributes']=_[_0xdd78('0x33')](_0x371b88[_0xdd78('0x2e')],qs[_0xdd78('0x34')](_0x284099[_0xdd78('0x29')][_0xdd78('0x34')]));_0x3ac9db[_0xdd78('0x35')]=_0x3ac9db[_0xdd78('0x35')]['length']?_0x3ac9db[_0xdd78('0x35')]:_0x371b88[_0xdd78('0x2e')];if(_0x284099['query'][_0xdd78('0x36')]){_0x3ac9db[_0xdd78('0x37')]=[{'all':!![]}];}_0x3ac9db=_[_0xdd78('0x38')]({},_0x3ac9db,_0x284099[_0xdd78('0x39')]);return db['MailInteraction']['find'](_0x3ac9db)[_0xdd78('0x2a')](handleEntityNotFound(_0x46fe82,null))[_0xdd78('0x2a')](respondWithResult(_0x46fe82,null))[_0xdd78('0x2b')](handleError(_0x46fe82,null));};exports['create']=function(_0x1d4a86,_0x5b64ce){return db[_0xdd78('0x30')][_0xdd78('0x3a')](_0x1d4a86[_0xdd78('0x3b')],{})[_0xdd78('0x2a')](respondWithResult(_0x5b64ce,0xc9))[_0xdd78('0x2b')](handleError(_0x5b64ce,null));};exports[_0xdd78('0x3c')]=function(_0x498332,_0x1d82c5){if(_0x498332[_0xdd78('0x3b')]['id']){delete _0x498332[_0xdd78('0x3b')]['id'];}return db[_0xdd78('0x30')][_0xdd78('0x3d')]({'where':{'id':_0x498332[_0xdd78('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1d82c5,null))[_0xdd78('0x2a')](saveUpdates(_0x498332['body'],null))[_0xdd78('0x2a')](respondWithResult(_0x1d82c5,null))['catch'](handleError(_0x1d82c5,null));};exports['destroy']=function(_0x4a86cf,_0x3c4ac6){return db['MailInteraction'][_0xdd78('0x3d')]({'where':{'id':_0x4a86cf[_0xdd78('0x2d')]['id']}})[_0xdd78('0x2a')](handleEntityNotFound(_0x3c4ac6,null))[_0xdd78('0x2a')](removeEntity(_0x3c4ac6,null))[_0xdd78('0x2b')](handleError(_0x3c4ac6,null));};exports[_0xdd78('0x3e')]=function(_0x128722,_0x38132b){return db[_0xdd78('0x30')][_0xdd78('0x3e')]()[_0xdd78('0x2a')](respondWithResult(_0x38132b,null))[_0xdd78('0x2b')](handleError(_0x38132b,null));};exports[_0xdd78('0x3f')]=function(_0x24d86b,_0x265063){return db[_0xdd78('0x40')][_0xdd78('0x3d')]({'where':{'id':_0x24d86b['params']['id']}})[_0xdd78('0x2a')](handleEntityNotFound(_0x265063,null))[_0xdd78('0x2a')](function(_0x572a4e){if(_0x572a4e){return _0x572a4e[_0xdd78('0x3f')](_0x24d86b[_0xdd78('0x3b')]['ids'],_['omit'](_0x24d86b[_0xdd78('0x3b')],[_0xdd78('0x41'),'id'])||{});}})[_0xdd78('0x2a')](respondWithResult(_0x265063,null))[_0xdd78('0x2b')](handleError(_0x265063,null));};exports[_0xdd78('0x42')]=function(_0x327d3f,_0x5acbaa){var _0x4431dd={'raw':![],'where':{}};var _0x4d7f97={};var _0x4dc209={'count':0x0,'rows':[]};return db[_0xdd78('0x30')][_0xdd78('0x43')]({'where':{'id':_0x327d3f[_0xdd78('0x2d')]['id']}})[_0xdd78('0x2a')](handleEntityNotFound(_0x5acbaa,null))['then'](function(_0x19059e){if(_0x19059e){_0x4d7f97[_0xdd78('0x2e')]=_['keys'](db[_0xdd78('0x40')][_0xdd78('0x31')]);_0x4d7f97[_0xdd78('0x29')]=_[_0xdd78('0x2f')](_0x327d3f[_0xdd78('0x29')]);_0x4d7f97[_0xdd78('0x32')]=_[_0xdd78('0x33')](_0x4d7f97['model'],_0x4d7f97[_0xdd78('0x29')]);_0x4431dd['attributes']=_[_0xdd78('0x33')](_0x4d7f97[_0xdd78('0x2e')],qs['fields'](_0x327d3f[_0xdd78('0x29')][_0xdd78('0x34')]));_0x4431dd[_0xdd78('0x35')]=_0x4431dd['attributes'][_0xdd78('0x44')]?_0x4431dd[_0xdd78('0x35')]:_0x4d7f97[_0xdd78('0x2e')];if(!_0x327d3f[_0xdd78('0x29')]['hasOwnProperty'](_0xdd78('0x45'))){_0x4431dd[_0xdd78('0x19')]=qs[_0xdd78('0x19')](_0x327d3f[_0xdd78('0x29')][_0xdd78('0x19')]);_0x4431dd[_0xdd78('0x17')]=qs[_0xdd78('0x17')](_0x327d3f[_0xdd78('0x29')][_0xdd78('0x17')]);}_0x4431dd['order']=qs[_0xdd78('0x46')](_0x327d3f[_0xdd78('0x29')]['sort']);_0x4431dd['where']=qs[_0xdd78('0x32')](_[_0xdd78('0x47')](_0x327d3f[_0xdd78('0x29')],_0x4d7f97[_0xdd78('0x32')]));_0x4431dd[_0xdd78('0x48')]['MailInteractionId']=_0x19059e['id'];if(_0x327d3f[_0xdd78('0x29')][_0xdd78('0x49')]){_0x4431dd[_0xdd78('0x48')]=_['merge'](_0x4431dd[_0xdd78('0x48')],{'$or':_[_0xdd78('0x23')](_0x4431dd[_0xdd78('0x35')],function(_0x21fe60){var _0x5a9197={};_0x5a9197[_0x21fe60]={'$like':'%'+_0x327d3f['query'][_0xdd78('0x49')]+'%'};return _0x5a9197;})});}if(_0x327d3f[_0xdd78('0x29')][_0xdd78('0x4a')]){var _0x1dc272=_0x327d3f[_0xdd78('0x29')][_0xdd78('0x4a')][_0xdd78('0x4b')](',');var _0x4cb45f={};_0x4cb45f[_0x1dc272[0x0]]={'$gte':moment(_0x1dc272[0x1])[_0xdd78('0x4c')](_0xdd78('0x4d'))};_0x4431dd[_0xdd78('0x48')]=_[_0xdd78('0x38')](_0x4431dd[_0xdd78('0x48')],_0x4cb45f);}_0x4431dd=_['merge']({},_0x4431dd,_0x327d3f[_0xdd78('0x39')]);return db[_0xdd78('0x40')][_0xdd78('0x1a')]({'where':_0x4431dd['where']})[_0xdd78('0x2a')](function(_0x1c2433){_0x4dc209[_0xdd78('0x1a')]=_0x1c2433;if(_0x327d3f['query'][_0xdd78('0x36')]){_0x4431dd[_0xdd78('0x37')]=[{'all':!![]}];}return db[_0xdd78('0x40')][_0xdd78('0x4e')](_0x4431dd);})['then'](function(_0x27b1e2){if(_0x327d3f[_0xdd78('0x29')]['inlineCss']==='true'){for(var _0x7c7f90=0x0;_0x7c7f90<_0x27b1e2[_0xdd78('0x44')];_0x7c7f90++){_0x27b1e2[_0x7c7f90][_0xdd78('0x3b')]=juice(_0x27b1e2[_0x7c7f90]['body']);}}_0x4dc209[_0xdd78('0x4f')]=_0x27b1e2;return _0x4dc209;});}})[_0xdd78('0x2a')](respondWithFilteredResult(_0x5acbaa,_0x4431dd))[_0xdd78('0x2b')](handleError(_0x5acbaa,null));};exports[_0xdd78('0x50')]=function(_0x32694b,_0x26d53a){return db['MailInteraction']['find']({'where':{'id':_0x32694b[_0xdd78('0x2d')]['id']}})['then'](handleEntityNotFound(_0x26d53a,null))[_0xdd78('0x2a')](function(_0x2e5744){if(_0x2e5744){return _0x2e5744[_0xdd78('0x51')](_0x32694b[_0xdd78('0x3b')][_0xdd78('0x41')],_[_0xdd78('0x52')](_0x32694b['body'],[_0xdd78('0x41'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xdd78('0x20'),_0xdd78('0x53')],'where':{'id':_0x32694b[_0xdd78('0x3b')][_0xdd78('0x41')]}});})[_0xdd78('0x2a')](function(_0x37106c){socket[_0xdd78('0x54')](_0xdd78('0x55'),{'id':Number(_0x32694b[_0xdd78('0x2d')]['id']),'tags':_0x37106c||[]});return{'id':Number(_0x32694b[_0xdd78('0x2d')]['id']),'tags':_0x37106c||[]};});}})[_0xdd78('0x2a')](respondWithResult(_0x26d53a,null))[_0xdd78('0x2b')](handleError(_0x26d53a,null));};exports['removeTags']=function(_0x12a4dc,_0x215980){return db[_0xdd78('0x30')][_0xdd78('0x3d')]({'where':{'id':_0x12a4dc[_0xdd78('0x2d')]['id']}})['then'](handleEntityNotFound(_0x215980,null))[_0xdd78('0x2a')](function(_0x10706a){if(_0x10706a){return _0x10706a[_0xdd78('0x56')](_0x12a4dc[_0xdd78('0x29')][_0xdd78('0x41')]);}})[_0xdd78('0x2a')](respondWithStatusCode(_0x215980,null))[_0xdd78('0x2b')](handleError(_0x215980,null));};exports['download']=function(_0x51510d,_0x33a8a9){var _0x3b5b5b=moment()[_0xdd78('0x57')]()[_0xdd78('0x58')]();var _0x92a254=path[_0xdd78('0x59')](config['root'],_0xdd78('0x5a'),_0xdd78('0x5b'),_0xdd78('0x5c'));var _0x43862e=path['join'](config['root'],_0xdd78('0x5a'),'files',_0xdd78('0x5d'));var _0xb1ce4d=path[_0xdd78('0x59')](_0x92a254,_0x3b5b5b);var _0x1e3e9c=util[_0xdd78('0x4c')](_0xdd78('0x5e'),_0x51510d[_0xdd78('0x2d')]['id'],_0x3b5b5b);var _0x32a217=path['join'](_0x92a254,_0x1e3e9c);var _0x185c0c=[];if(_0x51510d['query'][_0xdd78('0x5d')]){_0x185c0c[_0xdd78('0x5f')]({'model':db[_0xdd78('0x60')],'as':'Attachments','raw':!![]});}var _0x23ff53=[{'model':db[_0xdd78('0x40')],'as':_0xdd78('0x61'),'attributes':['id',_0xdd78('0x3b'),_0xdd78('0x62'),'to','cc',_0xdd78('0x63'),'subject',_0xdd78('0x64')],'where':{'secret':![]},'order':qs[_0xdd78('0x46')]('id'),'include':_0x185c0c}];return db[_0xdd78('0x30')][_0xdd78('0x3d')]({'where':{'id':_0x51510d['params']['id']},'include':_0x23ff53})['then'](handleEntityNotFound(_0x33a8a9,null))['then'](function(_0x53652b){if(_0x53652b&&_0x53652b[_0xdd78('0x61')]){var _0x5379e3=_0x53652b['get']({'plain':!![]});fs[_0xdd78('0x65')](_0xb1ce4d);return BPromise['each'](_0x5379e3['Messages'],function(_0x48b7d0,_0x2306b2){var _0xf431f2={'from':_0x48b7d0['from'],'to':_0x48b7d0['to']||_0xdd78('0x66'),'subject':_0x48b7d0[_0xdd78('0x67')],'html':htmlEntities['decode'](_0x48b7d0[_0xdd78('0x3b')]),'headers':{'Date':moment(_0x48b7d0[_0xdd78('0x64')])[_0xdd78('0x4c')](_0xdd78('0x68'))},'attachments':[]};if(_0x48b7d0['cc']){_0xf431f2['headers']['Cc']=_0x48b7d0['cc'];}if(_0x48b7d0['bcc']){_0xf431f2['headers'][_0xdd78('0x69')]=_0x48b7d0[_0xdd78('0x63')];}return new BPromise(function(_0xb7602,_0x29ed6e){if(_0x48b7d0['Attachments']){for(var _0xd2b214=0x0;_0xd2b214<_0x48b7d0['Attachments']['length'];_0xd2b214++){var _0x5bde2e=_0x48b7d0[_0xdd78('0x6a')][_0xd2b214];var _0x248ecb=path[_0xdd78('0x59')](_0x43862e,_0x5bde2e[_0xdd78('0x6b')]);if(fs[_0xdd78('0x6c')](_0x248ecb)){_0xf431f2[_0xdd78('0x5d')]['push']({'name':_0x5bde2e[_0xdd78('0x20')],'contentType':_0x5bde2e['type'],'data':fs[_0xdd78('0x6d')](_0x248ecb)});}}}emlformat[_0xdd78('0x6e')](_0xf431f2,function(_0x54b97c,_0x209853){if(_0x54b97c)return _0x29ed6e(_0x54b97c);fs[_0xdd78('0x6f')](path['join'](_0xb1ce4d,util['format'](_0xdd78('0x70'),_0x2306b2)),_0x209853);return _0xb7602(_0x209853);});});})[_0xdd78('0x2a')](function(){return new BPromise(function(_0x48a945,_0x4d1442){zipdir(_0xb1ce4d,{'saveTo':_0x32a217},function(_0x360e54,_0x44c380){if(_0x360e54)return _0x4d1442(_0x360e54);return _0x48a945(_0x44c380);});})[_0xdd78('0x2a')](function(){return new BPromise(function(_0x4f3c03,_0x255af5){rimraf(_0xb1ce4d,function(_0x22b90d){if(_0x22b90d)_0x255af5(_0x22b90d);return _0x4f3c03();});});})['then'](function(){return _0x33a8a9[_0xdd78('0x71')](_0x32a217,_0x1e3e9c,function(_0x142a45){if(!_0x142a45)fs[_0xdd78('0x72')](_0x32a217);});});});}else{return _0x33a8a9[_0xdd78('0x13')](0xc8);}})[_0xdd78('0x2b')](handleError(_0x33a8a9,null));}; \ No newline at end of file +var _0x0b1f=['addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','headers','Bcc','basename','existsSync','push','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','getOptions','findAll','mail','user','catch','model','query','keys','intersection','attributes','fields','options','create','body','find','params','destroy','describe','addMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','merge','MailMessage','include','inlineCss','true'];(function(_0x419919,_0xc4d1ea){var _0x249673=function(_0x52fd3b){while(--_0x52fd3b){_0x419919['push'](_0x419919['shift']());}};_0x249673(++_0xc4d1ea);}(_0x0b1f,0x1e0));var _0xf0b1=function(_0x2a35df,_0x4ff008){_0x2a35df=_0x2a35df-0x0;var _0x50dd48=_0x0b1f[_0x2a35df];return _0x50dd48;};'use strict';var emlformat=require(_0xf0b1('0x0'));var rimraf=require(_0xf0b1('0x1'));var zipdir=require('zip-dir');var moment=require(_0xf0b1('0x2'));var BPromise=require(_0xf0b1('0x3'));var util=require(_0xf0b1('0x4'));var path=require(_0xf0b1('0x5'));var fs=require('fs');var _=require(_0xf0b1('0x6'));var juice=require('juice');var Redis=require(_0xf0b1('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xf0b1('0x8'));var logger=require(_0xf0b1('0x9'))(_0xf0b1('0xa'));var config=require('../../config/environment');var db=require(_0xf0b1('0xb'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xf0b1('0xc')](config['redis'],{'host':_0xf0b1('0xd'),'port':0x18eb});var socket=require(_0xf0b1('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xf0b1('0xf')](socket);function respondWithStatusCode(_0x419f6a,_0x38e7d7){_0x38e7d7=_0x38e7d7||0xcc;return function(_0x24cc85){if(_0x24cc85){return _0x419f6a[_0xf0b1('0x10')](_0x38e7d7);}return _0x419f6a['status'](_0x38e7d7)[_0xf0b1('0x11')]();};}function respondWithResult(_0x4e008b,_0x8781e0){_0x8781e0=_0x8781e0||0xc8;return function(_0x3f00f2){if(_0x3f00f2){return _0x4e008b[_0xf0b1('0x12')](_0x8781e0)[_0xf0b1('0x13')](_0x3f00f2);}};}function respondWithFilteredResult(_0x36374d,_0x3fed93){return function(_0x424261){if(_0x424261){var _0x49da2e=typeof _0x3fed93[_0xf0b1('0x14')]===_0xf0b1('0x15')&&typeof _0x3fed93[_0xf0b1('0x16')]===_0xf0b1('0x15');var _0x5bebc6=_0x424261[_0xf0b1('0x17')];var _0x31580a=_0x49da2e?0x0:_0x3fed93['offset'];var _0x1d305c=_0x49da2e?_0x424261['count']:_0x3fed93['offset']+_0x3fed93[_0xf0b1('0x16')];var _0x286af3;if(_0x1d305c>=_0x5bebc6){_0x1d305c=_0x5bebc6;_0x286af3=0xc8;}else{_0x286af3=0xce;}_0x36374d['status'](_0x286af3);return _0x36374d[_0xf0b1('0x18')]('Content-Range',_0x31580a+'-'+_0x1d305c+'/'+_0x5bebc6)[_0xf0b1('0x13')](_0x424261);}return null;};}function saveUpdates(_0x5b0c83){return function(_0x56623d){if(_0x56623d){return _0x56623d[_0xf0b1('0x19')](_0x5b0c83)[_0xf0b1('0x1a')](function(_0x20e93f){return _0x20e93f;});}return null;};}function removeEntity(_0x413017){return function(_0x3e0d33){if(_0x3e0d33){return _0x3e0d33['destroy']()['then'](function(){_0x413017[_0xf0b1('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f771){return function(_0x1163b4){if(!_0x1163b4){_0x35f771[_0xf0b1('0x10')](0x194);}return _0x1163b4;};}function handleError(_0x482bc1,_0x40eebc){_0x40eebc=_0x40eebc||0x1f4;return function(_0x595756){logger[_0xf0b1('0x1b')](_0x595756[_0xf0b1('0x1c')]);if(_0x595756['name']){delete _0x595756[_0xf0b1('0x1d')];}_0x482bc1[_0xf0b1('0x12')](_0x40eebc)[_0xf0b1('0x1e')](_0x595756);};}exports[_0xf0b1('0x1f')]=function(_0x30dc27,_0x2c9038){var _0x9e8fdf={};var _0x57e498=_[_0xf0b1('0x20')](db[_0xf0b1('0x21')][_0xf0b1('0x22')],function(_0x2a13f3){return{'name':_0x2a13f3['fieldName'],'type':_0x2a13f3[_0xf0b1('0x23')]['key']};});_0x9e8fdf=qs[_0xf0b1('0x24')](_0x57e498,_0x30dc27);return interaction[_0xf0b1('0x25')](_0xf0b1('0x26'),_0x30dc27['query'],_0x30dc27[_0xf0b1('0x27')],_0x9e8fdf,_0x57e498)['then'](respondWithFilteredResult(_0x2c9038,_0x9e8fdf))[_0xf0b1('0x28')](handleError(_0x2c9038,null));};exports['show']=function(_0x5f0945,_0x8f94a5){var _0x2f3255={'raw':![],'where':{'id':_0x5f0945['params']['id']}},_0xcd3531={};_0xcd3531[_0xf0b1('0x29')]=_['keys'](db[_0xf0b1('0x21')][_0xf0b1('0x22')]);_0xcd3531[_0xf0b1('0x2a')]=_[_0xf0b1('0x2b')](_0x5f0945['query']);_0xcd3531['filters']=_[_0xf0b1('0x2c')](_0xcd3531[_0xf0b1('0x29')],_0xcd3531[_0xf0b1('0x2a')]);_0x2f3255[_0xf0b1('0x2d')]=_[_0xf0b1('0x2c')](_0xcd3531[_0xf0b1('0x29')],qs[_0xf0b1('0x2e')](_0x5f0945[_0xf0b1('0x2a')][_0xf0b1('0x2e')]));_0x2f3255['attributes']=_0x2f3255[_0xf0b1('0x2d')]['length']?_0x2f3255[_0xf0b1('0x2d')]:_0xcd3531['model'];if(_0x5f0945['query']['includeAll']){_0x2f3255['include']=[{'all':!![]}];}_0x2f3255=_['merge']({},_0x2f3255,_0x5f0945[_0xf0b1('0x2f')]);return db[_0xf0b1('0x21')]['find'](_0x2f3255)['then'](handleEntityNotFound(_0x8f94a5,null))['then'](respondWithResult(_0x8f94a5,null))['catch'](handleError(_0x8f94a5,null));};exports[_0xf0b1('0x30')]=function(_0x1e5ab8,_0xf7e908){return db[_0xf0b1('0x21')][_0xf0b1('0x30')](_0x1e5ab8[_0xf0b1('0x31')],{})[_0xf0b1('0x1a')](respondWithResult(_0xf7e908,0xc9))[_0xf0b1('0x28')](handleError(_0xf7e908,null));};exports[_0xf0b1('0x19')]=function(_0x50183e,_0x1122b4){if(_0x50183e['body']['id']){delete _0x50183e[_0xf0b1('0x31')]['id'];}return db['MailInteraction'][_0xf0b1('0x32')]({'where':{'id':_0x50183e[_0xf0b1('0x33')]['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0x1122b4,null))[_0xf0b1('0x1a')](saveUpdates(_0x50183e[_0xf0b1('0x31')],null))['then'](respondWithResult(_0x1122b4,null))[_0xf0b1('0x28')](handleError(_0x1122b4,null));};exports[_0xf0b1('0x34')]=function(_0x17b238,_0x2571c3){return db[_0xf0b1('0x21')]['find']({'where':{'id':_0x17b238[_0xf0b1('0x33')]['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0x2571c3,null))['then'](removeEntity(_0x2571c3,null))[_0xf0b1('0x28')](handleError(_0x2571c3,null));};exports[_0xf0b1('0x35')]=function(_0x10bd71,_0x13dde3){return db[_0xf0b1('0x21')][_0xf0b1('0x35')]()[_0xf0b1('0x1a')](respondWithResult(_0x13dde3,null))[_0xf0b1('0x28')](handleError(_0x13dde3,null));};exports[_0xf0b1('0x36')]=function(_0xc34170,_0xef0532){return db['MailMessage'][_0xf0b1('0x32')]({'where':{'id':_0xc34170[_0xf0b1('0x33')]['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0xef0532,null))[_0xf0b1('0x1a')](function(_0x50b202){if(_0x50b202){return _0x50b202[_0xf0b1('0x36')](_0xc34170[_0xf0b1('0x31')][_0xf0b1('0x37')],_[_0xf0b1('0x38')](_0xc34170[_0xf0b1('0x31')],[_0xf0b1('0x37'),'id'])||{});}})[_0xf0b1('0x1a')](respondWithResult(_0xef0532,null))[_0xf0b1('0x28')](handleError(_0xef0532,null));};exports[_0xf0b1('0x39')]=function(_0x15cd1b,_0x165f0b){var _0x4ba697={'raw':![],'where':{}};var _0x43f1db={};var _0x4a227b={'count':0x0,'rows':[]};return db['MailInteraction'][_0xf0b1('0x3a')]({'where':{'id':_0x15cd1b['params']['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0x165f0b,null))[_0xf0b1('0x1a')](function(_0x592277){if(_0x592277){_0x43f1db[_0xf0b1('0x29')]=_[_0xf0b1('0x2b')](db['MailMessage']['rawAttributes']);_0x43f1db['query']=_['keys'](_0x15cd1b[_0xf0b1('0x2a')]);_0x43f1db[_0xf0b1('0x3b')]=_[_0xf0b1('0x2c')](_0x43f1db[_0xf0b1('0x29')],_0x43f1db['query']);_0x4ba697['attributes']=_[_0xf0b1('0x2c')](_0x43f1db[_0xf0b1('0x29')],qs['fields'](_0x15cd1b['query'][_0xf0b1('0x2e')]));_0x4ba697['attributes']=_0x4ba697[_0xf0b1('0x2d')][_0xf0b1('0x3c')]?_0x4ba697[_0xf0b1('0x2d')]:_0x43f1db[_0xf0b1('0x29')];if(!_0x15cd1b[_0xf0b1('0x2a')][_0xf0b1('0x3d')](_0xf0b1('0x3e'))){_0x4ba697[_0xf0b1('0x16')]=qs[_0xf0b1('0x16')](_0x15cd1b[_0xf0b1('0x2a')][_0xf0b1('0x16')]);_0x4ba697[_0xf0b1('0x14')]=qs[_0xf0b1('0x14')](_0x15cd1b['query']['offset']);}_0x4ba697[_0xf0b1('0x3f')]=qs['sort'](_0x15cd1b[_0xf0b1('0x2a')][_0xf0b1('0x40')]);_0x4ba697[_0xf0b1('0x41')]=qs[_0xf0b1('0x3b')](_['pick'](_0x15cd1b[_0xf0b1('0x2a')],_0x43f1db[_0xf0b1('0x3b')]));_0x4ba697[_0xf0b1('0x41')][_0xf0b1('0x42')]=_0x592277['id'];if(_0x15cd1b['query'][_0xf0b1('0x43')]){_0x4ba697[_0xf0b1('0x41')]=_['merge'](_0x4ba697[_0xf0b1('0x41')],{'$or':_[_0xf0b1('0x20')](_0x4ba697['attributes'],function(_0x23af07){var _0x49fb66={};_0x49fb66[_0x23af07]={'$like':'%'+_0x15cd1b['query'][_0xf0b1('0x43')]+'%'};return _0x49fb66;})});}if(_0x15cd1b[_0xf0b1('0x2a')]['$gte']){var _0x4c897f=_0x15cd1b[_0xf0b1('0x2a')]['$gte']['split'](',');var _0x4bce68={};_0x4bce68[_0x4c897f[0x0]]={'$gte':moment(_0x4c897f[0x1])[_0xf0b1('0x44')](_0xf0b1('0x45'))};_0x4ba697[_0xf0b1('0x41')]=_[_0xf0b1('0x46')](_0x4ba697[_0xf0b1('0x41')],_0x4bce68);}_0x4ba697=_[_0xf0b1('0x46')]({},_0x4ba697,_0x15cd1b[_0xf0b1('0x2f')]);return db[_0xf0b1('0x47')][_0xf0b1('0x17')]({'where':_0x4ba697[_0xf0b1('0x41')]})['then'](function(_0x2d6c09){_0x4a227b[_0xf0b1('0x17')]=_0x2d6c09;if(_0x15cd1b[_0xf0b1('0x2a')]['includeAll']){_0x4ba697[_0xf0b1('0x48')]=[{'all':!![]}];}return db[_0xf0b1('0x47')][_0xf0b1('0x25')](_0x4ba697);})['then'](function(_0x5317ec){if(_0x15cd1b[_0xf0b1('0x2a')][_0xf0b1('0x49')]===_0xf0b1('0x4a')){for(var _0x28c532=0x0;_0x28c532<_0x5317ec['length'];_0x28c532++){_0x5317ec[_0x28c532][_0xf0b1('0x31')]=juice(_0x5317ec[_0x28c532][_0xf0b1('0x31')]);}}_0x4a227b['rows']=_0x5317ec;return _0x4a227b;});}})[_0xf0b1('0x1a')](respondWithFilteredResult(_0x165f0b,_0x4ba697))[_0xf0b1('0x28')](handleError(_0x165f0b,null));};exports[_0xf0b1('0x4b')]=function(_0x2bc0ef,_0x2bd927){return db[_0xf0b1('0x21')][_0xf0b1('0x32')]({'where':{'id':_0x2bc0ef[_0xf0b1('0x33')]['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0x2bd927,null))[_0xf0b1('0x1a')](function(_0x4954cc){if(_0x4954cc){return _0x4954cc[_0xf0b1('0x4c')](_0x2bc0ef[_0xf0b1('0x31')][_0xf0b1('0x37')],_['omit'](_0x2bc0ef[_0xf0b1('0x31')],[_0xf0b1('0x37'),'id'])||{})[_0xf0b1('0x4d')](function(){return db[_0xf0b1('0x4e')][_0xf0b1('0x25')]({'attributes':['id',_0xf0b1('0x1d'),_0xf0b1('0x4f')],'where':{'id':_0x2bc0ef[_0xf0b1('0x31')][_0xf0b1('0x37')]}});})[_0xf0b1('0x1a')](function(_0x2cf335){socket[_0xf0b1('0x50')](_0xf0b1('0x51'),{'id':Number(_0x2bc0ef[_0xf0b1('0x33')]['id']),'tags':_0x2cf335||[]});return{'id':Number(_0x2bc0ef['params']['id']),'tags':_0x2cf335||[]};});}})['then'](respondWithResult(_0x2bd927,null))[_0xf0b1('0x28')](handleError(_0x2bd927,null));};exports[_0xf0b1('0x52')]=function(_0x13ac45,_0x2ec49d){return db['MailInteraction'][_0xf0b1('0x32')]({'where':{'id':_0x13ac45['params']['id']}})[_0xf0b1('0x1a')](handleEntityNotFound(_0x2ec49d,null))[_0xf0b1('0x1a')](function(_0x350716){if(_0x350716){return _0x350716['removeTags'](_0x13ac45[_0xf0b1('0x2a')][_0xf0b1('0x37')]);}})[_0xf0b1('0x1a')](respondWithStatusCode(_0x2ec49d,null))[_0xf0b1('0x28')](handleError(_0x2ec49d,null));};exports['download']=function(_0x2db55e,_0x149314){var _0x28def1=moment()[_0xf0b1('0x53')]()[_0xf0b1('0x54')]();var _0x40448c=path[_0xf0b1('0x55')](config['root'],_0xf0b1('0x56'),'files',_0xf0b1('0x57'));var _0x31e701=path[_0xf0b1('0x55')](config[_0xf0b1('0x58')],'server','files',_0xf0b1('0x59'));var _0x2d8afe=path[_0xf0b1('0x55')](_0x40448c,_0x28def1);var _0xfcd924=util[_0xf0b1('0x44')](_0xf0b1('0x5a'),_0x2db55e[_0xf0b1('0x33')]['id'],_0x28def1);var _0x42dcce=path[_0xf0b1('0x55')](_0x40448c,_0xfcd924);var _0x3e0137=[];if(_0x2db55e['query'][_0xf0b1('0x59')]){_0x3e0137['push']({'model':db[_0xf0b1('0x5b')],'as':_0xf0b1('0x5c'),'raw':!![]});}var _0x52198f=[{'model':db[_0xf0b1('0x47')],'as':_0xf0b1('0x5d'),'attributes':['id',_0xf0b1('0x31'),_0xf0b1('0x5e'),'to','cc',_0xf0b1('0x5f'),'subject',_0xf0b1('0x60')],'where':{'secret':![]},'order':qs[_0xf0b1('0x40')]('id'),'include':_0x3e0137}];return db[_0xf0b1('0x21')][_0xf0b1('0x32')]({'where':{'id':_0x2db55e['params']['id']},'include':_0x52198f})[_0xf0b1('0x1a')](handleEntityNotFound(_0x149314,null))[_0xf0b1('0x1a')](function(_0x5a6d24){if(_0x5a6d24&&_0x5a6d24[_0xf0b1('0x5d')]){var _0x3e35c1=_0x5a6d24[_0xf0b1('0x61')]({'plain':!![]});fs[_0xf0b1('0x62')](_0x2d8afe);return BPromise[_0xf0b1('0x63')](_0x3e35c1[_0xf0b1('0x5d')],function(_0x840948,_0x5b851a){var _0x5a0780={'from':_0x840948['from'],'to':_0x840948['to']||_0xf0b1('0x64'),'subject':_0x840948['subject'],'html':htmlEntities['decode'](_0x840948[_0xf0b1('0x31')]),'headers':{'Date':moment(_0x840948['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x840948['cc']){_0x5a0780['headers']['Cc']=_0x840948['cc'];}if(_0x840948[_0xf0b1('0x5f')]){_0x5a0780[_0xf0b1('0x65')][_0xf0b1('0x66')]=_0x840948[_0xf0b1('0x5f')];}return new BPromise(function(_0x5a7478,_0x2e33f9){if(_0x840948[_0xf0b1('0x5c')]){for(var _0x3c7753=0x0;_0x3c7753<_0x840948[_0xf0b1('0x5c')][_0xf0b1('0x3c')];_0x3c7753++){var _0x95eb20=_0x840948[_0xf0b1('0x5c')][_0x3c7753];var _0x12c425=path[_0xf0b1('0x55')](_0x31e701,_0x95eb20[_0xf0b1('0x67')]);if(fs[_0xf0b1('0x68')](_0x12c425)){_0x5a0780[_0xf0b1('0x59')][_0xf0b1('0x69')]({'name':_0x95eb20[_0xf0b1('0x1d')],'contentType':_0x95eb20[_0xf0b1('0x23')],'data':fs[_0xf0b1('0x6a')](_0x12c425)});}}}emlformat[_0xf0b1('0x6b')](_0x5a0780,function(_0x43939c,_0x4f16b5){if(_0x43939c)return _0x2e33f9(_0x43939c);fs['writeFileSync'](path[_0xf0b1('0x55')](_0x2d8afe,util[_0xf0b1('0x44')](_0xf0b1('0x6c'),_0x5b851a)),_0x4f16b5);return _0x5a7478(_0x4f16b5);});});})['then'](function(){return new BPromise(function(_0x4003bb,_0x5b86ea){zipdir(_0x2d8afe,{'saveTo':_0x42dcce},function(_0x5df8ae,_0x585e5d){if(_0x5df8ae)return _0x5b86ea(_0x5df8ae);return _0x4003bb(_0x585e5d);});})['then'](function(){return new BPromise(function(_0x5e3965,_0x373e5f){rimraf(_0x2d8afe,function(_0x4b9b51){if(_0x4b9b51)_0x373e5f(_0x4b9b51);return _0x5e3965();});});})['then'](function(){return _0x149314[_0xf0b1('0x6d')](_0x42dcce,_0xfcd924,function(_0x276fa2){if(!_0x276fa2)fs[_0xf0b1('0x6e')](_0x42dcce);});});});}else{return _0x149314[_0xf0b1('0x10')](0xc8);}})[_0xf0b1('0x28')](handleError(_0x149314,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index eb1898d..36d28a5 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 _0xe1cd=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','events'];(function(_0x3ab936,_0x4f4d92){var _0x105c86=function(_0x2b4c5d){while(--_0x2b4c5d){_0x3ab936['push'](_0x3ab936['shift']());}};_0x105c86(++_0x4f4d92);}(_0xe1cd,0x95));var _0xde1c=function(_0x320c2c,_0x2b5c01){_0x320c2c=_0x320c2c-0x0;var _0x3c87b0=_0xe1cd[_0x320c2c];return _0x3c87b0;};'use strict';var EventEmitter=require(_0xde1c('0x0'));var MailInteraction=require(_0xde1c('0x1'))['db'][_0xde1c('0x2')];var MailMessage=require(_0xde1c('0x1'))['db'][_0xde1c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xde1c('0x4')](0x0);var events={'afterCreate':_0xde1c('0x5'),'afterUpdate':'update','afterDestroy':_0xde1c('0x6')};function emitEvent(_0x7a692){return function(_0x346ac9,_0x47e45c,_0x147768){_0x346ac9[_0xde1c('0x7')]({'attributes':['id'],'raw':!![]})[_0xde1c('0x8')](function(_0x2f73b4){_0x346ac9[_0xde1c('0x9')](_0xde1c('0xa'),_0x2f73b4['map'](function(_0x31ca0e){return{'id':_0x31ca0e['id']};}));return MailMessage[_0xde1c('0xb')]({'where':{'MailInteractionId':_0x346ac9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde1c('0x8')](function(_0x318627){_0x346ac9['setDataValue'](_0xde1c('0xc'),_0x318627['length']);MailInteractionEvents[_0xde1c('0xd')](_0x7a692+':'+_0x346ac9['id'],_0x346ac9);MailInteractionEvents[_0xde1c('0xd')](_0x7a692,_0x346ac9);_0x147768(null);})[_0xde1c('0xe')](_0x147768(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xe55d=['then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','remove','getUsers'];(function(_0x3141f8,_0xc7e547){var _0x5b3d1f=function(_0x493866){while(--_0x493866){_0x3141f8['push'](_0x3141f8['shift']());}};_0x5b3d1f(++_0xc7e547);}(_0xe55d,0x81));var _0xde55=function(_0x1b1211,_0x25a3ec){_0x1b1211=_0x1b1211-0x0;var _0x458eea=_0xe55d[_0x1b1211];return _0x458eea;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xde55('0x0'))['db'][_0xde55('0x1')];var MailMessage=require(_0xde55('0x0'))['db'][_0xde55('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xde55('0x3'),'afterUpdate':'update','afterDestroy':_0xde55('0x4')};function emitEvent(_0x3097a3){return function(_0x48b6ab,_0x5b7168,_0x1b5471){_0x48b6ab[_0xde55('0x5')]({'attributes':['id'],'raw':!![]})[_0xde55('0x6')](function(_0x5c0382){_0x48b6ab[_0xde55('0x7')]('Users',_0x5c0382[_0xde55('0x8')](function(_0x4bc355){return{'id':_0x4bc355['id']};}));return MailMessage[_0xde55('0x9')]({'where':{'MailInteractionId':_0x48b6ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde55('0x6')](function(_0x2141c1){_0x48b6ab[_0xde55('0x7')](_0xde55('0xa'),_0x2141c1['length']);MailInteractionEvents[_0xde55('0xb')](_0x3097a3+':'+_0x48b6ab['id'],_0x48b6ab);MailInteractionEvents[_0xde55('0xb')](_0x3097a3,_0x48b6ab);_0x1b5471(null);})['catch'](_0x1b5471(null));};}for(var e in events){if(events[_0xde55('0xc')](e)){var event=events[e];MailInteraction[_0xde55('0xd')](e,emitEvent(event));}}module[_0xde55('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ac7f3a0..eff2744 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 _0x430a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x6045e7,_0x25786a){var _0x3b626e=function(_0x4e09d5){while(--_0x4e09d5){_0x6045e7['push'](_0x6045e7['shift']());}};_0x3b626e(++_0x25786a);}(_0x430a,0x1a3));var _0xa430=function(_0x45853d,_0x241369){_0x45853d=_0x45853d-0x0;var _0x1fafec=_0x430a[_0x45853d];return _0x1fafec;};'use strict';var _=require('lodash');var util=require(_0xa430('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa430('0x1'));var BPromise=require(_0xa430('0x2'));var rp=require(_0xa430('0x3'));var fs=require('fs');var path=require(_0xa430('0x4'));var rimraf=require(_0xa430('0x5'));var config=require(_0xa430('0x6'));var attributes=require(_0xa430('0x7'));module[_0xa430('0x8')]=function(_0x5c5153,_0x305f42){return _0x5c5153[_0xa430('0x9')](_0xa430('0xa'),attributes,{'tableName':_0xa430('0xb'),'paranoid':![],'indexes':[{'name':_0xa430('0xc'),'fields':[_0xa430('0xd'),'to'],'type':_0xa430('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a5337,_0x2e213a,_0x35a8a9){if(_0x4a5337[_0xa430('0xf')]){_0x4a5337[_0xa430('0x10')]=moment()['format'](_0xa430('0x11'));}if(_0x4a5337[_0xa430('0x12')]){_0x4a5337[_0xa430('0x13')]=moment()[_0xa430('0x14')]('YYYY-MM-DD\x20HH:mm:ss');}_0x35a8a9(null,_0x2e213a);},'beforeUpdate':function(_0x518f02,_0x34f6f7,_0x36374f){if(_0x518f02[_0xa430('0x15')](_0xa430('0xf'))){_0x518f02[_0xa430('0x10')]=_0x518f02[_0xa430('0xf')]?moment()[_0xa430('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x518f02[_0xa430('0x15')](_0xa430('0x12'))){_0x518f02[_0xa430('0x13')]=moment()[_0xa430('0x14')](_0xa430('0x11'));_0x518f02['substatus']=null;_0x518f02['substatusAt']=null;}_0x36374f(null,_0x518f02);},'afterUpdate':function(_0x410be3,_0x2acab0,_0x5d9a70){var _0x2f9383=_0x5c5153['models'];var _0x261dd7=_0x410be3[_0xa430('0x16')]({'plain':!![]});if(_0x261dd7[_0xa430('0x12')]){return _0x2f9383['MailMessage'][_0xa430('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x261dd7['id']}})[_0xa430('0x18')](function(){_0x5d9a70();})[_0xa430('0x19')](function(_0x5a8a80){_0x5d9a70(_0x5a8a80);});}else{_0x5d9a70();}}},'charset':_0xa430('0x1a'),'collate':_0xa430('0x1b')});}; \ No newline at end of file +var _0x2389=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xff7025,_0x237d34){var _0x10fc95=function(_0x4adc7a){while(--_0x4adc7a){_0xff7025['push'](_0xff7025['shift']());}};_0x10fc95(++_0x237d34);}(_0x2389,0x1f0));var _0x9238=function(_0x275983,_0x2e8bb0){_0x275983=_0x275983-0x0;var _0x234332=_0x2389[_0x275983];return _0x234332;};'use strict';var _=require('lodash');var util=require(_0x9238('0x0'));var logger=require(_0x9238('0x1'))(_0x9238('0x2'));var moment=require(_0x9238('0x3'));var BPromise=require('bluebird');var rp=require(_0x9238('0x4'));var fs=require('fs');var path=require(_0x9238('0x5'));var rimraf=require(_0x9238('0x6'));var config=require(_0x9238('0x7'));var attributes=require(_0x9238('0x8'));module[_0x9238('0x9')]=function(_0x516217,_0x575206){return _0x516217[_0x9238('0xa')](_0x9238('0xb'),attributes,{'tableName':_0x9238('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x9238('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x101ba9,_0x55fa4a,_0x501da1){if(_0x101ba9[_0x9238('0xe')]){_0x101ba9[_0x9238('0xf')]=moment()[_0x9238('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x101ba9[_0x9238('0x11')]){_0x101ba9['closedAt']=moment()[_0x9238('0x10')](_0x9238('0x12'));}_0x501da1(null,_0x55fa4a);},'beforeUpdate':function(_0x44c398,_0x37f5f7,_0x44b1fa){if(_0x44c398['changed'](_0x9238('0xe'))){_0x44c398[_0x9238('0xf')]=_0x44c398['substatus']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x44c398[_0x9238('0x13')](_0x9238('0x11'))){_0x44c398[_0x9238('0x14')]=moment()[_0x9238('0x10')](_0x9238('0x12'));_0x44c398[_0x9238('0xe')]=null;_0x44c398[_0x9238('0xf')]=null;}_0x44b1fa(null,_0x44c398);},'afterUpdate':function(_0x4ab046,_0x147be3,_0x462dac){var _0x405d7c=_0x516217[_0x9238('0x15')];var _0x34e056=_0x4ab046[_0x9238('0x16')]({'plain':!![]});if(_0x34e056[_0x9238('0x11')]){return _0x405d7c[_0x9238('0x17')][_0x9238('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x34e056['id']}})[_0x9238('0x19')](function(){_0x462dac();})[_0x9238('0x1a')](function(_0x31674e){_0x462dac(_0x31674e);});}else{_0x462dac();}}},'charset':_0x9238('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index bd4cd18..efc358b 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 _0x0a01=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','find','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x25745c,_0x4c7e38){var _0x1b3e14=function(_0x1585a1){while(--_0x1585a1){_0x25745c['push'](_0x25745c['shift']());}};_0x1b3e14(++_0x4c7e38);}(_0x0a01,0x1a6));var _0x10a0=function(_0x4fa8b5,_0x7c24ec){_0x4fa8b5=_0x4fa8b5-0x0;var _0x1b0ec2=_0x0a01[_0x4fa8b5];return _0x1b0ec2;};'use strict';var _=require(_0x10a0('0x0'));var util=require(_0x10a0('0x1'));var moment=require(_0x10a0('0x2'));var BPromise=require(_0x10a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10a0('0x4'));var db=require(_0x10a0('0x5'))['db'];var utils=require(_0x10a0('0x6'));var logger=require(_0x10a0('0x7'))(_0x10a0('0x8'));var config=require(_0x10a0('0x9'));var jayson=require(_0x10a0('0xa'));var client=jayson[_0x10a0('0xb')]['http']({'port':0x232a});config[_0x10a0('0xc')]=_[_0x10a0('0xd')](config[_0x10a0('0xc')],{'host':_0x10a0('0xe'),'port':0x18eb});var socket=require(_0x10a0('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x591e2b,_0x1ec17e,_0x3e7a73){return new BPromise(function(_0x44942d,_0xee400d){return client[_0x10a0('0x10')](_0x591e2b,_0x3e7a73)[_0x10a0('0x11')](function(_0x14456c){logger[_0x10a0('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1ec17e,_0x10a0('0x13'));logger[_0x10a0('0x14')](_0x10a0('0x15'),_0x1ec17e,_0x10a0('0x13'),JSON[_0x10a0('0x16')](_0x14456c));if(_0x14456c['error']){if(_0x14456c[_0x10a0('0x17')][_0x10a0('0x18')]===0x1f4){logger[_0x10a0('0x17')](_0x10a0('0x19'),_0x1ec17e,_0x14456c[_0x10a0('0x17')][_0x10a0('0x1a')]);return _0xee400d(_0x14456c['error'][_0x10a0('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x1ec17e,_0x14456c['error']['message']);return _0x44942d(_0x14456c[_0x10a0('0x17')][_0x10a0('0x1a')]);}else{logger[_0x10a0('0x12')](_0x10a0('0x19'),_0x1ec17e,_0x10a0('0x13'));_0x44942d(_0x14456c['result'][_0x10a0('0x1a')]);}})[_0x10a0('0x1b')](function(_0x506b42){logger['error']('MailInteraction,\x20%s,\x20%s',_0x1ec17e,_0x506b42);_0xee400d(_0x506b42);});});}exports[_0x10a0('0x1c')]=function(_0x37350c){var _0xfb9163=this;return new Promise(function(_0x17e961,_0x1bf19f){return db[_0x10a0('0x1d')][_0x10a0('0x1e')](_0x37350c[_0x10a0('0x1f')],{'raw':_0x37350c[_0x10a0('0x20')]?_0x37350c['options'][_0x10a0('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37350c[_0x10a0('0x20')]?_0x37350c[_0x10a0('0x20')][_0x10a0('0x22')]||null:null,'attributes':_0x37350c['options']?_0x37350c['options'][_0x10a0('0x23')]||null:null,'limit':_0x37350c[_0x10a0('0x20')]?_0x37350c[_0x10a0('0x20')]['limit']||null:null})[_0x10a0('0x11')](function(_0xffa582){logger[_0x10a0('0x12')](_0x10a0('0x1c'),_0x37350c);logger['debug'](_0x10a0('0x1c'),_0x37350c,JSON[_0x10a0('0x16')](_0xffa582));_0x17e961(_0xffa582);})[_0x10a0('0x1b')](function(_0x190b47){logger[_0x10a0('0x17')](_0x10a0('0x1c'),_0x190b47[_0x10a0('0x1a')],_0x37350c);_0x1bf19f(_0xfb9163['error'](0x1f4,_0x190b47[_0x10a0('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x18c9b5){return new Promise(function(_0x49ab3b,_0x3be3f1){return db['MailInteraction'][_0x10a0('0x24')]({'where':_0x18c9b5[_0x10a0('0x20')]?_0x18c9b5[_0x10a0('0x20')]['where']||null:null})['then'](function(_0x42749b){if(_0x42749b){return _0x42749b['addTags'](_0x18c9b5[_0x10a0('0x1f')]['ids'],_['omit'](_0x18c9b5['body'],[_0x10a0('0x25'),'id'])||{});}})['spread'](function(_0x48dd5c){logger[_0x10a0('0x12')](_0x10a0('0x26'),_0x18c9b5);logger['debug'](_0x10a0('0x26'),_0x18c9b5,JSON[_0x10a0('0x16')](_0x48dd5c));_0x49ab3b(_0x48dd5c);})[_0x10a0('0x1b')](function(_0x3ef8fc){logger[_0x10a0('0x17')](_0x10a0('0x26'),_0x3ef8fc[_0x10a0('0x1a')],_0x18c9b5);_0x3be3f1(_this[_0x10a0('0x17')](0x1f4,_0x3ef8fc[_0x10a0('0x1a')]));});});}; \ No newline at end of file +var _0x5186=['find','addTags','ids','omit','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction'];(function(_0x7072c1,_0x264b9e){var _0x10a0bf=function(_0x5e6ae8){while(--_0x5e6ae8){_0x7072c1['push'](_0x7072c1['shift']());}};_0x10a0bf(++_0x264b9e);}(_0x5186,0x180));var _0x6518=function(_0x1694e4,_0x555d67){_0x1694e4=_0x1694e4-0x0;var _0x3c087d=_0x5186[_0x1694e4];return _0x3c087d;};'use strict';var _=require(_0x6518('0x0'));var util=require(_0x6518('0x1'));var moment=require(_0x6518('0x2'));var BPromise=require(_0x6518('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6518('0x4'));var db=require(_0x6518('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6518('0x6'));var config=require('../../config/environment');var jayson=require(_0x6518('0x7'));var client=jayson[_0x6518('0x8')][_0x6518('0x9')]({'port':0x232a});config['redis']=_[_0x6518('0xa')](config['redis'],{'host':_0x6518('0xb'),'port':0x18eb});var socket=require(_0x6518('0xc'))(new Redis(config[_0x6518('0xd')]));require(_0x6518('0xe'))['register'](socket);function respondWithRpcPromise(_0x3414ff,_0x3b2e34,_0x2ba042){return new BPromise(function(_0x3e42dd,_0x3ea3d7){return client[_0x6518('0xf')](_0x3414ff,_0x2ba042)[_0x6518('0x10')](function(_0xaa4c87){logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));logger['debug'](_0x6518('0x14'),_0x3b2e34,_0x6518('0x13'),JSON[_0x6518('0x15')](_0xaa4c87));if(_0xaa4c87['error']){if(_0xaa4c87['error'][_0x6518('0x16')]===0x1f4){logger[_0x6518('0x17')]('MailInteraction,\x20%s,\x20%s',_0x3b2e34,_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);return _0x3ea3d7(_0xaa4c87['error'][_0x6518('0x18')]);}logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0xaa4c87['error']['message']);return _0x3e42dd(_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);}else{logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));_0x3e42dd(_0xaa4c87['result'][_0x6518('0x18')]);}})[_0x6518('0x19')](function(_0x53f49a){logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0x53f49a);_0x3ea3d7(_0x53f49a);});});}exports[_0x6518('0x1a')]=function(_0x29302e){var _0x486a0f=this;return new Promise(function(_0x2fa8a9,_0x5785ff){return db[_0x6518('0x1b')][_0x6518('0x1c')](_0x29302e[_0x6518('0x1d')],{'raw':_0x29302e['options']?_0x29302e[_0x6518('0x1e')][_0x6518('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29302e[_0x6518('0x1e')]?_0x29302e[_0x6518('0x1e')][_0x6518('0x20')]||null:null,'attributes':_0x29302e[_0x6518('0x1e')]?_0x29302e[_0x6518('0x1e')][_0x6518('0x21')]||null:null,'limit':_0x29302e['options']?_0x29302e[_0x6518('0x1e')][_0x6518('0x22')]||null:null})[_0x6518('0x10')](function(_0x466c05){logger[_0x6518('0x11')](_0x6518('0x1a'),_0x29302e);logger['debug']('UpdateMailInteraction',_0x29302e,JSON[_0x6518('0x15')](_0x466c05));_0x2fa8a9(_0x466c05);})['catch'](function(_0x463f49){logger[_0x6518('0x17')](_0x6518('0x1a'),_0x463f49[_0x6518('0x18')],_0x29302e);_0x5785ff(_0x486a0f[_0x6518('0x17')](0x1f4,_0x463f49['message']));});});};exports[_0x6518('0x23')]=function(_0x3b0553){return new Promise(function(_0x4f231e,_0x37d183){return db[_0x6518('0x1b')][_0x6518('0x24')]({'where':_0x3b0553[_0x6518('0x1e')]?_0x3b0553[_0x6518('0x1e')][_0x6518('0x20')]||null:null})[_0x6518('0x10')](function(_0x38eba9){if(_0x38eba9){return _0x38eba9[_0x6518('0x25')](_0x3b0553['body'][_0x6518('0x26')],_[_0x6518('0x27')](_0x3b0553[_0x6518('0x1d')],[_0x6518('0x26'),'id'])||{});}})['spread'](function(_0x314957){logger[_0x6518('0x11')](_0x6518('0x28'),_0x3b0553);logger[_0x6518('0x29')](_0x6518('0x28'),_0x3b0553,JSON[_0x6518('0x15')](_0x314957));_0x4f231e(_0x314957);})[_0x6518('0x19')](function(_0x5d3dc9){logger[_0x6518('0x17')](_0x6518('0x28'),_0x5d3dc9['message'],_0x3b0553);_0x37d183(_this[_0x6518('0x17')](0x1f4,_0x5d3dc9[_0x6518('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a32f917..2751c05 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 _0x5a79=['length','mailInteraction:','./mailInteraction.events','save','update','emit','removeListener','register'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x5a79,0x1e2));var _0x95a7=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x5a79[_0x8c8176];return _0x4dc47b;};'use strict';var MailInteractionEvents=require(_0x95a7('0x0'));var events=[_0x95a7('0x1'),'remove',_0x95a7('0x2')];function createListener(_0x5f22b9,_0x1b5bf3){return function(_0x15a952){_0x1b5bf3[_0x95a7('0x3')](_0x5f22b9,_0x15a952);};}function removeListener(_0x3d8e69,_0x48b0de){return function(){MailInteractionEvents[_0x95a7('0x4')](_0x3d8e69,_0x48b0de);};}exports[_0x95a7('0x5')]=function(_0x211864){for(var _0x2c6985=0x0,_0x4d3cbf=events[_0x95a7('0x6')];_0x2c6985<_0x4d3cbf;_0x2c6985++){var _0x456256=events[_0x2c6985];var _0xacc21b=createListener(_0x95a7('0x7')+_0x456256,_0x211864);MailInteractionEvents['on'](_0x456256,_0xacc21b);}}; \ No newline at end of file +var _0x3238=['emit','removeListener','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x985f24,_0x467140){var _0x75236e=function(_0x212320){while(--_0x212320){_0x985f24['push'](_0x985f24['shift']());}};_0x75236e(++_0x467140);}(_0x3238,0x81));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var MailInteractionEvents=require(_0x8323('0x0'));var events=[_0x8323('0x1'),'remove',_0x8323('0x2')];function createListener(_0x2b3766,_0x14f1c6){return function(_0x69ca19){_0x14f1c6[_0x8323('0x3')](_0x2b3766,_0x69ca19);};}function removeListener(_0x164551,_0x4d0416){return function(){MailInteractionEvents[_0x8323('0x4')](_0x164551,_0x4d0416);};}exports['register']=function(_0x425d73){for(var _0xc463d8=0x0,_0x690e38=events['length'];_0xc463d8<_0x690e38;_0xc463d8++){var _0x566d35=events[_0xc463d8];var _0x2f817b=createListener(_0x8323('0x5')+_0x566d35,_0x425d73);MailInteractionEvents['on'](_0x566d35,_0x2f817b);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 3e01151..0882158 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8921=['describe','exports','express','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated'];(function(_0xed7c77,_0x19544e){var _0x25e668=function(_0x41548f){while(--_0x41548f){_0xed7c77['push'](_0xed7c77['shift']());}};_0x25e668(++_0x19544e);}(_0x8921,0x9a));var _0x1892=function(_0x895558,_0x2978d9){_0x895558=_0x895558-0x0;var _0x8fd70d=_0x8921[_0x895558];return _0x8fd70d;};'use strict';var express=require(_0x1892('0x0'));var router=express['Router']();var auth=require(_0x1892('0x1'));var controller=require(_0x1892('0x2'));router[_0x1892('0x3')](_0x1892('0x4'),auth[_0x1892('0x5')](),controller[_0x1892('0x6')]);module[_0x1892('0x7')]=router; \ No newline at end of file +var _0xb145=['isAuthenticated','describe','exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe'];(function(_0xafff94,_0x4f2efc){var _0xe841dc=function(_0xc00050){while(--_0xc00050){_0xafff94['push'](_0xafff94['shift']());}};_0xe841dc(++_0x4f2efc);}(_0xb145,0xa3));var _0x5b14=function(_0x5a5f1f,_0x31326c){_0x5a5f1f=_0x5a5f1f-0x0;var _0x5ad1e3=_0xb145[_0x5a5f1f];return _0x5ad1e3;};'use strict';var express=require('express');var router=express[_0x5b14('0x0')]();var auth=require(_0x5b14('0x1'));var controller=require(_0x5b14('0x2'));router[_0x5b14('0x3')](_0x5b14('0x4'),auth[_0x5b14('0x5')](),controller[_0x5b14('0x6')]);module[_0x5b14('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index c6e3c7f..ba25f27 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x32445d,_0x552432){var _0x22241c=function(_0x36609a){while(--_0x36609a){_0x32445d['push'](_0x32445d['shift']());}};_0x22241c(++_0x552432);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x266027,_0x2c6226){var _0x5cedda=function(_0x4c1686){while(--_0x4c1686){_0x266027['push'](_0x266027['shift']());}};_0x5cedda(++_0x2c6226);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 996ebda..9f6ccff 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabc3=['exports','INTEGER'];(function(_0x5bbf1f,_0x3b1735){var _0x56557f=function(_0x1f35fd){while(--_0x1f35fd){_0x5bbf1f['push'](_0x5bbf1f['shift']());}};_0x56557f(++_0x3b1735);}(_0xabc3,0xfc));var _0x3abc=function(_0x1712f8,_0x45409f){_0x1712f8=_0x1712f8-0x0;var _0x56e19c=_0xabc3[_0x1712f8];return _0x56e19c;};'use strict';var Sequelize=require('sequelize');module[_0x3abc('0x0')]={'MailInteractionId':{'type':Sequelize[_0x3abc('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x3abc('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x99b7=['sequelize','exports','INTEGER'];(function(_0x52b2ad,_0x252541){var _0x5d0a09=function(_0x5f508b){while(--_0x5f508b){_0x52b2ad['push'](_0x52b2ad['shift']());}};_0x5d0a09(++_0x252541);}(_0x99b7,0x180));var _0x799b=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x99b7[_0xf73c09];return _0xa8923c;};'use strict';var Sequelize=require(_0x799b('0x0'));module[_0x799b('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x799b('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 805e7d5..cdd3c0f 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5bf=['define','./mailInteractionHasTag'];(function(_0x449a38,_0x3f8271){var _0x38a415=function(_0x261b53){while(--_0x261b53){_0x449a38['push'](_0x449a38['shift']());}};_0x38a415(++_0x3f8271);}(_0xd5bf,0x15d));var _0xfd5b=function(_0xe9d10a,_0x191e32){_0xe9d10a=_0xe9d10a-0x0;var _0x3e019a=_0xd5bf[_0xe9d10a];return _0x3e019a;};'use strict';var attributes=require(_0xfd5b('0x0'));module['exports']=function(_0x5ea36c){return _0x5ea36c[_0xfd5b('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x846f=['MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x48e954,_0x4546e8){var _0x124016=function(_0x61a956){while(--_0x61a956){_0x48e954['push'](_0x48e954['shift']());}};_0x124016(++_0x4546e8);}(_0x846f,0xc8));var _0xf846=function(_0x4c76c6,_0x235057){_0x4c76c6=_0x4c76c6-0x0;var _0x32e7f3=_0x846f[_0x4c76c6];return _0x32e7f3;};'use strict';var attributes=require(_0xf846('0x0'));module['exports']=function(_0x17b60d){return _0x17b60d['define'](_0xf846('0x1'),attributes,{'tableName':_0xf846('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 188de5c..42f377b 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 _0xaa1b=['/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','get','isAuthenticated','describe'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var path=require(_0xbaa1('0x2'));var timeout=require('connect-timeout');var express=require(_0xbaa1('0x3'));var router=express['Router']();var fs_extra=require(_0xbaa1('0x4'));var auth=require(_0xbaa1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbaa1('0x6')]('/',auth[_0xbaa1('0x7')](),controller['index']);router[_0xbaa1('0x6')]('/describe',auth[_0xbaa1('0x7')](),controller[_0xbaa1('0x8')]);router[_0xbaa1('0x6')](_0xbaa1('0x9'),auth[_0xbaa1('0x7')](),controller[_0xbaa1('0xa')]);router['get'](_0xbaa1('0xb'),auth[_0xbaa1('0x7')](),controller[_0xbaa1('0xc')]);router[_0xbaa1('0xd')]('/',auth[_0xbaa1('0x7')](),interaction[_0xbaa1('0xe')](_0xbaa1('0xf'),_0xbaa1('0x10')),controller[_0xbaa1('0x11')]);router[_0xbaa1('0x12')](_0xbaa1('0x9'),auth[_0xbaa1('0x7')](),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xbaa1('0x13')]);router[_0xbaa1('0x12')](_0xbaa1('0x14'),auth[_0xbaa1('0x7')](),controller[_0xbaa1('0x15')]);router[_0xbaa1('0x16')](_0xbaa1('0x9'),auth[_0xbaa1('0x7')](),controller[_0xbaa1('0x17')]);module[_0xbaa1('0x18')]=router; \ No newline at end of file +var _0x1d90=['path','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','isAuthenticated','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x5bc57b,_0x7698b4){var _0x56333f=function(_0x336303){while(--_0x336303){_0x5bc57b['push'](_0x5bc57b['shift']());}};_0x56333f(++_0x7698b4);}(_0x1d90,0x13e));var _0x01d9=function(_0x54fbcb,_0x21a10f){_0x54fbcb=_0x54fbcb-0x0;var _0x58e047=_0x1d90[_0x54fbcb];return _0x58e047;};'use strict';var multer=require(_0x01d9('0x0'));var util=require('util');var path=require(_0x01d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x01d9('0x2'));var router=express['Router']();var fs_extra=require(_0x01d9('0x3'));var auth=require(_0x01d9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x01d9('0x5'));var controller=require(_0x01d9('0x6'));router[_0x01d9('0x7')]('/',auth['isAuthenticated'](),controller[_0x01d9('0x8')]);router[_0x01d9('0x7')](_0x01d9('0x9'),auth['isAuthenticated'](),controller[_0x01d9('0xa')]);router['get']('/:id',auth[_0x01d9('0xb')](),controller[_0x01d9('0xc')]);router[_0x01d9('0x7')]('/:id/download',auth[_0x01d9('0xb')](),controller[_0x01d9('0xd')]);router[_0x01d9('0xe')]('/',auth['isAuthenticated'](),interaction[_0x01d9('0xf')](_0x01d9('0x10'),_0x01d9('0x11')),controller[_0x01d9('0x12')]);router[_0x01d9('0x13')](_0x01d9('0x14'),auth[_0x01d9('0xb')](),controller[_0x01d9('0x15')]);router[_0x01d9('0x13')](_0x01d9('0x16'),auth[_0x01d9('0xb')](),controller[_0x01d9('0x17')]);router['put'](_0x01d9('0x18'),auth[_0x01d9('0xb')](),controller[_0x01d9('0x19')]);router[_0x01d9('0x1a')]('/:id',auth[_0x01d9('0xb')](),controller[_0x01d9('0x1b')]);module[_0x01d9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ffa9971..b5e4979 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 _0x072e=['BOOLEAN','ENUM','STRING','long','DATE','INTEGER','Email','lodash','exports','TEXT','medium'];(function(_0x477a89,_0x1eced9){var _0x4363f9=function(_0x1cb699){while(--_0x1cb699){_0x477a89['push'](_0x477a89['shift']());}};_0x4363f9(++_0x1eced9);}(_0x072e,0x75));var _0xe072=function(_0x5ac2e3,_0x1425aa){_0x5ac2e3=_0x5ac2e3-0x0;var _0x3890b1=_0x072e[_0x5ac2e3];return _0x3890b1;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe072('0x0'));module[_0xe072('0x1')]={'body':{'type':Sequelize[_0xe072('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe072('0x2')](_0xe072('0x3'))},'read':{'type':Sequelize[_0xe072('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe072('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe072('0x6')](0x1fe)},'from':{'type':Sequelize[_0xe072('0x6')]},'to':{'type':Sequelize[_0xe072('0x2')](_0xe072('0x7'))},'cc':{'type':Sequelize['TEXT'](_0xe072('0x7'))},'bcc':{'type':Sequelize[_0xe072('0x2')](_0xe072('0x7'))},'subject':{'type':Sequelize[_0xe072('0x2')]},'sentAt':{'type':Sequelize[_0xe072('0x8')]},'attach':{'type':Sequelize[_0xe072('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe072('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe072('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xe072('0x7'))},'originCc':{'type':Sequelize[_0xe072('0x2')](_0xe072('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xe072('0xa'),'Chat'),'defaultValue':_0xe072('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x32e0=['Chat','sequelize','exports','TEXT','long','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email'];(function(_0x27bfed,_0x270908){var _0x4add5a=function(_0x452fb3){while(--_0x452fb3){_0x27bfed['push'](_0x27bfed['shift']());}};_0x4add5a(++_0x270908);}(_0x32e0,0x15d));var _0x032e=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x32e0[_0x2459fd];return _0x364cd2;};'use strict';var Sequelize=require(_0x032e('0x0'));var _=require('lodash');module[_0x032e('0x1')]={'body':{'type':Sequelize[_0x032e('0x2')](_0x032e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x032e('0x4')]('in',_0x032e('0x5')),'defaultValue':_0x032e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x032e('0x6')](0x1fe)},'from':{'type':Sequelize[_0x032e('0x6')]},'to':{'type':Sequelize[_0x032e('0x2')](_0x032e('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x032e('0x2')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x032e('0x7')]},'attach':{'type':Sequelize[_0x032e('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x032e('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x032e('0x2')](_0x032e('0x3'))},'originCc':{'type':Sequelize[_0x032e('0x2')]('long')},'originChannel':{'type':Sequelize[_0x032e('0x4')](_0x032e('0xa'),_0x032e('0xb')),'defaultValue':_0x032e('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b00e5a7..244ca7f 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 _0x320c=['rejectmessage','download','unix','toString','server','files','tmp','from','bcc','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp','getSmtpOptions','attachments','join','server/files/attachments','basename','List','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','user','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','agent','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','internal','motionChannel'];(function(_0x5021d2,_0x318b87){var _0x2cd288=function(_0x217164){while(--_0x217164){_0x5021d2['push'](_0x5021d2['shift']());}};_0x2cd288(++_0x318b87);}(_0x320c,0xb5));var _0xc320=function(_0x2c745d,_0x57ff22){_0x2c745d=_0x2c745d-0x0;var _0x2b2c28=_0x320c[_0x2c745d];return _0x2b2c28;};'use strict';var emlformat=require(_0xc320('0x0'));var moment=require(_0xc320('0x1'));var BPromise=require('bluebird');var util=require(_0xc320('0x2'));var path=require(_0xc320('0x3'));var fs=require('fs');var _=require(_0xc320('0x4'));var Redis=require(_0xc320('0x5'));var htmlToText=require(_0xc320('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xc320('0x7'))(_0xc320('0x8'));var interaction_log=require('../../config/logger')(_0xc320('0x9'));var config=require('../../config/environment');var db=require(_0xc320('0xa'))['db'];config[_0xc320('0xb')]=_[_0xc320('0xc')](config[_0xc320('0xb')],{'host':_0xc320('0xd'),'port':0x18eb});var socket=require(_0xc320('0xe'))(new Redis(config[_0xc320('0xb')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xc320('0xf')](socket);var jayson=require(_0xc320('0x10'));var client=jayson[_0xc320('0x11')][_0xc320('0x12')]({'port':0x232c});var client9003=jayson[_0xc320('0x11')][_0xc320('0x12')]({'port':0x232b});var client9002=jayson[_0xc320('0x11')][_0xc320('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x11e717,_0x13698d,_0x9ff5b9,_0x806685){return new BPromise(function(_0x119dcf,_0x327f05){var _0x5f1583=_0x806685||client;return _0x5f1583[_0xc320('0x13')](_0x11e717,_0x9ff5b9)[_0xc320('0x14')](function(_0x1c2a9c){logger[_0xc320('0x15')](_0xc320('0x16'),_0x13698d,_0xc320('0x17'));logger[_0xc320('0x18')](_0xc320('0x19'),_0x13698d,_0xc320('0x17'),JSON[_0xc320('0x1a')](_0x1c2a9c));if(_0x1c2a9c['error']){if(_0x1c2a9c[_0xc320('0x1b')][_0xc320('0x1c')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x13698d,_0x1c2a9c[_0xc320('0x1b')][_0xc320('0x1d')]);return _0x327f05(_0x1c2a9c[_0xc320('0x1b')][_0xc320('0x1d')]);}logger[_0xc320('0x1b')](_0xc320('0x16'),_0x13698d,_0x1c2a9c[_0xc320('0x1b')]['message']);return _0x119dcf(_0x1c2a9c['error'][_0xc320('0x1d')]);}else{logger[_0xc320('0x15')](_0xc320('0x16'),_0x13698d,_0xc320('0x17'));_0x119dcf(_0x1c2a9c[_0xc320('0x1e')][_0xc320('0x1d')]);}})[_0xc320('0x1f')](function(_0x4e6737){logger[_0xc320('0x1b')](_0xc320('0x16'),_0x13698d,_0x4e6737);_0x327f05(_0x4e6737);});});}function respondWithResult(_0x35da27,_0x5d24b5){_0x5d24b5=_0x5d24b5||0xc8;return function(_0x3dcf47){if(_0x3dcf47){return _0x35da27[_0xc320('0x20')](_0x5d24b5)[_0xc320('0x21')](_0x3dcf47);}};}function respondWithFilteredResult(_0x2a6e87,_0x564989){return function(_0x536f40){if(_0x536f40){var _0x417978=typeof _0x564989[_0xc320('0x22')]===_0xc320('0x23')&&typeof _0x564989[_0xc320('0x24')]===_0xc320('0x23');var _0x70b5b2=_0x536f40[_0xc320('0x25')];var _0x3d605e=_0x417978?0x0:_0x564989['offset'];var _0xf1a1bb=_0x417978?_0x536f40[_0xc320('0x25')]:_0x564989[_0xc320('0x22')]+_0x564989[_0xc320('0x24')];var _0x36065a;if(_0xf1a1bb>=_0x70b5b2){_0xf1a1bb=_0x70b5b2;_0x36065a=0xc8;}else{_0x36065a=0xce;}_0x2a6e87[_0xc320('0x20')](_0x36065a);return _0x2a6e87[_0xc320('0x26')](_0xc320('0x27'),_0x3d605e+'-'+_0xf1a1bb+'/'+_0x70b5b2)['json'](_0x536f40);}return null;};}function saveUpdates(_0x24af1c){return function(_0x51fce4){if(_0x51fce4){return _0x51fce4[_0xc320('0x28')](_0x24af1c)[_0xc320('0x14')](function(_0x825362){return _0x825362;});}return null;};}function removeEntity(_0x4d55af){return function(_0x48782d){if(_0x48782d){return _0x48782d[_0xc320('0x29')]()[_0xc320('0x14')](function(){_0x4d55af[_0xc320('0x20')](0xcc)[_0xc320('0x2a')]();});}};}function handleEntityNotFound(_0x3744cf){return function(_0x58116f){if(!_0x58116f){_0x3744cf['sendStatus'](0x194);}return _0x58116f;};}function handleError(_0x2a7124,_0x313506){_0x313506=_0x313506||0x1f4;return function(_0x32aa99){logger[_0xc320('0x1b')](_0x32aa99[_0xc320('0x2b')]);if(_0x32aa99[_0xc320('0x2c')]){delete _0x32aa99[_0xc320('0x2c')];}_0x2a7124[_0xc320('0x20')](_0x313506)[_0xc320('0x2d')](_0x32aa99);};}exports[_0xc320('0x2e')]=function(_0x56b3a7,_0x4e67dd){var _0x34cde2={},_0x1f0a8b={},_0x4c7bba={'count':0x0,'rows':[]};var _0x21365b=_['map'](db[_0xc320('0x2f')][_0xc320('0x30')],function(_0x33bcb2){return{'name':_0x33bcb2[_0xc320('0x31')],'type':_0x33bcb2['type']['key']};});_0x1f0a8b[_0xc320('0x32')]=_['map'](_0x21365b,_0xc320('0x2c'));_0x1f0a8b[_0xc320('0x33')]=_[_0xc320('0x34')](_0x56b3a7[_0xc320('0x33')]);_0x1f0a8b[_0xc320('0x35')]=_[_0xc320('0x36')](_0x1f0a8b[_0xc320('0x32')],_0x1f0a8b[_0xc320('0x33')]);_0x34cde2[_0xc320('0x37')]=_['intersection'](_0x1f0a8b[_0xc320('0x32')],qs[_0xc320('0x38')](_0x56b3a7[_0xc320('0x33')][_0xc320('0x38')]));_0x34cde2['attributes']=_0x34cde2['attributes'][_0xc320('0x39')]?_0x34cde2[_0xc320('0x37')]:_0x1f0a8b['model'];if(!_0x56b3a7[_0xc320('0x33')]['hasOwnProperty'](_0xc320('0x3a'))){_0x34cde2[_0xc320('0x24')]=qs[_0xc320('0x24')](_0x56b3a7[_0xc320('0x33')]['limit']);_0x34cde2[_0xc320('0x22')]=qs[_0xc320('0x22')](_0x56b3a7[_0xc320('0x33')]['offset']);}_0x34cde2[_0xc320('0x3b')]=qs[_0xc320('0x3c')](_0x56b3a7['query'][_0xc320('0x3c')]);_0x34cde2[_0xc320('0x3d')]=qs[_0xc320('0x35')](_[_0xc320('0x3e')](_0x56b3a7['query'],_0x1f0a8b[_0xc320('0x35')]),_0x21365b);if(_0x56b3a7[_0xc320('0x33')][_0xc320('0x3f')]){_0x34cde2['where']=_['merge'](_0x34cde2[_0xc320('0x3d')],{'$or':_['map'](_0x21365b,function(_0x4f90a0){if(_0x4f90a0[_0xc320('0x40')]!==_0xc320('0x41')){var _0x38f55a={};_0x38f55a[_0x4f90a0[_0xc320('0x2c')]]={'$like':'%'+_0x56b3a7['query'][_0xc320('0x3f')]+'%'};return _0x38f55a;}})});}_0x34cde2=_[_0xc320('0x42')]({},_0x34cde2,_0x56b3a7[_0xc320('0x43')]);var _0x2f3f12={'where':_0x34cde2[_0xc320('0x3d')]};return db[_0xc320('0x2f')][_0xc320('0x25')](_0x2f3f12)[_0xc320('0x14')](function(_0x2c5305){_0x4c7bba[_0xc320('0x25')]=_0x2c5305;if(_0x56b3a7['query']['includeAll']){_0x34cde2[_0xc320('0x44')]=[{'all':!![]}];}return db[_0xc320('0x2f')][_0xc320('0x45')](_0x34cde2);})[_0xc320('0x14')](function(_0x3b31dd){_0x4c7bba[_0xc320('0x46')]=_0x3b31dd;return _0x4c7bba;})[_0xc320('0x14')](respondWithFilteredResult(_0x4e67dd,_0x34cde2))['catch'](handleError(_0x4e67dd,null));};exports[_0xc320('0x47')]=function(_0x13146a,_0x56763d){var _0x5ab27f={'raw':!![],'where':{'id':_0x13146a[_0xc320('0x48')]['id']}},_0x5bcf02={};_0x5bcf02[_0xc320('0x32')]=_[_0xc320('0x34')](db[_0xc320('0x2f')][_0xc320('0x30')]);_0x5bcf02[_0xc320('0x33')]=_[_0xc320('0x34')](_0x13146a[_0xc320('0x33')]);_0x5bcf02[_0xc320('0x35')]=_['intersection'](_0x5bcf02[_0xc320('0x32')],_0x5bcf02['query']);_0x5ab27f[_0xc320('0x37')]=_[_0xc320('0x36')](_0x5bcf02['model'],qs[_0xc320('0x38')](_0x13146a[_0xc320('0x33')][_0xc320('0x38')]));_0x5ab27f[_0xc320('0x37')]=_0x5ab27f[_0xc320('0x37')]['length']?_0x5ab27f['attributes']:_0x5bcf02[_0xc320('0x32')];if(_0x13146a['query'][_0xc320('0x49')]){_0x5ab27f[_0xc320('0x44')]=[{'all':!![]}];}_0x5ab27f=_[_0xc320('0x42')]({},_0x5ab27f,_0x13146a['options']);return db[_0xc320('0x2f')][_0xc320('0x4a')](_0x5ab27f)[_0xc320('0x14')](handleEntityNotFound(_0x56763d,null))['then'](respondWithResult(_0x56763d,null))[_0xc320('0x1f')](handleError(_0x56763d,null));};exports[_0xc320('0x28')]=function(_0x4c447e,_0x4391b3){if(_0x4c447e['body']['id']){delete _0x4c447e['body']['id'];}return db['MailMessage'][_0xc320('0x4a')]({'where':{'id':_0x4c447e[_0xc320('0x48')]['id']}})[_0xc320('0x14')](handleEntityNotFound(_0x4391b3,null))['then'](saveUpdates(_0x4c447e[_0xc320('0x4b')],null))['then'](respondWithResult(_0x4391b3,null))['catch'](handleError(_0x4391b3,null));};exports['destroy']=function(_0x3f56e9,_0x464790){return db[_0xc320('0x2f')]['find']({'where':{'id':_0x3f56e9[_0xc320('0x48')]['id']}})[_0xc320('0x14')](handleEntityNotFound(_0x464790,null))['then'](removeEntity(_0x464790,null))[_0xc320('0x1f')](handleError(_0x464790,null));};exports[_0xc320('0x4c')]=function(_0x4b71cb,_0x4737d9){return db[_0xc320('0x2f')][_0xc320('0x4c')]()['then'](respondWithResult(_0x4737d9,null))[_0xc320('0x1f')](handleError(_0x4737d9,null));};exports['create']=function(_0x146a83,_0x1cdd7f){return db['MailMessage'][_0xc320('0x4d')](_0x146a83[_0xc320('0x4b')])[_0xc320('0x14')](function(_0x225ee3){if(_0x225ee3){if(_0x225ee3[_0xc320('0x4e')]===_0xc320('0x4f')&&!_0x225ee3[_0xc320('0x50')]){var _0x1ebd6e,_0x336ca7,_0x130db6;if(_0x146a83['body']['to']){_0x336ca7=_0x146a83[_0xc320('0x4b')]['to']['split'](',')[0x0];}return db[_0xc320('0x51')][_0xc320('0x52')]({'where':{'id':_0x225ee3[_0xc320('0x53')]},'include':[{'model':db[_0xc320('0x54')],'as':'List','include':[{'model':db[_0xc320('0x55')],'as':_0xc320('0x56'),'where':{'email':_0x336ca7},'limit':0x1,'order':[[_0xc320('0x57'),_0xc320('0x58')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc320('0x59')],'as':_0xc320('0x59'),'raw':!![]}]}]})[_0xc320('0x14')](function(_0x2bc242){_0x1ebd6e=_0x2bc242;if(!_0x1ebd6e||!_0x1ebd6e[_0xc320('0x5a')])return;var _0x184d3b=_0x1ebd6e[_0xc320('0x5b')]();if(_0x146a83[_0xc320('0x4b')]['attachments']&&_0x146a83[_0xc320('0x4b')][_0xc320('0x5c')][_0xc320('0x39')]){for(var _0x4030ec=0x0;_0x4030ec<_0x146a83[_0xc320('0x4b')][_0xc320('0x5c')][_0xc320('0x39')];_0x4030ec+=0x1){_0x146a83[_0xc320('0x4b')][_0xc320('0x5c')][_0x4030ec]={'filename':_0x146a83[_0xc320('0x4b')]['attachments'][_0x4030ec][_0xc320('0x2c')],'path':path[_0xc320('0x5d')](config['root'],_0xc320('0x5e'),_0x146a83[_0xc320('0x4b')]['attachments'][_0x4030ec][_0xc320('0x5f')])};}}_0x130db6={'account':_0x184d3b,'message':_0x146a83[_0xc320('0x4b')]};return;})['then'](function(){if(_0x1ebd6e[_0xc320('0x60')]){if(_0x1ebd6e['List'][_0xc320('0x56')][_0xc320('0x39')]){return _0x1ebd6e['List']['Contacts'][0x0];}else{return db['CmContact'][_0xc320('0x4d')](_[_0xc320('0xc')](_0x146a83[_0xc320('0x4b')],{'firstName':_0x146a83[_0xc320('0x4b')]['to'],'email':_0x146a83[_0xc320('0x4b')]['to'],'phone':_0x146a83[_0xc320('0x4b')]['to'],'ListId':_0x1ebd6e[_0xc320('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc320('0x14')](function(){if(_0x130db6){return respondWithRpcPromise(_0xc320('0x62'),_0xc320('0x63'),_0x130db6,client9003)[_0xc320('0x14')](function(_0x3df2cb){return _0x225ee3[_0xc320('0x28')]({'read':!![],'messageId':_0x3df2cb[_0xc320('0x64')],'sentAt':moment()[_0xc320('0x65')](_0xc320('0x66'))});})[_0xc320('0x1f')](function(_0x181609){logger[_0xc320('0x1b')]('%s',JSON['stringify'](_0x181609));return _0x225ee3;});}return _0x225ee3;});}return _0x225ee3;}})[_0xc320('0x14')](respondWithResult(_0x1cdd7f,0xc9))[_0xc320('0x1f')](handleError(_0x1cdd7f,null));};exports[_0xc320('0x67')]=function(_0x5982eb,_0x2aa58c){var _0xc55603={'agent':{},'channel':_0xc320('0x68')};if(_0x5982eb['body']['id']){delete _0x5982eb['body']['id'];}_0x5982eb[_0xc320('0x4b')][_0xc320('0x69')]=!![];_0x5982eb[_0xc320('0x4b')][_0xc320('0x6a')]=moment()[_0xc320('0x65')](_0xc320('0x66'));_0x5982eb['body'][_0xc320('0x6b')]=_0x5982eb[_0xc320('0x4b')][_0xc320('0x6b')]||_0x5982eb['user']['id'];_0xc55603['agent']['id']=_0x5982eb[_0xc320('0x4b')]['UserId'];return db[_0xc320('0x2f')][_0xc320('0x4a')]({'where':{'id':_0x5982eb[_0xc320('0x48')]['id'],'UserId':null}})[_0xc320('0x14')](handleEntityNotFound(_0x2aa58c,null))[_0xc320('0x14')](saveUpdates(_0x5982eb['body'],null))[_0xc320('0x14')](function(_0x7078a8){if(_0x7078a8){_0xc55603[_0xc320('0x1d')]=_0x7078a8[_0xc320('0x6c')]({'plain':!![]});return db[_0xc320('0x6d')][_0xc320('0x4a')]({'where':{'id':_0x7078a8[_0xc320('0x6e')]}});}return null;})[_0xc320('0x14')](handleEntityNotFound(_0x2aa58c,null))['then'](function(_0xc95b04){if(_0xc95b04){return _0xc95b04[_0xc320('0x28')]({'UserId':_0x5982eb[_0xc320('0x4b')][_0xc320('0x6b')],'read1stAt':_[_0xc320('0x6f')](_0xc95b04[_0xc320('0x70')])?moment()[_0xc320('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc320('0x14')](function(_0x5c618b){if(_0x5c618b){_0xc55603['interaction']=_0x5c618b[_0xc320('0x6c')]({'plain':!![]});interaction_log[_0xc320('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5982eb[_0xc320('0x71')]['id'],_0x5982eb['user'][_0xc320('0x2c')],_0x5982eb[_0xc320('0x71')][_0xc320('0x72')],_0xc55603[_0xc320('0x73')]['id'],_0x5982eb[_0xc320('0x4b')]?JSON[_0xc320('0x1a')](_0x5982eb['body']):_0xc320('0x74'));return respondWithRpcPromise('AcceptMessage',_0xc320('0x75'),_0xc55603);}return null;})[_0xc320('0x14')](function(_0x4e0509){var _0x115c50='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e0509[_0xc320('0x1d')][_0xc320('0x76')];return db[_0xc320('0x77')]['query'](_0x115c50,{'type':db[_0xc320('0x78')][_0xc320('0x79')][_0xc320('0x7a')],'raw':!![]})[_0xc320('0x14')](function(_0x255ebf){return _0x255ebf;});})[_0xc320('0x14')](function(_0x4f0f46){if(_0x4f0f46){_0xc55603[_0xc320('0x1d')]['contact']=_0x4f0f46[0x0];if(!_0x5982eb[_0xc320('0x4b')][_0xc320('0x6b')])return;return db[_0xc320('0x7b')][_0xc320('0x4a')]({'where':{'id':_0x5982eb[_0xc320('0x4b')][_0xc320('0x6b')],'role':'agent'},'attributes':['id',_0xc320('0x2c'),'fullname',_0xc320('0x7c'),'internal'],'raw':!![]});}return null;})[_0xc320('0x14')](function(_0x1b7826){if(!_0x1b7826)return null;_0xc55603[_0xc320('0x1d')][_0xc320('0x7d')]=_0x1b7826;return _0xc55603;})[_0xc320('0x14')](function(_0x351a6e){if(_0x351a6e){if(_0x5982eb[_0xc320('0x4b')][_0xc320('0x7e')]){_0xc55603[_0xc320('0x1d')][_0xc320('0x7f')]=util[_0xc320('0x65')](_0xc320('0x80'),_0x5982eb['user'][_0xc320('0x2c')]);_0xc55603['message'][_0xc320('0x81')]=_0xc55603['channel'];_0xc55603[_0xc320('0x1d')]['motionChannel']=_0xc55603['channel'];_0xc55603[_0xc320('0x1d')][_0xc320('0x82')]='accept';_0xc55603[_0xc320('0x1d')]['body']=htmlToText[_0xc320('0x83')](_0xc55603[_0xc320('0x1d')][_0xc320('0x4b')]);return respondWithRpcPromise('EventManager',_0xc320('0x84'),{'event':_0xc320('0x85'),'message':_0xc55603[_0xc320('0x1d')]},client9002)['then'](function(){return _0xc55603;});}return _0xc55603;}return null;})['then'](respondWithResult(_0x2aa58c,null))[_0xc320('0x1f')](handleError(_0x2aa58c,null));};exports[_0xc320('0x86')]=function(_0x55d7d4,_0x3056f8){var _0x13a5f3={'agent':{},'channel':_0xc320('0x68')};if(_0x55d7d4[_0xc320('0x4b')]['id']){delete _0x55d7d4['body']['id'];}_0x55d7d4[_0xc320('0x4b')][_0xc320('0x6b')]=_0x55d7d4[_0xc320('0x4b')][_0xc320('0x6b')]||_0x55d7d4[_0xc320('0x71')]['id'];_0x13a5f3[_0xc320('0x7d')]['id']=_0x55d7d4[_0xc320('0x4b')]['UserId'];return db[_0xc320('0x2f')][_0xc320('0x4a')]({'where':{'id':_0x55d7d4[_0xc320('0x48')]['id'],'UserId':null}})[_0xc320('0x14')](handleEntityNotFound(_0x3056f8,null))[_0xc320('0x14')](function(_0xc716b8){if(_0xc716b8){_0x13a5f3[_0xc320('0x1d')]=_0xc716b8['get']({'plain':!![]});return db[_0xc320('0x6d')][_0xc320('0x4a')]({'where':{'id':_0xc716b8['MailInteractionId']}});}return null;})[_0xc320('0x14')](handleEntityNotFound(_0x3056f8,null))[_0xc320('0x14')](function(_0x33aff4){if(_0x33aff4){_0x13a5f3[_0xc320('0x73')]=_0x33aff4[_0xc320('0x6c')]({'plain':!![]});interaction_log[_0xc320('0x15')](_0xc320('0x87'),_0x55d7d4[_0xc320('0x71')]['id'],_0x55d7d4[_0xc320('0x71')][_0xc320('0x2c')],_0x55d7d4[_0xc320('0x71')][_0xc320('0x72')],_0x13a5f3['interaction']['id'],_0x55d7d4[_0xc320('0x4b')]?JSON['stringify'](_0x55d7d4['body']):_0xc320('0x74'));return respondWithRpcPromise('RejectMessage',_0xc320('0x88'),_0x13a5f3);}return null;})[_0xc320('0x14')](function(_0x5448e5){var _0x1a8b83=_0xc320('0x89')+_0x5448e5[_0xc320('0x1d')]['ContactId'];return db['sequelize'][_0xc320('0x33')](_0x1a8b83,{'type':db[_0xc320('0x78')][_0xc320('0x79')][_0xc320('0x7a')],'raw':!![]})[_0xc320('0x14')](function(_0x37df2c){return _0x37df2c;});})[_0xc320('0x14')](function(_0x34408a){if(_0x34408a){_0x13a5f3[_0xc320('0x1d')]['contact']=_0x34408a[0x0];if(!_0x55d7d4[_0xc320('0x4b')][_0xc320('0x6b')])return;return db[_0xc320('0x7b')][_0xc320('0x4a')]({'where':{'id':_0x55d7d4[_0xc320('0x4b')][_0xc320('0x6b')],'role':'agent'},'attributes':['id',_0xc320('0x2c'),_0xc320('0x8a'),_0xc320('0x7c'),_0xc320('0x8b')],'raw':!![]});}return null;})[_0xc320('0x14')](function(_0x5890b7){if(!_0x5890b7)return null;_0x13a5f3[_0xc320('0x1d')][_0xc320('0x7d')]=_0x5890b7;return _0x13a5f3;})[_0xc320('0x14')](function(_0x927040){if(_0x927040){_0x927040[_0xc320('0x1d')]['interface']=util[_0xc320('0x65')](_0xc320('0x80'),_0x55d7d4[_0xc320('0x71')][_0xc320('0x2c')]);_0x927040[_0xc320('0x1d')][_0xc320('0x81')]=_0x13a5f3[_0xc320('0x81')];_0x927040[_0xc320('0x1d')][_0xc320('0x8c')]=_0x13a5f3[_0xc320('0x81')];_0x927040['message'][_0xc320('0x82')]=_0xc320('0x86');_0x927040[_0xc320('0x1d')]['body']=htmlToText[_0xc320('0x83')](_0x13a5f3['message'][_0xc320('0x4b')]);respondWithRpcPromise('EventManager',_0xc320('0x84'),{'event':_0xc320('0x8d'),'message':_0x927040['message']},client9002);return _0x13a5f3;}return null;})[_0xc320('0x14')](respondWithResult(_0x3056f8,null))[_0xc320('0x1f')](handleError(_0x3056f8,null));};exports[_0xc320('0x8e')]=function(_0x5a3067,_0x5d930d){var _0x5990bc=moment()[_0xc320('0x8f')]()[_0xc320('0x90')]();var _0x3793e1=path[_0xc320('0x5d')](config['root'],_0xc320('0x91'),_0xc320('0x92'),_0xc320('0x93'));var _0xf0b52a=path[_0xc320('0x5d')](config['root'],_0xc320('0x91'),_0xc320('0x92'),_0xc320('0x5c'));var _0x22c72c=util[_0xc320('0x65')]('message-%s.eml',_0x5990bc);return db[_0xc320('0x2f')][_0xc320('0x4a')]({'where':{'id':_0x5a3067[_0xc320('0x48')]['id']},'attributes':['id','body',_0xc320('0x94'),'to','cc',_0xc320('0x95'),'subject',_0xc320('0x96')],'include':_0x5a3067['query'][_0xc320('0x5c')]?[{'model':db[_0xc320('0x97')],'as':'Attachments'}]:undefined})[_0xc320('0x14')](handleEntityNotFound(_0x5d930d,null))[_0xc320('0x14')](function(_0x3f592d){if(_0x3f592d){var _0x587cb7=_0x3f592d;var _0x2e3f7f={'from':_0x587cb7[_0xc320('0x94')],'to':_0x587cb7['to'],'subject':_0x587cb7['subject'],'html':htmlEntities[_0xc320('0x98')](_0x587cb7[_0xc320('0x4b')]),'headers':{'Date':moment(_0x587cb7[_0xc320('0x96')])[_0xc320('0x65')](_0xc320('0x99'))},'attachments':[]};if(_0x3f592d['cc']){_0x2e3f7f[_0xc320('0x9a')]['Cc']=_0x3f592d['cc'];}if(_0x3f592d[_0xc320('0x95')]){_0x2e3f7f['headers'][_0xc320('0x9b')]=_0x3f592d['bcc'];}return new BPromise(function(_0x50bc3c,_0xf4e829){if(_0x3f592d[_0xc320('0x9c')]){for(var _0x5a4693=0x0;_0x5a4693<_0x3f592d[_0xc320('0x9c')]['length'];_0x5a4693++){var _0x26aeec=_0x3f592d[_0xc320('0x9c')][_0x5a4693];var _0x5bf614=path['join'](_0xf0b52a,_0x26aeec[_0xc320('0x5f')]);if(fs[_0xc320('0x9d')](_0x5bf614)){_0x2e3f7f[_0xc320('0x5c')]['push']({'name':_0x26aeec[_0xc320('0x2c')],'contentType':_0x26aeec['type'],'data':fs[_0xc320('0x9e')](_0x5bf614)});}}}emlformat[_0xc320('0x9f')](_0x2e3f7f,function(_0x9f9141,_0x4c44f9){if(_0x9f9141)return _0xf4e829(_0x9f9141);fs[_0xc320('0xa0')](path['join'](_0x3793e1,_0x22c72c),_0x4c44f9);return _0x50bc3c(_0x4c44f9);});});}})[_0xc320('0x14')](function(_0x2d250d){if(_0x2d250d){return _0x5d930d['download'](path[_0xc320('0x5d')](_0x3793e1,_0x22c72c),_0x22c72c,function(_0x3a8a3c){if(!_0x3a8a3c)fs['unlinkSync'](path[_0xc320('0x5d')](_0x3793e1,_0x22c72c));});}})['catch'](handleError(_0x5d930d,null));}; \ No newline at end of file +var _0x715d=['then','includeAll','rows','show','params','intersection','include','update','body','find','describe','create','out','secret','MailAccount','findOne','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','Content-Range','json','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x2bae8b,_0x58af3f){var _0x1db3bc=function(_0x4c1c5f){while(--_0x4c1c5f){_0x2bae8b['push'](_0x2bae8b['shift']());}};_0x1db3bc(++_0x58af3f);}(_0x715d,0xff));var _0xd715=function(_0xedf2de,_0xdc5858){_0xedf2de=_0xedf2de-0x0;var _0x5674a5=_0x715d[_0xedf2de];return _0x5674a5;};'use strict';var emlformat=require(_0xd715('0x0'));var moment=require(_0xd715('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xd715('0x2'));var fs=require('fs');var _=require(_0xd715('0x3'));var Redis=require(_0xd715('0x4'));var htmlToText=require(_0xd715('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd715('0x6'));var interaction_log=require(_0xd715('0x7'))(_0xd715('0x8'));var config=require(_0xd715('0x9'));var db=require(_0xd715('0xa'))['db'];config['redis']=_[_0xd715('0xb')](config[_0xd715('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd715('0xd'))(new Redis(config[_0xd715('0xc')]));var htmlEntities=require(_0xd715('0xe'));require(_0xd715('0xf'))['register'](socket);var jayson=require(_0xd715('0x10'));var client=jayson[_0xd715('0x11')][_0xd715('0x12')]({'port':0x232c});var client9003=jayson[_0xd715('0x11')][_0xd715('0x12')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3387b8,_0x532544,_0x5df406,_0x397ab7){return new BPromise(function(_0x4caee2,_0x46a934){var _0x2e5c02=_0x397ab7||client;return _0x2e5c02['request'](_0x3387b8,_0x5df406)['then'](function(_0x214868){logger[_0xd715('0x13')](_0xd715('0x14'),_0x532544,_0xd715('0x15'));logger['debug'](_0xd715('0x16'),_0x532544,_0xd715('0x15'),JSON['stringify'](_0x214868));if(_0x214868[_0xd715('0x17')]){if(_0x214868[_0xd715('0x17')][_0xd715('0x18')]===0x1f4){logger['error'](_0xd715('0x14'),_0x532544,_0x214868['error'][_0xd715('0x19')]);return _0x46a934(_0x214868[_0xd715('0x17')][_0xd715('0x19')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x532544,_0x214868[_0xd715('0x17')][_0xd715('0x19')]);return _0x4caee2(_0x214868[_0xd715('0x17')][_0xd715('0x19')]);}else{logger[_0xd715('0x13')]('MailMessage,\x20%s,\x20%s',_0x532544,_0xd715('0x15'));_0x4caee2(_0x214868[_0xd715('0x1a')][_0xd715('0x19')]);}})[_0xd715('0x1b')](function(_0x13d123){logger[_0xd715('0x17')](_0xd715('0x14'),_0x532544,_0x13d123);_0x46a934(_0x13d123);});});}function respondWithResult(_0x5787d4,_0x28fbef){_0x28fbef=_0x28fbef||0xc8;return function(_0x56030c){if(_0x56030c){return _0x5787d4[_0xd715('0x1c')](_0x28fbef)['json'](_0x56030c);}};}function respondWithFilteredResult(_0x226e46,_0x5750c5){return function(_0x278503){if(_0x278503){var _0x241073=typeof _0x5750c5[_0xd715('0x1d')]===_0xd715('0x1e')&&typeof _0x5750c5[_0xd715('0x1f')]===_0xd715('0x1e');var _0x3160ef=_0x278503[_0xd715('0x20')];var _0x36c2e0=_0x241073?0x0:_0x5750c5[_0xd715('0x1d')];var _0x1b15bb=_0x241073?_0x278503[_0xd715('0x20')]:_0x5750c5[_0xd715('0x1d')]+_0x5750c5[_0xd715('0x1f')];var _0x3c5dea;if(_0x1b15bb>=_0x3160ef){_0x1b15bb=_0x3160ef;_0x3c5dea=0xc8;}else{_0x3c5dea=0xce;}_0x226e46['status'](_0x3c5dea);return _0x226e46['set'](_0xd715('0x21'),_0x36c2e0+'-'+_0x1b15bb+'/'+_0x3160ef)[_0xd715('0x22')](_0x278503);}return null;};}function saveUpdates(_0x26d8e2){return function(_0x1b4c86){if(_0x1b4c86){return _0x1b4c86['update'](_0x26d8e2)['then'](function(_0x1f1d1c){return _0x1f1d1c;});}return null;};}function removeEntity(_0x338a47){return function(_0x1ef810){if(_0x1ef810){return _0x1ef810[_0xd715('0x23')]()['then'](function(){_0x338a47[_0xd715('0x1c')](0xcc)[_0xd715('0x24')]();});}};}function handleEntityNotFound(_0x4d2b5f){return function(_0x384d33){if(!_0x384d33){_0x4d2b5f[_0xd715('0x25')](0x194);}return _0x384d33;};}function handleError(_0x146585,_0x566265){_0x566265=_0x566265||0x1f4;return function(_0x79f6cc){logger[_0xd715('0x17')](_0x79f6cc[_0xd715('0x26')]);if(_0x79f6cc[_0xd715('0x27')]){delete _0x79f6cc[_0xd715('0x27')];}_0x146585[_0xd715('0x1c')](_0x566265)[_0xd715('0x28')](_0x79f6cc);};}exports['index']=function(_0x6fcf96,_0x59618e){var _0x5a00c5={},_0xcbfde6={},_0x2e0d07={'count':0x0,'rows':[]};var _0x48727a=_[_0xd715('0x29')](db[_0xd715('0x2a')][_0xd715('0x2b')],function(_0x1498d3){return{'name':_0x1498d3[_0xd715('0x2c')],'type':_0x1498d3[_0xd715('0x2d')][_0xd715('0x2e')]};});_0xcbfde6[_0xd715('0x2f')]=_[_0xd715('0x29')](_0x48727a,_0xd715('0x27'));_0xcbfde6['query']=_[_0xd715('0x30')](_0x6fcf96[_0xd715('0x31')]);_0xcbfde6[_0xd715('0x32')]=_['intersection'](_0xcbfde6[_0xd715('0x2f')],_0xcbfde6[_0xd715('0x31')]);_0x5a00c5[_0xd715('0x33')]=_['intersection'](_0xcbfde6[_0xd715('0x2f')],qs[_0xd715('0x34')](_0x6fcf96[_0xd715('0x31')][_0xd715('0x34')]));_0x5a00c5[_0xd715('0x33')]=_0x5a00c5[_0xd715('0x33')][_0xd715('0x35')]?_0x5a00c5[_0xd715('0x33')]:_0xcbfde6[_0xd715('0x2f')];if(!_0x6fcf96['query'][_0xd715('0x36')]('nolimit')){_0x5a00c5[_0xd715('0x1f')]=qs['limit'](_0x6fcf96['query'][_0xd715('0x1f')]);_0x5a00c5['offset']=qs[_0xd715('0x1d')](_0x6fcf96[_0xd715('0x31')][_0xd715('0x1d')]);}_0x5a00c5[_0xd715('0x37')]=qs[_0xd715('0x38')](_0x6fcf96[_0xd715('0x31')]['sort']);_0x5a00c5[_0xd715('0x39')]=qs[_0xd715('0x32')](_[_0xd715('0x3a')](_0x6fcf96['query'],_0xcbfde6[_0xd715('0x32')]),_0x48727a);if(_0x6fcf96[_0xd715('0x31')][_0xd715('0x3b')]){_0x5a00c5['where']=_['merge'](_0x5a00c5['where'],{'$or':_[_0xd715('0x29')](_0x48727a,function(_0x34bb8b){if(_0x34bb8b[_0xd715('0x2d')]!=='VIRTUAL'){var _0x3b977d={};_0x3b977d[_0x34bb8b['name']]={'$like':'%'+_0x6fcf96[_0xd715('0x31')]['filter']+'%'};return _0x3b977d;}})});}_0x5a00c5=_[_0xd715('0x3c')]({},_0x5a00c5,_0x6fcf96['options']);var _0x29cf04={'where':_0x5a00c5[_0xd715('0x39')]};return db[_0xd715('0x2a')][_0xd715('0x20')](_0x29cf04)[_0xd715('0x3d')](function(_0x4c0608){_0x2e0d07[_0xd715('0x20')]=_0x4c0608;if(_0x6fcf96[_0xd715('0x31')][_0xd715('0x3e')]){_0x5a00c5['include']=[{'all':!![]}];}return db[_0xd715('0x2a')]['findAll'](_0x5a00c5);})[_0xd715('0x3d')](function(_0x5f40ec){_0x2e0d07[_0xd715('0x3f')]=_0x5f40ec;return _0x2e0d07;})[_0xd715('0x3d')](respondWithFilteredResult(_0x59618e,_0x5a00c5))[_0xd715('0x1b')](handleError(_0x59618e,null));};exports[_0xd715('0x40')]=function(_0x137ec3,_0x54b466){var _0x34cfbe={'raw':!![],'where':{'id':_0x137ec3[_0xd715('0x41')]['id']}},_0x4fab58={};_0x4fab58[_0xd715('0x2f')]=_[_0xd715('0x30')](db[_0xd715('0x2a')]['rawAttributes']);_0x4fab58[_0xd715('0x31')]=_[_0xd715('0x30')](_0x137ec3[_0xd715('0x31')]);_0x4fab58['filters']=_['intersection'](_0x4fab58['model'],_0x4fab58[_0xd715('0x31')]);_0x34cfbe[_0xd715('0x33')]=_[_0xd715('0x42')](_0x4fab58[_0xd715('0x2f')],qs[_0xd715('0x34')](_0x137ec3[_0xd715('0x31')]['fields']));_0x34cfbe[_0xd715('0x33')]=_0x34cfbe[_0xd715('0x33')]['length']?_0x34cfbe[_0xd715('0x33')]:_0x4fab58[_0xd715('0x2f')];if(_0x137ec3[_0xd715('0x31')][_0xd715('0x3e')]){_0x34cfbe[_0xd715('0x43')]=[{'all':!![]}];}_0x34cfbe=_[_0xd715('0x3c')]({},_0x34cfbe,_0x137ec3['options']);return db[_0xd715('0x2a')]['find'](_0x34cfbe)[_0xd715('0x3d')](handleEntityNotFound(_0x54b466,null))[_0xd715('0x3d')](respondWithResult(_0x54b466,null))[_0xd715('0x1b')](handleError(_0x54b466,null));};exports[_0xd715('0x44')]=function(_0x347b4e,_0x421e07){if(_0x347b4e[_0xd715('0x45')]['id']){delete _0x347b4e[_0xd715('0x45')]['id'];}return db['MailMessage'][_0xd715('0x46')]({'where':{'id':_0x347b4e[_0xd715('0x41')]['id']}})[_0xd715('0x3d')](handleEntityNotFound(_0x421e07,null))['then'](saveUpdates(_0x347b4e[_0xd715('0x45')],null))[_0xd715('0x3d')](respondWithResult(_0x421e07,null))[_0xd715('0x1b')](handleError(_0x421e07,null));};exports['destroy']=function(_0x1d7e22,_0x51fcf0){return db[_0xd715('0x2a')][_0xd715('0x46')]({'where':{'id':_0x1d7e22[_0xd715('0x41')]['id']}})[_0xd715('0x3d')](handleEntityNotFound(_0x51fcf0,null))[_0xd715('0x3d')](removeEntity(_0x51fcf0,null))['catch'](handleError(_0x51fcf0,null));};exports[_0xd715('0x47')]=function(_0x5f0114,_0x48e879){return db[_0xd715('0x2a')][_0xd715('0x47')]()[_0xd715('0x3d')](respondWithResult(_0x48e879,null))[_0xd715('0x1b')](handleError(_0x48e879,null));};exports[_0xd715('0x48')]=function(_0x20b804,_0x52fe30){return db[_0xd715('0x2a')][_0xd715('0x48')](_0x20b804[_0xd715('0x45')])[_0xd715('0x3d')](function(_0x55efdc){if(_0x55efdc){if(_0x55efdc['direction']===_0xd715('0x49')&&!_0x55efdc[_0xd715('0x4a')]){var _0x178a37,_0x299582,_0x579322;if(_0x20b804[_0xd715('0x45')]['to']){_0x299582=_0x20b804[_0xd715('0x45')]['to']['split'](',')[0x0];}return db[_0xd715('0x4b')][_0xd715('0x4c')]({'where':{'id':_0x55efdc['MailAccountId']},'include':[{'model':db[_0xd715('0x4d')],'as':_0xd715('0x4e'),'include':[{'model':db[_0xd715('0x4f')],'as':'Contacts','where':{'email':_0x299582},'limit':0x1,'order':[['updatedAt',_0xd715('0x50')]]}]},{'model':db[_0xd715('0x51')],'as':_0xd715('0x52'),'raw':!![],'include':[{'model':db[_0xd715('0x53')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x450667){_0x178a37=_0x450667;if(!_0x178a37||!_0x178a37[_0xd715('0x52')])return;var _0x297387=_0x178a37[_0xd715('0x54')]();if(_0x20b804['body'][_0xd715('0x55')]&&_0x20b804[_0xd715('0x45')]['attachments']['length']){for(var _0x48b343=0x0;_0x48b343<_0x20b804['body'][_0xd715('0x55')][_0xd715('0x35')];_0x48b343+=0x1){_0x20b804['body'][_0xd715('0x55')][_0x48b343]={'filename':_0x20b804[_0xd715('0x45')]['attachments'][_0x48b343]['name'],'path':path[_0xd715('0x56')](config[_0xd715('0x57')],_0xd715('0x58'),_0x20b804[_0xd715('0x45')][_0xd715('0x55')][_0x48b343][_0xd715('0x59')])};}}_0x579322={'account':_0x297387,'message':_0x20b804[_0xd715('0x45')]};return;})[_0xd715('0x3d')](function(){if(_0x178a37[_0xd715('0x4e')]){if(_0x178a37[_0xd715('0x4e')][_0xd715('0x5a')]['length']){return _0x178a37[_0xd715('0x4e')][_0xd715('0x5a')][0x0];}else{return db[_0xd715('0x4f')][_0xd715('0x48')](_[_0xd715('0xb')](_0x20b804[_0xd715('0x45')],{'firstName':_0x20b804['body']['to'],'email':_0x20b804[_0xd715('0x45')]['to'],'phone':_0x20b804[_0xd715('0x45')]['to'],'ListId':_0x178a37[_0xd715('0x5b')]}));}}else{throw new Error(_0xd715('0x5c'));}})[_0xd715('0x3d')](function(){if(_0x579322){return respondWithRpcPromise(_0xd715('0x5d'),_0xd715('0x5e'),_0x579322,client9003)[_0xd715('0x3d')](function(_0x38def3){return _0x55efdc[_0xd715('0x44')]({'read':!![],'messageId':_0x38def3[_0xd715('0x5f')],'sentAt':moment()[_0xd715('0x60')](_0xd715('0x61'))});})['catch'](function(_0x2caaec){logger['error']('%s',JSON[_0xd715('0x62')](_0x2caaec));return _0x55efdc;});}return _0x55efdc;});}return _0x55efdc;}})['then'](respondWithResult(_0x52fe30,0xc9))['catch'](handleError(_0x52fe30,null));};exports[_0xd715('0x63')]=function(_0x2e29f2,_0x3a421e){var _0x24f80b={'agent':{},'channel':_0xd715('0x64')};if(_0x2e29f2['body']['id']){delete _0x2e29f2['body']['id'];}_0x2e29f2['body'][_0xd715('0x65')]=!![];_0x2e29f2[_0xd715('0x45')]['readAt']=moment()[_0xd715('0x60')](_0xd715('0x61'));_0x2e29f2['body'][_0xd715('0x66')]=_0x2e29f2[_0xd715('0x45')]['UserId']||_0x2e29f2[_0xd715('0x67')]['id'];_0x24f80b[_0xd715('0x68')]['id']=_0x2e29f2[_0xd715('0x45')][_0xd715('0x66')];return db[_0xd715('0x2a')][_0xd715('0x46')]({'where':{'id':_0x2e29f2[_0xd715('0x41')]['id'],'UserId':null}})[_0xd715('0x3d')](handleEntityNotFound(_0x3a421e,null))[_0xd715('0x3d')](saveUpdates(_0x2e29f2[_0xd715('0x45')],null))[_0xd715('0x3d')](function(_0x184d85){if(_0x184d85){_0x24f80b[_0xd715('0x19')]=_0x184d85[_0xd715('0x69')]({'plain':!![]});return db[_0xd715('0x6a')][_0xd715('0x46')]({'where':{'id':_0x184d85[_0xd715('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x3a421e,null))[_0xd715('0x3d')](function(_0x26bcd4){if(_0x26bcd4){return _0x26bcd4[_0xd715('0x44')]({'UserId':_0x2e29f2[_0xd715('0x45')]['UserId'],'read1stAt':_[_0xd715('0x6c')](_0x26bcd4[_0xd715('0x6d')])?moment()[_0xd715('0x60')](_0xd715('0x61')):undefined});}return null;})[_0xd715('0x3d')](function(_0x47b95e){if(_0x47b95e){_0x24f80b['interaction']=_0x47b95e[_0xd715('0x69')]({'plain':!![]});interaction_log[_0xd715('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e29f2['user']['id'],_0x2e29f2[_0xd715('0x67')][_0xd715('0x27')],_0x2e29f2['user']['role'],_0x24f80b[_0xd715('0x6e')]['id'],_0x2e29f2[_0xd715('0x45')]?JSON['stringify'](_0x2e29f2[_0xd715('0x45')]):_0xd715('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xd715('0x70'),_0x24f80b);}return null;})['then'](function(_0x52853e){var _0x3787c1=_0xd715('0x71')+_0x52853e[_0xd715('0x19')][_0xd715('0x72')];return db[_0xd715('0x73')][_0xd715('0x31')](_0x3787c1,{'type':db['Sequelize'][_0xd715('0x74')][_0xd715('0x75')],'raw':!![]})['then'](function(_0x3534f8){return _0x3534f8;});})[_0xd715('0x3d')](function(_0x58beb9){if(_0x58beb9){_0x24f80b[_0xd715('0x19')][_0xd715('0x76')]=_0x58beb9[0x0];if(!_0x2e29f2[_0xd715('0x45')][_0xd715('0x66')])return;return db[_0xd715('0x77')][_0xd715('0x46')]({'where':{'id':_0x2e29f2['body'][_0xd715('0x66')],'role':_0xd715('0x68')},'attributes':['id','name',_0xd715('0x78'),_0xd715('0x79'),_0xd715('0x7a')],'raw':!![]});}return null;})['then'](function(_0x571ce0){if(!_0x571ce0)return null;_0x24f80b[_0xd715('0x19')]['agent']=_0x571ce0;return _0x24f80b;})['then'](function(_0x24abdf){if(_0x24abdf){if(_0x2e29f2[_0xd715('0x45')]['manual']){_0x24f80b[_0xd715('0x19')][_0xd715('0x7b')]=util[_0xd715('0x60')](_0xd715('0x7c'),_0x2e29f2[_0xd715('0x67')][_0xd715('0x27')]);_0x24f80b[_0xd715('0x19')]['channel']=_0x24f80b[_0xd715('0x7d')];_0x24f80b[_0xd715('0x19')][_0xd715('0x7e')]=_0x24f80b['channel'];_0x24f80b[_0xd715('0x19')]['event']=_0xd715('0x63');_0x24f80b[_0xd715('0x19')]['body']=htmlToText[_0xd715('0x7f')](_0x24f80b[_0xd715('0x19')][_0xd715('0x45')]);return respondWithRpcPromise(_0xd715('0x80'),_0xd715('0x80'),{'event':_0xd715('0x81'),'message':_0x24f80b[_0xd715('0x19')]},client9002)[_0xd715('0x3d')](function(){return _0x24f80b;});}return _0x24f80b;}return null;})['then'](respondWithResult(_0x3a421e,null))[_0xd715('0x1b')](handleError(_0x3a421e,null));};exports[_0xd715('0x82')]=function(_0x1a6a1e,_0x1f0225){var _0x996718={'agent':{},'channel':'mail'};if(_0x1a6a1e[_0xd715('0x45')]['id']){delete _0x1a6a1e[_0xd715('0x45')]['id'];}_0x1a6a1e['body'][_0xd715('0x66')]=_0x1a6a1e['body'][_0xd715('0x66')]||_0x1a6a1e['user']['id'];_0x996718['agent']['id']=_0x1a6a1e['body'][_0xd715('0x66')];return db[_0xd715('0x2a')][_0xd715('0x46')]({'where':{'id':_0x1a6a1e[_0xd715('0x41')]['id'],'UserId':null}})[_0xd715('0x3d')](handleEntityNotFound(_0x1f0225,null))[_0xd715('0x3d')](function(_0x3b42e7){if(_0x3b42e7){_0x996718[_0xd715('0x19')]=_0x3b42e7[_0xd715('0x69')]({'plain':!![]});return db[_0xd715('0x6a')][_0xd715('0x46')]({'where':{'id':_0x3b42e7[_0xd715('0x6b')]}});}return null;})[_0xd715('0x3d')](handleEntityNotFound(_0x1f0225,null))['then'](function(_0x51c1da){if(_0x51c1da){_0x996718[_0xd715('0x6e')]=_0x51c1da[_0xd715('0x69')]({'plain':!![]});interaction_log[_0xd715('0x13')](_0xd715('0x83'),_0x1a6a1e[_0xd715('0x67')]['id'],_0x1a6a1e[_0xd715('0x67')][_0xd715('0x27')],_0x1a6a1e['user'][_0xd715('0x84')],_0x996718[_0xd715('0x6e')]['id'],_0x1a6a1e[_0xd715('0x45')]?JSON[_0xd715('0x62')](_0x1a6a1e[_0xd715('0x45')]):_0xd715('0x6f'));return respondWithRpcPromise(_0xd715('0x85'),_0xd715('0x86'),_0x996718);}return null;})[_0xd715('0x3d')](function(_0x21837f){var _0x157ae6=_0xd715('0x71')+_0x21837f['message'][_0xd715('0x72')];return db['sequelize'][_0xd715('0x31')](_0x157ae6,{'type':db['Sequelize'][_0xd715('0x74')][_0xd715('0x75')],'raw':!![]})[_0xd715('0x3d')](function(_0x5dd72f){return _0x5dd72f;});})[_0xd715('0x3d')](function(_0x43ab05){if(_0x43ab05){_0x996718[_0xd715('0x19')][_0xd715('0x76')]=_0x43ab05[0x0];if(!_0x1a6a1e[_0xd715('0x45')][_0xd715('0x66')])return;return db[_0xd715('0x77')][_0xd715('0x46')]({'where':{'id':_0x1a6a1e[_0xd715('0x45')][_0xd715('0x66')],'role':_0xd715('0x68')},'attributes':['id',_0xd715('0x27'),'fullname',_0xd715('0x79'),'internal'],'raw':!![]});}return null;})[_0xd715('0x3d')](function(_0x166ba5){if(!_0x166ba5)return null;_0x996718[_0xd715('0x19')]['agent']=_0x166ba5;return _0x996718;})['then'](function(_0x470c7c){if(_0x470c7c){_0x470c7c['message'][_0xd715('0x7b')]=util[_0xd715('0x60')]('SIP/%s',_0x1a6a1e['user'][_0xd715('0x27')]);_0x470c7c[_0xd715('0x19')][_0xd715('0x7d')]=_0x996718[_0xd715('0x7d')];_0x470c7c[_0xd715('0x19')][_0xd715('0x7e')]=_0x996718[_0xd715('0x7d')];_0x470c7c[_0xd715('0x19')][_0xd715('0x87')]=_0xd715('0x82');_0x470c7c['message'][_0xd715('0x45')]=htmlToText['fromString'](_0x996718['message']['body']);respondWithRpcPromise(_0xd715('0x80'),'EventManager',{'event':_0xd715('0x88'),'message':_0x470c7c[_0xd715('0x19')]},client9002);return _0x996718;}return null;})[_0xd715('0x3d')](respondWithResult(_0x1f0225,null))[_0xd715('0x1b')](handleError(_0x1f0225,null));};exports['download']=function(_0x2020de,_0x3ec31f){var _0x429861=moment()[_0xd715('0x89')]()[_0xd715('0x8a')]();var _0x533b37=path['join'](config[_0xd715('0x57')],_0xd715('0x8b'),_0xd715('0x8c'),_0xd715('0x8d'));var _0x393562=path['join'](config[_0xd715('0x57')],_0xd715('0x8b'),_0xd715('0x8c'),_0xd715('0x55'));var _0x3e6f2c=util['format'](_0xd715('0x8e'),_0x429861);return db[_0xd715('0x2a')][_0xd715('0x46')]({'where':{'id':_0x2020de[_0xd715('0x41')]['id']},'attributes':['id',_0xd715('0x45'),_0xd715('0x8f'),'to','cc',_0xd715('0x90'),_0xd715('0x91'),_0xd715('0x92')],'include':_0x2020de[_0xd715('0x31')][_0xd715('0x55')]?[{'model':db[_0xd715('0x93')],'as':_0xd715('0x94')}]:undefined})[_0xd715('0x3d')](handleEntityNotFound(_0x3ec31f,null))[_0xd715('0x3d')](function(_0x89821d){if(_0x89821d){var _0x1140ae=_0x89821d;var _0x5ec025={'from':_0x1140ae[_0xd715('0x8f')],'to':_0x1140ae['to'],'subject':_0x1140ae[_0xd715('0x91')],'html':htmlEntities['decode'](_0x1140ae[_0xd715('0x45')]),'headers':{'Date':moment(_0x1140ae['createdAt'])[_0xd715('0x60')](_0xd715('0x95'))},'attachments':[]};if(_0x89821d['cc']){_0x5ec025[_0xd715('0x96')]['Cc']=_0x89821d['cc'];}if(_0x89821d[_0xd715('0x90')]){_0x5ec025[_0xd715('0x96')]['Bcc']=_0x89821d['bcc'];}return new BPromise(function(_0x54f406,_0xf73b5c){if(_0x89821d[_0xd715('0x94')]){for(var _0x255b2d=0x0;_0x255b2d<_0x89821d[_0xd715('0x94')][_0xd715('0x35')];_0x255b2d++){var _0xd3420b=_0x89821d[_0xd715('0x94')][_0x255b2d];var _0x5c124f=path[_0xd715('0x56')](_0x393562,_0xd3420b['basename']);if(fs[_0xd715('0x97')](_0x5c124f)){_0x5ec025[_0xd715('0x55')][_0xd715('0x98')]({'name':_0xd3420b[_0xd715('0x27')],'contentType':_0xd3420b[_0xd715('0x2d')],'data':fs[_0xd715('0x99')](_0x5c124f)});}}}emlformat[_0xd715('0x9a')](_0x5ec025,function(_0x7ab7a2,_0x500e86){if(_0x7ab7a2)return _0xf73b5c(_0x7ab7a2);fs[_0xd715('0x9b')](path[_0xd715('0x56')](_0x533b37,_0x3e6f2c),_0x500e86);return _0x54f406(_0x500e86);});});}})[_0xd715('0x3d')](function(_0x5e7036){if(_0x5e7036){return _0x3ec31f[_0xd715('0x9c')](path['join'](_0x533b37,_0x3e6f2c),_0x3e6f2c,function(_0x1cc583){if(!_0x1cc583)fs[_0xd715('0x9d')](path[_0xd715('0x56')](_0x533b37,_0x3e6f2c));});}})[_0xd715('0x1b')](handleError(_0x3ec31f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c542fbb..ce70a49 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 _0x637d=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','save','update','remove'];(function(_0x17e492,_0x7353de){var _0x16f676=function(_0x2feb6e){while(--_0x2feb6e){_0x17e492['push'](_0x17e492['shift']());}};_0x16f676(++_0x7353de);}(_0x637d,0x8b));var _0xd637=function(_0x2525ae,_0x5519aa){_0x2525ae=_0x2525ae-0x0;var _0x50093e=_0x637d[_0x2525ae];return _0x50093e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xd637('0x0'))['db'][_0xd637('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd637('0x2'),'afterUpdate':_0xd637('0x3'),'afterDestroy':_0xd637('0x4')};function emitEvent(_0x34ebe7){return function(_0x3ec977,_0x3b1199,_0x5bdd82){MailMessageEvents[_0xd637('0x5')](_0x34ebe7+':'+_0x3ec977['id'],_0x3ec977);MailMessageEvents[_0xd637('0x5')](_0x34ebe7,_0x3ec977);_0x5bdd82(null);};}for(var e in events){if(events[_0xd637('0x6')](e)){var event=events[e];MailMessage[_0xd637('0x7')](e,emitEvent(event));}}module[_0xd637('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xc205=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x55a4ec,_0x4d7610){var _0x2ded12=function(_0x14fd4f){while(--_0x14fd4f){_0x55a4ec['push'](_0x55a4ec['shift']());}};_0x2ded12(++_0x4d7610);}(_0xc205,0x14d));var _0x5c20=function(_0x54a436,_0x2ada8a){_0x54a436=_0x54a436-0x0;var _0x48d867=_0xc205[_0x54a436];return _0x48d867;};'use strict';var EventEmitter=require(_0x5c20('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5c20('0x1')](0x0);var events={'afterCreate':_0x5c20('0x2'),'afterUpdate':_0x5c20('0x3'),'afterDestroy':_0x5c20('0x4')};function emitEvent(_0x37ab35){return function(_0x2ac2eb,_0x6c36b8,_0xd6a6ad){MailMessageEvents[_0x5c20('0x5')](_0x37ab35+':'+_0x2ac2eb['id'],_0x2ac2eb);MailMessageEvents[_0x5c20('0x5')](_0x37ab35,_0x2ac2eb);_0xd6a6ad(null);};}for(var e in events){if(events[_0x5c20('0x6')](e)){var event=events[e];MailMessage[_0x5c20('0x7')](e,emitEvent(event));}}module[_0x5c20('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d9b8af7..70710e5 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 _0x5a28=['util','../../config/logger','api','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','error','utf8mb4'];(function(_0x129d52,_0x1beadf){var _0x79ef89=function(_0x4913bb){while(--_0x4913bb){_0x129d52['push'](_0x129d52['shift']());}};_0x79ef89(++_0x1beadf);}(_0x5a28,0xa0));var _0x85a2=function(_0x15fb19,_0x3f9d71){_0x15fb19=_0x15fb19-0x0;var _0x5b1b67=_0x5a28[_0x15fb19];return _0x5b1b67;};'use strict';var _=require('lodash');var util=require(_0x85a2('0x0'));var logger=require(_0x85a2('0x1'))(_0x85a2('0x2'));var moment=require('moment');var BPromise=require(_0x85a2('0x3'));var rp=require(_0x85a2('0x4'));var htmlToText=require(_0x85a2('0x5'));var fs=require('fs');var path=require(_0x85a2('0x6'));var rimraf=require('rimraf');var config=require(_0x85a2('0x7'));var attributes=require(_0x85a2('0x8'));module[_0x85a2('0x9')]=function(_0x38d689,_0x327126){return _0x38d689[_0x85a2('0xa')](_0x85a2('0xb'),attributes,{'tableName':_0x85a2('0xc'),'paranoid':![],'indexes':[{'name':_0x85a2('0xd'),'fields':[_0x85a2('0xd')]},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':_0x85a2('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x103703,_0x572b0f,_0x372fe1){if(_0x103703[_0x85a2('0xf')]){_0x103703[_0x85a2('0x10')]=htmlToText[_0x85a2('0x11')](_0x103703['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x372fe1(null,_0x572b0f);},'afterCreate':function(_0x146cba,_0x458197,_0x2ae142){var _0x5eed5d=_0x38d689[_0x85a2('0x12')];var _0x1b85ef=_0x146cba[_0x85a2('0x13')]({'plain':!![]});if(_0x1b85ef[_0x85a2('0x14')][_0x85a2('0x15')]()==='in'||_0x1b85ef[_0x85a2('0x14')][_0x85a2('0x15')]()===_0x85a2('0x16')&&!_0x1b85ef[_0x85a2('0x17')]&&!_[_0x85a2('0x18')](_0x1b85ef['UserId'])){_0x5eed5d[_0x85a2('0x19')][_0x85a2('0x1a')]({'where':{'id':_0x1b85ef[_0x85a2('0x1b')]}})['then'](function(_0x509526){if(_0x509526){_0x509526[_0x85a2('0x1c')]({'lastMsgAt':_0x1b85ef[_0x85a2('0x1d')],'lastMsgDirection':_0x1b85ef[_0x85a2('0x14')][_0x85a2('0x15')]()});}})['catch'](function(_0x380064){console[_0x85a2('0x1e')](_0x380064);});}_0x2ae142();}},'charset':_0x85a2('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5cf3=['api','moment','bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','toLowerCase','direction','out','secret','UserId','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger'];(function(_0x4e3292,_0x2e25ae){var _0x151ea7=function(_0x456edb){while(--_0x456edb){_0x4e3292['push'](_0x4e3292['shift']());}};_0x151ea7(++_0x2e25ae);}(_0x5cf3,0x195));var _0x35cf=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x5cf3[_0x4884a7];return _0x56b60e;};'use strict';var _=require(_0x35cf('0x0'));var util=require(_0x35cf('0x1'));var logger=require(_0x35cf('0x2'))(_0x35cf('0x3'));var moment=require(_0x35cf('0x4'));var BPromise=require(_0x35cf('0x5'));var rp=require('request-promise');var htmlToText=require(_0x35cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35cf('0x7'));var config=require(_0x35cf('0x8'));var attributes=require(_0x35cf('0x9'));module[_0x35cf('0xa')]=function(_0xabea3d,_0x2073d8){return _0xabea3d[_0x35cf('0xb')](_0x35cf('0xc'),attributes,{'tableName':_0x35cf('0xd'),'paranoid':![],'indexes':[{'name':_0x35cf('0xe'),'fields':['messageId']},{'name':_0x35cf('0xf'),'fields':[_0x35cf('0x10'),_0x35cf('0x11')],'type':_0x35cf('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x176cf8,_0x57c815,_0x576981){if(_0x176cf8[_0x35cf('0x13')]){_0x176cf8[_0x35cf('0x10')]=htmlToText[_0x35cf('0x14')](_0x176cf8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x576981(null,_0x57c815);},'afterCreate':function(_0x428a65,_0x55f05d,_0x13d76f){var _0x542864=_0xabea3d['models'];var _0x10ce08=_0x428a65[_0x35cf('0x15')]({'plain':!![]});if(_0x10ce08['direction'][_0x35cf('0x16')]()==='in'||_0x10ce08[_0x35cf('0x17')]['toLowerCase']()===_0x35cf('0x18')&&!_0x10ce08[_0x35cf('0x19')]&&!_['isNil'](_0x10ce08[_0x35cf('0x1a')])){_0x542864['MailInteraction'][_0x35cf('0x1b')]({'where':{'id':_0x10ce08[_0x35cf('0x1c')]}})[_0x35cf('0x1d')](function(_0x359874){if(_0x359874){_0x359874['update']({'lastMsgAt':_0x10ce08[_0x35cf('0x1e')],'lastMsgDirection':_0x10ce08[_0x35cf('0x17')][_0x35cf('0x16')]()});}})[_0x35cf('0x1f')](function(_0x489035){console[_0x35cf('0x20')](_0x489035);});}_0x13d76f();}},'charset':_0x35cf('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 09c059d..6cc5c1b 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 _0x6d11=['options','raw','CreateMailMessage','debug','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage','create','body'];(function(_0x5143c5,_0x5a688e){var _0x157214=function(_0x5e9e53){while(--_0x5e9e53){_0x5143c5['push'](_0x5143c5['shift']());}};_0x157214(++_0x5a688e);}(_0x6d11,0xbf));var _0x16d1=function(_0x409d62,_0x41507c){_0x409d62=_0x409d62-0x0;var _0x2e2d31=_0x6d11[_0x409d62];return _0x2e2d31;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});config[_0x16d1('0xa')]=_[_0x16d1('0xb')](config[_0x16d1('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x16d1('0xc'))[_0x16d1('0xd')](socket);function respondWithRpcPromise(_0xe67758,_0x5a6abb,_0x4b7d4f){return new BPromise(function(_0x265a84,_0x2c360f){return client[_0x16d1('0xe')](_0xe67758,_0x4b7d4f)[_0x16d1('0xf')](function(_0x28188f){logger[_0x16d1('0x10')](_0x16d1('0x11'),_0x5a6abb,_0x16d1('0x12'));logger['debug'](_0x16d1('0x13'),_0x5a6abb,_0x16d1('0x12'),JSON[_0x16d1('0x14')](_0x28188f));if(_0x28188f[_0x16d1('0x15')]){if(_0x28188f[_0x16d1('0x15')]['code']===0x1f4){logger[_0x16d1('0x15')](_0x16d1('0x11'),_0x5a6abb,_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);return _0x2c360f(_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);}logger[_0x16d1('0x15')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x28188f[_0x16d1('0x15')][_0x16d1('0x16')]);return _0x265a84(_0x28188f['error']['message']);}else{logger[_0x16d1('0x10')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x16d1('0x12'));_0x265a84(_0x28188f['result'][_0x16d1('0x16')]);}})['catch'](function(_0x30f694){logger[_0x16d1('0x15')]('MailMessage,\x20%s,\x20%s',_0x5a6abb,_0x30f694);_0x2c360f(_0x30f694);});});}exports['CreateMailMessage']=function(_0x52a0f2){var _0x5b9599=this;return new Promise(function(_0x348425,_0x55a0e0){return db[_0x16d1('0x17')][_0x16d1('0x18')](_0x52a0f2[_0x16d1('0x19')],{'raw':_0x52a0f2[_0x16d1('0x1a')]?_0x52a0f2['options'][_0x16d1('0x1b')]===undefined?!![]:![]:!![]})[_0x16d1('0xf')](function(_0x2a897d){logger['info'](_0x16d1('0x1c'),_0x52a0f2);logger[_0x16d1('0x1d')](_0x16d1('0x1c'),_0x52a0f2,JSON[_0x16d1('0x14')](_0x2a897d));_0x348425(_0x2a897d);})[_0x16d1('0x1e')](function(_0x1448b7){logger[_0x16d1('0x15')](_0x16d1('0x1c'),_0x1448b7[_0x16d1('0x16')],_0x52a0f2);_0x55a0e0(_0x5b9599[_0x16d1('0x15')](0x1f4,_0x1448b7[_0x16d1('0x16')]));});});}; \ No newline at end of file +var _0x4888=['code','message','request\x20sent','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x53f9a8,_0x43c7ea){var _0x27b839=function(_0x5b75b0){while(--_0x5b75b0){_0x53f9a8['push'](_0x53f9a8['shift']());}};_0x27b839(++_0x43c7ea);}(_0x4888,0x198));var _0x8488=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x4888[_0x5ecbe8];return _0x1c6e21;};'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']('MailMessage,\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);});});}exports[_0x8488('0x1a')]=function(_0x3dd93e){var _0x554ec6=this;return new Promise(function(_0x4a1b45,_0x340d6b){return db[_0x8488('0x1b')][_0x8488('0x1c')](_0x3dd93e[_0x8488('0x1d')],{'raw':_0x3dd93e[_0x8488('0x1e')]?_0x3dd93e[_0x8488('0x1e')][_0x8488('0x1f')]===undefined?!![]:![]:!![]})[_0x8488('0xf')](function(_0x39dd43){logger['info'](_0x8488('0x1a'),_0x3dd93e);logger[_0x8488('0x12')](_0x8488('0x1a'),_0x3dd93e,JSON[_0x8488('0x20')](_0x39dd43));_0x4a1b45(_0x39dd43);})[_0x8488('0x19')](function(_0x54ecda){logger['error']('CreateMailMessage',_0x54ecda['message'],_0x3dd93e);_0x340d6b(_0x554ec6[_0x8488('0x14')](0x1f4,_0x54ecda['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 832b60f..1d65d9a 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 _0x2242=['register','length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x2242,0x1a3));var _0x2224=function(_0x5b0742,_0x26263d){_0x5b0742=_0x5b0742-0x0;var _0x515d00=_0x2242[_0x5b0742];return _0x515d00;};'use strict';var MailMessageEvents=require(_0x2224('0x0'));var events=[_0x2224('0x1'),_0x2224('0x2'),'update'];function createListener(_0x3180c8,_0x317565){return function(_0x4acc10){_0x317565[_0x2224('0x3')](_0x3180c8,_0x4acc10);};}function removeListener(_0xb65b2f,_0x4b2099){return function(){MailMessageEvents[_0x2224('0x4')](_0xb65b2f,_0x4b2099);};}exports[_0x2224('0x5')]=function(_0x23a873){for(var _0x54d057=0x0,_0x28833b=events[_0x2224('0x6')];_0x54d057<_0x28833b;_0x54d057++){var _0x35f807=events[_0x54d057];var _0x25c6d4=createListener(_0x2224('0x7')+_0x35f807,_0x23a873);MailMessageEvents['on'](_0x35f807,_0x25c6d4);}}; \ No newline at end of file +var _0xa7aa=['mailMessage:','save','remove','update'];(function(_0x40d627,_0x1276e4){var _0x4c3ab7=function(_0x55e71c){while(--_0x55e71c){_0x40d627['push'](_0x40d627['shift']());}};_0x4c3ab7(++_0x1276e4);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x117ec3,_0x4cff4b){_0x117ec3=_0x117ec3-0x0;var _0x1a2e59=_0xa7aa[_0x117ec3];return _0x1a2e59;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xaa7a('0x0'),_0xaa7a('0x1'),_0xaa7a('0x2')];function createListener(_0x40303d,_0x23fcbd){return function(_0x252dc2){_0x23fcbd['emit'](_0x40303d,_0x252dc2);};}function removeListener(_0x53edc8,_0x428169){return function(){MailMessageEvents['removeListener'](_0x53edc8,_0x428169);};}exports['register']=function(_0x5675f3){for(var _0x4159ec=0x0,_0x4e5615=events['length'];_0x4159ec<_0x4e5615;_0x4159ec++){var _0xc1585f=events[_0x4159ec];var _0x2d77b3=createListener(_0xaa7a('0x3')+_0xc1585f,_0x5675f3);MailMessageEvents['on'](_0xc1585f,_0x2d77b3);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a75f84d..bf55c89 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 _0xd1e1=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x1dcb4d,_0x158910){var _0x18bc70=function(_0x5a8c8a){while(--_0x5a8c8a){_0x1dcb4d['push'](_0x1dcb4d['shift']());}};_0x18bc70(++_0x158910);}(_0xd1e1,0xbe));var _0x1d1e=function(_0x4e45dd,_0x11c489){_0x4e45dd=_0x4e45dd-0x0;var _0x55f014=_0xd1e1[_0x4e45dd];return _0x55f014;};'use strict';var multer=require(_0x1d1e('0x0'));var util=require(_0x1d1e('0x1'));var path=require(_0x1d1e('0x2'));var timeout=require(_0x1d1e('0x3'));var express=require(_0x1d1e('0x4'));var router=express[_0x1d1e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1d1e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1e('0x7'));var controller=require('./mailQueue.controller');router[_0x1d1e('0x8')]('/',auth[_0x1d1e('0x9')](),controller['index']);router['get'](_0x1d1e('0xa'),auth[_0x1d1e('0x9')](),controller['describe']);router[_0x1d1e('0x8')]('/:id',auth[_0x1d1e('0x9')](),controller[_0x1d1e('0xb')]);router['get'](_0x1d1e('0xc'),auth['isAuthenticated'](),controller[_0x1d1e('0xd')]);router[_0x1d1e('0x8')]('/:id/teams',auth[_0x1d1e('0x9')](),controller[_0x1d1e('0xe')]);router[_0x1d1e('0x8')](_0x1d1e('0xf'),auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x10')]);router[_0x1d1e('0x11')]('/',auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x12')]);router[_0x1d1e('0x11')](_0x1d1e('0x13'),auth['isAuthenticated'](),controller[_0x1d1e('0x14')]);router[_0x1d1e('0x11')](_0x1d1e('0xf'),auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x15')]);router[_0x1d1e('0x16')](_0x1d1e('0x17'),auth[_0x1d1e('0x9')](),controller['update']);router[_0x1d1e('0x18')](_0x1d1e('0x17'),auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x19')]);router[_0x1d1e('0x18')](_0x1d1e('0x13'),auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x1a')]);router[_0x1d1e('0x18')](_0x1d1e('0xf'),auth[_0x1d1e('0x9')](),controller[_0x1d1e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2512=['index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x4a6a4c,_0x5149d1){var _0xdb0e5b=function(_0x319640){while(--_0x319640){_0x4a6a4c['push'](_0x4a6a4c['shift']());}};_0xdb0e5b(++_0x5149d1);}(_0x2512,0xa9));var _0x2251=function(_0x3a351d,_0x5bb577){_0x3a351d=_0x3a351d-0x0;var _0x370d12=_0x2512[_0x3a351d];return _0x370d12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2251('0x0'));var timeout=require(_0x2251('0x1'));var express=require(_0x2251('0x2'));var router=express[_0x2251('0x3')]();var fs_extra=require(_0x2251('0x4'));var auth=require(_0x2251('0x5'));var interaction=require(_0x2251('0x6'));var config=require(_0x2251('0x7'));var controller=require(_0x2251('0x8'));router[_0x2251('0x9')]('/',auth[_0x2251('0xa')](),controller[_0x2251('0xb')]);router['get'](_0x2251('0xc'),auth[_0x2251('0xa')](),controller[_0x2251('0xd')]);router[_0x2251('0x9')](_0x2251('0xe'),auth[_0x2251('0xa')](),controller[_0x2251('0xf')]);router[_0x2251('0x9')]('/:id/members',auth[_0x2251('0xa')](),controller[_0x2251('0x10')]);router[_0x2251('0x9')](_0x2251('0x11'),auth[_0x2251('0xa')](),controller[_0x2251('0x12')]);router[_0x2251('0x9')](_0x2251('0x13'),auth[_0x2251('0xa')](),controller[_0x2251('0x14')]);router[_0x2251('0x15')]('/',auth[_0x2251('0xa')](),controller[_0x2251('0x16')]);router[_0x2251('0x15')](_0x2251('0x11'),auth[_0x2251('0xa')](),controller['addTeams']);router[_0x2251('0x15')](_0x2251('0x13'),auth[_0x2251('0xa')](),controller[_0x2251('0x17')]);router[_0x2251('0x18')]('/:id',auth[_0x2251('0xa')](),controller[_0x2251('0x19')]);router[_0x2251('0x1a')](_0x2251('0xe'),auth[_0x2251('0xa')](),controller[_0x2251('0x1b')]);router[_0x2251('0x1a')](_0x2251('0x11'),auth['isAuthenticated'](),controller[_0x2251('0x1c')]);router['delete'](_0x2251('0x13'),auth[_0x2251('0xa')](),controller[_0x2251('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 248059a..bd54481 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 _0x0ccc=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x325c80,_0x5f0357){var _0x1e13e3=function(_0x4a422a){while(--_0x4a422a){_0x325c80['push'](_0x325c80['shift']());}};_0x1e13e3(++_0x5f0357);}(_0x0ccc,0xcb));var _0xc0cc=function(_0xc0cec0,_0x2aa508){_0xc0cec0=_0xc0cec0-0x0;var _0x46949d=_0x0ccc[_0xc0cec0];return _0x46949d;};'use strict';var Sequelize=require(_0xc0cc('0x0'));module[_0xc0cc('0x1')]={'name':{'type':Sequelize[_0xc0cc('0x2')],'unique':_0xc0cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc0cc('0x2')]},'timeout':{'type':Sequelize[_0xc0cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0cc('0x5')](_0xc0cc('0x6'),_0xc0cc('0x7'),_0xc0cc('0x8'))}}; \ No newline at end of file +var _0x9849=['roundrobin','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x9849,0x151));var _0x9984=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x9849[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require('sequelize');module[_0x9984('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9984('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9984('0x2')]},'timeout':{'type':Sequelize[_0x9984('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9984('0x4')]('rrmemory',_0x9984('0x5'),_0x9984('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e594333..19b24c9 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 _0x90e0=['interface','flatMap','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','MailQueues','destroy','sendStatus','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','catch','show','params','keys','filters','intersection','model','fields','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','order','sort','pick','where','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','ids','Agents','online'];(function(_0x8e59c6,_0x4da425){var _0x5e645a=function(_0x1b450b){while(--_0x1b450b){_0x8e59c6['push'](_0x8e59c6['shift']());}};_0x5e645a(++_0x4da425);}(_0x90e0,0xa0));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x090e('0x0'));var util=require(_0x090e('0x1'));var _=require('lodash');var squel=require(_0x090e('0x2'));var Redis=require(_0x090e('0x3'));var qs=require(_0x090e('0x4'));var logger=require(_0x090e('0x5'))(_0x090e('0x6'));var config=require(_0x090e('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x090e('0x8')](config['redis'],{'host':_0x090e('0x9'),'port':0x18eb});var socket=require(_0x090e('0xa'))(new Redis(config['redis']));require(_0x090e('0xb'))['register'](socket);function respondWithStatusCode(_0x51ddb1,_0x4105ea){_0x4105ea=_0x4105ea||0xcc;return function(_0xf8130e){if(_0xf8130e){return _0x51ddb1['sendStatus'](_0x4105ea);}return _0x51ddb1[_0x090e('0xc')](_0x4105ea)[_0x090e('0xd')]();};}function respondWithResult(_0x292660,_0x42b3a6){_0x42b3a6=_0x42b3a6||0xc8;return function(_0x3c4081){if(_0x3c4081){return _0x292660['status'](_0x42b3a6)[_0x090e('0xe')](_0x3c4081);}};}function respondWithFilteredResult(_0x48ffb2,_0xe890ca){return function(_0x3f7468){if(_0x3f7468){var _0x5f5a3b=typeof _0xe890ca[_0x090e('0xf')]===_0x090e('0x10')&&typeof _0xe890ca[_0x090e('0x11')]===_0x090e('0x10');var _0x41efbf=_0x3f7468[_0x090e('0x12')];var _0x39529e=_0x5f5a3b?0x0:_0xe890ca[_0x090e('0xf')];var _0x3e595d=_0x5f5a3b?_0x3f7468[_0x090e('0x12')]:_0xe890ca[_0x090e('0xf')]+_0xe890ca['limit'];var _0x387365;if(_0x3e595d>=_0x41efbf){_0x3e595d=_0x41efbf;_0x387365=0xc8;}else{_0x387365=0xce;}_0x48ffb2['status'](_0x387365);return _0x48ffb2[_0x090e('0x13')](_0x090e('0x14'),_0x39529e+'-'+_0x3e595d+'/'+_0x41efbf)[_0x090e('0xe')](_0x3f7468);}return null;};}function saveUpdates(_0x42332f){return function(_0x46542b){if(_0x46542b){return _0x46542b[_0x090e('0x15')](_0x42332f)['then'](function(_0x2e525f){return _0x2e525f;});}return null;};}function removeEntity(_0x6ce5ca){return function(_0x278c4c){if(_0x278c4c){return _0x278c4c['destroy']()[_0x090e('0x16')](function(){var _0x3983cc=_0x278c4c[_0x090e('0x17')]({'plain':!![]});var _0x436b70=_0x090e('0x18');return db['UserProfileResource'][_0x090e('0x19')]({'where':{'type':_0x436b70,'resourceId':_0x3983cc['id']}})['then'](function(){return _0x278c4c;});})['then'](function(){_0x6ce5ca[_0x090e('0xc')](0xcc)[_0x090e('0xd')]();});}};}function handleEntityNotFound(_0x44433f){return function(_0x1eed65){if(!_0x1eed65){_0x44433f[_0x090e('0x1a')](0x194);}return _0x1eed65;};}function handleError(_0xbc8e6a,_0x3177ec){_0x3177ec=_0x3177ec||0x1f4;return function(_0xb39ced){logger[_0x090e('0x1b')](_0xb39ced[_0x090e('0x1c')]);if(_0xb39ced['name']){delete _0xb39ced[_0x090e('0x1d')];}_0xbc8e6a[_0x090e('0xc')](_0x3177ec)['send'](_0xb39ced);};}exports[_0x090e('0x1e')]=function(_0x177717,_0x529d3a){var _0x5895b6={};var _0x5e2fb0={'count':0x0,'rows':[]};var _0x4fdf13=_[_0x090e('0x1f')](db[_0x090e('0x20')][_0x090e('0x21')],function(_0x957af8){return{'name':_0x957af8[_0x090e('0x22')],'type':_0x957af8[_0x090e('0x23')]['key']};});_0x5895b6=qs[_0x090e('0x24')](_0x4fdf13,_0x177717);var _0x727ea1={'where':_0x5895b6['where']};return db['MailQueue'][_0x090e('0x12')](_0x727ea1)[_0x090e('0x16')](function(_0xa16e6c){_0x5e2fb0[_0x090e('0x12')]=_0xa16e6c;_0x5895b6[_0x090e('0x25')]=qs[_0x090e('0x25')](_0x177717[_0x090e('0x26')]);return db[_0x090e('0x20')][_0x090e('0x27')](_0x5895b6);})[_0x090e('0x16')](function(_0x369a51){_0x5e2fb0['rows']=_0x369a51;return _0x5e2fb0;})[_0x090e('0x16')](respondWithFilteredResult(_0x529d3a,_0x5895b6))[_0x090e('0x28')](handleError(_0x529d3a,null));};exports[_0x090e('0x29')]=function(_0x4e1053,_0x7c55d6){var _0x417b6b={'raw':!![],'where':{'id':_0x4e1053[_0x090e('0x2a')]['id']}},_0xd5b687={};_0xd5b687['model']=_[_0x090e('0x2b')](db[_0x090e('0x20')][_0x090e('0x21')]);_0xd5b687[_0x090e('0x26')]=_[_0x090e('0x2b')](_0x4e1053[_0x090e('0x26')]);_0xd5b687[_0x090e('0x2c')]=_[_0x090e('0x2d')](_0xd5b687[_0x090e('0x2e')],_0xd5b687[_0x090e('0x26')]);_0x417b6b['attributes']=_[_0x090e('0x2d')](_0xd5b687['model'],qs['fields'](_0x4e1053[_0x090e('0x26')][_0x090e('0x2f')]));_0x417b6b['attributes']=_0x417b6b[_0x090e('0x30')]['length']?_0x417b6b[_0x090e('0x30')]:_0xd5b687['model'];if(_0x4e1053['query'][_0x090e('0x31')]){_0x417b6b['include']=[{'all':!![]}];}_0x417b6b=_[_0x090e('0x32')]({},_0x417b6b,_0x4e1053[_0x090e('0x33')]);return db[_0x090e('0x20')][_0x090e('0x34')](_0x417b6b)[_0x090e('0x16')](handleEntityNotFound(_0x7c55d6,null))[_0x090e('0x16')](respondWithResult(_0x7c55d6,null))['catch'](handleError(_0x7c55d6,null));};exports[_0x090e('0x35')]=function(_0x8dcda6,_0x3896d2){return db['MailQueue'][_0x090e('0x35')](_0x8dcda6[_0x090e('0x36')],{})[_0x090e('0x16')](function(_0x51d538){var _0x75ec0a=_0x8dcda6[_0x090e('0x37')]['get']({'plain':!![]});if(!_0x75ec0a)throw new Error(_0x090e('0x38'));if(_0x75ec0a[_0x090e('0x39')]===_0x090e('0x37')){var _0x1347f4=_0x51d538[_0x090e('0x17')]({'plain':!![]});var _0x3fbd0f=_0x090e('0x18');return db[_0x090e('0x3a')]['find']({'where':{'name':_0x3fbd0f,'userProfileId':_0x75ec0a[_0x090e('0x3b')]},'raw':!![]})[_0x090e('0x16')](function(_0x322b33){if(_0x322b33&&_0x322b33[_0x090e('0x3c')]===0x0){return db[_0x090e('0x3d')][_0x090e('0x35')]({'name':_0x1347f4[_0x090e('0x1d')],'resourceId':_0x1347f4['id'],'type':_0x322b33[_0x090e('0x1d')],'sectionId':_0x322b33['id']},{})[_0x090e('0x16')](function(){return _0x51d538;});}else{return _0x51d538;}})[_0x090e('0x28')](function(_0x3045f6){logger[_0x090e('0x1b')](_0x090e('0x3e'),_0x3045f6);throw _0x3045f6;});}return _0x51d538;})[_0x090e('0x16')](respondWithResult(_0x3896d2,0xc9))[_0x090e('0x28')](handleError(_0x3896d2,null));};exports[_0x090e('0x15')]=function(_0x1e6689,_0x1d1f2a){if(_0x1e6689[_0x090e('0x36')]['id']){delete _0x1e6689[_0x090e('0x36')]['id'];}return db[_0x090e('0x20')][_0x090e('0x34')]({'where':{'id':_0x1e6689[_0x090e('0x2a')]['id']}})[_0x090e('0x16')](handleEntityNotFound(_0x1d1f2a,null))[_0x090e('0x16')](saveUpdates(_0x1e6689[_0x090e('0x36')],null))[_0x090e('0x16')](respondWithResult(_0x1d1f2a,null))[_0x090e('0x28')](handleError(_0x1d1f2a,null));};exports[_0x090e('0x19')]=function(_0x267110,_0x2771b4){return db[_0x090e('0x20')]['find']({'where':{'id':_0x267110[_0x090e('0x2a')]['id']}})[_0x090e('0x16')](handleEntityNotFound(_0x2771b4,null))[_0x090e('0x16')](removeEntity(_0x2771b4,null))[_0x090e('0x28')](handleError(_0x2771b4,null));};exports[_0x090e('0x3f')]=function(_0x5c94cf,_0x1a3c26){return db[_0x090e('0x20')][_0x090e('0x3f')]()['then'](respondWithResult(_0x1a3c26,null))['catch'](handleError(_0x1a3c26,null));};exports[_0x090e('0x40')]=function(_0x15275f,_0x3ab9f0){var _0xb940e2={'raw':!![],'where':{}},_0x3b8377={},_0x3d7735;return db[_0x090e('0x20')][_0x090e('0x41')]({'where':{'id':_0x15275f[_0x090e('0x2a')]['id']}})[_0x090e('0x16')](handleEntityNotFound(_0x3ab9f0,null))[_0x090e('0x16')](function(_0x3a3ef2){if(_0x3a3ef2){_0x3d7735=_0x3a3ef2[_0x090e('0x17')]({'plain':!![]});_0x3b8377[_0x090e('0x2e')]=_['keys'](db[_0x090e('0x42')][_0x090e('0x21')]);_0x3b8377[_0x090e('0x26')]=_['keys'](_0x15275f[_0x090e('0x26')]);_0x3b8377[_0x090e('0x2c')]=_[_0x090e('0x2d')](_0x3b8377[_0x090e('0x2e')],_0x3b8377[_0x090e('0x26')]);_0xb940e2['attributes']=_['intersection'](_0x3b8377[_0x090e('0x2e')],qs[_0x090e('0x2f')](_0x15275f[_0x090e('0x26')][_0x090e('0x2f')]));_0xb940e2['attributes']=_0xb940e2[_0x090e('0x30')][_0x090e('0x43')]?_0xb940e2[_0x090e('0x30')]:_0x3b8377[_0x090e('0x2e')];if(!_0x15275f[_0x090e('0x26')][_0x090e('0x44')]('nolimit')){_0xb940e2[_0x090e('0x11')]=qs[_0x090e('0x11')](_0x15275f[_0x090e('0x26')][_0x090e('0x11')]);_0xb940e2['offset']=qs[_0x090e('0xf')](_0x15275f[_0x090e('0x26')][_0x090e('0xf')]);}_0xb940e2[_0x090e('0x45')]=qs[_0x090e('0x46')](_0x15275f['query'][_0x090e('0x46')]);_0xb940e2['where']=qs[_0x090e('0x2c')](_[_0x090e('0x47')](_0x15275f['query'],_0x3b8377['filters']));_0xb940e2[_0x090e('0x48')][_0x090e('0x49')]=_0x3a3ef2['id'];if(_0x15275f[_0x090e('0x26')][_0x090e('0x4a')]){_0xb940e2['where']=_['merge'](_0xb940e2[_0x090e('0x48')],{'$or':_[_0x090e('0x1f')](_0xb940e2[_0x090e('0x30')],function(_0x108f98){var _0x4b9f9f={};_0x4b9f9f[_0x108f98]={'$like':'%'+_0x15275f[_0x090e('0x26')]['filter']+'%'};return _0x4b9f9f;})});}_0xb940e2=_[_0x090e('0x32')]({},_0xb940e2,_0x15275f[_0x090e('0x33')]);return db['UserMailQueue']['findAll'](_0xb940e2);}})[_0x090e('0x16')](function(_0x22bf4b){if(_0x22bf4b){return db[_0x090e('0x4b')][_0x090e('0x4c')]({'where':{'id':_[_0x090e('0x1f')](_0x22bf4b,_0x090e('0x4d')),'role':_0x090e('0x4e')},'attributes':['id',_0x090e('0x1d'),_0x090e('0x4f'),_0x090e('0x50'),'createdAt']});}})[_0x090e('0x16')](function(_0x3b88c9){if(_0x3b88c9){return{'count':_0x3b88c9['count'],'rows':_[_0x090e('0x1f')](_0x3b88c9[_0x090e('0x51')],function(_0x1d825e){return{'membername':_0x1d825e[_0x090e('0x1d')],'UserId':_0x1d825e['id'],'queue_name':_0x3d7735[_0x090e('0x1d')],'MailQueueId':_0x3d7735['id'],'interface':util[_0x090e('0x52')](_0x090e('0x53'),'SIP',_0x1d825e[_0x090e('0x1d')]),'penalty':0x0,'paused':_0x1d825e['mailPause'],'createdAt':_0x1d825e[_0x090e('0x54')],'updatedAt':_0x1d825e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x090e('0x16')](respondWithFilteredResult(_0x3ab9f0,_0xb940e2))[_0x090e('0x28')](handleError(_0x3ab9f0,null));};exports[_0x090e('0x55')]=function(_0x17d274,_0x53c5f7){var _0x17e5a7={};var _0x694615={};var _0x2fc64b;var _0x20030d;return db[_0x090e('0x20')][_0x090e('0x41')]({'where':{'id':_0x17d274['params']['id']}})['then'](handleEntityNotFound(_0x53c5f7,null))[_0x090e('0x16')](function(_0x30ab2e){if(_0x30ab2e){_0x2fc64b=_0x30ab2e;_0x694615[_0x090e('0x2e')]=_['keys'](db[_0x090e('0x56')][_0x090e('0x21')]);_0x694615[_0x090e('0x26')]=_[_0x090e('0x2b')](_0x17d274[_0x090e('0x26')]);_0x694615[_0x090e('0x2c')]=_[_0x090e('0x2d')](_0x694615['model'],_0x694615['query']);_0x17e5a7[_0x090e('0x30')]=_[_0x090e('0x2d')](_0x694615[_0x090e('0x2e')],qs[_0x090e('0x2f')](_0x17d274[_0x090e('0x26')]['fields']));_0x17e5a7[_0x090e('0x30')]=_0x17e5a7[_0x090e('0x30')]['length']?_0x17e5a7['attributes']:_0x694615[_0x090e('0x2e')];_0x17e5a7[_0x090e('0x45')]=qs[_0x090e('0x46')](_0x17d274['query'][_0x090e('0x46')]);_0x17e5a7[_0x090e('0x48')]=qs['filters'](_[_0x090e('0x47')](_0x17d274[_0x090e('0x26')],_0x694615[_0x090e('0x2c')]));if(_0x17d274[_0x090e('0x26')][_0x090e('0x4a')]){_0x17e5a7[_0x090e('0x48')]=_['merge'](_0x17e5a7[_0x090e('0x48')],{'$or':_[_0x090e('0x1f')](_0x17e5a7[_0x090e('0x30')],function(_0x29e37b){var _0xb554e1={};_0xb554e1[_0x29e37b]={'$like':'%'+_0x17d274['query'][_0x090e('0x4a')]+'%'};return _0xb554e1;})});}_0x17e5a7=_[_0x090e('0x32')]({},_0x17e5a7,_0x17d274[_0x090e('0x33')]);return _0x2fc64b['getTeams'](_0x17e5a7);}})['then'](function(_0x279f81){if(_0x279f81){_0x20030d=_0x279f81['length'];if(!_0x17d274[_0x090e('0x26')][_0x090e('0x44')](_0x090e('0x57'))){_0x17e5a7['limit']=qs[_0x090e('0x11')](_0x17d274[_0x090e('0x26')][_0x090e('0x11')]);_0x17e5a7[_0x090e('0xf')]=qs[_0x090e('0xf')](_0x17d274[_0x090e('0x26')][_0x090e('0xf')]);}return _0x2fc64b[_0x090e('0x55')](_0x17e5a7);}})[_0x090e('0x16')](function(_0x264d0c){if(_0x264d0c){return _0x264d0c?{'count':_0x20030d,'rows':_0x264d0c}:null;}})[_0x090e('0x16')](respondWithResult(_0x53c5f7,null))['catch'](handleError(_0x53c5f7,null));};exports[_0x090e('0x58')]=function(_0x127726,_0xd2c995){var _0x556929=_0x127726['body'][_0x090e('0x59')];return db[_0x090e('0x56')][_0x090e('0x27')]({'where':{'id':_0x556929},'attributes':['id'],'include':[{'model':db[_0x090e('0x4b')],'as':_0x090e('0x5a'),'attributes':['id',_0x090e('0x1d'),_0x090e('0x5b'),'voicePause',_0x090e('0x5c')],'raw':!![]}]})['then'](function(_0x2ce1fc){if(_0x2ce1fc){var _0x58fd75=_[_0x090e('0x5d')](_0x2ce1fc,function(_0x2be04c){var _0x23690b=_0x2be04c['get']({'plain':!![]});return _0x23690b[_0x090e('0x5a')];});return db['MailQueue'][_0x090e('0x34')]({'where':{'id':_0x127726['params']['id']}})[_0x090e('0x16')](function(_0x4cdea1){return db['sequelize'][_0x090e('0x5e')](function(_0xab04be){return _0x4cdea1[_0x090e('0x58')](_0x556929,{'transaction':_0xab04be})[_0x090e('0x16')](function(){return BPromise[_0x090e('0x5f')](_0x58fd75,function(_0x4c1dae){return db[_0x090e('0x42')][_0x090e('0x60')]({'where':{'UserId':_0x4c1dae['id'],'MailQueueId':_0x127726[_0x090e('0x2a')]['id']},'transaction':_0xab04be});});})[_0x090e('0x16')](function(){_0x58fd75['forEach'](function(_0x6c97a3){socket[_0x090e('0x61')](_0x090e('0x62'),{'UserId':_0x6c97a3['id'],'MailQueueId':_0x4cdea1['id']});});});});});}})[_0x090e('0x16')](respondWithStatusCode(_0xd2c995,null))['catch'](handleError(_0xd2c995,null));};exports[_0x090e('0x63')]=function(_0x2e5b7b,_0x3b32fb){return db['Team'][_0x090e('0x27')]({'where':{'id':_0x2e5b7b[_0x090e('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x090e('0x4b')],'as':_0x090e('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3b32fb,null))['then'](function(_0xf03883){var _0x172aab=_['map'](_0xf03883,'id');var _0x2fec40=[];var _0x322f37=[];var _0x23b7a3=squel[_0x090e('0x64')]();_0x23b7a3[_0x090e('0x65')]('tq.TeamId')['from'](_0x090e('0x66'),'tq')['join'](_0x090e('0x67'),'ut',_0x090e('0x68'))[_0x090e('0x48')](_0x090e('0x69'),_0x2e5b7b['params']['id']);for(var _0x4c6425=0x0;_0x4c6425<_0xf03883[_0x090e('0x43')];_0x4c6425+=0x1){let _0x443d53=_0xf03883[_0x4c6425];for(var _0x259501=0x0;_0x259501<_0x443d53[_0x090e('0x5a')][_0x090e('0x43')];_0x259501+=0x1){let _0x1ed637=_0x443d53[_0x090e('0x5a')][_0x259501];var _0x2ed89d=_0x23b7a3[_0x090e('0x6a')]();_0x2ed89d[_0x090e('0x48')](_0x090e('0x6b'),_0x1ed637['id']);_0x322f37[_0x090e('0x6c')](db[_0x090e('0x6d')][_0x090e('0x26')](_0x2ed89d[_0x090e('0x6e')](),{'type':db[_0x090e('0x6d')][_0x090e('0x6f')][_0x090e('0x70')]})[_0x090e('0x16')](function(_0x7b5f57){if(_0x7b5f57[_0x090e('0x43')]===0x1){return _0x1ed637['id'];}else{var _0xdeaf=_[_0x090e('0x71')](_[_0x090e('0x1f')](_0x7b5f57,'TeamId'),function(_0x16493d){return _[_0x090e('0x72')](_0x172aab,_0x16493d);});if(_0xdeaf){return _0x1ed637['id'];}}}));}}return BPromise['all'](_0x322f37)['then'](function(_0x41e29f){_0x2fec40=_(_0x2fec40)['union'](_0x41e29f)[_0x090e('0x73')]()[_0x090e('0x74')]();return db[_0x090e('0x20')][_0x090e('0x34')]({'where':{'id':_0x2e5b7b['params']['id']}})[_0x090e('0x16')](function(_0x1ac79f){return db[_0x090e('0x6d')][_0x090e('0x5e')](function(_0x499996){return _0x1ac79f[_0x090e('0x63')](_0x2e5b7b[_0x090e('0x26')]['ids'],{'transaction':_0x499996})[_0x090e('0x16')](function(){if(!_[_0x090e('0x75')](_0x2fec40)){return _0x1ac79f[_0x090e('0x76')](_0x2fec40,{'transaction':_0x499996});}})[_0x090e('0x16')](function(){_0x2fec40[_0x090e('0x77')](function(_0x28b3fe){socket[_0x090e('0x61')](_0x090e('0x78'),{'UserId':_0x28b3fe,'MailQueueId':_0x1ac79f['id']});});});});});});})[_0x090e('0x16')](respondWithStatusCode(_0x3b32fb,null))[_0x090e('0x28')](handleError(_0x3b32fb,null));};exports[_0x090e('0x79')]=function(_0x35e0d9,_0x4cf2bb){return db[_0x090e('0x20')][_0x090e('0x34')]({'where':{'id':_0x35e0d9[_0x090e('0x2a')]['id']}})[_0x090e('0x16')](handleEntityNotFound(_0x4cf2bb,null))[_0x090e('0x16')](function(_0x1cb9ad){if(_0x1cb9ad){return _0x1cb9ad[_0x090e('0x79')](_0x35e0d9[_0x090e('0x36')][_0x090e('0x59')],_[_0x090e('0x7a')](_0x35e0d9['body'],[_0x090e('0x59'),'id'])||{})[_0x090e('0x7b')](function(_0x11ba57){for(var _0x4c21ad=0x0;_0x4c21ad<_0x35e0d9[_0x090e('0x36')][_0x090e('0x59')][_0x090e('0x43')];_0x4c21ad+=0x1){socket[_0x090e('0x61')](_0x090e('0x62'),{'UserId':Number(_0x35e0d9[_0x090e('0x36')][_0x090e('0x59')][_0x4c21ad]),'MailQueueId':Number(_0x35e0d9[_0x090e('0x2a')]['id'])});}return _0x11ba57;});}})['then'](respondWithResult(_0x4cf2bb,null))[_0x090e('0x28')](handleError(_0x4cf2bb,null));};exports[_0x090e('0x76')]=function(_0xa459ac,_0x34ca71){return db[_0x090e('0x20')][_0x090e('0x34')]({'where':{'id':_0xa459ac['params']['id']}})[_0x090e('0x16')](handleEntityNotFound(_0x34ca71,null))[_0x090e('0x16')](function(_0xe7921a){if(_0xe7921a){return _0xe7921a[_0x090e('0x76')](_0xa459ac[_0x090e('0x26')]['ids'])[_0x090e('0x16')](function(){if(_[_0x090e('0x7c')](_0xa459ac[_0x090e('0x26')]['ids'])){for(var _0x24ea7a=0x0;_0x24ea7a<_0xa459ac[_0x090e('0x26')][_0x090e('0x59')][_0x090e('0x43')];_0x24ea7a+=0x1){socket[_0x090e('0x61')]('userMailQueue:remove',{'UserId':Number(_0xa459ac[_0x090e('0x26')][_0x090e('0x59')][_0x24ea7a]),'MailQueueId':Number(_0xa459ac[_0x090e('0x2a')]['id'])});}}else{socket[_0x090e('0x61')]('userMailQueue:remove',{'UserId':Number(_0xa459ac[_0x090e('0x26')]['ids']),'MailQueueId':Number(_0xa459ac[_0x090e('0x2a')]['id'])});}});}})[_0x090e('0x16')](respondWithStatusCode(_0x34ca71,null))[_0x090e('0x28')](handleError(_0x34ca71,null));};exports[_0x090e('0x7d')]=function(_0x5cb044,_0x48d0f4){var _0x426f19={};var _0x1986a5={};var _0x4c3b4c;var _0x25bc9c;return db[_0x090e('0x20')][_0x090e('0x41')]({'where':{'id':_0x5cb044[_0x090e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48d0f4,null))[_0x090e('0x16')](function(_0x1e3fcf){if(_0x1e3fcf){_0x4c3b4c=_0x1e3fcf;_0x1986a5[_0x090e('0x2e')]=_[_0x090e('0x2b')](db['User']['rawAttributes']);_0x1986a5[_0x090e('0x26')]=_[_0x090e('0x2b')](_0x5cb044['query']);_0x1986a5[_0x090e('0x2c')]=_[_0x090e('0x2d')](_0x1986a5[_0x090e('0x2e')],_0x1986a5[_0x090e('0x26')]);_0x426f19['attributes']=_['intersection'](_0x1986a5[_0x090e('0x2e')],qs['fields'](_0x5cb044[_0x090e('0x26')]['fields']));_0x426f19[_0x090e('0x30')]=_0x426f19['attributes']['length']?_0x426f19[_0x090e('0x30')]:_0x1986a5[_0x090e('0x2e')];_0x426f19[_0x090e('0x45')]=qs[_0x090e('0x46')](_0x5cb044[_0x090e('0x26')]['sort']);_0x426f19[_0x090e('0x48')]=qs[_0x090e('0x2c')](_[_0x090e('0x47')](_0x5cb044[_0x090e('0x26')],_0x1986a5['filters']));if(_0x5cb044[_0x090e('0x26')]['filter']){_0x426f19['where']=_[_0x090e('0x32')](_0x426f19[_0x090e('0x48')],{'$or':_['map'](_0x426f19[_0x090e('0x30')],function(_0x226bdd){var _0x25c2a1={};_0x25c2a1[_0x226bdd]={'$like':'%'+_0x5cb044[_0x090e('0x26')][_0x090e('0x4a')]+'%'};return _0x25c2a1;})});}_0x426f19=_[_0x090e('0x32')]({},_0x426f19,_0x5cb044[_0x090e('0x33')]);return _0x4c3b4c[_0x090e('0x7d')](_0x426f19);}})[_0x090e('0x16')](function(_0x56db18){if(_0x56db18){_0x25bc9c=_0x56db18['length'];if(!_0x5cb044[_0x090e('0x26')]['hasOwnProperty'](_0x090e('0x57'))){_0x426f19[_0x090e('0x11')]=qs[_0x090e('0x11')](_0x5cb044[_0x090e('0x26')][_0x090e('0x11')]);_0x426f19[_0x090e('0xf')]=qs[_0x090e('0xf')](_0x5cb044[_0x090e('0x26')][_0x090e('0xf')]);}return _0x4c3b4c[_0x090e('0x7d')](_0x426f19);}})[_0x090e('0x16')](function(_0x19d54f){if(_0x19d54f){return _0x19d54f?{'count':_0x25bc9c,'rows':_0x19d54f}:null;}})[_0x090e('0x16')](respondWithResult(_0x48d0f4,null))[_0x090e('0x28')](handleError(_0x48d0f4,null));}; \ No newline at end of file +var _0x0fde=['pick','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','error','name','send','index','map','MailQueue','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','User','findAndCountAll','UserId','agent','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','Team','addTeams','ids','online','interface','flatMap','sequelize','each','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents'];(function(_0x2d0716,_0x2b1a42){var _0x2567e2=function(_0x3a421e){while(--_0x3a421e){_0x2d0716['push'](_0x2d0716['shift']());}};_0x2567e2(++_0x2b1a42);}(_0x0fde,0x78));var _0xe0fd=function(_0x2688bb,_0x2ebb9c){_0x2688bb=_0x2688bb-0x0;var _0x417ae8=_0x0fde[_0x2688bb];return _0x417ae8;};'use strict';var BPromise=require(_0xe0fd('0x0'));var util=require(_0xe0fd('0x1'));var _=require(_0xe0fd('0x2'));var squel=require(_0xe0fd('0x3'));var Redis=require('ioredis');var qs=require(_0xe0fd('0x4'));var logger=require(_0xe0fd('0x5'))('api');var config=require(_0xe0fd('0x6'));var db=require(_0xe0fd('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe0fd('0x8'))(new Redis(config[_0xe0fd('0x9')]));require(_0xe0fd('0xa'))[_0xe0fd('0xb')](socket);function respondWithStatusCode(_0x1726b9,_0x147989){_0x147989=_0x147989||0xcc;return function(_0x104d07){if(_0x104d07){return _0x1726b9[_0xe0fd('0xc')](_0x147989);}return _0x1726b9['status'](_0x147989)['end']();};}function respondWithResult(_0xbac418,_0x444c68){_0x444c68=_0x444c68||0xc8;return function(_0x16afa0){if(_0x16afa0){return _0xbac418[_0xe0fd('0xd')](_0x444c68)[_0xe0fd('0xe')](_0x16afa0);}};}function respondWithFilteredResult(_0x5b83d5,_0xa87b13){return function(_0x2f8c3f){if(_0x2f8c3f){var _0x5588fb=typeof _0xa87b13['offset']===_0xe0fd('0xf')&&typeof _0xa87b13[_0xe0fd('0x10')]==='undefined';var _0x1c109e=_0x2f8c3f[_0xe0fd('0x11')];var _0x91b4d7=_0x5588fb?0x0:_0xa87b13[_0xe0fd('0x12')];var _0x307e05=_0x5588fb?_0x2f8c3f[_0xe0fd('0x11')]:_0xa87b13['offset']+_0xa87b13[_0xe0fd('0x10')];var _0xcd20a8;if(_0x307e05>=_0x1c109e){_0x307e05=_0x1c109e;_0xcd20a8=0xc8;}else{_0xcd20a8=0xce;}_0x5b83d5[_0xe0fd('0xd')](_0xcd20a8);return _0x5b83d5[_0xe0fd('0x13')](_0xe0fd('0x14'),_0x91b4d7+'-'+_0x307e05+'/'+_0x1c109e)[_0xe0fd('0xe')](_0x2f8c3f);}return null;};}function saveUpdates(_0x2b3374){return function(_0xc57379){if(_0xc57379){return _0xc57379['update'](_0x2b3374)[_0xe0fd('0x15')](function(_0x1797dc){return _0x1797dc;});}return null;};}function removeEntity(_0x25f0d9){return function(_0x2d3f2d){if(_0x2d3f2d){return _0x2d3f2d[_0xe0fd('0x16')]()[_0xe0fd('0x15')](function(){var _0xdeb2e1=_0x2d3f2d[_0xe0fd('0x17')]({'plain':!![]});var _0x503055='MailQueues';return db['UserProfileResource'][_0xe0fd('0x16')]({'where':{'type':_0x503055,'resourceId':_0xdeb2e1['id']}})[_0xe0fd('0x15')](function(){return _0x2d3f2d;});})[_0xe0fd('0x15')](function(){_0x25f0d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x434524){return function(_0x167897){if(!_0x167897){_0x434524['sendStatus'](0x194);}return _0x167897;};}function handleError(_0x42ff3b,_0x352bdc){_0x352bdc=_0x352bdc||0x1f4;return function(_0x3976b9){logger[_0xe0fd('0x18')](_0x3976b9['stack']);if(_0x3976b9[_0xe0fd('0x19')]){delete _0x3976b9[_0xe0fd('0x19')];}_0x42ff3b['status'](_0x352bdc)[_0xe0fd('0x1a')](_0x3976b9);};}exports[_0xe0fd('0x1b')]=function(_0x1c9755,_0x1da6c3){var _0x88e0f0={};var _0x16ceca={'count':0x0,'rows':[]};var _0x529d13=_[_0xe0fd('0x1c')](db[_0xe0fd('0x1d')]['rawAttributes'],function(_0x464b06){return{'name':_0x464b06['fieldName'],'type':_0x464b06['type'][_0xe0fd('0x1e')]};});_0x88e0f0=qs[_0xe0fd('0x1f')](_0x529d13,_0x1c9755);var _0x4e5445={'where':_0x88e0f0[_0xe0fd('0x20')]};return db['MailQueue'][_0xe0fd('0x11')](_0x4e5445)[_0xe0fd('0x15')](function(_0x45948e){_0x16ceca[_0xe0fd('0x11')]=_0x45948e;_0x88e0f0[_0xe0fd('0x21')]=qs['include'](_0x1c9755[_0xe0fd('0x22')]);return db['MailQueue'][_0xe0fd('0x23')](_0x88e0f0);})[_0xe0fd('0x15')](function(_0x122be0){_0x16ceca[_0xe0fd('0x24')]=_0x122be0;return _0x16ceca;})[_0xe0fd('0x15')](respondWithFilteredResult(_0x1da6c3,_0x88e0f0))[_0xe0fd('0x25')](handleError(_0x1da6c3,null));};exports['show']=function(_0x165999,_0x14fc45){var _0x2b2d65={'raw':!![],'where':{'id':_0x165999[_0xe0fd('0x26')]['id']}},_0x283257={};_0x283257[_0xe0fd('0x27')]=_[_0xe0fd('0x28')](db[_0xe0fd('0x1d')][_0xe0fd('0x29')]);_0x283257['query']=_[_0xe0fd('0x28')](_0x165999['query']);_0x283257[_0xe0fd('0x2a')]=_[_0xe0fd('0x2b')](_0x283257[_0xe0fd('0x27')],_0x283257['query']);_0x2b2d65['attributes']=_[_0xe0fd('0x2b')](_0x283257[_0xe0fd('0x27')],qs[_0xe0fd('0x2c')](_0x165999[_0xe0fd('0x22')][_0xe0fd('0x2c')]));_0x2b2d65[_0xe0fd('0x2d')]=_0x2b2d65['attributes'][_0xe0fd('0x2e')]?_0x2b2d65[_0xe0fd('0x2d')]:_0x283257[_0xe0fd('0x27')];if(_0x165999['query'][_0xe0fd('0x2f')]){_0x2b2d65[_0xe0fd('0x21')]=[{'all':!![]}];}_0x2b2d65=_[_0xe0fd('0x30')]({},_0x2b2d65,_0x165999[_0xe0fd('0x31')]);return db[_0xe0fd('0x1d')][_0xe0fd('0x32')](_0x2b2d65)['then'](handleEntityNotFound(_0x14fc45,null))['then'](respondWithResult(_0x14fc45,null))[_0xe0fd('0x25')](handleError(_0x14fc45,null));};exports[_0xe0fd('0x33')]=function(_0x1713d7,_0x5511b7){return db[_0xe0fd('0x1d')][_0xe0fd('0x33')](_0x1713d7[_0xe0fd('0x34')],{})[_0xe0fd('0x15')](function(_0x237626){var _0x127fbb=_0x1713d7[_0xe0fd('0x35')][_0xe0fd('0x17')]({'plain':!![]});if(!_0x127fbb)throw new Error(_0xe0fd('0x36'));if(_0x127fbb[_0xe0fd('0x37')]==='user'){var _0x17fb5d=_0x237626[_0xe0fd('0x17')]({'plain':!![]});var _0x4e594f=_0xe0fd('0x38');return db[_0xe0fd('0x39')][_0xe0fd('0x32')]({'where':{'name':_0x4e594f,'userProfileId':_0x127fbb['userProfileId']},'raw':!![]})[_0xe0fd('0x15')](function(_0x4fff91){if(_0x4fff91&&_0x4fff91[_0xe0fd('0x3a')]===0x0){return db[_0xe0fd('0x3b')][_0xe0fd('0x33')]({'name':_0x17fb5d['name'],'resourceId':_0x17fb5d['id'],'type':_0x4fff91[_0xe0fd('0x19')],'sectionId':_0x4fff91['id']},{})[_0xe0fd('0x15')](function(){return _0x237626;});}else{return _0x237626;}})[_0xe0fd('0x25')](function(_0x5d1179){logger[_0xe0fd('0x18')](_0xe0fd('0x3c'),_0x5d1179);throw _0x5d1179;});}return _0x237626;})[_0xe0fd('0x15')](respondWithResult(_0x5511b7,0xc9))[_0xe0fd('0x25')](handleError(_0x5511b7,null));};exports[_0xe0fd('0x3d')]=function(_0x38d764,_0x3f628d){if(_0x38d764[_0xe0fd('0x34')]['id']){delete _0x38d764[_0xe0fd('0x34')]['id'];}return db[_0xe0fd('0x1d')]['find']({'where':{'id':_0x38d764[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](handleEntityNotFound(_0x3f628d,null))['then'](saveUpdates(_0x38d764['body'],null))[_0xe0fd('0x15')](respondWithResult(_0x3f628d,null))[_0xe0fd('0x25')](handleError(_0x3f628d,null));};exports[_0xe0fd('0x16')]=function(_0x4e51d0,_0x5102ef){return db['MailQueue']['find']({'where':{'id':_0x4e51d0[_0xe0fd('0x26')]['id']}})['then'](handleEntityNotFound(_0x5102ef,null))[_0xe0fd('0x15')](removeEntity(_0x5102ef,null))['catch'](handleError(_0x5102ef,null));};exports[_0xe0fd('0x3e')]=function(_0x2c0558,_0x3b3204){return db[_0xe0fd('0x1d')]['describe']()['then'](respondWithResult(_0x3b3204,null))[_0xe0fd('0x25')](handleError(_0x3b3204,null));};exports[_0xe0fd('0x3f')]=function(_0x594aa3,_0x22af25){var _0x124e7f={'raw':!![],'where':{}},_0x196503={},_0x519d78;return db['MailQueue'][_0xe0fd('0x40')]({'where':{'id':_0x594aa3[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](handleEntityNotFound(_0x22af25,null))['then'](function(_0x35df18){if(_0x35df18){_0x519d78=_0x35df18[_0xe0fd('0x17')]({'plain':!![]});_0x196503[_0xe0fd('0x27')]=_['keys'](db[_0xe0fd('0x41')][_0xe0fd('0x29')]);_0x196503['query']=_['keys'](_0x594aa3[_0xe0fd('0x22')]);_0x196503[_0xe0fd('0x2a')]=_[_0xe0fd('0x2b')](_0x196503['model'],_0x196503[_0xe0fd('0x22')]);_0x124e7f[_0xe0fd('0x2d')]=_['intersection'](_0x196503['model'],qs[_0xe0fd('0x2c')](_0x594aa3[_0xe0fd('0x22')][_0xe0fd('0x2c')]));_0x124e7f[_0xe0fd('0x2d')]=_0x124e7f['attributes'][_0xe0fd('0x2e')]?_0x124e7f[_0xe0fd('0x2d')]:_0x196503[_0xe0fd('0x27')];if(!_0x594aa3[_0xe0fd('0x22')][_0xe0fd('0x42')](_0xe0fd('0x43'))){_0x124e7f[_0xe0fd('0x10')]=qs['limit'](_0x594aa3['query'][_0xe0fd('0x10')]);_0x124e7f['offset']=qs['offset'](_0x594aa3[_0xe0fd('0x22')]['offset']);}_0x124e7f[_0xe0fd('0x44')]=qs[_0xe0fd('0x45')](_0x594aa3[_0xe0fd('0x22')][_0xe0fd('0x45')]);_0x124e7f[_0xe0fd('0x20')]=qs['filters'](_['pick'](_0x594aa3[_0xe0fd('0x22')],_0x196503[_0xe0fd('0x2a')]));_0x124e7f['where'][_0xe0fd('0x46')]=_0x35df18['id'];if(_0x594aa3[_0xe0fd('0x22')][_0xe0fd('0x47')]){_0x124e7f[_0xe0fd('0x20')]=_[_0xe0fd('0x30')](_0x124e7f[_0xe0fd('0x20')],{'$or':_[_0xe0fd('0x1c')](_0x124e7f[_0xe0fd('0x2d')],function(_0x1e6627){var _0x570b2a={};_0x570b2a[_0x1e6627]={'$like':'%'+_0x594aa3[_0xe0fd('0x22')][_0xe0fd('0x47')]+'%'};return _0x570b2a;})});}_0x124e7f=_[_0xe0fd('0x30')]({},_0x124e7f,_0x594aa3[_0xe0fd('0x31')]);return db[_0xe0fd('0x41')][_0xe0fd('0x23')](_0x124e7f);}})[_0xe0fd('0x15')](function(_0x12d918){if(_0x12d918){return db[_0xe0fd('0x48')][_0xe0fd('0x49')]({'where':{'id':_[_0xe0fd('0x1c')](_0x12d918,_0xe0fd('0x4a')),'role':_0xe0fd('0x4b')},'attributes':['id','name','mailPause','updatedAt',_0xe0fd('0x4c')]});}})[_0xe0fd('0x15')](function(_0x3bad3f){if(_0x3bad3f){return{'count':_0x3bad3f[_0xe0fd('0x11')],'rows':_[_0xe0fd('0x1c')](_0x3bad3f[_0xe0fd('0x24')],function(_0x530fd4){return{'membername':_0x530fd4[_0xe0fd('0x19')],'UserId':_0x530fd4['id'],'queue_name':_0x519d78[_0xe0fd('0x19')],'MailQueueId':_0x519d78['id'],'interface':util['format'](_0xe0fd('0x4d'),_0xe0fd('0x4e'),_0x530fd4['name']),'penalty':0x0,'paused':_0x530fd4[_0xe0fd('0x4f')],'createdAt':_0x530fd4[_0xe0fd('0x4c')],'updatedAt':_0x530fd4[_0xe0fd('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0fd('0x15')](respondWithFilteredResult(_0x22af25,_0x124e7f))[_0xe0fd('0x25')](handleError(_0x22af25,null));};exports[_0xe0fd('0x51')]=function(_0x201256,_0x5bf4b4){var _0x58504c={};var _0x41486b={};var _0x56993e;var _0x2cd73f;return db[_0xe0fd('0x1d')]['findOne']({'where':{'id':_0x201256['params']['id']}})['then'](handleEntityNotFound(_0x5bf4b4,null))[_0xe0fd('0x15')](function(_0x3ef11a){if(_0x3ef11a){_0x56993e=_0x3ef11a;_0x41486b[_0xe0fd('0x27')]=_['keys'](db[_0xe0fd('0x52')][_0xe0fd('0x29')]);_0x41486b[_0xe0fd('0x22')]=_[_0xe0fd('0x28')](_0x201256[_0xe0fd('0x22')]);_0x41486b[_0xe0fd('0x2a')]=_[_0xe0fd('0x2b')](_0x41486b['model'],_0x41486b['query']);_0x58504c[_0xe0fd('0x2d')]=_[_0xe0fd('0x2b')](_0x41486b[_0xe0fd('0x27')],qs['fields'](_0x201256[_0xe0fd('0x22')][_0xe0fd('0x2c')]));_0x58504c[_0xe0fd('0x2d')]=_0x58504c['attributes'][_0xe0fd('0x2e')]?_0x58504c[_0xe0fd('0x2d')]:_0x41486b[_0xe0fd('0x27')];_0x58504c[_0xe0fd('0x44')]=qs[_0xe0fd('0x45')](_0x201256['query'][_0xe0fd('0x45')]);_0x58504c[_0xe0fd('0x20')]=qs[_0xe0fd('0x2a')](_['pick'](_0x201256[_0xe0fd('0x22')],_0x41486b[_0xe0fd('0x2a')]));if(_0x201256[_0xe0fd('0x22')]['filter']){_0x58504c[_0xe0fd('0x20')]=_[_0xe0fd('0x30')](_0x58504c['where'],{'$or':_['map'](_0x58504c[_0xe0fd('0x2d')],function(_0x52f541){var _0x2d49fe={};_0x2d49fe[_0x52f541]={'$like':'%'+_0x201256[_0xe0fd('0x22')][_0xe0fd('0x47')]+'%'};return _0x2d49fe;})});}_0x58504c=_[_0xe0fd('0x30')]({},_0x58504c,_0x201256[_0xe0fd('0x31')]);return _0x56993e[_0xe0fd('0x51')](_0x58504c);}})[_0xe0fd('0x15')](function(_0x28ba6c){if(_0x28ba6c){_0x2cd73f=_0x28ba6c[_0xe0fd('0x2e')];if(!_0x201256[_0xe0fd('0x22')][_0xe0fd('0x42')](_0xe0fd('0x43'))){_0x58504c[_0xe0fd('0x10')]=qs[_0xe0fd('0x10')](_0x201256[_0xe0fd('0x22')]['limit']);_0x58504c['offset']=qs[_0xe0fd('0x12')](_0x201256[_0xe0fd('0x22')]['offset']);}return _0x56993e['getTeams'](_0x58504c);}})[_0xe0fd('0x15')](function(_0x20871d){if(_0x20871d){return _0x20871d?{'count':_0x2cd73f,'rows':_0x20871d}:null;}})[_0xe0fd('0x15')](respondWithResult(_0x5bf4b4,null))[_0xe0fd('0x25')](handleError(_0x5bf4b4,null));};exports[_0xe0fd('0x53')]=function(_0x149ae4,_0x2f179d){var _0x250edf=_0x149ae4[_0xe0fd('0x34')][_0xe0fd('0x54')];return db[_0xe0fd('0x52')][_0xe0fd('0x23')]({'where':{'id':_0x250edf},'attributes':['id'],'include':[{'model':db[_0xe0fd('0x48')],'as':'Agents','attributes':['id',_0xe0fd('0x19'),_0xe0fd('0x55'),'voicePause',_0xe0fd('0x56')],'raw':!![]}]})[_0xe0fd('0x15')](function(_0xe0ed8d){if(_0xe0ed8d){var _0x5c8006=_[_0xe0fd('0x57')](_0xe0ed8d,function(_0x9013c4){var _0x2d0f17=_0x9013c4[_0xe0fd('0x17')]({'plain':!![]});return _0x2d0f17['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x149ae4[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](function(_0x288a68){return db[_0xe0fd('0x58')]['transaction'](function(_0x34c2da){return _0x288a68[_0xe0fd('0x53')](_0x250edf,{'transaction':_0x34c2da})[_0xe0fd('0x15')](function(){return BPromise[_0xe0fd('0x59')](_0x5c8006,function(_0x2f4195){return db[_0xe0fd('0x41')]['findOrCreate']({'where':{'UserId':_0x2f4195['id'],'MailQueueId':_0x149ae4[_0xe0fd('0x26')]['id']},'transaction':_0x34c2da});});})[_0xe0fd('0x15')](function(){_0x5c8006['forEach'](function(_0x1ceefb){socket[_0xe0fd('0x5a')](_0xe0fd('0x5b'),{'UserId':_0x1ceefb['id'],'MailQueueId':_0x288a68['id']});});});});});}})[_0xe0fd('0x15')](respondWithStatusCode(_0x2f179d,null))[_0xe0fd('0x25')](handleError(_0x2f179d,null));};exports[_0xe0fd('0x5c')]=function(_0x492246,_0x2bcb64){return db['Team'][_0xe0fd('0x23')]({'where':{'id':_0x492246[_0xe0fd('0x22')][_0xe0fd('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0fd('0x15')](handleEntityNotFound(_0x2bcb64,null))[_0xe0fd('0x15')](function(_0x3c0a89){var _0x24fe08=_['map'](_0x3c0a89,'id');var _0x20b701=[];var _0x3fd833=[];var _0x5a7ce3=squel[_0xe0fd('0x5d')]();_0x5a7ce3['field']('tq.TeamId')[_0xe0fd('0x5e')](_0xe0fd('0x5f'),'tq')[_0xe0fd('0x60')](_0xe0fd('0x61'),'ut',_0xe0fd('0x62'))[_0xe0fd('0x20')](_0xe0fd('0x63'),_0x492246['params']['id']);for(var _0x838631=0x0;_0x838631<_0x3c0a89['length'];_0x838631+=0x1){let _0x275253=_0x3c0a89[_0x838631];for(var _0xe82bd4=0x0;_0xe82bd4<_0x275253['Agents'][_0xe0fd('0x2e')];_0xe82bd4+=0x1){let _0x2f5469=_0x275253['Agents'][_0xe82bd4];var _0x3893d2=_0x5a7ce3[_0xe0fd('0x64')]();_0x3893d2[_0xe0fd('0x20')](_0xe0fd('0x65'),_0x2f5469['id']);_0x3fd833['push'](db[_0xe0fd('0x58')][_0xe0fd('0x22')](_0x3893d2[_0xe0fd('0x66')](),{'type':db[_0xe0fd('0x58')][_0xe0fd('0x67')][_0xe0fd('0x68')]})[_0xe0fd('0x15')](function(_0x219c2e){if(_0x219c2e[_0xe0fd('0x2e')]===0x1){return _0x2f5469['id'];}else{var _0x379d92=_['every'](_['map'](_0x219c2e,_0xe0fd('0x69')),function(_0x56bbfd){return _[_0xe0fd('0x6a')](_0x24fe08,_0x56bbfd);});if(_0x379d92){return _0x2f5469['id'];}}}));}}return BPromise['all'](_0x3fd833)[_0xe0fd('0x15')](function(_0x40ed1e){_0x20b701=_(_0x20b701)[_0xe0fd('0x6b')](_0x40ed1e)['compact']()[_0xe0fd('0x6c')]();return db[_0xe0fd('0x1d')]['find']({'where':{'id':_0x492246['params']['id']}})[_0xe0fd('0x15')](function(_0x5e379f){return db['sequelize']['transaction'](function(_0x5cfe4d){return _0x5e379f[_0xe0fd('0x5c')](_0x492246[_0xe0fd('0x22')]['ids'],{'transaction':_0x5cfe4d})[_0xe0fd('0x15')](function(){if(!_[_0xe0fd('0x6d')](_0x20b701)){return _0x5e379f[_0xe0fd('0x6e')](_0x20b701,{'transaction':_0x5cfe4d});}})[_0xe0fd('0x15')](function(){_0x20b701[_0xe0fd('0x6f')](function(_0x29105f){socket[_0xe0fd('0x5a')](_0xe0fd('0x70'),{'UserId':_0x29105f,'MailQueueId':_0x5e379f['id']});});});});});});})[_0xe0fd('0x15')](respondWithStatusCode(_0x2bcb64,null))[_0xe0fd('0x25')](handleError(_0x2bcb64,null));};exports[_0xe0fd('0x71')]=function(_0x270bb2,_0x3809ad){return db['MailQueue'][_0xe0fd('0x32')]({'where':{'id':_0x270bb2[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](handleEntityNotFound(_0x3809ad,null))[_0xe0fd('0x15')](function(_0xd2f4c4){if(_0xd2f4c4){return _0xd2f4c4[_0xe0fd('0x71')](_0x270bb2[_0xe0fd('0x34')]['ids'],_[_0xe0fd('0x72')](_0x270bb2[_0xe0fd('0x34')],[_0xe0fd('0x54'),'id'])||{})[_0xe0fd('0x73')](function(_0x467526){for(var _0x1a9aaf=0x0;_0x1a9aaf<_0x270bb2[_0xe0fd('0x34')][_0xe0fd('0x54')][_0xe0fd('0x2e')];_0x1a9aaf+=0x1){socket[_0xe0fd('0x5a')](_0xe0fd('0x5b'),{'UserId':Number(_0x270bb2[_0xe0fd('0x34')]['ids'][_0x1a9aaf]),'MailQueueId':Number(_0x270bb2['params']['id'])});}return _0x467526;});}})[_0xe0fd('0x15')](respondWithResult(_0x3809ad,null))['catch'](handleError(_0x3809ad,null));};exports[_0xe0fd('0x6e')]=function(_0x450338,_0x53158f){return db[_0xe0fd('0x1d')][_0xe0fd('0x32')]({'where':{'id':_0x450338[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](handleEntityNotFound(_0x53158f,null))[_0xe0fd('0x15')](function(_0x404c1c){if(_0x404c1c){return _0x404c1c[_0xe0fd('0x6e')](_0x450338[_0xe0fd('0x22')][_0xe0fd('0x54')])[_0xe0fd('0x15')](function(){if(_[_0xe0fd('0x74')](_0x450338[_0xe0fd('0x22')]['ids'])){for(var _0x1366cd=0x0;_0x1366cd<_0x450338[_0xe0fd('0x22')][_0xe0fd('0x54')][_0xe0fd('0x2e')];_0x1366cd+=0x1){socket[_0xe0fd('0x5a')](_0xe0fd('0x70'),{'UserId':Number(_0x450338[_0xe0fd('0x22')][_0xe0fd('0x54')][_0x1366cd]),'MailQueueId':Number(_0x450338['params']['id'])});}}else{socket['emit'](_0xe0fd('0x70'),{'UserId':Number(_0x450338[_0xe0fd('0x22')][_0xe0fd('0x54')]),'MailQueueId':Number(_0x450338[_0xe0fd('0x26')]['id'])});}});}})[_0xe0fd('0x15')](respondWithStatusCode(_0x53158f,null))[_0xe0fd('0x25')](handleError(_0x53158f,null));};exports[_0xe0fd('0x75')]=function(_0x12797b,_0x4c942c){var _0x1a66c5={};var _0x39d27e={};var _0x5b5335;var _0x1d7306;return db[_0xe0fd('0x1d')][_0xe0fd('0x40')]({'where':{'id':_0x12797b[_0xe0fd('0x26')]['id']}})[_0xe0fd('0x15')](handleEntityNotFound(_0x4c942c,null))[_0xe0fd('0x15')](function(_0x23add4){if(_0x23add4){_0x5b5335=_0x23add4;_0x39d27e[_0xe0fd('0x27')]=_[_0xe0fd('0x28')](db[_0xe0fd('0x48')]['rawAttributes']);_0x39d27e[_0xe0fd('0x22')]=_['keys'](_0x12797b[_0xe0fd('0x22')]);_0x39d27e[_0xe0fd('0x2a')]=_['intersection'](_0x39d27e[_0xe0fd('0x27')],_0x39d27e['query']);_0x1a66c5['attributes']=_[_0xe0fd('0x2b')](_0x39d27e[_0xe0fd('0x27')],qs[_0xe0fd('0x2c')](_0x12797b[_0xe0fd('0x22')]['fields']));_0x1a66c5[_0xe0fd('0x2d')]=_0x1a66c5[_0xe0fd('0x2d')][_0xe0fd('0x2e')]?_0x1a66c5[_0xe0fd('0x2d')]:_0x39d27e[_0xe0fd('0x27')];_0x1a66c5[_0xe0fd('0x44')]=qs[_0xe0fd('0x45')](_0x12797b['query']['sort']);_0x1a66c5['where']=qs[_0xe0fd('0x2a')](_[_0xe0fd('0x76')](_0x12797b[_0xe0fd('0x22')],_0x39d27e[_0xe0fd('0x2a')]));if(_0x12797b[_0xe0fd('0x22')][_0xe0fd('0x47')]){_0x1a66c5['where']=_[_0xe0fd('0x30')](_0x1a66c5[_0xe0fd('0x20')],{'$or':_['map'](_0x1a66c5[_0xe0fd('0x2d')],function(_0x210a71){var _0x283e7a={};_0x283e7a[_0x210a71]={'$like':'%'+_0x12797b[_0xe0fd('0x22')][_0xe0fd('0x47')]+'%'};return _0x283e7a;})});}_0x1a66c5=_[_0xe0fd('0x30')]({},_0x1a66c5,_0x12797b[_0xe0fd('0x31')]);return _0x5b5335[_0xe0fd('0x75')](_0x1a66c5);}})['then'](function(_0x12213a){if(_0x12213a){_0x1d7306=_0x12213a[_0xe0fd('0x2e')];if(!_0x12797b['query']['hasOwnProperty']('nolimit')){_0x1a66c5['limit']=qs['limit'](_0x12797b['query'][_0xe0fd('0x10')]);_0x1a66c5['offset']=qs[_0xe0fd('0x12')](_0x12797b['query'][_0xe0fd('0x12')]);}return _0x5b5335[_0xe0fd('0x75')](_0x1a66c5);}})[_0xe0fd('0x15')](function(_0x4c7e24){if(_0x4c7e24){return _0x4c7e24?{'count':_0x1d7306,'rows':_0x4c7e24}:null;}})[_0xe0fd('0x15')](respondWithResult(_0x4c942c,null))[_0xe0fd('0x25')](handleError(_0x4c942c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 884356a..c91380d 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 _0x1517=['update','remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save'];(function(_0x3deaa4,_0x54da65){var _0x4eb424=function(_0x12f3bd){while(--_0x12f3bd){_0x3deaa4['push'](_0x3deaa4['shift']());}};_0x4eb424(++_0x54da65);}(_0x1517,0x1dc));var _0x7151=function(_0x59d003,_0x626b4f){_0x59d003=_0x59d003-0x0;var _0x29c845=_0x1517[_0x59d003];return _0x29c845;};'use strict';var EventEmitter=require(_0x7151('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x7151('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7151('0x2')](0x0);var events={'afterCreate':_0x7151('0x3'),'afterUpdate':_0x7151('0x4'),'afterDestroy':_0x7151('0x5')};function emitEvent(_0x3194b7){return function(_0x3f5bae,_0x355963,_0x7fd75b){MailQueueEvents[_0x7151('0x6')](_0x3194b7+':'+_0x3f5bae['id'],_0x3f5bae);MailQueueEvents[_0x7151('0x6')](_0x3194b7,_0x3f5bae);_0x7fd75b(null);};}for(var e in events){if(events[_0x7151('0x7')](e)){var event=events[e];MailQueue[_0x7151('0x8')](e,emitEvent(event));}}module[_0x7151('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x484e=['save','remove','hasOwnProperty','exports','../../mysqldb','MailQueue'];(function(_0x3e9e62,_0x16d198){var _0xb8a42d=function(_0x308bbb){while(--_0x308bbb){_0x3e9e62['push'](_0x3e9e62['shift']());}};_0xb8a42d(++_0x16d198);}(_0x484e,0x130));var _0xe484=function(_0x55e95d,_0x73f423){_0x55e95d=_0x55e95d-0x0;var _0x5895cf=_0x484e[_0x55e95d];return _0x5895cf;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xe484('0x0'))['db'][_0xe484('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe484('0x2'),'afterUpdate':'update','afterDestroy':_0xe484('0x3')};function emitEvent(_0x2fb6e9){return function(_0x1ac18c,_0x4f6431,_0x534836){MailQueueEvents['emit'](_0x2fb6e9+':'+_0x1ac18c['id'],_0x1ac18c);MailQueueEvents['emit'](_0x2fb6e9,_0x1ac18c);_0x534836(null);};}for(var e in events){if(events[_0xe484('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xe484('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 04a17e6..7e33698 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 _0xa7f2=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailQueue.attributes'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0xa7f2,0xc7));var _0x2a7f=function(_0x3f889c,_0x1c16af){_0x3f889c=_0x3f889c-0x0;var _0x5edf2a=_0xa7f2[_0x3f889c];return _0x5edf2a;};'use strict';var _=require(_0x2a7f('0x0'));var util=require(_0x2a7f('0x1'));var logger=require(_0x2a7f('0x2'))(_0x2a7f('0x3'));var moment=require(_0x2a7f('0x4'));var BPromise=require(_0x2a7f('0x5'));var rp=require(_0x2a7f('0x6'));var fs=require('fs');var path=require(_0x2a7f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a7f('0x8'));module[_0x2a7f('0x9')]=function(_0x5d0f62,_0x2c0c76){return _0x5d0f62[_0x2a7f('0xa')](_0x2a7f('0xb'),attributes,{'tableName':_0x2a7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a6=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','MailQueue','lodash'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0x97a6,0x83));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x697a('0x0'));var util=require(_0x697a('0x1'));var logger=require(_0x697a('0x2'))(_0x697a('0x3'));var moment=require('moment');var BPromise=require(_0x697a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x697a('0x5'));var rimraf=require(_0x697a('0x6'));var config=require(_0x697a('0x7'));var attributes=require('./mailQueue.attributes');module[_0x697a('0x8')]=function(_0x2b5d94,_0x42b670){return _0x2b5d94[_0x697a('0x9')](_0x697a('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ed6200b..b61c2cd 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 _0x6de8=['socket.io-emitter','./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','MailQueue','options','raw','where','attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x1a20b5,_0x265db5){var _0x2efdaf=function(_0x279cd9){while(--_0x279cd9){_0x1a20b5['push'](_0x1a20b5['shift']());}};_0x2efdaf(++_0x265db5);}(_0x6de8,0x183));var _0x86de=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x6de8[_0x43444b];return _0x392fe5;};'use strict';var _=require(_0x86de('0x0'));var util=require('util');var moment=require(_0x86de('0x1'));var BPromise=require(_0x86de('0x2'));var rs=require(_0x86de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x86de('0x4'));var logger=require(_0x86de('0x5'))(_0x86de('0x6'));var config=require(_0x86de('0x7'));var jayson=require(_0x86de('0x8'));var client=jayson[_0x86de('0x9')][_0x86de('0xa')]({'port':0x232a});config[_0x86de('0xb')]=_['defaults'](config[_0x86de('0xb')],{'host':_0x86de('0xc'),'port':0x18eb});var socket=require(_0x86de('0xd'))(new Redis(config[_0x86de('0xb')]));require(_0x86de('0xe'))[_0x86de('0xf')](socket);function respondWithRpcPromise(_0x5b6ae2,_0x2d0d63,_0x1f80eb){return new BPromise(function(_0xf849d2,_0x151e0a){return client[_0x86de('0x10')](_0x5b6ae2,_0x1f80eb)[_0x86de('0x11')](function(_0x969e64){logger[_0x86de('0x12')]('MailQueue,\x20%s,\x20%s',_0x2d0d63,_0x86de('0x13'));logger[_0x86de('0x14')](_0x86de('0x15'),_0x2d0d63,_0x86de('0x13'),JSON[_0x86de('0x16')](_0x969e64));if(_0x969e64['error']){if(_0x969e64[_0x86de('0x17')]['code']===0x1f4){logger['error'](_0x86de('0x18'),_0x2d0d63,_0x969e64['error'][_0x86de('0x19')]);return _0x151e0a(_0x969e64['error']['message']);}logger[_0x86de('0x17')]('MailQueue,\x20%s,\x20%s',_0x2d0d63,_0x969e64['error'][_0x86de('0x19')]);return _0xf849d2(_0x969e64[_0x86de('0x17')][_0x86de('0x19')]);}else{logger[_0x86de('0x12')](_0x86de('0x18'),_0x2d0d63,_0x86de('0x13'));_0xf849d2(_0x969e64[_0x86de('0x1a')][_0x86de('0x19')]);}})[_0x86de('0x1b')](function(_0x10350b){logger['error'](_0x86de('0x18'),_0x2d0d63,_0x10350b);_0x151e0a(_0x10350b);});});}exports['GetMailQueue']=function(_0x50659d){var _0x3e39e8=this;return new Promise(function(_0x4ab6a9,_0x56f3a6){return db[_0x86de('0x1c')]['findAll']({'raw':_0x50659d[_0x86de('0x1d')]?_0x50659d[_0x86de('0x1d')][_0x86de('0x1e')]===undefined?!![]:![]:!![],'where':_0x50659d['options']?_0x50659d[_0x86de('0x1d')][_0x86de('0x1f')]||null:null,'attributes':_0x50659d['options']?_0x50659d[_0x86de('0x1d')][_0x86de('0x20')]||null:null,'limit':_0x50659d[_0x86de('0x1d')]?_0x50659d['options'][_0x86de('0x21')]||null:null,'include':_0x50659d[_0x86de('0x1d')]?_0x50659d['options'][_0x86de('0x22')]?_['map'](_0x50659d[_0x86de('0x1d')]['include'],function(_0x1e41cf){return{'model':db[_0x1e41cf[_0x86de('0x23')]],'as':_0x1e41cf['as'],'attributes':_0x1e41cf[_0x86de('0x20')],'include':_0x1e41cf[_0x86de('0x22')]?_[_0x86de('0x24')](_0x1e41cf['include'],function(_0x3d7313){return{'model':db[_0x3d7313[_0x86de('0x23')]],'as':_0x3d7313['as'],'attributes':_0x3d7313[_0x86de('0x20')],'include':_0x3d7313['include']?_['map'](_0x3d7313[_0x86de('0x22')],function(_0x5e3591){return{'model':db[_0x5e3591[_0x86de('0x23')]],'as':_0x5e3591['as'],'attributes':_0x5e3591[_0x86de('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee22f){logger[_0x86de('0x12')](_0x86de('0x25'),_0x50659d);logger[_0x86de('0x14')](_0x86de('0x25'),_0x50659d,JSON[_0x86de('0x16')](_0x4ee22f));_0x4ab6a9(_0x4ee22f);})[_0x86de('0x1b')](function(_0x556794){logger[_0x86de('0x17')](_0x86de('0x25'),_0x556794[_0x86de('0x19')],_0x50659d);_0x56f3a6(_0x3e39e8[_0x86de('0x17')](0x1f4,_0x556794['message']));});});};exports[_0x86de('0x26')]=function(_0x30cafe){var _0x41842f=this;return new Promise(function(_0x2fc341,_0x233581){return db[_0x86de('0x1c')][_0x86de('0x27')]({'raw':_0x30cafe['options']?_0x30cafe[_0x86de('0x1d')][_0x86de('0x1e')]===undefined?!![]:![]:!![],'where':_0x30cafe[_0x86de('0x1d')]?_0x30cafe[_0x86de('0x1d')][_0x86de('0x1f')]||null:null,'attributes':_0x30cafe[_0x86de('0x1d')]?_0x30cafe[_0x86de('0x1d')][_0x86de('0x20')]||null:null,'include':_0x30cafe[_0x86de('0x1d')]?_0x30cafe[_0x86de('0x1d')][_0x86de('0x22')]?_[_0x86de('0x24')](_0x30cafe[_0x86de('0x1d')][_0x86de('0x22')],function(_0x3aff7c){return{'model':db[_0x3aff7c[_0x86de('0x23')]],'as':_0x3aff7c['as'],'attributes':_0x3aff7c['attributes'],'include':_0x3aff7c[_0x86de('0x22')]?_[_0x86de('0x24')](_0x3aff7c[_0x86de('0x22')],function(_0x3b7322){return{'model':db[_0x3b7322[_0x86de('0x23')]],'as':_0x3b7322['as'],'attributes':_0x3b7322[_0x86de('0x20')],'include':_0x3b7322[_0x86de('0x22')]?_[_0x86de('0x24')](_0x3b7322[_0x86de('0x22')],function(_0x5b8306){return{'model':db[_0x5b8306['model']],'as':_0x5b8306['as'],'attributes':_0x5b8306[_0x86de('0x20')]};}):[]};}):[]};}):[]:[]})[_0x86de('0x11')](function(_0x377f74){logger[_0x86de('0x12')](_0x86de('0x26'),_0x30cafe);logger[_0x86de('0x14')](_0x86de('0x26'),_0x30cafe,JSON[_0x86de('0x16')](_0x377f74));_0x2fc341(_0x377f74);})[_0x86de('0x1b')](function(_0x224d74){logger[_0x86de('0x17')]('ShowMailQueue',_0x224d74[_0x86de('0x19')],_0x30cafe);_0x233581(_0x41842f[_0x86de('0x17')](0x1f4,_0x224d74[_0x86de('0x19')]));});});}; \ No newline at end of file +var _0x82b0=['include','model','attributes','debug','stringify','ShowMailQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','map'];(function(_0x2682a4,_0x5db558){var _0x3489ea=function(_0x1bc19f){while(--_0x1bc19f){_0x2682a4['push'](_0x2682a4['shift']());}};_0x3489ea(++_0x5db558);}(_0x82b0,0x81));var _0x082b=function(_0x169f86,_0xadf81f){_0x169f86=_0x169f86-0x0;var _0x30cced=_0x82b0[_0x169f86];return _0x30cced;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require('bluebird');var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require('../../config/logger')(_0x082b('0x7'));var config=require(_0x082b('0x8'));var jayson=require(_0x082b('0x9'));var client=jayson[_0x082b('0xa')][_0x082b('0xb')]({'port':0x232a});config['redis']=_[_0x082b('0xc')](config[_0x082b('0xd')],{'host':_0x082b('0xe'),'port':0x18eb});var socket=require(_0x082b('0xf'))(new Redis(config[_0x082b('0xd')]));require(_0x082b('0x10'))[_0x082b('0x11')](socket);function respondWithRpcPromise(_0x303c1e,_0x1483c3,_0x1066e8){return new BPromise(function(_0x18a27f,_0x181a6e){return client[_0x082b('0x12')](_0x303c1e,_0x1066e8)[_0x082b('0x13')](function(_0x4e9133){logger['info'](_0x082b('0x14'),_0x1483c3,'request\x20sent');logger['debug'](_0x082b('0x15'),_0x1483c3,_0x082b('0x16'),JSON['stringify'](_0x4e9133));if(_0x4e9133[_0x082b('0x17')]){if(_0x4e9133[_0x082b('0x17')][_0x082b('0x18')]===0x1f4){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x4e9133['error'][_0x082b('0x19')]);return _0x181a6e(_0x4e9133[_0x082b('0x17')]['message']);}logger[_0x082b('0x17')]('MailQueue,\x20%s,\x20%s',_0x1483c3,_0x4e9133[_0x082b('0x17')][_0x082b('0x19')]);return _0x18a27f(_0x4e9133['error'][_0x082b('0x19')]);}else{logger[_0x082b('0x1a')](_0x082b('0x14'),_0x1483c3,_0x082b('0x16'));_0x18a27f(_0x4e9133['result'][_0x082b('0x19')]);}})[_0x082b('0x1b')](function(_0x7d188d){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x7d188d);_0x181a6e(_0x7d188d);});});}exports[_0x082b('0x1c')]=function(_0x101654){var _0x18074e=this;return new Promise(function(_0x5dee52,_0x9faf2){return db[_0x082b('0x1d')][_0x082b('0x1e')]({'raw':_0x101654['options']?_0x101654[_0x082b('0x1f')][_0x082b('0x20')]===undefined?!![]:![]:!![],'where':_0x101654[_0x082b('0x1f')]?_0x101654['options']['where']||null:null,'attributes':_0x101654[_0x082b('0x1f')]?_0x101654['options']['attributes']||null:null,'limit':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')][_0x082b('0x21')]||null:null,'include':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')]['include']?_[_0x082b('0x22')](_0x101654[_0x082b('0x1f')][_0x082b('0x23')],function(_0x1082bf){return{'model':db[_0x1082bf[_0x082b('0x24')]],'as':_0x1082bf['as'],'attributes':_0x1082bf[_0x082b('0x25')],'include':_0x1082bf[_0x082b('0x23')]?_['map'](_0x1082bf[_0x082b('0x23')],function(_0x5ee68e){return{'model':db[_0x5ee68e[_0x082b('0x24')]],'as':_0x5ee68e['as'],'attributes':_0x5ee68e['attributes'],'include':_0x5ee68e[_0x082b('0x23')]?_[_0x082b('0x22')](_0x5ee68e['include'],function(_0x2279d7){return{'model':db[_0x2279d7['model']],'as':_0x2279d7['as'],'attributes':_0x2279d7[_0x082b('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x528e52){logger[_0x082b('0x1a')](_0x082b('0x1c'),_0x101654);logger[_0x082b('0x26')](_0x082b('0x1c'),_0x101654,JSON[_0x082b('0x27')](_0x528e52));_0x5dee52(_0x528e52);})[_0x082b('0x1b')](function(_0x2c9197){logger[_0x082b('0x17')](_0x082b('0x1c'),_0x2c9197[_0x082b('0x19')],_0x101654);_0x9faf2(_0x18074e[_0x082b('0x17')](0x1f4,_0x2c9197['message']));});});};exports[_0x082b('0x28')]=function(_0x32e57d){var _0x43244b=this;return new Promise(function(_0x2ede9f,_0x3189ac){return db['MailQueue']['find']({'raw':_0x32e57d[_0x082b('0x1f')]?_0x32e57d[_0x082b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x32e57d[_0x082b('0x1f')]?_0x32e57d[_0x082b('0x1f')]['where']||null:null,'attributes':_0x32e57d[_0x082b('0x1f')]?_0x32e57d['options'][_0x082b('0x25')]||null:null,'include':_0x32e57d[_0x082b('0x1f')]?_0x32e57d['options'][_0x082b('0x23')]?_[_0x082b('0x22')](_0x32e57d[_0x082b('0x1f')][_0x082b('0x23')],function(_0x171bd8){return{'model':db[_0x171bd8['model']],'as':_0x171bd8['as'],'attributes':_0x171bd8[_0x082b('0x25')],'include':_0x171bd8['include']?_[_0x082b('0x22')](_0x171bd8[_0x082b('0x23')],function(_0x40e422){return{'model':db[_0x40e422[_0x082b('0x24')]],'as':_0x40e422['as'],'attributes':_0x40e422[_0x082b('0x25')],'include':_0x40e422[_0x082b('0x23')]?_[_0x082b('0x22')](_0x40e422[_0x082b('0x23')],function(_0x56f15c){return{'model':db[_0x56f15c[_0x082b('0x24')]],'as':_0x56f15c['as'],'attributes':_0x56f15c[_0x082b('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x129f19){logger[_0x082b('0x1a')](_0x082b('0x28'),_0x32e57d);logger[_0x082b('0x26')](_0x082b('0x28'),_0x32e57d,JSON[_0x082b('0x27')](_0x129f19));_0x2ede9f(_0x129f19);})[_0x082b('0x1b')](function(_0x65836e){logger['error'](_0x082b('0x28'),_0x65836e[_0x082b('0x19')],_0x32e57d);_0x3189ac(_0x43244b[_0x082b('0x17')](0x1f4,_0x65836e[_0x082b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 44b34bd..6d816de 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 _0x920b=['update','emit','removeListener','register','mailQueue:','./mailQueue.events','save','remove'];(function(_0x1495a1,_0x1db63e){var _0x1fb7c9=function(_0x5b667a){while(--_0x5b667a){_0x1495a1['push'](_0x1495a1['shift']());}};_0x1fb7c9(++_0x1db63e);}(_0x920b,0x11d));var _0xb920=function(_0x1b8df7,_0x55256b){_0x1b8df7=_0x1b8df7-0x0;var _0x3dc277=_0x920b[_0x1b8df7];return _0x3dc277;};'use strict';var MailQueueEvents=require(_0xb920('0x0'));var events=[_0xb920('0x1'),_0xb920('0x2'),_0xb920('0x3')];function createListener(_0x48c792,_0x149aa4){return function(_0x19c80f){_0x149aa4[_0xb920('0x4')](_0x48c792,_0x19c80f);};}function removeListener(_0x5c3f71,_0x208900){return function(){MailQueueEvents[_0xb920('0x5')](_0x5c3f71,_0x208900);};}exports[_0xb920('0x6')]=function(_0x75e15e){for(var _0x480383=0x0,_0x1ceebd=events['length'];_0x480383<_0x1ceebd;_0x480383++){var _0xc473b1=events[_0x480383];var _0xd802cf=createListener(_0xb920('0x7')+_0xc473b1,_0x75e15e);MailQueueEvents['on'](_0xc473b1,_0xd802cf);}}; \ No newline at end of file +var _0x47a0=['length','mailQueue:','./mailQueue.events','remove','update','emit','removeListener','register'];(function(_0x1a1b49,_0x4c6d15){var _0x336d48=function(_0x5993be){while(--_0x5993be){_0x1a1b49['push'](_0x1a1b49['shift']());}};_0x336d48(++_0x4c6d15);}(_0x47a0,0x15a));var _0x047a=function(_0x15320e,_0x3c9cce){_0x15320e=_0x15320e-0x0;var _0x21fe36=_0x47a0[_0x15320e];return _0x21fe36;};'use strict';var MailQueueEvents=require(_0x047a('0x0'));var events=['save',_0x047a('0x1'),_0x047a('0x2')];function createListener(_0x449dc5,_0x4e76e9){return function(_0xc38132){_0x4e76e9[_0x047a('0x3')](_0x449dc5,_0xc38132);};}function removeListener(_0x5ceee8,_0x4c9941){return function(){MailQueueEvents[_0x047a('0x4')](_0x5ceee8,_0x4c9941);};}exports[_0x047a('0x5')]=function(_0x1d60e1){for(var _0x56908d=0x0,_0x176f33=events[_0x047a('0x6')];_0x56908d<_0x176f33;_0x56908d++){var _0x2967b9=events[_0x56908d];var _0x138c00=createListener(_0x047a('0x7')+_0x2967b9,_0x1d60e1);MailQueueEvents['on'](_0x2967b9,_0x138c00);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a72c7d1..57a8170 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 _0xcc7a=['index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x53e617,_0x207619){var _0x3987c7=function(_0x4f5b78){while(--_0x4f5b78){_0x53e617['push'](_0x53e617['shift']());}};_0x3987c7(++_0x207619);}(_0xcc7a,0x1ae));var _0xacc7=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xcc7a[_0x427d3a];return _0xe5c521;};'use strict';var multer=require(_0xacc7('0x0'));var util=require(_0xacc7('0x1'));var path=require(_0xacc7('0x2'));var timeout=require(_0xacc7('0x3'));var express=require('express');var router=express[_0xacc7('0x4')]();var fs_extra=require(_0xacc7('0x5'));var auth=require(_0xacc7('0x6'));var interaction=require(_0xacc7('0x7'));var config=require(_0xacc7('0x8'));var controller=require(_0xacc7('0x9'));router[_0xacc7('0xa')]('/',auth['isAuthenticated'](),controller[_0xacc7('0xb')]);router[_0xacc7('0xa')](_0xacc7('0xc'),auth['isAuthenticated'](),controller[_0xacc7('0xd')]);router[_0xacc7('0xa')](_0xacc7('0xe'),auth[_0xacc7('0xf')](),controller[_0xacc7('0x10')]);router[_0xacc7('0x11')]('/',auth[_0xacc7('0xf')](),controller['create']);router[_0xacc7('0x12')]('/:id',auth[_0xacc7('0xf')](),controller[_0xacc7('0x13')]);router[_0xacc7('0x14')](_0xacc7('0xe'),auth[_0xacc7('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc986=['create','put','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post'];(function(_0xb9f3ae,_0x4016b8){var _0x1a2e76=function(_0xbf200b){while(--_0xbf200b){_0xb9f3ae['push'](_0xb9f3ae['shift']());}};_0x1a2e76(++_0x4016b8);}(_0xc986,0x16d));var _0x6c98=function(_0x1e753b,_0x209149){_0x1e753b=_0x1e753b-0x0;var _0x13d34e=_0xc986[_0x1e753b];return _0x13d34e;};'use strict';var multer=require(_0x6c98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6c98('0x1'));var express=require(_0x6c98('0x2'));var router=express['Router']();var fs_extra=require(_0x6c98('0x3'));var auth=require(_0x6c98('0x4'));var interaction=require(_0x6c98('0x5'));var config=require(_0x6c98('0x6'));var controller=require(_0x6c98('0x7'));router['get']('/',auth[_0x6c98('0x8')](),controller[_0x6c98('0x9')]);router['get'](_0x6c98('0xa'),auth[_0x6c98('0x8')](),controller[_0x6c98('0xb')]);router[_0x6c98('0xc')](_0x6c98('0xd'),auth[_0x6c98('0x8')](),controller['show']);router[_0x6c98('0xe')]('/',auth[_0x6c98('0x8')](),controller[_0x6c98('0xf')]);router[_0x6c98('0x10')](_0x6c98('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6c98('0x11')](_0x6c98('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6c98('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1523198..12e3057 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 _0x12c5=['STRING','DATE','sequelize','exports'];(function(_0x59fe7b,_0x40de81){var _0x5beca1=function(_0x45f09){while(--_0x45f09){_0x59fe7b['push'](_0x59fe7b['shift']());}};_0x5beca1(++_0x40de81);}(_0x12c5,0xbe));var _0x512c=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x12c5[_0xd09668];return _0x68726;};'use strict';var moment=require('moment');var Sequelize=require(_0x512c('0x0'));module[_0x512c('0x1')]={'uniqueid':{'type':Sequelize[_0x512c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x512c('0x3')]},'leaveAt':{'type':Sequelize[_0x512c('0x3')]},'acceptAt':{'type':Sequelize[_0x512c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7f2d=['STRING','DATE','moment','sequelize'];(function(_0x4c5ae3,_0x34c645){var _0x6148a2=function(_0x2f2523){while(--_0x2f2523){_0x4c5ae3['push'](_0x4c5ae3['shift']());}};_0x6148a2(++_0x34c645);}(_0x7f2d,0x1ea));var _0xd7f2=function(_0x3acb0f,_0x422e6f){_0x3acb0f=_0x3acb0f-0x0;var _0x5bdb4f=_0x7f2d[_0x3acb0f];return _0x5bdb4f;};'use strict';var moment=require(_0xd7f2('0x0'));var Sequelize=require(_0xd7f2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd7f2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd7f2('0x2')]},'joinAt':{'type':Sequelize[_0xd7f2('0x3')]},'leaveAt':{'type':Sequelize[_0xd7f2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 106266d..dd8dca1 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 _0xcf2f=['sort','pick','where','merge','VIRTUAL','filter','options','MailQueueReport','includeAll','include','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x366394,_0x8887e1){_0x366394=_0x366394-0x0;var _0x2cf598=_0xcf2f[_0x366394];return _0x2cf598;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6f14,_0x26bfcc){return function(_0x1f0f07){if(!_0x1f0f07){_0x1e6f14[_0xfcf2('0x25')](0x194);}return _0x1f0f07;};}function handleError(_0x5bb384,_0x1deca3){_0x1deca3=_0x1deca3||0x1f4;return function(_0x448222){logger[_0xfcf2('0x26')](_0x448222[_0xfcf2('0x27')]);if(_0x448222[_0xfcf2('0x28')]){delete _0x448222[_0xfcf2('0x28')];}_0x5bb384[_0xfcf2('0x19')](_0x1deca3)[_0xfcf2('0x29')](_0x448222);};}exports[_0xfcf2('0x2a')]=function(_0x56f839,_0x4c2935){var _0x695f31={},_0x878504={},_0x3308c3={'count':0x0,'rows':[]};var _0x532db6=_[_0xfcf2('0x2b')](db['MailQueueReport'][_0xfcf2('0x2c')],function(_0x26651e){return{'name':_0x26651e[_0xfcf2('0x2d')],'type':_0x26651e[_0xfcf2('0x2e')][_0xfcf2('0x2f')]};});_0x878504[_0xfcf2('0x30')]=_[_0xfcf2('0x2b')](_0x532db6,'name');_0x878504['query']=_[_0xfcf2('0x31')](_0x56f839[_0xfcf2('0x32')]);_0x878504[_0xfcf2('0x33')]=_[_0xfcf2('0x34')](_0x878504['model'],_0x878504['query']);_0x695f31[_0xfcf2('0x35')]=_['intersection'](_0x878504[_0xfcf2('0x30')],qs[_0xfcf2('0x36')](_0x56f839['query'][_0xfcf2('0x36')]));_0x695f31[_0xfcf2('0x35')]=_0x695f31[_0xfcf2('0x35')][_0xfcf2('0x37')]?_0x695f31[_0xfcf2('0x35')]:_0x878504[_0xfcf2('0x30')];if(!_0x56f839[_0xfcf2('0x32')]['hasOwnProperty'](_0xfcf2('0x38'))){_0x695f31[_0xfcf2('0x1e')]=qs['limit'](_0x56f839[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x695f31['offset']=qs[_0xfcf2('0x1b')](_0x56f839[_0xfcf2('0x32')]['offset']);}_0x695f31[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x56f839[_0xfcf2('0x32')][_0xfcf2('0x3a')]);_0x695f31['where']=qs[_0xfcf2('0x33')](_[_0xfcf2('0x3b')](_0x56f839[_0xfcf2('0x32')],_0x878504[_0xfcf2('0x33')]),_0x532db6);if(_0x56f839[_0xfcf2('0x32')]['filter']){_0x695f31[_0xfcf2('0x3c')]=_[_0xfcf2('0x3d')](_0x695f31[_0xfcf2('0x3c')],{'$or':_[_0xfcf2('0x2b')](_0x532db6,function(_0x41cac2){if(_0x41cac2['type']!==_0xfcf2('0x3e')){var _0x4dfc61={};_0x4dfc61[_0x41cac2[_0xfcf2('0x28')]]={'$like':'%'+_0x56f839[_0xfcf2('0x32')][_0xfcf2('0x3f')]+'%'};return _0x4dfc61;}})});}_0x695f31=_[_0xfcf2('0x3d')]({},_0x695f31,_0x56f839[_0xfcf2('0x40')]);var _0x59b404={'where':_0x695f31[_0xfcf2('0x3c')]};return db[_0xfcf2('0x41')][_0xfcf2('0x1d')](_0x59b404)['then'](function(_0x1e8e71){_0x3308c3[_0xfcf2('0x1d')]=_0x1e8e71;if(_0x56f839[_0xfcf2('0x32')][_0xfcf2('0x42')]){_0x695f31[_0xfcf2('0x43')]=[{'all':!![]}];}return db[_0xfcf2('0x41')]['findAll'](_0x695f31);})['then'](function(_0x526c42){_0x3308c3[_0xfcf2('0x44')]=_0x526c42;return _0x3308c3;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x4c2935,_0x695f31))[_0xfcf2('0x45')](handleError(_0x4c2935,null));};exports['show']=function(_0x559aea,_0x5efb5c){var _0x3fb288={'raw':!![],'where':{'id':_0x559aea[_0xfcf2('0x46')]['id']}},_0xab0747={};_0xab0747[_0xfcf2('0x30')]=_[_0xfcf2('0x31')](db[_0xfcf2('0x41')][_0xfcf2('0x2c')]);_0xab0747[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x559aea[_0xfcf2('0x32')]);_0xab0747[_0xfcf2('0x33')]=_['intersection'](_0xab0747['model'],_0xab0747[_0xfcf2('0x32')]);_0x3fb288[_0xfcf2('0x35')]=_[_0xfcf2('0x34')](_0xab0747[_0xfcf2('0x30')],qs[_0xfcf2('0x36')](_0x559aea[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x3fb288[_0xfcf2('0x35')]=_0x3fb288[_0xfcf2('0x35')][_0xfcf2('0x37')]?_0x3fb288[_0xfcf2('0x35')]:_0xab0747[_0xfcf2('0x30')];if(_0x559aea[_0xfcf2('0x32')][_0xfcf2('0x42')]){_0x3fb288[_0xfcf2('0x43')]=[{'all':!![]}];}_0x3fb288=_[_0xfcf2('0x3d')]({},_0x3fb288,_0x559aea[_0xfcf2('0x40')]);return db['MailQueueReport'][_0xfcf2('0x47')](_0x3fb288)[_0xfcf2('0x24')](handleEntityNotFound(_0x5efb5c,null))['then'](respondWithResult(_0x5efb5c,null))[_0xfcf2('0x45')](handleError(_0x5efb5c,null));};exports['create']=function(_0x12eef4,_0xe85e89){return db[_0xfcf2('0x41')][_0xfcf2('0x48')](_0x12eef4['body'],{})['then'](respondWithResult(_0xe85e89,0xc9))['catch'](handleError(_0xe85e89,null));};exports[_0xfcf2('0x23')]=function(_0x37d4bb,_0x20fcab){if(_0x37d4bb[_0xfcf2('0x49')]['id']){delete _0x37d4bb['body']['id'];}return db[_0xfcf2('0x41')][_0xfcf2('0x47')]({'where':{'id':_0x37d4bb[_0xfcf2('0x46')]['id']}})['then'](handleEntityNotFound(_0x20fcab,null))[_0xfcf2('0x24')](saveUpdates(_0x37d4bb[_0xfcf2('0x49')],null))[_0xfcf2('0x24')](respondWithResult(_0x20fcab,null))[_0xfcf2('0x45')](handleError(_0x20fcab,null));};exports[_0xfcf2('0x4a')]=function(_0x4af270,_0x4c14d){return db[_0xfcf2('0x41')][_0xfcf2('0x47')]({'where':{'id':_0x4af270[_0xfcf2('0x46')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x4c14d,null))[_0xfcf2('0x24')](removeEntity(_0x4c14d,null))['catch'](handleError(_0x4c14d,null));};exports['describe']=function(_0x4aa02f,_0x37c8b4){return db[_0xfcf2('0x41')]['describe']()['then'](respondWithResult(_0x37c8b4,null))[_0xfcf2('0x45')](handleError(_0x37c8b4,null));}; \ No newline at end of file +var _0x3d04=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x39befc,_0x45628d){var _0x1ff165=function(_0x4d617e){while(--_0x4d617e){_0x39befc['push'](_0x39befc['shift']());}};_0x1ff165(++_0x45628d);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c111,_0x44497b){return function(_0x5dd310){if(!_0x5dd310){_0x29c111[_0x43d0('0x16')](0x194);}return _0x5dd310;};}function handleError(_0x238c64,_0x5ac4c0){_0x5ac4c0=_0x5ac4c0||0x1f4;return function(_0x12df30){logger[_0x43d0('0x24')](_0x12df30[_0x43d0('0x25')]);if(_0x12df30['name']){delete _0x12df30[_0x43d0('0x26')];}_0x238c64[_0x43d0('0x17')](_0x5ac4c0)[_0x43d0('0x27')](_0x12df30);};}exports[_0x43d0('0x28')]=function(_0x37d78f,_0x440ecb){var _0x31a057={},_0x4a3cd4={},_0x2b0784={'count':0x0,'rows':[]};var _0x2f5bc5=_[_0x43d0('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x52c37b){return{'name':_0x52c37b[_0x43d0('0x2a')],'type':_0x52c37b[_0x43d0('0x2b')][_0x43d0('0x2c')]};});_0x4a3cd4[_0x43d0('0x2d')]=_[_0x43d0('0x29')](_0x2f5bc5,_0x43d0('0x26'));_0x4a3cd4['query']=_[_0x43d0('0x2e')](_0x37d78f[_0x43d0('0x2f')]);_0x4a3cd4[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],_0x4a3cd4[_0x43d0('0x2f')]);_0x31a057[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x37d78f[_0x43d0('0x2f')]['fields']));_0x31a057[_0x43d0('0x32')]=_0x31a057[_0x43d0('0x32')][_0x43d0('0x34')]?_0x31a057[_0x43d0('0x32')]:_0x4a3cd4['model'];if(!_0x37d78f[_0x43d0('0x2f')]['hasOwnProperty'](_0x43d0('0x35'))){_0x31a057[_0x43d0('0x19')]=qs['limit'](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x19')]);_0x31a057[_0x43d0('0x1c')]=qs[_0x43d0('0x1c')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x1c')]);}_0x31a057[_0x43d0('0x36')]=qs[_0x43d0('0x37')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x37')]);_0x31a057[_0x43d0('0x38')]=qs['filters'](_[_0x43d0('0x39')](_0x37d78f[_0x43d0('0x2f')],_0x4a3cd4[_0x43d0('0x30')]),_0x2f5bc5);if(_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x3a')]){_0x31a057[_0x43d0('0x38')]=_[_0x43d0('0x3b')](_0x31a057[_0x43d0('0x38')],{'$or':_[_0x43d0('0x29')](_0x2f5bc5,function(_0x43bcc5){if(_0x43bcc5[_0x43d0('0x2b')]!==_0x43d0('0x3c')){var _0x19843c={};_0x19843c[_0x43bcc5[_0x43d0('0x26')]]={'$like':'%'+_0x37d78f['query'][_0x43d0('0x3a')]+'%'};return _0x19843c;}})});}_0x31a057=_[_0x43d0('0x3b')]({},_0x31a057,_0x37d78f[_0x43d0('0x3d')]);var _0xc3f9c7={'where':_0x31a057[_0x43d0('0x38')]};return db[_0x43d0('0x3e')][_0x43d0('0x1b')](_0xc3f9c7)[_0x43d0('0x22')](function(_0x4ae965){_0x2b0784['count']=_0x4ae965;if(_0x37d78f[_0x43d0('0x2f')]['includeAll']){_0x31a057['include']=[{'all':!![]}];}return db[_0x43d0('0x3e')]['findAll'](_0x31a057);})[_0x43d0('0x22')](function(_0x5027d0){_0x2b0784[_0x43d0('0x3f')]=_0x5027d0;return _0x2b0784;})['then'](respondWithFilteredResult(_0x440ecb,_0x31a057))[_0x43d0('0x40')](handleError(_0x440ecb,null));};exports[_0x43d0('0x41')]=function(_0x468b32,_0x4e817e){var _0x3eb2e9={'raw':!![],'where':{'id':_0x468b32[_0x43d0('0x42')]['id']}},_0x520406={};_0x520406['model']=_['keys'](db[_0x43d0('0x3e')][_0x43d0('0x43')]);_0x520406['query']=_[_0x43d0('0x2e')](_0x468b32[_0x43d0('0x2f')]);_0x520406[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],_0x520406['query']);_0x3eb2e9[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x468b32['query'][_0x43d0('0x33')]));_0x3eb2e9[_0x43d0('0x32')]=_0x3eb2e9[_0x43d0('0x32')][_0x43d0('0x34')]?_0x3eb2e9[_0x43d0('0x32')]:_0x520406['model'];if(_0x468b32[_0x43d0('0x2f')][_0x43d0('0x44')]){_0x3eb2e9['include']=[{'all':!![]}];}_0x3eb2e9=_[_0x43d0('0x3b')]({},_0x3eb2e9,_0x468b32[_0x43d0('0x3d')]);return db[_0x43d0('0x3e')]['find'](_0x3eb2e9)[_0x43d0('0x22')](handleEntityNotFound(_0x4e817e,null))['then'](respondWithResult(_0x4e817e,null))[_0x43d0('0x40')](handleError(_0x4e817e,null));};exports['create']=function(_0x1f55e9,_0x269d99){return db[_0x43d0('0x3e')][_0x43d0('0x45')](_0x1f55e9[_0x43d0('0x46')],{})['then'](respondWithResult(_0x269d99,0xc9))[_0x43d0('0x40')](handleError(_0x269d99,null));};exports['update']=function(_0x5a6364,_0x3e7392){if(_0x5a6364[_0x43d0('0x46')]['id']){delete _0x5a6364[_0x43d0('0x46')]['id'];}return db[_0x43d0('0x3e')][_0x43d0('0x47')]({'where':{'id':_0x5a6364[_0x43d0('0x42')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3e7392,null))[_0x43d0('0x22')](saveUpdates(_0x5a6364[_0x43d0('0x46')],null))[_0x43d0('0x22')](respondWithResult(_0x3e7392,null))[_0x43d0('0x40')](handleError(_0x3e7392,null));};exports['destroy']=function(_0x338203,_0xd78af1){return db[_0x43d0('0x3e')]['find']({'where':{'id':_0x338203[_0x43d0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd78af1,null))['then'](removeEntity(_0xd78af1,null))[_0x43d0('0x40')](handleError(_0xd78af1,null));};exports[_0x43d0('0x48')]=function(_0x234571,_0x127815){return db[_0x43d0('0x3e')]['describe']()['then'](respondWithResult(_0x127815,null))[_0x43d0('0x40')](handleError(_0x127815,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 78363da..449d946 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 _0x7ef7=['uniqueid','util','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x3921b1,_0x4969ff){var _0x588ae8=function(_0x4be954){while(--_0x4be954){_0x3921b1['push'](_0x3921b1['shift']());}};_0x588ae8(++_0x4969ff);}(_0x7ef7,0x91));var _0x77ef=function(_0x17b151,_0x3fab68){_0x17b151=_0x17b151-0x0;var _0x4b3a79=_0x7ef7[_0x17b151];return _0x4b3a79;};'use strict';var _=require('lodash');var util=require(_0x77ef('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x77ef('0x1'));var BPromise=require('bluebird');var rp=require(_0x77ef('0x2'));var fs=require('fs');var path=require(_0x77ef('0x3'));var rimraf=require(_0x77ef('0x4'));var config=require(_0x77ef('0x5'));var attributes=require(_0x77ef('0x6'));module[_0x77ef('0x7')]=function(_0xce66cb,_0x7f205){return _0xce66cb['define']('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x77ef('0x8'),'fields':[_0x77ef('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3482=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x26db64,_0x459628){var _0x45dc7b=function(_0x223a18){while(--_0x223a18){_0x26db64['push'](_0x26db64['shift']());}};_0x45dc7b(++_0x459628);}(_0x3482,0x1cd));var _0x2348=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x3482[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0x2348('0x0'));var util=require(_0x2348('0x1'));var logger=require(_0x2348('0x2'))(_0x2348('0x3'));var moment=require(_0x2348('0x4'));var BPromise=require(_0x2348('0x5'));var rp=require(_0x2348('0x6'));var fs=require('fs');var path=require(_0x2348('0x7'));var rimraf=require(_0x2348('0x8'));var config=require(_0x2348('0x9'));var attributes=require(_0x2348('0xa'));module[_0x2348('0xb')]=function(_0x136cae,_0x204527){return _0x136cae[_0x2348('0xc')](_0x2348('0xd'),attributes,{'tableName':_0x2348('0xe'),'paranoid':![],'indexes':[{'name':_0x2348('0xf'),'fields':[_0x2348('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c7f331d..ae7d628 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(_0x3df870,_0x32e29f){var _0x53e934=function(_0x5a636d){while(--_0x5a636d){_0x3df870['push'](_0x3df870['shift']());}};_0x53e934(++_0x32e29f);}(_0xdb28,0x106));var _0x8db2=function(_0x405455,_0x1a43f0){_0x405455=_0x405455-0x0;var _0x200e59=_0xdb28[_0x405455];return _0x200e59;};'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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x310aed,_0x3ae910){var _0x3208f2=function(_0x28d372){while(--_0x28d372){_0x310aed['push'](_0x310aed['shift']());}};_0x3208f2(++_0x3ae910);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 743b120..78f997e 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3b660f,_0x45c3db){var _0x187a29=function(_0x11cedf){while(--_0x11cedf){_0x3b660f['push'](_0x3b660f['shift']());}};_0x187a29(++_0x45c3db);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4093f25..17e4320 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 _0xa635=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x58ed84,_0x2ac5aa){var _0x27b770=function(_0x1bcb27){while(--_0x1bcb27){_0x58ed84['push'](_0x58ed84['shift']());}};_0x27b770(++_0x2ac5aa);}(_0xa635,0x73));var _0x5a63=function(_0x1e2da4,_0x32e346){_0x1e2da4=_0x1e2da4-0x0;var _0x1a5b82=_0xa635[_0x1e2da4];return _0x1a5b82;};'use strict';var Sequelize=require(_0x5a63('0x0'));module[_0x5a63('0x1')]={'description':{'type':Sequelize[_0x5a63('0x2')]},'host':{'type':Sequelize[_0x5a63('0x2')]},'authentication':{'type':Sequelize[_0x5a63('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5a63('0x2')]},'password':{'type':Sequelize[_0x5a63('0x2')]},'port':{'type':Sequelize[_0x5a63('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5a63('0x2')],'defaultValue':_0x5a63('0x5')},'connTimeout':{'type':Sequelize[_0x5a63('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5a63('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2929=['sequelize','exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x20bd9d,_0xdcc206){var _0x117cab=function(_0x51f6a3){while(--_0x51f6a3){_0x20bd9d['push'](_0x20bd9d['shift']());}};_0x117cab(++_0xdcc206);}(_0x2929,0xd8));var _0x9292=function(_0x1ef1d5,_0x82bb06){_0x1ef1d5=_0x1ef1d5-0x0;var _0x3672de=_0x2929[_0x1ef1d5];return _0x3672de;};'use strict';var Sequelize=require(_0x9292('0x0'));module[_0x9292('0x1')]={'description':{'type':Sequelize[_0x9292('0x2')]},'host':{'type':Sequelize[_0x9292('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x9292('0x2')]},'password':{'type':Sequelize[_0x9292('0x2')]},'port':{'type':Sequelize[_0x9292('0x3')]},'tls':{'type':Sequelize[_0x9292('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9292('0x2')],'defaultValue':_0x9292('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9292('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2cf5b45..c713fe8 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 _0xf6b4=['../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4dcb1f,_0x1cd009){var _0x29a2e7=function(_0x328f27){while(--_0x328f27){_0x4dcb1f['push'](_0x4dcb1f['shift']());}};_0x29a2e7(++_0x1cd009);}(_0xf6b4,0xa1));var _0x4f6b=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0xf6b4[_0x538bd3];return _0x5e2fd7;};'use strict';var _=require(_0x4f6b('0x0'));var util=require(_0x4f6b('0x1'));var logger=require('../../config/logger')(_0x4f6b('0x2'));var moment=require(_0x4f6b('0x3'));var BPromise=require(_0x4f6b('0x4'));var rp=require(_0x4f6b('0x5'));var fs=require('fs');var path=require(_0x4f6b('0x6'));var rimraf=require(_0x4f6b('0x7'));var config=require(_0x4f6b('0x8'));var attributes=require(_0x4f6b('0x9'));module[_0x4f6b('0xa')]=function(_0x118f00,_0x11b328){return _0x118f00['define'](_0x4f6b('0xb'),attributes,{'tableName':_0x4f6b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c8b=['moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8c8b,0x159));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb8c8('0x0'));var util=require(_0xb8c8('0x1'));var logger=require(_0xb8c8('0x2'))('api');var moment=require(_0xb8c8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8c8('0x5'));var config=require(_0xb8c8('0x6'));var attributes=require(_0xb8c8('0x7'));module[_0xb8c8('0x8')]=function(_0x5b5052,_0x5b9441){return _0x5b5052[_0xb8c8('0x9')](_0xb8c8('0xa'),attributes,{'tableName':_0xb8c8('0xb'),'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 f651287..5cd467f 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 _0x2394=['include','map','model','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit'];(function(_0x5931ac,_0x58908c){var _0x54d6d1=function(_0x5662f1){while(--_0x5662f1){_0x5931ac['push'](_0x5931ac['shift']());}};_0x54d6d1(++_0x58908c);}(_0x2394,0x1f4));var _0x4239=function(_0x6e1b38,_0x3255a3){_0x6e1b38=_0x6e1b38-0x0;var _0x1d1fa8=_0x2394[_0x6e1b38];return _0x1d1fa8;};'use strict';var _=require(_0x4239('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4239('0x1'));var rs=require(_0x4239('0x2'));var fs=require('fs');var Redis=require(_0x4239('0x3'));var db=require(_0x4239('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4239('0x5'));var config=require(_0x4239('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4239('0x7')][_0x4239('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e9ff7,_0x49eaf3,_0x26b373){return new BPromise(function(_0x1307f3,_0x353c7a){return client[_0x4239('0x9')](_0x2e9ff7,_0x26b373)[_0x4239('0xa')](function(_0x2cd5b4){logger[_0x4239('0xb')](_0x4239('0xc'),_0x49eaf3,_0x4239('0xd'));logger['debug'](_0x4239('0xe'),_0x49eaf3,'request\x20sent',JSON[_0x4239('0xf')](_0x2cd5b4));if(_0x2cd5b4['error']){if(_0x2cd5b4[_0x4239('0x10')][_0x4239('0x11')]===0x1f4){logger['error'](_0x4239('0xc'),_0x49eaf3,_0x2cd5b4[_0x4239('0x10')][_0x4239('0x12')]);return _0x353c7a(_0x2cd5b4['error'][_0x4239('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x49eaf3,_0x2cd5b4['error'][_0x4239('0x12')]);return _0x1307f3(_0x2cd5b4[_0x4239('0x10')][_0x4239('0x12')]);}else{logger[_0x4239('0xb')]('MailServerIn,\x20%s,\x20%s',_0x49eaf3,_0x4239('0xd'));_0x1307f3(_0x2cd5b4['result'][_0x4239('0x12')]);}})[_0x4239('0x13')](function(_0x18a8e8){logger[_0x4239('0x10')]('MailServerIn,\x20%s,\x20%s',_0x49eaf3,_0x18a8e8);_0x353c7a(_0x18a8e8);});});}exports[_0x4239('0x14')]=function(_0x5d1c0b){var _0x3af647=this;return new Promise(function(_0x247c49,_0x33ce01){return db[_0x4239('0x15')]['findAll']({'raw':_0x5d1c0b[_0x4239('0x16')]?_0x5d1c0b['options'][_0x4239('0x17')]===undefined?!![]:![]:!![],'where':_0x5d1c0b[_0x4239('0x16')]?_0x5d1c0b[_0x4239('0x16')][_0x4239('0x18')]||null:null,'attributes':_0x5d1c0b['options']?_0x5d1c0b[_0x4239('0x16')][_0x4239('0x19')]||null:null,'limit':_0x5d1c0b[_0x4239('0x16')]?_0x5d1c0b[_0x4239('0x16')][_0x4239('0x1a')]||null:null,'include':_0x5d1c0b[_0x4239('0x16')]?_0x5d1c0b['options'][_0x4239('0x1b')]?_[_0x4239('0x1c')](_0x5d1c0b[_0x4239('0x16')][_0x4239('0x1b')],function(_0x2f920f){return{'model':db[_0x2f920f[_0x4239('0x1d')]],'as':_0x2f920f['as'],'attributes':_0x2f920f[_0x4239('0x19')],'include':_0x2f920f['include']?_[_0x4239('0x1c')](_0x2f920f['include'],function(_0x1e2e10){return{'model':db[_0x1e2e10[_0x4239('0x1d')]],'as':_0x1e2e10['as'],'attributes':_0x1e2e10[_0x4239('0x19')],'include':_0x1e2e10[_0x4239('0x1b')]?_[_0x4239('0x1c')](_0x1e2e10[_0x4239('0x1b')],function(_0x2e6660){return{'model':db[_0x2e6660[_0x4239('0x1d')]],'as':_0x2e6660['as'],'attributes':_0x2e6660[_0x4239('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4239('0xa')](function(_0x4252af){logger[_0x4239('0xb')]('GetMailServerIn',_0x5d1c0b);logger[_0x4239('0x1e')](_0x4239('0x14'),_0x5d1c0b,JSON[_0x4239('0xf')](_0x4252af));_0x247c49(_0x4252af);})[_0x4239('0x13')](function(_0x1e1cb3){logger[_0x4239('0x10')](_0x4239('0x14'),_0x1e1cb3[_0x4239('0x12')],_0x5d1c0b);_0x33ce01(_0x3af647[_0x4239('0x10')](0x1f4,_0x1e1cb3[_0x4239('0x12')]));});});}; \ No newline at end of file +var _0x98fc=['http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','raw','limit','map','include','model','attributes','then','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x34bf20,_0x292acb){var _0xc1ba1b=function(_0x2519bc){while(--_0x2519bc){_0x34bf20['push'](_0x34bf20['shift']());}};_0xc1ba1b(++_0x292acb);}(_0x98fc,0x156));var _0xc98f=function(_0x625a73,_0x50ae08){_0x625a73=_0x625a73-0x0;var _0x3eceb5=_0x98fc[_0x625a73];return _0x3eceb5;};'use strict';var _=require(_0xc98f('0x0'));var util=require(_0xc98f('0x1'));var moment=require(_0xc98f('0x2'));var BPromise=require(_0xc98f('0x3'));var rs=require(_0xc98f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc98f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc98f('0x6'))('rpc');var config=require(_0xc98f('0x7'));var jayson=require(_0xc98f('0x8'));var client=jayson[_0xc98f('0x9')][_0xc98f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3237e1,_0x1a8812,_0x28f276){return new BPromise(function(_0x191b3f,_0x12bdba){return client[_0xc98f('0xb')](_0x3237e1,_0x28f276)['then'](function(_0xb21d1a){logger['info'](_0xc98f('0xc'),_0x1a8812,_0xc98f('0xd'));logger[_0xc98f('0xe')](_0xc98f('0xf'),_0x1a8812,_0xc98f('0xd'),JSON['stringify'](_0xb21d1a));if(_0xb21d1a['error']){if(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x11')]===0x1f4){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')]['message']);return _0x12bdba(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}logger['error'](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);return _0x191b3f(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}else{logger[_0xc98f('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1a8812,_0xc98f('0xd'));_0x191b3f(_0xb21d1a[_0xc98f('0x14')]['message']);}})[_0xc98f('0x15')](function(_0x5ef39c){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0x5ef39c);_0x12bdba(_0x5ef39c);});});}exports['GetMailServerIn']=function(_0xbed285){var _0x838572=this;return new Promise(function(_0x19e873,_0x53b2e5){return db['MailServerIn'][_0xc98f('0x16')]({'raw':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')][_0xc98f('0x18')]===undefined?!![]:![]:!![],'where':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['where']||null:null,'attributes':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['attributes']||null:null,'limit':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')][_0xc98f('0x19')]||null:null,'include':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['include']?_[_0xc98f('0x1a')](_0xbed285[_0xc98f('0x17')][_0xc98f('0x1b')],function(_0x433576){return{'model':db[_0x433576[_0xc98f('0x1c')]],'as':_0x433576['as'],'attributes':_0x433576[_0xc98f('0x1d')],'include':_0x433576[_0xc98f('0x1b')]?_[_0xc98f('0x1a')](_0x433576[_0xc98f('0x1b')],function(_0x13c9c9){return{'model':db[_0x13c9c9[_0xc98f('0x1c')]],'as':_0x13c9c9['as'],'attributes':_0x13c9c9['attributes'],'include':_0x13c9c9[_0xc98f('0x1b')]?_[_0xc98f('0x1a')](_0x13c9c9[_0xc98f('0x1b')],function(_0x13f9e0){return{'model':db[_0x13f9e0[_0xc98f('0x1c')]],'as':_0x13f9e0['as'],'attributes':_0x13f9e0[_0xc98f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc98f('0x1e')](function(_0x297429){logger['info'](_0xc98f('0x1f'),_0xbed285);logger[_0xc98f('0xe')](_0xc98f('0x1f'),_0xbed285,JSON['stringify'](_0x297429));_0x19e873(_0x297429);})[_0xc98f('0x15')](function(_0x202500){logger[_0xc98f('0x10')](_0xc98f('0x1f'),_0x202500['message'],_0xbed285);_0x53b2e5(_0x838572[_0xc98f('0x10')](0x1f4,_0x202500['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4b9a612..484fc87 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x1f6f1f,_0x395b2c){_0x1f6f1f=_0x1f6f1f-0x0;var _0x1a65e9=_0x7a54[_0x1f6f1f];return _0x1a65e9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x394243,_0x5715f0){_0x394243=_0x394243-0x0;var _0x106fbc=_0x7a54[_0x394243];return _0x106fbc;};'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 0d212c5..47057a8 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 _0x1eba=['exports','STRING','BOOLEAN','sequelize'];(function(_0x14b123,_0x3986be){var _0x53db8e=function(_0x44e9dc){while(--_0x44e9dc){_0x14b123['push'](_0x14b123['shift']());}};_0x53db8e(++_0x3986be);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x1eba[_0x17406e];return _0x2bfc5a;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'description':{'type':Sequelize[_0xa1eb('0x2')]},'host':{'type':Sequelize[_0xa1eb('0x2')]},'user':{'type':Sequelize[_0xa1eb('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xa1eb('0x2')]},'authentication':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4cf8=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x5618a9,_0x2654f8){var _0x16ba86=function(_0x4924a5){while(--_0x4924a5){_0x5618a9['push'](_0x5618a9['shift']());}};_0x16ba86(++_0x2654f8);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x499d15,_0x5376c1){_0x499d15=_0x499d15-0x0;var _0x189291=_0x4cf8[_0x499d15];return _0x189291;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'description':{'type':Sequelize[_0x84cf('0x2')]},'host':{'type':Sequelize[_0x84cf('0x2')]},'user':{'type':Sequelize[_0x84cf('0x2')]},'pass':{'type':Sequelize[_0x84cf('0x2')]},'port':{'type':Sequelize[_0x84cf('0x3')]},'secure':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x84cf('0x2')]},'authentication':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2d936f8..7eb8d7a 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 _0x919f=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','update','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1cb36c,_0x6d6af7){var _0x3d7efc=function(_0x29979c){while(--_0x29979c){_0x1cb36c['push'](_0x1cb36c['shift']());}};_0x3d7efc(++_0x6d6af7);}(_0x919f,0xd7));var _0xf919=function(_0x724393,_0x1a9572){_0x724393=_0x724393-0x0;var _0x45aaf9=_0x919f[_0x724393];return _0x45aaf9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf919('0x0'));var jsonpatch=require(_0xf919('0x1'));var rp=require(_0xf919('0x2'));var moment=require(_0xf919('0x3'));var BPromise=require(_0xf919('0x4'));var Mustache=require(_0xf919('0x5'));var util=require(_0xf919('0x6'));var path=require('path');var sox=require(_0xf919('0x7'));var csv=require(_0xf919('0x8'));var ejs=require(_0xf919('0x9'));var fs=require('fs');var fs_extra=require(_0xf919('0xa'));var _=require(_0xf919('0xb'));var squel=require('squel');var crypto=require(_0xf919('0xc'));var jsforce=require(_0xf919('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf919('0x8'));var querystring=require(_0xf919('0xe'));var Papa=require(_0xf919('0xf'));var Redis=require('ioredis');var authService=require(_0xf919('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf919('0x11'));var utils=require(_0xf919('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf919('0x13'));var db=require(_0xf919('0x14'))['db'];function respondWithStatusCode(_0x2f8615,_0xe35202){_0xe35202=_0xe35202||0xcc;return function(_0x127e1e){if(_0x127e1e){return _0x2f8615[_0xf919('0x15')](_0xe35202);}return _0x2f8615['status'](_0xe35202)[_0xf919('0x16')]();};}function respondWithResult(_0x3c72f2,_0x161bb4){_0x161bb4=_0x161bb4||0xc8;return function(_0x273059){if(_0x273059){return _0x3c72f2[_0xf919('0x17')](_0x161bb4)[_0xf919('0x18')](_0x273059);}};}function respondWithFilteredResult(_0x583fb8,_0x22e6c9){return function(_0x2192a1){if(_0x2192a1){var _0x106969=typeof _0x22e6c9['offset']===_0xf919('0x19')&&typeof _0x22e6c9[_0xf919('0x1a')]===_0xf919('0x19');var _0x3b5227=_0x2192a1[_0xf919('0x1b')];var _0x5d7977=_0x106969?0x0:_0x22e6c9[_0xf919('0x1c')];var _0x5328c2=_0x106969?_0x2192a1['count']:_0x22e6c9[_0xf919('0x1c')]+_0x22e6c9[_0xf919('0x1a')];var _0x2125ca;if(_0x5328c2>=_0x3b5227){_0x5328c2=_0x3b5227;_0x2125ca=0xc8;}else{_0x2125ca=0xce;}_0x583fb8[_0xf919('0x17')](_0x2125ca);return _0x583fb8[_0xf919('0x1d')](_0xf919('0x1e'),_0x5d7977+'-'+_0x5328c2+'/'+_0x3b5227)['json'](_0x2192a1);}return null;};}function patchUpdates(_0x67de07){return function(_0x5723b3){try{jsonpatch[_0xf919('0x1f')](_0x5723b3,_0x67de07,!![]);}catch(_0x4f5296){return BPromise[_0xf919('0x20')](_0x4f5296);}return _0x5723b3[_0xf919('0x21')]();};}function saveUpdates(_0x4c5b4c,_0xc376e0){return function(_0x2d4c4b){if(_0x2d4c4b){return _0x2d4c4b['update'](_0x4c5b4c)['then'](function(_0x24e7a5){return _0x24e7a5;});}return null;};}function removeEntity(_0x36b769,_0x5ea793){return function(_0x184c58){if(_0x184c58){return _0x184c58[_0xf919('0x22')]()[_0xf919('0x23')](function(){_0x36b769[_0xf919('0x17')](0xcc)[_0xf919('0x16')]();});}};}function handleEntityNotFound(_0x46ecf5,_0x384548){return function(_0x31ff6b){if(!_0x31ff6b){_0x46ecf5[_0xf919('0x15')](0x194);}return _0x31ff6b;};}function handleError(_0x242948,_0x3c1d95){_0x3c1d95=_0x3c1d95||0x1f4;return function(_0x22d990){logger[_0xf919('0x24')](_0x22d990[_0xf919('0x25')]);if(_0x22d990[_0xf919('0x26')]){delete _0x22d990['name'];}_0x242948['status'](_0x3c1d95)['send'](_0x22d990);};}exports[_0xf919('0x27')]=function(_0x46b19a,_0xe852d4){var _0x4066aa={},_0x1575a4={},_0x3648f4={'count':0x0,'rows':[]};var _0x1b69be=_[_0xf919('0x28')](db[_0xf919('0x29')][_0xf919('0x2a')],function(_0x4fcba4){return{'name':_0x4fcba4[_0xf919('0x2b')],'type':_0x4fcba4[_0xf919('0x2c')][_0xf919('0x2d')]};});_0x1575a4[_0xf919('0x2e')]=_[_0xf919('0x28')](_0x1b69be,_0xf919('0x26'));_0x1575a4[_0xf919('0x2f')]=_[_0xf919('0x30')](_0x46b19a[_0xf919('0x2f')]);_0x1575a4[_0xf919('0x31')]=_['intersection'](_0x1575a4[_0xf919('0x2e')],_0x1575a4[_0xf919('0x2f')]);_0x4066aa[_0xf919('0x32')]=_[_0xf919('0x33')](_0x1575a4[_0xf919('0x2e')],qs['fields'](_0x46b19a[_0xf919('0x2f')][_0xf919('0x34')]));_0x4066aa[_0xf919('0x32')]=_0x4066aa[_0xf919('0x32')][_0xf919('0x35')]?_0x4066aa['attributes']:_0x1575a4[_0xf919('0x2e')];if(!_0x46b19a[_0xf919('0x2f')][_0xf919('0x36')](_0xf919('0x37'))){_0x4066aa[_0xf919('0x1a')]=qs[_0xf919('0x1a')](_0x46b19a[_0xf919('0x2f')]['limit']);_0x4066aa[_0xf919('0x1c')]=qs[_0xf919('0x1c')](_0x46b19a['query'][_0xf919('0x1c')]);}_0x4066aa[_0xf919('0x38')]=qs[_0xf919('0x39')](_0x46b19a[_0xf919('0x2f')]['sort']);_0x4066aa[_0xf919('0x3a')]=qs[_0xf919('0x31')](_[_0xf919('0x3b')](_0x46b19a[_0xf919('0x2f')],_0x1575a4[_0xf919('0x31')]),_0x1b69be);if(_0x46b19a[_0xf919('0x2f')][_0xf919('0x3c')]){_0x4066aa['where']=_[_0xf919('0x3d')](_0x4066aa[_0xf919('0x3a')],{'$or':_[_0xf919('0x28')](_0x1b69be,function(_0x41b43d){if(_0x41b43d['type']!==_0xf919('0x3e')){var _0x4638b6={};_0x4638b6[_0x41b43d[_0xf919('0x26')]]={'$like':'%'+_0x46b19a[_0xf919('0x2f')][_0xf919('0x3c')]+'%'};return _0x4638b6;}})});}_0x4066aa=_['merge']({},_0x4066aa,_0x46b19a[_0xf919('0x3f')]);var _0x53d4f9={'where':_0x4066aa[_0xf919('0x3a')]};return db[_0xf919('0x29')][_0xf919('0x1b')](_0x53d4f9)[_0xf919('0x23')](function(_0x5d3a88){_0x3648f4[_0xf919('0x1b')]=_0x5d3a88;if(_0x46b19a[_0xf919('0x2f')][_0xf919('0x40')]){_0x4066aa[_0xf919('0x41')]=[{'all':!![]}];}return db[_0xf919('0x29')]['findAll'](_0x4066aa);})[_0xf919('0x23')](function(_0x5cf11c){_0x3648f4[_0xf919('0x42')]=_0x5cf11c;return _0x3648f4;})['then'](respondWithFilteredResult(_0xe852d4,_0x4066aa))[_0xf919('0x43')](handleError(_0xe852d4,null));};exports[_0xf919('0x44')]=function(_0x52f283,_0x590e07){var _0x2a6f4e={'raw':!![],'where':{'id':_0x52f283[_0xf919('0x45')]['id']}},_0x15dae1={};_0x15dae1[_0xf919('0x2e')]=_[_0xf919('0x30')](db[_0xf919('0x29')][_0xf919('0x2a')]);_0x15dae1['query']=_['keys'](_0x52f283[_0xf919('0x2f')]);_0x15dae1[_0xf919('0x31')]=_[_0xf919('0x33')](_0x15dae1[_0xf919('0x2e')],_0x15dae1['query']);_0x2a6f4e['attributes']=_[_0xf919('0x33')](_0x15dae1[_0xf919('0x2e')],qs['fields'](_0x52f283[_0xf919('0x2f')][_0xf919('0x34')]));_0x2a6f4e[_0xf919('0x32')]=_0x2a6f4e[_0xf919('0x32')][_0xf919('0x35')]?_0x2a6f4e[_0xf919('0x32')]:_0x15dae1['model'];if(_0x52f283[_0xf919('0x2f')]['includeAll']){_0x2a6f4e[_0xf919('0x41')]=[{'all':!![]}];}_0x2a6f4e=_['merge']({},_0x2a6f4e,_0x52f283['options']);return db[_0xf919('0x29')]['find'](_0x2a6f4e)['then'](handleEntityNotFound(_0x590e07,null))[_0xf919('0x23')](respondWithResult(_0x590e07,null))['catch'](handleError(_0x590e07,null));};exports[_0xf919('0x46')]=function(_0x1e0c46,_0x198058){return db[_0xf919('0x29')]['create'](_0x1e0c46['body'],{})['then'](respondWithResult(_0x198058,0xc9))[_0xf919('0x43')](handleError(_0x198058,null));};exports[_0xf919('0x47')]=function(_0x16ade4,_0x1f8922){if(_0x16ade4[_0xf919('0x48')]['id']){delete _0x16ade4[_0xf919('0x48')]['id'];}return db[_0xf919('0x29')][_0xf919('0x49')]({'where':{'id':_0x16ade4[_0xf919('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f8922,null))[_0xf919('0x23')](saveUpdates(_0x16ade4['body'],null))[_0xf919('0x23')](respondWithResult(_0x1f8922,null))[_0xf919('0x43')](handleError(_0x1f8922,null));};exports[_0xf919('0x22')]=function(_0x16ac78,_0x3580ad){return db[_0xf919('0x29')][_0xf919('0x49')]({'where':{'id':_0x16ac78[_0xf919('0x45')]['id']}})[_0xf919('0x23')](handleEntityNotFound(_0x3580ad,null))[_0xf919('0x23')](removeEntity(_0x3580ad,null))[_0xf919('0x43')](handleError(_0x3580ad,null));}; \ No newline at end of file +var _0xfc18=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5877ec,_0x1b418b){var _0x37b1b9=function(_0x25bf9d){while(--_0x25bf9d){_0x5877ec['push'](_0x5877ec['shift']());}};_0x37b1b9(++_0x1b418b);}(_0xfc18,0x17f));var _0x8fc1=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xfc18[_0xa8883];return _0x479426;};'use strict';var emlformat=require(_0x8fc1('0x0'));var rimraf=require(_0x8fc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fc1('0x2'));var rp=require(_0x8fc1('0x3'));var moment=require(_0x8fc1('0x4'));var BPromise=require(_0x8fc1('0x5'));var Mustache=require(_0x8fc1('0x6'));var util=require(_0x8fc1('0x7'));var path=require(_0x8fc1('0x8'));var sox=require(_0x8fc1('0x9'));var csv=require(_0x8fc1('0xa'));var ejs=require(_0x8fc1('0xb'));var fs=require('fs');var fs_extra=require(_0x8fc1('0xc'));var _=require(_0x8fc1('0xd'));var squel=require(_0x8fc1('0xe'));var crypto=require(_0x8fc1('0xf'));var jsforce=require(_0x8fc1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8fc1('0xa'));var querystring=require(_0x8fc1('0x11'));var Papa=require('papaparse');var Redis=require(_0x8fc1('0x12'));var authService=require(_0x8fc1('0x13'));var qs=require(_0x8fc1('0x14'));var as=require(_0x8fc1('0x15'));var hardwareService=require(_0x8fc1('0x16'));var logger=require(_0x8fc1('0x17'))('api');var utils=require(_0x8fc1('0x18'));var config=require(_0x8fc1('0x19'));var licenseUtil=require(_0x8fc1('0x1a'));var db=require(_0x8fc1('0x1b'))['db'];function respondWithStatusCode(_0x563539,_0x4b89dd){_0x4b89dd=_0x4b89dd||0xcc;return function(_0xac268a){if(_0xac268a){return _0x563539[_0x8fc1('0x1c')](_0x4b89dd);}return _0x563539['status'](_0x4b89dd)[_0x8fc1('0x1d')]();};}function respondWithResult(_0x2b6df6,_0x122fd7){_0x122fd7=_0x122fd7||0xc8;return function(_0x506a4b){if(_0x506a4b){return _0x2b6df6[_0x8fc1('0x1e')](_0x122fd7)[_0x8fc1('0x1f')](_0x506a4b);}};}function respondWithFilteredResult(_0x4d458b,_0x3ce63e){return function(_0x406094){if(_0x406094){var _0x1cca61=typeof _0x3ce63e[_0x8fc1('0x20')]===_0x8fc1('0x21')&&typeof _0x3ce63e[_0x8fc1('0x22')]===_0x8fc1('0x21');var _0x572aa3=_0x406094[_0x8fc1('0x23')];var _0x8c076c=_0x1cca61?0x0:_0x3ce63e[_0x8fc1('0x20')];var _0x471b20=_0x1cca61?_0x406094[_0x8fc1('0x23')]:_0x3ce63e[_0x8fc1('0x20')]+_0x3ce63e[_0x8fc1('0x22')];var _0x2601da;if(_0x471b20>=_0x572aa3){_0x471b20=_0x572aa3;_0x2601da=0xc8;}else{_0x2601da=0xce;}_0x4d458b[_0x8fc1('0x1e')](_0x2601da);return _0x4d458b[_0x8fc1('0x24')](_0x8fc1('0x25'),_0x8c076c+'-'+_0x471b20+'/'+_0x572aa3)[_0x8fc1('0x1f')](_0x406094);}return null;};}function patchUpdates(_0x57bca7){return function(_0x4fd68b){try{jsonpatch[_0x8fc1('0x26')](_0x4fd68b,_0x57bca7,!![]);}catch(_0x424f05){return BPromise[_0x8fc1('0x27')](_0x424f05);}return _0x4fd68b['save']();};}function saveUpdates(_0x5c5731,_0x3c2885){return function(_0x5da326){if(_0x5da326){return _0x5da326[_0x8fc1('0x28')](_0x5c5731)[_0x8fc1('0x29')](function(_0x41cb26){return _0x41cb26;});}return null;};}function removeEntity(_0x5f3e23,_0x289797){return function(_0x3f17fa){if(_0x3f17fa){return _0x3f17fa['destroy']()[_0x8fc1('0x29')](function(){_0x5f3e23[_0x8fc1('0x1e')](0xcc)[_0x8fc1('0x1d')]();});}};}function handleEntityNotFound(_0x166051,_0x31afe3){return function(_0x16670e){if(!_0x16670e){_0x166051['sendStatus'](0x194);}return _0x16670e;};}function handleError(_0x1be6ba,_0x73d0ca){_0x73d0ca=_0x73d0ca||0x1f4;return function(_0x5efb03){logger[_0x8fc1('0x2a')](_0x5efb03[_0x8fc1('0x2b')]);if(_0x5efb03[_0x8fc1('0x2c')]){delete _0x5efb03[_0x8fc1('0x2c')];}_0x1be6ba[_0x8fc1('0x1e')](_0x73d0ca)[_0x8fc1('0x2d')](_0x5efb03);};}exports['index']=function(_0x19e942,_0x789224){var _0x128e5a={},_0x4faa4a={},_0x47d887={'count':0x0,'rows':[]};var _0x1a4c2a=_[_0x8fc1('0x2e')](db[_0x8fc1('0x2f')][_0x8fc1('0x30')],function(_0x4e38a1){return{'name':_0x4e38a1[_0x8fc1('0x31')],'type':_0x4e38a1['type'][_0x8fc1('0x32')]};});_0x4faa4a[_0x8fc1('0x33')]=_[_0x8fc1('0x2e')](_0x1a4c2a,'name');_0x4faa4a[_0x8fc1('0x34')]=_[_0x8fc1('0x35')](_0x19e942['query']);_0x4faa4a['filters']=_[_0x8fc1('0x36')](_0x4faa4a[_0x8fc1('0x33')],_0x4faa4a[_0x8fc1('0x34')]);_0x128e5a[_0x8fc1('0x37')]=_[_0x8fc1('0x36')](_0x4faa4a[_0x8fc1('0x33')],qs[_0x8fc1('0x38')](_0x19e942[_0x8fc1('0x34')]['fields']));_0x128e5a[_0x8fc1('0x37')]=_0x128e5a['attributes'][_0x8fc1('0x39')]?_0x128e5a['attributes']:_0x4faa4a[_0x8fc1('0x33')];if(!_0x19e942[_0x8fc1('0x34')]['hasOwnProperty'](_0x8fc1('0x3a'))){_0x128e5a[_0x8fc1('0x22')]=qs['limit'](_0x19e942['query'][_0x8fc1('0x22')]);_0x128e5a[_0x8fc1('0x20')]=qs[_0x8fc1('0x20')](_0x19e942[_0x8fc1('0x34')]['offset']);}_0x128e5a[_0x8fc1('0x3b')]=qs[_0x8fc1('0x3c')](_0x19e942[_0x8fc1('0x34')][_0x8fc1('0x3c')]);_0x128e5a[_0x8fc1('0x3d')]=qs[_0x8fc1('0x3e')](_[_0x8fc1('0x3f')](_0x19e942[_0x8fc1('0x34')],_0x4faa4a[_0x8fc1('0x3e')]),_0x1a4c2a);if(_0x19e942['query'][_0x8fc1('0x40')]){_0x128e5a['where']=_[_0x8fc1('0x41')](_0x128e5a[_0x8fc1('0x3d')],{'$or':_[_0x8fc1('0x2e')](_0x1a4c2a,function(_0x2d4970){if(_0x2d4970[_0x8fc1('0x42')]!=='VIRTUAL'){var _0xf469d7={};_0xf469d7[_0x2d4970[_0x8fc1('0x2c')]]={'$like':'%'+_0x19e942[_0x8fc1('0x34')]['filter']+'%'};return _0xf469d7;}})});}_0x128e5a=_[_0x8fc1('0x41')]({},_0x128e5a,_0x19e942['options']);var _0x53ba3c={'where':_0x128e5a[_0x8fc1('0x3d')]};return db[_0x8fc1('0x2f')][_0x8fc1('0x23')](_0x53ba3c)[_0x8fc1('0x29')](function(_0x250d1b){_0x47d887['count']=_0x250d1b;if(_0x19e942['query'][_0x8fc1('0x43')]){_0x128e5a[_0x8fc1('0x44')]=[{'all':!![]}];}return db[_0x8fc1('0x2f')][_0x8fc1('0x45')](_0x128e5a);})['then'](function(_0x2bda00){_0x47d887[_0x8fc1('0x46')]=_0x2bda00;return _0x47d887;})[_0x8fc1('0x29')](respondWithFilteredResult(_0x789224,_0x128e5a))[_0x8fc1('0x47')](handleError(_0x789224,null));};exports[_0x8fc1('0x48')]=function(_0x284147,_0x47cac3){var _0x10f32f={'raw':!![],'where':{'id':_0x284147[_0x8fc1('0x49')]['id']}},_0x1c31b7={};_0x1c31b7[_0x8fc1('0x33')]=_['keys'](db[_0x8fc1('0x2f')][_0x8fc1('0x30')]);_0x1c31b7[_0x8fc1('0x34')]=_['keys'](_0x284147[_0x8fc1('0x34')]);_0x1c31b7[_0x8fc1('0x3e')]=_[_0x8fc1('0x36')](_0x1c31b7['model'],_0x1c31b7[_0x8fc1('0x34')]);_0x10f32f[_0x8fc1('0x37')]=_[_0x8fc1('0x36')](_0x1c31b7['model'],qs['fields'](_0x284147[_0x8fc1('0x34')][_0x8fc1('0x38')]));_0x10f32f['attributes']=_0x10f32f['attributes']['length']?_0x10f32f[_0x8fc1('0x37')]:_0x1c31b7[_0x8fc1('0x33')];if(_0x284147[_0x8fc1('0x34')][_0x8fc1('0x43')]){_0x10f32f['include']=[{'all':!![]}];}_0x10f32f=_[_0x8fc1('0x41')]({},_0x10f32f,_0x284147['options']);return db['MailServerOut'][_0x8fc1('0x4a')](_0x10f32f)[_0x8fc1('0x29')](handleEntityNotFound(_0x47cac3,null))[_0x8fc1('0x29')](respondWithResult(_0x47cac3,null))[_0x8fc1('0x47')](handleError(_0x47cac3,null));};exports[_0x8fc1('0x4b')]=function(_0x104e35,_0x7918d5){return db['MailServerOut'][_0x8fc1('0x4b')](_0x104e35[_0x8fc1('0x4c')],{})['then'](respondWithResult(_0x7918d5,0xc9))[_0x8fc1('0x47')](handleError(_0x7918d5,null));};exports['update']=function(_0x767991,_0x292bf7){if(_0x767991[_0x8fc1('0x4c')]['id']){delete _0x767991[_0x8fc1('0x4c')]['id'];}return db['MailServerOut'][_0x8fc1('0x4a')]({'where':{'id':_0x767991[_0x8fc1('0x49')]['id']}})[_0x8fc1('0x29')](handleEntityNotFound(_0x292bf7,null))['then'](saveUpdates(_0x767991[_0x8fc1('0x4c')],null))[_0x8fc1('0x29')](respondWithResult(_0x292bf7,null))[_0x8fc1('0x47')](handleError(_0x292bf7,null));};exports[_0x8fc1('0x4d')]=function(_0x1e5685,_0x30decd){return db['MailServerOut']['find']({'where':{'id':_0x1e5685[_0x8fc1('0x49')]['id']}})[_0x8fc1('0x29')](handleEntityNotFound(_0x30decd,null))[_0x8fc1('0x29')](removeEntity(_0x30decd,null))[_0x8fc1('0x47')](handleError(_0x30decd,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4b9956d..39e9228 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 _0xd1de=['mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x3b1c1b,_0xf2b398){var _0x449d25=function(_0x544f7a){while(--_0x544f7a){_0x3b1c1b['push'](_0x3b1c1b['shift']());}};_0x449d25(++_0xf2b398);}(_0xd1de,0x1a1));var _0xed1d=function(_0x408a51,_0x44fb61){_0x408a51=_0x408a51-0x0;var _0x54f211=_0xd1de[_0x408a51];return _0x54f211;};'use strict';var _=require(_0xed1d('0x0'));var util=require('util');var logger=require(_0xed1d('0x1'))(_0xed1d('0x2'));var moment=require(_0xed1d('0x3'));var BPromise=require(_0xed1d('0x4'));var rp=require(_0xed1d('0x5'));var fs=require('fs');var path=require(_0xed1d('0x6'));var rimraf=require(_0xed1d('0x7'));var config=require(_0xed1d('0x8'));var attributes=require(_0xed1d('0x9'));module[_0xed1d('0xa')]=function(_0x279e99,_0x12bd83){return _0x279e99['define'](_0xed1d('0xb'),attributes,{'tableName':_0xed1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ad4=['api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x1fbb56,_0x22b4f8){var _0x562df4=function(_0x3f6958){while(--_0x3f6958){_0x1fbb56['push'](_0x1fbb56['shift']());}};_0x562df4(++_0x22b4f8);}(_0x9ad4,0x190));var _0x49ad=function(_0x526298,_0x2ec3ba){_0x526298=_0x526298-0x0;var _0x467835=_0x9ad4[_0x526298];return _0x467835;};'use strict';var _=require(_0x49ad('0x0'));var util=require(_0x49ad('0x1'));var logger=require(_0x49ad('0x2'))(_0x49ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x49ad('0x4'));var fs=require('fs');var path=require(_0x49ad('0x5'));var rimraf=require(_0x49ad('0x6'));var config=require(_0x49ad('0x7'));var attributes=require(_0x49ad('0x8'));module[_0x49ad('0x9')]=function(_0x52f25f,_0x1af052){return _0x52f25f[_0x49ad('0xa')](_0x49ad('0xb'),attributes,{'tableName':_0x49ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9f1c8cf..c4572de 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5e8721,_0x378840){var _0xc78d88=function(_0x3dbff7){while(--_0x3dbff7){_0x5e8721['push'](_0x5e8721['shift']());}};_0xc78d88(++_0x378840);}(_0xadb5,0xad));var _0x5adb=function(_0x285032,_0x529248){_0x285032=_0x285032-0x0;var _0x1ed72a=_0xadb5[_0x285032];return _0x1ed72a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x5017a2,_0x17f919){_0x5017a2=_0x5017a2-0x0;var _0x11449a=_0x7a54[_0x5017a2];return _0x11449a;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1a346a4..020e6ce 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 _0xae68=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','update','delete','destroy'];(function(_0x48be61,_0x204c04){var _0x55fcd9=function(_0x5a9c6b){while(--_0x5a9c6b){_0x48be61['push'](_0x48be61['shift']());}};_0x55fcd9(++_0x204c04);}(_0xae68,0x133));var _0x8ae6=function(_0x19a4ac,_0x5d763d){_0x19a4ac=_0x19a4ac-0x0;var _0x8f3876=_0xae68[_0x19a4ac];return _0x8f3876;};'use strict';var multer=require(_0x8ae6('0x0'));var util=require('util');var path=require(_0x8ae6('0x1'));var timeout=require(_0x8ae6('0x2'));var express=require(_0x8ae6('0x3'));var router=express[_0x8ae6('0x4')]();var fs_extra=require(_0x8ae6('0x5'));var auth=require(_0x8ae6('0x6'));var interaction=require(_0x8ae6('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8ae6('0x8')]);router[_0x8ae6('0x9')](_0x8ae6('0xa'),auth[_0x8ae6('0xb')](),controller[_0x8ae6('0xc')]);router[_0x8ae6('0x9')](_0x8ae6('0xd'),auth[_0x8ae6('0xb')](),controller['show']);router['post']('/',auth[_0x8ae6('0xb')](),controller['create']);router['put'](_0x8ae6('0xd'),auth[_0x8ae6('0xb')](),controller[_0x8ae6('0xe')]);router[_0x8ae6('0xf')]('/:id',auth[_0x8ae6('0xb')](),controller[_0x8ae6('0x10')]);module[_0x8ae6('0x11')]=router; \ No newline at end of file +var _0x50c5=['destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','post','create'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x50c5,0xbd));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x550c('0x0'));var path=require('path');var timeout=require(_0x550c('0x1'));var express=require('express');var router=express[_0x550c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x550c('0x3'));var interaction=require(_0x550c('0x4'));var config=require(_0x550c('0x5'));var controller=require(_0x550c('0x6'));router['get']('/',auth[_0x550c('0x7')](),controller[_0x550c('0x8')]);router[_0x550c('0x9')]('/describe',auth[_0x550c('0x7')](),controller[_0x550c('0xa')]);router[_0x550c('0x9')](_0x550c('0xb'),auth[_0x550c('0x7')](),controller[_0x550c('0xc')]);router[_0x550c('0xd')]('/',auth[_0x550c('0x7')](),controller[_0x550c('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x550c('0xb'),auth[_0x550c('0x7')](),controller[_0x550c('0xf')]);module[_0x550c('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 117798e..5d47f75 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 _0x83d0=['exports','STRING','name','sequelize'];(function(_0x486f8b,_0x11608c){var _0x37a64c=function(_0x41a8d6){while(--_0x41a8d6){_0x486f8b['push'](_0x486f8b['shift']());}};_0x37a64c(++_0x11608c);}(_0x83d0,0xb7));var _0x083d=function(_0x5cd79e,_0x2c6b4e){_0x5cd79e=_0x5cd79e-0x0;var _0x3b394c=_0x83d0[_0x5cd79e];return _0x3b394c;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize[_0x083d('0x2')],'unique':_0x083d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x083d('0x2')]}}; \ No newline at end of file +var _0x885a=['exports','STRING','name'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'name':{'type':Sequelize[_0xa885('0x1')],'unique':_0xa885('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa885('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9cc5d3d..0f33e6a 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 _0x6d57=['merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x6d57,0x1d9));var _0x76d5=function(_0x243f7e,_0x20f844){_0x243f7e=_0x243f7e-0x0;var _0x18fc25=_0x6d57[_0x243f7e];return _0x18fc25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76d5('0x1'));var rp=require(_0x76d5('0x2'));var moment=require(_0x76d5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76d5('0x4'));var path=require(_0x76d5('0x5'));var sox=require(_0x76d5('0x6'));var csv=require(_0x76d5('0x7'));var ejs=require(_0x76d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76d5('0x9'));var squel=require(_0x76d5('0xa'));var crypto=require(_0x76d5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x76d5('0xc'));var Papa=require(_0x76d5('0xd'));var Redis=require(_0x76d5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x76d5('0xf'));var as=require(_0x76d5('0x10'));var hardwareService=require(_0x76d5('0x11'));var logger=require(_0x76d5('0x12'))(_0x76d5('0x13'));var utils=require(_0x76d5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x76d5('0x15'));var db=require(_0x76d5('0x16'))['db'];function respondWithStatusCode(_0x492d0b,_0x2e5cb0){_0x2e5cb0=_0x2e5cb0||0xcc;return function(_0x2e59b1){if(_0x2e59b1){return _0x492d0b['sendStatus'](_0x2e5cb0);}return _0x492d0b[_0x76d5('0x17')](_0x2e5cb0)[_0x76d5('0x18')]();};}function respondWithResult(_0x5d8c91,_0x3ac82a){_0x3ac82a=_0x3ac82a||0xc8;return function(_0x912cb0){if(_0x912cb0){return _0x5d8c91[_0x76d5('0x17')](_0x3ac82a)[_0x76d5('0x19')](_0x912cb0);}};}function respondWithFilteredResult(_0x411386,_0x521de0){return function(_0x52dbb7){if(_0x52dbb7){var _0x5e3b4b=typeof _0x521de0[_0x76d5('0x1a')]===_0x76d5('0x1b')&&typeof _0x521de0['limit']===_0x76d5('0x1b');var _0x5af205=_0x52dbb7[_0x76d5('0x1c')];var _0x5f1c6c=_0x5e3b4b?0x0:_0x521de0[_0x76d5('0x1a')];var _0x3a0bda=_0x5e3b4b?_0x52dbb7['count']:_0x521de0[_0x76d5('0x1a')]+_0x521de0[_0x76d5('0x1d')];var _0x3d979d;if(_0x3a0bda>=_0x5af205){_0x3a0bda=_0x5af205;_0x3d979d=0xc8;}else{_0x3d979d=0xce;}_0x411386[_0x76d5('0x17')](_0x3d979d);return _0x411386[_0x76d5('0x1e')](_0x76d5('0x1f'),_0x5f1c6c+'-'+_0x3a0bda+'/'+_0x5af205)[_0x76d5('0x19')](_0x52dbb7);}return null;};}function patchUpdates(_0x4b061d){return function(_0x5957ab){try{jsonpatch[_0x76d5('0x20')](_0x5957ab,_0x4b061d,!![]);}catch(_0x5161f3){return BPromise[_0x76d5('0x21')](_0x5161f3);}return _0x5957ab[_0x76d5('0x22')]();};}function saveUpdates(_0x3be5ee,_0x52d78b){return function(_0x4d52b9){if(_0x4d52b9){return _0x4d52b9[_0x76d5('0x23')](_0x3be5ee)[_0x76d5('0x24')](function(_0x4ed17c){return _0x4ed17c;});}return null;};}function removeEntity(_0x12b87b,_0x53298c){return function(_0x573026){if(_0x573026){return _0x573026['destroy']()['then'](function(){_0x12b87b['status'](0xcc)[_0x76d5('0x18')]();});}};}function handleEntityNotFound(_0x1f980b,_0x52788f){return function(_0x5895bb){if(!_0x5895bb){_0x1f980b[_0x76d5('0x25')](0x194);}return _0x5895bb;};}function handleError(_0x58fbe6,_0x2e8359){_0x2e8359=_0x2e8359||0x1f4;return function(_0x6a0d5f){logger[_0x76d5('0x26')](_0x6a0d5f[_0x76d5('0x27')]);if(_0x6a0d5f['name']){delete _0x6a0d5f[_0x76d5('0x28')];}_0x58fbe6[_0x76d5('0x17')](_0x2e8359)['send'](_0x6a0d5f);};}exports[_0x76d5('0x29')]=function(_0x191b0e,_0xc5b1ad){var _0x48b630={},_0x211b74={},_0xdf602e={'count':0x0,'rows':[]};var _0x2e72d2=_[_0x76d5('0x2a')](db[_0x76d5('0x2b')]['rawAttributes'],function(_0x46c9eb){return{'name':_0x46c9eb[_0x76d5('0x2c')],'type':_0x46c9eb[_0x76d5('0x2d')][_0x76d5('0x2e')]};});_0x211b74[_0x76d5('0x2f')]=_[_0x76d5('0x2a')](_0x2e72d2,_0x76d5('0x28'));_0x211b74['query']=_['keys'](_0x191b0e[_0x76d5('0x30')]);_0x211b74['filters']=_[_0x76d5('0x31')](_0x211b74[_0x76d5('0x2f')],_0x211b74[_0x76d5('0x30')]);_0x48b630[_0x76d5('0x32')]=_['intersection'](_0x211b74[_0x76d5('0x2f')],qs[_0x76d5('0x33')](_0x191b0e[_0x76d5('0x30')][_0x76d5('0x33')]));_0x48b630[_0x76d5('0x32')]=_0x48b630['attributes']['length']?_0x48b630['attributes']:_0x211b74[_0x76d5('0x2f')];if(!_0x191b0e['query'][_0x76d5('0x34')](_0x76d5('0x35'))){_0x48b630[_0x76d5('0x1d')]=qs[_0x76d5('0x1d')](_0x191b0e[_0x76d5('0x30')][_0x76d5('0x1d')]);_0x48b630[_0x76d5('0x1a')]=qs[_0x76d5('0x1a')](_0x191b0e[_0x76d5('0x30')][_0x76d5('0x1a')]);}_0x48b630[_0x76d5('0x36')]=qs[_0x76d5('0x37')](_0x191b0e[_0x76d5('0x30')][_0x76d5('0x37')]);_0x48b630[_0x76d5('0x38')]=qs[_0x76d5('0x39')](_['pick'](_0x191b0e[_0x76d5('0x30')],_0x211b74[_0x76d5('0x39')]),_0x2e72d2);if(_0x191b0e[_0x76d5('0x30')][_0x76d5('0x3a')]){_0x48b630['where']=_[_0x76d5('0x3b')](_0x48b630[_0x76d5('0x38')],{'$or':_[_0x76d5('0x2a')](_0x2e72d2,function(_0x34b047){if(_0x34b047['type']!==_0x76d5('0x3c')){var _0x2cc70a={};_0x2cc70a[_0x34b047[_0x76d5('0x28')]]={'$like':'%'+_0x191b0e[_0x76d5('0x30')]['filter']+'%'};return _0x2cc70a;}})});}_0x48b630=_[_0x76d5('0x3b')]({},_0x48b630,_0x191b0e[_0x76d5('0x3d')]);var _0x116e25={'where':_0x48b630[_0x76d5('0x38')]};return db[_0x76d5('0x2b')][_0x76d5('0x1c')](_0x116e25)['then'](function(_0x566765){_0xdf602e[_0x76d5('0x1c')]=_0x566765;if(_0x191b0e[_0x76d5('0x30')]['includeAll']){_0x48b630[_0x76d5('0x3e')]=[{'all':!![]}];}return db[_0x76d5('0x2b')][_0x76d5('0x3f')](_0x48b630);})[_0x76d5('0x24')](function(_0x1f4cca){_0xdf602e[_0x76d5('0x40')]=_0x1f4cca;return _0xdf602e;})[_0x76d5('0x24')](respondWithFilteredResult(_0xc5b1ad,_0x48b630))[_0x76d5('0x41')](handleError(_0xc5b1ad,null));};exports[_0x76d5('0x42')]=function(_0x59dfda,_0x3fd89a){var _0x4b1e62={'raw':!![],'where':{'id':_0x59dfda[_0x76d5('0x43')]['id']}},_0x417e31={};_0x417e31['model']=_[_0x76d5('0x44')](db[_0x76d5('0x2b')][_0x76d5('0x45')]);_0x417e31['query']=_['keys'](_0x59dfda[_0x76d5('0x30')]);_0x417e31[_0x76d5('0x39')]=_['intersection'](_0x417e31['model'],_0x417e31[_0x76d5('0x30')]);_0x4b1e62[_0x76d5('0x32')]=_['intersection'](_0x417e31[_0x76d5('0x2f')],qs[_0x76d5('0x33')](_0x59dfda[_0x76d5('0x30')][_0x76d5('0x33')]));_0x4b1e62['attributes']=_0x4b1e62[_0x76d5('0x32')][_0x76d5('0x46')]?_0x4b1e62[_0x76d5('0x32')]:_0x417e31[_0x76d5('0x2f')];if(_0x59dfda['query'][_0x76d5('0x47')]){_0x4b1e62[_0x76d5('0x3e')]=[{'all':!![]}];}_0x4b1e62=_[_0x76d5('0x3b')]({},_0x4b1e62,_0x59dfda['options']);return db[_0x76d5('0x2b')][_0x76d5('0x48')](_0x4b1e62)['then'](handleEntityNotFound(_0x3fd89a,null))['then'](respondWithResult(_0x3fd89a,null))[_0x76d5('0x41')](handleError(_0x3fd89a,null));};exports['create']=function(_0x266edd,_0x9cbb65){return db[_0x76d5('0x2b')][_0x76d5('0x49')](_0x266edd['body'],{})[_0x76d5('0x24')](respondWithResult(_0x9cbb65,0xc9))[_0x76d5('0x41')](handleError(_0x9cbb65,null));};exports['update']=function(_0x4db63a,_0x50f5cf){if(_0x4db63a['body']['id']){delete _0x4db63a[_0x76d5('0x4a')]['id'];}return db[_0x76d5('0x2b')][_0x76d5('0x48')]({'where':{'id':_0x4db63a['params']['id']}})[_0x76d5('0x24')](handleEntityNotFound(_0x50f5cf,null))[_0x76d5('0x24')](saveUpdates(_0x4db63a['body'],null))[_0x76d5('0x24')](respondWithResult(_0x50f5cf,null))[_0x76d5('0x41')](handleError(_0x50f5cf,null));};exports[_0x76d5('0x4b')]=function(_0x162abe,_0x22d0d3){return db[_0x76d5('0x2b')][_0x76d5('0x48')]({'where':{'id':_0x162abe[_0x76d5('0x43')]['id']}})[_0x76d5('0x24')](handleEntityNotFound(_0x22d0d3,null))[_0x76d5('0x24')](removeEntity(_0x22d0d3,null))[_0x76d5('0x41')](handleError(_0x22d0d3,null));};exports['describe']=function(_0x61f798,_0x5c1e0c){return db['MailSubstatus']['describe']()[_0x76d5('0x24')](respondWithResult(_0x5c1e0c,null))['catch'](handleError(_0x5c1e0c,null));}; \ No newline at end of file +var _0xc144=['index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','map','merge','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xc144,0x66));var _0x4c14=function(_0x452aa7,_0x15ec35){_0x452aa7=_0x452aa7-0x0;var _0x11d929=_0xc144[_0x452aa7];return _0x11d929;};'use strict';var emlformat=require(_0x4c14('0x0'));var rimraf=require(_0x4c14('0x1'));var zipdir=require(_0x4c14('0x2'));var jsonpatch=require(_0x4c14('0x3'));var rp=require(_0x4c14('0x4'));var moment=require(_0x4c14('0x5'));var BPromise=require(_0x4c14('0x6'));var Mustache=require('mustache');var util=require(_0x4c14('0x7'));var path=require(_0x4c14('0x8'));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(_0x4c14('0x9'));var squel=require(_0x4c14('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c14('0xb'));var querystring=require('querystring');var Papa=require(_0x4c14('0xc'));var Redis=require(_0x4c14('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4c14('0xe'));var as=require(_0x4c14('0xf'));var hardwareService=require(_0x4c14('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4c14('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x431665,_0x446eb9){_0x446eb9=_0x446eb9||0xcc;return function(_0x139276){if(_0x139276){return _0x431665[_0x4c14('0x12')](_0x446eb9);}return _0x431665[_0x4c14('0x13')](_0x446eb9)['end']();};}function respondWithResult(_0x555740,_0xe5c106){_0xe5c106=_0xe5c106||0xc8;return function(_0x456e17){if(_0x456e17){return _0x555740[_0x4c14('0x13')](_0xe5c106)[_0x4c14('0x14')](_0x456e17);}};}function respondWithFilteredResult(_0x12fa86,_0x2a2e81){return function(_0x11d20e){if(_0x11d20e){var _0x14a983=typeof _0x2a2e81[_0x4c14('0x15')]===_0x4c14('0x16')&&typeof _0x2a2e81[_0x4c14('0x17')]===_0x4c14('0x16');var _0x57b21d=_0x11d20e[_0x4c14('0x18')];var _0x1da59a=_0x14a983?0x0:_0x2a2e81['offset'];var _0x4a0352=_0x14a983?_0x11d20e[_0x4c14('0x18')]:_0x2a2e81[_0x4c14('0x15')]+_0x2a2e81[_0x4c14('0x17')];var _0x222851;if(_0x4a0352>=_0x57b21d){_0x4a0352=_0x57b21d;_0x222851=0xc8;}else{_0x222851=0xce;}_0x12fa86[_0x4c14('0x13')](_0x222851);return _0x12fa86[_0x4c14('0x19')](_0x4c14('0x1a'),_0x1da59a+'-'+_0x4a0352+'/'+_0x57b21d)['json'](_0x11d20e);}return null;};}function patchUpdates(_0x1aea42){return function(_0x338e3d){try{jsonpatch['apply'](_0x338e3d,_0x1aea42,!![]);}catch(_0x2319ce){return BPromise[_0x4c14('0x1b')](_0x2319ce);}return _0x338e3d['save']();};}function saveUpdates(_0x33cd84,_0x2f69cf){return function(_0x523b67){if(_0x523b67){return _0x523b67[_0x4c14('0x1c')](_0x33cd84)[_0x4c14('0x1d')](function(_0x241d2a){return _0x241d2a;});}return null;};}function removeEntity(_0x383a49,_0x1470e4){return function(_0x29cc6e){if(_0x29cc6e){return _0x29cc6e[_0x4c14('0x1e')]()[_0x4c14('0x1d')](function(){_0x383a49[_0x4c14('0x13')](0xcc)[_0x4c14('0x1f')]();});}};}function handleEntityNotFound(_0x15ad98,_0x203da9){return function(_0x3be584){if(!_0x3be584){_0x15ad98[_0x4c14('0x12')](0x194);}return _0x3be584;};}function handleError(_0x39189e,_0x219f5a){_0x219f5a=_0x219f5a||0x1f4;return function(_0x182dcd){logger[_0x4c14('0x20')](_0x182dcd[_0x4c14('0x21')]);if(_0x182dcd[_0x4c14('0x22')]){delete _0x182dcd[_0x4c14('0x22')];}_0x39189e['status'](_0x219f5a)[_0x4c14('0x23')](_0x182dcd);};}exports[_0x4c14('0x24')]=function(_0x420d90,_0x16e2c8){var _0x5e9b7e={},_0x50b723={},_0x155a99={'count':0x0,'rows':[]};var _0x157e28=_['map'](db['MailSubstatus'][_0x4c14('0x25')],function(_0x447f6e){return{'name':_0x447f6e[_0x4c14('0x26')],'type':_0x447f6e[_0x4c14('0x27')][_0x4c14('0x28')]};});_0x50b723[_0x4c14('0x29')]=_['map'](_0x157e28,'name');_0x50b723[_0x4c14('0x2a')]=_[_0x4c14('0x2b')](_0x420d90[_0x4c14('0x2a')]);_0x50b723[_0x4c14('0x2c')]=_[_0x4c14('0x2d')](_0x50b723[_0x4c14('0x29')],_0x50b723[_0x4c14('0x2a')]);_0x5e9b7e[_0x4c14('0x2e')]=_[_0x4c14('0x2d')](_0x50b723[_0x4c14('0x29')],qs[_0x4c14('0x2f')](_0x420d90[_0x4c14('0x2a')][_0x4c14('0x2f')]));_0x5e9b7e[_0x4c14('0x2e')]=_0x5e9b7e['attributes'][_0x4c14('0x30')]?_0x5e9b7e[_0x4c14('0x2e')]:_0x50b723[_0x4c14('0x29')];if(!_0x420d90[_0x4c14('0x2a')]['hasOwnProperty']('nolimit')){_0x5e9b7e[_0x4c14('0x17')]=qs[_0x4c14('0x17')](_0x420d90[_0x4c14('0x2a')][_0x4c14('0x17')]);_0x5e9b7e[_0x4c14('0x15')]=qs[_0x4c14('0x15')](_0x420d90[_0x4c14('0x2a')][_0x4c14('0x15')]);}_0x5e9b7e[_0x4c14('0x31')]=qs[_0x4c14('0x32')](_0x420d90[_0x4c14('0x2a')][_0x4c14('0x32')]);_0x5e9b7e[_0x4c14('0x33')]=qs[_0x4c14('0x2c')](_[_0x4c14('0x34')](_0x420d90[_0x4c14('0x2a')],_0x50b723['filters']),_0x157e28);if(_0x420d90[_0x4c14('0x2a')][_0x4c14('0x35')]){_0x5e9b7e[_0x4c14('0x33')]=_['merge'](_0x5e9b7e[_0x4c14('0x33')],{'$or':_[_0x4c14('0x36')](_0x157e28,function(_0x3736bf){if(_0x3736bf[_0x4c14('0x27')]!=='VIRTUAL'){var _0x346221={};_0x346221[_0x3736bf[_0x4c14('0x22')]]={'$like':'%'+_0x420d90['query']['filter']+'%'};return _0x346221;}})});}_0x5e9b7e=_[_0x4c14('0x37')]({},_0x5e9b7e,_0x420d90[_0x4c14('0x38')]);var _0x12610e={'where':_0x5e9b7e[_0x4c14('0x33')]};return db[_0x4c14('0x39')][_0x4c14('0x18')](_0x12610e)[_0x4c14('0x1d')](function(_0x14d6fc){_0x155a99[_0x4c14('0x18')]=_0x14d6fc;if(_0x420d90[_0x4c14('0x2a')][_0x4c14('0x3a')]){_0x5e9b7e[_0x4c14('0x3b')]=[{'all':!![]}];}return db[_0x4c14('0x39')][_0x4c14('0x3c')](_0x5e9b7e);})[_0x4c14('0x1d')](function(_0x412daf){_0x155a99[_0x4c14('0x3d')]=_0x412daf;return _0x155a99;})[_0x4c14('0x1d')](respondWithFilteredResult(_0x16e2c8,_0x5e9b7e))[_0x4c14('0x3e')](handleError(_0x16e2c8,null));};exports[_0x4c14('0x3f')]=function(_0x572e86,_0x280aa5){var _0x5e0034={'raw':!![],'where':{'id':_0x572e86['params']['id']}},_0x5562ef={};_0x5562ef['model']=_[_0x4c14('0x2b')](db['MailSubstatus'][_0x4c14('0x25')]);_0x5562ef[_0x4c14('0x2a')]=_['keys'](_0x572e86[_0x4c14('0x2a')]);_0x5562ef[_0x4c14('0x2c')]=_['intersection'](_0x5562ef[_0x4c14('0x29')],_0x5562ef[_0x4c14('0x2a')]);_0x5e0034['attributes']=_[_0x4c14('0x2d')](_0x5562ef['model'],qs[_0x4c14('0x2f')](_0x572e86[_0x4c14('0x2a')][_0x4c14('0x2f')]));_0x5e0034[_0x4c14('0x2e')]=_0x5e0034[_0x4c14('0x2e')][_0x4c14('0x30')]?_0x5e0034[_0x4c14('0x2e')]:_0x5562ef[_0x4c14('0x29')];if(_0x572e86['query'][_0x4c14('0x3a')]){_0x5e0034[_0x4c14('0x3b')]=[{'all':!![]}];}_0x5e0034=_['merge']({},_0x5e0034,_0x572e86[_0x4c14('0x38')]);return db['MailSubstatus']['find'](_0x5e0034)[_0x4c14('0x1d')](handleEntityNotFound(_0x280aa5,null))[_0x4c14('0x1d')](respondWithResult(_0x280aa5,null))[_0x4c14('0x3e')](handleError(_0x280aa5,null));};exports[_0x4c14('0x40')]=function(_0x414876,_0xd65ba7){return db[_0x4c14('0x39')][_0x4c14('0x40')](_0x414876[_0x4c14('0x41')],{})[_0x4c14('0x1d')](respondWithResult(_0xd65ba7,0xc9))[_0x4c14('0x3e')](handleError(_0xd65ba7,null));};exports['update']=function(_0x549cf2,_0x1ebd91){if(_0x549cf2['body']['id']){delete _0x549cf2[_0x4c14('0x41')]['id'];}return db['MailSubstatus'][_0x4c14('0x42')]({'where':{'id':_0x549cf2[_0x4c14('0x43')]['id']}})[_0x4c14('0x1d')](handleEntityNotFound(_0x1ebd91,null))['then'](saveUpdates(_0x549cf2[_0x4c14('0x41')],null))[_0x4c14('0x1d')](respondWithResult(_0x1ebd91,null))[_0x4c14('0x3e')](handleError(_0x1ebd91,null));};exports[_0x4c14('0x1e')]=function(_0x1fa218,_0x4c8c82){return db[_0x4c14('0x39')]['find']({'where':{'id':_0x1fa218[_0x4c14('0x43')]['id']}})[_0x4c14('0x1d')](handleEntityNotFound(_0x4c8c82,null))[_0x4c14('0x1d')](removeEntity(_0x4c8c82,null))['catch'](handleError(_0x4c8c82,null));};exports[_0x4c14('0x44')]=function(_0x462150,_0x163813){return db[_0x4c14('0x39')][_0x4c14('0x44')]()[_0x4c14('0x1d')](respondWithResult(_0x163813,null))[_0x4c14('0x3e')](handleError(_0x163813,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ce21c8b..b4c898d 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 _0xcb44=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hook'];(function(_0x48bcb0,_0x3ba74b){var _0x37232c=function(_0x159906){while(--_0x159906){_0x48bcb0['push'](_0x48bcb0['shift']());}};_0x37232c(++_0x3ba74b);}(_0xcb44,0x89));var _0x4cb4=function(_0x3bb43c,_0x5e18f3){_0x3bb43c=_0x3bb43c-0x0;var _0x1c5bf9=_0xcb44[_0x3bb43c];return _0x1c5bf9;};'use strict';var EventEmitter=require(_0x4cb4('0x0'));var MailSubstatus=require(_0x4cb4('0x1'))['db'][_0x4cb4('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4cb4('0x3')](0x0);var events={'afterUpdate':_0x4cb4('0x4')};function emitEvent(_0x273fb9){return function(_0x4b7f69,_0x544d77,_0x780eea){MailSubstatusEvents[_0x4cb4('0x5')](_0x273fb9+':'+_0x4b7f69['id'],_0x4b7f69);MailSubstatusEvents[_0x4cb4('0x5')](_0x273fb9,_0x4b7f69);_0x780eea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x4cb4('0x6')](e,emitEvent(event));}}module[_0x4cb4('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xf675=['hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update','emit'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xf675,0x18b));var _0x5f67=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xf675[_0x18a79d];return _0x4f8848;};'use strict';var EventEmitter=require(_0x5f67('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x5f67('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5f67('0x2')](0x0);var events={'afterUpdate':_0x5f67('0x3')};function emitEvent(_0x3214d2){return function(_0x53a2f1,_0x427ac3,_0xa664da){MailSubstatusEvents['emit'](_0x3214d2+':'+_0x53a2f1['id'],_0x53a2f1);MailSubstatusEvents[_0x5f67('0x4')](_0x3214d2,_0x53a2f1);_0xa664da(null);};}for(var e in events){if(events[_0x5f67('0x5')](e)){var event=events[e];MailSubstatus[_0x5f67('0x6')](e,emitEvent(event));}}module[_0x5f67('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d81ccbf..96c5095 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 _0x5f13=['define','mail_substatuses','Condition','update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','models'];(function(_0x395be8,_0x285479){var _0x5ceb20=function(_0x225920){while(--_0x225920){_0x395be8['push'](_0x395be8['shift']());}};_0x5ceb20(++_0x285479);}(_0x5f13,0x115));var _0x35f1=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5f13[_0x1ac595];return _0x455fff;};'use strict';var attributes=require(_0x35f1('0x0'));module[_0x35f1('0x1')]=function(_0x514187){var _0x35cbe0=_0x514187[_0x35f1('0x2')];return _0x514187[_0x35f1('0x3')]('MailSubstatus',attributes,{'tableName':_0x35f1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1b2ecf,_0x1bbdb2,_0x1334f6){return _0x35cbe0[_0x35f1('0x5')][_0x35f1('0x6')]({'value':_0x1b2ecf[_0x35f1('0x7')]},{'where':{'field':_0x35f1('0x8'),'value':_0x1b2ecf['_previousDataValues']['name']}})['then'](function(){_0x1334f6();})[_0x35f1('0x9')](function(_0x8f0321){_0x1334f6(_0x8f0321);});}}});}; \ No newline at end of file +var _0x3c11=['exports','models','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c11,0x196));var _0x13c1=function(_0x448061,_0x2debfd){_0x448061=_0x448061-0x0;var _0x3a9247=_0x3c11[_0x448061];return _0x3a9247;};'use strict';var attributes=require(_0x13c1('0x0'));module[_0x13c1('0x1')]=function(_0x1a8dea){var _0x28c218=_0x1a8dea[_0x13c1('0x2')];return _0x1a8dea['define'](_0x13c1('0x3'),attributes,{'tableName':_0x13c1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x35d589,_0x5e78fc,_0x494e3e){return _0x28c218[_0x13c1('0x5')]['update']({'value':_0x35d589[_0x13c1('0x6')]},{'where':{'field':_0x13c1('0x7'),'value':_0x35d589[_0x13c1('0x8')][_0x13c1('0x6')]}})[_0x13c1('0x9')](function(){_0x494e3e();})[_0x13c1('0xa')](function(_0x4e692d){_0x494e3e(_0x4e692d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c89d4bf..61a802e 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 _0xbd72=['error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xbd72,0x119));var _0x2bd7=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xbd72[_0x54c9dd];return _0x855156;};'use strict';var _=require(_0x2bd7('0x0'));var util=require(_0x2bd7('0x1'));var moment=require('moment');var BPromise=require(_0x2bd7('0x2'));var rs=require(_0x2bd7('0x3'));var fs=require('fs');var Redis=require(_0x2bd7('0x4'));var db=require(_0x2bd7('0x5'))['db'];var utils=require(_0x2bd7('0x6'));var logger=require(_0x2bd7('0x7'))('rpc');var config=require(_0x2bd7('0x8'));var jayson=require(_0x2bd7('0x9'));var client=jayson[_0x2bd7('0xa')][_0x2bd7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x307795,_0x5ca372,_0x6eb5f0){return new BPromise(function(_0x5aae10,_0x456f0e){return client[_0x2bd7('0xc')](_0x307795,_0x6eb5f0)[_0x2bd7('0xd')](function(_0x24d57a){logger[_0x2bd7('0xe')](_0x2bd7('0xf'),_0x5ca372,'request\x20sent');logger[_0x2bd7('0x10')](_0x2bd7('0x11'),_0x5ca372,'request\x20sent',JSON[_0x2bd7('0x12')](_0x24d57a));if(_0x24d57a[_0x2bd7('0x13')]){if(_0x24d57a[_0x2bd7('0x13')][_0x2bd7('0x14')]===0x1f4){logger[_0x2bd7('0x13')](_0x2bd7('0xf'),_0x5ca372,_0x24d57a[_0x2bd7('0x13')][_0x2bd7('0x15')]);return _0x456f0e(_0x24d57a[_0x2bd7('0x13')][_0x2bd7('0x15')]);}logger[_0x2bd7('0x13')](_0x2bd7('0xf'),_0x5ca372,_0x24d57a[_0x2bd7('0x13')]['message']);return _0x5aae10(_0x24d57a['error'][_0x2bd7('0x15')]);}else{logger[_0x2bd7('0xe')](_0x2bd7('0xf'),_0x5ca372,_0x2bd7('0x16'));_0x5aae10(_0x24d57a[_0x2bd7('0x17')][_0x2bd7('0x15')]);}})[_0x2bd7('0x18')](function(_0x5973b9){logger[_0x2bd7('0x13')](_0x2bd7('0xf'),_0x5ca372,_0x5973b9);_0x456f0e(_0x5973b9);});});} \ No newline at end of file +var _0x18c8=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xcf3595,_0x5a91f2){var _0xd052e8=function(_0x3c0175){while(--_0x3c0175){_0xcf3595['push'](_0xcf3595['shift']());}};_0xd052e8(++_0x5a91f2);}(_0x18c8,0x160));var _0x818c=function(_0x507cbd,_0x4402cc){_0x507cbd=_0x507cbd-0x0;var _0x2274ab=_0x18c8[_0x507cbd];return _0x2274ab;};'use strict';var _=require(_0x818c('0x0'));var util=require(_0x818c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x818c('0x2'));var fs=require('fs');var Redis=require(_0x818c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x818c('0x4'));var logger=require(_0x818c('0x5'))(_0x818c('0x6'));var config=require(_0x818c('0x7'));var jayson=require(_0x818c('0x8'));var client=jayson['client'][_0x818c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x568e2,_0x1b8c5f,_0x54dcfe){return new BPromise(function(_0x1641ad,_0x105c74){return client[_0x818c('0xa')](_0x568e2,_0x54dcfe)['then'](function(_0x4e74a3){logger[_0x818c('0xb')](_0x818c('0xc'),_0x1b8c5f,'request\x20sent');logger[_0x818c('0xd')](_0x818c('0xe'),_0x1b8c5f,_0x818c('0xf'),JSON[_0x818c('0x10')](_0x4e74a3));if(_0x4e74a3[_0x818c('0x11')]){if(_0x4e74a3[_0x818c('0x11')][_0x818c('0x12')]===0x1f4){logger[_0x818c('0x11')](_0x818c('0xc'),_0x1b8c5f,_0x4e74a3[_0x818c('0x11')]['message']);return _0x105c74(_0x4e74a3[_0x818c('0x11')][_0x818c('0x13')]);}logger[_0x818c('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1b8c5f,_0x4e74a3[_0x818c('0x11')][_0x818c('0x13')]);return _0x1641ad(_0x4e74a3[_0x818c('0x11')][_0x818c('0x13')]);}else{logger[_0x818c('0xb')](_0x818c('0xc'),_0x1b8c5f,_0x818c('0xf'));_0x1641ad(_0x4e74a3[_0x818c('0x14')][_0x818c('0x13')]);}})[_0x818c('0x15')](function(_0x5936b9){logger[_0x818c('0x11')](_0x818c('0xc'),_0x1b8c5f,_0x5936b9);_0x105c74(_0x5936b9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ab91d16..2dcd2ba 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 _0xa26f=['get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x1734ab,_0x254bb2){var _0x41008e=function(_0x131727){while(--_0x131727){_0x1734ab['push'](_0x1734ab['shift']());}};_0x41008e(++_0x254bb2);}(_0xa26f,0x118));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa26('0x0'));var util=require('util');var path=require(_0xfa26('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa26('0x2'));var router=express[_0xfa26('0x3')]();var fs_extra=require(_0xfa26('0x4'));var auth=require(_0xfa26('0x5'));var interaction=require(_0xfa26('0x6'));var config=require('../../config/environment');var controller=require(_0xfa26('0x7'));router[_0xfa26('0x8')]('/',auth[_0xfa26('0x9')](),controller[_0xfa26('0xa')]);router['get'](_0xfa26('0xb'),auth['isAuthenticated'](),controller[_0xfa26('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfa26('0xd')]);router[_0xfa26('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfa26('0xf'),auth[_0xfa26('0x9')](),controller[_0xfa26('0x10')]);router[_0xfa26('0x11')](_0xfa26('0xf'),auth[_0xfa26('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46c6=['/describe','describe','/:id','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46c6,0x170));var _0x646c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x46c6[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0x646c('0x0'));var util=require('util');var path=require(_0x646c('0x1'));var timeout=require(_0x646c('0x2'));var express=require(_0x646c('0x3'));var router=express[_0x646c('0x4')]();var fs_extra=require(_0x646c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x646c('0x6'));var config=require(_0x646c('0x7'));var controller=require(_0x646c('0x8'));router[_0x646c('0x9')]('/',auth[_0x646c('0xa')](),controller[_0x646c('0xb')]);router['get'](_0x646c('0xc'),auth[_0x646c('0xa')](),controller[_0x646c('0xd')]);router['get'](_0x646c('0xe'),auth[_0x646c('0xa')](),controller['show']);router[_0x646c('0xf')]('/',auth['isAuthenticated'](),controller[_0x646c('0x10')]);router[_0x646c('0x11')](_0x646c('0xe'),auth['isAuthenticated'](),controller[_0x646c('0x12')]);router[_0x646c('0x13')](_0x646c('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4742b68..d8f33af 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1dbf9a,_0x2189b1){var _0xc858e9=function(_0x4931ac){while(--_0x4931ac){_0x1dbf9a['push'](_0x1dbf9a['shift']());}};_0xc858e9(++_0x2189b1);}(_0xaa88,0x137));var _0x8aa8=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xaa88[_0x1ccdf7];return _0x52a0ae;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x346aec,_0x121bb2){var _0x3bc5f3=function(_0x3ba5f6){while(--_0x3ba5f6){_0x346aec['push'](_0x346aec['shift']());}};_0x3bc5f3(++_0x121bb2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x4b84[_0x1034ca];return _0x1a023a;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e815879..2f363c9 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 _0x891a=['../../mysqldb','sendStatus','status','json','undefined','count','offset','reject','update','destroy','then','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','merge','options','MailTransferReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','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'];(function(_0x31d4da,_0x3acfa6){var _0xafc711=function(_0x21600f){while(--_0x21600f){_0x31d4da['push'](_0x31d4da['shift']());}};_0xafc711(++_0x3acfa6);}(_0x891a,0x76));var _0xa891=function(_0x5cf0ef,_0x212849){_0x5cf0ef=_0x5cf0ef-0x0;var _0x2904e9=_0x891a[_0x5cf0ef];return _0x2904e9;};'use strict';var emlformat=require(_0xa891('0x0'));var rimraf=require(_0xa891('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa891('0x2'));var moment=require(_0xa891('0x3'));var BPromise=require(_0xa891('0x4'));var Mustache=require(_0xa891('0x5'));var util=require(_0xa891('0x6'));var path=require('path');var sox=require(_0xa891('0x7'));var csv=require(_0xa891('0x8'));var ejs=require(_0xa891('0x9'));var fs=require('fs');var fs_extra=require(_0xa891('0xa'));var _=require(_0xa891('0xb'));var squel=require(_0xa891('0xc'));var crypto=require(_0xa891('0xd'));var jsforce=require(_0xa891('0xe'));var deskjs=require(_0xa891('0xf'));var toCsv=require(_0xa891('0x8'));var querystring=require(_0xa891('0x10'));var Papa=require(_0xa891('0x11'));var Redis=require('ioredis');var authService=require(_0xa891('0x12'));var qs=require(_0xa891('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa891('0x14'))(_0xa891('0x15'));var utils=require(_0xa891('0x16'));var config=require(_0xa891('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa891('0x18'))['db'];function respondWithStatusCode(_0x375fa5,_0x532354){_0x532354=_0x532354||0xcc;return function(_0x3e8b17){if(_0x3e8b17){return _0x375fa5[_0xa891('0x19')](_0x532354);}return _0x375fa5['status'](_0x532354)['end']();};}function respondWithResult(_0x935d75,_0x3a7d2a){_0x3a7d2a=_0x3a7d2a||0xc8;return function(_0xd5cace){if(_0xd5cace){return _0x935d75[_0xa891('0x1a')](_0x3a7d2a)[_0xa891('0x1b')](_0xd5cace);}};}function respondWithFilteredResult(_0x499d75,_0x2c5c84){return function(_0x468265){if(_0x468265){var _0x4f3b74=typeof _0x2c5c84['offset']===_0xa891('0x1c')&&typeof _0x2c5c84['limit']===_0xa891('0x1c');var _0x2c373e=_0x468265[_0xa891('0x1d')];var _0x34561e=_0x4f3b74?0x0:_0x2c5c84[_0xa891('0x1e')];var _0x1f0e94=_0x4f3b74?_0x468265[_0xa891('0x1d')]:_0x2c5c84[_0xa891('0x1e')]+_0x2c5c84['limit'];var _0x23326d;if(_0x1f0e94>=_0x2c373e){_0x1f0e94=_0x2c373e;_0x23326d=0xc8;}else{_0x23326d=0xce;}_0x499d75[_0xa891('0x1a')](_0x23326d);return _0x499d75['set']('Content-Range',_0x34561e+'-'+_0x1f0e94+'/'+_0x2c373e)['json'](_0x468265);}return null;};}function patchUpdates(_0x802cfe){return function(_0x4b8ec3){try{jsonpatch['apply'](_0x4b8ec3,_0x802cfe,!![]);}catch(_0x4d3681){return BPromise[_0xa891('0x1f')](_0x4d3681);}return _0x4b8ec3['save']();};}function saveUpdates(_0xa4a7bb,_0x50c5c8){return function(_0x4094f4){if(_0x4094f4){return _0x4094f4[_0xa891('0x20')](_0xa4a7bb)['then'](function(_0x5d29d2){return _0x5d29d2;});}return null;};}function removeEntity(_0x616e68,_0xab4c53){return function(_0x101138){if(_0x101138){return _0x101138[_0xa891('0x21')]()[_0xa891('0x22')](function(){_0x616e68['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dce15,_0x38ab95){return function(_0x42e4b9){if(!_0x42e4b9){_0x4dce15[_0xa891('0x19')](0x194);}return _0x42e4b9;};}function handleError(_0x3558b5,_0x5bb91d){_0x5bb91d=_0x5bb91d||0x1f4;return function(_0x584546){logger['error'](_0x584546[_0xa891('0x23')]);if(_0x584546[_0xa891('0x24')]){delete _0x584546[_0xa891('0x24')];}_0x3558b5[_0xa891('0x1a')](_0x5bb91d)[_0xa891('0x25')](_0x584546);};}exports[_0xa891('0x26')]=function(_0xcbb3b7,_0xf125a8){var _0xbf60fc={},_0x473fdc={},_0x5541fd={'count':0x0,'rows':[]};var _0x3cbd78=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x55f9f1){return{'name':_0x55f9f1[_0xa891('0x27')],'type':_0x55f9f1[_0xa891('0x28')][_0xa891('0x29')]};});_0x473fdc[_0xa891('0x2a')]=_[_0xa891('0x2b')](_0x3cbd78,'name');_0x473fdc['query']=_[_0xa891('0x2c')](_0xcbb3b7[_0xa891('0x2d')]);_0x473fdc[_0xa891('0x2e')]=_[_0xa891('0x2f')](_0x473fdc[_0xa891('0x2a')],_0x473fdc['query']);_0xbf60fc[_0xa891('0x30')]=_['intersection'](_0x473fdc[_0xa891('0x2a')],qs[_0xa891('0x31')](_0xcbb3b7['query'][_0xa891('0x31')]));_0xbf60fc[_0xa891('0x30')]=_0xbf60fc['attributes'][_0xa891('0x32')]?_0xbf60fc[_0xa891('0x30')]:_0x473fdc['model'];if(!_0xcbb3b7[_0xa891('0x2d')]['hasOwnProperty'](_0xa891('0x33'))){_0xbf60fc[_0xa891('0x34')]=qs[_0xa891('0x34')](_0xcbb3b7[_0xa891('0x2d')]['limit']);_0xbf60fc['offset']=qs[_0xa891('0x1e')](_0xcbb3b7['query'][_0xa891('0x1e')]);}_0xbf60fc[_0xa891('0x35')]=qs['sort'](_0xcbb3b7[_0xa891('0x2d')][_0xa891('0x36')]);_0xbf60fc[_0xa891('0x37')]=qs[_0xa891('0x2e')](_[_0xa891('0x38')](_0xcbb3b7[_0xa891('0x2d')],_0x473fdc[_0xa891('0x2e')]),_0x3cbd78);if(_0xcbb3b7[_0xa891('0x2d')]['filter']){_0xbf60fc['where']=_['merge'](_0xbf60fc[_0xa891('0x37')],{'$or':_[_0xa891('0x2b')](_0x3cbd78,function(_0x3846ff){if(_0x3846ff[_0xa891('0x28')]!==_0xa891('0x39')){var _0x93826e={};_0x93826e[_0x3846ff['name']]={'$like':'%'+_0xcbb3b7[_0xa891('0x2d')]['filter']+'%'};return _0x93826e;}})});}_0xbf60fc=_[_0xa891('0x3a')]({},_0xbf60fc,_0xcbb3b7[_0xa891('0x3b')]);var _0x23f170={'where':_0xbf60fc[_0xa891('0x37')]};return db[_0xa891('0x3c')][_0xa891('0x1d')](_0x23f170)[_0xa891('0x22')](function(_0x12e04c){_0x5541fd[_0xa891('0x1d')]=_0x12e04c;if(_0xcbb3b7[_0xa891('0x2d')]['includeAll']){_0xbf60fc[_0xa891('0x3d')]=[{'all':!![]}];}return db[_0xa891('0x3c')][_0xa891('0x3e')](_0xbf60fc);})[_0xa891('0x22')](function(_0x3ea277){_0x5541fd[_0xa891('0x3f')]=_0x3ea277;return _0x5541fd;})[_0xa891('0x22')](respondWithFilteredResult(_0xf125a8,_0xbf60fc))[_0xa891('0x40')](handleError(_0xf125a8,null));};exports[_0xa891('0x41')]=function(_0x4e4712,_0x5114bd){var _0x1fc882={'raw':!![],'where':{'id':_0x4e4712[_0xa891('0x42')]['id']}},_0x48b3e9={};_0x48b3e9[_0xa891('0x2a')]=_[_0xa891('0x2c')](db[_0xa891('0x3c')][_0xa891('0x43')]);_0x48b3e9[_0xa891('0x2d')]=_[_0xa891('0x2c')](_0x4e4712['query']);_0x48b3e9[_0xa891('0x2e')]=_['intersection'](_0x48b3e9[_0xa891('0x2a')],_0x48b3e9[_0xa891('0x2d')]);_0x1fc882[_0xa891('0x30')]=_[_0xa891('0x2f')](_0x48b3e9[_0xa891('0x2a')],qs[_0xa891('0x31')](_0x4e4712['query']['fields']));_0x1fc882['attributes']=_0x1fc882[_0xa891('0x30')][_0xa891('0x32')]?_0x1fc882[_0xa891('0x30')]:_0x48b3e9['model'];if(_0x4e4712[_0xa891('0x2d')][_0xa891('0x44')]){_0x1fc882[_0xa891('0x3d')]=[{'all':!![]}];}_0x1fc882=_['merge']({},_0x1fc882,_0x4e4712[_0xa891('0x3b')]);return db[_0xa891('0x3c')][_0xa891('0x45')](_0x1fc882)[_0xa891('0x22')](handleEntityNotFound(_0x5114bd,null))[_0xa891('0x22')](respondWithResult(_0x5114bd,null))[_0xa891('0x40')](handleError(_0x5114bd,null));};exports['create']=function(_0x2cd842,_0x4ceaea){return db['MailTransferReport']['create'](_0x2cd842[_0xa891('0x46')],{})['then'](respondWithResult(_0x4ceaea,0xc9))[_0xa891('0x40')](handleError(_0x4ceaea,null));};exports[_0xa891('0x20')]=function(_0x4ba57b,_0x85f599){if(_0x4ba57b['body']['id']){delete _0x4ba57b[_0xa891('0x46')]['id'];}return db['MailTransferReport'][_0xa891('0x45')]({'where':{'id':_0x4ba57b[_0xa891('0x42')]['id']}})[_0xa891('0x22')](handleEntityNotFound(_0x85f599,null))[_0xa891('0x22')](saveUpdates(_0x4ba57b[_0xa891('0x46')],null))[_0xa891('0x22')](respondWithResult(_0x85f599,null))[_0xa891('0x40')](handleError(_0x85f599,null));};exports[_0xa891('0x21')]=function(_0x30e749,_0x3dcdde){return db['MailTransferReport']['find']({'where':{'id':_0x30e749['params']['id']}})[_0xa891('0x22')](handleEntityNotFound(_0x3dcdde,null))[_0xa891('0x22')](removeEntity(_0x3dcdde,null))['catch'](handleError(_0x3dcdde,null));};exports['describe']=function(_0xfb1307,_0x35ef89){return db[_0xa891('0x3c')]['describe']()[_0xa891('0x22')](respondWithResult(_0x35ef89,null))[_0xa891('0x40')](handleError(_0x35ef89,null));}; \ No newline at end of file +var _0x2107=['stack','name','send','MailTransferReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','describe','eml-format','zip-dir','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy'];(function(_0x3b404a,_0x5c049d){var _0x6c464d=function(_0x345eb5){while(--_0x345eb5){_0x3b404a['push'](_0x3b404a['shift']());}};_0x6c464d(++_0x5c049d);}(_0x2107,0xa7));var _0x7210=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x2107[_0x5179a5];return _0x15c8ce;};'use strict';var emlformat=require(_0x7210('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7210('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7210('0x2'));var util=require(_0x7210('0x3'));var path=require('path');var sox=require(_0x7210('0x4'));var csv=require(_0x7210('0x5'));var ejs=require(_0x7210('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7210('0x7'));var squel=require(_0x7210('0x8'));var crypto=require(_0x7210('0x9'));var jsforce=require(_0x7210('0xa'));var deskjs=require(_0x7210('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7210('0xc'));var Papa=require(_0x7210('0xd'));var Redis=require(_0x7210('0xe'));var authService=require(_0x7210('0xf'));var qs=require(_0x7210('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7210('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7210('0x12'));var db=require(_0x7210('0x13'))['db'];function respondWithStatusCode(_0x1af0c3,_0x47f2b5){_0x47f2b5=_0x47f2b5||0xcc;return function(_0x466682){if(_0x466682){return _0x1af0c3[_0x7210('0x14')](_0x47f2b5);}return _0x1af0c3[_0x7210('0x15')](_0x47f2b5)[_0x7210('0x16')]();};}function respondWithResult(_0x230c9b,_0x59d5ea){_0x59d5ea=_0x59d5ea||0xc8;return function(_0x15be55){if(_0x15be55){return _0x230c9b[_0x7210('0x15')](_0x59d5ea)[_0x7210('0x17')](_0x15be55);}};}function respondWithFilteredResult(_0x229fd2,_0x2992b0){return function(_0x62d9c9){if(_0x62d9c9){var _0x1edb2e=typeof _0x2992b0[_0x7210('0x18')]===_0x7210('0x19')&&typeof _0x2992b0['limit']===_0x7210('0x19');var _0x427f71=_0x62d9c9[_0x7210('0x1a')];var _0x4a2eec=_0x1edb2e?0x0:_0x2992b0[_0x7210('0x18')];var _0x42b7f3=_0x1edb2e?_0x62d9c9['count']:_0x2992b0[_0x7210('0x18')]+_0x2992b0[_0x7210('0x1b')];var _0x56f351;if(_0x42b7f3>=_0x427f71){_0x42b7f3=_0x427f71;_0x56f351=0xc8;}else{_0x56f351=0xce;}_0x229fd2[_0x7210('0x15')](_0x56f351);return _0x229fd2['set'](_0x7210('0x1c'),_0x4a2eec+'-'+_0x42b7f3+'/'+_0x427f71)[_0x7210('0x17')](_0x62d9c9);}return null;};}function patchUpdates(_0x5332c0){return function(_0x4de8bd){try{jsonpatch[_0x7210('0x1d')](_0x4de8bd,_0x5332c0,!![]);}catch(_0x154d2e){return BPromise['reject'](_0x154d2e);}return _0x4de8bd[_0x7210('0x1e')]();};}function saveUpdates(_0x4b0178,_0x242ffc){return function(_0x5800db){if(_0x5800db){return _0x5800db[_0x7210('0x1f')](_0x4b0178)[_0x7210('0x20')](function(_0x9ada81){return _0x9ada81;});}return null;};}function removeEntity(_0x28b806,_0x2505bb){return function(_0x503ee6){if(_0x503ee6){return _0x503ee6[_0x7210('0x21')]()[_0x7210('0x20')](function(){_0x28b806['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23efd5,_0x119738){return function(_0x41db02){if(!_0x41db02){_0x23efd5[_0x7210('0x14')](0x194);}return _0x41db02;};}function handleError(_0xabbeca,_0x474f77){_0x474f77=_0x474f77||0x1f4;return function(_0x1b2133){logger['error'](_0x1b2133[_0x7210('0x22')]);if(_0x1b2133['name']){delete _0x1b2133[_0x7210('0x23')];}_0xabbeca['status'](_0x474f77)[_0x7210('0x24')](_0x1b2133);};}exports['index']=function(_0x65c507,_0x471f40){var _0xe511c1={},_0xf96dc0={},_0x4956e7={'count':0x0,'rows':[]};var _0x5d0015=_['map'](db[_0x7210('0x25')][_0x7210('0x26')],function(_0x18022d){return{'name':_0x18022d[_0x7210('0x27')],'type':_0x18022d[_0x7210('0x28')]['key']};});_0xf96dc0['model']=_[_0x7210('0x29')](_0x5d0015,_0x7210('0x23'));_0xf96dc0['query']=_[_0x7210('0x2a')](_0x65c507[_0x7210('0x2b')]);_0xf96dc0[_0x7210('0x2c')]=_[_0x7210('0x2d')](_0xf96dc0[_0x7210('0x2e')],_0xf96dc0[_0x7210('0x2b')]);_0xe511c1[_0x7210('0x2f')]=_['intersection'](_0xf96dc0[_0x7210('0x2e')],qs['fields'](_0x65c507[_0x7210('0x2b')]['fields']));_0xe511c1[_0x7210('0x2f')]=_0xe511c1['attributes']['length']?_0xe511c1[_0x7210('0x2f')]:_0xf96dc0[_0x7210('0x2e')];if(!_0x65c507['query'][_0x7210('0x30')](_0x7210('0x31'))){_0xe511c1[_0x7210('0x1b')]=qs['limit'](_0x65c507[_0x7210('0x2b')][_0x7210('0x1b')]);_0xe511c1[_0x7210('0x18')]=qs[_0x7210('0x18')](_0x65c507['query']['offset']);}_0xe511c1['order']=qs[_0x7210('0x32')](_0x65c507['query'][_0x7210('0x32')]);_0xe511c1[_0x7210('0x33')]=qs[_0x7210('0x2c')](_['pick'](_0x65c507[_0x7210('0x2b')],_0xf96dc0['filters']),_0x5d0015);if(_0x65c507[_0x7210('0x2b')][_0x7210('0x34')]){_0xe511c1[_0x7210('0x33')]=_[_0x7210('0x35')](_0xe511c1[_0x7210('0x33')],{'$or':_[_0x7210('0x29')](_0x5d0015,function(_0x3f1f7c){if(_0x3f1f7c[_0x7210('0x28')]!=='VIRTUAL'){var _0x182b52={};_0x182b52[_0x3f1f7c['name']]={'$like':'%'+_0x65c507[_0x7210('0x2b')][_0x7210('0x34')]+'%'};return _0x182b52;}})});}_0xe511c1=_[_0x7210('0x35')]({},_0xe511c1,_0x65c507[_0x7210('0x36')]);var _0x1e4c2e={'where':_0xe511c1[_0x7210('0x33')]};return db[_0x7210('0x25')][_0x7210('0x1a')](_0x1e4c2e)['then'](function(_0x1a1237){_0x4956e7[_0x7210('0x1a')]=_0x1a1237;if(_0x65c507[_0x7210('0x2b')][_0x7210('0x37')]){_0xe511c1['include']=[{'all':!![]}];}return db[_0x7210('0x25')][_0x7210('0x38')](_0xe511c1);})['then'](function(_0x3d60c5){_0x4956e7[_0x7210('0x39')]=_0x3d60c5;return _0x4956e7;})[_0x7210('0x20')](respondWithFilteredResult(_0x471f40,_0xe511c1))[_0x7210('0x3a')](handleError(_0x471f40,null));};exports[_0x7210('0x3b')]=function(_0x31c10f,_0x12efcc){var _0x5a97d2={'raw':!![],'where':{'id':_0x31c10f['params']['id']}},_0x1eec69={};_0x1eec69[_0x7210('0x2e')]=_[_0x7210('0x2a')](db['MailTransferReport']['rawAttributes']);_0x1eec69['query']=_[_0x7210('0x2a')](_0x31c10f[_0x7210('0x2b')]);_0x1eec69[_0x7210('0x2c')]=_['intersection'](_0x1eec69['model'],_0x1eec69['query']);_0x5a97d2[_0x7210('0x2f')]=_['intersection'](_0x1eec69[_0x7210('0x2e')],qs[_0x7210('0x3c')](_0x31c10f['query'][_0x7210('0x3c')]));_0x5a97d2['attributes']=_0x5a97d2[_0x7210('0x2f')]['length']?_0x5a97d2[_0x7210('0x2f')]:_0x1eec69[_0x7210('0x2e')];if(_0x31c10f[_0x7210('0x2b')][_0x7210('0x37')]){_0x5a97d2[_0x7210('0x3d')]=[{'all':!![]}];}_0x5a97d2=_[_0x7210('0x35')]({},_0x5a97d2,_0x31c10f[_0x7210('0x36')]);return db[_0x7210('0x25')][_0x7210('0x3e')](_0x5a97d2)[_0x7210('0x20')](handleEntityNotFound(_0x12efcc,null))[_0x7210('0x20')](respondWithResult(_0x12efcc,null))[_0x7210('0x3a')](handleError(_0x12efcc,null));};exports[_0x7210('0x3f')]=function(_0x322521,_0x354ae0){return db[_0x7210('0x25')]['create'](_0x322521[_0x7210('0x40')],{})[_0x7210('0x20')](respondWithResult(_0x354ae0,0xc9))[_0x7210('0x3a')](handleError(_0x354ae0,null));};exports['update']=function(_0x38136b,_0x59f4ff){if(_0x38136b[_0x7210('0x40')]['id']){delete _0x38136b[_0x7210('0x40')]['id'];}return db[_0x7210('0x25')][_0x7210('0x3e')]({'where':{'id':_0x38136b[_0x7210('0x41')]['id']}})[_0x7210('0x20')](handleEntityNotFound(_0x59f4ff,null))[_0x7210('0x20')](saveUpdates(_0x38136b[_0x7210('0x40')],null))['then'](respondWithResult(_0x59f4ff,null))[_0x7210('0x3a')](handleError(_0x59f4ff,null));};exports['destroy']=function(_0x123de8,_0x253a4f){return db[_0x7210('0x25')][_0x7210('0x3e')]({'where':{'id':_0x123de8['params']['id']}})[_0x7210('0x20')](handleEntityNotFound(_0x253a4f,null))[_0x7210('0x20')](removeEntity(_0x253a4f,null))[_0x7210('0x3a')](handleError(_0x253a4f,null));};exports[_0x7210('0x42')]=function(_0x3790d4,_0x3b7c1e){return db[_0x7210('0x25')][_0x7210('0x42')]()['then'](respondWithResult(_0x3b7c1e,null))[_0x7210('0x3a')](handleError(_0x3b7c1e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f0368ef..dcb493d 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 _0x4534=['bluebird','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x39bfa5,_0x4c50cc){var _0x16aef9=function(_0x1175ab){while(--_0x1175ab){_0x39bfa5['push'](_0x39bfa5['shift']());}};_0x16aef9(++_0x4c50cc);}(_0x4534,0x141));var _0x4453=function(_0x2b7f22,_0x188a18){_0x2b7f22=_0x2b7f22-0x0;var _0x4508e6=_0x4534[_0x2b7f22];return _0x4508e6;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x4453('0x8')]=function(_0x456815,_0x25bf80){return _0x456815[_0x4453('0x9')](_0x4453('0xa'),attributes,{'tableName':_0x4453('0xb'),'paranoid':![],'indexes':[{'name':_0x4453('0xc'),'fields':[_0x4453('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x851e=['request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x851e,0x1e8));var _0xe851=function(_0x3aff64,_0x55b017){_0x3aff64=_0x3aff64-0x0;var _0x1343d9=_0x851e[_0x3aff64];return _0x1343d9;};'use strict';var _=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var logger=require(_0xe851('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe851('0x3'));var rp=require(_0xe851('0x4'));var fs=require('fs');var path=require(_0xe851('0x5'));var rimraf=require(_0xe851('0x6'));var config=require(_0xe851('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xe851('0x8')]=function(_0x2b36b5,_0xba0648){return _0x2b36b5[_0xe851('0x9')](_0xe851('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xe851('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 629f329..46fef11 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 _0xc8dc=['jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xc8dc,0x1f2));var _0xcc8d=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0xc8dc[_0x188c88];return _0x4e4c38;};'use strict';var _=require(_0xcc8d('0x0'));var util=require(_0xcc8d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc8d('0x2'));var fs=require('fs');var Redis=require(_0xcc8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc8d('0x4'));var logger=require('../../config/logger')(_0xcc8d('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc8d('0x6'));var client=jayson[_0xcc8d('0x7')][_0xcc8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x367634,_0x4a52d8,_0x141078){return new BPromise(function(_0xe62d80,_0x9e4f8e){return client[_0xcc8d('0x9')](_0x367634,_0x141078)[_0xcc8d('0xa')](function(_0x5aa17e){logger[_0xcc8d('0xb')](_0xcc8d('0xc'),_0x4a52d8,_0xcc8d('0xd'));logger[_0xcc8d('0xe')](_0xcc8d('0xf'),_0x4a52d8,'request\x20sent',JSON['stringify'](_0x5aa17e));if(_0x5aa17e['error']){if(_0x5aa17e[_0xcc8d('0x10')][_0xcc8d('0x11')]===0x1f4){logger[_0xcc8d('0x10')](_0xcc8d('0xc'),_0x4a52d8,_0x5aa17e[_0xcc8d('0x10')][_0xcc8d('0x12')]);return _0x9e4f8e(_0x5aa17e[_0xcc8d('0x10')][_0xcc8d('0x12')]);}logger['error'](_0xcc8d('0xc'),_0x4a52d8,_0x5aa17e[_0xcc8d('0x10')]['message']);return _0xe62d80(_0x5aa17e['error'][_0xcc8d('0x12')]);}else{logger[_0xcc8d('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4a52d8,_0xcc8d('0xd'));_0xe62d80(_0x5aa17e[_0xcc8d('0x13')][_0xcc8d('0x12')]);}})[_0xcc8d('0x14')](function(_0x5c6125){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4a52d8,_0x5c6125);_0x9e4f8e(_0x5c6125);});});} \ No newline at end of file +var _0xc63d=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x338a1d,_0x5ad84c){var _0x58e4b7=function(_0x28939c){while(--_0x28939c){_0x338a1d['push'](_0x338a1d['shift']());}};_0x58e4b7(++_0x5ad84c);}(_0xc63d,0x101));var _0xdc63=function(_0x2d5338,_0x4fac2e){_0x2d5338=_0x2d5338-0x0;var _0x2053c1=_0xc63d[_0x2d5338];return _0x2053c1;};'use strict';var _=require(_0xdc63('0x0'));var util=require(_0xdc63('0x1'));var moment=require(_0xdc63('0x2'));var BPromise=require(_0xdc63('0x3'));var rs=require(_0xdc63('0x4'));var fs=require('fs');var Redis=require(_0xdc63('0x5'));var db=require(_0xdc63('0x6'))['db'];var utils=require(_0xdc63('0x7'));var logger=require(_0xdc63('0x8'))(_0xdc63('0x9'));var config=require(_0xdc63('0xa'));var jayson=require(_0xdc63('0xb'));var client=jayson[_0xdc63('0xc')][_0xdc63('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2fb32f,_0x17afa1,_0x173600){return new BPromise(function(_0xc0df0f,_0x28619a){return client[_0xdc63('0xe')](_0x2fb32f,_0x173600)['then'](function(_0x210ea9){logger[_0xdc63('0xf')](_0xdc63('0x10'),_0x17afa1,_0xdc63('0x11'));logger[_0xdc63('0x12')](_0xdc63('0x13'),_0x17afa1,'request\x20sent',JSON[_0xdc63('0x14')](_0x210ea9));if(_0x210ea9['error']){if(_0x210ea9[_0xdc63('0x15')]['code']===0x1f4){logger[_0xdc63('0x15')](_0xdc63('0x10'),_0x17afa1,_0x210ea9[_0xdc63('0x15')][_0xdc63('0x16')]);return _0x28619a(_0x210ea9[_0xdc63('0x15')][_0xdc63('0x16')]);}logger[_0xdc63('0x15')](_0xdc63('0x10'),_0x17afa1,_0x210ea9[_0xdc63('0x15')][_0xdc63('0x16')]);return _0xc0df0f(_0x210ea9[_0xdc63('0x15')]['message']);}else{logger[_0xdc63('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x17afa1,_0xdc63('0x11'));_0xc0df0f(_0x210ea9[_0xdc63('0x17')][_0xdc63('0x16')]);}})[_0xdc63('0x18')](function(_0xf4ff8f){logger[_0xdc63('0x15')](_0xdc63('0x10'),_0x17afa1,_0xf4ff8f);_0x28619a(_0xf4ff8f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 4fc6141..46facbd 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 _0x0c63=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x34e999,_0x227313){var _0xea8594=function(_0x533c37){while(--_0x533c37){_0x34e999['push'](_0x34e999['shift']());}};_0xea8594(++_0x227313);}(_0x0c63,0x14d));var _0x30c6=function(_0x34017e,_0x25f6b1){_0x34017e=_0x34017e-0x0;var _0x3e725e=_0x0c63[_0x34017e];return _0x3e725e;};'use strict';var multer=require(_0x30c6('0x0'));var util=require(_0x30c6('0x1'));var path=require(_0x30c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x30c6('0x3'));var router=express[_0x30c6('0x4')]();var fs_extra=require(_0x30c6('0x5'));var auth=require(_0x30c6('0x6'));var interaction=require(_0x30c6('0x7'));var config=require(_0x30c6('0x8'));var controller=require(_0x30c6('0x9'));router[_0x30c6('0xa')]('/',auth[_0x30c6('0xb')](),controller[_0x30c6('0xc')]);router[_0x30c6('0xa')](_0x30c6('0xd'),auth['isAuthenticated'](),controller[_0x30c6('0xe')]);router[_0x30c6('0xa')](_0x30c6('0xf'),auth[_0x30c6('0xb')](),controller[_0x30c6('0x10')]);router[_0x30c6('0x11')]('/',auth[_0x30c6('0xb')](),controller[_0x30c6('0x12')]);router[_0x30c6('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x30c6('0x14')]);router[_0x30c6('0x15')]('/:id',auth[_0x30c6('0xb')](),controller[_0x30c6('0x16')]);module[_0x30c6('0x17')]=router; \ No newline at end of file +var _0xfdfa=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0xfdfa,0x1b8));var _0xafdf=function(_0x31da2c,_0x276d4d){_0x31da2c=_0x31da2c-0x0;var _0x191df1=_0xfdfa[_0x31da2c];return _0x191df1;};'use strict';var multer=require(_0xafdf('0x0'));var util=require('util');var path=require(_0xafdf('0x1'));var timeout=require(_0xafdf('0x2'));var express=require(_0xafdf('0x3'));var router=express[_0xafdf('0x4')]();var fs_extra=require(_0xafdf('0x5'));var auth=require(_0xafdf('0x6'));var interaction=require(_0xafdf('0x7'));var config=require(_0xafdf('0x8'));var controller=require(_0xafdf('0x9'));router[_0xafdf('0xa')]('/',auth['isAuthenticated'](),controller[_0xafdf('0xb')]);router[_0xafdf('0xa')](_0xafdf('0xc'),auth[_0xafdf('0xd')](),controller[_0xafdf('0xe')]);router[_0xafdf('0xa')](_0xafdf('0xf'),auth['isAuthenticated'](),controller[_0xafdf('0x10')]);router[_0xafdf('0x11')]('/',auth[_0xafdf('0xd')](),controller[_0xafdf('0x12')]);router[_0xafdf('0x13')](_0xafdf('0xf'),auth[_0xafdf('0xd')](),controller[_0xafdf('0x14')]);router[_0xafdf('0x15')](_0xafdf('0xf'),auth[_0xafdf('0xd')](),controller['destroy']);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 7266a8d..ac88c14 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 _0x0be7=['talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x1471cd,_0x31b38d){var _0x1134af=function(_0x289cd0){while(--_0x289cd0){_0x1471cd['push'](_0x1471cd['shift']());}};_0x1134af(++_0x31b38d);}(_0x0be7,0x182));var _0x70be=function(_0x26e1b9,_0x62eeef){_0x26e1b9=_0x26e1b9-0x0;var _0x1fc560=_0x0be7[_0x26e1b9];return _0x1fc560;};'use strict';var Sequelize=require(_0x70be('0x0'));var moment=require('moment');module[_0x70be('0x1')]={'channel':{'type':Sequelize[_0x70be('0x2')]},'membername':{'type':Sequelize[_0x70be('0x2')]},'interface':{'type':Sequelize[_0x70be('0x2')]},'type':{'type':Sequelize[_0x70be('0x2')],'defaultValue':_0x70be('0x3'),'comment':_0x70be('0x4')},'duration':{'type':Sequelize[_0x70be('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x70be('0x6')],'set':function(_0x4a730d){var _0x5e0cbb=moment(_0x4a730d);var _0x4a76e0=moment(this[_0x70be('0x7')]('enterAt'));var _0x5f687=_0x5e0cbb[_0x70be('0x8')](_0x4a76e0,_0x70be('0x9'));this[_0x70be('0xa')](_0x70be('0xb'),_0x4a730d);this[_0x70be('0xa')]('duration',_0x5f687>=0x0?_0x5f687:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x70be('0xc')},'data2':{'type':Sequelize[_0x70be('0x2')],'comment':_0x70be('0xd')},'data3':{'type':Sequelize[_0x70be('0x2')],'comment':_0x70be('0xe')},'data4':{'type':Sequelize[_0x70be('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x70be('0xf')},'role':{'type':Sequelize[_0x70be('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x70be('0x2')]}}; \ No newline at end of file +var _0x36f4=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','setDataValue','exitAt'];(function(_0x57a6ca,_0x4fa1e4){var _0x3d2d2c=function(_0x48efd9){while(--_0x48efd9){_0x57a6ca['push'](_0x57a6ca['shift']());}};_0x3d2d2c(++_0x4fa1e4);}(_0x36f4,0x8d));var _0x436f=function(_0x1c7fa6,_0x401777){_0x1c7fa6=_0x1c7fa6-0x0;var _0x5dce05=_0x36f4[_0x1c7fa6];return _0x5dce05;};'use strict';var Sequelize=require(_0x436f('0x0'));var moment=require(_0x436f('0x1'));module[_0x436f('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x436f('0x3')]},'interface':{'type':Sequelize[_0x436f('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x436f('0x4'),'comment':_0x436f('0x5')},'duration':{'type':Sequelize[_0x436f('0x6')]},'enterAt':{'type':Sequelize[_0x436f('0x7')]},'exitAt':{'type':Sequelize[_0x436f('0x7')],'set':function(_0x2cdc94){var _0xcaa108=moment(_0x2cdc94);var _0x1f9f94=moment(this[_0x436f('0x8')]('enterAt'));var _0x228421=_0xcaa108['diff'](_0x1f9f94,_0x436f('0x9'));this[_0x436f('0xa')](_0x436f('0xb'),_0x2cdc94);this[_0x436f('0xa')](_0x436f('0xc'),_0x228421>=0x0?_0x228421:null);}},'data1':{'type':Sequelize[_0x436f('0x3')],'comment':_0x436f('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x436f('0xe')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x436f('0x3')],'comment':_0x436f('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x436f('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x436f('0x6')]},'uniqueid':{'type':Sequelize[_0x436f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e8aece9..3f8625f 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x55ca,0x126));var _0xa55c=function(_0x53a1be,_0x42dff2){_0x53a1be=_0x53a1be-0x0;var _0x38ae84=_0x55ca[_0x53a1be];return _0x38ae84;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +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(_0x1ae46e,_0x55dd9e){var _0x208f0d=function(_0x498133){while(--_0x498133){_0x1ae46e['push'](_0x1ae46e['shift']());}};_0x208f0d(++_0x55dd9e);}(_0x008c,0x188));var _0xc008=function(_0x263a0a,_0x2aebeb){_0x263a0a=_0x263a0a-0x0;var _0x9fdcb=_0x008c[_0x263a0a];return _0x9fdcb;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4c0206f..0e28a49 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 _0x3d32=['membername','lodash','request-promise','path','rimraf','../../config/environment','define'];(function(_0x503a61,_0x1a48f7){var _0x2202cb=function(_0x4e6fce){while(--_0x4e6fce){_0x503a61['push'](_0x503a61['shift']());}};_0x2202cb(++_0x1a48f7);}(_0x3d32,0x13c));var _0x23d3=function(_0x579a12,_0xaf7f4c){_0x579a12=_0x579a12-0x0;var _0x42758c=_0x3d32[_0x579a12];return _0x42758c;};'use strict';var _=require(_0x23d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23d3('0x1'));var fs=require('fs');var path=require(_0x23d3('0x2'));var rimraf=require(_0x23d3('0x3'));var config=require(_0x23d3('0x4'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x40e1c4,_0x5ae258){return _0x40e1c4[_0x23d3('0x5')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x23d3('0x6'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x71fb=['lodash','util','../../config/logger','bluebird','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x71fb,0xd0));var _0xb71f=function(_0x1556cc,_0x5547de){_0x1556cc=_0x1556cc-0x0;var _0x566cba=_0x71fb[_0x1556cc];return _0x566cba;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require(_0xb71f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb71f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb71f('0x4'));var rimraf=require(_0xb71f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb71f('0x6'));module[_0xb71f('0x7')]=function(_0x3b0450,_0x5a4552){return _0x3b0450[_0xb71f('0x8')]('MemberReport',attributes,{'tableName':_0xb71f('0x9'),'paranoid':![],'indexes':[{'name':_0xb71f('0xa'),'fields':[_0xb71f('0xb'),_0xb71f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d0e81a7..0d35466 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 _0x0619=['MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','info','CreateMemberReport','create','body','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5bac10,_0x436643){var _0x362c49=function(_0x28b940){while(--_0x28b940){_0x5bac10['push'](_0x5bac10['shift']());}};_0x362c49(++_0x436643);}(_0x0619,0x90));var _0x9061=function(_0x433942,_0x437df2){_0x433942=_0x433942-0x0;var _0x4796cb=_0x0619[_0x433942];return _0x4796cb;};'use strict';var _=require(_0x9061('0x0'));var util=require(_0x9061('0x1'));var moment=require(_0x9061('0x2'));var BPromise=require(_0x9061('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9061('0x4'));var db=require(_0x9061('0x5'))['db'];var utils=require(_0x9061('0x6'));var logger=require(_0x9061('0x7'))(_0x9061('0x8'));var config=require(_0x9061('0x9'));var jayson=require(_0x9061('0xa'));var client=jayson[_0x9061('0xb')][_0x9061('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x259fbd,_0x287026,_0x5a950f){return new BPromise(function(_0x3ab87c,_0x59c323){return client['request'](_0x259fbd,_0x5a950f)[_0x9061('0xd')](function(_0x3b27f7){logger['info']('MemberReport,\x20%s,\x20%s',_0x287026,_0x9061('0xe'));logger[_0x9061('0xf')](_0x9061('0x10'),_0x287026,_0x9061('0xe'),JSON[_0x9061('0x11')](_0x3b27f7));if(_0x3b27f7[_0x9061('0x12')]){if(_0x3b27f7[_0x9061('0x12')][_0x9061('0x13')]===0x1f4){logger[_0x9061('0x12')](_0x9061('0x14'),_0x287026,_0x3b27f7[_0x9061('0x12')][_0x9061('0x15')]);return _0x59c323(_0x3b27f7[_0x9061('0x12')]['message']);}logger['error'](_0x9061('0x14'),_0x287026,_0x3b27f7[_0x9061('0x12')][_0x9061('0x15')]);return _0x3ab87c(_0x3b27f7[_0x9061('0x12')][_0x9061('0x15')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x287026,_0x9061('0xe'));_0x3ab87c(_0x3b27f7[_0x9061('0x16')]['message']);}})[_0x9061('0x17')](function(_0x4f2ea6){logger[_0x9061('0x12')]('MemberReport,\x20%s,\x20%s',_0x287026,_0x4f2ea6);_0x59c323(_0x4f2ea6);});});}exports[_0x9061('0x18')]=function(_0x5eae3a){var _0xe89ff2=this;return new Promise(function(_0x358907,_0x1cabb0){return db[_0x9061('0x19')][_0x9061('0x1a')]({'raw':_0x5eae3a[_0x9061('0x1b')]?_0x5eae3a[_0x9061('0x1b')][_0x9061('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eae3a['options']?_0x5eae3a[_0x9061('0x1b')][_0x9061('0x1d')]||null:null,'attributes':_0x5eae3a[_0x9061('0x1b')]?_0x5eae3a[_0x9061('0x1b')]['attributes']||null:null,'limit':_0x5eae3a[_0x9061('0x1b')]?_0x5eae3a[_0x9061('0x1b')]['limit']||null:null,'include':_0x5eae3a['options']?_0x5eae3a['options'][_0x9061('0x1e')]?_[_0x9061('0x1f')](_0x5eae3a['options']['include'],function(_0xbaa53a){return{'model':db[_0xbaa53a['model']],'as':_0xbaa53a['as'],'attributes':_0xbaa53a['attributes'],'include':_0xbaa53a[_0x9061('0x1e')]?_[_0x9061('0x1f')](_0xbaa53a[_0x9061('0x1e')],function(_0x17825b){return{'model':db[_0x17825b[_0x9061('0x20')]],'as':_0x17825b['as'],'attributes':_0x17825b[_0x9061('0x21')],'include':_0x17825b[_0x9061('0x1e')]?_[_0x9061('0x1f')](_0x17825b[_0x9061('0x1e')],function(_0x26962b){return{'model':db[_0x26962b[_0x9061('0x20')]],'as':_0x26962b['as'],'attributes':_0x26962b[_0x9061('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf4f4){logger[_0x9061('0x22')](_0x9061('0x18'),_0x5eae3a);logger[_0x9061('0xf')](_0x9061('0x18'),_0x5eae3a,JSON[_0x9061('0x11')](_0x5bf4f4));_0x358907(_0x5bf4f4);})['catch'](function(_0x2355d3){logger['error']('GetMemberReport',_0x2355d3[_0x9061('0x15')],_0x5eae3a);_0x1cabb0(_0xe89ff2[_0x9061('0x12')](0x1f4,_0x2355d3[_0x9061('0x15')]));});});};exports[_0x9061('0x23')]=function(_0x230a29){var _0x5a9ca4=this;return new Promise(function(_0x3c29d1,_0x33e248){return db[_0x9061('0x19')][_0x9061('0x24')](_0x230a29[_0x9061('0x25')],{'raw':_0x230a29['options']?_0x230a29[_0x9061('0x1b')][_0x9061('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x70754f){logger['info'](_0x9061('0x23'),_0x230a29);logger['debug']('CreateMemberReport',_0x230a29,JSON[_0x9061('0x11')](_0x70754f));_0x3c29d1(_0x70754f);})[_0x9061('0x17')](function(_0x49672b){logger[_0x9061('0x12')]('CreateMemberReport',_0x49672b[_0x9061('0x15')],_0x230a29);_0x33e248(_0x5a9ca4[_0x9061('0x12')](0x1f4,_0x49672b['message']));});});};exports[_0x9061('0x26')]=function(_0x1ee5d4){var _0x1cae3b=this;return new Promise(function(_0x2046d9,_0x53672b){return db[_0x9061('0x19')][_0x9061('0x27')](_0x1ee5d4['body'],{'raw':_0x1ee5d4['options']?_0x1ee5d4[_0x9061('0x1b')][_0x9061('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ee5d4['options']?_0x1ee5d4[_0x9061('0x1b')][_0x9061('0x1d')]||null:null,'attributes':_0x1ee5d4['options']?_0x1ee5d4[_0x9061('0x1b')][_0x9061('0x21')]||null:null,'limit':_0x1ee5d4[_0x9061('0x1b')]?_0x1ee5d4[_0x9061('0x1b')][_0x9061('0x28')]||null:null})[_0x9061('0xd')](function(_0x146e47){logger[_0x9061('0x22')](_0x9061('0x26'),_0x1ee5d4);logger['debug'](_0x9061('0x26'),_0x1ee5d4,JSON['stringify'](_0x146e47));_0x2046d9(_0x146e47);})[_0x9061('0x17')](function(_0x4e5228){logger[_0x9061('0x12')](_0x9061('0x26'),_0x4e5228[_0x9061('0x15')],_0x1ee5d4);_0x53672b(_0x1cae3b[_0x9061('0x12')](0x1f4,_0x4e5228['message']));});});}; \ No newline at end of file +var _0x9303=['create','body','raw','UpdateMemberReport','update','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','debug','catch','CreateMemberReport'];(function(_0x5c30f0,_0x1d9f11){var _0x501e8f=function(_0x38bc5a){while(--_0x38bc5a){_0x5c30f0['push'](_0x5c30f0['shift']());}};_0x501e8f(++_0x1d9f11);}(_0x9303,0xd7));var _0x3930=function(_0x380b08,_0x1df63a){_0x380b08=_0x380b08-0x0;var _0x22f65d=_0x9303[_0x380b08];return _0x22f65d;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3930('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3930('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3930('0x3'))(_0x3930('0x4'));var config=require(_0x3930('0x5'));var jayson=require(_0x3930('0x6'));var client=jayson['client'][_0x3930('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55af25,_0x47d206,_0x20f2d8){return new BPromise(function(_0x4397b0,_0x20ba32){return client[_0x3930('0x8')](_0x55af25,_0x20f2d8)[_0x3930('0x9')](function(_0x58e723){logger['info'](_0x3930('0xa'),_0x47d206,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x47d206,_0x3930('0xb'),JSON[_0x3930('0xc')](_0x58e723));if(_0x58e723[_0x3930('0xd')]){if(_0x58e723[_0x3930('0xd')][_0x3930('0xe')]===0x1f4){logger['error'](_0x3930('0xa'),_0x47d206,_0x58e723['error'][_0x3930('0xf')]);return _0x20ba32(_0x58e723[_0x3930('0xd')][_0x3930('0xf')]);}logger['error'](_0x3930('0xa'),_0x47d206,_0x58e723[_0x3930('0xd')]['message']);return _0x4397b0(_0x58e723[_0x3930('0xd')][_0x3930('0xf')]);}else{logger[_0x3930('0x10')](_0x3930('0xa'),_0x47d206,'request\x20sent');_0x4397b0(_0x58e723['result'][_0x3930('0xf')]);}})['catch'](function(_0x2a2562){logger['error'](_0x3930('0xa'),_0x47d206,_0x2a2562);_0x20ba32(_0x2a2562);});});}exports[_0x3930('0x11')]=function(_0x5a1c39){var _0x4a1405=this;return new Promise(function(_0x4b02b6,_0x1427f6){return db[_0x3930('0x12')][_0x3930('0x13')]({'raw':_0x5a1c39['options']?_0x5a1c39['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a1c39['options']?_0x5a1c39[_0x3930('0x14')][_0x3930('0x15')]||null:null,'attributes':_0x5a1c39[_0x3930('0x14')]?_0x5a1c39[_0x3930('0x14')][_0x3930('0x16')]||null:null,'limit':_0x5a1c39['options']?_0x5a1c39[_0x3930('0x14')][_0x3930('0x17')]||null:null,'include':_0x5a1c39[_0x3930('0x14')]?_0x5a1c39['options'][_0x3930('0x18')]?_[_0x3930('0x19')](_0x5a1c39[_0x3930('0x14')][_0x3930('0x18')],function(_0x2bcc3b){return{'model':db[_0x2bcc3b[_0x3930('0x1a')]],'as':_0x2bcc3b['as'],'attributes':_0x2bcc3b[_0x3930('0x16')],'include':_0x2bcc3b[_0x3930('0x18')]?_['map'](_0x2bcc3b[_0x3930('0x18')],function(_0x1dcdcd){return{'model':db[_0x1dcdcd[_0x3930('0x1a')]],'as':_0x1dcdcd['as'],'attributes':_0x1dcdcd[_0x3930('0x16')],'include':_0x1dcdcd[_0x3930('0x18')]?_['map'](_0x1dcdcd[_0x3930('0x18')],function(_0x7b6825){return{'model':db[_0x7b6825[_0x3930('0x1a')]],'as':_0x7b6825['as'],'attributes':_0x7b6825['attributes']};}):[]};}):[]};}):[]:[]})[_0x3930('0x9')](function(_0x306d5b){logger[_0x3930('0x10')](_0x3930('0x11'),_0x5a1c39);logger[_0x3930('0x1b')]('GetMemberReport',_0x5a1c39,JSON[_0x3930('0xc')](_0x306d5b));_0x4b02b6(_0x306d5b);})[_0x3930('0x1c')](function(_0xca904a){logger['error'](_0x3930('0x11'),_0xca904a[_0x3930('0xf')],_0x5a1c39);_0x1427f6(_0x4a1405[_0x3930('0xd')](0x1f4,_0xca904a[_0x3930('0xf')]));});});};exports[_0x3930('0x1d')]=function(_0x8fdd26){var _0xcd21b7=this;return new Promise(function(_0xc4a53e,_0x148f4e){return db[_0x3930('0x12')][_0x3930('0x1e')](_0x8fdd26[_0x3930('0x1f')],{'raw':_0x8fdd26[_0x3930('0x14')]?_0x8fdd26[_0x3930('0x14')][_0x3930('0x20')]===undefined?!![]:![]:!![]})[_0x3930('0x9')](function(_0x3c9fb3){logger[_0x3930('0x10')](_0x3930('0x1d'),_0x8fdd26);logger[_0x3930('0x1b')]('CreateMemberReport',_0x8fdd26,JSON['stringify'](_0x3c9fb3));_0xc4a53e(_0x3c9fb3);})['catch'](function(_0x298387){logger[_0x3930('0xd')]('CreateMemberReport',_0x298387[_0x3930('0xf')],_0x8fdd26);_0x148f4e(_0xcd21b7[_0x3930('0xd')](0x1f4,_0x298387['message']));});});};exports[_0x3930('0x21')]=function(_0x587492){var _0x476e6e=this;return new Promise(function(_0x3aee1f,_0xbb5110){return db[_0x3930('0x12')][_0x3930('0x22')](_0x587492[_0x3930('0x1f')],{'raw':_0x587492[_0x3930('0x14')]?_0x587492[_0x3930('0x14')][_0x3930('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587492[_0x3930('0x14')]?_0x587492[_0x3930('0x14')][_0x3930('0x15')]||null:null,'attributes':_0x587492[_0x3930('0x14')]?_0x587492[_0x3930('0x14')][_0x3930('0x16')]||null:null,'limit':_0x587492[_0x3930('0x14')]?_0x587492['options'][_0x3930('0x17')]||null:null})['then'](function(_0x33c7d2){logger['info'](_0x3930('0x21'),_0x587492);logger['debug']('UpdateMemberReport',_0x587492,JSON[_0x3930('0xc')](_0x33c7d2));_0x3aee1f(_0x33c7d2);})[_0x3930('0x1c')](function(_0x504cd6){logger['error'](_0x3930('0x21'),_0x504cd6['message'],_0x587492);_0xbb5110(_0x476e6e[_0x3930('0xd')](0x1f4,_0x504cd6[_0x3930('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 13da835..0339fa5 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 _0x1db9=['express','Router','../../components/auth/service','../../components/interaction/service','get','multer','util','path','connect-timeout'];(function(_0x4d1d45,_0xdcd26){var _0x419daf=function(_0x1a4597){while(--_0x1a4597){_0x4d1d45['push'](_0x4d1d45['shift']());}};_0x419daf(++_0xdcd26);}(_0x1db9,0x176));var _0x91db=function(_0x529dcd,_0x3835f4){_0x529dcd=_0x529dcd-0x0;var _0x4b44f1=_0x1db9[_0x529dcd];return _0x4b44f1;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x91db('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x58f0=['index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./migration.controller','get'];(function(_0x4af78d,_0x10b5e1){var _0x1892da=function(_0x45d2a9){while(--_0x45d2a9){_0x4af78d['push'](_0x4af78d['shift']());}};_0x1892da(++_0x10b5e1);}(_0x58f0,0x1a6));var _0x058f=function(_0x256fb6,_0xe8343b){_0x256fb6=_0x256fb6-0x0;var _0x35e3be=_0x58f0[_0x256fb6];return _0x35e3be;};'use strict';var multer=require(_0x058f('0x0'));var util=require(_0x058f('0x1'));var path=require(_0x058f('0x2'));var timeout=require(_0x058f('0x3'));var express=require(_0x058f('0x4'));var router=express[_0x058f('0x5')]();var fs_extra=require(_0x058f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x058f('0x7'));var config=require('../../config/environment');var controller=require(_0x058f('0x8'));router[_0x058f('0x9')]('/',controller[_0x058f('0xa')]);module[_0x058f('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7326513..9aa91aa 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 _0x3c04=['exports','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c04,0x192));var _0x43c0=function(_0x25b459,_0x347064){_0x25b459=_0x25b459-0x0;var _0x4da043=_0x3c04[_0x25b459];return _0x4da043;};'use strict';var Sequelize=require('sequelize');module[_0x43c0('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x43c0('0x1')}}; \ No newline at end of file +var _0x2f58=['exports','version','sequelize'];(function(_0x7b39b5,_0x24375c){var _0x1e54fd=function(_0x34ec67){while(--_0x34ec67){_0x7b39b5['push'](_0x7b39b5['shift']());}};_0x1e54fd(++_0x24375c);}(_0x2f58,0x1d0));var _0x82f5=function(_0x527112,_0x56a4d5){_0x527112=_0x527112-0x0;var _0x7a7df3=_0x2f58[_0x527112];return _0x7a7df3;};'use strict';var Sequelize=require(_0x82f5('0x0'));module[_0x82f5('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x82f5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 54ea743..d30bf44 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 _0x1b4d=['path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','Migration','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x1b4d,0x1ea));var _0xd1b4=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x1b4d[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1b4('0x1'));var rp=require(_0xd1b4('0x2'));var moment=require(_0xd1b4('0x3'));var BPromise=require(_0xd1b4('0x4'));var Mustache=require(_0xd1b4('0x5'));var util=require(_0xd1b4('0x6'));var path=require(_0xd1b4('0x7'));var sox=require(_0xd1b4('0x8'));var csv=require(_0xd1b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1b4('0xa'));var _=require(_0xd1b4('0xb'));var squel=require(_0xd1b4('0xc'));var crypto=require(_0xd1b4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd1b4('0xe'));var toCsv=require(_0xd1b4('0x9'));var querystring=require('querystring');var Papa=require(_0xd1b4('0xf'));var Redis=require(_0xd1b4('0x10'));var authService=require(_0xd1b4('0x11'));var qs=require(_0xd1b4('0x12'));var as=require(_0xd1b4('0x13'));var hardwareService=require(_0xd1b4('0x14'));var logger=require(_0xd1b4('0x15'))(_0xd1b4('0x16'));var utils=require(_0xd1b4('0x17'));var config=require(_0xd1b4('0x18'));var licenseUtil=require(_0xd1b4('0x19'));var db=require(_0xd1b4('0x1a'))['db'];function respondWithStatusCode(_0x8f09f7,_0x3d4439){_0x3d4439=_0x3d4439||0xcc;return function(_0x330f01){if(_0x330f01){return _0x8f09f7[_0xd1b4('0x1b')](_0x3d4439);}return _0x8f09f7[_0xd1b4('0x1c')](_0x3d4439)[_0xd1b4('0x1d')]();};}function respondWithResult(_0x35bbca,_0x3146fa){_0x3146fa=_0x3146fa||0xc8;return function(_0x50dc58){if(_0x50dc58){return _0x35bbca['status'](_0x3146fa)['json'](_0x50dc58);}};}function respondWithFilteredResult(_0x597ec0,_0x54f2f1){return function(_0x53d402){if(_0x53d402){var _0xd3f8ae=typeof _0x54f2f1[_0xd1b4('0x1e')]===_0xd1b4('0x1f')&&typeof _0x54f2f1[_0xd1b4('0x20')]==='undefined';var _0x493cde=_0x53d402[_0xd1b4('0x21')];var _0x1c1a3c=_0xd3f8ae?0x0:_0x54f2f1[_0xd1b4('0x1e')];var _0x623d8c=_0xd3f8ae?_0x53d402[_0xd1b4('0x21')]:_0x54f2f1[_0xd1b4('0x1e')]+_0x54f2f1[_0xd1b4('0x20')];var _0x4d823f;if(_0x623d8c>=_0x493cde){_0x623d8c=_0x493cde;_0x4d823f=0xc8;}else{_0x4d823f=0xce;}_0x597ec0['status'](_0x4d823f);return _0x597ec0[_0xd1b4('0x22')](_0xd1b4('0x23'),_0x1c1a3c+'-'+_0x623d8c+'/'+_0x493cde)[_0xd1b4('0x24')](_0x53d402);}return null;};}function patchUpdates(_0x4547b2){return function(_0x5e40c4){try{jsonpatch[_0xd1b4('0x25')](_0x5e40c4,_0x4547b2,!![]);}catch(_0x5567e8){return BPromise[_0xd1b4('0x26')](_0x5567e8);}return _0x5e40c4[_0xd1b4('0x27')]();};}function saveUpdates(_0x598c66,_0x55eb55){return function(_0x5b964b){if(_0x5b964b){return _0x5b964b[_0xd1b4('0x28')](_0x598c66)[_0xd1b4('0x29')](function(_0x5d362f){return _0x5d362f;});}return null;};}function removeEntity(_0x30075d,_0x5cb67f){return function(_0x474253){if(_0x474253){return _0x474253[_0xd1b4('0x2a')]()[_0xd1b4('0x29')](function(){_0x30075d[_0xd1b4('0x1c')](0xcc)[_0xd1b4('0x1d')]();});}};}function handleEntityNotFound(_0x30fdb4,_0x4d77a8){return function(_0x442bae){if(!_0x442bae){_0x30fdb4[_0xd1b4('0x1b')](0x194);}return _0x442bae;};}function handleError(_0x394407,_0x3c5737){_0x3c5737=_0x3c5737||0x1f4;return function(_0x2d49fb){logger['error'](_0x2d49fb['stack']);if(_0x2d49fb['name']){delete _0x2d49fb[_0xd1b4('0x2b')];}_0x394407[_0xd1b4('0x1c')](_0x3c5737)[_0xd1b4('0x2c')](_0x2d49fb);};}exports['index']=function(_0x2ccae7,_0x1d27ce){var _0x40bf9={},_0x511daa={},_0x1e5df6={'count':0x0,'rows':[]};var _0x41f977=_[_0xd1b4('0x2d')](db[_0xd1b4('0x2e')][_0xd1b4('0x2f')],function(_0x177298){return{'name':_0x177298['fieldName'],'type':_0x177298[_0xd1b4('0x30')][_0xd1b4('0x31')]};});_0x511daa['model']=_['map'](_0x41f977,'name');_0x511daa['query']=_[_0xd1b4('0x32')](_0x2ccae7[_0xd1b4('0x33')]);_0x511daa['filters']=_[_0xd1b4('0x34')](_0x511daa[_0xd1b4('0x35')],_0x511daa[_0xd1b4('0x33')]);_0x40bf9[_0xd1b4('0x36')]=_[_0xd1b4('0x34')](_0x511daa[_0xd1b4('0x35')],qs[_0xd1b4('0x37')](_0x2ccae7[_0xd1b4('0x33')]['fields']));_0x40bf9[_0xd1b4('0x36')]=_0x40bf9['attributes'][_0xd1b4('0x38')]?_0x40bf9[_0xd1b4('0x36')]:_0x511daa[_0xd1b4('0x35')];if(!_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x39')](_0xd1b4('0x3a'))){_0x40bf9[_0xd1b4('0x20')]=qs[_0xd1b4('0x20')](_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x20')]);_0x40bf9[_0xd1b4('0x1e')]=qs[_0xd1b4('0x1e')](_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x1e')]);}_0x40bf9[_0xd1b4('0x3b')]=qs[_0xd1b4('0x3c')](_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x3c')]);_0x40bf9['where']=qs['filters'](_['pick'](_0x2ccae7['query'],_0x511daa[_0xd1b4('0x3d')]),_0x41f977);if(_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x3e')]){_0x40bf9[_0xd1b4('0x3f')]=_[_0xd1b4('0x40')](_0x40bf9[_0xd1b4('0x3f')],{'$or':_['map'](_0x41f977,function(_0x26b85f){if(_0x26b85f[_0xd1b4('0x30')]!==_0xd1b4('0x41')){var _0x451db3={};_0x451db3[_0x26b85f[_0xd1b4('0x2b')]]={'$like':'%'+_0x2ccae7['query'][_0xd1b4('0x3e')]+'%'};return _0x451db3;}})});}_0x40bf9=_['merge']({},_0x40bf9,_0x2ccae7['options']);var _0x2ecf05={'where':_0x40bf9['where']};return db[_0xd1b4('0x2e')][_0xd1b4('0x21')](_0x2ecf05)['then'](function(_0x5428ae){_0x1e5df6[_0xd1b4('0x21')]=_0x5428ae;if(_0x2ccae7[_0xd1b4('0x33')][_0xd1b4('0x42')]){_0x40bf9[_0xd1b4('0x43')]=[{'all':!![]}];}return db['Migration'][_0xd1b4('0x44')](_0x40bf9);})['then'](function(_0x386721){_0x1e5df6[_0xd1b4('0x45')]=_0x386721;return _0x1e5df6;})['then'](respondWithFilteredResult(_0x1d27ce,_0x40bf9))[_0xd1b4('0x46')](handleError(_0x1d27ce,null));}; \ No newline at end of file +var _0xef0c=['count','offset','set','apply','update','then','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','catch','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined'];(function(_0x451dd4,_0x451e98){var _0x383b12=function(_0x103dbe){while(--_0x103dbe){_0x451dd4['push'](_0x451dd4['shift']());}};_0x383b12(++_0x451e98);}(_0xef0c,0x11a));var _0xcef0=function(_0x1ef701,_0x1bf366){_0x1ef701=_0x1ef701-0x0;var _0x448d94=_0xef0c[_0x1ef701];return _0x448d94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcef0('0x0'));var zipdir=require(_0xcef0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcef0('0x2'));var moment=require('moment');var BPromise=require(_0xcef0('0x3'));var Mustache=require('mustache');var util=require(_0xcef0('0x4'));var path=require('path');var sox=require(_0xcef0('0x5'));var csv=require(_0xcef0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcef0('0x7'));var _=require(_0xcef0('0x8'));var squel=require(_0xcef0('0x9'));var crypto=require('crypto');var jsforce=require(_0xcef0('0xa'));var deskjs=require(_0xcef0('0xb'));var toCsv=require(_0xcef0('0x6'));var querystring=require(_0xcef0('0xc'));var Papa=require('papaparse');var Redis=require(_0xcef0('0xd'));var authService=require(_0xcef0('0xe'));var qs=require(_0xcef0('0xf'));var as=require(_0xcef0('0x10'));var hardwareService=require(_0xcef0('0x11'));var logger=require(_0xcef0('0x12'))(_0xcef0('0x13'));var utils=require(_0xcef0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcef0('0x15'))['db'];function respondWithStatusCode(_0x49c5b3,_0x289dbb){_0x289dbb=_0x289dbb||0xcc;return function(_0x4ed577){if(_0x4ed577){return _0x49c5b3[_0xcef0('0x16')](_0x289dbb);}return _0x49c5b3[_0xcef0('0x17')](_0x289dbb)[_0xcef0('0x18')]();};}function respondWithResult(_0x5e7187,_0x2e9de2){_0x2e9de2=_0x2e9de2||0xc8;return function(_0x5cab73){if(_0x5cab73){return _0x5e7187[_0xcef0('0x17')](_0x2e9de2)[_0xcef0('0x19')](_0x5cab73);}};}function respondWithFilteredResult(_0x4dab69,_0xb01ab9){return function(_0x2fe7d4){if(_0x2fe7d4){var _0x5e9c52=typeof _0xb01ab9['offset']==='undefined'&&typeof _0xb01ab9[_0xcef0('0x1a')]===_0xcef0('0x1b');var _0x481da2=_0x2fe7d4[_0xcef0('0x1c')];var _0x15753a=_0x5e9c52?0x0:_0xb01ab9['offset'];var _0x4817f1=_0x5e9c52?_0x2fe7d4[_0xcef0('0x1c')]:_0xb01ab9[_0xcef0('0x1d')]+_0xb01ab9[_0xcef0('0x1a')];var _0x3072b2;if(_0x4817f1>=_0x481da2){_0x4817f1=_0x481da2;_0x3072b2=0xc8;}else{_0x3072b2=0xce;}_0x4dab69[_0xcef0('0x17')](_0x3072b2);return _0x4dab69[_0xcef0('0x1e')]('Content-Range',_0x15753a+'-'+_0x4817f1+'/'+_0x481da2)[_0xcef0('0x19')](_0x2fe7d4);}return null;};}function patchUpdates(_0x35208c){return function(_0x1f5756){try{jsonpatch[_0xcef0('0x1f')](_0x1f5756,_0x35208c,!![]);}catch(_0x3f1936){return BPromise['reject'](_0x3f1936);}return _0x1f5756['save']();};}function saveUpdates(_0x2bfb37,_0x59c8a7){return function(_0x1b5aea){if(_0x1b5aea){return _0x1b5aea[_0xcef0('0x20')](_0x2bfb37)[_0xcef0('0x21')](function(_0x2a60c0){return _0x2a60c0;});}return null;};}function removeEntity(_0xe875a1,_0x1b1118){return function(_0x2384fa){if(_0x2384fa){return _0x2384fa['destroy']()['then'](function(){_0xe875a1[_0xcef0('0x17')](0xcc)[_0xcef0('0x18')]();});}};}function handleEntityNotFound(_0x1d960e,_0x2b731d){return function(_0x461e28){if(!_0x461e28){_0x1d960e[_0xcef0('0x16')](0x194);}return _0x461e28;};}function handleError(_0x2d5578,_0x1ac6ba){_0x1ac6ba=_0x1ac6ba||0x1f4;return function(_0x5aa40a){logger['error'](_0x5aa40a[_0xcef0('0x22')]);if(_0x5aa40a[_0xcef0('0x23')]){delete _0x5aa40a[_0xcef0('0x23')];}_0x2d5578[_0xcef0('0x17')](_0x1ac6ba)[_0xcef0('0x24')](_0x5aa40a);};}exports[_0xcef0('0x25')]=function(_0x4dc171,_0x22d5f7){var _0x599964={},_0x4b7399={},_0x35fb32={'count':0x0,'rows':[]};var _0x2a6a2c=_[_0xcef0('0x26')](db[_0xcef0('0x27')][_0xcef0('0x28')],function(_0x592732){return{'name':_0x592732[_0xcef0('0x29')],'type':_0x592732[_0xcef0('0x2a')]['key']};});_0x4b7399[_0xcef0('0x2b')]=_['map'](_0x2a6a2c,_0xcef0('0x23'));_0x4b7399[_0xcef0('0x2c')]=_[_0xcef0('0x2d')](_0x4dc171[_0xcef0('0x2c')]);_0x4b7399[_0xcef0('0x2e')]=_[_0xcef0('0x2f')](_0x4b7399[_0xcef0('0x2b')],_0x4b7399[_0xcef0('0x2c')]);_0x599964[_0xcef0('0x30')]=_[_0xcef0('0x2f')](_0x4b7399['model'],qs[_0xcef0('0x31')](_0x4dc171[_0xcef0('0x2c')][_0xcef0('0x31')]));_0x599964[_0xcef0('0x30')]=_0x599964['attributes'][_0xcef0('0x32')]?_0x599964[_0xcef0('0x30')]:_0x4b7399[_0xcef0('0x2b')];if(!_0x4dc171[_0xcef0('0x2c')][_0xcef0('0x33')](_0xcef0('0x34'))){_0x599964[_0xcef0('0x1a')]=qs[_0xcef0('0x1a')](_0x4dc171[_0xcef0('0x2c')]['limit']);_0x599964[_0xcef0('0x1d')]=qs[_0xcef0('0x1d')](_0x4dc171[_0xcef0('0x2c')][_0xcef0('0x1d')]);}_0x599964['order']=qs['sort'](_0x4dc171['query'][_0xcef0('0x35')]);_0x599964['where']=qs['filters'](_[_0xcef0('0x36')](_0x4dc171['query'],_0x4b7399['filters']),_0x2a6a2c);if(_0x4dc171[_0xcef0('0x2c')][_0xcef0('0x37')]){_0x599964[_0xcef0('0x38')]=_['merge'](_0x599964[_0xcef0('0x38')],{'$or':_[_0xcef0('0x26')](_0x2a6a2c,function(_0x1d0d3e){if(_0x1d0d3e[_0xcef0('0x2a')]!==_0xcef0('0x39')){var _0x17fe7f={};_0x17fe7f[_0x1d0d3e[_0xcef0('0x23')]]={'$like':'%'+_0x4dc171['query'][_0xcef0('0x37')]+'%'};return _0x17fe7f;}})});}_0x599964=_['merge']({},_0x599964,_0x4dc171[_0xcef0('0x3a')]);var _0x3a1140={'where':_0x599964[_0xcef0('0x38')]};return db[_0xcef0('0x27')][_0xcef0('0x1c')](_0x3a1140)[_0xcef0('0x21')](function(_0x445a8c){_0x35fb32[_0xcef0('0x1c')]=_0x445a8c;if(_0x4dc171[_0xcef0('0x2c')][_0xcef0('0x3b')]){_0x599964['include']=[{'all':!![]}];}return db[_0xcef0('0x27')][_0xcef0('0x3c')](_0x599964);})[_0xcef0('0x21')](function(_0x46b207){_0x35fb32['rows']=_0x46b207;return _0x35fb32;})[_0xcef0('0x21')](respondWithFilteredResult(_0x22d5f7,_0x599964))[_0xcef0('0x3d')](handleError(_0x22d5f7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 5d6f3aa..a7eb086 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 _0x8f3d=['path','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x36453b,_0x2f2e6){var _0x459b19=function(_0x47a181){while(--_0x47a181){_0x36453b['push'](_0x36453b['shift']());}};_0x459b19(++_0x2f2e6);}(_0x8f3d,0x74));var _0xd8f3=function(_0x244a88,_0x1d428e){_0x244a88=_0x244a88-0x0;var _0x167710=_0x8f3d[_0x244a88];return _0x167710;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var logger=require(_0xd8f3('0x2'))(_0xd8f3('0x3'));var moment=require(_0xd8f3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8f3('0x5'));var rimraf=require('rimraf');var config=require(_0xd8f3('0x6'));var attributes=require(_0xd8f3('0x7'));module[_0xd8f3('0x8')]=function(_0x105845,_0x31d908){return _0x105845[_0xd8f3('0x9')]('Migration',attributes,{'tableName':_0xd8f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0d8=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','util'];(function(_0x1c4ad0,_0x11cf55){var _0x421d71=function(_0x29a683){while(--_0x29a683){_0x1c4ad0['push'](_0x1c4ad0['shift']());}};_0x421d71(++_0x11cf55);}(_0xe0d8,0x1a1));var _0x8e0d=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xe0d8[_0x1c34e7];return _0x378cb1;};'use strict';var _=require('lodash');var util=require(_0x8e0d('0x0'));var logger=require(_0x8e0d('0x1'))(_0x8e0d('0x2'));var moment=require(_0x8e0d('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e0d('0x5'));var config=require(_0x8e0d('0x6'));var attributes=require(_0x8e0d('0x7'));module[_0x8e0d('0x8')]=function(_0x56ba7f,_0x47c038){return _0x56ba7f[_0x8e0d('0x9')]('Migration',attributes,{'tableName':_0x8e0d('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 83cad5e..1202b20 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 _0x26bc=['Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x437f8f,_0x443c59){var _0x4286f9=function(_0xfb3702){while(--_0xfb3702){_0x437f8f['push'](_0x437f8f['shift']());}};_0x4286f9(++_0x443c59);}(_0x26bc,0x162));var _0xc26b=function(_0x2da95b,_0x527d8d){_0x2da95b=_0x2da95b-0x0;var _0x37ce05=_0x26bc[_0x2da95b];return _0x37ce05;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('Migration,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});} \ No newline at end of file +var _0xb921=['info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa35eb5,_0xc91775){var _0x4371f7=function(_0x589ab5){while(--_0x589ab5){_0xa35eb5['push'](_0xa35eb5['shift']());}};_0x4371f7(++_0xc91775);}(_0xb921,0x16a));var _0x1b92=function(_0x1efa08,_0x2633ad){_0x1efa08=_0x1efa08-0x0;var _0x11c3da=_0xb921[_0x1efa08];return _0x11c3da;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('Migration,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('Migration,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2422563..1cdce3e 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 _0x47c5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x1d38e0,_0x23dcaf){var _0x26e31b=function(_0x26b77b){while(--_0x26b77b){_0x1d38e0['push'](_0x1d38e0['shift']());}};_0x26e31b(++_0x23dcaf);}(_0x47c5,0x165));var _0x547c=function(_0x551ade,_0x48fa98){_0x551ade=_0x551ade-0x0;var _0xe7d001=_0x47c5[_0x551ade];return _0xe7d001;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0xe')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x10')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x12')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);module[_0x547c('0x14')]=router; \ No newline at end of file +var _0xc029=['show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x32209e,_0x4838f0){var _0x374861=function(_0x362fab){while(--_0x362fab){_0x32209e['push'](_0x32209e['shift']());}};_0x374861(++_0x4838f0);}(_0xc029,0x1df));var _0x9c02=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xc029[_0x424501];return _0xb719af;};'use strict';var multer=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var path=require(_0x9c02('0x2'));var timeout=require(_0x9c02('0x3'));var express=require(_0x9c02('0x4'));var router=express[_0x9c02('0x5')]();var fs_extra=require(_0x9c02('0x6'));var auth=require(_0x9c02('0x7'));var interaction=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var controller=require(_0x9c02('0xa'));router[_0x9c02('0xb')]('/',auth[_0x9c02('0xc')](),controller[_0x9c02('0xd')]);router[_0x9c02('0xb')](_0x9c02('0xe'),auth[_0x9c02('0xc')](),controller[_0x9c02('0xf')]);router['post']('/',auth[_0x9c02('0xc')](),controller['create']);router[_0x9c02('0x10')](_0x9c02('0xe'),auth[_0x9c02('0xc')](),controller[_0x9c02('0x11')]);router['delete'](_0x9c02('0xe'),auth['isAuthenticated'](),controller[_0x9c02('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index fc343ba..a3c0bb2 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 _0x5e07=['localnet','externip','stun','turn','STRING','exports','ENUM'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5e07,0x83));var _0x75e0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5e07[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x75e0('0x0')]={'type':{'type':Sequelize[_0x75e0('0x1')](_0x75e0('0x2'),_0x75e0('0x3'),_0x75e0('0x4'),_0x75e0('0x5'))},'value':{'type':Sequelize[_0x75e0('0x6')]},'username':{'type':Sequelize[_0x75e0('0x6')]},'password':{'type':Sequelize[_0x75e0('0x6')]}}; \ No newline at end of file +var _0x2f48=['STRING','sequelize','exports','ENUM','externip','stun'];(function(_0x56aa4e,_0x4be1ae){var _0x4c588f=function(_0x58c7a7){while(--_0x58c7a7){_0x56aa4e['push'](_0x56aa4e['shift']());}};_0x4c588f(++_0x4be1ae);}(_0x2f48,0x1a5));var _0x82f4=function(_0x473329,_0x3294d0){_0x473329=_0x473329-0x0;var _0x23148f=_0x2f48[_0x473329];return _0x23148f;};'use strict';var Sequelize=require(_0x82f4('0x0'));module[_0x82f4('0x1')]={'type':{'type':Sequelize[_0x82f4('0x2')]('localnet',_0x82f4('0x3'),_0x82f4('0x4'),'turn')},'value':{'type':Sequelize[_0x82f4('0x5')]},'username':{'type':Sequelize[_0x82f4('0x5')]},'password':{'type':Sequelize[_0x82f4('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 80bc65c..121f7d4 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 _0x8dd9=['map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','catch','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','server/files/templates/turn_multiple.ejs','STUN','server/files/templates/network.ejs','util','path','ejs','../../config/logger','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','undefined','count','offset','limit','set','Content-Range','json','destroy','then','end','stack','name','send','index'];(function(_0x256fa5,_0x2965d5){var _0xa54e6f=function(_0x22f895){while(--_0x22f895){_0x256fa5['push'](_0x256fa5['shift']());}};_0xa54e6f(++_0x2965d5);}(_0x8dd9,0x1df));var _0x98dd=function(_0x1d53a8,_0x533494){_0x1d53a8=_0x1d53a8-0x0;var _0x2a3bbc=_0x8dd9[_0x1d53a8];return _0x2a3bbc;};'use strict';var util=require(_0x98dd('0x0'));var path=require(_0x98dd('0x1'));var ejs=require(_0x98dd('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x98dd('0x3'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x98dd('0x4'));var client=jayson[_0x98dd('0x5')][_0x98dd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5cc383,_0x426632,_0x534cbd,_0x249f60){return new Promise(function(_0x531d4e,_0x1223a1){var _0x8e2fe8=_0x249f60||client;return _0x8e2fe8[_0x98dd('0x7')](_0x5cc383,_0x534cbd)['then'](function(_0x1a6b4b){logger[_0x98dd('0x8')](_0x98dd('0x9'),_0x426632,_0x98dd('0xa'));logger[_0x98dd('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x426632,'request\x20sent',JSON['stringify'](_0x1a6b4b));if(_0x1a6b4b[_0x98dd('0xc')]){if(_0x1a6b4b[_0x98dd('0xc')][_0x98dd('0xd')]===0x1f4){logger[_0x98dd('0xc')](_0x98dd('0x9'),_0x426632,_0x1a6b4b[_0x98dd('0xc')][_0x98dd('0xe')]);return _0x1223a1(_0x1a6b4b[_0x98dd('0xc')]['message']);}logger['error']('Network,\x20%s,\x20%s',_0x426632,_0x1a6b4b[_0x98dd('0xc')][_0x98dd('0xe')]);return _0x531d4e(_0x1a6b4b[_0x98dd('0xc')][_0x98dd('0xe')]);}else{logger[_0x98dd('0x8')](_0x98dd('0x9'),_0x426632,_0x98dd('0xa'));_0x531d4e(_0x1a6b4b[_0x98dd('0xf')][_0x98dd('0xe')]);}})['catch'](function(_0x2d8140){logger[_0x98dd('0xc')](_0x98dd('0x9'),_0x426632,_0x2d8140);_0x1223a1(_0x2d8140);});});}function respondWithResult(_0x54787d,_0x44bf78){_0x44bf78=_0x44bf78||0xc8;return function(_0x31aa8b){if(_0x31aa8b){return _0x54787d[_0x98dd('0x10')](_0x44bf78)['json'](_0x31aa8b);}};}function respondWithFilteredResult(_0x2d03ca,_0x32b43d){return function(_0x48414c){if(_0x48414c){var _0x196303=typeof _0x32b43d['offset']===_0x98dd('0x11')&&typeof _0x32b43d['limit']===_0x98dd('0x11');var _0x152423=_0x48414c[_0x98dd('0x12')];var _0xbd669d=_0x196303?0x0:_0x32b43d['offset'];var _0xa63e16=_0x196303?_0x48414c[_0x98dd('0x12')]:_0x32b43d[_0x98dd('0x13')]+_0x32b43d[_0x98dd('0x14')];var _0x476bcf;if(_0xa63e16>=_0x152423){_0xa63e16=_0x152423;_0x476bcf=0xc8;}else{_0x476bcf=0xce;}_0x2d03ca[_0x98dd('0x10')](_0x476bcf);return _0x2d03ca[_0x98dd('0x15')](_0x98dd('0x16'),_0xbd669d+'-'+_0xa63e16+'/'+_0x152423)[_0x98dd('0x17')](_0x48414c);}return null;};}function saveUpdates(_0x5c53e1){return function(_0x39af85){if(_0x39af85){return _0x39af85['update'](_0x5c53e1)['then'](function(_0x4e77f1){return _0x4e77f1;});}return null;};}function removeEntity(_0x3842af){return function(_0x1da1fd){if(_0x1da1fd){return _0x1da1fd[_0x98dd('0x18')]()[_0x98dd('0x19')](function(){_0x3842af[_0x98dd('0x10')](0xcc)[_0x98dd('0x1a')]();});}};}function handleEntityNotFound(_0x20eaf1){return function(_0x35652f){if(!_0x35652f){_0x20eaf1['sendStatus'](0x194);}return _0x35652f;};}function handleError(_0x1c9bdf,_0x99c487){_0x99c487=_0x99c487||0x1f4;return function(_0x1a38a3){logger[_0x98dd('0xc')](_0x1a38a3[_0x98dd('0x1b')]);if(_0x1a38a3[_0x98dd('0x1c')]){delete _0x1a38a3[_0x98dd('0x1c')];}_0x1c9bdf['status'](_0x99c487)[_0x98dd('0x1d')](_0x1a38a3);};}exports[_0x98dd('0x1e')]=function(_0x358726,_0x417faa){var _0xefb690={},_0x20a883={},_0x1f7620={'count':0x0,'rows':[]};var _0x2f8d80=_[_0x98dd('0x1f')](db[_0x98dd('0x20')][_0x98dd('0x21')],function(_0x4a3985){return{'name':_0x4a3985[_0x98dd('0x22')],'type':_0x4a3985[_0x98dd('0x23')][_0x98dd('0x24')]};});_0x20a883[_0x98dd('0x25')]=_['map'](_0x2f8d80,_0x98dd('0x1c'));_0x20a883[_0x98dd('0x26')]=_[_0x98dd('0x27')](_0x358726[_0x98dd('0x26')]);_0x20a883[_0x98dd('0x28')]=_[_0x98dd('0x29')](_0x20a883[_0x98dd('0x25')],_0x20a883['query']);_0xefb690[_0x98dd('0x2a')]=_['intersection'](_0x20a883[_0x98dd('0x25')],qs['fields'](_0x358726['query']['fields']));_0xefb690[_0x98dd('0x2a')]=_0xefb690[_0x98dd('0x2a')][_0x98dd('0x2b')]?_0xefb690['attributes']:_0x20a883['model'];if(!_0x358726[_0x98dd('0x26')][_0x98dd('0x2c')](_0x98dd('0x2d'))){_0xefb690[_0x98dd('0x14')]=qs[_0x98dd('0x14')](_0x358726[_0x98dd('0x26')]['limit']);_0xefb690[_0x98dd('0x13')]=qs[_0x98dd('0x13')](_0x358726[_0x98dd('0x26')][_0x98dd('0x13')]);}_0xefb690[_0x98dd('0x2e')]=qs['sort'](_0x358726[_0x98dd('0x26')][_0x98dd('0x2f')]);_0xefb690[_0x98dd('0x30')]=qs['filters'](_[_0x98dd('0x31')](_0x358726[_0x98dd('0x26')],_0x20a883['filters']),_0x2f8d80);if(_0x358726[_0x98dd('0x26')][_0x98dd('0x32')]){_0xefb690[_0x98dd('0x30')]=_[_0x98dd('0x33')](_0xefb690[_0x98dd('0x30')],{'$or':_['map'](_0x2f8d80,function(_0x3d360b){if(_0x3d360b[_0x98dd('0x23')]!==_0x98dd('0x34')){var _0x24b4cf={};_0x24b4cf[_0x3d360b[_0x98dd('0x1c')]]={'$like':'%'+_0x358726[_0x98dd('0x26')]['filter']+'%'};return _0x24b4cf;}})});}_0xefb690=_[_0x98dd('0x33')]({},_0xefb690,_0x358726[_0x98dd('0x35')]);var _0x50d962={'where':_0xefb690[_0x98dd('0x30')]};return db[_0x98dd('0x20')][_0x98dd('0x12')](_0x50d962)[_0x98dd('0x19')](function(_0x24954d){_0x1f7620['count']=_0x24954d;if(_0x358726[_0x98dd('0x26')][_0x98dd('0x36')]){_0xefb690['include']=[{'all':!![]}];}return db['Network'][_0x98dd('0x37')](_0xefb690);})[_0x98dd('0x19')](function(_0x364af9){_0x1f7620[_0x98dd('0x38')]=_0x364af9;return _0x1f7620;})[_0x98dd('0x19')](respondWithFilteredResult(_0x417faa,_0xefb690))['catch'](handleError(_0x417faa,null));};exports[_0x98dd('0x39')]=function(_0x907cdc,_0x1d8007){var _0x4d1edb={'raw':!![],'where':{'id':_0x907cdc[_0x98dd('0x3a')]['id']}},_0xf6f9c={};_0xf6f9c[_0x98dd('0x25')]=_['keys'](db['Network'][_0x98dd('0x21')]);_0xf6f9c[_0x98dd('0x26')]=_['keys'](_0x907cdc[_0x98dd('0x26')]);_0xf6f9c[_0x98dd('0x28')]=_['intersection'](_0xf6f9c[_0x98dd('0x25')],_0xf6f9c[_0x98dd('0x26')]);_0x4d1edb['attributes']=_['intersection'](_0xf6f9c[_0x98dd('0x25')],qs[_0x98dd('0x3b')](_0x907cdc[_0x98dd('0x26')][_0x98dd('0x3b')]));_0x4d1edb[_0x98dd('0x2a')]=_0x4d1edb[_0x98dd('0x2a')][_0x98dd('0x2b')]?_0x4d1edb[_0x98dd('0x2a')]:_0xf6f9c[_0x98dd('0x25')];if(_0x907cdc[_0x98dd('0x26')][_0x98dd('0x36')]){_0x4d1edb['include']=[{'all':!![]}];}_0x4d1edb=_[_0x98dd('0x33')]({},_0x4d1edb,_0x907cdc[_0x98dd('0x35')]);return db[_0x98dd('0x20')]['find'](_0x4d1edb)['then'](handleEntityNotFound(_0x1d8007,null))[_0x98dd('0x19')](respondWithResult(_0x1d8007,null))[_0x98dd('0x3c')](handleError(_0x1d8007,null));};exports[_0x98dd('0x3d')]=function(_0x5db0a1,_0x51838c){var _0x460832;return db[_0x98dd('0x20')]['create'](_0x5db0a1[_0x98dd('0x3e')],{'raw':!![]})[_0x98dd('0x19')](function(_0x16472c){_0x460832=_0x16472c;return db[_0x98dd('0x20')][_0x98dd('0x37')]({'where':{'type':_0x5db0a1['body'][_0x98dd('0x23')]},'raw':!![]});})[_0x98dd('0x19')](function(_0x4e8639){if(_0x460832[_0x98dd('0x23')][_0x98dd('0x3f')]()=='STUN'){var _0x41eb7c=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],_0x98dd('0x43')),_0x98dd('0x44'));var _0x42271d=ejs[_0x98dd('0x45')](_0x41eb7c,{'networks':_0x4e8639||[]});fs['writeFileSync'](_0x98dd('0x46'),_0x42271d);return respondWithRpcPromise(_0x98dd('0x47'),'create',{'module':_0x98dd('0x48')});}else if(_0x460832['type']['toUpperCase']()==_0x98dd('0x49')){var _0x3f5d4c=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],'server/files/templates/turn_multiple.ejs'),_0x98dd('0x44'));var _0x2d38c9=ejs['render'](_0x3f5d4c,{'networks':_0x4e8639||[]});fs[_0x98dd('0x4a')](_0x98dd('0x4b'),_0x2d38c9);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x3d'),{'module':_0x98dd('0x48')});}else{var _0x5cf404=fs['readFileSync'](path[_0x98dd('0x41')](config['root'],'server/files/templates/network.ejs'),_0x98dd('0x44'));var _0x127677=ejs[_0x98dd('0x45')](_0x5cf404,{'networks':_0x4e8639||[]});fs[_0x98dd('0x4a')](util[_0x98dd('0x4c')](_0x98dd('0x4d'),_0x5db0a1[_0x98dd('0x3e')]['type'][_0x98dd('0x4e')]()),_0x127677);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x3d'),{'module':_0x98dd('0x4f')});}})[_0x98dd('0x19')](function(){return _0x460832;})[_0x98dd('0x19')](respondWithResult(_0x51838c,0xc9))[_0x98dd('0x3c')](handleError(_0x51838c,null));};exports[_0x98dd('0x50')]=function(_0x5cb337,_0x1e89dd){var _0x362687;return db[_0x98dd('0x20')][_0x98dd('0x51')]({'where':{'id':_0x5cb337['params']['id']}})['then'](handleEntityNotFound(_0x1e89dd,null))[_0x98dd('0x19')](saveUpdates(_0x5cb337['body'],null))[_0x98dd('0x19')](function(_0x1619d3){if(_0x1619d3){_0x362687=_0x1619d3;return db[_0x98dd('0x20')][_0x98dd('0x37')]({'where':{'type':_0x362687['type']},'raw':!![]});}return null;})['then'](function(_0x4446a1){if(_0x362687[_0x98dd('0x23')]['toUpperCase']()=='STUN'){var _0x5d24fa=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],_0x98dd('0x43')),'utf8');var _0x4f51ab=ejs['render'](_0x5d24fa,{'networks':_0x4446a1||[]});fs[_0x98dd('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x4f51ab);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x50'),{'module':_0x98dd('0x48')});}else if(_0x362687[_0x98dd('0x23')][_0x98dd('0x3f')]()=='TURN'){var _0x41d807=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config['root'],_0x98dd('0x52')),_0x98dd('0x44'));var _0xb05da4=ejs[_0x98dd('0x45')](_0x41d807,{'networks':_0x4446a1||[]});fs[_0x98dd('0x4a')](_0x98dd('0x4b'),_0xb05da4);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x5ef53c=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],'server/files/templates/network.ejs'),_0x98dd('0x44'));var _0x495803=ejs[_0x98dd('0x45')](_0x5ef53c,{'networks':_0x4446a1||[]});fs[_0x98dd('0x4a')](util[_0x98dd('0x4c')](_0x98dd('0x4d'),_0x5cb337[_0x98dd('0x3e')][_0x98dd('0x23')][_0x98dd('0x4e')]()),_0x495803);return respondWithRpcPromise('Reload',_0x98dd('0x50'),{'module':_0x98dd('0x4f')});}})[_0x98dd('0x19')](function(_0x581d5d){if(_0x581d5d){return _0x362687;}return null;})['then'](respondWithResult(_0x1e89dd,null))[_0x98dd('0x3c')](handleError(_0x1e89dd,null));};exports[_0x98dd('0x18')]=function(_0x841235,_0x3f568e){var _0x3d53dd;return db[_0x98dd('0x20')][_0x98dd('0x51')]({'where':{'id':_0x841235[_0x98dd('0x3a')]['id']}})['then'](function(_0x35e4af){_0x3d53dd=_0x35e4af;return _0x35e4af;})['then'](handleEntityNotFound(_0x3f568e,null))['then'](removeEntity(_0x3f568e,null))[_0x98dd('0x19')](function(){if(_0x3d53dd){return db['Network']['findAll']({'where':{'type':_0x3d53dd[_0x98dd('0x23')]},'raw':!![]});}})[_0x98dd('0x19')](function(_0x4baa9c){if(_0x3d53dd[_0x98dd('0x23')][_0x98dd('0x3f')]()==_0x98dd('0x53')){var _0x49da24=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config['root'],_0x98dd('0x43')),_0x98dd('0x44'));var _0x28dc1b=ejs[_0x98dd('0x45')](_0x49da24,{'networks':_0x4baa9c||[]});fs[_0x98dd('0x4a')](_0x98dd('0x46'),_0x28dc1b);return respondWithRpcPromise('Reload','destroy',{'module':_0x98dd('0x48')});}else if(_0x3d53dd['type'][_0x98dd('0x3f')]()==_0x98dd('0x49')){var _0x52af03=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x172cc3=ejs['render'](_0x52af03,{'networks':_0x4baa9c||[]});fs[_0x98dd('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x172cc3);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x18'),{'module':_0x98dd('0x48')});}else{var _0x4a2db3=fs[_0x98dd('0x40')](path[_0x98dd('0x41')](config[_0x98dd('0x42')],_0x98dd('0x54')),_0x98dd('0x44'));var _0x1c46f6=ejs[_0x98dd('0x45')](_0x4a2db3,{'networks':_0x4baa9c||[]});fs[_0x98dd('0x4a')](util[_0x98dd('0x4c')](_0x98dd('0x4d'),_0x3d53dd['type'][_0x98dd('0x4e')]()),_0x1c46f6);return respondWithRpcPromise(_0x98dd('0x47'),_0x98dd('0x18'),{'module':_0x98dd('0x4f')});}})['catch'](handleError(_0x3f568e,null));}; \ No newline at end of file +var _0x4980=['body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','toLowerCase','update','params','destroy','util','path','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','limit','undefined','offset','count','set','Content-Range','json','end','sendStatus','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create'];(function(_0x4e71f7,_0x147594){var _0x29970b=function(_0x42d937){while(--_0x42d937){_0x4e71f7['push'](_0x4e71f7['shift']());}};_0x29970b(++_0x147594);}(_0x4980,0x11d));var _0x0498=function(_0x58ee61,_0x41f78f){_0x58ee61=_0x58ee61-0x0;var _0x1b8825=_0x4980[_0x58ee61];return _0x1b8825;};'use strict';var util=require(_0x0498('0x0'));var path=require(_0x0498('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x0498('0x2'));var logger=require(_0x0498('0x3'))('api');var config=require(_0x0498('0x4'));var db=require(_0x0498('0x5'))['db'];var jayson=require(_0x0498('0x6'));var client=jayson[_0x0498('0x7')][_0x0498('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f583,_0x453c2b,_0x169233,_0x39c8e2){return new Promise(function(_0x20695c,_0x2e5bfa){var _0x39154e=_0x39c8e2||client;return _0x39154e[_0x0498('0x9')](_0x26f583,_0x169233)[_0x0498('0xa')](function(_0x488e4){logger[_0x0498('0xb')](_0x0498('0xc'),_0x453c2b,_0x0498('0xd'));logger[_0x0498('0xe')](_0x0498('0xf'),_0x453c2b,_0x0498('0xd'),JSON['stringify'](_0x488e4));if(_0x488e4[_0x0498('0x10')]){if(_0x488e4['error'][_0x0498('0x11')]===0x1f4){logger[_0x0498('0x10')](_0x0498('0xc'),_0x453c2b,_0x488e4[_0x0498('0x10')][_0x0498('0x12')]);return _0x2e5bfa(_0x488e4[_0x0498('0x10')][_0x0498('0x12')]);}logger[_0x0498('0x10')](_0x0498('0xc'),_0x453c2b,_0x488e4['error']['message']);return _0x20695c(_0x488e4['error'][_0x0498('0x12')]);}else{logger[_0x0498('0xb')](_0x0498('0xc'),_0x453c2b,_0x0498('0xd'));_0x20695c(_0x488e4[_0x0498('0x13')][_0x0498('0x12')]);}})[_0x0498('0x14')](function(_0x388033){logger[_0x0498('0x10')](_0x0498('0xc'),_0x453c2b,_0x388033);_0x2e5bfa(_0x388033);});});}function respondWithResult(_0x39c731,_0x47eb6d){_0x47eb6d=_0x47eb6d||0xc8;return function(_0x2e33ec){if(_0x2e33ec){return _0x39c731[_0x0498('0x15')](_0x47eb6d)['json'](_0x2e33ec);}};}function respondWithFilteredResult(_0x1ccc14,_0x2262de){return function(_0x3942d4){if(_0x3942d4){var _0x35e786=typeof _0x2262de['offset']==='undefined'&&typeof _0x2262de[_0x0498('0x16')]===_0x0498('0x17');var _0x2f6ba5=_0x3942d4['count'];var _0x13becb=_0x35e786?0x0:_0x2262de[_0x0498('0x18')];var _0x29f2ae=_0x35e786?_0x3942d4[_0x0498('0x19')]:_0x2262de[_0x0498('0x18')]+_0x2262de[_0x0498('0x16')];var _0x17873b;if(_0x29f2ae>=_0x2f6ba5){_0x29f2ae=_0x2f6ba5;_0x17873b=0xc8;}else{_0x17873b=0xce;}_0x1ccc14['status'](_0x17873b);return _0x1ccc14[_0x0498('0x1a')](_0x0498('0x1b'),_0x13becb+'-'+_0x29f2ae+'/'+_0x2f6ba5)[_0x0498('0x1c')](_0x3942d4);}return null;};}function saveUpdates(_0x3ed3eb){return function(_0x1493eb){if(_0x1493eb){return _0x1493eb['update'](_0x3ed3eb)['then'](function(_0x3f4ae4){return _0x3f4ae4;});}return null;};}function removeEntity(_0x33ee88){return function(_0x1d6f80){if(_0x1d6f80){return _0x1d6f80['destroy']()['then'](function(){_0x33ee88[_0x0498('0x15')](0xcc)[_0x0498('0x1d')]();});}};}function handleEntityNotFound(_0xe268da){return function(_0x34c6c1){if(!_0x34c6c1){_0xe268da[_0x0498('0x1e')](0x194);}return _0x34c6c1;};}function handleError(_0x5a4c3f,_0x84bd91){_0x84bd91=_0x84bd91||0x1f4;return function(_0x4ac096){logger[_0x0498('0x10')](_0x4ac096['stack']);if(_0x4ac096['name']){delete _0x4ac096[_0x0498('0x1f')];}_0x5a4c3f[_0x0498('0x15')](_0x84bd91)[_0x0498('0x20')](_0x4ac096);};}exports[_0x0498('0x21')]=function(_0x12e6be,_0x13232c){var _0xbc917e={},_0x4e3464={},_0x19a579={'count':0x0,'rows':[]};var _0x2d6517=_[_0x0498('0x22')](db[_0x0498('0x23')][_0x0498('0x24')],function(_0x5d5413){return{'name':_0x5d5413['fieldName'],'type':_0x5d5413[_0x0498('0x25')][_0x0498('0x26')]};});_0x4e3464[_0x0498('0x27')]=_[_0x0498('0x22')](_0x2d6517,_0x0498('0x1f'));_0x4e3464[_0x0498('0x28')]=_[_0x0498('0x29')](_0x12e6be[_0x0498('0x28')]);_0x4e3464[_0x0498('0x2a')]=_[_0x0498('0x2b')](_0x4e3464['model'],_0x4e3464[_0x0498('0x28')]);_0xbc917e[_0x0498('0x2c')]=_[_0x0498('0x2b')](_0x4e3464[_0x0498('0x27')],qs[_0x0498('0x2d')](_0x12e6be[_0x0498('0x28')][_0x0498('0x2d')]));_0xbc917e['attributes']=_0xbc917e[_0x0498('0x2c')][_0x0498('0x2e')]?_0xbc917e['attributes']:_0x4e3464['model'];if(!_0x12e6be[_0x0498('0x28')][_0x0498('0x2f')](_0x0498('0x30'))){_0xbc917e[_0x0498('0x16')]=qs[_0x0498('0x16')](_0x12e6be['query'][_0x0498('0x16')]);_0xbc917e[_0x0498('0x18')]=qs[_0x0498('0x18')](_0x12e6be[_0x0498('0x28')][_0x0498('0x18')]);}_0xbc917e['order']=qs[_0x0498('0x31')](_0x12e6be[_0x0498('0x28')][_0x0498('0x31')]);_0xbc917e['where']=qs[_0x0498('0x2a')](_[_0x0498('0x32')](_0x12e6be[_0x0498('0x28')],_0x4e3464[_0x0498('0x2a')]),_0x2d6517);if(_0x12e6be['query'][_0x0498('0x33')]){_0xbc917e[_0x0498('0x34')]=_[_0x0498('0x35')](_0xbc917e[_0x0498('0x34')],{'$or':_[_0x0498('0x22')](_0x2d6517,function(_0x1f6f3e){if(_0x1f6f3e[_0x0498('0x25')]!==_0x0498('0x36')){var _0x4ed605={};_0x4ed605[_0x1f6f3e[_0x0498('0x1f')]]={'$like':'%'+_0x12e6be[_0x0498('0x28')][_0x0498('0x33')]+'%'};return _0x4ed605;}})});}_0xbc917e=_[_0x0498('0x35')]({},_0xbc917e,_0x12e6be[_0x0498('0x37')]);var _0x47cd15={'where':_0xbc917e[_0x0498('0x34')]};return db[_0x0498('0x23')][_0x0498('0x19')](_0x47cd15)[_0x0498('0xa')](function(_0x541869){_0x19a579[_0x0498('0x19')]=_0x541869;if(_0x12e6be['query']['includeAll']){_0xbc917e['include']=[{'all':!![]}];}return db[_0x0498('0x23')][_0x0498('0x38')](_0xbc917e);})[_0x0498('0xa')](function(_0x553216){_0x19a579[_0x0498('0x39')]=_0x553216;return _0x19a579;})[_0x0498('0xa')](respondWithFilteredResult(_0x13232c,_0xbc917e))[_0x0498('0x14')](handleError(_0x13232c,null));};exports[_0x0498('0x3a')]=function(_0x1145a7,_0xebae8c){var _0xdbf8e2={'raw':!![],'where':{'id':_0x1145a7['params']['id']}},_0x33483a={};_0x33483a['model']=_[_0x0498('0x29')](db[_0x0498('0x23')][_0x0498('0x24')]);_0x33483a[_0x0498('0x28')]=_['keys'](_0x1145a7['query']);_0x33483a[_0x0498('0x2a')]=_[_0x0498('0x2b')](_0x33483a[_0x0498('0x27')],_0x33483a['query']);_0xdbf8e2['attributes']=_['intersection'](_0x33483a[_0x0498('0x27')],qs[_0x0498('0x2d')](_0x1145a7[_0x0498('0x28')]['fields']));_0xdbf8e2['attributes']=_0xdbf8e2[_0x0498('0x2c')][_0x0498('0x2e')]?_0xdbf8e2['attributes']:_0x33483a[_0x0498('0x27')];if(_0x1145a7[_0x0498('0x28')][_0x0498('0x3b')]){_0xdbf8e2[_0x0498('0x3c')]=[{'all':!![]}];}_0xdbf8e2=_['merge']({},_0xdbf8e2,_0x1145a7['options']);return db[_0x0498('0x23')][_0x0498('0x3d')](_0xdbf8e2)[_0x0498('0xa')](handleEntityNotFound(_0xebae8c,null))[_0x0498('0xa')](respondWithResult(_0xebae8c,null))[_0x0498('0x14')](handleError(_0xebae8c,null));};exports['create']=function(_0x31eed1,_0x5289bf){var _0x12d425;return db[_0x0498('0x23')][_0x0498('0x3e')](_0x31eed1['body'],{'raw':!![]})['then'](function(_0x13306b){_0x12d425=_0x13306b;return db[_0x0498('0x23')][_0x0498('0x38')]({'where':{'type':_0x31eed1[_0x0498('0x3f')][_0x0498('0x25')]},'raw':!![]});})['then'](function(_0x187d78){if(_0x12d425[_0x0498('0x25')][_0x0498('0x40')]()=='STUN'){var _0x3e3b75=fs['readFileSync'](path[_0x0498('0x41')](config[_0x0498('0x42')],_0x0498('0x43')),_0x0498('0x44'));var _0x12221a=ejs[_0x0498('0x45')](_0x3e3b75,{'networks':_0x187d78||[]});fs['writeFileSync'](_0x0498('0x46'),_0x12221a);return respondWithRpcPromise(_0x0498('0x47'),_0x0498('0x3e'),{'module':_0x0498('0x48')});}else if(_0x12d425[_0x0498('0x25')][_0x0498('0x40')]()==_0x0498('0x49')){var _0x165137=fs[_0x0498('0x4a')](path['join'](config[_0x0498('0x42')],_0x0498('0x4b')),_0x0498('0x44'));var _0x57ce95=ejs[_0x0498('0x45')](_0x165137,{'networks':_0x187d78||[]});fs[_0x0498('0x4c')](_0x0498('0x4d'),_0x57ce95);return respondWithRpcPromise('Reload',_0x0498('0x3e'),{'module':'res_stun_monitor.so'});}else{var _0x3a0e68=fs[_0x0498('0x4a')](path['join'](config[_0x0498('0x42')],_0x0498('0x4e')),_0x0498('0x44'));var _0x788a5e=ejs[_0x0498('0x45')](_0x3a0e68,{'networks':_0x187d78||[]});fs[_0x0498('0x4c')](util[_0x0498('0x4f')](_0x0498('0x50'),_0x31eed1[_0x0498('0x3f')][_0x0498('0x25')]['toLowerCase']()),_0x788a5e);return respondWithRpcPromise('Reload',_0x0498('0x3e'),{'module':_0x0498('0x51')});}})[_0x0498('0xa')](function(){return _0x12d425;})['then'](respondWithResult(_0x5289bf,0xc9))[_0x0498('0x14')](handleError(_0x5289bf,null));};exports['update']=function(_0x45d32b,_0x55ee5f){var _0x3a0e9d;return db[_0x0498('0x23')][_0x0498('0x3d')]({'where':{'id':_0x45d32b['params']['id']}})[_0x0498('0xa')](handleEntityNotFound(_0x55ee5f,null))[_0x0498('0xa')](saveUpdates(_0x45d32b['body'],null))[_0x0498('0xa')](function(_0x5add79){if(_0x5add79){_0x3a0e9d=_0x5add79;return db[_0x0498('0x23')][_0x0498('0x38')]({'where':{'type':_0x3a0e9d[_0x0498('0x25')]},'raw':!![]});}return null;})[_0x0498('0xa')](function(_0x3396b6){if(_0x3a0e9d[_0x0498('0x25')][_0x0498('0x40')]()==_0x0498('0x52')){var _0x217ac8=fs[_0x0498('0x4a')](path['join'](config[_0x0498('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0xd04be2=ejs['render'](_0x217ac8,{'networks':_0x3396b6||[]});fs[_0x0498('0x4c')](_0x0498('0x46'),_0xd04be2);return respondWithRpcPromise(_0x0498('0x47'),'update',{'module':'res_stun_monitor.so'});}else if(_0x3a0e9d[_0x0498('0x25')]['toUpperCase']()==_0x0498('0x49')){var _0x3eefe0=fs['readFileSync'](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x0498('0x44'));var _0x1da10d=ejs['render'](_0x3eefe0,{'networks':_0x3396b6||[]});fs['writeFileSync'](_0x0498('0x4d'),_0x1da10d);return respondWithRpcPromise(_0x0498('0x47'),'update',{'module':_0x0498('0x48')});}else{var _0x4ea630=fs[_0x0498('0x4a')](path['join'](config[_0x0498('0x42')],_0x0498('0x4e')),_0x0498('0x44'));var _0x518a4e=ejs[_0x0498('0x45')](_0x4ea630,{'networks':_0x3396b6||[]});fs['writeFileSync'](util[_0x0498('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x45d32b['body'][_0x0498('0x25')][_0x0498('0x53')]()),_0x518a4e);return respondWithRpcPromise(_0x0498('0x47'),_0x0498('0x54'),{'module':_0x0498('0x51')});}})[_0x0498('0xa')](function(_0xd24707){if(_0xd24707){return _0x3a0e9d;}return null;})[_0x0498('0xa')](respondWithResult(_0x55ee5f,null))['catch'](handleError(_0x55ee5f,null));};exports['destroy']=function(_0x2e1a51,_0x3832b8){var _0x83b3db;return db['Network'][_0x0498('0x3d')]({'where':{'id':_0x2e1a51[_0x0498('0x55')]['id']}})[_0x0498('0xa')](function(_0x4251fe){_0x83b3db=_0x4251fe;return _0x4251fe;})['then'](handleEntityNotFound(_0x3832b8,null))[_0x0498('0xa')](removeEntity(_0x3832b8,null))['then'](function(){if(_0x83b3db){return db[_0x0498('0x23')][_0x0498('0x38')]({'where':{'type':_0x83b3db['type']},'raw':!![]});}})['then'](function(_0x3eaa91){if(_0x83b3db[_0x0498('0x25')][_0x0498('0x40')]()==_0x0498('0x52')){var _0x590b1f=fs[_0x0498('0x4a')](path[_0x0498('0x41')](config[_0x0498('0x42')],_0x0498('0x43')),_0x0498('0x44'));var _0x4d76ca=ejs['render'](_0x590b1f,{'networks':_0x3eaa91||[]});fs[_0x0498('0x4c')]('/etc/asterisk/stun_xcally.conf',_0x4d76ca);return respondWithRpcPromise(_0x0498('0x47'),_0x0498('0x56'),{'module':_0x0498('0x48')});}else if(_0x83b3db[_0x0498('0x25')][_0x0498('0x40')]()==_0x0498('0x49')){var _0x2bef97=fs[_0x0498('0x4a')](path[_0x0498('0x41')](config[_0x0498('0x42')],_0x0498('0x4b')),'utf8');var _0x4c062f=ejs[_0x0498('0x45')](_0x2bef97,{'networks':_0x3eaa91||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4c062f);return respondWithRpcPromise(_0x0498('0x47'),_0x0498('0x56'),{'module':_0x0498('0x48')});}else{var _0x47cfe3=fs[_0x0498('0x4a')](path[_0x0498('0x41')](config['root'],_0x0498('0x4e')),_0x0498('0x44'));var _0x54006b=ejs[_0x0498('0x45')](_0x47cfe3,{'networks':_0x3eaa91||[]});fs['writeFileSync'](util['format'](_0x0498('0x50'),_0x83b3db[_0x0498('0x25')]['toLowerCase']()),_0x54006b);return respondWithRpcPromise(_0x0498('0x47'),_0x0498('0x56'),{'module':'chan_sip.so'});}})[_0x0498('0x14')](handleError(_0x3832b8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0308238..1a3a201 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 _0x4746=['rimraf','../../config/environment','exports','define','Network','network','lodash','util','api','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4746,0xc6));var _0x6474=function(_0x2fede9,_0x4a5d1a){_0x2fede9=_0x2fede9-0x0;var _0x16fdac=_0x4746[_0x2fede9];return _0x16fdac;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./network.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb28a=['moment','rimraf','../../config/environment','./network.attributes','exports','define','Network','util','../../config/logger'];(function(_0x497d39,_0x2fef30){var _0x4a9d8f=function(_0x98eaa4){while(--_0x98eaa4){_0x497d39['push'](_0x497d39['shift']());}};_0x4a9d8f(++_0x2fef30);}(_0xb28a,0x166));var _0xab28=function(_0x50af94,_0x2af691){_0x50af94=_0x50af94-0x0;var _0x2c54a0=_0xb28a[_0x50af94];return _0x2c54a0;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var logger=require(_0xab28('0x1'))('api');var moment=require(_0xab28('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab28('0x3'));var config=require(_0xab28('0x4'));var attributes=require(_0xab28('0x5'));module[_0xab28('0x6')]=function(_0x133169,_0x128a13){return _0x133169[_0xab28('0x7')](_0xab28('0x8'),attributes,{'tableName':'network','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 e125958..0df411b 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14700d,_0x55a66d){var _0x4ddcd5=function(_0x398af9){while(--_0x398af9){_0x14700d['push'](_0x14700d['shift']());}};_0x4ddcd5(++_0x55a66d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x5b2541,_0x207b8d){var _0x463431=function(_0x30d867){while(--_0x30d867){_0x5b2541['push'](_0x5b2541['shift']());}};_0x463431(++_0x207b8d);}(_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 6cd307f..bbd700a 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 _0x4b17=['path','express','Router','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','exports','multer'];(function(_0xbe9886,_0x128ea5){var _0x82a852=function(_0x4d3325){while(--_0x4d3325){_0xbe9886['push'](_0xbe9886['shift']());}};_0x82a852(++_0x128ea5);}(_0x4b17,0x10f));var _0x74b1=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0x4b17[_0x22093a];return _0x2f4989;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74b1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74b1('0x5'));router[_0x74b1('0x6')]('/',auth[_0x74b1('0x7')](),controller[_0x74b1('0x8')]);router[_0x74b1('0x6')](_0x74b1('0x9'),auth[_0x74b1('0x7')](),controller['describe']);router[_0x74b1('0x6')](_0x74b1('0xa'),auth[_0x74b1('0x7')](),controller[_0x74b1('0xb')]);router[_0x74b1('0x6')]('/:id/dispositions',auth[_0x74b1('0x7')](),controller[_0x74b1('0xc')]);router['get'](_0x74b1('0xd'),auth[_0x74b1('0x7')](),controller[_0x74b1('0xe')]);router[_0x74b1('0x6')]('/:id/applications',auth[_0x74b1('0x7')](),controller['getApplications']);router['get'](_0x74b1('0xf'),auth[_0x74b1('0x7')](),controller['getInteractions']);router['get']('/:id/users',auth[_0x74b1('0x7')](),controller['getAgents']);router['post']('/',auth[_0x74b1('0x7')](),controller[_0x74b1('0x10')]);router[_0x74b1('0x11')](_0x74b1('0x12'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x13')]);router['post'](_0x74b1('0xd'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x14')]);router[_0x74b1('0x11')](_0x74b1('0x15'),controller[_0x74b1('0x16')]);router[_0x74b1('0x11')]('/:id/applications',auth[_0x74b1('0x7')](),controller[_0x74b1('0x17')]);router['post'](_0x74b1('0x18'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x19')]);router[_0x74b1('0x11')](_0x74b1('0x1a'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x1b')]);router[_0x74b1('0x1c')]('/:id',auth[_0x74b1('0x7')](),controller['update']);router['delete']('/:id',auth[_0x74b1('0x7')](),controller[_0x74b1('0x1d')]);router[_0x74b1('0x1e')](_0x74b1('0x12'),auth[_0x74b1('0x7')](),controller['removeDispositions']);router[_0x74b1('0x1e')]('/:id/canned_answers',auth[_0x74b1('0x7')](),controller[_0x74b1('0x1f')]);router[_0x74b1('0x1e')](_0x74b1('0x18'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x20')]);module[_0x74b1('0x21')]=router; \ No newline at end of file +var _0xadb5=['/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x3e169e,_0x2f983f){var _0x5587ff=function(_0x2100d1){while(--_0x2100d1){_0x3e169e['push'](_0x3e169e['shift']());}};_0x5587ff(++_0x2f983f);}(_0xadb5,0xad));var _0x5adb=function(_0xd55e8c,_0x3d37e2){_0xd55e8c=_0xd55e8c-0x0;var _0x320330=_0xadb5[_0xd55e8c];return _0x320330;};'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('./openchannelAccount.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getDispositions']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);router['get'](_0x5adb('0x15'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x16')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x17')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x18')]);router[_0x5adb('0x17')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x17')]('/:id/notify',controller[_0x5adb('0x1a')]);router['post'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x1b')]);router['post']('/:id/users',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x17')](_0x5adb('0x1d'),auth[_0x5adb('0x8')](),controller['send']);router[_0x5adb('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x1f')]);router[_0x5adb('0x20')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x21')]);router[_0x5adb('0x20')](_0x5adb('0xe'),auth['isAuthenticated'](),controller[_0x5adb('0x22')]);router[_0x5adb('0x20')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x23')]);router['delete'](_0x5adb('0x15'),auth[_0x5adb('0x8')](),controller['removeAgents']);module[_0x5adb('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f920f37..0190eb9 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 _0xbcac=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x5b4c5d,_0x10026d){var _0x194ef4=function(_0x10fbdd){while(--_0x10fbdd){_0x5b4c5d['push'](_0x5b4c5d['shift']());}};_0x194ef4(++_0x10026d);}(_0xbcac,0xff));var _0xcbca=function(_0x25b001,_0x1e4e19){_0x25b001=_0x25b001-0x0;var _0x1ba78c=_0xbcac[_0x25b001];return _0x1ba78c;};'use strict';var Sequelize=require(_0xcbca('0x0'));var rs=require('randomstring');module[_0xcbca('0x1')]={'name':{'type':Sequelize[_0xcbca('0x2')],'unique':_0xcbca('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcbca('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xcbca('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcbca('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcbca('0x4')],'defaultValue':function(){return _0xcbca('0x5');}},'notificationSound':{'type':Sequelize[_0xcbca('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcbca('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcbca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcbca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcbca('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcbca('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcbca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcbca('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcbca('0x8'),'set':function(_0x1dce81){if(!_0x1dce81)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x1dce81);}}}; \ No newline at end of file +var _0x5a1d=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','name','generate'];(function(_0x4236d8,_0x12a9ac){var _0x39a29b=function(_0x1575df){while(--_0x1575df){_0x4236d8['push'](_0x4236d8['shift']());}};_0x39a29b(++_0x12a9ac);}(_0x5a1d,0xe5));var _0xd5a1=function(_0x2832e2,_0x209a7a){_0x2832e2=_0x2832e2-0x0;var _0x5183f3=_0x5a1d[_0x2832e2];return _0x5183f3;};'use strict';var Sequelize=require(_0xd5a1('0x0'));var rs=require('randomstring');module[_0xd5a1('0x1')]={'name':{'type':Sequelize[_0xd5a1('0x2')],'unique':_0xd5a1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd5a1('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd5a1('0x4')]();}},'replyUri':{'type':Sequelize[_0xd5a1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd5a1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd5a1('0x5')],'defaultValue':function(){return _0xd5a1('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd5a1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd5a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd5a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd5a1('0x2')]},'queueTransfer':{'type':Sequelize[_0xd5a1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd5a1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd5a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd5a1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xd5a1('0x7')],'defaultValue':![],'comment':_0xd5a1('0xa'),'set':function(_0x2bdd33){if(!_0x2bdd33)this['setDataValue'](_0xd5a1('0xb'),null);this[_0xd5a1('0xc')]('mandatoryDisposition',_0x2bdd33);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4e16277..ef2d615 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 _0x3981=['type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','body','OpenchannelAccountId','findOne','Disposition','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','Tags','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','http','request','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName'];(function(_0x3757c8,_0x4ebaa2){var _0x250a9b=function(_0x513b9b){while(--_0x513b9b){_0x3757c8['push'](_0x3757c8['shift']());}};_0x250a9b(++_0x4ebaa2);}(_0x3981,0x144));var _0x1398=function(_0x3adf97,_0x1aa51d){_0x3adf97=_0x3adf97-0x0;var _0x5c51ea=_0x3981[_0x3adf97];return _0x5c51ea;};'use strict';var emlformat=require(_0x1398('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1398('0x1'));var jsonpatch=require(_0x1398('0x2'));var rp=require(_0x1398('0x3'));var moment=require(_0x1398('0x4'));var BPromise=require(_0x1398('0x5'));var Mustache=require(_0x1398('0x6'));var util=require(_0x1398('0x7'));var path=require(_0x1398('0x8'));var sox=require(_0x1398('0x9'));var csv=require(_0x1398('0xa'));var ejs=require(_0x1398('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1398('0xc'));var squel=require(_0x1398('0xd'));var crypto=require(_0x1398('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1398('0xf'));var toCsv=require(_0x1398('0xa'));var querystring=require(_0x1398('0x10'));var Papa=require(_0x1398('0x11'));var Redis=require(_0x1398('0x12'));var authService=require(_0x1398('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1398('0x14'));var hardwareService=require(_0x1398('0x15'));var logger=require(_0x1398('0x16'))(_0x1398('0x17'));var utils=require(_0x1398('0x18'));var config=require(_0x1398('0x19'));var licenseUtil=require(_0x1398('0x1a'));var db=require(_0x1398('0x1b'))['db'];config[_0x1398('0x1c')]=_[_0x1398('0x1d')](config['redis'],{'host':_0x1398('0x1e'),'port':0x18eb});var socket=require(_0x1398('0x1f'))(new Redis(config[_0x1398('0x1c')]));require(_0x1398('0x20'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1398('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x514216,_0x2afbd6,_0x4abc92,_0x289bd3){return new BPromise(function(_0x255a40,_0x24252f){var _0x382319=_0x289bd3||client;return _0x382319[_0x1398('0x22')](_0x514216,_0x4abc92)['then'](function(_0x33e24a){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2afbd6,_0x1398('0x23'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2afbd6,_0x1398('0x23'),JSON[_0x1398('0x24')](_0x33e24a));if(_0x33e24a['error']){if(_0x33e24a[_0x1398('0x25')][_0x1398('0x26')]===0x1f4){logger[_0x1398('0x25')](_0x1398('0x27'),_0x2afbd6,_0x33e24a[_0x1398('0x25')][_0x1398('0x28')]);return _0x24252f(_0x33e24a['error']['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2afbd6,_0x33e24a[_0x1398('0x25')][_0x1398('0x28')]);return _0x255a40(_0x33e24a[_0x1398('0x25')][_0x1398('0x28')]);}else{logger[_0x1398('0x29')](_0x1398('0x27'),_0x2afbd6,'request\x20sent');_0x255a40(_0x33e24a[_0x1398('0x2a')][_0x1398('0x28')]);}})['catch'](function(_0xb54964){logger[_0x1398('0x25')](_0x1398('0x27'),_0x2afbd6,_0xb54964);_0x24252f(_0xb54964);});});}function respondWithStatusCode(_0x2fe3c9,_0x50d3cf){_0x50d3cf=_0x50d3cf||0xcc;return function(_0x5edfdd){if(_0x5edfdd){return _0x2fe3c9[_0x1398('0x2b')](_0x50d3cf);}return _0x2fe3c9['status'](_0x50d3cf)[_0x1398('0x2c')]();};}function respondWithResult(_0x5144d3,_0x4f23d9){_0x4f23d9=_0x4f23d9||0xc8;return function(_0x543cd9){if(_0x543cd9){return _0x5144d3[_0x1398('0x2d')](_0x4f23d9)[_0x1398('0x2e')](_0x543cd9);}};}function respondWithFilteredResult(_0x76bd5,_0x2c8d2b){return function(_0x24965c){if(_0x24965c){var _0x2fd175=typeof _0x2c8d2b['offset']==='undefined'&&typeof _0x2c8d2b['limit']===_0x1398('0x2f');var _0x14cd86=_0x24965c[_0x1398('0x30')];var _0x585ebb=_0x2fd175?0x0:_0x2c8d2b[_0x1398('0x31')];var _0x983481=_0x2fd175?_0x24965c['count']:_0x2c8d2b['offset']+_0x2c8d2b['limit'];var _0x3e3f23;if(_0x983481>=_0x14cd86){_0x983481=_0x14cd86;_0x3e3f23=0xc8;}else{_0x3e3f23=0xce;}_0x76bd5['status'](_0x3e3f23);return _0x76bd5[_0x1398('0x32')](_0x1398('0x33'),_0x585ebb+'-'+_0x983481+'/'+_0x14cd86)[_0x1398('0x2e')](_0x24965c);}return null;};}function patchUpdates(_0x264b6a){return function(_0x169b12){try{jsonpatch['apply'](_0x169b12,_0x264b6a,!![]);}catch(_0xe5706e){return BPromise[_0x1398('0x34')](_0xe5706e);}return _0x169b12['save']();};}function saveUpdates(_0xe7ade4,_0x4be451){return function(_0x14f19d){if(_0x14f19d){return _0x14f19d[_0x1398('0x35')](_0xe7ade4)[_0x1398('0x36')](function(_0x461e40){return _0x461e40;});}return null;};}function removeEntity(_0xc954e8,_0x4ae9ae){return function(_0x5155e7){if(_0x5155e7){return _0x5155e7[_0x1398('0x37')]()[_0x1398('0x36')](function(){var _0x511276=_0x5155e7['get']({'plain':!![]});var _0x515472=_0x1398('0x38');return db['UserProfileResource'][_0x1398('0x37')]({'where':{'type':_0x515472,'resourceId':_0x511276['id']}})['then'](function(){return _0x5155e7;});})[_0x1398('0x36')](function(){_0xc954e8['status'](0xcc)[_0x1398('0x2c')]();});}};}function handleEntityNotFound(_0xe1fd72,_0x241bf0){return function(_0x3c5e5b){if(!_0x3c5e5b){_0xe1fd72[_0x1398('0x2b')](0x194);}return _0x3c5e5b;};}function handleError(_0x37d61e,_0x2f86cc){_0x2f86cc=_0x2f86cc||0x1f4;return function(_0x13c86d){logger[_0x1398('0x25')](_0x13c86d[_0x1398('0x39')]);if(_0x13c86d[_0x1398('0x3a')]){delete _0x13c86d[_0x1398('0x3a')];}_0x37d61e['status'](_0x2f86cc)[_0x1398('0x3b')](_0x13c86d);};}exports[_0x1398('0x3c')]=function(_0x43723a,_0x4eb937){var _0x2409c6={'include':[{'model':db[_0x1398('0x3d')],'as':_0x1398('0x3e')}]},_0x5a8a27={},_0x1267df={'count':0x0,'rows':[]};var _0x42459f=_['map'](db[_0x1398('0x3f')][_0x1398('0x40')],function(_0x36262f){return{'name':_0x36262f[_0x1398('0x41')],'type':_0x36262f[_0x1398('0x42')][_0x1398('0x43')]};});_0x5a8a27[_0x1398('0x44')]=_[_0x1398('0x45')](_0x42459f,'name');_0x5a8a27[_0x1398('0x46')]=_['keys'](_0x43723a[_0x1398('0x46')]);_0x5a8a27[_0x1398('0x47')]=_[_0x1398('0x48')](_0x5a8a27[_0x1398('0x44')],_0x5a8a27[_0x1398('0x46')]);_0x2409c6[_0x1398('0x49')]=_[_0x1398('0x48')](_0x5a8a27[_0x1398('0x44')],qs['fields'](_0x43723a[_0x1398('0x46')][_0x1398('0x4a')]));_0x2409c6['attributes']=_0x2409c6[_0x1398('0x49')][_0x1398('0x4b')]?_0x2409c6[_0x1398('0x49')]:_0x5a8a27[_0x1398('0x44')];if(!_0x43723a['query']['hasOwnProperty'](_0x1398('0x4c'))){_0x2409c6[_0x1398('0x4d')]=qs['limit'](_0x43723a[_0x1398('0x46')]['limit']);_0x2409c6['offset']=qs[_0x1398('0x31')](_0x43723a[_0x1398('0x46')][_0x1398('0x31')]);}_0x2409c6[_0x1398('0x4e')]=qs[_0x1398('0x4f')](_0x43723a[_0x1398('0x46')]['sort']);_0x2409c6[_0x1398('0x50')]=qs[_0x1398('0x47')](_[_0x1398('0x51')](_0x43723a[_0x1398('0x46')],_0x5a8a27['filters']),_0x42459f);if(_0x43723a[_0x1398('0x46')]['filter']){_0x2409c6[_0x1398('0x50')]=_[_0x1398('0x52')](_0x2409c6[_0x1398('0x50')],{'$or':_[_0x1398('0x45')](_0x42459f,function(_0x5adfe4){if(_0x5adfe4[_0x1398('0x42')]!==_0x1398('0x53')){var _0x41ad73={};_0x41ad73[_0x5adfe4['name']]={'$like':'%'+_0x43723a[_0x1398('0x46')][_0x1398('0x54')]+'%'};return _0x41ad73;}})});}_0x2409c6=_['merge']({},_0x2409c6,_0x43723a[_0x1398('0x55')]);var _0x22b57c={'where':_0x2409c6[_0x1398('0x50')]};return db[_0x1398('0x3f')][_0x1398('0x30')](_0x22b57c)['then'](function(_0x71de69){_0x1267df['count']=_0x71de69;if(_0x43723a[_0x1398('0x46')][_0x1398('0x56')]){_0x2409c6[_0x1398('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x2409c6);})['then'](function(_0x553ecc){_0x1267df[_0x1398('0x58')]=_0x553ecc;return _0x1267df;})['then'](respondWithFilteredResult(_0x4eb937,_0x2409c6))[_0x1398('0x59')](handleError(_0x4eb937,null));};exports[_0x1398('0x5a')]=function(_0x12b13d,_0xfac679){var _0x1c43db={'raw':![],'where':{'id':_0x12b13d[_0x1398('0x5b')]['id']},'include':[{'model':db[_0x1398('0x3d')],'as':_0x1398('0x3e')}]},_0x44f91f={};_0x44f91f['model']=_[_0x1398('0x5c')](db[_0x1398('0x3f')]['rawAttributes']);_0x44f91f[_0x1398('0x46')]=_['keys'](_0x12b13d[_0x1398('0x46')]);_0x44f91f[_0x1398('0x47')]=_['intersection'](_0x44f91f[_0x1398('0x44')],_0x44f91f[_0x1398('0x46')]);_0x1c43db['attributes']=_[_0x1398('0x48')](_0x44f91f[_0x1398('0x44')],qs[_0x1398('0x4a')](_0x12b13d[_0x1398('0x46')]['fields']));_0x1c43db[_0x1398('0x49')]=_0x1c43db[_0x1398('0x49')]['length']?_0x1c43db['attributes']:_0x44f91f[_0x1398('0x44')];if(_0x12b13d[_0x1398('0x46')][_0x1398('0x56')]){_0x1c43db[_0x1398('0x57')]=[{'all':!![]}];}_0x1c43db=_[_0x1398('0x52')]({},_0x1c43db,_0x12b13d[_0x1398('0x55')]);return db[_0x1398('0x3f')][_0x1398('0x5d')](_0x1c43db)[_0x1398('0x36')](handleEntityNotFound(_0xfac679,null))[_0x1398('0x36')](respondWithResult(_0xfac679,null))[_0x1398('0x59')](handleError(_0xfac679,null));};exports['create']=function(_0x162737,_0x45d7ac){return db[_0x1398('0x3f')][_0x1398('0x5e')](_0x162737['body'],{})['then'](function(_0x2497e4){var _0x505bd6=_0x162737[_0x1398('0x5f')][_0x1398('0x60')]({'plain':!![]});if(!_0x505bd6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x505bd6[_0x1398('0x61')]==='user'){var _0x115fdb=_0x2497e4[_0x1398('0x60')]({'plain':!![]});var _0x34f39e='OpenchannelAccounts';return db[_0x1398('0x62')][_0x1398('0x5d')]({'where':{'name':_0x34f39e,'userProfileId':_0x505bd6[_0x1398('0x63')]},'raw':!![]})[_0x1398('0x36')](function(_0x3e9488){if(_0x3e9488&&_0x3e9488[_0x1398('0x64')]===0x0){return db[_0x1398('0x65')][_0x1398('0x5e')]({'name':_0x115fdb['name'],'resourceId':_0x115fdb['id'],'type':_0x3e9488[_0x1398('0x3a')],'sectionId':_0x3e9488['id']},{})[_0x1398('0x36')](function(){return _0x2497e4;});}else{return _0x2497e4;}})['catch'](function(_0xe813dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe813dd);throw _0xe813dd;});}return _0x2497e4;})['then'](respondWithResult(_0x45d7ac,0xc9))[_0x1398('0x59')](handleError(_0x45d7ac,null));};exports['update']=function(_0x22b3d4,_0x35aea5){if(_0x22b3d4['body']['id']){delete _0x22b3d4['body']['id'];}return db['OpenchannelAccount'][_0x1398('0x5d')]({'where':{'id':_0x22b3d4[_0x1398('0x5b')]['id']},'include':[{'model':db[_0x1398('0x3d')],'as':_0x1398('0x3e')}]})[_0x1398('0x36')](handleEntityNotFound(_0x35aea5,null))['then'](saveUpdates(_0x22b3d4['body'],null))[_0x1398('0x36')](respondWithResult(_0x35aea5,null))[_0x1398('0x59')](handleError(_0x35aea5,null));};exports[_0x1398('0x37')]=function(_0x1f441f,_0x2ac250){return db['OpenchannelAccount']['find']({'where':{'id':_0x1f441f[_0x1398('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ac250,null))[_0x1398('0x36')](removeEntity(_0x2ac250,null))['catch'](handleError(_0x2ac250,null));};exports[_0x1398('0x66')]=function(_0x2f4df5,_0x27ab0a){return db['OpenchannelAccount']['describe']()[_0x1398('0x36')](respondWithResult(_0x27ab0a,null))[_0x1398('0x59')](handleError(_0x27ab0a,null));};exports[_0x1398('0x67')]=function(_0x5d3417,_0x26ef3f,_0x4b91e1){if(_0x5d3417[_0x1398('0x68')]['id']){delete _0x5d3417['body']['id'];}return db[_0x1398('0x3f')]['find']({'where':{'id':_0x5d3417[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x26ef3f,null))[_0x1398('0x36')](function(_0x1f3bbf){if(_0x1f3bbf){_0x5d3417[_0x1398('0x68')][_0x1398('0x69')]=_0x1f3bbf['id'];return db['Disposition']['create'](_0x5d3417[_0x1398('0x68')]);}})[_0x1398('0x36')](respondWithResult(_0x26ef3f,null))[_0x1398('0x59')](handleError(_0x26ef3f,null));};exports['getDispositions']=function(_0x2d2c30,_0x149659,_0x1d7642){var _0xaaa838={'raw':![],'where':{}};var _0x46167c={};var _0x2a2d92={'count':0x0,'rows':[]};return db[_0x1398('0x3f')][_0x1398('0x6a')]({'where':{'id':_0x2d2c30[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x149659,null))[_0x1398('0x36')](function(_0x5b9e6d){if(_0x5b9e6d){_0x46167c[_0x1398('0x44')]=_['keys'](db[_0x1398('0x6b')][_0x1398('0x40')]);_0x46167c['query']=_[_0x1398('0x5c')](_0x2d2c30[_0x1398('0x46')]);_0x46167c['filters']=_[_0x1398('0x48')](_0x46167c[_0x1398('0x44')],_0x46167c[_0x1398('0x46')]);_0xaaa838[_0x1398('0x49')]=_['intersection'](_0x46167c[_0x1398('0x44')],qs['fields'](_0x2d2c30[_0x1398('0x46')][_0x1398('0x4a')]));_0xaaa838[_0x1398('0x49')]=_0xaaa838[_0x1398('0x49')][_0x1398('0x4b')]?_0xaaa838[_0x1398('0x49')]:_0x46167c[_0x1398('0x44')];if(!_0x2d2c30['query'][_0x1398('0x6c')]('nolimit')){_0xaaa838[_0x1398('0x4d')]=qs[_0x1398('0x4d')](_0x2d2c30[_0x1398('0x46')][_0x1398('0x4d')]);_0xaaa838[_0x1398('0x31')]=qs['offset'](_0x2d2c30[_0x1398('0x46')][_0x1398('0x31')]);}_0xaaa838[_0x1398('0x4e')]=qs[_0x1398('0x4f')](_0x2d2c30[_0x1398('0x46')][_0x1398('0x4f')]);_0xaaa838[_0x1398('0x50')]=qs[_0x1398('0x47')](_[_0x1398('0x51')](_0x2d2c30[_0x1398('0x46')],_0x46167c[_0x1398('0x47')]));_0xaaa838[_0x1398('0x50')][_0x1398('0x69')]=_0x5b9e6d['id'];if(_0x2d2c30['query']['filter']){_0xaaa838[_0x1398('0x50')]=_['merge'](_0xaaa838['where'],{'$or':_[_0x1398('0x45')](_0xaaa838['attributes'],function(_0x3f4c24){var _0x20bef8={};_0x20bef8[_0x3f4c24]={'$like':'%'+_0x2d2c30['query']['filter']+'%'};return _0x20bef8;})});}_0xaaa838=_[_0x1398('0x52')]({},_0xaaa838,_0x2d2c30[_0x1398('0x55')]);return db[_0x1398('0x6b')][_0x1398('0x30')]({'where':_0xaaa838[_0x1398('0x50')]})[_0x1398('0x36')](function(_0x3bc527){_0x2a2d92[_0x1398('0x30')]=_0x3bc527;if(_0x2d2c30[_0x1398('0x46')][_0x1398('0x56')]){_0xaaa838['include']=[{'all':!![]}];}return db[_0x1398('0x6b')][_0x1398('0x6d')](_0xaaa838);})['then'](function(_0x2a2175){_0x2a2d92[_0x1398('0x58')]=_0x2a2175;return _0x2a2d92;});}})[_0x1398('0x36')](respondWithFilteredResult(_0x149659,_0xaaa838))[_0x1398('0x59')](handleError(_0x149659,null));};exports[_0x1398('0x6e')]=function(_0x3df097,_0x5b46f3,_0x44d208){return db['OpenchannelAccount'][_0x1398('0x5d')]({'where':{'id':_0x3df097[_0x1398('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b46f3,null))['then'](function(_0x487b00){if(_0x487b00){return _0x487b00[_0x1398('0x6e')](_0x3df097[_0x1398('0x46')][_0x1398('0x6f')]);}})[_0x1398('0x36')](respondWithStatusCode(_0x5b46f3,null))[_0x1398('0x59')](handleError(_0x5b46f3,null));};exports[_0x1398('0x70')]=function(_0x1944e7,_0x2662f6,_0x5a9e02){if(_0x1944e7[_0x1398('0x68')]['id']){delete _0x1944e7[_0x1398('0x68')]['id'];}return db[_0x1398('0x3f')][_0x1398('0x5d')]({'where':{'id':_0x1944e7[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x2662f6,null))[_0x1398('0x36')](function(_0x4a1941){if(_0x4a1941){_0x1944e7[_0x1398('0x68')][_0x1398('0x69')]=_0x4a1941['id'];return db['CannedAnswer'][_0x1398('0x5e')](_0x1944e7[_0x1398('0x68')]);}})[_0x1398('0x36')](respondWithResult(_0x2662f6,null))[_0x1398('0x59')](handleError(_0x2662f6,null));};exports[_0x1398('0x71')]=function(_0x125972,_0x14392b,_0x3ed892){var _0x2d4717={'raw':![],'where':{}};var _0x3d3bb5={};var _0x3bfc40={'count':0x0,'rows':[]};return db[_0x1398('0x3f')][_0x1398('0x6a')]({'where':{'id':_0x125972[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x14392b,null))[_0x1398('0x36')](function(_0x5556dd){if(_0x5556dd){_0x3d3bb5[_0x1398('0x44')]=_[_0x1398('0x5c')](db['CannedAnswer'][_0x1398('0x40')]);_0x3d3bb5[_0x1398('0x46')]=_[_0x1398('0x5c')](_0x125972[_0x1398('0x46')]);_0x3d3bb5[_0x1398('0x47')]=_['intersection'](_0x3d3bb5[_0x1398('0x44')],_0x3d3bb5[_0x1398('0x46')]);_0x2d4717[_0x1398('0x49')]=_['intersection'](_0x3d3bb5[_0x1398('0x44')],qs[_0x1398('0x4a')](_0x125972['query'][_0x1398('0x4a')]));_0x2d4717[_0x1398('0x49')]=_0x2d4717['attributes']['length']?_0x2d4717[_0x1398('0x49')]:_0x3d3bb5[_0x1398('0x44')];if(!_0x125972['query'][_0x1398('0x6c')](_0x1398('0x4c'))){_0x2d4717[_0x1398('0x4d')]=qs[_0x1398('0x4d')](_0x125972[_0x1398('0x46')][_0x1398('0x4d')]);_0x2d4717[_0x1398('0x31')]=qs[_0x1398('0x31')](_0x125972['query'][_0x1398('0x31')]);}_0x2d4717['order']=qs['sort'](_0x125972[_0x1398('0x46')][_0x1398('0x4f')]);_0x2d4717[_0x1398('0x50')]=qs[_0x1398('0x47')](_[_0x1398('0x51')](_0x125972[_0x1398('0x46')],_0x3d3bb5['filters']));_0x2d4717[_0x1398('0x50')]['OpenchannelAccountId']=_0x5556dd['id'];if(_0x125972['query'][_0x1398('0x54')]){_0x2d4717[_0x1398('0x50')]=_[_0x1398('0x52')](_0x2d4717['where'],{'$or':_[_0x1398('0x45')](_0x2d4717[_0x1398('0x49')],function(_0x949cdd){var _0x5a1c1f={};_0x5a1c1f[_0x949cdd]={'$like':'%'+_0x125972[_0x1398('0x46')]['filter']+'%'};return _0x5a1c1f;})});}_0x2d4717=_[_0x1398('0x52')]({},_0x2d4717,_0x125972[_0x1398('0x55')]);return db[_0x1398('0x72')][_0x1398('0x30')]({'where':_0x2d4717[_0x1398('0x50')]})[_0x1398('0x36')](function(_0x518aaa){_0x3bfc40[_0x1398('0x30')]=_0x518aaa;if(_0x125972[_0x1398('0x46')][_0x1398('0x56')]){_0x2d4717[_0x1398('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2d4717);})['then'](function(_0x16ea18){_0x3bfc40['rows']=_0x16ea18;return _0x3bfc40;});}})[_0x1398('0x36')](respondWithFilteredResult(_0x14392b,_0x2d4717))[_0x1398('0x59')](handleError(_0x14392b,null));};exports[_0x1398('0x73')]=function(_0x4b293e,_0x5ead8d,_0x309338){return db[_0x1398('0x3f')][_0x1398('0x5d')]({'where':{'id':_0x4b293e['params']['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x5ead8d,null))[_0x1398('0x36')](function(_0x7cdb39){if(_0x7cdb39){return _0x7cdb39[_0x1398('0x73')](_0x4b293e['query'][_0x1398('0x6f')]);}})['then'](respondWithStatusCode(_0x5ead8d,null))[_0x1398('0x59')](handleError(_0x5ead8d,null));};exports['notify']=function(_0x278911,_0x4fbdd0,_0x1fe84e){var _0x433b46={'body':_0x278911['body'],'channel':_0x1398('0x74')};var _0x3b9cb4=[];var _0x2176ec=[];var _0x57c992={};var _0xc6d3d8=![];return db[_0x1398('0x75')]['describe']()[_0x1398('0x36')](function(_0x3e199d){if(!_0x3e199d){throw new db['Sequelize'][(_0x1398('0x76'))]('no\x20available\x20attributes');}_0x3b9cb4=_[_0x1398('0x77')](_[_0x1398('0x5c')](_0x3e199d),[_0x1398('0x78'),_0x1398('0x79')]);_0x2176ec=_[_0x1398('0x77')](_[_0x1398('0x5c')](_0x3e199d),[_0x1398('0x78'),'updatedAt',_0x1398('0x7a'),_0x1398('0x7b')]);if(_0x278911['body']['id']){delete _0x278911[_0x1398('0x68')]['id'];}if(_[_0x1398('0x7c')](_0x278911[_0x1398('0x68')][_0x1398('0x7d')])){throw new db[(_0x1398('0x7e'))]['ValidationError'](_0x1398('0x7f'));}if(_[_0x1398('0x7c')](_0x278911[_0x1398('0x68')][_0x1398('0x68')])||_0x278911['body'][_0x1398('0x68')]===''){throw new db[(_0x1398('0x7e'))][(_0x1398('0x76'))](_0x1398('0x80'));}if(_[_0x1398('0x7c')](_0x278911[_0x1398('0x68')][_0x1398('0x81')])){throw new db[(_0x1398('0x7e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2176ec);}if(!_['includes'](_0x2176ec,_0x278911['body'][_0x1398('0x81')])){throw new db[(_0x1398('0x7e'))][(_0x1398('0x76'))](_0x1398('0x82')+_0x2176ec);}_0x57c992[_0x278911[_0x1398('0x68')]['mapKey']]=_0x278911['body']['from'];})[_0x1398('0x36')](function(){return db[_0x1398('0x3f')][_0x1398('0x5d')]({'where':{'id':_0x278911['params']['id']},'include':[{'model':db['CmList'],'as':_0x1398('0x83'),'include':[{'model':db[_0x1398('0x75')],'as':_0x1398('0x84'),'where':_0x57c992,'limit':0x1,'order':[[_0x1398('0x79'),_0x1398('0x85')]]}]},{'model':db[_0x1398('0x86')],'as':'Applications'}]});})[_0x1398('0x36')](handleEntityNotFound(_0x4fbdd0,null))['then'](function(_0x2ae3a7){if(_0x2ae3a7&&_0x2ae3a7[_0x1398('0x83')]){_0x433b46[_0x1398('0x87')]=_0x2ae3a7;_0x433b46[_0x1398('0x88')]=_0x2ae3a7[_0x1398('0x89')];_0x433b46[_0x1398('0x8a')]=_0x2ae3a7[_0x1398('0x83')];_0x433b46[_0x1398('0x88')]=_[_0x1398('0x8b')](_0x433b46[_0x1398('0x88')],[_0x1398('0x8c')],[_0x1398('0x8d')]);if(_0x433b46[_0x1398('0x87')][_0x1398('0x89')]){delete _0x433b46[_0x1398('0x87')]['Applications'];}if(_0x433b46[_0x1398('0x87')][_0x1398('0x83')]&&_0x433b46['account'][_0x1398('0x83')][_0x1398('0x84')][_0x1398('0x4b')]){return _0x433b46['account'][_0x1398('0x83')][_0x1398('0x84')][0x0];}var _0x249617=_['defaults'](_0x278911[_0x1398('0x68')],{'firstName':_0x278911['body'][_0x1398('0x7d')],'ListId':_0x2ae3a7[_0x1398('0x7b')]});_0x249617[_0x278911['body'][_0x1398('0x81')]]=_0x278911[_0x1398('0x68')][_0x1398('0x7d')];return db[_0x1398('0x75')][_0x1398('0x5e')](_0x249617,{'fields':_0x3b9cb4,'raw':!![]});}})[_0x1398('0x36')](handleEntityNotFound(_0x4fbdd0,null))[_0x1398('0x36')](function(_0x779d90){_0x433b46[_0x1398('0x8e')]=_0x779d90;if(_0x779d90){var _0x32659a={'ContactId':_0x779d90['id'],'OpenchannelAccountId':_0x278911[_0x1398('0x5b')]['id'],'from':(_0x779d90[_0x1398('0x8f')]||'')+'\x20'+(_0x779d90[_0x1398('0x90')]||'')};var _0x521a02={'OpenchannelAccountId':_0x278911[_0x1398('0x5b')]['id'],'closed':![]};if(_0x278911[_0x1398('0x68')][_0x1398('0x91')]){_0x521a02[_0x1398('0x91')]=_0x278911[_0x1398('0x68')][_0x1398('0x91')];return db[_0x1398('0x92')][_0x1398('0x5d')]({'where':_0x521a02})[_0x1398('0x36')](function(_0x5b84ab){if(_0x5b84ab){return[_0x5b84ab,![]];}_0x32659a[_0x1398('0x91')]=_0x278911['body']['threadId'];_0x32659a[_0x1398('0x93')]=_0x278911['body']['externalUrl'];return db[_0x1398('0x92')][_0x1398('0x5e')](_0x32659a)[_0x1398('0x36')](function(_0x4569e2){return[_0x4569e2,!![]];});});}else{_0x521a02['threadId']=null;}_0x521a02[_0x1398('0x94')]=_0x779d90['id'];return db['OpenchannelInteraction'][_0x1398('0x5d')]({'where':_0x521a02})[_0x1398('0x36')](function(_0x5af267){if(_0x5af267){return[_0x5af267,![]];}return db[_0x1398('0x92')][_0x1398('0x5e')](_0x32659a)[_0x1398('0x36')](function(_0x38fa43){return[_0x38fa43,!![]];});});}})[_0x1398('0x95')](function(_0x3dd3bf,_0x13c01c){if(_0x3dd3bf){_0xc6d3d8=_0x13c01c;if(!_0x13c01c){var _0x2f9089={'from':(_0x433b46['contact']['firstName']||'')+'\x20'+(_0x433b46[_0x1398('0x8e')][_0x1398('0x90')]||'')};if(_0x278911[_0x1398('0x68')][_0x1398('0x91')]&&_0x278911[_0x1398('0x68')][_0x1398('0x96')]&&_0x278911['body'][_0x1398('0x91')]!=_0x278911[_0x1398('0x68')][_0x1398('0x96')]){_0x2f9089['threadId']=_0x278911[_0x1398('0x68')][_0x1398('0x96')];}return _0x3dd3bf[_0x1398('0x35')](_0x2f9089);}else{return _0x3dd3bf;}}})['then'](function(_0x43b042){_0x433b46[_0x1398('0x97')]=_0x43b042['get']({'plain':!![]});_0x433b46[_0x1398('0x97')][_0x1398('0x98')]=_0xc6d3d8;if(_0x433b46[_0x1398('0x97')][_0x1398('0x98')]){if(_0x433b46[_0x1398('0x87')][_0x1398('0x99')]){_0x433b46[_0x1398('0x88')][_0x1398('0x9a')]({'id':0x0,'priority':_0x433b46[_0x1398('0x88')][_0x1398('0x4b')]+0x1,'app':'close','appdata':_0x1398('0x9b'),'interval':'*,*,*,*'});}}return db[_0x1398('0x9c')][_0x1398('0x5e')]({'body':_0x278911[_0x1398('0x68')][_0x1398('0x68')],'OpenchannelAccountId':_0x278911[_0x1398('0x5b')]['id'],'OpenchannelInteractionId':_0x43b042['id'],'direction':'in','ContactId':_0x433b46[_0x1398('0x8e')]['id'],'AttachmentId':_0x278911[_0x1398('0x68')][_0x1398('0x9d')]});})[_0x1398('0x36')](function(_0x4d2042){_0x433b46[_0x1398('0x28')]=_0x4d2042;if(!_0x433b46[_0x1398('0x97')][_0x1398('0x9e')])return;return db[_0x1398('0x9f')]['find']({'attributes':['id',_0x1398('0x3a')],'where':{'id':_0x433b46['interaction'][_0x1398('0x9e')]}});})[_0x1398('0x36')](function(_0x427978){if(_0x427978){_0x433b46[_0x1398('0x88')][_0x1398('0xa0')]({'id':0x0,'priority':0x0,'app':_0x1398('0xa1'),'appdata':_0x427978['name']+','+(_0x433b46[_0x1398('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x1398('0xa2')});}if(!_0x433b46[_0x1398('0x97')][_0x1398('0xa3')])return;return db[_0x1398('0xa4')]['find']({'attributes':['id',_0x1398('0x3a')],'where':{'id':_0x433b46[_0x1398('0x97')][_0x1398('0xa3')]}});})[_0x1398('0x36')](function(_0x153882){if(_0x153882){_0x433b46[_0x1398('0x88')][_0x1398('0xa0')]({'id':0x0,'priority':0x1,'app':_0x1398('0xa5'),'appdata':_0x153882[_0x1398('0x3a')]+','+(_0x433b46[_0x1398('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1398('0xa2')});}return respondWithRpcPromise(_0x1398('0xa6'),_0x1398('0xa7'),_0x433b46);})['then'](function(_0x49c7cf){respondWithRpcPromise(_0x1398('0xa8'),_0x1398('0xa8'),{'event':_0x1398('0xa9'),'message':_0x49c7cf},client9002);return _0x49c7cf;})[_0x1398('0x36')](respondWithResult(_0x4fbdd0,null))[_0x1398('0x59')](handleError(_0x4fbdd0,null));};exports[_0x1398('0xaa')]=function(_0x28125e,_0x346014){var _0x3ca01c=_0x28125e[_0x1398('0x5b')]['id'];var _0x488004=_0x28125e[_0x1398('0x68')];var _0x4f0654=0xc8;var _0x2e6e82=null;return db[_0x1398('0xab')][_0x1398('0xac')]({'isolationLevel':db[_0x1398('0xab')][_0x1398('0xad')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x47c421){return db[_0x1398('0x3f')][_0x1398('0x6a')]({'where':{'id':_0x3ca01c},'transaction':_0x47c421})[_0x1398('0x36')](function(_0xa4493){if(_0xa4493){return db['OpenchannelApplication'][_0x1398('0x37')]({'where':{'OpenchannelAccountId':_0x3ca01c},'transaction':_0x47c421})['then'](function(){var _0x1ae60a=_[_0x1398('0x45')](_0x488004,function(_0xe5aad5){_0xe5aad5['OpenchannelAccountId']=_0x3ca01c;return _0xe5aad5;});return db[_0x1398('0x86')][_0x1398('0xae')](_0x1ae60a,{'transaction':_0x47c421});});}else{_0x4f0654=0x194;_0x2e6e82=[];}});})[_0x1398('0x36')](function(){if(_0x4f0654!==0x194){return db[_0x1398('0x86')][_0x1398('0xaf')]({'where':{'OpenchannelAccountId':_0x3ca01c},'order':_0x1398('0x8c')})[_0x1398('0x36')](function(_0x4b4659){_0x2e6e82=_0x4b4659;});}})[_0x1398('0x59')](function(_0x2c5933){_0x4f0654=0x1f4;logger[_0x1398('0x25')](_0x2c5933[_0x1398('0x39')]);if(_0x2c5933[_0x1398('0x3a')]){delete _0x2c5933[_0x1398('0x3a')];}_0x2e6e82=_0x2c5933;})[_0x1398('0xb0')](function(){if(_0x2e6e82===null){_0x346014[_0x1398('0x2b')](_0x4f0654);}else{if(_0x4f0654===0x1f4){_0x346014[_0x1398('0x2d')](_0x4f0654)[_0x1398('0x3b')](_0x2e6e82);}else{_0x346014['status'](_0x4f0654)[_0x1398('0x2e')](_0x2e6e82);}}});};exports[_0x1398('0xb1')]=function(_0x4c66c7,_0x29b9cd,_0x599531){var _0x595010={};var _0x45466c={};var _0x1aa1f1;var _0x1eac0e;return db[_0x1398('0x3f')][_0x1398('0x6a')]({'where':{'id':_0x4c66c7[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x29b9cd,null))['then'](function(_0x31a8b1){if(_0x31a8b1){_0x1aa1f1=_0x31a8b1;_0x45466c[_0x1398('0x44')]=_['keys'](db[_0x1398('0x86')]['rawAttributes']);_0x45466c[_0x1398('0x46')]=_[_0x1398('0x5c')](_0x4c66c7['query']);_0x45466c[_0x1398('0x47')]=_['intersection'](_0x45466c[_0x1398('0x44')],_0x45466c[_0x1398('0x46')]);_0x595010[_0x1398('0x49')]=_[_0x1398('0x48')](_0x45466c[_0x1398('0x44')],qs[_0x1398('0x4a')](_0x4c66c7[_0x1398('0x46')][_0x1398('0x4a')]));_0x595010['attributes']=_0x595010[_0x1398('0x49')][_0x1398('0x4b')]?_0x595010[_0x1398('0x49')]:_0x45466c[_0x1398('0x44')];_0x595010[_0x1398('0x4e')]=qs['sort'](_0x4c66c7[_0x1398('0x46')][_0x1398('0x4f')]);_0x595010[_0x1398('0x50')]=qs[_0x1398('0x47')](_[_0x1398('0x51')](_0x4c66c7[_0x1398('0x46')],_0x45466c['filters']));if(_0x4c66c7[_0x1398('0x46')][_0x1398('0x54')]){_0x595010[_0x1398('0x50')]=_[_0x1398('0x52')](_0x595010[_0x1398('0x50')],{'$or':_['map'](_0x595010[_0x1398('0x49')],function(_0x2646e8){var _0x4cf069={};_0x4cf069[_0x2646e8]={'$like':'%'+_0x4c66c7[_0x1398('0x46')][_0x1398('0x54')]+'%'};return _0x4cf069;})});}_0x595010=_[_0x1398('0x52')]({},_0x595010,_0x4c66c7['options']);return _0x1aa1f1['getApplications'](_0x595010);}})[_0x1398('0x36')](function(_0x2a45b5){if(_0x2a45b5){_0x1eac0e=_0x2a45b5[_0x1398('0x4b')];if(!_0x4c66c7[_0x1398('0x46')][_0x1398('0x6c')](_0x1398('0x4c'))){_0x595010[_0x1398('0x4d')]=qs[_0x1398('0x4d')](_0x4c66c7[_0x1398('0x46')][_0x1398('0x4d')]);_0x595010['offset']=qs[_0x1398('0x31')](_0x4c66c7[_0x1398('0x46')][_0x1398('0x31')]);}return _0x1aa1f1[_0x1398('0xb1')](_0x595010);}})[_0x1398('0x36')](function(_0x2608e3){if(_0x2608e3){return _0x2608e3?{'count':_0x1eac0e,'rows':_0x2608e3}:null;}})[_0x1398('0x36')](respondWithResult(_0x29b9cd,null))[_0x1398('0x59')](handleError(_0x29b9cd,null));};exports['getInteractions']=function(_0x5170e3,_0x465dc4,_0x3dce9e){var _0x3b8e03={'raw':![],'where':{}};var _0x48a717={};var _0x37f6e4={'count':0x0,'rows':[]};return db[_0x1398('0x3f')]['findOne']({'where':{'id':_0x5170e3[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x465dc4,null))[_0x1398('0x36')](function(_0x2ce4d1){if(_0x2ce4d1){_0x48a717[_0x1398('0x44')]=_[_0x1398('0x5c')](db[_0x1398('0x92')][_0x1398('0x40')]);_0x48a717[_0x1398('0x46')]=_['keys'](_0x5170e3[_0x1398('0x46')]);_0x48a717[_0x1398('0x47')]=_[_0x1398('0x48')](_0x48a717[_0x1398('0x44')],_0x48a717['query']);_0x3b8e03['attributes']=_[_0x1398('0x48')](_0x48a717['model'],qs['fields'](_0x5170e3[_0x1398('0x46')]['fields']));_0x3b8e03[_0x1398('0x49')]=_0x3b8e03[_0x1398('0x49')][_0x1398('0x4b')]?_0x3b8e03[_0x1398('0x49')]:_0x48a717[_0x1398('0x44')];if(!_0x5170e3[_0x1398('0x46')]['hasOwnProperty']('nolimit')){_0x3b8e03['limit']=qs[_0x1398('0x4d')](_0x5170e3[_0x1398('0x46')][_0x1398('0x4d')]);_0x3b8e03[_0x1398('0x31')]=qs[_0x1398('0x31')](_0x5170e3[_0x1398('0x46')][_0x1398('0x31')]);}_0x3b8e03[_0x1398('0x4e')]=qs[_0x1398('0x4f')](_0x5170e3['query'][_0x1398('0x4f')]);_0x3b8e03[_0x1398('0x50')]=qs[_0x1398('0x47')](_['pick'](_0x5170e3['query'],_0x48a717[_0x1398('0x47')]));_0x3b8e03[_0x1398('0x50')][_0x1398('0x69')]=_0x2ce4d1['id'];if(_0x5170e3[_0x1398('0x46')]['filter']){_0x3b8e03[_0x1398('0x50')]=_[_0x1398('0x52')](_0x3b8e03[_0x1398('0x50')],{'$or':_[_0x1398('0x45')](_0x3b8e03[_0x1398('0x49')],function(_0x53b136){var _0x35a964={};_0x35a964[_0x53b136]={'$like':'%'+_0x5170e3['query'][_0x1398('0x54')]+'%'};return _0x35a964;})});}_0x3b8e03=_[_0x1398('0x52')]({},_0x3b8e03,_0x5170e3[_0x1398('0x55')]);return db[_0x1398('0x92')][_0x1398('0x30')]({'where':_0x3b8e03[_0x1398('0x50')]})[_0x1398('0x36')](function(_0x412e45){_0x37f6e4[_0x1398('0x30')]=_0x412e45;if(_0x5170e3[_0x1398('0x46')][_0x1398('0x56')]){_0x3b8e03[_0x1398('0x57')]=[{'model':db[_0x1398('0x75')],'as':_0x1398('0xb2'),'required':![]},{'model':db[_0x1398('0x9f')],'as':_0x1398('0xb3'),'attributes':['name','fullname',_0x1398('0xb4')],'required':![]},{'model':db[_0x1398('0xb5')],'as':_0x1398('0xb6'),'attributes':['id',_0x1398('0x3a'),'color'],'where':_0x5170e3[_0x1398('0x46')][_0x1398('0xb7')]?{'id':_0x5170e3[_0x1398('0x46')][_0x1398('0xb7')]}:undefined,'required':_0x5170e3[_0x1398('0x46')][_0x1398('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x1398('0x6d')](_0x3b8e03);})[_0x1398('0x36')](function(_0x25f093){_0x37f6e4[_0x1398('0x58')]=_0x25f093;return _0x37f6e4;});}})[_0x1398('0x36')](respondWithFilteredResult(_0x465dc4,_0x3b8e03))['catch'](handleError(_0x465dc4,null));};exports[_0x1398('0xb8')]=function(_0x582df9,_0x7040b2,_0x437e58){return db['OpenchannelAccount'][_0x1398('0x5d')]({'where':{'id':_0x582df9['params']['id']}})['then'](handleEntityNotFound(_0x7040b2,null))[_0x1398('0x36')](function(_0x187b65){if(_0x187b65){return _0x187b65[_0x1398('0xb8')](_0x582df9[_0x1398('0x68')][_0x1398('0x6f')],_[_0x1398('0xb9')](_0x582df9[_0x1398('0x68')],[_0x1398('0x6f'),'id'])||{})[_0x1398('0x95')](function(_0x585795){for(var _0xf88289=0x0;_0xf88289<_0x582df9[_0x1398('0x68')][_0x1398('0x6f')][_0x1398('0x4b')];_0xf88289+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x582df9[_0x1398('0x68')][_0x1398('0x6f')][_0xf88289]),'OpenchannelAccountId':Number(_0x582df9[_0x1398('0x5b')]['id'])});}return _0x585795;});}})[_0x1398('0x36')](respondWithResult(_0x7040b2,null))['catch'](handleError(_0x7040b2,null));};exports['removeAgents']=function(_0x328b12,_0x25836a,_0x25ecba){return db[_0x1398('0x3f')][_0x1398('0x5d')]({'where':{'id':_0x328b12[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x25836a,null))['then'](function(_0x31811b){if(_0x31811b){return _0x31811b[_0x1398('0xba')](_0x328b12[_0x1398('0x46')][_0x1398('0x6f')])[_0x1398('0x36')](function(){if(_[_0x1398('0xbb')](_0x328b12[_0x1398('0x46')][_0x1398('0x6f')])){for(var _0x584434=0x0;_0x584434<_0x328b12[_0x1398('0x46')][_0x1398('0x6f')][_0x1398('0x4b')];_0x584434+=0x1){socket[_0x1398('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x328b12[_0x1398('0x46')][_0x1398('0x6f')][_0x584434]),'OpenchannelAccountId':Number(_0x328b12[_0x1398('0x5b')]['id'])});}}else{socket[_0x1398('0xbc')](_0x1398('0xbd'),{'UserId':Number(_0x328b12[_0x1398('0x46')][_0x1398('0x6f')]),'OpenchannelAccountId':Number(_0x328b12[_0x1398('0x5b')]['id'])});}});}})[_0x1398('0x36')](respondWithStatusCode(_0x25836a,null))[_0x1398('0x59')](handleError(_0x25836a,null));};exports[_0x1398('0xbe')]=function(_0xe023ca,_0x99b511,_0x5007c3){var _0x27c065={};var _0x4e4b4a={};var _0x1e99c1;var _0x4f8f7f;return db[_0x1398('0x3f')][_0x1398('0x6a')]({'where':{'id':_0xe023ca[_0x1398('0x5b')]['id']}})['then'](handleEntityNotFound(_0x99b511,null))[_0x1398('0x36')](function(_0x1bff92){if(_0x1bff92){_0x1e99c1=_0x1bff92;_0x4e4b4a['model']=_['keys'](db['User'][_0x1398('0x40')]);_0x4e4b4a['query']=_[_0x1398('0x5c')](_0xe023ca[_0x1398('0x46')]);_0x4e4b4a[_0x1398('0x47')]=_['intersection'](_0x4e4b4a[_0x1398('0x44')],_0x4e4b4a['query']);_0x27c065[_0x1398('0x49')]=_[_0x1398('0x48')](_0x4e4b4a[_0x1398('0x44')],qs[_0x1398('0x4a')](_0xe023ca['query'][_0x1398('0x4a')]));_0x27c065[_0x1398('0x49')]=_0x27c065['attributes'][_0x1398('0x4b')]?_0x27c065['attributes']:_0x4e4b4a[_0x1398('0x44')];_0x27c065[_0x1398('0x4e')]=qs[_0x1398('0x4f')](_0xe023ca[_0x1398('0x46')][_0x1398('0x4f')]);_0x27c065[_0x1398('0x50')]=qs['filters'](_[_0x1398('0x51')](_0xe023ca[_0x1398('0x46')],_0x4e4b4a['filters']));if(_0xe023ca[_0x1398('0x46')][_0x1398('0x54')]){_0x27c065[_0x1398('0x50')]=_[_0x1398('0x52')](_0x27c065[_0x1398('0x50')],{'$or':_['map'](_0x27c065[_0x1398('0x49')],function(_0x29481f){var _0x59f3f6={};_0x59f3f6[_0x29481f]={'$like':'%'+_0xe023ca[_0x1398('0x46')][_0x1398('0x54')]+'%'};return _0x59f3f6;})});}_0x27c065=_['merge']({},_0x27c065,_0xe023ca['options']);return _0x1e99c1[_0x1398('0xbe')](_0x27c065);}})[_0x1398('0x36')](function(_0x2ef3f4){if(_0x2ef3f4){_0x4f8f7f=_0x2ef3f4[_0x1398('0x4b')];if(!_0xe023ca[_0x1398('0x46')]['hasOwnProperty'](_0x1398('0x4c'))){_0x27c065[_0x1398('0x4d')]=qs[_0x1398('0x4d')](_0xe023ca['query'][_0x1398('0x4d')]);_0x27c065[_0x1398('0x31')]=qs[_0x1398('0x31')](_0xe023ca['query'][_0x1398('0x31')]);}return _0x1e99c1[_0x1398('0xbe')](_0x27c065);}})[_0x1398('0x36')](function(_0x1b0371){if(_0x1b0371){return _0x1b0371?{'count':_0x4f8f7f,'rows':_0x1b0371}:null;}})[_0x1398('0x36')](respondWithResult(_0x99b511,null))[_0x1398('0x59')](handleError(_0x99b511,null));};exports['send']=function(_0xe6984,_0x468088,_0x472229){var _0xa9e41c,_0x47b2cf,_0x1b1acb;if(_['isNil'](_0xe6984[_0x1398('0x68')]['body'])||_0xe6984[_0x1398('0x68')]['body']===''){throw new db['Sequelize'][(_0x1398('0x76'))](_0x1398('0x80'));}if(_[_0x1398('0x7c')](_0xe6984[_0x1398('0x68')]['to'])){}_0xa9e41c=_0xe6984['body']['to'];return db['OpenchannelAccount'][_0x1398('0x6a')]({'where':{'id':_0xe6984[_0x1398('0x5b')]['id']}})[_0x1398('0x36')](handleEntityNotFound(_0x468088,null))['then'](function(_0x303a05){if(_0x303a05){return db[_0x1398('0x3f')][_0x1398('0x5d')]({'where':{'id':_0x303a05['id']},'include':[{'model':db[_0x1398('0xbf')],'as':_0x1398('0x83'),'include':[{'model':db[_0x1398('0x75')],'as':_0x1398('0x84'),'where':{[_0x303a05[_0x1398('0x81')]]:_0xa9e41c},'limit':0x1,'order':[['updatedAt',_0x1398('0x85')]]}]}]})[_0x1398('0x36')](handleEntityNotFound(_0x468088,null))[_0x1398('0x36')](function(_0x293969){if(_0x293969&&_0x293969[_0x1398('0x83')]){_0x47b2cf=_0x293969['get']({'plain':!![]});if(_0x47b2cf[_0x1398('0x83')]&&_0x47b2cf[_0x1398('0x83')][_0x1398('0x84')][_0x1398('0x4b')]){return _0x47b2cf['List'][_0x1398('0x84')][0x0];}return db['CmContact'][_0x1398('0x5e')](_[_0x1398('0x1d')](_0xe6984[_0x1398('0x68')],{'firstName':_0xa9e41c,[_0x293969[_0x1398('0x81')]]:_0xa9e41c,'phone':_0xa9e41c,'ListId':_0x47b2cf[_0x1398('0x7b')]}));}})[_0x1398('0x36')](handleEntityNotFound(_0x468088,null))[_0x1398('0x36')](function(_0x1814f4){if(_0x1814f4){_0x1b1acb=_0x1814f4;return db[_0x1398('0x92')][_0x1398('0x5d')]({'where':{'ContactId':_0x1b1acb['id'],'closed':![],'OpenchannelAccountId':_0x47b2cf['id']}})[_0x1398('0x36')](function(_0x2eeed4){if(_0x2eeed4){return[_0x2eeed4,![]];}return db[_0x1398('0x92')][_0x1398('0x5e')]({'UserId':_0xe6984[_0x1398('0x5f')]['id'],'ContactId':_0x1b1acb['id'],'OpenchannelAccountId':_0x47b2cf['id'],'lastMsgDirection':_0x1398('0xc0'),'firstMsgDirection':_0x1398('0xc0'),'Messages':[_[_0x1398('0x52')](_0xe6984['body'],{'read':![],'body':_0xe6984[_0x1398('0x68')][_0x1398('0x68')],'OpenchannelAccountId':_0x47b2cf['id'],'UserId':_0xe6984[_0x1398('0x5f')]['id'],'ContactId':_0x1b1acb['id']})]},{'include':[{'model':db[_0x1398('0x9c')],'as':_0x1398('0xc1')}]})[_0x1398('0x36')](function(_0x2140be){return[_0x2140be,!![]];});});}})[_0x1398('0x95')](function(_0x415f70,_0x10be2c){if(_0x10be2c){return _0x415f70;}return db[_0x1398('0x9c')][_0x1398('0x5e')](_[_0x1398('0x52')](_0xe6984['body'],{'read':![],'body':_0xe6984[_0x1398('0x68')][_0x1398('0x68')],'OpenchannelAccountId':_0x47b2cf['id'],'OpenchannelInteractionId':_0x415f70['id'],'UserId':_0xe6984['user']['id'],'ContactId':_0x1b1acb['id']}))[_0x1398('0x36')](function(_0x5aaf79){_0x415f70[_0x1398('0xc2')]['Messages']=[];_0x415f70[_0x1398('0xc2')][_0x1398('0xc1')]['push'](_0x5aaf79[_0x1398('0xc2')]);return _0x415f70;});});}})['then'](respondWithResult(_0x468088,null))[_0x1398('0x59')](handleError(_0x468088,null));}; \ No newline at end of file +var _0xe740=['json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','user','role','get','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','length','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','asc','Contacts','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status'];(function(_0xcb9904,_0x3fa20c){var _0xf6d3d=function(_0x3c81aa){while(--_0x3c81aa){_0xcb9904['push'](_0xcb9904['shift']());}};_0xf6d3d(++_0x3fa20c);}(_0xe740,0x14b));var _0x0e74=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xe740[_0x37a79c];return _0x561d89;};'use strict';var emlformat=require(_0x0e74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e74('0x1'));var jsonpatch=require(_0x0e74('0x2'));var rp=require('request-promise');var moment=require(_0x0e74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e74('0x4'));var util=require('util');var path=require(_0x0e74('0x5'));var sox=require(_0x0e74('0x6'));var csv=require('to-csv');var ejs=require(_0x0e74('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e74('0x8'));var squel=require(_0x0e74('0x9'));var crypto=require(_0x0e74('0xa'));var jsforce=require(_0x0e74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0e74('0xc'));var querystring=require(_0x0e74('0xd'));var Papa=require(_0x0e74('0xe'));var Redis=require(_0x0e74('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e74('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0e74('0x12'));var config=require(_0x0e74('0x13'));var licenseUtil=require(_0x0e74('0x14'));var db=require(_0x0e74('0x15'))['db'];config['redis']=_[_0x0e74('0x16')](config['redis'],{'host':_0x0e74('0x17'),'port':0x18eb});var socket=require(_0x0e74('0x18'))(new Redis(config[_0x0e74('0x19')]));require(_0x0e74('0x1a'))[_0x0e74('0x1b')](socket);var jayson=require(_0x0e74('0x1c'));var client=jayson[_0x0e74('0x1d')][_0x0e74('0x1e')]({'port':0x232c});var client9002=jayson[_0x0e74('0x1d')][_0x0e74('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1c9156,_0x205272,_0x2421a9,_0x5972a0){return new BPromise(function(_0x5a754e,_0x3c3c9c){var _0x472a49=_0x5972a0||client;return _0x472a49[_0x0e74('0x1f')](_0x1c9156,_0x2421a9)[_0x0e74('0x20')](function(_0x44c74e){logger[_0x0e74('0x21')](_0x0e74('0x22'),_0x205272,_0x0e74('0x23'));logger[_0x0e74('0x24')](_0x0e74('0x25'),_0x205272,_0x0e74('0x23'),JSON['stringify'](_0x44c74e));if(_0x44c74e[_0x0e74('0x26')]){if(_0x44c74e[_0x0e74('0x26')][_0x0e74('0x27')]===0x1f4){logger[_0x0e74('0x26')](_0x0e74('0x22'),_0x205272,_0x44c74e[_0x0e74('0x26')]['message']);return _0x3c3c9c(_0x44c74e[_0x0e74('0x26')][_0x0e74('0x28')]);}logger[_0x0e74('0x26')](_0x0e74('0x22'),_0x205272,_0x44c74e['error'][_0x0e74('0x28')]);return _0x5a754e(_0x44c74e[_0x0e74('0x26')][_0x0e74('0x28')]);}else{logger[_0x0e74('0x21')](_0x0e74('0x22'),_0x205272,_0x0e74('0x23'));_0x5a754e(_0x44c74e[_0x0e74('0x29')][_0x0e74('0x28')]);}})[_0x0e74('0x2a')](function(_0x12de91){logger[_0x0e74('0x26')](_0x0e74('0x22'),_0x205272,_0x12de91);_0x3c3c9c(_0x12de91);});});}function respondWithStatusCode(_0x37eb6f,_0x536143){_0x536143=_0x536143||0xcc;return function(_0x2709be){if(_0x2709be){return _0x37eb6f[_0x0e74('0x2b')](_0x536143);}return _0x37eb6f[_0x0e74('0x2c')](_0x536143)['end']();};}function respondWithResult(_0x9d1248,_0x24db44){_0x24db44=_0x24db44||0xc8;return function(_0x1e35e4){if(_0x1e35e4){return _0x9d1248[_0x0e74('0x2c')](_0x24db44)[_0x0e74('0x2d')](_0x1e35e4);}};}function respondWithFilteredResult(_0x4a895d,_0x100950){return function(_0x172870){if(_0x172870){var _0x18064a=typeof _0x100950[_0x0e74('0x2e')]==='undefined'&&typeof _0x100950[_0x0e74('0x2f')]===_0x0e74('0x30');var _0x58a822=_0x172870[_0x0e74('0x31')];var _0x4df6c1=_0x18064a?0x0:_0x100950[_0x0e74('0x2e')];var _0x1fe6af=_0x18064a?_0x172870['count']:_0x100950[_0x0e74('0x2e')]+_0x100950[_0x0e74('0x2f')];var _0xaac9a6;if(_0x1fe6af>=_0x58a822){_0x1fe6af=_0x58a822;_0xaac9a6=0xc8;}else{_0xaac9a6=0xce;}_0x4a895d[_0x0e74('0x2c')](_0xaac9a6);return _0x4a895d[_0x0e74('0x32')](_0x0e74('0x33'),_0x4df6c1+'-'+_0x1fe6af+'/'+_0x58a822)['json'](_0x172870);}return null;};}function patchUpdates(_0x49f341){return function(_0x36c055){try{jsonpatch[_0x0e74('0x34')](_0x36c055,_0x49f341,!![]);}catch(_0x47bd97){return BPromise['reject'](_0x47bd97);}return _0x36c055[_0x0e74('0x35')]();};}function saveUpdates(_0x51ddbe,_0x43a9e1){return function(_0x32c120){if(_0x32c120){return _0x32c120[_0x0e74('0x36')](_0x51ddbe)[_0x0e74('0x20')](function(_0x1f4ccd){return _0x1f4ccd;});}return null;};}function removeEntity(_0x4ce64c,_0x5b529c){return function(_0x24c55b){if(_0x24c55b){return _0x24c55b[_0x0e74('0x37')]()[_0x0e74('0x20')](function(){var _0x45f0b9=_0x24c55b['get']({'plain':!![]});var _0x3a8a58='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x3a8a58,'resourceId':_0x45f0b9['id']}})['then'](function(){return _0x24c55b;});})[_0x0e74('0x20')](function(){_0x4ce64c[_0x0e74('0x2c')](0xcc)[_0x0e74('0x38')]();});}};}function handleEntityNotFound(_0x12cb2d,_0x345046){return function(_0xf8f525){if(!_0xf8f525){_0x12cb2d[_0x0e74('0x2b')](0x194);}return _0xf8f525;};}function handleError(_0x43a482,_0x3fc00c){_0x3fc00c=_0x3fc00c||0x1f4;return function(_0x533271){logger[_0x0e74('0x26')](_0x533271['stack']);if(_0x533271[_0x0e74('0x39')]){delete _0x533271[_0x0e74('0x39')];}_0x43a482[_0x0e74('0x2c')](_0x3fc00c)[_0x0e74('0x3a')](_0x533271);};}exports[_0x0e74('0x3b')]=function(_0x1d6c2d,_0x3b46da){var _0x42eab1={'include':[{'model':db[_0x0e74('0x3c')],'as':_0x0e74('0x3d')}]},_0xe7e4ad={},_0x4b446a={'count':0x0,'rows':[]};var _0x1e1dd2=_[_0x0e74('0x3e')](db[_0x0e74('0x3f')][_0x0e74('0x40')],function(_0xb1108e){return{'name':_0xb1108e[_0x0e74('0x41')],'type':_0xb1108e[_0x0e74('0x42')]['key']};});_0xe7e4ad['model']=_[_0x0e74('0x3e')](_0x1e1dd2,'name');_0xe7e4ad['query']=_[_0x0e74('0x43')](_0x1d6c2d[_0x0e74('0x44')]);_0xe7e4ad[_0x0e74('0x45')]=_[_0x0e74('0x46')](_0xe7e4ad[_0x0e74('0x47')],_0xe7e4ad[_0x0e74('0x44')]);_0x42eab1[_0x0e74('0x48')]=_['intersection'](_0xe7e4ad[_0x0e74('0x47')],qs['fields'](_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x49')]));_0x42eab1[_0x0e74('0x48')]=_0x42eab1['attributes']['length']?_0x42eab1['attributes']:_0xe7e4ad[_0x0e74('0x47')];if(!_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x4a')](_0x0e74('0x4b'))){_0x42eab1[_0x0e74('0x2f')]=qs[_0x0e74('0x2f')](_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x2f')]);_0x42eab1['offset']=qs['offset'](_0x1d6c2d['query'][_0x0e74('0x2e')]);}_0x42eab1[_0x0e74('0x4c')]=qs[_0x0e74('0x4d')](_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x4d')]);_0x42eab1[_0x0e74('0x4e')]=qs[_0x0e74('0x45')](_[_0x0e74('0x4f')](_0x1d6c2d[_0x0e74('0x44')],_0xe7e4ad['filters']),_0x1e1dd2);if(_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x50')]){_0x42eab1[_0x0e74('0x4e')]=_[_0x0e74('0x51')](_0x42eab1[_0x0e74('0x4e')],{'$or':_[_0x0e74('0x3e')](_0x1e1dd2,function(_0x1f6714){if(_0x1f6714[_0x0e74('0x42')]!==_0x0e74('0x52')){var _0x29b1ac={};_0x29b1ac[_0x1f6714['name']]={'$like':'%'+_0x1d6c2d['query'][_0x0e74('0x50')]+'%'};return _0x29b1ac;}})});}_0x42eab1=_[_0x0e74('0x51')]({},_0x42eab1,_0x1d6c2d[_0x0e74('0x53')]);var _0x4cfeff={'where':_0x42eab1[_0x0e74('0x4e')]};return db[_0x0e74('0x3f')][_0x0e74('0x31')](_0x4cfeff)[_0x0e74('0x20')](function(_0x4569cd){_0x4b446a[_0x0e74('0x31')]=_0x4569cd;if(_0x1d6c2d[_0x0e74('0x44')][_0x0e74('0x54')]){_0x42eab1[_0x0e74('0x55')]=[{'all':!![]}];}return db[_0x0e74('0x3f')][_0x0e74('0x56')](_0x42eab1);})['then'](function(_0x352735){_0x4b446a[_0x0e74('0x57')]=_0x352735;return _0x4b446a;})['then'](respondWithFilteredResult(_0x3b46da,_0x42eab1))[_0x0e74('0x2a')](handleError(_0x3b46da,null));};exports[_0x0e74('0x58')]=function(_0x1dd9e4,_0x704361){var _0x39cb75={'raw':![],'where':{'id':_0x1dd9e4['params']['id']},'include':[{'model':db['Pause'],'as':_0x0e74('0x3d')}]},_0x5d33a2={};_0x5d33a2[_0x0e74('0x47')]=_[_0x0e74('0x43')](db['OpenchannelAccount']['rawAttributes']);_0x5d33a2[_0x0e74('0x44')]=_[_0x0e74('0x43')](_0x1dd9e4['query']);_0x5d33a2['filters']=_[_0x0e74('0x46')](_0x5d33a2[_0x0e74('0x47')],_0x5d33a2['query']);_0x39cb75[_0x0e74('0x48')]=_[_0x0e74('0x46')](_0x5d33a2[_0x0e74('0x47')],qs[_0x0e74('0x49')](_0x1dd9e4['query'][_0x0e74('0x49')]));_0x39cb75[_0x0e74('0x48')]=_0x39cb75[_0x0e74('0x48')]['length']?_0x39cb75[_0x0e74('0x48')]:_0x5d33a2[_0x0e74('0x47')];if(_0x1dd9e4[_0x0e74('0x44')][_0x0e74('0x54')]){_0x39cb75[_0x0e74('0x55')]=[{'all':!![]}];}_0x39cb75=_[_0x0e74('0x51')]({},_0x39cb75,_0x1dd9e4[_0x0e74('0x53')]);return db[_0x0e74('0x3f')][_0x0e74('0x59')](_0x39cb75)[_0x0e74('0x20')](handleEntityNotFound(_0x704361,null))[_0x0e74('0x20')](respondWithResult(_0x704361,null))['catch'](handleError(_0x704361,null));};exports['create']=function(_0x254f04,_0x10b114){return db[_0x0e74('0x3f')]['create'](_0x254f04[_0x0e74('0x5a')],{})['then'](function(_0x3cc322){var _0xd45d19=_0x254f04[_0x0e74('0x5b')]['get']({'plain':!![]});if(!_0xd45d19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd45d19[_0x0e74('0x5c')]===_0x0e74('0x5b')){var _0x4ba19f=_0x3cc322[_0x0e74('0x5d')]({'plain':!![]});var _0x247c00=_0x0e74('0x5e');return db[_0x0e74('0x5f')][_0x0e74('0x59')]({'where':{'name':_0x247c00,'userProfileId':_0xd45d19[_0x0e74('0x60')]},'raw':!![]})['then'](function(_0x5ebb97){if(_0x5ebb97&&_0x5ebb97[_0x0e74('0x61')]===0x0){return db['UserProfileResource'][_0x0e74('0x62')]({'name':_0x4ba19f[_0x0e74('0x39')],'resourceId':_0x4ba19f['id'],'type':_0x5ebb97['name'],'sectionId':_0x5ebb97['id']},{})[_0x0e74('0x20')](function(){return _0x3cc322;});}else{return _0x3cc322;}})[_0x0e74('0x2a')](function(_0x1e1b4){logger[_0x0e74('0x26')](_0x0e74('0x63'),_0x1e1b4);throw _0x1e1b4;});}return _0x3cc322;})[_0x0e74('0x20')](respondWithResult(_0x10b114,0xc9))[_0x0e74('0x2a')](handleError(_0x10b114,null));};exports[_0x0e74('0x36')]=function(_0x3cbaaf,_0x16a77e){if(_0x3cbaaf[_0x0e74('0x5a')]['id']){delete _0x3cbaaf['body']['id'];}return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x3cbaaf['params']['id']},'include':[{'model':db[_0x0e74('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x0e74('0x20')](handleEntityNotFound(_0x16a77e,null))[_0x0e74('0x20')](saveUpdates(_0x3cbaaf[_0x0e74('0x5a')],null))[_0x0e74('0x20')](respondWithResult(_0x16a77e,null))[_0x0e74('0x2a')](handleError(_0x16a77e,null));};exports[_0x0e74('0x37')]=function(_0x1fadfb,_0x4100dd){return db['OpenchannelAccount'][_0x0e74('0x59')]({'where':{'id':_0x1fadfb[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x4100dd,null))['then'](removeEntity(_0x4100dd,null))[_0x0e74('0x2a')](handleError(_0x4100dd,null));};exports[_0x0e74('0x65')]=function(_0xffeddd,_0x52a295){return db[_0x0e74('0x3f')][_0x0e74('0x65')]()[_0x0e74('0x20')](respondWithResult(_0x52a295,null))[_0x0e74('0x2a')](handleError(_0x52a295,null));};exports[_0x0e74('0x66')]=function(_0x49ee10,_0x28d5a2,_0x2a8547){if(_0x49ee10[_0x0e74('0x5a')]['id']){delete _0x49ee10[_0x0e74('0x5a')]['id'];}return db['OpenchannelAccount'][_0x0e74('0x59')]({'where':{'id':_0x49ee10['params']['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x28d5a2,null))[_0x0e74('0x20')](function(_0x43cac4){if(_0x43cac4){_0x49ee10[_0x0e74('0x5a')][_0x0e74('0x67')]=_0x43cac4['id'];return db['Disposition'][_0x0e74('0x62')](_0x49ee10['body']);}})[_0x0e74('0x20')](respondWithResult(_0x28d5a2,null))[_0x0e74('0x2a')](handleError(_0x28d5a2,null));};exports[_0x0e74('0x68')]=function(_0x448643,_0x449163,_0x483ecf){var _0x95589a={'raw':![],'where':{}};var _0x4f4902={};var _0x1072f3={'count':0x0,'rows':[]};return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x448643[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x449163,null))[_0x0e74('0x20')](function(_0x3ba09d){if(_0x3ba09d){_0x4f4902['model']=_[_0x0e74('0x43')](db[_0x0e74('0x6a')][_0x0e74('0x40')]);_0x4f4902[_0x0e74('0x44')]=_[_0x0e74('0x43')](_0x448643[_0x0e74('0x44')]);_0x4f4902['filters']=_[_0x0e74('0x46')](_0x4f4902[_0x0e74('0x47')],_0x4f4902[_0x0e74('0x44')]);_0x95589a[_0x0e74('0x48')]=_[_0x0e74('0x46')](_0x4f4902[_0x0e74('0x47')],qs[_0x0e74('0x49')](_0x448643[_0x0e74('0x44')][_0x0e74('0x49')]));_0x95589a[_0x0e74('0x48')]=_0x95589a[_0x0e74('0x48')][_0x0e74('0x6b')]?_0x95589a['attributes']:_0x4f4902[_0x0e74('0x47')];if(!_0x448643[_0x0e74('0x44')]['hasOwnProperty']('nolimit')){_0x95589a[_0x0e74('0x2f')]=qs[_0x0e74('0x2f')](_0x448643[_0x0e74('0x44')][_0x0e74('0x2f')]);_0x95589a[_0x0e74('0x2e')]=qs[_0x0e74('0x2e')](_0x448643['query'][_0x0e74('0x2e')]);}_0x95589a[_0x0e74('0x4c')]=qs[_0x0e74('0x4d')](_0x448643[_0x0e74('0x44')][_0x0e74('0x4d')]);_0x95589a[_0x0e74('0x4e')]=qs[_0x0e74('0x45')](_['pick'](_0x448643['query'],_0x4f4902[_0x0e74('0x45')]));_0x95589a[_0x0e74('0x4e')]['OpenchannelAccountId']=_0x3ba09d['id'];if(_0x448643[_0x0e74('0x44')][_0x0e74('0x50')]){_0x95589a[_0x0e74('0x4e')]=_[_0x0e74('0x51')](_0x95589a[_0x0e74('0x4e')],{'$or':_[_0x0e74('0x3e')](_0x95589a['attributes'],function(_0x5e1fe6){var _0x387dae={};_0x387dae[_0x5e1fe6]={'$like':'%'+_0x448643[_0x0e74('0x44')]['filter']+'%'};return _0x387dae;})});}_0x95589a=_[_0x0e74('0x51')]({},_0x95589a,_0x448643['options']);return db[_0x0e74('0x6a')]['count']({'where':_0x95589a['where']})[_0x0e74('0x20')](function(_0x149fcd){_0x1072f3[_0x0e74('0x31')]=_0x149fcd;if(_0x448643[_0x0e74('0x44')]['includeAll']){_0x95589a[_0x0e74('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x0e74('0x56')](_0x95589a);})[_0x0e74('0x20')](function(_0x19ee28){_0x1072f3[_0x0e74('0x57')]=_0x19ee28;return _0x1072f3;});}})[_0x0e74('0x20')](respondWithFilteredResult(_0x449163,_0x95589a))[_0x0e74('0x2a')](handleError(_0x449163,null));};exports[_0x0e74('0x6c')]=function(_0x143106,_0x4cb0c2,_0x2c96b7){return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x143106[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x4cb0c2,null))[_0x0e74('0x20')](function(_0xa2699f){if(_0xa2699f){return _0xa2699f[_0x0e74('0x6c')](_0x143106[_0x0e74('0x44')][_0x0e74('0x6d')]);}})[_0x0e74('0x20')](respondWithStatusCode(_0x4cb0c2,null))[_0x0e74('0x2a')](handleError(_0x4cb0c2,null));};exports['addAnswer']=function(_0x20a431,_0x2920a4,_0x5aac94){if(_0x20a431[_0x0e74('0x5a')]['id']){delete _0x20a431[_0x0e74('0x5a')]['id'];}return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x20a431[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x2920a4,null))['then'](function(_0x5721d8){if(_0x5721d8){_0x20a431[_0x0e74('0x5a')]['OpenchannelAccountId']=_0x5721d8['id'];return db[_0x0e74('0x6e')][_0x0e74('0x62')](_0x20a431['body']);}})[_0x0e74('0x20')](respondWithResult(_0x2920a4,null))['catch'](handleError(_0x2920a4,null));};exports['getAnswers']=function(_0x39b77e,_0x1c7500,_0x1e0b35){var _0x5c36d2={'raw':![],'where':{}};var _0x9b770c={};var _0x508754={'count':0x0,'rows':[]};return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x39b77e[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x1c7500,null))['then'](function(_0x404293){if(_0x404293){_0x9b770c[_0x0e74('0x47')]=_[_0x0e74('0x43')](db[_0x0e74('0x6e')]['rawAttributes']);_0x9b770c['query']=_[_0x0e74('0x43')](_0x39b77e[_0x0e74('0x44')]);_0x9b770c[_0x0e74('0x45')]=_[_0x0e74('0x46')](_0x9b770c[_0x0e74('0x47')],_0x9b770c['query']);_0x5c36d2[_0x0e74('0x48')]=_[_0x0e74('0x46')](_0x9b770c[_0x0e74('0x47')],qs[_0x0e74('0x49')](_0x39b77e[_0x0e74('0x44')][_0x0e74('0x49')]));_0x5c36d2[_0x0e74('0x48')]=_0x5c36d2['attributes'][_0x0e74('0x6b')]?_0x5c36d2[_0x0e74('0x48')]:_0x9b770c[_0x0e74('0x47')];if(!_0x39b77e[_0x0e74('0x44')][_0x0e74('0x4a')](_0x0e74('0x4b'))){_0x5c36d2[_0x0e74('0x2f')]=qs[_0x0e74('0x2f')](_0x39b77e['query']['limit']);_0x5c36d2[_0x0e74('0x2e')]=qs['offset'](_0x39b77e['query'][_0x0e74('0x2e')]);}_0x5c36d2[_0x0e74('0x4c')]=qs[_0x0e74('0x4d')](_0x39b77e['query']['sort']);_0x5c36d2[_0x0e74('0x4e')]=qs['filters'](_['pick'](_0x39b77e[_0x0e74('0x44')],_0x9b770c[_0x0e74('0x45')]));_0x5c36d2[_0x0e74('0x4e')][_0x0e74('0x67')]=_0x404293['id'];if(_0x39b77e[_0x0e74('0x44')][_0x0e74('0x50')]){_0x5c36d2['where']=_[_0x0e74('0x51')](_0x5c36d2['where'],{'$or':_['map'](_0x5c36d2[_0x0e74('0x48')],function(_0x5eca3c){var _0x35175e={};_0x35175e[_0x5eca3c]={'$like':'%'+_0x39b77e['query'][_0x0e74('0x50')]+'%'};return _0x35175e;})});}_0x5c36d2=_[_0x0e74('0x51')]({},_0x5c36d2,_0x39b77e['options']);return db[_0x0e74('0x6e')][_0x0e74('0x31')]({'where':_0x5c36d2['where']})['then'](function(_0x50037a){_0x508754[_0x0e74('0x31')]=_0x50037a;if(_0x39b77e[_0x0e74('0x44')][_0x0e74('0x54')]){_0x5c36d2[_0x0e74('0x55')]=[{'all':!![]}];}return db[_0x0e74('0x6e')]['findAll'](_0x5c36d2);})[_0x0e74('0x20')](function(_0x3b298e){_0x508754[_0x0e74('0x57')]=_0x3b298e;return _0x508754;});}})[_0x0e74('0x20')](respondWithFilteredResult(_0x1c7500,_0x5c36d2))['catch'](handleError(_0x1c7500,null));};exports[_0x0e74('0x6f')]=function(_0x4781f7,_0x5f2f33,_0x38f06d){return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x4781f7[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x5f2f33,null))[_0x0e74('0x20')](function(_0x90c053){if(_0x90c053){return _0x90c053['removeAnswers'](_0x4781f7[_0x0e74('0x44')][_0x0e74('0x6d')]);}})[_0x0e74('0x20')](respondWithStatusCode(_0x5f2f33,null))['catch'](handleError(_0x5f2f33,null));};exports[_0x0e74('0x70')]=function(_0x6dc359,_0x17a22a,_0x55321a){var _0x5ac9e6={'body':_0x6dc359[_0x0e74('0x5a')],'channel':_0x0e74('0x71')};var _0x212188=[];var _0x5cd9cc=[];var _0x394afc={};var _0x3dac21=![];return db['CmContact'][_0x0e74('0x65')]()['then'](function(_0x5d600e){if(!_0x5d600e){throw new db[(_0x0e74('0x72'))][(_0x0e74('0x73'))](_0x0e74('0x74'));}_0x212188=_[_0x0e74('0x75')](_['keys'](_0x5d600e),[_0x0e74('0x76'),_0x0e74('0x77')]);_0x5cd9cc=_['difference'](_[_0x0e74('0x43')](_0x5d600e),[_0x0e74('0x76'),'updatedAt',_0x0e74('0x78'),_0x0e74('0x79')]);if(_0x6dc359[_0x0e74('0x5a')]['id']){delete _0x6dc359[_0x0e74('0x5a')]['id'];}if(_['isNil'](_0x6dc359[_0x0e74('0x5a')]['from'])){throw new db[(_0x0e74('0x72'))][(_0x0e74('0x73'))](_0x0e74('0x7a'));}if(_[_0x0e74('0x7b')](_0x6dc359[_0x0e74('0x5a')]['body'])||_0x6dc359['body'][_0x0e74('0x5a')]===''){throw new db[(_0x0e74('0x72'))][(_0x0e74('0x73'))](_0x0e74('0x7c'));}if(_[_0x0e74('0x7b')](_0x6dc359['body'][_0x0e74('0x7d')])){throw new db[(_0x0e74('0x72'))]['ValidationError'](_0x0e74('0x7e')+_0x5cd9cc);}if(!_['includes'](_0x5cd9cc,_0x6dc359['body'][_0x0e74('0x7d')])){throw new db['Sequelize'][(_0x0e74('0x73'))](_0x0e74('0x7f')+_0x5cd9cc);}_0x394afc[_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x7d')]]=_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x80')];})[_0x0e74('0x20')](function(){return db[_0x0e74('0x3f')]['find']({'where':{'id':_0x6dc359[_0x0e74('0x64')]['id']},'include':[{'model':db[_0x0e74('0x81')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x394afc,'limit':0x1,'order':[['updatedAt',_0x0e74('0x82')]]}]},{'model':db[_0x0e74('0x83')],'as':_0x0e74('0x84')}]});})[_0x0e74('0x20')](handleEntityNotFound(_0x17a22a,null))['then'](function(_0x284ad0){if(_0x284ad0&&_0x284ad0[_0x0e74('0x85')]){_0x5ac9e6[_0x0e74('0x86')]=_0x284ad0;_0x5ac9e6[_0x0e74('0x87')]=_0x284ad0[_0x0e74('0x84')];_0x5ac9e6['list']=_0x284ad0['List'];_0x5ac9e6[_0x0e74('0x87')]=_[_0x0e74('0x88')](_0x5ac9e6[_0x0e74('0x87')],['priority'],[_0x0e74('0x89')]);if(_0x5ac9e6[_0x0e74('0x86')][_0x0e74('0x84')]){delete _0x5ac9e6['account'][_0x0e74('0x84')];}if(_0x5ac9e6['account']['List']&&_0x5ac9e6[_0x0e74('0x86')][_0x0e74('0x85')]['Contacts'][_0x0e74('0x6b')]){return _0x5ac9e6[_0x0e74('0x86')][_0x0e74('0x85')][_0x0e74('0x8a')][0x0];}var _0x3761f7=_[_0x0e74('0x16')](_0x6dc359[_0x0e74('0x5a')],{'firstName':_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x80')],'ListId':_0x284ad0[_0x0e74('0x79')]});_0x3761f7[_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x7d')]]=_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x80')];return db[_0x0e74('0x8b')][_0x0e74('0x62')](_0x3761f7,{'fields':_0x212188,'raw':!![]});}})['then'](handleEntityNotFound(_0x17a22a,null))[_0x0e74('0x20')](function(_0x249a65){_0x5ac9e6['contact']=_0x249a65;if(_0x249a65){var _0x279cd8={'ContactId':_0x249a65['id'],'OpenchannelAccountId':_0x6dc359['params']['id'],'from':(_0x249a65[_0x0e74('0x8c')]||'')+'\x20'+(_0x249a65['lastName']||'')};var _0x2d8fad={'OpenchannelAccountId':_0x6dc359[_0x0e74('0x64')]['id'],'closed':![]};if(_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x8d')]){_0x2d8fad[_0x0e74('0x8d')]=_0x6dc359['body'][_0x0e74('0x8d')];return db[_0x0e74('0x8e')][_0x0e74('0x59')]({'where':_0x2d8fad})['then'](function(_0x31cd78){if(_0x31cd78){return[_0x31cd78,![]];}_0x279cd8[_0x0e74('0x8d')]=_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x8d')];_0x279cd8[_0x0e74('0x8f')]=_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x8f')];return db[_0x0e74('0x8e')][_0x0e74('0x62')](_0x279cd8)[_0x0e74('0x20')](function(_0x468567){return[_0x468567,!![]];});});}else{_0x2d8fad[_0x0e74('0x8d')]=null;}_0x2d8fad[_0x0e74('0x90')]=_0x249a65['id'];return db['OpenchannelInteraction'][_0x0e74('0x59')]({'where':_0x2d8fad})[_0x0e74('0x20')](function(_0x1cfb91){if(_0x1cfb91){return[_0x1cfb91,![]];}return db[_0x0e74('0x8e')]['create'](_0x279cd8)[_0x0e74('0x20')](function(_0x28a01a){return[_0x28a01a,!![]];});});}})[_0x0e74('0x91')](function(_0x48a39a,_0x17ee84){if(_0x48a39a){_0x3dac21=_0x17ee84;if(!_0x17ee84){var _0x115ed8={'from':(_0x5ac9e6[_0x0e74('0x92')]['firstName']||'')+'\x20'+(_0x5ac9e6[_0x0e74('0x92')]['lastName']||'')};if(_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x8d')]&&_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x93')]&&_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x8d')]!=_0x6dc359['body']['messageId']){_0x115ed8[_0x0e74('0x8d')]=_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x93')];}return _0x48a39a[_0x0e74('0x36')](_0x115ed8);}else{return _0x48a39a;}}})[_0x0e74('0x20')](function(_0x3d2347){_0x5ac9e6[_0x0e74('0x94')]=_0x3d2347[_0x0e74('0x5d')]({'plain':!![]});_0x5ac9e6[_0x0e74('0x94')]['created']=_0x3dac21;if(_0x5ac9e6[_0x0e74('0x94')][_0x0e74('0x95')]){if(_0x5ac9e6[_0x0e74('0x86')]['autoclose']){_0x5ac9e6['applications'][_0x0e74('0x96')]({'id':0x0,'priority':_0x5ac9e6['applications'][_0x0e74('0x6b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x0e74('0x97')});}}return db[_0x0e74('0x98')]['create']({'body':_0x6dc359[_0x0e74('0x5a')][_0x0e74('0x5a')],'OpenchannelAccountId':_0x6dc359[_0x0e74('0x64')]['id'],'OpenchannelInteractionId':_0x3d2347['id'],'direction':'in','ContactId':_0x5ac9e6[_0x0e74('0x92')]['id'],'AttachmentId':_0x6dc359['body'][_0x0e74('0x99')]});})['then'](function(_0x114e6b){_0x5ac9e6[_0x0e74('0x28')]=_0x114e6b;if(!_0x5ac9e6['interaction'][_0x0e74('0x9a')])return;return db['User'][_0x0e74('0x59')]({'attributes':['id',_0x0e74('0x39')],'where':{'id':_0x5ac9e6[_0x0e74('0x94')][_0x0e74('0x9a')]}});})[_0x0e74('0x20')](function(_0x44f849){if(_0x44f849){_0x5ac9e6[_0x0e74('0x87')][_0x0e74('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x44f849['name']+','+(_0x5ac9e6['account'][_0x0e74('0x9c')]||0xa),'interval':'*,*,*,*'});}if(!_0x5ac9e6[_0x0e74('0x94')][_0x0e74('0x9d')])return;return db[_0x0e74('0x9e')][_0x0e74('0x59')]({'attributes':['id',_0x0e74('0x39')],'where':{'id':_0x5ac9e6['interaction']['queueId']}});})[_0x0e74('0x20')](function(_0x1679e1){if(_0x1679e1){_0x5ac9e6[_0x0e74('0x87')][_0x0e74('0x9b')]({'id':0x0,'priority':0x1,'app':_0x0e74('0x9f'),'appdata':_0x1679e1[_0x0e74('0x39')]+','+(_0x5ac9e6[_0x0e74('0x86')]['waitForTheAssignedQueue']||0x12c),'interval':_0x0e74('0x97')});}return respondWithRpcPromise('Start',_0x0e74('0xa0'),_0x5ac9e6);})[_0x0e74('0x20')](function(_0x4cda33){respondWithRpcPromise(_0x0e74('0xa1'),_0x0e74('0xa1'),{'event':_0x0e74('0x70'),'message':_0x4cda33},client9002);return _0x4cda33;})[_0x0e74('0x20')](respondWithResult(_0x17a22a,null))[_0x0e74('0x2a')](handleError(_0x17a22a,null));};exports[_0x0e74('0xa2')]=function(_0x2f2097,_0x557f42){var _0x1a8233=_0x2f2097['params']['id'];var _0x575e2b=_0x2f2097[_0x0e74('0x5a')];var _0x11f999=0xc8;var _0x3ea5d8=null;return db['sequelize'][_0x0e74('0xa3')]({'isolationLevel':db[_0x0e74('0xa4')][_0x0e74('0xa5')][_0x0e74('0xa6')][_0x0e74('0xa7')]},function(_0x5f318e){return db[_0x0e74('0x3f')]['findOne']({'where':{'id':_0x1a8233},'transaction':_0x5f318e})[_0x0e74('0x20')](function(_0x5900b4){if(_0x5900b4){return db[_0x0e74('0x83')][_0x0e74('0x37')]({'where':{'OpenchannelAccountId':_0x1a8233},'transaction':_0x5f318e})[_0x0e74('0x20')](function(){var _0x302eca=_[_0x0e74('0x3e')](_0x575e2b,function(_0x1205f7){_0x1205f7['OpenchannelAccountId']=_0x1a8233;return _0x1205f7;});return db[_0x0e74('0x83')]['bulkCreate'](_0x302eca,{'transaction':_0x5f318e});});}else{_0x11f999=0x194;_0x3ea5d8=[];}});})[_0x0e74('0x20')](function(){if(_0x11f999!==0x194){return db[_0x0e74('0x83')][_0x0e74('0xa8')]({'where':{'OpenchannelAccountId':_0x1a8233},'order':'priority'})[_0x0e74('0x20')](function(_0x3ddf90){_0x3ea5d8=_0x3ddf90;});}})[_0x0e74('0x2a')](function(_0x5169a3){_0x11f999=0x1f4;logger[_0x0e74('0x26')](_0x5169a3['stack']);if(_0x5169a3[_0x0e74('0x39')]){delete _0x5169a3['name'];}_0x3ea5d8=_0x5169a3;})[_0x0e74('0xa9')](function(){if(_0x3ea5d8===null){_0x557f42[_0x0e74('0x2b')](_0x11f999);}else{if(_0x11f999===0x1f4){_0x557f42[_0x0e74('0x2c')](_0x11f999)['send'](_0x3ea5d8);}else{_0x557f42[_0x0e74('0x2c')](_0x11f999)[_0x0e74('0x2d')](_0x3ea5d8);}}});};exports[_0x0e74('0xaa')]=function(_0x289f15,_0x3e797d,_0x50ac70){var _0x4fc188={};var _0x57d0f2={};var _0xccdd69;var _0x264c3f;return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x289f15['params']['id']}})['then'](handleEntityNotFound(_0x3e797d,null))[_0x0e74('0x20')](function(_0xa35cd2){if(_0xa35cd2){_0xccdd69=_0xa35cd2;_0x57d0f2['model']=_[_0x0e74('0x43')](db[_0x0e74('0x83')][_0x0e74('0x40')]);_0x57d0f2[_0x0e74('0x44')]=_[_0x0e74('0x43')](_0x289f15[_0x0e74('0x44')]);_0x57d0f2[_0x0e74('0x45')]=_['intersection'](_0x57d0f2[_0x0e74('0x47')],_0x57d0f2['query']);_0x4fc188[_0x0e74('0x48')]=_[_0x0e74('0x46')](_0x57d0f2[_0x0e74('0x47')],qs[_0x0e74('0x49')](_0x289f15[_0x0e74('0x44')][_0x0e74('0x49')]));_0x4fc188[_0x0e74('0x48')]=_0x4fc188[_0x0e74('0x48')]['length']?_0x4fc188[_0x0e74('0x48')]:_0x57d0f2[_0x0e74('0x47')];_0x4fc188[_0x0e74('0x4c')]=qs[_0x0e74('0x4d')](_0x289f15[_0x0e74('0x44')]['sort']);_0x4fc188[_0x0e74('0x4e')]=qs[_0x0e74('0x45')](_[_0x0e74('0x4f')](_0x289f15[_0x0e74('0x44')],_0x57d0f2['filters']));if(_0x289f15['query']['filter']){_0x4fc188[_0x0e74('0x4e')]=_['merge'](_0x4fc188[_0x0e74('0x4e')],{'$or':_[_0x0e74('0x3e')](_0x4fc188['attributes'],function(_0x591856){var _0x511214={};_0x511214[_0x591856]={'$like':'%'+_0x289f15[_0x0e74('0x44')][_0x0e74('0x50')]+'%'};return _0x511214;})});}_0x4fc188=_[_0x0e74('0x51')]({},_0x4fc188,_0x289f15[_0x0e74('0x53')]);return _0xccdd69[_0x0e74('0xaa')](_0x4fc188);}})[_0x0e74('0x20')](function(_0x1c57ae){if(_0x1c57ae){_0x264c3f=_0x1c57ae[_0x0e74('0x6b')];if(!_0x289f15[_0x0e74('0x44')]['hasOwnProperty'](_0x0e74('0x4b'))){_0x4fc188['limit']=qs[_0x0e74('0x2f')](_0x289f15['query'][_0x0e74('0x2f')]);_0x4fc188[_0x0e74('0x2e')]=qs[_0x0e74('0x2e')](_0x289f15[_0x0e74('0x44')][_0x0e74('0x2e')]);}return _0xccdd69[_0x0e74('0xaa')](_0x4fc188);}})[_0x0e74('0x20')](function(_0x2a9d78){if(_0x2a9d78){return _0x2a9d78?{'count':_0x264c3f,'rows':_0x2a9d78}:null;}})[_0x0e74('0x20')](respondWithResult(_0x3e797d,null))[_0x0e74('0x2a')](handleError(_0x3e797d,null));};exports[_0x0e74('0xab')]=function(_0x4d1966,_0x47b0c1,_0xc45121){var _0x234c8e={'raw':![],'where':{}};var _0x283ab8={};var _0x4d9abb={'count':0x0,'rows':[]};return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x4d1966[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x47b0c1,null))[_0x0e74('0x20')](function(_0x20c3d8){if(_0x20c3d8){_0x283ab8['model']=_[_0x0e74('0x43')](db[_0x0e74('0x8e')][_0x0e74('0x40')]);_0x283ab8[_0x0e74('0x44')]=_[_0x0e74('0x43')](_0x4d1966['query']);_0x283ab8[_0x0e74('0x45')]=_['intersection'](_0x283ab8[_0x0e74('0x47')],_0x283ab8['query']);_0x234c8e[_0x0e74('0x48')]=_[_0x0e74('0x46')](_0x283ab8[_0x0e74('0x47')],qs[_0x0e74('0x49')](_0x4d1966[_0x0e74('0x44')][_0x0e74('0x49')]));_0x234c8e['attributes']=_0x234c8e[_0x0e74('0x48')][_0x0e74('0x6b')]?_0x234c8e[_0x0e74('0x48')]:_0x283ab8['model'];if(!_0x4d1966[_0x0e74('0x44')][_0x0e74('0x4a')]('nolimit')){_0x234c8e['limit']=qs[_0x0e74('0x2f')](_0x4d1966[_0x0e74('0x44')]['limit']);_0x234c8e[_0x0e74('0x2e')]=qs['offset'](_0x4d1966[_0x0e74('0x44')]['offset']);}_0x234c8e[_0x0e74('0x4c')]=qs['sort'](_0x4d1966[_0x0e74('0x44')][_0x0e74('0x4d')]);_0x234c8e[_0x0e74('0x4e')]=qs['filters'](_['pick'](_0x4d1966[_0x0e74('0x44')],_0x283ab8['filters']));_0x234c8e[_0x0e74('0x4e')][_0x0e74('0x67')]=_0x20c3d8['id'];if(_0x4d1966[_0x0e74('0x44')][_0x0e74('0x50')]){_0x234c8e[_0x0e74('0x4e')]=_[_0x0e74('0x51')](_0x234c8e[_0x0e74('0x4e')],{'$or':_[_0x0e74('0x3e')](_0x234c8e[_0x0e74('0x48')],function(_0x54160c){var _0x28d08a={};_0x28d08a[_0x54160c]={'$like':'%'+_0x4d1966[_0x0e74('0x44')][_0x0e74('0x50')]+'%'};return _0x28d08a;})});}_0x234c8e=_[_0x0e74('0x51')]({},_0x234c8e,_0x4d1966[_0x0e74('0x53')]);return db[_0x0e74('0x8e')][_0x0e74('0x31')]({'where':_0x234c8e[_0x0e74('0x4e')]})[_0x0e74('0x20')](function(_0x2e8506){_0x4d9abb['count']=_0x2e8506;if(_0x4d1966['query'][_0x0e74('0x54')]){_0x234c8e[_0x0e74('0x55')]=[{'model':db[_0x0e74('0x8b')],'as':_0x0e74('0xac'),'required':![]},{'model':db[_0x0e74('0xad')],'as':_0x0e74('0xae'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x0e74('0xaf')],'as':'Tags','attributes':['id',_0x0e74('0x39'),'color'],'where':_0x4d1966[_0x0e74('0x44')]['tag']?{'id':_0x4d1966[_0x0e74('0x44')][_0x0e74('0xb0')]}:undefined,'required':_0x4d1966[_0x0e74('0x44')][_0x0e74('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x0e74('0x56')](_0x234c8e);})[_0x0e74('0x20')](function(_0x529fd5){_0x4d9abb[_0x0e74('0x57')]=_0x529fd5;return _0x4d9abb;});}})[_0x0e74('0x20')](respondWithFilteredResult(_0x47b0c1,_0x234c8e))['catch'](handleError(_0x47b0c1,null));};exports['addAgents']=function(_0x3f8edd,_0x1a807c,_0xade667){return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x3f8edd[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x1a807c,null))[_0x0e74('0x20')](function(_0x56cea2){if(_0x56cea2){return _0x56cea2[_0x0e74('0xb1')](_0x3f8edd[_0x0e74('0x5a')][_0x0e74('0x6d')],_[_0x0e74('0xb2')](_0x3f8edd[_0x0e74('0x5a')],['ids','id'])||{})[_0x0e74('0x91')](function(_0x5d61ca){for(var _0x1d1a0f=0x0;_0x1d1a0f<_0x3f8edd['body'][_0x0e74('0x6d')][_0x0e74('0x6b')];_0x1d1a0f+=0x1){socket[_0x0e74('0xb3')](_0x0e74('0xb4'),{'UserId':Number(_0x3f8edd[_0x0e74('0x5a')][_0x0e74('0x6d')][_0x1d1a0f]),'OpenchannelAccountId':Number(_0x3f8edd['params']['id'])});}return _0x5d61ca;});}})['then'](respondWithResult(_0x1a807c,null))[_0x0e74('0x2a')](handleError(_0x1a807c,null));};exports[_0x0e74('0xb5')]=function(_0x315abd,_0x51c035,_0x36d19c){return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x315abd[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x51c035,null))['then'](function(_0x162b8e){if(_0x162b8e){return _0x162b8e['removeAgents'](_0x315abd[_0x0e74('0x44')][_0x0e74('0x6d')])[_0x0e74('0x20')](function(){if(_[_0x0e74('0xb6')](_0x315abd['query']['ids'])){for(var _0x54c03a=0x0;_0x54c03a<_0x315abd[_0x0e74('0x44')][_0x0e74('0x6d')][_0x0e74('0x6b')];_0x54c03a+=0x1){socket[_0x0e74('0xb3')](_0x0e74('0xb7'),{'UserId':Number(_0x315abd[_0x0e74('0x44')][_0x0e74('0x6d')][_0x54c03a]),'OpenchannelAccountId':Number(_0x315abd['params']['id'])});}}else{socket[_0x0e74('0xb3')](_0x0e74('0xb7'),{'UserId':Number(_0x315abd['query'][_0x0e74('0x6d')]),'OpenchannelAccountId':Number(_0x315abd[_0x0e74('0x64')]['id'])});}});}})[_0x0e74('0x20')](respondWithStatusCode(_0x51c035,null))[_0x0e74('0x2a')](handleError(_0x51c035,null));};exports[_0x0e74('0xb8')]=function(_0x1d0a7d,_0x51b9a4,_0x45f794){var _0x26fb74={};var _0x58e3bf={};var _0x1adbcf;var _0x5625a0;return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x1d0a7d[_0x0e74('0x64')]['id']}})['then'](handleEntityNotFound(_0x51b9a4,null))[_0x0e74('0x20')](function(_0x8b2734){if(_0x8b2734){_0x1adbcf=_0x8b2734;_0x58e3bf[_0x0e74('0x47')]=_[_0x0e74('0x43')](db['User'][_0x0e74('0x40')]);_0x58e3bf[_0x0e74('0x44')]=_[_0x0e74('0x43')](_0x1d0a7d[_0x0e74('0x44')]);_0x58e3bf[_0x0e74('0x45')]=_[_0x0e74('0x46')](_0x58e3bf['model'],_0x58e3bf[_0x0e74('0x44')]);_0x26fb74['attributes']=_[_0x0e74('0x46')](_0x58e3bf[_0x0e74('0x47')],qs['fields'](_0x1d0a7d['query'][_0x0e74('0x49')]));_0x26fb74[_0x0e74('0x48')]=_0x26fb74[_0x0e74('0x48')][_0x0e74('0x6b')]?_0x26fb74[_0x0e74('0x48')]:_0x58e3bf[_0x0e74('0x47')];_0x26fb74[_0x0e74('0x4c')]=qs[_0x0e74('0x4d')](_0x1d0a7d['query'][_0x0e74('0x4d')]);_0x26fb74['where']=qs[_0x0e74('0x45')](_['pick'](_0x1d0a7d[_0x0e74('0x44')],_0x58e3bf['filters']));if(_0x1d0a7d[_0x0e74('0x44')][_0x0e74('0x50')]){_0x26fb74[_0x0e74('0x4e')]=_[_0x0e74('0x51')](_0x26fb74[_0x0e74('0x4e')],{'$or':_[_0x0e74('0x3e')](_0x26fb74[_0x0e74('0x48')],function(_0x3a9e05){var _0xeb42e8={};_0xeb42e8[_0x3a9e05]={'$like':'%'+_0x1d0a7d['query'][_0x0e74('0x50')]+'%'};return _0xeb42e8;})});}_0x26fb74=_[_0x0e74('0x51')]({},_0x26fb74,_0x1d0a7d[_0x0e74('0x53')]);return _0x1adbcf[_0x0e74('0xb8')](_0x26fb74);}})[_0x0e74('0x20')](function(_0x2417a1){if(_0x2417a1){_0x5625a0=_0x2417a1['length'];if(!_0x1d0a7d[_0x0e74('0x44')]['hasOwnProperty'](_0x0e74('0x4b'))){_0x26fb74[_0x0e74('0x2f')]=qs['limit'](_0x1d0a7d[_0x0e74('0x44')]['limit']);_0x26fb74[_0x0e74('0x2e')]=qs[_0x0e74('0x2e')](_0x1d0a7d[_0x0e74('0x44')][_0x0e74('0x2e')]);}return _0x1adbcf['getAgents'](_0x26fb74);}})[_0x0e74('0x20')](function(_0x3c97b0){if(_0x3c97b0){return _0x3c97b0?{'count':_0x5625a0,'rows':_0x3c97b0}:null;}})[_0x0e74('0x20')](respondWithResult(_0x51b9a4,null))['catch'](handleError(_0x51b9a4,null));};exports['send']=function(_0x821165,_0x3846b7,_0x1db933){var _0x200045,_0x4af72a,_0x3c0254;if(_[_0x0e74('0x7b')](_0x821165[_0x0e74('0x5a')][_0x0e74('0x5a')])||_0x821165[_0x0e74('0x5a')][_0x0e74('0x5a')]===''){throw new db[(_0x0e74('0x72'))]['ValidationError'](_0x0e74('0x7c'));}if(_[_0x0e74('0x7b')](_0x821165[_0x0e74('0x5a')]['to'])){}_0x200045=_0x821165[_0x0e74('0x5a')]['to'];return db[_0x0e74('0x3f')][_0x0e74('0x69')]({'where':{'id':_0x821165[_0x0e74('0x64')]['id']}})[_0x0e74('0x20')](handleEntityNotFound(_0x3846b7,null))[_0x0e74('0x20')](function(_0x46669b){if(_0x46669b){return db[_0x0e74('0x3f')][_0x0e74('0x59')]({'where':{'id':_0x46669b['id']},'include':[{'model':db[_0x0e74('0x81')],'as':_0x0e74('0x85'),'include':[{'model':db['CmContact'],'as':_0x0e74('0x8a'),'where':{[_0x46669b[_0x0e74('0x7d')]]:_0x200045},'limit':0x1,'order':[[_0x0e74('0x77'),_0x0e74('0x82')]]}]}]})[_0x0e74('0x20')](handleEntityNotFound(_0x3846b7,null))[_0x0e74('0x20')](function(_0x431fc5){if(_0x431fc5&&_0x431fc5['List']){_0x4af72a=_0x431fc5['get']({'plain':!![]});if(_0x4af72a[_0x0e74('0x85')]&&_0x4af72a[_0x0e74('0x85')][_0x0e74('0x8a')][_0x0e74('0x6b')]){return _0x4af72a['List'][_0x0e74('0x8a')][0x0];}return db['CmContact'][_0x0e74('0x62')](_[_0x0e74('0x16')](_0x821165[_0x0e74('0x5a')],{'firstName':_0x200045,[_0x431fc5[_0x0e74('0x7d')]]:_0x200045,'phone':_0x200045,'ListId':_0x4af72a[_0x0e74('0x79')]}));}})[_0x0e74('0x20')](handleEntityNotFound(_0x3846b7,null))['then'](function(_0x316b0a){if(_0x316b0a){_0x3c0254=_0x316b0a;return db[_0x0e74('0x8e')][_0x0e74('0x59')]({'where':{'ContactId':_0x3c0254['id'],'closed':![],'OpenchannelAccountId':_0x4af72a['id']}})[_0x0e74('0x20')](function(_0x45b094){if(_0x45b094){return[_0x45b094,![]];}return db[_0x0e74('0x8e')]['create']({'UserId':_0x821165[_0x0e74('0x5b')]['id'],'ContactId':_0x3c0254['id'],'OpenchannelAccountId':_0x4af72a['id'],'lastMsgDirection':'out','firstMsgDirection':_0x0e74('0xb9'),'Messages':[_['merge'](_0x821165[_0x0e74('0x5a')],{'read':![],'body':_0x821165[_0x0e74('0x5a')]['body'],'OpenchannelAccountId':_0x4af72a['id'],'UserId':_0x821165[_0x0e74('0x5b')]['id'],'ContactId':_0x3c0254['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0e74('0xba')}]})[_0x0e74('0x20')](function(_0x515907){return[_0x515907,!![]];});});}})[_0x0e74('0x91')](function(_0x5799b8,_0x54e5ad){if(_0x54e5ad){return _0x5799b8;}return db[_0x0e74('0x98')][_0x0e74('0x62')](_[_0x0e74('0x51')](_0x821165['body'],{'read':![],'body':_0x821165[_0x0e74('0x5a')][_0x0e74('0x5a')],'OpenchannelAccountId':_0x4af72a['id'],'OpenchannelInteractionId':_0x5799b8['id'],'UserId':_0x821165['user']['id'],'ContactId':_0x3c0254['id']}))[_0x0e74('0x20')](function(_0x48b17a){_0x5799b8[_0x0e74('0xbb')][_0x0e74('0xba')]=[];_0x5799b8['dataValues'][_0x0e74('0xba')][_0x0e74('0x96')](_0x48b17a[_0x0e74('0xbb')]);return _0x5799b8;});});}})[_0x0e74('0x20')](respondWithResult(_0x3846b7,null))[_0x0e74('0x2a')](handleError(_0x3846b7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 66d6988..7de8051 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 _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x58f7ae,_0x5086c9){var _0x151519=function(_0x102e83){while(--_0x102e83){_0x58f7ae['push'](_0x58f7ae['shift']());}};_0x151519(++_0x5086c9);}(_0x13f6,0x124));var _0x613f=function(_0x276fae,_0x1424c1){_0x276fae=_0x276fae-0x0;var _0x132c7e=_0x13f6[_0x276fae];return _0x132c7e;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x38cffe,_0x130745){var _0x4152ea=function(_0x5e5f16){while(--_0x5e5f16){_0x38cffe['push'](_0x38cffe['shift']());}};_0x4152ea(++_0x130745);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('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 b33f4a1..9cf892c 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(_0x48564c,_0x2fa4ba){var _0x3cfcf4=function(_0x13dc4b){while(--_0x13dc4b){_0x48564c['push'](_0x48564c['shift']());}};_0x3cfcf4(++_0x2fa4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x207e92,_0x3fb511){var _0x1b23e0=function(_0x3b6b41){while(--_0x3b6b41){_0x207e92['push'](_0x207e92['shift']());}};_0x1b23e0(++_0x3fb511);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 9b76275..43c4f65 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 _0xbdb7=['http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x10756d,_0x2f324b){var _0x50f5cb=function(_0x88b00){while(--_0x88b00){_0x10756d['push'](_0x10756d['shift']());}};_0x50f5cb(++_0x2f324b);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0xbdb7[_0x8b0f43];return _0x3f4425;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});config[_0x7bdb('0xb')]=_['defaults'](config['redis'],{'host':_0x7bdb('0xc'),'port':0x18eb});var socket=require(_0x7bdb('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x7bdb('0xe')](socket);function respondWithRpcPromise(_0x1a6b61,_0x2cb569,_0x2c328e){return new BPromise(function(_0x27297d,_0x144ff7){return client[_0x7bdb('0xf')](_0x1a6b61,_0x2c328e)[_0x7bdb('0x10')](function(_0x5462da){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2cb569,_0x7bdb('0x11'));logger[_0x7bdb('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2cb569,_0x7bdb('0x11'),JSON['stringify'](_0x5462da));if(_0x5462da['error']){if(_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2cb569,_0x5462da['error'][_0x7bdb('0x15')]);return _0x144ff7(_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x15')]);}logger[_0x7bdb('0x13')](_0x7bdb('0x16'),_0x2cb569,_0x5462da[_0x7bdb('0x13')][_0x7bdb('0x15')]);return _0x27297d(_0x5462da[_0x7bdb('0x13')]['message']);}else{logger[_0x7bdb('0x17')](_0x7bdb('0x16'),_0x2cb569,_0x7bdb('0x11'));_0x27297d(_0x5462da[_0x7bdb('0x18')]['message']);}})[_0x7bdb('0x19')](function(_0x23e9eb){logger['error'](_0x7bdb('0x16'),_0x2cb569,_0x23e9eb);_0x144ff7(_0x23e9eb);});});} \ No newline at end of file +var _0x593e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3f7c01,_0x14de50){var _0x4f0d13=function(_0x23849e){while(--_0x23849e){_0x3f7c01['push'](_0x3f7c01['shift']());}};_0x4f0d13(++_0x14de50);}(_0x593e,0xcb));var _0xe593=function(_0x10e530,_0x50961e){_0x10e530=_0x10e530-0x0;var _0x5332e3=_0x593e[_0x10e530];return _0x5332e3;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});config[_0xe593('0xd')]=_[_0xe593('0xe')](config[_0xe593('0xd')],{'host':_0xe593('0xf'),'port':0x18eb});var socket=require(_0xe593('0x10'))(new Redis(config['redis']));require(_0xe593('0x11'))[_0xe593('0x12')](socket);function respondWithRpcPromise(_0x38d977,_0x5ba75c,_0x5f1222){return new BPromise(function(_0x3032ee,_0xeefe30){return client[_0xe593('0x13')](_0x38d977,_0x5f1222)['then'](function(_0x6a5d4f){logger[_0xe593('0x14')](_0xe593('0x15'),_0x5ba75c,_0xe593('0x16'));logger[_0xe593('0x17')](_0xe593('0x18'),_0x5ba75c,_0xe593('0x16'),JSON[_0xe593('0x19')](_0x6a5d4f));if(_0x6a5d4f[_0xe593('0x1a')]){if(_0x6a5d4f[_0xe593('0x1a')]['code']===0x1f4){logger[_0xe593('0x1a')](_0xe593('0x15'),_0x5ba75c,_0x6a5d4f['error'][_0xe593('0x1b')]);return _0xeefe30(_0x6a5d4f[_0xe593('0x1a')]['message']);}logger[_0xe593('0x1a')](_0xe593('0x15'),_0x5ba75c,_0x6a5d4f[_0xe593('0x1a')][_0xe593('0x1b')]);return _0x3032ee(_0x6a5d4f[_0xe593('0x1a')][_0xe593('0x1b')]);}else{logger['info'](_0xe593('0x15'),_0x5ba75c,_0xe593('0x16'));_0x3032ee(_0x6a5d4f['result'][_0xe593('0x1b')]);}})[_0xe593('0x1c')](function(_0x56b4ff){logger[_0xe593('0x1a')](_0xe593('0x15'),_0x5ba75c,_0x56b4ff);_0xeefe30(_0x56b4ff);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7b58ec5..30ce8ea 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 _0xfd3a=['save','remove','update','emit','removeListener','length','./openchannelAccount.events'];(function(_0x53c9cc,_0x1e3782){var _0x47b5f8=function(_0x4bc3f1){while(--_0x4bc3f1){_0x53c9cc['push'](_0x53c9cc['shift']());}};_0x47b5f8(++_0x1e3782);}(_0xfd3a,0x179));var _0xafd3=function(_0x4cdbca,_0x3841bd){_0x4cdbca=_0x4cdbca-0x0;var _0x8b114f=_0xfd3a[_0x4cdbca];return _0x8b114f;};'use strict';var OpenchannelAccountEvents=require(_0xafd3('0x0'));var events=[_0xafd3('0x1'),_0xafd3('0x2'),_0xafd3('0x3')];function createListener(_0x4ce05e,_0x488608){return function(_0x160b0d){_0x488608[_0xafd3('0x4')](_0x4ce05e,_0x160b0d);};}function removeListener(_0x328118,_0x415217){return function(){OpenchannelAccountEvents[_0xafd3('0x5')](_0x328118,_0x415217);};}exports['register']=function(_0x9db715){for(var _0x1a72eb=0x0,_0x1f7e16=events[_0xafd3('0x6')];_0x1a72eb<_0x1f7e16;_0x1a72eb++){var _0xd2d780=events[_0x1a72eb];var _0x4c4dcd=createListener('openchannelAccount:'+_0xd2d780,_0x9db715);OpenchannelAccountEvents['on'](_0xd2d780,_0x4c4dcd);}}; \ No newline at end of file +var _0x21a3=['update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','remove'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x21a3,0x66));var _0x321a=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0x21a3[_0x3b08de];return _0x53fbe4;};'use strict';var OpenchannelAccountEvents=require(_0x321a('0x0'));var events=['save',_0x321a('0x1'),_0x321a('0x2')];function createListener(_0x1070a2,_0x401ef1){return function(_0x3ad15d){_0x401ef1[_0x321a('0x3')](_0x1070a2,_0x3ad15d);};}function removeListener(_0x5df495,_0x536b51){return function(){OpenchannelAccountEvents[_0x321a('0x4')](_0x5df495,_0x536b51);};}exports[_0x321a('0x5')]=function(_0x467682){for(var _0x28e166=0x0,_0x5f3b81=events[_0x321a('0x6')];_0x28e166<_0x5f3b81;_0x28e166++){var _0x24a04c=events[_0x28e166];var _0x10c1d3=createListener(_0x321a('0x7')+_0x24a04c,_0x467682);OpenchannelAccountEvents['on'](_0x24a04c,_0x10c1d3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index eff5363..c9d60a7 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 _0x1ef1=['./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0x1ef1,0x9b));var _0x11ef=function(_0x92db13,_0x76c91c){_0x92db13=_0x92db13-0x0;var _0x2c37e9=_0x1ef1[_0x92db13];return _0x2c37e9;};'use strict';var multer=require('multer');var util=require(_0x11ef('0x0'));var path=require('path');var timeout=require(_0x11ef('0x1'));var express=require(_0x11ef('0x2'));var router=express[_0x11ef('0x3')]();var fs_extra=require(_0x11ef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x11ef('0x5'));var config=require(_0x11ef('0x6'));var controller=require(_0x11ef('0x7'));router['get']('/',auth[_0x11ef('0x8')](),controller[_0x11ef('0x9')]);router['get'](_0x11ef('0xa'),auth[_0x11ef('0x8')](),controller[_0x11ef('0xb')]);router[_0x11ef('0xc')]('/',auth[_0x11ef('0x8')](),controller[_0x11ef('0xd')]);router[_0x11ef('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x11ef('0xf')]);router['delete'](_0x11ef('0xa'),auth[_0x11ef('0x8')](),controller[_0x11ef('0x10')]);module[_0x11ef('0x11')]=router; \ No newline at end of file +var _0x11ea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2d66b4,_0x5ccdbe){var _0x17fc0b=function(_0x2d7228){while(--_0x2d7228){_0x2d66b4['push'](_0x2d66b4['shift']());}};_0x17fc0b(++_0x5ccdbe);}(_0x11ea,0x19d));var _0xa11e=function(_0x1e2058,_0x4daf37){_0x1e2058=_0x1e2058-0x0;var _0x1db307=_0x11ea[_0x1e2058];return _0x1db307;};'use strict';var multer=require(_0xa11e('0x0'));var util=require(_0xa11e('0x1'));var path=require(_0xa11e('0x2'));var timeout=require(_0xa11e('0x3'));var express=require(_0xa11e('0x4'));var router=express[_0xa11e('0x5')]();var fs_extra=require(_0xa11e('0x6'));var auth=require(_0xa11e('0x7'));var interaction=require(_0xa11e('0x8'));var config=require(_0xa11e('0x9'));var controller=require(_0xa11e('0xa'));router['get']('/',auth[_0xa11e('0xb')](),controller[_0xa11e('0xc')]);router['get'](_0xa11e('0xd'),auth['isAuthenticated'](),controller[_0xa11e('0xe')]);router[_0xa11e('0xf')]('/',auth[_0xa11e('0xb')](),controller['create']);router[_0xa11e('0x10')](_0xa11e('0xd'),auth[_0xa11e('0xb')](),controller[_0xa11e('0x11')]);router['delete'](_0xa11e('0xd'),auth[_0xa11e('0xb')](),controller[_0xa11e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7c70572..699edfa 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 _0xe644=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x51ba60,_0x285782){var _0x7c11bf=function(_0x2aa30a){while(--_0x2aa30a){_0x51ba60['push'](_0x51ba60['shift']());}};_0x7c11bf(++_0x285782);}(_0xe644,0x7f));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e64('0x0'));module[_0x4e64('0x1')]={'priority':{'type':Sequelize[_0x4e64('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4e64('0x3')],'allowNull':![],'defaultValue':_0x4e64('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4e64('0x5')}}; \ No newline at end of file +var _0x84f5=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x179805,_0x17d188){var _0x5654fa=function(_0x2083bb){while(--_0x2083bb){_0x179805['push'](_0x179805['shift']());}};_0x5654fa(++_0x17d188);}(_0x84f5,0xa0));var _0x584f=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x84f5[_0x3b8774];return _0x5bcfcc;};'use strict';var Sequelize=require('sequelize');module[_0x584f('0x0')]={'priority':{'type':Sequelize[_0x584f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x584f('0x2')],'allowNull':![],'defaultValue':_0x584f('0x3')},'appdata':{'type':Sequelize[_0x584f('0x4')]()},'description':{'type':Sequelize[_0x584f('0x2')]},'interval':{'type':Sequelize[_0x584f('0x2')],'defaultValue':_0x584f('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 74bcb99..4903e57 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 _0xd57f=['send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd57f,0x185));var _0xfd57=function(_0x550c79,_0x2f7801){_0x550c79=_0x550c79-0x0;var _0x53a2fe=_0xd57f[_0x550c79];return _0x53a2fe;};'use strict';var emlformat=require(_0xfd57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd57('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfd57('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfd57('0x3'));var util=require('util');var path=require(_0xfd57('0x4'));var sox=require(_0xfd57('0x5'));var csv=require(_0xfd57('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd57('0x7'));var _=require('lodash');var squel=require(_0xfd57('0x8'));var crypto=require(_0xfd57('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfd57('0xa'));var toCsv=require(_0xfd57('0x6'));var querystring=require(_0xfd57('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfd57('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd57('0xd'));var logger=require(_0xfd57('0xe'))(_0xfd57('0xf'));var utils=require(_0xfd57('0x10'));var config=require(_0xfd57('0x11'));var licenseUtil=require(_0xfd57('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x553841,_0x452989){_0x452989=_0x452989||0xcc;return function(_0x1779c8){if(_0x1779c8){return _0x553841[_0xfd57('0x13')](_0x452989);}return _0x553841[_0xfd57('0x14')](_0x452989)['end']();};}function respondWithResult(_0x31daf3,_0x38b70e){_0x38b70e=_0x38b70e||0xc8;return function(_0x301c3b){if(_0x301c3b){return _0x31daf3[_0xfd57('0x14')](_0x38b70e)[_0xfd57('0x15')](_0x301c3b);}};}function respondWithFilteredResult(_0x216d6b,_0x36789f){return function(_0x243839){if(_0x243839){var _0x1653eb=typeof _0x36789f[_0xfd57('0x16')]===_0xfd57('0x17')&&typeof _0x36789f[_0xfd57('0x18')]===_0xfd57('0x17');var _0x2e954e=_0x243839['count'];var _0x4db100=_0x1653eb?0x0:_0x36789f[_0xfd57('0x16')];var _0x5ffed6=_0x1653eb?_0x243839[_0xfd57('0x19')]:_0x36789f[_0xfd57('0x16')]+_0x36789f[_0xfd57('0x18')];var _0x24c8a8;if(_0x5ffed6>=_0x2e954e){_0x5ffed6=_0x2e954e;_0x24c8a8=0xc8;}else{_0x24c8a8=0xce;}_0x216d6b[_0xfd57('0x14')](_0x24c8a8);return _0x216d6b[_0xfd57('0x1a')](_0xfd57('0x1b'),_0x4db100+'-'+_0x5ffed6+'/'+_0x2e954e)[_0xfd57('0x15')](_0x243839);}return null;};}function patchUpdates(_0x13be89){return function(_0x1b0f0d){try{jsonpatch[_0xfd57('0x1c')](_0x1b0f0d,_0x13be89,!![]);}catch(_0x21f333){return BPromise[_0xfd57('0x1d')](_0x21f333);}return _0x1b0f0d[_0xfd57('0x1e')]();};}function saveUpdates(_0x397fd1,_0x52c190){return function(_0x40ff54){if(_0x40ff54){return _0x40ff54['update'](_0x397fd1)[_0xfd57('0x1f')](function(_0x27279f){return _0x27279f;});}return null;};}function removeEntity(_0x4e9bb4,_0xd5215c){return function(_0x4cf2c0){if(_0x4cf2c0){return _0x4cf2c0[_0xfd57('0x20')]()['then'](function(){_0x4e9bb4['status'](0xcc)[_0xfd57('0x21')]();});}};}function handleEntityNotFound(_0x143845,_0x5cc87c){return function(_0x411ae7){if(!_0x411ae7){_0x143845['sendStatus'](0x194);}return _0x411ae7;};}function handleError(_0x460d5d,_0x3cfd9d){_0x3cfd9d=_0x3cfd9d||0x1f4;return function(_0xb1c22d){logger[_0xfd57('0x22')](_0xb1c22d[_0xfd57('0x23')]);if(_0xb1c22d[_0xfd57('0x24')]){delete _0xb1c22d['name'];}_0x460d5d['status'](_0x3cfd9d)[_0xfd57('0x25')](_0xb1c22d);};}exports[_0xfd57('0x26')]=function(_0x2555a6,_0x43baca){var _0xa6e0fb={},_0x167b79={},_0x591254={'count':0x0,'rows':[]};var _0x485116=_[_0xfd57('0x27')](db[_0xfd57('0x28')][_0xfd57('0x29')],function(_0xdb18f3){return{'name':_0xdb18f3['fieldName'],'type':_0xdb18f3[_0xfd57('0x2a')][_0xfd57('0x2b')]};});_0x167b79[_0xfd57('0x2c')]=_[_0xfd57('0x27')](_0x485116,_0xfd57('0x24'));_0x167b79[_0xfd57('0x2d')]=_['keys'](_0x2555a6[_0xfd57('0x2d')]);_0x167b79[_0xfd57('0x2e')]=_[_0xfd57('0x2f')](_0x167b79['model'],_0x167b79[_0xfd57('0x2d')]);_0xa6e0fb[_0xfd57('0x30')]=_[_0xfd57('0x2f')](_0x167b79[_0xfd57('0x2c')],qs['fields'](_0x2555a6[_0xfd57('0x2d')][_0xfd57('0x31')]));_0xa6e0fb[_0xfd57('0x30')]=_0xa6e0fb[_0xfd57('0x30')][_0xfd57('0x32')]?_0xa6e0fb[_0xfd57('0x30')]:_0x167b79[_0xfd57('0x2c')];if(!_0x2555a6['query'][_0xfd57('0x33')]('nolimit')){_0xa6e0fb[_0xfd57('0x18')]=qs[_0xfd57('0x18')](_0x2555a6[_0xfd57('0x2d')][_0xfd57('0x18')]);_0xa6e0fb['offset']=qs[_0xfd57('0x16')](_0x2555a6['query'][_0xfd57('0x16')]);}_0xa6e0fb[_0xfd57('0x34')]=qs[_0xfd57('0x35')](_0x2555a6[_0xfd57('0x2d')][_0xfd57('0x35')]);_0xa6e0fb[_0xfd57('0x36')]=qs['filters'](_[_0xfd57('0x37')](_0x2555a6['query'],_0x167b79['filters']),_0x485116);if(_0x2555a6[_0xfd57('0x2d')]['filter']){_0xa6e0fb[_0xfd57('0x36')]=_[_0xfd57('0x38')](_0xa6e0fb[_0xfd57('0x36')],{'$or':_['map'](_0x485116,function(_0x1bc8ab){if(_0x1bc8ab[_0xfd57('0x2a')]!==_0xfd57('0x39')){var _0xd43e72={};_0xd43e72[_0x1bc8ab['name']]={'$like':'%'+_0x2555a6[_0xfd57('0x2d')][_0xfd57('0x3a')]+'%'};return _0xd43e72;}})});}_0xa6e0fb=_[_0xfd57('0x38')]({},_0xa6e0fb,_0x2555a6[_0xfd57('0x3b')]);var _0x3a0d57={'where':_0xa6e0fb[_0xfd57('0x36')]};return db[_0xfd57('0x28')][_0xfd57('0x19')](_0x3a0d57)[_0xfd57('0x1f')](function(_0x2a1334){_0x591254[_0xfd57('0x19')]=_0x2a1334;if(_0x2555a6[_0xfd57('0x2d')][_0xfd57('0x3c')]){_0xa6e0fb[_0xfd57('0x3d')]=[{'all':!![]}];}return db[_0xfd57('0x28')]['findAll'](_0xa6e0fb);})['then'](function(_0x23c803){_0x591254[_0xfd57('0x3e')]=_0x23c803;return _0x591254;})[_0xfd57('0x1f')](respondWithFilteredResult(_0x43baca,_0xa6e0fb))[_0xfd57('0x3f')](handleError(_0x43baca,null));};exports[_0xfd57('0x40')]=function(_0x25b3a7,_0x4206b1){var _0x46194d={'raw':!![],'where':{'id':_0x25b3a7[_0xfd57('0x41')]['id']}},_0x8cdcc0={};_0x8cdcc0[_0xfd57('0x2c')]=_[_0xfd57('0x42')](db[_0xfd57('0x28')]['rawAttributes']);_0x8cdcc0['query']=_[_0xfd57('0x42')](_0x25b3a7['query']);_0x8cdcc0[_0xfd57('0x2e')]=_[_0xfd57('0x2f')](_0x8cdcc0[_0xfd57('0x2c')],_0x8cdcc0[_0xfd57('0x2d')]);_0x46194d[_0xfd57('0x30')]=_[_0xfd57('0x2f')](_0x8cdcc0[_0xfd57('0x2c')],qs['fields'](_0x25b3a7[_0xfd57('0x2d')][_0xfd57('0x31')]));_0x46194d[_0xfd57('0x30')]=_0x46194d[_0xfd57('0x30')][_0xfd57('0x32')]?_0x46194d[_0xfd57('0x30')]:_0x8cdcc0['model'];if(_0x25b3a7[_0xfd57('0x2d')][_0xfd57('0x3c')]){_0x46194d[_0xfd57('0x3d')]=[{'all':!![]}];}_0x46194d=_['merge']({},_0x46194d,_0x25b3a7['options']);return db[_0xfd57('0x28')][_0xfd57('0x43')](_0x46194d)['then'](handleEntityNotFound(_0x4206b1,null))['then'](respondWithResult(_0x4206b1,null))[_0xfd57('0x3f')](handleError(_0x4206b1,null));};exports[_0xfd57('0x44')]=function(_0x19c08d,_0x26a7c4){return db['OpenchannelApplication'][_0xfd57('0x44')](_0x19c08d[_0xfd57('0x45')],{})[_0xfd57('0x1f')](respondWithResult(_0x26a7c4,0xc9))['catch'](handleError(_0x26a7c4,null));};exports[_0xfd57('0x46')]=function(_0x13b919,_0x37747f){if(_0x13b919[_0xfd57('0x45')]['id']){delete _0x13b919[_0xfd57('0x45')]['id'];}return db['OpenchannelApplication'][_0xfd57('0x43')]({'where':{'id':_0x13b919[_0xfd57('0x41')]['id']}})[_0xfd57('0x1f')](handleEntityNotFound(_0x37747f,null))[_0xfd57('0x1f')](saveUpdates(_0x13b919['body'],null))[_0xfd57('0x1f')](respondWithResult(_0x37747f,null))['catch'](handleError(_0x37747f,null));};exports[_0xfd57('0x20')]=function(_0x557f97,_0x3243ef){return db['OpenchannelApplication'][_0xfd57('0x43')]({'where':{'id':_0x557f97['params']['id']}})[_0xfd57('0x1f')](handleEntityNotFound(_0x3243ef,null))[_0xfd57('0x1f')](removeEntity(_0x3243ef,null))[_0xfd57('0x3f')](handleError(_0x3243ef,null));}; \ No newline at end of file +var _0x720f=['hasOwnProperty','nolimit','sort','where','filter','merge','options','OpenchannelApplication','includeAll','findAll','rows','show','fields','include','catch','create','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','query','intersection','attributes','length'];(function(_0xe075e8,_0x4fe11a){var _0x240582=function(_0xdf5765){while(--_0xdf5765){_0xe075e8['push'](_0xe075e8['shift']());}};_0x240582(++_0x4fe11a);}(_0x720f,0x13b));var _0xf720=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x720f[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0xf720('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf720('0x1'));var rp=require(_0xf720('0x2'));var moment=require(_0xf720('0x3'));var BPromise=require(_0xf720('0x4'));var Mustache=require(_0xf720('0x5'));var util=require(_0xf720('0x6'));var path=require('path');var sox=require(_0xf720('0x7'));var csv=require(_0xf720('0x8'));var ejs=require(_0xf720('0x9'));var fs=require('fs');var fs_extra=require(_0xf720('0xa'));var _=require(_0xf720('0xb'));var squel=require('squel');var crypto=require(_0xf720('0xc'));var jsforce=require(_0xf720('0xd'));var deskjs=require(_0xf720('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf720('0xf'));var Papa=require('papaparse');var Redis=require(_0xf720('0x10'));var authService=require(_0xf720('0x11'));var qs=require(_0xf720('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf720('0x13'))(_0xf720('0x14'));var utils=require(_0xf720('0x15'));var config=require(_0xf720('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf720('0x17'))['db'];function respondWithStatusCode(_0x1ffdd9,_0x41afd0){_0x41afd0=_0x41afd0||0xcc;return function(_0x33f369){if(_0x33f369){return _0x1ffdd9[_0xf720('0x18')](_0x41afd0);}return _0x1ffdd9[_0xf720('0x19')](_0x41afd0)['end']();};}function respondWithResult(_0x1be1af,_0x1e3652){_0x1e3652=_0x1e3652||0xc8;return function(_0xe573b9){if(_0xe573b9){return _0x1be1af['status'](_0x1e3652)[_0xf720('0x1a')](_0xe573b9);}};}function respondWithFilteredResult(_0x2f3d71,_0x2ad2db){return function(_0x1d3b7f){if(_0x1d3b7f){var _0xced92=typeof _0x2ad2db[_0xf720('0x1b')]===_0xf720('0x1c')&&typeof _0x2ad2db[_0xf720('0x1d')]==='undefined';var _0x1feba5=_0x1d3b7f[_0xf720('0x1e')];var _0x174841=_0xced92?0x0:_0x2ad2db['offset'];var _0xef4793=_0xced92?_0x1d3b7f[_0xf720('0x1e')]:_0x2ad2db[_0xf720('0x1b')]+_0x2ad2db[_0xf720('0x1d')];var _0x53c75d;if(_0xef4793>=_0x1feba5){_0xef4793=_0x1feba5;_0x53c75d=0xc8;}else{_0x53c75d=0xce;}_0x2f3d71[_0xf720('0x19')](_0x53c75d);return _0x2f3d71[_0xf720('0x1f')](_0xf720('0x20'),_0x174841+'-'+_0xef4793+'/'+_0x1feba5)[_0xf720('0x1a')](_0x1d3b7f);}return null;};}function patchUpdates(_0x26fa26){return function(_0x2a9388){try{jsonpatch['apply'](_0x2a9388,_0x26fa26,!![]);}catch(_0x490344){return BPromise[_0xf720('0x21')](_0x490344);}return _0x2a9388[_0xf720('0x22')]();};}function saveUpdates(_0x176d49,_0x57e18b){return function(_0x5a49bd){if(_0x5a49bd){return _0x5a49bd[_0xf720('0x23')](_0x176d49)[_0xf720('0x24')](function(_0x26993d){return _0x26993d;});}return null;};}function removeEntity(_0x14bab4,_0x5471a0){return function(_0xbcd26a){if(_0xbcd26a){return _0xbcd26a[_0xf720('0x25')]()[_0xf720('0x24')](function(){_0x14bab4[_0xf720('0x19')](0xcc)[_0xf720('0x26')]();});}};}function handleEntityNotFound(_0x1972b9,_0x5b1e4a){return function(_0x4cd164){if(!_0x4cd164){_0x1972b9[_0xf720('0x18')](0x194);}return _0x4cd164;};}function handleError(_0x21820a,_0x5059ee){_0x5059ee=_0x5059ee||0x1f4;return function(_0x4f1d1d){logger[_0xf720('0x27')](_0x4f1d1d[_0xf720('0x28')]);if(_0x4f1d1d[_0xf720('0x29')]){delete _0x4f1d1d['name'];}_0x21820a[_0xf720('0x19')](_0x5059ee)[_0xf720('0x2a')](_0x4f1d1d);};}exports[_0xf720('0x2b')]=function(_0x333f00,_0xf42fe2){var _0x5c8428={},_0x5aa116={},_0x5f335e={'count':0x0,'rows':[]};var _0x5243ef=_[_0xf720('0x2c')](db['OpenchannelApplication'][_0xf720('0x2d')],function(_0xd1ecfc){return{'name':_0xd1ecfc['fieldName'],'type':_0xd1ecfc[_0xf720('0x2e')][_0xf720('0x2f')]};});_0x5aa116[_0xf720('0x30')]=_[_0xf720('0x2c')](_0x5243ef,_0xf720('0x29'));_0x5aa116['query']=_[_0xf720('0x31')](_0x333f00['query']);_0x5aa116[_0xf720('0x32')]=_['intersection'](_0x5aa116[_0xf720('0x30')],_0x5aa116[_0xf720('0x33')]);_0x5c8428['attributes']=_[_0xf720('0x34')](_0x5aa116['model'],qs['fields'](_0x333f00['query']['fields']));_0x5c8428[_0xf720('0x35')]=_0x5c8428[_0xf720('0x35')][_0xf720('0x36')]?_0x5c8428[_0xf720('0x35')]:_0x5aa116[_0xf720('0x30')];if(!_0x333f00[_0xf720('0x33')][_0xf720('0x37')](_0xf720('0x38'))){_0x5c8428[_0xf720('0x1d')]=qs[_0xf720('0x1d')](_0x333f00[_0xf720('0x33')][_0xf720('0x1d')]);_0x5c8428['offset']=qs[_0xf720('0x1b')](_0x333f00['query'][_0xf720('0x1b')]);}_0x5c8428['order']=qs[_0xf720('0x39')](_0x333f00[_0xf720('0x33')]['sort']);_0x5c8428[_0xf720('0x3a')]=qs[_0xf720('0x32')](_['pick'](_0x333f00['query'],_0x5aa116[_0xf720('0x32')]),_0x5243ef);if(_0x333f00['query'][_0xf720('0x3b')]){_0x5c8428[_0xf720('0x3a')]=_[_0xf720('0x3c')](_0x5c8428[_0xf720('0x3a')],{'$or':_[_0xf720('0x2c')](_0x5243ef,function(_0x1bc3c1){if(_0x1bc3c1[_0xf720('0x2e')]!=='VIRTUAL'){var _0x3a5d2c={};_0x3a5d2c[_0x1bc3c1[_0xf720('0x29')]]={'$like':'%'+_0x333f00[_0xf720('0x33')][_0xf720('0x3b')]+'%'};return _0x3a5d2c;}})});}_0x5c8428=_[_0xf720('0x3c')]({},_0x5c8428,_0x333f00[_0xf720('0x3d')]);var _0x2b43f0={'where':_0x5c8428[_0xf720('0x3a')]};return db[_0xf720('0x3e')]['count'](_0x2b43f0)[_0xf720('0x24')](function(_0x4d1095){_0x5f335e[_0xf720('0x1e')]=_0x4d1095;if(_0x333f00[_0xf720('0x33')][_0xf720('0x3f')]){_0x5c8428['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf720('0x40')](_0x5c8428);})['then'](function(_0x1319c5){_0x5f335e[_0xf720('0x41')]=_0x1319c5;return _0x5f335e;})[_0xf720('0x24')](respondWithFilteredResult(_0xf42fe2,_0x5c8428))['catch'](handleError(_0xf42fe2,null));};exports[_0xf720('0x42')]=function(_0x1cce91,_0x3360a6){var _0x129c1b={'raw':!![],'where':{'id':_0x1cce91['params']['id']}},_0x3f6c6e={};_0x3f6c6e[_0xf720('0x30')]=_[_0xf720('0x31')](db[_0xf720('0x3e')][_0xf720('0x2d')]);_0x3f6c6e['query']=_[_0xf720('0x31')](_0x1cce91[_0xf720('0x33')]);_0x3f6c6e[_0xf720('0x32')]=_[_0xf720('0x34')](_0x3f6c6e[_0xf720('0x30')],_0x3f6c6e['query']);_0x129c1b['attributes']=_['intersection'](_0x3f6c6e[_0xf720('0x30')],qs[_0xf720('0x43')](_0x1cce91['query'][_0xf720('0x43')]));_0x129c1b[_0xf720('0x35')]=_0x129c1b[_0xf720('0x35')][_0xf720('0x36')]?_0x129c1b[_0xf720('0x35')]:_0x3f6c6e['model'];if(_0x1cce91['query'][_0xf720('0x3f')]){_0x129c1b[_0xf720('0x44')]=[{'all':!![]}];}_0x129c1b=_[_0xf720('0x3c')]({},_0x129c1b,_0x1cce91[_0xf720('0x3d')]);return db[_0xf720('0x3e')]['find'](_0x129c1b)[_0xf720('0x24')](handleEntityNotFound(_0x3360a6,null))[_0xf720('0x24')](respondWithResult(_0x3360a6,null))[_0xf720('0x45')](handleError(_0x3360a6,null));};exports['create']=function(_0x1b7f65,_0x4e3232){return db[_0xf720('0x3e')][_0xf720('0x46')](_0x1b7f65[_0xf720('0x47')],{})[_0xf720('0x24')](respondWithResult(_0x4e3232,0xc9))[_0xf720('0x45')](handleError(_0x4e3232,null));};exports[_0xf720('0x23')]=function(_0x48cb42,_0x522c56){if(_0x48cb42['body']['id']){delete _0x48cb42['body']['id'];}return db[_0xf720('0x3e')][_0xf720('0x48')]({'where':{'id':_0x48cb42[_0xf720('0x49')]['id']}})[_0xf720('0x24')](handleEntityNotFound(_0x522c56,null))[_0xf720('0x24')](saveUpdates(_0x48cb42[_0xf720('0x47')],null))['then'](respondWithResult(_0x522c56,null))[_0xf720('0x45')](handleError(_0x522c56,null));};exports[_0xf720('0x25')]=function(_0x3e7cc9,_0xc99381){return db['OpenchannelApplication'][_0xf720('0x48')]({'where':{'id':_0x3e7cc9[_0xf720('0x49')]['id']}})[_0xf720('0x24')](handleEntityNotFound(_0xc99381,null))[_0xf720('0x24')](removeEntity(_0xc99381,null))['catch'](handleError(_0xc99381,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1f37ef2..fe323a0 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 _0x92c5=['request-promise','path','rimraf','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x201b6e,_0x1452f5){var _0x35d54c=function(_0x1f291d){while(--_0x1f291d){_0x201b6e['push'](_0x201b6e['shift']());}};_0x35d54c(++_0x1452f5);}(_0x92c5,0x1a9));var _0x592c=function(_0x309bc8,_0x117ddc){_0x309bc8=_0x309bc8-0x0;var _0x4bd9e9=_0x92c5[_0x309bc8];return _0x4bd9e9;};'use strict';var _=require(_0x592c('0x0'));var util=require('util');var logger=require(_0x592c('0x1'))(_0x592c('0x2'));var moment=require(_0x592c('0x3'));var BPromise=require('bluebird');var rp=require(_0x592c('0x4'));var fs=require('fs');var path=require(_0x592c('0x5'));var rimraf=require(_0x592c('0x6'));var config=require('../../config/environment');var attributes=require(_0x592c('0x7'));module['exports']=function(_0x245931,_0x10b8be){return _0x245931['define'](_0x592c('0x8'),attributes,{'tableName':_0x592c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x592c('0xa')});}; \ No newline at end of file +var _0xb56c=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2eb35d,_0x4a7a45){var _0x1f9854=function(_0x5eb6f9){while(--_0x5eb6f9){_0x2eb35d['push'](_0x2eb35d['shift']());}};_0x1f9854(++_0x4a7a45);}(_0xb56c,0x94));var _0xcb56=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0xb56c[_0x2ecb67];return _0x168079;};'use strict';var _=require(_0xcb56('0x0'));var util=require(_0xcb56('0x1'));var logger=require(_0xcb56('0x2'))(_0xcb56('0x3'));var moment=require(_0xcb56('0x4'));var BPromise=require(_0xcb56('0x5'));var rp=require(_0xcb56('0x6'));var fs=require('fs');var path=require(_0xcb56('0x7'));var rimraf=require(_0xcb56('0x8'));var config=require(_0xcb56('0x9'));var attributes=require(_0xcb56('0xa'));module[_0xcb56('0xb')]=function(_0x4afc55,_0x4206e4){return _0x4afc55[_0xcb56('0xc')](_0xcb56('0xd'),attributes,{'tableName':_0xcb56('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb56('0xf'),'collate':_0xcb56('0x10')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ceda664..d559df9 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 _0xeee2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','lodash'];(function(_0x250a70,_0x501d75){var _0x1d99b6=function(_0x5c30b4){while(--_0x5c30b4){_0x250a70['push'](_0x250a70['shift']());}};_0x1d99b6(++_0x501d75);}(_0xeee2,0x11f));var _0x2eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2eee('0x0'));var util=require('util');var moment=require(_0x2eee('0x1'));var BPromise=require(_0x2eee('0x2'));var rs=require(_0x2eee('0x3'));var fs=require('fs');var Redis=require(_0x2eee('0x4'));var db=require(_0x2eee('0x5'))['db'];var utils=require(_0x2eee('0x6'));var logger=require(_0x2eee('0x7'))('rpc');var config=require(_0x2eee('0x8'));var jayson=require(_0x2eee('0x9'));var client=jayson[_0x2eee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c75e3,_0x48c0c6,_0x57206d){return new BPromise(function(_0x419ae2,_0x156705){return client[_0x2eee('0xb')](_0x2c75e3,_0x57206d)[_0x2eee('0xc')](function(_0x59989a){logger[_0x2eee('0xd')](_0x2eee('0xe'),_0x48c0c6,_0x2eee('0xf'));logger[_0x2eee('0x10')](_0x2eee('0x11'),_0x48c0c6,_0x2eee('0xf'),JSON[_0x2eee('0x12')](_0x59989a));if(_0x59989a[_0x2eee('0x13')]){if(_0x59989a['error'][_0x2eee('0x14')]===0x1f4){logger[_0x2eee('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x48c0c6,_0x59989a[_0x2eee('0x13')][_0x2eee('0x15')]);return _0x156705(_0x59989a[_0x2eee('0x13')][_0x2eee('0x15')]);}logger[_0x2eee('0x13')](_0x2eee('0xe'),_0x48c0c6,_0x59989a[_0x2eee('0x13')][_0x2eee('0x15')]);return _0x419ae2(_0x59989a[_0x2eee('0x13')]['message']);}else{logger[_0x2eee('0xd')](_0x2eee('0xe'),_0x48c0c6,'request\x20sent');_0x419ae2(_0x59989a[_0x2eee('0x16')][_0x2eee('0x15')]);}})[_0x2eee('0x17')](function(_0x73a159){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x48c0c6,_0x73a159);_0x156705(_0x73a159);});});}exports[_0x2eee('0x18')]=function(_0x2b8e91){var _0x5bf368=this;return new Promise(function(_0xa0f8ed,_0x1408a2){return db[_0x2eee('0x19')][_0x2eee('0x1a')](_0x2b8e91['body'],{'raw':_0x2b8e91[_0x2eee('0x1b')]?_0x2b8e91['options'][_0x2eee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b8e91[_0x2eee('0x1b')]?_0x2b8e91[_0x2eee('0x1b')][_0x2eee('0x1d')]||null:null,'attributes':_0x2b8e91[_0x2eee('0x1b')]?_0x2b8e91[_0x2eee('0x1b')][_0x2eee('0x1e')]||null:null,'limit':_0x2b8e91[_0x2eee('0x1b')]?_0x2b8e91[_0x2eee('0x1b')][_0x2eee('0x1f')]||null:null})['then'](function(_0x4ef5ba){logger[_0x2eee('0xd')](_0x2eee('0x18'),_0x2b8e91);logger['debug']('UpdateOpenchannelApplication',_0x2b8e91,JSON['stringify'](_0x4ef5ba));_0xa0f8ed(_0x4ef5ba);})[_0x2eee('0x17')](function(_0x19c91d){logger[_0x2eee('0x13')]('UpdateOpenchannelApplication',_0x19c91d[_0x2eee('0x15')],_0x2b8e91);_0x1408a2(_0x5bf368[_0x2eee('0x13')](0x1f4,_0x19c91d['message']));});});}; \ No newline at end of file +var _0xf9d5=['code','error','message','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0xf9d5,0x1e0));var _0x5f9d=function(_0x4bc873,_0x2e2c33){_0x4bc873=_0x4bc873-0x0;var _0x1faa4e=_0xf9d5[_0x4bc873];return _0x1faa4e;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var moment=require(_0x5f9d('0x1'));var BPromise=require(_0x5f9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f9d('0x3'));var db=require(_0x5f9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f9d('0x5'))(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var jayson=require(_0x5f9d('0x8'));var client=jayson[_0x5f9d('0x9')][_0x5f9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29f40d,_0xe5b654,_0x2ad682){return new BPromise(function(_0x2c3152,_0x10047d){return client[_0x5f9d('0xb')](_0x29f40d,_0x2ad682)['then'](function(_0x1a4f7c){logger[_0x5f9d('0xc')](_0x5f9d('0xd'),_0xe5b654,_0x5f9d('0xe'));logger[_0x5f9d('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xe5b654,_0x5f9d('0xe'),JSON['stringify'](_0x1a4f7c));if(_0x1a4f7c['error']){if(_0x1a4f7c['error'][_0x5f9d('0x10')]===0x1f4){logger[_0x5f9d('0x11')](_0x5f9d('0xd'),_0xe5b654,_0x1a4f7c[_0x5f9d('0x11')][_0x5f9d('0x12')]);return _0x10047d(_0x1a4f7c[_0x5f9d('0x11')][_0x5f9d('0x12')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xe5b654,_0x1a4f7c['error'][_0x5f9d('0x12')]);return _0x2c3152(_0x1a4f7c[_0x5f9d('0x11')][_0x5f9d('0x12')]);}else{logger[_0x5f9d('0xc')](_0x5f9d('0xd'),_0xe5b654,_0x5f9d('0xe'));_0x2c3152(_0x1a4f7c[_0x5f9d('0x13')]['message']);}})[_0x5f9d('0x14')](function(_0x58852c){logger[_0x5f9d('0x11')](_0x5f9d('0xd'),_0xe5b654,_0x58852c);_0x10047d(_0x58852c);});});}exports['UpdateOpenchannelApplication']=function(_0x3f79a0){var _0xb40727=this;return new Promise(function(_0x4ee6b1,_0x102b26){return db[_0x5f9d('0x15')][_0x5f9d('0x16')](_0x3f79a0[_0x5f9d('0x17')],{'raw':_0x3f79a0[_0x5f9d('0x18')]?_0x3f79a0[_0x5f9d('0x18')][_0x5f9d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f79a0[_0x5f9d('0x18')]?_0x3f79a0[_0x5f9d('0x18')][_0x5f9d('0x1a')]||null:null,'attributes':_0x3f79a0[_0x5f9d('0x18')]?_0x3f79a0[_0x5f9d('0x18')][_0x5f9d('0x1b')]||null:null,'limit':_0x3f79a0['options']?_0x3f79a0[_0x5f9d('0x18')][_0x5f9d('0x1c')]||null:null})['then'](function(_0x234abe){logger[_0x5f9d('0xc')](_0x5f9d('0x1d'),_0x3f79a0);logger[_0x5f9d('0xf')](_0x5f9d('0x1d'),_0x3f79a0,JSON[_0x5f9d('0x1e')](_0x234abe));_0x4ee6b1(_0x234abe);})[_0x5f9d('0x14')](function(_0x145fa2){logger['error'](_0x5f9d('0x1d'),_0x145fa2[_0x5f9d('0x12')],_0x3f79a0);_0x102b26(_0xb40727[_0x5f9d('0x11')](0x1f4,_0x145fa2[_0x5f9d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 53c9a7d..05cffea 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 _0x40bb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router'];(function(_0x17bfc6,_0x57be27){var _0x19fedc=function(_0xafea29){while(--_0xafea29){_0x17bfc6['push'](_0x17bfc6['shift']());}};_0x19fedc(++_0x57be27);}(_0x40bb,0x12d));var _0xb40b=function(_0x42e9d9,_0x1da4f6){_0x42e9d9=_0x42e9d9-0x0;var _0x59c3e4=_0x40bb[_0x42e9d9];return _0x59c3e4;};'use strict';var multer=require('multer');var util=require(_0xb40b('0x0'));var path=require(_0xb40b('0x1'));var timeout=require(_0xb40b('0x2'));var express=require(_0xb40b('0x3'));var router=express[_0xb40b('0x4')]();var fs_extra=require(_0xb40b('0x5'));var auth=require(_0xb40b('0x6'));var interaction=require(_0xb40b('0x7'));var config=require(_0xb40b('0x8'));var controller=require(_0xb40b('0x9'));router[_0xb40b('0xa')]('/',auth[_0xb40b('0xb')](),controller[_0xb40b('0xc')]);router[_0xb40b('0xa')](_0xb40b('0xd'),auth['isAuthenticated'](),controller[_0xb40b('0xe')]);router[_0xb40b('0xa')](_0xb40b('0xf'),auth['isAuthenticated'](),controller[_0xb40b('0x10')]);router['get'](_0xb40b('0x11'),auth[_0xb40b('0xb')](),controller[_0xb40b('0x12')]);router[_0xb40b('0xa')](_0xb40b('0x13'),auth[_0xb40b('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xb40b('0x14')]);router[_0xb40b('0x15')](_0xb40b('0x11'),auth[_0xb40b('0xb')](),controller[_0xb40b('0x16')]);router['post'](_0xb40b('0x17'),auth[_0xb40b('0xb')](),interaction[_0xb40b('0x18')]('openchannel',_0xb40b('0x19')),controller[_0xb40b('0x1a')]);router['put'](_0xb40b('0xf'),auth[_0xb40b('0xb')](),interaction[_0xb40b('0x18')](_0xb40b('0x1b'),'openchannelinteraction:update'),controller[_0xb40b('0x1c')]);router[_0xb40b('0x1d')](_0xb40b('0xf'),auth[_0xb40b('0xb')](),interaction[_0xb40b('0x18')](_0xb40b('0x1b'),_0xb40b('0x1e')),controller[_0xb40b('0x1f')]);router['delete'](_0xb40b('0x17'),auth[_0xb40b('0xb')](),controller[_0xb40b('0x20')]);module[_0xb40b('0x21')]=router; \ No newline at end of file +var _0xf7ad=['download','post','addMessage','tracked','openchannel','put','update','delete','destroy','/:id/tags','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x30198a,_0x4a4407){var _0x127066=function(_0x3650ec){while(--_0x3650ec){_0x30198a['push'](_0x30198a['shift']());}};_0x127066(++_0x4a4407);}(_0xf7ad,0x107));var _0xdf7a=function(_0x5073e6,_0x56b79d){_0x5073e6=_0x5073e6-0x0;var _0x247776=_0xf7ad[_0x5073e6];return _0x247776;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf7a('0x0'));var timeout=require(_0xdf7a('0x1'));var express=require(_0xdf7a('0x2'));var router=express[_0xdf7a('0x3')]();var fs_extra=require(_0xdf7a('0x4'));var auth=require(_0xdf7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdf7a('0x6'));var controller=require(_0xdf7a('0x7'));router['get']('/',auth[_0xdf7a('0x8')](),controller['index']);router[_0xdf7a('0x9')](_0xdf7a('0xa'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xb')]);router['get'](_0xdf7a('0xc'),auth['isAuthenticated'](),controller[_0xdf7a('0xd')]);router['get'](_0xdf7a('0xe'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0xf')]);router[_0xdf7a('0x9')](_0xdf7a('0x10'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdf7a('0x12')](_0xdf7a('0xe'),auth[_0xdf7a('0x8')](),controller[_0xdf7a('0x13')]);router[_0xdf7a('0x12')]('/:id/tags',auth[_0xdf7a('0x8')](),interaction[_0xdf7a('0x14')](_0xdf7a('0x15'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xdf7a('0x16')](_0xdf7a('0xc'),auth[_0xdf7a('0x8')](),interaction['tracked'](_0xdf7a('0x15'),'openchannelinteraction:update'),controller[_0xdf7a('0x17')]);router[_0xdf7a('0x18')](_0xdf7a('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xdf7a('0x15'),'openchannelinteraction:destroy'),controller[_0xdf7a('0x19')]);router[_0xdf7a('0x18')](_0xdf7a('0x1a'),auth['isAuthenticated'](),controller[_0xdf7a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 79b9589..b70ef39 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 _0xc234=['DATE','out','exports','BOOLEAN','STRING'];(function(_0x5123a7,_0x2e10c9){var _0x21688b=function(_0x22fda6){while(--_0x22fda6){_0x5123a7['push'](_0x5123a7['shift']());}};_0x21688b(++_0x2e10c9);}(_0xc234,0x7f));var _0x4c23=function(_0x2222d9,_0x3293ff){_0x2222d9=_0x2222d9-0x0;var _0x3e08e3=_0xc234[_0x2222d9];return _0x3e08e3;};'use strict';var Sequelize=require('sequelize');module[_0x4c23('0x0')]={'closed':{'type':Sequelize[_0x4c23('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4c23('0x2')]},'secondDisposition':{'type':Sequelize[_0x4c23('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4c23('0x2')]},'note':{'type':Sequelize[_0x4c23('0x2')]},'read1stAt':{'type':Sequelize[_0x4c23('0x3')]},'threadId':{'type':Sequelize[_0x4c23('0x2')]},'externalUrl':{'type':Sequelize[_0x4c23('0x2')]},'lastMsgAt':{'type':Sequelize[_0x4c23('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4c23('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4c23('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4c23('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x4c23('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2d6d=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x236374,_0x1c10c0){var _0x3fdd32=function(_0x49afe0){while(--_0x49afe0){_0x236374['push'](_0x236374['shift']());}};_0x3fdd32(++_0x1c10c0);}(_0x2d6d,0x66));var _0xd2d6=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x2d6d[_0x99facc];return _0xd39ed0;};'use strict';var Sequelize=require(_0xd2d6('0x0'));module[_0xd2d6('0x1')]={'closed':{'type':Sequelize[_0xd2d6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd2d6('0x3')]},'disposition':{'type':Sequelize[_0xd2d6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd2d6('0x4')]},'read1stAt':{'type':Sequelize[_0xd2d6('0x3')]},'threadId':{'type':Sequelize[_0xd2d6('0x4')]},'externalUrl':{'type':Sequelize[_0xd2d6('0x4')]},'lastMsgAt':{'type':Sequelize[_0xd2d6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd2d6('0x5')]('in',_0xd2d6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd2d6('0x5')]('in',_0xd2d6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xd2d6('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b8f7ab0..9e8492f 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 _0xcc6f=['destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','keys','intersection','attributes','model','fields','includeAll','include','options','catch','create','body','find','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','filters','length','hasOwnProperty','limit','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','unix','toString','join','root','server','files','attachments','format','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','User','get','Openchannel','Account','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','undefined','count','set','Content-Range','update','then'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0xcc6f,0x69));var _0xfcc6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xcc6f[_0x422905];return _0x33dc6c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xfcc6('0x0'));var moment=require(_0xfcc6('0x1'));var util=require(_0xfcc6('0x2'));var path=require(_0xfcc6('0x3'));var ejs=require(_0xfcc6('0x4'));var fs=require('fs');var _=require(_0xfcc6('0x5'));var Redis=require(_0xfcc6('0x6'));var interaction=require(_0xfcc6('0x7'));var qs=require(_0xfcc6('0x8'));var pdf=require(_0xfcc6('0x9'));var logger=require(_0xfcc6('0xa'))(_0xfcc6('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xfcc6('0xc')]=_[_0xfcc6('0xd')](config[_0xfcc6('0xc')],{'host':_0xfcc6('0xe'),'port':0x18eb});var socket=require(_0xfcc6('0xf'))(new Redis(config[_0xfcc6('0xc')]));require(_0xfcc6('0x10'))[_0xfcc6('0x11')](socket);function respondWithStatusCode(_0x5932d7,_0x57be5d){_0x57be5d=_0x57be5d||0xcc;return function(_0x29f241){if(_0x29f241){return _0x5932d7['sendStatus'](_0x57be5d);}return _0x5932d7['status'](_0x57be5d)[_0xfcc6('0x12')]();};}function respondWithResult(_0x2f8000,_0x4825e8){_0x4825e8=_0x4825e8||0xc8;return function(_0x1459c3){if(_0x1459c3){return _0x2f8000[_0xfcc6('0x13')](_0x4825e8)[_0xfcc6('0x14')](_0x1459c3);}};}function respondWithFilteredResult(_0x522f25,_0x3e2375){return function(_0x28f93b){if(_0x28f93b){var _0x2667c9=typeof _0x3e2375[_0xfcc6('0x15')]===_0xfcc6('0x16')&&typeof _0x3e2375['limit']==='undefined';var _0x4f7af4=_0x28f93b[_0xfcc6('0x17')];var _0x4e9c2c=_0x2667c9?0x0:_0x3e2375[_0xfcc6('0x15')];var _0x6cb11d=_0x2667c9?_0x28f93b[_0xfcc6('0x17')]:_0x3e2375['offset']+_0x3e2375['limit'];var _0x5be8a5;if(_0x6cb11d>=_0x4f7af4){_0x6cb11d=_0x4f7af4;_0x5be8a5=0xc8;}else{_0x5be8a5=0xce;}_0x522f25[_0xfcc6('0x13')](_0x5be8a5);return _0x522f25[_0xfcc6('0x18')](_0xfcc6('0x19'),_0x4e9c2c+'-'+_0x6cb11d+'/'+_0x4f7af4)[_0xfcc6('0x14')](_0x28f93b);}return null;};}function saveUpdates(_0x509d4c){return function(_0x567aac){if(_0x567aac){return _0x567aac[_0xfcc6('0x1a')](_0x509d4c)[_0xfcc6('0x1b')](function(_0x2e7714){return _0x2e7714;});}return null;};}function removeEntity(_0xf70c37){return function(_0x2023af){if(_0x2023af){return _0x2023af[_0xfcc6('0x1c')]()[_0xfcc6('0x1b')](function(){_0xf70c37[_0xfcc6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12c310){return function(_0x5045d6){if(!_0x5045d6){_0x12c310['sendStatus'](0x194);}return _0x5045d6;};}function handleError(_0x38f80b,_0x5e3499){_0x5e3499=_0x5e3499||0x1f4;return function(_0x4a2a3c){logger[_0xfcc6('0x1d')](_0x4a2a3c[_0xfcc6('0x1e')]);if(_0x4a2a3c[_0xfcc6('0x1f')]){delete _0x4a2a3c[_0xfcc6('0x1f')];}_0x38f80b[_0xfcc6('0x13')](_0x5e3499)[_0xfcc6('0x20')](_0x4a2a3c);};}exports[_0xfcc6('0x21')]=function(_0x23347c,_0x52af7c){var _0x295c34={};var _0x3bfdab=_[_0xfcc6('0x22')](db[_0xfcc6('0x23')][_0xfcc6('0x24')],function(_0x2ddb4c){return{'name':_0x2ddb4c[_0xfcc6('0x25')],'type':_0x2ddb4c[_0xfcc6('0x26')][_0xfcc6('0x27')]};});_0x295c34=qs[_0xfcc6('0x28')](_0x3bfdab,_0x23347c);return interaction[_0xfcc6('0x29')](_0xfcc6('0x2a'),_0x23347c[_0xfcc6('0x2b')],_0x23347c[_0xfcc6('0x2c')],_0x295c34,_0x3bfdab)[_0xfcc6('0x1b')](respondWithFilteredResult(_0x52af7c,_0x295c34))['catch'](handleError(_0x52af7c,null));};exports[_0xfcc6('0x2d')]=function(_0x2c3424,_0x406b32){var _0xd01b51={};if(_0x2c3424[_0xfcc6('0x2b')][_0xfcc6('0x26')]&&_0x2c3424[_0xfcc6('0x2b')][_0xfcc6('0x26')]===_0xfcc6('0x2e')){_0xd01b51['from']=_0x2c3424[_0xfcc6('0x2f')]['id'];}else{_0xd01b51['id']=_0x2c3424[_0xfcc6('0x2f')]['id'];}var _0x222c4a={'raw':![],'where':_0xd01b51},_0x36cc35={};_0x36cc35['model']=_[_0xfcc6('0x30')](db[_0xfcc6('0x23')][_0xfcc6('0x24')]);_0x36cc35[_0xfcc6('0x2b')]=_['keys'](_0x2c3424['query']);_0x36cc35['filters']=_[_0xfcc6('0x31')](_0x36cc35['model'],_0x36cc35[_0xfcc6('0x2b')]);_0x222c4a[_0xfcc6('0x32')]=_[_0xfcc6('0x31')](_0x36cc35[_0xfcc6('0x33')],qs[_0xfcc6('0x34')](_0x2c3424[_0xfcc6('0x2b')][_0xfcc6('0x34')]));_0x222c4a[_0xfcc6('0x32')]=_0x222c4a[_0xfcc6('0x32')]['length']?_0x222c4a[_0xfcc6('0x32')]:_0x36cc35['model'];if(_0x2c3424[_0xfcc6('0x2b')][_0xfcc6('0x35')]){_0x222c4a[_0xfcc6('0x36')]=[{'all':!![]}];}_0x222c4a=_['merge']({},_0x222c4a,_0x2c3424[_0xfcc6('0x37')]);return db[_0xfcc6('0x23')]['find'](_0x222c4a)[_0xfcc6('0x1b')](handleEntityNotFound(_0x406b32,null))[_0xfcc6('0x1b')](respondWithResult(_0x406b32,null))[_0xfcc6('0x38')](handleError(_0x406b32,null));};exports['create']=function(_0x3295b0,_0x635cdd){return db[_0xfcc6('0x23')][_0xfcc6('0x39')](_0x3295b0['body'],{})[_0xfcc6('0x1b')](respondWithResult(_0x635cdd,0xc9))[_0xfcc6('0x38')](handleError(_0x635cdd,null));};exports[_0xfcc6('0x1a')]=function(_0x1fd527,_0x1ffdd2){if(_0x1fd527[_0xfcc6('0x3a')]['id']){delete _0x1fd527[_0xfcc6('0x3a')]['id'];}return db[_0xfcc6('0x23')]['find']({'where':{'id':_0x1fd527[_0xfcc6('0x2f')]['id']}})[_0xfcc6('0x1b')](handleEntityNotFound(_0x1ffdd2,null))[_0xfcc6('0x1b')](saveUpdates(_0x1fd527[_0xfcc6('0x3a')],null))['then'](respondWithResult(_0x1ffdd2,null))['catch'](handleError(_0x1ffdd2,null));};exports[_0xfcc6('0x1c')]=function(_0x5310db,_0x2e3d8f){return db[_0xfcc6('0x23')][_0xfcc6('0x3b')]({'where':{'id':_0x5310db[_0xfcc6('0x2f')]['id']}})[_0xfcc6('0x1b')](handleEntityNotFound(_0x2e3d8f,null))[_0xfcc6('0x1b')](removeEntity(_0x2e3d8f,null))[_0xfcc6('0x38')](handleError(_0x2e3d8f,null));};exports['describe']=function(_0x4fa793,_0x5b9dde){return db[_0xfcc6('0x23')][_0xfcc6('0x3c')]()[_0xfcc6('0x1b')](respondWithResult(_0x5b9dde,null))[_0xfcc6('0x38')](handleError(_0x5b9dde,null));};exports[_0xfcc6('0x3d')]=function(_0x383760,_0x1b8bef){return db['OpenchannelMessage'][_0xfcc6('0x3b')]({'where':{'id':_0x383760[_0xfcc6('0x2f')]['id']}})[_0xfcc6('0x1b')](handleEntityNotFound(_0x1b8bef,null))[_0xfcc6('0x1b')](function(_0x2dcdc8){if(_0x2dcdc8){return _0x2dcdc8[_0xfcc6('0x3d')](_0x383760[_0xfcc6('0x3a')][_0xfcc6('0x3e')],_['omit'](_0x383760[_0xfcc6('0x3a')],[_0xfcc6('0x3e'),'id'])||{});}})[_0xfcc6('0x1b')](respondWithResult(_0x1b8bef,null))[_0xfcc6('0x38')](handleError(_0x1b8bef,null));};exports[_0xfcc6('0x3f')]=function(_0x19d551,_0x331c33){var _0x5143a8={'raw':![],'where':{}};var _0x34515c={};var _0x5e34bc={'count':0x0,'rows':[]};return db[_0xfcc6('0x23')][_0xfcc6('0x40')]({'where':{'id':_0x19d551[_0xfcc6('0x2f')]['id']}})[_0xfcc6('0x1b')](handleEntityNotFound(_0x331c33,null))[_0xfcc6('0x1b')](function(_0x25057f){if(_0x25057f){_0x34515c[_0xfcc6('0x33')]=_['keys'](db[_0xfcc6('0x41')][_0xfcc6('0x24')]);_0x34515c[_0xfcc6('0x2b')]=_[_0xfcc6('0x30')](_0x19d551[_0xfcc6('0x2b')]);_0x34515c[_0xfcc6('0x42')]=_['intersection'](_0x34515c[_0xfcc6('0x33')],_0x34515c[_0xfcc6('0x2b')]);_0x5143a8[_0xfcc6('0x32')]=_[_0xfcc6('0x31')](_0x34515c[_0xfcc6('0x33')],qs[_0xfcc6('0x34')](_0x19d551['query'][_0xfcc6('0x34')]));_0x5143a8[_0xfcc6('0x32')]=_0x5143a8[_0xfcc6('0x32')][_0xfcc6('0x43')]?_0x5143a8['attributes']:_0x34515c[_0xfcc6('0x33')];if(!_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x44')]('nolimit')){_0x5143a8[_0xfcc6('0x45')]=qs[_0xfcc6('0x45')](_0x19d551['query'][_0xfcc6('0x45')]);_0x5143a8[_0xfcc6('0x15')]=qs[_0xfcc6('0x15')](_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x15')]);}_0x5143a8['order']=qs[_0xfcc6('0x46')](_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x46')]);_0x5143a8[_0xfcc6('0x47')]=qs[_0xfcc6('0x42')](_[_0xfcc6('0x48')](_0x19d551[_0xfcc6('0x2b')],_0x34515c[_0xfcc6('0x42')]));_0x5143a8['where'][_0xfcc6('0x49')]=_0x25057f['id'];if(_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x4a')]){_0x5143a8['where']=_[_0xfcc6('0x4b')](_0x5143a8['where'],{'$or':_['map'](_0x5143a8[_0xfcc6('0x32')],function(_0x1ab08b){var _0x3cdf6d={};_0x3cdf6d[_0x1ab08b]={'$like':'%'+_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x4a')]+'%'};return _0x3cdf6d;})});}if(_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x4c')]){var _0x52e9a0=_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x4c')][_0xfcc6('0x4d')](',');var _0x2728b2={};_0x2728b2[_0x52e9a0[0x0]]={'$gte':moment(_0x52e9a0[0x1])['format'](_0xfcc6('0x4e'))};_0x5143a8[_0xfcc6('0x47')]=_['merge'](_0x5143a8[_0xfcc6('0x47')],_0x2728b2);}_0x5143a8=_[_0xfcc6('0x4b')]({},_0x5143a8,_0x19d551[_0xfcc6('0x37')]);return db[_0xfcc6('0x41')][_0xfcc6('0x17')]({'where':_0x5143a8[_0xfcc6('0x47')]})[_0xfcc6('0x1b')](function(_0x33d70b){_0x5e34bc[_0xfcc6('0x17')]=_0x33d70b;if(_0x19d551[_0xfcc6('0x2b')][_0xfcc6('0x35')]){_0x5143a8[_0xfcc6('0x36')]=[{'all':!![]}];}return db[_0xfcc6('0x41')]['findAll'](_0x5143a8);})[_0xfcc6('0x1b')](function(_0x70f1e7){_0x5e34bc['rows']=_0x70f1e7;return _0x5e34bc;});}})[_0xfcc6('0x1b')](respondWithFilteredResult(_0x331c33,_0x5143a8))[_0xfcc6('0x38')](handleError(_0x331c33,null));};exports[_0xfcc6('0x4f')]=function(_0x244507,_0x31fb73){return db[_0xfcc6('0x23')]['find']({'where':{'id':_0x244507[_0xfcc6('0x2f')]['id']}})['then'](handleEntityNotFound(_0x31fb73,null))[_0xfcc6('0x1b')](function(_0x5c6524){if(_0x5c6524){return _0x5c6524[_0xfcc6('0x50')](_0x244507['body']['ids'],_[_0xfcc6('0x51')](_0x244507[_0xfcc6('0x3a')],[_0xfcc6('0x3e'),'id'])||{})[_0xfcc6('0x52')](function(){return db[_0xfcc6('0x53')][_0xfcc6('0x29')]({'attributes':['id','name',_0xfcc6('0x54')],'where':{'id':_0x244507[_0xfcc6('0x3a')][_0xfcc6('0x3e')]}});})[_0xfcc6('0x1b')](function(_0x2ab799){socket[_0xfcc6('0x55')](_0xfcc6('0x56'),{'id':Number(_0x244507[_0xfcc6('0x2f')]['id']),'tags':_0x2ab799||[]});return{'id':Number(_0x244507[_0xfcc6('0x2f')]['id']),'tags':_0x2ab799||[]};});}})[_0xfcc6('0x1b')](respondWithResult(_0x31fb73,null))[_0xfcc6('0x38')](handleError(_0x31fb73,null));};exports['removeTags']=function(_0x1fbffd,_0x21f011){return db[_0xfcc6('0x23')]['find']({'where':{'id':_0x1fbffd[_0xfcc6('0x2f')]['id']}})['then'](handleEntityNotFound(_0x21f011,null))['then'](function(_0x3ed5ac){if(_0x3ed5ac){return _0x3ed5ac['removeTags'](_0x1fbffd[_0xfcc6('0x2b')]['ids']);}})[_0xfcc6('0x1b')](respondWithStatusCode(_0x21f011,null))[_0xfcc6('0x38')](handleError(_0x21f011,null));};exports['download']=function(_0x45e031,_0x4a74ba){var _0x2e5025=moment()[_0xfcc6('0x57')]()[_0xfcc6('0x58')]();var _0x1ad8ed=path[_0xfcc6('0x59')](config[_0xfcc6('0x5a')],_0xfcc6('0x5b'),_0xfcc6('0x5c'),'tmp');var _0x439c19=path[_0xfcc6('0x59')](config[_0xfcc6('0x5a')],_0xfcc6('0x5b'),'files',_0xfcc6('0x5d'));var _0x58688b=path[_0xfcc6('0x59')](_0x1ad8ed,_0x2e5025);var _0x1dc7e3=util[_0xfcc6('0x5e')](_0xfcc6('0x5f'),_0x45e031[_0xfcc6('0x2f')]['id'],_0x2e5025);var _0xd7960=path['join'](_0x1ad8ed,_0x1dc7e3);var _0x13227a=[];_0x13227a[_0xfcc6('0x60')]({'model':db['User'],'as':'User','attributes':['id',_0xfcc6('0x61')],'raw':!![]});_0x13227a[_0xfcc6('0x60')]({'model':db[_0xfcc6('0x62')],'as':_0xfcc6('0x63'),'attributes':['id',_0xfcc6('0x64'),_0xfcc6('0x65')],'raw':!![]});if(_0x45e031[_0xfcc6('0x2b')][_0xfcc6('0x5d')]){_0x13227a[_0xfcc6('0x60')]({'model':db[_0xfcc6('0x66')],'as':_0xfcc6('0x66'),'raw':!![]});}var _0x2bfd8d=[{'model':db[_0xfcc6('0x41')],'as':'Messages','attributes':['id',_0xfcc6('0x3a'),_0xfcc6('0x67'),_0xfcc6('0x68'),_0xfcc6('0x69'),'read'],'include':_0x13227a}];_0x2bfd8d[_0xfcc6('0x60')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xfcc6('0x1f')]});_0x2bfd8d[_0xfcc6('0x60')]({'model':db[_0xfcc6('0x6a')],'as':'Owner','attributes':['id',_0xfcc6('0x61')]});return db[_0xfcc6('0x23')][_0xfcc6('0x3b')]({'where':{'id':_0x45e031[_0xfcc6('0x2f')]['id']},'include':_0x2bfd8d})[_0xfcc6('0x1b')](handleEntityNotFound(_0x4a74ba,null))[_0xfcc6('0x1b')](function(_0x1520b3){if(_0x1520b3){var _0xfe539=_0x1520b3[_0xfcc6('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x58688b);var _0x268bfa={'channel':_0xfcc6('0x6c'),'account':_0xfe539[_0xfcc6('0x6d')][_0xfcc6('0x1f')],'agent':_0xfe539[_0xfcc6('0x6e')]?_0xfe539['Owner'][_0xfcc6('0x61')]:_0xfcc6('0x6f'),'createdAt':moment(_0xfe539[_0xfcc6('0x67')])[_0xfcc6('0x5e')](_0xfcc6('0x4e'))[_0xfcc6('0x58')](),'closedAt':_0xfe539[_0xfcc6('0x70')]?moment(_0xfe539[_0xfcc6('0x71')])[_0xfcc6('0x5e')](_0xfcc6('0x4e'))['toString']():'','disposition':_0xfe539[_0xfcc6('0x72')],'visibility':_0xfe539[_0xfcc6('0x73')]?_0xfcc6('0x74'):_0xfcc6('0x75'),'messages':_(_0xfe539['Messages'])['filter']({'secret':![]})[_0xfcc6('0x22')](function(_0x1ccc80){if(_0x1ccc80[_0xfcc6('0x66')]){var _0x264c24=path[_0xfcc6('0x59')](_0x439c19,_0x1ccc80[_0xfcc6('0x66')][_0xfcc6('0x76')]);if(fs[_0xfcc6('0x77')](_0x264c24)){fs[_0xfcc6('0x78')](_0x264c24)['pipe'](fs['createWriteStream'](path['join'](_0x58688b,_0x1ccc80[_0xfcc6('0x66')][_0xfcc6('0x76')])));}}return{'date':moment(_0x1ccc80['createdAt'])[_0xfcc6('0x5e')](_0xfcc6('0x4e'))[_0xfcc6('0x58')](),'sender':_0x1ccc80[_0xfcc6('0x68')]==='out'?_0x1ccc80[_0xfcc6('0x6a')]?_0x1ccc80[_0xfcc6('0x6a')][_0xfcc6('0x61')]:_0xfcc6('0x79'):_0x1ccc80['Contact'][_0xfcc6('0x64')]+(_0x1ccc80[_0xfcc6('0x63')]['lastName']?'\x20'+_0x1ccc80[_0xfcc6('0x63')][_0xfcc6('0x65')]:''),'body':_0x1ccc80[_0xfcc6('0x66')]?_0x1ccc80[_0xfcc6('0x66')][_0xfcc6('0x76')]:_0x1ccc80[_0xfcc6('0x3a')],'direction':_0x1ccc80[_0xfcc6('0x68')]===_0xfcc6('0x7a')?'A':'C','secret':_0x1ccc80[_0xfcc6('0x69')],'read':_0x1ccc80['read'],'attachment':_0x1ccc80[_0xfcc6('0x66')]};})[_0xfcc6('0x7b')]()};return ejs[_0xfcc6('0x7c')](path['join'](config[_0xfcc6('0x5a')],_0xfcc6('0x5b'),_0xfcc6('0x7d'),_0xfcc6('0x7e')),{'interaction':_0x268bfa})[_0xfcc6('0x1b')](function(_0x233005){var _0x400fe8=path[_0xfcc6('0x59')](_0x58688b,_0xfcc6('0x7f')+_0xfe539['id']+'-'+_0x2e5025+_0xfcc6('0x80'));var _0x54afee={'path':_0x400fe8,'channel':_0xfcc6('0x6c'),'interactionId':_0xfe539['id']};return pdf['createPdfFromHTML'](_0x233005,_0x54afee);})['then'](function(){return new Promise(function(_0x5cf1ea,_0x11fb4a){zipdir(_0x58688b,{'saveTo':_0xd7960},function(_0x3275b4,_0x3fe665){if(_0x3275b4)return _0x11fb4a(_0x3275b4);return _0x5cf1ea(_0x3fe665);});})[_0xfcc6('0x1b')](function(){return new Promise(function(_0x5adfde,_0x1bf479){rimraf(_0x58688b,function(_0x306f3e){if(_0x306f3e)_0x1bf479(_0x306f3e);return _0x5adfde();});});})[_0xfcc6('0x1b')](function(){return _0x4a74ba[_0xfcc6('0x81')](_0xd7960,_0x1dc7e3,function(_0x5bb84d){if(_0x5bb84d){logger[_0xfcc6('0x1d')](_0xfcc6('0x82'),_0x5bb84d);}else{fs[_0xfcc6('0x83')](_0xd7960);}});});});}else{return _0x4a74ba[_0xfcc6('0x84')](0xc8);}})['catch'](handleError(_0x4a74ba,null));}; \ No newline at end of file +var _0xe7f7=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy','then','error','stack','name','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','disposition','threadId','Public','Private','map','existsSync','pipe','createWriteStream','direction','out','System','basename','value','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','path','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xe7f7,0x168));var _0x7e7f=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0xe7f7[_0x5c7e53];return _0x1c9af9;};'use strict';var rimraf=require(_0x7e7f('0x0'));var zipdir=require(_0x7e7f('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x7e7f('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e7f('0x3'));var Redis=require('ioredis');var interaction=require(_0x7e7f('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7e7f('0x5'));var logger=require(_0x7e7f('0x6'))(_0x7e7f('0x7'));var config=require(_0x7e7f('0x8'));var db=require(_0x7e7f('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7e7f('0xa'),'port':0x18eb});var socket=require(_0x7e7f('0xb'))(new Redis(config[_0x7e7f('0xc')]));require(_0x7e7f('0xd'))[_0x7e7f('0xe')](socket);function respondWithStatusCode(_0x2e6f50,_0x3cf1a0){_0x3cf1a0=_0x3cf1a0||0xcc;return function(_0x492841){if(_0x492841){return _0x2e6f50[_0x7e7f('0xf')](_0x3cf1a0);}return _0x2e6f50[_0x7e7f('0x10')](_0x3cf1a0)[_0x7e7f('0x11')]();};}function respondWithResult(_0x11fcc3,_0x4a0f22){_0x4a0f22=_0x4a0f22||0xc8;return function(_0x170d03){if(_0x170d03){return _0x11fcc3[_0x7e7f('0x10')](_0x4a0f22)[_0x7e7f('0x12')](_0x170d03);}};}function respondWithFilteredResult(_0xa07ecb,_0x5a49aa){return function(_0x4ac193){if(_0x4ac193){var _0x96b27d=typeof _0x5a49aa[_0x7e7f('0x13')]==='undefined'&&typeof _0x5a49aa[_0x7e7f('0x14')]==='undefined';var _0x37b19b=_0x4ac193[_0x7e7f('0x15')];var _0x598135=_0x96b27d?0x0:_0x5a49aa[_0x7e7f('0x13')];var _0x213ce3=_0x96b27d?_0x4ac193[_0x7e7f('0x15')]:_0x5a49aa[_0x7e7f('0x13')]+_0x5a49aa[_0x7e7f('0x14')];var _0x27301c;if(_0x213ce3>=_0x37b19b){_0x213ce3=_0x37b19b;_0x27301c=0xc8;}else{_0x27301c=0xce;}_0xa07ecb['status'](_0x27301c);return _0xa07ecb[_0x7e7f('0x16')](_0x7e7f('0x17'),_0x598135+'-'+_0x213ce3+'/'+_0x37b19b)[_0x7e7f('0x12')](_0x4ac193);}return null;};}function saveUpdates(_0x10e7b9){return function(_0x344fd0){if(_0x344fd0){return _0x344fd0[_0x7e7f('0x18')](_0x10e7b9)['then'](function(_0x27f170){return _0x27f170;});}return null;};}function removeEntity(_0x22889f){return function(_0x649eea){if(_0x649eea){return _0x649eea[_0x7e7f('0x19')]()[_0x7e7f('0x1a')](function(){_0x22889f['status'](0xcc)[_0x7e7f('0x11')]();});}};}function handleEntityNotFound(_0x13075b){return function(_0x267ff9){if(!_0x267ff9){_0x13075b['sendStatus'](0x194);}return _0x267ff9;};}function handleError(_0x3385ba,_0x33e769){_0x33e769=_0x33e769||0x1f4;return function(_0x3fcf0d){logger[_0x7e7f('0x1b')](_0x3fcf0d[_0x7e7f('0x1c')]);if(_0x3fcf0d['name']){delete _0x3fcf0d[_0x7e7f('0x1d')];}_0x3385ba[_0x7e7f('0x10')](_0x33e769)['send'](_0x3fcf0d);};}exports[_0x7e7f('0x1e')]=function(_0x530709,_0x327149){var _0x53750c={};var _0x27b483=_['map'](db[_0x7e7f('0x1f')][_0x7e7f('0x20')],function(_0xf64684){return{'name':_0xf64684[_0x7e7f('0x21')],'type':_0xf64684[_0x7e7f('0x22')][_0x7e7f('0x23')]};});_0x53750c=qs[_0x7e7f('0x24')](_0x27b483,_0x530709);return interaction[_0x7e7f('0x25')](_0x7e7f('0x26'),_0x530709[_0x7e7f('0x27')],_0x530709[_0x7e7f('0x28')],_0x53750c,_0x27b483)['then'](respondWithFilteredResult(_0x327149,_0x53750c))[_0x7e7f('0x29')](handleError(_0x327149,null));};exports[_0x7e7f('0x2a')]=function(_0x4a32cc,_0x247f9f){var _0x3d7b2d={};if(_0x4a32cc[_0x7e7f('0x27')][_0x7e7f('0x22')]&&_0x4a32cc['query'][_0x7e7f('0x22')]===_0x7e7f('0x2b')){_0x3d7b2d[_0x7e7f('0x2b')]=_0x4a32cc['params']['id'];}else{_0x3d7b2d['id']=_0x4a32cc[_0x7e7f('0x2c')]['id'];}var _0x4ef2cf={'raw':![],'where':_0x3d7b2d},_0x5dbd69={};_0x5dbd69[_0x7e7f('0x2d')]=_[_0x7e7f('0x2e')](db[_0x7e7f('0x1f')][_0x7e7f('0x20')]);_0x5dbd69[_0x7e7f('0x27')]=_[_0x7e7f('0x2e')](_0x4a32cc[_0x7e7f('0x27')]);_0x5dbd69[_0x7e7f('0x2f')]=_['intersection'](_0x5dbd69['model'],_0x5dbd69['query']);_0x4ef2cf['attributes']=_[_0x7e7f('0x30')](_0x5dbd69[_0x7e7f('0x2d')],qs[_0x7e7f('0x31')](_0x4a32cc[_0x7e7f('0x27')][_0x7e7f('0x31')]));_0x4ef2cf['attributes']=_0x4ef2cf[_0x7e7f('0x32')][_0x7e7f('0x33')]?_0x4ef2cf[_0x7e7f('0x32')]:_0x5dbd69[_0x7e7f('0x2d')];if(_0x4a32cc[_0x7e7f('0x27')][_0x7e7f('0x34')]){_0x4ef2cf['include']=[{'all':!![]}];}_0x4ef2cf=_['merge']({},_0x4ef2cf,_0x4a32cc[_0x7e7f('0x35')]);return db[_0x7e7f('0x1f')][_0x7e7f('0x36')](_0x4ef2cf)[_0x7e7f('0x1a')](handleEntityNotFound(_0x247f9f,null))[_0x7e7f('0x1a')](respondWithResult(_0x247f9f,null))['catch'](handleError(_0x247f9f,null));};exports['create']=function(_0x2da434,_0x4d29d0){return db[_0x7e7f('0x1f')][_0x7e7f('0x37')](_0x2da434[_0x7e7f('0x38')],{})['then'](respondWithResult(_0x4d29d0,0xc9))[_0x7e7f('0x29')](handleError(_0x4d29d0,null));};exports[_0x7e7f('0x18')]=function(_0x326df5,_0x49c776){if(_0x326df5['body']['id']){delete _0x326df5[_0x7e7f('0x38')]['id'];}return db[_0x7e7f('0x1f')][_0x7e7f('0x36')]({'where':{'id':_0x326df5[_0x7e7f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x49c776,null))[_0x7e7f('0x1a')](saveUpdates(_0x326df5[_0x7e7f('0x38')],null))[_0x7e7f('0x1a')](respondWithResult(_0x49c776,null))[_0x7e7f('0x29')](handleError(_0x49c776,null));};exports[_0x7e7f('0x19')]=function(_0x3b97b3,_0x35425b){return db['OpenchannelInteraction'][_0x7e7f('0x36')]({'where':{'id':_0x3b97b3[_0x7e7f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x35425b,null))['then'](removeEntity(_0x35425b,null))[_0x7e7f('0x29')](handleError(_0x35425b,null));};exports[_0x7e7f('0x39')]=function(_0x13ac2e,_0x1e34fd){return db[_0x7e7f('0x1f')]['describe']()[_0x7e7f('0x1a')](respondWithResult(_0x1e34fd,null))[_0x7e7f('0x29')](handleError(_0x1e34fd,null));};exports[_0x7e7f('0x3a')]=function(_0xc55342,_0x985633){return db[_0x7e7f('0x3b')][_0x7e7f('0x36')]({'where':{'id':_0xc55342[_0x7e7f('0x2c')]['id']}})[_0x7e7f('0x1a')](handleEntityNotFound(_0x985633,null))['then'](function(_0x2b4db2){if(_0x2b4db2){return _0x2b4db2[_0x7e7f('0x3a')](_0xc55342['body']['ids'],_[_0x7e7f('0x3c')](_0xc55342[_0x7e7f('0x38')],[_0x7e7f('0x3d'),'id'])||{});}})[_0x7e7f('0x1a')](respondWithResult(_0x985633,null))['catch'](handleError(_0x985633,null));};exports[_0x7e7f('0x3e')]=function(_0x547e0a,_0x13f0a3){var _0x46d7a3={'raw':![],'where':{}};var _0x343d81={};var _0x5a6932={'count':0x0,'rows':[]};return db[_0x7e7f('0x1f')][_0x7e7f('0x3f')]({'where':{'id':_0x547e0a[_0x7e7f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x13f0a3,null))[_0x7e7f('0x1a')](function(_0x2a656f){if(_0x2a656f){_0x343d81[_0x7e7f('0x2d')]=_[_0x7e7f('0x2e')](db['OpenchannelMessage'][_0x7e7f('0x20')]);_0x343d81['query']=_[_0x7e7f('0x2e')](_0x547e0a[_0x7e7f('0x27')]);_0x343d81[_0x7e7f('0x2f')]=_[_0x7e7f('0x30')](_0x343d81[_0x7e7f('0x2d')],_0x343d81[_0x7e7f('0x27')]);_0x46d7a3[_0x7e7f('0x32')]=_[_0x7e7f('0x30')](_0x343d81['model'],qs[_0x7e7f('0x31')](_0x547e0a[_0x7e7f('0x27')]['fields']));_0x46d7a3[_0x7e7f('0x32')]=_0x46d7a3[_0x7e7f('0x32')]['length']?_0x46d7a3['attributes']:_0x343d81['model'];if(!_0x547e0a['query'][_0x7e7f('0x40')](_0x7e7f('0x41'))){_0x46d7a3['limit']=qs[_0x7e7f('0x14')](_0x547e0a['query'][_0x7e7f('0x14')]);_0x46d7a3[_0x7e7f('0x13')]=qs['offset'](_0x547e0a['query']['offset']);}_0x46d7a3[_0x7e7f('0x42')]=qs[_0x7e7f('0x43')](_0x547e0a['query'][_0x7e7f('0x43')]);_0x46d7a3[_0x7e7f('0x44')]=qs[_0x7e7f('0x2f')](_['pick'](_0x547e0a[_0x7e7f('0x27')],_0x343d81[_0x7e7f('0x2f')]));_0x46d7a3['where']['OpenchannelInteractionId']=_0x2a656f['id'];if(_0x547e0a[_0x7e7f('0x27')]['filter']){_0x46d7a3['where']=_[_0x7e7f('0x45')](_0x46d7a3[_0x7e7f('0x44')],{'$or':_['map'](_0x46d7a3[_0x7e7f('0x32')],function(_0x3f1447){var _0x36e3c7={};_0x36e3c7[_0x3f1447]={'$like':'%'+_0x547e0a[_0x7e7f('0x27')][_0x7e7f('0x46')]+'%'};return _0x36e3c7;})});}if(_0x547e0a[_0x7e7f('0x27')]['$gte']){var _0x231a95=_0x547e0a[_0x7e7f('0x27')][_0x7e7f('0x47')][_0x7e7f('0x48')](',');var _0x619088={};_0x619088[_0x231a95[0x0]]={'$gte':moment(_0x231a95[0x1])[_0x7e7f('0x49')](_0x7e7f('0x4a'))};_0x46d7a3[_0x7e7f('0x44')]=_[_0x7e7f('0x45')](_0x46d7a3[_0x7e7f('0x44')],_0x619088);}_0x46d7a3=_[_0x7e7f('0x45')]({},_0x46d7a3,_0x547e0a[_0x7e7f('0x35')]);return db[_0x7e7f('0x3b')][_0x7e7f('0x15')]({'where':_0x46d7a3['where']})['then'](function(_0x4ae5cb){_0x5a6932[_0x7e7f('0x15')]=_0x4ae5cb;if(_0x547e0a[_0x7e7f('0x27')][_0x7e7f('0x34')]){_0x46d7a3['include']=[{'all':!![]}];}return db[_0x7e7f('0x3b')]['findAll'](_0x46d7a3);})[_0x7e7f('0x1a')](function(_0x262fc8){_0x5a6932[_0x7e7f('0x4b')]=_0x262fc8;return _0x5a6932;});}})[_0x7e7f('0x1a')](respondWithFilteredResult(_0x13f0a3,_0x46d7a3))[_0x7e7f('0x29')](handleError(_0x13f0a3,null));};exports['addTags']=function(_0x2bc8ba,_0x34bdee){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2bc8ba['params']['id']}})[_0x7e7f('0x1a')](handleEntityNotFound(_0x34bdee,null))[_0x7e7f('0x1a')](function(_0x483fc2){if(_0x483fc2){return _0x483fc2[_0x7e7f('0x4c')](_0x2bc8ba[_0x7e7f('0x38')]['ids'],_[_0x7e7f('0x3c')](_0x2bc8ba[_0x7e7f('0x38')],['ids','id'])||{})[_0x7e7f('0x4d')](function(){return db[_0x7e7f('0x4e')]['findAll']({'attributes':['id',_0x7e7f('0x1d'),_0x7e7f('0x4f')],'where':{'id':_0x2bc8ba[_0x7e7f('0x38')][_0x7e7f('0x3d')]}});})[_0x7e7f('0x1a')](function(_0x1078f2){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2bc8ba[_0x7e7f('0x2c')]['id']),'tags':_0x1078f2||[]});return{'id':Number(_0x2bc8ba[_0x7e7f('0x2c')]['id']),'tags':_0x1078f2||[]};});}})[_0x7e7f('0x1a')](respondWithResult(_0x34bdee,null))[_0x7e7f('0x29')](handleError(_0x34bdee,null));};exports['removeTags']=function(_0x292b9c,_0xbae81){return db['OpenchannelInteraction']['find']({'where':{'id':_0x292b9c[_0x7e7f('0x2c')]['id']}})[_0x7e7f('0x1a')](handleEntityNotFound(_0xbae81,null))[_0x7e7f('0x1a')](function(_0xb96bdd){if(_0xb96bdd){return _0xb96bdd[_0x7e7f('0x50')](_0x292b9c['query'][_0x7e7f('0x3d')]);}})[_0x7e7f('0x1a')](respondWithStatusCode(_0xbae81,null))[_0x7e7f('0x29')](handleError(_0xbae81,null));};exports[_0x7e7f('0x51')]=function(_0x59ff7c,_0x1490af){var _0x27426a=moment()[_0x7e7f('0x52')]()[_0x7e7f('0x53')]();var _0x2062fa=path[_0x7e7f('0x54')](config[_0x7e7f('0x55')],_0x7e7f('0x56'),_0x7e7f('0x57'),_0x7e7f('0x58'));var _0x550965=path[_0x7e7f('0x54')](config['root'],_0x7e7f('0x56'),_0x7e7f('0x57'),_0x7e7f('0x59'));var _0x4f2e0e=path[_0x7e7f('0x54')](_0x2062fa,_0x27426a);var _0x548d3f=util[_0x7e7f('0x49')](_0x7e7f('0x5a'),_0x59ff7c[_0x7e7f('0x2c')]['id'],_0x27426a);var _0x536dc2=path[_0x7e7f('0x54')](_0x2062fa,_0x548d3f);var _0x1e1ea4=[];_0x1e1ea4[_0x7e7f('0x5b')]({'model':db[_0x7e7f('0x5c')],'as':'User','attributes':['id',_0x7e7f('0x5d')],'raw':!![]});_0x1e1ea4[_0x7e7f('0x5b')]({'model':db[_0x7e7f('0x5e')],'as':_0x7e7f('0x5f'),'attributes':['id',_0x7e7f('0x60'),_0x7e7f('0x61')],'raw':!![]});if(_0x59ff7c[_0x7e7f('0x27')][_0x7e7f('0x59')]){_0x1e1ea4[_0x7e7f('0x5b')]({'model':db[_0x7e7f('0x62')],'as':_0x7e7f('0x62'),'raw':!![]});}var _0x482f0e=[{'model':db[_0x7e7f('0x3b')],'as':'Messages','attributes':['id',_0x7e7f('0x38'),_0x7e7f('0x63'),'direction',_0x7e7f('0x64'),_0x7e7f('0x65')],'include':_0x1e1ea4}];_0x482f0e[_0x7e7f('0x5b')]({'model':db[_0x7e7f('0x66')],'as':_0x7e7f('0x67'),'attributes':['id',_0x7e7f('0x1d')]});_0x482f0e[_0x7e7f('0x5b')]({'model':db['User'],'as':_0x7e7f('0x68'),'attributes':['id',_0x7e7f('0x5d')]});return db[_0x7e7f('0x1f')][_0x7e7f('0x36')]({'where':{'id':_0x59ff7c[_0x7e7f('0x2c')]['id']},'include':_0x482f0e})[_0x7e7f('0x1a')](handleEntityNotFound(_0x1490af,null))['then'](function(_0x4e4401){if(_0x4e4401){var _0x5e00e0=_0x4e4401['get']({'plain':!![]});fs[_0x7e7f('0x69')](_0x4f2e0e);var _0x2b5c0f={'channel':_0x7e7f('0x6a'),'account':_0x5e00e0[_0x7e7f('0x67')][_0x7e7f('0x1d')],'agent':_0x5e00e0['Owner']?_0x5e00e0[_0x7e7f('0x68')]['fullname']:_0x7e7f('0x6b'),'createdAt':moment(_0x5e00e0[_0x7e7f('0x63')])[_0x7e7f('0x49')](_0x7e7f('0x4a'))[_0x7e7f('0x53')](),'closedAt':_0x5e00e0[_0x7e7f('0x6c')]?moment(_0x5e00e0['closedAt'])[_0x7e7f('0x49')](_0x7e7f('0x4a'))['toString']():'','disposition':_0x5e00e0[_0x7e7f('0x6d')],'visibility':_0x5e00e0[_0x7e7f('0x6e')]?_0x7e7f('0x6f'):_0x7e7f('0x70'),'messages':_(_0x5e00e0['Messages'])[_0x7e7f('0x46')]({'secret':![]})[_0x7e7f('0x71')](function(_0x34ac8a){if(_0x34ac8a[_0x7e7f('0x62')]){var _0x59793d=path[_0x7e7f('0x54')](_0x550965,_0x34ac8a[_0x7e7f('0x62')]['basename']);if(fs[_0x7e7f('0x72')](_0x59793d)){fs['createReadStream'](_0x59793d)[_0x7e7f('0x73')](fs[_0x7e7f('0x74')](path[_0x7e7f('0x54')](_0x4f2e0e,_0x34ac8a[_0x7e7f('0x62')]['basename'])));}}return{'date':moment(_0x34ac8a[_0x7e7f('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x34ac8a[_0x7e7f('0x75')]===_0x7e7f('0x76')?_0x34ac8a['User']?_0x34ac8a[_0x7e7f('0x5c')]['fullname']:_0x7e7f('0x77'):_0x34ac8a['Contact'][_0x7e7f('0x60')]+(_0x34ac8a[_0x7e7f('0x5f')][_0x7e7f('0x61')]?'\x20'+_0x34ac8a['Contact']['lastName']:''),'body':_0x34ac8a['Attachment']?_0x34ac8a[_0x7e7f('0x62')][_0x7e7f('0x78')]:_0x34ac8a[_0x7e7f('0x38')],'direction':_0x34ac8a[_0x7e7f('0x75')]===_0x7e7f('0x76')?'A':'C','secret':_0x34ac8a[_0x7e7f('0x64')],'read':_0x34ac8a['read'],'attachment':_0x34ac8a['Attachment']};})[_0x7e7f('0x79')]()};return ejs['renderFile'](path[_0x7e7f('0x54')](config[_0x7e7f('0x55')],_0x7e7f('0x56'),'views','downloadInteraction.ejs'),{'interaction':_0x2b5c0f})[_0x7e7f('0x1a')](function(_0x29c8ae){var _0x12cc10=path[_0x7e7f('0x54')](_0x4f2e0e,_0x7e7f('0x7a')+_0x5e00e0['id']+'-'+_0x27426a+'.pdf');var _0x3023eb={'path':_0x12cc10,'channel':_0x7e7f('0x6a'),'interactionId':_0x5e00e0['id']};return pdf[_0x7e7f('0x7b')](_0x29c8ae,_0x3023eb);})[_0x7e7f('0x1a')](function(){return new Promise(function(_0x378ad2,_0x239c68){zipdir(_0x4f2e0e,{'saveTo':_0x536dc2},function(_0x497f3e,_0x4b8ff1){if(_0x497f3e)return _0x239c68(_0x497f3e);return _0x378ad2(_0x4b8ff1);});})[_0x7e7f('0x1a')](function(){return new Promise(function(_0x5c099a,_0x253ddc){rimraf(_0x4f2e0e,function(_0x5921e5){if(_0x5921e5)_0x253ddc(_0x5921e5);return _0x5c099a();});});})[_0x7e7f('0x1a')](function(){return _0x1490af[_0x7e7f('0x51')](_0x536dc2,_0x548d3f,function(_0x49f82d){if(_0x49f82d){logger[_0x7e7f('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x49f82d);}else{fs[_0x7e7f('0x7c')](_0x536dc2);}});});});}else{return _0x1490af[_0x7e7f('0xf')](0xc8);}})[_0x7e7f('0x29')](handleError(_0x1490af,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5dead35..441fede 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 _0x2818=['OpenchannelMessage','setMaxListeners','update','getUsers','Users','map','findAll','then','length','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction'];(function(_0x1bbfd4,_0x5cb9c4){var _0x34d2bb=function(_0x3d3e66){while(--_0x3d3e66){_0x1bbfd4['push'](_0x1bbfd4['shift']());}};_0x34d2bb(++_0x5cb9c4);}(_0x2818,0xb1));var _0x8281=function(_0x21ae82,_0x4902ed){_0x21ae82=_0x21ae82-0x0;var _0x11990b=_0x2818[_0x21ae82];return _0x11990b;};'use strict';var EventEmitter=require(_0x8281('0x0'));var OpenchannelInteraction=require(_0x8281('0x1'))['db'][_0x8281('0x2')];var OpenchannelMessage=require(_0x8281('0x1'))['db'][_0x8281('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8281('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8281('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3777f2){return function(_0x6885ce,_0x5aa838,_0x5ba489){_0x6885ce[_0x8281('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d7a9b){_0x6885ce['setDataValue'](_0x8281('0x7'),_0x2d7a9b[_0x8281('0x8')](function(_0x230cb7){return{'id':_0x230cb7['id']};}));return OpenchannelMessage[_0x8281('0x9')]({'where':{'OpenchannelInteractionId':_0x6885ce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8281('0xa')](function(_0x4521d4){_0x6885ce['setDataValue']('unreadMessages',_0x4521d4[_0x8281('0xb')]);OpenchannelInteractionEvents['emit'](_0x3777f2+':'+_0x6885ce['id'],_0x6885ce);OpenchannelInteractionEvents['emit'](_0x3777f2,_0x6885ce);_0x5ba489(null);})[_0x8281('0xc')](_0x5ba489(null));};}for(var e in events){if(events[_0x8281('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x8281('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xaf1c=['update','getUsers','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x464f27,_0x39d03f){var _0x249738=function(_0x5d6b3f){while(--_0x5d6b3f){_0x464f27['push'](_0x464f27['shift']());}};_0x249738(++_0x39d03f);}(_0xaf1c,0x10c));var _0xcaf1=function(_0x1ea713,_0x3b81ff){_0x1ea713=_0x1ea713-0x0;var _0x30f58b=_0xaf1c[_0x1ea713];return _0x30f58b;};'use strict';var EventEmitter=require(_0xcaf1('0x0'));var OpenchannelInteraction=require(_0xcaf1('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xcaf1('0x1'))['db'][_0xcaf1('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcaf1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaf1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e750c){return function(_0xabea5e,_0x18de0a,_0x3c775a){_0xabea5e[_0xcaf1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xf3f37b){_0xabea5e['setDataValue'](_0xcaf1('0x6'),_0xf3f37b[_0xcaf1('0x7')](function(_0x2fcd80){return{'id':_0x2fcd80['id']};}));return OpenchannelMessage[_0xcaf1('0x8')]({'where':{'OpenchannelInteractionId':_0xabea5e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcaf1('0x9')](function(_0xe6ce32){_0xabea5e['setDataValue'](_0xcaf1('0xa'),_0xe6ce32[_0xcaf1('0xb')]);OpenchannelInteractionEvents[_0xcaf1('0xc')](_0x3e750c+':'+_0xabea5e['id'],_0xabea5e);OpenchannelInteractionEvents[_0xcaf1('0xc')](_0x3e750c,_0xabea5e);_0x3c775a(null);})[_0xcaf1('0xd')](_0x3c775a(null));};}for(var e in events){if(events[_0xcaf1('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xcaf1('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 fc0bde2..0474816 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 _0x68aa=['exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x21da6a,_0x57d4e2){var _0x355c35=function(_0x3dbde6){while(--_0x3dbde6){_0x21da6a['push'](_0x21da6a['shift']());}};_0x355c35(++_0x57d4e2);}(_0x68aa,0x81));var _0xa68a=function(_0x49617a,_0x7ed6aa){_0x49617a=_0x49617a-0x0;var _0x3e8736=_0x68aa[_0x49617a];return _0x3e8736;};'use strict';var _=require('lodash');var util=require(_0xa68a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa68a('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa68a('0x2'));var rimraf=require(_0xa68a('0x3'));var config=require(_0xa68a('0x4'));var attributes=require(_0xa68a('0x5'));module[_0xa68a('0x6')]=function(_0x2d1ede,_0x23a1f2){return _0x2d1ede['define'](_0xa68a('0x7'),attributes,{'tableName':_0xa68a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa68a('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x35780a,_0x4113e1,_0x3969a0){if(_0x35780a[_0xa68a('0xa')](_0xa68a('0xb'))){_0x35780a[_0xa68a('0xc')]=moment()[_0xa68a('0xd')](_0xa68a('0xe'));}_0x3969a0(null,_0x35780a);}}});}; \ No newline at end of file +var _0x38ed=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x968d3,_0x426f06){var _0x581696=function(_0x60c8ef){while(--_0x60c8ef){_0x968d3['push'](_0x968d3['shift']());}};_0x581696(++_0x426f06);}(_0x38ed,0xbd));var _0xd38e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38ed[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd38e('0x0'));var util=require('util');var logger=require(_0xd38e('0x1'))(_0xd38e('0x2'));var moment=require(_0xd38e('0x3'));var BPromise=require(_0xd38e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd38e('0x5'));var rimraf=require(_0xd38e('0x6'));var config=require(_0xd38e('0x7'));var attributes=require(_0xd38e('0x8'));module[_0xd38e('0x9')]=function(_0x2363db,_0x3b1cce){return _0x2363db[_0xd38e('0xa')](_0xd38e('0xb'),attributes,{'tableName':_0xd38e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd38e('0xd'),'collate':_0xd38e('0xe'),'hooks':{'beforeUpdate':function(_0x4510c4,_0x3053ae,_0xe85f19){if(_0x4510c4[_0xd38e('0xf')](_0xd38e('0x10'))){_0x4510c4[_0xd38e('0x11')]=moment()[_0xd38e('0x12')](_0xd38e('0x13'));}_0xe85f19(null,_0x4510c4);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index bcb622f..799ef13 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 _0x66d4=['options','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw'];(function(_0x2b18ba,_0x285c2c){var _0x5d1729=function(_0x5c3796){while(--_0x5c3796){_0x2b18ba['push'](_0x2b18ba['shift']());}};_0x5d1729(++_0x285c2c);}(_0x66d4,0x15a));var _0x466d=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x66d4[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0x466d('0x0'));var util=require(_0x466d('0x1'));var moment=require('moment');var BPromise=require(_0x466d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x466d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x466d('0x4'))(_0x466d('0x5'));var config=require(_0x466d('0x6'));var jayson=require(_0x466d('0x7'));var client=jayson['client'][_0x466d('0x8')]({'port':0x232a});config[_0x466d('0x9')]=_[_0x466d('0xa')](config[_0x466d('0x9')],{'host':_0x466d('0xb'),'port':0x18eb});var socket=require(_0x466d('0xc'))(new Redis(config[_0x466d('0x9')]));require(_0x466d('0xd'))[_0x466d('0xe')](socket);function respondWithRpcPromise(_0x301572,_0x3b5c48,_0x4071eb){return new BPromise(function(_0x2aaea9,_0x406a5a){return client[_0x466d('0xf')](_0x301572,_0x4071eb)[_0x466d('0x10')](function(_0x43bc4d){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3b5c48,_0x466d('0x11'));logger[_0x466d('0x12')](_0x466d('0x13'),_0x3b5c48,'request\x20sent',JSON[_0x466d('0x14')](_0x43bc4d));if(_0x43bc4d[_0x466d('0x15')]){if(_0x43bc4d[_0x466d('0x15')][_0x466d('0x16')]===0x1f4){logger[_0x466d('0x15')](_0x466d('0x17'),_0x3b5c48,_0x43bc4d[_0x466d('0x15')][_0x466d('0x18')]);return _0x406a5a(_0x43bc4d['error'][_0x466d('0x18')]);}logger[_0x466d('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3b5c48,_0x43bc4d[_0x466d('0x15')]['message']);return _0x2aaea9(_0x43bc4d[_0x466d('0x15')][_0x466d('0x18')]);}else{logger[_0x466d('0x19')](_0x466d('0x17'),_0x3b5c48,_0x466d('0x11'));_0x2aaea9(_0x43bc4d[_0x466d('0x1a')][_0x466d('0x18')]);}})['catch'](function(_0x59aab6){logger['error'](_0x466d('0x17'),_0x3b5c48,_0x59aab6);_0x406a5a(_0x59aab6);});});}exports[_0x466d('0x1b')]=function(_0xf8f2d4){var _0x103cc3=this;return new Promise(function(_0x549cbf,_0x26cbac){return db[_0x466d('0x1c')][_0x466d('0x1d')](_0xf8f2d4[_0x466d('0x1e')],{'raw':_0xf8f2d4['options']?_0xf8f2d4['options'][_0x466d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8f2d4[_0x466d('0x20')]?_0xf8f2d4['options'][_0x466d('0x21')]||null:null,'attributes':_0xf8f2d4['options']?_0xf8f2d4['options'][_0x466d('0x22')]||null:null,'limit':_0xf8f2d4['options']?_0xf8f2d4[_0x466d('0x20')][_0x466d('0x23')]||null:null})[_0x466d('0x10')](function(_0x530c09){logger[_0x466d('0x19')](_0x466d('0x1b'),_0xf8f2d4);logger['debug']('UpdateOpenchannelInteraction',_0xf8f2d4,JSON[_0x466d('0x14')](_0x530c09));_0x549cbf(_0x530c09);})[_0x466d('0x24')](function(_0x20bfb9){logger[_0x466d('0x15')](_0x466d('0x1b'),_0x20bfb9[_0x466d('0x18')],_0xf8f2d4);_0x26cbac(_0x103cc3[_0x466d('0x15')](0x1f4,_0x20bfb9[_0x466d('0x18')]));});});};exports[_0x466d('0x25')]=function(_0xdd69b3){return new Promise(function(_0x3f2131,_0x3d5a92){return db[_0x466d('0x1c')]['find']({'where':_0xdd69b3[_0x466d('0x20')]?_0xdd69b3[_0x466d('0x20')][_0x466d('0x21')]||null:null})[_0x466d('0x10')](function(_0x3da47a){if(_0x3da47a){return _0x3da47a['addTags'](_0xdd69b3[_0x466d('0x1e')][_0x466d('0x26')],_[_0x466d('0x27')](_0xdd69b3['body'],[_0x466d('0x26'),'id'])||{});}})[_0x466d('0x28')](function(_0x20f5c8){logger[_0x466d('0x19')](_0x466d('0x29'),_0xdd69b3);logger[_0x466d('0x12')](_0x466d('0x29'),_0xdd69b3,JSON[_0x466d('0x14')](_0x20f5c8));_0x3f2131(_0x20f5c8);})['catch'](function(_0x5a34e2){logger[_0x466d('0x15')](_0x466d('0x29'),_0x5a34e2[_0x466d('0x18')],_0xdd69b3);_0x3d5a92(_this['error'](0x1f4,_0x5a34e2[_0x466d('0x18')]));});});}; \ No newline at end of file +var _0xe36a=['omit','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','find','addTags'];(function(_0x5321e9,_0xfa0270){var _0xe4c457=function(_0x4d46f0){while(--_0x4d46f0){_0x5321e9['push'](_0x5321e9['shift']());}};_0xe4c457(++_0xfa0270);}(_0xe36a,0x191));var _0xae36=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xe36a[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0xae36('0x0'));var util=require('util');var moment=require(_0xae36('0x1'));var BPromise=require(_0xae36('0x2'));var rs=require(_0xae36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae36('0x4'))['db'];var utils=require(_0xae36('0x5'));var logger=require(_0xae36('0x6'))(_0xae36('0x7'));var config=require(_0xae36('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae36('0x9')][_0xae36('0xa')]({'port':0x232a});config[_0xae36('0xb')]=_['defaults'](config[_0xae36('0xb')],{'host':_0xae36('0xc'),'port':0x18eb});var socket=require(_0xae36('0xd'))(new Redis(config['redis']));require(_0xae36('0xe'))[_0xae36('0xf')](socket);function respondWithRpcPromise(_0xe321f7,_0x1a70c7,_0x502f7c){return new BPromise(function(_0x5e341b,_0x1b94dd){return client[_0xae36('0x10')](_0xe321f7,_0x502f7c)[_0xae36('0x11')](function(_0x76cf27){logger[_0xae36('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a70c7,_0xae36('0x13'));logger[_0xae36('0x14')](_0xae36('0x15'),_0x1a70c7,_0xae36('0x13'),JSON[_0xae36('0x16')](_0x76cf27));if(_0x76cf27[_0xae36('0x17')]){if(_0x76cf27[_0xae36('0x17')][_0xae36('0x18')]===0x1f4){logger[_0xae36('0x17')](_0xae36('0x19'),_0x1a70c7,_0x76cf27['error'][_0xae36('0x1a')]);return _0x1b94dd(_0x76cf27[_0xae36('0x17')]['message']);}logger[_0xae36('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a70c7,_0x76cf27[_0xae36('0x17')][_0xae36('0x1a')]);return _0x5e341b(_0x76cf27[_0xae36('0x17')][_0xae36('0x1a')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1a70c7,_0xae36('0x13'));_0x5e341b(_0x76cf27[_0xae36('0x1b')][_0xae36('0x1a')]);}})[_0xae36('0x1c')](function(_0x40525c){logger[_0xae36('0x17')](_0xae36('0x19'),_0x1a70c7,_0x40525c);_0x1b94dd(_0x40525c);});});}exports['UpdateOpenchannelInteraction']=function(_0x2b514b){var _0x5ebb0c=this;return new Promise(function(_0x2c47cb,_0x353ea3){return db[_0xae36('0x1d')][_0xae36('0x1e')](_0x2b514b['body'],{'raw':_0x2b514b['options']?_0x2b514b[_0xae36('0x1f')][_0xae36('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b514b[_0xae36('0x1f')]?_0x2b514b['options'][_0xae36('0x21')]||null:null,'attributes':_0x2b514b[_0xae36('0x1f')]?_0x2b514b[_0xae36('0x1f')][_0xae36('0x22')]||null:null,'limit':_0x2b514b[_0xae36('0x1f')]?_0x2b514b[_0xae36('0x1f')][_0xae36('0x23')]||null:null})[_0xae36('0x11')](function(_0x3228fb){logger[_0xae36('0x12')](_0xae36('0x24'),_0x2b514b);logger[_0xae36('0x14')](_0xae36('0x24'),_0x2b514b,JSON[_0xae36('0x16')](_0x3228fb));_0x2c47cb(_0x3228fb);})[_0xae36('0x1c')](function(_0x1228fb){logger[_0xae36('0x17')]('UpdateOpenchannelInteraction',_0x1228fb[_0xae36('0x1a')],_0x2b514b);_0x353ea3(_0x5ebb0c['error'](0x1f4,_0x1228fb[_0xae36('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x551852){return new Promise(function(_0x26a953,_0x4cdf77){return db['OpenchannelInteraction'][_0xae36('0x25')]({'where':_0x551852[_0xae36('0x1f')]?_0x551852['options'][_0xae36('0x21')]||null:null})[_0xae36('0x11')](function(_0xd6d5b4){if(_0xd6d5b4){return _0xd6d5b4[_0xae36('0x26')](_0x551852['body']['ids'],_[_0xae36('0x27')](_0x551852[_0xae36('0x28')],[_0xae36('0x29'),'id'])||{});}})[_0xae36('0x2a')](function(_0x2808e6){logger[_0xae36('0x12')]('AddTags',_0x551852);logger[_0xae36('0x14')](_0xae36('0x2b'),_0x551852,JSON['stringify'](_0x2808e6));_0x26a953(_0x2808e6);})[_0xae36('0x1c')](function(_0x95c05c){logger[_0xae36('0x17')]('AddTags',_0x95c05c[_0xae36('0x1a')],_0x551852);_0x4cdf77(_this[_0xae36('0x17')](0x1f4,_0x95c05c[_0xae36('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9c269d1..f445045 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 _0xde7a=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','emit'];(function(_0x3b5031,_0x38057f){var _0x57ad35=function(_0x1660cc){while(--_0x1660cc){_0x3b5031['push'](_0x3b5031['shift']());}};_0x57ad35(++_0x38057f);}(_0xde7a,0x17e));var _0xade7=function(_0x20c450,_0x524915){_0x20c450=_0x20c450-0x0;var _0x196655=_0xde7a[_0x20c450];return _0x196655;};'use strict';var OpenchannelInteractionEvents=require(_0xade7('0x0'));var events=[_0xade7('0x1'),'remove','update'];function createListener(_0x195c0c,_0x3b2d30){return function(_0x231589){_0x3b2d30[_0xade7('0x2')](_0x195c0c,_0x231589);};}function removeListener(_0x2783c8,_0x239c49){return function(){OpenchannelInteractionEvents[_0xade7('0x3')](_0x2783c8,_0x239c49);};}exports[_0xade7('0x4')]=function(_0x4aef1d){for(var _0x3907ea=0x0,_0x4d60af=events[_0xade7('0x5')];_0x3907ea<_0x4d60af;_0x3907ea++){var _0x3e0b4f=events[_0x3907ea];var _0x9d44a3=createListener(_0xade7('0x6')+_0x3e0b4f,_0x4aef1d);OpenchannelInteractionEvents['on'](_0x3e0b4f,_0x9d44a3);}}; \ No newline at end of file +var _0xaa3e=['emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x23f8e7,_0x1af059){var _0x455632=function(_0x2017ed){while(--_0x2017ed){_0x23f8e7['push'](_0x23f8e7['shift']());}};_0x455632(++_0x1af059);}(_0xaa3e,0x170));var _0xeaa3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xaa3e[_0x4b369d];return _0x571a98;};'use strict';var OpenchannelInteractionEvents=require(_0xeaa3('0x0'));var events=[_0xeaa3('0x1'),_0xeaa3('0x2'),'update'];function createListener(_0x20f492,_0x306849){return function(_0x52844b){_0x306849[_0xeaa3('0x3')](_0x20f492,_0x52844b);};}function removeListener(_0x5b816a,_0x1f90df){return function(){OpenchannelInteractionEvents['removeListener'](_0x5b816a,_0x1f90df);};}exports[_0xeaa3('0x4')]=function(_0x3a0de7){for(var _0x82ba34=0x0,_0xdc03f9=events[_0xeaa3('0x5')];_0x82ba34<_0xdc03f9;_0x82ba34++){var _0x47515f=events[_0x82ba34];var _0x8c3741=createListener(_0xeaa3('0x6')+_0x47515f,_0x3a0de7);OpenchannelInteractionEvents['on'](_0x47515f,_0x8c3741);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6858226..78f4f2d 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x315d69,_0x1a9224){var _0x599dca=function(_0x51feeb){while(--_0x51feeb){_0x315d69['push'](_0x315d69['shift']());}};_0x599dca(++_0x1a9224);}(_0xe706,0xa3));var _0x6e70=function(_0x14e780,_0x3b07c6){_0x14e780=_0x14e780-0x0;var _0x5f884c=_0xe706[_0x14e780];return _0x5f884c;};'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')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x229a9d,_0x4d3229){var _0x5bd600=function(_0x5f5af9){while(--_0x5f5af9){_0x229a9d['push'](_0x229a9d['shift']());}};_0x5bd600(++_0x4d3229);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xcb91[_0x57add2];return _0x4e3670;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0596e15..9562341 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 _0x7269=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x7269,0x76));var _0x9726=function(_0x199259,_0x1bc8ff){_0x199259=_0x199259-0x0;var _0x227b64=_0x7269[_0x199259];return _0x227b64;};'use strict';var Sequelize=require(_0x9726('0x0'));module[_0x9726('0x1')]={'body':{'type':Sequelize[_0x9726('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9726('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9726('0x4')]('in','out'),'defaultValue':_0x9726('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9726('0x6')]},'providerName':{'type':Sequelize[_0x9726('0x7')]},'providerResponse':{'type':Sequelize[_0x9726('0x2')]}}; \ No newline at end of file +var _0x3cae=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x3cae,0x117));var _0xe3ca=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x3cae[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'body':{'type':Sequelize[_0xe3ca('0x2')](_0xe3ca('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe3ca('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3ca('0x5')]('in','out'),'defaultValue':_0xe3ca('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe3ca('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe3ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 769f397..2c86d13 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 _0xed08=['localhost','./openchannelMessage.socket','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','name','index','map','OpenchannelMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','find','create','update','body','params','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x47dcc0,_0x42647e){var _0x1191cb=function(_0x2e4b82){while(--_0x2e4b82){_0x47dcc0['push'](_0x47dcc0['shift']());}};_0x1191cb(++_0x42647e);}(_0xed08,0x67));var _0x8ed0=function(_0x1f7ec0,_0xca1275){_0x1f7ec0=_0x1f7ec0-0x0;var _0x3f9992=_0xed08[_0x1f7ec0];return _0x3f9992;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ed0('0x0'));var zipdir=require(_0x8ed0('0x1'));var jsonpatch=require(_0x8ed0('0x2'));var rp=require(_0x8ed0('0x3'));var moment=require(_0x8ed0('0x4'));var BPromise=require(_0x8ed0('0x5'));var Mustache=require(_0x8ed0('0x6'));var util=require(_0x8ed0('0x7'));var path=require(_0x8ed0('0x8'));var sox=require(_0x8ed0('0x9'));var csv=require(_0x8ed0('0xa'));var ejs=require(_0x8ed0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ed0('0xc'));var squel=require(_0x8ed0('0xd'));var crypto=require(_0x8ed0('0xe'));var jsforce=require(_0x8ed0('0xf'));var deskjs=require(_0x8ed0('0x10'));var toCsv=require(_0x8ed0('0xa'));var querystring=require(_0x8ed0('0x11'));var Papa=require('papaparse');var Redis=require(_0x8ed0('0x12'));var authService=require(_0x8ed0('0x13'));var qs=require(_0x8ed0('0x14'));var as=require(_0x8ed0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ed0('0x16'))(_0x8ed0('0x17'));var utils=require(_0x8ed0('0x18'));var config=require(_0x8ed0('0x19'));var licenseUtil=require(_0x8ed0('0x1a'));var db=require(_0x8ed0('0x1b'))['db'];config[_0x8ed0('0x1c')]=_[_0x8ed0('0x1d')](config[_0x8ed0('0x1c')],{'host':_0x8ed0('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ed0('0x1c')]));require(_0x8ed0('0x1f'))['register'](socket);var jayson=require(_0x8ed0('0x20'));var client=jayson[_0x8ed0('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x8ed0('0x21')][_0x8ed0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5eda69,_0x72bf7a,_0x280676,_0x48b5a7){return new BPromise(function(_0x2792c8,_0x42afeb){var _0xb255c=_0x48b5a7||client;return _0xb255c['request'](_0x5eda69,_0x280676)['then'](function(_0x5ef89c){logger[_0x8ed0('0x23')](_0x8ed0('0x24'),_0x72bf7a,_0x8ed0('0x25'));logger[_0x8ed0('0x26')](_0x8ed0('0x27'),_0x72bf7a,_0x8ed0('0x25'),JSON[_0x8ed0('0x28')](_0x5ef89c));if(_0x5ef89c[_0x8ed0('0x29')]){if(_0x5ef89c[_0x8ed0('0x29')]['code']===0x1f4){logger['error'](_0x8ed0('0x24'),_0x72bf7a,_0x5ef89c[_0x8ed0('0x29')]['message']);return _0x42afeb(_0x5ef89c[_0x8ed0('0x29')][_0x8ed0('0x2a')]);}logger[_0x8ed0('0x29')](_0x8ed0('0x24'),_0x72bf7a,_0x5ef89c['error'][_0x8ed0('0x2a')]);return _0x2792c8(_0x5ef89c[_0x8ed0('0x29')]['message']);}else{logger[_0x8ed0('0x23')](_0x8ed0('0x24'),_0x72bf7a,_0x8ed0('0x25'));_0x2792c8(_0x5ef89c[_0x8ed0('0x2b')][_0x8ed0('0x2a')]);}})[_0x8ed0('0x2c')](function(_0x551c91){logger['error'](_0x8ed0('0x24'),_0x72bf7a,_0x551c91);_0x42afeb(_0x551c91);});});}function respondWithStatusCode(_0x2674e9,_0x3a17d4){_0x3a17d4=_0x3a17d4||0xcc;return function(_0x158364){if(_0x158364){return _0x2674e9[_0x8ed0('0x2d')](_0x3a17d4);}return _0x2674e9[_0x8ed0('0x2e')](_0x3a17d4)['end']();};}function respondWithResult(_0xbfcca,_0x436e54){_0x436e54=_0x436e54||0xc8;return function(_0x4886f8){if(_0x4886f8){return _0xbfcca[_0x8ed0('0x2e')](_0x436e54)[_0x8ed0('0x2f')](_0x4886f8);}};}function respondWithFilteredResult(_0x29c986,_0x25617c){return function(_0x15eec2){if(_0x15eec2){var _0xec3bd2=typeof _0x25617c[_0x8ed0('0x30')]==='undefined'&&typeof _0x25617c['limit']==='undefined';var _0x5c2ff=_0x15eec2[_0x8ed0('0x31')];var _0x59a78a=_0xec3bd2?0x0:_0x25617c[_0x8ed0('0x30')];var _0x53c60c=_0xec3bd2?_0x15eec2[_0x8ed0('0x31')]:_0x25617c[_0x8ed0('0x30')]+_0x25617c['limit'];var _0x4a0c9e;if(_0x53c60c>=_0x5c2ff){_0x53c60c=_0x5c2ff;_0x4a0c9e=0xc8;}else{_0x4a0c9e=0xce;}_0x29c986[_0x8ed0('0x2e')](_0x4a0c9e);return _0x29c986[_0x8ed0('0x32')](_0x8ed0('0x33'),_0x59a78a+'-'+_0x53c60c+'/'+_0x5c2ff)['json'](_0x15eec2);}return null;};}function patchUpdates(_0x30aa44){return function(_0x4fa368){try{jsonpatch[_0x8ed0('0x34')](_0x4fa368,_0x30aa44,!![]);}catch(_0x2cca02){return BPromise[_0x8ed0('0x35')](_0x2cca02);}return _0x4fa368[_0x8ed0('0x36')]();};}function saveUpdates(_0x468683,_0x4a2fc0){return function(_0x27a3fb){if(_0x27a3fb){return _0x27a3fb['update'](_0x468683)[_0x8ed0('0x37')](function(_0x1c4642){return _0x1c4642;});}return null;};}function removeEntity(_0xa1483,_0x18b564){return function(_0x1cfd71){if(_0x1cfd71){return _0x1cfd71[_0x8ed0('0x38')]()[_0x8ed0('0x37')](function(){_0xa1483[_0x8ed0('0x2e')](0xcc)[_0x8ed0('0x39')]();});}};}function handleEntityNotFound(_0x152f3b,_0x1b7a94){return function(_0x15c206){if(!_0x15c206){_0x152f3b[_0x8ed0('0x2d')](0x194);}return _0x15c206;};}function handleError(_0x4b50d0,_0x3ddeb4){_0x3ddeb4=_0x3ddeb4||0x1f4;return function(_0x58b2b6){logger[_0x8ed0('0x29')](_0x58b2b6['stack']);if(_0x58b2b6[_0x8ed0('0x3a')]){delete _0x58b2b6[_0x8ed0('0x3a')];}_0x4b50d0[_0x8ed0('0x2e')](_0x3ddeb4)['send'](_0x58b2b6);};}exports[_0x8ed0('0x3b')]=function(_0xb58797,_0x19777e){var _0x573048={},_0x5847bd={},_0x399b1={'count':0x0,'rows':[]};var _0x2c155a=_[_0x8ed0('0x3c')](db[_0x8ed0('0x3d')]['rawAttributes'],function(_0x22257b){return{'name':_0x22257b['fieldName'],'type':_0x22257b[_0x8ed0('0x3e')][_0x8ed0('0x3f')]};});_0x5847bd['model']=_[_0x8ed0('0x3c')](_0x2c155a,_0x8ed0('0x3a'));_0x5847bd[_0x8ed0('0x40')]=_[_0x8ed0('0x41')](_0xb58797[_0x8ed0('0x40')]);_0x5847bd[_0x8ed0('0x42')]=_[_0x8ed0('0x43')](_0x5847bd['model'],_0x5847bd[_0x8ed0('0x40')]);_0x573048[_0x8ed0('0x44')]=_[_0x8ed0('0x43')](_0x5847bd[_0x8ed0('0x45')],qs[_0x8ed0('0x46')](_0xb58797[_0x8ed0('0x40')]['fields']));_0x573048[_0x8ed0('0x44')]=_0x573048[_0x8ed0('0x44')][_0x8ed0('0x47')]?_0x573048[_0x8ed0('0x44')]:_0x5847bd[_0x8ed0('0x45')];if(!_0xb58797[_0x8ed0('0x40')][_0x8ed0('0x48')](_0x8ed0('0x49'))){_0x573048[_0x8ed0('0x4a')]=qs[_0x8ed0('0x4a')](_0xb58797[_0x8ed0('0x40')][_0x8ed0('0x4a')]);_0x573048['offset']=qs[_0x8ed0('0x30')](_0xb58797['query'][_0x8ed0('0x30')]);}_0x573048[_0x8ed0('0x4b')]=qs['sort'](_0xb58797['query'][_0x8ed0('0x4c')]);_0x573048[_0x8ed0('0x4d')]=qs['filters'](_[_0x8ed0('0x4e')](_0xb58797[_0x8ed0('0x40')],_0x5847bd[_0x8ed0('0x42')]),_0x2c155a);if(_0xb58797[_0x8ed0('0x40')][_0x8ed0('0x4f')]){_0x573048[_0x8ed0('0x4d')]=_[_0x8ed0('0x50')](_0x573048['where'],{'$or':_[_0x8ed0('0x3c')](_0x2c155a,function(_0x3291dd){if(_0x3291dd[_0x8ed0('0x3e')]!==_0x8ed0('0x51')){var _0xf8851a={};_0xf8851a[_0x3291dd['name']]={'$like':'%'+_0xb58797[_0x8ed0('0x40')]['filter']+'%'};return _0xf8851a;}})});}_0x573048=_[_0x8ed0('0x50')]({},_0x573048,_0xb58797[_0x8ed0('0x52')]);var _0x3d8e4f={'where':_0x573048[_0x8ed0('0x4d')]};return db[_0x8ed0('0x3d')][_0x8ed0('0x31')](_0x3d8e4f)[_0x8ed0('0x37')](function(_0x484945){_0x399b1[_0x8ed0('0x31')]=_0x484945;if(_0xb58797[_0x8ed0('0x40')][_0x8ed0('0x53')]){_0x573048[_0x8ed0('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8ed0('0x55')](_0x573048);})['then'](function(_0x9d8e2){_0x399b1['rows']=_0x9d8e2;return _0x399b1;})[_0x8ed0('0x37')](respondWithFilteredResult(_0x19777e,_0x573048))['catch'](handleError(_0x19777e,null));};exports[_0x8ed0('0x56')]=function(_0x55f1d7,_0x62701d){var _0x566ceb={'raw':!![],'where':{'id':_0x55f1d7['params']['id']}},_0x43643f={};_0x43643f['model']=_[_0x8ed0('0x41')](db[_0x8ed0('0x3d')][_0x8ed0('0x57')]);_0x43643f[_0x8ed0('0x40')]=_[_0x8ed0('0x41')](_0x55f1d7[_0x8ed0('0x40')]);_0x43643f[_0x8ed0('0x42')]=_['intersection'](_0x43643f[_0x8ed0('0x45')],_0x43643f[_0x8ed0('0x40')]);_0x566ceb[_0x8ed0('0x44')]=_[_0x8ed0('0x43')](_0x43643f['model'],qs[_0x8ed0('0x46')](_0x55f1d7['query']['fields']));_0x566ceb[_0x8ed0('0x44')]=_0x566ceb[_0x8ed0('0x44')][_0x8ed0('0x47')]?_0x566ceb[_0x8ed0('0x44')]:_0x43643f[_0x8ed0('0x45')];if(_0x55f1d7[_0x8ed0('0x40')][_0x8ed0('0x53')]){_0x566ceb['include']=[{'all':!![]}];}_0x566ceb=_[_0x8ed0('0x50')]({},_0x566ceb,_0x55f1d7[_0x8ed0('0x52')]);return db['OpenchannelMessage'][_0x8ed0('0x58')](_0x566ceb)[_0x8ed0('0x37')](handleEntityNotFound(_0x62701d,null))[_0x8ed0('0x37')](respondWithResult(_0x62701d,null))[_0x8ed0('0x2c')](handleError(_0x62701d,null));};exports[_0x8ed0('0x59')]=function(_0x410436,_0x3f90f4){return db[_0x8ed0('0x3d')][_0x8ed0('0x59')](_0x410436['body'],{})['then'](respondWithResult(_0x3f90f4,0xc9))[_0x8ed0('0x2c')](handleError(_0x3f90f4,null));};exports[_0x8ed0('0x5a')]=function(_0x2b9c32,_0x4183e4){if(_0x2b9c32[_0x8ed0('0x5b')]['id']){delete _0x2b9c32[_0x8ed0('0x5b')]['id'];}return db[_0x8ed0('0x3d')][_0x8ed0('0x58')]({'where':{'id':_0x2b9c32[_0x8ed0('0x5c')]['id']}})[_0x8ed0('0x37')](handleEntityNotFound(_0x4183e4,null))[_0x8ed0('0x37')](saveUpdates(_0x2b9c32[_0x8ed0('0x5b')],null))[_0x8ed0('0x37')](respondWithResult(_0x4183e4,null))[_0x8ed0('0x2c')](handleError(_0x4183e4,null));};exports[_0x8ed0('0x38')]=function(_0x3de2c9,_0x2b3865){return db['OpenchannelMessage'][_0x8ed0('0x58')]({'where':{'id':_0x3de2c9['params']['id']}})[_0x8ed0('0x37')](handleEntityNotFound(_0x2b3865,null))[_0x8ed0('0x37')](removeEntity(_0x2b3865,null))[_0x8ed0('0x2c')](handleError(_0x2b3865,null));};exports['describe']=function(_0x421031,_0x5aa7c8){return db[_0x8ed0('0x3d')]['describe']()[_0x8ed0('0x37')](respondWithResult(_0x5aa7c8,null))[_0x8ed0('0x2c')](handleError(_0x5aa7c8,null));};var interaction_log=require(_0x8ed0('0x16'))('openchannel-interactions');exports[_0x8ed0('0x5d')]=function(_0x1e610f,_0x2233e8,_0x3f5534){var _0x33e48d={'agent':{},'channel':_0x8ed0('0x5e')};if(_0x1e610f['body']['id']){delete _0x1e610f[_0x8ed0('0x5b')]['id'];}_0x1e610f[_0x8ed0('0x5b')][_0x8ed0('0x5f')]=!![];_0x1e610f[_0x8ed0('0x5b')]['readAt']=moment()['format'](_0x8ed0('0x60'));_0x1e610f[_0x8ed0('0x5b')]['UserId']=_0x1e610f['body'][_0x8ed0('0x61')]||_0x1e610f['user']['id'];_0x33e48d['agent']['id']=_0x1e610f['body'][_0x8ed0('0x61')];return db[_0x8ed0('0x3d')][_0x8ed0('0x58')]({'where':{'id':_0x1e610f[_0x8ed0('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2233e8,null))[_0x8ed0('0x37')](saveUpdates(_0x1e610f[_0x8ed0('0x5b')],null))[_0x8ed0('0x37')](function(_0x20ea44){if(_0x20ea44){_0x33e48d[_0x8ed0('0x2a')]=_0x20ea44[_0x8ed0('0x62')]({'plain':!![]});return db[_0x8ed0('0x63')][_0x8ed0('0x58')]({'where':{'id':_0x20ea44[_0x8ed0('0x64')]}});}return null;})[_0x8ed0('0x37')](handleEntityNotFound(_0x2233e8,null))['then'](function(_0x22d82a){if(_0x22d82a){return _0x22d82a[_0x8ed0('0x5a')]({'UserId':_0x1e610f['body'][_0x8ed0('0x61')],'read1stAt':_['isNil'](_0x22d82a[_0x8ed0('0x65')])?moment()[_0x8ed0('0x66')](_0x8ed0('0x60')):undefined});}return null;})[_0x8ed0('0x37')](function(_0x380111){if(_0x380111){_0x33e48d[_0x8ed0('0x67')]=_0x380111[_0x8ed0('0x62')]({'plain':!![]});interaction_log[_0x8ed0('0x23')](_0x8ed0('0x68'),_0x1e610f[_0x8ed0('0x69')]['id'],_0x1e610f[_0x8ed0('0x69')][_0x8ed0('0x3a')],_0x1e610f[_0x8ed0('0x69')][_0x8ed0('0x6a')],_0x33e48d[_0x8ed0('0x67')]['id'],_0x1e610f[_0x8ed0('0x5b')]?JSON[_0x8ed0('0x28')](_0x1e610f['body']):_0x8ed0('0x6b'));return respondWithRpcPromise(_0x8ed0('0x6c'),_0x8ed0('0x6d'),_0x33e48d);}return null;})[_0x8ed0('0x37')](function(_0x114a95){var _0xa22330=_0x8ed0('0x6e')+_0x114a95[_0x8ed0('0x2a')]['ContactId'];return db[_0x8ed0('0x6f')][_0x8ed0('0x40')](_0xa22330,{'type':db[_0x8ed0('0x70')][_0x8ed0('0x71')][_0x8ed0('0x72')],'raw':!![]})[_0x8ed0('0x37')](function(_0x485d10){return _0x485d10;});})[_0x8ed0('0x37')](function(_0x7b4a8d){if(_0x7b4a8d){_0x33e48d[_0x8ed0('0x2a')][_0x8ed0('0x73')]=_0x7b4a8d[0x0];if(!_0x1e610f['body'][_0x8ed0('0x61')])return;return db[_0x8ed0('0x74')][_0x8ed0('0x58')]({'where':{'id':_0x1e610f[_0x8ed0('0x5b')][_0x8ed0('0x61')],'role':'agent'},'attributes':['id','name',_0x8ed0('0x75'),_0x8ed0('0x76'),_0x8ed0('0x77')],'raw':!![]});}return null;})[_0x8ed0('0x37')](function(_0x1d19ac){if(!_0x1d19ac)return null;_0x33e48d[_0x8ed0('0x2a')]['agent']=_0x1d19ac;return _0x33e48d;})[_0x8ed0('0x37')](function(_0xe82ab5){if(_0xe82ab5){if(_0x1e610f[_0x8ed0('0x5b')]['manual']){_0x33e48d[_0x8ed0('0x2a')][_0x8ed0('0x78')]=util[_0x8ed0('0x66')](_0x8ed0('0x79'),_0x1e610f[_0x8ed0('0x69')][_0x8ed0('0x3a')]);_0x33e48d['message'][_0x8ed0('0x7a')]=_0x33e48d[_0x8ed0('0x7a')];_0x33e48d[_0x8ed0('0x2a')][_0x8ed0('0x7b')]=_0x33e48d['channel'];_0x33e48d[_0x8ed0('0x2a')][_0x8ed0('0x7c')]='accept';return respondWithRpcPromise(_0x8ed0('0x7d'),'EventManager',{'event':_0x8ed0('0x7e'),'message':_0x33e48d[_0x8ed0('0x2a')]},client9002)[_0x8ed0('0x37')](function(){return _0x33e48d;});}return _0x33e48d;}return null;})[_0x8ed0('0x37')](respondWithResult(_0x2233e8,null))['catch'](handleError(_0x2233e8,null));};var interaction_log=require(_0x8ed0('0x16'))(_0x8ed0('0x7f'));exports[_0x8ed0('0x35')]=function(_0x889d9,_0x41470b,_0x155a62){var _0xbaf6bf={'agent':{},'channel':'openchannel'};if(_0x889d9[_0x8ed0('0x5b')]['id']){delete _0x889d9['body']['id'];}_0x889d9['body']['UserId']=_0x889d9[_0x8ed0('0x5b')][_0x8ed0('0x61')]||_0x889d9[_0x8ed0('0x69')]['id'];_0xbaf6bf[_0x8ed0('0x80')]['id']=_0x889d9[_0x8ed0('0x5b')][_0x8ed0('0x61')];return db['OpenchannelMessage'][_0x8ed0('0x58')]({'where':{'id':_0x889d9['params']['id'],'UserId':null}})[_0x8ed0('0x37')](handleEntityNotFound(_0x41470b,null))[_0x8ed0('0x37')](function(_0x4fcb24){if(_0x4fcb24){_0xbaf6bf[_0x8ed0('0x2a')]=_0x4fcb24[_0x8ed0('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4fcb24[_0x8ed0('0x64')]}});}return null;})[_0x8ed0('0x37')](handleEntityNotFound(_0x41470b,null))[_0x8ed0('0x37')](function(_0x3f0ff5){if(_0x3f0ff5){_0xbaf6bf['interaction']=_0x3f0ff5[_0x8ed0('0x62')]({'plain':!![]});interaction_log[_0x8ed0('0x23')](_0x8ed0('0x81'),_0x889d9[_0x8ed0('0x69')]['id'],_0x889d9[_0x8ed0('0x69')][_0x8ed0('0x3a')],_0x889d9[_0x8ed0('0x69')]['role'],_0xbaf6bf['interaction']['id'],_0x889d9[_0x8ed0('0x5b')]?JSON['stringify'](_0x889d9[_0x8ed0('0x5b')]):_0x8ed0('0x6b'));return respondWithRpcPromise('RejectMessage',_0x8ed0('0x82'),_0xbaf6bf);}return null;})['then'](function(_0x1a9e72){var _0x59d76f=_0x8ed0('0x6e')+_0x1a9e72[_0x8ed0('0x2a')][_0x8ed0('0x83')];return db[_0x8ed0('0x6f')][_0x8ed0('0x40')](_0x59d76f,{'type':db[_0x8ed0('0x70')][_0x8ed0('0x71')][_0x8ed0('0x72')],'raw':!![]})[_0x8ed0('0x37')](function(_0x573a1a){return _0x573a1a;});})['then'](function(_0x284c1d){if(_0x284c1d){_0xbaf6bf[_0x8ed0('0x2a')]['contact']=_0x284c1d[0x0];if(!_0x889d9[_0x8ed0('0x5b')][_0x8ed0('0x61')])return;return db[_0x8ed0('0x74')]['find']({'where':{'id':_0x889d9[_0x8ed0('0x5b')]['UserId'],'role':_0x8ed0('0x80')},'attributes':['id',_0x8ed0('0x3a'),_0x8ed0('0x75'),_0x8ed0('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1f2bb7){if(!_0x1f2bb7)return null;_0xbaf6bf[_0x8ed0('0x2a')][_0x8ed0('0x80')]=_0x1f2bb7;return _0xbaf6bf;})[_0x8ed0('0x37')](function(_0x582321){if(_0x582321){_0x582321[_0x8ed0('0x2a')]['interface']=util[_0x8ed0('0x66')](_0x8ed0('0x79'),_0x889d9['user'][_0x8ed0('0x3a')]);_0x582321[_0x8ed0('0x2a')][_0x8ed0('0x7a')]=_0xbaf6bf[_0x8ed0('0x7a')];_0x582321[_0x8ed0('0x2a')]['motionChannel']=_0xbaf6bf[_0x8ed0('0x7a')];_0x582321['message']['event']='reject';respondWithRpcPromise(_0x8ed0('0x7d'),_0x8ed0('0x7d'),{'event':_0x8ed0('0x84'),'message':_0x582321[_0x8ed0('0x2a')]},client9002);return _0xbaf6bf;}return null;})[_0x8ed0('0x37')](respondWithResult(_0x41470b,null))['catch'](handleError(_0x41470b,null));}; \ No newline at end of file +var _0x0f50=['user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','interface','motionChannel','channel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','contact','User','SIP/%s','event','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','create','body','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0x0f50,0x123));var _0x00f5=function(_0x1cd389,_0xe31783){_0x1cd389=_0x1cd389-0x0;var _0x114696=_0x0f50[_0x1cd389];return _0x114696;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00f5('0x0'));var zipdir=require(_0x00f5('0x1'));var jsonpatch=require(_0x00f5('0x2'));var rp=require('request-promise');var moment=require(_0x00f5('0x3'));var BPromise=require(_0x00f5('0x4'));var Mustache=require(_0x00f5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x00f5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00f5('0x7'));var _=require(_0x00f5('0x8'));var squel=require(_0x00f5('0x9'));var crypto=require(_0x00f5('0xa'));var jsforce=require(_0x00f5('0xb'));var deskjs=require(_0x00f5('0xc'));var toCsv=require(_0x00f5('0x6'));var querystring=require(_0x00f5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x00f5('0xe'));var qs=require(_0x00f5('0xf'));var as=require(_0x00f5('0x10'));var hardwareService=require(_0x00f5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x00f5('0x12'));var config=require(_0x00f5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x00f5('0x14'))['db'];config[_0x00f5('0x15')]=_['defaults'](config[_0x00f5('0x15')],{'host':_0x00f5('0x16'),'port':0x18eb});var socket=require(_0x00f5('0x17'))(new Redis(config[_0x00f5('0x15')]));require(_0x00f5('0x18'))[_0x00f5('0x19')](socket);var jayson=require(_0x00f5('0x1a'));var client=jayson[_0x00f5('0x1b')][_0x00f5('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x00f5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x50e2a8,_0x538168,_0x4417b3,_0x24c391){return new BPromise(function(_0x3d03d1,_0x301fe2){var _0xad93fb=_0x24c391||client;return _0xad93fb['request'](_0x50e2a8,_0x4417b3)['then'](function(_0x13f4b2){logger[_0x00f5('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x538168,_0x00f5('0x1e'));logger[_0x00f5('0x1f')](_0x00f5('0x20'),_0x538168,_0x00f5('0x1e'),JSON['stringify'](_0x13f4b2));if(_0x13f4b2[_0x00f5('0x21')]){if(_0x13f4b2[_0x00f5('0x21')]['code']===0x1f4){logger['error'](_0x00f5('0x22'),_0x538168,_0x13f4b2[_0x00f5('0x21')][_0x00f5('0x23')]);return _0x301fe2(_0x13f4b2['error'][_0x00f5('0x23')]);}logger[_0x00f5('0x21')](_0x00f5('0x22'),_0x538168,_0x13f4b2[_0x00f5('0x21')][_0x00f5('0x23')]);return _0x3d03d1(_0x13f4b2[_0x00f5('0x21')][_0x00f5('0x23')]);}else{logger[_0x00f5('0x1d')](_0x00f5('0x22'),_0x538168,_0x00f5('0x1e'));_0x3d03d1(_0x13f4b2[_0x00f5('0x24')][_0x00f5('0x23')]);}})[_0x00f5('0x25')](function(_0x54eed8){logger[_0x00f5('0x21')](_0x00f5('0x22'),_0x538168,_0x54eed8);_0x301fe2(_0x54eed8);});});}function respondWithStatusCode(_0x1b7359,_0x23157f){_0x23157f=_0x23157f||0xcc;return function(_0x1ca226){if(_0x1ca226){return _0x1b7359[_0x00f5('0x26')](_0x23157f);}return _0x1b7359['status'](_0x23157f)[_0x00f5('0x27')]();};}function respondWithResult(_0x44ce14,_0x18990d){_0x18990d=_0x18990d||0xc8;return function(_0x1f79c1){if(_0x1f79c1){return _0x44ce14[_0x00f5('0x28')](_0x18990d)[_0x00f5('0x29')](_0x1f79c1);}};}function respondWithFilteredResult(_0x54f4f8,_0x79dd74){return function(_0x3c62b2){if(_0x3c62b2){var _0x49afca=typeof _0x79dd74[_0x00f5('0x2a')]===_0x00f5('0x2b')&&typeof _0x79dd74['limit']===_0x00f5('0x2b');var _0x1916e7=_0x3c62b2[_0x00f5('0x2c')];var _0x341d16=_0x49afca?0x0:_0x79dd74['offset'];var _0x48f98f=_0x49afca?_0x3c62b2[_0x00f5('0x2c')]:_0x79dd74[_0x00f5('0x2a')]+_0x79dd74['limit'];var _0x35aa9a;if(_0x48f98f>=_0x1916e7){_0x48f98f=_0x1916e7;_0x35aa9a=0xc8;}else{_0x35aa9a=0xce;}_0x54f4f8['status'](_0x35aa9a);return _0x54f4f8[_0x00f5('0x2d')](_0x00f5('0x2e'),_0x341d16+'-'+_0x48f98f+'/'+_0x1916e7)[_0x00f5('0x29')](_0x3c62b2);}return null;};}function patchUpdates(_0x3c58db){return function(_0x208eee){try{jsonpatch['apply'](_0x208eee,_0x3c58db,!![]);}catch(_0x232b9c){return BPromise[_0x00f5('0x2f')](_0x232b9c);}return _0x208eee[_0x00f5('0x30')]();};}function saveUpdates(_0x4e11a4,_0x5f593c){return function(_0x2268a2){if(_0x2268a2){return _0x2268a2[_0x00f5('0x31')](_0x4e11a4)[_0x00f5('0x32')](function(_0x2bb1f7){return _0x2bb1f7;});}return null;};}function removeEntity(_0x2f2849,_0x986aee){return function(_0x31e711){if(_0x31e711){return _0x31e711[_0x00f5('0x33')]()['then'](function(){_0x2f2849['status'](0xcc)[_0x00f5('0x27')]();});}};}function handleEntityNotFound(_0x1789a0,_0x5e1ecc){return function(_0x11e7e0){if(!_0x11e7e0){_0x1789a0[_0x00f5('0x26')](0x194);}return _0x11e7e0;};}function handleError(_0x115033,_0x1e03e3){_0x1e03e3=_0x1e03e3||0x1f4;return function(_0x26b5f9){logger['error'](_0x26b5f9[_0x00f5('0x34')]);if(_0x26b5f9[_0x00f5('0x35')]){delete _0x26b5f9[_0x00f5('0x35')];}_0x115033[_0x00f5('0x28')](_0x1e03e3)[_0x00f5('0x36')](_0x26b5f9);};}exports[_0x00f5('0x37')]=function(_0x1afe3e,_0x14e09a){var _0x5b821d={},_0x3f9086={},_0x4cdccf={'count':0x0,'rows':[]};var _0x5881ac=_[_0x00f5('0x38')](db[_0x00f5('0x39')][_0x00f5('0x3a')],function(_0x508104){return{'name':_0x508104[_0x00f5('0x3b')],'type':_0x508104['type']['key']};});_0x3f9086[_0x00f5('0x3c')]=_[_0x00f5('0x38')](_0x5881ac,_0x00f5('0x35'));_0x3f9086[_0x00f5('0x3d')]=_[_0x00f5('0x3e')](_0x1afe3e[_0x00f5('0x3d')]);_0x3f9086['filters']=_[_0x00f5('0x3f')](_0x3f9086['model'],_0x3f9086[_0x00f5('0x3d')]);_0x5b821d[_0x00f5('0x40')]=_[_0x00f5('0x3f')](_0x3f9086[_0x00f5('0x3c')],qs[_0x00f5('0x41')](_0x1afe3e['query'][_0x00f5('0x41')]));_0x5b821d[_0x00f5('0x40')]=_0x5b821d[_0x00f5('0x40')][_0x00f5('0x42')]?_0x5b821d[_0x00f5('0x40')]:_0x3f9086[_0x00f5('0x3c')];if(!_0x1afe3e[_0x00f5('0x3d')][_0x00f5('0x43')](_0x00f5('0x44'))){_0x5b821d[_0x00f5('0x45')]=qs['limit'](_0x1afe3e[_0x00f5('0x3d')][_0x00f5('0x45')]);_0x5b821d['offset']=qs[_0x00f5('0x2a')](_0x1afe3e[_0x00f5('0x3d')]['offset']);}_0x5b821d[_0x00f5('0x46')]=qs[_0x00f5('0x47')](_0x1afe3e['query'][_0x00f5('0x47')]);_0x5b821d['where']=qs[_0x00f5('0x48')](_[_0x00f5('0x49')](_0x1afe3e[_0x00f5('0x3d')],_0x3f9086[_0x00f5('0x48')]),_0x5881ac);if(_0x1afe3e['query']['filter']){_0x5b821d[_0x00f5('0x4a')]=_['merge'](_0x5b821d['where'],{'$or':_[_0x00f5('0x38')](_0x5881ac,function(_0x2821f7){if(_0x2821f7[_0x00f5('0x4b')]!==_0x00f5('0x4c')){var _0x4cda9a={};_0x4cda9a[_0x2821f7['name']]={'$like':'%'+_0x1afe3e['query']['filter']+'%'};return _0x4cda9a;}})});}_0x5b821d=_['merge']({},_0x5b821d,_0x1afe3e[_0x00f5('0x4d')]);var _0x14a2ad={'where':_0x5b821d[_0x00f5('0x4a')]};return db[_0x00f5('0x39')][_0x00f5('0x2c')](_0x14a2ad)['then'](function(_0x4206b0){_0x4cdccf[_0x00f5('0x2c')]=_0x4206b0;if(_0x1afe3e[_0x00f5('0x3d')][_0x00f5('0x4e')]){_0x5b821d[_0x00f5('0x4f')]=[{'all':!![]}];}return db[_0x00f5('0x39')][_0x00f5('0x50')](_0x5b821d);})[_0x00f5('0x32')](function(_0x4d9e2e){_0x4cdccf[_0x00f5('0x51')]=_0x4d9e2e;return _0x4cdccf;})[_0x00f5('0x32')](respondWithFilteredResult(_0x14e09a,_0x5b821d))[_0x00f5('0x25')](handleError(_0x14e09a,null));};exports['show']=function(_0xb90ea6,_0x26b632){var _0x303ef2={'raw':!![],'where':{'id':_0xb90ea6[_0x00f5('0x52')]['id']}},_0x15f978={};_0x15f978[_0x00f5('0x3c')]=_['keys'](db['OpenchannelMessage'][_0x00f5('0x3a')]);_0x15f978[_0x00f5('0x3d')]=_[_0x00f5('0x3e')](_0xb90ea6[_0x00f5('0x3d')]);_0x15f978[_0x00f5('0x48')]=_[_0x00f5('0x3f')](_0x15f978['model'],_0x15f978['query']);_0x303ef2[_0x00f5('0x40')]=_[_0x00f5('0x3f')](_0x15f978[_0x00f5('0x3c')],qs[_0x00f5('0x41')](_0xb90ea6[_0x00f5('0x3d')]['fields']));_0x303ef2[_0x00f5('0x40')]=_0x303ef2[_0x00f5('0x40')][_0x00f5('0x42')]?_0x303ef2[_0x00f5('0x40')]:_0x15f978['model'];if(_0xb90ea6[_0x00f5('0x3d')]['includeAll']){_0x303ef2[_0x00f5('0x4f')]=[{'all':!![]}];}_0x303ef2=_[_0x00f5('0x53')]({},_0x303ef2,_0xb90ea6[_0x00f5('0x4d')]);return db[_0x00f5('0x39')][_0x00f5('0x54')](_0x303ef2)[_0x00f5('0x32')](handleEntityNotFound(_0x26b632,null))['then'](respondWithResult(_0x26b632,null))[_0x00f5('0x25')](handleError(_0x26b632,null));};exports[_0x00f5('0x55')]=function(_0x2c60a9,_0x54d48b){return db['OpenchannelMessage']['create'](_0x2c60a9[_0x00f5('0x56')],{})['then'](respondWithResult(_0x54d48b,0xc9))['catch'](handleError(_0x54d48b,null));};exports['update']=function(_0x2e8cac,_0x20288e){if(_0x2e8cac[_0x00f5('0x56')]['id']){delete _0x2e8cac[_0x00f5('0x56')]['id'];}return db['OpenchannelMessage'][_0x00f5('0x54')]({'where':{'id':_0x2e8cac[_0x00f5('0x52')]['id']}})['then'](handleEntityNotFound(_0x20288e,null))[_0x00f5('0x32')](saveUpdates(_0x2e8cac[_0x00f5('0x56')],null))['then'](respondWithResult(_0x20288e,null))['catch'](handleError(_0x20288e,null));};exports['destroy']=function(_0x5d5844,_0x137217){return db[_0x00f5('0x39')][_0x00f5('0x54')]({'where':{'id':_0x5d5844[_0x00f5('0x52')]['id']}})[_0x00f5('0x32')](handleEntityNotFound(_0x137217,null))['then'](removeEntity(_0x137217,null))[_0x00f5('0x25')](handleError(_0x137217,null));};exports[_0x00f5('0x57')]=function(_0x9fddc4,_0x5b34fd){return db[_0x00f5('0x39')][_0x00f5('0x57')]()[_0x00f5('0x32')](respondWithResult(_0x5b34fd,null))[_0x00f5('0x25')](handleError(_0x5b34fd,null));};var interaction_log=require(_0x00f5('0x58'))(_0x00f5('0x59'));exports['accept']=function(_0x305a8d,_0x4d9322,_0x316ff8){var _0x1ecc93={'agent':{},'channel':_0x00f5('0x5a')};if(_0x305a8d[_0x00f5('0x56')]['id']){delete _0x305a8d[_0x00f5('0x56')]['id'];}_0x305a8d['body'][_0x00f5('0x5b')]=!![];_0x305a8d[_0x00f5('0x56')][_0x00f5('0x5c')]=moment()[_0x00f5('0x5d')](_0x00f5('0x5e'));_0x305a8d[_0x00f5('0x56')][_0x00f5('0x5f')]=_0x305a8d['body']['UserId']||_0x305a8d[_0x00f5('0x60')]['id'];_0x1ecc93[_0x00f5('0x61')]['id']=_0x305a8d['body'][_0x00f5('0x5f')];return db[_0x00f5('0x39')][_0x00f5('0x54')]({'where':{'id':_0x305a8d[_0x00f5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d9322,null))[_0x00f5('0x32')](saveUpdates(_0x305a8d['body'],null))[_0x00f5('0x32')](function(_0x20ec67){if(_0x20ec67){_0x1ecc93[_0x00f5('0x23')]=_0x20ec67[_0x00f5('0x62')]({'plain':!![]});return db[_0x00f5('0x63')][_0x00f5('0x54')]({'where':{'id':_0x20ec67[_0x00f5('0x64')]}});}return null;})[_0x00f5('0x32')](handleEntityNotFound(_0x4d9322,null))[_0x00f5('0x32')](function(_0x285ec1){if(_0x285ec1){return _0x285ec1[_0x00f5('0x31')]({'UserId':_0x305a8d['body'][_0x00f5('0x5f')],'read1stAt':_['isNil'](_0x285ec1[_0x00f5('0x65')])?moment()[_0x00f5('0x5d')](_0x00f5('0x5e')):undefined});}return null;})[_0x00f5('0x32')](function(_0x15de8c){if(_0x15de8c){_0x1ecc93[_0x00f5('0x66')]=_0x15de8c[_0x00f5('0x62')]({'plain':!![]});interaction_log[_0x00f5('0x1d')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x305a8d['user']['id'],_0x305a8d[_0x00f5('0x60')]['name'],_0x305a8d[_0x00f5('0x60')][_0x00f5('0x67')],_0x1ecc93[_0x00f5('0x66')]['id'],_0x305a8d[_0x00f5('0x56')]?JSON['stringify'](_0x305a8d[_0x00f5('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x00f5('0x68'),_0x1ecc93);}return null;})['then'](function(_0x39b8dc){var _0x13dcb4=_0x00f5('0x69')+_0x39b8dc[_0x00f5('0x23')][_0x00f5('0x6a')];return db[_0x00f5('0x6b')][_0x00f5('0x3d')](_0x13dcb4,{'type':db[_0x00f5('0x6c')][_0x00f5('0x6d')][_0x00f5('0x6e')],'raw':!![]})[_0x00f5('0x32')](function(_0xfd3a84){return _0xfd3a84;});})[_0x00f5('0x32')](function(_0x419688){if(_0x419688){_0x1ecc93[_0x00f5('0x23')]['contact']=_0x419688[0x0];if(!_0x305a8d[_0x00f5('0x56')][_0x00f5('0x5f')])return;return db['User'][_0x00f5('0x54')]({'where':{'id':_0x305a8d[_0x00f5('0x56')][_0x00f5('0x5f')],'role':_0x00f5('0x61')},'attributes':['id',_0x00f5('0x35'),_0x00f5('0x6f'),_0x00f5('0x70'),_0x00f5('0x71')],'raw':!![]});}return null;})[_0x00f5('0x32')](function(_0x45ace8){if(!_0x45ace8)return null;_0x1ecc93[_0x00f5('0x23')][_0x00f5('0x61')]=_0x45ace8;return _0x1ecc93;})[_0x00f5('0x32')](function(_0x1ae0e0){if(_0x1ae0e0){if(_0x305a8d[_0x00f5('0x56')]['manual']){_0x1ecc93[_0x00f5('0x23')][_0x00f5('0x72')]=util[_0x00f5('0x5d')]('SIP/%s',_0x305a8d['user'][_0x00f5('0x35')]);_0x1ecc93[_0x00f5('0x23')]['channel']=_0x1ecc93['channel'];_0x1ecc93['message'][_0x00f5('0x73')]=_0x1ecc93[_0x00f5('0x74')];_0x1ecc93[_0x00f5('0x23')]['event']=_0x00f5('0x75');return respondWithRpcPromise(_0x00f5('0x76'),_0x00f5('0x76'),{'event':_0x00f5('0x77'),'message':_0x1ecc93[_0x00f5('0x23')]},client9002)[_0x00f5('0x32')](function(){return _0x1ecc93;});}return _0x1ecc93;}return null;})[_0x00f5('0x32')](respondWithResult(_0x4d9322,null))[_0x00f5('0x25')](handleError(_0x4d9322,null));};var interaction_log=require('../../config/logger')(_0x00f5('0x59'));exports[_0x00f5('0x2f')]=function(_0x358ba7,_0x30fadf,_0x19a5f1){var _0x2f4908={'agent':{},'channel':_0x00f5('0x5a')};if(_0x358ba7[_0x00f5('0x56')]['id']){delete _0x358ba7[_0x00f5('0x56')]['id'];}_0x358ba7[_0x00f5('0x56')][_0x00f5('0x5f')]=_0x358ba7[_0x00f5('0x56')][_0x00f5('0x5f')]||_0x358ba7[_0x00f5('0x60')]['id'];_0x2f4908[_0x00f5('0x61')]['id']=_0x358ba7[_0x00f5('0x56')][_0x00f5('0x5f')];return db['OpenchannelMessage'][_0x00f5('0x54')]({'where':{'id':_0x358ba7[_0x00f5('0x52')]['id'],'UserId':null}})[_0x00f5('0x32')](handleEntityNotFound(_0x30fadf,null))[_0x00f5('0x32')](function(_0x193079){if(_0x193079){_0x2f4908[_0x00f5('0x23')]=_0x193079[_0x00f5('0x62')]({'plain':!![]});return db[_0x00f5('0x63')]['find']({'where':{'id':_0x193079[_0x00f5('0x64')]}});}return null;})[_0x00f5('0x32')](handleEntityNotFound(_0x30fadf,null))['then'](function(_0x3281f7){if(_0x3281f7){_0x2f4908[_0x00f5('0x66')]=_0x3281f7[_0x00f5('0x62')]({'plain':!![]});interaction_log[_0x00f5('0x1d')](_0x00f5('0x78'),_0x358ba7['user']['id'],_0x358ba7['user'][_0x00f5('0x35')],_0x358ba7[_0x00f5('0x60')][_0x00f5('0x67')],_0x2f4908[_0x00f5('0x66')]['id'],_0x358ba7[_0x00f5('0x56')]?JSON[_0x00f5('0x79')](_0x358ba7['body']):_0x00f5('0x7a'));return respondWithRpcPromise('RejectMessage',_0x00f5('0x7b'),_0x2f4908);}return null;})['then'](function(_0x34db91){var _0xca2343=_0x00f5('0x69')+_0x34db91[_0x00f5('0x23')][_0x00f5('0x6a')];return db[_0x00f5('0x6b')][_0x00f5('0x3d')](_0xca2343,{'type':db[_0x00f5('0x6c')][_0x00f5('0x6d')][_0x00f5('0x6e')],'raw':!![]})[_0x00f5('0x32')](function(_0xb9852){return _0xb9852;});})[_0x00f5('0x32')](function(_0x2c0c48){if(_0x2c0c48){_0x2f4908['message'][_0x00f5('0x7c')]=_0x2c0c48[0x0];if(!_0x358ba7[_0x00f5('0x56')][_0x00f5('0x5f')])return;return db[_0x00f5('0x7d')][_0x00f5('0x54')]({'where':{'id':_0x358ba7[_0x00f5('0x56')][_0x00f5('0x5f')],'role':_0x00f5('0x61')},'attributes':['id',_0x00f5('0x35'),_0x00f5('0x6f'),_0x00f5('0x70'),_0x00f5('0x71')],'raw':!![]});}return null;})[_0x00f5('0x32')](function(_0x5227bd){if(!_0x5227bd)return null;_0x2f4908[_0x00f5('0x23')][_0x00f5('0x61')]=_0x5227bd;return _0x2f4908;})[_0x00f5('0x32')](function(_0x3ae5c3){if(_0x3ae5c3){_0x3ae5c3[_0x00f5('0x23')][_0x00f5('0x72')]=util['format'](_0x00f5('0x7e'),_0x358ba7[_0x00f5('0x60')]['name']);_0x3ae5c3[_0x00f5('0x23')]['channel']=_0x2f4908[_0x00f5('0x74')];_0x3ae5c3[_0x00f5('0x23')][_0x00f5('0x73')]=_0x2f4908['channel'];_0x3ae5c3['message'][_0x00f5('0x7f')]=_0x00f5('0x2f');respondWithRpcPromise('EventManager',_0x00f5('0x76'),{'event':_0x00f5('0x80'),'message':_0x3ae5c3[_0x00f5('0x23')]},client9002);return _0x2f4908;}return null;})[_0x00f5('0x32')](respondWithResult(_0x30fadf,null))['catch'](handleError(_0x30fadf,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b9b3ce6..c2c804e 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 _0xfd9d=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xdf0547,_0x3fede7){var _0x5d1804=function(_0x976802){while(--_0x976802){_0xdf0547['push'](_0xdf0547['shift']());}};_0x5d1804(++_0x3fede7);}(_0xfd9d,0x194));var _0xdfd9=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xfd9d[_0x1265ed];return _0x5ac459;};'use strict';var EventEmitter=require(_0xdfd9('0x0'));var OpenchannelMessage=require(_0xdfd9('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdfd9('0x2')](0x0);var events={'afterCreate':_0xdfd9('0x3'),'afterUpdate':_0xdfd9('0x4'),'afterDestroy':_0xdfd9('0x5')};function emitEvent(_0x49c767){return function(_0x104594,_0x36ac7d,_0x5e356a){OpenchannelMessageEvents[_0xdfd9('0x6')](_0x49c767+':'+_0x104594['id'],_0x104594);OpenchannelMessageEvents['emit'](_0x49c767,_0x104594);_0x5e356a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xdfd9('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x37dd=['save','update','remove','emit','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x37dd,0x1d0));var _0xd37d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37dd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd37d('0x0'));var OpenchannelMessage=require(_0xd37d('0x1'))['db'][_0xd37d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd37d('0x3')](0x0);var events={'afterCreate':_0xd37d('0x4'),'afterUpdate':_0xd37d('0x5'),'afterDestroy':_0xd37d('0x6')};function emitEvent(_0x47e279){return function(_0x547556,_0x45859c,_0x3444e8){OpenchannelMessageEvents[_0xd37d('0x7')](_0x47e279+':'+_0x547556['id'],_0x547556);OpenchannelMessageEvents[_0xd37d('0x7')](_0x47e279,_0x547556);_0x3444e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xd37d('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5f33526..3e23bce 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 _0x6676=['finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','createdAt','error','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','threadId','Interaction','update','catch','inspect'];(function(_0x98b464,_0x551d30){var _0x7b5672=function(_0x1b126f){while(--_0x1b126f){_0x98b464['push'](_0x98b464['shift']());}};_0x7b5672(++_0x551d30);}(_0x6676,0x1cd));var _0x6667=function(_0x7f7f7,_0x293acf){_0x7f7f7=_0x7f7f7-0x0;var _0x5c7f7e=_0x6676[_0x7f7f7];return _0x5c7f7e;};'use strict';var _=require(_0x6667('0x0'));var util=require(_0x6667('0x1'));var logger=require(_0x6667('0x2'))(_0x6667('0x3'));var moment=require(_0x6667('0x4'));var BPromise=require('bluebird');var rp=require(_0x6667('0x5'));var fs=require('fs');var path=require(_0x6667('0x6'));var rimraf=require(_0x6667('0x7'));var config=require(_0x6667('0x8'));var attributes=require(_0x6667('0x9'));module[_0x6667('0xa')]=function(_0x3b2897,_0xa4b724){return _0x3b2897['define'](_0x6667('0xb'),attributes,{'tableName':_0x6667('0xc'),'paranoid':![],'indexes':[{'name':_0x6667('0xd'),'fields':[_0x6667('0xe')],'type':_0x6667('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50f028,_0x17d62e,_0x1db46e){var _0x166bf6=_0x3b2897[_0x6667('0x10')];var _0x52ba5e=_0x50f028[_0x6667('0x11')]({'plain':!![]});if(_0x52ba5e[_0x6667('0x12')][_0x6667('0x13')]()==='in'||_0x52ba5e[_0x6667('0x12')][_0x6667('0x13')]()===_0x6667('0x14')&&!_0x52ba5e[_0x6667('0x15')]&&!_[_0x6667('0x16')](_0x52ba5e[_0x6667('0x17')])){_0x166bf6[_0x6667('0x18')]['findOne']({'where':{'id':_0x52ba5e['OpenchannelInteractionId']}})[_0x6667('0x19')](function(_0x27013e){if(_0x27013e){_0x27013e['update']({'lastMsgAt':_0x52ba5e[_0x6667('0x1a')],'lastMsgDirection':_0x52ba5e[_0x6667('0x12')]['toLowerCase']()});}})['catch'](function(_0x2617af){console[_0x6667('0x1b')](_0x2617af);});}if(_0x52ba5e[_0x6667('0x12')]===_0x6667('0x14')&&!_0x52ba5e['secret']){var _0x580774;_0x166bf6['CmContact'][_0x6667('0x1c')]()[_0x6667('0x19')](function(_0x45ed02){return _0x166bf6[_0x6667('0x1d')][_0x6667('0x1e')]({'where':{'id':_0x52ba5e['OpenchannelAccountId']},'include':[{'model':_0x166bf6['OpenchannelInteraction'],'as':_0x6667('0x1f'),'where':{'id':_0x52ba5e[_0x6667('0x20')]},'limit':0x1,'include':[{'model':_0x166bf6['CmContact'],'as':_0x6667('0x21'),'attributes':_[_0x6667('0x22')](_0x45ed02)}]}]});})[_0x6667('0x19')](function(_0x220898){_0x580774=_0x220898[_0x6667('0x11')]({'plain':!![]});if(_0x580774&&_0x580774[_0x6667('0x23')]){logger[_0x6667('0x24')](_0x6667('0x25'),_0x6667('0x26'),util[_0x6667('0x27')](_0x6667('0x28'),_0x52ba5e['id'],_0x580774[_0x6667('0x23')]));if(_0x580774[_0x6667('0x1f')]&&_0x580774['Interactions'][_0x6667('0x29')]){_0x52ba5e['Interaction']=_[_0x6667('0x2a')](_0x580774['Interactions'][0x0],'Contact');_0x52ba5e[_0x6667('0x21')]=_0x580774[_0x6667('0x1f')][0x0][_0x6667('0x21')];}var _0x17d62e={'method':'POST','uri':encodeURI(_0x580774[_0x6667('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x17d62e[_0x6667('0x2b')]){case'GET':_0x17d62e['qs']=_0x52ba5e;break;case'POST':_0x17d62e[_0x6667('0xe')]=_0x52ba5e;break;}return rp(_0x17d62e)[_0x6667('0x19')](function(_0x4020cd){logger[_0x6667('0x24')](_0x6667('0x25'),_0x6667('0x26'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x52ba5e['id'],_0x580774[_0x6667('0x23')]));if(_0x4020cd[_0x6667('0xe')][_0x6667('0x2c')]&&_0x4020cd['body'][_0x6667('0x2c')]!=_0x52ba5e[_0x6667('0x2d')][_0x6667('0x2c')]){return _0x166bf6['OpenchannelInteraction'][_0x6667('0x2e')]({'threadId':_0x4020cd[_0x6667('0xe')]['threadId']},{'where':{'id':_0x52ba5e[_0x6667('0x2d')]['id']}});}else{return;}})[_0x6667('0x19')](function(){return _0x50f028[_0x6667('0x2e')]({'read':!![]});})[_0x6667('0x2f')](function(_0x2b5cb2){logger[_0x6667('0x1b')](_0x6667('0x25'),_0x6667('0x26'),util[_0x6667('0x30')](_0x2b5cb2,{'showHidden':![],'depth':null}));_0x1db46e();});}else{_0x1db46e();}})[_0x6667('0x31')](function(){_0x1db46e();});}else{_0x1db46e();}}},'charset':'utf8mb4','collate':_0x6667('0x32')});}; \ No newline at end of file +var _0xd753=['find','OpenchannelAccountId','Interactions','Contact','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount'];(function(_0x3013fb,_0x5017dc){var _0x1951f2=function(_0x19f057){while(--_0x19f057){_0x3013fb['push'](_0x3013fb['shift']());}};_0x1951f2(++_0x5017dc);}(_0xd753,0x191));var _0x3d75=function(_0x446bd3,_0x4b4cca){_0x446bd3=_0x446bd3-0x0;var _0x4a2216=_0xd753[_0x446bd3];return _0x4a2216;};'use strict';var _=require(_0x3d75('0x0'));var util=require(_0x3d75('0x1'));var logger=require('../../config/logger')(_0x3d75('0x2'));var moment=require(_0x3d75('0x3'));var BPromise=require(_0x3d75('0x4'));var rp=require(_0x3d75('0x5'));var fs=require('fs');var path=require(_0x3d75('0x6'));var rimraf=require(_0x3d75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d75('0x8'));module[_0x3d75('0x9')]=function(_0x2a657e,_0x47e8fc){return _0x2a657e[_0x3d75('0xa')](_0x3d75('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x3d75('0xc'),'fields':[_0x3d75('0xd')],'type':_0x3d75('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5960c3,_0x117242,_0x4f6150){var _0x268f80=_0x2a657e[_0x3d75('0xf')];var _0x292e5d=_0x5960c3['get']({'plain':!![]});if(_0x292e5d['direction'][_0x3d75('0x10')]()==='in'||_0x292e5d[_0x3d75('0x11')][_0x3d75('0x10')]()===_0x3d75('0x12')&&!_0x292e5d[_0x3d75('0x13')]&&!_[_0x3d75('0x14')](_0x292e5d['UserId'])){_0x268f80[_0x3d75('0x15')]['findOne']({'where':{'id':_0x292e5d[_0x3d75('0x16')]}})[_0x3d75('0x17')](function(_0x466026){if(_0x466026){_0x466026[_0x3d75('0x18')]({'lastMsgAt':_0x292e5d[_0x3d75('0x19')],'lastMsgDirection':_0x292e5d[_0x3d75('0x11')][_0x3d75('0x10')]()});}})[_0x3d75('0x1a')](function(_0x9d4f04){console[_0x3d75('0x1b')](_0x9d4f04);});}if(_0x292e5d[_0x3d75('0x11')]==='out'&&!_0x292e5d[_0x3d75('0x13')]){var _0xa64be9;_0x268f80[_0x3d75('0x1c')][_0x3d75('0x1d')]()[_0x3d75('0x17')](function(_0x4b59a1){return _0x268f80[_0x3d75('0x1e')][_0x3d75('0x1f')]({'where':{'id':_0x292e5d[_0x3d75('0x20')]},'include':[{'model':_0x268f80[_0x3d75('0x15')],'as':_0x3d75('0x21'),'where':{'id':_0x292e5d[_0x3d75('0x16')]},'limit':0x1,'include':[{'model':_0x268f80[_0x3d75('0x1c')],'as':_0x3d75('0x22'),'attributes':_['keys'](_0x4b59a1)}]}]});})[_0x3d75('0x17')](function(_0x34a546){_0xa64be9=_0x34a546['get']({'plain':!![]});if(_0xa64be9&&_0xa64be9[_0x3d75('0x23')]){logger['info'](_0x3d75('0x24'),'afterCreate',util[_0x3d75('0x25')](_0x3d75('0x26'),_0x292e5d['id'],_0xa64be9['replyUri']));if(_0xa64be9[_0x3d75('0x21')]&&_0xa64be9[_0x3d75('0x21')]['length']){_0x292e5d[_0x3d75('0x27')]=_['omit'](_0xa64be9[_0x3d75('0x21')][0x0],'Contact');_0x292e5d[_0x3d75('0x22')]=_0xa64be9[_0x3d75('0x21')][0x0][_0x3d75('0x22')];}var _0x117242={'method':_0x3d75('0x28'),'uri':encodeURI(_0xa64be9[_0x3d75('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x117242[_0x3d75('0x29')]){case _0x3d75('0x2a'):_0x117242['qs']=_0x292e5d;break;case _0x3d75('0x28'):_0x117242['body']=_0x292e5d;break;}return rp(_0x117242)[_0x3d75('0x17')](function(_0x1524f5){logger['info'](_0x3d75('0x24'),'afterCreate',util[_0x3d75('0x25')](_0x3d75('0x2b'),_0x292e5d['id'],_0xa64be9['replyUri']));if(_0x1524f5['body'][_0x3d75('0x2c')]&&_0x1524f5['body']['threadId']!=_0x292e5d[_0x3d75('0x27')][_0x3d75('0x2c')]){return _0x268f80[_0x3d75('0x15')][_0x3d75('0x18')]({'threadId':_0x1524f5[_0x3d75('0xd')][_0x3d75('0x2c')]},{'where':{'id':_0x292e5d[_0x3d75('0x27')]['id']}});}else{return;}})['then'](function(){return _0x5960c3[_0x3d75('0x18')]({'read':!![]});})[_0x3d75('0x1a')](function(_0x1930e1){logger[_0x3d75('0x1b')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x3d75('0x2d')](_0x1930e1,{'showHidden':![],'depth':null}));_0x4f6150();});}else{_0x4f6150();}})['finally'](function(){_0x4f6150();});}else{_0x4f6150();}}},'charset':_0x3d75('0x2e'),'collate':_0x3d75('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8b6ae36..71a4c02 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(_0x294fda,_0x474d4c){var _0x53da81=function(_0x5548a0){while(--_0x5548a0){_0x294fda['push'](_0x294fda['shift']());}};_0x53da81(++_0x474d4c);}(_0x2ef3,0xba));var _0x32ef=function(_0x45e707,_0x11911f){_0x45e707=_0x45e707-0x0;var _0xaa6abf=_0x2ef3[_0x45e707];return _0xaa6abf;};'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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x45aca3,_0x2dc880){var _0x540d06=function(_0x1ca425){while(--_0x1ca425){_0x45aca3['push'](_0x45aca3['shift']());}};_0x540d06(++_0x2dc880);}(_0xdb28,0x106));var _0x8db2=function(_0x3215ff,_0x349c84){_0x3215ff=_0x3215ff-0x0;var _0x16cd1e=_0xdb28[_0x3215ff];return _0x16cd1e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8feb716..066f6f8 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 _0x8bea=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x8bea,0xfc));var _0xa8be=function(_0x1fa5ac,_0x815a90){_0x1fa5ac=_0x1fa5ac-0x0;var _0x25cdf3=_0x8bea[_0x1fa5ac];return _0x25cdf3;};'use strict';var OpenchannelMessageEvents=require(_0xa8be('0x0'));var events=[_0xa8be('0x1'),_0xa8be('0x2'),_0xa8be('0x3')];function createListener(_0x2fe52e,_0x7b1d84){return function(_0x5ac9c1){_0x7b1d84[_0xa8be('0x4')](_0x2fe52e,_0x5ac9c1);};}function removeListener(_0x2ef761,_0x1fc3a0){return function(){OpenchannelMessageEvents[_0xa8be('0x5')](_0x2ef761,_0x1fc3a0);};}exports[_0xa8be('0x6')]=function(_0x39d97b){for(var _0x381ef6=0x0,_0x200872=events[_0xa8be('0x7')];_0x381ef6<_0x200872;_0x381ef6++){var _0x5e726d=events[_0x381ef6];var _0x20b355=createListener(_0xa8be('0x8')+_0x5e726d,_0x39d97b);OpenchannelMessageEvents['on'](_0x5e726d,_0x20b355);}}; \ No newline at end of file +var _0x7827=['save','remove','emit','removeListener','length','./openchannelMessage.events'];(function(_0x4d4878,_0x1810b8){var _0x5c6bbe=function(_0x373a16){while(--_0x373a16){_0x4d4878['push'](_0x4d4878['shift']());}};_0x5c6bbe(++_0x1810b8);}(_0x7827,0x19d));var _0x7782=function(_0x1e8f35,_0x3db390){_0x1e8f35=_0x1e8f35-0x0;var _0x446c13=_0x7827[_0x1e8f35];return _0x446c13;};'use strict';var OpenchannelMessageEvents=require(_0x7782('0x0'));var events=[_0x7782('0x1'),_0x7782('0x2'),'update'];function createListener(_0x59e448,_0x2ca404){return function(_0x4f783e){_0x2ca404[_0x7782('0x3')](_0x59e448,_0x4f783e);};}function removeListener(_0x321f67,_0x2c7008){return function(){OpenchannelMessageEvents[_0x7782('0x4')](_0x321f67,_0x2c7008);};}exports['register']=function(_0x54ec8c){for(var _0x1f1de7=0x0,_0x229e18=events[_0x7782('0x5')];_0x1f1de7<_0x229e18;_0x1f1de7++){var _0xdc102e=events[_0x1f1de7];var _0x32b5f4=createListener('openchannelMessage:'+_0xdc102e,_0x54ec8c);OpenchannelMessageEvents['on'](_0xdc102e,_0x32b5f4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2e2beb0..d509352 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 _0xbe9d=['addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','describe','get','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xbe9d,0x1d8));var _0xdbe9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xbe9d[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var path=require(_0xdbe9('0x2'));var timeout=require(_0xdbe9('0x3'));var express=require(_0xdbe9('0x4'));var router=express[_0xdbe9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdbe9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdbe9('0x7'));var controller=require(_0xdbe9('0x8'));router['get']('/',auth[_0xdbe9('0x9')](),controller[_0xdbe9('0xa')]);router['get']('/describe',auth[_0xdbe9('0x9')](),controller[_0xdbe9('0xb')]);router[_0xdbe9('0xc')](_0xdbe9('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdbe9('0xe'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0xf')]);router[_0xdbe9('0xc')](_0xdbe9('0x10'),auth[_0xdbe9('0x9')](),controller['getTeams']);router[_0xdbe9('0xc')](_0xdbe9('0x11'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x12')]);router[_0xdbe9('0x13')]('/',auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x14')]);router[_0xdbe9('0x13')](_0xdbe9('0x10'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x15')]);router['post'](_0xdbe9('0x11'),auth[_0xdbe9('0x9')](),controller['addAgents']);router[_0xdbe9('0x16')](_0xdbe9('0xd'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x17')]);router[_0xdbe9('0x18')](_0xdbe9('0xd'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x19')]);router[_0xdbe9('0x18')](_0xdbe9('0x10'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x1a')]);router[_0xdbe9('0x18')](_0xdbe9('0x11'),auth[_0xdbe9('0x9')](),controller[_0xdbe9('0x1b')]);module[_0xdbe9('0x1c')]=router; \ No newline at end of file +var _0x9849=['isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x46b4ad,_0x148a49){var _0x589592=function(_0xd6433d){while(--_0xd6433d){_0x46b4ad['push'](_0x46b4ad['shift']());}};_0x589592(++_0x148a49);}(_0x9849,0xba));var _0x9984=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x9849[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x9984('0x0'));var util=require('util');var path=require(_0x9984('0x1'));var timeout=require(_0x9984('0x2'));var express=require(_0x9984('0x3'));var router=express[_0x9984('0x4')]();var fs_extra=require(_0x9984('0x5'));var auth=require(_0x9984('0x6'));var interaction=require(_0x9984('0x7'));var config=require(_0x9984('0x8'));var controller=require('./openchannelQueue.controller');router[_0x9984('0x9')]('/',auth[_0x9984('0xa')](),controller[_0x9984('0xb')]);router[_0x9984('0x9')](_0x9984('0xc'),auth[_0x9984('0xa')](),controller['describe']);router[_0x9984('0x9')](_0x9984('0xd'),auth[_0x9984('0xa')](),controller['show']);router[_0x9984('0x9')](_0x9984('0xe'),auth[_0x9984('0xa')](),controller[_0x9984('0xf')]);router[_0x9984('0x9')](_0x9984('0x10'),auth[_0x9984('0xa')](),controller[_0x9984('0x11')]);router[_0x9984('0x9')](_0x9984('0x12'),auth[_0x9984('0xa')](),controller[_0x9984('0x13')]);router[_0x9984('0x14')]('/',auth[_0x9984('0xa')](),controller[_0x9984('0x15')]);router[_0x9984('0x14')](_0x9984('0x10'),auth[_0x9984('0xa')](),controller['addTeams']);router['post'](_0x9984('0x12'),auth[_0x9984('0xa')](),controller[_0x9984('0x16')]);router[_0x9984('0x17')](_0x9984('0xd'),auth[_0x9984('0xa')](),controller[_0x9984('0x18')]);router['delete'](_0x9984('0xd'),auth[_0x9984('0xa')](),controller['destroy']);router[_0x9984('0x19')](_0x9984('0x10'),auth[_0x9984('0xa')](),controller[_0x9984('0x1a')]);router['delete'](_0x9984('0x12'),auth['isAuthenticated'](),controller[_0x9984('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1c97c94..eee3c32 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 _0x6dd7=['beepall','roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6dd7,0x11c));var _0x76dd=function(_0x5af812,_0x43d252){_0x5af812=_0x5af812-0x0;var _0x1489f2=_0x6dd7[_0x5af812];return _0x1489f2;};'use strict';var Sequelize=require(_0x76dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x76dd('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x76dd('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x76dd('0x2')](_0x76dd('0x3'),_0x76dd('0x4'),_0x76dd('0x5'))}}; \ No newline at end of file +var _0xf844=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf844,0x182));var _0x4f84=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0xf844[_0x463376];return _0x336ccd;};'use strict';var Sequelize=require(_0x4f84('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f84('0x1')],'unique':_0x4f84('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f84('0x1')]},'timeout':{'type':Sequelize[_0x4f84('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f84('0x4')](_0x4f84('0x5'),_0x4f84('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4eeb321..7b02003 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 _0xa8ee=['includes','union','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','spread','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','update','destroy','then','get','UserProfileResource','end','error','stack','name','index','OpenchannelQueue','fieldName','type','key','getOptions','include','query','show','params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','map','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','addTeams','ids','findAll','User','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa8ee,0x16f));var _0xea8e=function(_0x1b78ae,_0x5b3cae){_0x1b78ae=_0x1b78ae-0x0;var _0x56bd98=_0xa8ee[_0x1b78ae];return _0x56bd98;};'use strict';var BPromise=require(_0xea8e('0x0'));var util=require(_0xea8e('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xea8e('0x2'));var qs=require(_0xea8e('0x3'));var logger=require('../../config/logger')(_0xea8e('0x4'));var config=require(_0xea8e('0x5'));var db=require(_0xea8e('0x6'))['db'];config[_0xea8e('0x7')]=_['defaults'](config[_0xea8e('0x7')],{'host':_0xea8e('0x8'),'port':0x18eb});var socket=require(_0xea8e('0x9'))(new Redis(config['redis']));require(_0xea8e('0xa'))['register'](socket);function respondWithStatusCode(_0x4b12bc,_0x442e6e){_0x442e6e=_0x442e6e||0xcc;return function(_0x3f232b){if(_0x3f232b){return _0x4b12bc[_0xea8e('0xb')](_0x442e6e);}return _0x4b12bc[_0xea8e('0xc')](_0x442e6e)['end']();};}function respondWithResult(_0x495868,_0x554384){_0x554384=_0x554384||0xc8;return function(_0x5bc37f){if(_0x5bc37f){return _0x495868[_0xea8e('0xc')](_0x554384)[_0xea8e('0xd')](_0x5bc37f);}};}function respondWithFilteredResult(_0x50502c,_0x14a7be){return function(_0x22e82d){if(_0x22e82d){var _0x1ee042=typeof _0x14a7be['offset']===_0xea8e('0xe')&&typeof _0x14a7be[_0xea8e('0xf')]===_0xea8e('0xe');var _0x4bfeb7=_0x22e82d[_0xea8e('0x10')];var _0x194338=_0x1ee042?0x0:_0x14a7be['offset'];var _0x81c3e0=_0x1ee042?_0x22e82d[_0xea8e('0x10')]:_0x14a7be[_0xea8e('0x11')]+_0x14a7be['limit'];var _0x3f8a3f;if(_0x81c3e0>=_0x4bfeb7){_0x81c3e0=_0x4bfeb7;_0x3f8a3f=0xc8;}else{_0x3f8a3f=0xce;}_0x50502c[_0xea8e('0xc')](_0x3f8a3f);return _0x50502c[_0xea8e('0x12')]('Content-Range',_0x194338+'-'+_0x81c3e0+'/'+_0x4bfeb7)[_0xea8e('0xd')](_0x22e82d);}return null;};}function saveUpdates(_0x4c1ddc){return function(_0x10d52d){if(_0x10d52d){return _0x10d52d[_0xea8e('0x13')](_0x4c1ddc)['then'](function(_0x4df8a7){return _0x4df8a7;});}return null;};}function removeEntity(_0x281718){return function(_0x410931){if(_0x410931){return _0x410931[_0xea8e('0x14')]()[_0xea8e('0x15')](function(){var _0x315fea=_0x410931[_0xea8e('0x16')]({'plain':!![]});var _0x19152b='OpenchannelQueues';return db[_0xea8e('0x17')][_0xea8e('0x14')]({'where':{'type':_0x19152b,'resourceId':_0x315fea['id']}})['then'](function(){return _0x410931;});})[_0xea8e('0x15')](function(){_0x281718[_0xea8e('0xc')](0xcc)[_0xea8e('0x18')]();});}};}function handleEntityNotFound(_0x407c4b){return function(_0x13185d){if(!_0x13185d){_0x407c4b[_0xea8e('0xb')](0x194);}return _0x13185d;};}function handleError(_0xdc0bd1,_0x2924e8){_0x2924e8=_0x2924e8||0x1f4;return function(_0x44dfd7){logger[_0xea8e('0x19')](_0x44dfd7[_0xea8e('0x1a')]);if(_0x44dfd7[_0xea8e('0x1b')]){delete _0x44dfd7[_0xea8e('0x1b')];}_0xdc0bd1['status'](_0x2924e8)['send'](_0x44dfd7);};}exports[_0xea8e('0x1c')]=function(_0x209c59,_0x486fc0){var _0x3adab2={};var _0x67cb5a={'count':0x0,'rows':[]};var _0x4ba5a4=_['map'](db[_0xea8e('0x1d')]['rawAttributes'],function(_0x473829){return{'name':_0x473829[_0xea8e('0x1e')],'type':_0x473829[_0xea8e('0x1f')][_0xea8e('0x20')]};});_0x3adab2=qs[_0xea8e('0x21')](_0x4ba5a4,_0x209c59);var _0x4b7d11={'where':_0x3adab2['where']};return db[_0xea8e('0x1d')]['count'](_0x4b7d11)['then'](function(_0x293ab0){_0x67cb5a['count']=_0x293ab0;_0x3adab2[_0xea8e('0x22')]=qs['include'](_0x209c59[_0xea8e('0x23')]);return db[_0xea8e('0x1d')]['findAll'](_0x3adab2);})[_0xea8e('0x15')](function(_0x1bc863){_0x67cb5a['rows']=_0x1bc863;return _0x67cb5a;})[_0xea8e('0x15')](respondWithFilteredResult(_0x486fc0,_0x3adab2))['catch'](handleError(_0x486fc0,null));};exports[_0xea8e('0x24')]=function(_0x1f39f6,_0x531278){var _0xf4ab17={'raw':!![],'where':{'id':_0x1f39f6[_0xea8e('0x25')]['id']}},_0x32e88d={};_0x32e88d[_0xea8e('0x26')]=_[_0xea8e('0x27')](db[_0xea8e('0x1d')]['rawAttributes']);_0x32e88d[_0xea8e('0x23')]=_[_0xea8e('0x27')](_0x1f39f6[_0xea8e('0x23')]);_0x32e88d[_0xea8e('0x28')]=_['intersection'](_0x32e88d['model'],_0x32e88d[_0xea8e('0x23')]);_0xf4ab17[_0xea8e('0x29')]=_[_0xea8e('0x2a')](_0x32e88d[_0xea8e('0x26')],qs[_0xea8e('0x2b')](_0x1f39f6['query'][_0xea8e('0x2b')]));_0xf4ab17[_0xea8e('0x29')]=_0xf4ab17['attributes']['length']?_0xf4ab17[_0xea8e('0x29')]:_0x32e88d[_0xea8e('0x26')];if(_0x1f39f6[_0xea8e('0x23')][_0xea8e('0x2c')]){_0xf4ab17[_0xea8e('0x22')]=[{'all':!![]}];}_0xf4ab17=_[_0xea8e('0x2d')]({},_0xf4ab17,_0x1f39f6[_0xea8e('0x2e')]);return db['OpenchannelQueue']['find'](_0xf4ab17)[_0xea8e('0x15')](handleEntityNotFound(_0x531278,null))[_0xea8e('0x15')](respondWithResult(_0x531278,null))[_0xea8e('0x2f')](handleError(_0x531278,null));};exports[_0xea8e('0x30')]=function(_0x394384,_0x56e4a4){return db['OpenchannelQueue'][_0xea8e('0x30')](_0x394384[_0xea8e('0x31')],{})[_0xea8e('0x15')](function(_0x21b7b8){var _0x5785ab=_0x394384[_0xea8e('0x32')][_0xea8e('0x16')]({'plain':!![]});if(!_0x5785ab)throw new Error(_0xea8e('0x33'));if(_0x5785ab[_0xea8e('0x34')]===_0xea8e('0x32')){var _0x541883=_0x21b7b8['get']({'plain':!![]});var _0x59ebac=_0xea8e('0x35');return db[_0xea8e('0x36')]['find']({'where':{'name':_0x59ebac,'userProfileId':_0x5785ab['userProfileId']},'raw':!![]})[_0xea8e('0x15')](function(_0x12d342){if(_0x12d342&&_0x12d342['autoAssociation']===0x0){return db[_0xea8e('0x17')][_0xea8e('0x30')]({'name':_0x541883['name'],'resourceId':_0x541883['id'],'type':_0x12d342[_0xea8e('0x1b')],'sectionId':_0x12d342['id']},{})['then'](function(){return _0x21b7b8;});}else{return _0x21b7b8;}})[_0xea8e('0x2f')](function(_0x2ffd98){logger[_0xea8e('0x19')](_0xea8e('0x37'),_0x2ffd98);throw _0x2ffd98;});}return _0x21b7b8;})[_0xea8e('0x15')](respondWithResult(_0x56e4a4,0xc9))[_0xea8e('0x2f')](handleError(_0x56e4a4,null));};exports['update']=function(_0x48464f,_0x234fe6){if(_0x48464f[_0xea8e('0x31')]['id']){delete _0x48464f['body']['id'];}return db[_0xea8e('0x1d')]['find']({'where':{'id':_0x48464f[_0xea8e('0x25')]['id']}})['then'](handleEntityNotFound(_0x234fe6,null))[_0xea8e('0x15')](saveUpdates(_0x48464f[_0xea8e('0x31')],null))['then'](respondWithResult(_0x234fe6,null))[_0xea8e('0x2f')](handleError(_0x234fe6,null));};exports[_0xea8e('0x14')]=function(_0x5b477e,_0x6bceca){return db[_0xea8e('0x1d')][_0xea8e('0x38')]({'where':{'id':_0x5b477e[_0xea8e('0x25')]['id']}})['then'](handleEntityNotFound(_0x6bceca,null))[_0xea8e('0x15')](removeEntity(_0x6bceca,null))[_0xea8e('0x2f')](handleError(_0x6bceca,null));};exports[_0xea8e('0x39')]=function(_0x1a65e5,_0x389552){return db[_0xea8e('0x1d')][_0xea8e('0x39')]()[_0xea8e('0x15')](respondWithResult(_0x389552,null))[_0xea8e('0x2f')](handleError(_0x389552,null));};exports[_0xea8e('0x3a')]=function(_0x5736d9,_0x488222){var _0x37f4e0={'raw':!![],'where':{}},_0x4d8e4e={},_0x1b767c;return db[_0xea8e('0x1d')][_0xea8e('0x3b')]({'where':{'id':_0x5736d9[_0xea8e('0x25')]['id']}})['then'](handleEntityNotFound(_0x488222,null))[_0xea8e('0x15')](function(_0x4a2d38){if(_0x4a2d38){_0x1b767c=_0x4a2d38[_0xea8e('0x16')]({'plain':!![]});_0x4d8e4e['model']=_[_0xea8e('0x27')](db[_0xea8e('0x3c')]['rawAttributes']);_0x4d8e4e[_0xea8e('0x23')]=_[_0xea8e('0x27')](_0x5736d9[_0xea8e('0x23')]);_0x4d8e4e['filters']=_[_0xea8e('0x2a')](_0x4d8e4e[_0xea8e('0x26')],_0x4d8e4e[_0xea8e('0x23')]);_0x37f4e0[_0xea8e('0x29')]=_[_0xea8e('0x2a')](_0x4d8e4e[_0xea8e('0x26')],qs[_0xea8e('0x2b')](_0x5736d9[_0xea8e('0x23')][_0xea8e('0x2b')]));_0x37f4e0[_0xea8e('0x29')]=_0x37f4e0[_0xea8e('0x29')][_0xea8e('0x3d')]?_0x37f4e0[_0xea8e('0x29')]:_0x4d8e4e[_0xea8e('0x26')];if(!_0x5736d9[_0xea8e('0x23')][_0xea8e('0x3e')](_0xea8e('0x3f'))){_0x37f4e0[_0xea8e('0xf')]=qs[_0xea8e('0xf')](_0x5736d9[_0xea8e('0x23')][_0xea8e('0xf')]);_0x37f4e0[_0xea8e('0x11')]=qs['offset'](_0x5736d9['query'][_0xea8e('0x11')]);}_0x37f4e0[_0xea8e('0x40')]=qs[_0xea8e('0x41')](_0x5736d9[_0xea8e('0x23')][_0xea8e('0x41')]);_0x37f4e0[_0xea8e('0x42')]=qs[_0xea8e('0x28')](_[_0xea8e('0x43')](_0x5736d9['query'],_0x4d8e4e[_0xea8e('0x28')]));_0x37f4e0[_0xea8e('0x42')][_0xea8e('0x44')]=_0x4a2d38['id'];if(_0x5736d9[_0xea8e('0x23')][_0xea8e('0x45')]){_0x37f4e0['where']=_[_0xea8e('0x2d')](_0x37f4e0['where'],{'$or':_[_0xea8e('0x46')](_0x37f4e0['attributes'],function(_0x45b1f0){var _0x4e0776={};_0x4e0776[_0x45b1f0]={'$like':'%'+_0x5736d9[_0xea8e('0x23')][_0xea8e('0x45')]+'%'};return _0x4e0776;})});}_0x37f4e0=_[_0xea8e('0x2d')]({},_0x37f4e0,_0x5736d9[_0xea8e('0x2e')]);return db[_0xea8e('0x3c')]['findAll'](_0x37f4e0);}})[_0xea8e('0x15')](function(_0x31cad5){if(_0x31cad5){return db['User'][_0xea8e('0x47')]({'where':{'id':_['map'](_0x31cad5,_0xea8e('0x48')),'role':_0xea8e('0x49')},'attributes':['id',_0xea8e('0x1b'),_0xea8e('0x4a'),_0xea8e('0x4b'),_0xea8e('0x4c')]});}})['then'](function(_0x10d2e4){if(_0x10d2e4){return{'count':_0x10d2e4[_0xea8e('0x10')],'rows':_['map'](_0x10d2e4[_0xea8e('0x4d')],function(_0x31acc5){return{'membername':_0x31acc5[_0xea8e('0x1b')],'UserId':_0x31acc5['id'],'queue_name':_0x1b767c[_0xea8e('0x1b')],'OpenchannelQueueId':_0x1b767c['id'],'interface':util['format'](_0xea8e('0x4e'),'SIP',_0x31acc5[_0xea8e('0x1b')]),'penalty':0x0,'paused':_0x31acc5[_0xea8e('0x4a')],'createdAt':_0x31acc5[_0xea8e('0x4c')],'updatedAt':_0x31acc5[_0xea8e('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea8e('0x15')](respondWithFilteredResult(_0x488222,_0x37f4e0))[_0xea8e('0x2f')](handleError(_0x488222,null));};exports[_0xea8e('0x4f')]=function(_0x27095d,_0x253ab5){var _0x4519e9={};var _0x2bba23={};var _0x3c0b00;var _0x3ebc83;return db[_0xea8e('0x1d')]['findOne']({'where':{'id':_0x27095d[_0xea8e('0x25')]['id']}})[_0xea8e('0x15')](handleEntityNotFound(_0x253ab5,null))[_0xea8e('0x15')](function(_0x4927c1){if(_0x4927c1){_0x3c0b00=_0x4927c1;_0x2bba23[_0xea8e('0x26')]=_[_0xea8e('0x27')](db[_0xea8e('0x50')]['rawAttributes']);_0x2bba23[_0xea8e('0x23')]=_[_0xea8e('0x27')](_0x27095d[_0xea8e('0x23')]);_0x2bba23['filters']=_[_0xea8e('0x2a')](_0x2bba23[_0xea8e('0x26')],_0x2bba23['query']);_0x4519e9[_0xea8e('0x29')]=_[_0xea8e('0x2a')](_0x2bba23['model'],qs[_0xea8e('0x2b')](_0x27095d[_0xea8e('0x23')][_0xea8e('0x2b')]));_0x4519e9[_0xea8e('0x29')]=_0x4519e9['attributes'][_0xea8e('0x3d')]?_0x4519e9[_0xea8e('0x29')]:_0x2bba23['model'];_0x4519e9[_0xea8e('0x40')]=qs[_0xea8e('0x41')](_0x27095d[_0xea8e('0x23')][_0xea8e('0x41')]);_0x4519e9['where']=qs[_0xea8e('0x28')](_[_0xea8e('0x43')](_0x27095d[_0xea8e('0x23')],_0x2bba23['filters']));if(_0x27095d[_0xea8e('0x23')][_0xea8e('0x45')]){_0x4519e9[_0xea8e('0x42')]=_[_0xea8e('0x2d')](_0x4519e9[_0xea8e('0x42')],{'$or':_[_0xea8e('0x46')](_0x4519e9[_0xea8e('0x29')],function(_0x476599){var _0xc0b088={};_0xc0b088[_0x476599]={'$like':'%'+_0x27095d[_0xea8e('0x23')][_0xea8e('0x45')]+'%'};return _0xc0b088;})});}_0x4519e9=_[_0xea8e('0x2d')]({},_0x4519e9,_0x27095d[_0xea8e('0x2e')]);return _0x3c0b00['getTeams'](_0x4519e9);}})[_0xea8e('0x15')](function(_0x43e3ac){if(_0x43e3ac){_0x3ebc83=_0x43e3ac[_0xea8e('0x3d')];if(!_0x27095d[_0xea8e('0x23')][_0xea8e('0x3e')]('nolimit')){_0x4519e9[_0xea8e('0xf')]=qs[_0xea8e('0xf')](_0x27095d[_0xea8e('0x23')][_0xea8e('0xf')]);_0x4519e9[_0xea8e('0x11')]=qs['offset'](_0x27095d[_0xea8e('0x23')]['offset']);}return _0x3c0b00['getTeams'](_0x4519e9);}})[_0xea8e('0x15')](function(_0x212d74){if(_0x212d74){return _0x212d74?{'count':_0x3ebc83,'rows':_0x212d74}:null;}})[_0xea8e('0x15')](respondWithResult(_0x253ab5,null))[_0xea8e('0x2f')](handleError(_0x253ab5,null));};exports[_0xea8e('0x51')]=function(_0xc55d0c,_0x303138){var _0x2b20b0=_0xc55d0c[_0xea8e('0x31')][_0xea8e('0x52')];return db['Team'][_0xea8e('0x53')]({'where':{'id':_0x2b20b0},'attributes':['id'],'include':[{'model':db[_0xea8e('0x54')],'as':'Agents','attributes':['id',_0xea8e('0x1b'),_0xea8e('0x55'),_0xea8e('0x56'),_0xea8e('0x57')],'raw':!![]}]})['then'](function(_0x20ae68){if(_0x20ae68){var _0x477382=_[_0xea8e('0x58')](_0x20ae68,function(_0x55b45d){var _0x205b86=_0x55b45d['get']({'plain':!![]});return _0x205b86['Agents'];});return db[_0xea8e('0x1d')][_0xea8e('0x38')]({'where':{'id':_0xc55d0c[_0xea8e('0x25')]['id']}})[_0xea8e('0x15')](function(_0x10c2ec){return db[_0xea8e('0x59')][_0xea8e('0x5a')](function(_0x1c0b51){return _0x10c2ec['addTeams'](_0x2b20b0,{'transaction':_0x1c0b51})[_0xea8e('0x15')](function(){return BPromise[_0xea8e('0x5b')](_0x477382,function(_0x1de65c){return db[_0xea8e('0x3c')]['findOrCreate']({'where':{'UserId':_0x1de65c['id'],'OpenchannelQueueId':_0xc55d0c[_0xea8e('0x25')]['id']},'transaction':_0x1c0b51});});})['then'](function(){_0x477382[_0xea8e('0x5c')](function(_0x54ff02){socket[_0xea8e('0x5d')](_0xea8e('0x5e'),{'UserId':_0x54ff02['id'],'OpenchannelQueueId':_0x10c2ec['id']});});});});});}})[_0xea8e('0x15')](respondWithStatusCode(_0x303138,null))[_0xea8e('0x2f')](handleError(_0x303138,null));};exports['removeTeams']=function(_0x257a3a,_0x256b72){return db[_0xea8e('0x50')][_0xea8e('0x53')]({'where':{'id':_0x257a3a[_0xea8e('0x23')][_0xea8e('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea8e('0x15')](handleEntityNotFound(_0x256b72,null))['then'](function(_0x12b8aa){var _0x3ea511=_[_0xea8e('0x46')](_0x12b8aa,'id');var _0x407a81=[];var _0x3af1e3=[];var _0x3c507f=squel[_0xea8e('0x5f')]();_0x3c507f[_0xea8e('0x60')](_0xea8e('0x61'))[_0xea8e('0x62')]('team_has_openchannel_queues','tq')['join'](_0xea8e('0x63'),'ut',_0xea8e('0x64'))[_0xea8e('0x42')](_0xea8e('0x65'),_0x257a3a[_0xea8e('0x25')]['id']);for(var _0x25c715=0x0;_0x25c715<_0x12b8aa[_0xea8e('0x3d')];_0x25c715+=0x1){let _0x3734ed=_0x12b8aa[_0x25c715];for(var _0x427d92=0x0;_0x427d92<_0x3734ed[_0xea8e('0x66')][_0xea8e('0x3d')];_0x427d92+=0x1){let _0x5273a6=_0x3734ed[_0xea8e('0x66')][_0x427d92];var _0x163390=_0x3c507f[_0xea8e('0x67')]();_0x163390['where'](_0xea8e('0x68'),_0x5273a6['id']);_0x3af1e3['push'](db[_0xea8e('0x59')][_0xea8e('0x23')](_0x163390[_0xea8e('0x69')](),{'type':db[_0xea8e('0x59')][_0xea8e('0x6a')][_0xea8e('0x6b')]})[_0xea8e('0x15')](function(_0x4fb3b2){if(_0x4fb3b2[_0xea8e('0x3d')]===0x1){return _0x5273a6['id'];}else{var _0x1e30d6=_['every'](_[_0xea8e('0x46')](_0x4fb3b2,_0xea8e('0x6c')),function(_0x1e622e){return _[_0xea8e('0x6d')](_0x3ea511,_0x1e622e);});if(_0x1e30d6){return _0x5273a6['id'];}}}));}}return BPromise['all'](_0x3af1e3)[_0xea8e('0x15')](function(_0x1d9ab2){_0x407a81=_(_0x407a81)[_0xea8e('0x6e')](_0x1d9ab2)['compact']()[_0xea8e('0x6f')]();return db['OpenchannelQueue'][_0xea8e('0x38')]({'where':{'id':_0x257a3a[_0xea8e('0x25')]['id']}})[_0xea8e('0x15')](function(_0x10396f){return db[_0xea8e('0x59')][_0xea8e('0x5a')](function(_0x278a59){return _0x10396f[_0xea8e('0x70')](_0x257a3a[_0xea8e('0x23')]['ids'],{'transaction':_0x278a59})[_0xea8e('0x15')](function(){if(!_[_0xea8e('0x71')](_0x407a81)){return _0x10396f[_0xea8e('0x72')](_0x407a81,{'transaction':_0x278a59});}})['then'](function(){_0x407a81['forEach'](function(_0x9028c1){socket[_0xea8e('0x5d')](_0xea8e('0x73'),{'UserId':_0x9028c1,'OpenchannelQueueId':_0x10396f['id']});});});});});});})['then'](respondWithStatusCode(_0x256b72,null))[_0xea8e('0x2f')](handleError(_0x256b72,null));};exports['addAgents']=function(_0x5ac0ab,_0x5ebc45){return db[_0xea8e('0x1d')]['find']({'where':{'id':_0x5ac0ab[_0xea8e('0x25')]['id']}})[_0xea8e('0x15')](handleEntityNotFound(_0x5ebc45,null))[_0xea8e('0x15')](function(_0x54461c){if(_0x54461c){return _0x54461c['addAgents'](_0x5ac0ab[_0xea8e('0x31')][_0xea8e('0x52')],_['omit'](_0x5ac0ab[_0xea8e('0x31')],['ids','id'])||{})[_0xea8e('0x74')](function(_0x1d6828){for(var _0x451e4d=0x0;_0x451e4d<_0x5ac0ab[_0xea8e('0x31')]['ids'][_0xea8e('0x3d')];_0x451e4d+=0x1){socket[_0xea8e('0x5d')]('userOpenchannelQueue:save',{'UserId':Number(_0x5ac0ab[_0xea8e('0x31')][_0xea8e('0x52')][_0x451e4d]),'OpenchannelQueueId':Number(_0x5ac0ab[_0xea8e('0x25')]['id'])});}return _0x1d6828;});}})[_0xea8e('0x15')](respondWithResult(_0x5ebc45,null))['catch'](handleError(_0x5ebc45,null));};exports[_0xea8e('0x72')]=function(_0x4addb9,_0x1d5bc9){return db['OpenchannelQueue'][_0xea8e('0x38')]({'where':{'id':_0x4addb9['params']['id']}})[_0xea8e('0x15')](handleEntityNotFound(_0x1d5bc9,null))['then'](function(_0x3db176){if(_0x3db176){return _0x3db176[_0xea8e('0x72')](_0x4addb9[_0xea8e('0x23')][_0xea8e('0x52')])[_0xea8e('0x15')](function(){if(_[_0xea8e('0x75')](_0x4addb9[_0xea8e('0x23')]['ids'])){for(var _0x68d32c=0x0;_0x68d32c<_0x4addb9['query']['ids'][_0xea8e('0x3d')];_0x68d32c+=0x1){socket[_0xea8e('0x5d')](_0xea8e('0x73'),{'UserId':Number(_0x4addb9[_0xea8e('0x23')][_0xea8e('0x52')][_0x68d32c]),'OpenchannelQueueId':Number(_0x4addb9['params']['id'])});}}else{socket['emit'](_0xea8e('0x73'),{'UserId':Number(_0x4addb9[_0xea8e('0x23')][_0xea8e('0x52')]),'OpenchannelQueueId':Number(_0x4addb9[_0xea8e('0x25')]['id'])});}});}})[_0xea8e('0x15')](respondWithStatusCode(_0x1d5bc9,null))[_0xea8e('0x2f')](handleError(_0x1d5bc9,null));};exports[_0xea8e('0x76')]=function(_0x154bb6,_0x2a2ec2){var _0x311785={};var _0x30085b={};var _0x5b81e7;var _0x351007;return db[_0xea8e('0x1d')][_0xea8e('0x3b')]({'where':{'id':_0x154bb6['params']['id']}})[_0xea8e('0x15')](handleEntityNotFound(_0x2a2ec2,null))[_0xea8e('0x15')](function(_0x305291){if(_0x305291){_0x5b81e7=_0x305291;_0x30085b['model']=_[_0xea8e('0x27')](db[_0xea8e('0x54')]['rawAttributes']);_0x30085b[_0xea8e('0x23')]=_[_0xea8e('0x27')](_0x154bb6[_0xea8e('0x23')]);_0x30085b[_0xea8e('0x28')]=_['intersection'](_0x30085b['model'],_0x30085b[_0xea8e('0x23')]);_0x311785[_0xea8e('0x29')]=_['intersection'](_0x30085b[_0xea8e('0x26')],qs['fields'](_0x154bb6[_0xea8e('0x23')][_0xea8e('0x2b')]));_0x311785[_0xea8e('0x29')]=_0x311785[_0xea8e('0x29')][_0xea8e('0x3d')]?_0x311785['attributes']:_0x30085b[_0xea8e('0x26')];_0x311785['order']=qs[_0xea8e('0x41')](_0x154bb6[_0xea8e('0x23')]['sort']);_0x311785[_0xea8e('0x42')]=qs[_0xea8e('0x28')](_['pick'](_0x154bb6['query'],_0x30085b['filters']));if(_0x154bb6[_0xea8e('0x23')]['filter']){_0x311785[_0xea8e('0x42')]=_['merge'](_0x311785[_0xea8e('0x42')],{'$or':_[_0xea8e('0x46')](_0x311785[_0xea8e('0x29')],function(_0x52387e){var _0x265e0b={};_0x265e0b[_0x52387e]={'$like':'%'+_0x154bb6['query']['filter']+'%'};return _0x265e0b;})});}_0x311785=_[_0xea8e('0x2d')]({},_0x311785,_0x154bb6['options']);return _0x5b81e7[_0xea8e('0x76')](_0x311785);}})[_0xea8e('0x15')](function(_0x2e4d54){if(_0x2e4d54){_0x351007=_0x2e4d54[_0xea8e('0x3d')];if(!_0x154bb6[_0xea8e('0x23')]['hasOwnProperty'](_0xea8e('0x3f'))){_0x311785['limit']=qs[_0xea8e('0xf')](_0x154bb6[_0xea8e('0x23')][_0xea8e('0xf')]);_0x311785[_0xea8e('0x11')]=qs[_0xea8e('0x11')](_0x154bb6[_0xea8e('0x23')][_0xea8e('0x11')]);}return _0x5b81e7[_0xea8e('0x76')](_0x311785);}})['then'](function(_0x4da8b4){if(_0x4da8b4){return _0x4da8b4?{'count':_0x351007,'rows':_0x4da8b4}:null;}})[_0xea8e('0x15')](respondWithResult(_0x2a2ec2,null))[_0xea8e('0x2f')](handleError(_0x2a2ec2,null));}; \ No newline at end of file +var _0xbc0d=['keys','attributes','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','filters','intersection','hasOwnProperty','nolimit','OpenchannelQueueId','filter','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','order','sort','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','find','sequelize','transaction','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','OpenchannelQueue','include','query','findAll','rows','show','params','model'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0xbc0d,0x1ca));var _0xdbc0=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0xbc0d[_0x3a07c1];return _0x2bbe15;};'use strict';var BPromise=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var _=require(_0xdbc0('0x2'));var squel=require(_0xdbc0('0x3'));var Redis=require(_0xdbc0('0x4'));var qs=require(_0xdbc0('0x5'));var logger=require(_0xdbc0('0x6'))(_0xdbc0('0x7'));var config=require(_0xdbc0('0x8'));var db=require('../../mysqldb')['db'];config[_0xdbc0('0x9')]=_['defaults'](config[_0xdbc0('0x9')],{'host':_0xdbc0('0xa'),'port':0x18eb});var socket=require(_0xdbc0('0xb'))(new Redis(config[_0xdbc0('0x9')]));require('./openchannelQueue.socket')[_0xdbc0('0xc')](socket);function respondWithStatusCode(_0xd65c0c,_0x1d115b){_0x1d115b=_0x1d115b||0xcc;return function(_0x11a530){if(_0x11a530){return _0xd65c0c[_0xdbc0('0xd')](_0x1d115b);}return _0xd65c0c[_0xdbc0('0xe')](_0x1d115b)[_0xdbc0('0xf')]();};}function respondWithResult(_0x35933f,_0x5cbc99){_0x5cbc99=_0x5cbc99||0xc8;return function(_0x5670a4){if(_0x5670a4){return _0x35933f[_0xdbc0('0xe')](_0x5cbc99)[_0xdbc0('0x10')](_0x5670a4);}};}function respondWithFilteredResult(_0x394751,_0x51c5b6){return function(_0x4e105b){if(_0x4e105b){var _0xa1083a=typeof _0x51c5b6[_0xdbc0('0x11')]===_0xdbc0('0x12')&&typeof _0x51c5b6[_0xdbc0('0x13')]===_0xdbc0('0x12');var _0x3b7726=_0x4e105b[_0xdbc0('0x14')];var _0x20ee50=_0xa1083a?0x0:_0x51c5b6[_0xdbc0('0x11')];var _0x5d9249=_0xa1083a?_0x4e105b[_0xdbc0('0x14')]:_0x51c5b6[_0xdbc0('0x11')]+_0x51c5b6[_0xdbc0('0x13')];var _0xa7772a;if(_0x5d9249>=_0x3b7726){_0x5d9249=_0x3b7726;_0xa7772a=0xc8;}else{_0xa7772a=0xce;}_0x394751[_0xdbc0('0xe')](_0xa7772a);return _0x394751[_0xdbc0('0x15')](_0xdbc0('0x16'),_0x20ee50+'-'+_0x5d9249+'/'+_0x3b7726)[_0xdbc0('0x10')](_0x4e105b);}return null;};}function saveUpdates(_0x1aa085){return function(_0x141a73){if(_0x141a73){return _0x141a73[_0xdbc0('0x17')](_0x1aa085)[_0xdbc0('0x18')](function(_0x4abe12){return _0x4abe12;});}return null;};}function removeEntity(_0x32d041){return function(_0x12eb82){if(_0x12eb82){return _0x12eb82[_0xdbc0('0x19')]()[_0xdbc0('0x18')](function(){var _0x5376e0=_0x12eb82['get']({'plain':!![]});var _0x3f476d='OpenchannelQueues';return db[_0xdbc0('0x1a')]['destroy']({'where':{'type':_0x3f476d,'resourceId':_0x5376e0['id']}})[_0xdbc0('0x18')](function(){return _0x12eb82;});})[_0xdbc0('0x18')](function(){_0x32d041[_0xdbc0('0xe')](0xcc)[_0xdbc0('0xf')]();});}};}function handleEntityNotFound(_0x52967b){return function(_0x45df03){if(!_0x45df03){_0x52967b['sendStatus'](0x194);}return _0x45df03;};}function handleError(_0x26dad9,_0x13cf27){_0x13cf27=_0x13cf27||0x1f4;return function(_0x372fc6){logger[_0xdbc0('0x1b')](_0x372fc6[_0xdbc0('0x1c')]);if(_0x372fc6['name']){delete _0x372fc6[_0xdbc0('0x1d')];}_0x26dad9[_0xdbc0('0xe')](_0x13cf27)[_0xdbc0('0x1e')](_0x372fc6);};}exports[_0xdbc0('0x1f')]=function(_0x52899b,_0x5e5e42){var _0xf7b178={};var _0x44425a={'count':0x0,'rows':[]};var _0x34f6cb=_[_0xdbc0('0x20')](db['OpenchannelQueue'][_0xdbc0('0x21')],function(_0x5d227f){return{'name':_0x5d227f[_0xdbc0('0x22')],'type':_0x5d227f[_0xdbc0('0x23')][_0xdbc0('0x24')]};});_0xf7b178=qs['getOptions'](_0x34f6cb,_0x52899b);var _0x5be2a7={'where':_0xf7b178[_0xdbc0('0x25')]};return db[_0xdbc0('0x26')]['count'](_0x5be2a7)[_0xdbc0('0x18')](function(_0x3480e6){_0x44425a[_0xdbc0('0x14')]=_0x3480e6;_0xf7b178[_0xdbc0('0x27')]=qs[_0xdbc0('0x27')](_0x52899b[_0xdbc0('0x28')]);return db[_0xdbc0('0x26')][_0xdbc0('0x29')](_0xf7b178);})[_0xdbc0('0x18')](function(_0x418932){_0x44425a[_0xdbc0('0x2a')]=_0x418932;return _0x44425a;})[_0xdbc0('0x18')](respondWithFilteredResult(_0x5e5e42,_0xf7b178))['catch'](handleError(_0x5e5e42,null));};exports[_0xdbc0('0x2b')]=function(_0xe41fe5,_0x2141c5){var _0x3a9183={'raw':!![],'where':{'id':_0xe41fe5[_0xdbc0('0x2c')]['id']}},_0x266f21={};_0x266f21[_0xdbc0('0x2d')]=_[_0xdbc0('0x2e')](db[_0xdbc0('0x26')][_0xdbc0('0x21')]);_0x266f21[_0xdbc0('0x28')]=_[_0xdbc0('0x2e')](_0xe41fe5[_0xdbc0('0x28')]);_0x266f21['filters']=_['intersection'](_0x266f21[_0xdbc0('0x2d')],_0x266f21[_0xdbc0('0x28')]);_0x3a9183[_0xdbc0('0x2f')]=_['intersection'](_0x266f21['model'],qs[_0xdbc0('0x30')](_0xe41fe5[_0xdbc0('0x28')]['fields']));_0x3a9183[_0xdbc0('0x2f')]=_0x3a9183[_0xdbc0('0x2f')][_0xdbc0('0x31')]?_0x3a9183[_0xdbc0('0x2f')]:_0x266f21[_0xdbc0('0x2d')];if(_0xe41fe5['query'][_0xdbc0('0x32')]){_0x3a9183[_0xdbc0('0x27')]=[{'all':!![]}];}_0x3a9183=_[_0xdbc0('0x33')]({},_0x3a9183,_0xe41fe5[_0xdbc0('0x34')]);return db['OpenchannelQueue']['find'](_0x3a9183)['then'](handleEntityNotFound(_0x2141c5,null))['then'](respondWithResult(_0x2141c5,null))[_0xdbc0('0x35')](handleError(_0x2141c5,null));};exports['create']=function(_0x347450,_0x5e13b3){return db['OpenchannelQueue'][_0xdbc0('0x36')](_0x347450[_0xdbc0('0x37')],{})[_0xdbc0('0x18')](function(_0xa4130){var _0x4d3b0c=_0x347450[_0xdbc0('0x38')]['get']({'plain':!![]});if(!_0x4d3b0c)throw new Error(_0xdbc0('0x39'));if(_0x4d3b0c[_0xdbc0('0x3a')]===_0xdbc0('0x38')){var _0x5bcf3d=_0xa4130[_0xdbc0('0x3b')]({'plain':!![]});var _0x305c02=_0xdbc0('0x3c');return db[_0xdbc0('0x3d')]['find']({'where':{'name':_0x305c02,'userProfileId':_0x4d3b0c[_0xdbc0('0x3e')]},'raw':!![]})[_0xdbc0('0x18')](function(_0x45fa38){if(_0x45fa38&&_0x45fa38[_0xdbc0('0x3f')]===0x0){return db[_0xdbc0('0x1a')][_0xdbc0('0x36')]({'name':_0x5bcf3d['name'],'resourceId':_0x5bcf3d['id'],'type':_0x45fa38['name'],'sectionId':_0x45fa38['id']},{})['then'](function(){return _0xa4130;});}else{return _0xa4130;}})['catch'](function(_0x35b181){logger[_0xdbc0('0x1b')](_0xdbc0('0x40'),_0x35b181);throw _0x35b181;});}return _0xa4130;})[_0xdbc0('0x18')](respondWithResult(_0x5e13b3,0xc9))[_0xdbc0('0x35')](handleError(_0x5e13b3,null));};exports[_0xdbc0('0x17')]=function(_0x39ab6f,_0x5096b5){if(_0x39ab6f['body']['id']){delete _0x39ab6f[_0xdbc0('0x37')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x39ab6f[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](handleEntityNotFound(_0x5096b5,null))[_0xdbc0('0x18')](saveUpdates(_0x39ab6f[_0xdbc0('0x37')],null))['then'](respondWithResult(_0x5096b5,null))[_0xdbc0('0x35')](handleError(_0x5096b5,null));};exports[_0xdbc0('0x19')]=function(_0x2af21c,_0x5e721d){return db['OpenchannelQueue']['find']({'where':{'id':_0x2af21c[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](handleEntityNotFound(_0x5e721d,null))[_0xdbc0('0x18')](removeEntity(_0x5e721d,null))[_0xdbc0('0x35')](handleError(_0x5e721d,null));};exports['describe']=function(_0x180db1,_0x47ec6c){return db[_0xdbc0('0x26')][_0xdbc0('0x41')]()[_0xdbc0('0x18')](respondWithResult(_0x47ec6c,null))[_0xdbc0('0x35')](handleError(_0x47ec6c,null));};exports[_0xdbc0('0x42')]=function(_0x2be969,_0x273058){var _0x35dfd8={'raw':!![],'where':{}},_0x4eaaf={},_0xf9e321;return db[_0xdbc0('0x26')]['findOne']({'where':{'id':_0x2be969[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](handleEntityNotFound(_0x273058,null))[_0xdbc0('0x18')](function(_0x5b5993){if(_0x5b5993){_0xf9e321=_0x5b5993[_0xdbc0('0x3b')]({'plain':!![]});_0x4eaaf[_0xdbc0('0x2d')]=_['keys'](db[_0xdbc0('0x43')][_0xdbc0('0x21')]);_0x4eaaf[_0xdbc0('0x28')]=_[_0xdbc0('0x2e')](_0x2be969['query']);_0x4eaaf[_0xdbc0('0x44')]=_[_0xdbc0('0x45')](_0x4eaaf[_0xdbc0('0x2d')],_0x4eaaf[_0xdbc0('0x28')]);_0x35dfd8['attributes']=_[_0xdbc0('0x45')](_0x4eaaf[_0xdbc0('0x2d')],qs[_0xdbc0('0x30')](_0x2be969[_0xdbc0('0x28')][_0xdbc0('0x30')]));_0x35dfd8[_0xdbc0('0x2f')]=_0x35dfd8[_0xdbc0('0x2f')][_0xdbc0('0x31')]?_0x35dfd8[_0xdbc0('0x2f')]:_0x4eaaf[_0xdbc0('0x2d')];if(!_0x2be969[_0xdbc0('0x28')][_0xdbc0('0x46')](_0xdbc0('0x47'))){_0x35dfd8['limit']=qs[_0xdbc0('0x13')](_0x2be969['query'][_0xdbc0('0x13')]);_0x35dfd8[_0xdbc0('0x11')]=qs[_0xdbc0('0x11')](_0x2be969[_0xdbc0('0x28')][_0xdbc0('0x11')]);}_0x35dfd8['order']=qs['sort'](_0x2be969[_0xdbc0('0x28')]['sort']);_0x35dfd8[_0xdbc0('0x25')]=qs[_0xdbc0('0x44')](_['pick'](_0x2be969[_0xdbc0('0x28')],_0x4eaaf['filters']));_0x35dfd8['where'][_0xdbc0('0x48')]=_0x5b5993['id'];if(_0x2be969[_0xdbc0('0x28')][_0xdbc0('0x49')]){_0x35dfd8['where']=_['merge'](_0x35dfd8[_0xdbc0('0x25')],{'$or':_[_0xdbc0('0x20')](_0x35dfd8[_0xdbc0('0x2f')],function(_0x15b324){var _0xd8dddb={};_0xd8dddb[_0x15b324]={'$like':'%'+_0x2be969[_0xdbc0('0x28')][_0xdbc0('0x49')]+'%'};return _0xd8dddb;})});}_0x35dfd8=_['merge']({},_0x35dfd8,_0x2be969['options']);return db[_0xdbc0('0x43')][_0xdbc0('0x29')](_0x35dfd8);}})[_0xdbc0('0x18')](function(_0x22dbf7){if(_0x22dbf7){return db[_0xdbc0('0x4a')]['findAndCountAll']({'where':{'id':_['map'](_0x22dbf7,'UserId'),'role':_0xdbc0('0x4b')},'attributes':['id',_0xdbc0('0x1d'),_0xdbc0('0x4c'),_0xdbc0('0x4d'),_0xdbc0('0x4e')]});}})[_0xdbc0('0x18')](function(_0x470823){if(_0x470823){return{'count':_0x470823[_0xdbc0('0x14')],'rows':_['map'](_0x470823[_0xdbc0('0x2a')],function(_0x14fce6){return{'membername':_0x14fce6['name'],'UserId':_0x14fce6['id'],'queue_name':_0xf9e321['name'],'OpenchannelQueueId':_0xf9e321['id'],'interface':util[_0xdbc0('0x4f')](_0xdbc0('0x50'),'SIP',_0x14fce6[_0xdbc0('0x1d')]),'penalty':0x0,'paused':_0x14fce6[_0xdbc0('0x4c')],'createdAt':_0x14fce6[_0xdbc0('0x4e')],'updatedAt':_0x14fce6[_0xdbc0('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdbc0('0x18')](respondWithFilteredResult(_0x273058,_0x35dfd8))['catch'](handleError(_0x273058,null));};exports[_0xdbc0('0x51')]=function(_0x4f24c0,_0x2d01c6){var _0x2ad71a={};var _0x4ade91={};var _0x4af536;var _0x30ad9c;return db[_0xdbc0('0x26')][_0xdbc0('0x52')]({'where':{'id':_0x4f24c0[_0xdbc0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2d01c6,null))[_0xdbc0('0x18')](function(_0x388ca5){if(_0x388ca5){_0x4af536=_0x388ca5;_0x4ade91[_0xdbc0('0x2d')]=_[_0xdbc0('0x2e')](db['Team'][_0xdbc0('0x21')]);_0x4ade91['query']=_[_0xdbc0('0x2e')](_0x4f24c0['query']);_0x4ade91[_0xdbc0('0x44')]=_[_0xdbc0('0x45')](_0x4ade91['model'],_0x4ade91[_0xdbc0('0x28')]);_0x2ad71a[_0xdbc0('0x2f')]=_[_0xdbc0('0x45')](_0x4ade91[_0xdbc0('0x2d')],qs['fields'](_0x4f24c0['query'][_0xdbc0('0x30')]));_0x2ad71a[_0xdbc0('0x2f')]=_0x2ad71a[_0xdbc0('0x2f')]['length']?_0x2ad71a[_0xdbc0('0x2f')]:_0x4ade91['model'];_0x2ad71a[_0xdbc0('0x53')]=qs[_0xdbc0('0x54')](_0x4f24c0[_0xdbc0('0x28')][_0xdbc0('0x54')]);_0x2ad71a[_0xdbc0('0x25')]=qs[_0xdbc0('0x44')](_[_0xdbc0('0x55')](_0x4f24c0[_0xdbc0('0x28')],_0x4ade91[_0xdbc0('0x44')]));if(_0x4f24c0[_0xdbc0('0x28')][_0xdbc0('0x49')]){_0x2ad71a[_0xdbc0('0x25')]=_[_0xdbc0('0x33')](_0x2ad71a[_0xdbc0('0x25')],{'$or':_['map'](_0x2ad71a['attributes'],function(_0x259581){var _0x5af7b9={};_0x5af7b9[_0x259581]={'$like':'%'+_0x4f24c0[_0xdbc0('0x28')][_0xdbc0('0x49')]+'%'};return _0x5af7b9;})});}_0x2ad71a=_[_0xdbc0('0x33')]({},_0x2ad71a,_0x4f24c0['options']);return _0x4af536[_0xdbc0('0x51')](_0x2ad71a);}})['then'](function(_0x1540da){if(_0x1540da){_0x30ad9c=_0x1540da[_0xdbc0('0x31')];if(!_0x4f24c0[_0xdbc0('0x28')]['hasOwnProperty'](_0xdbc0('0x47'))){_0x2ad71a[_0xdbc0('0x13')]=qs[_0xdbc0('0x13')](_0x4f24c0[_0xdbc0('0x28')]['limit']);_0x2ad71a['offset']=qs['offset'](_0x4f24c0[_0xdbc0('0x28')][_0xdbc0('0x11')]);}return _0x4af536[_0xdbc0('0x51')](_0x2ad71a);}})['then'](function(_0x3f5077){if(_0x3f5077){return _0x3f5077?{'count':_0x30ad9c,'rows':_0x3f5077}:null;}})[_0xdbc0('0x18')](respondWithResult(_0x2d01c6,null))[_0xdbc0('0x35')](handleError(_0x2d01c6,null));};exports[_0xdbc0('0x56')]=function(_0x40ad50,_0x18d511){var _0x516949=_0x40ad50[_0xdbc0('0x37')]['ids'];return db[_0xdbc0('0x57')][_0xdbc0('0x29')]({'where':{'id':_0x516949},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdbc0('0x58'),'attributes':['id',_0xdbc0('0x1d'),_0xdbc0('0x59'),_0xdbc0('0x5a'),_0xdbc0('0x5b')],'raw':!![]}]})[_0xdbc0('0x18')](function(_0x792fd6){if(_0x792fd6){var _0x559388=_[_0xdbc0('0x5c')](_0x792fd6,function(_0x3952fd){var _0x3921d2=_0x3952fd[_0xdbc0('0x3b')]({'plain':!![]});return _0x3921d2[_0xdbc0('0x58')];});return db[_0xdbc0('0x26')][_0xdbc0('0x5d')]({'where':{'id':_0x40ad50[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](function(_0x17e9f0){return db[_0xdbc0('0x5e')][_0xdbc0('0x5f')](function(_0x3a41f7){return _0x17e9f0[_0xdbc0('0x56')](_0x516949,{'transaction':_0x3a41f7})[_0xdbc0('0x18')](function(){return BPromise['each'](_0x559388,function(_0x276b04){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x276b04['id'],'OpenchannelQueueId':_0x40ad50[_0xdbc0('0x2c')]['id']},'transaction':_0x3a41f7});});})[_0xdbc0('0x18')](function(){_0x559388['forEach'](function(_0x4081cc){socket['emit'](_0xdbc0('0x60'),{'UserId':_0x4081cc['id'],'OpenchannelQueueId':_0x17e9f0['id']});});});});});}})['then'](respondWithStatusCode(_0x18d511,null))[_0xdbc0('0x35')](handleError(_0x18d511,null));};exports['removeTeams']=function(_0x2c2f8e,_0x2264a5){return db['Team'][_0xdbc0('0x29')]({'where':{'id':_0x2c2f8e['query'][_0xdbc0('0x61')]},'attributes':['id'],'include':[{'model':db[_0xdbc0('0x4a')],'as':_0xdbc0('0x58'),'attributes':['id'],'raw':!![]}]})[_0xdbc0('0x18')](handleEntityNotFound(_0x2264a5,null))['then'](function(_0x4eaec3){var _0x5e8c3b=_[_0xdbc0('0x20')](_0x4eaec3,'id');var _0x44820f=[];var _0x7c6ae6=[];var _0x2a08c1=squel[_0xdbc0('0x62')]();_0x2a08c1[_0xdbc0('0x63')](_0xdbc0('0x64'))[_0xdbc0('0x65')](_0xdbc0('0x66'),'tq')[_0xdbc0('0x67')](_0xdbc0('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdbc0('0x25')](_0xdbc0('0x69'),_0x2c2f8e[_0xdbc0('0x2c')]['id']);for(var _0x5189dd=0x0;_0x5189dd<_0x4eaec3[_0xdbc0('0x31')];_0x5189dd+=0x1){let _0x3e0957=_0x4eaec3[_0x5189dd];for(var _0x1ed2c0=0x0;_0x1ed2c0<_0x3e0957['Agents'][_0xdbc0('0x31')];_0x1ed2c0+=0x1){let _0x47005d=_0x3e0957[_0xdbc0('0x58')][_0x1ed2c0];var _0x157e66=_0x2a08c1['clone']();_0x157e66['where'](_0xdbc0('0x6a'),_0x47005d['id']);_0x7c6ae6[_0xdbc0('0x6b')](db[_0xdbc0('0x5e')][_0xdbc0('0x28')](_0x157e66[_0xdbc0('0x6c')](),{'type':db['sequelize'][_0xdbc0('0x6d')][_0xdbc0('0x6e')]})[_0xdbc0('0x18')](function(_0x3760a1){if(_0x3760a1[_0xdbc0('0x31')]===0x1){return _0x47005d['id'];}else{var _0x3f8284=_[_0xdbc0('0x6f')](_[_0xdbc0('0x20')](_0x3760a1,_0xdbc0('0x70')),function(_0x342d62){return _[_0xdbc0('0x71')](_0x5e8c3b,_0x342d62);});if(_0x3f8284){return _0x47005d['id'];}}}));}}return BPromise[_0xdbc0('0x72')](_0x7c6ae6)['then'](function(_0x50cddc){_0x44820f=_(_0x44820f)['union'](_0x50cddc)['compact']()[_0xdbc0('0x73')]();return db[_0xdbc0('0x26')][_0xdbc0('0x5d')]({'where':{'id':_0x2c2f8e[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](function(_0x3e6255){return db['sequelize'][_0xdbc0('0x5f')](function(_0x2424be){return _0x3e6255[_0xdbc0('0x74')](_0x2c2f8e[_0xdbc0('0x28')][_0xdbc0('0x61')],{'transaction':_0x2424be})[_0xdbc0('0x18')](function(){if(!_[_0xdbc0('0x75')](_0x44820f)){return _0x3e6255[_0xdbc0('0x76')](_0x44820f,{'transaction':_0x2424be});}})['then'](function(){_0x44820f['forEach'](function(_0x45c109){socket[_0xdbc0('0x77')](_0xdbc0('0x78'),{'UserId':_0x45c109,'OpenchannelQueueId':_0x3e6255['id']});});});});});});})[_0xdbc0('0x18')](respondWithStatusCode(_0x2264a5,null))[_0xdbc0('0x35')](handleError(_0x2264a5,null));};exports['addAgents']=function(_0x563eb7,_0x1f6b94){return db[_0xdbc0('0x26')]['find']({'where':{'id':_0x563eb7['params']['id']}})['then'](handleEntityNotFound(_0x1f6b94,null))['then'](function(_0x33507e){if(_0x33507e){return _0x33507e[_0xdbc0('0x79')](_0x563eb7[_0xdbc0('0x37')][_0xdbc0('0x61')],_[_0xdbc0('0x7a')](_0x563eb7[_0xdbc0('0x37')],['ids','id'])||{})[_0xdbc0('0x7b')](function(_0x173c88){for(var _0x582fb6=0x0;_0x582fb6<_0x563eb7[_0xdbc0('0x37')][_0xdbc0('0x61')][_0xdbc0('0x31')];_0x582fb6+=0x1){socket[_0xdbc0('0x77')](_0xdbc0('0x60'),{'UserId':Number(_0x563eb7[_0xdbc0('0x37')]['ids'][_0x582fb6]),'OpenchannelQueueId':Number(_0x563eb7[_0xdbc0('0x2c')]['id'])});}return _0x173c88;});}})[_0xdbc0('0x18')](respondWithResult(_0x1f6b94,null))[_0xdbc0('0x35')](handleError(_0x1f6b94,null));};exports['removeAgents']=function(_0x4af694,_0x564f94){return db[_0xdbc0('0x26')][_0xdbc0('0x5d')]({'where':{'id':_0x4af694[_0xdbc0('0x2c')]['id']}})[_0xdbc0('0x18')](handleEntityNotFound(_0x564f94,null))[_0xdbc0('0x18')](function(_0x434f28){if(_0x434f28){return _0x434f28['removeAgents'](_0x4af694[_0xdbc0('0x28')][_0xdbc0('0x61')])[_0xdbc0('0x18')](function(){if(_[_0xdbc0('0x7c')](_0x4af694[_0xdbc0('0x28')][_0xdbc0('0x61')])){for(var _0x365965=0x0;_0x365965<_0x4af694[_0xdbc0('0x28')][_0xdbc0('0x61')][_0xdbc0('0x31')];_0x365965+=0x1){socket[_0xdbc0('0x77')](_0xdbc0('0x78'),{'UserId':Number(_0x4af694[_0xdbc0('0x28')][_0xdbc0('0x61')][_0x365965]),'OpenchannelQueueId':Number(_0x4af694[_0xdbc0('0x2c')]['id'])});}}else{socket[_0xdbc0('0x77')](_0xdbc0('0x78'),{'UserId':Number(_0x4af694[_0xdbc0('0x28')][_0xdbc0('0x61')]),'OpenchannelQueueId':Number(_0x4af694['params']['id'])});}});}})[_0xdbc0('0x18')](respondWithStatusCode(_0x564f94,null))[_0xdbc0('0x35')](handleError(_0x564f94,null));};exports[_0xdbc0('0x7d')]=function(_0x4f8dba,_0x3bf9d4){var _0x5a70b3={};var _0x511556={};var _0x1d917d;var _0x10da7d;return db[_0xdbc0('0x26')][_0xdbc0('0x52')]({'where':{'id':_0x4f8dba[_0xdbc0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3bf9d4,null))[_0xdbc0('0x18')](function(_0x24fada){if(_0x24fada){_0x1d917d=_0x24fada;_0x511556['model']=_[_0xdbc0('0x2e')](db[_0xdbc0('0x4a')]['rawAttributes']);_0x511556[_0xdbc0('0x28')]=_[_0xdbc0('0x2e')](_0x4f8dba[_0xdbc0('0x28')]);_0x511556[_0xdbc0('0x44')]=_[_0xdbc0('0x45')](_0x511556[_0xdbc0('0x2d')],_0x511556[_0xdbc0('0x28')]);_0x5a70b3['attributes']=_[_0xdbc0('0x45')](_0x511556[_0xdbc0('0x2d')],qs['fields'](_0x4f8dba[_0xdbc0('0x28')]['fields']));_0x5a70b3[_0xdbc0('0x2f')]=_0x5a70b3['attributes'][_0xdbc0('0x31')]?_0x5a70b3[_0xdbc0('0x2f')]:_0x511556['model'];_0x5a70b3[_0xdbc0('0x53')]=qs[_0xdbc0('0x54')](_0x4f8dba['query']['sort']);_0x5a70b3['where']=qs['filters'](_[_0xdbc0('0x55')](_0x4f8dba[_0xdbc0('0x28')],_0x511556[_0xdbc0('0x44')]));if(_0x4f8dba[_0xdbc0('0x28')][_0xdbc0('0x49')]){_0x5a70b3[_0xdbc0('0x25')]=_[_0xdbc0('0x33')](_0x5a70b3[_0xdbc0('0x25')],{'$or':_[_0xdbc0('0x20')](_0x5a70b3[_0xdbc0('0x2f')],function(_0xa6d374){var _0x2ea9a8={};_0x2ea9a8[_0xa6d374]={'$like':'%'+_0x4f8dba['query'][_0xdbc0('0x49')]+'%'};return _0x2ea9a8;})});}_0x5a70b3=_[_0xdbc0('0x33')]({},_0x5a70b3,_0x4f8dba[_0xdbc0('0x34')]);return _0x1d917d[_0xdbc0('0x7d')](_0x5a70b3);}})[_0xdbc0('0x18')](function(_0x5ee9c1){if(_0x5ee9c1){_0x10da7d=_0x5ee9c1[_0xdbc0('0x31')];if(!_0x4f8dba[_0xdbc0('0x28')][_0xdbc0('0x46')](_0xdbc0('0x47'))){_0x5a70b3['limit']=qs[_0xdbc0('0x13')](_0x4f8dba[_0xdbc0('0x28')][_0xdbc0('0x13')]);_0x5a70b3[_0xdbc0('0x11')]=qs[_0xdbc0('0x11')](_0x4f8dba['query'][_0xdbc0('0x11')]);}return _0x1d917d[_0xdbc0('0x7d')](_0x5a70b3);}})[_0xdbc0('0x18')](function(_0x58576f){if(_0x58576f){return _0x58576f?{'count':_0x10da7d,'rows':_0x58576f}:null;}})[_0xdbc0('0x18')](respondWithResult(_0x3bf9d4,null))[_0xdbc0('0x35')](handleError(_0x3bf9d4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d1b38d7..409f8ef 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 _0x71e4=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x2be18f,_0x38d2e0){var _0x4d37ac=function(_0x5dbe84){while(--_0x5dbe84){_0x2be18f['push'](_0x2be18f['shift']());}};_0x4d37ac(++_0x38d2e0);}(_0x71e4,0x65));var _0x471e=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x71e4[_0x15ca1a];return _0x507626;};'use strict';var EventEmitter=require(_0x471e('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x471e('0x1')](0x0);var events={'afterCreate':_0x471e('0x2'),'afterUpdate':'update','afterDestroy':_0x471e('0x3')};function emitEvent(_0x488870){return function(_0x45715f,_0x43a1c4,_0x500cec){OpenchannelQueueEvents[_0x471e('0x4')](_0x488870+':'+_0x45715f['id'],_0x45715f);OpenchannelQueueEvents['emit'](_0x488870,_0x45715f);_0x500cec(null);};}for(var e in events){if(events[_0x471e('0x5')](e)){var event=events[e];OpenchannelQueue[_0x471e('0x6')](e,emitEvent(event));}}module[_0x471e('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0846=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','emit'];(function(_0x212a78,_0x5addfe){var _0x495749=function(_0x25b637){while(--_0x25b637){_0x212a78['push'](_0x212a78['shift']());}};_0x495749(++_0x5addfe);}(_0x0846,0x17d));var _0x6084=function(_0x7cd053,_0x34e67b){_0x7cd053=_0x7cd053-0x0;var _0x47f178=_0x0846[_0x7cd053];return _0x47f178;};'use strict';var EventEmitter=require(_0x6084('0x0'));var OpenchannelQueue=require(_0x6084('0x1'))['db'][_0x6084('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6084('0x3'),'afterUpdate':_0x6084('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a2b68){return function(_0x13ed26,_0x2f3a80,_0x531ef3){OpenchannelQueueEvents[_0x6084('0x5')](_0x5a2b68+':'+_0x13ed26['id'],_0x13ed26);OpenchannelQueueEvents['emit'](_0x5a2b68,_0x13ed26);_0x531ef3(null);};}for(var e in events){if(events[_0x6084('0x6')](e)){var event=events[e];OpenchannelQueue[_0x6084('0x7')](e,emitEvent(event));}}module[_0x6084('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9f80fe2..edd9028 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 _0x77fa=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x77fa,0x164));var _0xa77f=function(_0x4e11b7,_0x39136c){_0x4e11b7=_0x4e11b7-0x0;var _0x1cc5c7=_0x77fa[_0x4e11b7];return _0x1cc5c7;};'use strict';var _=require(_0xa77f('0x0'));var util=require(_0xa77f('0x1'));var logger=require(_0xa77f('0x2'))(_0xa77f('0x3'));var moment=require(_0xa77f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa77f('0x5'));var fs=require('fs');var path=require(_0xa77f('0x6'));var rimraf=require(_0xa77f('0x7'));var config=require(_0xa77f('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xa77f('0x9')]=function(_0x39841e,_0x2a2da0){return _0x39841e[_0xa77f('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13a9=['exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37fa2b,_0xe35210){var _0x37cb4b=function(_0x40034a){while(--_0x40034a){_0x37fa2b['push'](_0x37fa2b['shift']());}};_0x37cb4b(++_0xe35210);}(_0x13a9,0xd4));var _0x913a=function(_0x580a28,_0x832eaa){_0x580a28=_0x580a28-0x0;var _0x3fd539=_0x13a9[_0x580a28];return _0x3fd539;};'use strict';var _=require('lodash');var util=require(_0x913a('0x0'));var logger=require(_0x913a('0x1'))(_0x913a('0x2'));var moment=require(_0x913a('0x3'));var BPromise=require(_0x913a('0x4'));var rp=require(_0x913a('0x5'));var fs=require('fs');var path=require(_0x913a('0x6'));var rimraf=require(_0x913a('0x7'));var config=require(_0x913a('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x913a('0x9')]=function(_0x8e502e,_0x2f7c2d){return _0x8e502e[_0x913a('0xa')](_0x913a('0xb'),attributes,{'tableName':_0x913a('0xc'),'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 dfbf7ec..85b0cf5 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 _0xb08f=['info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0xb08f,0xb7));var _0xfb08=function(_0xb062ee,_0x5e67a4){_0xb062ee=_0xb062ee-0x0;var _0x254d2e=_0xb08f[_0xb062ee];return _0x254d2e;};'use strict';var _=require(_0xfb08('0x0'));var util=require(_0xfb08('0x1'));var moment=require(_0xfb08('0x2'));var BPromise=require(_0xfb08('0x3'));var rs=require(_0xfb08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb08('0x5'))['db'];var utils=require(_0xfb08('0x6'));var logger=require(_0xfb08('0x7'))(_0xfb08('0x8'));var config=require(_0xfb08('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb08('0xa')][_0xfb08('0xb')]({'port':0x232a});config[_0xfb08('0xc')]=_[_0xfb08('0xd')](config['redis'],{'host':_0xfb08('0xe'),'port':0x18eb});var socket=require(_0xfb08('0xf'))(new Redis(config[_0xfb08('0xc')]));require(_0xfb08('0x10'))[_0xfb08('0x11')](socket);function respondWithRpcPromise(_0x2529d9,_0x6b25d5,_0x3000ae){return new BPromise(function(_0x939c87,_0x522403){return client[_0xfb08('0x12')](_0x2529d9,_0x3000ae)[_0xfb08('0x13')](function(_0x34cd91){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x6b25d5,_0xfb08('0x14'));logger[_0xfb08('0x15')](_0xfb08('0x16'),_0x6b25d5,_0xfb08('0x14'),JSON[_0xfb08('0x17')](_0x34cd91));if(_0x34cd91['error']){if(_0x34cd91[_0xfb08('0x18')]['code']===0x1f4){logger[_0xfb08('0x18')](_0xfb08('0x19'),_0x6b25d5,_0x34cd91[_0xfb08('0x18')][_0xfb08('0x1a')]);return _0x522403(_0x34cd91[_0xfb08('0x18')][_0xfb08('0x1a')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x6b25d5,_0x34cd91[_0xfb08('0x18')][_0xfb08('0x1a')]);return _0x939c87(_0x34cd91[_0xfb08('0x18')][_0xfb08('0x1a')]);}else{logger[_0xfb08('0x1b')](_0xfb08('0x19'),_0x6b25d5,_0xfb08('0x14'));_0x939c87(_0x34cd91['result']['message']);}})[_0xfb08('0x1c')](function(_0x55b78b){logger[_0xfb08('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x6b25d5,_0x55b78b);_0x522403(_0x55b78b);});});}exports[_0xfb08('0x1d')]=function(_0x26c059){var _0x13a190=this;return new Promise(function(_0xccd07a,_0x1d9f07){return db[_0xfb08('0x1e')][_0xfb08('0x1f')]({'raw':_0x26c059[_0xfb08('0x20')]?_0x26c059['options'][_0xfb08('0x21')]===undefined?!![]:![]:!![],'where':_0x26c059[_0xfb08('0x20')]?_0x26c059[_0xfb08('0x20')]['where']||null:null,'attributes':_0x26c059['options']?_0x26c059['options'][_0xfb08('0x22')]||null:null,'limit':_0x26c059[_0xfb08('0x20')]?_0x26c059[_0xfb08('0x20')][_0xfb08('0x23')]||null:null,'include':_0x26c059['options']?_0x26c059[_0xfb08('0x20')][_0xfb08('0x24')]?_[_0xfb08('0x25')](_0x26c059[_0xfb08('0x20')]['include'],function(_0x1d30b6){return{'model':db[_0x1d30b6[_0xfb08('0x26')]],'as':_0x1d30b6['as'],'attributes':_0x1d30b6[_0xfb08('0x22')],'include':_0x1d30b6[_0xfb08('0x24')]?_[_0xfb08('0x25')](_0x1d30b6[_0xfb08('0x24')],function(_0x752635){return{'model':db[_0x752635[_0xfb08('0x26')]],'as':_0x752635['as'],'attributes':_0x752635[_0xfb08('0x22')],'include':_0x752635[_0xfb08('0x24')]?_[_0xfb08('0x25')](_0x752635[_0xfb08('0x24')],function(_0x2251d0){return{'model':db[_0x2251d0['model']],'as':_0x2251d0['as'],'attributes':_0x2251d0[_0xfb08('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfb08('0x13')](function(_0x19d225){logger[_0xfb08('0x1b')]('GetOpenchannelQueue',_0x26c059);logger[_0xfb08('0x15')](_0xfb08('0x1d'),_0x26c059,JSON[_0xfb08('0x17')](_0x19d225));_0xccd07a(_0x19d225);})[_0xfb08('0x1c')](function(_0x3d7946){logger[_0xfb08('0x18')](_0xfb08('0x1d'),_0x3d7946[_0xfb08('0x1a')],_0x26c059);_0x1d9f07(_0x13a190[_0xfb08('0x18')](0x1f4,_0x3d7946[_0xfb08('0x1a')]));});});};exports[_0xfb08('0x27')]=function(_0x109b4b){var _0x1b4706=this;return new Promise(function(_0x3cc367,_0x431f4f){return db[_0xfb08('0x1e')][_0xfb08('0x28')]({'raw':_0x109b4b[_0xfb08('0x20')]?_0x109b4b[_0xfb08('0x20')][_0xfb08('0x21')]===undefined?!![]:![]:!![],'where':_0x109b4b[_0xfb08('0x20')]?_0x109b4b[_0xfb08('0x20')][_0xfb08('0x29')]||null:null,'attributes':_0x109b4b[_0xfb08('0x20')]?_0x109b4b['options'][_0xfb08('0x22')]||null:null,'include':_0x109b4b[_0xfb08('0x20')]?_0x109b4b[_0xfb08('0x20')][_0xfb08('0x24')]?_['map'](_0x109b4b['options'][_0xfb08('0x24')],function(_0x1ad18e){return{'model':db[_0x1ad18e[_0xfb08('0x26')]],'as':_0x1ad18e['as'],'attributes':_0x1ad18e[_0xfb08('0x22')],'include':_0x1ad18e[_0xfb08('0x24')]?_['map'](_0x1ad18e[_0xfb08('0x24')],function(_0x3b0bd5){return{'model':db[_0x3b0bd5[_0xfb08('0x26')]],'as':_0x3b0bd5['as'],'attributes':_0x3b0bd5[_0xfb08('0x22')],'include':_0x3b0bd5[_0xfb08('0x24')]?_[_0xfb08('0x25')](_0x3b0bd5['include'],function(_0x8fca47){return{'model':db[_0x8fca47['model']],'as':_0x8fca47['as'],'attributes':_0x8fca47[_0xfb08('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfb08('0x13')](function(_0x2986f1){logger[_0xfb08('0x1b')](_0xfb08('0x27'),_0x109b4b);logger[_0xfb08('0x15')]('ShowOpenchannelQueue',_0x109b4b,JSON[_0xfb08('0x17')](_0x2986f1));_0x3cc367(_0x2986f1);})[_0xfb08('0x1c')](function(_0xae43ce){logger['error'](_0xfb08('0x27'),_0xae43ce[_0xfb08('0x1a')],_0x109b4b);_0x431f4f(_0x1b4706[_0xfb08('0x18')](0x1f4,_0xae43ce[_0xfb08('0x1a')]));});});}; \ No newline at end of file +var _0x0786=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','find','util','moment','bluebird'];(function(_0x469c64,_0x5afb8c){var _0x88f87f=function(_0xee6adb){while(--_0xee6adb){_0x469c64['push'](_0x469c64['shift']());}};_0x88f87f(++_0x5afb8c);}(_0x0786,0x1dd));var _0x6078=function(_0x3527be,_0x113fdb){_0x3527be=_0x3527be-0x0;var _0x5c61b8=_0x0786[_0x3527be];return _0x5c61b8;};'use strict';var _=require('lodash');var util=require(_0x6078('0x0'));var moment=require(_0x6078('0x1'));var BPromise=require(_0x6078('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6078('0x3'))(_0x6078('0x4'));var config=require(_0x6078('0x5'));var jayson=require(_0x6078('0x6'));var client=jayson[_0x6078('0x7')][_0x6078('0x8')]({'port':0x232a});config[_0x6078('0x9')]=_[_0x6078('0xa')](config[_0x6078('0x9')],{'host':_0x6078('0xb'),'port':0x18eb});var socket=require(_0x6078('0xc'))(new Redis(config[_0x6078('0x9')]));require(_0x6078('0xd'))[_0x6078('0xe')](socket);function respondWithRpcPromise(_0x3b22c1,_0x22caf0,_0x884695){return new BPromise(function(_0x5eb807,_0x2bcf22){return client[_0x6078('0xf')](_0x3b22c1,_0x884695)[_0x6078('0x10')](function(_0x5840bb){logger[_0x6078('0x11')](_0x6078('0x12'),_0x22caf0,_0x6078('0x13'));logger[_0x6078('0x14')](_0x6078('0x15'),_0x22caf0,_0x6078('0x13'),JSON[_0x6078('0x16')](_0x5840bb));if(_0x5840bb[_0x6078('0x17')]){if(_0x5840bb[_0x6078('0x17')][_0x6078('0x18')]===0x1f4){logger[_0x6078('0x17')](_0x6078('0x12'),_0x22caf0,_0x5840bb[_0x6078('0x17')]['message']);return _0x2bcf22(_0x5840bb[_0x6078('0x17')][_0x6078('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x22caf0,_0x5840bb[_0x6078('0x17')][_0x6078('0x19')]);return _0x5eb807(_0x5840bb['error']['message']);}else{logger['info'](_0x6078('0x12'),_0x22caf0,'request\x20sent');_0x5eb807(_0x5840bb['result'][_0x6078('0x19')]);}})[_0x6078('0x1a')](function(_0x983366){logger[_0x6078('0x17')](_0x6078('0x12'),_0x22caf0,_0x983366);_0x2bcf22(_0x983366);});});}exports[_0x6078('0x1b')]=function(_0x510279){var _0x59c8b7=this;return new Promise(function(_0x101a4e,_0x5d037a){return db[_0x6078('0x1c')][_0x6078('0x1d')]({'raw':_0x510279['options']?_0x510279[_0x6078('0x1e')][_0x6078('0x1f')]===undefined?!![]:![]:!![],'where':_0x510279[_0x6078('0x1e')]?_0x510279[_0x6078('0x1e')][_0x6078('0x20')]||null:null,'attributes':_0x510279[_0x6078('0x1e')]?_0x510279[_0x6078('0x1e')]['attributes']||null:null,'limit':_0x510279[_0x6078('0x1e')]?_0x510279[_0x6078('0x1e')][_0x6078('0x21')]||null:null,'include':_0x510279[_0x6078('0x1e')]?_0x510279[_0x6078('0x1e')][_0x6078('0x22')]?_[_0x6078('0x23')](_0x510279[_0x6078('0x1e')][_0x6078('0x22')],function(_0x4fe867){return{'model':db[_0x4fe867[_0x6078('0x24')]],'as':_0x4fe867['as'],'attributes':_0x4fe867[_0x6078('0x25')],'include':_0x4fe867[_0x6078('0x22')]?_[_0x6078('0x23')](_0x4fe867[_0x6078('0x22')],function(_0x27e141){return{'model':db[_0x27e141[_0x6078('0x24')]],'as':_0x27e141['as'],'attributes':_0x27e141[_0x6078('0x25')],'include':_0x27e141['include']?_[_0x6078('0x23')](_0x27e141['include'],function(_0x18d081){return{'model':db[_0x18d081['model']],'as':_0x18d081['as'],'attributes':_0x18d081[_0x6078('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6078('0x10')](function(_0x11a399){logger['info'](_0x6078('0x1b'),_0x510279);logger[_0x6078('0x14')]('GetOpenchannelQueue',_0x510279,JSON[_0x6078('0x16')](_0x11a399));_0x101a4e(_0x11a399);})['catch'](function(_0x3f71b7){logger[_0x6078('0x17')](_0x6078('0x1b'),_0x3f71b7['message'],_0x510279);_0x5d037a(_0x59c8b7[_0x6078('0x17')](0x1f4,_0x3f71b7['message']));});});};exports[_0x6078('0x26')]=function(_0x31a06f){var _0x277008=this;return new Promise(function(_0x5f07ec,_0x338acf){return db['OpenchannelQueue'][_0x6078('0x27')]({'raw':_0x31a06f[_0x6078('0x1e')]?_0x31a06f[_0x6078('0x1e')][_0x6078('0x1f')]===undefined?!![]:![]:!![],'where':_0x31a06f[_0x6078('0x1e')]?_0x31a06f[_0x6078('0x1e')]['where']||null:null,'attributes':_0x31a06f[_0x6078('0x1e')]?_0x31a06f['options'][_0x6078('0x25')]||null:null,'include':_0x31a06f[_0x6078('0x1e')]?_0x31a06f[_0x6078('0x1e')][_0x6078('0x22')]?_[_0x6078('0x23')](_0x31a06f['options'][_0x6078('0x22')],function(_0x30f713){return{'model':db[_0x30f713[_0x6078('0x24')]],'as':_0x30f713['as'],'attributes':_0x30f713[_0x6078('0x25')],'include':_0x30f713[_0x6078('0x22')]?_[_0x6078('0x23')](_0x30f713[_0x6078('0x22')],function(_0x3ec722){return{'model':db[_0x3ec722[_0x6078('0x24')]],'as':_0x3ec722['as'],'attributes':_0x3ec722[_0x6078('0x25')],'include':_0x3ec722[_0x6078('0x22')]?_['map'](_0x3ec722[_0x6078('0x22')],function(_0x632f7c){return{'model':db[_0x632f7c['model']],'as':_0x632f7c['as'],'attributes':_0x632f7c[_0x6078('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6078('0x10')](function(_0x47fb27){logger[_0x6078('0x11')](_0x6078('0x26'),_0x31a06f);logger[_0x6078('0x14')](_0x6078('0x26'),_0x31a06f,JSON[_0x6078('0x16')](_0x47fb27));_0x5f07ec(_0x47fb27);})['catch'](function(_0x549fc8){logger[_0x6078('0x17')](_0x6078('0x26'),_0x549fc8[_0x6078('0x19')],_0x31a06f);_0x338acf(_0x277008[_0x6078('0x17')](0x1f4,_0x549fc8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index caeee2b..63db7a3 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 _0x8bca=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register','length'];(function(_0x2192ee,_0x35c95b){var _0x1f708f=function(_0x3ae1dc){while(--_0x3ae1dc){_0x2192ee['push'](_0x2192ee['shift']());}};_0x1f708f(++_0x35c95b);}(_0x8bca,0x191));var _0xa8bc=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x8bca[_0x4c12ec];return _0x3ae42c;};'use strict';var OpenchannelQueueEvents=require(_0xa8bc('0x0'));var events=[_0xa8bc('0x1'),'remove',_0xa8bc('0x2')];function createListener(_0x5079a4,_0x4d2eb1){return function(_0x2909e8){_0x4d2eb1[_0xa8bc('0x3')](_0x5079a4,_0x2909e8);};}function removeListener(_0x4f6f80,_0x83c2c8){return function(){OpenchannelQueueEvents[_0xa8bc('0x4')](_0x4f6f80,_0x83c2c8);};}exports[_0xa8bc('0x5')]=function(_0x111cd2){for(var _0x3339ea=0x0,_0x47f686=events[_0xa8bc('0x6')];_0x3339ea<_0x47f686;_0x3339ea++){var _0x23dfa9=events[_0x3339ea];var _0x52bd5c=createListener(_0xa8bc('0x7')+_0x23dfa9,_0x111cd2);OpenchannelQueueEvents['on'](_0x23dfa9,_0x52bd5c);}}; \ No newline at end of file +var _0x0283=['register','length','openchannelQueue:','./openchannelQueue.events','save','emit','removeListener'];(function(_0x130e76,_0x1c3104){var _0x11a5e7=function(_0x441495){while(--_0x441495){_0x130e76['push'](_0x130e76['shift']());}};_0x11a5e7(++_0x1c3104);}(_0x0283,0x73));var _0x3028=function(_0xc0f3d0,_0x4cfe98){_0xc0f3d0=_0xc0f3d0-0x0;var _0x1798ba=_0x0283[_0xc0f3d0];return _0x1798ba;};'use strict';var OpenchannelQueueEvents=require(_0x3028('0x0'));var events=[_0x3028('0x1'),'remove','update'];function createListener(_0x4d3005,_0x423268){return function(_0x1ca8c6){_0x423268[_0x3028('0x2')](_0x4d3005,_0x1ca8c6);};}function removeListener(_0xa255d8,_0x54f2b8){return function(){OpenchannelQueueEvents[_0x3028('0x3')](_0xa255d8,_0x54f2b8);};}exports[_0x3028('0x4')]=function(_0x382aa9){for(var _0x1bdce4=0x0,_0x2c2318=events[_0x3028('0x5')];_0x1bdce4<_0x2c2318;_0x1bdce4++){var _0x3f9848=events[_0x1bdce4];var _0x3141f4=createListener(_0x3028('0x6')+_0x3f9848,_0x382aa9);OpenchannelQueueEvents['on'](_0x3f9848,_0x3141f4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 13b63c2..1dddb3d 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 _0x561d=['/:id','post','create','update','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x4d98ac,_0x5613ba){var _0x2f142c=function(_0x539687){while(--_0x539687){_0x4d98ac['push'](_0x4d98ac['shift']());}};_0x2f142c(++_0x5613ba);}(_0x561d,0xe5));var _0xd561=function(_0x342774,_0x4744bf){_0x342774=_0x342774-0x0;var _0x40e233=_0x561d[_0x342774];return _0x40e233;};'use strict';var multer=require(_0xd561('0x0'));var util=require('util');var path=require(_0xd561('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd561('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd561('0x3'));var interaction=require(_0xd561('0x4'));var config=require('../../config/environment');var controller=require(_0xd561('0x5'));router[_0xd561('0x6')]('/',auth['isAuthenticated'](),controller[_0xd561('0x7')]);router['get'](_0xd561('0x8'),auth[_0xd561('0x9')](),controller[_0xd561('0xa')]);router[_0xd561('0x6')](_0xd561('0xb'),auth[_0xd561('0x9')](),controller['show']);router[_0xd561('0xc')]('/',auth[_0xd561('0x9')](),controller[_0xd561('0xd')]);router['put'](_0xd561('0xb'),auth[_0xd561('0x9')](),controller[_0xd561('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd561('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9788=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9788,0xd9));var _0x8978=function(_0xfc8a5f,_0xd7321a){_0xfc8a5f=_0xfc8a5f-0x0;var _0x59175e=_0x9788[_0xfc8a5f];return _0x59175e;};'use strict';var multer=require(_0x8978('0x0'));var util=require(_0x8978('0x1'));var path=require(_0x8978('0x2'));var timeout=require('connect-timeout');var express=require(_0x8978('0x3'));var router=express[_0x8978('0x4')]();var fs_extra=require(_0x8978('0x5'));var auth=require(_0x8978('0x6'));var interaction=require(_0x8978('0x7'));var config=require(_0x8978('0x8'));var controller=require(_0x8978('0x9'));router[_0x8978('0xa')]('/',auth['isAuthenticated'](),controller[_0x8978('0xb')]);router[_0x8978('0xa')]('/describe',auth[_0x8978('0xc')](),controller[_0x8978('0xd')]);router[_0x8978('0xa')](_0x8978('0xe'),auth[_0x8978('0xc')](),controller[_0x8978('0xf')]);router[_0x8978('0x10')]('/',auth[_0x8978('0xc')](),controller['create']);router[_0x8978('0x11')](_0x8978('0xe'),auth[_0x8978('0xc')](),controller[_0x8978('0x12')]);router[_0x8978('0x13')](_0x8978('0xe'),auth['isAuthenticated'](),controller[_0x8978('0x14')]);module[_0x8978('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index db532f8..6f03262 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 _0x7058=['DATE','moment','sequelize','STRING'];(function(_0x8e5d10,_0x1ca5f0){var _0x489f57=function(_0x53c00b){while(--_0x53c00b){_0x8e5d10['push'](_0x8e5d10['shift']());}};_0x489f57(++_0x1ca5f0);}(_0x7058,0xc9));var _0x8705=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x7058[_0x38537f];return _0x141e23;};'use strict';var moment=require(_0x8705('0x0'));var Sequelize=require(_0x8705('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8705('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8705('0x2')]},'joinAt':{'type':Sequelize[_0x8705('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8705('0x3')]},'exitAt':{'type':Sequelize[_0x8705('0x3')]},'reason':{'type':Sequelize[_0x8705('0x2')]}}; \ No newline at end of file +var _0x811b=['STRING','DATE','moment'];(function(_0x41a8bb,_0x6293ef){var _0x4d9682=function(_0xeafb7f){while(--_0xeafb7f){_0x41a8bb['push'](_0x41a8bb['shift']());}};_0x4d9682(++_0x6293ef);}(_0x811b,0xb0));var _0xb811=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x811b[_0x4f8cba];return _0xe240a6;};'use strict';var moment=require(_0xb811('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb811('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb811('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb811('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb811('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 30bb3aa..bd29a24 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 _0xb652=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','VIRTUAL','merge','options','where','OpenchannelQueueReport','include','findAll','rows','params','length','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x35a72a,_0x57cbcf){var _0x2ac359=function(_0x30cc41){while(--_0x30cc41){_0x35a72a['push'](_0x35a72a['shift']());}};_0x2ac359(++_0x57cbcf);}(_0xb652,0x8e));var _0x2b65=function(_0x5e90f0,_0x5b0206){_0x5e90f0=_0x5e90f0-0x0;var _0x49e16a=_0xb652[_0x5e90f0];return _0x49e16a;};'use strict';var emlformat=require(_0x2b65('0x0'));var rimraf=require(_0x2b65('0x1'));var zipdir=require(_0x2b65('0x2'));var jsonpatch=require(_0x2b65('0x3'));var rp=require(_0x2b65('0x4'));var moment=require(_0x2b65('0x5'));var BPromise=require(_0x2b65('0x6'));var Mustache=require(_0x2b65('0x7'));var util=require(_0x2b65('0x8'));var path=require(_0x2b65('0x9'));var sox=require(_0x2b65('0xa'));var csv=require(_0x2b65('0xb'));var ejs=require(_0x2b65('0xc'));var fs=require('fs');var fs_extra=require(_0x2b65('0xd'));var _=require(_0x2b65('0xe'));var squel=require(_0x2b65('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b65('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2b65('0x11'));var Papa=require(_0x2b65('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b65('0x13'));var hardwareService=require(_0x2b65('0x14'));var logger=require('../../config/logger')(_0x2b65('0x15'));var utils=require(_0x2b65('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2b65('0x17'));var db=require(_0x2b65('0x18'))['db'];function respondWithStatusCode(_0x2ac81a,_0xe75e63){_0xe75e63=_0xe75e63||0xcc;return function(_0x2b8823){if(_0x2b8823){return _0x2ac81a[_0x2b65('0x19')](_0xe75e63);}return _0x2ac81a[_0x2b65('0x1a')](_0xe75e63)[_0x2b65('0x1b')]();};}function respondWithResult(_0x253547,_0x21a40b){_0x21a40b=_0x21a40b||0xc8;return function(_0x378e3c){if(_0x378e3c){return _0x253547['status'](_0x21a40b)[_0x2b65('0x1c')](_0x378e3c);}};}function respondWithFilteredResult(_0x5821f1,_0x44339f){return function(_0x28afd7){if(_0x28afd7){var _0x456078=typeof _0x44339f['offset']==='undefined'&&typeof _0x44339f[_0x2b65('0x1d')]===_0x2b65('0x1e');var _0x498780=_0x28afd7[_0x2b65('0x1f')];var _0x54847d=_0x456078?0x0:_0x44339f[_0x2b65('0x20')];var _0x1b4b7e=_0x456078?_0x28afd7[_0x2b65('0x1f')]:_0x44339f['offset']+_0x44339f['limit'];var _0x275fea;if(_0x1b4b7e>=_0x498780){_0x1b4b7e=_0x498780;_0x275fea=0xc8;}else{_0x275fea=0xce;}_0x5821f1[_0x2b65('0x1a')](_0x275fea);return _0x5821f1[_0x2b65('0x21')](_0x2b65('0x22'),_0x54847d+'-'+_0x1b4b7e+'/'+_0x498780)[_0x2b65('0x1c')](_0x28afd7);}return null;};}function patchUpdates(_0x5eb17b){return function(_0x111dd2){try{jsonpatch[_0x2b65('0x23')](_0x111dd2,_0x5eb17b,!![]);}catch(_0x5289f9){return BPromise[_0x2b65('0x24')](_0x5289f9);}return _0x111dd2['save']();};}function saveUpdates(_0x2e5535,_0x2cea1a){return function(_0x566e27){if(_0x566e27){return _0x566e27[_0x2b65('0x25')](_0x2e5535)[_0x2b65('0x26')](function(_0x5674e0){return _0x5674e0;});}return null;};}function removeEntity(_0x11e7bd,_0x4cf494){return function(_0x27e862){if(_0x27e862){return _0x27e862['destroy']()['then'](function(){_0x11e7bd['status'](0xcc)[_0x2b65('0x1b')]();});}};}function handleEntityNotFound(_0x48f3e5,_0x13d859){return function(_0x56b258){if(!_0x56b258){_0x48f3e5['sendStatus'](0x194);}return _0x56b258;};}function handleError(_0x238cf8,_0x4deac3){_0x4deac3=_0x4deac3||0x1f4;return function(_0x17904c){logger['error'](_0x17904c[_0x2b65('0x27')]);if(_0x17904c[_0x2b65('0x28')]){delete _0x17904c[_0x2b65('0x28')];}_0x238cf8[_0x2b65('0x1a')](_0x4deac3)[_0x2b65('0x29')](_0x17904c);};}exports['index']=function(_0x47cb42,_0x5ceb3f){var _0xce5dbd={},_0x54567b={},_0x4402d7={'count':0x0,'rows':[]};var _0x467985=_[_0x2b65('0x2a')](db['OpenchannelQueueReport'][_0x2b65('0x2b')],function(_0x3ddac7){return{'name':_0x3ddac7[_0x2b65('0x2c')],'type':_0x3ddac7[_0x2b65('0x2d')]['key']};});_0x54567b[_0x2b65('0x2e')]=_[_0x2b65('0x2a')](_0x467985,_0x2b65('0x28'));_0x54567b[_0x2b65('0x2f')]=_[_0x2b65('0x30')](_0x47cb42[_0x2b65('0x2f')]);_0x54567b[_0x2b65('0x31')]=_[_0x2b65('0x32')](_0x54567b[_0x2b65('0x2e')],_0x54567b[_0x2b65('0x2f')]);_0xce5dbd[_0x2b65('0x33')]=_[_0x2b65('0x32')](_0x54567b[_0x2b65('0x2e')],qs[_0x2b65('0x34')](_0x47cb42[_0x2b65('0x2f')]['fields']));_0xce5dbd[_0x2b65('0x33')]=_0xce5dbd[_0x2b65('0x33')]['length']?_0xce5dbd[_0x2b65('0x33')]:_0x54567b['model'];if(!_0x47cb42[_0x2b65('0x2f')][_0x2b65('0x35')](_0x2b65('0x36'))){_0xce5dbd[_0x2b65('0x1d')]=qs[_0x2b65('0x1d')](_0x47cb42[_0x2b65('0x2f')][_0x2b65('0x1d')]);_0xce5dbd[_0x2b65('0x20')]=qs['offset'](_0x47cb42['query'][_0x2b65('0x20')]);}_0xce5dbd[_0x2b65('0x37')]=qs['sort'](_0x47cb42[_0x2b65('0x2f')]['sort']);_0xce5dbd['where']=qs[_0x2b65('0x31')](_[_0x2b65('0x38')](_0x47cb42[_0x2b65('0x2f')],_0x54567b[_0x2b65('0x31')]),_0x467985);if(_0x47cb42[_0x2b65('0x2f')][_0x2b65('0x39')]){_0xce5dbd['where']=_['merge'](_0xce5dbd['where'],{'$or':_[_0x2b65('0x2a')](_0x467985,function(_0x3d70dc){if(_0x3d70dc[_0x2b65('0x2d')]!==_0x2b65('0x3a')){var _0x441e8e={};_0x441e8e[_0x3d70dc[_0x2b65('0x28')]]={'$like':'%'+_0x47cb42['query']['filter']+'%'};return _0x441e8e;}})});}_0xce5dbd=_[_0x2b65('0x3b')]({},_0xce5dbd,_0x47cb42[_0x2b65('0x3c')]);var _0x535e39={'where':_0xce5dbd[_0x2b65('0x3d')]};return db[_0x2b65('0x3e')][_0x2b65('0x1f')](_0x535e39)['then'](function(_0x575064){_0x4402d7[_0x2b65('0x1f')]=_0x575064;if(_0x47cb42['query']['includeAll']){_0xce5dbd[_0x2b65('0x3f')]=[{'all':!![]}];}return db[_0x2b65('0x3e')][_0x2b65('0x40')](_0xce5dbd);})[_0x2b65('0x26')](function(_0x556cdf){_0x4402d7[_0x2b65('0x41')]=_0x556cdf;return _0x4402d7;})['then'](respondWithFilteredResult(_0x5ceb3f,_0xce5dbd))['catch'](handleError(_0x5ceb3f,null));};exports['show']=function(_0x31bd15,_0x6ecc29){var _0x18ee5b={'raw':!![],'where':{'id':_0x31bd15[_0x2b65('0x42')]['id']}},_0x53030a={};_0x53030a['model']=_['keys'](db['OpenchannelQueueReport'][_0x2b65('0x2b')]);_0x53030a['query']=_[_0x2b65('0x30')](_0x31bd15[_0x2b65('0x2f')]);_0x53030a[_0x2b65('0x31')]=_[_0x2b65('0x32')](_0x53030a[_0x2b65('0x2e')],_0x53030a[_0x2b65('0x2f')]);_0x18ee5b[_0x2b65('0x33')]=_['intersection'](_0x53030a[_0x2b65('0x2e')],qs['fields'](_0x31bd15[_0x2b65('0x2f')][_0x2b65('0x34')]));_0x18ee5b['attributes']=_0x18ee5b[_0x2b65('0x33')][_0x2b65('0x43')]?_0x18ee5b['attributes']:_0x53030a[_0x2b65('0x2e')];if(_0x31bd15[_0x2b65('0x2f')][_0x2b65('0x44')]){_0x18ee5b['include']=[{'all':!![]}];}_0x18ee5b=_[_0x2b65('0x3b')]({},_0x18ee5b,_0x31bd15[_0x2b65('0x3c')]);return db[_0x2b65('0x3e')][_0x2b65('0x45')](_0x18ee5b)[_0x2b65('0x26')](handleEntityNotFound(_0x6ecc29,null))[_0x2b65('0x26')](respondWithResult(_0x6ecc29,null))[_0x2b65('0x46')](handleError(_0x6ecc29,null));};exports['create']=function(_0x45e5b2,_0xb06798){return db[_0x2b65('0x3e')][_0x2b65('0x47')](_0x45e5b2[_0x2b65('0x48')],{})[_0x2b65('0x26')](respondWithResult(_0xb06798,0xc9))[_0x2b65('0x46')](handleError(_0xb06798,null));};exports[_0x2b65('0x25')]=function(_0x1a1076,_0x5c7c42){if(_0x1a1076['body']['id']){delete _0x1a1076[_0x2b65('0x48')]['id'];}return db[_0x2b65('0x3e')][_0x2b65('0x45')]({'where':{'id':_0x1a1076['params']['id']}})['then'](handleEntityNotFound(_0x5c7c42,null))[_0x2b65('0x26')](saveUpdates(_0x1a1076['body'],null))[_0x2b65('0x26')](respondWithResult(_0x5c7c42,null))[_0x2b65('0x46')](handleError(_0x5c7c42,null));};exports[_0x2b65('0x49')]=function(_0xb8fdca,_0x4266c9){return db[_0x2b65('0x3e')][_0x2b65('0x45')]({'where':{'id':_0xb8fdca[_0x2b65('0x42')]['id']}})[_0x2b65('0x26')](handleEntityNotFound(_0x4266c9,null))[_0x2b65('0x26')](removeEntity(_0x4266c9,null))[_0x2b65('0x46')](handleError(_0x4266c9,null));};exports[_0x2b65('0x4a')]=function(_0x39a24b,_0x3a6cf4){return db[_0x2b65('0x3e')][_0x2b65('0x4a')]()['then'](respondWithResult(_0x3a6cf4,null))[_0x2b65('0x46')](handleError(_0x3a6cf4,null));}; \ No newline at end of file +var _0x91ba=['fields','length','sort','pick','where','merge','filter','count','includeAll','include','rows','catch','show','params','keys','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x91ba,0x145));var _0xa91b=function(_0x3c06e2,_0x247e9d){_0x3c06e2=_0x3c06e2-0x0;var _0x3eb59f=_0x91ba[_0x3c06e2];return _0x3eb59f;};'use strict';var emlformat=require(_0xa91b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa91b('0x1'));var jsonpatch=require(_0xa91b('0x2'));var rp=require(_0xa91b('0x3'));var moment=require('moment');var BPromise=require(_0xa91b('0x4'));var Mustache=require(_0xa91b('0x5'));var util=require(_0xa91b('0x6'));var path=require(_0xa91b('0x7'));var sox=require(_0xa91b('0x8'));var csv=require(_0xa91b('0x9'));var ejs=require(_0xa91b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa91b('0xb'));var squel=require(_0xa91b('0xc'));var crypto=require(_0xa91b('0xd'));var jsforce=require(_0xa91b('0xe'));var deskjs=require(_0xa91b('0xf'));var toCsv=require(_0xa91b('0x9'));var querystring=require(_0xa91b('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa91b('0x11'));var as=require(_0xa91b('0x12'));var hardwareService=require(_0xa91b('0x13'));var logger=require(_0xa91b('0x14'))(_0xa91b('0x15'));var utils=require(_0xa91b('0x16'));var config=require(_0xa91b('0x17'));var licenseUtil=require(_0xa91b('0x18'));var db=require(_0xa91b('0x19'))['db'];function respondWithStatusCode(_0x838c6f,_0x51779a){_0x51779a=_0x51779a||0xcc;return function(_0x46fbac){if(_0x46fbac){return _0x838c6f[_0xa91b('0x1a')](_0x51779a);}return _0x838c6f[_0xa91b('0x1b')](_0x51779a)[_0xa91b('0x1c')]();};}function respondWithResult(_0x1f08bf,_0x22902c){_0x22902c=_0x22902c||0xc8;return function(_0x323b10){if(_0x323b10){return _0x1f08bf[_0xa91b('0x1b')](_0x22902c)[_0xa91b('0x1d')](_0x323b10);}};}function respondWithFilteredResult(_0x1bb4c0,_0x3cc875){return function(_0x1054d4){if(_0x1054d4){var _0x2c7e2b=typeof _0x3cc875[_0xa91b('0x1e')]===_0xa91b('0x1f')&&typeof _0x3cc875[_0xa91b('0x20')]===_0xa91b('0x1f');var _0x2f518c=_0x1054d4['count'];var _0x252dbc=_0x2c7e2b?0x0:_0x3cc875[_0xa91b('0x1e')];var _0x947c4e=_0x2c7e2b?_0x1054d4['count']:_0x3cc875[_0xa91b('0x1e')]+_0x3cc875['limit'];var _0x41bf90;if(_0x947c4e>=_0x2f518c){_0x947c4e=_0x2f518c;_0x41bf90=0xc8;}else{_0x41bf90=0xce;}_0x1bb4c0['status'](_0x41bf90);return _0x1bb4c0[_0xa91b('0x21')](_0xa91b('0x22'),_0x252dbc+'-'+_0x947c4e+'/'+_0x2f518c)[_0xa91b('0x1d')](_0x1054d4);}return null;};}function patchUpdates(_0x278a67){return function(_0x3ed9d0){try{jsonpatch[_0xa91b('0x23')](_0x3ed9d0,_0x278a67,!![]);}catch(_0x3f4a60){return BPromise[_0xa91b('0x24')](_0x3f4a60);}return _0x3ed9d0[_0xa91b('0x25')]();};}function saveUpdates(_0x242d45,_0x144c59){return function(_0x111663){if(_0x111663){return _0x111663[_0xa91b('0x26')](_0x242d45)[_0xa91b('0x27')](function(_0x214b20){return _0x214b20;});}return null;};}function removeEntity(_0x14be83,_0x48f73c){return function(_0x50d6b7){if(_0x50d6b7){return _0x50d6b7['destroy']()[_0xa91b('0x27')](function(){_0x14be83[_0xa91b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34a463,_0x2dafab){return function(_0x2884a9){if(!_0x2884a9){_0x34a463[_0xa91b('0x1a')](0x194);}return _0x2884a9;};}function handleError(_0x37e81a,_0x3c04dd){_0x3c04dd=_0x3c04dd||0x1f4;return function(_0x75d466){logger[_0xa91b('0x28')](_0x75d466[_0xa91b('0x29')]);if(_0x75d466[_0xa91b('0x2a')]){delete _0x75d466['name'];}_0x37e81a['status'](_0x3c04dd)[_0xa91b('0x2b')](_0x75d466);};}exports[_0xa91b('0x2c')]=function(_0x53f9ac,_0x3a8a0e){var _0x50b78e={},_0x1d6b06={},_0x3be6fe={'count':0x0,'rows':[]};var _0x85180a=_[_0xa91b('0x2d')](db[_0xa91b('0x2e')][_0xa91b('0x2f')],function(_0x224bf2){return{'name':_0x224bf2['fieldName'],'type':_0x224bf2[_0xa91b('0x30')][_0xa91b('0x31')]};});_0x1d6b06[_0xa91b('0x32')]=_[_0xa91b('0x2d')](_0x85180a,'name');_0x1d6b06['query']=_['keys'](_0x53f9ac[_0xa91b('0x33')]);_0x1d6b06[_0xa91b('0x34')]=_[_0xa91b('0x35')](_0x1d6b06['model'],_0x1d6b06[_0xa91b('0x33')]);_0x50b78e[_0xa91b('0x36')]=_[_0xa91b('0x35')](_0x1d6b06['model'],qs[_0xa91b('0x37')](_0x53f9ac[_0xa91b('0x33')]['fields']));_0x50b78e['attributes']=_0x50b78e[_0xa91b('0x36')][_0xa91b('0x38')]?_0x50b78e[_0xa91b('0x36')]:_0x1d6b06[_0xa91b('0x32')];if(!_0x53f9ac[_0xa91b('0x33')]['hasOwnProperty']('nolimit')){_0x50b78e['limit']=qs[_0xa91b('0x20')](_0x53f9ac['query']['limit']);_0x50b78e[_0xa91b('0x1e')]=qs[_0xa91b('0x1e')](_0x53f9ac[_0xa91b('0x33')][_0xa91b('0x1e')]);}_0x50b78e['order']=qs[_0xa91b('0x39')](_0x53f9ac[_0xa91b('0x33')][_0xa91b('0x39')]);_0x50b78e['where']=qs['filters'](_[_0xa91b('0x3a')](_0x53f9ac[_0xa91b('0x33')],_0x1d6b06[_0xa91b('0x34')]),_0x85180a);if(_0x53f9ac[_0xa91b('0x33')]['filter']){_0x50b78e[_0xa91b('0x3b')]=_[_0xa91b('0x3c')](_0x50b78e[_0xa91b('0x3b')],{'$or':_['map'](_0x85180a,function(_0x168295){if(_0x168295[_0xa91b('0x30')]!=='VIRTUAL'){var _0x37e90c={};_0x37e90c[_0x168295['name']]={'$like':'%'+_0x53f9ac[_0xa91b('0x33')][_0xa91b('0x3d')]+'%'};return _0x37e90c;}})});}_0x50b78e=_[_0xa91b('0x3c')]({},_0x50b78e,_0x53f9ac['options']);var _0x505ca3={'where':_0x50b78e[_0xa91b('0x3b')]};return db['OpenchannelQueueReport'][_0xa91b('0x3e')](_0x505ca3)['then'](function(_0x1b32c8){_0x3be6fe[_0xa91b('0x3e')]=_0x1b32c8;if(_0x53f9ac['query'][_0xa91b('0x3f')]){_0x50b78e[_0xa91b('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x50b78e);})['then'](function(_0x162293){_0x3be6fe[_0xa91b('0x41')]=_0x162293;return _0x3be6fe;})[_0xa91b('0x27')](respondWithFilteredResult(_0x3a8a0e,_0x50b78e))[_0xa91b('0x42')](handleError(_0x3a8a0e,null));};exports[_0xa91b('0x43')]=function(_0x1eb581,_0x435d5b){var _0x7f6a51={'raw':!![],'where':{'id':_0x1eb581[_0xa91b('0x44')]['id']}},_0x5eb959={};_0x5eb959[_0xa91b('0x32')]=_[_0xa91b('0x45')](db[_0xa91b('0x2e')][_0xa91b('0x2f')]);_0x5eb959[_0xa91b('0x33')]=_[_0xa91b('0x45')](_0x1eb581['query']);_0x5eb959[_0xa91b('0x34')]=_[_0xa91b('0x35')](_0x5eb959['model'],_0x5eb959['query']);_0x7f6a51[_0xa91b('0x36')]=_[_0xa91b('0x35')](_0x5eb959['model'],qs[_0xa91b('0x37')](_0x1eb581[_0xa91b('0x33')]['fields']));_0x7f6a51[_0xa91b('0x36')]=_0x7f6a51['attributes']['length']?_0x7f6a51['attributes']:_0x5eb959[_0xa91b('0x32')];if(_0x1eb581['query'][_0xa91b('0x3f')]){_0x7f6a51[_0xa91b('0x40')]=[{'all':!![]}];}_0x7f6a51=_[_0xa91b('0x3c')]({},_0x7f6a51,_0x1eb581[_0xa91b('0x46')]);return db[_0xa91b('0x2e')][_0xa91b('0x47')](_0x7f6a51)[_0xa91b('0x27')](handleEntityNotFound(_0x435d5b,null))['then'](respondWithResult(_0x435d5b,null))[_0xa91b('0x42')](handleError(_0x435d5b,null));};exports[_0xa91b('0x48')]=function(_0x567dd2,_0x3146b1){return db['OpenchannelQueueReport'][_0xa91b('0x48')](_0x567dd2[_0xa91b('0x49')],{})[_0xa91b('0x27')](respondWithResult(_0x3146b1,0xc9))[_0xa91b('0x42')](handleError(_0x3146b1,null));};exports['update']=function(_0x492b4d,_0x551aa2){if(_0x492b4d[_0xa91b('0x49')]['id']){delete _0x492b4d[_0xa91b('0x49')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x492b4d[_0xa91b('0x44')]['id']}})[_0xa91b('0x27')](handleEntityNotFound(_0x551aa2,null))[_0xa91b('0x27')](saveUpdates(_0x492b4d[_0xa91b('0x49')],null))[_0xa91b('0x27')](respondWithResult(_0x551aa2,null))[_0xa91b('0x42')](handleError(_0x551aa2,null));};exports[_0xa91b('0x4a')]=function(_0x22331a,_0x4fe698){return db[_0xa91b('0x2e')][_0xa91b('0x47')]({'where':{'id':_0x22331a[_0xa91b('0x44')]['id']}})[_0xa91b('0x27')](handleEntityNotFound(_0x4fe698,null))[_0xa91b('0x27')](removeEntity(_0x4fe698,null))[_0xa91b('0x42')](handleError(_0x4fe698,null));};exports[_0xa91b('0x4b')]=function(_0x12c94c,_0x4b7a05){return db[_0xa91b('0x2e')][_0xa91b('0x4b')]()[_0xa91b('0x27')](respondWithResult(_0x4b7a05,null))[_0xa91b('0x42')](handleError(_0x4b7a05,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 059323b..391e30e 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x814b,0x1a2));var _0xb814=function(_0x11bc40,_0x537bbc){_0x11bc40=_0x11bc40-0x0;var _0x2b7a99=_0x814b[_0x11bc40];return _0x2b7a99;};'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 +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x37c13f,_0x5e198c){var _0xd52006=function(_0x51ae23){while(--_0x51ae23){_0x37c13f['push'](_0x37c13f['shift']());}};_0xd52006(++_0x5e198c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ff16f08..c884acf 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f53b1,_0x1b73ab){var _0x1f310f=function(_0x39ec4b){while(--_0x39ec4b){_0x3f53b1['push'](_0x3f53b1['shift']());}};_0x1f310f(++_0x1b73ab);}(_0x5c3c,0x132));var _0xc5c3=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x5c3c[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![]})[_0xc5c3('0xd')](function(_0x3cc612){logger[_0xc5c3('0x15')](_0xc5c3('0x17'),_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x3cc612));_0x28bae6(_0x3cc612);})[_0xc5c3('0x1d')](function(_0x2de266){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x2de266[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2de266['message']));});});};exports[_0xc5c3('0x1e')]=function(_0x38dd9e){var _0x53ab72=this;return new Promise(function(_0x5c7329,_0x23e2fb){return db[_0xc5c3('0x18')][_0xc5c3('0x1f')](_0x38dd9e['body'],{'raw':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e[_0xc5c3('0x1b')]['where']||null:null,'attributes':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e['options'][_0xc5c3('0x20')]||null:null,'limit':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x21')]||null:null})[_0xc5c3('0xd')](function(_0x4773c5){logger[_0xc5c3('0x15')](_0xc5c3('0x1e'),_0x38dd9e);logger[_0xc5c3('0x22')]('UpdateOpenchannelQueueReport',_0x38dd9e,JSON[_0xc5c3('0x11')](_0x4773c5));_0x5c7329(_0x4773c5);})['catch'](function(_0xc4b134){logger[_0xc5c3('0x12')]('UpdateOpenchannelQueueReport',_0xc4b134['message'],_0x38dd9e);_0x23e2fb(_0x53ab72[_0xc5c3('0x12')](0x1f4,_0xc4b134[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0xb6fa=['attributes','limit','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','UpdateOpenchannelQueueReport','update','body','where'];(function(_0x17654f,_0x51e9a8){var _0x184793=function(_0x182c27){while(--_0x182c27){_0x17654f['push'](_0x17654f['shift']());}};_0x184793(++_0x51e9a8);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xb6fa[_0x4d337e];return _0x247963;};'use strict';var _=require(_0xab6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab6f('0x2'))['db'];var utils=require(_0xab6f('0x3'));var logger=require('../../config/logger')(_0xab6f('0x4'));var config=require(_0xab6f('0x5'));var jayson=require(_0xab6f('0x6'));var client=jayson[_0xab6f('0x7')][_0xab6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x895acc,_0x16b84e,_0x1b4da9){return new BPromise(function(_0x46b0f6,_0x85cb19){return client[_0xab6f('0x9')](_0x895acc,_0x1b4da9)[_0xab6f('0xa')](function(_0x199f2d){logger[_0xab6f('0xb')](_0xab6f('0xc'),_0x16b84e,_0xab6f('0xd'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x16b84e,_0xab6f('0xd'),JSON[_0xab6f('0xe')](_0x199f2d));if(_0x199f2d['error']){if(_0x199f2d[_0xab6f('0xf')][_0xab6f('0x10')]===0x1f4){logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')][_0xab6f('0x11')]);return _0x85cb19(_0x199f2d[_0xab6f('0xf')]['message']);}logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')]['message']);return _0x46b0f6(_0x199f2d[_0xab6f('0xf')]['message']);}else{logger['info'](_0xab6f('0xc'),_0x16b84e,'request\x20sent');_0x46b0f6(_0x199f2d[_0xab6f('0x12')][_0xab6f('0x11')]);}})[_0xab6f('0x13')](function(_0x59b934){logger[_0xab6f('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16b84e,_0x59b934);_0x85cb19(_0x59b934);});});}exports[_0xab6f('0x14')]=function(_0x439b73){var _0x3e616c=this;return new Promise(function(_0x2f75c1,_0xbb7af){return db[_0xab6f('0x15')][_0xab6f('0x16')](_0x439b73['body'],{'raw':_0x439b73[_0xab6f('0x17')]?_0x439b73[_0xab6f('0x17')][_0xab6f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x43eda0){logger[_0xab6f('0xb')](_0xab6f('0x14'),_0x439b73);logger[_0xab6f('0x19')](_0xab6f('0x14'),_0x439b73,JSON[_0xab6f('0xe')](_0x43eda0));_0x2f75c1(_0x43eda0);})['catch'](function(_0x4dc7c1){logger[_0xab6f('0xf')](_0xab6f('0x14'),_0x4dc7c1[_0xab6f('0x11')],_0x439b73);_0xbb7af(_0x3e616c[_0xab6f('0xf')](0x1f4,_0x4dc7c1[_0xab6f('0x11')]));});});};exports[_0xab6f('0x1a')]=function(_0xb1ef77){var _0x5634c5=this;return new Promise(function(_0x1294d3,_0xf849b5){return db['OpenchannelQueueReport'][_0xab6f('0x1b')](_0xb1ef77[_0xab6f('0x1c')],{'raw':_0xb1ef77[_0xab6f('0x17')]?_0xb1ef77[_0xab6f('0x17')][_0xab6f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb1ef77['options']?_0xb1ef77[_0xab6f('0x17')][_0xab6f('0x1d')]||null:null,'attributes':_0xb1ef77['options']?_0xb1ef77[_0xab6f('0x17')][_0xab6f('0x1e')]||null:null,'limit':_0xb1ef77[_0xab6f('0x17')]?_0xb1ef77[_0xab6f('0x17')][_0xab6f('0x1f')]||null:null})[_0xab6f('0xa')](function(_0x4952f9){logger[_0xab6f('0xb')]('UpdateOpenchannelQueueReport',_0xb1ef77);logger['debug']('UpdateOpenchannelQueueReport',_0xb1ef77,JSON['stringify'](_0x4952f9));_0x1294d3(_0x4952f9);})['catch'](function(_0x14af68){logger[_0xab6f('0xf')](_0xab6f('0x1a'),_0x14af68[_0xab6f('0x11')],_0xb1ef77);_0xf849b5(_0x5634c5[_0xab6f('0xf')](0x1f4,_0x14af68['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3bcb190..344f459 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 _0x68ff=['describe','post','put','/:id','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x2164ef,_0x9c542d){var _0x4cdf94=function(_0x1cdd7f){while(--_0x1cdd7f){_0x2164ef['push'](_0x2164ef['shift']());}};_0x4cdf94(++_0x9c542d);}(_0x68ff,0x79));var _0xf68f=function(_0x436dbd,_0x4290cc){_0x436dbd=_0x436dbd-0x0;var _0x2c9bc5=_0x68ff[_0x436dbd];return _0x2c9bc5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf68f('0x0'));var express=require(_0xf68f('0x1'));var router=express[_0xf68f('0x2')]();var fs_extra=require(_0xf68f('0x3'));var auth=require(_0xf68f('0x4'));var interaction=require(_0xf68f('0x5'));var config=require(_0xf68f('0x6'));var controller=require(_0xf68f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf68f('0x8')]);router[_0xf68f('0x9')](_0xf68f('0xa'),auth[_0xf68f('0xb')](),controller[_0xf68f('0xc')]);router[_0xf68f('0x9')]('/:id',auth[_0xf68f('0xb')](),controller['show']);router[_0xf68f('0xd')]('/',auth[_0xf68f('0xb')](),controller['create']);router[_0xf68f('0xe')](_0xf68f('0xf'),auth[_0xf68f('0xb')](),controller[_0xf68f('0x10')]);router[_0xf68f('0x11')]('/:id',auth[_0xf68f('0xb')](),controller['destroy']);module[_0xf68f('0x12')]=router; \ No newline at end of file +var _0x5501=['/:id','show','post','create','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5501,0xc3));var _0x1550=function(_0x367c95,_0x545ab3){_0x367c95=_0x367c95-0x0;var _0x4220d6=_0x5501[_0x367c95];return _0x4220d6;};'use strict';var multer=require('multer');var util=require(_0x1550('0x0'));var path=require(_0x1550('0x1'));var timeout=require(_0x1550('0x2'));var express=require(_0x1550('0x3'));var router=express[_0x1550('0x4')]();var fs_extra=require(_0x1550('0x5'));var auth=require(_0x1550('0x6'));var interaction=require(_0x1550('0x7'));var config=require(_0x1550('0x8'));var controller=require(_0x1550('0x9'));router[_0x1550('0xa')]('/',auth[_0x1550('0xb')](),controller[_0x1550('0xc')]);router['get'](_0x1550('0xd'),auth[_0x1550('0xb')](),controller['describe']);router['get'](_0x1550('0xe'),auth['isAuthenticated'](),controller[_0x1550('0xf')]);router[_0x1550('0x10')]('/',auth[_0x1550('0xb')](),controller[_0x1550('0x11')]);router['put']('/:id',auth[_0x1550('0xb')](),controller['update']);router['delete'](_0x1550('0xe'),auth[_0x1550('0xb')](),controller[_0x1550('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 93e7e37..d6ee546 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x16e56f,_0x3439a2){var _0x54ed56=function(_0x4241b8){while(--_0x4241b8){_0x16e56f['push'](_0x16e56f['shift']());}};_0x54ed56(++_0x3439a2);}(_0xe706,0xa3));var _0x6e70=function(_0x585276,_0x553f5a){_0x585276=_0x585276-0x0;var _0x4a7181=_0xe706[_0x585276];return _0x4a7181;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x12e075,_0x2f6b9c){var _0xacd6dd=function(_0x1135c2){while(--_0x1135c2){_0x12e075['push'](_0x12e075['shift']());}};_0xacd6dd(++_0x2f6b9c);}(_0x34e8,0x12c));var _0x834e=function(_0x4e1841,_0x315ed1){_0x4e1841=_0x4e1841-0x0;var _0x5bfa7a=_0x34e8[_0x4e1841];return _0x5bfa7a;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4261683..91fb1e8 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 _0x19d0=['end','error','name','send','map','OpenchannelTransferReport','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then'];(function(_0x552474,_0xb7958d){var _0x348d11=function(_0x5cd421){while(--_0x5cd421){_0x552474['push'](_0x552474['shift']());}};_0x348d11(++_0xb7958d);}(_0x19d0,0x14b));var _0x019d=function(_0x21e1dc,_0x2b148d){_0x21e1dc=_0x21e1dc-0x0;var _0x44cfb9=_0x19d0[_0x21e1dc];return _0x44cfb9;};'use strict';var emlformat=require(_0x019d('0x0'));var rimraf=require(_0x019d('0x1'));var zipdir=require(_0x019d('0x2'));var jsonpatch=require(_0x019d('0x3'));var rp=require(_0x019d('0x4'));var moment=require(_0x019d('0x5'));var BPromise=require(_0x019d('0x6'));var Mustache=require(_0x019d('0x7'));var util=require(_0x019d('0x8'));var path=require(_0x019d('0x9'));var sox=require('sox');var csv=require(_0x019d('0xa'));var ejs=require(_0x019d('0xb'));var fs=require('fs');var fs_extra=require(_0x019d('0xc'));var _=require(_0x019d('0xd'));var squel=require(_0x019d('0xe'));var crypto=require(_0x019d('0xf'));var jsforce=require(_0x019d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x019d('0xa'));var querystring=require(_0x019d('0x11'));var Papa=require('papaparse');var Redis=require(_0x019d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x019d('0x13'));var as=require(_0x019d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x019d('0x15'))('api');var utils=require(_0x019d('0x16'));var config=require(_0x019d('0x17'));var licenseUtil=require(_0x019d('0x18'));var db=require(_0x019d('0x19'))['db'];function respondWithStatusCode(_0x57b142,_0x472a83){_0x472a83=_0x472a83||0xcc;return function(_0x6b70b0){if(_0x6b70b0){return _0x57b142[_0x019d('0x1a')](_0x472a83);}return _0x57b142[_0x019d('0x1b')](_0x472a83)['end']();};}function respondWithResult(_0x59f736,_0x1a5674){_0x1a5674=_0x1a5674||0xc8;return function(_0x24c08b){if(_0x24c08b){return _0x59f736[_0x019d('0x1b')](_0x1a5674)[_0x019d('0x1c')](_0x24c08b);}};}function respondWithFilteredResult(_0x3cef19,_0x1f1a74){return function(_0x159620){if(_0x159620){var _0x4cad30=typeof _0x1f1a74[_0x019d('0x1d')]==='undefined'&&typeof _0x1f1a74[_0x019d('0x1e')]===_0x019d('0x1f');var _0x29c3f6=_0x159620[_0x019d('0x20')];var _0x7b8baf=_0x4cad30?0x0:_0x1f1a74['offset'];var _0x11862c=_0x4cad30?_0x159620[_0x019d('0x20')]:_0x1f1a74['offset']+_0x1f1a74[_0x019d('0x1e')];var _0x26d128;if(_0x11862c>=_0x29c3f6){_0x11862c=_0x29c3f6;_0x26d128=0xc8;}else{_0x26d128=0xce;}_0x3cef19[_0x019d('0x1b')](_0x26d128);return _0x3cef19[_0x019d('0x21')](_0x019d('0x22'),_0x7b8baf+'-'+_0x11862c+'/'+_0x29c3f6)[_0x019d('0x1c')](_0x159620);}return null;};}function patchUpdates(_0x1e0792){return function(_0x3dfe03){try{jsonpatch['apply'](_0x3dfe03,_0x1e0792,!![]);}catch(_0x3116cb){return BPromise[_0x019d('0x23')](_0x3116cb);}return _0x3dfe03[_0x019d('0x24')]();};}function saveUpdates(_0x232839,_0x5a93f9){return function(_0x5ea37e){if(_0x5ea37e){return _0x5ea37e[_0x019d('0x25')](_0x232839)[_0x019d('0x26')](function(_0x4f3690){return _0x4f3690;});}return null;};}function removeEntity(_0x3b5c98,_0x4f2139){return function(_0x2bb0ac){if(_0x2bb0ac){return _0x2bb0ac['destroy']()[_0x019d('0x26')](function(){_0x3b5c98[_0x019d('0x1b')](0xcc)[_0x019d('0x27')]();});}};}function handleEntityNotFound(_0x26fe8f,_0x3e49fc){return function(_0x3d6a8b){if(!_0x3d6a8b){_0x26fe8f[_0x019d('0x1a')](0x194);}return _0x3d6a8b;};}function handleError(_0x9029d4,_0x684ac9){_0x684ac9=_0x684ac9||0x1f4;return function(_0x16fa3c){logger[_0x019d('0x28')](_0x16fa3c['stack']);if(_0x16fa3c['name']){delete _0x16fa3c[_0x019d('0x29')];}_0x9029d4[_0x019d('0x1b')](_0x684ac9)[_0x019d('0x2a')](_0x16fa3c);};}exports['index']=function(_0xb6112a,_0x523a25){var _0x3fdf22={},_0x42a907={},_0x364764={'count':0x0,'rows':[]};var _0x4e4937=_[_0x019d('0x2b')](db[_0x019d('0x2c')]['rawAttributes'],function(_0x3f0149){return{'name':_0x3f0149['fieldName'],'type':_0x3f0149[_0x019d('0x2d')][_0x019d('0x2e')]};});_0x42a907['model']=_[_0x019d('0x2b')](_0x4e4937,_0x019d('0x29'));_0x42a907[_0x019d('0x2f')]=_[_0x019d('0x30')](_0xb6112a[_0x019d('0x2f')]);_0x42a907[_0x019d('0x31')]=_[_0x019d('0x32')](_0x42a907['model'],_0x42a907[_0x019d('0x2f')]);_0x3fdf22[_0x019d('0x33')]=_[_0x019d('0x32')](_0x42a907[_0x019d('0x34')],qs[_0x019d('0x35')](_0xb6112a[_0x019d('0x2f')][_0x019d('0x35')]));_0x3fdf22['attributes']=_0x3fdf22[_0x019d('0x33')]['length']?_0x3fdf22[_0x019d('0x33')]:_0x42a907[_0x019d('0x34')];if(!_0xb6112a[_0x019d('0x2f')][_0x019d('0x36')](_0x019d('0x37'))){_0x3fdf22[_0x019d('0x1e')]=qs[_0x019d('0x1e')](_0xb6112a[_0x019d('0x2f')]['limit']);_0x3fdf22[_0x019d('0x1d')]=qs[_0x019d('0x1d')](_0xb6112a[_0x019d('0x2f')][_0x019d('0x1d')]);}_0x3fdf22[_0x019d('0x38')]=qs[_0x019d('0x39')](_0xb6112a[_0x019d('0x2f')][_0x019d('0x39')]);_0x3fdf22['where']=qs[_0x019d('0x31')](_[_0x019d('0x3a')](_0xb6112a[_0x019d('0x2f')],_0x42a907[_0x019d('0x31')]),_0x4e4937);if(_0xb6112a['query'][_0x019d('0x3b')]){_0x3fdf22[_0x019d('0x3c')]=_['merge'](_0x3fdf22[_0x019d('0x3c')],{'$or':_[_0x019d('0x2b')](_0x4e4937,function(_0x5c4056){if(_0x5c4056[_0x019d('0x2d')]!=='VIRTUAL'){var _0xd1ddb1={};_0xd1ddb1[_0x5c4056[_0x019d('0x29')]]={'$like':'%'+_0xb6112a[_0x019d('0x2f')]['filter']+'%'};return _0xd1ddb1;}})});}_0x3fdf22=_[_0x019d('0x3d')]({},_0x3fdf22,_0xb6112a[_0x019d('0x3e')]);var _0x2e807b={'where':_0x3fdf22[_0x019d('0x3c')]};return db[_0x019d('0x2c')][_0x019d('0x20')](_0x2e807b)[_0x019d('0x26')](function(_0x46531c){_0x364764['count']=_0x46531c;if(_0xb6112a[_0x019d('0x2f')][_0x019d('0x3f')]){_0x3fdf22[_0x019d('0x40')]=[{'all':!![]}];}return db[_0x019d('0x2c')][_0x019d('0x41')](_0x3fdf22);})[_0x019d('0x26')](function(_0x3ccc74){_0x364764['rows']=_0x3ccc74;return _0x364764;})['then'](respondWithFilteredResult(_0x523a25,_0x3fdf22))[_0x019d('0x42')](handleError(_0x523a25,null));};exports['show']=function(_0x914a63,_0x32deda){var _0x14f7d8={'raw':!![],'where':{'id':_0x914a63[_0x019d('0x43')]['id']}},_0x3f1a3b={};_0x3f1a3b[_0x019d('0x34')]=_[_0x019d('0x30')](db['OpenchannelTransferReport'][_0x019d('0x44')]);_0x3f1a3b[_0x019d('0x2f')]=_[_0x019d('0x30')](_0x914a63[_0x019d('0x2f')]);_0x3f1a3b[_0x019d('0x31')]=_[_0x019d('0x32')](_0x3f1a3b[_0x019d('0x34')],_0x3f1a3b[_0x019d('0x2f')]);_0x14f7d8[_0x019d('0x33')]=_[_0x019d('0x32')](_0x3f1a3b[_0x019d('0x34')],qs[_0x019d('0x35')](_0x914a63['query'][_0x019d('0x35')]));_0x14f7d8[_0x019d('0x33')]=_0x14f7d8[_0x019d('0x33')]['length']?_0x14f7d8[_0x019d('0x33')]:_0x3f1a3b['model'];if(_0x914a63[_0x019d('0x2f')][_0x019d('0x3f')]){_0x14f7d8[_0x019d('0x40')]=[{'all':!![]}];}_0x14f7d8=_['merge']({},_0x14f7d8,_0x914a63['options']);return db[_0x019d('0x2c')][_0x019d('0x45')](_0x14f7d8)[_0x019d('0x26')](handleEntityNotFound(_0x32deda,null))['then'](respondWithResult(_0x32deda,null))[_0x019d('0x42')](handleError(_0x32deda,null));};exports[_0x019d('0x46')]=function(_0x2bd77c,_0x5bd72a){return db[_0x019d('0x2c')][_0x019d('0x46')](_0x2bd77c[_0x019d('0x47')],{})[_0x019d('0x26')](respondWithResult(_0x5bd72a,0xc9))[_0x019d('0x42')](handleError(_0x5bd72a,null));};exports['update']=function(_0x56fff1,_0x425209){if(_0x56fff1[_0x019d('0x47')]['id']){delete _0x56fff1[_0x019d('0x47')]['id'];}return db['OpenchannelTransferReport'][_0x019d('0x45')]({'where':{'id':_0x56fff1['params']['id']}})[_0x019d('0x26')](handleEntityNotFound(_0x425209,null))['then'](saveUpdates(_0x56fff1[_0x019d('0x47')],null))['then'](respondWithResult(_0x425209,null))[_0x019d('0x42')](handleError(_0x425209,null));};exports[_0x019d('0x48')]=function(_0x1f0ae5,_0x4d9297){return db[_0x019d('0x2c')][_0x019d('0x45')]({'where':{'id':_0x1f0ae5[_0x019d('0x43')]['id']}})[_0x019d('0x26')](handleEntityNotFound(_0x4d9297,null))[_0x019d('0x26')](removeEntity(_0x4d9297,null))[_0x019d('0x42')](handleError(_0x4d9297,null));};exports[_0x019d('0x49')]=function(_0xe3e70e,_0x942c48){return db[_0x019d('0x2c')][_0x019d('0x49')]()[_0x019d('0x26')](respondWithResult(_0x942c48,null))['catch'](handleError(_0x942c48,null));}; \ No newline at end of file +var _0xcd0b=['attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','OpenchannelTransferReport','includeAll','include','findAll','catch','show','merge','options','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xcd0b,0x134));var _0xbcd0=function(_0x2cc73d,_0x296fe1){_0x2cc73d=_0x2cc73d-0x0;var _0x4c2b7c=_0xcd0b[_0x2cc73d];return _0x4c2b7c;};'use strict';var emlformat=require(_0xbcd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcd0('0x1'));var jsonpatch=require(_0xbcd0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcd0('0x3'));var Mustache=require(_0xbcd0('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbcd0('0x5'));var csv=require(_0xbcd0('0x6'));var ejs=require(_0xbcd0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcd0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcd0('0x9'));var toCsv=require('to-csv');var querystring=require(_0xbcd0('0xa'));var Papa=require('papaparse');var Redis=require(_0xbcd0('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcd0('0xc'));var hardwareService=require(_0xbcd0('0xd'));var logger=require(_0xbcd0('0xe'))(_0xbcd0('0xf'));var utils=require(_0xbcd0('0x10'));var config=require(_0xbcd0('0x11'));var licenseUtil=require(_0xbcd0('0x12'));var db=require(_0xbcd0('0x13'))['db'];function respondWithStatusCode(_0xf8ceb4,_0x7f9f7f){_0x7f9f7f=_0x7f9f7f||0xcc;return function(_0x734692){if(_0x734692){return _0xf8ceb4[_0xbcd0('0x14')](_0x7f9f7f);}return _0xf8ceb4[_0xbcd0('0x15')](_0x7f9f7f)[_0xbcd0('0x16')]();};}function respondWithResult(_0x7cc53b,_0x57e59c){_0x57e59c=_0x57e59c||0xc8;return function(_0x552aaf){if(_0x552aaf){return _0x7cc53b[_0xbcd0('0x15')](_0x57e59c)[_0xbcd0('0x17')](_0x552aaf);}};}function respondWithFilteredResult(_0x3cf5ba,_0x554759){return function(_0x27792e){if(_0x27792e){var _0x21305e=typeof _0x554759['offset']===_0xbcd0('0x18')&&typeof _0x554759[_0xbcd0('0x19')]===_0xbcd0('0x18');var _0x222113=_0x27792e[_0xbcd0('0x1a')];var _0x230d6f=_0x21305e?0x0:_0x554759[_0xbcd0('0x1b')];var _0x2e3804=_0x21305e?_0x27792e[_0xbcd0('0x1a')]:_0x554759[_0xbcd0('0x1b')]+_0x554759[_0xbcd0('0x19')];var _0x1bdd87;if(_0x2e3804>=_0x222113){_0x2e3804=_0x222113;_0x1bdd87=0xc8;}else{_0x1bdd87=0xce;}_0x3cf5ba[_0xbcd0('0x15')](_0x1bdd87);return _0x3cf5ba[_0xbcd0('0x1c')](_0xbcd0('0x1d'),_0x230d6f+'-'+_0x2e3804+'/'+_0x222113)['json'](_0x27792e);}return null;};}function patchUpdates(_0x166107){return function(_0x23956f){try{jsonpatch[_0xbcd0('0x1e')](_0x23956f,_0x166107,!![]);}catch(_0x529a5c){return BPromise[_0xbcd0('0x1f')](_0x529a5c);}return _0x23956f[_0xbcd0('0x20')]();};}function saveUpdates(_0x374d29,_0x308a60){return function(_0x473853){if(_0x473853){return _0x473853[_0xbcd0('0x21')](_0x374d29)[_0xbcd0('0x22')](function(_0x1ded50){return _0x1ded50;});}return null;};}function removeEntity(_0x74e2cf,_0x5ea9a2){return function(_0x36eaeb){if(_0x36eaeb){return _0x36eaeb['destroy']()[_0xbcd0('0x22')](function(){_0x74e2cf[_0xbcd0('0x15')](0xcc)[_0xbcd0('0x16')]();});}};}function handleEntityNotFound(_0x50e518,_0x1182c3){return function(_0x4778af){if(!_0x4778af){_0x50e518['sendStatus'](0x194);}return _0x4778af;};}function handleError(_0x290821,_0x34f899){_0x34f899=_0x34f899||0x1f4;return function(_0x3c65fb){logger[_0xbcd0('0x23')](_0x3c65fb[_0xbcd0('0x24')]);if(_0x3c65fb['name']){delete _0x3c65fb[_0xbcd0('0x25')];}_0x290821['status'](_0x34f899)['send'](_0x3c65fb);};}exports[_0xbcd0('0x26')]=function(_0x1963d5,_0x455e88){var _0x2863c4={},_0x403c23={},_0x20899b={'count':0x0,'rows':[]};var _0x351c05=_[_0xbcd0('0x27')](db['OpenchannelTransferReport'][_0xbcd0('0x28')],function(_0x3385ad){return{'name':_0x3385ad[_0xbcd0('0x29')],'type':_0x3385ad[_0xbcd0('0x2a')]['key']};});_0x403c23[_0xbcd0('0x2b')]=_['map'](_0x351c05,_0xbcd0('0x25'));_0x403c23[_0xbcd0('0x2c')]=_[_0xbcd0('0x2d')](_0x1963d5['query']);_0x403c23['filters']=_[_0xbcd0('0x2e')](_0x403c23[_0xbcd0('0x2b')],_0x403c23[_0xbcd0('0x2c')]);_0x2863c4[_0xbcd0('0x2f')]=_[_0xbcd0('0x2e')](_0x403c23['model'],qs[_0xbcd0('0x30')](_0x1963d5['query'][_0xbcd0('0x30')]));_0x2863c4[_0xbcd0('0x2f')]=_0x2863c4['attributes'][_0xbcd0('0x31')]?_0x2863c4[_0xbcd0('0x2f')]:_0x403c23[_0xbcd0('0x2b')];if(!_0x1963d5[_0xbcd0('0x2c')][_0xbcd0('0x32')]('nolimit')){_0x2863c4[_0xbcd0('0x19')]=qs[_0xbcd0('0x19')](_0x1963d5[_0xbcd0('0x2c')][_0xbcd0('0x19')]);_0x2863c4[_0xbcd0('0x1b')]=qs[_0xbcd0('0x1b')](_0x1963d5[_0xbcd0('0x2c')][_0xbcd0('0x1b')]);}_0x2863c4[_0xbcd0('0x33')]=qs[_0xbcd0('0x34')](_0x1963d5[_0xbcd0('0x2c')]['sort']);_0x2863c4[_0xbcd0('0x35')]=qs[_0xbcd0('0x36')](_['pick'](_0x1963d5['query'],_0x403c23[_0xbcd0('0x36')]),_0x351c05);if(_0x1963d5[_0xbcd0('0x2c')][_0xbcd0('0x37')]){_0x2863c4['where']=_['merge'](_0x2863c4[_0xbcd0('0x35')],{'$or':_[_0xbcd0('0x27')](_0x351c05,function(_0x4197e2){if(_0x4197e2[_0xbcd0('0x2a')]!==_0xbcd0('0x38')){var _0x1f5830={};_0x1f5830[_0x4197e2[_0xbcd0('0x25')]]={'$like':'%'+_0x1963d5['query'][_0xbcd0('0x37')]+'%'};return _0x1f5830;}})});}_0x2863c4=_['merge']({},_0x2863c4,_0x1963d5['options']);var _0x186717={'where':_0x2863c4[_0xbcd0('0x35')]};return db[_0xbcd0('0x39')]['count'](_0x186717)[_0xbcd0('0x22')](function(_0x210e4a){_0x20899b[_0xbcd0('0x1a')]=_0x210e4a;if(_0x1963d5[_0xbcd0('0x2c')][_0xbcd0('0x3a')]){_0x2863c4[_0xbcd0('0x3b')]=[{'all':!![]}];}return db[_0xbcd0('0x39')][_0xbcd0('0x3c')](_0x2863c4);})['then'](function(_0x62ac3a){_0x20899b['rows']=_0x62ac3a;return _0x20899b;})['then'](respondWithFilteredResult(_0x455e88,_0x2863c4))[_0xbcd0('0x3d')](handleError(_0x455e88,null));};exports[_0xbcd0('0x3e')]=function(_0x4670f9,_0x1313fc){var _0x6d759c={'raw':!![],'where':{'id':_0x4670f9['params']['id']}},_0x544b96={};_0x544b96['model']=_[_0xbcd0('0x2d')](db[_0xbcd0('0x39')][_0xbcd0('0x28')]);_0x544b96['query']=_[_0xbcd0('0x2d')](_0x4670f9[_0xbcd0('0x2c')]);_0x544b96['filters']=_[_0xbcd0('0x2e')](_0x544b96[_0xbcd0('0x2b')],_0x544b96[_0xbcd0('0x2c')]);_0x6d759c[_0xbcd0('0x2f')]=_['intersection'](_0x544b96[_0xbcd0('0x2b')],qs[_0xbcd0('0x30')](_0x4670f9[_0xbcd0('0x2c')][_0xbcd0('0x30')]));_0x6d759c[_0xbcd0('0x2f')]=_0x6d759c[_0xbcd0('0x2f')][_0xbcd0('0x31')]?_0x6d759c[_0xbcd0('0x2f')]:_0x544b96[_0xbcd0('0x2b')];if(_0x4670f9[_0xbcd0('0x2c')]['includeAll']){_0x6d759c[_0xbcd0('0x3b')]=[{'all':!![]}];}_0x6d759c=_[_0xbcd0('0x3f')]({},_0x6d759c,_0x4670f9[_0xbcd0('0x40')]);return db[_0xbcd0('0x39')][_0xbcd0('0x41')](_0x6d759c)['then'](handleEntityNotFound(_0x1313fc,null))[_0xbcd0('0x22')](respondWithResult(_0x1313fc,null))[_0xbcd0('0x3d')](handleError(_0x1313fc,null));};exports[_0xbcd0('0x42')]=function(_0x43228a,_0x496164){return db[_0xbcd0('0x39')][_0xbcd0('0x42')](_0x43228a[_0xbcd0('0x43')],{})['then'](respondWithResult(_0x496164,0xc9))[_0xbcd0('0x3d')](handleError(_0x496164,null));};exports[_0xbcd0('0x21')]=function(_0x3c9503,_0x18d603){if(_0x3c9503[_0xbcd0('0x43')]['id']){delete _0x3c9503[_0xbcd0('0x43')]['id'];}return db[_0xbcd0('0x39')][_0xbcd0('0x41')]({'where':{'id':_0x3c9503[_0xbcd0('0x44')]['id']}})[_0xbcd0('0x22')](handleEntityNotFound(_0x18d603,null))[_0xbcd0('0x22')](saveUpdates(_0x3c9503[_0xbcd0('0x43')],null))[_0xbcd0('0x22')](respondWithResult(_0x18d603,null))[_0xbcd0('0x3d')](handleError(_0x18d603,null));};exports[_0xbcd0('0x45')]=function(_0x56eaa2,_0x1af9a8){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x56eaa2[_0xbcd0('0x44')]['id']}})[_0xbcd0('0x22')](handleEntityNotFound(_0x1af9a8,null))[_0xbcd0('0x22')](removeEntity(_0x1af9a8,null))[_0xbcd0('0x3d')](handleError(_0x1af9a8,null));};exports['describe']=function(_0x376db1,_0x4fc5c4){return db[_0xbcd0('0x39')][_0xbcd0('0x46')]()['then'](respondWithResult(_0x4fc5c4,null))['catch'](handleError(_0x4fc5c4,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ab7165f..6e42990 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 _0xf81e=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3a3822,_0x1e4fd1){var _0x2f9aca=function(_0x33fad6){while(--_0x33fad6){_0x3a3822['push'](_0x3a3822['shift']());}};_0x2f9aca(++_0x1e4fd1);}(_0xf81e,0x1f3));var _0xef81=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf81e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xef81('0x0'));var util=require('util');var logger=require(_0xef81('0x1'))(_0xef81('0x2'));var moment=require(_0xef81('0x3'));var BPromise=require(_0xef81('0x4'));var rp=require(_0xef81('0x5'));var fs=require('fs');var path=require(_0xef81('0x6'));var rimraf=require('rimraf');var config=require(_0xef81('0x7'));var attributes=require(_0xef81('0x8'));module[_0xef81('0x9')]=function(_0x9524cc,_0x3cb0ae){return _0x9524cc[_0xef81('0xa')](_0xef81('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xef81('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d32=['util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x6d32,0xdc));var _0x26d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d32[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x26d3('0x0'));var util=require(_0x26d3('0x1'));var logger=require('../../config/logger')(_0x26d3('0x2'));var moment=require(_0x26d3('0x3'));var BPromise=require(_0x26d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26d3('0x5'));var rimraf=require(_0x26d3('0x6'));var config=require(_0x26d3('0x7'));var attributes=require(_0x26d3('0x8'));module['exports']=function(_0x53198a,_0x101aec){return _0x53198a[_0x26d3('0x9')](_0x26d3('0xa'),attributes,{'tableName':_0x26d3('0xb'),'paranoid':![],'indexes':[{'name':_0x26d3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 332b47b..8080c42 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 _0x0958=['moment','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util'];(function(_0x494093,_0x4f7e84){var _0x394add=function(_0x572565){while(--_0x572565){_0x494093['push'](_0x494093['shift']());}};_0x394add(++_0x4f7e84);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var moment=require(_0x8095('0x2'));var BPromise=require('bluebird');var rs=require(_0x8095('0x3'));var fs=require('fs');var Redis=require(_0x8095('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8095('0x5'))(_0x8095('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8095('0x7')][_0x8095('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x439ecc,_0x1dac39,_0x1fac84){return new BPromise(function(_0x4d5ee3,_0x5a19ef){return client[_0x8095('0x9')](_0x439ecc,_0x1fac84)[_0x8095('0xa')](function(_0x4967a5){logger['info'](_0x8095('0xb'),_0x1dac39,'request\x20sent');logger[_0x8095('0xc')](_0x8095('0xd'),_0x1dac39,_0x8095('0xe'),JSON[_0x8095('0xf')](_0x4967a5));if(_0x4967a5[_0x8095('0x10')]){if(_0x4967a5['error'][_0x8095('0x11')]===0x1f4){logger['error'](_0x8095('0xb'),_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x5a19ef(_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);}logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x4d5ee3(_0x4967a5[_0x8095('0x10')]['message']);}else{logger[_0x8095('0x13')](_0x8095('0xb'),_0x1dac39,_0x8095('0xe'));_0x4d5ee3(_0x4967a5[_0x8095('0x14')][_0x8095('0x12')]);}})['catch'](function(_0x1b1ca3){logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x1b1ca3);_0x5a19ef(_0x1b1ca3);});});} \ No newline at end of file +var _0x0734=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3f6f3c,_0xda03ca){var _0x3c5c4=function(_0x2d867c){while(--_0x2d867c){_0x3f6f3c['push'](_0x3f6f3c['shift']());}};_0x3c5c4(++_0xda03ca);}(_0x0734,0xba));var _0x4073=function(_0x2906c2,_0x2eb2d9){_0x2906c2=_0x2906c2-0x0;var _0x1bb1aa=_0x0734[_0x2906c2];return _0x1bb1aa;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var rs=require(_0x4073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4073('0x5'))['db'];var utils=require(_0x4073('0x6'));var logger=require(_0x4073('0x7'))(_0x4073('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4073('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3c14,_0x2195e0,_0x1251bd){return new BPromise(function(_0x22a33d,_0x51515d){return client[_0x4073('0xa')](_0x2c3c14,_0x1251bd)['then'](function(_0x5432c4){logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,_0x4073('0xd'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2195e0,_0x4073('0xd'),JSON[_0x4073('0xe')](_0x5432c4));if(_0x5432c4['error']){if(_0x5432c4[_0x4073('0xf')]['code']===0x1f4){logger[_0x4073('0xf')](_0x4073('0xc'),_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x51515d(_0x5432c4['error'][_0x4073('0x10')]);}logger[_0x4073('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x22a33d(_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);}else{logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,'request\x20sent');_0x22a33d(_0x5432c4[_0x4073('0x11')]['message']);}})[_0x4073('0x12')](function(_0x38ea09){logger['error'](_0x4073('0xc'),_0x2195e0,_0x38ea09);_0x51515d(_0x38ea09);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 63b4282..f352ec3 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 _0xd87f=['put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','index','get','/:id','show','isAuthenticated','create'];(function(_0x4d31d8,_0x27d635){var _0x339e06=function(_0x36a646){while(--_0x36a646){_0x4d31d8['push'](_0x4d31d8['shift']());}};_0x339e06(++_0x27d635);}(_0xd87f,0x1b9));var _0xfd87=function(_0x337317,_0x416433){_0x337317=_0x337317-0x0;var _0x1c5d49=_0xd87f[_0x337317];return _0x1c5d49;};'use strict';var multer=require(_0xfd87('0x0'));var util=require('util');var path=require(_0xfd87('0x1'));var timeout=require(_0xfd87('0x2'));var express=require('express');var router=express[_0xfd87('0x3')]();var fs_extra=require(_0xfd87('0x4'));var auth=require(_0xfd87('0x5'));var interaction=require(_0xfd87('0x6'));var config=require(_0xfd87('0x7'));var controller=require(_0xfd87('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd87('0x9')]);router[_0xfd87('0xa')](_0xfd87('0xb'),auth['isAuthenticated'](),controller[_0xfd87('0xc')]);router['post']('/',auth[_0xfd87('0xd')](),controller[_0xfd87('0xe')]);router[_0xfd87('0xf')](_0xfd87('0xb'),auth['isAuthenticated'](),controller[_0xfd87('0x10')]);router[_0xfd87('0x11')]('/:id',auth[_0xfd87('0xd')](),controller['destroy']);module[_0xfd87('0x12')]=router; \ No newline at end of file +var _0x4c72=['isAuthenticated','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','show','post'];(function(_0x5d0724,_0x582a4c){var _0x172ef7=function(_0x2fa7a8){while(--_0x2fa7a8){_0x5d0724['push'](_0x5d0724['shift']());}};_0x172ef7(++_0x582a4c);}(_0x4c72,0x179));var _0x24c7=function(_0x137fd9,_0x1d793a){_0x137fd9=_0x137fd9-0x0;var _0x30fa13=_0x4c72[_0x137fd9];return _0x30fa13;};'use strict';var multer=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var path=require(_0x24c7('0x2'));var timeout=require(_0x24c7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x24c7('0x4'));var auth=require(_0x24c7('0x5'));var interaction=require(_0x24c7('0x6'));var config=require(_0x24c7('0x7'));var controller=require(_0x24c7('0x8'));router[_0x24c7('0x9')]('/',auth['isAuthenticated'](),controller[_0x24c7('0xa')]);router['get'](_0x24c7('0xb'),auth['isAuthenticated'](),controller[_0x24c7('0xc')]);router[_0x24c7('0xd')]('/',auth[_0x24c7('0xe')](),controller['create']);router['put'](_0x24c7('0xb'),auth[_0x24c7('0xe')](),controller[_0x24c7('0xf')]);router['delete'](_0x24c7('0xb'),auth[_0x24c7('0xe')](),controller[_0x24c7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index e07fe10..f7447ee 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 _0xc474=['sequelize','STRING','name'];(function(_0x92a14b,_0x39c324){var _0x3e955e=function(_0x5d0369){while(--_0x5d0369){_0x92a14b['push'](_0x92a14b['shift']());}};_0x3e955e(++_0x39c324);}(_0xc474,0xd5));var _0x4c47=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xc474[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x4c47('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c47('0x1')],'unique':_0x4c47('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4c47('0x1')]}}; \ No newline at end of file +var _0x91ed=['STRING','name','sequelize'];(function(_0x197ffa,_0x5548f2){var _0x12b819=function(_0x3e7b60){while(--_0x3e7b60){_0x197ffa['push'](_0x197ffa['shift']());}};_0x12b819(++_0x5548f2);}(_0x91ed,0x1a6));var _0xd91e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x91ed[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xd91e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd91e('0x1')],'unique':_0xd91e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd91e('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1ecb7af..c037887 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 _0x433b=['name','index','Pause','rawAttributes','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','update','destroy','Pauses','UserProfileResource','then','error','stack'];(function(_0x4cd31f,_0x326b8c){var _0x1fe932=function(_0x15f51a){while(--_0x15f51a){_0x4cd31f['push'](_0x4cd31f['shift']());}};_0x1fe932(++_0x326b8c);}(_0x433b,0x16c));var _0xb433=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x433b[_0x1bf8cc];return _0x322d20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb433('0x0'));var zipdir=require(_0xb433('0x1'));var jsonpatch=require(_0xb433('0x2'));var rp=require(_0xb433('0x3'));var moment=require(_0xb433('0x4'));var BPromise=require(_0xb433('0x5'));var Mustache=require(_0xb433('0x6'));var util=require(_0xb433('0x7'));var path=require('path');var sox=require(_0xb433('0x8'));var csv=require(_0xb433('0x9'));var ejs=require(_0xb433('0xa'));var fs=require('fs');var fs_extra=require(_0xb433('0xb'));var _=require('lodash');var squel=require(_0xb433('0xc'));var crypto=require(_0xb433('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb433('0x9'));var querystring=require(_0xb433('0xe'));var Papa=require(_0xb433('0xf'));var Redis=require(_0xb433('0x10'));var authService=require(_0xb433('0x11'));var qs=require(_0xb433('0x12'));var as=require(_0xb433('0x13'));var hardwareService=require(_0xb433('0x14'));var logger=require('../../config/logger')(_0xb433('0x15'));var utils=require(_0xb433('0x16'));var config=require(_0xb433('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb433('0x18'))['db'];function respondWithStatusCode(_0x20651e,_0x2a3c8f){_0x2a3c8f=_0x2a3c8f||0xcc;return function(_0x23d43e){if(_0x23d43e){return _0x20651e[_0xb433('0x19')](_0x2a3c8f);}return _0x20651e['status'](_0x2a3c8f)[_0xb433('0x1a')]();};}function respondWithResult(_0x10b905,_0x7ab24a){_0x7ab24a=_0x7ab24a||0xc8;return function(_0x398b94){if(_0x398b94){return _0x10b905[_0xb433('0x1b')](_0x7ab24a)[_0xb433('0x1c')](_0x398b94);}};}function respondWithFilteredResult(_0x10966a,_0x109a26){return function(_0x504b87){if(_0x504b87){var _0x547be3=typeof _0x109a26[_0xb433('0x1d')]===_0xb433('0x1e')&&typeof _0x109a26[_0xb433('0x1f')]==='undefined';var _0xf78953=_0x504b87[_0xb433('0x20')];var _0x42fe11=_0x547be3?0x0:_0x109a26[_0xb433('0x1d')];var _0x47515a=_0x547be3?_0x504b87['count']:_0x109a26[_0xb433('0x1d')]+_0x109a26['limit'];var _0x5bb0e5;if(_0x47515a>=_0xf78953){_0x47515a=_0xf78953;_0x5bb0e5=0xc8;}else{_0x5bb0e5=0xce;}_0x10966a[_0xb433('0x1b')](_0x5bb0e5);return _0x10966a['set']('Content-Range',_0x42fe11+'-'+_0x47515a+'/'+_0xf78953)[_0xb433('0x1c')](_0x504b87);}return null;};}function patchUpdates(_0x2669ec){return function(_0x516c48){try{jsonpatch[_0xb433('0x21')](_0x516c48,_0x2669ec,!![]);}catch(_0x4285f6){return BPromise['reject'](_0x4285f6);}return _0x516c48['save']();};}function saveUpdates(_0x347171,_0x29b9cb){return function(_0x45cfe0){if(_0x45cfe0){return _0x45cfe0[_0xb433('0x22')](_0x347171)['then'](function(_0x24f9cb){return _0x24f9cb;});}return null;};}function removeEntity(_0x314fc6,_0x16d67a){return function(_0x418902){if(_0x418902){return _0x418902[_0xb433('0x23')]()['then'](function(){var _0x23d70c=_0x418902['get']({'plain':!![]});var _0xb80b86=_0xb433('0x24');return db[_0xb433('0x25')]['destroy']({'where':{'type':_0xb80b86,'resourceId':_0x23d70c['id']}})['then'](function(){return _0x418902;});})[_0xb433('0x26')](function(){_0x314fc6[_0xb433('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4365ee,_0x28fdda){return function(_0x5ddc07){if(!_0x5ddc07){_0x4365ee[_0xb433('0x19')](0x194);}return _0x5ddc07;};}function handleError(_0x506179,_0x12022f){_0x12022f=_0x12022f||0x1f4;return function(_0x4cb3a4){logger[_0xb433('0x27')](_0x4cb3a4[_0xb433('0x28')]);if(_0x4cb3a4[_0xb433('0x29')]){delete _0x4cb3a4[_0xb433('0x29')];}_0x506179[_0xb433('0x1b')](_0x12022f)['send'](_0x4cb3a4);};}exports[_0xb433('0x2a')]=function(_0x1417b5,_0x1fc7db){var _0x519153={},_0x377425={},_0x445ac1={'count':0x0,'rows':[]};var _0x1ed1ca=_['map'](db[_0xb433('0x2b')][_0xb433('0x2c')],function(_0xa0eed6){return{'name':_0xa0eed6['fieldName'],'type':_0xa0eed6[_0xb433('0x2d')][_0xb433('0x2e')]};});_0x377425['model']=_[_0xb433('0x2f')](_0x1ed1ca,_0xb433('0x29'));_0x377425[_0xb433('0x30')]=_[_0xb433('0x31')](_0x1417b5['query']);_0x377425['filters']=_[_0xb433('0x32')](_0x377425[_0xb433('0x33')],_0x377425[_0xb433('0x30')]);_0x519153['attributes']=_[_0xb433('0x32')](_0x377425[_0xb433('0x33')],qs[_0xb433('0x34')](_0x1417b5[_0xb433('0x30')][_0xb433('0x34')]));_0x519153[_0xb433('0x35')]=_0x519153[_0xb433('0x35')][_0xb433('0x36')]?_0x519153['attributes']:_0x377425[_0xb433('0x33')];if(!_0x1417b5['query'][_0xb433('0x37')](_0xb433('0x38'))){_0x519153['limit']=qs['limit'](_0x1417b5[_0xb433('0x30')][_0xb433('0x1f')]);_0x519153[_0xb433('0x1d')]=qs[_0xb433('0x1d')](_0x1417b5[_0xb433('0x30')][_0xb433('0x1d')]);}_0x519153[_0xb433('0x39')]=qs[_0xb433('0x3a')](_0x1417b5[_0xb433('0x30')][_0xb433('0x3a')]);_0x519153['where']=qs[_0xb433('0x3b')](_[_0xb433('0x3c')](_0x1417b5[_0xb433('0x30')],_0x377425[_0xb433('0x3b')]),_0x1ed1ca);if(_0x1417b5['query'][_0xb433('0x3d')]){_0x519153[_0xb433('0x3e')]=_['merge'](_0x519153['where'],{'$or':_[_0xb433('0x2f')](_0x1ed1ca,function(_0x2e00a3){if(_0x2e00a3[_0xb433('0x2d')]!==_0xb433('0x3f')){var _0x43f78d={};_0x43f78d[_0x2e00a3['name']]={'$like':'%'+_0x1417b5[_0xb433('0x30')]['filter']+'%'};return _0x43f78d;}})});}_0x519153=_[_0xb433('0x40')]({},_0x519153,_0x1417b5['options']);var _0x598799={'where':_0x519153[_0xb433('0x3e')]};return db[_0xb433('0x2b')][_0xb433('0x20')](_0x598799)[_0xb433('0x26')](function(_0x3ac827){_0x445ac1['count']=_0x3ac827;if(_0x1417b5['query'][_0xb433('0x41')]){_0x519153[_0xb433('0x42')]=[{'all':!![]}];}return db['Pause'][_0xb433('0x43')](_0x519153);})['then'](function(_0x4f3e42){_0x445ac1[_0xb433('0x44')]=_0x4f3e42;return _0x445ac1;})[_0xb433('0x26')](respondWithFilteredResult(_0x1fc7db,_0x519153))[_0xb433('0x45')](handleError(_0x1fc7db,null));};exports[_0xb433('0x46')]=function(_0x3e26b2,_0x36dc8c){var _0x336348={'raw':!![],'where':{'id':_0x3e26b2[_0xb433('0x47')]['id']}},_0x4f8758={};_0x4f8758['model']=_[_0xb433('0x31')](db[_0xb433('0x2b')][_0xb433('0x2c')]);_0x4f8758['query']=_[_0xb433('0x31')](_0x3e26b2[_0xb433('0x30')]);_0x4f8758['filters']=_[_0xb433('0x32')](_0x4f8758[_0xb433('0x33')],_0x4f8758['query']);_0x336348[_0xb433('0x35')]=_[_0xb433('0x32')](_0x4f8758[_0xb433('0x33')],qs[_0xb433('0x34')](_0x3e26b2[_0xb433('0x30')][_0xb433('0x34')]));_0x336348[_0xb433('0x35')]=_0x336348[_0xb433('0x35')][_0xb433('0x36')]?_0x336348[_0xb433('0x35')]:_0x4f8758[_0xb433('0x33')];if(_0x3e26b2[_0xb433('0x30')][_0xb433('0x41')]){_0x336348[_0xb433('0x42')]=[{'all':!![]}];}_0x336348=_[_0xb433('0x40')]({},_0x336348,_0x3e26b2[_0xb433('0x48')]);return db[_0xb433('0x2b')][_0xb433('0x49')](_0x336348)[_0xb433('0x26')](handleEntityNotFound(_0x36dc8c,null))[_0xb433('0x26')](respondWithResult(_0x36dc8c,null))[_0xb433('0x45')](handleError(_0x36dc8c,null));};exports[_0xb433('0x4a')]=function(_0xed61a6,_0x178846){return db[_0xb433('0x2b')]['create'](_0xed61a6[_0xb433('0x4b')],{})['then'](function(_0x589c08){var _0x5958f1=_0xed61a6['user'][_0xb433('0x4c')]({'plain':!![]});if(!_0x5958f1)throw new Error(_0xb433('0x4d'));if(_0x5958f1[_0xb433('0x4e')]==='user'){var _0x50214f=_0x589c08[_0xb433('0x4c')]({'plain':!![]});var _0x4a5a53='Pauses';return db[_0xb433('0x4f')][_0xb433('0x49')]({'where':{'name':_0x4a5a53,'userProfileId':_0x5958f1[_0xb433('0x50')]},'raw':!![]})[_0xb433('0x26')](function(_0x3440aa){if(_0x3440aa&&_0x3440aa['autoAssociation']===0x0){return db[_0xb433('0x25')][_0xb433('0x4a')]({'name':_0x50214f[_0xb433('0x29')],'resourceId':_0x50214f['id'],'type':_0x3440aa[_0xb433('0x29')],'sectionId':_0x3440aa['id']},{})[_0xb433('0x26')](function(){return _0x589c08;});}else{return _0x589c08;}})[_0xb433('0x45')](function(_0x7896f){logger[_0xb433('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7896f);throw _0x7896f;});}return _0x589c08;})[_0xb433('0x26')](respondWithResult(_0x178846,0xc9))[_0xb433('0x45')](handleError(_0x178846,null));};exports['update']=function(_0xa6b585,_0x5385f9){if(_0xa6b585['body']['id']){delete _0xa6b585[_0xb433('0x4b')]['id'];}return db[_0xb433('0x2b')][_0xb433('0x49')]({'where':{'id':_0xa6b585[_0xb433('0x47')]['id']}})['then'](handleEntityNotFound(_0x5385f9,null))[_0xb433('0x26')](saveUpdates(_0xa6b585[_0xb433('0x4b')],null))[_0xb433('0x26')](respondWithResult(_0x5385f9,null))[_0xb433('0x45')](handleError(_0x5385f9,null));};exports[_0xb433('0x23')]=function(_0x4c9445,_0x2b3926){return db['Pause'][_0xb433('0x49')]({'where':{'id':_0x4c9445[_0xb433('0x47')]['id']}})[_0xb433('0x26')](handleEntityNotFound(_0x2b3926,null))[_0xb433('0x26')](removeEntity(_0x2b3926,null))[_0xb433('0x45')](handleError(_0x2b3926,null));}; \ No newline at end of file +var _0x2be6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','get','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','UserProfileResource','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2be6,0x93));var _0x62be=function(_0x326675,_0x13448f){_0x326675=_0x326675-0x0;var _0x1d1248=_0x2be6[_0x326675];return _0x1d1248;};'use strict';var emlformat=require(_0x62be('0x0'));var rimraf=require(_0x62be('0x1'));var zipdir=require(_0x62be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62be('0x3'));var BPromise=require(_0x62be('0x4'));var Mustache=require(_0x62be('0x5'));var util=require(_0x62be('0x6'));var path=require(_0x62be('0x7'));var sox=require(_0x62be('0x8'));var csv=require(_0x62be('0x9'));var ejs=require(_0x62be('0xa'));var fs=require('fs');var fs_extra=require(_0x62be('0xb'));var _=require('lodash');var squel=require(_0x62be('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x62be('0xd'));var toCsv=require(_0x62be('0x9'));var querystring=require(_0x62be('0xe'));var Papa=require(_0x62be('0xf'));var Redis=require(_0x62be('0x10'));var authService=require(_0x62be('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x62be('0x12'));var hardwareService=require(_0x62be('0x13'));var logger=require(_0x62be('0x14'))(_0x62be('0x15'));var utils=require(_0x62be('0x16'));var config=require(_0x62be('0x17'));var licenseUtil=require(_0x62be('0x18'));var db=require(_0x62be('0x19'))['db'];function respondWithStatusCode(_0x17b015,_0x9468d0){_0x9468d0=_0x9468d0||0xcc;return function(_0x314fb3){if(_0x314fb3){return _0x17b015[_0x62be('0x1a')](_0x9468d0);}return _0x17b015[_0x62be('0x1b')](_0x9468d0)[_0x62be('0x1c')]();};}function respondWithResult(_0x8942b8,_0x363197){_0x363197=_0x363197||0xc8;return function(_0x38d6ee){if(_0x38d6ee){return _0x8942b8[_0x62be('0x1b')](_0x363197)['json'](_0x38d6ee);}};}function respondWithFilteredResult(_0x23adc0,_0x273f89){return function(_0x253aef){if(_0x253aef){var _0x3e2cd5=typeof _0x273f89['offset']===_0x62be('0x1d')&&typeof _0x273f89[_0x62be('0x1e')]===_0x62be('0x1d');var _0x12d943=_0x253aef[_0x62be('0x1f')];var _0xe44a58=_0x3e2cd5?0x0:_0x273f89[_0x62be('0x20')];var _0x1da723=_0x3e2cd5?_0x253aef[_0x62be('0x1f')]:_0x273f89[_0x62be('0x20')]+_0x273f89[_0x62be('0x1e')];var _0x236b6c;if(_0x1da723>=_0x12d943){_0x1da723=_0x12d943;_0x236b6c=0xc8;}else{_0x236b6c=0xce;}_0x23adc0['status'](_0x236b6c);return _0x23adc0[_0x62be('0x21')](_0x62be('0x22'),_0xe44a58+'-'+_0x1da723+'/'+_0x12d943)[_0x62be('0x23')](_0x253aef);}return null;};}function patchUpdates(_0x17faee){return function(_0x4b0054){try{jsonpatch[_0x62be('0x24')](_0x4b0054,_0x17faee,!![]);}catch(_0xecf4d8){return BPromise['reject'](_0xecf4d8);}return _0x4b0054['save']();};}function saveUpdates(_0xe0f627,_0x36645b){return function(_0x482864){if(_0x482864){return _0x482864[_0x62be('0x25')](_0xe0f627)[_0x62be('0x26')](function(_0x132ef9){return _0x132ef9;});}return null;};}function removeEntity(_0x20288a,_0x384dfa){return function(_0x111175){if(_0x111175){return _0x111175[_0x62be('0x27')]()[_0x62be('0x26')](function(){var _0x2e5bfd=_0x111175[_0x62be('0x28')]({'plain':!![]});var _0x43edd1='Pauses';return db['UserProfileResource'][_0x62be('0x27')]({'where':{'type':_0x43edd1,'resourceId':_0x2e5bfd['id']}})['then'](function(){return _0x111175;});})[_0x62be('0x26')](function(){_0x20288a[_0x62be('0x1b')](0xcc)[_0x62be('0x1c')]();});}};}function handleEntityNotFound(_0x314246,_0x5c0c23){return function(_0x2c5de7){if(!_0x2c5de7){_0x314246[_0x62be('0x1a')](0x194);}return _0x2c5de7;};}function handleError(_0x5523ff,_0x19a5e6){_0x19a5e6=_0x19a5e6||0x1f4;return function(_0x4226d7){logger[_0x62be('0x29')](_0x4226d7[_0x62be('0x2a')]);if(_0x4226d7[_0x62be('0x2b')]){delete _0x4226d7['name'];}_0x5523ff[_0x62be('0x1b')](_0x19a5e6)[_0x62be('0x2c')](_0x4226d7);};}exports[_0x62be('0x2d')]=function(_0x351a5e,_0x40184e){var _0x90b747={},_0x5523c0={},_0xe7c9e7={'count':0x0,'rows':[]};var _0x3e93cf=_[_0x62be('0x2e')](db[_0x62be('0x2f')][_0x62be('0x30')],function(_0x5947b5){return{'name':_0x5947b5[_0x62be('0x31')],'type':_0x5947b5[_0x62be('0x32')][_0x62be('0x33')]};});_0x5523c0[_0x62be('0x34')]=_['map'](_0x3e93cf,'name');_0x5523c0[_0x62be('0x35')]=_[_0x62be('0x36')](_0x351a5e[_0x62be('0x35')]);_0x5523c0[_0x62be('0x37')]=_[_0x62be('0x38')](_0x5523c0[_0x62be('0x34')],_0x5523c0[_0x62be('0x35')]);_0x90b747[_0x62be('0x39')]=_[_0x62be('0x38')](_0x5523c0['model'],qs[_0x62be('0x3a')](_0x351a5e['query'][_0x62be('0x3a')]));_0x90b747[_0x62be('0x39')]=_0x90b747['attributes'][_0x62be('0x3b')]?_0x90b747[_0x62be('0x39')]:_0x5523c0[_0x62be('0x34')];if(!_0x351a5e['query'][_0x62be('0x3c')](_0x62be('0x3d'))){_0x90b747[_0x62be('0x1e')]=qs[_0x62be('0x1e')](_0x351a5e[_0x62be('0x35')][_0x62be('0x1e')]);_0x90b747['offset']=qs[_0x62be('0x20')](_0x351a5e[_0x62be('0x35')]['offset']);}_0x90b747[_0x62be('0x3e')]=qs[_0x62be('0x3f')](_0x351a5e[_0x62be('0x35')][_0x62be('0x3f')]);_0x90b747[_0x62be('0x40')]=qs['filters'](_[_0x62be('0x41')](_0x351a5e[_0x62be('0x35')],_0x5523c0[_0x62be('0x37')]),_0x3e93cf);if(_0x351a5e['query'][_0x62be('0x42')]){_0x90b747[_0x62be('0x40')]=_[_0x62be('0x43')](_0x90b747[_0x62be('0x40')],{'$or':_[_0x62be('0x2e')](_0x3e93cf,function(_0x4677ae){if(_0x4677ae[_0x62be('0x32')]!==_0x62be('0x44')){var _0x2a0e90={};_0x2a0e90[_0x4677ae[_0x62be('0x2b')]]={'$like':'%'+_0x351a5e[_0x62be('0x35')][_0x62be('0x42')]+'%'};return _0x2a0e90;}})});}_0x90b747=_['merge']({},_0x90b747,_0x351a5e[_0x62be('0x45')]);var _0x365d12={'where':_0x90b747[_0x62be('0x40')]};return db[_0x62be('0x2f')][_0x62be('0x1f')](_0x365d12)[_0x62be('0x26')](function(_0x41ac24){_0xe7c9e7[_0x62be('0x1f')]=_0x41ac24;if(_0x351a5e[_0x62be('0x35')][_0x62be('0x46')]){_0x90b747['include']=[{'all':!![]}];}return db[_0x62be('0x2f')][_0x62be('0x47')](_0x90b747);})[_0x62be('0x26')](function(_0x58ddbf){_0xe7c9e7['rows']=_0x58ddbf;return _0xe7c9e7;})[_0x62be('0x26')](respondWithFilteredResult(_0x40184e,_0x90b747))[_0x62be('0x48')](handleError(_0x40184e,null));};exports['show']=function(_0x5c6a9a,_0x418cfc){var _0x4032bd={'raw':!![],'where':{'id':_0x5c6a9a[_0x62be('0x49')]['id']}},_0xa0917e={};_0xa0917e[_0x62be('0x34')]=_[_0x62be('0x36')](db[_0x62be('0x2f')]['rawAttributes']);_0xa0917e[_0x62be('0x35')]=_[_0x62be('0x36')](_0x5c6a9a[_0x62be('0x35')]);_0xa0917e['filters']=_[_0x62be('0x38')](_0xa0917e[_0x62be('0x34')],_0xa0917e[_0x62be('0x35')]);_0x4032bd[_0x62be('0x39')]=_[_0x62be('0x38')](_0xa0917e[_0x62be('0x34')],qs['fields'](_0x5c6a9a[_0x62be('0x35')][_0x62be('0x3a')]));_0x4032bd['attributes']=_0x4032bd[_0x62be('0x39')][_0x62be('0x3b')]?_0x4032bd[_0x62be('0x39')]:_0xa0917e['model'];if(_0x5c6a9a[_0x62be('0x35')][_0x62be('0x46')]){_0x4032bd[_0x62be('0x4a')]=[{'all':!![]}];}_0x4032bd=_['merge']({},_0x4032bd,_0x5c6a9a[_0x62be('0x45')]);return db[_0x62be('0x2f')][_0x62be('0x4b')](_0x4032bd)['then'](handleEntityNotFound(_0x418cfc,null))[_0x62be('0x26')](respondWithResult(_0x418cfc,null))[_0x62be('0x48')](handleError(_0x418cfc,null));};exports[_0x62be('0x4c')]=function(_0x327730,_0x262cdf){return db['Pause'][_0x62be('0x4c')](_0x327730[_0x62be('0x4d')],{})[_0x62be('0x26')](function(_0x5370d0){var _0x131e87=_0x327730[_0x62be('0x4e')][_0x62be('0x28')]({'plain':!![]});if(!_0x131e87)throw new Error(_0x62be('0x4f'));if(_0x131e87['role']===_0x62be('0x4e')){var _0x2bb22e=_0x5370d0[_0x62be('0x28')]({'plain':!![]});var _0x48810a=_0x62be('0x50');return db[_0x62be('0x51')][_0x62be('0x4b')]({'where':{'name':_0x48810a,'userProfileId':_0x131e87['userProfileId']},'raw':!![]})['then'](function(_0x228f49){if(_0x228f49&&_0x228f49['autoAssociation']===0x0){return db[_0x62be('0x52')]['create']({'name':_0x2bb22e[_0x62be('0x2b')],'resourceId':_0x2bb22e['id'],'type':_0x228f49[_0x62be('0x2b')],'sectionId':_0x228f49['id']},{})[_0x62be('0x26')](function(){return _0x5370d0;});}else{return _0x5370d0;}})[_0x62be('0x48')](function(_0x556539){logger[_0x62be('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x556539);throw _0x556539;});}return _0x5370d0;})[_0x62be('0x26')](respondWithResult(_0x262cdf,0xc9))[_0x62be('0x48')](handleError(_0x262cdf,null));};exports[_0x62be('0x25')]=function(_0x582d9a,_0x43ac2e){if(_0x582d9a['body']['id']){delete _0x582d9a[_0x62be('0x4d')]['id'];}return db['Pause']['find']({'where':{'id':_0x582d9a[_0x62be('0x49')]['id']}})['then'](handleEntityNotFound(_0x43ac2e,null))[_0x62be('0x26')](saveUpdates(_0x582d9a[_0x62be('0x4d')],null))[_0x62be('0x26')](respondWithResult(_0x43ac2e,null))['catch'](handleError(_0x43ac2e,null));};exports[_0x62be('0x27')]=function(_0x5b74db,_0x1f7dae){return db[_0x62be('0x2f')][_0x62be('0x4b')]({'where':{'id':_0x5b74db[_0x62be('0x49')]['id']}})[_0x62be('0x26')](handleEntityNotFound(_0x1f7dae,null))[_0x62be('0x26')](removeEntity(_0x1f7dae,null))[_0x62be('0x48')](handleError(_0x1f7dae,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4b103ee..581383b 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x57b77f,_0xa15fd6){var _0x10c04a=function(_0x16fe61){while(--_0x16fe61){_0x57b77f['push'](_0x57b77f['shift']());}};_0x10c04a(++_0xa15fd6);}(_0x326f,0xd1));var _0xf326=function(_0x479b6a,_0x5ec09d){_0x479b6a=_0x479b6a-0x0;var _0x170c95=_0x326f[_0x479b6a];return _0x170c95;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x929116,_0x4966ed){var _0x256d27=function(_0x24a2eb){while(--_0x24a2eb){_0x929116['push'](_0x929116['shift']());}};_0x256d27(++_0x4966ed);}(_0xe14b,0x93));var _0xbe14=function(_0x2ce94c,_0x4c3509){_0x2ce94c=_0x2ce94c-0x0;var _0x18ad94=_0xe14b[_0x2ce94c];return _0x18ad94;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 98a2c73..f2aa8c3 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4f192e,_0x4d1756){var _0x49294d=function(_0x580ab3){while(--_0x580ab3){_0x4f192e['push'](_0x4f192e['shift']());}};_0x49294d(++_0x4d1756);}(_0x7a54,0x106));var _0x47a5=function(_0xc8bb19,_0x20ebd9){_0xc8bb19=_0xc8bb19-0x0;var _0x330c80=_0x7a54[_0xc8bb19];return _0x330c80;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x520845,_0x1a79e9){var _0x4bd2e1=function(_0x1aebe7){while(--_0x1aebe7){_0x520845['push'](_0x520845['shift']());}};_0x4bd2e1(++_0x1a79e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x25ccbe,_0xc935c0){_0x25ccbe=_0x25ccbe-0x0;var _0x289529=_0xb10b[_0x25ccbe];return _0x289529;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fbacb1a..97bef6b 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 _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x3d9a4a,_0x49cb5f){var _0x5c4b88=function(_0x3555e9){while(--_0x3555e9){_0x3d9a4a['push'](_0x3d9a4a['shift']());}};_0x5c4b88(++_0x49cb5f);}(_0xcb99,0x8b));var _0x9cb9=function(_0x57abf7,_0x11bb02){_0x57abf7=_0x57abf7-0x0;var _0x1c7779=_0xcb99[_0x57abf7];return _0x1c7779;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x3937=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x437d83,_0x300f7b){var _0x345fb3=function(_0x1cacfc){while(--_0x1cacfc){_0x437d83['push'](_0x437d83['shift']());}};_0x345fb3(++_0x300f7b);}(_0x3937,0xbf));var _0x7393=function(_0x5915a3,_0x3d2e12){_0x5915a3=_0x5915a3-0x0;var _0x46e89b=_0x3937[_0x5915a3];return _0x46e89b;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),controller[_0x7393('0xb')]);router[_0x7393('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0xc')]);router[_0x7393('0x7')](_0x7393('0xd'),auth['isAuthenticated'](),controller[_0x7393('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ed4c,_0x47c5c6,_0x497b6b){_0x497b6b(null,path[_0x7393('0xf')](config[_0x7393('0x10')],_0x7393('0x11')));},'filename':function(_0x4fb764,_0x79fc4e,_0x470f09){_0x79fc4e[_0x7393('0x12')]=_0x79fc4e[_0x7393('0x12')][_0x7393('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x470f09(null,util[_0x7393('0x14')](_0x7393('0x15'),path[_0x7393('0x16')](_0x79fc4e[_0x7393('0x12')],path['extname'](_0x79fc4e['originalname'])),Date[_0x7393('0x17')](),path['extname'](_0x79fc4e['originalname'])));}})});router['post']('/',upload[_0x7393('0x18')]('file'),controller[_0x7393('0x19')]);router[_0x7393('0x1a')]('/webhook',controller[_0x7393('0x1b')]);router['put']('/:id',auth[_0x7393('0x8')](),controller[_0x7393('0x1c')]);router[_0x7393('0x1d')](_0x7393('0x1e'),auth[_0x7393('0x8')](),controller[_0x7393('0x1d')]);module[_0x7393('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 28d2a88..cce5c0c 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 _0x9995=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x2ef84a,_0x3515c5){var _0x2e871e=function(_0x30f2f9){while(--_0x30f2f9){_0x2ef84a['push'](_0x2ef84a['shift']());}};_0x2e871e(++_0x3515c5);}(_0x9995,0x9d));var _0x5999=function(_0x4aa5e4,_0x56f9b9){_0x4aa5e4=_0x4aa5e4-0x0;var _0x333336=_0x9995[_0x4aa5e4];return _0x333336;};'use strict';var Sequelize=require(_0x5999('0x0'));module[_0x5999('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5999('0x2')]('html',_0x5999('0x3'))},'description':{'type':Sequelize[_0x5999('0x4')]},'version':{'type':Sequelize[_0x5999('0x4')]},'path':{'type':Sequelize[_0x5999('0x5')],'comment':_0x5999('0x6')},'active':{'type':Sequelize[_0x5999('0x7')],'defaultValue':0x0,'comment':_0x5999('0x8')},'sidebar':{'type':Sequelize[_0x5999('0x2')](_0x5999('0x9'),_0x5999('0xa'),_0x5999('0xb'),_0x5999('0xc')),'defaultValue':_0x5999('0xb'),'comment':_0x5999('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x5999('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x5999('0x5')]}}; \ No newline at end of file +var _0x5f79=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','never'];(function(_0x2ea8f2,_0x14aab7){var _0x398b05=function(_0x4b2d6f){while(--_0x4b2d6f){_0x2ea8f2['push'](_0x2ea8f2['shift']());}};_0x398b05(++_0x14aab7);}(_0x5f79,0x146));var _0x95f7=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x5f79[_0x516927];return _0x30749b;};'use strict';var Sequelize=require(_0x95f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x95f7('0x1')]},'type':{'type':Sequelize[_0x95f7('0x2')](_0x95f7('0x3'),_0x95f7('0x4'))},'description':{'type':Sequelize[_0x95f7('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x95f7('0x6')},'active':{'type':Sequelize[_0x95f7('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x95f7('0x2')](_0x95f7('0x8'),'agentOnly','always',_0x95f7('0x9')),'defaultValue':_0x95f7('0xa'),'comment':_0x95f7('0xb')},'icon':{'type':Sequelize[_0x95f7('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x95f7('0x1')]},'scriptPath':{'type':Sequelize[_0x95f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 615117a..e56cfed 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 _0xb518=['format','basename','createWriteStream','zip','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','server/files/plugins','Plugin\x20upload\x20destination:\x20%s','0777','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','get','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','rawAttributes','include','find','download','params','join','root'];(function(_0x4f8250,_0x2519f3){var _0x4b2e3e=function(_0x18d297){while(--_0x18d297){_0x4f8250['push'](_0x4f8250['shift']());}};_0x4b2e3e(++_0x2519f3);}(_0xb518,0x1b4));var _0x8b51=function(_0x46fe02,_0x5f0e57){_0x46fe02=_0x46fe02-0x0;var _0x312a81=_0xb518[_0x46fe02];return _0x312a81;};'use strict';var emlformat=require(_0x8b51('0x0'));var rimraf=require(_0x8b51('0x1'));var zipdir=require(_0x8b51('0x2'));var jsonpatch=require(_0x8b51('0x3'));var rp=require(_0x8b51('0x4'));var moment=require(_0x8b51('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b51('0x6'));var util=require('util');var path=require(_0x8b51('0x7'));var sox=require(_0x8b51('0x8'));var csv=require(_0x8b51('0x9'));var ejs=require(_0x8b51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b51('0xb'));var squel=require(_0x8b51('0xc'));var crypto=require(_0x8b51('0xd'));var jsforce=require(_0x8b51('0xe'));var deskjs=require(_0x8b51('0xf'));var toCsv=require(_0x8b51('0x9'));var querystring=require(_0x8b51('0x10'));var Papa=require('papaparse');var extract=require(_0x8b51('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x8b51('0x12'));var authService=require(_0x8b51('0x13'));var qs=require(_0x8b51('0x14'));var as=require(_0x8b51('0x15'));var hardwareService=require(_0x8b51('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x8b51('0x17'));var config=require(_0x8b51('0x18'));var licenseUtil=require(_0x8b51('0x19'));var db=require(_0x8b51('0x1a'))['db'];config[_0x8b51('0x1b')]=_['defaults'](config[_0x8b51('0x1b')],{'host':_0x8b51('0x1c'),'port':0x18eb});var socket=require(_0x8b51('0x1d'))(new Redis(config[_0x8b51('0x1b')]));require(_0x8b51('0x1e'))['register'](socket);function respondWithStatusCode(_0x4f83c4,_0x4388d6){_0x4388d6=_0x4388d6||0xcc;return function(_0x5c3c17){if(_0x5c3c17){return _0x4f83c4[_0x8b51('0x1f')](_0x4388d6);}return _0x4f83c4[_0x8b51('0x20')](_0x4388d6)[_0x8b51('0x21')]();};}function respondWithResult(_0x40bee8,_0x486b71){_0x486b71=_0x486b71||0xc8;return function(_0x1ddb16){if(_0x1ddb16){return _0x40bee8['status'](_0x486b71)[_0x8b51('0x22')](_0x1ddb16);}};}function respondWithFilteredResult(_0x4d231e,_0xa593ad){return function(_0x138cbc){if(_0x138cbc){var _0x51efe6=typeof _0xa593ad[_0x8b51('0x23')]===_0x8b51('0x24')&&typeof _0xa593ad['limit']==='undefined';var _0x5f3b51=_0x138cbc[_0x8b51('0x25')];var _0x4c81cb=_0x51efe6?0x0:_0xa593ad[_0x8b51('0x23')];var _0x2b5aed=_0x51efe6?_0x138cbc[_0x8b51('0x25')]:_0xa593ad['offset']+_0xa593ad[_0x8b51('0x26')];var _0x417dd8;if(_0x2b5aed>=_0x5f3b51){_0x2b5aed=_0x5f3b51;_0x417dd8=0xc8;}else{_0x417dd8=0xce;}_0x4d231e[_0x8b51('0x20')](_0x417dd8);return _0x4d231e[_0x8b51('0x27')]('Content-Range',_0x4c81cb+'-'+_0x2b5aed+'/'+_0x5f3b51)[_0x8b51('0x22')](_0x138cbc);}return null;};}function patchUpdates(_0x316019){return function(_0x55b891){try{jsonpatch['apply'](_0x55b891,_0x316019,!![]);}catch(_0x572819){return BPromise[_0x8b51('0x28')](_0x572819);}return _0x55b891[_0x8b51('0x29')]();};}function saveUpdates(_0x4c0f6f,_0x2003ff){return function(_0x15c270){if(_0x15c270){return _0x15c270[_0x8b51('0x2a')](_0x4c0f6f)['then'](function(_0x4e6a70){return _0x4e6a70;});}return null;};}function removeEntity(_0xfbf009,_0x1fea0a){return function(_0x3d79d7){if(_0x3d79d7){return _0x3d79d7[_0x8b51('0x2b')]()[_0x8b51('0x2c')](function(){var _0x445e64=_0x3d79d7[_0x8b51('0x2d')]({'plain':!![]});var _0x27fba1=_0x8b51('0x2e');return db[_0x8b51('0x2f')]['destroy']({'where':{'type':_0x27fba1,'resourceId':_0x445e64['id']}})[_0x8b51('0x2c')](function(){return _0x3d79d7;});})[_0x8b51('0x2c')](function(){_0xfbf009['status'](0xcc)[_0x8b51('0x21')]();});}};}function handleEntityNotFound(_0x2ae4fe,_0x3905c2){return function(_0x5ede53){if(!_0x5ede53){_0x2ae4fe[_0x8b51('0x1f')](0x194);}return _0x5ede53;};}function handleError(_0xb7ffdf,_0xc7318){_0xc7318=_0xc7318||0x1f4;return function(_0x254e69){logger['error'](_0x254e69[_0x8b51('0x30')]);if(_0x254e69[_0x8b51('0x31')]){delete _0x254e69[_0x8b51('0x31')];}_0xb7ffdf[_0x8b51('0x20')](_0xc7318)[_0x8b51('0x32')](_0x254e69);};}exports[_0x8b51('0x33')]=function(_0x412a51,_0x481971){var _0xfcf85d={},_0x4392ec={},_0x1e6c8d={'count':0x0,'rows':[]};var _0x3a4bd3=_[_0x8b51('0x34')](db[_0x8b51('0x35')]['rawAttributes'],function(_0x479ef2){return{'name':_0x479ef2[_0x8b51('0x36')],'type':_0x479ef2[_0x8b51('0x37')][_0x8b51('0x38')]};});_0x4392ec[_0x8b51('0x39')]=_['map'](_0x3a4bd3,_0x8b51('0x31'));_0x4392ec[_0x8b51('0x3a')]=_['keys'](_0x412a51['query']);_0x4392ec[_0x8b51('0x3b')]=_[_0x8b51('0x3c')](_0x4392ec[_0x8b51('0x39')],_0x4392ec[_0x8b51('0x3a')]);_0xfcf85d[_0x8b51('0x3d')]=_[_0x8b51('0x3c')](_0x4392ec[_0x8b51('0x39')],qs[_0x8b51('0x3e')](_0x412a51[_0x8b51('0x3a')][_0x8b51('0x3e')]));_0xfcf85d[_0x8b51('0x3d')]=_0xfcf85d[_0x8b51('0x3d')][_0x8b51('0x3f')]?_0xfcf85d['attributes']:_0x4392ec[_0x8b51('0x39')];if(!_0x412a51[_0x8b51('0x3a')]['hasOwnProperty'](_0x8b51('0x40'))){_0xfcf85d['limit']=qs[_0x8b51('0x26')](_0x412a51[_0x8b51('0x3a')]['limit']);_0xfcf85d['offset']=qs[_0x8b51('0x23')](_0x412a51['query'][_0x8b51('0x23')]);}_0xfcf85d['order']=qs['sort'](_0x412a51[_0x8b51('0x3a')]['sort']);_0xfcf85d[_0x8b51('0x41')]=qs[_0x8b51('0x3b')](_[_0x8b51('0x42')](_0x412a51['query'],_0x4392ec[_0x8b51('0x3b')]),_0x3a4bd3);if(_0x412a51['query'][_0x8b51('0x43')]){_0xfcf85d[_0x8b51('0x41')]=_[_0x8b51('0x44')](_0xfcf85d['where'],{'$or':_[_0x8b51('0x34')](_0x3a4bd3,function(_0x569a7b){if(_0x569a7b[_0x8b51('0x37')]!==_0x8b51('0x45')){var _0x372d6c={};_0x372d6c[_0x569a7b[_0x8b51('0x31')]]={'$like':'%'+_0x412a51[_0x8b51('0x3a')][_0x8b51('0x43')]+'%'};return _0x372d6c;}})});}_0xfcf85d=_[_0x8b51('0x44')]({},_0xfcf85d,_0x412a51[_0x8b51('0x46')]);var _0x5ed790={'where':_0xfcf85d[_0x8b51('0x41')]};return db['Plugin'][_0x8b51('0x25')](_0x5ed790)['then'](function(_0x1e3a68){_0x1e6c8d[_0x8b51('0x25')]=_0x1e3a68;if(_0x412a51['query'][_0x8b51('0x47')]){_0xfcf85d['include']=[{'all':!![]}];}return db[_0x8b51('0x35')][_0x8b51('0x48')](_0xfcf85d);})[_0x8b51('0x2c')](function(_0x10f936){_0x1e6c8d['rows']=_0x10f936;return _0x1e6c8d;})[_0x8b51('0x2c')](respondWithFilteredResult(_0x481971,_0xfcf85d))[_0x8b51('0x49')](handleError(_0x481971,null));};exports[_0x8b51('0x4a')]=function(_0x1aafb6,_0x1b1299){var _0x9831ca={'raw':!![],'where':{'id':_0x1aafb6['params']['id']}},_0x6d6a1e={};_0x6d6a1e[_0x8b51('0x39')]=_[_0x8b51('0x4b')](db[_0x8b51('0x35')][_0x8b51('0x4c')]);_0x6d6a1e['query']=_[_0x8b51('0x4b')](_0x1aafb6['query']);_0x6d6a1e[_0x8b51('0x3b')]=_[_0x8b51('0x3c')](_0x6d6a1e[_0x8b51('0x39')],_0x6d6a1e[_0x8b51('0x3a')]);_0x9831ca['attributes']=_['intersection'](_0x6d6a1e[_0x8b51('0x39')],qs[_0x8b51('0x3e')](_0x1aafb6[_0x8b51('0x3a')]['fields']));_0x9831ca[_0x8b51('0x3d')]=_0x9831ca['attributes'][_0x8b51('0x3f')]?_0x9831ca[_0x8b51('0x3d')]:_0x6d6a1e[_0x8b51('0x39')];if(_0x1aafb6['query']['includeAll']){_0x9831ca[_0x8b51('0x4d')]=[{'all':!![]}];}_0x9831ca=_[_0x8b51('0x44')]({},_0x9831ca,_0x1aafb6[_0x8b51('0x46')]);return db[_0x8b51('0x35')][_0x8b51('0x4e')](_0x9831ca)[_0x8b51('0x2c')](handleEntityNotFound(_0x1b1299,null))[_0x8b51('0x2c')](respondWithResult(_0x1b1299,null))[_0x8b51('0x49')](handleError(_0x1b1299,null));};exports[_0x8b51('0x4f')]=function(_0x2d8016,_0x2d4569,_0x23b0b4){return db[_0x8b51('0x35')][_0x8b51('0x4e')]({'where':{'id':_0x2d8016[_0x8b51('0x50')]['id']},'attributes':[_0x8b51('0x31'),_0x8b51('0x7')],'raw':!![]})[_0x8b51('0x2c')](handleEntityNotFound(_0x2d4569,null))[_0x8b51('0x2c')](function(_0x8b5809){if(_0x8b5809){var _0x2fb55e=path[_0x8b51('0x51')](config[_0x8b51('0x52')],'server/files/plugins',util[_0x8b51('0x53')]('%s.zip',path[_0x8b51('0x54')](_0x8b5809[_0x8b51('0x7')])));var _0x5aaad3=fs[_0x8b51('0x55')](_0x2fb55e);var _0x2f1c6c=archiver(_0x8b51('0x56'),{'zlib':{'level':0x9}});_0x2f1c6c['on'](_0x8b51('0x57'),function(_0x1e250d){if(_0x1e250d[_0x8b51('0x58')]===_0x8b51('0x59')){logger[_0x8b51('0x5a')](_0x1e250d);}else{throw new db['Sequelize'][(_0x8b51('0x5b'))](_0x8b51('0x5c'));}});_0x2f1c6c['on'](_0x8b51('0x5a'),function(_0x4ecca3){throw new db[(_0x8b51('0x5d'))][(_0x8b51('0x5b'))](_0x8b51('0x5c'));});_0x2f1c6c[_0x8b51('0x5e')](_0x5aaad3);_0x2f1c6c[_0x8b51('0x5f')](_0x8b51('0x60'),{'cwd':path[_0x8b51('0x51')](config[_0x8b51('0x52')],'server/files/plugins',path[_0x8b51('0x61')](_0x8b5809[_0x8b51('0x7')])),'ignore':[path['join'](path[_0x8b51('0x54')](_0x8b5809['path']),'node_modules/**/*'),path[_0x8b51('0x51')](path['basename'](_0x8b5809['path']),_0x8b51('0x62'))],'nodir':!![]})[_0x8b51('0x63')]();_0x5aaad3['on'](_0x8b51('0x64'),function(){if(!fs['existsSync'](_0x2fb55e)){throw new db['Sequelize'][(_0x8b51('0x5b'))](_0x8b51('0x65'));}return _0x2d4569['download'](_0x2fb55e,util[_0x8b51('0x53')](_0x8b51('0x66'),path[_0x8b51('0x54')](_0x8b5809['path'])),function(_0x1419d4){if(_0x1419d4){throw new db[(_0x8b51('0x5d'))][(_0x8b51('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2fb55e);logger[_0x8b51('0x67')](_0x8b51('0x68'));logger['info'](_0x8b51('0x69'));});});}return null;})[_0x8b51('0x49')](handleError(_0x2d4569,null));};exports['upload']=function(_0x4aeaaa,_0x12a488,_0x203df3){var _0x57b299=path['basename'](_0x4aeaaa[_0x8b51('0x6a')][_0x8b51('0x6b')],path[_0x8b51('0x6c')](_0x4aeaaa[_0x8b51('0x6a')]['filename']));var _0x5e117b=path[_0x8b51('0x51')](config[_0x8b51('0x52')],_0x8b51('0x6d'),_0x4aeaaa['file'][_0x8b51('0x6b')]);var _0x3f75e0=path[_0x8b51('0x51')](config[_0x8b51('0x52')],_0x8b51('0x6d'),_0x57b299);logger[_0x8b51('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x5e117b);logger[_0x8b51('0x67')](_0x8b51('0x6e'),_0x3f75e0);try{fs['chmodSync'](_0x5e117b,parseInt(_0x8b51('0x6f'),0x8));extract(_0x5e117b,{'dir':_0x3f75e0},function(_0x2e3ed9){if(_0x2e3ed9){logger[_0x8b51('0x5a')](_0x2e3ed9);handleError(_0x2e3ed9,!![]);};var _0x217a36=fs['readdirSync'](_0x3f75e0);if(_0x217a36[_0x8b51('0x3f')]>0x1){removeReferences(_0x5e117b,_0x3f75e0);logger[_0x8b51('0x5a')]('Invalid\x20plugin\x20structure');return _0x203df3(new Error('Invalid\x20plugin\x20structure'));}var _0x23d57a=fs[_0x8b51('0x70')](path[_0x8b51('0x51')](_0x3f75e0,_0x217a36[0x0]));if(_0x23d57a[_0x8b51('0x71')]()){removeReferences(_0x5e117b,_0x3f75e0);logger[_0x8b51('0x5a')](_0x8b51('0x72'));return _0x203df3(new Error(_0x8b51('0x72')));}if(_0x23d57a[_0x8b51('0x73')]()){var _0x2d2591=fs['readdirSync'](path['join'](_0x3f75e0,_0x217a36[0x0]));if(_0x2d2591[_0x8b51('0x3f')]===0x0){removeReferences(_0x5e117b,_0x3f75e0);logger[_0x8b51('0x5a')](_0x8b51('0x72'));return _0x203df3(new Error('Invalid\x20plugin\x20structure'));}var _0x4dd710=_0x2d2591[_0x8b51('0x74')](function(_0x5cee8e){return _0x5cee8e===_0x8b51('0x75');});if(!_0x4dd710){return _0x203df3(new Error(_0x8b51('0x76')));}var _0x343fb5=fs[_0x8b51('0x77')](path[_0x8b51('0x51')](_0x3f75e0,_0x217a36[0x0],_0x8b51('0x75')));var _0x122ff7=JSON['parse'](_0x343fb5);if(_0x8b51('0x24')==typeof _0x122ff7['name']){return _0x203df3(new Error(_0x8b51('0x78')));}if(_0x8b51('0x24')==typeof _0x122ff7[_0x8b51('0x37')]){return _0x203df3(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8b51('0x24')==typeof _0x122ff7['version']){return _0x203df3(new Error(_0x8b51('0x79')));}if(_0x8b51('0x24')==typeof _0x122ff7[_0x8b51('0x7a')]){return _0x203df3(new Error(_0x8b51('0x7b')));}if(_0x122ff7['type']===_0x8b51('0x7c')){if('undefined'==typeof _0x122ff7['parameters'][_0x8b51('0x7d')]){return _0x203df3(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x8b51('0x24')==typeof _0x122ff7['parameters'][_0x8b51('0x7d')][_0x8b51('0x7e')]&&_0x8b51('0x24')==typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x7d')]['agent']){return _0x203df3(new Error(_0x8b51('0x7f')));}}else if(_0x122ff7[_0x8b51('0x37')]===_0x8b51('0x80')){if(_0x8b51('0x24')==typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x81')]){return _0x203df3(new Error(_0x8b51('0x82')));}if(_0x8b51('0x24')==typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x83')]){return _0x203df3(new Error(_0x8b51('0x84')));}}else{return _0x203df3(new Error(_0x8b51('0x85')));}var _0xae9d9c=_0x122ff7[_0x8b51('0x31')];var _0x233330=_0x122ff7[_0x8b51('0x86')];var _0x1942bf=_0x122ff7[_0x8b51('0x37')];var _0x495c7f=_0x122ff7[_0x8b51('0x87')]?_0x122ff7[_0x8b51('0x87')]:_0x8b51('0x88');var _0x146098=_0x122ff7[_0x8b51('0x89')]?_0x122ff7[_0x8b51('0x89')]:_0x8b51('0x8a');var _0x410abe='';var _0x1c87a8='';var _0x492ff7='';var _0x44bea1='';var _0x2a4210=_0x122ff7[_0x8b51('0x8b')];if(_0x1942bf===_0x8b51('0x7c')){if('undefined'!=typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x7d')][_0x8b51('0x7e')]){var _0x3aab6a=_0x122ff7[_0x8b51('0x7a')]['views'][_0x8b51('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x8b51('0x8c')](_0x3aab6a)){_0x410abe=path[_0x8b51('0x51')](_0x8b51('0x8d'),_0x57b299,_0x217a36[0x0],_0x3aab6a);}else{_0x410abe=_0x3aab6a;}}else{logger[_0x8b51('0x67')](_0x8b51('0x8e'));}if(_0x8b51('0x24')!=typeof _0x122ff7[_0x8b51('0x7a')]['views'][_0x8b51('0x8f')]){var _0x4764ea=_0x122ff7['parameters']['views'][_0x8b51('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x8b51('0x8c')](_0x4764ea)){_0x1c87a8=path[_0x8b51('0x51')]('plugins',_0x57b299,_0x217a36[0x0],_0x4764ea);}else{_0x1c87a8=_0x4764ea;}}else{logger[_0x8b51('0x67')](_0x8b51('0x90'));}}else if(_0x1942bf===_0x8b51('0x80')){_0x492ff7=_0x122ff7['parameters'][_0x8b51('0x81')];_0x44bea1=_0x122ff7['parameters'][_0x8b51('0x83')];if(_0x8b51('0x24')!=typeof _0x122ff7['parameters'][_0x8b51('0x7d')]){if(_0x8b51('0x24')!=typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x7d')][_0x8b51('0x7e')]){var _0x3aab6a=_0x122ff7['parameters'][_0x8b51('0x7d')][_0x8b51('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x8b51('0x8c')](_0x3aab6a)){_0x410abe=path[_0x8b51('0x51')](_0x8b51('0x8d'),_0x57b299,_0x217a36[0x0],_0x3aab6a);}else{_0x410abe=_0x3aab6a;}}if(_0x8b51('0x24')!=typeof _0x122ff7[_0x8b51('0x7a')][_0x8b51('0x7d')][_0x8b51('0x8f')]){var _0x4764ea=_0x122ff7[_0x8b51('0x7a')][_0x8b51('0x7d')][_0x8b51('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x8b51('0x8c')](_0x4764ea)){_0x1c87a8=path[_0x8b51('0x51')](_0x8b51('0x8d'),_0x57b299,_0x217a36[0x0],_0x4764ea);}else{_0x1c87a8=_0x4764ea;}}}}var _0x4ffbd={'name':_0xae9d9c,'description':_0x233330,'path':path['join'](_0x57b299,_0x217a36[0x0]),'type':_0x1942bf,'sidebar':_0x495c7f,'icon':_0x146098,'adminUrl':_0x410abe,'agentUrl':_0x1c87a8,'scriptName':_0x492ff7,'scriptPath':_0x44bea1,'version':_0x2a4210};removeReferences(_0x5e117b,null);return db[_0x8b51('0x35')][_0x8b51('0x91')](_0x4ffbd)[_0x8b51('0x2c')](function(_0x51d312){var _0x1ea233={'role':_0x4aeaaa[_0x8b51('0x92')]['role'],'userProfileId':_0x4aeaaa[_0x8b51('0x92')]['userProfileId']};if(!_0x1ea233)throw new Error(_0x8b51('0x93'));if(_0x1ea233[_0x8b51('0x94')]==='user'){var _0x2bb5de=_0x51d312[_0x8b51('0x2d')]({'plain':!![]});return db[_0x8b51('0x95')][_0x8b51('0x4e')]({'where':{'name':_0x8b51('0x2e'),'userProfileId':_0x1ea233[_0x8b51('0x96')]},'raw':!![]})[_0x8b51('0x2c')](function(_0x5ed905){if(_0x5ed905&&_0x5ed905[_0x8b51('0x97')]===0x0){return db[_0x8b51('0x2f')][_0x8b51('0x91')]({'name':_0x2bb5de[_0x8b51('0x31')],'resourceId':_0x2bb5de['id'],'type':_0x5ed905[_0x8b51('0x31')],'sectionId':_0x5ed905['id']},{})[_0x8b51('0x2c')](function(){return _0x51d312;});}else{return _0x51d312;}})[_0x8b51('0x49')](function(_0x462ca1){logger[_0x8b51('0x5a')](_0x8b51('0x98'),_0x462ca1);throw _0x462ca1;});}return _0x51d312;})[_0x8b51('0x2c')](respondWithResult(_0x12a488,null))[_0x8b51('0x49')](handleError(_0x12a488,null));}});}catch(_0x47610b){_0x12a488['status'](0x1f4)[_0x8b51('0x32')](_0x47610b);}};function removeReferences(_0x5bf3e2,_0x3d106e){try{if(_0x5bf3e2){fs[_0x8b51('0x99')](_0x5bf3e2);logger['info'](_0x8b51('0x9a'));}if(_0x3d106e){rimraf(_0x3d106e,function(){});logger[_0x8b51('0x67')](_0x8b51('0x9b'));}}catch(_0x4c19ae){logger[_0x8b51('0x5a')](_0x4c19ae);}}exports[_0x8b51('0x2a')]=function(_0x1bee70,_0x555872,_0x433c03){return db[_0x8b51('0x35')][_0x8b51('0x4e')]({'where':{'id':_0x1bee70[_0x8b51('0x50')]['id']}})[_0x8b51('0x2c')](handleEntityNotFound(_0x555872,null))[_0x8b51('0x2c')](saveUpdates(_0x1bee70[_0x8b51('0x92')],null))[_0x8b51('0x2c')](respondWithResult(_0x555872,null))['catch'](handleError(_0x555872,null));};exports[_0x8b51('0x9c')]=function(_0x25abcb,_0x2f377e,_0x4e3a14){return db[_0x8b51('0x35')][_0x8b51('0x4e')]({'where':{'id':_0x25abcb[_0x8b51('0x50')]['id']}})[_0x8b51('0x2c')](function(_0x3ffebf){if(_0x3ffebf){return _0x3ffebf[_0x8b51('0x2b')]();}})[_0x8b51('0x2c')](function(_0x55c2e3){rimraf(path[_0x8b51('0x51')](config['root'],_0x8b51('0x6d'),path[_0x8b51('0x61')](_0x55c2e3[_0x8b51('0x7')])),function(){});return _0x55c2e3;})[_0x8b51('0x2c')](handleEntityNotFound(_0x2f377e,null))[_0x8b51('0x2c')](respondWithStatusCode(_0x2f377e,null))[_0x8b51('0x49')](handleError(_0x2f377e,null));};exports[_0x8b51('0x9d')]=function(_0x1072c6,_0x206ca1,_0x2f8a3d){return BPromise['resolve']()[_0x8b51('0x2c')](function(){if(!_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x7')]){throw new Error(_0x8b51('0x9e'));}if(!_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x496103=_0x1072c6[_0x8b51('0x3a')][_0x8b51('0xa0')]?_0x1072c6[_0x8b51('0x3a')][_0x8b51('0xa0')]+':'+_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x9f')]:_0x8b51('0xa1')+_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x9f')];var _0x460402=_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x22')]?_0x1072c6['query'][_0x8b51('0x22')]:!![];var _0x26560b=_0x1072c6[_0x8b51('0x3a')][_0x8b51('0xa2')]?_0x1072c6[_0x8b51('0x3a')][_0x8b51('0xa2')]:null;var _0x513a0d={'method':_0x1072c6[_0x8b51('0xa3')],'uri':util['format'](_0x8b51('0xa4'),_0x496103,_0x1072c6[_0x8b51('0x3a')][_0x8b51('0x7')]),'json':_0x460402,'resolveWithFullResponse':!![],'encoding':_0x26560b,'qs':_0x1072c6[_0x8b51('0x3a')]};if(_0x1072c6[_0x8b51('0xa5')]){_0x513a0d[_0x8b51('0xa5')]=_0x1072c6[_0x8b51('0xa5')];if(_0x513a0d[_0x8b51('0xa5')]['content-length']){delete _0x513a0d[_0x8b51('0xa5')][_0x8b51('0xa6')];}}if(_0x513a0d[_0x8b51('0xa5')][_0x8b51('0xa7')]){delete _0x513a0d[_0x8b51('0xa5')][_0x8b51('0xa7')];}return rp(_0x513a0d);})[_0x8b51('0x2c')](function(_0x271d85){if(_0x271d85){_0x206ca1[_0x8b51('0x27')](_0x271d85[_0x8b51('0xa5')]);logger[_0x8b51('0x67')](_0x271d85['body']);if(_[_0x8b51('0xa8')](_0x1072c6['query'][_0x8b51('0x7')],'download')&&_0x271d85['statusCode']==0x1f4){return _0x206ca1[_0x8b51('0x1f')](_0x271d85[_0x8b51('0xa9')]);}else{return _0x206ca1[_0x8b51('0x20')](_0x271d85[_0x8b51('0xa9')])[_0x8b51('0x32')](_0x271d85['body']);}}else{return _0x206ca1[_0x8b51('0x1f')](0xc8);}})[_0x8b51('0x49')](handleError(_0x206ca1,null));};exports[_0x8b51('0xaa')]=function(_0x115346,_0x3ad3e5,_0x1e703a){return BPromise[_0x8b51('0xab')]()[_0x8b51('0x2c')](function(){if(!_0x115346[_0x8b51('0x3a')]['path']){throw new Error(_0x8b51('0x9e'));}if(!_0x115346[_0x8b51('0x3a')][_0x8b51('0x9f')]){throw new Error(_0x8b51('0xac'));}var _0x726cff=_0x115346[_0x8b51('0x3a')][_0x8b51('0xa0')]?_0x115346[_0x8b51('0x3a')][_0x8b51('0xa0')]+':'+_0x115346[_0x8b51('0x3a')][_0x8b51('0x9f')]:_0x8b51('0xa1')+_0x115346['query'][_0x8b51('0x9f')];var _0x2a51a9=_0x115346[_0x8b51('0x3a')]['json']?_0x115346[_0x8b51('0x3a')][_0x8b51('0x22')]:!![];var _0x263955=_0x115346[_0x8b51('0x3a')]['encoding']?_0x115346[_0x8b51('0x3a')][_0x8b51('0xa2')]:null;var _0x5a0dd4={'method':_0x115346['method'],'uri':util[_0x8b51('0x53')](_0x8b51('0xa4'),_0x726cff,_0x115346[_0x8b51('0x3a')][_0x8b51('0x7')]),'json':_0x2a51a9,'resolveWithFullResponse':!![],'encoding':_0x263955,'body':_0x115346[_0x8b51('0x92')]};if(_0x115346[_0x8b51('0xa5')]){_0x5a0dd4[_0x8b51('0xa5')]=_0x115346[_0x8b51('0xa5')];if(_0x5a0dd4[_0x8b51('0xa5')][_0x8b51('0xa6')]){delete _0x5a0dd4['headers'][_0x8b51('0xa6')];}}if(_0x5a0dd4['headers'][_0x8b51('0xa7')]){delete _0x5a0dd4[_0x8b51('0xa5')][_0x8b51('0xa7')];}return rp(_0x5a0dd4);})[_0x8b51('0x2c')](function(_0x5c4171){if(_0x5c4171){_0x3ad3e5[_0x8b51('0x27')](_0x5c4171[_0x8b51('0xa5')]);logger['info'](_0x5c4171[_0x8b51('0x92')]);return _0x3ad3e5[_0x8b51('0x20')](_0x5c4171[_0x8b51('0xa9')])['send'](_0x5c4171[_0x8b51('0x92')]);}else{return _0x3ad3e5['sendStatus'](0xc8);}})[_0x8b51('0x49')](handleError(_0x3ad3e5,null));}; \ No newline at end of file +var _0x7cda=['lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','unlinkSync','Zip\x20archive\x20removed','body','delete','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','content-length','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','extract-zip','rimraf','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Plugins','error','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Plugin','includeAll','findAll','show','params','rawAttributes','include','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','format','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','catch','upload','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x7cda,0x183));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7cd('0x0'));var rp=require(_0xa7cd('0x1'));var moment=require('moment');var BPromise=require(_0xa7cd('0x2'));var Mustache=require(_0xa7cd('0x3'));var util=require(_0xa7cd('0x4'));var path=require(_0xa7cd('0x5'));var sox=require(_0xa7cd('0x6'));var csv=require(_0xa7cd('0x7'));var ejs=require(_0xa7cd('0x8'));var fs=require('fs');var fs_extra=require(_0xa7cd('0x9'));var _=require(_0xa7cd('0xa'));var squel=require(_0xa7cd('0xb'));var crypto=require(_0xa7cd('0xc'));var jsforce=require(_0xa7cd('0xd'));var deskjs=require(_0xa7cd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xa7cd('0xf'));var rimraf=require(_0xa7cd('0x10'));var archiver=require(_0xa7cd('0x11'));var Redis=require(_0xa7cd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa7cd('0x13'));var hardwareService=require(_0xa7cd('0x14'));var logger=require(_0xa7cd('0x15'))(_0xa7cd('0x16'));var utils=require(_0xa7cd('0x17'));var config=require(_0xa7cd('0x18'));var licenseUtil=require(_0xa7cd('0x19'));var db=require(_0xa7cd('0x1a'))['db'];config[_0xa7cd('0x1b')]=_[_0xa7cd('0x1c')](config[_0xa7cd('0x1b')],{'host':_0xa7cd('0x1d'),'port':0x18eb});var socket=require(_0xa7cd('0x1e'))(new Redis(config[_0xa7cd('0x1b')]));require(_0xa7cd('0x1f'))[_0xa7cd('0x20')](socket);function respondWithStatusCode(_0x27434a,_0x4e5fc5){_0x4e5fc5=_0x4e5fc5||0xcc;return function(_0x509b14){if(_0x509b14){return _0x27434a[_0xa7cd('0x21')](_0x4e5fc5);}return _0x27434a['status'](_0x4e5fc5)[_0xa7cd('0x22')]();};}function respondWithResult(_0x4b32d6,_0x135618){_0x135618=_0x135618||0xc8;return function(_0x41de09){if(_0x41de09){return _0x4b32d6[_0xa7cd('0x23')](_0x135618)[_0xa7cd('0x24')](_0x41de09);}};}function respondWithFilteredResult(_0x249677,_0x27b9d0){return function(_0x3f997a){if(_0x3f997a){var _0x42e9c7=typeof _0x27b9d0[_0xa7cd('0x25')]===_0xa7cd('0x26')&&typeof _0x27b9d0[_0xa7cd('0x27')]===_0xa7cd('0x26');var _0x1d52ed=_0x3f997a[_0xa7cd('0x28')];var _0x5bc76c=_0x42e9c7?0x0:_0x27b9d0['offset'];var _0x3975f5=_0x42e9c7?_0x3f997a[_0xa7cd('0x28')]:_0x27b9d0[_0xa7cd('0x25')]+_0x27b9d0[_0xa7cd('0x27')];var _0x47735f;if(_0x3975f5>=_0x1d52ed){_0x3975f5=_0x1d52ed;_0x47735f=0xc8;}else{_0x47735f=0xce;}_0x249677[_0xa7cd('0x23')](_0x47735f);return _0x249677[_0xa7cd('0x29')](_0xa7cd('0x2a'),_0x5bc76c+'-'+_0x3975f5+'/'+_0x1d52ed)['json'](_0x3f997a);}return null;};}function patchUpdates(_0x1dc663){return function(_0x5e4972){try{jsonpatch[_0xa7cd('0x2b')](_0x5e4972,_0x1dc663,!![]);}catch(_0x25efd1){return BPromise[_0xa7cd('0x2c')](_0x25efd1);}return _0x5e4972['save']();};}function saveUpdates(_0x541a64,_0x393015){return function(_0x26bd44){if(_0x26bd44){return _0x26bd44[_0xa7cd('0x2d')](_0x541a64)['then'](function(_0x34c336){return _0x34c336;});}return null;};}function removeEntity(_0x5ac01b,_0x1c91e2){return function(_0x3d74d5){if(_0x3d74d5){return _0x3d74d5[_0xa7cd('0x2e')]()[_0xa7cd('0x2f')](function(){var _0x2dcf1d=_0x3d74d5[_0xa7cd('0x30')]({'plain':!![]});var _0x5461c1=_0xa7cd('0x31');return db['UserProfileResource'][_0xa7cd('0x2e')]({'where':{'type':_0x5461c1,'resourceId':_0x2dcf1d['id']}})[_0xa7cd('0x2f')](function(){return _0x3d74d5;});})[_0xa7cd('0x2f')](function(){_0x5ac01b[_0xa7cd('0x23')](0xcc)[_0xa7cd('0x22')]();});}};}function handleEntityNotFound(_0x1531b1,_0xe1bd41){return function(_0x57165c){if(!_0x57165c){_0x1531b1[_0xa7cd('0x21')](0x194);}return _0x57165c;};}function handleError(_0x508f9c,_0x45f1cb){_0x45f1cb=_0x45f1cb||0x1f4;return function(_0x389997){logger[_0xa7cd('0x32')](_0x389997['stack']);if(_0x389997[_0xa7cd('0x33')]){delete _0x389997['name'];}_0x508f9c[_0xa7cd('0x23')](_0x45f1cb)[_0xa7cd('0x34')](_0x389997);};}exports['index']=function(_0x5c0eb8,_0x102557){var _0x3ea000={},_0xccdcd2={},_0x4494d9={'count':0x0,'rows':[]};var _0x3d1ab0=_['map'](db['Plugin']['rawAttributes'],function(_0x26a2bd){return{'name':_0x26a2bd[_0xa7cd('0x35')],'type':_0x26a2bd[_0xa7cd('0x36')][_0xa7cd('0x37')]};});_0xccdcd2[_0xa7cd('0x38')]=_[_0xa7cd('0x39')](_0x3d1ab0,_0xa7cd('0x33'));_0xccdcd2[_0xa7cd('0x3a')]=_[_0xa7cd('0x3b')](_0x5c0eb8[_0xa7cd('0x3a')]);_0xccdcd2[_0xa7cd('0x3c')]=_[_0xa7cd('0x3d')](_0xccdcd2[_0xa7cd('0x38')],_0xccdcd2[_0xa7cd('0x3a')]);_0x3ea000[_0xa7cd('0x3e')]=_[_0xa7cd('0x3d')](_0xccdcd2[_0xa7cd('0x38')],qs[_0xa7cd('0x3f')](_0x5c0eb8['query'][_0xa7cd('0x3f')]));_0x3ea000['attributes']=_0x3ea000[_0xa7cd('0x3e')][_0xa7cd('0x40')]?_0x3ea000['attributes']:_0xccdcd2['model'];if(!_0x5c0eb8['query']['hasOwnProperty'](_0xa7cd('0x41'))){_0x3ea000[_0xa7cd('0x27')]=qs[_0xa7cd('0x27')](_0x5c0eb8[_0xa7cd('0x3a')]['limit']);_0x3ea000[_0xa7cd('0x25')]=qs[_0xa7cd('0x25')](_0x5c0eb8['query'][_0xa7cd('0x25')]);}_0x3ea000[_0xa7cd('0x42')]=qs[_0xa7cd('0x43')](_0x5c0eb8[_0xa7cd('0x3a')]['sort']);_0x3ea000[_0xa7cd('0x44')]=qs[_0xa7cd('0x3c')](_[_0xa7cd('0x45')](_0x5c0eb8[_0xa7cd('0x3a')],_0xccdcd2[_0xa7cd('0x3c')]),_0x3d1ab0);if(_0x5c0eb8[_0xa7cd('0x3a')]['filter']){_0x3ea000[_0xa7cd('0x44')]=_[_0xa7cd('0x46')](_0x3ea000['where'],{'$or':_[_0xa7cd('0x39')](_0x3d1ab0,function(_0x49f7a9){if(_0x49f7a9['type']!==_0xa7cd('0x47')){var _0xc8c904={};_0xc8c904[_0x49f7a9[_0xa7cd('0x33')]]={'$like':'%'+_0x5c0eb8['query'][_0xa7cd('0x48')]+'%'};return _0xc8c904;}})});}_0x3ea000=_['merge']({},_0x3ea000,_0x5c0eb8[_0xa7cd('0x49')]);var _0x511de0={'where':_0x3ea000[_0xa7cd('0x44')]};return db[_0xa7cd('0x4a')][_0xa7cd('0x28')](_0x511de0)[_0xa7cd('0x2f')](function(_0x525408){_0x4494d9['count']=_0x525408;if(_0x5c0eb8['query'][_0xa7cd('0x4b')]){_0x3ea000['include']=[{'all':!![]}];}return db[_0xa7cd('0x4a')][_0xa7cd('0x4c')](_0x3ea000);})['then'](function(_0x297114){_0x4494d9['rows']=_0x297114;return _0x4494d9;})['then'](respondWithFilteredResult(_0x102557,_0x3ea000))['catch'](handleError(_0x102557,null));};exports[_0xa7cd('0x4d')]=function(_0x2740f7,_0x1b47ae){var _0x42bf27={'raw':!![],'where':{'id':_0x2740f7[_0xa7cd('0x4e')]['id']}},_0x66370b={};_0x66370b[_0xa7cd('0x38')]=_[_0xa7cd('0x3b')](db[_0xa7cd('0x4a')][_0xa7cd('0x4f')]);_0x66370b[_0xa7cd('0x3a')]=_[_0xa7cd('0x3b')](_0x2740f7['query']);_0x66370b[_0xa7cd('0x3c')]=_[_0xa7cd('0x3d')](_0x66370b[_0xa7cd('0x38')],_0x66370b['query']);_0x42bf27[_0xa7cd('0x3e')]=_[_0xa7cd('0x3d')](_0x66370b[_0xa7cd('0x38')],qs['fields'](_0x2740f7[_0xa7cd('0x3a')][_0xa7cd('0x3f')]));_0x42bf27[_0xa7cd('0x3e')]=_0x42bf27[_0xa7cd('0x3e')][_0xa7cd('0x40')]?_0x42bf27[_0xa7cd('0x3e')]:_0x66370b[_0xa7cd('0x38')];if(_0x2740f7[_0xa7cd('0x3a')][_0xa7cd('0x4b')]){_0x42bf27[_0xa7cd('0x50')]=[{'all':!![]}];}_0x42bf27=_['merge']({},_0x42bf27,_0x2740f7[_0xa7cd('0x49')]);return db[_0xa7cd('0x4a')][_0xa7cd('0x51')](_0x42bf27)['then'](handleEntityNotFound(_0x1b47ae,null))['then'](respondWithResult(_0x1b47ae,null))['catch'](handleError(_0x1b47ae,null));};exports[_0xa7cd('0x52')]=function(_0x3ffb16,_0x5d9bb8,_0x3da054){return db[_0xa7cd('0x4a')]['find']({'where':{'id':_0x3ffb16[_0xa7cd('0x4e')]['id']},'attributes':[_0xa7cd('0x33'),_0xa7cd('0x5')],'raw':!![]})[_0xa7cd('0x2f')](handleEntityNotFound(_0x5d9bb8,null))['then'](function(_0x2b88d0){if(_0x2b88d0){var _0x360f43=path[_0xa7cd('0x53')](config[_0xa7cd('0x54')],_0xa7cd('0x55'),util['format'](_0xa7cd('0x56'),path[_0xa7cd('0x57')](_0x2b88d0['path'])));var _0x58d182=fs[_0xa7cd('0x58')](_0x360f43);var _0x59511b=archiver(_0xa7cd('0x59'),{'zlib':{'level':0x9}});_0x59511b['on'](_0xa7cd('0x5a'),function(_0x2f21e3){if(_0x2f21e3['code']==='ENOENT'){logger[_0xa7cd('0x32')](_0x2f21e3);}else{throw new db[(_0xa7cd('0x5b'))]['Error'](_0xa7cd('0x5c'));}});_0x59511b['on'](_0xa7cd('0x32'),function(_0x37e6d6){throw new db[(_0xa7cd('0x5b'))][(_0xa7cd('0x5d'))](_0xa7cd('0x5c'));});_0x59511b[_0xa7cd('0x5e')](_0x58d182);_0x59511b[_0xa7cd('0x5f')](_0xa7cd('0x60'),{'cwd':path[_0xa7cd('0x53')](config[_0xa7cd('0x54')],_0xa7cd('0x55'),path[_0xa7cd('0x61')](_0x2b88d0[_0xa7cd('0x5')])),'ignore':[path['join'](path['basename'](_0x2b88d0[_0xa7cd('0x5')]),_0xa7cd('0x62')),path[_0xa7cd('0x53')](path[_0xa7cd('0x57')](_0x2b88d0['path']),_0xa7cd('0x63'))],'nodir':!![]})[_0xa7cd('0x64')]();_0x58d182['on'](_0xa7cd('0x65'),function(){if(!fs['existsSync'](_0x360f43)){throw new db[(_0xa7cd('0x5b'))][(_0xa7cd('0x5d'))]('Plugin\x20not\x20found');}return _0x5d9bb8[_0xa7cd('0x52')](_0x360f43,util[_0xa7cd('0x66')]('%s.zip',path[_0xa7cd('0x57')](_0x2b88d0[_0xa7cd('0x5')])),function(_0x4d632b){if(_0x4d632b){throw new db[(_0xa7cd('0x5b'))]['Error'](_0xa7cd('0x67'));}fs['unlinkSync'](_0x360f43);logger['info']('Download\x20completed');logger[_0xa7cd('0x68')](_0xa7cd('0x69'));});});}return null;})[_0xa7cd('0x6a')](handleError(_0x5d9bb8,null));};exports[_0xa7cd('0x6b')]=function(_0x532592,_0x28194f,_0xa2e403){var _0x5d669e=path['basename'](_0x532592['file']['filename'],path['extname'](_0x532592[_0xa7cd('0x6c')]['filename']));var _0x255dfc=path['join'](config[_0xa7cd('0x54')],'server/files/plugins',_0x532592[_0xa7cd('0x6c')]['filename']);var _0x2be314=path[_0xa7cd('0x53')](config[_0xa7cd('0x54')],'server/files/plugins',_0x5d669e);logger['info'](_0xa7cd('0x6d'),_0x255dfc);logger[_0xa7cd('0x68')](_0xa7cd('0x6e'),_0x2be314);try{fs[_0xa7cd('0x6f')](_0x255dfc,parseInt('0777',0x8));extract(_0x255dfc,{'dir':_0x2be314},function(_0x47aea8){if(_0x47aea8){logger[_0xa7cd('0x32')](_0x47aea8);handleError(_0x47aea8,!![]);};var _0xf37a8a=fs[_0xa7cd('0x70')](_0x2be314);if(_0xf37a8a[_0xa7cd('0x40')]>0x1){removeReferences(_0x255dfc,_0x2be314);logger[_0xa7cd('0x32')](_0xa7cd('0x71'));return _0xa2e403(new Error(_0xa7cd('0x71')));}var _0x81e8a9=fs[_0xa7cd('0x72')](path[_0xa7cd('0x53')](_0x2be314,_0xf37a8a[0x0]));if(_0x81e8a9['isFile']()){removeReferences(_0x255dfc,_0x2be314);logger[_0xa7cd('0x32')](_0xa7cd('0x71'));return _0xa2e403(new Error(_0xa7cd('0x71')));}if(_0x81e8a9[_0xa7cd('0x73')]()){var _0x35e0e6=fs['readdirSync'](path[_0xa7cd('0x53')](_0x2be314,_0xf37a8a[0x0]));if(_0x35e0e6[_0xa7cd('0x40')]===0x0){removeReferences(_0x255dfc,_0x2be314);logger['error'](_0xa7cd('0x71'));return _0xa2e403(new Error(_0xa7cd('0x71')));}var _0x4a81ad=_0x35e0e6[_0xa7cd('0x74')](function(_0x5c55e4){return _0x5c55e4===_0xa7cd('0x75');});if(!_0x4a81ad){return _0xa2e403(new Error(_0xa7cd('0x76')));}var _0x48823d=fs[_0xa7cd('0x77')](path['join'](_0x2be314,_0xf37a8a[0x0],_0xa7cd('0x75')));var _0x27cf75=JSON[_0xa7cd('0x78')](_0x48823d);if(_0xa7cd('0x26')==typeof _0x27cf75['name']){return _0xa2e403(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xa7cd('0x26')==typeof _0x27cf75[_0xa7cd('0x36')]){return _0xa2e403(new Error(_0xa7cd('0x79')));}if(_0xa7cd('0x26')==typeof _0x27cf75['version']){return _0xa2e403(new Error(_0xa7cd('0x7a')));}if(_0xa7cd('0x26')==typeof _0x27cf75[_0xa7cd('0x7b')]){return _0xa2e403(new Error(_0xa7cd('0x7c')));}if(_0x27cf75[_0xa7cd('0x36')]===_0xa7cd('0x7d')){if(_0xa7cd('0x26')==typeof _0x27cf75[_0xa7cd('0x7b')]['views']){return _0xa2e403(new Error(_0xa7cd('0x7e')));}if(_0xa7cd('0x26')==typeof _0x27cf75['parameters'][_0xa7cd('0x7f')][_0xa7cd('0x80')]&&_0xa7cd('0x26')==typeof _0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')]['agent']){return _0xa2e403(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x27cf75[_0xa7cd('0x36')]===_0xa7cd('0x81')){if(_0xa7cd('0x26')==typeof _0x27cf75['parameters'][_0xa7cd('0x82')]){return _0xa2e403(new Error(_0xa7cd('0x83')));}if('undefined'==typeof _0x27cf75['parameters'][_0xa7cd('0x84')]){return _0xa2e403(new Error(_0xa7cd('0x85')));}}else{return _0xa2e403(new Error(_0xa7cd('0x86')));}var _0x4c82c0=_0x27cf75['name'];var _0x1f35d0=_0x27cf75[_0xa7cd('0x87')];var _0x43c86e=_0x27cf75[_0xa7cd('0x36')];var _0x155fc9=_0x27cf75[_0xa7cd('0x88')]?_0x27cf75[_0xa7cd('0x88')]:_0xa7cd('0x89');var _0x34ebf8=_0x27cf75[_0xa7cd('0x8a')]?_0x27cf75[_0xa7cd('0x8a')]:_0xa7cd('0x8b');var _0x3cb02a='';var _0x491ff2='';var _0x19ea9a='';var _0x4bd162='';var _0x37fde3=_0x27cf75[_0xa7cd('0x8c')];if(_0x43c86e===_0xa7cd('0x7d')){if(_0xa7cd('0x26')!=typeof _0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')][_0xa7cd('0x80')]){var _0x5e4e1f=_0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')][_0xa7cd('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa7cd('0x8d')](_0x5e4e1f)){_0x3cb02a=path[_0xa7cd('0x53')](_0xa7cd('0x8e'),_0x5d669e,_0xf37a8a[0x0],_0x5e4e1f);}else{_0x3cb02a=_0x5e4e1f;}}else{logger[_0xa7cd('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xa7cd('0x26')!=typeof _0x27cf75[_0xa7cd('0x7b')]['views'][_0xa7cd('0x8f')]){var _0x44ec53=_0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x44ec53)){_0x491ff2=path[_0xa7cd('0x53')]('plugins',_0x5d669e,_0xf37a8a[0x0],_0x44ec53);}else{_0x491ff2=_0x44ec53;}}else{logger[_0xa7cd('0x68')](_0xa7cd('0x90'));}}else if(_0x43c86e===_0xa7cd('0x81')){_0x19ea9a=_0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x82')];_0x4bd162=_0x27cf75[_0xa7cd('0x7b')]['scriptPath'];if('undefined'!=typeof _0x27cf75['parameters'][_0xa7cd('0x7f')]){if(_0xa7cd('0x26')!=typeof _0x27cf75[_0xa7cd('0x7b')]['views'][_0xa7cd('0x80')]){var _0x5e4e1f=_0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')][_0xa7cd('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa7cd('0x8d')](_0x5e4e1f)){_0x3cb02a=path[_0xa7cd('0x53')](_0xa7cd('0x8e'),_0x5d669e,_0xf37a8a[0x0],_0x5e4e1f);}else{_0x3cb02a=_0x5e4e1f;}}if(_0xa7cd('0x26')!=typeof _0x27cf75[_0xa7cd('0x7b')][_0xa7cd('0x7f')][_0xa7cd('0x8f')]){var _0x44ec53=_0x27cf75[_0xa7cd('0x7b')]['views'][_0xa7cd('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xa7cd('0x8d')](_0x44ec53)){_0x491ff2=path[_0xa7cd('0x53')](_0xa7cd('0x8e'),_0x5d669e,_0xf37a8a[0x0],_0x44ec53);}else{_0x491ff2=_0x44ec53;}}}}var _0x20a0d2={'name':_0x4c82c0,'description':_0x1f35d0,'path':path[_0xa7cd('0x53')](_0x5d669e,_0xf37a8a[0x0]),'type':_0x43c86e,'sidebar':_0x155fc9,'icon':_0x34ebf8,'adminUrl':_0x3cb02a,'agentUrl':_0x491ff2,'scriptName':_0x19ea9a,'scriptPath':_0x4bd162,'version':_0x37fde3};removeReferences(_0x255dfc,null);return db[_0xa7cd('0x4a')][_0xa7cd('0x91')](_0x20a0d2)[_0xa7cd('0x2f')](function(_0x2f036c){var _0x1e020={'role':_0x532592['body'][_0xa7cd('0x92')],'userProfileId':_0x532592['body'][_0xa7cd('0x93')]};if(!_0x1e020)throw new Error(_0xa7cd('0x94'));if(_0x1e020['role']===_0xa7cd('0x95')){var _0x9e9260=_0x2f036c[_0xa7cd('0x30')]({'plain':!![]});return db['UserProfileSection'][_0xa7cd('0x51')]({'where':{'name':_0xa7cd('0x31'),'userProfileId':_0x1e020[_0xa7cd('0x93')]},'raw':!![]})[_0xa7cd('0x2f')](function(_0x5662d5){if(_0x5662d5&&_0x5662d5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x9e9260[_0xa7cd('0x33')],'resourceId':_0x9e9260['id'],'type':_0x5662d5[_0xa7cd('0x33')],'sectionId':_0x5662d5['id']},{})['then'](function(){return _0x2f036c;});}else{return _0x2f036c;}})[_0xa7cd('0x6a')](function(_0x488aee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x488aee);throw _0x488aee;});}return _0x2f036c;})[_0xa7cd('0x2f')](respondWithResult(_0x28194f,null))[_0xa7cd('0x6a')](handleError(_0x28194f,null));}});}catch(_0x4ab22b){_0x28194f[_0xa7cd('0x23')](0x1f4)[_0xa7cd('0x34')](_0x4ab22b);}};function removeReferences(_0x4732ec,_0xd80b28){try{if(_0x4732ec){fs[_0xa7cd('0x96')](_0x4732ec);logger[_0xa7cd('0x68')](_0xa7cd('0x97'));}if(_0xd80b28){rimraf(_0xd80b28,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x3414f4){logger[_0xa7cd('0x32')](_0x3414f4);}}exports[_0xa7cd('0x2d')]=function(_0x598928,_0x35396e,_0x5bf5ba){return db[_0xa7cd('0x4a')][_0xa7cd('0x51')]({'where':{'id':_0x598928[_0xa7cd('0x4e')]['id']}})[_0xa7cd('0x2f')](handleEntityNotFound(_0x35396e,null))[_0xa7cd('0x2f')](saveUpdates(_0x598928[_0xa7cd('0x98')],null))[_0xa7cd('0x2f')](respondWithResult(_0x35396e,null))['catch'](handleError(_0x35396e,null));};exports[_0xa7cd('0x99')]=function(_0x1f86b4,_0x58e76f,_0x547ef5){return db[_0xa7cd('0x4a')][_0xa7cd('0x51')]({'where':{'id':_0x1f86b4[_0xa7cd('0x4e')]['id']}})[_0xa7cd('0x2f')](function(_0xcbe04d){if(_0xcbe04d){return _0xcbe04d[_0xa7cd('0x2e')]();}})[_0xa7cd('0x2f')](function(_0x56c1e3){rimraf(path[_0xa7cd('0x53')](config['root'],'server/files/plugins',path[_0xa7cd('0x61')](_0x56c1e3[_0xa7cd('0x5')])),function(){});return _0x56c1e3;})[_0xa7cd('0x2f')](handleEntityNotFound(_0x58e76f,null))[_0xa7cd('0x2f')](respondWithStatusCode(_0x58e76f,null))[_0xa7cd('0x6a')](handleError(_0x58e76f,null));};exports['webhookGet']=function(_0x34ee7a,_0x3493bb,_0x490b26){return BPromise['resolve']()['then'](function(){if(!_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x34ee7a['query'][_0xa7cd('0x9a')]){throw new Error(_0xa7cd('0x9b'));}var _0xe12153=_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x9c')]?_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x9c')]+':'+_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x9a')]:_0xa7cd('0x9d')+_0x34ee7a['query'][_0xa7cd('0x9a')];var _0x151688=_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x24')]?_0x34ee7a['query'][_0xa7cd('0x24')]:!![];var _0x450017=_0x34ee7a[_0xa7cd('0x3a')]['encoding']?_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x9e')]:null;var _0x347366={'method':_0x34ee7a[_0xa7cd('0x9f')],'uri':util['format'](_0xa7cd('0xa0'),_0xe12153,_0x34ee7a[_0xa7cd('0x3a')][_0xa7cd('0x5')]),'json':_0x151688,'resolveWithFullResponse':!![],'encoding':_0x450017,'qs':_0x34ee7a[_0xa7cd('0x3a')]};if(_0x34ee7a[_0xa7cd('0xa1')]){_0x347366[_0xa7cd('0xa1')]=_0x34ee7a[_0xa7cd('0xa1')];if(_0x347366[_0xa7cd('0xa1')]['content-length']){delete _0x347366[_0xa7cd('0xa1')]['content-length'];}}if(_0x347366[_0xa7cd('0xa1')][_0xa7cd('0xa2')]){delete _0x347366[_0xa7cd('0xa1')][_0xa7cd('0xa2')];}return rp(_0x347366);})[_0xa7cd('0x2f')](function(_0x18c173){if(_0x18c173){_0x3493bb['set'](_0x18c173[_0xa7cd('0xa1')]);logger[_0xa7cd('0x68')](_0x18c173[_0xa7cd('0x98')]);if(_[_0xa7cd('0xa3')](_0x34ee7a['query']['path'],'download')&&_0x18c173[_0xa7cd('0xa4')]==0x1f4){return _0x3493bb[_0xa7cd('0x21')](_0x18c173[_0xa7cd('0xa4')]);}else{return _0x3493bb[_0xa7cd('0x23')](_0x18c173['statusCode'])[_0xa7cd('0x34')](_0x18c173[_0xa7cd('0x98')]);}}else{return _0x3493bb['sendStatus'](0xc8);}})[_0xa7cd('0x6a')](handleError(_0x3493bb,null));};exports['webhookPost']=function(_0x1a909f,_0x48f8d5,_0x5bb161){return BPromise['resolve']()['then'](function(){if(!_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x5')]){throw new Error(_0xa7cd('0xa5'));}if(!_0x1a909f[_0xa7cd('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2298f5=_0x1a909f['query']['hostname']?_0x1a909f[_0xa7cd('0x3a')]['hostname']+':'+_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x9a')]:'http://localhost:'+_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x9a')];var _0x5cf3fe=_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x24')]?_0x1a909f[_0xa7cd('0x3a')]['json']:!![];var _0x3e9c51=_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x9e')]?_0x1a909f[_0xa7cd('0x3a')]['encoding']:null;var _0x12f4f9={'method':_0x1a909f[_0xa7cd('0x9f')],'uri':util['format'](_0xa7cd('0xa0'),_0x2298f5,_0x1a909f[_0xa7cd('0x3a')][_0xa7cd('0x5')]),'json':_0x5cf3fe,'resolveWithFullResponse':!![],'encoding':_0x3e9c51,'body':_0x1a909f[_0xa7cd('0x98')]};if(_0x1a909f[_0xa7cd('0xa1')]){_0x12f4f9[_0xa7cd('0xa1')]=_0x1a909f[_0xa7cd('0xa1')];if(_0x12f4f9[_0xa7cd('0xa1')][_0xa7cd('0xa6')]){delete _0x12f4f9['headers']['content-length'];}}if(_0x12f4f9[_0xa7cd('0xa1')][_0xa7cd('0xa2')]){delete _0x12f4f9[_0xa7cd('0xa1')][_0xa7cd('0xa2')];}return rp(_0x12f4f9);})['then'](function(_0x39e926){if(_0x39e926){_0x48f8d5[_0xa7cd('0x29')](_0x39e926['headers']);logger[_0xa7cd('0x68')](_0x39e926[_0xa7cd('0x98')]);return _0x48f8d5['status'](_0x39e926[_0xa7cd('0xa4')])['send'](_0x39e926[_0xa7cd('0x98')]);}else{return _0x48f8d5[_0xa7cd('0x21')](0xc8);}})['catch'](handleError(_0x48f8d5,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6470197..f592569 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 _0x374c=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x20d8b4,_0x129cfc){var _0x4604d1=function(_0x2eefbd){while(--_0x2eefbd){_0x20d8b4['push'](_0x20d8b4['shift']());}};_0x4604d1(++_0x129cfc);}(_0x374c,0x1e3));var _0xc374=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x374c[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc374('0x0'))['db'][_0xc374('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc374('0x2')](0x0);var events={'afterCreate':_0xc374('0x3'),'afterUpdate':_0xc374('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8d161e){return function(_0x534707,_0x1f68cf,_0x2561c0){PluginEvents['emit'](_0x8d161e+':'+_0x534707['id'],_0x534707);PluginEvents[_0xc374('0x5')](_0x8d161e,_0x534707);_0x2561c0(null);};}for(var e in events){if(events[_0xc374('0x6')](e)){var event=events[e];Plugin[_0xc374('0x7')](e,emitEvent(event));}}module[_0xc374('0x8')]=PluginEvents; \ No newline at end of file +var _0x3c94=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x3c94,0xcd));var _0x43c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3c94[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x43c9('0x0'));var Plugin=require(_0x43c9('0x1'))['db'][_0x43c9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x43c9('0x3')](0x0);var events={'afterCreate':_0x43c9('0x4'),'afterUpdate':_0x43c9('0x5'),'afterDestroy':_0x43c9('0x6')};function emitEvent(_0x18159f){return function(_0x170a0d,_0x44fc3,_0x15ef71){PluginEvents[_0x43c9('0x7')](_0x18159f+':'+_0x170a0d['id'],_0x170a0d);PluginEvents['emit'](_0x18159f,_0x170a0d);_0x15ef71(null);};}for(var e in events){if(events[_0x43c9('0x8')](e)){var event=events[e];Plugin[_0x43c9('0x9')](e,emitEvent(event));}}module[_0x43c9('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 7d61847..55a0f1e 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 _0x5af0=['moment','bluebird','request-promise','path','../../config/environment','exports','Plugin','lodash','util','../../config/logger','api'];(function(_0x554662,_0x4242b8){var _0x26621d=function(_0x593999){while(--_0x593999){_0x554662['push'](_0x554662['shift']());}};_0x26621d(++_0x4242b8);}(_0x5af0,0x1eb));var _0x05af=function(_0x1e0071,_0x195369){_0x1e0071=_0x1e0071-0x0;var _0x2f0418=_0x5af0[_0x1e0071];return _0x2f0418;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var logger=require(_0x05af('0x2'))(_0x05af('0x3'));var moment=require(_0x05af('0x4'));var BPromise=require(_0x05af('0x5'));var rp=require(_0x05af('0x6'));var fs=require('fs');var path=require(_0x05af('0x7'));var rimraf=require('rimraf');var config=require(_0x05af('0x8'));var attributes=require('./plugin.attributes');module[_0x05af('0x9')]=function(_0x27a3e2,_0x2a8ef6){return _0x27a3e2['define'](_0x05af('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46b7=['rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24e886,_0x117e1b){var _0x1aeea4=function(_0x56f8ca){while(--_0x56f8ca){_0x24e886['push'](_0x24e886['shift']());}};_0x1aeea4(++_0x117e1b);}(_0x46b7,0xf0));var _0x746b=function(_0x4e487c,_0x2f3e77){_0x4e487c=_0x4e487c-0x0;var _0x3acb9e=_0x46b7[_0x4e487c];return _0x3acb9e;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var logger=require(_0x746b('0x2'))(_0x746b('0x3'));var moment=require(_0x746b('0x4'));var BPromise=require(_0x746b('0x5'));var rp=require(_0x746b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x746b('0x7'));var config=require(_0x746b('0x8'));var attributes=require(_0x746b('0x9'));module['exports']=function(_0x2e60b7,_0x4e6a0b){return _0x2e60b7[_0x746b('0xa')](_0x746b('0xb'),attributes,{'tableName':_0x746b('0xc'),'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 ecb6cd5..559570a 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 _0xf55c=['error','message','result','catch','CreatePlugin','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','code'];(function(_0x46e9ed,_0x3c468a){var _0x591d3b=function(_0x758725){while(--_0x758725){_0x46e9ed['push'](_0x46e9ed['shift']());}};_0x591d3b(++_0x3c468a);}(_0xf55c,0x18a));var _0xcf55=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf55c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xcf55('0x0'));var util=require(_0xcf55('0x1'));var moment=require(_0xcf55('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require(_0xcf55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf55('0x5'));var logger=require('../../config/logger')(_0xcf55('0x6'));var config=require('../../config/environment');var jayson=require(_0xcf55('0x7'));var client=jayson[_0xcf55('0x8')][_0xcf55('0x9')]({'port':0x232a});config[_0xcf55('0xa')]=_[_0xcf55('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcf55('0xc'))(new Redis(config[_0xcf55('0xa')]));require(_0xcf55('0xd'))[_0xcf55('0xe')](socket);function respondWithRpcPromise(_0x6557ae,_0x2e4432,_0x33c0cd){return new BPromise(function(_0x399584,_0x33fe23){return client[_0xcf55('0xf')](_0x6557ae,_0x33c0cd)[_0xcf55('0x10')](function(_0x4adb69){logger[_0xcf55('0x11')](_0xcf55('0x12'),_0x2e4432,_0xcf55('0x13'));logger[_0xcf55('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2e4432,_0xcf55('0x13'),JSON['stringify'](_0x4adb69));if(_0x4adb69['error']){if(_0x4adb69['error'][_0xcf55('0x15')]===0x1f4){logger[_0xcf55('0x16')](_0xcf55('0x12'),_0x2e4432,_0x4adb69['error'][_0xcf55('0x17')]);return _0x33fe23(_0x4adb69[_0xcf55('0x16')][_0xcf55('0x17')]);}logger[_0xcf55('0x16')](_0xcf55('0x12'),_0x2e4432,_0x4adb69['error'][_0xcf55('0x17')]);return _0x399584(_0x4adb69[_0xcf55('0x16')]['message']);}else{logger['info'](_0xcf55('0x12'),_0x2e4432,_0xcf55('0x13'));_0x399584(_0x4adb69[_0xcf55('0x18')][_0xcf55('0x17')]);}})[_0xcf55('0x19')](function(_0x374d2b){logger[_0xcf55('0x16')](_0xcf55('0x12'),_0x2e4432,_0x374d2b);_0x33fe23(_0x374d2b);});});}exports[_0xcf55('0x1a')]=function(_0x202b92){var _0x421369=this;return new Promise(function(_0x3c210e,_0x4ba0ad){return db['Plugin'][_0xcf55('0x1b')](_0x202b92[_0xcf55('0x1c')],{'raw':_0x202b92[_0xcf55('0x1d')]?_0x202b92['options'][_0xcf55('0x1e')]===undefined?!![]:![]:!![]})[_0xcf55('0x10')](function(_0x1364a3){logger[_0xcf55('0x11')](_0xcf55('0x1a'),_0x202b92);logger[_0xcf55('0x14')](_0xcf55('0x1a'),_0x202b92,JSON[_0xcf55('0x1f')](_0x1364a3));_0x3c210e(_0x1364a3);})[_0xcf55('0x19')](function(_0x556ad2){logger['error'](_0xcf55('0x1a'),_0x556ad2['message'],_0x202b92);_0x4ba0ad(_0x421369[_0xcf55('0x16')](0x1f4,_0x556ad2[_0xcf55('0x17')]));});});}; \ No newline at end of file +var _0xd21b=['stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x119722,_0x3ae79c){var _0x4b0e0e=function(_0xcf7283){while(--_0xcf7283){_0x119722['push'](_0x119722['shift']());}};_0x4b0e0e(++_0x3ae79c);}(_0xd21b,0x9d));var _0xbd21=function(_0x2a9197,_0x5225eb){_0x2a9197=_0x2a9197-0x0;var _0x588c8a=_0xd21b[_0x2a9197];return _0x588c8a;};'use strict';var _=require('lodash');var util=require(_0xbd21('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbd21('0x1'));var fs=require('fs');var Redis=require(_0xbd21('0x2'));var db=require(_0xbd21('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd21('0x4'))(_0xbd21('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd21('0x6')][_0xbd21('0x7')]({'port':0x232a});config[_0xbd21('0x8')]=_[_0xbd21('0x9')](config[_0xbd21('0x8')],{'host':_0xbd21('0xa'),'port':0x18eb});var socket=require(_0xbd21('0xb'))(new Redis(config[_0xbd21('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x1cf3dd,_0x110a45,_0x4f79c0){return new BPromise(function(_0x566a36,_0x361dc1){return client[_0xbd21('0xc')](_0x1cf3dd,_0x4f79c0)['then'](function(_0x828aad){logger[_0xbd21('0xd')](_0xbd21('0xe'),_0x110a45,_0xbd21('0xf'));logger[_0xbd21('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x110a45,_0xbd21('0xf'),JSON[_0xbd21('0x11')](_0x828aad));if(_0x828aad[_0xbd21('0x12')]){if(_0x828aad[_0xbd21('0x12')][_0xbd21('0x13')]===0x1f4){logger[_0xbd21('0x12')](_0xbd21('0xe'),_0x110a45,_0x828aad[_0xbd21('0x12')][_0xbd21('0x14')]);return _0x361dc1(_0x828aad[_0xbd21('0x12')][_0xbd21('0x14')]);}logger[_0xbd21('0x12')](_0xbd21('0xe'),_0x110a45,_0x828aad[_0xbd21('0x12')][_0xbd21('0x14')]);return _0x566a36(_0x828aad[_0xbd21('0x12')][_0xbd21('0x14')]);}else{logger[_0xbd21('0xd')]('Plugin,\x20%s,\x20%s',_0x110a45,_0xbd21('0xf'));_0x566a36(_0x828aad[_0xbd21('0x15')][_0xbd21('0x14')]);}})[_0xbd21('0x16')](function(_0x50714c){logger[_0xbd21('0x12')]('Plugin,\x20%s,\x20%s',_0x110a45,_0x50714c);_0x361dc1(_0x50714c);});});}exports[_0xbd21('0x17')]=function(_0x4c6321){var _0x4967d0=this;return new Promise(function(_0x53ba6a,_0x345dd6){return db[_0xbd21('0x18')][_0xbd21('0x19')](_0x4c6321['body'],{'raw':_0x4c6321['options']?_0x4c6321[_0xbd21('0x1a')][_0xbd21('0x1b')]===undefined?!![]:![]:!![]})[_0xbd21('0x1c')](function(_0x31129e){logger[_0xbd21('0xd')](_0xbd21('0x17'),_0x4c6321);logger['debug'](_0xbd21('0x17'),_0x4c6321,JSON[_0xbd21('0x11')](_0x31129e));_0x53ba6a(_0x31129e);})[_0xbd21('0x16')](function(_0x235ef9){logger[_0xbd21('0x12')](_0xbd21('0x17'),_0x235ef9[_0xbd21('0x14')],_0x4c6321);_0x345dd6(_0x4967d0[_0xbd21('0x12')](0x1f4,_0x235ef9[_0xbd21('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 344843f..2f3da69 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 _0x8740=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x8740,0x171));var _0x0874=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x8740[_0x27af45];return _0x18df21;};'use strict';var PluginEvents=require(_0x0874('0x0'));var events=[_0x0874('0x1'),_0x0874('0x2'),_0x0874('0x3')];function createListener(_0x4cce85,_0x5b8b35){return function(_0x2e366d){_0x5b8b35[_0x0874('0x4')](_0x4cce85,_0x2e366d);};}function removeListener(_0x11656d,_0x1277c2){return function(){PluginEvents[_0x0874('0x5')](_0x11656d,_0x1277c2);};}exports[_0x0874('0x6')]=function(_0x40a6fb){for(var _0x1f98c0=0x0,_0x1cb052=events['length'];_0x1f98c0<_0x1cb052;_0x1f98c0++){var _0x9dc9b7=events[_0x1f98c0];var _0x575d01=createListener(_0x0874('0x7')+_0x9dc9b7,_0x40a6fb);PluginEvents['on'](_0x9dc9b7,_0x575d01);}}; \ No newline at end of file +var _0xe68c=['./plugin.events','save','remove','update','removeListener','register','length'];(function(_0x331447,_0x7c0eea){var _0x397521=function(_0x4fd489){while(--_0x4fd489){_0x331447['push'](_0x331447['shift']());}};_0x397521(++_0x7c0eea);}(_0xe68c,0x118));var _0xce68=function(_0x10a7b2,_0x37587c){_0x10a7b2=_0x10a7b2-0x0;var _0x5cf00e=_0xe68c[_0x10a7b2];return _0x5cf00e;};'use strict';var PluginEvents=require(_0xce68('0x0'));var events=[_0xce68('0x1'),_0xce68('0x2'),_0xce68('0x3')];function createListener(_0x2d4b6b,_0x23862d){return function(_0x1c10be){_0x23862d['emit'](_0x2d4b6b,_0x1c10be);};}function removeListener(_0x53e07f,_0x3453d7){return function(){PluginEvents[_0xce68('0x4')](_0x53e07f,_0x3453d7);};}exports[_0xce68('0x5')]=function(_0x5a0743){for(var _0x2e37ae=0x0,_0x453a19=events[_0xce68('0x6')];_0x2e37ae<_0x453a19;_0x2e37ae++){var _0x465e83=events[_0x2e37ae];var _0x4aaec6=createListener('plugin:'+_0x465e83,_0x5a0743);PluginEvents['on'](_0x465e83,_0x4aaec6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 07160f6..ac2c711 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(_0x7ea8c,_0x3e0bba){var _0x57117b=function(_0x3a4b53){while(--_0x3a4b53){_0x7ea8c['push'](_0x7ea8c['shift']());}};_0x57117b(++_0x3e0bba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x217e8d,_0x6c599f){var _0x44d7e6=function(_0x351cee){while(--_0x351cee){_0x217e8d['push'](_0x217e8d['shift']());}};_0x44d7e6(++_0x6c599f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 0471828..f7823bc 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 _0x55e0=['hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','name','status','send','info','index','then','reject','express','motion2','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x55e0,0xdc));var _0x055e=function(_0xe886fa,_0x5a2f45){_0xe886fa=_0xe886fa-0x0;var _0xf40f=_0x55e0[_0xe886fa];return _0xf40f;};'use strict';var _=require(_0x055e('0x0'));var pm2=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var path=require('path');var exec=require('child_process')[_0x055e('0x4')];var BPromise=require(_0x055e('0x5'));function handleEntityNotFound(_0x33cd7b,_0x2773e4){return function(_0x157473){if(!_0x157473){_0x33cd7b[_0x055e('0x6')](0x194);;}return _0x157473;};}function respondWithResult(_0x490ee1,_0x5239f6){_0x5239f6=_0x5239f6||0xc8;return function(_0x4384ff){if(_0x4384ff){return _0x490ee1['status'](_0x5239f6)[_0x055e('0x7')](_0x4384ff);}return null;};}function handleError(_0x3c4cf,_0x376618){_0x376618=_0x376618||0x1f4;return function(_0x230c32){logger[_0x055e('0x8')](_0x230c32['stack']);if(_0x230c32[_0x055e('0x9')]){delete _0x230c32[_0x055e('0x9')];}_0x3c4cf[_0x055e('0xa')](_0x376618)[_0x055e('0xb')](_0x230c32);};}function execChildProcess(){return new BPromise(function(_0x238068,_0x5237d9){exec('npm\x20install',function(_0x187cce,_0x51c524,_0x3c44b2){logger[_0x055e('0xc')](_0x51c524);logger[_0x055e('0xc')](_0x3c44b2);if(_0x187cce){logger[_0x055e('0x8')](_0x187cce);return _0x5237d9(_0x187cce);}return _0x238068(_0x51c524);});});}exports[_0x055e('0xd')]=function(_0x31c649,_0x236a2b){return pm2['list']()[_0x055e('0xe')](function(_0xb80d83){if(_0xb80d83){var _0x3cfd14=_[_0x055e('0xf')](_0xb80d83,function(_0x222817){return _0x222817['name']===_0x055e('0x10')||_0x222817[_0x055e('0x9')]===_0x055e('0x11');});return{'rows':_0x3cfd14,'count':_0x3cfd14['length']};}return null;})[_0x055e('0xe')](respondWithResult(_0x236a2b,null))[_0x055e('0x12')](handleError(_0x236a2b,null));};exports[_0x055e('0x13')]=function(_0x2bad86,_0x2cc84e){return pm2['describe'](_0x2bad86[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x2cc84e,null))[_0x055e('0xe')](handleEntityNotFound(_0x2cc84e,null))[_0x055e('0x12')](handleError(_0x2cc84e,null));};exports['create']=function(_0x4004ce,_0x3cdd68){if(_0x4004ce['body'][_0x055e('0x9')]&&_0x4004ce[_0x055e('0x15')][_0x055e('0x16')]){var _0x124d86=path[_0x055e('0x17')](__dirname,_0x055e('0x18'),_0x4004ce['body'][_0x055e('0x16')]);var _0x2f0346=process[_0x055e('0x19')]();process['chdir'](path[_0x055e('0x1a')](_0x124d86));return execChildProcess()[_0x055e('0xe')](function(_0x32c64e){process[_0x055e('0x1b')](_0x2f0346);return pm2['start']({'name':_0x4004ce[_0x055e('0x15')]['name'],'script':_0x124d86});})[_0x055e('0xe')](function(_0x42a6aa){pm2[_0x055e('0x1c')]();return _0x42a6aa[0x0];})[_0x055e('0xe')](respondWithResult(_0x3cdd68,0xc9))[_0x055e('0x12')](handleError(_0x3cdd68,null));}else{return _0x3cdd68[_0x055e('0xa')](0x1f4)['send']({'message':_0x055e('0x1d')});}};exports[_0x055e('0x1e')]=function(_0x2a82f8,_0x4b5891){if(_0x2a82f8[_0x055e('0x15')]['id']){delete _0x2a82f8[_0x055e('0x15')]['id'];}var _0x42f2df={'online':_0x055e('0x1f'),'stopped':'stop'};if(_0x42f2df[_0x055e('0x20')](_0x2a82f8['body'][_0x055e('0xa')])){return pm2[_0x42f2df[_0x2a82f8[_0x055e('0x15')][_0x055e('0xa')]]](_0x2a82f8[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x4b5891,0xc8))['catch'](handleError(_0x4b5891,null));}else{return _0x4b5891[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':_0x055e('0x21')});}};exports[_0x055e('0x22')]=function(_0x36abb2,_0x225c88){if(_0x36abb2[_0x055e('0x15')]['id']){delete _0x36abb2[_0x055e('0x15')]['id'];}if(_0x36abb2['params']['id']){return pm2[_0x055e('0x23')](_0x36abb2[_0x055e('0x14')]['id'])['then'](function(_0xd9298d){pm2[_0x055e('0x1c')]();return _0xd9298d[0x0];})[_0x055e('0xe')](respondWithResult(_0x225c88,null))[_0x055e('0x12')](handleError(_0x225c88,null));}else{return _0x225c88[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x55e0=['hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','name','status','send','info','index','then','reject','express','motion2','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x55e0,0xdc));var _0x055e=function(_0x566715,_0x1d45c3){_0x566715=_0x566715-0x0;var _0xf089e7=_0x55e0[_0x566715];return _0xf089e7;};'use strict';var _=require(_0x055e('0x0'));var pm2=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var path=require('path');var exec=require('child_process')[_0x055e('0x4')];var BPromise=require(_0x055e('0x5'));function handleEntityNotFound(_0x33cd7b,_0x2773e4){return function(_0x157473){if(!_0x157473){_0x33cd7b[_0x055e('0x6')](0x194);;}return _0x157473;};}function respondWithResult(_0x490ee1,_0x5239f6){_0x5239f6=_0x5239f6||0xc8;return function(_0x4384ff){if(_0x4384ff){return _0x490ee1['status'](_0x5239f6)[_0x055e('0x7')](_0x4384ff);}return null;};}function handleError(_0x3c4cf,_0x376618){_0x376618=_0x376618||0x1f4;return function(_0x230c32){logger[_0x055e('0x8')](_0x230c32['stack']);if(_0x230c32[_0x055e('0x9')]){delete _0x230c32[_0x055e('0x9')];}_0x3c4cf[_0x055e('0xa')](_0x376618)[_0x055e('0xb')](_0x230c32);};}function execChildProcess(){return new BPromise(function(_0x238068,_0x5237d9){exec('npm\x20install',function(_0x187cce,_0x51c524,_0x3c44b2){logger[_0x055e('0xc')](_0x51c524);logger[_0x055e('0xc')](_0x3c44b2);if(_0x187cce){logger[_0x055e('0x8')](_0x187cce);return _0x5237d9(_0x187cce);}return _0x238068(_0x51c524);});});}exports[_0x055e('0xd')]=function(_0x31c649,_0x236a2b){return pm2['list']()[_0x055e('0xe')](function(_0xb80d83){if(_0xb80d83){var _0x3cfd14=_[_0x055e('0xf')](_0xb80d83,function(_0x222817){return _0x222817['name']===_0x055e('0x10')||_0x222817[_0x055e('0x9')]===_0x055e('0x11');});return{'rows':_0x3cfd14,'count':_0x3cfd14['length']};}return null;})[_0x055e('0xe')](respondWithResult(_0x236a2b,null))[_0x055e('0x12')](handleError(_0x236a2b,null));};exports[_0x055e('0x13')]=function(_0x2bad86,_0x2cc84e){return pm2['describe'](_0x2bad86[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x2cc84e,null))[_0x055e('0xe')](handleEntityNotFound(_0x2cc84e,null))[_0x055e('0x12')](handleError(_0x2cc84e,null));};exports['create']=function(_0x4004ce,_0x3cdd68){if(_0x4004ce['body'][_0x055e('0x9')]&&_0x4004ce[_0x055e('0x15')][_0x055e('0x16')]){var _0x124d86=path[_0x055e('0x17')](__dirname,_0x055e('0x18'),_0x4004ce['body'][_0x055e('0x16')]);var _0x2f0346=process[_0x055e('0x19')]();process['chdir'](path[_0x055e('0x1a')](_0x124d86));return execChildProcess()[_0x055e('0xe')](function(_0x32c64e){process[_0x055e('0x1b')](_0x2f0346);return pm2['start']({'name':_0x4004ce[_0x055e('0x15')]['name'],'script':_0x124d86});})[_0x055e('0xe')](function(_0x42a6aa){pm2[_0x055e('0x1c')]();return _0x42a6aa[0x0];})[_0x055e('0xe')](respondWithResult(_0x3cdd68,0xc9))[_0x055e('0x12')](handleError(_0x3cdd68,null));}else{return _0x3cdd68[_0x055e('0xa')](0x1f4)['send']({'message':_0x055e('0x1d')});}};exports[_0x055e('0x1e')]=function(_0x2a82f8,_0x4b5891){if(_0x2a82f8[_0x055e('0x15')]['id']){delete _0x2a82f8[_0x055e('0x15')]['id'];}var _0x42f2df={'online':_0x055e('0x1f'),'stopped':'stop'};if(_0x42f2df[_0x055e('0x20')](_0x2a82f8['body'][_0x055e('0xa')])){return pm2[_0x42f2df[_0x2a82f8[_0x055e('0x15')][_0x055e('0xa')]]](_0x2a82f8[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x4b5891,0xc8))['catch'](handleError(_0x4b5891,null));}else{return _0x4b5891[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':_0x055e('0x21')});}};exports[_0x055e('0x22')]=function(_0x36abb2,_0x225c88){if(_0x36abb2[_0x055e('0x15')]['id']){delete _0x36abb2[_0x055e('0x15')]['id'];}if(_0x36abb2['params']['id']){return pm2[_0x055e('0x23')](_0x36abb2[_0x055e('0x14')]['id'])['then'](function(_0xd9298d){pm2[_0x055e('0x1c')]();return _0xd9298d[0x0];})[_0x055e('0xe')](respondWithResult(_0x225c88,null))[_0x055e('0x12')](handleError(_0x225c88,null));}else{return _0x225c88[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6085f9b..faca8e3 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 _0xf69a=['getAgents','get','getQueues','Router','./realtime.controller','/agents','isAuthenticated'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf69a,0x106));var _0xaf69=function(_0x18b0a1,_0x535aac){_0x18b0a1=_0x18b0a1-0x0;var _0x55005a=_0xf69a[_0x18b0a1];return _0x55005a;};'use strict';var express=require('express');var router=express[_0xaf69('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xaf69('0x1'));router['get'](_0xaf69('0x2'),auth[_0xaf69('0x3')](),controller[_0xaf69('0x4')]);router[_0xaf69('0x5')]('/queues',auth[_0xaf69('0x3')](),controller[_0xaf69('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4770=['get','/agents','isAuthenticated','getAgents','/queues','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4770,0xe6));var _0x0477=function(_0x3e1362,_0x44d880){_0x3e1362=_0x3e1362-0x0;var _0xad09b8=_0x4770[_0x3e1362];return _0xad09b8;};'use strict';var express=require(_0x0477('0x0'));var router=express[_0x0477('0x1')]();var auth=require(_0x0477('0x2'));var controller=require(_0x0477('0x3'));router[_0x0477('0x4')](_0x0477('0x5'),auth[_0x0477('0x6')](),controller[_0x0477('0x7')]);router[_0x0477('0x4')](_0x0477('0x8'),auth[_0x0477('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 3384c69..854bfcc 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 _0x56d5=['getQueues','resolve','format','Channel\x20parameter\x20%s\x20is\x20invalid','Queue','rawAttributes','key','name','voice','dialMethod','join','QueueCampaigns','startCase','Queues','filter','UserProfile','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','limit','undefined','offset','count','json','query','globalQueueFilter','globalStatusFilter','pause','*pause','then','channel','isValidChannel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','fieldName','type','role','agent','getOptions','raw','length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch'];(function(_0x51f42c,_0x35889f){var _0x13ef7d=function(_0x368796){while(--_0x368796){_0x51f42c['push'](_0x51f42c['shift']());}};_0x13ef7d(++_0x35889f);}(_0x56d5,0xbe));var _0x556d=function(_0x14b688,_0x54013a){_0x14b688=_0x14b688-0x0;var _0x57e00b=_0x56d5[_0x14b688];return _0x57e00b;};'use strict';var _=require(_0x556d('0x0'));var util=require('util');var rta=require(_0x556d('0x1'));var rtq=require(_0x556d('0x2'));var qs=require(_0x556d('0x3'));var utils=require(_0x556d('0x4'));var db=require(_0x556d('0x5'))['db'];var APIBadRequestError=require('../../errors/api')[_0x556d('0x6')];var APIHandleError=require(_0x556d('0x7'))['handleError'];function respondWithFilteredResult(_0x538374,_0x58d6a7){return function(_0x2b7baf){if(_0x2b7baf){var _0x100178=typeof _0x58d6a7['offset']==='undefined'&&typeof _0x58d6a7[_0x556d('0x8')]===_0x556d('0x9');var _0x5bc37e=_0x2b7baf['count'];var _0x30b08f=_0x100178?0x0:_0x58d6a7[_0x556d('0xa')];var _0x305981=_0x100178?_0x2b7baf[_0x556d('0xb')]:_0x58d6a7[_0x556d('0xa')]+_0x58d6a7[_0x556d('0x8')];var _0x59c594;if(_0x305981>=_0x5bc37e){_0x305981=_0x5bc37e;_0x59c594=0xc8;}else{_0x59c594=0xce;}_0x538374['status'](_0x59c594);return _0x538374['set']('Content-Range',_0x30b08f+'-'+_0x305981+'/'+_0x5bc37e)[_0x556d('0xc')](_0x2b7baf);}return null;};}exports['getAgents']=function(_0x1a12dc,_0x1f9c37){var _0x2be02d={'count':0x0,'rows':[]};var _0x5e33c9={};var _0xed7e06;var _0x2ccf17=utils['getChannels']();var _0x17b273;var _0x2efbb9;var _0x22aaed=_0x1a12dc[_0x556d('0xd')][_0x556d('0xe')];var _0x224e91=_0x1a12dc[_0x556d('0xd')][_0x556d('0xf')];var _0x337e5a=_0x1a12dc[_0x556d('0xd')]['pauseTypeFilter'];var _0x999c40=_0x224e91===_0x556d('0x10')||_0x224e91===_0x556d('0x11')?!![]:![];var _0x37936f=[];var _0x5a8762;var _0x3dd2c9;Promise['resolve']()[_0x556d('0x12')](function(){if(_0x1a12dc[_0x556d('0xd')][_0x556d('0x13')]){if(!utils[_0x556d('0x14')](_0x1a12dc[_0x556d('0xd')][_0x556d('0x13')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1a12dc['query'][_0x556d('0x13')]));}_0xed7e06=_0x1a12dc[_0x556d('0xd')][_0x556d('0x13')][_0x556d('0x15')]();}if(!_0x1a12dc[_0x556d('0xd')][_0x556d('0x16')]||!_0x1a12dc[_0x556d('0xd')][_0x556d('0x16')][_0x556d('0x17')](_0x556d('0x18'))){_0x1a12dc[_0x556d('0xd')][_0x556d('0x16')]=rta[_0x556d('0x19')](_0x1a12dc['query'][_0x556d('0x16')]);return;}var _0x5927a4=rta[_0x556d('0x1a')](_0x1a12dc[_0x556d('0xd')][_0x556d('0x16')]);_0x1a12dc[_0x556d('0xd')]['sort']=_0x5927a4[_0x556d('0x1b')]['join'](',');_0x5a8762=_0x5927a4[_0x556d('0x1c')];})[_0x556d('0x12')](function(){if(!_0x22aaed){return[];}return rta[_0x556d('0x1d')](_0x22aaed,_0xed7e06);})[_0x556d('0x12')](function(_0x5cddb0){_0x37936f=_0x5cddb0;return rta['getRealtimeAgents']();})[_0x556d('0x12')](function(_0x34c7f9){_0x2efbb9=_0x34c7f9['rows'];if((!_0x224e91||_0x999c40)&&!_0x5a8762){return _0x37936f;}if(_0x5a8762&&!_0x224e91){return rta[_0x556d('0x1e')](_0x2efbb9,_0x37936f,_0x5a8762);}else{return rta[_0x556d('0x1f')](_0x2efbb9,_0x37936f,_0x224e91);}})[_0x556d('0x12')](function(_0x192257){_0x37936f=_0x192257;var _0x5895b4=![];if(_0x37936f['length']===0x0){if(_0x22aaed||_0x224e91){_0x5895b4=!![];}if(_0x999c40){_0x5895b4=![];}}if(_0x5895b4){return _0x2be02d;}var _0x19894d=_[_0x556d('0x20')](db[_0x556d('0x21')]['rawAttributes'],function(_0x3a93d1){return{'name':_0x3a93d1[_0x556d('0x22')],'type':_0x3a93d1[_0x556d('0x23')]['key']};});_0x1a12dc[_0x556d('0xd')][_0x556d('0x24')]=_0x556d('0x25');_0x5e33c9=qs[_0x556d('0x26')](_0x19894d,_0x1a12dc);_0x5e33c9[_0x556d('0x27')]=!![];var _0x3f099f=[];if(_0x37936f[_0x556d('0x28')]>0x0){_0x3f099f[_0x556d('0x29')]({'id':{'$in':_0x37936f}});if(_0x5a8762&&!_0x224e91){_0x3dd2c9=[db[_0x556d('0x2a')][_0x556d('0x2b')](_0x556d('0x2c')+_0x37936f+')')];_0x5e33c9[_0x556d('0x1c')]=_0x3dd2c9;}}if(_0x999c40){_0x2ccf17[_0x556d('0x2d')](function(_0x5f240b){var _0x1f3e8d=!![];if(_0x224e91===_0x556d('0x11')&&_0xed7e06!==_0x5f240b){_0x1f3e8d=![];}_0x3f099f[_0x556d('0x29')]({[_0x5f240b+_0x556d('0x2e')]:_0x1f3e8d});});if(_0x337e5a){_0x3f099f[_0x556d('0x29')]({'pauseType':_0x337e5a});}}else if(_0x224e91){_0x2ccf17['forEach'](function(_0x29e94a){_0x3f099f[_0x556d('0x29')]({[_0x29e94a+_0x556d('0x2e')]:![]});});}_0x5e33c9[_0x556d('0x2f')]=_[_0x556d('0x30')](_0x5e33c9[_0x556d('0x2f')],{'$and':_0x3f099f});if(_0x1a12dc['user'][_0x556d('0x24')]==='user'){var _0x403e9c={'params':{'id':_0x1a12dc[_0x556d('0x31')][_0x556d('0x32')]},'query':{'section':_0x556d('0x33'),'role':'agent','raw':!![],'ids':_0x37936f,'customSorting':_0x3dd2c9}};if(_0x1a12dc[_0x556d('0xd')][_0x556d('0x34')]){_0x403e9c[_0x556d('0xd')][_0x556d('0x34')]=!![];}if(_0x999c40){_0x403e9c['query'][_0x556d('0x35')]=_0x3f099f;}_0x403e9c[_0x556d('0xd')]=Object[_0x556d('0x36')](_0x403e9c['query'],_0x1a12dc[_0x556d('0xd')]);return db['UserProfile'][_0x556d('0x37')](_0x403e9c);}return db[_0x556d('0x21')][_0x556d('0x38')](_0x5e33c9);})[_0x556d('0x12')](function(_0x33bdd9){_0x2be02d[_0x556d('0xb')]=_0x33bdd9[_0x556d('0xb')];_0x17b273=_0x33bdd9[_0x556d('0x39')];return _0x17b273[_0x556d('0x20')](function(_0x285e39){var _0x3547f5=_[_0x556d('0x3a')](_0x2efbb9,['id',_0x285e39['id']]);if(_0x3547f5){var _0x3800b6=rta[_0x556d('0x3b')](_0x3547f5);_[_0x556d('0x30')](_0x285e39,_0x3800b6);}_0x285e39[_0x556d('0x18')]=rta[_0x556d('0x3c')](_0x285e39);if(_0x285e39[_0x556d('0x18')][_0x556d('0x17')]('pause')){_0x2ccf17[_0x556d('0x2d')](function(_0x338264){if(_0x285e39[_0x338264+_0x556d('0x2e')]){if(_0x338264==='voice'){if(_0x285e39['voiceStatus']!==_0x556d('0x3d')){_0x285e39[_0x556d('0x3e')]='pause';}}else{_0x285e39[_0x338264+_0x556d('0x3f')]='pause';}}});}return _0x285e39;});})[_0x556d('0x12')](function(_0x30d59c){if(!_0x5a8762||_0x3dd2c9){return _0x30d59c;}return rta[_0x556d('0x40')](_0x30d59c,_0x5a8762);})[_0x556d('0x12')](function(_0x3213e0){var _0x2ded53=rta[_0x556d('0x41')]();_0x2be02d[_0x556d('0x39')]=_0x3213e0[_0x556d('0x20')](function(_0x4e888d){return _[_0x556d('0x42')](_0x4e888d,_0x2ded53);});return _0x2be02d;})[_0x556d('0x12')](respondWithFilteredResult(_0x1f9c37,_0x5e33c9))[_0x556d('0x43')](APIHandleError(_0x1f9c37));};exports[_0x556d('0x44')]=function(_0x20ea45,_0x17e624){var _0xacef7b={'count':0x0,'rows':[]};var _0x42a416={};var _0x30fdfa;var _0x1a5f96;var _0x5d2911;Promise[_0x556d('0x45')]()[_0x556d('0x12')](function(){if(_0x20ea45[_0x556d('0xd')]['channel']){if(!utils['isValidChannel'](_0x20ea45['query'][_0x556d('0x13')])){throw new APIBadRequestError(util[_0x556d('0x46')](_0x556d('0x47'),_0x20ea45['query'][_0x556d('0x13')]));}_0x30fdfa=_0x20ea45[_0x556d('0xd')][_0x556d('0x13')]['toLowerCase']();}var _0x236c0b=_['startCase'](_0x30fdfa)+_0x556d('0x48');var _0x1b4299=_['map'](db[_0x236c0b][_0x556d('0x49')],function(_0x4cdde7){return{'name':_0x4cdde7['fieldName'],'type':_0x4cdde7[_0x556d('0x23')][_0x556d('0x4a')]};});if(!_0x20ea45['query'][_0x556d('0x1b')]){var _0x1f0cce=['id',_0x556d('0x4b')];if(_0x30fdfa===_0x556d('0x4c')){_0x1f0cce[_0x556d('0x29')](_0x556d('0x23'));if(_0x20ea45[_0x556d('0xd')][_0x556d('0x23')]==='outbound'){_0x1f0cce['push'](['dialActive',_0x556d('0x4d')]);}}_0x20ea45[_0x556d('0xd')][_0x556d('0x1b')]=_0x1f0cce[_0x556d('0x4e')](',');}_0x42a416=qs[_0x556d('0x26')](_0x1b4299,_0x20ea45);if(_0x20ea45[_0x556d('0x31')]['role']==='user'){var _0x4a1fb0={'params':{'id':_0x20ea45[_0x556d('0x31')]['userProfileId']},'query':{'section':_0x30fdfa==='voice'&&_0x20ea45[_0x556d('0xd')][_0x556d('0x23')]==='outbound'?_0x556d('0x4f'):_[_0x556d('0x50')](_0x30fdfa)+_0x556d('0x51'),'type':_0x20ea45['query'][_0x556d('0x23')],'nolimit':!![],'sort':_0x556d('0x4b'),'filter':_0x20ea45[_0x556d('0xd')][_0x556d('0x52')]}};_0x4a1fb0[_0x556d('0xd')]=Object[_0x556d('0x36')](_0x4a1fb0[_0x556d('0xd')],_0x20ea45[_0x556d('0xd')]);delete _0x4a1fb0[_0x556d('0xd')]['id'];return db[_0x556d('0x53')][_0x556d('0x37')](_0x4a1fb0);}return db[_0x236c0b][_0x556d('0x38')](_0x42a416);})[_0x556d('0x12')](function(_0x12dc11){_0xacef7b['count']=_0x12dc11['count'];_0x1a5f96=_0x12dc11[_0x556d('0x39')];return rtq[_0x556d('0x54')](_0x20ea45,_0x30fdfa);})[_0x556d('0x12')](function(_0x15a648){_0x5d2911=_0x15a648[_0x556d('0x39')];return rtq[_0x556d('0x55')](_0x1a5f96,_0x5d2911,_0x30fdfa,_0x20ea45[_0x556d('0xd')][_0x556d('0x23')]);})[_0x556d('0x12')](function(_0x3f8127){_0xacef7b[_0x556d('0x39')]=_0x3f8127;return _0xacef7b;})[_0x556d('0x12')](respondWithFilteredResult(_0x17e624,_0x42a416))[_0x556d('0x43')](APIHandleError(_0x17e624));}; \ No newline at end of file +var _0xea82=['userProfileId','Agents','online','extraQueryConditions','omit','UserProfile','getResources','map','find','filterAgentAttributes','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','fields','name','outbound','dialActive','dialMethod','join','getOptions','QueueCampaigns','startCase','assign','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','undefined','count','offset','status','set','Content-Range','json','getAgents','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','order','then','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','raw','push','sequelize','FIELD(id,','forEach','Pause','where','merge','user'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xea82,0xc4));var _0x2ea8=function(_0x2980d0,_0x5265db){_0x2980d0=_0x2980d0-0x0;var _0x16da7d=_0xea82[_0x2980d0];return _0x16da7d;};'use strict';var _=require(_0x2ea8('0x0'));var util=require(_0x2ea8('0x1'));var rta=require(_0x2ea8('0x2'));var rtq=require(_0x2ea8('0x3'));var qs=require(_0x2ea8('0x4'));var utils=require(_0x2ea8('0x5'));var db=require(_0x2ea8('0x6'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0x2ea8('0x7'))[_0x2ea8('0x8')];function respondWithFilteredResult(_0x30de81,_0x94a80){return function(_0x3c8f9f){if(_0x3c8f9f){var _0x5e1f4c=typeof _0x94a80['offset']===_0x2ea8('0x9')&&typeof _0x94a80['limit']===_0x2ea8('0x9');var _0x2117ed=_0x3c8f9f[_0x2ea8('0xa')];var _0x5d19f0=_0x5e1f4c?0x0:_0x94a80['offset'];var _0x239dc2=_0x5e1f4c?_0x3c8f9f[_0x2ea8('0xa')]:_0x94a80[_0x2ea8('0xb')]+_0x94a80['limit'];var _0x1c843e;if(_0x239dc2>=_0x2117ed){_0x239dc2=_0x2117ed;_0x1c843e=0xc8;}else{_0x1c843e=0xce;}_0x30de81[_0x2ea8('0xc')](_0x1c843e);return _0x30de81[_0x2ea8('0xd')](_0x2ea8('0xe'),_0x5d19f0+'-'+_0x239dc2+'/'+_0x2117ed)[_0x2ea8('0xf')](_0x3c8f9f);}return null;};}exports[_0x2ea8('0x10')]=function(_0x559a0d,_0x3af1c9){var _0xc93c9={'count':0x0,'rows':[]};var _0x16af22={};var _0x14676b;var _0x1144c1=utils['getChannels']();var _0x2401e3;var _0xd3b8ac;var _0x1e49af=_0x559a0d[_0x2ea8('0x11')]['globalQueueFilter'];var _0x2f6049=_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x12')];var _0x3324da=_0x559a0d['query'][_0x2ea8('0x13')];var _0x330532=_0x2f6049===_0x2ea8('0x14')||_0x2f6049===_0x2ea8('0x15')?!![]:![];var _0x54ca77=[];var _0x4c04aa;var _0x26dbe9;Promise[_0x2ea8('0x16')]()['then'](function(){if(_0x559a0d[_0x2ea8('0x11')]['channel']){if(!utils['isValidChannel'](_0x559a0d['query'][_0x2ea8('0x17')])){throw new APIBadRequestError(util[_0x2ea8('0x18')](_0x2ea8('0x19'),_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x17')]));}_0x14676b=_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x17')][_0x2ea8('0x1a')]();}if(!_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x1b')]||!_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x1b')][_0x2ea8('0x1c')](_0x2ea8('0x1d'))){_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x1b')]=rta[_0x2ea8('0x1e')](_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x1b')]);return;}var _0x5cdf6f=rta[_0x2ea8('0x1f')](_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x1b')]);_0x559a0d[_0x2ea8('0x11')]['sort']=_0x5cdf6f['fields']['join'](',');_0x4c04aa=_0x5cdf6f[_0x2ea8('0x20')];})[_0x2ea8('0x21')](function(){if(!_0x1e49af){return[];}return rta['getAgentIdsByQueues'](_0x1e49af,_0x14676b);})[_0x2ea8('0x21')](function(_0x448e2a){_0x54ca77=_0x448e2a;return rta['getRealtimeAgents']();})['then'](function(_0x3f8ad6){_0xd3b8ac=_0x3f8ad6[_0x2ea8('0x22')];if((!_0x2f6049||_0x330532)&&!_0x4c04aa){return _0x54ca77;}if(_0x4c04aa&&!_0x2f6049){return rta[_0x2ea8('0x23')](_0xd3b8ac,_0x54ca77,_0x4c04aa);}else{return rta[_0x2ea8('0x24')](_0xd3b8ac,_0x54ca77,_0x2f6049);}})[_0x2ea8('0x21')](function(_0x28eba4){_0x54ca77=_0x28eba4;var _0x40c66a=![];if(_0x54ca77[_0x2ea8('0x25')]===0x0){if(_0x1e49af||_0x2f6049){_0x40c66a=!![];}if(_0x330532){_0x40c66a=![];}}if(_0x40c66a){return _0xc93c9;}var _0x14d7fe=_['map'](db[_0x2ea8('0x26')][_0x2ea8('0x27')],function(_0x4c14bf){return{'name':_0x4c14bf[_0x2ea8('0x28')],'type':_0x4c14bf[_0x2ea8('0x29')][_0x2ea8('0x2a')]};});_0x559a0d[_0x2ea8('0x11')][_0x2ea8('0x2b')]='agent';_0x16af22=qs['getOptions'](_0x14d7fe,_0x559a0d);_0x16af22[_0x2ea8('0x2c')]=!![];var _0x5cb314=[];if(_0x54ca77[_0x2ea8('0x25')]>0x0){_0x5cb314[_0x2ea8('0x2d')]({'id':{'$in':_0x54ca77}});if(_0x4c04aa&&!_0x2f6049){_0x26dbe9=[db[_0x2ea8('0x2e')]['literal'](_0x2ea8('0x2f')+_0x54ca77+')')];_0x16af22[_0x2ea8('0x20')]=_0x26dbe9;}}if(_0x330532){_0x1144c1[_0x2ea8('0x30')](function(_0x2af0e8){var _0x49b761=!![];if(_0x2f6049===_0x2ea8('0x15')&&_0x14676b!==_0x2af0e8){_0x49b761=![];}_0x5cb314[_0x2ea8('0x2d')]({[_0x2af0e8+_0x2ea8('0x31')]:_0x49b761});});if(_0x3324da){_0x5cb314['push']({'pauseType':_0x3324da});}}else if(_0x2f6049){_0x1144c1['forEach'](function(_0x27bc89){_0x5cb314[_0x2ea8('0x2d')]({[_0x27bc89+_0x2ea8('0x31')]:![]});});}_0x16af22[_0x2ea8('0x32')]=_[_0x2ea8('0x33')](_0x16af22[_0x2ea8('0x32')],{'$and':_0x5cb314});if(_0x559a0d[_0x2ea8('0x34')][_0x2ea8('0x2b')]===_0x2ea8('0x34')){var _0x141d94={'params':{'id':_0x559a0d[_0x2ea8('0x34')][_0x2ea8('0x35')]},'query':{'section':_0x2ea8('0x36'),'role':'agent','raw':!![],'ids':_0x54ca77,'customSorting':_0x26dbe9}};if(_0x559a0d['query'][_0x2ea8('0x37')]){_0x141d94[_0x2ea8('0x11')][_0x2ea8('0x37')]=!![];}if(_0x330532){_0x141d94[_0x2ea8('0x11')][_0x2ea8('0x38')]=_0x5cb314;}_0x141d94[_0x2ea8('0x11')]=Object['assign'](_0x141d94['query'],_[_0x2ea8('0x39')](_0x559a0d[_0x2ea8('0x11')],'id'));return db[_0x2ea8('0x3a')][_0x2ea8('0x3b')](_0x141d94);}return db['User']['findAndCountAll'](_0x16af22);})[_0x2ea8('0x21')](function(_0x189fc4){_0xc93c9[_0x2ea8('0xa')]=_0x189fc4[_0x2ea8('0xa')];_0x2401e3=_0x189fc4[_0x2ea8('0x22')];return _0x2401e3[_0x2ea8('0x3c')](function(_0xe21b9d){var _0x55391f=_[_0x2ea8('0x3d')](_0xd3b8ac,['id',_0xe21b9d['id']]);if(_0x55391f){var _0x4d5fe2=rta[_0x2ea8('0x3e')](_0x55391f);_[_0x2ea8('0x33')](_0xe21b9d,_0x4d5fe2);}_0xe21b9d[_0x2ea8('0x1d')]=rta['getAgentStatus'](_0xe21b9d);if(_0xe21b9d[_0x2ea8('0x1d')][_0x2ea8('0x1c')](_0x2ea8('0x14'))){_0x1144c1['forEach'](function(_0x55423d){if(_0xe21b9d[_0x55423d+_0x2ea8('0x31')]){if(_0x55423d===_0x2ea8('0x3f')){if(_0xe21b9d[_0x2ea8('0x40')]!==_0x2ea8('0x41')){_0xe21b9d[_0x2ea8('0x40')]=_0x2ea8('0x14');}}else{_0xe21b9d[_0x55423d+'Status']='pause';}}});}return _0xe21b9d;});})[_0x2ea8('0x21')](function(_0x2f973e){if(!_0x4c04aa||_0x26dbe9){return _0x2f973e;}return rta[_0x2ea8('0x42')](_0x2f973e,_0x4c04aa);})['then'](function(_0x20f5bc){var _0x42fdfe=rta[_0x2ea8('0x43')]();_0xc93c9['rows']=_0x20f5bc['map'](function(_0x271c0b){return _[_0x2ea8('0x44')](_0x271c0b,_0x42fdfe);});return _0xc93c9;})[_0x2ea8('0x21')](respondWithFilteredResult(_0x3af1c9,_0x16af22))[_0x2ea8('0x45')](APIHandleError(_0x3af1c9));};exports['getQueues']=function(_0x35201e,_0x3d20b2){var _0x1a52d2={'count':0x0,'rows':[]};var _0x5457c9={};var _0x22d08a;var _0x545842;var _0x58f81c;Promise['resolve']()[_0x2ea8('0x21')](function(){if(_0x35201e[_0x2ea8('0x11')]['channel']){if(!utils['isValidChannel'](_0x35201e[_0x2ea8('0x11')][_0x2ea8('0x17')])){throw new APIBadRequestError(util['format'](_0x2ea8('0x19'),_0x35201e[_0x2ea8('0x11')]['channel']));}_0x22d08a=_0x35201e['query'][_0x2ea8('0x17')][_0x2ea8('0x1a')]();}var _0xcd760=_['startCase'](_0x22d08a)+'Queue';var _0x1d949c=_[_0x2ea8('0x3c')](db[_0xcd760][_0x2ea8('0x27')],function(_0x644b30){return{'name':_0x644b30['fieldName'],'type':_0x644b30[_0x2ea8('0x29')]['key']};});if(!_0x35201e['query'][_0x2ea8('0x46')]){var _0xde8c6f=['id',_0x2ea8('0x47')];if(_0x22d08a===_0x2ea8('0x3f')){_0xde8c6f[_0x2ea8('0x2d')](_0x2ea8('0x29'));if(_0x35201e[_0x2ea8('0x11')][_0x2ea8('0x29')]===_0x2ea8('0x48')){_0xde8c6f[_0x2ea8('0x2d')]([_0x2ea8('0x49'),_0x2ea8('0x4a')]);}}_0x35201e[_0x2ea8('0x11')][_0x2ea8('0x46')]=_0xde8c6f[_0x2ea8('0x4b')](',');}_0x5457c9=qs[_0x2ea8('0x4c')](_0x1d949c,_0x35201e);if(_0x35201e[_0x2ea8('0x34')][_0x2ea8('0x2b')]===_0x2ea8('0x34')){var _0x2100a7={'params':{'id':_0x35201e['user'][_0x2ea8('0x35')]},'query':{'section':_0x22d08a===_0x2ea8('0x3f')&&_0x35201e['query']['type']==='outbound'?_0x2ea8('0x4d'):_[_0x2ea8('0x4e')](_0x22d08a)+'Queues','type':_0x35201e[_0x2ea8('0x11')]['type'],'nolimit':!![],'sort':_0x2ea8('0x47'),'filter':_0x35201e[_0x2ea8('0x11')]['filter']}};_0x2100a7[_0x2ea8('0x11')]=Object[_0x2ea8('0x4f')](_0x2100a7[_0x2ea8('0x11')],_0x35201e[_0x2ea8('0x11')]);delete _0x2100a7[_0x2ea8('0x11')]['id'];return db['UserProfile'][_0x2ea8('0x3b')](_0x2100a7);}return db[_0xcd760][_0x2ea8('0x50')](_0x5457c9);})[_0x2ea8('0x21')](function(_0x2d0ffe){_0x1a52d2['count']=_0x2d0ffe[_0x2ea8('0xa')];_0x545842=_0x2d0ffe['rows'];return rtq[_0x2ea8('0x51')](_0x35201e,_0x22d08a);})['then'](function(_0x5bb2c0){_0x58f81c=_0x5bb2c0[_0x2ea8('0x22')];return rtq[_0x2ea8('0x52')](_0x545842,_0x58f81c,_0x22d08a,_0x35201e[_0x2ea8('0x11')][_0x2ea8('0x29')]);})['then'](function(_0x1bbed4){_0x1a52d2[_0x2ea8('0x22')]=_0x1bbed4;return _0x1a52d2;})[_0x2ea8('0x21')](respondWithFilteredResult(_0x3d20b2,_0x5457c9))[_0x2ea8('0x45')](APIHandleError(_0x3d20b2));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e4fcaff..52eb582 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1af612,_0x4678dc){var _0x1826ae=function(_0x5864fd){while(--_0x5864fd){_0x1af612['push'](_0x1af612['shift']());}};_0x1826ae(++_0x4678dc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a2cd6,_0x529961){var _0x1bbe2b=function(_0x23d9fb){while(--_0x23d9fb){_0x2a2cd6['push'](_0x2a2cd6['shift']());}};_0x1bbe2b(++_0x529961);}(_0x70e0,0x17b));var _0x070e=function(_0x25a4bc,_0x2f0877){_0x25a4bc=_0x25a4bc-0x0;var _0x1b0c55=_0x70e0[_0x25a4bc];return _0x1b0c55;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e01471e..2ad529b 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 _0xbff5=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x36cc7b,_0x436d43){var _0x164425=function(_0x180473){while(--_0x180473){_0x36cc7b['push'](_0x36cc7b['shift']());}};_0x164425(++_0x436d43);}(_0xbff5,0x1bc));var _0x5bff=function(_0x13f6cd,_0x34689d){_0x13f6cd=_0x13f6cd-0x0;var _0x5cfb29=_0xbff5[_0x13f6cd];return _0x5cfb29;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'state':{'type':Sequelize[_0x5bff('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5bff('0x3')]},'scheduledat':{'type':Sequelize[_0x5bff('0x4')]},'uniqueid':{'type':Sequelize[_0x5bff('0x3')]},'starttime':{'type':Sequelize[_0x5bff('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5bff('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5bff('0x3')]}}; \ No newline at end of file +var _0x53ec=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0x53ec,0x192));var _0xc53e=function(_0x21f70b,_0x47501e){_0x21f70b=_0x21f70b-0x0;var _0x153b64=_0x53ec[_0x21f70b];return _0x153b64;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'state':{'type':Sequelize[_0xc53e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc53e('0x3')]},'scheduledat':{'type':Sequelize[_0xc53e('0x4')]},'uniqueid':{'type':Sequelize[_0xc53e('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc53e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc53e('0x3')]},'campaigntype':{'type':Sequelize[_0xc53e('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2c6c01a..0ad0cb5 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 _0xac05=['rimraf','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x32bcbb,_0x2e37ae){var _0x157155=function(_0x2fb9ae){while(--_0x2fb9ae){_0x32bcbb['push'](_0x32bcbb['shift']());}};_0x157155(++_0x2e37ae);}(_0xac05,0x1f1));var _0x5ac0=function(_0x367922,_0x19f865){_0x367922=_0x367922-0x0;var _0xb2c86e=_0xac05[_0x367922];return _0xb2c86e;};'use strict';var _=require(_0x5ac0('0x0'));var util=require(_0x5ac0('0x1'));var logger=require('../../config/logger')(_0x5ac0('0x2'));var moment=require(_0x5ac0('0x3'));var BPromise=require(_0x5ac0('0x4'));var rp=require(_0x5ac0('0x5'));var fs=require('fs');var path=require(_0x5ac0('0x6'));var rimraf=require(_0x5ac0('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ac0('0x8'));module[_0x5ac0('0x9')]=function(_0xcb4479,_0x1410e0){return _0xcb4479[_0x5ac0('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x5ac0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbde5=['request-promise','path','rimraf','report_agent_preview','lodash','util','moment'];(function(_0x1b98f8,_0x2db035){var _0x1baf40=function(_0x43b514){while(--_0x43b514){_0x1b98f8['push'](_0x1b98f8['shift']());}};_0x1baf40(++_0x2db035);}(_0xbde5,0x107));var _0x5bde=function(_0x26c4cd,_0x509321){_0x26c4cd=_0x26c4cd-0x0;var _0x19b3e9=_0xbde5[_0x26c4cd];return _0x19b3e9;};'use strict';var _=require(_0x5bde('0x0'));var util=require(_0x5bde('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5bde('0x2'));var BPromise=require('bluebird');var rp=require(_0x5bde('0x3'));var fs=require('fs');var path=require(_0x5bde('0x4'));var rimraf=require(_0x5bde('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x4357bd,_0x8e17d9){return _0x4357bd['define']('ReportAgentPreview',attributes,{'tableName':_0x5bde('0x6'),'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 b0fb352..d134666 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 _0x272b=['bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ReportAgentPreview','create','body','options','raw','lodash','moment'];(function(_0x175756,_0x4450bc){var _0x3be0a6=function(_0x3fb180){while(--_0x3fb180){_0x175756['push'](_0x175756['shift']());}};_0x3be0a6(++_0x4450bc);}(_0x272b,0x136));var _0xb272=function(_0x152cb8,_0x2cd976){_0x152cb8=_0x152cb8-0x0;var _0x494c94=_0x272b[_0x152cb8];return _0x494c94;};'use strict';var _=require(_0xb272('0x0'));var util=require('util');var moment=require(_0xb272('0x1'));var BPromise=require(_0xb272('0x2'));var rs=require(_0xb272('0x3'));var fs=require('fs');var Redis=require(_0xb272('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb272('0x5'))(_0xb272('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb272('0x7')][_0xb272('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x99dd98,_0x520510,_0x4bf56a){return new BPromise(function(_0x2e31f9,_0x2dbe92){return client['request'](_0x99dd98,_0x4bf56a)['then'](function(_0x307beb){logger[_0xb272('0x9')](_0xb272('0xa'),_0x520510,_0xb272('0xb'));logger[_0xb272('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x520510,_0xb272('0xb'),JSON[_0xb272('0xd')](_0x307beb));if(_0x307beb[_0xb272('0xe')]){if(_0x307beb[_0xb272('0xe')][_0xb272('0xf')]===0x1f4){logger[_0xb272('0xe')](_0xb272('0xa'),_0x520510,_0x307beb[_0xb272('0xe')][_0xb272('0x10')]);return _0x2dbe92(_0x307beb[_0xb272('0xe')][_0xb272('0x10')]);}logger['error'](_0xb272('0xa'),_0x520510,_0x307beb[_0xb272('0xe')][_0xb272('0x10')]);return _0x2e31f9(_0x307beb[_0xb272('0xe')][_0xb272('0x10')]);}else{logger[_0xb272('0x9')](_0xb272('0xa'),_0x520510,_0xb272('0xb'));_0x2e31f9(_0x307beb[_0xb272('0x11')]['message']);}})[_0xb272('0x12')](function(_0x191653){logger[_0xb272('0xe')](_0xb272('0xa'),_0x520510,_0x191653);_0x2dbe92(_0x191653);});});}exports['CreateReportAgentPreview']=function(_0x3ed022){var _0x522443=this;return new Promise(function(_0x1b457d,_0x33d153){return db[_0xb272('0x13')][_0xb272('0x14')](_0x3ed022[_0xb272('0x15')],{'raw':_0x3ed022['options']?_0x3ed022[_0xb272('0x16')][_0xb272('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x255a9b){logger[_0xb272('0x9')]('CreateReportAgentPreview',_0x3ed022);logger['debug']('CreateReportAgentPreview',_0x3ed022,JSON[_0xb272('0xd')](_0x255a9b));_0x1b457d(_0x255a9b);})[_0xb272('0x12')](function(_0x595d1c){logger[_0xb272('0xe')]('CreateReportAgentPreview',_0x595d1c[_0xb272('0x10')],_0x3ed022);_0x33d153(_0x522443[_0xb272('0xe')](0x1f4,_0x595d1c[_0xb272('0x10')]));});});}; \ No newline at end of file +var _0x2da7=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x338c8c,_0x19df14){var _0x371a9a=function(_0x4da3fe){while(--_0x4da3fe){_0x338c8c['push'](_0x338c8c['shift']());}};_0x371a9a(++_0x19df14);}(_0x2da7,0x99));var _0x72da=function(_0x2bb004,_0x324a3f){_0x2bb004=_0x2bb004-0x0;var _0x1b0c1e=_0x2da7[_0x2bb004];return _0x1b0c1e;};'use strict';var _=require(_0x72da('0x0'));var util=require('util');var moment=require(_0x72da('0x1'));var BPromise=require(_0x72da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72da('0x3'));var db=require(_0x72da('0x4'))['db'];var utils=require(_0x72da('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x72da('0x6'));var client=jayson[_0x72da('0x7')][_0x72da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8e3d2,_0x71f805,_0x203301){return new BPromise(function(_0x2ec9bb,_0x2fbbe3){return client[_0x72da('0x9')](_0x8e3d2,_0x203301)[_0x72da('0xa')](function(_0x5165e2){logger[_0x72da('0xb')](_0x72da('0xc'),_0x71f805,_0x72da('0xd'));logger[_0x72da('0xe')](_0x72da('0xf'),_0x71f805,'request\x20sent',JSON[_0x72da('0x10')](_0x5165e2));if(_0x5165e2[_0x72da('0x11')]){if(_0x5165e2[_0x72da('0x11')][_0x72da('0x12')]===0x1f4){logger[_0x72da('0x11')](_0x72da('0xc'),_0x71f805,_0x5165e2[_0x72da('0x11')][_0x72da('0x13')]);return _0x2fbbe3(_0x5165e2['error'][_0x72da('0x13')]);}logger[_0x72da('0x11')](_0x72da('0xc'),_0x71f805,_0x5165e2[_0x72da('0x11')][_0x72da('0x13')]);return _0x2ec9bb(_0x5165e2['error']['message']);}else{logger[_0x72da('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x71f805,_0x72da('0xd'));_0x2ec9bb(_0x5165e2[_0x72da('0x14')][_0x72da('0x13')]);}})[_0x72da('0x15')](function(_0x135b9c){logger[_0x72da('0x11')](_0x72da('0xc'),_0x71f805,_0x135b9c);_0x2fbbe3(_0x135b9c);});});}exports[_0x72da('0x16')]=function(_0x2ad242){var _0x3bc6b1=this;return new Promise(function(_0x541767,_0x1e1795){return db['ReportAgentPreview'][_0x72da('0x17')](_0x2ad242[_0x72da('0x18')],{'raw':_0x2ad242['options']?_0x2ad242[_0x72da('0x19')][_0x72da('0x1a')]===undefined?!![]:![]:!![]})[_0x72da('0xa')](function(_0xc2252d){logger['info']('CreateReportAgentPreview',_0x2ad242);logger[_0x72da('0xe')](_0x72da('0x16'),_0x2ad242,JSON[_0x72da('0x10')](_0xc2252d));_0x541767(_0xc2252d);})['catch'](function(_0x5a30f5){logger[_0x72da('0x11')]('CreateReportAgentPreview',_0x5a30f5[_0x72da('0x13')],_0x2ad242);_0x1e1795(_0x3bc6b1[_0x72da('0x11')](0x1f4,_0x5a30f5['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1ea53b2..f48d287 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 _0x1f31=['updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put'];(function(_0x283ef3,_0x136ad1){var _0x1d4c24=function(_0x55b811){while(--_0x55b811){_0x283ef3['push'](_0x283ef3['shift']());}};_0x1d4c24(++_0x136ad1);}(_0x1f31,0x12d));var _0x11f3=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x1f31[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require(_0x11f3('0x0'));var util=require(_0x11f3('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x11f3('0x2'));var controller=require(_0x11f3('0x3'));router[_0x11f3('0x4')](_0x11f3('0x5'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x7')]);router[_0x11f3('0x4')](_0x11f3('0x8'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x9')]);router[_0x11f3('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x11f3('0x4')](_0x11f3('0xa'),auth[_0x11f3('0x6')](),controller[_0x11f3('0xb')]);router[_0x11f3('0x4')](_0x11f3('0xc'),auth[_0x11f3('0x6')](),controller[_0x11f3('0xd')]);router[_0x11f3('0x4')](_0x11f3('0xe'),auth['isAuthenticated'](),controller[_0x11f3('0xf')]);router[_0x11f3('0x4')](_0x11f3('0x10'),auth[_0x11f3('0x6')](),controller['mailAccounts']);router['get'](_0x11f3('0x11'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x12')]);router['get'](_0x11f3('0x13'),auth[_0x11f3('0x6')](),controller['smsQueues']);router[_0x11f3('0x4')](_0x11f3('0x14'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x15')]);router[_0x11f3('0x4')]('/fax/queues',auth[_0x11f3('0x6')](),controller[_0x11f3('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0x11f3('0x6')](),controller['voiceQueuesPreview']);router[_0x11f3('0x4')]('/voice/queues/channels',auth[_0x11f3('0x6')](),controller[_0x11f3('0x17')]);router[_0x11f3('0x4')](_0x11f3('0x18'),auth['isAuthenticated'](),controller[_0x11f3('0x19')]);router[_0x11f3('0x4')](_0x11f3('0x1a'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x1b')]);router[_0x11f3('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x11f3('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x11f3('0x4')](_0x11f3('0x1c'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x1d')]);router[_0x11f3('0x1e')]('/voice/queues/:id',auth[_0x11f3('0x6')](),controller[_0x11f3('0x1f')]);router[_0x11f3('0x4')]('/outbound',auth[_0x11f3('0x6')](),controller[_0x11f3('0x20')]);router[_0x11f3('0x4')](_0x11f3('0x21'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x22')]);router['get'](_0x11f3('0x23'),auth['isAuthenticated'](),controller[_0x11f3('0x24')]);router[_0x11f3('0x1e')](_0x11f3('0x25'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x26')]);router['get'](_0x11f3('0x27'),auth['isAuthenticated'](),controller[_0x11f3('0x28')]);router[_0x11f3('0x4')](_0x11f3('0x29'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x2a')]);router['get'](_0x11f3('0x2b'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x2c')]);router[_0x11f3('0x4')](_0x11f3('0x2d'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x2e')]);router[_0x11f3('0x4')]('/chat/queues/waitinginteractions',auth[_0x11f3('0x6')](),controller[_0x11f3('0x2f')]);router[_0x11f3('0x4')](_0x11f3('0x30'),auth['isAuthenticated'](),controller[_0x11f3('0x31')]);router[_0x11f3('0x4')]('/openchannel/queues/waitinginteractions',auth[_0x11f3('0x6')](),controller[_0x11f3('0x32')]);router[_0x11f3('0x4')](_0x11f3('0x33'),auth[_0x11f3('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x11f3('0x34'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x35')]);router['get'](_0x11f3('0x36'),auth[_0x11f3('0x6')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x11f3('0x37'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x38')]);router['post'](_0x11f3('0x39'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3a')](_0x11f3('0x3b')));router[_0x11f3('0x4')](_0x11f3('0x3c'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3d')]);router[_0x11f3('0x3e')](_0x11f3('0x3f'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3a')](_0x11f3('0x40')));router['get'](_0x11f3('0x41'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x42')]);router[_0x11f3('0x3e')](_0x11f3('0x43'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3a')](_0x11f3('0x44')));router['get'](_0x11f3('0x45'),auth['isAuthenticated'](),controller[_0x11f3('0x46')]);router[_0x11f3('0x3e')](_0x11f3('0x47'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x11f3('0x4')](_0x11f3('0x48'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x49')]);router[_0x11f3('0x3e')](_0x11f3('0x4a'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3a')](_0x11f3('0x4b')));router[_0x11f3('0x3e')](_0x11f3('0x4c'),auth[_0x11f3('0x6')](),controller[_0x11f3('0x3a')](_0x11f3('0x4d')));router['get'](_0x11f3('0x4e'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x11f3('0x4')](_0x11f3('0x4f'),auth[_0x11f3('0x6')](),controller['showWhatsappQueues']);router[_0x11f3('0x3e')](_0x11f3('0x50'),auth['isAuthenticated'](),controller[_0x11f3('0x51')]);module[_0x11f3('0x52')]=router; \ No newline at end of file +var _0xb505=['showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/fax/queues/:id/notify','/fax/queues/:id'];(function(_0x17ac27,_0x75d9a){var _0x1271b2=function(_0x843ef7){while(--_0x843ef7){_0x17ac27['push'](_0x17ac27['shift']());}};_0x1271b2(++_0x75d9a);}(_0xb505,0x1a8));var _0x5b50=function(_0x26e4e2,_0x5a41b9){_0x26e4e2=_0x26e4e2-0x0;var _0x399743=_0xb505[_0x26e4e2];return _0x399743;};'use strict';var multer=require(_0x5b50('0x0'));var util=require(_0x5b50('0x1'));var path=require('path');var express=require(_0x5b50('0x2'));var router=express['Router']();var auth=require(_0x5b50('0x3'));var controller=require(_0x5b50('0x4'));router['get'](_0x5b50('0x5'),auth[_0x5b50('0x6')](),controller['voiceChannels']);router[_0x5b50('0x7')](_0x5b50('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x5b50('0x7')](_0x5b50('0x9'),auth['isAuthenticated'](),controller[_0x5b50('0xa')]);router[_0x5b50('0x7')](_0x5b50('0xb'),auth[_0x5b50('0x6')](),controller[_0x5b50('0xc')]);router[_0x5b50('0x7')](_0x5b50('0xd'),auth[_0x5b50('0x6')](),controller['chatQueues']);router[_0x5b50('0x7')](_0x5b50('0xe'),auth['isAuthenticated'](),controller[_0x5b50('0xf')]);router[_0x5b50('0x7')](_0x5b50('0x10'),auth[_0x5b50('0x6')](),controller['mailAccounts']);router[_0x5b50('0x7')](_0x5b50('0x11'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x12')]);router[_0x5b50('0x7')](_0x5b50('0x13'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x5b50('0x7')](_0x5b50('0x14'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x15')]);router[_0x5b50('0x7')](_0x5b50('0x16'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x17')]);router[_0x5b50('0x7')](_0x5b50('0x18'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x19')]);router['get'](_0x5b50('0x1a'),auth['isAuthenticated'](),controller[_0x5b50('0x1b')]);router[_0x5b50('0x7')](_0x5b50('0x1c'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x1d')]);router[_0x5b50('0x7')](_0x5b50('0x1e'),auth[_0x5b50('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x5b50('0x7')](_0x5b50('0x1f'),auth['isAuthenticated'](),controller[_0x5b50('0x20')]);router[_0x5b50('0x7')](_0x5b50('0x21'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x22')]);router[_0x5b50('0x23')](_0x5b50('0x21'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x24')]);router[_0x5b50('0x7')](_0x5b50('0x25'),auth['isAuthenticated'](),controller[_0x5b50('0x26')]);router['get'](_0x5b50('0x27'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x28')]);router[_0x5b50('0x7')](_0x5b50('0x29'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x2a')]);router['put'](_0x5b50('0x2b'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x2c')]);router[_0x5b50('0x7')](_0x5b50('0x2d'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x2e')]);router[_0x5b50('0x7')]('/trunks',auth[_0x5b50('0x6')](),controller['trunks']);router[_0x5b50('0x7')]('/campaigns',auth[_0x5b50('0x6')](),controller[_0x5b50('0x2f')]);router[_0x5b50('0x7')]('/fax/accounts',auth[_0x5b50('0x6')](),controller[_0x5b50('0x30')]);router[_0x5b50('0x7')](_0x5b50('0x31'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x32')]);router[_0x5b50('0x7')](_0x5b50('0x33'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x34')]);router['get'](_0x5b50('0x35'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x36')]);router[_0x5b50('0x7')](_0x5b50('0x37'),auth[_0x5b50('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x5b50('0x7')]('/sms/queues/waitinginteractions',auth[_0x5b50('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x5b50('0x7')](_0x5b50('0x38'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x39')]);router['get'](_0x5b50('0x3a'),auth['isAuthenticated'](),controller[_0x5b50('0x3b')]);router[_0x5b50('0x3c')](_0x5b50('0x3d'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x3e')](_0x5b50('0x3f')));router[_0x5b50('0x7')](_0x5b50('0x40'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x41')]);router[_0x5b50('0x3c')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x5b50('0x3e')]('chat'));router[_0x5b50('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x5b50('0x3c')](_0x5b50('0x42'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router[_0x5b50('0x7')](_0x5b50('0x43'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x44')]);router[_0x5b50('0x3c')](_0x5b50('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0x5b50('0x46')));router[_0x5b50('0x7')](_0x5b50('0x47'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x48')]);router['post'](_0x5b50('0x49'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x3e')](_0x5b50('0x4a')));router['post'](_0x5b50('0x4b'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x3e')](_0x5b50('0x4c')));router[_0x5b50('0x7')](_0x5b50('0x4d'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x4e')]);router['get']('/whatsapp/queues/:id',auth[_0x5b50('0x6')](),controller['showWhatsappQueues']);router[_0x5b50('0x3c')](_0x5b50('0x4f'),auth[_0x5b50('0x6')](),controller[_0x5b50('0x50')]);module[_0x5b50('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 906fc2e..61d1734 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x433444,_0x2bc2ba){var _0x5f4924=function(_0x9efc5d){while(--_0x9efc5d){_0x433444['push'](_0x433444['shift']());}};_0x5f4924(++_0x2bc2ba);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x197782,_0x55d213){var _0x110fe0=function(_0x5846c3){while(--_0x5846c3){_0x197782['push'](_0x197782['shift']());}};_0x110fe0(++_0x55d213);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index db9a47e..cf1fc65 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 _0xb057=['isAuthenticated','show','/:id/run','put','/:id','update','delete','destroy','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index'];(function(_0x660b01,_0x4644b2){var _0x127d86=function(_0x45f4bb){while(--_0x45f4bb){_0x660b01['push'](_0x660b01['shift']());}};_0x127d86(++_0x4644b2);}(_0xb057,0x158));var _0x7b05=function(_0x204e8d,_0x268f00){_0x204e8d=_0x204e8d-0x0;var _0x31b006=_0xb057[_0x204e8d];return _0x31b006;};'use strict';var multer=require('multer');var util=require(_0x7b05('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7b05('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7b05('0x2'));var interaction=require(_0x7b05('0x3'));var config=require(_0x7b05('0x4'));var controller=require(_0x7b05('0x5'));router[_0x7b05('0x6')]('/',auth['isAuthenticated'](),controller[_0x7b05('0x7')]);router[_0x7b05('0x6')]('/:id',auth[_0x7b05('0x8')](),controller[_0x7b05('0x9')]);router[_0x7b05('0x6')](_0x7b05('0xa'),auth[_0x7b05('0x8')](),controller['run']);router['post']('/',auth[_0x7b05('0x8')](),controller['create']);router[_0x7b05('0xb')](_0x7b05('0xc'),auth[_0x7b05('0x8')](),controller[_0x7b05('0xd')]);router[_0x7b05('0xe')](_0x7b05('0xc'),auth[_0x7b05('0x8')](),controller[_0x7b05('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc575=['put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','run','post','create'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc575,0xe8));var _0x5c57=function(_0x5880ad,_0x4da2dc){_0x5880ad=_0x5880ad-0x0;var _0x5b3222=_0xc575[_0x5880ad];return _0x5b3222;};'use strict';var multer=require(_0x5c57('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c57('0x1'));var express=require(_0x5c57('0x2'));var router=express['Router']();var fs_extra=require(_0x5c57('0x3'));var auth=require(_0x5c57('0x4'));var interaction=require(_0x5c57('0x5'));var config=require(_0x5c57('0x6'));var controller=require('./schedule.controller');router[_0x5c57('0x7')]('/',auth[_0x5c57('0x8')](),controller[_0x5c57('0x9')]);router['get'](_0x5c57('0xa'),auth[_0x5c57('0x8')](),controller[_0x5c57('0xb')]);router[_0x5c57('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x5c57('0xc')]);router[_0x5c57('0xd')]('/',auth['isAuthenticated'](),controller[_0x5c57('0xe')]);router[_0x5c57('0xf')](_0x5c57('0xa'),auth['isAuthenticated'](),controller[_0x5c57('0x10')]);router[_0x5c57('0x11')](_0x5c57('0xa'),auth[_0x5c57('0x8')](),controller['destroy']);module[_0x5c57('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f745d91..65eed15 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 _0x5641=['csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','minutes'];(function(_0x25861b,_0x136582){var _0xbc22fc=function(_0x518486){while(--_0x518486){_0x25861b['push'](_0x25861b['shift']());}};_0xbc22fc(++_0x136582);}(_0x5641,0x16f));var _0x1564=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5641[_0x1992f1];return _0x413dfe;};'use strict';var Sequelize=require(_0x1564('0x0'));module[_0x1564('0x1')]={'name':{'type':Sequelize[_0x1564('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1564('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1564('0x2')],'allowNull':![],'defaultValue':_0x1564('0x4')},'startAt':{'type':Sequelize[_0x1564('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1564('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1564('0x7')](_0x1564('0x8'),_0x1564('0x9'),_0x1564('0xa'),'weeks',_0x1564('0xb'),'hours',_0x1564('0xc')),'allowNull':![],'defaultValue':_0x1564('0xb')},'output':{'type':Sequelize['ENUM'](_0x1564('0xd'),_0x1564('0xe'),_0x1564('0xf')),'allowNull':![],'defaultValue':_0x1564('0xd')},'type':{'type':Sequelize[_0x1564('0x7')](_0x1564('0x10'),_0x1564('0x11')),'allowNull':![],'defaultValue':_0x1564('0x10')},'sendMail':{'type':Sequelize[_0x1564('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1564('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x1564('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0ed1=['weeks','days','hours','minutes','csv','pdf','xlsx','ENUM','custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months'];(function(_0x2c50b7,_0x7604fb){var _0x46b5a9=function(_0x4a5ba3){while(--_0x4a5ba3){_0x2c50b7['push'](_0x2c50b7['shift']());}};_0x46b5a9(++_0x7604fb);}(_0x0ed1,0x9a));var _0x10ed=function(_0x572b5d,_0x4bfb90){_0x572b5d=_0x572b5d-0x0;var _0x4268f2=_0x0ed1[_0x572b5d];return _0x4268f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x10ed('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x10ed('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x10ed('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x10ed('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x10ed('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x10ed('0x5'),_0x10ed('0x6'),_0x10ed('0x7'),_0x10ed('0x8'),_0x10ed('0x9'),_0x10ed('0xa'),_0x10ed('0xb')),'allowNull':![],'defaultValue':_0x10ed('0x9')},'output':{'type':Sequelize['ENUM'](_0x10ed('0xc'),_0x10ed('0xd'),_0x10ed('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x10ed('0xf')](_0x10ed('0x10'),'default'),'allowNull':![],'defaultValue':_0x10ed('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x10ed('0x11')]},'bcc':{'type':Sequelize[_0x10ed('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x10ed('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 22ccaa5..cfa1303 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 _0x45d6=['undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Scheduler','UserProfileResource','then','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','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/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'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x45d6,0xf3));var _0x645d=function(_0x1289bc,_0x144483){_0x1289bc=_0x1289bc-0x0;var _0x4b7b61=_0x45d6[_0x1289bc];return _0x4b7b61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x645d('0x0'));var jsonpatch=require(_0x645d('0x1'));var rp=require(_0x645d('0x2'));var moment=require(_0x645d('0x3'));var BPromise=require(_0x645d('0x4'));var Mustache=require(_0x645d('0x5'));var util=require(_0x645d('0x6'));var path=require(_0x645d('0x7'));var sox=require(_0x645d('0x8'));var csv=require(_0x645d('0x9'));var ejs=require(_0x645d('0xa'));var fs=require('fs');var fs_extra=require(_0x645d('0xb'));var _=require(_0x645d('0xc'));var squel=require(_0x645d('0xd'));var crypto=require(_0x645d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x645d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x645d('0x10'));var Papa=require(_0x645d('0x11'));var Redis=require(_0x645d('0x12'));var authService=require(_0x645d('0x13'));var qs=require(_0x645d('0x14'));var as=require(_0x645d('0x15'));var hardwareService=require(_0x645d('0x16'));var logger=require(_0x645d('0x17'))('api');var utils=require(_0x645d('0x18'));var config=require(_0x645d('0x19'));var licenseUtil=require(_0x645d('0x1a'));var db=require(_0x645d('0x1b'))['db'];function respondWithStatusCode(_0x5ad6d0,_0xdbe8f8){_0xdbe8f8=_0xdbe8f8||0xcc;return function(_0x1b5352){if(_0x1b5352){return _0x5ad6d0[_0x645d('0x1c')](_0xdbe8f8);}return _0x5ad6d0['status'](_0xdbe8f8)[_0x645d('0x1d')]();};}function respondWithResult(_0x581fa7,_0x1cfa25){_0x1cfa25=_0x1cfa25||0xc8;return function(_0x4cb198){if(_0x4cb198){return _0x581fa7[_0x645d('0x1e')](_0x1cfa25)[_0x645d('0x1f')](_0x4cb198);}};}function respondWithFilteredResult(_0x15199f,_0x5960b1){return function(_0x535910){if(_0x535910){var _0x100b8e=typeof _0x5960b1[_0x645d('0x20')]===_0x645d('0x21')&&typeof _0x5960b1[_0x645d('0x22')]===_0x645d('0x21');var _0x17b724=_0x535910[_0x645d('0x23')];var _0x4d966d=_0x100b8e?0x0:_0x5960b1[_0x645d('0x20')];var _0x38c36c=_0x100b8e?_0x535910[_0x645d('0x23')]:_0x5960b1['offset']+_0x5960b1['limit'];var _0x56b87f;if(_0x38c36c>=_0x17b724){_0x38c36c=_0x17b724;_0x56b87f=0xc8;}else{_0x56b87f=0xce;}_0x15199f[_0x645d('0x1e')](_0x56b87f);return _0x15199f[_0x645d('0x24')](_0x645d('0x25'),_0x4d966d+'-'+_0x38c36c+'/'+_0x17b724)[_0x645d('0x1f')](_0x535910);}return null;};}function patchUpdates(_0x366d71){return function(_0x4ac557){try{jsonpatch[_0x645d('0x26')](_0x4ac557,_0x366d71,!![]);}catch(_0x2a37e6){return BPromise[_0x645d('0x27')](_0x2a37e6);}return _0x4ac557[_0x645d('0x28')]();};}function saveUpdates(_0x1ccbd9,_0x1ea34d){return function(_0x178e45){if(_0x178e45){return _0x178e45[_0x645d('0x29')](_0x1ccbd9)['then'](function(_0x153ee7){return _0x153ee7;});}return null;};}function removeEntity(_0x3711c8,_0x45c9ed){return function(_0x180746){if(_0x180746){return _0x180746[_0x645d('0x2a')]()['then'](function(){var _0x159602=_0x180746[_0x645d('0x2b')]({'plain':!![]});var _0x43645c=_0x645d('0x2c');return db[_0x645d('0x2d')][_0x645d('0x2a')]({'where':{'type':_0x43645c,'resourceId':_0x159602['id']}})[_0x645d('0x2e')](function(){return _0x180746;});})[_0x645d('0x2e')](function(){_0x3711c8[_0x645d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f67f2,_0x4b914a){return function(_0x2a369a){if(!_0x2a369a){_0x4f67f2[_0x645d('0x1c')](0x194);}return _0x2a369a;};}function handleError(_0xb830bf,_0x457649){_0x457649=_0x457649||0x1f4;return function(_0xbcfdd7){logger[_0x645d('0x2f')](_0xbcfdd7[_0x645d('0x30')]);if(_0xbcfdd7[_0x645d('0x31')]){delete _0xbcfdd7['name'];}_0xb830bf[_0x645d('0x1e')](_0x457649)[_0x645d('0x32')](_0xbcfdd7);};}exports[_0x645d('0x33')]=function(_0x258119,_0x5dad7c){var _0x145710={},_0x47ab3e={},_0xd2cd43={'count':0x0,'rows':[]};var _0x415dce=_['map'](db[_0x645d('0x34')][_0x645d('0x35')],function(_0x4172d1){return{'name':_0x4172d1[_0x645d('0x36')],'type':_0x4172d1[_0x645d('0x37')][_0x645d('0x38')]};});_0x47ab3e[_0x645d('0x39')]=_[_0x645d('0x3a')](_0x415dce,_0x645d('0x31'));_0x47ab3e['query']=_['keys'](_0x258119[_0x645d('0x3b')]);_0x47ab3e['filters']=_['intersection'](_0x47ab3e[_0x645d('0x39')],_0x47ab3e['query']);_0x145710[_0x645d('0x3c')]=_[_0x645d('0x3d')](_0x47ab3e[_0x645d('0x39')],qs['fields'](_0x258119[_0x645d('0x3b')]['fields']));_0x145710['attributes']=_0x145710[_0x645d('0x3c')][_0x645d('0x3e')]?_0x145710[_0x645d('0x3c')]:_0x47ab3e[_0x645d('0x39')];if(!_0x258119[_0x645d('0x3b')][_0x645d('0x3f')](_0x645d('0x40'))){_0x145710[_0x645d('0x22')]=qs['limit'](_0x258119[_0x645d('0x3b')]['limit']);_0x145710[_0x645d('0x20')]=qs[_0x645d('0x20')](_0x258119[_0x645d('0x3b')]['offset']);}_0x145710[_0x645d('0x41')]=qs['sort'](_0x258119[_0x645d('0x3b')][_0x645d('0x42')]);_0x145710[_0x645d('0x43')]=qs['filters'](_[_0x645d('0x44')](_0x258119[_0x645d('0x3b')],_0x47ab3e[_0x645d('0x45')]),_0x415dce);if(_0x258119[_0x645d('0x3b')][_0x645d('0x46')]){_0x145710[_0x645d('0x43')]=_[_0x645d('0x47')](_0x145710[_0x645d('0x43')],{'$or':_[_0x645d('0x3a')](_0x415dce,function(_0x27dbfa){if(_0x27dbfa[_0x645d('0x37')]!==_0x645d('0x48')){var _0x59ba25={};_0x59ba25[_0x27dbfa['name']]={'$like':'%'+_0x258119[_0x645d('0x3b')][_0x645d('0x46')]+'%'};return _0x59ba25;}})});}_0x145710=_[_0x645d('0x47')]({},_0x145710,_0x258119[_0x645d('0x49')]);var _0x322a9c={'where':_0x145710['where']};return db['Schedule']['count'](_0x322a9c)[_0x645d('0x2e')](function(_0x19e66b){_0xd2cd43['count']=_0x19e66b;if(_0x258119[_0x645d('0x3b')][_0x645d('0x4a')]){_0x145710[_0x645d('0x4b')]=[{'all':!![]}];}return db[_0x645d('0x34')][_0x645d('0x4c')](_0x145710);})[_0x645d('0x2e')](function(_0x388794){_0xd2cd43[_0x645d('0x4d')]=_0x388794;return _0xd2cd43;})[_0x645d('0x2e')](respondWithFilteredResult(_0x5dad7c,_0x145710))[_0x645d('0x4e')](handleError(_0x5dad7c,null));};exports[_0x645d('0x4f')]=function(_0x19bb94,_0x5d290a){var _0x402119={'raw':![],'where':{'id':_0x19bb94[_0x645d('0x50')]['id']}},_0x5d3c87={};_0x5d3c87['model']=_[_0x645d('0x51')](db['Schedule'][_0x645d('0x35')]);_0x5d3c87[_0x645d('0x3b')]=_[_0x645d('0x51')](_0x19bb94[_0x645d('0x3b')]);_0x5d3c87[_0x645d('0x45')]=_['intersection'](_0x5d3c87[_0x645d('0x39')],_0x5d3c87[_0x645d('0x3b')]);_0x402119[_0x645d('0x3c')]=_[_0x645d('0x3d')](_0x5d3c87[_0x645d('0x39')],qs[_0x645d('0x52')](_0x19bb94[_0x645d('0x3b')][_0x645d('0x52')]));_0x402119[_0x645d('0x3c')]=_0x402119[_0x645d('0x3c')][_0x645d('0x3e')]?_0x402119['attributes']:_0x5d3c87['model'];if(_0x19bb94['query']['includeAll']){_0x402119[_0x645d('0x4b')]=[{'all':!![]}];}_0x402119=_[_0x645d('0x47')]({},_0x402119,_0x19bb94[_0x645d('0x49')]);return db[_0x645d('0x34')][_0x645d('0x53')](_0x402119)[_0x645d('0x2e')](handleEntityNotFound(_0x5d290a,null))[_0x645d('0x2e')](respondWithResult(_0x5d290a,null))['catch'](handleError(_0x5d290a,null));};exports['create']=function(_0x40fc7d,_0x5221d4){return db[_0x645d('0x34')][_0x645d('0x54')](_0x40fc7d[_0x645d('0x55')],{})[_0x645d('0x2e')](function(_0xd1476c){var _0x266c22=_0x40fc7d[_0x645d('0x56')]['get']({'plain':!![]});if(!_0x266c22)throw new Error(_0x645d('0x57'));if(_0x266c22['role']===_0x645d('0x56')){var _0x57899c=_0xd1476c[_0x645d('0x2b')]({'plain':!![]});var _0x3026a4=_0x645d('0x2c');return db['UserProfileSection'][_0x645d('0x53')]({'where':{'name':_0x3026a4,'userProfileId':_0x266c22['userProfileId']},'raw':!![]})[_0x645d('0x2e')](function(_0x1cf38c){if(_0x1cf38c&&_0x1cf38c[_0x645d('0x58')]===0x0){return db[_0x645d('0x2d')][_0x645d('0x54')]({'name':_0x57899c['name'],'resourceId':_0x57899c['id'],'type':_0x1cf38c['name'],'sectionId':_0x1cf38c['id']},{})[_0x645d('0x2e')](function(){return _0xd1476c;});}else{return _0xd1476c;}})[_0x645d('0x4e')](function(_0x46fe5f){logger[_0x645d('0x2f')](_0x645d('0x59'),_0x46fe5f);throw _0x46fe5f;});}return _0xd1476c;})['then'](respondWithResult(_0x5221d4,0xc9))[_0x645d('0x4e')](handleError(_0x5221d4,null));};exports['update']=function(_0x3cddcf,_0x42b724){if(_0x3cddcf[_0x645d('0x55')]['id']){delete _0x3cddcf[_0x645d('0x55')]['id'];}return db[_0x645d('0x34')][_0x645d('0x53')]({'where':{'id':_0x3cddcf[_0x645d('0x50')]['id']}})[_0x645d('0x2e')](handleEntityNotFound(_0x42b724,null))[_0x645d('0x2e')](saveUpdates(_0x3cddcf[_0x645d('0x55')],null))[_0x645d('0x2e')](respondWithResult(_0x42b724,null))['catch'](handleError(_0x42b724,null));};exports[_0x645d('0x2a')]=function(_0x5eaad2,_0x4e5ca0){return db[_0x645d('0x34')][_0x645d('0x53')]({'where':{'id':_0x5eaad2[_0x645d('0x50')]['id']}})[_0x645d('0x2e')](handleEntityNotFound(_0x4e5ca0,null))['then'](removeEntity(_0x4e5ca0,null))[_0x645d('0x4e')](handleError(_0x4e5ca0,null));};exports[_0x645d('0x5a')]=function(_0x3e761c,_0x308cd2,_0x33f7d9){var _0x2359de=require(_0x645d('0x5b'));return db[_0x645d('0x34')][_0x645d('0x53')]({'where':{'id':_0x3e761c['params']['id']},'raw':!![]})[_0x645d('0x2e')](handleEntityNotFound(_0x308cd2,null))[_0x645d('0x2e')](function(){_0x2359de['run'](_0x3e761c[_0x645d('0x50')]['id']);})[_0x645d('0x2e')](respondWithStatusCode(_0x308cd2,null))[_0x645d('0x4e')](handleError(_0x308cd2,null));}; \ No newline at end of file +var _0x220f=['run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','then','destroy','Scheduler','UserProfileResource','error','stack','name','map','Schedule','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','params','options','find','create','user','get','role','userProfileId','autoAssociation','update','body'];(function(_0x69eff8,_0x598f44){var _0x3706a5=function(_0x1ec4af){while(--_0x1ec4af){_0x69eff8['push'](_0x69eff8['shift']());}};_0x3706a5(++_0x598f44);}(_0x220f,0x101));var _0xf220=function(_0x76be49,_0x1fc18e){_0x76be49=_0x76be49-0x0;var _0x42886d=_0x220f[_0x76be49];return _0x42886d;};'use strict';var emlformat=require(_0xf220('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf220('0x1'));var jsonpatch=require(_0xf220('0x2'));var rp=require(_0xf220('0x3'));var moment=require('moment');var BPromise=require(_0xf220('0x4'));var Mustache=require(_0xf220('0x5'));var util=require(_0xf220('0x6'));var path=require(_0xf220('0x7'));var sox=require(_0xf220('0x8'));var csv=require(_0xf220('0x9'));var ejs=require(_0xf220('0xa'));var fs=require('fs');var fs_extra=require(_0xf220('0xb'));var _=require(_0xf220('0xc'));var squel=require(_0xf220('0xd'));var crypto=require(_0xf220('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf220('0xf'));var toCsv=require(_0xf220('0x9'));var querystring=require(_0xf220('0x10'));var Papa=require(_0xf220('0x11'));var Redis=require('ioredis');var authService=require(_0xf220('0x12'));var qs=require(_0xf220('0x13'));var as=require(_0xf220('0x14'));var hardwareService=require(_0xf220('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf220('0x16'));var config=require(_0xf220('0x17'));var licenseUtil=require(_0xf220('0x18'));var db=require(_0xf220('0x19'))['db'];function respondWithStatusCode(_0x5604e1,_0x329694){_0x329694=_0x329694||0xcc;return function(_0x30a771){if(_0x30a771){return _0x5604e1[_0xf220('0x1a')](_0x329694);}return _0x5604e1['status'](_0x329694)[_0xf220('0x1b')]();};}function respondWithResult(_0xd2841d,_0x25f5e0){_0x25f5e0=_0x25f5e0||0xc8;return function(_0xb9a630){if(_0xb9a630){return _0xd2841d['status'](_0x25f5e0)['json'](_0xb9a630);}};}function respondWithFilteredResult(_0x51be62,_0x239332){return function(_0x1ec5ce){if(_0x1ec5ce){var _0x160c08=typeof _0x239332[_0xf220('0x1c')]===_0xf220('0x1d')&&typeof _0x239332['limit']==='undefined';var _0x44a0e2=_0x1ec5ce['count'];var _0x5dc893=_0x160c08?0x0:_0x239332['offset'];var _0x5833eb=_0x160c08?_0x1ec5ce[_0xf220('0x1e')]:_0x239332[_0xf220('0x1c')]+_0x239332[_0xf220('0x1f')];var _0x217fcd;if(_0x5833eb>=_0x44a0e2){_0x5833eb=_0x44a0e2;_0x217fcd=0xc8;}else{_0x217fcd=0xce;}_0x51be62[_0xf220('0x20')](_0x217fcd);return _0x51be62[_0xf220('0x21')](_0xf220('0x22'),_0x5dc893+'-'+_0x5833eb+'/'+_0x44a0e2)[_0xf220('0x23')](_0x1ec5ce);}return null;};}function patchUpdates(_0x44432c){return function(_0x5ed29b){try{jsonpatch[_0xf220('0x24')](_0x5ed29b,_0x44432c,!![]);}catch(_0x47b9cc){return BPromise[_0xf220('0x25')](_0x47b9cc);}return _0x5ed29b['save']();};}function saveUpdates(_0x66fc5c,_0x3fcb51){return function(_0x2ab72c){if(_0x2ab72c){return _0x2ab72c['update'](_0x66fc5c)[_0xf220('0x26')](function(_0x33c1a7){return _0x33c1a7;});}return null;};}function removeEntity(_0x44f48c,_0x2622e3){return function(_0x1d4c57){if(_0x1d4c57){return _0x1d4c57[_0xf220('0x27')]()[_0xf220('0x26')](function(){var _0x28c038=_0x1d4c57['get']({'plain':!![]});var _0x38c121=_0xf220('0x28');return db[_0xf220('0x29')]['destroy']({'where':{'type':_0x38c121,'resourceId':_0x28c038['id']}})[_0xf220('0x26')](function(){return _0x1d4c57;});})[_0xf220('0x26')](function(){_0x44f48c[_0xf220('0x20')](0xcc)[_0xf220('0x1b')]();});}};}function handleEntityNotFound(_0x3d9d3e,_0x389199){return function(_0x5bccad){if(!_0x5bccad){_0x3d9d3e[_0xf220('0x1a')](0x194);}return _0x5bccad;};}function handleError(_0x92916b,_0x43e283){_0x43e283=_0x43e283||0x1f4;return function(_0x19a850){logger[_0xf220('0x2a')](_0x19a850[_0xf220('0x2b')]);if(_0x19a850[_0xf220('0x2c')]){delete _0x19a850[_0xf220('0x2c')];}_0x92916b[_0xf220('0x20')](_0x43e283)['send'](_0x19a850);};}exports['index']=function(_0x26a9b7,_0x53538e){var _0x2b1970={},_0x3ef2bc={},_0x435581={'count':0x0,'rows':[]};var _0x37a8fa=_[_0xf220('0x2d')](db[_0xf220('0x2e')][_0xf220('0x2f')],function(_0x2efdac){return{'name':_0x2efdac[_0xf220('0x30')],'type':_0x2efdac['type'][_0xf220('0x31')]};});_0x3ef2bc[_0xf220('0x32')]=_[_0xf220('0x2d')](_0x37a8fa,_0xf220('0x2c'));_0x3ef2bc['query']=_[_0xf220('0x33')](_0x26a9b7[_0xf220('0x34')]);_0x3ef2bc[_0xf220('0x35')]=_[_0xf220('0x36')](_0x3ef2bc[_0xf220('0x32')],_0x3ef2bc[_0xf220('0x34')]);_0x2b1970[_0xf220('0x37')]=_[_0xf220('0x36')](_0x3ef2bc[_0xf220('0x32')],qs[_0xf220('0x38')](_0x26a9b7[_0xf220('0x34')][_0xf220('0x38')]));_0x2b1970[_0xf220('0x37')]=_0x2b1970[_0xf220('0x37')][_0xf220('0x39')]?_0x2b1970[_0xf220('0x37')]:_0x3ef2bc[_0xf220('0x32')];if(!_0x26a9b7[_0xf220('0x34')][_0xf220('0x3a')](_0xf220('0x3b'))){_0x2b1970[_0xf220('0x1f')]=qs[_0xf220('0x1f')](_0x26a9b7[_0xf220('0x34')][_0xf220('0x1f')]);_0x2b1970['offset']=qs[_0xf220('0x1c')](_0x26a9b7['query']['offset']);}_0x2b1970[_0xf220('0x3c')]=qs[_0xf220('0x3d')](_0x26a9b7[_0xf220('0x34')][_0xf220('0x3d')]);_0x2b1970[_0xf220('0x3e')]=qs['filters'](_[_0xf220('0x3f')](_0x26a9b7[_0xf220('0x34')],_0x3ef2bc[_0xf220('0x35')]),_0x37a8fa);if(_0x26a9b7[_0xf220('0x34')]['filter']){_0x2b1970[_0xf220('0x3e')]=_[_0xf220('0x40')](_0x2b1970['where'],{'$or':_[_0xf220('0x2d')](_0x37a8fa,function(_0x2ef08d){if(_0x2ef08d[_0xf220('0x41')]!==_0xf220('0x42')){var _0x2b878d={};_0x2b878d[_0x2ef08d[_0xf220('0x2c')]]={'$like':'%'+_0x26a9b7[_0xf220('0x34')][_0xf220('0x43')]+'%'};return _0x2b878d;}})});}_0x2b1970=_[_0xf220('0x40')]({},_0x2b1970,_0x26a9b7['options']);var _0x1a0e88={'where':_0x2b1970[_0xf220('0x3e')]};return db[_0xf220('0x2e')][_0xf220('0x1e')](_0x1a0e88)[_0xf220('0x26')](function(_0x31ecd4){_0x435581['count']=_0x31ecd4;if(_0x26a9b7[_0xf220('0x34')][_0xf220('0x44')]){_0x2b1970[_0xf220('0x45')]=[{'all':!![]}];}return db[_0xf220('0x2e')][_0xf220('0x46')](_0x2b1970);})[_0xf220('0x26')](function(_0x1635b5){_0x435581['rows']=_0x1635b5;return _0x435581;})[_0xf220('0x26')](respondWithFilteredResult(_0x53538e,_0x2b1970))[_0xf220('0x47')](handleError(_0x53538e,null));};exports['show']=function(_0x46a6c7,_0x1d34db){var _0x270dd4={'raw':![],'where':{'id':_0x46a6c7[_0xf220('0x48')]['id']}},_0x43eef5={};_0x43eef5[_0xf220('0x32')]=_['keys'](db[_0xf220('0x2e')][_0xf220('0x2f')]);_0x43eef5[_0xf220('0x34')]=_[_0xf220('0x33')](_0x46a6c7[_0xf220('0x34')]);_0x43eef5[_0xf220('0x35')]=_[_0xf220('0x36')](_0x43eef5['model'],_0x43eef5[_0xf220('0x34')]);_0x270dd4[_0xf220('0x37')]=_['intersection'](_0x43eef5[_0xf220('0x32')],qs[_0xf220('0x38')](_0x46a6c7['query']['fields']));_0x270dd4[_0xf220('0x37')]=_0x270dd4[_0xf220('0x37')][_0xf220('0x39')]?_0x270dd4[_0xf220('0x37')]:_0x43eef5['model'];if(_0x46a6c7[_0xf220('0x34')][_0xf220('0x44')]){_0x270dd4[_0xf220('0x45')]=[{'all':!![]}];}_0x270dd4=_[_0xf220('0x40')]({},_0x270dd4,_0x46a6c7[_0xf220('0x49')]);return db[_0xf220('0x2e')][_0xf220('0x4a')](_0x270dd4)[_0xf220('0x26')](handleEntityNotFound(_0x1d34db,null))['then'](respondWithResult(_0x1d34db,null))[_0xf220('0x47')](handleError(_0x1d34db,null));};exports[_0xf220('0x4b')]=function(_0x21466e,_0x2e0ccc){return db[_0xf220('0x2e')][_0xf220('0x4b')](_0x21466e['body'],{})[_0xf220('0x26')](function(_0x374d21){var _0x29ffc2=_0x21466e[_0xf220('0x4c')][_0xf220('0x4d')]({'plain':!![]});if(!_0x29ffc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ffc2[_0xf220('0x4e')]===_0xf220('0x4c')){var _0x2aec43=_0x374d21[_0xf220('0x4d')]({'plain':!![]});var _0x4aa4d8=_0xf220('0x28');return db['UserProfileSection'][_0xf220('0x4a')]({'where':{'name':_0x4aa4d8,'userProfileId':_0x29ffc2[_0xf220('0x4f')]},'raw':!![]})[_0xf220('0x26')](function(_0x5e5431){if(_0x5e5431&&_0x5e5431[_0xf220('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2aec43['name'],'resourceId':_0x2aec43['id'],'type':_0x5e5431['name'],'sectionId':_0x5e5431['id']},{})['then'](function(){return _0x374d21;});}else{return _0x374d21;}})[_0xf220('0x47')](function(_0x579704){logger[_0xf220('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x579704);throw _0x579704;});}return _0x374d21;})[_0xf220('0x26')](respondWithResult(_0x2e0ccc,0xc9))[_0xf220('0x47')](handleError(_0x2e0ccc,null));};exports[_0xf220('0x51')]=function(_0x3313f2,_0x1023a8){if(_0x3313f2['body']['id']){delete _0x3313f2['body']['id'];}return db[_0xf220('0x2e')][_0xf220('0x4a')]({'where':{'id':_0x3313f2[_0xf220('0x48')]['id']}})[_0xf220('0x26')](handleEntityNotFound(_0x1023a8,null))[_0xf220('0x26')](saveUpdates(_0x3313f2[_0xf220('0x52')],null))[_0xf220('0x26')](respondWithResult(_0x1023a8,null))[_0xf220('0x47')](handleError(_0x1023a8,null));};exports['destroy']=function(_0x1193f6,_0x3377bc){return db['Schedule'][_0xf220('0x4a')]({'where':{'id':_0x1193f6[_0xf220('0x48')]['id']}})['then'](handleEntityNotFound(_0x3377bc,null))['then'](removeEntity(_0x3377bc,null))['catch'](handleError(_0x3377bc,null));};exports[_0xf220('0x53')]=function(_0xf6fb9c,_0x2dab45,_0x185c52){var _0x14da98=require(_0xf220('0x54'));return db[_0xf220('0x2e')][_0xf220('0x4a')]({'where':{'id':_0xf6fb9c['params']['id']},'raw':!![]})[_0xf220('0x26')](handleEntityNotFound(_0x2dab45,null))[_0xf220('0x26')](function(){_0x14da98[_0xf220('0x53')](_0xf6fb9c[_0xf220('0x48')]['id']);})[_0xf220('0x26')](respondWithStatusCode(_0x2dab45,null))['catch'](handleError(_0x2dab45,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9232ee5..90b89f9 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 _0x9aaa=['request-promise','./schedule.attributes','define','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x5e1248,_0x42b862){var _0x1b4201=function(_0x534a23){while(--_0x534a23){_0x5e1248['push'](_0x5e1248['shift']());}};_0x1b4201(++_0x42b862);}(_0x9aaa,0x199));var _0xa9aa=function(_0x4b65b5,_0x18464a){_0x4b65b5=_0x4b65b5-0x0;var _0x4b8d22=_0x9aaa[_0x4b65b5];return _0x4b8d22;};'use strict';var _=require(_0xa9aa('0x0'));var util=require(_0xa9aa('0x1'));var logger=require(_0xa9aa('0x2'))(_0xa9aa('0x3'));var moment=require(_0xa9aa('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9aa('0x6'));module['exports']=function(_0x13fd1c,_0x3b9f0c){return _0x13fd1c[_0xa9aa('0x7')]('Schedule',attributes,{'tableName':_0xa9aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x328d=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','api','bluebird','request-promise'];(function(_0x2cad2f,_0xed8e71){var _0x572af7=function(_0x68d9f7){while(--_0x68d9f7){_0x2cad2f['push'](_0x2cad2f['shift']());}};_0x572af7(++_0xed8e71);}(_0x328d,0x127));var _0xd328=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x328d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd328('0x0'));var util=require(_0xd328('0x1'));var logger=require('../../config/logger')(_0xd328('0x2'));var moment=require('moment');var BPromise=require(_0xd328('0x3'));var rp=require(_0xd328('0x4'));var fs=require('fs');var path=require(_0xd328('0x5'));var rimraf=require(_0xd328('0x6'));var config=require(_0xd328('0x7'));var attributes=require(_0xd328('0x8'));module[_0xd328('0x9')]=function(_0x2194d6,_0x3f8fd7){return _0x2194d6[_0xd328('0xa')](_0xd328('0xb'),attributes,{'tableName':'tools_schedules','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 0c4a147..1118b4e 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 _0x72d6=['error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434d69,_0x194775){var _0x523fd0=function(_0x19f0b4){while(--_0x19f0b4){_0x434d69['push'](_0x434d69['shift']());}};_0x523fd0(++_0x194775);}(_0x72d6,0x13c));var _0x672d=function(_0x40d40d,_0x3a5baf){_0x40d40d=_0x40d40d-0x0;var _0x367eb3=_0x72d6[_0x40d40d];return _0x367eb3;};'use strict';var _=require(_0x672d('0x0'));var util=require(_0x672d('0x1'));var moment=require('moment');var BPromise=require(_0x672d('0x2'));var rs=require(_0x672d('0x3'));var fs=require('fs');var Redis=require(_0x672d('0x4'));var db=require(_0x672d('0x5'))['db'];var utils=require(_0x672d('0x6'));var logger=require(_0x672d('0x7'))(_0x672d('0x8'));var config=require('../../config/environment');var jayson=require(_0x672d('0x9'));var client=jayson[_0x672d('0xa')][_0x672d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x432c78,_0x5035db,_0x4553c8){return new BPromise(function(_0xe1dc25,_0x537000){return client[_0x672d('0xc')](_0x432c78,_0x4553c8)[_0x672d('0xd')](function(_0x156071){logger[_0x672d('0xe')](_0x672d('0xf'),_0x5035db,_0x672d('0x10'));logger[_0x672d('0x11')](_0x672d('0x12'),_0x5035db,_0x672d('0x10'),JSON[_0x672d('0x13')](_0x156071));if(_0x156071[_0x672d('0x14')]){if(_0x156071[_0x672d('0x14')][_0x672d('0x15')]===0x1f4){logger[_0x672d('0x14')](_0x672d('0xf'),_0x5035db,_0x156071[_0x672d('0x14')]['message']);return _0x537000(_0x156071[_0x672d('0x14')][_0x672d('0x16')]);}logger[_0x672d('0x14')](_0x672d('0xf'),_0x5035db,_0x156071[_0x672d('0x14')][_0x672d('0x16')]);return _0xe1dc25(_0x156071[_0x672d('0x14')]['message']);}else{logger[_0x672d('0xe')](_0x672d('0xf'),_0x5035db,_0x672d('0x10'));_0xe1dc25(_0x156071[_0x672d('0x17')][_0x672d('0x16')]);}})['catch'](function(_0x5c9440){logger[_0x672d('0x14')]('Schedule,\x20%s,\x20%s',_0x5035db,_0x5c9440);_0x537000(_0x5c9440);});});} \ No newline at end of file +var _0x0401=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0401,0x17c));var _0x1040=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0401[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x1040('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1040('0x1'));var rs=require(_0x1040('0x2'));var fs=require('fs');var Redis=require(_0x1040('0x3'));var db=require(_0x1040('0x4'))['db'];var utils=require(_0x1040('0x5'));var logger=require(_0x1040('0x6'))(_0x1040('0x7'));var config=require(_0x1040('0x8'));var jayson=require(_0x1040('0x9'));var client=jayson[_0x1040('0xa')][_0x1040('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9ab4d9,_0x19be88,_0x1c904b){return new BPromise(function(_0x65302a,_0x341b53){return client[_0x1040('0xc')](_0x9ab4d9,_0x1c904b)[_0x1040('0xd')](function(_0x31dd3e){logger[_0x1040('0xe')]('Schedule,\x20%s,\x20%s',_0x19be88,_0x1040('0xf'));logger[_0x1040('0x10')](_0x1040('0x11'),_0x19be88,_0x1040('0xf'),JSON['stringify'](_0x31dd3e));if(_0x31dd3e['error']){if(_0x31dd3e[_0x1040('0x12')][_0x1040('0x13')]===0x1f4){logger[_0x1040('0x12')]('Schedule,\x20%s,\x20%s',_0x19be88,_0x31dd3e[_0x1040('0x12')]['message']);return _0x341b53(_0x31dd3e['error']['message']);}logger['error'](_0x1040('0x14'),_0x19be88,_0x31dd3e[_0x1040('0x12')][_0x1040('0x15')]);return _0x65302a(_0x31dd3e[_0x1040('0x12')][_0x1040('0x15')]);}else{logger[_0x1040('0xe')](_0x1040('0x14'),_0x19be88,'request\x20sent');_0x65302a(_0x31dd3e[_0x1040('0x16')]['message']);}})[_0x1040('0x17')](function(_0x3229f8){logger[_0x1040('0x12')](_0x1040('0x14'),_0x19be88,_0x3229f8);_0x341b53(_0x3229f8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0419691..59246ce 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 _0xb31c=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','post','create','put','update'];(function(_0x4423fc,_0x386165){var _0x150146=function(_0x22efb9){while(--_0x22efb9){_0x4423fc['push'](_0x4423fc['shift']());}};_0x150146(++_0x386165);}(_0xb31c,0x10b));var _0xcb31=function(_0x58d3e4,_0x3bae7f){_0x58d3e4=_0x58d3e4-0x0;var _0x52ff5b=_0xb31c[_0x58d3e4];return _0x52ff5b;};'use strict';var multer=require('multer');var util=require(_0xcb31('0x0'));var path=require(_0xcb31('0x1'));var timeout=require(_0xcb31('0x2'));var express=require(_0xcb31('0x3'));var router=express[_0xcb31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb31('0x5'));var interaction=require(_0xcb31('0x6'));var config=require(_0xcb31('0x7'));var controller=require('./screenRecording.controller');router[_0xcb31('0x8')]('/',auth['isAuthenticated'](),controller[_0xcb31('0x9')]);router['get'](_0xcb31('0xa'),auth[_0xcb31('0xb')](),controller[_0xcb31('0xc')]);router['get'](_0xcb31('0xd'),auth[_0xcb31('0xb')](),controller['show']);router['get'](_0xcb31('0xe'),auth[_0xcb31('0xb')](),controller['download']);router[_0xcb31('0xf')]('/',auth['isAuthenticated'](),controller[_0xcb31('0x10')]);router[_0xcb31('0x11')](_0xcb31('0xd'),auth[_0xcb31('0xb')](),controller[_0xcb31('0x12')]);router[_0xcb31('0x13')](_0xcb31('0xd'),auth['isAuthenticated'](),controller[_0xcb31('0x14')]);module[_0xcb31('0x15')]=router; \ No newline at end of file +var _0x18b1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','create','delete','destroy'];(function(_0x4b3c5d,_0x481607){var _0x441426=function(_0x1e7e02){while(--_0x1e7e02){_0x4b3c5d['push'](_0x4b3c5d['shift']());}};_0x441426(++_0x481607);}(_0x18b1,0x9a));var _0x118b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x18b1[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x118b('0x0'));var util=require(_0x118b('0x1'));var path=require(_0x118b('0x2'));var timeout=require(_0x118b('0x3'));var express=require(_0x118b('0x4'));var router=express[_0x118b('0x5')]();var fs_extra=require(_0x118b('0x6'));var auth=require(_0x118b('0x7'));var interaction=require(_0x118b('0x8'));var config=require(_0x118b('0x9'));var controller=require(_0x118b('0xa'));router[_0x118b('0xb')]('/',auth['isAuthenticated'](),controller[_0x118b('0xc')]);router[_0x118b('0xb')]('/describe',auth[_0x118b('0xd')](),controller[_0x118b('0xe')]);router[_0x118b('0xb')](_0x118b('0xf'),auth[_0x118b('0xd')](),controller[_0x118b('0x10')]);router[_0x118b('0xb')](_0x118b('0x11'),auth[_0x118b('0xd')](),controller['download']);router[_0x118b('0x12')]('/',auth[_0x118b('0xd')](),controller[_0x118b('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x118b('0x14')](_0x118b('0xf'),auth[_0x118b('0xd')](),controller[_0x118b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ec03613..693ff9f 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 _0xc00b=['exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize'];(function(_0x31a7af,_0x507c09){var _0x2ea8a3=function(_0x16ee2d){while(--_0x16ee2d){_0x31a7af['push'](_0x31a7af['shift']());}};_0x2ea8a3(++_0x507c09);}(_0xc00b,0x1e5));var _0xbc00=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0xc00b[_0xc8a02c];return _0x3d89da;};'use strict';var Sequelize=require(_0xbc00('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xbc00('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbc00('0x2')](_0xbc00('0x3'))?path[_0xbc00('0x4')](this[_0xbc00('0x2')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xbc00('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xbc00('0x5')],'set':function(_0x5362c6){var _0x378982=_0x5362c6[_0xbc00('0x6')](/\\/g,'/');this[_0xbc00('0x7')](_0xbc00('0x3'),_0x378982);}},'rating':{'type':Sequelize[_0xbc00('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbc00('0x8')],'set':function(_0x51a669){this[_0xbc00('0x7')]('startedAt',moment()[_0xbc00('0x9')](_0x51a669,'ms'));this[_0xbc00('0x7')](_0xbc00('0xa'),moment());this['setDataValue'](_0xbc00('0xb'),_0x51a669);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbc00('0x2')]('startedAt'))[_0xbc00('0xc')](_0xbc00('0xd'))[_0xbc00('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbc00('0x2')](_0xbc00('0xa')))[_0xbc00('0xc')]('MM-DD-YYYY\x20HH:mm')[_0xbc00('0xe')]();}},'createdAt':{'type':Sequelize[_0xbc00('0xf')],'get':function(){return moment(this['getDataValue'](_0xbc00('0x10')))[_0xbc00('0xc')](_0xbc00('0xd'))[_0xbc00('0xe')]();}},'updatedAt':{'type':Sequelize[_0xbc00('0xf')],'get':function(){return moment(this[_0xbc00('0x2')](_0xbc00('0x11')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x62f1=['INTEGER','startedAt','closedAt','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x3eddeb,_0x3ebda6){var _0x1bd68e=function(_0x16b46d){while(--_0x16b46d){_0x3eddeb['push'](_0x3eddeb['shift']());}};_0x1bd68e(++_0x3ebda6);}(_0x62f1,0x112));var _0x162f=function(_0x248dc8,_0x10c027){_0x248dc8=_0x248dc8-0x0;var _0x15aaee=_0x62f1[_0x248dc8];return _0x15aaee;};'use strict';var Sequelize=require(_0x162f('0x0'));var moment=require('moment');var path=require(_0x162f('0x1'));var config=require(_0x162f('0x2'));module[_0x162f('0x3')]={'format':{'type':Sequelize[_0x162f('0x4')],'get':function(){return this[_0x162f('0x5')](_0x162f('0x6'))?path[_0x162f('0x7')](this[_0x162f('0x5')](_0x162f('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x162f('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x162f('0x8')],'set':function(_0x2e763a){var _0x593029=_0x2e763a[_0x162f('0x9')](/\\/g,'/');this[_0x162f('0xa')](_0x162f('0x6'),_0x593029);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x162f('0xb')],'set':function(_0x3d795c){this[_0x162f('0xa')](_0x162f('0xc'),moment()['subtract'](_0x3d795c,'ms'));this[_0x162f('0xa')](_0x162f('0xd'),moment());this[_0x162f('0xa')]('duration',_0x3d795c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x162f('0xc')))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}},'closedAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this[_0x162f('0x5')]('closedAt'))[_0x162f('0x11')](_0x162f('0xe'))[_0x162f('0xf')]();}},'createdAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this['getDataValue'](_0x162f('0x12')))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}},'updatedAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this[_0x162f('0x5')]('updatedAt'))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 284656f..20219de 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x58fd96,_0x57b2d1){var _0x57d274=function(_0x3b9fbb){while(--_0x3b9fbb){_0x58fd96['push'](_0x58fd96['shift']());}};_0x57d274(++_0x57b2d1);}(_0x207c,0x1e8));var _0xc207=function(_0x3f3a47,_0x28f84b){_0x3f3a47=_0x3f3a47-0x0;var _0x57a682=_0x207c[_0x3f3a47];return _0x57a682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0x7bae=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0x7bae,0x13b));var _0xe7ba=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7bae[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 6307583..c3e3a4e 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 _0x0d6b=['screen_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0d6b,0x1da));var _0xb0d6=function(_0x2ff19f,_0xbefc43){_0x2ff19f=_0x2ff19f-0x0;var _0x1983d4=_0x0d6b[_0x2ff19f];return _0x1983d4;};'use strict';var _=require(_0xb0d6('0x0'));var util=require('util');var logger=require(_0xb0d6('0x1'))('api');var moment=require(_0xb0d6('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0d6('0x3'));var fs=require('fs');var path=require(_0xb0d6('0x4'));var rimraf=require(_0xb0d6('0x5'));var config=require(_0xb0d6('0x6'));var attributes=require(_0xb0d6('0x7'));module[_0xb0d6('0x8')]=function(_0x57fa93,_0x17f835){return _0x57fa93[_0xb0d6('0x9')]('ScreenRecording',attributes,{'tableName':_0xb0d6('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x71b2=['moment','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api'];(function(_0x2781c1,_0x45a2aa){var _0x4bf4a9=function(_0x2cc579){while(--_0x2cc579){_0x2781c1['push'](_0x2781c1['shift']());}};_0x4bf4a9(++_0x45a2aa);}(_0x71b2,0x183));var _0x271b=function(_0x2f8140,_0x37076b){_0x2f8140=_0x2f8140-0x0;var _0x21bd12=_0x71b2[_0x2f8140];return _0x21bd12;};'use strict';var _=require(_0x271b('0x0'));var util=require(_0x271b('0x1'));var logger=require('../../config/logger')(_0x271b('0x2'));var moment=require(_0x271b('0x3'));var BPromise=require('bluebird');var rp=require(_0x271b('0x4'));var fs=require('fs');var path=require(_0x271b('0x5'));var rimraf=require(_0x271b('0x6'));var config=require(_0x271b('0x7'));var attributes=require('./screenRecording.attributes');module[_0x271b('0x8')]=function(_0x5f5959,_0x574a3e){return _0x5f5959[_0x271b('0x9')](_0x271b('0xa'),attributes,{'tableName':_0x271b('0xb'),'paranoid':![],'indexes':[{'name':_0x271b('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 73a30a5..7f58241 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 _0x6665=['then','info','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x43b624,_0x18168d){var _0x29e970=function(_0x4a91e2){while(--_0x4a91e2){_0x43b624['push'](_0x43b624['shift']());}};_0x29e970(++_0x18168d);}(_0x6665,0xe4));var _0x5666=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x6665[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x5666('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5666('0x1'));var rs=require(_0x5666('0x2'));var fs=require('fs');var Redis=require(_0x5666('0x3'));var db=require(_0x5666('0x4'))['db'];var utils=require(_0x5666('0x5'));var logger=require(_0x5666('0x6'))(_0x5666('0x7'));var config=require(_0x5666('0x8'));var jayson=require(_0x5666('0x9'));var client=jayson['client'][_0x5666('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x962ae1,_0xaa5776,_0x3dc893){return new BPromise(function(_0x5ca26d,_0x8a531c){return client[_0x5666('0xb')](_0x962ae1,_0x3dc893)[_0x5666('0xc')](function(_0x35ee45){logger[_0x5666('0xd')]('ScreenRecording,\x20%s,\x20%s',_0xaa5776,'request\x20sent');logger[_0x5666('0xe')](_0x5666('0xf'),_0xaa5776,_0x5666('0x10'),JSON[_0x5666('0x11')](_0x35ee45));if(_0x35ee45[_0x5666('0x12')]){if(_0x35ee45['error'][_0x5666('0x13')]===0x1f4){logger[_0x5666('0x12')]('ScreenRecording,\x20%s,\x20%s',_0xaa5776,_0x35ee45[_0x5666('0x12')][_0x5666('0x14')]);return _0x8a531c(_0x35ee45[_0x5666('0x12')][_0x5666('0x14')]);}logger[_0x5666('0x12')](_0x5666('0x15'),_0xaa5776,_0x35ee45[_0x5666('0x12')][_0x5666('0x14')]);return _0x5ca26d(_0x35ee45['error'][_0x5666('0x14')]);}else{logger['info'](_0x5666('0x15'),_0xaa5776,'request\x20sent');_0x5ca26d(_0x35ee45[_0x5666('0x16')][_0x5666('0x14')]);}})[_0x5666('0x17')](function(_0x5ef618){logger[_0x5666('0x12')](_0x5666('0x15'),_0xaa5776,_0x5ef618);_0x8a531c(_0x5ef618);});});} \ No newline at end of file +var _0xa91f=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x17c68b,_0x45f9b4){var _0x8005b3=function(_0x428964){while(--_0x428964){_0x17c68b['push'](_0x17c68b['shift']());}};_0x8005b3(++_0x45f9b4);}(_0xa91f,0x16b));var _0xfa91=function(_0x1e6cbc,_0x5410c3){_0x1e6cbc=_0x1e6cbc-0x0;var _0x9852ab=_0xa91f[_0x1e6cbc];return _0x9852ab;};'use strict';var _=require(_0xfa91('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa91('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa91('0x2'));var db=require(_0xfa91('0x3'))['db'];var utils=require(_0xfa91('0x4'));var logger=require('../../config/logger')(_0xfa91('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa91('0x6')][_0xfa91('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9d5396,_0x2e2e25,_0x24e641){return new BPromise(function(_0x507c71,_0x4e0532){return client['request'](_0x9d5396,_0x24e641)[_0xfa91('0x8')](function(_0x56e413){logger['info'](_0xfa91('0x9'),_0x2e2e25,_0xfa91('0xa'));logger[_0xfa91('0xb')](_0xfa91('0xc'),_0x2e2e25,_0xfa91('0xa'),JSON[_0xfa91('0xd')](_0x56e413));if(_0x56e413[_0xfa91('0xe')]){if(_0x56e413[_0xfa91('0xe')]['code']===0x1f4){logger[_0xfa91('0xe')](_0xfa91('0x9'),_0x2e2e25,_0x56e413[_0xfa91('0xe')][_0xfa91('0xf')]);return _0x4e0532(_0x56e413[_0xfa91('0xe')][_0xfa91('0xf')]);}logger[_0xfa91('0xe')](_0xfa91('0x9'),_0x2e2e25,_0x56e413[_0xfa91('0xe')][_0xfa91('0xf')]);return _0x507c71(_0x56e413[_0xfa91('0xe')][_0xfa91('0xf')]);}else{logger[_0xfa91('0x10')](_0xfa91('0x9'),_0x2e2e25,_0xfa91('0xa'));_0x507c71(_0x56e413[_0xfa91('0x11')]['message']);}})[_0xfa91('0x12')](function(_0x5a4409){logger['error'](_0xfa91('0x9'),_0x2e2e25,_0x5a4409);_0x4e0532(_0x5a4409);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ec98c67..070a485 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 _0xef3f=['single','addLogo','join','logologin','file','addLogoLogin','preferred','addPreferred','favicon','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xef3f,0x164));var _0xfef3=function(_0x264c23,_0x266966){_0x264c23=_0x264c23-0x0;var _0x3bc271=_0xef3f[_0x264c23];return _0x3bc271;};'use strict';var multer=require(_0xfef3('0x0'));var util=require('util');var path=require(_0xfef3('0x1'));var timeout=require('connect-timeout');var express=require(_0xfef3('0x2'));var router=express[_0xfef3('0x3')]();var fs_extra=require(_0xfef3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfef3('0x5'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xfef3('0x6')]('/',auth[_0xfef3('0x7')](),controller[_0xfef3('0x8')]);router['get'](_0xfef3('0x9'),controller[_0xfef3('0xa')]);router[_0xfef3('0x6')](_0xfef3('0xb'),controller[_0xfef3('0xc')]);router['get'](_0xfef3('0xd'),controller[_0xfef3('0xe')]);router[_0xfef3('0x6')](_0xfef3('0xf'),controller[_0xfef3('0x10')]);router[_0xfef3('0x6')]('/:id/gdpr',controller[_0xfef3('0x11')]);router[_0xfef3('0x6')](_0xfef3('0x12'),controller[_0xfef3('0x13')]);router[_0xfef3('0x6')](_0xfef3('0x14'),controller[_0xfef3('0x15')]);var upload=multer({'storage':multer[_0xfef3('0x16')]({'destination':function(_0x37251d,_0x4d5bbc,_0x4984ca){_0x4984ca(null,path['join'](config[_0xfef3('0x17')],_0xfef3('0x18')));},'filename':function(_0x2e6e60,_0x491a9c,_0x1705a9){_0x1705a9(null,util[_0xfef3('0x19')](_0xfef3('0x1a'),_0xfef3('0x1b'),path[_0xfef3('0x1c')](_0x491a9c[_0xfef3('0x1d')])));}})});router[_0xfef3('0x1e')](_0xfef3('0xd'),upload[_0xfef3('0x1f')]('file'),controller[_0xfef3('0x20')]);var upload=multer({'storage':multer[_0xfef3('0x16')]({'destination':function(_0x17ab6c,_0x28af3b,_0x2c831a){_0x2c831a(null,path[_0xfef3('0x21')](config[_0xfef3('0x17')],_0xfef3('0x18')));},'filename':function(_0x63cc0c,_0xe7ee9c,_0x337c77){_0x337c77(null,util[_0xfef3('0x19')](_0xfef3('0x1a'),_0xfef3('0x22'),path[_0xfef3('0x1c')](_0xe7ee9c[_0xfef3('0x1d')])));}})});router['post'](_0xfef3('0xf'),upload[_0xfef3('0x1f')](_0xfef3('0x23')),controller[_0xfef3('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x544cc2,_0x415f31,_0xd5cf8f){_0xd5cf8f(null,path[_0xfef3('0x21')](config[_0xfef3('0x17')],_0xfef3('0x18')));},'filename':function(_0x2bf6e1,_0x4ca2e8,_0xb05579){_0xb05579(null,util[_0xfef3('0x19')](_0xfef3('0x1a'),_0xfef3('0x25'),path[_0xfef3('0x1c')](_0x4ca2e8[_0xfef3('0x1d')])));}})});router[_0xfef3('0x1e')](_0xfef3('0x12'),upload[_0xfef3('0x1f')](_0xfef3('0x23')),controller[_0xfef3('0x26')]);var upload=multer({'storage':multer[_0xfef3('0x16')]({'destination':function(_0x88a18a,_0x358f95,_0x5a5732){_0x5a5732(null,path['join'](config['root'],_0xfef3('0x18')));},'filename':function(_0x3d2ae3,_0x4a857e,_0x3737b4){_0x3737b4(null,util[_0xfef3('0x19')](_0xfef3('0x1a'),_0xfef3('0x27'),path[_0xfef3('0x1c')](_0x4a857e[_0xfef3('0x1d')])));}})});router['post'](_0xfef3('0x14'),upload[_0xfef3('0x1f')](_0xfef3('0x23')),controller['addFavicon']);router[_0xfef3('0x28')](_0xfef3('0xb'),auth['isAuthenticated'](),controller[_0xfef3('0x29')]);module[_0xfef3('0x2a')]=router; \ No newline at end of file +var _0xdb32=['single','file','addLogo','logologin','originalname','addLogoLogin','join','addPreferred','favicon','/:id/favicon','addFavicon','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','post'];(function(_0x401b47,_0x5c1964){var _0x8ba713=function(_0x4b6b0b){while(--_0x4b6b0b){_0x401b47['push'](_0x401b47['shift']());}};_0x8ba713(++_0x5c1964);}(_0xdb32,0xde));var _0x2db3=function(_0x378aa6,_0x30e8e5){_0x378aa6=_0x378aa6-0x0;var _0x72610=_0xdb32[_0x378aa6];return _0x72610;};'use strict';var multer=require(_0x2db3('0x0'));var util=require(_0x2db3('0x1'));var path=require('path');var timeout=require(_0x2db3('0x2'));var express=require(_0x2db3('0x3'));var router=express[_0x2db3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2db3('0x5'));var interaction=require(_0x2db3('0x6'));var config=require(_0x2db3('0x7'));var controller=require(_0x2db3('0x8'));router[_0x2db3('0x9')]('/',auth[_0x2db3('0xa')](),controller['index']);router[_0x2db3('0x9')](_0x2db3('0xb'),controller[_0x2db3('0xc')]);router[_0x2db3('0x9')](_0x2db3('0xd'),controller[_0x2db3('0xe')]);router[_0x2db3('0x9')](_0x2db3('0xf'),controller['getLogo']);router['get'](_0x2db3('0x10'),controller[_0x2db3('0x11')]);router[_0x2db3('0x9')]('/:id/gdpr',controller[_0x2db3('0x12')]);router['get'](_0x2db3('0x13'),controller[_0x2db3('0x14')]);router[_0x2db3('0x9')]('/:id/favicon',controller[_0x2db3('0x15')]);var upload=multer({'storage':multer[_0x2db3('0x16')]({'destination':function(_0x5821fa,_0x5a265f,_0x4c599c){_0x4c599c(null,path['join'](config[_0x2db3('0x17')],_0x2db3('0x18')));},'filename':function(_0x1ead1d,_0x4f44ec,_0x137be4){_0x137be4(null,util[_0x2db3('0x19')](_0x2db3('0x1a'),_0x2db3('0x1b'),path[_0x2db3('0x1c')](_0x4f44ec['originalname'])));}})});router[_0x2db3('0x1d')]('/:id/logo',upload[_0x2db3('0x1e')](_0x2db3('0x1f')),controller[_0x2db3('0x20')]);var upload=multer({'storage':multer[_0x2db3('0x16')]({'destination':function(_0x1c9b81,_0xc3a726,_0x4f8d87){_0x4f8d87(null,path['join'](config[_0x2db3('0x17')],_0x2db3('0x18')));},'filename':function(_0x43ab21,_0x7318f8,_0x493a62){_0x493a62(null,util['format'](_0x2db3('0x1a'),_0x2db3('0x21'),path[_0x2db3('0x1c')](_0x7318f8[_0x2db3('0x22')])));}})});router['post'](_0x2db3('0x10'),upload[_0x2db3('0x1e')]('file'),controller[_0x2db3('0x23')]);var upload=multer({'storage':multer[_0x2db3('0x16')]({'destination':function(_0x23c423,_0x1ae7d9,_0x1b7229){_0x1b7229(null,path[_0x2db3('0x24')](config[_0x2db3('0x17')],_0x2db3('0x18')));},'filename':function(_0x4d8804,_0x510ec9,_0x4d7132){_0x4d7132(null,util[_0x2db3('0x19')]('%s%s','preferred',path[_0x2db3('0x1c')](_0x510ec9[_0x2db3('0x22')])));}})});router[_0x2db3('0x1d')](_0x2db3('0x13'),upload['single'](_0x2db3('0x1f')),controller[_0x2db3('0x25')]);var upload=multer({'storage':multer[_0x2db3('0x16')]({'destination':function(_0x573847,_0x56e9c5,_0x586fbf){_0x586fbf(null,path[_0x2db3('0x24')](config[_0x2db3('0x17')],'server/files/images/logos/'));},'filename':function(_0x17b874,_0x5a7856,_0x1a9380){_0x1a9380(null,util[_0x2db3('0x19')](_0x2db3('0x1a'),_0x2db3('0x26'),path[_0x2db3('0x1c')](_0x5a7856[_0x2db3('0x22')])));}})});router[_0x2db3('0x1d')](_0x2db3('0x27'),upload['single']('file'),controller[_0x2db3('0x28')]);router['put'](_0x2db3('0xd'),auth['isAuthenticated'](),controller['update']);module[_0x2db3('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 68d04f9..6b6a2d8 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 _0x3861=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED'];(function(_0x12f036,_0x27e401){var _0xf0be1b=function(_0x4084c){while(--_0x4084c){_0x12f036['push'](_0x12f036['shift']());}};_0xf0be1b(++_0x27e401);}(_0x3861,0x1c2));var _0x1386=function(_0x1d78bd,_0x55da95){_0x1d78bd=_0x1d78bd-0x0;var _0x51fc0e=_0x3861[_0x1d78bd];return _0x51fc0e;};'use strict';var Sequelize=require(_0x1386('0x0'));module[_0x1386('0x1')]={'min_internal':{'type':Sequelize[_0x1386('0x2')](0xb),'unique':_0x1386('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1386('0x2')](0xb),'unique':_0x1386('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1386('0x5')],'defaultValue':_0x1386('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1386('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1386('0x5')]},'turnaddr':{'type':Sequelize[_0x1386('0x5')]},'turnusername':{'type':Sequelize[_0x1386('0x5')]},'turnpassword':{'type':Sequelize[_0x1386('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1386('0x5')],'defaultValue':_0x1386('0x8')},'enableEmailPreview':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1386('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1386('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1386('0x2')]},'transcribeRegion':{'type':Sequelize[_0x1386('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x1386('0x5')]},'language':{'type':Sequelize[_0x1386('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x1386('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1386('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1386('0x2')](0x2)[_0x1386('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x1386('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1386('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x1386('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1386('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x835b=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4d9108,_0x4b2c2c){var _0x5b31bd=function(_0x3a8baf){while(--_0x3a8baf){_0x4d9108['push'](_0x4d9108['shift']());}};_0x5b31bd(++_0x4b2c2c);}(_0x835b,0x9a));var _0xb835=function(_0xf8b0d4,_0x13cdd2){_0xf8b0d4=_0xf8b0d4-0x0;var _0x323c68=_0x835b[_0xf8b0d4];return _0x323c68;};'use strict';var Sequelize=require(_0xb835('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb835('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb835('0x2')](0xb),'unique':_0xb835('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb835('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb835('0x4')],'defaultValue':_0xb835('0x5')},'logo':{'type':Sequelize[_0xb835('0x4')]},'defaultLogo':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb835('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb835('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xb835('0x4')]},'turnusername':{'type':Sequelize[_0xb835('0x4')]},'turnpassword':{'type':Sequelize[_0xb835('0x4')]},'pageTitle':{'type':Sequelize[_0xb835('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb835('0x4')],'defaultValue':_0xb835('0x7')},'enableEmailPreview':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb835('0x4')],'defaultValue':_0xb835('0x8')},'chatTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb835('0x4')]},'defaultPreferred':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb835('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb835('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb835('0x4')]},'language':{'type':Sequelize[_0xb835('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb835('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb835('0x2')](0x2)[_0xb835('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb835('0x2')](0x2)[_0xb835('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb835('0x2')](0x2)[_0xb835('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb835('0x2')](0x2)[_0xb835('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb835('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb835('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c9e8f71..71948f9 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 _0xcee0=['http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','body','find','file','filename','loginLogo','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','custom','ValidationError','upperFirst','download','getLogoLogin','preferred','defaultPreferred','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','jayson/promise','client'];(function(_0x53c5cf,_0x3ef208){var _0x3261aa=function(_0x69b1d){while(--_0x69b1d){_0x53c5cf['push'](_0x53c5cf['shift']());}};_0x3261aa(++_0x3ef208);}(_0xcee0,0x1e1));var _0x0cee=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xcee0[_0x5235dd];return _0x13059d;};'use strict';var emlformat=require(_0x0cee('0x0'));var rimraf=require(_0x0cee('0x1'));var zipdir=require(_0x0cee('0x2'));var jsonpatch=require(_0x0cee('0x3'));var rp=require(_0x0cee('0x4'));var moment=require(_0x0cee('0x5'));var BPromise=require(_0x0cee('0x6'));var Mustache=require(_0x0cee('0x7'));var util=require(_0x0cee('0x8'));var path=require('path');var sox=require(_0x0cee('0x9'));var csv=require(_0x0cee('0xa'));var ejs=require(_0x0cee('0xb'));var fs=require('fs');var fs_extra=require(_0x0cee('0xc'));var _=require(_0x0cee('0xd'));var squel=require('squel');var crypto=require(_0x0cee('0xe'));var jsforce=require(_0x0cee('0xf'));var deskjs=require(_0x0cee('0x10'));var toCsv=require(_0x0cee('0xa'));var querystring=require(_0x0cee('0x11'));var Papa=require(_0x0cee('0x12'));var Redis=require(_0x0cee('0x13'));var authService=require(_0x0cee('0x14'));var qs=require(_0x0cee('0x15'));var as=require(_0x0cee('0x16'));var hardwareService=require(_0x0cee('0x17'));var logger=require(_0x0cee('0x18'))('api');var utils=require(_0x0cee('0x19'));var config=require(_0x0cee('0x1a'));var licenseUtil=require(_0x0cee('0x1b'));var db=require(_0x0cee('0x1c'))['db'];var jayson=require(_0x0cee('0x1d'));var client=jayson[_0x0cee('0x1e')][_0x0cee('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2eab47,_0x515803,_0x1ffbf7,_0x123543){return new BPromise(function(_0x35dbb1,_0xa21b9){var _0x2497ed=_0x123543||client;return _0x2497ed[_0x0cee('0x20')](_0x2eab47,_0x1ffbf7)[_0x0cee('0x21')](function(_0x1a51f3){logger['info'](_0x0cee('0x22'),_0x515803,_0x0cee('0x23'));logger[_0x0cee('0x24')](_0x0cee('0x25'),_0x515803,_0x0cee('0x23'),JSON[_0x0cee('0x26')](_0x1a51f3));if(_0x1a51f3[_0x0cee('0x27')]){if(_0x1a51f3[_0x0cee('0x27')][_0x0cee('0x28')]===0x1f4){logger['error'](_0x0cee('0x22'),_0x515803,_0x1a51f3['error'][_0x0cee('0x29')]);return _0xa21b9(_0x1a51f3[_0x0cee('0x27')]['message']);}logger[_0x0cee('0x27')](_0x0cee('0x22'),_0x515803,_0x1a51f3[_0x0cee('0x27')][_0x0cee('0x29')]);return _0x35dbb1(_0x1a51f3[_0x0cee('0x27')][_0x0cee('0x29')]);}else{logger[_0x0cee('0x2a')](_0x0cee('0x22'),_0x515803,_0x0cee('0x23'));_0x35dbb1(_0x1a51f3[_0x0cee('0x2b')][_0x0cee('0x29')]);}})[_0x0cee('0x2c')](function(_0x3bdfa9){logger['error'](_0x0cee('0x22'),_0x515803,_0x3bdfa9);_0xa21b9(_0x3bdfa9);});});}function respondWithStatusCode(_0x2fd696,_0x512cfc){_0x512cfc=_0x512cfc||0xcc;return function(_0x4dca3a){if(_0x4dca3a){return _0x2fd696[_0x0cee('0x2d')](_0x512cfc);}return _0x2fd696[_0x0cee('0x2e')](_0x512cfc)[_0x0cee('0x2f')]();};}function respondWithResult(_0x4d895f,_0x15e4ed){_0x15e4ed=_0x15e4ed||0xc8;return function(_0x3e4bca){if(_0x3e4bca){return _0x4d895f[_0x0cee('0x2e')](_0x15e4ed)[_0x0cee('0x30')](_0x3e4bca);}};}function respondWithFilteredResult(_0x31ac4d,_0x27e266){return function(_0x24739e){if(_0x24739e){var _0x288651=typeof _0x27e266[_0x0cee('0x31')]==='undefined'&&typeof _0x27e266[_0x0cee('0x32')]===_0x0cee('0x33');var _0x4c9a44=_0x24739e[_0x0cee('0x34')];var _0x3b59eb=_0x288651?0x0:_0x27e266[_0x0cee('0x31')];var _0x448d3f=_0x288651?_0x24739e['count']:_0x27e266[_0x0cee('0x31')]+_0x27e266[_0x0cee('0x32')];var _0x33cf6d;if(_0x448d3f>=_0x4c9a44){_0x448d3f=_0x4c9a44;_0x33cf6d=0xc8;}else{_0x33cf6d=0xce;}_0x31ac4d[_0x0cee('0x2e')](_0x33cf6d);return _0x31ac4d[_0x0cee('0x35')](_0x0cee('0x36'),_0x3b59eb+'-'+_0x448d3f+'/'+_0x4c9a44)['json'](_0x24739e);}return null;};}function patchUpdates(_0x5b836a){return function(_0x1dc587){try{jsonpatch['apply'](_0x1dc587,_0x5b836a,!![]);}catch(_0x5754d4){return BPromise['reject'](_0x5754d4);}return _0x1dc587[_0x0cee('0x37')]();};}function saveUpdates(_0x1fec41,_0x5c3c5e){return function(_0x4d5b3d){if(_0x4d5b3d){return _0x4d5b3d[_0x0cee('0x38')](_0x1fec41)[_0x0cee('0x21')](function(_0x1e960a){return _0x1e960a;});}return null;};}function removeEntity(_0x3429b0,_0x557653){return function(_0x19fd82){if(_0x19fd82){return _0x19fd82['destroy']()[_0x0cee('0x21')](function(){_0x3429b0[_0x0cee('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7c98,_0x3c964e){return function(_0x573066){if(!_0x573066){_0x1b7c98[_0x0cee('0x2d')](0x194);}return _0x573066;};}function handleError(_0x2d403c,_0x33fb63){_0x33fb63=_0x33fb63||0x1f4;return function(_0x103ab3){logger['error'](_0x103ab3[_0x0cee('0x39')]);if(_0x103ab3[_0x0cee('0x3a')]){delete _0x103ab3[_0x0cee('0x3a')];}_0x2d403c[_0x0cee('0x2e')](_0x33fb63)[_0x0cee('0x3b')](_0x103ab3);};}exports[_0x0cee('0x3c')]=function(_0x53b319,_0x5d9208){var _0x56f7c3={},_0x3ba86e={},_0xb5ab5a={'count':0x0,'rows':[]};var _0x2d87e2=_[_0x0cee('0x3d')](db[_0x0cee('0x3e')][_0x0cee('0x3f')],function(_0x3a49f8){return{'name':_0x3a49f8[_0x0cee('0x40')],'type':_0x3a49f8[_0x0cee('0x41')][_0x0cee('0x42')]};});_0x3ba86e[_0x0cee('0x43')]=_[_0x0cee('0x3d')](_0x2d87e2,_0x0cee('0x3a'));_0x3ba86e['query']=_['keys'](_0x53b319['query']);_0x3ba86e[_0x0cee('0x44')]=_[_0x0cee('0x45')](_0x3ba86e[_0x0cee('0x43')],_0x3ba86e[_0x0cee('0x46')]);_0x56f7c3[_0x0cee('0x47')]=_[_0x0cee('0x45')](_0x3ba86e[_0x0cee('0x43')],qs[_0x0cee('0x48')](_0x53b319['query'][_0x0cee('0x48')]));_0x56f7c3[_0x0cee('0x47')]=_0x56f7c3[_0x0cee('0x47')][_0x0cee('0x49')]?_0x56f7c3['attributes']:_0x3ba86e[_0x0cee('0x43')];if(!_0x53b319[_0x0cee('0x46')][_0x0cee('0x4a')](_0x0cee('0x4b'))){_0x56f7c3[_0x0cee('0x32')]=qs[_0x0cee('0x32')](_0x53b319[_0x0cee('0x46')][_0x0cee('0x32')]);_0x56f7c3[_0x0cee('0x31')]=qs['offset'](_0x53b319[_0x0cee('0x46')][_0x0cee('0x31')]);}_0x56f7c3[_0x0cee('0x4c')]=qs[_0x0cee('0x4d')](_0x53b319[_0x0cee('0x46')]['sort']);_0x56f7c3[_0x0cee('0x4e')]=qs[_0x0cee('0x44')](_[_0x0cee('0x4f')](_0x53b319[_0x0cee('0x46')],_0x3ba86e[_0x0cee('0x44')]),_0x2d87e2);if(_0x53b319[_0x0cee('0x46')][_0x0cee('0x50')]){_0x56f7c3[_0x0cee('0x4e')]=_[_0x0cee('0x51')](_0x56f7c3[_0x0cee('0x4e')],{'$or':_[_0x0cee('0x3d')](_0x2d87e2,function(_0x8322d8){if(_0x8322d8['type']!==_0x0cee('0x52')){var _0x3548b1={};_0x3548b1[_0x8322d8[_0x0cee('0x3a')]]={'$like':'%'+_0x53b319[_0x0cee('0x46')]['filter']+'%'};return _0x3548b1;}})});}_0x56f7c3=_[_0x0cee('0x51')]({},_0x56f7c3,_0x53b319[_0x0cee('0x53')]);var _0x3e46af={'where':_0x56f7c3[_0x0cee('0x4e')]};return db[_0x0cee('0x3e')][_0x0cee('0x34')](_0x3e46af)['then'](function(_0x4b788f){_0xb5ab5a[_0x0cee('0x34')]=_0x4b788f;if(_0x53b319['query'][_0x0cee('0x54')]){_0x56f7c3[_0x0cee('0x55')]=[{'all':!![]}];}return db[_0x0cee('0x3e')][_0x0cee('0x56')](_0x56f7c3);})[_0x0cee('0x21')](function(_0x2c7649){_0xb5ab5a['rows']=_0x2c7649;return _0xb5ab5a;})['then'](respondWithFilteredResult(_0x5d9208,_0x56f7c3))[_0x0cee('0x2c')](handleError(_0x5d9208,null));};exports['show']=function(_0x53d935,_0x57e3aa){var _0x3721b6={'raw':![],'where':{'id':_0x53d935[_0x0cee('0x57')]['id']}},_0x18f19a={};_0x18f19a[_0x0cee('0x43')]=_[_0x0cee('0x58')](db[_0x0cee('0x3e')][_0x0cee('0x3f')]);_0x18f19a['query']=_[_0x0cee('0x58')](_0x53d935[_0x0cee('0x46')]);_0x18f19a[_0x0cee('0x44')]=_[_0x0cee('0x45')](_0x18f19a['model'],_0x18f19a[_0x0cee('0x46')]);_0x3721b6[_0x0cee('0x47')]=_['intersection'](_0x18f19a[_0x0cee('0x43')],qs[_0x0cee('0x48')](_0x53d935[_0x0cee('0x46')]['fields']));_0x3721b6[_0x0cee('0x47')]=_0x3721b6[_0x0cee('0x47')][_0x0cee('0x49')]?_0x3721b6[_0x0cee('0x47')]:_0x18f19a[_0x0cee('0x43')];if(_0x53d935['query']['includeAll']){_0x3721b6[_0x0cee('0x55')]=[{'all':!![]}];}_0x3721b6=_[_0x0cee('0x51')]({},_0x3721b6,_0x53d935[_0x0cee('0x53')]);return db['Setting']['find'](_0x3721b6)[_0x0cee('0x21')](handleEntityNotFound(_0x57e3aa,null))[_0x0cee('0x21')](respondWithResult(_0x57e3aa,null))[_0x0cee('0x2c')](handleError(_0x57e3aa,null));};exports[_0x0cee('0x38')]=function(_0xdafa8,_0x6aaa2d){if(_0xdafa8['body']['id']){delete _0xdafa8[_0x0cee('0x59')]['id'];}return db['Setting'][_0x0cee('0x5a')]({'where':{'id':_0xdafa8['params']['id']}})['then'](handleEntityNotFound(_0x6aaa2d,null))['then'](saveUpdates(_0xdafa8[_0x0cee('0x59')],null))['then'](respondWithResult(_0x6aaa2d,null))['catch'](handleError(_0x6aaa2d,null));};exports['addLogo']=function(_0x3d2017,_0x27842e,_0xb600a2){if(_0x3d2017[_0x0cee('0x5b')]&&_0x3d2017['file'][_0x0cee('0x5c')]){_0x3d2017[_0x0cee('0x59')]['logo']=_0x3d2017[_0x0cee('0x5b')][_0x0cee('0x5c')];}return db[_0x0cee('0x3e')]['find']({'where':{'id':_0x3d2017[_0x0cee('0x57')]['id']}})[_0x0cee('0x21')](handleEntityNotFound(_0x27842e,null))[_0x0cee('0x21')](saveUpdates(_0x3d2017[_0x0cee('0x59')],null))[_0x0cee('0x21')](respondWithResult(_0x27842e,null))[_0x0cee('0x2c')](handleError(_0x27842e,null));};exports['addLogoLogin']=function(_0x2013bf,_0x471ccb,_0x2189a8){if(_0x2013bf['file']&&_0x2013bf[_0x0cee('0x5b')][_0x0cee('0x5c')]){_0x2013bf[_0x0cee('0x59')][_0x0cee('0x5d')]=_0x2013bf[_0x0cee('0x5b')][_0x0cee('0x5c')];}return db[_0x0cee('0x3e')][_0x0cee('0x5a')]({'where':{'id':_0x2013bf[_0x0cee('0x57')]['id']}})['then'](handleEntityNotFound(_0x471ccb,null))[_0x0cee('0x21')](saveUpdates(_0x2013bf[_0x0cee('0x59')],null))['then'](respondWithResult(_0x471ccb,null))[_0x0cee('0x2c')](handleError(_0x471ccb,null));};var utilLicense=require(_0x0cee('0x1b'));exports['getLogo']=function(_0x917d58,_0x110bcf,_0x845c9e){var _0x14a30f=_0x0cee('0x5e');var _0x554a1b={'custom':![]};return utilLicense[_0x0cee('0x5f')]()[_0x0cee('0x21')](function(_0x89d020){if(_0x89d020){_0x554a1b=_0x89d020;}return db[_0x0cee('0x3e')][_0x0cee('0x5a')]({'where':{'id':_0x917d58[_0x0cee('0x57')]['id']},'attributes':[_0x0cee('0x60'),_0x0cee('0x5d'),'preferred',_0x0cee('0x61'),_0x0cee('0x62'),_0x0cee('0x63'),'defaultPreferred',_0x0cee('0x64')],'raw':!![]});})[_0x0cee('0x21')](handleEntityNotFound(_0x110bcf,null))[_0x0cee('0x21')](function(_0x3ca4b2){if(_0x3ca4b2){var _0x1d4ae3=_0x3ca4b2[_0x0cee('0x60')]&&fs[_0x0cee('0x65')](path[_0x0cee('0x66')](config['root'],_0x14a30f,_[_0x0cee('0x67')](_0x3ca4b2[_0x0cee('0x60')])))?path['join'](config[_0x0cee('0x68')],_0x14a30f,_[_0x0cee('0x67')](_0x3ca4b2[_0x0cee('0x60')])):path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x14a30f,_[_0x0cee('0x67')](_0x0cee('0x69')));var _0x3d92ea=_0x0cee('0x6a')+_['upperFirst'](_0x0cee('0x60'));if(_0x3ca4b2[_0x3d92ea]||!_0x554a1b[_0x0cee('0x6b')]){_0x1d4ae3=path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x14a30f,_[_0x0cee('0x67')](_0x0cee('0x69')));}if(!fs[_0x0cee('0x65')](_0x1d4ae3)){throw new db['Sequelize'][(_0x0cee('0x6c'))](_[_0x0cee('0x6d')](_0x0cee('0x60'))+'\x20not\x20found');}return _0x110bcf[_0x0cee('0x6e')](_0x1d4ae3);}})[_0x0cee('0x2c')](handleError(_0x110bcf,null));};var utilLicense=require(_0x0cee('0x1b'));exports[_0x0cee('0x6f')]=function(_0x52fa28,_0x5fcf6f,_0x566c77){var _0x23aee9='server/files/images/logos';var _0x579c43={'custom':![]};return utilLicense['getLicense']()[_0x0cee('0x21')](function(_0x1f495b){if(_0x1f495b){_0x579c43=_0x1f495b;}return db['Setting'][_0x0cee('0x5a')]({'where':{'id':_0x52fa28[_0x0cee('0x57')]['id']},'attributes':[_0x0cee('0x60'),'loginLogo',_0x0cee('0x70'),_0x0cee('0x61'),'defaultLogo',_0x0cee('0x63'),_0x0cee('0x71'),_0x0cee('0x64')],'raw':!![]});})[_0x0cee('0x21')](handleEntityNotFound(_0x5fcf6f,null))['then'](function(_0x11e132){if(_0x11e132){var _0x3f9f84=_0x11e132['loginLogo']&&fs[_0x0cee('0x65')](path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x23aee9,_[_0x0cee('0x67')](_0x11e132[_0x0cee('0x5d')])))?path[_0x0cee('0x66')](config['root'],_0x23aee9,_[_0x0cee('0x67')](_0x11e132[_0x0cee('0x5d')])):path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x23aee9,_[_0x0cee('0x67')](_0x0cee('0x72')));var _0x322611=_0x0cee('0x6a')+_[_0x0cee('0x6d')](_0x0cee('0x5d'));if(_0x11e132[_0x322611]||!_0x579c43[_0x0cee('0x6b')]){_0x3f9f84=path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x23aee9,_[_0x0cee('0x67')](_0x0cee('0x72')));}if(!fs[_0x0cee('0x65')](_0x3f9f84)){throw new db[(_0x0cee('0x73'))][(_0x0cee('0x6c'))](_[_0x0cee('0x6d')](_0x0cee('0x5d'))+'\x20not\x20found');}return _0x5fcf6f['download'](_0x3f9f84);}})['catch'](handleError(_0x5fcf6f,null));};exports[_0x0cee('0x74')]=function(_0x44dff4,_0x26e0e8){return db['Setting'][_0x0cee('0x5a')]({'where':{'id':_0x44dff4[_0x0cee('0x57')]['id']},'attributes':[_0x0cee('0x75')]})[_0x0cee('0x21')](respondWithResult(_0x26e0e8,null))['catch'](handleError(_0x26e0e8,null));};exports[_0x0cee('0x76')]=function(_0x31df55,_0x25443e,_0x1104c3){if(_0x31df55['file']&&_0x31df55[_0x0cee('0x5b')]['filename']){_0x31df55[_0x0cee('0x59')]['preferred']=_0x31df55[_0x0cee('0x5b')][_0x0cee('0x5c')];}return db[_0x0cee('0x3e')][_0x0cee('0x5a')]({'where':{'id':_0x31df55['params']['id']}})['then'](handleEntityNotFound(_0x25443e,null))[_0x0cee('0x21')](saveUpdates(_0x31df55[_0x0cee('0x59')],null))[_0x0cee('0x21')](respondWithResult(_0x25443e,null))[_0x0cee('0x2c')](handleError(_0x25443e,null));};var utilLicense=require(_0x0cee('0x1b'));exports[_0x0cee('0x77')]=function(_0x5a547f,_0x2212aa,_0x411bb1){var _0xc4d5fb='server/files/images/logos';var _0x56756c={'custom':![]};return utilLicense[_0x0cee('0x5f')]()[_0x0cee('0x21')](function(_0x43e9cf){if(_0x43e9cf){_0x56756c=_0x43e9cf;}return db[_0x0cee('0x3e')]['find']({'where':{'id':_0x5a547f['params']['id']},'attributes':[_0x0cee('0x60'),_0x0cee('0x5d'),_0x0cee('0x70'),_0x0cee('0x61'),_0x0cee('0x62'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0cee('0x21')](handleEntityNotFound(_0x2212aa,null))[_0x0cee('0x21')](function(_0x13e845){if(_0x13e845){var _0xb9c646=_0x13e845[_0x0cee('0x70')]&&fs[_0x0cee('0x65')](path[_0x0cee('0x66')](config['root'],_0xc4d5fb,_[_0x0cee('0x67')](_0x13e845['preferred'])))?path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0xc4d5fb,_[_0x0cee('0x67')](_0x13e845['preferred'])):path[_0x0cee('0x66')](config['root'],_0xc4d5fb,_[_0x0cee('0x67')](_0x0cee('0x78')));var _0x429e1c='default'+_['upperFirst'](_0x0cee('0x70'));if(_0x13e845[_0x429e1c]||!_0x56756c['custom']||!_0x56756c[_0x0cee('0x70')]){_0xb9c646=path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0xc4d5fb,_[_0x0cee('0x67')](_0x0cee('0x78')));}if(!fs['existsSync'](_0xb9c646)){throw new db['Sequelize'][(_0x0cee('0x6c'))](_['upperFirst'](_0x0cee('0x70'))+_0x0cee('0x79'));}return _0x2212aa[_0x0cee('0x6e')](_0xb9c646);}})[_0x0cee('0x2c')](handleError(_0x2212aa,null));};exports[_0x0cee('0x7a')]=function(_0x526259,_0x41fcb5,_0x30c436){if(_0x526259['file']&&_0x526259[_0x0cee('0x5b')][_0x0cee('0x5c')]){_0x526259[_0x0cee('0x59')][_0x0cee('0x61')]=_0x526259[_0x0cee('0x5b')]['filename'];}return db['Setting'][_0x0cee('0x5a')]({'where':{'id':_0x526259['params']['id']}})[_0x0cee('0x21')](handleEntityNotFound(_0x41fcb5,null))[_0x0cee('0x21')](saveUpdates(_0x526259['body'],null))[_0x0cee('0x21')](respondWithResult(_0x41fcb5,null))[_0x0cee('0x2c')](handleError(_0x41fcb5,null));};var utilLicense=require(_0x0cee('0x1b'));exports[_0x0cee('0x7b')]=function(_0x54baf0,_0x8a1ed0,_0x3f28c1){var _0x303ccd=_0x0cee('0x5e');var _0x2f8185={'custom':![]};return utilLicense[_0x0cee('0x5f')]()[_0x0cee('0x21')](function(_0x1c1abd){if(_0x1c1abd){_0x2f8185=_0x1c1abd;}return db[_0x0cee('0x3e')]['find']({'where':{'id':_0x54baf0[_0x0cee('0x57')]['id']},'attributes':[_0x0cee('0x60'),'loginLogo','preferred',_0x0cee('0x61'),'defaultLogo',_0x0cee('0x63'),_0x0cee('0x71'),'defaultFavicon'],'raw':!![]});})[_0x0cee('0x21')](handleEntityNotFound(_0x8a1ed0,null))[_0x0cee('0x21')](function(_0x492333){if(_0x492333){var _0x40987b=_0x492333[_0x0cee('0x61')]&&fs[_0x0cee('0x65')](path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x303ccd,_['toLower'](_0x492333['favicon'])))?path[_0x0cee('0x66')](config['root'],_0x303ccd,_[_0x0cee('0x67')](_0x492333[_0x0cee('0x61')])):path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x303ccd,_[_0x0cee('0x67')](_0x0cee('0x7c')));var _0x2603e4=_0x0cee('0x6a')+_['upperFirst'](_0x0cee('0x61'));if(_0x492333[_0x2603e4]||!_0x2f8185[_0x0cee('0x6b')]){_0x40987b=path[_0x0cee('0x66')](config[_0x0cee('0x68')],_0x303ccd,_['toLower'](_0x0cee('0x7c')));}if(!fs[_0x0cee('0x65')](_0x40987b)){throw new db[(_0x0cee('0x73'))][(_0x0cee('0x6c'))](_[_0x0cee('0x6d')](_0x0cee('0x61'))+_0x0cee('0x79'));}return _0x8a1ed0[_0x0cee('0x6e')](_0x40987b);}})[_0x0cee('0x2c')](handleError(_0x8a1ed0,null));};exports[_0x0cee('0x7d')]=function(_0x105b9f,_0x270f32){var _0x32a5f1={'offset':moment()['utcOffset']()};_0x32a5f1['now']=moment()[_0x0cee('0x7e')](_0x32a5f1[_0x0cee('0x31')])[_0x0cee('0x7f')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x270f32[_0x0cee('0x2e')](0xc8)[_0x0cee('0x3b')](_0x32a5f1);}; \ No newline at end of file +var _0xa0e5=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','save','destroy','stack','name','Setting','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','sort','pick','merge','where','map','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','logo','root','upperFirst','custom','default_logo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','server/files/images/logos','favicon','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x1efdf9,_0x725098){var _0x24f74d=function(_0x4e1f64){while(--_0x4e1f64){_0x1efdf9['push'](_0x1efdf9['shift']());}};_0x24f74d(++_0x725098);}(_0xa0e5,0x6f));var _0x5a0e=function(_0x4d9098,_0x4eaeeb){_0x4d9098=_0x4d9098-0x0;var _0x464b68=_0xa0e5[_0x4d9098];return _0x464b68;};'use strict';var emlformat=require(_0x5a0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a0e('0x1'));var jsonpatch=require(_0x5a0e('0x2'));var rp=require(_0x5a0e('0x3'));var moment=require('moment');var BPromise=require(_0x5a0e('0x4'));var Mustache=require(_0x5a0e('0x5'));var util=require('util');var path=require(_0x5a0e('0x6'));var sox=require(_0x5a0e('0x7'));var csv=require(_0x5a0e('0x8'));var ejs=require(_0x5a0e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a0e('0xa'));var squel=require(_0x5a0e('0xb'));var crypto=require(_0x5a0e('0xc'));var jsforce=require(_0x5a0e('0xd'));var deskjs=require(_0x5a0e('0xe'));var toCsv=require(_0x5a0e('0x8'));var querystring=require('querystring');var Papa=require(_0x5a0e('0xf'));var Redis=require(_0x5a0e('0x10'));var authService=require(_0x5a0e('0x11'));var qs=require(_0x5a0e('0x12'));var as=require(_0x5a0e('0x13'));var hardwareService=require(_0x5a0e('0x14'));var logger=require(_0x5a0e('0x15'))(_0x5a0e('0x16'));var utils=require(_0x5a0e('0x17'));var config=require(_0x5a0e('0x18'));var licenseUtil=require(_0x5a0e('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5a0e('0x1a')][_0x5a0e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xfd12de,_0x4fb36d,_0x51c9cc,_0x2a3fef){return new BPromise(function(_0x2bca67,_0x540655){var _0x59230e=_0x2a3fef||client;return _0x59230e[_0x5a0e('0x1c')](_0xfd12de,_0x51c9cc)[_0x5a0e('0x1d')](function(_0xc4865c){logger['info'](_0x5a0e('0x1e'),_0x4fb36d,_0x5a0e('0x1f'));logger[_0x5a0e('0x20')](_0x5a0e('0x21'),_0x4fb36d,_0x5a0e('0x1f'),JSON[_0x5a0e('0x22')](_0xc4865c));if(_0xc4865c['error']){if(_0xc4865c[_0x5a0e('0x23')][_0x5a0e('0x24')]===0x1f4){logger[_0x5a0e('0x23')](_0x5a0e('0x1e'),_0x4fb36d,_0xc4865c[_0x5a0e('0x23')][_0x5a0e('0x25')]);return _0x540655(_0xc4865c[_0x5a0e('0x23')][_0x5a0e('0x25')]);}logger[_0x5a0e('0x23')]('Setting,\x20%s,\x20%s',_0x4fb36d,_0xc4865c[_0x5a0e('0x23')][_0x5a0e('0x25')]);return _0x2bca67(_0xc4865c['error'][_0x5a0e('0x25')]);}else{logger[_0x5a0e('0x26')](_0x5a0e('0x1e'),_0x4fb36d,_0x5a0e('0x1f'));_0x2bca67(_0xc4865c[_0x5a0e('0x27')][_0x5a0e('0x25')]);}})[_0x5a0e('0x28')](function(_0x2ecb2a){logger[_0x5a0e('0x23')](_0x5a0e('0x1e'),_0x4fb36d,_0x2ecb2a);_0x540655(_0x2ecb2a);});});}function respondWithStatusCode(_0x333956,_0x5e45cb){_0x5e45cb=_0x5e45cb||0xcc;return function(_0x223192){if(_0x223192){return _0x333956[_0x5a0e('0x29')](_0x5e45cb);}return _0x333956[_0x5a0e('0x2a')](_0x5e45cb)[_0x5a0e('0x2b')]();};}function respondWithResult(_0x4378db,_0x377e37){_0x377e37=_0x377e37||0xc8;return function(_0x20848d){if(_0x20848d){return _0x4378db['status'](_0x377e37)[_0x5a0e('0x2c')](_0x20848d);}};}function respondWithFilteredResult(_0x1ea1ab,_0x4aacfa){return function(_0x4dd32e){if(_0x4dd32e){var _0x1e5703=typeof _0x4aacfa[_0x5a0e('0x2d')]===_0x5a0e('0x2e')&&typeof _0x4aacfa['limit']===_0x5a0e('0x2e');var _0x390627=_0x4dd32e['count'];var _0x5ca1e0=_0x1e5703?0x0:_0x4aacfa['offset'];var _0x608792=_0x1e5703?_0x4dd32e['count']:_0x4aacfa[_0x5a0e('0x2d')]+_0x4aacfa['limit'];var _0xbf9ff3;if(_0x608792>=_0x390627){_0x608792=_0x390627;_0xbf9ff3=0xc8;}else{_0xbf9ff3=0xce;}_0x1ea1ab['status'](_0xbf9ff3);return _0x1ea1ab[_0x5a0e('0x2f')](_0x5a0e('0x30'),_0x5ca1e0+'-'+_0x608792+'/'+_0x390627)['json'](_0x4dd32e);}return null;};}function patchUpdates(_0x5adcae){return function(_0xf96aa5){try{jsonpatch[_0x5a0e('0x31')](_0xf96aa5,_0x5adcae,!![]);}catch(_0x1a29c1){return BPromise['reject'](_0x1a29c1);}return _0xf96aa5[_0x5a0e('0x32')]();};}function saveUpdates(_0x16d19c,_0x534647){return function(_0x1420ea){if(_0x1420ea){return _0x1420ea['update'](_0x16d19c)[_0x5a0e('0x1d')](function(_0x712346){return _0x712346;});}return null;};}function removeEntity(_0x171ae4,_0x5a6203){return function(_0x1f6114){if(_0x1f6114){return _0x1f6114[_0x5a0e('0x33')]()['then'](function(){_0x171ae4[_0x5a0e('0x2a')](0xcc)[_0x5a0e('0x2b')]();});}};}function handleEntityNotFound(_0x14f375,_0x362f02){return function(_0x55d101){if(!_0x55d101){_0x14f375['sendStatus'](0x194);}return _0x55d101;};}function handleError(_0x448fea,_0x4459bc){_0x4459bc=_0x4459bc||0x1f4;return function(_0xb5c74e){logger['error'](_0xb5c74e[_0x5a0e('0x34')]);if(_0xb5c74e[_0x5a0e('0x35')]){delete _0xb5c74e['name'];}_0x448fea[_0x5a0e('0x2a')](_0x4459bc)['send'](_0xb5c74e);};}exports['index']=function(_0x429969,_0x3d117c){var _0x7f92ea={},_0x1e24a6={},_0x3914eb={'count':0x0,'rows':[]};var _0x2575ea=_['map'](db[_0x5a0e('0x36')]['rawAttributes'],function(_0x113862){return{'name':_0x113862['fieldName'],'type':_0x113862[_0x5a0e('0x37')][_0x5a0e('0x38')]};});_0x1e24a6['model']=_['map'](_0x2575ea,_0x5a0e('0x35'));_0x1e24a6[_0x5a0e('0x39')]=_[_0x5a0e('0x3a')](_0x429969['query']);_0x1e24a6[_0x5a0e('0x3b')]=_[_0x5a0e('0x3c')](_0x1e24a6['model'],_0x1e24a6['query']);_0x7f92ea[_0x5a0e('0x3d')]=_[_0x5a0e('0x3c')](_0x1e24a6['model'],qs[_0x5a0e('0x3e')](_0x429969[_0x5a0e('0x39')]['fields']));_0x7f92ea[_0x5a0e('0x3d')]=_0x7f92ea['attributes'][_0x5a0e('0x3f')]?_0x7f92ea[_0x5a0e('0x3d')]:_0x1e24a6[_0x5a0e('0x40')];if(!_0x429969[_0x5a0e('0x39')][_0x5a0e('0x41')]('nolimit')){_0x7f92ea[_0x5a0e('0x42')]=qs['limit'](_0x429969[_0x5a0e('0x39')][_0x5a0e('0x42')]);_0x7f92ea[_0x5a0e('0x2d')]=qs['offset'](_0x429969['query'][_0x5a0e('0x2d')]);}_0x7f92ea['order']=qs[_0x5a0e('0x43')](_0x429969[_0x5a0e('0x39')][_0x5a0e('0x43')]);_0x7f92ea['where']=qs[_0x5a0e('0x3b')](_[_0x5a0e('0x44')](_0x429969['query'],_0x1e24a6['filters']),_0x2575ea);if(_0x429969[_0x5a0e('0x39')]['filter']){_0x7f92ea['where']=_[_0x5a0e('0x45')](_0x7f92ea[_0x5a0e('0x46')],{'$or':_[_0x5a0e('0x47')](_0x2575ea,function(_0x5c4870){if(_0x5c4870[_0x5a0e('0x37')]!==_0x5a0e('0x48')){var _0x9c0d2f={};_0x9c0d2f[_0x5c4870[_0x5a0e('0x35')]]={'$like':'%'+_0x429969[_0x5a0e('0x39')][_0x5a0e('0x49')]+'%'};return _0x9c0d2f;}})});}_0x7f92ea=_['merge']({},_0x7f92ea,_0x429969[_0x5a0e('0x4a')]);var _0x25e006={'where':_0x7f92ea['where']};return db[_0x5a0e('0x36')]['count'](_0x25e006)[_0x5a0e('0x1d')](function(_0x3c6189){_0x3914eb[_0x5a0e('0x4b')]=_0x3c6189;if(_0x429969[_0x5a0e('0x39')][_0x5a0e('0x4c')]){_0x7f92ea['include']=[{'all':!![]}];}return db[_0x5a0e('0x36')][_0x5a0e('0x4d')](_0x7f92ea);})['then'](function(_0x2731d0){_0x3914eb[_0x5a0e('0x4e')]=_0x2731d0;return _0x3914eb;})[_0x5a0e('0x1d')](respondWithFilteredResult(_0x3d117c,_0x7f92ea))[_0x5a0e('0x28')](handleError(_0x3d117c,null));};exports[_0x5a0e('0x4f')]=function(_0x3e0b8d,_0x41eefe){var _0x287e4b={'raw':![],'where':{'id':_0x3e0b8d[_0x5a0e('0x50')]['id']}},_0x56214b={};_0x56214b['model']=_[_0x5a0e('0x3a')](db['Setting'][_0x5a0e('0x51')]);_0x56214b[_0x5a0e('0x39')]=_[_0x5a0e('0x3a')](_0x3e0b8d[_0x5a0e('0x39')]);_0x56214b[_0x5a0e('0x3b')]=_[_0x5a0e('0x3c')](_0x56214b[_0x5a0e('0x40')],_0x56214b[_0x5a0e('0x39')]);_0x287e4b[_0x5a0e('0x3d')]=_[_0x5a0e('0x3c')](_0x56214b[_0x5a0e('0x40')],qs[_0x5a0e('0x3e')](_0x3e0b8d[_0x5a0e('0x39')][_0x5a0e('0x3e')]));_0x287e4b[_0x5a0e('0x3d')]=_0x287e4b[_0x5a0e('0x3d')][_0x5a0e('0x3f')]?_0x287e4b[_0x5a0e('0x3d')]:_0x56214b[_0x5a0e('0x40')];if(_0x3e0b8d[_0x5a0e('0x39')][_0x5a0e('0x4c')]){_0x287e4b[_0x5a0e('0x52')]=[{'all':!![]}];}_0x287e4b=_[_0x5a0e('0x45')]({},_0x287e4b,_0x3e0b8d[_0x5a0e('0x4a')]);return db[_0x5a0e('0x36')][_0x5a0e('0x53')](_0x287e4b)[_0x5a0e('0x1d')](handleEntityNotFound(_0x41eefe,null))['then'](respondWithResult(_0x41eefe,null))[_0x5a0e('0x28')](handleError(_0x41eefe,null));};exports[_0x5a0e('0x54')]=function(_0x227a4b,_0x1cdf41){if(_0x227a4b['body']['id']){delete _0x227a4b[_0x5a0e('0x55')]['id'];}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x227a4b[_0x5a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cdf41,null))[_0x5a0e('0x1d')](saveUpdates(_0x227a4b[_0x5a0e('0x55')],null))[_0x5a0e('0x1d')](respondWithResult(_0x1cdf41,null))[_0x5a0e('0x28')](handleError(_0x1cdf41,null));};exports[_0x5a0e('0x56')]=function(_0x2018eb,_0x4655d3,_0x4aab96){if(_0x2018eb[_0x5a0e('0x57')]&&_0x2018eb[_0x5a0e('0x57')][_0x5a0e('0x58')]){_0x2018eb[_0x5a0e('0x55')]['logo']=_0x2018eb[_0x5a0e('0x57')]['filename'];}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x2018eb[_0x5a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x4655d3,null))[_0x5a0e('0x1d')](saveUpdates(_0x2018eb[_0x5a0e('0x55')],null))['then'](respondWithResult(_0x4655d3,null))[_0x5a0e('0x28')](handleError(_0x4655d3,null));};exports[_0x5a0e('0x59')]=function(_0x2508ad,_0x54abd0,_0x58a6e9){if(_0x2508ad[_0x5a0e('0x57')]&&_0x2508ad['file'][_0x5a0e('0x58')]){_0x2508ad[_0x5a0e('0x55')][_0x5a0e('0x5a')]=_0x2508ad['file']['filename'];}return db['Setting'][_0x5a0e('0x53')]({'where':{'id':_0x2508ad[_0x5a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x54abd0,null))[_0x5a0e('0x1d')](saveUpdates(_0x2508ad[_0x5a0e('0x55')],null))[_0x5a0e('0x1d')](respondWithResult(_0x54abd0,null))[_0x5a0e('0x28')](handleError(_0x54abd0,null));};var utilLicense=require(_0x5a0e('0x19'));exports[_0x5a0e('0x5b')]=function(_0x10702d,_0x246910,_0x1f24fc){var _0x39e708='server/files/images/logos';var _0xdef473={'custom':![]};return utilLicense[_0x5a0e('0x5c')]()['then'](function(_0x4f9cfb){if(_0x4f9cfb){_0xdef473=_0x4f9cfb;}return db['Setting'][_0x5a0e('0x53')]({'where':{'id':_0x10702d['params']['id']},'attributes':['logo',_0x5a0e('0x5a'),_0x5a0e('0x5d'),'favicon',_0x5a0e('0x5e'),_0x5a0e('0x5f'),_0x5a0e('0x60'),_0x5a0e('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x246910,null))[_0x5a0e('0x1d')](function(_0x3ab3d2){if(_0x3ab3d2){var _0x15dbb1=_0x3ab3d2['logo']&&fs['existsSync'](path[_0x5a0e('0x62')](config['root'],_0x39e708,_[_0x5a0e('0x63')](_0x3ab3d2[_0x5a0e('0x64')])))?path[_0x5a0e('0x62')](config['root'],_0x39e708,_[_0x5a0e('0x63')](_0x3ab3d2[_0x5a0e('0x64')])):path['join'](config[_0x5a0e('0x65')],_0x39e708,_[_0x5a0e('0x63')]('default_logo.svg'));var _0xf4a84c='default'+_[_0x5a0e('0x66')](_0x5a0e('0x64'));if(_0x3ab3d2[_0xf4a84c]||!_0xdef473[_0x5a0e('0x67')]){_0x15dbb1=path[_0x5a0e('0x62')](config[_0x5a0e('0x65')],_0x39e708,_[_0x5a0e('0x63')](_0x5a0e('0x68')));}if(!fs[_0x5a0e('0x69')](_0x15dbb1)){throw new db[(_0x5a0e('0x6a'))][(_0x5a0e('0x6b'))](_[_0x5a0e('0x66')]('logo')+_0x5a0e('0x6c'));}return _0x246910['download'](_0x15dbb1);}})[_0x5a0e('0x28')](handleError(_0x246910,null));};var utilLicense=require(_0x5a0e('0x19'));exports['getLogoLogin']=function(_0x36c5ac,_0x514d37,_0x528bd2){var _0x2fb88a=_0x5a0e('0x6d');var _0x179987={'custom':![]};return utilLicense[_0x5a0e('0x5c')]()[_0x5a0e('0x1d')](function(_0x2b049f){if(_0x2b049f){_0x179987=_0x2b049f;}return db['Setting'][_0x5a0e('0x53')]({'where':{'id':_0x36c5ac[_0x5a0e('0x50')]['id']},'attributes':[_0x5a0e('0x64'),'loginLogo',_0x5a0e('0x5d'),_0x5a0e('0x6e'),_0x5a0e('0x5e'),_0x5a0e('0x5f'),_0x5a0e('0x60'),_0x5a0e('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x514d37,null))['then'](function(_0xff7cd0){if(_0xff7cd0){var _0x1dee6b=_0xff7cd0[_0x5a0e('0x5a')]&&fs[_0x5a0e('0x69')](path['join'](config['root'],_0x2fb88a,_['toLower'](_0xff7cd0[_0x5a0e('0x5a')])))?path[_0x5a0e('0x62')](config['root'],_0x2fb88a,_[_0x5a0e('0x63')](_0xff7cd0['loginLogo'])):path[_0x5a0e('0x62')](config['root'],_0x2fb88a,_[_0x5a0e('0x63')](_0x5a0e('0x6f')));var _0x24ea4e='default'+_[_0x5a0e('0x66')](_0x5a0e('0x5a'));if(_0xff7cd0[_0x24ea4e]||!_0x179987[_0x5a0e('0x67')]){_0x1dee6b=path['join'](config[_0x5a0e('0x65')],_0x2fb88a,_['toLower'](_0x5a0e('0x6f')));}if(!fs[_0x5a0e('0x69')](_0x1dee6b)){throw new db[(_0x5a0e('0x6a'))][(_0x5a0e('0x6b'))](_['upperFirst'](_0x5a0e('0x5a'))+_0x5a0e('0x6c'));}return _0x514d37[_0x5a0e('0x70')](_0x1dee6b);}})[_0x5a0e('0x28')](handleError(_0x514d37,null));};exports[_0x5a0e('0x71')]=function(_0x57a770,_0x25da6f){return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x57a770[_0x5a0e('0x50')]['id']},'attributes':[_0x5a0e('0x72')]})[_0x5a0e('0x1d')](respondWithResult(_0x25da6f,null))[_0x5a0e('0x28')](handleError(_0x25da6f,null));};exports[_0x5a0e('0x73')]=function(_0x3c8822,_0x54abe3,_0x22dbf3){if(_0x3c8822[_0x5a0e('0x57')]&&_0x3c8822[_0x5a0e('0x57')][_0x5a0e('0x58')]){_0x3c8822[_0x5a0e('0x55')][_0x5a0e('0x5d')]=_0x3c8822['file']['filename'];}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x3c8822[_0x5a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x54abe3,null))['then'](saveUpdates(_0x3c8822['body'],null))[_0x5a0e('0x1d')](respondWithResult(_0x54abe3,null))[_0x5a0e('0x28')](handleError(_0x54abe3,null));};var utilLicense=require('../../config/license/util');exports[_0x5a0e('0x74')]=function(_0x120383,_0x317e1f,_0x4534fe){var _0x3c2569=_0x5a0e('0x6d');var _0x358093={'custom':![]};return utilLicense[_0x5a0e('0x5c')]()['then'](function(_0x4a2559){if(_0x4a2559){_0x358093=_0x4a2559;}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x120383['params']['id']},'attributes':['logo','loginLogo',_0x5a0e('0x5d'),'favicon',_0x5a0e('0x5e'),_0x5a0e('0x5f'),_0x5a0e('0x60'),_0x5a0e('0x61')],'raw':!![]});})[_0x5a0e('0x1d')](handleEntityNotFound(_0x317e1f,null))[_0x5a0e('0x1d')](function(_0x1b5293){if(_0x1b5293){var _0x300f2f=_0x1b5293['preferred']&&fs['existsSync'](path[_0x5a0e('0x62')](config[_0x5a0e('0x65')],_0x3c2569,_[_0x5a0e('0x63')](_0x1b5293['preferred'])))?path[_0x5a0e('0x62')](config[_0x5a0e('0x65')],_0x3c2569,_[_0x5a0e('0x63')](_0x1b5293[_0x5a0e('0x5d')])):path[_0x5a0e('0x62')](config['root'],_0x3c2569,_['toLower'](_0x5a0e('0x75')));var _0x2a22aa=_0x5a0e('0x76')+_[_0x5a0e('0x66')](_0x5a0e('0x5d'));if(_0x1b5293[_0x2a22aa]||!_0x358093[_0x5a0e('0x67')]||!_0x358093[_0x5a0e('0x5d')]){_0x300f2f=path[_0x5a0e('0x62')](config['root'],_0x3c2569,_[_0x5a0e('0x63')](_0x5a0e('0x75')));}if(!fs[_0x5a0e('0x69')](_0x300f2f)){throw new db[(_0x5a0e('0x6a'))][(_0x5a0e('0x6b'))](_[_0x5a0e('0x66')](_0x5a0e('0x5d'))+_0x5a0e('0x6c'));}return _0x317e1f['download'](_0x300f2f);}})['catch'](handleError(_0x317e1f,null));};exports[_0x5a0e('0x77')]=function(_0x4499a7,_0x5e0537,_0x8eb9bf){if(_0x4499a7[_0x5a0e('0x57')]&&_0x4499a7[_0x5a0e('0x57')][_0x5a0e('0x58')]){_0x4499a7[_0x5a0e('0x55')]['favicon']=_0x4499a7[_0x5a0e('0x57')][_0x5a0e('0x58')];}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x4499a7[_0x5a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e0537,null))[_0x5a0e('0x1d')](saveUpdates(_0x4499a7['body'],null))[_0x5a0e('0x1d')](respondWithResult(_0x5e0537,null))[_0x5a0e('0x28')](handleError(_0x5e0537,null));};var utilLicense=require(_0x5a0e('0x19'));exports[_0x5a0e('0x78')]=function(_0x3ca7c5,_0x4842bc,_0x3be88d){var _0x5f3adc=_0x5a0e('0x6d');var _0x281813={'custom':![]};return utilLicense[_0x5a0e('0x5c')]()['then'](function(_0x48d56f){if(_0x48d56f){_0x281813=_0x48d56f;}return db[_0x5a0e('0x36')][_0x5a0e('0x53')]({'where':{'id':_0x3ca7c5[_0x5a0e('0x50')]['id']},'attributes':[_0x5a0e('0x64'),_0x5a0e('0x5a'),_0x5a0e('0x5d'),_0x5a0e('0x6e'),_0x5a0e('0x5e'),'defaultLoginLogo',_0x5a0e('0x60'),'defaultFavicon'],'raw':!![]});})[_0x5a0e('0x1d')](handleEntityNotFound(_0x4842bc,null))['then'](function(_0x24693f){if(_0x24693f){var _0x7da9b0=_0x24693f[_0x5a0e('0x6e')]&&fs['existsSync'](path[_0x5a0e('0x62')](config['root'],_0x5f3adc,_['toLower'](_0x24693f['favicon'])))?path['join'](config[_0x5a0e('0x65')],_0x5f3adc,_[_0x5a0e('0x63')](_0x24693f[_0x5a0e('0x6e')])):path[_0x5a0e('0x62')](config[_0x5a0e('0x65')],_0x5f3adc,_[_0x5a0e('0x63')](_0x5a0e('0x79')));var _0x61256='default'+_[_0x5a0e('0x66')](_0x5a0e('0x6e'));if(_0x24693f[_0x61256]||!_0x281813[_0x5a0e('0x67')]){_0x7da9b0=path[_0x5a0e('0x62')](config[_0x5a0e('0x65')],_0x5f3adc,_[_0x5a0e('0x63')]('default_favicon.ico'));}if(!fs[_0x5a0e('0x69')](_0x7da9b0)){throw new db[(_0x5a0e('0x6a'))][(_0x5a0e('0x6b'))](_[_0x5a0e('0x66')](_0x5a0e('0x6e'))+_0x5a0e('0x6c'));}return _0x4842bc[_0x5a0e('0x70')](_0x7da9b0);}})[_0x5a0e('0x28')](handleError(_0x4842bc,null));};exports[_0x5a0e('0x7a')]=function(_0x542e58,_0x2672bb){var _0x94b452={'offset':moment()[_0x5a0e('0x7b')]()};_0x94b452['now']=moment()['utcOffset'](_0x94b452['offset'])[_0x5a0e('0x7c')](_0x5a0e('0x7d'));return _0x2672bb['status'](0xc8)[_0x5a0e('0x7e')](_0x94b452);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 75c93b3..c976b7c 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x57408b,_0xb7cbc5){var _0x31a897=function(_0x5810ac){while(--_0x5810ac){_0x57408b['push'](_0x57408b['shift']());}};_0x31a897(++_0xb7cbc5);}(_0x008c,0x188));var _0xc008=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0x008c[_0x770f7];return _0xe797c6;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'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 68c093c..22f692e 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 _0x2d96=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Setting,\x20%s,\x20%s','catch','find','options','raw','attributes','include','map','model','ShowSetting','stringify'];(function(_0x2cdff4,_0x161af6){var _0x22b2ab=function(_0x57064a){while(--_0x57064a){_0x2cdff4['push'](_0x2cdff4['shift']());}};_0x22b2ab(++_0x161af6);}(_0x2d96,0x134));var _0x62d9=function(_0x57f9ac,_0x57c899){_0x57f9ac=_0x57f9ac-0x0;var _0x57dba3=_0x2d96[_0x57f9ac];return _0x57dba3;};'use strict';var _=require(_0x62d9('0x0'));var util=require('util');var moment=require(_0x62d9('0x1'));var BPromise=require(_0x62d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62d9('0x3'));var db=require(_0x62d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x62d9('0x5'))(_0x62d9('0x6'));var config=require('../../config/environment');var jayson=require(_0x62d9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eafa9,_0x2b62d4,_0x238195){return new BPromise(function(_0x2e3952,_0x772697){return client[_0x62d9('0x8')](_0x1eafa9,_0x238195)[_0x62d9('0x9')](function(_0x7a0df1){logger[_0x62d9('0xa')]('Setting,\x20%s,\x20%s',_0x2b62d4,'request\x20sent');logger[_0x62d9('0xb')](_0x62d9('0xc'),_0x2b62d4,_0x62d9('0xd'),JSON['stringify'](_0x7a0df1));if(_0x7a0df1[_0x62d9('0xe')]){if(_0x7a0df1['error'][_0x62d9('0xf')]===0x1f4){logger[_0x62d9('0xe')]('Setting,\x20%s,\x20%s',_0x2b62d4,_0x7a0df1[_0x62d9('0xe')][_0x62d9('0x10')]);return _0x772697(_0x7a0df1[_0x62d9('0xe')][_0x62d9('0x10')]);}logger[_0x62d9('0xe')](_0x62d9('0x11'),_0x2b62d4,_0x7a0df1[_0x62d9('0xe')][_0x62d9('0x10')]);return _0x2e3952(_0x7a0df1['error'][_0x62d9('0x10')]);}else{logger[_0x62d9('0xa')](_0x62d9('0x11'),_0x2b62d4,_0x62d9('0xd'));_0x2e3952(_0x7a0df1['result'][_0x62d9('0x10')]);}})[_0x62d9('0x12')](function(_0x2dccb8){logger[_0x62d9('0xe')](_0x62d9('0x11'),_0x2b62d4,_0x2dccb8);_0x772697(_0x2dccb8);});});}exports['ShowSetting']=function(_0x4d31aa){var _0x2bd002=this;return new Promise(function(_0x3b9768,_0x5db206){return db['Setting'][_0x62d9('0x13')]({'raw':_0x4d31aa[_0x62d9('0x14')]?_0x4d31aa[_0x62d9('0x14')][_0x62d9('0x15')]===undefined?!![]:![]:!![],'where':_0x4d31aa[_0x62d9('0x14')]?_0x4d31aa[_0x62d9('0x14')]['where']||null:null,'attributes':_0x4d31aa[_0x62d9('0x14')]?_0x4d31aa[_0x62d9('0x14')][_0x62d9('0x16')]||null:null,'include':_0x4d31aa['options']?_0x4d31aa['options'][_0x62d9('0x17')]?_[_0x62d9('0x18')](_0x4d31aa[_0x62d9('0x14')][_0x62d9('0x17')],function(_0x10f522){return{'model':db[_0x10f522['model']],'as':_0x10f522['as'],'attributes':_0x10f522[_0x62d9('0x16')],'include':_0x10f522[_0x62d9('0x17')]?_['map'](_0x10f522['include'],function(_0x503440){return{'model':db[_0x503440[_0x62d9('0x19')]],'as':_0x503440['as'],'attributes':_0x503440[_0x62d9('0x16')],'include':_0x503440[_0x62d9('0x17')]?_['map'](_0x503440[_0x62d9('0x17')],function(_0x252bc0){return{'model':db[_0x252bc0[_0x62d9('0x19')]],'as':_0x252bc0['as'],'attributes':_0x252bc0[_0x62d9('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x571bbb){logger['info']('ShowSetting',_0x4d31aa);logger[_0x62d9('0xb')](_0x62d9('0x1a'),_0x4d31aa,JSON[_0x62d9('0x1b')](_0x571bbb));_0x3b9768(_0x571bbb);})[_0x62d9('0x12')](function(_0x2c5a42){logger[_0x62d9('0xe')](_0x62d9('0x1a'),_0x2c5a42[_0x62d9('0x10')],_0x4d31aa);_0x5db206(_0x2bd002[_0x62d9('0xe')](0x1f4,_0x2c5a42[_0x62d9('0x10')]));});});}; \ No newline at end of file +var _0x61c1=['then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41249e,_0x275d84){var _0x2bff48=function(_0x33a84d){while(--_0x33a84d){_0x41249e['push'](_0x41249e['shift']());}};_0x2bff48(++_0x275d84);}(_0x61c1,0x82));var _0x161c=function(_0x3ec10d,_0x292ab5){_0x3ec10d=_0x3ec10d-0x0;var _0x9b5ebf=_0x61c1[_0x3ec10d];return _0x9b5ebf;};'use strict';var _=require(_0x161c('0x0'));var util=require(_0x161c('0x1'));var moment=require('moment');var BPromise=require(_0x161c('0x2'));var rs=require(_0x161c('0x3'));var fs=require('fs');var Redis=require(_0x161c('0x4'));var db=require(_0x161c('0x5'))['db'];var utils=require(_0x161c('0x6'));var logger=require(_0x161c('0x7'))(_0x161c('0x8'));var config=require(_0x161c('0x9'));var jayson=require(_0x161c('0xa'));var client=jayson[_0x161c('0xb')][_0x161c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c83fb,_0x530910,_0x1a5060){return new BPromise(function(_0x184010,_0xf3d8fc){return client[_0x161c('0xd')](_0x5c83fb,_0x1a5060)[_0x161c('0xe')](function(_0x583aed){logger[_0x161c('0xf')](_0x161c('0x10'),_0x530910,_0x161c('0x11'));logger['debug'](_0x161c('0x12'),_0x530910,'request\x20sent',JSON[_0x161c('0x13')](_0x583aed));if(_0x583aed[_0x161c('0x14')]){if(_0x583aed[_0x161c('0x14')][_0x161c('0x15')]===0x1f4){logger[_0x161c('0x14')](_0x161c('0x10'),_0x530910,_0x583aed[_0x161c('0x14')][_0x161c('0x16')]);return _0xf3d8fc(_0x583aed[_0x161c('0x14')][_0x161c('0x16')]);}logger[_0x161c('0x14')](_0x161c('0x10'),_0x530910,_0x583aed[_0x161c('0x14')][_0x161c('0x16')]);return _0x184010(_0x583aed[_0x161c('0x14')][_0x161c('0x16')]);}else{logger[_0x161c('0xf')]('Setting,\x20%s,\x20%s',_0x530910,'request\x20sent');_0x184010(_0x583aed[_0x161c('0x17')][_0x161c('0x16')]);}})[_0x161c('0x18')](function(_0x14bfa1){logger[_0x161c('0x14')](_0x161c('0x10'),_0x530910,_0x14bfa1);_0xf3d8fc(_0x14bfa1);});});}exports[_0x161c('0x19')]=function(_0xd70cb7){var _0xe66493=this;return new Promise(function(_0x6105ed,_0x64a602){return db[_0x161c('0x1a')][_0x161c('0x1b')]({'raw':_0xd70cb7[_0x161c('0x1c')]?_0xd70cb7[_0x161c('0x1c')][_0x161c('0x1d')]===undefined?!![]:![]:!![],'where':_0xd70cb7['options']?_0xd70cb7[_0x161c('0x1c')][_0x161c('0x1e')]||null:null,'attributes':_0xd70cb7['options']?_0xd70cb7[_0x161c('0x1c')][_0x161c('0x1f')]||null:null,'include':_0xd70cb7[_0x161c('0x1c')]?_0xd70cb7[_0x161c('0x1c')][_0x161c('0x20')]?_[_0x161c('0x21')](_0xd70cb7[_0x161c('0x1c')][_0x161c('0x20')],function(_0x52eac0){return{'model':db[_0x52eac0[_0x161c('0x22')]],'as':_0x52eac0['as'],'attributes':_0x52eac0[_0x161c('0x1f')],'include':_0x52eac0[_0x161c('0x20')]?_[_0x161c('0x21')](_0x52eac0[_0x161c('0x20')],function(_0x477683){return{'model':db[_0x477683[_0x161c('0x22')]],'as':_0x477683['as'],'attributes':_0x477683['attributes'],'include':_0x477683[_0x161c('0x20')]?_[_0x161c('0x21')](_0x477683[_0x161c('0x20')],function(_0x55bf76){return{'model':db[_0x55bf76[_0x161c('0x22')]],'as':_0x55bf76['as'],'attributes':_0x55bf76[_0x161c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x161c('0xe')](function(_0x498d4d){logger[_0x161c('0xf')]('ShowSetting',_0xd70cb7);logger[_0x161c('0x23')](_0x161c('0x19'),_0xd70cb7,JSON['stringify'](_0x498d4d));_0x6105ed(_0x498d4d);})['catch'](function(_0x2ff9c8){logger[_0x161c('0x14')](_0x161c('0x19'),_0x2ff9c8[_0x161c('0x16')],_0xd70cb7);_0x64a602(_0xe66493[_0x161c('0x14')](0x1f4,_0x2ff9c8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 1a4e5aa..a88269d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0xa1586,_0x16eb51){var _0x19576e=function(_0x3906ea){while(--_0x3906ea){_0xa1586['push'](_0xa1586['shift']());}};_0x19576e(++_0x16eb51);}(_0x7a54,0x106));var _0x47a5=function(_0x3eaef2,_0x3c668c){_0x3eaef2=_0x3eaef2-0x0;var _0x48cb9a=_0x7a54[_0x3eaef2];return _0x48cb9a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x41935b,_0x34c738){var _0xb4518=function(_0x1baf6f){while(--_0x1baf6f){_0x41935b['push'](_0x41935b['shift']());}};_0xb4518(++_0x34c738);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 71f265b..896b5de 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 _0xc506=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1e20f4,_0x103413){var _0x7d34cd=function(_0x51f50f){while(--_0x51f50f){_0x1e20f4['push'](_0x1e20f4['shift']());}};_0x7d34cd(++_0x103413);}(_0xc506,0x131));var _0x6c50=function(_0x452ad3,_0x3e5ca8){_0x452ad3=_0x452ad3-0x0;var _0x349222=_0xc506[_0x452ad3];return _0x349222;};'use strict';var Sequelize=require(_0x6c50('0x0'));var rs=require(_0x6c50('0x1'));module[_0x6c50('0x2')]={'name':{'type':Sequelize[_0x6c50('0x3')],'unique':_0x6c50('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6c50('0x3')],'defaultValue':function(){return rs[_0x6c50('0x5')]();}},'phone':{'type':Sequelize[_0x6c50('0x3')]},'type':{'type':Sequelize[_0x6c50('0x6')](_0x6c50('0x7'),_0x6c50('0x8'),_0x6c50('0x9'),'clicksend',_0x6c50('0xa'),_0x6c50('0xb'),'bandwidth','csc',_0x6c50('0xc'),_0x6c50('0xd'))},'accountSid':{'type':Sequelize[_0x6c50('0x3')]},'authId':{'type':Sequelize[_0x6c50('0x3')]},'authToken':{'type':Sequelize[_0x6c50('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6c50('0x3')]},'apiKey':{'type':Sequelize[_0x6c50('0x3')]},'applicationId':{'type':Sequelize[_0x6c50('0x3')]},'accountId':{'type':Sequelize[_0x6c50('0x3')]},'senderString':{'type':Sequelize[_0x6c50('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x6c50('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6c50('0xe')],'defaultValue':function(){return _0x6c50('0xf');}},'notificationSound':{'type':Sequelize[_0x6c50('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c50('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6c50('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c50('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6c50('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c50('0x11')],'comment':_0x6c50('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6c50('0x10')],'defaultValue':![],'comment':_0x6c50('0x13'),'set':function(_0x55dec9){if(!_0x55dec9)this['setDataValue'](_0x6c50('0x14'),null);this[_0x6c50('0x15')](_0x6c50('0x16'),_0x55dec9);}}}; \ No newline at end of file +var _0x0046=['clicksend','clickatell','bandwidth','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','twilio','skebby','connectel'];(function(_0x5f25e6,_0x4b1319){var _0x29c892=function(_0x274d7c){while(--_0x274d7c){_0x5f25e6['push'](_0x5f25e6['shift']());}};_0x29c892(++_0x4b1319);}(_0x0046,0x161));var _0x6004=function(_0x16311d,_0x3563ed){_0x16311d=_0x16311d-0x0;var _0x21bf6d=_0x0046[_0x16311d];return _0x21bf6d;};'use strict';var Sequelize=require(_0x6004('0x0'));var rs=require('randomstring');module[_0x6004('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6004('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6004('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6004('0x2')],'defaultValue':function(){return rs[_0x6004('0x3')]();}},'phone':{'type':Sequelize[_0x6004('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6004('0x4'),_0x6004('0x5'),_0x6004('0x6'),_0x6004('0x7'),'plivo',_0x6004('0x8'),_0x6004('0x9'),_0x6004('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x6004('0x2')]},'authId':{'type':Sequelize[_0x6004('0x2')]},'authToken':{'type':Sequelize[_0x6004('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6004('0x2')]},'apiKey':{'type':Sequelize[_0x6004('0x2')]},'applicationId':{'type':Sequelize[_0x6004('0x2')]},'accountId':{'type':Sequelize[_0x6004('0x2')]},'senderString':{'type':Sequelize[_0x6004('0x2')]},'deliveryReport':{'type':Sequelize[_0x6004('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6004('0xc')],'defaultValue':function(){return _0x6004('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6004('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6004('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6004('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6004('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6004('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6004('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6004('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6004('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x6004('0xb')],'defaultValue':![],'comment':_0x6004('0x10'),'set':function(_0xa6bd14){if(!_0xa6bd14)this[_0x6004('0x11')](_0x6004('0x12'),null);this['setDataValue'](_0x6004('0x13'),_0xa6bd14);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f1708d1..26c209f 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 _0x5c52=['redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','then','info','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','findOne','Disposition','sort','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','skebby','sender','text','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','*,*,*,*','receiveMessage','entity\x20found','debug','twilio','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Owner','fullname','Tag','Tags','tag','rows','List','defaults','ListId','out','Messages','dataValues','push','SmsAccount,\x20%s,\x20%s,\x20%s','connectel','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x4b1531,_0x4bd920){var _0x1c944b=function(_0x1aafb0){while(--_0x1aafb0){_0x4b1531['push'](_0x4b1531['shift']());}};_0x1c944b(++_0x4bd920);}(_0x5c52,0xc7));var _0x25c5=function(_0x1b81d3,_0x345aa3){_0x1b81d3=_0x1b81d3-0x0;var _0x27ee7e=_0x5c52[_0x1b81d3];return _0x27ee7e;};'use strict';var emlformat=require(_0x25c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25c5('0x1'));var jsonpatch=require(_0x25c5('0x2'));var rp=require(_0x25c5('0x3'));var moment=require(_0x25c5('0x4'));var BPromise=require(_0x25c5('0x5'));var Mustache=require(_0x25c5('0x6'));var util=require(_0x25c5('0x7'));var path=require(_0x25c5('0x8'));var sox=require(_0x25c5('0x9'));var csv=require('to-csv');var ejs=require(_0x25c5('0xa'));var fs=require('fs');var fs_extra=require(_0x25c5('0xb'));var _=require('lodash');var squel=require(_0x25c5('0xc'));var crypto=require(_0x25c5('0xd'));var jsforce=require(_0x25c5('0xe'));var deskjs=require(_0x25c5('0xf'));var toCsv=require(_0x25c5('0x10'));var querystring=require(_0x25c5('0x11'));var Papa=require(_0x25c5('0x12'));var Redis=require(_0x25c5('0x13'));var authService=require(_0x25c5('0x14'));var qs=require(_0x25c5('0x15'));var as=require(_0x25c5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25c5('0x17'))('api');var utils=require(_0x25c5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x25c5('0x19'));var db=require('../../mysqldb')['db'];config[_0x25c5('0x1a')]=_['defaults'](config[_0x25c5('0x1a')],{'host':_0x25c5('0x1b'),'port':0x18eb});var socket=require(_0x25c5('0x1c'))(new Redis(config[_0x25c5('0x1a')]));require(_0x25c5('0x1d'))[_0x25c5('0x1e')](socket);var jayson=require(_0x25c5('0x1f'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2a70b1,_0x1f4ac9,_0x51a0aa,_0x4051f4){return new BPromise(function(_0x31af39,_0x1a7a08){var _0x473f92=_0x4051f4||client;return _0x473f92['request'](_0x2a70b1,_0x51a0aa)[_0x25c5('0x20')](function(_0x305f79){logger[_0x25c5('0x21')]('SmsAccount,\x20%s,\x20%s',_0x1f4ac9,_0x25c5('0x22'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1f4ac9,_0x25c5('0x22'),JSON[_0x25c5('0x23')](_0x305f79));if(_0x305f79[_0x25c5('0x24')]){if(_0x305f79['error']['code']===0x1f4){logger[_0x25c5('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1f4ac9,_0x305f79[_0x25c5('0x24')][_0x25c5('0x25')]);return _0x1a7a08(_0x305f79[_0x25c5('0x24')][_0x25c5('0x25')]);}logger[_0x25c5('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1f4ac9,_0x305f79[_0x25c5('0x24')][_0x25c5('0x25')]);return _0x31af39(_0x305f79[_0x25c5('0x24')][_0x25c5('0x25')]);}else{logger['info'](_0x25c5('0x26'),_0x1f4ac9,_0x25c5('0x22'));_0x31af39(_0x305f79[_0x25c5('0x27')][_0x25c5('0x25')]);}})[_0x25c5('0x28')](function(_0x52358d){logger[_0x25c5('0x24')](_0x25c5('0x26'),_0x1f4ac9,_0x52358d);_0x1a7a08(_0x52358d);});});}function respondWithStatusCode(_0x17c4a3,_0x2b136e){_0x2b136e=_0x2b136e||0xcc;return function(_0x3c00ee){if(_0x3c00ee){return _0x17c4a3['sendStatus'](_0x2b136e);}return _0x17c4a3[_0x25c5('0x29')](_0x2b136e)[_0x25c5('0x2a')]();};}function respondWithResult(_0x2eb301,_0x264312){_0x264312=_0x264312||0xc8;return function(_0x557c00){if(_0x557c00){return _0x2eb301[_0x25c5('0x29')](_0x264312)[_0x25c5('0x2b')](_0x557c00);}};}function respondWithFilteredResult(_0x21aa22,_0x24bf82){return function(_0x21ff10){if(_0x21ff10){var _0x4743d5=typeof _0x24bf82[_0x25c5('0x2c')]===_0x25c5('0x2d')&&typeof _0x24bf82[_0x25c5('0x2e')]===_0x25c5('0x2d');var _0xfdb3f4=_0x21ff10[_0x25c5('0x2f')];var _0x289dc2=_0x4743d5?0x0:_0x24bf82[_0x25c5('0x2c')];var _0x2a9914=_0x4743d5?_0x21ff10[_0x25c5('0x2f')]:_0x24bf82[_0x25c5('0x2c')]+_0x24bf82[_0x25c5('0x2e')];var _0x30e8ea;if(_0x2a9914>=_0xfdb3f4){_0x2a9914=_0xfdb3f4;_0x30e8ea=0xc8;}else{_0x30e8ea=0xce;}_0x21aa22['status'](_0x30e8ea);return _0x21aa22['set'](_0x25c5('0x30'),_0x289dc2+'-'+_0x2a9914+'/'+_0xfdb3f4)[_0x25c5('0x2b')](_0x21ff10);}return null;};}function patchUpdates(_0x257879){return function(_0x598e76){try{jsonpatch[_0x25c5('0x31')](_0x598e76,_0x257879,!![]);}catch(_0x1f80a3){return BPromise[_0x25c5('0x32')](_0x1f80a3);}return _0x598e76[_0x25c5('0x33')]();};}function saveUpdates(_0x24fe7c,_0x516526){return function(_0x380f91){if(_0x380f91){return _0x380f91[_0x25c5('0x34')](_0x24fe7c)[_0x25c5('0x20')](function(_0x9ce908){return _0x9ce908;});}return null;};}function removeEntity(_0x1b8717,_0x539603){return function(_0x1d080a){if(_0x1d080a){return _0x1d080a[_0x25c5('0x35')]()[_0x25c5('0x20')](function(){var _0x495068=_0x1d080a[_0x25c5('0x36')]({'plain':!![]});var _0x5d3e77=_0x25c5('0x37');return db[_0x25c5('0x38')][_0x25c5('0x35')]({'where':{'type':_0x5d3e77,'resourceId':_0x495068['id']}})[_0x25c5('0x20')](function(){return _0x1d080a;});})[_0x25c5('0x20')](function(){_0x1b8717[_0x25c5('0x29')](0xcc)[_0x25c5('0x2a')]();});}};}function handleEntityNotFound(_0x48b495,_0xa642df){return function(_0x332db6){if(!_0x332db6){_0x48b495[_0x25c5('0x39')](0x194);}return _0x332db6;};}function handleError(_0x168d58,_0x532b1d){_0x532b1d=_0x532b1d||0x1f4;return function(_0x4a0bad){logger[_0x25c5('0x24')](_0x4a0bad[_0x25c5('0x3a')]);if(_0x4a0bad[_0x25c5('0x3b')]){delete _0x4a0bad[_0x25c5('0x3b')];}_0x168d58[_0x25c5('0x29')](_0x532b1d)[_0x25c5('0x3c')](_0x4a0bad);};}exports[_0x25c5('0x3d')]=function(_0xffec88,_0x149c5d){var _0x14e2f4={'include':[{'model':db[_0x25c5('0x3e')],'as':_0x25c5('0x3f')}]},_0x495775={},_0x1531e0={'count':0x0,'rows':[]};var _0x234660=_[_0x25c5('0x40')](db[_0x25c5('0x41')][_0x25c5('0x42')],function(_0x4ae5af){return{'name':_0x4ae5af['fieldName'],'type':_0x4ae5af[_0x25c5('0x43')][_0x25c5('0x44')]};});_0x495775['model']=_[_0x25c5('0x40')](_0x234660,'name');_0x495775[_0x25c5('0x45')]=_[_0x25c5('0x46')](_0xffec88['query']);_0x495775[_0x25c5('0x47')]=_['intersection'](_0x495775[_0x25c5('0x48')],_0x495775['query']);_0x14e2f4[_0x25c5('0x49')]=_[_0x25c5('0x4a')](_0x495775[_0x25c5('0x48')],qs[_0x25c5('0x4b')](_0xffec88['query'][_0x25c5('0x4b')]));_0x14e2f4[_0x25c5('0x49')]=_0x14e2f4[_0x25c5('0x49')][_0x25c5('0x4c')]?_0x14e2f4[_0x25c5('0x49')]:_0x495775[_0x25c5('0x48')];if(!_0xffec88[_0x25c5('0x45')][_0x25c5('0x4d')](_0x25c5('0x4e'))){_0x14e2f4[_0x25c5('0x2e')]=qs[_0x25c5('0x2e')](_0xffec88[_0x25c5('0x45')][_0x25c5('0x2e')]);_0x14e2f4[_0x25c5('0x2c')]=qs['offset'](_0xffec88[_0x25c5('0x45')]['offset']);}_0x14e2f4[_0x25c5('0x4f')]=qs['sort'](_0xffec88['query']['sort']);_0x14e2f4[_0x25c5('0x50')]=qs[_0x25c5('0x47')](_[_0x25c5('0x51')](_0xffec88[_0x25c5('0x45')],_0x495775[_0x25c5('0x47')]),_0x234660);if(_0xffec88[_0x25c5('0x45')][_0x25c5('0x52')]){_0x14e2f4['where']=_[_0x25c5('0x53')](_0x14e2f4[_0x25c5('0x50')],{'$or':_['map'](_0x234660,function(_0x1f52c8){if(_0x1f52c8['type']!==_0x25c5('0x54')){var _0x510f2b={};_0x510f2b[_0x1f52c8[_0x25c5('0x3b')]]={'$like':'%'+_0xffec88[_0x25c5('0x45')][_0x25c5('0x52')]+'%'};return _0x510f2b;}})});}_0x14e2f4=_['merge']({},_0x14e2f4,_0xffec88[_0x25c5('0x55')]);var _0xc5a300={'where':_0x14e2f4[_0x25c5('0x50')]};return db[_0x25c5('0x41')][_0x25c5('0x2f')](_0xc5a300)[_0x25c5('0x20')](function(_0x5883d6){_0x1531e0[_0x25c5('0x2f')]=_0x5883d6;if(_0xffec88[_0x25c5('0x45')]['includeAll']){_0x14e2f4[_0x25c5('0x56')]=[{'all':!![]}];}return db[_0x25c5('0x41')][_0x25c5('0x57')](_0x14e2f4);})['then'](function(_0x1d8de4){_0x1531e0['rows']=_0x1d8de4;return _0x1531e0;})['then'](respondWithFilteredResult(_0x149c5d,_0x14e2f4))[_0x25c5('0x28')](handleError(_0x149c5d,null));};exports[_0x25c5('0x58')]=function(_0x1b5a1f,_0x268893){var _0x241b0f={'raw':![],'where':{'id':_0x1b5a1f['params']['id']},'include':[{'model':db[_0x25c5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5467aa={};_0x5467aa[_0x25c5('0x48')]=_[_0x25c5('0x46')](db[_0x25c5('0x41')]['rawAttributes']);_0x5467aa[_0x25c5('0x45')]=_[_0x25c5('0x46')](_0x1b5a1f[_0x25c5('0x45')]);_0x5467aa[_0x25c5('0x47')]=_['intersection'](_0x5467aa[_0x25c5('0x48')],_0x5467aa[_0x25c5('0x45')]);_0x241b0f[_0x25c5('0x49')]=_[_0x25c5('0x4a')](_0x5467aa[_0x25c5('0x48')],qs[_0x25c5('0x4b')](_0x1b5a1f['query'][_0x25c5('0x4b')]));_0x241b0f[_0x25c5('0x49')]=_0x241b0f[_0x25c5('0x49')][_0x25c5('0x4c')]?_0x241b0f[_0x25c5('0x49')]:_0x5467aa[_0x25c5('0x48')];if(_0x1b5a1f[_0x25c5('0x45')][_0x25c5('0x59')]){_0x241b0f['include']=[{'all':!![]}];}_0x241b0f=_[_0x25c5('0x53')]({},_0x241b0f,_0x1b5a1f[_0x25c5('0x55')]);return db[_0x25c5('0x41')][_0x25c5('0x5a')](_0x241b0f)[_0x25c5('0x20')](handleEntityNotFound(_0x268893,null))[_0x25c5('0x20')](respondWithResult(_0x268893,null))[_0x25c5('0x28')](handleError(_0x268893,null));};exports[_0x25c5('0x5b')]=function(_0x3cecb0,_0x484404){return db[_0x25c5('0x41')][_0x25c5('0x5b')](_0x3cecb0[_0x25c5('0x5c')],{})['then'](function(_0x17696f){var _0x121399=_0x3cecb0[_0x25c5('0x5d')][_0x25c5('0x36')]({'plain':!![]});if(!_0x121399)throw new Error(_0x25c5('0x5e'));if(_0x121399['role']==='user'){var _0x1b3a76=_0x17696f[_0x25c5('0x36')]({'plain':!![]});var _0x5ca9c4=_0x25c5('0x37');return db[_0x25c5('0x5f')][_0x25c5('0x5a')]({'where':{'name':_0x5ca9c4,'userProfileId':_0x121399[_0x25c5('0x60')]},'raw':!![]})[_0x25c5('0x20')](function(_0x489ab5){if(_0x489ab5&&_0x489ab5[_0x25c5('0x61')]===0x0){return db[_0x25c5('0x38')]['create']({'name':_0x1b3a76[_0x25c5('0x3b')],'resourceId':_0x1b3a76['id'],'type':_0x489ab5['name'],'sectionId':_0x489ab5['id']},{})[_0x25c5('0x20')](function(){return _0x17696f;});}else{return _0x17696f;}})[_0x25c5('0x28')](function(_0x498488){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x498488);throw _0x498488;});}return _0x17696f;})[_0x25c5('0x20')](respondWithResult(_0x484404,0xc9))['catch'](handleError(_0x484404,null));};exports[_0x25c5('0x34')]=function(_0xee3453,_0x13522c){if(_0xee3453[_0x25c5('0x5c')]['id']){delete _0xee3453['body']['id'];}return db[_0x25c5('0x41')][_0x25c5('0x5a')]({'where':{'id':_0xee3453[_0x25c5('0x62')]['id']},'include':[{'model':db[_0x25c5('0x3e')],'as':_0x25c5('0x3f')}]})[_0x25c5('0x20')](handleEntityNotFound(_0x13522c,null))[_0x25c5('0x20')](saveUpdates(_0xee3453[_0x25c5('0x5c')],null))[_0x25c5('0x20')](respondWithResult(_0x13522c,null))['catch'](handleError(_0x13522c,null));};exports[_0x25c5('0x35')]=function(_0x99dbf7,_0x3e37c2){return db[_0x25c5('0x41')]['find']({'where':{'id':_0x99dbf7[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x3e37c2,null))[_0x25c5('0x20')](removeEntity(_0x3e37c2,null))['catch'](handleError(_0x3e37c2,null));};exports[_0x25c5('0x63')]=function(_0x3293be,_0x3e7fcc){return db[_0x25c5('0x41')][_0x25c5('0x63')]()[_0x25c5('0x20')](respondWithResult(_0x3e7fcc,null))[_0x25c5('0x28')](handleError(_0x3e7fcc,null));};exports[_0x25c5('0x64')]=function(_0x327e48,_0xe4f49a,_0x4f0fc0){if(_0x327e48[_0x25c5('0x5c')]['id']){delete _0x327e48['body']['id'];}return db[_0x25c5('0x41')][_0x25c5('0x5a')]({'where':{'id':_0x327e48[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0xe4f49a,null))[_0x25c5('0x20')](function(_0x5b6507){if(_0x5b6507){_0x327e48[_0x25c5('0x5c')]['SmsAccountId']=_0x5b6507['id'];return db['Disposition'][_0x25c5('0x5b')](_0x327e48[_0x25c5('0x5c')]);}})['then'](respondWithResult(_0xe4f49a,null))['catch'](handleError(_0xe4f49a,null));};exports['getDispositions']=function(_0x47df74,_0x5a9bd6,_0x5c7b6e){var _0xa58551={'raw':![],'where':{}};var _0x524aba={};var _0x2bf8e8={'count':0x0,'rows':[]};return db[_0x25c5('0x41')][_0x25c5('0x65')]({'where':{'id':_0x47df74[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x5a9bd6,null))[_0x25c5('0x20')](function(_0x560272){if(_0x560272){_0x524aba[_0x25c5('0x48')]=_['keys'](db[_0x25c5('0x66')][_0x25c5('0x42')]);_0x524aba['query']=_['keys'](_0x47df74[_0x25c5('0x45')]);_0x524aba[_0x25c5('0x47')]=_[_0x25c5('0x4a')](_0x524aba['model'],_0x524aba['query']);_0xa58551[_0x25c5('0x49')]=_['intersection'](_0x524aba['model'],qs[_0x25c5('0x4b')](_0x47df74['query'][_0x25c5('0x4b')]));_0xa58551[_0x25c5('0x49')]=_0xa58551[_0x25c5('0x49')][_0x25c5('0x4c')]?_0xa58551[_0x25c5('0x49')]:_0x524aba[_0x25c5('0x48')];if(!_0x47df74[_0x25c5('0x45')][_0x25c5('0x4d')](_0x25c5('0x4e'))){_0xa58551[_0x25c5('0x2e')]=qs[_0x25c5('0x2e')](_0x47df74[_0x25c5('0x45')][_0x25c5('0x2e')]);_0xa58551[_0x25c5('0x2c')]=qs[_0x25c5('0x2c')](_0x47df74[_0x25c5('0x45')]['offset']);}_0xa58551[_0x25c5('0x4f')]=qs['sort'](_0x47df74['query'][_0x25c5('0x67')]);_0xa58551['where']=qs[_0x25c5('0x47')](_['pick'](_0x47df74[_0x25c5('0x45')],_0x524aba[_0x25c5('0x47')]));_0xa58551[_0x25c5('0x50')]['SmsAccountId']=_0x560272['id'];if(_0x47df74['query'][_0x25c5('0x52')]){_0xa58551[_0x25c5('0x50')]=_[_0x25c5('0x53')](_0xa58551[_0x25c5('0x50')],{'$or':_['map'](_0xa58551['attributes'],function(_0x4b0a15){var _0x23fa2d={};_0x23fa2d[_0x4b0a15]={'$like':'%'+_0x47df74['query']['filter']+'%'};return _0x23fa2d;})});}_0xa58551=_[_0x25c5('0x53')]({},_0xa58551,_0x47df74[_0x25c5('0x55')]);return db['Disposition'][_0x25c5('0x2f')]({'where':_0xa58551[_0x25c5('0x50')]})[_0x25c5('0x20')](function(_0x17af87){_0x2bf8e8[_0x25c5('0x2f')]=_0x17af87;if(_0x47df74[_0x25c5('0x45')][_0x25c5('0x59')]){_0xa58551[_0x25c5('0x56')]=[{'all':!![]}];}return db[_0x25c5('0x66')]['findAll'](_0xa58551);})[_0x25c5('0x20')](function(_0x24b1b3){_0x2bf8e8['rows']=_0x24b1b3;return _0x2bf8e8;});}})[_0x25c5('0x20')](respondWithFilteredResult(_0x5a9bd6,_0xa58551))[_0x25c5('0x28')](handleError(_0x5a9bd6,null));};exports[_0x25c5('0x68')]=function(_0xa5bdb1,_0x624351,_0x34e1d9){return db['SmsAccount'][_0x25c5('0x5a')]({'where':{'id':_0xa5bdb1[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x624351,null))['then'](function(_0x2c7d0a){if(_0x2c7d0a){return _0x2c7d0a[_0x25c5('0x68')](_0xa5bdb1[_0x25c5('0x45')][_0x25c5('0x69')]);}})[_0x25c5('0x20')](respondWithStatusCode(_0x624351,null))['catch'](handleError(_0x624351,null));};exports[_0x25c5('0x6a')]=function(_0x4f701d,_0x2ee942,_0x514a62){if(_0x4f701d[_0x25c5('0x5c')]['id']){delete _0x4f701d[_0x25c5('0x5c')]['id'];}return db[_0x25c5('0x41')]['find']({'where':{'id':_0x4f701d[_0x25c5('0x62')]['id']}})['then'](handleEntityNotFound(_0x2ee942,null))['then'](function(_0x3f2604){if(_0x3f2604){_0x4f701d['body'][_0x25c5('0x6b')]=_0x3f2604['id'];return db['CannedAnswer'][_0x25c5('0x5b')](_0x4f701d[_0x25c5('0x5c')]);}})[_0x25c5('0x20')](respondWithResult(_0x2ee942,null))[_0x25c5('0x28')](handleError(_0x2ee942,null));};exports[_0x25c5('0x6c')]=function(_0x188a98,_0x4f115b,_0x5b2332){var _0x37884d={'raw':![],'where':{}};var _0x1ce718={};var _0x18bcb2={'count':0x0,'rows':[]};return db[_0x25c5('0x41')][_0x25c5('0x65')]({'where':{'id':_0x188a98[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x4f115b,null))[_0x25c5('0x20')](function(_0x23802a){if(_0x23802a){_0x1ce718[_0x25c5('0x48')]=_['keys'](db[_0x25c5('0x6d')][_0x25c5('0x42')]);_0x1ce718[_0x25c5('0x45')]=_['keys'](_0x188a98['query']);_0x1ce718[_0x25c5('0x47')]=_['intersection'](_0x1ce718[_0x25c5('0x48')],_0x1ce718[_0x25c5('0x45')]);_0x37884d[_0x25c5('0x49')]=_[_0x25c5('0x4a')](_0x1ce718[_0x25c5('0x48')],qs[_0x25c5('0x4b')](_0x188a98[_0x25c5('0x45')]['fields']));_0x37884d[_0x25c5('0x49')]=_0x37884d[_0x25c5('0x49')][_0x25c5('0x4c')]?_0x37884d['attributes']:_0x1ce718[_0x25c5('0x48')];if(!_0x188a98['query'][_0x25c5('0x4d')]('nolimit')){_0x37884d['limit']=qs['limit'](_0x188a98[_0x25c5('0x45')][_0x25c5('0x2e')]);_0x37884d[_0x25c5('0x2c')]=qs[_0x25c5('0x2c')](_0x188a98[_0x25c5('0x45')][_0x25c5('0x2c')]);}_0x37884d[_0x25c5('0x4f')]=qs['sort'](_0x188a98[_0x25c5('0x45')][_0x25c5('0x67')]);_0x37884d[_0x25c5('0x50')]=qs[_0x25c5('0x47')](_['pick'](_0x188a98[_0x25c5('0x45')],_0x1ce718[_0x25c5('0x47')]));_0x37884d['where'][_0x25c5('0x6b')]=_0x23802a['id'];if(_0x188a98[_0x25c5('0x45')][_0x25c5('0x52')]){_0x37884d[_0x25c5('0x50')]=_[_0x25c5('0x53')](_0x37884d['where'],{'$or':_[_0x25c5('0x40')](_0x37884d[_0x25c5('0x49')],function(_0x327e31){var _0x1eaa6e={};_0x1eaa6e[_0x327e31]={'$like':'%'+_0x188a98[_0x25c5('0x45')][_0x25c5('0x52')]+'%'};return _0x1eaa6e;})});}_0x37884d=_[_0x25c5('0x53')]({},_0x37884d,_0x188a98[_0x25c5('0x55')]);return db[_0x25c5('0x6d')][_0x25c5('0x2f')]({'where':_0x37884d[_0x25c5('0x50')]})[_0x25c5('0x20')](function(_0x4362fd){_0x18bcb2['count']=_0x4362fd;if(_0x188a98['query'][_0x25c5('0x59')]){_0x37884d[_0x25c5('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x37884d);})[_0x25c5('0x20')](function(_0x550371){_0x18bcb2['rows']=_0x550371;return _0x18bcb2;});}})['then'](respondWithFilteredResult(_0x4f115b,_0x37884d))[_0x25c5('0x28')](handleError(_0x4f115b,null));};exports['removeAnswers']=function(_0x4e263d,_0x10221e,_0x521485){return db['SmsAccount'][_0x25c5('0x5a')]({'where':{'id':_0x4e263d[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x10221e,null))[_0x25c5('0x20')](function(_0x227b87){if(_0x227b87){return _0x227b87[_0x25c5('0x6e')](_0x4e263d[_0x25c5('0x45')][_0x25c5('0x69')]);}})[_0x25c5('0x20')](respondWithStatusCode(_0x10221e,null))[_0x25c5('0x28')](handleError(_0x10221e,null));};exports[_0x25c5('0x6f')]=function(_0x18366a,_0x293b16,_0x30b5ce){var _0x5d1cb1={'channel':_0x25c5('0x70')};var _0x48f01c=[];var _0x6d8d03=[];var _0xe996ab={};return db[_0x25c5('0x41')]['find']({'where':{'id':_0x18366a['params']['id']},'include':[{'model':db[_0x25c5('0x71')],'as':'Applications'}]})[_0x25c5('0x20')](handleEntityNotFound(_0x293b16,null))[_0x25c5('0x20')](function(_0x89468c){_0x5d1cb1[_0x25c5('0x72')]=_0x89468c;_0x5d1cb1[_0x25c5('0x73')]=_['orderBy'](_0x89468c[_0x25c5('0x74')],[_0x25c5('0x75')],[_0x25c5('0x76')]);if(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0x74')]){delete _0x5d1cb1['account'][_0x25c5('0x74')];}return db[_0x25c5('0x77')][_0x25c5('0x63')]();})[_0x25c5('0x20')](function(_0x571160){if(!_0x571160){throw new db[(_0x25c5('0x78'))][(_0x25c5('0x79'))]('no\x20available\x20attributes');}_0x48f01c=_[_0x25c5('0x7a')](_[_0x25c5('0x46')](_0x571160),[_0x25c5('0x7b'),_0x25c5('0x7c')]);_0x6d8d03=_[_0x25c5('0x7a')](_[_0x25c5('0x46')](_0x571160),[_0x25c5('0x7b'),_0x25c5('0x7c'),_0x25c5('0x7d'),'ListId']);_0x5d1cb1[_0x25c5('0x5c')]={'mapKey':_0x25c5('0x7e')};if(_0x5d1cb1[_0x25c5('0x72')]['type']){switch(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0x43')]){case'twilio':_0x5d1cb1['body'][_0x25c5('0x7f')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x80')];_0x5d1cb1[_0x25c5('0x5c')]['body']=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x81')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x82')]=_0x18366a[_0x25c5('0x5c')]['MessageSid'];break;case _0x25c5('0x83'):_0x5d1cb1['body']['from']='+'+_0x18366a[_0x25c5('0x5c')][_0x25c5('0x84')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x85')];break;case'connectel':_0x5d1cb1[_0x25c5('0x5c')]['from']=_0x18366a['body'][_0x25c5('0x7f')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a['body'][_0x25c5('0x25')];break;case _0x25c5('0x86'):_0x5d1cb1[_0x25c5('0x5c')]['from']=_0x18366a[_0x25c5('0x5c')]['from'];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a['body'][_0x25c5('0x5c')];_0x5d1cb1['body'][_0x25c5('0x82')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x87')];break;case'plivo':_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x80')];_0x5d1cb1['body'][_0x25c5('0x5c')]=_0x18366a['body']['Text'];_0x5d1cb1[_0x25c5('0x5c')]['messageId']=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x88')];break;case _0x25c5('0x89'):_0x5d1cb1['body']['from']='+'+_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8a')][0x0][_0x25c5('0x7f')];_0x5d1cb1[_0x25c5('0x5c')]['body']=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8a')][0x0][_0x25c5('0x85')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x82')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8a')][0x0][_0x25c5('0x82')];break;case _0x25c5('0x8b'):_0x5d1cb1['body'][_0x25c5('0x7f')]=_0x18366a['body'][_0x25c5('0x8c')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8d')][_0x25c5('0x25')];break;case'clickatell':_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8e')];_0x5d1cb1['body']['body']=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x85')];_0x5d1cb1['body'][_0x25c5('0x82')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x8f')];break;case _0x25c5('0x90'):_0x5d1cb1['body']['messageId']=_0x18366a[_0x25c5('0x5c')][0x0][_0x25c5('0x25')]['id'];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')]=_0x18366a[_0x25c5('0x5c')][0x0][_0x25c5('0x25')][_0x25c5('0x7f')];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a[_0x25c5('0x5c')][0x0]['message'][_0x25c5('0x85')];break;case _0x25c5('0x91'):_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')]=_0x18366a[_0x25c5('0x5c')]['from'];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')]=_0x18366a[_0x25c5('0x5c')]['message'];_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x82')]=_0x18366a[_0x25c5('0x5c')][_0x25c5('0x92')];break;}}if(_0x5d1cb1[_0x25c5('0x5c')]['id']){delete _0x5d1cb1[_0x25c5('0x5c')]['id'];}if(_[_0x25c5('0x93')](_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')])){throw new db['Sequelize'][(_0x25c5('0x79'))]('from\x20is\x20mandatory');}if(_[_0x25c5('0x93')](_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x5c')])||_0x5d1cb1['body'][_0x25c5('0x5c')]===''){throw new db[(_0x25c5('0x78'))][(_0x25c5('0x79'))](_0x25c5('0x94'));}if(_[_0x25c5('0x93')](_0x5d1cb1['body'][_0x25c5('0x95')])){throw new db[(_0x25c5('0x78'))]['ValidationError'](_0x25c5('0x96')+_0x6d8d03);}if(!_['includes'](_0x6d8d03,_0x5d1cb1[_0x25c5('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x25c5('0x97')+_0x6d8d03);}_0xe996ab[_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x95')]]=_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')];return db[_0x25c5('0x98')][_0x25c5('0x5a')]({'where':{'id':_0x5d1cb1[_0x25c5('0x72')]['ListId']},'include':[{'model':db[_0x25c5('0x77')],'as':'Contacts','where':_0xe996ab,'limit':0x1,'order':[[_0x25c5('0x7c'),_0x25c5('0x99')]]}]});})[_0x25c5('0x20')](handleEntityNotFound(_0x293b16,null))[_0x25c5('0x20')](function(_0x2d4809){if(_0x2d4809){_0x5d1cb1[_0x25c5('0x9a')]=_[_0x25c5('0x9b')](_0x2d4809,[_0x25c5('0x9c')]);if(_0x2d4809[_0x25c5('0x9c')][_0x25c5('0x4c')]){return _0x2d4809[_0x25c5('0x9c')][0x0];}var _0x2b5061=_['defaults'](_0x5d1cb1[_0x25c5('0x5c')],{'firstName':_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')],'ListId':_0x2d4809['id']});_0x2b5061[_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x95')]]=_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')];return db[_0x25c5('0x77')][_0x25c5('0x5b')](_0x2b5061,{'fields':_0x48f01c,'raw':!![]});}})['then'](handleEntityNotFound(_0x293b16,null))['then'](function(_0x7123f8){if(_0x7123f8){_0x5d1cb1[_0x25c5('0x9d')]=_0x7123f8;var _0x4c4234={'ContactId':_0x7123f8['id'],'phone':_0x5d1cb1[_0x25c5('0x5c')]['from'],'SmsAccountId':_0x18366a[_0x25c5('0x62')]['id']};var _0x26862c={'ContactId':_0x7123f8['id'],'SmsAccountId':_0x18366a[_0x25c5('0x62')]['id'],'closed':![]};return db['SmsInteraction'][_0x25c5('0x5a')]({'where':_0x26862c})[_0x25c5('0x20')](function(_0x35042b){if(_0x35042b){return[_0x35042b,![]];}return db[_0x25c5('0x9e')]['create'](_0x4c4234)[_0x25c5('0x20')](function(_0x2a7599){return[_0x2a7599,!![]];});});}})[_0x25c5('0x9f')](function(_0x20ae3c,_0x26c22f){_0x5d1cb1[_0x25c5('0xa0')]=_0x20ae3c[_0x25c5('0x36')]({'plain':!![]});_0x5d1cb1[_0x25c5('0xa0')]['created']=![];if(_0x26c22f){if(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0xa1')]){_0x5d1cb1[_0x25c5('0x73')]['push']({'id':0x0,'priority':_0x5d1cb1[_0x25c5('0x73')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5d1cb1[_0x25c5('0xa0')]['created']=!![];}return db[_0x25c5('0xa2')]['create']({'phone':_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0x7f')],'messageId':_0x5d1cb1['body'][_0x25c5('0x82')],'body':_0x5d1cb1['body']['body'],'SmsAccountId':_0x18366a[_0x25c5('0x62')]['id'],'SmsInteractionId':_0x20ae3c['id'],'direction':'in','ContactId':_0x20ae3c[_0x25c5('0xa3')],'AttachmentId':_0x5d1cb1[_0x25c5('0x5c')][_0x25c5('0xa4')]});})[_0x25c5('0x20')](function(_0x4f1a1b){_0x5d1cb1['message']=_0x4f1a1b;if(!_0x5d1cb1['interaction']['UserId'])return;return db[_0x25c5('0xa5')][_0x25c5('0x5a')]({'attributes':['id',_0x25c5('0x3b')],'where':{'id':_0x5d1cb1['interaction'][_0x25c5('0xa6')]}});})[_0x25c5('0x20')](function(_0x44bfc1){if(_0x44bfc1){_0x5d1cb1[_0x25c5('0x73')][_0x25c5('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x44bfc1['name']+','+(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0xa8')]||0xa),'interval':'*,*,*,*'});}if(!_0x5d1cb1[_0x25c5('0xa0')][_0x25c5('0xa9')])return;return db['SmsQueue'][_0x25c5('0x5a')]({'attributes':['id',_0x25c5('0x3b')],'where':{'id':_0x5d1cb1[_0x25c5('0xa0')][_0x25c5('0xa9')]}});})[_0x25c5('0x20')](function(_0x3caccd){if(_0x3caccd){_0x5d1cb1[_0x25c5('0x73')]['unshift']({'id':0x0,'priority':0x1,'app':_0x25c5('0xaa'),'appdata':_0x3caccd[_0x25c5('0x3b')]+','+(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0xab')]||0x12c),'interval':_0x25c5('0xac')});}return respondWithRpcPromise('Start','startRouting',_0x5d1cb1);})[_0x25c5('0x20')](function(_0x489ae5){if(_0x489ae5){var _0x14a536=0xc8;var _0x4db95e=_0x25c5('0xad');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4db95e,_0x14a536,_0x25c5('0xae'));logger[_0x25c5('0xaf')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4db95e,_0x14a536,_0x25c5('0xae'),JSON[_0x25c5('0x23')](_0x489ae5));if(_0x5d1cb1[_0x25c5('0x72')][_0x25c5('0x43')]===_0x25c5('0xb0')){return _0x293b16[_0x25c5('0x29')](_0x14a536)['set'](_0x25c5('0xb1'),_0x25c5('0xb2'))[_0x25c5('0x3c')]('\x0a');}else{return _0x293b16[_0x25c5('0x29')](_0x14a536)[_0x25c5('0x2b')](_0x489ae5);}}})[_0x25c5('0x28')](handleError(_0x293b16,null));};exports[_0x25c5('0xb3')]=function(_0x385255,_0x2cb226){var _0x28de90=_0x385255[_0x25c5('0x62')]['id'];var _0x13cdea=_0x385255[_0x25c5('0x5c')];var _0x5a9f10=0xc8;var _0x1709d1=null;return db[_0x25c5('0xb4')][_0x25c5('0xb5')]({'isolationLevel':db[_0x25c5('0xb4')][_0x25c5('0xb6')][_0x25c5('0xb7')][_0x25c5('0xb8')]},function(_0x206ef){return db[_0x25c5('0x41')][_0x25c5('0x65')]({'where':{'id':_0x28de90},'transaction':_0x206ef})[_0x25c5('0x20')](function(_0x1ffb90){if(_0x1ffb90){return db[_0x25c5('0x71')][_0x25c5('0x35')]({'where':{'SmsAccountId':_0x28de90},'transaction':_0x206ef})['then'](function(){var _0x2226c3=_[_0x25c5('0x40')](_0x13cdea,function(_0x8aa95){_0x8aa95['SmsAccountId']=_0x28de90;return _0x8aa95;});return db[_0x25c5('0x71')][_0x25c5('0xb9')](_0x2226c3,{'transaction':_0x206ef});});}else{_0x5a9f10=0x194;_0x1709d1=[];}});})[_0x25c5('0x20')](function(){if(_0x5a9f10!==0x194){return db[_0x25c5('0x71')][_0x25c5('0xba')]({'where':{'SmsAccountId':_0x28de90},'order':_0x25c5('0x75')})[_0x25c5('0x20')](function(_0x13b507){_0x1709d1=_0x13b507;});}})[_0x25c5('0x28')](function(_0x6fbad4){_0x5a9f10=0x1f4;logger['error'](_0x6fbad4['stack']);if(_0x6fbad4[_0x25c5('0x3b')]){delete _0x6fbad4[_0x25c5('0x3b')];}_0x1709d1=_0x6fbad4;})[_0x25c5('0xbb')](function(){if(_0x1709d1===null){_0x2cb226[_0x25c5('0x39')](_0x5a9f10);}else{if(_0x5a9f10===0x1f4){_0x2cb226[_0x25c5('0x29')](_0x5a9f10)[_0x25c5('0x3c')](_0x1709d1);}else{_0x2cb226['status'](_0x5a9f10)[_0x25c5('0x2b')](_0x1709d1);}}});};exports[_0x25c5('0xbc')]=function(_0x39105d,_0xb13686,_0x27fa02){var _0x584da1={};var _0x56780b={};var _0x41f3ae;var _0x3d75df;return db['SmsAccount'][_0x25c5('0x65')]({'where':{'id':_0x39105d['params']['id']}})['then'](handleEntityNotFound(_0xb13686,null))['then'](function(_0x261df6){if(_0x261df6){_0x41f3ae=_0x261df6;_0x56780b[_0x25c5('0x48')]=_['keys'](db[_0x25c5('0x71')][_0x25c5('0x42')]);_0x56780b[_0x25c5('0x45')]=_['keys'](_0x39105d[_0x25c5('0x45')]);_0x56780b['filters']=_[_0x25c5('0x4a')](_0x56780b['model'],_0x56780b[_0x25c5('0x45')]);_0x584da1['attributes']=_['intersection'](_0x56780b[_0x25c5('0x48')],qs[_0x25c5('0x4b')](_0x39105d[_0x25c5('0x45')][_0x25c5('0x4b')]));_0x584da1['attributes']=_0x584da1[_0x25c5('0x49')][_0x25c5('0x4c')]?_0x584da1[_0x25c5('0x49')]:_0x56780b['model'];_0x584da1[_0x25c5('0x4f')]=qs[_0x25c5('0x67')](_0x39105d[_0x25c5('0x45')][_0x25c5('0x67')]);_0x584da1['where']=qs[_0x25c5('0x47')](_[_0x25c5('0x51')](_0x39105d['query'],_0x56780b[_0x25c5('0x47')]));if(_0x39105d['query'][_0x25c5('0x52')]){_0x584da1[_0x25c5('0x50')]=_['merge'](_0x584da1[_0x25c5('0x50')],{'$or':_[_0x25c5('0x40')](_0x584da1['attributes'],function(_0x41eeb6){var _0x4cd5d9={};_0x4cd5d9[_0x41eeb6]={'$like':'%'+_0x39105d[_0x25c5('0x45')]['filter']+'%'};return _0x4cd5d9;})});}_0x584da1=_['merge']({},_0x584da1,_0x39105d['options']);return _0x41f3ae['getApplications'](_0x584da1);}})['then'](function(_0x291690){if(_0x291690){_0x3d75df=_0x291690[_0x25c5('0x4c')];if(!_0x39105d['query']['hasOwnProperty'](_0x25c5('0x4e'))){_0x584da1[_0x25c5('0x2e')]=qs[_0x25c5('0x2e')](_0x39105d['query']['limit']);_0x584da1[_0x25c5('0x2c')]=qs['offset'](_0x39105d[_0x25c5('0x45')][_0x25c5('0x2c')]);}return _0x41f3ae[_0x25c5('0xbc')](_0x584da1);}})['then'](function(_0x1c1fda){if(_0x1c1fda){return _0x1c1fda?{'count':_0x3d75df,'rows':_0x1c1fda}:null;}})[_0x25c5('0x20')](respondWithResult(_0xb13686,null))[_0x25c5('0x28')](handleError(_0xb13686,null));};exports['getInteractions']=function(_0x2b71c7,_0x4baa44,_0x4df793){var _0xcbcda7={'raw':![],'where':{}};var _0x449c4f={};var _0x740e8b={'count':0x0,'rows':[]};return db[_0x25c5('0x41')]['findOne']({'where':{'id':_0x2b71c7['params']['id']}})['then'](handleEntityNotFound(_0x4baa44,null))['then'](function(_0x579fe5){if(_0x579fe5){_0x449c4f[_0x25c5('0x48')]=_[_0x25c5('0x46')](db[_0x25c5('0x9e')][_0x25c5('0x42')]);_0x449c4f[_0x25c5('0x45')]=_[_0x25c5('0x46')](_0x2b71c7[_0x25c5('0x45')]);_0x449c4f[_0x25c5('0x47')]=_[_0x25c5('0x4a')](_0x449c4f[_0x25c5('0x48')],_0x449c4f[_0x25c5('0x45')]);_0xcbcda7[_0x25c5('0x49')]=_['intersection'](_0x449c4f['model'],qs[_0x25c5('0x4b')](_0x2b71c7[_0x25c5('0x45')][_0x25c5('0x4b')]));_0xcbcda7[_0x25c5('0x49')]=_0xcbcda7['attributes'][_0x25c5('0x4c')]?_0xcbcda7['attributes']:_0x449c4f[_0x25c5('0x48')];if(!_0x2b71c7[_0x25c5('0x45')][_0x25c5('0x4d')](_0x25c5('0x4e'))){_0xcbcda7[_0x25c5('0x2e')]=qs['limit'](_0x2b71c7['query'][_0x25c5('0x2e')]);_0xcbcda7['offset']=qs[_0x25c5('0x2c')](_0x2b71c7[_0x25c5('0x45')][_0x25c5('0x2c')]);}_0xcbcda7[_0x25c5('0x4f')]=qs[_0x25c5('0x67')](_0x2b71c7[_0x25c5('0x45')][_0x25c5('0x67')]);_0xcbcda7[_0x25c5('0x50')]=qs[_0x25c5('0x47')](_[_0x25c5('0x51')](_0x2b71c7[_0x25c5('0x45')],_0x449c4f[_0x25c5('0x47')]));_0xcbcda7[_0x25c5('0x50')][_0x25c5('0x6b')]=_0x579fe5['id'];if(_0x2b71c7['query'][_0x25c5('0x52')]){_0xcbcda7[_0x25c5('0x50')]=_[_0x25c5('0x53')](_0xcbcda7[_0x25c5('0x50')],{'$or':_[_0x25c5('0x40')](_0xcbcda7['attributes'],function(_0x15acf8){var _0x1ea805={};_0x1ea805[_0x15acf8]={'$like':'%'+_0x2b71c7[_0x25c5('0x45')][_0x25c5('0x52')]+'%'};return _0x1ea805;})});}_0xcbcda7=_[_0x25c5('0x53')]({},_0xcbcda7,_0x2b71c7[_0x25c5('0x55')]);return db['SmsInteraction'][_0x25c5('0x2f')]({'where':_0xcbcda7[_0x25c5('0x50')]})['then'](function(_0x1316e1){_0x740e8b['count']=_0x1316e1;if(_0x2b71c7[_0x25c5('0x45')]['includeAll']){_0xcbcda7[_0x25c5('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x25c5('0xa5')],'as':_0x25c5('0xbd'),'attributes':[_0x25c5('0x3b'),_0x25c5('0xbe'),'internal'],'required':![]},{'model':db[_0x25c5('0xbf')],'as':_0x25c5('0xc0'),'attributes':['id',_0x25c5('0x3b'),'color'],'where':_0x2b71c7[_0x25c5('0x45')][_0x25c5('0xc1')]?{'id':_0x2b71c7['query']['tag']}:undefined,'required':_0x2b71c7[_0x25c5('0x45')][_0x25c5('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x25c5('0x57')](_0xcbcda7);})['then'](function(_0x22d82a){_0x740e8b[_0x25c5('0xc2')]=_0x22d82a;return _0x740e8b;});}})['then'](respondWithFilteredResult(_0x4baa44,_0xcbcda7))[_0x25c5('0x28')](handleError(_0x4baa44,null));};exports[_0x25c5('0x3c')]=function(_0x1904bb,_0x31cb64,_0x5105ad){var _0x513364,_0x15970c,_0x41e76b;if(_[_0x25c5('0x93')](_0x1904bb[_0x25c5('0x5c')][_0x25c5('0x5c')])||_0x1904bb['body']['body']===''){throw new db[(_0x25c5('0x78'))][(_0x25c5('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1904bb[_0x25c5('0x5c')]['to'])){throw new db[(_0x25c5('0x78'))][(_0x25c5('0x79'))]('to\x20is\x20mandatory');}_0x513364=_0x1904bb[_0x25c5('0x5c')]['to'];return db[_0x25c5('0x41')]['find']({'where':{'id':_0x1904bb['params']['id']},'include':[{'model':db[_0x25c5('0x98')],'as':_0x25c5('0xc3'),'include':[{'model':db[_0x25c5('0x77')],'as':_0x25c5('0x9c'),'where':{'mobile':_0x513364},'limit':0x1,'order':[[_0x25c5('0x7c'),_0x25c5('0x99')]]}]}]})[_0x25c5('0x20')](handleEntityNotFound(_0x31cb64,null))[_0x25c5('0x20')](function(_0x312797){if(_0x312797&&_0x312797[_0x25c5('0xc3')]){_0x15970c=_0x312797[_0x25c5('0x36')]({'plain':!![]});if(_0x15970c[_0x25c5('0xc3')]&&_0x15970c[_0x25c5('0xc3')]['Contacts'][_0x25c5('0x4c')]){return _0x15970c['List'][_0x25c5('0x9c')][0x0];}return db['CmContact']['create'](_[_0x25c5('0xc4')](_0x1904bb[_0x25c5('0x5c')],{'firstName':_0x513364,'mobile':_0x513364,'phone':_0x513364,'ListId':_0x15970c[_0x25c5('0xc5')]}));}})[_0x25c5('0x20')](handleEntityNotFound(_0x31cb64,null))[_0x25c5('0x20')](function(_0x218710){if(_0x218710){_0x41e76b=_0x218710;return db[_0x25c5('0x9e')]['find']({'where':{'ContactId':_0x41e76b['id'],'closed':![],'SmsAccountId':_0x15970c['id']}})[_0x25c5('0x20')](function(_0x1e31bb){if(_0x1e31bb){return[_0x1e31bb,![]];}return db[_0x25c5('0x9e')]['create']({'UserId':_0x1904bb[_0x25c5('0x5d')]['id'],'ContactId':_0x41e76b['id'],'SmsAccountId':_0x15970c['id'],'phone':_0x513364,'firstMsgDirection':_0x25c5('0xc6'),'Messages':[_[_0x25c5('0x53')](_0x1904bb[_0x25c5('0x5c')],{'read':![],'body':_0x1904bb[_0x25c5('0x5c')][_0x25c5('0x5c')],'phone':_0x513364,'SmsAccountId':_0x15970c['id'],'UserId':_0x1904bb[_0x25c5('0x5d')]['id'],'ContactId':_0x41e76b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x25c5('0xc7')}]})[_0x25c5('0x20')](function(_0x8dc6d1){return[_0x8dc6d1,!![]];});});}})[_0x25c5('0x9f')](function(_0x5f3517,_0x1785a2){if(_0x1785a2){return _0x5f3517;}return db[_0x25c5('0xa2')][_0x25c5('0x5b')](_[_0x25c5('0x53')](_0x1904bb[_0x25c5('0x5c')],{'read':![],'body':_0x1904bb['body']['body'],'phone':_0x513364,'SmsAccountId':_0x15970c['id'],'SmsInteractionId':_0x5f3517['id'],'UserId':_0x1904bb[_0x25c5('0x5d')]['id'],'ContactId':_0x41e76b['id']}))[_0x25c5('0x20')](function(_0x30ef23){_0x5f3517[_0x25c5('0xc8')]['Messages']=[];_0x5f3517[_0x25c5('0xc8')][_0x25c5('0xc7')][_0x25c5('0xc9')](_0x30ef23[_0x25c5('0xc8')]);return _0x5f3517;});})['then'](respondWithResult(_0x31cb64,null))[_0x25c5('0x28')](handleError(_0x31cb64,null));};exports[_0x25c5('0x29')]=function(_0x23b499,_0xad1876,_0x1478bc){if(_0x23b499[_0x25c5('0x5c')]['id']){delete _0x23b499[_0x25c5('0x5c')]['id'];}var _0x4308f1,_0x137f54,_0x24e65a;return db[_0x25c5('0x41')][_0x25c5('0x5a')]({'where':{'id':_0x23b499[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0xad1876,null))[_0x25c5('0x20')](function(_0x128fcd){if(_0x128fcd){_0x24e65a=_0x128fcd;logger[_0x25c5('0xaf')](_0x25c5('0xca'),_0x25c5('0x29'),'received\x20delivery\x20report\x20from',_0x128fcd[_0x25c5('0x43')],util['inspect'](_0x23b499[_0x25c5('0x5c')],{'showHidden':![],'depth':null}));switch(_0x128fcd[_0x25c5('0x43')]){case _0x25c5('0x83'):if(_0x23b499[_0x25c5('0x5c')]['skebby_dispatch_id']&&_0x23b499['body']['status']){_0x137f54=_0x23b499['body'][_0x25c5('0x29')];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499['body']['skebby_dispatch_id']}});}break;case _0x25c5('0xcb'):if(_0x23b499[_0x25c5('0x5c')][_0x25c5('0xcc')]&&_0x23b499[_0x25c5('0x5c')]['statusInt']){_0x137f54=_0x23b499[_0x25c5('0x5c')][_0x25c5('0xcd')];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499[_0x25c5('0x5c')][_0x25c5('0xcc')]}});}break;case _0x25c5('0x86'):if(_0x23b499['body'][_0x25c5('0x87')]&&_0x23b499[_0x25c5('0x5c')]['status_code']){_0x137f54=_0x23b499['body'][_0x25c5('0xce')];return db['SmsMessage'][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499['body'][_0x25c5('0x87')]}});}break;case'infobip':var _0xa3c485=_0x23b499['body'][_0x25c5('0x8a')][0x0];if(_0xa3c485[_0x25c5('0x82')]&&_0xa3c485['status'][_0x25c5('0xcf')]===_0x25c5('0xd0')){_0x137f54=_0xa3c485['status'][_0x25c5('0xcf')];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0xa3c485[_0x25c5('0x82')]}});}break;case _0x25c5('0xd1'):if(_0x23b499[_0x25c5('0x5c')]['messageId']&&_0x23b499[_0x25c5('0x5c')][_0x25c5('0x29')]){_0x137f54=_0x23b499[_0x25c5('0x5c')][_0x25c5('0x29')];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499[_0x25c5('0x5c')][_0x25c5('0x82')]}});}break;case _0x25c5('0x90'):if(_0x23b499[_0x25c5('0x5c')][0x0][_0x25c5('0x25')]['id']){_0x137f54=_0x23b499[_0x25c5('0x5c')][0x0][_0x25c5('0x43')];return db['SmsMessage'][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499[_0x25c5('0x5c')][0x0][_0x25c5('0x25')]['id']}});}break;case _0x25c5('0x91'):if(_0x23b499['body'][_0x25c5('0xd2')]&&_0x23b499[_0x25c5('0x5c')][_0x25c5('0x29')]){_0x137f54=_0x23b499['body'][_0x25c5('0x29')];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0x23b499[_0x25c5('0x5c')]['redif']}});}break;}}})[_0x25c5('0x20')](handleEntityNotFound(_0xad1876,null))['then'](function(_0x11d089){if(_0x11d089){_0x4308f1=_0x11d089;switch(_0x24e65a[_0x25c5('0x43')]){case'skebby':if(_0x137f54===_0x25c5('0xd0')){return _0x4308f1['update']({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),_0x25c5('0x29'),_0x25c5('0x83'),util[_0x25c5('0xd3')](_0x23b499['body'],{'showHidden':![],'depth':null}));}break;case _0x25c5('0xcb'):if(_0x137f54==='1'){return _0x4308f1[_0x25c5('0x34')]({'read':!![]});}else{logger[_0x25c5('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x25c5('0x29'),'skebby',util['inspect'](_0x23b499[_0x25c5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x25c5('0x86'):if(!_0x23b499[_0x25c5('0x5c')][_0x25c5('0xd4')]&&_0x137f54>=0xc8&&_0x137f54<=0xce){return _0x4308f1[_0x25c5('0x34')]({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),_0x25c5('0x29'),_0x25c5('0x86'),util[_0x25c5('0xd3')](_0x23b499[_0x25c5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x25c5('0x89'):var _0x88549=_0x23b499[_0x25c5('0x5c')][_0x25c5('0x8a')][0x0];if(_0x88549['status'][_0x25c5('0xcf')]===_0x25c5('0xd0')){return _0x4308f1[_0x25c5('0x34')]({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),'status',_0x25c5('0x89'),util[_0x25c5('0xd3')](_0x23b499['body'],{'showHidden':![],'depth':null}));}break;case _0x25c5('0xd1'):if(_0x137f54==_0x25c5('0xd5')||_0x137f54==_0x25c5('0xd6')){return _0x4308f1[_0x25c5('0x34')]({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),_0x25c5('0x29'),_0x25c5('0xd1'),util[_0x25c5('0xd3')](_0x23b499[_0x25c5('0x5c')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x137f54==_0x25c5('0xd7')){return _0x4308f1['update']({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),_0x25c5('0x29'),_0x25c5('0x90'),util[_0x25c5('0xd3')](_0x23b499['body'],{'showHidden':![],'depth':null}));}break;case _0x25c5('0x91'):if(_0x137f54===_0x25c5('0xd8')||_0x137f54==='ACCEPTD'){return _0x4308f1[_0x25c5('0x34')]({'read':!![]});}else{logger['error'](_0x25c5('0xca'),_0x25c5('0x29'),'intelepeer',util[_0x25c5('0xd3')](_0x23b499[_0x25c5('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4308f1;}})[_0x25c5('0x20')](respondWithResult(_0xad1876,null))[_0x25c5('0x28')](handleError(_0xad1876,null));};exports['statusGet']=function(_0x5bab7e,_0x26bf0b,_0x42b9ce){var _0x3064d5,_0x12831b,_0x5cdbad;return db['SmsAccount'][_0x25c5('0x5a')]({'where':{'id':_0x5bab7e[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x26bf0b,null))['then'](function(_0x57bb10){if(_0x57bb10){_0x5cdbad=_0x57bb10;logger[_0x25c5('0xaf')](_0x25c5('0xca'),_0x25c5('0x29'),'received\x20delivery\x20report\x20from',_0x57bb10['type'],util[_0x25c5('0xd3')](_0x5bab7e[_0x25c5('0x45')],{'showHidden':![],'depth':null}));switch(_0x57bb10[_0x25c5('0x43')]){case _0x25c5('0x8b'):if(_0x5bab7e[_0x25c5('0x45')][_0x25c5('0xd9')]&&_0x5bab7e[_0x25c5('0x45')]['state']){_0x12831b=_0x5bab7e['query']['state'];return db[_0x25c5('0xa2')][_0x25c5('0x5a')]({'where':{'messageId':_0x5bab7e['query'][_0x25c5('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x26bf0b,null))[_0x25c5('0x20')](function(_0x2f0cae){if(_0x2f0cae){_0x3064d5=_0x2f0cae;switch(_0x5cdbad[_0x25c5('0x43')]){case _0x25c5('0x8b'):if(_0x12831b==='2'||_0x12831b==='6'){return _0x3064d5['update']({'read':!![]});}else{logger[_0x25c5('0x24')](_0x25c5('0xca'),_0x25c5('0x29'),'csc',util[_0x25c5('0xd3')](_0x5bab7e['query'],{'showHidden':![],'depth':null}));};break;}return _0x3064d5;}})[_0x25c5('0x20')](respondWithResult(_0x26bf0b,null))[_0x25c5('0x28')](handleError(_0x26bf0b,null));};exports[_0x25c5('0xda')]=function(_0x5262d8,_0x20738f,_0x533d46){return db['SmsAccount']['find']({'where':{'id':_0x5262d8['params']['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x20738f,null))[_0x25c5('0x20')](function(_0x31878f){if(_0x31878f){return _0x31878f[_0x25c5('0xda')](_0x5262d8[_0x25c5('0x5c')][_0x25c5('0x69')],_[_0x25c5('0x9b')](_0x5262d8[_0x25c5('0x5c')],['ids','id'])||{})[_0x25c5('0x9f')](function(_0x223e31){for(var _0x18fc49=0x0;_0x18fc49<_0x5262d8[_0x25c5('0x5c')][_0x25c5('0x69')]['length'];_0x18fc49+=0x1){socket[_0x25c5('0xdb')](_0x25c5('0xdc'),{'UserId':Number(_0x5262d8['body'][_0x25c5('0x69')][_0x18fc49]),'SmsAccountId':Number(_0x5262d8[_0x25c5('0x62')]['id'])});}return _0x223e31;});}})['then'](respondWithResult(_0x20738f,null))[_0x25c5('0x28')](handleError(_0x20738f,null));};exports['removeAgents']=function(_0x275a47,_0x3d6881,_0x2c3046){return db[_0x25c5('0x41')]['find']({'where':{'id':_0x275a47[_0x25c5('0x62')]['id']}})['then'](handleEntityNotFound(_0x3d6881,null))['then'](function(_0x5dcc1e){if(_0x5dcc1e){return _0x5dcc1e[_0x25c5('0xdd')](_0x275a47[_0x25c5('0x45')]['ids'])[_0x25c5('0x20')](function(){if(_[_0x25c5('0xde')](_0x275a47['query'][_0x25c5('0x69')])){for(var _0x2ce6f0=0x0;_0x2ce6f0<_0x275a47[_0x25c5('0x45')][_0x25c5('0x69')][_0x25c5('0x4c')];_0x2ce6f0+=0x1){socket['emit'](_0x25c5('0xdf'),{'UserId':Number(_0x275a47[_0x25c5('0x45')][_0x25c5('0x69')][_0x2ce6f0]),'SmsAccountId':Number(_0x275a47[_0x25c5('0x62')]['id'])});}}else{socket[_0x25c5('0xdb')](_0x25c5('0xdf'),{'UserId':Number(_0x275a47[_0x25c5('0x45')][_0x25c5('0x69')]),'SmsAccountId':Number(_0x275a47['params']['id'])});}});}})[_0x25c5('0x20')](respondWithStatusCode(_0x3d6881,null))['catch'](handleError(_0x3d6881,null));};exports[_0x25c5('0xe0')]=function(_0x2267f2,_0x412653,_0xd318d7){var _0x6e9de9={};var _0x243116={};var _0x26875f;var _0x3e46b6;return db[_0x25c5('0x41')]['findOne']({'where':{'id':_0x2267f2[_0x25c5('0x62')]['id']}})[_0x25c5('0x20')](handleEntityNotFound(_0x412653,null))['then'](function(_0x2bbb22){if(_0x2bbb22){_0x26875f=_0x2bbb22;_0x243116['model']=_[_0x25c5('0x46')](db['User']['rawAttributes']);_0x243116[_0x25c5('0x45')]=_[_0x25c5('0x46')](_0x2267f2[_0x25c5('0x45')]);_0x243116[_0x25c5('0x47')]=_[_0x25c5('0x4a')](_0x243116[_0x25c5('0x48')],_0x243116[_0x25c5('0x45')]);_0x6e9de9['attributes']=_['intersection'](_0x243116[_0x25c5('0x48')],qs['fields'](_0x2267f2[_0x25c5('0x45')][_0x25c5('0x4b')]));_0x6e9de9[_0x25c5('0x49')]=_0x6e9de9[_0x25c5('0x49')]['length']?_0x6e9de9[_0x25c5('0x49')]:_0x243116[_0x25c5('0x48')];_0x6e9de9['order']=qs[_0x25c5('0x67')](_0x2267f2[_0x25c5('0x45')][_0x25c5('0x67')]);_0x6e9de9[_0x25c5('0x50')]=qs[_0x25c5('0x47')](_[_0x25c5('0x51')](_0x2267f2['query'],_0x243116[_0x25c5('0x47')]));if(_0x2267f2[_0x25c5('0x45')][_0x25c5('0x52')]){_0x6e9de9[_0x25c5('0x50')]=_[_0x25c5('0x53')](_0x6e9de9[_0x25c5('0x50')],{'$or':_[_0x25c5('0x40')](_0x6e9de9['attributes'],function(_0x68aea7){var _0x2bdbb1={};_0x2bdbb1[_0x68aea7]={'$like':'%'+_0x2267f2[_0x25c5('0x45')][_0x25c5('0x52')]+'%'};return _0x2bdbb1;})});}_0x6e9de9=_[_0x25c5('0x53')]({},_0x6e9de9,_0x2267f2['options']);return _0x26875f['getAgents'](_0x6e9de9);}})[_0x25c5('0x20')](function(_0x78e27e){if(_0x78e27e){_0x3e46b6=_0x78e27e['length'];if(!_0x2267f2[_0x25c5('0x45')][_0x25c5('0x4d')](_0x25c5('0x4e'))){_0x6e9de9['limit']=qs[_0x25c5('0x2e')](_0x2267f2[_0x25c5('0x45')]['limit']);_0x6e9de9[_0x25c5('0x2c')]=qs[_0x25c5('0x2c')](_0x2267f2[_0x25c5('0x45')][_0x25c5('0x2c')]);}return _0x26875f[_0x25c5('0xe0')](_0x6e9de9);}})[_0x25c5('0x20')](function(_0x1a7ff3){if(_0x1a7ff3){return _0x1a7ff3?{'count':_0x3e46b6,'rows':_0x1a7ff3}:null;}})[_0x25c5('0x20')](respondWithResult(_0x412653,null))[_0x25c5('0x28')](handleError(_0x412653,null));}; \ No newline at end of file +var _0x7171=['describe','addDisposition','SmsAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','plivo','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','spread','interaction','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','SmsInteraction','User','Owner','fullname','internal','Tag','tag','List','out','Messages','dataValues','push','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','intelepeer','redif','error_code','clickatell','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','get','UserProfileResource','destroy','stack','name','send','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','Pause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause'];(function(_0x1427e5,_0x34526e){var _0x59bb5f=function(_0x353365){while(--_0x353365){_0x1427e5['push'](_0x1427e5['shift']());}};_0x59bb5f(++_0x34526e);}(_0x7171,0x160));var _0x1717=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7171[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1717('0x0'));var zipdir=require(_0x1717('0x1'));var jsonpatch=require(_0x1717('0x2'));var rp=require(_0x1717('0x3'));var moment=require('moment');var BPromise=require(_0x1717('0x4'));var Mustache=require('mustache');var util=require(_0x1717('0x5'));var path=require(_0x1717('0x6'));var sox=require(_0x1717('0x7'));var csv=require(_0x1717('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1717('0x9'));var _=require(_0x1717('0xa'));var squel=require(_0x1717('0xb'));var crypto=require(_0x1717('0xc'));var jsforce=require(_0x1717('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1717('0x8'));var querystring=require(_0x1717('0xe'));var Papa=require(_0x1717('0xf'));var Redis=require('ioredis');var authService=require(_0x1717('0x10'));var qs=require(_0x1717('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1717('0x12'));var logger=require('../../config/logger')(_0x1717('0x13'));var utils=require('../../config/utils');var config=require(_0x1717('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1717('0x15'))['db'];config[_0x1717('0x16')]=_[_0x1717('0x17')](config[_0x1717('0x16')],{'host':_0x1717('0x18'),'port':0x18eb});var socket=require(_0x1717('0x19'))(new Redis(config[_0x1717('0x16')]));require(_0x1717('0x1a'))[_0x1717('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1717('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5ee618,_0x30dd82,_0x4c7b73,_0x443956){return new BPromise(function(_0x42d291,_0x4dc855){var _0x3147af=_0x443956||client;return _0x3147af[_0x1717('0x1d')](_0x5ee618,_0x4c7b73)['then'](function(_0x3572ad){logger['info'](_0x1717('0x1e'),_0x30dd82,_0x1717('0x1f'));logger[_0x1717('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x30dd82,'request\x20sent',JSON[_0x1717('0x21')](_0x3572ad));if(_0x3572ad['error']){if(_0x3572ad[_0x1717('0x22')][_0x1717('0x23')]===0x1f4){logger[_0x1717('0x22')](_0x1717('0x1e'),_0x30dd82,_0x3572ad[_0x1717('0x22')][_0x1717('0x24')]);return _0x4dc855(_0x3572ad['error'][_0x1717('0x24')]);}logger['error'](_0x1717('0x1e'),_0x30dd82,_0x3572ad[_0x1717('0x22')][_0x1717('0x24')]);return _0x42d291(_0x3572ad[_0x1717('0x22')][_0x1717('0x24')]);}else{logger[_0x1717('0x25')](_0x1717('0x1e'),_0x30dd82,_0x1717('0x1f'));_0x42d291(_0x3572ad[_0x1717('0x26')]['message']);}})[_0x1717('0x27')](function(_0x1bfca1){logger[_0x1717('0x22')]('SmsAccount,\x20%s,\x20%s',_0x30dd82,_0x1bfca1);_0x4dc855(_0x1bfca1);});});}function respondWithStatusCode(_0x4f765d,_0x403bf4){_0x403bf4=_0x403bf4||0xcc;return function(_0x24cd63){if(_0x24cd63){return _0x4f765d[_0x1717('0x28')](_0x403bf4);}return _0x4f765d[_0x1717('0x29')](_0x403bf4)[_0x1717('0x2a')]();};}function respondWithResult(_0x416d35,_0x2337ee){_0x2337ee=_0x2337ee||0xc8;return function(_0xd8d4e8){if(_0xd8d4e8){return _0x416d35[_0x1717('0x29')](_0x2337ee)[_0x1717('0x2b')](_0xd8d4e8);}};}function respondWithFilteredResult(_0x36bbf8,_0x336146){return function(_0x4c7aa4){if(_0x4c7aa4){var _0xc53c38=typeof _0x336146[_0x1717('0x2c')]===_0x1717('0x2d')&&typeof _0x336146['limit']===_0x1717('0x2d');var _0x8f9934=_0x4c7aa4[_0x1717('0x2e')];var _0x5c76d9=_0xc53c38?0x0:_0x336146[_0x1717('0x2c')];var _0x41f385=_0xc53c38?_0x4c7aa4[_0x1717('0x2e')]:_0x336146[_0x1717('0x2c')]+_0x336146[_0x1717('0x2f')];var _0x15e05b;if(_0x41f385>=_0x8f9934){_0x41f385=_0x8f9934;_0x15e05b=0xc8;}else{_0x15e05b=0xce;}_0x36bbf8['status'](_0x15e05b);return _0x36bbf8[_0x1717('0x30')](_0x1717('0x31'),_0x5c76d9+'-'+_0x41f385+'/'+_0x8f9934)[_0x1717('0x2b')](_0x4c7aa4);}return null;};}function patchUpdates(_0x3fef67){return function(_0x1e918a){try{jsonpatch['apply'](_0x1e918a,_0x3fef67,!![]);}catch(_0x26cd97){return BPromise['reject'](_0x26cd97);}return _0x1e918a[_0x1717('0x32')]();};}function saveUpdates(_0x5346a5,_0x33dbf1){return function(_0xb68b64){if(_0xb68b64){return _0xb68b64[_0x1717('0x33')](_0x5346a5)[_0x1717('0x34')](function(_0x514ae1){return _0x514ae1;});}return null;};}function removeEntity(_0x1bade0,_0x5c6f6e){return function(_0x2e9ac9){if(_0x2e9ac9){return _0x2e9ac9['destroy']()[_0x1717('0x34')](function(){var _0x543170=_0x2e9ac9[_0x1717('0x35')]({'plain':!![]});var _0x571ade='SmsAccounts';return db[_0x1717('0x36')][_0x1717('0x37')]({'where':{'type':_0x571ade,'resourceId':_0x543170['id']}})[_0x1717('0x34')](function(){return _0x2e9ac9;});})[_0x1717('0x34')](function(){_0x1bade0[_0x1717('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111475,_0x207435){return function(_0x1524c1){if(!_0x1524c1){_0x111475[_0x1717('0x28')](0x194);}return _0x1524c1;};}function handleError(_0x10decb,_0x2a85e3){_0x2a85e3=_0x2a85e3||0x1f4;return function(_0x15457c){logger[_0x1717('0x22')](_0x15457c[_0x1717('0x38')]);if(_0x15457c['name']){delete _0x15457c[_0x1717('0x39')];}_0x10decb[_0x1717('0x29')](_0x2a85e3)[_0x1717('0x3a')](_0x15457c);};}exports['index']=function(_0x48949e,_0xa1e8e1){var _0x1d9684={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xa118a9={},_0x4c8bc4={'count':0x0,'rows':[]};var _0x3678fd=_[_0x1717('0x3b')](db[_0x1717('0x3c')][_0x1717('0x3d')],function(_0x1883f9){return{'name':_0x1883f9[_0x1717('0x3e')],'type':_0x1883f9[_0x1717('0x3f')][_0x1717('0x40')]};});_0xa118a9['model']=_[_0x1717('0x3b')](_0x3678fd,_0x1717('0x39'));_0xa118a9[_0x1717('0x41')]=_[_0x1717('0x42')](_0x48949e['query']);_0xa118a9[_0x1717('0x43')]=_[_0x1717('0x44')](_0xa118a9[_0x1717('0x45')],_0xa118a9[_0x1717('0x41')]);_0x1d9684[_0x1717('0x46')]=_['intersection'](_0xa118a9[_0x1717('0x45')],qs['fields'](_0x48949e[_0x1717('0x41')][_0x1717('0x47')]));_0x1d9684[_0x1717('0x46')]=_0x1d9684['attributes'][_0x1717('0x48')]?_0x1d9684[_0x1717('0x46')]:_0xa118a9['model'];if(!_0x48949e[_0x1717('0x41')]['hasOwnProperty'](_0x1717('0x49'))){_0x1d9684[_0x1717('0x2f')]=qs[_0x1717('0x2f')](_0x48949e[_0x1717('0x41')][_0x1717('0x2f')]);_0x1d9684[_0x1717('0x2c')]=qs['offset'](_0x48949e[_0x1717('0x41')]['offset']);}_0x1d9684[_0x1717('0x4a')]=qs[_0x1717('0x4b')](_0x48949e[_0x1717('0x41')][_0x1717('0x4b')]);_0x1d9684[_0x1717('0x4c')]=qs['filters'](_[_0x1717('0x4d')](_0x48949e[_0x1717('0x41')],_0xa118a9[_0x1717('0x43')]),_0x3678fd);if(_0x48949e['query'][_0x1717('0x4e')]){_0x1d9684[_0x1717('0x4c')]=_[_0x1717('0x4f')](_0x1d9684[_0x1717('0x4c')],{'$or':_[_0x1717('0x3b')](_0x3678fd,function(_0x524061){if(_0x524061[_0x1717('0x3f')]!=='VIRTUAL'){var _0x523cb5={};_0x523cb5[_0x524061[_0x1717('0x39')]]={'$like':'%'+_0x48949e[_0x1717('0x41')]['filter']+'%'};return _0x523cb5;}})});}_0x1d9684=_[_0x1717('0x4f')]({},_0x1d9684,_0x48949e['options']);var _0x13bf6d={'where':_0x1d9684[_0x1717('0x4c')]};return db[_0x1717('0x3c')][_0x1717('0x2e')](_0x13bf6d)['then'](function(_0x175bac){_0x4c8bc4[_0x1717('0x2e')]=_0x175bac;if(_0x48949e[_0x1717('0x41')][_0x1717('0x50')]){_0x1d9684[_0x1717('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0x1717('0x52')](_0x1d9684);})['then'](function(_0x333f86){_0x4c8bc4[_0x1717('0x53')]=_0x333f86;return _0x4c8bc4;})['then'](respondWithFilteredResult(_0xa1e8e1,_0x1d9684))[_0x1717('0x27')](handleError(_0xa1e8e1,null));};exports['show']=function(_0x52b075,_0x24207b){var _0x4c2809={'raw':![],'where':{'id':_0x52b075[_0x1717('0x54')]['id']},'include':[{'model':db[_0x1717('0x55')],'as':'mandatoryDispositionPause'}]},_0x3cf5f2={};_0x3cf5f2[_0x1717('0x45')]=_[_0x1717('0x42')](db['SmsAccount'][_0x1717('0x3d')]);_0x3cf5f2['query']=_[_0x1717('0x42')](_0x52b075[_0x1717('0x41')]);_0x3cf5f2[_0x1717('0x43')]=_['intersection'](_0x3cf5f2[_0x1717('0x45')],_0x3cf5f2[_0x1717('0x41')]);_0x4c2809[_0x1717('0x46')]=_['intersection'](_0x3cf5f2['model'],qs[_0x1717('0x47')](_0x52b075[_0x1717('0x41')][_0x1717('0x47')]));_0x4c2809[_0x1717('0x46')]=_0x4c2809[_0x1717('0x46')][_0x1717('0x48')]?_0x4c2809[_0x1717('0x46')]:_0x3cf5f2['model'];if(_0x52b075[_0x1717('0x41')]['includeAll']){_0x4c2809[_0x1717('0x51')]=[{'all':!![]}];}_0x4c2809=_[_0x1717('0x4f')]({},_0x4c2809,_0x52b075[_0x1717('0x56')]);return db[_0x1717('0x3c')][_0x1717('0x57')](_0x4c2809)[_0x1717('0x34')](handleEntityNotFound(_0x24207b,null))[_0x1717('0x34')](respondWithResult(_0x24207b,null))[_0x1717('0x27')](handleError(_0x24207b,null));};exports[_0x1717('0x58')]=function(_0x26b9d9,_0x413316){return db[_0x1717('0x3c')][_0x1717('0x58')](_0x26b9d9[_0x1717('0x59')],{})[_0x1717('0x34')](function(_0x4d29e0){var _0x280505=_0x26b9d9[_0x1717('0x5a')][_0x1717('0x35')]({'plain':!![]});if(!_0x280505)throw new Error(_0x1717('0x5b'));if(_0x280505[_0x1717('0x5c')]===_0x1717('0x5a')){var _0x4ab57b=_0x4d29e0[_0x1717('0x35')]({'plain':!![]});var _0x1c013a='SmsAccounts';return db[_0x1717('0x5d')][_0x1717('0x57')]({'where':{'name':_0x1c013a,'userProfileId':_0x280505[_0x1717('0x5e')]},'raw':!![]})[_0x1717('0x34')](function(_0x4353a3){if(_0x4353a3&&_0x4353a3[_0x1717('0x5f')]===0x0){return db[_0x1717('0x36')][_0x1717('0x58')]({'name':_0x4ab57b[_0x1717('0x39')],'resourceId':_0x4ab57b['id'],'type':_0x4353a3[_0x1717('0x39')],'sectionId':_0x4353a3['id']},{})[_0x1717('0x34')](function(){return _0x4d29e0;});}else{return _0x4d29e0;}})[_0x1717('0x27')](function(_0x1ffd03){logger[_0x1717('0x22')](_0x1717('0x60'),_0x1ffd03);throw _0x1ffd03;});}return _0x4d29e0;})['then'](respondWithResult(_0x413316,0xc9))[_0x1717('0x27')](handleError(_0x413316,null));};exports[_0x1717('0x33')]=function(_0x20fafc,_0x239813){if(_0x20fafc[_0x1717('0x59')]['id']){delete _0x20fafc[_0x1717('0x59')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x20fafc[_0x1717('0x54')]['id']},'include':[{'model':db[_0x1717('0x55')],'as':_0x1717('0x61')}]})[_0x1717('0x34')](handleEntityNotFound(_0x239813,null))[_0x1717('0x34')](saveUpdates(_0x20fafc[_0x1717('0x59')],null))[_0x1717('0x34')](respondWithResult(_0x239813,null))[_0x1717('0x27')](handleError(_0x239813,null));};exports[_0x1717('0x37')]=function(_0x3c734d,_0x2a1653){return db['SmsAccount'][_0x1717('0x57')]({'where':{'id':_0x3c734d[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x2a1653,null))['then'](removeEntity(_0x2a1653,null))[_0x1717('0x27')](handleError(_0x2a1653,null));};exports[_0x1717('0x62')]=function(_0x780082,_0x5e8cc5){return db[_0x1717('0x3c')][_0x1717('0x62')]()[_0x1717('0x34')](respondWithResult(_0x5e8cc5,null))['catch'](handleError(_0x5e8cc5,null));};exports[_0x1717('0x63')]=function(_0x53edf0,_0x43a644,_0xfc470c){if(_0x53edf0[_0x1717('0x59')]['id']){delete _0x53edf0[_0x1717('0x59')]['id'];}return db[_0x1717('0x3c')][_0x1717('0x57')]({'where':{'id':_0x53edf0[_0x1717('0x54')]['id']}})['then'](handleEntityNotFound(_0x43a644,null))['then'](function(_0x300c8a){if(_0x300c8a){_0x53edf0['body'][_0x1717('0x64')]=_0x300c8a['id'];return db[_0x1717('0x65')][_0x1717('0x58')](_0x53edf0[_0x1717('0x59')]);}})['then'](respondWithResult(_0x43a644,null))['catch'](handleError(_0x43a644,null));};exports['getDispositions']=function(_0x2e0c74,_0x4b1eb7,_0x13194a){var _0x5801b8={'raw':![],'where':{}};var _0x4529cb={};var _0xb9cd52={'count':0x0,'rows':[]};return db[_0x1717('0x3c')][_0x1717('0x66')]({'where':{'id':_0x2e0c74['params']['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x4b1eb7,null))[_0x1717('0x34')](function(_0x5c2fe6){if(_0x5c2fe6){_0x4529cb['model']=_['keys'](db[_0x1717('0x65')][_0x1717('0x3d')]);_0x4529cb[_0x1717('0x41')]=_[_0x1717('0x42')](_0x2e0c74[_0x1717('0x41')]);_0x4529cb[_0x1717('0x43')]=_[_0x1717('0x44')](_0x4529cb[_0x1717('0x45')],_0x4529cb['query']);_0x5801b8[_0x1717('0x46')]=_[_0x1717('0x44')](_0x4529cb[_0x1717('0x45')],qs['fields'](_0x2e0c74[_0x1717('0x41')][_0x1717('0x47')]));_0x5801b8[_0x1717('0x46')]=_0x5801b8['attributes'][_0x1717('0x48')]?_0x5801b8[_0x1717('0x46')]:_0x4529cb[_0x1717('0x45')];if(!_0x2e0c74[_0x1717('0x41')][_0x1717('0x67')](_0x1717('0x49'))){_0x5801b8['limit']=qs[_0x1717('0x2f')](_0x2e0c74['query'][_0x1717('0x2f')]);_0x5801b8['offset']=qs[_0x1717('0x2c')](_0x2e0c74[_0x1717('0x41')][_0x1717('0x2c')]);}_0x5801b8['order']=qs[_0x1717('0x4b')](_0x2e0c74['query'][_0x1717('0x4b')]);_0x5801b8[_0x1717('0x4c')]=qs[_0x1717('0x43')](_[_0x1717('0x4d')](_0x2e0c74[_0x1717('0x41')],_0x4529cb[_0x1717('0x43')]));_0x5801b8['where']['SmsAccountId']=_0x5c2fe6['id'];if(_0x2e0c74[_0x1717('0x41')]['filter']){_0x5801b8[_0x1717('0x4c')]=_['merge'](_0x5801b8['where'],{'$or':_[_0x1717('0x3b')](_0x5801b8[_0x1717('0x46')],function(_0xa6681){var _0x3c8082={};_0x3c8082[_0xa6681]={'$like':'%'+_0x2e0c74[_0x1717('0x41')][_0x1717('0x4e')]+'%'};return _0x3c8082;})});}_0x5801b8=_['merge']({},_0x5801b8,_0x2e0c74[_0x1717('0x56')]);return db[_0x1717('0x65')]['count']({'where':_0x5801b8['where']})[_0x1717('0x34')](function(_0x59b691){_0xb9cd52[_0x1717('0x2e')]=_0x59b691;if(_0x2e0c74['query'][_0x1717('0x50')]){_0x5801b8[_0x1717('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x1717('0x52')](_0x5801b8);})['then'](function(_0x45f343){_0xb9cd52['rows']=_0x45f343;return _0xb9cd52;});}})[_0x1717('0x34')](respondWithFilteredResult(_0x4b1eb7,_0x5801b8))[_0x1717('0x27')](handleError(_0x4b1eb7,null));};exports[_0x1717('0x68')]=function(_0x5b45e5,_0x39a4d0,_0x20302c){return db[_0x1717('0x3c')][_0x1717('0x57')]({'where':{'id':_0x5b45e5[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x39a4d0,null))[_0x1717('0x34')](function(_0x2a32e7){if(_0x2a32e7){return _0x2a32e7[_0x1717('0x68')](_0x5b45e5['query'][_0x1717('0x69')]);}})['then'](respondWithStatusCode(_0x39a4d0,null))[_0x1717('0x27')](handleError(_0x39a4d0,null));};exports[_0x1717('0x6a')]=function(_0x24f7ea,_0x24c1ec,_0x17e99e){if(_0x24f7ea[_0x1717('0x59')]['id']){delete _0x24f7ea[_0x1717('0x59')]['id'];}return db[_0x1717('0x3c')][_0x1717('0x57')]({'where':{'id':_0x24f7ea[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x24c1ec,null))[_0x1717('0x34')](function(_0x3e0e6d){if(_0x3e0e6d){_0x24f7ea[_0x1717('0x59')][_0x1717('0x64')]=_0x3e0e6d['id'];return db[_0x1717('0x6b')][_0x1717('0x58')](_0x24f7ea[_0x1717('0x59')]);}})[_0x1717('0x34')](respondWithResult(_0x24c1ec,null))[_0x1717('0x27')](handleError(_0x24c1ec,null));};exports['getAnswers']=function(_0x3fc9ac,_0x33c0f6,_0x5cb38e){var _0xbfee07={'raw':![],'where':{}};var _0x167421={};var _0x3be832={'count':0x0,'rows':[]};return db[_0x1717('0x3c')][_0x1717('0x66')]({'where':{'id':_0x3fc9ac[_0x1717('0x54')]['id']}})['then'](handleEntityNotFound(_0x33c0f6,null))[_0x1717('0x34')](function(_0x1c8db0){if(_0x1c8db0){_0x167421[_0x1717('0x45')]=_['keys'](db[_0x1717('0x6b')]['rawAttributes']);_0x167421[_0x1717('0x41')]=_[_0x1717('0x42')](_0x3fc9ac[_0x1717('0x41')]);_0x167421['filters']=_[_0x1717('0x44')](_0x167421[_0x1717('0x45')],_0x167421[_0x1717('0x41')]);_0xbfee07[_0x1717('0x46')]=_['intersection'](_0x167421[_0x1717('0x45')],qs[_0x1717('0x47')](_0x3fc9ac['query'][_0x1717('0x47')]));_0xbfee07['attributes']=_0xbfee07[_0x1717('0x46')]['length']?_0xbfee07[_0x1717('0x46')]:_0x167421[_0x1717('0x45')];if(!_0x3fc9ac[_0x1717('0x41')][_0x1717('0x67')](_0x1717('0x49'))){_0xbfee07[_0x1717('0x2f')]=qs[_0x1717('0x2f')](_0x3fc9ac[_0x1717('0x41')][_0x1717('0x2f')]);_0xbfee07[_0x1717('0x2c')]=qs['offset'](_0x3fc9ac[_0x1717('0x41')][_0x1717('0x2c')]);}_0xbfee07[_0x1717('0x4a')]=qs['sort'](_0x3fc9ac[_0x1717('0x41')][_0x1717('0x4b')]);_0xbfee07[_0x1717('0x4c')]=qs[_0x1717('0x43')](_[_0x1717('0x4d')](_0x3fc9ac[_0x1717('0x41')],_0x167421[_0x1717('0x43')]));_0xbfee07[_0x1717('0x4c')][_0x1717('0x64')]=_0x1c8db0['id'];if(_0x3fc9ac['query'][_0x1717('0x4e')]){_0xbfee07['where']=_[_0x1717('0x4f')](_0xbfee07[_0x1717('0x4c')],{'$or':_[_0x1717('0x3b')](_0xbfee07[_0x1717('0x46')],function(_0x3e5095){var _0x5c9cbc={};_0x5c9cbc[_0x3e5095]={'$like':'%'+_0x3fc9ac[_0x1717('0x41')][_0x1717('0x4e')]+'%'};return _0x5c9cbc;})});}_0xbfee07=_[_0x1717('0x4f')]({},_0xbfee07,_0x3fc9ac[_0x1717('0x56')]);return db[_0x1717('0x6b')][_0x1717('0x2e')]({'where':_0xbfee07[_0x1717('0x4c')]})['then'](function(_0x2dcb88){_0x3be832[_0x1717('0x2e')]=_0x2dcb88;if(_0x3fc9ac['query']['includeAll']){_0xbfee07['include']=[{'all':!![]}];}return db[_0x1717('0x6b')][_0x1717('0x52')](_0xbfee07);})[_0x1717('0x34')](function(_0x1d9c77){_0x3be832[_0x1717('0x53')]=_0x1d9c77;return _0x3be832;});}})[_0x1717('0x34')](respondWithFilteredResult(_0x33c0f6,_0xbfee07))[_0x1717('0x27')](handleError(_0x33c0f6,null));};exports[_0x1717('0x6c')]=function(_0x3ab613,_0x4f5202,_0x61aa12){return db['SmsAccount']['find']({'where':{'id':_0x3ab613[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x4f5202,null))[_0x1717('0x34')](function(_0x252b76){if(_0x252b76){return _0x252b76[_0x1717('0x6c')](_0x3ab613[_0x1717('0x41')][_0x1717('0x69')]);}})[_0x1717('0x34')](respondWithStatusCode(_0x4f5202,null))[_0x1717('0x27')](handleError(_0x4f5202,null));};exports[_0x1717('0x6d')]=function(_0x478f46,_0x5cfff0,_0x2c2cba){var _0x1ae63e={'channel':'sms'};var _0xcf2735=[];var _0xd4d4b=[];var _0x329166={};return db[_0x1717('0x3c')]['find']({'where':{'id':_0x478f46[_0x1717('0x54')]['id']},'include':[{'model':db[_0x1717('0x6e')],'as':_0x1717('0x6f')}]})['then'](handleEntityNotFound(_0x5cfff0,null))[_0x1717('0x34')](function(_0x5d29a8){_0x1ae63e['account']=_0x5d29a8;_0x1ae63e[_0x1717('0x70')]=_[_0x1717('0x71')](_0x5d29a8[_0x1717('0x6f')],[_0x1717('0x72')],['asc']);if(_0x1ae63e['account'][_0x1717('0x6f')]){delete _0x1ae63e[_0x1717('0x73')][_0x1717('0x6f')];}return db[_0x1717('0x74')][_0x1717('0x62')]();})[_0x1717('0x34')](function(_0x25b9fe){if(!_0x25b9fe){throw new db[(_0x1717('0x75'))][(_0x1717('0x76'))](_0x1717('0x77'));}_0xcf2735=_[_0x1717('0x78')](_[_0x1717('0x42')](_0x25b9fe),[_0x1717('0x79'),'updatedAt']);_0xd4d4b=_[_0x1717('0x78')](_[_0x1717('0x42')](_0x25b9fe),['createdAt',_0x1717('0x7a'),_0x1717('0x7b'),_0x1717('0x7c')]);_0x1ae63e['body']={'mapKey':_0x1717('0x7d')};if(_0x1ae63e[_0x1717('0x73')][_0x1717('0x3f')]){switch(_0x1ae63e[_0x1717('0x73')][_0x1717('0x3f')]){case _0x1717('0x7e'):_0x1ae63e[_0x1717('0x59')]['from']=_0x478f46[_0x1717('0x59')][_0x1717('0x7f')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')]=_0x478f46['body'][_0x1717('0x80')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x81')]=_0x478f46[_0x1717('0x59')][_0x1717('0x82')];break;case _0x1717('0x83'):_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')]='+'+_0x478f46[_0x1717('0x59')][_0x1717('0x85')];_0x1ae63e[_0x1717('0x59')]['body']=_0x478f46['body'][_0x1717('0x86')];break;case _0x1717('0x87'):_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')]=_0x478f46[_0x1717('0x59')][_0x1717('0x84')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')]=_0x478f46[_0x1717('0x59')][_0x1717('0x24')];break;case _0x1717('0x88'):_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')]=_0x478f46[_0x1717('0x59')]['from'];_0x1ae63e[_0x1717('0x59')]['body']=_0x478f46[_0x1717('0x59')][_0x1717('0x59')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x81')]=_0x478f46[_0x1717('0x59')]['message_id'];break;case _0x1717('0x89'):_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')]=_0x478f46[_0x1717('0x59')][_0x1717('0x7f')];_0x1ae63e['body']['body']=_0x478f46[_0x1717('0x59')]['Text'];_0x1ae63e[_0x1717('0x59')][_0x1717('0x81')]=_0x478f46[_0x1717('0x59')][_0x1717('0x8a')];break;case _0x1717('0x8b'):_0x1ae63e['body'][_0x1717('0x84')]='+'+_0x478f46[_0x1717('0x59')][_0x1717('0x8c')][0x0][_0x1717('0x84')];_0x1ae63e[_0x1717('0x59')]['body']=_0x478f46[_0x1717('0x59')][_0x1717('0x8c')][0x0][_0x1717('0x86')];_0x1ae63e[_0x1717('0x59')]['messageId']=_0x478f46['body'][_0x1717('0x8c')][0x0][_0x1717('0x81')];break;case _0x1717('0x8d'):_0x1ae63e['body'][_0x1717('0x84')]=_0x478f46['body'][_0x1717('0x8e')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')]=_0x478f46[_0x1717('0x59')]['segmentedMessage'][_0x1717('0x24')];break;case'clickatell':_0x1ae63e['body'][_0x1717('0x84')]=_0x478f46[_0x1717('0x59')][_0x1717('0x8f')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')]=_0x478f46[_0x1717('0x59')]['text'];_0x1ae63e['body'][_0x1717('0x81')]=_0x478f46[_0x1717('0x59')][_0x1717('0x90')];break;case _0x1717('0x91'):_0x1ae63e[_0x1717('0x59')]['messageId']=_0x478f46[_0x1717('0x59')][0x0][_0x1717('0x24')]['id'];_0x1ae63e['body'][_0x1717('0x84')]=_0x478f46['body'][0x0]['message']['from'];_0x1ae63e[_0x1717('0x59')]['body']=_0x478f46['body'][0x0][_0x1717('0x24')]['text'];break;case'intelepeer':_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')]=_0x478f46[_0x1717('0x59')][_0x1717('0x84')];_0x1ae63e[_0x1717('0x59')]['body']=_0x478f46[_0x1717('0x59')][_0x1717('0x24')];_0x1ae63e[_0x1717('0x59')][_0x1717('0x81')]=_0x478f46['body'][_0x1717('0x92')];break;}}if(_0x1ae63e[_0x1717('0x59')]['id']){delete _0x1ae63e[_0x1717('0x59')]['id'];}if(_[_0x1717('0x93')](_0x1ae63e['body'][_0x1717('0x84')])){throw new db[(_0x1717('0x75'))][(_0x1717('0x76'))](_0x1717('0x94'));}if(_['isNil'](_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')])||_0x1ae63e['body'][_0x1717('0x59')]===''){throw new db['Sequelize'][(_0x1717('0x76'))](_0x1717('0x95'));}if(_[_0x1717('0x93')](_0x1ae63e[_0x1717('0x59')][_0x1717('0x96')])){throw new db[(_0x1717('0x75'))][(_0x1717('0x76'))](_0x1717('0x97')+_0xd4d4b);}if(!_['includes'](_0xd4d4b,_0x1ae63e[_0x1717('0x59')]['mapKey'])){throw new db[(_0x1717('0x75'))][(_0x1717('0x76'))](_0x1717('0x98')+_0xd4d4b);}_0x329166[_0x1ae63e[_0x1717('0x59')][_0x1717('0x96')]]=_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')];return db[_0x1717('0x99')]['find']({'where':{'id':_0x1ae63e[_0x1717('0x73')][_0x1717('0x7c')]},'include':[{'model':db[_0x1717('0x74')],'as':_0x1717('0x9a'),'where':_0x329166,'limit':0x1,'order':[[_0x1717('0x7a'),_0x1717('0x9b')]]}]});})[_0x1717('0x34')](handleEntityNotFound(_0x5cfff0,null))[_0x1717('0x34')](function(_0x716906){if(_0x716906){_0x1ae63e[_0x1717('0x9c')]=_[_0x1717('0x9d')](_0x716906,['Contacts']);if(_0x716906[_0x1717('0x9a')][_0x1717('0x48')]){return _0x716906[_0x1717('0x9a')][0x0];}var _0xdec6ae=_[_0x1717('0x17')](_0x1ae63e[_0x1717('0x59')],{'firstName':_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')],'ListId':_0x716906['id']});_0xdec6ae[_0x1ae63e[_0x1717('0x59')]['mapKey']]=_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')];return db[_0x1717('0x74')]['create'](_0xdec6ae,{'fields':_0xcf2735,'raw':!![]});}})['then'](handleEntityNotFound(_0x5cfff0,null))[_0x1717('0x34')](function(_0x53681b){if(_0x53681b){_0x1ae63e['contact']=_0x53681b;var _0x139b11={'ContactId':_0x53681b['id'],'phone':_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')],'SmsAccountId':_0x478f46['params']['id']};var _0x52a63a={'ContactId':_0x53681b['id'],'SmsAccountId':_0x478f46[_0x1717('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x1717('0x57')]({'where':_0x52a63a})[_0x1717('0x34')](function(_0x27ae1b){if(_0x27ae1b){return[_0x27ae1b,![]];}return db['SmsInteraction'][_0x1717('0x58')](_0x139b11)[_0x1717('0x34')](function(_0x4556e0){return[_0x4556e0,!![]];});});}})[_0x1717('0x9e')](function(_0x4bef8a,_0x16bd7c){_0x1ae63e[_0x1717('0x9f')]=_0x4bef8a['get']({'plain':!![]});_0x1ae63e[_0x1717('0x9f')]['created']=![];if(_0x16bd7c){if(_0x1ae63e[_0x1717('0x73')]['autoclose']){_0x1ae63e[_0x1717('0x70')]['push']({'id':0x0,'priority':_0x1ae63e[_0x1717('0x70')][_0x1717('0x48')]+0x1,'app':'close','appdata':_0x1717('0xa0'),'interval':_0x1717('0xa1')});}_0x1ae63e[_0x1717('0x9f')][_0x1717('0xa2')]=!![];}return db[_0x1717('0xa3')][_0x1717('0x58')]({'phone':_0x1ae63e[_0x1717('0x59')][_0x1717('0x84')],'messageId':_0x1ae63e[_0x1717('0x59')][_0x1717('0x81')],'body':_0x1ae63e[_0x1717('0x59')][_0x1717('0x59')],'SmsAccountId':_0x478f46['params']['id'],'SmsInteractionId':_0x4bef8a['id'],'direction':'in','ContactId':_0x4bef8a[_0x1717('0xa4')],'AttachmentId':_0x1ae63e[_0x1717('0x59')][_0x1717('0xa5')]});})[_0x1717('0x34')](function(_0xc88d27){_0x1ae63e['message']=_0xc88d27;if(!_0x1ae63e[_0x1717('0x9f')][_0x1717('0xa6')])return;return db['User'][_0x1717('0x57')]({'attributes':['id',_0x1717('0x39')],'where':{'id':_0x1ae63e[_0x1717('0x9f')]['UserId']}});})['then'](function(_0x233a51){if(_0x233a51){_0x1ae63e[_0x1717('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x233a51[_0x1717('0x39')]+','+(_0x1ae63e['account'][_0x1717('0xa7')]||0xa),'interval':_0x1717('0xa1')});}if(!_0x1ae63e['interaction'][_0x1717('0xa8')])return;return db['SmsQueue']['find']({'attributes':['id',_0x1717('0x39')],'where':{'id':_0x1ae63e[_0x1717('0x9f')]['queueId']}});})['then'](function(_0xa2fa1c){if(_0xa2fa1c){_0x1ae63e[_0x1717('0x70')][_0x1717('0xa9')]({'id':0x0,'priority':0x1,'app':_0x1717('0xaa'),'appdata':_0xa2fa1c['name']+','+(_0x1ae63e['account'][_0x1717('0xab')]||0x12c),'interval':_0x1717('0xa1')});}return respondWithRpcPromise('Start',_0x1717('0xac'),_0x1ae63e);})[_0x1717('0x34')](function(_0x52004b){if(_0x52004b){var _0x47fb2d=0xc8;var _0x52539c=_0x1717('0xad');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x52539c,_0x47fb2d,_0x1717('0xae'));logger[_0x1717('0x20')](_0x1717('0xaf'),_0x52539c,_0x47fb2d,'entity\x20found',JSON['stringify'](_0x52004b));if(_0x1ae63e['account']['type']===_0x1717('0x7e')){return _0x5cfff0[_0x1717('0x29')](_0x47fb2d)[_0x1717('0x30')](_0x1717('0xb0'),_0x1717('0xb1'))['send'](_0x1717('0xb2'));}else{return _0x5cfff0[_0x1717('0x29')](_0x47fb2d)['json'](_0x52004b);}}})['catch'](handleError(_0x5cfff0,null));};exports['addApplications']=function(_0x4ccfed,_0x7fe5e8){var _0x14bf23=_0x4ccfed[_0x1717('0x54')]['id'];var _0x272c48=_0x4ccfed[_0x1717('0x59')];var _0x2dbe2a=0xc8;var _0x162afa=null;return db[_0x1717('0xb3')][_0x1717('0xb4')]({'isolationLevel':db['sequelize'][_0x1717('0xb5')][_0x1717('0xb6')][_0x1717('0xb7')]},function(_0x313605){return db[_0x1717('0x3c')][_0x1717('0x66')]({'where':{'id':_0x14bf23},'transaction':_0x313605})[_0x1717('0x34')](function(_0x15ce27){if(_0x15ce27){return db[_0x1717('0x6e')][_0x1717('0x37')]({'where':{'SmsAccountId':_0x14bf23},'transaction':_0x313605})[_0x1717('0x34')](function(){var _0x257b3e=_['map'](_0x272c48,function(_0x59f404){_0x59f404[_0x1717('0x64')]=_0x14bf23;return _0x59f404;});return db[_0x1717('0x6e')][_0x1717('0xb8')](_0x257b3e,{'transaction':_0x313605});});}else{_0x2dbe2a=0x194;_0x162afa=[];}});})['then'](function(){if(_0x2dbe2a!==0x194){return db[_0x1717('0x6e')][_0x1717('0xb9')]({'where':{'SmsAccountId':_0x14bf23},'order':_0x1717('0x72')})[_0x1717('0x34')](function(_0x554e26){_0x162afa=_0x554e26;});}})['catch'](function(_0x55373f){_0x2dbe2a=0x1f4;logger[_0x1717('0x22')](_0x55373f['stack']);if(_0x55373f[_0x1717('0x39')]){delete _0x55373f['name'];}_0x162afa=_0x55373f;})[_0x1717('0xba')](function(){if(_0x162afa===null){_0x7fe5e8[_0x1717('0x28')](_0x2dbe2a);}else{if(_0x2dbe2a===0x1f4){_0x7fe5e8['status'](_0x2dbe2a)[_0x1717('0x3a')](_0x162afa);}else{_0x7fe5e8[_0x1717('0x29')](_0x2dbe2a)[_0x1717('0x2b')](_0x162afa);}}});};exports[_0x1717('0xbb')]=function(_0x59fbc1,_0x31e712,_0x50aae7){var _0x1c2906={};var _0x4b56ac={};var _0x47987d;var _0x20abad;return db[_0x1717('0x3c')][_0x1717('0x66')]({'where':{'id':_0x59fbc1[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x31e712,null))[_0x1717('0x34')](function(_0x225dcb){if(_0x225dcb){_0x47987d=_0x225dcb;_0x4b56ac[_0x1717('0x45')]=_[_0x1717('0x42')](db[_0x1717('0x6e')][_0x1717('0x3d')]);_0x4b56ac[_0x1717('0x41')]=_[_0x1717('0x42')](_0x59fbc1[_0x1717('0x41')]);_0x4b56ac[_0x1717('0x43')]=_[_0x1717('0x44')](_0x4b56ac['model'],_0x4b56ac[_0x1717('0x41')]);_0x1c2906[_0x1717('0x46')]=_[_0x1717('0x44')](_0x4b56ac[_0x1717('0x45')],qs[_0x1717('0x47')](_0x59fbc1[_0x1717('0x41')][_0x1717('0x47')]));_0x1c2906[_0x1717('0x46')]=_0x1c2906['attributes'][_0x1717('0x48')]?_0x1c2906['attributes']:_0x4b56ac[_0x1717('0x45')];_0x1c2906['order']=qs[_0x1717('0x4b')](_0x59fbc1[_0x1717('0x41')][_0x1717('0x4b')]);_0x1c2906[_0x1717('0x4c')]=qs[_0x1717('0x43')](_['pick'](_0x59fbc1[_0x1717('0x41')],_0x4b56ac[_0x1717('0x43')]));if(_0x59fbc1[_0x1717('0x41')][_0x1717('0x4e')]){_0x1c2906['where']=_['merge'](_0x1c2906[_0x1717('0x4c')],{'$or':_[_0x1717('0x3b')](_0x1c2906[_0x1717('0x46')],function(_0x1df629){var _0x3fa5b9={};_0x3fa5b9[_0x1df629]={'$like':'%'+_0x59fbc1[_0x1717('0x41')]['filter']+'%'};return _0x3fa5b9;})});}_0x1c2906=_[_0x1717('0x4f')]({},_0x1c2906,_0x59fbc1[_0x1717('0x56')]);return _0x47987d[_0x1717('0xbb')](_0x1c2906);}})['then'](function(_0x24f5d2){if(_0x24f5d2){_0x20abad=_0x24f5d2[_0x1717('0x48')];if(!_0x59fbc1[_0x1717('0x41')][_0x1717('0x67')](_0x1717('0x49'))){_0x1c2906[_0x1717('0x2f')]=qs[_0x1717('0x2f')](_0x59fbc1['query']['limit']);_0x1c2906['offset']=qs[_0x1717('0x2c')](_0x59fbc1['query']['offset']);}return _0x47987d[_0x1717('0xbb')](_0x1c2906);}})[_0x1717('0x34')](function(_0x2ec2b0){if(_0x2ec2b0){return _0x2ec2b0?{'count':_0x20abad,'rows':_0x2ec2b0}:null;}})[_0x1717('0x34')](respondWithResult(_0x31e712,null))[_0x1717('0x27')](handleError(_0x31e712,null));};exports['getInteractions']=function(_0x174006,_0x121c7b,_0x2df06e){var _0x332edc={'raw':![],'where':{}};var _0xb4003a={};var _0x232e27={'count':0x0,'rows':[]};return db[_0x1717('0x3c')][_0x1717('0x66')]({'where':{'id':_0x174006[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x121c7b,null))[_0x1717('0x34')](function(_0x32d844){if(_0x32d844){_0xb4003a[_0x1717('0x45')]=_[_0x1717('0x42')](db[_0x1717('0xbc')][_0x1717('0x3d')]);_0xb4003a['query']=_[_0x1717('0x42')](_0x174006[_0x1717('0x41')]);_0xb4003a['filters']=_[_0x1717('0x44')](_0xb4003a[_0x1717('0x45')],_0xb4003a[_0x1717('0x41')]);_0x332edc[_0x1717('0x46')]=_[_0x1717('0x44')](_0xb4003a[_0x1717('0x45')],qs[_0x1717('0x47')](_0x174006[_0x1717('0x41')][_0x1717('0x47')]));_0x332edc[_0x1717('0x46')]=_0x332edc[_0x1717('0x46')]['length']?_0x332edc[_0x1717('0x46')]:_0xb4003a[_0x1717('0x45')];if(!_0x174006[_0x1717('0x41')]['hasOwnProperty']('nolimit')){_0x332edc[_0x1717('0x2f')]=qs[_0x1717('0x2f')](_0x174006[_0x1717('0x41')][_0x1717('0x2f')]);_0x332edc[_0x1717('0x2c')]=qs[_0x1717('0x2c')](_0x174006[_0x1717('0x41')]['offset']);}_0x332edc[_0x1717('0x4a')]=qs[_0x1717('0x4b')](_0x174006[_0x1717('0x41')]['sort']);_0x332edc[_0x1717('0x4c')]=qs['filters'](_[_0x1717('0x4d')](_0x174006[_0x1717('0x41')],_0xb4003a[_0x1717('0x43')]));_0x332edc[_0x1717('0x4c')][_0x1717('0x64')]=_0x32d844['id'];if(_0x174006[_0x1717('0x41')][_0x1717('0x4e')]){_0x332edc[_0x1717('0x4c')]=_[_0x1717('0x4f')](_0x332edc[_0x1717('0x4c')],{'$or':_['map'](_0x332edc[_0x1717('0x46')],function(_0x405b32){var _0x587060={};_0x587060[_0x405b32]={'$like':'%'+_0x174006['query'][_0x1717('0x4e')]+'%'};return _0x587060;})});}_0x332edc=_['merge']({},_0x332edc,_0x174006[_0x1717('0x56')]);return db[_0x1717('0xbc')][_0x1717('0x2e')]({'where':_0x332edc[_0x1717('0x4c')]})[_0x1717('0x34')](function(_0x26046e){_0x232e27[_0x1717('0x2e')]=_0x26046e;if(_0x174006[_0x1717('0x41')]['includeAll']){_0x332edc[_0x1717('0x51')]=[{'model':db[_0x1717('0x74')],'as':'Contact','required':![]},{'model':db[_0x1717('0xbd')],'as':_0x1717('0xbe'),'attributes':[_0x1717('0x39'),_0x1717('0xbf'),_0x1717('0xc0')],'required':![]},{'model':db[_0x1717('0xc1')],'as':'Tags','attributes':['id',_0x1717('0x39'),'color'],'where':_0x174006[_0x1717('0x41')]['tag']?{'id':_0x174006[_0x1717('0x41')][_0x1717('0xc2')]}:undefined,'required':_0x174006[_0x1717('0x41')][_0x1717('0xc2')]?!![]:![]}];}return db[_0x1717('0xbc')][_0x1717('0x52')](_0x332edc);})['then'](function(_0x5a0f46){_0x232e27[_0x1717('0x53')]=_0x5a0f46;return _0x232e27;});}})[_0x1717('0x34')](respondWithFilteredResult(_0x121c7b,_0x332edc))[_0x1717('0x27')](handleError(_0x121c7b,null));};exports[_0x1717('0x3a')]=function(_0x3c088a,_0x46e4d3,_0x5eadf2){var _0x3f2a10,_0x3a03b4,_0x734c61;if(_[_0x1717('0x93')](_0x3c088a[_0x1717('0x59')][_0x1717('0x59')])||_0x3c088a['body'][_0x1717('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0x1717('0x95'));}if(_[_0x1717('0x93')](_0x3c088a[_0x1717('0x59')]['to'])){throw new db[(_0x1717('0x75'))][(_0x1717('0x76'))]('to\x20is\x20mandatory');}_0x3f2a10=_0x3c088a[_0x1717('0x59')]['to'];return db[_0x1717('0x3c')]['find']({'where':{'id':_0x3c088a[_0x1717('0x54')]['id']},'include':[{'model':db[_0x1717('0x99')],'as':_0x1717('0xc3'),'include':[{'model':db[_0x1717('0x74')],'as':_0x1717('0x9a'),'where':{'mobile':_0x3f2a10},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x1717('0x34')](handleEntityNotFound(_0x46e4d3,null))[_0x1717('0x34')](function(_0x3cf8ac){if(_0x3cf8ac&&_0x3cf8ac[_0x1717('0xc3')]){_0x3a03b4=_0x3cf8ac[_0x1717('0x35')]({'plain':!![]});if(_0x3a03b4[_0x1717('0xc3')]&&_0x3a03b4[_0x1717('0xc3')]['Contacts']['length']){return _0x3a03b4[_0x1717('0xc3')][_0x1717('0x9a')][0x0];}return db['CmContact'][_0x1717('0x58')](_[_0x1717('0x17')](_0x3c088a[_0x1717('0x59')],{'firstName':_0x3f2a10,'mobile':_0x3f2a10,'phone':_0x3f2a10,'ListId':_0x3a03b4['ListId']}));}})[_0x1717('0x34')](handleEntityNotFound(_0x46e4d3,null))[_0x1717('0x34')](function(_0x24beae){if(_0x24beae){_0x734c61=_0x24beae;return db['SmsInteraction'][_0x1717('0x57')]({'where':{'ContactId':_0x734c61['id'],'closed':![],'SmsAccountId':_0x3a03b4['id']}})['then'](function(_0x1d0257){if(_0x1d0257){return[_0x1d0257,![]];}return db[_0x1717('0xbc')][_0x1717('0x58')]({'UserId':_0x3c088a[_0x1717('0x5a')]['id'],'ContactId':_0x734c61['id'],'SmsAccountId':_0x3a03b4['id'],'phone':_0x3f2a10,'firstMsgDirection':_0x1717('0xc4'),'Messages':[_[_0x1717('0x4f')](_0x3c088a['body'],{'read':![],'body':_0x3c088a['body'][_0x1717('0x59')],'phone':_0x3f2a10,'SmsAccountId':_0x3a03b4['id'],'UserId':_0x3c088a[_0x1717('0x5a')]['id'],'ContactId':_0x734c61['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x1717('0xc5')}]})[_0x1717('0x34')](function(_0x4bf95b){return[_0x4bf95b,!![]];});});}})[_0x1717('0x9e')](function(_0x39753e,_0x13cb2d){if(_0x13cb2d){return _0x39753e;}return db[_0x1717('0xa3')][_0x1717('0x58')](_[_0x1717('0x4f')](_0x3c088a[_0x1717('0x59')],{'read':![],'body':_0x3c088a[_0x1717('0x59')][_0x1717('0x59')],'phone':_0x3f2a10,'SmsAccountId':_0x3a03b4['id'],'SmsInteractionId':_0x39753e['id'],'UserId':_0x3c088a[_0x1717('0x5a')]['id'],'ContactId':_0x734c61['id']}))['then'](function(_0x43670c){_0x39753e[_0x1717('0xc6')]['Messages']=[];_0x39753e['dataValues'][_0x1717('0xc5')][_0x1717('0xc7')](_0x43670c['dataValues']);return _0x39753e;});})[_0x1717('0x34')](respondWithResult(_0x46e4d3,null))[_0x1717('0x27')](handleError(_0x46e4d3,null));};exports[_0x1717('0x29')]=function(_0x51379e,_0x2556dd,_0x387b89){if(_0x51379e[_0x1717('0x59')]['id']){delete _0x51379e[_0x1717('0x59')]['id'];}var _0x2d5aa0,_0x29655e,_0x42460e;return db['SmsAccount']['find']({'where':{'id':_0x51379e[_0x1717('0x54')]['id']}})['then'](handleEntityNotFound(_0x2556dd,null))[_0x1717('0x34')](function(_0x4d5b5f){if(_0x4d5b5f){_0x42460e=_0x4d5b5f;logger['debug'](_0x1717('0xc8'),'status','received\x20delivery\x20report\x20from',_0x4d5b5f[_0x1717('0x3f')],util[_0x1717('0xc9')](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));switch(_0x4d5b5f[_0x1717('0x3f')]){case'skebby':if(_0x51379e[_0x1717('0x59')]['skebby_dispatch_id']&&_0x51379e[_0x1717('0x59')][_0x1717('0x29')]){_0x29655e=_0x51379e['body'][_0x1717('0x29')];return db[_0x1717('0xa3')]['find']({'where':{'messageId':_0x51379e[_0x1717('0x59')][_0x1717('0xca')]}});}break;case _0x1717('0x87'):if(_0x51379e[_0x1717('0x59')][_0x1717('0xcb')]&&_0x51379e[_0x1717('0x59')][_0x1717('0xcc')]){_0x29655e=_0x51379e['body'][_0x1717('0xcc')];return db['SmsMessage'][_0x1717('0x57')]({'where':{'messageId':_0x51379e[_0x1717('0x59')][_0x1717('0xcb')]}});}break;case _0x1717('0x88'):if(_0x51379e['body'][_0x1717('0xcd')]&&_0x51379e[_0x1717('0x59')][_0x1717('0xce')]){_0x29655e=_0x51379e[_0x1717('0x59')][_0x1717('0xce')];return db[_0x1717('0xa3')][_0x1717('0x57')]({'where':{'messageId':_0x51379e['body'][_0x1717('0xcd')]}});}break;case _0x1717('0x8b'):var _0x245598=_0x51379e[_0x1717('0x59')]['results'][0x0];if(_0x245598[_0x1717('0x81')]&&_0x245598[_0x1717('0x29')][_0x1717('0xcf')]===_0x1717('0xd0')){_0x29655e=_0x245598[_0x1717('0x29')]['groupName'];return db[_0x1717('0xa3')][_0x1717('0x57')]({'where':{'messageId':_0x245598[_0x1717('0x81')]}});}break;case'clickatell':if(_0x51379e['body'][_0x1717('0x81')]&&_0x51379e[_0x1717('0x59')][_0x1717('0x29')]){_0x29655e=_0x51379e[_0x1717('0x59')][_0x1717('0x29')];return db['SmsMessage'][_0x1717('0x57')]({'where':{'messageId':_0x51379e[_0x1717('0x59')][_0x1717('0x81')]}});}break;case _0x1717('0x91'):if(_0x51379e[_0x1717('0x59')][0x0][_0x1717('0x24')]['id']){_0x29655e=_0x51379e['body'][0x0][_0x1717('0x3f')];return db[_0x1717('0xa3')][_0x1717('0x57')]({'where':{'messageId':_0x51379e[_0x1717('0x59')][0x0][_0x1717('0x24')]['id']}});}break;case _0x1717('0xd1'):if(_0x51379e[_0x1717('0x59')][_0x1717('0xd2')]&&_0x51379e[_0x1717('0x59')][_0x1717('0x29')]){_0x29655e=_0x51379e['body'][_0x1717('0x29')];return db[_0x1717('0xa3')][_0x1717('0x57')]({'where':{'messageId':_0x51379e[_0x1717('0x59')][_0x1717('0xd2')]}});}break;}}})[_0x1717('0x34')](handleEntityNotFound(_0x2556dd,null))[_0x1717('0x34')](function(_0x5acec6){if(_0x5acec6){_0x2d5aa0=_0x5acec6;switch(_0x42460e[_0x1717('0x3f')]){case _0x1717('0x83'):if(_0x29655e==='DELIVERED'){return _0x2d5aa0[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),_0x1717('0x29'),'skebby',util['inspect'](_0x51379e['body'],{'showHidden':![],'depth':null}));}break;case _0x1717('0x87'):if(_0x29655e==='1'){return _0x2d5aa0[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),_0x1717('0x29'),_0x1717('0x83'),util[_0x1717('0xc9')](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x51379e[_0x1717('0x59')][_0x1717('0xd3')]&&_0x29655e>=0xc8&&_0x29655e<=0xce){return _0x2d5aa0[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),'status',_0x1717('0x88'),util['inspect'](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1717('0x8b'):var _0x54ac29=_0x51379e['body'][_0x1717('0x8c')][0x0];if(_0x54ac29[_0x1717('0x29')][_0x1717('0xcf')]==='DELIVERED'){return _0x2d5aa0['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1717('0x29'),_0x1717('0x8b'),util[_0x1717('0xc9')](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1717('0xd4'):if(_0x29655e==_0x1717('0xd5')||_0x29655e=='RECEIVED_BY_RECIPIENT'){return _0x2d5aa0[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),'status',_0x1717('0xd4'),util[_0x1717('0xc9')](_0x51379e['body'],{'showHidden':![],'depth':null}));}break;case _0x1717('0x91'):if(_0x29655e==_0x1717('0xd6')){return _0x2d5aa0['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1717('0x29'),_0x1717('0x91'),util[_0x1717('0xc9')](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1717('0xd1'):if(_0x29655e===_0x1717('0xd7')||_0x29655e===_0x1717('0xd8')){return _0x2d5aa0[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),_0x1717('0x29'),_0x1717('0xd1'),util['inspect'](_0x51379e[_0x1717('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2d5aa0;}})[_0x1717('0x34')](respondWithResult(_0x2556dd,null))[_0x1717('0x27')](handleError(_0x2556dd,null));};exports['statusGet']=function(_0xe66783,_0x292540,_0x4c07e0){var _0x187c87,_0x277c90,_0x524c3b;return db[_0x1717('0x3c')][_0x1717('0x57')]({'where':{'id':_0xe66783[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x292540,null))[_0x1717('0x34')](function(_0x34d976){if(_0x34d976){_0x524c3b=_0x34d976;logger[_0x1717('0x20')](_0x1717('0xc8'),_0x1717('0x29'),'received\x20delivery\x20report\x20from',_0x34d976['type'],util[_0x1717('0xc9')](_0xe66783['query'],{'showHidden':![],'depth':null}));switch(_0x34d976[_0x1717('0x3f')]){case _0x1717('0x8d'):if(_0xe66783[_0x1717('0x41')]['message-id']&&_0xe66783['query'][_0x1717('0xd9')]){_0x277c90=_0xe66783[_0x1717('0x41')][_0x1717('0xd9')];return db[_0x1717('0xa3')][_0x1717('0x57')]({'where':{'messageId':_0xe66783[_0x1717('0x41')][_0x1717('0xda')]}});}break;}}})[_0x1717('0x34')](handleEntityNotFound(_0x292540,null))[_0x1717('0x34')](function(_0x4e5270){if(_0x4e5270){_0x187c87=_0x4e5270;switch(_0x524c3b['type']){case _0x1717('0x8d'):if(_0x277c90==='2'||_0x277c90==='6'){return _0x187c87[_0x1717('0x33')]({'read':!![]});}else{logger[_0x1717('0x22')](_0x1717('0xc8'),'status',_0x1717('0x8d'),util['inspect'](_0xe66783[_0x1717('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x187c87;}})['then'](respondWithResult(_0x292540,null))['catch'](handleError(_0x292540,null));};exports[_0x1717('0xdb')]=function(_0x1201d1,_0x466745,_0xce1daa){return db['SmsAccount'][_0x1717('0x57')]({'where':{'id':_0x1201d1[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x466745,null))[_0x1717('0x34')](function(_0x3303c9){if(_0x3303c9){return _0x3303c9['addAgents'](_0x1201d1[_0x1717('0x59')][_0x1717('0x69')],_['omit'](_0x1201d1['body'],['ids','id'])||{})['spread'](function(_0x5aaaf6){for(var _0x2fa104=0x0;_0x2fa104<_0x1201d1['body'][_0x1717('0x69')]['length'];_0x2fa104+=0x1){socket[_0x1717('0xdc')](_0x1717('0xdd'),{'UserId':Number(_0x1201d1[_0x1717('0x59')]['ids'][_0x2fa104]),'SmsAccountId':Number(_0x1201d1[_0x1717('0x54')]['id'])});}return _0x5aaaf6;});}})['then'](respondWithResult(_0x466745,null))[_0x1717('0x27')](handleError(_0x466745,null));};exports['removeAgents']=function(_0x2ccaf2,_0xffe11d,_0x1bb886){return db['SmsAccount']['find']({'where':{'id':_0x2ccaf2['params']['id']}})[_0x1717('0x34')](handleEntityNotFound(_0xffe11d,null))[_0x1717('0x34')](function(_0x8737ca){if(_0x8737ca){return _0x8737ca[_0x1717('0xde')](_0x2ccaf2[_0x1717('0x41')][_0x1717('0x69')])[_0x1717('0x34')](function(){if(_['isArray'](_0x2ccaf2[_0x1717('0x41')][_0x1717('0x69')])){for(var _0x4895bb=0x0;_0x4895bb<_0x2ccaf2[_0x1717('0x41')][_0x1717('0x69')][_0x1717('0x48')];_0x4895bb+=0x1){socket[_0x1717('0xdc')](_0x1717('0xdf'),{'UserId':Number(_0x2ccaf2[_0x1717('0x41')][_0x1717('0x69')][_0x4895bb]),'SmsAccountId':Number(_0x2ccaf2[_0x1717('0x54')]['id'])});}}else{socket[_0x1717('0xdc')](_0x1717('0xdf'),{'UserId':Number(_0x2ccaf2[_0x1717('0x41')][_0x1717('0x69')]),'SmsAccountId':Number(_0x2ccaf2[_0x1717('0x54')]['id'])});}});}})[_0x1717('0x34')](respondWithStatusCode(_0xffe11d,null))[_0x1717('0x27')](handleError(_0xffe11d,null));};exports[_0x1717('0xe0')]=function(_0x58a83a,_0x2e2985,_0x14b909){var _0x6b5d49={};var _0x13bc32={};var _0x53c8b1;var _0x436ddf;return db['SmsAccount'][_0x1717('0x66')]({'where':{'id':_0x58a83a[_0x1717('0x54')]['id']}})[_0x1717('0x34')](handleEntityNotFound(_0x2e2985,null))[_0x1717('0x34')](function(_0x26aab5){if(_0x26aab5){_0x53c8b1=_0x26aab5;_0x13bc32['model']=_[_0x1717('0x42')](db[_0x1717('0xbd')]['rawAttributes']);_0x13bc32['query']=_[_0x1717('0x42')](_0x58a83a[_0x1717('0x41')]);_0x13bc32[_0x1717('0x43')]=_[_0x1717('0x44')](_0x13bc32[_0x1717('0x45')],_0x13bc32[_0x1717('0x41')]);_0x6b5d49[_0x1717('0x46')]=_['intersection'](_0x13bc32[_0x1717('0x45')],qs['fields'](_0x58a83a['query']['fields']));_0x6b5d49[_0x1717('0x46')]=_0x6b5d49[_0x1717('0x46')][_0x1717('0x48')]?_0x6b5d49[_0x1717('0x46')]:_0x13bc32['model'];_0x6b5d49[_0x1717('0x4a')]=qs['sort'](_0x58a83a[_0x1717('0x41')][_0x1717('0x4b')]);_0x6b5d49[_0x1717('0x4c')]=qs['filters'](_[_0x1717('0x4d')](_0x58a83a['query'],_0x13bc32[_0x1717('0x43')]));if(_0x58a83a[_0x1717('0x41')]['filter']){_0x6b5d49['where']=_[_0x1717('0x4f')](_0x6b5d49[_0x1717('0x4c')],{'$or':_['map'](_0x6b5d49[_0x1717('0x46')],function(_0x9f6d94){var _0x3b7c30={};_0x3b7c30[_0x9f6d94]={'$like':'%'+_0x58a83a[_0x1717('0x41')]['filter']+'%'};return _0x3b7c30;})});}_0x6b5d49=_[_0x1717('0x4f')]({},_0x6b5d49,_0x58a83a[_0x1717('0x56')]);return _0x53c8b1[_0x1717('0xe0')](_0x6b5d49);}})['then'](function(_0x2deedc){if(_0x2deedc){_0x436ddf=_0x2deedc[_0x1717('0x48')];if(!_0x58a83a[_0x1717('0x41')][_0x1717('0x67')]('nolimit')){_0x6b5d49[_0x1717('0x2f')]=qs[_0x1717('0x2f')](_0x58a83a[_0x1717('0x41')][_0x1717('0x2f')]);_0x6b5d49[_0x1717('0x2c')]=qs['offset'](_0x58a83a[_0x1717('0x41')][_0x1717('0x2c')]);}return _0x53c8b1[_0x1717('0xe0')](_0x6b5d49);}})[_0x1717('0x34')](function(_0x34d6cf){if(_0x34d6cf){return _0x34d6cf?{'count':_0x436ddf,'rows':_0x34d6cf}:null;}})[_0x1717('0x34')](respondWithResult(_0x2e2985,null))['catch'](handleError(_0x2e2985,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e70a062..6595930 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 _0x0c09=['SmsAccount','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x356686,_0x205bb7){var _0x32bf54=function(_0x21f6d6){while(--_0x21f6d6){_0x356686['push'](_0x356686['shift']());}};_0x32bf54(++_0x205bb7);}(_0x0c09,0x68));var _0x90c0=function(_0x342497,_0x37cb26){_0x342497=_0x342497-0x0;var _0x2aca97=_0x0c09[_0x342497];return _0x2aca97;};'use strict';var EventEmitter=require(_0x90c0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x90c0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90c0('0x2'),'afterUpdate':'update','afterDestroy':_0x90c0('0x3')};function emitEvent(_0x5c30dc){return function(_0x2f10c9,_0x2ced4b,_0x31b45a){SmsAccountEvents[_0x90c0('0x4')](_0x5c30dc+':'+_0x2f10c9['id'],_0x2f10c9);SmsAccountEvents['emit'](_0x5c30dc,_0x2f10c9);_0x31b45a(null);};}for(var e in events){if(events[_0x90c0('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x90c0('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xc019=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x41e5f5,_0xd56249){var _0x58560a=function(_0x2db89c){while(--_0x2db89c){_0x41e5f5['push'](_0x41e5f5['shift']());}};_0x58560a(++_0xd56249);}(_0xc019,0x1b6));var _0x9c01=function(_0x2d5392,_0xc4f707){_0x2d5392=_0x2d5392-0x0;var _0x4bd3fb=_0xc019[_0x2d5392];return _0x4bd3fb;};'use strict';var EventEmitter=require(_0x9c01('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9c01('0x1')](0x0);var events={'afterCreate':_0x9c01('0x2'),'afterUpdate':_0x9c01('0x3'),'afterDestroy':_0x9c01('0x4')};function emitEvent(_0x53cf8d){return function(_0x262f03,_0x16720c,_0x46708f){SmsAccountEvents[_0x9c01('0x5')](_0x53cf8d+':'+_0x262f03['id'],_0x262f03);SmsAccountEvents[_0x9c01('0x5')](_0x53cf8d,_0x262f03);_0x46708f(null);};}for(var e in events){if(events[_0x9c01('0x6')](e)){var event=events[e];SmsAccount[_0x9c01('0x7')](e,emitEvent(event));}}module[_0x9c01('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 62f3b70..6ed122c 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 _0x1a4a=['SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports'];(function(_0x580dfa,_0x426033){var _0x147b84=function(_0x107d94){while(--_0x107d94){_0x580dfa['push'](_0x580dfa['shift']());}};_0x147b84(++_0x426033);}(_0x1a4a,0xce));var _0xa1a4=function(_0x557841,_0x384c15){_0x557841=_0x557841-0x0;var _0x33f4f1=_0x1a4a[_0x557841];return _0x33f4f1;};'use strict';var _=require(_0xa1a4('0x0'));var util=require(_0xa1a4('0x1'));var logger=require('../../config/logger')(_0xa1a4('0x2'));var moment=require(_0xa1a4('0x3'));var BPromise=require(_0xa1a4('0x4'));var rp=require(_0xa1a4('0x5'));var fs=require('fs');var path=require(_0xa1a4('0x6'));var rimraf=require(_0xa1a4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1a4('0x8'));module[_0xa1a4('0x9')]=function(_0x5cc2e1,_0x1a8245){return _0x5cc2e1['define'](_0xa1a4('0xa'),attributes,{'tableName':_0xa1a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5600=['SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x398e75,_0x515ea9){var _0x277712=function(_0x4e3ab1){while(--_0x4e3ab1){_0x398e75['push'](_0x398e75['shift']());}};_0x277712(++_0x515ea9);}(_0x5600,0xe6));var _0x0560=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x5600[_0x4bacb6];return _0x58c029;};'use strict';var _=require(_0x0560('0x0'));var util=require(_0x0560('0x1'));var logger=require(_0x0560('0x2'))('api');var moment=require(_0x0560('0x3'));var BPromise=require(_0x0560('0x4'));var rp=require(_0x0560('0x5'));var fs=require('fs');var path=require(_0x0560('0x6'));var rimraf=require(_0x0560('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x0560('0x8')]=function(_0x2d40b8,_0x2f80e3){return _0x2d40b8[_0x0560('0x9')](_0x0560('0xa'),attributes,{'tableName':_0x0560('0xb'),'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 62071c1..f4764c7 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 _0x1dbf=['stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSmsAccount','options','where','attributes','map','include','model','then','debug'];(function(_0x9010e3,_0x28b9b7){var _0x13865e=function(_0x75f8fb){while(--_0x75f8fb){_0x9010e3['push'](_0x9010e3['shift']());}};_0x13865e(++_0x28b9b7);}(_0x1dbf,0x18d));var _0xf1db=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x1dbf[_0x2af053];return _0x4b4001;};'use strict';var _=require('lodash');var util=require(_0xf1db('0x0'));var moment=require(_0xf1db('0x1'));var BPromise=require(_0xf1db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1db('0x3'));var db=require(_0xf1db('0x4'))['db'];var utils=require(_0xf1db('0x5'));var logger=require(_0xf1db('0x6'))(_0xf1db('0x7'));var config=require(_0xf1db('0x8'));var jayson=require(_0xf1db('0x9'));var client=jayson[_0xf1db('0xa')][_0xf1db('0xb')]({'port':0x232a});config['redis']=_[_0xf1db('0xc')](config[_0xf1db('0xd')],{'host':_0xf1db('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf1db('0xd')]));require('./smsAccount.socket')[_0xf1db('0xf')](socket);function respondWithRpcPromise(_0x4c7864,_0x3588ab,_0x1fb720){return new BPromise(function(_0x5991e8,_0x1e2582){return client[_0xf1db('0x10')](_0x4c7864,_0x1fb720)['then'](function(_0x177b1b){logger[_0xf1db('0x11')]('SmsAccount,\x20%s,\x20%s',_0x3588ab,'request\x20sent');logger['debug'](_0xf1db('0x12'),_0x3588ab,'request\x20sent',JSON['stringify'](_0x177b1b));if(_0x177b1b[_0xf1db('0x13')]){if(_0x177b1b[_0xf1db('0x13')][_0xf1db('0x14')]===0x1f4){logger[_0xf1db('0x13')](_0xf1db('0x15'),_0x3588ab,_0x177b1b[_0xf1db('0x13')][_0xf1db('0x16')]);return _0x1e2582(_0x177b1b[_0xf1db('0x13')][_0xf1db('0x16')]);}logger[_0xf1db('0x13')](_0xf1db('0x15'),_0x3588ab,_0x177b1b[_0xf1db('0x13')]['message']);return _0x5991e8(_0x177b1b[_0xf1db('0x13')]['message']);}else{logger[_0xf1db('0x11')](_0xf1db('0x15'),_0x3588ab,_0xf1db('0x17'));_0x5991e8(_0x177b1b[_0xf1db('0x18')][_0xf1db('0x16')]);}})[_0xf1db('0x19')](function(_0x2e14aa){logger[_0xf1db('0x13')](_0xf1db('0x15'),_0x3588ab,_0x2e14aa);_0x1e2582(_0x2e14aa);});});}exports[_0xf1db('0x1a')]=function(_0x3f821e){var _0x26bc7a=this;return new Promise(function(_0x559396,_0x1ed10e){return db['SmsAccount']['find']({'raw':_0x3f821e[_0xf1db('0x1b')]?_0x3f821e['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f821e[_0xf1db('0x1b')]?_0x3f821e[_0xf1db('0x1b')][_0xf1db('0x1c')]||null:null,'attributes':_0x3f821e[_0xf1db('0x1b')]?_0x3f821e['options'][_0xf1db('0x1d')]||null:null,'include':_0x3f821e['options']?_0x3f821e['options']['include']?_[_0xf1db('0x1e')](_0x3f821e['options'][_0xf1db('0x1f')],function(_0x2a758e){return{'model':db[_0x2a758e[_0xf1db('0x20')]],'as':_0x2a758e['as'],'attributes':_0x2a758e[_0xf1db('0x1d')],'include':_0x2a758e[_0xf1db('0x1f')]?_['map'](_0x2a758e[_0xf1db('0x1f')],function(_0x5d8452){return{'model':db[_0x5d8452[_0xf1db('0x20')]],'as':_0x5d8452['as'],'attributes':_0x5d8452['attributes'],'include':_0x5d8452[_0xf1db('0x1f')]?_[_0xf1db('0x1e')](_0x5d8452[_0xf1db('0x1f')],function(_0x29daf2){return{'model':db[_0x29daf2[_0xf1db('0x20')]],'as':_0x29daf2['as'],'attributes':_0x29daf2[_0xf1db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf1db('0x21')](function(_0x322ea8){logger[_0xf1db('0x11')](_0xf1db('0x1a'),_0x3f821e);logger[_0xf1db('0x22')](_0xf1db('0x1a'),_0x3f821e,JSON[_0xf1db('0x23')](_0x322ea8));_0x559396(_0x322ea8);})[_0xf1db('0x19')](function(_0x5f4702){logger[_0xf1db('0x13')]('ShowSmsAccount',_0x5f4702[_0xf1db('0x16')],_0x3f821e);_0x1ed10e(_0x26bc7a[_0xf1db('0x13')](0x1f4,_0x5f4702[_0xf1db('0x16')]));});});}; \ No newline at end of file +var _0x19d8=['redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','include','map','attributes','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x19d8,0x182));var _0x819d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x819d('0x0'));var moment=require(_0x819d('0x1'));var BPromise=require('bluebird');var rs=require(_0x819d('0x2'));var fs=require('fs');var Redis=require(_0x819d('0x3'));var db=require(_0x819d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x819d('0x5'))('rpc');var config=require(_0x819d('0x6'));var jayson=require(_0x819d('0x7'));var client=jayson[_0x819d('0x8')][_0x819d('0x9')]({'port':0x232a});config[_0x819d('0xa')]=_[_0x819d('0xb')](config['redis'],{'host':_0x819d('0xc'),'port':0x18eb});var socket=require(_0x819d('0xd'))(new Redis(config['redis']));require(_0x819d('0xe'))[_0x819d('0xf')](socket);function respondWithRpcPromise(_0x30f559,_0x64f07,_0x3c2c4c){return new BPromise(function(_0x11ad9e,_0x2f5224){return client['request'](_0x30f559,_0x3c2c4c)[_0x819d('0x10')](function(_0xd579b7){logger[_0x819d('0x11')]('SmsAccount,\x20%s,\x20%s',_0x64f07,_0x819d('0x12'));logger[_0x819d('0x13')](_0x819d('0x14'),_0x64f07,'request\x20sent',JSON[_0x819d('0x15')](_0xd579b7));if(_0xd579b7['error']){if(_0xd579b7[_0x819d('0x16')][_0x819d('0x17')]===0x1f4){logger[_0x819d('0x16')](_0x819d('0x18'),_0x64f07,_0xd579b7[_0x819d('0x16')][_0x819d('0x19')]);return _0x2f5224(_0xd579b7[_0x819d('0x16')][_0x819d('0x19')]);}logger['error'](_0x819d('0x18'),_0x64f07,_0xd579b7[_0x819d('0x16')]['message']);return _0x11ad9e(_0xd579b7[_0x819d('0x16')][_0x819d('0x19')]);}else{logger[_0x819d('0x11')](_0x819d('0x18'),_0x64f07,_0x819d('0x12'));_0x11ad9e(_0xd579b7['result']['message']);}})[_0x819d('0x1a')](function(_0x41bbc9){logger[_0x819d('0x16')]('SmsAccount,\x20%s,\x20%s',_0x64f07,_0x41bbc9);_0x2f5224(_0x41bbc9);});});}exports[_0x819d('0x1b')]=function(_0x175dbf){var _0x2faa07=this;return new Promise(function(_0x1dec0b,_0x7b7394){return db[_0x819d('0x1c')][_0x819d('0x1d')]({'raw':_0x175dbf[_0x819d('0x1e')]?_0x175dbf[_0x819d('0x1e')][_0x819d('0x1f')]===undefined?!![]:![]:!![],'where':_0x175dbf[_0x819d('0x1e')]?_0x175dbf['options']['where']||null:null,'attributes':_0x175dbf['options']?_0x175dbf['options']['attributes']||null:null,'include':_0x175dbf[_0x819d('0x1e')]?_0x175dbf[_0x819d('0x1e')][_0x819d('0x20')]?_[_0x819d('0x21')](_0x175dbf[_0x819d('0x1e')][_0x819d('0x20')],function(_0x1c19ec){return{'model':db[_0x1c19ec['model']],'as':_0x1c19ec['as'],'attributes':_0x1c19ec[_0x819d('0x22')],'include':_0x1c19ec[_0x819d('0x20')]?_[_0x819d('0x21')](_0x1c19ec[_0x819d('0x20')],function(_0x475816){return{'model':db[_0x475816[_0x819d('0x23')]],'as':_0x475816['as'],'attributes':_0x475816[_0x819d('0x22')],'include':_0x475816[_0x819d('0x20')]?_[_0x819d('0x21')](_0x475816[_0x819d('0x20')],function(_0x17bf6c){return{'model':db[_0x17bf6c[_0x819d('0x23')]],'as':_0x17bf6c['as'],'attributes':_0x17bf6c[_0x819d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x819d('0x10')](function(_0xa34d8){logger['info']('ShowSmsAccount',_0x175dbf);logger[_0x819d('0x13')](_0x819d('0x1b'),_0x175dbf,JSON[_0x819d('0x15')](_0xa34d8));_0x1dec0b(_0xa34d8);})[_0x819d('0x1a')](function(_0x10a4da){logger['error'](_0x819d('0x1b'),_0x10a4da[_0x819d('0x19')],_0x175dbf);_0x7b7394(_0x2faa07[_0x819d('0x16')](0x1f4,_0x10a4da['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ac4d0f2..e35c6db 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 4c5307a..f9dc8ac 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4da572,_0x326408){var _0x378393=function(_0x1357e4){while(--_0x1357e4){_0x4da572['push'](_0x4da572['shift']());}};_0x378393(++_0x326408);}(_0x34e8,0x12c));var _0x834e=function(_0x8432da,_0xb2ec37){_0x8432da=_0x8432da-0x0;var _0xbc6d05=_0x34e8[_0x8432da];return _0xbc6d05;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x38e9c1,_0x4f5575){var _0x247488=function(_0x2577f0){while(--_0x2577f0){_0x38e9c1['push'](_0x38e9c1['shift']());}};_0x247488(++_0x4f5575);}(_0xe14b,0x93));var _0xbe14=function(_0x29c007,_0x3d788b){_0x29c007=_0x29c007-0x0;var _0x54b5ac=_0xe14b[_0x29c007];return _0x54b5ac;};'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['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 2c4cfeb..96b5fbd 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 _0xe4ab=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x4dd149,_0x27746b){var _0x3402b1=function(_0x5e21bd){while(--_0x5e21bd){_0x4dd149['push'](_0x4dd149['shift']());}};_0x3402b1(++_0x27746b);}(_0xe4ab,0x91));var _0xbe4a=function(_0x40c4c5,_0x2f6fc0){_0x40c4c5=_0x40c4c5-0x0;var _0x3b3470=_0xe4ab[_0x40c4c5];return _0x3b3470;};'use strict';var Sequelize=require(_0xbe4a('0x0'));module[_0xbe4a('0x1')]={'priority':{'type':Sequelize[_0xbe4a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbe4a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbe4a('0x4')]()},'description':{'type':Sequelize[_0xbe4a('0x3')]},'interval':{'type':Sequelize[_0xbe4a('0x3')],'defaultValue':_0xbe4a('0x5')}}; \ No newline at end of file +var _0x32cd=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x3c281b,_0x16dabf){var _0x4a7287=function(_0x3c89b9){while(--_0x3c89b9){_0x3c281b['push'](_0x3c281b['shift']());}};_0x4a7287(++_0x16dabf);}(_0x32cd,0x1be));var _0xd32c=function(_0x23d7a3,_0x2e7d2b){_0x23d7a3=_0x23d7a3-0x0;var _0x47a0a8=_0x32cd[_0x23d7a3];return _0x47a0a8;};'use strict';var Sequelize=require(_0xd32c('0x0'));module[_0xd32c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd32c('0x2')],'allowNull':![],'defaultValue':_0xd32c('0x3')},'appdata':{'type':Sequelize[_0xd32c('0x4')]()},'description':{'type':Sequelize[_0xd32c('0x2')]},'interval':{'type':Sequelize[_0xd32c('0x2')],'defaultValue':_0xd32c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 17aa6aa..2208b5c 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 _0x5896=['fast-json-patch','moment','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','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','sendStatus','error','stack','name','index','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','then','rows','catch','show','params','keys','include','find','create','body','rimraf'];(function(_0x6609e6,_0x51e7db){var _0xcad9a6=function(_0x28a784){while(--_0x28a784){_0x6609e6['push'](_0x6609e6['shift']());}};_0xcad9a6(++_0x51e7db);}(_0x5896,0x91));var _0x6589=function(_0x33a5d7,_0x23475b){_0x33a5d7=_0x33a5d7-0x0;var _0x2169fc=_0x5896[_0x33a5d7];return _0x2169fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6589('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6589('0x1'));var rp=require('request-promise');var moment=require(_0x6589('0x2'));var BPromise=require(_0x6589('0x3'));var Mustache=require(_0x6589('0x4'));var util=require('util');var path=require(_0x6589('0x5'));var sox=require(_0x6589('0x6'));var csv=require(_0x6589('0x7'));var ejs=require(_0x6589('0x8'));var fs=require('fs');var fs_extra=require(_0x6589('0x9'));var _=require('lodash');var squel=require(_0x6589('0xa'));var crypto=require(_0x6589('0xb'));var jsforce=require(_0x6589('0xc'));var deskjs=require(_0x6589('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6589('0xe'));var Papa=require(_0x6589('0xf'));var Redis=require(_0x6589('0x10'));var authService=require(_0x6589('0x11'));var qs=require(_0x6589('0x12'));var as=require(_0x6589('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6589('0x14'))('api');var utils=require(_0x6589('0x15'));var config=require(_0x6589('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6589('0x17'))['db'];function respondWithStatusCode(_0x5089fe,_0x16dffe){_0x16dffe=_0x16dffe||0xcc;return function(_0x1a4735){if(_0x1a4735){return _0x5089fe['sendStatus'](_0x16dffe);}return _0x5089fe[_0x6589('0x18')](_0x16dffe)[_0x6589('0x19')]();};}function respondWithResult(_0x432af2,_0x24e812){_0x24e812=_0x24e812||0xc8;return function(_0x2a8694){if(_0x2a8694){return _0x432af2['status'](_0x24e812)['json'](_0x2a8694);}};}function respondWithFilteredResult(_0x42ac55,_0x1ba555){return function(_0x109e9d){if(_0x109e9d){var _0x28a763=typeof _0x1ba555['offset']===_0x6589('0x1a')&&typeof _0x1ba555[_0x6589('0x1b')]===_0x6589('0x1a');var _0x1f0e57=_0x109e9d[_0x6589('0x1c')];var _0x17c408=_0x28a763?0x0:_0x1ba555[_0x6589('0x1d')];var _0x1adb28=_0x28a763?_0x109e9d['count']:_0x1ba555[_0x6589('0x1d')]+_0x1ba555[_0x6589('0x1b')];var _0x528191;if(_0x1adb28>=_0x1f0e57){_0x1adb28=_0x1f0e57;_0x528191=0xc8;}else{_0x528191=0xce;}_0x42ac55[_0x6589('0x18')](_0x528191);return _0x42ac55[_0x6589('0x1e')](_0x6589('0x1f'),_0x17c408+'-'+_0x1adb28+'/'+_0x1f0e57)[_0x6589('0x20')](_0x109e9d);}return null;};}function patchUpdates(_0x950b3b){return function(_0x45e80b){try{jsonpatch['apply'](_0x45e80b,_0x950b3b,!![]);}catch(_0x329633){return BPromise[_0x6589('0x21')](_0x329633);}return _0x45e80b['save']();};}function saveUpdates(_0x391454,_0x3ad5d6){return function(_0x116fa3){if(_0x116fa3){return _0x116fa3[_0x6589('0x22')](_0x391454)['then'](function(_0x26ad25){return _0x26ad25;});}return null;};}function removeEntity(_0x249106,_0x2fbbe4){return function(_0x29cf6e){if(_0x29cf6e){return _0x29cf6e[_0x6589('0x23')]()['then'](function(){_0x249106[_0x6589('0x18')](0xcc)[_0x6589('0x19')]();});}};}function handleEntityNotFound(_0x524b23,_0x7262d1){return function(_0x482c2a){if(!_0x482c2a){_0x524b23[_0x6589('0x24')](0x194);}return _0x482c2a;};}function handleError(_0x42c380,_0x541d75){_0x541d75=_0x541d75||0x1f4;return function(_0x18b812){logger[_0x6589('0x25')](_0x18b812[_0x6589('0x26')]);if(_0x18b812[_0x6589('0x27')]){delete _0x18b812[_0x6589('0x27')];}_0x42c380['status'](_0x541d75)['send'](_0x18b812);};}exports[_0x6589('0x28')]=function(_0x5d2ad3,_0x21696c){var _0x2e4a41={},_0x3a5461={},_0x3b7617={'count':0x0,'rows':[]};var _0x2198e0=_[_0x6589('0x29')](db[_0x6589('0x2a')][_0x6589('0x2b')],function(_0xfaa95f){return{'name':_0xfaa95f['fieldName'],'type':_0xfaa95f[_0x6589('0x2c')][_0x6589('0x2d')]};});_0x3a5461[_0x6589('0x2e')]=_['map'](_0x2198e0,_0x6589('0x27'));_0x3a5461[_0x6589('0x2f')]=_['keys'](_0x5d2ad3[_0x6589('0x2f')]);_0x3a5461[_0x6589('0x30')]=_[_0x6589('0x31')](_0x3a5461[_0x6589('0x2e')],_0x3a5461[_0x6589('0x2f')]);_0x2e4a41['attributes']=_[_0x6589('0x31')](_0x3a5461['model'],qs[_0x6589('0x32')](_0x5d2ad3['query'][_0x6589('0x32')]));_0x2e4a41[_0x6589('0x33')]=_0x2e4a41[_0x6589('0x33')][_0x6589('0x34')]?_0x2e4a41[_0x6589('0x33')]:_0x3a5461[_0x6589('0x2e')];if(!_0x5d2ad3['query']['hasOwnProperty'](_0x6589('0x35'))){_0x2e4a41[_0x6589('0x1b')]=qs[_0x6589('0x1b')](_0x5d2ad3[_0x6589('0x2f')][_0x6589('0x1b')]);_0x2e4a41[_0x6589('0x1d')]=qs[_0x6589('0x1d')](_0x5d2ad3['query'][_0x6589('0x1d')]);}_0x2e4a41[_0x6589('0x36')]=qs[_0x6589('0x37')](_0x5d2ad3[_0x6589('0x2f')][_0x6589('0x37')]);_0x2e4a41['where']=qs['filters'](_[_0x6589('0x38')](_0x5d2ad3[_0x6589('0x2f')],_0x3a5461[_0x6589('0x30')]),_0x2198e0);if(_0x5d2ad3[_0x6589('0x2f')][_0x6589('0x39')]){_0x2e4a41[_0x6589('0x3a')]=_[_0x6589('0x3b')](_0x2e4a41[_0x6589('0x3a')],{'$or':_[_0x6589('0x29')](_0x2198e0,function(_0x20d4f9){if(_0x20d4f9[_0x6589('0x2c')]!==_0x6589('0x3c')){var _0xeea491={};_0xeea491[_0x20d4f9[_0x6589('0x27')]]={'$like':'%'+_0x5d2ad3[_0x6589('0x2f')][_0x6589('0x39')]+'%'};return _0xeea491;}})});}_0x2e4a41=_[_0x6589('0x3b')]({},_0x2e4a41,_0x5d2ad3[_0x6589('0x3d')]);var _0x2ead99={'where':_0x2e4a41[_0x6589('0x3a')]};return db['SmsApplication'][_0x6589('0x1c')](_0x2ead99)['then'](function(_0x523e38){_0x3b7617['count']=_0x523e38;if(_0x5d2ad3[_0x6589('0x2f')][_0x6589('0x3e')]){_0x2e4a41['include']=[{'all':!![]}];}return db[_0x6589('0x2a')]['findAll'](_0x2e4a41);})[_0x6589('0x3f')](function(_0xdd5ffd){_0x3b7617[_0x6589('0x40')]=_0xdd5ffd;return _0x3b7617;})[_0x6589('0x3f')](respondWithFilteredResult(_0x21696c,_0x2e4a41))[_0x6589('0x41')](handleError(_0x21696c,null));};exports[_0x6589('0x42')]=function(_0x4d9f41,_0x538756){var _0x3a32d5={'raw':!![],'where':{'id':_0x4d9f41[_0x6589('0x43')]['id']}},_0x3def1d={};_0x3def1d[_0x6589('0x2e')]=_[_0x6589('0x44')](db[_0x6589('0x2a')]['rawAttributes']);_0x3def1d[_0x6589('0x2f')]=_[_0x6589('0x44')](_0x4d9f41[_0x6589('0x2f')]);_0x3def1d[_0x6589('0x30')]=_[_0x6589('0x31')](_0x3def1d[_0x6589('0x2e')],_0x3def1d['query']);_0x3a32d5[_0x6589('0x33')]=_[_0x6589('0x31')](_0x3def1d['model'],qs[_0x6589('0x32')](_0x4d9f41[_0x6589('0x2f')][_0x6589('0x32')]));_0x3a32d5[_0x6589('0x33')]=_0x3a32d5[_0x6589('0x33')]['length']?_0x3a32d5[_0x6589('0x33')]:_0x3def1d[_0x6589('0x2e')];if(_0x4d9f41[_0x6589('0x2f')][_0x6589('0x3e')]){_0x3a32d5[_0x6589('0x45')]=[{'all':!![]}];}_0x3a32d5=_[_0x6589('0x3b')]({},_0x3a32d5,_0x4d9f41[_0x6589('0x3d')]);return db['SmsApplication'][_0x6589('0x46')](_0x3a32d5)[_0x6589('0x3f')](handleEntityNotFound(_0x538756,null))[_0x6589('0x3f')](respondWithResult(_0x538756,null))[_0x6589('0x41')](handleError(_0x538756,null));};exports[_0x6589('0x47')]=function(_0x3b8df9,_0x54151d){return db[_0x6589('0x2a')][_0x6589('0x47')](_0x3b8df9[_0x6589('0x48')],{})[_0x6589('0x3f')](respondWithResult(_0x54151d,0xc9))[_0x6589('0x41')](handleError(_0x54151d,null));};exports[_0x6589('0x22')]=function(_0x49f9e4,_0x5f1d79){if(_0x49f9e4[_0x6589('0x48')]['id']){delete _0x49f9e4[_0x6589('0x48')]['id'];}return db[_0x6589('0x2a')][_0x6589('0x46')]({'where':{'id':_0x49f9e4[_0x6589('0x43')]['id']}})[_0x6589('0x3f')](handleEntityNotFound(_0x5f1d79,null))[_0x6589('0x3f')](saveUpdates(_0x49f9e4[_0x6589('0x48')],null))[_0x6589('0x3f')](respondWithResult(_0x5f1d79,null))[_0x6589('0x41')](handleError(_0x5f1d79,null));};exports['destroy']=function(_0x2f9dc7,_0x3b7d08){return db[_0x6589('0x2a')][_0x6589('0x46')]({'where':{'id':_0x2f9dc7[_0x6589('0x43')]['id']}})[_0x6589('0x3f')](handleEntityNotFound(_0x3b7d08,null))[_0x6589('0x3f')](removeEntity(_0x3b7d08,null))['catch'](handleError(_0x3b7d08,null));}; \ No newline at end of file +var _0x2ba4=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','error','stack','name','send','index','SmsApplication','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','filters','filter','where','merge','options','findAll','then','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x2ba4,0x90));var _0x42ba=function(_0x3403d4,_0x568aa6){_0x3403d4=_0x3403d4-0x0;var _0x4d764c=_0x2ba4[_0x3403d4];return _0x4d764c;};'use strict';var emlformat=require(_0x42ba('0x0'));var rimraf=require(_0x42ba('0x1'));var zipdir=require(_0x42ba('0x2'));var jsonpatch=require(_0x42ba('0x3'));var rp=require('request-promise');var moment=require(_0x42ba('0x4'));var BPromise=require(_0x42ba('0x5'));var Mustache=require(_0x42ba('0x6'));var util=require(_0x42ba('0x7'));var path=require(_0x42ba('0x8'));var sox=require(_0x42ba('0x9'));var csv=require(_0x42ba('0xa'));var ejs=require(_0x42ba('0xb'));var fs=require('fs');var fs_extra=require(_0x42ba('0xc'));var _=require(_0x42ba('0xd'));var squel=require(_0x42ba('0xe'));var crypto=require(_0x42ba('0xf'));var jsforce=require(_0x42ba('0x10'));var deskjs=require(_0x42ba('0x11'));var toCsv=require(_0x42ba('0xa'));var querystring=require(_0x42ba('0x12'));var Papa=require(_0x42ba('0x13'));var Redis=require(_0x42ba('0x14'));var authService=require(_0x42ba('0x15'));var qs=require(_0x42ba('0x16'));var as=require(_0x42ba('0x17'));var hardwareService=require(_0x42ba('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x42ba('0x19'));var config=require(_0x42ba('0x1a'));var licenseUtil=require(_0x42ba('0x1b'));var db=require(_0x42ba('0x1c'))['db'];function respondWithStatusCode(_0x23d074,_0x4e0854){_0x4e0854=_0x4e0854||0xcc;return function(_0x5c5d21){if(_0x5c5d21){return _0x23d074[_0x42ba('0x1d')](_0x4e0854);}return _0x23d074['status'](_0x4e0854)[_0x42ba('0x1e')]();};}function respondWithResult(_0x2f5da0,_0xd37309){_0xd37309=_0xd37309||0xc8;return function(_0x3a0669){if(_0x3a0669){return _0x2f5da0[_0x42ba('0x1f')](_0xd37309)[_0x42ba('0x20')](_0x3a0669);}};}function respondWithFilteredResult(_0x4f20ae,_0x347f77){return function(_0x6e5aeb){if(_0x6e5aeb){var _0x3c2b2f=typeof _0x347f77[_0x42ba('0x21')]===_0x42ba('0x22')&&typeof _0x347f77[_0x42ba('0x23')]===_0x42ba('0x22');var _0x2bacc9=_0x6e5aeb[_0x42ba('0x24')];var _0x363ae6=_0x3c2b2f?0x0:_0x347f77[_0x42ba('0x21')];var _0x72773a=_0x3c2b2f?_0x6e5aeb['count']:_0x347f77[_0x42ba('0x21')]+_0x347f77[_0x42ba('0x23')];var _0x4e8b1b;if(_0x72773a>=_0x2bacc9){_0x72773a=_0x2bacc9;_0x4e8b1b=0xc8;}else{_0x4e8b1b=0xce;}_0x4f20ae['status'](_0x4e8b1b);return _0x4f20ae[_0x42ba('0x25')]('Content-Range',_0x363ae6+'-'+_0x72773a+'/'+_0x2bacc9)[_0x42ba('0x20')](_0x6e5aeb);}return null;};}function patchUpdates(_0x6977b2){return function(_0x3ed875){try{jsonpatch[_0x42ba('0x26')](_0x3ed875,_0x6977b2,!![]);}catch(_0x1e875b){return BPromise[_0x42ba('0x27')](_0x1e875b);}return _0x3ed875[_0x42ba('0x28')]();};}function saveUpdates(_0x2658cb,_0x1797bb){return function(_0x1a6779){if(_0x1a6779){return _0x1a6779['update'](_0x2658cb)['then'](function(_0x4504d0){return _0x4504d0;});}return null;};}function removeEntity(_0x37ed1f,_0x4e0dda){return function(_0x176532){if(_0x176532){return _0x176532[_0x42ba('0x29')]()['then'](function(){_0x37ed1f[_0x42ba('0x1f')](0xcc)[_0x42ba('0x1e')]();});}};}function handleEntityNotFound(_0x2b0423,_0x20eb70){return function(_0x5545e1){if(!_0x5545e1){_0x2b0423[_0x42ba('0x1d')](0x194);}return _0x5545e1;};}function handleError(_0x292e10,_0xbc578c){_0xbc578c=_0xbc578c||0x1f4;return function(_0x4aadb2){logger[_0x42ba('0x2a')](_0x4aadb2[_0x42ba('0x2b')]);if(_0x4aadb2[_0x42ba('0x2c')]){delete _0x4aadb2[_0x42ba('0x2c')];}_0x292e10['status'](_0xbc578c)[_0x42ba('0x2d')](_0x4aadb2);};}exports[_0x42ba('0x2e')]=function(_0x2c1ab7,_0x4106b3){var _0x395ef4={},_0x531399={},_0x360f64={'count':0x0,'rows':[]};var _0x3db4c1=_['map'](db[_0x42ba('0x2f')]['rawAttributes'],function(_0x4ca3ae){return{'name':_0x4ca3ae[_0x42ba('0x30')],'type':_0x4ca3ae[_0x42ba('0x31')]['key']};});_0x531399[_0x42ba('0x32')]=_[_0x42ba('0x33')](_0x3db4c1,'name');_0x531399[_0x42ba('0x34')]=_[_0x42ba('0x35')](_0x2c1ab7[_0x42ba('0x34')]);_0x531399['filters']=_[_0x42ba('0x36')](_0x531399[_0x42ba('0x32')],_0x531399[_0x42ba('0x34')]);_0x395ef4[_0x42ba('0x37')]=_['intersection'](_0x531399[_0x42ba('0x32')],qs[_0x42ba('0x38')](_0x2c1ab7[_0x42ba('0x34')][_0x42ba('0x38')]));_0x395ef4[_0x42ba('0x37')]=_0x395ef4[_0x42ba('0x37')]['length']?_0x395ef4[_0x42ba('0x37')]:_0x531399[_0x42ba('0x32')];if(!_0x2c1ab7['query'][_0x42ba('0x39')](_0x42ba('0x3a'))){_0x395ef4['limit']=qs[_0x42ba('0x23')](_0x2c1ab7[_0x42ba('0x34')]['limit']);_0x395ef4[_0x42ba('0x21')]=qs[_0x42ba('0x21')](_0x2c1ab7['query'][_0x42ba('0x21')]);}_0x395ef4['order']=qs['sort'](_0x2c1ab7[_0x42ba('0x34')]['sort']);_0x395ef4['where']=qs[_0x42ba('0x3b')](_['pick'](_0x2c1ab7[_0x42ba('0x34')],_0x531399[_0x42ba('0x3b')]),_0x3db4c1);if(_0x2c1ab7[_0x42ba('0x34')][_0x42ba('0x3c')]){_0x395ef4[_0x42ba('0x3d')]=_[_0x42ba('0x3e')](_0x395ef4[_0x42ba('0x3d')],{'$or':_[_0x42ba('0x33')](_0x3db4c1,function(_0x2a7bf7){if(_0x2a7bf7[_0x42ba('0x31')]!=='VIRTUAL'){var _0x2d94cc={};_0x2d94cc[_0x2a7bf7[_0x42ba('0x2c')]]={'$like':'%'+_0x2c1ab7[_0x42ba('0x34')][_0x42ba('0x3c')]+'%'};return _0x2d94cc;}})});}_0x395ef4=_[_0x42ba('0x3e')]({},_0x395ef4,_0x2c1ab7[_0x42ba('0x3f')]);var _0x2e4854={'where':_0x395ef4[_0x42ba('0x3d')]};return db[_0x42ba('0x2f')][_0x42ba('0x24')](_0x2e4854)['then'](function(_0x5649f1){_0x360f64[_0x42ba('0x24')]=_0x5649f1;if(_0x2c1ab7['query']['includeAll']){_0x395ef4['include']=[{'all':!![]}];}return db[_0x42ba('0x2f')][_0x42ba('0x40')](_0x395ef4);})[_0x42ba('0x41')](function(_0x6b82f4){_0x360f64['rows']=_0x6b82f4;return _0x360f64;})['then'](respondWithFilteredResult(_0x4106b3,_0x395ef4))[_0x42ba('0x42')](handleError(_0x4106b3,null));};exports[_0x42ba('0x43')]=function(_0x30721b,_0x5dee59){var _0x5d6b9a={'raw':!![],'where':{'id':_0x30721b[_0x42ba('0x44')]['id']}},_0x3030bd={};_0x3030bd[_0x42ba('0x32')]=_[_0x42ba('0x35')](db[_0x42ba('0x2f')][_0x42ba('0x45')]);_0x3030bd[_0x42ba('0x34')]=_[_0x42ba('0x35')](_0x30721b['query']);_0x3030bd[_0x42ba('0x3b')]=_[_0x42ba('0x36')](_0x3030bd['model'],_0x3030bd[_0x42ba('0x34')]);_0x5d6b9a['attributes']=_['intersection'](_0x3030bd[_0x42ba('0x32')],qs[_0x42ba('0x38')](_0x30721b[_0x42ba('0x34')][_0x42ba('0x38')]));_0x5d6b9a[_0x42ba('0x37')]=_0x5d6b9a[_0x42ba('0x37')]['length']?_0x5d6b9a[_0x42ba('0x37')]:_0x3030bd[_0x42ba('0x32')];if(_0x30721b[_0x42ba('0x34')][_0x42ba('0x46')]){_0x5d6b9a['include']=[{'all':!![]}];}_0x5d6b9a=_[_0x42ba('0x3e')]({},_0x5d6b9a,_0x30721b[_0x42ba('0x3f')]);return db[_0x42ba('0x2f')][_0x42ba('0x47')](_0x5d6b9a)['then'](handleEntityNotFound(_0x5dee59,null))[_0x42ba('0x41')](respondWithResult(_0x5dee59,null))[_0x42ba('0x42')](handleError(_0x5dee59,null));};exports[_0x42ba('0x48')]=function(_0x166267,_0x1b0073){return db['SmsApplication']['create'](_0x166267[_0x42ba('0x49')],{})['then'](respondWithResult(_0x1b0073,0xc9))[_0x42ba('0x42')](handleError(_0x1b0073,null));};exports[_0x42ba('0x4a')]=function(_0x3cbf2c,_0x3c920f){if(_0x3cbf2c[_0x42ba('0x49')]['id']){delete _0x3cbf2c[_0x42ba('0x49')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3cbf2c['params']['id']}})[_0x42ba('0x41')](handleEntityNotFound(_0x3c920f,null))[_0x42ba('0x41')](saveUpdates(_0x3cbf2c['body'],null))[_0x42ba('0x41')](respondWithResult(_0x3c920f,null))[_0x42ba('0x42')](handleError(_0x3c920f,null));};exports[_0x42ba('0x29')]=function(_0x40ee10,_0x33f6b1){return db[_0x42ba('0x2f')]['find']({'where':{'id':_0x40ee10[_0x42ba('0x44')]['id']}})[_0x42ba('0x41')](handleEntityNotFound(_0x33f6b1,null))[_0x42ba('0x41')](removeEntity(_0x33f6b1,null))['catch'](handleError(_0x33f6b1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ef0360d..39c6353 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 _0x31ee=['./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x17c216,_0x1eed2a){var _0x2b2b39=function(_0x26a65a){while(--_0x26a65a){_0x17c216['push'](_0x17c216['shift']());}};_0x2b2b39(++_0x1eed2a);}(_0x31ee,0xf4));var _0xe31e=function(_0x3bfe35,_0x244208){_0x3bfe35=_0x3bfe35-0x0;var _0x2121a7=_0x31ee[_0x3bfe35];return _0x2121a7;};'use strict';var _=require(_0xe31e('0x0'));var util=require(_0xe31e('0x1'));var logger=require(_0xe31e('0x2'))(_0xe31e('0x3'));var moment=require(_0xe31e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe31e('0x5'));var fs=require('fs');var path=require(_0xe31e('0x6'));var rimraf=require('rimraf');var config=require(_0xe31e('0x7'));var attributes=require(_0xe31e('0x8'));module[_0xe31e('0x9')]=function(_0x1483aa,_0x10de21){return _0x1483aa[_0xe31e('0xa')]('SmsApplication',attributes,{'tableName':_0xe31e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe31e('0xc'),'collate':_0xe31e('0xd')});}; \ No newline at end of file +var _0xa363=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4820b5,_0x37e7fa){var _0x280668=function(_0x2ce41c){while(--_0x2ce41c){_0x4820b5['push'](_0x4820b5['shift']());}};_0x280668(++_0x37e7fa);}(_0xa363,0x19b));var _0x3a36=function(_0x3269b8,_0x24cf8c){_0x3269b8=_0x3269b8-0x0;var _0x513aa2=_0xa363[_0x3269b8];return _0x513aa2;};'use strict';var _=require(_0x3a36('0x0'));var util=require(_0x3a36('0x1'));var logger=require(_0x3a36('0x2'))('api');var moment=require(_0x3a36('0x3'));var BPromise=require(_0x3a36('0x4'));var rp=require(_0x3a36('0x5'));var fs=require('fs');var path=require(_0x3a36('0x6'));var rimraf=require(_0x3a36('0x7'));var config=require(_0x3a36('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x228667,_0x4365dd){return _0x228667[_0x3a36('0x9')](_0x3a36('0xa'),attributes,{'tableName':_0x3a36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a36('0xc'),'collate':_0x3a36('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 26509c3..2345e46 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 _0xa282=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x1f80eb,_0x4fefa6){var _0xd2634f=function(_0x2cbcdf){while(--_0x2cbcdf){_0x1f80eb['push'](_0x1f80eb['shift']());}};_0xd2634f(++_0x4fefa6);}(_0xa282,0x1f3));var _0x2a28=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa282[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x2a28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a28('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a28('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a28('0x3'));var logger=require(_0x2a28('0x4'))(_0x2a28('0x5'));var config=require(_0x2a28('0x6'));var jayson=require(_0x2a28('0x7'));var client=jayson[_0x2a28('0x8')][_0x2a28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36635c,_0x3d379c,_0x84908){return new BPromise(function(_0x24c7f5,_0x91d789){return client[_0x2a28('0xa')](_0x36635c,_0x84908)['then'](function(_0x1e20b3){logger['info'](_0x2a28('0xb'),_0x3d379c,_0x2a28('0xc'));logger[_0x2a28('0xd')](_0x2a28('0xe'),_0x3d379c,_0x2a28('0xc'),JSON[_0x2a28('0xf')](_0x1e20b3));if(_0x1e20b3[_0x2a28('0x10')]){if(_0x1e20b3['error']['code']===0x1f4){logger[_0x2a28('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3d379c,_0x1e20b3[_0x2a28('0x10')][_0x2a28('0x11')]);return _0x91d789(_0x1e20b3[_0x2a28('0x10')][_0x2a28('0x11')]);}logger[_0x2a28('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3d379c,_0x1e20b3['error'][_0x2a28('0x11')]);return _0x24c7f5(_0x1e20b3[_0x2a28('0x10')]['message']);}else{logger[_0x2a28('0x12')](_0x2a28('0xb'),_0x3d379c,'request\x20sent');_0x24c7f5(_0x1e20b3['result'][_0x2a28('0x11')]);}})[_0x2a28('0x13')](function(_0x506493){logger[_0x2a28('0x10')](_0x2a28('0xb'),_0x3d379c,_0x506493);_0x91d789(_0x506493);});});} \ No newline at end of file +var _0x6a55=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x6a55,0xdb));var _0x56a5=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x6a55[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6c1e007..43bcd02 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 _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x2d3b0a,_0x21d953){var _0x363102=function(_0x5dddac){while(--_0x5dddac){_0x2d3b0a['push'](_0x2d3b0a['shift']());}};_0x363102(++_0x21d953);}(_0x087b,0x11a));var _0xb087=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x087b[_0x122ef9];return _0x42fba0;};'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/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file +var _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b71f3,_0x10c08d){var _0x5d7ac5=function(_0x233598){while(--_0x233598){_0x2b71f3['push'](_0x2b71f3['shift']());}};_0x5d7ac5(++_0x10c08d);}(_0xe605,0x92));var _0x5e60=function(_0x53690a,_0x40fe64){_0x53690a=_0x53690a-0x0;var _0x2b7a16=_0xe605[_0x53690a];return _0x2b7a16;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ecf18a6..8549bff 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 _0xdf4d=['ENUM','BOOLEAN','INTEGER','moment','exports','DATE','STRING','out'];(function(_0x49f72d,_0x315dc6){var _0x4e1123=function(_0x37464b){while(--_0x37464b){_0x49f72d['push'](_0x49f72d['shift']());}};_0x4e1123(++_0x315dc6);}(_0xdf4d,0xcb));var _0xddf4=function(_0x4e11f,_0x1522cc){_0x4e11f=_0x4e11f-0x0;var _0x4240c3=_0xdf4d[_0x4e11f];return _0x4240c3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xddf4('0x0'));module[_0xddf4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xddf4('0x2')]},'disposition':{'type':Sequelize[_0xddf4('0x3')]},'secondDisposition':{'type':Sequelize[_0xddf4('0x3')]},'thirdDisposition':{'type':Sequelize[_0xddf4('0x3')]},'note':{'type':Sequelize[_0xddf4('0x3')]},'phone':{'type':Sequelize[_0xddf4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xddf4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xddf4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xddf4('0x5')]('in',_0xddf4('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xddf4('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xddf4('0x7')]}}; \ No newline at end of file +var _0x3c1a=['out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c1a,0xda));var _0xa3c1=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x3c1a[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0xa3c1('0x0'));var moment=require(_0xa3c1('0x1'));module[_0xa3c1('0x2')]={'closed':{'type':Sequelize[_0xa3c1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa3c1('0x4')]},'disposition':{'type':Sequelize[_0xa3c1('0x5')]},'secondDisposition':{'type':Sequelize[_0xa3c1('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa3c1('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa3c1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa3c1('0x6')]('in',_0xa3c1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa3c1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa3c1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa3c1('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7316038..c0240ff 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 _0x62ca=['out','System','lastName','read','renderFile','server','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','model','keys','attributes','intersection','fields','length','includeAll','include','merge','find','update','body','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','filters','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','secret','SmsAccount','Owner','mkdirSync','Account','N.A.','createdAt','closed','closedAt','disposition','Messages','direction'];(function(_0x314d90,_0x44b44e){var _0x2269c9=function(_0x360f06){while(--_0x360f06){_0x314d90['push'](_0x314d90['shift']());}};_0x2269c9(++_0x44b44e);}(_0x62ca,0x18b));var _0xa62c=function(_0x32fba1,_0x485363){_0x32fba1=_0x32fba1-0x0;var _0x32b2b2=_0x62ca[_0x32fba1];return _0x32b2b2;};'use strict';var rimraf=require(_0xa62c('0x0'));var zipdir=require(_0xa62c('0x1'));var moment=require('moment');var BPromise=require(_0xa62c('0x2'));var util=require(_0xa62c('0x3'));var path=require(_0xa62c('0x4'));var ejs=require(_0xa62c('0x5'));var fs=require('fs');var _=require(_0xa62c('0x6'));var Redis=require(_0xa62c('0x7'));var interaction=require(_0xa62c('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xa62c('0x9'));var logger=require(_0xa62c('0xa'))('api');var config=require(_0xa62c('0xb'));var db=require(_0xa62c('0xc'))['db'];config[_0xa62c('0xd')]=_[_0xa62c('0xe')](config['redis'],{'host':_0xa62c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa62c('0xd')]));require(_0xa62c('0x10'))[_0xa62c('0x11')](socket);function respondWithStatusCode(_0x1d52ba,_0x3ada2c){_0x3ada2c=_0x3ada2c||0xcc;return function(_0x5d8359){if(_0x5d8359){return _0x1d52ba[_0xa62c('0x12')](_0x3ada2c);}return _0x1d52ba[_0xa62c('0x13')](_0x3ada2c)[_0xa62c('0x14')]();};}function respondWithResult(_0x176f02,_0x8a8f9e){_0x8a8f9e=_0x8a8f9e||0xc8;return function(_0x357046){if(_0x357046){return _0x176f02[_0xa62c('0x13')](_0x8a8f9e)[_0xa62c('0x15')](_0x357046);}};}function respondWithFilteredResult(_0x3b115f,_0x47580d){return function(_0x1a67da){if(_0x1a67da){var _0x3b1ab1=typeof _0x47580d[_0xa62c('0x16')]===_0xa62c('0x17')&&typeof _0x47580d[_0xa62c('0x18')]===_0xa62c('0x17');var _0x2e465e=_0x1a67da['count'];var _0x58fa74=_0x3b1ab1?0x0:_0x47580d[_0xa62c('0x16')];var _0x1aab9=_0x3b1ab1?_0x1a67da[_0xa62c('0x19')]:_0x47580d['offset']+_0x47580d[_0xa62c('0x18')];var _0x5a59b5;if(_0x1aab9>=_0x2e465e){_0x1aab9=_0x2e465e;_0x5a59b5=0xc8;}else{_0x5a59b5=0xce;}_0x3b115f[_0xa62c('0x13')](_0x5a59b5);return _0x3b115f[_0xa62c('0x1a')](_0xa62c('0x1b'),_0x58fa74+'-'+_0x1aab9+'/'+_0x2e465e)[_0xa62c('0x15')](_0x1a67da);}return null;};}function saveUpdates(_0x13489d){return function(_0x51050a){if(_0x51050a){return _0x51050a['update'](_0x13489d)[_0xa62c('0x1c')](function(_0x2689b3){return _0x2689b3;});}return null;};}function removeEntity(_0x34f3ef){return function(_0x56e5c4){if(_0x56e5c4){return _0x56e5c4[_0xa62c('0x1d')]()['then'](function(){_0x34f3ef['status'](0xcc)[_0xa62c('0x14')]();});}};}function handleEntityNotFound(_0x2e7c43){return function(_0x599442){if(!_0x599442){_0x2e7c43[_0xa62c('0x12')](0x194);}return _0x599442;};}function handleError(_0x250d2d,_0x579419){_0x579419=_0x579419||0x1f4;return function(_0x25d72e){logger[_0xa62c('0x1e')](_0x25d72e[_0xa62c('0x1f')]);if(_0x25d72e[_0xa62c('0x20')]){delete _0x25d72e[_0xa62c('0x20')];}_0x250d2d[_0xa62c('0x13')](_0x579419)[_0xa62c('0x21')](_0x25d72e);};}exports[_0xa62c('0x22')]=function(_0x4f8b25,_0x6f2910){var _0x4c4c6c={};var _0x1a59a7=_[_0xa62c('0x23')](db[_0xa62c('0x24')][_0xa62c('0x25')],function(_0x1ac058){return{'name':_0x1ac058[_0xa62c('0x26')],'type':_0x1ac058[_0xa62c('0x27')][_0xa62c('0x28')]};});_0x4c4c6c=qs[_0xa62c('0x29')](_0x1a59a7,_0x4f8b25);return interaction[_0xa62c('0x2a')](_0xa62c('0x2b'),_0x4f8b25[_0xa62c('0x2c')],_0x4f8b25['user'],_0x4c4c6c,_0x1a59a7)['then'](respondWithFilteredResult(_0x6f2910,_0x4c4c6c))[_0xa62c('0x2d')](handleError(_0x6f2910,null));};exports[_0xa62c('0x2e')]=function(_0x5ac4c2,_0x5db71b){var _0x2aa824={'raw':![],'where':{'id':_0x5ac4c2['params']['id']}},_0x1e7402={};_0x1e7402[_0xa62c('0x2f')]=_[_0xa62c('0x30')](db[_0xa62c('0x24')][_0xa62c('0x25')]);_0x1e7402[_0xa62c('0x2c')]=_[_0xa62c('0x30')](_0x5ac4c2[_0xa62c('0x2c')]);_0x1e7402['filters']=_['intersection'](_0x1e7402[_0xa62c('0x2f')],_0x1e7402['query']);_0x2aa824[_0xa62c('0x31')]=_[_0xa62c('0x32')](_0x1e7402[_0xa62c('0x2f')],qs['fields'](_0x5ac4c2[_0xa62c('0x2c')][_0xa62c('0x33')]));_0x2aa824[_0xa62c('0x31')]=_0x2aa824['attributes'][_0xa62c('0x34')]?_0x2aa824[_0xa62c('0x31')]:_0x1e7402[_0xa62c('0x2f')];if(_0x5ac4c2[_0xa62c('0x2c')][_0xa62c('0x35')]){_0x2aa824[_0xa62c('0x36')]=[{'all':!![]}];}_0x2aa824=_[_0xa62c('0x37')]({},_0x2aa824,_0x5ac4c2['options']);return db[_0xa62c('0x24')][_0xa62c('0x38')](_0x2aa824)[_0xa62c('0x1c')](handleEntityNotFound(_0x5db71b,null))[_0xa62c('0x1c')](respondWithResult(_0x5db71b,null))[_0xa62c('0x2d')](handleError(_0x5db71b,null));};exports['create']=function(_0x120b81,_0x45746e){return db[_0xa62c('0x24')]['create'](_0x120b81['body'],{})[_0xa62c('0x1c')](respondWithResult(_0x45746e,0xc9))[_0xa62c('0x2d')](handleError(_0x45746e,null));};exports[_0xa62c('0x39')]=function(_0x5bdde5,_0x786f65){if(_0x5bdde5[_0xa62c('0x3a')]['id']){delete _0x5bdde5[_0xa62c('0x3a')]['id'];}return db[_0xa62c('0x24')][_0xa62c('0x38')]({'where':{'id':_0x5bdde5[_0xa62c('0x3b')]['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0x786f65,null))['then'](saveUpdates(_0x5bdde5['body'],null))['then'](respondWithResult(_0x786f65,null))[_0xa62c('0x2d')](handleError(_0x786f65,null));};exports[_0xa62c('0x1d')]=function(_0x345dcc,_0x230c02){return db[_0xa62c('0x24')][_0xa62c('0x38')]({'where':{'id':_0x345dcc[_0xa62c('0x3b')]['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0x230c02,null))[_0xa62c('0x1c')](removeEntity(_0x230c02,null))[_0xa62c('0x2d')](handleError(_0x230c02,null));};exports['describe']=function(_0x41e7c6,_0x34adef){return db[_0xa62c('0x24')][_0xa62c('0x3c')]()[_0xa62c('0x1c')](respondWithResult(_0x34adef,null))[_0xa62c('0x2d')](handleError(_0x34adef,null));};exports[_0xa62c('0x3d')]=function(_0x4fe5dc,_0x4da6f2){return db['SmsMessage'][_0xa62c('0x38')]({'where':{'id':_0x4fe5dc[_0xa62c('0x3b')]['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0x4da6f2,null))[_0xa62c('0x1c')](function(_0x4ecaec){if(_0x4ecaec){return _0x4ecaec[_0xa62c('0x3d')](_0x4fe5dc[_0xa62c('0x3a')][_0xa62c('0x3e')],_[_0xa62c('0x3f')](_0x4fe5dc[_0xa62c('0x3a')],[_0xa62c('0x3e'),'id'])||{});}})[_0xa62c('0x1c')](respondWithResult(_0x4da6f2,null))[_0xa62c('0x2d')](handleError(_0x4da6f2,null));};exports[_0xa62c('0x40')]=function(_0x55b543,_0xc367b8){var _0x11a1c5={'raw':![],'where':{}};var _0x36e8f5={};var _0x2d1cd8={'count':0x0,'rows':[]};return db[_0xa62c('0x24')][_0xa62c('0x41')]({'where':{'id':_0x55b543[_0xa62c('0x3b')]['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0xc367b8,null))[_0xa62c('0x1c')](function(_0x38d691){if(_0x38d691){_0x36e8f5['model']=_['keys'](db[_0xa62c('0x42')][_0xa62c('0x25')]);_0x36e8f5['query']=_[_0xa62c('0x30')](_0x55b543[_0xa62c('0x2c')]);_0x36e8f5[_0xa62c('0x43')]=_[_0xa62c('0x32')](_0x36e8f5[_0xa62c('0x2f')],_0x36e8f5[_0xa62c('0x2c')]);_0x11a1c5[_0xa62c('0x31')]=_[_0xa62c('0x32')](_0x36e8f5[_0xa62c('0x2f')],qs[_0xa62c('0x33')](_0x55b543[_0xa62c('0x2c')]['fields']));_0x11a1c5['attributes']=_0x11a1c5['attributes'][_0xa62c('0x34')]?_0x11a1c5[_0xa62c('0x31')]:_0x36e8f5['model'];if(!_0x55b543[_0xa62c('0x2c')][_0xa62c('0x44')](_0xa62c('0x45'))){_0x11a1c5['limit']=qs['limit'](_0x55b543[_0xa62c('0x2c')][_0xa62c('0x18')]);_0x11a1c5['offset']=qs[_0xa62c('0x16')](_0x55b543['query'][_0xa62c('0x16')]);}_0x11a1c5[_0xa62c('0x46')]=qs['sort'](_0x55b543[_0xa62c('0x2c')][_0xa62c('0x47')]);_0x11a1c5[_0xa62c('0x48')]=qs['filters'](_[_0xa62c('0x49')](_0x55b543[_0xa62c('0x2c')],_0x36e8f5[_0xa62c('0x43')]));_0x11a1c5['where'][_0xa62c('0x4a')]=_0x38d691['id'];if(_0x55b543[_0xa62c('0x2c')][_0xa62c('0x4b')]){_0x11a1c5[_0xa62c('0x48')]=_['merge'](_0x11a1c5['where'],{'$or':_[_0xa62c('0x23')](_0x11a1c5['attributes'],function(_0x40f784){var _0x303003={};_0x303003[_0x40f784]={'$like':'%'+_0x55b543[_0xa62c('0x2c')]['filter']+'%'};return _0x303003;})});}if(_0x55b543['query'][_0xa62c('0x4c')]){var _0x10e338=_0x55b543['query'][_0xa62c('0x4c')]['split'](',');var _0x3ab0d5={};_0x3ab0d5[_0x10e338[0x0]]={'$gte':moment(_0x10e338[0x1])['format'](_0xa62c('0x4d'))};_0x11a1c5[_0xa62c('0x48')]=_[_0xa62c('0x37')](_0x11a1c5['where'],_0x3ab0d5);}_0x11a1c5=_[_0xa62c('0x37')]({},_0x11a1c5,_0x55b543[_0xa62c('0x4e')]);return db['SmsMessage'][_0xa62c('0x19')]({'where':_0x11a1c5[_0xa62c('0x48')]})[_0xa62c('0x1c')](function(_0x17b6ec){_0x2d1cd8['count']=_0x17b6ec;if(_0x55b543[_0xa62c('0x2c')][_0xa62c('0x35')]){_0x11a1c5[_0xa62c('0x36')]=[{'all':!![]}];}return db[_0xa62c('0x42')]['findAll'](_0x11a1c5);})[_0xa62c('0x1c')](function(_0xe47a75){_0x2d1cd8[_0xa62c('0x4f')]=_0xe47a75;return _0x2d1cd8;});}})[_0xa62c('0x1c')](respondWithFilteredResult(_0xc367b8,_0x11a1c5))[_0xa62c('0x2d')](handleError(_0xc367b8,null));};exports[_0xa62c('0x50')]=function(_0x37ab0c,_0x49e65a){return db[_0xa62c('0x24')][_0xa62c('0x38')]({'where':{'id':_0x37ab0c['params']['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0x49e65a,null))[_0xa62c('0x1c')](function(_0x280458){if(_0x280458){return _0x280458[_0xa62c('0x51')](_0x37ab0c['body'][_0xa62c('0x3e')],_[_0xa62c('0x3f')](_0x37ab0c[_0xa62c('0x3a')],[_0xa62c('0x3e'),'id'])||{})[_0xa62c('0x52')](function(){return db[_0xa62c('0x53')][_0xa62c('0x2a')]({'attributes':['id','name',_0xa62c('0x54')],'where':{'id':_0x37ab0c[_0xa62c('0x3a')][_0xa62c('0x3e')]}});})[_0xa62c('0x1c')](function(_0x558417){socket[_0xa62c('0x55')](_0xa62c('0x56'),{'id':Number(_0x37ab0c[_0xa62c('0x3b')]['id']),'tags':_0x558417||[]});return{'id':Number(_0x37ab0c['params']['id']),'tags':_0x558417||[]};});}})['then'](respondWithResult(_0x49e65a,null))[_0xa62c('0x2d')](handleError(_0x49e65a,null));};exports[_0xa62c('0x57')]=function(_0x3a4edb,_0x210420){return db[_0xa62c('0x24')][_0xa62c('0x38')]({'where':{'id':_0x3a4edb['params']['id']}})[_0xa62c('0x1c')](handleEntityNotFound(_0x210420,null))[_0xa62c('0x1c')](function(_0x2e1009){if(_0x2e1009){return _0x2e1009[_0xa62c('0x57')](_0x3a4edb[_0xa62c('0x2c')][_0xa62c('0x3e')]);}})[_0xa62c('0x1c')](respondWithStatusCode(_0x210420,null))['catch'](handleError(_0x210420,null));};exports[_0xa62c('0x58')]=function(_0x15cfe7,_0x566416){var _0x212f92=moment()[_0xa62c('0x59')]()[_0xa62c('0x5a')]();var _0x36e543=path[_0xa62c('0x5b')](config[_0xa62c('0x5c')],'server','files',_0xa62c('0x5d'));var _0x522de0=path[_0xa62c('0x5b')](_0x36e543,_0x212f92);var _0x225a54=util[_0xa62c('0x5e')](_0xa62c('0x5f'),_0x15cfe7[_0xa62c('0x3b')]['id'],_0x212f92);var _0x18b00c=path[_0xa62c('0x5b')](_0x36e543,_0x225a54);var _0x503625=[];_0x503625[_0xa62c('0x60')]({'model':db[_0xa62c('0x61')],'as':_0xa62c('0x61'),'attributes':['id',_0xa62c('0x62')],'raw':!![]});_0x503625[_0xa62c('0x60')]({'model':db['CmContact'],'as':_0xa62c('0x63'),'attributes':['id',_0xa62c('0x64'),'lastName'],'raw':!![]});var _0x4bb3e9=[{'model':db[_0xa62c('0x42')],'as':'Messages','attributes':['id',_0xa62c('0x3a'),'createdAt','direction',_0xa62c('0x65'),'read'],'include':_0x503625}];_0x4bb3e9[_0xa62c('0x60')]({'model':db[_0xa62c('0x66')],'as':'Account','attributes':['id','name']});_0x4bb3e9[_0xa62c('0x60')]({'model':db['User'],'as':_0xa62c('0x67'),'attributes':['id',_0xa62c('0x62')]});return db[_0xa62c('0x24')][_0xa62c('0x38')]({'where':{'id':_0x15cfe7[_0xa62c('0x3b')]['id']},'include':_0x4bb3e9})[_0xa62c('0x1c')](handleEntityNotFound(_0x566416,null))[_0xa62c('0x1c')](function(_0x40d000){if(_0x40d000){var _0x27b02c=_0x40d000['get']({'plain':!![]});fs[_0xa62c('0x68')](_0x522de0);var _0x433d47={'channel':'Sms','account':_0x27b02c[_0xa62c('0x69')]['name'],'agent':_0x27b02c['Owner']?_0x27b02c[_0xa62c('0x67')][_0xa62c('0x62')]:_0xa62c('0x6a'),'createdAt':moment(_0x27b02c[_0xa62c('0x6b')])[_0xa62c('0x5e')](_0xa62c('0x4d'))[_0xa62c('0x5a')](),'closedAt':_0x27b02c[_0xa62c('0x6c')]?moment(_0x27b02c[_0xa62c('0x6d')])['format'](_0xa62c('0x4d'))[_0xa62c('0x5a')]():'','disposition':_0x27b02c[_0xa62c('0x6e')],'messages':_(_0x27b02c[_0xa62c('0x6f')])['filter']({'secret':![]})[_0xa62c('0x23')](function(_0x5d2e9b){return{'date':moment(_0x5d2e9b[_0xa62c('0x6b')])[_0xa62c('0x5e')](_0xa62c('0x4d'))[_0xa62c('0x5a')](),'sender':_0x5d2e9b[_0xa62c('0x70')]===_0xa62c('0x71')?_0x5d2e9b[_0xa62c('0x61')]?_0x5d2e9b[_0xa62c('0x61')]['fullname']:_0xa62c('0x72'):_0x5d2e9b[_0xa62c('0x63')][_0xa62c('0x64')]+(_0x5d2e9b[_0xa62c('0x63')]['lastName']?'\x20'+_0x5d2e9b[_0xa62c('0x63')][_0xa62c('0x73')]:''),'body':_0x5d2e9b[_0xa62c('0x3a')],'direction':_0x5d2e9b[_0xa62c('0x70')]==='out'?'A':'C','secret':_0x5d2e9b[_0xa62c('0x65')],'read':_0x5d2e9b[_0xa62c('0x74')]};})['value']()};return ejs[_0xa62c('0x75')](path[_0xa62c('0x5b')](config['root'],_0xa62c('0x76'),_0xa62c('0x77'),_0xa62c('0x78')),{'interaction':_0x433d47})[_0xa62c('0x1c')](function(_0x30d5ac){var _0x47b489=path[_0xa62c('0x5b')](_0x522de0,'transcript-'+_0x27b02c['id']+'-'+_0x212f92+_0xa62c('0x79'));var _0x2cbfc3={'path':_0x47b489,'channel':_0xa62c('0x7a'),'interactionId':_0x27b02c['id']};return pdf[_0xa62c('0x7b')](_0x30d5ac,_0x2cbfc3);})[_0xa62c('0x1c')](function(){return new BPromise(function(_0x390a78,_0x4856cd){zipdir(_0x522de0,{'saveTo':_0x18b00c},function(_0x1b5dc9,_0x579868){if(_0x1b5dc9)return _0x4856cd(_0x1b5dc9);return _0x390a78(_0x579868);});})[_0xa62c('0x1c')](function(){return new BPromise(function(_0x283770,_0x1a2b7e){rimraf(_0x522de0,function(_0x5503e7){if(_0x5503e7)_0x1a2b7e(_0x5503e7);return _0x283770();});});})['then'](function(){return _0x566416['download'](_0x18b00c,_0x225a54,function(_0x56daf3){if(_0x56daf3){console[_0xa62c('0x7c')](_0xa62c('0x7d'),_0x56daf3);}else{fs[_0xa62c('0x7e')](_0x18b00c);}});});});}else{return _0x566416['sendStatus'](0xc8);}})[_0xa62c('0x2d')](handleError(_0x566416,null));}; \ No newline at end of file +var _0x8f3a=['SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','emit','removeTags','download','unix','join','server','tmp','format','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','createdAt','direction','secret','read','SmsAccount','push','Owner','Account','N.A.','toString','closedAt','disposition','out','firstName','value','renderFile','root','transcript-','Sms','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','error','stack','name','send','index','map','SmsInteraction','type','getOptions','findAll','query','user','catch','show','keys','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','params','describe','addMessage'];(function(_0x4cf067,_0x443e1e){var _0x548c96=function(_0x2fa683){while(--_0x2fa683){_0x4cf067['push'](_0x4cf067['shift']());}};_0x548c96(++_0x443e1e);}(_0x8f3a,0xa9));var _0xa8f3=function(_0x103692,_0x50f2dd){_0x103692=_0x103692-0x0;var _0x553218=_0x8f3a[_0x103692];return _0x553218;};'use strict';var rimraf=require(_0xa8f3('0x0'));var zipdir=require(_0xa8f3('0x1'));var moment=require(_0xa8f3('0x2'));var BPromise=require(_0xa8f3('0x3'));var util=require(_0xa8f3('0x4'));var path=require(_0xa8f3('0x5'));var ejs=require(_0xa8f3('0x6'));var fs=require('fs');var _=require(_0xa8f3('0x7'));var Redis=require(_0xa8f3('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xa8f3('0x9'));var pdf=require(_0xa8f3('0xa'));var logger=require(_0xa8f3('0xb'))('api');var config=require(_0xa8f3('0xc'));var db=require('../../mysqldb')['db'];config[_0xa8f3('0xd')]=_[_0xa8f3('0xe')](config[_0xa8f3('0xd')],{'host':_0xa8f3('0xf'),'port':0x18eb});var socket=require(_0xa8f3('0x10'))(new Redis(config['redis']));require(_0xa8f3('0x11'))[_0xa8f3('0x12')](socket);function respondWithStatusCode(_0x215804,_0x425f0c){_0x425f0c=_0x425f0c||0xcc;return function(_0x3e6c40){if(_0x3e6c40){return _0x215804[_0xa8f3('0x13')](_0x425f0c);}return _0x215804[_0xa8f3('0x14')](_0x425f0c)[_0xa8f3('0x15')]();};}function respondWithResult(_0xf04fb6,_0x24309d){_0x24309d=_0x24309d||0xc8;return function(_0x4b74ca){if(_0x4b74ca){return _0xf04fb6[_0xa8f3('0x14')](_0x24309d)[_0xa8f3('0x16')](_0x4b74ca);}};}function respondWithFilteredResult(_0x544f18,_0x33045f){return function(_0x36a872){if(_0x36a872){var _0x25e870=typeof _0x33045f[_0xa8f3('0x17')]===_0xa8f3('0x18')&&typeof _0x33045f[_0xa8f3('0x19')]===_0xa8f3('0x18');var _0x416eef=_0x36a872[_0xa8f3('0x1a')];var _0x572822=_0x25e870?0x0:_0x33045f[_0xa8f3('0x17')];var _0x2c1229=_0x25e870?_0x36a872['count']:_0x33045f[_0xa8f3('0x17')]+_0x33045f['limit'];var _0x42b168;if(_0x2c1229>=_0x416eef){_0x2c1229=_0x416eef;_0x42b168=0xc8;}else{_0x42b168=0xce;}_0x544f18[_0xa8f3('0x14')](_0x42b168);return _0x544f18['set']('Content-Range',_0x572822+'-'+_0x2c1229+'/'+_0x416eef)[_0xa8f3('0x16')](_0x36a872);}return null;};}function saveUpdates(_0x3c67de){return function(_0x19c287){if(_0x19c287){return _0x19c287[_0xa8f3('0x1b')](_0x3c67de)[_0xa8f3('0x1c')](function(_0x416ee7){return _0x416ee7;});}return null;};}function removeEntity(_0x3fe662){return function(_0x5a856e){if(_0x5a856e){return _0x5a856e['destroy']()[_0xa8f3('0x1c')](function(){_0x3fe662['status'](0xcc)[_0xa8f3('0x15')]();});}};}function handleEntityNotFound(_0x41794f){return function(_0x586523){if(!_0x586523){_0x41794f[_0xa8f3('0x13')](0x194);}return _0x586523;};}function handleError(_0x5e2da4,_0x2ea4cf){_0x2ea4cf=_0x2ea4cf||0x1f4;return function(_0x280a9c){logger[_0xa8f3('0x1d')](_0x280a9c[_0xa8f3('0x1e')]);if(_0x280a9c[_0xa8f3('0x1f')]){delete _0x280a9c[_0xa8f3('0x1f')];}_0x5e2da4[_0xa8f3('0x14')](_0x2ea4cf)[_0xa8f3('0x20')](_0x280a9c);};}exports[_0xa8f3('0x21')]=function(_0x4b9bd1,_0x583248){var _0x4c0162={};var _0x35c302=_[_0xa8f3('0x22')](db[_0xa8f3('0x23')]['rawAttributes'],function(_0x5b1e70){return{'name':_0x5b1e70['fieldName'],'type':_0x5b1e70[_0xa8f3('0x24')]['key']};});_0x4c0162=qs[_0xa8f3('0x25')](_0x35c302,_0x4b9bd1);return interaction[_0xa8f3('0x26')]('sms',_0x4b9bd1[_0xa8f3('0x27')],_0x4b9bd1[_0xa8f3('0x28')],_0x4c0162,_0x35c302)[_0xa8f3('0x1c')](respondWithFilteredResult(_0x583248,_0x4c0162))[_0xa8f3('0x29')](handleError(_0x583248,null));};exports[_0xa8f3('0x2a')]=function(_0x2c03ab,_0x2aeee9){var _0x2a2fa4={'raw':![],'where':{'id':_0x2c03ab['params']['id']}},_0x11df00={};_0x11df00['model']=_[_0xa8f3('0x2b')](db[_0xa8f3('0x23')][_0xa8f3('0x2c')]);_0x11df00[_0xa8f3('0x27')]=_[_0xa8f3('0x2b')](_0x2c03ab['query']);_0x11df00[_0xa8f3('0x2d')]=_[_0xa8f3('0x2e')](_0x11df00[_0xa8f3('0x2f')],_0x11df00['query']);_0x2a2fa4[_0xa8f3('0x30')]=_[_0xa8f3('0x2e')](_0x11df00['model'],qs[_0xa8f3('0x31')](_0x2c03ab[_0xa8f3('0x27')][_0xa8f3('0x31')]));_0x2a2fa4[_0xa8f3('0x30')]=_0x2a2fa4[_0xa8f3('0x30')][_0xa8f3('0x32')]?_0x2a2fa4[_0xa8f3('0x30')]:_0x11df00[_0xa8f3('0x2f')];if(_0x2c03ab[_0xa8f3('0x27')][_0xa8f3('0x33')]){_0x2a2fa4['include']=[{'all':!![]}];}_0x2a2fa4=_[_0xa8f3('0x34')]({},_0x2a2fa4,_0x2c03ab['options']);return db[_0xa8f3('0x23')][_0xa8f3('0x35')](_0x2a2fa4)[_0xa8f3('0x1c')](handleEntityNotFound(_0x2aeee9,null))['then'](respondWithResult(_0x2aeee9,null))[_0xa8f3('0x29')](handleError(_0x2aeee9,null));};exports[_0xa8f3('0x36')]=function(_0x16bf40,_0x540858){return db[_0xa8f3('0x23')][_0xa8f3('0x36')](_0x16bf40[_0xa8f3('0x37')],{})[_0xa8f3('0x1c')](respondWithResult(_0x540858,0xc9))['catch'](handleError(_0x540858,null));};exports[_0xa8f3('0x1b')]=function(_0x30ebeb,_0x2acf75){if(_0x30ebeb['body']['id']){delete _0x30ebeb[_0xa8f3('0x37')]['id'];}return db[_0xa8f3('0x23')]['find']({'where':{'id':_0x30ebeb['params']['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0x2acf75,null))['then'](saveUpdates(_0x30ebeb[_0xa8f3('0x37')],null))[_0xa8f3('0x1c')](respondWithResult(_0x2acf75,null))[_0xa8f3('0x29')](handleError(_0x2acf75,null));};exports['destroy']=function(_0x97225c,_0x271fd7){return db[_0xa8f3('0x23')][_0xa8f3('0x35')]({'where':{'id':_0x97225c[_0xa8f3('0x38')]['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0x271fd7,null))['then'](removeEntity(_0x271fd7,null))['catch'](handleError(_0x271fd7,null));};exports[_0xa8f3('0x39')]=function(_0xcb4360,_0x40b8b2){return db[_0xa8f3('0x23')]['describe']()[_0xa8f3('0x1c')](respondWithResult(_0x40b8b2,null))[_0xa8f3('0x29')](handleError(_0x40b8b2,null));};exports[_0xa8f3('0x3a')]=function(_0x16ad52,_0x161d69){return db[_0xa8f3('0x3b')][_0xa8f3('0x35')]({'where':{'id':_0x16ad52[_0xa8f3('0x38')]['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0x161d69,null))[_0xa8f3('0x1c')](function(_0x3c48ff){if(_0x3c48ff){return _0x3c48ff[_0xa8f3('0x3a')](_0x16ad52[_0xa8f3('0x37')]['ids'],_[_0xa8f3('0x3c')](_0x16ad52['body'],[_0xa8f3('0x3d'),'id'])||{});}})[_0xa8f3('0x1c')](respondWithResult(_0x161d69,null))[_0xa8f3('0x29')](handleError(_0x161d69,null));};exports[_0xa8f3('0x3e')]=function(_0x25c7fa,_0x253363){var _0x443e17={'raw':![],'where':{}};var _0x569b51={};var _0x30b957={'count':0x0,'rows':[]};return db[_0xa8f3('0x23')][_0xa8f3('0x3f')]({'where':{'id':_0x25c7fa[_0xa8f3('0x38')]['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0x253363,null))[_0xa8f3('0x1c')](function(_0x508cf1){if(_0x508cf1){_0x569b51[_0xa8f3('0x2f')]=_[_0xa8f3('0x2b')](db[_0xa8f3('0x3b')]['rawAttributes']);_0x569b51[_0xa8f3('0x27')]=_[_0xa8f3('0x2b')](_0x25c7fa[_0xa8f3('0x27')]);_0x569b51[_0xa8f3('0x2d')]=_[_0xa8f3('0x2e')](_0x569b51[_0xa8f3('0x2f')],_0x569b51[_0xa8f3('0x27')]);_0x443e17[_0xa8f3('0x30')]=_['intersection'](_0x569b51[_0xa8f3('0x2f')],qs[_0xa8f3('0x31')](_0x25c7fa[_0xa8f3('0x27')]['fields']));_0x443e17[_0xa8f3('0x30')]=_0x443e17[_0xa8f3('0x30')][_0xa8f3('0x32')]?_0x443e17[_0xa8f3('0x30')]:_0x569b51[_0xa8f3('0x2f')];if(!_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x40')](_0xa8f3('0x41'))){_0x443e17[_0xa8f3('0x19')]=qs['limit'](_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x19')]);_0x443e17['offset']=qs[_0xa8f3('0x17')](_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x17')]);}_0x443e17[_0xa8f3('0x42')]=qs[_0xa8f3('0x43')](_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x43')]);_0x443e17[_0xa8f3('0x44')]=qs[_0xa8f3('0x2d')](_[_0xa8f3('0x45')](_0x25c7fa['query'],_0x569b51[_0xa8f3('0x2d')]));_0x443e17[_0xa8f3('0x44')][_0xa8f3('0x46')]=_0x508cf1['id'];if(_0x25c7fa['query'][_0xa8f3('0x47')]){_0x443e17['where']=_[_0xa8f3('0x34')](_0x443e17['where'],{'$or':_[_0xa8f3('0x22')](_0x443e17['attributes'],function(_0x11b93f){var _0x234fd7={};_0x234fd7[_0x11b93f]={'$like':'%'+_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x47')]+'%'};return _0x234fd7;})});}if(_0x25c7fa['query'][_0xa8f3('0x48')]){var _0x42dce7=_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x48')]['split'](',');var _0x22e7a4={};_0x22e7a4[_0x42dce7[0x0]]={'$gte':moment(_0x42dce7[0x1])['format'](_0xa8f3('0x49'))};_0x443e17['where']=_['merge'](_0x443e17['where'],_0x22e7a4);}_0x443e17=_[_0xa8f3('0x34')]({},_0x443e17,_0x25c7fa[_0xa8f3('0x4a')]);return db[_0xa8f3('0x3b')]['count']({'where':_0x443e17[_0xa8f3('0x44')]})[_0xa8f3('0x1c')](function(_0x110823){_0x30b957['count']=_0x110823;if(_0x25c7fa[_0xa8f3('0x27')][_0xa8f3('0x33')]){_0x443e17['include']=[{'all':!![]}];}return db[_0xa8f3('0x3b')][_0xa8f3('0x26')](_0x443e17);})[_0xa8f3('0x1c')](function(_0x10e03b){_0x30b957[_0xa8f3('0x4b')]=_0x10e03b;return _0x30b957;});}})[_0xa8f3('0x1c')](respondWithFilteredResult(_0x253363,_0x443e17))[_0xa8f3('0x29')](handleError(_0x253363,null));};exports[_0xa8f3('0x4c')]=function(_0x3f0d1a,_0xe20550){return db['SmsInteraction'][_0xa8f3('0x35')]({'where':{'id':_0x3f0d1a[_0xa8f3('0x38')]['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0xe20550,null))['then'](function(_0x43e7c2){if(_0x43e7c2){return _0x43e7c2[_0xa8f3('0x4d')](_0x3f0d1a[_0xa8f3('0x37')][_0xa8f3('0x3d')],_[_0xa8f3('0x3c')](_0x3f0d1a[_0xa8f3('0x37')],[_0xa8f3('0x3d'),'id'])||{})['spread'](function(){return db['Tag'][_0xa8f3('0x26')]({'attributes':['id',_0xa8f3('0x1f'),'color'],'where':{'id':_0x3f0d1a['body'][_0xa8f3('0x3d')]}});})[_0xa8f3('0x1c')](function(_0x16f232){socket[_0xa8f3('0x4e')]('smsInteractionTags:save',{'id':Number(_0x3f0d1a[_0xa8f3('0x38')]['id']),'tags':_0x16f232||[]});return{'id':Number(_0x3f0d1a[_0xa8f3('0x38')]['id']),'tags':_0x16f232||[]};});}})[_0xa8f3('0x1c')](respondWithResult(_0xe20550,null))[_0xa8f3('0x29')](handleError(_0xe20550,null));};exports[_0xa8f3('0x4f')]=function(_0x161511,_0x168575){return db[_0xa8f3('0x23')]['find']({'where':{'id':_0x161511['params']['id']}})[_0xa8f3('0x1c')](handleEntityNotFound(_0x168575,null))['then'](function(_0x1125ce){if(_0x1125ce){return _0x1125ce['removeTags'](_0x161511['query'][_0xa8f3('0x3d')]);}})[_0xa8f3('0x1c')](respondWithStatusCode(_0x168575,null))[_0xa8f3('0x29')](handleError(_0x168575,null));};exports[_0xa8f3('0x50')]=function(_0x4fb8d2,_0x1ea3d5){var _0x438802=moment()[_0xa8f3('0x51')]()['toString']();var _0x278bf5=path[_0xa8f3('0x52')](config['root'],_0xa8f3('0x53'),'files',_0xa8f3('0x54'));var _0x1df98f=path[_0xa8f3('0x52')](_0x278bf5,_0x438802);var _0x39814e=util[_0xa8f3('0x55')](_0xa8f3('0x56'),_0x4fb8d2[_0xa8f3('0x38')]['id'],_0x438802);var _0x538ca8=path[_0xa8f3('0x52')](_0x278bf5,_0x39814e);var _0x4d5f9d=[];_0x4d5f9d['push']({'model':db[_0xa8f3('0x57')],'as':_0xa8f3('0x57'),'attributes':['id',_0xa8f3('0x58')],'raw':!![]});_0x4d5f9d['push']({'model':db[_0xa8f3('0x59')],'as':_0xa8f3('0x5a'),'attributes':['id','firstName',_0xa8f3('0x5b')],'raw':!![]});var _0x49c630=[{'model':db[_0xa8f3('0x3b')],'as':'Messages','attributes':['id',_0xa8f3('0x37'),_0xa8f3('0x5c'),_0xa8f3('0x5d'),_0xa8f3('0x5e'),_0xa8f3('0x5f')],'include':_0x4d5f9d}];_0x49c630['push']({'model':db[_0xa8f3('0x60')],'as':'Account','attributes':['id',_0xa8f3('0x1f')]});_0x49c630[_0xa8f3('0x61')]({'model':db[_0xa8f3('0x57')],'as':_0xa8f3('0x62'),'attributes':['id','fullname']});return db[_0xa8f3('0x23')][_0xa8f3('0x35')]({'where':{'id':_0x4fb8d2[_0xa8f3('0x38')]['id']},'include':_0x49c630})[_0xa8f3('0x1c')](handleEntityNotFound(_0x1ea3d5,null))[_0xa8f3('0x1c')](function(_0x5086ae){if(_0x5086ae){var _0x25e3e2=_0x5086ae['get']({'plain':!![]});fs['mkdirSync'](_0x1df98f);var _0x24eeec={'channel':'Sms','account':_0x25e3e2[_0xa8f3('0x63')][_0xa8f3('0x1f')],'agent':_0x25e3e2[_0xa8f3('0x62')]?_0x25e3e2[_0xa8f3('0x62')]['fullname']:_0xa8f3('0x64'),'createdAt':moment(_0x25e3e2[_0xa8f3('0x5c')])[_0xa8f3('0x55')](_0xa8f3('0x49'))[_0xa8f3('0x65')](),'closedAt':_0x25e3e2['closed']?moment(_0x25e3e2[_0xa8f3('0x66')])[_0xa8f3('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa8f3('0x65')]():'','disposition':_0x25e3e2[_0xa8f3('0x67')],'messages':_(_0x25e3e2['Messages'])[_0xa8f3('0x47')]({'secret':![]})[_0xa8f3('0x22')](function(_0x2e42a1){return{'date':moment(_0x2e42a1[_0xa8f3('0x5c')])[_0xa8f3('0x55')](_0xa8f3('0x49'))[_0xa8f3('0x65')](),'sender':_0x2e42a1[_0xa8f3('0x5d')]===_0xa8f3('0x68')?_0x2e42a1[_0xa8f3('0x57')]?_0x2e42a1['User'][_0xa8f3('0x58')]:'System':_0x2e42a1[_0xa8f3('0x5a')][_0xa8f3('0x69')]+(_0x2e42a1[_0xa8f3('0x5a')][_0xa8f3('0x5b')]?'\x20'+_0x2e42a1['Contact']['lastName']:''),'body':_0x2e42a1[_0xa8f3('0x37')],'direction':_0x2e42a1[_0xa8f3('0x5d')]===_0xa8f3('0x68')?'A':'C','secret':_0x2e42a1[_0xa8f3('0x5e')],'read':_0x2e42a1[_0xa8f3('0x5f')]};})[_0xa8f3('0x6a')]()};return ejs[_0xa8f3('0x6b')](path[_0xa8f3('0x52')](config[_0xa8f3('0x6c')],_0xa8f3('0x53'),'views','downloadInteraction.ejs'),{'interaction':_0x24eeec})[_0xa8f3('0x1c')](function(_0x3af63d){var _0x14f030=path[_0xa8f3('0x52')](_0x1df98f,_0xa8f3('0x6d')+_0x25e3e2['id']+'-'+_0x438802+'.pdf');var _0x2a4f77={'path':_0x14f030,'channel':_0xa8f3('0x6e'),'interactionId':_0x25e3e2['id']};return pdf[_0xa8f3('0x6f')](_0x3af63d,_0x2a4f77);})[_0xa8f3('0x1c')](function(){return new BPromise(function(_0x2840e0,_0x2fb465){zipdir(_0x1df98f,{'saveTo':_0x538ca8},function(_0x376c3a,_0x3c6af0){if(_0x376c3a)return _0x2fb465(_0x376c3a);return _0x2840e0(_0x3c6af0);});})[_0xa8f3('0x1c')](function(){return new BPromise(function(_0x34ac07,_0x233268){rimraf(_0x1df98f,function(_0x4bbeaf){if(_0x4bbeaf)_0x233268(_0x4bbeaf);return _0x34ac07();});});})['then'](function(){return _0x1ea3d5[_0xa8f3('0x50')](_0x538ca8,_0x39814e,function(_0xfac4ad){if(_0xfac4ad){console['log'](_0xa8f3('0x70'),_0xfac4ad);}else{fs[_0xa8f3('0x71')](_0x538ca8);}});});});}else{return _0x1ea3d5['sendStatus'](0xc8);}})[_0xa8f3('0x29')](handleError(_0x1ea3d5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f5ec945..3ddb95d 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 _0x36ee=['getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove'];(function(_0xb093b4,_0x2544c0){var _0x3a3c3b=function(_0x54580d){while(--_0x54580d){_0xb093b4['push'](_0xb093b4['shift']());}};_0x3a3c3b(++_0x2544c0);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0xe36e('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0xe36e('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe36e('0x2')](0x0);var events={'afterCreate':_0xe36e('0x3'),'afterUpdate':_0xe36e('0x4'),'afterDestroy':_0xe36e('0x5')};function emitEvent(_0x1118af){return function(_0x29e692,_0x3f29e1,_0x25a07d){_0x29e692[_0xe36e('0x6')]({'attributes':['id'],'raw':!![]})[_0xe36e('0x7')](function(_0x1aa596){_0x29e692['setDataValue'](_0xe36e('0x8'),_0x1aa596['map'](function(_0x2236e9){return{'id':_0x2236e9['id']};}));return SmsMessage[_0xe36e('0x9')]({'where':{'SmsInteractionId':_0x29e692['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe36e('0x7')](function(_0x47ce3a){_0x29e692[_0xe36e('0xa')]('unreadMessages',_0x47ce3a[_0xe36e('0xb')]);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af+':'+_0x29e692['id'],_0x29e692);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af,_0x29e692);_0x25a07d(null);})[_0xe36e('0xd')](_0x25a07d(null));};}for(var e in events){if(events[_0xe36e('0xe')](e)){var event=events[e];SmsInteraction[_0xe36e('0xf')](e,emitEvent(event));}}module[_0xe36e('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x32f562,_0x4d4dd8){var _0x29ba85=function(_0x44f318){while(--_0x44f318){_0x32f562['push'](_0x32f562['shift']());}};_0x29ba85(++_0x4d4dd8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x29156a,_0x4f04c4){_0x29156a=_0x29156a-0x0;var _0x53ad8c=_0xdd4f[_0x29156a];return _0x53ad8c;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 907531b..42cf8d4 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 _0x2c04=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x2c04,0x129));var _0x42c0=function(_0x4ed49a,_0x51e6c2){_0x4ed49a=_0x4ed49a-0x0;var _0x4eded3=_0x2c04[_0x4ed49a];return _0x4eded3;};'use strict';var _=require(_0x42c0('0x0'));var util=require('util');var logger=require(_0x42c0('0x1'))('api');var moment=require(_0x42c0('0x2'));var BPromise=require(_0x42c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42c0('0x4'));var config=require(_0x42c0('0x5'));var attributes=require(_0x42c0('0x6'));module[_0x42c0('0x7')]=function(_0x980366,_0x244b33){return _0x980366[_0x42c0('0x8')](_0x42c0('0x9'),attributes,{'tableName':_0x42c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30586d,_0x42a705,_0x1db2b8){if(_0x30586d[_0x42c0('0xb')]('closed')){_0x30586d[_0x42c0('0xc')]=moment()['format'](_0x42c0('0xd'));}_0x1db2b8(null,_0x30586d);}}});}; \ No newline at end of file +var _0x9931=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x9931,0x19d));var _0x1993=function(_0x5ddef2,_0x43c7c8){_0x5ddef2=_0x5ddef2-0x0;var _0x502902=_0x9931[_0x5ddef2];return _0x502902;};'use strict';var _=require(_0x1993('0x0'));var util=require(_0x1993('0x1'));var logger=require(_0x1993('0x2'))(_0x1993('0x3'));var moment=require('moment');var BPromise=require(_0x1993('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1993('0x5'));var config=require(_0x1993('0x6'));var attributes=require(_0x1993('0x7'));module[_0x1993('0x8')]=function(_0x31103a,_0x189373){return _0x31103a[_0x1993('0x9')](_0x1993('0xa'),attributes,{'tableName':_0x1993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a5b83,_0x586e41,_0x3cd732){if(_0x5a5b83['changed']('closed')){_0x5a5b83['closedAt']=moment()[_0x1993('0xc')](_0x1993('0xd'));}_0x3cd732(null,_0x5a5b83);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a6c0d15..988dcfe 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 _0x94ea=['stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x445203,_0x52e5dc){var _0x39db3a=function(_0x5b4d32){while(--_0x5b4d32){_0x445203['push'](_0x445203['shift']());}};_0x39db3a(++_0x52e5dc);}(_0x94ea,0xf7));var _0xa94e=function(_0x5b0d8a,_0xb8e38c){_0x5b0d8a=_0x5b0d8a-0x0;var _0x4cfe8d=_0x94ea[_0x5b0d8a];return _0x4cfe8d;};'use strict';var _=require('lodash');var util=require(_0xa94e('0x0'));var moment=require('moment');var BPromise=require(_0xa94e('0x1'));var rs=require(_0xa94e('0x2'));var fs=require('fs');var Redis=require(_0xa94e('0x3'));var db=require(_0xa94e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa94e('0x5'));var config=require('../../config/environment');var jayson=require(_0xa94e('0x6'));var client=jayson[_0xa94e('0x7')][_0xa94e('0x8')]({'port':0x232a});config[_0xa94e('0x9')]=_['defaults'](config[_0xa94e('0x9')],{'host':_0xa94e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa94e('0x9')]));require(_0xa94e('0xb'))[_0xa94e('0xc')](socket);function respondWithRpcPromise(_0x398dfc,_0x3dfc93,_0x8baa87){return new BPromise(function(_0x452b99,_0x4bee67){return client[_0xa94e('0xd')](_0x398dfc,_0x8baa87)[_0xa94e('0xe')](function(_0x53f9a8){logger[_0xa94e('0xf')](_0xa94e('0x10'),_0x3dfc93,_0xa94e('0x11'));logger[_0xa94e('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3dfc93,_0xa94e('0x11'),JSON[_0xa94e('0x13')](_0x53f9a8));if(_0x53f9a8[_0xa94e('0x14')]){if(_0x53f9a8[_0xa94e('0x14')][_0xa94e('0x15')]===0x1f4){logger['error'](_0xa94e('0x10'),_0x3dfc93,_0x53f9a8[_0xa94e('0x14')][_0xa94e('0x16')]);return _0x4bee67(_0x53f9a8['error'][_0xa94e('0x16')]);}logger[_0xa94e('0x14')](_0xa94e('0x10'),_0x3dfc93,_0x53f9a8[_0xa94e('0x14')][_0xa94e('0x16')]);return _0x452b99(_0x53f9a8[_0xa94e('0x14')][_0xa94e('0x16')]);}else{logger[_0xa94e('0xf')](_0xa94e('0x10'),_0x3dfc93,_0xa94e('0x11'));_0x452b99(_0x53f9a8[_0xa94e('0x17')]['message']);}})[_0xa94e('0x18')](function(_0xb7c15c){logger[_0xa94e('0x14')](_0xa94e('0x10'),_0x3dfc93,_0xb7c15c);_0x4bee67(_0xb7c15c);});});}exports[_0xa94e('0x19')]=function(_0x525d39){var _0x26e5db=this;return new Promise(function(_0x1ed287,_0xc2112a){return db[_0xa94e('0x1a')]['update'](_0x525d39[_0xa94e('0x1b')],{'raw':_0x525d39[_0xa94e('0x1c')]?_0x525d39['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525d39[_0xa94e('0x1c')]?_0x525d39[_0xa94e('0x1c')][_0xa94e('0x1d')]||null:null,'attributes':_0x525d39[_0xa94e('0x1c')]?_0x525d39[_0xa94e('0x1c')][_0xa94e('0x1e')]||null:null,'limit':_0x525d39[_0xa94e('0x1c')]?_0x525d39[_0xa94e('0x1c')][_0xa94e('0x1f')]||null:null})[_0xa94e('0xe')](function(_0x54285b){logger[_0xa94e('0xf')](_0xa94e('0x19'),_0x525d39);logger[_0xa94e('0x12')](_0xa94e('0x19'),_0x525d39,JSON['stringify'](_0x54285b));_0x1ed287(_0x54285b);})[_0xa94e('0x18')](function(_0x323353){logger[_0xa94e('0x14')](_0xa94e('0x19'),_0x323353[_0xa94e('0x16')],_0x525d39);_0xc2112a(_0x26e5db[_0xa94e('0x14')](0x1f4,_0x323353[_0xa94e('0x16')]));});});};exports[_0xa94e('0x20')]=function(_0x12eeab){return new Promise(function(_0x4c801a,_0x129d46){return db[_0xa94e('0x1a')][_0xa94e('0x21')]({'where':_0x12eeab['options']?_0x12eeab['options']['where']||null:null})[_0xa94e('0xe')](function(_0x575408){if(_0x575408){return _0x575408[_0xa94e('0x22')](_0x12eeab[_0xa94e('0x1b')]['ids'],_['omit'](_0x12eeab[_0xa94e('0x1b')],[_0xa94e('0x23'),'id'])||{});}})[_0xa94e('0x24')](function(_0x7258ec){logger[_0xa94e('0xf')](_0xa94e('0x25'),_0x12eeab);logger[_0xa94e('0x12')](_0xa94e('0x25'),_0x12eeab,JSON[_0xa94e('0x13')](_0x7258ec));_0x4c801a(_0x7258ec);})[_0xa94e('0x18')](function(_0x59d43f){logger[_0xa94e('0x14')](_0xa94e('0x25'),_0x59d43f[_0xa94e('0x16')],_0x12eeab);_0x129d46(_this[_0xa94e('0x14')](0x1f4,_0x59d43f['message']));});});}; \ No newline at end of file +var _0x6f91=['attributes','limit','info','AddTagsToSmsInteraction','SmsInteraction','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','update','body','options'];(function(_0x813a92,_0x464efd){var _0x2bd26=function(_0x20704d){while(--_0x20704d){_0x813a92['push'](_0x813a92['shift']());}};_0x2bd26(++_0x464efd);}(_0x6f91,0xd6));var _0x16f9=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x6f91[_0x2d72ab];return _0x256423;};'use strict';var _=require(_0x16f9('0x0'));var util=require(_0x16f9('0x1'));var moment=require('moment');var BPromise=require(_0x16f9('0x2'));var rs=require(_0x16f9('0x3'));var fs=require('fs');var Redis=require(_0x16f9('0x4'));var db=require(_0x16f9('0x5'))['db'];var utils=require(_0x16f9('0x6'));var logger=require(_0x16f9('0x7'))(_0x16f9('0x8'));var config=require(_0x16f9('0x9'));var jayson=require(_0x16f9('0xa'));var client=jayson[_0x16f9('0xb')][_0x16f9('0xc')]({'port':0x232a});config[_0x16f9('0xd')]=_[_0x16f9('0xe')](config[_0x16f9('0xd')],{'host':_0x16f9('0xf'),'port':0x18eb});var socket=require(_0x16f9('0x10'))(new Redis(config[_0x16f9('0xd')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xc16d03,_0x6048f,_0x429cf4){return new BPromise(function(_0x47b82b,_0xc842a2){return client[_0x16f9('0x11')](_0xc16d03,_0x429cf4)[_0x16f9('0x12')](function(_0x503f0f){logger['info'](_0x16f9('0x13'),_0x6048f,_0x16f9('0x14'));logger[_0x16f9('0x15')](_0x16f9('0x16'),_0x6048f,'request\x20sent',JSON[_0x16f9('0x17')](_0x503f0f));if(_0x503f0f[_0x16f9('0x18')]){if(_0x503f0f['error'][_0x16f9('0x19')]===0x1f4){logger['error'](_0x16f9('0x13'),_0x6048f,_0x503f0f[_0x16f9('0x18')][_0x16f9('0x1a')]);return _0xc842a2(_0x503f0f[_0x16f9('0x18')][_0x16f9('0x1a')]);}logger[_0x16f9('0x18')](_0x16f9('0x13'),_0x6048f,_0x503f0f[_0x16f9('0x18')][_0x16f9('0x1a')]);return _0x47b82b(_0x503f0f[_0x16f9('0x18')][_0x16f9('0x1a')]);}else{logger['info'](_0x16f9('0x13'),_0x6048f,_0x16f9('0x14'));_0x47b82b(_0x503f0f['result'][_0x16f9('0x1a')]);}})[_0x16f9('0x1b')](function(_0x1f4681){logger[_0x16f9('0x18')](_0x16f9('0x13'),_0x6048f,_0x1f4681);_0xc842a2(_0x1f4681);});});}exports[_0x16f9('0x1c')]=function(_0x10eae0){var _0x113712=this;return new Promise(function(_0x2a4913,_0x49932c){return db['SmsInteraction'][_0x16f9('0x1d')](_0x10eae0[_0x16f9('0x1e')],{'raw':_0x10eae0[_0x16f9('0x1f')]?_0x10eae0[_0x16f9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10eae0[_0x16f9('0x1f')]?_0x10eae0['options']['where']||null:null,'attributes':_0x10eae0[_0x16f9('0x1f')]?_0x10eae0[_0x16f9('0x1f')][_0x16f9('0x20')]||null:null,'limit':_0x10eae0[_0x16f9('0x1f')]?_0x10eae0[_0x16f9('0x1f')][_0x16f9('0x21')]||null:null})['then'](function(_0x5f4116){logger[_0x16f9('0x22')](_0x16f9('0x1c'),_0x10eae0);logger[_0x16f9('0x15')](_0x16f9('0x1c'),_0x10eae0,JSON[_0x16f9('0x17')](_0x5f4116));_0x2a4913(_0x5f4116);})[_0x16f9('0x1b')](function(_0x23d07e){logger['error'](_0x16f9('0x1c'),_0x23d07e['message'],_0x10eae0);_0x49932c(_0x113712['error'](0x1f4,_0x23d07e[_0x16f9('0x1a')]));});});};exports[_0x16f9('0x23')]=function(_0x4c2255){return new Promise(function(_0x388a11,_0x435c9d){return db[_0x16f9('0x24')]['find']({'where':_0x4c2255['options']?_0x4c2255['options']['where']||null:null})[_0x16f9('0x12')](function(_0x5497e9){if(_0x5497e9){return _0x5497e9[_0x16f9('0x25')](_0x4c2255[_0x16f9('0x1e')][_0x16f9('0x26')],_['omit'](_0x4c2255['body'],[_0x16f9('0x26'),'id'])||{});}})[_0x16f9('0x27')](function(_0x989fa6){logger[_0x16f9('0x22')]('AddTags',_0x4c2255);logger[_0x16f9('0x15')](_0x16f9('0x28'),_0x4c2255,JSON['stringify'](_0x989fa6));_0x388a11(_0x989fa6);})[_0x16f9('0x1b')](function(_0x2dfaf0){logger[_0x16f9('0x18')](_0x16f9('0x28'),_0x2dfaf0[_0x16f9('0x1a')],_0x4c2255);_0x435c9d(_this[_0x16f9('0x18')](0x1f4,_0x2dfaf0[_0x16f9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5825ba5..ba56cc6 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 _0x19be=['save','remove','update','emit','removeListener','register','length','./smsInteraction.events'];(function(_0x4c35f9,_0x25fe48){var _0x10fda5=function(_0x413d18){while(--_0x413d18){_0x4c35f9['push'](_0x4c35f9['shift']());}};_0x10fda5(++_0x25fe48);}(_0x19be,0x187));var _0xe19b=function(_0x589e0b,_0x896bd6){_0x589e0b=_0x589e0b-0x0;var _0x15a105=_0x19be[_0x589e0b];return _0x15a105;};'use strict';var SmsInteractionEvents=require(_0xe19b('0x0'));var events=[_0xe19b('0x1'),_0xe19b('0x2'),_0xe19b('0x3')];function createListener(_0x3a7aaf,_0x4ab804){return function(_0x579376){_0x4ab804[_0xe19b('0x4')](_0x3a7aaf,_0x579376);};}function removeListener(_0x27c976,_0x2e667a){return function(){SmsInteractionEvents[_0xe19b('0x5')](_0x27c976,_0x2e667a);};}exports[_0xe19b('0x6')]=function(_0x219c1a){for(var _0x427457=0x0,_0x209c7f=events[_0xe19b('0x7')];_0x427457<_0x209c7f;_0x427457++){var _0x11f6f9=events[_0x427457];var _0x5a8bd6=createListener('smsInteraction:'+_0x11f6f9,_0x219c1a);SmsInteractionEvents['on'](_0x11f6f9,_0x5a8bd6);}}; \ No newline at end of file +var _0x6f11=['update','emit','register','./smsInteraction.events','remove'];(function(_0x1b2fb8,_0x579a7d){var _0x576932=function(_0x320b0e){while(--_0x320b0e){_0x1b2fb8['push'](_0x1b2fb8['shift']());}};_0x576932(++_0x579a7d);}(_0x6f11,0xda));var _0x16f1=function(_0x2946c2,_0x4b07d7){_0x2946c2=_0x2946c2-0x0;var _0x5a4e52=_0x6f11[_0x2946c2];return _0x5a4e52;};'use strict';var SmsInteractionEvents=require(_0x16f1('0x0'));var events=['save',_0x16f1('0x1'),_0x16f1('0x2')];function createListener(_0x30072b,_0x4b8cda){return function(_0x21c955){_0x4b8cda[_0x16f1('0x3')](_0x30072b,_0x21c955);};}function removeListener(_0x1bdccd,_0x4fbae0){return function(){SmsInteractionEvents['removeListener'](_0x1bdccd,_0x4fbae0);};}exports[_0x16f1('0x4')]=function(_0x2dd2ec){for(var _0xab5bf0=0x0,_0x2efb62=events['length'];_0xab5bf0<_0x2efb62;_0xab5bf0++){var _0x33b7f0=events[_0xab5bf0];var _0x24853b=createListener('smsInteraction:'+_0x33b7f0,_0x2dd2ec);SmsInteractionEvents['on'](_0x33b7f0,_0x24853b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a8a2298..15a81a8 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 _0x30a6=['smsmessage:create','create','/:id/status','status','put','update','accept','reject','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x30a6,0x1ab));var _0x630a=function(_0x343bd0,_0x1858a6){_0x343bd0=_0x343bd0-0x0;var _0x111a8d=_0x30a6[_0x343bd0];return _0x111a8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x630a('0x0'));var timeout=require(_0x630a('0x1'));var express=require('express');var router=express[_0x630a('0x2')]();var fs_extra=require(_0x630a('0x3'));var auth=require(_0x630a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x630a('0x5')]('/',auth[_0x630a('0x6')](),controller[_0x630a('0x7')]);router[_0x630a('0x5')](_0x630a('0x8'),auth['isAuthenticated'](),controller[_0x630a('0x9')]);router['get'](_0x630a('0xa'),auth[_0x630a('0x6')](),controller[_0x630a('0xb')]);router[_0x630a('0xc')]('/',auth[_0x630a('0x6')](),interaction[_0x630a('0xd')](_0x630a('0xe'),_0x630a('0xf')),controller[_0x630a('0x10')]);router[_0x630a('0xc')](_0x630a('0x11'),controller[_0x630a('0x12')]);router[_0x630a('0x13')](_0x630a('0xa'),auth[_0x630a('0x6')](),controller[_0x630a('0x14')]);router[_0x630a('0x13')]('/:id/accept',auth[_0x630a('0x6')](),controller[_0x630a('0x15')]);router[_0x630a('0x13')]('/:id/reject',auth[_0x630a('0x6')](),controller[_0x630a('0x16')]);router[_0x630a('0x17')](_0x630a('0xa'),auth[_0x630a('0x6')](),controller[_0x630a('0x18')]);module[_0x630a('0x19')]=router; \ No newline at end of file +var _0x4f34=['/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','sms','/:id/status','status','update','put'];(function(_0x4137c0,_0x41d82e){var _0x59d01f=function(_0x4b80ed){while(--_0x4b80ed){_0x4137c0['push'](_0x4137c0['shift']());}};_0x59d01f(++_0x41d82e);}(_0x4f34,0xae));var _0x44f3=function(_0x34000d,_0x40af78){_0x34000d=_0x34000d-0x0;var _0x1661f3=_0x4f34[_0x34000d];return _0x1661f3;};'use strict';var multer=require(_0x44f3('0x0'));var util=require(_0x44f3('0x1'));var path=require(_0x44f3('0x2'));var timeout=require(_0x44f3('0x3'));var express=require(_0x44f3('0x4'));var router=express[_0x44f3('0x5')]();var fs_extra=require(_0x44f3('0x6'));var auth=require(_0x44f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x44f3('0x8'));var controller=require(_0x44f3('0x9'));router[_0x44f3('0xa')]('/',auth[_0x44f3('0xb')](),controller[_0x44f3('0xc')]);router[_0x44f3('0xa')]('/describe',auth[_0x44f3('0xb')](),controller['describe']);router[_0x44f3('0xa')](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0xe')]);router[_0x44f3('0xf')]('/',auth[_0x44f3('0xb')](),interaction[_0x44f3('0x10')](_0x44f3('0x11'),'smsmessage:create'),controller['create']);router['post'](_0x44f3('0x12'),controller[_0x44f3('0x13')]);router['put'](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x14')]);router[_0x44f3('0x15')](_0x44f3('0x16'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x17')]);router['put'](_0x44f3('0x18'),auth[_0x44f3('0xb')](),controller['reject']);router[_0x44f3('0x19')](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x1a')]);module[_0x44f3('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 f113014..917c7b1 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 _0x6898=['TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize','exports'];(function(_0xaecde5,_0x59f4b5){var _0x2ed28c=function(_0x47c368){while(--_0x47c368){_0xaecde5['push'](_0xaecde5['shift']());}};_0x2ed28c(++_0x59f4b5);}(_0x6898,0x18e));var _0x8689=function(_0x24d164,_0x2a8d6f){_0x24d164=_0x24d164-0x0;var _0x24d2fc=_0x6898[_0x24d164];return _0x24d2fc;};'use strict';var Sequelize=require(_0x8689('0x0'));module[_0x8689('0x1')]={'body':{'type':Sequelize[_0x8689('0x2')](_0x8689('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8689('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8689('0x5')),'defaultValue':_0x8689('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8689('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8689('0x6')]},'readAt':{'type':Sequelize[_0x8689('0x7')]},'secret':{'type':Sequelize[_0x8689('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8689('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3604=['DATE','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x47a7dc,_0x560171){var _0x2cf138=function(_0x598784){while(--_0x598784){_0x47a7dc['push'](_0x47a7dc['shift']());}};_0x2cf138(++_0x560171);}(_0x3604,0x174));var _0x4360=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x3604[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module[_0x4360('0x0')]={'body':{'type':Sequelize[_0x4360('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4360('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4360('0x3')]('in',_0x4360('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4360('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4360('0x5')]},'readAt':{'type':Sequelize[_0x4360('0x6')]},'secret':{'type':Sequelize[_0x4360('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4360('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9d937ed..eece974 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 _0x8e4f=['SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','json','undefined','count','limit','Content-Range','apply','reject','save','end','stack','name','send','index','map','SmsMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','rawAttributes','options','catch','body','find','params','destroy','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','update','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','SmsAccount'];(function(_0x2cbeb1,_0x480a89){var _0x4d8240=function(_0x3b9f4c){while(--_0x3b9f4c){_0x2cbeb1['push'](_0x2cbeb1['shift']());}};_0x4d8240(++_0x480a89);}(_0x8e4f,0xa9));var _0xf8e4=function(_0x1dded2,_0x46dbbc){_0x1dded2=_0x1dded2-0x0;var _0x3dfe8c=_0x8e4f[_0x1dded2];return _0x3dfe8c;};'use strict';var emlformat=require(_0xf8e4('0x0'));var rimraf=require(_0xf8e4('0x1'));var zipdir=require(_0xf8e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e4('0x3'));var moment=require(_0xf8e4('0x4'));var BPromise=require(_0xf8e4('0x5'));var Mustache=require(_0xf8e4('0x6'));var util=require('util');var path=require(_0xf8e4('0x7'));var sox=require(_0xf8e4('0x8'));var csv=require(_0xf8e4('0x9'));var ejs=require(_0xf8e4('0xa'));var fs=require('fs');var fs_extra=require(_0xf8e4('0xb'));var _=require(_0xf8e4('0xc'));var squel=require(_0xf8e4('0xd'));var crypto=require(_0xf8e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf8e4('0xf'));var toCsv=require(_0xf8e4('0x9'));var querystring=require(_0xf8e4('0x10'));var Papa=require(_0xf8e4('0x11'));var Redis=require('ioredis');var authService=require(_0xf8e4('0x12'));var qs=require(_0xf8e4('0x13'));var as=require(_0xf8e4('0x14'));var hardwareService=require(_0xf8e4('0x15'));var logger=require(_0xf8e4('0x16'))(_0xf8e4('0x17'));var utils=require('../../config/utils');var config=require(_0xf8e4('0x18'));var licenseUtil=require(_0xf8e4('0x19'));var db=require('../../mysqldb')['db'];config[_0xf8e4('0x1a')]=_[_0xf8e4('0x1b')](config[_0xf8e4('0x1a')],{'host':_0xf8e4('0x1c'),'port':0x18eb});var socket=require(_0xf8e4('0x1d'))(new Redis(config[_0xf8e4('0x1a')]));require(_0xf8e4('0x1e'))[_0xf8e4('0x1f')](socket);var jayson=require(_0xf8e4('0x20'));var client=jayson[_0xf8e4('0x21')][_0xf8e4('0x22')]({'port':0x232c});var client9002=jayson[_0xf8e4('0x21')][_0xf8e4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x490aa8,_0x524868,_0x58480a,_0x397836){return new BPromise(function(_0xbcf106,_0xb73593){var _0x56f510=_0x397836||client;return _0x56f510[_0xf8e4('0x23')](_0x490aa8,_0x58480a)[_0xf8e4('0x24')](function(_0x292a87){logger['info'](_0xf8e4('0x25'),_0x524868,'request\x20sent');logger[_0xf8e4('0x26')](_0xf8e4('0x27'),_0x524868,_0xf8e4('0x28'),JSON[_0xf8e4('0x29')](_0x292a87));if(_0x292a87[_0xf8e4('0x2a')]){if(_0x292a87[_0xf8e4('0x2a')]['code']===0x1f4){logger[_0xf8e4('0x2a')](_0xf8e4('0x25'),_0x524868,_0x292a87['error'][_0xf8e4('0x2b')]);return _0xb73593(_0x292a87[_0xf8e4('0x2a')][_0xf8e4('0x2b')]);}logger[_0xf8e4('0x2a')](_0xf8e4('0x25'),_0x524868,_0x292a87[_0xf8e4('0x2a')][_0xf8e4('0x2b')]);return _0xbcf106(_0x292a87[_0xf8e4('0x2a')][_0xf8e4('0x2b')]);}else{logger[_0xf8e4('0x2c')](_0xf8e4('0x25'),_0x524868,_0xf8e4('0x28'));_0xbcf106(_0x292a87[_0xf8e4('0x2d')]['message']);}})['catch'](function(_0x14fd03){logger[_0xf8e4('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x524868,_0x14fd03);_0xb73593(_0x14fd03);});});}function respondWithStatusCode(_0x562a89,_0xdd4f3d){_0xdd4f3d=_0xdd4f3d||0xcc;return function(_0x4f72dd){if(_0x4f72dd){return _0x562a89[_0xf8e4('0x2e')](_0xdd4f3d);}return _0x562a89['status'](_0xdd4f3d)['end']();};}function respondWithResult(_0x5f57ef,_0x189f83){_0x189f83=_0x189f83||0xc8;return function(_0xf8a545){if(_0xf8a545){return _0x5f57ef[_0xf8e4('0x2f')](_0x189f83)[_0xf8e4('0x30')](_0xf8a545);}};}function respondWithFilteredResult(_0xe2881a,_0x1532ef){return function(_0x3136a7){if(_0x3136a7){var _0x425c09=typeof _0x1532ef['offset']===_0xf8e4('0x31')&&typeof _0x1532ef['limit']==='undefined';var _0x2aa6b=_0x3136a7[_0xf8e4('0x32')];var _0x3712a7=_0x425c09?0x0:_0x1532ef['offset'];var _0x32a1ee=_0x425c09?_0x3136a7[_0xf8e4('0x32')]:_0x1532ef['offset']+_0x1532ef[_0xf8e4('0x33')];var _0x1ee805;if(_0x32a1ee>=_0x2aa6b){_0x32a1ee=_0x2aa6b;_0x1ee805=0xc8;}else{_0x1ee805=0xce;}_0xe2881a[_0xf8e4('0x2f')](_0x1ee805);return _0xe2881a['set'](_0xf8e4('0x34'),_0x3712a7+'-'+_0x32a1ee+'/'+_0x2aa6b)['json'](_0x3136a7);}return null;};}function patchUpdates(_0x361266){return function(_0x14be48){try{jsonpatch[_0xf8e4('0x35')](_0x14be48,_0x361266,!![]);}catch(_0x862ef7){return BPromise[_0xf8e4('0x36')](_0x862ef7);}return _0x14be48[_0xf8e4('0x37')]();};}function saveUpdates(_0x38dd4d,_0x3e01a1){return function(_0x3e7b9c){if(_0x3e7b9c){return _0x3e7b9c['update'](_0x38dd4d)[_0xf8e4('0x24')](function(_0xdb4dbb){return _0xdb4dbb;});}return null;};}function removeEntity(_0x2e0aa6,_0x27223c){return function(_0x1a88c9){if(_0x1a88c9){return _0x1a88c9['destroy']()[_0xf8e4('0x24')](function(){_0x2e0aa6[_0xf8e4('0x2f')](0xcc)[_0xf8e4('0x38')]();});}};}function handleEntityNotFound(_0x55c43d,_0x3041df){return function(_0x364065){if(!_0x364065){_0x55c43d[_0xf8e4('0x2e')](0x194);}return _0x364065;};}function handleError(_0x28cb1a,_0x301eca){_0x301eca=_0x301eca||0x1f4;return function(_0x597e16){logger['error'](_0x597e16[_0xf8e4('0x39')]);if(_0x597e16[_0xf8e4('0x3a')]){delete _0x597e16[_0xf8e4('0x3a')];}_0x28cb1a[_0xf8e4('0x2f')](_0x301eca)[_0xf8e4('0x3b')](_0x597e16);};}exports[_0xf8e4('0x3c')]=function(_0xe9ba50,_0x14fb39){var _0xf8af35={},_0x266e15={},_0x166d73={'count':0x0,'rows':[]};var _0x3f6712=_[_0xf8e4('0x3d')](db[_0xf8e4('0x3e')]['rawAttributes'],function(_0x513aba){return{'name':_0x513aba['fieldName'],'type':_0x513aba[_0xf8e4('0x3f')][_0xf8e4('0x40')]};});_0x266e15[_0xf8e4('0x41')]=_[_0xf8e4('0x3d')](_0x3f6712,_0xf8e4('0x3a'));_0x266e15[_0xf8e4('0x42')]=_[_0xf8e4('0x43')](_0xe9ba50[_0xf8e4('0x42')]);_0x266e15[_0xf8e4('0x44')]=_[_0xf8e4('0x45')](_0x266e15[_0xf8e4('0x41')],_0x266e15[_0xf8e4('0x42')]);_0xf8af35[_0xf8e4('0x46')]=_[_0xf8e4('0x45')](_0x266e15[_0xf8e4('0x41')],qs['fields'](_0xe9ba50[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0xf8af35[_0xf8e4('0x46')]=_0xf8af35[_0xf8e4('0x46')][_0xf8e4('0x48')]?_0xf8af35[_0xf8e4('0x46')]:_0x266e15[_0xf8e4('0x41')];if(!_0xe9ba50[_0xf8e4('0x42')][_0xf8e4('0x49')](_0xf8e4('0x4a'))){_0xf8af35['limit']=qs[_0xf8e4('0x33')](_0xe9ba50[_0xf8e4('0x42')][_0xf8e4('0x33')]);_0xf8af35[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4b')](_0xe9ba50['query'][_0xf8e4('0x4b')]);}_0xf8af35['order']=qs[_0xf8e4('0x4c')](_0xe9ba50[_0xf8e4('0x42')]['sort']);_0xf8af35['where']=qs['filters'](_[_0xf8e4('0x4d')](_0xe9ba50['query'],_0x266e15['filters']),_0x3f6712);if(_0xe9ba50[_0xf8e4('0x42')]['filter']){_0xf8af35[_0xf8e4('0x4e')]=_[_0xf8e4('0x4f')](_0xf8af35[_0xf8e4('0x4e')],{'$or':_['map'](_0x3f6712,function(_0x3e2308){if(_0x3e2308[_0xf8e4('0x3f')]!==_0xf8e4('0x50')){var _0x42ce7c={};_0x42ce7c[_0x3e2308[_0xf8e4('0x3a')]]={'$like':'%'+_0xe9ba50[_0xf8e4('0x42')][_0xf8e4('0x51')]+'%'};return _0x42ce7c;}})});}_0xf8af35=_[_0xf8e4('0x4f')]({},_0xf8af35,_0xe9ba50['options']);var _0x32ed6a={'where':_0xf8af35[_0xf8e4('0x4e')]};return db[_0xf8e4('0x3e')][_0xf8e4('0x32')](_0x32ed6a)[_0xf8e4('0x24')](function(_0x2376cf){_0x166d73[_0xf8e4('0x32')]=_0x2376cf;if(_0xe9ba50[_0xf8e4('0x42')][_0xf8e4('0x52')]){_0xf8af35[_0xf8e4('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0xf8e4('0x54')](_0xf8af35);})[_0xf8e4('0x24')](function(_0x4f3d57){_0x166d73[_0xf8e4('0x55')]=_0x4f3d57;return _0x166d73;})[_0xf8e4('0x24')](respondWithFilteredResult(_0x14fb39,_0xf8af35))['catch'](handleError(_0x14fb39,null));};exports['show']=function(_0x16585f,_0x1d9157){var _0x4a128c={'raw':!![],'where':{'id':_0x16585f['params']['id']}},_0x3e8a0d={};_0x3e8a0d[_0xf8e4('0x41')]=_['keys'](db[_0xf8e4('0x3e')][_0xf8e4('0x56')]);_0x3e8a0d[_0xf8e4('0x42')]=_[_0xf8e4('0x43')](_0x16585f[_0xf8e4('0x42')]);_0x3e8a0d[_0xf8e4('0x44')]=_['intersection'](_0x3e8a0d[_0xf8e4('0x41')],_0x3e8a0d[_0xf8e4('0x42')]);_0x4a128c[_0xf8e4('0x46')]=_[_0xf8e4('0x45')](_0x3e8a0d[_0xf8e4('0x41')],qs[_0xf8e4('0x47')](_0x16585f[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0x4a128c[_0xf8e4('0x46')]=_0x4a128c[_0xf8e4('0x46')]['length']?_0x4a128c[_0xf8e4('0x46')]:_0x3e8a0d['model'];if(_0x16585f[_0xf8e4('0x42')][_0xf8e4('0x52')]){_0x4a128c[_0xf8e4('0x53')]=[{'all':!![]}];}_0x4a128c=_[_0xf8e4('0x4f')]({},_0x4a128c,_0x16585f[_0xf8e4('0x57')]);return db[_0xf8e4('0x3e')]['find'](_0x4a128c)[_0xf8e4('0x24')](handleEntityNotFound(_0x1d9157,null))[_0xf8e4('0x24')](respondWithResult(_0x1d9157,null))[_0xf8e4('0x58')](handleError(_0x1d9157,null));};exports['create']=function(_0x46c69a,_0x24653a){return db[_0xf8e4('0x3e')]['create'](_0x46c69a['body'],{})[_0xf8e4('0x24')](respondWithResult(_0x24653a,0xc9))[_0xf8e4('0x58')](handleError(_0x24653a,null));};exports['update']=function(_0x330c63,_0xa8a9a7){if(_0x330c63[_0xf8e4('0x59')]['id']){delete _0x330c63[_0xf8e4('0x59')]['id'];}return db[_0xf8e4('0x3e')][_0xf8e4('0x5a')]({'where':{'id':_0x330c63[_0xf8e4('0x5b')]['id']}})[_0xf8e4('0x24')](handleEntityNotFound(_0xa8a9a7,null))[_0xf8e4('0x24')](saveUpdates(_0x330c63['body'],null))['then'](respondWithResult(_0xa8a9a7,null))[_0xf8e4('0x58')](handleError(_0xa8a9a7,null));};exports[_0xf8e4('0x5c')]=function(_0xe2a7b1,_0x5553c3){return db[_0xf8e4('0x3e')][_0xf8e4('0x5a')]({'where':{'id':_0xe2a7b1[_0xf8e4('0x5b')]['id']}})[_0xf8e4('0x24')](handleEntityNotFound(_0x5553c3,null))[_0xf8e4('0x24')](removeEntity(_0x5553c3,null))[_0xf8e4('0x58')](handleError(_0x5553c3,null));};exports[_0xf8e4('0x5d')]=function(_0x41a6c3,_0x4a8df7){return db['SmsMessage'][_0xf8e4('0x5d')]()[_0xf8e4('0x24')](respondWithResult(_0x4a8df7,null))[_0xf8e4('0x58')](handleError(_0x4a8df7,null));};var interaction_log=require('../../config/logger')(_0xf8e4('0x5e'));exports['accept']=function(_0x1e42c1,_0x2f1ef9,_0x563971){var _0x2c5a93={'agent':{},'channel':_0xf8e4('0x5f')};if(_0x1e42c1[_0xf8e4('0x59')]['id']){delete _0x1e42c1[_0xf8e4('0x59')]['id'];}_0x1e42c1['body'][_0xf8e4('0x60')]=!![];_0x1e42c1[_0xf8e4('0x59')][_0xf8e4('0x61')]=moment()[_0xf8e4('0x62')](_0xf8e4('0x63'));_0x1e42c1[_0xf8e4('0x59')][_0xf8e4('0x64')]=_0x1e42c1[_0xf8e4('0x59')][_0xf8e4('0x64')]||_0x1e42c1[_0xf8e4('0x65')]['id'];_0x2c5a93[_0xf8e4('0x66')]['id']=_0x1e42c1['body'][_0xf8e4('0x64')];return db[_0xf8e4('0x3e')]['find']({'where':{'id':_0x1e42c1[_0xf8e4('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f1ef9,null))[_0xf8e4('0x24')](saveUpdates(_0x1e42c1[_0xf8e4('0x59')],null))[_0xf8e4('0x24')](function(_0x255d8e){if(_0x255d8e){_0x2c5a93['message']=_0x255d8e[_0xf8e4('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xf8e4('0x5a')]({'where':{'id':_0x255d8e[_0xf8e4('0x68')]}});}return null;})[_0xf8e4('0x24')](handleEntityNotFound(_0x2f1ef9,null))[_0xf8e4('0x24')](function(_0x2830bb){if(_0x2830bb){return _0x2830bb[_0xf8e4('0x69')]({'UserId':_0x1e42c1[_0xf8e4('0x59')][_0xf8e4('0x64')],'read1stAt':_[_0xf8e4('0x6a')](_0x2830bb['read1stAt'])?moment()[_0xf8e4('0x62')](_0xf8e4('0x63')):undefined});}return null;})['then'](function(_0x484bc5){if(_0x484bc5){_0x2c5a93[_0xf8e4('0x6b')]=_0x484bc5[_0xf8e4('0x67')]({'plain':!![]});interaction_log['info'](_0xf8e4('0x6c'),_0x1e42c1[_0xf8e4('0x65')]['id'],_0x1e42c1[_0xf8e4('0x65')][_0xf8e4('0x3a')],_0x1e42c1['user'][_0xf8e4('0x6d')],_0x2c5a93['interaction']['id'],_0x1e42c1[_0xf8e4('0x59')]?JSON[_0xf8e4('0x29')](_0x1e42c1[_0xf8e4('0x59')]):_0xf8e4('0x6e'));return respondWithRpcPromise(_0xf8e4('0x6f'),_0xf8e4('0x70'),_0x2c5a93);}return null;})[_0xf8e4('0x24')](function(_0x174772){var _0x368af=_0xf8e4('0x71')+_0x174772[_0xf8e4('0x2b')]['ContactId'];return db[_0xf8e4('0x72')][_0xf8e4('0x42')](_0x368af,{'type':db[_0xf8e4('0x73')]['QueryTypes'][_0xf8e4('0x74')],'raw':!![]})[_0xf8e4('0x24')](function(_0x4a4d71){return _0x4a4d71;});})['then'](function(_0x17ca26){if(_0x17ca26){_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x75')]=_0x17ca26[0x0];if(!_0x1e42c1['body'][_0xf8e4('0x64')])return;return db[_0xf8e4('0x76')][_0xf8e4('0x5a')]({'where':{'id':_0x1e42c1[_0xf8e4('0x59')]['UserId'],'role':_0xf8e4('0x66')},'attributes':['id',_0xf8e4('0x3a'),_0xf8e4('0x77'),_0xf8e4('0x78'),_0xf8e4('0x79')],'raw':!![]});}return null;})['then'](function(_0xfbdd21){if(!_0xfbdd21)return null;_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x66')]=_0xfbdd21;return _0x2c5a93;})[_0xf8e4('0x24')](function(_0xdb0c9){if(_0xdb0c9){if(_0x1e42c1['body'][_0xf8e4('0x7a')]){_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x7b')]=util[_0xf8e4('0x62')]('SIP/%s',_0x1e42c1[_0xf8e4('0x65')]['name']);_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x7c')]=_0x2c5a93['channel'];_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x7d')]=_0x2c5a93[_0xf8e4('0x7c')];_0x2c5a93[_0xf8e4('0x2b')][_0xf8e4('0x7e')]=_0xf8e4('0x7f');return respondWithRpcPromise(_0xf8e4('0x80'),_0xf8e4('0x80'),{'event':_0xf8e4('0x81'),'message':_0x2c5a93[_0xf8e4('0x2b')]},client9002)[_0xf8e4('0x24')](function(){return _0x2c5a93;});}return _0x2c5a93;}return null;})[_0xf8e4('0x24')](respondWithResult(_0x2f1ef9,null))['catch'](handleError(_0x2f1ef9,null));};var interaction_log=require(_0xf8e4('0x16'))(_0xf8e4('0x5e'));exports['reject']=function(_0x1b6b61,_0x4d8d13,_0x7727f5){var _0x177bed={'agent':{},'channel':'sms'};if(_0x1b6b61[_0xf8e4('0x59')]['id']){delete _0x1b6b61[_0xf8e4('0x59')]['id'];}_0x1b6b61[_0xf8e4('0x59')]['UserId']=_0x1b6b61[_0xf8e4('0x59')]['UserId']||_0x1b6b61[_0xf8e4('0x65')]['id'];_0x177bed['agent']['id']=_0x1b6b61[_0xf8e4('0x59')]['UserId'];return db['SmsMessage'][_0xf8e4('0x5a')]({'where':{'id':_0x1b6b61['params']['id'],'UserId':null}})[_0xf8e4('0x24')](handleEntityNotFound(_0x4d8d13,null))[_0xf8e4('0x24')](function(_0x1abb97){if(_0x1abb97){_0x177bed[_0xf8e4('0x2b')]=_0x1abb97[_0xf8e4('0x67')]({'plain':!![]});return db[_0xf8e4('0x82')][_0xf8e4('0x5a')]({'where':{'id':_0x1abb97[_0xf8e4('0x68')]}});}return null;})[_0xf8e4('0x24')](handleEntityNotFound(_0x4d8d13,null))[_0xf8e4('0x24')](function(_0x234d67){if(_0x234d67){_0x177bed[_0xf8e4('0x6b')]=_0x234d67[_0xf8e4('0x67')]({'plain':!![]});interaction_log[_0xf8e4('0x2c')](_0xf8e4('0x83'),_0x1b6b61[_0xf8e4('0x65')]['id'],_0x1b6b61[_0xf8e4('0x65')][_0xf8e4('0x3a')],_0x1b6b61[_0xf8e4('0x65')]['role'],_0x177bed[_0xf8e4('0x6b')]['id'],_0x1b6b61[_0xf8e4('0x59')]?JSON[_0xf8e4('0x29')](_0x1b6b61[_0xf8e4('0x59')]):_0xf8e4('0x6e'));return respondWithRpcPromise(_0xf8e4('0x84'),_0xf8e4('0x85'),_0x177bed);}return null;})['then'](function(_0x36d9db){var _0x166d9f=_0xf8e4('0x71')+_0x36d9db[_0xf8e4('0x2b')][_0xf8e4('0x86')];return db['sequelize'][_0xf8e4('0x42')](_0x166d9f,{'type':db[_0xf8e4('0x73')][_0xf8e4('0x87')][_0xf8e4('0x74')],'raw':!![]})[_0xf8e4('0x24')](function(_0xcc5530){return _0xcc5530;});})[_0xf8e4('0x24')](function(_0x24c82c){if(_0x24c82c){_0x177bed[_0xf8e4('0x2b')][_0xf8e4('0x75')]=_0x24c82c[0x0];if(!_0x1b6b61[_0xf8e4('0x59')][_0xf8e4('0x64')])return;return db['User'][_0xf8e4('0x5a')]({'where':{'id':_0x1b6b61['body'][_0xf8e4('0x64')],'role':_0xf8e4('0x66')},'attributes':['id',_0xf8e4('0x3a'),_0xf8e4('0x77'),_0xf8e4('0x78'),_0xf8e4('0x79')],'raw':!![]});}return null;})['then'](function(_0x10972e){if(!_0x10972e)return null;_0x177bed[_0xf8e4('0x2b')][_0xf8e4('0x66')]=_0x10972e;return _0x177bed;})[_0xf8e4('0x24')](function(_0x20e568){if(_0x20e568){_0x20e568['message'][_0xf8e4('0x7b')]=util['format']('SIP/%s',_0x1b6b61[_0xf8e4('0x65')][_0xf8e4('0x3a')]);_0x20e568['message']['channel']=_0x177bed['channel'];_0x20e568[_0xf8e4('0x2b')][_0xf8e4('0x7d')]=_0x177bed['channel'];_0x20e568[_0xf8e4('0x2b')][_0xf8e4('0x7e')]=_0xf8e4('0x36');respondWithRpcPromise(_0xf8e4('0x80'),_0xf8e4('0x80'),{'event':'rejectmessage','message':_0x20e568[_0xf8e4('0x2b')]},client9002);return _0x177bed;}return null;})[_0xf8e4('0x24')](respondWithResult(_0x4d8d13,null))[_0xf8e4('0x58')](handleError(_0x4d8d13,null));};exports[_0xf8e4('0x2f')]=function(_0x53ce13,_0x456f86,_0x4796e7){if(_0x53ce13[_0xf8e4('0x59')]['id']){delete _0x53ce13[_0xf8e4('0x59')]['id'];}var _0x4b5684;return db[_0xf8e4('0x3e')][_0xf8e4('0x5a')]({'where':{'id':_0x53ce13[_0xf8e4('0x5b')]['id']}})[_0xf8e4('0x24')](handleEntityNotFound(_0x456f86,null))[_0xf8e4('0x24')](function(_0xaefa4){if(_0xaefa4){_0x4b5684=_0xaefa4;return db[_0xf8e4('0x88')][_0xf8e4('0x5a')]({'where':{'id':_0xaefa4[_0xf8e4('0x89')]}});}})[_0xf8e4('0x24')](handleEntityNotFound(_0x456f86,null))[_0xf8e4('0x24')](function(_0x28d7bc){if(_0x28d7bc){logger['debug'](_0xf8e4('0x27'),_0xf8e4('0x2f'),'received\x20delivery\x20report\x20from',_0x28d7bc['type'],util[_0xf8e4('0x8a')](_0x53ce13[_0xf8e4('0x59')],{'showHidden':![],'depth':null}));switch(_0x28d7bc['type']){case _0xf8e4('0x8b'):if(_0x53ce13[_0xf8e4('0x59')][_0xf8e4('0x8c')]&&_0x53ce13['body'][_0xf8e4('0x8c')]===_0x4b5684[_0xf8e4('0x8d')]){return _0x4b5684[_0xf8e4('0x69')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf8e4('0x2f'),_0xf8e4('0x8b'),util[_0xf8e4('0x8a')](_0x53ce13[_0xf8e4('0x59')],{'showHidden':![],'depth':null}));}break;case _0xf8e4('0x8e'):if(_0x53ce13[_0xf8e4('0x59')]['MessageUUID']&&_0x53ce13['body'][_0xf8e4('0x8f')]===_0x4b5684[_0xf8e4('0x8d')]&&_[_0xf8e4('0x90')](['sent',_0xf8e4('0x91')],_0x53ce13[_0xf8e4('0x59')][_0xf8e4('0x92')])>=0x0){return _0x4b5684['update']({'read':!![]});}else{logger[_0xf8e4('0x2a')](_0xf8e4('0x93'),_0xf8e4('0x2f'),_0xf8e4('0x94'),util['inspect'](_0x53ce13[_0xf8e4('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x257059=_0x53ce13[_0xf8e4('0x59')][_0xf8e4('0x95')][0x0];if(_0x257059['status'][_0xf8e4('0x96')]===_0xf8e4('0x97')){return _0x4b5684['update']({'read':!![]});}else{logger[_0xf8e4('0x2a')](_0xf8e4('0x93'),_0xf8e4('0x2f'),_0xf8e4('0x98'),util['inspect'](_0x53ce13[_0xf8e4('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4b5684;}})['then'](respondWithResult(_0x456f86,null))['catch'](handleError(_0x456f86,null));}; \ No newline at end of file +var _0x15da=['SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','Status','plivio','inspect','infobip','results','groupName','DELIVERED','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','create','body','find','params','describe','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','internal','event','rejectmessage','SmsAccount','SmsAccountId','twilio','MessageSid','messageId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x15da,0x98));var _0xa15d=function(_0x5a6f32,_0x58b204){_0x5a6f32=_0x5a6f32-0x0;var _0x18c961=_0x15da[_0x5a6f32];return _0x18c961;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa15d('0x0'));var zipdir=require(_0xa15d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa15d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa15d('0x3'));var path=require(_0xa15d('0x4'));var sox=require(_0xa15d('0x5'));var csv=require(_0xa15d('0x6'));var ejs=require(_0xa15d('0x7'));var fs=require('fs');var fs_extra=require(_0xa15d('0x8'));var _=require(_0xa15d('0x9'));var squel=require('squel');var crypto=require(_0xa15d('0xa'));var jsforce=require(_0xa15d('0xb'));var deskjs=require(_0xa15d('0xc'));var toCsv=require(_0xa15d('0x6'));var querystring=require(_0xa15d('0xd'));var Papa=require(_0xa15d('0xe'));var Redis=require(_0xa15d('0xf'));var authService=require(_0xa15d('0x10'));var qs=require(_0xa15d('0x11'));var as=require(_0xa15d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa15d('0x13'))(_0xa15d('0x14'));var utils=require(_0xa15d('0x15'));var config=require(_0xa15d('0x16'));var licenseUtil=require(_0xa15d('0x17'));var db=require(_0xa15d('0x18'))['db'];config['redis']=_['defaults'](config[_0xa15d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa15d('0x1a'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xa15d('0x1b')](socket);var jayson=require(_0xa15d('0x1c'));var client=jayson['client'][_0xa15d('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x540865,_0x2b4845,_0x4a0bea,_0x1e32ac){return new BPromise(function(_0x14e95f,_0x21d678){var _0x45ebb0=_0x1e32ac||client;return _0x45ebb0[_0xa15d('0x1e')](_0x540865,_0x4a0bea)[_0xa15d('0x1f')](function(_0x2f1353){logger[_0xa15d('0x20')](_0xa15d('0x21'),_0x2b4845,'request\x20sent');logger[_0xa15d('0x22')](_0xa15d('0x23'),_0x2b4845,_0xa15d('0x24'),JSON['stringify'](_0x2f1353));if(_0x2f1353[_0xa15d('0x25')]){if(_0x2f1353[_0xa15d('0x25')]['code']===0x1f4){logger[_0xa15d('0x25')](_0xa15d('0x21'),_0x2b4845,_0x2f1353['error'][_0xa15d('0x26')]);return _0x21d678(_0x2f1353['error'][_0xa15d('0x26')]);}logger[_0xa15d('0x25')](_0xa15d('0x21'),_0x2b4845,_0x2f1353['error'][_0xa15d('0x26')]);return _0x14e95f(_0x2f1353['error'][_0xa15d('0x26')]);}else{logger[_0xa15d('0x20')](_0xa15d('0x21'),_0x2b4845,_0xa15d('0x24'));_0x14e95f(_0x2f1353[_0xa15d('0x27')]['message']);}})[_0xa15d('0x28')](function(_0x553025){logger[_0xa15d('0x25')](_0xa15d('0x21'),_0x2b4845,_0x553025);_0x21d678(_0x553025);});});}function respondWithStatusCode(_0x2cfe62,_0x9deb29){_0x9deb29=_0x9deb29||0xcc;return function(_0x39047d){if(_0x39047d){return _0x2cfe62['sendStatus'](_0x9deb29);}return _0x2cfe62[_0xa15d('0x29')](_0x9deb29)[_0xa15d('0x2a')]();};}function respondWithResult(_0x1fa4c1,_0x1f7e30){_0x1f7e30=_0x1f7e30||0xc8;return function(_0xce6c74){if(_0xce6c74){return _0x1fa4c1['status'](_0x1f7e30)[_0xa15d('0x2b')](_0xce6c74);}};}function respondWithFilteredResult(_0x26499e,_0x4edd0e){return function(_0x3a60ae){if(_0x3a60ae){var _0x150b08=typeof _0x4edd0e['offset']===_0xa15d('0x2c')&&typeof _0x4edd0e[_0xa15d('0x2d')]===_0xa15d('0x2c');var _0x3d54bd=_0x3a60ae['count'];var _0x32c593=_0x150b08?0x0:_0x4edd0e[_0xa15d('0x2e')];var _0x259ea9=_0x150b08?_0x3a60ae['count']:_0x4edd0e[_0xa15d('0x2e')]+_0x4edd0e[_0xa15d('0x2d')];var _0x5ba3a3;if(_0x259ea9>=_0x3d54bd){_0x259ea9=_0x3d54bd;_0x5ba3a3=0xc8;}else{_0x5ba3a3=0xce;}_0x26499e[_0xa15d('0x29')](_0x5ba3a3);return _0x26499e[_0xa15d('0x2f')](_0xa15d('0x30'),_0x32c593+'-'+_0x259ea9+'/'+_0x3d54bd)[_0xa15d('0x2b')](_0x3a60ae);}return null;};}function patchUpdates(_0x7d4dac){return function(_0x3a3bf5){try{jsonpatch[_0xa15d('0x31')](_0x3a3bf5,_0x7d4dac,!![]);}catch(_0x4810af){return BPromise[_0xa15d('0x32')](_0x4810af);}return _0x3a3bf5[_0xa15d('0x33')]();};}function saveUpdates(_0x5526c6,_0x197bd0){return function(_0x1ff3fb){if(_0x1ff3fb){return _0x1ff3fb[_0xa15d('0x34')](_0x5526c6)[_0xa15d('0x1f')](function(_0x3f15bd){return _0x3f15bd;});}return null;};}function removeEntity(_0x17225c,_0x38c782){return function(_0x4481bd){if(_0x4481bd){return _0x4481bd[_0xa15d('0x35')]()['then'](function(){_0x17225c[_0xa15d('0x29')](0xcc)[_0xa15d('0x2a')]();});}};}function handleEntityNotFound(_0x5cdb2b,_0x401144){return function(_0xe9e81d){if(!_0xe9e81d){_0x5cdb2b[_0xa15d('0x36')](0x194);}return _0xe9e81d;};}function handleError(_0x570c50,_0x9e57a7){_0x9e57a7=_0x9e57a7||0x1f4;return function(_0x35182c){logger[_0xa15d('0x25')](_0x35182c['stack']);if(_0x35182c[_0xa15d('0x37')]){delete _0x35182c[_0xa15d('0x37')];}_0x570c50[_0xa15d('0x29')](_0x9e57a7)[_0xa15d('0x38')](_0x35182c);};}exports[_0xa15d('0x39')]=function(_0x15d84b,_0x1a7d3f){var _0x198b89={},_0x3d3ee2={},_0x641cec={'count':0x0,'rows':[]};var _0x2bbbb2=_[_0xa15d('0x3a')](db[_0xa15d('0x3b')][_0xa15d('0x3c')],function(_0x5a1edb){return{'name':_0x5a1edb[_0xa15d('0x3d')],'type':_0x5a1edb[_0xa15d('0x3e')][_0xa15d('0x3f')]};});_0x3d3ee2[_0xa15d('0x40')]=_[_0xa15d('0x3a')](_0x2bbbb2,_0xa15d('0x37'));_0x3d3ee2['query']=_[_0xa15d('0x41')](_0x15d84b[_0xa15d('0x42')]);_0x3d3ee2[_0xa15d('0x43')]=_[_0xa15d('0x44')](_0x3d3ee2['model'],_0x3d3ee2[_0xa15d('0x42')]);_0x198b89[_0xa15d('0x45')]=_[_0xa15d('0x44')](_0x3d3ee2['model'],qs[_0xa15d('0x46')](_0x15d84b[_0xa15d('0x42')][_0xa15d('0x46')]));_0x198b89[_0xa15d('0x45')]=_0x198b89[_0xa15d('0x45')][_0xa15d('0x47')]?_0x198b89[_0xa15d('0x45')]:_0x3d3ee2[_0xa15d('0x40')];if(!_0x15d84b[_0xa15d('0x42')][_0xa15d('0x48')](_0xa15d('0x49'))){_0x198b89['limit']=qs['limit'](_0x15d84b['query'][_0xa15d('0x2d')]);_0x198b89[_0xa15d('0x2e')]=qs['offset'](_0x15d84b[_0xa15d('0x42')]['offset']);}_0x198b89[_0xa15d('0x4a')]=qs['sort'](_0x15d84b['query'][_0xa15d('0x4b')]);_0x198b89[_0xa15d('0x4c')]=qs[_0xa15d('0x43')](_[_0xa15d('0x4d')](_0x15d84b[_0xa15d('0x42')],_0x3d3ee2['filters']),_0x2bbbb2);if(_0x15d84b[_0xa15d('0x42')][_0xa15d('0x4e')]){_0x198b89[_0xa15d('0x4c')]=_['merge'](_0x198b89[_0xa15d('0x4c')],{'$or':_[_0xa15d('0x3a')](_0x2bbbb2,function(_0x2e8098){if(_0x2e8098[_0xa15d('0x3e')]!=='VIRTUAL'){var _0x4a4c1c={};_0x4a4c1c[_0x2e8098['name']]={'$like':'%'+_0x15d84b[_0xa15d('0x42')][_0xa15d('0x4e')]+'%'};return _0x4a4c1c;}})});}_0x198b89=_[_0xa15d('0x4f')]({},_0x198b89,_0x15d84b[_0xa15d('0x50')]);var _0x308cfc={'where':_0x198b89['where']};return db[_0xa15d('0x3b')][_0xa15d('0x51')](_0x308cfc)[_0xa15d('0x1f')](function(_0x9bbd6d){_0x641cec['count']=_0x9bbd6d;if(_0x15d84b[_0xa15d('0x42')][_0xa15d('0x52')]){_0x198b89[_0xa15d('0x53')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x198b89);})['then'](function(_0x2a8dcb){_0x641cec['rows']=_0x2a8dcb;return _0x641cec;})[_0xa15d('0x1f')](respondWithFilteredResult(_0x1a7d3f,_0x198b89))[_0xa15d('0x28')](handleError(_0x1a7d3f,null));};exports['show']=function(_0x34813f,_0x430ed5){var _0x37b905={'raw':!![],'where':{'id':_0x34813f['params']['id']}},_0x12632d={};_0x12632d[_0xa15d('0x40')]=_['keys'](db[_0xa15d('0x3b')][_0xa15d('0x3c')]);_0x12632d[_0xa15d('0x42')]=_[_0xa15d('0x41')](_0x34813f['query']);_0x12632d[_0xa15d('0x43')]=_['intersection'](_0x12632d['model'],_0x12632d[_0xa15d('0x42')]);_0x37b905[_0xa15d('0x45')]=_[_0xa15d('0x44')](_0x12632d[_0xa15d('0x40')],qs[_0xa15d('0x46')](_0x34813f[_0xa15d('0x42')][_0xa15d('0x46')]));_0x37b905[_0xa15d('0x45')]=_0x37b905[_0xa15d('0x45')]['length']?_0x37b905[_0xa15d('0x45')]:_0x12632d['model'];if(_0x34813f[_0xa15d('0x42')][_0xa15d('0x52')]){_0x37b905[_0xa15d('0x53')]=[{'all':!![]}];}_0x37b905=_[_0xa15d('0x4f')]({},_0x37b905,_0x34813f['options']);return db[_0xa15d('0x3b')]['find'](_0x37b905)['then'](handleEntityNotFound(_0x430ed5,null))[_0xa15d('0x1f')](respondWithResult(_0x430ed5,null))[_0xa15d('0x28')](handleError(_0x430ed5,null));};exports[_0xa15d('0x54')]=function(_0x575963,_0x1995fd){return db['SmsMessage'][_0xa15d('0x54')](_0x575963[_0xa15d('0x55')],{})[_0xa15d('0x1f')](respondWithResult(_0x1995fd,0xc9))['catch'](handleError(_0x1995fd,null));};exports['update']=function(_0x570500,_0x26181c){if(_0x570500['body']['id']){delete _0x570500[_0xa15d('0x55')]['id'];}return db[_0xa15d('0x3b')][_0xa15d('0x56')]({'where':{'id':_0x570500[_0xa15d('0x57')]['id']}})[_0xa15d('0x1f')](handleEntityNotFound(_0x26181c,null))[_0xa15d('0x1f')](saveUpdates(_0x570500[_0xa15d('0x55')],null))[_0xa15d('0x1f')](respondWithResult(_0x26181c,null))[_0xa15d('0x28')](handleError(_0x26181c,null));};exports[_0xa15d('0x35')]=function(_0x57e250,_0x101a6c){return db[_0xa15d('0x3b')][_0xa15d('0x56')]({'where':{'id':_0x57e250['params']['id']}})[_0xa15d('0x1f')](handleEntityNotFound(_0x101a6c,null))[_0xa15d('0x1f')](removeEntity(_0x101a6c,null))[_0xa15d('0x28')](handleError(_0x101a6c,null));};exports['describe']=function(_0x4ae081,_0x14fbb7){return db[_0xa15d('0x3b')][_0xa15d('0x58')]()['then'](respondWithResult(_0x14fbb7,null))[_0xa15d('0x28')](handleError(_0x14fbb7,null));};var interaction_log=require(_0xa15d('0x13'))('sms-interactions');exports[_0xa15d('0x59')]=function(_0xf54fc,_0xbe32e0,_0x394cb6){var _0x427e71={'agent':{},'channel':_0xa15d('0x5a')};if(_0xf54fc[_0xa15d('0x55')]['id']){delete _0xf54fc[_0xa15d('0x55')]['id'];}_0xf54fc[_0xa15d('0x55')][_0xa15d('0x5b')]=!![];_0xf54fc[_0xa15d('0x55')]['readAt']=moment()[_0xa15d('0x5c')](_0xa15d('0x5d'));_0xf54fc['body'][_0xa15d('0x5e')]=_0xf54fc[_0xa15d('0x55')]['UserId']||_0xf54fc[_0xa15d('0x5f')]['id'];_0x427e71[_0xa15d('0x60')]['id']=_0xf54fc[_0xa15d('0x55')][_0xa15d('0x5e')];return db[_0xa15d('0x3b')][_0xa15d('0x56')]({'where':{'id':_0xf54fc[_0xa15d('0x57')]['id'],'UserId':null}})[_0xa15d('0x1f')](handleEntityNotFound(_0xbe32e0,null))['then'](saveUpdates(_0xf54fc['body'],null))[_0xa15d('0x1f')](function(_0x4bd56f){if(_0x4bd56f){_0x427e71[_0xa15d('0x26')]=_0x4bd56f[_0xa15d('0x61')]({'plain':!![]});return db[_0xa15d('0x62')][_0xa15d('0x56')]({'where':{'id':_0x4bd56f[_0xa15d('0x63')]}});}return null;})[_0xa15d('0x1f')](handleEntityNotFound(_0xbe32e0,null))['then'](function(_0x17ceb3){if(_0x17ceb3){return _0x17ceb3[_0xa15d('0x34')]({'UserId':_0xf54fc['body'][_0xa15d('0x5e')],'read1stAt':_['isNil'](_0x17ceb3['read1stAt'])?moment()[_0xa15d('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa15d('0x1f')](function(_0x5705fb){if(_0x5705fb){_0x427e71[_0xa15d('0x64')]=_0x5705fb[_0xa15d('0x61')]({'plain':!![]});interaction_log[_0xa15d('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf54fc[_0xa15d('0x5f')]['id'],_0xf54fc[_0xa15d('0x5f')][_0xa15d('0x37')],_0xf54fc['user']['role'],_0x427e71['interaction']['id'],_0xf54fc['body']?JSON[_0xa15d('0x65')](_0xf54fc[_0xa15d('0x55')]):_0xa15d('0x66'));return respondWithRpcPromise(_0xa15d('0x67'),'acceptMessage',_0x427e71);}return null;})[_0xa15d('0x1f')](function(_0x44c448){var _0x1a140f=_0xa15d('0x68')+_0x44c448[_0xa15d('0x26')][_0xa15d('0x69')];return db[_0xa15d('0x6a')][_0xa15d('0x42')](_0x1a140f,{'type':db['Sequelize'][_0xa15d('0x6b')][_0xa15d('0x6c')],'raw':!![]})['then'](function(_0x2c4da5){return _0x2c4da5;});})[_0xa15d('0x1f')](function(_0x542d58){if(_0x542d58){_0x427e71[_0xa15d('0x26')][_0xa15d('0x6d')]=_0x542d58[0x0];if(!_0xf54fc[_0xa15d('0x55')][_0xa15d('0x5e')])return;return db['User'][_0xa15d('0x56')]({'where':{'id':_0xf54fc[_0xa15d('0x55')][_0xa15d('0x5e')],'role':_0xa15d('0x60')},'attributes':['id','name',_0xa15d('0x6e'),_0xa15d('0x6f'),'internal'],'raw':!![]});}return null;})[_0xa15d('0x1f')](function(_0x405a7a){if(!_0x405a7a)return null;_0x427e71['message'][_0xa15d('0x60')]=_0x405a7a;return _0x427e71;})[_0xa15d('0x1f')](function(_0x5384af){if(_0x5384af){if(_0xf54fc[_0xa15d('0x55')][_0xa15d('0x70')]){_0x427e71[_0xa15d('0x26')][_0xa15d('0x71')]=util['format'](_0xa15d('0x72'),_0xf54fc[_0xa15d('0x5f')][_0xa15d('0x37')]);_0x427e71[_0xa15d('0x26')][_0xa15d('0x73')]=_0x427e71[_0xa15d('0x73')];_0x427e71[_0xa15d('0x26')][_0xa15d('0x74')]=_0x427e71[_0xa15d('0x73')];_0x427e71[_0xa15d('0x26')]['event']=_0xa15d('0x59');return respondWithRpcPromise(_0xa15d('0x75'),_0xa15d('0x75'),{'event':_0xa15d('0x76'),'message':_0x427e71[_0xa15d('0x26')]},client9002)[_0xa15d('0x1f')](function(){return _0x427e71;});}return _0x427e71;}return null;})[_0xa15d('0x1f')](respondWithResult(_0xbe32e0,null))['catch'](handleError(_0xbe32e0,null));};var interaction_log=require(_0xa15d('0x13'))(_0xa15d('0x77'));exports[_0xa15d('0x32')]=function(_0x4eac72,_0x3313f4,_0x51b915){var _0x357132={'agent':{},'channel':_0xa15d('0x5a')};if(_0x4eac72['body']['id']){delete _0x4eac72[_0xa15d('0x55')]['id'];}_0x4eac72[_0xa15d('0x55')][_0xa15d('0x5e')]=_0x4eac72[_0xa15d('0x55')][_0xa15d('0x5e')]||_0x4eac72['user']['id'];_0x357132[_0xa15d('0x60')]['id']=_0x4eac72[_0xa15d('0x55')][_0xa15d('0x5e')];return db[_0xa15d('0x3b')][_0xa15d('0x56')]({'where':{'id':_0x4eac72[_0xa15d('0x57')]['id'],'UserId':null}})[_0xa15d('0x1f')](handleEntityNotFound(_0x3313f4,null))[_0xa15d('0x1f')](function(_0x33f9b3){if(_0x33f9b3){_0x357132['message']=_0x33f9b3['get']({'plain':!![]});return db[_0xa15d('0x62')]['find']({'where':{'id':_0x33f9b3[_0xa15d('0x63')]}});}return null;})[_0xa15d('0x1f')](handleEntityNotFound(_0x3313f4,null))[_0xa15d('0x1f')](function(_0x34003d){if(_0x34003d){_0x357132['interaction']=_0x34003d[_0xa15d('0x61')]({'plain':!![]});interaction_log['info'](_0xa15d('0x78'),_0x4eac72[_0xa15d('0x5f')]['id'],_0x4eac72[_0xa15d('0x5f')][_0xa15d('0x37')],_0x4eac72['user']['role'],_0x357132[_0xa15d('0x64')]['id'],_0x4eac72['body']?JSON[_0xa15d('0x65')](_0x4eac72[_0xa15d('0x55')]):_0xa15d('0x66'));return respondWithRpcPromise(_0xa15d('0x79'),_0xa15d('0x7a'),_0x357132);}return null;})[_0xa15d('0x1f')](function(_0x20276b){var _0x10f85e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x20276b['message']['ContactId'];return db['sequelize'][_0xa15d('0x42')](_0x10f85e,{'type':db['Sequelize'][_0xa15d('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x33fcc6){return _0x33fcc6;});})['then'](function(_0x59527c){if(_0x59527c){_0x357132[_0xa15d('0x26')][_0xa15d('0x6d')]=_0x59527c[0x0];if(!_0x4eac72['body'][_0xa15d('0x5e')])return;return db[_0xa15d('0x7b')][_0xa15d('0x56')]({'where':{'id':_0x4eac72['body'][_0xa15d('0x5e')],'role':'agent'},'attributes':['id',_0xa15d('0x37'),_0xa15d('0x6e'),'email',_0xa15d('0x7c')],'raw':!![]});}return null;})[_0xa15d('0x1f')](function(_0x39f0e7){if(!_0x39f0e7)return null;_0x357132[_0xa15d('0x26')][_0xa15d('0x60')]=_0x39f0e7;return _0x357132;})[_0xa15d('0x1f')](function(_0x10f000){if(_0x10f000){_0x10f000[_0xa15d('0x26')][_0xa15d('0x71')]=util['format'](_0xa15d('0x72'),_0x4eac72[_0xa15d('0x5f')]['name']);_0x10f000[_0xa15d('0x26')][_0xa15d('0x73')]=_0x357132[_0xa15d('0x73')];_0x10f000[_0xa15d('0x26')][_0xa15d('0x74')]=_0x357132[_0xa15d('0x73')];_0x10f000['message'][_0xa15d('0x7d')]=_0xa15d('0x32');respondWithRpcPromise(_0xa15d('0x75'),_0xa15d('0x75'),{'event':_0xa15d('0x7e'),'message':_0x10f000[_0xa15d('0x26')]},client9002);return _0x357132;}return null;})[_0xa15d('0x1f')](respondWithResult(_0x3313f4,null))[_0xa15d('0x28')](handleError(_0x3313f4,null));};exports['status']=function(_0x3bc328,_0x434888,_0x3d1f94){if(_0x3bc328['body']['id']){delete _0x3bc328[_0xa15d('0x55')]['id'];}var _0x2def71;return db[_0xa15d('0x3b')][_0xa15d('0x56')]({'where':{'id':_0x3bc328[_0xa15d('0x57')]['id']}})[_0xa15d('0x1f')](handleEntityNotFound(_0x434888,null))[_0xa15d('0x1f')](function(_0x3e3fc3){if(_0x3e3fc3){_0x2def71=_0x3e3fc3;return db[_0xa15d('0x7f')][_0xa15d('0x56')]({'where':{'id':_0x3e3fc3[_0xa15d('0x80')]}});}})[_0xa15d('0x1f')](handleEntityNotFound(_0x434888,null))[_0xa15d('0x1f')](function(_0x37bc7b){if(_0x37bc7b){logger[_0xa15d('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa15d('0x29'),'received\x20delivery\x20report\x20from',_0x37bc7b[_0xa15d('0x3e')],util['inspect'](_0x3bc328[_0xa15d('0x55')],{'showHidden':![],'depth':null}));switch(_0x37bc7b[_0xa15d('0x3e')]){case _0xa15d('0x81'):if(_0x3bc328[_0xa15d('0x55')][_0xa15d('0x82')]&&_0x3bc328[_0xa15d('0x55')]['MessageSid']===_0x2def71[_0xa15d('0x83')]){return _0x2def71[_0xa15d('0x34')]({'read':!![]});}else{logger[_0xa15d('0x25')](_0xa15d('0x84'),_0xa15d('0x29'),_0xa15d('0x81'),util['inspect'](_0x3bc328['body'],{'showHidden':![],'depth':null}));}break;case _0xa15d('0x85'):if(_0x3bc328['body']['MessageUUID']&&_0x3bc328['body']['MessageUUID']===_0x2def71['messageId']&&_[_0xa15d('0x86')](['sent','delivered'],_0x3bc328[_0xa15d('0x55')][_0xa15d('0x87')])>=0x0){return _0x2def71[_0xa15d('0x34')]({'read':!![]});}else{logger[_0xa15d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa15d('0x29'),_0xa15d('0x88'),util[_0xa15d('0x89')](_0x3bc328['body'],{'showHidden':![],'depth':null}));}break;case _0xa15d('0x8a'):var _0x452158=_0x3bc328[_0xa15d('0x55')][_0xa15d('0x8b')][0x0];if(_0x452158[_0xa15d('0x29')][_0xa15d('0x8c')]===_0xa15d('0x8d')){return _0x2def71['update']({'read':!![]});}else{logger[_0xa15d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa15d('0x29'),_0xa15d('0x8a'),util[_0xa15d('0x89')](_0x3bc328[_0xa15d('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2def71;}})[_0xa15d('0x1f')](respondWithResult(_0x434888,null))[_0xa15d('0x28')](handleError(_0x434888,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 02f1d5c..119f764 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 _0xbf91=['hook','exports','events','../../mysqldb','SmsMessage','save','update','remove','hasOwnProperty'];(function(_0x4012af,_0x4b4385){var _0x4dd469=function(_0x13ff5a){while(--_0x13ff5a){_0x4012af['push'](_0x4012af['shift']());}};_0x4dd469(++_0x4b4385);}(_0xbf91,0x14f));var _0x1bf9=function(_0x245e9c,_0x3846b6){_0x245e9c=_0x245e9c-0x0;var _0x423cb0=_0xbf91[_0x245e9c];return _0x423cb0;};'use strict';var EventEmitter=require(_0x1bf9('0x0'));var SmsMessage=require(_0x1bf9('0x1'))['db'][_0x1bf9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bf9('0x3'),'afterUpdate':_0x1bf9('0x4'),'afterDestroy':_0x1bf9('0x5')};function emitEvent(_0x12f0e0){return function(_0x173a11,_0x327231,_0x466e01){SmsMessageEvents['emit'](_0x12f0e0+':'+_0x173a11['id'],_0x173a11);SmsMessageEvents['emit'](_0x12f0e0,_0x173a11);_0x466e01(null);};}for(var e in events){if(events[_0x1bf9('0x6')](e)){var event=events[e];SmsMessage[_0x1bf9('0x7')](e,emitEvent(event));}}module[_0x1bf9('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4227=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4227,0xe9));var _0x7422=function(_0x30364d,_0x5124b4){_0x30364d=_0x30364d-0x0;var _0x56d5fd=_0x4227[_0x30364d];return _0x56d5fd;};'use strict';var EventEmitter=require(_0x7422('0x0'));var SmsMessage=require(_0x7422('0x1'))['db'][_0x7422('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7422('0x3')](0x0);var events={'afterCreate':_0x7422('0x4'),'afterUpdate':'update','afterDestroy':_0x7422('0x5')};function emitEvent(_0xa8e009){return function(_0x570f00,_0x1e0ab1,_0x271f41){SmsMessageEvents['emit'](_0xa8e009+':'+_0x570f00['id'],_0x570f00);SmsMessageEvents[_0x7422('0x6')](_0xa8e009,_0x570f00);_0x271f41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7422('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 637af82..7f2c284 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 _0x2143=['find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','remote','/api/sms/messages/','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','messages','message_id','clickSend','authId','/status?token=','token','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','md5','digest','hex','signature=','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','status','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','error','secret','SmsAccount'];(function(_0x21817b,_0x597793){var _0x43368b=function(_0x4ca6b7){while(--_0x4ca6b7){_0x21817b['push'](_0x21817b['shift']());}};_0x43368b(++_0x597793);}(_0x2143,0x163));var _0x3214=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0x2143[_0x11b8ae];return _0x35a448;};'use strict';var _=require('lodash');var util=require(_0x3214('0x0'));var logger=require(_0x3214('0x1'))('api');var moment=require(_0x3214('0x2'));var BPromise=require(_0x3214('0x3'));var rp=require(_0x3214('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3214('0x5'));var config=require(_0x3214('0x6'));var attributes=require(_0x3214('0x7'));module[_0x3214('0x8')]=function(_0x3976b1,_0x5a97c2){return _0x3976b1[_0x3214('0x9')](_0x3214('0xa'),attributes,{'tableName':_0x3214('0xb'),'paranoid':![],'indexes':[{'name':_0x3214('0xc'),'fields':[_0x3214('0xc')]},{'name':'fti_sms_messages','fields':[_0x3214('0xd')],'type':_0x3214('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d844a,_0x3901a0,_0x272d3c){var _0x2d015e=_0x3976b1[_0x3214('0xf')];var _0x5a7e78=_0x4d844a['get']({'plain':!![]});if(_0x5a7e78[_0x3214('0x10')][_0x3214('0x11')]()==='in'||_0x5a7e78[_0x3214('0x10')]['toLowerCase']()===_0x3214('0x12')&&!_0x5a7e78['secret']&&!_[_0x3214('0x13')](_0x5a7e78[_0x3214('0x14')])&&!_[_0x3214('0x13')](_0x5a7e78['SmsInteractionId'])){_0x2d015e[_0x3214('0x15')][_0x3214('0x16')]({'where':{'id':_0x5a7e78[_0x3214('0x17')]}})[_0x3214('0x18')](function(_0x3d91ce){if(_0x3d91ce){_0x3d91ce['update']({'lastMsgAt':_0x5a7e78[_0x3214('0x19')],'lastMsgDirection':_0x5a7e78[_0x3214('0x10')][_0x3214('0x11')]()});}})['catch'](function(_0x1b00fc){console[_0x3214('0x1a')](_0x1b00fc);});}if(_0x5a7e78[_0x3214('0x10')]==='out'&&!_0x5a7e78[_0x3214('0x1b')]){var _0x3c8c17;_0x2d015e[_0x3214('0x1c')][_0x3214('0x1d')]({'where':{'id':_0x5a7e78[_0x3214('0x1e')]},'raw':!![]})[_0x3214('0x18')](function(_0x22a8a6){_0x3c8c17=_0x22a8a6;if(_0x3c8c17&&_0x3c8c17[_0x3214('0x1f')]){switch(_0x3c8c17[_0x3214('0x1f')]){case _0x3214('0x20'):var _0x4d2456=require(_0x3214('0x20'));if(_0x3c8c17[_0x3214('0x21')]&&_0x3c8c17[_0x3214('0x22')]&&_0x3c8c17['phone']){var _0x50cb86=new _0x4d2456(_0x3c8c17[_0x3214('0x21')],_0x3c8c17['authToken']);_0x50cb86['messages'][_0x3214('0x23')]({'body':_0x5a7e78[_0x3214('0xd')],'to':_0x5a7e78[_0x3214('0x24')],'from':_0x3c8c17[_0x3214('0x24')],'statusCallback':_0x3c8c17[_0x3214('0x25')]+_0x3214('0x26')+_0x5a7e78['id']+'/status?token='+_0x3c8c17['token']})[_0x3214('0x18')](function(_0xfb4016){if(_0xfb4016[_0x3214('0x27')]){return _0x4d844a['update']({'messageId':_0xfb4016[_0x3214('0x27')]});}})[_0x3214('0x28')](function(_0x23f91a){logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x20'),util[_0x3214('0x2a')](_0x23f91a,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3214('0x2c'):var _0x289267=_0x3214('0x2d');if(_0x3c8c17['username']&&_0x3c8c17[_0x3214('0x2e')]){var _0x826760={'recipient':[_0x5a7e78[_0x3214('0x24')]],'message':_0x5a7e78[_0x3214('0xd')],'message_type':_0x3c8c17['smsMethod']};if(_0x3c8c17['smsMethod']&&_0x3c8c17[_0x3214('0x2f')]!=='SI'){_0x826760[_0x3214('0x30')]=_0x3c8c17[_0x3214('0x24')];}var _0x503c0f={'url':_0x289267+_0x3214('0x31')+_0x3c8c17[_0x3214('0x32')]+_0x3214('0x33')+_0x3c8c17['password'],'method':_0x3214('0x34')};rp(_0x503c0f)['then'](function(_0x152686){var _0x384cbc=_0x152686[_0x3214('0x35')](';');var _0x52d708={'user_key':_0x384cbc[0x0],'session_key':_0x384cbc[0x1]};_0x503c0f={'url':_0x289267+_0x3214('0x36'),'method':_0x3214('0x37'),'headers':{'user_key':_0x52d708[_0x3214('0x38')],'Session_key':_0x52d708[_0x3214('0x39')]},'json':!![],'body':_0x826760};return rp(_0x503c0f);})[_0x3214('0x18')](function(_0x428b29){if(_0x428b29['total_sent']>=0x1){var _0x1be688={'messageId':_0x428b29[_0x3214('0x3a')]};if(_0x3c8c17[_0x3214('0x2f')]!=='GP'||!_0x3c8c17[_0x3214('0x3b')]){_0x1be688[_0x3214('0x3c')]=!![];}return _0x4d844a[_0x3214('0x3d')](_0x1be688);}else{return logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x3214('0x2a')](_0x428b29,{'showHidden':![],'depth':null}));}})[_0x3214('0x28')](function(_0x12b046){return logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x2c'),util['inspect'](_0x12b046,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x2c'),_0x3214('0x3e'));}break;case'connectel':if(_0x3c8c17[_0x3214('0x22')]){var _0x5147ef={'recipient':_0x5a7e78[_0x3214('0x24')],'message':_0x5a7e78[_0x3214('0xd')],'sender':_0x3c8c17['senderString']||_0x3c8c17[_0x3214('0x24')],'authorization':_0x3c8c17[_0x3214('0x22')]};var _0x3901a0={'method':_0x3214('0x37'),'uri':_0x3214('0x3f'),'body':_0x5147ef,'json':!![]};rp(_0x3901a0)['then'](function(_0x213c05){var _0x71e0d7={'messageId':_0x213c05[_0x3214('0x40')]};if(!_0x3c8c17[_0x3214('0x3b')]){_0x71e0d7[_0x3214('0x3c')]=!![];}return _0x4d844a[_0x3214('0x3d')](_0x71e0d7);})[_0x3214('0x28')](function(_0x57655f){logger['error'](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x41'),util['inspect'](_0x57655f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),'connectel',_0x3214('0x42'));}break;case'clicksend':if(_0x3c8c17[_0x3214('0x32')]&&_0x3c8c17[_0x3214('0x2e')]){var _0x5147ef={'messages':[{'source':_0x3214('0x43'),'to':_0x5a7e78[_0x3214('0x24')],'body':_0x5a7e78[_0x3214('0xd')],'from':_0x3c8c17[_0x3214('0x44')]||_0x3c8c17['phone']}]};var _0x27ea6a=util['format'](_0x3214('0x45'),_0x3c8c17[_0x3214('0x32')],_0x3c8c17['password']);var _0x3901a0={'method':_0x3214('0x37'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5147ef,'headers':{'Authorization':util['format'](_0x3214('0x46'),new Buffer(_0x27ea6a)[_0x3214('0x47')](_0x3214('0x48')))},'json':!![]};rp(_0x3901a0)[_0x3214('0x18')](function(_0x4a30dd){if(_0x4a30dd['http_code']>=0xc8&&_0x4a30dd[_0x3214('0x49')]<=0xce){if(_0x4a30dd['data']&&_0x4a30dd[_0x3214('0x4a')][_0x3214('0x4b')]>0x0){var _0x29bc93=_['head'](_0x4a30dd['data'][_0x3214('0x4c')]);var _0x1fa4cf={'messageId':_0x29bc93[_0x3214('0x4d')]};if(!_0x3c8c17[_0x3214('0x3b')]){_0x1fa4cf[_0x3214('0x3c')]=!![];}return _0x4d844a[_0x3214('0x3d')](_0x1fa4cf);}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),'afterCreate','clickSend',util[_0x3214('0x2a')](_0x4a30dd,{'showHidden':![],'depth':null}));}}else{logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x4e'),util[_0x3214('0x2a')](_0x4a30dd,{'showHidden':![],'depth':null}));}})[_0x3214('0x28')](function(_0x29c11d){logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x4e'),util[_0x3214('0x2a')](_0x29c11d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3c8c17[_0x3214('0x4f')]&&_0x3c8c17[_0x3214('0x22')]){var _0x5147ef={'dst':_0x5a7e78[_0x3214('0x24')],'text':_0x5a7e78[_0x3214('0xd')],'src':_0x3c8c17[_0x3214('0x44')]||_0x3c8c17['phone'],'url':_0x3c8c17['remote']+_0x3214('0x26')+_0x5a7e78['id']+_0x3214('0x50')+_0x3c8c17[_0x3214('0x51')]};var _0x27ea6a=util[_0x3214('0x52')]('%s:%s',_0x3c8c17['authId'],_0x3c8c17[_0x3214('0x22')]);var _0x3901a0={'method':_0x3214('0x37'),'uri':util['format'](_0x3214('0x53'),_0x3c8c17[_0x3214('0x4f')]),'body':_0x5147ef,'headers':{'Authorization':util['format'](_0x3214('0x46'),new Buffer(_0x27ea6a)['toString'](_0x3214('0x48')))},'json':!![]};rp(_0x3901a0)[_0x3214('0x18')](function(_0x11180d){var _0x38f8d8={'messageId':_0x11180d[_0x3214('0x54')][0x0]};return _0x4d844a[_0x3214('0x3d')](_0x38f8d8);})[_0x3214('0x28')](function(_0x403cea){logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x55'),util[_0x3214('0x2a')](_0x403cea,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x55'),_0x3214('0x56'));}break;case _0x3214('0x57'):if(_0x3c8c17[_0x3214('0x32')]&&_0x3c8c17[_0x3214('0x2e')]){if(_0x3c8c17[_0x3214('0x58')]){var _0x2190f6={'method':_0x3214('0x37'),'uri':_0x3c8c17[_0x3214('0x58')]+_0x3214('0x59'),'body':{'username':_0x3c8c17[_0x3214('0x32')],'password':_0x3c8c17['password']},'json':!![]};return rp(_0x2190f6)[_0x3214('0x18')](function(_0x55958e){var _0x32f87e={'method':'POST','uri':_0x3c8c17[_0x3214('0x58')]+_0x3214('0x5a'),'body':{'messages':[{'from':_0x3c8c17['phone'],'destinations':[{'to':_0x5a7e78[_0x3214('0x24')]}],'text':_0x5a7e78[_0x3214('0xd')],'notifyUrl':_0x3c8c17[_0x3214('0x25')]+'/api/sms/messages/'+_0x5a7e78['id']+'/status?token='+_0x3c8c17[_0x3214('0x51')],'notifyContentType':'application/json','callbackData':_0x3c8c17[_0x3214('0x24')]+';'+_0x5a7e78[_0x3214('0xd')]}]},'headers':{'Authorization':_0x3214('0x5b')+_0x55958e[_0x3214('0x51')]},'json':!![]};return rp(_0x32f87e)[_0x3214('0x18')](function(_0x2e1acb){if(_0x2e1acb[_0x3214('0x4c')]){var _0x3d5a62={'messageId':_0x2e1acb[_0x3214('0x4c')][0x0][_0x3214('0xc')]};if(!_0x3c8c17[_0x3214('0x3b')]){_0x3d5a62[_0x3214('0x3c')]=!![];}return _0x4d844a['update'](_0x3d5a62);}else{return logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x57'),util[_0x3214('0x2a')](_0x2e1acb,{'showHidden':![],'depth':null}));}});})[_0x3214('0x28')](function(_0x17e3e5){return logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x57'),util['inspect'](_0x17e3e5,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),'infobip',_0x3214('0x5c'));}}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3214('0x5d'):var _0x1e5970=require('crypto');if(_0x3c8c17[_0x3214('0x5e')]){var _0x42cb1b={};_0x42cb1b[_0x3214('0x5f')]=_0x3c8c17['username'];_0x42cb1b[_0x3214('0x24')]=_0x5a7e78[_0x3214('0x24')];_0x42cb1b['sender']=_0x3c8c17[_0x3214('0x24')];_0x42cb1b[_0x3214('0x60')]=_0x5a7e78[_0x3214('0xd')];_0x42cb1b[_0x3214('0x61')]=+new Date();var _0xf30f74='';var _0x5f32fb='';var _0x25cc90=Object['keys'](_0x42cb1b);_0x25cc90[_0x3214('0x62')]();for(var _0xb16d39=0x0;_0xb16d39<_0x25cc90[_0x3214('0x63')];_0xb16d39++){if(_0xf30f74!=''){_0xf30f74+='&';}_0xf30f74+=_0x25cc90[_0xb16d39]+'='+encodeURIComponent(_0x42cb1b[_0x25cc90[_0xb16d39]]);_0x5f32fb+=_0x42cb1b[_0x25cc90[_0xb16d39]];}_0x5f32fb+=_0x3c8c17[_0x3214('0x5e')];_0x5f32fb=_0x1e5970['createHash'](_0x3214('0x64'))['update'](_0x5f32fb)[_0x3214('0x65')](_0x3214('0x66'));if(_0xf30f74!==''){_0xf30f74+='&';}_0xf30f74+=_0x3214('0x67')+_0x5f32fb;var _0x503c0f={'method':_0x3214('0x34'),'uri':_0x3c8c17[_0x3214('0x58')]+_0x3214('0x68')+_0xf30f74,'json':!![]};return rp(_0x503c0f)['then'](function(_0x4d44dc){var _0x11f2cf=Object[_0x3214('0x69')](_0x4d44dc);if(_0x4d44dc[_0x11f2cf[0x0]]['error']&&parseInt(_0x4d44dc[_0x11f2cf[0x0]][_0x3214('0x1a')])===0x0){var _0x122d5b={'messageId':_0x4d44dc[_0x11f2cf[0x0]]['id_sms']};if(!_0x3c8c17[_0x3214('0x3b')]){_0x122d5b['read']=!![];}return _0x4d844a[_0x3214('0x3d')](_0x122d5b);}else{return logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x5d'),util[_0x3214('0x2a')](_0x4d44dc['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x138bdc){return logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x5d'),util[_0x3214('0x2a')](_0x138bdc,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x5d'),_0x3214('0x6a'));}break;case _0x3214('0x6b'):if(_0x3c8c17[_0x3214('0x5e')]){var _0x128312={'method':'POST','uri':_0x3214('0x6c'),'headers':{'Authorization':_0x3c8c17[_0x3214('0x5e')]},'body':{'content':_0x5a7e78[_0x3214('0xd')],'to':[_0x5a7e78[_0x3214('0x24')]],'from':_0x3c8c17[_0x3214('0x24')],'binary':![],'clientMessageId':_0x3214('0x6d'),'charset':_0x3214('0x6e')},'json':!![]};rp(_0x128312)[_0x3214('0x18')](function(_0x43103e){if(!_0x43103e[_0x3214('0x1a')]){var _0x49559d={'messageId':_0x43103e[_0x3214('0x4c')][0x0][_0x3214('0x6f')]};if(!_0x3c8c17[_0x3214('0x3b')]){_0x49559d[_0x3214('0x3c')]=!![];}return _0x4d844a[_0x3214('0x3d')](_0x49559d);}else{return logger['error'](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x6b'),util[_0x3214('0x2a')](_0x43103e[_0x3214('0x1a')],{'showHidden':![],'depth':null}));}})[_0x3214('0x28')](function(_0x5752ee){return logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),'clickatell',util[_0x3214('0x2a')](_0x5752ee,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x6b'),_0x3214('0x6a'));}break;case _0x3214('0x70'):if(_0x3c8c17[_0x3214('0x32')]&&_0x3c8c17[_0x3214('0x2e')]){var _0x27ea6a=util[_0x3214('0x52')]('%s:%s',_0x3c8c17[_0x3214('0x32')],_0x3c8c17[_0x3214('0x2e')]);var _0x3901a0={'method':_0x3214('0x37'),'uri':_0x3214('0x71')+_0x3c8c17[_0x3214('0x72')]+_0x3214('0x73'),'body':{'to':[_0x5a7e78['phone']],'text':_0x5a7e78[_0x3214('0xd')],'from':_0x3c8c17[_0x3214('0x24')],'applicationId':_0x3c8c17[_0x3214('0x74')]},'headers':{'Authorization':util[_0x3214('0x52')]('Basic\x20%s',new Buffer(_0x27ea6a)[_0x3214('0x47')](_0x3214('0x48')))},'json':!![]};rp(_0x3901a0)[_0x3214('0x18')](function(_0x4c2f2f){if(_0x4c2f2f['id']){var _0x4f65e9={'messageId':_0x4c2f2f['id']};return _0x4d844a[_0x3214('0x3d')](_0x4f65e9);}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),_0x3214('0x70'),util[_0x3214('0x2a')](_0x4c2f2f,{'showHidden':![],'depth':null}));}})[_0x3214('0x28')](function(_0x20b955){logger[_0x3214('0x1a')](_0x3214('0x2b'),'afterCreate',_0x3214('0x70'),util[_0x3214('0x2a')](_0x20b955,{'showHidden':![],'depth':null}));});}else{logger[_0x3214('0x1a')](_0x3214('0x2b'),'afterCreate','bandwidth',_0x3214('0x3e'));}break;case'intelepeer':if(_0x3c8c17['apiKey']){var _0x2d21e4={};var _0x503c0f={'method':'POST','uri':_0x3214('0x75'),'headers':{'Authorization':_0x3214('0x76')+_0x3c8c17[_0x3214('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x3c8c17['phone'],'to':_0x5a7e78[_0x3214('0x24')],'text':_0x5a7e78[_0x3214('0xd')]},'json':!![]};return rp(_0x503c0f)[_0x3214('0x18')](function(_0x4b70eb){if(_0x4b70eb['code']==0xca){_0x2d21e4[_0x3214('0x77')]=_0x4b70eb;var _0x5e0b53={'method':_0x3214('0x37'),'uri':_0x3214('0x78'),'headers':{'Authorization':_0x3214('0x76')+_0x3c8c17[_0x3214('0x5e')],'Content-Type':_0x3214('0x79')},'body':{'refid':_0x2d21e4[_0x3214('0x77')]['refid']},'json':!![]};return rp(_0x5e0b53)[_0x3214('0x18')](function(_0x20f269){_0x2d21e4[_0x3214('0x7a')]=_0x20f269;var _0x712e63={'messageId':_0x2d21e4[_0x3214('0x77')][_0x3214('0x7b')],'read':!![]};return _0x4d844a['update'](_0x712e63);});}else{return logger[_0x3214('0x1a')](_0x3214('0x2b'),_0x3214('0x29'),'intelepeer',util['inspect'](_0x4b70eb,{'showHidden':![],'depth':null}));}})[_0x3214('0x28')](function(_0x4526a0){return logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x7c'),util['inspect'](_0x4526a0,{'showHidden':![],'depth':null}));});}else{return logger[_0x3214('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3214('0x29'),_0x3214('0x7c'),'Token\x20not\x20received');}break;}}})[_0x3214('0x7d')](function(){_0x272d3c();});}else{_0x272d3c();}}},'charset':_0x3214('0x7e'),'collate':_0x3214('0x7f')});}; \ No newline at end of file +var _0xadc4=['/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','api','request-promise','path','rimraf','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','login?username=','username','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','clickSend','plivo','authId','token','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','csc','crypto','apiKey','login','sender','text','timestamp','length','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadc4,0x82));var _0x4adc=function(_0x20f841,_0x1c2da7){_0x20f841=_0x20f841-0x0;var _0x3264c6=_0xadc4[_0x20f841];return _0x3264c6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4adc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4adc('0x1'));var fs=require('fs');var path=require(_0x4adc('0x2'));var rimraf=require(_0x4adc('0x3'));var config=require('../../config/environment');var attributes=require(_0x4adc('0x4'));module[_0x4adc('0x5')]=function(_0xa442ed,_0x500e24){return _0xa442ed['define']('SmsMessage',attributes,{'tableName':_0x4adc('0x6'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x4adc('0x7')]},{'name':_0x4adc('0x8'),'fields':['body'],'type':_0x4adc('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3df003,_0x4bc52f,_0x5eb5ff){var _0x430957=_0xa442ed[_0x4adc('0xa')];var _0x5c007c=_0x3df003['get']({'plain':!![]});if(_0x5c007c[_0x4adc('0xb')][_0x4adc('0xc')]()==='in'||_0x5c007c[_0x4adc('0xb')][_0x4adc('0xc')]()===_0x4adc('0xd')&&!_0x5c007c[_0x4adc('0xe')]&&!_[_0x4adc('0xf')](_0x5c007c['UserId'])&&!_[_0x4adc('0xf')](_0x5c007c[_0x4adc('0x10')])){_0x430957[_0x4adc('0x11')][_0x4adc('0x12')]({'where':{'id':_0x5c007c[_0x4adc('0x10')]}})[_0x4adc('0x13')](function(_0x406c0b){if(_0x406c0b){_0x406c0b[_0x4adc('0x14')]({'lastMsgAt':_0x5c007c[_0x4adc('0x15')],'lastMsgDirection':_0x5c007c[_0x4adc('0xb')][_0x4adc('0xc')]()});}})[_0x4adc('0x16')](function(_0x54759c){console[_0x4adc('0x17')](_0x54759c);});}if(_0x5c007c['direction']===_0x4adc('0xd')&&!_0x5c007c[_0x4adc('0xe')]){var _0x4335e3;_0x430957[_0x4adc('0x18')][_0x4adc('0x19')]({'where':{'id':_0x5c007c['SmsAccountId']},'raw':!![]})[_0x4adc('0x13')](function(_0x2df093){_0x4335e3=_0x2df093;if(_0x4335e3&&_0x4335e3[_0x4adc('0x1a')]){switch(_0x4335e3[_0x4adc('0x1a')]){case _0x4adc('0x1b'):var _0x938540=require(_0x4adc('0x1b'));if(_0x4335e3[_0x4adc('0x1c')]&&_0x4335e3[_0x4adc('0x1d')]&&_0x4335e3[_0x4adc('0x1e')]){var _0x578477=new _0x938540(_0x4335e3[_0x4adc('0x1c')],_0x4335e3['authToken']);_0x578477[_0x4adc('0x1f')][_0x4adc('0x20')]({'body':_0x5c007c[_0x4adc('0x21')],'to':_0x5c007c[_0x4adc('0x1e')],'from':_0x4335e3['phone'],'statusCallback':_0x4335e3[_0x4adc('0x22')]+_0x4adc('0x23')+_0x5c007c['id']+_0x4adc('0x24')+_0x4335e3['token']})['then'](function(_0x22d288){if(_0x22d288[_0x4adc('0x25')]){return _0x3df003[_0x4adc('0x14')]({'messageId':_0x22d288[_0x4adc('0x25')]});}})[_0x4adc('0x16')](function(_0x6cfaab){logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4adc('0x1b'),util['inspect'](_0x6cfaab,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x1b'),_0x4adc('0x28'));}break;case _0x4adc('0x29'):var _0x2b493a='https://api.skebby.it/API/v1.0/REST/';if(_0x4335e3['username']&&_0x4335e3[_0x4adc('0x2a')]){var _0x235beb={'recipient':[_0x5c007c[_0x4adc('0x1e')]],'message':_0x5c007c[_0x4adc('0x21')],'message_type':_0x4335e3['smsMethod']};if(_0x4335e3[_0x4adc('0x2b')]&&_0x4335e3[_0x4adc('0x2b')]!=='SI'){_0x235beb['sender']=_0x4335e3[_0x4adc('0x1e')];}var _0x2be556={'url':_0x2b493a+_0x4adc('0x2c')+_0x4335e3[_0x4adc('0x2d')]+_0x4adc('0x2e')+_0x4335e3['password'],'method':_0x4adc('0x2f')};rp(_0x2be556)[_0x4adc('0x13')](function(_0x2ba723){var _0x34c1a6=_0x2ba723[_0x4adc('0x30')](';');var _0x50d053={'user_key':_0x34c1a6[0x0],'session_key':_0x34c1a6[0x1]};_0x2be556={'url':_0x2b493a+'sms','method':_0x4adc('0x31'),'headers':{'user_key':_0x50d053[_0x4adc('0x32')],'Session_key':_0x50d053[_0x4adc('0x33')]},'json':!![],'body':_0x235beb};return rp(_0x2be556);})['then'](function(_0xdce6a9){if(_0xdce6a9[_0x4adc('0x34')]>=0x1){var _0x323b06={'messageId':_0xdce6a9[_0x4adc('0x35')]};if(_0x4335e3[_0x4adc('0x2b')]!=='GP'||!_0x4335e3['deliveryReport']){_0x323b06[_0x4adc('0x36')]=!![];}return _0x3df003[_0x4adc('0x14')](_0x323b06);}else{return logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),'skebby',util[_0x4adc('0x37')](_0xdce6a9,{'showHidden':![],'depth':null}));}})[_0x4adc('0x16')](function(_0x43740c){return logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),'skebby',util[_0x4adc('0x37')](_0x43740c,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),'skebby',_0x4adc('0x38'));}break;case _0x4adc('0x39'):if(_0x4335e3['authToken']){var _0x4cce1e={'recipient':_0x5c007c['phone'],'message':_0x5c007c[_0x4adc('0x21')],'sender':_0x4335e3[_0x4adc('0x3a')]||_0x4335e3['phone'],'authorization':_0x4335e3[_0x4adc('0x1d')]};var _0x4bc52f={'method':'POST','uri':_0x4adc('0x3b'),'body':_0x4cce1e,'json':!![]};rp(_0x4bc52f)[_0x4adc('0x13')](function(_0x25b730){var _0x364675={'messageId':_0x25b730[_0x4adc('0x3c')]};if(!_0x4335e3[_0x4adc('0x3d')]){_0x364675['read']=!![];}return _0x3df003[_0x4adc('0x14')](_0x364675);})[_0x4adc('0x16')](function(_0x42af71){logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x39'),util['inspect'](_0x42af71,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x39'),_0x4adc('0x3e'));}break;case'clicksend':if(_0x4335e3['username']&&_0x4335e3[_0x4adc('0x2a')]){var _0x4cce1e={'messages':[{'source':'xCALLY\x20Motion','to':_0x5c007c['phone'],'body':_0x5c007c[_0x4adc('0x21')],'from':_0x4335e3[_0x4adc('0x3a')]||_0x4335e3[_0x4adc('0x1e')]}]};var _0x14a4a0=util[_0x4adc('0x3f')]('%s:%s',_0x4335e3[_0x4adc('0x2d')],_0x4335e3[_0x4adc('0x2a')]);var _0x4bc52f={'method':_0x4adc('0x31'),'uri':_0x4adc('0x40'),'body':_0x4cce1e,'headers':{'Authorization':util['format'](_0x4adc('0x41'),new Buffer(_0x14a4a0)[_0x4adc('0x42')](_0x4adc('0x43')))},'json':!![]};rp(_0x4bc52f)[_0x4adc('0x13')](function(_0xf53bed){if(_0xf53bed[_0x4adc('0x44')]>=0xc8&&_0xf53bed[_0x4adc('0x44')]<=0xce){if(_0xf53bed[_0x4adc('0x45')]&&_0xf53bed[_0x4adc('0x45')]['queued_count']>0x0){var _0x312c4c=_[_0x4adc('0x46')](_0xf53bed[_0x4adc('0x45')][_0x4adc('0x1f')]);var _0x5d6218={'messageId':_0x312c4c['message_id']};if(!_0x4335e3[_0x4adc('0x3d')]){_0x5d6218[_0x4adc('0x36')]=!![];}return _0x3df003[_0x4adc('0x14')](_0x5d6218);}else{logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x47'),util[_0x4adc('0x37')](_0xf53bed,{'showHidden':![],'depth':null}));}}else{logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),_0x4adc('0x47'),util[_0x4adc('0x37')](_0xf53bed,{'showHidden':![],'depth':null}));}})[_0x4adc('0x16')](function(_0x21f808){logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x47'),util['inspect'](_0x21f808,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x47'),_0x4adc('0x38'));}break;case _0x4adc('0x48'):if(_0x4335e3[_0x4adc('0x49')]&&_0x4335e3[_0x4adc('0x1d')]){var _0x4cce1e={'dst':_0x5c007c['phone'],'text':_0x5c007c['body'],'src':_0x4335e3['senderString']||_0x4335e3[_0x4adc('0x1e')],'url':_0x4335e3['remote']+_0x4adc('0x23')+_0x5c007c['id']+'/status?token='+_0x4335e3[_0x4adc('0x4a')]};var _0x14a4a0=util['format'](_0x4adc('0x4b'),_0x4335e3[_0x4adc('0x49')],_0x4335e3['authToken']);var _0x4bc52f={'method':_0x4adc('0x31'),'uri':util[_0x4adc('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4335e3[_0x4adc('0x49')]),'body':_0x4cce1e,'headers':{'Authorization':util['format'](_0x4adc('0x41'),new Buffer(_0x14a4a0)[_0x4adc('0x42')](_0x4adc('0x43')))},'json':!![]};rp(_0x4bc52f)[_0x4adc('0x13')](function(_0x1d9969){var _0x225977={'messageId':_0x1d9969[_0x4adc('0x4c')][0x0]};return _0x3df003['update'](_0x225977);})[_0x4adc('0x16')](function(_0x281e34){logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x48'),util[_0x4adc('0x37')](_0x281e34,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x48'),_0x4adc('0x4d'));}break;case'infobip':if(_0x4335e3[_0x4adc('0x2d')]&&_0x4335e3[_0x4adc('0x2a')]){if(_0x4335e3['baseUrl']){var _0x10a2c2={'method':'POST','uri':_0x4335e3[_0x4adc('0x4e')]+_0x4adc('0x4f'),'body':{'username':_0x4335e3['username'],'password':_0x4335e3['password']},'json':!![]};return rp(_0x10a2c2)['then'](function(_0x2d71d5){var _0x4fa21b={'method':_0x4adc('0x31'),'uri':_0x4335e3[_0x4adc('0x4e')]+_0x4adc('0x50'),'body':{'messages':[{'from':_0x4335e3[_0x4adc('0x1e')],'destinations':[{'to':_0x5c007c[_0x4adc('0x1e')]}],'text':_0x5c007c[_0x4adc('0x21')],'notifyUrl':_0x4335e3[_0x4adc('0x22')]+_0x4adc('0x23')+_0x5c007c['id']+'/status?token='+_0x4335e3[_0x4adc('0x4a')],'notifyContentType':_0x4adc('0x51'),'callbackData':_0x4335e3[_0x4adc('0x1e')]+';'+_0x5c007c['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x2d71d5[_0x4adc('0x4a')]},'json':!![]};return rp(_0x4fa21b)[_0x4adc('0x13')](function(_0x37af23){if(_0x37af23[_0x4adc('0x1f')]){var _0x46d755={'messageId':_0x37af23['messages'][0x0][_0x4adc('0x7')]};if(!_0x4335e3[_0x4adc('0x3d')]){_0x46d755[_0x4adc('0x36')]=!![];}return _0x3df003[_0x4adc('0x14')](_0x46d755);}else{return logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x52'),util['inspect'](_0x37af23,{'showHidden':![],'depth':null}));}});})[_0x4adc('0x16')](function(_0x1604f5){return logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x52'),util[_0x4adc('0x37')](_0x1604f5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),'infobip',_0x4adc('0x38'));}break;case _0x4adc('0x53'):var _0x44bde6=require(_0x4adc('0x54'));if(_0x4335e3[_0x4adc('0x55')]){var _0x1f1ff1={};_0x1f1ff1[_0x4adc('0x56')]=_0x4335e3[_0x4adc('0x2d')];_0x1f1ff1[_0x4adc('0x1e')]=_0x5c007c[_0x4adc('0x1e')];_0x1f1ff1[_0x4adc('0x57')]=_0x4335e3[_0x4adc('0x1e')];_0x1f1ff1[_0x4adc('0x58')]=_0x5c007c[_0x4adc('0x21')];_0x1f1ff1[_0x4adc('0x59')]=+new Date();var _0x5663e7='';var _0x55aff6='';var _0x15ca43=Object['keys'](_0x1f1ff1);_0x15ca43['sort']();for(var _0x10e4b0=0x0;_0x10e4b0<_0x15ca43[_0x4adc('0x5a')];_0x10e4b0++){if(_0x5663e7!=''){_0x5663e7+='&';}_0x5663e7+=_0x15ca43[_0x10e4b0]+'='+encodeURIComponent(_0x1f1ff1[_0x15ca43[_0x10e4b0]]);_0x55aff6+=_0x1f1ff1[_0x15ca43[_0x10e4b0]];}_0x55aff6+=_0x4335e3[_0x4adc('0x55')];_0x55aff6=_0x44bde6['createHash'](_0x4adc('0x5b'))['update'](_0x55aff6)[_0x4adc('0x5c')](_0x4adc('0x5d'));if(_0x5663e7!==''){_0x5663e7+='&';}_0x5663e7+=_0x4adc('0x5e')+_0x55aff6;var _0x2be556={'method':_0x4adc('0x2f'),'uri':_0x4335e3[_0x4adc('0x4e')]+'/external/get/send.php?'+_0x5663e7,'json':!![]};return rp(_0x2be556)[_0x4adc('0x13')](function(_0x21a5ee){var _0x3875f6=Object[_0x4adc('0x5f')](_0x21a5ee);if(_0x21a5ee[_0x3875f6[0x0]]['error']&&parseInt(_0x21a5ee[_0x3875f6[0x0]]['error'])===0x0){var _0x13a2d8={'messageId':_0x21a5ee[_0x3875f6[0x0]][_0x4adc('0x60')]};if(!_0x4335e3['deliveryReport']){_0x13a2d8[_0x4adc('0x36')]=!![];}return _0x3df003[_0x4adc('0x14')](_0x13a2d8);}else{return logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x53'),util[_0x4adc('0x37')](_0x21a5ee[_0x4adc('0x17')],{'showHidden':![],'depth':null}));}})[_0x4adc('0x16')](function(_0x5c92f1){return logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x53'),util[_0x4adc('0x37')](_0x5c92f1,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x53'),_0x4adc('0x61'));}break;case _0x4adc('0x62'):if(_0x4335e3['apiKey']){var _0x519837={'method':'POST','uri':_0x4adc('0x63'),'headers':{'Authorization':_0x4335e3[_0x4adc('0x55')]},'body':{'content':_0x5c007c[_0x4adc('0x21')],'to':[_0x5c007c[_0x4adc('0x1e')]],'from':_0x4335e3['phone'],'binary':![],'clientMessageId':_0x4adc('0x64'),'charset':_0x4adc('0x65')},'json':!![]};rp(_0x519837)[_0x4adc('0x13')](function(_0x487835){if(!_0x487835[_0x4adc('0x17')]){var _0x11ed05={'messageId':_0x487835[_0x4adc('0x1f')][0x0][_0x4adc('0x66')]};if(!_0x4335e3[_0x4adc('0x3d')]){_0x11ed05[_0x4adc('0x36')]=!![];}return _0x3df003[_0x4adc('0x14')](_0x11ed05);}else{return logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),'clickatell',util[_0x4adc('0x37')](_0x487835[_0x4adc('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1b8d4d){return logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x4adc('0x37')](_0x1b8d4d,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x62'),_0x4adc('0x61'));}break;case _0x4adc('0x67'):if(_0x4335e3['username']&&_0x4335e3[_0x4adc('0x2a')]){var _0x14a4a0=util[_0x4adc('0x3f')]('%s:%s',_0x4335e3['username'],_0x4335e3[_0x4adc('0x2a')]);var _0x4bc52f={'method':_0x4adc('0x31'),'uri':_0x4adc('0x68')+_0x4335e3[_0x4adc('0x69')]+_0x4adc('0x6a'),'body':{'to':[_0x5c007c[_0x4adc('0x1e')]],'text':_0x5c007c['body'],'from':_0x4335e3['phone'],'applicationId':_0x4335e3['applicationId']},'headers':{'Authorization':util[_0x4adc('0x3f')](_0x4adc('0x41'),new Buffer(_0x14a4a0)[_0x4adc('0x42')](_0x4adc('0x43')))},'json':!![]};rp(_0x4bc52f)[_0x4adc('0x13')](function(_0x2fa4ad){if(_0x2fa4ad['id']){var _0x54c8f6={'messageId':_0x2fa4ad['id']};return _0x3df003[_0x4adc('0x14')](_0x54c8f6);}else{logger['error'](_0x4adc('0x26'),_0x4adc('0x27'),_0x4adc('0x67'),util[_0x4adc('0x37')](_0x2fa4ad,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5806d9){logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),_0x4adc('0x67'),util[_0x4adc('0x37')](_0x5806d9,{'showHidden':![],'depth':null}));});}else{logger[_0x4adc('0x17')](_0x4adc('0x26'),'afterCreate','bandwidth',_0x4adc('0x38'));}break;case _0x4adc('0x6b'):if(_0x4335e3[_0x4adc('0x55')]){var _0x5baefb={};var _0x2be556={'method':_0x4adc('0x31'),'uri':_0x4adc('0x6c'),'headers':{'Authorization':_0x4adc('0x6d')+_0x4335e3['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x4335e3['phone'],'to':_0x5c007c[_0x4adc('0x1e')],'text':_0x5c007c[_0x4adc('0x21')]},'json':!![]};return rp(_0x2be556)[_0x4adc('0x13')](function(_0x5b06d0){if(_0x5b06d0[_0x4adc('0x6e')]==0xca){_0x5baefb[_0x4adc('0x6f')]=_0x5b06d0;var _0x4e7552={'method':_0x4adc('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4adc('0x6d')+_0x4335e3[_0x4adc('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x5baefb[_0x4adc('0x6f')][_0x4adc('0x70')]},'json':!![]};return rp(_0x4e7552)[_0x4adc('0x13')](function(_0x2894d8){_0x5baefb[_0x4adc('0x71')]=_0x2894d8;var _0x428d2b={'messageId':_0x5baefb[_0x4adc('0x6f')]['refid'],'read':!![]};return _0x3df003['update'](_0x428d2b);});}else{return logger[_0x4adc('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),_0x4adc('0x6b'),util['inspect'](_0x5b06d0,{'showHidden':![],'depth':null}));}})[_0x4adc('0x16')](function(_0x930cb8){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4adc('0x27'),_0x4adc('0x6b'),util[_0x4adc('0x37')](_0x930cb8,{'showHidden':![],'depth':null}));});}else{return logger[_0x4adc('0x17')](_0x4adc('0x26'),_0x4adc('0x27'),'intelepeer',_0x4adc('0x72'));}break;}}})[_0x4adc('0x73')](function(){_0x5eb5ff();});}else{_0x5eb5ff();}}},'charset':_0x4adc('0x74'),'collate':_0x4adc('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 18bbdfd..be8c2d5 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 _0x7eee=['redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xc32056,_0x3c8455){var _0x56e04f=function(_0x515a6a){while(--_0x515a6a){_0xc32056['push'](_0xc32056['shift']());}};_0x56e04f(++_0x3c8455);}(_0x7eee,0x13f));var _0xe7ee=function(_0x9b8427,_0x400bfc){_0x9b8427=_0x9b8427-0x0;var _0x4e3711=_0x7eee[_0x9b8427];return _0x4e3711;};'use strict';var _=require(_0xe7ee('0x0'));var util=require(_0xe7ee('0x1'));var moment=require('moment');var BPromise=require(_0xe7ee('0x2'));var rs=require(_0xe7ee('0x3'));var fs=require('fs');var Redis=require(_0xe7ee('0x4'));var db=require(_0xe7ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7ee('0x6'))(_0xe7ee('0x7'));var config=require(_0xe7ee('0x8'));var jayson=require(_0xe7ee('0x9'));var client=jayson['client'][_0xe7ee('0xa')]({'port':0x232a});config[_0xe7ee('0xb')]=_[_0xe7ee('0xc')](config[_0xe7ee('0xb')],{'host':_0xe7ee('0xd'),'port':0x18eb});var socket=require(_0xe7ee('0xe'))(new Redis(config[_0xe7ee('0xb')]));require(_0xe7ee('0xf'))['register'](socket);function respondWithRpcPromise(_0x444c3d,_0x61df02,_0x22e8b7){return new BPromise(function(_0x3a1294,_0x39d9ff){return client['request'](_0x444c3d,_0x22e8b7)[_0xe7ee('0x10')](function(_0x21f239){logger['info'](_0xe7ee('0x11'),_0x61df02,_0xe7ee('0x12'));logger[_0xe7ee('0x13')](_0xe7ee('0x14'),_0x61df02,_0xe7ee('0x12'),JSON[_0xe7ee('0x15')](_0x21f239));if(_0x21f239[_0xe7ee('0x16')]){if(_0x21f239[_0xe7ee('0x16')][_0xe7ee('0x17')]===0x1f4){logger[_0xe7ee('0x16')](_0xe7ee('0x11'),_0x61df02,_0x21f239[_0xe7ee('0x16')][_0xe7ee('0x18')]);return _0x39d9ff(_0x21f239['error'][_0xe7ee('0x18')]);}logger[_0xe7ee('0x16')](_0xe7ee('0x11'),_0x61df02,_0x21f239['error'][_0xe7ee('0x18')]);return _0x3a1294(_0x21f239['error'][_0xe7ee('0x18')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x61df02,_0xe7ee('0x12'));_0x3a1294(_0x21f239[_0xe7ee('0x19')][_0xe7ee('0x18')]);}})[_0xe7ee('0x1a')](function(_0x3f8da4){logger[_0xe7ee('0x16')]('SmsMessage,\x20%s,\x20%s',_0x61df02,_0x3f8da4);_0x39d9ff(_0x3f8da4);});});}exports[_0xe7ee('0x1b')]=function(_0x484b00){var _0x13b56f=this;return new Promise(function(_0x2c3f61,_0x7f5af1){return db[_0xe7ee('0x1c')][_0xe7ee('0x1d')](_0x484b00[_0xe7ee('0x1e')],{'raw':_0x484b00['options']?_0x484b00[_0xe7ee('0x1f')][_0xe7ee('0x20')]===undefined?!![]:![]:!![]})[_0xe7ee('0x10')](function(_0x262ba3){logger['info'](_0xe7ee('0x1b'),_0x484b00);logger[_0xe7ee('0x13')](_0xe7ee('0x1b'),_0x484b00,JSON[_0xe7ee('0x15')](_0x262ba3));_0x2c3f61(_0x262ba3);})[_0xe7ee('0x1a')](function(_0x4808b8){logger[_0xe7ee('0x16')](_0xe7ee('0x1b'),_0x4808b8[_0xe7ee('0x18')],_0x484b00);_0x7f5af1(_0x13b56f['error'](0x1f4,_0x4808b8['message']));});});}; \ No newline at end of file +var _0xfcaa=['rpc','jayson/promise','client','http','redis','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','CreateSmsMessage','SmsMessage','options','raw','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xfcaa,0x1cb));var _0xafca=function(_0x306735,_0x1df060){_0x306735=_0x306735-0x0;var _0x224671=_0xfcaa[_0x306735];return _0x224671;};'use strict';var _=require(_0xafca('0x0'));var util=require('util');var moment=require(_0xafca('0x1'));var BPromise=require('bluebird');var rs=require(_0xafca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafca('0x3'))['db'];var utils=require(_0xafca('0x4'));var logger=require('../../config/logger')(_0xafca('0x5'));var config=require('../../config/environment');var jayson=require(_0xafca('0x6'));var client=jayson[_0xafca('0x7')][_0xafca('0x8')]({'port':0x232a});config[_0xafca('0x9')]=_['defaults'](config[_0xafca('0x9')],{'host':_0xafca('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xafca('0xb'))[_0xafca('0xc')](socket);function respondWithRpcPromise(_0x403f03,_0x210161,_0x1a6acf){return new BPromise(function(_0x4c8cf9,_0x2e5cb3){return client[_0xafca('0xd')](_0x403f03,_0x1a6acf)[_0xafca('0xe')](function(_0x50b6f1){logger['info'](_0xafca('0xf'),_0x210161,'request\x20sent');logger[_0xafca('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x210161,_0xafca('0x11'),JSON[_0xafca('0x12')](_0x50b6f1));if(_0x50b6f1[_0xafca('0x13')]){if(_0x50b6f1[_0xafca('0x13')][_0xafca('0x14')]===0x1f4){logger[_0xafca('0x13')](_0xafca('0xf'),_0x210161,_0x50b6f1['error'][_0xafca('0x15')]);return _0x2e5cb3(_0x50b6f1[_0xafca('0x13')][_0xafca('0x15')]);}logger['error'](_0xafca('0xf'),_0x210161,_0x50b6f1[_0xafca('0x13')][_0xafca('0x15')]);return _0x4c8cf9(_0x50b6f1[_0xafca('0x13')][_0xafca('0x15')]);}else{logger[_0xafca('0x16')](_0xafca('0xf'),_0x210161,_0xafca('0x11'));_0x4c8cf9(_0x50b6f1[_0xafca('0x17')][_0xafca('0x15')]);}})['catch'](function(_0x518348){logger[_0xafca('0x13')](_0xafca('0xf'),_0x210161,_0x518348);_0x2e5cb3(_0x518348);});});}exports[_0xafca('0x18')]=function(_0x1ed34b){var _0x5395e3=this;return new Promise(function(_0x5c9846,_0x14fd24){return db[_0xafca('0x19')]['create'](_0x1ed34b['body'],{'raw':_0x1ed34b['options']?_0x1ed34b[_0xafca('0x1a')][_0xafca('0x1b')]===undefined?!![]:![]:!![]})[_0xafca('0xe')](function(_0x5bc497){logger[_0xafca('0x16')](_0xafca('0x18'),_0x1ed34b);logger[_0xafca('0x10')](_0xafca('0x18'),_0x1ed34b,JSON[_0xafca('0x12')](_0x5bc497));_0x5c9846(_0x5bc497);})[_0xafca('0x1c')](function(_0x338004){logger[_0xafca('0x13')]('CreateSmsMessage',_0x338004[_0xafca('0x15')],_0x1ed34b);_0x14fd24(_0x5395e3[_0xafca('0x13')](0x1f4,_0x338004[_0xafca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fd1731f..f387f11 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 _0x4531=['remove','update','emit','removeListener','register','smsMessage:','./smsMessage.events','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4531,0xb6));var _0x1453=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0x4531[_0x262baa];return _0x4f2257;};'use strict';var SmsMessageEvents=require(_0x1453('0x0'));var events=[_0x1453('0x1'),_0x1453('0x2'),_0x1453('0x3')];function createListener(_0x211fd8,_0x14ee50){return function(_0x23b4d3){_0x14ee50[_0x1453('0x4')](_0x211fd8,_0x23b4d3);};}function removeListener(_0x5ae8df,_0x5c030e){return function(){SmsMessageEvents[_0x1453('0x5')](_0x5ae8df,_0x5c030e);};}exports[_0x1453('0x6')]=function(_0x3ef1f2){for(var _0x65cbfb=0x0,_0x2af141=events['length'];_0x65cbfb<_0x2af141;_0x65cbfb++){var _0x607c8c=events[_0x65cbfb];var _0x5ad976=createListener(_0x1453('0x7')+_0x607c8c,_0x3ef1f2);SmsMessageEvents['on'](_0x607c8c,_0x5ad976);}}; \ No newline at end of file +var _0x1682=['update','emit','removeListener','length','smsMessage:','./smsMessage.events','remove'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1682,0x1e1));var _0x2168=function(_0x3639d8,_0xb47e14){_0x3639d8=_0x3639d8-0x0;var _0x32dbc1=_0x1682[_0x3639d8];return _0x32dbc1;};'use strict';var SmsMessageEvents=require(_0x2168('0x0'));var events=['save',_0x2168('0x1'),_0x2168('0x2')];function createListener(_0xc73080,_0x44a84e){return function(_0x229aaf){_0x44a84e[_0x2168('0x3')](_0xc73080,_0x229aaf);};}function removeListener(_0x134734,_0x5139c3){return function(){SmsMessageEvents[_0x2168('0x4')](_0x134734,_0x5139c3);};}exports['register']=function(_0x1790c1){for(var _0x402bcb=0x0,_0x12bcc0=events[_0x2168('0x5')];_0x402bcb<_0x12bcc0;_0x402bcb++){var _0x55bd33=events[_0x402bcb];var _0xfbf0c7=createListener(_0x2168('0x6')+_0x55bd33,_0x1790c1);SmsMessageEvents['on'](_0x55bd33,_0xfbf0c7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index fb4b813..4d0b1f2 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 _0x428b=['delete','destroy','removeTeams','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x428b,0xb2));var _0xb428=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x428b[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0xb428('0x0'));var path=require(_0xb428('0x1'));var timeout=require(_0xb428('0x2'));var express=require('express');var router=express[_0xb428('0x3')]();var fs_extra=require(_0xb428('0x4'));var auth=require(_0xb428('0x5'));var interaction=require(_0xb428('0x6'));var config=require(_0xb428('0x7'));var controller=require(_0xb428('0x8'));router[_0xb428('0x9')]('/',auth[_0xb428('0xa')](),controller[_0xb428('0xb')]);router[_0xb428('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb428('0xc')]);router['get'](_0xb428('0xd'),auth[_0xb428('0xa')](),controller['show']);router['get'](_0xb428('0xe'),auth[_0xb428('0xa')](),controller[_0xb428('0xf')]);router[_0xb428('0x9')](_0xb428('0x10'),auth[_0xb428('0xa')](),controller[_0xb428('0x11')]);router['get'](_0xb428('0x12'),auth[_0xb428('0xa')](),controller[_0xb428('0x13')]);router['post']('/',auth[_0xb428('0xa')](),controller[_0xb428('0x14')]);router['post'](_0xb428('0x10'),auth['isAuthenticated'](),controller[_0xb428('0x15')]);router[_0xb428('0x16')](_0xb428('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb428('0x17')](_0xb428('0xd'),auth[_0xb428('0xa')](),controller[_0xb428('0x18')]);router[_0xb428('0x19')](_0xb428('0xd'),auth[_0xb428('0xa')](),controller[_0xb428('0x1a')]);router[_0xb428('0x19')](_0xb428('0x10'),auth[_0xb428('0xa')](),controller[_0xb428('0x1b')]);router[_0xb428('0x19')](_0xb428('0x12'),auth[_0xb428('0xa')](),controller['removeAgents']);module[_0xb428('0x1c')]=router; \ No newline at end of file +var _0xa41d=['../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b3b41,_0x107e39){var _0x1e39d1=function(_0x4dead0){while(--_0x4dead0){_0x1b3b41['push'](_0x1b3b41['shift']());}};_0x1e39d1(++_0x107e39);}(_0xa41d,0xad));var _0xda41=function(_0x408358,_0x911a82){_0x408358=_0x408358-0x0;var _0x50cea0=_0xa41d[_0x408358];return _0x50cea0;};'use strict';var multer=require(_0xda41('0x0'));var util=require(_0xda41('0x1'));var path=require(_0xda41('0x2'));var timeout=require(_0xda41('0x3'));var express=require(_0xda41('0x4'));var router=express[_0xda41('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xda41('0x6'));var interaction=require(_0xda41('0x7'));var config=require('../../config/environment');var controller=require(_0xda41('0x8'));router[_0xda41('0x9')]('/',auth[_0xda41('0xa')](),controller[_0xda41('0xb')]);router[_0xda41('0x9')](_0xda41('0xc'),auth[_0xda41('0xa')](),controller['describe']);router['get'](_0xda41('0xd'),auth[_0xda41('0xa')](),controller[_0xda41('0xe')]);router[_0xda41('0x9')]('/:id/members',auth[_0xda41('0xa')](),controller[_0xda41('0xf')]);router[_0xda41('0x9')](_0xda41('0x10'),auth[_0xda41('0xa')](),controller[_0xda41('0x11')]);router[_0xda41('0x9')]('/:id/users',auth[_0xda41('0xa')](),controller[_0xda41('0x12')]);router[_0xda41('0x13')]('/',auth[_0xda41('0xa')](),controller[_0xda41('0x14')]);router['post']('/:id/teams',auth[_0xda41('0xa')](),controller[_0xda41('0x15')]);router[_0xda41('0x13')](_0xda41('0x16'),auth['isAuthenticated'](),controller[_0xda41('0x17')]);router[_0xda41('0x18')](_0xda41('0xd'),auth['isAuthenticated'](),controller[_0xda41('0x19')]);router['delete'](_0xda41('0xd'),auth['isAuthenticated'](),controller[_0xda41('0x1a')]);router['delete'](_0xda41('0x10'),auth[_0xda41('0xa')](),controller[_0xda41('0x1b')]);router[_0xda41('0x1c')](_0xda41('0x16'),auth[_0xda41('0xa')](),controller['removeAgents']);module[_0xda41('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 686afca..f143600 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 _0x262a=['beepall','roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x262a,0x1e2));var _0xa262=function(_0x15ddc9,_0x209223){_0x15ddc9=_0x15ddc9-0x0;var _0x2fc9e8=_0x262a[_0x15ddc9];return _0x2fc9e8;};'use strict';var Sequelize=require(_0xa262('0x0'));module['exports']={'name':{'type':Sequelize[_0xa262('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa262('0x2')](_0xa262('0x3'),_0xa262('0x4'),_0xa262('0x5'))}}; \ No newline at end of file +var _0x87c6=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x31060c,_0x302713){var _0x5e3f63=function(_0x19b53c){while(--_0x19b53c){_0x31060c['push'](_0x31060c['shift']());}};_0x5e3f63(++_0x302713);}(_0x87c6,0x1df));var _0x687c=function(_0x8d3471,_0x3393e3){_0x8d3471=_0x8d3471-0x0;var _0x1d2d06=_0x87c6[_0x8d3471];return _0x1d2d06;};'use strict';var Sequelize=require(_0x687c('0x0'));module[_0x687c('0x1')]={'name':{'type':Sequelize[_0x687c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x687c('0x2')]},'timeout':{'type':Sequelize[_0x687c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x687c('0x4')](_0x687c('0x5'),_0x687c('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b2f0f34..85db943 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x0b0e[_0x47cfa0];return _0x386b1d;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x195e0f,_0x339f4b){var _0x3029d8=function(_0x38e062){while(--_0x38e062){_0x195e0f['push'](_0x195e0f['shift']());}};_0x3029d8(++_0x339f4b);}(_0x2ef3,0xba));var _0x32ef=function(_0x76fd26,_0x1667ea){_0x76fd26=_0x76fd26-0x0;var _0x204ec5=_0x2ef3[_0x76fd26];return _0x204ec5;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ddbd9c0..2f72794 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 _0x219e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x219e,0x13a));var _0xe219=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x219e[_0x2112d4];return _0x434972;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xe219('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe219('0x1')](0x0);var events={'afterCreate':_0xe219('0x2'),'afterUpdate':_0xe219('0x3'),'afterDestroy':_0xe219('0x4')};function emitEvent(_0x4c84e6){return function(_0x3127bf,_0x23e162,_0x1e04e6){SmsQueueEvents[_0xe219('0x5')](_0x4c84e6+':'+_0x3127bf['id'],_0x3127bf);SmsQueueEvents[_0xe219('0x5')](_0x4c84e6,_0x3127bf);_0x1e04e6(null);};}for(var e in events){if(events[_0xe219('0x6')](e)){var event=events[e];SmsQueue[_0xe219('0x7')](e,emitEvent(event));}}module[_0xe219('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd407=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xd407,0xa4));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7d40('0x0'));var SmsQueue=require(_0x7d40('0x1'))['db'][_0x7d40('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7d40('0x3')](0x0);var events={'afterCreate':_0x7d40('0x4'),'afterUpdate':_0x7d40('0x5'),'afterDestroy':_0x7d40('0x6')};function emitEvent(_0x26f91b){return function(_0x5b41d5,_0x238897,_0x45b2ca){SmsQueueEvents[_0x7d40('0x7')](_0x26f91b+':'+_0x5b41d5['id'],_0x5b41d5);SmsQueueEvents['emit'](_0x26f91b,_0x5b41d5);_0x45b2ca(null);};}for(var e in events){if(events[_0x7d40('0x8')](e)){var event=events[e];SmsQueue[_0x7d40('0x9')](e,emitEvent(event));}}module[_0x7d40('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 31d09a8..a052d1a 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 _0xc878=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc878,0x144));var _0x8c87=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xc878[_0x557f5f];return _0x196eba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c87('0x0'))(_0x8c87('0x1'));var moment=require('moment');var BPromise=require(_0x8c87('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c87('0x3'));var rimraf=require(_0x8c87('0x4'));var config=require(_0x8c87('0x5'));var attributes=require(_0x8c87('0x6'));module[_0x8c87('0x7')]=function(_0x9babfb,_0x5a1957){return _0x9babfb['define'](_0x8c87('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c8=['../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4b70cc,_0x1033a8){var _0x5a00af=function(_0x442e67){while(--_0x442e67){_0x4b70cc['push'](_0x4b70cc['shift']());}};_0x5a00af(++_0x1033a8);}(_0x81c8,0x1bf));var _0x881c=function(_0x370f26,_0x2ebdab){_0x370f26=_0x370f26-0x0;var _0x466030=_0x81c8[_0x370f26];return _0x466030;};'use strict';var _=require(_0x881c('0x0'));var util=require(_0x881c('0x1'));var logger=require(_0x881c('0x2'))(_0x881c('0x3'));var moment=require(_0x881c('0x4'));var BPromise=require('bluebird');var rp=require(_0x881c('0x5'));var fs=require('fs');var path=require(_0x881c('0x6'));var rimraf=require(_0x881c('0x7'));var config=require(_0x881c('0x8'));var attributes=require(_0x881c('0x9'));module[_0x881c('0xa')]=function(_0x3e3572,_0x2d1a32){return _0x3e3572[_0x881c('0xb')]('SmsQueue',attributes,{'tableName':_0x881c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 5fec377..5d12a88 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 _0xf503=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','request','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','then','info','GetSmsQueue','ShowSmsQueue','find','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x195260,_0x20db57){var _0x330435=function(_0x22b2df){while(--_0x22b2df){_0x195260['push'](_0x195260['shift']());}};_0x330435(++_0x20db57);}(_0xf503,0x13b));var _0x3f50=function(_0x11ef2d,_0x4da792){_0x11ef2d=_0x11ef2d-0x0;var _0xc17ba0=_0xf503[_0x11ef2d];return _0xc17ba0;};'use strict';var _=require(_0x3f50('0x0'));var util=require('util');var moment=require(_0x3f50('0x1'));var BPromise=require(_0x3f50('0x2'));var rs=require(_0x3f50('0x3'));var fs=require('fs');var Redis=require(_0x3f50('0x4'));var db=require(_0x3f50('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f50('0x6'));var config=require(_0x3f50('0x7'));var jayson=require(_0x3f50('0x8'));var client=jayson[_0x3f50('0x9')][_0x3f50('0xa')]({'port':0x232a});config[_0x3f50('0xb')]=_[_0x3f50('0xc')](config[_0x3f50('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f50('0xd'))(new Redis(config[_0x3f50('0xb')]));require(_0x3f50('0xe'))['register'](socket);function respondWithRpcPromise(_0x5e4a09,_0x2b1f5a,_0x4842fe){return new BPromise(function(_0x386949,_0x71fe46){return client[_0x3f50('0xf')](_0x5e4a09,_0x4842fe)['then'](function(_0x47e32d){logger['info']('SmsQueue,\x20%s,\x20%s',_0x2b1f5a,_0x3f50('0x10'));logger['debug'](_0x3f50('0x11'),_0x2b1f5a,_0x3f50('0x10'),JSON[_0x3f50('0x12')](_0x47e32d));if(_0x47e32d[_0x3f50('0x13')]){if(_0x47e32d['error'][_0x3f50('0x14')]===0x1f4){logger[_0x3f50('0x13')](_0x3f50('0x15'),_0x2b1f5a,_0x47e32d['error']['message']);return _0x71fe46(_0x47e32d[_0x3f50('0x13')][_0x3f50('0x16')]);}logger[_0x3f50('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2b1f5a,_0x47e32d[_0x3f50('0x13')][_0x3f50('0x16')]);return _0x386949(_0x47e32d[_0x3f50('0x13')]['message']);}else{logger['info'](_0x3f50('0x15'),_0x2b1f5a,'request\x20sent');_0x386949(_0x47e32d[_0x3f50('0x17')][_0x3f50('0x16')]);}})[_0x3f50('0x18')](function(_0x52fd73){logger[_0x3f50('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2b1f5a,_0x52fd73);_0x71fe46(_0x52fd73);});});}exports['GetSmsQueue']=function(_0x2b3a2b){var _0x4e3db5=this;return new Promise(function(_0x5dc45b,_0x47c83c){return db[_0x3f50('0x19')]['findAll']({'raw':_0x2b3a2b[_0x3f50('0x1a')]?_0x2b3a2b[_0x3f50('0x1a')][_0x3f50('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b3a2b[_0x3f50('0x1a')]?_0x2b3a2b['options'][_0x3f50('0x1c')]||null:null,'attributes':_0x2b3a2b[_0x3f50('0x1a')]?_0x2b3a2b[_0x3f50('0x1a')][_0x3f50('0x1d')]||null:null,'limit':_0x2b3a2b[_0x3f50('0x1a')]?_0x2b3a2b[_0x3f50('0x1a')][_0x3f50('0x1e')]||null:null,'include':_0x2b3a2b['options']?_0x2b3a2b[_0x3f50('0x1a')][_0x3f50('0x1f')]?_[_0x3f50('0x20')](_0x2b3a2b[_0x3f50('0x1a')][_0x3f50('0x1f')],function(_0x1195f4){return{'model':db[_0x1195f4[_0x3f50('0x21')]],'as':_0x1195f4['as'],'attributes':_0x1195f4[_0x3f50('0x1d')],'include':_0x1195f4[_0x3f50('0x1f')]?_[_0x3f50('0x20')](_0x1195f4[_0x3f50('0x1f')],function(_0x1bcab3){return{'model':db[_0x1bcab3['model']],'as':_0x1bcab3['as'],'attributes':_0x1bcab3[_0x3f50('0x1d')],'include':_0x1bcab3[_0x3f50('0x1f')]?_[_0x3f50('0x20')](_0x1bcab3[_0x3f50('0x1f')],function(_0x5e9249){return{'model':db[_0x5e9249[_0x3f50('0x21')]],'as':_0x5e9249['as'],'attributes':_0x5e9249[_0x3f50('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f50('0x22')](function(_0x4109ba){logger[_0x3f50('0x23')](_0x3f50('0x24'),_0x2b3a2b);logger['debug'](_0x3f50('0x24'),_0x2b3a2b,JSON[_0x3f50('0x12')](_0x4109ba));_0x5dc45b(_0x4109ba);})[_0x3f50('0x18')](function(_0x5e3d12){logger['error']('GetSmsQueue',_0x5e3d12[_0x3f50('0x16')],_0x2b3a2b);_0x47c83c(_0x4e3db5[_0x3f50('0x13')](0x1f4,_0x5e3d12['message']));});});};exports[_0x3f50('0x25')]=function(_0x12a81a){var _0x277c15=this;return new Promise(function(_0x1f5f8c,_0x3dec6f){return db['SmsQueue'][_0x3f50('0x26')]({'raw':_0x12a81a[_0x3f50('0x1a')]?_0x12a81a[_0x3f50('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12a81a[_0x3f50('0x1a')]?_0x12a81a[_0x3f50('0x1a')][_0x3f50('0x1c')]||null:null,'attributes':_0x12a81a['options']?_0x12a81a[_0x3f50('0x1a')][_0x3f50('0x1d')]||null:null,'include':_0x12a81a[_0x3f50('0x1a')]?_0x12a81a[_0x3f50('0x1a')][_0x3f50('0x1f')]?_[_0x3f50('0x20')](_0x12a81a[_0x3f50('0x1a')][_0x3f50('0x1f')],function(_0x46c51b){return{'model':db[_0x46c51b[_0x3f50('0x21')]],'as':_0x46c51b['as'],'attributes':_0x46c51b[_0x3f50('0x1d')],'include':_0x46c51b[_0x3f50('0x1f')]?_['map'](_0x46c51b['include'],function(_0x1c883a){return{'model':db[_0x1c883a[_0x3f50('0x21')]],'as':_0x1c883a['as'],'attributes':_0x1c883a[_0x3f50('0x1d')],'include':_0x1c883a[_0x3f50('0x1f')]?_[_0x3f50('0x20')](_0x1c883a['include'],function(_0x3a4325){return{'model':db[_0x3a4325[_0x3f50('0x21')]],'as':_0x3a4325['as'],'attributes':_0x3a4325[_0x3f50('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f50('0x22')](function(_0x432fc1){logger['info'](_0x3f50('0x25'),_0x12a81a);logger[_0x3f50('0x27')](_0x3f50('0x25'),_0x12a81a,JSON[_0x3f50('0x12')](_0x432fc1));_0x1f5f8c(_0x432fc1);})['catch'](function(_0x23d434){logger[_0x3f50('0x13')](_0x3f50('0x25'),_0x23d434[_0x3f50('0x16')],_0x12a81a);_0x3dec6f(_0x277c15[_0x3f50('0x13')](0x1f4,_0x23d434[_0x3f50('0x16')]));});});}; \ No newline at end of file +var _0xbc66=['options','raw','attributes','limit','map','include','model','debug','catch','ShowSmsQueue','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','GetSmsQueue','SmsQueue'];(function(_0x1057cd,_0x4fe93d){var _0x149799=function(_0xf97388){while(--_0xf97388){_0x1057cd['push'](_0x1057cd['shift']());}};_0x149799(++_0x4fe93d);}(_0xbc66,0x192));var _0x6bc6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc66[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x6bc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6bc6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bc6('0x2'));var db=require(_0x6bc6('0x3'))['db'];var utils=require(_0x6bc6('0x4'));var logger=require('../../config/logger')(_0x6bc6('0x5'));var config=require(_0x6bc6('0x6'));var jayson=require(_0x6bc6('0x7'));var client=jayson[_0x6bc6('0x8')][_0x6bc6('0x9')]({'port':0x232a});config[_0x6bc6('0xa')]=_['defaults'](config[_0x6bc6('0xa')],{'host':_0x6bc6('0xb'),'port':0x18eb});var socket=require(_0x6bc6('0xc'))(new Redis(config[_0x6bc6('0xa')]));require(_0x6bc6('0xd'))[_0x6bc6('0xe')](socket);function respondWithRpcPromise(_0x5e8fd1,_0x111e32,_0x3ab2d6){return new BPromise(function(_0x4d6bd8,_0x55834a){return client[_0x6bc6('0xf')](_0x5e8fd1,_0x3ab2d6)[_0x6bc6('0x10')](function(_0xdeeb7){logger[_0x6bc6('0x11')]('SmsQueue,\x20%s,\x20%s',_0x111e32,_0x6bc6('0x12'));logger['debug'](_0x6bc6('0x13'),_0x111e32,_0x6bc6('0x12'),JSON[_0x6bc6('0x14')](_0xdeeb7));if(_0xdeeb7[_0x6bc6('0x15')]){if(_0xdeeb7['error'][_0x6bc6('0x16')]===0x1f4){logger[_0x6bc6('0x15')]('SmsQueue,\x20%s,\x20%s',_0x111e32,_0xdeeb7[_0x6bc6('0x15')][_0x6bc6('0x17')]);return _0x55834a(_0xdeeb7['error'][_0x6bc6('0x17')]);}logger['error'](_0x6bc6('0x18'),_0x111e32,_0xdeeb7[_0x6bc6('0x15')][_0x6bc6('0x17')]);return _0x4d6bd8(_0xdeeb7[_0x6bc6('0x15')][_0x6bc6('0x17')]);}else{logger[_0x6bc6('0x11')]('SmsQueue,\x20%s,\x20%s',_0x111e32,_0x6bc6('0x12'));_0x4d6bd8(_0xdeeb7['result'][_0x6bc6('0x17')]);}})['catch'](function(_0x2c1c15){logger[_0x6bc6('0x15')](_0x6bc6('0x18'),_0x111e32,_0x2c1c15);_0x55834a(_0x2c1c15);});});}exports[_0x6bc6('0x19')]=function(_0x101db7){var _0x20f081=this;return new Promise(function(_0x2f7cb5,_0x260256){return db[_0x6bc6('0x1a')]['findAll']({'raw':_0x101db7[_0x6bc6('0x1b')]?_0x101db7[_0x6bc6('0x1b')][_0x6bc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x101db7[_0x6bc6('0x1b')]?_0x101db7[_0x6bc6('0x1b')]['where']||null:null,'attributes':_0x101db7[_0x6bc6('0x1b')]?_0x101db7[_0x6bc6('0x1b')][_0x6bc6('0x1d')]||null:null,'limit':_0x101db7[_0x6bc6('0x1b')]?_0x101db7[_0x6bc6('0x1b')][_0x6bc6('0x1e')]||null:null,'include':_0x101db7[_0x6bc6('0x1b')]?_0x101db7[_0x6bc6('0x1b')]['include']?_[_0x6bc6('0x1f')](_0x101db7[_0x6bc6('0x1b')][_0x6bc6('0x20')],function(_0x1fd3eb){return{'model':db[_0x1fd3eb[_0x6bc6('0x21')]],'as':_0x1fd3eb['as'],'attributes':_0x1fd3eb[_0x6bc6('0x1d')],'include':_0x1fd3eb[_0x6bc6('0x20')]?_[_0x6bc6('0x1f')](_0x1fd3eb['include'],function(_0xe97ef4){return{'model':db[_0xe97ef4['model']],'as':_0xe97ef4['as'],'attributes':_0xe97ef4['attributes'],'include':_0xe97ef4[_0x6bc6('0x20')]?_['map'](_0xe97ef4[_0x6bc6('0x20')],function(_0x60e2){return{'model':db[_0x60e2[_0x6bc6('0x21')]],'as':_0x60e2['as'],'attributes':_0x60e2[_0x6bc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6bc6('0x10')](function(_0x504974){logger['info'](_0x6bc6('0x19'),_0x101db7);logger[_0x6bc6('0x22')](_0x6bc6('0x19'),_0x101db7,JSON[_0x6bc6('0x14')](_0x504974));_0x2f7cb5(_0x504974);})[_0x6bc6('0x23')](function(_0x2a4e55){logger[_0x6bc6('0x15')](_0x6bc6('0x19'),_0x2a4e55[_0x6bc6('0x17')],_0x101db7);_0x260256(_0x20f081[_0x6bc6('0x15')](0x1f4,_0x2a4e55['message']));});});};exports[_0x6bc6('0x24')]=function(_0x3598c6){var _0x448e22=this;return new Promise(function(_0x5106d1,_0x965375){return db[_0x6bc6('0x1a')][_0x6bc6('0x25')]({'raw':_0x3598c6[_0x6bc6('0x1b')]?_0x3598c6['options'][_0x6bc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x3598c6['options']?_0x3598c6['options'][_0x6bc6('0x26')]||null:null,'attributes':_0x3598c6['options']?_0x3598c6[_0x6bc6('0x1b')]['attributes']||null:null,'include':_0x3598c6[_0x6bc6('0x1b')]?_0x3598c6[_0x6bc6('0x1b')][_0x6bc6('0x20')]?_[_0x6bc6('0x1f')](_0x3598c6[_0x6bc6('0x1b')][_0x6bc6('0x20')],function(_0x325c67){return{'model':db[_0x325c67[_0x6bc6('0x21')]],'as':_0x325c67['as'],'attributes':_0x325c67[_0x6bc6('0x1d')],'include':_0x325c67['include']?_[_0x6bc6('0x1f')](_0x325c67['include'],function(_0x2548f7){return{'model':db[_0x2548f7[_0x6bc6('0x21')]],'as':_0x2548f7['as'],'attributes':_0x2548f7[_0x6bc6('0x1d')],'include':_0x2548f7[_0x6bc6('0x20')]?_['map'](_0x2548f7[_0x6bc6('0x20')],function(_0xbf0e6f){return{'model':db[_0xbf0e6f[_0x6bc6('0x21')]],'as':_0xbf0e6f['as'],'attributes':_0xbf0e6f[_0x6bc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6bc6('0x10')](function(_0x56e9ed){logger[_0x6bc6('0x11')](_0x6bc6('0x24'),_0x3598c6);logger[_0x6bc6('0x22')](_0x6bc6('0x24'),_0x3598c6,JSON['stringify'](_0x56e9ed));_0x5106d1(_0x56e9ed);})[_0x6bc6('0x23')](function(_0x246386){logger['error'](_0x6bc6('0x24'),_0x246386[_0x6bc6('0x17')],_0x3598c6);_0x965375(_0x448e22[_0x6bc6('0x15')](0x1f4,_0x246386['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 36d2d08..353a191 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 _0xa46b=['length','smsQueue:','./smsQueue.events','remove','update','emit','register'];(function(_0x2d0ad1,_0x1daf0f){var _0x5c0220=function(_0x2afcbd){while(--_0x2afcbd){_0x2d0ad1['push'](_0x2d0ad1['shift']());}};_0x5c0220(++_0x1daf0f);}(_0xa46b,0x198));var _0xba46=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa46b[_0xa464c9];return _0x3d73c4;};'use strict';var SmsQueueEvents=require(_0xba46('0x0'));var events=['save',_0xba46('0x1'),_0xba46('0x2')];function createListener(_0x24ebd0,_0x566e41){return function(_0x48a1a4){_0x566e41[_0xba46('0x3')](_0x24ebd0,_0x48a1a4);};}function removeListener(_0x43e6f0,_0x22db07){return function(){SmsQueueEvents['removeListener'](_0x43e6f0,_0x22db07);};}exports[_0xba46('0x4')]=function(_0x67cbcc){for(var _0x1e0df9=0x0,_0x1ca9a4=events[_0xba46('0x5')];_0x1e0df9<_0x1ca9a4;_0x1e0df9++){var _0x257d76=events[_0x1e0df9];var _0x2e1456=createListener(_0xba46('0x6')+_0x257d76,_0x67cbcc);SmsQueueEvents['on'](_0x257d76,_0x2e1456);}}; \ No newline at end of file +var _0x1a42=['length','smsQueue:','./smsQueue.events','update','emit'];(function(_0x3135a2,_0x2ba376){var _0x3bc420=function(_0x5c3e37){while(--_0x5c3e37){_0x3135a2['push'](_0x3135a2['shift']());}};_0x3bc420(++_0x2ba376);}(_0x1a42,0x18d));var _0x21a4=function(_0x3f787e,_0x951303){_0x3f787e=_0x3f787e-0x0;var _0x26242d=_0x1a42[_0x3f787e];return _0x26242d;};'use strict';var SmsQueueEvents=require(_0x21a4('0x0'));var events=['save','remove',_0x21a4('0x1')];function createListener(_0x3c74d7,_0x4d9a15){return function(_0x1492ae){_0x4d9a15[_0x21a4('0x2')](_0x3c74d7,_0x1492ae);};}function removeListener(_0x3403ca,_0x46380d){return function(){SmsQueueEvents['removeListener'](_0x3403ca,_0x46380d);};}exports['register']=function(_0x570099){for(var _0x5cee81=0x0,_0x3da1dd=events[_0x21a4('0x3')];_0x5cee81<_0x3da1dd;_0x5cee81++){var _0x48f63b=events[_0x5cee81];var _0x271cc1=createListener(_0x21a4('0x4')+_0x48f63b,_0x570099);SmsQueueEvents['on'](_0x48f63b,_0x271cc1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 71bccac..d586d39 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 _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','index','get'];(function(_0x394622,_0xbb2dd9){var _0x17be65=function(_0x1203ba){while(--_0x1203ba){_0x394622['push'](_0x394622['shift']());}};_0x17be65(++_0xbb2dd9);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1ee9f9,_0xfe4594){_0x1ee9f9=_0x1ee9f9-0x0;var _0x4a69c4=_0x8d0e[_0x1ee9f9];return _0x4a69c4;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x33ac=['post','create','put','/:id','update','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','show'];(function(_0x4a3f5e,_0x2ed7d7){var _0x4f448f=function(_0x632ed8){while(--_0x632ed8){_0x4a3f5e['push'](_0x4a3f5e['shift']());}};_0x4f448f(++_0x2ed7d7);}(_0x33ac,0x1f2));var _0xc33a=function(_0x23c896,_0x13bc03){_0x23c896=_0x23c896-0x0;var _0x579b27=_0x33ac[_0x23c896];return _0x579b27;};'use strict';var multer=require('multer');var util=require(_0xc33a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc33a('0x1'));var router=express[_0xc33a('0x2')]();var fs_extra=require(_0xc33a('0x3'));var auth=require(_0xc33a('0x4'));var interaction=require(_0xc33a('0x5'));var config=require(_0xc33a('0x6'));var controller=require(_0xc33a('0x7'));router[_0xc33a('0x8')]('/',auth[_0xc33a('0x9')](),controller['index']);router['get'](_0xc33a('0xa'),auth[_0xc33a('0x9')](),controller['describe']);router[_0xc33a('0x8')]('/:id',auth[_0xc33a('0x9')](),controller[_0xc33a('0xb')]);router[_0xc33a('0xc')]('/',auth[_0xc33a('0x9')](),controller[_0xc33a('0xd')]);router[_0xc33a('0xe')](_0xc33a('0xf'),auth[_0xc33a('0x9')](),controller[_0xc33a('0x10')]);router['delete']('/:id',auth[_0xc33a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 4862881..f4a9579 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 _0x9ac9=['DATE','moment','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ac9,0x1b9));var _0x99ac=function(_0x15dd89,_0x484c66){_0x15dd89=_0x15dd89-0x0;var _0x37565a=_0x9ac9[_0x15dd89];return _0x37565a;};'use strict';var moment=require(_0x99ac('0x0'));var Sequelize=require('sequelize');module[_0x99ac('0x1')]={'uniqueid':{'type':Sequelize[_0x99ac('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x99ac('0x2')]},'joinAt':{'type':Sequelize[_0x99ac('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x99ac('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x99ac('0x2')]}}; \ No newline at end of file +var _0xf26f=['STRING','DATE','moment','sequelize','exports'];(function(_0x471545,_0x261a18){var _0x197b39=function(_0x5602fd){while(--_0x5602fd){_0x471545['push'](_0x471545['shift']());}};_0x197b39(++_0x261a18);}(_0xf26f,0x142));var _0xff26=function(_0x54c81d,_0x47cd3e){_0x54c81d=_0x54c81d-0x0;var _0x1301c3=_0xf26f[_0x54c81d];return _0x1301c3;};'use strict';var moment=require(_0xff26('0x0'));var Sequelize=require(_0xff26('0x1'));module[_0xff26('0x2')]={'uniqueid':{'type':Sequelize[_0xff26('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xff26('0x3')]},'joinAt':{'type':Sequelize[_0xff26('0x4')]},'leaveAt':{'type':Sequelize[_0xff26('0x4')]},'acceptAt':{'type':Sequelize[_0xff26('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xff26('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 565b02c..d82f786 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 _0x5b88=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsQueueReport','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x204c47,_0x510777){var _0x2007c7=function(_0x4447b0){while(--_0x4447b0){_0x204c47['push'](_0x204c47['shift']());}};_0x2007c7(++_0x510777);}(_0x5b88,0x158));var _0x85b8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x5b88[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x85b8('0x0'));var rimraf=require(_0x85b8('0x1'));var zipdir=require(_0x85b8('0x2'));var jsonpatch=require(_0x85b8('0x3'));var rp=require(_0x85b8('0x4'));var moment=require(_0x85b8('0x5'));var BPromise=require(_0x85b8('0x6'));var Mustache=require(_0x85b8('0x7'));var util=require('util');var path=require(_0x85b8('0x8'));var sox=require('sox');var csv=require(_0x85b8('0x9'));var ejs=require(_0x85b8('0xa'));var fs=require('fs');var fs_extra=require(_0x85b8('0xb'));var _=require(_0x85b8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85b8('0xd'));var deskjs=require(_0x85b8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x85b8('0xf'));var Papa=require(_0x85b8('0x10'));var Redis=require('ioredis');var authService=require(_0x85b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x85b8('0x12'));var hardwareService=require(_0x85b8('0x13'));var logger=require(_0x85b8('0x14'))(_0x85b8('0x15'));var utils=require(_0x85b8('0x16'));var config=require(_0x85b8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85b8('0x18'))['db'];function respondWithStatusCode(_0x3309d1,_0x31bbe2){_0x31bbe2=_0x31bbe2||0xcc;return function(_0x166adb){if(_0x166adb){return _0x3309d1[_0x85b8('0x19')](_0x31bbe2);}return _0x3309d1['status'](_0x31bbe2)[_0x85b8('0x1a')]();};}function respondWithResult(_0x557c8b,_0xe61967){_0xe61967=_0xe61967||0xc8;return function(_0x211c7b){if(_0x211c7b){return _0x557c8b[_0x85b8('0x1b')](_0xe61967)[_0x85b8('0x1c')](_0x211c7b);}};}function respondWithFilteredResult(_0x167527,_0xbc52e){return function(_0x593a85){if(_0x593a85){var _0x5b929f=typeof _0xbc52e[_0x85b8('0x1d')]===_0x85b8('0x1e')&&typeof _0xbc52e[_0x85b8('0x1f')]==='undefined';var _0x3539ca=_0x593a85[_0x85b8('0x20')];var _0x551e5d=_0x5b929f?0x0:_0xbc52e[_0x85b8('0x1d')];var _0x5bd24c=_0x5b929f?_0x593a85[_0x85b8('0x20')]:_0xbc52e[_0x85b8('0x1d')]+_0xbc52e[_0x85b8('0x1f')];var _0x50956c;if(_0x5bd24c>=_0x3539ca){_0x5bd24c=_0x3539ca;_0x50956c=0xc8;}else{_0x50956c=0xce;}_0x167527[_0x85b8('0x1b')](_0x50956c);return _0x167527[_0x85b8('0x21')](_0x85b8('0x22'),_0x551e5d+'-'+_0x5bd24c+'/'+_0x3539ca)[_0x85b8('0x1c')](_0x593a85);}return null;};}function patchUpdates(_0x679e07){return function(_0x321b9d){try{jsonpatch[_0x85b8('0x23')](_0x321b9d,_0x679e07,!![]);}catch(_0x18a29f){return BPromise[_0x85b8('0x24')](_0x18a29f);}return _0x321b9d[_0x85b8('0x25')]();};}function saveUpdates(_0x5397d7,_0x347273){return function(_0x54eaed){if(_0x54eaed){return _0x54eaed[_0x85b8('0x26')](_0x5397d7)[_0x85b8('0x27')](function(_0x22e963){return _0x22e963;});}return null;};}function removeEntity(_0x278d39,_0x1c3e85){return function(_0x18526c){if(_0x18526c){return _0x18526c[_0x85b8('0x28')]()['then'](function(){_0x278d39[_0x85b8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54636f,_0x3101c7){return function(_0x4bf85c){if(!_0x4bf85c){_0x54636f[_0x85b8('0x19')](0x194);}return _0x4bf85c;};}function handleError(_0x2de0db,_0x405af4){_0x405af4=_0x405af4||0x1f4;return function(_0x5492aa){logger[_0x85b8('0x29')](_0x5492aa['stack']);if(_0x5492aa['name']){delete _0x5492aa[_0x85b8('0x2a')];}_0x2de0db[_0x85b8('0x1b')](_0x405af4)['send'](_0x5492aa);};}exports[_0x85b8('0x2b')]=function(_0x391923,_0x28bb12){var _0x528d72={},_0x23be88={},_0x293595={'count':0x0,'rows':[]};var _0x1b45e8=_[_0x85b8('0x2c')](db['SmsQueueReport'][_0x85b8('0x2d')],function(_0x4efbb5){return{'name':_0x4efbb5[_0x85b8('0x2e')],'type':_0x4efbb5['type'][_0x85b8('0x2f')]};});_0x23be88[_0x85b8('0x30')]=_['map'](_0x1b45e8,'name');_0x23be88[_0x85b8('0x31')]=_[_0x85b8('0x32')](_0x391923[_0x85b8('0x31')]);_0x23be88[_0x85b8('0x33')]=_['intersection'](_0x23be88[_0x85b8('0x30')],_0x23be88[_0x85b8('0x31')]);_0x528d72[_0x85b8('0x34')]=_[_0x85b8('0x35')](_0x23be88[_0x85b8('0x30')],qs[_0x85b8('0x36')](_0x391923[_0x85b8('0x31')][_0x85b8('0x36')]));_0x528d72['attributes']=_0x528d72[_0x85b8('0x34')]['length']?_0x528d72[_0x85b8('0x34')]:_0x23be88[_0x85b8('0x30')];if(!_0x391923[_0x85b8('0x31')][_0x85b8('0x37')](_0x85b8('0x38'))){_0x528d72[_0x85b8('0x1f')]=qs['limit'](_0x391923[_0x85b8('0x31')][_0x85b8('0x1f')]);_0x528d72[_0x85b8('0x1d')]=qs['offset'](_0x391923[_0x85b8('0x31')]['offset']);}_0x528d72['order']=qs[_0x85b8('0x39')](_0x391923['query'][_0x85b8('0x39')]);_0x528d72[_0x85b8('0x3a')]=qs['filters'](_[_0x85b8('0x3b')](_0x391923[_0x85b8('0x31')],_0x23be88[_0x85b8('0x33')]),_0x1b45e8);if(_0x391923[_0x85b8('0x31')][_0x85b8('0x3c')]){_0x528d72[_0x85b8('0x3a')]=_[_0x85b8('0x3d')](_0x528d72[_0x85b8('0x3a')],{'$or':_[_0x85b8('0x2c')](_0x1b45e8,function(_0x293200){if(_0x293200[_0x85b8('0x3e')]!==_0x85b8('0x3f')){var _0xb8c4ed={};_0xb8c4ed[_0x293200[_0x85b8('0x2a')]]={'$like':'%'+_0x391923['query']['filter']+'%'};return _0xb8c4ed;}})});}_0x528d72=_[_0x85b8('0x3d')]({},_0x528d72,_0x391923[_0x85b8('0x40')]);var _0x35dcb8={'where':_0x528d72['where']};return db[_0x85b8('0x41')][_0x85b8('0x20')](_0x35dcb8)['then'](function(_0x1c19d6){_0x293595[_0x85b8('0x20')]=_0x1c19d6;if(_0x391923['query'][_0x85b8('0x42')]){_0x528d72[_0x85b8('0x43')]=[{'all':!![]}];}return db[_0x85b8('0x41')]['findAll'](_0x528d72);})[_0x85b8('0x27')](function(_0x4b2140){_0x293595[_0x85b8('0x44')]=_0x4b2140;return _0x293595;})['then'](respondWithFilteredResult(_0x28bb12,_0x528d72))[_0x85b8('0x45')](handleError(_0x28bb12,null));};exports[_0x85b8('0x46')]=function(_0x19e7f7,_0x21e4b1){var _0x211695={'raw':!![],'where':{'id':_0x19e7f7[_0x85b8('0x47')]['id']}},_0x50097a={};_0x50097a['model']=_[_0x85b8('0x32')](db['SmsQueueReport'][_0x85b8('0x2d')]);_0x50097a[_0x85b8('0x31')]=_[_0x85b8('0x32')](_0x19e7f7[_0x85b8('0x31')]);_0x50097a['filters']=_[_0x85b8('0x35')](_0x50097a[_0x85b8('0x30')],_0x50097a[_0x85b8('0x31')]);_0x211695['attributes']=_['intersection'](_0x50097a[_0x85b8('0x30')],qs['fields'](_0x19e7f7[_0x85b8('0x31')][_0x85b8('0x36')]));_0x211695[_0x85b8('0x34')]=_0x211695[_0x85b8('0x34')]['length']?_0x211695[_0x85b8('0x34')]:_0x50097a[_0x85b8('0x30')];if(_0x19e7f7[_0x85b8('0x31')][_0x85b8('0x42')]){_0x211695['include']=[{'all':!![]}];}_0x211695=_[_0x85b8('0x3d')]({},_0x211695,_0x19e7f7[_0x85b8('0x40')]);return db[_0x85b8('0x41')]['find'](_0x211695)['then'](handleEntityNotFound(_0x21e4b1,null))[_0x85b8('0x27')](respondWithResult(_0x21e4b1,null))[_0x85b8('0x45')](handleError(_0x21e4b1,null));};exports[_0x85b8('0x48')]=function(_0x51d9d3,_0x3c94aa){return db[_0x85b8('0x41')][_0x85b8('0x48')](_0x51d9d3[_0x85b8('0x49')],{})['then'](respondWithResult(_0x3c94aa,0xc9))['catch'](handleError(_0x3c94aa,null));};exports[_0x85b8('0x26')]=function(_0x224e26,_0x54e2dd){if(_0x224e26[_0x85b8('0x49')]['id']){delete _0x224e26['body']['id'];}return db[_0x85b8('0x41')][_0x85b8('0x4a')]({'where':{'id':_0x224e26['params']['id']}})[_0x85b8('0x27')](handleEntityNotFound(_0x54e2dd,null))[_0x85b8('0x27')](saveUpdates(_0x224e26['body'],null))['then'](respondWithResult(_0x54e2dd,null))[_0x85b8('0x45')](handleError(_0x54e2dd,null));};exports[_0x85b8('0x28')]=function(_0x11eefe,_0x3b4d5a){return db['SmsQueueReport'][_0x85b8('0x4a')]({'where':{'id':_0x11eefe[_0x85b8('0x47')]['id']}})[_0x85b8('0x27')](handleEntityNotFound(_0x3b4d5a,null))[_0x85b8('0x27')](removeEntity(_0x3b4d5a,null))[_0x85b8('0x45')](handleError(_0x3b4d5a,null));};exports['describe']=function(_0x5ca208,_0x5ba2f8){return db[_0x85b8('0x41')]['describe']()[_0x85b8('0x27')](respondWithResult(_0x5ba2f8,null))[_0x85b8('0x45')](handleError(_0x5ba2f8,null));}; \ No newline at end of file +var _0x6e49=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','SmsQueueReport','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','create','body','find','describe','eml-format'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6e49,0xd7));var _0x96e4=function(_0x5b60b1,_0x54d588){_0x5b60b1=_0x5b60b1-0x0;var _0x34ada9=_0x6e49[_0x5b60b1];return _0x34ada9;};'use strict';var emlformat=require(_0x96e4('0x0'));var rimraf=require(_0x96e4('0x1'));var zipdir=require(_0x96e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96e4('0x3'));var moment=require(_0x96e4('0x4'));var BPromise=require(_0x96e4('0x5'));var Mustache=require(_0x96e4('0x6'));var util=require('util');var path=require(_0x96e4('0x7'));var sox=require(_0x96e4('0x8'));var csv=require(_0x96e4('0x9'));var ejs=require(_0x96e4('0xa'));var fs=require('fs');var fs_extra=require(_0x96e4('0xb'));var _=require(_0x96e4('0xc'));var squel=require(_0x96e4('0xd'));var crypto=require(_0x96e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x96e4('0xf'));var toCsv=require(_0x96e4('0x9'));var querystring=require('querystring');var Papa=require(_0x96e4('0x10'));var Redis=require('ioredis');var authService=require(_0x96e4('0x11'));var qs=require(_0x96e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96e4('0x13'));var logger=require('../../config/logger')(_0x96e4('0x14'));var utils=require(_0x96e4('0x15'));var config=require(_0x96e4('0x16'));var licenseUtil=require(_0x96e4('0x17'));var db=require(_0x96e4('0x18'))['db'];function respondWithStatusCode(_0xa6325,_0x9ccf6){_0x9ccf6=_0x9ccf6||0xcc;return function(_0x4060bf){if(_0x4060bf){return _0xa6325[_0x96e4('0x19')](_0x9ccf6);}return _0xa6325[_0x96e4('0x1a')](_0x9ccf6)[_0x96e4('0x1b')]();};}function respondWithResult(_0x5913fd,_0x49f96d){_0x49f96d=_0x49f96d||0xc8;return function(_0x8c5b9d){if(_0x8c5b9d){return _0x5913fd[_0x96e4('0x1a')](_0x49f96d)['json'](_0x8c5b9d);}};}function respondWithFilteredResult(_0x7714e1,_0x3fdfdb){return function(_0x24d46b){if(_0x24d46b){var _0x808efc=typeof _0x3fdfdb[_0x96e4('0x1c')]==='undefined'&&typeof _0x3fdfdb[_0x96e4('0x1d')]===_0x96e4('0x1e');var _0x1da512=_0x24d46b[_0x96e4('0x1f')];var _0x7448ff=_0x808efc?0x0:_0x3fdfdb[_0x96e4('0x1c')];var _0x95102=_0x808efc?_0x24d46b['count']:_0x3fdfdb[_0x96e4('0x1c')]+_0x3fdfdb['limit'];var _0x2c9bef;if(_0x95102>=_0x1da512){_0x95102=_0x1da512;_0x2c9bef=0xc8;}else{_0x2c9bef=0xce;}_0x7714e1[_0x96e4('0x1a')](_0x2c9bef);return _0x7714e1[_0x96e4('0x20')](_0x96e4('0x21'),_0x7448ff+'-'+_0x95102+'/'+_0x1da512)['json'](_0x24d46b);}return null;};}function patchUpdates(_0x1ab19d){return function(_0x2e4fc5){try{jsonpatch[_0x96e4('0x22')](_0x2e4fc5,_0x1ab19d,!![]);}catch(_0x20f737){return BPromise[_0x96e4('0x23')](_0x20f737);}return _0x2e4fc5[_0x96e4('0x24')]();};}function saveUpdates(_0x23725b,_0x1f4858){return function(_0x419224){if(_0x419224){return _0x419224[_0x96e4('0x25')](_0x23725b)['then'](function(_0x1129be){return _0x1129be;});}return null;};}function removeEntity(_0x3b1b2a,_0x4c8fb6){return function(_0xb7792d){if(_0xb7792d){return _0xb7792d[_0x96e4('0x26')]()[_0x96e4('0x27')](function(){_0x3b1b2a[_0x96e4('0x1a')](0xcc)[_0x96e4('0x1b')]();});}};}function handleEntityNotFound(_0x41745c,_0x14ea1a){return function(_0x8890ec){if(!_0x8890ec){_0x41745c[_0x96e4('0x19')](0x194);}return _0x8890ec;};}function handleError(_0x180bcd,_0x57c861){_0x57c861=_0x57c861||0x1f4;return function(_0x44560a){logger[_0x96e4('0x28')](_0x44560a['stack']);if(_0x44560a[_0x96e4('0x29')]){delete _0x44560a[_0x96e4('0x29')];}_0x180bcd[_0x96e4('0x1a')](_0x57c861)['send'](_0x44560a);};}exports['index']=function(_0x22fead,_0xbc712d){var _0x445eb4={},_0x3fa5bb={},_0x1e2912={'count':0x0,'rows':[]};var _0x86e8c5=_['map'](db[_0x96e4('0x2a')][_0x96e4('0x2b')],function(_0x2e8802){return{'name':_0x2e8802['fieldName'],'type':_0x2e8802[_0x96e4('0x2c')]['key']};});_0x3fa5bb['model']=_[_0x96e4('0x2d')](_0x86e8c5,_0x96e4('0x29'));_0x3fa5bb[_0x96e4('0x2e')]=_['keys'](_0x22fead['query']);_0x3fa5bb[_0x96e4('0x2f')]=_[_0x96e4('0x30')](_0x3fa5bb[_0x96e4('0x31')],_0x3fa5bb[_0x96e4('0x2e')]);_0x445eb4[_0x96e4('0x32')]=_[_0x96e4('0x30')](_0x3fa5bb[_0x96e4('0x31')],qs[_0x96e4('0x33')](_0x22fead[_0x96e4('0x2e')][_0x96e4('0x33')]));_0x445eb4['attributes']=_0x445eb4['attributes'][_0x96e4('0x34')]?_0x445eb4[_0x96e4('0x32')]:_0x3fa5bb[_0x96e4('0x31')];if(!_0x22fead['query'][_0x96e4('0x35')](_0x96e4('0x36'))){_0x445eb4[_0x96e4('0x1d')]=qs['limit'](_0x22fead['query'][_0x96e4('0x1d')]);_0x445eb4['offset']=qs['offset'](_0x22fead['query'][_0x96e4('0x1c')]);}_0x445eb4['order']=qs[_0x96e4('0x37')](_0x22fead['query'][_0x96e4('0x37')]);_0x445eb4[_0x96e4('0x38')]=qs[_0x96e4('0x2f')](_[_0x96e4('0x39')](_0x22fead[_0x96e4('0x2e')],_0x3fa5bb[_0x96e4('0x2f')]),_0x86e8c5);if(_0x22fead[_0x96e4('0x2e')]['filter']){_0x445eb4[_0x96e4('0x38')]=_[_0x96e4('0x3a')](_0x445eb4[_0x96e4('0x38')],{'$or':_['map'](_0x86e8c5,function(_0x528cee){if(_0x528cee[_0x96e4('0x2c')]!==_0x96e4('0x3b')){var _0x3af861={};_0x3af861[_0x528cee[_0x96e4('0x29')]]={'$like':'%'+_0x22fead[_0x96e4('0x2e')][_0x96e4('0x3c')]+'%'};return _0x3af861;}})});}_0x445eb4=_[_0x96e4('0x3a')]({},_0x445eb4,_0x22fead[_0x96e4('0x3d')]);var _0x2f3716={'where':_0x445eb4[_0x96e4('0x38')]};return db['SmsQueueReport'][_0x96e4('0x1f')](_0x2f3716)[_0x96e4('0x27')](function(_0x234f4b){_0x1e2912[_0x96e4('0x1f')]=_0x234f4b;if(_0x22fead[_0x96e4('0x2e')]['includeAll']){_0x445eb4[_0x96e4('0x3e')]=[{'all':!![]}];}return db[_0x96e4('0x2a')][_0x96e4('0x3f')](_0x445eb4);})['then'](function(_0x134da0){_0x1e2912[_0x96e4('0x40')]=_0x134da0;return _0x1e2912;})['then'](respondWithFilteredResult(_0xbc712d,_0x445eb4))[_0x96e4('0x41')](handleError(_0xbc712d,null));};exports['show']=function(_0x1bbfc3,_0xc9f519){var _0x501159={'raw':!![],'where':{'id':_0x1bbfc3[_0x96e4('0x42')]['id']}},_0x5e88c9={};_0x5e88c9[_0x96e4('0x31')]=_['keys'](db[_0x96e4('0x2a')][_0x96e4('0x2b')]);_0x5e88c9[_0x96e4('0x2e')]=_[_0x96e4('0x43')](_0x1bbfc3[_0x96e4('0x2e')]);_0x5e88c9[_0x96e4('0x2f')]=_[_0x96e4('0x30')](_0x5e88c9[_0x96e4('0x31')],_0x5e88c9[_0x96e4('0x2e')]);_0x501159[_0x96e4('0x32')]=_['intersection'](_0x5e88c9[_0x96e4('0x31')],qs[_0x96e4('0x33')](_0x1bbfc3[_0x96e4('0x2e')][_0x96e4('0x33')]));_0x501159[_0x96e4('0x32')]=_0x501159['attributes'][_0x96e4('0x34')]?_0x501159[_0x96e4('0x32')]:_0x5e88c9[_0x96e4('0x31')];if(_0x1bbfc3[_0x96e4('0x2e')]['includeAll']){_0x501159['include']=[{'all':!![]}];}_0x501159=_[_0x96e4('0x3a')]({},_0x501159,_0x1bbfc3[_0x96e4('0x3d')]);return db[_0x96e4('0x2a')]['find'](_0x501159)[_0x96e4('0x27')](handleEntityNotFound(_0xc9f519,null))[_0x96e4('0x27')](respondWithResult(_0xc9f519,null))[_0x96e4('0x41')](handleError(_0xc9f519,null));};exports[_0x96e4('0x44')]=function(_0x5adab0,_0x5053ed){return db['SmsQueueReport'][_0x96e4('0x44')](_0x5adab0[_0x96e4('0x45')],{})[_0x96e4('0x27')](respondWithResult(_0x5053ed,0xc9))[_0x96e4('0x41')](handleError(_0x5053ed,null));};exports['update']=function(_0x3f6266,_0x5bf25c){if(_0x3f6266[_0x96e4('0x45')]['id']){delete _0x3f6266[_0x96e4('0x45')]['id'];}return db['SmsQueueReport'][_0x96e4('0x46')]({'where':{'id':_0x3f6266[_0x96e4('0x42')]['id']}})[_0x96e4('0x27')](handleEntityNotFound(_0x5bf25c,null))[_0x96e4('0x27')](saveUpdates(_0x3f6266['body'],null))[_0x96e4('0x27')](respondWithResult(_0x5bf25c,null))[_0x96e4('0x41')](handleError(_0x5bf25c,null));};exports[_0x96e4('0x26')]=function(_0x391657,_0x511287){return db['SmsQueueReport'][_0x96e4('0x46')]({'where':{'id':_0x391657[_0x96e4('0x42')]['id']}})['then'](handleEntityNotFound(_0x511287,null))['then'](removeEntity(_0x511287,null))['catch'](handleError(_0x511287,null));};exports[_0x96e4('0x47')]=function(_0x34579c,_0x1e7980){return db[_0x96e4('0x2a')][_0x96e4('0x47')]()[_0x96e4('0x27')](respondWithResult(_0x1e7980,null))[_0x96e4('0x41')](handleError(_0x1e7980,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9ef985b..78effbd 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x10b330,_0x593016){var _0x5401c1=function(_0x451611){while(--_0x451611){_0x10b330['push'](_0x10b330['shift']());}};_0x5401c1(++_0x593016);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x158bd4,_0x51eccd){var _0x463241=function(_0x58424d){while(--_0x58424d){_0x158bd4['push'](_0x158bd4['shift']());}};_0x463241(++_0x51eccd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0e91afa..0d34740 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 _0xf12c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','options','raw','update','body','limit','UpdateSmsQueueReport','lodash','moment','randomstring','ioredis'];(function(_0x37d81d,_0x29f7b9){var _0xa7f5d1=function(_0x55d34c){while(--_0x55d34c){_0x37d81d['push'](_0x37d81d['shift']());}};_0xa7f5d1(++_0x29f7b9);}(_0xf12c,0x146));var _0xcf12=function(_0x7eee15,_0x3fe21a){_0x7eee15=_0x7eee15-0x0;var _0x7ad23=_0xf12c[_0x7eee15];return _0x7ad23;};'use strict';var _=require(_0xcf12('0x0'));var util=require('util');var moment=require(_0xcf12('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf12('0x2'));var fs=require('fs');var Redis=require(_0xcf12('0x3'));var db=require(_0xcf12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf12('0x5'))(_0xcf12('0x6'));var config=require(_0xcf12('0x7'));var jayson=require(_0xcf12('0x8'));var client=jayson[_0xcf12('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419972,_0x2b655f,_0xc1c2df){return new BPromise(function(_0x187c66,_0x467693){return client['request'](_0x419972,_0xc1c2df)[_0xcf12('0xa')](function(_0x5321d7){logger[_0xcf12('0xb')](_0xcf12('0xc'),_0x2b655f,'request\x20sent');logger[_0xcf12('0xd')](_0xcf12('0xe'),_0x2b655f,_0xcf12('0xf'),JSON[_0xcf12('0x10')](_0x5321d7));if(_0x5321d7['error']){if(_0x5321d7[_0xcf12('0x11')][_0xcf12('0x12')]===0x1f4){logger['error'](_0xcf12('0xc'),_0x2b655f,_0x5321d7[_0xcf12('0x11')][_0xcf12('0x13')]);return _0x467693(_0x5321d7['error'][_0xcf12('0x13')]);}logger[_0xcf12('0x11')](_0xcf12('0xc'),_0x2b655f,_0x5321d7[_0xcf12('0x11')][_0xcf12('0x13')]);return _0x187c66(_0x5321d7['error'][_0xcf12('0x13')]);}else{logger[_0xcf12('0xb')](_0xcf12('0xc'),_0x2b655f,_0xcf12('0xf'));_0x187c66(_0x5321d7[_0xcf12('0x14')][_0xcf12('0x13')]);}})[_0xcf12('0x15')](function(_0x517d24){logger[_0xcf12('0x11')](_0xcf12('0xc'),_0x2b655f,_0x517d24);_0x467693(_0x517d24);});});}exports[_0xcf12('0x16')]=function(_0x497aa6){var _0x2de01a=this;return new Promise(function(_0x14c8ae,_0x586cce){return db['SmsQueueReport'][_0xcf12('0x17')](_0x497aa6['body'],{'raw':_0x497aa6[_0xcf12('0x18')]?_0x497aa6[_0xcf12('0x18')][_0xcf12('0x19')]===undefined?!![]:![]:!![]})[_0xcf12('0xa')](function(_0x53a1db){logger['info'](_0xcf12('0x16'),_0x497aa6);logger[_0xcf12('0xd')]('CreateSmsQueueReport',_0x497aa6,JSON['stringify'](_0x53a1db));_0x14c8ae(_0x53a1db);})[_0xcf12('0x15')](function(_0x3c5c3f){logger[_0xcf12('0x11')](_0xcf12('0x16'),_0x3c5c3f[_0xcf12('0x13')],_0x497aa6);_0x586cce(_0x2de01a[_0xcf12('0x11')](0x1f4,_0x3c5c3f['message']));});});};exports['UpdateSmsQueueReport']=function(_0x24656f){var _0x2247fc=this;return new Promise(function(_0x581415,_0x2df4cf){return db['SmsQueueReport'][_0xcf12('0x1a')](_0x24656f[_0xcf12('0x1b')],{'raw':_0x24656f['options']?_0x24656f[_0xcf12('0x18')][_0xcf12('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24656f[_0xcf12('0x18')]?_0x24656f[_0xcf12('0x18')]['where']||null:null,'attributes':_0x24656f[_0xcf12('0x18')]?_0x24656f['options']['attributes']||null:null,'limit':_0x24656f[_0xcf12('0x18')]?_0x24656f[_0xcf12('0x18')][_0xcf12('0x1c')]||null:null})[_0xcf12('0xa')](function(_0x59ffbe){logger[_0xcf12('0xb')](_0xcf12('0x1d'),_0x24656f);logger[_0xcf12('0xd')](_0xcf12('0x1d'),_0x24656f,JSON[_0xcf12('0x10')](_0x59ffbe));_0x581415(_0x59ffbe);})['catch'](function(_0x3e5fae){logger[_0xcf12('0x11')](_0xcf12('0x1d'),_0x3e5fae[_0xcf12('0x13')],_0x24656f);_0x2df4cf(_0x2247fc[_0xcf12('0x11')](0x1f4,_0x3e5fae[_0xcf12('0x13')]));});});}; \ No newline at end of file +var _0xfe0b=['../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1cf981,_0x1bb468){var _0x367d3d=function(_0x430b03){while(--_0x430b03){_0x1cf981['push'](_0x1cf981['shift']());}};_0x367d3d(++_0x1bb468);}(_0xfe0b,0x10a));var _0xbfe0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe0b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xbfe0('0x0'));var moment=require(_0xbfe0('0x1'));var BPromise=require(_0xbfe0('0x2'));var rs=require(_0xbfe0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfe0('0x4'))['db'];var utils=require(_0xbfe0('0x5'));var logger=require(_0xbfe0('0x6'))(_0xbfe0('0x7'));var config=require(_0xbfe0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfe0('0x9')][_0xbfe0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10e77e,_0x2969e1,_0x2b5f80){return new BPromise(function(_0x500a0b,_0x3e62ca){return client[_0xbfe0('0xb')](_0x10e77e,_0x2b5f80)[_0xbfe0('0xc')](function(_0x401934){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2969e1,_0xbfe0('0xd'));logger[_0xbfe0('0xe')](_0xbfe0('0xf'),_0x2969e1,_0xbfe0('0xd'),JSON['stringify'](_0x401934));if(_0x401934[_0xbfe0('0x10')]){if(_0x401934[_0xbfe0('0x10')][_0xbfe0('0x11')]===0x1f4){logger['error'](_0xbfe0('0x12'),_0x2969e1,_0x401934[_0xbfe0('0x10')][_0xbfe0('0x13')]);return _0x3e62ca(_0x401934[_0xbfe0('0x10')][_0xbfe0('0x13')]);}logger[_0xbfe0('0x10')](_0xbfe0('0x12'),_0x2969e1,_0x401934[_0xbfe0('0x10')][_0xbfe0('0x13')]);return _0x500a0b(_0x401934['error'][_0xbfe0('0x13')]);}else{logger[_0xbfe0('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x2969e1,_0xbfe0('0xd'));_0x500a0b(_0x401934[_0xbfe0('0x15')][_0xbfe0('0x13')]);}})[_0xbfe0('0x16')](function(_0x264d8f){logger[_0xbfe0('0x10')](_0xbfe0('0x12'),_0x2969e1,_0x264d8f);_0x3e62ca(_0x264d8f);});});}exports[_0xbfe0('0x17')]=function(_0x410f33){var _0x581cb5=this;return new Promise(function(_0x16941a,_0x312635){return db['SmsQueueReport'][_0xbfe0('0x18')](_0x410f33['body'],{'raw':_0x410f33['options']?_0x410f33[_0xbfe0('0x19')][_0xbfe0('0x1a')]===undefined?!![]:![]:!![]})[_0xbfe0('0xc')](function(_0x33cc3f){logger[_0xbfe0('0x14')](_0xbfe0('0x17'),_0x410f33);logger[_0xbfe0('0xe')](_0xbfe0('0x17'),_0x410f33,JSON[_0xbfe0('0x1b')](_0x33cc3f));_0x16941a(_0x33cc3f);})[_0xbfe0('0x16')](function(_0x305735){logger[_0xbfe0('0x10')](_0xbfe0('0x17'),_0x305735[_0xbfe0('0x13')],_0x410f33);_0x312635(_0x581cb5['error'](0x1f4,_0x305735[_0xbfe0('0x13')]));});});};exports[_0xbfe0('0x1c')]=function(_0x41f52f){var _0x23b645=this;return new Promise(function(_0x42a115,_0x195eb0){return db[_0xbfe0('0x1d')][_0xbfe0('0x1e')](_0x41f52f['body'],{'raw':_0x41f52f[_0xbfe0('0x19')]?_0x41f52f[_0xbfe0('0x19')][_0xbfe0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f52f[_0xbfe0('0x19')]?_0x41f52f[_0xbfe0('0x19')][_0xbfe0('0x1f')]||null:null,'attributes':_0x41f52f['options']?_0x41f52f[_0xbfe0('0x19')][_0xbfe0('0x20')]||null:null,'limit':_0x41f52f[_0xbfe0('0x19')]?_0x41f52f[_0xbfe0('0x19')][_0xbfe0('0x21')]||null:null})[_0xbfe0('0xc')](function(_0x571357){logger['info']('UpdateSmsQueueReport',_0x41f52f);logger['debug'](_0xbfe0('0x1c'),_0x41f52f,JSON['stringify'](_0x571357));_0x42a115(_0x571357);})[_0xbfe0('0x16')](function(_0x567984){logger[_0xbfe0('0x10')]('UpdateSmsQueueReport',_0x567984[_0xbfe0('0x13')],_0x41f52f);_0x195eb0(_0x23b645['error'](0x1f4,_0x567984[_0xbfe0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index fa27ac5..fac2384 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 _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x2681a5,_0x255ca9){var _0x3f5066=function(_0x4e1d79){while(--_0x4e1d79){_0x2681a5['push'](_0x2681a5['shift']());}};_0x3f5066(++_0x255ca9);}(_0x5636,0x102));var _0x6563=function(_0xc1e44f,_0x45afa5){_0xc1e44f=_0xc1e44f-0x0;var _0x1818f9=_0x5636[_0xc1e44f];return _0x1818f9;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file +var _0xac95=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x503be0,_0x254ab5){var _0x2300f6=function(_0x17c3c4){while(--_0x17c3c4){_0x503be0['push'](_0x503be0['shift']());}};_0x2300f6(++_0x254ab5);}(_0xac95,0xa8));var _0x5ac9=function(_0x2cd30f,_0x44eaaf){_0x2cd30f=_0x2cd30f-0x0;var _0xe76f75=_0xac95[_0x2cd30f];return _0xe76f75;};'use strict';var multer=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var path=require(_0x5ac9('0x2'));var timeout=require(_0x5ac9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ac9('0x4'));var auth=require(_0x5ac9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ac9('0x6'));var controller=require(_0x5ac9('0x7'));router['get']('/',auth[_0x5ac9('0x8')](),controller[_0x5ac9('0x9')]);router[_0x5ac9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5ac9('0xb')]);router[_0x5ac9('0xa')](_0x5ac9('0xc'),auth[_0x5ac9('0x8')](),controller[_0x5ac9('0xd')]);router[_0x5ac9('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ac9('0xf')]);router[_0x5ac9('0x10')]('/:id',auth[_0x5ac9('0x8')](),controller['update']);router[_0x5ac9('0x11')]('/:id',auth[_0x5ac9('0x8')](),controller[_0x5ac9('0x12')]);module[_0x5ac9('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 37e908c..b79a078 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x588224,_0x2080d4){var _0x1b22c8=function(_0x40b597){while(--_0x40b597){_0x588224['push'](_0x588224['shift']());}};_0x1b22c8(++_0x2080d4);}(_0xedd9,0xfc));var _0x9edd=function(_0x2cc6e8,_0x4ad0cf){_0x2cc6e8=_0x2cc6e8-0x0;var _0x5937a5=_0xedd9[_0x2cc6e8];return _0x5937a5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x452780,_0xc9b9d3){_0x452780=_0x452780-0x0;var _0x335f97=_0xb43b[_0x452780];return _0x335f97;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 186e177..9945447 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 _0xe8bc=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x30e7d3,_0xcb5fcf){var _0x3bb3d1=function(_0x5424a3){while(--_0x5424a3){_0x30e7d3['push'](_0x30e7d3['shift']());}};_0x3bb3d1(++_0xcb5fcf);}(_0xe8bc,0x16b));var _0xce8b=function(_0x1570e2,_0x3215cd){_0x1570e2=_0x1570e2-0x0;var _0x155436=_0xe8bc[_0x1570e2];return _0x155436;};'use strict';var emlformat=require(_0xce8b('0x0'));var rimraf=require(_0xce8b('0x1'));var zipdir=require(_0xce8b('0x2'));var jsonpatch=require(_0xce8b('0x3'));var rp=require(_0xce8b('0x4'));var moment=require('moment');var BPromise=require(_0xce8b('0x5'));var Mustache=require(_0xce8b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xce8b('0x7'));var csv=require(_0xce8b('0x8'));var ejs=require(_0xce8b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce8b('0xa'));var squel=require(_0xce8b('0xb'));var crypto=require(_0xce8b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce8b('0xd'));var toCsv=require(_0xce8b('0x8'));var querystring=require(_0xce8b('0xe'));var Papa=require('papaparse');var Redis=require(_0xce8b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xce8b('0x10'));var as=require(_0xce8b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce8b('0x12'))(_0xce8b('0x13'));var utils=require(_0xce8b('0x14'));var config=require(_0xce8b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xce8b('0x16'))['db'];function respondWithStatusCode(_0x2342f8,_0x3bf6bc){_0x3bf6bc=_0x3bf6bc||0xcc;return function(_0x3ec37a){if(_0x3ec37a){return _0x2342f8[_0xce8b('0x17')](_0x3bf6bc);}return _0x2342f8[_0xce8b('0x18')](_0x3bf6bc)['end']();};}function respondWithResult(_0x2c0077,_0x46a549){_0x46a549=_0x46a549||0xc8;return function(_0x28cdc3){if(_0x28cdc3){return _0x2c0077[_0xce8b('0x18')](_0x46a549)[_0xce8b('0x19')](_0x28cdc3);}};}function respondWithFilteredResult(_0x3dbd67,_0x4f4f9a){return function(_0x16f0d9){if(_0x16f0d9){var _0x394f3e=typeof _0x4f4f9a[_0xce8b('0x1a')]==='undefined'&&typeof _0x4f4f9a[_0xce8b('0x1b')]===_0xce8b('0x1c');var _0x336d51=_0x16f0d9['count'];var _0x1d047d=_0x394f3e?0x0:_0x4f4f9a['offset'];var _0xf55a1=_0x394f3e?_0x16f0d9['count']:_0x4f4f9a['offset']+_0x4f4f9a[_0xce8b('0x1b')];var _0x31b37e;if(_0xf55a1>=_0x336d51){_0xf55a1=_0x336d51;_0x31b37e=0xc8;}else{_0x31b37e=0xce;}_0x3dbd67[_0xce8b('0x18')](_0x31b37e);return _0x3dbd67[_0xce8b('0x1d')]('Content-Range',_0x1d047d+'-'+_0xf55a1+'/'+_0x336d51)[_0xce8b('0x19')](_0x16f0d9);}return null;};}function patchUpdates(_0xf44b5a){return function(_0x4dc3a0){try{jsonpatch[_0xce8b('0x1e')](_0x4dc3a0,_0xf44b5a,!![]);}catch(_0x32b50e){return BPromise[_0xce8b('0x1f')](_0x32b50e);}return _0x4dc3a0[_0xce8b('0x20')]();};}function saveUpdates(_0x4c59c7,_0x4f76b0){return function(_0xafb436){if(_0xafb436){return _0xafb436[_0xce8b('0x21')](_0x4c59c7)[_0xce8b('0x22')](function(_0x207206){return _0x207206;});}return null;};}function removeEntity(_0x49e28f,_0x536b6c){return function(_0x3d62d1){if(_0x3d62d1){return _0x3d62d1[_0xce8b('0x23')]()[_0xce8b('0x22')](function(){_0x49e28f[_0xce8b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df7c9,_0x3bc526){return function(_0x120246){if(!_0x120246){_0x3df7c9[_0xce8b('0x17')](0x194);}return _0x120246;};}function handleError(_0x266f7e,_0x31f4c5){_0x31f4c5=_0x31f4c5||0x1f4;return function(_0x2b0787){logger[_0xce8b('0x24')](_0x2b0787[_0xce8b('0x25')]);if(_0x2b0787[_0xce8b('0x26')]){delete _0x2b0787[_0xce8b('0x26')];}_0x266f7e[_0xce8b('0x18')](_0x31f4c5)[_0xce8b('0x27')](_0x2b0787);};}exports[_0xce8b('0x28')]=function(_0x5ca595,_0x4b1d5f){var _0x217b0f={},_0x1509bf={},_0x2e811f={'count':0x0,'rows':[]};var _0x18f164=_[_0xce8b('0x29')](db[_0xce8b('0x2a')]['rawAttributes'],function(_0xe077b4){return{'name':_0xe077b4[_0xce8b('0x2b')],'type':_0xe077b4['type'][_0xce8b('0x2c')]};});_0x1509bf[_0xce8b('0x2d')]=_[_0xce8b('0x29')](_0x18f164,'name');_0x1509bf[_0xce8b('0x2e')]=_[_0xce8b('0x2f')](_0x5ca595[_0xce8b('0x2e')]);_0x1509bf[_0xce8b('0x30')]=_[_0xce8b('0x31')](_0x1509bf[_0xce8b('0x2d')],_0x1509bf[_0xce8b('0x2e')]);_0x217b0f[_0xce8b('0x32')]=_[_0xce8b('0x31')](_0x1509bf[_0xce8b('0x2d')],qs[_0xce8b('0x33')](_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x33')]));_0x217b0f[_0xce8b('0x32')]=_0x217b0f[_0xce8b('0x32')][_0xce8b('0x34')]?_0x217b0f['attributes']:_0x1509bf['model'];if(!_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x35')](_0xce8b('0x36'))){_0x217b0f['limit']=qs[_0xce8b('0x1b')](_0x5ca595[_0xce8b('0x2e')]['limit']);_0x217b0f[_0xce8b('0x1a')]=qs['offset'](_0x5ca595['query'][_0xce8b('0x1a')]);}_0x217b0f[_0xce8b('0x37')]=qs[_0xce8b('0x38')](_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x38')]);_0x217b0f['where']=qs['filters'](_[_0xce8b('0x39')](_0x5ca595[_0xce8b('0x2e')],_0x1509bf[_0xce8b('0x30')]),_0x18f164);if(_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x3a')]){_0x217b0f[_0xce8b('0x3b')]=_[_0xce8b('0x3c')](_0x217b0f['where'],{'$or':_['map'](_0x18f164,function(_0x3f17fc){if(_0x3f17fc[_0xce8b('0x3d')]!==_0xce8b('0x3e')){var _0x318f5c={};_0x318f5c[_0x3f17fc[_0xce8b('0x26')]]={'$like':'%'+_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x3a')]+'%'};return _0x318f5c;}})});}_0x217b0f=_[_0xce8b('0x3c')]({},_0x217b0f,_0x5ca595['options']);var _0x2d3236={'where':_0x217b0f[_0xce8b('0x3b')]};return db[_0xce8b('0x2a')][_0xce8b('0x3f')](_0x2d3236)[_0xce8b('0x22')](function(_0x4339ba){_0x2e811f[_0xce8b('0x3f')]=_0x4339ba;if(_0x5ca595[_0xce8b('0x2e')][_0xce8b('0x40')]){_0x217b0f[_0xce8b('0x41')]=[{'all':!![]}];}return db[_0xce8b('0x2a')][_0xce8b('0x42')](_0x217b0f);})[_0xce8b('0x22')](function(_0xb44a8a){_0x2e811f[_0xce8b('0x43')]=_0xb44a8a;return _0x2e811f;})[_0xce8b('0x22')](respondWithFilteredResult(_0x4b1d5f,_0x217b0f))[_0xce8b('0x44')](handleError(_0x4b1d5f,null));};exports[_0xce8b('0x45')]=function(_0x53fef7,_0x514a6e){var _0xa31b1e={'raw':!![],'where':{'id':_0x53fef7[_0xce8b('0x46')]['id']}},_0x2a7b20={};_0x2a7b20[_0xce8b('0x2d')]=_['keys'](db[_0xce8b('0x2a')][_0xce8b('0x47')]);_0x2a7b20[_0xce8b('0x2e')]=_[_0xce8b('0x2f')](_0x53fef7[_0xce8b('0x2e')]);_0x2a7b20[_0xce8b('0x30')]=_[_0xce8b('0x31')](_0x2a7b20[_0xce8b('0x2d')],_0x2a7b20[_0xce8b('0x2e')]);_0xa31b1e[_0xce8b('0x32')]=_['intersection'](_0x2a7b20['model'],qs[_0xce8b('0x33')](_0x53fef7[_0xce8b('0x2e')][_0xce8b('0x33')]));_0xa31b1e['attributes']=_0xa31b1e[_0xce8b('0x32')][_0xce8b('0x34')]?_0xa31b1e[_0xce8b('0x32')]:_0x2a7b20[_0xce8b('0x2d')];if(_0x53fef7[_0xce8b('0x2e')][_0xce8b('0x40')]){_0xa31b1e[_0xce8b('0x41')]=[{'all':!![]}];}_0xa31b1e=_[_0xce8b('0x3c')]({},_0xa31b1e,_0x53fef7['options']);return db[_0xce8b('0x2a')][_0xce8b('0x48')](_0xa31b1e)[_0xce8b('0x22')](handleEntityNotFound(_0x514a6e,null))[_0xce8b('0x22')](respondWithResult(_0x514a6e,null))[_0xce8b('0x44')](handleError(_0x514a6e,null));};exports['create']=function(_0x282708,_0x3675c7){return db[_0xce8b('0x2a')][_0xce8b('0x49')](_0x282708['body'],{})[_0xce8b('0x22')](respondWithResult(_0x3675c7,0xc9))['catch'](handleError(_0x3675c7,null));};exports['update']=function(_0x463609,_0x3391c9){if(_0x463609[_0xce8b('0x4a')]['id']){delete _0x463609['body']['id'];}return db[_0xce8b('0x2a')]['find']({'where':{'id':_0x463609[_0xce8b('0x46')]['id']}})[_0xce8b('0x22')](handleEntityNotFound(_0x3391c9,null))[_0xce8b('0x22')](saveUpdates(_0x463609['body'],null))[_0xce8b('0x22')](respondWithResult(_0x3391c9,null))[_0xce8b('0x44')](handleError(_0x3391c9,null));};exports['destroy']=function(_0xd29d01,_0x25326d){return db['SmsTransferReport'][_0xce8b('0x48')]({'where':{'id':_0xd29d01[_0xce8b('0x46')]['id']}})[_0xce8b('0x22')](handleEntityNotFound(_0x25326d,null))[_0xce8b('0x22')](removeEntity(_0x25326d,null))['catch'](handleError(_0x25326d,null));};exports['describe']=function(_0x1a3ccf,_0x419128){return db[_0xce8b('0x2a')][_0xce8b('0x4b')]()[_0xce8b('0x22')](respondWithResult(_0x419128,null))[_0xce8b('0x44')](handleError(_0x419128,null));}; \ No newline at end of file +var _0xdb5b=['count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SmsTransferReport','includeAll','include','rows','catch','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x7f1086,_0x434356){var _0x358a47=function(_0x1f14ab){while(--_0x1f14ab){_0x7f1086['push'](_0x7f1086['shift']());}};_0x358a47(++_0x434356);}(_0xdb5b,0x1df));var _0xbdb5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdb5b[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xbdb5('0x0'));var rimraf=require(_0xbdb5('0x1'));var zipdir=require(_0xbdb5('0x2'));var jsonpatch=require(_0xbdb5('0x3'));var rp=require(_0xbdb5('0x4'));var moment=require('moment');var BPromise=require(_0xbdb5('0x5'));var Mustache=require(_0xbdb5('0x6'));var util=require(_0xbdb5('0x7'));var path=require(_0xbdb5('0x8'));var sox=require(_0xbdb5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdb5('0xa'));var _=require(_0xbdb5('0xb'));var squel=require(_0xbdb5('0xc'));var crypto=require(_0xbdb5('0xd'));var jsforce=require(_0xbdb5('0xe'));var deskjs=require(_0xbdb5('0xf'));var toCsv=require(_0xbdb5('0x10'));var querystring=require(_0xbdb5('0x11'));var Papa=require(_0xbdb5('0x12'));var Redis=require(_0xbdb5('0x13'));var authService=require(_0xbdb5('0x14'));var qs=require(_0xbdb5('0x15'));var as=require(_0xbdb5('0x16'));var hardwareService=require(_0xbdb5('0x17'));var logger=require(_0xbdb5('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c35ec,_0x4ab5d7){_0x4ab5d7=_0x4ab5d7||0xcc;return function(_0x6fdc66){if(_0x6fdc66){return _0x5c35ec[_0xbdb5('0x19')](_0x4ab5d7);}return _0x5c35ec[_0xbdb5('0x1a')](_0x4ab5d7)[_0xbdb5('0x1b')]();};}function respondWithResult(_0x3d906e,_0x324294){_0x324294=_0x324294||0xc8;return function(_0x2f8a11){if(_0x2f8a11){return _0x3d906e[_0xbdb5('0x1a')](_0x324294)[_0xbdb5('0x1c')](_0x2f8a11);}};}function respondWithFilteredResult(_0x475e7c,_0x45c63f){return function(_0xe0014){if(_0xe0014){var _0xa5d5b9=typeof _0x45c63f[_0xbdb5('0x1d')]==='undefined'&&typeof _0x45c63f[_0xbdb5('0x1e')]===_0xbdb5('0x1f');var _0x13cac8=_0xe0014[_0xbdb5('0x20')];var _0x33b7aa=_0xa5d5b9?0x0:_0x45c63f[_0xbdb5('0x1d')];var _0x270a1d=_0xa5d5b9?_0xe0014[_0xbdb5('0x20')]:_0x45c63f[_0xbdb5('0x1d')]+_0x45c63f[_0xbdb5('0x1e')];var _0x5dd083;if(_0x270a1d>=_0x13cac8){_0x270a1d=_0x13cac8;_0x5dd083=0xc8;}else{_0x5dd083=0xce;}_0x475e7c['status'](_0x5dd083);return _0x475e7c['set'](_0xbdb5('0x21'),_0x33b7aa+'-'+_0x270a1d+'/'+_0x13cac8)['json'](_0xe0014);}return null;};}function patchUpdates(_0x12b043){return function(_0x3b5004){try{jsonpatch[_0xbdb5('0x22')](_0x3b5004,_0x12b043,!![]);}catch(_0x3f6aa3){return BPromise[_0xbdb5('0x23')](_0x3f6aa3);}return _0x3b5004['save']();};}function saveUpdates(_0x211cf1,_0x199376){return function(_0x473229){if(_0x473229){return _0x473229[_0xbdb5('0x24')](_0x211cf1)[_0xbdb5('0x25')](function(_0x356bf5){return _0x356bf5;});}return null;};}function removeEntity(_0x412517,_0x56654e){return function(_0x36f7c8){if(_0x36f7c8){return _0x36f7c8[_0xbdb5('0x26')]()[_0xbdb5('0x25')](function(){_0x412517['status'](0xcc)[_0xbdb5('0x1b')]();});}};}function handleEntityNotFound(_0x6f0019,_0x596cb7){return function(_0x24c7c3){if(!_0x24c7c3){_0x6f0019[_0xbdb5('0x19')](0x194);}return _0x24c7c3;};}function handleError(_0x25e0d5,_0x12c750){_0x12c750=_0x12c750||0x1f4;return function(_0x2dddc2){logger[_0xbdb5('0x27')](_0x2dddc2[_0xbdb5('0x28')]);if(_0x2dddc2[_0xbdb5('0x29')]){delete _0x2dddc2[_0xbdb5('0x29')];}_0x25e0d5[_0xbdb5('0x1a')](_0x12c750)[_0xbdb5('0x2a')](_0x2dddc2);};}exports['index']=function(_0x241d2a,_0x53c465){var _0x3dfa2f={},_0x1013ae={},_0x5c61ae={'count':0x0,'rows':[]};var _0x417bda=_['map'](db['SmsTransferReport'][_0xbdb5('0x2b')],function(_0xfbb497){return{'name':_0xfbb497[_0xbdb5('0x2c')],'type':_0xfbb497[_0xbdb5('0x2d')]['key']};});_0x1013ae[_0xbdb5('0x2e')]=_[_0xbdb5('0x2f')](_0x417bda,'name');_0x1013ae[_0xbdb5('0x30')]=_[_0xbdb5('0x31')](_0x241d2a['query']);_0x1013ae[_0xbdb5('0x32')]=_[_0xbdb5('0x33')](_0x1013ae['model'],_0x1013ae[_0xbdb5('0x30')]);_0x3dfa2f[_0xbdb5('0x34')]=_[_0xbdb5('0x33')](_0x1013ae[_0xbdb5('0x2e')],qs[_0xbdb5('0x35')](_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x35')]));_0x3dfa2f[_0xbdb5('0x34')]=_0x3dfa2f[_0xbdb5('0x34')][_0xbdb5('0x36')]?_0x3dfa2f[_0xbdb5('0x34')]:_0x1013ae[_0xbdb5('0x2e')];if(!_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x37')](_0xbdb5('0x38'))){_0x3dfa2f[_0xbdb5('0x1e')]=qs[_0xbdb5('0x1e')](_0x241d2a['query']['limit']);_0x3dfa2f['offset']=qs['offset'](_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x1d')]);}_0x3dfa2f[_0xbdb5('0x39')]=qs[_0xbdb5('0x3a')](_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x3a')]);_0x3dfa2f[_0xbdb5('0x3b')]=qs[_0xbdb5('0x32')](_[_0xbdb5('0x3c')](_0x241d2a['query'],_0x1013ae['filters']),_0x417bda);if(_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x3d')]){_0x3dfa2f[_0xbdb5('0x3b')]=_[_0xbdb5('0x3e')](_0x3dfa2f[_0xbdb5('0x3b')],{'$or':_[_0xbdb5('0x2f')](_0x417bda,function(_0x26d8c3){if(_0x26d8c3['type']!=='VIRTUAL'){var _0x47619f={};_0x47619f[_0x26d8c3[_0xbdb5('0x29')]]={'$like':'%'+_0x241d2a[_0xbdb5('0x30')][_0xbdb5('0x3d')]+'%'};return _0x47619f;}})});}_0x3dfa2f=_['merge']({},_0x3dfa2f,_0x241d2a[_0xbdb5('0x3f')]);var _0x3bb155={'where':_0x3dfa2f[_0xbdb5('0x3b')]};return db[_0xbdb5('0x40')]['count'](_0x3bb155)[_0xbdb5('0x25')](function(_0x174e5a){_0x5c61ae[_0xbdb5('0x20')]=_0x174e5a;if(_0x241d2a['query'][_0xbdb5('0x41')]){_0x3dfa2f[_0xbdb5('0x42')]=[{'all':!![]}];}return db[_0xbdb5('0x40')]['findAll'](_0x3dfa2f);})[_0xbdb5('0x25')](function(_0x1a365b){_0x5c61ae[_0xbdb5('0x43')]=_0x1a365b;return _0x5c61ae;})[_0xbdb5('0x25')](respondWithFilteredResult(_0x53c465,_0x3dfa2f))[_0xbdb5('0x44')](handleError(_0x53c465,null));};exports['show']=function(_0x1f266b,_0x5a7ba5){var _0x3bb660={'raw':!![],'where':{'id':_0x1f266b[_0xbdb5('0x45')]['id']}},_0x35ca58={};_0x35ca58[_0xbdb5('0x2e')]=_[_0xbdb5('0x31')](db[_0xbdb5('0x40')]['rawAttributes']);_0x35ca58[_0xbdb5('0x30')]=_['keys'](_0x1f266b[_0xbdb5('0x30')]);_0x35ca58[_0xbdb5('0x32')]=_[_0xbdb5('0x33')](_0x35ca58[_0xbdb5('0x2e')],_0x35ca58[_0xbdb5('0x30')]);_0x3bb660[_0xbdb5('0x34')]=_[_0xbdb5('0x33')](_0x35ca58[_0xbdb5('0x2e')],qs['fields'](_0x1f266b[_0xbdb5('0x30')][_0xbdb5('0x35')]));_0x3bb660[_0xbdb5('0x34')]=_0x3bb660[_0xbdb5('0x34')][_0xbdb5('0x36')]?_0x3bb660[_0xbdb5('0x34')]:_0x35ca58[_0xbdb5('0x2e')];if(_0x1f266b[_0xbdb5('0x30')][_0xbdb5('0x41')]){_0x3bb660[_0xbdb5('0x42')]=[{'all':!![]}];}_0x3bb660=_['merge']({},_0x3bb660,_0x1f266b['options']);return db[_0xbdb5('0x40')]['find'](_0x3bb660)[_0xbdb5('0x25')](handleEntityNotFound(_0x5a7ba5,null))['then'](respondWithResult(_0x5a7ba5,null))['catch'](handleError(_0x5a7ba5,null));};exports['create']=function(_0x246738,_0x2c787d){return db['SmsTransferReport']['create'](_0x246738[_0xbdb5('0x46')],{})[_0xbdb5('0x25')](respondWithResult(_0x2c787d,0xc9))[_0xbdb5('0x44')](handleError(_0x2c787d,null));};exports[_0xbdb5('0x24')]=function(_0x2fdc9a,_0x7362ef){if(_0x2fdc9a['body']['id']){delete _0x2fdc9a[_0xbdb5('0x46')]['id'];}return db[_0xbdb5('0x40')][_0xbdb5('0x47')]({'where':{'id':_0x2fdc9a['params']['id']}})['then'](handleEntityNotFound(_0x7362ef,null))[_0xbdb5('0x25')](saveUpdates(_0x2fdc9a['body'],null))[_0xbdb5('0x25')](respondWithResult(_0x7362ef,null))['catch'](handleError(_0x7362ef,null));};exports[_0xbdb5('0x26')]=function(_0x1d8a0d,_0x7deeb6){return db[_0xbdb5('0x40')]['find']({'where':{'id':_0x1d8a0d[_0xbdb5('0x45')]['id']}})[_0xbdb5('0x25')](handleEntityNotFound(_0x7deeb6,null))[_0xbdb5('0x25')](removeEntity(_0x7deeb6,null))[_0xbdb5('0x44')](handleError(_0x7deeb6,null));};exports[_0xbdb5('0x48')]=function(_0x4077a6,_0x4502b9){return db[_0xbdb5('0x40')][_0xbdb5('0x48')]()[_0xbdb5('0x25')](respondWithResult(_0x4502b9,null))['catch'](handleError(_0x4502b9,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a96f0f6..7828cd8 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 _0x33c5=['request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0x33c5,0xe6));var _0x533c=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x33c5[_0x1e6b59];return _0x40d7c5;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[{'name':_0x533c('0xc'),'fields':[_0x533c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02c5=['lodash','util','api','request-promise','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x21a188,_0x463d5f){var _0xa30c59=function(_0x3807c5){while(--_0x3807c5){_0x21a188['push'](_0x21a188['shift']());}};_0xa30c59(++_0x463d5f);}(_0x02c5,0x178));var _0x502c=function(_0x1d94b7,_0x5988e5){_0x1d94b7=_0x1d94b7-0x0;var _0x40a258=_0x02c5[_0x1d94b7];return _0x40a258;};'use strict';var _=require(_0x502c('0x0'));var util=require(_0x502c('0x1'));var logger=require('../../config/logger')(_0x502c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x502c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x502c('0x4'));module['exports']=function(_0x59794a,_0x4f56db){return _0x59794a['define'](_0x502c('0x5'),attributes,{'tableName':_0x502c('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x502c('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 69b3ddb..e5d7626 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 _0x5243=['result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5243,0x71));var _0x3524=function(_0xd413ab,_0x8595f7){_0xd413ab=_0xd413ab-0x0;var _0x22386c=_0x5243[_0xd413ab];return _0x22386c;};'use strict';var _=require(_0x3524('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3524('0x1'));var rs=require(_0x3524('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3524('0x3'));var logger=require(_0x3524('0x4'))('rpc');var config=require(_0x3524('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3524('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x375729,_0x1217ec,_0x1e9bf9){return new BPromise(function(_0x371171,_0x28ba74){return client['request'](_0x375729,_0x1e9bf9)['then'](function(_0x291030){logger[_0x3524('0x7')](_0x3524('0x8'),_0x1217ec,_0x3524('0x9'));logger[_0x3524('0xa')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1217ec,_0x3524('0x9'),JSON[_0x3524('0xb')](_0x291030));if(_0x291030['error']){if(_0x291030[_0x3524('0xc')][_0x3524('0xd')]===0x1f4){logger[_0x3524('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x1217ec,_0x291030['error']['message']);return _0x28ba74(_0x291030['error'][_0x3524('0xe')]);}logger[_0x3524('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x1217ec,_0x291030[_0x3524('0xc')][_0x3524('0xe')]);return _0x371171(_0x291030[_0x3524('0xc')][_0x3524('0xe')]);}else{logger[_0x3524('0x7')](_0x3524('0x8'),_0x1217ec,_0x3524('0x9'));_0x371171(_0x291030[_0x3524('0xf')][_0x3524('0xe')]);}})['catch'](function(_0x13e951){logger['error'](_0x3524('0x8'),_0x1217ec,_0x13e951);_0x28ba74(_0x13e951);});});} \ No newline at end of file +var _0xb6f1=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xb6f1,0x118));var _0x1b6f=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xb6f1[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var moment=require(_0x1b6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6f('0x2'));var fs=require('fs');var Redis=require(_0x1b6f('0x3'));var db=require(_0x1b6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b6f('0x5'))('rpc');var config=require(_0x1b6f('0x6'));var jayson=require(_0x1b6f('0x7'));var client=jayson[_0x1b6f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x496b52,_0xe05935,_0x7b27f5){return new BPromise(function(_0x236908,_0x493908){return client[_0x1b6f('0x9')](_0x496b52,_0x7b27f5)[_0x1b6f('0xa')](function(_0x4c4cbf){logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));logger[_0x1b6f('0xe')](_0x1b6f('0xf'),_0xe05935,_0x1b6f('0xd'),JSON['stringify'](_0x4c4cbf));if(_0x4c4cbf['error']){if(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x11')]===0x1f4){logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x493908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x236908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}else{logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));_0x236908(_0x4c4cbf[_0x1b6f('0x13')][_0x1b6f('0x12')]);}})[_0x1b6f('0x14')](function(_0x54eec7){logger['error'](_0x1b6f('0xc'),_0xe05935,_0x54eec7);_0x493908(_0x54eec7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 2348fef..d6153d8 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 _0xc4f4=['extname','post','file','create','put','update','delete','/:id','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','show','/:id/download','diskStorage','root','originalname','format','%s-%s%s','now'];(function(_0x1ea6eb,_0x1abf59){var _0x4654f1=function(_0x96dd60){while(--_0x96dd60){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x4654f1(++_0x1abf59);}(_0xc4f4,0x127));var _0x4c4f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc4f4[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x4c4f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4c4f('0x1'));var router=express['Router']();var fs_extra=require(_0x4c4f('0x2'));var auth=require(_0x4c4f('0x3'));var interaction=require(_0x4c4f('0x4'));var config=require('../../config/environment');var controller=require(_0x4c4f('0x5'));router[_0x4c4f('0x6')]('/',auth[_0x4c4f('0x7')](),controller[_0x4c4f('0x8')]);router[_0x4c4f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4c4f('0x9')]);router[_0x4c4f('0x6')](_0x4c4f('0xa'),auth[_0x4c4f('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x4c4f('0xb')]({'destination':function(_0x4f512e,_0x3c1a42,_0x86f423){_0x86f423(null,path['join'](config[_0x4c4f('0xc')],'server/files/sounds/original/'));},'filename':function(_0x5030b7,_0x217160,_0x93a162){_0x217160['originalname']=_0x217160[_0x4c4f('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x93a162(null,util[_0x4c4f('0xe')](_0x4c4f('0xf'),path['basename'](_0x217160[_0x4c4f('0xd')],path['extname'](_0x217160['originalname'])),Date[_0x4c4f('0x10')](),path[_0x4c4f('0x11')](_0x217160[_0x4c4f('0xd')])));}})});router[_0x4c4f('0x12')]('/',upload['single'](_0x4c4f('0x13')),controller[_0x4c4f('0x14')]);router[_0x4c4f('0x15')]('/:id',auth[_0x4c4f('0x7')](),controller[_0x4c4f('0x16')]);router[_0x4c4f('0x17')](_0x4c4f('0x18'),auth[_0x4c4f('0x7')](),controller['delete']);module[_0x4c4f('0x19')]=router; \ No newline at end of file +var _0x35b0=['post','file','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','now'];(function(_0xd2bea6,_0x1f1d4a){var _0x1d2439=function(_0x51f3f2){while(--_0x51f3f2){_0xd2bea6['push'](_0xd2bea6['shift']());}};_0x1d2439(++_0x1f1d4a);}(_0x35b0,0xcb));var _0x035b=function(_0x4b1685,_0x570158){_0x4b1685=_0x4b1685-0x0;var _0x447511=_0x35b0[_0x4b1685];return _0x447511;};'use strict';var multer=require(_0x035b('0x0'));var util=require('util');var path=require(_0x035b('0x1'));var timeout=require(_0x035b('0x2'));var express=require(_0x035b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x035b('0x4'));var interaction=require(_0x035b('0x5'));var config=require(_0x035b('0x6'));var controller=require('./sound.controller');router[_0x035b('0x7')]('/',auth[_0x035b('0x8')](),controller[_0x035b('0x9')]);router['get']('/:id',auth[_0x035b('0x8')](),controller[_0x035b('0xa')]);router['get'](_0x035b('0xb'),auth[_0x035b('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x035b('0xc')]({'destination':function(_0x2311a8,_0x2e63bf,_0x4bec50){_0x4bec50(null,path[_0x035b('0xd')](config[_0x035b('0xe')],_0x035b('0xf')));},'filename':function(_0x5ba847,_0x60c0fa,_0x175b92){_0x60c0fa[_0x035b('0x10')]=_0x60c0fa[_0x035b('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x175b92(null,util['format'](_0x035b('0x11'),path[_0x035b('0x12')](_0x60c0fa[_0x035b('0x10')],path[_0x035b('0x13')](_0x60c0fa['originalname'])),Date[_0x035b('0x14')](),path[_0x035b('0x13')](_0x60c0fa[_0x035b('0x10')])));}})});router[_0x035b('0x15')]('/',upload['single'](_0x035b('0x16')),controller['create']);router[_0x035b('0x17')](_0x035b('0x18'),auth['isAuthenticated'](),controller[_0x035b('0x19')]);router[_0x035b('0x1a')]('/:id',auth[_0x035b('0x8')](),controller[_0x035b('0x1a')]);module[_0x035b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2d49735..4e18992 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 _0x6a49=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x2953d5,_0x118e47){var _0x1da6eb=function(_0x33c2e8){while(--_0x33c2e8){_0x2953d5['push'](_0x2953d5['shift']());}};_0x1da6eb(++_0x118e47);}(_0x6a49,0x7c));var _0x96a4=function(_0x3cb0a9,_0x172b0a){_0x3cb0a9=_0x3cb0a9-0x0;var _0x5e45fc=_0x6a49[_0x3cb0a9];return _0x5e45fc;};'use strict';var Sequelize=require('sequelize');module[_0x96a4('0x0')]={'name':{'type':Sequelize[_0x96a4('0x1')],'unique':_0x96a4('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x96a4('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x96a4('0x1')]},'original_format':{'type':Sequelize[_0x96a4('0x1')]},'original_duration':{'type':Sequelize[_0x96a4('0x3')]},'original_sampleCount':{'type':Sequelize[_0x96a4('0x4')]},'original_channelCount':{'type':Sequelize[_0x96a4('0x5')]},'original_bitRate':{'type':Sequelize[_0x96a4('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x96a4('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x96a4('0x4')]},'converted_channelCount':{'type':Sequelize[_0x96a4('0x5')]},'converted_bitRate':{'type':Sequelize[_0x96a4('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x96a4('0x5')]}}; \ No newline at end of file +var _0x435b=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x302771,_0x336b33){var _0x30a9e1=function(_0x114ba5){while(--_0x114ba5){_0x302771['push'](_0x302771['shift']());}};_0x30a9e1(++_0x336b33);}(_0x435b,0x174));var _0xb435=function(_0x1c7f2b,_0x303af2){_0x1c7f2b=_0x1c7f2b-0x0;var _0x5e6e19=_0x435b[_0x1c7f2b];return _0x5e6e19;};'use strict';var Sequelize=require(_0xb435('0x0'));module[_0xb435('0x1')]={'name':{'type':Sequelize[_0xb435('0x2')],'unique':_0xb435('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb435('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xb435('0x2')]},'original_format':{'type':Sequelize[_0xb435('0x2')]},'original_duration':{'type':Sequelize[_0xb435('0x4')]},'original_sampleCount':{'type':Sequelize[_0xb435('0x5')]},'original_channelCount':{'type':Sequelize[_0xb435('0x6')]},'original_bitRate':{'type':Sequelize[_0xb435('0x5')]},'original_sampleRate':{'type':Sequelize[_0xb435('0x6')]},'converted_format':{'type':Sequelize[_0xb435('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb435('0x5')]},'converted_channelCount':{'type':Sequelize[_0xb435('0x6')]},'converted_bitRate':{'type':Sequelize[_0xb435('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xb435('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cd7ef92..b464aba 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 _0xd9fa=['keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','download','find','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','save_name','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','original_sampleRate','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','bitRate','converted_sampleRate','sampleRate','chmodSync','0777','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','original_format','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key'];(function(_0x2d598a,_0x1277fa){var _0x42d7f1=function(_0x82c665){while(--_0x82c665){_0x2d598a['push'](_0x2d598a['shift']());}};_0x42d7f1(++_0x1277fa);}(_0xd9fa,0xcd));var _0xad9f=function(_0x2df347,_0x2e8ebc){_0x2df347=_0x2df347-0x0;var _0x25e8d0=_0xd9fa[_0x2df347];return _0x25e8d0;};'use strict';var emlformat=require(_0xad9f('0x0'));var rimraf=require(_0xad9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xad9f('0x2'));var moment=require(_0xad9f('0x3'));var BPromise=require(_0xad9f('0x4'));var Mustache=require('mustache');var util=require(_0xad9f('0x5'));var path=require(_0xad9f('0x6'));var sox=require(_0xad9f('0x7'));var csv=require(_0xad9f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad9f('0x9'));var _=require('lodash');var squel=require(_0xad9f('0xa'));var crypto=require(_0xad9f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xad9f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xad9f('0xd'));var Papa=require(_0xad9f('0xe'));var Redis=require(_0xad9f('0xf'));var authService=require(_0xad9f('0x10'));var qs=require(_0xad9f('0x11'));var as=require(_0xad9f('0x12'));var hardwareService=require(_0xad9f('0x13'));var logger=require(_0xad9f('0x14'))(_0xad9f('0x15'));var utils=require(_0xad9f('0x16'));var config=require(_0xad9f('0x17'));var licenseUtil=require(_0xad9f('0x18'));var db=require(_0xad9f('0x19'))['db'];function respondWithStatusCode(_0x1cc176,_0x3e62d8){_0x3e62d8=_0x3e62d8||0xcc;return function(_0xbf8ba8){if(_0xbf8ba8){return _0x1cc176[_0xad9f('0x1a')](_0x3e62d8);}return _0x1cc176['status'](_0x3e62d8)[_0xad9f('0x1b')]();};}function respondWithResult(_0xff4e00,_0x3b9ca5){_0x3b9ca5=_0x3b9ca5||0xc8;return function(_0xf013e2){if(_0xf013e2){return _0xff4e00[_0xad9f('0x1c')](_0x3b9ca5)[_0xad9f('0x1d')](_0xf013e2);}};}function respondWithFilteredResult(_0x4dc0bf,_0x548a79){return function(_0x243429){if(_0x243429){var _0x36a26f=typeof _0x548a79[_0xad9f('0x1e')]===_0xad9f('0x1f')&&typeof _0x548a79[_0xad9f('0x20')]===_0xad9f('0x1f');var _0x2f16a9=_0x243429[_0xad9f('0x21')];var _0x2521ae=_0x36a26f?0x0:_0x548a79[_0xad9f('0x1e')];var _0x30601d=_0x36a26f?_0x243429[_0xad9f('0x21')]:_0x548a79[_0xad9f('0x1e')]+_0x548a79[_0xad9f('0x20')];var _0x50d6d7;if(_0x30601d>=_0x2f16a9){_0x30601d=_0x2f16a9;_0x50d6d7=0xc8;}else{_0x50d6d7=0xce;}_0x4dc0bf[_0xad9f('0x1c')](_0x50d6d7);return _0x4dc0bf['set']('Content-Range',_0x2521ae+'-'+_0x30601d+'/'+_0x2f16a9)['json'](_0x243429);}return null;};}function patchUpdates(_0x24bcc8){return function(_0x339dae){try{jsonpatch['apply'](_0x339dae,_0x24bcc8,!![]);}catch(_0x56677e){return BPromise[_0xad9f('0x22')](_0x56677e);}return _0x339dae[_0xad9f('0x23')]();};}function saveUpdates(_0x38a504,_0x20bbba){return function(_0x2104a6){if(_0x2104a6){return _0x2104a6[_0xad9f('0x24')](_0x38a504)[_0xad9f('0x25')](function(_0x3e80ba){return _0x3e80ba;});}return null;};}function removeEntity(_0x14b9b7,_0x44475d){return function(_0x42cbf7){if(_0x42cbf7){return _0x42cbf7[_0xad9f('0x26')]()[_0xad9f('0x25')](function(){var _0x171cc3=_0x42cbf7[_0xad9f('0x27')]({'plain':!![]});var _0x14d5a8=_0xad9f('0x28');return db[_0xad9f('0x29')]['destroy']({'where':{'type':_0x14d5a8,'resourceId':_0x171cc3['id']}})[_0xad9f('0x25')](function(){return _0x42cbf7;});})['then'](function(){_0x14b9b7['status'](0xcc)[_0xad9f('0x1b')]();});}};}function handleEntityNotFound(_0xa55573,_0x5be9cb){return function(_0x345a64){if(!_0x345a64){_0xa55573[_0xad9f('0x1a')](0x194);}return _0x345a64;};}function handleError(_0x462a5b,_0x28f710){_0x28f710=_0x28f710||0x1f4;return function(_0x3110bb){logger[_0xad9f('0x2a')](_0x3110bb[_0xad9f('0x2b')]);if(_0x3110bb[_0xad9f('0x2c')]){delete _0x3110bb[_0xad9f('0x2c')];}_0x462a5b[_0xad9f('0x1c')](_0x28f710)[_0xad9f('0x2d')](_0x3110bb);};}exports[_0xad9f('0x2e')]=function(_0x86fca8,_0x6e5d9a){var _0x557415={},_0x21d8e5={},_0x4e1822={'count':0x0,'rows':[]};var _0x21b2a1=_[_0xad9f('0x2f')](db[_0xad9f('0x30')][_0xad9f('0x31')],function(_0x4fe84c){return{'name':_0x4fe84c[_0xad9f('0x32')],'type':_0x4fe84c[_0xad9f('0x33')][_0xad9f('0x34')]};});_0x21d8e5['model']=_[_0xad9f('0x2f')](_0x21b2a1,'name');_0x21d8e5['query']=_[_0xad9f('0x35')](_0x86fca8[_0xad9f('0x36')]);_0x21d8e5['filters']=_[_0xad9f('0x37')](_0x21d8e5[_0xad9f('0x38')],_0x21d8e5[_0xad9f('0x36')]);_0x557415['attributes']=_[_0xad9f('0x37')](_0x21d8e5[_0xad9f('0x38')],qs['fields'](_0x86fca8[_0xad9f('0x36')][_0xad9f('0x39')]));_0x557415[_0xad9f('0x3a')]=_0x557415[_0xad9f('0x3a')][_0xad9f('0x3b')]?_0x557415[_0xad9f('0x3a')]:_0x21d8e5[_0xad9f('0x38')];if(!_0x86fca8[_0xad9f('0x36')][_0xad9f('0x3c')](_0xad9f('0x3d'))){_0x557415[_0xad9f('0x20')]=qs[_0xad9f('0x20')](_0x86fca8[_0xad9f('0x36')][_0xad9f('0x20')]);_0x557415[_0xad9f('0x1e')]=qs[_0xad9f('0x1e')](_0x86fca8[_0xad9f('0x36')]['offset']);}_0x557415[_0xad9f('0x3e')]=qs['sort'](_0x86fca8['query'][_0xad9f('0x3f')]);_0x557415[_0xad9f('0x40')]=qs['filters'](_[_0xad9f('0x41')](_0x86fca8[_0xad9f('0x36')],_0x21d8e5[_0xad9f('0x42')]),_0x21b2a1);if(_0x86fca8[_0xad9f('0x36')][_0xad9f('0x43')]){_0x557415[_0xad9f('0x40')]=_[_0xad9f('0x44')](_0x557415[_0xad9f('0x40')],{'$or':_[_0xad9f('0x2f')](_0x21b2a1,function(_0x1da3d1){if(_0x1da3d1[_0xad9f('0x33')]!==_0xad9f('0x45')){var _0x197ffb={};_0x197ffb[_0x1da3d1[_0xad9f('0x2c')]]={'$like':'%'+_0x86fca8['query']['filter']+'%'};return _0x197ffb;}})});}_0x557415=_[_0xad9f('0x44')]({},_0x557415,_0x86fca8['options']);var _0xf235b7={'where':_0x557415[_0xad9f('0x40')]};return db[_0xad9f('0x30')][_0xad9f('0x21')](_0xf235b7)[_0xad9f('0x25')](function(_0x3f530e){_0x4e1822[_0xad9f('0x21')]=_0x3f530e;if(_0x86fca8['query'][_0xad9f('0x46')]){_0x557415[_0xad9f('0x47')]=[{'all':!![]}];}return db[_0xad9f('0x30')][_0xad9f('0x48')](_0x557415);})[_0xad9f('0x25')](function(_0x4a1634){_0x4e1822[_0xad9f('0x49')]=_0x4a1634;return _0x4e1822;})['then'](respondWithFilteredResult(_0x6e5d9a,_0x557415))[_0xad9f('0x4a')](handleError(_0x6e5d9a,null));};exports[_0xad9f('0x4b')]=function(_0x13cff8,_0x2336b8){var _0x21fff2={'raw':!![],'where':{'id':_0x13cff8[_0xad9f('0x4c')]['id']}},_0x21f7ee={};_0x21f7ee['model']=_[_0xad9f('0x35')](db['Sound'][_0xad9f('0x31')]);_0x21f7ee[_0xad9f('0x36')]=_[_0xad9f('0x35')](_0x13cff8['query']);_0x21f7ee[_0xad9f('0x42')]=_['intersection'](_0x21f7ee['model'],_0x21f7ee['query']);_0x21fff2[_0xad9f('0x3a')]=_[_0xad9f('0x37')](_0x21f7ee['model'],qs['fields'](_0x13cff8[_0xad9f('0x36')][_0xad9f('0x39')]));_0x21fff2[_0xad9f('0x3a')]=_0x21fff2['attributes'][_0xad9f('0x3b')]?_0x21fff2['attributes']:_0x21f7ee[_0xad9f('0x38')];if(_0x13cff8['query'][_0xad9f('0x46')]){_0x21fff2[_0xad9f('0x47')]=[{'all':!![]}];}_0x21fff2=_[_0xad9f('0x44')]({},_0x21fff2,_0x13cff8[_0xad9f('0x4d')]);return db[_0xad9f('0x30')]['find'](_0x21fff2)['then'](handleEntityNotFound(_0x2336b8,null))[_0xad9f('0x25')](respondWithResult(_0x2336b8,null))[_0xad9f('0x4a')](handleError(_0x2336b8,null));};exports[_0xad9f('0x4e')]=function(_0x1289da,_0x1ad793,_0x4ce0ba){return db['Sound'][_0xad9f('0x4f')]({'where':{'id':_0x1289da[_0xad9f('0x4c')]['id']},'attributes':['name','save_name',_0xad9f('0x50')],'raw':!![]})[_0xad9f('0x25')](handleEntityNotFound(_0x1ad793,null))[_0xad9f('0x25')](function(_0x6f5eba){if(_0x6f5eba){if(!fs[_0xad9f('0x51')](path[_0xad9f('0x52')](config[_0xad9f('0x53')],_0xad9f('0x54'),_0x6f5eba['save_name']+'.'+_0x6f5eba[_0xad9f('0x50')]))){throw new db['Sequelize'][(_0xad9f('0x55'))](_0xad9f('0x56'));}return _0x1ad793[_0xad9f('0x4e')](path[_0xad9f('0x52')](config[_0xad9f('0x53')],_0xad9f('0x54'),util[_0xad9f('0x57')]('%s.%s',_0x6f5eba[_0xad9f('0x58')],_0x6f5eba['converted_format'])),util[_0xad9f('0x57')](_0xad9f('0x59'),_0x6f5eba[_0xad9f('0x2c')],_0x6f5eba[_0xad9f('0x50')]));}return null;})[_0xad9f('0x4a')](handleError(_0x1ad793,null));};exports[_0xad9f('0x5a')]=function(_0x9eee6f,_0x96a77e,_0x3e55c9){var _0x3b0f96={'name':path[_0xad9f('0x5b')](_0x9eee6f[_0xad9f('0x5c')][_0xad9f('0x5d')],path['extname'](_0x9eee6f[_0xad9f('0x5c')][_0xad9f('0x5d')])),'save_name':path[_0xad9f('0x5b')](_0x9eee6f[_0xad9f('0x5c')][_0xad9f('0x5e')],path['extname'](_0x9eee6f['file'][_0xad9f('0x5e')])),'original_format':path[_0xad9f('0x5f')](_0x9eee6f[_0xad9f('0x5c')]['originalname'])[_0xad9f('0x60')](0x1),'converted_format':_0xad9f('0x61')};var _0x3a1f91=path[_0xad9f('0x52')](config[_0xad9f('0x53')],_0xad9f('0x62'),_0x9eee6f[_0xad9f('0x5c')][_0xad9f('0x5e')]);var _0x126937=path[_0xad9f('0x52')](config['root'],_0xad9f('0x54'),util[_0xad9f('0x57')](_0xad9f('0x59'),path[_0xad9f('0x5b')](_0x9eee6f['file']['filename'],path[_0xad9f('0x5f')](_0x9eee6f[_0xad9f('0x5c')]['filename'])),_0x3b0f96[_0xad9f('0x50')]));logger['info'](_0xad9f('0x63'),_0x3a1f91);logger[_0xad9f('0x64')](_0xad9f('0x65'),_0x126937);try{fs['chmodSync'](_0x3a1f91,parseInt('0777',0x8));var _0x361383=sox[_0xad9f('0x66')](_0x3a1f91,_0x126937,{'sampleRate':0x1f40,'format':_0xad9f('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x361383['on'](_0xad9f('0x2a'),function(_0x14c246){fs['unlinkSync'](_0x3a1f91);_0x96a77e[_0xad9f('0x1c')](0x1f4)[_0xad9f('0x2d')](_0x14c246);});_0x361383['on']('src',function(_0xca1af8){_0x3b0f96[_0xad9f('0x67')]=isNaN(_0xca1af8['duration'])?null:_0xca1af8[_0xad9f('0x68')]*0x3e8;_0x3b0f96[_0xad9f('0x69')]=isNaN(_0xca1af8[_0xad9f('0x6a')])?null:_0xca1af8['sampleCount'];_0x3b0f96[_0xad9f('0x6b')]=isNaN(_0xca1af8['channelCount'])?null:_0xca1af8['channelCount'];_0x3b0f96[_0xad9f('0x6c')]=isNaN(_0xca1af8['bitRate'])?null:_0xca1af8['bitRate'];_0x3b0f96[_0xad9f('0x6d')]=isNaN(_0xca1af8['sampleRate'])?null:_0xca1af8['sampleRate'];});_0x361383['on']('dest',function(_0x1c59c1){_0x3b0f96['converted_duration']=isNaN(_0x1c59c1['duration'])?null:_0x1c59c1['duration']*0x3e8;_0x3b0f96[_0xad9f('0x6e')]=isNaN(_0x1c59c1['sampleCount'])?null:_0x1c59c1[_0xad9f('0x6a')];_0x3b0f96[_0xad9f('0x6f')]=isNaN(_0x1c59c1[_0xad9f('0x70')])?null:_0x1c59c1[_0xad9f('0x70')];_0x3b0f96[_0xad9f('0x71')]=isNaN(_0x1c59c1[_0xad9f('0x72')])?null:_0x1c59c1[_0xad9f('0x72')];_0x3b0f96[_0xad9f('0x73')]=isNaN(_0x1c59c1[_0xad9f('0x74')])?null:_0x1c59c1[_0xad9f('0x74')];});_0x361383['on']('end',function(){fs[_0xad9f('0x75')](_0x126937,parseInt(_0xad9f('0x76'),0x8));return db[_0xad9f('0x30')][_0xad9f('0x5a')](_0x3b0f96)[_0xad9f('0x25')](function(_0x14563f){var _0xd09f67={'role':_0x9eee6f[_0xad9f('0x77')][_0xad9f('0x78')],'userProfileId':_0x9eee6f['body'][_0xad9f('0x79')]};if(!_0xd09f67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd09f67[_0xad9f('0x78')]===_0xad9f('0x7a')){var _0x11925e=_0x14563f[_0xad9f('0x27')]({'plain':!![]});return db[_0xad9f('0x7b')][_0xad9f('0x4f')]({'where':{'name':'Sounds','userProfileId':_0xd09f67[_0xad9f('0x79')]},'raw':!![]})[_0xad9f('0x25')](function(_0x5c3eff){if(_0x5c3eff&&_0x5c3eff[_0xad9f('0x7c')]===0x0){return db['UserProfileResource'][_0xad9f('0x5a')]({'name':_0x11925e[_0xad9f('0x2c')],'resourceId':_0x11925e['id'],'type':_0x5c3eff[_0xad9f('0x2c')],'sectionId':_0x5c3eff['id']},{})[_0xad9f('0x25')](function(){return _0x14563f;});}else{return _0x14563f;}})['catch'](function(_0x59c317){logger['error'](_0xad9f('0x7d'),_0x59c317);throw _0x59c317;});}return _0x14563f;})[_0xad9f('0x25')](respondWithResult(_0x96a77e,null))[_0xad9f('0x4a')](handleError(_0x96a77e,null));});_0x361383[_0xad9f('0x7e')]();}catch(_0x45829f){_0x96a77e['status'](0x1f4)[_0xad9f('0x2d')](_0x45829f);}};exports[_0xad9f('0x24')]=function(_0x2229c1,_0x13bc7d,_0x1f7cd5){return db['Sound']['find']({'where':{'id':_0x2229c1[_0xad9f('0x4c')]['id']}})[_0xad9f('0x25')](handleEntityNotFound(_0x13bc7d,null))['then'](saveUpdates(_[_0xad9f('0x41')](_0x2229c1[_0xad9f('0x77')],[_0xad9f('0x2c'),'description']),null))[_0xad9f('0x25')](respondWithResult(_0x13bc7d,null))['catch'](handleError(_0x13bc7d,null));};exports['delete']=function(_0x19ec7e,_0x1bf56c,_0x189d69){return db[_0xad9f('0x30')]['find']({'where':{'id':_0x19ec7e[_0xad9f('0x4c')]['id']}})[_0xad9f('0x25')](function(_0x23003f){if(_0x23003f){return _0x23003f[_0xad9f('0x26')]();}})[_0xad9f('0x25')](function(_0x59cb65){var _0x8d1c6e=path['join'](config[_0xad9f('0x53')],_0xad9f('0x62'),util[_0xad9f('0x57')](_0xad9f('0x59'),_0x59cb65[_0xad9f('0x58')],_0x59cb65[_0xad9f('0x7f')]));var _0x3d4d01=path[_0xad9f('0x52')](config[_0xad9f('0x53')],_0xad9f('0x54'),util[_0xad9f('0x57')](_0xad9f('0x59'),_0x59cb65[_0xad9f('0x58')],_0x59cb65[_0xad9f('0x50')]));fs[_0xad9f('0x80')](_0x8d1c6e);fs[_0xad9f('0x80')](_0x3d4d01);return _0x59cb65;})[_0xad9f('0x25')](function(_0x4696a0){if(_0x4696a0){return _0x1bf56c[_0xad9f('0x1c')](0xcc)['end']();}})[_0xad9f('0x25')](handleEntityNotFound(_0x1bf56c,null))[_0xad9f('0x4a')](handleError(_0x1bf56c,null));}; \ No newline at end of file +var _0xa94c=['where','merge','options','includeAll','include','show','find','catch','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','chmodSync','transcode','error','unlinkSync','src','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','duration','converted_sampleCount','converted_bitRate','converted_sampleRate','role','userProfileId','user','UserProfileSection','autoAssociation','start','body','description','delete','original_format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xa94c,0xb7));var _0xca94=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa94c[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0xca94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca94('0x2'));var moment=require(_0xca94('0x3'));var BPromise=require(_0xca94('0x4'));var Mustache=require(_0xca94('0x5'));var util=require('util');var path=require(_0xca94('0x6'));var sox=require(_0xca94('0x7'));var csv=require(_0xca94('0x8'));var ejs=require(_0xca94('0x9'));var fs=require('fs');var fs_extra=require(_0xca94('0xa'));var _=require(_0xca94('0xb'));var squel=require(_0xca94('0xc'));var crypto=require(_0xca94('0xd'));var jsforce=require(_0xca94('0xe'));var deskjs=require(_0xca94('0xf'));var toCsv=require('to-csv');var querystring=require(_0xca94('0x10'));var Papa=require(_0xca94('0x11'));var Redis=require(_0xca94('0x12'));var authService=require(_0xca94('0x13'));var qs=require(_0xca94('0x14'));var as=require(_0xca94('0x15'));var hardwareService=require(_0xca94('0x16'));var logger=require(_0xca94('0x17'))('api');var utils=require(_0xca94('0x18'));var config=require(_0xca94('0x19'));var licenseUtil=require(_0xca94('0x1a'));var db=require(_0xca94('0x1b'))['db'];function respondWithStatusCode(_0x723a92,_0x3cbf01){_0x3cbf01=_0x3cbf01||0xcc;return function(_0x657d13){if(_0x657d13){return _0x723a92['sendStatus'](_0x3cbf01);}return _0x723a92[_0xca94('0x1c')](_0x3cbf01)[_0xca94('0x1d')]();};}function respondWithResult(_0x1c8af2,_0xd94984){_0xd94984=_0xd94984||0xc8;return function(_0x69a239){if(_0x69a239){return _0x1c8af2[_0xca94('0x1c')](_0xd94984)[_0xca94('0x1e')](_0x69a239);}};}function respondWithFilteredResult(_0x2966a8,_0x3ee368){return function(_0xf0a33c){if(_0xf0a33c){var _0x1c7f26=typeof _0x3ee368[_0xca94('0x1f')]===_0xca94('0x20')&&typeof _0x3ee368[_0xca94('0x21')]===_0xca94('0x20');var _0x1e69cc=_0xf0a33c[_0xca94('0x22')];var _0x1179f3=_0x1c7f26?0x0:_0x3ee368[_0xca94('0x1f')];var _0x1244c1=_0x1c7f26?_0xf0a33c['count']:_0x3ee368['offset']+_0x3ee368[_0xca94('0x21')];var _0x2c941b;if(_0x1244c1>=_0x1e69cc){_0x1244c1=_0x1e69cc;_0x2c941b=0xc8;}else{_0x2c941b=0xce;}_0x2966a8[_0xca94('0x1c')](_0x2c941b);return _0x2966a8[_0xca94('0x23')](_0xca94('0x24'),_0x1179f3+'-'+_0x1244c1+'/'+_0x1e69cc)[_0xca94('0x1e')](_0xf0a33c);}return null;};}function patchUpdates(_0x4d9ab2){return function(_0x12b025){try{jsonpatch[_0xca94('0x25')](_0x12b025,_0x4d9ab2,!![]);}catch(_0x57c6e4){return BPromise[_0xca94('0x26')](_0x57c6e4);}return _0x12b025[_0xca94('0x27')]();};}function saveUpdates(_0x5539a4,_0x33b25c){return function(_0x63fc37){if(_0x63fc37){return _0x63fc37[_0xca94('0x28')](_0x5539a4)['then'](function(_0x310e7f){return _0x310e7f;});}return null;};}function removeEntity(_0x292122,_0x490212){return function(_0x1df379){if(_0x1df379){return _0x1df379[_0xca94('0x29')]()[_0xca94('0x2a')](function(){var _0x25f8ce=_0x1df379[_0xca94('0x2b')]({'plain':!![]});var _0x263d17=_0xca94('0x2c');return db['UserProfileResource'][_0xca94('0x29')]({'where':{'type':_0x263d17,'resourceId':_0x25f8ce['id']}})[_0xca94('0x2a')](function(){return _0x1df379;});})[_0xca94('0x2a')](function(){_0x292122[_0xca94('0x1c')](0xcc)[_0xca94('0x1d')]();});}};}function handleEntityNotFound(_0x5220f6,_0x1250e5){return function(_0x1be50b){if(!_0x1be50b){_0x5220f6[_0xca94('0x2d')](0x194);}return _0x1be50b;};}function handleError(_0x18c4b4,_0x4a2a20){_0x4a2a20=_0x4a2a20||0x1f4;return function(_0x2f5e57){logger['error'](_0x2f5e57[_0xca94('0x2e')]);if(_0x2f5e57[_0xca94('0x2f')]){delete _0x2f5e57[_0xca94('0x2f')];}_0x18c4b4[_0xca94('0x1c')](_0x4a2a20)[_0xca94('0x30')](_0x2f5e57);};}exports[_0xca94('0x31')]=function(_0x15a8d9,_0x1598c0){var _0x4ba19f={},_0x168f5d={},_0x9b8deb={'count':0x0,'rows':[]};var _0x380709=_[_0xca94('0x32')](db[_0xca94('0x33')][_0xca94('0x34')],function(_0x28350f){return{'name':_0x28350f[_0xca94('0x35')],'type':_0x28350f[_0xca94('0x36')]['key']};});_0x168f5d[_0xca94('0x37')]=_['map'](_0x380709,_0xca94('0x2f'));_0x168f5d[_0xca94('0x38')]=_[_0xca94('0x39')](_0x15a8d9[_0xca94('0x38')]);_0x168f5d['filters']=_[_0xca94('0x3a')](_0x168f5d[_0xca94('0x37')],_0x168f5d[_0xca94('0x38')]);_0x4ba19f[_0xca94('0x3b')]=_[_0xca94('0x3a')](_0x168f5d[_0xca94('0x37')],qs['fields'](_0x15a8d9['query'][_0xca94('0x3c')]));_0x4ba19f[_0xca94('0x3b')]=_0x4ba19f[_0xca94('0x3b')][_0xca94('0x3d')]?_0x4ba19f[_0xca94('0x3b')]:_0x168f5d['model'];if(!_0x15a8d9['query'][_0xca94('0x3e')](_0xca94('0x3f'))){_0x4ba19f[_0xca94('0x21')]=qs[_0xca94('0x21')](_0x15a8d9[_0xca94('0x38')][_0xca94('0x21')]);_0x4ba19f[_0xca94('0x1f')]=qs[_0xca94('0x1f')](_0x15a8d9[_0xca94('0x38')][_0xca94('0x1f')]);}_0x4ba19f[_0xca94('0x40')]=qs[_0xca94('0x41')](_0x15a8d9[_0xca94('0x38')]['sort']);_0x4ba19f['where']=qs[_0xca94('0x42')](_[_0xca94('0x43')](_0x15a8d9['query'],_0x168f5d[_0xca94('0x42')]),_0x380709);if(_0x15a8d9['query'][_0xca94('0x44')]){_0x4ba19f[_0xca94('0x45')]=_[_0xca94('0x46')](_0x4ba19f['where'],{'$or':_[_0xca94('0x32')](_0x380709,function(_0x23c13d){if(_0x23c13d[_0xca94('0x36')]!=='VIRTUAL'){var _0xcb1b51={};_0xcb1b51[_0x23c13d[_0xca94('0x2f')]]={'$like':'%'+_0x15a8d9[_0xca94('0x38')]['filter']+'%'};return _0xcb1b51;}})});}_0x4ba19f=_[_0xca94('0x46')]({},_0x4ba19f,_0x15a8d9[_0xca94('0x47')]);var _0x24e772={'where':_0x4ba19f['where']};return db[_0xca94('0x33')][_0xca94('0x22')](_0x24e772)[_0xca94('0x2a')](function(_0x32064b){_0x9b8deb[_0xca94('0x22')]=_0x32064b;if(_0x15a8d9[_0xca94('0x38')][_0xca94('0x48')]){_0x4ba19f[_0xca94('0x49')]=[{'all':!![]}];}return db[_0xca94('0x33')]['findAll'](_0x4ba19f);})[_0xca94('0x2a')](function(_0x5d9cc4){_0x9b8deb['rows']=_0x5d9cc4;return _0x9b8deb;})[_0xca94('0x2a')](respondWithFilteredResult(_0x1598c0,_0x4ba19f))['catch'](handleError(_0x1598c0,null));};exports[_0xca94('0x4a')]=function(_0x278c2a,_0x5daf02){var _0x309875={'raw':!![],'where':{'id':_0x278c2a['params']['id']}},_0x1e0b67={};_0x1e0b67['model']=_[_0xca94('0x39')](db[_0xca94('0x33')][_0xca94('0x34')]);_0x1e0b67[_0xca94('0x38')]=_[_0xca94('0x39')](_0x278c2a['query']);_0x1e0b67[_0xca94('0x42')]=_[_0xca94('0x3a')](_0x1e0b67[_0xca94('0x37')],_0x1e0b67[_0xca94('0x38')]);_0x309875['attributes']=_[_0xca94('0x3a')](_0x1e0b67['model'],qs[_0xca94('0x3c')](_0x278c2a[_0xca94('0x38')][_0xca94('0x3c')]));_0x309875[_0xca94('0x3b')]=_0x309875[_0xca94('0x3b')][_0xca94('0x3d')]?_0x309875[_0xca94('0x3b')]:_0x1e0b67[_0xca94('0x37')];if(_0x278c2a['query'][_0xca94('0x48')]){_0x309875[_0xca94('0x49')]=[{'all':!![]}];}_0x309875=_[_0xca94('0x46')]({},_0x309875,_0x278c2a['options']);return db[_0xca94('0x33')][_0xca94('0x4b')](_0x309875)[_0xca94('0x2a')](handleEntityNotFound(_0x5daf02,null))[_0xca94('0x2a')](respondWithResult(_0x5daf02,null))[_0xca94('0x4c')](handleError(_0x5daf02,null));};exports[_0xca94('0x4d')]=function(_0x3633af,_0x219cd1,_0x3a4c72){return db[_0xca94('0x33')][_0xca94('0x4b')]({'where':{'id':_0x3633af['params']['id']},'attributes':['name',_0xca94('0x4e'),_0xca94('0x4f')],'raw':!![]})[_0xca94('0x2a')](handleEntityNotFound(_0x219cd1,null))[_0xca94('0x2a')](function(_0x4f9b02){if(_0x4f9b02){if(!fs[_0xca94('0x50')](path[_0xca94('0x51')](config[_0xca94('0x52')],'server/files/sounds/converted',_0x4f9b02[_0xca94('0x4e')]+'.'+_0x4f9b02[_0xca94('0x4f')]))){throw new db[(_0xca94('0x53'))][(_0xca94('0x54'))](_0xca94('0x55'));}return _0x219cd1[_0xca94('0x4d')](path[_0xca94('0x51')](config[_0xca94('0x52')],_0xca94('0x56'),util[_0xca94('0x57')](_0xca94('0x58'),_0x4f9b02[_0xca94('0x4e')],_0x4f9b02[_0xca94('0x4f')])),util['format'](_0xca94('0x58'),_0x4f9b02['name'],_0x4f9b02[_0xca94('0x4f')]));}return null;})[_0xca94('0x4c')](handleError(_0x219cd1,null));};exports[_0xca94('0x59')]=function(_0x5494f9,_0x4dc73e,_0x3f1631){var _0x2322d0={'name':path[_0xca94('0x5a')](_0x5494f9[_0xca94('0x5b')][_0xca94('0x5c')],path[_0xca94('0x5d')](_0x5494f9[_0xca94('0x5b')][_0xca94('0x5c')])),'save_name':path[_0xca94('0x5a')](_0x5494f9[_0xca94('0x5b')][_0xca94('0x5e')],path[_0xca94('0x5d')](_0x5494f9[_0xca94('0x5b')][_0xca94('0x5e')])),'original_format':path[_0xca94('0x5d')](_0x5494f9[_0xca94('0x5b')][_0xca94('0x5c')])[_0xca94('0x5f')](0x1),'converted_format':_0xca94('0x60')};var _0x56077d=path[_0xca94('0x51')](config[_0xca94('0x52')],_0xca94('0x61'),_0x5494f9[_0xca94('0x5b')]['filename']);var _0x3b14f2=path['join'](config['root'],_0xca94('0x56'),util[_0xca94('0x57')](_0xca94('0x58'),path[_0xca94('0x5a')](_0x5494f9[_0xca94('0x5b')]['filename'],path[_0xca94('0x5d')](_0x5494f9[_0xca94('0x5b')]['filename'])),_0x2322d0[_0xca94('0x4f')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x56077d);logger[_0xca94('0x62')]('Sound\x20upload\x20destination:\x20%s',_0x3b14f2);try{fs[_0xca94('0x63')](_0x56077d,parseInt('0777',0x8));var _0xf08929=sox[_0xca94('0x64')](_0x56077d,_0x3b14f2,{'sampleRate':0x1f40,'format':_0xca94('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf08929['on'](_0xca94('0x65'),function(_0x314131){fs[_0xca94('0x66')](_0x56077d);_0x4dc73e[_0xca94('0x1c')](0x1f4)[_0xca94('0x30')](_0x314131);});_0xf08929['on'](_0xca94('0x67'),function(_0x572a58){_0x2322d0['original_duration']=isNaN(_0x572a58['duration'])?null:_0x572a58['duration']*0x3e8;_0x2322d0[_0xca94('0x68')]=isNaN(_0x572a58[_0xca94('0x69')])?null:_0x572a58[_0xca94('0x69')];_0x2322d0[_0xca94('0x6a')]=isNaN(_0x572a58[_0xca94('0x6b')])?null:_0x572a58['channelCount'];_0x2322d0[_0xca94('0x6c')]=isNaN(_0x572a58[_0xca94('0x6d')])?null:_0x572a58[_0xca94('0x6d')];_0x2322d0[_0xca94('0x6e')]=isNaN(_0x572a58[_0xca94('0x6f')])?null:_0x572a58[_0xca94('0x6f')];});_0xf08929['on']('dest',function(_0x24e227){_0x2322d0['converted_duration']=isNaN(_0x24e227['duration'])?null:_0x24e227[_0xca94('0x70')]*0x3e8;_0x2322d0[_0xca94('0x71')]=isNaN(_0x24e227[_0xca94('0x69')])?null:_0x24e227[_0xca94('0x69')];_0x2322d0['converted_channelCount']=isNaN(_0x24e227[_0xca94('0x6b')])?null:_0x24e227[_0xca94('0x6b')];_0x2322d0[_0xca94('0x72')]=isNaN(_0x24e227['bitRate'])?null:_0x24e227['bitRate'];_0x2322d0[_0xca94('0x73')]=isNaN(_0x24e227[_0xca94('0x6f')])?null:_0x24e227[_0xca94('0x6f')];});_0xf08929['on'](_0xca94('0x1d'),function(){fs[_0xca94('0x63')](_0x3b14f2,parseInt('0777',0x8));return db[_0xca94('0x33')][_0xca94('0x59')](_0x2322d0)[_0xca94('0x2a')](function(_0x26f38b){var _0x5c095e={'role':_0x5494f9['body'][_0xca94('0x74')],'userProfileId':_0x5494f9['body'][_0xca94('0x75')]};if(!_0x5c095e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c095e[_0xca94('0x74')]===_0xca94('0x76')){var _0x3db9fd=_0x26f38b[_0xca94('0x2b')]({'plain':!![]});return db[_0xca94('0x77')][_0xca94('0x4b')]({'where':{'name':_0xca94('0x2c'),'userProfileId':_0x5c095e[_0xca94('0x75')]},'raw':!![]})[_0xca94('0x2a')](function(_0x2a0f97){if(_0x2a0f97&&_0x2a0f97[_0xca94('0x78')]===0x0){return db['UserProfileResource'][_0xca94('0x59')]({'name':_0x3db9fd[_0xca94('0x2f')],'resourceId':_0x3db9fd['id'],'type':_0x2a0f97['name'],'sectionId':_0x2a0f97['id']},{})[_0xca94('0x2a')](function(){return _0x26f38b;});}else{return _0x26f38b;}})[_0xca94('0x4c')](function(_0x63be7a){logger[_0xca94('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63be7a);throw _0x63be7a;});}return _0x26f38b;})['then'](respondWithResult(_0x4dc73e,null))[_0xca94('0x4c')](handleError(_0x4dc73e,null));});_0xf08929[_0xca94('0x79')]();}catch(_0x5b4e30){_0x4dc73e[_0xca94('0x1c')](0x1f4)[_0xca94('0x30')](_0x5b4e30);}};exports['update']=function(_0x1f04f2,_0x4be668,_0x597a80){return db[_0xca94('0x33')][_0xca94('0x4b')]({'where':{'id':_0x1f04f2['params']['id']}})['then'](handleEntityNotFound(_0x4be668,null))['then'](saveUpdates(_[_0xca94('0x43')](_0x1f04f2[_0xca94('0x7a')],[_0xca94('0x2f'),_0xca94('0x7b')]),null))[_0xca94('0x2a')](respondWithResult(_0x4be668,null))['catch'](handleError(_0x4be668,null));};exports[_0xca94('0x7c')]=function(_0x3f6f7e,_0x346bdf,_0xbc0986){return db['Sound'][_0xca94('0x4b')]({'where':{'id':_0x3f6f7e['params']['id']}})[_0xca94('0x2a')](function(_0x23995e){if(_0x23995e){return _0x23995e[_0xca94('0x29')]();}})[_0xca94('0x2a')](function(_0x369585){var _0x23a104=path[_0xca94('0x51')](config[_0xca94('0x52')],_0xca94('0x61'),util[_0xca94('0x57')](_0xca94('0x58'),_0x369585[_0xca94('0x4e')],_0x369585[_0xca94('0x7d')]));var _0x37f18e=path[_0xca94('0x51')](config[_0xca94('0x52')],_0xca94('0x56'),util[_0xca94('0x57')](_0xca94('0x58'),_0x369585[_0xca94('0x4e')],_0x369585[_0xca94('0x4f')]));fs[_0xca94('0x66')](_0x23a104);fs['unlinkSync'](_0x37f18e);return _0x369585;})[_0xca94('0x2a')](function(_0xc5a105){if(_0xc5a105){return _0x346bdf[_0xca94('0x1c')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x346bdf,null))[_0xca94('0x4c')](handleError(_0x346bdf,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index bbfeb7d..93c5645 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 _0x7c52=['define','tools_sounds','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x266d29,_0x2b6b29){var _0x33bbbd=function(_0x3b934d){while(--_0x3b934d){_0x266d29['push'](_0x266d29['shift']());}};_0x33bbbd(++_0x2b6b29);}(_0x7c52,0x1d6));var _0x27c5=function(_0x19c135,_0x2a9aba){_0x19c135=_0x19c135-0x0;var _0x52c8c8=_0x7c52[_0x19c135];return _0x52c8c8;};'use strict';var _=require(_0x27c5('0x0'));var util=require(_0x27c5('0x1'));var logger=require(_0x27c5('0x2'))(_0x27c5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x27c5('0x4'));var fs=require('fs');var path=require(_0x27c5('0x5'));var rimraf=require(_0x27c5('0x6'));var config=require(_0x27c5('0x7'));var attributes=require(_0x27c5('0x8'));module[_0x27c5('0x9')]=function(_0x6497d8,_0x1af531){return _0x6497d8[_0x27c5('0xa')]('Sound',attributes,{'tableName':_0x27c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x4512c6,_0x1940e8){var _0x35e1fa=function(_0x3bb6b2){while(--_0x3bb6b2){_0x4512c6['push'](_0x4512c6['shift']());}};_0x35e1fa(++_0x1940e8);}(_0x89cf,0x1d9));var _0xf89c=function(_0x328ac8,_0x10b008){_0x328ac8=_0x328ac8-0x0;var _0x1de83d=_0x89cf[_0x328ac8];return _0x1de83d;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var logger=require(_0xf89c('0x2'))(_0xf89c('0x3'));var moment=require('moment');var BPromise=require(_0xf89c('0x4'));var rp=require(_0xf89c('0x5'));var fs=require('fs');var path=require(_0xf89c('0x6'));var rimraf=require(_0xf89c('0x7'));var config=require(_0xf89c('0x8'));var attributes=require(_0xf89c('0x9'));module[_0xf89c('0xa')]=function(_0x2ef69d,_0x46750b){return _0x2ef69d[_0xf89c('0xb')](_0xf89c('0xc'),attributes,{'tableName':_0xf89c('0xd'),'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 9982633..31e5b7c 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 _0xe117=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','request\x20sent','result','catch','Sound','find','options','where','attributes','include','map','model','ShowSound','moment','bluebird','randomstring'];(function(_0x107d3a,_0x27b1d9){var _0x146a39=function(_0x102388){while(--_0x102388){_0x107d3a['push'](_0x107d3a['shift']());}};_0x146a39(++_0x27b1d9);}(_0xe117,0xbd));var _0x7e11=function(_0x2ee949,_0x4e060f){_0x2ee949=_0x2ee949-0x0;var _0x4d80a4=_0xe117[_0x2ee949];return _0x4d80a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e11('0x0'));var BPromise=require(_0x7e11('0x1'));var rs=require(_0x7e11('0x2'));var fs=require('fs');var Redis=require(_0x7e11('0x3'));var db=require(_0x7e11('0x4'))['db'];var utils=require(_0x7e11('0x5'));var logger=require(_0x7e11('0x6'))(_0x7e11('0x7'));var config=require(_0x7e11('0x8'));var jayson=require(_0x7e11('0x9'));var client=jayson[_0x7e11('0xa')][_0x7e11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f78f0,_0x26feb6,_0x36d872){return new BPromise(function(_0x30f3a3,_0x29673a){return client['request'](_0x3f78f0,_0x36d872)[_0x7e11('0xc')](function(_0x577f08){logger['info']('Sound,\x20%s,\x20%s',_0x26feb6,'request\x20sent');logger[_0x7e11('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x26feb6,'request\x20sent',JSON[_0x7e11('0xe')](_0x577f08));if(_0x577f08[_0x7e11('0xf')]){if(_0x577f08['error'][_0x7e11('0x10')]===0x1f4){logger['error'](_0x7e11('0x11'),_0x26feb6,_0x577f08[_0x7e11('0xf')][_0x7e11('0x12')]);return _0x29673a(_0x577f08['error'][_0x7e11('0x12')]);}logger[_0x7e11('0xf')]('Sound,\x20%s,\x20%s',_0x26feb6,_0x577f08['error'][_0x7e11('0x12')]);return _0x30f3a3(_0x577f08[_0x7e11('0xf')][_0x7e11('0x12')]);}else{logger[_0x7e11('0x13')](_0x7e11('0x11'),_0x26feb6,_0x7e11('0x14'));_0x30f3a3(_0x577f08[_0x7e11('0x15')]['message']);}})[_0x7e11('0x16')](function(_0x25ba60){logger[_0x7e11('0xf')](_0x7e11('0x11'),_0x26feb6,_0x25ba60);_0x29673a(_0x25ba60);});});}exports['ShowSound']=function(_0x5a26bc){var _0xf8b5e4=this;return new Promise(function(_0x5227ad,_0x5d7fd2){return db[_0x7e11('0x17')][_0x7e11('0x18')]({'raw':_0x5a26bc[_0x7e11('0x19')]?_0x5a26bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a26bc['options']?_0x5a26bc[_0x7e11('0x19')][_0x7e11('0x1a')]||null:null,'attributes':_0x5a26bc[_0x7e11('0x19')]?_0x5a26bc[_0x7e11('0x19')][_0x7e11('0x1b')]||null:null,'include':_0x5a26bc[_0x7e11('0x19')]?_0x5a26bc[_0x7e11('0x19')][_0x7e11('0x1c')]?_[_0x7e11('0x1d')](_0x5a26bc[_0x7e11('0x19')]['include'],function(_0x6e534d){return{'model':db[_0x6e534d[_0x7e11('0x1e')]],'as':_0x6e534d['as'],'attributes':_0x6e534d[_0x7e11('0x1b')],'include':_0x6e534d[_0x7e11('0x1c')]?_[_0x7e11('0x1d')](_0x6e534d[_0x7e11('0x1c')],function(_0x2b28ae){return{'model':db[_0x2b28ae['model']],'as':_0x2b28ae['as'],'attributes':_0x2b28ae[_0x7e11('0x1b')],'include':_0x2b28ae[_0x7e11('0x1c')]?_[_0x7e11('0x1d')](_0x2b28ae[_0x7e11('0x1c')],function(_0x2d656f){return{'model':db[_0x2d656f[_0x7e11('0x1e')]],'as':_0x2d656f['as'],'attributes':_0x2d656f[_0x7e11('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7e11('0xc')](function(_0x67dd28){logger['info'](_0x7e11('0x1f'),_0x5a26bc);logger['debug'](_0x7e11('0x1f'),_0x5a26bc,JSON['stringify'](_0x67dd28));_0x5227ad(_0x67dd28);})['catch'](function(_0x640b60){logger[_0x7e11('0xf')](_0x7e11('0x1f'),_0x640b60[_0x7e11('0x12')],_0x5a26bc);_0x5d7fd2(_0xf8b5e4['error'](0x1f4,_0x640b60[_0x7e11('0x12')]));});});}; \ No newline at end of file +var _0xdc66=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdc66,0x189));var _0x6dc6=function(_0x6054be,_0x2f4ffa){_0x6054be=_0x6054be-0x0;var _0xd1d697=_0xdc66[_0x6054be];return _0xd1d697;};'use strict';var _=require(_0x6dc6('0x0'));var util=require('util');var moment=require(_0x6dc6('0x1'));var BPromise=require(_0x6dc6('0x2'));var rs=require(_0x6dc6('0x3'));var fs=require('fs');var Redis=require(_0x6dc6('0x4'));var db=require(_0x6dc6('0x5'))['db'];var utils=require(_0x6dc6('0x6'));var logger=require(_0x6dc6('0x7'))(_0x6dc6('0x8'));var config=require(_0x6dc6('0x9'));var jayson=require(_0x6dc6('0xa'));var client=jayson[_0x6dc6('0xb')][_0x6dc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x170ff6,_0x24f229,_0x594d70){return new BPromise(function(_0x4ee662,_0x5e512f){return client[_0x6dc6('0xd')](_0x170ff6,_0x594d70)[_0x6dc6('0xe')](function(_0x3b39de){logger['info'](_0x6dc6('0xf'),_0x24f229,_0x6dc6('0x10'));logger[_0x6dc6('0x11')](_0x6dc6('0x12'),_0x24f229,_0x6dc6('0x10'),JSON[_0x6dc6('0x13')](_0x3b39de));if(_0x3b39de[_0x6dc6('0x14')]){if(_0x3b39de['error'][_0x6dc6('0x15')]===0x1f4){logger[_0x6dc6('0x14')](_0x6dc6('0xf'),_0x24f229,_0x3b39de['error'][_0x6dc6('0x16')]);return _0x5e512f(_0x3b39de[_0x6dc6('0x14')][_0x6dc6('0x16')]);}logger[_0x6dc6('0x14')](_0x6dc6('0xf'),_0x24f229,_0x3b39de[_0x6dc6('0x14')][_0x6dc6('0x16')]);return _0x4ee662(_0x3b39de[_0x6dc6('0x14')][_0x6dc6('0x16')]);}else{logger[_0x6dc6('0x17')]('Sound,\x20%s,\x20%s',_0x24f229,_0x6dc6('0x10'));_0x4ee662(_0x3b39de[_0x6dc6('0x18')][_0x6dc6('0x16')]);}})[_0x6dc6('0x19')](function(_0x2b631c){logger['error'](_0x6dc6('0xf'),_0x24f229,_0x2b631c);_0x5e512f(_0x2b631c);});});}exports[_0x6dc6('0x1a')]=function(_0xb60233){var _0x527d03=this;return new Promise(function(_0x929797,_0x3aafd0){return db[_0x6dc6('0x1b')][_0x6dc6('0x1c')]({'raw':_0xb60233[_0x6dc6('0x1d')]?_0xb60233[_0x6dc6('0x1d')][_0x6dc6('0x1e')]===undefined?!![]:![]:!![],'where':_0xb60233[_0x6dc6('0x1d')]?_0xb60233[_0x6dc6('0x1d')][_0x6dc6('0x1f')]||null:null,'attributes':_0xb60233[_0x6dc6('0x1d')]?_0xb60233['options'][_0x6dc6('0x20')]||null:null,'include':_0xb60233[_0x6dc6('0x1d')]?_0xb60233[_0x6dc6('0x1d')][_0x6dc6('0x21')]?_[_0x6dc6('0x22')](_0xb60233[_0x6dc6('0x1d')][_0x6dc6('0x21')],function(_0x3b7e77){return{'model':db[_0x3b7e77['model']],'as':_0x3b7e77['as'],'attributes':_0x3b7e77[_0x6dc6('0x20')],'include':_0x3b7e77[_0x6dc6('0x21')]?_[_0x6dc6('0x22')](_0x3b7e77[_0x6dc6('0x21')],function(_0x4b00e6){return{'model':db[_0x4b00e6['model']],'as':_0x4b00e6['as'],'attributes':_0x4b00e6['attributes'],'include':_0x4b00e6['include']?_['map'](_0x4b00e6[_0x6dc6('0x21')],function(_0x29919f){return{'model':db[_0x29919f[_0x6dc6('0x23')]],'as':_0x29919f['as'],'attributes':_0x29919f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dc6('0xe')](function(_0x5e584d){logger[_0x6dc6('0x17')](_0x6dc6('0x1a'),_0xb60233);logger['debug'](_0x6dc6('0x1a'),_0xb60233,JSON[_0x6dc6('0x13')](_0x5e584d));_0x929797(_0x5e584d);})['catch'](function(_0x573dec){logger['error'](_0x6dc6('0x1a'),_0x573dec[_0x6dc6('0x16')],_0xb60233);_0x3aafd0(_0x527d03[_0x6dc6('0x14')](0x1f4,_0x573dec[_0x6dc6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4cd9250..db37bf7 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xda2d,0x102));var _0xdda2=function(_0x2fb7ea,_0x160bab){_0x2fb7ea=_0x2fb7ea-0x0;var _0x588903=_0xda2d[_0x2fb7ea];return _0x588903;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x20c290,_0x47e736){var _0x3d7b3b=function(_0x5d837f){while(--_0x5d837f){_0x20c290['push'](_0x20c290['shift']());}};_0x3d7b3b(++_0x47e736);}(_0x4fc2,0x111));var _0x24fc=function(_0x3b6c2e,_0xb4d3ce){_0x3b6c2e=_0x3b6c2e-0x0;var _0x4e4e3f=_0x4fc2[_0x3b6c2e];return _0x4e4e3f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a703419..34f013c 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 _0x1313=['STRING','TEXT','ENUM','out','sequelize','exports'];(function(_0x1e7622,_0x2bb9cf){var _0x1c17a7=function(_0x35abb6){while(--_0x35abb6){_0x1e7622['push'](_0x1e7622['shift']());}};_0x1c17a7(++_0x2bb9cf);}(_0x1313,0xee));var _0x3131=function(_0x115696,_0x5ed701){_0x115696=_0x115696-0x0;var _0x393bbf=_0x1313[_0x115696];return _0x393bbf;};'use strict';var Sequelize=require(_0x3131('0x0'));module[_0x3131('0x1')]={'uniqueid':{'type':Sequelize[_0x3131('0x2')]},'body':{'type':Sequelize[_0x3131('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x3131('0x4')]('in',_0x3131('0x5')),'defaultValue':_0x3131('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3131('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8949=['STRING','exports','TEXT','medium','out'];(function(_0xa4448d,_0x394342){var _0x58bcf8=function(_0x7f5037){while(--_0x7f5037){_0xa4448d['push'](_0xa4448d['shift']());}};_0x58bcf8(++_0x394342);}(_0x8949,0x18c));var _0x9894=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0x8949[_0x1489ef];return _0x20e0e6;};'use strict';var Sequelize=require('sequelize');module[_0x9894('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x9894('0x1')](_0x9894('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9894('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9894('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index fb34721..4b01a1a 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 _0xa3b7=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','SquareMessage','rows','show','params','find','catch','create','body','eml-format','zip-dir','request-promise','moment'];(function(_0x29b01f,_0x13e8bb){var _0xf7d6c3=function(_0x4e0af6){while(--_0x4e0af6){_0x29b01f['push'](_0x29b01f['shift']());}};_0xf7d6c3(++_0x13e8bb);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xa3b7[_0x4cc492];return _0x1f36b9;};'use strict';var emlformat=require(_0x7a3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a3b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a3b('0x2'));var moment=require(_0x7a3b('0x3'));var BPromise=require(_0x7a3b('0x4'));var Mustache=require(_0x7a3b('0x5'));var util=require(_0x7a3b('0x6'));var path=require(_0x7a3b('0x7'));var sox=require(_0x7a3b('0x8'));var csv=require('to-csv');var ejs=require(_0x7a3b('0x9'));var fs=require('fs');var fs_extra=require(_0x7a3b('0xa'));var _=require(_0x7a3b('0xb'));var squel=require(_0x7a3b('0xc'));var crypto=require(_0x7a3b('0xd'));var jsforce=require(_0x7a3b('0xe'));var deskjs=require(_0x7a3b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a3b('0x10'));var Papa=require(_0x7a3b('0x11'));var Redis=require(_0x7a3b('0x12'));var authService=require(_0x7a3b('0x13'));var qs=require(_0x7a3b('0x14'));var as=require(_0x7a3b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a3b('0x16'))(_0x7a3b('0x17'));var utils=require(_0x7a3b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7a3b('0x19'));var db=require(_0x7a3b('0x1a'))['db'];function respondWithStatusCode(_0x5a5897,_0x2110d9){_0x2110d9=_0x2110d9||0xcc;return function(_0x12b073){if(_0x12b073){return _0x5a5897[_0x7a3b('0x1b')](_0x2110d9);}return _0x5a5897['status'](_0x2110d9)[_0x7a3b('0x1c')]();};}function respondWithResult(_0x4167d0,_0x346609){_0x346609=_0x346609||0xc8;return function(_0x4e27a9){if(_0x4e27a9){return _0x4167d0[_0x7a3b('0x1d')](_0x346609)[_0x7a3b('0x1e')](_0x4e27a9);}};}function respondWithFilteredResult(_0x530172,_0x335a43){return function(_0x312be6){if(_0x312be6){var _0x3267c5=typeof _0x335a43['offset']===_0x7a3b('0x1f')&&typeof _0x335a43[_0x7a3b('0x20')]==='undefined';var _0x444129=_0x312be6['count'];var _0x6de066=_0x3267c5?0x0:_0x335a43['offset'];var _0x27d5a1=_0x3267c5?_0x312be6[_0x7a3b('0x21')]:_0x335a43[_0x7a3b('0x22')]+_0x335a43[_0x7a3b('0x20')];var _0x58bb3a;if(_0x27d5a1>=_0x444129){_0x27d5a1=_0x444129;_0x58bb3a=0xc8;}else{_0x58bb3a=0xce;}_0x530172[_0x7a3b('0x1d')](_0x58bb3a);return _0x530172[_0x7a3b('0x23')](_0x7a3b('0x24'),_0x6de066+'-'+_0x27d5a1+'/'+_0x444129)[_0x7a3b('0x1e')](_0x312be6);}return null;};}function patchUpdates(_0x329123){return function(_0x1492d8){try{jsonpatch[_0x7a3b('0x25')](_0x1492d8,_0x329123,!![]);}catch(_0x3259f2){return BPromise[_0x7a3b('0x26')](_0x3259f2);}return _0x1492d8[_0x7a3b('0x27')]();};}function saveUpdates(_0x4622d5,_0x4138dc){return function(_0x4cfc79){if(_0x4cfc79){return _0x4cfc79[_0x7a3b('0x28')](_0x4622d5)['then'](function(_0x16410e){return _0x16410e;});}return null;};}function removeEntity(_0xaff1c2,_0x53b165){return function(_0x11f60b){if(_0x11f60b){return _0x11f60b[_0x7a3b('0x29')]()[_0x7a3b('0x2a')](function(){_0xaff1c2['status'](0xcc)[_0x7a3b('0x1c')]();});}};}function handleEntityNotFound(_0x2b8ee5,_0x285b78){return function(_0x22f15b){if(!_0x22f15b){_0x2b8ee5['sendStatus'](0x194);}return _0x22f15b;};}function handleError(_0x1b8965,_0x5950a4){_0x5950a4=_0x5950a4||0x1f4;return function(_0x599389){logger[_0x7a3b('0x2b')](_0x599389[_0x7a3b('0x2c')]);if(_0x599389[_0x7a3b('0x2d')]){delete _0x599389[_0x7a3b('0x2d')];}_0x1b8965[_0x7a3b('0x1d')](_0x5950a4)[_0x7a3b('0x2e')](_0x599389);};}exports[_0x7a3b('0x2f')]=function(_0x447252,_0x2224ed){var _0x440f90={},_0xaf37af={},_0x43653c={'count':0x0,'rows':[]};var _0x4c8d74=_['map'](db['SquareMessage'][_0x7a3b('0x30')],function(_0x170464){return{'name':_0x170464[_0x7a3b('0x31')],'type':_0x170464[_0x7a3b('0x32')][_0x7a3b('0x33')]};});_0xaf37af[_0x7a3b('0x34')]=_[_0x7a3b('0x35')](_0x4c8d74,_0x7a3b('0x2d'));_0xaf37af[_0x7a3b('0x36')]=_[_0x7a3b('0x37')](_0x447252['query']);_0xaf37af[_0x7a3b('0x38')]=_[_0x7a3b('0x39')](_0xaf37af[_0x7a3b('0x34')],_0xaf37af['query']);_0x440f90[_0x7a3b('0x3a')]=_[_0x7a3b('0x39')](_0xaf37af[_0x7a3b('0x34')],qs[_0x7a3b('0x3b')](_0x447252[_0x7a3b('0x36')]['fields']));_0x440f90[_0x7a3b('0x3a')]=_0x440f90[_0x7a3b('0x3a')][_0x7a3b('0x3c')]?_0x440f90['attributes']:_0xaf37af[_0x7a3b('0x34')];if(!_0x447252[_0x7a3b('0x36')][_0x7a3b('0x3d')](_0x7a3b('0x3e'))){_0x440f90[_0x7a3b('0x20')]=qs[_0x7a3b('0x20')](_0x447252['query'][_0x7a3b('0x20')]);_0x440f90[_0x7a3b('0x22')]=qs[_0x7a3b('0x22')](_0x447252[_0x7a3b('0x36')]['offset']);}_0x440f90[_0x7a3b('0x3f')]=qs[_0x7a3b('0x40')](_0x447252[_0x7a3b('0x36')][_0x7a3b('0x40')]);_0x440f90[_0x7a3b('0x41')]=qs['filters'](_['pick'](_0x447252[_0x7a3b('0x36')],_0xaf37af['filters']),_0x4c8d74);if(_0x447252[_0x7a3b('0x36')][_0x7a3b('0x42')]){_0x440f90[_0x7a3b('0x41')]=_['merge'](_0x440f90['where'],{'$or':_[_0x7a3b('0x35')](_0x4c8d74,function(_0x556954){if(_0x556954[_0x7a3b('0x32')]!=='VIRTUAL'){var _0x3f68f1={};_0x3f68f1[_0x556954['name']]={'$like':'%'+_0x447252[_0x7a3b('0x36')][_0x7a3b('0x42')]+'%'};return _0x3f68f1;}})});}_0x440f90=_[_0x7a3b('0x43')]({},_0x440f90,_0x447252['options']);var _0x1c43b4={'where':_0x440f90[_0x7a3b('0x41')]};return db['SquareMessage'][_0x7a3b('0x21')](_0x1c43b4)[_0x7a3b('0x2a')](function(_0x358ca8){_0x43653c[_0x7a3b('0x21')]=_0x358ca8;if(_0x447252[_0x7a3b('0x36')][_0x7a3b('0x44')]){_0x440f90[_0x7a3b('0x45')]=[{'all':!![]}];}return db[_0x7a3b('0x46')]['findAll'](_0x440f90);})[_0x7a3b('0x2a')](function(_0x4f81e9){_0x43653c[_0x7a3b('0x47')]=_0x4f81e9;return _0x43653c;})[_0x7a3b('0x2a')](respondWithFilteredResult(_0x2224ed,_0x440f90))['catch'](handleError(_0x2224ed,null));};exports[_0x7a3b('0x48')]=function(_0x2e5165,_0x1d795f){var _0x34aa36={'raw':!![],'where':{'id':_0x2e5165[_0x7a3b('0x49')]['id']}},_0x2c1cec={};_0x2c1cec[_0x7a3b('0x34')]=_[_0x7a3b('0x37')](db[_0x7a3b('0x46')]['rawAttributes']);_0x2c1cec[_0x7a3b('0x36')]=_[_0x7a3b('0x37')](_0x2e5165[_0x7a3b('0x36')]);_0x2c1cec[_0x7a3b('0x38')]=_[_0x7a3b('0x39')](_0x2c1cec[_0x7a3b('0x34')],_0x2c1cec[_0x7a3b('0x36')]);_0x34aa36[_0x7a3b('0x3a')]=_[_0x7a3b('0x39')](_0x2c1cec['model'],qs[_0x7a3b('0x3b')](_0x2e5165['query'][_0x7a3b('0x3b')]));_0x34aa36[_0x7a3b('0x3a')]=_0x34aa36[_0x7a3b('0x3a')]['length']?_0x34aa36['attributes']:_0x2c1cec[_0x7a3b('0x34')];if(_0x2e5165[_0x7a3b('0x36')]['includeAll']){_0x34aa36[_0x7a3b('0x45')]=[{'all':!![]}];}_0x34aa36=_[_0x7a3b('0x43')]({},_0x34aa36,_0x2e5165['options']);return db[_0x7a3b('0x46')][_0x7a3b('0x4a')](_0x34aa36)['then'](handleEntityNotFound(_0x1d795f,null))[_0x7a3b('0x2a')](respondWithResult(_0x1d795f,null))[_0x7a3b('0x4b')](handleError(_0x1d795f,null));};exports[_0x7a3b('0x4c')]=function(_0x57b1f4,_0x2603be){return db[_0x7a3b('0x46')][_0x7a3b('0x4c')](_0x57b1f4['body'],{})['then'](respondWithResult(_0x2603be,0xc9))[_0x7a3b('0x4b')](handleError(_0x2603be,null));};exports['update']=function(_0x2b9183,_0x17259c){if(_0x2b9183[_0x7a3b('0x4d')]['id']){delete _0x2b9183[_0x7a3b('0x4d')]['id'];}return db['SquareMessage'][_0x7a3b('0x4a')]({'where':{'id':_0x2b9183[_0x7a3b('0x49')]['id']}})['then'](handleEntityNotFound(_0x17259c,null))['then'](saveUpdates(_0x2b9183[_0x7a3b('0x4d')],null))['then'](respondWithResult(_0x17259c,null))[_0x7a3b('0x4b')](handleError(_0x17259c,null));};exports[_0x7a3b('0x29')]=function(_0x501fbe,_0x580bfb){return db[_0x7a3b('0x46')]['find']({'where':{'id':_0x501fbe[_0x7a3b('0x49')]['id']}})[_0x7a3b('0x2a')](handleEntityNotFound(_0x580bfb,null))['then'](removeEntity(_0x580bfb,null))[_0x7a3b('0x4b')](handleError(_0x580bfb,null));}; \ No newline at end of file +var _0xcbbb=['../../config/environment','../../config/license/util','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','status','sendStatus','stack','name','index','map','SquareMessage','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0xcbbb,0x1ee));var _0xbcbb=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xcbbb[_0x5eb22e];return _0x27fed5;};'use strict';var emlformat=require(_0xbcbb('0x0'));var rimraf=require(_0xbcbb('0x1'));var zipdir=require(_0xbcbb('0x2'));var jsonpatch=require(_0xbcbb('0x3'));var rp=require(_0xbcbb('0x4'));var moment=require(_0xbcbb('0x5'));var BPromise=require(_0xbcbb('0x6'));var Mustache=require(_0xbcbb('0x7'));var util=require(_0xbcbb('0x8'));var path=require(_0xbcbb('0x9'));var sox=require(_0xbcbb('0xa'));var csv=require(_0xbcbb('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcbb('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbcbb('0xd'));var jsforce=require(_0xbcbb('0xe'));var deskjs=require(_0xbcbb('0xf'));var toCsv=require(_0xbcbb('0xb'));var querystring=require(_0xbcbb('0x10'));var Papa=require('papaparse');var Redis=require(_0xbcbb('0x11'));var authService=require(_0xbcbb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbcbb('0x13'));var hardwareService=require(_0xbcbb('0x14'));var logger=require(_0xbcbb('0x15'))(_0xbcbb('0x16'));var utils=require(_0xbcbb('0x17'));var config=require(_0xbcbb('0x18'));var licenseUtil=require(_0xbcbb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dda36,_0x2722eb){_0x2722eb=_0x2722eb||0xcc;return function(_0x125a27){if(_0x125a27){return _0x5dda36['sendStatus'](_0x2722eb);}return _0x5dda36['status'](_0x2722eb)['end']();};}function respondWithResult(_0x5baf93,_0x1b28cc){_0x1b28cc=_0x1b28cc||0xc8;return function(_0x12a8c4){if(_0x12a8c4){return _0x5baf93['status'](_0x1b28cc)['json'](_0x12a8c4);}};}function respondWithFilteredResult(_0x25f177,_0x341ea3){return function(_0x518216){if(_0x518216){var _0x207602=typeof _0x341ea3['offset']===_0xbcbb('0x1a')&&typeof _0x341ea3[_0xbcbb('0x1b')]==='undefined';var _0x498466=_0x518216[_0xbcbb('0x1c')];var _0x556ec9=_0x207602?0x0:_0x341ea3['offset'];var _0x3a7644=_0x207602?_0x518216[_0xbcbb('0x1c')]:_0x341ea3[_0xbcbb('0x1d')]+_0x341ea3[_0xbcbb('0x1b')];var _0x342b7f;if(_0x3a7644>=_0x498466){_0x3a7644=_0x498466;_0x342b7f=0xc8;}else{_0x342b7f=0xce;}_0x25f177['status'](_0x342b7f);return _0x25f177['set'](_0xbcbb('0x1e'),_0x556ec9+'-'+_0x3a7644+'/'+_0x498466)[_0xbcbb('0x1f')](_0x518216);}return null;};}function patchUpdates(_0x1b804f){return function(_0x3629a6){try{jsonpatch[_0xbcbb('0x20')](_0x3629a6,_0x1b804f,!![]);}catch(_0x2819f4){return BPromise['reject'](_0x2819f4);}return _0x3629a6[_0xbcbb('0x21')]();};}function saveUpdates(_0x48021e,_0x30ebb9){return function(_0x19e78c){if(_0x19e78c){return _0x19e78c[_0xbcbb('0x22')](_0x48021e)[_0xbcbb('0x23')](function(_0x1e8fca){return _0x1e8fca;});}return null;};}function removeEntity(_0x518b02,_0x3a4c4f){return function(_0x46b924){if(_0x46b924){return _0x46b924[_0xbcbb('0x24')]()[_0xbcbb('0x23')](function(){_0x518b02[_0xbcbb('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89acb2,_0x5e36ce){return function(_0x2166c8){if(!_0x2166c8){_0x89acb2[_0xbcbb('0x26')](0x194);}return _0x2166c8;};}function handleError(_0x6ba897,_0x295a1d){_0x295a1d=_0x295a1d||0x1f4;return function(_0x595713){logger['error'](_0x595713[_0xbcbb('0x27')]);if(_0x595713[_0xbcbb('0x28')]){delete _0x595713[_0xbcbb('0x28')];}_0x6ba897[_0xbcbb('0x25')](_0x295a1d)['send'](_0x595713);};}exports[_0xbcbb('0x29')]=function(_0x997655,_0x5677c9){var _0x35e541={},_0x5c21cf={},_0x19a236={'count':0x0,'rows':[]};var _0x27052a=_[_0xbcbb('0x2a')](db[_0xbcbb('0x2b')][_0xbcbb('0x2c')],function(_0x49cda0){return{'name':_0x49cda0[_0xbcbb('0x2d')],'type':_0x49cda0['type']['key']};});_0x5c21cf[_0xbcbb('0x2e')]=_[_0xbcbb('0x2a')](_0x27052a,_0xbcbb('0x28'));_0x5c21cf[_0xbcbb('0x2f')]=_['keys'](_0x997655[_0xbcbb('0x2f')]);_0x5c21cf[_0xbcbb('0x30')]=_['intersection'](_0x5c21cf['model'],_0x5c21cf[_0xbcbb('0x2f')]);_0x35e541[_0xbcbb('0x31')]=_[_0xbcbb('0x32')](_0x5c21cf[_0xbcbb('0x2e')],qs[_0xbcbb('0x33')](_0x997655[_0xbcbb('0x2f')][_0xbcbb('0x33')]));_0x35e541[_0xbcbb('0x31')]=_0x35e541[_0xbcbb('0x31')][_0xbcbb('0x34')]?_0x35e541[_0xbcbb('0x31')]:_0x5c21cf[_0xbcbb('0x2e')];if(!_0x997655['query'][_0xbcbb('0x35')](_0xbcbb('0x36'))){_0x35e541['limit']=qs[_0xbcbb('0x1b')](_0x997655['query'][_0xbcbb('0x1b')]);_0x35e541[_0xbcbb('0x1d')]=qs[_0xbcbb('0x1d')](_0x997655['query'][_0xbcbb('0x1d')]);}_0x35e541[_0xbcbb('0x37')]=qs[_0xbcbb('0x38')](_0x997655[_0xbcbb('0x2f')][_0xbcbb('0x38')]);_0x35e541[_0xbcbb('0x39')]=qs[_0xbcbb('0x30')](_[_0xbcbb('0x3a')](_0x997655[_0xbcbb('0x2f')],_0x5c21cf[_0xbcbb('0x30')]),_0x27052a);if(_0x997655[_0xbcbb('0x2f')][_0xbcbb('0x3b')]){_0x35e541['where']=_[_0xbcbb('0x3c')](_0x35e541[_0xbcbb('0x39')],{'$or':_[_0xbcbb('0x2a')](_0x27052a,function(_0x3b4bb){if(_0x3b4bb[_0xbcbb('0x3d')]!==_0xbcbb('0x3e')){var _0x14a0b4={};_0x14a0b4[_0x3b4bb['name']]={'$like':'%'+_0x997655[_0xbcbb('0x2f')]['filter']+'%'};return _0x14a0b4;}})});}_0x35e541=_[_0xbcbb('0x3c')]({},_0x35e541,_0x997655[_0xbcbb('0x3f')]);var _0x311d97={'where':_0x35e541[_0xbcbb('0x39')]};return db[_0xbcbb('0x2b')][_0xbcbb('0x1c')](_0x311d97)[_0xbcbb('0x23')](function(_0x941075){_0x19a236[_0xbcbb('0x1c')]=_0x941075;if(_0x997655[_0xbcbb('0x2f')]['includeAll']){_0x35e541[_0xbcbb('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0xbcbb('0x41')](_0x35e541);})['then'](function(_0x5aee78){_0x19a236[_0xbcbb('0x42')]=_0x5aee78;return _0x19a236;})['then'](respondWithFilteredResult(_0x5677c9,_0x35e541))[_0xbcbb('0x43')](handleError(_0x5677c9,null));};exports[_0xbcbb('0x44')]=function(_0x28a32a,_0x195151){var _0xa30c48={'raw':!![],'where':{'id':_0x28a32a['params']['id']}},_0x3dd671={};_0x3dd671[_0xbcbb('0x2e')]=_[_0xbcbb('0x45')](db[_0xbcbb('0x2b')][_0xbcbb('0x2c')]);_0x3dd671[_0xbcbb('0x2f')]=_[_0xbcbb('0x45')](_0x28a32a['query']);_0x3dd671[_0xbcbb('0x30')]=_['intersection'](_0x3dd671[_0xbcbb('0x2e')],_0x3dd671['query']);_0xa30c48[_0xbcbb('0x31')]=_[_0xbcbb('0x32')](_0x3dd671[_0xbcbb('0x2e')],qs[_0xbcbb('0x33')](_0x28a32a[_0xbcbb('0x2f')][_0xbcbb('0x33')]));_0xa30c48[_0xbcbb('0x31')]=_0xa30c48[_0xbcbb('0x31')][_0xbcbb('0x34')]?_0xa30c48['attributes']:_0x3dd671['model'];if(_0x28a32a[_0xbcbb('0x2f')]['includeAll']){_0xa30c48['include']=[{'all':!![]}];}_0xa30c48=_[_0xbcbb('0x3c')]({},_0xa30c48,_0x28a32a[_0xbcbb('0x3f')]);return db['SquareMessage'][_0xbcbb('0x46')](_0xa30c48)[_0xbcbb('0x23')](handleEntityNotFound(_0x195151,null))[_0xbcbb('0x23')](respondWithResult(_0x195151,null))[_0xbcbb('0x43')](handleError(_0x195151,null));};exports[_0xbcbb('0x47')]=function(_0x2e0077,_0x768fc8){return db['SquareMessage'][_0xbcbb('0x47')](_0x2e0077[_0xbcbb('0x48')],{})['then'](respondWithResult(_0x768fc8,0xc9))[_0xbcbb('0x43')](handleError(_0x768fc8,null));};exports[_0xbcbb('0x22')]=function(_0x10b764,_0xef4214){if(_0x10b764['body']['id']){delete _0x10b764['body']['id'];}return db[_0xbcbb('0x2b')][_0xbcbb('0x46')]({'where':{'id':_0x10b764['params']['id']}})['then'](handleEntityNotFound(_0xef4214,null))[_0xbcbb('0x23')](saveUpdates(_0x10b764['body'],null))[_0xbcbb('0x23')](respondWithResult(_0xef4214,null))[_0xbcbb('0x43')](handleError(_0xef4214,null));};exports[_0xbcbb('0x24')]=function(_0x28d80e,_0x590b05){return db[_0xbcbb('0x2b')][_0xbcbb('0x46')]({'where':{'id':_0x28d80e[_0xbcbb('0x49')]['id']}})['then'](handleEntityNotFound(_0x590b05,null))[_0xbcbb('0x23')](removeEntity(_0x590b05,null))[_0xbcbb('0x43')](handleError(_0x590b05,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9caf4b9..f66fb08 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 _0x7ea2=['../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','api','moment','request-promise','path','rimraf'];(function(_0x458746,_0x2b3d5c){var _0x3b46a9=function(_0x43c394){while(--_0x43c394){_0x458746['push'](_0x458746['shift']());}};_0x3b46a9(++_0x2b3d5c);}(_0x7ea2,0x14e));var _0x27ea=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x7ea2[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x27ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x27ea('0x1'));var moment=require(_0x27ea('0x2'));var BPromise=require('bluebird');var rp=require(_0x27ea('0x3'));var fs=require('fs');var path=require(_0x27ea('0x4'));var rimraf=require(_0x27ea('0x5'));var config=require(_0x27ea('0x6'));var attributes=require(_0x27ea('0x7'));module['exports']=function(_0x468081,_0x47bd56){return _0x468081[_0x27ea('0x8')](_0x27ea('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3245=['path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','api','request-promise'];(function(_0x25fe5f,_0x553196){var _0x50a435=function(_0x211634){while(--_0x211634){_0x25fe5f['push'](_0x25fe5f['shift']());}};_0x50a435(++_0x553196);}(_0x3245,0x10b));var _0x5324=function(_0x145340,_0x5ce236){_0x145340=_0x145340-0x0;var _0xbbf004=_0x3245[_0x145340];return _0xbbf004;};'use strict';var _=require(_0x5324('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5324('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5324('0x2'));var fs=require('fs');var path=require(_0x5324('0x3'));var rimraf=require('rimraf');var config=require(_0x5324('0x4'));var attributes=require(_0x5324('0x5'));module[_0x5324('0x6')]=function(_0x516ef7,_0x489ba3){return _0x516ef7[_0x5324('0x7')](_0x5324('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 599a098..f3f6051 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 _0x7a04=['jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xbd4a6e,_0xc68eb6){var _0x1fe91d=function(_0x571615){while(--_0x571615){_0xbd4a6e['push'](_0xbd4a6e['shift']());}};_0x1fe91d(++_0xc68eb6);}(_0x7a04,0x89));var _0x47a0=function(_0x1a9b71,_0x351a1e){_0x1a9b71=_0x1a9b71-0x0;var _0x1119cf=_0x7a04[_0x1a9b71];return _0x1119cf;};'use strict';var _=require(_0x47a0('0x0'));var util=require(_0x47a0('0x1'));var moment=require('moment');var BPromise=require(_0x47a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x47a0('0x4'))(_0x47a0('0x5'));var config=require(_0x47a0('0x6'));var jayson=require(_0x47a0('0x7'));var client=jayson['client'][_0x47a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a3135,_0x231ff6,_0x1483f4){return new BPromise(function(_0x3c7af2,_0xea42a7){return client[_0x47a0('0x9')](_0x3a3135,_0x1483f4)[_0x47a0('0xa')](function(_0x5eaec9){logger[_0x47a0('0xb')](_0x47a0('0xc'),_0x231ff6,_0x47a0('0xd'));logger['debug'](_0x47a0('0xe'),_0x231ff6,'request\x20sent',JSON[_0x47a0('0xf')](_0x5eaec9));if(_0x5eaec9['error']){if(_0x5eaec9[_0x47a0('0x10')][_0x47a0('0x11')]===0x1f4){logger[_0x47a0('0x10')](_0x47a0('0xc'),_0x231ff6,_0x5eaec9[_0x47a0('0x10')][_0x47a0('0x12')]);return _0xea42a7(_0x5eaec9[_0x47a0('0x10')][_0x47a0('0x12')]);}logger[_0x47a0('0x10')]('SquareMessage,\x20%s,\x20%s',_0x231ff6,_0x5eaec9[_0x47a0('0x10')][_0x47a0('0x12')]);return _0x3c7af2(_0x5eaec9[_0x47a0('0x10')][_0x47a0('0x12')]);}else{logger[_0x47a0('0xb')](_0x47a0('0xc'),_0x231ff6,_0x47a0('0xd'));_0x3c7af2(_0x5eaec9[_0x47a0('0x13')][_0x47a0('0x12')]);}})[_0x47a0('0x14')](function(_0x20569c){logger[_0x47a0('0x10')](_0x47a0('0xc'),_0x231ff6,_0x20569c);_0xea42a7(_0x20569c);});});}exports[_0x47a0('0x15')]=function(_0x22aa9d){var _0x26242b=this;return new Promise(function(_0x433c9f,_0x317b24){return db[_0x47a0('0x16')]['create'](_0x22aa9d[_0x47a0('0x17')],{'raw':_0x22aa9d['options']?_0x22aa9d['options']['raw']===undefined?!![]:![]:!![]})[_0x47a0('0xa')](function(_0x56a3f2){logger[_0x47a0('0xb')](_0x47a0('0x15'),_0x22aa9d);logger['debug'](_0x47a0('0x15'),_0x22aa9d,JSON[_0x47a0('0xf')](_0x56a3f2));_0x433c9f(_0x56a3f2);})[_0x47a0('0x14')](function(_0x1e9f2e){logger[_0x47a0('0x10')](_0x47a0('0x15'),_0x1e9f2e[_0x47a0('0x12')],_0x22aa9d);_0x317b24(_0x26242b[_0x47a0('0x10')](0x1f4,_0x1e9f2e[_0x47a0('0x12')]));});});}; \ No newline at end of file +var _0x2ddd=['request\x20sent','stringify','error','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','SquareMessage','body','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x2ddd,0xa7));var _0xd2dd=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0x2ddd[_0x2d9535];return _0xb4e710;};'use strict';var _=require(_0xd2dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2dd('0x1'));var fs=require('fs');var Redis=require(_0xd2dd('0x2'));var db=require(_0xd2dd('0x3'))['db'];var utils=require(_0xd2dd('0x4'));var logger=require('../../config/logger')(_0xd2dd('0x5'));var config=require(_0xd2dd('0x6'));var jayson=require(_0xd2dd('0x7'));var client=jayson[_0xd2dd('0x8')][_0xd2dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb634,_0x5595af,_0x45bd57){return new BPromise(function(_0x4aa334,_0x4b03a4){return client[_0xd2dd('0xa')](_0x3cb634,_0x45bd57)[_0xd2dd('0xb')](function(_0x28520f){logger[_0xd2dd('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5595af,'request\x20sent');logger[_0xd2dd('0xd')](_0xd2dd('0xe'),_0x5595af,_0xd2dd('0xf'),JSON[_0xd2dd('0x10')](_0x28520f));if(_0x28520f['error']){if(_0x28520f[_0xd2dd('0x11')]['code']===0x1f4){logger[_0xd2dd('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5595af,_0x28520f[_0xd2dd('0x11')][_0xd2dd('0x12')]);return _0x4b03a4(_0x28520f[_0xd2dd('0x11')][_0xd2dd('0x12')]);}logger[_0xd2dd('0x11')](_0xd2dd('0x13'),_0x5595af,_0x28520f[_0xd2dd('0x11')]['message']);return _0x4aa334(_0x28520f[_0xd2dd('0x11')][_0xd2dd('0x12')]);}else{logger[_0xd2dd('0xc')](_0xd2dd('0x13'),_0x5595af,_0xd2dd('0xf'));_0x4aa334(_0x28520f[_0xd2dd('0x14')][_0xd2dd('0x12')]);}})[_0xd2dd('0x15')](function(_0x1dfc81){logger[_0xd2dd('0x11')](_0xd2dd('0x13'),_0x5595af,_0x1dfc81);_0x4b03a4(_0x1dfc81);});});}exports[_0xd2dd('0x16')]=function(_0x1e480e){var _0x4658b2=this;return new Promise(function(_0x233bf3,_0x372c77){return db[_0xd2dd('0x17')]['create'](_0x1e480e[_0xd2dd('0x18')],{'raw':_0x1e480e['options']?_0x1e480e['options'][_0xd2dd('0x19')]===undefined?!![]:![]:!![]})[_0xd2dd('0xb')](function(_0x560ffa){logger[_0xd2dd('0xc')](_0xd2dd('0x16'),_0x1e480e);logger['debug']('CreateSquareMessage',_0x1e480e,JSON['stringify'](_0x560ffa));_0x233bf3(_0x560ffa);})[_0xd2dd('0x15')](function(_0x38b1dc){logger['error'](_0xd2dd('0x16'),_0x38b1dc[_0xd2dd('0x12')],_0x1e480e);_0x372c77(_0x4658b2[_0xd2dd('0x11')](0x1f4,_0x38b1dc[_0xd2dd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e394e7d..ec27020 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 _0x679c=['post','create','put','update','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','15s','test'];(function(_0x163d42,_0x3cabea){var _0x59186c=function(_0x139ab9){while(--_0x139ab9){_0x163d42['push'](_0x163d42['shift']());}};_0x59186c(++_0x3cabea);}(_0x679c,0x94));var _0xc679=function(_0x2dd97b,_0x2fe831){_0x2dd97b=_0x2dd97b-0x0;var _0x466b2e=_0x679c[_0x2dd97b];return _0x466b2e;};'use strict';var multer=require(_0xc679('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc679('0x1'));var express=require('express');var router=express[_0xc679('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc679('0x3'));var config=require(_0xc679('0x4'));var controller=require(_0xc679('0x5'));router['get']('/',auth[_0xc679('0x6')](),controller[_0xc679('0x7')]);router[_0xc679('0x8')](_0xc679('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc679('0x8')]('/:id/test',auth[_0xc679('0x6')](),timeout(_0xc679('0xa')),controller[_0xc679('0xb')]);router[_0xc679('0xc')]('/',auth[_0xc679('0x6')](),controller[_0xc679('0xd')]);router[_0xc679('0xe')](_0xc679('0x9'),auth[_0xc679('0x6')](),controller[_0xc679('0xf')]);router['delete']('/:id',auth[_0xc679('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa06a=['../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0xa06a,0x158));var _0xaa06=function(_0xb8cd0a,_0x52d523){_0xb8cd0a=_0xb8cd0a-0x0;var _0x598b11=_0xa06a[_0xb8cd0a];return _0x598b11;};'use strict';var multer=require('multer');var util=require(_0xaa06('0x0'));var path=require(_0xaa06('0x1'));var timeout=require(_0xaa06('0x2'));var express=require(_0xaa06('0x3'));var router=express[_0xaa06('0x4')]();var fs_extra=require(_0xaa06('0x5'));var auth=require(_0xaa06('0x6'));var interaction=require(_0xaa06('0x7'));var config=require(_0xaa06('0x8'));var controller=require(_0xaa06('0x9'));router[_0xaa06('0xa')]('/',auth['isAuthenticated'](),controller[_0xaa06('0xb')]);router[_0xaa06('0xa')](_0xaa06('0xc'),auth[_0xaa06('0xd')](),controller[_0xaa06('0xe')]);router['get'](_0xaa06('0xf'),auth[_0xaa06('0xd')](),timeout('15s'),controller['test']);router[_0xaa06('0x10')]('/',auth[_0xaa06('0xd')](),controller[_0xaa06('0x11')]);router[_0xaa06('0x12')](_0xaa06('0xc'),auth[_0xaa06('0xd')](),controller['update']);router[_0xaa06('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xaa06('0x14')]);module[_0xaa06('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2a77764..9e69a8a 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 _0xb8fa=['exports','STRING','sequelize'];(function(_0x58af8b,_0x1071c6){var _0xc74d26=function(_0x232e4b){while(--_0x232e4b){_0x58af8b['push'](_0x58af8b['shift']());}};_0xc74d26(++_0x1071c6);}(_0xb8fa,0x17f));var _0xab8f=function(_0x25cc00,_0x374931){_0x25cc00=_0x25cc00-0x0;var _0x24e7b1=_0xb8fa[_0x25cc00];return _0x24e7b1;};'use strict';var Sequelize=require(_0xab8f('0x0'));module[_0xab8f('0x1')]={'name':{'type':Sequelize[_0xab8f('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xab8f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf167=['STRING','name','sequelize'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0xf167,0x146));var _0x7f16=function(_0x1d603a,_0x2b814e){_0x1d603a=_0x1d603a-0x0;var _0x4b76b4=_0xf167[_0x1d603a];return _0x4b76b4;};'use strict';var Sequelize=require(_0x7f16('0x0'));module['exports']={'name':{'type':Sequelize[_0x7f16('0x1')],'unique':_0x7f16('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7f16('0x1')]},'description':{'type':Sequelize[_0x7f16('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e22deec..822ddac 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 _0x99d2=['rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc'];(function(_0x217286,_0x461070){var _0x186ff2=function(_0x397f0c){while(--_0x397f0c){_0x217286['push'](_0x217286['shift']());}};_0x186ff2(++_0x461070);}(_0x99d2,0xca));var _0x299d=function(_0x539592,_0x33f256){_0x539592=_0x539592-0x0;var _0x2793c3=_0x99d2[_0x539592];return _0x2793c3;};'use strict';var emlformat=require(_0x299d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x299d('0x1'));var moment=require(_0x299d('0x2'));var BPromise=require(_0x299d('0x3'));var Mustache=require(_0x299d('0x4'));var util=require(_0x299d('0x5'));var path=require(_0x299d('0x6'));var sox=require(_0x299d('0x7'));var csv=require(_0x299d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x299d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x299d('0xa'));var jsforce=require(_0x299d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x299d('0x8'));var querystring=require(_0x299d('0xc'));var Papa=require(_0x299d('0xd'));var Redis=require('ioredis');var authService=require(_0x299d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x299d('0xf'));var hardwareService=require(_0x299d('0x10'));var logger=require('../../config/logger')(_0x299d('0x11'));var utils=require(_0x299d('0x12'));var config=require(_0x299d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x299d('0x14'))['db'];function respondWithStatusCode(_0x596b38,_0x4f13d6){_0x4f13d6=_0x4f13d6||0xcc;return function(_0x255ee0){if(_0x255ee0){return _0x596b38['sendStatus'](_0x4f13d6);}return _0x596b38[_0x299d('0x15')](_0x4f13d6)[_0x299d('0x16')]();};}function respondWithResult(_0x2f8085,_0x3748db){_0x3748db=_0x3748db||0xc8;return function(_0x49f821){if(_0x49f821){return _0x2f8085['status'](_0x3748db)[_0x299d('0x17')](_0x49f821);}};}function respondWithFilteredResult(_0x4bec57,_0x1183af){return function(_0x1ae1dd){if(_0x1ae1dd){var _0x44b6a7=typeof _0x1183af[_0x299d('0x18')]===_0x299d('0x19')&&typeof _0x1183af['limit']===_0x299d('0x19');var _0x31cc3d=_0x1ae1dd['count'];var _0x589685=_0x44b6a7?0x0:_0x1183af['offset'];var _0xc384cc=_0x44b6a7?_0x1ae1dd[_0x299d('0x1a')]:_0x1183af[_0x299d('0x18')]+_0x1183af[_0x299d('0x1b')];var _0x43a48f;if(_0xc384cc>=_0x31cc3d){_0xc384cc=_0x31cc3d;_0x43a48f=0xc8;}else{_0x43a48f=0xce;}_0x4bec57['status'](_0x43a48f);return _0x4bec57[_0x299d('0x1c')](_0x299d('0x1d'),_0x589685+'-'+_0xc384cc+'/'+_0x31cc3d)[_0x299d('0x17')](_0x1ae1dd);}return null;};}function patchUpdates(_0x4f143d){return function(_0x4fc0d9){try{jsonpatch['apply'](_0x4fc0d9,_0x4f143d,!![]);}catch(_0xd7c761){return BPromise[_0x299d('0x1e')](_0xd7c761);}return _0x4fc0d9['save']();};}function saveUpdates(_0x89a230,_0x1c714c){return function(_0x2c4983){if(_0x2c4983){return _0x2c4983[_0x299d('0x1f')](_0x89a230)[_0x299d('0x20')](function(_0x8b1d69){return _0x8b1d69;});}return null;};}function removeEntity(_0x383eb2,_0x5f10a4){return function(_0x4c8139){if(_0x4c8139){return _0x4c8139[_0x299d('0x21')]()[_0x299d('0x20')](function(){var _0x5cfd90=_0x4c8139[_0x299d('0x22')]({'plain':!![]});var _0x5a4c04=_0x299d('0x23');return db[_0x299d('0x24')][_0x299d('0x21')]({'where':{'type':_0x5a4c04,'resourceId':_0x5cfd90['id']}})['then'](function(){return _0x4c8139;});})[_0x299d('0x20')](function(){_0x383eb2[_0x299d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ecc4,_0x5df8a9){return function(_0x1cbede){if(!_0x1cbede){_0x54ecc4['sendStatus'](0x194);}return _0x1cbede;};}function handleError(_0x1e27b9,_0x20fa0a){_0x20fa0a=_0x20fa0a||0x1f4;return function(_0x1da935){logger[_0x299d('0x25')](_0x1da935[_0x299d('0x26')]);if(_0x1da935['name']){delete _0x1da935[_0x299d('0x27')];}_0x1e27b9[_0x299d('0x15')](_0x20fa0a)[_0x299d('0x28')](_0x1da935);};}exports[_0x299d('0x29')]=function(_0x65b1e7,_0x2b121b){var _0xae6fc={},_0x16f60e={},_0x3c3dbd={'count':0x0,'rows':[]};var _0x59af26=_[_0x299d('0x2a')](db[_0x299d('0x2b')][_0x299d('0x2c')],function(_0x1b576c){return{'name':_0x1b576c[_0x299d('0x2d')],'type':_0x1b576c['type'][_0x299d('0x2e')]};});_0x16f60e[_0x299d('0x2f')]=_['map'](_0x59af26,_0x299d('0x27'));_0x16f60e['query']=_[_0x299d('0x30')](_0x65b1e7['query']);_0x16f60e[_0x299d('0x31')]=_[_0x299d('0x32')](_0x16f60e[_0x299d('0x2f')],_0x16f60e[_0x299d('0x33')]);_0xae6fc[_0x299d('0x34')]=_[_0x299d('0x32')](_0x16f60e[_0x299d('0x2f')],qs[_0x299d('0x35')](_0x65b1e7[_0x299d('0x33')][_0x299d('0x35')]));_0xae6fc[_0x299d('0x34')]=_0xae6fc[_0x299d('0x34')][_0x299d('0x36')]?_0xae6fc['attributes']:_0x16f60e[_0x299d('0x2f')];if(!_0x65b1e7[_0x299d('0x33')][_0x299d('0x37')](_0x299d('0x38'))){_0xae6fc[_0x299d('0x1b')]=qs[_0x299d('0x1b')](_0x65b1e7[_0x299d('0x33')][_0x299d('0x1b')]);_0xae6fc['offset']=qs[_0x299d('0x18')](_0x65b1e7['query'][_0x299d('0x18')]);}_0xae6fc[_0x299d('0x39')]=qs[_0x299d('0x3a')](_0x65b1e7['query'][_0x299d('0x3a')]);_0xae6fc[_0x299d('0x3b')]=qs[_0x299d('0x31')](_[_0x299d('0x3c')](_0x65b1e7[_0x299d('0x33')],_0x16f60e[_0x299d('0x31')]),_0x59af26);if(_0x65b1e7[_0x299d('0x33')][_0x299d('0x3d')]){_0xae6fc[_0x299d('0x3b')]=_[_0x299d('0x3e')](_0xae6fc['where'],{'$or':_['map'](_0x59af26,function(_0x579900){if(_0x579900[_0x299d('0x3f')]!==_0x299d('0x40')){var _0x56174e={};_0x56174e[_0x579900['name']]={'$like':'%'+_0x65b1e7[_0x299d('0x33')][_0x299d('0x3d')]+'%'};return _0x56174e;}})});}_0xae6fc=_[_0x299d('0x3e')]({},_0xae6fc,_0x65b1e7['options']);var _0x5b4354={'where':_0xae6fc[_0x299d('0x3b')]};return db[_0x299d('0x2b')][_0x299d('0x1a')](_0x5b4354)[_0x299d('0x20')](function(_0x3f2c53){_0x3c3dbd[_0x299d('0x1a')]=_0x3f2c53;if(_0x65b1e7['query'][_0x299d('0x41')]){_0xae6fc['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x299d('0x42')](_0xae6fc);})[_0x299d('0x20')](function(_0x5f1737){_0x3c3dbd[_0x299d('0x43')]=_0x5f1737;return _0x3c3dbd;})[_0x299d('0x20')](respondWithFilteredResult(_0x2b121b,_0xae6fc))['catch'](handleError(_0x2b121b,null));};exports['show']=function(_0xa9962b,_0x5229d8){var _0x341d2c={'raw':!![],'where':{'id':_0xa9962b['params']['id']}},_0x582250={};_0x582250[_0x299d('0x2f')]=_[_0x299d('0x30')](db[_0x299d('0x2b')][_0x299d('0x2c')]);_0x582250['query']=_[_0x299d('0x30')](_0xa9962b['query']);_0x582250['filters']=_['intersection'](_0x582250[_0x299d('0x2f')],_0x582250['query']);_0x341d2c[_0x299d('0x34')]=_[_0x299d('0x32')](_0x582250[_0x299d('0x2f')],qs[_0x299d('0x35')](_0xa9962b[_0x299d('0x33')][_0x299d('0x35')]));_0x341d2c[_0x299d('0x34')]=_0x341d2c[_0x299d('0x34')]['length']?_0x341d2c['attributes']:_0x582250[_0x299d('0x2f')];if(_0xa9962b[_0x299d('0x33')][_0x299d('0x41')]){_0x341d2c[_0x299d('0x44')]=[{'all':!![]}];}_0x341d2c=_[_0x299d('0x3e')]({},_0x341d2c,_0xa9962b['options']);return db['SquareOdbc'][_0x299d('0x45')](_0x341d2c)[_0x299d('0x20')](handleEntityNotFound(_0x5229d8,null))['then'](respondWithResult(_0x5229d8,null))[_0x299d('0x46')](handleError(_0x5229d8,null));};exports[_0x299d('0x47')]=function(_0x30153e,_0x509539){return db[_0x299d('0x2b')][_0x299d('0x47')](_0x30153e[_0x299d('0x48')],{})[_0x299d('0x20')](function(_0xcde939){var _0x4a3d23=_0x30153e['user']['get']({'plain':!![]});if(!_0x4a3d23)throw new Error(_0x299d('0x49'));if(_0x4a3d23['role']==='user'){var _0x2c178b=_0xcde939['get']({'plain':!![]});var _0x4d2744=_0x299d('0x23');return db[_0x299d('0x4a')][_0x299d('0x45')]({'where':{'name':_0x4d2744,'userProfileId':_0x4a3d23[_0x299d('0x4b')]},'raw':!![]})[_0x299d('0x20')](function(_0x256960){if(_0x256960&&_0x256960['autoAssociation']===0x0){return db[_0x299d('0x24')][_0x299d('0x47')]({'name':_0x2c178b[_0x299d('0x27')],'resourceId':_0x2c178b['id'],'type':_0x256960[_0x299d('0x27')],'sectionId':_0x256960['id']},{})[_0x299d('0x20')](function(){return _0xcde939;});}else{return _0xcde939;}})[_0x299d('0x46')](function(_0x3081d2){logger[_0x299d('0x25')](_0x299d('0x4c'),_0x3081d2);throw _0x3081d2;});}return _0xcde939;})[_0x299d('0x20')](respondWithResult(_0x509539,0xc9))[_0x299d('0x46')](handleError(_0x509539,null));};exports[_0x299d('0x1f')]=function(_0x569122,_0x3515c1){if(_0x569122['body']['id']){delete _0x569122[_0x299d('0x48')]['id'];}return db['SquareOdbc'][_0x299d('0x45')]({'where':{'id':_0x569122[_0x299d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3515c1,null))[_0x299d('0x20')](saveUpdates(_0x569122[_0x299d('0x48')],null))[_0x299d('0x20')](respondWithResult(_0x3515c1,null))['catch'](handleError(_0x3515c1,null));};exports[_0x299d('0x21')]=function(_0x575808,_0x3048fe){return db[_0x299d('0x2b')][_0x299d('0x45')]({'where':{'id':_0x575808[_0x299d('0x4d')]['id']}})[_0x299d('0x20')](handleEntityNotFound(_0x3048fe,null))['then'](removeEntity(_0x3048fe,null))[_0x299d('0x46')](handleError(_0x3048fe,null));};exports['test']=function(_0xb1b2b4,_0x36d98b,_0x130a2b){var _0x349e8e;return db[_0x299d('0x2b')]['find']({'where':{'id':_0xb1b2b4[_0x299d('0x4d')]['id']},'attributes':['id',_0x299d('0x4e')]})[_0x299d('0x20')](handleEntityNotFound(_0x36d98b,null))[_0x299d('0x20')](function(_0x41a372){if(_0x41a372){var _0x24486e=require(_0x299d('0x4f'))();_0x24486e[_0x299d('0x50')](_0x41a372[_0x299d('0x4e')]);_0x24486e[_0x299d('0x51')]();return _0x41a372;}})[_0x299d('0x20')](respondWithResult(_0x36d98b,null))[_0x299d('0x46')](handleError(_0x36d98b,null));}; \ No newline at end of file +var _0xe898=['filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','SquareOdbc','filters','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x339cbe,_0x38a898){var _0x2fe6d2=function(_0x1c4645){while(--_0x1c4645){_0x339cbe['push'](_0x339cbe['shift']());}};_0x2fe6d2(++_0x38a898);}(_0xe898,0x175));var _0x8e89=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0xe898[_0x29bfbe];return _0x230663;};'use strict';var emlformat=require(_0x8e89('0x0'));var rimraf=require(_0x8e89('0x1'));var zipdir=require(_0x8e89('0x2'));var jsonpatch=require(_0x8e89('0x3'));var rp=require(_0x8e89('0x4'));var moment=require('moment');var BPromise=require(_0x8e89('0x5'));var Mustache=require(_0x8e89('0x6'));var util=require(_0x8e89('0x7'));var path=require(_0x8e89('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e89('0x9'));var fs=require('fs');var fs_extra=require(_0x8e89('0xa'));var _=require(_0x8e89('0xb'));var squel=require(_0x8e89('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e89('0xd'));var deskjs=require(_0x8e89('0xe'));var toCsv=require(_0x8e89('0xf'));var querystring=require(_0x8e89('0x10'));var Papa=require(_0x8e89('0x11'));var Redis=require(_0x8e89('0x12'));var authService=require(_0x8e89('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8e89('0x14'));var hardwareService=require(_0x8e89('0x15'));var logger=require(_0x8e89('0x16'))('api');var utils=require(_0x8e89('0x17'));var config=require(_0x8e89('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c0e48,_0x23401b){_0x23401b=_0x23401b||0xcc;return function(_0x18e0a6){if(_0x18e0a6){return _0x1c0e48[_0x8e89('0x19')](_0x23401b);}return _0x1c0e48[_0x8e89('0x1a')](_0x23401b)[_0x8e89('0x1b')]();};}function respondWithResult(_0x4866df,_0x55b9c8){_0x55b9c8=_0x55b9c8||0xc8;return function(_0x5aa619){if(_0x5aa619){return _0x4866df[_0x8e89('0x1a')](_0x55b9c8)['json'](_0x5aa619);}};}function respondWithFilteredResult(_0x1787b8,_0x458500){return function(_0x18375a){if(_0x18375a){var _0x1130b0=typeof _0x458500['offset']===_0x8e89('0x1c')&&typeof _0x458500[_0x8e89('0x1d')]===_0x8e89('0x1c');var _0x43d8fb=_0x18375a['count'];var _0x2373d3=_0x1130b0?0x0:_0x458500[_0x8e89('0x1e')];var _0x4a57c5=_0x1130b0?_0x18375a[_0x8e89('0x1f')]:_0x458500['offset']+_0x458500['limit'];var _0x38065a;if(_0x4a57c5>=_0x43d8fb){_0x4a57c5=_0x43d8fb;_0x38065a=0xc8;}else{_0x38065a=0xce;}_0x1787b8[_0x8e89('0x1a')](_0x38065a);return _0x1787b8[_0x8e89('0x20')](_0x8e89('0x21'),_0x2373d3+'-'+_0x4a57c5+'/'+_0x43d8fb)[_0x8e89('0x22')](_0x18375a);}return null;};}function patchUpdates(_0x15fd1b){return function(_0x11509d){try{jsonpatch[_0x8e89('0x23')](_0x11509d,_0x15fd1b,!![]);}catch(_0x5d3e56){return BPromise[_0x8e89('0x24')](_0x5d3e56);}return _0x11509d[_0x8e89('0x25')]();};}function saveUpdates(_0x3708b2,_0x35668b){return function(_0xf8743f){if(_0xf8743f){return _0xf8743f[_0x8e89('0x26')](_0x3708b2)[_0x8e89('0x27')](function(_0x135324){return _0x135324;});}return null;};}function removeEntity(_0x7ba3a2,_0x675559){return function(_0x5c9685){if(_0x5c9685){return _0x5c9685['destroy']()[_0x8e89('0x27')](function(){var _0x599ccc=_0x5c9685[_0x8e89('0x28')]({'plain':!![]});var _0x51e61b='ODBC';return db['UserProfileResource'][_0x8e89('0x29')]({'where':{'type':_0x51e61b,'resourceId':_0x599ccc['id']}})['then'](function(){return _0x5c9685;});})[_0x8e89('0x27')](function(){_0x7ba3a2[_0x8e89('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51bc3c,_0xc77a37){return function(_0xbcfa8e){if(!_0xbcfa8e){_0x51bc3c[_0x8e89('0x19')](0x194);}return _0xbcfa8e;};}function handleError(_0x2a90fd,_0x395004){_0x395004=_0x395004||0x1f4;return function(_0x495e94){logger[_0x8e89('0x2a')](_0x495e94[_0x8e89('0x2b')]);if(_0x495e94['name']){delete _0x495e94[_0x8e89('0x2c')];}_0x2a90fd[_0x8e89('0x1a')](_0x395004)[_0x8e89('0x2d')](_0x495e94);};}exports[_0x8e89('0x2e')]=function(_0x164a64,_0x54607c){var _0x5c137c={},_0x252c4a={},_0x20f84={'count':0x0,'rows':[]};var _0x50032d=_[_0x8e89('0x2f')](db['SquareOdbc'][_0x8e89('0x30')],function(_0x173688){return{'name':_0x173688['fieldName'],'type':_0x173688[_0x8e89('0x31')][_0x8e89('0x32')]};});_0x252c4a['model']=_[_0x8e89('0x2f')](_0x50032d,'name');_0x252c4a[_0x8e89('0x33')]=_[_0x8e89('0x34')](_0x164a64['query']);_0x252c4a['filters']=_[_0x8e89('0x35')](_0x252c4a[_0x8e89('0x36')],_0x252c4a[_0x8e89('0x33')]);_0x5c137c[_0x8e89('0x37')]=_[_0x8e89('0x35')](_0x252c4a[_0x8e89('0x36')],qs[_0x8e89('0x38')](_0x164a64['query'][_0x8e89('0x38')]));_0x5c137c[_0x8e89('0x37')]=_0x5c137c[_0x8e89('0x37')][_0x8e89('0x39')]?_0x5c137c[_0x8e89('0x37')]:_0x252c4a['model'];if(!_0x164a64['query'][_0x8e89('0x3a')](_0x8e89('0x3b'))){_0x5c137c[_0x8e89('0x1d')]=qs['limit'](_0x164a64['query'][_0x8e89('0x1d')]);_0x5c137c[_0x8e89('0x1e')]=qs[_0x8e89('0x1e')](_0x164a64['query']['offset']);}_0x5c137c['order']=qs[_0x8e89('0x3c')](_0x164a64[_0x8e89('0x33')][_0x8e89('0x3c')]);_0x5c137c['where']=qs['filters'](_[_0x8e89('0x3d')](_0x164a64[_0x8e89('0x33')],_0x252c4a['filters']),_0x50032d);if(_0x164a64['query'][_0x8e89('0x3e')]){_0x5c137c[_0x8e89('0x3f')]=_[_0x8e89('0x40')](_0x5c137c[_0x8e89('0x3f')],{'$or':_[_0x8e89('0x2f')](_0x50032d,function(_0x3a7e24){if(_0x3a7e24[_0x8e89('0x31')]!==_0x8e89('0x41')){var _0x11e4e6={};_0x11e4e6[_0x3a7e24['name']]={'$like':'%'+_0x164a64[_0x8e89('0x33')][_0x8e89('0x3e')]+'%'};return _0x11e4e6;}})});}_0x5c137c=_[_0x8e89('0x40')]({},_0x5c137c,_0x164a64[_0x8e89('0x42')]);var _0x48837f={'where':_0x5c137c[_0x8e89('0x3f')]};return db['SquareOdbc']['count'](_0x48837f)[_0x8e89('0x27')](function(_0x81715){_0x20f84[_0x8e89('0x1f')]=_0x81715;if(_0x164a64['query'][_0x8e89('0x43')]){_0x5c137c[_0x8e89('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x8e89('0x45')](_0x5c137c);})[_0x8e89('0x27')](function(_0xcf200d){_0x20f84[_0x8e89('0x46')]=_0xcf200d;return _0x20f84;})['then'](respondWithFilteredResult(_0x54607c,_0x5c137c))[_0x8e89('0x47')](handleError(_0x54607c,null));};exports[_0x8e89('0x48')]=function(_0x508f1e,_0x47dd87){var _0x388489={'raw':!![],'where':{'id':_0x508f1e[_0x8e89('0x49')]['id']}},_0x530c63={};_0x530c63[_0x8e89('0x36')]=_['keys'](db[_0x8e89('0x4a')][_0x8e89('0x30')]);_0x530c63[_0x8e89('0x33')]=_[_0x8e89('0x34')](_0x508f1e[_0x8e89('0x33')]);_0x530c63[_0x8e89('0x4b')]=_[_0x8e89('0x35')](_0x530c63[_0x8e89('0x36')],_0x530c63['query']);_0x388489['attributes']=_[_0x8e89('0x35')](_0x530c63[_0x8e89('0x36')],qs['fields'](_0x508f1e[_0x8e89('0x33')][_0x8e89('0x38')]));_0x388489[_0x8e89('0x37')]=_0x388489[_0x8e89('0x37')][_0x8e89('0x39')]?_0x388489[_0x8e89('0x37')]:_0x530c63[_0x8e89('0x36')];if(_0x508f1e['query'][_0x8e89('0x43')]){_0x388489['include']=[{'all':!![]}];}_0x388489=_[_0x8e89('0x40')]({},_0x388489,_0x508f1e[_0x8e89('0x42')]);return db[_0x8e89('0x4a')]['find'](_0x388489)[_0x8e89('0x27')](handleEntityNotFound(_0x47dd87,null))['then'](respondWithResult(_0x47dd87,null))[_0x8e89('0x47')](handleError(_0x47dd87,null));};exports[_0x8e89('0x4c')]=function(_0x3ee90f,_0x6f7d0e){return db[_0x8e89('0x4a')][_0x8e89('0x4c')](_0x3ee90f[_0x8e89('0x4d')],{})['then'](function(_0x2a37e1){var _0x7d1eb7=_0x3ee90f[_0x8e89('0x4e')][_0x8e89('0x28')]({'plain':!![]});if(!_0x7d1eb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7d1eb7[_0x8e89('0x4f')]===_0x8e89('0x4e')){var _0x4080d4=_0x2a37e1[_0x8e89('0x28')]({'plain':!![]});var _0x629394='ODBC';return db[_0x8e89('0x50')][_0x8e89('0x51')]({'where':{'name':_0x629394,'userProfileId':_0x7d1eb7['userProfileId']},'raw':!![]})[_0x8e89('0x27')](function(_0x3b7a05){if(_0x3b7a05&&_0x3b7a05[_0x8e89('0x52')]===0x0){return db[_0x8e89('0x53')][_0x8e89('0x4c')]({'name':_0x4080d4[_0x8e89('0x2c')],'resourceId':_0x4080d4['id'],'type':_0x3b7a05[_0x8e89('0x2c')],'sectionId':_0x3b7a05['id']},{})['then'](function(){return _0x2a37e1;});}else{return _0x2a37e1;}})[_0x8e89('0x47')](function(_0x18a07d){logger[_0x8e89('0x2a')](_0x8e89('0x54'),_0x18a07d);throw _0x18a07d;});}return _0x2a37e1;})[_0x8e89('0x27')](respondWithResult(_0x6f7d0e,0xc9))[_0x8e89('0x47')](handleError(_0x6f7d0e,null));};exports['update']=function(_0x108b49,_0x2c1999){if(_0x108b49[_0x8e89('0x4d')]['id']){delete _0x108b49[_0x8e89('0x4d')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x108b49[_0x8e89('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c1999,null))['then'](saveUpdates(_0x108b49['body'],null))[_0x8e89('0x27')](respondWithResult(_0x2c1999,null))['catch'](handleError(_0x2c1999,null));};exports[_0x8e89('0x29')]=function(_0x477aca,_0x38c254){return db['SquareOdbc'][_0x8e89('0x51')]({'where':{'id':_0x477aca[_0x8e89('0x49')]['id']}})['then'](handleEntityNotFound(_0x38c254,null))[_0x8e89('0x27')](removeEntity(_0x38c254,null))[_0x8e89('0x47')](handleError(_0x38c254,null));};exports['test']=function(_0x124b7a,_0x1fb913,_0x2f7257){var _0x22fef9;return db['SquareOdbc'][_0x8e89('0x51')]({'where':{'id':_0x124b7a[_0x8e89('0x49')]['id']},'attributes':['id',_0x8e89('0x55')]})['then'](handleEntityNotFound(_0x1fb913,null))[_0x8e89('0x27')](function(_0x296103){if(_0x296103){var _0x11d7ec=require('odbc')();_0x11d7ec['openSync'](_0x296103[_0x8e89('0x55')]);_0x11d7ec[_0x8e89('0x56')]();return _0x296103;}})[_0x8e89('0x27')](respondWithResult(_0x1fb913,null))[_0x8e89('0x47')](handleError(_0x1fb913,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a88fcc7..6ab3f94 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 _0x8b07=['../../config/environment','define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x288d3a,_0x3482ca){var _0x1c0b2d=function(_0x369150){while(--_0x369150){_0x288d3a['push'](_0x288d3a['shift']());}};_0x1c0b2d(++_0x3482ca);}(_0x8b07,0x6f));var _0x78b0=function(_0xd0d12a,_0x575683){_0xd0d12a=_0xd0d12a-0x0;var _0x514d07=_0x8b07[_0xd0d12a];return _0x514d07;};'use strict';var _=require(_0x78b0('0x0'));var util=require(_0x78b0('0x1'));var logger=require(_0x78b0('0x2'))(_0x78b0('0x3'));var moment=require(_0x78b0('0x4'));var BPromise=require(_0x78b0('0x5'));var rp=require(_0x78b0('0x6'));var fs=require('fs');var path=require(_0x78b0('0x7'));var rimraf=require(_0x78b0('0x8'));var config=require(_0x78b0('0x9'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x1cc8c5,_0x4ccaac){return _0x1cc8c5[_0x78b0('0xa')](_0x78b0('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa685=['path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0xa685,0x1cd));var _0x5a68=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0xa685[_0x5a7618];return _0x12dc65;};'use strict';var _=require(_0x5a68('0x0'));var util=require(_0x5a68('0x1'));var logger=require(_0x5a68('0x2'))(_0x5a68('0x3'));var moment=require(_0x5a68('0x4'));var BPromise=require(_0x5a68('0x5'));var rp=require(_0x5a68('0x6'));var fs=require('fs');var path=require(_0x5a68('0x7'));var rimraf=require(_0x5a68('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a68('0x9'));module[_0x5a68('0xa')]=function(_0x289d0c,_0x172da5){return _0x289d0c['define'](_0x5a68('0xb'),attributes,{'tableName':_0x5a68('0xc'),'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 195c78c..93607c9 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 _0x9fd7=['message','result','ShowSquareOdbc','options','where','attributes','include','map','model','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x105080,_0x2a8b60){var _0x72b561=function(_0xefa285){while(--_0xefa285){_0x105080['push'](_0x105080['shift']());}};_0x72b561(++_0x2a8b60);}(_0x9fd7,0xd2));var _0x79fd=function(_0x2827a5,_0x287f24){_0x2827a5=_0x2827a5-0x0;var _0x5151d2=_0x9fd7[_0x2827a5];return _0x5151d2;};'use strict';var _=require(_0x79fd('0x0'));var util=require(_0x79fd('0x1'));var moment=require(_0x79fd('0x2'));var BPromise=require(_0x79fd('0x3'));var rs=require(_0x79fd('0x4'));var fs=require('fs');var Redis=require(_0x79fd('0x5'));var db=require(_0x79fd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x79fd('0x7'))(_0x79fd('0x8'));var config=require(_0x79fd('0x9'));var jayson=require(_0x79fd('0xa'));var client=jayson[_0x79fd('0xb')][_0x79fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x509bf3,_0x19972,_0x4bb145){return new BPromise(function(_0x556db0,_0x5ed701){return client[_0x79fd('0xd')](_0x509bf3,_0x4bb145)['then'](function(_0x2fb649){logger[_0x79fd('0xe')](_0x79fd('0xf'),_0x19972,_0x79fd('0x10'));logger['debug'](_0x79fd('0x11'),_0x19972,_0x79fd('0x10'),JSON[_0x79fd('0x12')](_0x2fb649));if(_0x2fb649[_0x79fd('0x13')]){if(_0x2fb649[_0x79fd('0x13')][_0x79fd('0x14')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x19972,_0x2fb649[_0x79fd('0x13')][_0x79fd('0x15')]);return _0x5ed701(_0x2fb649[_0x79fd('0x13')][_0x79fd('0x15')]);}logger[_0x79fd('0x13')](_0x79fd('0xf'),_0x19972,_0x2fb649[_0x79fd('0x13')][_0x79fd('0x15')]);return _0x556db0(_0x2fb649[_0x79fd('0x13')][_0x79fd('0x15')]);}else{logger['info'](_0x79fd('0xf'),_0x19972,_0x79fd('0x10'));_0x556db0(_0x2fb649[_0x79fd('0x16')][_0x79fd('0x15')]);}})['catch'](function(_0x184e77){logger[_0x79fd('0x13')](_0x79fd('0xf'),_0x19972,_0x184e77);_0x5ed701(_0x184e77);});});}exports[_0x79fd('0x17')]=function(_0x39cd94){var _0xc20f36=this;return new Promise(function(_0x1794dd,_0x1b54c0){return db['SquareOdbc']['find']({'raw':_0x39cd94[_0x79fd('0x18')]?_0x39cd94[_0x79fd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39cd94['options']?_0x39cd94['options'][_0x79fd('0x19')]||null:null,'attributes':_0x39cd94['options']?_0x39cd94[_0x79fd('0x18')][_0x79fd('0x1a')]||null:null,'include':_0x39cd94[_0x79fd('0x18')]?_0x39cd94[_0x79fd('0x18')][_0x79fd('0x1b')]?_[_0x79fd('0x1c')](_0x39cd94['options'][_0x79fd('0x1b')],function(_0x5147dc){return{'model':db[_0x5147dc[_0x79fd('0x1d')]],'as':_0x5147dc['as'],'attributes':_0x5147dc[_0x79fd('0x1a')],'include':_0x5147dc['include']?_[_0x79fd('0x1c')](_0x5147dc[_0x79fd('0x1b')],function(_0x138c0c){return{'model':db[_0x138c0c[_0x79fd('0x1d')]],'as':_0x138c0c['as'],'attributes':_0x138c0c[_0x79fd('0x1a')],'include':_0x138c0c[_0x79fd('0x1b')]?_[_0x79fd('0x1c')](_0x138c0c[_0x79fd('0x1b')],function(_0x3ac324){return{'model':db[_0x3ac324[_0x79fd('0x1d')]],'as':_0x3ac324['as'],'attributes':_0x3ac324['attributes']};}):[]};}):[]};}):[]:[]})[_0x79fd('0x1e')](function(_0xe4d2cd){logger[_0x79fd('0xe')]('ShowSquareOdbc',_0x39cd94);logger[_0x79fd('0x1f')](_0x79fd('0x17'),_0x39cd94,JSON[_0x79fd('0x12')](_0xe4d2cd));_0x1794dd(_0xe4d2cd);})[_0x79fd('0x20')](function(_0x3a7b36){logger[_0x79fd('0x13')]('ShowSquareOdbc',_0x3a7b36[_0x79fd('0x15')],_0x39cd94);_0x1b54c0(_0xc20f36[_0x79fd('0x13')](0x1f4,_0x3a7b36[_0x79fd('0x15')]));});});}; \ No newline at end of file +var _0x6e85=['message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s'];(function(_0x3906d2,_0x4b3aab){var _0x5d74c8=function(_0x2ab97c){while(--_0x2ab97c){_0x3906d2['push'](_0x3906d2['shift']());}};_0x5d74c8(++_0x4b3aab);}(_0x6e85,0x14d));var _0x56e8=function(_0x150079,_0x2326a7){_0x150079=_0x150079-0x0;var _0x47fded=_0x6e85[_0x150079];return _0x47fded;};'use strict';var _=require('lodash');var util=require(_0x56e8('0x0'));var moment=require(_0x56e8('0x1'));var BPromise=require(_0x56e8('0x2'));var rs=require(_0x56e8('0x3'));var fs=require('fs');var Redis=require(_0x56e8('0x4'));var db=require(_0x56e8('0x5'))['db'];var utils=require(_0x56e8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x56e8('0x7'));var jayson=require(_0x56e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5506a7,_0x24d41c,_0x4de142){return new BPromise(function(_0xf3a541,_0x226edf){return client[_0x56e8('0x9')](_0x5506a7,_0x4de142)[_0x56e8('0xa')](function(_0x750421){logger[_0x56e8('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x24d41c,'request\x20sent');logger[_0x56e8('0xc')](_0x56e8('0xd'),_0x24d41c,_0x56e8('0xe'),JSON[_0x56e8('0xf')](_0x750421));if(_0x750421[_0x56e8('0x10')]){if(_0x750421[_0x56e8('0x10')][_0x56e8('0x11')]===0x1f4){logger[_0x56e8('0x10')](_0x56e8('0x12'),_0x24d41c,_0x750421['error']['message']);return _0x226edf(_0x750421[_0x56e8('0x10')]['message']);}logger[_0x56e8('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x24d41c,_0x750421[_0x56e8('0x10')][_0x56e8('0x13')]);return _0xf3a541(_0x750421[_0x56e8('0x10')][_0x56e8('0x13')]);}else{logger[_0x56e8('0xb')](_0x56e8('0x12'),_0x24d41c,_0x56e8('0xe'));_0xf3a541(_0x750421[_0x56e8('0x14')][_0x56e8('0x13')]);}})[_0x56e8('0x15')](function(_0x4bc6b6){logger[_0x56e8('0x10')](_0x56e8('0x12'),_0x24d41c,_0x4bc6b6);_0x226edf(_0x4bc6b6);});});}exports[_0x56e8('0x16')]=function(_0x1dd598){var _0x504ffd=this;return new Promise(function(_0x8e960a,_0xeae7fc){return db[_0x56e8('0x17')][_0x56e8('0x18')]({'raw':_0x1dd598[_0x56e8('0x19')]?_0x1dd598['options'][_0x56e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dd598[_0x56e8('0x19')]?_0x1dd598[_0x56e8('0x19')][_0x56e8('0x1b')]||null:null,'attributes':_0x1dd598[_0x56e8('0x19')]?_0x1dd598[_0x56e8('0x19')][_0x56e8('0x1c')]||null:null,'include':_0x1dd598['options']?_0x1dd598[_0x56e8('0x19')][_0x56e8('0x1d')]?_[_0x56e8('0x1e')](_0x1dd598[_0x56e8('0x19')]['include'],function(_0x23fa69){return{'model':db[_0x23fa69[_0x56e8('0x1f')]],'as':_0x23fa69['as'],'attributes':_0x23fa69[_0x56e8('0x1c')],'include':_0x23fa69[_0x56e8('0x1d')]?_['map'](_0x23fa69['include'],function(_0x4f27f0){return{'model':db[_0x4f27f0['model']],'as':_0x4f27f0['as'],'attributes':_0x4f27f0['attributes'],'include':_0x4f27f0[_0x56e8('0x1d')]?_['map'](_0x4f27f0[_0x56e8('0x1d')],function(_0x33272a){return{'model':db[_0x33272a[_0x56e8('0x1f')]],'as':_0x33272a['as'],'attributes':_0x33272a[_0x56e8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37cb3e){logger[_0x56e8('0xb')]('ShowSquareOdbc',_0x1dd598);logger[_0x56e8('0xc')](_0x56e8('0x16'),_0x1dd598,JSON['stringify'](_0x37cb3e));_0x8e960a(_0x37cb3e);})[_0x56e8('0x15')](function(_0x53d456){logger[_0x56e8('0x10')](_0x56e8('0x16'),_0x53d456[_0x56e8('0x13')],_0x1dd598);_0xeae7fc(_0x504ffd[_0x56e8('0x10')](0x1f4,_0x53d456[_0x56e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3782914..82eb109 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 _0x19c4=['index','/:id','show','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x19c4,0x181));var _0x419c=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x19c4[_0x2c5255];return _0x30d0ea;};'use strict';var multer=require(_0x419c('0x0'));var util=require('util');var path=require(_0x419c('0x1'));var timeout=require(_0x419c('0x2'));var express=require(_0x419c('0x3'));var router=express[_0x419c('0x4')]();var fs_extra=require(_0x419c('0x5'));var auth=require(_0x419c('0x6'));var interaction=require(_0x419c('0x7'));var config=require(_0x419c('0x8'));var controller=require(_0x419c('0x9'));router['get']('/',auth[_0x419c('0xa')](),controller[_0x419c('0xb')]);router['get'](_0x419c('0xc'),auth[_0x419c('0xa')](),controller[_0x419c('0xd')]);router[_0x419c('0xe')]('/',auth[_0x419c('0xa')](),controller[_0x419c('0xf')]);router['put'](_0x419c('0xc'),auth['isAuthenticated'](),controller[_0x419c('0x10')]);router[_0x419c('0x11')](_0x419c('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7e99=['../../config/environment','./squareProject.controller','get','show','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18928d,_0x457833){var _0x4520f1=function(_0x507c94){while(--_0x507c94){_0x18928d['push'](_0x18928d['shift']());}};_0x4520f1(++_0x457833);}(_0x7e99,0x81));var _0x97e9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7e99[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x97e9('0x0'));var util=require(_0x97e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x97e9('0x2'));var router=express[_0x97e9('0x3')]();var fs_extra=require(_0x97e9('0x4'));var auth=require(_0x97e9('0x5'));var interaction=require(_0x97e9('0x6'));var config=require(_0x97e9('0x7'));var controller=require(_0x97e9('0x8'));router[_0x97e9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x97e9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x97e9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97e9('0xb')]);router[_0x97e9('0xc')](_0x97e9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x97e9('0xe')](_0x97e9('0xd'),auth['isAuthenticated'](),controller[_0x97e9('0xf')]);module[_0x97e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f6dfc1d..408b047 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 _0x7753=['DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','utf8','production','toString'];(function(_0x4522ce,_0x4a3a79){var _0x566414=function(_0x128f35){while(--_0x128f35){_0x4522ce['push'](_0x4522ce['shift']());}};_0x566414(++_0x4a3a79);}(_0x7753,0xfd));var _0x3775=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x7753[_0x2ab365];return _0x49fef3;};'use strict';var Sequelize=require(_0x3775('0x0'));module[_0x3775('0x1')]={'name':{'type':Sequelize[_0x3775('0x2')],'unique':_0x3775('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3775('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x3775('0x4')](_0x3775('0x5')),'get':function(){if(this[_0x3775('0x6')]('preproduction')){return this[_0x3775('0x6')](_0x3775('0x7'))['toString'](_0x3775('0x8'));}}},'production':{'type':Sequelize[_0x3775('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x3775('0x9'))){return this[_0x3775('0x6')](_0x3775('0x9'))[_0x3775('0xa')](_0x3775('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x3775('0xb')]}}; \ No newline at end of file +var _0x514d=['toString','long','production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','preproduction','getDataValue'];(function(_0x27ff27,_0x47898e){var _0x20fe26=function(_0x36f39e){while(--_0x36f39e){_0x27ff27['push'](_0x27ff27['shift']());}};_0x20fe26(++_0x47898e);}(_0x514d,0x87));var _0xd514=function(_0x5d314f,_0x349994){_0x5d314f=_0x5d314f-0x0;var _0xf2f268=_0x514d[_0x5d314f];return _0xf2f268;};'use strict';var Sequelize=require(_0xd514('0x0'));module[_0xd514('0x1')]={'name':{'type':Sequelize[_0xd514('0x2')],'unique':_0xd514('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd514('0x2')]},'notes':{'type':Sequelize[_0xd514('0x4')]},'preproduction':{'type':Sequelize[_0xd514('0x5')]('long'),'get':function(){if(this['getDataValue'](_0xd514('0x6'))){return this[_0xd514('0x7')](_0xd514('0x6'))[_0xd514('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xd514('0x5')](_0xd514('0x9')),'get':function(){if(this['getDataValue'](_0xd514('0xa'))){return this[_0xd514('0x7')](_0xd514('0xa'))[_0xd514('0x8')](_0xd514('0xb'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd514('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d127fa8..90a366e 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 _0x9dbf=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./squareProject.socket','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','status','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','SquareProject','includeAll','include','findAll','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3e9be1,_0x2fac9c){var _0x41518b=function(_0x5f19ed){while(--_0x5f19ed){_0x3e9be1['push'](_0x3e9be1['shift']());}};_0x41518b(++_0x2fac9c);}(_0x9dbf,0x11b));var _0xf9db=function(_0x4975b6,_0x530657){_0x4975b6=_0x4975b6-0x0;var _0x58e70a=_0x9dbf[_0x4975b6];return _0x58e70a;};'use strict';var _=require(_0xf9db('0x0'));var Redis=require(_0xf9db('0x1'));var qs=require(_0xf9db('0x2'));var logger=require(_0xf9db('0x3'))(_0xf9db('0x4'));var config=require(_0xf9db('0x5'));var db=require(_0xf9db('0x6'))['db'];config['redis']=_[_0xf9db('0x7')](config[_0xf9db('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9db('0x8')]));require(_0xf9db('0x9'))['register'](socket);function respondWithResult(_0x32804f,_0x1eaa72){_0x1eaa72=_0x1eaa72||0xc8;return function(_0x4dfa0b){if(_0x4dfa0b){return _0x32804f['status'](_0x1eaa72)[_0xf9db('0xa')](_0x4dfa0b);}};}function respondWithFilteredResult(_0xdf9f08,_0x1bc081){return function(_0x5b8f01){if(_0x5b8f01){var _0x3734b0=typeof _0x1bc081[_0xf9db('0xb')]===_0xf9db('0xc')&&typeof _0x1bc081[_0xf9db('0xd')]===_0xf9db('0xc');var _0x19dd42=_0x5b8f01[_0xf9db('0xe')];var _0xf81103=_0x3734b0?0x0:_0x1bc081[_0xf9db('0xb')];var _0x578549=_0x3734b0?_0x5b8f01[_0xf9db('0xe')]:_0x1bc081['offset']+_0x1bc081['limit'];var _0x518410;if(_0x578549>=_0x19dd42){_0x578549=_0x19dd42;_0x518410=0xc8;}else{_0x518410=0xce;}_0xdf9f08['status'](_0x518410);return _0xdf9f08[_0xf9db('0xf')](_0xf9db('0x10'),_0xf81103+'-'+_0x578549+'/'+_0x19dd42)['json'](_0x5b8f01);}return null;};}function saveUpdates(_0x492495){return function(_0x4e201c){if(_0x4e201c){return _0x4e201c[_0xf9db('0x11')](_0x492495)[_0xf9db('0x12')](function(_0x1afb86){return _0x1afb86;});}return null;};}function removeEntity(_0x26a7cf){return function(_0x3f11b8){if(_0x3f11b8){return _0x3f11b8[_0xf9db('0x13')]()[_0xf9db('0x12')](function(){var _0x42e94f=_0x3f11b8[_0xf9db('0x14')]({'plain':!![]});var _0x4fda89=_0xf9db('0x15');return db[_0xf9db('0x16')][_0xf9db('0x13')]({'where':{'type':_0x4fda89,'resourceId':_0x42e94f['id']}})[_0xf9db('0x12')](function(){return _0x3f11b8;});})[_0xf9db('0x12')](function(){var _0x3c935c=new Redis(config[_0xf9db('0x8')]);_0x3c935c[_0xf9db('0x17')](_0xf9db('0x18'),JSON[_0xf9db('0x19')]({'id':_0x3f11b8['id'],'deleted':!![]}));})[_0xf9db('0x12')](function(){_0x26a7cf['status'](0xcc)[_0xf9db('0x1a')]();});}};}function handleEntityNotFound(_0xc010ab){return function(_0x1af20c){if(!_0x1af20c){_0xc010ab[_0xf9db('0x1b')](0x194);}return _0x1af20c;};}function handleError(_0x1cefe7,_0xf0475a){_0xf0475a=_0xf0475a||0x1f4;return function(_0x204a63){logger[_0xf9db('0x1c')](_0x204a63[_0xf9db('0x1d')]);if(_0x204a63['name']){delete _0x204a63[_0xf9db('0x1e')];}_0x1cefe7[_0xf9db('0x1f')](_0xf0475a)[_0xf9db('0x20')](_0x204a63);};}exports[_0xf9db('0x21')]=function(_0x2afcb5,_0x2d909a){var _0x32c0f4={},_0x5f2d1b={},_0x4bdf7b={'count':0x0,'rows':[]};var _0x4c57d6=_[_0xf9db('0x22')](db['SquareProject'][_0xf9db('0x23')],function(_0x179f4){return{'name':_0x179f4[_0xf9db('0x24')],'type':_0x179f4['type']['key']};});_0x5f2d1b[_0xf9db('0x25')]=_[_0xf9db('0x22')](_0x4c57d6,_0xf9db('0x1e'));_0x5f2d1b[_0xf9db('0x26')]=_[_0xf9db('0x27')](_0x2afcb5[_0xf9db('0x26')]);_0x5f2d1b[_0xf9db('0x28')]=_[_0xf9db('0x29')](_0x5f2d1b['model'],_0x5f2d1b['query']);_0x32c0f4['attributes']=_[_0xf9db('0x29')](_0x5f2d1b[_0xf9db('0x25')],qs[_0xf9db('0x2a')](_0x2afcb5[_0xf9db('0x26')]['fields']));_0x32c0f4[_0xf9db('0x2b')]=_0x32c0f4['attributes'][_0xf9db('0x2c')]?_0x32c0f4[_0xf9db('0x2b')]:_0x5f2d1b[_0xf9db('0x25')];if(!_0x2afcb5[_0xf9db('0x26')][_0xf9db('0x2d')](_0xf9db('0x2e'))){_0x32c0f4[_0xf9db('0xd')]=qs[_0xf9db('0xd')](_0x2afcb5['query'][_0xf9db('0xd')]);_0x32c0f4[_0xf9db('0xb')]=qs['offset'](_0x2afcb5['query'][_0xf9db('0xb')]);}_0x32c0f4['order']=qs[_0xf9db('0x2f')](_0x2afcb5[_0xf9db('0x26')][_0xf9db('0x2f')]);_0x32c0f4[_0xf9db('0x30')]=qs[_0xf9db('0x28')](_[_0xf9db('0x31')](_0x2afcb5[_0xf9db('0x26')],_0x5f2d1b[_0xf9db('0x28')]),_0x4c57d6);if(_0x2afcb5['query'][_0xf9db('0x32')]){_0x32c0f4['where']=_[_0xf9db('0x33')](_0x32c0f4[_0xf9db('0x30')],{'$or':_[_0xf9db('0x22')](_0x4c57d6,function(_0x4da2ac){if(_0x4da2ac[_0xf9db('0x34')]!=='VIRTUAL'){var _0x3413eb={};_0x3413eb[_0x4da2ac['name']]={'$like':'%'+_0x2afcb5[_0xf9db('0x26')][_0xf9db('0x32')]+'%'};return _0x3413eb;}})});}_0x32c0f4=_['merge']({},_0x32c0f4,_0x2afcb5[_0xf9db('0x35')]);var _0x17c826={'where':_0x32c0f4['where']};return db[_0xf9db('0x36')][_0xf9db('0xe')](_0x17c826)[_0xf9db('0x12')](function(_0xb0abc7){_0x4bdf7b[_0xf9db('0xe')]=_0xb0abc7;if(_0x2afcb5[_0xf9db('0x26')][_0xf9db('0x37')]){_0x32c0f4[_0xf9db('0x38')]=[{'all':!![]}];}return db['SquareProject'][_0xf9db('0x39')](_0x32c0f4);})[_0xf9db('0x12')](function(_0x4c5db3){_0x4bdf7b['rows']=_0x4c5db3;return _0x4bdf7b;})[_0xf9db('0x12')](respondWithFilteredResult(_0x2d909a,_0x32c0f4))['catch'](handleError(_0x2d909a,null));};exports[_0xf9db('0x3a')]=function(_0x343ffa,_0x5202a0){var _0x5b9467={'raw':![],'where':{'id':_0x343ffa['params']['id']}},_0x3ce617={};_0x3ce617[_0xf9db('0x25')]=_[_0xf9db('0x27')](db['SquareProject'][_0xf9db('0x23')]);_0x3ce617['query']=_['keys'](_0x343ffa[_0xf9db('0x26')]);_0x3ce617[_0xf9db('0x28')]=_[_0xf9db('0x29')](_0x3ce617['model'],_0x3ce617['query']);_0x5b9467[_0xf9db('0x2b')]=_['intersection'](_0x3ce617[_0xf9db('0x25')],qs['fields'](_0x343ffa['query'][_0xf9db('0x2a')]));_0x5b9467[_0xf9db('0x2b')]=_0x5b9467['attributes']['length']?_0x5b9467[_0xf9db('0x2b')]:_0x3ce617[_0xf9db('0x25')];if(_0x343ffa[_0xf9db('0x26')][_0xf9db('0x37')]){_0x5b9467['include']=[{'all':!![]}];}_0x5b9467=_['merge']({},_0x5b9467,_0x343ffa[_0xf9db('0x35')]);return db[_0xf9db('0x36')][_0xf9db('0x3b')](_0x5b9467)[_0xf9db('0x12')](handleEntityNotFound(_0x5202a0,null))[_0xf9db('0x12')](respondWithResult(_0x5202a0,null))[_0xf9db('0x3c')](handleError(_0x5202a0,null));};exports['create']=function(_0x5cd84e,_0x587274){return db[_0xf9db('0x36')][_0xf9db('0x3d')](_0x5cd84e[_0xf9db('0x3e')],{})[_0xf9db('0x12')](function(_0x3c893e){var _0x6eb1ef=_0x5cd84e['user'][_0xf9db('0x14')]({'plain':!![]});if(!_0x6eb1ef)throw new Error(_0xf9db('0x3f'));if(_0x6eb1ef['role']==='user'){var _0x1c8a9c=_0x3c893e[_0xf9db('0x14')]({'plain':!![]});var _0x261a48=_0xf9db('0x15');return db[_0xf9db('0x40')][_0xf9db('0x3b')]({'where':{'name':_0x261a48,'userProfileId':_0x6eb1ef[_0xf9db('0x41')]},'raw':!![]})[_0xf9db('0x12')](function(_0x551306){if(_0x551306&&_0x551306[_0xf9db('0x42')]===0x0){return db[_0xf9db('0x16')][_0xf9db('0x3d')]({'name':_0x1c8a9c[_0xf9db('0x1e')],'resourceId':_0x1c8a9c['id'],'type':_0x551306[_0xf9db('0x1e')],'sectionId':_0x551306['id']},{})['then'](function(){return _0x3c893e;});}else{return _0x3c893e;}})[_0xf9db('0x3c')](function(_0x3d8932){logger[_0xf9db('0x1c')](_0xf9db('0x43'),_0x3d8932);throw _0x3d8932;});}return _0x3c893e;})[_0xf9db('0x12')](respondWithResult(_0x587274,0xc9))[_0xf9db('0x3c')](handleError(_0x587274,null));};exports[_0xf9db('0x11')]=function(_0x25b628,_0x5705f0){if(_0x25b628[_0xf9db('0x3e')]['id']){delete _0x25b628[_0xf9db('0x3e')]['id'];}return db[_0xf9db('0x36')]['find']({'where':{'id':_0x25b628[_0xf9db('0x44')]['id']}})[_0xf9db('0x12')](handleEntityNotFound(_0x5705f0,null))[_0xf9db('0x12')](saveUpdates(_0x25b628[_0xf9db('0x3e')],null))[_0xf9db('0x12')](function(_0x41955f){if(!_0x41955f)return;var _0x2d37f8=_0x41955f[_0xf9db('0x14')]({'plain':!![]});return _0x2d37f8;})['then'](function(_0x2831ae){var _0x230bc5=new Redis(config[_0xf9db('0x8')]);_0x230bc5['publish'](_0xf9db('0x18'),JSON[_0xf9db('0x19')](_['pick'](_0x2831ae,['id',_0xf9db('0x1e'),_0xf9db('0x45')])));return _0x2831ae;})[_0xf9db('0x12')](respondWithResult(_0x5705f0,null))[_0xf9db('0x3c')](handleError(_0x5705f0,null));};exports[_0xf9db('0x13')]=function(_0x454964,_0x421e62){return db[_0xf9db('0x36')][_0xf9db('0x3b')]({'where':{'id':_0x454964[_0xf9db('0x44')]['id']}})[_0xf9db('0x12')](handleEntityNotFound(_0x421e62,null))[_0xf9db('0x12')](removeEntity(_0x421e62,null))[_0xf9db('0x3c')](handleError(_0x421e62,null));}; \ No newline at end of file +var _0x478a=['model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','agi','stringify','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','undefined','limit','count','offset','set','then','destroy','get','UserProfileResource','publish','sendStatus','stack','name','send','SquareProject','fieldName','type','key'];(function(_0x282a31,_0x3db803){var _0x152786=function(_0x466b7b){while(--_0x466b7b){_0x282a31['push'](_0x282a31['shift']());}};_0x152786(++_0x3db803);}(_0x478a,0x180));var _0xa478=function(_0x1064f3,_0x1bd224){_0x1064f3=_0x1064f3-0x0;var _0x4889aa=_0x478a[_0x1064f3];return _0x4889aa;};'use strict';var _=require(_0xa478('0x0'));var Redis=require('ioredis');var qs=require(_0xa478('0x1'));var logger=require(_0xa478('0x2'))(_0xa478('0x3'));var config=require(_0xa478('0x4'));var db=require(_0xa478('0x5'))['db'];config[_0xa478('0x6')]=_[_0xa478('0x7')](config['redis'],{'host':_0xa478('0x8'),'port':0x18eb});var socket=require(_0xa478('0x9'))(new Redis(config[_0xa478('0x6')]));require('./squareProject.socket')[_0xa478('0xa')](socket);function respondWithResult(_0x288f8d,_0x3222b9){_0x3222b9=_0x3222b9||0xc8;return function(_0x4c87d8){if(_0x4c87d8){return _0x288f8d[_0xa478('0xb')](_0x3222b9)['json'](_0x4c87d8);}};}function respondWithFilteredResult(_0x47cbae,_0x1c4ecd){return function(_0x46fde6){if(_0x46fde6){var _0x38e7fd=typeof _0x1c4ecd['offset']===_0xa478('0xc')&&typeof _0x1c4ecd[_0xa478('0xd')]==='undefined';var _0xf35837=_0x46fde6[_0xa478('0xe')];var _0x3b30ab=_0x38e7fd?0x0:_0x1c4ecd[_0xa478('0xf')];var _0x1cfb55=_0x38e7fd?_0x46fde6[_0xa478('0xe')]:_0x1c4ecd['offset']+_0x1c4ecd[_0xa478('0xd')];var _0x22a086;if(_0x1cfb55>=_0xf35837){_0x1cfb55=_0xf35837;_0x22a086=0xc8;}else{_0x22a086=0xce;}_0x47cbae[_0xa478('0xb')](_0x22a086);return _0x47cbae[_0xa478('0x10')]('Content-Range',_0x3b30ab+'-'+_0x1cfb55+'/'+_0xf35837)['json'](_0x46fde6);}return null;};}function saveUpdates(_0x250421){return function(_0xcf90c9){if(_0xcf90c9){return _0xcf90c9['update'](_0x250421)[_0xa478('0x11')](function(_0x3e3d99){return _0x3e3d99;});}return null;};}function removeEntity(_0x329709){return function(_0x2aa340){if(_0x2aa340){return _0x2aa340[_0xa478('0x12')]()[_0xa478('0x11')](function(){var _0x436990=_0x2aa340[_0xa478('0x13')]({'plain':!![]});var _0x3e8bd6='SquareProjects';return db[_0xa478('0x14')][_0xa478('0x12')]({'where':{'type':_0x3e8bd6,'resourceId':_0x436990['id']}})[_0xa478('0x11')](function(){return _0x2aa340;});})[_0xa478('0x11')](function(){var _0x505fd0=new Redis(config[_0xa478('0x6')]);_0x505fd0[_0xa478('0x15')]('agi',JSON['stringify']({'id':_0x2aa340['id'],'deleted':!![]}));})[_0xa478('0x11')](function(){_0x329709[_0xa478('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bbce2){return function(_0x132381){if(!_0x132381){_0x5bbce2[_0xa478('0x16')](0x194);}return _0x132381;};}function handleError(_0x309b4a,_0x356482){_0x356482=_0x356482||0x1f4;return function(_0x2aaddd){logger['error'](_0x2aaddd[_0xa478('0x17')]);if(_0x2aaddd[_0xa478('0x18')]){delete _0x2aaddd['name'];}_0x309b4a[_0xa478('0xb')](_0x356482)[_0xa478('0x19')](_0x2aaddd);};}exports['index']=function(_0x5e0939,_0x39c759){var _0x2f91aa={},_0x5985b7={},_0x22d3c4={'count':0x0,'rows':[]};var _0x10f1ed=_['map'](db[_0xa478('0x1a')]['rawAttributes'],function(_0x594325){return{'name':_0x594325[_0xa478('0x1b')],'type':_0x594325[_0xa478('0x1c')][_0xa478('0x1d')]};});_0x5985b7[_0xa478('0x1e')]=_[_0xa478('0x1f')](_0x10f1ed,'name');_0x5985b7[_0xa478('0x20')]=_[_0xa478('0x21')](_0x5e0939['query']);_0x5985b7[_0xa478('0x22')]=_[_0xa478('0x23')](_0x5985b7[_0xa478('0x1e')],_0x5985b7[_0xa478('0x20')]);_0x2f91aa[_0xa478('0x24')]=_['intersection'](_0x5985b7['model'],qs[_0xa478('0x25')](_0x5e0939[_0xa478('0x20')][_0xa478('0x25')]));_0x2f91aa[_0xa478('0x24')]=_0x2f91aa[_0xa478('0x24')][_0xa478('0x26')]?_0x2f91aa[_0xa478('0x24')]:_0x5985b7['model'];if(!_0x5e0939['query']['hasOwnProperty'](_0xa478('0x27'))){_0x2f91aa[_0xa478('0xd')]=qs[_0xa478('0xd')](_0x5e0939[_0xa478('0x20')][_0xa478('0xd')]);_0x2f91aa['offset']=qs['offset'](_0x5e0939[_0xa478('0x20')][_0xa478('0xf')]);}_0x2f91aa[_0xa478('0x28')]=qs[_0xa478('0x29')](_0x5e0939['query'][_0xa478('0x29')]);_0x2f91aa[_0xa478('0x2a')]=qs[_0xa478('0x22')](_[_0xa478('0x2b')](_0x5e0939['query'],_0x5985b7[_0xa478('0x22')]),_0x10f1ed);if(_0x5e0939[_0xa478('0x20')]['filter']){_0x2f91aa['where']=_[_0xa478('0x2c')](_0x2f91aa[_0xa478('0x2a')],{'$or':_[_0xa478('0x1f')](_0x10f1ed,function(_0x2e9ad6){if(_0x2e9ad6[_0xa478('0x1c')]!==_0xa478('0x2d')){var _0x2135df={};_0x2135df[_0x2e9ad6[_0xa478('0x18')]]={'$like':'%'+_0x5e0939['query'][_0xa478('0x2e')]+'%'};return _0x2135df;}})});}_0x2f91aa=_[_0xa478('0x2c')]({},_0x2f91aa,_0x5e0939['options']);var _0x33ac38={'where':_0x2f91aa[_0xa478('0x2a')]};return db[_0xa478('0x1a')]['count'](_0x33ac38)[_0xa478('0x11')](function(_0x57a7e2){_0x22d3c4[_0xa478('0xe')]=_0x57a7e2;if(_0x5e0939[_0xa478('0x20')][_0xa478('0x2f')]){_0x2f91aa['include']=[{'all':!![]}];}return db[_0xa478('0x1a')][_0xa478('0x30')](_0x2f91aa);})[_0xa478('0x11')](function(_0x38c844){_0x22d3c4[_0xa478('0x31')]=_0x38c844;return _0x22d3c4;})[_0xa478('0x11')](respondWithFilteredResult(_0x39c759,_0x2f91aa))[_0xa478('0x32')](handleError(_0x39c759,null));};exports[_0xa478('0x33')]=function(_0x3917ab,_0x22417d){var _0x1aa4ee={'raw':![],'where':{'id':_0x3917ab['params']['id']}},_0x323610={};_0x323610[_0xa478('0x1e')]=_[_0xa478('0x21')](db[_0xa478('0x1a')][_0xa478('0x34')]);_0x323610[_0xa478('0x20')]=_[_0xa478('0x21')](_0x3917ab['query']);_0x323610[_0xa478('0x22')]=_[_0xa478('0x23')](_0x323610[_0xa478('0x1e')],_0x323610[_0xa478('0x20')]);_0x1aa4ee[_0xa478('0x24')]=_[_0xa478('0x23')](_0x323610[_0xa478('0x1e')],qs[_0xa478('0x25')](_0x3917ab[_0xa478('0x20')][_0xa478('0x25')]));_0x1aa4ee[_0xa478('0x24')]=_0x1aa4ee['attributes'][_0xa478('0x26')]?_0x1aa4ee[_0xa478('0x24')]:_0x323610[_0xa478('0x1e')];if(_0x3917ab[_0xa478('0x20')][_0xa478('0x2f')]){_0x1aa4ee[_0xa478('0x35')]=[{'all':!![]}];}_0x1aa4ee=_['merge']({},_0x1aa4ee,_0x3917ab[_0xa478('0x36')]);return db[_0xa478('0x1a')][_0xa478('0x37')](_0x1aa4ee)[_0xa478('0x11')](handleEntityNotFound(_0x22417d,null))[_0xa478('0x11')](respondWithResult(_0x22417d,null))['catch'](handleError(_0x22417d,null));};exports[_0xa478('0x38')]=function(_0x60a2b3,_0x1a35db){return db[_0xa478('0x1a')][_0xa478('0x38')](_0x60a2b3[_0xa478('0x39')],{})['then'](function(_0x1417ce){var _0x14c632=_0x60a2b3[_0xa478('0x3a')][_0xa478('0x13')]({'plain':!![]});if(!_0x14c632)throw new Error(_0xa478('0x3b'));if(_0x14c632['role']==='user'){var _0x4e12a2=_0x1417ce[_0xa478('0x13')]({'plain':!![]});var _0x3dd27d=_0xa478('0x3c');return db['UserProfileSection'][_0xa478('0x37')]({'where':{'name':_0x3dd27d,'userProfileId':_0x14c632[_0xa478('0x3d')]},'raw':!![]})[_0xa478('0x11')](function(_0x1181d4){if(_0x1181d4&&_0x1181d4[_0xa478('0x3e')]===0x0){return db[_0xa478('0x14')][_0xa478('0x38')]({'name':_0x4e12a2[_0xa478('0x18')],'resourceId':_0x4e12a2['id'],'type':_0x1181d4['name'],'sectionId':_0x1181d4['id']},{})[_0xa478('0x11')](function(){return _0x1417ce;});}else{return _0x1417ce;}})['catch'](function(_0x24381b){logger[_0xa478('0x3f')](_0xa478('0x40'),_0x24381b);throw _0x24381b;});}return _0x1417ce;})[_0xa478('0x11')](respondWithResult(_0x1a35db,0xc9))[_0xa478('0x32')](handleError(_0x1a35db,null));};exports[_0xa478('0x41')]=function(_0x28ae94,_0x21c28c){if(_0x28ae94[_0xa478('0x39')]['id']){delete _0x28ae94[_0xa478('0x39')]['id'];}return db[_0xa478('0x1a')][_0xa478('0x37')]({'where':{'id':_0x28ae94[_0xa478('0x42')]['id']}})['then'](handleEntityNotFound(_0x21c28c,null))['then'](saveUpdates(_0x28ae94[_0xa478('0x39')],null))[_0xa478('0x11')](function(_0x97b977){if(!_0x97b977)return;var _0x2cabcf=_0x97b977[_0xa478('0x13')]({'plain':!![]});return _0x2cabcf;})[_0xa478('0x11')](function(_0x52983a){var _0x1c9ee5=new Redis(config['redis']);_0x1c9ee5[_0xa478('0x15')](_0xa478('0x43'),JSON[_0xa478('0x44')](_[_0xa478('0x2b')](_0x52983a,['id',_0xa478('0x18'),'production'])));return _0x52983a;})[_0xa478('0x11')](respondWithResult(_0x21c28c,null))[_0xa478('0x32')](handleError(_0x21c28c,null));};exports[_0xa478('0x12')]=function(_0x1e0fa0,_0x1a9143){return db[_0xa478('0x1a')]['find']({'where':{'id':_0x1e0fa0[_0xa478('0x42')]['id']}})[_0xa478('0x11')](handleEntityNotFound(_0x1a9143,null))[_0xa478('0x11')](removeEntity(_0x1a9143,null))[_0xa478('0x32')](handleError(_0x1a9143,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ed62445..c109132 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 _0x691b=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x691b,0x11e));var _0xb691=function(_0x59f5c1,_0x133fef){_0x59f5c1=_0x59f5c1-0x0;var _0x182112=_0x691b[_0x59f5c1];return _0x182112;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xb691('0x0'))['db'][_0xb691('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb691('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb691('0x3'),'afterDestroy':_0xb691('0x4')};function emitEvent(_0x595380){return function(_0x3172c4,_0x39737e,_0x183ae3){SquareProjectEvents['emit'](_0x595380+':'+_0x3172c4['id'],_0x3172c4);SquareProjectEvents[_0xb691('0x5')](_0x595380,_0x3172c4);_0x183ae3(null);};}for(var e in events){if(events[_0xb691('0x6')](e)){var event=events[e];SquareProject[_0xb691('0x7')](e,emitEvent(event));}}module[_0xb691('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xedfe=['SquareProject','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b7df2,_0xab7af5){var _0x2a32fe=function(_0x53e147){while(--_0x53e147){_0x2b7df2['push'](_0x2b7df2['shift']());}};_0x2a32fe(++_0xab7af5);}(_0xedfe,0x1be));var _0xeedf=function(_0x5b656f,_0x72fcd6){_0x5b656f=_0x5b656f-0x0;var _0x2875c3=_0xedfe[_0x5b656f];return _0x2875c3;};'use strict';var EventEmitter=require(_0xeedf('0x0'));var SquareProject=require(_0xeedf('0x1'))['db'][_0xeedf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x426378){return function(_0x22d342,_0x2b0e70,_0x3813e6){SquareProjectEvents['emit'](_0x426378+':'+_0x22d342['id'],_0x22d342);SquareProjectEvents[_0xeedf('0x3')](_0x426378,_0x22d342);_0x3813e6(null);};}for(var e in events){if(events[_0xeedf('0x4')](e)){var event=events[e];SquareProject[_0xeedf('0x5')](e,emitEvent(event));}}module[_0xeedf('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0e061bf..387b189 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 _0xef8a=['bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','YYYY-MM-DD\x20HH:mm:ss','format','lodash','../../config/logger','api','moment'];(function(_0x4b0ed6,_0x1a595e){var _0x1e7777=function(_0x19445c){while(--_0x19445c){_0x4b0ed6['push'](_0x4b0ed6['shift']());}};_0x1e7777(++_0x1a595e);}(_0xef8a,0xec));var _0xaef8=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xef8a[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0xaef8('0x0'));var util=require('util');var logger=require(_0xaef8('0x1'))(_0xaef8('0x2'));var moment=require(_0xaef8('0x3'));var BPromise=require(_0xaef8('0x4'));var rp=require(_0xaef8('0x5'));var fs=require('fs');var path=require(_0xaef8('0x6'));var rimraf=require('rimraf');var config=require(_0xaef8('0x7'));var attributes=require(_0xaef8('0x8'));module[_0xaef8('0x9')]=function(_0x519fa2,_0x3bdbe5){return _0x519fa2['define'](_0xaef8('0xa'),attributes,{'tableName':_0xaef8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc373cf,_0x37956b,_0x1710fd){if(_0xc373cf[_0xaef8('0xc')]('preproduction')){_0xc373cf['savedAt']=moment()['format'](_0xaef8('0xd'));}if(_0xc373cf[_0xaef8('0xc')]('production')){_0xc373cf['publishedAt']=moment()[_0xaef8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1710fd(null,_0xc373cf);}}});}; \ No newline at end of file +var _0xbbf2=['changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','format'];(function(_0x49f9aa,_0x22ac9d){var _0xf0189=function(_0xfc9040){while(--_0xfc9040){_0x49f9aa['push'](_0x49f9aa['shift']());}};_0xf0189(++_0x22ac9d);}(_0xbbf2,0xd5));var _0x2bbf=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xbbf2[_0x5cabfd];return _0x4bc06c;};'use strict';var _=require(_0x2bbf('0x0'));var util=require(_0x2bbf('0x1'));var logger=require(_0x2bbf('0x2'))(_0x2bbf('0x3'));var moment=require(_0x2bbf('0x4'));var BPromise=require(_0x2bbf('0x5'));var rp=require(_0x2bbf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bbf('0x7'));var config=require(_0x2bbf('0x8'));var attributes=require(_0x2bbf('0x9'));module[_0x2bbf('0xa')]=function(_0x1d24f4,_0xa8382c){return _0x1d24f4['define'](_0x2bbf('0xb'),attributes,{'tableName':_0x2bbf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bb4a9,_0x32bb52,_0x591280){if(_0x3bb4a9['changed'](_0x2bbf('0xd'))){_0x3bb4a9['savedAt']=moment()[_0x2bbf('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3bb4a9[_0x2bbf('0xf')](_0x2bbf('0x10'))){_0x3bb4a9[_0x2bbf('0x11')]=moment()[_0x2bbf('0xe')](_0x2bbf('0x12'));}_0x591280(null,_0x3bb4a9);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f971035..b644720 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 _0x3752=['../../mysqldb','rpc','../../config/environment','redis','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','model','attributes','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','map','lodash'];(function(_0x26e606,_0xf6d86e){var _0x4b346e=function(_0x397e25){while(--_0x397e25){_0x26e606['push'](_0x26e606['shift']());}};_0x4b346e(++_0xf6d86e);}(_0x3752,0x16b));var _0x2375=function(_0x14349b,_0x1eb24d){_0x14349b=_0x14349b-0x0;var _0x34f8cb=_0x3752[_0x14349b];return _0x34f8cb;};'use strict';var _=require(_0x2375('0x0'));var Redis=require('ioredis');var db=require(_0x2375('0x1'))['db'];var logger=require('../../config/logger')(_0x2375('0x2'));var config=require(_0x2375('0x3'));config['redis']=_['defaults'](config[_0x2375('0x4')],{'host':_0x2375('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2375('0x4')]));require(_0x2375('0x6'))[_0x2375('0x7')](socket);exports[_0x2375('0x8')]=function(_0x2e982e){var _0x4f22b8=this;return new Promise(function(_0x39dfac,_0x769a1f){return db[_0x2375('0x9')][_0x2375('0xa')]({'raw':_0x2e982e[_0x2375('0xb')]?_0x2e982e[_0x2375('0xb')][_0x2375('0xc')]===undefined?!![]:![]:!![],'where':_0x2e982e[_0x2375('0xb')]?_0x2e982e[_0x2375('0xb')][_0x2375('0xd')]||null:null,'attributes':_0x2e982e[_0x2375('0xb')]?_0x2e982e[_0x2375('0xb')]['attributes']||null:null,'limit':_0x2e982e[_0x2375('0xb')]?_0x2e982e[_0x2375('0xb')][_0x2375('0xe')]||null:null,'include':_0x2e982e[_0x2375('0xb')]?_0x2e982e['options']['include']?_['map'](_0x2e982e[_0x2375('0xb')][_0x2375('0xf')],function(_0x547591){return{'model':db[_0x547591[_0x2375('0x10')]],'as':_0x547591['as'],'attributes':_0x547591[_0x2375('0x11')],'include':_0x547591[_0x2375('0xf')]?_['map'](_0x547591[_0x2375('0xf')],function(_0x104d60){return{'model':db[_0x104d60[_0x2375('0x10')]],'as':_0x104d60['as'],'attributes':_0x104d60[_0x2375('0x11')],'include':_0x104d60[_0x2375('0xf')]?_['map'](_0x104d60[_0x2375('0xf')],function(_0xf54fad){return{'model':db[_0xf54fad[_0x2375('0x10')]],'as':_0xf54fad['as'],'attributes':_0xf54fad[_0x2375('0x11')]};}):[]};}):[]};}):[]:[]})[_0x2375('0x12')](function(_0x558545){logger[_0x2375('0x13')](_0x2375('0x8'),_0x2e982e);logger[_0x2375('0x14')](_0x2375('0x8'),_0x2e982e,JSON[_0x2375('0x15')](_0x558545));_0x39dfac(_0x558545);})[_0x2375('0x16')](function(_0x3ecffd){logger[_0x2375('0x17')](_0x2375('0x8'),_0x3ecffd[_0x2375('0x18')],_0x2e982e);_0x769a1f(_0x4f22b8['error'](0x1f4,_0x3ecffd[_0x2375('0x18')]));});});};exports[_0x2375('0x19')]=function(_0x5e767a){var _0x4047b7=this;return new Promise(function(_0x6d914e,_0x197a74){return db['SquareProject'][_0x2375('0x1a')]({'raw':_0x5e767a[_0x2375('0xb')]?_0x5e767a[_0x2375('0xb')][_0x2375('0xc')]===undefined?!![]:![]:!![],'where':_0x5e767a[_0x2375('0xb')]?_0x5e767a[_0x2375('0xb')][_0x2375('0xd')]||null:null,'attributes':_0x5e767a[_0x2375('0xb')]?_0x5e767a[_0x2375('0xb')][_0x2375('0x11')]||null:null,'include':_0x5e767a[_0x2375('0xb')]?_0x5e767a[_0x2375('0xb')][_0x2375('0xf')]?_[_0x2375('0x1b')](_0x5e767a[_0x2375('0xb')][_0x2375('0xf')],function(_0x3faa1c){return{'model':db[_0x3faa1c['model']],'as':_0x3faa1c['as'],'attributes':_0x3faa1c[_0x2375('0x11')],'include':_0x3faa1c['include']?_[_0x2375('0x1b')](_0x3faa1c[_0x2375('0xf')],function(_0x3b5dd4){return{'model':db[_0x3b5dd4['model']],'as':_0x3b5dd4['as'],'attributes':_0x3b5dd4[_0x2375('0x11')],'include':_0x3b5dd4[_0x2375('0xf')]?_[_0x2375('0x1b')](_0x3b5dd4[_0x2375('0xf')],function(_0x2e8046){return{'model':db[_0x2e8046[_0x2375('0x10')]],'as':_0x2e8046['as'],'attributes':_0x2e8046[_0x2375('0x11')]};}):[]};}):[]};}):[]:[]})[_0x2375('0x12')](function(_0x1e1ce9){logger['info'](_0x2375('0x19'),_0x5e767a);logger[_0x2375('0x14')](_0x2375('0x19'),_0x5e767a,JSON['stringify'](_0x1e1ce9));_0x6d914e(_0x1e1ce9);})[_0x2375('0x16')](function(_0x322440){logger[_0x2375('0x17')](_0x2375('0x19'),_0x322440[_0x2375('0x18')],_0x5e767a);_0x197a74(_0x4047b7[_0x2375('0x17')](0x1f4,_0x322440['message']));});});}; \ No newline at end of file +var _0x7edc=['limit','include','map','model','info','GetSquareProjects','catch','error','message','ShowSquareProject','find','then','debug','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject','findAll','options','raw','where','attributes'];(function(_0x4e8022,_0x53229d){var _0xf5e73f=function(_0x3a1309){while(--_0x3a1309){_0x4e8022['push'](_0x4e8022['shift']());}};_0xf5e73f(++_0x53229d);}(_0x7edc,0x13a));var _0xc7ed=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x7edc[_0x5a8aa3];return _0x5d0458;};'use strict';var _=require(_0xc7ed('0x0'));var Redis=require(_0xc7ed('0x1'));var db=require(_0xc7ed('0x2'))['db'];var logger=require(_0xc7ed('0x3'))(_0xc7ed('0x4'));var config=require('../../config/environment');config[_0xc7ed('0x5')]=_[_0xc7ed('0x6')](config['redis'],{'host':_0xc7ed('0x7'),'port':0x18eb});var socket=require(_0xc7ed('0x8'))(new Redis(config[_0xc7ed('0x5')]));require(_0xc7ed('0x9'))['register'](socket);exports['GetSquareProjects']=function(_0x155dd7){var _0x47c504=this;return new Promise(function(_0x41c6be,_0x566b5f){return db[_0xc7ed('0xa')][_0xc7ed('0xb')]({'raw':_0x155dd7[_0xc7ed('0xc')]?_0x155dd7['options'][_0xc7ed('0xd')]===undefined?!![]:![]:!![],'where':_0x155dd7[_0xc7ed('0xc')]?_0x155dd7[_0xc7ed('0xc')][_0xc7ed('0xe')]||null:null,'attributes':_0x155dd7[_0xc7ed('0xc')]?_0x155dd7[_0xc7ed('0xc')][_0xc7ed('0xf')]||null:null,'limit':_0x155dd7[_0xc7ed('0xc')]?_0x155dd7[_0xc7ed('0xc')][_0xc7ed('0x10')]||null:null,'include':_0x155dd7[_0xc7ed('0xc')]?_0x155dd7[_0xc7ed('0xc')][_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x155dd7['options']['include'],function(_0x2cb99a){return{'model':db[_0x2cb99a[_0xc7ed('0x13')]],'as':_0x2cb99a['as'],'attributes':_0x2cb99a['attributes'],'include':_0x2cb99a[_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x2cb99a['include'],function(_0x19e8f3){return{'model':db[_0x19e8f3[_0xc7ed('0x13')]],'as':_0x19e8f3['as'],'attributes':_0x19e8f3[_0xc7ed('0xf')],'include':_0x19e8f3[_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x19e8f3[_0xc7ed('0x11')],function(_0x4b56be){return{'model':db[_0x4b56be[_0xc7ed('0x13')]],'as':_0x4b56be['as'],'attributes':_0x4b56be[_0xc7ed('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x290a51){logger[_0xc7ed('0x14')](_0xc7ed('0x15'),_0x155dd7);logger['debug']('GetSquareProjects',_0x155dd7,JSON['stringify'](_0x290a51));_0x41c6be(_0x290a51);})[_0xc7ed('0x16')](function(_0x2bae12){logger[_0xc7ed('0x17')](_0xc7ed('0x15'),_0x2bae12[_0xc7ed('0x18')],_0x155dd7);_0x566b5f(_0x47c504[_0xc7ed('0x17')](0x1f4,_0x2bae12[_0xc7ed('0x18')]));});});};exports[_0xc7ed('0x19')]=function(_0x43241e){var _0x37a2ff=this;return new Promise(function(_0x74a4ca,_0x43a645){return db[_0xc7ed('0xa')][_0xc7ed('0x1a')]({'raw':_0x43241e[_0xc7ed('0xc')]?_0x43241e[_0xc7ed('0xc')][_0xc7ed('0xd')]===undefined?!![]:![]:!![],'where':_0x43241e[_0xc7ed('0xc')]?_0x43241e['options'][_0xc7ed('0xe')]||null:null,'attributes':_0x43241e[_0xc7ed('0xc')]?_0x43241e[_0xc7ed('0xc')][_0xc7ed('0xf')]||null:null,'include':_0x43241e[_0xc7ed('0xc')]?_0x43241e['options'][_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x43241e[_0xc7ed('0xc')][_0xc7ed('0x11')],function(_0x39e789){return{'model':db[_0x39e789['model']],'as':_0x39e789['as'],'attributes':_0x39e789[_0xc7ed('0xf')],'include':_0x39e789[_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x39e789['include'],function(_0x1aa83e){return{'model':db[_0x1aa83e[_0xc7ed('0x13')]],'as':_0x1aa83e['as'],'attributes':_0x1aa83e[_0xc7ed('0xf')],'include':_0x1aa83e[_0xc7ed('0x11')]?_[_0xc7ed('0x12')](_0x1aa83e[_0xc7ed('0x11')],function(_0x5af224){return{'model':db[_0x5af224['model']],'as':_0x5af224['as'],'attributes':_0x5af224[_0xc7ed('0xf')]};}):[]};}):[]};}):[]:[]})[_0xc7ed('0x1b')](function(_0x338d63){logger[_0xc7ed('0x14')](_0xc7ed('0x19'),_0x43241e);logger[_0xc7ed('0x1c')](_0xc7ed('0x19'),_0x43241e,JSON[_0xc7ed('0x1d')](_0x338d63));_0x74a4ca(_0x338d63);})['catch'](function(_0x40184b){logger[_0xc7ed('0x17')](_0xc7ed('0x19'),_0x40184b[_0xc7ed('0x18')],_0x43241e);_0x43a645(_0x37a2ff['error'](0x1f4,_0x40184b[_0xc7ed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9552d5c..7a98af7 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 _0xbf36=['./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xbf36,0xd8));var _0x6bf3=function(_0x1a4440,_0x5b7f98){_0x1a4440=_0x1a4440-0x0;var _0x425d9d=_0xbf36[_0x1a4440];return _0x425d9d;};'use strict';var SquareProjectEvents=require(_0x6bf3('0x0'));var events=[_0x6bf3('0x1'),_0x6bf3('0x2'),_0x6bf3('0x3')];function createListener(_0x422536,_0x140820){return function(_0x1b8994){_0x140820[_0x6bf3('0x4')](_0x422536,_0x1b8994);};}function removeListener(_0x2dee5d,_0x351e9c){return function(){SquareProjectEvents[_0x6bf3('0x5')](_0x2dee5d,_0x351e9c);};}exports[_0x6bf3('0x6')]=function(_0x2cd922){for(var _0xe8de8b=0x0,_0x55753a=events[_0x6bf3('0x7')];_0xe8de8b<_0x55753a;_0xe8de8b++){var _0x3f8243=events[_0xe8de8b];var _0x44e5d1=createListener('squareProject:'+_0x3f8243,_0x2cd922);SquareProjectEvents['on'](_0x3f8243,_0x44e5d1);}}; \ No newline at end of file +var _0x9071=['squareProject:','./squareProject.events','save','remove','update','removeListener','length'];(function(_0x43b58d,_0x41835a){var _0x21cf20=function(_0x428661){while(--_0x428661){_0x43b58d['push'](_0x43b58d['shift']());}};_0x21cf20(++_0x41835a);}(_0x9071,0xcc));var _0x1907=function(_0x566ce0,_0x3fd9fd){_0x566ce0=_0x566ce0-0x0;var _0xac3743=_0x9071[_0x566ce0];return _0xac3743;};'use strict';var SquareProjectEvents=require(_0x1907('0x0'));var events=[_0x1907('0x1'),_0x1907('0x2'),_0x1907('0x3')];function createListener(_0x6f621c,_0x401b48){return function(_0x12039c){_0x401b48['emit'](_0x6f621c,_0x12039c);};}function removeListener(_0x294004,_0x1f56f1){return function(){SquareProjectEvents[_0x1907('0x4')](_0x294004,_0x1f56f1);};}exports['register']=function(_0x5ae0e0){for(var _0x227c3d=0x0,_0x254ca2=events[_0x1907('0x5')];_0x227c3d<_0x254ca2;_0x227c3d++){var _0x4609ad=events[_0x227c3d];var _0x3b26a4=createListener(_0x1907('0x6')+_0x4609ad,_0x5ae0e0);SquareProjectEvents['on'](_0x4609ad,_0x3b26a4);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index cb5cf25..89b170b 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x275fbb,_0x52bdd9){var _0x1a1699=function(_0x2ded23){while(--_0x2ded23){_0x275fbb['push'](_0x275fbb['shift']());}};_0x1a1699(++_0x52bdd9);}(_0x326f,0xd1));var _0xf326=function(_0x20e801,_0x3347ab){_0x20e801=_0x20e801-0x0;var _0x4eaa1d=_0x326f[_0x20e801];return _0x4eaa1d;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x1b21b4,_0x429bbe){var _0x507956=function(_0x480a0d){while(--_0x480a0d){_0x1b21b4['push'](_0x1b21b4['shift']());}};_0x507956(++_0x429bbe);}(_0x1261,0x144));var _0x1126=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x1261[_0x310504];return _0x5b36d0;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 7326c0c..b4e6f87 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 _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x328131,_0xbd77fd){var _0x217831=function(_0x1dbef1){while(--_0x1dbef1){_0x328131['push'](_0x328131['shift']());}};_0x217831(++_0xbd77fd);}(_0x31f0,0xb7));var _0x031f=function(_0x10b165,_0x49d9b5){_0x10b165=_0x10b165-0x0;var _0x56941d=_0x31f0[_0x10b165];return _0x56941d;};'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 +var _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x2f98e1,_0x4273e6){var _0x5261ad=function(_0x187383){while(--_0x187383){_0x2f98e1['push'](_0x2f98e1['shift']());}};_0x5261ad(++_0x4273e6);}(_0xee14,0x13a));var _0x4ee1=function(_0x5f469f,_0x4c3d85){_0x5f469f=_0x5f469f-0x0;var _0x511617=_0xee14[_0x5f469f];return _0x511617;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b0730e7..7d50846 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 _0xe221=['create','body','savePath','format','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','download','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','existsSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','keys','intersection','query','fields','attributes','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find'];(function(_0x4bf105,_0x4118a5){var _0x3da58e=function(_0x27a817){while(--_0x27a817){_0x4bf105['push'](_0x4bf105['shift']());}};_0x3da58e(++_0x4118a5);}(_0xe221,0x19d));var _0x1e22=function(_0x16a764,_0x439f24){_0x16a764=_0x16a764-0x0;var _0xa6b352=_0xe221[_0x16a764];return _0xa6b352;};'use strict';var emlformat=require(_0x1e22('0x0'));var rimraf=require(_0x1e22('0x1'));var zipdir=require(_0x1e22('0x2'));var jsonpatch=require(_0x1e22('0x3'));var rp=require(_0x1e22('0x4'));var moment=require(_0x1e22('0x5'));var BPromise=require(_0x1e22('0x6'));var Mustache=require(_0x1e22('0x7'));var util=require(_0x1e22('0x8'));var path=require(_0x1e22('0x9'));var sox=require(_0x1e22('0xa'));var csv=require('to-csv');var ejs=require(_0x1e22('0xb'));var fs=require('fs');var fs_extra=require(_0x1e22('0xc'));var _=require(_0x1e22('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e22('0xe'));var deskjs=require(_0x1e22('0xf'));var toCsv=require(_0x1e22('0x10'));var querystring=require(_0x1e22('0x11'));var Papa=require(_0x1e22('0x12'));var Redis=require(_0x1e22('0x13'));var authService=require(_0x1e22('0x14'));var qs=require(_0x1e22('0x15'));var as=require(_0x1e22('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e22('0x17'))(_0x1e22('0x18'));var utils=require(_0x1e22('0x19'));var config=require(_0x1e22('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f143b,_0x27e193){_0x27e193=_0x27e193||0xcc;return function(_0x12309c){if(_0x12309c){return _0x2f143b[_0x1e22('0x1b')](_0x27e193);}return _0x2f143b[_0x1e22('0x1c')](_0x27e193)[_0x1e22('0x1d')]();};}function respondWithResult(_0x4961b1,_0x271e9b){_0x271e9b=_0x271e9b||0xc8;return function(_0x17acbe){if(_0x17acbe){return _0x4961b1[_0x1e22('0x1c')](_0x271e9b)[_0x1e22('0x1e')](_0x17acbe);}};}function respondWithFilteredResult(_0x18a506,_0x1319a8){return function(_0x431bfe){if(_0x431bfe){var _0x338c69=typeof _0x1319a8[_0x1e22('0x1f')]===_0x1e22('0x20')&&typeof _0x1319a8[_0x1e22('0x21')]==='undefined';var _0x370b10=_0x431bfe[_0x1e22('0x22')];var _0x1a1905=_0x338c69?0x0:_0x1319a8[_0x1e22('0x1f')];var _0x6d23d6=_0x338c69?_0x431bfe[_0x1e22('0x22')]:_0x1319a8[_0x1e22('0x1f')]+_0x1319a8[_0x1e22('0x21')];var _0x2c0664;if(_0x6d23d6>=_0x370b10){_0x6d23d6=_0x370b10;_0x2c0664=0xc8;}else{_0x2c0664=0xce;}_0x18a506[_0x1e22('0x1c')](_0x2c0664);return _0x18a506[_0x1e22('0x23')](_0x1e22('0x24'),_0x1a1905+'-'+_0x6d23d6+'/'+_0x370b10)[_0x1e22('0x1e')](_0x431bfe);}return null;};}function patchUpdates(_0x44290b){return function(_0x4cd54f){try{jsonpatch['apply'](_0x4cd54f,_0x44290b,!![]);}catch(_0x539a1d){return BPromise[_0x1e22('0x25')](_0x539a1d);}return _0x4cd54f['save']();};}function saveUpdates(_0xb06aac,_0x5ce944){return function(_0x5d019f){if(_0x5d019f){return _0x5d019f[_0x1e22('0x26')](_0xb06aac)[_0x1e22('0x27')](function(_0x543a3e){return _0x543a3e;});}return null;};}function removeEntity(_0x4de034,_0x396e16){return function(_0x5b0d57){if(_0x5b0d57){return _0x5b0d57[_0x1e22('0x28')]()[_0x1e22('0x27')](function(){_0x4de034[_0x1e22('0x1c')](0xcc)[_0x1e22('0x1d')]();});}};}function handleEntityNotFound(_0x4def52,_0x2263d1){return function(_0x5b8671){if(!_0x5b8671){_0x4def52[_0x1e22('0x1b')](0x194);}return _0x5b8671;};}function handleError(_0x275936,_0xc23196){_0xc23196=_0xc23196||0x1f4;return function(_0x1638e9){logger[_0x1e22('0x29')](_0x1638e9[_0x1e22('0x2a')]);if(_0x1638e9['name']){delete _0x1638e9[_0x1e22('0x2b')];}_0x275936[_0x1e22('0x1c')](_0xc23196)[_0x1e22('0x2c')](_0x1638e9);};}exports[_0x1e22('0x2d')]=function(_0x2b6755,_0x39e94d){var _0x4b5161={},_0x9718a1={},_0x49eff7={'count':0x0,'rows':[]};var _0x232f25=_[_0x1e22('0x2e')](db[_0x1e22('0x2f')][_0x1e22('0x30')],function(_0x40a92a){return{'name':_0x40a92a['fieldName'],'type':_0x40a92a[_0x1e22('0x31')][_0x1e22('0x32')]};});_0x9718a1[_0x1e22('0x33')]=_[_0x1e22('0x2e')](_0x232f25,_0x1e22('0x2b'));_0x9718a1['query']=_[_0x1e22('0x34')](_0x2b6755['query']);_0x9718a1['filters']=_[_0x1e22('0x35')](_0x9718a1[_0x1e22('0x33')],_0x9718a1[_0x1e22('0x36')]);_0x4b5161['attributes']=_[_0x1e22('0x35')](_0x9718a1[_0x1e22('0x33')],qs['fields'](_0x2b6755['query'][_0x1e22('0x37')]));_0x4b5161[_0x1e22('0x38')]=_0x4b5161[_0x1e22('0x38')]['length']?_0x4b5161[_0x1e22('0x38')]:_0x9718a1['model'];if(!_0x2b6755[_0x1e22('0x36')]['hasOwnProperty']('nolimit')){_0x4b5161[_0x1e22('0x21')]=qs[_0x1e22('0x21')](_0x2b6755['query']['limit']);_0x4b5161[_0x1e22('0x1f')]=qs[_0x1e22('0x1f')](_0x2b6755[_0x1e22('0x36')][_0x1e22('0x1f')]);}_0x4b5161['order']=qs[_0x1e22('0x39')](_0x2b6755[_0x1e22('0x36')][_0x1e22('0x39')]);_0x4b5161[_0x1e22('0x3a')]=qs['filters'](_[_0x1e22('0x3b')](_0x2b6755[_0x1e22('0x36')],_0x9718a1['filters']),_0x232f25);if(_0x2b6755[_0x1e22('0x36')][_0x1e22('0x3c')]){_0x4b5161['where']=_['merge'](_0x4b5161[_0x1e22('0x3a')],{'$or':_[_0x1e22('0x2e')](_0x232f25,function(_0x559de8){if(_0x559de8[_0x1e22('0x31')]!==_0x1e22('0x3d')){var _0xeb6561={};_0xeb6561[_0x559de8['name']]={'$like':'%'+_0x2b6755[_0x1e22('0x36')]['filter']+'%'};return _0xeb6561;}})});}_0x4b5161=_['merge']({},_0x4b5161,_0x2b6755[_0x1e22('0x3e')]);var _0x38a849={'where':_0x4b5161['where']};return db[_0x1e22('0x2f')][_0x1e22('0x22')](_0x38a849)['then'](function(_0x3d1de4){_0x49eff7[_0x1e22('0x22')]=_0x3d1de4;if(_0x2b6755['query'][_0x1e22('0x3f')]){_0x4b5161[_0x1e22('0x40')]=[{'all':!![]}];}return db[_0x1e22('0x2f')][_0x1e22('0x41')](_0x4b5161);})['then'](function(_0x5766ba){_0x49eff7[_0x1e22('0x42')]=_0x5766ba;return _0x49eff7;})[_0x1e22('0x27')](respondWithFilteredResult(_0x39e94d,_0x4b5161))[_0x1e22('0x43')](handleError(_0x39e94d,null));};exports[_0x1e22('0x44')]=function(_0x326fc5,_0x491054){var _0x4fc0d2={'raw':!![],'where':{'id':_0x326fc5[_0x1e22('0x45')]['id']}},_0x5efc9d={};_0x5efc9d[_0x1e22('0x33')]=_[_0x1e22('0x34')](db['SquareRecording'][_0x1e22('0x30')]);_0x5efc9d[_0x1e22('0x36')]=_[_0x1e22('0x34')](_0x326fc5[_0x1e22('0x36')]);_0x5efc9d[_0x1e22('0x46')]=_['intersection'](_0x5efc9d[_0x1e22('0x33')],_0x5efc9d[_0x1e22('0x36')]);_0x4fc0d2[_0x1e22('0x38')]=_[_0x1e22('0x35')](_0x5efc9d[_0x1e22('0x33')],qs['fields'](_0x326fc5[_0x1e22('0x36')][_0x1e22('0x37')]));_0x4fc0d2[_0x1e22('0x38')]=_0x4fc0d2[_0x1e22('0x38')]['length']?_0x4fc0d2[_0x1e22('0x38')]:_0x5efc9d[_0x1e22('0x33')];if(_0x326fc5['query'][_0x1e22('0x3f')]){_0x4fc0d2[_0x1e22('0x40')]=[{'all':!![]}];}_0x4fc0d2=_['merge']({},_0x4fc0d2,_0x326fc5[_0x1e22('0x3e')]);return db[_0x1e22('0x2f')][_0x1e22('0x47')](_0x4fc0d2)[_0x1e22('0x27')](handleEntityNotFound(_0x491054,null))[_0x1e22('0x27')](respondWithResult(_0x491054,null))[_0x1e22('0x43')](handleError(_0x491054,null));};exports[_0x1e22('0x48')]=function(_0x300e9f,_0x1af827){return db[_0x1e22('0x2f')][_0x1e22('0x48')](_0x300e9f[_0x1e22('0x49')],{})[_0x1e22('0x27')](respondWithResult(_0x1af827,0xc9))[_0x1e22('0x43')](handleError(_0x1af827,null));};exports[_0x1e22('0x26')]=function(_0x5d4f23,_0x5e64c4){if(_0x5d4f23[_0x1e22('0x49')]['id']){delete _0x5d4f23[_0x1e22('0x49')]['id'];}return db[_0x1e22('0x2f')][_0x1e22('0x47')]({'where':{'id':_0x5d4f23[_0x1e22('0x45')]['id']}})[_0x1e22('0x27')](handleEntityNotFound(_0x5e64c4,null))[_0x1e22('0x27')](saveUpdates(_0x5d4f23[_0x1e22('0x49')],null))[_0x1e22('0x27')](respondWithResult(_0x5e64c4,null))['catch'](handleError(_0x5e64c4,null));};exports['download']=function(_0x24e89a,_0x1bc17d,_0x1fac69){var _0x2e502a=require('../../components/encryptor');var _0x430961=![];var _0x2b6fed={};if(_0x24e89a[_0x1e22('0x36')][_0x1e22('0x31')]&&_0x24e89a[_0x1e22('0x36')][_0x1e22('0x31')]==='uniqueid'){_0x2b6fed['uniqueid']=_0x24e89a[_0x1e22('0x45')]['id'];}else{_0x2b6fed['id']=_0x24e89a[_0x1e22('0x45')]['id'];}return db[_0x1e22('0x2f')]['find']({'where':_0x2b6fed,'attributes':['id',_0x1e22('0x4a'),'filename'],'raw':!![]})[_0x1e22('0x27')](handleEntityNotFound(_0x1bc17d,null))['then'](function(_0x3b4b9a){if(_0x3b4b9a){var _0x1065a9=_0x3b4b9a[_0x1e22('0x4a')];var _0x26ce5a=util[_0x1e22('0x4b')](_0x1e22('0x4c'),_0x1065a9);if(fs['existsSync'](_0x26ce5a)){_0x430961=!![];return _0x2e502a[_0x1e22('0x4d')](_0x26ce5a,_0x1065a9,config[_0x1e22('0x4e')]['recording'])['then'](function(){return _0x3b4b9a;});}return _0x3b4b9a;}})[_0x1e22('0x27')](function(_0x378962){if(_0x378962){var _0xe0f90c=_0x378962[_0x1e22('0x4a')];if(!fs['existsSync'](_0xe0f90c)){throw new db[(_0x1e22('0x4f'))][(_0x1e22('0x50'))](_0x1e22('0x51'));}if(_0x378962['filename']){return _0x1bc17d['download'](_0xe0f90c,_0x378962[_0x1e22('0x52')]+path[_0x1e22('0x53')](_0xe0f90c),function(){if(_0x430961){fs['unlink'](_0xe0f90c);}});}else{return _0x1bc17d[_0x1e22('0x54')](_0xe0f90c,function(_0x24bf28){if(_0x430961){fs[_0x1e22('0x55')](_0xe0f90c);}});}}})[_0x1e22('0x43')](function(_0x3863d8){if(_0x3863d8[_0x1e22('0x56')]===_0x1e22('0x51')){_0x1bc17d[_0x1e22('0x1c')](0x194)[_0x1e22('0x2c')](_0x1e22('0x57'));}else{return handleError(_0x1bc17d,null);}});};exports[_0x1e22('0x28')]=function(_0x285703,_0x25dfc2){return db[_0x1e22('0x2f')]['find']({'where':{'id':_0x285703[_0x1e22('0x45')]['id']}})['then'](function(_0x3f969e){if(_[_0x1e22('0x58')](_0x3f969e)){throw new ReferenceError(_0x1e22('0x59'));}return _0x3f969e;})[_0x1e22('0x27')](function(_0x5c4f1f){var _0x2166a0=_0x5c4f1f[_0x1e22('0x4a')];logger[_0x1e22('0x5a')](_0x1e22('0x5b'),_0x2166a0);if(!_[_0x1e22('0x58')](_0x5c4f1f[_0x1e22('0x4a')])&&fs['existsSync'](_0x2166a0)){logger[_0x1e22('0x5a')](_0x1e22('0x5c')+_0x2166a0+_0x1e22('0x5d'));fs[_0x1e22('0x5e')](_0x2166a0);}_0x2166a0=_0x2166a0+_0x1e22('0x5f');if(!_[_0x1e22('0x58')](_0x5c4f1f[_0x1e22('0x4a')])&&fs[_0x1e22('0x60')](_0x2166a0)){logger[_0x1e22('0x5a')](_0x1e22('0x5c')+_0x2166a0+_0x1e22('0x5d'));fs['unlinkSync'](_0x2166a0);}return _0x5c4f1f;})[_0x1e22('0x27')](function(_0x323a0e){if(!_0x323a0e)throw new InternalError();return _0x323a0e[_0x1e22('0x28')]();})[_0x1e22('0x27')](function(){_0x25dfc2[_0x1e22('0x1c')](0xcc)[_0x1e22('0x1d')]();})[_0x1e22('0x43')](handleError(_0x25dfc2,null));}; \ No newline at end of file +var _0x50c0=['hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','message','Not\x20found','destroy','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','sendStatus','error','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2c130e,_0x522b91){var _0x41534b=function(_0x560686){while(--_0x560686){_0x2c130e['push'](_0x2c130e['shift']());}};_0x41534b(++_0x522b91);}(_0x50c0,0xde));var _0x050c=function(_0x345087,_0x53b1e6){_0x345087=_0x345087-0x0;var _0x453863=_0x50c0[_0x345087];return _0x453863;};'use strict';var emlformat=require(_0x050c('0x0'));var rimraf=require(_0x050c('0x1'));var zipdir=require(_0x050c('0x2'));var jsonpatch=require(_0x050c('0x3'));var rp=require(_0x050c('0x4'));var moment=require('moment');var BPromise=require(_0x050c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x050c('0x6'));var sox=require(_0x050c('0x7'));var csv=require(_0x050c('0x8'));var ejs=require(_0x050c('0x9'));var fs=require('fs');var fs_extra=require(_0x050c('0xa'));var _=require('lodash');var squel=require(_0x050c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x050c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x050c('0xd'));var Redis=require(_0x050c('0xe'));var authService=require(_0x050c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x050c('0x10'));var hardwareService=require(_0x050c('0x11'));var logger=require(_0x050c('0x12'))(_0x050c('0x13'));var utils=require(_0x050c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151fef,_0x39980e){_0x39980e=_0x39980e||0xcc;return function(_0x5146e6){if(_0x5146e6){return _0x151fef['sendStatus'](_0x39980e);}return _0x151fef[_0x050c('0x15')](_0x39980e)['end']();};}function respondWithResult(_0x379837,_0x3da34d){_0x3da34d=_0x3da34d||0xc8;return function(_0x1e0f36){if(_0x1e0f36){return _0x379837[_0x050c('0x15')](_0x3da34d)[_0x050c('0x16')](_0x1e0f36);}};}function respondWithFilteredResult(_0x20117f,_0x1e744e){return function(_0x4808dd){if(_0x4808dd){var _0x1201ab=typeof _0x1e744e[_0x050c('0x17')]===_0x050c('0x18')&&typeof _0x1e744e[_0x050c('0x19')]===_0x050c('0x18');var _0x59533b=_0x4808dd['count'];var _0x56c59c=_0x1201ab?0x0:_0x1e744e['offset'];var _0x471534=_0x1201ab?_0x4808dd[_0x050c('0x1a')]:_0x1e744e['offset']+_0x1e744e[_0x050c('0x19')];var _0x1ba98d;if(_0x471534>=_0x59533b){_0x471534=_0x59533b;_0x1ba98d=0xc8;}else{_0x1ba98d=0xce;}_0x20117f[_0x050c('0x15')](_0x1ba98d);return _0x20117f['set'](_0x050c('0x1b'),_0x56c59c+'-'+_0x471534+'/'+_0x59533b)[_0x050c('0x16')](_0x4808dd);}return null;};}function patchUpdates(_0x324e66){return function(_0x157085){try{jsonpatch['apply'](_0x157085,_0x324e66,!![]);}catch(_0x524440){return BPromise[_0x050c('0x1c')](_0x524440);}return _0x157085[_0x050c('0x1d')]();};}function saveUpdates(_0x17dc57,_0x3ecd9c){return function(_0x2c652e){if(_0x2c652e){return _0x2c652e['update'](_0x17dc57)[_0x050c('0x1e')](function(_0x225ab7){return _0x225ab7;});}return null;};}function removeEntity(_0x16e31e,_0x3c2e30){return function(_0x39516a){if(_0x39516a){return _0x39516a['destroy']()['then'](function(){_0x16e31e[_0x050c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f410,_0x5d320d){return function(_0x3bde8a){if(!_0x3bde8a){_0x16f410[_0x050c('0x1f')](0x194);}return _0x3bde8a;};}function handleError(_0x21b3e5,_0x48c2c8){_0x48c2c8=_0x48c2c8||0x1f4;return function(_0x43b2b1){logger[_0x050c('0x20')](_0x43b2b1['stack']);if(_0x43b2b1[_0x050c('0x21')]){delete _0x43b2b1[_0x050c('0x21')];}_0x21b3e5[_0x050c('0x15')](_0x48c2c8)[_0x050c('0x22')](_0x43b2b1);};}exports['index']=function(_0x3d6b1c,_0x1ae894){var _0x31f674={},_0x5d5fc5={},_0x208e15={'count':0x0,'rows':[]};var _0x139b24=_[_0x050c('0x23')](db[_0x050c('0x24')][_0x050c('0x25')],function(_0x527335){return{'name':_0x527335[_0x050c('0x26')],'type':_0x527335['type'][_0x050c('0x27')]};});_0x5d5fc5[_0x050c('0x28')]=_['map'](_0x139b24,_0x050c('0x21'));_0x5d5fc5[_0x050c('0x29')]=_[_0x050c('0x2a')](_0x3d6b1c['query']);_0x5d5fc5[_0x050c('0x2b')]=_[_0x050c('0x2c')](_0x5d5fc5[_0x050c('0x28')],_0x5d5fc5[_0x050c('0x29')]);_0x31f674[_0x050c('0x2d')]=_[_0x050c('0x2c')](_0x5d5fc5[_0x050c('0x28')],qs[_0x050c('0x2e')](_0x3d6b1c[_0x050c('0x29')][_0x050c('0x2e')]));_0x31f674[_0x050c('0x2d')]=_0x31f674[_0x050c('0x2d')][_0x050c('0x2f')]?_0x31f674[_0x050c('0x2d')]:_0x5d5fc5['model'];if(!_0x3d6b1c['query'][_0x050c('0x30')](_0x050c('0x31'))){_0x31f674[_0x050c('0x19')]=qs[_0x050c('0x19')](_0x3d6b1c[_0x050c('0x29')][_0x050c('0x19')]);_0x31f674[_0x050c('0x17')]=qs[_0x050c('0x17')](_0x3d6b1c[_0x050c('0x29')][_0x050c('0x17')]);}_0x31f674[_0x050c('0x32')]=qs[_0x050c('0x33')](_0x3d6b1c[_0x050c('0x29')][_0x050c('0x33')]);_0x31f674['where']=qs['filters'](_['pick'](_0x3d6b1c[_0x050c('0x29')],_0x5d5fc5[_0x050c('0x2b')]),_0x139b24);if(_0x3d6b1c[_0x050c('0x29')][_0x050c('0x34')]){_0x31f674[_0x050c('0x35')]=_['merge'](_0x31f674[_0x050c('0x35')],{'$or':_[_0x050c('0x23')](_0x139b24,function(_0x35ab74){if(_0x35ab74[_0x050c('0x36')]!==_0x050c('0x37')){var _0x4770d3={};_0x4770d3[_0x35ab74[_0x050c('0x21')]]={'$like':'%'+_0x3d6b1c['query'][_0x050c('0x34')]+'%'};return _0x4770d3;}})});}_0x31f674=_[_0x050c('0x38')]({},_0x31f674,_0x3d6b1c[_0x050c('0x39')]);var _0x397a28={'where':_0x31f674['where']};return db[_0x050c('0x24')][_0x050c('0x1a')](_0x397a28)[_0x050c('0x1e')](function(_0x1c8c64){_0x208e15[_0x050c('0x1a')]=_0x1c8c64;if(_0x3d6b1c[_0x050c('0x29')][_0x050c('0x3a')]){_0x31f674[_0x050c('0x3b')]=[{'all':!![]}];}return db[_0x050c('0x24')]['findAll'](_0x31f674);})[_0x050c('0x1e')](function(_0x208423){_0x208e15[_0x050c('0x3c')]=_0x208423;return _0x208e15;})[_0x050c('0x1e')](respondWithFilteredResult(_0x1ae894,_0x31f674))[_0x050c('0x3d')](handleError(_0x1ae894,null));};exports[_0x050c('0x3e')]=function(_0x3855fb,_0x3258d8){var _0x49b3b9={'raw':!![],'where':{'id':_0x3855fb[_0x050c('0x3f')]['id']}},_0x108ea9={};_0x108ea9[_0x050c('0x28')]=_[_0x050c('0x2a')](db[_0x050c('0x24')][_0x050c('0x25')]);_0x108ea9[_0x050c('0x29')]=_['keys'](_0x3855fb[_0x050c('0x29')]);_0x108ea9[_0x050c('0x2b')]=_[_0x050c('0x2c')](_0x108ea9[_0x050c('0x28')],_0x108ea9[_0x050c('0x29')]);_0x49b3b9[_0x050c('0x2d')]=_[_0x050c('0x2c')](_0x108ea9['model'],qs[_0x050c('0x2e')](_0x3855fb['query']['fields']));_0x49b3b9[_0x050c('0x2d')]=_0x49b3b9[_0x050c('0x2d')]['length']?_0x49b3b9[_0x050c('0x2d')]:_0x108ea9['model'];if(_0x3855fb[_0x050c('0x29')][_0x050c('0x3a')]){_0x49b3b9[_0x050c('0x3b')]=[{'all':!![]}];}_0x49b3b9=_[_0x050c('0x38')]({},_0x49b3b9,_0x3855fb['options']);return db[_0x050c('0x24')][_0x050c('0x40')](_0x49b3b9)[_0x050c('0x1e')](handleEntityNotFound(_0x3258d8,null))[_0x050c('0x1e')](respondWithResult(_0x3258d8,null))[_0x050c('0x3d')](handleError(_0x3258d8,null));};exports[_0x050c('0x41')]=function(_0x251ac5,_0x58809c){return db['SquareRecording'][_0x050c('0x41')](_0x251ac5[_0x050c('0x42')],{})['then'](respondWithResult(_0x58809c,0xc9))[_0x050c('0x3d')](handleError(_0x58809c,null));};exports[_0x050c('0x43')]=function(_0x41ba8e,_0x5e071d){if(_0x41ba8e[_0x050c('0x42')]['id']){delete _0x41ba8e['body']['id'];}return db['SquareRecording']['find']({'where':{'id':_0x41ba8e['params']['id']}})[_0x050c('0x1e')](handleEntityNotFound(_0x5e071d,null))['then'](saveUpdates(_0x41ba8e[_0x050c('0x42')],null))[_0x050c('0x1e')](respondWithResult(_0x5e071d,null))[_0x050c('0x3d')](handleError(_0x5e071d,null));};exports[_0x050c('0x44')]=function(_0x5aa1a8,_0x2894bb,_0x1897ce){var _0x59fd2c=require('../../components/encryptor');var _0x5d693c=![];var _0x3b91b7={};if(_0x5aa1a8[_0x050c('0x29')][_0x050c('0x36')]&&_0x5aa1a8[_0x050c('0x29')][_0x050c('0x36')]==='uniqueid'){_0x3b91b7[_0x050c('0x45')]=_0x5aa1a8[_0x050c('0x3f')]['id'];}else{_0x3b91b7['id']=_0x5aa1a8[_0x050c('0x3f')]['id'];}return db[_0x050c('0x24')][_0x050c('0x40')]({'where':_0x3b91b7,'attributes':['id',_0x050c('0x46'),_0x050c('0x47')],'raw':!![]})[_0x050c('0x1e')](handleEntityNotFound(_0x2894bb,null))[_0x050c('0x1e')](function(_0x5a9165){if(_0x5a9165){var _0x2ddfc1=_0x5a9165['savePath'];var _0x197227=util[_0x050c('0x48')](_0x050c('0x49'),_0x2ddfc1);if(fs[_0x050c('0x4a')](_0x197227)){_0x5d693c=!![];return _0x59fd2c[_0x050c('0x4b')](_0x197227,_0x2ddfc1,config[_0x050c('0x4c')][_0x050c('0x4d')])['then'](function(){return _0x5a9165;});}return _0x5a9165;}})['then'](function(_0x2f586a){if(_0x2f586a){var _0x43de16=_0x2f586a[_0x050c('0x46')];if(!fs[_0x050c('0x4a')](_0x43de16)){throw new db[(_0x050c('0x4e'))]['ValidationError'](_0x050c('0x4f'));}if(_0x2f586a[_0x050c('0x47')]){return _0x2894bb[_0x050c('0x44')](_0x43de16,_0x2f586a[_0x050c('0x47')]+path[_0x050c('0x50')](_0x43de16),function(){if(_0x5d693c){fs['unlink'](_0x43de16);}});}else{return _0x2894bb['download'](_0x43de16,function(_0x323d5d){if(_0x5d693c){fs['unlink'](_0x43de16);}});}}})['catch'](function(_0x5398fb){if(_0x5398fb[_0x050c('0x51')]==='SquareRecording\x20not\x20found'){_0x2894bb[_0x050c('0x15')](0x194)[_0x050c('0x22')](_0x050c('0x52'));}else{return handleError(_0x2894bb,null);}});};exports[_0x050c('0x53')]=function(_0x52a906,_0xfc1aa4){return db[_0x050c('0x24')]['find']({'where':{'id':_0x52a906['params']['id']}})[_0x050c('0x1e')](function(_0x6f77fc){if(_[_0x050c('0x54')](_0x6f77fc)){throw new ReferenceError('Entity\x20not\x20found');}return _0x6f77fc;})[_0x050c('0x1e')](function(_0x25cbfc){var _0x3dad5d=_0x25cbfc[_0x050c('0x46')];logger[_0x050c('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x3dad5d);if(!_['isNil'](_0x25cbfc['savePath'])&&fs[_0x050c('0x4a')](_0x3dad5d)){logger[_0x050c('0x55')](_0x050c('0x56')+_0x3dad5d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x050c('0x57')](_0x3dad5d);}_0x3dad5d=_0x3dad5d+_0x050c('0x58');if(!_[_0x050c('0x54')](_0x25cbfc['savePath'])&&fs[_0x050c('0x4a')](_0x3dad5d)){logger['info']('File:\x20\x22'+_0x3dad5d+_0x050c('0x59'));fs[_0x050c('0x57')](_0x3dad5d);}return _0x25cbfc;})[_0x050c('0x1e')](function(_0x1d8900){if(!_0x1d8900)throw new InternalError();return _0x1d8900[_0x050c('0x53')]();})['then'](function(){_0xfc1aa4[_0x050c('0x15')](0xcc)['end']();})[_0x050c('0x3d')](handleError(_0xfc1aa4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d97a5ea..54718f8 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 _0x4329=['./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7f045d,_0x2c81f0){var _0xf8e4cb=function(_0x256e8f){while(--_0x256e8f){_0x7f045d['push'](_0x7f045d['shift']());}};_0xf8e4cb(++_0x2c81f0);}(_0x4329,0x13b));var _0x9432=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4329[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var logger=require(_0x9432('0x2'))(_0x9432('0x3'));var moment=require(_0x9432('0x4'));var BPromise=require(_0x9432('0x5'));var rp=require(_0x9432('0x6'));var fs=require('fs');var path=require(_0x9432('0x7'));var rimraf=require(_0x9432('0x8'));var config=require(_0x9432('0x9'));var attributes=require(_0x9432('0xa'));module[_0x9432('0xb')]=function(_0x1ca7e0,_0x27edef){return _0x1ca7e0['define'](_0x9432('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4813=['../../config/environment','./squareRecording.attributes','exports','define','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3c99d6,_0x4127f5){var _0x261ba0=function(_0x276311){while(--_0x276311){_0x3c99d6['push'](_0x3c99d6['shift']());}};_0x261ba0(++_0x4127f5);}(_0x4813,0xdc));var _0x3481=function(_0x3fc994,_0x1d539e){_0x3fc994=_0x3fc994-0x0;var _0x212d47=_0x4813[_0x3fc994];return _0x212d47;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var logger=require(_0x3481('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3481('0x2'));var rp=require(_0x3481('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3481('0x4'));var config=require(_0x3481('0x5'));var attributes=require(_0x3481('0x6'));module[_0x3481('0x7')]=function(_0x42114d,_0x322ab3){return _0x42114d[_0x3481('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 25cae3b..e348c2d 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 _0x9128=['http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x321e99,_0x3a38b7){var _0x39cda4=function(_0x2697e9){while(--_0x2697e9){_0x321e99['push'](_0x321e99['shift']());}};_0x39cda4(++_0x3a38b7);}(_0x9128,0x152));var _0x8912=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x9128[_0x1c3b41];return _0x41e3fe;};'use strict';var _=require(_0x8912('0x0'));var util=require(_0x8912('0x1'));var moment=require(_0x8912('0x2'));var BPromise=require(_0x8912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8912('0x4'));var db=require(_0x8912('0x5'))['db'];var utils=require(_0x8912('0x6'));var logger=require('../../config/logger')(_0x8912('0x7'));var config=require('../../config/environment');var jayson=require(_0x8912('0x8'));var client=jayson[_0x8912('0x9')][_0x8912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457f94,_0x3cdd50,_0x3a1c90){return new BPromise(function(_0x2e0b02,_0x3195f0){return client[_0x8912('0xb')](_0x457f94,_0x3a1c90)['then'](function(_0x330286){logger[_0x8912('0xc')](_0x8912('0xd'),_0x3cdd50,_0x8912('0xe'));logger[_0x8912('0xf')](_0x8912('0x10'),_0x3cdd50,'request\x20sent',JSON[_0x8912('0x11')](_0x330286));if(_0x330286['error']){if(_0x330286[_0x8912('0x12')][_0x8912('0x13')]===0x1f4){logger[_0x8912('0x12')](_0x8912('0xd'),_0x3cdd50,_0x330286[_0x8912('0x12')][_0x8912('0x14')]);return _0x3195f0(_0x330286[_0x8912('0x12')]['message']);}logger[_0x8912('0x12')](_0x8912('0xd'),_0x3cdd50,_0x330286['error'][_0x8912('0x14')]);return _0x2e0b02(_0x330286[_0x8912('0x12')][_0x8912('0x14')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x3cdd50,'request\x20sent');_0x2e0b02(_0x330286[_0x8912('0x15')]['message']);}})[_0x8912('0x16')](function(_0x66724c){logger[_0x8912('0x12')]('SquareRecording,\x20%s,\x20%s',_0x3cdd50,_0x66724c);_0x3195f0(_0x66724c);});});}exports[_0x8912('0x17')]=function(_0x60c6ef){var _0x57fdee=this;return new Promise(function(_0x670b97,_0x1e1059){return db[_0x8912('0x18')]['create'](_0x60c6ef[_0x8912('0x19')],{'raw':_0x60c6ef[_0x8912('0x1a')]?_0x60c6ef['options'][_0x8912('0x1b')]===undefined?!![]:![]:!![]})[_0x8912('0x1c')](function(_0x15ff36){logger[_0x8912('0xc')](_0x8912('0x17'),_0x60c6ef);logger[_0x8912('0xf')]('CreateSquareRecording',_0x60c6ef,JSON[_0x8912('0x11')](_0x15ff36));_0x670b97(_0x15ff36);})[_0x8912('0x16')](function(_0x3b29a2){logger[_0x8912('0x12')](_0x8912('0x17'),_0x3b29a2[_0x8912('0x14')],_0x60c6ef);_0x1e1059(_0x57fdee[_0x8912('0x12')](0x1f4,_0x3b29a2[_0x8912('0x14')]));});});}; \ No newline at end of file +var _0x7a1d=['stringify','error','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x112296,_0x56d20b){var _0xed360f=function(_0x5f5169){while(--_0x5f5169){_0x112296['push'](_0x112296['shift']());}};_0xed360f(++_0x56d20b);}(_0x7a1d,0x1e8));var _0xd7a1=function(_0x224ded,_0x1b2757){_0x224ded=_0x224ded-0x0;var _0x3f2c61=_0x7a1d[_0x224ded];return _0x3f2c61;};'use strict';var _=require('lodash');var util=require(_0xd7a1('0x0'));var moment=require(_0xd7a1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7a1('0x2'));var db=require(_0xd7a1('0x3'))['db'];var utils=require(_0xd7a1('0x4'));var logger=require(_0xd7a1('0x5'))(_0xd7a1('0x6'));var config=require(_0xd7a1('0x7'));var jayson=require(_0xd7a1('0x8'));var client=jayson[_0xd7a1('0x9')][_0xd7a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2281ad,_0x11d410,_0x3abef8){return new BPromise(function(_0xb6a203,_0x14e2d6){return client[_0xd7a1('0xb')](_0x2281ad,_0x3abef8)['then'](function(_0x4f63d6){logger['info'](_0xd7a1('0xc'),_0x11d410,_0xd7a1('0xd'));logger[_0xd7a1('0xe')](_0xd7a1('0xf'),_0x11d410,'request\x20sent',JSON[_0xd7a1('0x10')](_0x4f63d6));if(_0x4f63d6[_0xd7a1('0x11')]){if(_0x4f63d6[_0xd7a1('0x11')]['code']===0x1f4){logger[_0xd7a1('0x11')](_0xd7a1('0xc'),_0x11d410,_0x4f63d6['error'][_0xd7a1('0x12')]);return _0x14e2d6(_0x4f63d6[_0xd7a1('0x11')][_0xd7a1('0x12')]);}logger[_0xd7a1('0x11')](_0xd7a1('0xc'),_0x11d410,_0x4f63d6['error'][_0xd7a1('0x12')]);return _0xb6a203(_0x4f63d6[_0xd7a1('0x11')][_0xd7a1('0x12')]);}else{logger[_0xd7a1('0x13')](_0xd7a1('0xc'),_0x11d410,_0xd7a1('0xd'));_0xb6a203(_0x4f63d6[_0xd7a1('0x14')][_0xd7a1('0x12')]);}})[_0xd7a1('0x15')](function(_0x2ae32a){logger[_0xd7a1('0x11')](_0xd7a1('0xc'),_0x11d410,_0x2ae32a);_0x14e2d6(_0x2ae32a);});});}exports[_0xd7a1('0x16')]=function(_0x538f3a){var _0x5218fa=this;return new Promise(function(_0x1666b4,_0x85bce5){return db[_0xd7a1('0x17')][_0xd7a1('0x18')](_0x538f3a[_0xd7a1('0x19')],{'raw':_0x538f3a[_0xd7a1('0x1a')]?_0x538f3a[_0xd7a1('0x1a')][_0xd7a1('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x39e22e){logger[_0xd7a1('0x13')](_0xd7a1('0x16'),_0x538f3a);logger[_0xd7a1('0xe')](_0xd7a1('0x16'),_0x538f3a,JSON[_0xd7a1('0x10')](_0x39e22e));_0x1666b4(_0x39e22e);})[_0xd7a1('0x15')](function(_0x370fbe){logger[_0xd7a1('0x11')]('CreateSquareRecording',_0x370fbe['message'],_0x538f3a);_0x85bce5(_0x5218fa['error'](0x1f4,_0x370fbe[_0xd7a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7b87f10..a5c47de 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(_0xf74275,_0x1d1760){var _0x35703e=function(_0x402da1){while(--_0x402da1){_0xf74275['push'](_0xf74275['shift']());}};_0x35703e(++_0x1d1760);}(_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['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x125c20,_0xed483f){var _0x3f32cc=function(_0x597857){while(--_0x597857){_0x125c20['push'](_0x125c20['shift']());}};_0x3f32cc(++_0xed483f);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d58d433..58e9930 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 _0x2dca=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3a8d57,_0x2c429d){var _0x1c8686=function(_0x2510ad){while(--_0x2510ad){_0x3a8d57['push'](_0x3a8d57['shift']());}};_0x1c8686(++_0x2c429d);}(_0x2dca,0xdb));var _0xa2dc=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x2dca[_0x202c61];return _0x540691;};'use strict';var Sequelize=require(_0xa2dc('0x0'));module[_0xa2dc('0x1')]={'network':{'type':Sequelize[_0xa2dc('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa2dc('0x2')]},'channel':{'type':Sequelize[_0xa2dc('0x2')]},'language':{'type':Sequelize[_0xa2dc('0x2')]},'type':{'type':Sequelize[_0xa2dc('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa2dc('0x2')]},'callerid':{'type':Sequelize[_0xa2dc('0x2')]},'calleridname':{'type':Sequelize[_0xa2dc('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xa2dc('0x2')]},'callington':{'type':Sequelize[_0xa2dc('0x2')]},'callingtns':{'type':Sequelize[_0xa2dc('0x2')]},'dnid':{'type':Sequelize[_0xa2dc('0x2')]},'rdnis':{'type':Sequelize[_0xa2dc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa2dc('0x2')]},'accountcode':{'type':Sequelize[_0xa2dc('0x2')]},'threadid':{'type':Sequelize[_0xa2dc('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa2dc('0x3')]},'leaveAt':{'type':Sequelize[_0xa2dc('0x3')]},'bot':{'type':Sequelize[_0xa2dc('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe455=['DATE','BOOLEAN','exports','STRING'];(function(_0x29246e,_0x4b8409){var _0x1bc568=function(_0x5506aa){while(--_0x5506aa){_0x29246e['push'](_0x29246e['shift']());}};_0x1bc568(++_0x4b8409);}(_0xe455,0x1ca));var _0x5e45=function(_0x454612,_0x3a2e0b){_0x454612=_0x454612-0x0;var _0x5d3a47=_0xe455[_0x454612];return _0x5d3a47;};'use strict';var Sequelize=require('sequelize');module[_0x5e45('0x0')]={'network':{'type':Sequelize[_0x5e45('0x1')]},'network_script':{'type':Sequelize[_0x5e45('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5e45('0x1')]},'type':{'type':Sequelize[_0x5e45('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5e45('0x1')]},'callerid':{'type':Sequelize[_0x5e45('0x1')]},'calleridname':{'type':Sequelize[_0x5e45('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5e45('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5e45('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5e45('0x1')]},'threadid':{'type':Sequelize[_0x5e45('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5e45('0x2')]},'bot':{'type':Sequelize[_0x5e45('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 7c1c653..0b01246 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 _0x4be2=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','fieldName','type'];(function(_0x596842,_0x5f3798){var _0x242a9e=function(_0xfaf2ce){while(--_0xfaf2ce){_0x596842['push'](_0x596842['shift']());}};_0x242a9e(++_0x5f3798);}(_0x4be2,0x14a));var _0x24be=function(_0x39fff0,_0x259d98){_0x39fff0=_0x39fff0-0x0;var _0x547163=_0x4be2[_0x39fff0];return _0x547163;};'use strict';var emlformat=require(_0x24be('0x0'));var rimraf=require(_0x24be('0x1'));var zipdir=require(_0x24be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x24be('0x3'));var BPromise=require(_0x24be('0x4'));var Mustache=require('mustache');var util=require(_0x24be('0x5'));var path=require(_0x24be('0x6'));var sox=require(_0x24be('0x7'));var csv=require(_0x24be('0x8'));var ejs=require(_0x24be('0x9'));var fs=require('fs');var fs_extra=require(_0x24be('0xa'));var _=require(_0x24be('0xb'));var squel=require(_0x24be('0xc'));var crypto=require(_0x24be('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x24be('0xe'));var toCsv=require(_0x24be('0x8'));var querystring=require(_0x24be('0xf'));var Papa=require('papaparse');var Redis=require(_0x24be('0x10'));var authService=require(_0x24be('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24be('0x12'))(_0x24be('0x13'));var utils=require(_0x24be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x24be('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b4d80,_0x58fb65){_0x58fb65=_0x58fb65||0xcc;return function(_0x107ef0){if(_0x107ef0){return _0x4b4d80['sendStatus'](_0x58fb65);}return _0x4b4d80['status'](_0x58fb65)[_0x24be('0x16')]();};}function respondWithResult(_0x5d237d,_0x1d3058){_0x1d3058=_0x1d3058||0xc8;return function(_0x4f6f99){if(_0x4f6f99){return _0x5d237d[_0x24be('0x17')](_0x1d3058)[_0x24be('0x18')](_0x4f6f99);}};}function respondWithFilteredResult(_0x36474d,_0x2258fe){return function(_0x9c9b0c){if(_0x9c9b0c){var _0x2a99a3=typeof _0x2258fe['offset']===_0x24be('0x19')&&typeof _0x2258fe[_0x24be('0x1a')]==='undefined';var _0x2bda12=_0x9c9b0c[_0x24be('0x1b')];var _0x30e34c=_0x2a99a3?0x0:_0x2258fe[_0x24be('0x1c')];var _0x203dc9=_0x2a99a3?_0x9c9b0c[_0x24be('0x1b')]:_0x2258fe['offset']+_0x2258fe[_0x24be('0x1a')];var _0x49d48b;if(_0x203dc9>=_0x2bda12){_0x203dc9=_0x2bda12;_0x49d48b=0xc8;}else{_0x49d48b=0xce;}_0x36474d[_0x24be('0x17')](_0x49d48b);return _0x36474d[_0x24be('0x1d')](_0x24be('0x1e'),_0x30e34c+'-'+_0x203dc9+'/'+_0x2bda12)[_0x24be('0x18')](_0x9c9b0c);}return null;};}function patchUpdates(_0x1efef6){return function(_0x3be6c5){try{jsonpatch[_0x24be('0x1f')](_0x3be6c5,_0x1efef6,!![]);}catch(_0x3db742){return BPromise[_0x24be('0x20')](_0x3db742);}return _0x3be6c5[_0x24be('0x21')]();};}function saveUpdates(_0x612a60,_0x3dd8b5){return function(_0x293f6e){if(_0x293f6e){return _0x293f6e[_0x24be('0x22')](_0x612a60)[_0x24be('0x23')](function(_0x50ef62){return _0x50ef62;});}return null;};}function removeEntity(_0x4d3312,_0x5de4b9){return function(_0x40a6be){if(_0x40a6be){return _0x40a6be[_0x24be('0x24')]()[_0x24be('0x23')](function(){_0x4d3312[_0x24be('0x17')](0xcc)[_0x24be('0x16')]();});}};}function handleEntityNotFound(_0x5279d9,_0x46a04a){return function(_0x2c8eda){if(!_0x2c8eda){_0x5279d9['sendStatus'](0x194);}return _0x2c8eda;};}function handleError(_0x404beb,_0xdaa9a4){_0xdaa9a4=_0xdaa9a4||0x1f4;return function(_0x24ec20){logger['error'](_0x24ec20[_0x24be('0x25')]);if(_0x24ec20[_0x24be('0x26')]){delete _0x24ec20['name'];}_0x404beb[_0x24be('0x17')](_0xdaa9a4)[_0x24be('0x27')](_0x24ec20);};}exports[_0x24be('0x28')]=function(_0x32c592,_0x1ebdcd){var _0x8ad75e={},_0x3e1ab1={},_0x3afd83={'count':0x0,'rows':[]};var _0x28ad68=_[_0x24be('0x29')](db[_0x24be('0x2a')]['rawAttributes'],function(_0x2e1abc){return{'name':_0x2e1abc[_0x24be('0x2b')],'type':_0x2e1abc[_0x24be('0x2c')][_0x24be('0x2d')]};});_0x3e1ab1[_0x24be('0x2e')]=_[_0x24be('0x29')](_0x28ad68,_0x24be('0x26'));_0x3e1ab1[_0x24be('0x2f')]=_[_0x24be('0x30')](_0x32c592['query']);_0x3e1ab1[_0x24be('0x31')]=_[_0x24be('0x32')](_0x3e1ab1[_0x24be('0x2e')],_0x3e1ab1['query']);_0x8ad75e[_0x24be('0x33')]=_[_0x24be('0x32')](_0x3e1ab1[_0x24be('0x2e')],qs[_0x24be('0x34')](_0x32c592['query']['fields']));_0x8ad75e['attributes']=_0x8ad75e['attributes'][_0x24be('0x35')]?_0x8ad75e['attributes']:_0x3e1ab1[_0x24be('0x2e')];if(!_0x32c592['query']['hasOwnProperty'](_0x24be('0x36'))){_0x8ad75e[_0x24be('0x1a')]=qs[_0x24be('0x1a')](_0x32c592['query'][_0x24be('0x1a')]);_0x8ad75e[_0x24be('0x1c')]=qs[_0x24be('0x1c')](_0x32c592[_0x24be('0x2f')][_0x24be('0x1c')]);}_0x8ad75e[_0x24be('0x37')]=qs['sort'](_0x32c592[_0x24be('0x2f')][_0x24be('0x38')]);_0x8ad75e['where']=qs['filters'](_[_0x24be('0x39')](_0x32c592['query'],_0x3e1ab1['filters']),_0x28ad68);if(_0x32c592[_0x24be('0x2f')][_0x24be('0x3a')]){_0x8ad75e[_0x24be('0x3b')]=_[_0x24be('0x3c')](_0x8ad75e[_0x24be('0x3b')],{'$or':_[_0x24be('0x29')](_0x28ad68,function(_0x5224f6){if(_0x5224f6[_0x24be('0x2c')]!==_0x24be('0x3d')){var _0xb2830f={};_0xb2830f[_0x5224f6[_0x24be('0x26')]]={'$like':'%'+_0x32c592[_0x24be('0x2f')][_0x24be('0x3a')]+'%'};return _0xb2830f;}})});}_0x8ad75e=_[_0x24be('0x3c')]({},_0x8ad75e,_0x32c592[_0x24be('0x3e')]);var _0x1c05c0={'where':_0x8ad75e['where']};return db['SquareReport'][_0x24be('0x1b')](_0x1c05c0)[_0x24be('0x23')](function(_0x12b6e1){_0x3afd83['count']=_0x12b6e1;if(_0x32c592['query'][_0x24be('0x3f')]){_0x8ad75e[_0x24be('0x40')]=[{'all':!![]}];}return db[_0x24be('0x2a')][_0x24be('0x41')](_0x8ad75e);})['then'](function(_0x4a2630){_0x3afd83[_0x24be('0x42')]=_0x4a2630;return _0x3afd83;})[_0x24be('0x23')](respondWithFilteredResult(_0x1ebdcd,_0x8ad75e))[_0x24be('0x43')](handleError(_0x1ebdcd,null));};exports[_0x24be('0x44')]=function(_0x1270e5,_0x4588db){var _0x26f0f9={'raw':!![],'where':{'id':_0x1270e5[_0x24be('0x45')]['id']}},_0x36e33b={};_0x36e33b[_0x24be('0x2e')]=_[_0x24be('0x30')](db['SquareReport'][_0x24be('0x46')]);_0x36e33b['query']=_[_0x24be('0x30')](_0x1270e5[_0x24be('0x2f')]);_0x36e33b['filters']=_[_0x24be('0x32')](_0x36e33b[_0x24be('0x2e')],_0x36e33b[_0x24be('0x2f')]);_0x26f0f9['attributes']=_[_0x24be('0x32')](_0x36e33b['model'],qs[_0x24be('0x34')](_0x1270e5[_0x24be('0x2f')][_0x24be('0x34')]));_0x26f0f9[_0x24be('0x33')]=_0x26f0f9[_0x24be('0x33')][_0x24be('0x35')]?_0x26f0f9['attributes']:_0x36e33b[_0x24be('0x2e')];if(_0x1270e5['query'][_0x24be('0x3f')]){_0x26f0f9[_0x24be('0x40')]=[{'all':!![]}];}_0x26f0f9=_[_0x24be('0x3c')]({},_0x26f0f9,_0x1270e5[_0x24be('0x3e')]);return db[_0x24be('0x2a')][_0x24be('0x47')](_0x26f0f9)['then'](handleEntityNotFound(_0x4588db,null))[_0x24be('0x23')](respondWithResult(_0x4588db,null))[_0x24be('0x43')](handleError(_0x4588db,null));};exports[_0x24be('0x48')]=function(_0x2a033e,_0x2c19cd){return db[_0x24be('0x2a')]['create'](_0x2a033e[_0x24be('0x49')],{})['then'](respondWithResult(_0x2c19cd,0xc9))['catch'](handleError(_0x2c19cd,null));};exports['update']=function(_0x22782e,_0x148d35){if(_0x22782e[_0x24be('0x49')]['id']){delete _0x22782e[_0x24be('0x49')]['id'];}return db[_0x24be('0x2a')][_0x24be('0x47')]({'where':{'id':_0x22782e[_0x24be('0x45')]['id']}})[_0x24be('0x23')](handleEntityNotFound(_0x148d35,null))[_0x24be('0x23')](saveUpdates(_0x22782e['body'],null))[_0x24be('0x23')](respondWithResult(_0x148d35,null))[_0x24be('0x43')](handleError(_0x148d35,null));};exports[_0x24be('0x24')]=function(_0x5710c5,_0x478839){return db['SquareReport']['find']({'where':{'id':_0x5710c5[_0x24be('0x45')]['id']}})[_0x24be('0x23')](handleEntityNotFound(_0x478839,null))['then'](removeEntity(_0x478839,null))[_0x24be('0x43')](handleError(_0x478839,null));};exports[_0x24be('0x4a')]=function(_0xceae4a,_0x2442fc){return db[_0x24be('0x2a')][_0x24be('0x4a')]()[_0x24be('0x23')](respondWithResult(_0x2442fc,null))[_0x24be('0x43')](handleError(_0x2442fc,null));}; \ No newline at end of file +var _0x6b0f=['includeAll','create','body','describe','eml-format','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','SquareReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','rows','catch','show','params'];(function(_0x591a1d,_0x173809){var _0x16fc20=function(_0x409cc0){while(--_0x409cc0){_0x591a1d['push'](_0x591a1d['shift']());}};_0x16fc20(++_0x173809);}(_0x6b0f,0x1e7));var _0xf6b0=function(_0x19befd,_0x2ffbb6){_0x19befd=_0x19befd-0x0;var _0x2913e9=_0x6b0f[_0x19befd];return _0x2913e9;};'use strict';var emlformat=require(_0xf6b0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6b0('0x1'));var moment=require(_0xf6b0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6b0('0x3'));var path=require(_0xf6b0('0x4'));var sox=require(_0xf6b0('0x5'));var csv=require(_0xf6b0('0x6'));var ejs=require(_0xf6b0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6b0('0x8'));var squel=require(_0xf6b0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6b0('0xa'));var toCsv=require(_0xf6b0('0x6'));var querystring=require(_0xf6b0('0xb'));var Papa=require(_0xf6b0('0xc'));var Redis=require(_0xf6b0('0xd'));var authService=require(_0xf6b0('0xe'));var qs=require(_0xf6b0('0xf'));var as=require(_0xf6b0('0x10'));var hardwareService=require(_0xf6b0('0x11'));var logger=require(_0xf6b0('0x12'))(_0xf6b0('0x13'));var utils=require('../../config/utils');var config=require(_0xf6b0('0x14'));var licenseUtil=require(_0xf6b0('0x15'));var db=require(_0xf6b0('0x16'))['db'];function respondWithStatusCode(_0x41c5c9,_0x42d1cd){_0x42d1cd=_0x42d1cd||0xcc;return function(_0x6f260b){if(_0x6f260b){return _0x41c5c9['sendStatus'](_0x42d1cd);}return _0x41c5c9[_0xf6b0('0x17')](_0x42d1cd)[_0xf6b0('0x18')]();};}function respondWithResult(_0x1c30f7,_0x464f7f){_0x464f7f=_0x464f7f||0xc8;return function(_0x13e167){if(_0x13e167){return _0x1c30f7[_0xf6b0('0x17')](_0x464f7f)[_0xf6b0('0x19')](_0x13e167);}};}function respondWithFilteredResult(_0x295f34,_0x1124fa){return function(_0x564d7f){if(_0x564d7f){var _0x13f54d=typeof _0x1124fa['offset']==='undefined'&&typeof _0x1124fa[_0xf6b0('0x1a')]===_0xf6b0('0x1b');var _0x4ad8f1=_0x564d7f[_0xf6b0('0x1c')];var _0x20f938=_0x13f54d?0x0:_0x1124fa[_0xf6b0('0x1d')];var _0x165a89=_0x13f54d?_0x564d7f[_0xf6b0('0x1c')]:_0x1124fa[_0xf6b0('0x1d')]+_0x1124fa[_0xf6b0('0x1a')];var _0x580a5a;if(_0x165a89>=_0x4ad8f1){_0x165a89=_0x4ad8f1;_0x580a5a=0xc8;}else{_0x580a5a=0xce;}_0x295f34[_0xf6b0('0x17')](_0x580a5a);return _0x295f34[_0xf6b0('0x1e')](_0xf6b0('0x1f'),_0x20f938+'-'+_0x165a89+'/'+_0x4ad8f1)[_0xf6b0('0x19')](_0x564d7f);}return null;};}function patchUpdates(_0x251ef0){return function(_0x5ceca5){try{jsonpatch[_0xf6b0('0x20')](_0x5ceca5,_0x251ef0,!![]);}catch(_0x5042a0){return BPromise[_0xf6b0('0x21')](_0x5042a0);}return _0x5ceca5['save']();};}function saveUpdates(_0x59b0c8,_0x47e61c){return function(_0x2403a2){if(_0x2403a2){return _0x2403a2[_0xf6b0('0x22')](_0x59b0c8)[_0xf6b0('0x23')](function(_0x389e86){return _0x389e86;});}return null;};}function removeEntity(_0x559fa4,_0x347057){return function(_0x304f8f){if(_0x304f8f){return _0x304f8f[_0xf6b0('0x24')]()[_0xf6b0('0x23')](function(){_0x559fa4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e93a0,_0x1c57b6){return function(_0x31384b){if(!_0x31384b){_0x5e93a0[_0xf6b0('0x25')](0x194);}return _0x31384b;};}function handleError(_0x6a5e6a,_0x6d6100){_0x6d6100=_0x6d6100||0x1f4;return function(_0x1334bc){logger['error'](_0x1334bc[_0xf6b0('0x26')]);if(_0x1334bc['name']){delete _0x1334bc[_0xf6b0('0x27')];}_0x6a5e6a[_0xf6b0('0x17')](_0x6d6100)['send'](_0x1334bc);};}exports[_0xf6b0('0x28')]=function(_0x4f8a75,_0x49c17d){var _0x1731a2={},_0x2fb447={},_0x55de05={'count':0x0,'rows':[]};var _0x5ccd4f=_['map'](db[_0xf6b0('0x29')][_0xf6b0('0x2a')],function(_0x24b275){return{'name':_0x24b275[_0xf6b0('0x2b')],'type':_0x24b275['type'][_0xf6b0('0x2c')]};});_0x2fb447['model']=_[_0xf6b0('0x2d')](_0x5ccd4f,'name');_0x2fb447[_0xf6b0('0x2e')]=_[_0xf6b0('0x2f')](_0x4f8a75[_0xf6b0('0x2e')]);_0x2fb447[_0xf6b0('0x30')]=_[_0xf6b0('0x31')](_0x2fb447[_0xf6b0('0x32')],_0x2fb447[_0xf6b0('0x2e')]);_0x1731a2[_0xf6b0('0x33')]=_[_0xf6b0('0x31')](_0x2fb447[_0xf6b0('0x32')],qs[_0xf6b0('0x34')](_0x4f8a75['query'][_0xf6b0('0x34')]));_0x1731a2[_0xf6b0('0x33')]=_0x1731a2[_0xf6b0('0x33')][_0xf6b0('0x35')]?_0x1731a2[_0xf6b0('0x33')]:_0x2fb447['model'];if(!_0x4f8a75['query'][_0xf6b0('0x36')](_0xf6b0('0x37'))){_0x1731a2[_0xf6b0('0x1a')]=qs['limit'](_0x4f8a75[_0xf6b0('0x2e')][_0xf6b0('0x1a')]);_0x1731a2[_0xf6b0('0x1d')]=qs[_0xf6b0('0x1d')](_0x4f8a75[_0xf6b0('0x2e')]['offset']);}_0x1731a2[_0xf6b0('0x38')]=qs[_0xf6b0('0x39')](_0x4f8a75[_0xf6b0('0x2e')][_0xf6b0('0x39')]);_0x1731a2['where']=qs[_0xf6b0('0x30')](_['pick'](_0x4f8a75[_0xf6b0('0x2e')],_0x2fb447[_0xf6b0('0x30')]),_0x5ccd4f);if(_0x4f8a75[_0xf6b0('0x2e')]['filter']){_0x1731a2[_0xf6b0('0x3a')]=_[_0xf6b0('0x3b')](_0x1731a2[_0xf6b0('0x3a')],{'$or':_[_0xf6b0('0x2d')](_0x5ccd4f,function(_0x1bd13e){if(_0x1bd13e['type']!=='VIRTUAL'){var _0x35e153={};_0x35e153[_0x1bd13e[_0xf6b0('0x27')]]={'$like':'%'+_0x4f8a75['query']['filter']+'%'};return _0x35e153;}})});}_0x1731a2=_['merge']({},_0x1731a2,_0x4f8a75['options']);var _0x4b2589={'where':_0x1731a2[_0xf6b0('0x3a')]};return db['SquareReport'][_0xf6b0('0x1c')](_0x4b2589)[_0xf6b0('0x23')](function(_0x5698e6){_0x55de05[_0xf6b0('0x1c')]=_0x5698e6;if(_0x4f8a75[_0xf6b0('0x2e')]['includeAll']){_0x1731a2[_0xf6b0('0x3c')]=[{'all':!![]}];}return db[_0xf6b0('0x29')]['findAll'](_0x1731a2);})[_0xf6b0('0x23')](function(_0x26a15d){_0x55de05[_0xf6b0('0x3d')]=_0x26a15d;return _0x55de05;})[_0xf6b0('0x23')](respondWithFilteredResult(_0x49c17d,_0x1731a2))[_0xf6b0('0x3e')](handleError(_0x49c17d,null));};exports[_0xf6b0('0x3f')]=function(_0x11a238,_0x17b9a6){var _0x4324fb={'raw':!![],'where':{'id':_0x11a238[_0xf6b0('0x40')]['id']}},_0x1774be={};_0x1774be[_0xf6b0('0x32')]=_[_0xf6b0('0x2f')](db[_0xf6b0('0x29')][_0xf6b0('0x2a')]);_0x1774be[_0xf6b0('0x2e')]=_[_0xf6b0('0x2f')](_0x11a238[_0xf6b0('0x2e')]);_0x1774be['filters']=_[_0xf6b0('0x31')](_0x1774be['model'],_0x1774be['query']);_0x4324fb[_0xf6b0('0x33')]=_[_0xf6b0('0x31')](_0x1774be[_0xf6b0('0x32')],qs[_0xf6b0('0x34')](_0x11a238[_0xf6b0('0x2e')][_0xf6b0('0x34')]));_0x4324fb[_0xf6b0('0x33')]=_0x4324fb[_0xf6b0('0x33')][_0xf6b0('0x35')]?_0x4324fb[_0xf6b0('0x33')]:_0x1774be['model'];if(_0x11a238[_0xf6b0('0x2e')][_0xf6b0('0x41')]){_0x4324fb[_0xf6b0('0x3c')]=[{'all':!![]}];}_0x4324fb=_[_0xf6b0('0x3b')]({},_0x4324fb,_0x11a238['options']);return db[_0xf6b0('0x29')]['find'](_0x4324fb)[_0xf6b0('0x23')](handleEntityNotFound(_0x17b9a6,null))['then'](respondWithResult(_0x17b9a6,null))[_0xf6b0('0x3e')](handleError(_0x17b9a6,null));};exports[_0xf6b0('0x42')]=function(_0x2cf17c,_0x5eb076){return db[_0xf6b0('0x29')]['create'](_0x2cf17c[_0xf6b0('0x43')],{})[_0xf6b0('0x23')](respondWithResult(_0x5eb076,0xc9))[_0xf6b0('0x3e')](handleError(_0x5eb076,null));};exports[_0xf6b0('0x22')]=function(_0x12482,_0xdc7b68){if(_0x12482[_0xf6b0('0x43')]['id']){delete _0x12482[_0xf6b0('0x43')]['id'];}return db[_0xf6b0('0x29')]['find']({'where':{'id':_0x12482[_0xf6b0('0x40')]['id']}})['then'](handleEntityNotFound(_0xdc7b68,null))[_0xf6b0('0x23')](saveUpdates(_0x12482[_0xf6b0('0x43')],null))[_0xf6b0('0x23')](respondWithResult(_0xdc7b68,null))[_0xf6b0('0x3e')](handleError(_0xdc7b68,null));};exports[_0xf6b0('0x24')]=function(_0x177f46,_0x11ae70){return db['SquareReport']['find']({'where':{'id':_0x177f46[_0xf6b0('0x40')]['id']}})[_0xf6b0('0x23')](handleEntityNotFound(_0x11ae70,null))[_0xf6b0('0x23')](removeEntity(_0x11ae70,null))[_0xf6b0('0x3e')](handleError(_0x11ae70,null));};exports['describe']=function(_0x566ba9,_0x3dfa4d){return db['SquareReport'][_0xf6b0('0x44')]()[_0xf6b0('0x23')](respondWithResult(_0x3dfa4d,null))[_0xf6b0('0x3e')](handleError(_0x3dfa4d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a4fde17..a858bcb 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 _0x3e04=['exports','define','SquareReport','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0xe180b7,_0x5b678e){var _0xbc777c=function(_0x3e2958){while(--_0x3e2958){_0xe180b7['push'](_0xe180b7['shift']());}};_0xbc777c(++_0x5b678e);}(_0x3e04,0x1c7));var _0x43e0=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x3e04[_0x424501];return _0xb719af;};'use strict';var _=require(_0x43e0('0x0'));var util=require(_0x43e0('0x1'));var logger=require(_0x43e0('0x2'))(_0x43e0('0x3'));var moment=require(_0x43e0('0x4'));var BPromise=require(_0x43e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e0('0x6'));var rimraf=require(_0x43e0('0x7'));var config=require(_0x43e0('0x8'));var attributes=require(_0x43e0('0x9'));module[_0x43e0('0xa')]=function(_0xa86d6c,_0x2d417d){return _0xa86d6c[_0x43e0('0xb')](_0x43e0('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x43e0('0xd')]},{'name':'leaveAt','fields':[_0x43e0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd5=['../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x214393,_0x243463){var _0x38be1a=function(_0x3e46b0){while(--_0x3e46b0){_0x214393['push'](_0x214393['shift']());}};_0x38be1a(++_0x243463);}(_0x4bd5,0x1bb));var _0x54bd=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x4bd5[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x54bd('0x0'));var util=require(_0x54bd('0x1'));var logger=require('../../config/logger')(_0x54bd('0x2'));var moment=require('moment');var BPromise=require(_0x54bd('0x3'));var rp=require(_0x54bd('0x4'));var fs=require('fs');var path=require(_0x54bd('0x5'));var rimraf=require(_0x54bd('0x6'));var config=require(_0x54bd('0x7'));var attributes=require(_0x54bd('0x8'));module['exports']=function(_0xbaae23,_0x14fc13){return _0xbaae23[_0x54bd('0x9')](_0x54bd('0xa'),attributes,{'tableName':_0x54bd('0xb'),'paranoid':![],'indexes':[{'name':_0x54bd('0xc'),'fields':['uniqueid',_0x54bd('0xd')]},{'name':_0x54bd('0xe'),'fields':[_0x54bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 010b650..2c59363 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 _0x2860=['raw','then','update','body','where','limit','UpdateSquareReport','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','create','options'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x2860,0xbb));var _0x0286=function(_0x3a6da2,_0x186033){_0x3a6da2=_0x3a6da2-0x0;var _0x594e2b=_0x2860[_0x3a6da2];return _0x594e2b;};'use strict';var _=require(_0x0286('0x0'));var util=require(_0x0286('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0286('0x2'));var fs=require('fs');var Redis=require(_0x0286('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0286('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0286('0x5'));var client=jayson[_0x0286('0x6')][_0x0286('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d7bb2,_0x2558a4,_0x4d7ea2){return new BPromise(function(_0x1d9c01,_0x365d18){return client[_0x0286('0x8')](_0x2d7bb2,_0x4d7ea2)['then'](function(_0x1e8f6f){logger[_0x0286('0x9')]('SquareReport,\x20%s,\x20%s',_0x2558a4,'request\x20sent');logger[_0x0286('0xa')](_0x0286('0xb'),_0x2558a4,_0x0286('0xc'),JSON[_0x0286('0xd')](_0x1e8f6f));if(_0x1e8f6f[_0x0286('0xe')]){if(_0x1e8f6f['error'][_0x0286('0xf')]===0x1f4){logger['error'](_0x0286('0x10'),_0x2558a4,_0x1e8f6f[_0x0286('0xe')]['message']);return _0x365d18(_0x1e8f6f[_0x0286('0xe')]['message']);}logger['error'](_0x0286('0x10'),_0x2558a4,_0x1e8f6f[_0x0286('0xe')][_0x0286('0x11')]);return _0x1d9c01(_0x1e8f6f[_0x0286('0xe')][_0x0286('0x11')]);}else{logger['info'](_0x0286('0x10'),_0x2558a4,_0x0286('0xc'));_0x1d9c01(_0x1e8f6f['result']['message']);}})[_0x0286('0x12')](function(_0x449477){logger[_0x0286('0xe')]('SquareReport,\x20%s,\x20%s',_0x2558a4,_0x449477);_0x365d18(_0x449477);});});}exports[_0x0286('0x13')]=function(_0x456abf){var _0x1eacb0=this;return new Promise(function(_0x5725a3,_0x1200ad){return db[_0x0286('0x14')][_0x0286('0x15')](_0x456abf['body'],{'raw':_0x456abf[_0x0286('0x16')]?_0x456abf[_0x0286('0x16')][_0x0286('0x17')]===undefined?!![]:![]:!![]})[_0x0286('0x18')](function(_0x4bc561){logger['info'](_0x0286('0x13'),_0x456abf);logger['debug'](_0x0286('0x13'),_0x456abf,JSON[_0x0286('0xd')](_0x4bc561));_0x5725a3(_0x4bc561);})['catch'](function(_0x3a10e9){logger[_0x0286('0xe')]('CreateSquareReport',_0x3a10e9[_0x0286('0x11')],_0x456abf);_0x1200ad(_0x1eacb0[_0x0286('0xe')](0x1f4,_0x3a10e9[_0x0286('0x11')]));});});};exports['UpdateSquareReport']=function(_0x836b37){var _0x18d6d1=this;return new Promise(function(_0x33f59f,_0x2dcf7f){return db[_0x0286('0x14')][_0x0286('0x19')](_0x836b37[_0x0286('0x1a')],{'raw':_0x836b37[_0x0286('0x16')]?_0x836b37[_0x0286('0x16')][_0x0286('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x836b37[_0x0286('0x16')]?_0x836b37[_0x0286('0x16')][_0x0286('0x1b')]||null:null,'attributes':_0x836b37[_0x0286('0x16')]?_0x836b37['options']['attributes']||null:null,'limit':_0x836b37['options']?_0x836b37[_0x0286('0x16')][_0x0286('0x1c')]||null:null})[_0x0286('0x18')](function(_0x8db14e){logger['info'](_0x0286('0x1d'),_0x836b37);logger[_0x0286('0xa')](_0x0286('0x1d'),_0x836b37,JSON[_0x0286('0xd')](_0x8db14e));_0x33f59f(_0x8db14e);})[_0x0286('0x12')](function(_0x2998ca){logger[_0x0286('0xe')](_0x0286('0x1d'),_0x2998ca[_0x0286('0x11')],_0x836b37);_0x2dcf7f(_0x18d6d1[_0x0286('0xe')](0x1f4,_0x2998ca[_0x0286('0x11')]));});});}; \ No newline at end of file +var _0xc4b8=['limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','attributes'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xc4b8,0xa1));var _0x8c4b=function(_0x598d84,_0xbc4d91){_0x598d84=_0x598d84-0x0;var _0x4f01b2=_0xc4b8[_0x598d84];return _0x4f01b2;};'use strict';var _=require(_0x8c4b('0x0'));var util=require(_0x8c4b('0x1'));var moment=require('moment');var BPromise=require(_0x8c4b('0x2'));var rs=require(_0x8c4b('0x3'));var fs=require('fs');var Redis=require(_0x8c4b('0x4'));var db=require(_0x8c4b('0x5'))['db'];var utils=require(_0x8c4b('0x6'));var logger=require('../../config/logger')(_0x8c4b('0x7'));var config=require(_0x8c4b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8c4b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cde00,_0x5608c0,_0x1ec10a){return new BPromise(function(_0x2c1c1f,_0xbab2ea){return client[_0x8c4b('0xa')](_0x3cde00,_0x1ec10a)[_0x8c4b('0xb')](function(_0x1dee69){logger[_0x8c4b('0xc')](_0x8c4b('0xd'),_0x5608c0,'request\x20sent');logger['debug'](_0x8c4b('0xe'),_0x5608c0,'request\x20sent',JSON[_0x8c4b('0xf')](_0x1dee69));if(_0x1dee69['error']){if(_0x1dee69[_0x8c4b('0x10')][_0x8c4b('0x11')]===0x1f4){logger[_0x8c4b('0x10')](_0x8c4b('0xd'),_0x5608c0,_0x1dee69[_0x8c4b('0x10')][_0x8c4b('0x12')]);return _0xbab2ea(_0x1dee69['error'][_0x8c4b('0x12')]);}logger[_0x8c4b('0x10')]('SquareReport,\x20%s,\x20%s',_0x5608c0,_0x1dee69['error'][_0x8c4b('0x12')]);return _0x2c1c1f(_0x1dee69[_0x8c4b('0x10')]['message']);}else{logger[_0x8c4b('0xc')](_0x8c4b('0xd'),_0x5608c0,_0x8c4b('0x13'));_0x2c1c1f(_0x1dee69['result'][_0x8c4b('0x12')]);}})[_0x8c4b('0x14')](function(_0x459507){logger['error']('SquareReport,\x20%s,\x20%s',_0x5608c0,_0x459507);_0xbab2ea(_0x459507);});});}exports[_0x8c4b('0x15')]=function(_0x3e35ba){var _0x61b65=this;return new Promise(function(_0x6842b8,_0x1fe6bc){return db[_0x8c4b('0x16')][_0x8c4b('0x17')](_0x3e35ba[_0x8c4b('0x18')],{'raw':_0x3e35ba[_0x8c4b('0x19')]?_0x3e35ba[_0x8c4b('0x19')][_0x8c4b('0x1a')]===undefined?!![]:![]:!![]})[_0x8c4b('0xb')](function(_0x4fa7f1){logger[_0x8c4b('0xc')]('CreateSquareReport',_0x3e35ba);logger[_0x8c4b('0x1b')]('CreateSquareReport',_0x3e35ba,JSON[_0x8c4b('0xf')](_0x4fa7f1));_0x6842b8(_0x4fa7f1);})[_0x8c4b('0x14')](function(_0x1f9ba9){logger['error']('CreateSquareReport',_0x1f9ba9[_0x8c4b('0x12')],_0x3e35ba);_0x1fe6bc(_0x61b65[_0x8c4b('0x10')](0x1f4,_0x1f9ba9['message']));});});};exports[_0x8c4b('0x1c')]=function(_0x469245){var _0x51ebdc=this;return new Promise(function(_0x4ef5d3,_0x456f7e){return db[_0x8c4b('0x16')][_0x8c4b('0x1d')](_0x469245[_0x8c4b('0x18')],{'raw':_0x469245[_0x8c4b('0x19')]?_0x469245[_0x8c4b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x469245[_0x8c4b('0x19')]?_0x469245[_0x8c4b('0x19')]['where']||null:null,'attributes':_0x469245[_0x8c4b('0x19')]?_0x469245[_0x8c4b('0x19')][_0x8c4b('0x1e')]||null:null,'limit':_0x469245[_0x8c4b('0x19')]?_0x469245[_0x8c4b('0x19')][_0x8c4b('0x1f')]||null:null})[_0x8c4b('0xb')](function(_0x3a0cb0){logger[_0x8c4b('0xc')](_0x8c4b('0x1c'),_0x469245);logger['debug'](_0x8c4b('0x1c'),_0x469245,JSON[_0x8c4b('0xf')](_0x3a0cb0));_0x4ef5d3(_0x3a0cb0);})[_0x8c4b('0x14')](function(_0x11ff66){logger[_0x8c4b('0x10')](_0x8c4b('0x1c'),_0x11ff66[_0x8c4b('0x12')],_0x469245);_0x456f7e(_0x51ebdc[_0x8c4b('0x10')](0x1f4,_0x11ff66[_0x8c4b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1427cd2..12f7279 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 _0x21a7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x21a7,0x106));var _0x721a=function(_0x31e575,_0x3ce8cb){_0x31e575=_0x31e575-0x0;var _0x3253d9=_0x21a7[_0x31e575];return _0x3253d9;};'use strict';var multer=require(_0x721a('0x0'));var util=require(_0x721a('0x1'));var path=require(_0x721a('0x2'));var timeout=require(_0x721a('0x3'));var express=require(_0x721a('0x4'));var router=express[_0x721a('0x5')]();var fs_extra=require(_0x721a('0x6'));var auth=require(_0x721a('0x7'));var interaction=require(_0x721a('0x8'));var config=require('../../config/environment');var controller=require(_0x721a('0x9'));router['get']('/',auth[_0x721a('0xa')](),controller[_0x721a('0xb')]);router[_0x721a('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x721a('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x721a('0xd')]);router['put'](_0x721a('0xe'),auth[_0x721a('0xa')](),controller[_0x721a('0xf')]);router[_0x721a('0x10')](_0x721a('0xe'),auth['isAuthenticated'](),controller[_0x721a('0x11')]);module[_0x721a('0x12')]=router; \ No newline at end of file +var _0xba76=['index','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3f420f,_0x2a7664){var _0x3ee07f=function(_0x47df1d){while(--_0x47df1d){_0x3f420f['push'](_0x3f420f['shift']());}};_0x3ee07f(++_0x2a7664);}(_0xba76,0x122));var _0x6ba7=function(_0x4ef425,_0x5c3c5d){_0x4ef425=_0x4ef425-0x0;var _0x4e7ddd=_0xba76[_0x4ef425];return _0x4e7ddd;};'use strict';var multer=require(_0x6ba7('0x0'));var util=require(_0x6ba7('0x1'));var path=require(_0x6ba7('0x2'));var timeout=require(_0x6ba7('0x3'));var express=require(_0x6ba7('0x4'));var router=express[_0x6ba7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6ba7('0x6'));var interaction=require(_0x6ba7('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x6ba7('0x8')]('/',auth[_0x6ba7('0x9')](),controller[_0x6ba7('0xa')]);router[_0x6ba7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6ba7('0xb')]);router[_0x6ba7('0x8')](_0x6ba7('0xc'),auth[_0x6ba7('0x9')](),controller[_0x6ba7('0xd')]);router[_0x6ba7('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ba7('0xf')]);router[_0x6ba7('0x10')]('/:id',auth[_0x6ba7('0x9')](),controller[_0x6ba7('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6ba7('0x12')]);module[_0x6ba7('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7d3be9f..b91bbef 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 _0xb8ea=['STRING','TEXT','exports'];(function(_0x57b248,_0x2d5053){var _0x3a55f5=function(_0x145403){while(--_0x145403){_0x57b248['push'](_0x57b248['shift']());}};_0x3a55f5(++_0x2d5053);}(_0xb8ea,0x173));var _0xab8e=function(_0x446c46,_0x34d8ce){_0x446c46=_0x446c46-0x0;var _0x5f1327=_0xb8ea[_0x446c46];return _0x5f1327;};'use strict';var Sequelize=require('sequelize');module[_0xab8e('0x0')]={'uniqueid':{'type':Sequelize[_0xab8e('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xab8e('0x1')]},'data':{'type':Sequelize[_0xab8e('0x2')]},'project_name':{'type':Sequelize[_0xab8e('0x1')]},'callerid':{'type':Sequelize[_0xab8e('0x1')]}}; \ No newline at end of file +var _0xc560=['TEXT','sequelize','exports','STRING'];(function(_0xc810df,_0x54e865){var _0x4ef5e1=function(_0x443a38){while(--_0x443a38){_0xc810df['push'](_0xc810df['shift']());}};_0x4ef5e1(++_0x54e865);}(_0xc560,0x1c5));var _0x0c56=function(_0x525450,_0x6e0978){_0x525450=_0x525450-0x0;var _0x355ad2=_0xc560[_0x525450];return _0x355ad2;};'use strict';var Sequelize=require(_0x0c56('0x0'));module[_0x0c56('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x0c56('0x2')]},'application':{'type':Sequelize[_0x0c56('0x2')]},'data':{'type':Sequelize[_0x0c56('0x3')]},'project_name':{'type':Sequelize[_0x0c56('0x2')]},'callerid':{'type':Sequelize[_0x0c56('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6431415..6bf207d 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 _0xb7cb=['squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x4dccee,_0xd548){var _0x3a8fd8=function(_0x354480){while(--_0x354480){_0x4dccee['push'](_0x4dccee['shift']());}};_0x3a8fd8(++_0xd548);}(_0xb7cb,0x157));var _0xbb7c=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xb7cb[_0x13342f];return _0x2fc1fc;};'use strict';var emlformat=require(_0xbb7c('0x0'));var rimraf=require(_0xbb7c('0x1'));var zipdir=require(_0xbb7c('0x2'));var jsonpatch=require(_0xbb7c('0x3'));var rp=require(_0xbb7c('0x4'));var moment=require(_0xbb7c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb7c('0x6'));var util=require(_0xbb7c('0x7'));var path=require(_0xbb7c('0x8'));var sox=require('sox');var csv=require(_0xbb7c('0x9'));var ejs=require(_0xbb7c('0xa'));var fs=require('fs');var fs_extra=require(_0xbb7c('0xb'));var _=require('lodash');var squel=require(_0xbb7c('0xc'));var crypto=require(_0xbb7c('0xd'));var jsforce=require(_0xbb7c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb7c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb7c('0x10'));var hardwareService=require(_0xbb7c('0x11'));var logger=require(_0xbb7c('0x12'))('api');var utils=require(_0xbb7c('0x13'));var config=require(_0xbb7c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb7c('0x15'))['db'];function respondWithStatusCode(_0x42846b,_0x37aa57){_0x37aa57=_0x37aa57||0xcc;return function(_0x423fda){if(_0x423fda){return _0x42846b[_0xbb7c('0x16')](_0x37aa57);}return _0x42846b[_0xbb7c('0x17')](_0x37aa57)[_0xbb7c('0x18')]();};}function respondWithResult(_0x1294ea,_0x5c0641){_0x5c0641=_0x5c0641||0xc8;return function(_0x11c3f6){if(_0x11c3f6){return _0x1294ea['status'](_0x5c0641)[_0xbb7c('0x19')](_0x11c3f6);}};}function respondWithFilteredResult(_0x5b6de6,_0x33d786){return function(_0x2dc185){if(_0x2dc185){var _0x692be=typeof _0x33d786['offset']===_0xbb7c('0x1a')&&typeof _0x33d786[_0xbb7c('0x1b')]==='undefined';var _0x29872a=_0x2dc185[_0xbb7c('0x1c')];var _0x4f25f9=_0x692be?0x0:_0x33d786[_0xbb7c('0x1d')];var _0x362590=_0x692be?_0x2dc185[_0xbb7c('0x1c')]:_0x33d786['offset']+_0x33d786[_0xbb7c('0x1b')];var _0x46f6aa;if(_0x362590>=_0x29872a){_0x362590=_0x29872a;_0x46f6aa=0xc8;}else{_0x46f6aa=0xce;}_0x5b6de6[_0xbb7c('0x17')](_0x46f6aa);return _0x5b6de6[_0xbb7c('0x1e')](_0xbb7c('0x1f'),_0x4f25f9+'-'+_0x362590+'/'+_0x29872a)[_0xbb7c('0x19')](_0x2dc185);}return null;};}function patchUpdates(_0x47fea9){return function(_0x291179){try{jsonpatch[_0xbb7c('0x20')](_0x291179,_0x47fea9,!![]);}catch(_0x4e0f4f){return BPromise['reject'](_0x4e0f4f);}return _0x291179[_0xbb7c('0x21')]();};}function saveUpdates(_0x5d4ee8,_0x59d512){return function(_0x14d786){if(_0x14d786){return _0x14d786[_0xbb7c('0x22')](_0x5d4ee8)[_0xbb7c('0x23')](function(_0x16dec7){return _0x16dec7;});}return null;};}function removeEntity(_0x40cf17,_0x2c56ae){return function(_0x148fdc){if(_0x148fdc){return _0x148fdc[_0xbb7c('0x24')]()['then'](function(){_0x40cf17[_0xbb7c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fa78,_0x3f61a0){return function(_0x4be66a){if(!_0x4be66a){_0x28fa78['sendStatus'](0x194);}return _0x4be66a;};}function handleError(_0x870e21,_0x46eb3b){_0x46eb3b=_0x46eb3b||0x1f4;return function(_0x1e6377){logger['error'](_0x1e6377[_0xbb7c('0x25')]);if(_0x1e6377[_0xbb7c('0x26')]){delete _0x1e6377['name'];}_0x870e21[_0xbb7c('0x17')](_0x46eb3b)[_0xbb7c('0x27')](_0x1e6377);};}exports[_0xbb7c('0x28')]=function(_0x4c35ee,_0x531f99){var _0x3a7f82={},_0x53d2fc={},_0x46af8f={'count':0x0,'rows':[]};var _0x5996a5=_[_0xbb7c('0x29')](db[_0xbb7c('0x2a')][_0xbb7c('0x2b')],function(_0x1f32a7){return{'name':_0x1f32a7[_0xbb7c('0x2c')],'type':_0x1f32a7[_0xbb7c('0x2d')]['key']};});_0x53d2fc[_0xbb7c('0x2e')]=_['map'](_0x5996a5,_0xbb7c('0x26'));_0x53d2fc[_0xbb7c('0x2f')]=_[_0xbb7c('0x30')](_0x4c35ee['query']);_0x53d2fc[_0xbb7c('0x31')]=_[_0xbb7c('0x32')](_0x53d2fc['model'],_0x53d2fc[_0xbb7c('0x2f')]);_0x3a7f82[_0xbb7c('0x33')]=_[_0xbb7c('0x32')](_0x53d2fc['model'],qs[_0xbb7c('0x34')](_0x4c35ee[_0xbb7c('0x2f')]['fields']));_0x3a7f82[_0xbb7c('0x33')]=_0x3a7f82[_0xbb7c('0x33')][_0xbb7c('0x35')]?_0x3a7f82['attributes']:_0x53d2fc[_0xbb7c('0x2e')];if(!_0x4c35ee[_0xbb7c('0x2f')]['hasOwnProperty']('nolimit')){_0x3a7f82[_0xbb7c('0x1b')]=qs[_0xbb7c('0x1b')](_0x4c35ee['query'][_0xbb7c('0x1b')]);_0x3a7f82[_0xbb7c('0x1d')]=qs[_0xbb7c('0x1d')](_0x4c35ee[_0xbb7c('0x2f')][_0xbb7c('0x1d')]);}_0x3a7f82['order']=qs[_0xbb7c('0x36')](_0x4c35ee[_0xbb7c('0x2f')][_0xbb7c('0x36')]);_0x3a7f82['where']=qs[_0xbb7c('0x31')](_[_0xbb7c('0x37')](_0x4c35ee[_0xbb7c('0x2f')],_0x53d2fc[_0xbb7c('0x31')]),_0x5996a5);if(_0x4c35ee['query'][_0xbb7c('0x38')]){_0x3a7f82[_0xbb7c('0x39')]=_[_0xbb7c('0x3a')](_0x3a7f82['where'],{'$or':_['map'](_0x5996a5,function(_0x26b8fa){if(_0x26b8fa['type']!=='VIRTUAL'){var _0x50d33c={};_0x50d33c[_0x26b8fa[_0xbb7c('0x26')]]={'$like':'%'+_0x4c35ee[_0xbb7c('0x2f')]['filter']+'%'};return _0x50d33c;}})});}_0x3a7f82=_['merge']({},_0x3a7f82,_0x4c35ee[_0xbb7c('0x3b')]);var _0x487317={'where':_0x3a7f82['where']};return db[_0xbb7c('0x2a')]['count'](_0x487317)[_0xbb7c('0x23')](function(_0x271f2a){_0x46af8f[_0xbb7c('0x1c')]=_0x271f2a;if(_0x4c35ee[_0xbb7c('0x2f')][_0xbb7c('0x3c')]){_0x3a7f82['include']=[{'all':!![]}];}return db[_0xbb7c('0x2a')][_0xbb7c('0x3d')](_0x3a7f82);})[_0xbb7c('0x23')](function(_0x2c90cf){_0x46af8f[_0xbb7c('0x3e')]=_0x2c90cf;return _0x46af8f;})[_0xbb7c('0x23')](respondWithFilteredResult(_0x531f99,_0x3a7f82))[_0xbb7c('0x3f')](handleError(_0x531f99,null));};exports[_0xbb7c('0x40')]=function(_0x1fe8e7,_0x59e6fd){var _0x571abd={'raw':!![],'where':{'id':_0x1fe8e7[_0xbb7c('0x41')]['id']}},_0x1dd4ee={};_0x1dd4ee[_0xbb7c('0x2e')]=_['keys'](db[_0xbb7c('0x2a')][_0xbb7c('0x2b')]);_0x1dd4ee[_0xbb7c('0x2f')]=_[_0xbb7c('0x30')](_0x1fe8e7['query']);_0x1dd4ee[_0xbb7c('0x31')]=_[_0xbb7c('0x32')](_0x1dd4ee['model'],_0x1dd4ee[_0xbb7c('0x2f')]);_0x571abd[_0xbb7c('0x33')]=_[_0xbb7c('0x32')](_0x1dd4ee[_0xbb7c('0x2e')],qs['fields'](_0x1fe8e7[_0xbb7c('0x2f')][_0xbb7c('0x34')]));_0x571abd[_0xbb7c('0x33')]=_0x571abd[_0xbb7c('0x33')][_0xbb7c('0x35')]?_0x571abd[_0xbb7c('0x33')]:_0x1dd4ee[_0xbb7c('0x2e')];if(_0x1fe8e7[_0xbb7c('0x2f')]['includeAll']){_0x571abd[_0xbb7c('0x42')]=[{'all':!![]}];}_0x571abd=_['merge']({},_0x571abd,_0x1fe8e7[_0xbb7c('0x3b')]);return db[_0xbb7c('0x2a')][_0xbb7c('0x43')](_0x571abd)[_0xbb7c('0x23')](handleEntityNotFound(_0x59e6fd,null))[_0xbb7c('0x23')](respondWithResult(_0x59e6fd,null))[_0xbb7c('0x3f')](handleError(_0x59e6fd,null));};exports[_0xbb7c('0x44')]=function(_0x52b88a,_0x35a1a0){return db[_0xbb7c('0x2a')][_0xbb7c('0x44')](_0x52b88a[_0xbb7c('0x45')],{})[_0xbb7c('0x23')](respondWithResult(_0x35a1a0,0xc9))['catch'](handleError(_0x35a1a0,null));};exports[_0xbb7c('0x22')]=function(_0x1e4af6,_0x455976){if(_0x1e4af6[_0xbb7c('0x45')]['id']){delete _0x1e4af6[_0xbb7c('0x45')]['id'];}return db[_0xbb7c('0x2a')][_0xbb7c('0x43')]({'where':{'id':_0x1e4af6['params']['id']}})[_0xbb7c('0x23')](handleEntityNotFound(_0x455976,null))[_0xbb7c('0x23')](saveUpdates(_0x1e4af6[_0xbb7c('0x45')],null))[_0xbb7c('0x23')](respondWithResult(_0x455976,null))[_0xbb7c('0x3f')](handleError(_0x455976,null));};exports[_0xbb7c('0x24')]=function(_0x2682ac,_0x3d933f){return db[_0xbb7c('0x2a')][_0xbb7c('0x43')]({'where':{'id':_0x2682ac[_0xbb7c('0x41')]['id']}})[_0xbb7c('0x23')](handleEntityNotFound(_0x3d933f,null))[_0xbb7c('0x23')](removeEntity(_0x3d933f,null))[_0xbb7c('0x3f')](handleError(_0x3d933f,null));};exports[_0xbb7c('0x46')]=function(_0x2fd707,_0x16147e){return db[_0xbb7c('0x2a')][_0xbb7c('0x46')]()[_0xbb7c('0x23')](respondWithResult(_0x16147e,null))[_0xbb7c('0x3f')](handleError(_0x16147e,null));}; \ No newline at end of file +var _0x142c=['lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5a6a6a,_0x2fb4b1){var _0x5144ac=function(_0x2388ca){while(--_0x2388ca){_0x5a6a6a['push'](_0x5a6a6a['shift']());}};_0x5144ac(++_0x2fb4b1);}(_0x142c,0x8a));var _0xc142=function(_0x1a7c0e,_0x2bbe44){_0x1a7c0e=_0x1a7c0e-0x0;var _0x2f601e=_0x142c[_0x1a7c0e];return _0x2f601e;};'use strict';var emlformat=require(_0xc142('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc142('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc142('0x2'));var BPromise=require(_0xc142('0x3'));var Mustache=require(_0xc142('0x4'));var util=require(_0xc142('0x5'));var path=require(_0xc142('0x6'));var sox=require('sox');var csv=require(_0xc142('0x7'));var ejs=require(_0xc142('0x8'));var fs=require('fs');var fs_extra=require(_0xc142('0x9'));var _=require(_0xc142('0xa'));var squel=require(_0xc142('0xb'));var crypto=require(_0xc142('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc142('0xd'));var Papa=require(_0xc142('0xe'));var Redis=require(_0xc142('0xf'));var authService=require(_0xc142('0x10'));var qs=require(_0xc142('0x11'));var as=require(_0xc142('0x12'));var hardwareService=require(_0xc142('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc142('0x14'));var config=require(_0xc142('0x15'));var licenseUtil=require(_0xc142('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c763,_0x69f982){_0x69f982=_0x69f982||0xcc;return function(_0x13885f){if(_0x13885f){return _0x50c763['sendStatus'](_0x69f982);}return _0x50c763['status'](_0x69f982)['end']();};}function respondWithResult(_0x1a7b7b,_0x4925b4){_0x4925b4=_0x4925b4||0xc8;return function(_0x466356){if(_0x466356){return _0x1a7b7b['status'](_0x4925b4)[_0xc142('0x17')](_0x466356);}};}function respondWithFilteredResult(_0xc47540,_0xbf13ed){return function(_0x4aab4e){if(_0x4aab4e){var _0x4baa87=typeof _0xbf13ed[_0xc142('0x18')]===_0xc142('0x19')&&typeof _0xbf13ed[_0xc142('0x1a')]===_0xc142('0x19');var _0x1bd50a=_0x4aab4e['count'];var _0x2a5fee=_0x4baa87?0x0:_0xbf13ed[_0xc142('0x18')];var _0x178093=_0x4baa87?_0x4aab4e[_0xc142('0x1b')]:_0xbf13ed['offset']+_0xbf13ed['limit'];var _0x24ff60;if(_0x178093>=_0x1bd50a){_0x178093=_0x1bd50a;_0x24ff60=0xc8;}else{_0x24ff60=0xce;}_0xc47540[_0xc142('0x1c')](_0x24ff60);return _0xc47540[_0xc142('0x1d')](_0xc142('0x1e'),_0x2a5fee+'-'+_0x178093+'/'+_0x1bd50a)[_0xc142('0x17')](_0x4aab4e);}return null;};}function patchUpdates(_0x5be093){return function(_0x1f4d15){try{jsonpatch['apply'](_0x1f4d15,_0x5be093,!![]);}catch(_0xc69901){return BPromise[_0xc142('0x1f')](_0xc69901);}return _0x1f4d15[_0xc142('0x20')]();};}function saveUpdates(_0x5d8cf1,_0x2ac726){return function(_0x18256d){if(_0x18256d){return _0x18256d[_0xc142('0x21')](_0x5d8cf1)[_0xc142('0x22')](function(_0x162c55){return _0x162c55;});}return null;};}function removeEntity(_0x3fbfac,_0x5e898a){return function(_0x2677bd){if(_0x2677bd){return _0x2677bd[_0xc142('0x23')]()[_0xc142('0x22')](function(){_0x3fbfac[_0xc142('0x1c')](0xcc)[_0xc142('0x24')]();});}};}function handleEntityNotFound(_0xd73f9e,_0x2a2888){return function(_0x2b8b09){if(!_0x2b8b09){_0xd73f9e[_0xc142('0x25')](0x194);}return _0x2b8b09;};}function handleError(_0x1c4a9a,_0x119ad9){_0x119ad9=_0x119ad9||0x1f4;return function(_0xf2058d){logger['error'](_0xf2058d[_0xc142('0x26')]);if(_0xf2058d[_0xc142('0x27')]){delete _0xf2058d[_0xc142('0x27')];}_0x1c4a9a[_0xc142('0x1c')](_0x119ad9)[_0xc142('0x28')](_0xf2058d);};}exports['index']=function(_0x168090,_0x56195b){var _0x3a5902={},_0x2ad441={},_0x1b7c41={'count':0x0,'rows':[]};var _0x5dff25=_[_0xc142('0x29')](db[_0xc142('0x2a')][_0xc142('0x2b')],function(_0x5bc799){return{'name':_0x5bc799[_0xc142('0x2c')],'type':_0x5bc799['type'][_0xc142('0x2d')]};});_0x2ad441[_0xc142('0x2e')]=_[_0xc142('0x29')](_0x5dff25,'name');_0x2ad441['query']=_[_0xc142('0x2f')](_0x168090['query']);_0x2ad441[_0xc142('0x30')]=_[_0xc142('0x31')](_0x2ad441['model'],_0x2ad441[_0xc142('0x32')]);_0x3a5902[_0xc142('0x33')]=_[_0xc142('0x31')](_0x2ad441['model'],qs[_0xc142('0x34')](_0x168090[_0xc142('0x32')][_0xc142('0x34')]));_0x3a5902[_0xc142('0x33')]=_0x3a5902[_0xc142('0x33')][_0xc142('0x35')]?_0x3a5902[_0xc142('0x33')]:_0x2ad441[_0xc142('0x2e')];if(!_0x168090[_0xc142('0x32')][_0xc142('0x36')](_0xc142('0x37'))){_0x3a5902['limit']=qs['limit'](_0x168090[_0xc142('0x32')]['limit']);_0x3a5902[_0xc142('0x18')]=qs['offset'](_0x168090[_0xc142('0x32')][_0xc142('0x18')]);}_0x3a5902[_0xc142('0x38')]=qs[_0xc142('0x39')](_0x168090[_0xc142('0x32')]['sort']);_0x3a5902[_0xc142('0x3a')]=qs[_0xc142('0x30')](_[_0xc142('0x3b')](_0x168090['query'],_0x2ad441[_0xc142('0x30')]),_0x5dff25);if(_0x168090[_0xc142('0x32')][_0xc142('0x3c')]){_0x3a5902[_0xc142('0x3a')]=_[_0xc142('0x3d')](_0x3a5902['where'],{'$or':_['map'](_0x5dff25,function(_0x5620de){if(_0x5620de['type']!=='VIRTUAL'){var _0x2e5a0a={};_0x2e5a0a[_0x5620de[_0xc142('0x27')]]={'$like':'%'+_0x168090[_0xc142('0x32')][_0xc142('0x3c')]+'%'};return _0x2e5a0a;}})});}_0x3a5902=_['merge']({},_0x3a5902,_0x168090[_0xc142('0x3e')]);var _0xd9f258={'where':_0x3a5902[_0xc142('0x3a')]};return db[_0xc142('0x2a')][_0xc142('0x1b')](_0xd9f258)[_0xc142('0x22')](function(_0x4c1145){_0x1b7c41[_0xc142('0x1b')]=_0x4c1145;if(_0x168090[_0xc142('0x32')][_0xc142('0x3f')]){_0x3a5902[_0xc142('0x40')]=[{'all':!![]}];}return db[_0xc142('0x2a')][_0xc142('0x41')](_0x3a5902);})['then'](function(_0x4663d2){_0x1b7c41[_0xc142('0x42')]=_0x4663d2;return _0x1b7c41;})[_0xc142('0x22')](respondWithFilteredResult(_0x56195b,_0x3a5902))[_0xc142('0x43')](handleError(_0x56195b,null));};exports[_0xc142('0x44')]=function(_0x510825,_0x9b1e5f){var _0x1be371={'raw':!![],'where':{'id':_0x510825['params']['id']}},_0x55dab8={};_0x55dab8[_0xc142('0x2e')]=_['keys'](db[_0xc142('0x2a')][_0xc142('0x2b')]);_0x55dab8[_0xc142('0x32')]=_[_0xc142('0x2f')](_0x510825[_0xc142('0x32')]);_0x55dab8[_0xc142('0x30')]=_[_0xc142('0x31')](_0x55dab8[_0xc142('0x2e')],_0x55dab8[_0xc142('0x32')]);_0x1be371[_0xc142('0x33')]=_[_0xc142('0x31')](_0x55dab8['model'],qs[_0xc142('0x34')](_0x510825['query'][_0xc142('0x34')]));_0x1be371['attributes']=_0x1be371[_0xc142('0x33')][_0xc142('0x35')]?_0x1be371[_0xc142('0x33')]:_0x55dab8[_0xc142('0x2e')];if(_0x510825[_0xc142('0x32')]['includeAll']){_0x1be371[_0xc142('0x40')]=[{'all':!![]}];}_0x1be371=_[_0xc142('0x3d')]({},_0x1be371,_0x510825[_0xc142('0x3e')]);return db[_0xc142('0x2a')][_0xc142('0x45')](_0x1be371)[_0xc142('0x22')](handleEntityNotFound(_0x9b1e5f,null))[_0xc142('0x22')](respondWithResult(_0x9b1e5f,null))['catch'](handleError(_0x9b1e5f,null));};exports[_0xc142('0x46')]=function(_0x26abae,_0x4e7fd4){return db[_0xc142('0x2a')][_0xc142('0x46')](_0x26abae[_0xc142('0x47')],{})[_0xc142('0x22')](respondWithResult(_0x4e7fd4,0xc9))[_0xc142('0x43')](handleError(_0x4e7fd4,null));};exports[_0xc142('0x21')]=function(_0x4cd60d,_0x4f1f29){if(_0x4cd60d[_0xc142('0x47')]['id']){delete _0x4cd60d[_0xc142('0x47')]['id'];}return db[_0xc142('0x2a')][_0xc142('0x45')]({'where':{'id':_0x4cd60d['params']['id']}})[_0xc142('0x22')](handleEntityNotFound(_0x4f1f29,null))[_0xc142('0x22')](saveUpdates(_0x4cd60d[_0xc142('0x47')],null))[_0xc142('0x22')](respondWithResult(_0x4f1f29,null))[_0xc142('0x43')](handleError(_0x4f1f29,null));};exports['destroy']=function(_0x5207b2,_0x803641){return db[_0xc142('0x2a')][_0xc142('0x45')]({'where':{'id':_0x5207b2[_0xc142('0x48')]['id']}})[_0xc142('0x22')](handleEntityNotFound(_0x803641,null))[_0xc142('0x22')](removeEntity(_0x803641,null))['catch'](handleError(_0x803641,null));};exports[_0xc142('0x49')]=function(_0x2933f1,_0x43d9b3){return db['SquareDetailsReport'][_0xc142('0x49')]()[_0xc142('0x22')](respondWithResult(_0x43d9b3,null))[_0xc142('0x43')](handleError(_0x43d9b3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d290fc0..9228b5c 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 _0x78a0=['exports','report_square_details','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x88cea5,_0x1f7ad9){var _0x701927=function(_0x2c8d8e){while(--_0x2c8d8e){_0x88cea5['push'](_0x88cea5['shift']());}};_0x701927(++_0x1f7ad9);}(_0x78a0,0x98));var _0x078a=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x78a0[_0x406e46];return _0x4a3742;};'use strict';var _=require(_0x078a('0x0'));var util=require('util');var logger=require(_0x078a('0x1'))(_0x078a('0x2'));var moment=require(_0x078a('0x3'));var BPromise=require('bluebird');var rp=require(_0x078a('0x4'));var fs=require('fs');var path=require(_0x078a('0x5'));var rimraf=require(_0x078a('0x6'));var config=require('../../config/environment');var attributes=require(_0x078a('0x7'));module[_0x078a('0x8')]=function(_0x3c55af,_0x52cee3){return _0x3c55af['define']('SquareDetailsReport',attributes,{'tableName':_0x078a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e16=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd24dc3,_0x305f5d){var _0xa4697f=function(_0x18b679){while(--_0x18b679){_0xd24dc3['push'](_0xd24dc3['shift']());}};_0xa4697f(++_0x305f5d);}(_0x3e16,0x1c8));var _0x63e1=function(_0x3be82c,_0x3307d7){_0x3be82c=_0x3be82c-0x0;var _0x40d25a=_0x3e16[_0x3be82c];return _0x40d25a;};'use strict';var _=require(_0x63e1('0x0'));var util=require('util');var logger=require(_0x63e1('0x1'))(_0x63e1('0x2'));var moment=require(_0x63e1('0x3'));var BPromise=require(_0x63e1('0x4'));var rp=require(_0x63e1('0x5'));var fs=require('fs');var path=require(_0x63e1('0x6'));var rimraf=require(_0x63e1('0x7'));var config=require(_0x63e1('0x8'));var attributes=require(_0x63e1('0x9'));module[_0x63e1('0xa')]=function(_0x55f09a,_0x33db22){return _0x55f09a[_0x63e1('0xb')](_0x63e1('0xc'),attributes,{'tableName':_0x63e1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 7a45a11..05c084f 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 _0x5b12=['../../config/utils','rpc','client','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x362f6d,_0x59089a){var _0xde9ff1=function(_0x3aad76){while(--_0x3aad76){_0x362f6d['push'](_0x362f6d['shift']());}};_0xde9ff1(++_0x59089a);}(_0x5b12,0xa3));var _0x25b1=function(_0x427e0f,_0x123805){_0x427e0f=_0x427e0f-0x0;var _0x2531d9=_0x5b12[_0x427e0f];return _0x2531d9;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['create'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3bfd7d){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger['debug'](_0x25b1('0x14'),_0x27ccc9,JSON['stringify'](_0x3bfd7d));_0x2a7d14(_0x3bfd7d);})['catch'](function(_0x565cfd){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x565cfd['message'],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x565cfd[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0x1b0e=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','create','options','raw','stringify','lodash','util'];(function(_0x361bd3,_0x6dd8fa){var _0x344bee=function(_0x14bb22){while(--_0x14bb22){_0x361bd3['push'](_0x361bd3['shift']());}};_0x344bee(++_0x6dd8fa);}(_0x1b0e,0x132));var _0xe1b0=function(_0xf76138,_0x3ee58b){_0xf76138=_0xf76138-0x0;var _0xdb57d0=_0x1b0e[_0xf76138];return _0xdb57d0;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['SquareDetailsReport'][_0xe1b0('0x18')](_0x2928b6['body'],{'raw':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e0a89){logger[_0xe1b0('0xd')]('CreateSquareDetailsReport',_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x1b')](_0x3e0a89));_0x5c195f(_0x3e0a89);})['catch'](function(_0x3c0824){logger['error']('CreateSquareDetailsReport',_0x3c0824['message'],_0x2928b6);_0x5b300e(_0x349f90['error'](0x1f4,_0x3c0824[_0xe1b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3efa99e..91d4f8f 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 _0xc05b=['isAuthenticated','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get'];(function(_0x1920d8,_0x140ccf){var _0x51965d=function(_0x5ab12b){while(--_0x5ab12b){_0x1920d8['push'](_0x1920d8['shift']());}};_0x51965d(++_0x140ccf);}(_0xc05b,0x14c));var _0xbc05=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xc05b[_0x45313f];return _0x402910;};'use strict';var express=require('express');var router=express[_0xbc05('0x0')]();var auth=require(_0xbc05('0x1'));var controller=require(_0xbc05('0x2'));router[_0xbc05('0x3')]('/',auth[_0xbc05('0x4')](),controller['index']);router[_0xbc05('0x3')](_0xbc05('0x5'),auth[_0xbc05('0x4')](),controller['killProcess']);module[_0xbc05('0x6')]=router; \ No newline at end of file +var _0xfb43=['/process/:pid/kill','isAuthenticated','exports','express','Router','../../components/auth/service','get','index'];(function(_0x14aee9,_0x596a94){var _0x6de2f7=function(_0x4561e3){while(--_0x4561e3){_0x14aee9['push'](_0x14aee9['shift']());}};_0x6de2f7(++_0x596a94);}(_0xfb43,0xfb));var _0x3fb4=function(_0x11536c,_0x5dd752){_0x11536c=_0x11536c-0x0;var _0x14cb23=_0xfb43[_0x11536c];return _0x14cb23;};'use strict';var express=require(_0x3fb4('0x0'));var router=express[_0x3fb4('0x1')]();var auth=require(_0x3fb4('0x2'));var controller=require('./system.controller');router[_0x3fb4('0x3')]('/',auth['isAuthenticated'](),controller[_0x3fb4('0x4')]);router['get'](_0x3fb4('0x5'),auth[_0x3fb4('0x6')](),controller['killProcess']);module[_0x3fb4('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5d110b2..c5749ac 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 _0xaa4f=['Process\x20with\x20pid\x20%s\x20not\x20found!','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','getAllData','then','status','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','format'];(function(_0x2c4e79,_0x2ecbf5){var _0x428d2a=function(_0x4b5793){while(--_0x4b5793){_0x2c4e79['push'](_0x2c4e79['shift']());}};_0x428d2a(++_0x2ecbf5);}(_0xaa4f,0x7b));var _0xfaa4=function(_0x2848be,_0x100627){_0x2848be=_0x2848be-0x0;var _0x2bf68d=_0xaa4f[_0x2848be];return _0x2bf68d;};'use strict';var info=require(_0xfaa4('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xfaa4('0x1'))(_0xfaa4('0x2'));var util=require(_0xfaa4('0x3'));var BPromise=require(_0xfaa4('0x4'));var _=require(_0xfaa4('0x5'));function handleError(_0x384413,_0x7a612b,_0x5aa273){_0x7a612b=_0x7a612b||0x1f4;return function(_0x542253){logger[_0xfaa4('0x6')](_0xfaa4('0x7'),_0x5aa273,_0x7a612b,util[_0xfaa4('0x8')](_0x542253,{'showHidden':![],'depth':null}));delete _0x542253['name'];_0x384413['status'](_0x7a612b)['send'](_0x542253);};}exports['index']=function(_0x8139df,_0x51cacf){return info[_0xfaa4('0x9')]()[_0xfaa4('0xa')](function(_0x5e6c3d){return _0x51cacf[_0xfaa4('0xb')](0xc8)[_0xfaa4('0xc')](_0x5e6c3d);})[_0xfaa4('0xd')](function(_0x1f8077){return _0x51cacf[_0xfaa4('0xb')](0x1f4)[_0xfaa4('0xc')](_0x1f8077);});};exports[_0xfaa4('0xe')]=function(_0x2540e6,_0x164642){var _0x2820f4=[_0xfaa4('0xf')];return new BPromise(function(_0x187af7,_0x19a789){return exec(util['format'](_0xfaa4('0x10'),_0x2540e6['params'][_0xfaa4('0x11')]),function(_0x183238,_0x4c63d5,_0x5ddf84){if(_0x183238){return _0x19a789(_0x183238);}return _0x187af7(_0x4c63d5);});})[_0xfaa4('0xa')](function(_0x1f1d23){var _0x25c623=![];var _0x3defdb=_0x1f1d23[_0xfaa4('0x12')](/\n/);for(var _0x2ca6e6=0x0,_0x2f4722=_0x2820f4[_0xfaa4('0x13')];_0x2ca6e6<_0x2f4722,_0x25c623===![];_0x2ca6e6+=0x1){if(_0x1f1d23['indexOf'](_0x2820f4[_0x2ca6e6])>=0x0){_0x25c623=!![];}}if(!_0x25c623){throw new Error(util[_0xfaa4('0x14')](_0xfaa4('0x15'),_0x2540e6[_0xfaa4('0x16')]['pid']));}process['kill'](_0x2540e6[_0xfaa4('0x16')][_0xfaa4('0x11')],'SIGINT');return _0x164642[_0xfaa4('0xb')](0xc8)['json']({'message':util[_0xfaa4('0x14')](_0xfaa4('0x17'),_0x2540e6['params']['pid'])});})[_0xfaa4('0xd')](handleError(_0x164642,null,'killProcess'));}; \ No newline at end of file +var _0xee57=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util'];(function(_0x4db79a,_0x153490){var _0x1c6cb1=function(_0x4ddd11){while(--_0x4ddd11){_0x4db79a['push'](_0x4db79a['shift']());}};_0x1c6cb1(++_0x153490);}(_0xee57,0xc6));var _0x7ee5=function(_0x3f11d6,_0x5ed626){_0x3f11d6=_0x3f11d6-0x0;var _0x133d2e=_0xee57[_0x3f11d6];return _0x133d2e;};'use strict';var info=require(_0x7ee5('0x0'));var exec=require(_0x7ee5('0x1'))['exec'];var logger=require(_0x7ee5('0x2'))(_0x7ee5('0x3'));var util=require(_0x7ee5('0x4'));var BPromise=require('bluebird');var _=require(_0x7ee5('0x5'));function handleError(_0xb160b,_0x5c10eb,_0x376806){_0x5c10eb=_0x5c10eb||0x1f4;return function(_0x14a85e){logger[_0x7ee5('0x6')](_0x7ee5('0x7'),_0x376806,_0x5c10eb,util[_0x7ee5('0x8')](_0x14a85e,{'showHidden':![],'depth':null}));delete _0x14a85e[_0x7ee5('0x9')];_0xb160b[_0x7ee5('0xa')](_0x5c10eb)[_0x7ee5('0xb')](_0x14a85e);};}exports[_0x7ee5('0xc')]=function(_0x255051,_0x17ad6f){return info[_0x7ee5('0xd')]()[_0x7ee5('0xe')](function(_0x1b35c4){return _0x17ad6f['status'](0xc8)[_0x7ee5('0xf')](_0x1b35c4);})[_0x7ee5('0x10')](function(_0x1a2028){return _0x17ad6f['status'](0x1f4)['json'](_0x1a2028);});};exports[_0x7ee5('0x11')]=function(_0x1834a8,_0xa8e301){var _0x580ee0=[_0x7ee5('0x12')];return new BPromise(function(_0x22a59f,_0x411ecc){return exec(util[_0x7ee5('0x13')](_0x7ee5('0x14'),_0x1834a8['params'][_0x7ee5('0x15')]),function(_0x289478,_0x29fcc6,_0x27f214){if(_0x289478){return _0x411ecc(_0x289478);}return _0x22a59f(_0x29fcc6);});})[_0x7ee5('0xe')](function(_0x3b4abf){var _0x39dc2=![];var _0x3c287d=_0x3b4abf[_0x7ee5('0x16')](/\n/);for(var _0x6e7f7=0x0,_0x4ab703=_0x580ee0['length'];_0x6e7f7<_0x4ab703,_0x39dc2===![];_0x6e7f7+=0x1){if(_0x3b4abf[_0x7ee5('0x17')](_0x580ee0[_0x6e7f7])>=0x0){_0x39dc2=!![];}}if(!_0x39dc2){throw new Error(util[_0x7ee5('0x13')](_0x7ee5('0x18'),_0x1834a8[_0x7ee5('0x19')][_0x7ee5('0x15')]));}process[_0x7ee5('0x1a')](_0x1834a8[_0x7ee5('0x19')][_0x7ee5('0x15')],_0x7ee5('0x1b'));return _0xa8e301[_0x7ee5('0xa')](0xc8)['json']({'message':util[_0x7ee5('0x13')](_0x7ee5('0x1c'),_0x1834a8[_0x7ee5('0x19')][_0x7ee5('0x15')])});})['catch'](handleError(_0xa8e301,null,_0x7ee5('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a5b399f..78e49d4 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 _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','index','/describe','isAuthenticated'];(function(_0xb16c89,_0x330be9){var _0xbd6b13=function(_0x562649){while(--_0x562649){_0xb16c89['push'](_0xb16c89['shift']());}};_0xbd6b13(++_0x330be9);}(_0xbec5,0xe5));var _0x5bec=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0xbec5[_0x28e2cd];return _0x11fd46;};'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('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file +var _0xb43b=['../../components/interaction/service','../../config/environment','./tag.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x13aebb,_0x7a3a){var _0x4fa276=function(_0x7e58ba){while(--_0x7e58ba){_0x13aebb['push'](_0x13aebb['shift']());}};_0x4fa276(++_0x7a3a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1dc5db,_0x4597c8){_0x1dc5db=_0x1dc5db-0x0;var _0x2b9523=_0xb43b[_0x1dc5db];return _0x2b9523;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 5802ad4..6550ac5 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 _0x3308=['name','#0091EA','sequelize','exports','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3308,0x160));var _0x8330=function(_0x1b5620,_0x3f6bac){_0x1b5620=_0x1b5620-0x0;var _0x11cd02=_0x3308[_0x1b5620];return _0x11cd02;};'use strict';var Sequelize=require(_0x8330('0x0'));module[_0x8330('0x1')]={'name':{'type':Sequelize[_0x8330('0x2')],'unique':_0x8330('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8330('0x2')],'defaultValue':_0x8330('0x4')},'description':{'type':Sequelize[_0x8330('0x2')]}}; \ No newline at end of file +var _0x17d1=['#0091EA','sequelize','exports','STRING'];(function(_0x519f9f,_0x55d3b2){var _0x242097=function(_0x525474){while(--_0x525474){_0x519f9f['push'](_0x519f9f['shift']());}};_0x242097(++_0x55d3b2);}(_0x17d1,0xc9));var _0x117d=function(_0xc0b99b,_0xf5632){_0xc0b99b=_0xc0b99b-0x0;var _0x2da8e0=_0x17d1[_0xc0b99b];return _0x2da8e0;};'use strict';var Sequelize=require(_0x117d('0x0'));module[_0x117d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x117d('0x2')],'defaultValue':_0x117d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c4392ad..4f3f0f6 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 _0xd022=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','Tags','UserProfileResource','destroy','then','error','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Tag','count','includeAll','include','findAll','rows','catch','keys','find','create','body','user','get'];(function(_0x1e9347,_0x29a5d6){var _0xbd7bbb=function(_0x28c418){while(--_0x28c418){_0x1e9347['push'](_0x1e9347['shift']());}};_0xbd7bbb(++_0x29a5d6);}(_0xd022,0xa6));var _0x2d02=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd022[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x2d02('0x0'));var rimraf=require(_0x2d02('0x1'));var zipdir=require(_0x2d02('0x2'));var jsonpatch=require(_0x2d02('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d02('0x4'));var Mustache=require(_0x2d02('0x5'));var util=require('util');var path=require(_0x2d02('0x6'));var sox=require(_0x2d02('0x7'));var csv=require(_0x2d02('0x8'));var ejs=require(_0x2d02('0x9'));var fs=require('fs');var fs_extra=require(_0x2d02('0xa'));var _=require(_0x2d02('0xb'));var squel=require('squel');var crypto=require(_0x2d02('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d02('0x8'));var querystring=require(_0x2d02('0xd'));var Papa=require(_0x2d02('0xe'));var Redis=require('ioredis');var authService=require(_0x2d02('0xf'));var qs=require(_0x2d02('0x10'));var as=require(_0x2d02('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2d02('0x12'));var config=require(_0x2d02('0x13'));var licenseUtil=require(_0x2d02('0x14'));var db=require(_0x2d02('0x15'))['db'];function respondWithStatusCode(_0x41bd6a,_0x5bf254){_0x5bf254=_0x5bf254||0xcc;return function(_0x4b6745){if(_0x4b6745){return _0x41bd6a[_0x2d02('0x16')](_0x5bf254);}return _0x41bd6a[_0x2d02('0x17')](_0x5bf254)['end']();};}function respondWithResult(_0x1eae3f,_0x40e919){_0x40e919=_0x40e919||0xc8;return function(_0xee5791){if(_0xee5791){return _0x1eae3f[_0x2d02('0x17')](_0x40e919)[_0x2d02('0x18')](_0xee5791);}};}function respondWithFilteredResult(_0x3d9a08,_0x340661){return function(_0x2bcd77){if(_0x2bcd77){var _0x926b2b=typeof _0x340661[_0x2d02('0x19')]==='undefined'&&typeof _0x340661[_0x2d02('0x1a')]==='undefined';var _0x37fa19=_0x2bcd77['count'];var _0x3e308d=_0x926b2b?0x0:_0x340661['offset'];var _0x2d53b0=_0x926b2b?_0x2bcd77['count']:_0x340661['offset']+_0x340661[_0x2d02('0x1a')];var _0x991803;if(_0x2d53b0>=_0x37fa19){_0x2d53b0=_0x37fa19;_0x991803=0xc8;}else{_0x991803=0xce;}_0x3d9a08[_0x2d02('0x17')](_0x991803);return _0x3d9a08['set'](_0x2d02('0x1b'),_0x3e308d+'-'+_0x2d53b0+'/'+_0x37fa19)[_0x2d02('0x18')](_0x2bcd77);}return null;};}function patchUpdates(_0x26bf0f){return function(_0x3390f3){try{jsonpatch['apply'](_0x3390f3,_0x26bf0f,!![]);}catch(_0xc62499){return BPromise[_0x2d02('0x1c')](_0xc62499);}return _0x3390f3[_0x2d02('0x1d')]();};}function saveUpdates(_0x3ac116,_0x2c0425){return function(_0x507bb8){if(_0x507bb8){return _0x507bb8['update'](_0x3ac116)['then'](function(_0x5f469f){return _0x5f469f;});}return null;};}function removeEntity(_0x411523,_0x1c4e73){return function(_0x10529a){if(_0x10529a){return _0x10529a['destroy']()['then'](function(){var _0x4b30ca=_0x10529a['get']({'plain':!![]});var _0x437def=_0x2d02('0x1e');return db[_0x2d02('0x1f')][_0x2d02('0x20')]({'where':{'type':_0x437def,'resourceId':_0x4b30ca['id']}})['then'](function(){return _0x10529a;});})[_0x2d02('0x21')](function(){_0x411523[_0x2d02('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478650,_0x563b90){return function(_0x1418e6){if(!_0x1418e6){_0x478650[_0x2d02('0x16')](0x194);}return _0x1418e6;};}function handleError(_0x6fbf,_0x98e1b6){_0x98e1b6=_0x98e1b6||0x1f4;return function(_0x51430b){logger[_0x2d02('0x22')](_0x51430b[_0x2d02('0x23')]);if(_0x51430b[_0x2d02('0x24')]){delete _0x51430b[_0x2d02('0x24')];}_0x6fbf[_0x2d02('0x17')](_0x98e1b6)[_0x2d02('0x25')](_0x51430b);};}exports[_0x2d02('0x26')]=function(_0x28e0d6,_0x2ff166){var _0x295de9={},_0x37e3c5={},_0x197b3f={'count':0x0,'rows':[]};var _0x3a80b9=_[_0x2d02('0x27')](db['Tag'][_0x2d02('0x28')],function(_0x1fe69a){return{'name':_0x1fe69a['fieldName'],'type':_0x1fe69a[_0x2d02('0x29')]['key']};});_0x37e3c5['model']=_['map'](_0x3a80b9,'name');_0x37e3c5[_0x2d02('0x2a')]=_['keys'](_0x28e0d6[_0x2d02('0x2a')]);_0x37e3c5[_0x2d02('0x2b')]=_[_0x2d02('0x2c')](_0x37e3c5['model'],_0x37e3c5[_0x2d02('0x2a')]);_0x295de9[_0x2d02('0x2d')]=_[_0x2d02('0x2c')](_0x37e3c5[_0x2d02('0x2e')],qs[_0x2d02('0x2f')](_0x28e0d6[_0x2d02('0x2a')][_0x2d02('0x2f')]));_0x295de9[_0x2d02('0x2d')]=_0x295de9[_0x2d02('0x2d')][_0x2d02('0x30')]?_0x295de9['attributes']:_0x37e3c5[_0x2d02('0x2e')];if(!_0x28e0d6[_0x2d02('0x2a')]['hasOwnProperty'](_0x2d02('0x31'))){_0x295de9[_0x2d02('0x1a')]=qs[_0x2d02('0x1a')](_0x28e0d6['query'][_0x2d02('0x1a')]);_0x295de9['offset']=qs[_0x2d02('0x19')](_0x28e0d6[_0x2d02('0x2a')][_0x2d02('0x19')]);}_0x295de9[_0x2d02('0x32')]=qs['sort'](_0x28e0d6[_0x2d02('0x2a')][_0x2d02('0x33')]);_0x295de9['where']=qs[_0x2d02('0x2b')](_[_0x2d02('0x34')](_0x28e0d6['query'],_0x37e3c5['filters']),_0x3a80b9);if(_0x28e0d6['query']['filter']){_0x295de9['where']=_[_0x2d02('0x35')](_0x295de9[_0x2d02('0x36')],{'$or':_[_0x2d02('0x27')](_0x3a80b9,function(_0x1cf557){if(_0x1cf557[_0x2d02('0x29')]!==_0x2d02('0x37')){var _0x558633={};_0x558633[_0x1cf557[_0x2d02('0x24')]]={'$like':'%'+_0x28e0d6['query'][_0x2d02('0x38')]+'%'};return _0x558633;}})});}_0x295de9=_['merge']({},_0x295de9,_0x28e0d6[_0x2d02('0x39')]);var _0x5421bb={'where':_0x295de9[_0x2d02('0x36')]};return db[_0x2d02('0x3a')]['count'](_0x5421bb)[_0x2d02('0x21')](function(_0x5ccc42){_0x197b3f[_0x2d02('0x3b')]=_0x5ccc42;if(_0x28e0d6[_0x2d02('0x2a')][_0x2d02('0x3c')]){_0x295de9[_0x2d02('0x3d')]=[{'all':!![]}];}return db[_0x2d02('0x3a')][_0x2d02('0x3e')](_0x295de9);})[_0x2d02('0x21')](function(_0x5d0d24){_0x197b3f[_0x2d02('0x3f')]=_0x5d0d24;return _0x197b3f;})[_0x2d02('0x21')](respondWithFilteredResult(_0x2ff166,_0x295de9))[_0x2d02('0x40')](handleError(_0x2ff166,null));};exports['show']=function(_0x221345,_0x337330){var _0x44a010={'raw':!![],'where':{'id':_0x221345['params']['id']}},_0x291bf4={};_0x291bf4[_0x2d02('0x2e')]=_[_0x2d02('0x41')](db[_0x2d02('0x3a')][_0x2d02('0x28')]);_0x291bf4['query']=_[_0x2d02('0x41')](_0x221345['query']);_0x291bf4[_0x2d02('0x2b')]=_['intersection'](_0x291bf4[_0x2d02('0x2e')],_0x291bf4[_0x2d02('0x2a')]);_0x44a010['attributes']=_[_0x2d02('0x2c')](_0x291bf4[_0x2d02('0x2e')],qs[_0x2d02('0x2f')](_0x221345['query']['fields']));_0x44a010[_0x2d02('0x2d')]=_0x44a010[_0x2d02('0x2d')][_0x2d02('0x30')]?_0x44a010[_0x2d02('0x2d')]:_0x291bf4[_0x2d02('0x2e')];if(_0x221345[_0x2d02('0x2a')][_0x2d02('0x3c')]){_0x44a010[_0x2d02('0x3d')]=[{'all':!![]}];}_0x44a010=_[_0x2d02('0x35')]({},_0x44a010,_0x221345[_0x2d02('0x39')]);return db['Tag'][_0x2d02('0x42')](_0x44a010)[_0x2d02('0x21')](handleEntityNotFound(_0x337330,null))[_0x2d02('0x21')](respondWithResult(_0x337330,null))[_0x2d02('0x40')](handleError(_0x337330,null));};exports[_0x2d02('0x43')]=function(_0x2ee879,_0x291a3f){return db['Tag'][_0x2d02('0x43')](_0x2ee879[_0x2d02('0x44')],{})[_0x2d02('0x21')](function(_0x20b23a){var _0x43fb58=_0x2ee879[_0x2d02('0x45')][_0x2d02('0x46')]({'plain':!![]});if(!_0x43fb58)throw new Error(_0x2d02('0x47'));if(_0x43fb58[_0x2d02('0x48')]===_0x2d02('0x45')){var _0x29c8dd=_0x20b23a[_0x2d02('0x46')]({'plain':!![]});var _0x3be0d0='Tags';return db[_0x2d02('0x49')][_0x2d02('0x42')]({'where':{'name':_0x3be0d0,'userProfileId':_0x43fb58[_0x2d02('0x4a')]},'raw':!![]})[_0x2d02('0x21')](function(_0x2e4e70){if(_0x2e4e70&&_0x2e4e70[_0x2d02('0x4b')]===0x0){return db[_0x2d02('0x1f')][_0x2d02('0x43')]({'name':_0x29c8dd[_0x2d02('0x24')],'resourceId':_0x29c8dd['id'],'type':_0x2e4e70[_0x2d02('0x24')],'sectionId':_0x2e4e70['id']},{})[_0x2d02('0x21')](function(){return _0x20b23a;});}else{return _0x20b23a;}})[_0x2d02('0x40')](function(_0x233ec0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233ec0);throw _0x233ec0;});}return _0x20b23a;})['then'](respondWithResult(_0x291a3f,0xc9))[_0x2d02('0x40')](handleError(_0x291a3f,null));};exports[_0x2d02('0x4c')]=function(_0x358739,_0x3c8405){if(_0x358739[_0x2d02('0x44')]['id']){delete _0x358739[_0x2d02('0x44')]['id'];}return db['Tag'][_0x2d02('0x42')]({'where':{'id':_0x358739[_0x2d02('0x4d')]['id']}})[_0x2d02('0x21')](handleEntityNotFound(_0x3c8405,null))[_0x2d02('0x21')](saveUpdates(_0x358739[_0x2d02('0x44')],null))[_0x2d02('0x21')](respondWithResult(_0x3c8405,null))[_0x2d02('0x40')](handleError(_0x3c8405,null));};exports[_0x2d02('0x20')]=function(_0x28da58,_0xeeb7f7){return db['Tag'][_0x2d02('0x42')]({'where':{'id':_0x28da58[_0x2d02('0x4d')]['id']}})[_0x2d02('0x21')](handleEntityNotFound(_0xeeb7f7,null))[_0x2d02('0x21')](removeEntity(_0xeeb7f7,null))[_0x2d02('0x40')](handleError(_0xeeb7f7,null));};exports[_0x2d02('0x4e')]=function(_0x3310e9,_0x591982){return db[_0x2d02('0x3a')][_0x2d02('0x4e')]()[_0x2d02('0x21')](respondWithResult(_0x591982,null))[_0x2d02('0x40')](handleError(_0x591982,null));}; \ No newline at end of file +var _0xe182=['zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','rimraf'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0xe182,0xf8));var _0x2e18=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe182[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e18('0x0'));var zipdir=require(_0x2e18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e18('0x2'));var BPromise=require(_0x2e18('0x3'));var Mustache=require(_0x2e18('0x4'));var util=require(_0x2e18('0x5'));var path=require(_0x2e18('0x6'));var sox=require(_0x2e18('0x7'));var csv=require(_0x2e18('0x8'));var ejs=require(_0x2e18('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e18('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2e18('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2e18('0x8'));var querystring=require(_0x2e18('0xc'));var Papa=require(_0x2e18('0xd'));var Redis=require(_0x2e18('0xe'));var authService=require(_0x2e18('0xf'));var qs=require(_0x2e18('0x10'));var as=require(_0x2e18('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e18('0x12'))(_0x2e18('0x13'));var utils=require('../../config/utils');var config=require(_0x2e18('0x14'));var licenseUtil=require(_0x2e18('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xac2cc,_0x2def99){_0x2def99=_0x2def99||0xcc;return function(_0x158608){if(_0x158608){return _0xac2cc[_0x2e18('0x16')](_0x2def99);}return _0xac2cc['status'](_0x2def99)[_0x2e18('0x17')]();};}function respondWithResult(_0x1e4688,_0xaaa192){_0xaaa192=_0xaaa192||0xc8;return function(_0x148a5b){if(_0x148a5b){return _0x1e4688['status'](_0xaaa192)[_0x2e18('0x18')](_0x148a5b);}};}function respondWithFilteredResult(_0x273096,_0x3d1f38){return function(_0x31e644){if(_0x31e644){var _0x157850=typeof _0x3d1f38[_0x2e18('0x19')]===_0x2e18('0x1a')&&typeof _0x3d1f38[_0x2e18('0x1b')]==='undefined';var _0x828c35=_0x31e644[_0x2e18('0x1c')];var _0x448e90=_0x157850?0x0:_0x3d1f38['offset'];var _0x79024f=_0x157850?_0x31e644[_0x2e18('0x1c')]:_0x3d1f38['offset']+_0x3d1f38[_0x2e18('0x1b')];var _0xc7067;if(_0x79024f>=_0x828c35){_0x79024f=_0x828c35;_0xc7067=0xc8;}else{_0xc7067=0xce;}_0x273096[_0x2e18('0x1d')](_0xc7067);return _0x273096[_0x2e18('0x1e')](_0x2e18('0x1f'),_0x448e90+'-'+_0x79024f+'/'+_0x828c35)['json'](_0x31e644);}return null;};}function patchUpdates(_0x44a4a3){return function(_0x14217c){try{jsonpatch[_0x2e18('0x20')](_0x14217c,_0x44a4a3,!![]);}catch(_0x31b77a){return BPromise[_0x2e18('0x21')](_0x31b77a);}return _0x14217c[_0x2e18('0x22')]();};}function saveUpdates(_0x223700,_0x5bc3b8){return function(_0xf41e0d){if(_0xf41e0d){return _0xf41e0d[_0x2e18('0x23')](_0x223700)[_0x2e18('0x24')](function(_0x6b4c83){return _0x6b4c83;});}return null;};}function removeEntity(_0x2c07b6,_0x9b42f5){return function(_0x3153b9){if(_0x3153b9){return _0x3153b9[_0x2e18('0x25')]()[_0x2e18('0x24')](function(){var _0x65fd9d=_0x3153b9[_0x2e18('0x26')]({'plain':!![]});var _0x3f4673=_0x2e18('0x27');return db[_0x2e18('0x28')]['destroy']({'where':{'type':_0x3f4673,'resourceId':_0x65fd9d['id']}})['then'](function(){return _0x3153b9;});})[_0x2e18('0x24')](function(){_0x2c07b6['status'](0xcc)[_0x2e18('0x17')]();});}};}function handleEntityNotFound(_0x44edf7,_0x2660b4){return function(_0x58f18e){if(!_0x58f18e){_0x44edf7[_0x2e18('0x16')](0x194);}return _0x58f18e;};}function handleError(_0x4936c1,_0x85f8df){_0x85f8df=_0x85f8df||0x1f4;return function(_0x324bbb){logger[_0x2e18('0x29')](_0x324bbb[_0x2e18('0x2a')]);if(_0x324bbb[_0x2e18('0x2b')]){delete _0x324bbb['name'];}_0x4936c1[_0x2e18('0x1d')](_0x85f8df)[_0x2e18('0x2c')](_0x324bbb);};}exports[_0x2e18('0x2d')]=function(_0x1f9f6f,_0xd7e2){var _0x1e6a38={},_0x356046={},_0xf4820b={'count':0x0,'rows':[]};var _0x334e74=_[_0x2e18('0x2e')](db[_0x2e18('0x2f')][_0x2e18('0x30')],function(_0x10b8a3){return{'name':_0x10b8a3[_0x2e18('0x31')],'type':_0x10b8a3[_0x2e18('0x32')][_0x2e18('0x33')]};});_0x356046[_0x2e18('0x34')]=_[_0x2e18('0x2e')](_0x334e74,_0x2e18('0x2b'));_0x356046[_0x2e18('0x35')]=_['keys'](_0x1f9f6f[_0x2e18('0x35')]);_0x356046[_0x2e18('0x36')]=_['intersection'](_0x356046[_0x2e18('0x34')],_0x356046['query']);_0x1e6a38[_0x2e18('0x37')]=_[_0x2e18('0x38')](_0x356046[_0x2e18('0x34')],qs[_0x2e18('0x39')](_0x1f9f6f[_0x2e18('0x35')]['fields']));_0x1e6a38['attributes']=_0x1e6a38[_0x2e18('0x37')][_0x2e18('0x3a')]?_0x1e6a38[_0x2e18('0x37')]:_0x356046['model'];if(!_0x1f9f6f[_0x2e18('0x35')][_0x2e18('0x3b')](_0x2e18('0x3c'))){_0x1e6a38[_0x2e18('0x1b')]=qs[_0x2e18('0x1b')](_0x1f9f6f[_0x2e18('0x35')]['limit']);_0x1e6a38[_0x2e18('0x19')]=qs[_0x2e18('0x19')](_0x1f9f6f['query'][_0x2e18('0x19')]);}_0x1e6a38[_0x2e18('0x3d')]=qs[_0x2e18('0x3e')](_0x1f9f6f[_0x2e18('0x35')][_0x2e18('0x3e')]);_0x1e6a38[_0x2e18('0x3f')]=qs[_0x2e18('0x36')](_[_0x2e18('0x40')](_0x1f9f6f[_0x2e18('0x35')],_0x356046[_0x2e18('0x36')]),_0x334e74);if(_0x1f9f6f[_0x2e18('0x35')]['filter']){_0x1e6a38[_0x2e18('0x3f')]=_[_0x2e18('0x41')](_0x1e6a38[_0x2e18('0x3f')],{'$or':_[_0x2e18('0x2e')](_0x334e74,function(_0x5830d9){if(_0x5830d9[_0x2e18('0x32')]!==_0x2e18('0x42')){var _0x19629f={};_0x19629f[_0x5830d9[_0x2e18('0x2b')]]={'$like':'%'+_0x1f9f6f[_0x2e18('0x35')]['filter']+'%'};return _0x19629f;}})});}_0x1e6a38=_[_0x2e18('0x41')]({},_0x1e6a38,_0x1f9f6f[_0x2e18('0x43')]);var _0x48862d={'where':_0x1e6a38[_0x2e18('0x3f')]};return db[_0x2e18('0x2f')]['count'](_0x48862d)['then'](function(_0x569d5e){_0xf4820b[_0x2e18('0x1c')]=_0x569d5e;if(_0x1f9f6f[_0x2e18('0x35')]['includeAll']){_0x1e6a38['include']=[{'all':!![]}];}return db[_0x2e18('0x2f')][_0x2e18('0x44')](_0x1e6a38);})[_0x2e18('0x24')](function(_0x5629f4){_0xf4820b['rows']=_0x5629f4;return _0xf4820b;})['then'](respondWithFilteredResult(_0xd7e2,_0x1e6a38))[_0x2e18('0x45')](handleError(_0xd7e2,null));};exports[_0x2e18('0x46')]=function(_0x4ab039,_0x40989e){var _0x2e6bd5={'raw':!![],'where':{'id':_0x4ab039[_0x2e18('0x47')]['id']}},_0x5bfaba={};_0x5bfaba[_0x2e18('0x34')]=_[_0x2e18('0x48')](db['Tag']['rawAttributes']);_0x5bfaba['query']=_[_0x2e18('0x48')](_0x4ab039[_0x2e18('0x35')]);_0x5bfaba[_0x2e18('0x36')]=_[_0x2e18('0x38')](_0x5bfaba['model'],_0x5bfaba[_0x2e18('0x35')]);_0x2e6bd5[_0x2e18('0x37')]=_['intersection'](_0x5bfaba['model'],qs[_0x2e18('0x39')](_0x4ab039[_0x2e18('0x35')]['fields']));_0x2e6bd5['attributes']=_0x2e6bd5[_0x2e18('0x37')]['length']?_0x2e6bd5[_0x2e18('0x37')]:_0x5bfaba[_0x2e18('0x34')];if(_0x4ab039['query'][_0x2e18('0x49')]){_0x2e6bd5[_0x2e18('0x4a')]=[{'all':!![]}];}_0x2e6bd5=_[_0x2e18('0x41')]({},_0x2e6bd5,_0x4ab039[_0x2e18('0x43')]);return db['Tag'][_0x2e18('0x4b')](_0x2e6bd5)[_0x2e18('0x24')](handleEntityNotFound(_0x40989e,null))[_0x2e18('0x24')](respondWithResult(_0x40989e,null))[_0x2e18('0x45')](handleError(_0x40989e,null));};exports[_0x2e18('0x4c')]=function(_0x1d621f,_0x170b4f){return db[_0x2e18('0x2f')][_0x2e18('0x4c')](_0x1d621f[_0x2e18('0x4d')],{})[_0x2e18('0x24')](function(_0xa4f80c){var _0x710232=_0x1d621f[_0x2e18('0x4e')]['get']({'plain':!![]});if(!_0x710232)throw new Error(_0x2e18('0x4f'));if(_0x710232['role']==='user'){var _0x396922=_0xa4f80c[_0x2e18('0x26')]({'plain':!![]});var _0x17bb73=_0x2e18('0x27');return db[_0x2e18('0x50')][_0x2e18('0x4b')]({'where':{'name':_0x17bb73,'userProfileId':_0x710232[_0x2e18('0x51')]},'raw':!![]})[_0x2e18('0x24')](function(_0x5acee2){if(_0x5acee2&&_0x5acee2[_0x2e18('0x52')]===0x0){return db[_0x2e18('0x28')]['create']({'name':_0x396922[_0x2e18('0x2b')],'resourceId':_0x396922['id'],'type':_0x5acee2[_0x2e18('0x2b')],'sectionId':_0x5acee2['id']},{})[_0x2e18('0x24')](function(){return _0xa4f80c;});}else{return _0xa4f80c;}})['catch'](function(_0x4bef41){logger[_0x2e18('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bef41);throw _0x4bef41;});}return _0xa4f80c;})['then'](respondWithResult(_0x170b4f,0xc9))[_0x2e18('0x45')](handleError(_0x170b4f,null));};exports['update']=function(_0x573c08,_0x392756){if(_0x573c08['body']['id']){delete _0x573c08['body']['id'];}return db['Tag'][_0x2e18('0x4b')]({'where':{'id':_0x573c08[_0x2e18('0x47')]['id']}})[_0x2e18('0x24')](handleEntityNotFound(_0x392756,null))[_0x2e18('0x24')](saveUpdates(_0x573c08['body'],null))[_0x2e18('0x24')](respondWithResult(_0x392756,null))['catch'](handleError(_0x392756,null));};exports[_0x2e18('0x25')]=function(_0x45c22a,_0x5b76f4){return db['Tag']['find']({'where':{'id':_0x45c22a['params']['id']}})[_0x2e18('0x24')](handleEntityNotFound(_0x5b76f4,null))['then'](removeEntity(_0x5b76f4,null))[_0x2e18('0x45')](handleError(_0x5b76f4,null));};exports['describe']=function(_0x3f2917,_0x48038e){return db[_0x2e18('0x2f')]['describe']()['then'](respondWithResult(_0x48038e,null))['catch'](handleError(_0x48038e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ec5f09..d08a3a1 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 _0x2ccd=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','api','moment','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ccd,0x1e6));var _0xd2cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ccd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd2cc('0x0'));var util=require(_0xd2cc('0x1'));var logger=require('../../config/logger')(_0xd2cc('0x2'));var moment=require(_0xd2cc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2cc('0x4'));var rimraf=require(_0xd2cc('0x5'));var config=require(_0xd2cc('0x6'));var attributes=require(_0xd2cc('0x7'));module[_0xd2cc('0x8')]=function(_0x242674,_0x8f4e39){return _0x242674[_0xd2cc('0x9')](_0xd2cc('0xa'),attributes,{'tableName':_0xd2cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x919d=['api','bluebird','path','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x5a83e7,_0x3185a7){var _0x3222b1=function(_0x2c9504){while(--_0x2c9504){_0x5a83e7['push'](_0x5a83e7['shift']());}};_0x3222b1(++_0x3185a7);}(_0x919d,0x1c0));var _0xd919=function(_0x43ab16,_0x203b3e){_0x43ab16=_0x43ab16-0x0;var _0x3a6a7a=_0x919d[_0x43ab16];return _0x3a6a7a;};'use strict';var _=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var logger=require(_0xd919('0x2'))(_0xd919('0x3'));var moment=require('moment');var BPromise=require(_0xd919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd919('0x6'));module[_0xd919('0x7')]=function(_0x5493fc,_0x495d7b){return _0x5493fc[_0xd919('0x8')](_0xd919('0x9'),attributes,{'tableName':_0xd919('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b85b8ce..ca61187 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 _0xbd50=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x1729c5,_0x3e8797){_0x1729c5=_0x1729c5-0x0;var _0x5b3d6c=_0xbd50[_0x1729c5];return _0x5b3d6c;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0x9567=['info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x13d5bc,_0x3fce3c){var _0x4b8a40=function(_0xe3ef3a){while(--_0xe3ef3a){_0x13d5bc['push'](_0x13d5bc['shift']());}};_0x4b8a40(++_0x3fce3c);}(_0x9567,0xdc));var _0x7956=function(_0x25ce90,_0x52a72a){_0x25ce90=_0x25ce90-0x0;var _0xf5f97a=_0x9567[_0x25ce90];return _0xf5f97a;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Tag,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 1a2f0ee..97325f2 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(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 987f42b..5191fe0 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 _0xe706=['STRING','sequelize','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe706,0xa3));var _0x6e70=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0xe706[_0x3b6f58];return _0x987c61;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3fc672,_0x4fad24){var _0x455d5a=function(_0x2a2dc1){while(--_0x2a2dc1){_0x3fc672['push'](_0x3fc672['shift']());}};_0x455d5a(++_0x4fad24);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3a42f55..f69be9c 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 _0x1d79=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Team','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Voice','Sms','Openchannel','Whatsapp','transaction','through','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','spread','removeAgents','Chat','Mail','Fax','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0x1d79,0x128));var _0x91d7=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1d79[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0x91d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91d7('0x1'));var jsonpatch=require(_0x91d7('0x2'));var rp=require(_0x91d7('0x3'));var moment=require(_0x91d7('0x4'));var BPromise=require(_0x91d7('0x5'));var Mustache=require(_0x91d7('0x6'));var util=require(_0x91d7('0x7'));var path=require(_0x91d7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x91d7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91d7('0xa'));var squel=require('squel');var crypto=require(_0x91d7('0xb'));var jsforce=require(_0x91d7('0xc'));var deskjs=require(_0x91d7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x91d7('0xe'));var Redis=require(_0x91d7('0xf'));var authService=require(_0x91d7('0x10'));var qs=require(_0x91d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x91d7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91d7('0x14'))['db'];config[_0x91d7('0x15')]=_[_0x91d7('0x16')](config[_0x91d7('0x15')],{'host':_0x91d7('0x17'),'port':0x18eb});var socket=require(_0x91d7('0x18'))(new Redis(config[_0x91d7('0x15')]));require(_0x91d7('0x19'))[_0x91d7('0x1a')](socket);function respondWithStatusCode(_0x59966b,_0x569b19){_0x569b19=_0x569b19||0xcc;return function(_0x134517){if(_0x134517){return _0x59966b[_0x91d7('0x1b')](_0x569b19);}return _0x59966b['status'](_0x569b19)[_0x91d7('0x1c')]();};}function respondWithResult(_0x482caf,_0x524466){_0x524466=_0x524466||0xc8;return function(_0x2a73e6){if(_0x2a73e6){return _0x482caf[_0x91d7('0x1d')](_0x524466)[_0x91d7('0x1e')](_0x2a73e6);}};}function respondWithFilteredResult(_0x595693,_0x31c3d9){return function(_0x47f913){if(_0x47f913){var _0x4c4ad3=typeof _0x31c3d9[_0x91d7('0x1f')]===_0x91d7('0x20')&&typeof _0x31c3d9[_0x91d7('0x21')]==='undefined';var _0x1ddb42=_0x47f913[_0x91d7('0x22')];var _0x5c74e5=_0x4c4ad3?0x0:_0x31c3d9[_0x91d7('0x1f')];var _0xc69207=_0x4c4ad3?_0x47f913['count']:_0x31c3d9[_0x91d7('0x1f')]+_0x31c3d9[_0x91d7('0x21')];var _0x41d41f;if(_0xc69207>=_0x1ddb42){_0xc69207=_0x1ddb42;_0x41d41f=0xc8;}else{_0x41d41f=0xce;}_0x595693[_0x91d7('0x1d')](_0x41d41f);return _0x595693[_0x91d7('0x23')](_0x91d7('0x24'),_0x5c74e5+'-'+_0xc69207+'/'+_0x1ddb42)[_0x91d7('0x1e')](_0x47f913);}return null;};}function patchUpdates(_0x3a399b){return function(_0x43526a){try{jsonpatch[_0x91d7('0x25')](_0x43526a,_0x3a399b,!![]);}catch(_0x427cb0){return BPromise[_0x91d7('0x26')](_0x427cb0);}return _0x43526a[_0x91d7('0x27')]();};}function saveUpdates(_0x3677b3,_0x7e7bdb){return function(_0x3948ed){if(_0x3948ed){return _0x3948ed[_0x91d7('0x28')](_0x3677b3)[_0x91d7('0x29')](function(_0x57b464){return _0x57b464;});}return null;};}function handleEntityNotFound(_0x419ee8,_0x3d6c3c){return function(_0x2523b7){if(!_0x2523b7){_0x419ee8[_0x91d7('0x1b')](0x194);}return _0x2523b7;};}function handleError(_0xbda44f,_0x177730){_0x177730=_0x177730||0x1f4;return function(_0x2753fc){logger[_0x91d7('0x2a')](_0x2753fc['stack']);if(_0x2753fc[_0x91d7('0x2b')]){delete _0x2753fc[_0x91d7('0x2b')];}_0xbda44f[_0x91d7('0x1d')](_0x177730)[_0x91d7('0x2c')](_0x2753fc);};}exports[_0x91d7('0x2d')]=function(_0x3247cc,_0x12ec6c){var _0x3b5fe5={},_0x3f76cf={},_0x249347={'count':0x0,'rows':[]};var _0x4820e9=_[_0x91d7('0x2e')](db[_0x91d7('0x2f')]['rawAttributes'],function(_0x55de06){return{'name':_0x55de06[_0x91d7('0x30')],'type':_0x55de06[_0x91d7('0x31')][_0x91d7('0x32')]};});_0x3f76cf[_0x91d7('0x33')]=_[_0x91d7('0x2e')](_0x4820e9,_0x91d7('0x2b'));_0x3f76cf[_0x91d7('0x34')]=_[_0x91d7('0x35')](_0x3247cc[_0x91d7('0x34')]);_0x3f76cf['filters']=_[_0x91d7('0x36')](_0x3f76cf['model'],_0x3f76cf[_0x91d7('0x34')]);_0x3b5fe5[_0x91d7('0x37')]=_[_0x91d7('0x36')](_0x3f76cf['model'],qs[_0x91d7('0x38')](_0x3247cc[_0x91d7('0x34')][_0x91d7('0x38')]));_0x3b5fe5[_0x91d7('0x37')]=_0x3b5fe5[_0x91d7('0x37')]['length']?_0x3b5fe5[_0x91d7('0x37')]:_0x3f76cf[_0x91d7('0x33')];if(!_0x3247cc[_0x91d7('0x34')]['hasOwnProperty'](_0x91d7('0x39'))){_0x3b5fe5[_0x91d7('0x21')]=qs['limit'](_0x3247cc[_0x91d7('0x34')][_0x91d7('0x21')]);_0x3b5fe5[_0x91d7('0x1f')]=qs[_0x91d7('0x1f')](_0x3247cc[_0x91d7('0x34')][_0x91d7('0x1f')]);}_0x3b5fe5[_0x91d7('0x3a')]=qs[_0x91d7('0x3b')](_0x3247cc['query'][_0x91d7('0x3b')]);_0x3b5fe5[_0x91d7('0x3c')]=qs[_0x91d7('0x3d')](_['pick'](_0x3247cc['query'],_0x3f76cf[_0x91d7('0x3d')]),_0x4820e9);if(_0x3247cc[_0x91d7('0x34')]['filter']){_0x3b5fe5['where']=_['merge'](_0x3b5fe5[_0x91d7('0x3c')],{'$or':_[_0x91d7('0x2e')](_0x4820e9,function(_0x59c909){if(_0x59c909['type']!==_0x91d7('0x3e')){var _0x47f050={};_0x47f050[_0x59c909[_0x91d7('0x2b')]]={'$like':'%'+_0x3247cc[_0x91d7('0x34')][_0x91d7('0x3f')]+'%'};return _0x47f050;}})});}_0x3b5fe5=_[_0x91d7('0x40')]({},_0x3b5fe5,_0x3247cc[_0x91d7('0x41')]);var _0x47cd1d={'where':_0x3b5fe5[_0x91d7('0x3c')]};return db['Team']['count'](_0x47cd1d)[_0x91d7('0x29')](function(_0x17f6d7){_0x249347[_0x91d7('0x22')]=_0x17f6d7;if(_0x3247cc[_0x91d7('0x34')]['includeAll']){_0x3b5fe5[_0x91d7('0x42')]=[{'all':!![]}];}return db[_0x91d7('0x2f')][_0x91d7('0x43')](_0x3b5fe5);})['then'](function(_0x537106){_0x249347[_0x91d7('0x44')]=_0x537106;return _0x249347;})[_0x91d7('0x29')](respondWithFilteredResult(_0x12ec6c,_0x3b5fe5))[_0x91d7('0x45')](handleError(_0x12ec6c,null));};exports[_0x91d7('0x46')]=function(_0x23c089,_0x499d86){var _0x43a7c0={'raw':![],'where':{'id':_0x23c089['params']['id']}},_0x2169f3={};_0x2169f3['model']=_[_0x91d7('0x35')](db[_0x91d7('0x2f')][_0x91d7('0x47')]);_0x2169f3[_0x91d7('0x34')]=_[_0x91d7('0x35')](_0x23c089[_0x91d7('0x34')]);_0x2169f3[_0x91d7('0x3d')]=_[_0x91d7('0x36')](_0x2169f3[_0x91d7('0x33')],_0x2169f3[_0x91d7('0x34')]);_0x43a7c0['attributes']=_[_0x91d7('0x36')](_0x2169f3['model'],qs[_0x91d7('0x38')](_0x23c089[_0x91d7('0x34')]['fields']));_0x43a7c0[_0x91d7('0x37')]=_0x43a7c0[_0x91d7('0x37')][_0x91d7('0x48')]?_0x43a7c0['attributes']:_0x2169f3[_0x91d7('0x33')];if(_0x23c089[_0x91d7('0x34')][_0x91d7('0x49')]){_0x43a7c0['include']=[{'all':!![]}];}_0x43a7c0=_['merge']({},_0x43a7c0,_0x23c089[_0x91d7('0x41')]);return db['Team'][_0x91d7('0x4a')](_0x43a7c0)[_0x91d7('0x29')](handleEntityNotFound(_0x499d86,null))[_0x91d7('0x29')](respondWithResult(_0x499d86,null))['catch'](handleError(_0x499d86,null));};exports[_0x91d7('0x4b')]=function(_0x2cc756,_0x178701){return db[_0x91d7('0x2f')][_0x91d7('0x4b')](_0x2cc756[_0x91d7('0x4c')],{})[_0x91d7('0x29')](function(_0x47602){var _0x4c0a5e=_0x2cc756[_0x91d7('0x4d')]['get']({'plain':!![]});if(!_0x4c0a5e)throw new Error(_0x91d7('0x4e'));if(_0x4c0a5e['role']===_0x91d7('0x4d')){var _0x5d4dfa=_0x47602[_0x91d7('0x4f')]({'plain':!![]});var _0x1c0672=_0x91d7('0x50');return db[_0x91d7('0x51')][_0x91d7('0x4a')]({'where':{'name':_0x1c0672,'userProfileId':_0x4c0a5e['userProfileId']},'raw':!![]})[_0x91d7('0x29')](function(_0x5a51a7){if(_0x5a51a7&&_0x5a51a7['autoAssociation']===0x0){return db[_0x91d7('0x52')]['create']({'name':_0x5d4dfa['name'],'resourceId':_0x5d4dfa['id'],'type':_0x5a51a7['name'],'sectionId':_0x5a51a7['id']},{})['then'](function(){return _0x47602;});}else{return _0x47602;}})[_0x91d7('0x45')](function(_0x1e1ca7){logger[_0x91d7('0x2a')](_0x91d7('0x53'),_0x1e1ca7);throw _0x1e1ca7;});}return _0x47602;})[_0x91d7('0x29')](respondWithResult(_0x178701,0xc9))[_0x91d7('0x45')](handleError(_0x178701,null));};exports['update']=function(_0x4e8e16,_0x405c3f){if(_0x4e8e16[_0x91d7('0x4c')]['id']){delete _0x4e8e16[_0x91d7('0x4c')]['id'];}return db[_0x91d7('0x2f')][_0x91d7('0x4a')]({'where':{'id':_0x4e8e16[_0x91d7('0x54')]['id']}})[_0x91d7('0x29')](handleEntityNotFound(_0x405c3f,null))['then'](saveUpdates(_0x4e8e16[_0x91d7('0x4c')],null))[_0x91d7('0x29')](respondWithResult(_0x405c3f,null))[_0x91d7('0x45')](handleError(_0x405c3f,null));};exports[_0x91d7('0x55')]=function(_0x2cfd02,_0x1cc210){var _0x3e897a=_0x2cfd02[_0x91d7('0x54')]['id'];var _0x49eea2=[];return db[_0x91d7('0x56')]['transaction'](function(_0x53f3f6){var _0x161e07='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x3e897a;return db[_0x91d7('0x56')]['query'](_0x161e07,{'type':db[_0x91d7('0x57')][_0x91d7('0x58')]['SELECT'],'raw':!![],'transaction':_0x53f3f6})[_0x91d7('0x29')](function(_0x3108b5){_0x49eea2=_['map'](_0x3108b5,function(_0x5428fb){return Number(_0x5428fb[_0x91d7('0x59')]);});})['then'](function(){var _0x15db85=_0x91d7('0x5a')+_0x3e897a;return db[_0x91d7('0x56')]['query'](_0x15db85,{'type':db['Sequelize'][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0x386d3d){var _0x15b1e9=_[_0x91d7('0x2e')](_0x386d3d,function(_0x42edad){return Number(_0x42edad[_0x91d7('0x5c')]);});return db['UserVoiceQueue'][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'VoiceQueueId':{'$in':_0x15b1e9}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){var _0x2457a4=_0x91d7('0x5d')+_0x3e897a;return db[_0x91d7('0x56')][_0x91d7('0x34')](_0x2457a4,{'type':db[_0x91d7('0x57')][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0x4b1bc3){var _0x24b505=_[_0x91d7('0x2e')](_0x4b1bc3,function(_0x30f90a){return Number(_0x30f90a['MailQueueId']);});return db[_0x91d7('0x5e')][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'MailQueueId':{'$in':_0x24b505}},'transaction':_0x53f3f6});})['then'](function(){var _0x5be5b3=_0x91d7('0x5f')+_0x3e897a;return db[_0x91d7('0x56')][_0x91d7('0x34')](_0x5be5b3,{'type':db[_0x91d7('0x57')][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0x24b2a7){var _0x58d350=_[_0x91d7('0x2e')](_0x24b2a7,function(_0x537d7f){return Number(_0x537d7f[_0x91d7('0x60')]);});return db[_0x91d7('0x61')][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'SmsQueueId':{'$in':_0x58d350}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){var _0x14d41b='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3e897a;return db[_0x91d7('0x56')]['query'](_0x14d41b,{'type':db[_0x91d7('0x57')][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})['then'](function(_0x24ec08){var _0x275474=_['map'](_0x24ec08,function(_0x3366b5){return Number(_0x3366b5[_0x91d7('0x62')]);});return db[_0x91d7('0x63')][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'ChatQueueId':{'$in':_0x275474}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){var _0x29357c=_0x91d7('0x64')+_0x3e897a;return db['sequelize'][_0x91d7('0x34')](_0x29357c,{'type':db[_0x91d7('0x57')]['QueryTypes'][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0xa36702){var _0xfa25d=_['map'](_0xa36702,function(_0x26e5a5){return Number(_0x26e5a5[_0x91d7('0x65')]);});return db[_0x91d7('0x66')][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'FaxQueueId':{'$in':_0xfa25d}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){var _0x55b398=_0x91d7('0x67')+_0x3e897a;return db['sequelize'][_0x91d7('0x34')](_0x55b398,{'type':db['Sequelize'][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0x47727c){var _0x589b29=_[_0x91d7('0x2e')](_0x47727c,function(_0x165da8){return Number(_0x165da8[_0x91d7('0x68')]);});return db[_0x91d7('0x69')]['destroy']({'where':{'UserId':{'$in':_0x49eea2},'OpenchannelQueueId':{'$in':_0x589b29}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){var _0x21307d=_0x91d7('0x6a')+_0x3e897a;return db['sequelize'][_0x91d7('0x34')](_0x21307d,{'type':db[_0x91d7('0x57')][_0x91d7('0x58')][_0x91d7('0x5b')],'raw':!![],'transaction':_0x53f3f6});})['then'](function(_0x47fe9b){var _0x1dcdfd=_[_0x91d7('0x2e')](_0x47fe9b,function(_0x1ac760){return Number(_0x1ac760['WhatsappQueueId']);});return db[_0x91d7('0x6b')][_0x91d7('0x55')]({'where':{'UserId':{'$in':_0x49eea2},'WhatsappQueueId':{'$in':_0x1dcdfd}},'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(){return db[_0x91d7('0x6c')][_0x91d7('0x4a')]({'where':{'TeamId':_0x3e897a}});})[_0x91d7('0x29')](function(_0x46fbe0){if(_0x46fbe0===null){return;}return db[_0x91d7('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x49eea2},'VoicePrefixId':_0x46fbe0[_0x91d7('0x6e')]},'transaction':_0x53f3f6});})['then'](function(){return db[_0x91d7('0x2f')]['destroy']({'where':{'id':_0x3e897a},'cascade':!![],'transaction':_0x53f3f6});})[_0x91d7('0x29')](function(_0x574a16){if(_0x574a16===0x0){_0x1cc210[_0x91d7('0x1b')](0x194);}else{return db[_0x91d7('0x52')]['destroy']({'where':{'type':_0x91d7('0x50'),'resourceId':_0x3e897a},'cascade':!![],'transaction':_0x53f3f6})['then'](function(){_0x1cc210['status'](0xcc)[_0x91d7('0x1c')]();});}})[_0x91d7('0x45')](function(_0x100249){_0x1cc210[_0x91d7('0x1d')](0x1f4)[_0x91d7('0x2c')](_0x100249);});});};exports[_0x91d7('0x6f')]=function(_0x3ef0da,_0x2e6c57,_0x167a37){return db[_0x91d7('0x2f')]['findOne']({'where':{'id':_0x3ef0da[_0x91d7('0x54')]['id']}})[_0x91d7('0x29')](handleEntityNotFound(_0x2e6c57,null))[_0x91d7('0x29')](function(_0x297f58){if(!_0x3ef0da[_0x91d7('0x34')][_0x91d7('0x70')]||!utils[_0x91d7('0x71')](_0x3ef0da[_0x91d7('0x34')][_0x91d7('0x70')])){throw new db[(_0x91d7('0x57'))][(_0x91d7('0x72'))](_0x91d7('0x73'));}var _0x1a2e56={};var _0x49d9bc={};_0x49d9bc['model']=_['keys'](db[_[_0x91d7('0x74')](_0x3ef0da[_0x91d7('0x34')][_0x91d7('0x70')][_0x91d7('0x75')]())+'Queue']['rawAttributes']);_0x49d9bc['query']=_['keys'](_0x3ef0da[_0x91d7('0x34')]);_0x49d9bc[_0x91d7('0x3d')]=_[_0x91d7('0x36')](_0x49d9bc[_0x91d7('0x33')],_0x49d9bc['query']);_0x1a2e56['attributes']=_[_0x91d7('0x36')](_0x49d9bc[_0x91d7('0x33')],qs['fields'](_0x3ef0da['query'][_0x91d7('0x38')]));_0x1a2e56['attributes']=_0x1a2e56[_0x91d7('0x37')][_0x91d7('0x48')]?_0x1a2e56[_0x91d7('0x37')]:_0x49d9bc['model'];_0x1a2e56[_0x91d7('0x21')]=qs[_0x91d7('0x21')](_0x3ef0da[_0x91d7('0x34')][_0x91d7('0x21')]);_0x1a2e56['offset']=qs['offset'](_0x3ef0da[_0x91d7('0x34')][_0x91d7('0x1f')]);_0x1a2e56['order']=qs[_0x91d7('0x3b')](_0x3ef0da['query'][_0x91d7('0x3b')]);_0x1a2e56[_0x91d7('0x3c')]=qs[_0x91d7('0x3d')](_[_0x91d7('0x76')](_0x3ef0da[_0x91d7('0x34')],_0x49d9bc[_0x91d7('0x3d')]));_0x1a2e56=_[_0x91d7('0x40')]({},_0x1a2e56,_0x3ef0da[_0x91d7('0x41')]);return _0x297f58[_0x91d7('0x4f')+_['capitalize'](_0x3ef0da['query'][_0x91d7('0x70')][_0x91d7('0x75')]())+_0x91d7('0x77')](_0x1a2e56);})[_0x91d7('0x29')](respondWithResult(_0x2e6c57,null))['catch'](handleError(_0x2e6c57,null));};exports[_0x91d7('0x78')]=function(_0x472ded,_0x3c9703,_0x361c81){return db[_0x91d7('0x2f')][_0x91d7('0x79')]({'where':{'id':_0x472ded[_0x91d7('0x54')]['id']}})['then'](function(_0x4ebeaa){if(_0x4ebeaa){if(!_0x472ded['body'][_0x91d7('0x70')]||!utils['isValidChannel'](_0x472ded[_0x91d7('0x4c')][_0x91d7('0x70')])){throw new db[(_0x91d7('0x57'))][(_0x91d7('0x72'))]('Unknown\x20channel');}return _0x4ebeaa[_0x91d7('0x7a')+_[_0x91d7('0x74')](_0x472ded[_0x91d7('0x4c')][_0x91d7('0x70')][_0x91d7('0x75')]())+'Queues'](_0x472ded[_0x91d7('0x4c')][_0x91d7('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x3c9703,null))['then'](respondWithStatusCode(_0x3c9703,null))[_0x91d7('0x45')](handleError(_0x3c9703,null));};exports[_0x91d7('0x7c')]=function(_0x39a865,_0x480146,_0x10c1a9){return db[_0x91d7('0x2f')][_0x91d7('0x79')]({'where':{'id':_0x39a865[_0x91d7('0x54')]['id']}})[_0x91d7('0x29')](function(_0x38892d){if(_0x38892d){if(!_0x39a865['query'][_0x91d7('0x70')]||!utils[_0x91d7('0x71')](_0x39a865[_0x91d7('0x34')][_0x91d7('0x70')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x38892d[_0x91d7('0x7d')+_[_0x91d7('0x74')](_0x39a865[_0x91d7('0x34')][_0x91d7('0x70')][_0x91d7('0x75')]())+_0x91d7('0x77')](_0x39a865[_0x91d7('0x34')][_0x91d7('0x7b')]);}return null;})[_0x91d7('0x29')](handleEntityNotFound(_0x480146,null))[_0x91d7('0x29')](respondWithStatusCode(_0x480146,null))[_0x91d7('0x45')](handleError(_0x480146,null));};exports[_0x91d7('0x7e')]=function(_0x1821e5,_0x3a3917){var _0x594f8e=_[_0x91d7('0x7f')](_0x1821e5['body'][_0x91d7('0x7b')])?_0x1821e5['body'][_0x91d7('0x7b')]:[_0x1821e5[_0x91d7('0x4c')][_0x91d7('0x7b')]];var _0x350767=_0x1821e5[_0x91d7('0x54')]['id'];return db[_0x91d7('0x2f')][_0x91d7('0x4a')]({'where':{'id':_0x350767}})['then'](handleEntityNotFound(_0x3a3917,null))[_0x91d7('0x29')](function(_0x593231){if(_0x593231){var _0x39c4d4=[_0x91d7('0x80'),'Chat','Mail',_0x91d7('0x81'),'Fax',_0x91d7('0x82'),_0x91d7('0x83')];return db[_0x91d7('0x56')][_0x91d7('0x84')](function(_0x187be3){var _0x364812=_[_0x91d7('0x2e')](_0x39c4d4,function(_0x1339c4){var _0x1bc4de={'attributes':['id','name']};if(_0x1339c4==='Voice'){_0x1bc4de[_0x91d7('0x85')]={'attributes':['penalty']};}return _0x593231['get'+_0x1339c4+_0x91d7('0x77')](_0x1bc4de)[_0x91d7('0x29')](function(_0x1973a0){var _0x2a5b4b=_[_0x91d7('0x2e')](_0x1973a0,function(_0x19c544){var _0x28d9c7=_['map'](_0x594f8e,function(_0x2ff462){var _0x3665e4={'where':{'UserId':_0x2ff462,[_0x1339c4+'QueueId']:_0x19c544['id']},'transaction':_0x187be3};if(_0x1339c4===_0x91d7('0x80')){_0x3665e4['defaults']={'penalty':_0x19c544[_0x91d7('0x86')][_0x91d7('0x87')]};}return db[_0x91d7('0x88')+_0x1339c4+'Queue'][_0x91d7('0x89')](_0x3665e4)['then'](function(){socket['emit'](_0x91d7('0x4d')+_0x1339c4+_0x91d7('0x8a'),{'UserId':_0x2ff462,[_0x1339c4+_0x91d7('0x8b')]:_0x19c544['id']});if(_0x1339c4!=='Voice'){return;}return db[_0x91d7('0x88')][_0x91d7('0x43')]({'where':{'id':_0x594f8e,'online':0x1},'attributes':['id','name',_0x91d7('0x8c'),_0x91d7('0x8d'),_0x91d7('0x8e')],'raw':!![]})[_0x91d7('0x29')](function(_0x1c364b){var _0x5c0e7b=_[_0x91d7('0x2e')](_0x1c364b,function(_0x4a4fd9){return db[_0x91d7('0x8f')]['upsert']({'membername':_0x4a4fd9[_0x91d7('0x2b')],'UserId':_0x4a4fd9['id'],'queue_name':_0x19c544[_0x91d7('0x2b')],'VoiceQueueId':_0x19c544['id'],'interface':_[_0x91d7('0x90')](_0x4a4fd9[_0x91d7('0x8e')])?util[_0x91d7('0x91')](_0x91d7('0x92'),_0x4a4fd9[_0x91d7('0x2b')]):_0x4a4fd9[_0x91d7('0x8e')],'paused':_0x4a4fd9['voicePause']||![],'penalty':_0x19c544[_0x91d7('0x86')][_0x91d7('0x87')]},{'transaction':_0x187be3});});return Promise[_0x91d7('0x93')](_0x5c0e7b);});});});return Promise[_0x91d7('0x93')](_0x28d9c7);});return Promise[_0x91d7('0x93')](_0x2a5b4b);})[_0x91d7('0x29')](function(){return db['TeamVoicePrefix'][_0x91d7('0x79')]({'where':{'teamId':_0x350767}})[_0x91d7('0x29')](function(_0x2f9727){if(_0x2f9727){var _0x1f2b48=_[_0x91d7('0x2e')](_0x594f8e,function(_0x3f6d85){db[_0x91d7('0x6d')][_0x91d7('0x94')]({'UserId':_0x3f6d85,'VoicePrefixId':_0x2f9727['VoicePrefixId']});});return Promise[_0x91d7('0x93')](_0x1f2b48);}});});});return Promise[_0x91d7('0x93')](_0x364812)[_0x91d7('0x29')](function(){return _0x593231[_0x91d7('0x7e')](_0x594f8e,{'transaction':_0x187be3})[_0x91d7('0x95')](function(_0x1fb70b){return _0x1fb70b;});});});}})['then'](respondWithResult(_0x3a3917,null))[_0x91d7('0x45')](handleError(_0x3a3917,null));};exports[_0x91d7('0x96')]=function(_0x37cde6,_0x3957c0){var _0x26a80d=_['isArray'](_0x37cde6[_0x91d7('0x34')][_0x91d7('0x7b')])?_0x37cde6[_0x91d7('0x34')][_0x91d7('0x7b')]:[_0x37cde6['query'][_0x91d7('0x7b')]];var _0x241b98=_0x37cde6['params']['id'];return db['Team'][_0x91d7('0x4a')]({'where':{'id':_0x241b98}})[_0x91d7('0x29')](handleEntityNotFound(_0x3957c0,null))[_0x91d7('0x29')](function(_0x2c3e10){if(_0x2c3e10){var _0x5b040a=[_0x91d7('0x80'),_0x91d7('0x97'),_0x91d7('0x98'),'Sms',_0x91d7('0x99'),_0x91d7('0x82'),_0x91d7('0x83')];return db[_0x91d7('0x56')][_0x91d7('0x84')](function(_0x421d9c){var _0x5c843b=_[_0x91d7('0x2e')](_0x5b040a,function(_0x176833){var _0x5ca93c={'attributes':['id',_0x91d7('0x2b')]};return _0x2c3e10['get'+_0x176833+'Queues'](_0x5ca93c)[_0x91d7('0x29')](function(_0x380c1c){var _0x25c7f6=_[_0x91d7('0x2e')](_0x380c1c,function(_0x1d0d7e){return _0x1d0d7e[_0x91d7('0x96')](_0x26a80d,{'transaction':_0x421d9c})[_0x91d7('0x29')](function(){var _0x365bac=_[_0x91d7('0x2e')](_0x26a80d,function(_0x3fd0ba){socket['emit'](_0x91d7('0x4d')+_0x176833+_0x91d7('0x9a'),{'UserId':Number(_0x3fd0ba),[_0x176833+_0x91d7('0x8b')]:_0x1d0d7e['id']});if(_0x176833!==_0x91d7('0x80')){return;}return db[_0x91d7('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x1d0d7e['id'],'UserId':_0x3fd0ba},'transaction':_0x421d9c});});return Promise[_0x91d7('0x93')](_0x365bac);});});return Promise[_0x91d7('0x93')](_0x25c7f6);});});return Promise['all'](_0x5c843b)[_0x91d7('0x29')](function(){return _0x2c3e10['removeAgents'](_0x26a80d,{'transaction':_0x421d9c});})[_0x91d7('0x29')](function(){return db[_0x91d7('0x6c')][_0x91d7('0x79')]({'where':{'teamId':_0x241b98}})[_0x91d7('0x29')](function(_0x347b65){if(_0x347b65){var _0x155dbe=_[_0x91d7('0x2e')](_0x26a80d,function(_0x42ef6c){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x42ef6c,'VoicePrefixId':_0x347b65[_0x91d7('0x6e')]}});});return Promise[_0x91d7('0x93')](_0x155dbe);}});});});}})['then'](respondWithStatusCode(_0x3957c0,null))['catch'](handleError(_0x3957c0,null));};exports[_0x91d7('0x9b')]=function(_0x28e879,_0x55866c,_0x4205e1){var _0x1b2bda={};var _0x230bde={};var _0x439071;var _0x14542f;return db[_0x91d7('0x2f')][_0x91d7('0x79')]({'where':{'id':_0x28e879[_0x91d7('0x54')]['id']}})[_0x91d7('0x29')](handleEntityNotFound(_0x55866c,null))[_0x91d7('0x29')](function(_0x45df6e){if(_0x45df6e){_0x439071=_0x45df6e;_0x230bde[_0x91d7('0x33')]=_[_0x91d7('0x35')](db[_0x91d7('0x88')][_0x91d7('0x47')]);_0x230bde[_0x91d7('0x34')]=_[_0x91d7('0x35')](_0x28e879[_0x91d7('0x34')]);_0x230bde['filters']=_['intersection'](_0x230bde[_0x91d7('0x33')],_0x230bde['query']);_0x1b2bda[_0x91d7('0x37')]=_[_0x91d7('0x36')](_0x230bde[_0x91d7('0x33')],qs[_0x91d7('0x38')](_0x28e879[_0x91d7('0x34')][_0x91d7('0x38')]));_0x1b2bda['attributes']=_0x1b2bda[_0x91d7('0x37')][_0x91d7('0x48')]?_0x1b2bda[_0x91d7('0x37')]:_0x230bde[_0x91d7('0x33')];_0x1b2bda[_0x91d7('0x3a')]=qs['sort'](_0x28e879[_0x91d7('0x34')][_0x91d7('0x3b')]);_0x1b2bda[_0x91d7('0x3c')]=qs[_0x91d7('0x3d')](_[_0x91d7('0x76')](_0x28e879[_0x91d7('0x34')],_0x230bde[_0x91d7('0x3d')]));if(_0x28e879[_0x91d7('0x34')][_0x91d7('0x3f')]){_0x1b2bda[_0x91d7('0x3c')]=_[_0x91d7('0x40')](_0x1b2bda[_0x91d7('0x3c')],{'$or':_[_0x91d7('0x2e')](_0x1b2bda['attributes'],function(_0x3f5877){var _0x464a6d={};_0x464a6d[_0x3f5877]={'$like':'%'+_0x28e879['query']['filter']+'%'};return _0x464a6d;})});}_0x1b2bda=_[_0x91d7('0x40')]({},_0x1b2bda,_0x28e879[_0x91d7('0x41')]);return _0x439071['getAgents'](_0x1b2bda);}})[_0x91d7('0x29')](function(_0x7b9208){if(_0x7b9208){_0x14542f=_0x7b9208[_0x91d7('0x48')];if(!_0x28e879[_0x91d7('0x34')]['hasOwnProperty'](_0x91d7('0x39'))){_0x1b2bda[_0x91d7('0x21')]=qs['limit'](_0x28e879[_0x91d7('0x34')]['limit']);_0x1b2bda[_0x91d7('0x1f')]=qs[_0x91d7('0x1f')](_0x28e879[_0x91d7('0x34')][_0x91d7('0x1f')]);}return _0x439071[_0x91d7('0x9b')](_0x1b2bda);}})[_0x91d7('0x29')](function(_0x5c2d70){if(_0x5c2d70){return _0x5c2d70?{'count':_0x14542f,'rows':_0x5c2d70}:null;}})['then'](respondWithResult(_0x55866c,null))[_0x91d7('0x45')](handleError(_0x55866c,null));}; \ No newline at end of file +var _0x10a0=['find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','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','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','defaults','TeamVoiceQueue','penalty','findOrCreate','Queue:save','QueueId','User','voicePause','isNil','interface','format','SIP/%s','all','upsert','spread','removeAgents','Whatsapp','emit','Queue:remove','UserVoiceQueueRt','getAgents','rimraf','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Team','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection'];(function(_0x326904,_0x485428){var _0x412db7=function(_0x4177b2){while(--_0x4177b2){_0x326904['push'](_0x326904['shift']());}};_0x412db7(++_0x485428);}(_0x10a0,0x17d));var _0x010a=function(_0x4a258b,_0xb0006c){_0x4a258b=_0x4a258b-0x0;var _0x5ea6dc=_0x10a0[_0x4a258b];return _0x5ea6dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x010a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x010a('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x010a('0x2'));var sox=require('sox');var csv=require(_0x010a('0x3'));var ejs=require(_0x010a('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x010a('0x5'));var squel=require(_0x010a('0x6'));var crypto=require(_0x010a('0x7'));var jsforce=require(_0x010a('0x8'));var deskjs=require(_0x010a('0x9'));var toCsv=require(_0x010a('0x3'));var querystring=require(_0x010a('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x010a('0xb'));var qs=require(_0x010a('0xc'));var as=require(_0x010a('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x010a('0xe'))('api');var utils=require(_0x010a('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x010a('0x10'));var db=require(_0x010a('0x11'))['db'];config['redis']=_['defaults'](config[_0x010a('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x010a('0x13'))(new Redis(config[_0x010a('0x12')]));require(_0x010a('0x14'))[_0x010a('0x15')](socket);function respondWithStatusCode(_0x42cbf2,_0x9902f){_0x9902f=_0x9902f||0xcc;return function(_0x3e63c4){if(_0x3e63c4){return _0x42cbf2[_0x010a('0x16')](_0x9902f);}return _0x42cbf2[_0x010a('0x17')](_0x9902f)[_0x010a('0x18')]();};}function respondWithResult(_0xd3d755,_0x1aeeae){_0x1aeeae=_0x1aeeae||0xc8;return function(_0x56dc4d){if(_0x56dc4d){return _0xd3d755[_0x010a('0x17')](_0x1aeeae)[_0x010a('0x19')](_0x56dc4d);}};}function respondWithFilteredResult(_0x561e3f,_0xf8e85c){return function(_0x2ed8b8){if(_0x2ed8b8){var _0x166c6d=typeof _0xf8e85c[_0x010a('0x1a')]===_0x010a('0x1b')&&typeof _0xf8e85c[_0x010a('0x1c')]===_0x010a('0x1b');var _0x4f8686=_0x2ed8b8[_0x010a('0x1d')];var _0x42c0c5=_0x166c6d?0x0:_0xf8e85c['offset'];var _0x4b6018=_0x166c6d?_0x2ed8b8[_0x010a('0x1d')]:_0xf8e85c[_0x010a('0x1a')]+_0xf8e85c[_0x010a('0x1c')];var _0x36d84a;if(_0x4b6018>=_0x4f8686){_0x4b6018=_0x4f8686;_0x36d84a=0xc8;}else{_0x36d84a=0xce;}_0x561e3f[_0x010a('0x17')](_0x36d84a);return _0x561e3f[_0x010a('0x1e')](_0x010a('0x1f'),_0x42c0c5+'-'+_0x4b6018+'/'+_0x4f8686)[_0x010a('0x19')](_0x2ed8b8);}return null;};}function patchUpdates(_0x170b8b){return function(_0x42f27c){try{jsonpatch[_0x010a('0x20')](_0x42f27c,_0x170b8b,!![]);}catch(_0x4f4997){return BPromise[_0x010a('0x21')](_0x4f4997);}return _0x42f27c[_0x010a('0x22')]();};}function saveUpdates(_0x5dbe30,_0x32d615){return function(_0x11cbb6){if(_0x11cbb6){return _0x11cbb6[_0x010a('0x23')](_0x5dbe30)[_0x010a('0x24')](function(_0x334601){return _0x334601;});}return null;};}function handleEntityNotFound(_0x2ddb44,_0xc34cd6){return function(_0xa45fd5){if(!_0xa45fd5){_0x2ddb44['sendStatus'](0x194);}return _0xa45fd5;};}function handleError(_0x4a75dd,_0x465ec9){_0x465ec9=_0x465ec9||0x1f4;return function(_0x675dec){logger['error'](_0x675dec[_0x010a('0x25')]);if(_0x675dec[_0x010a('0x26')]){delete _0x675dec[_0x010a('0x26')];}_0x4a75dd[_0x010a('0x17')](_0x465ec9)[_0x010a('0x27')](_0x675dec);};}exports[_0x010a('0x28')]=function(_0x5969ad,_0x1e369c){var _0x4f277a={},_0x8a9118={},_0x123dba={'count':0x0,'rows':[]};var _0x2de7a7=_[_0x010a('0x29')](db[_0x010a('0x2a')]['rawAttributes'],function(_0x56da6d){return{'name':_0x56da6d['fieldName'],'type':_0x56da6d[_0x010a('0x2b')][_0x010a('0x2c')]};});_0x8a9118[_0x010a('0x2d')]=_[_0x010a('0x29')](_0x2de7a7,_0x010a('0x26'));_0x8a9118[_0x010a('0x2e')]=_['keys'](_0x5969ad[_0x010a('0x2e')]);_0x8a9118[_0x010a('0x2f')]=_[_0x010a('0x30')](_0x8a9118['model'],_0x8a9118[_0x010a('0x2e')]);_0x4f277a['attributes']=_['intersection'](_0x8a9118[_0x010a('0x2d')],qs[_0x010a('0x31')](_0x5969ad[_0x010a('0x2e')][_0x010a('0x31')]));_0x4f277a[_0x010a('0x32')]=_0x4f277a['attributes'][_0x010a('0x33')]?_0x4f277a[_0x010a('0x32')]:_0x8a9118[_0x010a('0x2d')];if(!_0x5969ad[_0x010a('0x2e')][_0x010a('0x34')](_0x010a('0x35'))){_0x4f277a['limit']=qs['limit'](_0x5969ad['query']['limit']);_0x4f277a['offset']=qs[_0x010a('0x1a')](_0x5969ad[_0x010a('0x2e')][_0x010a('0x1a')]);}_0x4f277a[_0x010a('0x36')]=qs[_0x010a('0x37')](_0x5969ad['query'][_0x010a('0x37')]);_0x4f277a[_0x010a('0x38')]=qs[_0x010a('0x2f')](_[_0x010a('0x39')](_0x5969ad[_0x010a('0x2e')],_0x8a9118[_0x010a('0x2f')]),_0x2de7a7);if(_0x5969ad[_0x010a('0x2e')][_0x010a('0x3a')]){_0x4f277a[_0x010a('0x38')]=_[_0x010a('0x3b')](_0x4f277a[_0x010a('0x38')],{'$or':_[_0x010a('0x29')](_0x2de7a7,function(_0x58492e){if(_0x58492e[_0x010a('0x2b')]!==_0x010a('0x3c')){var _0x3509b4={};_0x3509b4[_0x58492e['name']]={'$like':'%'+_0x5969ad['query']['filter']+'%'};return _0x3509b4;}})});}_0x4f277a=_[_0x010a('0x3b')]({},_0x4f277a,_0x5969ad[_0x010a('0x3d')]);var _0x58316a={'where':_0x4f277a[_0x010a('0x38')]};return db[_0x010a('0x2a')][_0x010a('0x1d')](_0x58316a)[_0x010a('0x24')](function(_0x34d8c9){_0x123dba[_0x010a('0x1d')]=_0x34d8c9;if(_0x5969ad[_0x010a('0x2e')][_0x010a('0x3e')]){_0x4f277a[_0x010a('0x3f')]=[{'all':!![]}];}return db['Team'][_0x010a('0x40')](_0x4f277a);})[_0x010a('0x24')](function(_0x2bcee6){_0x123dba[_0x010a('0x41')]=_0x2bcee6;return _0x123dba;})[_0x010a('0x24')](respondWithFilteredResult(_0x1e369c,_0x4f277a))[_0x010a('0x42')](handleError(_0x1e369c,null));};exports[_0x010a('0x43')]=function(_0x585136,_0x1daf33){var _0x231ec0={'raw':![],'where':{'id':_0x585136['params']['id']}},_0x59f8b4={};_0x59f8b4[_0x010a('0x2d')]=_[_0x010a('0x44')](db['Team'][_0x010a('0x45')]);_0x59f8b4[_0x010a('0x2e')]=_['keys'](_0x585136[_0x010a('0x2e')]);_0x59f8b4[_0x010a('0x2f')]=_[_0x010a('0x30')](_0x59f8b4[_0x010a('0x2d')],_0x59f8b4['query']);_0x231ec0[_0x010a('0x32')]=_[_0x010a('0x30')](_0x59f8b4['model'],qs[_0x010a('0x31')](_0x585136[_0x010a('0x2e')][_0x010a('0x31')]));_0x231ec0[_0x010a('0x32')]=_0x231ec0['attributes'][_0x010a('0x33')]?_0x231ec0['attributes']:_0x59f8b4[_0x010a('0x2d')];if(_0x585136[_0x010a('0x2e')]['includeAll']){_0x231ec0[_0x010a('0x3f')]=[{'all':!![]}];}_0x231ec0=_[_0x010a('0x3b')]({},_0x231ec0,_0x585136[_0x010a('0x3d')]);return db[_0x010a('0x2a')]['find'](_0x231ec0)[_0x010a('0x24')](handleEntityNotFound(_0x1daf33,null))[_0x010a('0x24')](respondWithResult(_0x1daf33,null))['catch'](handleError(_0x1daf33,null));};exports[_0x010a('0x46')]=function(_0x2e6c29,_0x209c15){return db['Team'][_0x010a('0x46')](_0x2e6c29[_0x010a('0x47')],{})['then'](function(_0x43e337){var _0x560209=_0x2e6c29[_0x010a('0x48')]['get']({'plain':!![]});if(!_0x560209)throw new Error(_0x010a('0x49'));if(_0x560209[_0x010a('0x4a')]===_0x010a('0x48')){var _0x1cc47b=_0x43e337[_0x010a('0x4b')]({'plain':!![]});var _0x270027=_0x010a('0x4c');return db[_0x010a('0x4d')][_0x010a('0x4e')]({'where':{'name':_0x270027,'userProfileId':_0x560209['userProfileId']},'raw':!![]})[_0x010a('0x24')](function(_0x5bdd9b){if(_0x5bdd9b&&_0x5bdd9b[_0x010a('0x4f')]===0x0){return db[_0x010a('0x50')][_0x010a('0x46')]({'name':_0x1cc47b['name'],'resourceId':_0x1cc47b['id'],'type':_0x5bdd9b['name'],'sectionId':_0x5bdd9b['id']},{})['then'](function(){return _0x43e337;});}else{return _0x43e337;}})[_0x010a('0x42')](function(_0x5a042c){logger[_0x010a('0x51')](_0x010a('0x52'),_0x5a042c);throw _0x5a042c;});}return _0x43e337;})['then'](respondWithResult(_0x209c15,0xc9))[_0x010a('0x42')](handleError(_0x209c15,null));};exports[_0x010a('0x23')]=function(_0x21ccf3,_0x178f50){if(_0x21ccf3[_0x010a('0x47')]['id']){delete _0x21ccf3['body']['id'];}return db[_0x010a('0x2a')][_0x010a('0x4e')]({'where':{'id':_0x21ccf3[_0x010a('0x53')]['id']}})[_0x010a('0x24')](handleEntityNotFound(_0x178f50,null))['then'](saveUpdates(_0x21ccf3[_0x010a('0x47')],null))[_0x010a('0x24')](respondWithResult(_0x178f50,null))['catch'](handleError(_0x178f50,null));};exports[_0x010a('0x54')]=function(_0x4446a7,_0x212255){var _0x1c7222=_0x4446a7[_0x010a('0x53')]['id'];var _0x426812=[];return db[_0x010a('0x55')][_0x010a('0x56')](function(_0x46b597){var _0x2ecccd=_0x010a('0x57')+_0x1c7222;return db[_0x010a('0x55')]['query'](_0x2ecccd,{'type':db['Sequelize']['QueryTypes'][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597})[_0x010a('0x24')](function(_0x1024c7){_0x426812=_[_0x010a('0x29')](_0x1024c7,function(_0x2ce944){return Number(_0x2ce944[_0x010a('0x59')]);});})[_0x010a('0x24')](function(){var _0xbfff3f=_0x010a('0x5a')+_0x1c7222;return db[_0x010a('0x55')][_0x010a('0x2e')](_0xbfff3f,{'type':db[_0x010a('0x5b')]['QueryTypes'][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x131870){var _0x4f7559=_[_0x010a('0x29')](_0x131870,function(_0x37a3f1){return Number(_0x37a3f1['VoiceQueueId']);});return db[_0x010a('0x5c')][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'VoiceQueueId':{'$in':_0x4f7559}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x55123d=_0x010a('0x5d')+_0x1c7222;return db['sequelize']['query'](_0x55123d,{'type':db['Sequelize'][_0x010a('0x5e')][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})['then'](function(_0x36e3ea){var _0x228943=_[_0x010a('0x29')](_0x36e3ea,function(_0x3e8290){return Number(_0x3e8290[_0x010a('0x5f')]);});return db['UserMailQueue'][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'MailQueueId':{'$in':_0x228943}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x42776b=_0x010a('0x60')+_0x1c7222;return db[_0x010a('0x55')][_0x010a('0x2e')](_0x42776b,{'type':db['Sequelize'][_0x010a('0x5e')][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x1b0f9d){var _0x3b17c3=_['map'](_0x1b0f9d,function(_0x3ce85a){return Number(_0x3ce85a[_0x010a('0x61')]);});return db[_0x010a('0x62')]['destroy']({'where':{'UserId':{'$in':_0x426812},'SmsQueueId':{'$in':_0x3b17c3}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x2a9097=_0x010a('0x63')+_0x1c7222;return db[_0x010a('0x55')][_0x010a('0x2e')](_0x2a9097,{'type':db['Sequelize']['QueryTypes'][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x1e425d){var _0x4ffb17=_[_0x010a('0x29')](_0x1e425d,function(_0x463ce2){return Number(_0x463ce2[_0x010a('0x64')]);});return db['UserChatQueue'][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'ChatQueueId':{'$in':_0x4ffb17}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x5ddff4=_0x010a('0x65')+_0x1c7222;return db[_0x010a('0x55')][_0x010a('0x2e')](_0x5ddff4,{'type':db['Sequelize'][_0x010a('0x5e')][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x3c8b17){var _0x1b249e=_['map'](_0x3c8b17,function(_0xdec9bb){return Number(_0xdec9bb[_0x010a('0x66')]);});return db[_0x010a('0x67')][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'FaxQueueId':{'$in':_0x1b249e}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x3faf4c='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1c7222;return db[_0x010a('0x55')]['query'](_0x3faf4c,{'type':db[_0x010a('0x5b')][_0x010a('0x5e')][_0x010a('0x58')],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x272efe){var _0xdac422=_[_0x010a('0x29')](_0x272efe,function(_0xba44c){return Number(_0xba44c[_0x010a('0x68')]);});return db['UserOpenchannelQueue'][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'OpenchannelQueueId':{'$in':_0xdac422}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){var _0x292483=_0x010a('0x69')+_0x1c7222;return db[_0x010a('0x55')][_0x010a('0x2e')](_0x292483,{'type':db[_0x010a('0x5b')][_0x010a('0x5e')]['SELECT'],'raw':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x1651d0){var _0xcdcf0c=_[_0x010a('0x29')](_0x1651d0,function(_0x451f07){return Number(_0x451f07['WhatsappQueueId']);});return db[_0x010a('0x6a')][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'WhatsappQueueId':{'$in':_0xcdcf0c}},'transaction':_0x46b597});})[_0x010a('0x24')](function(){return db[_0x010a('0x6b')][_0x010a('0x4e')]({'where':{'TeamId':_0x1c7222}});})[_0x010a('0x24')](function(_0x5ab628){if(_0x5ab628===null){return;}return db[_0x010a('0x6c')][_0x010a('0x54')]({'where':{'UserId':{'$in':_0x426812},'VoicePrefixId':_0x5ab628[_0x010a('0x6d')]},'transaction':_0x46b597});})[_0x010a('0x24')](function(){return db[_0x010a('0x2a')][_0x010a('0x54')]({'where':{'id':_0x1c7222},'cascade':!![],'transaction':_0x46b597});})[_0x010a('0x24')](function(_0x3cee0d){if(_0x3cee0d===0x0){_0x212255[_0x010a('0x16')](0x194);}else{return db[_0x010a('0x50')][_0x010a('0x54')]({'where':{'type':'Teams','resourceId':_0x1c7222},'cascade':!![],'transaction':_0x46b597})[_0x010a('0x24')](function(){_0x212255[_0x010a('0x17')](0xcc)['end']();});}})[_0x010a('0x42')](function(_0x36f6f6){_0x212255[_0x010a('0x17')](0x1f4)[_0x010a('0x27')](_0x36f6f6);});});};exports[_0x010a('0x6e')]=function(_0x122a6b,_0x588196,_0x80eaa6){return db[_0x010a('0x2a')][_0x010a('0x6f')]({'where':{'id':_0x122a6b[_0x010a('0x53')]['id']}})['then'](handleEntityNotFound(_0x588196,null))[_0x010a('0x24')](function(_0xecf2ee){if(!_0x122a6b[_0x010a('0x2e')][_0x010a('0x70')]||!utils['isValidChannel'](_0x122a6b[_0x010a('0x2e')][_0x010a('0x70')])){throw new db[(_0x010a('0x5b'))][(_0x010a('0x71'))](_0x010a('0x72'));}var _0x58a07d={};var _0x2bc3fa={};_0x2bc3fa[_0x010a('0x2d')]=_[_0x010a('0x44')](db[_[_0x010a('0x73')](_0x122a6b['query'][_0x010a('0x70')][_0x010a('0x74')]())+_0x010a('0x75')][_0x010a('0x45')]);_0x2bc3fa[_0x010a('0x2e')]=_[_0x010a('0x44')](_0x122a6b[_0x010a('0x2e')]);_0x2bc3fa[_0x010a('0x2f')]=_[_0x010a('0x30')](_0x2bc3fa['model'],_0x2bc3fa[_0x010a('0x2e')]);_0x58a07d[_0x010a('0x32')]=_[_0x010a('0x30')](_0x2bc3fa[_0x010a('0x2d')],qs[_0x010a('0x31')](_0x122a6b[_0x010a('0x2e')][_0x010a('0x31')]));_0x58a07d[_0x010a('0x32')]=_0x58a07d['attributes'][_0x010a('0x33')]?_0x58a07d[_0x010a('0x32')]:_0x2bc3fa[_0x010a('0x2d')];_0x58a07d[_0x010a('0x1c')]=qs[_0x010a('0x1c')](_0x122a6b[_0x010a('0x2e')]['limit']);_0x58a07d[_0x010a('0x1a')]=qs[_0x010a('0x1a')](_0x122a6b[_0x010a('0x2e')][_0x010a('0x1a')]);_0x58a07d[_0x010a('0x36')]=qs['sort'](_0x122a6b['query'][_0x010a('0x37')]);_0x58a07d['where']=qs[_0x010a('0x2f')](_[_0x010a('0x39')](_0x122a6b[_0x010a('0x2e')],_0x2bc3fa[_0x010a('0x2f')]));_0x58a07d=_[_0x010a('0x3b')]({},_0x58a07d,_0x122a6b['options']);return _0xecf2ee[_0x010a('0x4b')+_[_0x010a('0x73')](_0x122a6b[_0x010a('0x2e')]['channel'][_0x010a('0x74')]())+_0x010a('0x76')](_0x58a07d);})[_0x010a('0x24')](respondWithResult(_0x588196,null))['catch'](handleError(_0x588196,null));};exports[_0x010a('0x77')]=function(_0x55ea83,_0x559a1e,_0x32198b){return db['Team']['findOne']({'where':{'id':_0x55ea83[_0x010a('0x53')]['id']}})[_0x010a('0x24')](function(_0x284505){if(_0x284505){if(!_0x55ea83[_0x010a('0x47')]['channel']||!utils[_0x010a('0x78')](_0x55ea83[_0x010a('0x47')]['channel'])){throw new db[(_0x010a('0x5b'))][(_0x010a('0x71'))](_0x010a('0x72'));}return _0x284505[_0x010a('0x79')+_[_0x010a('0x73')](_0x55ea83[_0x010a('0x47')][_0x010a('0x70')][_0x010a('0x74')]())+'Queues'](_0x55ea83[_0x010a('0x47')][_0x010a('0x7a')]);}return null;})[_0x010a('0x24')](handleEntityNotFound(_0x559a1e,null))[_0x010a('0x24')](respondWithStatusCode(_0x559a1e,null))[_0x010a('0x42')](handleError(_0x559a1e,null));};exports[_0x010a('0x7b')]=function(_0x19c723,_0x55d1f9,_0xa576b){return db[_0x010a('0x2a')][_0x010a('0x6f')]({'where':{'id':_0x19c723[_0x010a('0x53')]['id']}})[_0x010a('0x24')](function(_0x1ee3a4){if(_0x1ee3a4){if(!_0x19c723['query'][_0x010a('0x70')]||!utils[_0x010a('0x78')](_0x19c723['query'][_0x010a('0x70')])){throw new db[(_0x010a('0x5b'))][(_0x010a('0x71'))](_0x010a('0x72'));}return _0x1ee3a4[_0x010a('0x7c')+_[_0x010a('0x73')](_0x19c723['query'][_0x010a('0x70')]['toLowerCase']())+_0x010a('0x76')](_0x19c723[_0x010a('0x2e')][_0x010a('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x55d1f9,null))['then'](respondWithStatusCode(_0x55d1f9,null))[_0x010a('0x42')](handleError(_0x55d1f9,null));};exports[_0x010a('0x7d')]=function(_0x3bdc8e,_0x5eca3f){var _0xfad2f=_[_0x010a('0x7e')](_0x3bdc8e[_0x010a('0x47')][_0x010a('0x7a')])?_0x3bdc8e[_0x010a('0x47')][_0x010a('0x7a')]:[_0x3bdc8e['body'][_0x010a('0x7a')]];var _0x14f32e=_0x3bdc8e[_0x010a('0x53')]['id'];return db[_0x010a('0x2a')]['find']({'where':{'id':_0x14f32e}})[_0x010a('0x24')](handleEntityNotFound(_0x5eca3f,null))[_0x010a('0x24')](function(_0x512a7f){if(_0x512a7f){var _0x55fb63=[_0x010a('0x7f'),'Chat',_0x010a('0x80'),_0x010a('0x81'),_0x010a('0x82'),_0x010a('0x83'),'Whatsapp'];return db['sequelize'][_0x010a('0x56')](function(_0x3a4f45){var _0x548789=_[_0x010a('0x29')](_0x55fb63,function(_0x2ebfc1){var _0x141c49={'attributes':['id',_0x010a('0x26')]};if(_0x2ebfc1===_0x010a('0x7f')){_0x141c49['through']={'attributes':['penalty']};}return _0x512a7f[_0x010a('0x4b')+_0x2ebfc1+_0x010a('0x76')](_0x141c49)[_0x010a('0x24')](function(_0xc30336){var _0x40da09=_[_0x010a('0x29')](_0xc30336,function(_0x191385){var _0x5e66e1=_['map'](_0xfad2f,function(_0x4e47cc){var _0x290cc0={'where':{'UserId':_0x4e47cc,[_0x2ebfc1+'QueueId']:_0x191385['id']},'transaction':_0x3a4f45};if(_0x2ebfc1===_0x010a('0x7f')){_0x290cc0[_0x010a('0x84')]={'penalty':_0x191385[_0x010a('0x85')][_0x010a('0x86')]};}return db['User'+_0x2ebfc1+'Queue'][_0x010a('0x87')](_0x290cc0)[_0x010a('0x24')](function(){socket['emit']('user'+_0x2ebfc1+_0x010a('0x88'),{'UserId':_0x4e47cc,[_0x2ebfc1+_0x010a('0x89')]:_0x191385['id']});if(_0x2ebfc1!==_0x010a('0x7f')){return;}return db[_0x010a('0x8a')]['findAll']({'where':{'id':_0xfad2f,'online':0x1},'attributes':['id','name','online',_0x010a('0x8b'),'interface'],'raw':!![]})['then'](function(_0x163cd2){var _0x4a3be2=_[_0x010a('0x29')](_0x163cd2,function(_0x510c3b){return db['UserVoiceQueueRt']['upsert']({'membername':_0x510c3b['name'],'UserId':_0x510c3b['id'],'queue_name':_0x191385[_0x010a('0x26')],'VoiceQueueId':_0x191385['id'],'interface':_[_0x010a('0x8c')](_0x510c3b[_0x010a('0x8d')])?util[_0x010a('0x8e')](_0x010a('0x8f'),_0x510c3b[_0x010a('0x26')]):_0x510c3b[_0x010a('0x8d')],'paused':_0x510c3b['voicePause']||![],'penalty':_0x191385[_0x010a('0x85')][_0x010a('0x86')]},{'transaction':_0x3a4f45});});return Promise[_0x010a('0x90')](_0x4a3be2);});});});return Promise['all'](_0x5e66e1);});return Promise['all'](_0x40da09);})[_0x010a('0x24')](function(){return db['TeamVoicePrefix'][_0x010a('0x6f')]({'where':{'teamId':_0x14f32e}})[_0x010a('0x24')](function(_0x38cfaf){if(_0x38cfaf){var _0x25d338=_[_0x010a('0x29')](_0xfad2f,function(_0x349ce8){db['UserVoicePrefix'][_0x010a('0x91')]({'UserId':_0x349ce8,'VoicePrefixId':_0x38cfaf[_0x010a('0x6d')]});});return Promise[_0x010a('0x90')](_0x25d338);}});});});return Promise[_0x010a('0x90')](_0x548789)['then'](function(){return _0x512a7f['addAgents'](_0xfad2f,{'transaction':_0x3a4f45})[_0x010a('0x92')](function(_0x5791cc){return _0x5791cc;});});});}})[_0x010a('0x24')](respondWithResult(_0x5eca3f,null))[_0x010a('0x42')](handleError(_0x5eca3f,null));};exports[_0x010a('0x93')]=function(_0x339ef1,_0x4cbc8a){var _0x5b5f6d=_[_0x010a('0x7e')](_0x339ef1[_0x010a('0x2e')]['ids'])?_0x339ef1[_0x010a('0x2e')][_0x010a('0x7a')]:[_0x339ef1[_0x010a('0x2e')][_0x010a('0x7a')]];var _0xd43fc1=_0x339ef1[_0x010a('0x53')]['id'];return db[_0x010a('0x2a')][_0x010a('0x4e')]({'where':{'id':_0xd43fc1}})['then'](handleEntityNotFound(_0x4cbc8a,null))[_0x010a('0x24')](function(_0x3e45a9){if(_0x3e45a9){var _0x38900c=[_0x010a('0x7f'),'Chat','Mail',_0x010a('0x81'),_0x010a('0x82'),'Openchannel',_0x010a('0x94')];return db[_0x010a('0x55')][_0x010a('0x56')](function(_0x41a14e){var _0x198738=_[_0x010a('0x29')](_0x38900c,function(_0x3464f2){var _0x3dd33c={'attributes':['id',_0x010a('0x26')]};return _0x3e45a9[_0x010a('0x4b')+_0x3464f2+_0x010a('0x76')](_0x3dd33c)[_0x010a('0x24')](function(_0x23d27c){var _0x37d6ee=_[_0x010a('0x29')](_0x23d27c,function(_0x1750f3){return _0x1750f3[_0x010a('0x93')](_0x5b5f6d,{'transaction':_0x41a14e})[_0x010a('0x24')](function(){var _0x53af33=_['map'](_0x5b5f6d,function(_0x55e1ef){socket[_0x010a('0x95')](_0x010a('0x48')+_0x3464f2+_0x010a('0x96'),{'UserId':Number(_0x55e1ef),[_0x3464f2+'QueueId']:_0x1750f3['id']});if(_0x3464f2!==_0x010a('0x7f')){return;}return db[_0x010a('0x97')][_0x010a('0x54')]({'where':{'VoiceQueueId':_0x1750f3['id'],'UserId':_0x55e1ef},'transaction':_0x41a14e});});return Promise['all'](_0x53af33);});});return Promise['all'](_0x37d6ee);});});return Promise[_0x010a('0x90')](_0x198738)['then'](function(){return _0x3e45a9[_0x010a('0x93')](_0x5b5f6d,{'transaction':_0x41a14e});})[_0x010a('0x24')](function(){return db[_0x010a('0x6b')][_0x010a('0x6f')]({'where':{'teamId':_0xd43fc1}})[_0x010a('0x24')](function(_0x1686e0){if(_0x1686e0){var _0x44297f=_[_0x010a('0x29')](_0x5b5f6d,function(_0x3d260b){db[_0x010a('0x6c')]['destroy']({'where':{'UserId':_0x3d260b,'VoicePrefixId':_0x1686e0[_0x010a('0x6d')]}});});return Promise[_0x010a('0x90')](_0x44297f);}});});});}})[_0x010a('0x24')](respondWithStatusCode(_0x4cbc8a,null))[_0x010a('0x42')](handleError(_0x4cbc8a,null));};exports[_0x010a('0x98')]=function(_0x55d263,_0x854e20,_0x2efd7d){var _0x5ec585={};var _0x2b4653={};var _0x520347;var _0x40d921;return db[_0x010a('0x2a')][_0x010a('0x6f')]({'where':{'id':_0x55d263[_0x010a('0x53')]['id']}})[_0x010a('0x24')](handleEntityNotFound(_0x854e20,null))[_0x010a('0x24')](function(_0x5a1177){if(_0x5a1177){_0x520347=_0x5a1177;_0x2b4653[_0x010a('0x2d')]=_[_0x010a('0x44')](db[_0x010a('0x8a')][_0x010a('0x45')]);_0x2b4653[_0x010a('0x2e')]=_[_0x010a('0x44')](_0x55d263['query']);_0x2b4653[_0x010a('0x2f')]=_[_0x010a('0x30')](_0x2b4653[_0x010a('0x2d')],_0x2b4653[_0x010a('0x2e')]);_0x5ec585[_0x010a('0x32')]=_[_0x010a('0x30')](_0x2b4653[_0x010a('0x2d')],qs[_0x010a('0x31')](_0x55d263['query'][_0x010a('0x31')]));_0x5ec585['attributes']=_0x5ec585[_0x010a('0x32')][_0x010a('0x33')]?_0x5ec585[_0x010a('0x32')]:_0x2b4653['model'];_0x5ec585[_0x010a('0x36')]=qs['sort'](_0x55d263[_0x010a('0x2e')]['sort']);_0x5ec585[_0x010a('0x38')]=qs[_0x010a('0x2f')](_[_0x010a('0x39')](_0x55d263['query'],_0x2b4653[_0x010a('0x2f')]));if(_0x55d263[_0x010a('0x2e')][_0x010a('0x3a')]){_0x5ec585[_0x010a('0x38')]=_[_0x010a('0x3b')](_0x5ec585['where'],{'$or':_[_0x010a('0x29')](_0x5ec585[_0x010a('0x32')],function(_0x1f8955){var _0x2d5472={};_0x2d5472[_0x1f8955]={'$like':'%'+_0x55d263[_0x010a('0x2e')][_0x010a('0x3a')]+'%'};return _0x2d5472;})});}_0x5ec585=_[_0x010a('0x3b')]({},_0x5ec585,_0x55d263['options']);return _0x520347[_0x010a('0x98')](_0x5ec585);}})[_0x010a('0x24')](function(_0x1a797b){if(_0x1a797b){_0x40d921=_0x1a797b[_0x010a('0x33')];if(!_0x55d263['query']['hasOwnProperty']('nolimit')){_0x5ec585[_0x010a('0x1c')]=qs['limit'](_0x55d263[_0x010a('0x2e')][_0x010a('0x1c')]);_0x5ec585[_0x010a('0x1a')]=qs['offset'](_0x55d263[_0x010a('0x2e')][_0x010a('0x1a')]);}return _0x520347['getAgents'](_0x5ec585);}})[_0x010a('0x24')](function(_0x3ef4fb){if(_0x3ef4fb){return _0x3ef4fb?{'count':_0x40d921,'rows':_0x3ef4fb}:null;}})[_0x010a('0x24')](respondWithResult(_0x854e20,null))[_0x010a('0x42')](handleError(_0x854e20,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 23850b8..1744633 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 _0x25fe=['../../mysqldb','setMaxListeners','remove','emit','hook','events'];(function(_0x4d8554,_0x547575){var _0x1c75a8=function(_0x5a4bb1){while(--_0x5a4bb1){_0x4d8554['push'](_0x4d8554['shift']());}};_0x1c75a8(++_0x547575);}(_0x25fe,0xfb));var _0xe25f=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x25fe[_0x256422];return _0x55dddc;};'use strict';var EventEmitter=require(_0xe25f('0x0'));var Team=require(_0xe25f('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe25f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe25f('0x3')};function emitEvent(_0x1231b1){return function(_0x23d55e,_0x18e947,_0x1eb02f){TeamEvents['emit'](_0x1231b1+':'+_0x23d55e['id'],_0x23d55e);TeamEvents[_0xe25f('0x4')](_0x1231b1,_0x23d55e);_0x1eb02f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xe25f('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x6e73=['remove','hasOwnProperty','hook','events','Team'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e73,0xd0));var _0x36e7=function(_0x239c82,_0x5a5749){_0x239c82=_0x239c82-0x0;var _0x2dc5c6=_0x6e73[_0x239c82];return _0x2dc5c6;};'use strict';var EventEmitter=require(_0x36e7('0x0'));var Team=require('../../mysqldb')['db'][_0x36e7('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x36e7('0x2')};function emitEvent(_0x30045c){return function(_0x1cf0da,_0x4da2f6,_0x231b49){TeamEvents['emit'](_0x30045c+':'+_0x1cf0da['id'],_0x1cf0da);TeamEvents['emit'](_0x30045c,_0x1cf0da);_0x231b49(null);};}for(var e in events){if(events[_0x36e7('0x3')](e)){var event=events[e];Team[_0x36e7('0x4')](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 b018dd0..1d464ba 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 _0xc5b3=['Fax','Sms','Voice','all','lodash','Queues','then','map','setDataValue','channel','exports','define','Team','teams'];(function(_0x1450c6,_0x4d4610){var _0x45bd8f=function(_0x4bb4cc){while(--_0x4bb4cc){_0x1450c6['push'](_0x1450c6['shift']());}};_0x45bd8f(++_0x4d4610);}(_0xc5b3,0xba));var _0x3c5b=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xc5b3[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0x3c5b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x2ea175,_0x13c0e1){var _0x5601f0='get'+_0x13c0e1+_0x3c5b('0x1');return _0x2ea175[_0x5601f0]()[_0x3c5b('0x2')](function(_0x31f2a1){return _[_0x3c5b('0x3')](_0x31f2a1,function(_0x2c0f6a){_0x2c0f6a[_0x3c5b('0x4')](_0x3c5b('0x5'),_0x13c0e1);return _0x2c0f6a;});})['catch'](function(_0x4ff998){throw _0x4ff998;});}module[_0x3c5b('0x6')]=function(_0x58b548){return _0x58b548[_0x3c5b('0x7')](_0x3c5b('0x8'),attributes,{'tableName':_0x3c5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x85071=this;var _0x5be7e3=['Chat',_0x3c5b('0xa'),'Mail','Openchannel',_0x3c5b('0xb'),_0x3c5b('0xc'),'Whatsapp'];return Promise['resolve']()[_0x3c5b('0x2')](function(){var _0x3b066e=_[_0x3c5b('0x3')](_0x5be7e3,function(_0x2d4b11){return getQueuesByChannel(_0x85071,_0x2d4b11);});return Promise[_0x3c5b('0xd')](_0x3b066e);})['catch'](function(_0x3675b0){throw _0x3675b0;});}}});}; \ No newline at end of file +var _0xda47=['Queues','then','map','setDataValue','channel','catch','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','all','lodash','get'];(function(_0x5bef1e,_0x209bd4){var _0x5420a5=function(_0x119c92){while(--_0x119c92){_0x5bef1e['push'](_0x5bef1e['shift']());}};_0x5420a5(++_0x209bd4);}(_0xda47,0xa3));var _0x7da4=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xda47[_0x515283];return _0x38f836;};'use strict';var _=require(_0x7da4('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x121db6,_0x30fc53){var _0x183300=_0x7da4('0x1')+_0x30fc53+_0x7da4('0x2');return _0x121db6[_0x183300]()[_0x7da4('0x3')](function(_0x1f32b0){return _[_0x7da4('0x4')](_0x1f32b0,function(_0x1f640b){_0x1f640b[_0x7da4('0x5')](_0x7da4('0x6'),_0x30fc53);return _0x1f640b;});})[_0x7da4('0x7')](function(_0xa22b7d){throw _0xa22b7d;});}module['exports']=function(_0x321f95){return _0x321f95['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x447ce4=this;var _0x5c0ce1=[_0x7da4('0x8'),_0x7da4('0x9'),'Mail',_0x7da4('0xa'),_0x7da4('0xb'),_0x7da4('0xc'),_0x7da4('0xd')];return Promise['resolve']()['then'](function(){var _0xadbd22=_[_0x7da4('0x4')](_0x5c0ce1,function(_0x3941c7){return getQueuesByChannel(_0x447ce4,_0x3941c7);});return Promise[_0x7da4('0xe')](_0xadbd22);})[_0x7da4('0x7')](function(_0x3a73ea){throw _0x3a73ea;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f6d3c82..3113d6b 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 _0x2403=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x2403,0x1b3));var _0x3240=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2403[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3240('0x0'));var util=require(_0x3240('0x1'));var moment=require(_0x3240('0x2'));var BPromise=require(_0x3240('0x3'));var rs=require(_0x3240('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3240('0x5'));var logger=require(_0x3240('0x6'))(_0x3240('0x7'));var config=require(_0x3240('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3240('0x9')][_0x3240('0xa')]({'port':0x232a});config[_0x3240('0xb')]=_[_0x3240('0xc')](config[_0x3240('0xb')],{'host':_0x3240('0xd'),'port':0x18eb});var socket=require(_0x3240('0xe'))(new Redis(config[_0x3240('0xb')]));require(_0x3240('0xf'))[_0x3240('0x10')](socket);function respondWithRpcPromise(_0x5ebe0d,_0x33be41,_0x56f1b0){return new BPromise(function(_0xa84059,_0x308e08){return client[_0x3240('0x11')](_0x5ebe0d,_0x56f1b0)[_0x3240('0x12')](function(_0x5cdd98){logger[_0x3240('0x13')](_0x3240('0x14'),_0x33be41,_0x3240('0x15'));logger[_0x3240('0x16')](_0x3240('0x17'),_0x33be41,'request\x20sent',JSON[_0x3240('0x18')](_0x5cdd98));if(_0x5cdd98['error']){if(_0x5cdd98[_0x3240('0x19')][_0x3240('0x1a')]===0x1f4){logger[_0x3240('0x19')](_0x3240('0x14'),_0x33be41,_0x5cdd98[_0x3240('0x19')][_0x3240('0x1b')]);return _0x308e08(_0x5cdd98[_0x3240('0x19')][_0x3240('0x1b')]);}logger[_0x3240('0x19')](_0x3240('0x14'),_0x33be41,_0x5cdd98[_0x3240('0x19')]['message']);return _0xa84059(_0x5cdd98[_0x3240('0x19')]['message']);}else{logger[_0x3240('0x13')](_0x3240('0x14'),_0x33be41,'request\x20sent');_0xa84059(_0x5cdd98['result'][_0x3240('0x1b')]);}})[_0x3240('0x1c')](function(_0x20d95c){logger[_0x3240('0x19')](_0x3240('0x14'),_0x33be41,_0x20d95c);_0x308e08(_0x20d95c);});});} \ No newline at end of file +var _0xd5d0=['./team.socket','register','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xd5d0,0x153));var _0x0d5d=function(_0x5b2bb8,_0xcd9faa){_0x5b2bb8=_0x5b2bb8-0x0;var _0x3d402c=_0xd5d0[_0x5b2bb8];return _0x3d402c;};'use strict';var _=require(_0x0d5d('0x0'));var util=require('util');var moment=require(_0x0d5d('0x1'));var BPromise=require(_0x0d5d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d5d('0x3'));var db=require(_0x0d5d('0x4'))['db'];var utils=require(_0x0d5d('0x5'));var logger=require('../../config/logger')(_0x0d5d('0x6'));var config=require(_0x0d5d('0x7'));var jayson=require(_0x0d5d('0x8'));var client=jayson['client'][_0x0d5d('0x9')]({'port':0x232a});config[_0x0d5d('0xa')]=_['defaults'](config[_0x0d5d('0xa')],{'host':_0x0d5d('0xb'),'port':0x18eb});var socket=require(_0x0d5d('0xc'))(new Redis(config['redis']));require(_0x0d5d('0xd'))[_0x0d5d('0xe')](socket);function respondWithRpcPromise(_0x227db4,_0x55de40,_0x3d23d9){return new BPromise(function(_0x239e36,_0xbab54f){return client['request'](_0x227db4,_0x3d23d9)['then'](function(_0x5e9bb3){logger['info']('Team,\x20%s,\x20%s',_0x55de40,_0x0d5d('0xf'));logger['debug'](_0x0d5d('0x10'),_0x55de40,_0x0d5d('0xf'),JSON['stringify'](_0x5e9bb3));if(_0x5e9bb3[_0x0d5d('0x11')]){if(_0x5e9bb3[_0x0d5d('0x11')][_0x0d5d('0x12')]===0x1f4){logger['error'](_0x0d5d('0x13'),_0x55de40,_0x5e9bb3[_0x0d5d('0x11')][_0x0d5d('0x14')]);return _0xbab54f(_0x5e9bb3[_0x0d5d('0x11')]['message']);}logger[_0x0d5d('0x11')](_0x0d5d('0x13'),_0x55de40,_0x5e9bb3[_0x0d5d('0x11')][_0x0d5d('0x14')]);return _0x239e36(_0x5e9bb3[_0x0d5d('0x11')][_0x0d5d('0x14')]);}else{logger[_0x0d5d('0x15')]('Team,\x20%s,\x20%s',_0x55de40,_0x0d5d('0xf'));_0x239e36(_0x5e9bb3['result']['message']);}})['catch'](function(_0x2e22b5){logger['error'](_0x0d5d('0x13'),_0x55de40,_0x2e22b5);_0xbab54f(_0x2e22b5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d588677..7f736bf 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 _0xc36a=['./team.events','save','update','register'];(function(_0x3083a0,_0x2462cb){var _0x168244=function(_0x62a88e){while(--_0x62a88e){_0x3083a0['push'](_0x3083a0['shift']());}};_0x168244(++_0x2462cb);}(_0xc36a,0x180));var _0xac36=function(_0x24f9f4,_0x860120){_0x24f9f4=_0x24f9f4-0x0;var _0x5e9a19=_0xc36a[_0x24f9f4];return _0x5e9a19;};'use strict';var TeamEvents=require(_0xac36('0x0'));var events=[_0xac36('0x1'),'remove',_0xac36('0x2')];function createListener(_0x480745,_0x14ab53){return function(_0x27911c){_0x14ab53['emit'](_0x480745,_0x27911c);};}function removeListener(_0x4f5294,_0x4fc41e){return function(){TeamEvents['removeListener'](_0x4f5294,_0x4fc41e);};}exports[_0xac36('0x3')]=function(_0xf828e9){for(var _0x42d539=0x0,_0xa2f50e=events['length'];_0x42d539<_0xa2f50e;_0x42d539++){var _0x5b8700=events[_0x42d539];var _0xe6d230=createListener('team:'+_0x5b8700,_0xf828e9);TeamEvents['on'](_0x5b8700,_0xe6d230);}}; \ No newline at end of file +var _0xda54=['team:','./team.events','save','remove','update','length'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xda54,0xa3));var _0x4da5=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xda54[_0x45c48f];return _0xaf5037;};'use strict';var TeamEvents=require(_0x4da5('0x0'));var events=[_0x4da5('0x1'),_0x4da5('0x2'),_0x4da5('0x3')];function createListener(_0x4da958,_0x4efc2e){return function(_0x272671){_0x4efc2e['emit'](_0x4da958,_0x272671);};}function removeListener(_0x1ad3ac,_0x494c73){return function(){TeamEvents['removeListener'](_0x1ad3ac,_0x494c73);};}exports['register']=function(_0x419789){for(var _0x5bbbcb=0x0,_0x411ab8=events[_0x4da5('0x4')];_0x5bbbcb<_0x411ab8;_0x5bbbcb++){var _0x57d34c=events[_0x5bbbcb];var _0x3246de=createListener(_0x4da5('0x5')+_0x57d34c,_0x419789);TeamEvents['on'](_0x57d34c,_0x3246de);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6e29e66..8937fd3 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 _0x3d76=['INTEGER','sequelize','exports'];(function(_0x5130aa,_0x441b77){var _0x125ec6=function(_0x4d3bf2){while(--_0x4d3bf2){_0x5130aa['push'](_0x5130aa['shift']());}};_0x125ec6(++_0x441b77);}(_0x3d76,0x13c));var _0x63d7=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x3d76[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x63d7('0x0'));module[_0x63d7('0x1')]={'TeamId':{'type':Sequelize[_0x63d7('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x63d7('0x2')]}}; \ No newline at end of file +var _0xe644=['sequelize','exports','INTEGER'];(function(_0x468fc4,_0x501001){var _0x3704ba=function(_0x2e1966){while(--_0x2e1966){_0x468fc4['push'](_0x468fc4['shift']());}};_0x3704ba(++_0x501001);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e64('0x0'));module[_0x4e64('0x1')]={'TeamId':{'type':Sequelize[_0x4e64('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4e64('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e0c9dcd..66d0f3a 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 _0x9f4d=['moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','lodash','util','../../config/logger','api'];(function(_0x157363,_0x43e87b){var _0x25dd68=function(_0xfc7f6c){while(--_0xfc7f6c){_0x157363['push'](_0x157363['shift']());}};_0x25dd68(++_0x43e87b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0x9f4d[_0x177cc9];return _0x2fe577;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))(_0xd9f4('0x3'));var moment=require(_0xd9f4('0x4'));var BPromise=require(_0xd9f4('0x5'));var rp=require(_0xd9f4('0x6'));var fs=require('fs');var path=require(_0xd9f4('0x7'));var rimraf=require(_0xd9f4('0x8'));var config=require('../../config/environment');var attributes=require(_0xd9f4('0x9'));module['exports']=function(_0x3d521d,_0x3ebf1b){return _0x3d521d[_0xd9f4('0xa')](_0xd9f4('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e22=['moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','util','api'];(function(_0x17c7c5,_0x9fd9c8){var _0xb2dd19=function(_0x4887b2){while(--_0x4887b2){_0x17c7c5['push'](_0x17c7c5['shift']());}};_0xb2dd19(++_0x9fd9c8);}(_0x3e22,0xa8));var _0x23e2=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x3e22[_0x12a2a6];return _0x1754ae;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var logger=require('../../config/logger')(_0x23e2('0x1'));var moment=require(_0x23e2('0x2'));var BPromise=require(_0x23e2('0x3'));var rp=require(_0x23e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23e2('0x5'));var attributes=require(_0x23e2('0x6'));module['exports']=function(_0x287f8f,_0x433a85){return _0x287f8f[_0x23e2('0x7')](_0x23e2('0x8'),attributes,{'tableName':_0x23e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index a42d5ea..c217034 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(_0x3fc942,_0x528909){var _0x29e4c4=function(_0x5c7dee){while(--_0x5c7dee){_0x3fc942['push'](_0x3fc942['shift']());}};_0x29e4c4(++_0x528909);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xcb91[_0x3aaf0a];return _0x33e6bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b8eb6,_0xe23a2f){var _0x14afec=function(_0x45b634){while(--_0x45b634){_0x3b8eb6['push'](_0x3b8eb6['shift']());}};_0x14afec(++_0xe23a2f);}(_0xe706,0xa3));var _0x6e70=function(_0x3e2435,_0xc531a1){_0x3e2435=_0x3e2435-0x0;var _0x5d49e7=_0xe706[_0x3e2435];return _0x5d49e7;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 4599fe1..9bb271a 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 _0xd90b=['sequelize'];(function(_0x16168a,_0x47974c){var _0x35316d=function(_0x3ad457){while(--_0x3ad457){_0x16168a['push'](_0x16168a['shift']());}};_0x35316d(++_0x47974c);}(_0xd90b,0xbd));var _0xbd90=function(_0x364b9d,_0x2b8682){_0x364b9d=_0x364b9d-0x0;var _0x490404=_0xd90b[_0x364b9d];return _0x490404;};'use strict';var Sequelize=require(_0xbd90('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7cd7=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd7,0xdd));var _0x77cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x77cd('0x0'));module[_0x77cd('0x1')]={'penalty':{'type':Sequelize[_0x77cd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 5bd015c..bb828fb 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 _0x4f5d=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x135dc0,_0x5ac0e2){var _0x469cb1=function(_0x4bd018){while(--_0x4bd018){_0x135dc0['push'](_0x135dc0['shift']());}};_0x469cb1(++_0x5ac0e2);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4f5d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash'];(function(_0x151567,_0x490047){var _0x1245fb=function(_0x9a3cbf){while(--_0x9a3cbf){_0x151567['push'](_0x151567['shift']());}};_0x1245fb(++_0x490047);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7deb('0x0'));var util=require(_0x7deb('0x1'));var logger=require(_0x7deb('0x2'))('api');var moment=require(_0x7deb('0x3'));var BPromise=require(_0x7deb('0x4'));var rp=require(_0x7deb('0x5'));var fs=require('fs');var path=require(_0x7deb('0x6'));var rimraf=require(_0x7deb('0x7'));var config=require('../../config/environment');var attributes=require(_0x7deb('0x8'));module[_0x7deb('0x9')]=function(_0x9283e7,_0x46e08e){return _0x9283e7[_0x7deb('0xa')](_0x7deb('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index cf16e94..9f0fb7e 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 _0xa461=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1546c2,_0x22e822){var _0x24583c=function(_0x3906f8){while(--_0x3906f8){_0x1546c2['push'](_0x1546c2['shift']());}};_0x24583c(++_0x22e822);}(_0xa461,0x1f2));var _0x1a46=function(_0x81121,_0x11bf0a){_0x81121=_0x81121-0x0;var _0x2cbc97=_0xa461[_0x81121];return _0x2cbc97;};'use strict';var _=require(_0x1a46('0x0'));var util=require(_0x1a46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a46('0x2'));var fs=require('fs');var Redis=require(_0x1a46('0x3'));var db=require(_0x1a46('0x4'))['db'];var utils=require(_0x1a46('0x5'));var logger=require(_0x1a46('0x6'))(_0x1a46('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a46('0x8'));var client=jayson[_0x1a46('0x9')][_0x1a46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1328a2,_0x408d4a,_0x31747e){return new BPromise(function(_0x5a2abe,_0x4a8c5a){return client[_0x1a46('0xb')](_0x1328a2,_0x31747e)[_0x1a46('0xc')](function(_0x153bc2){logger[_0x1a46('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x408d4a,_0x1a46('0xe'));logger[_0x1a46('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x408d4a,'request\x20sent',JSON[_0x1a46('0x10')](_0x153bc2));if(_0x153bc2[_0x1a46('0x11')]){if(_0x153bc2['error'][_0x1a46('0x12')]===0x1f4){logger[_0x1a46('0x11')](_0x1a46('0x13'),_0x408d4a,_0x153bc2[_0x1a46('0x11')]['message']);return _0x4a8c5a(_0x153bc2[_0x1a46('0x11')][_0x1a46('0x14')]);}logger[_0x1a46('0x11')](_0x1a46('0x13'),_0x408d4a,_0x153bc2[_0x1a46('0x11')]['message']);return _0x5a2abe(_0x153bc2['error'][_0x1a46('0x14')]);}else{logger[_0x1a46('0xd')](_0x1a46('0x13'),_0x408d4a,_0x1a46('0xe'));_0x5a2abe(_0x153bc2[_0x1a46('0x15')][_0x1a46('0x14')]);}})[_0x1a46('0x16')](function(_0x3cac57){logger[_0x1a46('0x11')](_0x1a46('0x13'),_0x408d4a,_0x3cac57);_0x4a8c5a(_0x3cac57);});});} \ No newline at end of file +var _0x599f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5c559a,_0x51274c){var _0x399ffb=function(_0x537e4c){while(--_0x537e4c){_0x5c559a['push'](_0x5c559a['shift']());}};_0x399ffb(++_0x51274c);}(_0x599f,0x74));var _0xf599=function(_0x12fdbe,_0x204796){_0x12fdbe=_0x12fdbe-0x0;var _0x38a758=_0x599f[_0x12fdbe];return _0x38a758;};'use strict';var _=require(_0xf599('0x0'));var util=require(_0xf599('0x1'));var moment=require(_0xf599('0x2'));var BPromise=require(_0xf599('0x3'));var rs=require(_0xf599('0x4'));var fs=require('fs');var Redis=require(_0xf599('0x5'));var db=require(_0xf599('0x6'))['db'];var utils=require(_0xf599('0x7'));var logger=require(_0xf599('0x8'))(_0xf599('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf599('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8cb1,_0x151d22,_0x45f97e){return new BPromise(function(_0x3c49e9,_0xf79222){return client[_0xf599('0xb')](_0x4b8cb1,_0x45f97e)[_0xf599('0xc')](function(_0x116bb9){logger[_0xf599('0xd')](_0xf599('0xe'),_0x151d22,'request\x20sent');logger[_0xf599('0xf')](_0xf599('0x10'),_0x151d22,_0xf599('0x11'),JSON[_0xf599('0x12')](_0x116bb9));if(_0x116bb9[_0xf599('0x13')]){if(_0x116bb9[_0xf599('0x13')][_0xf599('0x14')]===0x1f4){logger['error'](_0xf599('0xe'),_0x151d22,_0x116bb9['error']['message']);return _0xf79222(_0x116bb9['error']['message']);}logger[_0xf599('0x13')](_0xf599('0xe'),_0x151d22,_0x116bb9[_0xf599('0x13')]['message']);return _0x3c49e9(_0x116bb9['error'][_0xf599('0x15')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x151d22,_0xf599('0x11'));_0x3c49e9(_0x116bb9[_0xf599('0x16')]['message']);}})[_0xf599('0x17')](function(_0x17e544){logger[_0xf599('0x13')](_0xf599('0xe'),_0x151d22,_0x17e544);_0xf79222(_0x17e544);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 386893c..6b8059b 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 _0x3646=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x6d5061,_0x3ea5be){var _0x598ad1=function(_0x3afa66){while(--_0x3afa66){_0x6d5061['push'](_0x6d5061['shift']());}};_0x598ad1(++_0x3ea5be);}(_0x3646,0x15f));var _0x6364=function(_0x361bcd,_0x1833a2){_0x361bcd=_0x361bcd-0x0;var _0x10e6da=_0x3646[_0x361bcd];return _0x10e6da;};'use strict';var multer=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var path=require(_0x6364('0x2'));var timeout=require(_0x6364('0x3'));var express=require('express');var router=express[_0x6364('0x4')]();var fs_extra=require(_0x6364('0x5'));var auth=require(_0x6364('0x6'));var interaction=require(_0x6364('0x7'));var config=require(_0x6364('0x8'));var controller=require(_0x6364('0x9'));router[_0x6364('0xa')]('/',auth[_0x6364('0xb')](),controller[_0x6364('0xc')]);router[_0x6364('0xa')](_0x6364('0xd'),auth['isAuthenticated'](),controller[_0x6364('0xe')]);router[_0x6364('0xf')]('/',auth[_0x6364('0xb')](),controller[_0x6364('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6364('0x11')]);router[_0x6364('0x12')](_0x6364('0xd'),auth[_0x6364('0xb')](),controller[_0x6364('0x13')]);module[_0x6364('0x14')]=router; \ No newline at end of file +var _0xb511=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x4ad0e9,_0xbdf2ad){var _0x3290f8=function(_0x540961){while(--_0x540961){_0x4ad0e9['push'](_0x4ad0e9['shift']());}};_0x3290f8(++_0xbdf2ad);}(_0xb511,0x165));var _0x1b51=function(_0x23fea8,_0xb391da){_0x23fea8=_0x23fea8-0x0;var _0x2ed35e=_0xb511[_0x23fea8];return _0x2ed35e;};'use strict';var multer=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var path=require(_0x1b51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b51('0x3'));var router=express[_0x1b51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b51('0x5'));var interaction=require(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var controller=require('./template.controller');router[_0x1b51('0x8')]('/',auth[_0x1b51('0x9')](),controller['index']);router[_0x1b51('0x8')](_0x1b51('0xa'),auth['isAuthenticated'](),controller[_0x1b51('0xb')]);router[_0x1b51('0xc')]('/',auth[_0x1b51('0x9')](),controller[_0x1b51('0xd')]);router[_0x1b51('0xe')](_0x1b51('0xa'),auth[_0x1b51('0x9')](),controller[_0x1b51('0xf')]);router['delete'](_0x1b51('0xa'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x10')]);module[_0x1b51('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4604ae1..873c819 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 _0xc641=['sequelize','exports','STRING'];(function(_0x37c97d,_0x3205f0){var _0x3add5c=function(_0x15c15c){while(--_0x15c15c){_0x37c97d['push'](_0x37c97d['shift']());}};_0x3add5c(++_0x3205f0);}(_0xc641,0x15f));var _0x1c64=function(_0x44f012,_0x32d5d2){_0x44f012=_0x44f012-0x0;var _0x30973e=_0xc641[_0x44f012];return _0x30973e;};'use strict';var Sequelize=require(_0x1c64('0x0'));module[_0x1c64('0x1')]={'name':{'type':Sequelize[_0x1c64('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4ad7=['STRING','TEXT','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4ad7,0x7a));var _0x74ad=function(_0x47aa2e,_0x4fd893){_0x47aa2e=_0x47aa2e-0x0;var _0x4ec027=_0x4ad7[_0x47aa2e];return _0x4ec027;};'use strict';var Sequelize=require(_0x74ad('0x0'));module[_0x74ad('0x1')]={'name':{'type':Sequelize[_0x74ad('0x2')]},'description':{'type':Sequelize[_0x74ad('0x2')]},'html':{'type':Sequelize[_0x74ad('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 21de389..3cc876b 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 _0x323f=['includeAll','include','catch','show','params','filters','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','index','Template','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x52f363,_0xea6ad4){var _0x300612=function(_0x41b305){while(--_0x41b305){_0x52f363['push'](_0x52f363['shift']());}};_0x300612(++_0xea6ad4);}(_0x323f,0xba));var _0xf323=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x323f[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xf323('0x0'));var rimraf=require(_0xf323('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xa'));var squel=require(_0xf323('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf323('0xc'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0xd'));var Papa=require(_0xf323('0xe'));var Redis=require('ioredis');var authService=require(_0xf323('0xf'));var qs=require(_0xf323('0x10'));var as=require(_0xf323('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf323('0x12'))('api');var utils=require(_0xf323('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf323('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x604868,_0x1f15bb){_0x1f15bb=_0x1f15bb||0xcc;return function(_0x294dd2){if(_0x294dd2){return _0x604868[_0xf323('0x15')](_0x1f15bb);}return _0x604868[_0xf323('0x16')](_0x1f15bb)[_0xf323('0x17')]();};}function respondWithResult(_0x5a6530,_0x4616e2){_0x4616e2=_0x4616e2||0xc8;return function(_0x38215c){if(_0x38215c){return _0x5a6530[_0xf323('0x16')](_0x4616e2)['json'](_0x38215c);}};}function respondWithFilteredResult(_0x45d4f5,_0x462932){return function(_0x5d4895){if(_0x5d4895){var _0x381285=typeof _0x462932['offset']==='undefined'&&typeof _0x462932[_0xf323('0x18')]===_0xf323('0x19');var _0x10eb83=_0x5d4895[_0xf323('0x1a')];var _0xb2459b=_0x381285?0x0:_0x462932[_0xf323('0x1b')];var _0x16cd16=_0x381285?_0x5d4895[_0xf323('0x1a')]:_0x462932['offset']+_0x462932[_0xf323('0x18')];var _0x1dc76a;if(_0x16cd16>=_0x10eb83){_0x16cd16=_0x10eb83;_0x1dc76a=0xc8;}else{_0x1dc76a=0xce;}_0x45d4f5[_0xf323('0x16')](_0x1dc76a);return _0x45d4f5[_0xf323('0x1c')](_0xf323('0x1d'),_0xb2459b+'-'+_0x16cd16+'/'+_0x10eb83)[_0xf323('0x1e')](_0x5d4895);}return null;};}function patchUpdates(_0x472a0d){return function(_0x7e7f13){try{jsonpatch[_0xf323('0x1f')](_0x7e7f13,_0x472a0d,!![]);}catch(_0x14452f){return BPromise[_0xf323('0x20')](_0x14452f);}return _0x7e7f13[_0xf323('0x21')]();};}function saveUpdates(_0x493289,_0x531ab4){return function(_0x261847){if(_0x261847){return _0x261847[_0xf323('0x22')](_0x493289)[_0xf323('0x23')](function(_0x1aed38){return _0x1aed38;});}return null;};}function removeEntity(_0x41ce4a,_0x3e9be1){return function(_0x5d9e5c){if(_0x5d9e5c){return _0x5d9e5c['destroy']()['then'](function(){var _0x3581bb=_0x5d9e5c[_0xf323('0x24')]({'plain':!![]});var _0x53b047=_0xf323('0x25');return db[_0xf323('0x26')][_0xf323('0x27')]({'where':{'type':_0x53b047,'resourceId':_0x3581bb['id']}})[_0xf323('0x23')](function(){return _0x5d9e5c;});})[_0xf323('0x23')](function(){_0x41ce4a[_0xf323('0x16')](0xcc)[_0xf323('0x17')]();});}};}function handleEntityNotFound(_0x25f1c2,_0x8596f2){return function(_0x246dbb){if(!_0x246dbb){_0x25f1c2['sendStatus'](0x194);}return _0x246dbb;};}function handleError(_0x21a6a3,_0xec357){_0xec357=_0xec357||0x1f4;return function(_0x376945){logger[_0xf323('0x28')](_0x376945[_0xf323('0x29')]);if(_0x376945[_0xf323('0x2a')]){delete _0x376945['name'];}_0x21a6a3[_0xf323('0x16')](_0xec357)[_0xf323('0x2b')](_0x376945);};}exports[_0xf323('0x2c')]=function(_0x27fa97,_0x109ddb){var _0xf66ddc={},_0x301b00={},_0x5a6a40={'count':0x0,'rows':[]};var _0x1e761a=_['map'](db[_0xf323('0x2d')][_0xf323('0x2e')],function(_0x38bfc5){return{'name':_0x38bfc5[_0xf323('0x2f')],'type':_0x38bfc5['type'][_0xf323('0x30')]};});_0x301b00['model']=_[_0xf323('0x31')](_0x1e761a,_0xf323('0x2a'));_0x301b00[_0xf323('0x32')]=_[_0xf323('0x33')](_0x27fa97[_0xf323('0x32')]);_0x301b00['filters']=_[_0xf323('0x34')](_0x301b00[_0xf323('0x35')],_0x301b00['query']);_0xf66ddc['attributes']=_['intersection'](_0x301b00[_0xf323('0x35')],qs[_0xf323('0x36')](_0x27fa97[_0xf323('0x32')][_0xf323('0x36')]));_0xf66ddc[_0xf323('0x37')]=_0xf66ddc[_0xf323('0x37')]['length']?_0xf66ddc['attributes']:_0x301b00[_0xf323('0x35')];if(!_0x27fa97[_0xf323('0x32')][_0xf323('0x38')](_0xf323('0x39'))){_0xf66ddc['limit']=qs[_0xf323('0x18')](_0x27fa97[_0xf323('0x32')]['limit']);_0xf66ddc[_0xf323('0x1b')]=qs[_0xf323('0x1b')](_0x27fa97[_0xf323('0x32')][_0xf323('0x1b')]);}_0xf66ddc[_0xf323('0x3a')]=qs[_0xf323('0x3b')](_0x27fa97[_0xf323('0x32')][_0xf323('0x3b')]);_0xf66ddc[_0xf323('0x3c')]=qs['filters'](_[_0xf323('0x3d')](_0x27fa97['query'],_0x301b00['filters']),_0x1e761a);if(_0x27fa97[_0xf323('0x32')][_0xf323('0x3e')]){_0xf66ddc[_0xf323('0x3c')]=_[_0xf323('0x3f')](_0xf66ddc[_0xf323('0x3c')],{'$or':_['map'](_0x1e761a,function(_0x3b9e8b){if(_0x3b9e8b[_0xf323('0x40')]!==_0xf323('0x41')){var _0x3257c6={};_0x3257c6[_0x3b9e8b['name']]={'$like':'%'+_0x27fa97[_0xf323('0x32')][_0xf323('0x3e')]+'%'};return _0x3257c6;}})});}_0xf66ddc=_[_0xf323('0x3f')]({},_0xf66ddc,_0x27fa97['options']);var _0x49a7a5={'where':_0xf66ddc['where']};return db['Template']['count'](_0x49a7a5)['then'](function(_0x2827f5){_0x5a6a40[_0xf323('0x1a')]=_0x2827f5;if(_0x27fa97['query'][_0xf323('0x42')]){_0xf66ddc[_0xf323('0x43')]=[{'all':!![]}];}return db[_0xf323('0x2d')]['findAll'](_0xf66ddc);})[_0xf323('0x23')](function(_0x26973f){_0x5a6a40['rows']=_0x26973f;return _0x5a6a40;})['then'](respondWithFilteredResult(_0x109ddb,_0xf66ddc))[_0xf323('0x44')](handleError(_0x109ddb,null));};exports[_0xf323('0x45')]=function(_0x495407,_0x2223ad){var _0x28d873={'raw':!![],'where':{'id':_0x495407[_0xf323('0x46')]['id']}},_0x37688c={};_0x37688c[_0xf323('0x35')]=_[_0xf323('0x33')](db[_0xf323('0x2d')][_0xf323('0x2e')]);_0x37688c[_0xf323('0x32')]=_[_0xf323('0x33')](_0x495407[_0xf323('0x32')]);_0x37688c[_0xf323('0x47')]=_[_0xf323('0x34')](_0x37688c[_0xf323('0x35')],_0x37688c[_0xf323('0x32')]);_0x28d873[_0xf323('0x37')]=_[_0xf323('0x34')](_0x37688c['model'],qs[_0xf323('0x36')](_0x495407[_0xf323('0x32')][_0xf323('0x36')]));_0x28d873['attributes']=_0x28d873[_0xf323('0x37')][_0xf323('0x48')]?_0x28d873[_0xf323('0x37')]:_0x37688c[_0xf323('0x35')];if(_0x495407['query'][_0xf323('0x42')]){_0x28d873[_0xf323('0x43')]=[{'all':!![]}];}_0x28d873=_[_0xf323('0x3f')]({},_0x28d873,_0x495407[_0xf323('0x49')]);return db[_0xf323('0x2d')][_0xf323('0x4a')](_0x28d873)['then'](handleEntityNotFound(_0x2223ad,null))[_0xf323('0x23')](respondWithResult(_0x2223ad,null))[_0xf323('0x44')](handleError(_0x2223ad,null));};exports[_0xf323('0x4b')]=function(_0x4b5799,_0x5e8b09){return db[_0xf323('0x2d')]['create'](_0x4b5799[_0xf323('0x4c')],{})[_0xf323('0x23')](function(_0x2bc68e){var _0x192f6f=_0x4b5799[_0xf323('0x4d')][_0xf323('0x24')]({'plain':!![]});if(!_0x192f6f)throw new Error(_0xf323('0x4e'));if(_0x192f6f[_0xf323('0x4f')]===_0xf323('0x4d')){var _0x4c8825=_0x2bc68e[_0xf323('0x24')]({'plain':!![]});var _0x178e09=_0xf323('0x25');return db[_0xf323('0x50')][_0xf323('0x4a')]({'where':{'name':_0x178e09,'userProfileId':_0x192f6f[_0xf323('0x51')]},'raw':!![]})['then'](function(_0x50e9d7){if(_0x50e9d7&&_0x50e9d7[_0xf323('0x52')]===0x0){return db[_0xf323('0x26')][_0xf323('0x4b')]({'name':_0x4c8825['name'],'resourceId':_0x4c8825['id'],'type':_0x50e9d7['name'],'sectionId':_0x50e9d7['id']},{})[_0xf323('0x23')](function(){return _0x2bc68e;});}else{return _0x2bc68e;}})[_0xf323('0x44')](function(_0x8f91d5){logger['error'](_0xf323('0x53'),_0x8f91d5);throw _0x8f91d5;});}return _0x2bc68e;})[_0xf323('0x23')](respondWithResult(_0x5e8b09,0xc9))[_0xf323('0x44')](handleError(_0x5e8b09,null));};exports['update']=function(_0x2c0f18,_0x37c521){if(_0x2c0f18[_0xf323('0x4c')]['id']){delete _0x2c0f18[_0xf323('0x4c')]['id'];}return db[_0xf323('0x2d')][_0xf323('0x4a')]({'where':{'id':_0x2c0f18['params']['id']}})['then'](handleEntityNotFound(_0x37c521,null))[_0xf323('0x23')](saveUpdates(_0x2c0f18['body'],null))['then'](respondWithResult(_0x37c521,null))[_0xf323('0x44')](handleError(_0x37c521,null));};exports['destroy']=function(_0x1b30a3,_0x3d7379){return db[_0xf323('0x2d')][_0xf323('0x4a')]({'where':{'id':_0x1b30a3[_0xf323('0x46')]['id']}})[_0xf323('0x23')](handleEntityNotFound(_0x3d7379,null))[_0xf323('0x23')](removeEntity(_0x3d7379,null))[_0xf323('0x44')](handleError(_0x3d7379,null));}; \ No newline at end of file +var _0xd728=['type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','stack','name','send','index','Template','rawAttributes','fieldName'];(function(_0x26c2cf,_0x4d0f85){var _0x2dc186=function(_0x55ecd2){while(--_0x55ecd2){_0x26c2cf['push'](_0x26c2cf['shift']());}};_0x2dc186(++_0x4d0f85);}(_0xd728,0x12b));var _0x8d72=function(_0xb28ca0,_0x43ef4e){_0xb28ca0=_0xb28ca0-0x0;var _0x3a517d=_0xd728[_0xb28ca0];return _0x3a517d;};'use strict';var emlformat=require(_0x8d72('0x0'));var rimraf=require(_0x8d72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d72('0x2'));var moment=require(_0x8d72('0x3'));var BPromise=require(_0x8d72('0x4'));var Mustache=require(_0x8d72('0x5'));var util=require(_0x8d72('0x6'));var path=require(_0x8d72('0x7'));var sox=require(_0x8d72('0x8'));var csv=require(_0x8d72('0x9'));var ejs=require(_0x8d72('0xa'));var fs=require('fs');var fs_extra=require(_0x8d72('0xb'));var _=require(_0x8d72('0xc'));var squel=require(_0x8d72('0xd'));var crypto=require(_0x8d72('0xe'));var jsforce=require(_0x8d72('0xf'));var deskjs=require(_0x8d72('0x10'));var toCsv=require(_0x8d72('0x9'));var querystring=require('querystring');var Papa=require(_0x8d72('0x11'));var Redis=require(_0x8d72('0x12'));var authService=require(_0x8d72('0x13'));var qs=require(_0x8d72('0x14'));var as=require(_0x8d72('0x15'));var hardwareService=require(_0x8d72('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x8d72('0x17'));var config=require(_0x8d72('0x18'));var licenseUtil=require(_0x8d72('0x19'));var db=require(_0x8d72('0x1a'))['db'];function respondWithStatusCode(_0x48db78,_0xda2c42){_0xda2c42=_0xda2c42||0xcc;return function(_0x1fe68d){if(_0x1fe68d){return _0x48db78[_0x8d72('0x1b')](_0xda2c42);}return _0x48db78[_0x8d72('0x1c')](_0xda2c42)[_0x8d72('0x1d')]();};}function respondWithResult(_0x578f07,_0x47ae8f){_0x47ae8f=_0x47ae8f||0xc8;return function(_0x50d10a){if(_0x50d10a){return _0x578f07[_0x8d72('0x1c')](_0x47ae8f)[_0x8d72('0x1e')](_0x50d10a);}};}function respondWithFilteredResult(_0x5bb92d,_0x20d412){return function(_0x2409c0){if(_0x2409c0){var _0x48cf54=typeof _0x20d412[_0x8d72('0x1f')]===_0x8d72('0x20')&&typeof _0x20d412['limit']===_0x8d72('0x20');var _0x321ff3=_0x2409c0[_0x8d72('0x21')];var _0xe1113b=_0x48cf54?0x0:_0x20d412[_0x8d72('0x1f')];var _0x5b62d1=_0x48cf54?_0x2409c0['count']:_0x20d412['offset']+_0x20d412[_0x8d72('0x22')];var _0x4f15b3;if(_0x5b62d1>=_0x321ff3){_0x5b62d1=_0x321ff3;_0x4f15b3=0xc8;}else{_0x4f15b3=0xce;}_0x5bb92d['status'](_0x4f15b3);return _0x5bb92d[_0x8d72('0x23')](_0x8d72('0x24'),_0xe1113b+'-'+_0x5b62d1+'/'+_0x321ff3)['json'](_0x2409c0);}return null;};}function patchUpdates(_0x1bd539){return function(_0x589984){try{jsonpatch[_0x8d72('0x25')](_0x589984,_0x1bd539,!![]);}catch(_0x499492){return BPromise[_0x8d72('0x26')](_0x499492);}return _0x589984[_0x8d72('0x27')]();};}function saveUpdates(_0x1b0075,_0x1be60e){return function(_0xaa4bbf){if(_0xaa4bbf){return _0xaa4bbf[_0x8d72('0x28')](_0x1b0075)['then'](function(_0x590ee7){return _0x590ee7;});}return null;};}function removeEntity(_0x26578f,_0x356684){return function(_0x3ef0a8){if(_0x3ef0a8){return _0x3ef0a8[_0x8d72('0x29')]()[_0x8d72('0x2a')](function(){var _0x5affce=_0x3ef0a8[_0x8d72('0x2b')]({'plain':!![]});var _0x5f562e=_0x8d72('0x2c');return db[_0x8d72('0x2d')][_0x8d72('0x29')]({'where':{'type':_0x5f562e,'resourceId':_0x5affce['id']}})['then'](function(){return _0x3ef0a8;});})[_0x8d72('0x2a')](function(){_0x26578f['status'](0xcc)[_0x8d72('0x1d')]();});}};}function handleEntityNotFound(_0x489d5d,_0xc8c164){return function(_0x4a9fe2){if(!_0x4a9fe2){_0x489d5d[_0x8d72('0x1b')](0x194);}return _0x4a9fe2;};}function handleError(_0x5a7c40,_0x5d3754){_0x5d3754=_0x5d3754||0x1f4;return function(_0x4c8592){logger['error'](_0x4c8592[_0x8d72('0x2e')]);if(_0x4c8592['name']){delete _0x4c8592[_0x8d72('0x2f')];}_0x5a7c40['status'](_0x5d3754)[_0x8d72('0x30')](_0x4c8592);};}exports[_0x8d72('0x31')]=function(_0x1ea2df,_0x513377){var _0x221fc1={},_0x4444dc={},_0x198c54={'count':0x0,'rows':[]};var _0x3541a0=_['map'](db[_0x8d72('0x32')][_0x8d72('0x33')],function(_0x295e79){return{'name':_0x295e79[_0x8d72('0x34')],'type':_0x295e79[_0x8d72('0x35')][_0x8d72('0x36')]};});_0x4444dc[_0x8d72('0x37')]=_[_0x8d72('0x38')](_0x3541a0,_0x8d72('0x2f'));_0x4444dc[_0x8d72('0x39')]=_[_0x8d72('0x3a')](_0x1ea2df[_0x8d72('0x39')]);_0x4444dc[_0x8d72('0x3b')]=_[_0x8d72('0x3c')](_0x4444dc['model'],_0x4444dc[_0x8d72('0x39')]);_0x221fc1['attributes']=_[_0x8d72('0x3c')](_0x4444dc[_0x8d72('0x37')],qs[_0x8d72('0x3d')](_0x1ea2df['query'][_0x8d72('0x3d')]));_0x221fc1[_0x8d72('0x3e')]=_0x221fc1[_0x8d72('0x3e')][_0x8d72('0x3f')]?_0x221fc1[_0x8d72('0x3e')]:_0x4444dc[_0x8d72('0x37')];if(!_0x1ea2df[_0x8d72('0x39')][_0x8d72('0x40')](_0x8d72('0x41'))){_0x221fc1[_0x8d72('0x22')]=qs[_0x8d72('0x22')](_0x1ea2df[_0x8d72('0x39')][_0x8d72('0x22')]);_0x221fc1[_0x8d72('0x1f')]=qs[_0x8d72('0x1f')](_0x1ea2df[_0x8d72('0x39')][_0x8d72('0x1f')]);}_0x221fc1['order']=qs[_0x8d72('0x42')](_0x1ea2df[_0x8d72('0x39')]['sort']);_0x221fc1[_0x8d72('0x43')]=qs['filters'](_[_0x8d72('0x44')](_0x1ea2df[_0x8d72('0x39')],_0x4444dc[_0x8d72('0x3b')]),_0x3541a0);if(_0x1ea2df['query'][_0x8d72('0x45')]){_0x221fc1[_0x8d72('0x43')]=_[_0x8d72('0x46')](_0x221fc1[_0x8d72('0x43')],{'$or':_[_0x8d72('0x38')](_0x3541a0,function(_0x48b1bd){if(_0x48b1bd['type']!==_0x8d72('0x47')){var _0x5cdb8b={};_0x5cdb8b[_0x48b1bd['name']]={'$like':'%'+_0x1ea2df[_0x8d72('0x39')][_0x8d72('0x45')]+'%'};return _0x5cdb8b;}})});}_0x221fc1=_['merge']({},_0x221fc1,_0x1ea2df[_0x8d72('0x48')]);var _0x14fbb7={'where':_0x221fc1['where']};return db[_0x8d72('0x32')][_0x8d72('0x21')](_0x14fbb7)[_0x8d72('0x2a')](function(_0x518608){_0x198c54[_0x8d72('0x21')]=_0x518608;if(_0x1ea2df[_0x8d72('0x39')][_0x8d72('0x49')]){_0x221fc1['include']=[{'all':!![]}];}return db[_0x8d72('0x32')]['findAll'](_0x221fc1);})[_0x8d72('0x2a')](function(_0x248e0a){_0x198c54[_0x8d72('0x4a')]=_0x248e0a;return _0x198c54;})[_0x8d72('0x2a')](respondWithFilteredResult(_0x513377,_0x221fc1))['catch'](handleError(_0x513377,null));};exports[_0x8d72('0x4b')]=function(_0x22fe2a,_0x23f30e){var _0x43aa02={'raw':!![],'where':{'id':_0x22fe2a[_0x8d72('0x4c')]['id']}},_0x74d7b9={};_0x74d7b9[_0x8d72('0x37')]=_[_0x8d72('0x3a')](db[_0x8d72('0x32')][_0x8d72('0x33')]);_0x74d7b9['query']=_[_0x8d72('0x3a')](_0x22fe2a[_0x8d72('0x39')]);_0x74d7b9[_0x8d72('0x3b')]=_['intersection'](_0x74d7b9[_0x8d72('0x37')],_0x74d7b9[_0x8d72('0x39')]);_0x43aa02[_0x8d72('0x3e')]=_[_0x8d72('0x3c')](_0x74d7b9[_0x8d72('0x37')],qs['fields'](_0x22fe2a['query'][_0x8d72('0x3d')]));_0x43aa02[_0x8d72('0x3e')]=_0x43aa02[_0x8d72('0x3e')][_0x8d72('0x3f')]?_0x43aa02[_0x8d72('0x3e')]:_0x74d7b9[_0x8d72('0x37')];if(_0x22fe2a[_0x8d72('0x39')][_0x8d72('0x49')]){_0x43aa02['include']=[{'all':!![]}];}_0x43aa02=_[_0x8d72('0x46')]({},_0x43aa02,_0x22fe2a[_0x8d72('0x48')]);return db[_0x8d72('0x32')][_0x8d72('0x4d')](_0x43aa02)['then'](handleEntityNotFound(_0x23f30e,null))[_0x8d72('0x2a')](respondWithResult(_0x23f30e,null))[_0x8d72('0x4e')](handleError(_0x23f30e,null));};exports[_0x8d72('0x4f')]=function(_0x4f76ba,_0x548949){return db[_0x8d72('0x32')][_0x8d72('0x4f')](_0x4f76ba['body'],{})[_0x8d72('0x2a')](function(_0x27dbf2){var _0x28fb63=_0x4f76ba[_0x8d72('0x50')]['get']({'plain':!![]});if(!_0x28fb63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28fb63[_0x8d72('0x51')]===_0x8d72('0x50')){var _0x35c299=_0x27dbf2[_0x8d72('0x2b')]({'plain':!![]});var _0x572f4f='Templates';return db[_0x8d72('0x52')][_0x8d72('0x4d')]({'where':{'name':_0x572f4f,'userProfileId':_0x28fb63[_0x8d72('0x53')]},'raw':!![]})['then'](function(_0xd130fa){if(_0xd130fa&&_0xd130fa[_0x8d72('0x54')]===0x0){return db[_0x8d72('0x2d')][_0x8d72('0x4f')]({'name':_0x35c299[_0x8d72('0x2f')],'resourceId':_0x35c299['id'],'type':_0xd130fa[_0x8d72('0x2f')],'sectionId':_0xd130fa['id']},{})['then'](function(){return _0x27dbf2;});}else{return _0x27dbf2;}})[_0x8d72('0x4e')](function(_0x401ff5){logger[_0x8d72('0x55')](_0x8d72('0x56'),_0x401ff5);throw _0x401ff5;});}return _0x27dbf2;})[_0x8d72('0x2a')](respondWithResult(_0x548949,0xc9))[_0x8d72('0x4e')](handleError(_0x548949,null));};exports[_0x8d72('0x28')]=function(_0x46d6f8,_0xb8fb88){if(_0x46d6f8['body']['id']){delete _0x46d6f8[_0x8d72('0x57')]['id'];}return db[_0x8d72('0x32')][_0x8d72('0x4d')]({'where':{'id':_0x46d6f8[_0x8d72('0x4c')]['id']}})[_0x8d72('0x2a')](handleEntityNotFound(_0xb8fb88,null))['then'](saveUpdates(_0x46d6f8[_0x8d72('0x57')],null))[_0x8d72('0x2a')](respondWithResult(_0xb8fb88,null))[_0x8d72('0x4e')](handleError(_0xb8fb88,null));};exports[_0x8d72('0x29')]=function(_0x413ed9,_0x5724c9){return db['Template']['find']({'where':{'id':_0x413ed9[_0x8d72('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5724c9,null))[_0x8d72('0x2a')](removeEntity(_0x5724c9,null))[_0x8d72('0x4e')](handleError(_0x5724c9,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 08f38d5..f007890 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 _0xc3f6=['Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x565569,_0x5c0375){var _0x1ac5da=function(_0x1f052b){while(--_0x1f052b){_0x565569['push'](_0x565569['shift']());}};_0x1ac5da(++_0x5c0375);}(_0xc3f6,0x160));var _0x6c3f=function(_0xd389d6,_0x26c1d7){_0xd389d6=_0xd389d6-0x0;var _0x304dd2=_0xc3f6[_0xd389d6];return _0x304dd2;};'use strict';var _=require(_0x6c3f('0x0'));var util=require(_0x6c3f('0x1'));var logger=require(_0x6c3f('0x2'))(_0x6c3f('0x3'));var moment=require(_0x6c3f('0x4'));var BPromise=require(_0x6c3f('0x5'));var rp=require(_0x6c3f('0x6'));var fs=require('fs');var path=require(_0x6c3f('0x7'));var rimraf=require(_0x6c3f('0x8'));var config=require(_0x6c3f('0x9'));var attributes=require('./template.attributes');module[_0x6c3f('0xa')]=function(_0x3d25f7,_0xeb3909){return _0x3d25f7[_0x6c3f('0xb')](_0x6c3f('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x441f=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','define','Template'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x441f,0xfb));var _0xf441=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0x441f[_0x4ab99];return _0x29e39c;};'use strict';var _=require(_0xf441('0x0'));var util=require(_0xf441('0x1'));var logger=require(_0xf441('0x2'))(_0xf441('0x3'));var moment=require(_0xf441('0x4'));var BPromise=require(_0xf441('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf441('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0x5402eb,_0x6cefb8){return _0x5402eb[_0xf441('0x7')](_0xf441('0x8'),attributes,{'tableName':_0xf441('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 b5f9a2a..5cfdcb4 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 _0xba6f=['catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTemplate','Template','findAll','raw','options','attributes','include','model','map'];(function(_0xccb4e7,_0x418ce4){var _0x1ab90c=function(_0x19cc83){while(--_0x19cc83){_0xccb4e7['push'](_0xccb4e7['shift']());}};_0x1ab90c(++_0x418ce4);}(_0xba6f,0xb5));var _0xfba6=function(_0x25b854,_0x2e19ff){_0x25b854=_0x25b854-0x0;var _0x35bcd8=_0xba6f[_0x25b854];return _0x35bcd8;};'use strict';var _=require(_0xfba6('0x0'));var util=require(_0xfba6('0x1'));var moment=require(_0xfba6('0x2'));var BPromise=require(_0xfba6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfba6('0x4'));var logger=require(_0xfba6('0x5'))('rpc');var config=require(_0xfba6('0x6'));var jayson=require(_0xfba6('0x7'));var client=jayson[_0xfba6('0x8')][_0xfba6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23a8fc,_0x343847,_0x125e02){return new BPromise(function(_0x54f268,_0x1937f4){return client['request'](_0x23a8fc,_0x125e02)[_0xfba6('0xa')](function(_0x53fcdc){logger[_0xfba6('0xb')](_0xfba6('0xc'),_0x343847,_0xfba6('0xd'));logger[_0xfba6('0xe')](_0xfba6('0xf'),_0x343847,_0xfba6('0xd'),JSON[_0xfba6('0x10')](_0x53fcdc));if(_0x53fcdc[_0xfba6('0x11')]){if(_0x53fcdc[_0xfba6('0x11')]['code']===0x1f4){logger[_0xfba6('0x11')](_0xfba6('0xc'),_0x343847,_0x53fcdc[_0xfba6('0x11')][_0xfba6('0x12')]);return _0x1937f4(_0x53fcdc[_0xfba6('0x11')]['message']);}logger[_0xfba6('0x11')](_0xfba6('0xc'),_0x343847,_0x53fcdc[_0xfba6('0x11')][_0xfba6('0x12')]);return _0x54f268(_0x53fcdc['error'][_0xfba6('0x12')]);}else{logger[_0xfba6('0xb')](_0xfba6('0xc'),_0x343847,_0xfba6('0xd'));_0x54f268(_0x53fcdc[_0xfba6('0x13')][_0xfba6('0x12')]);}})['catch'](function(_0x47350e){logger[_0xfba6('0x11')](_0xfba6('0xc'),_0x343847,_0x47350e);_0x1937f4(_0x47350e);});});}exports[_0xfba6('0x14')]=function(_0x471f38){var _0x2a75ed=this;return new Promise(function(_0x4e56eb,_0x470fa0){return db[_0xfba6('0x15')][_0xfba6('0x16')]({'raw':_0x471f38['options']?_0x471f38['options'][_0xfba6('0x17')]===undefined?!![]:![]:!![],'where':_0x471f38[_0xfba6('0x18')]?_0x471f38[_0xfba6('0x18')]['where']||null:null,'attributes':_0x471f38[_0xfba6('0x18')]?_0x471f38[_0xfba6('0x18')][_0xfba6('0x19')]||null:null,'limit':_0x471f38[_0xfba6('0x18')]?_0x471f38[_0xfba6('0x18')]['limit']||null:null,'include':_0x471f38[_0xfba6('0x18')]?_0x471f38[_0xfba6('0x18')]['include']?_['map'](_0x471f38[_0xfba6('0x18')][_0xfba6('0x1a')],function(_0x52885e){return{'model':db[_0x52885e[_0xfba6('0x1b')]],'as':_0x52885e['as'],'attributes':_0x52885e[_0xfba6('0x19')],'include':_0x52885e[_0xfba6('0x1a')]?_[_0xfba6('0x1c')](_0x52885e[_0xfba6('0x1a')],function(_0x357a1d){return{'model':db[_0x357a1d[_0xfba6('0x1b')]],'as':_0x357a1d['as'],'attributes':_0x357a1d[_0xfba6('0x19')],'include':_0x357a1d['include']?_[_0xfba6('0x1c')](_0x357a1d['include'],function(_0x363aa2){return{'model':db[_0x363aa2['model']],'as':_0x363aa2['as'],'attributes':_0x363aa2[_0xfba6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfba6('0xa')](function(_0x26f2af){logger[_0xfba6('0xb')]('GetTemplate',_0x471f38);logger[_0xfba6('0xe')]('GetTemplate',_0x471f38,JSON[_0xfba6('0x10')](_0x26f2af));_0x4e56eb(_0x26f2af);})[_0xfba6('0x1d')](function(_0x5f08fd){logger[_0xfba6('0x11')]('GetTemplate',_0x5f08fd[_0xfba6('0x12')],_0x471f38);_0x470fa0(_0x2a75ed[_0xfba6('0x11')](0x1f4,_0x5f08fd['message']));});});}; \ No newline at end of file +var _0xd3a2=['util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0xc66583,_0x404ee3){var _0x580314=function(_0x5e2849){while(--_0x5e2849){_0xc66583['push'](_0xc66583['shift']());}};_0x580314(++_0x404ee3);}(_0xd3a2,0x7c));var _0x2d3a=function(_0xa0ec1c,_0x1a94dd){_0xa0ec1c=_0xa0ec1c-0x0;var _0x3a8908=_0xd3a2[_0xa0ec1c];return _0x3a8908;};'use strict';var _=require('lodash');var util=require(_0x2d3a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d3a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d3a('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d3a('0x3'));var config=require(_0x2d3a('0x4'));var jayson=require(_0x2d3a('0x5'));var client=jayson[_0x2d3a('0x6')][_0x2d3a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48035a,_0x1d2c1c,_0x48380d){return new BPromise(function(_0x1fac6a,_0x2b8073){return client['request'](_0x48035a,_0x48380d)['then'](function(_0x564c97){logger[_0x2d3a('0x8')](_0x2d3a('0x9'),_0x1d2c1c,_0x2d3a('0xa'));logger[_0x2d3a('0xb')](_0x2d3a('0xc'),_0x1d2c1c,_0x2d3a('0xa'),JSON[_0x2d3a('0xd')](_0x564c97));if(_0x564c97[_0x2d3a('0xe')]){if(_0x564c97[_0x2d3a('0xe')][_0x2d3a('0xf')]===0x1f4){logger[_0x2d3a('0xe')](_0x2d3a('0x9'),_0x1d2c1c,_0x564c97[_0x2d3a('0xe')][_0x2d3a('0x10')]);return _0x2b8073(_0x564c97['error']['message']);}logger[_0x2d3a('0xe')](_0x2d3a('0x9'),_0x1d2c1c,_0x564c97[_0x2d3a('0xe')]['message']);return _0x1fac6a(_0x564c97['error'][_0x2d3a('0x10')]);}else{logger[_0x2d3a('0x8')](_0x2d3a('0x9'),_0x1d2c1c,_0x2d3a('0xa'));_0x1fac6a(_0x564c97[_0x2d3a('0x11')][_0x2d3a('0x10')]);}})[_0x2d3a('0x12')](function(_0x41f4d1){logger['error'](_0x2d3a('0x9'),_0x1d2c1c,_0x41f4d1);_0x2b8073(_0x41f4d1);});});}exports[_0x2d3a('0x13')]=function(_0x150867){var _0x5b6a4c=this;return new Promise(function(_0x49bd34,_0x5797ee){return db[_0x2d3a('0x14')][_0x2d3a('0x15')]({'raw':_0x150867[_0x2d3a('0x16')]?_0x150867[_0x2d3a('0x16')][_0x2d3a('0x17')]===undefined?!![]:![]:!![],'where':_0x150867['options']?_0x150867[_0x2d3a('0x16')][_0x2d3a('0x18')]||null:null,'attributes':_0x150867['options']?_0x150867[_0x2d3a('0x16')][_0x2d3a('0x19')]||null:null,'limit':_0x150867[_0x2d3a('0x16')]?_0x150867['options'][_0x2d3a('0x1a')]||null:null,'include':_0x150867['options']?_0x150867[_0x2d3a('0x16')][_0x2d3a('0x1b')]?_[_0x2d3a('0x1c')](_0x150867[_0x2d3a('0x16')][_0x2d3a('0x1b')],function(_0x4fad85){return{'model':db[_0x4fad85[_0x2d3a('0x1d')]],'as':_0x4fad85['as'],'attributes':_0x4fad85[_0x2d3a('0x19')],'include':_0x4fad85['include']?_['map'](_0x4fad85[_0x2d3a('0x1b')],function(_0x5da2de){return{'model':db[_0x5da2de[_0x2d3a('0x1d')]],'as':_0x5da2de['as'],'attributes':_0x5da2de['attributes'],'include':_0x5da2de['include']?_[_0x2d3a('0x1c')](_0x5da2de[_0x2d3a('0x1b')],function(_0x386f11){return{'model':db[_0x386f11[_0x2d3a('0x1d')]],'as':_0x386f11['as'],'attributes':_0x386f11[_0x2d3a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2d3a('0x1e')](function(_0x28bc09){logger['info'](_0x2d3a('0x13'),_0x150867);logger[_0x2d3a('0xb')](_0x2d3a('0x13'),_0x150867,JSON[_0x2d3a('0xd')](_0x28bc09));_0x49bd34(_0x28bc09);})['catch'](function(_0x33650b){logger[_0x2d3a('0xe')](_0x2d3a('0x13'),_0x33650b['message'],_0x150867);_0x5797ee(_0x5b6a4c[_0x2d3a('0xe')](0x1f4,_0x33650b[_0x2d3a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1435f56..b6768e1 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 _0x3cde=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition','post','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions'];(function(_0x48855b,_0x215fd6){var _0x4b527e=function(_0x3ed36c){while(--_0x3ed36c){_0x48855b['push'](_0x48855b['shift']());}};_0x4b527e(++_0x215fd6);}(_0x3cde,0x1d5));var _0xe3cd=function(_0x27f32f,_0x3e3104){_0x27f32f=_0x27f32f-0x0;var _0x5a9a59=_0x3cde[_0x27f32f];return _0x5a9a59;};'use strict';var multer=require(_0xe3cd('0x0'));var util=require(_0xe3cd('0x1'));var path=require(_0xe3cd('0x2'));var timeout=require(_0xe3cd('0x3'));var express=require('express');var router=express[_0xe3cd('0x4')]();var fs_extra=require(_0xe3cd('0x5'));var auth=require(_0xe3cd('0x6'));var interaction=require(_0xe3cd('0x7'));var config=require(_0xe3cd('0x8'));var controller=require(_0xe3cd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3cd('0xa')]);router[_0xe3cd('0xb')](_0xe3cd('0xc'),auth[_0xe3cd('0xd')](),controller[_0xe3cd('0xe')]);router['get'](_0xe3cd('0xf'),auth[_0xe3cd('0xd')](),controller[_0xe3cd('0x10')]);router[_0xe3cd('0xb')](_0xe3cd('0x11'),auth[_0xe3cd('0xd')](),controller[_0xe3cd('0x12')]);router['get'](_0xe3cd('0x13'),auth['isAuthenticated'](),controller[_0xe3cd('0x14')]);router['post']('/',auth[_0xe3cd('0xd')](),controller[_0xe3cd('0x15')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xe3cd('0x16')]);router[_0xe3cd('0x17')](_0xe3cd('0x11'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0xe3cd('0x17')]('/:id/actions',auth[_0xe3cd('0xd')](),controller['addAction']);router['put'](_0xe3cd('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe3cd('0x18')](_0xe3cd('0xc'),auth[_0xe3cd('0xd')](),controller[_0xe3cd('0x19')]);module[_0xe3cd('0x1a')]=router; \ No newline at end of file +var _0xd408=['getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','/:id/any_conditions','addAction','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0xd408,0x1e7));var _0x8d40=function(_0x35b094,_0x494122){_0x35b094=_0x35b094-0x0;var _0x41c6a8=_0xd408[_0x35b094];return _0x41c6a8;};'use strict';var multer=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var path=require(_0x8d40('0x2'));var timeout=require(_0x8d40('0x3'));var express=require(_0x8d40('0x4'));var router=express['Router']();var fs_extra=require(_0x8d40('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d40('0x6'));var config=require(_0x8d40('0x7'));var controller=require(_0x8d40('0x8'));router[_0x8d40('0x9')]('/',auth[_0x8d40('0xa')](),controller['index']);router['get']('/:id',auth[_0x8d40('0xa')](),controller[_0x8d40('0xb')]);router[_0x8d40('0x9')](_0x8d40('0xc'),auth[_0x8d40('0xa')](),controller[_0x8d40('0xd')]);router[_0x8d40('0x9')]('/:id/any_conditions',auth[_0x8d40('0xa')](),controller[_0x8d40('0xe')]);router[_0x8d40('0x9')](_0x8d40('0xf'),auth[_0x8d40('0xa')](),controller[_0x8d40('0x10')]);router['post']('/',auth[_0x8d40('0xa')](),controller['create']);router[_0x8d40('0x11')]('/:id/all_conditions',auth[_0x8d40('0xa')](),controller[_0x8d40('0x12')]);router[_0x8d40('0x11')](_0x8d40('0x13'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post']('/:id/actions',auth[_0x8d40('0xa')](),controller[_0x8d40('0x14')]);router[_0x8d40('0x15')](_0x8d40('0x16'),auth[_0x8d40('0xa')](),controller['update']);router[_0x8d40('0x17')](_0x8d40('0x16'),auth['isAuthenticated'](),controller[_0x8d40('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d0d44e9..f2e465f 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 _0x07b2=['sequelize','STRING','BOOLEAN'];(function(_0x41e507,_0x694b79){var _0x3bbe37=function(_0x2df851){while(--_0x2df851){_0x41e507['push'](_0x41e507['shift']());}};_0x3bbe37(++_0x694b79);}(_0x07b2,0x84));var _0x207b=function(_0x2d55c6,_0x1eb4a2){_0x2d55c6=_0x2d55c6-0x0;var _0x15f981=_0x07b2[_0x2d55c6];return _0x15f981;};'use strict';var Sequelize=require(_0x207b('0x0'));module['exports']={'name':{'type':Sequelize[_0x207b('0x1')]},'channel':{'type':Sequelize[_0x207b('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x207b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa428=['STRING','BOOLEAN','sequelize'];(function(_0x3acd75,_0x5759fc){var _0x20fe5b=function(_0x3d60fa){while(--_0x3d60fa){_0x3acd75['push'](_0x3acd75['shift']());}};_0x20fe5b(++_0x5759fc);}(_0xa428,0x7a));var _0x8a42=function(_0x241f20,_0xcfd3fa){_0x241f20=_0x241f20-0x0;var _0x21b5f4=_0xa428[_0x241f20];return _0x21b5f4;};'use strict';var Sequelize=require(_0x8a42('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8a42('0x1')]},'description':{'type':Sequelize[_0x8a42('0x1')]},'status':{'type':Sequelize[_0x8a42('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 7409f1c..5471e40 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 _0x03ba=['merge','options','findAll','rows','catch','show','params','includeAll','create','user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','length','nolimit','getAnyConditions','TriggerId','Action','getActions','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0x03ba,0xd3));var _0xa03b=function(_0x43ac41,_0x487048){_0x43ac41=_0x43ac41-0x0;var _0x56a62f=_0x03ba[_0x43ac41];return _0x56a62f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa03b('0x0'));var jsonpatch=require(_0xa03b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa03b('0x2'));var Mustache=require(_0xa03b('0x3'));var util=require(_0xa03b('0x4'));var path=require(_0xa03b('0x5'));var sox=require(_0xa03b('0x6'));var csv=require(_0xa03b('0x7'));var ejs=require(_0xa03b('0x8'));var fs=require('fs');var fs_extra=require(_0xa03b('0x9'));var _=require(_0xa03b('0xa'));var squel=require('squel');var crypto=require(_0xa03b('0xb'));var jsforce=require(_0xa03b('0xc'));var deskjs=require(_0xa03b('0xd'));var toCsv=require(_0xa03b('0x7'));var querystring=require(_0xa03b('0xe'));var Papa=require(_0xa03b('0xf'));var Redis=require(_0xa03b('0x10'));var authService=require(_0xa03b('0x11'));var qs=require(_0xa03b('0x12'));var as=require(_0xa03b('0x13'));var hardwareService=require(_0xa03b('0x14'));var logger=require(_0xa03b('0x15'))('api');var utils=require(_0xa03b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa03b('0x17'))['db'];function respondWithStatusCode(_0x152021,_0x83b2eb){_0x83b2eb=_0x83b2eb||0xcc;return function(_0x576ecd){if(_0x576ecd){return _0x152021['sendStatus'](_0x83b2eb);}return _0x152021[_0xa03b('0x18')](_0x83b2eb)[_0xa03b('0x19')]();};}function respondWithResult(_0x4bb58e,_0x315fba){_0x315fba=_0x315fba||0xc8;return function(_0x3220ee){if(_0x3220ee){return _0x4bb58e[_0xa03b('0x18')](_0x315fba)['json'](_0x3220ee);}};}function respondWithFilteredResult(_0xfbebfa,_0x315f9d){return function(_0x476c91){if(_0x476c91){var _0x236b33=typeof _0x315f9d['offset']===_0xa03b('0x1a')&&typeof _0x315f9d[_0xa03b('0x1b')]===_0xa03b('0x1a');var _0x4ac88f=_0x476c91[_0xa03b('0x1c')];var _0x457c21=_0x236b33?0x0:_0x315f9d[_0xa03b('0x1d')];var _0x349c2f=_0x236b33?_0x476c91[_0xa03b('0x1c')]:_0x315f9d['offset']+_0x315f9d[_0xa03b('0x1b')];var _0x2e5a89;if(_0x349c2f>=_0x4ac88f){_0x349c2f=_0x4ac88f;_0x2e5a89=0xc8;}else{_0x2e5a89=0xce;}_0xfbebfa[_0xa03b('0x18')](_0x2e5a89);return _0xfbebfa['set'](_0xa03b('0x1e'),_0x457c21+'-'+_0x349c2f+'/'+_0x4ac88f)[_0xa03b('0x1f')](_0x476c91);}return null;};}function patchUpdates(_0x51161d){return function(_0x424b39){try{jsonpatch[_0xa03b('0x20')](_0x424b39,_0x51161d,!![]);}catch(_0x100235){return BPromise[_0xa03b('0x21')](_0x100235);}return _0x424b39[_0xa03b('0x22')]();};}function saveUpdates(_0x1d626e,_0x2a35ec){return function(_0x12876c){if(_0x12876c){return _0x12876c['update'](_0x1d626e)[_0xa03b('0x23')](function(_0xfd8546){return _0xfd8546;});}return null;};}function removeEntity(_0xc2558c,_0x24dc5b){return function(_0x470735){if(_0x470735){return _0x470735[_0xa03b('0x24')]()['then'](function(){var _0x20b890=_0x470735[_0xa03b('0x25')]({'plain':!![]});var _0x1a3c86=_0xa03b('0x26');return db[_0xa03b('0x27')][_0xa03b('0x24')]({'where':{'type':_0x1a3c86,'resourceId':_0x20b890['id']}})[_0xa03b('0x23')](function(){return _0x470735;});})[_0xa03b('0x23')](function(){_0xc2558c[_0xa03b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf49422,_0x1f1ec8){return function(_0x5c2e00){if(!_0x5c2e00){_0xf49422['sendStatus'](0x194);}return _0x5c2e00;};}function handleError(_0x332389,_0x12a5f7){_0x12a5f7=_0x12a5f7||0x1f4;return function(_0x59752e){logger['error'](_0x59752e[_0xa03b('0x28')]);if(_0x59752e[_0xa03b('0x29')]){delete _0x59752e[_0xa03b('0x29')];}_0x332389[_0xa03b('0x18')](_0x12a5f7)[_0xa03b('0x2a')](_0x59752e);};}exports[_0xa03b('0x2b')]=function(_0x3f51ae,_0x68ac5e){var _0x17bcb1={},_0x52a882={},_0x414feb={'count':0x0,'rows':[]};var _0x5b0a1c=_[_0xa03b('0x2c')](db[_0xa03b('0x2d')][_0xa03b('0x2e')],function(_0x5ec1e7){return{'name':_0x5ec1e7[_0xa03b('0x2f')],'type':_0x5ec1e7[_0xa03b('0x30')]['key']};});_0x52a882['model']=_[_0xa03b('0x2c')](_0x5b0a1c,_0xa03b('0x29'));_0x52a882[_0xa03b('0x31')]=_[_0xa03b('0x32')](_0x3f51ae['query']);_0x52a882[_0xa03b('0x33')]=_[_0xa03b('0x34')](_0x52a882[_0xa03b('0x35')],_0x52a882[_0xa03b('0x31')]);_0x17bcb1[_0xa03b('0x36')]=_[_0xa03b('0x34')](_0x52a882['model'],qs[_0xa03b('0x37')](_0x3f51ae[_0xa03b('0x31')][_0xa03b('0x37')]));_0x17bcb1[_0xa03b('0x36')]=_0x17bcb1[_0xa03b('0x36')]['length']?_0x17bcb1[_0xa03b('0x36')]:_0x52a882[_0xa03b('0x35')];if(!_0x3f51ae[_0xa03b('0x31')][_0xa03b('0x38')]('nolimit')){_0x17bcb1[_0xa03b('0x1b')]=qs[_0xa03b('0x1b')](_0x3f51ae[_0xa03b('0x31')][_0xa03b('0x1b')]);_0x17bcb1[_0xa03b('0x1d')]=qs[_0xa03b('0x1d')](_0x3f51ae['query']['offset']);}_0x17bcb1[_0xa03b('0x39')]=qs[_0xa03b('0x3a')](_0x3f51ae[_0xa03b('0x31')][_0xa03b('0x3a')]);_0x17bcb1['where']=qs[_0xa03b('0x33')](_[_0xa03b('0x3b')](_0x3f51ae[_0xa03b('0x31')],_0x52a882[_0xa03b('0x33')]),_0x5b0a1c);if(_0x3f51ae['query'][_0xa03b('0x3c')]){_0x17bcb1['where']=_['merge'](_0x17bcb1[_0xa03b('0x3d')],{'$or':_[_0xa03b('0x2c')](_0x5b0a1c,function(_0x5107cd){if(_0x5107cd['type']!=='VIRTUAL'){var _0x18cd92={};_0x18cd92[_0x5107cd[_0xa03b('0x29')]]={'$like':'%'+_0x3f51ae['query'][_0xa03b('0x3c')]+'%'};return _0x18cd92;}})});}_0x17bcb1=_[_0xa03b('0x3e')]({},_0x17bcb1,_0x3f51ae[_0xa03b('0x3f')]);var _0x2f6048={'where':_0x17bcb1['where']};return db['Trigger'][_0xa03b('0x1c')](_0x2f6048)[_0xa03b('0x23')](function(_0x5f42d8){_0x414feb[_0xa03b('0x1c')]=_0x5f42d8;if(_0x3f51ae[_0xa03b('0x31')]['includeAll']){_0x17bcb1['include']=[{'all':!![]}];}return db['Trigger'][_0xa03b('0x40')](_0x17bcb1);})[_0xa03b('0x23')](function(_0x21ad44){_0x414feb[_0xa03b('0x41')]=_0x21ad44;return _0x414feb;})['then'](respondWithFilteredResult(_0x68ac5e,_0x17bcb1))[_0xa03b('0x42')](handleError(_0x68ac5e,null));};exports[_0xa03b('0x43')]=function(_0x121b33,_0xb49185){var _0x173609={'raw':![],'where':{'id':_0x121b33[_0xa03b('0x44')]['id']}},_0x136fda={};_0x136fda['model']=_[_0xa03b('0x32')](db[_0xa03b('0x2d')][_0xa03b('0x2e')]);_0x136fda['query']=_[_0xa03b('0x32')](_0x121b33[_0xa03b('0x31')]);_0x136fda[_0xa03b('0x33')]=_['intersection'](_0x136fda[_0xa03b('0x35')],_0x136fda['query']);_0x173609[_0xa03b('0x36')]=_['intersection'](_0x136fda['model'],qs['fields'](_0x121b33[_0xa03b('0x31')][_0xa03b('0x37')]));_0x173609['attributes']=_0x173609[_0xa03b('0x36')]['length']?_0x173609[_0xa03b('0x36')]:_0x136fda['model'];if(_0x121b33['query'][_0xa03b('0x45')]){_0x173609['include']=[{'all':!![]}];}_0x173609=_[_0xa03b('0x3e')]({},_0x173609,_0x121b33[_0xa03b('0x3f')]);return db[_0xa03b('0x2d')]['find'](_0x173609)['then'](handleEntityNotFound(_0xb49185,null))[_0xa03b('0x23')](respondWithResult(_0xb49185,null))[_0xa03b('0x42')](handleError(_0xb49185,null));};exports[_0xa03b('0x46')]=function(_0x4afcb3,_0x460605){return db[_0xa03b('0x2d')][_0xa03b('0x46')](_0x4afcb3['body'],{})['then'](function(_0x4dea0a){var _0x55c048=_0x4afcb3[_0xa03b('0x47')]['get']({'plain':!![]});if(!_0x55c048)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55c048[_0xa03b('0x48')]===_0xa03b('0x47')){var _0x1c6bb5=_0x4dea0a['get']({'plain':!![]});var _0x22fe03=_0xa03b('0x26');return db['UserProfileSection'][_0xa03b('0x49')]({'where':{'name':_0x22fe03,'userProfileId':_0x55c048[_0xa03b('0x4a')]},'raw':!![]})['then'](function(_0x274036){if(_0x274036&&_0x274036[_0xa03b('0x4b')]===0x0){return db['UserProfileResource'][_0xa03b('0x46')]({'name':_0x1c6bb5[_0xa03b('0x29')],'resourceId':_0x1c6bb5['id'],'type':_0x274036[_0xa03b('0x29')],'sectionId':_0x274036['id']},{})['then'](function(){return _0x4dea0a;});}else{return _0x4dea0a;}})['catch'](function(_0x98477e){logger[_0xa03b('0x4c')](_0xa03b('0x4d'),_0x98477e);throw _0x98477e;});}return _0x4dea0a;})[_0xa03b('0x23')](respondWithResult(_0x460605,0xc9))['catch'](handleError(_0x460605,null));};exports[_0xa03b('0x4e')]=function(_0x1fa5b1,_0x5c3bcd){if(_0x1fa5b1[_0xa03b('0x4f')]['id']){delete _0x1fa5b1[_0xa03b('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1fa5b1['params']['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x5c3bcd,null))[_0xa03b('0x23')](saveUpdates(_0x1fa5b1[_0xa03b('0x4f')],null))[_0xa03b('0x23')](respondWithResult(_0x5c3bcd,null))['catch'](handleError(_0x5c3bcd,null));};exports[_0xa03b('0x24')]=function(_0x59c56d,_0x2c6a14){return db[_0xa03b('0x2d')][_0xa03b('0x49')]({'where':{'id':_0x59c56d[_0xa03b('0x44')]['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x2c6a14,null))[_0xa03b('0x23')](removeEntity(_0x2c6a14,null))[_0xa03b('0x42')](handleError(_0x2c6a14,null));};exports[_0xa03b('0x50')]=function(_0x252167,_0x39ed08,_0x576be5){if(_0x252167[_0xa03b('0x4f')]['id']){delete _0x252167[_0xa03b('0x4f')]['id'];}return db[_0xa03b('0x2d')][_0xa03b('0x49')]({'where':{'id':_0x252167[_0xa03b('0x44')]['id']}})['then'](handleEntityNotFound(_0x39ed08,null))['then'](function(_0x54e3c9){if(_0x54e3c9){_0x252167[_0xa03b('0x4f')]['TriggerAllId']=_0x54e3c9['id'];return db['Condition'][_0xa03b('0x46')](_0x252167[_0xa03b('0x4f')]);}})[_0xa03b('0x23')](respondWithResult(_0x39ed08,null))[_0xa03b('0x42')](handleError(_0x39ed08,null));};exports[_0xa03b('0x51')]=function(_0x13efd3,_0x1702a2,_0x4ee3d5){if(_0x13efd3[_0xa03b('0x4f')]['id']){delete _0x13efd3[_0xa03b('0x4f')]['id'];}return db['Trigger'][_0xa03b('0x49')]({'where':{'id':_0x13efd3[_0xa03b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1702a2,null))[_0xa03b('0x23')](function(_0xf750d0){if(_0xf750d0){_0x13efd3[_0xa03b('0x4f')]['TriggerAnyId']=_0xf750d0['id'];return db[_0xa03b('0x52')][_0xa03b('0x46')](_0x13efd3[_0xa03b('0x4f')]);}})[_0xa03b('0x23')](respondWithResult(_0x1702a2,null))[_0xa03b('0x42')](handleError(_0x1702a2,null));};exports[_0xa03b('0x53')]=function(_0x5ce313,_0x4085ff,_0x57faff){var _0x88d6d5={};var _0x326fba={};var _0x3d3372;var _0x5746b4;return db['Trigger'][_0xa03b('0x54')]({'where':{'id':_0x5ce313['params']['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x4085ff,null))[_0xa03b('0x23')](function(_0x14e5f7){if(_0x14e5f7){_0x3d3372=_0x14e5f7;_0x326fba[_0xa03b('0x35')]=_[_0xa03b('0x32')](db[_0xa03b('0x52')][_0xa03b('0x2e')]);_0x326fba[_0xa03b('0x31')]=_[_0xa03b('0x32')](_0x5ce313[_0xa03b('0x31')]);_0x326fba[_0xa03b('0x33')]=_[_0xa03b('0x34')](_0x326fba[_0xa03b('0x35')],_0x326fba['query']);_0x88d6d5[_0xa03b('0x36')]=_['intersection'](_0x326fba['model'],qs[_0xa03b('0x37')](_0x5ce313[_0xa03b('0x31')][_0xa03b('0x37')]));_0x88d6d5[_0xa03b('0x36')]=_0x88d6d5[_0xa03b('0x36')][_0xa03b('0x55')]?_0x88d6d5[_0xa03b('0x36')]:_0x326fba[_0xa03b('0x35')];_0x88d6d5[_0xa03b('0x39')]=qs[_0xa03b('0x3a')](_0x5ce313[_0xa03b('0x31')][_0xa03b('0x3a')]);_0x88d6d5[_0xa03b('0x3d')]=qs['filters'](_[_0xa03b('0x3b')](_0x5ce313['query'],_0x326fba[_0xa03b('0x33')]));if(_0x5ce313[_0xa03b('0x31')]['filter']){_0x88d6d5['where']=_['merge'](_0x88d6d5[_0xa03b('0x3d')],{'$or':_[_0xa03b('0x2c')](_0x88d6d5[_0xa03b('0x36')],function(_0x12ee8e){var _0x2d4195={};_0x2d4195[_0x12ee8e]={'$like':'%'+_0x5ce313[_0xa03b('0x31')][_0xa03b('0x3c')]+'%'};return _0x2d4195;})});}_0x88d6d5=_['merge']({},_0x88d6d5,_0x5ce313['options']);return _0x3d3372[_0xa03b('0x53')](_0x88d6d5);}})[_0xa03b('0x23')](function(_0x46b32d){if(_0x46b32d){_0x5746b4=_0x46b32d['length'];if(!_0x5ce313[_0xa03b('0x31')]['hasOwnProperty'](_0xa03b('0x56'))){_0x88d6d5[_0xa03b('0x1b')]=qs['limit'](_0x5ce313[_0xa03b('0x31')][_0xa03b('0x1b')]);_0x88d6d5['offset']=qs[_0xa03b('0x1d')](_0x5ce313[_0xa03b('0x31')]['offset']);}return _0x3d3372[_0xa03b('0x53')](_0x88d6d5);}})['then'](function(_0x197bf6){if(_0x197bf6){return _0x197bf6?{'count':_0x5746b4,'rows':_0x197bf6}:null;}})[_0xa03b('0x23')](respondWithResult(_0x4085ff,null))[_0xa03b('0x42')](handleError(_0x4085ff,null));};exports[_0xa03b('0x57')]=function(_0x2defb6,_0x28ae45,_0x140e65){var _0x3b9de4={};var _0x544f32={};var _0x1a75ef;var _0x33bd73;return db['Trigger'][_0xa03b('0x54')]({'where':{'id':_0x2defb6['params']['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x28ae45,null))[_0xa03b('0x23')](function(_0x578158){if(_0x578158){_0x1a75ef=_0x578158;_0x544f32[_0xa03b('0x35')]=_['keys'](db[_0xa03b('0x52')]['rawAttributes']);_0x544f32[_0xa03b('0x31')]=_[_0xa03b('0x32')](_0x2defb6['query']);_0x544f32['filters']=_[_0xa03b('0x34')](_0x544f32['model'],_0x544f32[_0xa03b('0x31')]);_0x3b9de4[_0xa03b('0x36')]=_[_0xa03b('0x34')](_0x544f32['model'],qs['fields'](_0x2defb6[_0xa03b('0x31')][_0xa03b('0x37')]));_0x3b9de4[_0xa03b('0x36')]=_0x3b9de4[_0xa03b('0x36')][_0xa03b('0x55')]?_0x3b9de4[_0xa03b('0x36')]:_0x544f32[_0xa03b('0x35')];_0x3b9de4[_0xa03b('0x39')]=qs[_0xa03b('0x3a')](_0x2defb6[_0xa03b('0x31')][_0xa03b('0x3a')]);_0x3b9de4[_0xa03b('0x3d')]=qs['filters'](_[_0xa03b('0x3b')](_0x2defb6[_0xa03b('0x31')],_0x544f32[_0xa03b('0x33')]));if(_0x2defb6[_0xa03b('0x31')][_0xa03b('0x3c')]){_0x3b9de4[_0xa03b('0x3d')]=_[_0xa03b('0x3e')](_0x3b9de4['where'],{'$or':_['map'](_0x3b9de4['attributes'],function(_0x552ea1){var _0x43f51e={};_0x43f51e[_0x552ea1]={'$like':'%'+_0x2defb6[_0xa03b('0x31')][_0xa03b('0x3c')]+'%'};return _0x43f51e;})});}_0x3b9de4=_['merge']({},_0x3b9de4,_0x2defb6[_0xa03b('0x3f')]);return _0x1a75ef['getAnyConditions'](_0x3b9de4);}})['then'](function(_0x56862d){if(_0x56862d){_0x33bd73=_0x56862d[_0xa03b('0x55')];if(!_0x2defb6['query'][_0xa03b('0x38')](_0xa03b('0x56'))){_0x3b9de4['limit']=qs['limit'](_0x2defb6['query'][_0xa03b('0x1b')]);_0x3b9de4[_0xa03b('0x1d')]=qs[_0xa03b('0x1d')](_0x2defb6[_0xa03b('0x31')]['offset']);}return _0x1a75ef[_0xa03b('0x57')](_0x3b9de4);}})['then'](function(_0x592830){if(_0x592830){return _0x592830?{'count':_0x33bd73,'rows':_0x592830}:null;}})[_0xa03b('0x23')](respondWithResult(_0x28ae45,null))[_0xa03b('0x42')](handleError(_0x28ae45,null));};exports['addAction']=function(_0xbf6057,_0x3f125c,_0x31ce2a){if(_0xbf6057[_0xa03b('0x4f')]['id']){delete _0xbf6057[_0xa03b('0x4f')]['id'];}return db[_0xa03b('0x2d')][_0xa03b('0x49')]({'where':{'id':_0xbf6057['params']['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x3f125c,null))[_0xa03b('0x23')](function(_0x13bd04){if(_0x13bd04){_0xbf6057[_0xa03b('0x4f')][_0xa03b('0x58')]=_0x13bd04['id'];return db[_0xa03b('0x59')][_0xa03b('0x46')](_0xbf6057[_0xa03b('0x4f')]);}})['then'](respondWithResult(_0x3f125c,null))['catch'](handleError(_0x3f125c,null));};exports['getActions']=function(_0x247cc2,_0x343b63,_0x417da4){var _0x23a5a7={};var _0x5a38e6={};var _0x5ce31e;var _0xbbc657;return db[_0xa03b('0x2d')][_0xa03b('0x54')]({'where':{'id':_0x247cc2[_0xa03b('0x44')]['id']}})[_0xa03b('0x23')](handleEntityNotFound(_0x343b63,null))[_0xa03b('0x23')](function(_0x38417){if(_0x38417){_0x5ce31e=_0x38417;_0x5a38e6[_0xa03b('0x35')]=_['keys'](db[_0xa03b('0x59')][_0xa03b('0x2e')]);_0x5a38e6[_0xa03b('0x31')]=_['keys'](_0x247cc2['query']);_0x5a38e6[_0xa03b('0x33')]=_['intersection'](_0x5a38e6[_0xa03b('0x35')],_0x5a38e6[_0xa03b('0x31')]);_0x23a5a7['attributes']=_[_0xa03b('0x34')](_0x5a38e6['model'],qs[_0xa03b('0x37')](_0x247cc2[_0xa03b('0x31')][_0xa03b('0x37')]));_0x23a5a7[_0xa03b('0x36')]=_0x23a5a7[_0xa03b('0x36')][_0xa03b('0x55')]?_0x23a5a7[_0xa03b('0x36')]:_0x5a38e6[_0xa03b('0x35')];_0x23a5a7[_0xa03b('0x39')]=qs[_0xa03b('0x3a')](_0x247cc2[_0xa03b('0x31')][_0xa03b('0x3a')]);_0x23a5a7['where']=qs[_0xa03b('0x33')](_[_0xa03b('0x3b')](_0x247cc2['query'],_0x5a38e6[_0xa03b('0x33')]));if(_0x247cc2[_0xa03b('0x31')]['filter']){_0x23a5a7[_0xa03b('0x3d')]=_['merge'](_0x23a5a7[_0xa03b('0x3d')],{'$or':_['map'](_0x23a5a7['attributes'],function(_0x4068ad){var _0x5494b0={};_0x5494b0[_0x4068ad]={'$like':'%'+_0x247cc2[_0xa03b('0x31')][_0xa03b('0x3c')]+'%'};return _0x5494b0;})});}_0x23a5a7=_[_0xa03b('0x3e')]({},_0x23a5a7,_0x247cc2[_0xa03b('0x3f')]);return _0x5ce31e['getActions'](_0x23a5a7);}})['then'](function(_0x1f5e58){if(_0x1f5e58){_0xbbc657=_0x1f5e58['length'];if(!_0x247cc2[_0xa03b('0x31')][_0xa03b('0x38')](_0xa03b('0x56'))){_0x23a5a7['limit']=qs[_0xa03b('0x1b')](_0x247cc2[_0xa03b('0x31')][_0xa03b('0x1b')]);_0x23a5a7['offset']=qs['offset'](_0x247cc2['query'][_0xa03b('0x1d')]);}return _0x5ce31e[_0xa03b('0x5a')](_0x23a5a7);}})['then'](function(_0x411a78){if(_0x411a78){return _0x411a78?{'count':_0xbbc657,'rows':_0x411a78}:null;}})[_0xa03b('0x23')](respondWithResult(_0x343b63,null))[_0xa03b('0x42')](handleError(_0x343b63,null));}; \ No newline at end of file +var _0x56a6=['count','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','Trigger','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','user','role','Triggers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','Condition','sort','filter','getAnyConditions','addAction','TriggerId','getActions','Action','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x19c05d,_0x1253ad){var _0x167988=function(_0x437221){while(--_0x437221){_0x19c05d['push'](_0x19c05d['shift']());}};_0x167988(++_0x1253ad);}(_0x56a6,0x9b));var _0x656a=function(_0x367551,_0x17634d){_0x367551=_0x367551-0x0;var _0x3254f8=_0x56a6[_0x367551];return _0x3254f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x656a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x656a('0x1'));var rp=require(_0x656a('0x2'));var moment=require('moment');var BPromise=require(_0x656a('0x3'));var Mustache=require(_0x656a('0x4'));var util=require('util');var path=require(_0x656a('0x5'));var sox=require(_0x656a('0x6'));var csv=require(_0x656a('0x7'));var ejs=require(_0x656a('0x8'));var fs=require('fs');var fs_extra=require(_0x656a('0x9'));var _=require(_0x656a('0xa'));var squel=require(_0x656a('0xb'));var crypto=require('crypto');var jsforce=require(_0x656a('0xc'));var deskjs=require(_0x656a('0xd'));var toCsv=require(_0x656a('0x7'));var querystring=require(_0x656a('0xe'));var Papa=require(_0x656a('0xf'));var Redis=require(_0x656a('0x10'));var authService=require(_0x656a('0x11'));var qs=require(_0x656a('0x12'));var as=require(_0x656a('0x13'));var hardwareService=require(_0x656a('0x14'));var logger=require(_0x656a('0x15'))(_0x656a('0x16'));var utils=require(_0x656a('0x17'));var config=require(_0x656a('0x18'));var licenseUtil=require(_0x656a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa203,_0x532303){_0x532303=_0x532303||0xcc;return function(_0x216c57){if(_0x216c57){return _0x1fa203[_0x656a('0x1a')](_0x532303);}return _0x1fa203['status'](_0x532303)[_0x656a('0x1b')]();};}function respondWithResult(_0x44047f,_0x245fb8){_0x245fb8=_0x245fb8||0xc8;return function(_0x690ba9){if(_0x690ba9){return _0x44047f[_0x656a('0x1c')](_0x245fb8)[_0x656a('0x1d')](_0x690ba9);}};}function respondWithFilteredResult(_0x5e2e7d,_0x27aa62){return function(_0x16f6df){if(_0x16f6df){var _0x5a9f74=typeof _0x27aa62[_0x656a('0x1e')]==='undefined'&&typeof _0x27aa62[_0x656a('0x1f')]===_0x656a('0x20');var _0x19263f=_0x16f6df['count'];var _0x56b6c0=_0x5a9f74?0x0:_0x27aa62[_0x656a('0x1e')];var _0x573103=_0x5a9f74?_0x16f6df[_0x656a('0x21')]:_0x27aa62[_0x656a('0x1e')]+_0x27aa62[_0x656a('0x1f')];var _0x5dd4f4;if(_0x573103>=_0x19263f){_0x573103=_0x19263f;_0x5dd4f4=0xc8;}else{_0x5dd4f4=0xce;}_0x5e2e7d[_0x656a('0x1c')](_0x5dd4f4);return _0x5e2e7d['set'](_0x656a('0x22'),_0x56b6c0+'-'+_0x573103+'/'+_0x19263f)[_0x656a('0x1d')](_0x16f6df);}return null;};}function patchUpdates(_0x41c1bc){return function(_0x94c065){try{jsonpatch[_0x656a('0x23')](_0x94c065,_0x41c1bc,!![]);}catch(_0x1984c3){return BPromise[_0x656a('0x24')](_0x1984c3);}return _0x94c065['save']();};}function saveUpdates(_0x1c2ec4,_0x43dc5b){return function(_0x42b188){if(_0x42b188){return _0x42b188['update'](_0x1c2ec4)[_0x656a('0x25')](function(_0x4ce777){return _0x4ce777;});}return null;};}function removeEntity(_0x2b7fc3,_0x31f928){return function(_0x2b890b){if(_0x2b890b){return _0x2b890b[_0x656a('0x26')]()['then'](function(){var _0x2a8588=_0x2b890b[_0x656a('0x27')]({'plain':!![]});var _0x10d9eb='Triggers';return db[_0x656a('0x28')]['destroy']({'where':{'type':_0x10d9eb,'resourceId':_0x2a8588['id']}})[_0x656a('0x25')](function(){return _0x2b890b;});})[_0x656a('0x25')](function(){_0x2b7fc3[_0x656a('0x1c')](0xcc)[_0x656a('0x1b')]();});}};}function handleEntityNotFound(_0x515fa8,_0x7eb879){return function(_0x135122){if(!_0x135122){_0x515fa8[_0x656a('0x1a')](0x194);}return _0x135122;};}function handleError(_0xc438a9,_0x58f211){_0x58f211=_0x58f211||0x1f4;return function(_0x220d8e){logger[_0x656a('0x29')](_0x220d8e[_0x656a('0x2a')]);if(_0x220d8e['name']){delete _0x220d8e[_0x656a('0x2b')];}_0xc438a9[_0x656a('0x1c')](_0x58f211)[_0x656a('0x2c')](_0x220d8e);};}exports[_0x656a('0x2d')]=function(_0x46195b,_0x170ace){var _0x57a83f={},_0x21e582={},_0x38908d={'count':0x0,'rows':[]};var _0x436c9e=_['map'](db[_0x656a('0x2e')][_0x656a('0x2f')],function(_0x1994bb){return{'name':_0x1994bb['fieldName'],'type':_0x1994bb[_0x656a('0x30')]['key']};});_0x21e582[_0x656a('0x31')]=_[_0x656a('0x32')](_0x436c9e,_0x656a('0x2b'));_0x21e582[_0x656a('0x33')]=_[_0x656a('0x34')](_0x46195b[_0x656a('0x33')]);_0x21e582[_0x656a('0x35')]=_[_0x656a('0x36')](_0x21e582['model'],_0x21e582[_0x656a('0x33')]);_0x57a83f[_0x656a('0x37')]=_[_0x656a('0x36')](_0x21e582[_0x656a('0x31')],qs[_0x656a('0x38')](_0x46195b[_0x656a('0x33')][_0x656a('0x38')]));_0x57a83f['attributes']=_0x57a83f[_0x656a('0x37')][_0x656a('0x39')]?_0x57a83f[_0x656a('0x37')]:_0x21e582['model'];if(!_0x46195b[_0x656a('0x33')][_0x656a('0x3a')](_0x656a('0x3b'))){_0x57a83f[_0x656a('0x1f')]=qs[_0x656a('0x1f')](_0x46195b[_0x656a('0x33')][_0x656a('0x1f')]);_0x57a83f[_0x656a('0x1e')]=qs[_0x656a('0x1e')](_0x46195b[_0x656a('0x33')][_0x656a('0x1e')]);}_0x57a83f[_0x656a('0x3c')]=qs['sort'](_0x46195b[_0x656a('0x33')]['sort']);_0x57a83f[_0x656a('0x3d')]=qs['filters'](_[_0x656a('0x3e')](_0x46195b[_0x656a('0x33')],_0x21e582[_0x656a('0x35')]),_0x436c9e);if(_0x46195b[_0x656a('0x33')]['filter']){_0x57a83f['where']=_['merge'](_0x57a83f['where'],{'$or':_['map'](_0x436c9e,function(_0x462c20){if(_0x462c20[_0x656a('0x30')]!==_0x656a('0x3f')){var _0x5bec3d={};_0x5bec3d[_0x462c20[_0x656a('0x2b')]]={'$like':'%'+_0x46195b[_0x656a('0x33')]['filter']+'%'};return _0x5bec3d;}})});}_0x57a83f=_[_0x656a('0x40')]({},_0x57a83f,_0x46195b[_0x656a('0x41')]);var _0x3950d2={'where':_0x57a83f['where']};return db[_0x656a('0x2e')]['count'](_0x3950d2)[_0x656a('0x25')](function(_0x42b7dd){_0x38908d['count']=_0x42b7dd;if(_0x46195b[_0x656a('0x33')][_0x656a('0x42')]){_0x57a83f[_0x656a('0x43')]=[{'all':!![]}];}return db[_0x656a('0x2e')]['findAll'](_0x57a83f);})[_0x656a('0x25')](function(_0x1beb54){_0x38908d[_0x656a('0x44')]=_0x1beb54;return _0x38908d;})[_0x656a('0x25')](respondWithFilteredResult(_0x170ace,_0x57a83f))[_0x656a('0x45')](handleError(_0x170ace,null));};exports['show']=function(_0x292484,_0x2960a3){var _0x3b6136={'raw':![],'where':{'id':_0x292484[_0x656a('0x46')]['id']}},_0x1af4ea={};_0x1af4ea[_0x656a('0x31')]=_[_0x656a('0x34')](db['Trigger'][_0x656a('0x2f')]);_0x1af4ea[_0x656a('0x33')]=_[_0x656a('0x34')](_0x292484[_0x656a('0x33')]);_0x1af4ea[_0x656a('0x35')]=_[_0x656a('0x36')](_0x1af4ea['model'],_0x1af4ea[_0x656a('0x33')]);_0x3b6136[_0x656a('0x37')]=_[_0x656a('0x36')](_0x1af4ea['model'],qs['fields'](_0x292484['query'][_0x656a('0x38')]));_0x3b6136[_0x656a('0x37')]=_0x3b6136['attributes'][_0x656a('0x39')]?_0x3b6136[_0x656a('0x37')]:_0x1af4ea[_0x656a('0x31')];if(_0x292484[_0x656a('0x33')]['includeAll']){_0x3b6136[_0x656a('0x43')]=[{'all':!![]}];}_0x3b6136=_[_0x656a('0x40')]({},_0x3b6136,_0x292484[_0x656a('0x41')]);return db[_0x656a('0x2e')][_0x656a('0x47')](_0x3b6136)['then'](handleEntityNotFound(_0x2960a3,null))[_0x656a('0x25')](respondWithResult(_0x2960a3,null))['catch'](handleError(_0x2960a3,null));};exports['create']=function(_0x2cf9a0,_0x2d51c9){return db[_0x656a('0x2e')][_0x656a('0x48')](_0x2cf9a0['body'],{})[_0x656a('0x25')](function(_0x1b3751){var _0x1070e1=_0x2cf9a0[_0x656a('0x49')][_0x656a('0x27')]({'plain':!![]});if(!_0x1070e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1070e1[_0x656a('0x4a')]===_0x656a('0x49')){var _0xc4599e=_0x1b3751[_0x656a('0x27')]({'plain':!![]});var _0xd2e697=_0x656a('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0xd2e697,'userProfileId':_0x1070e1['userProfileId']},'raw':!![]})['then'](function(_0x581696){if(_0x581696&&_0x581696[_0x656a('0x4c')]===0x0){return db['UserProfileResource'][_0x656a('0x48')]({'name':_0xc4599e['name'],'resourceId':_0xc4599e['id'],'type':_0x581696[_0x656a('0x2b')],'sectionId':_0x581696['id']},{})[_0x656a('0x25')](function(){return _0x1b3751;});}else{return _0x1b3751;}})[_0x656a('0x45')](function(_0x13289e){logger['error'](_0x656a('0x4d'),_0x13289e);throw _0x13289e;});}return _0x1b3751;})[_0x656a('0x25')](respondWithResult(_0x2d51c9,0xc9))[_0x656a('0x45')](handleError(_0x2d51c9,null));};exports[_0x656a('0x4e')]=function(_0xe5db8,_0xd79915){if(_0xe5db8[_0x656a('0x4f')]['id']){delete _0xe5db8[_0x656a('0x4f')]['id'];}return db['Trigger'][_0x656a('0x47')]({'where':{'id':_0xe5db8[_0x656a('0x46')]['id']}})['then'](handleEntityNotFound(_0xd79915,null))[_0x656a('0x25')](saveUpdates(_0xe5db8[_0x656a('0x4f')],null))[_0x656a('0x25')](respondWithResult(_0xd79915,null))[_0x656a('0x45')](handleError(_0xd79915,null));};exports[_0x656a('0x26')]=function(_0x5bc4a0,_0x5f0286){return db['Trigger'][_0x656a('0x47')]({'where':{'id':_0x5bc4a0[_0x656a('0x46')]['id']}})[_0x656a('0x25')](handleEntityNotFound(_0x5f0286,null))[_0x656a('0x25')](removeEntity(_0x5f0286,null))[_0x656a('0x45')](handleError(_0x5f0286,null));};exports[_0x656a('0x50')]=function(_0x2de2f,_0x2b588f,_0x366bf2){if(_0x2de2f['body']['id']){delete _0x2de2f[_0x656a('0x4f')]['id'];}return db[_0x656a('0x2e')]['find']({'where':{'id':_0x2de2f[_0x656a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b588f,null))[_0x656a('0x25')](function(_0x23adc0){if(_0x23adc0){_0x2de2f['body'][_0x656a('0x51')]=_0x23adc0['id'];return db['Condition'][_0x656a('0x48')](_0x2de2f['body']);}})[_0x656a('0x25')](respondWithResult(_0x2b588f,null))[_0x656a('0x45')](handleError(_0x2b588f,null));};exports[_0x656a('0x52')]=function(_0x5ef068,_0x5a05a1,_0x5342a6){if(_0x5ef068['body']['id']){delete _0x5ef068['body']['id'];}return db[_0x656a('0x2e')][_0x656a('0x47')]({'where':{'id':_0x5ef068[_0x656a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a05a1,null))[_0x656a('0x25')](function(_0x10d426){if(_0x10d426){_0x5ef068[_0x656a('0x4f')][_0x656a('0x53')]=_0x10d426['id'];return db['Condition']['create'](_0x5ef068['body']);}})[_0x656a('0x25')](respondWithResult(_0x5a05a1,null))['catch'](handleError(_0x5a05a1,null));};exports[_0x656a('0x54')]=function(_0x4b4169,_0x57b680,_0x2fb098){var _0x141d32={};var _0x366b7={};var _0x3a1fdb;var _0x32438f;return db[_0x656a('0x2e')][_0x656a('0x55')]({'where':{'id':_0x4b4169[_0x656a('0x46')]['id']}})[_0x656a('0x25')](handleEntityNotFound(_0x57b680,null))[_0x656a('0x25')](function(_0x3667e9){if(_0x3667e9){_0x3a1fdb=_0x3667e9;_0x366b7['model']=_[_0x656a('0x34')](db[_0x656a('0x56')][_0x656a('0x2f')]);_0x366b7[_0x656a('0x33')]=_['keys'](_0x4b4169['query']);_0x366b7[_0x656a('0x35')]=_[_0x656a('0x36')](_0x366b7['model'],_0x366b7[_0x656a('0x33')]);_0x141d32['attributes']=_[_0x656a('0x36')](_0x366b7[_0x656a('0x31')],qs[_0x656a('0x38')](_0x4b4169[_0x656a('0x33')]['fields']));_0x141d32[_0x656a('0x37')]=_0x141d32[_0x656a('0x37')][_0x656a('0x39')]?_0x141d32['attributes']:_0x366b7[_0x656a('0x31')];_0x141d32[_0x656a('0x3c')]=qs[_0x656a('0x57')](_0x4b4169[_0x656a('0x33')][_0x656a('0x57')]);_0x141d32[_0x656a('0x3d')]=qs['filters'](_[_0x656a('0x3e')](_0x4b4169[_0x656a('0x33')],_0x366b7[_0x656a('0x35')]));if(_0x4b4169[_0x656a('0x33')][_0x656a('0x58')]){_0x141d32['where']=_[_0x656a('0x40')](_0x141d32[_0x656a('0x3d')],{'$or':_[_0x656a('0x32')](_0x141d32[_0x656a('0x37')],function(_0x468bf2){var _0xa4f10={};_0xa4f10[_0x468bf2]={'$like':'%'+_0x4b4169[_0x656a('0x33')][_0x656a('0x58')]+'%'};return _0xa4f10;})});}_0x141d32=_[_0x656a('0x40')]({},_0x141d32,_0x4b4169[_0x656a('0x41')]);return _0x3a1fdb[_0x656a('0x54')](_0x141d32);}})[_0x656a('0x25')](function(_0x1ab1b8){if(_0x1ab1b8){_0x32438f=_0x1ab1b8[_0x656a('0x39')];if(!_0x4b4169[_0x656a('0x33')][_0x656a('0x3a')](_0x656a('0x3b'))){_0x141d32[_0x656a('0x1f')]=qs[_0x656a('0x1f')](_0x4b4169['query'][_0x656a('0x1f')]);_0x141d32['offset']=qs[_0x656a('0x1e')](_0x4b4169[_0x656a('0x33')][_0x656a('0x1e')]);}return _0x3a1fdb[_0x656a('0x54')](_0x141d32);}})['then'](function(_0x5c5067){if(_0x5c5067){return _0x5c5067?{'count':_0x32438f,'rows':_0x5c5067}:null;}})[_0x656a('0x25')](respondWithResult(_0x57b680,null))[_0x656a('0x45')](handleError(_0x57b680,null));};exports[_0x656a('0x59')]=function(_0x20114e,_0x1ececb,_0x578865){var _0x33b228={};var _0x5c549f={};var _0x295ed1;var _0x3105ca;return db[_0x656a('0x2e')][_0x656a('0x55')]({'where':{'id':_0x20114e[_0x656a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ececb,null))['then'](function(_0x4adf76){if(_0x4adf76){_0x295ed1=_0x4adf76;_0x5c549f[_0x656a('0x31')]=_[_0x656a('0x34')](db[_0x656a('0x56')][_0x656a('0x2f')]);_0x5c549f[_0x656a('0x33')]=_[_0x656a('0x34')](_0x20114e['query']);_0x5c549f[_0x656a('0x35')]=_['intersection'](_0x5c549f[_0x656a('0x31')],_0x5c549f[_0x656a('0x33')]);_0x33b228['attributes']=_[_0x656a('0x36')](_0x5c549f[_0x656a('0x31')],qs['fields'](_0x20114e[_0x656a('0x33')][_0x656a('0x38')]));_0x33b228[_0x656a('0x37')]=_0x33b228[_0x656a('0x37')]['length']?_0x33b228[_0x656a('0x37')]:_0x5c549f[_0x656a('0x31')];_0x33b228[_0x656a('0x3c')]=qs[_0x656a('0x57')](_0x20114e[_0x656a('0x33')][_0x656a('0x57')]);_0x33b228[_0x656a('0x3d')]=qs[_0x656a('0x35')](_[_0x656a('0x3e')](_0x20114e[_0x656a('0x33')],_0x5c549f[_0x656a('0x35')]));if(_0x20114e['query'][_0x656a('0x58')]){_0x33b228[_0x656a('0x3d')]=_['merge'](_0x33b228[_0x656a('0x3d')],{'$or':_[_0x656a('0x32')](_0x33b228[_0x656a('0x37')],function(_0x544573){var _0x37ec1a={};_0x37ec1a[_0x544573]={'$like':'%'+_0x20114e[_0x656a('0x33')][_0x656a('0x58')]+'%'};return _0x37ec1a;})});}_0x33b228=_[_0x656a('0x40')]({},_0x33b228,_0x20114e[_0x656a('0x41')]);return _0x295ed1[_0x656a('0x59')](_0x33b228);}})[_0x656a('0x25')](function(_0x5c5096){if(_0x5c5096){_0x3105ca=_0x5c5096['length'];if(!_0x20114e[_0x656a('0x33')]['hasOwnProperty'](_0x656a('0x3b'))){_0x33b228[_0x656a('0x1f')]=qs['limit'](_0x20114e[_0x656a('0x33')][_0x656a('0x1f')]);_0x33b228['offset']=qs[_0x656a('0x1e')](_0x20114e[_0x656a('0x33')][_0x656a('0x1e')]);}return _0x295ed1['getAnyConditions'](_0x33b228);}})[_0x656a('0x25')](function(_0x4f218d){if(_0x4f218d){return _0x4f218d?{'count':_0x3105ca,'rows':_0x4f218d}:null;}})[_0x656a('0x25')](respondWithResult(_0x1ececb,null))[_0x656a('0x45')](handleError(_0x1ececb,null));};exports[_0x656a('0x5a')]=function(_0x4fd5df,_0x2f7e93,_0x167fe9){if(_0x4fd5df[_0x656a('0x4f')]['id']){delete _0x4fd5df[_0x656a('0x4f')]['id'];}return db[_0x656a('0x2e')]['find']({'where':{'id':_0x4fd5df[_0x656a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f7e93,null))[_0x656a('0x25')](function(_0x180fa4){if(_0x180fa4){_0x4fd5df[_0x656a('0x4f')][_0x656a('0x5b')]=_0x180fa4['id'];return db['Action']['create'](_0x4fd5df[_0x656a('0x4f')]);}})['then'](respondWithResult(_0x2f7e93,null))['catch'](handleError(_0x2f7e93,null));};exports[_0x656a('0x5c')]=function(_0x3840bd,_0x43b8a1,_0x597c62){var _0x536e4e={};var _0x5a1c02={};var _0x3ca6fa;var _0x1ade90;return db[_0x656a('0x2e')][_0x656a('0x55')]({'where':{'id':_0x3840bd['params']['id']}})['then'](handleEntityNotFound(_0x43b8a1,null))[_0x656a('0x25')](function(_0x227b8e){if(_0x227b8e){_0x3ca6fa=_0x227b8e;_0x5a1c02[_0x656a('0x31')]=_['keys'](db[_0x656a('0x5d')][_0x656a('0x2f')]);_0x5a1c02['query']=_[_0x656a('0x34')](_0x3840bd[_0x656a('0x33')]);_0x5a1c02[_0x656a('0x35')]=_[_0x656a('0x36')](_0x5a1c02[_0x656a('0x31')],_0x5a1c02['query']);_0x536e4e['attributes']=_[_0x656a('0x36')](_0x5a1c02[_0x656a('0x31')],qs[_0x656a('0x38')](_0x3840bd[_0x656a('0x33')][_0x656a('0x38')]));_0x536e4e[_0x656a('0x37')]=_0x536e4e[_0x656a('0x37')][_0x656a('0x39')]?_0x536e4e[_0x656a('0x37')]:_0x5a1c02[_0x656a('0x31')];_0x536e4e[_0x656a('0x3c')]=qs[_0x656a('0x57')](_0x3840bd[_0x656a('0x33')][_0x656a('0x57')]);_0x536e4e[_0x656a('0x3d')]=qs[_0x656a('0x35')](_['pick'](_0x3840bd['query'],_0x5a1c02['filters']));if(_0x3840bd[_0x656a('0x33')][_0x656a('0x58')]){_0x536e4e[_0x656a('0x3d')]=_['merge'](_0x536e4e[_0x656a('0x3d')],{'$or':_[_0x656a('0x32')](_0x536e4e['attributes'],function(_0x3ec009){var _0x7d6431={};_0x7d6431[_0x3ec009]={'$like':'%'+_0x3840bd[_0x656a('0x33')][_0x656a('0x58')]+'%'};return _0x7d6431;})});}_0x536e4e=_[_0x656a('0x40')]({},_0x536e4e,_0x3840bd[_0x656a('0x41')]);return _0x3ca6fa['getActions'](_0x536e4e);}})[_0x656a('0x25')](function(_0x11a6d6){if(_0x11a6d6){_0x1ade90=_0x11a6d6[_0x656a('0x39')];if(!_0x3840bd[_0x656a('0x33')][_0x656a('0x3a')](_0x656a('0x3b'))){_0x536e4e['limit']=qs[_0x656a('0x1f')](_0x3840bd['query'][_0x656a('0x1f')]);_0x536e4e[_0x656a('0x1e')]=qs[_0x656a('0x1e')](_0x3840bd[_0x656a('0x33')][_0x656a('0x1e')]);}return _0x3ca6fa[_0x656a('0x5c')](_0x536e4e);}})['then'](function(_0x583ab7){if(_0x583ab7){return _0x583ab7?{'count':_0x1ade90,'rows':_0x583ab7}:null;}})[_0x656a('0x25')](respondWithResult(_0x43b8a1,null))[_0x656a('0x45')](handleError(_0x43b8a1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ba9e187..32243f4 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 _0xde50=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','Trigger'];(function(_0x4e1a50,_0x39adc7){var _0x30c219=function(_0x249fe4){while(--_0x249fe4){_0x4e1a50['push'](_0x4e1a50['shift']());}};_0x30c219(++_0x39adc7);}(_0xde50,0x140));var _0x0de5=function(_0x33719a,_0x1b9e9f){_0x33719a=_0x33719a-0x0;var _0x2d1391=_0xde50[_0x33719a];return _0x2d1391;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0de5('0x0'))(_0x0de5('0x1'));var moment=require(_0x0de5('0x2'));var BPromise=require(_0x0de5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de5('0x4'));var rimraf=require('rimraf');var config=require(_0x0de5('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x5f05a1,_0x444955){return _0x5f05a1[_0x0de5('0x6')](_0x0de5('0x7'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9585=['Trigger','tools_triggers','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x50d0ad,_0x359285){var _0x53bdf3=function(_0x28a445){while(--_0x28a445){_0x50d0ad['push'](_0x50d0ad['shift']());}};_0x53bdf3(++_0x359285);}(_0x9585,0x15e));var _0x5958=function(_0x2a5b0c,_0x284c86){_0x2a5b0c=_0x2a5b0c-0x0;var _0x35e7dd=_0x9585[_0x2a5b0c];return _0x35e7dd;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require('../../config/logger')(_0x5958('0x1'));var moment=require(_0x5958('0x2'));var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var fs=require('fs');var path=require(_0x5958('0x5'));var rimraf=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var attributes=require(_0x5958('0x8'));module['exports']=function(_0x202d6f,_0x48ddaf){return _0x202d6f[_0x5958('0x9')](_0x5958('0xa'),attributes,{'tableName':_0x5958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 082b4a0..8088495 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 _0x21bd=['rpc','client','http','request','then','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','findAll','options','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x160219,_0x44d746){var _0x3fa18d=function(_0x12f93c){while(--_0x12f93c){_0x160219['push'](_0x160219['shift']());}};_0x3fa18d(++_0x44d746);}(_0x21bd,0x157));var _0xd21b=function(_0x638529,_0x33415d){_0x638529=_0x638529-0x0;var _0x1c5a97=_0x21bd[_0x638529];return _0x1c5a97;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var moment=require(_0xd21b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd21b('0x3'));var fs=require('fs');var Redis=require(_0xd21b('0x4'));var db=require(_0xd21b('0x5'))['db'];var utils=require(_0xd21b('0x6'));var logger=require('../../config/logger')(_0xd21b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd21b('0x8')][_0xd21b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55bf09,_0x3faa25,_0x4034a5){return new BPromise(function(_0x2eeabb,_0x59154d){return client[_0xd21b('0xa')](_0x55bf09,_0x4034a5)[_0xd21b('0xb')](function(_0x20702d){logger['info']('Trigger,\x20%s,\x20%s',_0x3faa25,_0xd21b('0xc'));logger[_0xd21b('0xd')](_0xd21b('0xe'),_0x3faa25,'request\x20sent',JSON[_0xd21b('0xf')](_0x20702d));if(_0x20702d['error']){if(_0x20702d[_0xd21b('0x10')][_0xd21b('0x11')]===0x1f4){logger[_0xd21b('0x10')](_0xd21b('0x12'),_0x3faa25,_0x20702d[_0xd21b('0x10')][_0xd21b('0x13')]);return _0x59154d(_0x20702d[_0xd21b('0x10')]['message']);}logger[_0xd21b('0x10')](_0xd21b('0x12'),_0x3faa25,_0x20702d[_0xd21b('0x10')][_0xd21b('0x13')]);return _0x2eeabb(_0x20702d['error'][_0xd21b('0x13')]);}else{logger[_0xd21b('0x14')](_0xd21b('0x12'),_0x3faa25,_0xd21b('0xc'));_0x2eeabb(_0x20702d[_0xd21b('0x15')][_0xd21b('0x13')]);}})[_0xd21b('0x16')](function(_0x43e12e){logger['error'](_0xd21b('0x12'),_0x3faa25,_0x43e12e);_0x59154d(_0x43e12e);});});}exports['GetTrigger']=function(_0x4fe2e2){var _0x242c61=this;return new Promise(function(_0x1a6607,_0x3ab047){return db['Trigger'][_0xd21b('0x17')]({'raw':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x19')]||null:null,'attributes':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2['options'][_0xd21b('0x1a')]||null:null,'limit':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2['options'][_0xd21b('0x1b')]||null:null,'include':_0x4fe2e2[_0xd21b('0x18')]?_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x4fe2e2[_0xd21b('0x18')][_0xd21b('0x1c')],function(_0x5c4893){return{'model':db[_0x5c4893['model']],'as':_0x5c4893['as'],'attributes':_0x5c4893[_0xd21b('0x1a')],'include':_0x5c4893[_0xd21b('0x1c')]?_['map'](_0x5c4893[_0xd21b('0x1c')],function(_0x5ac946){return{'model':db[_0x5ac946['model']],'as':_0x5ac946['as'],'attributes':_0x5ac946[_0xd21b('0x1a')],'include':_0x5ac946[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x5ac946['include'],function(_0x29a7d3){return{'model':db[_0x29a7d3[_0xd21b('0x1e')]],'as':_0x29a7d3['as'],'attributes':_0x29a7d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd21b('0xb')](function(_0x3b5abd){logger[_0xd21b('0x14')](_0xd21b('0x1f'),_0x4fe2e2);logger['debug'](_0xd21b('0x1f'),_0x4fe2e2,JSON[_0xd21b('0xf')](_0x3b5abd));_0x1a6607(_0x3b5abd);})[_0xd21b('0x16')](function(_0x96c788){logger['error'](_0xd21b('0x1f'),_0x96c788[_0xd21b('0x13')],_0x4fe2e2);_0x3ab047(_0x242c61['error'](0x1f4,_0x96c788[_0xd21b('0x13')]));});});};exports[_0xd21b('0x20')]=function(_0x19dfdb){var _0x17b981=this;return new Promise(function(_0x26c2f9,_0x22d94f){return db['Trigger'][_0xd21b('0x21')]({'raw':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb['options'][_0xd21b('0x22')]===undefined?!![]:![]:!![],'where':_0x19dfdb['options']?_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x19')]||null:null,'attributes':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb['options'][_0xd21b('0x1a')]||null:null,'include':_0x19dfdb[_0xd21b('0x18')]?_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x19dfdb[_0xd21b('0x18')][_0xd21b('0x1c')],function(_0x139d32){return{'model':db[_0x139d32[_0xd21b('0x1e')]],'as':_0x139d32['as'],'attributes':_0x139d32[_0xd21b('0x1a')],'include':_0x139d32[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x139d32[_0xd21b('0x1c')],function(_0x4023b0){return{'model':db[_0x4023b0[_0xd21b('0x1e')]],'as':_0x4023b0['as'],'attributes':_0x4023b0[_0xd21b('0x1a')],'include':_0x4023b0[_0xd21b('0x1c')]?_[_0xd21b('0x1d')](_0x4023b0[_0xd21b('0x1c')],function(_0x2f09bd){return{'model':db[_0x2f09bd[_0xd21b('0x1e')]],'as':_0x2f09bd['as'],'attributes':_0x2f09bd[_0xd21b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd21b('0xb')](function(_0x53816c){logger[_0xd21b('0x14')](_0xd21b('0x20'),_0x19dfdb);logger[_0xd21b('0xd')](_0xd21b('0x20'),_0x19dfdb,JSON[_0xd21b('0xf')](_0x53816c));_0x26c2f9(_0x53816c);})[_0xd21b('0x16')](function(_0x34167c){logger['error']('ShowTrigger',_0x34167c[_0xd21b('0x13')],_0x19dfdb);_0x22d94f(_0x17b981['error'](0x1f4,_0x34167c[_0xd21b('0x13')]));});});}; \ No newline at end of file +var _0x534b=['message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x512adb,_0x52d6bf){var _0x246a74=function(_0x45183c){while(--_0x45183c){_0x512adb['push'](_0x512adb['shift']());}};_0x246a74(++_0x52d6bf);}(_0x534b,0x1a8));var _0xb534=function(_0x1afacd,_0x5d41fb){_0x1afacd=_0x1afacd-0x0;var _0x194245=_0x534b[_0x1afacd];return _0x194245;};'use strict';var _=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var moment=require(_0xb534('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb534('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb534('0x4'));var logger=require(_0xb534('0x5'))(_0xb534('0x6'));var config=require(_0xb534('0x7'));var jayson=require(_0xb534('0x8'));var client=jayson[_0xb534('0x9')][_0xb534('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467694,_0x141c5b,_0x24f052){return new BPromise(function(_0x4955eb,_0x338309){return client[_0xb534('0xb')](_0x467694,_0x24f052)[_0xb534('0xc')](function(_0x3ce5cf){logger['info'](_0xb534('0xd'),_0x141c5b,_0xb534('0xe'));logger[_0xb534('0xf')](_0xb534('0x10'),_0x141c5b,_0xb534('0xe'),JSON[_0xb534('0x11')](_0x3ce5cf));if(_0x3ce5cf[_0xb534('0x12')]){if(_0x3ce5cf[_0xb534('0x12')][_0xb534('0x13')]===0x1f4){logger['error'](_0xb534('0xd'),_0x141c5b,_0x3ce5cf[_0xb534('0x12')][_0xb534('0x14')]);return _0x338309(_0x3ce5cf[_0xb534('0x12')]['message']);}logger[_0xb534('0x12')](_0xb534('0xd'),_0x141c5b,_0x3ce5cf[_0xb534('0x12')]['message']);return _0x4955eb(_0x3ce5cf[_0xb534('0x12')]['message']);}else{logger[_0xb534('0x15')](_0xb534('0xd'),_0x141c5b,_0xb534('0xe'));_0x4955eb(_0x3ce5cf[_0xb534('0x16')][_0xb534('0x14')]);}})['catch'](function(_0x3c7a0e){logger[_0xb534('0x12')](_0xb534('0xd'),_0x141c5b,_0x3c7a0e);_0x338309(_0x3c7a0e);});});}exports[_0xb534('0x17')]=function(_0x706ab0){var _0x40d241=this;return new Promise(function(_0x55b9,_0x55ac50){return db[_0xb534('0x18')][_0xb534('0x19')]({'raw':_0x706ab0[_0xb534('0x1a')]?_0x706ab0['options'][_0xb534('0x1b')]===undefined?!![]:![]:!![],'where':_0x706ab0[_0xb534('0x1a')]?_0x706ab0[_0xb534('0x1a')][_0xb534('0x1c')]||null:null,'attributes':_0x706ab0[_0xb534('0x1a')]?_0x706ab0[_0xb534('0x1a')][_0xb534('0x1d')]||null:null,'limit':_0x706ab0[_0xb534('0x1a')]?_0x706ab0[_0xb534('0x1a')][_0xb534('0x1e')]||null:null,'include':_0x706ab0[_0xb534('0x1a')]?_0x706ab0[_0xb534('0x1a')][_0xb534('0x1f')]?_[_0xb534('0x20')](_0x706ab0[_0xb534('0x1a')][_0xb534('0x1f')],function(_0x537c27){return{'model':db[_0x537c27[_0xb534('0x21')]],'as':_0x537c27['as'],'attributes':_0x537c27[_0xb534('0x1d')],'include':_0x537c27['include']?_[_0xb534('0x20')](_0x537c27[_0xb534('0x1f')],function(_0x29c071){return{'model':db[_0x29c071[_0xb534('0x21')]],'as':_0x29c071['as'],'attributes':_0x29c071['attributes'],'include':_0x29c071[_0xb534('0x1f')]?_[_0xb534('0x20')](_0x29c071['include'],function(_0x59f3ee){return{'model':db[_0x59f3ee[_0xb534('0x21')]],'as':_0x59f3ee['as'],'attributes':_0x59f3ee[_0xb534('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5266e0){logger['info'](_0xb534('0x17'),_0x706ab0);logger['debug'](_0xb534('0x17'),_0x706ab0,JSON[_0xb534('0x11')](_0x5266e0));_0x55b9(_0x5266e0);})['catch'](function(_0x5caed8){logger[_0xb534('0x12')](_0xb534('0x17'),_0x5caed8[_0xb534('0x14')],_0x706ab0);_0x55ac50(_0x40d241[_0xb534('0x12')](0x1f4,_0x5caed8[_0xb534('0x14')]));});});};exports[_0xb534('0x22')]=function(_0x1d7fe6){var _0x351abb=this;return new Promise(function(_0x412df9,_0x3a1a11){return db['Trigger'][_0xb534('0x23')]({'raw':_0x1d7fe6[_0xb534('0x1a')]?_0x1d7fe6[_0xb534('0x1a')][_0xb534('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d7fe6[_0xb534('0x1a')]?_0x1d7fe6['options'][_0xb534('0x1c')]||null:null,'attributes':_0x1d7fe6['options']?_0x1d7fe6[_0xb534('0x1a')]['attributes']||null:null,'include':_0x1d7fe6[_0xb534('0x1a')]?_0x1d7fe6['options'][_0xb534('0x1f')]?_[_0xb534('0x20')](_0x1d7fe6[_0xb534('0x1a')][_0xb534('0x1f')],function(_0x50e190){return{'model':db[_0x50e190[_0xb534('0x21')]],'as':_0x50e190['as'],'attributes':_0x50e190['attributes'],'include':_0x50e190[_0xb534('0x1f')]?_[_0xb534('0x20')](_0x50e190[_0xb534('0x1f')],function(_0x1f654f){return{'model':db[_0x1f654f['model']],'as':_0x1f654f['as'],'attributes':_0x1f654f['attributes'],'include':_0x1f654f[_0xb534('0x1f')]?_['map'](_0x1f654f[_0xb534('0x1f')],function(_0xbf5293){return{'model':db[_0xbf5293[_0xb534('0x21')]],'as':_0xbf5293['as'],'attributes':_0xbf5293['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x427eaf){logger['info']('ShowTrigger',_0x1d7fe6);logger['debug']('ShowTrigger',_0x1d7fe6,JSON['stringify'](_0x427eaf));_0x412df9(_0x427eaf);})[_0xb534('0x24')](function(_0x452d37){logger[_0xb534('0x12')]('ShowTrigger',_0x452d37['message'],_0x1d7fe6);_0x3a1a11(_0x351abb[_0xb534('0x12')](0x1f4,_0x452d37[_0xb534('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 2e69af2..4a04ad8 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 _0x0396=['../../components/auth/service','./trunk.controller','get','isAuthenticated','/:id','show','/:id/clone','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x0396,0x19d));var _0x6039=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0396[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var path=require(_0x6039('0x2'));var timeout=require(_0x6039('0x3'));var express=require(_0x6039('0x4'));var router=express[_0x6039('0x5')]();var fs_extra=require(_0x6039('0x6'));var auth=require(_0x6039('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6039('0x8'));router[_0x6039('0x9')]('/',auth[_0x6039('0xa')](),controller['index']);router[_0x6039('0x9')](_0x6039('0xb'),auth[_0x6039('0xa')](),controller[_0x6039('0xc')]);router['post'](_0x6039('0xd'),auth[_0x6039('0xa')](),controller[_0x6039('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6039('0xf')]);router[_0x6039('0x10')](_0x6039('0xb'),auth[_0x6039('0xa')](),controller['update']);router[_0x6039('0x11')]('/:id',auth[_0x6039('0xa')](),controller[_0x6039('0x12')]);module[_0x6039('0x13')]=router; \ No newline at end of file +var _0x5acf=['multer','util','path','connect-timeout','express','../../components/auth/service','./trunk.controller','get','index','/:id','show','/:id/clone','clone','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x3ea9a4,_0x456ead){var _0x116803=function(_0x3fc35c){while(--_0x3fc35c){_0x3ea9a4['push'](_0x3ea9a4['shift']());}};_0x116803(++_0x456ead);}(_0x5acf,0x12c));var _0xf5ac=function(_0x182d72,_0x3a68dd){_0x182d72=_0x182d72-0x0;var _0x58280e=_0x5acf[_0x182d72];return _0x58280e;};'use strict';var multer=require(_0xf5ac('0x0'));var util=require(_0xf5ac('0x1'));var path=require(_0xf5ac('0x2'));var timeout=require(_0xf5ac('0x3'));var express=require(_0xf5ac('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf5ac('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5ac('0x6'));router[_0xf5ac('0x7')]('/',auth['isAuthenticated'](),controller[_0xf5ac('0x8')]);router[_0xf5ac('0x7')](_0xf5ac('0x9'),auth['isAuthenticated'](),controller[_0xf5ac('0xa')]);router['post'](_0xf5ac('0xb'),auth['isAuthenticated'](),controller[_0xf5ac('0xc')]);router[_0xf5ac('0xd')]('/',auth[_0xf5ac('0xe')](),controller[_0xf5ac('0xf')]);router[_0xf5ac('0x10')](_0xf5ac('0x9'),auth[_0xf5ac('0xe')](),controller[_0xf5ac('0x11')]);router[_0xf5ac('0x12')](_0xf5ac('0x9'),auth[_0xf5ac('0xe')](),controller[_0xf5ac('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 76e679c..40b17c8 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 _0xd146=['info','inband','nonat','update','yes','force_rport,comedia','nat','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','dynamic','update,nonat','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x20993e,_0x5aa54b){var _0x7c8bc2=function(_0x3b6be7){while(--_0x3b6be7){_0x20993e['push'](_0x20993e['shift']());}};_0x7c8bc2(++_0x5aa54b);}(_0xd146,0xb5));var _0x6d14=function(_0x197dda,_0x26cb2a){_0x197dda=_0x197dda-0x0;var _0x524804=_0xd146[_0x197dda];return _0x524804;};'use strict';var Sequelize=require(_0x6d14('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d14('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x3'),_0x6d14('0x4'),_0x6d14('0x5')),'allowNull':![],'defaultValue':_0x6d14('0x3')},'context':{'type':Sequelize[_0x6d14('0x1')],'allowNull':![],'defaultValue':_0x6d14('0x6')},'callingpres':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x7'),_0x6d14('0x8'),_0x6d14('0x9'),_0x6d14('0xa'),_0x6d14('0xb'),_0x6d14('0xc'),_0x6d14('0xd'),_0x6d14('0xe'))},'deny':{'type':Sequelize[_0x6d14('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x6d14('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x6d14('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x6d14('0xf'),'set':function(_0x3251c6){this[_0x6d14('0x10')](_0x6d14('0x11'),_0x3251c6?_0x3251c6[_0x6d14('0x12')](','):null);},'get':function(){return this[_0x6d14('0x13')](_0x6d14('0x11'))?this[_0x6d14('0x13')](_0x6d14('0x11'))[_0x6d14('0x14')](','):null;},'comment':_0x6d14('0x15')},'dtmfmode':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x16'),_0x6d14('0x17'),'shortinfo',_0x6d14('0x18'),'auto'),'defaultValue':_0x6d14('0x16')},'directmedia':{'type':Sequelize[_0x6d14('0x2')]('yes','no',_0x6d14('0x19'),_0x6d14('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6d14('0x1')]},'directmediadeny':{'type':Sequelize[_0x6d14('0x1')]},'nat':{'type':Sequelize[_0x6d14('0x1')],'defaultValue':_0x6d14('0x1c'),'set':function(_0x5cce5e){this[_0x6d14('0x10')](_0x6d14('0x1d'),_0x5cce5e?_0x5cce5e[_0x6d14('0x12')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue']('nat')[_0x6d14('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6d14('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6d14('0x1')]},'pickupgroup':{'type':Sequelize[_0x6d14('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6d14('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6d14('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6d14('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6d14('0x1e'),'set':function(_0x1dec57){this[_0x6d14('0x10')](_0x6d14('0x1f'),_0x1dec57?_0x1dec57[_0x6d14('0x12')](';'):_0x6d14('0x1e'));},'get':function(){return this[_0x6d14('0x13')](_0x6d14('0x1f'))?this[_0x6d14('0x13')](_0x6d14('0x1f'))['split'](';'):null;},'comment':_0x6d14('0x20')},'autoframing':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'insecure':{'type':Sequelize[_0x6d14('0x1')],'defaultValue':_0x6d14('0x21'),'set':function(_0x1e3aa7){this[_0x6d14('0x10')](_0x6d14('0x22'),_0x1e3aa7?_0x1e3aa7[_0x6d14('0x12')](','):null);},'get':function(){return this[_0x6d14('0x13')](_0x6d14('0x22'))?this[_0x6d14('0x13')](_0x6d14('0x22'))[_0x6d14('0x14')](','):null;},'comment':_0x6d14('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6d14('0x2')]('yes','no',_0x6d14('0x24'))},'promiscredir':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x6d14('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x6d14('0x25')](0xb)},'setvar':{'type':Sequelize[_0x6d14('0x1')]},'callerid':{'type':Sequelize[_0x6d14('0x1')],'defaultValue':_0x6d14('0x26')},'amaflags':{'type':Sequelize[_0x6d14('0x1')]},'callcounter':{'type':Sequelize[_0x6d14('0x2')]('yes','no'),'defaultValue':_0x6d14('0x1b')},'busylevel':{'type':Sequelize[_0x6d14('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x6d14('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x6d14('0x1')]},'template':{'type':Sequelize[_0x6d14('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no',_0x6d14('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6d14('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x6d14('0x1')]},'session_timers':{'type':Sequelize[_0x6d14('0x2')]('accept','refuse',_0x6d14('0x28'))},'session_expires':{'type':Sequelize[_0x6d14('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x6d14('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x29'),_0x6d14('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6d14('0x1')]},'fromuser':{'type':Sequelize[_0x6d14('0x1')]},'port':{'type':Sequelize[_0x6d14('0x25')](0x5)},'qualify':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x6d14('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6d14('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6d14('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no',_0x6d14('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6d14('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x6d14('0x25')](0xb)},'timerb':{'type':Sequelize[_0x6d14('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x6d14('0x1')]},'contactdeny':{'type':Sequelize[_0x6d14('0x1')]},'contactacl':{'type':Sequelize[_0x6d14('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6d14('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6d14('0x1')]},'maxforwards':{'type':Sequelize[_0x6d14('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6d14('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x6d14('0x1b'),'no',_0x6d14('0x2c'),_0x6d14('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x6d14('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6d14('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6d14('0x1')]},'dtlscipher':{'type':Sequelize[_0x6d14('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x2e'),_0x6d14('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6d14('0x1')]},'usereqphone':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6d14('0x1')]},'recordofffeature':{'type':Sequelize[_0x6d14('0x1')]},'call_limit':{'type':Sequelize[_0x6d14('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x6d14('0x2')](_0x6d14('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x6d14('0x1')]},'mohsuggest':{'type':Sequelize[_0x6d14('0x1')]},'parkinglot':{'type':Sequelize[_0x6d14('0x1')]},'description':{'type':Sequelize[_0x6d14('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6d14('0x30')},'canreinvite':{'type':Sequelize[_0x6d14('0x2')]('yes','no','nonat',_0x6d14('0x1a'),_0x6d14('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6d14('0x1')]},'otherFields':{'type':Sequelize[_0x6d14('0x1')]},'active':{'type':Sequelize[_0x6d14('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x485a=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport'];(function(_0x376453,_0x53cff8){var _0x227eb2=function(_0x8c70f6){while(--_0x8c70f6){_0x376453['push'](_0x376453['shift']());}};_0x227eb2(++_0x53cff8);}(_0x485a,0xeb));var _0xa485=function(_0x2c5eac,_0x319ede){_0x2c5eac=_0x2c5eac-0x0;var _0x13773d=_0x485a[_0x2c5eac];return _0x13773d;};'use strict';var Sequelize=require(_0xa485('0x0'));module[_0xa485('0x1')]={'name':{'type':Sequelize[_0xa485('0x2')],'allowNull':![],'unique':_0xa485('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x5'),_0xa485('0x6'),_0xa485('0x7')),'allowNull':![],'defaultValue':_0xa485('0x5')},'context':{'type':Sequelize[_0xa485('0x2')],'allowNull':![],'defaultValue':_0xa485('0x8')},'callingpres':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x9'),_0xa485('0xa'),_0xa485('0xb'),'ALLOWED',_0xa485('0xc'),_0xa485('0xd'),_0xa485('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0xa485('0x2')]},'permit':{'type':Sequelize[_0xa485('0x2')]},'secret':{'type':Sequelize[_0xa485('0x2')]},'md5secret':{'type':Sequelize[_0xa485('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xa485('0x2')],'defaultValue':_0xa485('0xf'),'set':function(_0x49c4b9){this[_0xa485('0x10')]('transport',_0x49c4b9?_0x49c4b9[_0xa485('0x11')](','):null);},'get':function(){return this[_0xa485('0x12')](_0xa485('0x13'))?this[_0xa485('0x12')](_0xa485('0x13'))[_0xa485('0x14')](','):null;},'comment':_0xa485('0x15')},'dtmfmode':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x16'),'info',_0xa485('0x17'),'inband',_0xa485('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no',_0xa485('0x1a'),_0xa485('0x1b'),_0xa485('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa485('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa485('0x2')]},'directmediadeny':{'type':Sequelize[_0xa485('0x2')]},'nat':{'type':Sequelize[_0xa485('0x2')],'defaultValue':_0xa485('0x1d'),'set':function(_0x2ca7c1){this[_0xa485('0x10')](_0xa485('0x1e'),_0x2ca7c1?_0x2ca7c1[_0xa485('0x11')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue']('nat')[_0xa485('0x14')](','):null;},'comment':_0xa485('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa485('0x2')]},'pickupgroup':{'type':Sequelize[_0xa485('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xa485('0x2')]},'language':{'type':Sequelize[_0xa485('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa485('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa485('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa485('0x2')],'allowNull':![],'defaultValue':_0xa485('0x20'),'set':function(_0x116063){this[_0xa485('0x10')](_0xa485('0x21'),_0x116063?_0x116063['join'](';'):_0xa485('0x20'));},'get':function(){return this[_0xa485('0x12')]('allow')?this[_0xa485('0x12')]('allow')[_0xa485('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xa485('0x19'),'no')},'insecure':{'type':Sequelize[_0xa485('0x2')],'defaultValue':_0xa485('0x22'),'set':function(_0x350837){this[_0xa485('0x10')]('insecure',_0x350837?_0x350837['join'](','):null);},'get':function(){return this[_0xa485('0x12')](_0xa485('0x23'))?this[_0xa485('0x12')](_0xa485('0x23'))[_0xa485('0x14')](','):null;},'comment':_0xa485('0x24')},'trustrpid':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa485('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xa485('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'accountcode':{'type':Sequelize[_0xa485('0x25')](0xb)},'setvar':{'type':Sequelize[_0xa485('0x2')]},'callerid':{'type':Sequelize[_0xa485('0x2')],'defaultValue':_0xa485('0x26')},'amaflags':{'type':Sequelize[_0xa485('0x2')]},'callcounter':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no'),'defaultValue':_0xa485('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xa485('0x2')]},'template':{'type':Sequelize[_0xa485('0x2')]},'videosupport':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no',_0xa485('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa485('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x28'),_0xa485('0x29'),_0xa485('0x2a'))},'session_expires':{'type':Sequelize[_0xa485('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xa485('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xa485('0x2b'),_0xa485('0x2c')),'defaultValue':_0xa485('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xa485('0x2')]},'regexten':{'type':Sequelize[_0xa485('0x2')]},'fromdomain':{'type':Sequelize[_0xa485('0x2')]},'fromuser':{'type':Sequelize[_0xa485('0x2')]},'port':{'type':Sequelize[_0xa485('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xa485('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa485('0x2')]},'defaultuser':{'type':Sequelize[_0xa485('0x2')]},'rtptimeout':{'type':Sequelize[_0xa485('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa485('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no',_0xa485('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa485('0x2')]},'callbackextension':{'type':Sequelize[_0xa485('0x2')]},'timert1':{'type':Sequelize[_0xa485('0x25')](0xb)},'timerb':{'type':Sequelize[_0xa485('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa485('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xa485('0x2')]},'contactdeny':{'type':Sequelize[_0xa485('0x2')]},'contactacl':{'type':Sequelize[_0xa485('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xa485('0x2')]},'use_q850_reason':{'type':Sequelize[_0xa485('0x2')]},'maxforwards':{'type':Sequelize[_0xa485('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa485('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xa485('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xa485('0x4')]('yes','no','fingerprint',_0xa485('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xa485('0x2')]},'dtlscipher':{'type':Sequelize[_0xa485('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa485('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa485('0x2f'),_0xa485('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa485('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xa485('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa485('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa485('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xa485('0x2')]},'mohsuggest':{'type':Sequelize[_0xa485('0x2')]},'parkinglot':{'type':Sequelize[_0xa485('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa485('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xa485('0x4')](_0xa485('0x19'),'no','nonat',_0xa485('0x1b'),_0xa485('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xa485('0x2')]},'active':{'type':Sequelize[_0xa485('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa485('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 586f156..ecfdc3d 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(_0x3d53e7,_0x402859){var _0x53b9c6=function(_0x578ac5){while(--_0x578ac5){_0x3d53e7['push'](_0x3d53e7['shift']());}};_0x53b9c6(++_0x402859);}(_0xedd9,0xfc));var _0x9edd=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xedd9[_0x56e0e8];return _0x2dab50;};'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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x458dc1,_0x56a907){var _0x35ab83=function(_0x2727de){while(--_0x2727de){_0x458dc1['push'](_0x458dc1['shift']());}};_0x35ab83(++_0x56a907);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3dc21f,_0x10070f){_0x3dc21f=_0x3dc21f-0x0;var _0x4192a8=_0x8ef6[_0x3dc21f];return _0x4192a8;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 61bcd34..081386a 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 _0xcef6=['bluebird','request-promise','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xcef6,0x1b4));var _0x6cef=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xcef6[_0xfc406a];return _0x395473;};'use strict';var _=require(_0x6cef('0x0'));var util=require(_0x6cef('0x1'));var logger=require(_0x6cef('0x2'))('api');var moment=require(_0x6cef('0x3'));var BPromise=require(_0x6cef('0x4'));var rp=require(_0x6cef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6cef('0x6'));module[_0x6cef('0x7')]=function(_0x10502d,_0x4fcde3){return _0x10502d[_0x6cef('0x8')](_0x6cef('0x9'),attributes,{'tableName':_0x6cef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd180=['moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x257e1e,_0x2387c2){var _0x2afd23=function(_0x464860){while(--_0x464860){_0x257e1e['push'](_0x257e1e['shift']());}};_0x2afd23(++_0x2387c2);}(_0xd180,0x1c4));var _0x0d18=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xd180[_0x3da707];return _0x342ee7;};'use strict';var _=require(_0x0d18('0x0'));var util=require(_0x0d18('0x1'));var logger=require(_0x0d18('0x2'))(_0x0d18('0x3'));var moment=require(_0x0d18('0x4'));var BPromise=require(_0x0d18('0x5'));var rp=require(_0x0d18('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d18('0x7'));var config=require(_0x0d18('0x8'));var attributes=require(_0x0d18('0x9'));module['exports']=function(_0x176846,_0x4e2885){return _0x176846['define'](_0x0d18('0xa'),attributes,{'tableName':_0x0d18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 1e9dcb9..ef2910d 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 _0x045a=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','include','map','model','attributes','ShowTrunk','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x193ff3,_0x35c303){var _0x4aba18=function(_0x542f45){while(--_0x542f45){_0x193ff3['push'](_0x193ff3['shift']());}};_0x4aba18(++_0x35c303);}(_0x045a,0xf1));var _0xa045=function(_0x2d4877,_0x59b057){_0x2d4877=_0x2d4877-0x0;var _0x2d4fec=_0x045a[_0x2d4877];return _0x2d4fec;};'use strict';var _=require(_0xa045('0x0'));var util=require(_0xa045('0x1'));var moment=require('moment');var BPromise=require(_0xa045('0x2'));var rs=require(_0xa045('0x3'));var fs=require('fs');var Redis=require(_0xa045('0x4'));var db=require(_0xa045('0x5'))['db'];var utils=require(_0xa045('0x6'));var logger=require(_0xa045('0x7'))(_0xa045('0x8'));var config=require(_0xa045('0x9'));var jayson=require(_0xa045('0xa'));var client=jayson[_0xa045('0xb')][_0xa045('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ad609,_0x5dfed5,_0x420027){return new BPromise(function(_0x4cc7e1,_0x577218){return client['request'](_0x3ad609,_0x420027)[_0xa045('0xd')](function(_0x584b32){logger[_0xa045('0xe')](_0xa045('0xf'),_0x5dfed5,_0xa045('0x10'));logger[_0xa045('0x11')](_0xa045('0x12'),_0x5dfed5,'request\x20sent',JSON[_0xa045('0x13')](_0x584b32));if(_0x584b32['error']){if(_0x584b32[_0xa045('0x14')][_0xa045('0x15')]===0x1f4){logger['error'](_0xa045('0xf'),_0x5dfed5,_0x584b32['error'][_0xa045('0x16')]);return _0x577218(_0x584b32[_0xa045('0x14')][_0xa045('0x16')]);}logger[_0xa045('0x14')](_0xa045('0xf'),_0x5dfed5,_0x584b32[_0xa045('0x14')]['message']);return _0x4cc7e1(_0x584b32[_0xa045('0x14')][_0xa045('0x16')]);}else{logger[_0xa045('0xe')](_0xa045('0xf'),_0x5dfed5,'request\x20sent');_0x4cc7e1(_0x584b32[_0xa045('0x17')]['message']);}})[_0xa045('0x18')](function(_0x1e2505){logger[_0xa045('0x14')]('Trunk,\x20%s,\x20%s',_0x5dfed5,_0x1e2505);_0x577218(_0x1e2505);});});}exports[_0xa045('0x19')]=function(_0xcf33d9){var _0x2961eb=this;return new Promise(function(_0x14df1c,_0x261db5){return db[_0xa045('0x1a')][_0xa045('0x1b')]({'raw':_0xcf33d9[_0xa045('0x1c')]?_0xcf33d9[_0xa045('0x1c')][_0xa045('0x1d')]===undefined?!![]:![]:!![],'where':_0xcf33d9[_0xa045('0x1c')]?_0xcf33d9['options'][_0xa045('0x1e')]||null:null,'attributes':_0xcf33d9['options']?_0xcf33d9[_0xa045('0x1c')]['attributes']||null:null,'limit':_0xcf33d9[_0xa045('0x1c')]?_0xcf33d9[_0xa045('0x1c')]['limit']||null:null,'include':_0xcf33d9[_0xa045('0x1c')]?_0xcf33d9[_0xa045('0x1c')][_0xa045('0x1f')]?_[_0xa045('0x20')](_0xcf33d9[_0xa045('0x1c')][_0xa045('0x1f')],function(_0x2d780f){return{'model':db[_0x2d780f[_0xa045('0x21')]],'as':_0x2d780f['as'],'attributes':_0x2d780f[_0xa045('0x22')],'include':_0x2d780f[_0xa045('0x1f')]?_[_0xa045('0x20')](_0x2d780f[_0xa045('0x1f')],function(_0x1a4c0b){return{'model':db[_0x1a4c0b[_0xa045('0x21')]],'as':_0x1a4c0b['as'],'attributes':_0x1a4c0b[_0xa045('0x22')],'include':_0x1a4c0b[_0xa045('0x1f')]?_['map'](_0x1a4c0b[_0xa045('0x1f')],function(_0x4d06ef){return{'model':db[_0x4d06ef[_0xa045('0x21')]],'as':_0x4d06ef['as'],'attributes':_0x4d06ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xa045('0xd')](function(_0x402676){logger[_0xa045('0xe')]('GetTrunk',_0xcf33d9);logger[_0xa045('0x11')](_0xa045('0x19'),_0xcf33d9,JSON[_0xa045('0x13')](_0x402676));_0x14df1c(_0x402676);})['catch'](function(_0x6c12f4){logger['error'](_0xa045('0x19'),_0x6c12f4[_0xa045('0x16')],_0xcf33d9);_0x261db5(_0x2961eb[_0xa045('0x14')](0x1f4,_0x6c12f4['message']));});});};exports[_0xa045('0x23')]=function(_0x1cbbdc){var _0x1e2eea=this;return new Promise(function(_0x464903,_0x307b7f){return db[_0xa045('0x1a')][_0xa045('0x24')]({'raw':_0x1cbbdc[_0xa045('0x1c')]?_0x1cbbdc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cbbdc[_0xa045('0x1c')]?_0x1cbbdc[_0xa045('0x1c')]['where']||null:null,'attributes':_0x1cbbdc[_0xa045('0x1c')]?_0x1cbbdc[_0xa045('0x1c')]['attributes']||null:null,'include':_0x1cbbdc[_0xa045('0x1c')]?_0x1cbbdc[_0xa045('0x1c')][_0xa045('0x1f')]?_[_0xa045('0x20')](_0x1cbbdc[_0xa045('0x1c')]['include'],function(_0x2c6dd0){return{'model':db[_0x2c6dd0[_0xa045('0x21')]],'as':_0x2c6dd0['as'],'attributes':_0x2c6dd0['attributes'],'include':_0x2c6dd0['include']?_['map'](_0x2c6dd0[_0xa045('0x1f')],function(_0x5a7a41){return{'model':db[_0x5a7a41[_0xa045('0x21')]],'as':_0x5a7a41['as'],'attributes':_0x5a7a41['attributes'],'include':_0x5a7a41[_0xa045('0x1f')]?_[_0xa045('0x20')](_0x5a7a41[_0xa045('0x1f')],function(_0x4b1ea2){return{'model':db[_0x4b1ea2[_0xa045('0x21')]],'as':_0x4b1ea2['as'],'attributes':_0x4b1ea2[_0xa045('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa045('0xd')](function(_0x129f18){logger[_0xa045('0xe')](_0xa045('0x23'),_0x1cbbdc);logger[_0xa045('0x11')](_0xa045('0x23'),_0x1cbbdc,JSON[_0xa045('0x13')](_0x129f18));_0x464903(_0x129f18);})[_0xa045('0x18')](function(_0x5554ae){logger['error']('ShowTrunk',_0x5554ae[_0xa045('0x16')],_0x1cbbdc);_0x307b7f(_0x1e2eea['error'](0x1f4,_0x5554ae[_0xa045('0x16')]));});});}; \ No newline at end of file +var _0x04d0=['ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','map','include','model'];(function(_0x6780cb,_0x58a7b9){var _0x4043aa=function(_0xad72aa){while(--_0xad72aa){_0x6780cb['push'](_0x6780cb['shift']());}};_0x4043aa(++_0x58a7b9);}(_0x04d0,0x122));var _0x004d=function(_0x2aa162,_0x193e6f){_0x2aa162=_0x2aa162-0x0;var _0x4efd6d=_0x04d0[_0x2aa162];return _0x4efd6d;};'use strict';var _=require('lodash');var util=require(_0x004d('0x0'));var moment=require(_0x004d('0x1'));var BPromise=require(_0x004d('0x2'));var rs=require(_0x004d('0x3'));var fs=require('fs');var Redis=require(_0x004d('0x4'));var db=require(_0x004d('0x5'))['db'];var utils=require(_0x004d('0x6'));var logger=require(_0x004d('0x7'))(_0x004d('0x8'));var config=require(_0x004d('0x9'));var jayson=require(_0x004d('0xa'));var client=jayson[_0x004d('0xb')][_0x004d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43ac56,_0x5933b5,_0x4355ec){return new BPromise(function(_0x22af55,_0x87c28f){return client[_0x004d('0xd')](_0x43ac56,_0x4355ec)[_0x004d('0xe')](function(_0x3a096c){logger[_0x004d('0xf')](_0x004d('0x10'),_0x5933b5,'request\x20sent');logger[_0x004d('0x11')](_0x004d('0x12'),_0x5933b5,_0x004d('0x13'),JSON[_0x004d('0x14')](_0x3a096c));if(_0x3a096c[_0x004d('0x15')]){if(_0x3a096c[_0x004d('0x15')]['code']===0x1f4){logger[_0x004d('0x15')](_0x004d('0x10'),_0x5933b5,_0x3a096c[_0x004d('0x15')][_0x004d('0x16')]);return _0x87c28f(_0x3a096c[_0x004d('0x15')][_0x004d('0x16')]);}logger[_0x004d('0x15')]('Trunk,\x20%s,\x20%s',_0x5933b5,_0x3a096c[_0x004d('0x15')]['message']);return _0x22af55(_0x3a096c[_0x004d('0x15')][_0x004d('0x16')]);}else{logger[_0x004d('0xf')](_0x004d('0x10'),_0x5933b5,_0x004d('0x13'));_0x22af55(_0x3a096c['result'][_0x004d('0x16')]);}})[_0x004d('0x17')](function(_0x5acc7d){logger[_0x004d('0x15')]('Trunk,\x20%s,\x20%s',_0x5933b5,_0x5acc7d);_0x87c28f(_0x5acc7d);});});}exports[_0x004d('0x18')]=function(_0x37fcd1){var _0x46eef8=this;return new Promise(function(_0x4a3a5c,_0x2765b5){return db[_0x004d('0x19')][_0x004d('0x1a')]({'raw':_0x37fcd1[_0x004d('0x1b')]?_0x37fcd1[_0x004d('0x1b')][_0x004d('0x1c')]===undefined?!![]:![]:!![],'where':_0x37fcd1[_0x004d('0x1b')]?_0x37fcd1[_0x004d('0x1b')][_0x004d('0x1d')]||null:null,'attributes':_0x37fcd1[_0x004d('0x1b')]?_0x37fcd1[_0x004d('0x1b')][_0x004d('0x1e')]||null:null,'limit':_0x37fcd1[_0x004d('0x1b')]?_0x37fcd1['options']['limit']||null:null,'include':_0x37fcd1[_0x004d('0x1b')]?_0x37fcd1[_0x004d('0x1b')]['include']?_['map'](_0x37fcd1[_0x004d('0x1b')]['include'],function(_0x3bd69c){return{'model':db[_0x3bd69c['model']],'as':_0x3bd69c['as'],'attributes':_0x3bd69c[_0x004d('0x1e')],'include':_0x3bd69c['include']?_[_0x004d('0x1f')](_0x3bd69c[_0x004d('0x20')],function(_0x2f4f5a){return{'model':db[_0x2f4f5a[_0x004d('0x21')]],'as':_0x2f4f5a['as'],'attributes':_0x2f4f5a[_0x004d('0x1e')],'include':_0x2f4f5a[_0x004d('0x20')]?_[_0x004d('0x1f')](_0x2f4f5a[_0x004d('0x20')],function(_0xb6c98b){return{'model':db[_0xb6c98b[_0x004d('0x21')]],'as':_0xb6c98b['as'],'attributes':_0xb6c98b[_0x004d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x004d('0xe')](function(_0x325f8a){logger[_0x004d('0xf')](_0x004d('0x18'),_0x37fcd1);logger[_0x004d('0x11')](_0x004d('0x18'),_0x37fcd1,JSON[_0x004d('0x14')](_0x325f8a));_0x4a3a5c(_0x325f8a);})['catch'](function(_0x51586c){logger[_0x004d('0x15')]('GetTrunk',_0x51586c[_0x004d('0x16')],_0x37fcd1);_0x2765b5(_0x46eef8['error'](0x1f4,_0x51586c['message']));});});};exports[_0x004d('0x22')]=function(_0x2316d5){var _0x58f716=this;return new Promise(function(_0x444887,_0x40d182){return db[_0x004d('0x19')][_0x004d('0x23')]({'raw':_0x2316d5[_0x004d('0x1b')]?_0x2316d5[_0x004d('0x1b')][_0x004d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2316d5[_0x004d('0x1b')]?_0x2316d5['options'][_0x004d('0x1d')]||null:null,'attributes':_0x2316d5['options']?_0x2316d5[_0x004d('0x1b')][_0x004d('0x1e')]||null:null,'include':_0x2316d5[_0x004d('0x1b')]?_0x2316d5['options'][_0x004d('0x20')]?_[_0x004d('0x1f')](_0x2316d5[_0x004d('0x1b')][_0x004d('0x20')],function(_0xf2db17){return{'model':db[_0xf2db17['model']],'as':_0xf2db17['as'],'attributes':_0xf2db17[_0x004d('0x1e')],'include':_0xf2db17[_0x004d('0x20')]?_['map'](_0xf2db17[_0x004d('0x20')],function(_0x1651ea){return{'model':db[_0x1651ea[_0x004d('0x21')]],'as':_0x1651ea['as'],'attributes':_0x1651ea[_0x004d('0x1e')],'include':_0x1651ea['include']?_[_0x004d('0x1f')](_0x1651ea[_0x004d('0x20')],function(_0x4620f1){return{'model':db[_0x4620f1[_0x004d('0x21')]],'as':_0x4620f1['as'],'attributes':_0x4620f1[_0x004d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x004d('0xe')](function(_0x2b925e){logger[_0x004d('0xf')](_0x004d('0x22'),_0x2316d5);logger[_0x004d('0x11')](_0x004d('0x22'),_0x2316d5,JSON[_0x004d('0x14')](_0x2b925e));_0x444887(_0x2b925e);})[_0x004d('0x17')](function(_0x3be73c){logger[_0x004d('0x15')](_0x004d('0x22'),_0x3be73c[_0x004d('0x16')],_0x2316d5);_0x40d182(_0x58f716[_0x004d('0x15')](0x1f4,_0x3be73c[_0x004d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d912efb..6c46c1e 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bbd=['put','/:id','update','exports','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x27f491,_0x1b74f4){var _0x86f9de=function(_0x449a37){while(--_0x449a37){_0x27f491['push'](_0x27f491['shift']());}};_0x86f9de(++_0x1b74f4);}(_0x3bbd,0x16c));var _0xd3bb=function(_0x3f20ce,_0x4cd4b2){_0x3f20ce=_0x3f20ce-0x0;var _0x18ca5b=_0x3bbd[_0x3f20ce];return _0x18ca5b;};'use strict';var express=require(_0xd3bb('0x0'));var router=express[_0xd3bb('0x1')]();var auth=require(_0xd3bb('0x2'));var controller=require(_0xd3bb('0x3'));router[_0xd3bb('0x4')](_0xd3bb('0x5'),auth['isAuthenticated'](),controller[_0xd3bb('0x6')]);module[_0xd3bb('0x7')]=router; \ No newline at end of file +var _0x35f0=['isAuthenticated','update','exports','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x4fb37d,_0x49a113){var _0x39400b=function(_0xc15daa){while(--_0xc15daa){_0x4fb37d['push'](_0x4fb37d['shift']());}};_0x39400b(++_0x49a113);}(_0x35f0,0x1b3));var _0x035f=function(_0x309fda,_0x1496f8){_0x309fda=_0x309fda-0x0;var _0xccaf12=_0x35f0[_0x309fda];return _0xccaf12;};'use strict';var express=require('express');var router=express[_0x035f('0x0')]();var auth=require(_0x035f('0x1'));var controller=require(_0x035f('0x2'));router[_0x035f('0x3')](_0x035f('0x4'),auth[_0x035f('0x5')](),controller[_0x035f('0x6')]);module[_0x035f('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 3b6d598..018c9e1 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa558=['INTEGER','UserId','sequelize','warning','info','debug','exports','ENUM','error','BOOLEAN','TEXT'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xa558,0x199));var _0x8a55=function(_0x2b8e06,_0x58db70){_0x2b8e06=_0x2b8e06-0x0;var _0x123184=_0xa558[_0x2b8e06];return _0x123184;};'use strict';var Sequelize=require(_0x8a55('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x8a55('0x1'),_0x8a55('0x2'),_0x8a55('0x3')];module[_0x8a55('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8a55('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8a55('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8a55('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8a55('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8a55('0x9')],'unique':_0x8a55('0xa')}}; \ No newline at end of file +var _0xaf53=['exports','ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','info','debug'];(function(_0x346da4,_0x5e9473){var _0x535c0e=function(_0x3a54a2){while(--_0x3a54a2){_0x346da4['push'](_0x346da4['shift']());}};_0x535c0e(++_0x5e9473);}(_0xaf53,0x196));var _0x3af5=function(_0x580607,_0x3d2c7d){_0x580607=_0x580607-0x0;var _0x3adb02=_0xaf53[_0x580607];return _0x3adb02;};'use strict';var Sequelize=require(_0x3af5('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3af5('0x1'),'warning',_0x3af5('0x2'),_0x3af5('0x3')];module[_0x3af5('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3af5('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3af5('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3af5('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3af5('0x8')],'unique':_0x3af5('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index def0426..e9d1c25 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1d4=['ioredis','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','then','sendStatus','error','stack','name','status','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','lodash'];(function(_0x60e609,_0x24a1a4){var _0x18584f=function(_0x40c7ac){while(--_0x40c7ac){_0x60e609['push'](_0x60e609['shift']());}};_0x18584f(++_0x24a1a4);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd1d4[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x4d1d('0x0'));var Redis=require(_0x4d1d('0x1'));var logger=require('../../config/logger')(_0x4d1d('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x4d1d('0x3'))(new Redis(config[_0x4d1d('0x4')]));require(_0x4d1d('0x5'))[_0x4d1d('0x6')](socket);config[_0x4d1d('0x4')]=_[_0x4d1d('0x7')](config[_0x4d1d('0x4')],{'host':_0x4d1d('0x8'),'port':0x18eb});function respondWithResult(_0x1547d5,_0x1e0694){_0x1e0694=_0x1e0694||0xc8;return function(_0x23f6c4){if(_0x23f6c4){return _0x1547d5['status'](_0x1e0694)['json'](_0x23f6c4);}};}function saveUpdates(_0x26fbcf){return function(_0x371de3){if(_0x371de3){return _0x371de3['update'](_0x26fbcf)[_0x4d1d('0x9')](function(_0x33d8a7){return _0x33d8a7;});}return null;};}function handleEntityNotFound(_0x3551f4){return function(_0x248db3){if(!_0x248db3){_0x3551f4[_0x4d1d('0xa')](0x194);}return _0x248db3;};}function handleError(_0x1d8ca8,_0x7cd852){_0x7cd852=_0x7cd852||0x1f4;return function(_0x19a888){logger[_0x4d1d('0xb')](_0x19a888[_0x4d1d('0xc')]);if(_0x19a888[_0x4d1d('0xd')]){delete _0x19a888[_0x4d1d('0xd')];}_0x1d8ca8[_0x4d1d('0xe')](_0x7cd852)['send'](_0x19a888);};}exports[_0x4d1d('0xf')]=function(_0x2e00f8,_0x4383ae){if(_0x2e00f8[_0x4d1d('0x10')]['role']!=='admin')throw new Error(_0x4d1d('0x11'));if(isNaN(Number(_0x2e00f8[_0x4d1d('0x12')]['id'])))throw new Error(_0x4d1d('0x13'));return db['UserSetting'][_0x4d1d('0x14')]({'where':{'id':_0x2e00f8[_0x4d1d('0x12')]['id']}})[_0x4d1d('0x9')](handleEntityNotFound(_0x4383ae,null))[_0x4d1d('0x9')](saveUpdates(_0x2e00f8['body'],null))['then'](respondWithResult(_0x4383ae,null))['catch'](handleError(_0x4383ae,null));}; \ No newline at end of file +var _0xbf83=['name','status','send','user','role','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','register','redis','defaults','json','update','then','sendStatus','stack'];(function(_0x5f12b1,_0x4df658){var _0x3290f7=function(_0x41cbe5){while(--_0x41cbe5){_0x5f12b1['push'](_0x5f12b1['shift']());}};_0x3290f7(++_0x4df658);}(_0xbf83,0x11e));var _0x3bf8=function(_0xb99346,_0xe507d5){_0xb99346=_0xb99346-0x0;var _0xd4881a=_0xbf83[_0xb99346];return _0xd4881a;};'use strict';var _=require(_0x3bf8('0x0'));var Redis=require('ioredis');var logger=require(_0x3bf8('0x1'))(_0x3bf8('0x2'));var config=require(_0x3bf8('0x3'));var db=require(_0x3bf8('0x4'))['db'];var socket=require(_0x3bf8('0x5'))(new Redis(config['redis']));require('./user-setting.socket')[_0x3bf8('0x6')](socket);config[_0x3bf8('0x7')]=_[_0x3bf8('0x8')](config[_0x3bf8('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5b0c12,_0x168a20){_0x168a20=_0x168a20||0xc8;return function(_0x2df7c9){if(_0x2df7c9){return _0x5b0c12['status'](_0x168a20)[_0x3bf8('0x9')](_0x2df7c9);}};}function saveUpdates(_0x538bec){return function(_0x2f07a8){if(_0x2f07a8){return _0x2f07a8[_0x3bf8('0xa')](_0x538bec)[_0x3bf8('0xb')](function(_0x281063){return _0x281063;});}return null;};}function handleEntityNotFound(_0x2ee63c){return function(_0xc9f419){if(!_0xc9f419){_0x2ee63c[_0x3bf8('0xc')](0x194);}return _0xc9f419;};}function handleError(_0x5d1274,_0xb88128){_0xb88128=_0xb88128||0x1f4;return function(_0x3e0ab0){logger['error'](_0x3e0ab0[_0x3bf8('0xd')]);if(_0x3e0ab0[_0x3bf8('0xe')]){delete _0x3e0ab0[_0x3bf8('0xe')];}_0x5d1274[_0x3bf8('0xf')](_0xb88128)[_0x3bf8('0x10')](_0x3e0ab0);};}exports[_0x3bf8('0xa')]=function(_0x27b4e1,_0x260445){if(_0x27b4e1[_0x3bf8('0x11')][_0x3bf8('0x12')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x27b4e1[_0x3bf8('0x13')]['id'])))throw new Error(_0x3bf8('0x14'));return db[_0x3bf8('0x15')][_0x3bf8('0x16')]({'where':{'id':_0x27b4e1['params']['id']}})[_0x3bf8('0xb')](handleEntityNotFound(_0x260445,null))[_0x3bf8('0xb')](saveUpdates(_0x27b4e1[_0x3bf8('0x17')],null))[_0x3bf8('0xb')](respondWithResult(_0x260445,null))[_0x3bf8('0x18')](handleError(_0x260445,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index d9f0e8f..a456a91 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032c=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1e25aa,_0x491457){var _0x1e49d6=function(_0x3fd8b5){while(--_0x3fd8b5){_0x1e25aa['push'](_0x1e25aa['shift']());}};_0x1e49d6(++_0x491457);}(_0x032c,0xff));var _0xc032=function(_0x1a78f0,_0x398b53){_0x1a78f0=_0x1a78f0-0x0;var _0x3704e5=_0x032c[_0x1a78f0];return _0x3704e5;};'use strict';var EventEmitter=require(_0xc032('0x0'));var UserSetting=require(_0xc032('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc032('0x2')](0x0);var events={'afterCreate':_0xc032('0x3'),'afterUpdate':_0xc032('0x4'),'afterDestroy':_0xc032('0x5')};function emitEvent(_0x169c66){return function(_0x28bac3,_0x2c796e,_0x5cb19d){UserSettingEvents[_0xc032('0x6')](_0x169c66+':'+_0x28bac3['id'],_0x28bac3);UserSettingEvents[_0xc032('0x6')](_0x169c66,_0x28bac3);_0x5cb19d(null);};}for(var e in events){if(events[_0xc032('0x7')](e)){var event=events[e];UserSetting[_0xc032('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x4ce3=['save','emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting'];(function(_0x356ed3,_0x4edc4a){var _0xcfbee=function(_0x432188){while(--_0x432188){_0x356ed3['push'](_0x356ed3['shift']());}};_0xcfbee(++_0x4edc4a);}(_0x4ce3,0x1c4));var _0x34ce=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x4ce3[_0x28669c];return _0x4a3af6;};'use strict';var EventEmitter=require(_0x34ce('0x0'));var UserSetting=require(_0x34ce('0x1'))['db'][_0x34ce('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34ce('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21ae6c){return function(_0x39542b,_0x5a5aab,_0xd6b615){UserSettingEvents[_0x34ce('0x4')](_0x21ae6c+':'+_0x39542b['id'],_0x39542b);UserSettingEvents[_0x34ce('0x4')](_0x21ae6c,_0x39542b);_0xd6b615(null);};}for(var e in events){if(events[_0x34ce('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x34ce('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index fe279b6..898a037 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b24=['UserSetting','clientSideLoggingEnabledSince','exports','define'];(function(_0x4adad3,_0x202bba){var _0x52dae4=function(_0x562ccb){while(--_0x562ccb){_0x4adad3['push'](_0x4adad3['shift']());}};_0x52dae4(++_0x202bba);}(_0x6b24,0x1ce));var _0x46b2=function(_0xca2488,_0x14de01){_0xca2488=_0xca2488-0x0;var _0xa77bb9=_0x6b24[_0xca2488];return _0xa77bb9;};'use strict';var attributes=require('./user-setting.attributes');module[_0x46b2('0x0')]=function(_0x1e72c7){return _0x1e72c7[_0x46b2('0x1')](_0x46b2('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x529a0c){if(!_0x529a0c['clientSideLoggingEnabled'])_0x529a0c[_0x46b2('0x3')]=null;else if(_0x529a0c['clientSideLoggingEnabledSince']===null)_0x529a0c[_0x46b2('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xbaf0=['UserSetting','user_settings','clientSideLoggingEnabledSince','exports','define'];(function(_0x362f5d,_0x5282c4){var _0x26f35c=function(_0x1386e6){while(--_0x1386e6){_0x362f5d['push'](_0x362f5d['shift']());}};_0x26f35c(++_0x5282c4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0baf('0x0')]=function(_0x2a3620){return _0x2a3620[_0x0baf('0x1')](_0x0baf('0x2'),attributes,{'tableName':_0x0baf('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d2e72){if(!_0x4d2e72['clientSideLoggingEnabled'])_0x4d2e72[_0x0baf('0x4')]=null;else if(_0x4d2e72[_0x0baf('0x4')]===null)_0x4d2e72[_0x0baf('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 3ff4bf7..4e77048 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafb2=['register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xafb2,0xd4));var _0x2afb=function(_0x18e094,_0x5d233a){_0x18e094=_0x18e094-0x0;var _0x56368f=_0xafb2[_0x18e094];return _0x56368f;};'use strict';var UserSettingEvents=require(_0x2afb('0x0'));var events=[_0x2afb('0x1'),_0x2afb('0x2'),_0x2afb('0x3')];function createListener(_0x3ce07e,_0x331c26){return function(_0x593d3b){_0x331c26[_0x2afb('0x4')](_0x3ce07e,_0x593d3b);if(_0x3ce07e===_0x2afb('0x5')){_0x331c26[_0x2afb('0x4')](_0x2afb('0x6')+_0x593d3b[_0x2afb('0x7')],_0x593d3b);}};}exports[_0x2afb('0x8')]=function(_0x3a5211){for(var _0x422e36=0x0,_0x453668=events[_0x2afb('0x9')];_0x422e36<_0x453668;_0x422e36++){var _0x250e33=events[_0x422e36];var _0x2ef58f=createListener(_0x2afb('0xa')+_0x250e33,_0x3a5211);UserSettingEvents['on'](_0x250e33,_0x2ef58f);}}; \ No newline at end of file +var _0x7589=['UserId','register','length','user-setting:','./user-setting.events','remove','emit','user-setting:update:user-'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7589,0x14c));var _0x9758=function(_0xbc35ae,_0x1b79a1){_0xbc35ae=_0xbc35ae-0x0;var _0x527b4c=_0x7589[_0xbc35ae];return _0x527b4c;};'use strict';var UserSettingEvents=require(_0x9758('0x0'));var events=['save',_0x9758('0x1'),'update'];function createListener(_0x36fcf3,_0x1bf060){return function(_0xa558df){_0x1bf060[_0x9758('0x2')](_0x36fcf3,_0xa558df);if(_0x36fcf3==='user-setting:update'){_0x1bf060['emit'](_0x9758('0x3')+_0xa558df[_0x9758('0x4')],_0xa558df);}};}exports[_0x9758('0x5')]=function(_0x38c69f){for(var _0xc298d6=0x0,_0xe32c7e=events[_0x9758('0x6')];_0xc298d6<_0xe32c7e;_0xc298d6++){var _0x5a19f3=events[_0xc298d6];var _0x307248=createListener(_0x9758('0x7')+_0x5a19f3,_0x38c69f);UserSettingEvents['on'](_0x5a19f3,_0x307248);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 43d7182..b8ae4a5 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 _0x73ab=['getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','diskStorage','join','server/files/images/','format','now','originalname','single','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','put','/:id/password','delete','removeQueues','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x53c578,_0x56e28e){var _0x22fd45=function(_0x588068){while(--_0x588068){_0x53c578['push'](_0x53c578['shift']());}};_0x22fd45(++_0x56e28e);}(_0x73ab,0x182));var _0xb73a=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x73ab[_0x4c7d8b];return _0x187158;};'use strict';var multer=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var path=require(_0xb73a('0x2'));var timeout=require(_0xb73a('0x3'));var express=require(_0xb73a('0x4'));var router=express[_0xb73a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb73a('0x6'));var config=require(_0xb73a('0x7'));var controller=require('./user.controller');router[_0xb73a('0x8')]('/',auth[_0xb73a('0x9')](),controller['index']);router[_0xb73a('0x8')]('/describe',auth[_0xb73a('0x9')](),controller[_0xb73a('0xa')]);router[_0xb73a('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0xb73a('0xb')]);router[_0xb73a('0x8')](_0xb73a('0xc'),auth[_0xb73a('0x9')](),controller[_0xb73a('0xd')]);router['get'](_0xb73a('0xe'),auth[_0xb73a('0x9')](),controller[_0xb73a('0xf')]);router[_0xb73a('0x8')](_0xb73a('0x10'),controller[_0xb73a('0x11')]);router[_0xb73a('0x8')](_0xb73a('0x12'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x13')]);router[_0xb73a('0x8')](_0xb73a('0x14'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x15')]);router[_0xb73a('0x8')](_0xb73a('0x16'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x17')]);router['get'](_0xb73a('0x18'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x19')]);router['get'](_0xb73a('0x1a'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x1b')]);router[_0xb73a('0x8')]('/:id/recordings',auth[_0xb73a('0x9')](),controller[_0xb73a('0x1c')]);router[_0xb73a('0x8')](_0xb73a('0x1d'),auth['isAuthenticated'](),controller[_0xb73a('0x1e')]);router['get'](_0xb73a('0x1f'),auth[_0xb73a('0x9')](),controller['getChatInteractions']);router['get'](_0xb73a('0x20'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x21')]);router[_0xb73a('0x8')]('/:id/mail/interactions',auth[_0xb73a('0x9')](),controller[_0xb73a('0x22')]);router[_0xb73a('0x8')]('/:id/sms/interactions',auth[_0xb73a('0x9')](),controller['getSmsInteractions']);router[_0xb73a('0x8')](_0xb73a('0x23'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x24')]);router[_0xb73a('0x8')](_0xb73a('0x25'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xb73a('0x8')]('/:id/teams',auth[_0xb73a('0x9')](),controller['getTeams']);router['get'](_0xb73a('0x26'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x27')]);router['get'](_0xb73a('0x28'),auth['isAuthenticated'](),controller[_0xb73a('0x29')]);router[_0xb73a('0x8')]('/:id/prefixes',auth[_0xb73a('0x9')](),controller[_0xb73a('0x2a')]);router['get']('/:id/fax_accounts',auth[_0xb73a('0x9')](),controller[_0xb73a('0x2b')]);router['get'](_0xb73a('0x2c'),auth['isAuthenticated'](),controller[_0xb73a('0x2d')]);router[_0xb73a('0x8')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xb73a('0x2e')]);router[_0xb73a('0x8')](_0xb73a('0x2f'),auth['isAuthenticated'](),controller[_0xb73a('0x30')]);router[_0xb73a('0x8')](_0xb73a('0x31'),auth['isAuthenticated'](),controller[_0xb73a('0x32')]);router[_0xb73a('0x8')](_0xb73a('0x33'),auth[_0xb73a('0x9')](),controller['getWhatsappAccounts']);router[_0xb73a('0x8')](_0xb73a('0x34'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x35')]);router['get'](_0xb73a('0x36'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x37')]);router[_0xb73a('0x38')](_0xb73a('0x14'),auth[_0xb73a('0x9')](),controller['addContacts']);router['post']('/',auth[_0xb73a('0x9')](),controller[_0xb73a('0x39')]);router[_0xb73a('0x38')]('/create_many',auth[_0xb73a('0x9')](),controller[_0xb73a('0x3a')]);router['post']('/:id/queues',auth[_0xb73a('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xb73a('0x3b')]({'destination':function(_0x54d9c5,_0x477196,_0x351125){_0x351125(null,path[_0xb73a('0x3c')](config['root'],_0xb73a('0x3d')));},'filename':function(_0x290eb4,_0x27af7e,_0x2caf6a){_0x2caf6a(null,util[_0xb73a('0x3e')]('%s-%s',Date[_0xb73a('0x3f')](),_0x27af7e[_0xb73a('0x40')]));}})});router[_0xb73a('0x38')](_0xb73a('0x10'),upload[_0xb73a('0x41')]('file'),controller[_0xb73a('0x42')]);router[_0xb73a('0x38')]('/:id/login',auth[_0xb73a('0x9')](),controller['login']);router[_0xb73a('0x38')](_0xb73a('0x43'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x44')]);router[_0xb73a('0x38')](_0xb73a('0x45'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x46')]);router[_0xb73a('0x38')](_0xb73a('0x47'),auth[_0xb73a('0x9')](),controller['unpause']);router[_0xb73a('0x38')]('/:id/teams',auth[_0xb73a('0x9')](),controller[_0xb73a('0x48')]);router[_0xb73a('0x38')](_0xb73a('0x49'),auth[_0xb73a('0x9')](),controller['addChatInteractions']);router[_0xb73a('0x38')](_0xb73a('0x4a'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x4b')]);router['post'](_0xb73a('0x4c'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x4d')]);router[_0xb73a('0x38')](_0xb73a('0x4e'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xb73a('0x38')](_0xb73a('0x4f'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x50')]);router[_0xb73a('0x38')](_0xb73a('0x51'),auth['isAuthenticated'](),controller[_0xb73a('0x52')]);router['post'](_0xb73a('0x53'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x54')]);router[_0xb73a('0x38')](_0xb73a('0x2c'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x55')]);router[_0xb73a('0x38')](_0xb73a('0x56'),auth[_0xb73a('0x9')](),controller['addOpenchannelAccounts']);router[_0xb73a('0x38')](_0xb73a('0x2f'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x57')]);router['post'](_0xb73a('0x31'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0xb73a('0x9')](),controller['addWhatsappAccounts']);router[_0xb73a('0x38')](_0xb73a('0x36'),auth[_0xb73a('0x9')](),controller['createApiKey']);router[_0xb73a('0x58')](_0xb73a('0xe'),auth[_0xb73a('0x9')](),controller['update']);router[_0xb73a('0x58')](_0xb73a('0x59'),auth[_0xb73a('0x9')](),controller['changePassword']);router[_0xb73a('0x5a')](_0xb73a('0x16'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x5b')]);router[_0xb73a('0x5a')]('/:id/teams',auth[_0xb73a('0x9')](),controller['removeTeams']);router['delete'](_0xb73a('0xe'),auth['isAuthenticated'](),controller[_0xb73a('0x5c')]);router[_0xb73a('0x5a')](_0xb73a('0x49'),auth['isAuthenticated'](),controller[_0xb73a('0x5d')]);router['delete']('/:id/mail_interactions',auth[_0xb73a('0x9')](),controller['removeMailInteractions']);router[_0xb73a('0x5a')](_0xb73a('0x4c'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x5e')]);router[_0xb73a('0x5a')](_0xb73a('0x4e'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x5f')]);router[_0xb73a('0x5a')](_0xb73a('0x4f'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x60')]);router[_0xb73a('0x5a')](_0xb73a('0x51'),auth[_0xb73a('0x9')](),controller['removeWhatsappInteractions']);router[_0xb73a('0x5a')](_0xb73a('0x53'),auth['isAuthenticated'](),controller[_0xb73a('0x61')]);router[_0xb73a('0x5a')](_0xb73a('0x2c'),auth[_0xb73a('0x9')](),controller[_0xb73a('0x62')]);router[_0xb73a('0x5a')](_0xb73a('0x56'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xb73a('0x5a')](_0xb73a('0x2f'),auth['isAuthenticated'](),controller[_0xb73a('0x63')]);router[_0xb73a('0x5a')](_0xb73a('0x31'),auth['isAuthenticated'](),controller[_0xb73a('0x64')]);router[_0xb73a('0x5a')](_0xb73a('0x33'),auth['isAuthenticated'](),controller[_0xb73a('0x65')]);router[_0xb73a('0x5a')](_0xb73a('0x36'),auth[_0xb73a('0x9')](),controller['removeApiKey']);router[_0xb73a('0x38')](_0xb73a('0x66'),auth['isAuthenticated'](),controller[_0xb73a('0x67')]);module[_0xb73a('0x68')]=router; \ No newline at end of file +var _0xf1d4=['login','logout','/:id/pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','/:id/messengerSoundNotification','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getGroups','getRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','/:id/avatar','single','file'];(function(_0xf068cc,_0x3055cb){var _0xd21823=function(_0x5c1a4b){while(--_0x5c1a4b){_0xf068cc['push'](_0xf068cc['shift']());}};_0xd21823(++_0x3055cb);}(_0xf1d4,0x158));var _0x4f1d=function(_0x340a9a,_0x2b0ade){_0x340a9a=_0x340a9a-0x0;var _0x574153=_0xf1d4[_0x340a9a];return _0x574153;};'use strict';var multer=require(_0x4f1d('0x0'));var util=require('util');var path=require(_0x4f1d('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f1d('0x2'));var router=express[_0x4f1d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f1d('0x4'));var interaction=require(_0x4f1d('0x5'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x4f1d('0x6')]('/',auth[_0x4f1d('0x7')](),controller['index']);router[_0x4f1d('0x6')](_0x4f1d('0x8'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x9')]);router[_0x4f1d('0x6')](_0x4f1d('0xa'),auth[_0x4f1d('0x7')](),controller['whoami']);router['get'](_0x4f1d('0xb'),auth['isAuthenticated'](),controller[_0x4f1d('0xc')]);router[_0x4f1d('0x6')]('/:id',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0xd')]);router['get']('/:id/avatar',controller[_0x4f1d('0xe')]);router['get'](_0x4f1d('0xf'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x10')]);router[_0x4f1d('0x6')](_0x4f1d('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0x4f1d('0x6')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0x4f1d('0x6')]('/:id/queues_rt',auth[_0x4f1d('0x7')](),controller['getVoiceQueuesRt']);router[_0x4f1d('0x6')]('/:id/groups',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x12')]);router[_0x4f1d('0x6')]('/:id/recordings',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x13')]);router[_0x4f1d('0x6')]('/:id/screen_recordings',auth[_0x4f1d('0x7')](),controller['getScreenRecordings']);router[_0x4f1d('0x6')]('/:id/chat/interactions',auth[_0x4f1d('0x7')](),controller['getChatInteractions']);router[_0x4f1d('0x6')](_0x4f1d('0x14'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x15')]);router[_0x4f1d('0x6')](_0x4f1d('0x16'),auth['isAuthenticated'](),controller[_0x4f1d('0x17')]);router[_0x4f1d('0x6')](_0x4f1d('0x18'),auth[_0x4f1d('0x7')](),controller['getSmsInteractions']);router[_0x4f1d('0x6')](_0x4f1d('0x19'),auth['isAuthenticated'](),controller[_0x4f1d('0x1a')]);router[_0x4f1d('0x6')](_0x4f1d('0x1b'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x1c')]);router[_0x4f1d('0x6')]('/:id/teams',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x1d')]);router['get']('/:id/lists',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x1e')]);router[_0x4f1d('0x6')](_0x4f1d('0x1f'),auth['isAuthenticated'](),controller[_0x4f1d('0x20')]);router['get']('/:id/prefixes',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x21')]);router['get'](_0x4f1d('0x22'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x4f1d('0x6')](_0x4f1d('0x23'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x24')]);router[_0x4f1d('0x6')](_0x4f1d('0x25'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x26')]);router['get'](_0x4f1d('0x27'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x28')]);router['get'](_0x4f1d('0x29'),auth[_0x4f1d('0x7')](),controller['getChatWebsites']);router['get'](_0x4f1d('0x2a'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x2b')]);router['get'](_0x4f1d('0x2c'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x2d')]);router[_0x4f1d('0x6')](_0x4f1d('0x2e'),auth['isAuthenticated'](),controller[_0x4f1d('0x2f')]);router['post']('/:id/contacts',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x30')]);router[_0x4f1d('0x31')]('/',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x32')]);router['post'](_0x4f1d('0x33'),auth['isAuthenticated'](),controller[_0x4f1d('0x34')]);router[_0x4f1d('0x31')](_0x4f1d('0x35'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x36')]);var upload=multer({'storage':multer[_0x4f1d('0x37')]({'destination':function(_0x418bb4,_0x5e49f2,_0x4b2ea0){_0x4b2ea0(null,path['join'](config[_0x4f1d('0x38')],_0x4f1d('0x39')));},'filename':function(_0x1f1f5b,_0x126c7d,_0x534384){_0x534384(null,util[_0x4f1d('0x3a')](_0x4f1d('0x3b'),Date[_0x4f1d('0x3c')](),_0x126c7d['originalname']));}})});router[_0x4f1d('0x31')](_0x4f1d('0x3d'),upload[_0x4f1d('0x3e')](_0x4f1d('0x3f')),controller['addAvatar']);router['post']('/:id/login',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x40')]);router['post']('/:id/logout',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x41')]);router[_0x4f1d('0x31')](_0x4f1d('0x42'),auth[_0x4f1d('0x7')](),controller['pause']);router[_0x4f1d('0x31')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x4f1d('0x43')]);router['post'](_0x4f1d('0x44'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x45')]);router[_0x4f1d('0x31')](_0x4f1d('0x46'),auth[_0x4f1d('0x7')](),controller['addChatInteractions']);router['post'](_0x4f1d('0x47'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x48')]);router[_0x4f1d('0x31')](_0x4f1d('0x49'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x4a')]);router['post'](_0x4f1d('0x4b'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x4c')]);router[_0x4f1d('0x31')](_0x4f1d('0x4d'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x4e')]);router['post'](_0x4f1d('0x4f'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x50')]);router[_0x4f1d('0x31')](_0x4f1d('0x22'),auth[_0x4f1d('0x7')](),controller['addFaxAccounts']);router[_0x4f1d('0x31')]('/:id/mail_accounts',auth[_0x4f1d('0x7')](),controller['addMailAccounts']);router['post'](_0x4f1d('0x25'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x51')]);router[_0x4f1d('0x31')](_0x4f1d('0x27'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x52')]);router[_0x4f1d('0x31')](_0x4f1d('0x29'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x53')]);router[_0x4f1d('0x31')](_0x4f1d('0x2a'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x4f1d('0x31')](_0x4f1d('0x2e'),auth[_0x4f1d('0x7')](),controller['createApiKey']);router[_0x4f1d('0x54')](_0x4f1d('0x55'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x56')]);router['put'](_0x4f1d('0x57'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x58')]);router[_0x4f1d('0x59')](_0x4f1d('0x35'),auth['isAuthenticated'](),controller[_0x4f1d('0x5a')]);router[_0x4f1d('0x59')](_0x4f1d('0x44'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x5b')]);router[_0x4f1d('0x59')]('/:id',auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x5c')]);router[_0x4f1d('0x59')](_0x4f1d('0x46'),auth['isAuthenticated'](),controller[_0x4f1d('0x5d')]);router[_0x4f1d('0x59')](_0x4f1d('0x47'),auth[_0x4f1d('0x7')](),controller['removeMailInteractions']);router[_0x4f1d('0x59')](_0x4f1d('0x49'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x5e')]);router[_0x4f1d('0x59')](_0x4f1d('0x4b'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x5f')]);router['delete'](_0x4f1d('0x4d'),auth[_0x4f1d('0x7')](),controller['removeOpenchannelInteractions']);router[_0x4f1d('0x59')](_0x4f1d('0x4f'),auth['isAuthenticated'](),controller[_0x4f1d('0x60')]);router[_0x4f1d('0x59')](_0x4f1d('0x22'),auth['isAuthenticated'](),controller[_0x4f1d('0x61')]);router[_0x4f1d('0x59')](_0x4f1d('0x23'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x62')]);router[_0x4f1d('0x59')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x4f1d('0x63')]);router['delete'](_0x4f1d('0x27'),auth[_0x4f1d('0x7')](),controller['removeSmsAccounts']);router[_0x4f1d('0x59')]('/:id/chat_websites',auth[_0x4f1d('0x7')](),controller['removeChatWebsites']);router['delete'](_0x4f1d('0x2a'),auth[_0x4f1d('0x7')](),controller[_0x4f1d('0x64')]);router[_0x4f1d('0x59')](_0x4f1d('0x2e'),auth[_0x4f1d('0x7')](),controller['removeApiKey']);router['post'](_0x4f1d('0x65'),auth[_0x4f1d('0x7')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8c6c440..8a3312a 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 _0xdc3d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','UNSIGNED','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','dynamic','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdc3d,0x90));var _0xddc3=function(_0x53ff45,_0x513ca9){_0x53ff45=_0x53ff45-0x0;var _0x26507f=_0xdc3d[_0x53ff45];return _0x26507f;};'use strict';var Sequelize=require(_0xddc3('0x0'));var moment=require(_0xddc3('0x1'));var util=require('util');var _=require(_0xddc3('0x2'));module[_0xddc3('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x34d3f1){this['setDataValue'](_0xddc3('0x4'),_0x34d3f1);this[_0xddc3('0x5')](_0xddc3('0x6'),_0x34d3f1);},'comment':_0xddc3('0x7')},'fullname':{'type':Sequelize[_0xddc3('0x8')],'allowNull':![],'set':function(_0xdde59f){this[_0xddc3('0x5')](_0xddc3('0x9'),_0xdde59f);this['setDataValue'](_0xddc3('0xa'),util[_0xddc3('0xb')]('\x22%s\x22\x20<%s>',_0xdde59f,this['getDataValue'](_0xddc3('0xc'))));}},'alias':{'type':Sequelize[_0xddc3('0x8')]},'email':{'type':Sequelize[_0xddc3('0x8')],'allowNull':![],'unique':_0xddc3('0xd'),'validate':{'isEmail':!![]},'set':function(_0x31ce0a){if(_0x31ce0a){this[_0xddc3('0x5')](_0xddc3('0xd'),_0x31ce0a[_0xddc3('0xe')]());}}},'role':{'type':Sequelize[_0xddc3('0xf')]('admin',_0xddc3('0x10'),_0xddc3('0x11'),_0xddc3('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xddc3('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xddc3('0x8')],'defaultValue':_0xddc3('0x13')},'internal':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':![],'unique':_0xddc3('0xc'),'set':function(_0x2b3d86){this['setDataValue'](_0xddc3('0xc'),_0x2b3d86);this[_0xddc3('0x5')](_0xddc3('0x15'),_0x2b3d86);this[_0xddc3('0x5')](_0xddc3('0xa'),util[_0xddc3('0xb')](_0xddc3('0x16'),this[_0xddc3('0x17')](_0xddc3('0x9')),_0x2b3d86));}},'salt':{'type':Sequelize[_0xddc3('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xddc3('0x8')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xddc3('0x8')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xddc3('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xddc3('0x19')]},'chatCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xddc3('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xddc3('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![],'defaultValue':_0xddc3('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xddc3('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xddc3('0x10'),_0xddc3('0x1b')),'allowNull':!![],'defaultValue':_0xddc3('0x1c')},'context':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xddc3('0xf')]('ALLOWED_NOT_SCREENED',_0xddc3('0x1d'),_0xddc3('0x1e'),_0xddc3('0x1f'),_0xddc3('0x20'),_0xddc3('0x21'),_0xddc3('0x22'),_0xddc3('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![],'defaultValue':'udp','set':function(_0x770b1c){this['setDataValue'](_0xddc3('0x24'),_0x770b1c?_0x770b1c[_0xddc3('0x25')](','):null);},'get':function(){return this[_0xddc3('0x17')](_0xddc3('0x24'))?this[_0xddc3('0x17')](_0xddc3('0x24'))[_0xddc3('0x26')](','):null;},'comment':_0xddc3('0x27')},'dtmfmode':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x28'),_0xddc3('0x29'),_0xddc3('0x2a'),_0xddc3('0x2b'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no',_0xddc3('0x2d'),_0xddc3('0x2e'),_0xddc3('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xddc3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![],'defaultValue':_0xddc3('0x30'),'set':function(_0x348815){this[_0xddc3('0x5')]('nat',_0x348815?_0x348815[_0xddc3('0x25')](','):null);},'get':function(){return this[_0xddc3('0x17')](_0xddc3('0x31'))?this['getDataValue'](_0xddc3('0x31'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xddc3('0x8')]},'namedcallgroup':{'type':Sequelize[_0xddc3('0x8')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xddc3('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xddc3('0x8')]},'disallow':{'type':Sequelize[_0xddc3('0x8')],'allowNull':![],'defaultValue':_0xddc3('0x32')},'allow':{'type':Sequelize[_0xddc3('0x8')],'allowNull':![],'defaultValue':_0xddc3('0x33'),'set':function(_0xc61838){this[_0xddc3('0x5')]('allow',_0xc61838?_0xc61838[_0xddc3('0x25')](';'):_0xddc3('0x33'));},'get':function(){return this[_0xddc3('0x17')]('allow')?this['getDataValue'](_0xddc3('0x34'))[_0xddc3('0x26')](';'):null;},'comment':_0xddc3('0x35')},'autoframing':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![],'set':function(_0x3f5076){this[_0xddc3('0x5')](_0xddc3('0x36'),_0x3f5076?_0x3f5076[_0xddc3('0x25')](','):null);},'get':function(){return this[_0xddc3('0x17')](_0xddc3('0x36'))?this[_0xddc3('0x17')](_0xddc3('0x36'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xddc3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xddc3('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xddc3('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xddc3('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xddc3('0x38')},'amaflags':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xddc3('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xddc3('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xddc3('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xddc3('0x39'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xddc3('0x3a'),_0xddc3('0x3b')),'allowNull':!![],'defaultValue':_0xddc3('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xddc3('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xddc3('0x2c')},'keepalive':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xddc3('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xddc3('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no',_0xddc3('0x3c'),_0xddc3('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xddc3('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x3e'),_0xddc3('0x3f'),_0xddc3('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xddc3('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xddc3('0xf')]('yes','no',_0xddc3('0x2d'),'update',_0xddc3('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xddc3('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0,'set':function(_0x2bc300){this[_0xddc3('0x5')](_0xddc3('0x42'),_0x2bc300);var _0x3a9753=this[_0xddc3('0x43')]({'plain':!![]});switch(_0x2bc300){case 0x0:case 0x1:var _0x5c166e=_0x3a9753[_0xddc3('0x24')]?_[_0xddc3('0x44')](_0x3a9753[_0xddc3('0x24')])?_0x3a9753[_0xddc3('0x24')][_0xddc3('0x25')]():_0x3a9753[_0xddc3('0x24')]:_0xddc3('0x45');if(_0x5c166e===_0xddc3('0x46')){_0x5c166e=_0xddc3('0x45');}this[_0xddc3('0x5')](_0xddc3('0x24'),_0x5c166e);this[_0xddc3('0x5')](_0xddc3('0x47'),'no');this[_0xddc3('0x5')](_0xddc3('0x48'),null);this['setDataValue']('force_avp',null);this[_0xddc3('0x5')](_0xddc3('0x49'),null);this[_0xddc3('0x5')]('dtlsenable',null);this['setDataValue'](_0xddc3('0x4a'),null);this[_0xddc3('0x5')](_0xddc3('0x4b'),null);this[_0xddc3('0x5')](_0xddc3('0x4c'),null);this['setDataValue'](_0xddc3('0x4d'),null);this[_0xddc3('0x5')](_0xddc3('0x4e'),'no');break;case 0x2:this[_0xddc3('0x5')](_0xddc3('0x24'),'wss');this[_0xddc3('0x5')](_0xddc3('0x47'),_0xddc3('0x2c'));this[_0xddc3('0x5')](_0xddc3('0x48'),_0xddc3('0x2c'));this[_0xddc3('0x5')](_0xddc3('0x4f'),'yes');this['setDataValue'](_0xddc3('0x49'),'yes');this[_0xddc3('0x5')](_0xddc3('0x50'),'yes');this[_0xddc3('0x5')](_0xddc3('0x4a'),'no');this[_0xddc3('0x5')](_0xddc3('0x4b'),_0xddc3('0x40'));this[_0xddc3('0x5')](_0xddc3('0x4c'),_0x3a9753['dtlscertfile']||_0xddc3('0x51'));this[_0xddc3('0x5')]('dtlsprivatekey',_0x3a9753[_0xddc3('0x4d')]||_0xddc3('0x52'));this[_0xddc3('0x5')](_0xddc3('0x4e'),_0xddc3('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x293af2){this[_0xddc3('0x5')](_0xddc3('0x53'),_0x293af2?_0x293af2[_0xddc3('0x25')](','):[]);},'get':function(){return this[_0xddc3('0x17')](_0xddc3('0x53'))?_[_0xddc3('0x54')](this[_0xddc3('0x17')](_0xddc3('0x53'))[_0xddc3('0x26')](','),function(_0x18c400){return parseInt(_0x18c400,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xddc3('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xddc3('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xddc3('0xf')](_0xddc3('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xddc3('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xddc3('0x17')](_0xddc3('0x55'))?this[_0xddc3('0x17')](_0xddc3('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xddc3('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xddc3('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![],'set':function(_0x5e0739){if(typeof _0x5e0739===_0xddc3('0x56')){var _0x5a66fd=_0x5e0739==='1'?!![]:_0x5e0739==='0'?![]:_0x5e0739==='true'?!![]:_0x5e0739===_0xddc3('0x57')?![]:![];this['setDataValue'](_0xddc3('0x58'),_0x5a66fd);}else{this[_0xddc3('0x5')]('screenrecording',_0x5e0739);}}},'blocked':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![],'set':function(_0xbbf2d){this[_0xddc3('0x5')](_0xddc3('0x59'),_0xbbf2d);if(_0xbbf2d===!![]){this[_0xddc3('0x5')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xddc3('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xddc3('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xddc3('0x14')](0x5)[_0xddc3('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xddc3('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xddc3('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0x92b5=['info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','join','nat','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','TEXT','showWebBar','get','isArray','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN','DATE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x1150dc,_0x2b8fee){var _0x3ad6bd=function(_0xe6ff2b){while(--_0xe6ff2b){_0x1150dc['push'](_0x1150dc['shift']());}};_0x3ad6bd(++_0x2b8fee);}(_0x92b5,0x149));var _0x592b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x92b5[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x592b('0x0'));var moment=require(_0x592b('0x1'));var util=require(_0x592b('0x2'));var _=require(_0x592b('0x3'));module[_0x592b('0x4')]={'name':{'type':Sequelize[_0x592b('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5d08c3){this['setDataValue'](_0x592b('0x6'),_0x5d08c3);this[_0x592b('0x7')](_0x592b('0x8'),_0x5d08c3);},'comment':_0x592b('0x9')},'fullname':{'type':Sequelize[_0x592b('0x5')],'allowNull':![],'set':function(_0x2c41d4){this[_0x592b('0x7')](_0x592b('0xa'),_0x2c41d4);this[_0x592b('0x7')](_0x592b('0xb'),util[_0x592b('0xc')]('\x22%s\x22\x20<%s>',_0x2c41d4,this[_0x592b('0xd')](_0x592b('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x592b('0x5')],'allowNull':![],'unique':_0x592b('0xf'),'validate':{'isEmail':!![]},'set':function(_0x3123e7){if(_0x3123e7){this['setDataValue'](_0x592b('0xf'),_0x3123e7[_0x592b('0x10')]());}}},'role':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x12'),_0x592b('0x13'),'agent',_0x592b('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x592b('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x592b('0x5')],'defaultValue':_0x592b('0x15')},'internal':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':![],'unique':'internal','set':function(_0x281fd7){this[_0x592b('0x7')](_0x592b('0xe'),_0x281fd7);this[_0x592b('0x7')]('accountcode',_0x281fd7);this[_0x592b('0x7')](_0x592b('0xb'),util[_0x592b('0xc')](_0x592b('0x17'),this[_0x592b('0xd')](_0x592b('0xa')),_0x281fd7));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x592b('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x592b('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x592b('0x5')]},'country':{'type':Sequelize[_0x592b('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x592b('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x592b('0x19')]},'chatCapacity':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x592b('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x592b('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x592b('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0x592b('0x1a')},'context':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![],'defaultValue':_0x592b('0x1b')},'callingpres':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x1c'),'ALLOWED_PASSED_SCREEN',_0x592b('0x1d'),_0x592b('0x1e'),_0x592b('0x1f'),_0x592b('0x20'),_0x592b('0x21'),_0x592b('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3fb77b){this['setDataValue'](_0x592b('0x23'),_0x3fb77b?_0x3fb77b['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x592b('0x23'))[_0x592b('0x24')](','):null;},'comment':_0x592b('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x592b('0x26'),_0x592b('0x27'),_0x592b('0x28'),'inband',_0x592b('0x29')),'allowNull':!![],'defaultValue':_0x592b('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0x592b('0x2a'),'no',_0x592b('0x2b'),_0x592b('0x2c'),_0x592b('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![],'defaultValue':_0x592b('0x2e'),'set':function(_0x51c7ee){this[_0x592b('0x7')]('nat',_0x51c7ee?_0x51c7ee[_0x592b('0x2f')](','):null);},'get':function(){return this[_0x592b('0xd')]('nat')?this['getDataValue'](_0x592b('0x30'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x592b('0x5')]},'namedcallgroup':{'type':Sequelize[_0x592b('0x5')]},'pickupgroup':{'type':Sequelize[_0x592b('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x592b('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x592b('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x592b('0x31'),'set':function(_0x4b7460){this['setDataValue'](_0x592b('0x32'),_0x4b7460?_0x4b7460['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x592b('0xd')]('allow')?this[_0x592b('0xd')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![],'set':function(_0x21df42){this[_0x592b('0x7')]('insecure',_0x21df42?_0x21df42[_0x592b('0x2f')](','):null);},'get':function(){return this[_0x592b('0xd')](_0x592b('0x33'))?this[_0x592b('0xd')](_0x592b('0x33'))[_0x592b('0x24')](','):null;},'comment':_0x592b('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x592b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no',_0x592b('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x592b('0x11')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x592b('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x592b('0x11')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x592b('0x11')]('accept',_0x592b('0x36'),_0x592b('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x38'),_0x592b('0x39')),'allowNull':!![],'defaultValue':_0x592b('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x592b('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x592b('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x592b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x592b('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x592b('0x11')]('yes','no',_0x592b('0x3a'),_0x592b('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x592b('0x11')]('active',_0x592b('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x592b('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x592b('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x592b('0x11')]('yes','no',_0x592b('0x2b'),_0x592b('0x2c'),_0x592b('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x592b('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x592b('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x592b('0x3e')]},'showWebBar':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0,'set':function(_0x5a6b55){this[_0x592b('0x7')](_0x592b('0x3f'),_0x5a6b55);var _0x245c21=this[_0x592b('0x40')]({'plain':!![]});switch(_0x5a6b55){case 0x0:case 0x1:var _0x3b9556=_0x245c21[_0x592b('0x23')]?_[_0x592b('0x41')](_0x245c21['transport'])?_0x245c21[_0x592b('0x23')]['join']():_0x245c21['transport']:_0x592b('0x42');if(_0x3b9556==='wss'){_0x3b9556=_0x592b('0x42');}this['setDataValue'](_0x592b('0x23'),_0x3b9556);this[_0x592b('0x7')](_0x592b('0x43'),'no');this[_0x592b('0x7')](_0x592b('0x44'),null);this[_0x592b('0x7')](_0x592b('0x45'),null);this[_0x592b('0x7')](_0x592b('0x46'),null);this[_0x592b('0x7')](_0x592b('0x47'),null);this[_0x592b('0x7')](_0x592b('0x48'),null);this['setDataValue'](_0x592b('0x49'),null);this['setDataValue'](_0x592b('0x4a'),null);this[_0x592b('0x7')](_0x592b('0x4b'),null);this[_0x592b('0x7')](_0x592b('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x592b('0x23'),_0x592b('0x4d'));this[_0x592b('0x7')]('encryption',_0x592b('0x2a'));this['setDataValue'](_0x592b('0x44'),'yes');this[_0x592b('0x7')]('force_avp','yes');this[_0x592b('0x7')](_0x592b('0x46'),_0x592b('0x2a'));this[_0x592b('0x7')](_0x592b('0x47'),_0x592b('0x2a'));this[_0x592b('0x7')](_0x592b('0x48'),'no');this[_0x592b('0x7')](_0x592b('0x49'),_0x592b('0x4e'));this[_0x592b('0x7')]('dtlscertfile',_0x245c21[_0x592b('0x4a')]||_0x592b('0x4f'));this[_0x592b('0x7')]('dtlsprivatekey',_0x245c21[_0x592b('0x4b')]||_0x592b('0x50'));this[_0x592b('0x7')](_0x592b('0x4c'),_0x592b('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x54c050){this[_0x592b('0x7')]('permissions',_0x54c050?_0x54c050[_0x592b('0x2f')](','):[]);},'get':function(){return this[_0x592b('0xd')](_0x592b('0x51'))?_[_0x592b('0x52')](this[_0x592b('0xd')](_0x592b('0x51'))[_0x592b('0x24')](','),function(_0x584437){return parseInt(_0x584437,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x592b('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x592b('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x592b('0x11')](_0x592b('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x592b('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x592b('0xd')](_0x592b('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x592b('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x592b('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x29f623){if(typeof _0x29f623===_0x592b('0x54')){var _0x1df719=_0x29f623==='1'?!![]:_0x29f623==='0'?![]:_0x29f623===_0x592b('0x55')?!![]:_0x29f623===_0x592b('0x56')?![]:![];this[_0x592b('0x7')](_0x592b('0x57'),_0x1df719);}else{this[_0x592b('0x7')]('screenrecording',_0x29f623);}}},'blocked':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![],'set':function(_0x55a1c7){this[_0x592b('0x7')](_0x592b('0x58'),_0x55a1c7);if(_0x55a1c7===!![]){this[_0x592b('0x7')]('blockedAt',moment());this[_0x592b('0x7')](_0x592b('0x59'),0x0);}else{this[_0x592b('0x7')](_0x592b('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x592b('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x592b('0x16')](0x5)[_0x592b('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x592b('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x592b('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x592b('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ee7d8b7..d449b4e 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 _0x9792=['User','query','includeAll','include','true','userSetting','attributes','push','findAll','openTabs','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','merge','options','includes','body','describe','addContacts','ids','omit','Setting','findById','max','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','length','from','voicemail','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','105','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','telephone','isEmpty','oldPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','passwordHistoryLimit','enforcePasswordHistory','updatePasswordsHistory','addQueues','online','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','penalty','QueueId','Queue:save','voice','SIP/%s','UserVoiceQueueRt','upsert','channel','Queues','Queue:remove','addAvatar','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','download','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','nolimit','getVoiceQueuesRt','findOne','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','getTeams','Team','transaction','addTeams','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$lt','$ne','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$any','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','teams','queues','inbound','flatten','toString','asc','desc','substring','uniqBy','orderBy','offline','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','messengerSoundNotification','enabled','moment','util','path','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/realtime/agents','api','../../config/utils','../../config/license/util','../../errors/api','APINotFoundError','handleError','socket.io-emitter','redis','register','defaults','localhost','client','http','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','role','agent','emit','userNotification:recalc:','get','admin','Users','user','Agents','Telephones','filter','ignore','map','value','find','UserProfileResource','destroy','end','stack','name','rawAttributes','fieldName','type','key','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where'];(function(_0x1b06e6,_0x2cf17d){var _0x3520f6=function(_0xd5a00e){while(--_0xd5a00e){_0x1b06e6['push'](_0x1b06e6['shift']());}};_0x3520f6(++_0x2cf17d);}(_0x9792,0x144));var _0x2979=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9792[_0xfae23b];return _0x200640;};'use strict';var moment=require(_0x2979('0x0'));var util=require(_0x2979('0x1'));var path=require(_0x2979('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2979('0x3'));var Redis=require('ioredis');var jayson=require(_0x2979('0x4'));var authService=require(_0x2979('0x5'));var contacts=require(_0x2979('0x6'));var qs=require('../../components/parsers/qs');var rta=require(_0x2979('0x7'));var logger=require('../../config/logger')(_0x2979('0x8'));var utils=require(_0x2979('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0x2979('0xa'));var APIBadRequestError=require(_0x2979('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0x2979('0xb'))[_0x2979('0xc')];var APIForbiddenError=require(_0x2979('0xb'))['APIForbiddenrror'];var APIHandleError=require('../../errors/api')[_0x2979('0xd')];var db=require('../../mysqldb')['db'];var socket=require(_0x2979('0xe'))(new Redis(config[_0x2979('0xf')]));require('./user.socket')[_0x2979('0x10')](socket);config[_0x2979('0xf')]=_[_0x2979('0x11')](config[_0x2979('0xf')],{'host':_0x2979('0x12'),'port':0x18eb});var amiClient=jayson[_0x2979('0x13')][_0x2979('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x46686e,_0x2ea804){_0x2ea804=_0x2ea804||0xcc;return function(_0x327016){if(_0x327016){return _0x46686e[_0x2979('0x15')](_0x2ea804);}return _0x46686e[_0x2979('0x16')](_0x2ea804)['end']();};}function respondWithResult(_0x52831c,_0x41c916){_0x41c916=_0x41c916||0xc8;return function(_0x161a67){if(_0x161a67){return _0x52831c[_0x2979('0x16')](_0x41c916)['json'](_0x161a67);}};}function respondWithFilteredResult(_0x1f4c66,_0x1249ab){return function(_0x2c3fda){if(_0x2c3fda){var _0x262e89=typeof _0x1249ab[_0x2979('0x17')]==='undefined'&&typeof _0x1249ab[_0x2979('0x18')]===_0x2979('0x19');var _0x2274a9=_0x2c3fda['count'];var _0x54a284=_0x262e89?0x0:_0x1249ab['offset'];var _0x2b7f2f=_0x262e89?_0x2c3fda[_0x2979('0x1a')]:_0x1249ab[_0x2979('0x17')]+_0x1249ab[_0x2979('0x18')];var _0x1958a8;if(_0x2b7f2f>=_0x2274a9){_0x2b7f2f=_0x2274a9;_0x1958a8=0xc8;}else{_0x1958a8=0xce;}_0x1f4c66[_0x2979('0x16')](_0x1958a8);return _0x1f4c66[_0x2979('0x1b')](_0x2979('0x1c'),_0x54a284+'-'+_0x2b7f2f+'/'+_0x2274a9)[_0x2979('0x1d')](_0x2c3fda);}return null;};}function respondWithRpcPromise(_0x5ee422,_0x5ae4fb,_0x3c8009,_0x12b80a){return new Promise(function(_0x5409df,_0xb425b4){var _0x29b176=_0x12b80a||amiClient;return _0x29b176[_0x2979('0x1e')](_0x5ee422,_0x3c8009)[_0x2979('0x1f')](function(_0x139d95){logger[_0x2979('0x20')](_0x2979('0x21'),_0x5ae4fb,_0x2979('0x22'));logger['debug'](_0x2979('0x23'),_0x5ae4fb,_0x2979('0x22'),JSON[_0x2979('0x24')](_0x139d95));if(_0x139d95[_0x2979('0x25')]){if(_0x139d95[_0x2979('0x25')][_0x2979('0x26')]===0x1f4){logger[_0x2979('0x25')]('User,\x20%s,\x20%s',_0x5ae4fb,_0x139d95[_0x2979('0x25')][_0x2979('0x27')]);return _0xb425b4(_0x139d95[_0x2979('0x25')][_0x2979('0x27')]);}logger[_0x2979('0x25')]('User,\x20%s,\x20%s',_0x5ae4fb,_0x139d95[_0x2979('0x25')]['message']);return _0x5409df(_0x139d95[_0x2979('0x25')][_0x2979('0x27')]);}else{logger[_0x2979('0x20')]('User,\x20%s,\x20%s',_0x5ae4fb,'request\x20sent');_0x5409df(_0x139d95[_0x2979('0x28')]['message']);}})[_0x2979('0x29')](function(_0x5a520a){logger[_0x2979('0x25')](_0x2979('0x21'),_0x5ae4fb,_0x5a520a);_0xb425b4(_0x5a520a);});});}function saveUpdates(_0x800c44){return function(_0x463021){if(_0x463021){return _0x463021[_0x2979('0x2a')](_0x800c44)[_0x2979('0x1f')](function(_0x177c71){if(_0x177c71[_0x2979('0x2b')]===_0x2979('0x2c')){socket[_0x2979('0x2d')](_0x2979('0x2e')+_0x177c71['id'],_0x177c71);}return _0x177c71;});}return null;};}function removeEntity(_0x20a8f0,_0x36426a){return function(_0x4e685a){if(_0x4e685a){return _0x4e685a['destroy']({'transaction':_0x36426a})['then'](function(){var _0x1173de=_0x4e685a[_0x2979('0x2f')]({'plain':!![]});if(_0x1173de[_0x2979('0x2b')]===_0x2979('0x30'))return;var _0x227590=[{'name':_0x2979('0x31'),'value':_0x2979('0x32'),'ignore':!![]},{'name':_0x2979('0x33'),'value':_0x2979('0x2c'),'ignore':![]},{'name':_0x2979('0x34'),'value':'telephone','ignore':![]}];var _0x471f2a=_(_0x227590)[_0x2979('0x35')](_0x2979('0x36'))[_0x2979('0x37')]('value')[_0x2979('0x38')]();if(_['includes'](_0x471f2a,_0x1173de['role'])){return;}var _0x5ba675=_[_0x2979('0x39')](_0x227590,[_0x2979('0x38'),_0x1173de[_0x2979('0x2b')]])['name'];return db[_0x2979('0x3a')][_0x2979('0x3b')]({'where':{'type':_0x5ba675,'resourceId':_0x1173de['id']},'transaction':_0x36426a})['then'](function(){return _0x4e685a;});})[_0x2979('0x1f')](function(){_0x20a8f0['status'](0xcc)[_0x2979('0x3c')]();});}};}function handleEntityNotFound(_0x32da5d){return function(_0x59a024){if(!_0x59a024){_0x32da5d[_0x2979('0x15')](0x194);}return _0x59a024;};}function handleError(_0x5d9ba8,_0x39df6e){_0x39df6e=_0x39df6e||0x1f4;return function(_0x587d75){logger[_0x2979('0x25')](_0x587d75[_0x2979('0x3d')]);if(_0x587d75['name']){delete _0x587d75[_0x2979('0x3e')];}_0x5d9ba8[_0x2979('0x16')](_0x39df6e)['send'](_0x587d75);};}function getUserAttributes(){return _(db['User'][_0x2979('0x3f')])['map'](function(_0x41a846){return{'name':_0x41a846[_0x2979('0x40')],'type':_0x41a846[_0x2979('0x41')][_0x2979('0x42')]};})[_0x2979('0x35')](function(_0x5b216b){return!['password','salt',_0x2979('0x43'),_0x2979('0x44'),_0x2979('0x45'),'md5secret']['includes'](_0x5b216b[_0x2979('0x3e')]);})[_0x2979('0x38')]();}exports[_0x2979('0x46')]=function(_0x22079e,_0x1dc3e8){var _0xbc3356={},_0x143e95={'count':0x0,'rows':[]};var _0x3bbead=getUserAttributes();_0xbc3356=qs[_0x2979('0x47')](_0x3bbead,_0x22079e);var _0x1ce9ff={'where':_0xbc3356[_0x2979('0x48')]};return db[_0x2979('0x49')]['count'](_0x1ce9ff)[_0x2979('0x1f')](function(_0x50340a){_0x143e95['count']=_0x50340a;if(_0x22079e[_0x2979('0x4a')][_0x2979('0x4b')]){_0xbc3356[_0x2979('0x4c')]=[{'all':!![]}];}if(_0x22079e[_0x2979('0x4a')]['userSetting']===_0x2979('0x4d')){_0xbc3356[_0x2979('0x4c')]=[{'model':db['UserSetting'],'as':_0x2979('0x4e')}];}if(!_['includes'](_0xbc3356[_0x2979('0x4f')],'id')){_0xbc3356[_0x2979('0x4f')][_0x2979('0x50')]('id');}return db['User'][_0x2979('0x51')](_0xbc3356);})['then'](function(_0x1830f1){_0x143e95['rows']=_0x1830f1;if(_0x22079e[_0x2979('0x4a')][_0x2979('0x52')]===_0x2979('0x4d')){var _0x3211bf=[];for(var _0x1ef0d9=0x0;_0x1ef0d9<_0x143e95[_0x2979('0x53')]['length'];_0x1ef0d9++){_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x54'),_0x143e95[_0x2979('0x53')][_0x1ef0d9][_0x2979('0x55')]));_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x56'),_0x143e95[_0x2979('0x53')][_0x1ef0d9][_0x2979('0x55')]));_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x57'),_0x143e95['rows'][_0x1ef0d9][_0x2979('0x55')]));_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x58'),_0x143e95[_0x2979('0x53')][_0x1ef0d9]['dataValues']));_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x59'),_0x143e95[_0x2979('0x53')][_0x1ef0d9][_0x2979('0x55')]));_0x3211bf[_0x2979('0x50')](get_open_tabs(_0x2979('0x5a'),_0x143e95[_0x2979('0x53')][_0x1ef0d9][_0x2979('0x55')]));}return Promise[_0x2979('0x5b')](_0x3211bf)[_0x2979('0x1f')](function(){return _0x143e95;});}else{return _0x143e95;}})[_0x2979('0x1f')](respondWithFilteredResult(_0x1dc3e8,_0xbc3356))['catch'](handleError(_0x1dc3e8,null));};exports[_0x2979('0x5c')]=function(_0xa4feb5,_0x51ddd4){var _0x34d886=getUserAttributes();_0xa4feb5[_0x2979('0x4a')]['id']=_0xa4feb5[_0x2979('0x5d')]['id'];var _0x153a78=qs[_0x2979('0x47')](_0x34d886,_0xa4feb5);if(_0xa4feb5[_0x2979('0x4a')][_0x2979('0x4b')]){_0x153a78[_0x2979('0x4c')]=[{'all':!![]}];}if(_0xa4feb5[_0x2979('0x4a')][_0x2979('0x4e')]===_0x2979('0x4d')){_0x153a78['include']=[{'model':db['UserSetting'],'as':_0x2979('0x4e')}];}_0x153a78=_[_0x2979('0x5e')]({},_0x153a78,_0xa4feb5[_0x2979('0x5f')]);if(!_[_0x2979('0x60')](_0x153a78['attributes'],'id')){_0x153a78[_0x2979('0x4f')][_0x2979('0x50')]('id');}return db[_0x2979('0x49')][_0x2979('0x39')](_0x153a78)[_0x2979('0x1f')](handleEntityNotFound(_0x51ddd4,null))[_0x2979('0x1f')](function(_0x228f64){var _0x3c1e6c=[];values=_0x228f64;if(_0xa4feb5['query']['openTabs']==='true'){_0x3c1e6c[_0x2979('0x50')](get_open_tabs('chat',_0x228f64[_0x2979('0x55')]));_0x3c1e6c[_0x2979('0x50')](get_open_tabs(_0x2979('0x56'),_0x228f64[_0x2979('0x55')]));_0x3c1e6c[_0x2979('0x50')](get_open_tabs(_0x2979('0x59'),_0x228f64[_0x2979('0x55')]));_0x3c1e6c['push'](get_open_tabs(_0x2979('0x5a'),_0x228f64[_0x2979('0x55')]));_0x3c1e6c[_0x2979('0x50')](get_open_tabs(_0x2979('0x57'),_0x228f64[_0x2979('0x55')]));_0x3c1e6c[_0x2979('0x50')](get_open_tabs(_0x2979('0x58'),_0x228f64['dataValues']));return Promise[_0x2979('0x5b')](_0x3c1e6c);}else{return values;}})['then'](function(){return values;})[_0x2979('0x1f')](respondWithResult(_0x51ddd4,null))[_0x2979('0x29')](handleError(_0x51ddd4,null));};exports[_0x2979('0x2a')]=function(_0x32e040,_0x361cf1){if(_0x32e040['body']['id']){delete _0x32e040[_0x2979('0x61')]['id'];}delete _0x32e040['body'][_0x2979('0x2b')];return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x32e040['params']['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x361cf1,null))['then'](saveUpdates(_0x32e040[_0x2979('0x61')],null))[_0x2979('0x1f')](respondWithResult(_0x361cf1,null))[_0x2979('0x29')](handleError(_0x361cf1,null));};exports[_0x2979('0x62')]=function(_0x2ed327,_0x456a7e){return db[_0x2979('0x49')][_0x2979('0x62')]()[_0x2979('0x1f')](respondWithResult(_0x456a7e,null))[_0x2979('0x29')](handleError(_0x456a7e,null));};exports[_0x2979('0x63')]=function(_0x367d14,_0xcd7e37){return db[_0x2979('0x49')]['find']({'where':{'id':_0x367d14[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0xcd7e37,null))[_0x2979('0x1f')](function(_0x12c6de){if(_0x12c6de){return _0x12c6de[_0x2979('0x63')](_0x367d14[_0x2979('0x61')][_0x2979('0x64')],_[_0x2979('0x65')](_0x367d14[_0x2979('0x61')],[_0x2979('0x64'),'id'])||{});}})['then'](respondWithResult(_0xcd7e37,null))[_0x2979('0x29')](handleError(_0xcd7e37,null));};function validateUser(_0x3a40b3){return new Promise(function(_0x496f9e,_0x1c265b){if(_0x3a40b3['internal'])return _0x496f9e(_0x3a40b3);return db[_0x2979('0x66')][_0x2979('0x67')](0x1)[_0x2979('0x1f')](function(_0x10a14e){if(_0x10a14e['securePassword'])authService['validatePasswordPattern'](_0x3a40b3['password']);db[_0x2979('0x49')][_0x2979('0x68')](_0x2979('0x69'))[_0x2979('0x1f')](function(_0x45b132){if(_[_0x2979('0x6a')](_0x45b132)){_0x3a40b3[_0x2979('0x69')]=_0x10a14e[_0x2979('0x6b')]||0x1;return;}if(_[_0x2979('0x6a')](_0x10a14e[_0x2979('0x6b')])||_0x10a14e['min_internal']===_0x45b132){_0x3a40b3['internal']=_0x45b132+0x1;return;}if(_0x10a14e[_0x2979('0x6b')]>_0x45b132){_0x3a40b3[_0x2979('0x69')]=_0x10a14e['min_internal'];return;}return db['sequelize'][_0x2979('0x4a')](_0x2979('0x6c'),{'type':db[_0x2979('0x6d')][_0x2979('0x6e')]['SELECT']})[_0x2979('0x1f')](function(_0x2d1e44){if(_0x2d1e44&&_0x2d1e44[_0x2979('0x6f')]){for(var _0x52c24a=0x0,_0x10e68d=_0x2d1e44[_0x2979('0x6f')];_0x52c24a<_0x10e68d&&_[_0x2979('0x6a')](_0x3a40b3[_0x2979('0x69')]);_0x52c24a++){if(_0x10a14e[_0x2979('0x6b')]<=_0x2d1e44[_0x52c24a][_0x2979('0x70')]){_0x3a40b3[_0x2979('0x69')]=_0x2d1e44[_0x52c24a][_0x2979('0x70')];}else if(_0x10a14e[_0x2979('0x6b')]>_0x2d1e44[_0x52c24a][_0x2979('0x70')]&&_0x10a14e[_0x2979('0x6b')]<=_0x2d1e44[_0x52c24a]['to']){_0x3a40b3[_0x2979('0x69')]=_0x10a14e['min_internal'];}}}if(_[_0x2979('0x6a')](_0x3a40b3[_0x2979('0x69')])){_0x3a40b3['internal']=_0x45b132+0x1;}return _0x496f9e(_0x3a40b3);});});})[_0x2979('0x29')](function(_0x221d74){_0x1c265b(_0x221d74);});});}function updateUser(_0x8e98a4){return new Promise(function(_0x34e590,_0x1b7d5d){try{if(_0x8e98a4[_0x2979('0x71')]){_0x8e98a4['mailbox']=_0x8e98a4[_0x2979('0x69')];_0x8e98a4[_0x2979('0x72')]={'mailbox':_0x8e98a4[_0x2979('0x69')],'password':_0x8e98a4['password'],'fullname':_0x8e98a4[_0x2979('0x73')],'email':_0x8e98a4[_0x2979('0x74')]};}if(_0x8e98a4[_0x2979('0x2b')]===_0x2979('0x2c')){if(!_0x8e98a4['permissions'])_0x8e98a4[_0x2979('0x75')]=[_0x2979('0x76'),_0x2979('0x77'),_0x2979('0x78'),_0x2979('0x79'),_0x2979('0x7a'),_0x2979('0x7b'),_0x2979('0x7c'),'106',_0x2979('0x7d'),_0x2979('0x7e'),_0x2979('0x7f'),_0x2979('0x80'),_0x2979('0x81'),_0x2979('0x82'),_0x2979('0x83')];}_0x34e590(_0x8e98a4);}catch(_0x45d58e){_0x1b7d5d(_0x45d58e);}});}exports[_0x2979('0x84')]=function(_0x1213e0,_0x36a8a1){if(_0x1213e0[_0x2979('0x32')][_0x2979('0x2b')]===_0x2979('0x2c'))throw new Error(_0x2979('0x85'));if(_0x1213e0['body'][_0x2979('0x2b')]===_0x2979('0x32')&&_0x1213e0['user'][_0x2979('0x2b')]!==_0x2979('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1213e0[_0x2979('0x61')][_0x2979('0x2b')]===_0x2979('0x30')&&_0x1213e0[_0x2979('0x32')][_0x2979('0x2b')]!==_0x2979('0x30')){throw new Error(_0x2979('0x86'));}return licenseUtil['checkUserLimits']([_0x1213e0[_0x2979('0x61')]])['then'](function(){return validateUser(_0x1213e0[_0x2979('0x61')]);})[_0x2979('0x1f')](function(_0x11728b){return updateUser(_0x11728b)[_0x2979('0x1f')](function(_0x39caf5){if(_0x39caf5[_0x2979('0x2b')]===_0x2979('0x30')){_0x39caf5['settingsEnabled']=_0x1213e0[_0x2979('0x32')][_0x2979('0x87')];delete _0x39caf5['userProfileId'];}return _0x39caf5;});})[_0x2979('0x1f')](function(_0x328dde){return db[_0x2979('0x49')][_0x2979('0x84')](_0x328dde,{'include':[{'model':db[_0x2979('0x72')],'as':'VoiceMail'}]});})[_0x2979('0x1f')](function(_0xff889e){if(_0x1213e0[_0x2979('0x61')]['role']===_0x2979('0x32'))return _0xff889e;if(_0x1213e0[_0x2979('0x32')]['role']!==_0x2979('0x32'))return _0xff889e;return db[_0x2979('0x88')][_0x2979('0x39')]({'where':{'name':_0xff889e['role']===_0x2979('0x2c')?'Agents':_0x2979('0x34'),'userProfileId':_0x1213e0[_0x2979('0x32')][_0x2979('0x89')]},'raw':!![]})[_0x2979('0x1f')](function(_0x5ca15a){if(!_0x5ca15a||_0x5ca15a[_0x2979('0x8a')]!=0x0)return _0xff889e;return db[_0x2979('0x3a')][_0x2979('0x84')]({'name':_0xff889e['name'],'resourceId':_0xff889e['id'],'type':_0x5ca15a[_0x2979('0x3e')],'sectionId':_0x5ca15a['id']},{})['then'](function(){return _0xff889e;});})[_0x2979('0x29')](function(_0x47b877){logger[_0x2979('0x25')](_0x2979('0x8b'),_0x47b877);throw _0x47b877;});})[_0x2979('0x1f')](respondWithResult(_0x36a8a1,0xc9))[_0x2979('0x29')](handleError(_0x36a8a1,null));};exports[_0x2979('0x8c')]=function(_0x192ae6,_0x55472c){var _0x8d8e1d=_0x192ae6['body'];var _0x320178=[];if(_0x192ae6[_0x2979('0x32')][_0x2979('0x2b')]==='agent')throw new Error('Unauthorized');if(_[_0x2979('0x8d')](_0x8d8e1d,[_0x2979('0x2b'),_0x2979('0x32')])&&_0x192ae6[_0x2979('0x32')]['role']!==_0x2979('0x30')){throw new Error(_0x2979('0x8e'));}if(_[_0x2979('0x8d')](_0x8d8e1d,[_0x2979('0x2b'),_0x2979('0x30')])&&_0x192ae6[_0x2979('0x32')][_0x2979('0x2b')]!==_0x2979('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x8d8e1d)['then'](function(){return validateUser(_0x8d8e1d[0x0]);})['then'](function(){for(var _0x12cb45=0x1;_0x12cb45<_0x8d8e1d[_0x2979('0x6f')];_0x12cb45++){var _0x46827f=_0x8d8e1d[_0x12cb45-0x1][_0x2979('0x69')];if(!_0x8d8e1d[_0x12cb45][_0x2979('0x69')])_0x8d8e1d[_0x12cb45][_0x2979('0x69')]=_0x46827f+0x1;_0x320178[_0x2979('0x50')](validateUser(_0x8d8e1d[_0x12cb45]));}return Promise[_0x2979('0x5b')](_0x320178);})[_0x2979('0x1f')](function(){_0x320178=[];for(var _0x44b0c9=0x0;_0x44b0c9<_0x8d8e1d[_0x2979('0x6f')];_0x44b0c9++){_0x320178[_0x2979('0x50')](updateUser(_0x8d8e1d[_0x44b0c9]));}return Promise[_0x2979('0x5b')](_0x320178);})['then'](function(){_0x320178=_0x8d8e1d['map'](function(_0x4ace16){return db[_0x2979('0x49')]['create'](_0x4ace16,{'include':[{'model':db[_0x2979('0x72')],'as':_0x2979('0x72')}]})['then'](function(_0x1e7e3d){_0x4ace16['id']=_0x1e7e3d['id'];return _0x4ace16;});});return Promise['all'](_0x320178);})[_0x2979('0x1f')](function(_0x186797){if(_0x192ae6[_0x2979('0x61')][_0x2979('0x2b')]===_0x2979('0x32'))return _0x186797;if(_0x192ae6[_0x2979('0x32')]['role']!=='user')return _0x186797;var _0x217ab1=_['some'](_0x186797,function(_0x4d76f5){return _0x4d76f5[_0x2979('0x2b')]==='agent'||_0x4d76f5[_0x2979('0x2b')]===_0x2979('0x8f');});if(!_0x217ab1)return _0x186797;return db[_0x2979('0x88')][_0x2979('0x51')]({'where':{'name':{'$or':[_0x2979('0x33'),_0x2979('0x34')]},'userProfileId':_0x192ae6[_0x2979('0x32')][_0x2979('0x89')]},'raw':!![]})[_0x2979('0x1f')](function(_0x2f424d){if(_[_0x2979('0x90')](_0x2f424d)||!_[_0x2979('0x8d')](_0x2f424d,[_0x2979('0x8a'),0x0]))return _0x186797;_0x320178=[];var _0x245f11=_(_0x2f424d)[_0x2979('0x37')](function(_0x15e477){if(_0x15e477[_0x2979('0x8a')]===0x1)return;return _0x15e477[_0x2979('0x3e')]===_0x2979('0x33')?_0x2979('0x2c'):_0x2979('0x8f');})['compact']()['value']();for(var _0x328f3e=0x0;_0x328f3e<_0x186797['length'];_0x328f3e++){if(!_['includes'](_0x245f11,_0x186797[_0x328f3e][_0x2979('0x2b')]))return;var _0x21069f=_0x186797[_0x328f3e][_0x2979('0x2b')]===_0x2979('0x2c')?_0x2979('0x33'):_0x2979('0x34');_0x320178['push'](db['UserProfileResource'][_0x2979('0x84')]({'name':_0x186797[_0x328f3e][_0x2979('0x3e')],'resourceId':_0x186797[_0x328f3e]['id'],'type':_0x21069f,'sectionId':_[_0x2979('0x39')](_0x2f424d,['name',_0x21069f])['id']},{}));}return Promise['all'](_0x320178);});})['then'](respondWithResult(_0x55472c,0xc9))['catch'](handleError(_0x55472c,null));};exports['changePassword']=function(_0x288a08,_0x5ee17b){if(_0x288a08[_0x2979('0x61')]['id']){delete _0x288a08[_0x2979('0x61')]['id'];}return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x288a08['params']['id']}})[_0x2979('0x1f')](function(_0x13bcc4){if(!_0x13bcc4)return null;if(_0x13bcc4['id']===_0x288a08[_0x2979('0x32')]['id']){if(!_0x288a08[_0x2979('0x61')][_0x2979('0x91')]||!_0x288a08['body']['newPassword']){throw new db[(_0x2979('0x92'))]['ValidationError'](_0x2979('0x93'));}if(!_0x13bcc4[_0x2979('0x94')](_0x288a08[_0x2979('0x61')]['oldPassword'])){throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))](_0x2979('0x96'));}if(_0x288a08['body'][_0x2979('0x91')]===_0x288a08[_0x2979('0x61')][_0x2979('0x97')]){throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))](_0x2979('0x98'));}}else if(_0x288a08[_0x2979('0x32')][_0x2979('0x2b')]===_0x2979('0x30')){if(!_0x288a08['body']['newPassword']){throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))](_0x2979('0x99'));}}else if(_0x288a08['user'][_0x2979('0x2b')]===_0x2979('0x32')){if(!_0x288a08[_0x2979('0x61')][_0x2979('0x97')]){throw new db['Sequelize'][(_0x2979('0x95'))](_0x2979('0x99'));}if(_0x13bcc4[_0x2979('0x2b')]!==_0x2979('0x2c')){throw new db[(_0x2979('0x92'))]['ValidationError'](_0x2979('0x85'));}}else{throw new db['Sequelize'][(_0x2979('0x95'))]('Unauthorized');}return _0x13bcc4;})['then'](handleEntityNotFound(_0x5ee17b,null))[_0x2979('0x1f')](function(_0x245b01){return db[_0x2979('0x66')]['findOne']({'attributes':['id',_0x2979('0x9a'),'enforcePasswordHistory',_0x2979('0x9b')]})[_0x2979('0x1f')](function(_0xc76d53){if(_0xc76d53[_0x2979('0x9a')])authService['validatePasswordPattern'](_0x288a08['body'][_0x2979('0x97')]);if(!_0xc76d53[_0x2979('0x9c')]||!_0x245b01[_0x2979('0x43')])return _0x245b01;authService['validatePasswordHistory'](_0x288a08[_0x2979('0x61')][_0x2979('0x97')],_0x245b01[_0x2979('0x43')],_0xc76d53[_0x2979('0x9b')]);return _0x245b01;})['then'](saveUpdates({'password':_0x288a08[_0x2979('0x61')][_0x2979('0x97')],'passwordResetAt':_0x288a08['user']['id']==_0x288a08[_0x2979('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x2979('0x9d')](_0x288a08['body'][_0x2979('0x97')],_0x245b01[_0x2979('0x43')])},null));})['then'](respondWithResult(_0x5ee17b,null))['catch'](handleError(_0x5ee17b,null));};exports[_0x2979('0x9e')]=function(_0xd88fff,_0x5a95b0){var _0xe40ec4=_0xd88fff[_0x2979('0x61')]['channel'];return db[_0x2979('0x49')]['find']({'where':{'id':_0xd88fff[_0x2979('0x5d')]['id']},'attributes':['id',_0x2979('0x3e'),_0x2979('0x2b'),_0x2979('0x9f'),'loginInPause',_0x2979('0xa0'),_0x2979('0xa1')]})[_0x2979('0x1f')](handleEntityNotFound(_0x5a95b0,null))[_0x2979('0x1f')](function(_0x3ac880){if(_0x3ac880){if(!utils[_0x2979('0xa2')](_0xe40ec4)){throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))](_0x2979('0xa3'));}return _0x3ac880['add'+_[_0x2979('0xa4')](_0xe40ec4[_0x2979('0xa5')]())+'Queues'](_0xd88fff['body'][_0x2979('0x64')],{'penalty':_0xd88fff['body'][_0x2979('0xa6')]||0x0})['spread'](function(_0x498bfe){for(var _0x57a8a9=0x0;_0x57a8a9<_0xd88fff[_0x2979('0x61')][_0x2979('0x64')][_0x2979('0x6f')];_0x57a8a9+=0x1){var _0x4b6c3d={'UserId':Number(_0xd88fff[_0x2979('0x5d')]['id'])};_0x4b6c3d[_[_0x2979('0xa4')](_0xe40ec4[_0x2979('0xa5')]())+_0x2979('0xa7')]=Number(_0xd88fff[_0x2979('0x61')][_0x2979('0x64')][_0x57a8a9]);socket[_0x2979('0x2d')](_0x2979('0x32')+_[_0x2979('0xa4')](_0xe40ec4[_0x2979('0xa5')]())+_0x2979('0xa8'),_0x4b6c3d);}return _0x498bfe;})[_0x2979('0x1f')](function(){if(_0xe40ec4===_0x2979('0xa9')){return db['VoiceQueue'][_0x2979('0x51')]({'where':{'id':_0xd88fff[_0x2979('0x61')][_0x2979('0x64')]||[]},'raw':!![],'attributes':['id',_0x2979('0x3e')]});}})[_0x2979('0x1f')](function(_0xe0c4b){var _0x339fdf=_0x3ac880[_0x2979('0x2f')]({'plain':!![]});var _0x5e6841=[];if(_0xe40ec4===_0x2979('0xa9')&&_0x339fdf[_0x2979('0x2b')]==='agent'&&_0x339fdf['online']){for(let _0x81716b=0x0;_0x81716b<_0xe0c4b[_0x2979('0x6f')];_0x81716b+=0x1){_0x5e6841[_0x2979('0x50')]({'membername':_0x339fdf[_0x2979('0x3e')],'UserId':_0x339fdf['id'],'queue_name':_0xe0c4b[_0x81716b]['name'],'VoiceQueueId':_0xe0c4b[_0x81716b]['id'],'interface':_['isNil'](_0x339fdf['interface'])?util['format'](_0x2979('0xaa'),_0x339fdf[_0x2979('0x3e')]):_0x339fdf[_0x2979('0xa1')],'paused':_0x339fdf['voicePause']||![],'penalty':_0xd88fff[_0x2979('0x61')][_0x2979('0xa6')]||0x0});}return Promise[_0x2979('0x5b')](_0x5e6841[_0x2979('0x37')](function(_0x5c12c9){return db[_0x2979('0xab')][_0x2979('0xac')](_0x5c12c9);}));}return _0x3ac880;});}})[_0x2979('0x1f')](respondWithStatusCode(_0x5a95b0,null))[_0x2979('0x29')](handleError(_0x5a95b0,null));};exports['removeQueues']=function(_0xe3bdfd,_0x1cf398){var _0x5bb772,_0x21cfe2;return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0xe3bdfd[_0x2979('0x5d')]['id']},'attributes':['id',_0x2979('0x3e'),_0x2979('0x2b')]})['then'](handleEntityNotFound(_0x1cf398,null))[_0x2979('0x1f')](function(_0x12f035){if(_0x12f035){_0x5bb772=_0x12f035;if(!_0xe3bdfd[_0x2979('0x4a')][_0x2979('0xad')]||!utils[_0x2979('0xa2')](_0xe3bdfd[_0x2979('0x4a')][_0x2979('0xad')])){throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))](_0x2979('0xa3'));}return _0x12f035['remove'+_[_0x2979('0xa4')](_0xe3bdfd[_0x2979('0x4a')][_0x2979('0xad')][_0x2979('0xa5')]())+_0x2979('0xae')](_0xe3bdfd[_0x2979('0x4a')][_0x2979('0x64')]);}})['then'](function(_0xa82729){if(_['isArray'](_0xe3bdfd['query'][_0x2979('0x64')])){for(var _0x5231a5=0x0;_0x5231a5<_0xe3bdfd[_0x2979('0x4a')][_0x2979('0x64')]['length'];_0x5231a5+=0x1){_0x21cfe2={'UserId':Number(_0xe3bdfd['params']['id'])};_0x21cfe2[_[_0x2979('0xa4')](_0xe3bdfd[_0x2979('0x4a')]['channel'][_0x2979('0xa5')]())+_0x2979('0xa7')]=Number(_0xe3bdfd[_0x2979('0x4a')][_0x2979('0x64')][_0x5231a5]);socket[_0x2979('0x2d')]('user'+_['capitalize'](_0xe3bdfd[_0x2979('0x4a')]['channel'][_0x2979('0xa5')]())+_0x2979('0xaf'),_0x21cfe2);}}else{_0x21cfe2={'UserId':Number(_0xe3bdfd[_0x2979('0x5d')]['id'])};_0x21cfe2[_['capitalize'](_0xe3bdfd['query'][_0x2979('0xad')][_0x2979('0xa5')]())+_0x2979('0xa7')]=Number(_0xe3bdfd[_0x2979('0x4a')][_0x2979('0x64')]);socket[_0x2979('0x2d')](_0x2979('0x32')+_[_0x2979('0xa4')](_0xe3bdfd['query'][_0x2979('0xad')][_0x2979('0xa5')]())+'Queue:remove',_0x21cfe2);}return _0xa82729;})[_0x2979('0x1f')](function(){if(_0xe3bdfd[_0x2979('0x4a')][_0x2979('0xad')]===_0x2979('0xa9')){return db[_0x2979('0xab')]['destroy']({'where':{'UserId':_0xe3bdfd[_0x2979('0x5d')]['id'],'VoiceQueueId':_0xe3bdfd[_0x2979('0x4a')]['ids']},'individualHooks':!![]})[_0x2979('0x1f')](function(){return _0x5bb772;});}return _0x5bb772;})[_0x2979('0x1f')](respondWithStatusCode(_0x1cf398,null))[_0x2979('0x29')](handleError(_0x1cf398,null));};exports[_0x2979('0xb0')]=function(_0x3d607a,_0x11f2c9){_0x3d607a['body']['userpic']=_0x3d607a[_0x2979('0xb1')][_0x2979('0xb2')];return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x3d607a['params']['id']}})['then'](handleEntityNotFound(_0x11f2c9,null))[_0x2979('0x1f')](saveUpdates(_0x3d607a['body'],null))[_0x2979('0x1f')](respondWithResult(_0x11f2c9,null))['catch'](handleError(_0x11f2c9,null));};exports['getAvatar']=function(_0x1fb530,_0x6cefb8){var _0x2c1bdf=path[_0x2979('0xb3')](config[_0x2979('0xb4')],_0x2979('0xb5'));return db['User'][_0x2979('0x39')]({'where':{'id':_0x1fb530[_0x2979('0x5d')]['id']},'attributes':['id',_0x2979('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x6cefb8,null))[_0x2979('0x1f')](function(_0x5cd981){if(_0x5cd981){if(_['isNil'](_0x5cd981[_0x2979('0xb6')])){return _0x6cefb8['download'](_0x2c1bdf);}else{if(!fs[_0x2979('0xb7')](path[_0x2979('0xb3')](config[_0x2979('0xb4')],'server/files/images/',_0x5cd981[_0x2979('0xb6')]))){return _0x6cefb8[_0x2979('0xb8')](_0x2c1bdf);}return _0x6cefb8[_0x2979('0xb8')](path[_0x2979('0xb3')](config[_0x2979('0xb4')],_0x2979('0xb9'),_0x5cd981[_0x2979('0xb6')]));}}})[_0x2979('0x29')](handleError(_0x6cefb8,null));};exports[_0x2979('0xba')]=function(_0x43c609,_0xe9a8c){return db[_0x2979('0x49')]['find']({'where':{'id':_0x43c609[_0x2979('0x5d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xe9a8c,null))['then'](function(_0x2e231b){var _0x3b88bd=[];values=_0x2e231b[_0x2979('0x55')];_0x3b88bd[_0x2979('0x50')](get_open_tabs(_0x2979('0x54'),_0x2e231b[_0x2979('0x55')]));_0x3b88bd['push'](get_open_tabs(_0x2979('0x56'),_0x2e231b[_0x2979('0x55')]));_0x3b88bd[_0x2979('0x50')](get_open_tabs(_0x2979('0x59'),_0x2e231b[_0x2979('0x55')]));_0x3b88bd[_0x2979('0x50')](get_open_tabs(_0x2979('0x5a'),_0x2e231b['dataValues']));_0x3b88bd[_0x2979('0x50')](get_open_tabs(_0x2979('0x57'),_0x2e231b['dataValues']));_0x3b88bd[_0x2979('0x50')](get_open_tabs(_0x2979('0x58'),_0x2e231b[_0x2979('0x55')]));return Promise['all'](_0x3b88bd);})[_0x2979('0x1f')](function(_0x426efd){if(_0x426efd){var _0x2b134d=_[_0x2979('0x37')](values['ChatOpenTabs'],function(_0x45f8c7){return{'channel':_0x2979('0xbb'),'id':_0x45f8c7['id'],'createdAt':_0x45f8c7[_0x2979('0xbc')]};});var _0x34219d=_[_0x2979('0x37')](values[_0x2979('0xbd')],function(_0x18c4d4){return{'channel':'FAX','id':_0x18c4d4['id'],'createdAt':_0x18c4d4[_0x2979('0xbc')]};});var _0x30a65f=_['map'](values[_0x2979('0xbe')],function(_0x5e50f5){return{'channel':_0x2979('0xbf'),'id':_0x5e50f5['id'],'createdAt':_0x5e50f5['createdAt']};});var _0x83f4eb=_[_0x2979('0x37')](values[_0x2979('0xc0')],function(_0x28d665){return{'channel':_0x2979('0xc1'),'id':_0x28d665['id'],'createdAt':_0x28d665[_0x2979('0xbc')]};});var _0x4a44b6=_['map'](values[_0x2979('0xc2')],function(_0x4307bc){return{'channel':'SMS','id':_0x4307bc['id'],'createdAt':_0x4307bc[_0x2979('0xbc')]};});var _0x4aa127=_['map'](values[_0x2979('0xc3')],function(_0x48aff6){return{'channel':_0x2979('0xc4'),'id':_0x48aff6['id'],'createdAt':_0x48aff6[_0x2979('0xbc')]};});var _0x289e80=_['concat'](_0x2b134d,_0x34219d,_0x30a65f,_0x83f4eb,_0x4a44b6,_0x4aa127);var _0x2cc657={'count':_0x289e80[_0x2979('0x6f')],'rows':_0x289e80};return _0x2cc657;}else return null;})[_0x2979('0x1f')](respondWithResult(_0xe9a8c,null))['catch'](handleError(_0xe9a8c,null));};exports[_0x2979('0xc5')]=function(_0xdbd888,_0x69768b){var _0x30e273={};return db[_0x2979('0x49')]['findOne']({'where':{'id':_0xdbd888[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](function(_0x48109e){if(!_0x48109e){throw new APINotFoundError(util[_0x2979('0xc6')](_0x2979('0xc7'),_0xdbd888['params']['id']));}return contacts[_0x2979('0x62')]();})[_0x2979('0x1f')](function(_0x1f39e7){_0xdbd888[_0x2979('0x4a')][_0x2979('0x49')]=_0xdbd888[_0x2979('0x5d')]['id'];_0x30e273=qs[_0x2979('0x47')](_0x1f39e7,_0xdbd888);if(_0xdbd888['query'][_0x2979('0xc8')]('includeAll')){_0x30e273[_0x2979('0x4c')]=[{'model':db[_0x2979('0xc9')],'as':_0x2979('0xca'),'required':![]},{'model':db[_0x2979('0xcb')],'as':_0x2979('0xcc'),'attributes':['id',_0x2979('0x3e'),_0x2979('0xcd')],'where':_0xdbd888[_0x2979('0x4a')][_0x2979('0xce')]?{'id':_0xdbd888['query'][_0x2979('0xce')]}:undefined,'required':_0xdbd888[_0x2979('0x4a')][_0x2979('0xce')]?!![]:![]}];}return contacts['findAll'](_0xdbd888[_0x2979('0x4a')],_0xdbd888['user'],_0x30e273,_0x1f39e7);})['then'](respondWithFilteredResult(_0x69768b,_0x30e273))[_0x2979('0x29')](APIHandleError(_0x69768b));};exports[_0x2979('0xcf')]=function(_0x4ec634,_0x5933ec){var _0x36c68a;var _0x892429={};var _0x47184a;return db[_0x2979('0x49')]['findOne']({'where':{'id':_0x4ec634['params']['id']},'attributes':['id',_0x2979('0x3e'),_0x2979('0x2b')]})[_0x2979('0x1f')](handleEntityNotFound(_0x5933ec,null))['then'](function(_0x364b0c){if(!utils[_0x2979('0xa2')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xad')])){throw new db[(_0x2979('0x92'))]['ValidationError'](_0x2979('0xa3'));}_0x36c68a=_0x364b0c;var _0x53b6b3={};_0x53b6b3[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_[_0x2979('0xa4')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xad')])+_0x2979('0xd2')][_0x2979('0x3f')]);_0x53b6b3[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x4ec634['query']);_0x53b6b3[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0x53b6b3[_0x2979('0xd0')],_0x53b6b3[_0x2979('0x4a')]);_0x892429[_0x2979('0x4f')]=_['intersection'](_0x53b6b3['model'],qs[_0x2979('0xd5')](_0x4ec634['query']['fields']));_0x892429['attributes']=_0x892429[_0x2979('0x4f')][_0x2979('0x6f')]?_0x892429['attributes']:_0x53b6b3[_0x2979('0xd0')];_0x892429[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xd7')]);_0x892429['where']=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x4ec634[_0x2979('0x4a')],_0x53b6b3[_0x2979('0xd3')]));if(_0x4ec634[_0x2979('0x4a')]['filter']){_0x892429[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x892429['where'],{'$or':_[_0x2979('0x37')](_0x892429['attributes'],function(_0x2a67c1){var _0xdcdca8={};_0xdcdca8[_0x2a67c1]={'$like':'%'+_0x4ec634['query'][_0x2979('0x35')]+'%'};return _0xdcdca8;})});}_0x892429=_[_0x2979('0x5e')]({},_0x892429,_0x4ec634[_0x2979('0x5f')]);switch(_0x36c68a[_0x2979('0x2b')]){case _0x2979('0x30'):return db[_[_0x2979('0xa4')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xad')])+_0x2979('0xd2')][_0x2979('0x51')](_0x892429);case _0x2979('0x32'):case _0x2979('0x2c'):return _0x36c68a[_0x2979('0x2f')+_[_0x2979('0xa4')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xad')])+'Queues'](_0x892429);default:throw new db[(_0x2979('0x92'))][(_0x2979('0x95'))]('Unknown\x20role');}})['then'](function(_0x8b438a){_0x47184a=_0x8b438a[_0x2979('0x6f')];if(!_0x4ec634['query'][_0x2979('0xc8')](_0x2979('0xd9'))){_0x892429[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x4ec634['query'][_0x2979('0x18')]);_0x892429[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x4ec634[_0x2979('0x4a')][_0x2979('0x17')]);}switch(_0x36c68a['role']){case'admin':return db[_['capitalize'](_0x4ec634['query']['channel'])+_0x2979('0xd2')][_0x2979('0x51')](_0x892429);case _0x2979('0x32'):case _0x2979('0x2c'):return _0x36c68a[_0x2979('0x2f')+_[_0x2979('0xa4')](_0x4ec634[_0x2979('0x4a')][_0x2979('0xad')])+'Queues'](_0x892429);}})[_0x2979('0x1f')](function(_0x1f2740){return{'count':_0x47184a,'rows':_0x1f2740};})[_0x2979('0x1f')](respondWithResult(_0x5933ec,null))[_0x2979('0x29')](handleError(_0x5933ec,null));};exports[_0x2979('0xda')]=function(_0x1c2d9d,_0x230eb1){var _0x1548ef={};var _0x398798={};var _0x37c5e4;var _0x57b485;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x1c2d9d['params']['id']}})['then'](handleEntityNotFound(_0x230eb1,null))[_0x2979('0x1f')](function(_0x1fdf6a){if(_0x1fdf6a){_0x37c5e4=_0x1fdf6a;_0x398798[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xab')]['rawAttributes']);_0x398798['query']=_['keys'](_0x1c2d9d[_0x2979('0x4a')]);_0x398798['filters']=_[_0x2979('0xd4')](_0x398798[_0x2979('0xd0')],_0x398798[_0x2979('0x4a')]);_0x1548ef['attributes']=_['intersection'](_0x398798[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x1c2d9d[_0x2979('0x4a')][_0x2979('0xd5')]));_0x1548ef[_0x2979('0x4f')]=_0x1548ef[_0x2979('0x4f')]['length']?_0x1548ef[_0x2979('0x4f')]:_0x398798[_0x2979('0xd0')];_0x1548ef[_0x2979('0xd6')]=qs['sort'](_0x1c2d9d['query']['sort']);_0x1548ef[_0x2979('0x48')]=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x1c2d9d['query'],_0x398798['filters']));if(_0x1c2d9d[_0x2979('0x4a')][_0x2979('0x35')]){_0x1548ef[_0x2979('0x48')]=_['merge'](_0x1548ef[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x1548ef[_0x2979('0x4f')],function(_0x2e243e){var _0x785d8={};_0x785d8[_0x2e243e]={'$like':'%'+_0x1c2d9d[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x785d8;})});}_0x1548ef=_[_0x2979('0x5e')]({},_0x1548ef,_0x1c2d9d['options']);return _0x37c5e4[_0x2979('0xda')](_0x1548ef);}})[_0x2979('0x1f')](function(_0x34a051){if(_0x34a051){_0x57b485=_0x34a051[_0x2979('0x6f')];if(!_0x1c2d9d['query'][_0x2979('0xc8')](_0x2979('0xd9'))){_0x1548ef[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x1c2d9d['query'][_0x2979('0x18')]);_0x1548ef['offset']=qs[_0x2979('0x17')](_0x1c2d9d[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x37c5e4[_0x2979('0xda')](_0x1548ef);}})[_0x2979('0x1f')](function(_0x4fe600){if(_0x4fe600){return _0x4fe600?{'count':_0x57b485,'rows':_0x4fe600}:null;}})['then'](respondWithResult(_0x230eb1,null))['catch'](handleError(_0x230eb1,null));};exports[_0x2979('0xdc')]=function(_0x1518e1,_0x43d23c){var _0x3cc2a1={};var _0x101146={};var _0x45b0d8;var _0x279232;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x1518e1[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x43d23c,null))[_0x2979('0x1f')](function(_0x16730e){if(_0x16730e){_0x45b0d8=_0x16730e;_0x101146[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xdd')][_0x2979('0x3f')]);_0x101146[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x1518e1[_0x2979('0x4a')]);_0x101146[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0x101146[_0x2979('0xd0')],_0x101146['query']);_0x3cc2a1[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x101146[_0x2979('0xd0')],qs['fields'](_0x1518e1[_0x2979('0x4a')][_0x2979('0xd5')]));_0x3cc2a1[_0x2979('0x4f')]=_0x3cc2a1[_0x2979('0x4f')][_0x2979('0x6f')]?_0x3cc2a1[_0x2979('0x4f')]:_0x101146[_0x2979('0xd0')];_0x3cc2a1['order']=qs['sort'](_0x1518e1[_0x2979('0x4a')][_0x2979('0xd7')]);_0x3cc2a1['where']=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x1518e1[_0x2979('0x4a')],_0x101146[_0x2979('0xd3')]));if(_0x1518e1['query'][_0x2979('0x35')]){_0x3cc2a1[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x3cc2a1['where'],{'$or':_[_0x2979('0x37')](_0x3cc2a1['attributes'],function(_0x542725){var _0x376881={};_0x376881[_0x542725]={'$like':'%'+_0x1518e1[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x376881;})});}_0x3cc2a1=_[_0x2979('0x5e')]({},_0x3cc2a1,_0x1518e1[_0x2979('0x5f')]);return _0x45b0d8[_0x2979('0xdc')](_0x3cc2a1);}})[_0x2979('0x1f')](function(_0x10d7b7){if(_0x10d7b7){_0x279232=_0x10d7b7[_0x2979('0x6f')];if(!_0x1518e1[_0x2979('0x4a')][_0x2979('0xc8')]('nolimit')){_0x3cc2a1['limit']=qs[_0x2979('0x18')](_0x1518e1[_0x2979('0x4a')][_0x2979('0x18')]);_0x3cc2a1['offset']=qs[_0x2979('0x17')](_0x1518e1[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x45b0d8[_0x2979('0xdc')](_0x3cc2a1);}})[_0x2979('0x1f')](function(_0x21e4bc){if(_0x21e4bc){return _0x21e4bc?{'count':_0x279232,'rows':_0x21e4bc}:null;}})['then'](respondWithResult(_0x43d23c,null))[_0x2979('0x29')](handleError(_0x43d23c,null));};exports['getRecordings']=function(_0x3c0b21,_0x5eb990){var _0x3b24e7={'raw':!![],'where':{}};var _0x34ddde={};var _0x4cd35b={'count':0x0,'rows':[]};return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x3c0b21['params']['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x5eb990,null))[_0x2979('0x1f')](function(_0x1d3297){if(_0x1d3297){_0x34ddde[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xde')]['rawAttributes']);_0x34ddde[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x3c0b21['query']);_0x34ddde[_0x2979('0xd3')]=_['intersection'](_0x34ddde[_0x2979('0xd0')],_0x34ddde['query']);_0x3b24e7[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x34ddde[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x3c0b21[_0x2979('0x4a')][_0x2979('0xd5')]));_0x3b24e7[_0x2979('0x4f')]=_0x3b24e7[_0x2979('0x4f')]['length']?_0x3b24e7[_0x2979('0x4f')]:_0x34ddde['model'];if(!_0x3c0b21['query'][_0x2979('0xc8')](_0x2979('0xd9'))){_0x3b24e7[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x3c0b21['query'][_0x2979('0x18')]);_0x3b24e7[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x3c0b21['query'][_0x2979('0x17')]);}_0x3b24e7[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x3c0b21['query'][_0x2979('0xd7')]);_0x3b24e7['where']=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x3c0b21[_0x2979('0x4a')],_0x34ddde[_0x2979('0xd3')]));_0x3b24e7[_0x2979('0x48')][_0x2979('0xdf')]=_0x1d3297['id'];if(_0x3c0b21['query']['filter']){_0x3b24e7[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x3b24e7[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x3b24e7[_0x2979('0x4f')],function(_0x45b8dc){var _0x4da894={};_0x4da894[_0x45b8dc]={'$like':'%'+_0x3c0b21[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x4da894;})});}_0x3b24e7=_[_0x2979('0x5e')]({},_0x3b24e7,_0x3c0b21[_0x2979('0x5f')]);return db['VoiceRecording']['count']({'where':_0x3b24e7[_0x2979('0x48')]})[_0x2979('0x1f')](function(_0x453c7a){_0x4cd35b[_0x2979('0x1a')]=_0x453c7a;if(_0x3c0b21[_0x2979('0x4a')][_0x2979('0x4b')]){_0x3b24e7[_0x2979('0x4c')]=[{'all':!![]}];}return db[_0x2979('0xde')][_0x2979('0x51')](_0x3b24e7);})[_0x2979('0x1f')](function(_0x83d5b2){_0x4cd35b['rows']=_0x83d5b2;return _0x4cd35b;});}})[_0x2979('0x1f')](respondWithFilteredResult(_0x5eb990,_0x3b24e7))[_0x2979('0x29')](handleError(_0x5eb990,null));};exports[_0x2979('0xe0')]=function(_0x347d15,_0x15c2b9){var _0x34b266={'raw':!![],'where':{}};var _0xd4d061={};var _0x189eb4={'count':0x0,'rows':[]};return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x347d15[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x15c2b9,null))[_0x2979('0x1f')](function(_0x5108b7){if(_0x5108b7){_0xd4d061['model']=_[_0x2979('0xd1')](db[_0x2979('0xe1')][_0x2979('0x3f')]);_0xd4d061[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x347d15['query']);_0xd4d061[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0xd4d061[_0x2979('0xd0')],_0xd4d061[_0x2979('0x4a')]);_0x34b266[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0xd4d061['model'],qs[_0x2979('0xd5')](_0x347d15[_0x2979('0x4a')]['fields']));_0x34b266[_0x2979('0x4f')]=_0x34b266[_0x2979('0x4f')][_0x2979('0x6f')]?_0x34b266[_0x2979('0x4f')]:_0xd4d061[_0x2979('0xd0')];if(!_0x347d15[_0x2979('0x4a')][_0x2979('0xc8')](_0x2979('0xd9'))){_0x34b266[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x347d15['query'][_0x2979('0x18')]);_0x34b266[_0x2979('0x17')]=qs['offset'](_0x347d15[_0x2979('0x4a')][_0x2979('0x17')]);}_0x34b266[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x347d15[_0x2979('0x4a')]['sort']);_0x34b266[_0x2979('0x48')]=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x347d15['query'],_0xd4d061[_0x2979('0xd3')]));_0x34b266[_0x2979('0x48')]['UserId']=_0x5108b7['id'];if(_0x347d15[_0x2979('0x4a')][_0x2979('0x35')]){_0x34b266['where']=_['merge'](_0x34b266[_0x2979('0x48')],{'$or':_['map'](_0x34b266[_0x2979('0x4f')],function(_0xc2bc2f){var _0x54068d={};_0x54068d[_0xc2bc2f]={'$like':'%'+_0x347d15[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x54068d;})});}_0x34b266=_[_0x2979('0x5e')]({},_0x34b266,_0x347d15[_0x2979('0x5f')]);return db[_0x2979('0xe1')][_0x2979('0x1a')]({'where':_0x34b266[_0x2979('0x48')]})['then'](function(_0x388a54){_0x189eb4[_0x2979('0x1a')]=_0x388a54;if(_0x347d15['query']['includeAll']){_0x34b266[_0x2979('0x4c')]=[{'all':!![]}];}return db[_0x2979('0xe1')]['findAll'](_0x34b266);})[_0x2979('0x1f')](function(_0x1b6551){_0x189eb4[_0x2979('0x53')]=_0x1b6551;return _0x189eb4;});}})[_0x2979('0x1f')](respondWithFilteredResult(_0x15c2b9,_0x34b266))['catch'](handleError(_0x15c2b9,null));};exports['getChatInteractions']=function(_0x105807,_0x40310a){var _0x49fec5={};var _0x5a1d24={};var _0x14d138;var _0x27b2d8;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x105807[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x40310a,null))[_0x2979('0x1f')](function(_0x545285){if(_0x545285){_0x14d138=_0x545285;_0x5a1d24[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xe2')]['rawAttributes']);_0x5a1d24[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x105807[_0x2979('0x4a')]);_0x5a1d24['filters']=_[_0x2979('0xd4')](_0x5a1d24[_0x2979('0xd0')],_0x5a1d24[_0x2979('0x4a')]);_0x49fec5[_0x2979('0x4f')]=_['intersection'](_0x5a1d24[_0x2979('0xd0')],qs['fields'](_0x105807[_0x2979('0x4a')][_0x2979('0xd5')]));_0x49fec5[_0x2979('0x4f')]=_0x49fec5['attributes']['length']?_0x49fec5[_0x2979('0x4f')]:_0x5a1d24[_0x2979('0xd0')];_0x49fec5[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x105807[_0x2979('0x4a')]['sort']);_0x49fec5[_0x2979('0x48')]=qs[_0x2979('0xd3')](_['pick'](_0x105807['query'],_0x5a1d24[_0x2979('0xd3')]));if(_0x105807[_0x2979('0x4a')][_0x2979('0x35')]){_0x49fec5[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x49fec5[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x49fec5[_0x2979('0x4f')],function(_0xf865b8){var _0xfa0165={};_0xfa0165[_0xf865b8]={'$like':'%'+_0x105807[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0xfa0165;})});}_0x49fec5=_[_0x2979('0x5e')]({},_0x49fec5,_0x105807[_0x2979('0x5f')]);return _0x14d138[_0x2979('0xe3')](_0x49fec5);}})[_0x2979('0x1f')](function(_0x592d39){if(_0x592d39){_0x27b2d8=_0x592d39[_0x2979('0x6f')];if(!_0x105807[_0x2979('0x4a')][_0x2979('0xc8')](_0x2979('0xd9'))){_0x49fec5[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x105807[_0x2979('0x4a')][_0x2979('0x18')]);_0x49fec5[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x105807[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x14d138[_0x2979('0xe3')](_0x49fec5);}})['then'](function(_0x589bab){if(_0x589bab){return _0x589bab?{'count':_0x27b2d8,'rows':_0x589bab}:null;}})[_0x2979('0x1f')](respondWithResult(_0x40310a,null))[_0x2979('0x29')](handleError(_0x40310a,null));};exports['getOpenchannelInteractions']=function(_0x5557ce,_0x190572){var _0x3dce10={};var _0x201915={};var _0xf88bf7;var _0x4e2e1f;return db['User'][_0x2979('0xdb')]({'where':{'id':_0x5557ce[_0x2979('0x5d')]['id']}})['then'](handleEntityNotFound(_0x190572,null))[_0x2979('0x1f')](function(_0x393d76){if(_0x393d76){_0xf88bf7=_0x393d76;_0x201915[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xe4')][_0x2979('0x3f')]);_0x201915['query']=_[_0x2979('0xd1')](_0x5557ce[_0x2979('0x4a')]);_0x201915['filters']=_[_0x2979('0xd4')](_0x201915[_0x2979('0xd0')],_0x201915['query']);_0x3dce10[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x201915[_0x2979('0xd0')],qs['fields'](_0x5557ce[_0x2979('0x4a')]['fields']));_0x3dce10['attributes']=_0x3dce10[_0x2979('0x4f')][_0x2979('0x6f')]?_0x3dce10[_0x2979('0x4f')]:_0x201915[_0x2979('0xd0')];_0x3dce10[_0x2979('0xd6')]=qs['sort'](_0x5557ce[_0x2979('0x4a')][_0x2979('0xd7')]);_0x3dce10[_0x2979('0x48')]=qs['filters'](_['pick'](_0x5557ce[_0x2979('0x4a')],_0x201915['filters']));if(_0x5557ce[_0x2979('0x4a')][_0x2979('0x35')]){_0x3dce10['where']=_[_0x2979('0x5e')](_0x3dce10[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x3dce10['attributes'],function(_0x7cffc4){var _0x46d1af={};_0x46d1af[_0x7cffc4]={'$like':'%'+_0x5557ce['query']['filter']+'%'};return _0x46d1af;})});}_0x3dce10=_[_0x2979('0x5e')]({},_0x3dce10,_0x5557ce[_0x2979('0x5f')]);return _0xf88bf7[_0x2979('0xe5')](_0x3dce10);}})['then'](function(_0x20ad1d){if(_0x20ad1d){_0x4e2e1f=_0x20ad1d[_0x2979('0x6f')];if(!_0x5557ce[_0x2979('0x4a')][_0x2979('0xc8')](_0x2979('0xd9'))){_0x3dce10['limit']=qs[_0x2979('0x18')](_0x5557ce[_0x2979('0x4a')][_0x2979('0x18')]);_0x3dce10[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x5557ce[_0x2979('0x4a')]['offset']);}return _0xf88bf7[_0x2979('0xe5')](_0x3dce10);}})['then'](function(_0x1c79c5){if(_0x1c79c5){return _0x1c79c5?{'count':_0x4e2e1f,'rows':_0x1c79c5}:null;}})[_0x2979('0x1f')](respondWithResult(_0x190572,null))[_0x2979('0x29')](handleError(_0x190572,null));};exports[_0x2979('0xe6')]=function(_0x18adb0,_0x2bb342){var _0x1fd347={'raw':!![],'where':{}};var _0x54616e={};var _0x59ac01={'count':0x0,'rows':[]};return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x18adb0[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x2bb342,null))[_0x2979('0x1f')](function(_0x1c11d6){if(_0x1c11d6){_0x54616e[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xe7')][_0x2979('0x3f')]);_0x54616e[_0x2979('0x4a')]=_['keys'](_0x18adb0[_0x2979('0x4a')]);_0x54616e['filters']=_[_0x2979('0xd4')](_0x54616e['model'],_0x54616e[_0x2979('0x4a')]);_0x1fd347[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x54616e[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x18adb0[_0x2979('0x4a')][_0x2979('0xd5')]));_0x1fd347['attributes']=_0x1fd347[_0x2979('0x4f')][_0x2979('0x6f')]?_0x1fd347['attributes']:_0x54616e[_0x2979('0xd0')];if(!_0x18adb0[_0x2979('0x4a')]['hasOwnProperty']('nolimit')){_0x1fd347[_0x2979('0x18')]=qs['limit'](_0x18adb0[_0x2979('0x4a')][_0x2979('0x18')]);_0x1fd347[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x18adb0[_0x2979('0x4a')][_0x2979('0x17')]);}_0x1fd347[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x18adb0['query']['sort']);_0x1fd347['where']=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x18adb0[_0x2979('0x4a')],_0x54616e['filters']));_0x1fd347[_0x2979('0x48')][_0x2979('0xdf')]=_0x1c11d6['id'];if(_0x18adb0[_0x2979('0x4a')][_0x2979('0x35')]){_0x1fd347[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x1fd347[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x1fd347[_0x2979('0x4f')],function(_0x5e33cb){var _0x1417a2={};_0x1417a2[_0x5e33cb]={'$like':'%'+_0x18adb0[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x1417a2;})});}_0x1fd347=_[_0x2979('0x5e')]({},_0x1fd347,_0x18adb0['options']);return db[_0x2979('0xe7')]['count']({'where':_0x1fd347[_0x2979('0x48')]})[_0x2979('0x1f')](function(_0x23ac88){_0x59ac01[_0x2979('0x1a')]=_0x23ac88;if(_0x18adb0[_0x2979('0x4a')][_0x2979('0x4b')]){_0x1fd347[_0x2979('0x4c')]=[{'all':!![]}];}return db[_0x2979('0xe7')][_0x2979('0x51')](_0x1fd347);})[_0x2979('0x1f')](function(_0x5a165f){_0x59ac01[_0x2979('0x53')]=_0x5a165f;return _0x59ac01;});}})[_0x2979('0x1f')](respondWithFilteredResult(_0x2bb342,_0x1fd347))[_0x2979('0x29')](handleError(_0x2bb342,null));};exports['getSmsInteractions']=function(_0x3245f1,_0x4f986f){var _0x5bf788={};var _0x2edb08={};var _0x239d04;var _0x2b5821;return db['User']['findOne']({'where':{'id':_0x3245f1[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x4f986f,null))[_0x2979('0x1f')](function(_0x1c80c9){if(_0x1c80c9){_0x239d04=_0x1c80c9;_0x2edb08['model']=_[_0x2979('0xd1')](db['SmsInteraction'][_0x2979('0x3f')]);_0x2edb08['query']=_[_0x2979('0xd1')](_0x3245f1['query']);_0x2edb08[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0x2edb08['model'],_0x2edb08['query']);_0x5bf788[_0x2979('0x4f')]=_['intersection'](_0x2edb08['model'],qs[_0x2979('0xd5')](_0x3245f1['query'][_0x2979('0xd5')]));_0x5bf788['attributes']=_0x5bf788[_0x2979('0x4f')][_0x2979('0x6f')]?_0x5bf788[_0x2979('0x4f')]:_0x2edb08['model'];_0x5bf788[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x3245f1[_0x2979('0x4a')][_0x2979('0xd7')]);_0x5bf788[_0x2979('0x48')]=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x3245f1[_0x2979('0x4a')],_0x2edb08[_0x2979('0xd3')]));if(_0x3245f1['query'][_0x2979('0x35')]){_0x5bf788[_0x2979('0x48')]=_['merge'](_0x5bf788[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x5bf788[_0x2979('0x4f')],function(_0x487604){var _0x136f91={};_0x136f91[_0x487604]={'$like':'%'+_0x3245f1[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x136f91;})});}_0x5bf788=_['merge']({},_0x5bf788,_0x3245f1[_0x2979('0x5f')]);return _0x239d04['getSmsInteractions'](_0x5bf788);}})[_0x2979('0x1f')](function(_0x359e8c){if(_0x359e8c){_0x2b5821=_0x359e8c[_0x2979('0x6f')];if(!_0x3245f1['query'][_0x2979('0xc8')](_0x2979('0xd9'))){_0x5bf788[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x3245f1['query'][_0x2979('0x18')]);_0x5bf788[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x3245f1[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x239d04[_0x2979('0xe8')](_0x5bf788);}})[_0x2979('0x1f')](function(_0x218553){if(_0x218553){return _0x218553?{'count':_0x2b5821,'rows':_0x218553}:null;}})[_0x2979('0x1f')](respondWithResult(_0x4f986f,null))['catch'](handleError(_0x4f986f,null));};exports['getFaxInteractions']=function(_0x5d9ac7,_0x25dcdb){var _0x5bf7ec={};var _0x4bbf35={};var _0x524cd2;var _0x23f156;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x5d9ac7[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x25dcdb,null))[_0x2979('0x1f')](function(_0x2fbf12){if(_0x2fbf12){_0x524cd2=_0x2fbf12;_0x4bbf35[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0xe9')]['rawAttributes']);_0x4bbf35['query']=_[_0x2979('0xd1')](_0x5d9ac7[_0x2979('0x4a')]);_0x4bbf35['filters']=_[_0x2979('0xd4')](_0x4bbf35[_0x2979('0xd0')],_0x4bbf35['query']);_0x5bf7ec[_0x2979('0x4f')]=_['intersection'](_0x4bbf35[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x5d9ac7[_0x2979('0x4a')][_0x2979('0xd5')]));_0x5bf7ec[_0x2979('0x4f')]=_0x5bf7ec[_0x2979('0x4f')]['length']?_0x5bf7ec[_0x2979('0x4f')]:_0x4bbf35[_0x2979('0xd0')];_0x5bf7ec[_0x2979('0xd6')]=qs[_0x2979('0xd7')](_0x5d9ac7['query'][_0x2979('0xd7')]);_0x5bf7ec[_0x2979('0x48')]=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x5d9ac7['query'],_0x4bbf35[_0x2979('0xd3')]));if(_0x5d9ac7[_0x2979('0x4a')][_0x2979('0x35')]){_0x5bf7ec['where']=_[_0x2979('0x5e')](_0x5bf7ec[_0x2979('0x48')],{'$or':_['map'](_0x5bf7ec['attributes'],function(_0x3317a5){var _0x52b8dc={};_0x52b8dc[_0x3317a5]={'$like':'%'+_0x5d9ac7[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x52b8dc;})});}_0x5bf7ec=_[_0x2979('0x5e')]({},_0x5bf7ec,_0x5d9ac7['options']);return _0x524cd2['getFaxInteractions'](_0x5bf7ec);}})[_0x2979('0x1f')](function(_0xdee47f){if(_0xdee47f){_0x23f156=_0xdee47f[_0x2979('0x6f')];if(!_0x5d9ac7[_0x2979('0x4a')][_0x2979('0xc8')](_0x2979('0xd9'))){_0x5bf7ec[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x5d9ac7[_0x2979('0x4a')][_0x2979('0x18')]);_0x5bf7ec['offset']=qs[_0x2979('0x17')](_0x5d9ac7[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x524cd2[_0x2979('0xea')](_0x5bf7ec);}})[_0x2979('0x1f')](function(_0xd5457f){if(_0xd5457f){return _0xd5457f?{'count':_0x23f156,'rows':_0xd5457f}:null;}})[_0x2979('0x1f')](respondWithResult(_0x25dcdb,null))['catch'](handleError(_0x25dcdb,null));};exports[_0x2979('0xeb')]=function(_0x207c97,_0x423959){var _0x3e1843={};var _0x7c6ca3={};var _0xb0a6c5;var _0x4e1ff3;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x207c97[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x423959,null))['then'](function(_0x5bf28b){if(_0x5bf28b){_0xb0a6c5=_0x5bf28b;_0x7c6ca3['model']=_[_0x2979('0xd1')](db[_0x2979('0xec')]['rawAttributes']);_0x7c6ca3[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x207c97[_0x2979('0x4a')]);_0x7c6ca3[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0x7c6ca3[_0x2979('0xd0')],_0x7c6ca3[_0x2979('0x4a')]);_0x3e1843[_0x2979('0x4f')]=_['intersection'](_0x7c6ca3[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x207c97[_0x2979('0x4a')][_0x2979('0xd5')]));_0x3e1843[_0x2979('0x4f')]=_0x3e1843[_0x2979('0x4f')][_0x2979('0x6f')]?_0x3e1843[_0x2979('0x4f')]:_0x7c6ca3[_0x2979('0xd0')];_0x3e1843['order']=qs['sort'](_0x207c97[_0x2979('0x4a')]['sort']);_0x3e1843[_0x2979('0x48')]=qs['filters'](_[_0x2979('0xd8')](_0x207c97[_0x2979('0x4a')],_0x7c6ca3[_0x2979('0xd3')]));if(_0x207c97['query'][_0x2979('0x35')]){_0x3e1843[_0x2979('0x48')]=_['merge'](_0x3e1843[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x3e1843[_0x2979('0x4f')],function(_0x1d76c0){var _0x15d1d1={};_0x15d1d1[_0x1d76c0]={'$like':'%'+_0x207c97[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x15d1d1;})});}_0x3e1843=_[_0x2979('0x5e')]({},_0x3e1843,_0x207c97[_0x2979('0x5f')]);return _0xb0a6c5['getWhatsappInteractions'](_0x3e1843);}})[_0x2979('0x1f')](function(_0x276aeb){if(_0x276aeb){_0x4e1ff3=_0x276aeb[_0x2979('0x6f')];if(!_0x207c97[_0x2979('0x4a')]['hasOwnProperty'](_0x2979('0xd9'))){_0x3e1843[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x207c97[_0x2979('0x4a')][_0x2979('0x18')]);_0x3e1843[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x207c97[_0x2979('0x4a')][_0x2979('0x17')]);}return _0xb0a6c5[_0x2979('0xeb')](_0x3e1843);}})[_0x2979('0x1f')](function(_0x1dd333){if(_0x1dd333){return _0x1dd333?{'count':_0x4e1ff3,'rows':_0x1dd333}:null;}})['then'](respondWithResult(_0x423959,null))['catch'](handleError(_0x423959,null));};exports['login']=function(_0x3a4c33,_0x305836,_0x4f66a8){var _0x56eb8e;var _0x13a909;var _0x20d276;var _0x568870=!_[_0x2979('0x6a')](_0x3a4c33[_0x2979('0x5d')]['id'])?_0x3a4c33[_0x2979('0x5d')]['id']:!_[_0x2979('0x6a')](_0x3a4c33[_0x2979('0x32')]['id'])?_0x3a4c33[_0x2979('0x32')]['id']:null;return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x568870,'role':{'$or':[_0x2979('0x30'),_0x2979('0x32'),'agent']}},'attributes':['id',_0x2979('0x3e'),_0x2979('0xed'),_0x2979('0xee'),'role',_0x2979('0x69'),_0x2979('0xef')]})['then'](function(_0x1c0072){if(_0x1c0072){if(_0x1c0072['role']===_0x2979('0x2c')){_0x56eb8e=_0x1c0072;if(_0x3a4c33['body']['interface']){_0x20d276=util['format'](_0x2979('0xf0'),_0x56eb8e[_0x3a4c33[_0x2979('0x61')][_0x2979('0xa1')]]);}else if(_0x3a4c33[_0x2979('0x61')][_0x2979('0xf1')]){_0x20d276=util[_0x2979('0xc6')](_0x2979('0xaa'),_0x3a4c33[_0x2979('0x61')]['intrf']);}else{_0x20d276=util[_0x2979('0xc6')](_0x2979('0xaa'),_0x56eb8e[_0x2979('0x3e')]);}socket['to'](util['format']('user:%s',_0x56eb8e[_0x2979('0x3e')]))['emit']('user:forcelogout',{'user':{'id':_0x56eb8e['id'],'name':_0x56eb8e[_0x2979('0x3e')]},'ip':_0x3a4c33['headers'][_0x2979('0xf2')]||_0x3a4c33[_0x2979('0xf3')][_0x2979('0xf4')]||_0x3a4c33['socket'][_0x2979('0xf4')]||_0x3a4c33[_0x2979('0xf3')][_0x2979('0xf5')][_0x2979('0xf4')]});return db[_0x2979('0xab')][_0x2979('0x3b')]({'where':{'membername':_0x56eb8e[_0x2979('0x3e')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x2979('0x95'))](_0x2979('0xf6'));}})[_0x2979('0x1f')](function(){if(_0x56eb8e){return _0x56eb8e[_0x2979('0xf7')]({'raw':!![]});}})[_0x2979('0x1f')](function(_0x2a9577){if(_0x56eb8e){if(_0x2a9577){_0x13a909=_0x2a9577;if(_0x13a909['length']){var _0x404d04=_0x13a909[_0x2979('0x37')](function(_0x32a6f1){var _0x2120f3={'membername':_0x56eb8e[_0x2979('0x3e')],'UserId':_0x56eb8e['id'],'queue_name':_0x32a6f1[_0x2979('0x3e')],'VoiceQueueId':_0x32a6f1['id'],'interface':_0x20d276,'paused':_0x56eb8e[_0x2979('0xef')]||![],'penalty':_0x32a6f1[_0x2979('0xf8')]||0x0};return db[_0x2979('0xab')]['upsert'](_0x2120f3);});return Promise['all'](_0x404d04);}}}})['then'](function(){if(_0x56eb8e){return db[_0x2979('0xf9')][_0x2979('0x51')]({'where':{'membername':_0x56eb8e['name'],'exitAt':null}});}})[_0x2979('0x1f')](function(_0x2dce4f){if(_0x56eb8e){var _0x25d545=[];_0x2dce4f[_0x2979('0xfa')](function(_0x5367f7){_0x25d545[_0x2979('0x50')](_0x5367f7[_0x2979('0x2a')]({'exitAt':moment()[_0x2979('0xc6')](_0x2979('0xfb'))}));});return Promise['all'](_0x25d545);}})[_0x2979('0x1f')](function(){if(_0x56eb8e){var _0x5f522f=[];var _0x27ff36=[];var _0x3aca11=utils[_0x2979('0xfc')]();var _0x2c00db={'membername':_0x56eb8e[_0x2979('0x3e')],'interface':_0x20d276,'enterAt':moment()[_0x2979('0xc6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x56eb8e[_0x2979('0x2b')],'internal':_0x56eb8e['internal']};_0x3aca11['forEach'](function(_0x264620){_0x5f522f[_0x2979('0x50')](_['merge']({'channel':_0x264620,'type':_0x2979('0xfd'),'data1':_0x3a4c33[_0x2979('0x61')][_0x2979('0xfe')],'data2':_0x20d276},_0x2c00db));if(_0x56eb8e[_0x2979('0xef')]){_0x27ff36[_0x2979('0x50')](_['merge']({'channel':_0x264620,'type':_0x2979('0xff'),'data1':_0x2979('0x100')},_0x2c00db));}});return db['MemberReport']['bulkCreate'](_0x5f522f[_0x2979('0x101')](_0x27ff36),{'individualHooks':!![]});}})['then'](function(){if(_0x56eb8e){return _0x56eb8e[_0x2979('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x2979('0xc6')](_0x2979('0xfb')),'voicePause':_0x56eb8e[_0x2979('0xef')]||![],'mailPause':_0x56eb8e[_0x2979('0xef')]||![],'chatPause':_0x56eb8e[_0x2979('0xef')]||![],'faxPause':_0x56eb8e[_0x2979('0xef')]||![],'smsPause':_0x56eb8e[_0x2979('0xef')]||![],'openchannelPause':_0x56eb8e[_0x2979('0xef')]||![],'whatsappPause':_0x56eb8e[_0x2979('0xef')]||![],'pauseType':_0x56eb8e['loginInPause']?_0x2979('0x100'):null,'interface':_0x20d276,'lastPauseAt':moment()[_0x2979('0xc6')](_0x2979('0xfb'))});}})[_0x2979('0x1f')](function(_0xcf1d5c){if(_0x3a4c33[_0x2979('0x102')]){return _0x4f66a8();}else{return Promise[_0x2979('0x103')](_0xcf1d5c)[_0x2979('0x1f')](respondWithResult(_0x305836,null));}})[_0x2979('0x29')](handleError(_0x305836,null));};exports[_0x2979('0x104')]=function(_0x38a6a9,_0x510d98){var _0x10a420;return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x38a6a9[_0x2979('0x5d')]['id'],'role':_0x2979('0x2c')},'attributes':['id','name',_0x2979('0x2b')]})[_0x2979('0x1f')](handleEntityNotFound(_0x510d98,null))['then'](function(_0xa3e3d4){if(_0xa3e3d4){_0x10a420=_0xa3e3d4;return db[_0x2979('0xab')][_0x2979('0x3b')]({'where':{'membername':_0x10a420['name']},'individualHooks':!![]});}})[_0x2979('0x1f')](function(){return db['MemberReport'][_0x2979('0x51')]({'where':{'membername':_0x10a420['name'],'exitAt':null}});})[_0x2979('0x1f')](function(_0xf1710c){var _0x2f7495=[];_0xf1710c['forEach'](function(_0x29bb6b){_0x2f7495['push'](_0x29bb6b[_0x2979('0x2a')]({'exitAt':moment()['format'](_0x2979('0xfb'))}));});return Promise[_0x2979('0x5b')](_0x2f7495);})[_0x2979('0x1f')](function(){return _0x10a420[_0x2979('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2979('0x1f')](respondWithResult(_0x510d98,null))[_0x2979('0x29')](handleError(_0x510d98,null));};exports[_0x2979('0x105')]=function(_0x41b137,_0x36fad1){var _0x3aeb9f;return db[_0x2979('0xab')][_0x2979('0x2a')]({'paused':0x1},{'where':{'UserId':_0x41b137['params']['id']},'individualHooks':!![]})[_0x2979('0x1f')](function(){return db[_0x2979('0x49')]['find']({'where':{'id':_0x41b137[_0x2979('0x5d')]['id'],'role':_0x2979('0x2c')},'attributes':['id',_0x2979('0x3e'),_0x2979('0x2b'),_0x2979('0x69'),_0x2979('0xa1'),_0x2979('0x9f')]});})[_0x2979('0x1f')](handleEntityNotFound(_0x36fad1,null))[_0x2979('0x1f')](function(_0x199e05){if(_0x199e05){_0x3aeb9f=_0x199e05;return respondWithRpcPromise(_0x2979('0x106'),_0x2979('0x105'),{'id':_0x3aeb9f['id'],'name':_0x3aeb9f[_0x2979('0x3e')],'pause':!![]});}})[_0x2979('0x1f')](function(){if(_0x3aeb9f){return db[_0x2979('0xf9')][_0x2979('0x51')]({'where':{'membername':_0x3aeb9f[_0x2979('0x3e')],'type':'PAUSE','exitAt':null}});}})[_0x2979('0x1f')](function(_0x368c1d){if(_0x368c1d[_0x2979('0x6f')]){var _0x5a240a=moment()[_0x2979('0xc6')](_0x2979('0xfb'));for(var _0x2cd2bb=0x0,_0x1629b2=_0x368c1d[_0x2979('0x6f')];_0x2cd2bb<_0x1629b2;_0x2cd2bb++){_0x368c1d[_0x2cd2bb][_0x2979('0x107')]({'exitAt':_0x5a240a});}}})[_0x2979('0x1f')](function(){var _0xf47cb7=[];var _0x331e7d=utils[_0x2979('0xfc')]();_0x331e7d[_0x2979('0xfa')](function(_0x1ec90d){_0xf47cb7[_0x2979('0x50')]({'channel':_0x1ec90d,'membername':_0x3aeb9f['name'],'interface':_[_0x2979('0x6a')](_0x3aeb9f[_0x2979('0xa1')])?util['format'](_0x2979('0xaa'),_0x3aeb9f['name']):_0x3aeb9f['interface'],'type':'PAUSE','enterAt':moment()[_0x2979('0xc6')](_0x2979('0xfb')),'data1':_0x41b137[_0x2979('0x61')][_0x2979('0x41')]||_0x2979('0x108'),'role':_0x3aeb9f['role'],'internal':_0x3aeb9f['internal']});});return db['MemberReport'][_0x2979('0x8c')](_0xf47cb7,{'individualHooks':!![]});})['then'](function(){return _0x3aeb9f[_0x2979('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x41b137[_0x2979('0x61')]['type']||_0x2979('0x108'),'lastPauseAt':moment()[_0x2979('0xc6')](_0x2979('0xfb'))});})[_0x2979('0x1f')](respondWithResult(_0x36fad1,null))[_0x2979('0x29')](handleError(_0x36fad1,null));};exports[_0x2979('0x109')]=function(_0x56da1b,_0x40f1d6){if(_0x56da1b[_0x2979('0x61')][_0x2979('0xad')]&&!utils['isValidChannel'](_0x56da1b['body']['channel'])){throw new APIBadRequestError(util[_0x2979('0xc6')](_0x2979('0x10a'),_0x56da1b[_0x2979('0x61')][_0x2979('0xad')]));}return db[_0x2979('0x49')][_0x2979('0x39')]({'where':{'id':_0x56da1b[_0x2979('0x5d')]['id']},'attributes':['id',_0x2979('0x3e'),'role',_0x2979('0x69'),_0x2979('0xa1'),_0x2979('0x9f'),_0x2979('0xa0'),'mailPause',_0x2979('0x10b'),_0x2979('0x10c'),_0x2979('0x10d'),_0x2979('0x10e'),_0x2979('0x10f'),_0x2979('0x110'),'lastPauseAt']})[_0x2979('0x1f')](function(_0x4339c9){if(!_0x4339c9){throw new APINotFoundError(util['format'](_0x2979('0xc7'),_0x56da1b[_0x2979('0x5d')]['id']));}return _0x4339c9['unpause'](_0x56da1b[_0x2979('0x61')][_0x2979('0xad')]);})[_0x2979('0x1f')](respondWithResult(_0x40f1d6,null))['catch'](APIHandleError(_0x40f1d6));};exports[_0x2979('0x111')]=function(_0x502493,_0xe7bf79){var _0x1b4e0e={};var _0x28e484={};var _0x190574;var _0x79c77e;return db['User'][_0x2979('0xdb')]({'where':{'id':_0x502493[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0xe7bf79,null))['then'](function(_0x5d757e){if(_0x5d757e){_0x190574=_0x5d757e;_0x28e484[_0x2979('0xd0')]=_['keys'](db[_0x2979('0x112')]['rawAttributes']);_0x28e484['query']=_['keys'](_0x502493[_0x2979('0x4a')]);_0x28e484['filters']=_['intersection'](_0x28e484['model'],_0x28e484['query']);_0x1b4e0e[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x28e484[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x502493[_0x2979('0x4a')]['fields']));_0x1b4e0e[_0x2979('0x4f')]=_0x1b4e0e[_0x2979('0x4f')][_0x2979('0x6f')]?_0x1b4e0e[_0x2979('0x4f')]:_0x28e484[_0x2979('0xd0')];_0x1b4e0e['order']=qs['sort'](_0x502493[_0x2979('0x4a')][_0x2979('0xd7')]);_0x1b4e0e[_0x2979('0x48')]=qs[_0x2979('0xd3')](_['pick'](_0x502493[_0x2979('0x4a')],_0x28e484['filters']));if(_0x502493[_0x2979('0x4a')][_0x2979('0x35')]){_0x1b4e0e[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x1b4e0e[_0x2979('0x48')],{'$or':_[_0x2979('0x37')](_0x1b4e0e[_0x2979('0x4f')],function(_0x50ddf5){var _0x517c2a={};_0x517c2a[_0x50ddf5]={'$like':'%'+_0x502493[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x517c2a;})});}_0x1b4e0e=_[_0x2979('0x5e')]({},_0x1b4e0e,_0x502493[_0x2979('0x5f')]);return _0x190574['getTeams'](_0x1b4e0e);}})[_0x2979('0x1f')](function(_0x271ceb){if(_0x271ceb){_0x79c77e=_0x271ceb['length'];if(!_0x502493['query'][_0x2979('0xc8')](_0x2979('0xd9'))){_0x1b4e0e[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x502493[_0x2979('0x4a')][_0x2979('0x18')]);_0x1b4e0e[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x502493[_0x2979('0x4a')]['offset']);}return _0x190574[_0x2979('0x111')](_0x1b4e0e);}})['then'](function(_0x5a10a3){if(_0x5a10a3){return _0x5a10a3?{'count':_0x79c77e,'rows':_0x5a10a3}:null;}})[_0x2979('0x1f')](respondWithResult(_0xe7bf79,null))['catch'](handleError(_0xe7bf79,null));};exports['addTeams']=function(_0x1c6604,_0x57c969){var _0x41c799=_0x1c6604[_0x2979('0x5d')]['id'];var _0x51fbec=_0x1c6604[_0x2979('0x61')]?_0x1c6604[_0x2979('0x61')][_0x2979('0x64')]:null;var _0x40133b=[];return Promise[_0x2979('0x103')]()[_0x2979('0x1f')](function(){if(!_0x51fbec)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x2979('0xdb')]({'where':{'id':_0x41c799}});})[_0x2979('0x1f')](function(_0x23e7cc){if(!_0x23e7cc)throw new APINotFoundError(util[_0x2979('0xc6')](_0x2979('0xc7'),_0x1c6604[_0x2979('0x5d')]['id']));return db[_0x2979('0x6d')][_0x2979('0x113')](function(_0x13314c){return _0x23e7cc[_0x2979('0x114')](_0x51fbec,{'transaction':_0x13314c})['then'](function(){return db[_0x2979('0x112')][_0x2979('0x51')]({'where':{'id':{'$in':_0x51fbec}}});})[_0x2979('0x1f')](function(_0x34b1bf){var _0x1e8483=_[_0x2979('0x37')](_0x34b1bf,function(_0x1b53b7){return _0x1b53b7[_0x2979('0x115')]();});return Promise[_0x2979('0x5b')](_0x1e8483);})[_0x2979('0x1f')](function(_0xbd36b6){_0x40133b=_[_0x2979('0x116')](_0xbd36b6);var _0x11e11a=_[_0x2979('0x37')](_0x40133b,function(_0x4593de){return _0x4593de['addAgent'](_0x23e7cc['id'],{'transaction':_0x13314c});});return Promise[_0x2979('0x5b')](_0x11e11a);})['then'](function(){if(!_0x23e7cc[_0x2979('0x9f')])return;var _0x4e4bc7=_[_0x2979('0x35')](_0x40133b,function(_0x14ba52){return _0x14ba52[_0x2979('0x117')](_0x2979('0xad'))===_0x2979('0x118');});var _0x468371=_[_0x2979('0x37')](_0x4e4bc7,function(_0x208cfc){return db['UserVoiceQueueRt'][_0x2979('0xac')]({'membername':_0x23e7cc[_0x2979('0x3e')],'UserId':_0x23e7cc['id'],'queue_name':_0x208cfc[_0x2979('0x3e')],'VoiceQueueId':_0x208cfc['id'],'interface':_[_0x2979('0x6a')](_0x23e7cc[_0x2979('0xa1')])?util['format']('SIP/%s',_0x23e7cc[_0x2979('0x3e')]):_0x23e7cc['interface'],'paused':_0x23e7cc['voicePause']||![],'penalty':_0x23e7cc['penalty']},{'transaction':_0x13314c});});return Promise[_0x2979('0x5b')](_0x468371);})[_0x2979('0x1f')](function(){return db[_0x2979('0x119')][_0x2979('0x51')]({'where':{'teamId':{'$in':_0x51fbec}}});})[_0x2979('0x1f')](function(_0x41753d){var _0x2b337b=_[_0x2979('0x37')](_0x41753d,function(_0x39cc87){return db[_0x2979('0x11a')][_0x2979('0x84')]({'UserId':_0x23e7cc['id'],'VoicePrefixId':_0x39cc87[_0x2979('0x11b')]},{'transaction':_0x13314c});});return Promise[_0x2979('0x5b')](_0x2b337b);});});})['then'](function(){for(var _0x1e48b0=0x0;_0x1e48b0<_0x40133b['length'];_0x1e48b0++){var _0x188738=_0x40133b[_0x1e48b0][_0x2979('0x117')](_0x2979('0xad'));var _0x226e08=_0x188738+_0x2979('0xa7');socket[_0x2979('0x2d')](_0x2979('0x32')+_0x188738+'Queue:save',{'UserId':_0x41c799,['queueField']:_0x40133b[_0x1e48b0]['id']});}})[_0x2979('0x1f')](respondWithStatusCode(_0x57c969,null))['catch'](APIHandleError(_0x57c969));};exports[_0x2979('0x11c')]=function(_0xb8bbf5,_0x3636ba){var _0x53f343=_0xb8bbf5[_0x2979('0x5d')]['id'];var _0x5e5041=null;if(_0xb8bbf5[_0x2979('0x4a')]['ids']){_0x5e5041=_[_0x2979('0x11d')](_0xb8bbf5[_0x2979('0x4a')][_0x2979('0x64')])?_0xb8bbf5[_0x2979('0x4a')][_0x2979('0x64')]:[_0xb8bbf5['query'][_0x2979('0x64')]];}var _0x40166a=[];return Promise[_0x2979('0x103')]()[_0x2979('0x1f')](function(){if(!_0x5e5041)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2979('0x1f')](function(){return db[_0x2979('0x49')]['findOne']({'where':{'id':_0x53f343}});})[_0x2979('0x1f')](function(_0x5a9687){if(!_0x5a9687)throw new APINotFoundError(util[_0x2979('0xc6')]('User\x20with\x20id\x20%s\x20not\x20found',_0xb8bbf5[_0x2979('0x5d')]['id']));return db[_0x2979('0x6d')][_0x2979('0x113')](function(_0x59553c){return _0x5a9687[_0x2979('0x11c')](_0x5e5041,{'transaction':_0x59553c})[_0x2979('0x1f')](function(){return db[_0x2979('0x112')][_0x2979('0x51')]({'where':{'id':{'$in':_0x5e5041}}});})[_0x2979('0x1f')](function(_0x4701c9){var _0x493316=_[_0x2979('0x37')](_0x4701c9,function(_0x39eb15){return _0x39eb15[_0x2979('0x115')]();});return Promise[_0x2979('0x5b')](_0x493316);})[_0x2979('0x1f')](function(_0x41cc10){_0x40166a=_['flattenDeep'](_0x41cc10);var _0x5b4b55=_['map'](_0x40166a,function(_0x5976e6){return _0x5976e6[_0x2979('0x11e')](_0x5a9687['id'],{'transaction':_0x59553c});});return Promise[_0x2979('0x5b')](_0x5b4b55);})[_0x2979('0x1f')](function(){if(!_0x5a9687[_0x2979('0x9f')])return;var _0x3e5bbc=_[_0x2979('0x35')](_0x40166a,function(_0x2d657b){return _0x2d657b[_0x2979('0x117')](_0x2979('0xad'))===_0x2979('0x118');});var _0x1dc261=_[_0x2979('0x37')](_0x3e5bbc,function(_0x37eb65){return db[_0x2979('0xab')][_0x2979('0x3b')]({'where':{'VoiceQueueId':_0x37eb65['id'],'UserId':_0x5a9687['id']},'transaction':_0x59553c});});return Promise[_0x2979('0x5b')](_0x1dc261);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x5e5041}}});})[_0x2979('0x1f')](function(_0x1eff99){var _0x1e67f4=_[_0x2979('0x37')](_0x1eff99,function(_0x3e0599){return db[_0x2979('0x11a')][_0x2979('0x3b')]({'where':{'UserId':_0x5a9687['id'],'VoicePrefixId':_0x3e0599[_0x2979('0x11b')]}},{'transaction':_0x59553c});});return Promise['all'](_0x1e67f4);});});})['then'](function(){for(var _0x4d4260=0x0;_0x4d4260<_0x40166a[_0x2979('0x6f')];_0x4d4260++){var _0x1cc88e=_0x40166a[_0x4d4260][_0x2979('0x117')](_0x2979('0xad'));var _0x1e0ea9=_0x1cc88e+_0x2979('0xa7');socket[_0x2979('0x2d')](_0x2979('0x32')+_0x1cc88e+'Queue:remove',{'UserId':_0x53f343,['queueField']:_0x40166a[_0x4d4260]['id']});}})['then'](respondWithStatusCode(_0x3636ba,null))[_0x2979('0x29')](APIHandleError(_0x3636ba));};exports[_0x2979('0x11f')]=function(_0x526375,_0x313028){var _0x406512={};var _0xadd814={};var _0x1d0cd8;var _0x3fc6f8;return db[_0x2979('0x49')]['findOne']({'where':{'id':_0x526375[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x313028,null))[_0x2979('0x1f')](function(_0x41cf92){if(_0x41cf92){_0x1d0cd8=_0x41cf92;_0xadd814['model']=_['keys'](db[_0x2979('0xc9')][_0x2979('0x3f')]);_0xadd814[_0x2979('0x4a')]=_['keys'](_0x526375[_0x2979('0x4a')]);_0xadd814[_0x2979('0xd3')]=_[_0x2979('0xd4')](_0xadd814[_0x2979('0xd0')],_0xadd814[_0x2979('0x4a')]);_0x406512[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0xadd814[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x526375[_0x2979('0x4a')][_0x2979('0xd5')]));_0x406512[_0x2979('0x4f')]=_0x406512['attributes']['length']?_0x406512[_0x2979('0x4f')]:_0xadd814['model'];_0x406512[_0x2979('0xd6')]=qs['sort'](_0x526375['query'][_0x2979('0xd7')]);_0x406512[_0x2979('0x48')]=qs['filters'](_[_0x2979('0xd8')](_0x526375['query'],_0xadd814[_0x2979('0xd3')]));if(_0x526375['query'][_0x2979('0x35')]){_0x406512[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x406512[_0x2979('0x48')],{'$or':_['map'](_0x406512[_0x2979('0x4f')],function(_0x3ef947){var _0x271751={};_0x271751[_0x3ef947]={'$like':'%'+_0x526375[_0x2979('0x4a')][_0x2979('0x35')]+'%'};return _0x271751;})});}_0x406512=_[_0x2979('0x5e')]({},_0x406512,_0x526375['options']);return _0x1d0cd8[_0x2979('0x11f')](_0x406512);}})[_0x2979('0x1f')](function(_0x4cdbba){if(_0x4cdbba){_0x3fc6f8=_0x4cdbba[_0x2979('0x6f')];if(!_0x526375[_0x2979('0x4a')][_0x2979('0xc8')](_0x2979('0xd9'))){_0x406512[_0x2979('0x18')]=qs[_0x2979('0x18')](_0x526375[_0x2979('0x4a')][_0x2979('0x18')]);_0x406512[_0x2979('0x17')]=qs[_0x2979('0x17')](_0x526375[_0x2979('0x4a')][_0x2979('0x17')]);}return _0x1d0cd8[_0x2979('0x11f')](_0x406512);}})[_0x2979('0x1f')](function(_0x350678){if(_0x350678){return _0x350678?{'count':_0x3fc6f8,'rows':_0x350678}:null;}})[_0x2979('0x1f')](respondWithResult(_0x313028,null))[_0x2979('0x29')](handleError(_0x313028,null));};exports[_0x2979('0x120')]=function(_0x34ac04,_0x3dc46a){var _0x5b501b={};var _0x404efc={};var _0x1f9ab6;return db[_0x2979('0x49')][_0x2979('0xdb')]({'where':{'id':_0x34ac04[_0x2979('0x5d')]['id']}})[_0x2979('0x1f')](handleEntityNotFound(_0x3dc46a,null))[_0x2979('0x1f')](function(_0x1aa70f){if(_0x1aa70f){_0x1f9ab6=_0x1aa70f;_0x404efc[_0x2979('0xd0')]=_[_0x2979('0xd1')](db[_0x2979('0x49')][_0x2979('0x3f')]);_0x404efc[_0x2979('0x4a')]=_[_0x2979('0xd1')](_0x34ac04[_0x2979('0x4a')]);_0x404efc['filters']=_['intersection'](_0x404efc['model'],_0x404efc[_0x2979('0x4a')]);_0x5b501b[_0x2979('0x4f')]=_[_0x2979('0xd4')](_0x404efc[_0x2979('0xd0')],qs[_0x2979('0xd5')](_0x34ac04['query']['fields']));_0x5b501b[_0x2979('0x4f')]=_0x5b501b['attributes'][_0x2979('0x6f')]?_0x5b501b[_0x2979('0x4f')]:_0x404efc[_0x2979('0xd0')];_0x5b501b[_0x2979('0xd6')]=qs['sort'](_0x34ac04[_0x2979('0x4a')][_0x2979('0xd7')]);_0x5b501b[_0x2979('0x48')]=qs[_0x2979('0xd3')](_[_0x2979('0xd8')](_0x34ac04[_0x2979('0x4a')],_0x404efc[_0x2979('0xd3')]));if(_0x34ac04[_0x2979('0x4a')][_0x2979('0x35')]){_0x5b501b[_0x2979('0x48')]=_[_0x2979('0x5e')](_0x5b501b['where'],{'$or':_['map'](_0x5b501b[_0x2979('0x4f')],function(_0x2aa24f){var _0x2b2ff5={};_0x2b2ff5[_0x2aa24f]={'$like':'%'+_0x34ac04[_0x2979('0x4a')]['filter']+'%'};return _0x2b2ff5;})});}_0x5b501b['model']=db['User'];_0x5b501b['as']=_0x2979('0x33');_0x5b501b=_['merge']({},_0x5b501b,_0x34ac04[_0x2979('0x5f')]);return _0x1f9ab6[_0x2979('0xf7')]({'include':[_0x5b501b]});}})[_0x2979('0x1f')](function(_0x53efe2){if(_0x53efe2){var _0x3a1c36={},_0x3a68af=[];for(var _0x404c4f=0x0;_0x404c4f<_0x53efe2[_0x2979('0x6f')];_0x404c4f+=0x1){for(var _0x4c6705=0x0,_0x203edd;_0x4c6705<_0x53efe2[_0x404c4f][_0x2979('0x33')]['length'];_0x4c6705+=0x1){_0x203edd=_0x53efe2[_0x404c4f][_0x2979('0x33')][_0x4c6705][_0x2979('0x2f')]({'plain':!![]});_0x3a1c36[_0x203edd['id']]=_0x203edd;}}_0x3a1c36=_[_0x2979('0x121')](_0x3a1c36);for(var _0x20a40f=qs['offset'](_0x34ac04[_0x2979('0x4a')][_0x2979('0x17')]);_0x20a40f<_0x3a1c36[_0x2979('0x6f')]&&_0x3a68af[_0x2979('0x6f')]=_0x11a9d5){_0xfff6da=_0x11a9d5;_0x4e8470=0xc8;}else{_0x4e8470=0xce;}_0x26dddc[_0xbd5c('0x1c')](_0x4e8470);return _0x26dddc[_0xbd5c('0x23')](_0xbd5c('0x24'),_0x475e99+'-'+_0xfff6da+'/'+_0x11a9d5)[_0xbd5c('0x1e')](_0x4ed2e5);}return null;};}function respondWithRpcPromise(_0x3d6678,_0x20ab78,_0x2dfd87,_0x27d2b9){return new Promise(function(_0x3ee4d2,_0x4aa817){var _0x466440=_0x27d2b9||amiClient;return _0x466440[_0xbd5c('0x25')](_0x3d6678,_0x2dfd87)['then'](function(_0x59479b){logger[_0xbd5c('0x26')](_0xbd5c('0x27'),_0x20ab78,'request\x20sent');logger[_0xbd5c('0x28')]('User,\x20%s,\x20%s,\x20%s',_0x20ab78,_0xbd5c('0x29'),JSON[_0xbd5c('0x2a')](_0x59479b));if(_0x59479b[_0xbd5c('0x2b')]){if(_0x59479b[_0xbd5c('0x2b')][_0xbd5c('0x2c')]===0x1f4){logger[_0xbd5c('0x2b')](_0xbd5c('0x27'),_0x20ab78,_0x59479b[_0xbd5c('0x2b')][_0xbd5c('0x2d')]);return _0x4aa817(_0x59479b[_0xbd5c('0x2b')]['message']);}logger[_0xbd5c('0x2b')](_0xbd5c('0x27'),_0x20ab78,_0x59479b[_0xbd5c('0x2b')][_0xbd5c('0x2d')]);return _0x3ee4d2(_0x59479b[_0xbd5c('0x2b')][_0xbd5c('0x2d')]);}else{logger['info'](_0xbd5c('0x27'),_0x20ab78,_0xbd5c('0x29'));_0x3ee4d2(_0x59479b['result']['message']);}})[_0xbd5c('0x2e')](function(_0x1b36b0){logger['error'](_0xbd5c('0x27'),_0x20ab78,_0x1b36b0);_0x4aa817(_0x1b36b0);});});}function saveUpdates(_0x2b7128){return function(_0x13b9ab){if(_0x13b9ab){return _0x13b9ab['update'](_0x2b7128)[_0xbd5c('0x2f')](function(_0x2b1993){if(_0x2b1993['role']==='agent'){socket[_0xbd5c('0x30')]('userNotification:recalc:'+_0x2b1993['id'],_0x2b1993);}return _0x2b1993;});}return null;};}function removeEntity(_0x3f0d2b,_0x7a2b0d){return function(_0x248cb4){if(_0x248cb4){return _0x248cb4[_0xbd5c('0x31')]({'transaction':_0x7a2b0d})[_0xbd5c('0x2f')](function(){var _0x284be3=_0x248cb4[_0xbd5c('0x32')]({'plain':!![]});if(_0x284be3[_0xbd5c('0x33')]===_0xbd5c('0x34'))return;var _0x20bffd=[{'name':_0xbd5c('0x35'),'value':_0xbd5c('0x36'),'ignore':!![]},{'name':'Agents','value':_0xbd5c('0x37'),'ignore':![]},{'name':_0xbd5c('0x38'),'value':_0xbd5c('0x39'),'ignore':![]}];var _0x1aa1b7=_(_0x20bffd)[_0xbd5c('0x3a')](_0xbd5c('0x3b'))['map']('value')['value']();if(_[_0xbd5c('0x3c')](_0x1aa1b7,_0x284be3['role'])){return;}var _0x28a432=_[_0xbd5c('0x3d')](_0x20bffd,[_0xbd5c('0x3e'),_0x284be3[_0xbd5c('0x33')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x28a432,'resourceId':_0x284be3['id']},'transaction':_0x7a2b0d})[_0xbd5c('0x2f')](function(){return _0x248cb4;});})[_0xbd5c('0x2f')](function(){_0x3f0d2b[_0xbd5c('0x1c')](0xcc)[_0xbd5c('0x1d')]();});}};}function handleEntityNotFound(_0x1354a5){return function(_0x19a82a){if(!_0x19a82a){_0x1354a5['sendStatus'](0x194);}return _0x19a82a;};}function handleError(_0x432df9,_0x471d5a){_0x471d5a=_0x471d5a||0x1f4;return function(_0x51badb){logger[_0xbd5c('0x2b')](_0x51badb[_0xbd5c('0x3f')]);if(_0x51badb['name']){delete _0x51badb[_0xbd5c('0x40')];}_0x432df9['status'](_0x471d5a)[_0xbd5c('0x41')](_0x51badb);};}function getUserAttributes(){return _(db[_0xbd5c('0x42')][_0xbd5c('0x43')])[_0xbd5c('0x44')](function(_0xe771b6){return{'name':_0xe771b6[_0xbd5c('0x45')],'type':_0xe771b6[_0xbd5c('0x46')][_0xbd5c('0x47')]};})[_0xbd5c('0x3a')](function(_0x4f2e10){return![_0xbd5c('0x48'),_0xbd5c('0x49'),_0xbd5c('0x4a'),'resetPasswordToken','resetPasswordExpires','md5secret'][_0xbd5c('0x3c')](_0x4f2e10[_0xbd5c('0x40')]);})['value']();}exports[_0xbd5c('0x4b')]=function(_0x5ad55d,_0x551343){var _0x271990={},_0x3daae4={'count':0x0,'rows':[]};var _0x225120=getUserAttributes();_0x271990=qs[_0xbd5c('0x4c')](_0x225120,_0x5ad55d);var _0x213ee5={'where':_0x271990[_0xbd5c('0x4d')]};return db[_0xbd5c('0x42')][_0xbd5c('0x22')](_0x213ee5)[_0xbd5c('0x2f')](function(_0x2c1f2e){_0x3daae4[_0xbd5c('0x22')]=_0x2c1f2e;if(_0x5ad55d[_0xbd5c('0x4e')][_0xbd5c('0x4f')]){_0x271990['include']=[{'all':!![]}];}if(_0x5ad55d[_0xbd5c('0x4e')][_0xbd5c('0x50')]==='true'){_0x271990[_0xbd5c('0x51')]=[{'model':db[_0xbd5c('0x52')],'as':'userSetting'}];}if(!_['includes'](_0x271990[_0xbd5c('0x53')],'id')){_0x271990[_0xbd5c('0x53')][_0xbd5c('0x54')]('id');}return db[_0xbd5c('0x42')][_0xbd5c('0x55')](_0x271990);})[_0xbd5c('0x2f')](function(_0x737f77){_0x3daae4[_0xbd5c('0x56')]=_0x737f77;if(_0x5ad55d[_0xbd5c('0x4e')][_0xbd5c('0x57')]===_0xbd5c('0x58')){var _0x2e6f9b=[];for(var _0xcfd6b=0x0;_0xcfd6b<_0x3daae4[_0xbd5c('0x56')]['length'];_0xcfd6b++){_0x2e6f9b['push'](get_open_tabs(_0xbd5c('0x59'),_0x3daae4[_0xbd5c('0x56')][_0xcfd6b][_0xbd5c('0x5a')]));_0x2e6f9b[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5b'),_0x3daae4['rows'][_0xcfd6b][_0xbd5c('0x5a')]));_0x2e6f9b[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5c'),_0x3daae4[_0xbd5c('0x56')][_0xcfd6b][_0xbd5c('0x5a')]));_0x2e6f9b[_0xbd5c('0x54')](get_open_tabs('mail',_0x3daae4[_0xbd5c('0x56')][_0xcfd6b][_0xbd5c('0x5a')]));_0x2e6f9b[_0xbd5c('0x54')](get_open_tabs('openchannel',_0x3daae4[_0xbd5c('0x56')][_0xcfd6b]['dataValues']));_0x2e6f9b['push'](get_open_tabs(_0xbd5c('0x5d'),_0x3daae4['rows'][_0xcfd6b][_0xbd5c('0x5a')]));}return Promise[_0xbd5c('0x5e')](_0x2e6f9b)[_0xbd5c('0x2f')](function(){return _0x3daae4;});}else{return _0x3daae4;}})['then'](respondWithFilteredResult(_0x551343,_0x271990))[_0xbd5c('0x2e')](handleError(_0x551343,null));};exports[_0xbd5c('0x5f')]=function(_0x45f6be,_0x2b2c59){var _0x55e931=getUserAttributes();_0x45f6be['query']['id']=_0x45f6be[_0xbd5c('0x60')]['id'];var _0x466544=qs[_0xbd5c('0x4c')](_0x55e931,_0x45f6be);if(_0x45f6be['query'][_0xbd5c('0x4f')]){_0x466544[_0xbd5c('0x51')]=[{'all':!![]}];}if(_0x45f6be[_0xbd5c('0x4e')]['userSetting']===_0xbd5c('0x58')){_0x466544[_0xbd5c('0x51')]=[{'model':db['UserSetting'],'as':_0xbd5c('0x50')}];}_0x466544=_[_0xbd5c('0x61')]({},_0x466544,_0x45f6be[_0xbd5c('0x62')]);if(!_[_0xbd5c('0x3c')](_0x466544[_0xbd5c('0x53')],'id')){_0x466544[_0xbd5c('0x53')][_0xbd5c('0x54')]('id');}return db[_0xbd5c('0x42')][_0xbd5c('0x3d')](_0x466544)['then'](handleEntityNotFound(_0x2b2c59,null))[_0xbd5c('0x2f')](function(_0x6233a0){var _0x392d25=[];values=_0x6233a0;if(_0x45f6be[_0xbd5c('0x4e')][_0xbd5c('0x57')]===_0xbd5c('0x58')){_0x392d25['push'](get_open_tabs(_0xbd5c('0x59'),_0x6233a0['dataValues']));_0x392d25[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5b'),_0x6233a0['dataValues']));_0x392d25[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x63'),_0x6233a0[_0xbd5c('0x5a')]));_0x392d25[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5d'),_0x6233a0[_0xbd5c('0x5a')]));_0x392d25[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5c'),_0x6233a0['dataValues']));_0x392d25['push'](get_open_tabs(_0xbd5c('0x64'),_0x6233a0[_0xbd5c('0x5a')]));return Promise[_0xbd5c('0x5e')](_0x392d25);}else{return values;}})[_0xbd5c('0x2f')](function(){return values;})[_0xbd5c('0x2f')](respondWithResult(_0x2b2c59,null))['catch'](handleError(_0x2b2c59,null));};exports[_0xbd5c('0x65')]=function(_0x235546,_0x1fa506){if(_0x235546[_0xbd5c('0x66')]['id']){delete _0x235546[_0xbd5c('0x66')]['id'];}delete _0x235546[_0xbd5c('0x66')]['role'];return db['User']['find']({'where':{'id':_0x235546[_0xbd5c('0x60')]['id']}})['then'](handleEntityNotFound(_0x1fa506,null))['then'](saveUpdates(_0x235546[_0xbd5c('0x66')],null))[_0xbd5c('0x2f')](respondWithResult(_0x1fa506,null))['catch'](handleError(_0x1fa506,null));};exports[_0xbd5c('0x67')]=function(_0x14172c,_0x18db51){return db[_0xbd5c('0x42')][_0xbd5c('0x67')]()[_0xbd5c('0x2f')](respondWithResult(_0x18db51,null))['catch'](handleError(_0x18db51,null));};exports[_0xbd5c('0x68')]=function(_0x2d5464,_0x3b549d){return db[_0xbd5c('0x42')]['find']({'where':{'id':_0x2d5464[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x3b549d,null))['then'](function(_0x4e31dd){if(_0x4e31dd){return _0x4e31dd['addContacts'](_0x2d5464['body'][_0xbd5c('0x69')],_[_0xbd5c('0x6a')](_0x2d5464[_0xbd5c('0x66')],[_0xbd5c('0x69'),'id'])||{});}})[_0xbd5c('0x2f')](respondWithResult(_0x3b549d,null))[_0xbd5c('0x2e')](handleError(_0x3b549d,null));};function validateUser(_0x205f9c){return new Promise(function(_0x3e53d8,_0x2d5f6d){if(_0x205f9c[_0xbd5c('0x6b')])return _0x3e53d8(_0x205f9c);return db[_0xbd5c('0x6c')][_0xbd5c('0x6d')](0x1)[_0xbd5c('0x2f')](function(_0x32150b){if(_0x32150b[_0xbd5c('0x6e')])authService[_0xbd5c('0x6f')](_0x205f9c['password']);db['User']['max'](_0xbd5c('0x6b'))[_0xbd5c('0x2f')](function(_0x2d7b43){if(_[_0xbd5c('0x70')](_0x2d7b43)){_0x205f9c[_0xbd5c('0x6b')]=_0x32150b[_0xbd5c('0x71')]||0x1;return;}if(_[_0xbd5c('0x70')](_0x32150b[_0xbd5c('0x71')])||_0x32150b[_0xbd5c('0x71')]===_0x2d7b43){_0x205f9c[_0xbd5c('0x6b')]=_0x2d7b43+0x1;return;}if(_0x32150b[_0xbd5c('0x71')]>_0x2d7b43){_0x205f9c[_0xbd5c('0x6b')]=_0x32150b[_0xbd5c('0x71')];return;}return db['sequelize'][_0xbd5c('0x4e')]('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[_0xbd5c('0x72')][_0xbd5c('0x73')]['SELECT']})['then'](function(_0x5ea5c7){if(_0x5ea5c7&&_0x5ea5c7['length']){for(var _0x405cf5=0x0,_0x3c2765=_0x5ea5c7[_0xbd5c('0x74')];_0x405cf5<_0x3c2765&&_['isNil'](_0x205f9c[_0xbd5c('0x6b')]);_0x405cf5++){if(_0x32150b['min_internal']<=_0x5ea5c7[_0x405cf5][_0xbd5c('0x75')]){_0x205f9c[_0xbd5c('0x6b')]=_0x5ea5c7[_0x405cf5]['from'];}else if(_0x32150b[_0xbd5c('0x71')]>_0x5ea5c7[_0x405cf5][_0xbd5c('0x75')]&&_0x32150b[_0xbd5c('0x71')]<=_0x5ea5c7[_0x405cf5]['to']){_0x205f9c[_0xbd5c('0x6b')]=_0x32150b[_0xbd5c('0x71')];}}}if(_[_0xbd5c('0x70')](_0x205f9c[_0xbd5c('0x6b')])){_0x205f9c['internal']=_0x2d7b43+0x1;}return _0x3e53d8(_0x205f9c);});});})[_0xbd5c('0x2e')](function(_0x4b1ce8){_0x2d5f6d(_0x4b1ce8);});});}function updateUser(_0x5203a4){return new Promise(function(_0x1e30ef,_0x4cbda4){try{if(_0x5203a4[_0xbd5c('0x76')]){_0x5203a4[_0xbd5c('0x77')]=_0x5203a4[_0xbd5c('0x6b')];_0x5203a4[_0xbd5c('0x78')]={'mailbox':_0x5203a4['internal'],'password':_0x5203a4[_0xbd5c('0x48')],'fullname':_0x5203a4[_0xbd5c('0x79')],'email':_0x5203a4[_0xbd5c('0x7a')]};}if(_0x5203a4['role']==='agent'){if(!_0x5203a4[_0xbd5c('0x7b')])_0x5203a4[_0xbd5c('0x7b')]=[_0xbd5c('0x7c'),_0xbd5c('0x7d'),_0xbd5c('0x7e'),'113',_0xbd5c('0x7f'),_0xbd5c('0x80'),'105',_0xbd5c('0x81'),_0xbd5c('0x82'),_0xbd5c('0x83'),_0xbd5c('0x84'),'100',_0xbd5c('0x85'),_0xbd5c('0x86'),_0xbd5c('0x87')];}_0x1e30ef(_0x5203a4);}catch(_0x282cf5){_0x4cbda4(_0x282cf5);}});}exports[_0xbd5c('0x88')]=function(_0xd27f9d,_0x3058f3){if(_0xd27f9d['user'][_0xbd5c('0x33')]===_0xbd5c('0x37'))throw new Error(_0xbd5c('0x89'));if(_0xd27f9d[_0xbd5c('0x66')]['role']===_0xbd5c('0x36')&&_0xd27f9d['user']['role']!==_0xbd5c('0x34')){throw new Error(_0xbd5c('0x8a'));}if(_0xd27f9d[_0xbd5c('0x66')][_0xbd5c('0x33')]==='admin'&&_0xd27f9d[_0xbd5c('0x36')][_0xbd5c('0x33')]!=='admin'){throw new Error(_0xbd5c('0x8b'));}return licenseUtil[_0xbd5c('0x8c')]([_0xd27f9d[_0xbd5c('0x66')]])['then'](function(){return validateUser(_0xd27f9d['body']);})[_0xbd5c('0x2f')](function(_0x477d5b){return updateUser(_0x477d5b)[_0xbd5c('0x2f')](function(_0x2afdb2){if(_0x2afdb2['role']===_0xbd5c('0x34')){_0x2afdb2[_0xbd5c('0x8d')]=_0xd27f9d[_0xbd5c('0x36')][_0xbd5c('0x8d')];delete _0x2afdb2[_0xbd5c('0x8e')];}return _0x2afdb2;});})[_0xbd5c('0x2f')](function(_0x365262){return db[_0xbd5c('0x42')][_0xbd5c('0x88')](_0x365262,{'include':[{'model':db[_0xbd5c('0x78')],'as':'VoiceMail'}]});})[_0xbd5c('0x2f')](function(_0x1fc872){if(_0xd27f9d['body']['role']==='user')return _0x1fc872;if(_0xd27f9d[_0xbd5c('0x36')][_0xbd5c('0x33')]!==_0xbd5c('0x36'))return _0x1fc872;return db[_0xbd5c('0x8f')][_0xbd5c('0x3d')]({'where':{'name':_0x1fc872[_0xbd5c('0x33')]==='agent'?_0xbd5c('0x90'):_0xbd5c('0x38'),'userProfileId':_0xd27f9d[_0xbd5c('0x36')][_0xbd5c('0x8e')]},'raw':!![]})[_0xbd5c('0x2f')](function(_0x452483){if(!_0x452483||_0x452483[_0xbd5c('0x91')]!=0x0)return _0x1fc872;return db[_0xbd5c('0x92')][_0xbd5c('0x88')]({'name':_0x1fc872[_0xbd5c('0x40')],'resourceId':_0x1fc872['id'],'type':_0x452483[_0xbd5c('0x40')],'sectionId':_0x452483['id']},{})['then'](function(){return _0x1fc872;});})[_0xbd5c('0x2e')](function(_0xfe548e){logger[_0xbd5c('0x2b')](_0xbd5c('0x93'),_0xfe548e);throw _0xfe548e;});})[_0xbd5c('0x2f')](respondWithResult(_0x3058f3,0xc9))['catch'](handleError(_0x3058f3,null));};exports[_0xbd5c('0x94')]=function(_0x20b7f6,_0x5797c9){var _0x4f417c=_0x20b7f6[_0xbd5c('0x66')];var _0x501902=[];if(_0x20b7f6[_0xbd5c('0x36')][_0xbd5c('0x33')]===_0xbd5c('0x37'))throw new Error(_0xbd5c('0x89'));if(_[_0xbd5c('0x95')](_0x4f417c,['role',_0xbd5c('0x36')])&&_0x20b7f6[_0xbd5c('0x36')][_0xbd5c('0x33')]!==_0xbd5c('0x34')){throw new Error(_0xbd5c('0x8a'));}if(_['some'](_0x4f417c,[_0xbd5c('0x33'),_0xbd5c('0x34')])&&_0x20b7f6[_0xbd5c('0x36')][_0xbd5c('0x33')]!==_0xbd5c('0x34')){throw new Error(_0xbd5c('0x96'));}return licenseUtil['checkUserLimits'](_0x4f417c)[_0xbd5c('0x2f')](function(){return validateUser(_0x4f417c[0x0]);})[_0xbd5c('0x2f')](function(){for(var _0x27c8a6=0x1;_0x27c8a6<_0x4f417c[_0xbd5c('0x74')];_0x27c8a6++){var _0x23dfdd=_0x4f417c[_0x27c8a6-0x1][_0xbd5c('0x6b')];if(!_0x4f417c[_0x27c8a6][_0xbd5c('0x6b')])_0x4f417c[_0x27c8a6][_0xbd5c('0x6b')]=_0x23dfdd+0x1;_0x501902['push'](validateUser(_0x4f417c[_0x27c8a6]));}return Promise[_0xbd5c('0x5e')](_0x501902);})[_0xbd5c('0x2f')](function(){_0x501902=[];for(var _0x402712=0x0;_0x402712<_0x4f417c[_0xbd5c('0x74')];_0x402712++){_0x501902[_0xbd5c('0x54')](updateUser(_0x4f417c[_0x402712]));}return Promise['all'](_0x501902);})[_0xbd5c('0x2f')](function(){_0x501902=_0x4f417c['map'](function(_0x30b66f){return db[_0xbd5c('0x42')][_0xbd5c('0x88')](_0x30b66f,{'include':[{'model':db[_0xbd5c('0x78')],'as':_0xbd5c('0x78')}]})[_0xbd5c('0x2f')](function(_0x6ef4fc){_0x30b66f['id']=_0x6ef4fc['id'];return _0x30b66f;});});return Promise['all'](_0x501902);})['then'](function(_0x300955){if(_0x20b7f6['body'][_0xbd5c('0x33')]==='user')return _0x300955;if(_0x20b7f6[_0xbd5c('0x36')][_0xbd5c('0x33')]!==_0xbd5c('0x36'))return _0x300955;var _0x3dfe3a=_[_0xbd5c('0x95')](_0x300955,function(_0x1854db){return _0x1854db[_0xbd5c('0x33')]===_0xbd5c('0x37')||_0x1854db[_0xbd5c('0x33')]==='telephone';});if(!_0x3dfe3a)return _0x300955;return db['UserProfileSection'][_0xbd5c('0x55')]({'where':{'name':{'$or':[_0xbd5c('0x90'),'Telephones']},'userProfileId':_0x20b7f6[_0xbd5c('0x36')][_0xbd5c('0x8e')]},'raw':!![]})[_0xbd5c('0x2f')](function(_0x3e7f7b){if(_[_0xbd5c('0x97')](_0x3e7f7b)||!_[_0xbd5c('0x95')](_0x3e7f7b,['autoAssociation',0x0]))return _0x300955;_0x501902=[];var _0xb3716=_(_0x3e7f7b)['map'](function(_0x209997){if(_0x209997['autoAssociation']===0x1)return;return _0x209997[_0xbd5c('0x40')]==='Agents'?'agent':_0xbd5c('0x39');})[_0xbd5c('0x98')]()[_0xbd5c('0x3e')]();for(var _0x16444a=0x0;_0x16444a<_0x300955[_0xbd5c('0x74')];_0x16444a++){if(!_[_0xbd5c('0x3c')](_0xb3716,_0x300955[_0x16444a][_0xbd5c('0x33')]))return;var _0x4e1498=_0x300955[_0x16444a][_0xbd5c('0x33')]==='agent'?'Agents':_0xbd5c('0x38');_0x501902[_0xbd5c('0x54')](db[_0xbd5c('0x92')]['create']({'name':_0x300955[_0x16444a][_0xbd5c('0x40')],'resourceId':_0x300955[_0x16444a]['id'],'type':_0x4e1498,'sectionId':_['find'](_0x3e7f7b,['name',_0x4e1498])['id']},{}));}return Promise[_0xbd5c('0x5e')](_0x501902);});})[_0xbd5c('0x2f')](respondWithResult(_0x5797c9,0xc9))[_0xbd5c('0x2e')](handleError(_0x5797c9,null));};exports[_0xbd5c('0x99')]=function(_0x4932eb,_0x2ad51d){if(_0x4932eb[_0xbd5c('0x66')]['id']){delete _0x4932eb[_0xbd5c('0x66')]['id'];}return db['User'][_0xbd5c('0x3d')]({'where':{'id':_0x4932eb[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](function(_0x5f4847){if(!_0x5f4847)return null;if(_0x5f4847['id']===_0x4932eb['user']['id']){if(!_0x4932eb[_0xbd5c('0x66')]['oldPassword']||!_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9a')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5f4847[_0xbd5c('0x9b')](_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9c')])){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0x9f'));}if(_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9c')]===_0x4932eb['body'][_0xbd5c('0x9a')]){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0xa0'));}}else if(_0x4932eb[_0xbd5c('0x36')][_0xbd5c('0x33')]==='admin'){if(!_0x4932eb[_0xbd5c('0x66')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0xbd5c('0xa1'));}}else if(_0x4932eb[_0xbd5c('0x36')]['role']===_0xbd5c('0x36')){if(!_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9a')]){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0xa1'));}if(_0x5f4847[_0xbd5c('0x33')]!==_0xbd5c('0x37')){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0x89'));}}else{throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0x89'));}return _0x5f4847;})[_0xbd5c('0x2f')](handleEntityNotFound(_0x2ad51d,null))['then'](function(_0x2a35cb){return db[_0xbd5c('0x6c')]['findOne']({'attributes':['id',_0xbd5c('0x6e'),_0xbd5c('0xa2'),'passwordHistoryLimit']})['then'](function(_0x4a3185){if(_0x4a3185['securePassword'])authService[_0xbd5c('0x6f')](_0x4932eb[_0xbd5c('0x66')]['newPassword']);if(!_0x4a3185[_0xbd5c('0xa2')]||!_0x2a35cb[_0xbd5c('0x4a')])return _0x2a35cb;authService[_0xbd5c('0xa3')](_0x4932eb['body']['newPassword'],_0x2a35cb[_0xbd5c('0x4a')],_0x4a3185[_0xbd5c('0xa4')]);return _0x2a35cb;})[_0xbd5c('0x2f')](saveUpdates({'password':_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9a')],'passwordResetAt':_0x4932eb[_0xbd5c('0x36')]['id']==_0x4932eb['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4932eb[_0xbd5c('0x66')][_0xbd5c('0x9a')],_0x2a35cb['previousPasswords'])},null));})[_0xbd5c('0x2f')](respondWithResult(_0x2ad51d,null))[_0xbd5c('0x2e')](handleError(_0x2ad51d,null));};exports['addQueues']=function(_0x4331af,_0x464958){var _0xb32dc1=_0x4331af[_0xbd5c('0x66')][_0xbd5c('0xa5')];return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x4331af['params']['id']},'attributes':['id',_0xbd5c('0x40'),_0xbd5c('0x33'),_0xbd5c('0xa6'),'loginInPause','voicePause',_0xbd5c('0xa7')]})[_0xbd5c('0x2f')](handleEntityNotFound(_0x464958,null))[_0xbd5c('0x2f')](function(_0x41f81f){if(_0x41f81f){if(!utils[_0xbd5c('0xa8')](_0xb32dc1)){throw new db['Sequelize'][(_0xbd5c('0x9e'))](_0xbd5c('0xa9'));}return _0x41f81f[_0xbd5c('0xaa')+_[_0xbd5c('0xab')](_0xb32dc1['toLowerCase']())+_0xbd5c('0xac')](_0x4331af[_0xbd5c('0x66')][_0xbd5c('0x69')],{'penalty':_0x4331af['body'][_0xbd5c('0xad')]||0x0})[_0xbd5c('0xae')](function(_0x5c8887){for(var _0x1af481=0x0;_0x1af481<_0x4331af[_0xbd5c('0x66')]['ids'][_0xbd5c('0x74')];_0x1af481+=0x1){var _0x2f744b={'UserId':Number(_0x4331af[_0xbd5c('0x60')]['id'])};_0x2f744b[_['capitalize'](_0xb32dc1[_0xbd5c('0xaf')]())+_0xbd5c('0xb0')]=Number(_0x4331af['body'][_0xbd5c('0x69')][_0x1af481]);socket[_0xbd5c('0x30')](_0xbd5c('0x36')+_['capitalize'](_0xb32dc1['toLowerCase']())+'Queue:save',_0x2f744b);}return _0x5c8887;})['then'](function(){if(_0xb32dc1===_0xbd5c('0xb1')){return db['VoiceQueue'][_0xbd5c('0x55')]({'where':{'id':_0x4331af[_0xbd5c('0x66')][_0xbd5c('0x69')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xbd5c('0x2f')](function(_0x2d860b){var _0x1151c8=_0x41f81f['get']({'plain':!![]});var _0x202083=[];if(_0xb32dc1==='voice'&&_0x1151c8[_0xbd5c('0x33')]===_0xbd5c('0x37')&&_0x1151c8[_0xbd5c('0xa6')]){for(let _0x2617dd=0x0;_0x2617dd<_0x2d860b['length'];_0x2617dd+=0x1){_0x202083[_0xbd5c('0x54')]({'membername':_0x1151c8[_0xbd5c('0x40')],'UserId':_0x1151c8['id'],'queue_name':_0x2d860b[_0x2617dd][_0xbd5c('0x40')],'VoiceQueueId':_0x2d860b[_0x2617dd]['id'],'interface':_[_0xbd5c('0x70')](_0x1151c8['interface'])?util[_0xbd5c('0xb2')]('SIP/%s',_0x1151c8['name']):_0x1151c8[_0xbd5c('0xa7')],'paused':_0x1151c8[_0xbd5c('0xb3')]||![],'penalty':_0x4331af[_0xbd5c('0x66')]['penalty']||0x0});}return Promise[_0xbd5c('0x5e')](_0x202083[_0xbd5c('0x44')](function(_0x45e210){return db[_0xbd5c('0xb4')][_0xbd5c('0xb5')](_0x45e210);}));}return _0x41f81f;});}})['then'](respondWithStatusCode(_0x464958,null))[_0xbd5c('0x2e')](handleError(_0x464958,null));};exports[_0xbd5c('0xb6')]=function(_0x452a79,_0x496a07){var _0x564b74,_0x3e87f1;return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x452a79[_0xbd5c('0x60')]['id']},'attributes':['id',_0xbd5c('0x40'),_0xbd5c('0x33')]})['then'](handleEntityNotFound(_0x496a07,null))[_0xbd5c('0x2f')](function(_0x555333){if(_0x555333){_0x564b74=_0x555333;if(!_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0xa5')]||!utils[_0xbd5c('0xa8')](_0x452a79['query']['channel'])){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0xa9'));}return _0x555333['remove'+_['capitalize'](_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0xa5')][_0xbd5c('0xaf')]())+_0xbd5c('0xac')](_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0x69')]);}})[_0xbd5c('0x2f')](function(_0x53a1e0){if(_[_0xbd5c('0xb7')](_0x452a79[_0xbd5c('0x4e')]['ids'])){for(var _0x5bbc3f=0x0;_0x5bbc3f<_0x452a79[_0xbd5c('0x4e')]['ids'][_0xbd5c('0x74')];_0x5bbc3f+=0x1){_0x3e87f1={'UserId':Number(_0x452a79['params']['id'])};_0x3e87f1[_[_0xbd5c('0xab')](_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0xa5')][_0xbd5c('0xaf')]())+'QueueId']=Number(_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0x69')][_0x5bbc3f]);socket[_0xbd5c('0x30')]('user'+_[_0xbd5c('0xab')](_0x452a79[_0xbd5c('0x4e')]['channel'][_0xbd5c('0xaf')]())+_0xbd5c('0xb8'),_0x3e87f1);}}else{_0x3e87f1={'UserId':Number(_0x452a79[_0xbd5c('0x60')]['id'])};_0x3e87f1[_['capitalize'](_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0xa5')][_0xbd5c('0xaf')]())+_0xbd5c('0xb0')]=Number(_0x452a79[_0xbd5c('0x4e')]['ids']);socket[_0xbd5c('0x30')](_0xbd5c('0x36')+_[_0xbd5c('0xab')](_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0xa5')][_0xbd5c('0xaf')]())+_0xbd5c('0xb8'),_0x3e87f1);}return _0x53a1e0;})[_0xbd5c('0x2f')](function(){if(_0x452a79[_0xbd5c('0x4e')]['channel']===_0xbd5c('0xb1')){return db['UserVoiceQueueRt'][_0xbd5c('0x31')]({'where':{'UserId':_0x452a79[_0xbd5c('0x60')]['id'],'VoiceQueueId':_0x452a79[_0xbd5c('0x4e')][_0xbd5c('0x69')]},'individualHooks':!![]})['then'](function(){return _0x564b74;});}return _0x564b74;})['then'](respondWithStatusCode(_0x496a07,null))['catch'](handleError(_0x496a07,null));};exports[_0xbd5c('0xb9')]=function(_0x41158c,_0x5ad9c1){_0x41158c[_0xbd5c('0x66')][_0xbd5c('0xba')]=_0x41158c[_0xbd5c('0xbb')][_0xbd5c('0xbc')];return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x41158c['params']['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x5ad9c1,null))[_0xbd5c('0x2f')](saveUpdates(_0x41158c['body'],null))[_0xbd5c('0x2f')](respondWithResult(_0x5ad9c1,null))[_0xbd5c('0x2e')](handleError(_0x5ad9c1,null));};exports[_0xbd5c('0xbd')]=function(_0x29b5b4,_0x3bca7f){var _0x523125=path[_0xbd5c('0xbe')](config[_0xbd5c('0xbf')],'server/files/images/logos/default_profile.png');return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x29b5b4[_0xbd5c('0x60')]['id']},'attributes':['id',_0xbd5c('0xba')],'raw':!![]})[_0xbd5c('0x2f')](handleEntityNotFound(_0x3bca7f,null))[_0xbd5c('0x2f')](function(_0x5432ed){if(_0x5432ed){if(_[_0xbd5c('0x70')](_0x5432ed[_0xbd5c('0xba')])){return _0x3bca7f[_0xbd5c('0xc0')](_0x523125);}else{if(!fs['existsSync'](path['join'](config['root'],_0xbd5c('0xc1'),_0x5432ed['userpic']))){return _0x3bca7f[_0xbd5c('0xc0')](_0x523125);}return _0x3bca7f[_0xbd5c('0xc0')](path['join'](config[_0xbd5c('0xbf')],'server/files/images/',_0x5432ed[_0xbd5c('0xba')]));}}})[_0xbd5c('0x2e')](handleError(_0x3bca7f,null));};exports['getOpenTabs']=function(_0x1f8cf4,_0x178230){return db['User'][_0xbd5c('0x3d')]({'where':{'id':_0x1f8cf4[_0xbd5c('0x60')]['id']},'attributes':['id']})[_0xbd5c('0x2f')](handleEntityNotFound(_0x178230,null))['then'](function(_0x13ee49){var _0x1ba019=[];values=_0x13ee49[_0xbd5c('0x5a')];_0x1ba019[_0xbd5c('0x54')](get_open_tabs('chat',_0x13ee49['dataValues']));_0x1ba019[_0xbd5c('0x54')](get_open_tabs('sms',_0x13ee49[_0xbd5c('0x5a')]));_0x1ba019['push'](get_open_tabs(_0xbd5c('0x63'),_0x13ee49['dataValues']));_0x1ba019[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x5d'),_0x13ee49[_0xbd5c('0x5a')]));_0x1ba019['push'](get_open_tabs(_0xbd5c('0x5c'),_0x13ee49[_0xbd5c('0x5a')]));_0x1ba019[_0xbd5c('0x54')](get_open_tabs(_0xbd5c('0x64'),_0x13ee49[_0xbd5c('0x5a')]));return Promise['all'](_0x1ba019);})[_0xbd5c('0x2f')](function(_0x5b17d4){if(_0x5b17d4){var _0x2abbe8=_[_0xbd5c('0x44')](values['ChatOpenTabs'],function(_0x4275bb){return{'channel':_0xbd5c('0xc2'),'id':_0x4275bb['id'],'createdAt':_0x4275bb[_0xbd5c('0xc3')]};});var _0x1159d4=_[_0xbd5c('0x44')](values[_0xbd5c('0xc4')],function(_0x22e1f3){return{'channel':_0xbd5c('0xc5'),'id':_0x22e1f3['id'],'createdAt':_0x22e1f3['createdAt']};});var _0x15f24a=_[_0xbd5c('0x44')](values[_0xbd5c('0xc6')],function(_0x673f8c){return{'channel':'OPENCHANNEL','id':_0x673f8c['id'],'createdAt':_0x673f8c[_0xbd5c('0xc3')]};});var _0x1f172f=_[_0xbd5c('0x44')](values['MailOpenTabs'],function(_0x1889f8){return{'channel':_0xbd5c('0xc7'),'id':_0x1889f8['id'],'createdAt':_0x1889f8[_0xbd5c('0xc3')]};});var _0x831871=_[_0xbd5c('0x44')](values[_0xbd5c('0xc8')],function(_0x106089){return{'channel':_0xbd5c('0xc9'),'id':_0x106089['id'],'createdAt':_0x106089['createdAt']};});var _0x1e5a10=_['map'](values['WhatsappOpenTabs'],function(_0x1846f1){return{'channel':'WHATSAPP','id':_0x1846f1['id'],'createdAt':_0x1846f1[_0xbd5c('0xc3')]};});var _0x3ffccf=_['concat'](_0x2abbe8,_0x1159d4,_0x15f24a,_0x1f172f,_0x831871,_0x1e5a10);var _0x33fb2f={'count':_0x3ffccf[_0xbd5c('0x74')],'rows':_0x3ffccf};return _0x33fb2f;}else return null;})[_0xbd5c('0x2f')](respondWithResult(_0x178230,null))[_0xbd5c('0x2e')](handleError(_0x178230,null));};exports['getContacts']=function(_0x18512a,_0x1132e0){var _0x4b6ee9={};return db['User'][_0xbd5c('0xca')]({'where':{'id':_0x18512a[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](function(_0x402870){if(!_0x402870){throw new APINotFoundError(util[_0xbd5c('0xb2')](_0xbd5c('0xcb'),_0x18512a['params']['id']));}return contacts[_0xbd5c('0x67')]();})['then'](function(_0x4161f9){_0x18512a['query'][_0xbd5c('0x42')]=_0x18512a['params']['id'];_0x4b6ee9=qs[_0xbd5c('0x4c')](_0x4161f9,_0x18512a);if(_0x18512a['query'][_0xbd5c('0xcc')]('includeAll')){_0x4b6ee9[_0xbd5c('0x51')]=[{'model':db[_0xbd5c('0xcd')],'as':_0xbd5c('0xce'),'required':![]},{'model':db[_0xbd5c('0xcf')],'as':'Tags','attributes':['id',_0xbd5c('0x40'),'color'],'where':_0x18512a[_0xbd5c('0x4e')][_0xbd5c('0xd0')]?{'id':_0x18512a[_0xbd5c('0x4e')][_0xbd5c('0xd0')]}:undefined,'required':_0x18512a[_0xbd5c('0x4e')][_0xbd5c('0xd0')]?!![]:![]}];}return contacts[_0xbd5c('0x55')](_0x18512a[_0xbd5c('0x4e')],_0x18512a['user'],_0x4b6ee9,_0x4161f9);})[_0xbd5c('0x2f')](respondWithFilteredResult(_0x1132e0,_0x4b6ee9))[_0xbd5c('0x2e')](APIHandleError(_0x1132e0));};exports['getQueues']=function(_0x5e6a6b,_0x4ff072){var _0x5eb23a;var _0x1da584={};var _0x1e2d59;return db[_0xbd5c('0x42')]['findOne']({'where':{'id':_0x5e6a6b[_0xbd5c('0x60')]['id']},'attributes':['id',_0xbd5c('0x40'),'role']})['then'](handleEntityNotFound(_0x4ff072,null))[_0xbd5c('0x2f')](function(_0x11c43c){if(!utils['isValidChannel'](_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0xa5')])){throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0xa9'));}_0x5eb23a=_0x11c43c;var _0x166d90={};_0x166d90[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_[_0xbd5c('0xab')](_0x5e6a6b['query'][_0xbd5c('0xa5')])+_0xbd5c('0xd3')][_0xbd5c('0x43')]);_0x166d90[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x5e6a6b[_0xbd5c('0x4e')]);_0x166d90[_0xbd5c('0xd4')]=_[_0xbd5c('0xd5')](_0x166d90[_0xbd5c('0xd1')],_0x166d90[_0xbd5c('0x4e')]);_0x1da584[_0xbd5c('0x53')]=_['intersection'](_0x166d90[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x5e6a6b['query']['fields']));_0x1da584[_0xbd5c('0x53')]=_0x1da584[_0xbd5c('0x53')]['length']?_0x1da584[_0xbd5c('0x53')]:_0x166d90['model'];_0x1da584[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x1da584[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_['pick'](_0x5e6a6b[_0xbd5c('0x4e')],_0x166d90[_0xbd5c('0xd4')]));if(_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x1da584[_0xbd5c('0x4d')]=_['merge'](_0x1da584[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x1da584['attributes'],function(_0x39ac7d){var _0x33b5e4={};_0x33b5e4[_0x39ac7d]={'$like':'%'+_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x33b5e4;})});}_0x1da584=_[_0xbd5c('0x61')]({},_0x1da584,_0x5e6a6b[_0xbd5c('0x62')]);switch(_0x5eb23a[_0xbd5c('0x33')]){case _0xbd5c('0x34'):return db[_[_0xbd5c('0xab')](_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0xa5')])+_0xbd5c('0xd3')]['findAll'](_0x1da584);case _0xbd5c('0x36'):case _0xbd5c('0x37'):return _0x5eb23a[_0xbd5c('0x32')+_[_0xbd5c('0xab')](_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0xa5')])+_0xbd5c('0xac')](_0x1da584);default:throw new db['Sequelize'][(_0xbd5c('0x9e'))](_0xbd5c('0xd9'));}})[_0xbd5c('0x2f')](function(_0x1b6037){_0x1e2d59=_0x1b6037['length'];if(!_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x1da584['limit']=qs[_0xbd5c('0x20')](_0x5e6a6b['query'][_0xbd5c('0x20')]);_0x1da584['offset']=qs[_0xbd5c('0x1f')](_0x5e6a6b[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}switch(_0x5eb23a[_0xbd5c('0x33')]){case _0xbd5c('0x34'):return db[_[_0xbd5c('0xab')](_0x5e6a6b[_0xbd5c('0x4e')]['channel'])+_0xbd5c('0xd3')][_0xbd5c('0x55')](_0x1da584);case _0xbd5c('0x36'):case _0xbd5c('0x37'):return _0x5eb23a[_0xbd5c('0x32')+_[_0xbd5c('0xab')](_0x5e6a6b['query'][_0xbd5c('0xa5')])+_0xbd5c('0xac')](_0x1da584);}})[_0xbd5c('0x2f')](function(_0x46baae){return{'count':_0x1e2d59,'rows':_0x46baae};})[_0xbd5c('0x2f')](respondWithResult(_0x4ff072,null))[_0xbd5c('0x2e')](handleError(_0x4ff072,null));};exports[_0xbd5c('0xdb')]=function(_0x15303b,_0x2ffa94){var _0x15f4a2={};var _0x45f473={};var _0x17c766;var _0x4c83ab;return db['User'][_0xbd5c('0xca')]({'where':{'id':_0x15303b[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x2ffa94,null))['then'](function(_0x241107){if(_0x241107){_0x17c766=_0x241107;_0x45f473[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_0xbd5c('0xb4')][_0xbd5c('0x43')]);_0x45f473[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x15303b['query']);_0x45f473[_0xbd5c('0xd4')]=_['intersection'](_0x45f473[_0xbd5c('0xd1')],_0x45f473['query']);_0x15f4a2[_0xbd5c('0x53')]=_['intersection'](_0x45f473[_0xbd5c('0xd1')],qs['fields'](_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x15f4a2[_0xbd5c('0x53')]=_0x15f4a2[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x15f4a2[_0xbd5c('0x53')]:_0x45f473[_0xbd5c('0xd1')];_0x15f4a2['order']=qs[_0xbd5c('0xd8')](_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x15f4a2[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_[_0xbd5c('0xdc')](_0x15303b[_0xbd5c('0x4e')],_0x45f473[_0xbd5c('0xd4')]));if(_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x15f4a2[_0xbd5c('0x4d')]=_['merge'](_0x15f4a2[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x15f4a2[_0xbd5c('0x53')],function(_0x2cd5e6){var _0x55eef5={};_0x55eef5[_0x2cd5e6]={'$like':'%'+_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x55eef5;})});}_0x15f4a2=_['merge']({},_0x15f4a2,_0x15303b[_0xbd5c('0x62')]);return _0x17c766[_0xbd5c('0xdb')](_0x15f4a2);}})[_0xbd5c('0x2f')](function(_0x19e74f){if(_0x19e74f){_0x4c83ab=_0x19e74f[_0xbd5c('0x74')];if(!_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x15f4a2[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x15303b['query']['limit']);_0x15f4a2['offset']=qs[_0xbd5c('0x1f')](_0x15303b[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x17c766['getVoiceQueuesRt'](_0x15f4a2);}})['then'](function(_0x3bfc1a){if(_0x3bfc1a){return _0x3bfc1a?{'count':_0x4c83ab,'rows':_0x3bfc1a}:null;}})['then'](respondWithResult(_0x2ffa94,null))[_0xbd5c('0x2e')](handleError(_0x2ffa94,null));};exports[_0xbd5c('0xdd')]=function(_0x3ba5d6,_0x591382){var _0x46f7b8={};var _0x4d3427={};var _0x1624e8;var _0x51a329;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x3ba5d6[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x591382,null))[_0xbd5c('0x2f')](function(_0x523564){if(_0x523564){_0x1624e8=_0x523564;_0x4d3427[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_0xbd5c('0xde')][_0xbd5c('0x43')]);_0x4d3427[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x3ba5d6[_0xbd5c('0x4e')]);_0x4d3427[_0xbd5c('0xd4')]=_[_0xbd5c('0xd5')](_0x4d3427[_0xbd5c('0xd1')],_0x4d3427[_0xbd5c('0x4e')]);_0x46f7b8[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x4d3427['model'],qs['fields'](_0x3ba5d6['query'][_0xbd5c('0xd6')]));_0x46f7b8['attributes']=_0x46f7b8[_0xbd5c('0x53')]['length']?_0x46f7b8[_0xbd5c('0x53')]:_0x4d3427[_0xbd5c('0xd1')];_0x46f7b8['order']=qs[_0xbd5c('0xd8')](_0x3ba5d6[_0xbd5c('0x4e')]['sort']);_0x46f7b8['where']=qs['filters'](_['pick'](_0x3ba5d6[_0xbd5c('0x4e')],_0x4d3427[_0xbd5c('0xd4')]));if(_0x3ba5d6[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x46f7b8[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x46f7b8[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x46f7b8['attributes'],function(_0x440a8c){var _0x456a04={};_0x456a04[_0x440a8c]={'$like':'%'+_0x3ba5d6[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x456a04;})});}_0x46f7b8=_['merge']({},_0x46f7b8,_0x3ba5d6[_0xbd5c('0x62')]);return _0x1624e8[_0xbd5c('0xdd')](_0x46f7b8);}})[_0xbd5c('0x2f')](function(_0x1ebeec){if(_0x1ebeec){_0x51a329=_0x1ebeec[_0xbd5c('0x74')];if(!_0x3ba5d6[_0xbd5c('0x4e')][_0xbd5c('0xcc')]('nolimit')){_0x46f7b8[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x3ba5d6[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x46f7b8[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x3ba5d6[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x1624e8[_0xbd5c('0xdd')](_0x46f7b8);}})[_0xbd5c('0x2f')](function(_0x53d1d2){if(_0x53d1d2){return _0x53d1d2?{'count':_0x51a329,'rows':_0x53d1d2}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0x591382,null))[_0xbd5c('0x2e')](handleError(_0x591382,null));};exports[_0xbd5c('0xdf')]=function(_0x58b986,_0x439e6b){var _0x5584af={'raw':!![],'where':{}};var _0x2add11={};var _0x11660a={'count':0x0,'rows':[]};return db['User'][_0xbd5c('0xca')]({'where':{'id':_0x58b986[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x439e6b,null))[_0xbd5c('0x2f')](function(_0x3cd0a7){if(_0x3cd0a7){_0x2add11['model']=_[_0xbd5c('0xd2')](db[_0xbd5c('0xe0')][_0xbd5c('0x43')]);_0x2add11[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x58b986['query']);_0x2add11[_0xbd5c('0xd4')]=_['intersection'](_0x2add11[_0xbd5c('0xd1')],_0x2add11['query']);_0x5584af[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x2add11[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x58b986[_0xbd5c('0x4e')]['fields']));_0x5584af[_0xbd5c('0x53')]=_0x5584af[_0xbd5c('0x53')]['length']?_0x5584af[_0xbd5c('0x53')]:_0x2add11[_0xbd5c('0xd1')];if(!_0x58b986[_0xbd5c('0x4e')]['hasOwnProperty'](_0xbd5c('0xda'))){_0x5584af[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x58b986[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x5584af[_0xbd5c('0x1f')]=qs['offset'](_0x58b986[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}_0x5584af['order']=qs[_0xbd5c('0xd8')](_0x58b986[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x5584af[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_['pick'](_0x58b986[_0xbd5c('0x4e')],_0x2add11[_0xbd5c('0xd4')]));_0x5584af[_0xbd5c('0x4d')][_0xbd5c('0xe1')]=_0x3cd0a7['id'];if(_0x58b986[_0xbd5c('0x4e')]['filter']){_0x5584af[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x5584af[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x5584af[_0xbd5c('0x53')],function(_0x1017ce){var _0x280efc={};_0x280efc[_0x1017ce]={'$like':'%'+_0x58b986[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x280efc;})});}_0x5584af=_['merge']({},_0x5584af,_0x58b986[_0xbd5c('0x62')]);return db['VoiceRecording'][_0xbd5c('0x22')]({'where':_0x5584af[_0xbd5c('0x4d')]})[_0xbd5c('0x2f')](function(_0x53680b){_0x11660a[_0xbd5c('0x22')]=_0x53680b;if(_0x58b986[_0xbd5c('0x4e')][_0xbd5c('0x4f')]){_0x5584af[_0xbd5c('0x51')]=[{'all':!![]}];}return db[_0xbd5c('0xe0')]['findAll'](_0x5584af);})[_0xbd5c('0x2f')](function(_0x37a289){_0x11660a[_0xbd5c('0x56')]=_0x37a289;return _0x11660a;});}})['then'](respondWithFilteredResult(_0x439e6b,_0x5584af))[_0xbd5c('0x2e')](handleError(_0x439e6b,null));};exports['getScreenRecordings']=function(_0x357c0d,_0x30dd5d){var _0x2ee5a2={'raw':!![],'where':{}};var _0x4dcc9d={};var _0x33e39e={'count':0x0,'rows':[]};return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x357c0d[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x30dd5d,null))[_0xbd5c('0x2f')](function(_0x575a33){if(_0x575a33){_0x4dcc9d[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db['ScreenRecording'][_0xbd5c('0x43')]);_0x4dcc9d[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x357c0d['query']);_0x4dcc9d[_0xbd5c('0xd4')]=_[_0xbd5c('0xd5')](_0x4dcc9d[_0xbd5c('0xd1')],_0x4dcc9d[_0xbd5c('0x4e')]);_0x2ee5a2['attributes']=_[_0xbd5c('0xd5')](_0x4dcc9d['model'],qs['fields'](_0x357c0d['query']['fields']));_0x2ee5a2[_0xbd5c('0x53')]=_0x2ee5a2['attributes'][_0xbd5c('0x74')]?_0x2ee5a2[_0xbd5c('0x53')]:_0x4dcc9d[_0xbd5c('0xd1')];if(!_0x357c0d[_0xbd5c('0x4e')]['hasOwnProperty']('nolimit')){_0x2ee5a2[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x357c0d[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x2ee5a2[_0xbd5c('0x1f')]=qs['offset'](_0x357c0d['query']['offset']);}_0x2ee5a2['order']=qs[_0xbd5c('0xd8')](_0x357c0d['query'][_0xbd5c('0xd8')]);_0x2ee5a2['where']=qs[_0xbd5c('0xd4')](_[_0xbd5c('0xdc')](_0x357c0d[_0xbd5c('0x4e')],_0x4dcc9d[_0xbd5c('0xd4')]));_0x2ee5a2[_0xbd5c('0x4d')]['UserId']=_0x575a33['id'];if(_0x357c0d[_0xbd5c('0x4e')]['filter']){_0x2ee5a2[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x2ee5a2[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x2ee5a2[_0xbd5c('0x53')],function(_0x523225){var _0x36d61e={};_0x36d61e[_0x523225]={'$like':'%'+_0x357c0d[_0xbd5c('0x4e')]['filter']+'%'};return _0x36d61e;})});}_0x2ee5a2=_[_0xbd5c('0x61')]({},_0x2ee5a2,_0x357c0d[_0xbd5c('0x62')]);return db['ScreenRecording'][_0xbd5c('0x22')]({'where':_0x2ee5a2['where']})['then'](function(_0x45a962){_0x33e39e[_0xbd5c('0x22')]=_0x45a962;if(_0x357c0d['query']['includeAll']){_0x2ee5a2[_0xbd5c('0x51')]=[{'all':!![]}];}return db[_0xbd5c('0xe2')]['findAll'](_0x2ee5a2);})[_0xbd5c('0x2f')](function(_0x4bf2d6){_0x33e39e[_0xbd5c('0x56')]=_0x4bf2d6;return _0x33e39e;});}})[_0xbd5c('0x2f')](respondWithFilteredResult(_0x30dd5d,_0x2ee5a2))['catch'](handleError(_0x30dd5d,null));};exports[_0xbd5c('0xe3')]=function(_0x39099c,_0x4c3911){var _0x1aeda0={};var _0xe47514={};var _0x1aaf8e;var _0x112e49;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x39099c[_0xbd5c('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c3911,null))['then'](function(_0x255ead){if(_0x255ead){_0x1aaf8e=_0x255ead;_0xe47514[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_0xbd5c('0xe4')][_0xbd5c('0x43')]);_0xe47514[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x39099c['query']);_0xe47514['filters']=_['intersection'](_0xe47514[_0xbd5c('0xd1')],_0xe47514[_0xbd5c('0x4e')]);_0x1aeda0[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0xe47514[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x39099c[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x1aeda0['attributes']=_0x1aeda0['attributes'][_0xbd5c('0x74')]?_0x1aeda0[_0xbd5c('0x53')]:_0xe47514[_0xbd5c('0xd1')];_0x1aeda0[_0xbd5c('0xd7')]=qs['sort'](_0x39099c[_0xbd5c('0x4e')]['sort']);_0x1aeda0[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_['pick'](_0x39099c[_0xbd5c('0x4e')],_0xe47514['filters']));if(_0x39099c[_0xbd5c('0x4e')]['filter']){_0x1aeda0[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x1aeda0[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x1aeda0[_0xbd5c('0x53')],function(_0x813bee){var _0x5a160a={};_0x5a160a[_0x813bee]={'$like':'%'+_0x39099c[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x5a160a;})});}_0x1aeda0=_['merge']({},_0x1aeda0,_0x39099c[_0xbd5c('0x62')]);return _0x1aaf8e[_0xbd5c('0xe3')](_0x1aeda0);}})[_0xbd5c('0x2f')](function(_0x8cdda){if(_0x8cdda){_0x112e49=_0x8cdda['length'];if(!_0x39099c[_0xbd5c('0x4e')][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x1aeda0[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x39099c[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x1aeda0[_0xbd5c('0x1f')]=qs['offset'](_0x39099c[_0xbd5c('0x4e')]['offset']);}return _0x1aaf8e['getChatInteractions'](_0x1aeda0);}})['then'](function(_0xf13214){if(_0xf13214){return _0xf13214?{'count':_0x112e49,'rows':_0xf13214}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0x4c3911,null))['catch'](handleError(_0x4c3911,null));};exports[_0xbd5c('0xe5')]=function(_0x4120a5,_0xa81461){var _0x390717={};var _0x37208a={};var _0xc2ccd8;var _0x1a422c;return db['User'][_0xbd5c('0xca')]({'where':{'id':_0x4120a5[_0xbd5c('0x60')]['id']}})['then'](handleEntityNotFound(_0xa81461,null))[_0xbd5c('0x2f')](function(_0x30889f){if(_0x30889f){_0xc2ccd8=_0x30889f;_0x37208a[_0xbd5c('0xd1')]=_['keys'](db[_0xbd5c('0xe6')][_0xbd5c('0x43')]);_0x37208a[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x4120a5['query']);_0x37208a[_0xbd5c('0xd4')]=_[_0xbd5c('0xd5')](_0x37208a[_0xbd5c('0xd1')],_0x37208a[_0xbd5c('0x4e')]);_0x390717[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x37208a[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x4120a5[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x390717[_0xbd5c('0x53')]=_0x390717[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x390717[_0xbd5c('0x53')]:_0x37208a[_0xbd5c('0xd1')];_0x390717['order']=qs[_0xbd5c('0xd8')](_0x4120a5['query']['sort']);_0x390717[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_['pick'](_0x4120a5['query'],_0x37208a[_0xbd5c('0xd4')]));if(_0x4120a5[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x390717[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x390717[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x390717[_0xbd5c('0x53')],function(_0xfd36b1){var _0x1d76f3={};_0x1d76f3[_0xfd36b1]={'$like':'%'+_0x4120a5[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x1d76f3;})});}_0x390717=_[_0xbd5c('0x61')]({},_0x390717,_0x4120a5[_0xbd5c('0x62')]);return _0xc2ccd8[_0xbd5c('0xe5')](_0x390717);}})[_0xbd5c('0x2f')](function(_0x54b69f){if(_0x54b69f){_0x1a422c=_0x54b69f[_0xbd5c('0x74')];if(!_0x4120a5[_0xbd5c('0x4e')][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x390717[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x4120a5[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x390717[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x4120a5['query'][_0xbd5c('0x1f')]);}return _0xc2ccd8[_0xbd5c('0xe5')](_0x390717);}})[_0xbd5c('0x2f')](function(_0x3b8cb6){if(_0x3b8cb6){return _0x3b8cb6?{'count':_0x1a422c,'rows':_0x3b8cb6}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0xa81461,null))[_0xbd5c('0x2e')](handleError(_0xa81461,null));};exports[_0xbd5c('0xe7')]=function(_0x3012a5,_0x4de99d){var _0x2bf489={'raw':!![],'where':{}};var _0x48549b={};var _0x2aead8={'count':0x0,'rows':[]};return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x3012a5['params']['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x4de99d,null))['then'](function(_0x524c93){if(_0x524c93){_0x48549b['model']=_[_0xbd5c('0xd2')](db['MailInteraction']['rawAttributes']);_0x48549b[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x3012a5[_0xbd5c('0x4e')]);_0x48549b['filters']=_[_0xbd5c('0xd5')](_0x48549b[_0xbd5c('0xd1')],_0x48549b[_0xbd5c('0x4e')]);_0x2bf489['attributes']=_[_0xbd5c('0xd5')](_0x48549b[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x3012a5[_0xbd5c('0x4e')]['fields']));_0x2bf489[_0xbd5c('0x53')]=_0x2bf489[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x2bf489[_0xbd5c('0x53')]:_0x48549b['model'];if(!_0x3012a5[_0xbd5c('0x4e')][_0xbd5c('0xcc')]('nolimit')){_0x2bf489['limit']=qs[_0xbd5c('0x20')](_0x3012a5[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x2bf489[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x3012a5[_0xbd5c('0x4e')]['offset']);}_0x2bf489[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x3012a5[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x2bf489['where']=qs['filters'](_['pick'](_0x3012a5[_0xbd5c('0x4e')],_0x48549b[_0xbd5c('0xd4')]));_0x2bf489[_0xbd5c('0x4d')][_0xbd5c('0xe1')]=_0x524c93['id'];if(_0x3012a5[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x2bf489[_0xbd5c('0x4d')]=_['merge'](_0x2bf489[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x2bf489[_0xbd5c('0x53')],function(_0x514b94){var _0x3a9951={};_0x3a9951[_0x514b94]={'$like':'%'+_0x3012a5[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x3a9951;})});}_0x2bf489=_['merge']({},_0x2bf489,_0x3012a5['options']);return db[_0xbd5c('0xe8')][_0xbd5c('0x22')]({'where':_0x2bf489[_0xbd5c('0x4d')]})[_0xbd5c('0x2f')](function(_0x58a75a){_0x2aead8[_0xbd5c('0x22')]=_0x58a75a;if(_0x3012a5['query'][_0xbd5c('0x4f')]){_0x2bf489[_0xbd5c('0x51')]=[{'all':!![]}];}return db['MailInteraction'][_0xbd5c('0x55')](_0x2bf489);})['then'](function(_0x17238f){_0x2aead8[_0xbd5c('0x56')]=_0x17238f;return _0x2aead8;});}})[_0xbd5c('0x2f')](respondWithFilteredResult(_0x4de99d,_0x2bf489))['catch'](handleError(_0x4de99d,null));};exports['getSmsInteractions']=function(_0x3c160d,_0x29da33){var _0x4ef6b2={};var _0x53bdd7={};var _0x19c22e;var _0x3e7df1;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x3c160d[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x29da33,null))[_0xbd5c('0x2f')](function(_0x4e8056){if(_0x4e8056){_0x19c22e=_0x4e8056;_0x53bdd7['model']=_[_0xbd5c('0xd2')](db[_0xbd5c('0xe9')][_0xbd5c('0x43')]);_0x53bdd7[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x3c160d[_0xbd5c('0x4e')]);_0x53bdd7[_0xbd5c('0xd4')]=_[_0xbd5c('0xd5')](_0x53bdd7[_0xbd5c('0xd1')],_0x53bdd7[_0xbd5c('0x4e')]);_0x4ef6b2[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x53bdd7[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x3c160d[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x4ef6b2[_0xbd5c('0x53')]=_0x4ef6b2[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x4ef6b2[_0xbd5c('0x53')]:_0x53bdd7['model'];_0x4ef6b2[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x3c160d[_0xbd5c('0x4e')]['sort']);_0x4ef6b2[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_['pick'](_0x3c160d[_0xbd5c('0x4e')],_0x53bdd7['filters']));if(_0x3c160d[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x4ef6b2[_0xbd5c('0x4d')]=_['merge'](_0x4ef6b2[_0xbd5c('0x4d')],{'$or':_['map'](_0x4ef6b2[_0xbd5c('0x53')],function(_0x1a194c){var _0x57a3f9={};_0x57a3f9[_0x1a194c]={'$like':'%'+_0x3c160d['query'][_0xbd5c('0x3a')]+'%'};return _0x57a3f9;})});}_0x4ef6b2=_[_0xbd5c('0x61')]({},_0x4ef6b2,_0x3c160d['options']);return _0x19c22e['getSmsInteractions'](_0x4ef6b2);}})[_0xbd5c('0x2f')](function(_0x559cfe){if(_0x559cfe){_0x3e7df1=_0x559cfe[_0xbd5c('0x74')];if(!_0x3c160d['query'][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x4ef6b2[_0xbd5c('0x20')]=qs['limit'](_0x3c160d['query'][_0xbd5c('0x20')]);_0x4ef6b2['offset']=qs[_0xbd5c('0x1f')](_0x3c160d[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x19c22e[_0xbd5c('0xea')](_0x4ef6b2);}})[_0xbd5c('0x2f')](function(_0xaa0743){if(_0xaa0743){return _0xaa0743?{'count':_0x3e7df1,'rows':_0xaa0743}:null;}})['then'](respondWithResult(_0x29da33,null))[_0xbd5c('0x2e')](handleError(_0x29da33,null));};exports['getFaxInteractions']=function(_0x1b119f,_0x2cb615){var _0x3620d7={};var _0x1dcf45={};var _0x22e2b1;var _0x2d542f;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x1b119f[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x2cb615,null))[_0xbd5c('0x2f')](function(_0x105cee){if(_0x105cee){_0x22e2b1=_0x105cee;_0x1dcf45[_0xbd5c('0xd1')]=_['keys'](db['FaxInteraction'][_0xbd5c('0x43')]);_0x1dcf45[_0xbd5c('0x4e')]=_['keys'](_0x1b119f[_0xbd5c('0x4e')]);_0x1dcf45['filters']=_['intersection'](_0x1dcf45[_0xbd5c('0xd1')],_0x1dcf45[_0xbd5c('0x4e')]);_0x3620d7[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x1dcf45['model'],qs['fields'](_0x1b119f['query'][_0xbd5c('0xd6')]));_0x3620d7['attributes']=_0x3620d7[_0xbd5c('0x53')]['length']?_0x3620d7[_0xbd5c('0x53')]:_0x1dcf45[_0xbd5c('0xd1')];_0x3620d7[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x1b119f['query'][_0xbd5c('0xd8')]);_0x3620d7[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_[_0xbd5c('0xdc')](_0x1b119f[_0xbd5c('0x4e')],_0x1dcf45[_0xbd5c('0xd4')]));if(_0x1b119f[_0xbd5c('0x4e')]['filter']){_0x3620d7[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x3620d7[_0xbd5c('0x4d')],{'$or':_['map'](_0x3620d7['attributes'],function(_0x5413be){var _0xb26476={};_0xb26476[_0x5413be]={'$like':'%'+_0x1b119f[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0xb26476;})});}_0x3620d7=_[_0xbd5c('0x61')]({},_0x3620d7,_0x1b119f['options']);return _0x22e2b1['getFaxInteractions'](_0x3620d7);}})[_0xbd5c('0x2f')](function(_0x35094d){if(_0x35094d){_0x2d542f=_0x35094d['length'];if(!_0x1b119f['query'][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x3620d7['limit']=qs[_0xbd5c('0x20')](_0x1b119f[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x3620d7[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x1b119f[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x22e2b1[_0xbd5c('0xeb')](_0x3620d7);}})[_0xbd5c('0x2f')](function(_0x399b94){if(_0x399b94){return _0x399b94?{'count':_0x2d542f,'rows':_0x399b94}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0x2cb615,null))['catch'](handleError(_0x2cb615,null));};exports[_0xbd5c('0xec')]=function(_0x4b8b01,_0x24959d){var _0x1d1fb5={};var _0x2a9f8f={};var _0x16a20b;var _0x1c3a68;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x4b8b01[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x24959d,null))['then'](function(_0x1846c3){if(_0x1846c3){_0x16a20b=_0x1846c3;_0x2a9f8f[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_0xbd5c('0xed')][_0xbd5c('0x43')]);_0x2a9f8f['query']=_[_0xbd5c('0xd2')](_0x4b8b01['query']);_0x2a9f8f['filters']=_[_0xbd5c('0xd5')](_0x2a9f8f[_0xbd5c('0xd1')],_0x2a9f8f['query']);_0x1d1fb5['attributes']=_[_0xbd5c('0xd5')](_0x2a9f8f['model'],qs[_0xbd5c('0xd6')](_0x4b8b01['query'][_0xbd5c('0xd6')]));_0x1d1fb5[_0xbd5c('0x53')]=_0x1d1fb5[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x1d1fb5[_0xbd5c('0x53')]:_0x2a9f8f[_0xbd5c('0xd1')];_0x1d1fb5[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x4b8b01[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x1d1fb5['where']=qs[_0xbd5c('0xd4')](_[_0xbd5c('0xdc')](_0x4b8b01[_0xbd5c('0x4e')],_0x2a9f8f[_0xbd5c('0xd4')]));if(_0x4b8b01[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x1d1fb5[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x1d1fb5[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x1d1fb5['attributes'],function(_0x13b7be){var _0x4dd29c={};_0x4dd29c[_0x13b7be]={'$like':'%'+_0x4b8b01['query'][_0xbd5c('0x3a')]+'%'};return _0x4dd29c;})});}_0x1d1fb5=_[_0xbd5c('0x61')]({},_0x1d1fb5,_0x4b8b01['options']);return _0x16a20b[_0xbd5c('0xec')](_0x1d1fb5);}})['then'](function(_0x1f37c1){if(_0x1f37c1){_0x1c3a68=_0x1f37c1['length'];if(!_0x4b8b01[_0xbd5c('0x4e')]['hasOwnProperty'](_0xbd5c('0xda'))){_0x1d1fb5[_0xbd5c('0x20')]=qs[_0xbd5c('0x20')](_0x4b8b01['query'][_0xbd5c('0x20')]);_0x1d1fb5[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x4b8b01[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x16a20b[_0xbd5c('0xec')](_0x1d1fb5);}})[_0xbd5c('0x2f')](function(_0xa11612){if(_0xa11612){return _0xa11612?{'count':_0x1c3a68,'rows':_0xa11612}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0x24959d,null))[_0xbd5c('0x2e')](handleError(_0x24959d,null));};exports[_0xbd5c('0xee')]=function(_0x26096a,_0x7b2aa1,_0x1dbd50){var _0x3120cc;var _0x390cc1;var _0x4a6d90;var _0x4aca03=!_[_0xbd5c('0x70')](_0x26096a['params']['id'])?_0x26096a[_0xbd5c('0x60')]['id']:!_[_0xbd5c('0x70')](_0x26096a[_0xbd5c('0x36')]['id'])?_0x26096a[_0xbd5c('0x36')]['id']:null;return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x4aca03,'role':{'$or':[_0xbd5c('0x34'),_0xbd5c('0x36'),_0xbd5c('0x37')]}},'attributes':['id',_0xbd5c('0x40'),'phone',_0xbd5c('0xef'),_0xbd5c('0x33'),_0xbd5c('0x6b'),_0xbd5c('0xf0')]})[_0xbd5c('0x2f')](function(_0x17ea18){if(_0x17ea18){if(_0x17ea18[_0xbd5c('0x33')]===_0xbd5c('0x37')){_0x3120cc=_0x17ea18;if(_0x26096a['body'][_0xbd5c('0xa7')]){_0x4a6d90=util[_0xbd5c('0xb2')](_0xbd5c('0xf1'),_0x3120cc[_0x26096a[_0xbd5c('0x66')]['interface']]);}else if(_0x26096a[_0xbd5c('0x66')]['intrf']){_0x4a6d90=util[_0xbd5c('0xb2')](_0xbd5c('0xf2'),_0x26096a[_0xbd5c('0x66')][_0xbd5c('0xf3')]);}else{_0x4a6d90=util[_0xbd5c('0xb2')]('SIP/%s',_0x3120cc[_0xbd5c('0x40')]);}socket['to'](util[_0xbd5c('0xb2')](_0xbd5c('0xf4'),_0x3120cc[_0xbd5c('0x40')]))[_0xbd5c('0x30')](_0xbd5c('0xf5'),{'user':{'id':_0x3120cc['id'],'name':_0x3120cc[_0xbd5c('0x40')]},'ip':_0x26096a['headers']['x-forwarded-for']||_0x26096a['connection'][_0xbd5c('0xf6')]||_0x26096a['socket']['remoteAddress']||_0x26096a[_0xbd5c('0xf7')]['socket'][_0xbd5c('0xf6')]});return db['UserVoiceQueueRt'][_0xbd5c('0x31')]({'where':{'membername':_0x3120cc[_0xbd5c('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0xbd5c('0x9d'))][(_0xbd5c('0x9e'))](_0xbd5c('0xf8'));}})[_0xbd5c('0x2f')](function(){if(_0x3120cc){return _0x3120cc['getVoiceQueues']({'raw':!![]});}})[_0xbd5c('0x2f')](function(_0x3b01e3){if(_0x3120cc){if(_0x3b01e3){_0x390cc1=_0x3b01e3;if(_0x390cc1['length']){var _0x1f5926=_0x390cc1[_0xbd5c('0x44')](function(_0x283cd0){var _0x441eb0={'membername':_0x3120cc[_0xbd5c('0x40')],'UserId':_0x3120cc['id'],'queue_name':_0x283cd0[_0xbd5c('0x40')],'VoiceQueueId':_0x283cd0['id'],'interface':_0x4a6d90,'paused':_0x3120cc[_0xbd5c('0xf0')]||![],'penalty':_0x283cd0['UserVoiceQueue.penalty']||0x0};return db[_0xbd5c('0xb4')][_0xbd5c('0xb5')](_0x441eb0);});return Promise[_0xbd5c('0x5e')](_0x1f5926);}}}})[_0xbd5c('0x2f')](function(){if(_0x3120cc){return db[_0xbd5c('0xf9')][_0xbd5c('0x55')]({'where':{'membername':_0x3120cc['name'],'exitAt':null}});}})[_0xbd5c('0x2f')](function(_0x61affb){if(_0x3120cc){var _0x237d04=[];_0x61affb['forEach'](function(_0x4dcb14){_0x237d04[_0xbd5c('0x54')](_0x4dcb14[_0xbd5c('0x65')]({'exitAt':moment()[_0xbd5c('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x237d04);}})['then'](function(){if(_0x3120cc){var _0x4de5f6=[];var _0x329ecd=[];var _0x1ac349=utils[_0xbd5c('0xfa')]();var _0x302394={'membername':_0x3120cc[_0xbd5c('0x40')],'interface':_0x4a6d90,'enterAt':moment()[_0xbd5c('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3120cc[_0xbd5c('0x33')],'internal':_0x3120cc['internal']};_0x1ac349[_0xbd5c('0xfb')](function(_0x490d95){_0x4de5f6[_0xbd5c('0x54')](_['merge']({'channel':_0x490d95,'type':_0xbd5c('0xfc'),'data1':_0x26096a[_0xbd5c('0x66')]['device'],'data2':_0x4a6d90},_0x302394));if(_0x3120cc[_0xbd5c('0xf0')]){_0x329ecd['push'](_[_0xbd5c('0x61')]({'channel':_0x490d95,'type':_0xbd5c('0xfd'),'data1':_0xbd5c('0xfe')},_0x302394));}});return db['MemberReport'][_0xbd5c('0x94')](_0x4de5f6[_0xbd5c('0xff')](_0x329ecd),{'individualHooks':!![]});}})[_0xbd5c('0x2f')](function(){if(_0x3120cc){return _0x3120cc[_0xbd5c('0x65')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3120cc['loginInPause']||![],'mailPause':_0x3120cc[_0xbd5c('0xf0')]||![],'chatPause':_0x3120cc[_0xbd5c('0xf0')]||![],'faxPause':_0x3120cc[_0xbd5c('0xf0')]||![],'smsPause':_0x3120cc[_0xbd5c('0xf0')]||![],'openchannelPause':_0x3120cc[_0xbd5c('0xf0')]||![],'whatsappPause':_0x3120cc[_0xbd5c('0xf0')]||![],'pauseType':_0x3120cc[_0xbd5c('0xf0')]?_0xbd5c('0xfe'):null,'interface':_0x4a6d90,'lastPauseAt':moment()[_0xbd5c('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbd5c('0x2f')](function(_0x51cf1f){if(_0x26096a[_0xbd5c('0x100')]){return _0x1dbd50();}else{return Promise['resolve'](_0x51cf1f)[_0xbd5c('0x2f')](respondWithResult(_0x7b2aa1,null));}})['catch'](handleError(_0x7b2aa1,null));};exports[_0xbd5c('0x101')]=function(_0x5eadde,_0x4a33be){var _0x9a2a9d;return db[_0xbd5c('0x42')][_0xbd5c('0x3d')]({'where':{'id':_0x5eadde[_0xbd5c('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0xbd5c('0x33')]})[_0xbd5c('0x2f')](handleEntityNotFound(_0x4a33be,null))[_0xbd5c('0x2f')](function(_0xabf1d3){if(_0xabf1d3){_0x9a2a9d=_0xabf1d3;return db[_0xbd5c('0xb4')][_0xbd5c('0x31')]({'where':{'membername':_0x9a2a9d['name']},'individualHooks':!![]});}})[_0xbd5c('0x2f')](function(){return db['MemberReport'][_0xbd5c('0x55')]({'where':{'membername':_0x9a2a9d[_0xbd5c('0x40')],'exitAt':null}});})[_0xbd5c('0x2f')](function(_0x3eb15b){var _0x403c71=[];_0x3eb15b[_0xbd5c('0xfb')](function(_0x4fcd5c){_0x403c71[_0xbd5c('0x54')](_0x4fcd5c[_0xbd5c('0x65')]({'exitAt':moment()[_0xbd5c('0xb2')](_0xbd5c('0x102'))}));});return Promise['all'](_0x403c71);})['then'](function(){return _0x9a2a9d[_0xbd5c('0x65')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbd5c('0x2f')](respondWithResult(_0x4a33be,null))[_0xbd5c('0x2e')](handleError(_0x4a33be,null));};exports[_0xbd5c('0x103')]=function(_0x19ea8b,_0x23da17){var _0x51680c;return db['UserVoiceQueueRt'][_0xbd5c('0x65')]({'paused':0x1},{'where':{'UserId':_0x19ea8b['params']['id']},'individualHooks':!![]})[_0xbd5c('0x2f')](function(){return db[_0xbd5c('0x42')]['find']({'where':{'id':_0x19ea8b[_0xbd5c('0x60')]['id'],'role':_0xbd5c('0x37')},'attributes':['id','name',_0xbd5c('0x33'),'internal',_0xbd5c('0xa7'),'online']});})[_0xbd5c('0x2f')](handleEntityNotFound(_0x23da17,null))[_0xbd5c('0x2f')](function(_0x2f5685){if(_0x2f5685){_0x51680c=_0x2f5685;return respondWithRpcPromise(_0xbd5c('0x104'),_0xbd5c('0x103'),{'id':_0x51680c['id'],'name':_0x51680c['name'],'pause':!![]});}})[_0xbd5c('0x2f')](function(){if(_0x51680c){return db[_0xbd5c('0xf9')][_0xbd5c('0x55')]({'where':{'membername':_0x51680c[_0xbd5c('0x40')],'type':_0xbd5c('0xfd'),'exitAt':null}});}})['then'](function(_0x3ee1e1){if(_0x3ee1e1[_0xbd5c('0x74')]){var _0x1a9d6e=moment()[_0xbd5c('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x880b22=0x0,_0x4c6cc8=_0x3ee1e1[_0xbd5c('0x74')];_0x880b22<_0x4c6cc8;_0x880b22++){_0x3ee1e1[_0x880b22][_0xbd5c('0x105')]({'exitAt':_0x1a9d6e});}}})[_0xbd5c('0x2f')](function(){var _0x44fed4=[];var _0x1c2019=utils['getChannels']();_0x1c2019[_0xbd5c('0xfb')](function(_0x5f4968){_0x44fed4[_0xbd5c('0x54')]({'channel':_0x5f4968,'membername':_0x51680c[_0xbd5c('0x40')],'interface':_[_0xbd5c('0x70')](_0x51680c[_0xbd5c('0xa7')])?util[_0xbd5c('0xb2')](_0xbd5c('0xf2'),_0x51680c['name']):_0x51680c[_0xbd5c('0xa7')],'type':_0xbd5c('0xfd'),'enterAt':moment()[_0xbd5c('0xb2')](_0xbd5c('0x102')),'data1':_0x19ea8b[_0xbd5c('0x66')][_0xbd5c('0x46')]||_0xbd5c('0x106'),'role':_0x51680c['role'],'internal':_0x51680c[_0xbd5c('0x6b')]});});return db[_0xbd5c('0xf9')][_0xbd5c('0x94')](_0x44fed4,{'individualHooks':!![]});})[_0xbd5c('0x2f')](function(){return _0x51680c[_0xbd5c('0x65')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x19ea8b[_0xbd5c('0x66')][_0xbd5c('0x46')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbd5c('0xb2')](_0xbd5c('0x102'))});})['then'](respondWithResult(_0x23da17,null))[_0xbd5c('0x2e')](handleError(_0x23da17,null));};exports[_0xbd5c('0x107')]=function(_0x3fca11,_0xd93c87){if(_0x3fca11[_0xbd5c('0x66')]['channel']&&!utils[_0xbd5c('0xa8')](_0x3fca11[_0xbd5c('0x66')]['channel'])){throw new APIBadRequestError(util[_0xbd5c('0xb2')](_0xbd5c('0x108'),_0x3fca11[_0xbd5c('0x66')][_0xbd5c('0xa5')]));}return db[_0xbd5c('0x42')]['find']({'where':{'id':_0x3fca11['params']['id']},'attributes':['id',_0xbd5c('0x40'),_0xbd5c('0x33'),_0xbd5c('0x6b'),'interface','online','voicePause',_0xbd5c('0x109'),'chatPause',_0xbd5c('0x10a'),_0xbd5c('0x10b'),_0xbd5c('0x10c'),_0xbd5c('0x10d'),_0xbd5c('0x10e'),_0xbd5c('0x10f')]})['then'](function(_0x1479ce){if(!_0x1479ce){throw new APINotFoundError(util[_0xbd5c('0xb2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3fca11['params']['id']));}return _0x1479ce['unpause'](_0x3fca11[_0xbd5c('0x66')][_0xbd5c('0xa5')]);})[_0xbd5c('0x2f')](respondWithResult(_0xd93c87,null))[_0xbd5c('0x2e')](APIHandleError(_0xd93c87));};exports[_0xbd5c('0x110')]=function(_0x1217b4,_0xeb7e0d){var _0x245ed1={};var _0x41e4e9={};var _0x40654a;var _0x5bcc68;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x1217b4[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0xeb7e0d,null))[_0xbd5c('0x2f')](function(_0x5080d1){if(_0x5080d1){_0x40654a=_0x5080d1;_0x41e4e9[_0xbd5c('0xd1')]=_[_0xbd5c('0xd2')](db[_0xbd5c('0x111')][_0xbd5c('0x43')]);_0x41e4e9['query']=_[_0xbd5c('0xd2')](_0x1217b4['query']);_0x41e4e9['filters']=_[_0xbd5c('0xd5')](_0x41e4e9[_0xbd5c('0xd1')],_0x41e4e9[_0xbd5c('0x4e')]);_0x245ed1[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x41e4e9[_0xbd5c('0xd1')],qs[_0xbd5c('0xd6')](_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x245ed1['attributes']=_0x245ed1[_0xbd5c('0x53')][_0xbd5c('0x74')]?_0x245ed1[_0xbd5c('0x53')]:_0x41e4e9[_0xbd5c('0xd1')];_0x245ed1[_0xbd5c('0xd7')]=qs[_0xbd5c('0xd8')](_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x245ed1['where']=qs['filters'](_[_0xbd5c('0xdc')](_0x1217b4[_0xbd5c('0x4e')],_0x41e4e9[_0xbd5c('0xd4')]));if(_0x1217b4[_0xbd5c('0x4e')]['filter']){_0x245ed1[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x245ed1[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x245ed1['attributes'],function(_0x25733d){var _0x393b2c={};_0x393b2c[_0x25733d]={'$like':'%'+_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x393b2c;})});}_0x245ed1=_[_0xbd5c('0x61')]({},_0x245ed1,_0x1217b4[_0xbd5c('0x62')]);return _0x40654a['getTeams'](_0x245ed1);}})[_0xbd5c('0x2f')](function(_0x18f390){if(_0x18f390){_0x5bcc68=_0x18f390[_0xbd5c('0x74')];if(!_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0xcc')]('nolimit')){_0x245ed1[_0xbd5c('0x20')]=qs['limit'](_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0x20')]);_0x245ed1[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x1217b4[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x40654a[_0xbd5c('0x110')](_0x245ed1);}})[_0xbd5c('0x2f')](function(_0x15d398){if(_0x15d398){return _0x15d398?{'count':_0x5bcc68,'rows':_0x15d398}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0xeb7e0d,null))['catch'](handleError(_0xeb7e0d,null));};exports[_0xbd5c('0x112')]=function(_0x3394b1,_0x23b94a){var _0x3f8f32=_0x3394b1[_0xbd5c('0x60')]['id'];var _0x3e62a5=_0x3394b1[_0xbd5c('0x66')]?_0x3394b1['body'][_0xbd5c('0x69')]:null;var _0x9c49a1=[];return Promise[_0xbd5c('0x113')]()[_0xbd5c('0x2f')](function(){if(!_0x3e62a5)throw new APIBadRequestError(_0xbd5c('0x114'));})['then'](function(){return db['User'][_0xbd5c('0xca')]({'where':{'id':_0x3f8f32}});})[_0xbd5c('0x2f')](function(_0x15e04d){if(!_0x15e04d)throw new APINotFoundError(util[_0xbd5c('0xb2')](_0xbd5c('0xcb'),_0x3394b1[_0xbd5c('0x60')]['id']));return db[_0xbd5c('0x72')][_0xbd5c('0x115')](function(_0x3fd92d){return _0x15e04d[_0xbd5c('0x112')](_0x3e62a5,{'transaction':_0x3fd92d})[_0xbd5c('0x2f')](function(){return db[_0xbd5c('0x111')][_0xbd5c('0x55')]({'where':{'id':{'$in':_0x3e62a5}}});})['then'](function(_0x23fa3a){var _0x2055f2=_['map'](_0x23fa3a,function(_0x5f40d9){return _0x5f40d9['getAssociatedQueues']();});return Promise['all'](_0x2055f2);})['then'](function(_0x3e536d){_0x9c49a1=_[_0xbd5c('0x116')](_0x3e536d);var _0x3bb3b9=_[_0xbd5c('0x44')](_0x9c49a1,function(_0x59fab2){return _0x59fab2[_0xbd5c('0x117')](_0x15e04d['id'],{'transaction':_0x3fd92d});});return Promise['all'](_0x3bb3b9);})[_0xbd5c('0x2f')](function(){if(!_0x15e04d[_0xbd5c('0xa6')])return;var _0x19b494=_[_0xbd5c('0x3a')](_0x9c49a1,function(_0x2dd702){return _0x2dd702['getDataValue'](_0xbd5c('0xa5'))===_0xbd5c('0x118');});var _0x26526e=_['map'](_0x19b494,function(_0x1c4f75){return db[_0xbd5c('0xb4')][_0xbd5c('0xb5')]({'membername':_0x15e04d[_0xbd5c('0x40')],'UserId':_0x15e04d['id'],'queue_name':_0x1c4f75[_0xbd5c('0x40')],'VoiceQueueId':_0x1c4f75['id'],'interface':_['isNil'](_0x15e04d['interface'])?util['format']('SIP/%s',_0x15e04d[_0xbd5c('0x40')]):_0x15e04d[_0xbd5c('0xa7')],'paused':_0x15e04d[_0xbd5c('0xb3')]||![],'penalty':_0x15e04d['penalty']},{'transaction':_0x3fd92d});});return Promise[_0xbd5c('0x5e')](_0x26526e);})[_0xbd5c('0x2f')](function(){return db[_0xbd5c('0x119')][_0xbd5c('0x55')]({'where':{'teamId':{'$in':_0x3e62a5}}});})[_0xbd5c('0x2f')](function(_0x4b9cd1){var _0x11ef48=_[_0xbd5c('0x44')](_0x4b9cd1,function(_0x503013){return db[_0xbd5c('0x11a')]['create']({'UserId':_0x15e04d['id'],'VoicePrefixId':_0x503013[_0xbd5c('0x11b')]},{'transaction':_0x3fd92d});});return Promise[_0xbd5c('0x5e')](_0x11ef48);});});})['then'](function(){for(var _0x5713a7=0x0;_0x5713a7<_0x9c49a1['length'];_0x5713a7++){var _0x1f391c=_0x9c49a1[_0x5713a7]['getDataValue'](_0xbd5c('0xa5'));var _0x1b34a6=_0x1f391c+_0xbd5c('0xb0');socket[_0xbd5c('0x30')](_0xbd5c('0x36')+_0x1f391c+_0xbd5c('0x11c'),{'UserId':_0x3f8f32,['queueField']:_0x9c49a1[_0x5713a7]['id']});}})[_0xbd5c('0x2f')](respondWithStatusCode(_0x23b94a,null))[_0xbd5c('0x2e')](APIHandleError(_0x23b94a));};exports[_0xbd5c('0x11d')]=function(_0x44b38d,_0x28257c){var _0x1dfb47=_0x44b38d['params']['id'];var _0x2cdd19=null;if(_0x44b38d[_0xbd5c('0x4e')]['ids']){_0x2cdd19=_[_0xbd5c('0xb7')](_0x44b38d[_0xbd5c('0x4e')][_0xbd5c('0x69')])?_0x44b38d[_0xbd5c('0x4e')][_0xbd5c('0x69')]:[_0x44b38d[_0xbd5c('0x4e')][_0xbd5c('0x69')]];}var _0x146d23=[];return Promise[_0xbd5c('0x113')]()[_0xbd5c('0x2f')](function(){if(!_0x2cdd19)throw new APIBadRequestError(_0xbd5c('0x11e'));})[_0xbd5c('0x2f')](function(){return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x1dfb47}});})[_0xbd5c('0x2f')](function(_0x36981f){if(!_0x36981f)throw new APINotFoundError(util[_0xbd5c('0xb2')](_0xbd5c('0xcb'),_0x44b38d['params']['id']));return db['sequelize'][_0xbd5c('0x115')](function(_0x2927fd){return _0x36981f[_0xbd5c('0x11d')](_0x2cdd19,{'transaction':_0x2927fd})[_0xbd5c('0x2f')](function(){return db[_0xbd5c('0x111')][_0xbd5c('0x55')]({'where':{'id':{'$in':_0x2cdd19}}});})['then'](function(_0x5ab3c1){var _0x202b25=_[_0xbd5c('0x44')](_0x5ab3c1,function(_0x4f6951){return _0x4f6951['getAssociatedQueues']();});return Promise[_0xbd5c('0x5e')](_0x202b25);})['then'](function(_0x443fd7){_0x146d23=_['flattenDeep'](_0x443fd7);var _0x385bb9=_[_0xbd5c('0x44')](_0x146d23,function(_0x480730){return _0x480730[_0xbd5c('0x11f')](_0x36981f['id'],{'transaction':_0x2927fd});});return Promise[_0xbd5c('0x5e')](_0x385bb9);})[_0xbd5c('0x2f')](function(){if(!_0x36981f[_0xbd5c('0xa6')])return;var _0x3f988a=_[_0xbd5c('0x3a')](_0x146d23,function(_0x51bdb6){return _0x51bdb6[_0xbd5c('0x120')](_0xbd5c('0xa5'))===_0xbd5c('0x118');});var _0x597869=_[_0xbd5c('0x44')](_0x3f988a,function(_0x45932f){return db[_0xbd5c('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x45932f['id'],'UserId':_0x36981f['id']},'transaction':_0x2927fd});});return Promise['all'](_0x597869);})['then'](function(){return db['TeamVoicePrefix'][_0xbd5c('0x55')]({'where':{'teamId':{'$in':_0x2cdd19}}});})['then'](function(_0x1d76e2){var _0x1276bc=_[_0xbd5c('0x44')](_0x1d76e2,function(_0x116498){return db[_0xbd5c('0x11a')]['destroy']({'where':{'UserId':_0x36981f['id'],'VoicePrefixId':_0x116498[_0xbd5c('0x11b')]}},{'transaction':_0x2927fd});});return Promise['all'](_0x1276bc);});});})[_0xbd5c('0x2f')](function(){for(var _0x38143d=0x0;_0x38143d<_0x146d23['length'];_0x38143d++){var _0xd3c0a6=_0x146d23[_0x38143d][_0xbd5c('0x120')](_0xbd5c('0xa5'));var _0x263a0d=_0xd3c0a6+_0xbd5c('0xb0');socket[_0xbd5c('0x30')](_0xbd5c('0x36')+_0xd3c0a6+'Queue:remove',{'UserId':_0x1dfb47,['queueField']:_0x146d23[_0x38143d]['id']});}})[_0xbd5c('0x2f')](respondWithStatusCode(_0x28257c,null))['catch'](APIHandleError(_0x28257c));};exports[_0xbd5c('0x121')]=function(_0x4b3209,_0x41f232){var _0x3748f1={};var _0x53f7ad={};var _0x312cd9;var _0x56515e;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0x4b3209[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x41f232,null))[_0xbd5c('0x2f')](function(_0x33a4d9){if(_0x33a4d9){_0x312cd9=_0x33a4d9;_0x53f7ad[_0xbd5c('0xd1')]=_['keys'](db['CmList']['rawAttributes']);_0x53f7ad[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0x4b3209['query']);_0x53f7ad['filters']=_[_0xbd5c('0xd5')](_0x53f7ad[_0xbd5c('0xd1')],_0x53f7ad[_0xbd5c('0x4e')]);_0x3748f1[_0xbd5c('0x53')]=_[_0xbd5c('0xd5')](_0x53f7ad['model'],qs[_0xbd5c('0xd6')](_0x4b3209[_0xbd5c('0x4e')][_0xbd5c('0xd6')]));_0x3748f1['attributes']=_0x3748f1[_0xbd5c('0x53')]['length']?_0x3748f1[_0xbd5c('0x53')]:_0x53f7ad[_0xbd5c('0xd1')];_0x3748f1[_0xbd5c('0xd7')]=qs['sort'](_0x4b3209[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x3748f1[_0xbd5c('0x4d')]=qs['filters'](_[_0xbd5c('0xdc')](_0x4b3209[_0xbd5c('0x4e')],_0x53f7ad[_0xbd5c('0xd4')]));if(_0x4b3209['query'][_0xbd5c('0x3a')]){_0x3748f1[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x3748f1[_0xbd5c('0x4d')],{'$or':_[_0xbd5c('0x44')](_0x3748f1[_0xbd5c('0x53')],function(_0x386077){var _0x4ef3c9={};_0x4ef3c9[_0x386077]={'$like':'%'+_0x4b3209[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x4ef3c9;})});}_0x3748f1=_[_0xbd5c('0x61')]({},_0x3748f1,_0x4b3209[_0xbd5c('0x62')]);return _0x312cd9['getLists'](_0x3748f1);}})[_0xbd5c('0x2f')](function(_0x51c651){if(_0x51c651){_0x56515e=_0x51c651[_0xbd5c('0x74')];if(!_0x4b3209[_0xbd5c('0x4e')][_0xbd5c('0xcc')](_0xbd5c('0xda'))){_0x3748f1['limit']=qs[_0xbd5c('0x20')](_0x4b3209[_0xbd5c('0x4e')]['limit']);_0x3748f1[_0xbd5c('0x1f')]=qs[_0xbd5c('0x1f')](_0x4b3209[_0xbd5c('0x4e')][_0xbd5c('0x1f')]);}return _0x312cd9[_0xbd5c('0x121')](_0x3748f1);}})['then'](function(_0x5e1a0b){if(_0x5e1a0b){return _0x5e1a0b?{'count':_0x56515e,'rows':_0x5e1a0b}:null;}})[_0xbd5c('0x2f')](respondWithResult(_0x41f232,null))[_0xbd5c('0x2e')](handleError(_0x41f232,null));};exports[_0xbd5c('0x122')]=function(_0xbb05,_0x469fb5){var _0x249345={};var _0x59a0e9={};var _0x15b10f;return db[_0xbd5c('0x42')][_0xbd5c('0xca')]({'where':{'id':_0xbb05[_0xbd5c('0x60')]['id']}})[_0xbd5c('0x2f')](handleEntityNotFound(_0x469fb5,null))['then'](function(_0x1f4e28){if(_0x1f4e28){_0x15b10f=_0x1f4e28;_0x59a0e9[_0xbd5c('0xd1')]=_['keys'](db[_0xbd5c('0x42')][_0xbd5c('0x43')]);_0x59a0e9[_0xbd5c('0x4e')]=_[_0xbd5c('0xd2')](_0xbb05[_0xbd5c('0x4e')]);_0x59a0e9['filters']=_[_0xbd5c('0xd5')](_0x59a0e9['model'],_0x59a0e9[_0xbd5c('0x4e')]);_0x249345[_0xbd5c('0x53')]=_['intersection'](_0x59a0e9['model'],qs[_0xbd5c('0xd6')](_0xbb05['query'][_0xbd5c('0xd6')]));_0x249345['attributes']=_0x249345[_0xbd5c('0x53')]['length']?_0x249345[_0xbd5c('0x53')]:_0x59a0e9[_0xbd5c('0xd1')];_0x249345['order']=qs['sort'](_0xbb05[_0xbd5c('0x4e')][_0xbd5c('0xd8')]);_0x249345[_0xbd5c('0x4d')]=qs[_0xbd5c('0xd4')](_[_0xbd5c('0xdc')](_0xbb05[_0xbd5c('0x4e')],_0x59a0e9['filters']));if(_0xbb05[_0xbd5c('0x4e')][_0xbd5c('0x3a')]){_0x249345[_0xbd5c('0x4d')]=_[_0xbd5c('0x61')](_0x249345[_0xbd5c('0x4d')],{'$or':_['map'](_0x249345[_0xbd5c('0x53')],function(_0x2f52f7){var _0x381d48={};_0x381d48[_0x2f52f7]={'$like':'%'+_0xbb05[_0xbd5c('0x4e')][_0xbd5c('0x3a')]+'%'};return _0x381d48;})});}_0x249345[_0xbd5c('0xd1')]=db['User'];_0x249345['as']='Agents';_0x249345=_[_0xbd5c('0x61')]({},_0x249345,_0xbb05[_0xbd5c('0x62')]);return _0x15b10f[_0xbd5c('0x123')]({'include':[_0x249345]});}})[_0xbd5c('0x2f')](function(_0x4868cc){if(_0x4868cc){var _0x5f038e={},_0x2ea73b=[];for(var _0x3874d4=0x0;_0x3874d4<_0x4868cc[_0xbd5c('0x74')];_0x3874d4+=0x1){for(var _0x4a2bff=0x0,_0x1a772b;_0x4a2bff<_0x4868cc[_0x3874d4][_0xbd5c('0x90')][_0xbd5c('0x74')];_0x4a2bff+=0x1){_0x1a772b=_0x4868cc[_0x3874d4][_0xbd5c('0x90')][_0x4a2bff][_0xbd5c('0x32')]({'plain':!![]});_0x5f038e[_0x1a772b['id']]=_0x1a772b;}}_0x5f038e=_[_0xbd5c('0x124')](_0x5f038e);for(var _0x46094a=qs[_0xbd5c('0x1f')](_0xbb05['query'][_0xbd5c('0x1f')]);_0x46094a<_0x5f038e[_0xbd5c('0x74')]&&_0x2ea73b[_0xbd5c('0x74')]=_0x3a3a4c[_0x77b8('0x4e')]){throw new Error(_0x77b8('0x4f'));}})['then'](function(){if(_0x248365){return db[_0x77b8('0x45')][_0x77b8('0x46')]({'where':{'membername':_0x248365[_0x77b8('0x24')]},'individualHooks':!![]});}})[_0x77b8('0x1a')](function(){if(_0x248365){return _0x248365[_0x77b8('0x50')]({'raw':!![]});}})[_0x77b8('0x1a')](function(_0x451c7f){if(_0x248365){if(_0x451c7f){var _0x421bfb=[];_0x1637b1=_0x451c7f;if(_0x1637b1[_0x77b8('0x29')]){for(var _0x3b8acf=0x0;_0x3b8acf<_0x1637b1[_0x77b8('0x29')];_0x3b8acf++){_0x421bfb[_0x77b8('0x2f')](db[_0x77b8('0x45')]['upsert']({'membername':_0x248365[_0x77b8('0x24')],'UserId':_0x248365['id'],'queue_name':_0x1637b1[_0x3b8acf][_0x77b8('0x24')],'VoiceQueueId':_0x1637b1[_0x3b8acf]['id'],'interface':_0x425f0d,'paused':_0x248365[_0x77b8('0x4a')]||![],'penalty':_0x1637b1[_0x3b8acf][_0x77b8('0x51')]||0x0}));}return BPromise['all'](_0x421bfb);}}}})[_0x77b8('0x1a')](function(){if(_0x248365){return db[_0x77b8('0x27')]['findAll']({'where':{'membername':_0x248365['name'],'exitAt':null}});}})[_0x77b8('0x1a')](function(_0x52220e){if(_0x248365){if(_0x52220e&&_0x52220e['length']){var _0x4d2a75=[];_0x52220e[_0x77b8('0x2e')](function(_0x5832d3){_0x4d2a75[_0x77b8('0x2f')](_0x5832d3[_0x77b8('0x52')]({'exitAt':moment()[_0x77b8('0x2a')](_0x77b8('0x2b'))}));});return BPromise[_0x77b8('0x53')](_0x4d2a75);}}})['then'](function(){if(_0x248365){var _0x16eac0=[];var _0x15c598=[];var _0x1aea3b=utils[_0x77b8('0x2d')]();var _0x3574f6={'membername':_0x248365['name'],'interface':_0x425f0d,'enterAt':moment()['format'](_0x77b8('0x2b')),'role':_0x248365['role'],'internal':_0x248365[_0x77b8('0x3c')]};_0x1aea3b[_0x77b8('0x2e')](function(_0x2cb8e0){_0x16eac0[_0x77b8('0x2f')](_[_0x77b8('0x54')]({'channel':_0x2cb8e0,'type':_0x77b8('0x55'),'data1':_0x77b8('0x56'),'data2':_0x425f0d},_0x3574f6));if(_0x248365[_0x77b8('0x4a')]){_0x15c598[_0x77b8('0x2f')](_[_0x77b8('0x54')]({'channel':_0x2cb8e0,'type':'PAUSE','data1':_0x77b8('0x57')},_0x3574f6));}});return db['MemberReport'][_0x77b8('0x36')](_0x16eac0[_0x77b8('0x58')](_0x15c598),{'individualHooks':!![]});}})[_0x77b8('0x1a')](function(){if(_0x248365){return _0x248365[_0x77b8('0x52')]({'online':!![],'lastLoginAt':moment()[_0x77b8('0x2a')](_0x77b8('0x2b')),'voicePause':_0x248365['loginInPause']||![],'mailPause':_0x248365['loginInPause']||![],'chatPause':_0x248365[_0x77b8('0x4a')]||![],'faxPause':_0x248365['loginInPause']||![],'smsPause':_0x248365[_0x77b8('0x4a')]||![],'openchannelPause':_0x248365[_0x77b8('0x4a')]||![],'pauseType':_0x248365[_0x77b8('0x4a')]?_0x77b8('0x57'):null,'lastPauseAt':moment()['format'](_0x77b8('0x2b')),'interface':_0x425f0d});}})[_0x77b8('0x1a')](function(_0x16bc2e){_0x1f817b(_0x16bc2e);})[_0x77b8('0x1d')](function(_0x27d01a){_0x414c7b(_0x174dc9[_0x77b8('0x1e')](0x1f4,_0x27d01a[_0x77b8('0x1f')]));});});}; \ No newline at end of file +var _0x6c28=['isNil','body','type','internal','uniqueid','update','DEFAULT\x20PAUSE','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','chatPause','smsPause','whatsappPause','pauseType','system','UserVoiceQueueRt','destroy','length','forEach','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','merge','concat','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','ShowUser','find','info','message','PauseUser','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','MemberReport','findAll','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push'];(function(_0x2282e3,_0x51001d){var _0x266329=function(_0x1da644){while(--_0x1da644){_0x2282e3['push'](_0x2282e3['shift']());}};_0x266329(++_0x51001d);}(_0x6c28,0x11b));var _0x86c2=function(_0x31c281,_0x5960fe){_0x31c281=_0x31c281-0x0;var _0x2452c7=_0x6c28[_0x31c281];return _0x2452c7;};'use strict';var _=require(_0x86c2('0x0'));var util=require(_0x86c2('0x1'));var moment=require(_0x86c2('0x2'));var BPromise=require(_0x86c2('0x3'));var Redis=require(_0x86c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x86c2('0x5'));var logger=require(_0x86c2('0x6'))(_0x86c2('0x7'));var config=require('../../config/environment');config[_0x86c2('0x8')]=_['defaults'](config[_0x86c2('0x8')],{'host':_0x86c2('0x9'),'port':0x18eb});var socket=require(_0x86c2('0xa'))(new Redis(config['redis']));require(_0x86c2('0xb'))[_0x86c2('0xc')](socket);exports[_0x86c2('0xd')]=function(_0x459527){var _0x5dd021=this;return new Promise(function(_0x558745,_0x2e4a6a){return db[_0x86c2('0xe')]['findAll']({'raw':_0x459527['options']?_0x459527[_0x86c2('0xf')][_0x86c2('0x10')]===undefined?!![]:![]:!![],'where':_0x459527[_0x86c2('0xf')]?_0x459527[_0x86c2('0xf')][_0x86c2('0x11')]||null:null,'attributes':_0x459527['options']?_0x459527[_0x86c2('0xf')][_0x86c2('0x12')]||null:null,'limit':_0x459527[_0x86c2('0xf')]?_0x459527[_0x86c2('0xf')][_0x86c2('0x13')]||null:null,'include':_0x459527['options']?_0x459527[_0x86c2('0xf')][_0x86c2('0x14')]?_[_0x86c2('0x15')](_0x459527[_0x86c2('0xf')]['include'],function(_0x663cf8){return{'model':db[_0x663cf8[_0x86c2('0x16')]],'as':_0x663cf8['as'],'attributes':_0x663cf8[_0x86c2('0x12')],'include':_0x663cf8['include']?_[_0x86c2('0x15')](_0x663cf8[_0x86c2('0x14')],function(_0x5af39f){return{'model':db[_0x5af39f['model']],'as':_0x5af39f['as'],'attributes':_0x5af39f[_0x86c2('0x12')],'include':_0x5af39f[_0x86c2('0x14')]?_['map'](_0x5af39f[_0x86c2('0x14')],function(_0x23db1f){return{'model':db[_0x23db1f[_0x86c2('0x16')]],'as':_0x23db1f['as'],'attributes':_0x23db1f[_0x86c2('0x12')]};}):[]};}):[]};}):[]:[]})[_0x86c2('0x17')](function(_0x3e366c){logger['info']('GetUser',_0x459527);logger[_0x86c2('0x18')](_0x86c2('0xd'),_0x459527,JSON[_0x86c2('0x19')](_0x3e366c));_0x558745(_0x3e366c);})[_0x86c2('0x1a')](function(_0x1d9667){logger[_0x86c2('0x1b')](_0x86c2('0xd'),_0x1d9667['message'],_0x459527);_0x2e4a6a(_0x5dd021['error'](0x1f4,_0x1d9667['message']));});});};exports[_0x86c2('0x1c')]=function(_0x4eedd4){var _0x25bd60=this;return new Promise(function(_0x1f76cf,_0x575267){return db[_0x86c2('0xe')][_0x86c2('0x1d')]({'raw':_0x4eedd4['options']?_0x4eedd4['options'][_0x86c2('0x10')]===undefined?!![]:![]:!![],'where':_0x4eedd4['options']?_0x4eedd4[_0x86c2('0xf')][_0x86c2('0x11')]||null:null,'attributes':_0x4eedd4[_0x86c2('0xf')]?_0x4eedd4[_0x86c2('0xf')][_0x86c2('0x12')]||null:null,'include':_0x4eedd4[_0x86c2('0xf')]?_0x4eedd4[_0x86c2('0xf')][_0x86c2('0x14')]?_[_0x86c2('0x15')](_0x4eedd4[_0x86c2('0xf')][_0x86c2('0x14')],function(_0x350e0f){return{'model':db[_0x350e0f[_0x86c2('0x16')]],'as':_0x350e0f['as'],'attributes':_0x350e0f['attributes'],'include':_0x350e0f[_0x86c2('0x14')]?_[_0x86c2('0x15')](_0x350e0f[_0x86c2('0x14')],function(_0x2a5015){return{'model':db[_0x2a5015[_0x86c2('0x16')]],'as':_0x2a5015['as'],'attributes':_0x2a5015[_0x86c2('0x12')],'include':_0x2a5015[_0x86c2('0x14')]?_['map'](_0x2a5015[_0x86c2('0x14')],function(_0x33705a){return{'model':db[_0x33705a[_0x86c2('0x16')]],'as':_0x33705a['as'],'attributes':_0x33705a[_0x86c2('0x12')]};}):[]};}):[]};}):[]:[]})[_0x86c2('0x17')](function(_0xda309a){logger[_0x86c2('0x1e')](_0x86c2('0x1c'),_0x4eedd4);logger[_0x86c2('0x18')]('ShowUser',_0x4eedd4,JSON[_0x86c2('0x19')](_0xda309a));_0x1f76cf(_0xda309a);})[_0x86c2('0x1a')](function(_0x1fa0ca){logger['error']('ShowUser',_0x1fa0ca[_0x86c2('0x1f')],_0x4eedd4);_0x575267(_0x25bd60[_0x86c2('0x1b')](0x1f4,_0x1fa0ca['message']));});});};exports[_0x86c2('0x20')]=function(_0x403f3f){var _0xd7c607;return db[_0x86c2('0xe')][_0x86c2('0x1d')]({'where':_0x403f3f[_0x86c2('0xf')][_0x86c2('0x11')]||{},'attributes':['id',_0x86c2('0x21'),_0x86c2('0x22'),'internal',_0x86c2('0x23')]})[_0x86c2('0x17')](function(_0x188b55){if(!_0x188b55){throw new Error(util[_0x86c2('0x24')](_0x86c2('0x25'),_0x403f3f['params']['id']));}_0xd7c607=_0x188b55;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0xd7c607['id']},'individualHooks':!![]});})[_0x86c2('0x17')](function(){return db[_0x86c2('0x26')][_0x86c2('0x27')]({'where':{'membername':_0xd7c607[_0x86c2('0x21')],'type':_0x86c2('0x28'),'exitAt':null}});})[_0x86c2('0x17')](function(_0x3d8bbf){if(_0x3d8bbf&&_0x3d8bbf['length']){var _0xd7a2d8=moment()[_0x86c2('0x24')](_0x86c2('0x29'));for(var _0xfbdf55=0x0,_0x38b862=_0x3d8bbf['length'];_0xfbdf55<_0x38b862;_0xfbdf55++){_0x3d8bbf[_0xfbdf55][_0x86c2('0x2a')]({'exitAt':_0xd7a2d8});}}})[_0x86c2('0x17')](function(){var _0x3d6046=[];var _0x47b609=utils[_0x86c2('0x2b')]();_0x47b609['forEach'](function(_0x18296d){_0x3d6046[_0x86c2('0x2c')]({'channel':_0x18296d,'membername':_0xd7c607['name'],'interface':_[_0x86c2('0x2d')](_0xd7c607[_0x86c2('0x23')])?util[_0x86c2('0x24')]('SIP/%s',_0xd7c607[_0x86c2('0x21')]):_0xd7c607[_0x86c2('0x23')],'type':_0x86c2('0x28'),'enterAt':moment()[_0x86c2('0x24')](_0x86c2('0x29')),'data1':_0x403f3f[_0x86c2('0x2e')][_0x86c2('0x2f')]||'DEFAULT\x20PAUSE','role':_0xd7c607['role'],'internal':_0xd7c607[_0x86c2('0x30')],'uniqueid':_0x403f3f[_0x86c2('0x2e')][_0x86c2('0x31')]||null});});return db['MemberReport']['bulkCreate'](_0x3d6046,{'individualHooks':!![]});})[_0x86c2('0x17')](function(){return _0xd7c607[_0x86c2('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x403f3f[_0x86c2('0x2e')][_0x86c2('0x2f')]||_0x86c2('0x33'),'lastPauseAt':moment()[_0x86c2('0x24')](_0x86c2('0x29'))});})['catch'](function(_0x806251){throw _0x806251;});};exports['UnpauseUser']=function(_0x52f1b0){return Promise[_0x86c2('0x34')]()[_0x86c2('0x17')](function(){if(_0x52f1b0[_0x86c2('0x2e')][_0x86c2('0x35')]&&!utils['isValidChannel'](_0x52f1b0[_0x86c2('0x2e')][_0x86c2('0x35')])){throw new Error(util[_0x86c2('0x24')](_0x86c2('0x36'),_0x52f1b0[_0x86c2('0x2e')][_0x86c2('0x35')]));}return db[_0x86c2('0xe')][_0x86c2('0x37')]({'where':_0x52f1b0['options'][_0x86c2('0x11')]||{},'attributes':['id',_0x86c2('0x21'),'role',_0x86c2('0x30'),_0x86c2('0x23'),'online','voicePause',_0x86c2('0x38'),_0x86c2('0x39'),'faxPause','openchannelPause',_0x86c2('0x3a'),_0x86c2('0x3b'),_0x86c2('0x3c'),'lastPauseAt']});})[_0x86c2('0x17')](function(_0x32f0f5){if(!_0x32f0f5){throw new Error(util[_0x86c2('0x24')]('User\x20with\x20id\x20%s\x20not\x20found',_0x52f1b0['params']['id']));}return _0x32f0f5['unpause'](_0x52f1b0[_0x86c2('0x2e')][_0x86c2('0x35')],_0x86c2('0x3d'));})[_0x86c2('0x1a')](function(_0x98ca3b){throw _0x98ca3b;});};exports['LogoutUser']=function(_0x10c456){var _0x486842=this;return new Promise(function(_0x3cfc71,_0x2e5bdb){var _0x47bab5;return db['User'][_0x86c2('0x37')]({'where':_0x10c456[_0x86c2('0xf')][_0x86c2('0x11')]||{},'attributes':['id',_0x86c2('0x21')]})['then'](function(_0x1df929){if(_0x1df929){_0x47bab5=_0x1df929;return db[_0x86c2('0x3e')][_0x86c2('0x3f')]({'where':{'membername':_0x47bab5[_0x86c2('0x21')]},'individualHooks':!![]});}})[_0x86c2('0x17')](function(){if(_0x47bab5){return db[_0x86c2('0x26')][_0x86c2('0x27')]({'where':{'membername':_0x47bab5[_0x86c2('0x21')],'exitAt':null}});}})[_0x86c2('0x17')](function(_0x18cde2){if(_0x47bab5){if(_0x18cde2&&_0x18cde2[_0x86c2('0x40')]){var _0x385855=[];_0x18cde2[_0x86c2('0x41')](function(_0x30b092){_0x385855['push'](_0x30b092[_0x86c2('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x86c2('0x42')](_0x385855);}}})[_0x86c2('0x17')](function(){if(_0x47bab5){return _0x47bab5[_0x86c2('0x32')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x86c2('0x17')](function(_0x309277){_0x3cfc71(_0x309277);})[_0x86c2('0x1a')](function(_0x5b62c2){_0x2e5bdb(_0x486842[_0x86c2('0x1b')](0x1f4,_0x5b62c2['message']));});});};exports[_0x86c2('0x43')]=function(_0x6ec3b8){var _0x389ac1=this;return new Promise(function(_0x57bc3d,_0x59910d){var _0x16e78d;var _0x279a16;var _0x1042df;var _0x21effc;return db['User']['findOne']({'where':_0x6ec3b8['options'][_0x86c2('0x11')]||{},'attributes':['id',_0x86c2('0x21'),_0x86c2('0x22'),_0x86c2('0x44'),'phone',_0x86c2('0x30'),_0x86c2('0x45'),_0x86c2('0x23')]})[_0x86c2('0x17')](function(_0x18a5ff){if(_0x18a5ff){_0x16e78d=_0x18a5ff;_0x21effc=_0x6ec3b8['body']['interface']?_0x6ec3b8[_0x86c2('0x2e')][_0x86c2('0x23')]:util[_0x86c2('0x24')]('SIP/%s',_0x16e78d[_0x86c2('0x21')]);return db[_0x86c2('0xe')][_0x86c2('0x46')]({'where':{'role':_0x86c2('0x47'),'online':!![],'id':{'$ne':_0x16e78d['id']}}});}})[_0x86c2('0x17')](function(_0x4f899d){if(_0x4f899d){_0x1042df=_0x4f899d;return require(_0x86c2('0x48'))[_0x86c2('0x49')]();}})['then'](function(_0x472727){if(_0x472727&&_0x472727[_0x86c2('0x4a')]&&_0x1042df>=_0x472727[_0x86c2('0x4a')]){throw new Error(_0x86c2('0x4b'));}})[_0x86c2('0x17')](function(){if(_0x16e78d){return db[_0x86c2('0x3e')][_0x86c2('0x3f')]({'where':{'membername':_0x16e78d[_0x86c2('0x21')]},'individualHooks':!![]});}})[_0x86c2('0x17')](function(){if(_0x16e78d){return _0x16e78d[_0x86c2('0x4c')]({'raw':!![]});}})[_0x86c2('0x17')](function(_0x2d898b){if(_0x16e78d){if(_0x2d898b){var _0x23c0ec=[];_0x279a16=_0x2d898b;if(_0x279a16[_0x86c2('0x40')]){for(var _0x5363c8=0x0;_0x5363c8<_0x279a16[_0x86c2('0x40')];_0x5363c8++){_0x23c0ec[_0x86c2('0x2c')](db[_0x86c2('0x3e')][_0x86c2('0x4d')]({'membername':_0x16e78d[_0x86c2('0x21')],'UserId':_0x16e78d['id'],'queue_name':_0x279a16[_0x5363c8][_0x86c2('0x21')],'VoiceQueueId':_0x279a16[_0x5363c8]['id'],'interface':_0x21effc,'paused':_0x16e78d[_0x86c2('0x45')]||![],'penalty':_0x279a16[_0x5363c8][_0x86c2('0x4e')]||0x0}));}return BPromise[_0x86c2('0x42')](_0x23c0ec);}}}})[_0x86c2('0x17')](function(){if(_0x16e78d){return db['MemberReport'][_0x86c2('0x27')]({'where':{'membername':_0x16e78d[_0x86c2('0x21')],'exitAt':null}});}})[_0x86c2('0x17')](function(_0x9ac933){if(_0x16e78d){if(_0x9ac933&&_0x9ac933[_0x86c2('0x40')]){var _0x4409d6=[];_0x9ac933['forEach'](function(_0x38c677){_0x4409d6[_0x86c2('0x2c')](_0x38c677[_0x86c2('0x32')]({'exitAt':moment()[_0x86c2('0x24')](_0x86c2('0x29'))}));});return BPromise['all'](_0x4409d6);}}})['then'](function(){if(_0x16e78d){var _0xc89470=[];var _0x4a93a9=[];var _0x4921ef=utils[_0x86c2('0x2b')]();var _0x39f87c={'membername':_0x16e78d[_0x86c2('0x21')],'interface':_0x21effc,'enterAt':moment()[_0x86c2('0x24')](_0x86c2('0x29')),'role':_0x16e78d['role'],'internal':_0x16e78d[_0x86c2('0x30')]};_0x4921ef[_0x86c2('0x41')](function(_0x2ae5f8){_0xc89470[_0x86c2('0x2c')](_['merge']({'channel':_0x2ae5f8,'type':_0x86c2('0x4f'),'data1':'callysquare','data2':_0x21effc},_0x39f87c));if(_0x16e78d['loginInPause']){_0x4a93a9['push'](_[_0x86c2('0x50')]({'channel':_0x2ae5f8,'type':_0x86c2('0x28'),'data1':'LOGININPAUSE'},_0x39f87c));}});return db[_0x86c2('0x26')]['bulkCreate'](_0xc89470[_0x86c2('0x51')](_0x4a93a9),{'individualHooks':!![]});}})['then'](function(){if(_0x16e78d){return _0x16e78d[_0x86c2('0x32')]({'online':!![],'lastLoginAt':moment()[_0x86c2('0x24')](_0x86c2('0x29')),'voicePause':_0x16e78d[_0x86c2('0x45')]||![],'mailPause':_0x16e78d[_0x86c2('0x45')]||![],'chatPause':_0x16e78d['loginInPause']||![],'faxPause':_0x16e78d['loginInPause']||![],'smsPause':_0x16e78d[_0x86c2('0x45')]||![],'openchannelPause':_0x16e78d[_0x86c2('0x45')]||![],'pauseType':_0x16e78d[_0x86c2('0x45')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x86c2('0x24')](_0x86c2('0x29')),'interface':_0x21effc});}})[_0x86c2('0x17')](function(_0x3900cd){_0x57bc3d(_0x3900cd);})[_0x86c2('0x1a')](function(_0x38924e){_0x59910d(_0x389ac1[_0x86c2('0x1b')](0x1f4,_0x38924e[_0x86c2('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1c1aa20..e267d28 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 _0x348c=['emit','removeListener','register','user:','./user.events','remove'];(function(_0x48bea1,_0x5f124f){var _0x3628bf=function(_0x4ae26b){while(--_0x4ae26b){_0x48bea1['push'](_0x48bea1['shift']());}};_0x3628bf(++_0x5f124f);}(_0x348c,0xd6));var _0xc348=function(_0x5d9e90,_0xd0db6b){_0x5d9e90=_0x5d9e90-0x0;var _0x20651e=_0x348c[_0x5d9e90];return _0x20651e;};'use strict';var UserEvents=require(_0xc348('0x0'));var events=['save',_0xc348('0x1'),'update'];function createListener(_0x821cbe,_0x416bc5){return function(_0x52f52f){_0x416bc5[_0xc348('0x2')](_0x821cbe,_0x52f52f);};}function removeListener(_0x2b5ec,_0x590d2d){return function(){UserEvents[_0xc348('0x3')](_0x2b5ec,_0x590d2d);};}exports[_0xc348('0x4')]=function(_0x427de0){for(var _0x380161=0x0,_0x1c6ea8=events['length'];_0x380161<_0x1c6ea8;_0x380161++){var _0x2bad05=events[_0x380161];var _0x239461=createListener(_0xc348('0x5')+_0x2bad05,_0x427de0);UserEvents['on'](_0x2bad05,_0x239461);}}; \ No newline at end of file +var _0xe9b1=['removeListener','register','length','user:','save','emit'];(function(_0x44ad4b,_0x13ccad){var _0x4c0516=function(_0x1a841e){while(--_0x1a841e){_0x44ad4b['push'](_0x44ad4b['shift']());}};_0x4c0516(++_0x13ccad);}(_0xe9b1,0xc4));var _0x1e9b=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xe9b1[_0x1beef3];return _0x5af964;};'use strict';var UserEvents=require('./user.events');var events=[_0x1e9b('0x0'),'remove','update'];function createListener(_0x564100,_0x14a6bc){return function(_0x222dd8){_0x14a6bc[_0x1e9b('0x1')](_0x564100,_0x222dd8);};}function removeListener(_0x1f2037,_0x2fbea1){return function(){UserEvents[_0x1e9b('0x2')](_0x1f2037,_0x2fbea1);};}exports[_0x1e9b('0x3')]=function(_0x5d4bfd){for(var _0xb9456a=0x0,_0x18887e=events[_0x1e9b('0x4')];_0xb9456a<_0x18887e;_0xb9456a++){var _0x483439=events[_0xb9456a];var _0x2e94d2=createListener(_0x1e9b('0x5')+_0x483439,_0x5d4bfd);UserEvents['on'](_0x483439,_0x2e94d2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index dbc6069..0a3d7b5 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x57d11b,_0x2a4299){var _0x63ad6e=function(_0x54b02d){while(--_0x54b02d){_0x57d11b['push'](_0x57d11b['shift']());}};_0x63ad6e(++_0x2a4299);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4441587..da99aba 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 _0xe4c0=['exports'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0xe4c0,0x1ca));var _0x0e4c=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xe4c0[_0x5515a7];return _0x43f4bf;};'use strict';var Sequelize=require('sequelize');module[_0x0e4c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5885=['exports','INTEGER','sequelize'];(function(_0x14d44f,_0x4e0e7a){var _0x238549=function(_0x461dfd){while(--_0x461dfd){_0x14d44f['push'](_0x14d44f['shift']());}};_0x238549(++_0x4e0e7a);}(_0x5885,0x1f1));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5588('0x0'));module[_0x5588('0x1')]={'penalty':{'type':Sequelize[_0x5588('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index a6f48b5..eeef7f1 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 _0xe614=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x58e4c4,_0x29efe8){var _0x4ff125=function(_0x5c712a){while(--_0x5c712a){_0x58e4c4['push'](_0x58e4c4['shift']());}};_0x4ff125(++_0x29efe8);}(_0xe614,0xd2));var _0x4e61=function(_0x30cf5e,_0x27d666){_0x30cf5e=_0x30cf5e-0x0;var _0x64e361=_0xe614[_0x30cf5e];return _0x64e361;};'use strict';var _=require(_0x4e61('0x0'));var util=require(_0x4e61('0x1'));var logger=require(_0x4e61('0x2'))('api');var moment=require(_0x4e61('0x3'));var BPromise=require(_0x4e61('0x4'));var rp=require(_0x4e61('0x5'));var fs=require('fs');var path=require(_0x4e61('0x6'));var rimraf=require(_0x4e61('0x7'));var config=require(_0x4e61('0x8'));var attributes=require(_0x4e61('0x9'));module[_0x4e61('0xa')]=function(_0x4b0c83,_0x42c9ac){return _0x4b0c83[_0x4e61('0xb')](_0x4e61('0xc'),attributes,{'tableName':_0x4e61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4256=['../../config/environment','UserChatQueue','user_has_chat_queues','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4ce67e,_0x53e4bf){var _0x103349=function(_0x305233){while(--_0x305233){_0x4ce67e['push'](_0x4ce67e['shift']());}};_0x103349(++_0x53e4bf);}(_0x4256,0xf6));var _0x6425=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x4256[_0xd22d95];return _0x15d7a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6425('0x0'))(_0x6425('0x1'));var moment=require(_0x6425('0x2'));var BPromise=require(_0x6425('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6425('0x4'));var rimraf=require(_0x6425('0x5'));var config=require(_0x6425('0x6'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1b42f8,_0x57f938){return _0x1b42f8['define'](_0x6425('0x7'),attributes,{'tableName':_0x6425('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index ec46ea4..8e77e52 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 _0x77f5=['code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2d0fff,_0x128adc){var _0x40c5b1=function(_0x2bbb86){while(--_0x2bbb86){_0x2d0fff['push'](_0x2d0fff['shift']());}};_0x40c5b1(++_0x128adc);}(_0x77f5,0xae));var _0x577f=function(_0x1e5017,_0x652070){_0x1e5017=_0x1e5017-0x0;var _0x56e3bd=_0x77f5[_0x1e5017];return _0x56e3bd;};'use strict';var _=require('lodash');var util=require(_0x577f('0x0'));var moment=require('moment');var BPromise=require(_0x577f('0x1'));var rs=require(_0x577f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x577f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x577f('0x4'))(_0x577f('0x5'));var config=require(_0x577f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x577f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5561a0,_0x2cea82,_0xed71b9){return new BPromise(function(_0x110ac8,_0x21253b){return client[_0x577f('0x8')](_0x5561a0,_0xed71b9)[_0x577f('0x9')](function(_0x102310){logger[_0x577f('0xa')](_0x577f('0xb'),_0x2cea82,_0x577f('0xc'));logger['debug'](_0x577f('0xd'),_0x2cea82,_0x577f('0xc'),JSON[_0x577f('0xe')](_0x102310));if(_0x102310[_0x577f('0xf')]){if(_0x102310[_0x577f('0xf')][_0x577f('0x10')]===0x1f4){logger[_0x577f('0xf')](_0x577f('0xb'),_0x2cea82,_0x102310[_0x577f('0xf')][_0x577f('0x11')]);return _0x21253b(_0x102310[_0x577f('0xf')][_0x577f('0x11')]);}logger['error'](_0x577f('0xb'),_0x2cea82,_0x102310['error']['message']);return _0x110ac8(_0x102310[_0x577f('0xf')][_0x577f('0x11')]);}else{logger[_0x577f('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x2cea82,_0x577f('0xc'));_0x110ac8(_0x102310['result'][_0x577f('0x11')]);}})[_0x577f('0x12')](function(_0x253692){logger['error'](_0x577f('0xb'),_0x2cea82,_0x253692);_0x21253b(_0x253692);});});} \ No newline at end of file +var _0x1c77=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x53fced,_0x648397){var _0x561e1d=function(_0x34e3f8){while(--_0x34e3f8){_0x53fced['push'](_0x53fced['shift']());}};_0x561e1d(++_0x648397);}(_0x1c77,0x111));var _0x71c7=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x1c77[_0x29a29f];return _0x443ea3;};'use strict';var _=require(_0x71c7('0x0'));var util=require(_0x71c7('0x1'));var moment=require(_0x71c7('0x2'));var BPromise=require(_0x71c7('0x3'));var rs=require(_0x71c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71c7('0x5'))['db'];var utils=require(_0x71c7('0x6'));var logger=require(_0x71c7('0x7'))(_0x71c7('0x8'));var config=require(_0x71c7('0x9'));var jayson=require(_0x71c7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x525440,_0x55f048,_0x538c9d){return new BPromise(function(_0xcd3b49,_0x2022a9){return client[_0x71c7('0xb')](_0x525440,_0x538c9d)[_0x71c7('0xc')](function(_0x1c1927){logger[_0x71c7('0xd')](_0x71c7('0xe'),_0x55f048,_0x71c7('0xf'));logger[_0x71c7('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x55f048,_0x71c7('0xf'),JSON['stringify'](_0x1c1927));if(_0x1c1927[_0x71c7('0x11')]){if(_0x1c1927[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger['error'](_0x71c7('0xe'),_0x55f048,_0x1c1927[_0x71c7('0x11')][_0x71c7('0x13')]);return _0x2022a9(_0x1c1927[_0x71c7('0x11')][_0x71c7('0x13')]);}logger[_0x71c7('0x11')](_0x71c7('0xe'),_0x55f048,_0x1c1927[_0x71c7('0x11')][_0x71c7('0x13')]);return _0xcd3b49(_0x1c1927[_0x71c7('0x11')][_0x71c7('0x13')]);}else{logger['info'](_0x71c7('0xe'),_0x55f048,_0x71c7('0xf'));_0xcd3b49(_0x1c1927[_0x71c7('0x14')]['message']);}})[_0x71c7('0x15')](function(_0x14bad2){logger['error'](_0x71c7('0xe'),_0x55f048,_0x14bad2);_0x2022a9(_0x14bad2);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1bce770..a345138 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x50b854,_0x37d8ba){var _0x2c30c4=function(_0x328bef){while(--_0x328bef){_0x50b854['push'](_0x50b854['shift']());}};_0x2c30c4(++_0x37d8ba);}(_0xe706,0xa3));var _0x6e70=function(_0x173fdf,_0x1ba573){_0x173fdf=_0x173fdf-0x0;var _0x147b6d=_0xe706[_0x173fdf];return _0x147b6d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x30471a,_0x4825b2){var _0xdb9d5e=function(_0x4a2d78){while(--_0x4a2d78){_0x30471a['push'](_0x30471a['shift']());}};_0xdb9d5e(++_0x4825b2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 059901a..b6eb14c 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 _0xbecb=['INTEGER','STRING'];(function(_0x5c9fbf,_0x2a3ae3){var _0x2e6678=function(_0x298e4b){while(--_0x298e4b){_0x5c9fbf['push'](_0x5c9fbf['shift']());}};_0x2e6678(++_0x2a3ae3);}(_0xbecb,0x14c));var _0xbbec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xbecb[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbbec('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbbec('0x1')]}}; \ No newline at end of file +var _0x89cc=['INTEGER','sequelize','exports'];(function(_0x5d28f4,_0x1cb121){var _0x377447=function(_0x541cc7){while(--_0x541cc7){_0x5d28f4['push'](_0x5d28f4['shift']());}};_0x377447(++_0x1cb121);}(_0x89cc,0x109));var _0xc89c=function(_0x27276d,_0x1fb889){_0x27276d=_0x27276d-0x0;var _0x35f7a1=_0x89cc[_0x27276d];return _0x35f7a1;};'use strict';var Sequelize=require(_0xc89c('0x0'));module[_0xc89c('0x1')]={'penalty':{'type':Sequelize[_0xc89c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc89c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 173ec1d..43e3f31 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 _0x525b=['UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x525b,0x12d));var _0xb525=function(_0xdbdb5f,_0x10f18b){_0xdbdb5f=_0xdbdb5f-0x0;var _0x4dfa9d=_0x525b[_0xdbdb5f];return _0x4dfa9d;};'use strict';var _=require(_0xb525('0x0'));var util=require(_0xb525('0x1'));var logger=require(_0xb525('0x2'))(_0xb525('0x3'));var moment=require(_0xb525('0x4'));var BPromise=require(_0xb525('0x5'));var rp=require(_0xb525('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb525('0x7'));var config=require(_0xb525('0x8'));var attributes=require(_0xb525('0x9'));module[_0xb525('0xa')]=function(_0x469750,_0x3bd374){return _0x469750['define'](_0xb525('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb207=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xb207,0x17a));var _0x7b20=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb207[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7b20('0x0'));var util=require(_0x7b20('0x1'));var logger=require(_0x7b20('0x2'))(_0x7b20('0x3'));var moment=require(_0x7b20('0x4'));var BPromise=require(_0x7b20('0x5'));var rp=require(_0x7b20('0x6'));var fs=require('fs');var path=require(_0x7b20('0x7'));var rimraf=require('rimraf');var config=require(_0x7b20('0x8'));var attributes=require(_0x7b20('0x9'));module[_0x7b20('0xa')]=function(_0x25cc59,_0x59c74c){return _0x25cc59[_0x7b20('0xb')]('UserFaxQueue',attributes,{'tableName':_0x7b20('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 4200ddf..3e92f5e 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 _0xa15a=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa15a,0x160));var _0xaa15=function(_0x451650,_0x3b2028){_0x451650=_0x451650-0x0;var _0x47c984=_0xa15a[_0x451650];return _0x47c984;};'use strict';var _=require('lodash');var util=require(_0xaa15('0x0'));var moment=require('moment');var BPromise=require(_0xaa15('0x1'));var rs=require(_0xaa15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa15('0x3'));var logger=require('../../config/logger')(_0xaa15('0x4'));var config=require(_0xaa15('0x5'));var jayson=require(_0xaa15('0x6'));var client=jayson[_0xaa15('0x7')][_0xaa15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cb4f1,_0x4c14a0,_0x31dfd9){return new BPromise(function(_0x2f71bd,_0x1f78ca){return client[_0xaa15('0x9')](_0x5cb4f1,_0x31dfd9)[_0xaa15('0xa')](function(_0x274338){logger[_0xaa15('0xb')](_0xaa15('0xc'),_0x4c14a0,_0xaa15('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4c14a0,'request\x20sent',JSON['stringify'](_0x274338));if(_0x274338[_0xaa15('0xe')]){if(_0x274338[_0xaa15('0xe')][_0xaa15('0xf')]===0x1f4){logger[_0xaa15('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4c14a0,_0x274338[_0xaa15('0xe')][_0xaa15('0x10')]);return _0x1f78ca(_0x274338[_0xaa15('0xe')][_0xaa15('0x10')]);}logger[_0xaa15('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4c14a0,_0x274338[_0xaa15('0xe')][_0xaa15('0x10')]);return _0x2f71bd(_0x274338['error'][_0xaa15('0x10')]);}else{logger[_0xaa15('0xb')](_0xaa15('0xc'),_0x4c14a0,_0xaa15('0xd'));_0x2f71bd(_0x274338[_0xaa15('0x11')][_0xaa15('0x10')]);}})[_0xaa15('0x12')](function(_0x26201b){logger[_0xaa15('0xe')](_0xaa15('0xc'),_0x4c14a0,_0x26201b);_0x1f78ca(_0x26201b);});});} \ No newline at end of file +var _0xd7c0=['request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xd7c0,0xa5));var _0x0d7c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd7c0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0d7c('0x0'));var util=require('util');var moment=require(_0x0d7c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d7c('0x2'));var fs=require('fs');var Redis=require(_0x0d7c('0x3'));var db=require(_0x0d7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d7c('0x5'))(_0x0d7c('0x6'));var config=require(_0x0d7c('0x7'));var jayson=require(_0x0d7c('0x8'));var client=jayson[_0x0d7c('0x9')][_0x0d7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57c620,_0x32fb52,_0x45620e){return new BPromise(function(_0x2db6b6,_0x377c06){return client[_0x0d7c('0xb')](_0x57c620,_0x45620e)['then'](function(_0xf6baa5){logger['info'](_0x0d7c('0xc'),_0x32fb52,_0x0d7c('0xd'));logger['debug'](_0x0d7c('0xe'),_0x32fb52,_0x0d7c('0xd'),JSON[_0x0d7c('0xf')](_0xf6baa5));if(_0xf6baa5[_0x0d7c('0x10')]){if(_0xf6baa5[_0x0d7c('0x10')][_0x0d7c('0x11')]===0x1f4){logger[_0x0d7c('0x10')](_0x0d7c('0xc'),_0x32fb52,_0xf6baa5[_0x0d7c('0x10')]['message']);return _0x377c06(_0xf6baa5[_0x0d7c('0x10')][_0x0d7c('0x12')]);}logger['error'](_0x0d7c('0xc'),_0x32fb52,_0xf6baa5[_0x0d7c('0x10')][_0x0d7c('0x12')]);return _0x2db6b6(_0xf6baa5[_0x0d7c('0x10')][_0x0d7c('0x12')]);}else{logger[_0x0d7c('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x32fb52,'request\x20sent');_0x2db6b6(_0xf6baa5[_0x0d7c('0x14')]['message']);}})[_0x0d7c('0x15')](function(_0x19fc6f){logger[_0x0d7c('0x10')](_0x0d7c('0xc'),_0x32fb52,_0x19fc6f);_0x377c06(_0x19fc6f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1bbdc46..7cda1c6 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x701c5d,_0x47a566){var _0x617b08=function(_0x41409f){while(--_0x41409f){_0x701c5d['push'](_0x701c5d['shift']());}};_0x617b08(++_0x47a566);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f8072,_0x490a73){var _0xb2d4ba=function(_0xdf8f29){while(--_0xdf8f29){_0x4f8072['push'](_0x4f8072['shift']());}};_0xb2d4ba(++_0x490a73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 43e2ec8..053e4a3 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 _0xd943=['sequelize','exports','INTEGER'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd943,0x14a));var _0x3d94=function(_0x289f13,_0x584981){_0x289f13=_0x289f13-0x0;var _0x39fa0a=_0xd943[_0x289f13];return _0x39fa0a;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'penalty':{'type':Sequelize[_0x3d94('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46e0=['INTEGER','sequelize','exports'];(function(_0x583e84,_0xda5b0c){var _0x3f8d93=function(_0x4579cb){while(--_0x4579cb){_0x583e84['push'](_0x583e84['shift']());}};_0x3f8d93(++_0xda5b0c);}(_0x46e0,0x1c3));var _0x046e=function(_0x54c27b,_0x2333f7){_0x54c27b=_0x54c27b-0x0;var _0x365557=_0x46e0[_0x54c27b];return _0x365557;};'use strict';var Sequelize=require(_0x046e('0x0'));module[_0x046e('0x1')]={'penalty':{'type':Sequelize[_0x046e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a148353..7e94739 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 _0xb5cb=['path','rimraf','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13fbbe,_0x255069){var _0x39fa58=function(_0x4406c0){while(--_0x4406c0){_0x13fbbe['push'](_0x13fbbe['shift']());}};_0x39fa58(++_0x255069);}(_0xb5cb,0x1cd));var _0xbb5c=function(_0x576757,_0x175ba6){_0x576757=_0x576757-0x0;var _0x7b4412=_0xb5cb[_0x576757];return _0x7b4412;};'use strict';var _=require(_0xbb5c('0x0'));var util=require(_0xbb5c('0x1'));var logger=require(_0xbb5c('0x2'))(_0xbb5c('0x3'));var moment=require(_0xbb5c('0x4'));var BPromise=require(_0xbb5c('0x5'));var rp=require(_0xbb5c('0x6'));var fs=require('fs');var path=require(_0xbb5c('0x7'));var rimraf=require(_0xbb5c('0x8'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xbb5c('0x9')]=function(_0x5c48db,_0x2942b7){return _0x5c48db[_0xbb5c('0xa')](_0xbb5c('0xb'),attributes,{'tableName':_0xbb5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76a4=['define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./userMailQueue.attributes'];(function(_0x4ce1ba,_0x436e9f){var _0x3b4ce7=function(_0x51fcac){while(--_0x51fcac){_0x4ce1ba['push'](_0x4ce1ba['shift']());}};_0x3b4ce7(++_0x436e9f);}(_0x76a4,0x107));var _0x476a=function(_0x42e07f,_0x393196){_0x42e07f=_0x42e07f-0x0;var _0x358915=_0x76a4[_0x42e07f];return _0x358915;};'use strict';var _=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var logger=require(_0x476a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x476a('0x3'));var rp=require(_0x476a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x476a('0x5'));var config=require('../../config/environment');var attributes=require(_0x476a('0x6'));module['exports']=function(_0x375c75,_0x44da77){return _0x375c75[_0x476a('0x7')](_0x476a('0x8'),attributes,{'tableName':_0x476a('0x9'),'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 e060a15..ddacea2 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d2821,_0x4f777f){var _0x791c2c=function(_0x7c3f15){while(--_0x7c3f15){_0x3d2821['push'](_0x3d2821['shift']());}};_0x791c2c(++_0x4f777f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x296f8d,_0x1f7a9a){_0x296f8d=_0x296f8d-0x0;var _0x19c6aa=_0x8ef6[_0x296f8d];return _0x19c6aa;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x291777,_0x4568cc){var _0x3e1f74=function(_0x108155){while(--_0x108155){_0x291777['push'](_0x291777['shift']());}};_0x3e1f74(++_0x4568cc);}(_0x3e74,0x175));var _0x43e7=function(_0x40f47c,_0x53db27){_0x40f47c=_0x40f47c-0x0;var _0x42b620=_0x3e74[_0x40f47c];return _0x42b620;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9e65e05..6f64818 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 _0x9c54=['../../components/interaction/service','post','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xfc8faf,_0x86244a){var _0x48c40b=function(_0x107c22){while(--_0x107c22){_0xfc8faf['push'](_0xfc8faf['shift']());}};_0x48c40b(++_0x86244a);}(_0x9c54,0x14a));var _0x49c5=function(_0x2d2236,_0xa04eee){_0x2d2236=_0x2d2236-0x0;var _0x7eb261=_0x9c54[_0x2d2236];return _0x7eb261;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c5('0x0'));var timeout=require(_0x49c5('0x1'));var express=require(_0x49c5('0x2'));var router=express[_0x49c5('0x3')]();var fs_extra=require(_0x49c5('0x4'));var auth=require(_0x49c5('0x5'));var interaction=require(_0x49c5('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x49c5('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x1d8f=['path','connect-timeout','express','../../components/auth/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x1d8f,0x1ed));var _0xf1d8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1d8f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xf1d8('0x0'));var util=require(_0xf1d8('0x1'));var path=require(_0xf1d8('0x2'));var timeout=require(_0xf1d8('0x3'));var express=require(_0xf1d8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1d8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf1d8('0x6'));var controller=require('./userNotification.controller');router[_0xf1d8('0x7')]('/',auth[_0xf1d8('0x8')](),controller[_0xf1d8('0x9')]);module[_0xf1d8('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ac10490..6a941f0 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 _0xf4dd=['STRING','TEXT','BOOLEAN','exports'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xf4dd,0x16f));var _0xdf4d=function(_0x3bd233,_0x2674d7){_0x3bd233=_0x3bd233-0x0;var _0x26c36a=_0xf4dd[_0x3bd233];return _0x26c36a;};'use strict';var Sequelize=require('sequelize');module[_0xdf4d('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xdf4d('0x1')]},'recipientsId':{'type':Sequelize[_0xdf4d('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdf4d('0x1')]},'beep':{'type':Sequelize[_0xdf4d('0x3')]}}; \ No newline at end of file +var _0xbd65=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xbd65,0xc6));var _0x5bd6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbd65[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x5bd6('0x0'));module[_0x5bd6('0x1')]={'body':{'type':Sequelize[_0x5bd6('0x2')]},'senderName':{'type':Sequelize[_0x5bd6('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x5bd6('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f9f0182..0045b6c 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 _0x977e=['ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Sequelize','Missing\x20\x27recipients\x27\x20parameter','recipients','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','transaction','UserNotification','forEach','recipient','userNotification:send','catch','Template','findOne','render','startCase','ids','queue','Queue','flatten','map','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv'];(function(_0x3c3a2e,_0x1c91a6){var _0x20bd91=function(_0x5f5bc0){while(--_0x5f5bc0){_0x3c3a2e['push'](_0x3c3a2e['shift']());}};_0x20bd91(++_0x1c91a6);}(_0x977e,0x1b0));var _0xe977=function(_0x376968,_0x13b18c){_0x376968=_0x376968-0x0;var _0x4249e6=_0x977e[_0x376968];return _0x4249e6;};'use strict';var emlformat=require(_0xe977('0x0'));var rimraf=require(_0xe977('0x1'));var zipdir=require(_0xe977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe977('0x3'));var moment=require('moment');var BPromise=require(_0xe977('0x4'));var Mustache=require(_0xe977('0x5'));var util=require('util');var path=require(_0xe977('0x6'));var sox=require('sox');var csv=require(_0xe977('0x7'));var ejs=require(_0xe977('0x8'));var fs=require('fs');var fs_extra=require(_0xe977('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe977('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe977('0xb'));var toCsv=require(_0xe977('0x7'));var querystring=require(_0xe977('0xc'));var Papa=require(_0xe977('0xd'));var Redis=require('ioredis');var authService=require(_0xe977('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe977('0xf'));var hardwareService=require(_0xe977('0x10'));var logger=require(_0xe977('0x11'))(_0xe977('0x12'));var utils=require('../../config/utils');var config=require(_0xe977('0x13'));var licenseUtil=require(_0xe977('0x14'));var db=require('../../mysqldb')['db'];config[_0xe977('0x15')]=_[_0xe977('0x16')](config['redis'],{'host':_0xe977('0x17'),'port':0x18eb});var socket=require(_0xe977('0x18'))(new Redis(config[_0xe977('0x15')]));require('./userNotification.socket')[_0xe977('0x19')](socket);function respondWithStatusCode(_0x4d9120,_0x2dd65b){_0x2dd65b=_0x2dd65b||0xcc;return function(_0x27fd54){if(_0x27fd54){return _0x4d9120[_0xe977('0x1a')](_0x2dd65b);}return _0x4d9120['status'](_0x2dd65b)[_0xe977('0x1b')]();};}function respondWithResult(_0x33d4ce,_0x12a884){_0x12a884=_0x12a884||0xc8;return function(_0x59c555){if(_0x59c555){return _0x33d4ce[_0xe977('0x1c')](_0x12a884)[_0xe977('0x1d')](_0x59c555);}};}function respondWithFilteredResult(_0x168602,_0x5e435f){return function(_0x4dd851){if(_0x4dd851){var _0x43f060=typeof _0x5e435f[_0xe977('0x1e')]===_0xe977('0x1f')&&typeof _0x5e435f[_0xe977('0x20')]===_0xe977('0x1f');var _0x343164=_0x4dd851[_0xe977('0x21')];var _0x32ec8f=_0x43f060?0x0:_0x5e435f[_0xe977('0x1e')];var _0x3b2054=_0x43f060?_0x4dd851['count']:_0x5e435f['offset']+_0x5e435f['limit'];var _0x50fe79;if(_0x3b2054>=_0x343164){_0x3b2054=_0x343164;_0x50fe79=0xc8;}else{_0x50fe79=0xce;}_0x168602['status'](_0x50fe79);return _0x168602[_0xe977('0x22')](_0xe977('0x23'),_0x32ec8f+'-'+_0x3b2054+'/'+_0x343164)[_0xe977('0x1d')](_0x4dd851);}return null;};}function patchUpdates(_0x2ecce2){return function(_0x4c499b){try{jsonpatch[_0xe977('0x24')](_0x4c499b,_0x2ecce2,!![]);}catch(_0x451ca1){return BPromise[_0xe977('0x25')](_0x451ca1);}return _0x4c499b[_0xe977('0x26')]();};}function saveUpdates(_0x26571f,_0xe4f2f0){return function(_0x366b1f){if(_0x366b1f){return _0x366b1f['update'](_0x26571f)[_0xe977('0x27')](function(_0x3e19f3){return _0x3e19f3;});}return null;};}function removeEntity(_0x57ac90,_0x1cd6c1){return function(_0x481177){if(_0x481177){return _0x481177['destroy']()[_0xe977('0x27')](function(){_0x57ac90[_0xe977('0x1c')](0xcc)[_0xe977('0x1b')]();});}};}function handleEntityNotFound(_0x14bb5e,_0x478870){return function(_0x251972){if(!_0x251972){_0x14bb5e[_0xe977('0x1a')](0x194);}return _0x251972;};}function handleError(_0x3caff7,_0x5b3e74){_0x5b3e74=_0x5b3e74||0x1f4;return function(_0x42c4af){logger[_0xe977('0x28')](_0x42c4af['stack']);if(_0x42c4af[_0xe977('0x29')]){delete _0x42c4af[_0xe977('0x29')];}_0x3caff7[_0xe977('0x1c')](_0x5b3e74)[_0xe977('0x2a')](_0x42c4af);};}exports['sendUserNotification']=function(_0x577058,_0x21b237,_0x270e2e){if(!_0x577058[_0xe977('0x2b')][_0xe977('0x2c')](_0xe977('0x2d'))&&!_0x577058[_0xe977('0x2b')]['hasOwnProperty'](_0xe977('0x2e'))){throw new db['Sequelize'][(_0xe977('0x2f'))](_0xe977('0x30'));}else{if(_0x577058['body'][_0xe977('0x2c')](_0xe977('0x2e'))&&!_0x577058['body'][_0xe977('0x2c')](_0xe977('0x31'))){throw new db['Sequelize'][(_0xe977('0x2f'))](_0xe977('0x32'));}if(!_0x577058['body'][_0xe977('0x2c')]('recipients')){throw new db[(_0xe977('0x33'))][(_0xe977('0x2f'))](_0xe977('0x34'));}else{try{var _0x519ec5=JSON['parse'](_0x577058[_0xe977('0x2b')][_0xe977('0x35')]);}catch(_0x4c5ebf){logger[_0xe977('0x28')](_0x4c5ebf);throw new db['Sequelize'][(_0xe977('0x2f'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x498df1=[_0xe977('0x36'),'faxqueue','mailqueue',_0xe977('0x37'),_0xe977('0x38'),_0xe977('0x39'),_0xe977('0x3a'),_0xe977('0x3b'),_0xe977('0x3c')];if(_[_0xe977('0x3d')](_0x519ec5,function(_0x1483c0){return!_[_0xe977('0x3e')](_0x498df1,_0x1483c0[_0xe977('0x3f')][_0xe977('0x40')]());})){throw new db['Sequelize'][(_0xe977('0x2f'))](_0xe977('0x41'));}}}var _0x1399f8={};_0x1399f8['senderName']=_0x577058[_0xe977('0x2b')][_0xe977('0x2c')](_0xe977('0x42'))?_0x577058[_0xe977('0x2b')][_0xe977('0x42')]:_0x577058[_0xe977('0x3c')][_0xe977('0x43')];_0x1399f8['recipientsDescription']=_[_0xe977('0x44')](_0x577058['body'][_0xe977('0x45')])?null:_0x577058[_0xe977('0x2b')][_0xe977('0x45')];_0x1399f8['beep']=_0x577058['body'][_0xe977('0x46')]||![];_0x1399f8[_0xe977('0x47')]=_0x577058['user']['id'];return getContent(_0x577058[_0xe977('0x2b')])['then'](function(_0x4936b4){_0x1399f8[_0xe977('0x2b')]=_0x4936b4;return getRecipients(_0x519ec5);})['then'](function(_0x2af828){_0x1399f8[_0xe977('0x48')]=_['sortBy'](_0x2af828)['join'](',');return db['sequelize'][_0xe977('0x49')](function(_0x2108eb){return db[_0xe977('0x4a')]['create'](_0x1399f8,{'raw':!![],'transaction':_0x2108eb})['then'](function(_0x270cd1){var _0x5b908c={'sender':_0x1399f8['senderName'],'description':_0x1399f8[_0xe977('0x45')],'content':_0x1399f8[_0xe977('0x2b')],'beep':_0x1399f8[_0xe977('0x46')]};_0x2af828[_0xe977('0x4b')](function(_0x338f3f){_0x5b908c[_0xe977('0x4c')]=_0x338f3f;socket['emit'](_0xe977('0x4d'),_0x5b908c);});return _0x270cd1;});});})[_0xe977('0x27')](respondWithResult(_0x21b237,0xc9))[_0xe977('0x4e')](handleError(_0x21b237,null));};function getContent(_0x52618f){return new BPromise(function(_0x510c84,_0x135724){if(_0x52618f[_0xe977('0x2d')]){_0x510c84(_0x52618f[_0xe977('0x2d')]);return;}return db[_0xe977('0x4f')][_0xe977('0x50')]({'attributes':['html'],'where':{'id':_0x52618f[_0xe977('0x2e')]},'raw':!![]})[_0xe977('0x27')](function(_0x16195d){if(!_0x16195d)throw new db[(_0xe977('0x33'))][(_0xe977('0x2f'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x514768=Mustache[_0xe977('0x51')](_0x16195d['html'],_0x52618f['view']);_0x510c84(_0x514768);})['catch'](function(_0x1a0b7e){_0x135724(_0x1a0b7e);});});}function getRecipients(_0x3ea847){return new BPromise(function(_0x25d326,_0x468f32){var _0x413ea8=[];var _0x1f3eb9=[];_0x3ea847[_0xe977('0x4b')](function(_0xae1dcb){var _0x1ec40e=_[_0xe977('0x52')](_0xae1dcb[_0xe977('0x3f')][_0xe977('0x40')]());if(_0x1ec40e==='User'){_0x413ea8=_['union'](_0x413ea8,_0xae1dcb[_0xe977('0x53')]);}else{if(_[_0xe977('0x3e')](_0x1ec40e,'queue'))_0x1ec40e=_0x1ec40e['replace'](_0xe977('0x54'),_0xe977('0x55'));_0xae1dcb[_0xe977('0x53')]['forEach'](function(_0x21d868){_0x1f3eb9['push'](getAgents(_0x1ec40e,_0x21d868));});}});return BPromise['all'](_0x1f3eb9)['then'](function(_0x3c6910){_0x413ea8=_['union'](_0x413ea8,_[_0xe977('0x56')](_0x3c6910));_0x25d326(_0x413ea8);})[_0xe977('0x4e')](function(_0xb37e53){_0x468f32(_0xb37e53);});});}function getAgents(_0x43fd49,_0x5535ca){return new BPromise(function(_0x250cfd,_0x41535e){return db[_0x43fd49][_0xe977('0x50')]({'where':{'id':_0x5535ca}})[_0xe977('0x27')](function(_0x487314){return _0x487314['getAgents']({'attributes':['id'],'raw':!![]})[_0xe977('0x27')](function(_0x182e66){var _0x1f02f0=_[_0xe977('0x57')](_0x182e66,'id');_0x250cfd(_0x1f02f0);});})[_0xe977('0x4e')](function(_0x1bef02){_0x41535e(_0x1bef02);});});} \ No newline at end of file +var _0xc47e=['./userNotification.socket','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','UserNotification','create','forEach','emit','userNotification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','toLowerCase','User','queue','replace','Queue','ids','all','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x4af8e1,_0xff0618){var _0x22f628=function(_0x5e099c){while(--_0x5e099c){_0x4af8e1['push'](_0x4af8e1['shift']());}};_0x22f628(++_0xff0618);}(_0xc47e,0x198));var _0xec47=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xc47e[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0xec47('0x0'));var rimraf=require(_0xec47('0x1'));var zipdir=require(_0xec47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec47('0x3'));var util=require('util');var path=require(_0xec47('0x4'));var sox=require(_0xec47('0x5'));var csv=require(_0xec47('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec47('0x7'));var _=require(_0xec47('0x8'));var squel=require(_0xec47('0x9'));var crypto=require(_0xec47('0xa'));var jsforce=require(_0xec47('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xec47('0x6'));var querystring=require(_0xec47('0xc'));var Papa=require(_0xec47('0xd'));var Redis=require(_0xec47('0xe'));var authService=require(_0xec47('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xec47('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec47('0x11'));var db=require(_0xec47('0x12'))['db'];config[_0xec47('0x13')]=_[_0xec47('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec47('0x15'))(new Redis(config['redis']));require(_0xec47('0x16'))[_0xec47('0x17')](socket);function respondWithStatusCode(_0x409605,_0xdacfb1){_0xdacfb1=_0xdacfb1||0xcc;return function(_0x347e57){if(_0x347e57){return _0x409605['sendStatus'](_0xdacfb1);}return _0x409605[_0xec47('0x18')](_0xdacfb1)[_0xec47('0x19')]();};}function respondWithResult(_0x4f9012,_0x2ab34f){_0x2ab34f=_0x2ab34f||0xc8;return function(_0x30512e){if(_0x30512e){return _0x4f9012[_0xec47('0x18')](_0x2ab34f)[_0xec47('0x1a')](_0x30512e);}};}function respondWithFilteredResult(_0x656757,_0x1dc9f7){return function(_0x396aa2){if(_0x396aa2){var _0x3ffecc=typeof _0x1dc9f7[_0xec47('0x1b')]===_0xec47('0x1c')&&typeof _0x1dc9f7['limit']==='undefined';var _0x42fcf0=_0x396aa2[_0xec47('0x1d')];var _0xd2bc4b=_0x3ffecc?0x0:_0x1dc9f7[_0xec47('0x1b')];var _0x4cc6e1=_0x3ffecc?_0x396aa2[_0xec47('0x1d')]:_0x1dc9f7[_0xec47('0x1b')]+_0x1dc9f7[_0xec47('0x1e')];var _0x1aabf9;if(_0x4cc6e1>=_0x42fcf0){_0x4cc6e1=_0x42fcf0;_0x1aabf9=0xc8;}else{_0x1aabf9=0xce;}_0x656757[_0xec47('0x18')](_0x1aabf9);return _0x656757[_0xec47('0x1f')]('Content-Range',_0xd2bc4b+'-'+_0x4cc6e1+'/'+_0x42fcf0)['json'](_0x396aa2);}return null;};}function patchUpdates(_0x451ebd){return function(_0x5d1b39){try{jsonpatch[_0xec47('0x20')](_0x5d1b39,_0x451ebd,!![]);}catch(_0x31fea4){return BPromise['reject'](_0x31fea4);}return _0x5d1b39[_0xec47('0x21')]();};}function saveUpdates(_0x59b5d5,_0x407ab8){return function(_0x3fd907){if(_0x3fd907){return _0x3fd907[_0xec47('0x22')](_0x59b5d5)[_0xec47('0x23')](function(_0x55a594){return _0x55a594;});}return null;};}function removeEntity(_0x5ac48a,_0x3492ae){return function(_0x365a52){if(_0x365a52){return _0x365a52[_0xec47('0x24')]()[_0xec47('0x23')](function(){_0x5ac48a[_0xec47('0x18')](0xcc)[_0xec47('0x19')]();});}};}function handleEntityNotFound(_0xa6e2c8,_0x3c45b5){return function(_0x1c0a74){if(!_0x1c0a74){_0xa6e2c8[_0xec47('0x25')](0x194);}return _0x1c0a74;};}function handleError(_0x2e0080,_0x21175a){_0x21175a=_0x21175a||0x1f4;return function(_0x4e6f7d){logger[_0xec47('0x26')](_0x4e6f7d[_0xec47('0x27')]);if(_0x4e6f7d[_0xec47('0x28')]){delete _0x4e6f7d[_0xec47('0x28')];}_0x2e0080[_0xec47('0x18')](_0x21175a)[_0xec47('0x29')](_0x4e6f7d);};}exports['sendUserNotification']=function(_0x580614,_0x41c495,_0x4c9d22){if(!_0x580614[_0xec47('0x2a')][_0xec47('0x2b')](_0xec47('0x2c'))&&!_0x580614[_0xec47('0x2a')][_0xec47('0x2b')](_0xec47('0x2d'))){throw new db[(_0xec47('0x2e'))][(_0xec47('0x2f'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x580614[_0xec47('0x2a')][_0xec47('0x2b')](_0xec47('0x2d'))&&!_0x580614[_0xec47('0x2a')][_0xec47('0x2b')](_0xec47('0x30'))){throw new db[(_0xec47('0x2e'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x580614[_0xec47('0x2a')][_0xec47('0x2b')](_0xec47('0x31'))){throw new db[(_0xec47('0x2e'))][(_0xec47('0x2f'))](_0xec47('0x32'));}else{try{var _0x49ca3c=JSON[_0xec47('0x33')](_0x580614[_0xec47('0x2a')][_0xec47('0x31')]);}catch(_0x31e2a1){logger[_0xec47('0x26')](_0x31e2a1);throw new db[(_0xec47('0x2e'))]['ValidationError'](_0xec47('0x34'));}var _0x6bd110=[_0xec47('0x35'),'faxqueue','mailqueue',_0xec47('0x36'),'smsqueue','voicequeue','whatsappqueue','team',_0xec47('0x37')];if(_['some'](_0x49ca3c,function(_0x1d8849){return!_[_0xec47('0x38')](_0x6bd110,_0x1d8849[_0xec47('0x39')]['toLowerCase']());})){throw new db[(_0xec47('0x2e'))]['ValidationError'](_0xec47('0x3a'));}}}var _0x27e3c5={};_0x27e3c5[_0xec47('0x3b')]=_0x580614['body'][_0xec47('0x2b')](_0xec47('0x3b'))?_0x580614[_0xec47('0x2a')][_0xec47('0x3b')]:_0x580614[_0xec47('0x37')][_0xec47('0x3c')];_0x27e3c5[_0xec47('0x3d')]=_[_0xec47('0x3e')](_0x580614['body'][_0xec47('0x3d')])?null:_0x580614[_0xec47('0x2a')]['recipientsDescription'];_0x27e3c5[_0xec47('0x3f')]=_0x580614[_0xec47('0x2a')]['beep']||![];_0x27e3c5[_0xec47('0x40')]=_0x580614[_0xec47('0x37')]['id'];return getContent(_0x580614[_0xec47('0x2a')])['then'](function(_0x197763){_0x27e3c5['body']=_0x197763;return getRecipients(_0x49ca3c);})[_0xec47('0x23')](function(_0x1be470){_0x27e3c5[_0xec47('0x41')]=_[_0xec47('0x42')](_0x1be470)['join'](',');return db[_0xec47('0x43')]['transaction'](function(_0x38024a){return db[_0xec47('0x44')][_0xec47('0x45')](_0x27e3c5,{'raw':!![],'transaction':_0x38024a})[_0xec47('0x23')](function(_0xd921de){var _0x962d13={'sender':_0x27e3c5[_0xec47('0x3b')],'description':_0x27e3c5[_0xec47('0x3d')],'content':_0x27e3c5[_0xec47('0x2a')],'beep':_0x27e3c5[_0xec47('0x3f')]};_0x1be470[_0xec47('0x46')](function(_0x401335){_0x962d13['recipient']=_0x401335;socket[_0xec47('0x47')](_0xec47('0x48'),_0x962d13);});return _0xd921de;});});})['then'](respondWithResult(_0x41c495,0xc9))[_0xec47('0x49')](handleError(_0x41c495,null));};function getContent(_0x1b12d){return new BPromise(function(_0x452f27,_0xaa685e){if(_0x1b12d['text']){_0x452f27(_0x1b12d['text']);return;}return db['Template'][_0xec47('0x4a')]({'attributes':['html'],'where':{'id':_0x1b12d['TemplateId']},'raw':!![]})['then'](function(_0xe17ce8){if(!_0xe17ce8)throw new db[(_0xec47('0x2e'))][(_0xec47('0x2f'))](_0xec47('0x4b'));var _0x16a779=Mustache[_0xec47('0x4c')](_0xe17ce8[_0xec47('0x4d')],_0x1b12d[_0xec47('0x30')]);_0x452f27(_0x16a779);})[_0xec47('0x49')](function(_0x290cf7){_0xaa685e(_0x290cf7);});});}function getRecipients(_0x47671e){return new BPromise(function(_0x3727ec,_0x102588){var _0x571ef9=[];var _0x53d87b=[];_0x47671e[_0xec47('0x46')](function(_0x39f267){var _0x317396=_[_0xec47('0x4e')](_0x39f267[_0xec47('0x39')][_0xec47('0x4f')]());if(_0x317396===_0xec47('0x50')){_0x571ef9=_['union'](_0x571ef9,_0x39f267['ids']);}else{if(_['includes'](_0x317396,_0xec47('0x51')))_0x317396=_0x317396[_0xec47('0x52')](_0xec47('0x51'),_0xec47('0x53'));_0x39f267[_0xec47('0x54')]['forEach'](function(_0x4badc3){_0x53d87b['push'](getAgents(_0x317396,_0x4badc3));});}});return BPromise[_0xec47('0x55')](_0x53d87b)[_0xec47('0x23')](function(_0x1ed6df){_0x571ef9=_['union'](_0x571ef9,_['flatten'](_0x1ed6df));_0x3727ec(_0x571ef9);})['catch'](function(_0x4210a7){_0x102588(_0x4210a7);});});}function getAgents(_0x32cdb5,_0x5c8102){return new BPromise(function(_0x3f0bff,_0xedca0e){return db[_0x32cdb5]['findOne']({'where':{'id':_0x5c8102}})[_0xec47('0x23')](function(_0x103994){return _0x103994['getAgents']({'attributes':['id'],'raw':!![]})[_0xec47('0x23')](function(_0x1c6e98){var _0x1548b3=_['map'](_0x1c6e98,'id');_0x3f0bff(_0x1548b3);});})[_0xec47('0x49')](function(_0x39e04f){_0xedca0e(_0x39e04f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 31da891..cc63377 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 _0x67ca=['save','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x3ec6b3,_0x6619b2){var _0x5cf6c4=function(_0x28358c){while(--_0x28358c){_0x3ec6b3['push'](_0x3ec6b3['shift']());}};_0x5cf6c4(++_0x6619b2);}(_0x67ca,0x1ac));var _0xa67c=function(_0x1f4c73,_0x5b8b94){_0x1f4c73=_0x1f4c73-0x0;var _0xb812a8=_0x67ca[_0x1f4c73];return _0xb812a8;};'use strict';var EventEmitter=require(_0xa67c('0x0'));var UserNotification=require(_0xa67c('0x1'))['db'][_0xa67c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa67c('0x3')](0x0);var events={'afterCreate':_0xa67c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21100b){return function(_0x55a3c4,_0x1e799f,_0x5d6b17){UserNotificationEvents[_0xa67c('0x5')](_0x21100b+':'+_0x55a3c4['id'],_0x55a3c4);UserNotificationEvents['emit'](_0x21100b,_0x55a3c4);_0x5d6b17(null);};}for(var e in events){if(events[_0xa67c('0x6')](e)){var event=events[e];UserNotification[_0xa67c('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x210f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','UserNotification'];(function(_0x527536,_0x192f94){var _0x11f19d=function(_0x53c6c0){while(--_0x53c6c0){_0x527536['push'](_0x527536['shift']());}};_0x11f19d(++_0x192f94);}(_0x210f,0x1c0));var _0xf210=function(_0x1f19a3,_0x41ee9a){_0x1f19a3=_0x1f19a3-0x0;var _0x5765a1=_0x210f[_0x1f19a3];return _0x5765a1;};'use strict';var EventEmitter=require(_0xf210('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xf210('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf210('0x2')](0x0);var events={'afterCreate':_0xf210('0x3'),'afterUpdate':_0xf210('0x4'),'afterDestroy':_0xf210('0x5')};function emitEvent(_0x369047){return function(_0x3da874,_0x58e14a,_0x50df62){UserNotificationEvents[_0xf210('0x6')](_0x369047+':'+_0x3da874['id'],_0x3da874);UserNotificationEvents['emit'](_0x369047,_0x3da874);_0x50df62(null);};}for(var e in events){if(events[_0xf210('0x7')](e)){var event=events[e];UserNotification[_0xf210('0x8')](e,emitEvent(event));}}module[_0xf210('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 c8dbe73..1057826 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 _0x623f=['../../config/logger','bluebird','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0x623f,0x16a));var _0xf623=function(_0x1291f4,_0xb21792){_0x1291f4=_0x1291f4-0x0;var _0x40f568=_0x623f[_0x1291f4];return _0x40f568;};'use strict';var _=require(_0xf623('0x0'));var util=require(_0xf623('0x1'));var logger=require(_0xf623('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf623('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf623('0x4'));var rimraf=require(_0xf623('0x5'));var config=require('../../config/environment');var attributes=require(_0xf623('0x6'));module[_0xf623('0x7')]=function(_0xa14ead,_0x48758e){return _0xa14ead[_0xf623('0x8')](_0xf623('0x9'),attributes,{'tableName':_0xf623('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf623('0xb'),'collate':_0xf623('0xc')});}; \ No newline at end of file +var _0x39e6=['../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3bd827,_0x5acf5c){var _0x47271f=function(_0x23aa20){while(--_0x23aa20){_0x3bd827['push'](_0x3bd827['shift']());}};_0x47271f(++_0x5acf5c);}(_0x39e6,0xf5));var _0x639e=function(_0xf613fc,_0x496d11){_0xf613fc=_0xf613fc-0x0;var _0x3b6abd=_0x39e6[_0xf613fc];return _0x3b6abd;};'use strict';var _=require(_0x639e('0x0'));var util=require(_0x639e('0x1'));var logger=require(_0x639e('0x2'))(_0x639e('0x3'));var moment=require('moment');var BPromise=require(_0x639e('0x4'));var rp=require(_0x639e('0x5'));var fs=require('fs');var path=require(_0x639e('0x6'));var rimraf=require('rimraf');var config=require(_0x639e('0x7'));var attributes=require(_0x639e('0x8'));module[_0x639e('0x9')]=function(_0x46b3e9,_0x5b0f1e){return _0x46b3e9[_0x639e('0xa')]('UserNotification',attributes,{'tableName':_0x639e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x639e('0xc'),'collate':_0x639e('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 83e011c..1a183e7 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 _0xa628=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0xa628,0x9c));var _0x8a62=function(_0x6e51f1,_0x11371a){_0x6e51f1=_0x6e51f1-0x0;var _0x141b4c=_0xa628[_0x6e51f1];return _0x141b4c;};'use strict';var _=require(_0x8a62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a62('0x1'));var rs=require(_0x8a62('0x2'));var fs=require('fs');var Redis=require(_0x8a62('0x3'));var db=require(_0x8a62('0x4'))['db'];var utils=require(_0x8a62('0x5'));var logger=require(_0x8a62('0x6'))(_0x8a62('0x7'));var config=require(_0x8a62('0x8'));var jayson=require(_0x8a62('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8a62('0xa')]=_[_0x8a62('0xb')](config[_0x8a62('0xa')],{'host':_0x8a62('0xc'),'port':0x18eb});var socket=require(_0x8a62('0xd'))(new Redis(config[_0x8a62('0xa')]));require(_0x8a62('0xe'))[_0x8a62('0xf')](socket);function respondWithRpcPromise(_0x416d49,_0x4ef1ad,_0x2ca30f){return new BPromise(function(_0x59863e,_0x1279ed){return client['request'](_0x416d49,_0x2ca30f)[_0x8a62('0x10')](function(_0x3b0550){logger['info'](_0x8a62('0x11'),_0x4ef1ad,_0x8a62('0x12'));logger[_0x8a62('0x13')](_0x8a62('0x14'),_0x4ef1ad,_0x8a62('0x12'),JSON['stringify'](_0x3b0550));if(_0x3b0550[_0x8a62('0x15')]){if(_0x3b0550[_0x8a62('0x15')][_0x8a62('0x16')]===0x1f4){logger[_0x8a62('0x15')](_0x8a62('0x11'),_0x4ef1ad,_0x3b0550[_0x8a62('0x15')][_0x8a62('0x17')]);return _0x1279ed(_0x3b0550[_0x8a62('0x15')][_0x8a62('0x17')]);}logger['error'](_0x8a62('0x11'),_0x4ef1ad,_0x3b0550[_0x8a62('0x15')][_0x8a62('0x17')]);return _0x59863e(_0x3b0550['error'][_0x8a62('0x17')]);}else{logger[_0x8a62('0x18')](_0x8a62('0x11'),_0x4ef1ad,'request\x20sent');_0x59863e(_0x3b0550[_0x8a62('0x19')][_0x8a62('0x17')]);}})[_0x8a62('0x1a')](function(_0x41b886){logger['error'](_0x8a62('0x11'),_0x4ef1ad,_0x41b886);_0x1279ed(_0x41b886);});});} \ No newline at end of file +var _0x8f0e=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error'];(function(_0x5cf3d7,_0x26611b){var _0x318db5=function(_0x18bc6a){while(--_0x18bc6a){_0x5cf3d7['push'](_0x5cf3d7['shift']());}};_0x318db5(++_0x26611b);}(_0x8f0e,0x16f));var _0xe8f0=function(_0x3c513d,_0x239f98){_0x3c513d=_0x3c513d-0x0;var _0x418f20=_0x8f0e[_0x3c513d];return _0x418f20;};'use strict';var _=require(_0xe8f0('0x0'));var util=require(_0xe8f0('0x1'));var moment=require(_0xe8f0('0x2'));var BPromise=require(_0xe8f0('0x3'));var rs=require(_0xe8f0('0x4'));var fs=require('fs');var Redis=require(_0xe8f0('0x5'));var db=require(_0xe8f0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe8f0('0x7'));var config=require(_0xe8f0('0x8'));var jayson=require(_0xe8f0('0x9'));var client=jayson['client'][_0xe8f0('0xa')]({'port':0x232a});config[_0xe8f0('0xb')]=_[_0xe8f0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8f0('0xd'))(new Redis(config[_0xe8f0('0xb')]));require(_0xe8f0('0xe'))[_0xe8f0('0xf')](socket);function respondWithRpcPromise(_0x58f7ff,_0x3fdfad,_0x5791d0){return new BPromise(function(_0x52dc5e,_0x512955){return client['request'](_0x58f7ff,_0x5791d0)[_0xe8f0('0x10')](function(_0x19f3f2){logger[_0xe8f0('0x11')](_0xe8f0('0x12'),_0x3fdfad,_0xe8f0('0x13'));logger[_0xe8f0('0x14')](_0xe8f0('0x15'),_0x3fdfad,'request\x20sent',JSON['stringify'](_0x19f3f2));if(_0x19f3f2[_0xe8f0('0x16')]){if(_0x19f3f2[_0xe8f0('0x16')][_0xe8f0('0x17')]===0x1f4){logger[_0xe8f0('0x16')](_0xe8f0('0x12'),_0x3fdfad,_0x19f3f2[_0xe8f0('0x16')][_0xe8f0('0x18')]);return _0x512955(_0x19f3f2[_0xe8f0('0x16')][_0xe8f0('0x18')]);}logger[_0xe8f0('0x16')](_0xe8f0('0x12'),_0x3fdfad,_0x19f3f2['error'][_0xe8f0('0x18')]);return _0x52dc5e(_0x19f3f2[_0xe8f0('0x16')]['message']);}else{logger[_0xe8f0('0x11')](_0xe8f0('0x12'),_0x3fdfad,_0xe8f0('0x13'));_0x52dc5e(_0x19f3f2[_0xe8f0('0x19')][_0xe8f0('0x18')]);}})['catch'](function(_0x5babe9){logger[_0xe8f0('0x16')](_0xe8f0('0x12'),_0x3fdfad,_0x5babe9);_0x512955(_0x5babe9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 168aa5f..7cf376d 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 _0x66e6=['length','./userNotification.events','remove','update','removeListener','register'];(function(_0x26a9dd,_0x22505e){var _0x907423=function(_0x383920){while(--_0x383920){_0x26a9dd['push'](_0x26a9dd['shift']());}};_0x907423(++_0x22505e);}(_0x66e6,0xb5));var _0x666e=function(_0x370bf0,_0x2ce146){_0x370bf0=_0x370bf0-0x0;var _0x1c9ff2=_0x66e6[_0x370bf0];return _0x1c9ff2;};'use strict';var UserNotificationEvents=require(_0x666e('0x0'));var events=['save',_0x666e('0x1'),_0x666e('0x2')];function createListener(_0x2e9bcc,_0x88ed12){return function(_0x470c56){_0x88ed12['emit'](_0x2e9bcc,_0x470c56);};}function removeListener(_0x4bb665,_0x557ad2){return function(){UserNotificationEvents[_0x666e('0x3')](_0x4bb665,_0x557ad2);};}exports[_0x666e('0x4')]=function(_0x5b230e){for(var _0x1eeeee=0x0,_0x269154=events[_0x666e('0x5')];_0x1eeeee<_0x269154;_0x1eeeee++){var _0x56a6be=events[_0x1eeeee];var _0x54d4f7=createListener('userNotification:'+_0x56a6be,_0x5b230e);UserNotificationEvents['on'](_0x56a6be,_0x54d4f7);}}; \ No newline at end of file +var _0xa8c7=['removeListener','register','length','userNotification:','./userNotification.events','save','remove','update'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xa8c7,0x184));var _0x7a8c=function(_0x24502c,_0x147fb1){_0x24502c=_0x24502c-0x0;var _0x549866=_0xa8c7[_0x24502c];return _0x549866;};'use strict';var UserNotificationEvents=require(_0x7a8c('0x0'));var events=[_0x7a8c('0x1'),_0x7a8c('0x2'),_0x7a8c('0x3')];function createListener(_0x44642c,_0x5d7ac8){return function(_0xc9a470){_0x5d7ac8['emit'](_0x44642c,_0xc9a470);};}function removeListener(_0x1cc684,_0x344335){return function(){UserNotificationEvents[_0x7a8c('0x4')](_0x1cc684,_0x344335);};}exports[_0x7a8c('0x5')]=function(_0x40c7d4){for(var _0x4103f8=0x0,_0x37c55a=events[_0x7a8c('0x6')];_0x4103f8<_0x37c55a;_0x4103f8++){var _0x2b760b=events[_0x4103f8];var _0x583a43=createListener(_0x7a8c('0x7')+_0x2b760b,_0x40c7d4);UserNotificationEvents['on'](_0x2b760b,_0x583a43);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4c7ade6..778cd44 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(_0x2b5c60,_0xddad37){var _0x40ef50=function(_0x103b03){while(--_0x103b03){_0x2b5c60['push'](_0x2b5c60['shift']());}};_0x40ef50(++_0xddad37);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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(_0x913c1d,_0x2afb77){var _0x4c15f9=function(_0x2e7cda){while(--_0x2e7cda){_0x913c1d['push'](_0x913c1d['shift']());}};_0x4c15f9(++_0x2afb77);}(_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'));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 7899ce7..83b16b3 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 _0x4e6c=['sequelize','exports','INTEGER'];(function(_0x343b35,_0xe7c1f9){var _0x26db79=function(_0x4bc0c8){while(--_0x4bc0c8){_0x343b35['push'](_0x343b35['shift']());}};_0x26db79(++_0xe7c1f9);}(_0x4e6c,0x8d));var _0xc4e6=function(_0x30a30e,_0x4ac764){_0x30a30e=_0x30a30e-0x0;var _0x3d25c3=_0x4e6c[_0x30a30e];return _0x3d25c3;};'use strict';var Sequelize=require(_0xc4e6('0x0'));module[_0xc4e6('0x1')]={'penalty':{'type':Sequelize[_0xc4e6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd5d=['sequelize','exports','INTEGER'];(function(_0x51265e,_0x204fb3){var _0x503405=function(_0x4e4cd8){while(--_0x4e4cd8){_0x51265e['push'](_0x51265e['shift']());}};_0x503405(++_0x204fb3);}(_0xdd5d,0xd5));var _0xddd5=function(_0x43cc0d,_0x5f2e7d){_0x43cc0d=_0x43cc0d-0x0;var _0x22fc29=_0xdd5d[_0x43cc0d];return _0x22fc29;};'use strict';var Sequelize=require(_0xddd5('0x0'));module[_0xddd5('0x1')]={'penalty':{'type':Sequelize[_0xddd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4a686eb..9e5adc3 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 _0x613c=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x613c,0xc1));var _0xc613=function(_0x463032,_0xcd7a34){_0x463032=_0x463032-0x0;var _0x2a7932=_0x613c[_0x463032];return _0x2a7932;};'use strict';var _=require(_0xc613('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc613('0x1'));var moment=require(_0xc613('0x2'));var BPromise=require(_0xc613('0x3'));var rp=require(_0xc613('0x4'));var fs=require('fs');var path=require(_0xc613('0x5'));var rimraf=require(_0xc613('0x6'));var config=require(_0xc613('0x7'));var attributes=require(_0xc613('0x8'));module[_0xc613('0x9')]=function(_0x3761ec,_0x1bf5f8){return _0x3761ec['define']('UserOpenchannelQueue',attributes,{'tableName':_0xc613('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b75=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x3e0709,_0x3e427b){var _0x9ed3b4=function(_0x45e864){while(--_0x45e864){_0x3e0709['push'](_0x3e0709['shift']());}};_0x9ed3b4(++_0x3e427b);}(_0x7b75,0x123));var _0x57b7=function(_0x1f2bd7,_0x26a4b6){_0x1f2bd7=_0x1f2bd7-0x0;var _0x56232d=_0x7b75[_0x1f2bd7];return _0x56232d;};'use strict';var _=require(_0x57b7('0x0'));var util=require(_0x57b7('0x1'));var logger=require(_0x57b7('0x2'))(_0x57b7('0x3'));var moment=require(_0x57b7('0x4'));var BPromise=require(_0x57b7('0x5'));var rp=require(_0x57b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57b7('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x57b7('0x8')]=function(_0x471d3d,_0x3666dc){return _0x471d3d['define']('UserOpenchannelQueue',attributes,{'tableName':_0x57b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index eb43bdc..3afa813 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 _0x50c0=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x50c0,0xd0));var _0x050c=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x50c0[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x050c('0x0'));var util=require('util');var moment=require(_0x050c('0x1'));var BPromise=require(_0x050c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x050c('0x3'));var db=require(_0x050c('0x4'))['db'];var utils=require(_0x050c('0x5'));var logger=require(_0x050c('0x6'))(_0x050c('0x7'));var config=require(_0x050c('0x8'));var jayson=require(_0x050c('0x9'));var client=jayson[_0x050c('0xa')][_0x050c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e38eb,_0x28954b,_0x33995f){return new BPromise(function(_0x1ceb64,_0x5bb9e9){return client[_0x050c('0xc')](_0x5e38eb,_0x33995f)['then'](function(_0xa93feb){logger[_0x050c('0xd')](_0x050c('0xe'),_0x28954b,'request\x20sent');logger[_0x050c('0xf')](_0x050c('0x10'),_0x28954b,_0x050c('0x11'),JSON[_0x050c('0x12')](_0xa93feb));if(_0xa93feb[_0x050c('0x13')]){if(_0xa93feb[_0x050c('0x13')]['code']===0x1f4){logger[_0x050c('0x13')](_0x050c('0xe'),_0x28954b,_0xa93feb[_0x050c('0x13')][_0x050c('0x14')]);return _0x5bb9e9(_0xa93feb[_0x050c('0x13')]['message']);}logger[_0x050c('0x13')](_0x050c('0xe'),_0x28954b,_0xa93feb['error'][_0x050c('0x14')]);return _0x1ceb64(_0xa93feb[_0x050c('0x13')]['message']);}else{logger[_0x050c('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x28954b,'request\x20sent');_0x1ceb64(_0xa93feb[_0x050c('0x15')][_0x050c('0x14')]);}})[_0x050c('0x16')](function(_0x5d1033){logger[_0x050c('0x13')](_0x050c('0xe'),_0x28954b,_0x5d1033);_0x5bb9e9(_0x5d1033);});});} \ No newline at end of file +var _0xc89c=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2d1db5,_0x7455eb){var _0x228e0d=function(_0xc56459){while(--_0xc56459){_0x2d1db5['push'](_0x2d1db5['shift']());}};_0x228e0d(++_0x7455eb);}(_0xc89c,0xd8));var _0xcc89=function(_0x14bcbe,_0x9e97b5){_0x14bcbe=_0x14bcbe-0x0;var _0x23edc1=_0xc89c[_0x14bcbe];return _0x23edc1;};'use strict';var _=require(_0xcc89('0x0'));var util=require(_0xcc89('0x1'));var moment=require(_0xcc89('0x2'));var BPromise=require(_0xcc89('0x3'));var rs=require(_0xcc89('0x4'));var fs=require('fs');var Redis=require(_0xcc89('0x5'));var db=require(_0xcc89('0x6'))['db'];var utils=require(_0xcc89('0x7'));var logger=require(_0xcc89('0x8'))(_0xcc89('0x9'));var config=require(_0xcc89('0xa'));var jayson=require(_0xcc89('0xb'));var client=jayson[_0xcc89('0xc')][_0xcc89('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xae2612,_0x305d49,_0x1d283f){return new BPromise(function(_0xd7504d,_0x1e3757){return client[_0xcc89('0xe')](_0xae2612,_0x1d283f)[_0xcc89('0xf')](function(_0x50bebb){logger['info'](_0xcc89('0x10'),_0x305d49,_0xcc89('0x11'));logger['debug'](_0xcc89('0x12'),_0x305d49,_0xcc89('0x11'),JSON[_0xcc89('0x13')](_0x50bebb));if(_0x50bebb[_0xcc89('0x14')]){if(_0x50bebb[_0xcc89('0x14')][_0xcc89('0x15')]===0x1f4){logger[_0xcc89('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x305d49,_0x50bebb[_0xcc89('0x14')]['message']);return _0x1e3757(_0x50bebb['error'][_0xcc89('0x16')]);}logger[_0xcc89('0x14')](_0xcc89('0x10'),_0x305d49,_0x50bebb[_0xcc89('0x14')][_0xcc89('0x16')]);return _0xd7504d(_0x50bebb[_0xcc89('0x14')][_0xcc89('0x16')]);}else{logger[_0xcc89('0x17')](_0xcc89('0x10'),_0x305d49,_0xcc89('0x11'));_0xd7504d(_0x50bebb[_0xcc89('0x18')][_0xcc89('0x16')]);}})[_0xcc89('0x19')](function(_0x356b4f){logger[_0xcc89('0x14')](_0xcc89('0x10'),_0x305d49,_0x356b4f);_0x1e3757(_0x356b4f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e77e98a..2950a17 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 _0x7aaa=['get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','/:id/clone','clone','addSections','post','destroy','delete','removeSections','removeResources','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller'];(function(_0x10a6db,_0x42b766){var _0x5a1ee2=function(_0x30cf98){while(--_0x30cf98){_0x10a6db['push'](_0x10a6db['shift']());}};_0x5a1ee2(++_0x42b766);}(_0x7aaa,0x164));var _0xa7aa=function(_0x36a94f,_0x3fcc6c){_0x36a94f=_0x36a94f-0x0;var _0x4ba69f=_0x7aaa[_0x36a94f];return _0x4ba69f;};'use strict';var multer=require(_0xa7aa('0x0'));var util=require('util');var path=require(_0xa7aa('0x1'));var timeout=require(_0xa7aa('0x2'));var express=require(_0xa7aa('0x3'));var router=express['Router']();var fs_extra=require(_0xa7aa('0x4'));var auth=require(_0xa7aa('0x5'));var interaction=require(_0xa7aa('0x6'));var config=require('../../config/environment');var controller=require(_0xa7aa('0x7'));router[_0xa7aa('0x8')]('/',auth[_0xa7aa('0x9')](),controller[_0xa7aa('0xa')]);router[_0xa7aa('0x8')](_0xa7aa('0xb'),auth['isAuthenticated'](),controller[_0xa7aa('0xc')]);router[_0xa7aa('0x8')](_0xa7aa('0xd'),auth[_0xa7aa('0x9')](),controller['show']);router['get'](_0xa7aa('0xe'),auth[_0xa7aa('0x9')](),controller[_0xa7aa('0xf')]);router[_0xa7aa('0x8')](_0xa7aa('0x10'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0xa7aa('0x9')](),controller['create']);router['post'](_0xa7aa('0x11'),auth[_0xa7aa('0x9')](),controller[_0xa7aa('0x12')]);router['post'](_0xa7aa('0xe'),auth['isAuthenticated'](),controller[_0xa7aa('0x13')]);router[_0xa7aa('0x14')](_0xa7aa('0x10'),auth[_0xa7aa('0x9')](),controller['addResources']);router['put'](_0xa7aa('0xd'),auth[_0xa7aa('0x9')](),controller['update']);router['delete'](_0xa7aa('0xd'),auth[_0xa7aa('0x9')](),controller[_0xa7aa('0x15')]);router[_0xa7aa('0x16')](_0xa7aa('0xe'),auth[_0xa7aa('0x9')](),controller[_0xa7aa('0x17')]);router[_0xa7aa('0x16')]('/:id/resources',auth[_0xa7aa('0x9')](),controller[_0xa7aa('0x18')]);module[_0xa7aa('0x19')]=router; \ No newline at end of file +var _0xe642=['show','get','/:id/resources','getResources','post','addSections','addResources','put','/:id','update','delete','removeSections','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe'];(function(_0x4b1660,_0x2805de){var _0x5d2b93=function(_0x1f1da2){while(--_0x1f1da2){_0x4b1660['push'](_0x4b1660['shift']());}};_0x5d2b93(++_0x2805de);}(_0xe642,0x17c));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2e64('0x0'));var util=require('util');var path=require(_0x2e64('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2e64('0x2')]();var fs_extra=require(_0x2e64('0x3'));var auth=require(_0x2e64('0x4'));var interaction=require(_0x2e64('0x5'));var config=require(_0x2e64('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2e64('0x7')]);router['get'](_0x2e64('0x8'),auth[_0x2e64('0x9')](),controller[_0x2e64('0xa')]);router['get']('/:id',auth[_0x2e64('0x9')](),controller[_0x2e64('0xb')]);router[_0x2e64('0xc')]('/:id/sections',auth[_0x2e64('0x9')](),controller['getSections']);router[_0x2e64('0xc')](_0x2e64('0xd'),auth[_0x2e64('0x9')](),controller[_0x2e64('0xe')]);router[_0x2e64('0xf')]('/',auth[_0x2e64('0x9')](),controller['create']);router[_0x2e64('0xf')]('/:id/clone',auth[_0x2e64('0x9')](),controller['clone']);router['post']('/:id/sections',auth[_0x2e64('0x9')](),controller[_0x2e64('0x10')]);router[_0x2e64('0xf')]('/:id/resources',auth[_0x2e64('0x9')](),controller[_0x2e64('0x11')]);router[_0x2e64('0x12')](_0x2e64('0x13'),auth[_0x2e64('0x9')](),controller[_0x2e64('0x14')]);router[_0x2e64('0x15')](_0x2e64('0x13'),auth['isAuthenticated'](),controller['destroy']);router[_0x2e64('0x15')]('/:id/sections',auth[_0x2e64('0x9')](),controller[_0x2e64('0x16')]);router['delete'](_0x2e64('0xd'),auth[_0x2e64('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6c83885..2d7fb20 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 _0xa73e=['sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x2f13dc,_0x266e44){var _0x497a86=function(_0xbb19ed){while(--_0xbb19ed){_0x2f13dc['push'](_0x2f13dc['shift']());}};_0x497a86(++_0x266e44);}(_0xa73e,0xf3));var _0xea73=function(_0x594b69,_0x3a5d13){_0x594b69=_0x594b69-0x0;var _0x25b7e3=_0xa73e[_0x594b69];return _0x25b7e3;};'use strict';var Sequelize=require(_0xea73('0x0'));module[_0xea73('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xea73('0x2')},'crudPermissions':{'type':Sequelize[_0xea73('0x3')],'set':function(_0x11ea7e){this[_0xea73('0x4')](_0xea73('0x5'),_0x11ea7e?_0x11ea7e[_0xea73('0x6')](''):[]);},'get':function(){return this[_0xea73('0x7')](_0xea73('0x5'))?this[_0xea73('0x7')](_0xea73('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xea73('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xea73('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xea73('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdc39=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','crudPermissions'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xdc39,0x16f));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9dc3('0x0'));module[_0x9dc3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x9dc3('0x2')],'set':function(_0x4715fa){this['setDataValue'](_0x9dc3('0x3'),_0x4715fa?_0x4715fa['join'](''):[]);},'get':function(){return this['getDataValue'](_0x9dc3('0x3'))?this[_0x9dc3('0x4')](_0x9dc3('0x3'))[_0x9dc3('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9dc3('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9dc3('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9dc3('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9dc3('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 69b34ef..386f0fa 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 _0xc97f=['Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filters','filter','options','includeAll','include','rows','catch','params','find','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','merge','each','autoAssociation','findAll','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','destroy','describe','push','ids','getSections','enabled','includes','isEmpty','subsections','concat'];(function(_0x25aa4c,_0x5b671f){var _0x332bcd=function(_0x193764){while(--_0x193764){_0x25aa4c['push'](_0x25aa4c['shift']());}};_0x332bcd(++_0x5b671f);}(_0xc97f,0x147));var _0xfc97=function(_0x1d35a3,_0x18d2ee){_0x1d35a3=_0x1d35a3-0x0;var _0x5acd09=_0xc97f[_0x1d35a3];return _0x5acd09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc97('0x0'));var jsonpatch=require(_0xfc97('0x1'));var rp=require(_0xfc97('0x2'));var moment=require(_0xfc97('0x3'));var BPromise=require(_0xfc97('0x4'));var Mustache=require(_0xfc97('0x5'));var util=require(_0xfc97('0x6'));var path=require(_0xfc97('0x7'));var sox=require(_0xfc97('0x8'));var csv=require(_0xfc97('0x9'));var ejs=require(_0xfc97('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc97('0xb'));var squel=require(_0xfc97('0xc'));var crypto=require(_0xfc97('0xd'));var jsforce=require(_0xfc97('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc97('0x9'));var querystring=require('querystring');var Papa=require(_0xfc97('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfc97('0x10'));var as=require(_0xfc97('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc97('0x12'))('api');var utils=require(_0xfc97('0x13'));var config=require(_0xfc97('0x14'));var licenseUtil=require(_0xfc97('0x15'));var db=require('../../mysqldb')['db'];config[_0xfc97('0x16')]=_[_0xfc97('0x17')](config[_0xfc97('0x16')],{'host':_0xfc97('0x18'),'port':0x18eb});var socket=require(_0xfc97('0x19'))(new Redis(config[_0xfc97('0x16')]));require(_0xfc97('0x1a'))[_0xfc97('0x1b')](socket);function respondWithStatusCode(_0x5776bc,_0x27016e){_0x27016e=_0x27016e||0xcc;return function(_0x5d5d53){if(_0x5d5d53){return _0x5776bc[_0xfc97('0x1c')](_0x27016e);}return _0x5776bc['status'](_0x27016e)[_0xfc97('0x1d')]();};}function respondWithResult(_0x5741a0,_0x15f7cc){_0x15f7cc=_0x15f7cc||0xc8;return function(_0x17c2d1){if(_0x17c2d1){return _0x5741a0[_0xfc97('0x1e')](_0x15f7cc)[_0xfc97('0x1f')](_0x17c2d1);}};}function respondWithFilteredResult(_0x3c0a50,_0x4284b1){return function(_0x467b6d){if(_0x467b6d){var _0x27fd47=typeof _0x4284b1[_0xfc97('0x20')]==='undefined'&&typeof _0x4284b1[_0xfc97('0x21')]===_0xfc97('0x22');var _0x292f3a=_0x467b6d['count'];var _0x354936=_0x27fd47?0x0:_0x4284b1[_0xfc97('0x20')];var _0x166bfa=_0x27fd47?_0x467b6d[_0xfc97('0x23')]:_0x4284b1[_0xfc97('0x20')]+_0x4284b1[_0xfc97('0x21')];var _0x2ca80c;if(_0x166bfa>=_0x292f3a){_0x166bfa=_0x292f3a;_0x2ca80c=0xc8;}else{_0x2ca80c=0xce;}_0x3c0a50['status'](_0x2ca80c);return _0x3c0a50['set'](_0xfc97('0x24'),_0x354936+'-'+_0x166bfa+'/'+_0x292f3a)['json'](_0x467b6d);}return null;};}function patchUpdates(_0x430b85){return function(_0x21526f){try{jsonpatch['apply'](_0x21526f,_0x430b85,!![]);}catch(_0x386b54){return BPromise[_0xfc97('0x25')](_0x386b54);}return _0x21526f['save']();};}function saveUpdates(_0x3f6d73,_0x5e61d8){return function(_0x303189){if(_0x303189){return _0x303189[_0xfc97('0x26')](_0x3f6d73)[_0xfc97('0x27')](function(_0x3cb072){return _0x3cb072;});}return null;};}function removeEntity(_0xace455,_0x2562eb){return function(_0x232ed7){if(_0x232ed7){return _0x232ed7['destroy']()[_0xfc97('0x27')](function(){_0xace455[_0xfc97('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f19e,_0x269cc9){return function(_0x251260){if(!_0x251260){_0x19f19e[_0xfc97('0x1c')](0x194);}return _0x251260;};}function handleError(_0x54dd43,_0x2410ac){_0x2410ac=_0x2410ac||0x1f4;return function(_0x56d970){logger[_0xfc97('0x28')](_0x56d970[_0xfc97('0x29')]);if(_0x56d970[_0xfc97('0x2a')]){delete _0x56d970[_0xfc97('0x2a')];}_0x54dd43['status'](_0x2410ac)[_0xfc97('0x2b')](_0x56d970);};}exports[_0xfc97('0x2c')]=function(_0x515797,_0x13540e){var _0x547436={},_0x56167f={},_0x3f59c5={'count':0x0,'rows':[]};var _0x7f096f=_[_0xfc97('0x2d')](db[_0xfc97('0x2e')][_0xfc97('0x2f')],function(_0xf04fa6){return{'name':_0xf04fa6['fieldName'],'type':_0xf04fa6['type'][_0xfc97('0x30')]};});_0x56167f[_0xfc97('0x31')]=_[_0xfc97('0x2d')](_0x7f096f,'name');_0x56167f['query']=_[_0xfc97('0x32')](_0x515797[_0xfc97('0x33')]);_0x56167f['filters']=_[_0xfc97('0x34')](_0x56167f[_0xfc97('0x31')],_0x56167f[_0xfc97('0x33')]);_0x547436['attributes']=_['intersection'](_0x56167f[_0xfc97('0x31')],qs['fields'](_0x515797[_0xfc97('0x33')][_0xfc97('0x35')]));_0x547436[_0xfc97('0x36')]=_0x547436[_0xfc97('0x36')][_0xfc97('0x37')]?_0x547436['attributes']:_0x56167f[_0xfc97('0x31')];if(!_0x515797[_0xfc97('0x33')][_0xfc97('0x38')]('nolimit')){_0x547436['limit']=qs[_0xfc97('0x21')](_0x515797[_0xfc97('0x33')]['limit']);_0x547436[_0xfc97('0x20')]=qs[_0xfc97('0x20')](_0x515797[_0xfc97('0x33')][_0xfc97('0x20')]);}_0x547436[_0xfc97('0x39')]=qs['sort'](_0x515797[_0xfc97('0x33')]['sort']);_0x547436[_0xfc97('0x3a')]=qs['filters'](_[_0xfc97('0x3b')](_0x515797[_0xfc97('0x33')],_0x56167f[_0xfc97('0x3c')]),_0x7f096f);if(_0x515797[_0xfc97('0x33')][_0xfc97('0x3d')]){_0x547436[_0xfc97('0x3a')]=_['merge'](_0x547436[_0xfc97('0x3a')],{'$or':_['map'](_0x7f096f,function(_0x456e66){if(_0x456e66['type']!=='VIRTUAL'){var _0x4f8fcc={};_0x4f8fcc[_0x456e66['name']]={'$like':'%'+_0x515797[_0xfc97('0x33')]['filter']+'%'};return _0x4f8fcc;}})});}_0x547436=_['merge']({},_0x547436,_0x515797[_0xfc97('0x3e')]);var _0x209843={'where':_0x547436[_0xfc97('0x3a')]};return db[_0xfc97('0x2e')][_0xfc97('0x23')](_0x209843)[_0xfc97('0x27')](function(_0x437034){_0x3f59c5[_0xfc97('0x23')]=_0x437034;if(_0x515797[_0xfc97('0x33')][_0xfc97('0x3f')]){_0x547436[_0xfc97('0x40')]=[{'all':!![]}];}return db[_0xfc97('0x2e')]['findAll'](_0x547436);})['then'](function(_0x700a36){_0x3f59c5[_0xfc97('0x41')]=_0x700a36;return _0x3f59c5;})[_0xfc97('0x27')](respondWithFilteredResult(_0x13540e,_0x547436))[_0xfc97('0x42')](handleError(_0x13540e,null));};exports['show']=function(_0x2ff1d7,_0x595be5){var _0x1b0b23={'raw':![],'where':{'id':_0x2ff1d7[_0xfc97('0x43')]['id']}},_0x4b2b89={};_0x4b2b89[_0xfc97('0x31')]=_[_0xfc97('0x32')](db['UserProfile'][_0xfc97('0x2f')]);_0x4b2b89[_0xfc97('0x33')]=_['keys'](_0x2ff1d7[_0xfc97('0x33')]);_0x4b2b89[_0xfc97('0x3c')]=_[_0xfc97('0x34')](_0x4b2b89[_0xfc97('0x31')],_0x4b2b89[_0xfc97('0x33')]);_0x1b0b23['attributes']=_[_0xfc97('0x34')](_0x4b2b89['model'],qs[_0xfc97('0x35')](_0x2ff1d7['query'][_0xfc97('0x35')]));_0x1b0b23[_0xfc97('0x36')]=_0x1b0b23[_0xfc97('0x36')][_0xfc97('0x37')]?_0x1b0b23[_0xfc97('0x36')]:_0x4b2b89[_0xfc97('0x31')];if(_0x2ff1d7[_0xfc97('0x33')][_0xfc97('0x3f')]){_0x1b0b23[_0xfc97('0x40')]=[{'all':!![]}];}_0x1b0b23=_['merge']({},_0x1b0b23,_0x2ff1d7['options']);return db[_0xfc97('0x2e')][_0xfc97('0x44')](_0x1b0b23)[_0xfc97('0x27')](handleEntityNotFound(_0x595be5,null))[_0xfc97('0x27')](respondWithResult(_0x595be5,null))[_0xfc97('0x42')](handleError(_0x595be5,null));};exports[_0xfc97('0x45')]=function(_0x1151bb,_0x54bf57){return db[_0xfc97('0x2e')]['create'](_0x1151bb[_0xfc97('0x46')],{})['then'](respondWithResult(_0x54bf57,0xc9))[_0xfc97('0x42')](handleError(_0x54bf57,null));};exports['clone']=function(_0x31bae5,_0x28926d){var _0x3aefdc={'where':{'id':_0x31bae5[_0xfc97('0x43')]['id']}},_0x33d286={};_0x33d286[_0xfc97('0x31')]=_[_0xfc97('0x32')](db[_0xfc97('0x2e')][_0xfc97('0x2f')]);_0x3aefdc['attributes']=_['intersection'](_0x33d286[_0xfc97('0x31')],qs['fields'](_0x31bae5['query'][_0xfc97('0x35')]));_0x3aefdc[_0xfc97('0x36')]=_0x3aefdc['attributes'][_0xfc97('0x37')]?_0x3aefdc['attributes']:_0x33d286[_0xfc97('0x31')];if(_0x31bae5['query'][_0xfc97('0x3f')]){_0x3aefdc[_0xfc97('0x40')]=[{'all':!![]}];}_0x3aefdc=_['merge']({},_0x3aefdc,_0x31bae5[_0xfc97('0x3e')]);return db['UserProfile'][_0xfc97('0x44')](_0x3aefdc)['then'](handleEntityNotFound(_0x28926d,null))[_0xfc97('0x27')](function(_0x18087f){if(_0x18087f){var _0x29636a=_0x18087f[_0xfc97('0x47')]({'plain':!![]});_0x29636a=qs[_0xfc97('0x48')](_0x29636a,['id',_0xfc97('0x49'),_0xfc97('0x4a'),_0xfc97('0x4b')]);_0x31bae5[_0xfc97('0x46')]=_[_0xfc97('0x48')](_0x31bae5[_0xfc97('0x46')],['id','createdAt',_0xfc97('0x4a')]);return db[_0xfc97('0x4c')][_0xfc97('0x4d')](function(_0x25d6dc){return db['UserProfile'][_0xfc97('0x45')](_[_0xfc97('0x4e')](_0x29636a,_0x31bae5[_0xfc97('0x46')]),{'include':_0x31bae5[_0xfc97('0x33')][_0xfc97('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x25d6dc})[_0xfc97('0x27')](function(_0x9763b3){var _0x395ad0=_0x9763b3['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x31bae5[_0xfc97('0x43')]['id']},'raw':!![]})[_0xfc97('0x27')](function(_0x2bdf67){if(_0x2bdf67){return BPromise[_0xfc97('0x4f')](_0x2bdf67,function(_0x33395a){return new BPromise(function(_0x577f8d,_0x3ecb9a){if(_0x33395a[_0xfc97('0x50')]===null||_0x33395a['autoAssociation']===0x1)_0x577f8d(null);return db['UserProfileResource'][_0xfc97('0x51')]({'where':{'sectionId':_0x33395a['id']},'raw':!![]})[_0xfc97('0x27')](function(_0x2d1e5f){var _0x4d505d=_[_0xfc97('0x2d')](_0x2d1e5f,function(_0x4b4cb9){return qs[_0xfc97('0x48')](_0x4b4cb9,['id',_0xfc97('0x49'),_0xfc97('0x4a'),_0xfc97('0x52')]);});_0x577f8d(_0x4d505d);})[_0xfc97('0x42')](function(_0x40762d){_0x3ecb9a(_0x40762d);});})[_0xfc97('0x27')](function(_0x29abd6){var _0x27bac9=qs[_0xfc97('0x48')](_0x33395a,['id',_0xfc97('0x49'),_0xfc97('0x4a')]);_0x27bac9[_0xfc97('0x53')]=_0x395ad0['id'];if(_0x29abd6)_0x27bac9[_0xfc97('0x54')]=_0x29abd6;return _0x27bac9;})[_0xfc97('0x27')](function(_0x5c0d9b){return db[_0xfc97('0x55')][_0xfc97('0x45')](_0x5c0d9b,{'include':[{'model':db[_0xfc97('0x56')],'as':_0xfc97('0x54')}],'raw':!![],'transaction':_0x25d6dc});});})[_0xfc97('0x27')](function(){return _0x395ad0;});}});});});}})[_0xfc97('0x27')](respondWithResult(_0x28926d,0xc9))[_0xfc97('0x42')](handleError(_0x28926d,null));};exports[_0xfc97('0x26')]=function(_0x2e22cf,_0xf9b3ab){if(_0x2e22cf[_0xfc97('0x46')]['id']){delete _0x2e22cf['body']['id'];}return db[_0xfc97('0x2e')][_0xfc97('0x44')]({'where':{'id':_0x2e22cf[_0xfc97('0x43')]['id']}})[_0xfc97('0x27')](handleEntityNotFound(_0xf9b3ab,null))[_0xfc97('0x27')](saveUpdates(_0x2e22cf[_0xfc97('0x46')],null))[_0xfc97('0x27')](respondWithResult(_0xf9b3ab,null))['catch'](handleError(_0xf9b3ab,null));};exports[_0xfc97('0x57')]=function(_0xa895f1,_0x316fb3){return db[_0xfc97('0x2e')][_0xfc97('0x44')]({'where':{'id':_0xa895f1[_0xfc97('0x43')]['id']}})[_0xfc97('0x27')](handleEntityNotFound(_0x316fb3,null))[_0xfc97('0x27')](removeEntity(_0x316fb3,null))[_0xfc97('0x42')](handleError(_0x316fb3,null));};exports['describe']=function(_0x49dbbc,_0x562e0e){return db[_0xfc97('0x2e')][_0xfc97('0x58')]()[_0xfc97('0x27')](respondWithResult(_0x562e0e,null))['catch'](handleError(_0x562e0e,null));};exports['addSections']=function(_0x30eb0c,_0x3a9250){var _0x11e30b=_0x30eb0c['body'];return db['UserProfile'][_0xfc97('0x44')]({'where':{'id':_0x30eb0c[_0xfc97('0x43')]['id']}})[_0xfc97('0x27')](handleEntityNotFound(_0x3a9250,null))[_0xfc97('0x27')](function(_0x3067d5){if(_0x3067d5){return db[_0xfc97('0x4c')]['transaction'](function(_0x10e371){return db['UserProfileSection'][_0xfc97('0x57')]({'where':{'userProfileId':_0x30eb0c[_0xfc97('0x43')]['id'],'sectionId':_[_0xfc97('0x2d')](_0x11e30b,function(_0x5587ae){return _0x5587ae['sectionId'];})},'transaction':_0x10e371})[_0xfc97('0x27')](function(){var _0x2b042b=_[_0xfc97('0x2d')](_0x11e30b,function(_0x5b9bf4){_0x5b9bf4[_0xfc97('0x53')]=_0x30eb0c[_0xfc97('0x43')]['id'];return _0x5b9bf4;});var _0x2123a0=[];return BPromise['each'](_0x2b042b,function(_0xbc93c7){return db[_0xfc97('0x55')][_0xfc97('0x45')](_0xbc93c7,{'include':[{'model':db[_0xfc97('0x56')],'as':_0xfc97('0x54')}],'raw':!![],'transaction':_0x10e371})[_0xfc97('0x27')](function(_0x41be6d){_0x2123a0[_0xfc97('0x59')](_0x41be6d[_0xfc97('0x47')]({'plain':!![]}));});})[_0xfc97('0x27')](function(){return _0x2123a0;});});});}})[_0xfc97('0x27')](function(_0x12509d){return _0x12509d;})[_0xfc97('0x27')](respondWithResult(_0x3a9250,null))['catch'](handleError(_0x3a9250,null));};exports['removeSections']=function(_0x158354,_0x3f6692){var _0x41af09;return db['UserProfile'][_0xfc97('0x44')]({'where':{'id':_0x158354[_0xfc97('0x43')]['id']},'attributes':['id',_0xfc97('0x2a')]})[_0xfc97('0x27')](handleEntityNotFound(_0x3f6692,null))[_0xfc97('0x27')](function(_0x516be2){if(_0x516be2){_0x41af09=_0x516be2;return db[_0xfc97('0x55')][_0xfc97('0x57')]({'where':{'userProfileId':_0x158354[_0xfc97('0x43')]['id'],'sectionId':_0x158354[_0xfc97('0x33')][_0xfc97('0x5a')]}});}})[_0xfc97('0x27')](function(){return _0x41af09;})[_0xfc97('0x27')](respondWithStatusCode(_0x3f6692,null))['catch'](handleError(_0x3f6692,null));};exports[_0xfc97('0x5b')]=function(_0xf8f0e,_0x3f5192){var _0x4e8cf3=[];var _0x5a5ad0=[];return db[_0xfc97('0x55')][_0xfc97('0x51')]({'where':{'userProfileId':_0xf8f0e[_0xfc97('0x43')]['id']},'raw':!![]})['then'](function(_0x2e40cb){_0x4e8cf3=_[_0xfc97('0x3d')](_0x2e40cb,function(_0x4cd3ea){return _0x4cd3ea[_0xfc97('0x5c')]===0x1||_[_0xfc97('0x5d')]([0x3eb,0x709],_0x4cd3ea[_0xfc97('0x52')]);});if(!_[_0xfc97('0x5e')](_0x4e8cf3)){return _[_0xfc97('0x2d')](_0x4e8cf3,function(_0x13667e){return _0x13667e[_0xfc97('0x52')];});}else{return;}})['then'](function(_0x4b754f){if(_0x4b754f)_0x5a5ad0=_0x4b754f;if(_[_0xfc97('0x5d')](_0x5a5ad0,0x64)){var _0x11b6f8=_['find'](_0x4e8cf3,{'sectionId':0x64});return hasDefaultDashboard(_0x11b6f8)[_0xfc97('0x27')](function(_0x42fa83){return _[_0xfc97('0x2d')](_0x4e8cf3,function(_0x441998){if(_0x441998[_0xfc97('0x52')]===0x64){_0x441998['subsections']=_0x42fa83;}return _0x441998;});});}else{return;}})[_0xfc97('0x27')](function(_0x1314b8){if(_0x1314b8)_0x4e8cf3=_0x1314b8;if(_[_0xfc97('0x5d')](_0x5a5ad0,0x3eb)){var _0x4d5f8=_[_0xfc97('0x44')](_0x4e8cf3,{'sectionId':0x3eb});return getCustomDashboards(_0x4d5f8)[_0xfc97('0x27')](function(_0x4f0cb7){return _['map'](_0x4e8cf3,function(_0x469921){if(_0x4d5f8[_0xfc97('0x5c')]){if(_0x469921[_0xfc97('0x52')]===0x3eb){_0x469921[_0xfc97('0x5f')]=_0x4f0cb7;}}else{if(_0x469921[_0xfc97('0x52')]===0x64){if(!_0x469921[_0xfc97('0x5f')]){_0x469921['subsections']=[];}_0x469921[_0xfc97('0x5f')]=_0x469921[_0xfc97('0x5f')][_0xfc97('0x60')](_0x4f0cb7);}}return _0x469921;});});}else{return;}})[_0xfc97('0x27')](function(_0x43db13){if(_0x43db13)_0x4e8cf3=_0x43db13;if(_[_0xfc97('0x5d')](_0x5a5ad0,0x709)){var _0x3952e6=_[_0xfc97('0x44')](_0x4e8cf3,{'sectionId':0x709});return getPlugins(_0x3952e6)[_0xfc97('0x27')](function(_0x5e22b6){if(_0x3952e6['enabled']){return _[_0xfc97('0x2d')](_0x4e8cf3,function(_0x57f824){if(_0x57f824[_0xfc97('0x52')]===0x709){_0x57f824['subsections']=_0x5e22b6;}return _0x57f824;});}else{var _0x261983={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5e22b6};var _0x154e37=_[_0xfc97('0x2d')](_0x4e8cf3);_0x154e37[_0xfc97('0x59')](_0x261983);return _0x154e37;}});}else{return;}})[_0xfc97('0x27')](function(_0x5d9dc2){if(_0x5d9dc2)_0x4e8cf3=_0x5d9dc2;return _[_0xfc97('0x3d')](_0x4e8cf3,[_0xfc97('0x5c'),0x1]);})[_0xfc97('0x27')](respondWithResult(_0x3f5192,null))['catch'](handleError(_0x3f5192,null));};function hasDefaultDashboard(_0x603b0){var _0x47c5ed=[0x65];return new BPromise(function(_0x2a817c,_0x51e647){try{if(_0x603b0[_0xfc97('0x50')]){_0x2a817c(_0x47c5ed);}else{return db[_0xfc97('0x56')]['findOne']({'where':{'sectionId':_0x603b0['id']},'raw':!![]})[_0xfc97('0x27')](function(_0x161178){_0x161178?_0x2a817c(_0x47c5ed):_0x2a817c();});}}catch(_0x2bb628){_0x51e647(_0x2bb628);}});}function getCustomDashboards(_0x24178d){var _0x22451d=[];return new BPromise(function(_0x14aaf8,_0x242020){try{if(_0x24178d[_0xfc97('0x50')]){return db[_0xfc97('0x61')][_0xfc97('0x51')]({'raw':!![]})[_0xfc97('0x27')](function(_0x932788){_0x932788[_0xfc97('0x62')](function(_0x49cc44){_0x22451d['push'](_0x49cc44['id']+0x1869f);});_0x14aaf8(_0x22451d);});}else{return db[_0xfc97('0x56')][_0xfc97('0x51')]({'where':{'sectionId':_0x24178d['id']},'raw':!![]})[_0xfc97('0x27')](function(_0x552363){_0x552363[_0xfc97('0x62')](function(_0xf6ee12){_0x22451d[_0xfc97('0x59')](_0xf6ee12[_0xfc97('0x63')]+0x1869f);});_0x14aaf8(_0x22451d);});}}catch(_0xb31eea){_0x242020(_0xb31eea);}});}function getPlugins(_0x4603d5){var _0x2f888e=[];return new BPromise(function(_0x563b75,_0x26384e){try{if(_0x4603d5[_0xfc97('0x50')]){return db['Plugin'][_0xfc97('0x51')]({'raw':!![]})['then'](function(_0x3bff25){_0x3bff25['forEach'](function(_0x6fa0d0){_0x2f888e[_0xfc97('0x59')](_0x6fa0d0['id']+0x15b38);});_0x563b75(_0x2f888e);});}else{return db[_0xfc97('0x56')][_0xfc97('0x51')]({'where':{'sectionId':_0x4603d5['id']},'raw':!![]})[_0xfc97('0x27')](function(_0x308f2e){_0x308f2e[_0xfc97('0x62')](function(_0x20ab8b){_0x2f888e[_0xfc97('0x59')](_0x20ab8b[_0xfc97('0x63')]+0x15b38);});_0x563b75(_0x2f888e);});}}catch(_0x2a4b84){_0x26384e(_0x2a4b84);}});}exports['addResources']=function(_0xccbd0e,_0x1c1b98){return db['UserProfile'][_0xfc97('0x44')]({'where':{'id':_0xccbd0e[_0xfc97('0x43')]['id']}})[_0xfc97('0x27')](handleEntityNotFound(_0x1c1b98,null))[_0xfc97('0x27')](function(_0x43ffc8){if(_0x43ffc8){return db[_0xfc97('0x4c')][_0xfc97('0x4d')](function(_0x5db63f){return db['UserProfileSection'][_0xfc97('0x51')]({'where':{'userProfileId':_0xccbd0e[_0xfc97('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0xfc97('0x27')](function(_0x51287d){if(_0x51287d){return db[_0xfc97('0x55')][_0xfc97('0x57')]({'where':{'userProfileId':_0xccbd0e[_0xfc97('0x43')]['id'],'id':_[_0xfc97('0x2d')](_0x51287d,function(_0x36477e){return _0x36477e['id'];})},'transaction':_0x5db63f});}})[_0xfc97('0x27')](function(_0x2ecbac){var _0x54205c=_[_0xfc97('0x2d')](_0xccbd0e['body'],function(_0x2e644c){_0x2e644c[_0xfc97('0x53')]=_0xccbd0e[_0xfc97('0x43')]['id'];return _0x2e644c;});return db[_0xfc97('0x55')][_0xfc97('0x64')](_0x54205c,{'raw':!![],'transaction':_0x5db63f});})[_0xfc97('0x27')](function(_0xcae1d3){var _0x32bdcb=_[_0xfc97('0x3d')](_[_0xfc97('0x2d')](_0xcae1d3,function(_0x57da59){return _0x57da59['get']({'plain':!![]});}),{'includeAll':![]});if(_0x32bdcb){return db[_0xfc97('0x55')]['findAll']({'where':{'userProfileId':_0xccbd0e[_0xfc97('0x43')]['id'],'sectionId':_[_0xfc97('0x2d')](_0x32bdcb,function(_0x292531){return _0x292531[_0xfc97('0x52')];})},'attributes':['id',_0xfc97('0x52')],'raw':!![]})[_0xfc97('0x27')](function(_0x52054e){var _0x46a6b5=_[_0xfc97('0x2d')](_0xccbd0e[_0xfc97('0x46')],function(_0x19c911){_0x19c911['userProfileId']=_0xccbd0e['params']['id'];return _0x19c911;});return db[_0xfc97('0x56')]['bulkCreate'](_0x46a6b5,{'raw':!![],'transaction':_0x5db63f});});}})['catch'](handleError(_0x1c1b98,null));});}})['then'](function(_0x266898){var _0x595362=_[_0xfc97('0x2d')](_0x266898,function(_0x1786e9){return _0x1786e9[_0xfc97('0x47')]({'plain':!![]});});})[_0xfc97('0x27')](respondWithResult(_0x1c1b98,null))[_0xfc97('0x42')](handleError(_0x1c1b98,null));};exports[_0xfc97('0x65')]=function(_0x16f1cd,_0x412e24,_0x3840a9){return db[_0xfc97('0x2e')][_0xfc97('0x44')]({'where':{'id':_0x16f1cd[_0xfc97('0x43')]['id']}})[_0xfc97('0x27')](handleEntityNotFound(_0x412e24,null))[_0xfc97('0x27')](function(_0x4538b1){if(_0x4538b1){return _0x4538b1[_0xfc97('0x65')](_0x16f1cd['query'][_0xfc97('0x5a')]);}})[_0xfc97('0x27')](respondWithStatusCode(_0x412e24,null))['catch'](handleError(_0x412e24,null));};exports[_0xfc97('0x66')]=function(_0x4ad791,_0x52f091){var _0x3ec8a1={};if(!_0x4ad791[_0xfc97('0x33')]['section'])throw new Error(_0xfc97('0x67'));if(!_0x4ad791[_0xfc97('0x33')][_0xfc97('0x38')](_0xfc97('0x68'))){_0x3ec8a1[_0xfc97('0x21')]=qs[_0xfc97('0x21')](_0x4ad791['query'][_0xfc97('0x21')]);_0x3ec8a1['offset']=qs[_0xfc97('0x20')](_0x4ad791[_0xfc97('0x33')][_0xfc97('0x20')]);}return db[_0xfc97('0x2e')][_0xfc97('0x44')]({'where':{'id':_0x4ad791[_0xfc97('0x43')]['id']}})['then'](function(_0x4ce635){if(!_0x4ce635)throw new Error(_0xfc97('0x69')+_0x4ad791['params']['id']);return db[_0xfc97('0x2e')][_0xfc97('0x66')](_0x4ad791);})['then'](respondWithFilteredResult(_0x52f091,_0x3ec8a1))['catch'](handleError(_0x52f091,null));}; \ No newline at end of file +var _0xc475=['userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','getResources','section','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','status','end','json','undefined','limit','count','offset','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','map','UserProfile','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','clone','params','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId'];(function(_0x2c0e63,_0x3de8dc){var _0x3cb9df=function(_0x5768cb){while(--_0x5768cb){_0x2c0e63['push'](_0x2c0e63['shift']());}};_0x3cb9df(++_0x3de8dc);}(_0xc475,0x8a));var _0x5c47=function(_0x3a44ef,_0x209c8d){_0x3a44ef=_0x3a44ef-0x0;var _0x278acd=_0xc475[_0x3a44ef];return _0x278acd;};'use strict';var emlformat=require(_0x5c47('0x0'));var rimraf=require(_0x5c47('0x1'));var zipdir=require(_0x5c47('0x2'));var jsonpatch=require(_0x5c47('0x3'));var rp=require(_0x5c47('0x4'));var moment=require(_0x5c47('0x5'));var BPromise=require(_0x5c47('0x6'));var Mustache=require(_0x5c47('0x7'));var util=require(_0x5c47('0x8'));var path=require(_0x5c47('0x9'));var sox=require(_0x5c47('0xa'));var csv=require(_0x5c47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c47('0xc'));var _=require(_0x5c47('0xd'));var squel=require(_0x5c47('0xe'));var crypto=require(_0x5c47('0xf'));var jsforce=require(_0x5c47('0x10'));var deskjs=require(_0x5c47('0x11'));var toCsv=require(_0x5c47('0xb'));var querystring=require('querystring');var Papa=require(_0x5c47('0x12'));var Redis=require(_0x5c47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5c47('0x14'));var as=require(_0x5c47('0x15'));var hardwareService=require(_0x5c47('0x16'));var logger=require(_0x5c47('0x17'))(_0x5c47('0x18'));var utils=require(_0x5c47('0x19'));var config=require(_0x5c47('0x1a'));var licenseUtil=require(_0x5c47('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5c47('0x1c'),'port':0x18eb});var socket=require(_0x5c47('0x1d'))(new Redis(config[_0x5c47('0x1e')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x29dd7e,_0x1c5696){_0x1c5696=_0x1c5696||0xcc;return function(_0x5251be){if(_0x5251be){return _0x29dd7e['sendStatus'](_0x1c5696);}return _0x29dd7e[_0x5c47('0x1f')](_0x1c5696)[_0x5c47('0x20')]();};}function respondWithResult(_0x477b94,_0x5bae07){_0x5bae07=_0x5bae07||0xc8;return function(_0x12da3b){if(_0x12da3b){return _0x477b94[_0x5c47('0x1f')](_0x5bae07)[_0x5c47('0x21')](_0x12da3b);}};}function respondWithFilteredResult(_0x306e96,_0x136594){return function(_0x19744f){if(_0x19744f){var _0xe6ed21=typeof _0x136594['offset']===_0x5c47('0x22')&&typeof _0x136594[_0x5c47('0x23')]===_0x5c47('0x22');var _0x3eaad8=_0x19744f[_0x5c47('0x24')];var _0x193b0a=_0xe6ed21?0x0:_0x136594[_0x5c47('0x25')];var _0x546e76=_0xe6ed21?_0x19744f[_0x5c47('0x24')]:_0x136594[_0x5c47('0x25')]+_0x136594[_0x5c47('0x23')];var _0xc5e140;if(_0x546e76>=_0x3eaad8){_0x546e76=_0x3eaad8;_0xc5e140=0xc8;}else{_0xc5e140=0xce;}_0x306e96['status'](_0xc5e140);return _0x306e96[_0x5c47('0x26')](_0x5c47('0x27'),_0x193b0a+'-'+_0x546e76+'/'+_0x3eaad8)[_0x5c47('0x21')](_0x19744f);}return null;};}function patchUpdates(_0x51692b){return function(_0x2b04dc){try{jsonpatch['apply'](_0x2b04dc,_0x51692b,!![]);}catch(_0x10c97d){return BPromise['reject'](_0x10c97d);}return _0x2b04dc[_0x5c47('0x28')]();};}function saveUpdates(_0x31103a,_0x3884d3){return function(_0x9b0418){if(_0x9b0418){return _0x9b0418['update'](_0x31103a)['then'](function(_0x1dc7f1){return _0x1dc7f1;});}return null;};}function removeEntity(_0x55102c,_0x51f2be){return function(_0x2ac1f5){if(_0x2ac1f5){return _0x2ac1f5[_0x5c47('0x29')]()[_0x5c47('0x2a')](function(){_0x55102c['status'](0xcc)[_0x5c47('0x20')]();});}};}function handleEntityNotFound(_0x366c99,_0x58ab22){return function(_0x333b84){if(!_0x333b84){_0x366c99[_0x5c47('0x2b')](0x194);}return _0x333b84;};}function handleError(_0x3d32bb,_0x2f01c7){_0x2f01c7=_0x2f01c7||0x1f4;return function(_0x1a0cdd){logger[_0x5c47('0x2c')](_0x1a0cdd[_0x5c47('0x2d')]);if(_0x1a0cdd[_0x5c47('0x2e')]){delete _0x1a0cdd[_0x5c47('0x2e')];}_0x3d32bb[_0x5c47('0x1f')](_0x2f01c7)[_0x5c47('0x2f')](_0x1a0cdd);};}exports['index']=function(_0x79d318,_0x2bf99b){var _0x4a1c63={},_0x4f066a={},_0x700ee5={'count':0x0,'rows':[]};var _0x23af93=_[_0x5c47('0x30')](db[_0x5c47('0x31')]['rawAttributes'],function(_0x175e68){return{'name':_0x175e68[_0x5c47('0x32')],'type':_0x175e68[_0x5c47('0x33')][_0x5c47('0x34')]};});_0x4f066a[_0x5c47('0x35')]=_[_0x5c47('0x30')](_0x23af93,_0x5c47('0x2e'));_0x4f066a[_0x5c47('0x36')]=_[_0x5c47('0x37')](_0x79d318['query']);_0x4f066a['filters']=_[_0x5c47('0x38')](_0x4f066a[_0x5c47('0x35')],_0x4f066a[_0x5c47('0x36')]);_0x4a1c63[_0x5c47('0x39')]=_['intersection'](_0x4f066a[_0x5c47('0x35')],qs['fields'](_0x79d318[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x4a1c63['attributes']=_0x4a1c63['attributes'][_0x5c47('0x3b')]?_0x4a1c63[_0x5c47('0x39')]:_0x4f066a[_0x5c47('0x35')];if(!_0x79d318[_0x5c47('0x36')]['hasOwnProperty']('nolimit')){_0x4a1c63[_0x5c47('0x23')]=qs[_0x5c47('0x23')](_0x79d318[_0x5c47('0x36')]['limit']);_0x4a1c63[_0x5c47('0x25')]=qs[_0x5c47('0x25')](_0x79d318[_0x5c47('0x36')][_0x5c47('0x25')]);}_0x4a1c63[_0x5c47('0x3c')]=qs[_0x5c47('0x3d')](_0x79d318['query'][_0x5c47('0x3d')]);_0x4a1c63[_0x5c47('0x3e')]=qs['filters'](_[_0x5c47('0x3f')](_0x79d318[_0x5c47('0x36')],_0x4f066a['filters']),_0x23af93);if(_0x79d318[_0x5c47('0x36')]['filter']){_0x4a1c63[_0x5c47('0x3e')]=_[_0x5c47('0x40')](_0x4a1c63['where'],{'$or':_[_0x5c47('0x30')](_0x23af93,function(_0x1dbd96){if(_0x1dbd96[_0x5c47('0x33')]!==_0x5c47('0x41')){var _0x43432c={};_0x43432c[_0x1dbd96[_0x5c47('0x2e')]]={'$like':'%'+_0x79d318[_0x5c47('0x36')][_0x5c47('0x42')]+'%'};return _0x43432c;}})});}_0x4a1c63=_[_0x5c47('0x40')]({},_0x4a1c63,_0x79d318[_0x5c47('0x43')]);var _0xcaf22e={'where':_0x4a1c63[_0x5c47('0x3e')]};return db[_0x5c47('0x31')][_0x5c47('0x24')](_0xcaf22e)[_0x5c47('0x2a')](function(_0x534763){_0x700ee5['count']=_0x534763;if(_0x79d318[_0x5c47('0x36')][_0x5c47('0x44')]){_0x4a1c63['include']=[{'all':!![]}];}return db[_0x5c47('0x31')][_0x5c47('0x45')](_0x4a1c63);})[_0x5c47('0x2a')](function(_0xe4639){_0x700ee5[_0x5c47('0x46')]=_0xe4639;return _0x700ee5;})[_0x5c47('0x2a')](respondWithFilteredResult(_0x2bf99b,_0x4a1c63))[_0x5c47('0x47')](handleError(_0x2bf99b,null));};exports['show']=function(_0x5bd2e1,_0x1e90ab){var _0x47b131={'raw':![],'where':{'id':_0x5bd2e1['params']['id']}},_0x47930c={};_0x47930c['model']=_[_0x5c47('0x37')](db[_0x5c47('0x31')][_0x5c47('0x48')]);_0x47930c[_0x5c47('0x36')]=_[_0x5c47('0x37')](_0x5bd2e1['query']);_0x47930c['filters']=_[_0x5c47('0x38')](_0x47930c[_0x5c47('0x35')],_0x47930c[_0x5c47('0x36')]);_0x47b131['attributes']=_['intersection'](_0x47930c[_0x5c47('0x35')],qs[_0x5c47('0x3a')](_0x5bd2e1[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x47b131[_0x5c47('0x39')]=_0x47b131[_0x5c47('0x39')][_0x5c47('0x3b')]?_0x47b131['attributes']:_0x47930c['model'];if(_0x5bd2e1[_0x5c47('0x36')][_0x5c47('0x44')]){_0x47b131[_0x5c47('0x49')]=[{'all':!![]}];}_0x47b131=_[_0x5c47('0x40')]({},_0x47b131,_0x5bd2e1[_0x5c47('0x43')]);return db[_0x5c47('0x31')][_0x5c47('0x4a')](_0x47b131)[_0x5c47('0x2a')](handleEntityNotFound(_0x1e90ab,null))[_0x5c47('0x2a')](respondWithResult(_0x1e90ab,null))['catch'](handleError(_0x1e90ab,null));};exports[_0x5c47('0x4b')]=function(_0x1604e6,_0x351d31){return db[_0x5c47('0x31')][_0x5c47('0x4b')](_0x1604e6[_0x5c47('0x4c')],{})[_0x5c47('0x2a')](respondWithResult(_0x351d31,0xc9))['catch'](handleError(_0x351d31,null));};exports[_0x5c47('0x4d')]=function(_0x5b8ef7,_0x24483c){var _0x1bcfc4={'where':{'id':_0x5b8ef7[_0x5c47('0x4e')]['id']}},_0x5a7ca6={};_0x5a7ca6[_0x5c47('0x35')]=_['keys'](db[_0x5c47('0x31')][_0x5c47('0x48')]);_0x1bcfc4['attributes']=_['intersection'](_0x5a7ca6[_0x5c47('0x35')],qs[_0x5c47('0x3a')](_0x5b8ef7[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x1bcfc4[_0x5c47('0x39')]=_0x1bcfc4[_0x5c47('0x39')][_0x5c47('0x3b')]?_0x1bcfc4[_0x5c47('0x39')]:_0x5a7ca6['model'];if(_0x5b8ef7[_0x5c47('0x36')][_0x5c47('0x44')]){_0x1bcfc4[_0x5c47('0x49')]=[{'all':!![]}];}_0x1bcfc4=_['merge']({},_0x1bcfc4,_0x5b8ef7[_0x5c47('0x43')]);return db[_0x5c47('0x31')]['find'](_0x1bcfc4)[_0x5c47('0x2a')](handleEntityNotFound(_0x24483c,null))[_0x5c47('0x2a')](function(_0x1b0c59){if(_0x1b0c59){var _0x1d9be1=_0x1b0c59[_0x5c47('0x4f')]({'plain':!![]});_0x1d9be1=qs[_0x5c47('0x50')](_0x1d9be1,['id','createdAt',_0x5c47('0x51'),_0x5c47('0x52')]);_0x5b8ef7['body']=_[_0x5c47('0x50')](_0x5b8ef7['body'],['id',_0x5c47('0x53'),_0x5c47('0x51')]);return db['sequelize'][_0x5c47('0x54')](function(_0x552732){return db['UserProfile'][_0x5c47('0x4b')](_['merge'](_0x1d9be1,_0x5b8ef7[_0x5c47('0x4c')]),{'include':_0x5b8ef7[_0x5c47('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x552732})['then'](function(_0x41007a){var _0x1bbcd1=_0x41007a[_0x5c47('0x4f')]({'plain':!![]});return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x5b8ef7[_0x5c47('0x4e')]['id']},'raw':!![]})[_0x5c47('0x2a')](function(_0x2f349a){if(_0x2f349a){return BPromise[_0x5c47('0x56')](_0x2f349a,function(_0x221b82){return new BPromise(function(_0x355469,_0x3cbfcc){if(_0x221b82['autoAssociation']===null||_0x221b82[_0x5c47('0x57')]===0x1)_0x355469(null);return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x221b82['id']},'raw':!![]})[_0x5c47('0x2a')](function(_0x188139){var _0xbedd5b=_[_0x5c47('0x30')](_0x188139,function(_0x824bbe){return qs[_0x5c47('0x50')](_0x824bbe,['id',_0x5c47('0x53'),_0x5c47('0x51'),_0x5c47('0x59')]);});_0x355469(_0xbedd5b);})[_0x5c47('0x47')](function(_0x3872e5){_0x3cbfcc(_0x3872e5);});})[_0x5c47('0x2a')](function(_0x4ed255){var _0x40b1a1=qs[_0x5c47('0x50')](_0x221b82,['id',_0x5c47('0x53'),'updatedAt']);_0x40b1a1[_0x5c47('0x5a')]=_0x1bbcd1['id'];if(_0x4ed255)_0x40b1a1[_0x5c47('0x5b')]=_0x4ed255;return _0x40b1a1;})[_0x5c47('0x2a')](function(_0x444bd3){return db[_0x5c47('0x55')][_0x5c47('0x4b')](_0x444bd3,{'include':[{'model':db['UserProfileResource'],'as':_0x5c47('0x5b')}],'raw':!![],'transaction':_0x552732});});})[_0x5c47('0x2a')](function(){return _0x1bbcd1;});}});});});}})['then'](respondWithResult(_0x24483c,0xc9))[_0x5c47('0x47')](handleError(_0x24483c,null));};exports[_0x5c47('0x5c')]=function(_0x1a5d53,_0x189b67){if(_0x1a5d53['body']['id']){delete _0x1a5d53[_0x5c47('0x4c')]['id'];}return db['UserProfile'][_0x5c47('0x4a')]({'where':{'id':_0x1a5d53['params']['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x189b67,null))[_0x5c47('0x2a')](saveUpdates(_0x1a5d53[_0x5c47('0x4c')],null))[_0x5c47('0x2a')](respondWithResult(_0x189b67,null))[_0x5c47('0x47')](handleError(_0x189b67,null));};exports[_0x5c47('0x29')]=function(_0x278ea2,_0x5ec32e){return db['UserProfile'][_0x5c47('0x4a')]({'where':{'id':_0x278ea2['params']['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x5ec32e,null))['then'](removeEntity(_0x5ec32e,null))[_0x5c47('0x47')](handleError(_0x5ec32e,null));};exports['describe']=function(_0x2f16ef,_0x44e376){return db['UserProfile'][_0x5c47('0x5d')]()[_0x5c47('0x2a')](respondWithResult(_0x44e376,null))[_0x5c47('0x47')](handleError(_0x44e376,null));};exports[_0x5c47('0x5e')]=function(_0xa89643,_0x19293b){var _0x266134=_0xa89643[_0x5c47('0x4c')];return db[_0x5c47('0x31')][_0x5c47('0x4a')]({'where':{'id':_0xa89643[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x19293b,null))[_0x5c47('0x2a')](function(_0x617f67){if(_0x617f67){return db['sequelize']['transaction'](function(_0x12efe6){return db[_0x5c47('0x55')][_0x5c47('0x29')]({'where':{'userProfileId':_0xa89643[_0x5c47('0x4e')]['id'],'sectionId':_[_0x5c47('0x30')](_0x266134,function(_0x55c465){return _0x55c465['sectionId'];})},'transaction':_0x12efe6})[_0x5c47('0x2a')](function(){var _0x27c8cb=_[_0x5c47('0x30')](_0x266134,function(_0x5e1763){_0x5e1763[_0x5c47('0x5a')]=_0xa89643[_0x5c47('0x4e')]['id'];return _0x5e1763;});var _0x3100a4=[];return BPromise['each'](_0x27c8cb,function(_0x259c3e){return db[_0x5c47('0x55')]['create'](_0x259c3e,{'include':[{'model':db['UserProfileResource'],'as':_0x5c47('0x5b')}],'raw':!![],'transaction':_0x12efe6})['then'](function(_0x19d3fa){_0x3100a4[_0x5c47('0x5f')](_0x19d3fa[_0x5c47('0x4f')]({'plain':!![]}));});})[_0x5c47('0x2a')](function(){return _0x3100a4;});});});}})[_0x5c47('0x2a')](function(_0x4b2148){return _0x4b2148;})[_0x5c47('0x2a')](respondWithResult(_0x19293b,null))['catch'](handleError(_0x19293b,null));};exports[_0x5c47('0x60')]=function(_0x1a5eb5,_0x1df33d){var _0x34e745;return db['UserProfile']['find']({'where':{'id':_0x1a5eb5[_0x5c47('0x4e')]['id']},'attributes':['id',_0x5c47('0x2e')]})[_0x5c47('0x2a')](handleEntityNotFound(_0x1df33d,null))['then'](function(_0x169ec8){if(_0x169ec8){_0x34e745=_0x169ec8;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1a5eb5[_0x5c47('0x4e')]['id'],'sectionId':_0x1a5eb5[_0x5c47('0x36')][_0x5c47('0x61')]}});}})['then'](function(){return _0x34e745;})[_0x5c47('0x2a')](respondWithStatusCode(_0x1df33d,null))[_0x5c47('0x47')](handleError(_0x1df33d,null));};exports[_0x5c47('0x62')]=function(_0x2f72ba,_0xd99b44){var _0x286b59=[];var _0x3ad4db=[];return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x2f72ba[_0x5c47('0x4e')]['id']},'raw':!![]})['then'](function(_0x390f34){_0x286b59=_[_0x5c47('0x42')](_0x390f34,function(_0x47d02b){return _0x47d02b[_0x5c47('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x47d02b['sectionId']);});if(!_[_0x5c47('0x64')](_0x286b59)){return _['map'](_0x286b59,function(_0x3a0c5b){return _0x3a0c5b[_0x5c47('0x59')];});}else{return;}})[_0x5c47('0x2a')](function(_0x54e012){if(_0x54e012)_0x3ad4db=_0x54e012;if(_['includes'](_0x3ad4db,0x64)){var _0x238150=_[_0x5c47('0x4a')](_0x286b59,{'sectionId':0x64});return hasDefaultDashboard(_0x238150)[_0x5c47('0x2a')](function(_0x4f7086){return _['map'](_0x286b59,function(_0x294938){if(_0x294938[_0x5c47('0x59')]===0x64){_0x294938[_0x5c47('0x65')]=_0x4f7086;}return _0x294938;});});}else{return;}})[_0x5c47('0x2a')](function(_0xd54304){if(_0xd54304)_0x286b59=_0xd54304;if(_[_0x5c47('0x66')](_0x3ad4db,0x3eb)){var _0x3d09c9=_['find'](_0x286b59,{'sectionId':0x3eb});return getCustomDashboards(_0x3d09c9)[_0x5c47('0x2a')](function(_0x1c6266){return _['map'](_0x286b59,function(_0x25822e){if(_0x3d09c9['enabled']){if(_0x25822e[_0x5c47('0x59')]===0x3eb){_0x25822e[_0x5c47('0x65')]=_0x1c6266;}}else{if(_0x25822e[_0x5c47('0x59')]===0x64){if(!_0x25822e[_0x5c47('0x65')]){_0x25822e['subsections']=[];}_0x25822e[_0x5c47('0x65')]=_0x25822e[_0x5c47('0x65')][_0x5c47('0x67')](_0x1c6266);}}return _0x25822e;});});}else{return;}})[_0x5c47('0x2a')](function(_0x496f52){if(_0x496f52)_0x286b59=_0x496f52;if(_[_0x5c47('0x66')](_0x3ad4db,0x709)){var _0x460f0e=_[_0x5c47('0x4a')](_0x286b59,{'sectionId':0x709});return getPlugins(_0x460f0e)[_0x5c47('0x2a')](function(_0x20757a){if(_0x460f0e[_0x5c47('0x63')]){return _[_0x5c47('0x30')](_0x286b59,function(_0x318acf){if(_0x318acf['sectionId']===0x709){_0x318acf[_0x5c47('0x65')]=_0x20757a;}return _0x318acf;});}else{var _0x3a46c6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x20757a};var _0x1bbfa4=_[_0x5c47('0x30')](_0x286b59);_0x1bbfa4[_0x5c47('0x5f')](_0x3a46c6);return _0x1bbfa4;}});}else{return;}})[_0x5c47('0x2a')](function(_0x128468){if(_0x128468)_0x286b59=_0x128468;return _[_0x5c47('0x42')](_0x286b59,[_0x5c47('0x63'),0x1]);})[_0x5c47('0x2a')](respondWithResult(_0xd99b44,null))[_0x5c47('0x47')](handleError(_0xd99b44,null));};function hasDefaultDashboard(_0x18c8c4){var _0x4d69bb=[0x65];return new BPromise(function(_0x330653,_0x48a6ce){try{if(_0x18c8c4[_0x5c47('0x57')]){_0x330653(_0x4d69bb);}else{return db[_0x5c47('0x58')][_0x5c47('0x68')]({'where':{'sectionId':_0x18c8c4['id']},'raw':!![]})['then'](function(_0x5dc1fc){_0x5dc1fc?_0x330653(_0x4d69bb):_0x330653();});}}catch(_0x107108){_0x48a6ce(_0x107108);}});}function getCustomDashboards(_0x279bd4){var _0x1ad603=[];return new BPromise(function(_0x5aed0f,_0x80cce1){try{if(_0x279bd4['autoAssociation']){return db[_0x5c47('0x69')][_0x5c47('0x45')]({'raw':!![]})[_0x5c47('0x2a')](function(_0x4134d4){_0x4134d4[_0x5c47('0x6a')](function(_0x14222e){_0x1ad603[_0x5c47('0x5f')](_0x14222e['id']+0x1869f);});_0x5aed0f(_0x1ad603);});}else{return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x279bd4['id']},'raw':!![]})['then'](function(_0x3ce425){_0x3ce425[_0x5c47('0x6a')](function(_0x58cc3d){_0x1ad603[_0x5c47('0x5f')](_0x58cc3d[_0x5c47('0x6b')]+0x1869f);});_0x5aed0f(_0x1ad603);});}}catch(_0x5d297f){_0x80cce1(_0x5d297f);}});}function getPlugins(_0x3871bc){var _0x1e8252=[];return new BPromise(function(_0x115175,_0x103b49){try{if(_0x3871bc[_0x5c47('0x57')]){return db[_0x5c47('0x6c')][_0x5c47('0x45')]({'raw':!![]})[_0x5c47('0x2a')](function(_0x4880e0){_0x4880e0[_0x5c47('0x6a')](function(_0x494018){_0x1e8252[_0x5c47('0x5f')](_0x494018['id']+0x15b38);});_0x115175(_0x1e8252);});}else{return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x3871bc['id']},'raw':!![]})['then'](function(_0x4cc045){_0x4cc045[_0x5c47('0x6a')](function(_0x2415be){_0x1e8252[_0x5c47('0x5f')](_0x2415be[_0x5c47('0x6b')]+0x15b38);});_0x115175(_0x1e8252);});}}catch(_0x5e91b9){_0x103b49(_0x5e91b9);}});}exports[_0x5c47('0x6d')]=function(_0x3eff63,_0x4136a9){return db[_0x5c47('0x31')][_0x5c47('0x4a')]({'where':{'id':_0x3eff63[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x4136a9,null))[_0x5c47('0x2a')](function(_0x4fb7b0){if(_0x4fb7b0){return db['sequelize']['transaction'](function(_0x7d86ad){return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x5c47('0x2a')](function(_0x392c4c){if(_0x392c4c){return db[_0x5c47('0x55')]['destroy']({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id'],'id':_['map'](_0x392c4c,function(_0x537686){return _0x537686['id'];})},'transaction':_0x7d86ad});}})[_0x5c47('0x2a')](function(_0x564f32){var _0x3830ea=_['map'](_0x3eff63[_0x5c47('0x4c')],function(_0x57143f){_0x57143f[_0x5c47('0x5a')]=_0x3eff63[_0x5c47('0x4e')]['id'];return _0x57143f;});return db[_0x5c47('0x55')]['bulkCreate'](_0x3830ea,{'raw':!![],'transaction':_0x7d86ad});})[_0x5c47('0x2a')](function(_0x46643d){var _0x1ac9bb=_[_0x5c47('0x42')](_[_0x5c47('0x30')](_0x46643d,function(_0x3e8f23){return _0x3e8f23[_0x5c47('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ac9bb){return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id'],'sectionId':_[_0x5c47('0x30')](_0x1ac9bb,function(_0x38a1c9){return _0x38a1c9[_0x5c47('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x3c0fdd){var _0x2f4af4=_['map'](_0x3eff63[_0x5c47('0x4c')],function(_0x2ff0d2){_0x2ff0d2[_0x5c47('0x5a')]=_0x3eff63[_0x5c47('0x4e')]['id'];return _0x2ff0d2;});return db[_0x5c47('0x58')]['bulkCreate'](_0x2f4af4,{'raw':!![],'transaction':_0x7d86ad});});}})[_0x5c47('0x47')](handleError(_0x4136a9,null));});}})[_0x5c47('0x2a')](function(_0x3ef80b){var _0x365a63=_[_0x5c47('0x30')](_0x3ef80b,function(_0x5aa437){return _0x5aa437[_0x5c47('0x4f')]({'plain':!![]});});})[_0x5c47('0x2a')](respondWithResult(_0x4136a9,null))[_0x5c47('0x47')](handleError(_0x4136a9,null));};exports[_0x5c47('0x6e')]=function(_0x18351a,_0x5c0064,_0x1a5d94){return db[_0x5c47('0x31')]['find']({'where':{'id':_0x18351a[_0x5c47('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5c0064,null))[_0x5c47('0x2a')](function(_0x2592d8){if(_0x2592d8){return _0x2592d8[_0x5c47('0x6e')](_0x18351a[_0x5c47('0x36')]['ids']);}})[_0x5c47('0x2a')](respondWithStatusCode(_0x5c0064,null))['catch'](handleError(_0x5c0064,null));};exports[_0x5c47('0x6f')]=function(_0x2c23c4,_0x3050ea){var _0x28e28a={};if(!_0x2c23c4['query'][_0x5c47('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x2c23c4['query'][_0x5c47('0x71')]('nolimit')){_0x28e28a['limit']=qs['limit'](_0x2c23c4[_0x5c47('0x36')][_0x5c47('0x23')]);_0x28e28a[_0x5c47('0x25')]=qs[_0x5c47('0x25')](_0x2c23c4[_0x5c47('0x36')][_0x5c47('0x25')]);}return db[_0x5c47('0x31')]['find']({'where':{'id':_0x2c23c4[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](function(_0x4cbc55){if(!_0x4cbc55)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2c23c4['params']['id']);return db[_0x5c47('0x31')][_0x5c47('0x6f')](_0x2c23c4);})[_0x5c47('0x2a')](respondWithFilteredResult(_0x3050ea,_0x28e28a))[_0x5c47('0x47')](handleError(_0x3050ea,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b78bfbc..9c5773f 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 _0xffd6=['../../mysqldb','UserProfile','update','remove','emit','hook','exports','events'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xffd6,0x97));var _0x6ffd=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xffd6[_0x13b8f3];return _0x1a6d06;};'use strict';var EventEmitter=require(_0x6ffd('0x0'));var UserProfile=require(_0x6ffd('0x1'))['db'][_0x6ffd('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ffd('0x3'),'afterDestroy':_0x6ffd('0x4')};function emitEvent(_0x39fd49){return function(_0x560afa,_0x1d12e3,_0x173979){UserProfileEvents[_0x6ffd('0x5')](_0x39fd49+':'+_0x560afa['id'],_0x560afa);UserProfileEvents[_0x6ffd('0x5')](_0x39fd49,_0x560afa);_0x173979(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x6ffd('0x6')](e,emitEvent(event));}}module[_0x6ffd('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','update','remove'];(function(_0x2c919a,_0x47c5e6){var _0x4a6261=function(_0x3e6f50){while(--_0x3e6f50){_0x2c919a['push'](_0x2c919a['shift']());}};_0x4a6261(++_0x47c5e6);}(_0x002d,0xca));var _0xd002=function(_0x55fb1e,_0x6caf25){_0x55fb1e=_0x55fb1e-0x0;var _0x27bf71=_0x002d[_0x55fb1e];return _0x27bf71;};'use strict';var EventEmitter=require(_0xd002('0x0'));var UserProfile=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){UserProfileEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);UserProfileEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];UserProfile[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f3567a1..6e1cb5b 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 _0x89fe=['field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceRecording','membername','User','role','agent','Telephones','VoiceQueues','VoiceQueue','type','inbound','QueueCampaigns','queue','outbound','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','openchannelqueues','OpenchannelQueue','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','Team','voicequeues','queuecampaigns','parentSections','agents','telephones','Users','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','_interactions','where','sequelize','toString','OpenTabs','UserProfile','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','all','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','key','VIRTUAL','foreignKey','forEach','merge','include','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','fax','mail','lodash','squel','models','filter'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x89fe,0x162));var _0xe89f=function(_0xc91845,_0xe67795){_0xc91845=_0xc91845-0x0;var _0x5a1332=_0x89fe[_0xc91845];return _0x5a1332;};'use strict';var _=require(_0xe89f('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xe89f('0x1'));module['exports']=function(_0x28a763){var _0x404186=_0x28a763[_0xe89f('0x2')];function _0x235106(_0x360c0e,_0x3e1235){return new Promise(function(_0x497bf8,_0xcf8e47){if(!_0x3e1235)return _0x497bf8(null);var _0x3ae749=_0x3e1235[_0xe89f('0x3')]?{[_0x3e1235[_0xe89f('0x3')][_0xe89f('0x4')]]:_0x3e1235[_0xe89f('0x3')][_0xe89f('0x5')]}:undefined;return _0x404186[_0x360c0e][_0xe89f('0x6')]({'where':_0x3ae749,'raw':!![]})[_0xe89f('0x7')](function(_0xb44cbb){_0x3e1235[_0xe89f('0x8')]=_[_0xe89f('0x9')](_0xb44cbb,'id');_0x497bf8(_0x3e1235);})[_0xe89f('0xa')](function(_0x4ef2d8){_0xcf8e47(_0x4ef2d8);});});}function _0xd351c2(_0x1e2468,_0x6b1497){return new Promise(function(_0x5e14a6,_0x5837db){var _0x509bbf=_0x1e2468[_0xe89f('0x3')]?{[_0x1e2468[_0xe89f('0x3')][_0xe89f('0x4')]]:_0x1e2468['filter']['value']}:undefined;return _0x404186[_0x1e2468[_0xe89f('0xb')]][_0xe89f('0x6')]({'where':_0x509bbf,'raw':!![]})[_0xe89f('0x7')](function(_0x5448f3){_0x6b1497[_0xe89f('0x8')]=_[_0xe89f('0x9')](_0x5448f3,function(_0x12f0a0){return _0x12f0a0[_0xe89f('0xc')];});_0x5e14a6(_0x6b1497);})[_0xe89f('0xa')](function(_0x3d3005){_0x5837db(_0x3d3005);});});}function _0x360c98(_0x11b090,_0x1a963b,_0x433fe8){if(!_0x1a963b)return Promise[_0xe89f('0xd')](null);return new Promise(function(_0x575ce9,_0x5c9743){return _0x404186[_0xe89f('0xe')][_0xe89f('0x6')]({'where':{'sectionId':_0x1a963b['id']},'raw':!![]})[_0xe89f('0x7')](function(_0x3bdf09){if(_0x11b090[_0xe89f('0x4')]&&_0x11b090['field']!=='id'){_0x1a963b[_0xe89f('0x8')]=_[_0xe89f('0x9')](_0x3bdf09,function(_0x2b6c7b){return _0x2b6c7b[_0x11b090[_0xe89f('0x4')]];});}else{if(_0x433fe8===_0xe89f('0xf')){_0x1a963b[_0xe89f('0x8')]=_['map'](_0x3bdf09,function(_0x58801b){return{'id':_0x58801b[_0xe89f('0x10')],'type':_0x58801b['type']};});}else{_0x1a963b[_0xe89f('0x8')]=_[_0xe89f('0x9')](_0x3bdf09,function(_0x1fdf46){return _0x1fdf46['resourceId'];});}}_0x575ce9(_0x1a963b);})[_0xe89f('0xa')](function(_0x55b09f){_0x5c9743(_0x55b09f);});});}function _0x1b24b8(_0xdada28,_0xdcef94){var _0x1ccd3a={'parentSections':[]};switch(_0xdada28[_0xe89f('0x11')]()){case _0xe89f('0x12'):_0x1ccd3a[_0xe89f('0x13')]='SquareProject';break;case _0xe89f('0x14'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x15');break;case _0xe89f('0x16'):_0x1ccd3a['childModel']=_0xe89f('0x17');_0x1ccd3a['parentSections']=[{'name':'SquareProjects','field':_0xe89f('0xc'),'foreignKey':_0xe89f('0x18')}];break;case'projects':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x19');break;case _0xe89f('0x1a'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x1b');_0x1ccd3a['parentSections']=[{'name':_0xe89f('0x1c'),'field':'id','foreignKey':_0xe89f('0x1d')}];break;case'lists':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x1e');break;case'companies':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x1f');break;case _0xe89f('0x20'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x21');break;case _0xe89f('0x22'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x23');break;case _0xe89f('0x24'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x25');break;case _0xe89f('0x26'):_0x1ccd3a['childModel']=_0xe89f('0x27');break;case _0xe89f('0x28'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x29');break;case _0xe89f('0x2a'):case _0xe89f('0x2b'):case _0xe89f('0x2c'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x2d');break;case _0xe89f('0x2e'):_0x1ccd3a[_0xe89f('0x13')]='VoiceContext';break;case'voicemails':_0x1ccd3a['childModel']='VoiceMail';break;case'voicerecordings':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x2f');_0x1ccd3a['parentSections']=[{'name':'Agents','field':_0xe89f('0xc'),'foreignKey':_0xe89f('0x30'),'model':_0xe89f('0x31'),'filter':{'field':_0xe89f('0x32'),'value':[_0xe89f('0x33')]}},{'name':_0xe89f('0x34'),'field':_0xe89f('0xc'),'foreignKey':_0xe89f('0x30'),'model':_0xe89f('0x31'),'filter':{'field':_0xe89f('0x32'),'value':['telephone']}},{'name':_0xe89f('0x35'),'field':_0xe89f('0xc'),'foreignKey':'queue','model':_0xe89f('0x36'),'filter':{'field':_0xe89f('0x37'),'value':[_0xe89f('0x38')]}},{'name':_0xe89f('0x39'),'field':_0xe89f('0xc'),'foreignKey':_0xe89f('0x3a'),'model':_0xe89f('0x36'),'filter':{'field':'type','value':[_0xe89f('0x3b')]}}];break;case'musiconholds':_0x1ccd3a[_0xe89f('0x13')]='VoiceMusicOnHold';break;case _0xe89f('0x3c'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x3d');break;case'voiceprefixes':_0x1ccd3a['childModel']=_0xe89f('0x3e');break;case _0xe89f('0x3f'):_0x1ccd3a['childModel']=_0xe89f('0x40');break;case _0xe89f('0x41'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x42');break;case _0xe89f('0x43'):_0x1ccd3a[_0xe89f('0x13')]='MailAccount';break;case'mailsubstatuses':_0x1ccd3a['childModel']='MailSubstatus';break;case _0xe89f('0x44'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x45');break;case'openchannelaccounts':_0x1ccd3a[_0xe89f('0x13')]='OpenchannelAccount';break;case _0xe89f('0x46'):_0x1ccd3a[_0xe89f('0x13')]='SmsQueue';break;case _0xe89f('0x47'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x48');break;case _0xe89f('0x49'):_0x1ccd3a['childModel']=_0xe89f('0x4a');break;case'whatsappaccounts':_0x1ccd3a[_0xe89f('0x13')]='WhatsappAccount';break;case'teams':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x4b');break;case _0xe89f('0x4c'):case _0xe89f('0x4d'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x36');if(_0xdcef94){_0x1ccd3a[_0xe89f('0x4e')]=[{'name':_0xe89f('0x35')},{'name':_0xe89f('0x39')}];}break;case'users':case _0xe89f('0x4f'):case _0xe89f('0x50'):_0x1ccd3a['childModel']=_0xe89f('0x31');if(_0xdcef94){_0x1ccd3a[_0xe89f('0x4e')]=[{'name':_0xe89f('0x51'),'filter':{'field':'role','value':['admin',_0xe89f('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x53');break;case'salesforceaccounts':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x54');break;case _0xe89f('0x55'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x56');break;case'sugarcrmaccounts':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x57');break;case _0xe89f('0x58'):_0x1ccd3a[_0xe89f('0x13')]='DeskAccount';break;case _0xe89f('0x59'):_0x1ccd3a['childModel']=_0xe89f('0x5a');break;case _0xe89f('0x5b'):_0x1ccd3a[_0xe89f('0x13')]='User';break;case _0xe89f('0x5c'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x5d');break;case _0xe89f('0x5e'):_0x1ccd3a[_0xe89f('0x13')]='Disposition';break;case _0xe89f('0x5f'):_0x1ccd3a['childModel']=_0xe89f('0x60');break;case'intervals':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x61');break;case _0xe89f('0x62'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x63');break;case'scheduler':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x64');break;case _0xe89f('0x65'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x66');break;case _0xe89f('0x67'):_0x1ccd3a['childModel']=_0xe89f('0x68');break;case'templates':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x69');break;case _0xe89f('0x6a'):_0x1ccd3a['childModel']=_0xe89f('0x6b');break;case'trunks':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x6c');break;case'variables':_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x6d');break;case _0xe89f('0x6e'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0x6f');break;case _0xe89f('0x70'):_0x1ccd3a[_0xe89f('0x13')]=_0xe89f('0xf');_0x1ccd3a[_0xe89f('0x4e')]=[{'name':_0xe89f('0x71'),'field':'id','foreignKey':_0xe89f('0x72')}];break;case'metrics':_0x1ccd3a[_0xe89f('0x13')]='AnalyticMetric';break;}return _0x1ccd3a;}function _0x4ef5c7(_0x2bab11,_0x3422d1){var _0x307744=_0x2bab11[_0xe89f('0x73')](0x0)['toUpperCase']()+_0x2bab11[_0xe89f('0x74')](0x1);var _0x14cd75={'type':_0x404186['Sequelize'][_0xe89f('0x75')][_0xe89f('0x76')],'raw':!![]};return new Promise(function(_0x5a4098,_0x225f9a){var _0x5637e0=squel[_0xe89f('0x77')]()[_0xe89f('0x4')]('ui.'+_0x307744+'InteractionId','id')[_0xe89f('0x4')](_0xe89f('0x78'))[_0xe89f('0x79')](_0xe89f('0x7a')+_0x2bab11+_0xe89f('0x7b'),'ui')[_0xe89f('0x7c')]('ui.UserId\x20=\x20?',_0x3422d1['id']);return _0x404186[_0xe89f('0x7d')]['query'](_0x5637e0[_0xe89f('0x7e')](),_0x14cd75)[_0xe89f('0x7')](function(_0x346ca6){_0x3422d1[_0x307744+_0xe89f('0x7f')]=_0x346ca6;_0x5a4098(_0x346ca6);})['catch'](function(_0x1b1acf){_0x225f9a(_0x1b1acf);});});}return _0x28a763['define'](_0xe89f('0x80'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5a439e){var _0x293ab0=require(_0xe89f('0x81'));var _0x167c51={'raw':_0x5a439e[_0xe89f('0x82')][_0xe89f('0x83')],'where':{}};var _0x1eaa6a={};var _0x1f2227={'count':0x0,'rows':[]};var _0x1a1bd9=_0x5a439e[_0xe89f('0x82')][_0xe89f('0x84')];var _0x162a8c=_0x5a439e[_0xe89f('0x82')][_0xe89f('0x85')]||![];var _0x9fbd3c=_0x1b24b8(_0x1a1bd9,_0x162a8c);if(!_0x9fbd3c[_0xe89f('0x13')])throw new Error(_0xe89f('0x86')+_0x1a1bd9+'\x27');var _0x343829=[{'name':_0x1a1bd9}];if(!_[_0xe89f('0x87')](_0x9fbd3c['parentSections']))_0x343829=_0x9fbd3c[_0xe89f('0x4e')];var _0x811b4f=[];for(var _0x5cc5d9=0x0;_0x5cc5d9<_0x343829[_0xe89f('0x88')];_0x5cc5d9++){_0x811b4f[_0xe89f('0x89')](_0x404186[_0xe89f('0x8a')][_0xe89f('0x8b')]({'where':{'userProfileId':_0x5a439e[_0xe89f('0x8c')]['id'],'name':_0x343829[_0x5cc5d9]['name']},'raw':!![]}));}return Promise['all'](_0x811b4f)[_0xe89f('0x7')](function(_0x3faf32){var _0x4ee602=_[_0xe89f('0x3')](_0x3faf32,function(_0x539cc4){return _0x539cc4?_0x539cc4:undefined;});var _0x5b22c0=_[_0xe89f('0x3')](_0x343829,[_0xe89f('0x8d'),!![]]);var _0x325607=_['isEmpty'](_0x4ee602)&&_[_0xe89f('0x87')](_0x5b22c0)?null:_[_0xe89f('0x8e')](_0x5b22c0,_0x4ee602);if(!_0x325607)return null;var _0x863adb=[];for(var _0x36f2b3=0x0;_0x36f2b3<_0x325607[_0xe89f('0x88')];_0x36f2b3++){var _0x4bb945=_['find'](_0x343829,function(_0x369802){return _0x325607[_0x36f2b3]?_0x369802[_0xe89f('0xc')]===_0x325607[_0x36f2b3][_0xe89f('0xc')]:null;});if(_0x4bb945){if(_0x325607[_0x36f2b3][_0xe89f('0x8d')]){_0x863adb[_0xe89f('0x89')](_0x235106(_0x9fbd3c[_0xe89f('0x13')],_0x325607[_0x36f2b3]));}else{if(!_0x325607[_0x36f2b3][_0xe89f('0x8f')]){_0x863adb['push'](_0x360c98(_0x4bb945,_0x325607[_0x36f2b3],_0x9fbd3c[_0xe89f('0x13')]));}else{if(_0x4bb945[_0xe89f('0xb')]){_0x863adb['push'](_0xd351c2(_0x4bb945,_0x325607[_0x36f2b3]));}}}}}return Promise[_0xe89f('0x90')](_0x863adb);})[_0xe89f('0x7')](function(_0xf8deec){var _0x51eb12=_0xf8deec;var _0x1d05cd=null;if(_0x51eb12){_0x1d05cd=_0x51eb12[_0xe89f('0x88')]===0x1?_0x51eb12[0x0]:null;}if(!_0x1d05cd&&!_0x51eb12)return _0x1f2227;var _0x1abfec=_0x404186[_0x9fbd3c[_0xe89f('0x13')]]['rawAttributes'];_0x1eaa6a[_0xe89f('0xb')]=_[_0xe89f('0x91')](_0x1abfec);_0x1eaa6a[_0xe89f('0x82')]=_[_0xe89f('0x91')](_0x5a439e[_0xe89f('0x82')]);_0x1eaa6a[_0xe89f('0x92')]=_[_0xe89f('0x93')](_0x1eaa6a[_0xe89f('0xb')],_0x1eaa6a[_0xe89f('0x82')]);_0x167c51[_0xe89f('0x94')]=_[_0xe89f('0x93')](_0x1eaa6a[_0xe89f('0xb')],_0x293ab0[_0xe89f('0x95')](_0x5a439e[_0xe89f('0x82')][_0xe89f('0x95')]));_0x167c51[_0xe89f('0x94')]=_0x167c51[_0xe89f('0x94')][_0xe89f('0x88')]?_0x167c51[_0xe89f('0x94')]:_0x1eaa6a['model'];if(!_0x5a439e[_0xe89f('0x82')][_0xe89f('0x96')](_0xe89f('0x97'))){_0x167c51[_0xe89f('0x98')]=_0x293ab0[_0xe89f('0x98')](_0x5a439e[_0xe89f('0x82')][_0xe89f('0x98')]);_0x167c51[_0xe89f('0x99')]=_0x293ab0[_0xe89f('0x99')](_0x5a439e['query'][_0xe89f('0x99')]);}_0x167c51[_0xe89f('0x9a')]=_0x293ab0['sort'](_0x5a439e[_0xe89f('0x82')]['sort']);_0x167c51['where']=_0x293ab0[_0xe89f('0x92')](_['pick'](_0x5a439e[_0xe89f('0x82')],_0x1eaa6a[_0xe89f('0x92')]));if(_0x5a439e['query']['filter']){_0x167c51[_0xe89f('0x7c')]=_['merge'](_0x167c51[_0xe89f('0x7c')],{'$or':_[_0xe89f('0x9')](_0x1abfec,function(_0x550f98){if(_0x550f98[_0xe89f('0x37')][_0xe89f('0x9b')]!==_0xe89f('0x9c')){var _0x1470d7={};_0x1470d7[_0x550f98['field']]={'$like':'%'+_0x5a439e[_0xe89f('0x82')][_0xe89f('0x3')]+'%'};return _0x1470d7;}})});}var _0x5d9758=[];var _0x25358c=null;var _0x5853f={};if(_0x1d05cd){_0x25358c=_[_0xe89f('0x8b')](_0x343829,[_0xe89f('0xc'),_0x1d05cd[_0xe89f('0xc')]]);if(_0x25358c['field']){_0x5853f={};if(_0x9fbd3c['childModel']===_0xe89f('0xf')){_0x5853f[_0x25358c[_0xe89f('0x9d')]]=_[_0xe89f('0x9')](_0x1d05cd['associatedResources'],'id');}else{_0x5853f[_0x25358c['foreignKey']]=_0x1d05cd[_0xe89f('0x8')];}_0x5d9758[_0xe89f('0x89')](_0x5853f);}else{_0x167c51['where']['id']=_0x1d05cd[_0xe89f('0x8')];}}else{for(var _0x14fde2=0x0;_0x14fde2<_0x51eb12['length'];_0x14fde2++){_0x25358c=_[_0xe89f('0x8b')](_0x343829,[_0xe89f('0xc'),_0x51eb12[_0x14fde2][_0xe89f('0xc')]]);if(_0x25358c[_0xe89f('0x4')]){_0x5853f={};_0x5853f[_0x25358c[_0xe89f('0x9d')]]=_0x51eb12[_0x14fde2]['associatedResources'];_0x5d9758[_0xe89f('0x89')](_0x5853f);}else{if(!_0x167c51['where']['id'])_0x167c51[_0xe89f('0x7c')]['id']=[];_0x51eb12[_0x14fde2][_0xe89f('0x8')][_0xe89f('0x9e')](function(_0x5ad7a5){_0x167c51[_0xe89f('0x7c')]['id']['push'](_0x5ad7a5);});}}}if(!_[_0xe89f('0x87')](_0x5d9758)){_0x167c51['where']=_[_0xe89f('0x9f')](_0x167c51[_0xe89f('0x7c')],{'$and':{'$or':_0x5d9758}});}_0x167c51=_['merge']({},_0x167c51,_0x5a439e['options']);if(_0x1d05cd&&!_0x1d05cd[_0xe89f('0x8f')]&&_0x9fbd3c[_0xe89f('0x13')]===_0xe89f('0xf')){if(_0x5a439e[_0xe89f('0x82')]['includeAll']){_0x167c51[_0xe89f('0xa0')]=[{'all':!![]}];}return _0x404186[_0x9fbd3c['childModel']][_0xe89f('0x6')](_0x167c51)[_0xe89f('0x7')](function(_0x1e6a60){var _0x18462d=[];_0x1e6a60[_0xe89f('0x9e')](function(_0x129a0e){var _0x3dacad;switch(_0x129a0e['reportType']){case'default':_0x3dacad=_[_0xe89f('0x8b')](_0x1d05cd[_0xe89f('0x8')],function(_0x2e9cfe){return _0x2e9cfe['id']===_0x129a0e[_0xe89f('0x72')]&&_0x2e9cfe[_0xe89f('0x37')]===_0xe89f('0xa1');});break;case'custom':_0x3dacad=_[_0xe89f('0x8b')](_0x1d05cd[_0xe89f('0x8')],function(_0x13afb0){return _0x13afb0['id']===_0x129a0e['reportId']&&_0x13afb0[_0xe89f('0x37')]===_0xe89f('0xa2');});break;}if(_0x3dacad)_0x18462d[_0xe89f('0x89')](_0x129a0e);});_0x1f2227[_0xe89f('0xa3')]=_0x18462d['length'];_0x1f2227[_0xe89f('0xa4')]=_0x18462d;return _0x1f2227;});}else{if(!_[_0xe89f('0x87')](_0x5a439e[_0xe89f('0x82')][_0xe89f('0xa5')])){_0x167c51[_0xe89f('0x7c')]['id']=_0x167c51['where']['id']?_[_0xe89f('0x93')](_0x167c51['where']['id'],_0x5a439e[_0xe89f('0x82')][_0xe89f('0xa5')]):_0x5a439e[_0xe89f('0x82')]['ids'];if(_0x5a439e['query'][_0xe89f('0xa6')]){_0x167c51[_0xe89f('0x9a')]=_0x5a439e[_0xe89f('0x82')][_0xe89f('0xa6')];}}if(_0x5a439e[_0xe89f('0x82')]['extraQueryConditions']){_0x167c51['where']=_[_0xe89f('0x9f')](_0x167c51['where'],{'$and':_0x5a439e[_0xe89f('0x82')][_0xe89f('0xa7')]});}return _0x404186[_0x9fbd3c[_0xe89f('0x13')]][_0xe89f('0xa3')]({'where':_0x167c51[_0xe89f('0x7c')]})[_0xe89f('0x7')](function(_0x1b1750){_0x1f2227['count']=_0x1b1750;if(_0x5a439e[_0xe89f('0x82')][_0xe89f('0xa8')]){if(_0x9fbd3c['childModel']===_0xe89f('0x1b')){_0x167c51[_0xe89f('0xa0')]=[{'model':_0x404186['Tag'],'as':_0xe89f('0xa9'),'attributes':['id',_0xe89f('0xc'),_0xe89f('0xaa')],'required':_0x5a439e[_0xe89f('0x82')]['tag']?!![]:![]},{'model':_0x404186[_0xe89f('0x68')],'as':_0xe89f('0xab'),'attributes':['id',_0xe89f('0xc'),_0xe89f('0xaa')],'through':_0x5a439e['query'][_0xe89f('0xac')]?{'attributes':[],'where':{'TagId':_0x5a439e[_0xe89f('0x82')]['tag']||undefined}}:{},'required':_0x5a439e[_0xe89f('0x82')][_0xe89f('0xac')]?!![]:![]}];}else{_0x167c51[_0xe89f('0xa0')]=[{'all':!![]}];}}return _0x404186[_0x9fbd3c[_0xe89f('0x13')]][_0xe89f('0x6')](_0x167c51);})[_0xe89f('0x7')](function(_0x17772c){_0x1f2227[_0xe89f('0xa4')]=_0x17772c;if(_0x1a1bd9==='Agents'&&_0x5a439e['query'][_0xe89f('0xad')]===_0xe89f('0xae')){var _0x24ba47=[];for(var _0x444c17=0x0;_0x444c17<_0x1f2227[_0xe89f('0xa4')]['length'];_0x444c17++){_0x24ba47[_0xe89f('0x89')](_0x4ef5c7(_0xe89f('0xaf'),_0x1f2227[_0xe89f('0xa4')][_0x444c17][_0xe89f('0xb0')]));_0x24ba47[_0xe89f('0x89')](_0x4ef5c7('sms',_0x1f2227['rows'][_0x444c17][_0xe89f('0xb0')]));_0x24ba47[_0xe89f('0x89')](_0x4ef5c7(_0xe89f('0xb1'),_0x1f2227[_0xe89f('0xa4')][_0x444c17][_0xe89f('0xb0')]));_0x24ba47[_0xe89f('0x89')](_0x4ef5c7(_0xe89f('0xb2'),_0x1f2227[_0xe89f('0xa4')][_0x444c17][_0xe89f('0xb0')]));_0x24ba47['push'](_0x4ef5c7('openchannel',_0x1f2227[_0xe89f('0xa4')][_0x444c17][_0xe89f('0xb0')]));_0x24ba47[_0xe89f('0x89')](_0x4ef5c7('whatsapp',_0x1f2227[_0xe89f('0xa4')][_0x444c17][_0xe89f('0xb0')]));}return Promise[_0xe89f('0x90')](_0x24ba47)[_0xe89f('0x7')](function(){return _0x1f2227;});}return _0x1f2227;});}});}}});}; \ No newline at end of file +var _0xe985=['VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','users','agents','telephones','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Dashboard','intervals','Interval','pauses','Pause','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','Reports','reportId','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','AnalyticExtractedReport','foreignKey','merge','options','autoAssociation','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','include','tag','Tag','openTabs','chat','dataValues','sms','mail','lodash','./userProfile.attributes','exports','models','filter','field','then','associatedResources','map','catch','value','findAll','name','resolve','UserProfileResource','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','parentSections','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxAccount','inboundroutes','internalroutes','outboundroutes'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xe985,0x13f));var _0x5e98=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0xe985[_0x57a402];return _0x753a36;};'use strict';var _=require(_0x5e98('0x0'));var attributes=require(_0x5e98('0x1'));var squel=require('squel');module[_0x5e98('0x2')]=function(_0x332c19){var _0x3fd4be=_0x332c19[_0x5e98('0x3')];function _0x3d52b0(_0x3780c4,_0x328f47){return new Promise(function(_0x2d5d4e,_0x41f6d0){if(!_0x328f47)return _0x2d5d4e(null);var _0x4c6a38=_0x328f47[_0x5e98('0x4')]?{[_0x328f47[_0x5e98('0x4')][_0x5e98('0x5')]]:_0x328f47[_0x5e98('0x4')]['value']}:undefined;return _0x3fd4be[_0x3780c4]['findAll']({'where':_0x4c6a38,'raw':!![]})[_0x5e98('0x6')](function(_0x5bba95){_0x328f47[_0x5e98('0x7')]=_[_0x5e98('0x8')](_0x5bba95,'id');_0x2d5d4e(_0x328f47);})[_0x5e98('0x9')](function(_0x57e8b4){_0x41f6d0(_0x57e8b4);});});}function _0x201fa4(_0x35f240,_0x4ba2f8){return new Promise(function(_0x3c30d8,_0x5fe9f7){var _0xd2c7b6=_0x35f240[_0x5e98('0x4')]?{[_0x35f240['filter'][_0x5e98('0x5')]]:_0x35f240[_0x5e98('0x4')][_0x5e98('0xa')]}:undefined;return _0x3fd4be[_0x35f240['model']][_0x5e98('0xb')]({'where':_0xd2c7b6,'raw':!![]})[_0x5e98('0x6')](function(_0x20ea76){_0x4ba2f8[_0x5e98('0x7')]=_['map'](_0x20ea76,function(_0x25b454){return _0x25b454[_0x5e98('0xc')];});_0x3c30d8(_0x4ba2f8);})[_0x5e98('0x9')](function(_0x5aa39a){_0x5fe9f7(_0x5aa39a);});});}function _0x1bde53(_0x40bc37,_0x348ba4,_0x470961){if(!_0x348ba4)return Promise[_0x5e98('0xd')](null);return new Promise(function(_0x1c2251,_0x37b3bc){return _0x3fd4be[_0x5e98('0xe')]['findAll']({'where':{'sectionId':_0x348ba4['id']},'raw':!![]})[_0x5e98('0x6')](function(_0x3e367f){if(_0x40bc37[_0x5e98('0x5')]&&_0x40bc37[_0x5e98('0x5')]!=='id'){_0x348ba4[_0x5e98('0x7')]=_[_0x5e98('0x8')](_0x3e367f,function(_0x23b4b1){return _0x23b4b1[_0x40bc37['field']];});}else{if(_0x470961==='AnalyticExtractedReport'){_0x348ba4['associatedResources']=_[_0x5e98('0x8')](_0x3e367f,function(_0x445d8f){return{'id':_0x445d8f['resourceId'],'type':_0x445d8f[_0x5e98('0xf')]};});}else{_0x348ba4['associatedResources']=_['map'](_0x3e367f,function(_0x14108b){return _0x14108b['resourceId'];});}}_0x1c2251(_0x348ba4);})[_0x5e98('0x9')](function(_0x1d96b2){_0x37b3bc(_0x1d96b2);});});}function _0x6da3f7(_0x2edc3f,_0x200db5){var _0xde2cdf={'parentSections':[]};switch(_0x2edc3f[_0x5e98('0x10')]()){case _0x5e98('0x11'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x13');break;case _0x5e98('0x14'):_0xde2cdf['childModel']='SquareOdbc';break;case _0x5e98('0x15'):_0xde2cdf[_0x5e98('0x12')]='SquareRecording';_0xde2cdf[_0x5e98('0x16')]=[{'name':'SquareProjects','field':_0x5e98('0xc'),'foreignKey':_0x5e98('0x17')}];break;case _0x5e98('0x18'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x19');break;case _0x5e98('0x1a'):_0xde2cdf['childModel']='CmContact';_0xde2cdf[_0x5e98('0x16')]=[{'name':_0x5e98('0x1b'),'field':'id','foreignKey':_0x5e98('0x1c')}];break;case'lists':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x1d');break;case _0x5e98('0x1e'):_0xde2cdf['childModel']=_0x5e98('0x1f');break;case _0x5e98('0x20'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x21');break;case _0x5e98('0x22'):_0xde2cdf[_0x5e98('0x12')]='ChatQueue';break;case'chatwebsites':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x23');break;case _0x5e98('0x24'):_0xde2cdf[_0x5e98('0x12')]='FaxQueue';break;case'faxaccounts':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x25');break;case _0x5e98('0x26'):case _0x5e98('0x27'):case _0x5e98('0x28'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x29');break;case _0x5e98('0x2a'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x2b');break;case _0x5e98('0x2c'):_0xde2cdf[_0x5e98('0x12')]='VoiceMail';break;case _0x5e98('0x2d'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x2e');_0xde2cdf[_0x5e98('0x16')]=[{'name':_0x5e98('0x2f'),'field':_0x5e98('0xc'),'foreignKey':_0x5e98('0x30'),'model':_0x5e98('0x31'),'filter':{'field':'role','value':[_0x5e98('0x32')]}},{'name':_0x5e98('0x33'),'field':_0x5e98('0xc'),'foreignKey':_0x5e98('0x30'),'model':_0x5e98('0x31'),'filter':{'field':_0x5e98('0x34'),'value':['telephone']}},{'name':_0x5e98('0x35'),'field':_0x5e98('0xc'),'foreignKey':'queue','model':_0x5e98('0x36'),'filter':{'field':_0x5e98('0xf'),'value':['inbound']}},{'name':_0x5e98('0x37'),'field':_0x5e98('0xc'),'foreignKey':_0x5e98('0x38'),'model':_0x5e98('0x36'),'filter':{'field':_0x5e98('0xf'),'value':[_0x5e98('0x39')]}}];break;case'musiconholds':_0xde2cdf[_0x5e98('0x12')]='VoiceMusicOnHold';break;case _0x5e98('0x3a'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x3b');break;case _0x5e98('0x3c'):_0xde2cdf[_0x5e98('0x12')]='VoicePrefix';break;case'ivrcampaigns':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x3d');break;case _0x5e98('0x3e'):_0xde2cdf['childModel']=_0x5e98('0x3f');break;case _0x5e98('0x40'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x41');break;case _0x5e98('0x42'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x43');break;case _0x5e98('0x44'):_0xde2cdf[_0x5e98('0x12')]='OpenchannelQueue';break;case _0x5e98('0x45'):_0xde2cdf['childModel']=_0x5e98('0x46');break;case'smsqueues':_0xde2cdf['childModel']=_0x5e98('0x47');break;case _0x5e98('0x48'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x49');break;case'whatsappqueues':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x4a');break;case _0x5e98('0x4b'):_0xde2cdf[_0x5e98('0x12')]='WhatsappAccount';break;case _0x5e98('0x4c'):_0xde2cdf['childModel']=_0x5e98('0x4d');break;case'voicequeues':case _0x5e98('0x4e'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x36');if(_0x200db5){_0xde2cdf[_0x5e98('0x16')]=[{'name':_0x5e98('0x35')},{'name':_0x5e98('0x37')}];}break;case _0x5e98('0x4f'):case _0x5e98('0x50'):case _0x5e98('0x51'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x31');if(_0x200db5){_0xde2cdf[_0x5e98('0x16')]=[{'name':'Users','filter':{'field':_0x5e98('0x34'),'value':[_0x5e98('0x52'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x5e98('0x33')}];}break;case _0x5e98('0x53'):_0xde2cdf[_0x5e98('0x12')]='ZendeskAccount';break;case _0x5e98('0x54'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x55');break;case _0x5e98('0x56'):_0xde2cdf['childModel']='FreshdeskAccount';break;case _0x5e98('0x57'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x58');break;case'deskaccounts':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x59');break;case'zohoaccounts':_0xde2cdf[_0x5e98('0x12')]='ZohoAccount';break;case _0x5e98('0x5a'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x31');break;case _0x5e98('0x5b'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x5c');break;case _0x5e98('0x5d'):_0xde2cdf[_0x5e98('0x12')]='Disposition';break;case'customdashboards':_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x5e');break;case _0x5e98('0x5f'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x60');break;case _0x5e98('0x61'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x62');break;case'scheduler':_0xde2cdf[_0x5e98('0x12')]='Schedule';break;case _0x5e98('0x63'):_0xde2cdf['childModel']=_0x5e98('0x64');break;case _0x5e98('0x65'):_0xde2cdf[_0x5e98('0x12')]='Tag';break;case _0x5e98('0x66'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x67');break;case _0x5e98('0x68'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x69');break;case _0x5e98('0x6a'):_0xde2cdf[_0x5e98('0x12')]='Trunk';break;case _0x5e98('0x6b'):_0xde2cdf['childModel']=_0x5e98('0x6c');break;case _0x5e98('0x6d'):_0xde2cdf[_0x5e98('0x12')]=_0x5e98('0x6e');break;case'extractedreports':_0xde2cdf['childModel']='AnalyticExtractedReport';_0xde2cdf['parentSections']=[{'name':_0x5e98('0x6f'),'field':'id','foreignKey':_0x5e98('0x70')}];break;case'metrics':_0xde2cdf['childModel']='AnalyticMetric';break;}return _0xde2cdf;}function _0x48b1ef(_0x580cb3,_0x1c4cd6){var _0x5b15ac=_0x580cb3['charAt'](0x0)[_0x5e98('0x71')]()+_0x580cb3[_0x5e98('0x72')](0x1);var _0x5e1aa5={'type':_0x3fd4be['Sequelize'][_0x5e98('0x73')][_0x5e98('0x74')],'raw':!![]};return new Promise(function(_0x3d0b3d,_0x236713){var _0x2aa57f=squel[_0x5e98('0x75')]()[_0x5e98('0x5')](_0x5e98('0x76')+_0x5b15ac+_0x5e98('0x77'),'id')['field']('ui.createdAt')['from'](_0x5e98('0x78')+_0x580cb3+'_interactions','ui')[_0x5e98('0x79')](_0x5e98('0x7a'),_0x1c4cd6['id']);return _0x3fd4be[_0x5e98('0x7b')][_0x5e98('0x7c')](_0x2aa57f['toString'](),_0x5e1aa5)['then'](function(_0x4b1323){_0x1c4cd6[_0x5b15ac+_0x5e98('0x7d')]=_0x4b1323;_0x3d0b3d(_0x4b1323);})[_0x5e98('0x9')](function(_0x16083d){_0x236713(_0x16083d);});});}return _0x332c19['define']('UserProfile',attributes,{'tableName':_0x5e98('0x7e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x38c0dd){var _0x3c965f=require(_0x5e98('0x7f'));var _0x2e13a9={'raw':_0x38c0dd['query'][_0x5e98('0x80')],'where':{}};var _0xbbfb4e={};var _0x472b9c={'count':0x0,'rows':[]};var _0x2cab40=_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x81')];var _0x2aa182=_0x38c0dd[_0x5e98('0x7c')]['mergeResources']||![];var _0x53db7a=_0x6da3f7(_0x2cab40,_0x2aa182);if(!_0x53db7a[_0x5e98('0x12')])throw new Error(_0x5e98('0x82')+_0x2cab40+'\x27');var _0x599ea9=[{'name':_0x2cab40}];if(!_[_0x5e98('0x83')](_0x53db7a[_0x5e98('0x16')]))_0x599ea9=_0x53db7a['parentSections'];var _0x30701c=[];for(var _0x533a75=0x0;_0x533a75<_0x599ea9[_0x5e98('0x84')];_0x533a75++){_0x30701c[_0x5e98('0x85')](_0x3fd4be[_0x5e98('0x86')][_0x5e98('0x87')]({'where':{'userProfileId':_0x38c0dd[_0x5e98('0x88')]['id'],'name':_0x599ea9[_0x533a75][_0x5e98('0xc')]},'raw':!![]}));}return Promise[_0x5e98('0x89')](_0x30701c)[_0x5e98('0x6')](function(_0x182da1){var _0x2c83d6=_[_0x5e98('0x4')](_0x182da1,function(_0x2b4f38){return _0x2b4f38?_0x2b4f38:undefined;});var _0x109d08=_[_0x5e98('0x4')](_0x599ea9,['ignore',!![]]);var _0x493e72=_[_0x5e98('0x83')](_0x2c83d6)&&_[_0x5e98('0x83')](_0x109d08)?null:_[_0x5e98('0x8a')](_0x109d08,_0x2c83d6);if(!_0x493e72)return null;var _0x1a865f=[];for(var _0x33cebb=0x0;_0x33cebb<_0x493e72['length'];_0x33cebb++){var _0xdf72c4=_[_0x5e98('0x87')](_0x599ea9,function(_0x44f2a9){return _0x493e72[_0x33cebb]?_0x44f2a9['name']===_0x493e72[_0x33cebb][_0x5e98('0xc')]:null;});if(_0xdf72c4){if(_0x493e72[_0x33cebb][_0x5e98('0x8b')]){_0x1a865f['push'](_0x3d52b0(_0x53db7a[_0x5e98('0x12')],_0x493e72[_0x33cebb]));}else{if(!_0x493e72[_0x33cebb]['autoAssociation']){_0x1a865f[_0x5e98('0x85')](_0x1bde53(_0xdf72c4,_0x493e72[_0x33cebb],_0x53db7a[_0x5e98('0x12')]));}else{if(_0xdf72c4[_0x5e98('0x8c')]){_0x1a865f['push'](_0x201fa4(_0xdf72c4,_0x493e72[_0x33cebb]));}}}}}return Promise['all'](_0x1a865f);})['then'](function(_0x160c72){var _0x19c9e9=_0x160c72;var _0x4cb7ce=null;if(_0x19c9e9){_0x4cb7ce=_0x19c9e9[_0x5e98('0x84')]===0x1?_0x19c9e9[0x0]:null;}if(!_0x4cb7ce&&!_0x19c9e9)return _0x472b9c;var _0x2d62e6=_0x3fd4be[_0x53db7a[_0x5e98('0x12')]]['rawAttributes'];_0xbbfb4e[_0x5e98('0x8c')]=_['keys'](_0x2d62e6);_0xbbfb4e[_0x5e98('0x7c')]=_[_0x5e98('0x8d')](_0x38c0dd[_0x5e98('0x7c')]);_0xbbfb4e[_0x5e98('0x8e')]=_[_0x5e98('0x8f')](_0xbbfb4e[_0x5e98('0x8c')],_0xbbfb4e['query']);_0x2e13a9['attributes']=_[_0x5e98('0x8f')](_0xbbfb4e['model'],_0x3c965f[_0x5e98('0x90')](_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x90')]));_0x2e13a9[_0x5e98('0x91')]=_0x2e13a9[_0x5e98('0x91')][_0x5e98('0x84')]?_0x2e13a9[_0x5e98('0x91')]:_0xbbfb4e[_0x5e98('0x8c')];if(!_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x92')](_0x5e98('0x93'))){_0x2e13a9['limit']=_0x3c965f[_0x5e98('0x94')](_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x94')]);_0x2e13a9['offset']=_0x3c965f['offset'](_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x95')]);}_0x2e13a9[_0x5e98('0x96')]=_0x3c965f[_0x5e98('0x97')](_0x38c0dd['query'][_0x5e98('0x97')]);_0x2e13a9[_0x5e98('0x79')]=_0x3c965f[_0x5e98('0x8e')](_[_0x5e98('0x98')](_0x38c0dd['query'],_0xbbfb4e[_0x5e98('0x8e')]));if(_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x4')]){_0x2e13a9['where']=_['merge'](_0x2e13a9[_0x5e98('0x79')],{'$or':_[_0x5e98('0x8')](_0x2d62e6,function(_0x4743e0){if(_0x4743e0[_0x5e98('0xf')][_0x5e98('0x99')]!==_0x5e98('0x9a')){var _0x276712={};_0x276712[_0x4743e0[_0x5e98('0x5')]]={'$like':'%'+_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0x4')]+'%'};return _0x276712;}})});}var _0xab9bb8=[];var _0x542195=null;var _0x417b8c={};if(_0x4cb7ce){_0x542195=_[_0x5e98('0x87')](_0x599ea9,[_0x5e98('0xc'),_0x4cb7ce[_0x5e98('0xc')]]);if(_0x542195['field']){_0x417b8c={};if(_0x53db7a['childModel']===_0x5e98('0x9b')){_0x417b8c[_0x542195[_0x5e98('0x9c')]]=_[_0x5e98('0x8')](_0x4cb7ce[_0x5e98('0x7')],'id');}else{_0x417b8c[_0x542195['foreignKey']]=_0x4cb7ce[_0x5e98('0x7')];}_0xab9bb8[_0x5e98('0x85')](_0x417b8c);}else{_0x2e13a9['where']['id']=_0x4cb7ce['associatedResources'];}}else{for(var _0xe416a3=0x0;_0xe416a3<_0x19c9e9[_0x5e98('0x84')];_0xe416a3++){_0x542195=_[_0x5e98('0x87')](_0x599ea9,['name',_0x19c9e9[_0xe416a3][_0x5e98('0xc')]]);if(_0x542195[_0x5e98('0x5')]){_0x417b8c={};_0x417b8c[_0x542195[_0x5e98('0x9c')]]=_0x19c9e9[_0xe416a3][_0x5e98('0x7')];_0xab9bb8['push'](_0x417b8c);}else{if(!_0x2e13a9[_0x5e98('0x79')]['id'])_0x2e13a9[_0x5e98('0x79')]['id']=[];_0x19c9e9[_0xe416a3]['associatedResources']['forEach'](function(_0x185cb3){_0x2e13a9[_0x5e98('0x79')]['id'][_0x5e98('0x85')](_0x185cb3);});}}}if(!_[_0x5e98('0x83')](_0xab9bb8)){_0x2e13a9[_0x5e98('0x79')]=_[_0x5e98('0x9d')](_0x2e13a9[_0x5e98('0x79')],{'$and':{'$or':_0xab9bb8}});}_0x2e13a9=_['merge']({},_0x2e13a9,_0x38c0dd[_0x5e98('0x9e')]);if(_0x4cb7ce&&!_0x4cb7ce[_0x5e98('0x9f')]&&_0x53db7a[_0x5e98('0x12')]==='AnalyticExtractedReport'){if(_0x38c0dd['query'][_0x5e98('0xa0')]){_0x2e13a9['include']=[{'all':!![]}];}return _0x3fd4be[_0x53db7a[_0x5e98('0x12')]]['findAll'](_0x2e13a9)[_0x5e98('0x6')](function(_0x37921e){var _0x117e55=[];_0x37921e['forEach'](function(_0x1b93a8){var _0x1ea3fa;switch(_0x1b93a8[_0x5e98('0xa1')]){case _0x5e98('0xa2'):_0x1ea3fa=_['find'](_0x4cb7ce[_0x5e98('0x7')],function(_0x57cc0f){return _0x57cc0f['id']===_0x1b93a8['reportId']&&_0x57cc0f[_0x5e98('0xf')]===_0x5e98('0xa3');});break;case _0x5e98('0xa4'):_0x1ea3fa=_[_0x5e98('0x87')](_0x4cb7ce['associatedResources'],function(_0x4b642d){return _0x4b642d['id']===_0x1b93a8[_0x5e98('0x70')]&&_0x4b642d[_0x5e98('0xf')]===_0x5e98('0xa5');});break;}if(_0x1ea3fa)_0x117e55['push'](_0x1b93a8);});_0x472b9c[_0x5e98('0xa6')]=_0x117e55['length'];_0x472b9c[_0x5e98('0xa7')]=_0x117e55;return _0x472b9c;});}else{if(!_[_0x5e98('0x83')](_0x38c0dd[_0x5e98('0x7c')]['ids'])){_0x2e13a9[_0x5e98('0x79')]['id']=_0x2e13a9[_0x5e98('0x79')]['id']?_['intersection'](_0x2e13a9[_0x5e98('0x79')]['id'],_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xa8')]):_0x38c0dd[_0x5e98('0x7c')]['ids'];if(_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xa9')]){_0x2e13a9[_0x5e98('0x96')]=_0x38c0dd['query']['customSorting'];}}if(_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xaa')]){_0x2e13a9['where']=_[_0x5e98('0x9d')](_0x2e13a9[_0x5e98('0x79')],{'$and':_0x38c0dd[_0x5e98('0x7c')]['extraQueryConditions']});}return _0x3fd4be[_0x53db7a[_0x5e98('0x12')]]['count']({'where':_0x2e13a9[_0x5e98('0x79')]})['then'](function(_0x5c6002){_0x472b9c[_0x5e98('0xa6')]=_0x5c6002;if(_0x38c0dd['query'][_0x5e98('0xa0')]){if(_0x53db7a['childModel']===_0x5e98('0xab')){_0x2e13a9[_0x5e98('0xac')]=[{'model':_0x3fd4be['Tag'],'as':'Tags','attributes':['id',_0x5e98('0xc'),'color'],'required':_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xad')]?!![]:![]},{'model':_0x3fd4be[_0x5e98('0xae')],'as':'ThroughTags','attributes':['id',_0x5e98('0xc'),'color'],'through':_0x38c0dd['query'][_0x5e98('0xad')]?{'attributes':[],'where':{'TagId':_0x38c0dd['query'][_0x5e98('0xad')]||undefined}}:{},'required':_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xad')]?!![]:![]}];}else{_0x2e13a9['include']=[{'all':!![]}];}}return _0x3fd4be[_0x53db7a[_0x5e98('0x12')]][_0x5e98('0xb')](_0x2e13a9);})[_0x5e98('0x6')](function(_0xdfbfc0){_0x472b9c[_0x5e98('0xa7')]=_0xdfbfc0;if(_0x2cab40===_0x5e98('0x2f')&&_0x38c0dd[_0x5e98('0x7c')][_0x5e98('0xaf')]==='true'){var _0x4c888e=[];for(var _0x24e879=0x0;_0x24e879<_0x472b9c[_0x5e98('0xa7')][_0x5e98('0x84')];_0x24e879++){_0x4c888e[_0x5e98('0x85')](_0x48b1ef(_0x5e98('0xb0'),_0x472b9c[_0x5e98('0xa7')][_0x24e879][_0x5e98('0xb1')]));_0x4c888e['push'](_0x48b1ef(_0x5e98('0xb2'),_0x472b9c['rows'][_0x24e879]['dataValues']));_0x4c888e[_0x5e98('0x85')](_0x48b1ef('fax',_0x472b9c[_0x5e98('0xa7')][_0x24e879][_0x5e98('0xb1')]));_0x4c888e['push'](_0x48b1ef(_0x5e98('0xb3'),_0x472b9c[_0x5e98('0xa7')][_0x24e879][_0x5e98('0xb1')]));_0x4c888e[_0x5e98('0x85')](_0x48b1ef('openchannel',_0x472b9c[_0x5e98('0xa7')][_0x24e879]['dataValues']));_0x4c888e[_0x5e98('0x85')](_0x48b1ef('whatsapp',_0x472b9c[_0x5e98('0xa7')][_0x24e879]['dataValues']));}return Promise[_0x5e98('0x89')](_0x4c888e)['then'](function(){return _0x472b9c;});}return _0x472b9c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index b565a81..051af0c 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 _0x8561=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8561,0x1b2));var _0x1856=function(_0x49e264,_0x142dd1){_0x49e264=_0x49e264-0x0;var _0x109309=_0x8561[_0x49e264];return _0x109309;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var moment=require(_0x1856('0x1'));var BPromise=require('bluebird');var rs=require(_0x1856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1856('0x4'))('rpc');var config=require(_0x1856('0x5'));var jayson=require(_0x1856('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1856('0x7')]=_['defaults'](config['redis'],{'host':_0x1856('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x1bfad8,_0x3e47b3,_0x510505){return new BPromise(function(_0x55fe85,_0x97f276){return client['request'](_0x1bfad8,_0x510505)[_0x1856('0x9')](function(_0x584a8e){logger[_0x1856('0xa')]('UserProfile,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'));logger[_0x1856('0xc')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'),JSON[_0x1856('0xd')](_0x584a8e));if(_0x584a8e[_0x1856('0xe')]){if(_0x584a8e['error'][_0x1856('0xf')]===0x1f4){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e['error'][_0x1856('0x11')]);return _0x97f276(_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);}logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);return _0x55fe85(_0x584a8e['error']['message']);}else{logger[_0x1856('0xa')]('UserProfile,\x20%s,\x20%s',_0x3e47b3,'request\x20sent');_0x55fe85(_0x584a8e[_0x1856('0x12')][_0x1856('0x11')]);}})['catch'](function(_0x4f5381){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x4f5381);_0x97f276(_0x4f5381);});});} \ No newline at end of file +var _0xcb22=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','info','debug','request\x20sent','error','UserProfile,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd148b1,_0x300e46){var _0x1153af=function(_0x40ae3c){while(--_0x40ae3c){_0xd148b1['push'](_0xd148b1['shift']());}};_0x1153af(++_0x300e46);}(_0xcb22,0xc8));var _0x2cb2=function(_0x11b6a8,_0x38b981){_0x11b6a8=_0x11b6a8-0x0;var _0x5537a9=_0xcb22[_0x11b6a8];return _0x5537a9;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var moment=require(_0x2cb2('0x2'));var BPromise=require(_0x2cb2('0x3'));var rs=require(_0x2cb2('0x4'));var fs=require('fs');var Redis=require(_0x2cb2('0x5'));var db=require(_0x2cb2('0x6'))['db'];var utils=require(_0x2cb2('0x7'));var logger=require(_0x2cb2('0x8'))(_0x2cb2('0x9'));var config=require(_0x2cb2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2cb2('0xb')][_0x2cb2('0xc')]({'port':0x232a});config[_0x2cb2('0xd')]=_[_0x2cb2('0xe')](config[_0x2cb2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cb2('0xf'))(new Redis(config[_0x2cb2('0xd')]));require('./userProfile.socket')[_0x2cb2('0x10')](socket);function respondWithRpcPromise(_0x34170f,_0xe8c23e,_0x14f52f){return new BPromise(function(_0x16f6fe,_0x2122bf){return client['request'](_0x34170f,_0x14f52f)['then'](function(_0x1e2e62){logger[_0x2cb2('0x11')]('UserProfile,\x20%s,\x20%s',_0xe8c23e,'request\x20sent');logger[_0x2cb2('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xe8c23e,_0x2cb2('0x13'),JSON['stringify'](_0x1e2e62));if(_0x1e2e62[_0x2cb2('0x14')]){if(_0x1e2e62[_0x2cb2('0x14')]['code']===0x1f4){logger[_0x2cb2('0x14')](_0x2cb2('0x15'),_0xe8c23e,_0x1e2e62[_0x2cb2('0x14')]['message']);return _0x2122bf(_0x1e2e62[_0x2cb2('0x14')][_0x2cb2('0x16')]);}logger['error'](_0x2cb2('0x15'),_0xe8c23e,_0x1e2e62['error'][_0x2cb2('0x16')]);return _0x16f6fe(_0x1e2e62[_0x2cb2('0x14')][_0x2cb2('0x16')]);}else{logger[_0x2cb2('0x11')](_0x2cb2('0x15'),_0xe8c23e,_0x2cb2('0x13'));_0x16f6fe(_0x1e2e62['result']['message']);}})['catch'](function(_0x488ae5){logger[_0x2cb2('0x14')](_0x2cb2('0x15'),_0xe8c23e,_0x488ae5);_0x2122bf(_0x488ae5);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fed3f08..addb7e4 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 _0xf090=['register','length','userProfile:','./userProfile.events','remove','removeListener'];(function(_0x54e205,_0x3cf352){var _0x156650=function(_0x24b1d6){while(--_0x24b1d6){_0x54e205['push'](_0x54e205['shift']());}};_0x156650(++_0x3cf352);}(_0xf090,0x1ad));var _0x0f09=function(_0x25a928,_0x2d6d48){_0x25a928=_0x25a928-0x0;var _0x3c5e1c=_0xf090[_0x25a928];return _0x3c5e1c;};'use strict';var UserProfileEvents=require(_0x0f09('0x0'));var events=['save',_0x0f09('0x1'),'update'];function createListener(_0x4847aa,_0x487899){return function(_0x46a6c0){_0x487899['emit'](_0x4847aa,_0x46a6c0);};}function removeListener(_0x9b0017,_0x3ccde5){return function(){UserProfileEvents[_0x0f09('0x2')](_0x9b0017,_0x3ccde5);};}exports[_0x0f09('0x3')]=function(_0x3120b3){for(var _0xafb47c=0x0,_0x4bae5b=events[_0x0f09('0x4')];_0xafb47c<_0x4bae5b;_0xafb47c++){var _0x4563a8=events[_0xafb47c];var _0x44763f=createListener(_0x0f09('0x5')+_0x4563a8,_0x3120b3);UserProfileEvents['on'](_0x4563a8,_0x44763f);}}; \ No newline at end of file +var _0xc632=['userProfile:','./userProfile.events','update','removeListener'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xc632,0x81));var _0x2c63=function(_0x5b3133,_0x39cd7f){_0x5b3133=_0x5b3133-0x0;var _0x5f4b51=_0xc632[_0x5b3133];return _0x5f4b51;};'use strict';var UserProfileEvents=require(_0x2c63('0x0'));var events=['save','remove',_0x2c63('0x1')];function createListener(_0x9c3ca5,_0x94998b){return function(_0x100c0e){_0x94998b['emit'](_0x9c3ca5,_0x100c0e);};}function removeListener(_0x182f8b,_0x27015a){return function(){UserProfileEvents[_0x2c63('0x2')](_0x182f8b,_0x27015a);};}exports['register']=function(_0x38d30c){for(var _0x47ea8b=0x0,_0x19c9d7=events['length'];_0x47ea8b<_0x19c9d7;_0x47ea8b++){var _0x4bdc66=events[_0x47ea8b];var _0x18c3fc=createListener(_0x2c63('0x3')+_0x4bdc66,_0x38d30c);UserProfileEvents['on'](_0x4bdc66,_0x18c3fc);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bb9b839..0cd3199 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 _0x2b03=['../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x364a3a,_0x5b4fe4){var _0x17fef8=function(_0x1e7ef9){while(--_0x1e7ef9){_0x364a3a['push'](_0x364a3a['shift']());}};_0x17fef8(++_0x5b4fe4);}(_0x2b03,0x196));var _0x32b0=function(_0x332c43,_0x545e88){_0x332c43=_0x332c43-0x0;var _0x20468e=_0x2b03[_0x332c43];return _0x20468e;};'use strict';var multer=require(_0x32b0('0x0'));var util=require(_0x32b0('0x1'));var path=require(_0x32b0('0x2'));var timeout=require(_0x32b0('0x3'));var express=require(_0x32b0('0x4'));var router=express[_0x32b0('0x5')]();var fs_extra=require(_0x32b0('0x6'));var auth=require(_0x32b0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x32b0('0x8'));var controller=require(_0x32b0('0x9'));router[_0x32b0('0xa')]('/',auth['isAuthenticated'](),controller[_0x32b0('0xb')]);router[_0x32b0('0xa')](_0x32b0('0xc'),auth['isAuthenticated'](),controller[_0x32b0('0xd')]);router[_0x32b0('0xa')](_0x32b0('0xe'),auth[_0x32b0('0xf')](),controller[_0x32b0('0x10')]);router['post']('/',auth[_0x32b0('0xf')](),controller[_0x32b0('0x11')]);router[_0x32b0('0x12')](_0x32b0('0xe'),auth[_0x32b0('0xf')](),controller[_0x32b0('0x13')]);router[_0x32b0('0x14')](_0x32b0('0xe'),auth[_0x32b0('0xf')](),controller[_0x32b0('0x15')]);module[_0x32b0('0x16')]=router; \ No newline at end of file +var _0x9a6f=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bf31c,_0x20f7e6){var _0x352186=function(_0x1e4266){while(--_0x1e4266){_0x3bf31c['push'](_0x3bf31c['shift']());}};_0x352186(++_0x20f7e6);}(_0x9a6f,0xdc));var _0xf9a6=function(_0x481ee8,_0x5aa574){_0x481ee8=_0x481ee8-0x0;var _0x5ad55f=_0x9a6f[_0x481ee8];return _0x5ad55f;};'use strict';var multer=require(_0xf9a6('0x0'));var util=require(_0xf9a6('0x1'));var path=require('path');var timeout=require(_0xf9a6('0x2'));var express=require(_0xf9a6('0x3'));var router=express[_0xf9a6('0x4')]();var fs_extra=require(_0xf9a6('0x5'));var auth=require(_0xf9a6('0x6'));var interaction=require(_0xf9a6('0x7'));var config=require(_0xf9a6('0x8'));var controller=require(_0xf9a6('0x9'));router[_0xf9a6('0xa')]('/',auth[_0xf9a6('0xb')](),controller['index']);router['get'](_0xf9a6('0xc'),auth['isAuthenticated'](),controller[_0xf9a6('0xd')]);router['get'](_0xf9a6('0xe'),auth[_0xf9a6('0xb')](),controller['show']);router[_0xf9a6('0xf')]('/',auth[_0xf9a6('0xb')](),controller['create']);router[_0xf9a6('0x10')](_0xf9a6('0xe'),auth[_0xf9a6('0xb')](),controller[_0xf9a6('0x11')]);router[_0xf9a6('0x12')]('/:id',auth[_0xf9a6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f5e0cbf..dc43669 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 _0xa6d9=['INTEGER','sequelize'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa6d9,0x91));var _0x9a6d=function(_0x2dedfa,_0x42ac98){_0x2dedfa=_0x2dedfa-0x0;var _0x16d8e4=_0xa6d9[_0x2dedfa];return _0x16d8e4;};'use strict';var Sequelize=require(_0x9a6d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9a6d('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xce8c=['sequelize','exports','STRING','INTEGER'];(function(_0x2fe4e6,_0x39f94e){var _0x331d75=function(_0x346bdf){while(--_0x346bdf){_0x2fe4e6['push'](_0x2fe4e6['shift']());}};_0x331d75(++_0x39f94e);}(_0xce8c,0x1d8));var _0xcce8=function(_0x1246e7,_0xdee926){_0x1246e7=_0x1246e7-0x0;var _0x59e6ff=_0xce8c[_0x1246e7];return _0x59e6ff;};'use strict';var Sequelize=require(_0xcce8('0x0'));module[_0xcce8('0x1')]={'name':{'type':Sequelize[_0xcce8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xcce8('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xcce8('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 776bf5e..0eeded1 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1873cc,_0x5433ff){var _0x4c8fbf=function(_0x1ebf6d){while(--_0x1ebf6d){_0x1873cc['push'](_0x1873cc['shift']());}};_0x4c8fbf(++_0x5433ff);}(_0xd117,0x182));var _0x7d11=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xd117[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x404434,_0x4c31b8){var _0x238525=function(_0x5a46c9){while(--_0x5a46c9){_0x404434['push'](_0x404434['shift']());}};_0x238525(++_0x4c31b8);}(_0x524e,0x15e));var _0xe524=function(_0x3ed73b,_0x4e7255){_0x3ed73b=_0x3ed73b-0x0;var _0x403e89=_0x524e[_0x3ed73b];return _0x403e89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['UserProfileResource'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['UserProfileResource'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['UserProfileResource'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cf75ae8..704d408 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 _0x7d03=['./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x7a3d6b,_0x58af42){var _0x2df0b5=function(_0x54391d){while(--_0x54391d){_0x7a3d6b['push'](_0x7a3d6b['shift']());}};_0x2df0b5(++_0x58af42);}(_0x7d03,0x156));var _0x37d0=function(_0x1f46bf,_0x4ebb1f){_0x1f46bf=_0x1f46bf-0x0;var _0x4076ab=_0x7d03[_0x1f46bf];return _0x4076ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x37d0('0x0'));var moment=require(_0x37d0('0x1'));var BPromise=require(_0x37d0('0x2'));var rp=require(_0x37d0('0x3'));var fs=require('fs');var path=require(_0x37d0('0x4'));var rimraf=require(_0x37d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x37d0('0x6'));module[_0x37d0('0x7')]=function(_0x318b02,_0x371b78){return _0x318b02[_0x37d0('0x8')](_0x37d0('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x37d0('0xa'),'fields':[_0x37d0('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb1=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger'];(function(_0x5a06ca,_0x1a25e4){var _0x51d8a4=function(_0xf17976){while(--_0xf17976){_0x5a06ca['push'](_0x5a06ca['shift']());}};_0x51d8a4(++_0x1a25e4);}(_0xfdb1,0x147));var _0x1fdb=function(_0x78f020,_0x5e1f35){_0x78f020=_0x78f020-0x0;var _0x4fd10c=_0xfdb1[_0x78f020];return _0x4fd10c;};'use strict';var _=require(_0x1fdb('0x0'));var util=require(_0x1fdb('0x1'));var logger=require(_0x1fdb('0x2'))(_0x1fdb('0x3'));var moment=require(_0x1fdb('0x4'));var BPromise=require(_0x1fdb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fdb('0x6'));var rimraf=require(_0x1fdb('0x7'));var config=require(_0x1fdb('0x8'));var attributes=require(_0x1fdb('0x9'));module[_0x1fdb('0xa')]=function(_0x4322e2,_0x4406e8){return _0x4322e2['define']('UserProfileResource',attributes,{'tableName':_0x1fdb('0xb'),'paranoid':![],'indexes':[{'name':_0x1fdb('0xc'),'fields':[_0x1fdb('0xd'),_0x1fdb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bf3af82..7833bbb 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 _0x7de2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x64edb0,_0x4dd13c){var _0x580a4b=function(_0x3e6636){while(--_0x3e6636){_0x64edb0['push'](_0x64edb0['shift']());}};_0x580a4b(++_0x4dd13c);}(_0x7de2,0xe5));var _0x27de=function(_0x42cd8c,_0x95ab6d){_0x42cd8c=_0x42cd8c-0x0;var _0x2c0798=_0x7de2[_0x42cd8c];return _0x2c0798;};'use strict';var _=require(_0x27de('0x0'));var util=require(_0x27de('0x1'));var moment=require(_0x27de('0x2'));var BPromise=require(_0x27de('0x3'));var rs=require(_0x27de('0x4'));var fs=require('fs');var Redis=require(_0x27de('0x5'));var db=require(_0x27de('0x6'))['db'];var utils=require(_0x27de('0x7'));var logger=require(_0x27de('0x8'))(_0x27de('0x9'));var config=require(_0x27de('0xa'));var jayson=require(_0x27de('0xb'));var client=jayson[_0x27de('0xc')][_0x27de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3d80c3,_0xe18a70,_0x5679d6){return new BPromise(function(_0x521fb2,_0xd61485){return client['request'](_0x3d80c3,_0x5679d6)[_0x27de('0xe')](function(_0x38fd64){logger[_0x27de('0xf')](_0x27de('0x10'),_0xe18a70,_0x27de('0x11'));logger[_0x27de('0x12')](_0x27de('0x13'),_0xe18a70,_0x27de('0x11'),JSON[_0x27de('0x14')](_0x38fd64));if(_0x38fd64['error']){if(_0x38fd64['error'][_0x27de('0x15')]===0x1f4){logger[_0x27de('0x16')](_0x27de('0x10'),_0xe18a70,_0x38fd64[_0x27de('0x16')][_0x27de('0x17')]);return _0xd61485(_0x38fd64[_0x27de('0x16')][_0x27de('0x17')]);}logger[_0x27de('0x16')]('UserProfileResource,\x20%s,\x20%s',_0xe18a70,_0x38fd64['error'][_0x27de('0x17')]);return _0x521fb2(_0x38fd64['error'][_0x27de('0x17')]);}else{logger[_0x27de('0xf')](_0x27de('0x10'),_0xe18a70,_0x27de('0x11'));_0x521fb2(_0x38fd64[_0x27de('0x18')][_0x27de('0x17')]);}})[_0x27de('0x19')](function(_0x5cfd0e){logger['error'](_0x27de('0x10'),_0xe18a70,_0x5cfd0e);_0xd61485(_0x5cfd0e);});});} \ No newline at end of file +var _0x93c1=['info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x93c1,0x181));var _0x193c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x93c1[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x193c('0x0'));var moment=require(_0x193c('0x1'));var BPromise=require(_0x193c('0x2'));var rs=require(_0x193c('0x3'));var fs=require('fs');var Redis=require(_0x193c('0x4'));var db=require(_0x193c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x193c('0x6'))(_0x193c('0x7'));var config=require(_0x193c('0x8'));var jayson=require(_0x193c('0x9'));var client=jayson[_0x193c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbdba79,_0x11f8b5,_0x5b25b2){return new BPromise(function(_0x2e2ab2,_0x5e3561){return client['request'](_0xbdba79,_0x5b25b2)['then'](function(_0x5bb6be){logger[_0x193c('0xb')](_0x193c('0xc'),_0x11f8b5,'request\x20sent');logger[_0x193c('0xd')](_0x193c('0xe'),_0x11f8b5,_0x193c('0xf'),JSON[_0x193c('0x10')](_0x5bb6be));if(_0x5bb6be[_0x193c('0x11')]){if(_0x5bb6be[_0x193c('0x11')][_0x193c('0x12')]===0x1f4){logger[_0x193c('0x11')](_0x193c('0xc'),_0x11f8b5,_0x5bb6be[_0x193c('0x11')]['message']);return _0x5e3561(_0x5bb6be[_0x193c('0x11')][_0x193c('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x11f8b5,_0x5bb6be['error']['message']);return _0x2e2ab2(_0x5bb6be[_0x193c('0x11')]['message']);}else{logger[_0x193c('0xb')](_0x193c('0xc'),_0x11f8b5,_0x193c('0xf'));_0x2e2ab2(_0x5bb6be[_0x193c('0x14')][_0x193c('0x13')]);}})[_0x193c('0x15')](function(_0x4f3545){logger[_0x193c('0x11')](_0x193c('0xc'),_0x11f8b5,_0x4f3545);_0x5e3561(_0x4f3545);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0dffe62..7003d30 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 _0x8c12=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','create'];(function(_0x317bf0,_0x277c03){var _0x225932=function(_0x2c280e){while(--_0x2c280e){_0x317bf0['push'](_0x317bf0['shift']());}};_0x225932(++_0x277c03);}(_0x8c12,0x64));var _0x28c1=function(_0x5809dc,_0x367ea7){_0x5809dc=_0x5809dc-0x0;var _0x5c9b25=_0x8c12[_0x5809dc];return _0x5c9b25;};'use strict';var multer=require(_0x28c1('0x0'));var util=require(_0x28c1('0x1'));var path=require('path');var timeout=require(_0x28c1('0x2'));var express=require(_0x28c1('0x3'));var router=express['Router']();var fs_extra=require(_0x28c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28c1('0x5'));var config=require(_0x28c1('0x6'));var controller=require(_0x28c1('0x7'));router[_0x28c1('0x8')]('/',auth[_0x28c1('0x9')](),controller['index']);router[_0x28c1('0x8')](_0x28c1('0xa'),auth[_0x28c1('0x9')](),controller[_0x28c1('0xb')]);router['get'](_0x28c1('0xc'),auth[_0x28c1('0x9')](),controller['show']);router['post']('/',auth[_0x28c1('0x9')](),controller[_0x28c1('0xd')]);router[_0x28c1('0xe')](_0x28c1('0xc'),auth[_0x28c1('0x9')](),controller[_0x28c1('0xf')]);router[_0x28c1('0x10')]('/:id',auth[_0x28c1('0x9')](),controller[_0x28c1('0x11')]);module[_0x28c1('0x12')]=router; \ No newline at end of file +var _0x67f1=['exports','path','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67f1,0xb5));var _0x167f=function(_0x3ba82e,_0x2ce183){_0x3ba82e=_0x3ba82e-0x0;var _0xfef60=_0x67f1[_0x3ba82e];return _0xfef60;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x167f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x167f('0x1')]();var fs_extra=require(_0x167f('0x2'));var auth=require(_0x167f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x167f('0x4'));var controller=require(_0x167f('0x5'));router[_0x167f('0x6')]('/',auth[_0x167f('0x7')](),controller[_0x167f('0x8')]);router[_0x167f('0x6')](_0x167f('0x9'),auth[_0x167f('0x7')](),controller[_0x167f('0xa')]);router[_0x167f('0x6')](_0x167f('0xb'),auth[_0x167f('0x7')](),controller[_0x167f('0xc')]);router[_0x167f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x167f('0xe')](_0x167f('0xb'),auth['isAuthenticated'](),controller[_0x167f('0xf')]);router[_0x167f('0x10')](_0x167f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x167f('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 933b096..5e311aa 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 _0xa5fa=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x34df56,_0x52a58f){_0x34df56=_0x34df56-0x0;var _0x520f88=_0xa5fa[_0x34df56];return _0x520f88;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'name':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa5f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa5f('0x1')],'set':function(_0x4d1c8b){this[_0xaa5f('0x4')](_0xaa5f('0x5'),_0x4d1c8b?_0x4d1c8b[_0xaa5f('0x6')](''):[]);},'get':function(){return this[_0xaa5f('0x7')](_0xaa5f('0x5'))?this[_0xaa5f('0x7')](_0xaa5f('0x5'))[_0xaa5f('0x8')](''):[];}}}; \ No newline at end of file +var _0xa30a=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa30('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa30('0x2')],'set':function(_0x2a9b06){this[_0xaa30('0x5')](_0xaa30('0x6'),_0x2a9b06?_0x2a9b06['join'](''):[]);},'get':function(){return this[_0xaa30('0x7')]('crudPermissions')?this[_0xaa30('0x7')](_0xaa30('0x6'))[_0xaa30('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6c12e7e..554058c 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 _0xb33c=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x5cd386,_0x420f9c){var _0x260c4d=function(_0x5264fc){while(--_0x5264fc){_0x5cd386['push'](_0x5cd386['shift']());}};_0x260c4d(++_0x420f9c);}(_0xb33c,0x102));var _0xcb33=function(_0x3d13f5,_0xcc65fa){_0x3d13f5=_0x3d13f5-0x0;var _0x3f98a1=_0xb33c[_0x3d13f5];return _0x3f98a1;};'use strict';var emlformat=require(_0xcb33('0x0'));var rimraf=require(_0xcb33('0x1'));var zipdir=require(_0xcb33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb33('0x3'));var BPromise=require(_0xcb33('0x4'));var Mustache=require('mustache');var util=require(_0xcb33('0x5'));var path=require(_0xcb33('0x6'));var sox=require(_0xcb33('0x7'));var csv=require('to-csv');var ejs=require(_0xcb33('0x8'));var fs=require('fs');var fs_extra=require(_0xcb33('0x9'));var _=require(_0xcb33('0xa'));var squel=require(_0xcb33('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb33('0xc'));var deskjs=require(_0xcb33('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcb33('0xe'));var Papa=require(_0xcb33('0xf'));var Redis=require(_0xcb33('0x10'));var authService=require(_0xcb33('0x11'));var qs=require(_0xcb33('0x12'));var as=require(_0xcb33('0x13'));var hardwareService=require(_0xcb33('0x14'));var logger=require(_0xcb33('0x15'))(_0xcb33('0x16'));var utils=require('../../config/utils');var config=require(_0xcb33('0x17'));var licenseUtil=require(_0xcb33('0x18'));var db=require(_0xcb33('0x19'))['db'];function respondWithStatusCode(_0x21c74d,_0x43cc62){_0x43cc62=_0x43cc62||0xcc;return function(_0x343ad4){if(_0x343ad4){return _0x21c74d[_0xcb33('0x1a')](_0x43cc62);}return _0x21c74d[_0xcb33('0x1b')](_0x43cc62)[_0xcb33('0x1c')]();};}function respondWithResult(_0x3d7953,_0x1e746f){_0x1e746f=_0x1e746f||0xc8;return function(_0x29fce0){if(_0x29fce0){return _0x3d7953[_0xcb33('0x1b')](_0x1e746f)[_0xcb33('0x1d')](_0x29fce0);}};}function respondWithFilteredResult(_0x526f63,_0x58d071){return function(_0x49c6a5){if(_0x49c6a5){var _0x18f63a=typeof _0x58d071[_0xcb33('0x1e')]===_0xcb33('0x1f')&&typeof _0x58d071[_0xcb33('0x20')]===_0xcb33('0x1f');var _0x1b152e=_0x49c6a5[_0xcb33('0x21')];var _0x19f8e6=_0x18f63a?0x0:_0x58d071['offset'];var _0x4e0584=_0x18f63a?_0x49c6a5[_0xcb33('0x21')]:_0x58d071['offset']+_0x58d071['limit'];var _0x444dd2;if(_0x4e0584>=_0x1b152e){_0x4e0584=_0x1b152e;_0x444dd2=0xc8;}else{_0x444dd2=0xce;}_0x526f63[_0xcb33('0x1b')](_0x444dd2);return _0x526f63[_0xcb33('0x22')](_0xcb33('0x23'),_0x19f8e6+'-'+_0x4e0584+'/'+_0x1b152e)['json'](_0x49c6a5);}return null;};}function patchUpdates(_0x4a8b1f){return function(_0x589e70){try{jsonpatch[_0xcb33('0x24')](_0x589e70,_0x4a8b1f,!![]);}catch(_0x180742){return BPromise[_0xcb33('0x25')](_0x180742);}return _0x589e70[_0xcb33('0x26')]();};}function saveUpdates(_0x39f752,_0x71024a){return function(_0x51160e){if(_0x51160e){return _0x51160e['update'](_0x39f752)[_0xcb33('0x27')](function(_0x322552){return _0x322552;});}return null;};}function removeEntity(_0x371eda,_0x43974a){return function(_0x29a642){if(_0x29a642){return _0x29a642[_0xcb33('0x28')]()[_0xcb33('0x27')](function(){_0x371eda[_0xcb33('0x1b')](0xcc)[_0xcb33('0x1c')]();});}};}function handleEntityNotFound(_0x184f53,_0x1e82b7){return function(_0x122c48){if(!_0x122c48){_0x184f53[_0xcb33('0x1a')](0x194);}return _0x122c48;};}function handleError(_0x4edd5e,_0x1e1e3a){_0x1e1e3a=_0x1e1e3a||0x1f4;return function(_0x5a470b){logger['error'](_0x5a470b[_0xcb33('0x29')]);if(_0x5a470b['name']){delete _0x5a470b[_0xcb33('0x2a')];}_0x4edd5e[_0xcb33('0x1b')](_0x1e1e3a)[_0xcb33('0x2b')](_0x5a470b);};}exports[_0xcb33('0x2c')]=function(_0x48c354,_0x21cc96){var _0x3ac1ae={},_0x32ea08={},_0x33840d={'count':0x0,'rows':[]};var _0xe0a4a0=_['map'](db[_0xcb33('0x2d')][_0xcb33('0x2e')],function(_0x54e0f8){return{'name':_0x54e0f8[_0xcb33('0x2f')],'type':_0x54e0f8[_0xcb33('0x30')][_0xcb33('0x31')]};});_0x32ea08['model']=_[_0xcb33('0x32')](_0xe0a4a0,_0xcb33('0x2a'));_0x32ea08[_0xcb33('0x33')]=_[_0xcb33('0x34')](_0x48c354['query']);_0x32ea08[_0xcb33('0x35')]=_[_0xcb33('0x36')](_0x32ea08[_0xcb33('0x37')],_0x32ea08[_0xcb33('0x33')]);_0x3ac1ae[_0xcb33('0x38')]=_[_0xcb33('0x36')](_0x32ea08['model'],qs[_0xcb33('0x39')](_0x48c354['query'][_0xcb33('0x39')]));_0x3ac1ae[_0xcb33('0x38')]=_0x3ac1ae[_0xcb33('0x38')][_0xcb33('0x3a')]?_0x3ac1ae[_0xcb33('0x38')]:_0x32ea08[_0xcb33('0x37')];if(!_0x48c354['query'][_0xcb33('0x3b')](_0xcb33('0x3c'))){_0x3ac1ae[_0xcb33('0x20')]=qs[_0xcb33('0x20')](_0x48c354[_0xcb33('0x33')]['limit']);_0x3ac1ae[_0xcb33('0x1e')]=qs[_0xcb33('0x1e')](_0x48c354[_0xcb33('0x33')][_0xcb33('0x1e')]);}_0x3ac1ae['order']=qs[_0xcb33('0x3d')](_0x48c354[_0xcb33('0x33')][_0xcb33('0x3d')]);_0x3ac1ae[_0xcb33('0x3e')]=qs['filters'](_[_0xcb33('0x3f')](_0x48c354[_0xcb33('0x33')],_0x32ea08[_0xcb33('0x35')]),_0xe0a4a0);if(_0x48c354[_0xcb33('0x33')][_0xcb33('0x40')]){_0x3ac1ae[_0xcb33('0x3e')]=_[_0xcb33('0x41')](_0x3ac1ae[_0xcb33('0x3e')],{'$or':_[_0xcb33('0x32')](_0xe0a4a0,function(_0x306ce5){if(_0x306ce5['type']!==_0xcb33('0x42')){var _0x5c2626={};_0x5c2626[_0x306ce5[_0xcb33('0x2a')]]={'$like':'%'+_0x48c354['query']['filter']+'%'};return _0x5c2626;}})});}_0x3ac1ae=_[_0xcb33('0x41')]({},_0x3ac1ae,_0x48c354[_0xcb33('0x43')]);var _0x4c9735={'where':_0x3ac1ae[_0xcb33('0x3e')]};return db[_0xcb33('0x2d')][_0xcb33('0x21')](_0x4c9735)[_0xcb33('0x27')](function(_0x38c805){_0x33840d[_0xcb33('0x21')]=_0x38c805;if(_0x48c354[_0xcb33('0x33')][_0xcb33('0x44')]){_0x3ac1ae[_0xcb33('0x45')]=[{'all':!![]}];}return db['UserProfileSection'][_0xcb33('0x46')](_0x3ac1ae);})[_0xcb33('0x27')](function(_0xfcbe63){_0x33840d[_0xcb33('0x47')]=_0xfcbe63;return _0x33840d;})[_0xcb33('0x27')](respondWithFilteredResult(_0x21cc96,_0x3ac1ae))[_0xcb33('0x48')](handleError(_0x21cc96,null));};exports[_0xcb33('0x49')]=function(_0x2ef133,_0x6d708e){var _0x2eb946={'raw':![],'where':{'id':_0x2ef133['params']['id']}},_0x25dd1={};_0x25dd1['model']=_[_0xcb33('0x34')](db[_0xcb33('0x2d')]['rawAttributes']);_0x25dd1[_0xcb33('0x33')]=_[_0xcb33('0x34')](_0x2ef133[_0xcb33('0x33')]);_0x25dd1[_0xcb33('0x35')]=_['intersection'](_0x25dd1[_0xcb33('0x37')],_0x25dd1[_0xcb33('0x33')]);_0x2eb946['attributes']=_[_0xcb33('0x36')](_0x25dd1['model'],qs[_0xcb33('0x39')](_0x2ef133[_0xcb33('0x33')][_0xcb33('0x39')]));_0x2eb946[_0xcb33('0x38')]=_0x2eb946['attributes'][_0xcb33('0x3a')]?_0x2eb946[_0xcb33('0x38')]:_0x25dd1[_0xcb33('0x37')];if(_0x2ef133[_0xcb33('0x33')]['includeAll']){_0x2eb946[_0xcb33('0x45')]=[{'all':!![]}];}_0x2eb946=_['merge']({},_0x2eb946,_0x2ef133[_0xcb33('0x43')]);return db[_0xcb33('0x2d')][_0xcb33('0x4a')](_0x2eb946)['then'](handleEntityNotFound(_0x6d708e,null))[_0xcb33('0x27')](respondWithResult(_0x6d708e,null))['catch'](handleError(_0x6d708e,null));};exports[_0xcb33('0x4b')]=function(_0x4e5e7a,_0x58e43c){return db[_0xcb33('0x2d')]['create'](_0x4e5e7a[_0xcb33('0x4c')],{})[_0xcb33('0x27')](respondWithResult(_0x58e43c,0xc9))['catch'](handleError(_0x58e43c,null));};exports['update']=function(_0x4fa1bf,_0x3a18ee){if(_0x4fa1bf['body']['id']){delete _0x4fa1bf[_0xcb33('0x4c')]['id'];}return db[_0xcb33('0x2d')][_0xcb33('0x4a')]({'where':{'id':_0x4fa1bf[_0xcb33('0x4d')]['id']}})[_0xcb33('0x27')](handleEntityNotFound(_0x3a18ee,null))['then'](saveUpdates(_0x4fa1bf[_0xcb33('0x4c')],null))[_0xcb33('0x27')](respondWithResult(_0x3a18ee,null))[_0xcb33('0x48')](handleError(_0x3a18ee,null));};exports[_0xcb33('0x28')]=function(_0x3f499e,_0x22ad49){return db[_0xcb33('0x2d')][_0xcb33('0x4a')]({'where':{'id':_0x3f499e['params']['id']}})[_0xcb33('0x27')](handleEntityNotFound(_0x22ad49,null))[_0xcb33('0x27')](removeEntity(_0x22ad49,null))[_0xcb33('0x48')](handleError(_0x22ad49,null));};exports[_0xcb33('0x4e')]=function(_0x5609bb,_0x1666f7){return db[_0xcb33('0x2d')][_0xcb33('0x4e')]()['then'](respondWithResult(_0x1666f7,null))[_0xcb33('0x48')](handleError(_0x1666f7,null));}; \ No newline at end of file +var _0xbb07=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','map','UserProfileSection','rawAttributes','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','eml-format','rimraf','zip-dir','mustache','util','sox'];(function(_0x1203c5,_0x4fd846){var _0x5435d6=function(_0xc9a244){while(--_0xc9a244){_0x1203c5['push'](_0x1203c5['shift']());}};_0x5435d6(++_0x4fd846);}(_0xbb07,0x192));var _0x7bb0=function(_0x477495,_0x5de2c1){_0x477495=_0x477495-0x0;var _0x29078e=_0xbb07[_0x477495];return _0x29078e;};'use strict';var emlformat=require(_0x7bb0('0x0'));var rimraf=require(_0x7bb0('0x1'));var zipdir=require(_0x7bb0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bb0('0x3'));var util=require(_0x7bb0('0x4'));var path=require('path');var sox=require(_0x7bb0('0x5'));var csv=require(_0x7bb0('0x6'));var ejs=require(_0x7bb0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7bb0('0x8'));var crypto=require(_0x7bb0('0x9'));var jsforce=require(_0x7bb0('0xa'));var deskjs=require(_0x7bb0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7bb0('0xc'));var Papa=require(_0x7bb0('0xd'));var Redis=require('ioredis');var authService=require(_0x7bb0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7bb0('0xf'));var hardwareService=require(_0x7bb0('0x10'));var logger=require(_0x7bb0('0x11'))(_0x7bb0('0x12'));var utils=require(_0x7bb0('0x13'));var config=require(_0x7bb0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f7ba,_0x43e3b0){_0x43e3b0=_0x43e3b0||0xcc;return function(_0x1f4b4b){if(_0x1f4b4b){return _0x11f7ba[_0x7bb0('0x15')](_0x43e3b0);}return _0x11f7ba[_0x7bb0('0x16')](_0x43e3b0)[_0x7bb0('0x17')]();};}function respondWithResult(_0x4d8bd5,_0xd4113){_0xd4113=_0xd4113||0xc8;return function(_0x2fae91){if(_0x2fae91){return _0x4d8bd5['status'](_0xd4113)[_0x7bb0('0x18')](_0x2fae91);}};}function respondWithFilteredResult(_0x10f6a3,_0x184719){return function(_0x1afd7e){if(_0x1afd7e){var _0x4b4a16=typeof _0x184719[_0x7bb0('0x19')]===_0x7bb0('0x1a')&&typeof _0x184719[_0x7bb0('0x1b')]===_0x7bb0('0x1a');var _0x30d86d=_0x1afd7e[_0x7bb0('0x1c')];var _0x454605=_0x4b4a16?0x0:_0x184719[_0x7bb0('0x19')];var _0x193d0d=_0x4b4a16?_0x1afd7e[_0x7bb0('0x1c')]:_0x184719[_0x7bb0('0x19')]+_0x184719['limit'];var _0x2dbab6;if(_0x193d0d>=_0x30d86d){_0x193d0d=_0x30d86d;_0x2dbab6=0xc8;}else{_0x2dbab6=0xce;}_0x10f6a3['status'](_0x2dbab6);return _0x10f6a3[_0x7bb0('0x1d')](_0x7bb0('0x1e'),_0x454605+'-'+_0x193d0d+'/'+_0x30d86d)[_0x7bb0('0x18')](_0x1afd7e);}return null;};}function patchUpdates(_0x30828b){return function(_0x449c9a){try{jsonpatch[_0x7bb0('0x1f')](_0x449c9a,_0x30828b,!![]);}catch(_0x4f4a47){return BPromise[_0x7bb0('0x20')](_0x4f4a47);}return _0x449c9a[_0x7bb0('0x21')]();};}function saveUpdates(_0x5ee980,_0x947fe7){return function(_0x3ac119){if(_0x3ac119){return _0x3ac119['update'](_0x5ee980)[_0x7bb0('0x22')](function(_0x353b44){return _0x353b44;});}return null;};}function removeEntity(_0x2baeda,_0x1a132c){return function(_0x5f0c3b){if(_0x5f0c3b){return _0x5f0c3b[_0x7bb0('0x23')]()[_0x7bb0('0x22')](function(){_0x2baeda['status'](0xcc)[_0x7bb0('0x17')]();});}};}function handleEntityNotFound(_0x8fc90e,_0x4636aa){return function(_0x59f648){if(!_0x59f648){_0x8fc90e[_0x7bb0('0x15')](0x194);}return _0x59f648;};}function handleError(_0x225dc1,_0x400a56){_0x400a56=_0x400a56||0x1f4;return function(_0x1480a2){logger[_0x7bb0('0x24')](_0x1480a2['stack']);if(_0x1480a2[_0x7bb0('0x25')]){delete _0x1480a2[_0x7bb0('0x25')];}_0x225dc1[_0x7bb0('0x16')](_0x400a56)['send'](_0x1480a2);};}exports['index']=function(_0x5a8b03,_0x280a5d){var _0x43cb74={},_0x2c3b94={},_0x100b18={'count':0x0,'rows':[]};var _0x29ef0c=_[_0x7bb0('0x26')](db[_0x7bb0('0x27')][_0x7bb0('0x28')],function(_0x590911){return{'name':_0x590911['fieldName'],'type':_0x590911['type']['key']};});_0x2c3b94[_0x7bb0('0x29')]=_[_0x7bb0('0x26')](_0x29ef0c,_0x7bb0('0x25'));_0x2c3b94[_0x7bb0('0x2a')]=_['keys'](_0x5a8b03[_0x7bb0('0x2a')]);_0x2c3b94[_0x7bb0('0x2b')]=_[_0x7bb0('0x2c')](_0x2c3b94[_0x7bb0('0x29')],_0x2c3b94[_0x7bb0('0x2a')]);_0x43cb74[_0x7bb0('0x2d')]=_['intersection'](_0x2c3b94['model'],qs['fields'](_0x5a8b03[_0x7bb0('0x2a')][_0x7bb0('0x2e')]));_0x43cb74[_0x7bb0('0x2d')]=_0x43cb74[_0x7bb0('0x2d')]['length']?_0x43cb74['attributes']:_0x2c3b94[_0x7bb0('0x29')];if(!_0x5a8b03['query']['hasOwnProperty'](_0x7bb0('0x2f'))){_0x43cb74[_0x7bb0('0x1b')]=qs[_0x7bb0('0x1b')](_0x5a8b03[_0x7bb0('0x2a')][_0x7bb0('0x1b')]);_0x43cb74[_0x7bb0('0x19')]=qs['offset'](_0x5a8b03['query'][_0x7bb0('0x19')]);}_0x43cb74['order']=qs[_0x7bb0('0x30')](_0x5a8b03['query'][_0x7bb0('0x30')]);_0x43cb74[_0x7bb0('0x31')]=qs[_0x7bb0('0x2b')](_[_0x7bb0('0x32')](_0x5a8b03['query'],_0x2c3b94[_0x7bb0('0x2b')]),_0x29ef0c);if(_0x5a8b03[_0x7bb0('0x2a')]['filter']){_0x43cb74['where']=_[_0x7bb0('0x33')](_0x43cb74[_0x7bb0('0x31')],{'$or':_[_0x7bb0('0x26')](_0x29ef0c,function(_0x2a445c){if(_0x2a445c[_0x7bb0('0x34')]!==_0x7bb0('0x35')){var _0x2b240c={};_0x2b240c[_0x2a445c[_0x7bb0('0x25')]]={'$like':'%'+_0x5a8b03[_0x7bb0('0x2a')][_0x7bb0('0x36')]+'%'};return _0x2b240c;}})});}_0x43cb74=_[_0x7bb0('0x33')]({},_0x43cb74,_0x5a8b03[_0x7bb0('0x37')]);var _0x3973be={'where':_0x43cb74[_0x7bb0('0x31')]};return db[_0x7bb0('0x27')][_0x7bb0('0x1c')](_0x3973be)[_0x7bb0('0x22')](function(_0xf1b1a){_0x100b18['count']=_0xf1b1a;if(_0x5a8b03[_0x7bb0('0x2a')][_0x7bb0('0x38')]){_0x43cb74[_0x7bb0('0x39')]=[{'all':!![]}];}return db[_0x7bb0('0x27')][_0x7bb0('0x3a')](_0x43cb74);})[_0x7bb0('0x22')](function(_0x43fc53){_0x100b18[_0x7bb0('0x3b')]=_0x43fc53;return _0x100b18;})[_0x7bb0('0x22')](respondWithFilteredResult(_0x280a5d,_0x43cb74))[_0x7bb0('0x3c')](handleError(_0x280a5d,null));};exports[_0x7bb0('0x3d')]=function(_0x15b32b,_0x4c601b){var _0x3f4435={'raw':![],'where':{'id':_0x15b32b[_0x7bb0('0x3e')]['id']}},_0x9ef436={};_0x9ef436[_0x7bb0('0x29')]=_['keys'](db[_0x7bb0('0x27')][_0x7bb0('0x28')]);_0x9ef436[_0x7bb0('0x2a')]=_[_0x7bb0('0x3f')](_0x15b32b[_0x7bb0('0x2a')]);_0x9ef436[_0x7bb0('0x2b')]=_['intersection'](_0x9ef436[_0x7bb0('0x29')],_0x9ef436['query']);_0x3f4435['attributes']=_[_0x7bb0('0x2c')](_0x9ef436[_0x7bb0('0x29')],qs['fields'](_0x15b32b[_0x7bb0('0x2a')][_0x7bb0('0x2e')]));_0x3f4435[_0x7bb0('0x2d')]=_0x3f4435[_0x7bb0('0x2d')]['length']?_0x3f4435[_0x7bb0('0x2d')]:_0x9ef436[_0x7bb0('0x29')];if(_0x15b32b[_0x7bb0('0x2a')][_0x7bb0('0x38')]){_0x3f4435[_0x7bb0('0x39')]=[{'all':!![]}];}_0x3f4435=_[_0x7bb0('0x33')]({},_0x3f4435,_0x15b32b[_0x7bb0('0x37')]);return db[_0x7bb0('0x27')]['find'](_0x3f4435)['then'](handleEntityNotFound(_0x4c601b,null))[_0x7bb0('0x22')](respondWithResult(_0x4c601b,null))[_0x7bb0('0x3c')](handleError(_0x4c601b,null));};exports[_0x7bb0('0x40')]=function(_0x2ca2fd,_0x1832e7){return db[_0x7bb0('0x27')][_0x7bb0('0x40')](_0x2ca2fd[_0x7bb0('0x41')],{})[_0x7bb0('0x22')](respondWithResult(_0x1832e7,0xc9))[_0x7bb0('0x3c')](handleError(_0x1832e7,null));};exports[_0x7bb0('0x42')]=function(_0x18718d,_0x145c2c){if(_0x18718d[_0x7bb0('0x41')]['id']){delete _0x18718d[_0x7bb0('0x41')]['id'];}return db[_0x7bb0('0x27')][_0x7bb0('0x43')]({'where':{'id':_0x18718d[_0x7bb0('0x3e')]['id']}})[_0x7bb0('0x22')](handleEntityNotFound(_0x145c2c,null))['then'](saveUpdates(_0x18718d['body'],null))[_0x7bb0('0x22')](respondWithResult(_0x145c2c,null))[_0x7bb0('0x3c')](handleError(_0x145c2c,null));};exports[_0x7bb0('0x23')]=function(_0x6d7fa5,_0x2980aa){return db['UserProfileSection']['find']({'where':{'id':_0x6d7fa5[_0x7bb0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2980aa,null))[_0x7bb0('0x22')](removeEntity(_0x2980aa,null))[_0x7bb0('0x3c')](handleError(_0x2980aa,null));};exports['describe']=function(_0x5d703e,_0x389dd4){return db[_0x7bb0('0x27')]['describe']()[_0x7bb0('0x22')](respondWithResult(_0x389dd4,null))[_0x7bb0('0x3c')](handleError(_0x389dd4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 7f7a1b2..0a09d0b 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 _0x43ef=['sectionId','userProfileId','lodash','util','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x43ef,0xc6));var _0xf43e=function(_0x17a6b0,_0x1abb71){_0x17a6b0=_0x17a6b0-0x0;var _0x343821=_0x43ef[_0x17a6b0];return _0x343821;};'use strict';var _=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf43e('0x2'));var BPromise=require(_0xf43e('0x3'));var rp=require(_0xf43e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf43e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf43e('0x6'));module[_0xf43e('0x7')]=function(_0x46b967,_0x2d984a){return _0x46b967[_0xf43e('0x8')](_0xf43e('0x9'),attributes,{'tableName':_0xf43e('0xa'),'paranoid':![],'indexes':[{'name':_0xf43e('0xb'),'fields':[_0xf43e('0xc'),_0xf43e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79a4=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0x79a4,0xeb));var _0x479a=function(_0x2f6088,_0x525fec){_0x2f6088=_0x2f6088-0x0;var _0xc5ad3c=_0x79a4[_0x2f6088];return _0xc5ad3c;};'use strict';var _=require(_0x479a('0x0'));var util=require(_0x479a('0x1'));var logger=require(_0x479a('0x2'))(_0x479a('0x3'));var moment=require('moment');var BPromise=require(_0x479a('0x4'));var rp=require(_0x479a('0x5'));var fs=require('fs');var path=require(_0x479a('0x6'));var rimraf=require(_0x479a('0x7'));var config=require(_0x479a('0x8'));var attributes=require(_0x479a('0x9'));module[_0x479a('0xa')]=function(_0x4ae49b,_0x473291){return _0x4ae49b[_0x479a('0xb')](_0x479a('0xc'),attributes,{'tableName':_0x479a('0xd'),'paranoid':![],'indexes':[{'name':_0x479a('0xe'),'fields':[_0x479a('0xf'),_0x479a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 33e14f6..8a3365c 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 _0x0d92=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0d92,0x1d1));var _0x20d9=function(_0x27ebb0,_0x1d8df6){_0x27ebb0=_0x27ebb0-0x0;var _0x29a4ba=_0x0d92[_0x27ebb0];return _0x29a4ba;};'use strict';var _=require(_0x20d9('0x0'));var util=require(_0x20d9('0x1'));var moment=require(_0x20d9('0x2'));var BPromise=require(_0x20d9('0x3'));var rs=require(_0x20d9('0x4'));var fs=require('fs');var Redis=require(_0x20d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x20d9('0x6'));var logger=require(_0x20d9('0x7'))(_0x20d9('0x8'));var config=require('../../config/environment');var jayson=require(_0x20d9('0x9'));var client=jayson[_0x20d9('0xa')][_0x20d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb0f2,_0x76ccf1,_0x37b705){return new BPromise(function(_0x4286da,_0x31b933){return client['request'](_0x5eb0f2,_0x37b705)[_0x20d9('0xc')](function(_0x4e6711){logger[_0x20d9('0xd')](_0x20d9('0xe'),_0x76ccf1,'request\x20sent');logger[_0x20d9('0xf')](_0x20d9('0x10'),_0x76ccf1,_0x20d9('0x11'),JSON['stringify'](_0x4e6711));if(_0x4e6711[_0x20d9('0x12')]){if(_0x4e6711['error'][_0x20d9('0x13')]===0x1f4){logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x4e6711[_0x20d9('0x12')]['message']);return _0x31b933(_0x4e6711[_0x20d9('0x12')][_0x20d9('0x14')]);}logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x4e6711['error'][_0x20d9('0x14')]);return _0x4286da(_0x4e6711['error'][_0x20d9('0x14')]);}else{logger[_0x20d9('0xd')](_0x20d9('0xe'),_0x76ccf1,'request\x20sent');_0x4286da(_0x4e6711[_0x20d9('0x15')][_0x20d9('0x14')]);}})['catch'](function(_0x545942){logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x545942);_0x31b933(_0x545942);});});} \ No newline at end of file +var _0x3e2a=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0x3e2a,0xa0));var _0xa3e2=function(_0x56c95c,_0x2c1be0){_0x56c95c=_0x56c95c-0x0;var _0x81c774=_0x3e2a[_0x56c95c];return _0x81c774;};'use strict';var _=require('lodash');var util=require(_0xa3e2('0x0'));var moment=require(_0xa3e2('0x1'));var BPromise=require(_0xa3e2('0x2'));var rs=require(_0xa3e2('0x3'));var fs=require('fs');var Redis=require(_0xa3e2('0x4'));var db=require(_0xa3e2('0x5'))['db'];var utils=require(_0xa3e2('0x6'));var logger=require(_0xa3e2('0x7'))('rpc');var config=require(_0xa3e2('0x8'));var jayson=require(_0xa3e2('0x9'));var client=jayson[_0xa3e2('0xa')][_0xa3e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aa9c5,_0x3b1e8f,_0x30e5f9){return new BPromise(function(_0x1d1119,_0x5c853d){return client[_0xa3e2('0xc')](_0x3aa9c5,_0x30e5f9)[_0xa3e2('0xd')](function(_0x4ed797){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x3b1e8f,'request\x20sent');logger[_0xa3e2('0xe')](_0xa3e2('0xf'),_0x3b1e8f,'request\x20sent',JSON[_0xa3e2('0x10')](_0x4ed797));if(_0x4ed797[_0xa3e2('0x11')]){if(_0x4ed797[_0xa3e2('0x11')][_0xa3e2('0x12')]===0x1f4){logger[_0xa3e2('0x11')](_0xa3e2('0x13'),_0x3b1e8f,_0x4ed797['error'][_0xa3e2('0x14')]);return _0x5c853d(_0x4ed797[_0xa3e2('0x11')][_0xa3e2('0x14')]);}logger[_0xa3e2('0x11')](_0xa3e2('0x13'),_0x3b1e8f,_0x4ed797[_0xa3e2('0x11')][_0xa3e2('0x14')]);return _0x1d1119(_0x4ed797[_0xa3e2('0x11')]['message']);}else{logger[_0xa3e2('0x15')](_0xa3e2('0x13'),_0x3b1e8f,_0xa3e2('0x16'));_0x1d1119(_0x4ed797[_0xa3e2('0x17')][_0xa3e2('0x14')]);}})[_0xa3e2('0x18')](function(_0x983f88){logger[_0xa3e2('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x3b1e8f,_0x983f88);_0x5c853d(_0x983f88);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f697ef4..65c3565 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4f98bd,_0x5a478d){var _0x143a7d=function(_0xb4e744){while(--_0xb4e744){_0x4f98bd['push'](_0x4f98bd['shift']());}};_0x143a7d(++_0x5a478d);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x7ce24c,_0x359fb9){var _0x38f713=function(_0x2d76ef){while(--_0x2d76ef){_0x7ce24c['push'](_0x7ce24c['shift']());}};_0x38f713(++_0x359fb9);}(_0x70e0,0x17b));var _0x070e=function(_0x5d3eca,_0x5d0820){_0x5d3eca=_0x5d3eca-0x0;var _0x37c68f=_0x70e0[_0x5d3eca];return _0x37c68f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 67b9e29..cea1845 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 _0x3442=['exports','INTEGER','sequelize'];(function(_0x49368d,_0xa36d84){var _0x528010=function(_0x16967e){while(--_0x16967e){_0x49368d['push'](_0x49368d['shift']());}};_0x528010(++_0xa36d84);}(_0x3442,0x194));var _0x2344=function(_0xbdf188,_0x40071a){_0xbdf188=_0xbdf188-0x0;var _0x3a536c=_0x3442[_0xbdf188];return _0x3a536c;};'use strict';var Sequelize=require(_0x2344('0x0'));module[_0x2344('0x1')]={'penalty':{'type':Sequelize[_0x2344('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x87f3=['INTEGER','exports'];(function(_0x201c00,_0xc3b3fd){var _0x47ba3c=function(_0x583c7d){while(--_0x583c7d){_0x201c00['push'](_0x201c00['shift']());}};_0x47ba3c(++_0xc3b3fd);}(_0x87f3,0x165));var _0x387f=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x87f3[_0x55ff3e];return _0x2709eb;};'use strict';var Sequelize=require('sequelize');module[_0x387f('0x0')]={'penalty':{'type':Sequelize[_0x387f('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 51d7d99..2d11d2a 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 _0x90ec=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x90ec,0x1d4));var _0xc90e=function(_0x4e9bf9,_0x235043){_0x4e9bf9=_0x4e9bf9-0x0;var _0x5685e2=_0x90ec[_0x4e9bf9];return _0x5685e2;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require('../../config/logger')(_0xc90e('0x2'));var moment=require(_0xc90e('0x3'));var BPromise=require(_0xc90e('0x4'));var rp=require(_0xc90e('0x5'));var fs=require('fs');var path=require(_0xc90e('0x6'));var rimraf=require('rimraf');var config=require(_0xc90e('0x7'));var attributes=require(_0xc90e('0x8'));module[_0xc90e('0x9')]=function(_0x54a0a8,_0x259c62){return _0x54a0a8['define'](_0xc90e('0xa'),attributes,{'tableName':_0xc90e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x467bb7,_0x33a845){var _0x308b55=function(_0xa52571){while(--_0xa52571){_0x467bb7['push'](_0x467bb7['shift']());}};_0x308b55(++_0x33a845);}(_0x11e5,0x8b));var _0x511e=function(_0x12bc0d,_0x1e40ca){_0x12bc0d=_0x12bc0d-0x0;var _0x18cf40=_0x11e5[_0x12bc0d];return _0x18cf40;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('UserSmsQueue',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 cd37d00..8f61fc3 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 _0xe81c=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x17d349,_0x150471){var _0x1e9a52=function(_0x2351ee){while(--_0x2351ee){_0x17d349['push'](_0x17d349['shift']());}};_0x1e9a52(++_0x150471);}(_0xe81c,0xa6));var _0xce81=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0xe81c[_0x5f2098];return _0x18af32;};'use strict';var _=require(_0xce81('0x0'));var util=require(_0xce81('0x1'));var moment=require(_0xce81('0x2'));var BPromise=require(_0xce81('0x3'));var rs=require(_0xce81('0x4'));var fs=require('fs');var Redis=require(_0xce81('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce81('0x6'));var logger=require(_0xce81('0x7'))(_0xce81('0x8'));var config=require('../../config/environment');var jayson=require(_0xce81('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc1a6,_0x4310e1,_0x1fb974){return new BPromise(function(_0x5d07b0,_0x172cde){return client[_0xce81('0xa')](_0x5cc1a6,_0x1fb974)['then'](function(_0x1360c5){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4310e1,_0xce81('0xb'));logger[_0xce81('0xc')](_0xce81('0xd'),_0x4310e1,_0xce81('0xb'),JSON[_0xce81('0xe')](_0x1360c5));if(_0x1360c5['error']){if(_0x1360c5[_0xce81('0xf')][_0xce81('0x10')]===0x1f4){logger[_0xce81('0xf')](_0xce81('0x11'),_0x4310e1,_0x1360c5[_0xce81('0xf')][_0xce81('0x12')]);return _0x172cde(_0x1360c5[_0xce81('0xf')][_0xce81('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4310e1,_0x1360c5[_0xce81('0xf')][_0xce81('0x12')]);return _0x5d07b0(_0x1360c5['error'][_0xce81('0x12')]);}else{logger[_0xce81('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x4310e1,'request\x20sent');_0x5d07b0(_0x1360c5['result'][_0xce81('0x12')]);}})[_0xce81('0x14')](function(_0x1b421f){logger[_0xce81('0xf')](_0xce81('0x11'),_0x4310e1,_0x1b421f);_0x172cde(_0x1b421f);});});} \ No newline at end of file +var _0x0657=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4425ea,_0x19d6f3){var _0x10f6af=function(_0x322c57){while(--_0x322c57){_0x4425ea['push'](_0x4425ea['shift']());}};_0x10f6af(++_0x19d6f3);}(_0x0657,0x12d));var _0x7065=function(_0x4ce25d,_0xfd5172){_0x4ce25d=_0x4ce25d-0x0;var _0x1fc1e1=_0x0657[_0x4ce25d];return _0x1fc1e1;};'use strict';var _=require('lodash');var util=require(_0x7065('0x0'));var moment=require('moment');var BPromise=require(_0x7065('0x1'));var rs=require(_0x7065('0x2'));var fs=require('fs');var Redis=require(_0x7065('0x3'));var db=require(_0x7065('0x4'))['db'];var utils=require(_0x7065('0x5'));var logger=require(_0x7065('0x6'))(_0x7065('0x7'));var config=require('../../config/environment');var jayson=require(_0x7065('0x8'));var client=jayson[_0x7065('0x9')][_0x7065('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a6a,_0x126947,_0x32d753){return new BPromise(function(_0x248ca9,_0x982be0){return client[_0x7065('0xb')](_0x3f9a6a,_0x32d753)[_0x7065('0xc')](function(_0x17d08d){logger[_0x7065('0xd')](_0x7065('0xe'),_0x126947,_0x7065('0xf'));logger[_0x7065('0x10')](_0x7065('0x11'),_0x126947,_0x7065('0xf'),JSON['stringify'](_0x17d08d));if(_0x17d08d['error']){if(_0x17d08d[_0x7065('0x12')]['code']===0x1f4){logger[_0x7065('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x126947,_0x17d08d[_0x7065('0x12')][_0x7065('0x13')]);return _0x982be0(_0x17d08d['error'][_0x7065('0x13')]);}logger[_0x7065('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x126947,_0x17d08d[_0x7065('0x12')]['message']);return _0x248ca9(_0x17d08d[_0x7065('0x12')]['message']);}else{logger[_0x7065('0xd')](_0x7065('0xe'),_0x126947,'request\x20sent');_0x248ca9(_0x17d08d[_0x7065('0x14')]['message']);}})['catch'](function(_0x2984ca){logger[_0x7065('0x12')](_0x7065('0xe'),_0x126947,_0x2984ca);_0x982be0(_0x2984ca);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 9db71c2..7fbac02 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 _0x6190=['exports','INTEGER'];(function(_0x3ddd13,_0x30f93c){var _0x4d1771=function(_0x13c6a9){while(--_0x13c6a9){_0x3ddd13['push'](_0x3ddd13['shift']());}};_0x4d1771(++_0x30f93c);}(_0x6190,0x1a2));var _0x0619=function(_0x1d8891,_0x578c2d){_0x1d8891=_0x1d8891-0x0;var _0x5c90fa=_0x6190[_0x1d8891];return _0x5c90fa;};'use strict';var Sequelize=require('sequelize');module[_0x0619('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0619('0x1')]}}; \ No newline at end of file +var _0xf7d7=['INTEGER','sequelize','exports'];(function(_0x4aa5c2,_0x35cf13){var _0xb8c19a=function(_0x35689a){while(--_0x35689a){_0x4aa5c2['push'](_0x4aa5c2['shift']());}};_0xb8c19a(++_0x35cf13);}(_0xf7d7,0x19f));var _0x7f7d=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xf7d7[_0x9c2427];return _0x51984f;};'use strict';var Sequelize=require(_0x7f7d('0x0'));module[_0x7f7d('0x1')]={'UserId':{'type':Sequelize[_0x7f7d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7f7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 37d3b0e..3b22ec9 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(_0x437cc1,_0x4cbd63){var _0x2f6c5a=function(_0x53bf9a){while(--_0x53bf9a){_0x437cc1['push'](_0x437cc1['shift']());}};_0x2f6c5a(++_0x4cbd63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x92a8f4,_0x30e671){var _0x250832=function(_0x567795){while(--_0x567795){_0x92a8f4['push'](_0x92a8f4['shift']());}};_0x250832(++_0x30e671);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index d848482..a5c881a 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56d096,_0x3486bc){var _0x473110=function(_0x1e664b){while(--_0x1e664b){_0x56d096['push'](_0x56d096['shift']());}};_0x473110(++_0x3486bc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b2193,_0x220cf2){var _0xd4faf8=function(_0x248b8d){while(--_0x248b8d){_0x2b2193['push'](_0x2b2193['shift']());}};_0xd4faf8(++_0x220cf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b60125c..4679efd 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 _0x2bfa=['exports','INTEGER'];(function(_0x20c434,_0x9b5b7e){var _0x24d74f=function(_0x485d8b){while(--_0x485d8b){_0x20c434['push'](_0x20c434['shift']());}};_0x24d74f(++_0x9b5b7e);}(_0x2bfa,0x7c));var _0xa2bf=function(_0x1ab0aa,_0x1c7246){_0x1ab0aa=_0x1ab0aa-0x0;var _0x441801=_0x2bfa[_0x1ab0aa];return _0x441801;};'use strict';var Sequelize=require('sequelize');module[_0xa2bf('0x0')]={'penalty':{'type':Sequelize[_0xa2bf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x261b=['sequelize','exports','INTEGER'];(function(_0x4ab3e0,_0x23c06b){var _0x3f9f9c=function(_0x4e3ffe){while(--_0x4e3ffe){_0x4ab3e0['push'](_0x4ab3e0['shift']());}};_0x3f9f9c(++_0x23c06b);}(_0x261b,0x195));var _0xb261=function(_0x5211e2,_0x21ff96){_0x5211e2=_0x5211e2-0x0;var _0x2d753b=_0x261b[_0x5211e2];return _0x2d753b;};'use strict';var Sequelize=require(_0xb261('0x0'));module[_0xb261('0x1')]={'penalty':{'type':Sequelize[_0xb261('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index cf77182..2a0403f 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 _0xc144=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','util'];(function(_0x2ad613,_0x2d8648){var _0x5bd8f3=function(_0x157379){while(--_0x157379){_0x2ad613['push'](_0x2ad613['shift']());}};_0x5bd8f3(++_0x2d8648);}(_0xc144,0x19f));var _0x4c14=function(_0x2a9cc6,_0x25e508){_0x2a9cc6=_0x2a9cc6-0x0;var _0x2043d3=_0xc144[_0x2a9cc6];return _0x2043d3;};'use strict';var _=require('lodash');var util=require(_0x4c14('0x0'));var logger=require(_0x4c14('0x1'))(_0x4c14('0x2'));var moment=require('moment');var BPromise=require(_0x4c14('0x3'));var rp=require(_0x4c14('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c14('0x5'));var config=require(_0x4c14('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x4c14('0x7')]=function(_0x2f8f0d,_0x525485){return _0x2f8f0d['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4729=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment'];(function(_0x2e71e7,_0x216597){var _0x4279b9=function(_0x509463){while(--_0x509463){_0x2e71e7['push'](_0x2e71e7['shift']());}};_0x4279b9(++_0x216597);}(_0x4729,0xe1));var _0x9472=function(_0x47da22,_0x5f48f1){_0x47da22=_0x47da22-0x0;var _0xbd7ef3=_0x4729[_0x47da22];return _0xbd7ef3;};'use strict';var _=require(_0x9472('0x0'));var util=require(_0x9472('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9472('0x2'));var BPromise=require(_0x9472('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9472('0x4'));var rimraf=require(_0x9472('0x5'));var config=require(_0x9472('0x6'));var attributes=require(_0x9472('0x7'));module[_0x9472('0x8')]=function(_0x32202d,_0x5d483a){return _0x32202d[_0x9472('0x9')](_0x9472('0xa'),attributes,{'tableName':_0x9472('0xb'),'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 284ccfe..c995c0f 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 _0xb727=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x17bc6a,_0x308586){var _0x4e629d=function(_0x19d7b3){while(--_0x19d7b3){_0x17bc6a['push'](_0x17bc6a['shift']());}};_0x4e629d(++_0x308586);}(_0xb727,0x17f));var _0x7b72=function(_0x370c0b,_0x1a2326){_0x370c0b=_0x370c0b-0x0;var _0xae0254=_0xb727[_0x370c0b];return _0xae0254;};'use strict';var _=require('lodash');var util=require(_0x7b72('0x0'));var moment=require(_0x7b72('0x1'));var BPromise=require(_0x7b72('0x2'));var rs=require(_0x7b72('0x3'));var fs=require('fs');var Redis=require(_0x7b72('0x4'));var db=require(_0x7b72('0x5'))['db'];var utils=require(_0x7b72('0x6'));var logger=require('../../config/logger')(_0x7b72('0x7'));var config=require(_0x7b72('0x8'));var jayson=require(_0x7b72('0x9'));var client=jayson['client'][_0x7b72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457d4e,_0x34512a,_0x4c642c){return new BPromise(function(_0x32feef,_0x303707){return client[_0x7b72('0xb')](_0x457d4e,_0x4c642c)[_0x7b72('0xc')](function(_0x447b25){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x34512a,_0x7b72('0xd'));logger[_0x7b72('0xe')](_0x7b72('0xf'),_0x34512a,_0x7b72('0xd'),JSON[_0x7b72('0x10')](_0x447b25));if(_0x447b25[_0x7b72('0x11')]){if(_0x447b25['error']['code']===0x1f4){logger[_0x7b72('0x11')](_0x7b72('0x12'),_0x34512a,_0x447b25['error'][_0x7b72('0x13')]);return _0x303707(_0x447b25['error'][_0x7b72('0x13')]);}logger[_0x7b72('0x11')](_0x7b72('0x12'),_0x34512a,_0x447b25['error'][_0x7b72('0x13')]);return _0x32feef(_0x447b25[_0x7b72('0x11')][_0x7b72('0x13')]);}else{logger['info'](_0x7b72('0x12'),_0x34512a,'request\x20sent');_0x32feef(_0x447b25[_0x7b72('0x14')][_0x7b72('0x13')]);}})[_0x7b72('0x15')](function(_0x275c23){logger['error'](_0x7b72('0x12'),_0x34512a,_0x275c23);_0x303707(_0x275c23);});});} \ No newline at end of file +var _0x875e=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x875e,0x106));var _0xe875=function(_0x3ea022,_0x2d5328){_0x3ea022=_0x3ea022-0x0;var _0x3b97a2=_0x875e[_0x3ea022];return _0x3b97a2;};'use strict';var _=require(_0xe875('0x0'));var util=require(_0xe875('0x1'));var moment=require(_0xe875('0x2'));var BPromise=require('bluebird');var rs=require(_0xe875('0x3'));var fs=require('fs');var Redis=require(_0xe875('0x4'));var db=require(_0xe875('0x5'))['db'];var utils=require(_0xe875('0x6'));var logger=require(_0xe875('0x7'))(_0xe875('0x8'));var config=require(_0xe875('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe875('0xa')][_0xe875('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a8ae9,_0x79cf6a,_0x5d2102){return new BPromise(function(_0x11c9b0,_0x2d44c5){return client[_0xe875('0xc')](_0x2a8ae9,_0x5d2102)[_0xe875('0xd')](function(_0x4b61f5){logger[_0xe875('0xe')](_0xe875('0xf'),_0x79cf6a,_0xe875('0x10'));logger[_0xe875('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x79cf6a,'request\x20sent',JSON[_0xe875('0x12')](_0x4b61f5));if(_0x4b61f5['error']){if(_0x4b61f5[_0xe875('0x13')][_0xe875('0x14')]===0x1f4){logger['error'](_0xe875('0xf'),_0x79cf6a,_0x4b61f5['error'][_0xe875('0x15')]);return _0x2d44c5(_0x4b61f5[_0xe875('0x13')][_0xe875('0x15')]);}logger[_0xe875('0x13')](_0xe875('0xf'),_0x79cf6a,_0x4b61f5[_0xe875('0x13')][_0xe875('0x15')]);return _0x11c9b0(_0x4b61f5[_0xe875('0x13')][_0xe875('0x15')]);}else{logger[_0xe875('0xe')](_0xe875('0xf'),_0x79cf6a,'request\x20sent');_0x11c9b0(_0x4b61f5[_0xe875('0x16')][_0xe875('0x15')]);}})[_0xe875('0x17')](function(_0x1db796){logger[_0xe875('0x13')](_0xe875('0xf'),_0x79cf6a,_0x1db796);_0x2d44c5(_0x1db796);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4a2afd3..24b08bb 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36b5be,_0x25cbb9){var _0x186b09=function(_0x559d03){while(--_0x559d03){_0x36b5be['push'](_0x36b5be['shift']());}};_0x186b09(++_0x25cbb9);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a6f95,_0x4787f7){var _0x1a5041=function(_0x11a509){while(--_0x11a509){_0x5a6f95['push'](_0x5a6f95['shift']());}};_0x1a5041(++_0x4787f7);}(_0xe706,0xa3));var _0x6e70=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0xe706[_0x414ff1];return _0x29c53f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 49de4eb..82de752 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 _0x127f=['Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER','STRING'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x127f,0xbc));var _0xf127=function(_0x224b1c,_0x5c242f){_0x224b1c=_0x224b1c-0x0;var _0x205659=_0x127f[_0x224b1c];return _0x205659;};'use strict';var Sequelize=require(_0xf127('0x0'));module[_0xf127('0x1')]={'uniqueid':{'type':Sequelize[_0xf127('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xf127('0x3')],'allowNull':![],'comment':_0xf127('0x4')},'UserId':{'type':Sequelize[_0xf127('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf127('0x3')],'allowNull':![],'unique':_0xf127('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf127('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xf127('0x4')},'penalty':{'type':Sequelize[_0xf127('0x2')](0xb),'defaultValue':0x0,'comment':_0xf127('0x4')},'paused':{'type':Sequelize[_0xf127('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x09eb=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x09eb,0x1d9));var _0xb09e=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0x09eb[_0x455893];return _0x3851e8;};'use strict';var Sequelize=require(_0xb09e('0x0'));module[_0xb09e('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb09e('0x2')},'membername':{'type':Sequelize[_0xb09e('0x3')],'allowNull':![],'comment':_0xb09e('0x2')},'UserId':{'type':Sequelize[_0xb09e('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb09e('0x5'),'comment':_0xb09e('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb09e('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xb09e('0x3')],'allowNull':![],'unique':_0xb09e('0x5'),'comment':_0xb09e('0x2')},'penalty':{'type':Sequelize[_0xb09e('0x4')](0xb),'defaultValue':0x0,'comment':_0xb09e('0x2')},'paused':{'type':Sequelize[_0xb09e('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2758aad..6ec95c6 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 _0xf813=['UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5e3e74,_0x98304){var _0x104728=function(_0x4b135b){while(--_0x4b135b){_0x5e3e74['push'](_0x5e3e74['shift']());}};_0x104728(++_0x98304);}(_0xf813,0x194));var _0x3f81=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0xf813[_0x287059];return _0x225c79;};'use strict';var EventEmitter=require(_0x3f81('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x3f81('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3f81('0x2')](0x0);var events={'afterCreate':_0x3f81('0x3'),'afterUpdate':_0x3f81('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54b67d){return function(_0x382f2c,_0x42b280,_0x2fb419){UserVoiceQueueRtEvents[_0x3f81('0x5')](_0x54b67d+':'+_0x382f2c['id'],_0x382f2c);UserVoiceQueueRtEvents[_0x3f81('0x5')](_0x54b67d,_0x382f2c);_0x2fb419(null);};}for(var e in events){if(events[_0x3f81('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x3f81('0x7')](e,emitEvent(event));}}module[_0x3f81('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x20e0=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x20e0,0x19a));var _0x020e=function(_0x157609,_0x23cd26){_0x157609=_0x157609-0x0;var _0x26d474=_0x20e0[_0x157609];return _0x26d474;};'use strict';var EventEmitter=require(_0x020e('0x0'));var UserVoiceQueueRt=require(_0x020e('0x1'))['db'][_0x020e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x020e('0x3')](0x0);var events={'afterCreate':_0x020e('0x4'),'afterUpdate':'update','afterDestroy':_0x020e('0x5')};function emitEvent(_0x4e5fb8){return function(_0x4f05ba,_0x379f7d,_0x9b1366){UserVoiceQueueRtEvents[_0x020e('0x6')](_0x4e5fb8+':'+_0x4f05ba['id'],_0x4f05ba);UserVoiceQueueRtEvents[_0x020e('0x6')](_0x4e5fb8,_0x4f05ba);_0x9b1366(null);};}for(var e in events){if(events[_0x020e('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x020e('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9dd93bd..565d6e1 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 _0x1155=['moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api'];(function(_0x16b67a,_0x445915){var _0x108f56=function(_0x2fd4ed){while(--_0x2fd4ed){_0x16b67a['push'](_0x16b67a['shift']());}};_0x108f56(++_0x445915);}(_0x1155,0x99));var _0x5115=function(_0x5d7417,_0x88d7ca){_0x5d7417=_0x5d7417-0x0;var _0x139270=_0x1155[_0x5d7417];return _0x139270;};'use strict';var _=require('lodash');var util=require(_0x5115('0x0'));var logger=require(_0x5115('0x1'))(_0x5115('0x2'));var moment=require(_0x5115('0x3'));var BPromise=require(_0x5115('0x4'));var rp=require(_0x5115('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5115('0x6'));var config=require(_0x5115('0x7'));var attributes=require(_0x5115('0x8'));module[_0x5115('0x9')]=function(_0x27e4e9,_0x31db53){return _0x27e4e9[_0x5115('0xa')](_0x5115('0xb'),attributes,{'tableName':_0x5115('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0114=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x5568ed,_0x61f3be){var _0x406c98=function(_0x3cc9a7){while(--_0x3cc9a7){_0x5568ed['push'](_0x5568ed['shift']());}};_0x406c98(++_0x61f3be);}(_0x0114,0x198));var _0x4011=function(_0xf4f46,_0x1f7bd1){_0xf4f46=_0xf4f46-0x0;var _0x263651=_0x0114[_0xf4f46];return _0x263651;};'use strict';var _=require(_0x4011('0x0'));var util=require('util');var logger=require(_0x4011('0x1'))('api');var moment=require(_0x4011('0x2'));var BPromise=require(_0x4011('0x3'));var rp=require(_0x4011('0x4'));var fs=require('fs');var path=require(_0x4011('0x5'));var rimraf=require(_0x4011('0x6'));var config=require(_0x4011('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x4011('0x8')]=function(_0x313e33,_0x479fc8){return _0x313e33[_0x4011('0x9')](_0x4011('0xa'),attributes,{'tableName':_0x4011('0xb'),'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 eb9f99e..a1a9ed4 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 _0x3ecf=['jayson/promise','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x59d7dd,_0x75a98d){var _0x53f598=function(_0x5044a4){while(--_0x5044a4){_0x59d7dd['push'](_0x59d7dd['shift']());}};_0x53f598(++_0x75a98d);}(_0x3ecf,0x1d4));var _0xf3ec=function(_0x3b8347,_0x142dc2){_0x3b8347=_0x3b8347-0x0;var _0x21777e=_0x3ecf[_0x3b8347];return _0x21777e;};'use strict';var _=require(_0xf3ec('0x0'));var util=require(_0xf3ec('0x1'));var moment=require(_0xf3ec('0x2'));var BPromise=require(_0xf3ec('0x3'));var rs=require(_0xf3ec('0x4'));var fs=require('fs');var Redis=require(_0xf3ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3ec('0x6'));var logger=require(_0xf3ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf3ec('0x8'));var client=jayson['client'][_0xf3ec('0x9')]({'port':0x232a});config['redis']=_[_0xf3ec('0xa')](config[_0xf3ec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3ec('0xc'))(new Redis(config[_0xf3ec('0xb')]));require(_0xf3ec('0xd'))[_0xf3ec('0xe')](socket);function respondWithRpcPromise(_0x24a5bd,_0x386847,_0x19444f){return new BPromise(function(_0x48042b,_0x42db99){return client[_0xf3ec('0xf')](_0x24a5bd,_0x19444f)['then'](function(_0x903af9){logger[_0xf3ec('0x10')](_0xf3ec('0x11'),_0x386847,_0xf3ec('0x12'));logger['debug'](_0xf3ec('0x13'),_0x386847,_0xf3ec('0x12'),JSON[_0xf3ec('0x14')](_0x903af9));if(_0x903af9[_0xf3ec('0x15')]){if(_0x903af9[_0xf3ec('0x15')]['code']===0x1f4){logger[_0xf3ec('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x386847,_0x903af9['error'][_0xf3ec('0x16')]);return _0x42db99(_0x903af9[_0xf3ec('0x15')][_0xf3ec('0x16')]);}logger['error'](_0xf3ec('0x11'),_0x386847,_0x903af9[_0xf3ec('0x15')][_0xf3ec('0x16')]);return _0x48042b(_0x903af9[_0xf3ec('0x15')][_0xf3ec('0x16')]);}else{logger[_0xf3ec('0x10')](_0xf3ec('0x11'),_0x386847,_0xf3ec('0x12'));_0x48042b(_0x903af9[_0xf3ec('0x17')][_0xf3ec('0x16')]);}})['catch'](function(_0x3f0a3a){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x386847,_0x3f0a3a);_0x42db99(_0x3f0a3a);});});}exports['GetVoiceQueueRtPauses']=function(_0x26baac){var _0x51f91a=this;return new Promise(function(_0x1d6036,_0x55f25c){return db[_0xf3ec('0x18')][_0xf3ec('0x19')]({'raw':_0x26baac[_0xf3ec('0x1a')]?_0x26baac['options'][_0xf3ec('0x1b')]===undefined?!![]:![]:!![],'where':_0x26baac['options']?_0x26baac['options']['where']||null:null,'attributes':[[db[_0xf3ec('0x1c')]['fn']('COUNT',db[_0xf3ec('0x1c')]['fn']('IF',db[_0xf3ec('0x1c')][_0xf3ec('0x1d')](_0xf3ec('0x1e')))),_0xf3ec('0x1f')]]})[_0xf3ec('0x20')](function(_0x360523){logger[_0xf3ec('0x10')]('GetVoiceQueueRtPauses',_0x26baac);logger['debug'](_0xf3ec('0x21'),_0x26baac,JSON[_0xf3ec('0x14')](_0x360523));_0x1d6036(_0x360523);})['catch'](function(_0x4c0248){logger[_0xf3ec('0x15')](_0xf3ec('0x21'),_0x4c0248[_0xf3ec('0x16')],_0x26baac);_0x55f25c(_0x51f91a[_0xf3ec('0x15')](0x1f4,_0x4c0248['message']));});});}; \ No newline at end of file +var _0xde9e=['http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0xde9e,0x69));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede9('0x0'));var util=require(_0xede9('0x1'));var moment=require(_0xede9('0x2'));var BPromise=require(_0xede9('0x3'));var rs=require(_0xede9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xede9('0x5'))['db'];var utils=require(_0xede9('0x6'));var logger=require(_0xede9('0x7'))(_0xede9('0x8'));var config=require(_0xede9('0x9'));var jayson=require(_0xede9('0xa'));var client=jayson[_0xede9('0xb')][_0xede9('0xc')]({'port':0x232a});config[_0xede9('0xd')]=_[_0xede9('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xede9('0xf'))(new Redis(config[_0xede9('0xd')]));require(_0xede9('0x10'))[_0xede9('0x11')](socket);function respondWithRpcPromise(_0x21ebc6,_0x542fbe,_0x3853fd){return new BPromise(function(_0xac50e3,_0x19490e){return client['request'](_0x21ebc6,_0x3853fd)[_0xede9('0x12')](function(_0x3356ce){logger[_0xede9('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x542fbe,'request\x20sent');logger['debug'](_0xede9('0x14'),_0x542fbe,_0xede9('0x15'),JSON[_0xede9('0x16')](_0x3356ce));if(_0x3356ce[_0xede9('0x17')]){if(_0x3356ce[_0xede9('0x17')][_0xede9('0x18')]===0x1f4){logger['error'](_0xede9('0x19'),_0x542fbe,_0x3356ce[_0xede9('0x17')]['message']);return _0x19490e(_0x3356ce['error'][_0xede9('0x1a')]);}logger[_0xede9('0x17')](_0xede9('0x19'),_0x542fbe,_0x3356ce[_0xede9('0x17')][_0xede9('0x1a')]);return _0xac50e3(_0x3356ce[_0xede9('0x17')][_0xede9('0x1a')]);}else{logger[_0xede9('0x13')](_0xede9('0x19'),_0x542fbe,_0xede9('0x15'));_0xac50e3(_0x3356ce[_0xede9('0x1b')][_0xede9('0x1a')]);}})[_0xede9('0x1c')](function(_0x5a226f){logger[_0xede9('0x17')](_0xede9('0x19'),_0x542fbe,_0x5a226f);_0x19490e(_0x5a226f);});});}exports[_0xede9('0x1d')]=function(_0x366f92){var _0xfb633e=this;return new Promise(function(_0x25f680,_0x532224){return db[_0xede9('0x1e')][_0xede9('0x1f')]({'raw':_0x366f92[_0xede9('0x20')]?_0x366f92[_0xede9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x366f92[_0xede9('0x20')]?_0x366f92[_0xede9('0x20')]['where']||null:null,'attributes':[[db[_0xede9('0x21')]['fn'](_0xede9('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xede9('0x23')](_0xede9('0x24')))),_0xede9('0x25')]]})['then'](function(_0x5172d7){logger[_0xede9('0x13')]('GetVoiceQueueRtPauses',_0x366f92);logger[_0xede9('0x26')]('GetVoiceQueueRtPauses',_0x366f92,JSON[_0xede9('0x16')](_0x5172d7));_0x25f680(_0x5172d7);})[_0xede9('0x1c')](function(_0x20c1ef){logger['error'](_0xede9('0x1d'),_0x20c1ef[_0xede9('0x1a')],_0x366f92);_0x532224(_0xfb633e[_0xede9('0x17')](0x1f4,_0x20c1ef[_0xede9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bda53d6..fd43186 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 _0x6bac=['./userVoiceQueueRt.events','remove','update','removeListener','length'];(function(_0x159af1,_0x5f23ce){var _0xc7aa7=function(_0x54d214){while(--_0x54d214){_0x159af1['push'](_0x159af1['shift']());}};_0xc7aa7(++_0x5f23ce);}(_0x6bac,0xa5));var _0xc6ba=function(_0x322024,_0x1340fb){_0x322024=_0x322024-0x0;var _0x4ffc7a=_0x6bac[_0x322024];return _0x4ffc7a;};'use strict';var UserVoiceQueueRtEvents=require(_0xc6ba('0x0'));var events=['save',_0xc6ba('0x1'),_0xc6ba('0x2')];function createListener(_0xf479c,_0x1869a3){return function(_0x489037){_0x1869a3['emit'](_0xf479c,_0x489037);};}function removeListener(_0x487ef1,_0x378f3d){return function(){UserVoiceQueueRtEvents[_0xc6ba('0x3')](_0x487ef1,_0x378f3d);};}exports['register']=function(_0x222f20){for(var _0x2a16af=0x0,_0x33167e=events[_0xc6ba('0x4')];_0x2a16af<_0x33167e;_0x2a16af++){var _0x12d6e9=events[_0x2a16af];var _0x1fa2a8=createListener('userVoiceQueueRt:'+_0x12d6e9,_0x222f20);UserVoiceQueueRtEvents['on'](_0x12d6e9,_0x1fa2a8);}}; \ No newline at end of file +var _0xab9f=['emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x4d8121,_0x2f5171){var _0x477e74=function(_0x5b2357){while(--_0x5b2357){_0x4d8121['push'](_0x4d8121['shift']());}};_0x477e74(++_0x2f5171);}(_0xab9f,0x1bd));var _0xfab9=function(_0x3a57b0,_0x23145a){_0x3a57b0=_0x3a57b0-0x0;var _0x2b8f3e=_0xab9f[_0x3a57b0];return _0x2b8f3e;};'use strict';var UserVoiceQueueRtEvents=require(_0xfab9('0x0'));var events=['save',_0xfab9('0x1'),_0xfab9('0x2')];function createListener(_0x4650a0,_0x52dab0){return function(_0xbdd0fa){_0x52dab0[_0xfab9('0x3')](_0x4650a0,_0xbdd0fa);};}function removeListener(_0x50b645,_0xb7152f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x50b645,_0xb7152f);};}exports[_0xfab9('0x4')]=function(_0x54ae20){for(var _0x1bfe77=0x0,_0x341aaf=events[_0xfab9('0x5')];_0x1bfe77<_0x341aaf;_0x1bfe77++){var _0x27e769=events[_0x1bfe77];var _0x524986=createListener(_0xfab9('0x6')+_0x27e769,_0x54ae20);UserVoiceQueueRtEvents['on'](_0x27e769,_0x524986);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 517109a..77e4b8b 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x182648,_0x2a7b01){var _0x10d106=function(_0x343645){while(--_0x343645){_0x182648['push'](_0x182648['shift']());}};_0x10d106(++_0x2a7b01);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1a86ec,_0x3feb05){var _0x2e2b34=function(_0x44d3bb){while(--_0x44d3bb){_0x1a86ec['push'](_0x1a86ec['shift']());}};_0x2e2b34(++_0x3feb05);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f92d1,_0x4e6aa2){_0x2f92d1=_0x2f92d1-0x0;var _0x2b0c0d=_0xedd9[_0x2f92d1];return _0x2b0c0d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9006424..69d5f76 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x117c=['exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x117c,0x8f));var _0xc117=function(_0x5f5c34,_0x23e89){_0x5f5c34=_0x5f5c34-0x0;var _0x48c0a7=_0x117c[_0x5f5c34];return _0x48c0a7;};'use strict';var Sequelize=require('sequelize');module[_0xc117('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 26ac1ad..9fc7737 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 _0xba62=['../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x28feec,_0x30514f){var _0x495efc=function(_0x4d6068){while(--_0x4d6068){_0x28feec['push'](_0x28feec['shift']());}};_0x495efc(++_0x30514f);}(_0xba62,0x126));var _0x2ba6=function(_0x5f584a,_0x47f064){_0x5f584a=_0x5f584a-0x0;var _0x3788d9=_0xba62[_0x5f584a];return _0x3788d9;};'use strict';var _=require(_0x2ba6('0x0'));var util=require('util');var logger=require(_0x2ba6('0x1'))(_0x2ba6('0x2'));var moment=require('moment');var BPromise=require(_0x2ba6('0x3'));var rp=require(_0x2ba6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ba6('0x5'));var config=require(_0x2ba6('0x6'));var attributes=require(_0x2ba6('0x7'));module['exports']=function(_0x205c82,_0x268033){return _0x205c82['define'](_0x2ba6('0x8'),attributes,{'tableName':_0x2ba6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d1c=['user_has_whatsapp_queues','lodash','../../config/logger','api','moment','path','../../config/environment','exports','UserWhatsappQueue'];(function(_0x495625,_0x2dbb3a){var _0xa034cc=function(_0x3af2a3){while(--_0x3af2a3){_0x495625['push'](_0x495625['shift']());}};_0xa034cc(++_0x2dbb3a);}(_0x2d1c,0x76));var _0xc2d1=function(_0x4aa0a5,_0x1a915b){_0x4aa0a5=_0x4aa0a5-0x0;var _0x293470=_0x2d1c[_0x4aa0a5];return _0x293470;};'use strict';var _=require(_0xc2d1('0x0'));var util=require('util');var logger=require(_0xc2d1('0x1'))(_0xc2d1('0x2'));var moment=require(_0xc2d1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2d1('0x4'));var rimraf=require('rimraf');var config=require(_0xc2d1('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xc2d1('0x6')]=function(_0x3f83ac,_0x2b8ade){return _0x3f83ac['define'](_0xc2d1('0x7'),attributes,{'tableName':_0xc2d1('0x8'),'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 bf02582..5efd7e8 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 _0x4413=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x4413,0x1da));var _0x3441=function(_0x568715,_0x3bdfcb){_0x568715=_0x568715-0x0;var _0xa6cfc8=_0x4413[_0x568715];return _0xa6cfc8;};'use strict';var _=require(_0x3441('0x0'));var util=require('util');var moment=require(_0x3441('0x1'));var BPromise=require(_0x3441('0x2'));var rs=require(_0x3441('0x3'));var fs=require('fs');var Redis=require(_0x3441('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3441('0x5'));var logger=require('../../config/logger')(_0x3441('0x6'));var config=require('../../config/environment');var jayson=require(_0x3441('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd85f9,_0x433a97,_0x19584f){return new BPromise(function(_0x16bc4b,_0x46b010){return client[_0x3441('0x8')](_0xd85f9,_0x19584f)[_0x3441('0x9')](function(_0x3b10a9){logger[_0x3441('0xa')](_0x3441('0xb'),_0x433a97,_0x3441('0xc'));logger['debug'](_0x3441('0xd'),_0x433a97,_0x3441('0xc'),JSON['stringify'](_0x3b10a9));if(_0x3b10a9[_0x3441('0xe')]){if(_0x3b10a9[_0x3441('0xe')][_0x3441('0xf')]===0x1f4){logger[_0x3441('0xe')](_0x3441('0xb'),_0x433a97,_0x3b10a9[_0x3441('0xe')][_0x3441('0x10')]);return _0x46b010(_0x3b10a9[_0x3441('0xe')][_0x3441('0x10')]);}logger[_0x3441('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x433a97,_0x3b10a9[_0x3441('0xe')][_0x3441('0x10')]);return _0x16bc4b(_0x3b10a9[_0x3441('0xe')][_0x3441('0x10')]);}else{logger[_0x3441('0xa')](_0x3441('0xb'),_0x433a97,_0x3441('0xc'));_0x16bc4b(_0x3b10a9[_0x3441('0x11')][_0x3441('0x10')]);}})[_0x3441('0x12')](function(_0x5ca7d8){logger[_0x3441('0xe')](_0x3441('0xb'),_0x433a97,_0x5ca7d8);_0x46b010(_0x5ca7d8);});});} \ No newline at end of file +var _0xded9=['catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d8065,_0x2c32cd){var _0x5bf04a=function(_0x2791f8){while(--_0x2791f8){_0x5d8065['push'](_0x5d8065['shift']());}};_0x5bf04a(++_0x2c32cd);}(_0xded9,0xb5));var _0x9ded=function(_0x18f533,_0xa5e674){_0x18f533=_0x18f533-0x0;var _0x153b34=_0xded9[_0x18f533];return _0x153b34;};'use strict';var _=require(_0x9ded('0x0'));var util=require('util');var moment=require(_0x9ded('0x1'));var BPromise=require('bluebird');var rs=require(_0x9ded('0x2'));var fs=require('fs');var Redis=require(_0x9ded('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ded('0x4'));var logger=require(_0x9ded('0x5'))(_0x9ded('0x6'));var config=require(_0x9ded('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x201f0b,_0x5ec5fb,_0x55df8a){return new BPromise(function(_0x358e94,_0x3b8d73){return client['request'](_0x201f0b,_0x55df8a)[_0x9ded('0x8')](function(_0x274e14){logger[_0x9ded('0x9')](_0x9ded('0xa'),_0x5ec5fb,_0x9ded('0xb'));logger[_0x9ded('0xc')](_0x9ded('0xd'),_0x5ec5fb,_0x9ded('0xb'),JSON[_0x9ded('0xe')](_0x274e14));if(_0x274e14[_0x9ded('0xf')]){if(_0x274e14[_0x9ded('0xf')][_0x9ded('0x10')]===0x1f4){logger[_0x9ded('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5ec5fb,_0x274e14['error'][_0x9ded('0x11')]);return _0x3b8d73(_0x274e14[_0x9ded('0xf')][_0x9ded('0x11')]);}logger[_0x9ded('0xf')](_0x9ded('0xa'),_0x5ec5fb,_0x274e14['error'][_0x9ded('0x11')]);return _0x358e94(_0x274e14[_0x9ded('0xf')][_0x9ded('0x11')]);}else{logger[_0x9ded('0x9')](_0x9ded('0xa'),_0x5ec5fb,'request\x20sent');_0x358e94(_0x274e14[_0x9ded('0x12')]['message']);}})[_0x9ded('0x13')](function(_0x59f8a9){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x5ec5fb,_0x59f8a9);_0x3b8d73(_0x59f8a9);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d1bb3ec..4fd97a2 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 _0x2bbb=['/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index'];(function(_0x59ce4d,_0x29bddc){var _0x42e64c=function(_0x7717c0){while(--_0x7717c0){_0x59ce4d['push'](_0x59ce4d['shift']());}};_0x42e64c(++_0x29bddc);}(_0x2bbb,0x85));var _0xb2bb=function(_0x2a1cab,_0x50e162){_0x2a1cab=_0x2a1cab-0x0;var _0x13000f=_0x2bbb[_0x2a1cab];return _0x13000f;};'use strict';var multer=require('multer');var util=require(_0xb2bb('0x0'));var path=require(_0xb2bb('0x1'));var timeout=require(_0xb2bb('0x2'));var express=require('express');var router=express[_0xb2bb('0x3')]();var fs_extra=require(_0xb2bb('0x4'));var auth=require(_0xb2bb('0x5'));var interaction=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var controller=require(_0xb2bb('0x8'));router['get']('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xa')]);router['get'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xc')]);router[_0xb2bb('0xd')]('/',auth['isAuthenticated'](),controller[_0xb2bb('0xe')]);router['put'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xf')]);router[_0xb2bb('0x10')](_0xb2bb('0xb'),auth['isAuthenticated'](),controller[_0xb2bb('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0ba7=['create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x0ba7,0x16d));var _0x70ba=function(_0x512e93,_0x7915ba){_0x512e93=_0x512e93-0x0;var _0x50bd84=_0x0ba7[_0x512e93];return _0x50bd84;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xd')]);router[_0x70ba('0xe')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x10')]('/:id',auth[_0x70ba('0xa')](),controller['update']);router[_0x70ba('0x11')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d21af6a..61a7241 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 _0x20fd=['exports','STRING','sequelize'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x20fd,0x125));var _0xd20f=function(_0x384b81,_0x514dfb){_0x384b81=_0x384b81-0x0;var _0x4b1e43=_0x20fd[_0x384b81];return _0x4b1e43;};'use strict';var Sequelize=require(_0xd20f('0x0'));module[_0xd20f('0x1')]={'name':{'type':Sequelize[_0xd20f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd20f('0x2')]}}; \ No newline at end of file +var _0xdae9=['exports','STRING','sequelize'];(function(_0x1f1f3b,_0x227aa9){var _0x2e63aa=function(_0x165a34){while(--_0x165a34){_0x1f1f3b['push'](_0x1f1f3b['shift']());}};_0x2e63aa(++_0x227aa9);}(_0xdae9,0x12b));var _0x9dae=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xdae9[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x9dae('0x0'));module[_0x9dae('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9dae('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b19df7e..a13becd 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 _0x9975=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','json','apply','reject','update','then','get','Variables','UserProfileResource','destroy','name','send','index','Variable','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x244745,_0xf9d957){var _0xf67728=function(_0x176722){while(--_0x176722){_0x244745['push'](_0x244745['shift']());}};_0xf67728(++_0xf9d957);}(_0x9975,0x89));var _0x5997=function(_0x1ebead,_0x362755){_0x1ebead=_0x1ebead-0x0;var _0x2445cc=_0x9975[_0x1ebead];return _0x2445cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5997('0x0'));var zipdir=require(_0x5997('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5997('0x2'));var BPromise=require(_0x5997('0x3'));var Mustache=require(_0x5997('0x4'));var util=require(_0x5997('0x5'));var path=require(_0x5997('0x6'));var sox=require(_0x5997('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5997('0x8'));var _=require(_0x5997('0x9'));var squel=require(_0x5997('0xa'));var crypto=require(_0x5997('0xb'));var jsforce=require(_0x5997('0xc'));var deskjs=require(_0x5997('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5997('0xe'));var Papa=require(_0x5997('0xf'));var Redis=require(_0x5997('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5997('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5997('0x12'));var logger=require('../../config/logger')(_0x5997('0x13'));var utils=require('../../config/utils');var config=require(_0x5997('0x14'));var licenseUtil=require(_0x5997('0x15'));var db=require(_0x5997('0x16'))['db'];function respondWithStatusCode(_0xda5f30,_0x213f70){_0x213f70=_0x213f70||0xcc;return function(_0x3b7fdc){if(_0x3b7fdc){return _0xda5f30[_0x5997('0x17')](_0x213f70);}return _0xda5f30['status'](_0x213f70)[_0x5997('0x18')]();};}function respondWithResult(_0x78ff5f,_0x6a58e0){_0x6a58e0=_0x6a58e0||0xc8;return function(_0x1f0714){if(_0x1f0714){return _0x78ff5f['status'](_0x6a58e0)['json'](_0x1f0714);}};}function respondWithFilteredResult(_0x5672fe,_0x318a81){return function(_0x35a1bd){if(_0x35a1bd){var _0x44fb50=typeof _0x318a81[_0x5997('0x19')]===_0x5997('0x1a')&&typeof _0x318a81[_0x5997('0x1b')]===_0x5997('0x1a');var _0x4a905c=_0x35a1bd[_0x5997('0x1c')];var _0x5312f4=_0x44fb50?0x0:_0x318a81[_0x5997('0x19')];var _0x5b1f9d=_0x44fb50?_0x35a1bd['count']:_0x318a81[_0x5997('0x19')]+_0x318a81[_0x5997('0x1b')];var _0x44fc2a;if(_0x5b1f9d>=_0x4a905c){_0x5b1f9d=_0x4a905c;_0x44fc2a=0xc8;}else{_0x44fc2a=0xce;}_0x5672fe[_0x5997('0x1d')](_0x44fc2a);return _0x5672fe[_0x5997('0x1e')]('Content-Range',_0x5312f4+'-'+_0x5b1f9d+'/'+_0x4a905c)[_0x5997('0x1f')](_0x35a1bd);}return null;};}function patchUpdates(_0x394f70){return function(_0x107923){try{jsonpatch[_0x5997('0x20')](_0x107923,_0x394f70,!![]);}catch(_0x11d1b1){return BPromise[_0x5997('0x21')](_0x11d1b1);}return _0x107923['save']();};}function saveUpdates(_0x11bad8,_0x1dd3fc){return function(_0xe9ca9d){if(_0xe9ca9d){return _0xe9ca9d[_0x5997('0x22')](_0x11bad8)[_0x5997('0x23')](function(_0x1ce13f){return _0x1ce13f;});}return null;};}function removeEntity(_0x124e8f,_0x4167da){return function(_0x46dd7d){if(_0x46dd7d){return _0x46dd7d['destroy']()[_0x5997('0x23')](function(){var _0x4d6b61=_0x46dd7d[_0x5997('0x24')]({'plain':!![]});var _0x26b276=_0x5997('0x25');return db[_0x5997('0x26')][_0x5997('0x27')]({'where':{'type':_0x26b276,'resourceId':_0x4d6b61['id']}})[_0x5997('0x23')](function(){return _0x46dd7d;});})[_0x5997('0x23')](function(){_0x124e8f[_0x5997('0x1d')](0xcc)[_0x5997('0x18')]();});}};}function handleEntityNotFound(_0xc632b7,_0x5578b0){return function(_0x248fcc){if(!_0x248fcc){_0xc632b7['sendStatus'](0x194);}return _0x248fcc;};}function handleError(_0x5b4e53,_0x4b82b2){_0x4b82b2=_0x4b82b2||0x1f4;return function(_0x3e5d01){logger['error'](_0x3e5d01['stack']);if(_0x3e5d01[_0x5997('0x28')]){delete _0x3e5d01[_0x5997('0x28')];}_0x5b4e53[_0x5997('0x1d')](_0x4b82b2)[_0x5997('0x29')](_0x3e5d01);};}exports[_0x5997('0x2a')]=function(_0x3bd253,_0x4f92a8){var _0x398ab9={},_0x19d4bf={},_0x45958d={'count':0x0,'rows':[]};var _0x46aef9=_['map'](db[_0x5997('0x2b')]['rawAttributes'],function(_0xd4b59){return{'name':_0xd4b59[_0x5997('0x2c')],'type':_0xd4b59['type'][_0x5997('0x2d')]};});_0x19d4bf['model']=_[_0x5997('0x2e')](_0x46aef9,_0x5997('0x28'));_0x19d4bf[_0x5997('0x2f')]=_[_0x5997('0x30')](_0x3bd253[_0x5997('0x2f')]);_0x19d4bf[_0x5997('0x31')]=_[_0x5997('0x32')](_0x19d4bf[_0x5997('0x33')],_0x19d4bf[_0x5997('0x2f')]);_0x398ab9[_0x5997('0x34')]=_[_0x5997('0x32')](_0x19d4bf[_0x5997('0x33')],qs['fields'](_0x3bd253[_0x5997('0x2f')][_0x5997('0x35')]));_0x398ab9[_0x5997('0x34')]=_0x398ab9[_0x5997('0x34')][_0x5997('0x36')]?_0x398ab9[_0x5997('0x34')]:_0x19d4bf['model'];if(!_0x3bd253['query'][_0x5997('0x37')]('nolimit')){_0x398ab9['limit']=qs['limit'](_0x3bd253[_0x5997('0x2f')][_0x5997('0x1b')]);_0x398ab9['offset']=qs[_0x5997('0x19')](_0x3bd253[_0x5997('0x2f')][_0x5997('0x19')]);}_0x398ab9[_0x5997('0x38')]=qs['sort'](_0x3bd253['query'][_0x5997('0x39')]);_0x398ab9[_0x5997('0x3a')]=qs['filters'](_['pick'](_0x3bd253[_0x5997('0x2f')],_0x19d4bf[_0x5997('0x31')]),_0x46aef9);if(_0x3bd253['query'][_0x5997('0x3b')]){_0x398ab9[_0x5997('0x3a')]=_[_0x5997('0x3c')](_0x398ab9[_0x5997('0x3a')],{'$or':_[_0x5997('0x2e')](_0x46aef9,function(_0x547aa5){if(_0x547aa5['type']!=='VIRTUAL'){var _0x4fb1b5={};_0x4fb1b5[_0x547aa5[_0x5997('0x28')]]={'$like':'%'+_0x3bd253[_0x5997('0x2f')][_0x5997('0x3b')]+'%'};return _0x4fb1b5;}})});}_0x398ab9=_[_0x5997('0x3c')]({},_0x398ab9,_0x3bd253['options']);var _0x257b05={'where':_0x398ab9['where']};return db[_0x5997('0x2b')][_0x5997('0x1c')](_0x257b05)['then'](function(_0x4e0210){_0x45958d[_0x5997('0x1c')]=_0x4e0210;if(_0x3bd253[_0x5997('0x2f')][_0x5997('0x3d')]){_0x398ab9[_0x5997('0x3e')]=[{'all':!![]}];}return db[_0x5997('0x2b')][_0x5997('0x3f')](_0x398ab9);})['then'](function(_0x50fac6){_0x45958d[_0x5997('0x40')]=_0x50fac6;return _0x45958d;})[_0x5997('0x23')](respondWithFilteredResult(_0x4f92a8,_0x398ab9))['catch'](handleError(_0x4f92a8,null));};exports[_0x5997('0x41')]=function(_0x355b64,_0x5a6786){var _0x2b3790={'raw':!![],'where':{'id':_0x355b64[_0x5997('0x42')]['id']}},_0x4fdb25={};_0x4fdb25[_0x5997('0x33')]=_[_0x5997('0x30')](db[_0x5997('0x2b')][_0x5997('0x43')]);_0x4fdb25[_0x5997('0x2f')]=_[_0x5997('0x30')](_0x355b64['query']);_0x4fdb25[_0x5997('0x31')]=_[_0x5997('0x32')](_0x4fdb25[_0x5997('0x33')],_0x4fdb25['query']);_0x2b3790[_0x5997('0x34')]=_[_0x5997('0x32')](_0x4fdb25[_0x5997('0x33')],qs[_0x5997('0x35')](_0x355b64[_0x5997('0x2f')][_0x5997('0x35')]));_0x2b3790[_0x5997('0x34')]=_0x2b3790[_0x5997('0x34')][_0x5997('0x36')]?_0x2b3790[_0x5997('0x34')]:_0x4fdb25[_0x5997('0x33')];if(_0x355b64[_0x5997('0x2f')][_0x5997('0x3d')]){_0x2b3790[_0x5997('0x3e')]=[{'all':!![]}];}_0x2b3790=_[_0x5997('0x3c')]({},_0x2b3790,_0x355b64['options']);return db[_0x5997('0x2b')][_0x5997('0x44')](_0x2b3790)['then'](handleEntityNotFound(_0x5a6786,null))[_0x5997('0x23')](respondWithResult(_0x5a6786,null))[_0x5997('0x45')](handleError(_0x5a6786,null));};exports[_0x5997('0x46')]=function(_0x116d14,_0x17c7cf){return db[_0x5997('0x2b')][_0x5997('0x46')](_0x116d14['body'],{})[_0x5997('0x23')](function(_0x297151){var _0xeeee12=_0x116d14[_0x5997('0x47')][_0x5997('0x24')]({'plain':!![]});if(!_0xeeee12)throw new Error(_0x5997('0x48'));if(_0xeeee12[_0x5997('0x49')]===_0x5997('0x47')){var _0x5b5b91=_0x297151[_0x5997('0x24')]({'plain':!![]});var _0x452add='Variables';return db[_0x5997('0x4a')]['find']({'where':{'name':_0x452add,'userProfileId':_0xeeee12[_0x5997('0x4b')]},'raw':!![]})[_0x5997('0x23')](function(_0x2cd9f0){if(_0x2cd9f0&&_0x2cd9f0[_0x5997('0x4c')]===0x0){return db['UserProfileResource'][_0x5997('0x46')]({'name':_0x5b5b91[_0x5997('0x28')],'resourceId':_0x5b5b91['id'],'type':_0x2cd9f0[_0x5997('0x28')],'sectionId':_0x2cd9f0['id']},{})[_0x5997('0x23')](function(){return _0x297151;});}else{return _0x297151;}})[_0x5997('0x45')](function(_0xf3fb77){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf3fb77);throw _0xf3fb77;});}return _0x297151;})[_0x5997('0x23')](respondWithResult(_0x17c7cf,0xc9))['catch'](handleError(_0x17c7cf,null));};exports[_0x5997('0x22')]=function(_0x348787,_0x53da4a){if(_0x348787[_0x5997('0x4d')]['id']){delete _0x348787[_0x5997('0x4d')]['id'];}return db['Variable'][_0x5997('0x44')]({'where':{'id':_0x348787[_0x5997('0x42')]['id']}})['then'](handleEntityNotFound(_0x53da4a,null))[_0x5997('0x23')](saveUpdates(_0x348787[_0x5997('0x4d')],null))[_0x5997('0x23')](respondWithResult(_0x53da4a,null))[_0x5997('0x45')](handleError(_0x53da4a,null));};exports[_0x5997('0x27')]=function(_0x1dc544,_0x3eb365){return db[_0x5997('0x2b')][_0x5997('0x44')]({'where':{'id':_0x1dc544[_0x5997('0x42')]['id']}})[_0x5997('0x23')](handleEntityNotFound(_0x3eb365,null))[_0x5997('0x23')](removeEntity(_0x3eb365,null))['catch'](handleError(_0x3eb365,null));}; \ No newline at end of file +var _0x8ade=['pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x8ade,0x6d));var _0xe8ad=function(_0x3ed505,_0x278780){_0x3ed505=_0x3ed505-0x0;var _0x43d948=_0x8ade[_0x3ed505];return _0x43d948;};'use strict';var emlformat=require(_0xe8ad('0x0'));var rimraf=require(_0xe8ad('0x1'));var zipdir=require(_0xe8ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8ad('0x3'));var moment=require(_0xe8ad('0x4'));var BPromise=require(_0xe8ad('0x5'));var Mustache=require(_0xe8ad('0x6'));var util=require('util');var path=require(_0xe8ad('0x7'));var sox=require(_0xe8ad('0x8'));var csv=require(_0xe8ad('0x9'));var ejs=require(_0xe8ad('0xa'));var fs=require('fs');var fs_extra=require(_0xe8ad('0xb'));var _=require(_0xe8ad('0xc'));var squel=require(_0xe8ad('0xd'));var crypto=require(_0xe8ad('0xe'));var jsforce=require(_0xe8ad('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe8ad('0x9'));var querystring=require(_0xe8ad('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe8ad('0x11'));var hardwareService=require(_0xe8ad('0x12'));var logger=require(_0xe8ad('0x13'))(_0xe8ad('0x14'));var utils=require('../../config/utils');var config=require(_0xe8ad('0x15'));var licenseUtil=require(_0xe8ad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a3c75,_0x526243){_0x526243=_0x526243||0xcc;return function(_0xfa4ffb){if(_0xfa4ffb){return _0x3a3c75['sendStatus'](_0x526243);}return _0x3a3c75['status'](_0x526243)[_0xe8ad('0x17')]();};}function respondWithResult(_0x1a7688,_0x5454f5){_0x5454f5=_0x5454f5||0xc8;return function(_0x1d85a2){if(_0x1d85a2){return _0x1a7688[_0xe8ad('0x18')](_0x5454f5)[_0xe8ad('0x19')](_0x1d85a2);}};}function respondWithFilteredResult(_0x54af69,_0x5485ba){return function(_0x1282e7){if(_0x1282e7){var _0x11fd59=typeof _0x5485ba[_0xe8ad('0x1a')]==='undefined'&&typeof _0x5485ba[_0xe8ad('0x1b')]===_0xe8ad('0x1c');var _0x4f42be=_0x1282e7['count'];var _0x43a751=_0x11fd59?0x0:_0x5485ba['offset'];var _0x370b8e=_0x11fd59?_0x1282e7['count']:_0x5485ba[_0xe8ad('0x1a')]+_0x5485ba[_0xe8ad('0x1b')];var _0x575911;if(_0x370b8e>=_0x4f42be){_0x370b8e=_0x4f42be;_0x575911=0xc8;}else{_0x575911=0xce;}_0x54af69['status'](_0x575911);return _0x54af69[_0xe8ad('0x1d')](_0xe8ad('0x1e'),_0x43a751+'-'+_0x370b8e+'/'+_0x4f42be)[_0xe8ad('0x19')](_0x1282e7);}return null;};}function patchUpdates(_0x2a28c3){return function(_0x13d67c){try{jsonpatch[_0xe8ad('0x1f')](_0x13d67c,_0x2a28c3,!![]);}catch(_0x33c84e){return BPromise[_0xe8ad('0x20')](_0x33c84e);}return _0x13d67c[_0xe8ad('0x21')]();};}function saveUpdates(_0x908ac4,_0x35675c){return function(_0x45c42f){if(_0x45c42f){return _0x45c42f[_0xe8ad('0x22')](_0x908ac4)[_0xe8ad('0x23')](function(_0x493af5){return _0x493af5;});}return null;};}function removeEntity(_0x145398,_0x3433ce){return function(_0x5b0af8){if(_0x5b0af8){return _0x5b0af8['destroy']()[_0xe8ad('0x23')](function(){var _0x50f635=_0x5b0af8[_0xe8ad('0x24')]({'plain':!![]});var _0x5db0ed=_0xe8ad('0x25');return db[_0xe8ad('0x26')][_0xe8ad('0x27')]({'where':{'type':_0x5db0ed,'resourceId':_0x50f635['id']}})[_0xe8ad('0x23')](function(){return _0x5b0af8;});})[_0xe8ad('0x23')](function(){_0x145398['status'](0xcc)[_0xe8ad('0x17')]();});}};}function handleEntityNotFound(_0x570463,_0x16468a){return function(_0x47d7c6){if(!_0x47d7c6){_0x570463[_0xe8ad('0x28')](0x194);}return _0x47d7c6;};}function handleError(_0x1f8d96,_0x1dfa51){_0x1dfa51=_0x1dfa51||0x1f4;return function(_0x3d87ed){logger[_0xe8ad('0x29')](_0x3d87ed[_0xe8ad('0x2a')]);if(_0x3d87ed['name']){delete _0x3d87ed[_0xe8ad('0x2b')];}_0x1f8d96['status'](_0x1dfa51)[_0xe8ad('0x2c')](_0x3d87ed);};}exports[_0xe8ad('0x2d')]=function(_0x2b925c,_0x4e44df){var _0x397a31={},_0x912715={},_0x451195={'count':0x0,'rows':[]};var _0x3c1d6a=_['map'](db[_0xe8ad('0x2e')][_0xe8ad('0x2f')],function(_0x5d360e){return{'name':_0x5d360e[_0xe8ad('0x30')],'type':_0x5d360e[_0xe8ad('0x31')][_0xe8ad('0x32')]};});_0x912715['model']=_[_0xe8ad('0x33')](_0x3c1d6a,'name');_0x912715[_0xe8ad('0x34')]=_[_0xe8ad('0x35')](_0x2b925c['query']);_0x912715[_0xe8ad('0x36')]=_[_0xe8ad('0x37')](_0x912715['model'],_0x912715[_0xe8ad('0x34')]);_0x397a31[_0xe8ad('0x38')]=_['intersection'](_0x912715[_0xe8ad('0x39')],qs[_0xe8ad('0x3a')](_0x2b925c[_0xe8ad('0x34')][_0xe8ad('0x3a')]));_0x397a31['attributes']=_0x397a31['attributes'][_0xe8ad('0x3b')]?_0x397a31[_0xe8ad('0x38')]:_0x912715[_0xe8ad('0x39')];if(!_0x2b925c[_0xe8ad('0x34')][_0xe8ad('0x3c')](_0xe8ad('0x3d'))){_0x397a31[_0xe8ad('0x1b')]=qs[_0xe8ad('0x1b')](_0x2b925c['query'][_0xe8ad('0x1b')]);_0x397a31['offset']=qs['offset'](_0x2b925c[_0xe8ad('0x34')][_0xe8ad('0x1a')]);}_0x397a31[_0xe8ad('0x3e')]=qs[_0xe8ad('0x3f')](_0x2b925c['query'][_0xe8ad('0x3f')]);_0x397a31[_0xe8ad('0x40')]=qs[_0xe8ad('0x36')](_[_0xe8ad('0x41')](_0x2b925c[_0xe8ad('0x34')],_0x912715[_0xe8ad('0x36')]),_0x3c1d6a);if(_0x2b925c[_0xe8ad('0x34')][_0xe8ad('0x42')]){_0x397a31[_0xe8ad('0x40')]=_[_0xe8ad('0x43')](_0x397a31[_0xe8ad('0x40')],{'$or':_['map'](_0x3c1d6a,function(_0x234cf9){if(_0x234cf9[_0xe8ad('0x31')]!==_0xe8ad('0x44')){var _0x2932f0={};_0x2932f0[_0x234cf9['name']]={'$like':'%'+_0x2b925c[_0xe8ad('0x34')][_0xe8ad('0x42')]+'%'};return _0x2932f0;}})});}_0x397a31=_[_0xe8ad('0x43')]({},_0x397a31,_0x2b925c[_0xe8ad('0x45')]);var _0x137a98={'where':_0x397a31[_0xe8ad('0x40')]};return db[_0xe8ad('0x2e')][_0xe8ad('0x46')](_0x137a98)[_0xe8ad('0x23')](function(_0x3dab8e){_0x451195[_0xe8ad('0x46')]=_0x3dab8e;if(_0x2b925c['query'][_0xe8ad('0x47')]){_0x397a31['include']=[{'all':!![]}];}return db[_0xe8ad('0x2e')][_0xe8ad('0x48')](_0x397a31);})['then'](function(_0x43c805){_0x451195[_0xe8ad('0x49')]=_0x43c805;return _0x451195;})[_0xe8ad('0x23')](respondWithFilteredResult(_0x4e44df,_0x397a31))[_0xe8ad('0x4a')](handleError(_0x4e44df,null));};exports[_0xe8ad('0x4b')]=function(_0x3ec99d,_0x3717a7){var _0xbabdbe={'raw':!![],'where':{'id':_0x3ec99d[_0xe8ad('0x4c')]['id']}},_0x342d60={};_0x342d60[_0xe8ad('0x39')]=_[_0xe8ad('0x35')](db['Variable'][_0xe8ad('0x2f')]);_0x342d60['query']=_['keys'](_0x3ec99d[_0xe8ad('0x34')]);_0x342d60[_0xe8ad('0x36')]=_[_0xe8ad('0x37')](_0x342d60['model'],_0x342d60[_0xe8ad('0x34')]);_0xbabdbe[_0xe8ad('0x38')]=_['intersection'](_0x342d60[_0xe8ad('0x39')],qs[_0xe8ad('0x3a')](_0x3ec99d['query'][_0xe8ad('0x3a')]));_0xbabdbe[_0xe8ad('0x38')]=_0xbabdbe[_0xe8ad('0x38')][_0xe8ad('0x3b')]?_0xbabdbe[_0xe8ad('0x38')]:_0x342d60[_0xe8ad('0x39')];if(_0x3ec99d[_0xe8ad('0x34')][_0xe8ad('0x47')]){_0xbabdbe['include']=[{'all':!![]}];}_0xbabdbe=_['merge']({},_0xbabdbe,_0x3ec99d[_0xe8ad('0x45')]);return db[_0xe8ad('0x2e')][_0xe8ad('0x4d')](_0xbabdbe)['then'](handleEntityNotFound(_0x3717a7,null))['then'](respondWithResult(_0x3717a7,null))[_0xe8ad('0x4a')](handleError(_0x3717a7,null));};exports[_0xe8ad('0x4e')]=function(_0x2723a4,_0x2249eb){return db[_0xe8ad('0x2e')][_0xe8ad('0x4e')](_0x2723a4['body'],{})[_0xe8ad('0x23')](function(_0x3b37f5){var _0x1f0396=_0x2723a4[_0xe8ad('0x4f')]['get']({'plain':!![]});if(!_0x1f0396)throw new Error(_0xe8ad('0x50'));if(_0x1f0396[_0xe8ad('0x51')]===_0xe8ad('0x4f')){var _0x5c576f=_0x3b37f5[_0xe8ad('0x24')]({'plain':!![]});var _0x12b052=_0xe8ad('0x25');return db[_0xe8ad('0x52')][_0xe8ad('0x4d')]({'where':{'name':_0x12b052,'userProfileId':_0x1f0396[_0xe8ad('0x53')]},'raw':!![]})['then'](function(_0x2a56f0){if(_0x2a56f0&&_0x2a56f0[_0xe8ad('0x54')]===0x0){return db['UserProfileResource'][_0xe8ad('0x4e')]({'name':_0x5c576f[_0xe8ad('0x2b')],'resourceId':_0x5c576f['id'],'type':_0x2a56f0[_0xe8ad('0x2b')],'sectionId':_0x2a56f0['id']},{})[_0xe8ad('0x23')](function(){return _0x3b37f5;});}else{return _0x3b37f5;}})[_0xe8ad('0x4a')](function(_0x3952ee){logger['error'](_0xe8ad('0x55'),_0x3952ee);throw _0x3952ee;});}return _0x3b37f5;})[_0xe8ad('0x23')](respondWithResult(_0x2249eb,0xc9))[_0xe8ad('0x4a')](handleError(_0x2249eb,null));};exports['update']=function(_0x3c73aa,_0x12ecca){if(_0x3c73aa[_0xe8ad('0x56')]['id']){delete _0x3c73aa[_0xe8ad('0x56')]['id'];}return db['Variable'][_0xe8ad('0x4d')]({'where':{'id':_0x3c73aa['params']['id']}})['then'](handleEntityNotFound(_0x12ecca,null))['then'](saveUpdates(_0x3c73aa[_0xe8ad('0x56')],null))['then'](respondWithResult(_0x12ecca,null))[_0xe8ad('0x4a')](handleError(_0x12ecca,null));};exports[_0xe8ad('0x27')]=function(_0x4cc46f,_0x421990){return db[_0xe8ad('0x2e')][_0xe8ad('0x4d')]({'where':{'id':_0x4cc46f[_0xe8ad('0x4c')]['id']}})[_0xe8ad('0x23')](handleEntityNotFound(_0x421990,null))['then'](removeEntity(_0x421990,null))[_0xe8ad('0x4a')](handleError(_0x421990,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5860265..49b5f8c 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 _0x8eb3=['exports','define','Variable','tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes'];(function(_0x156d4e,_0x1d222f){var _0x57edcc=function(_0x225adc){while(--_0x225adc){_0x156d4e['push'](_0x156d4e['shift']());}};_0x57edcc(++_0x1d222f);}(_0x8eb3,0x1d8));var _0x38eb=function(_0x3770dd,_0x28ec84){_0x3770dd=_0x3770dd-0x0;var _0x36c521=_0x8eb3[_0x3770dd];return _0x36c521;};'use strict';var _=require('lodash');var util=require(_0x38eb('0x0'));var logger=require(_0x38eb('0x1'))(_0x38eb('0x2'));var moment=require(_0x38eb('0x3'));var BPromise=require(_0x38eb('0x4'));var rp=require(_0x38eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38eb('0x6'));var config=require(_0x38eb('0x7'));var attributes=require(_0x38eb('0x8'));module[_0x38eb('0x9')]=function(_0x17d275,_0x4e9f49){return _0x17d275[_0x38eb('0xa')](_0x38eb('0xb'),attributes,{'tableName':_0x38eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1345=['tools_variables','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0xa36290,_0x27313a){var _0x3d03bb=function(_0x133186){while(--_0x133186){_0xa36290['push'](_0xa36290['shift']());}};_0x3d03bb(++_0x27313a);}(_0x1345,0xb5));var _0x5134=function(_0x3af54c,_0x436158){_0x3af54c=_0x3af54c-0x0;var _0x4bc816=_0x1345[_0x3af54c];return _0x4bc816;};'use strict';var _=require(_0x5134('0x0'));var util=require(_0x5134('0x1'));var logger=require(_0x5134('0x2'))(_0x5134('0x3'));var moment=require(_0x5134('0x4'));var BPromise=require(_0x5134('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5134('0x6'));var config=require(_0x5134('0x7'));var attributes=require(_0x5134('0x8'));module[_0x5134('0x9')]=function(_0x51b377,_0x4056c8){return _0x51b377[_0x5134('0xa')]('Variable',attributes,{'tableName':_0x5134('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6c0459d..ff50188 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x489d7c,_0x22cd8d){var _0x1af217=function(_0x52144e){while(--_0x52144e){_0x489d7c['push'](_0x489d7c['shift']());}};_0x1af217(++_0x22cd8d);}(_0x55ca,0x126));var _0xa55c=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x55ca[_0xb65ffb];return _0x58f55c;};'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')]('Variable,\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')]('Variable,\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);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +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(_0x284f70,_0x48622e){var _0x4f0d14=function(_0x4b31f3){while(--_0x4b31f3){_0x284f70['push'](_0x284f70['shift']());}};_0x4f0d14(++_0x48622e);}(_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']('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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 8b0fc9d..8c9e9f6 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 _0xed17=['reset','/pull','/migrations','migrations','Router','../../components/auth/service','get','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x40fa87,_0x3a3196){var _0x1d4cc1=function(_0x182903){while(--_0x182903){_0x40fa87['push'](_0x40fa87['shift']());}};_0x1d4cc1(++_0x3a3196);}(_0xed17,0x70));var _0x7ed1=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0xed17[_0x24693e];return _0x53e672;};'use strict';var express=require('express');var router=express[_0x7ed1('0x0')]();var auth=require(_0x7ed1('0x1'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0x7ed1('0x2')](_0x7ed1('0x3'),auth[_0x7ed1('0x4')](),auth[_0x7ed1('0x5')](),controller[_0x7ed1('0x6')]);router[_0x7ed1('0x2')](_0x7ed1('0x7'),auth[_0x7ed1('0x4')](),auth[_0x7ed1('0x5')](),controller[_0x7ed1('0x8')]);router[_0x7ed1('0x2')](_0x7ed1('0x9'),auth[_0x7ed1('0x4')](),auth[_0x7ed1('0x5')](),controller['pull']);router[_0x7ed1('0x2')]('/restart',auth['isAuthenticated'](),controller['restart']);router[_0x7ed1('0x2')](_0x7ed1('0xa'),controller[_0x7ed1('0xb')]);module['exports']=router; \ No newline at end of file +var _0x80f6=['/restart','restart','/migrations','migrations','exports','Router','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x80f6,0xd5));var _0x680f=function(_0x1f1b7d,_0xad68d5){_0x1f1b7d=_0x1f1b7d-0x0;var _0x4c921d=_0x80f6[_0x1f1b7d];return _0x4c921d;};'use strict';var express=require('express');var router=express[_0x680f('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x680f('0x1'));router[_0x680f('0x2')]('/',controller[_0x680f('0x3')]);router[_0x680f('0x2')](_0x680f('0x4'),auth[_0x680f('0x5')](),auth['canUpdate'](),controller[_0x680f('0x6')]);router[_0x680f('0x2')](_0x680f('0x7'),auth[_0x680f('0x5')](),auth[_0x680f('0x8')](),controller[_0x680f('0x9')]);router[_0x680f('0x2')]('/pull',auth[_0x680f('0x5')](),auth['canUpdate'](),controller[_0x680f('0xa')]);router['get'](_0x680f('0xb'),auth[_0x680f('0x5')](),controller[_0x680f('0xc')]);router[_0x680f('0x2')](_0x680f('0xd'),controller[_0x680f('0xe')]);module[_0x680f('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 0319004..8eb803c 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 _0x4897=['latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','root','server','length','replace','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','index','exports','query'];(function(_0x4dbef6,_0x2cbe40){var _0xcd4fa0=function(_0x1b01b0){while(--_0x1b01b0){_0x4dbef6['push'](_0x4dbef6['shift']());}};_0xcd4fa0(++_0x2cbe40);}(_0x4897,0x12f));var _0x7489=function(_0x55d1ad,_0x2fd8d6){_0x55d1ad=_0x55d1ad-0x0;var _0xbd4aa5=_0x4897[_0x55d1ad];return _0xbd4aa5;};'use strict';var Umzug=require(_0x7489('0x0'));var path=require(_0x7489('0x1'));var fs=require('fs');var _=require(_0x7489('0x2'));var pkginfo=require(_0x7489('0x3'))(module,_0x7489('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x7489('0x5'))[_0x7489('0x6')];var db=require(_0x7489('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x7489('0x8'));var logger=require(_0x7489('0x9'))(_0x7489('0xa'));var git=require(_0x7489('0xb'))(config['root']);exports[_0x7489('0xc')]=function(_0x5b2bc0,_0xd58709){var _0x44718d={'current':module[_0x7489('0xd')][_0x7489('0x4')],'phonebar':0x2};if(_0x5b2bc0[_0x7489('0xe')]&&_0x5b2bc0[_0x7489('0xe')][_0x7489('0xf')]){return git[_0x7489('0x10')]()[_0x7489('0x11')](function(_0x21b2d3,_0x580535){_0x44718d[_0x7489('0xf')]=(_0x21b2d3?module[_0x7489('0xd')][_0x7489('0x4')]:_0x580535[_0x7489('0xf')])||_0x7489('0x12');return _0xd58709[_0x7489('0x13')](0xc8)[_0x7489('0x14')](_0x44718d);});}else{return _0xd58709['status'](0xc8)[_0x7489('0x14')](_0x44718d);}};exports[_0x7489('0x10')]=function(_0x1a89f7,_0x4802fb){return git['fetch']([_0x7489('0x15'),_0x7489('0x16')],function(_0x2d0875){if(_0x2d0875){logger[_0x7489('0x17')](_0x2d0875);return _0x4802fb[_0x7489('0x13')](0x1f4)[_0x7489('0x14')](_0x2d0875);}logger[_0x7489('0x18')]('git\x20fetch');return _0x4802fb[_0x7489('0x13')](0xc8)['json']({'output':_0x7489('0x19')});});};exports[_0x7489('0x1a')]=function(_0x5b312a,_0x5106fc){return git[_0x7489('0x1a')](['--hard','FETCH_HEAD'],function(_0x216a7c){if(_0x216a7c){logger[_0x7489('0x17')](_0x216a7c);return _0x5106fc[_0x7489('0x13')](0x1f4)[_0x7489('0x14')](_0x216a7c);}logger[_0x7489('0x18')](_0x7489('0x1b'));return _0x5106fc[_0x7489('0x13')](0xc8)['json']({'output':_0x7489('0x1c')});});};exports[_0x7489('0x1d')]=function(_0x178f34,_0x11b8d8){exec(_0x7489('0x1e'),function(_0x2b07c7,_0x29016c,_0x42d449){logger[_0x7489('0x18')](_0x29016c);logger['info'](_0x42d449);if(_0x2b07c7){logger[_0x7489('0x17')](_0x2b07c7);return _0x11b8d8[_0x7489('0x13')](0x1f4)[_0x7489('0x14')](_0x2b07c7);}return _0x11b8d8['status'](0xc8)['json']({'output':_0x29016c});});};exports[_0x7489('0x1f')]=function(_0x3da99b,_0x51bffe){return pm2[_0x7489('0x1f')](_0x7489('0x20'))['then'](function(_0x2a31df){logger[_0x7489('0x18')](_0x7489('0x21'),_0x2a31df);return _0x51bffe[_0x7489('0x13')](0xc8)[_0x7489('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7489('0x22')](function(_0x4c9a47){logger['error'](_0x4c9a47);return _0x51bffe[_0x7489('0x13')](0x1f4)[_0x7489('0x14')](_0x4c9a47);});};exports[_0x7489('0x23')]=function(_0x1acb90,_0x2e5ece){var _0x2fe50c=fs[_0x7489('0x24')](path['join'](config[_0x7489('0x25')],_0x7489('0x26'),_0x7489('0x23')));var _0x495359=[];for(var _0x21a470=0x0;_0x21a470<_0x2fe50c[_0x7489('0x27')];_0x21a470++){var _0x4c29bc=_0x2fe50c[_0x21a470][_0x7489('0x28')]('.js','');if(compareVersions(module[_0x7489('0xd')]['version'],_0x4c29bc)===-0x1){_0x495359[_0x7489('0x29')](_0x4c29bc);}}if(_0x495359[_0x7489('0x27')]){var _0x155cbb=_0x495359['sort'](compareVersions);var _0x406dcf=new Umzug({'storage':_0x7489('0x2a'),'storageOptions':{'model':db[_0x7489('0x2b')],'modelName':_0x7489('0x2b'),'columnName':_0x7489('0x4')},'migrations':{'params':[db[_0x7489('0x2a')]['getQueryInterface'](),db[_0x7489('0x2a')][_0x7489('0x2c')],function(){throw new Error(_0x7489('0x2d'));}],'path':path['join'](config[_0x7489('0x25')],_0x7489('0x26'),_0x7489('0x23')),'pattern':/\.js$/}});_0x406dcf['up']({'migrations':_[_0x7489('0x2e')](_0x155cbb,function(_0x4ac4b1){return _0x4ac4b1+'.js';})})[_0x7489('0x2f')](function(){return _0x2e5ece[_0x7489('0x13')](0xc8)[_0x7489('0x14')]({'output':_0x7489('0x30')+module[_0x7489('0xd')][_0x7489('0x4')]+'\x20to\x20'+_[_0x7489('0x31')](_0x155cbb),'migrations':_[_0x7489('0x32')](_0x155cbb)});})[_0x7489('0x22')](function(_0x4aa9bc){if(_0x4aa9bc instanceof db['sequelize'][_0x7489('0x33')]){return _0x2e5ece[_0x7489('0x13')](0xc8)['json']({'output':_0x7489('0x34')});}else{return _0x2e5ece[_0x7489('0x13')](0x1f4)[_0x7489('0x14')](_0x4aa9bc);}});}else{return _0x2e5ece['status'](0xc8)[_0x7489('0x14')]({'output':_0x7489('0x34')});}}; \ No newline at end of file +var _0x0435=['index','exports','version','query','latest','tags','json','status','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','replace','.js','push','length','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.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root'];(function(_0x40a168,_0x1d8701){var _0xc48200=function(_0x4db946){while(--_0x4db946){_0x40a168['push'](_0x40a168['shift']());}};_0xc48200(++_0x1d8701);}(_0x0435,0x1ac));var _0x5043=function(_0x1067cd,_0x400cb1){_0x1067cd=_0x1067cd-0x0;var _0x5d980d=_0x0435[_0x1067cd];return _0x5d980d;};'use strict';var Umzug=require(_0x5043('0x0'));var path=require(_0x5043('0x1'));var fs=require('fs');var _=require(_0x5043('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x5043('0x3'));var exec=require(_0x5043('0x4'))[_0x5043('0x5')];var db=require(_0x5043('0x6'))['db'];var config=require(_0x5043('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x5043('0x8'))(_0x5043('0x9'));var git=require(_0x5043('0xa'))(config[_0x5043('0xb')]);exports[_0x5043('0xc')]=function(_0x297847,_0x5d5345){var _0x10e6da={'current':module[_0x5043('0xd')][_0x5043('0xe')],'phonebar':0x2};if(_0x297847['query']&&_0x297847[_0x5043('0xf')][_0x5043('0x10')]){return git['fetch']()[_0x5043('0x11')](function(_0x440105,_0x2dd049){_0x10e6da[_0x5043('0x10')]=(_0x440105?module['exports']['version']:_0x2dd049['latest'])||'2.0.0';return _0x5d5345['status'](0xc8)[_0x5043('0x12')](_0x10e6da);});}else{return _0x5d5345[_0x5043('0x13')](0xc8)['json'](_0x10e6da);}};exports[_0x5043('0x14')]=function(_0x1da341,_0x2ef38e){return git[_0x5043('0x14')]([_0x5043('0x15'),_0x5043('0x16')],function(_0x52534b){if(_0x52534b){logger[_0x5043('0x17')](_0x52534b);return _0x2ef38e['status'](0x1f4)[_0x5043('0x12')](_0x52534b);}logger[_0x5043('0x18')](_0x5043('0x19'));return _0x2ef38e['status'](0xc8)[_0x5043('0x12')]({'output':_0x5043('0x1a')});});};exports['reset']=function(_0x216b85,_0x40eef8){return git[_0x5043('0x1b')]([_0x5043('0x1c'),'FETCH_HEAD'],function(_0x28ae11){if(_0x28ae11){logger[_0x5043('0x17')](_0x28ae11);return _0x40eef8[_0x5043('0x13')](0x1f4)['json'](_0x28ae11);}logger['info'](_0x5043('0x1d'));return _0x40eef8[_0x5043('0x13')](0xc8)['json']({'output':_0x5043('0x1e')});});};exports[_0x5043('0x1f')]=function(_0x36d53b,_0x4e2a9a){exec('npm\x20install\x20--production',function(_0x4fe1a9,_0x33c3fc,_0x359e1e){logger[_0x5043('0x18')](_0x33c3fc);logger[_0x5043('0x18')](_0x359e1e);if(_0x4fe1a9){logger[_0x5043('0x17')](_0x4fe1a9);return _0x4e2a9a[_0x5043('0x13')](0x1f4)[_0x5043('0x12')](_0x4fe1a9);}return _0x4e2a9a[_0x5043('0x13')](0xc8)[_0x5043('0x12')]({'output':_0x33c3fc});});};exports['restart']=function(_0x54ce45,_0x4fcd56){return pm2[_0x5043('0x20')]('motion2')[_0x5043('0x21')](function(_0x7694dc){logger['info'](_0x5043('0x22'),_0x7694dc);return _0x4fcd56['status'](0xc8)['json']({'output':_0x5043('0x23')});})['catch'](function(_0x456fe0){logger['error'](_0x456fe0);return _0x4fcd56['status'](0x1f4)[_0x5043('0x12')](_0x456fe0);});};exports[_0x5043('0x24')]=function(_0x1bc13a,_0x5baadb){var _0x213a55=fs[_0x5043('0x25')](path['join'](config[_0x5043('0xb')],_0x5043('0x26'),'migrations'));var _0x28263d=[];for(var _0xe1bce4=0x0;_0xe1bce4<_0x213a55['length'];_0xe1bce4++){var _0x2562a2=_0x213a55[_0xe1bce4][_0x5043('0x27')](_0x5043('0x28'),'');if(compareVersions(module[_0x5043('0xd')][_0x5043('0xe')],_0x2562a2)===-0x1){_0x28263d[_0x5043('0x29')](_0x2562a2);}}if(_0x28263d[_0x5043('0x2a')]){var _0x54a5dc=_0x28263d[_0x5043('0x2b')](compareVersions);var _0x59f6c3=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x5043('0x2c')],'modelName':_0x5043('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x5043('0x2d')][_0x5043('0x2e')](),db['sequelize'][_0x5043('0x2f')],function(){throw new Error(_0x5043('0x30'));}],'path':path['join'](config[_0x5043('0xb')],'server',_0x5043('0x24')),'pattern':/\.js$/}});_0x59f6c3['up']({'migrations':_['map'](_0x54a5dc,function(_0x5d52cc){return _0x5d52cc+_0x5043('0x28');})})['then'](function(){return _0x5baadb[_0x5043('0x13')](0xc8)[_0x5043('0x12')]({'output':_0x5043('0x31')+module['exports'][_0x5043('0xe')]+_0x5043('0x32')+_[_0x5043('0x33')](_0x54a5dc),'migrations':_[_0x5043('0x34')](_0x54a5dc)});})['catch'](function(_0x8ed068){if(_0x8ed068 instanceof db['sequelize'][_0x5043('0x35')]){return _0x5baadb['status'](0xc8)[_0x5043('0x12')]({'output':_0x5043('0x36')});}else{return _0x5baadb[_0x5043('0x13')](0x1f4)[_0x5043('0x12')](_0x8ed068);}});}else{return _0x5baadb[_0x5043('0x13')](0xc8)[_0x5043('0x12')]({'output':_0x5043('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7bc96bf..cdf3710 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 _0x57b3=['fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2a1626,_0x2fec30){var _0x4bd03a=function(_0x1387eb){while(--_0x1387eb){_0x2a1626['push'](_0x2a1626['shift']());}};_0x4bd03a(++_0x2fec30);}(_0x57b3,0x10e));var _0x357b=function(_0x2bfc2c,_0x48ffd9){_0x2bfc2c=_0x2bfc2c-0x0;var _0x53f8d0=_0x57b3[_0x2bfc2c];return _0x53f8d0;};'use strict';var multer=require(_0x357b('0x0'));var util=require(_0x357b('0x1'));var path=require(_0x357b('0x2'));var timeout=require(_0x357b('0x3'));var express=require(_0x357b('0x4'));var router=express[_0x357b('0x5')]();var fs_extra=require(_0x357b('0x6'));var auth=require(_0x357b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x357b('0x8'));var controller=require(_0x357b('0x9'));router[_0x357b('0xa')]('/',auth[_0x357b('0xb')](),controller[_0x357b('0xc')]);router[_0x357b('0xa')](_0x357b('0xd'),auth[_0x357b('0xb')](),controller[_0x357b('0xe')]);router[_0x357b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x357b('0xf')]);router['post']('/',auth[_0x357b('0xb')](),controller[_0x357b('0x10')]);router[_0x357b('0x11')](_0x357b('0x12'),auth['isAuthenticated'](),controller[_0x357b('0x13')]);router[_0x357b('0x14')]('/:id',auth[_0x357b('0xb')](),controller[_0x357b('0x15')]);module[_0x357b('0x16')]=router; \ No newline at end of file +var _0x9b79=['/:id','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x2d30b0,_0x486019){var _0x2304a0=function(_0x191938){while(--_0x191938){_0x2d30b0['push'](_0x2d30b0['shift']());}};_0x2304a0(++_0x486019);}(_0x9b79,0x148));var _0x99b7=function(_0x537f6f,_0x10b756){_0x537f6f=_0x537f6f-0x0;var _0x212d3f=_0x9b79[_0x537f6f];return _0x212d3f;};'use strict';var multer=require(_0x99b7('0x0'));var util=require(_0x99b7('0x1'));var path=require(_0x99b7('0x2'));var timeout=require(_0x99b7('0x3'));var express=require(_0x99b7('0x4'));var router=express[_0x99b7('0x5')]();var fs_extra=require(_0x99b7('0x6'));var auth=require(_0x99b7('0x7'));var interaction=require(_0x99b7('0x8'));var config=require(_0x99b7('0x9'));var controller=require('./voiceAgentReport.controller');router[_0x99b7('0xa')]('/',auth[_0x99b7('0xb')](),controller['index']);router['get'](_0x99b7('0xc'),auth['isAuthenticated'](),controller[_0x99b7('0xd')]);router['get'](_0x99b7('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x99b7('0xf')]('/',auth[_0x99b7('0xb')](),controller[_0x99b7('0x10')]);router[_0x99b7('0x11')]('/:id',auth[_0x99b7('0xb')](),controller[_0x99b7('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d5ff11a..d18e249 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 _0x79d7=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x79d7,0x9c));var _0x779d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x79d7[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'type':{'type':Sequelize[_0x779d('0x1')]},'uniqueid':{'type':Sequelize[_0x779d('0x1')]},'calleridnum':{'type':Sequelize[_0x779d('0x1')]},'calleridname':{'type':Sequelize[_0x779d('0x1')]},'queue':{'type':Sequelize[_0x779d('0x1')]},'interface':{'type':Sequelize[_0x779d('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x779d('0x2')]},'agentconnectAt':{'type':Sequelize[_0x779d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x779d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x779d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x779d('0x1')]},'channel':{'type':Sequelize[_0x779d('0x1')]},'channelstate':{'type':Sequelize[_0x779d('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x779d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x779d('0x1')]},'exten':{'type':Sequelize[_0x779d('0x1')]},'priority':{'type':Sequelize[_0x779d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x779d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x779d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x779d('0x1')]},'destcalleridname':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x779d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x779d('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x779d('0x1')]},'destcontext':{'type':Sequelize[_0x779d('0x1')]},'destexten':{'type':Sequelize[_0x779d('0x1')]},'destpriority':{'type':Sequelize[_0x779d('0x1')]},'destuniqueid':{'type':Sequelize[_0x779d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x779d('0x1')]},'transfer':{'type':Sequelize[_0x779d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x779d('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x779d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x779d('0x1')]},'agententerreason':{'type':Sequelize[_0x779d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8caf=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x466bfd,_0x56f4bb){_0x466bfd=_0x466bfd-0x0;var _0x29293d=_0x8caf[_0x466bfd];return _0x29293d;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'type':{'type':Sequelize[_0xf8ca('0x1')]},'uniqueid':{'type':Sequelize[_0xf8ca('0x1')]},'calleridnum':{'type':Sequelize[_0xf8ca('0x1')]},'calleridname':{'type':Sequelize[_0xf8ca('0x1')]},'queue':{'type':Sequelize[_0xf8ca('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf8ca('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf8ca('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf8ca('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xf8ca('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xf8ca('0x2')]},'agentdumpAt':{'type':Sequelize[_0xf8ca('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf8ca('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf8ca('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf8ca('0x1')]},'channelstate':{'type':Sequelize[_0xf8ca('0x4')]},'channelstatedesc':{'type':Sequelize[_0xf8ca('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf8ca('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf8ca('0x1')]},'accountcode':{'type':Sequelize[_0xf8ca('0x1')]},'context':{'type':Sequelize[_0xf8ca('0x1')]},'exten':{'type':Sequelize[_0xf8ca('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf8ca('0x1')]},'destchannelstate':{'type':Sequelize[_0xf8ca('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf8ca('0x1')]},'destcalleridname':{'type':Sequelize[_0xf8ca('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf8ca('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf8ca('0x1')]},'destlanguage':{'type':Sequelize[_0xf8ca('0x1')]},'destaccountcode':{'type':Sequelize[_0xf8ca('0x1')]},'destcontext':{'type':Sequelize[_0xf8ca('0x1')]},'destexten':{'type':Sequelize[_0xf8ca('0x1')]},'destpriority':{'type':Sequelize[_0xf8ca('0x1')]},'destuniqueid':{'type':Sequelize[_0xf8ca('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xf8ca('0x1')]},'transfer':{'type':Sequelize[_0xf8ca('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf8ca('0x1')],'comment':_0xf8ca('0x5')},'transferexten':{'type':Sequelize[_0xf8ca('0x1')]},'transferuniqueid':{'type':Sequelize[_0xf8ca('0x1')]},'agententerreason':{'type':Sequelize[_0xf8ca('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 5a0f906..4965edf 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(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 f856984..7a6cbac 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 _0x28a2=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x228a('0xc'),_0x228a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['path','rimraf','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x44417e,_0x313408){var _0x32e605=function(_0x20ddcc){while(--_0x20ddcc){_0x44417e['push'](_0x44417e['shift']());}};_0x32e605(++_0x313408);}(_0xb458,0x103));var _0x8b45=function(_0x4f7d50,_0x363daa){_0x4f7d50=_0x4f7d50-0x0;var _0x327bfd=_0xb458[_0x4f7d50];return _0x327bfd;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8b45('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 02090b8..57bc9b5 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 _0x1983=['util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','update','where','then','lodash'];(function(_0x4113a5,_0x16e42f){var _0xae70e=function(_0x154efc){while(--_0x154efc){_0x4113a5['push'](_0x4113a5['shift']());}};_0xae70e(++_0x16e42f);}(_0x1983,0xd7));var _0x3198=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x1983[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x3198('0x0'));var util=require(_0x3198('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3198('0x2'));var db=require(_0x3198('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3198('0x4'))('rpc');var config=require(_0x3198('0x5'));var jayson=require(_0x3198('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7b416f,_0xaa407a,_0x243829){return new BPromise(function(_0x4f806c,_0x16fd10){return client['request'](_0x7b416f,_0x243829)['then'](function(_0x16162e){logger['info'](_0x3198('0x7'),_0xaa407a,_0x3198('0x8'));logger[_0x3198('0x9')](_0x3198('0xa'),_0xaa407a,'request\x20sent',JSON['stringify'](_0x16162e));if(_0x16162e[_0x3198('0xb')]){if(_0x16162e[_0x3198('0xb')]['code']===0x1f4){logger[_0x3198('0xb')](_0x3198('0x7'),_0xaa407a,_0x16162e[_0x3198('0xb')][_0x3198('0xc')]);return _0x16fd10(_0x16162e[_0x3198('0xb')][_0x3198('0xc')]);}logger[_0x3198('0xb')](_0x3198('0x7'),_0xaa407a,_0x16162e[_0x3198('0xb')][_0x3198('0xc')]);return _0x4f806c(_0x16162e['error'][_0x3198('0xc')]);}else{logger[_0x3198('0xd')](_0x3198('0x7'),_0xaa407a,_0x3198('0x8'));_0x4f806c(_0x16162e[_0x3198('0xe')][_0x3198('0xc')]);}})[_0x3198('0xf')](function(_0x376e7c){logger[_0x3198('0xb')](_0x3198('0x7'),_0xaa407a,_0x376e7c);_0x16fd10(_0x376e7c);});});}exports[_0x3198('0x10')]=function(_0x41875c){var _0x5e5045=this;return new Promise(function(_0x2bdad4,_0x30e0e7){return db[_0x3198('0x11')][_0x3198('0x12')](_0x41875c[_0x3198('0x13')],{'raw':_0x41875c[_0x3198('0x14')]?_0x41875c[_0x3198('0x14')][_0x3198('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4b324c){logger[_0x3198('0xd')](_0x3198('0x10'),_0x41875c);logger[_0x3198('0x9')]('CreateVoiceAgentReport',_0x41875c,JSON[_0x3198('0x16')](_0x4b324c));_0x2bdad4(_0x4b324c);})[_0x3198('0xf')](function(_0x3c6ab3){logger['error'](_0x3198('0x10'),_0x3c6ab3['message'],_0x41875c);_0x30e0e7(_0x5e5045[_0x3198('0xb')](0x1f4,_0x3c6ab3[_0x3198('0xc')]));});});};exports[_0x3198('0x17')]=function(_0x310b77){var _0x57e0b3=this;return new Promise(function(_0x3ef793,_0x598b87){return db[_0x3198('0x11')][_0x3198('0x18')](_0x310b77[_0x3198('0x13')],{'raw':_0x310b77[_0x3198('0x14')]?_0x310b77['options'][_0x3198('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x310b77[_0x3198('0x14')]?_0x310b77[_0x3198('0x14')][_0x3198('0x19')]||null:null,'attributes':_0x310b77[_0x3198('0x14')]?_0x310b77[_0x3198('0x14')]['attributes']||null:null,'limit':_0x310b77[_0x3198('0x14')]?_0x310b77[_0x3198('0x14')]['limit']||null:null})[_0x3198('0x1a')](function(_0x23fd37){logger[_0x3198('0xd')](_0x3198('0x17'),_0x310b77);logger[_0x3198('0x9')](_0x3198('0x17'),_0x310b77,JSON[_0x3198('0x16')](_0x23fd37));_0x3ef793(_0x23fd37);})[_0x3198('0xf')](function(_0x3c4856){logger[_0x3198('0xb')](_0x3198('0x17'),_0x3c4856[_0x3198('0xc')],_0x310b77);_0x598b87(_0x57e0b3[_0x3198('0xb')](0x1f4,_0x3c4856[_0x3198('0xc')]));});});}; \ No newline at end of file +var _0x65c9=['../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32f250,_0x1fbca3){var _0x39ead3=function(_0x7e79d6){while(--_0x7e79d6){_0x32f250['push'](_0x32f250['shift']());}};_0x39ead3(++_0x1fbca3);}(_0x65c9,0x15a));var _0x965c=function(_0x37f275,_0x286233){_0x37f275=_0x37f275-0x0;var _0x37bd25=_0x65c9[_0x37f275];return _0x37bd25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x965c('0x0'));var BPromise=require(_0x965c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x965c('0x2'));var db=require(_0x965c('0x3'))['db'];var utils=require(_0x965c('0x4'));var logger=require(_0x965c('0x5'))('rpc');var config=require(_0x965c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x965c('0x7')][_0x965c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f9a38,_0xbfceb0,_0x14e934){return new BPromise(function(_0x1d0a06,_0x2a21f8){return client[_0x965c('0x9')](_0x4f9a38,_0x14e934)['then'](function(_0x30b1ba){logger[_0x965c('0xa')](_0x965c('0xb'),_0xbfceb0,_0x965c('0xc'));logger[_0x965c('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xbfceb0,'request\x20sent',JSON[_0x965c('0xe')](_0x30b1ba));if(_0x30b1ba['error']){if(_0x30b1ba[_0x965c('0xf')][_0x965c('0x10')]===0x1f4){logger['error'](_0x965c('0xb'),_0xbfceb0,_0x30b1ba[_0x965c('0xf')]['message']);return _0x2a21f8(_0x30b1ba[_0x965c('0xf')][_0x965c('0x11')]);}logger[_0x965c('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0xbfceb0,_0x30b1ba[_0x965c('0xf')]['message']);return _0x1d0a06(_0x30b1ba[_0x965c('0xf')][_0x965c('0x11')]);}else{logger[_0x965c('0xa')](_0x965c('0xb'),_0xbfceb0,_0x965c('0xc'));_0x1d0a06(_0x30b1ba[_0x965c('0x12')][_0x965c('0x11')]);}})[_0x965c('0x13')](function(_0x4a571b){logger[_0x965c('0xf')](_0x965c('0xb'),_0xbfceb0,_0x4a571b);_0x2a21f8(_0x4a571b);});});}exports['CreateVoiceAgentReport']=function(_0x496809){var _0x515073=this;return new Promise(function(_0x36e091,_0x3e91cd){return db[_0x965c('0x14')][_0x965c('0x15')](_0x496809[_0x965c('0x16')],{'raw':_0x496809[_0x965c('0x17')]?_0x496809[_0x965c('0x17')][_0x965c('0x18')]===undefined?!![]:![]:!![]})[_0x965c('0x19')](function(_0x42d71d){logger[_0x965c('0xa')]('CreateVoiceAgentReport',_0x496809);logger[_0x965c('0xd')](_0x965c('0x1a'),_0x496809,JSON[_0x965c('0xe')](_0x42d71d));_0x36e091(_0x42d71d);})[_0x965c('0x13')](function(_0x42d44b){logger[_0x965c('0xf')](_0x965c('0x1a'),_0x42d44b['message'],_0x496809);_0x3e91cd(_0x515073[_0x965c('0xf')](0x1f4,_0x42d44b['message']));});});};exports[_0x965c('0x1b')]=function(_0x44149a){var _0x5ee334=this;return new Promise(function(_0x317a3d,_0x266386){return db[_0x965c('0x14')][_0x965c('0x1c')](_0x44149a[_0x965c('0x16')],{'raw':_0x44149a[_0x965c('0x17')]?_0x44149a[_0x965c('0x17')][_0x965c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44149a['options']?_0x44149a['options'][_0x965c('0x1d')]||null:null,'attributes':_0x44149a['options']?_0x44149a[_0x965c('0x17')][_0x965c('0x1e')]||null:null,'limit':_0x44149a[_0x965c('0x17')]?_0x44149a[_0x965c('0x17')][_0x965c('0x1f')]||null:null})[_0x965c('0x19')](function(_0x900672){logger[_0x965c('0xa')]('UpdateVoiceAgentReport',_0x44149a);logger[_0x965c('0xd')](_0x965c('0x1b'),_0x44149a,JSON['stringify'](_0x900672));_0x317a3d(_0x900672);})[_0x965c('0x13')](function(_0xefa58e){logger[_0x965c('0xf')](_0x965c('0x1b'),_0xefa58e['message'],_0x44149a);_0x266386(_0x5ee334[_0x965c('0xf')](0x1f4,_0xefa58e[_0x965c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 61ebc24..a49dd6a 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 _0xd13e=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x443b1e,_0xf7ffe9){var _0x3beb6f=function(_0x1cd133){while(--_0x1cd133){_0x443b1e['push'](_0x443b1e['shift']());}};_0x3beb6f(++_0xf7ffe9);}(_0xd13e,0x193));var _0xed13=function(_0x5f500a,_0x52590e){_0x5f500a=_0x5f500a-0x0;var _0xa425ab=_0xd13e[_0x5f500a];return _0xa425ab;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed13('0x8')](_0xed13('0x9'),auth[_0xed13('0xa')](),controller[_0xed13('0xb')]);router[_0xed13('0x8')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0xd')]);router[_0xed13('0xe')]('/',auth['isAuthenticated'](),controller[_0xed13('0xf')]);router[_0xed13('0x10')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x11')]);router['delete'](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x12')]);module[_0xed13('0x13')]=router; \ No newline at end of file +var _0xeec6=['isAuthenticated','index','/describe','describe','get','show','post','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xeec6[_0x4b1032];return _0x5a1d55;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xa')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6eec('0x11'),auth[_0x6eec('0xa')](),controller['update']);router['delete'](_0x6eec('0x11'),auth['isAuthenticated'](),controller[_0x6eec('0x12')]);module[_0x6eec('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 99ef398..c1226c1 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 _0xa064=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','inbound-fax','dialer','TEXT'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xa064,0x192));var _0x4a06=function(_0x395af7,_0x32901c){_0x395af7=_0x395af7-0x0;var _0x3d15cb=_0xa064[_0x395af7];return _0x3d15cb;};'use strict';var Sequelize=require(_0x4a06('0x0'));module[_0x4a06('0x1')]={'uniqueid':{'type':Sequelize[_0x4a06('0x2')]},'type':{'type':Sequelize[_0x4a06('0x3')](_0x4a06('0x4'),'internal','outbound',_0x4a06('0x5'),'outbound-fax',_0x4a06('0x6'))},'tag':{'type':Sequelize[_0x4a06('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x4a06('0x2')]},'destination':{'type':Sequelize[_0x4a06('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4a06('0x2')]},'channel':{'type':Sequelize[_0x4a06('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4a06('0x7')]},'starttime':{'type':Sequelize[_0x4a06('0x8')]},'systemanswertime':{'type':Sequelize[_0x4a06('0x8')]},'answertime':{'type':Sequelize[_0x4a06('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4a06('0x9')]},'billableseconds':{'type':Sequelize[_0x4a06('0x9')]},'mohtime':{'type':Sequelize[_0x4a06('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4a06('0x2')]},'amaflags':{'type':Sequelize[_0x4a06('0x2')]},'userfield':{'type':Sequelize[_0x4a06('0x2')]},'userDisposition':{'type':Sequelize[_0x4a06('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x4a06('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4a06('0x2')]},'routeid':{'type':Sequelize[_0x4a06('0x9')]},'sipcallid':{'type':Sequelize[_0x4a06('0x2')]}}; \ No newline at end of file +var _0x3458=['DATE','INTEGER','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','TEXT'];(function(_0x1f21a9,_0x967fa9){var _0x2756ba=function(_0x42612c){while(--_0x42612c){_0x1f21a9['push'](_0x1f21a9['shift']());}};_0x2756ba(++_0x967fa9);}(_0x3458,0x92));var _0x8345=function(_0x4687aa,_0x52ce79){_0x4687aa=_0x4687aa-0x0;var _0x129611=_0x3458[_0x4687aa];return _0x129611;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8345('0x0')]},'type':{'type':Sequelize[_0x8345('0x1')](_0x8345('0x2'),'internal',_0x8345('0x3'),_0x8345('0x4'),_0x8345('0x5'),'dialer')},'tag':{'type':Sequelize[_0x8345('0x0')]},'accountcode':{'type':Sequelize[_0x8345('0x0')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x8345('0x0')]},'destinationcontext':{'type':Sequelize[_0x8345('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8345('0x0')]},'destinationchannel':{'type':Sequelize[_0x8345('0x0')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8345('0x6')]},'starttime':{'type':Sequelize[_0x8345('0x7')]},'systemanswertime':{'type':Sequelize[_0x8345('0x7')]},'answertime':{'type':Sequelize[_0x8345('0x7')]},'endtime':{'type':Sequelize[_0x8345('0x7')]},'duration':{'type':Sequelize[_0x8345('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8345('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x8345('0x0')]},'userfield':{'type':Sequelize[_0x8345('0x0')]},'userDisposition':{'type':Sequelize[_0x8345('0x0')]},'userSecondDisposition':{'type':Sequelize[_0x8345('0x0')]},'userThirdDisposition':{'type':Sequelize[_0x8345('0x0')]},'note':{'type':Sequelize[_0x8345('0x0')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x8345('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7f46eda..e3df63b 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x304395,_0x5016d9){var _0x28a4ac=function(_0x11923e){while(--_0x11923e){_0x304395['push'](_0x304395['shift']());}};_0x28a4ac(++_0x5016d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0xb10b[_0x3eceb2];return _0x818bc4;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xadb5,0xad));var _0x5adb=function(_0x23a178,_0x2840dc){_0x23a178=_0x23a178-0x0;var _0x4e6937=_0xadb5[_0x23a178];return _0x4e6937;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a2bfecc..754f60a 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 _0xa049=['report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa049,0x136));var _0x9a04=function(_0x47cd62,_0x19bbf3){_0x47cd62=_0x47cd62-0x0;var _0x7923b9=_0xa049[_0x47cd62];return _0x7923b9;};'use strict';var _=require('lodash');var util=require(_0x9a04('0x0'));var logger=require(_0x9a04('0x1'))(_0x9a04('0x2'));var moment=require(_0x9a04('0x3'));var BPromise=require(_0x9a04('0x4'));var rp=require(_0x9a04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a04('0x6'));var config=require(_0x9a04('0x7'));var attributes=require(_0x9a04('0x8'));module[_0x9a04('0x9')]=function(_0x376afc,_0x15d14a){return _0x376afc[_0x9a04('0xa')](_0x9a04('0xb'),attributes,{'tableName':_0x9a04('0xc'),'paranoid':![],'indexes':[{'fields':[_0x9a04('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd93e=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd93e,0x15d));var _0xed93=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd93e[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var logger=require(_0xed93('0x2'))('api');var moment=require('moment');var BPromise=require(_0xed93('0x3'));var rp=require(_0xed93('0x4'));var fs=require('fs');var path=require(_0xed93('0x5'));var rimraf=require('rimraf');var config=require(_0xed93('0x6'));var attributes=require(_0xed93('0x7'));module['exports']=function(_0x3b39fa,_0x3e0fde){return _0x3b39fa[_0xed93('0x8')](_0xed93('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 790a50b..9c1f96c 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 _0xf8d7=['findAll','options','raw','where','attributes','limit','model','include','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport'];(function(_0x2000fe,_0x286bb5){var _0x569732=function(_0x53255c){while(--_0x53255c){_0x2000fe['push'](_0x2000fe['shift']());}};_0x569732(++_0x286bb5);}(_0xf8d7,0x86));var _0x7f8d=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0xf8d7[_0x179b53];return _0x38a146;};'use strict';var _=require('lodash');var util=require(_0x7f8d('0x0'));var moment=require(_0x7f8d('0x1'));var BPromise=require(_0x7f8d('0x2'));var rs=require(_0x7f8d('0x3'));var fs=require('fs');var Redis=require(_0x7f8d('0x4'));var db=require(_0x7f8d('0x5'))['db'];var utils=require(_0x7f8d('0x6'));var logger=require(_0x7f8d('0x7'))(_0x7f8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f8d('0x9'));var client=jayson[_0x7f8d('0xa')][_0x7f8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44b72e,_0x179e77,_0x5b4f4c){return new BPromise(function(_0x22adcb,_0x2e171a){return client['request'](_0x44b72e,_0x5b4f4c)[_0x7f8d('0xc')](function(_0xbc8a70){logger[_0x7f8d('0xd')](_0x7f8d('0xe'),_0x179e77,'request\x20sent');logger[_0x7f8d('0xf')](_0x7f8d('0x10'),_0x179e77,_0x7f8d('0x11'),JSON[_0x7f8d('0x12')](_0xbc8a70));if(_0xbc8a70[_0x7f8d('0x13')]){if(_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x14')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x179e77,_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x15')]);return _0x2e171a(_0xbc8a70['error'][_0x7f8d('0x15')]);}logger[_0x7f8d('0x13')](_0x7f8d('0xe'),_0x179e77,_0xbc8a70['error'][_0x7f8d('0x15')]);return _0x22adcb(_0xbc8a70[_0x7f8d('0x13')][_0x7f8d('0x15')]);}else{logger['info'](_0x7f8d('0xe'),_0x179e77,'request\x20sent');_0x22adcb(_0xbc8a70[_0x7f8d('0x16')]['message']);}})[_0x7f8d('0x17')](function(_0x5aeac9){logger[_0x7f8d('0x13')](_0x7f8d('0xe'),_0x179e77,_0x5aeac9);_0x2e171a(_0x5aeac9);});});}exports[_0x7f8d('0x18')]=function(_0x1e484a){var _0x2abaf1=this;return new Promise(function(_0x383231,_0x5c4cf9){return db[_0x7f8d('0x19')][_0x7f8d('0x1a')]({'raw':_0x1e484a['options']?_0x1e484a[_0x7f8d('0x1b')][_0x7f8d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e484a['options']?_0x1e484a[_0x7f8d('0x1b')][_0x7f8d('0x1d')]||null:null,'attributes':_0x1e484a[_0x7f8d('0x1b')]?_0x1e484a['options'][_0x7f8d('0x1e')]||null:null,'limit':_0x1e484a['options']?_0x1e484a['options'][_0x7f8d('0x1f')]||null:null,'include':_0x1e484a[_0x7f8d('0x1b')]?_0x1e484a[_0x7f8d('0x1b')]['include']?_['map'](_0x1e484a[_0x7f8d('0x1b')]['include'],function(_0x5e3ced){return{'model':db[_0x5e3ced[_0x7f8d('0x20')]],'as':_0x5e3ced['as'],'attributes':_0x5e3ced[_0x7f8d('0x1e')],'include':_0x5e3ced[_0x7f8d('0x21')]?_[_0x7f8d('0x22')](_0x5e3ced[_0x7f8d('0x21')],function(_0x5e4d8a){return{'model':db[_0x5e4d8a[_0x7f8d('0x20')]],'as':_0x5e4d8a['as'],'attributes':_0x5e4d8a[_0x7f8d('0x1e')],'include':_0x5e4d8a['include']?_[_0x7f8d('0x22')](_0x5e4d8a[_0x7f8d('0x21')],function(_0x254832){return{'model':db[_0x254832['model']],'as':_0x254832['as'],'attributes':_0x254832[_0x7f8d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14db78){logger['info']('GetVoiceCallReport',_0x1e484a);logger[_0x7f8d('0xf')](_0x7f8d('0x18'),_0x1e484a,JSON[_0x7f8d('0x12')](_0x14db78));_0x383231(_0x14db78);})[_0x7f8d('0x17')](function(_0x1a6df5){logger[_0x7f8d('0x13')]('GetVoiceCallReport',_0x1a6df5[_0x7f8d('0x15')],_0x1e484a);_0x5c4cf9(_0x2abaf1[_0x7f8d('0x13')](0x1f4,_0x1a6df5['message']));});});};exports[_0x7f8d('0x23')]=function(_0x2d0ec5){var _0x3c7e15=this;return new Promise(function(_0x482b93,_0x5d1fe8){return db[_0x7f8d('0x19')][_0x7f8d('0x24')](_0x2d0ec5[_0x7f8d('0x25')],{'raw':_0x2d0ec5['options']?_0x2d0ec5['options']['raw']===undefined?!![]:![]:!![]})[_0x7f8d('0xc')](function(_0x13b6b8){logger['info'](_0x7f8d('0x23'),_0x2d0ec5);logger[_0x7f8d('0xf')](_0x7f8d('0x23'),_0x2d0ec5,JSON[_0x7f8d('0x12')](_0x13b6b8));_0x482b93(_0x13b6b8);})['catch'](function(_0x3d5848){logger[_0x7f8d('0x13')](_0x7f8d('0x23'),_0x3d5848['message'],_0x2d0ec5);_0x5d1fe8(_0x3c7e15['error'](0x1f4,_0x3d5848[_0x7f8d('0x15')]));});});};exports[_0x7f8d('0x26')]=function(_0x408010){var _0x4f9f1b=this;return new Promise(function(_0x479d53,_0x27ccad){return db[_0x7f8d('0x19')][_0x7f8d('0x27')](_0x408010[_0x7f8d('0x25')],{'raw':_0x408010[_0x7f8d('0x1b')]?_0x408010[_0x7f8d('0x1b')][_0x7f8d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408010['options']?_0x408010[_0x7f8d('0x1b')][_0x7f8d('0x1d')]||null:null,'attributes':_0x408010[_0x7f8d('0x1b')]?_0x408010[_0x7f8d('0x1b')]['attributes']||null:null,'limit':_0x408010[_0x7f8d('0x1b')]?_0x408010[_0x7f8d('0x1b')][_0x7f8d('0x1f')]||null:null})[_0x7f8d('0xc')](function(_0x336c17){logger[_0x7f8d('0xd')](_0x7f8d('0x26'),_0x408010);logger[_0x7f8d('0xf')](_0x7f8d('0x26'),_0x408010,JSON['stringify'](_0x336c17));_0x479d53(_0x336c17);})[_0x7f8d('0x17')](function(_0x4b42a4){logger[_0x7f8d('0x13')](_0x7f8d('0x26'),_0x4b42a4[_0x7f8d('0x15')],_0x408010);_0x27ccad(_0x4f9f1b[_0x7f8d('0x13')](0x1f4,_0x4b42a4[_0x7f8d('0x15')]));});});}; \ No newline at end of file +var _0x8d5e=['client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','then','debug','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x249b8e,_0x4df915){var _0x3541ae=function(_0x5ea416){while(--_0x5ea416){_0x249b8e['push'](_0x249b8e['shift']());}};_0x3541ae(++_0x4df915);}(_0x8d5e,0x19a));var _0xe8d5=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8d5e[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0xe8d5('0x0'));var moment=require(_0xe8d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8d5('0x2'));var db=require(_0xe8d5('0x3'))['db'];var utils=require(_0xe8d5('0x4'));var logger=require(_0xe8d5('0x5'))('rpc');var config=require(_0xe8d5('0x6'));var jayson=require(_0xe8d5('0x7'));var client=jayson[_0xe8d5('0x8')][_0xe8d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2608bf,_0x3f7a13,_0x3eb966){return new BPromise(function(_0x1af844,_0xb389d2){return client[_0xe8d5('0xa')](_0x2608bf,_0x3eb966)['then'](function(_0x33ee48){logger[_0xe8d5('0xb')](_0xe8d5('0xc'),_0x3f7a13,_0xe8d5('0xd'));logger['debug'](_0xe8d5('0xe'),_0x3f7a13,'request\x20sent',JSON[_0xe8d5('0xf')](_0x33ee48));if(_0x33ee48[_0xe8d5('0x10')]){if(_0x33ee48[_0xe8d5('0x10')][_0xe8d5('0x11')]===0x1f4){logger[_0xe8d5('0x10')](_0xe8d5('0xc'),_0x3f7a13,_0x33ee48['error'][_0xe8d5('0x12')]);return _0xb389d2(_0x33ee48['error']['message']);}logger[_0xe8d5('0x10')](_0xe8d5('0xc'),_0x3f7a13,_0x33ee48[_0xe8d5('0x10')][_0xe8d5('0x12')]);return _0x1af844(_0x33ee48['error'][_0xe8d5('0x12')]);}else{logger[_0xe8d5('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x3f7a13,'request\x20sent');_0x1af844(_0x33ee48[_0xe8d5('0x13')][_0xe8d5('0x12')]);}})[_0xe8d5('0x14')](function(_0x464884){logger[_0xe8d5('0x10')](_0xe8d5('0xc'),_0x3f7a13,_0x464884);_0xb389d2(_0x464884);});});}exports[_0xe8d5('0x15')]=function(_0x2b3596){var _0x3f2839=this;return new Promise(function(_0x3d138f,_0x563a85){return db[_0xe8d5('0x16')][_0xe8d5('0x17')]({'raw':_0x2b3596[_0xe8d5('0x18')]?_0x2b3596[_0xe8d5('0x18')][_0xe8d5('0x19')]===undefined?!![]:![]:!![],'where':_0x2b3596['options']?_0x2b3596[_0xe8d5('0x18')][_0xe8d5('0x1a')]||null:null,'attributes':_0x2b3596[_0xe8d5('0x18')]?_0x2b3596[_0xe8d5('0x18')][_0xe8d5('0x1b')]||null:null,'limit':_0x2b3596['options']?_0x2b3596[_0xe8d5('0x18')]['limit']||null:null,'include':_0x2b3596[_0xe8d5('0x18')]?_0x2b3596[_0xe8d5('0x18')][_0xe8d5('0x1c')]?_[_0xe8d5('0x1d')](_0x2b3596[_0xe8d5('0x18')][_0xe8d5('0x1c')],function(_0x107a25){return{'model':db[_0x107a25[_0xe8d5('0x1e')]],'as':_0x107a25['as'],'attributes':_0x107a25[_0xe8d5('0x1b')],'include':_0x107a25['include']?_[_0xe8d5('0x1d')](_0x107a25[_0xe8d5('0x1c')],function(_0x1c729b){return{'model':db[_0x1c729b[_0xe8d5('0x1e')]],'as':_0x1c729b['as'],'attributes':_0x1c729b[_0xe8d5('0x1b')],'include':_0x1c729b[_0xe8d5('0x1c')]?_['map'](_0x1c729b[_0xe8d5('0x1c')],function(_0x35293c){return{'model':db[_0x35293c[_0xe8d5('0x1e')]],'as':_0x35293c['as'],'attributes':_0x35293c[_0xe8d5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8d5('0x1f')](function(_0x47586c){logger[_0xe8d5('0xb')]('GetVoiceCallReport',_0x2b3596);logger[_0xe8d5('0x20')]('GetVoiceCallReport',_0x2b3596,JSON['stringify'](_0x47586c));_0x3d138f(_0x47586c);})[_0xe8d5('0x14')](function(_0x4c7ca1){logger['error'](_0xe8d5('0x15'),_0x4c7ca1['message'],_0x2b3596);_0x563a85(_0x3f2839[_0xe8d5('0x10')](0x1f4,_0x4c7ca1[_0xe8d5('0x12')]));});});};exports[_0xe8d5('0x21')]=function(_0x4bb89a){var _0x59e730=this;return new Promise(function(_0x33a90f,_0x599919){return db[_0xe8d5('0x16')][_0xe8d5('0x22')](_0x4bb89a[_0xe8d5('0x23')],{'raw':_0x4bb89a[_0xe8d5('0x18')]?_0x4bb89a[_0xe8d5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe8d5('0x1f')](function(_0x4f495c){logger['info'](_0xe8d5('0x21'),_0x4bb89a);logger[_0xe8d5('0x20')](_0xe8d5('0x21'),_0x4bb89a,JSON['stringify'](_0x4f495c));_0x33a90f(_0x4f495c);})[_0xe8d5('0x14')](function(_0x4d83bf){logger[_0xe8d5('0x10')](_0xe8d5('0x21'),_0x4d83bf[_0xe8d5('0x12')],_0x4bb89a);_0x599919(_0x59e730['error'](0x1f4,_0x4d83bf[_0xe8d5('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4c9119){var _0x1e3f04=this;return new Promise(function(_0x152d73,_0x324256){return db['VoiceCallReport'][_0xe8d5('0x24')](_0x4c9119[_0xe8d5('0x23')],{'raw':_0x4c9119['options']?_0x4c9119[_0xe8d5('0x18')][_0xe8d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9119[_0xe8d5('0x18')]?_0x4c9119[_0xe8d5('0x18')][_0xe8d5('0x1a')]||null:null,'attributes':_0x4c9119[_0xe8d5('0x18')]?_0x4c9119['options'][_0xe8d5('0x1b')]||null:null,'limit':_0x4c9119[_0xe8d5('0x18')]?_0x4c9119[_0xe8d5('0x18')]['limit']||null:null})[_0xe8d5('0x1f')](function(_0x37ba2f){logger[_0xe8d5('0xb')](_0xe8d5('0x25'),_0x4c9119);logger[_0xe8d5('0x20')](_0xe8d5('0x25'),_0x4c9119,JSON[_0xe8d5('0xf')](_0x37ba2f));_0x152d73(_0x37ba2f);})['catch'](function(_0x3d965a){logger[_0xe8d5('0x10')](_0xe8d5('0x25'),_0x3d965a[_0xe8d5('0x12')],_0x4c9119);_0x324256(_0x1e3f04['error'](0x1f4,_0x3d965a[_0xe8d5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8441f39..1250fc4 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 _0x561a=['/:id','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','put'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x561a,0x157));var _0xa561=function(_0x1432a6,_0x5846c5){_0x1432a6=_0x1432a6-0x0;var _0x3eab00=_0x561a[_0x1432a6];return _0x3eab00;};'use strict';var multer=require(_0xa561('0x0'));var util=require(_0xa561('0x1'));var path=require('path');var timeout=require(_0xa561('0x2'));var express=require(_0xa561('0x3'));var router=express[_0xa561('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa561('0x5'));var interaction=require(_0xa561('0x6'));var config=require(_0xa561('0x7'));var controller=require(_0xa561('0x8'));router[_0xa561('0x9')]('/',auth[_0xa561('0xa')](),controller[_0xa561('0xb')]);router[_0xa561('0x9')]('/:id',auth[_0xa561('0xa')](),controller[_0xa561('0xc')]);router['post']('/',auth[_0xa561('0xa')](),controller['create']);router[_0xa561('0xd')](_0xa561('0xe'),auth[_0xa561('0xa')](),controller[_0xa561('0xf')]);router[_0xa561('0x10')](_0xa561('0xe'),auth[_0xa561('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x569d=['get','isAuthenticated','index','/:id','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x33bd05,_0x25781f){var _0x214ca2=function(_0x296820){while(--_0x296820){_0x33bd05['push'](_0x33bd05['shift']());}};_0x214ca2(++_0x25781f);}(_0x569d,0x1ab));var _0xd569=function(_0x33199e,_0x428ded){_0x33199e=_0x33199e-0x0;var _0x2eef3c=_0x569d[_0x33199e];return _0x2eef3c;};'use strict';var multer=require('multer');var util=require(_0xd569('0x0'));var path=require(_0xd569('0x1'));var timeout=require(_0xd569('0x2'));var express=require(_0xd569('0x3'));var router=express[_0xd569('0x4')]();var fs_extra=require(_0xd569('0x5'));var auth=require(_0xd569('0x6'));var interaction=require(_0xd569('0x7'));var config=require(_0xd569('0x8'));var controller=require(_0xd569('0x9'));router[_0xd569('0xa')]('/',auth[_0xd569('0xb')](),controller[_0xd569('0xc')]);router[_0xd569('0xa')](_0xd569('0xd'),auth[_0xd569('0xb')](),controller['show']);router['post']('/',auth[_0xd569('0xb')](),controller[_0xd569('0xe')]);router[_0xd569('0xf')](_0xd569('0xd'),auth[_0xd569('0xb')](),controller[_0xd569('0x10')]);router[_0xd569('0x11')]('/:id',auth[_0xd569('0xb')](),controller['destroy']);module[_0xd569('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c7e6e1c..858a512 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 _0xdb6b=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb6b,0x15a));var _0xbdb6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb6b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbdb6('0x0'));module[_0xbdb6('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xbdb6('0x2')],'unique':_0xbdb6('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x41ed2f){this[_0xbdb6('0x4')](_0xbdb6('0x5'),_0x41ed2f?_0x41ed2f[_0xbdb6('0x6')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xbdb6('0x7')](_0xbdb6('0x5'))[_0xbdb6('0x8')](''):[];}},'auth':{'type':Sequelize[_0xbdb6('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xbdb6('0x2')]},'record':{'type':Sequelize[_0xbdb6('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbdb6('0x2')]},'description':{'type':Sequelize[_0xbdb6('0x2')]}}; \ No newline at end of file +var _0x4342=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4342,0xe5));var _0x2434=function(_0x49aa99,_0x4ef618){_0x49aa99=_0x49aa99-0x0;var _0x1786d7=_0x4342[_0x49aa99];return _0x1786d7;};'use strict';var Sequelize=require(_0x2434('0x0'));module[_0x2434('0x1')]={'name':{'type':Sequelize[_0x2434('0x2')]},'prefix':{'type':Sequelize[_0x2434('0x2')],'unique':_0x2434('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2434('0x2')],'set':function(_0x50953a){this[_0x2434('0x4')]('options',_0x50953a?_0x50953a['join'](''):[]);},'get':function(){return this[_0x2434('0x5')](_0x2434('0x6'))?this[_0x2434('0x5')](_0x2434('0x6'))[_0x2434('0x7')](''):[];}},'auth':{'type':Sequelize[_0x2434('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2434('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2434('0x2')]},'description':{'type':Sequelize[_0x2434('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c375813..45ae7b2 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 _0x3ef0=['findAll','rows','catch','show','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0x3ef0,0x19a));var _0x03ef=function(_0x38de04,_0x535552){_0x38de04=_0x38de04-0x0;var _0x57c01e=_0x3ef0[_0x38de04];return _0x57c01e;};'use strict';var emlformat=require(_0x03ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03ef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03ef('0x2'));var moment=require('moment');var BPromise=require(_0x03ef('0x3'));var Mustache=require(_0x03ef('0x4'));var util=require(_0x03ef('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x03ef('0x6'));var ejs=require(_0x03ef('0x7'));var fs=require('fs');var fs_extra=require(_0x03ef('0x8'));var _=require('lodash');var squel=require(_0x03ef('0x9'));var crypto=require(_0x03ef('0xa'));var jsforce=require(_0x03ef('0xb'));var deskjs=require(_0x03ef('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03ef('0xd'));var Redis=require(_0x03ef('0xe'));var authService=require(_0x03ef('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x03ef('0x10'));var hardwareService=require(_0x03ef('0x11'));var logger=require('../../config/logger')(_0x03ef('0x12'));var utils=require(_0x03ef('0x13'));var config=require(_0x03ef('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x03ef('0x15'))['db'];function respondWithStatusCode(_0x8f3fb,_0x390cc2){_0x390cc2=_0x390cc2||0xcc;return function(_0x1e138e){if(_0x1e138e){return _0x8f3fb[_0x03ef('0x16')](_0x390cc2);}return _0x8f3fb[_0x03ef('0x17')](_0x390cc2)[_0x03ef('0x18')]();};}function respondWithResult(_0x39ed69,_0x1702a0){_0x1702a0=_0x1702a0||0xc8;return function(_0x3390ae){if(_0x3390ae){return _0x39ed69[_0x03ef('0x17')](_0x1702a0)['json'](_0x3390ae);}};}function respondWithFilteredResult(_0x531025,_0x16282b){return function(_0x17b6ec){if(_0x17b6ec){var _0x1a0113=typeof _0x16282b[_0x03ef('0x19')]===_0x03ef('0x1a')&&typeof _0x16282b['limit']==='undefined';var _0x343bf0=_0x17b6ec[_0x03ef('0x1b')];var _0x501d87=_0x1a0113?0x0:_0x16282b['offset'];var _0x277f0d=_0x1a0113?_0x17b6ec[_0x03ef('0x1b')]:_0x16282b[_0x03ef('0x19')]+_0x16282b[_0x03ef('0x1c')];var _0x1776d8;if(_0x277f0d>=_0x343bf0){_0x277f0d=_0x343bf0;_0x1776d8=0xc8;}else{_0x1776d8=0xce;}_0x531025['status'](_0x1776d8);return _0x531025[_0x03ef('0x1d')](_0x03ef('0x1e'),_0x501d87+'-'+_0x277f0d+'/'+_0x343bf0)['json'](_0x17b6ec);}return null;};}function patchUpdates(_0xb663d){return function(_0x39f693){try{jsonpatch[_0x03ef('0x1f')](_0x39f693,_0xb663d,!![]);}catch(_0xde0e02){return BPromise[_0x03ef('0x20')](_0xde0e02);}return _0x39f693['save']();};}function saveUpdates(_0x5cddb6,_0x41d7d7){return function(_0x5d56e1){if(_0x5d56e1){return _0x5d56e1[_0x03ef('0x21')](_0x5cddb6)['then'](function(_0x5c1a36){return _0x5c1a36;});}return null;};}function removeEntity(_0x13b033,_0x27ac0d){return function(_0x5efaf0){if(_0x5efaf0){return _0x5efaf0['destroy']()[_0x03ef('0x22')](function(){var _0x38a7c5=_0x5efaf0['get']({'plain':!![]});var _0x305829=_0x03ef('0x23');return db[_0x03ef('0x24')]['destroy']({'where':{'type':_0x305829,'resourceId':_0x38a7c5['id']}})[_0x03ef('0x22')](function(){return _0x5efaf0;});})[_0x03ef('0x22')](function(){_0x13b033[_0x03ef('0x17')](0xcc)[_0x03ef('0x18')]();});}};}function handleEntityNotFound(_0x1d1a51,_0x1b766b){return function(_0x538a5d){if(!_0x538a5d){_0x1d1a51['sendStatus'](0x194);}return _0x538a5d;};}function handleError(_0x29c965,_0x5a2bd5){_0x5a2bd5=_0x5a2bd5||0x1f4;return function(_0x39f762){logger[_0x03ef('0x25')](_0x39f762[_0x03ef('0x26')]);if(_0x39f762['name']){delete _0x39f762[_0x03ef('0x27')];}_0x29c965[_0x03ef('0x17')](_0x5a2bd5)[_0x03ef('0x28')](_0x39f762);};}exports[_0x03ef('0x29')]=function(_0x53658c,_0x4711df){var _0x2cd00c={},_0xf38b61={},_0x154c6f={'count':0x0,'rows':[]};var _0x54c07e=_[_0x03ef('0x2a')](db[_0x03ef('0x2b')][_0x03ef('0x2c')],function(_0x4ba338){return{'name':_0x4ba338[_0x03ef('0x2d')],'type':_0x4ba338[_0x03ef('0x2e')][_0x03ef('0x2f')]};});_0xf38b61[_0x03ef('0x30')]=_[_0x03ef('0x2a')](_0x54c07e,'name');_0xf38b61[_0x03ef('0x31')]=_[_0x03ef('0x32')](_0x53658c[_0x03ef('0x31')]);_0xf38b61[_0x03ef('0x33')]=_[_0x03ef('0x34')](_0xf38b61['model'],_0xf38b61[_0x03ef('0x31')]);_0x2cd00c[_0x03ef('0x35')]=_[_0x03ef('0x34')](_0xf38b61[_0x03ef('0x30')],qs[_0x03ef('0x36')](_0x53658c['query']['fields']));_0x2cd00c[_0x03ef('0x35')]=_0x2cd00c[_0x03ef('0x35')]['length']?_0x2cd00c[_0x03ef('0x35')]:_0xf38b61['model'];if(!_0x53658c[_0x03ef('0x31')][_0x03ef('0x37')]('nolimit')){_0x2cd00c[_0x03ef('0x1c')]=qs['limit'](_0x53658c[_0x03ef('0x31')][_0x03ef('0x1c')]);_0x2cd00c['offset']=qs['offset'](_0x53658c[_0x03ef('0x31')][_0x03ef('0x19')]);}_0x2cd00c['order']=qs[_0x03ef('0x38')](_0x53658c[_0x03ef('0x31')][_0x03ef('0x38')]);_0x2cd00c[_0x03ef('0x39')]=qs[_0x03ef('0x33')](_[_0x03ef('0x3a')](_0x53658c[_0x03ef('0x31')],_0xf38b61[_0x03ef('0x33')]),_0x54c07e);if(_0x53658c['query'][_0x03ef('0x3b')]){_0x2cd00c[_0x03ef('0x39')]=_[_0x03ef('0x3c')](_0x2cd00c['where'],{'$or':_[_0x03ef('0x2a')](_0x54c07e,function(_0x473dfe){if(_0x473dfe[_0x03ef('0x2e')]!==_0x03ef('0x3d')){var _0x4b2f62={};_0x4b2f62[_0x473dfe[_0x03ef('0x27')]]={'$like':'%'+_0x53658c[_0x03ef('0x31')][_0x03ef('0x3b')]+'%'};return _0x4b2f62;}})});}_0x2cd00c=_[_0x03ef('0x3c')]({},_0x2cd00c,_0x53658c['options']);var _0x286555={'where':_0x2cd00c[_0x03ef('0x39')]};return db[_0x03ef('0x2b')][_0x03ef('0x1b')](_0x286555)[_0x03ef('0x22')](function(_0x177e8b){_0x154c6f[_0x03ef('0x1b')]=_0x177e8b;if(_0x53658c[_0x03ef('0x31')][_0x03ef('0x3e')]){_0x2cd00c[_0x03ef('0x3f')]=[{'all':!![]}];}return db[_0x03ef('0x2b')][_0x03ef('0x40')](_0x2cd00c);})[_0x03ef('0x22')](function(_0x8f7f42){_0x154c6f[_0x03ef('0x41')]=_0x8f7f42;return _0x154c6f;})[_0x03ef('0x22')](respondWithFilteredResult(_0x4711df,_0x2cd00c))[_0x03ef('0x42')](handleError(_0x4711df,null));};exports[_0x03ef('0x43')]=function(_0x1152d3,_0xd37ba6){var _0x3f5a8b={'raw':![],'where':{'id':_0x1152d3['params']['id']}},_0xeaffb0={};_0xeaffb0[_0x03ef('0x30')]=_[_0x03ef('0x32')](db[_0x03ef('0x2b')][_0x03ef('0x2c')]);_0xeaffb0[_0x03ef('0x31')]=_[_0x03ef('0x32')](_0x1152d3[_0x03ef('0x31')]);_0xeaffb0[_0x03ef('0x33')]=_[_0x03ef('0x34')](_0xeaffb0[_0x03ef('0x30')],_0xeaffb0[_0x03ef('0x31')]);_0x3f5a8b[_0x03ef('0x35')]=_['intersection'](_0xeaffb0[_0x03ef('0x30')],qs[_0x03ef('0x36')](_0x1152d3['query'][_0x03ef('0x36')]));_0x3f5a8b[_0x03ef('0x35')]=_0x3f5a8b['attributes'][_0x03ef('0x44')]?_0x3f5a8b[_0x03ef('0x35')]:_0xeaffb0[_0x03ef('0x30')];if(_0x1152d3['query'][_0x03ef('0x3e')]){_0x3f5a8b[_0x03ef('0x3f')]=[{'all':!![]}];}_0x3f5a8b=_['merge']({},_0x3f5a8b,_0x1152d3['options']);return db[_0x03ef('0x2b')][_0x03ef('0x45')](_0x3f5a8b)[_0x03ef('0x22')](handleEntityNotFound(_0xd37ba6,null))[_0x03ef('0x22')](respondWithResult(_0xd37ba6,null))[_0x03ef('0x42')](handleError(_0xd37ba6,null));};exports[_0x03ef('0x46')]=function(_0x27c6ca,_0x2e3145){return db[_0x03ef('0x2b')]['create'](_0x27c6ca[_0x03ef('0x47')],{})['then'](function(_0x83afeb){var _0x159f2f=_0x27c6ca['user'][_0x03ef('0x48')]({'plain':!![]});if(!_0x159f2f)throw new Error(_0x03ef('0x49'));if(_0x159f2f[_0x03ef('0x4a')]===_0x03ef('0x4b')){var _0x390483=_0x83afeb['get']({'plain':!![]});var _0x1b7e2f=_0x03ef('0x23');return db['UserProfileSection'][_0x03ef('0x45')]({'where':{'name':_0x1b7e2f,'userProfileId':_0x159f2f[_0x03ef('0x4c')]},'raw':!![]})['then'](function(_0x6efa41){if(_0x6efa41&&_0x6efa41['autoAssociation']===0x0){return db['UserProfileResource'][_0x03ef('0x46')]({'name':_0x390483[_0x03ef('0x27')],'resourceId':_0x390483['id'],'type':_0x6efa41['name'],'sectionId':_0x6efa41['id']},{})['then'](function(){return _0x83afeb;});}else{return _0x83afeb;}})[_0x03ef('0x42')](function(_0x5a5533){logger[_0x03ef('0x25')](_0x03ef('0x4d'),_0x5a5533);throw _0x5a5533;});}return _0x83afeb;})[_0x03ef('0x22')](respondWithResult(_0x2e3145,0xc9))[_0x03ef('0x42')](handleError(_0x2e3145,null));};exports[_0x03ef('0x21')]=function(_0x492b1d,_0x45723f){if(_0x492b1d['body']['id']){delete _0x492b1d[_0x03ef('0x47')]['id'];}return db[_0x03ef('0x2b')][_0x03ef('0x45')]({'where':{'id':_0x492b1d[_0x03ef('0x4e')]['id']}})[_0x03ef('0x22')](handleEntityNotFound(_0x45723f,null))[_0x03ef('0x22')](saveUpdates(_0x492b1d[_0x03ef('0x47')],null))[_0x03ef('0x22')](respondWithResult(_0x45723f,null))[_0x03ef('0x42')](handleError(_0x45723f,null));};exports['destroy']=function(_0x5b46a8,_0x152bb5){return db[_0x03ef('0x2b')][_0x03ef('0x45')]({'where':{'id':_0x5b46a8[_0x03ef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x152bb5,null))[_0x03ef('0x22')](removeEntity(_0x152bb5,null))[_0x03ef('0x42')](handleError(_0x152bb5,null));}; \ No newline at end of file +var _0xf0cc=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','error','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x29bf6b,_0x12a4ac){_0x29bf6b=_0x29bf6b-0x0;var _0xbf3db3=_0xf0cc[_0x29bf6b];return _0xbf3db3;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){var _0x5466f4=_0x33628d[_0xcf0c('0x20')]({'plain':!![]});var _0x39f5e0=_0xcf0c('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x39f5e0,'resourceId':_0x5466f4['id']}})[_0xcf0c('0x1f')](function(){return _0x33628d;});})[_0xcf0c('0x1f')](function(){_0x8c4978[_0xcf0c('0x14')](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x9b0174,_0x36c637){return function(_0x3b38d9){if(!_0x3b38d9){_0x9b0174['sendStatus'](0x194);}return _0x3b38d9;};}function handleError(_0x1d9501,_0x1ce8d4){_0x1ce8d4=_0x1ce8d4||0x1f4;return function(_0x2bd2e3){logger[_0xcf0c('0x22')](_0x2bd2e3['stack']);if(_0x2bd2e3['name']){delete _0x2bd2e3['name'];}_0x1d9501['status'](_0x1ce8d4)[_0xcf0c('0x23')](_0x2bd2e3);};}exports[_0xcf0c('0x24')]=function(_0x3bdfd0,_0x34db17){var _0x3da4df={},_0x3fa73f={},_0x358e43={'count':0x0,'rows':[]};var _0x249d54=_[_0xcf0c('0x25')](db['VoiceChanSpy'][_0xcf0c('0x26')],function(_0x4f5ee2){return{'name':_0x4f5ee2[_0xcf0c('0x27')],'type':_0x4f5ee2[_0xcf0c('0x28')][_0xcf0c('0x29')]};});_0x3fa73f['model']=_['map'](_0x249d54,_0xcf0c('0x2a'));_0x3fa73f['query']=_[_0xcf0c('0x2b')](_0x3bdfd0[_0xcf0c('0x2c')]);_0x3fa73f[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],_0x3fa73f['query']);_0x3da4df[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x3bdfd0['query'][_0xcf0c('0x31')]));_0x3da4df[_0xcf0c('0x30')]=_0x3da4df[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x3da4df['attributes']:_0x3fa73f[_0xcf0c('0x2f')];if(!_0x3bdfd0[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x33'))){_0x3da4df[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x19')]);_0x3da4df[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x3bdfd0['query'][_0xcf0c('0x17')]);}_0x3da4df['order']=qs[_0xcf0c('0x34')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x3da4df[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x3bdfd0['query'],_0x3fa73f[_0xcf0c('0x2d')]),_0x249d54);if(_0x3bdfd0['query'][_0xcf0c('0x36')]){_0x3da4df[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x3da4df[_0xcf0c('0x35')],{'$or':_[_0xcf0c('0x25')](_0x249d54,function(_0x532b2a){if(_0x532b2a[_0xcf0c('0x28')]!==_0xcf0c('0x38')){var _0xc1d73e={};_0xc1d73e[_0x532b2a[_0xcf0c('0x2a')]]={'$like':'%'+_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0xc1d73e;}})});}_0x3da4df=_[_0xcf0c('0x37')]({},_0x3da4df,_0x3bdfd0[_0xcf0c('0x39')]);var _0x12b43f={'where':_0x3da4df[_0xcf0c('0x35')]};return db[_0xcf0c('0x3a')]['count'](_0x12b43f)['then'](function(_0xf39dea){_0x358e43[_0xcf0c('0x18')]=_0xf39dea;if(_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x3da4df[_0xcf0c('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3da4df);})[_0xcf0c('0x1f')](function(_0x24f4bd){_0x358e43[_0xcf0c('0x3d')]=_0x24f4bd;return _0x358e43;})['then'](respondWithFilteredResult(_0x34db17,_0x3da4df))[_0xcf0c('0x3e')](handleError(_0x34db17,null));};exports[_0xcf0c('0x3f')]=function(_0x2c8fa2,_0x1e688e){var _0x53af37={'raw':![],'where':{'id':_0x2c8fa2['params']['id']}},_0x681778={};_0x681778[_0xcf0c('0x2f')]=_['keys'](db[_0xcf0c('0x3a')]['rawAttributes']);_0x681778[_0xcf0c('0x2c')]=_[_0xcf0c('0x2b')](_0x2c8fa2['query']);_0x681778['filters']=_['intersection'](_0x681778[_0xcf0c('0x2f')],_0x681778[_0xcf0c('0x2c')]);_0x53af37[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x681778[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x31')]));_0x53af37[_0xcf0c('0x30')]=_0x53af37[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x53af37[_0xcf0c('0x30')]:_0x681778['model'];if(_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x53af37[_0xcf0c('0x3c')]=[{'all':!![]}];}_0x53af37=_[_0xcf0c('0x37')]({},_0x53af37,_0x2c8fa2[_0xcf0c('0x39')]);return db['VoiceChanSpy']['find'](_0x53af37)[_0xcf0c('0x1f')](handleEntityNotFound(_0x1e688e,null))[_0xcf0c('0x1f')](respondWithResult(_0x1e688e,null))['catch'](handleError(_0x1e688e,null));};exports[_0xcf0c('0x40')]=function(_0x1f9728,_0x87e6d4){return db[_0xcf0c('0x3a')][_0xcf0c('0x40')](_0x1f9728[_0xcf0c('0x41')],{})[_0xcf0c('0x1f')](function(_0xe9f843){var _0x2fca4a=_0x1f9728[_0xcf0c('0x42')][_0xcf0c('0x20')]({'plain':!![]});if(!_0x2fca4a)throw new Error(_0xcf0c('0x43'));if(_0x2fca4a[_0xcf0c('0x44')]===_0xcf0c('0x42')){var _0x11558c=_0xe9f843[_0xcf0c('0x20')]({'plain':!![]});var _0x5563be=_0xcf0c('0x21');return db['UserProfileSection'][_0xcf0c('0x45')]({'where':{'name':_0x5563be,'userProfileId':_0x2fca4a[_0xcf0c('0x46')]},'raw':!![]})[_0xcf0c('0x1f')](function(_0x5103ff){if(_0x5103ff&&_0x5103ff[_0xcf0c('0x47')]===0x0){return db[_0xcf0c('0x48')][_0xcf0c('0x40')]({'name':_0x11558c[_0xcf0c('0x2a')],'resourceId':_0x11558c['id'],'type':_0x5103ff[_0xcf0c('0x2a')],'sectionId':_0x5103ff['id']},{})[_0xcf0c('0x1f')](function(){return _0xe9f843;});}else{return _0xe9f843;}})['catch'](function(_0x20b133){logger['error'](_0xcf0c('0x49'),_0x20b133);throw _0x20b133;});}return _0xe9f843;})[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,0xc9))[_0xcf0c('0x3e')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x1e')]=function(_0x543d75,_0x19782d){if(_0x543d75[_0xcf0c('0x41')]['id']){delete _0x543d75[_0xcf0c('0x41')]['id'];}return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x543d75[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x19782d,null))['then'](saveUpdates(_0x543d75[_0xcf0c('0x41')],null))[_0xcf0c('0x1f')](respondWithResult(_0x19782d,null))[_0xcf0c('0x3e')](handleError(_0x19782d,null));};exports[_0xcf0c('0x4b')]=function(_0x3f9edd,_0x53a2c8){return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x3f9edd[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x53a2c8,null))[_0xcf0c('0x1f')](removeEntity(_0x53a2c8,null))['catch'](handleError(_0x53a2c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c305e5c..bf49a8d 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 _0xbcda=['./voiceChanSpy.attributes','context','%s%s','system','push','merge','format','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','lodash','util','bluebird'];(function(_0x3d3575,_0x50b3ab){var _0x482b9f=function(_0x5581e7){while(--_0x5581e7){_0x3d3575['push'](_0x3d3575['shift']());}};_0x482b9f(++_0x50b3ab);}(_0xbcda,0x1e7));var _0xabcd=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xbcda[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xabcd('0x0'));var util=require(_0xabcd('0x1'));var BPromise=require(_0xabcd('0x2'));var attributes=require(_0xabcd('0x3'));var getUserApplications=function(_0x186fb3,_0x590e49,_0x21a7d3){var _0x1586e5=0x1;var _0x3b21e1=[];var _0x524e0a={'context':_0x590e49[_0xabcd('0x4')]||'from-sip','exten':util['format'](_0xabcd('0x5'),_0x186fb3['prefix'],_0x21a7d3),'type':_0xabcd('0x6'),'isApp':![],'ChanSpyId':_0x186fb3['id'],'UserId':_0x590e49['id']};_0x3b21e1[_0xabcd('0x7')](_[_0xabcd('0x8')]({'app':'Set','appdata':util[_0xabcd('0x9')]('CDR(type)=%s',_0xabcd('0xa')),'priority':_0x1586e5++},_0x524e0a));if(_0x186fb3['record']){_0x3b21e1[_0xabcd('0x7')](_[_0xabcd('0x8')]({'app':_0xabcd('0xb'),'appdata':util[_0xabcd('0x9')](_0xabcd('0xc'),_0x186fb3[_0xabcd('0xd')]),'priority':_0x1586e5++},_0x524e0a));}if(_0x186fb3[_0xabcd('0xe')]){_0x3b21e1[_0xabcd('0x7')](_[_0xabcd('0x8')]({'app':_0xabcd('0xf'),'appdata':_0x186fb3[_0xabcd('0x10')],'priority':_0x1586e5++},_0x524e0a));}_0x3b21e1[_0xabcd('0x7')](_[_0xabcd('0x8')]({'app':'ChanSpy','appdata':util[_0xabcd('0x9')](_0xabcd('0x11'),_0x590e49[_0xabcd('0x12')],_0x186fb3[_0xabcd('0x13')]?_0x186fb3[_0xabcd('0x13')]['join'](''):''),'priority':_0x1586e5++},_0x524e0a));if(_0x186fb3[_0xabcd('0x14')]){_0x3b21e1['push'](_[_0xabcd('0x8')]({'app':_0xabcd('0x15'),'priority':_0x1586e5++},_0x524e0a));}return _0x3b21e1;};var getChanSpyApplications=function(_0x5c4caa,_0x5b5fc1){var _0x166dbb=[];for(var _0x2d144c=0x0,_0x3b9fc2=0x1;_0x2d144c<_0x5b5fc1[_0xabcd('0x16')];_0x2d144c++,_0x3b9fc2=0x1){_0x166dbb=_0x166dbb[_0xabcd('0x17')](getUserApplications(_0x5c4caa,_0x5b5fc1[_0x2d144c],_0x5b5fc1[_0x2d144c][_0xabcd('0x18')]));if(_0x5b5fc1[_0x2d144c][_0xabcd('0x18')]!=_0x5b5fc1[_0x2d144c][_0xabcd('0x12')]){_0x166dbb=_0x166dbb[_0xabcd('0x17')](getUserApplications(_0x5c4caa,_0x5b5fc1[_0x2d144c],_0x5b5fc1[_0x2d144c][_0xabcd('0x12')]));}}return _0x166dbb;};var getChanSpyPromise=function(_0x175c83,_0x4bc1f3){return new BPromise(function(_0x2364de,_0x48d31f){return _0x175c83[_0xabcd('0x19')]['findAll']({'attributes':['id',_0xabcd('0x12'),_0xabcd('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xabcd('0x1a')](function(_0x35c307){if(_0x35c307){return _0x2364de(getChanSpyApplications(_0x4bc1f3,_0x35c307));}return _0x2364de([]);})[_0xabcd('0x1b')](function(_0x59e337){_0x48d31f(_0x59e337);});});};module[_0xabcd('0x1c')]=function(_0x13d466,_0x101abe){var _0x35024d=_0x13d466[_0xabcd('0x1d')];return _0x13d466[_0xabcd('0x1e')](_0xabcd('0x1f'),attributes,{'tableName':_0xabcd('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b9fc8,_0x86092e,_0x39eb16){return getChanSpyPromise(_0x35024d,_0x2b9fc8)[_0xabcd('0x1a')](function(_0x3ada88){if(_0x3ada88&&_0x3ada88[_0xabcd('0x16')]){return _0x35024d['VoiceExtension'][_0xabcd('0x21')](_0x3ada88);}})[_0xabcd('0x1a')](function(){_0x39eb16();})[_0xabcd('0x1b')](function(_0x2b138b){_0x39eb16(_0x2b138b);});},'afterUpdate':function(_0x387fc2,_0x4e3271,_0x4e5927){return _0x35024d[_0xabcd('0x22')]['destroy']({'where':{'ChanSpyId':_0x387fc2['id']}})[_0xabcd('0x1a')](function(){return getChanSpyPromise(_0x35024d,_0x387fc2);})[_0xabcd('0x1a')](function(_0x28a4d7){if(_0x28a4d7&&_0x28a4d7['length']){return _0x35024d[_0xabcd('0x22')][_0xabcd('0x21')](_0x28a4d7);}})[_0xabcd('0x1a')](function(){_0x4e5927();})[_0xabcd('0x1b')](function(_0x578782){_0x4e5927(_0x578782);});},'afterDestroy':function(_0x25c3b6,_0x7f07ba,_0x51045c){return _0x35024d[_0xabcd('0x22')]['destroy']({'where':{'ChanSpyId':_0x25c3b6['id']}})[_0xabcd('0x1a')](function(){_0x51045c();})[_0xabcd('0x1b')](function(_0x37fb3e){_0x51045c(_0x37fb3e);});}}});}; \ No newline at end of file +var _0x41f1=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','util','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','merge','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x41f1,0x14c));var _0x141f=function(_0x206137,_0x2a56c7){_0x206137=_0x206137-0x0;var _0x96c5f7=_0x41f1[_0x206137];return _0x96c5f7;};'use strict';var _=require('lodash');var util=require(_0x141f('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x17d7b8,_0x501bab,_0x987458){var _0x908a86=0x1;var _0xb37222=[];var _0x3d19d4={'context':_0x501bab[_0x141f('0x1')]||_0x141f('0x2'),'exten':util[_0x141f('0x3')]('%s%s',_0x17d7b8[_0x141f('0x4')],_0x987458),'type':_0x141f('0x5'),'isApp':![],'ChanSpyId':_0x17d7b8['id'],'UserId':_0x501bab['id']};_0xb37222[_0x141f('0x6')](_['merge']({'app':_0x141f('0x7'),'appdata':util[_0x141f('0x3')](_0x141f('0x8'),_0x141f('0x9')),'priority':_0x908a86++},_0x3d19d4));if(_0x17d7b8[_0x141f('0xa')]){_0xb37222[_0x141f('0x6')](_['merge']({'app':_0x141f('0xb'),'appdata':util[_0x141f('0x3')]('${UNIQUEID}.%s,a',_0x17d7b8[_0x141f('0xc')]),'priority':_0x908a86++},_0x3d19d4));}if(_0x17d7b8[_0x141f('0xd')]){_0xb37222['push'](_[_0x141f('0xe')]({'app':_0x141f('0xf'),'appdata':_0x17d7b8[_0x141f('0x10')],'priority':_0x908a86++},_0x3d19d4));}_0xb37222['push'](_[_0x141f('0xe')]({'app':'ChanSpy','appdata':util[_0x141f('0x3')](_0x141f('0x11'),_0x501bab[_0x141f('0x12')],_0x17d7b8['options']?_0x17d7b8[_0x141f('0x13')][_0x141f('0x14')](''):''),'priority':_0x908a86++},_0x3d19d4));if(_0x17d7b8[_0x141f('0xa')]){_0xb37222[_0x141f('0x6')](_[_0x141f('0xe')]({'app':_0x141f('0x15'),'priority':_0x908a86++},_0x3d19d4));}return _0xb37222;};var getChanSpyApplications=function(_0x37277c,_0xb68613){var _0x47357d=[];for(var _0x10545c=0x0,_0x44744a=0x1;_0x10545c<_0xb68613['length'];_0x10545c++,_0x44744a=0x1){_0x47357d=_0x47357d[_0x141f('0x16')](getUserApplications(_0x37277c,_0xb68613[_0x10545c],_0xb68613[_0x10545c][_0x141f('0x17')]));if(_0xb68613[_0x10545c]['internal']!=_0xb68613[_0x10545c][_0x141f('0x12')]){_0x47357d=_0x47357d['concat'](getUserApplications(_0x37277c,_0xb68613[_0x10545c],_0xb68613[_0x10545c][_0x141f('0x12')]));}}return _0x47357d;};var getChanSpyPromise=function(_0x2a1129,_0x459548){return new BPromise(function(_0x532a21,_0x2a9190){return _0x2a1129[_0x141f('0x18')][_0x141f('0x19')]({'attributes':['id',_0x141f('0x12'),_0x141f('0x17')],'where':{'role':_0x141f('0x1a'),'chanspy':!![]},'raw':!![]})[_0x141f('0x1b')](function(_0x414046){if(_0x414046){return _0x532a21(getChanSpyApplications(_0x459548,_0x414046));}return _0x532a21([]);})['catch'](function(_0x53cbfc){_0x2a9190(_0x53cbfc);});});};module['exports']=function(_0x2d9aae,_0x1faf01){var _0x10c1df=_0x2d9aae[_0x141f('0x1c')];return _0x2d9aae[_0x141f('0x1d')](_0x141f('0x1e'),attributes,{'tableName':_0x141f('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x595925,_0x1bc3a9,_0x292e0d){return getChanSpyPromise(_0x10c1df,_0x595925)[_0x141f('0x1b')](function(_0x51e25c){if(_0x51e25c&&_0x51e25c['length']){return _0x10c1df[_0x141f('0x20')][_0x141f('0x21')](_0x51e25c);}})[_0x141f('0x1b')](function(){_0x292e0d();})[_0x141f('0x22')](function(_0x2df580){_0x292e0d(_0x2df580);});},'afterUpdate':function(_0x58856c,_0x1c1501,_0x22c529){return _0x10c1df[_0x141f('0x20')]['destroy']({'where':{'ChanSpyId':_0x58856c['id']}})[_0x141f('0x1b')](function(){return getChanSpyPromise(_0x10c1df,_0x58856c);})[_0x141f('0x1b')](function(_0x513d6e){if(_0x513d6e&&_0x513d6e['length']){return _0x10c1df[_0x141f('0x20')][_0x141f('0x21')](_0x513d6e);}})[_0x141f('0x1b')](function(){_0x22c529();})[_0x141f('0x22')](function(_0x596ccb){_0x22c529(_0x596ccb);});},'afterDestroy':function(_0x12a190,_0x38ad5b,_0x3c0cd8){return _0x10c1df[_0x141f('0x20')][_0x141f('0x23')]({'where':{'ChanSpyId':_0x12a190['id']}})[_0x141f('0x1b')](function(){_0x3c0cd8();})[_0x141f('0x22')](function(_0x11266c){_0x3c0cd8(_0x11266c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5616107..7a394f3 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x147c7a,_0x455a08){var _0x58fe0d=function(_0x37d2b8){while(--_0x37d2b8){_0x147c7a['push'](_0x147c7a['shift']());}};_0x58fe0d(++_0x455a08);}(_0x702d,0x147));var _0xd702=function(_0x4e9484,_0x1acc3f){_0x4e9484=_0x4e9484-0x0;var _0x5a1533=_0x702d[_0x4e9484];return _0x5a1533;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0x7341=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x16842d,_0x4014ac){var _0x3a3847=function(_0x191f43){while(--_0x191f43){_0x16842d['push'](_0x16842d['shift']());}};_0x3a3847(++_0x4014ac);}(_0x7341,0xe4));var _0x1734=function(_0x53e06e,_0x22ae77){_0x53e06e=_0x53e06e-0x0;var _0x8d64d8=_0x7341[_0x53e06e];return _0x8d64d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d0a2ce8..5f140e4 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 _0x1a55=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','index'];(function(_0x2c7fb4,_0x31f52b){var _0x22ea18=function(_0x5a8457){while(--_0x5a8457){_0x2c7fb4['push'](_0x2c7fb4['shift']());}};_0x22ea18(++_0x31f52b);}(_0x1a55,0x160));var _0x51a5=function(_0x4950ff,_0x1111e6){_0x4950ff=_0x4950ff-0x0;var _0x426b9d=_0x1a55[_0x4950ff];return _0x426b9d;};'use strict';var multer=require('multer');var util=require(_0x51a5('0x0'));var path=require('path');var timeout=require(_0x51a5('0x1'));var express=require('express');var router=express[_0x51a5('0x2')]();var fs_extra=require(_0x51a5('0x3'));var auth=require(_0x51a5('0x4'));var interaction=require(_0x51a5('0x5'));var config=require(_0x51a5('0x6'));var controller=require(_0x51a5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x51a5('0x8')]);router[_0x51a5('0x9')](_0x51a5('0xa'),auth[_0x51a5('0xb')](),controller[_0x51a5('0xc')]);router[_0x51a5('0xd')]('/',auth['isAuthenticated'](),controller[_0x51a5('0xe')]);router[_0x51a5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x51a5('0x10')]);router[_0x51a5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x51a5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7f82=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x136628,_0xdd3206){var _0x35aad7=function(_0x542332){while(--_0x542332){_0x136628['push'](_0x136628['shift']());}};_0x35aad7(++_0xdd3206);}(_0x7f82,0x150));var _0x27f8=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7f82[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x27f8('0x0'));var util=require(_0x27f8('0x1'));var path=require(_0x27f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x27f8('0x3')]();var fs_extra=require(_0x27f8('0x4'));var auth=require(_0x27f8('0x5'));var interaction=require(_0x27f8('0x6'));var config=require(_0x27f8('0x7'));var controller=require('./voiceContext.controller');router[_0x27f8('0x8')]('/',auth['isAuthenticated'](),controller[_0x27f8('0x9')]);router[_0x27f8('0x8')](_0x27f8('0xa'),auth[_0x27f8('0xb')](),controller[_0x27f8('0xc')]);router[_0x27f8('0xd')]('/',auth[_0x27f8('0xb')](),controller[_0x27f8('0xe')]);router[_0x27f8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x27f8('0x10')]);router[_0x27f8('0x11')]('/:id',auth[_0x27f8('0xb')](),controller['destroy']);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 257ddf9..0d84fd7 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 _0x09bf=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4c65f2,_0x50f860){var _0x2c97e2=function(_0x442a24){while(--_0x442a24){_0x4c65f2['push'](_0x4c65f2['shift']());}};_0x2c97e2(++_0x50f860);}(_0x09bf,0x80));var _0xf09b=function(_0x370bbf,_0x3d3175){_0x370bbf=_0x370bbf-0x0;var _0x13ea0b=_0x09bf[_0x370bbf];return _0x13ea0b;};'use strict';var Sequelize=require(_0xf09b('0x0'));module[_0xf09b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xf09b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf09b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8478=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x26e396,_0x235230){var _0xb28815=function(_0x43e0b4){while(--_0x43e0b4){_0x26e396['push'](_0x26e396['shift']());}};_0xb28815(++_0x235230);}(_0x8478,0x1e4));var _0x8847=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8478[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8847('0x0'));module[_0x8847('0x1')]={'name':{'type':Sequelize[_0x8847('0x2')],'unique':_0x8847('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8847('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a897a97..4bf4b6c 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 _0x3bd8=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','stack','name','send','VoiceContext','rawAttributes','fieldName','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3bd8,0xa6));var _0x83bd=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x3bd8[_0x420513];return _0x1b44ec;};'use strict';var emlformat=require(_0x83bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83bd('0x1'));var jsonpatch=require(_0x83bd('0x2'));var rp=require(_0x83bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x83bd('0x4'));var util=require(_0x83bd('0x5'));var path=require(_0x83bd('0x6'));var sox=require(_0x83bd('0x7'));var csv=require('to-csv');var ejs=require(_0x83bd('0x8'));var fs=require('fs');var fs_extra=require(_0x83bd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x83bd('0xa'));var jsforce=require(_0x83bd('0xb'));var deskjs=require(_0x83bd('0xc'));var toCsv=require(_0x83bd('0xd'));var querystring=require('querystring');var Papa=require(_0x83bd('0xe'));var Redis=require(_0x83bd('0xf'));var authService=require(_0x83bd('0x10'));var qs=require(_0x83bd('0x11'));var as=require(_0x83bd('0x12'));var hardwareService=require(_0x83bd('0x13'));var logger=require(_0x83bd('0x14'))('api');var utils=require(_0x83bd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83bd('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x83bd('0x17')][_0x83bd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4472ce,_0x4a92c3,_0x4e2b43,_0x44a30a){return new BPromise(function(_0xc44c2e,_0x3809e7){var _0x52ad83=_0x44a30a||client;return _0x52ad83['request'](_0x4472ce,_0x4e2b43)[_0x83bd('0x19')](function(_0x3fbc44){logger[_0x83bd('0x1a')](_0x83bd('0x1b'),_0x4a92c3,'request\x20sent');logger[_0x83bd('0x1c')](_0x83bd('0x1d'),_0x4a92c3,_0x83bd('0x1e'),JSON[_0x83bd('0x1f')](_0x3fbc44));if(_0x3fbc44[_0x83bd('0x20')]){if(_0x3fbc44[_0x83bd('0x20')]['code']===0x1f4){logger[_0x83bd('0x20')]('VoiceContext,\x20%s,\x20%s',_0x4a92c3,_0x3fbc44['error']['message']);return _0x3809e7(_0x3fbc44[_0x83bd('0x20')][_0x83bd('0x21')]);}logger[_0x83bd('0x20')](_0x83bd('0x1b'),_0x4a92c3,_0x3fbc44[_0x83bd('0x20')][_0x83bd('0x21')]);return _0xc44c2e(_0x3fbc44[_0x83bd('0x20')][_0x83bd('0x21')]);}else{logger[_0x83bd('0x1a')](_0x83bd('0x1b'),_0x4a92c3,'request\x20sent');_0xc44c2e(_0x3fbc44['result']['message']);}})[_0x83bd('0x22')](function(_0x5155f9){logger[_0x83bd('0x20')](_0x83bd('0x1b'),_0x4a92c3,_0x5155f9);_0x3809e7(_0x5155f9);});});}function respondWithStatusCode(_0x4a47f8,_0x3ef358){_0x3ef358=_0x3ef358||0xcc;return function(_0x17f53f){if(_0x17f53f){return _0x4a47f8[_0x83bd('0x23')](_0x3ef358);}return _0x4a47f8[_0x83bd('0x24')](_0x3ef358)[_0x83bd('0x25')]();};}function respondWithResult(_0x4dc74b,_0x2ff936){_0x2ff936=_0x2ff936||0xc8;return function(_0x439b58){if(_0x439b58){return _0x4dc74b[_0x83bd('0x24')](_0x2ff936)[_0x83bd('0x26')](_0x439b58);}};}function respondWithFilteredResult(_0x5b47c8,_0x41ec58){return function(_0x1f0182){if(_0x1f0182){var _0x401a3c=typeof _0x41ec58[_0x83bd('0x27')]===_0x83bd('0x28')&&typeof _0x41ec58[_0x83bd('0x29')]==='undefined';var _0x577852=_0x1f0182[_0x83bd('0x2a')];var _0xc1e2c8=_0x401a3c?0x0:_0x41ec58[_0x83bd('0x27')];var _0x4c8044=_0x401a3c?_0x1f0182['count']:_0x41ec58[_0x83bd('0x27')]+_0x41ec58[_0x83bd('0x29')];var _0x43c767;if(_0x4c8044>=_0x577852){_0x4c8044=_0x577852;_0x43c767=0xc8;}else{_0x43c767=0xce;}_0x5b47c8[_0x83bd('0x24')](_0x43c767);return _0x5b47c8[_0x83bd('0x2b')](_0x83bd('0x2c'),_0xc1e2c8+'-'+_0x4c8044+'/'+_0x577852)['json'](_0x1f0182);}return null;};}function patchUpdates(_0xeef9d3){return function(_0x2f32ed){try{jsonpatch[_0x83bd('0x2d')](_0x2f32ed,_0xeef9d3,!![]);}catch(_0x1b9177){return BPromise[_0x83bd('0x2e')](_0x1b9177);}return _0x2f32ed[_0x83bd('0x2f')]();};}function saveUpdates(_0x18221b,_0x3dc5eb){return function(_0x561334){if(_0x561334){return _0x561334[_0x83bd('0x30')](_0x18221b)['then'](function(_0xb8e3eb){return _0xb8e3eb;});}return null;};}function removeEntity(_0x217135,_0x13b12){return function(_0x3d4ba6){if(_0x3d4ba6){return _0x3d4ba6[_0x83bd('0x31')]()[_0x83bd('0x19')](function(){var _0x3ef3e3=_0x3d4ba6[_0x83bd('0x32')]({'plain':!![]});var _0x3511c6=_0x83bd('0x33');return db['UserProfileResource'][_0x83bd('0x31')]({'where':{'type':_0x3511c6,'resourceId':_0x3ef3e3['id']}})['then'](function(){return _0x3d4ba6;});})[_0x83bd('0x19')](function(){_0x217135[_0x83bd('0x24')](0xcc)[_0x83bd('0x25')]();});}};}function handleEntityNotFound(_0x494496,_0x2303c2){return function(_0x37c416){if(!_0x37c416){_0x494496['sendStatus'](0x194);}return _0x37c416;};}function handleError(_0x375fc4,_0x28b92a){_0x28b92a=_0x28b92a||0x1f4;return function(_0x417a83){logger[_0x83bd('0x20')](_0x417a83[_0x83bd('0x34')]);if(_0x417a83[_0x83bd('0x35')]){delete _0x417a83['name'];}_0x375fc4['status'](_0x28b92a)[_0x83bd('0x36')](_0x417a83);};}exports['index']=function(_0x27785,_0x46e69d){var _0x4a2eee={},_0x2c8090={},_0x24c80a={'count':0x0,'rows':[]};var _0x494d42=_['map'](db[_0x83bd('0x37')][_0x83bd('0x38')],function(_0x4d92d8){return{'name':_0x4d92d8[_0x83bd('0x39')],'type':_0x4d92d8['type']['key']};});_0x2c8090['model']=_[_0x83bd('0x3a')](_0x494d42,_0x83bd('0x35'));_0x2c8090[_0x83bd('0x3b')]=_[_0x83bd('0x3c')](_0x27785[_0x83bd('0x3b')]);_0x2c8090['filters']=_['intersection'](_0x2c8090[_0x83bd('0x3d')],_0x2c8090['query']);_0x4a2eee[_0x83bd('0x3e')]=_['intersection'](_0x2c8090[_0x83bd('0x3d')],qs[_0x83bd('0x3f')](_0x27785['query']['fields']));_0x4a2eee[_0x83bd('0x3e')]=_0x4a2eee[_0x83bd('0x3e')][_0x83bd('0x40')]?_0x4a2eee[_0x83bd('0x3e')]:_0x2c8090[_0x83bd('0x3d')];if(!_0x27785[_0x83bd('0x3b')][_0x83bd('0x41')](_0x83bd('0x42'))){_0x4a2eee[_0x83bd('0x29')]=qs[_0x83bd('0x29')](_0x27785[_0x83bd('0x3b')]['limit']);_0x4a2eee[_0x83bd('0x27')]=qs[_0x83bd('0x27')](_0x27785['query'][_0x83bd('0x27')]);}_0x4a2eee[_0x83bd('0x43')]=qs[_0x83bd('0x44')](_0x27785[_0x83bd('0x3b')][_0x83bd('0x44')]);_0x4a2eee[_0x83bd('0x45')]=qs[_0x83bd('0x46')](_[_0x83bd('0x47')](_0x27785['query'],_0x2c8090[_0x83bd('0x46')]),_0x494d42);if(_0x27785[_0x83bd('0x3b')][_0x83bd('0x48')]){_0x4a2eee[_0x83bd('0x45')]=_[_0x83bd('0x49')](_0x4a2eee[_0x83bd('0x45')],{'$or':_[_0x83bd('0x3a')](_0x494d42,function(_0x5b1538){if(_0x5b1538['type']!==_0x83bd('0x4a')){var _0x5e73f7={};_0x5e73f7[_0x5b1538[_0x83bd('0x35')]]={'$like':'%'+_0x27785[_0x83bd('0x3b')][_0x83bd('0x48')]+'%'};return _0x5e73f7;}})});}_0x4a2eee=_[_0x83bd('0x49')]({},_0x4a2eee,_0x27785[_0x83bd('0x4b')]);var _0x1a74aa={'where':_0x4a2eee[_0x83bd('0x45')]};return db[_0x83bd('0x37')][_0x83bd('0x2a')](_0x1a74aa)[_0x83bd('0x19')](function(_0x26be26){_0x24c80a[_0x83bd('0x2a')]=_0x26be26;if(_0x27785[_0x83bd('0x3b')][_0x83bd('0x4c')]){_0x4a2eee[_0x83bd('0x4d')]=[{'all':!![]}];}return db[_0x83bd('0x37')][_0x83bd('0x4e')](_0x4a2eee);})[_0x83bd('0x19')](function(_0x25a73c){_0x24c80a[_0x83bd('0x4f')]=_0x25a73c;return _0x24c80a;})['then'](respondWithFilteredResult(_0x46e69d,_0x4a2eee))[_0x83bd('0x22')](handleError(_0x46e69d,null));};exports[_0x83bd('0x50')]=function(_0x282880,_0x585e6d){var _0x4bc40f={'raw':![],'where':{'id':_0x282880['params']['id']}},_0x3962ab={};_0x3962ab[_0x83bd('0x3d')]=_['keys'](db[_0x83bd('0x37')][_0x83bd('0x38')]);_0x3962ab[_0x83bd('0x3b')]=_['keys'](_0x282880[_0x83bd('0x3b')]);_0x3962ab['filters']=_[_0x83bd('0x51')](_0x3962ab['model'],_0x3962ab['query']);_0x4bc40f[_0x83bd('0x3e')]=_[_0x83bd('0x51')](_0x3962ab[_0x83bd('0x3d')],qs['fields'](_0x282880['query'][_0x83bd('0x3f')]));_0x4bc40f[_0x83bd('0x3e')]=_0x4bc40f[_0x83bd('0x3e')][_0x83bd('0x40')]?_0x4bc40f[_0x83bd('0x3e')]:_0x3962ab[_0x83bd('0x3d')];if(_0x282880['query']['includeAll']){_0x4bc40f[_0x83bd('0x4d')]=[{'all':!![]}];}_0x4bc40f=_['merge']({},_0x4bc40f,_0x282880[_0x83bd('0x4b')]);return db[_0x83bd('0x37')][_0x83bd('0x52')](_0x4bc40f)[_0x83bd('0x19')](handleEntityNotFound(_0x585e6d,null))['then'](respondWithResult(_0x585e6d,null))[_0x83bd('0x22')](handleError(_0x585e6d,null));};exports[_0x83bd('0x53')]=function(_0x5f1fbb,_0xa79a7a,_0x59cd2b){var _0x31cc68;return db[_0x83bd('0x37')]['create'](_0x5f1fbb[_0x83bd('0x54')],{'raw':!![]})[_0x83bd('0x19')](function(_0x361222){_0x31cc68=_0x361222;return db['VoiceContext'][_0x83bd('0x4e')]({'raw':!![]});})[_0x83bd('0x19')](function(_0x545684){var _0x250f1d=fs[_0x83bd('0x55')](path['join'](config[_0x83bd('0x56')],_0x83bd('0x57')),_0x83bd('0x58'));var _0x598d09=ejs[_0x83bd('0x59')](_0x250f1d,{'contexts':_0x545684||[]});fs[_0x83bd('0x5a')](_0x83bd('0x5b'),_0x598d09);})['then'](function(){return respondWithRpcPromise(_0x83bd('0x5c'),'create',{'module':'chan_sip.so'});})[_0x83bd('0x19')](function(){var _0xb76b0d=_0x5f1fbb[_0x83bd('0x5d')]['get']({'plain':!![]});if(!_0xb76b0d)throw new Error(_0x83bd('0x5e'));if(_0xb76b0d[_0x83bd('0x5f')]==='user'){var _0xcf07dc=_0x31cc68['get']({'plain':!![]});return db[_0x83bd('0x60')][_0x83bd('0x52')]({'where':{'name':_0x83bd('0x33'),'userProfileId':_0xb76b0d[_0x83bd('0x61')]},'raw':!![]})[_0x83bd('0x19')](function(_0x1d8a91){if(_0x1d8a91&&_0x1d8a91['autoAssociation']===0x0){return db['UserProfileResource'][_0x83bd('0x53')]({'name':_0xcf07dc['name'],'resourceId':_0xcf07dc['id'],'type':_0x1d8a91['name'],'sectionId':_0x1d8a91['id']},{})['then'](function(){return _0x31cc68;});}else{return _0x31cc68;}})[_0x83bd('0x22')](function(_0xdadb4b){logger[_0x83bd('0x20')](_0x83bd('0x62'),_0xdadb4b);throw _0xdadb4b;});}return _0x31cc68;})['then'](respondWithResult(_0xa79a7a,0xc9))['catch'](handleError(_0xa79a7a,null));};exports[_0x83bd('0x30')]=function(_0x21ae5d,_0x3d76d8,_0x410e31){var _0x46f77f;return db['VoiceContext'][_0x83bd('0x52')]({'where':{'id':_0x21ae5d[_0x83bd('0x63')]['id']}})['then'](handleEntityNotFound(_0x3d76d8,null))[_0x83bd('0x19')](saveUpdates(_0x21ae5d[_0x83bd('0x54')],null))[_0x83bd('0x19')](function(_0x51b1f7){if(_0x51b1f7){_0x46f77f=_0x51b1f7;return db[_0x83bd('0x37')]['findAll']({'raw':!![]});}})['then'](function(_0x29369d){var _0x1a4323=fs[_0x83bd('0x55')](path[_0x83bd('0x64')](config[_0x83bd('0x56')],_0x83bd('0x57')),_0x83bd('0x58'));var _0x36cfc3=ejs['render'](_0x1a4323,{'contexts':_0x29369d||[]});fs[_0x83bd('0x5a')](_0x83bd('0x5b'),_0x36cfc3);})[_0x83bd('0x19')](function(){return respondWithRpcPromise(_0x83bd('0x5c'),_0x83bd('0x30'),{'module':_0x83bd('0x65')});})[_0x83bd('0x19')](function(){return _0x46f77f;})['then'](respondWithResult(_0x3d76d8,null))['catch'](handleError(_0x3d76d8,null));};exports[_0x83bd('0x31')]=function(_0x3ee993,_0x561f77,_0x4ee9d4){var _0x516943;return db['VoiceContext'][_0x83bd('0x52')]({'where':{'id':_0x3ee993[_0x83bd('0x63')]['id']}})[_0x83bd('0x19')](handleEntityNotFound(_0x561f77,null))['then'](removeEntity(_0x561f77,null))[_0x83bd('0x19')](function(){return db['VoiceContext'][_0x83bd('0x4e')]({'raw':!![]});})[_0x83bd('0x19')](function(_0x282800){var _0x2d5d8f=fs[_0x83bd('0x55')](path[_0x83bd('0x64')](config[_0x83bd('0x56')],_0x83bd('0x57')),_0x83bd('0x58'));var _0x17c8c8=ejs[_0x83bd('0x59')](_0x2d5d8f,{'contexts':_0x282800});fs[_0x83bd('0x5a')](_0x83bd('0x5b'),_0x17c8c8);return respondWithRpcPromise(_0x83bd('0x5c'),_0x83bd('0x31'),{'module':_0x83bd('0x65')});})[_0x83bd('0x22')](handleError(_0x561f77,null));}; \ No newline at end of file +var _0x5859=['squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','Contexts','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','options','create','body','join','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/context.ejs','utf8','render','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x488ec2,_0x22fcce){var _0x2519cd=function(_0x547a5c){while(--_0x547a5c){_0x488ec2['push'](_0x488ec2['shift']());}};_0x2519cd(++_0x22fcce);}(_0x5859,0xc4));var _0x9585=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x5859[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x9585('0x0'));var rimraf=require(_0x9585('0x1'));var zipdir=require(_0x9585('0x2'));var jsonpatch=require(_0x9585('0x3'));var rp=require(_0x9585('0x4'));var moment=require(_0x9585('0x5'));var BPromise=require(_0x9585('0x6'));var Mustache=require(_0x9585('0x7'));var util=require(_0x9585('0x8'));var path=require(_0x9585('0x9'));var sox=require(_0x9585('0xa'));var csv=require(_0x9585('0xb'));var ejs=require(_0x9585('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9585('0xd'));var squel=require(_0x9585('0xe'));var crypto=require(_0x9585('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9585('0x10'));var toCsv=require(_0x9585('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9585('0x11'));var authService=require(_0x9585('0x12'));var qs=require(_0x9585('0x13'));var as=require(_0x9585('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9585('0x15'))('api');var utils=require(_0x9585('0x16'));var config=require(_0x9585('0x17'));var licenseUtil=require(_0x9585('0x18'));var db=require(_0x9585('0x19'))['db'];var jayson=require(_0x9585('0x1a'));var client=jayson[_0x9585('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d31d1,_0x895b4d,_0x3dc44d,_0x5acfea){return new BPromise(function(_0x2b8d67,_0x278156){var _0x356835=_0x5acfea||client;return _0x356835['request'](_0x7d31d1,_0x3dc44d)[_0x9585('0x1c')](function(_0x44316b){logger['info'](_0x9585('0x1d'),_0x895b4d,'request\x20sent');logger[_0x9585('0x1e')](_0x9585('0x1f'),_0x895b4d,_0x9585('0x20'),JSON['stringify'](_0x44316b));if(_0x44316b[_0x9585('0x21')]){if(_0x44316b[_0x9585('0x21')]['code']===0x1f4){logger[_0x9585('0x21')]('VoiceContext,\x20%s,\x20%s',_0x895b4d,_0x44316b[_0x9585('0x21')]['message']);return _0x278156(_0x44316b[_0x9585('0x21')][_0x9585('0x22')]);}logger[_0x9585('0x21')](_0x9585('0x1d'),_0x895b4d,_0x44316b[_0x9585('0x21')][_0x9585('0x22')]);return _0x2b8d67(_0x44316b['error'][_0x9585('0x22')]);}else{logger[_0x9585('0x23')](_0x9585('0x1d'),_0x895b4d,_0x9585('0x20'));_0x2b8d67(_0x44316b[_0x9585('0x24')][_0x9585('0x22')]);}})['catch'](function(_0x36c868){logger[_0x9585('0x21')](_0x9585('0x1d'),_0x895b4d,_0x36c868);_0x278156(_0x36c868);});});}function respondWithStatusCode(_0x27ef5f,_0x135c71){_0x135c71=_0x135c71||0xcc;return function(_0x347e8d){if(_0x347e8d){return _0x27ef5f[_0x9585('0x25')](_0x135c71);}return _0x27ef5f[_0x9585('0x26')](_0x135c71)[_0x9585('0x27')]();};}function respondWithResult(_0x3afe59,_0xf735dd){_0xf735dd=_0xf735dd||0xc8;return function(_0x265631){if(_0x265631){return _0x3afe59['status'](_0xf735dd)[_0x9585('0x28')](_0x265631);}};}function respondWithFilteredResult(_0xa95ce6,_0x1f5217){return function(_0x1104df){if(_0x1104df){var _0x465c91=typeof _0x1f5217['offset']===_0x9585('0x29')&&typeof _0x1f5217[_0x9585('0x2a')]===_0x9585('0x29');var _0x5ac6c5=_0x1104df[_0x9585('0x2b')];var _0x33dbe7=_0x465c91?0x0:_0x1f5217['offset'];var _0x4d303e=_0x465c91?_0x1104df[_0x9585('0x2b')]:_0x1f5217['offset']+_0x1f5217[_0x9585('0x2a')];var _0x402905;if(_0x4d303e>=_0x5ac6c5){_0x4d303e=_0x5ac6c5;_0x402905=0xc8;}else{_0x402905=0xce;}_0xa95ce6[_0x9585('0x26')](_0x402905);return _0xa95ce6[_0x9585('0x2c')](_0x9585('0x2d'),_0x33dbe7+'-'+_0x4d303e+'/'+_0x5ac6c5)[_0x9585('0x28')](_0x1104df);}return null;};}function patchUpdates(_0x48e59f){return function(_0x29b35e){try{jsonpatch[_0x9585('0x2e')](_0x29b35e,_0x48e59f,!![]);}catch(_0x1b3b0c){return BPromise[_0x9585('0x2f')](_0x1b3b0c);}return _0x29b35e[_0x9585('0x30')]();};}function saveUpdates(_0x32cd9f,_0x736a66){return function(_0x802471){if(_0x802471){return _0x802471[_0x9585('0x31')](_0x32cd9f)['then'](function(_0x28efc9){return _0x28efc9;});}return null;};}function removeEntity(_0x3aab75,_0x424071){return function(_0x406d8b){if(_0x406d8b){return _0x406d8b['destroy']()[_0x9585('0x1c')](function(){var _0x176951=_0x406d8b['get']({'plain':!![]});var _0x3c7c56=_0x9585('0x32');return db[_0x9585('0x33')][_0x9585('0x34')]({'where':{'type':_0x3c7c56,'resourceId':_0x176951['id']}})['then'](function(){return _0x406d8b;});})[_0x9585('0x1c')](function(){_0x3aab75[_0x9585('0x26')](0xcc)[_0x9585('0x27')]();});}};}function handleEntityNotFound(_0x546a6c,_0x25f7f5){return function(_0x2b7b69){if(!_0x2b7b69){_0x546a6c['sendStatus'](0x194);}return _0x2b7b69;};}function handleError(_0x249d63,_0x2c093a){_0x2c093a=_0x2c093a||0x1f4;return function(_0x3be2fd){logger[_0x9585('0x21')](_0x3be2fd[_0x9585('0x35')]);if(_0x3be2fd[_0x9585('0x36')]){delete _0x3be2fd[_0x9585('0x36')];}_0x249d63[_0x9585('0x26')](_0x2c093a)[_0x9585('0x37')](_0x3be2fd);};}exports[_0x9585('0x38')]=function(_0x42046e,_0x34d274){var _0x5a90c9={},_0x16cabe={},_0x276f0b={'count':0x0,'rows':[]};var _0x428950=_[_0x9585('0x39')](db[_0x9585('0x3a')][_0x9585('0x3b')],function(_0x9a3c3e){return{'name':_0x9a3c3e['fieldName'],'type':_0x9a3c3e[_0x9585('0x3c')][_0x9585('0x3d')]};});_0x16cabe[_0x9585('0x3e')]=_[_0x9585('0x39')](_0x428950,_0x9585('0x36'));_0x16cabe[_0x9585('0x3f')]=_[_0x9585('0x40')](_0x42046e[_0x9585('0x3f')]);_0x16cabe['filters']=_[_0x9585('0x41')](_0x16cabe[_0x9585('0x3e')],_0x16cabe[_0x9585('0x3f')]);_0x5a90c9['attributes']=_[_0x9585('0x41')](_0x16cabe[_0x9585('0x3e')],qs['fields'](_0x42046e[_0x9585('0x3f')]['fields']));_0x5a90c9['attributes']=_0x5a90c9[_0x9585('0x42')]['length']?_0x5a90c9[_0x9585('0x42')]:_0x16cabe[_0x9585('0x3e')];if(!_0x42046e[_0x9585('0x3f')][_0x9585('0x43')](_0x9585('0x44'))){_0x5a90c9[_0x9585('0x2a')]=qs[_0x9585('0x2a')](_0x42046e['query']['limit']);_0x5a90c9[_0x9585('0x45')]=qs[_0x9585('0x45')](_0x42046e['query'][_0x9585('0x45')]);}_0x5a90c9[_0x9585('0x46')]=qs[_0x9585('0x47')](_0x42046e[_0x9585('0x3f')][_0x9585('0x47')]);_0x5a90c9[_0x9585('0x48')]=qs['filters'](_[_0x9585('0x49')](_0x42046e[_0x9585('0x3f')],_0x16cabe['filters']),_0x428950);if(_0x42046e[_0x9585('0x3f')][_0x9585('0x4a')]){_0x5a90c9[_0x9585('0x48')]=_[_0x9585('0x4b')](_0x5a90c9['where'],{'$or':_[_0x9585('0x39')](_0x428950,function(_0xbb138){if(_0xbb138[_0x9585('0x3c')]!==_0x9585('0x4c')){var _0x3dbc2a={};_0x3dbc2a[_0xbb138[_0x9585('0x36')]]={'$like':'%'+_0x42046e[_0x9585('0x3f')][_0x9585('0x4a')]+'%'};return _0x3dbc2a;}})});}_0x5a90c9=_[_0x9585('0x4b')]({},_0x5a90c9,_0x42046e['options']);var _0x3f26fd={'where':_0x5a90c9['where']};return db[_0x9585('0x3a')][_0x9585('0x2b')](_0x3f26fd)[_0x9585('0x1c')](function(_0x6485b2){_0x276f0b['count']=_0x6485b2;if(_0x42046e['query'][_0x9585('0x4d')]){_0x5a90c9[_0x9585('0x4e')]=[{'all':!![]}];}return db[_0x9585('0x3a')][_0x9585('0x4f')](_0x5a90c9);})[_0x9585('0x1c')](function(_0x21271b){_0x276f0b[_0x9585('0x50')]=_0x21271b;return _0x276f0b;})[_0x9585('0x1c')](respondWithFilteredResult(_0x34d274,_0x5a90c9))[_0x9585('0x51')](handleError(_0x34d274,null));};exports[_0x9585('0x52')]=function(_0x5ec0ca,_0x528882){var _0x4c614b={'raw':![],'where':{'id':_0x5ec0ca[_0x9585('0x53')]['id']}},_0x46272f={};_0x46272f['model']=_[_0x9585('0x40')](db[_0x9585('0x3a')][_0x9585('0x3b')]);_0x46272f[_0x9585('0x3f')]=_[_0x9585('0x40')](_0x5ec0ca[_0x9585('0x3f')]);_0x46272f['filters']=_[_0x9585('0x41')](_0x46272f['model'],_0x46272f[_0x9585('0x3f')]);_0x4c614b[_0x9585('0x42')]=_['intersection'](_0x46272f[_0x9585('0x3e')],qs[_0x9585('0x54')](_0x5ec0ca[_0x9585('0x3f')]['fields']));_0x4c614b[_0x9585('0x42')]=_0x4c614b[_0x9585('0x42')][_0x9585('0x55')]?_0x4c614b['attributes']:_0x46272f[_0x9585('0x3e')];if(_0x5ec0ca['query'][_0x9585('0x4d')]){_0x4c614b['include']=[{'all':!![]}];}_0x4c614b=_[_0x9585('0x4b')]({},_0x4c614b,_0x5ec0ca[_0x9585('0x56')]);return db[_0x9585('0x3a')]['find'](_0x4c614b)[_0x9585('0x1c')](handleEntityNotFound(_0x528882,null))[_0x9585('0x1c')](respondWithResult(_0x528882,null))['catch'](handleError(_0x528882,null));};exports[_0x9585('0x57')]=function(_0x40042a,_0x3e5f54,_0x5d2d62){var _0x336541;return db['VoiceContext'][_0x9585('0x57')](_0x40042a[_0x9585('0x58')],{'raw':!![]})['then'](function(_0x3679df){_0x336541=_0x3679df;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x9585('0x1c')](function(_0x317c39){var _0x9de665=fs['readFileSync'](path[_0x9585('0x59')](config[_0x9585('0x5a')],'server/files/templates/context.ejs'),'utf8');var _0x40eb82=ejs['render'](_0x9de665,{'contexts':_0x317c39||[]});fs[_0x9585('0x5b')](_0x9585('0x5c'),_0x40eb82);})['then'](function(){return respondWithRpcPromise('Reload',_0x9585('0x57'),{'module':_0x9585('0x5d')});})['then'](function(){var _0x46548f=_0x40042a['user'][_0x9585('0x5e')]({'plain':!![]});if(!_0x46548f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46548f[_0x9585('0x5f')]==='user'){var _0x510175=_0x336541[_0x9585('0x5e')]({'plain':!![]});return db[_0x9585('0x60')][_0x9585('0x61')]({'where':{'name':'Contexts','userProfileId':_0x46548f['userProfileId']},'raw':!![]})[_0x9585('0x1c')](function(_0x2a2375){if(_0x2a2375&&_0x2a2375[_0x9585('0x62')]===0x0){return db['UserProfileResource'][_0x9585('0x57')]({'name':_0x510175[_0x9585('0x36')],'resourceId':_0x510175['id'],'type':_0x2a2375[_0x9585('0x36')],'sectionId':_0x2a2375['id']},{})[_0x9585('0x1c')](function(){return _0x336541;});}else{return _0x336541;}})[_0x9585('0x51')](function(_0x3feb13){logger[_0x9585('0x21')](_0x9585('0x63'),_0x3feb13);throw _0x3feb13;});}return _0x336541;})[_0x9585('0x1c')](respondWithResult(_0x3e5f54,0xc9))[_0x9585('0x51')](handleError(_0x3e5f54,null));};exports[_0x9585('0x31')]=function(_0x5500ab,_0xc4e78,_0x53b155){var _0x19ce15;return db[_0x9585('0x3a')]['find']({'where':{'id':_0x5500ab[_0x9585('0x53')]['id']}})[_0x9585('0x1c')](handleEntityNotFound(_0xc4e78,null))['then'](saveUpdates(_0x5500ab['body'],null))[_0x9585('0x1c')](function(_0x39a6de){if(_0x39a6de){_0x19ce15=_0x39a6de;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bd651){var _0x411892=fs[_0x9585('0x64')](path[_0x9585('0x59')](config[_0x9585('0x5a')],_0x9585('0x65')),_0x9585('0x66'));var _0x1abb5c=ejs[_0x9585('0x67')](_0x411892,{'contexts':_0x1bd651||[]});fs[_0x9585('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1abb5c);})[_0x9585('0x1c')](function(){return respondWithRpcPromise(_0x9585('0x68'),'update',{'module':_0x9585('0x5d')});})[_0x9585('0x1c')](function(){return _0x19ce15;})[_0x9585('0x1c')](respondWithResult(_0xc4e78,null))[_0x9585('0x51')](handleError(_0xc4e78,null));};exports[_0x9585('0x34')]=function(_0x33bd4f,_0x50140b,_0x53ced2){var _0x1b9e49;return db[_0x9585('0x3a')][_0x9585('0x61')]({'where':{'id':_0x33bd4f['params']['id']}})[_0x9585('0x1c')](handleEntityNotFound(_0x50140b,null))[_0x9585('0x1c')](removeEntity(_0x50140b,null))[_0x9585('0x1c')](function(){return db[_0x9585('0x3a')][_0x9585('0x4f')]({'raw':!![]});})[_0x9585('0x1c')](function(_0x4f1e4a){var _0x2723f8=fs[_0x9585('0x64')](path[_0x9585('0x59')](config[_0x9585('0x5a')],'server/files/templates/context.ejs'),'utf8');var _0x209787=ejs[_0x9585('0x67')](_0x2723f8,{'contexts':_0x4f1e4a});fs['writeFileSync'](_0x9585('0x5c'),_0x209787);return respondWithRpcPromise(_0x9585('0x68'),_0x9585('0x34'),{'module':_0x9585('0x5d')});})[_0x9585('0x51')](handleError(_0x50140b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 83a1170..7a8de1e 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 _0xd20c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','voice_contexts','lodash','util','api'];(function(_0x3b371a,_0x1f4dec){var _0x421339=function(_0x5800d2){while(--_0x5800d2){_0x3b371a['push'](_0x3b371a['shift']());}};_0x421339(++_0x1f4dec);}(_0xd20c,0x97));var _0xcd20=function(_0x277bd8,_0x4bd5bc){_0x277bd8=_0x277bd8-0x0;var _0x3bc497=_0xd20c[_0x277bd8];return _0x3bc497;};'use strict';var _=require(_0xcd20('0x0'));var util=require(_0xcd20('0x1'));var logger=require('../../config/logger')(_0xcd20('0x2'));var moment=require(_0xcd20('0x3'));var BPromise=require(_0xcd20('0x4'));var rp=require(_0xcd20('0x5'));var fs=require('fs');var path=require(_0xcd20('0x6'));var rimraf=require(_0xcd20('0x7'));var config=require(_0xcd20('0x8'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x2eb463,_0x22a0c1){return _0x2eb463[_0xcd20('0x9')]('VoiceContext',attributes,{'tableName':_0xcd20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5990=['util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x3cdf0f,_0x32c761){var _0x173c21=function(_0xba83db){while(--_0xba83db){_0x3cdf0f['push'](_0x3cdf0f['shift']());}};_0x173c21(++_0x32c761);}(_0x5990,0x1a1));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0599('0x0'));var util=require(_0x0599('0x1'));var logger=require(_0x0599('0x2'))(_0x0599('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0599('0x4'));var rimraf=require(_0x0599('0x5'));var config=require(_0x0599('0x6'));var attributes=require('./voiceContext.attributes');module[_0x0599('0x7')]=function(_0x459008,_0x3decd8){return _0x459008[_0x0599('0x8')](_0x0599('0x9'),attributes,{'tableName':_0x0599('0xa'),'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 c6daab8..427bf58 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 _0xa509=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xa509,0x12f));var _0x9a50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa509[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9a50('0x0'));var util=require(_0x9a50('0x1'));var moment=require(_0x9a50('0x2'));var BPromise=require(_0x9a50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a50('0x5'));var logger=require(_0x9a50('0x6'))(_0x9a50('0x7'));var config=require(_0x9a50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a50('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6789,_0x4f28b0,_0x5cf0b9){return new BPromise(function(_0x5e83e8,_0x55ec13){return client[_0x9a50('0xa')](_0x3f6789,_0x5cf0b9)[_0x9a50('0xb')](function(_0x169179){logger[_0x9a50('0xc')](_0x9a50('0xd'),_0x4f28b0,_0x9a50('0xe'));logger[_0x9a50('0xf')](_0x9a50('0x10'),_0x4f28b0,_0x9a50('0xe'),JSON[_0x9a50('0x11')](_0x169179));if(_0x169179[_0x9a50('0x12')]){if(_0x169179[_0x9a50('0x12')][_0x9a50('0x13')]===0x1f4){logger[_0x9a50('0x12')](_0x9a50('0xd'),_0x4f28b0,_0x169179[_0x9a50('0x12')][_0x9a50('0x14')]);return _0x55ec13(_0x169179['error']['message']);}logger[_0x9a50('0x12')](_0x9a50('0xd'),_0x4f28b0,_0x169179[_0x9a50('0x12')]['message']);return _0x5e83e8(_0x169179[_0x9a50('0x12')]['message']);}else{logger[_0x9a50('0xc')](_0x9a50('0xd'),_0x4f28b0,'request\x20sent');_0x5e83e8(_0x169179[_0x9a50('0x15')]['message']);}})[_0x9a50('0x16')](function(_0x9c0cc7){logger['error'](_0x9a50('0xd'),_0x4f28b0,_0x9c0cc7);_0x55ec13(_0x9c0cc7);});});} \ No newline at end of file +var _0xb9a7=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceContext,\x20%s,\x20%s'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb9a7[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VoiceContext,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VoiceContext,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6ff1895..eca94f1 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 _0x4860=['./voiceDialReport.controller','get','index','isAuthenticated','describe','show','post','put','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xa44f,_0x246aa2){var _0x46f93b=function(_0xccbe2a){while(--_0xccbe2a){_0xa44f['push'](_0xa44f['shift']());}};_0x46f93b(++_0x246aa2);}(_0x4860,0x197));var _0x0486=function(_0x26c3e9,_0x22f120){_0x26c3e9=_0x26c3e9-0x0;var _0x318365=_0x4860[_0x26c3e9];return _0x318365;};'use strict';var multer=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var path=require(_0x0486('0x2'));var timeout=require('connect-timeout');var express=require(_0x0486('0x3'));var router=express['Router']();var fs_extra=require(_0x0486('0x4'));var auth=require(_0x0486('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0486('0x6'));var controller=require(_0x0486('0x7'));router[_0x0486('0x8')]('/',auth['isAuthenticated'](),controller[_0x0486('0x9')]);router[_0x0486('0x8')]('/describe',auth[_0x0486('0xa')](),controller[_0x0486('0xb')]);router[_0x0486('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0486('0xc')]);router[_0x0486('0xd')]('/',auth[_0x0486('0xa')](),controller['create']);router[_0x0486('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0486('0xf'),auth[_0x0486('0xa')](),controller[_0x0486('0x10')]);module[_0x0486('0x11')]=router; \ No newline at end of file +var _0xc196=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xc196,0x1bc));var _0x6c19=function(_0x20ec2e,_0x1a6f1e){_0x20ec2e=_0x20ec2e-0x0;var _0x155d73=_0xc196[_0x20ec2e];return _0x155d73;};'use strict';var multer=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var path=require(_0x6c19('0x2'));var timeout=require(_0x6c19('0x3'));var express=require(_0x6c19('0x4'));var router=express[_0x6c19('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c19('0x6'));var config=require(_0x6c19('0x7'));var controller=require(_0x6c19('0x8'));router[_0x6c19('0x9')]('/',auth[_0x6c19('0xa')](),controller['index']);router[_0x6c19('0x9')](_0x6c19('0xb'),auth[_0x6c19('0xa')](),controller['describe']);router[_0x6c19('0x9')](_0x6c19('0xc'),auth['isAuthenticated'](),controller[_0x6c19('0xd')]);router[_0x6c19('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c19('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6c19('0xc'),auth[_0x6c19('0xa')](),controller[_0x6c19('0x10')]);module[_0x6c19('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index fed9c61..bedc350 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3e74,0x175));var _0x43e7=function(_0x5348d9,_0x359769){_0x5348d9=_0x5348d9-0x0;var _0x456f7a=_0x3e74[_0x5348d9];return _0x456f7a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x944d2e,_0x186caf){var _0x3e29ff=function(_0x1a4eeb){while(--_0x1a4eeb){_0x944d2e['push'](_0x944d2e['shift']());}};_0x3e29ff(++_0x186caf);}(_0x425d,0x1e0));var _0xd425=function(_0x7d0f83,_0x43b7e3){_0x7d0f83=_0x7d0f83-0x0;var _0x7e1b2e=_0x425d[_0x7d0f83];return _0x7e1b2e;};'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 diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 400f00e..0181fbd 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 _0xbec9=['keys','length','include','find','catch','create','body','update','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','stack','name','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','show'];(function(_0x31a156,_0x51af0e){var _0x1d73d1=function(_0x1db470){while(--_0x1db470){_0x31a156['push'](_0x31a156['shift']());}};_0x1d73d1(++_0x51af0e);}(_0xbec9,0x99));var _0x9bec=function(_0x3cdc6f,_0x482f37){_0x3cdc6f=_0x3cdc6f-0x0;var _0x3c42f6=_0xbec9[_0x3cdc6f];return _0x3c42f6;};'use strict';var emlformat=require(_0x9bec('0x0'));var rimraf=require(_0x9bec('0x1'));var zipdir=require(_0x9bec('0x2'));var jsonpatch=require(_0x9bec('0x3'));var rp=require(_0x9bec('0x4'));var moment=require('moment');var BPromise=require(_0x9bec('0x5'));var Mustache=require(_0x9bec('0x6'));var util=require(_0x9bec('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9bec('0x8'));var ejs=require(_0x9bec('0x9'));var fs=require('fs');var fs_extra=require(_0x9bec('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9bec('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9bec('0xc'));var toCsv=require(_0x9bec('0x8'));var querystring=require(_0x9bec('0xd'));var Papa=require(_0x9bec('0xe'));var Redis=require(_0x9bec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9bec('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bec('0x11'));var logger=require('../../config/logger')(_0x9bec('0x12'));var utils=require(_0x9bec('0x13'));var config=require(_0x9bec('0x14'));var licenseUtil=require(_0x9bec('0x15'));var db=require(_0x9bec('0x16'))['db'];function respondWithStatusCode(_0x52419a,_0x4273a0){_0x4273a0=_0x4273a0||0xcc;return function(_0x5d6f5c){if(_0x5d6f5c){return _0x52419a[_0x9bec('0x17')](_0x4273a0);}return _0x52419a[_0x9bec('0x18')](_0x4273a0)[_0x9bec('0x19')]();};}function respondWithResult(_0x5a1b2b,_0x397583){_0x397583=_0x397583||0xc8;return function(_0x2fd668){if(_0x2fd668){return _0x5a1b2b[_0x9bec('0x18')](_0x397583)[_0x9bec('0x1a')](_0x2fd668);}};}function respondWithFilteredResult(_0x266efd,_0x6684f4){return function(_0xa0e99){if(_0xa0e99){var _0x44343a=typeof _0x6684f4[_0x9bec('0x1b')]===_0x9bec('0x1c')&&typeof _0x6684f4[_0x9bec('0x1d')]===_0x9bec('0x1c');var _0x641a8=_0xa0e99['count'];var _0x154ad3=_0x44343a?0x0:_0x6684f4[_0x9bec('0x1b')];var _0x5edc2e=_0x44343a?_0xa0e99[_0x9bec('0x1e')]:_0x6684f4[_0x9bec('0x1b')]+_0x6684f4[_0x9bec('0x1d')];var _0x3aefcb;if(_0x5edc2e>=_0x641a8){_0x5edc2e=_0x641a8;_0x3aefcb=0xc8;}else{_0x3aefcb=0xce;}_0x266efd[_0x9bec('0x18')](_0x3aefcb);return _0x266efd[_0x9bec('0x1f')](_0x9bec('0x20'),_0x154ad3+'-'+_0x5edc2e+'/'+_0x641a8)[_0x9bec('0x1a')](_0xa0e99);}return null;};}function patchUpdates(_0x1cef40){return function(_0x1d5bdb){try{jsonpatch['apply'](_0x1d5bdb,_0x1cef40,!![]);}catch(_0x412fc0){return BPromise[_0x9bec('0x21')](_0x412fc0);}return _0x1d5bdb['save']();};}function saveUpdates(_0x28ee3d,_0x5078d7){return function(_0x196225){if(_0x196225){return _0x196225['update'](_0x28ee3d)[_0x9bec('0x22')](function(_0x4227b8){return _0x4227b8;});}return null;};}function removeEntity(_0x560527,_0x41ef40){return function(_0x556ecd){if(_0x556ecd){return _0x556ecd['destroy']()[_0x9bec('0x22')](function(){_0x560527[_0x9bec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba72d,_0x4aa01c){return function(_0x1e2c38){if(!_0x1e2c38){_0xba72d[_0x9bec('0x17')](0x194);}return _0x1e2c38;};}function handleError(_0x2b2a2c,_0xaae3b7){_0xaae3b7=_0xaae3b7||0x1f4;return function(_0x1221a1){logger['error'](_0x1221a1[_0x9bec('0x23')]);if(_0x1221a1[_0x9bec('0x24')]){delete _0x1221a1['name'];}_0x2b2a2c[_0x9bec('0x18')](_0xaae3b7)['send'](_0x1221a1);};}exports[_0x9bec('0x25')]=function(_0x47cff1,_0x2cff0b){var _0x59dd93={},_0x31a551={},_0x2d0c67={'count':0x0,'rows':[]};var _0x15ae1c=_['map'](db[_0x9bec('0x26')][_0x9bec('0x27')],function(_0x49989a){return{'name':_0x49989a[_0x9bec('0x28')],'type':_0x49989a[_0x9bec('0x29')][_0x9bec('0x2a')]};});_0x31a551[_0x9bec('0x2b')]=_[_0x9bec('0x2c')](_0x15ae1c,_0x9bec('0x24'));_0x31a551[_0x9bec('0x2d')]=_['keys'](_0x47cff1['query']);_0x31a551[_0x9bec('0x2e')]=_[_0x9bec('0x2f')](_0x31a551[_0x9bec('0x2b')],_0x31a551[_0x9bec('0x2d')]);_0x59dd93['attributes']=_[_0x9bec('0x2f')](_0x31a551[_0x9bec('0x2b')],qs[_0x9bec('0x30')](_0x47cff1[_0x9bec('0x2d')]['fields']));_0x59dd93[_0x9bec('0x31')]=_0x59dd93['attributes']['length']?_0x59dd93[_0x9bec('0x31')]:_0x31a551[_0x9bec('0x2b')];if(!_0x47cff1[_0x9bec('0x2d')][_0x9bec('0x32')](_0x9bec('0x33'))){_0x59dd93['limit']=qs[_0x9bec('0x1d')](_0x47cff1[_0x9bec('0x2d')][_0x9bec('0x1d')]);_0x59dd93[_0x9bec('0x1b')]=qs[_0x9bec('0x1b')](_0x47cff1['query'][_0x9bec('0x1b')]);}_0x59dd93['order']=qs['sort'](_0x47cff1[_0x9bec('0x2d')][_0x9bec('0x34')]);_0x59dd93[_0x9bec('0x35')]=qs[_0x9bec('0x2e')](_[_0x9bec('0x36')](_0x47cff1['query'],_0x31a551['filters']),_0x15ae1c);if(_0x47cff1[_0x9bec('0x2d')]['filter']){_0x59dd93[_0x9bec('0x35')]=_[_0x9bec('0x37')](_0x59dd93[_0x9bec('0x35')],{'$or':_['map'](_0x15ae1c,function(_0x1ac559){if(_0x1ac559[_0x9bec('0x29')]!==_0x9bec('0x38')){var _0x5bad17={};_0x5bad17[_0x1ac559[_0x9bec('0x24')]]={'$like':'%'+_0x47cff1[_0x9bec('0x2d')][_0x9bec('0x39')]+'%'};return _0x5bad17;}})});}_0x59dd93=_[_0x9bec('0x37')]({},_0x59dd93,_0x47cff1['options']);var _0x4a73ef={'where':_0x59dd93['where']};return db['VoiceDialReport'][_0x9bec('0x1e')](_0x4a73ef)['then'](function(_0x160ffc){_0x2d0c67[_0x9bec('0x1e')]=_0x160ffc;if(_0x47cff1[_0x9bec('0x2d')][_0x9bec('0x3a')]){_0x59dd93['include']=[{'all':!![]}];}return db[_0x9bec('0x26')]['findAll'](_0x59dd93);})[_0x9bec('0x22')](function(_0x49f81d){_0x2d0c67['rows']=_0x49f81d;return _0x2d0c67;})['then'](respondWithFilteredResult(_0x2cff0b,_0x59dd93))['catch'](handleError(_0x2cff0b,null));};exports[_0x9bec('0x3b')]=function(_0x308a5c,_0x4331c9){var _0x1346d6={'raw':!![],'where':{'id':_0x308a5c['params']['id']}},_0x1be790={};_0x1be790[_0x9bec('0x2b')]=_[_0x9bec('0x3c')](db[_0x9bec('0x26')]['rawAttributes']);_0x1be790[_0x9bec('0x2d')]=_[_0x9bec('0x3c')](_0x308a5c['query']);_0x1be790[_0x9bec('0x2e')]=_[_0x9bec('0x2f')](_0x1be790[_0x9bec('0x2b')],_0x1be790[_0x9bec('0x2d')]);_0x1346d6['attributes']=_[_0x9bec('0x2f')](_0x1be790[_0x9bec('0x2b')],qs[_0x9bec('0x30')](_0x308a5c[_0x9bec('0x2d')]['fields']));_0x1346d6[_0x9bec('0x31')]=_0x1346d6[_0x9bec('0x31')][_0x9bec('0x3d')]?_0x1346d6[_0x9bec('0x31')]:_0x1be790[_0x9bec('0x2b')];if(_0x308a5c[_0x9bec('0x2d')][_0x9bec('0x3a')]){_0x1346d6[_0x9bec('0x3e')]=[{'all':!![]}];}_0x1346d6=_[_0x9bec('0x37')]({},_0x1346d6,_0x308a5c['options']);return db[_0x9bec('0x26')][_0x9bec('0x3f')](_0x1346d6)[_0x9bec('0x22')](handleEntityNotFound(_0x4331c9,null))[_0x9bec('0x22')](respondWithResult(_0x4331c9,null))[_0x9bec('0x40')](handleError(_0x4331c9,null));};exports[_0x9bec('0x41')]=function(_0x5b8ccc,_0x3a63b8){return db['VoiceDialReport'][_0x9bec('0x41')](_0x5b8ccc[_0x9bec('0x42')],{})[_0x9bec('0x22')](respondWithResult(_0x3a63b8,0xc9))['catch'](handleError(_0x3a63b8,null));};exports[_0x9bec('0x43')]=function(_0x5ac7d2,_0x54ce89){if(_0x5ac7d2['body']['id']){delete _0x5ac7d2[_0x9bec('0x42')]['id'];}return db[_0x9bec('0x26')][_0x9bec('0x3f')]({'where':{'id':_0x5ac7d2['params']['id']}})[_0x9bec('0x22')](handleEntityNotFound(_0x54ce89,null))[_0x9bec('0x22')](saveUpdates(_0x5ac7d2[_0x9bec('0x42')],null))[_0x9bec('0x22')](respondWithResult(_0x54ce89,null))[_0x9bec('0x40')](handleError(_0x54ce89,null));};exports[_0x9bec('0x44')]=function(_0x1027bf,_0x3d3a2c){return db[_0x9bec('0x26')][_0x9bec('0x3f')]({'where':{'id':_0x1027bf[_0x9bec('0x45')]['id']}})[_0x9bec('0x22')](handleEntityNotFound(_0x3d3a2c,null))['then'](removeEntity(_0x3d3a2c,null))['catch'](handleError(_0x3d3a2c,null));};exports[_0x9bec('0x46')]=function(_0x2ca523,_0x549fc1){return db['VoiceDialReport']['describe']()[_0x9bec('0x22')](respondWithResult(_0x549fc1,null))['catch'](handleError(_0x549fc1,null));}; \ No newline at end of file +var _0x7d48=['VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','then','rows','show','params','create','body','find','catch','describe','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','index','map'];(function(_0x1beacd,_0x17ded1){var _0x6b4276=function(_0xc55ce){while(--_0xc55ce){_0x1beacd['push'](_0x1beacd['shift']());}};_0x6b4276(++_0x17ded1);}(_0x7d48,0xed));var _0x87d4=function(_0x512a68,_0x11ee54){_0x512a68=_0x512a68-0x0;var _0x5c8499=_0x7d48[_0x512a68];return _0x5c8499;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x87d4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87d4('0x1'));var moment=require(_0x87d4('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87d4('0x3'));var path=require(_0x87d4('0x4'));var sox=require('sox');var csv=require(_0x87d4('0x5'));var ejs=require(_0x87d4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d4('0x7'));var squel=require('squel');var crypto=require(_0x87d4('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x87d4('0x9'));var toCsv=require(_0x87d4('0x5'));var querystring=require(_0x87d4('0xa'));var Papa=require(_0x87d4('0xb'));var Redis=require('ioredis');var authService=require(_0x87d4('0xc'));var qs=require(_0x87d4('0xd'));var as=require(_0x87d4('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87d4('0xf'))('api');var utils=require(_0x87d4('0x10'));var config=require(_0x87d4('0x11'));var licenseUtil=require(_0x87d4('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d5ab1,_0x258213){_0x258213=_0x258213||0xcc;return function(_0x328ca7){if(_0x328ca7){return _0x2d5ab1[_0x87d4('0x13')](_0x258213);}return _0x2d5ab1[_0x87d4('0x14')](_0x258213)[_0x87d4('0x15')]();};}function respondWithResult(_0x21c337,_0x267dfd){_0x267dfd=_0x267dfd||0xc8;return function(_0x368e9e){if(_0x368e9e){return _0x21c337[_0x87d4('0x14')](_0x267dfd)['json'](_0x368e9e);}};}function respondWithFilteredResult(_0x2c7e3d,_0x52e85f){return function(_0x59c945){if(_0x59c945){var _0xb3b9db=typeof _0x52e85f['offset']==='undefined'&&typeof _0x52e85f[_0x87d4('0x16')]===_0x87d4('0x17');var _0x5ef7e4=_0x59c945['count'];var _0x4eb36b=_0xb3b9db?0x0:_0x52e85f[_0x87d4('0x18')];var _0x4ecae3=_0xb3b9db?_0x59c945[_0x87d4('0x19')]:_0x52e85f[_0x87d4('0x18')]+_0x52e85f[_0x87d4('0x16')];var _0x24dc90;if(_0x4ecae3>=_0x5ef7e4){_0x4ecae3=_0x5ef7e4;_0x24dc90=0xc8;}else{_0x24dc90=0xce;}_0x2c7e3d[_0x87d4('0x14')](_0x24dc90);return _0x2c7e3d[_0x87d4('0x1a')](_0x87d4('0x1b'),_0x4eb36b+'-'+_0x4ecae3+'/'+_0x5ef7e4)[_0x87d4('0x1c')](_0x59c945);}return null;};}function patchUpdates(_0x1ebb42){return function(_0x441e84){try{jsonpatch[_0x87d4('0x1d')](_0x441e84,_0x1ebb42,!![]);}catch(_0x4f4175){return BPromise[_0x87d4('0x1e')](_0x4f4175);}return _0x441e84['save']();};}function saveUpdates(_0x2f1b04,_0x1e8f0d){return function(_0x4076a7){if(_0x4076a7){return _0x4076a7[_0x87d4('0x1f')](_0x2f1b04)['then'](function(_0x28a988){return _0x28a988;});}return null;};}function removeEntity(_0x42bb95,_0x4d24a2){return function(_0x3cde9c){if(_0x3cde9c){return _0x3cde9c[_0x87d4('0x20')]()['then'](function(){_0x42bb95[_0x87d4('0x14')](0xcc)[_0x87d4('0x15')]();});}};}function handleEntityNotFound(_0x21b4c9,_0xde3e7f){return function(_0x338d36){if(!_0x338d36){_0x21b4c9[_0x87d4('0x13')](0x194);}return _0x338d36;};}function handleError(_0x10ce5f,_0x4bad8d){_0x4bad8d=_0x4bad8d||0x1f4;return function(_0x329bbd){logger[_0x87d4('0x21')](_0x329bbd[_0x87d4('0x22')]);if(_0x329bbd[_0x87d4('0x23')]){delete _0x329bbd[_0x87d4('0x23')];}_0x10ce5f[_0x87d4('0x14')](_0x4bad8d)[_0x87d4('0x24')](_0x329bbd);};}exports[_0x87d4('0x25')]=function(_0x357d22,_0x2e72fc){var _0x545020={},_0x293fcf={},_0x27690f={'count':0x0,'rows':[]};var _0x217801=_[_0x87d4('0x26')](db[_0x87d4('0x27')][_0x87d4('0x28')],function(_0x340ba1){return{'name':_0x340ba1['fieldName'],'type':_0x340ba1[_0x87d4('0x29')][_0x87d4('0x2a')]};});_0x293fcf[_0x87d4('0x2b')]=_[_0x87d4('0x26')](_0x217801,'name');_0x293fcf[_0x87d4('0x2c')]=_[_0x87d4('0x2d')](_0x357d22['query']);_0x293fcf[_0x87d4('0x2e')]=_[_0x87d4('0x2f')](_0x293fcf[_0x87d4('0x2b')],_0x293fcf[_0x87d4('0x2c')]);_0x545020[_0x87d4('0x30')]=_['intersection'](_0x293fcf[_0x87d4('0x2b')],qs[_0x87d4('0x31')](_0x357d22[_0x87d4('0x2c')][_0x87d4('0x31')]));_0x545020[_0x87d4('0x30')]=_0x545020['attributes'][_0x87d4('0x32')]?_0x545020[_0x87d4('0x30')]:_0x293fcf[_0x87d4('0x2b')];if(!_0x357d22[_0x87d4('0x2c')]['hasOwnProperty']('nolimit')){_0x545020[_0x87d4('0x16')]=qs[_0x87d4('0x16')](_0x357d22['query']['limit']);_0x545020[_0x87d4('0x18')]=qs[_0x87d4('0x18')](_0x357d22[_0x87d4('0x2c')][_0x87d4('0x18')]);}_0x545020[_0x87d4('0x33')]=qs[_0x87d4('0x34')](_0x357d22[_0x87d4('0x2c')][_0x87d4('0x34')]);_0x545020[_0x87d4('0x35')]=qs[_0x87d4('0x2e')](_['pick'](_0x357d22['query'],_0x293fcf[_0x87d4('0x2e')]),_0x217801);if(_0x357d22[_0x87d4('0x2c')][_0x87d4('0x36')]){_0x545020['where']=_['merge'](_0x545020[_0x87d4('0x35')],{'$or':_[_0x87d4('0x26')](_0x217801,function(_0x166ba4){if(_0x166ba4[_0x87d4('0x29')]!==_0x87d4('0x37')){var _0x4dfb70={};_0x4dfb70[_0x166ba4[_0x87d4('0x23')]]={'$like':'%'+_0x357d22['query']['filter']+'%'};return _0x4dfb70;}})});}_0x545020=_[_0x87d4('0x38')]({},_0x545020,_0x357d22[_0x87d4('0x39')]);var _0x7bf06={'where':_0x545020[_0x87d4('0x35')]};return db[_0x87d4('0x27')][_0x87d4('0x19')](_0x7bf06)['then'](function(_0x4f3dcc){_0x27690f[_0x87d4('0x19')]=_0x4f3dcc;if(_0x357d22[_0x87d4('0x2c')][_0x87d4('0x3a')]){_0x545020[_0x87d4('0x3b')]=[{'all':!![]}];}return db[_0x87d4('0x27')]['findAll'](_0x545020);})[_0x87d4('0x3c')](function(_0x3157f0){_0x27690f[_0x87d4('0x3d')]=_0x3157f0;return _0x27690f;})['then'](respondWithFilteredResult(_0x2e72fc,_0x545020))['catch'](handleError(_0x2e72fc,null));};exports[_0x87d4('0x3e')]=function(_0x350339,_0x2700a7){var _0x48d156={'raw':!![],'where':{'id':_0x350339[_0x87d4('0x3f')]['id']}},_0xef17db={};_0xef17db['model']=_[_0x87d4('0x2d')](db[_0x87d4('0x27')][_0x87d4('0x28')]);_0xef17db[_0x87d4('0x2c')]=_[_0x87d4('0x2d')](_0x350339[_0x87d4('0x2c')]);_0xef17db[_0x87d4('0x2e')]=_[_0x87d4('0x2f')](_0xef17db[_0x87d4('0x2b')],_0xef17db['query']);_0x48d156[_0x87d4('0x30')]=_[_0x87d4('0x2f')](_0xef17db[_0x87d4('0x2b')],qs[_0x87d4('0x31')](_0x350339['query'][_0x87d4('0x31')]));_0x48d156[_0x87d4('0x30')]=_0x48d156[_0x87d4('0x30')][_0x87d4('0x32')]?_0x48d156[_0x87d4('0x30')]:_0xef17db['model'];if(_0x350339[_0x87d4('0x2c')][_0x87d4('0x3a')]){_0x48d156[_0x87d4('0x3b')]=[{'all':!![]}];}_0x48d156=_[_0x87d4('0x38')]({},_0x48d156,_0x350339[_0x87d4('0x39')]);return db[_0x87d4('0x27')]['find'](_0x48d156)[_0x87d4('0x3c')](handleEntityNotFound(_0x2700a7,null))[_0x87d4('0x3c')](respondWithResult(_0x2700a7,null))['catch'](handleError(_0x2700a7,null));};exports['create']=function(_0x4c4d27,_0x82588a){return db[_0x87d4('0x27')][_0x87d4('0x40')](_0x4c4d27[_0x87d4('0x41')],{})[_0x87d4('0x3c')](respondWithResult(_0x82588a,0xc9))['catch'](handleError(_0x82588a,null));};exports[_0x87d4('0x1f')]=function(_0x187914,_0x58a2f9){if(_0x187914[_0x87d4('0x41')]['id']){delete _0x187914['body']['id'];}return db['VoiceDialReport'][_0x87d4('0x42')]({'where':{'id':_0x187914['params']['id']}})[_0x87d4('0x3c')](handleEntityNotFound(_0x58a2f9,null))['then'](saveUpdates(_0x187914[_0x87d4('0x41')],null))[_0x87d4('0x3c')](respondWithResult(_0x58a2f9,null))['catch'](handleError(_0x58a2f9,null));};exports['destroy']=function(_0x53c70b,_0x5032b7){return db[_0x87d4('0x27')][_0x87d4('0x42')]({'where':{'id':_0x53c70b[_0x87d4('0x3f')]['id']}})[_0x87d4('0x3c')](handleEntityNotFound(_0x5032b7,null))[_0x87d4('0x3c')](removeEntity(_0x5032b7,null))[_0x87d4('0x43')](handleError(_0x5032b7,null));};exports[_0x87d4('0x44')]=function(_0x283014,_0x23cc6e){return db[_0x87d4('0x27')][_0x87d4('0x44')]()[_0x87d4('0x3c')](respondWithResult(_0x23cc6e,null))['catch'](handleError(_0x23cc6e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e47a71f..929c950 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 _0xe64b=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe64b,0x188));var _0xbe64=function(_0x4a6eaf,_0x3ada68){_0x4a6eaf=_0x4a6eaf-0x0;var _0x46299d=_0xe64b[_0x4a6eaf];return _0x46299d;};'use strict';var _=require(_0xbe64('0x0'));var util=require(_0xbe64('0x1'));var logger=require(_0xbe64('0x2'))(_0xbe64('0x3'));var moment=require(_0xbe64('0x4'));var BPromise=require(_0xbe64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe64('0x6'));var rimraf=require('rimraf');var config=require(_0xbe64('0x7'));var attributes=require(_0xbe64('0x8'));module[_0xbe64('0x9')]=function(_0x231846,_0x280f8c){return _0x231846[_0xbe64('0xa')](_0xbe64('0xb'),attributes,{'tableName':_0xbe64('0xc'),'paranoid':![],'indexes':[{'fields':[_0xbe64('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89c7=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial'];(function(_0x3b4359,_0x30fb5f){var _0x43cb11=function(_0x2d9be8){while(--_0x2d9be8){_0x3b4359['push'](_0x3b4359['shift']());}};_0x43cb11(++_0x30fb5f);}(_0x89c7,0x135));var _0x789c=function(_0xd467d7,_0x2f13cd){_0xd467d7=_0xd467d7-0x0;var _0x23b23d=_0x89c7[_0xd467d7];return _0x23b23d;};'use strict';var _=require(_0x789c('0x0'));var util=require(_0x789c('0x1'));var logger=require(_0x789c('0x2'))(_0x789c('0x3'));var moment=require('moment');var BPromise=require(_0x789c('0x4'));var rp=require(_0x789c('0x5'));var fs=require('fs');var path=require(_0x789c('0x6'));var rimraf=require(_0x789c('0x7'));var config=require(_0x789c('0x8'));var attributes=require(_0x789c('0x9'));module[_0x789c('0xa')]=function(_0x4d6cea,_0x162d40){return _0x4d6cea['define'](_0x789c('0xb'),attributes,{'tableName':_0x789c('0xc'),'paranoid':![],'indexes':[{'fields':[_0x789c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 549b138..8c1446c 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 _0x2f97=['../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceDialReport','create','options','raw','debug','VoiceDialReport','body','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f97,0x1c6));var _0x72f9=function(_0x41f9ff,_0x560607){_0x41f9ff=_0x41f9ff-0x0;var _0x55c95d=_0x2f97[_0x41f9ff];return _0x55c95d;};'use strict';var _=require(_0x72f9('0x0'));var util=require(_0x72f9('0x1'));var moment=require(_0x72f9('0x2'));var BPromise=require(_0x72f9('0x3'));var rs=require(_0x72f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72f9('0x5'))['db'];var utils=require(_0x72f9('0x6'));var logger=require(_0x72f9('0x7'))('rpc');var config=require(_0x72f9('0x8'));var jayson=require(_0x72f9('0x9'));var client=jayson[_0x72f9('0xa')][_0x72f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2386c8,_0x17ae5e,_0xf4b692){return new BPromise(function(_0x143ed9,_0x539ac8){return client['request'](_0x2386c8,_0xf4b692)[_0x72f9('0xc')](function(_0x2be026){logger[_0x72f9('0xd')](_0x72f9('0xe'),_0x17ae5e,'request\x20sent');logger['debug'](_0x72f9('0xf'),_0x17ae5e,_0x72f9('0x10'),JSON[_0x72f9('0x11')](_0x2be026));if(_0x2be026[_0x72f9('0x12')]){if(_0x2be026[_0x72f9('0x12')]['code']===0x1f4){logger['error'](_0x72f9('0xe'),_0x17ae5e,_0x2be026[_0x72f9('0x12')][_0x72f9('0x13')]);return _0x539ac8(_0x2be026['error']['message']);}logger[_0x72f9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x17ae5e,_0x2be026[_0x72f9('0x12')]['message']);return _0x143ed9(_0x2be026[_0x72f9('0x12')][_0x72f9('0x13')]);}else{logger[_0x72f9('0xd')](_0x72f9('0xe'),_0x17ae5e,_0x72f9('0x10'));_0x143ed9(_0x2be026[_0x72f9('0x14')][_0x72f9('0x13')]);}})[_0x72f9('0x15')](function(_0x31459f){logger[_0x72f9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x17ae5e,_0x31459f);_0x539ac8(_0x31459f);});});}exports[_0x72f9('0x16')]=function(_0xd54543){var _0x4621bb=this;return new Promise(function(_0x294613,_0x1e8afe){return db['VoiceDialReport'][_0x72f9('0x17')](_0xd54543['body'],{'raw':_0xd54543[_0x72f9('0x18')]?_0xd54543[_0x72f9('0x18')][_0x72f9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4f5a4f){logger[_0x72f9('0xd')](_0x72f9('0x16'),_0xd54543);logger[_0x72f9('0x1a')](_0x72f9('0x16'),_0xd54543,JSON[_0x72f9('0x11')](_0x4f5a4f));_0x294613(_0x4f5a4f);})[_0x72f9('0x15')](function(_0x1ef423){logger[_0x72f9('0x12')](_0x72f9('0x16'),_0x1ef423[_0x72f9('0x13')],_0xd54543);_0x1e8afe(_0x4621bb[_0x72f9('0x12')](0x1f4,_0x1ef423[_0x72f9('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x1fef19){var _0x38b61a=this;return new Promise(function(_0xe6f9ad,_0x4ee9b5){return db[_0x72f9('0x1b')]['update'](_0x1fef19[_0x72f9('0x1c')],{'raw':_0x1fef19[_0x72f9('0x18')]?_0x1fef19[_0x72f9('0x18')][_0x72f9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fef19['options']?_0x1fef19[_0x72f9('0x18')][_0x72f9('0x1d')]||null:null,'attributes':_0x1fef19[_0x72f9('0x18')]?_0x1fef19['options'][_0x72f9('0x1e')]||null:null,'limit':_0x1fef19[_0x72f9('0x18')]?_0x1fef19[_0x72f9('0x18')][_0x72f9('0x1f')]||null:null})[_0x72f9('0xc')](function(_0x1ca674){logger[_0x72f9('0xd')](_0x72f9('0x20'),_0x1fef19);logger[_0x72f9('0x1a')](_0x72f9('0x20'),_0x1fef19,JSON[_0x72f9('0x11')](_0x1ca674));_0xe6f9ad(_0x1ca674);})[_0x72f9('0x15')](function(_0x1fb306){logger[_0x72f9('0x12')](_0x72f9('0x20'),_0x1fb306[_0x72f9('0x13')],_0x1fef19);_0x4ee9b5(_0x38b61a[_0x72f9('0x12')](0x1f4,_0x1fb306[_0x72f9('0x13')]));});});}; \ No newline at end of file +var _0x2daa=['update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport'];(function(_0xbe8e75,_0x2da8ad){var _0x2a8178=function(_0x400c5f){while(--_0x400c5f){_0xbe8e75['push'](_0xbe8e75['shift']());}};_0x2a8178(++_0x2da8ad);}(_0x2daa,0x10b));var _0xa2da=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x2daa[_0x20cc29];return _0x28d513;};'use strict';var _=require(_0xa2da('0x0'));var util=require('util');var moment=require(_0xa2da('0x1'));var BPromise=require(_0xa2da('0x2'));var rs=require(_0xa2da('0x3'));var fs=require('fs');var Redis=require(_0xa2da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2da('0x5'));var logger=require(_0xa2da('0x6'))(_0xa2da('0x7'));var config=require(_0xa2da('0x8'));var jayson=require(_0xa2da('0x9'));var client=jayson['client'][_0xa2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x331993,_0x534413,_0x12e8a7){return new BPromise(function(_0x5a9a18,_0x3b3aaf){return client[_0xa2da('0xb')](_0x331993,_0x12e8a7)[_0xa2da('0xc')](function(_0x1d6c6c){logger[_0xa2da('0xd')](_0xa2da('0xe'),_0x534413,'request\x20sent');logger[_0xa2da('0xf')](_0xa2da('0x10'),_0x534413,_0xa2da('0x11'),JSON[_0xa2da('0x12')](_0x1d6c6c));if(_0x1d6c6c[_0xa2da('0x13')]){if(_0x1d6c6c[_0xa2da('0x13')]['code']===0x1f4){logger[_0xa2da('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x534413,_0x1d6c6c[_0xa2da('0x13')][_0xa2da('0x14')]);return _0x3b3aaf(_0x1d6c6c[_0xa2da('0x13')][_0xa2da('0x14')]);}logger['error'](_0xa2da('0xe'),_0x534413,_0x1d6c6c[_0xa2da('0x13')][_0xa2da('0x14')]);return _0x5a9a18(_0x1d6c6c[_0xa2da('0x13')]['message']);}else{logger['info'](_0xa2da('0xe'),_0x534413,_0xa2da('0x11'));_0x5a9a18(_0x1d6c6c[_0xa2da('0x15')][_0xa2da('0x14')]);}})[_0xa2da('0x16')](function(_0x2720a2){logger[_0xa2da('0x13')](_0xa2da('0xe'),_0x534413,_0x2720a2);_0x3b3aaf(_0x2720a2);});});}exports[_0xa2da('0x17')]=function(_0x5c29e6){var _0x1c55d7=this;return new Promise(function(_0x4f8487,_0x2d06f2){return db[_0xa2da('0x18')][_0xa2da('0x19')](_0x5c29e6[_0xa2da('0x1a')],{'raw':_0x5c29e6[_0xa2da('0x1b')]?_0x5c29e6[_0xa2da('0x1b')][_0xa2da('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5c556f){logger['info'](_0xa2da('0x17'),_0x5c29e6);logger['debug'](_0xa2da('0x17'),_0x5c29e6,JSON['stringify'](_0x5c556f));_0x4f8487(_0x5c556f);})[_0xa2da('0x16')](function(_0x475f40){logger[_0xa2da('0x13')](_0xa2da('0x17'),_0x475f40[_0xa2da('0x14')],_0x5c29e6);_0x2d06f2(_0x1c55d7[_0xa2da('0x13')](0x1f4,_0x475f40[_0xa2da('0x14')]));});});};exports[_0xa2da('0x1d')]=function(_0x264afa){var _0x9616ba=this;return new Promise(function(_0x5a7493,_0x33a67d){return db[_0xa2da('0x18')][_0xa2da('0x1e')](_0x264afa[_0xa2da('0x1a')],{'raw':_0x264afa['options']?_0x264afa[_0xa2da('0x1b')][_0xa2da('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x264afa['options']?_0x264afa['options'][_0xa2da('0x1f')]||null:null,'attributes':_0x264afa[_0xa2da('0x1b')]?_0x264afa[_0xa2da('0x1b')][_0xa2da('0x20')]||null:null,'limit':_0x264afa[_0xa2da('0x1b')]?_0x264afa[_0xa2da('0x1b')]['limit']||null:null})[_0xa2da('0xc')](function(_0x4a7f2a){logger[_0xa2da('0xd')](_0xa2da('0x1d'),_0x264afa);logger[_0xa2da('0xf')](_0xa2da('0x1d'),_0x264afa,JSON[_0xa2da('0x12')](_0x4a7f2a));_0x5a7493(_0x4a7f2a);})[_0xa2da('0x16')](function(_0x3a8f43){logger[_0xa2da('0x13')]('UpdateVoiceDialReport',_0x3a8f43[_0xa2da('0x14')],_0x264afa);_0x33a67d(_0x9616ba[_0xa2da('0x13')](0x1f4,_0x3a8f43['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2ab4352..ef98f6d 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 _0xe6f2=['post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show'];(function(_0x33925b,_0x95cfc6){var _0x375e21=function(_0x57c759){while(--_0x57c759){_0x33925b['push'](_0x33925b['shift']());}};_0x375e21(++_0x95cfc6);}(_0xe6f2,0x7c));var _0x2e6f=function(_0x587a49,_0x45b78c){_0x587a49=_0x587a49-0x0;var _0x557103=_0xe6f2[_0x587a49];return _0x557103;};'use strict';var multer=require(_0x2e6f('0x0'));var util=require(_0x2e6f('0x1'));var path=require(_0x2e6f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e6f('0x3'));var router=express[_0x2e6f('0x4')]();var fs_extra=require(_0x2e6f('0x5'));var auth=require(_0x2e6f('0x6'));var interaction=require(_0x2e6f('0x7'));var config=require(_0x2e6f('0x8'));var controller=require(_0x2e6f('0x9'));router[_0x2e6f('0xa')]('/',auth[_0x2e6f('0xb')](),controller['index']);router[_0x2e6f('0xa')](_0x2e6f('0xc'),auth[_0x2e6f('0xb')](),controller[_0x2e6f('0xd')]);router[_0x2e6f('0xe')]('/',auth[_0x2e6f('0xb')](),controller[_0x2e6f('0xf')]);router['post'](_0x2e6f('0x10'),auth[_0x2e6f('0xb')](),controller[_0x2e6f('0x11')]);router[_0x2e6f('0x12')](_0x2e6f('0xc'),auth[_0x2e6f('0xb')](),controller[_0x2e6f('0x13')]);router[_0x2e6f('0x14')](_0x2e6f('0xc'),auth[_0x2e6f('0xb')](),controller[_0x2e6f('0x15')]);module[_0x2e6f('0x16')]=router; \ No newline at end of file +var _0x1fb8=['addApplications','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','index','get','/:id','show','post','isAuthenticated','/:id/applications'];(function(_0x1341a6,_0x23816a){var _0x37658e=function(_0xbe0a4d){while(--_0xbe0a4d){_0x1341a6['push'](_0x1341a6['shift']());}};_0x37658e(++_0x23816a);}(_0x1fb8,0x17b));var _0x81fb=function(_0x2edb9f,_0x36fad0){_0x2edb9f=_0x2edb9f-0x0;var _0x4e5979=_0x1fb8[_0x2edb9f];return _0x4e5979;};'use strict';var multer=require(_0x81fb('0x0'));var util=require(_0x81fb('0x1'));var path=require(_0x81fb('0x2'));var timeout=require(_0x81fb('0x3'));var express=require(_0x81fb('0x4'));var router=express[_0x81fb('0x5')]();var fs_extra=require(_0x81fb('0x6'));var auth=require(_0x81fb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x81fb('0x8'));var controller=require(_0x81fb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x81fb('0xa')]);router[_0x81fb('0xb')](_0x81fb('0xc'),auth['isAuthenticated'](),controller[_0x81fb('0xd')]);router[_0x81fb('0xe')]('/',auth[_0x81fb('0xf')](),controller['create']);router[_0x81fb('0xe')](_0x81fb('0x10'),auth[_0x81fb('0xf')](),controller[_0x81fb('0x11')]);router[_0x81fb('0x12')](_0x81fb('0xc'),auth['isAuthenticated'](),controller[_0x81fb('0x13')]);router[_0x81fb('0x14')](_0x81fb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x81fb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index fbdef1e..4db512b 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 _0x3854=['NoOp','ENUM','inbound','outbound','outbound-fax','system','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x5d7caa,_0x468c97){var _0x53e8f0=function(_0x726fc8){while(--_0x726fc8){_0x5d7caa['push'](_0x5d7caa['shift']());}};_0x53e8f0(++_0x468c97);}(_0x3854,0x183));var _0x4385=function(_0x2c1a16,_0x2e0cb4){_0x2c1a16=_0x2c1a16-0x0;var _0x51c0cf=_0x3854[_0x2c1a16];return _0x51c0cf;};'use strict';var Sequelize=require(_0x4385('0x0'));module[_0x4385('0x1')]={'context':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'unique':_0x4385('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'unique':_0x4385('0x3')},'priority':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4385('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'defaultValue':_0x4385('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4385('0x5')](_0x4385('0x6'),_0x4385('0x7'),'internal','inbound-fax',_0x4385('0x8'),_0x4385('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x4385('0x2')]},'interval':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'defaultValue':_0x4385('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4385('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4385('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4385('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4385('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4385('0xc')]},'recordingFormat':{'type':Sequelize[_0x4385('0x2')],'defaultValue':_0x4385('0xd')},'answer':{'type':Sequelize[_0x4385('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4385('0xe')],'get':function(_0x42ebd2){return this[_0x4385('0xf')](_0x4385('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x607b=['outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING','compositeIndex','NoOp','inbound'];(function(_0x5f49b3,_0x1ea166){var _0x373e8a=function(_0x306bc2){while(--_0x306bc2){_0x5f49b3['push'](_0x5f49b3['shift']());}};_0x373e8a(++_0x1ea166);}(_0x607b,0x155));var _0xb607=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x607b[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xb607('0x0')],'allowNull':![],'unique':_0xb607('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb607('0x0')],'allowNull':![],'unique':_0xb607('0x1')},'priority':{'type':Sequelize[_0xb607('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xb607('0x1')},'tag':{'type':Sequelize[_0xb607('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb607('0x2')},'appdata':{'type':Sequelize[_0xb607('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xb607('0x3'),_0xb607('0x4'),'internal',_0xb607('0x5'),_0xb607('0x6'),_0xb607('0x7'),_0xb607('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb607('0x0')],'allowNull':![],'defaultValue':_0xb607('0x9')},'IntervalId':{'type':Sequelize[_0xb607('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xb607('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xb607('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb607('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb607('0xc')},'answer':{'type':Sequelize[_0xb607('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb607('0xd')],'get':function(_0x301096){return this[_0xb607('0xe')]('exten');}},'alias':{'type':Sequelize[_0xb607('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1c737c5..bc8ebd1 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 _0x965f=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','includes','type','find','name','UserProfileResource','then','error','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','VIRTUAL','includeAll','findAll','catch','show','params','include','merge','options','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','value','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','sendStatus','send','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x965f,0xbb));var _0xf965=function(_0xdd1a5f,_0x2b181a){_0xdd1a5f=_0xdd1a5f-0x0;var _0x4df958=_0x965f[_0xdd1a5f];return _0x4df958;};'use strict';var _=require(_0xf965('0x0'));var Redis=require(_0xf965('0x1'));var qs=require(_0xf965('0x2'));var logger=require(_0xf965('0x3'))(_0xf965('0x4'));var config=require(_0xf965('0x5'));var db=require(_0xf965('0x6'))['db'];config[_0xf965('0x7')]=_['defaults'](config['redis'],{'host':_0xf965('0x8'),'port':0x18eb});var socket=require(_0xf965('0x9'))(new Redis(config[_0xf965('0x7')]));require('./voiceExtension.socket')[_0xf965('0xa')](socket);function respondWithStatusCode(_0x20e348,_0x22b4c7){_0x22b4c7=_0x22b4c7||0xcc;return function(_0x53b904){if(_0x53b904){return _0x20e348['sendStatus'](_0x22b4c7);}return _0x20e348[_0xf965('0xb')](_0x22b4c7)[_0xf965('0xc')]();};}function respondWithResult(_0x68146a,_0x18a676){_0x18a676=_0x18a676||0xc8;return function(_0x51bd4a){if(_0x51bd4a){return _0x68146a[_0xf965('0xb')](_0x18a676)[_0xf965('0xd')](_0x51bd4a);}};}function respondWithFilteredResult(_0x36f1d2,_0x1a9c7a){return function(_0x17c24e){if(_0x17c24e){var _0x17a1eb=typeof _0x1a9c7a[_0xf965('0xe')]===_0xf965('0xf')&&typeof _0x1a9c7a[_0xf965('0x10')]===_0xf965('0xf');var _0x114f98=_0x17c24e[_0xf965('0x11')];var _0x59e73b=_0x17a1eb?0x0:_0x1a9c7a[_0xf965('0xe')];var _0x276a20=_0x17a1eb?_0x17c24e['count']:_0x1a9c7a[_0xf965('0xe')]+_0x1a9c7a[_0xf965('0x10')];var _0x1bab0b;if(_0x276a20>=_0x114f98){_0x276a20=_0x114f98;_0x1bab0b=0xc8;}else{_0x1bab0b=0xce;}_0x36f1d2['status'](_0x1bab0b);return _0x36f1d2['set'](_0xf965('0x12'),_0x59e73b+'-'+_0x276a20+'/'+_0x114f98)[_0xf965('0xd')](_0x17c24e);}return null;};}function removeEntity(_0xc4974b){return function(_0x1b342c){if(_0x1b342c){return _0x1b342c[_0xf965('0x13')]()['then'](function(){var _0x292f93=_0x1b342c[_0xf965('0x14')]({'plain':!![]});var _0x289f1d=[{'name':_0xf965('0x15'),'value':_0xf965('0x16'),'ignore':![]},{'name':_0xf965('0x17'),'value':'outbound','ignore':![]},{'name':_0xf965('0x18'),'value':'internal','ignore':![]}];var _0x55aeac=_(_0x289f1d)[_0xf965('0x19')](_0xf965('0x1a'))[_0xf965('0x1b')]('value')['value']();if(_[_0xf965('0x1c')](_0x55aeac,_0x292f93[_0xf965('0x1d')])){return;}var _0x32813a=_[_0xf965('0x1e')](_0x289f1d,['value',_0x292f93[_0xf965('0x1d')]])[_0xf965('0x1f')];return db[_0xf965('0x20')][_0xf965('0x13')]({'where':{'type':_0x32813a,'resourceId':_0x292f93['id']}})[_0xf965('0x21')](function(){return _0x1b342c;});})[_0xf965('0x21')](function(){_0xc4974b['status'](0xcc)[_0xf965('0xc')]();});}};}function handleEntityNotFound(_0x334e4a){return function(_0x2f14b2){if(!_0x2f14b2){_0x334e4a['sendStatus'](0x194);}return _0x2f14b2;};}function handleError(_0x31da42,_0x66facf){_0x66facf=_0x66facf||0x1f4;return function(_0x351860){logger[_0xf965('0x22')](_0x351860[_0xf965('0x23')]);if(_0x351860[_0xf965('0x1f')]){delete _0x351860[_0xf965('0x1f')];}_0x31da42['status'](_0x66facf)['send'](_0x351860);};}exports[_0xf965('0x24')]=function(_0x2520c1,_0x5b8b4e){var _0x29a86a={},_0x153094={},_0x30f26e={'count':0x0,'rows':[]};var _0x2cc0ab=_[_0xf965('0x1b')](db[_0xf965('0x25')][_0xf965('0x26')],function(_0x226923){return{'name':_0x226923[_0xf965('0x27')],'type':_0x226923[_0xf965('0x1d')][_0xf965('0x28')]};});_0x153094[_0xf965('0x29')]=_[_0xf965('0x1b')](_0x2cc0ab,_0xf965('0x1f'));_0x153094[_0xf965('0x2a')]=_[_0xf965('0x2b')](_0x2520c1[_0xf965('0x2a')]);_0x153094[_0xf965('0x2c')]=_['intersection'](_0x153094['model'],_0x153094[_0xf965('0x2a')]);_0x29a86a['attributes']=_[_0xf965('0x2d')](_0x153094[_0xf965('0x29')],qs[_0xf965('0x2e')](_0x2520c1[_0xf965('0x2a')][_0xf965('0x2e')]));_0x29a86a[_0xf965('0x2f')]=_0x29a86a[_0xf965('0x2f')][_0xf965('0x30')]?_0x29a86a[_0xf965('0x2f')]:_0x153094[_0xf965('0x29')];if(!_0x2520c1[_0xf965('0x2a')]['hasOwnProperty']('nolimit')){_0x29a86a[_0xf965('0x10')]=qs[_0xf965('0x10')](_0x2520c1[_0xf965('0x2a')]['limit']);_0x29a86a[_0xf965('0xe')]=qs[_0xf965('0xe')](_0x2520c1[_0xf965('0x2a')][_0xf965('0xe')]);}_0x29a86a[_0xf965('0x31')]=qs[_0xf965('0x32')](_0x2520c1[_0xf965('0x2a')][_0xf965('0x32')]);_0x29a86a[_0xf965('0x33')]=qs[_0xf965('0x2c')](_['pick'](_0x2520c1[_0xf965('0x2a')],_0x153094['filters']),_0x2cc0ab);if(_0x2520c1['query'][_0xf965('0x19')]){_0x29a86a[_0xf965('0x33')]=_['merge'](_0x29a86a['where'],{'$or':_[_0xf965('0x1b')](_0x2cc0ab,function(_0x2f7c7e){if(_0x2f7c7e[_0xf965('0x1d')]!==_0xf965('0x34')){var _0x5533af={};_0x5533af[_0x2f7c7e['name']]={'$like':'%'+_0x2520c1['query']['filter']+'%'};return _0x5533af;}})});}_0x29a86a=_['merge']({},_0x29a86a,_0x2520c1['options']);var _0x419711={'where':_0x29a86a['where']};return db[_0xf965('0x25')][_0xf965('0x11')](_0x419711)[_0xf965('0x21')](function(_0x48c030){_0x30f26e[_0xf965('0x11')]=_0x48c030;if(_0x2520c1[_0xf965('0x2a')][_0xf965('0x35')]){_0x29a86a['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xf965('0x36')](_0x29a86a);})[_0xf965('0x21')](function(_0x548dc1){_0x30f26e['rows']=_0x548dc1;return _0x30f26e;})[_0xf965('0x21')](respondWithFilteredResult(_0x5b8b4e,_0x29a86a))[_0xf965('0x37')](handleError(_0x5b8b4e,null));};exports[_0xf965('0x38')]=function(_0x3b7534,_0x4ded26){var _0x10abc1={'raw':![],'where':{'id':_0x3b7534[_0xf965('0x39')]['id']}},_0x4e2e7a={};_0x4e2e7a[_0xf965('0x29')]=_[_0xf965('0x2b')](db[_0xf965('0x25')][_0xf965('0x26')]);_0x4e2e7a[_0xf965('0x2a')]=_[_0xf965('0x2b')](_0x3b7534['query']);_0x4e2e7a[_0xf965('0x2c')]=_['intersection'](_0x4e2e7a[_0xf965('0x29')],_0x4e2e7a[_0xf965('0x2a')]);_0x10abc1[_0xf965('0x2f')]=_['intersection'](_0x4e2e7a['model'],qs[_0xf965('0x2e')](_0x3b7534[_0xf965('0x2a')][_0xf965('0x2e')]));_0x10abc1['attributes']=_0x10abc1[_0xf965('0x2f')][_0xf965('0x30')]?_0x10abc1[_0xf965('0x2f')]:_0x4e2e7a[_0xf965('0x29')];if(_0x3b7534['query'][_0xf965('0x35')]){_0x10abc1[_0xf965('0x3a')]=[{'all':!![]}];}_0x10abc1=_[_0xf965('0x3b')]({},_0x10abc1,_0x3b7534[_0xf965('0x3c')]);return db[_0xf965('0x25')][_0xf965('0x1e')](_0x10abc1)[_0xf965('0x21')](handleEntityNotFound(_0x4ded26,null))[_0xf965('0x21')](respondWithResult(_0x4ded26,null))[_0xf965('0x37')](handleError(_0x4ded26,null));};exports['destroy']=function(_0x3da8da,_0x1be48f){return db[_0xf965('0x25')]['find']({'where':{'id':_0x3da8da[_0xf965('0x39')]['id']}})['then'](handleEntityNotFound(_0x1be48f,null))[_0xf965('0x21')](removeEntity(_0x1be48f,null))[_0xf965('0x37')](handleError(_0x1be48f,null));};exports[_0xf965('0x3d')]=function(_0x5c2cca,_0x41497d){if(_0x5c2cca[_0xf965('0x3e')][_0xf965('0x1d')]===_0xf965('0x3f')&&!_[_0xf965('0x40')](_0x5c2cca['body']['exten'],'_')){_0x5c2cca['body'][_0xf965('0x41')]='_'[_0xf965('0x42')](_0x5c2cca[_0xf965('0x3e')][_0xf965('0x41')]);}return db['VoiceExtension']['create'](_0x5c2cca[_0xf965('0x3e')],{'raw':![]})['then'](function(_0x1806bb){var _0x4b0634=_0x5c2cca[_0xf965('0x43')][_0xf965('0x14')]({'plain':!![]});if(!_0x4b0634)throw new Error(_0xf965('0x44'));if(_0x4b0634[_0xf965('0x45')]===_0xf965('0x43')){var _0x2d60f1=_0x1806bb[_0xf965('0x14')]({'plain':!![]});var _0x49627d=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xf965('0x17'),'value':'outbound'},{'name':_0xf965('0x18'),'value':_0xf965('0x46')}];var _0x3c7d18=_['find'](_0x49627d,[_0xf965('0x47'),_0x2d60f1[_0xf965('0x1d')]])[_0xf965('0x1f')];return db['UserProfileSection'][_0xf965('0x1e')]({'where':{'name':_0x3c7d18,'userProfileId':_0x4b0634['userProfileId']},'raw':!![]})[_0xf965('0x21')](function(_0x1ce18c){if(_0x1ce18c&&_0x1ce18c[_0xf965('0x48')]===0x0){return db[_0xf965('0x20')]['create']({'name':_0x2d60f1[_0xf965('0x1f')],'resourceId':_0x2d60f1['id'],'type':_0x1ce18c['name'],'sectionId':_0x1ce18c['id']},{})[_0xf965('0x21')](function(){return _0x1806bb;});}else{return _0x1806bb;}})[_0xf965('0x37')](function(_0x42ca4e){logger[_0xf965('0x22')](_0xf965('0x49'),_0x42ca4e);throw _0x42ca4e;});}return _0x1806bb;})[_0xf965('0x21')](respondWithResult(_0x41497d,0xc9))[_0xf965('0x37')](handleError(_0x41497d,null));};exports[_0xf965('0x4a')]=function(_0x1cbdd2,_0x28efbd){if(_0x1cbdd2['body']['id']){delete _0x1cbdd2['body']['id'];}return db[_0xf965('0x25')][_0xf965('0x1e')]({'where':{'id':_0x1cbdd2[_0xf965('0x39')]['id']}})['then'](handleEntityNotFound(_0x28efbd,null))[_0xf965('0x21')](function(_0x117d5f){if(_0x117d5f){return db[_0xf965('0x25')]['update'](_[_0xf965('0x4b')](_0x1cbdd2['body'],[_0xf965('0x41'),_0xf965('0x4c'),'description',_0xf965('0x4d'),_0xf965('0x4e'),'mandatoryDisposition','alias']),{'where':{'context':_0x117d5f[_0xf965('0x4c')],'exten':_0x117d5f[_0xf965('0x41')]},'individualHooks':!![]})[_0xf965('0x21')](function(_0x459c5b){return _0x459c5b;});}return null;})[_0xf965('0x21')](respondWithStatusCode(_0x28efbd,null))[_0xf965('0x37')](handleError(_0x28efbd,null));};exports[_0xf965('0x4f')]=function(_0x46efe6,_0x93bb1d){var _0x1b6e7e=_0x46efe6[_0xf965('0x39')]['id'];var _0x1f400b=_0x46efe6[_0xf965('0x3e')];var _0x109a40=0xc8;var _0x129bec=null;return db['sequelize'][_0xf965('0x50')]({'isolationLevel':db[_0xf965('0x51')]['Transaction'][_0xf965('0x52')][_0xf965('0x53')]},function(_0x5d0d2b){return db[_0xf965('0x25')][_0xf965('0x54')]({'where':{'id':_0x1b6e7e},'transaction':_0x5d0d2b})[_0xf965('0x21')](function(_0x489ee5){if(_0x489ee5){return db[_0xf965('0x25')]['destroy']({'where':{'VoiceExtensionId':_0x1b6e7e},'transaction':_0x5d0d2b})[_0xf965('0x21')](function(){var _0x3b22b3=_[_0xf965('0x1b')](_0x1f400b,function(_0xedae2d){_0xedae2d[_0xf965('0x55')]=_0x1b6e7e;_0xedae2d[_0xf965('0x56')]=!![];return _0xedae2d;});return _0x489ee5[_0xf965('0x57')](_0x3b22b3);})[_0xf965('0x21')](function(_0x4c7d73){return db['VoiceExtension'][_0xf965('0x58')](_0x4c7d73,{'transaction':_0x5d0d2b});});}else{_0x109a40=0x194;_0x129bec=[];}});})[_0xf965('0x21')](function(){if(_0x109a40!==0x194){return db[_0xf965('0x25')][_0xf965('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1b6e7e},'order':_0xf965('0x5a')})[_0xf965('0x21')](function(_0x49a71e){_0x129bec=_0x49a71e;});}})[_0xf965('0x37')](function(_0x13fb3a){_0x109a40=0x1f4;logger[_0xf965('0x22')](_0x13fb3a[_0xf965('0x23')]);if(_0x13fb3a['name']){delete _0x13fb3a[_0xf965('0x1f')];}_0x129bec=_0x13fb3a;})[_0xf965('0x5b')](function(){if(_0x129bec===null){_0x93bb1d[_0xf965('0x5c')](_0x109a40);}else{if(_0x109a40===0x1f4){_0x93bb1d[_0xf965('0xb')](_0x109a40)[_0xf965('0x5d')](_0x129bec);}else{_0x93bb1d[_0xf965('0xb')](_0x109a40)[_0xf965('0xd')](_0x129bec);}}});}; \ No newline at end of file +var _0x0f07=['offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','InternalRoutes','internal','ignore','map','includes','type','value','name','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','outbound','startsWith','body','exten','concat','user','role','inbound','OutboundRoutes','UserProfileSection','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f07,0x1c8));var _0x70f0=function(_0x205790,_0x514d3d){_0x205790=_0x205790-0x0;var _0x1dc25c=_0x0f07[_0x205790];return _0x1dc25c;};'use strict';var _=require(_0x70f0('0x0'));var Redis=require(_0x70f0('0x1'));var qs=require(_0x70f0('0x2'));var logger=require(_0x70f0('0x3'))('api');var config=require(_0x70f0('0x4'));var db=require('../../mysqldb')['db'];config[_0x70f0('0x5')]=_['defaults'](config[_0x70f0('0x5')],{'host':_0x70f0('0x6'),'port':0x18eb});var socket=require(_0x70f0('0x7'))(new Redis(config['redis']));require(_0x70f0('0x8'))[_0x70f0('0x9')](socket);function respondWithStatusCode(_0x5df3dc,_0x5bea95){_0x5bea95=_0x5bea95||0xcc;return function(_0x3aa639){if(_0x3aa639){return _0x5df3dc[_0x70f0('0xa')](_0x5bea95);}return _0x5df3dc[_0x70f0('0xb')](_0x5bea95)[_0x70f0('0xc')]();};}function respondWithResult(_0x2b7a53,_0x5a6b96){_0x5a6b96=_0x5a6b96||0xc8;return function(_0x507319){if(_0x507319){return _0x2b7a53[_0x70f0('0xb')](_0x5a6b96)[_0x70f0('0xd')](_0x507319);}};}function respondWithFilteredResult(_0x1a9d1a,_0x3ddea8){return function(_0x50da65){if(_0x50da65){var _0x20fdf6=typeof _0x3ddea8[_0x70f0('0xe')]===_0x70f0('0xf')&&typeof _0x3ddea8['limit']===_0x70f0('0xf');var _0x5501e9=_0x50da65[_0x70f0('0x10')];var _0x267140=_0x20fdf6?0x0:_0x3ddea8[_0x70f0('0xe')];var _0xb06c48=_0x20fdf6?_0x50da65['count']:_0x3ddea8[_0x70f0('0xe')]+_0x3ddea8[_0x70f0('0x11')];var _0x446ada;if(_0xb06c48>=_0x5501e9){_0xb06c48=_0x5501e9;_0x446ada=0xc8;}else{_0x446ada=0xce;}_0x1a9d1a['status'](_0x446ada);return _0x1a9d1a[_0x70f0('0x12')](_0x70f0('0x13'),_0x267140+'-'+_0xb06c48+'/'+_0x5501e9)[_0x70f0('0xd')](_0x50da65);}return null;};}function removeEntity(_0x643928){return function(_0x59c7b3){if(_0x59c7b3){return _0x59c7b3[_0x70f0('0x14')]()[_0x70f0('0x15')](function(){var _0x2d65ec=_0x59c7b3[_0x70f0('0x16')]({'plain':!![]});var _0x12c3a1=[{'name':_0x70f0('0x17'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x70f0('0x18'),'value':_0x70f0('0x19'),'ignore':![]}];var _0x37084c=_(_0x12c3a1)['filter'](_0x70f0('0x1a'))[_0x70f0('0x1b')]('value')['value']();if(_[_0x70f0('0x1c')](_0x37084c,_0x2d65ec[_0x70f0('0x1d')])){return;}var _0x216d59=_['find'](_0x12c3a1,[_0x70f0('0x1e'),_0x2d65ec['type']])[_0x70f0('0x1f')];return db['UserProfileResource'][_0x70f0('0x14')]({'where':{'type':_0x216d59,'resourceId':_0x2d65ec['id']}})[_0x70f0('0x15')](function(){return _0x59c7b3;});})['then'](function(){_0x643928[_0x70f0('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e661){return function(_0x1f0b86){if(!_0x1f0b86){_0x39e661['sendStatus'](0x194);}return _0x1f0b86;};}function handleError(_0x10cc5f,_0x139507){_0x139507=_0x139507||0x1f4;return function(_0x4b5b2b){logger[_0x70f0('0x20')](_0x4b5b2b[_0x70f0('0x21')]);if(_0x4b5b2b[_0x70f0('0x1f')]){delete _0x4b5b2b[_0x70f0('0x1f')];}_0x10cc5f[_0x70f0('0xb')](_0x139507)[_0x70f0('0x22')](_0x4b5b2b);};}exports[_0x70f0('0x23')]=function(_0xe78af7,_0x243bca){var _0x46bccd={},_0x39770e={},_0x3ab902={'count':0x0,'rows':[]};var _0x1bdba8=_[_0x70f0('0x1b')](db[_0x70f0('0x24')][_0x70f0('0x25')],function(_0x5824a4){return{'name':_0x5824a4[_0x70f0('0x26')],'type':_0x5824a4['type'][_0x70f0('0x27')]};});_0x39770e[_0x70f0('0x28')]=_[_0x70f0('0x1b')](_0x1bdba8,_0x70f0('0x1f'));_0x39770e['query']=_[_0x70f0('0x29')](_0xe78af7[_0x70f0('0x2a')]);_0x39770e['filters']=_['intersection'](_0x39770e['model'],_0x39770e[_0x70f0('0x2a')]);_0x46bccd[_0x70f0('0x2b')]=_[_0x70f0('0x2c')](_0x39770e[_0x70f0('0x28')],qs['fields'](_0xe78af7[_0x70f0('0x2a')][_0x70f0('0x2d')]));_0x46bccd[_0x70f0('0x2b')]=_0x46bccd['attributes'][_0x70f0('0x2e')]?_0x46bccd[_0x70f0('0x2b')]:_0x39770e['model'];if(!_0xe78af7[_0x70f0('0x2a')]['hasOwnProperty'](_0x70f0('0x2f'))){_0x46bccd[_0x70f0('0x11')]=qs[_0x70f0('0x11')](_0xe78af7[_0x70f0('0x2a')][_0x70f0('0x11')]);_0x46bccd[_0x70f0('0xe')]=qs[_0x70f0('0xe')](_0xe78af7['query']['offset']);}_0x46bccd[_0x70f0('0x30')]=qs[_0x70f0('0x31')](_0xe78af7[_0x70f0('0x2a')][_0x70f0('0x31')]);_0x46bccd[_0x70f0('0x32')]=qs[_0x70f0('0x33')](_[_0x70f0('0x34')](_0xe78af7[_0x70f0('0x2a')],_0x39770e[_0x70f0('0x33')]),_0x1bdba8);if(_0xe78af7[_0x70f0('0x2a')][_0x70f0('0x35')]){_0x46bccd[_0x70f0('0x32')]=_[_0x70f0('0x36')](_0x46bccd['where'],{'$or':_[_0x70f0('0x1b')](_0x1bdba8,function(_0x11f265){if(_0x11f265[_0x70f0('0x1d')]!==_0x70f0('0x37')){var _0x528290={};_0x528290[_0x11f265[_0x70f0('0x1f')]]={'$like':'%'+_0xe78af7[_0x70f0('0x2a')]['filter']+'%'};return _0x528290;}})});}_0x46bccd=_[_0x70f0('0x36')]({},_0x46bccd,_0xe78af7['options']);var _0x4669c6={'where':_0x46bccd[_0x70f0('0x32')]};return db[_0x70f0('0x24')][_0x70f0('0x10')](_0x4669c6)[_0x70f0('0x15')](function(_0x298b69){_0x3ab902[_0x70f0('0x10')]=_0x298b69;if(_0xe78af7[_0x70f0('0x2a')][_0x70f0('0x38')]){_0x46bccd[_0x70f0('0x39')]=[{'all':!![]}];}return db[_0x70f0('0x24')][_0x70f0('0x3a')](_0x46bccd);})[_0x70f0('0x15')](function(_0x3c9b4f){_0x3ab902[_0x70f0('0x3b')]=_0x3c9b4f;return _0x3ab902;})['then'](respondWithFilteredResult(_0x243bca,_0x46bccd))[_0x70f0('0x3c')](handleError(_0x243bca,null));};exports['show']=function(_0x15a5e3,_0x550e49){var _0x2c58bd={'raw':![],'where':{'id':_0x15a5e3[_0x70f0('0x3d')]['id']}},_0x5415b2={};_0x5415b2[_0x70f0('0x28')]=_[_0x70f0('0x29')](db[_0x70f0('0x24')][_0x70f0('0x25')]);_0x5415b2[_0x70f0('0x2a')]=_[_0x70f0('0x29')](_0x15a5e3[_0x70f0('0x2a')]);_0x5415b2[_0x70f0('0x33')]=_['intersection'](_0x5415b2[_0x70f0('0x28')],_0x5415b2[_0x70f0('0x2a')]);_0x2c58bd['attributes']=_['intersection'](_0x5415b2[_0x70f0('0x28')],qs[_0x70f0('0x2d')](_0x15a5e3['query'][_0x70f0('0x2d')]));_0x2c58bd['attributes']=_0x2c58bd['attributes']['length']?_0x2c58bd[_0x70f0('0x2b')]:_0x5415b2[_0x70f0('0x28')];if(_0x15a5e3[_0x70f0('0x2a')][_0x70f0('0x38')]){_0x2c58bd[_0x70f0('0x39')]=[{'all':!![]}];}_0x2c58bd=_['merge']({},_0x2c58bd,_0x15a5e3['options']);return db['VoiceExtension'][_0x70f0('0x3e')](_0x2c58bd)[_0x70f0('0x15')](handleEntityNotFound(_0x550e49,null))[_0x70f0('0x15')](respondWithResult(_0x550e49,null))['catch'](handleError(_0x550e49,null));};exports[_0x70f0('0x14')]=function(_0x439167,_0x2fc21d){return db[_0x70f0('0x24')]['find']({'where':{'id':_0x439167[_0x70f0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2fc21d,null))['then'](removeEntity(_0x2fc21d,null))[_0x70f0('0x3c')](handleError(_0x2fc21d,null));};exports[_0x70f0('0x3f')]=function(_0x694a84,_0x128b92){if(_0x694a84['body'][_0x70f0('0x1d')]===_0x70f0('0x40')&&!_[_0x70f0('0x41')](_0x694a84[_0x70f0('0x42')]['exten'],'_')){_0x694a84['body'][_0x70f0('0x43')]='_'[_0x70f0('0x44')](_0x694a84[_0x70f0('0x42')][_0x70f0('0x43')]);}return db['VoiceExtension'][_0x70f0('0x3f')](_0x694a84[_0x70f0('0x42')],{'raw':![]})[_0x70f0('0x15')](function(_0x46ca62){var _0x1060c1=_0x694a84[_0x70f0('0x45')][_0x70f0('0x16')]({'plain':!![]});if(!_0x1060c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1060c1[_0x70f0('0x46')]==='user'){var _0x3f75b4=_0x46ca62[_0x70f0('0x16')]({'plain':!![]});var _0x1cacf3=[{'name':_0x70f0('0x17'),'value':_0x70f0('0x47')},{'name':_0x70f0('0x48'),'value':_0x70f0('0x40')},{'name':_0x70f0('0x18'),'value':'internal'}];var _0x209c6d=_[_0x70f0('0x3e')](_0x1cacf3,[_0x70f0('0x1e'),_0x3f75b4[_0x70f0('0x1d')]])[_0x70f0('0x1f')];return db[_0x70f0('0x49')][_0x70f0('0x3e')]({'where':{'name':_0x209c6d,'userProfileId':_0x1060c1['userProfileId']},'raw':!![]})[_0x70f0('0x15')](function(_0x3d0517){if(_0x3d0517&&_0x3d0517[_0x70f0('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f75b4[_0x70f0('0x1f')],'resourceId':_0x3f75b4['id'],'type':_0x3d0517[_0x70f0('0x1f')],'sectionId':_0x3d0517['id']},{})[_0x70f0('0x15')](function(){return _0x46ca62;});}else{return _0x46ca62;}})[_0x70f0('0x3c')](function(_0x116a1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x116a1a);throw _0x116a1a;});}return _0x46ca62;})[_0x70f0('0x15')](respondWithResult(_0x128b92,0xc9))[_0x70f0('0x3c')](handleError(_0x128b92,null));};exports[_0x70f0('0x4b')]=function(_0x6da3dc,_0x3666b0){if(_0x6da3dc['body']['id']){delete _0x6da3dc[_0x70f0('0x42')]['id'];}return db[_0x70f0('0x24')][_0x70f0('0x3e')]({'where':{'id':_0x6da3dc['params']['id']}})[_0x70f0('0x15')](handleEntityNotFound(_0x3666b0,null))[_0x70f0('0x15')](function(_0x20faec){if(_0x20faec){return db['VoiceExtension'][_0x70f0('0x4b')](_[_0x70f0('0x34')](_0x6da3dc[_0x70f0('0x42')],[_0x70f0('0x43'),_0x70f0('0x4c'),_0x70f0('0x4d'),_0x70f0('0x4e'),_0x70f0('0x4f'),_0x70f0('0x50'),_0x70f0('0x51')]),{'where':{'context':_0x20faec['context'],'exten':_0x20faec[_0x70f0('0x43')]},'individualHooks':!![]})['then'](function(_0x881d31){return _0x881d31;});}return null;})[_0x70f0('0x15')](respondWithStatusCode(_0x3666b0,null))[_0x70f0('0x3c')](handleError(_0x3666b0,null));};exports[_0x70f0('0x52')]=function(_0x90db9e,_0x4802e8){var _0x2de4dd=_0x90db9e[_0x70f0('0x3d')]['id'];var _0x556b52=_0x90db9e[_0x70f0('0x42')];var _0x46ed53=0xc8;var _0x3f4dcd=null;return db[_0x70f0('0x53')]['transaction']({'isolationLevel':db[_0x70f0('0x53')][_0x70f0('0x54')][_0x70f0('0x55')][_0x70f0('0x56')]},function(_0x1ba511){return db[_0x70f0('0x24')]['findOne']({'where':{'id':_0x2de4dd},'transaction':_0x1ba511})[_0x70f0('0x15')](function(_0x3c9fbc){if(_0x3c9fbc){return db[_0x70f0('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x2de4dd},'transaction':_0x1ba511})[_0x70f0('0x15')](function(){var _0x541022=_[_0x70f0('0x1b')](_0x556b52,function(_0x58680c){_0x58680c[_0x70f0('0x57')]=_0x2de4dd;_0x58680c[_0x70f0('0x58')]=!![];return _0x58680c;});return _0x3c9fbc[_0x70f0('0x59')](_0x541022);})[_0x70f0('0x15')](function(_0x5461fb){return db[_0x70f0('0x24')][_0x70f0('0x5a')](_0x5461fb,{'transaction':_0x1ba511});});}else{_0x46ed53=0x194;_0x3f4dcd=[];}});})[_0x70f0('0x15')](function(){if(_0x46ed53!==0x194){return db['VoiceExtension'][_0x70f0('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2de4dd},'order':_0x70f0('0x5c')})[_0x70f0('0x15')](function(_0x1c55a0){_0x3f4dcd=_0x1c55a0;});}})['catch'](function(_0x2632fe){_0x46ed53=0x1f4;logger['error'](_0x2632fe[_0x70f0('0x21')]);if(_0x2632fe[_0x70f0('0x1f')]){delete _0x2632fe[_0x70f0('0x1f')];}_0x3f4dcd=_0x2632fe;})[_0x70f0('0x5d')](function(){if(_0x3f4dcd===null){_0x4802e8[_0x70f0('0xa')](_0x46ed53);}else{if(_0x46ed53===0x1f4){_0x4802e8[_0x70f0('0xb')](_0x46ed53)[_0x70f0('0x22')](_0x3f4dcd);}else{_0x4802e8[_0x70f0('0xb')](_0x46ed53)['json'](_0x3f4dcd);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ee20bd6..a579f49 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 _0xf9b9=['emit','hasOwnProperty','hook','exports','../../mysqldb','update','remove'];(function(_0x18efb0,_0x402155){var _0x463641=function(_0x7f44b1){while(--_0x7f44b1){_0x18efb0['push'](_0x18efb0['shift']());}};_0x463641(++_0x402155);}(_0xf9b9,0x169));var _0x9f9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9b9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9f9b('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f9b('0x1'),'afterDestroy':_0x9f9b('0x2')};function emitEvent(_0x477297){return function(_0x3efc7f,_0x4f5957,_0x3609c1){VoiceExtensionEvents[_0x9f9b('0x3')](_0x477297+':'+_0x3efc7f['id'],_0x3efc7f);VoiceExtensionEvents['emit'](_0x477297,_0x3efc7f);_0x3609c1(null);};}for(var e in events){if(events[_0x9f9b('0x4')](e)){var event=events[e];VoiceExtension[_0x9f9b('0x5')](e,emitEvent(event));}}module[_0x9f9b('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6443=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6443,0x16a));var _0x3644=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x6443[_0x5de532];return _0x4e9192;};'use strict';var EventEmitter=require(_0x3644('0x0'));var VoiceExtension=require(_0x3644('0x1'))['db'][_0x3644('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3644('0x3')](0x0);var events={'afterCreate':_0x3644('0x4'),'afterUpdate':_0x3644('0x5'),'afterDestroy':'remove'};function emitEvent(_0x447067){return function(_0x4dbe86,_0x1e7f91,_0x3c7af0){VoiceExtensionEvents[_0x3644('0x6')](_0x447067+':'+_0x4dbe86['id'],_0x4dbe86);VoiceExtensionEvents['emit'](_0x447067,_0x4dbe86);_0x3c7af0(null);};}for(var e in events){if(events[_0x3644('0x7')](e)){var event=events[e];VoiceExtension[_0x3644('0x8')](e,emitEvent(event));}}module[_0x3644('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 2e49269..f9bf231 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 _0x3f14=['${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','then','*,*,*,*','intervals','IntervalId','map','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','catch','VoiceExtension','get','concat','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits'];(function(_0x522883,_0x4cf904){var _0x1c52ea=function(_0x316a2a){while(--_0x316a2a){_0x522883['push'](_0x522883['shift']());}};_0x1c52ea(++_0x4cf904);}(_0x3f14,0x87));var _0x43f1=function(_0x39ef3c,_0x51e30a){_0x39ef3c=_0x39ef3c-0x0;var _0x4e95df=_0x3f14[_0x39ef3c];return _0x4e95df;};'use strict';var _=require(_0x43f1('0x0'));var attributes=require(_0x43f1('0x1'));module[_0x43f1('0x2')]=function(_0x14085a){var _0x36c8d=_0x14085a[_0x43f1('0x3')];function _0x1dbd9c(_0xd86078){var _0xeb051e=0x2;var _0x4a08f0=[{'type':_0xd86078[_0x43f1('0x4')],'app':_0x43f1('0x5'),'appdata':_0x43f1('0x6')+_0xd86078[_0x43f1('0x4')],'context':_0xd86078[_0x43f1('0x7')],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']},{'type':_0xd86078['type'],'app':_0xd86078[_0x43f1('0x9')]?_0x43f1('0x5'):_0x43f1('0xa'),'appdata':_0xd86078['alias']?'CDR(routeAlias)='+_0xd86078[_0x43f1('0x9')]:_0x43f1('0xb'),'context':_0xd86078['context'],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']}];if(_0xd86078[_0x43f1('0x4')]===_0x43f1('0xc')){_0x4a08f0[_0x43f1('0xd')]({'type':_0x43f1('0xc'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0xe')+_0xd86078['id'],'context':_0xd86078[_0x43f1('0x7')],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']});}_0x4a08f0['push']({'type':_0xd86078[_0x43f1('0x4')],'app':_0x43f1('0x5'),'appdata':_0x43f1('0xf'),'context':_0xd86078[_0x43f1('0x7')],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']},{'type':_0xd86078['type'],'app':_0x43f1('0x5'),'appdata':_0x43f1('0x10'),'context':_0xd86078[_0x43f1('0x7')],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']},{'type':_0xd86078[_0x43f1('0x4')],'app':_0x43f1('0x5'),'appdata':_0x43f1('0x11'),'context':_0xd86078[_0x43f1('0x7')],'exten':_0xd86078[_0x43f1('0x8')],'priority':_0xeb051e++,'VoiceExtensionId':_0xd86078['id']});return _0x4a08f0;}function _0x273c67(_0x530349){var _0x3e5e59=0x2;var _0x34b973=[{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x13'),'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349['exten'],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x530349[_0x43f1('0x9')]?'Set':_0x43f1('0xa'),'appdata':_0x530349[_0x43f1('0x9')]?_0x43f1('0x14')+_0x530349[_0x43f1('0x9')]:_0x43f1('0xb'),'context':_0x530349['context'],'exten':_0x530349['exten'],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x15')+(_0x530349[_0x43f1('0x16')]?_0x43f1('0x17')+_0x530349[_0x43f1('0x16')]+'}':_0x43f1('0x18')),'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0xe')+_0x530349['id'],'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x19'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3e5e59+0x2)+_0x43f1('0x1a')+(_0x3e5e59+0x1)+')','context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':'outbound','app':_0x43f1('0x5'),'appdata':_0x530349[_0x43f1('0x16')]?_0x43f1('0x1b')+_0x530349[_0x43f1('0x16')]+'}':_0x43f1('0x1c'),'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0xf'),'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x10'),'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':'outboundrouteid='+_0x530349['id'],'context':_0x530349[_0x43f1('0x7')],'exten':_0x530349[_0x43f1('0x8')],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']}];if(_0x530349[_0x43f1('0x1d')](_0x43f1('0x1e'))&&_0x530349[_0x43f1('0x1e')]!==_0x43f1('0x1f')){_0x34b973['push']({'type':_0x43f1('0x12'),'app':'Set','appdata':_0x43f1('0x20'),'context':_0x530349['context'],'exten':_0x530349['exten'],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']},{'type':_0x43f1('0x12'),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x21')+_0x530349[_0x43f1('0x1e')]||'wav','context':_0x530349['context'],'exten':_0x530349['exten'],'priority':_0x3e5e59++,'VoiceExtensionId':_0x530349['id']});}return _0x34b973;}function _0x30d27a(_0x74dfef,_0x2940ab){var _0x31aee0=[{'name':_0x43f1('0x22'),'param':0x0},{'name':_0x43f1('0x23'),'param':0x1},{'name':_0x43f1('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x186879={};var _0x558dee=_0x2940ab[_0x43f1('0x25')](',');var _0x2ba4ce=[];for(var _0x31ec83=0x0;_0x31ec83<_0x31aee0[_0x43f1('0x26')];_0x31ec83++){switch(_0x31aee0[_0x31ec83][_0x43f1('0x27')]){case'trunk':_0x186879[_0x43f1('0x22')]=_0x558dee[_0x31aee0[_0x31ec83][_0x43f1('0x28')]][_0x43f1('0x25')]('/')[0x1];_0x186879[_0x43f1('0x29')]=_0x558dee[_0x31aee0[_0x31ec83][_0x43f1('0x28')]][_0x43f1('0x25')]('/')[0x2];_0x186879['prefix']=_0x186879[_0x43f1('0x29')]?_0x186879['phone']['split']('$')[0x0]:undefined;_0x186879[_0x43f1('0x29')]=_0x74dfef[_0x43f1('0x16')]?(_0x186879[_0x43f1('0x2a')]||'')+_0x43f1('0x17')+_0x74dfef[_0x43f1('0x16')]+'}':(_0x186879['prefix']||'')+_0x43f1('0x18');_0x2ba4ce[_0x31aee0[_0x31ec83][_0x43f1('0x28')]]=[_0x43f1('0x2b'),_0x186879[_0x43f1('0x22')],_0x186879[_0x43f1('0x29')]][_0x43f1('0x2c')]('/');break;case _0x43f1('0x24'):_0x186879[_0x43f1('0x24')]=_0x558dee[_0x31aee0[_0x31ec83]['param']];if(_0x74dfef[_0x43f1('0x1e')]!=='none'){if(_0x186879['options'][_0x43f1('0x2d')](_0x43f1('0x2e'))<0x0){_0x186879['options']+=_0x43f1('0x2e');}}else{_0x186879[_0x43f1('0x24')]=_0x186879[_0x43f1('0x24')][_0x43f1('0x2f')]('U(xcally-mixmonitor-context)','');}_0x2ba4ce[_0x31aee0[_0x31ec83]['param']]=_0x186879[_0x43f1('0x24')];break;default:_0x2ba4ce[_0x31aee0[_0x31ec83]['param']]=_0x558dee[_0x31aee0[_0x31ec83][_0x43f1('0x28')]];}}return _0x2ba4ce['join'](',');}function _0x52f49d(_0x2c91aa,_0x31908c,_0x28f443){return new Promise(function(_0x5c06f2,_0xf02543){var _0x6b50bb=[];if(_['isEmpty'](_0x31908c))return _0x5c06f2(_0x6b50bb);_0x36c8d[_0x43f1('0x30')]['findAll']({'attributes':['id',_0x43f1('0x31'),'IntervalId'],'raw':!![]})[_0x43f1('0x32')](function(_0x482e4f){for(var _0x4a4891=0x0,_0x24726b=0x0;_0x4a4891<_0x31908c[_0x43f1('0x26')];_0x4a4891++,_0x24726b=0x0){var _0xc801f7=_0x31908c[_0x4a4891];var _0x2c1e70=[];var _0x4c05c3=[];delete _0xc801f7['id'];if(_0xc801f7[_0x43f1('0x31')]!==_0x43f1('0x33')){_0xc801f7[_0x43f1('0x34')]=[_0xc801f7[_0x43f1('0x31')]];}else{_0xc801f7[_0x43f1('0x34')]=_0xc801f7[_0x43f1('0x35')]?_[_0x43f1('0x36')](_['filter'](_0x482e4f,{'IntervalId':_0xc801f7[_0x43f1('0x35')]}),'interval'):[];}_0xc801f7[_0x43f1('0x7')]=_0x2c91aa[_0x43f1('0x7')];_0xc801f7['exten']=_0x2c91aa[_0x43f1('0x8')];if(_0xc801f7[_0x43f1('0x4')])_0xc801f7[_0x43f1('0x4')]=_0xc801f7[_0x43f1('0x4')][_0x43f1('0x37')]();if(_0x2c91aa['type']==='outbound'){if(_0xc801f7[_0x43f1('0x1d')](_0x43f1('0x38'))&&_0xc801f7['tag']&&_0xc801f7['tag']!=='--'){_0x2c1e70['push']({'type':_0xc801f7['type'][_0x43f1('0x37')](),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x39')+_0xc801f7[_0x43f1('0x38')],'context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa['exten'],'priority':_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});}_0x2c1e70[_0x43f1('0xd')]({'type':_0xc801f7[_0x43f1('0x4')][_0x43f1('0x37')](),'app':_0x43f1('0x19'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xc801f7[_0x43f1('0x3a')]?_0x43f1('0x3b')+_0xc801f7[_0x43f1('0x3a')]+')':_0x43f1('0x3c')),'context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa[_0x43f1('0x8')],'priority':_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});}else{if(_0xc801f7[_0x43f1('0x1d')](_0x43f1('0x3d'))){if(['queue','playback'][_0x43f1('0x3e')](_0xc801f7[_0x43f1('0x3f')][_0x43f1('0x37')]())&&_0xc801f7['appType']!==_0x43f1('0x40')){if(_0xc801f7[_0x43f1('0x3d')]){_0x2c1e70['push']({'type':_0xc801f7['type'][_0x43f1('0x37')](),'app':_0x43f1('0x19'),'appdata':_0x43f1('0x41'),'context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa[_0x43f1('0x8')],'priority':_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});_0x2c1e70['push']({'type':_0xc801f7['type']['toLowerCase'](),'app':_0x43f1('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa[_0x43f1('0x8')],'priority':_0xc801f7['intervals'][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});}else{_0x2c1e70['push']({'type':_0xc801f7[_0x43f1('0x4')][_0x43f1('0x37')](),'app':_0x43f1('0x19'),'appdata':_0x43f1('0x42'),'context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa['exten'],'priority':_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});_0x2c1e70['push']({'type':_0xc801f7[_0x43f1('0x4')][_0x43f1('0x37')](),'app':_0x43f1('0x5'),'appdata':_0x43f1('0x43'),'context':_0x2c91aa['context'],'exten':_0x2c91aa['exten'],'priority':_0xc801f7[_0x43f1('0x34')]['length']+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});}}}}for(var _0x3ae9a5=0x0;_0x3ae9a5<_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')];_0x3ae9a5++){var _0x29efa8=_0x28f443+_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')];var _0x49e560=_0x3ae9a5===_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]-0x1?_0x28f443+_0x2c1e70[_0x43f1('0x26')]+_0x4c05c3['length']+0x2:_0x28f443+_0x3ae9a5+0x1;_0x2c1e70[_0x43f1('0x44')](_0x3ae9a5,0x0,{'type':_0x2c91aa[_0x43f1('0x4')],'app':'GotoIfTime','appdata':_0xc801f7[_0x43f1('0x34')][_0x3ae9a5]+'?'+_0x2c91aa[_0x43f1('0x7')]+_0x43f1('0x45')+_0x29efa8+':'+_0x2c91aa[_0x43f1('0x7')]+_0x43f1('0x45')+_0x49e560,'exten':_0x2c91aa[_0x43f1('0x8')],'context':_0x2c91aa['context'],'priority':_0x28f443+_0x3ae9a5,'VoiceExtensionId':_0x2c91aa['id']});}if(_0xc801f7[_0x43f1('0x46')]===_0x43f1('0x47')){_0xc801f7[_0x43f1('0x48')]=_0x30d27a(_0x2c91aa,_0xc801f7[_0x43f1('0x48')]);}if(_0xc801f7[_0x43f1('0x46')]==='agi'){_0x2c1e70['push']({'type':_0xc801f7[_0x43f1('0x4')][_0x43f1('0x37')](),'app':_0x43f1('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2c91aa[_0x43f1('0x7')],'exten':_0x2c91aa[_0x43f1('0x8')],'priority':_0xc801f7[_0x43f1('0x34')][_0x43f1('0x26')]+_0x28f443+_0x24726b++,'VoiceExtensionId':_0x2c91aa['id']});}_0xc801f7[_0x43f1('0x49')]=_0x2c1e70[_0x43f1('0x26')]?_[_0x43f1('0x4a')](_0x2c1e70)[_0x43f1('0x49')]+0x1:_0x28f443;_0x6b50bb=_['concat'](_0x6b50bb,_0x2c1e70,[_0xc801f7],_0x4c05c3);_0x28f443=_[_0x43f1('0x4a')](_0x6b50bb)[_0x43f1('0x49')]+0x1;}return _0x5c06f2(_0x6b50bb);})[_0x43f1('0x4b')](function(_0x1fb827){_0xf02543(_0x1fb827);});});}return _0x14085a['define'](_0x43f1('0x4c'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4e5565){var _0xa848ee=this[_0x43f1('0x4d')]({'plain':!![]});var _0x1a3ab3=_0xa848ee[_0x43f1('0x4')]===_0x43f1('0x12')?_0x273c67(_0xa848ee):_0x1dbd9c(_0xa848ee);return _0x52f49d(_0xa848ee,_0x4e5565,_[_0x43f1('0x4a')](_0x1a3ab3)[_0x43f1('0x49')]+0x1)[_0x43f1('0x32')](function(_0x1a25ab){var _0x2cafc0=_[_0x43f1('0x4e')](_0x1a3ab3,_0x1a25ab);_0x2cafc0[_0x43f1('0xd')]({'type':_0xa848ee[_0x43f1('0x4')],'app':'Hangup','exten':_0xa848ee['exten'],'context':_0xa848ee[_0x43f1('0x7')],'priority':_[_0x43f1('0x4a')](_0x2cafc0)[_0x43f1('0x49')]+0x1,'VoiceExtensionId':_0xa848ee['id']});return _0x2cafc0;});}}});}; \ No newline at end of file +var _0xa467=['NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','wav','options','split','length','trunk','param','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','IntervalId','*,*,*,*','intervals','interval','map','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','includes','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','priority','define','VoiceExtension','voice_extensions','then','Hangup','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','context','exten','type','alias'];(function(_0x125ab7,_0x2a1c41){var _0x5e3009=function(_0x5cb5b5){while(--_0x5cb5b5){_0x125ab7['push'](_0x125ab7['shift']());}};_0x5e3009(++_0x2a1c41);}(_0xa467,0xde));var _0x7a46=function(_0x140f21,_0x5a7cee){_0x140f21=_0x140f21-0x0;var _0x29d2f0=_0xa467[_0x140f21];return _0x29d2f0;};'use strict';var _=require(_0x7a46('0x0'));var attributes=require(_0x7a46('0x1'));module[_0x7a46('0x2')]=function(_0x46f0ea){var _0x2b1a88=_0x46f0ea[_0x7a46('0x3')];function _0xf0bef0(_0x55c4a7){var _0x1a39bf=0x2;var _0x5d2e0b=[{'type':_0x55c4a7['type'],'app':'Set','appdata':_0x7a46('0x4')+_0x55c4a7['type'],'context':_0x55c4a7[_0x7a46('0x5')],'exten':_0x55c4a7[_0x7a46('0x6')],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']},{'type':_0x55c4a7[_0x7a46('0x7')],'app':_0x55c4a7[_0x7a46('0x8')]?'Set':_0x7a46('0x9'),'appdata':_0x55c4a7['alias']?_0x7a46('0xa')+_0x55c4a7[_0x7a46('0x8')]:'No\x20alias\x20set','context':_0x55c4a7[_0x7a46('0x5')],'exten':_0x55c4a7['exten'],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']}];if(_0x55c4a7[_0x7a46('0x7')]==='inbound'){_0x5d2e0b['push']({'type':_0x7a46('0xb'),'app':'Set','appdata':_0x7a46('0xc')+_0x55c4a7['id'],'context':_0x55c4a7[_0x7a46('0x5')],'exten':_0x55c4a7[_0x7a46('0x6')],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']});}_0x5d2e0b[_0x7a46('0xd')]({'type':_0x55c4a7[_0x7a46('0x7')],'app':_0x7a46('0xe'),'appdata':_0x7a46('0xf'),'context':_0x55c4a7['context'],'exten':_0x55c4a7[_0x7a46('0x6')],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']},{'type':_0x55c4a7['type'],'app':_0x7a46('0xe'),'appdata':_0x7a46('0x10'),'context':_0x55c4a7[_0x7a46('0x5')],'exten':_0x55c4a7[_0x7a46('0x6')],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']},{'type':_0x55c4a7['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x55c4a7[_0x7a46('0x5')],'exten':_0x55c4a7[_0x7a46('0x6')],'priority':_0x1a39bf++,'VoiceExtensionId':_0x55c4a7['id']});return _0x5d2e0b;}function _0x5cc32f(_0x5e8497){var _0x16dd53=0x2;var _0x29cf9d=[{'type':_0x7a46('0x11'),'app':'Set','appdata':_0x7a46('0x12'),'context':_0x5e8497['context'],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x5e8497[_0x7a46('0x8')]?_0x7a46('0xe'):'NoOp','appdata':_0x5e8497[_0x7a46('0x8')]?_0x7a46('0xa')+_0x5e8497['alias']:_0x7a46('0x13'),'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497['exten'],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':'outbound','app':'Set','appdata':_0x7a46('0x14')+(_0x5e8497[_0x7a46('0x15')]?_0x7a46('0x16')+_0x5e8497[_0x7a46('0x15')]+'}':_0x7a46('0x17')),'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x7a46('0xe'),'appdata':_0x7a46('0xc')+_0x5e8497['id'],'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x7a46('0x18'),'appdata':_0x7a46('0x19')+(_0x16dd53+0x2)+_0x7a46('0x1a')+(_0x16dd53+0x1)+')','context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x7a46('0xe'),'appdata':_0x5e8497[_0x7a46('0x15')]?_0x7a46('0x1b')+_0x5e8497[_0x7a46('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':'outbound','app':'Set','appdata':_0x7a46('0xf'),'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':'Set','appdata':_0x7a46('0x10'),'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x7a46('0xe'),'appdata':_0x7a46('0x1c'),'context':_0x5e8497['context'],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':'outbound','app':_0x7a46('0xe'),'appdata':_0x7a46('0x1d')+_0x5e8497['id'],'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497[_0x7a46('0x6')],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']}];if(_0x5e8497[_0x7a46('0x1e')](_0x7a46('0x1f'))&&_0x5e8497['recordingFormat']!=='none'){_0x29cf9d[_0x7a46('0xd')]({'type':_0x7a46('0x11'),'app':_0x7a46('0xe'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497['exten'],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']},{'type':_0x7a46('0x11'),'app':_0x7a46('0xe'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5e8497[_0x7a46('0x1f')]||_0x7a46('0x20'),'context':_0x5e8497[_0x7a46('0x5')],'exten':_0x5e8497['exten'],'priority':_0x16dd53++,'VoiceExtensionId':_0x5e8497['id']});}return _0x29cf9d;}function _0x429264(_0x2426ed,_0x4c5baa){var _0x431392=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x7a46('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x4e646e={};var _0x40fbe8=_0x4c5baa[_0x7a46('0x22')](',');var _0x1c2721=[];for(var _0x21191f=0x0;_0x21191f<_0x431392[_0x7a46('0x23')];_0x21191f++){switch(_0x431392[_0x21191f]['name']){case _0x7a46('0x24'):_0x4e646e[_0x7a46('0x24')]=_0x40fbe8[_0x431392[_0x21191f][_0x7a46('0x25')]][_0x7a46('0x22')]('/')[0x1];_0x4e646e[_0x7a46('0x26')]=_0x40fbe8[_0x431392[_0x21191f][_0x7a46('0x25')]]['split']('/')[0x2];_0x4e646e[_0x7a46('0x27')]=_0x4e646e[_0x7a46('0x26')]?_0x4e646e[_0x7a46('0x26')][_0x7a46('0x22')]('$')[0x0]:undefined;_0x4e646e[_0x7a46('0x26')]=_0x2426ed['cutdigits']?(_0x4e646e[_0x7a46('0x27')]||'')+_0x7a46('0x16')+_0x2426ed[_0x7a46('0x15')]+'}':(_0x4e646e[_0x7a46('0x27')]||'')+_0x7a46('0x17');_0x1c2721[_0x431392[_0x21191f][_0x7a46('0x25')]]=[_0x7a46('0x28'),_0x4e646e['trunk'],_0x4e646e[_0x7a46('0x26')]]['join']('/');break;case'options':_0x4e646e[_0x7a46('0x21')]=_0x40fbe8[_0x431392[_0x21191f][_0x7a46('0x25')]];if(_0x2426ed['recordingFormat']!=='none'){if(_0x4e646e[_0x7a46('0x21')][_0x7a46('0x29')](_0x7a46('0x2a'))<0x0){_0x4e646e[_0x7a46('0x21')]+=_0x7a46('0x2a');}}else{_0x4e646e['options']=_0x4e646e[_0x7a46('0x21')][_0x7a46('0x2b')]('U(xcally-mixmonitor-context)','');}_0x1c2721[_0x431392[_0x21191f][_0x7a46('0x25')]]=_0x4e646e[_0x7a46('0x21')];break;default:_0x1c2721[_0x431392[_0x21191f][_0x7a46('0x25')]]=_0x40fbe8[_0x431392[_0x21191f]['param']];}}return _0x1c2721[_0x7a46('0x2c')](',');}function _0x24f324(_0x182e98,_0x207c9e,_0x2a2c4d){return new Promise(function(_0x3f8165,_0x47095e){var _0x2c6884=[];if(_['isEmpty'](_0x207c9e))return _0x3f8165(_0x2c6884);_0x2b1a88[_0x7a46('0x2d')]['findAll']({'attributes':['id','interval',_0x7a46('0x2e')],'raw':!![]})['then'](function(_0x15ee7d){for(var _0x22b576=0x0,_0x51a968=0x0;_0x22b576<_0x207c9e[_0x7a46('0x23')];_0x22b576++,_0x51a968=0x0){var _0xc2a742=_0x207c9e[_0x22b576];var _0x7bd2db=[];var _0x33aacb=[];delete _0xc2a742['id'];if(_0xc2a742['interval']!==_0x7a46('0x2f')){_0xc2a742[_0x7a46('0x30')]=[_0xc2a742[_0x7a46('0x31')]];}else{_0xc2a742['intervals']=_0xc2a742[_0x7a46('0x2e')]?_[_0x7a46('0x32')](_['filter'](_0x15ee7d,{'IntervalId':_0xc2a742[_0x7a46('0x2e')]}),_0x7a46('0x31')):[];}_0xc2a742[_0x7a46('0x5')]=_0x182e98[_0x7a46('0x5')];_0xc2a742[_0x7a46('0x6')]=_0x182e98[_0x7a46('0x6')];if(_0xc2a742[_0x7a46('0x7')])_0xc2a742[_0x7a46('0x7')]=_0xc2a742[_0x7a46('0x7')]['toLowerCase']();if(_0x182e98['type']===_0x7a46('0x11')){if(_0xc2a742[_0x7a46('0x1e')](_0x7a46('0x33'))&&_0xc2a742['tag']&&_0xc2a742[_0x7a46('0x33')]!=='--'){_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742[_0x7a46('0x7')]['toLowerCase'](),'app':_0x7a46('0xe'),'appdata':_0x7a46('0x34')+_0xc2a742['tag'],'context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});}_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742[_0x7a46('0x7')][_0x7a46('0x35')](),'app':_0x7a46('0x18'),'appdata':_0x7a46('0x36')+(_0xc2a742[_0x7a46('0x37')]?_0x7a46('0x38')+_0xc2a742[_0x7a46('0x37')]+')':'NoOp(No\x20number\x20available)'),'context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});}else{if(_0xc2a742[_0x7a46('0x1e')]('answer')){if(['queue','playback'][_0x7a46('0x39')](_0xc2a742['app'][_0x7a46('0x35')]())&&_0xc2a742[_0x7a46('0x3a')]!==_0x7a46('0x3b')){if(_0xc2a742[_0x7a46('0x3c')]){_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x7a46('0x3d'),'context':_0x182e98['context'],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});_0x7bd2db['push']({'type':_0xc2a742['type'][_0x7a46('0x35')](),'app':_0x7a46('0xe'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});}else{_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742['type'][_0x7a46('0x35')](),'app':'ExecIf','appdata':_0x7a46('0x3e'),'context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742[_0x7a46('0x7')]['toLowerCase'](),'app':'Set','appdata':_0x7a46('0x3f'),'context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742['intervals'][_0x7a46('0x23')]+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});}}}}for(var _0x1b071d=0x0;_0x1b071d<_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')];_0x1b071d++){var _0x1d0001=_0x2a2c4d+_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')];var _0x13a74e=_0x1b071d===_0xc2a742[_0x7a46('0x30')][_0x7a46('0x23')]-0x1?_0x2a2c4d+_0x7bd2db['length']+_0x33aacb['length']+0x2:_0x2a2c4d+_0x1b071d+0x1;_0x7bd2db[_0x7a46('0x40')](_0x1b071d,0x0,{'type':_0x182e98[_0x7a46('0x7')],'app':'GotoIfTime','appdata':_0xc2a742['intervals'][_0x1b071d]+'?'+_0x182e98[_0x7a46('0x5')]+_0x7a46('0x41')+_0x1d0001+':'+_0x182e98[_0x7a46('0x5')]+_0x7a46('0x41')+_0x13a74e,'exten':_0x182e98['exten'],'context':_0x182e98[_0x7a46('0x5')],'priority':_0x2a2c4d+_0x1b071d,'VoiceExtensionId':_0x182e98['id']});}if(_0xc2a742[_0x7a46('0x3a')]===_0x7a46('0x42')){_0xc2a742['appdata']=_0x429264(_0x182e98,_0xc2a742['appdata']);}if(_0xc2a742['appType']===_0x7a46('0x43')){_0x7bd2db[_0x7a46('0xd')]({'type':_0xc2a742['type'][_0x7a46('0x35')](),'app':_0x7a46('0xe'),'appdata':_0x7a46('0x44'),'context':_0x182e98[_0x7a46('0x5')],'exten':_0x182e98[_0x7a46('0x6')],'priority':_0xc2a742[_0x7a46('0x30')]['length']+_0x2a2c4d+_0x51a968++,'VoiceExtensionId':_0x182e98['id']});}_0xc2a742['priority']=_0x7bd2db[_0x7a46('0x23')]?_[_0x7a46('0x45')](_0x7bd2db)['priority']+0x1:_0x2a2c4d;_0x2c6884=_[_0x7a46('0x46')](_0x2c6884,_0x7bd2db,[_0xc2a742],_0x33aacb);_0x2a2c4d=_[_0x7a46('0x45')](_0x2c6884)[_0x7a46('0x47')]+0x1;}return _0x3f8165(_0x2c6884);})['catch'](function(_0x314c87){_0x47095e(_0x314c87);});});}return _0x46f0ea[_0x7a46('0x48')](_0x7a46('0x49'),attributes,{'tableName':_0x7a46('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x59693c){var _0x42de8d=this['get']({'plain':!![]});var _0x500d7f=_0x42de8d[_0x7a46('0x7')]===_0x7a46('0x11')?_0x5cc32f(_0x42de8d):_0xf0bef0(_0x42de8d);return _0x24f324(_0x42de8d,_0x59693c,_['last'](_0x500d7f)['priority']+0x1)[_0x7a46('0x4b')](function(_0x513e0c){var _0x3e9ab9=_[_0x7a46('0x46')](_0x500d7f,_0x513e0c);_0x3e9ab9[_0x7a46('0xd')]({'type':_0x42de8d['type'],'app':_0x7a46('0x4c'),'exten':_0x42de8d[_0x7a46('0x6')],'context':_0x42de8d['context'],'priority':_[_0x7a46('0x45')](_0x3e9ab9)[_0x7a46('0x47')]+0x1,'VoiceExtensionId':_0x42de8d['id']});return _0x3e9ab9;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 922351c..81c534f 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 _0x4312=['defaults','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceExtension','findAll','options','where','limit','map','include','model','attributes','GetVoiceExtension','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x4312,0xaf));var _0x2431=function(_0x50fe15,_0x4c1401){_0x50fe15=_0x50fe15-0x0;var _0x59299b=_0x4312[_0x50fe15];return _0x59299b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2431('0x0'));var BPromise=require(_0x2431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x2'));var db=require(_0x2431('0x3'))['db'];var utils=require(_0x2431('0x4'));var logger=require(_0x2431('0x5'))(_0x2431('0x6'));var config=require(_0x2431('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x8')]['http']({'port':0x232a});config[_0x2431('0x9')]=_[_0x2431('0xa')](config['redis'],{'host':_0x2431('0xb'),'port':0x18eb});var socket=require(_0x2431('0xc'))(new Redis(config[_0x2431('0x9')]));require('./voiceExtension.socket')[_0x2431('0xd')](socket);function respondWithRpcPromise(_0x26b223,_0xb751e,_0x568a96){return new BPromise(function(_0x12615b,_0x4a71f2){return client[_0x2431('0xe')](_0x26b223,_0x568a96)[_0x2431('0xf')](function(_0x384711){logger['info'](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));logger[_0x2431('0x12')](_0x2431('0x13'),_0xb751e,'request\x20sent',JSON[_0x2431('0x14')](_0x384711));if(_0x384711[_0x2431('0x15')]){if(_0x384711[_0x2431('0x15')][_0x2431('0x16')]===0x1f4){logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x4a71f2(_0x384711[_0x2431('0x15')]['message']);}logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x12615b(_0x384711[_0x2431('0x15')][_0x2431('0x17')]);}else{logger[_0x2431('0x18')](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));_0x12615b(_0x384711[_0x2431('0x19')][_0x2431('0x17')]);}})[_0x2431('0x1a')](function(_0x3b1776){logger[_0x2431('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xb751e,_0x3b1776);_0x4a71f2(_0x3b1776);});});}exports['GetVoiceExtension']=function(_0x3b4fa0){var _0x41b5df=this;return new Promise(function(_0x2e6b2b,_0x51d1ef){return db[_0x2431('0x1b')][_0x2431('0x1c')]({'raw':_0x3b4fa0['options']?_0x3b4fa0['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b4fa0['options']?_0x3b4fa0[_0x2431('0x1d')][_0x2431('0x1e')]||null:null,'attributes':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0[_0x2431('0x1d')]['attributes']||null:null,'limit':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0['options'][_0x2431('0x1f')]||null:null,'include':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0[_0x2431('0x1d')]['include']?_[_0x2431('0x20')](_0x3b4fa0[_0x2431('0x1d')][_0x2431('0x21')],function(_0x55914b){return{'model':db[_0x55914b['model']],'as':_0x55914b['as'],'attributes':_0x55914b['attributes'],'include':_0x55914b[_0x2431('0x21')]?_['map'](_0x55914b[_0x2431('0x21')],function(_0xf7afb5){return{'model':db[_0xf7afb5[_0x2431('0x22')]],'as':_0xf7afb5['as'],'attributes':_0xf7afb5[_0x2431('0x23')],'include':_0xf7afb5['include']?_['map'](_0xf7afb5[_0x2431('0x21')],function(_0x3954cc){return{'model':db[_0x3954cc['model']],'as':_0x3954cc['as'],'attributes':_0x3954cc[_0x2431('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2431('0xf')](function(_0x5842fb){logger[_0x2431('0x18')](_0x2431('0x24'),_0x3b4fa0);logger['debug'](_0x2431('0x24'),_0x3b4fa0,JSON[_0x2431('0x14')](_0x5842fb));_0x2e6b2b(_0x5842fb);})[_0x2431('0x1a')](function(_0x141478){logger[_0x2431('0x15')](_0x2431('0x24'),_0x141478[_0x2431('0x17')],_0x3b4fa0);_0x51d1ef(_0x41b5df[_0x2431('0x15')](0x1f4,_0x141478[_0x2431('0x17')]));});});}; \ No newline at end of file +var _0x9a96=['VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc0ae59,_0xf24b6f){var _0x2eeca9=function(_0x40ff6a){while(--_0x40ff6a){_0xc0ae59['push'](_0xc0ae59['shift']());}};_0x2eeca9(++_0xf24b6f);}(_0x9a96,0xd0));var _0x69a9=function(_0x205a5c,_0x58c037){_0x205a5c=_0x205a5c-0x0;var _0x5930a9=_0x9a96[_0x205a5c];return _0x5930a9;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var moment=require(_0x69a9('0x2'));var BPromise=require(_0x69a9('0x3'));var rs=require(_0x69a9('0x4'));var fs=require('fs');var Redis=require(_0x69a9('0x5'));var db=require(_0x69a9('0x6'))['db'];var utils=require(_0x69a9('0x7'));var logger=require(_0x69a9('0x8'))(_0x69a9('0x9'));var config=require(_0x69a9('0xa'));var jayson=require(_0x69a9('0xb'));var client=jayson['client'][_0x69a9('0xc')]({'port':0x232a});config[_0x69a9('0xd')]=_[_0x69a9('0xe')](config[_0x69a9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x69a9('0xf'))(new Redis(config[_0x69a9('0xd')]));require(_0x69a9('0x10'))[_0x69a9('0x11')](socket);function respondWithRpcPromise(_0x510cee,_0x15b6c7,_0x1dbcdb){return new BPromise(function(_0x5f3217,_0x4382d4){return client['request'](_0x510cee,_0x1dbcdb)[_0x69a9('0x12')](function(_0xb6e00f){logger[_0x69a9('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x15b6c7,_0x69a9('0x14'));logger[_0x69a9('0x15')](_0x69a9('0x16'),_0x15b6c7,_0x69a9('0x14'),JSON[_0x69a9('0x17')](_0xb6e00f));if(_0xb6e00f[_0x69a9('0x18')]){if(_0xb6e00f[_0x69a9('0x18')][_0x69a9('0x19')]===0x1f4){logger['error'](_0x69a9('0x1a'),_0x15b6c7,_0xb6e00f[_0x69a9('0x18')][_0x69a9('0x1b')]);return _0x4382d4(_0xb6e00f[_0x69a9('0x18')][_0x69a9('0x1b')]);}logger[_0x69a9('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x15b6c7,_0xb6e00f['error'][_0x69a9('0x1b')]);return _0x5f3217(_0xb6e00f[_0x69a9('0x18')][_0x69a9('0x1b')]);}else{logger['info'](_0x69a9('0x1a'),_0x15b6c7,_0x69a9('0x14'));_0x5f3217(_0xb6e00f[_0x69a9('0x1c')][_0x69a9('0x1b')]);}})[_0x69a9('0x1d')](function(_0x38d6cf){logger[_0x69a9('0x18')](_0x69a9('0x1a'),_0x15b6c7,_0x38d6cf);_0x4382d4(_0x38d6cf);});});}exports[_0x69a9('0x1e')]=function(_0x28b75b){var _0x4985bf=this;return new Promise(function(_0x59b6af,_0xcc835){return db[_0x69a9('0x1f')][_0x69a9('0x20')]({'raw':_0x28b75b['options']?_0x28b75b['options']['raw']===undefined?!![]:![]:!![],'where':_0x28b75b['options']?_0x28b75b[_0x69a9('0x21')][_0x69a9('0x22')]||null:null,'attributes':_0x28b75b[_0x69a9('0x21')]?_0x28b75b[_0x69a9('0x21')][_0x69a9('0x23')]||null:null,'limit':_0x28b75b['options']?_0x28b75b['options']['limit']||null:null,'include':_0x28b75b['options']?_0x28b75b[_0x69a9('0x21')][_0x69a9('0x24')]?_['map'](_0x28b75b['options']['include'],function(_0x4685e3){return{'model':db[_0x4685e3[_0x69a9('0x25')]],'as':_0x4685e3['as'],'attributes':_0x4685e3['attributes'],'include':_0x4685e3[_0x69a9('0x24')]?_[_0x69a9('0x26')](_0x4685e3['include'],function(_0x44cbbc){return{'model':db[_0x44cbbc['model']],'as':_0x44cbbc['as'],'attributes':_0x44cbbc[_0x69a9('0x23')],'include':_0x44cbbc[_0x69a9('0x24')]?_[_0x69a9('0x26')](_0x44cbbc[_0x69a9('0x24')],function(_0x2299b2){return{'model':db[_0x2299b2[_0x69a9('0x25')]],'as':_0x2299b2['as'],'attributes':_0x2299b2[_0x69a9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x69a9('0x12')](function(_0xc68890){logger[_0x69a9('0x13')](_0x69a9('0x1e'),_0x28b75b);logger['debug'](_0x69a9('0x1e'),_0x28b75b,JSON[_0x69a9('0x17')](_0xc68890));_0x59b6af(_0xc68890);})[_0x69a9('0x1d')](function(_0x4dcf96){logger[_0x69a9('0x18')](_0x69a9('0x1e'),_0x4dcf96[_0x69a9('0x1b')],_0x28b75b);_0xcc835(_0x4985bf[_0x69a9('0x18')](0x1f4,_0x4dcf96[_0x69a9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c9c18b6..8093d60 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x4b6a6f,_0x3cefe1){var _0xd0c0fe=function(_0x5e83fe){while(--_0x5e83fe){_0x4b6a6f['push'](_0x4b6a6f['shift']());}};_0xd0c0fe(++_0x3cefe1);}(_0xe14b,0x93));var _0xbe14=function(_0x4e4509,_0x1eb039){_0x4e4509=_0x4e4509-0x0;var _0x783c02=_0xe14b[_0x4e4509];return _0x783c02;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x436e4c,_0x3754f9){var _0x383d70=function(_0x22bfd4){while(--_0x22bfd4){_0x436e4c['push'](_0x436e4c['shift']());}};_0x383d70(++_0x3754f9);}(_0x326f,0xd1));var _0xf326=function(_0x298af3,_0x194ba3){_0x298af3=_0x298af3-0x0;var _0x5886cc=_0x326f[_0x298af3];return _0x5886cc;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 182d7c1..3ab2d7c 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 _0xc1c6=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getMessages','create','put','update','delete','destroy','exports'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5a7959,_0x89571f){_0x5a7959=_0x5a7959-0x0;var _0x11121a=_0xc1c6[_0x5a7959];return _0x11121a;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id/messages',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['post']('/',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xd')]);router[_0x6c1c('0xe')](_0x6c1c('0x9'),auth['isAuthenticated'](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')](_0x6c1c('0x9'),auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','create','put'];(function(_0x3bcfbd,_0x337e00){var _0x46e92b=function(_0x3afbf2){while(--_0x3afbf2){_0x3bcfbd['push'](_0x3bcfbd['shift']());}};_0x46e92b(++_0x337e00);}(_0x53ec,0x192));var _0xc53e=function(_0x56c4de,_0xf1c874){_0x56c4de=_0x56c4de-0x0;var _0xd799af=_0x53ec[_0x56c4de];return _0xd799af;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e9f39dc..5b466da 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 _0xfd90=['INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd90,0xfd));var _0x0fd9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfd90[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0fd9('0x0'));module[_0x0fd9('0x1')]={'customer_id':{'type':Sequelize[_0x0fd9('0x2')]},'context':{'type':Sequelize[_0x0fd9('0x2')],'defaultValue':_0x0fd9('0x3'),'unique':_0x0fd9('0x4')},'mailbox':{'type':Sequelize[_0x0fd9('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0fd9('0x2')]},'fullname':{'type':Sequelize[_0x0fd9('0x2')]},'email':{'type':Sequelize[_0x0fd9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x326a50){this[_0x0fd9('0x5')](_0x0fd9('0x6'),typeof _0x326a50==='string'&&_0x326a50[_0x0fd9('0x7')]()?_0x326a50[_0x0fd9('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0fd9('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0fd9('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0fd9('0xa')]('yes','no'),'defaultValue':_0x0fd9('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0fd9('0x2')]},'callback':{'type':Sequelize[_0x0fd9('0x2')]},'review':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0fd9('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0fd9('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0fd9('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':_0x0fd9('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0fd9('0xa')](_0x0fd9('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0fd9('0xc')},'emailsubject':{'type':Sequelize[_0x0fd9('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x0fd9('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0fd9('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0fd9('0xe')],'get':function(){return this['getDataValue'](_0x0fd9('0xf'))+_0x0fd9('0x10')+this[_0x0fd9('0x11')](_0x0fd9('0x12'));}}}; \ No newline at end of file +var _0xd85e=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x36bb1f,_0x1c8317){var _0x4c1228=function(_0x5497af){while(--_0x5497af){_0x36bb1f['push'](_0x36bb1f['shift']());}};_0x4c1228(++_0x1c8317);}(_0xd85e,0x1db));var _0xed85=function(_0x3a90d6,_0x5a15ca){_0x3a90d6=_0x3a90d6-0x0;var _0x4d079c=_0xd85e[_0x3a90d6];return _0x4d079c;};'use strict';var Sequelize=require('sequelize');module[_0xed85('0x0')]={'customer_id':{'type':Sequelize[_0xed85('0x1')]},'context':{'type':Sequelize[_0xed85('0x1')],'defaultValue':_0xed85('0x2'),'unique':_0xed85('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xed85('0x3')},'password':{'type':Sequelize[_0xed85('0x1')]},'fullname':{'type':Sequelize[_0xed85('0x1')]},'email':{'type':Sequelize[_0xed85('0x1')],'validate':{'isEmail':!![]},'set':function(_0x594648){this[_0xed85('0x4')]('email',typeof _0x594648==='string'&&_0x594648['trim']()?_0x594648['trim']():null);}},'pager':{'type':Sequelize[_0xed85('0x1')]},'tz':{'type':Sequelize[_0xed85('0x1')],'defaultValue':_0xed85('0x5')},'attach':{'type':Sequelize[_0xed85('0x6')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xed85('0x6')]('yes','no'),'defaultValue':_0xed85('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xed85('0x1')]},'review':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xed85('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':_0xed85('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xed85('0x6')](_0xed85('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xed85('0x6')]('yes','no'),'defaultValue':_0xed85('0x7'),'allowNull':![]},'stamp':{'type':_0xed85('0x9')},'emailsubject':{'type':Sequelize[_0xed85('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xed85('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xed85('0xb')],'get':function(){return this['getDataValue'](_0xed85('0xc'))+_0xed85('0xd')+this[_0xed85('0xe')](_0xed85('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f5e25e4..70c6e72 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 _0x0102=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','get','Voicemails','destroy','then','sendStatus','stack','name','send','index','VoiceMail'];(function(_0x4a6970,_0x291aa1){var _0x4b36c5=function(_0x2d8363){while(--_0x2d8363){_0x4a6970['push'](_0x4a6970['shift']());}};_0x4b36c5(++_0x291aa1);}(_0x0102,0x186));var _0x2010=function(_0x26c2b6,_0x3fdc0d){_0x26c2b6=_0x26c2b6-0x0;var _0x261a50=_0x0102[_0x26c2b6];return _0x261a50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){var _0xdb57be=_0x277dcc[_0x2010('0x23')]({'plain':!![]});var _0x52b4fe=_0x2010('0x24');return db['UserProfileResource'][_0x2010('0x25')]({'where':{'type':_0x52b4fe,'resourceId':_0xdb57be['id']}})[_0x2010('0x26')](function(){return _0x277dcc;});})[_0x2010('0x26')](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x2f63bb,_0x981b65){return function(_0x3eb4dc){if(!_0x3eb4dc){_0x2f63bb[_0x2010('0x27')](0x194);}return _0x3eb4dc;};}function handleError(_0x103460,_0x122ee3){_0x122ee3=_0x122ee3||0x1f4;return function(_0x2ebdbb){logger['error'](_0x2ebdbb[_0x2010('0x28')]);if(_0x2ebdbb['name']){delete _0x2ebdbb[_0x2010('0x29')];}_0x103460[_0x2010('0x19')](_0x122ee3)[_0x2010('0x2a')](_0x2ebdbb);};}exports[_0x2010('0x2b')]=function(_0x564a64,_0x554f66){var _0x136d5f={},_0x48d9f2={},_0x2839f2={'count':0x0,'rows':[]};var _0x1d5d7a=_['map'](db[_0x2010('0x2c')][_0x2010('0x2d')],function(_0x2b1ff7){return{'name':_0x2b1ff7[_0x2010('0x2e')],'type':_0x2b1ff7[_0x2010('0x2f')]['key']};});_0x48d9f2[_0x2010('0x30')]=_[_0x2010('0x31')](_0x1d5d7a,_0x2010('0x29'));_0x48d9f2['query']=_['keys'](_0x564a64[_0x2010('0x32')]);_0x48d9f2[_0x2010('0x33')]=_[_0x2010('0x34')](_0x48d9f2['model'],_0x48d9f2['query']);_0x136d5f[_0x2010('0x35')]=_[_0x2010('0x34')](_0x48d9f2[_0x2010('0x30')],qs[_0x2010('0x36')](_0x564a64[_0x2010('0x32')]['fields']));_0x136d5f['attributes']=_0x136d5f['attributes'][_0x2010('0x37')]?_0x136d5f[_0x2010('0x35')]:_0x48d9f2[_0x2010('0x30')];if(!_0x564a64['query'][_0x2010('0x38')](_0x2010('0x39'))){_0x136d5f[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x564a64['query'][_0x2010('0x1d')]);_0x136d5f[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x564a64['query'][_0x2010('0x1b')]);}_0x136d5f['order']=qs[_0x2010('0x3a')](_0x564a64[_0x2010('0x32')][_0x2010('0x3a')]);_0x136d5f[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x564a64['query'],_0x48d9f2[_0x2010('0x33')]),_0x1d5d7a);if(_0x564a64['query'][_0x2010('0x3d')]){_0x136d5f[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x136d5f[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x1d5d7a,function(_0x1f053c){if(_0x1f053c[_0x2010('0x2f')]!==_0x2010('0x3f')){var _0x2fcaef={};_0x2fcaef[_0x1f053c[_0x2010('0x29')]]={'$like':'%'+_0x564a64[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x2fcaef;}})});}_0x136d5f=_[_0x2010('0x3e')]({},_0x136d5f,_0x564a64[_0x2010('0x40')]);var _0x4b6251={'where':_0x136d5f['where']};return db[_0x2010('0x2c')][_0x2010('0x1e')](_0x4b6251)[_0x2010('0x26')](function(_0x35d631){_0x2839f2[_0x2010('0x1e')]=_0x35d631;if(_0x564a64[_0x2010('0x32')][_0x2010('0x41')]){_0x136d5f['include']=[{'all':!![]}];}return db[_0x2010('0x2c')]['findAll'](_0x136d5f);})[_0x2010('0x26')](function(_0x3ff496){_0x2839f2[_0x2010('0x42')]=_0x3ff496;return _0x2839f2;})[_0x2010('0x26')](respondWithFilteredResult(_0x554f66,_0x136d5f))[_0x2010('0x43')](handleError(_0x554f66,null));};exports['show']=function(_0x364338,_0x71eb35){var _0x3dd83c={'raw':!![],'where':{'id':_0x364338['params']['id']}},_0x41b3b5={};_0x41b3b5[_0x2010('0x30')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x41b3b5[_0x2010('0x32')]=_[_0x2010('0x44')](_0x364338[_0x2010('0x32')]);_0x41b3b5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],_0x41b3b5['query']);_0x3dd83c[_0x2010('0x35')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],qs['fields'](_0x364338['query'][_0x2010('0x36')]));_0x3dd83c['attributes']=_0x3dd83c[_0x2010('0x35')][_0x2010('0x37')]?_0x3dd83c[_0x2010('0x35')]:_0x41b3b5[_0x2010('0x30')];if(_0x364338['query'][_0x2010('0x41')]){_0x3dd83c[_0x2010('0x45')]=[{'all':!![]}];}_0x3dd83c=_[_0x2010('0x3e')]({},_0x3dd83c,_0x364338[_0x2010('0x40')]);return db[_0x2010('0x2c')][_0x2010('0x46')](_0x3dd83c)['then'](handleEntityNotFound(_0x71eb35,null))[_0x2010('0x26')](respondWithResult(_0x71eb35,null))[_0x2010('0x43')](handleError(_0x71eb35,null));};exports[_0x2010('0x47')]=function(_0x4dc0cf,_0x30e5d0){return db[_0x2010('0x2c')]['create'](_0x4dc0cf[_0x2010('0x48')],{})[_0x2010('0x26')](function(_0x110791){var _0x242274=_0x4dc0cf[_0x2010('0x49')][_0x2010('0x23')]({'plain':!![]});if(!_0x242274)throw new Error(_0x2010('0x4a'));if(_0x242274[_0x2010('0x4b')]==='user'){var _0x5258b9=_0x110791[_0x2010('0x23')]({'plain':!![]});var _0xe1721f='Voicemails';return db[_0x2010('0x4c')][_0x2010('0x46')]({'where':{'name':_0xe1721f,'userProfileId':_0x242274[_0x2010('0x4d')]},'raw':!![]})[_0x2010('0x26')](function(_0x1f1a59){if(_0x1f1a59&&_0x1f1a59['autoAssociation']===0x0){return db['UserProfileResource'][_0x2010('0x47')]({'name':_0x5258b9[_0x2010('0x29')],'resourceId':_0x5258b9['id'],'type':_0x1f1a59[_0x2010('0x29')],'sectionId':_0x1f1a59['id']},{})[_0x2010('0x26')](function(){return _0x110791;});}else{return _0x110791;}})[_0x2010('0x43')](function(_0x2d8164){logger[_0x2010('0x4e')](_0x2010('0x4f'),_0x2d8164);throw _0x2d8164;});}return _0x110791;})[_0x2010('0x26')](respondWithResult(_0x30e5d0,0xc9))[_0x2010('0x43')](handleError(_0x30e5d0,null));};exports[_0x2010('0x50')]=function(_0x5313b5,_0x24421a){if(_0x5313b5[_0x2010('0x48')]['id']){delete _0x5313b5['body']['id'];}return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x5313b5[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x24421a,null))[_0x2010('0x26')](saveUpdates(_0x5313b5[_0x2010('0x48')],null))[_0x2010('0x26')](respondWithResult(_0x24421a,null))[_0x2010('0x43')](handleError(_0x24421a,null));};exports[_0x2010('0x25')]=function(_0x2dbc2c,_0x1c0b2d){return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x2dbc2c[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x1c0b2d,null))[_0x2010('0x26')](removeEntity(_0x1c0b2d,null))[_0x2010('0x43')](handleError(_0x1c0b2d,null));};exports[_0x2010('0x52')]=function(_0x2d7765,_0x6f8565,_0x21ee87){return db[_0x2010('0x2c')][_0x2010('0x53')]({'where':{'id':_0x2d7765['params']['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x6f8565,null))['then'](function(_0x5253d5){var _0x1225d7;var _0x13f33d={},_0x4fb5d5={};_0x4fb5d5[_0x2010('0x30')]=_[_0x2010('0x44')](db[_0x2010('0x54')][_0x2010('0x2d')]);_0x4fb5d5['query']=_[_0x2010('0x44')](_0x2d7765[_0x2010('0x32')]);_0x4fb5d5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x4fb5d5['model'],_0x4fb5d5[_0x2010('0x32')]);_0x13f33d['attributes']=_[_0x2010('0x34')](_0x4fb5d5[_0x2010('0x30')],qs[_0x2010('0x36')](_0x2d7765[_0x2010('0x32')]['fields']));_0x13f33d['attributes']=_0x13f33d[_0x2010('0x35')][_0x2010('0x37')]?_0x13f33d['attributes']:_0x4fb5d5['model'];if(!_0x2d7765[_0x2010('0x32')][_0x2010('0x38')](_0x2010('0x39'))){_0x13f33d[_0x2010('0x1d')]=qs['limit'](_0x2d7765[_0x2010('0x32')]['limit']);_0x13f33d[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x2d7765[_0x2010('0x32')][_0x2010('0x1b')]);}_0x13f33d['order']=qs[_0x2010('0x3a')](_0x2d7765[_0x2010('0x32')]['sort']);_0x13f33d[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x2d7765[_0x2010('0x32')],_0x4fb5d5[_0x2010('0x33')]));if(_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]){_0x13f33d[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x13f33d[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x13f33d[_0x2010('0x35')],function(_0x4ebdca){var _0x3ca7b3={};_0x3ca7b3[_0x4ebdca]={'$like':'%'+_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x3ca7b3;})});}_0x13f33d['where']=_['merge'](_0x13f33d[_0x2010('0x3b')],{'mailboxuser':_0x5253d5[_0x2010('0x55')]});_0x13f33d=_[_0x2010('0x3e')]({},_0x13f33d,_0x2d7765[_0x2010('0x40')]);return db[_0x2010('0x54')][_0x2010('0x56')](_0x13f33d)['then'](respondWithFilteredResult(_0x6f8565,_0x13f33d));})[_0x2010('0x43')](handleError(_0x6f8565,null));}; \ No newline at end of file +var _0x1d2d=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','catch','update','find','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x11a06b,_0x5462d8){_0x11a06b=_0x11a06b-0x0;var _0x1c5a82=_0x1d2d[_0x11a06b];return _0x1c5a82;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){var _0x5df4af=_0x3f229c[_0xd1d2('0x28')]({'plain':!![]});var _0x42da6d=_0xd1d2('0x29');return db[_0xd1d2('0x2a')][_0xd1d2('0x27')]({'where':{'type':_0x42da6d,'resourceId':_0x5df4af['id']}})[_0xd1d2('0x26')](function(){return _0x3f229c;});})[_0xd1d2('0x26')](function(){_0x19d535[_0xd1d2('0x1c')](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x384460,_0x3645e9){return function(_0x4e1bc2){if(!_0x4e1bc2){_0x384460['sendStatus'](0x194);}return _0x4e1bc2;};}function handleError(_0x133c6c,_0x442375){_0x442375=_0x442375||0x1f4;return function(_0x1e6072){logger[_0xd1d2('0x2b')](_0x1e6072[_0xd1d2('0x2c')]);if(_0x1e6072['name']){delete _0x1e6072[_0xd1d2('0x2d')];}_0x133c6c[_0xd1d2('0x1c')](_0x442375)[_0xd1d2('0x2e')](_0x1e6072);};}exports['index']=function(_0x19db00,_0x1db17f){var _0xbd855a={},_0x56557d={},_0x419db7={'count':0x0,'rows':[]};var _0x18528f=_[_0xd1d2('0x2f')](db[_0xd1d2('0x30')][_0xd1d2('0x31')],function(_0x14d661){return{'name':_0x14d661[_0xd1d2('0x32')],'type':_0x14d661[_0xd1d2('0x33')][_0xd1d2('0x34')]};});_0x56557d[_0xd1d2('0x35')]=_[_0xd1d2('0x2f')](_0x18528f,_0xd1d2('0x2d'));_0x56557d[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x19db00[_0xd1d2('0x36')]);_0x56557d[_0xd1d2('0x38')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],_0x56557d['query']);_0xbd855a[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],qs['fields'](_0x19db00[_0xd1d2('0x36')]['fields']));_0xbd855a['attributes']=_0xbd855a[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0xbd855a[_0xd1d2('0x3a')]:_0x56557d[_0xd1d2('0x35')];if(!_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x3c')]('nolimit')){_0xbd855a[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x19db00['query'][_0xd1d2('0x21')]);_0xbd855a[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x19db00[_0xd1d2('0x36')]['offset']);}_0xbd855a['order']=qs[_0xd1d2('0x3d')](_0x19db00['query']['sort']);_0xbd855a['where']=qs[_0xd1d2('0x38')](_['pick'](_0x19db00[_0xd1d2('0x36')],_0x56557d['filters']),_0x18528f);if(_0x19db00['query']['filter']){_0xbd855a[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0xbd855a[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x18528f,function(_0x33ba30){if(_0x33ba30[_0xd1d2('0x33')]!==_0xd1d2('0x40')){var _0x38bf16={};_0x38bf16[_0x33ba30[_0xd1d2('0x2d')]]={'$like':'%'+_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x38bf16;}})});}_0xbd855a=_[_0xd1d2('0x3f')]({},_0xbd855a,_0x19db00[_0xd1d2('0x42')]);var _0x18ff05={'where':_0xbd855a['where']};return db['VoiceMail'][_0xd1d2('0x22')](_0x18ff05)[_0xd1d2('0x26')](function(_0x24fc93){_0x419db7['count']=_0x24fc93;if(_0x19db00['query'][_0xd1d2('0x43')]){_0xbd855a[_0xd1d2('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0xd1d2('0x45')](_0xbd855a);})['then'](function(_0x5a3790){_0x419db7[_0xd1d2('0x46')]=_0x5a3790;return _0x419db7;})['then'](respondWithFilteredResult(_0x1db17f,_0xbd855a))['catch'](handleError(_0x1db17f,null));};exports[_0xd1d2('0x47')]=function(_0x320fa4,_0x2a8961){var _0x49dad2={'raw':!![],'where':{'id':_0x320fa4[_0xd1d2('0x48')]['id']}},_0x2ba87b={};_0x2ba87b[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db['VoiceMail'][_0xd1d2('0x31')]);_0x2ba87b[_0xd1d2('0x36')]=_['keys'](_0x320fa4[_0xd1d2('0x36')]);_0x2ba87b['filters']=_[_0xd1d2('0x39')](_0x2ba87b[_0xd1d2('0x35')],_0x2ba87b[_0xd1d2('0x36')]);_0x49dad2[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x2ba87b['model'],qs['fields'](_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x49dad2['attributes']=_0x49dad2[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x49dad2[_0xd1d2('0x3a')]:_0x2ba87b[_0xd1d2('0x35')];if(_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x43')]){_0x49dad2[_0xd1d2('0x44')]=[{'all':!![]}];}_0x49dad2=_['merge']({},_0x49dad2,_0x320fa4[_0xd1d2('0x42')]);return db[_0xd1d2('0x30')]['find'](_0x49dad2)[_0xd1d2('0x26')](handleEntityNotFound(_0x2a8961,null))[_0xd1d2('0x26')](respondWithResult(_0x2a8961,null))['catch'](handleError(_0x2a8961,null));};exports['create']=function(_0x3d4fe3,_0x182ea8){return db['VoiceMail'][_0xd1d2('0x4a')](_0x3d4fe3[_0xd1d2('0x4b')],{})[_0xd1d2('0x26')](function(_0x23ab46){var _0x404ad2=_0x3d4fe3['user']['get']({'plain':!![]});if(!_0x404ad2)throw new Error(_0xd1d2('0x4c'));if(_0x404ad2['role']===_0xd1d2('0x4d')){var _0xcd4b70=_0x23ab46['get']({'plain':!![]});var _0x389fcb=_0xd1d2('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x389fcb,'userProfileId':_0x404ad2[_0xd1d2('0x4e')]},'raw':!![]})[_0xd1d2('0x26')](function(_0x187de4){if(_0x187de4&&_0x187de4[_0xd1d2('0x4f')]===0x0){return db[_0xd1d2('0x2a')][_0xd1d2('0x4a')]({'name':_0xcd4b70[_0xd1d2('0x2d')],'resourceId':_0xcd4b70['id'],'type':_0x187de4[_0xd1d2('0x2d')],'sectionId':_0x187de4['id']},{})[_0xd1d2('0x26')](function(){return _0x23ab46;});}else{return _0x23ab46;}})['catch'](function(_0x1958f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1958f3);throw _0x1958f3;});}return _0x23ab46;})[_0xd1d2('0x26')](respondWithResult(_0x182ea8,0xc9))[_0xd1d2('0x50')](handleError(_0x182ea8,null));};exports[_0xd1d2('0x51')]=function(_0x47417f,_0x215dea){if(_0x47417f[_0xd1d2('0x4b')]['id']){delete _0x47417f[_0xd1d2('0x4b')]['id'];}return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0x47417f[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x215dea,null))[_0xd1d2('0x26')](saveUpdates(_0x47417f[_0xd1d2('0x4b')],null))['then'](respondWithResult(_0x215dea,null))['catch'](handleError(_0x215dea,null));};exports[_0xd1d2('0x27')]=function(_0xd5323d,_0x1562ad){return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0xd5323d[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x1562ad,null))[_0xd1d2('0x26')](removeEntity(_0x1562ad,null))[_0xd1d2('0x50')](handleError(_0x1562ad,null));};exports[_0xd1d2('0x53')]=function(_0x1788cd,_0x54406e,_0x479471){return db[_0xd1d2('0x30')][_0xd1d2('0x54')]({'where':{'id':_0x1788cd[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x54406e,null))['then'](function(_0x17e149){var _0x27c629;var _0x42961d={},_0xaf2acf={};_0xaf2acf[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db[_0xd1d2('0x55')]['rawAttributes']);_0xaf2acf[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x1788cd[_0xd1d2('0x36')]);_0xaf2acf['filters']=_['intersection'](_0xaf2acf[_0xd1d2('0x35')],_0xaf2acf[_0xd1d2('0x36')]);_0x42961d[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0xaf2acf['model'],qs[_0xd1d2('0x49')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x42961d['attributes']=_0x42961d[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x42961d['attributes']:_0xaf2acf[_0xd1d2('0x35')];if(!_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x3c')](_0xd1d2('0x56'))){_0x42961d['limit']=qs[_0xd1d2('0x21')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x21')]);_0x42961d[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1788cd['query']['offset']);}_0x42961d['order']=qs['sort'](_0x1788cd['query'][_0xd1d2('0x3d')]);_0x42961d[_0xd1d2('0x3e')]=qs[_0xd1d2('0x38')](_['pick'](_0x1788cd[_0xd1d2('0x36')],_0xaf2acf[_0xd1d2('0x38')]));if(_0x1788cd[_0xd1d2('0x36')]['filter']){_0x42961d[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x42961d[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x42961d[_0xd1d2('0x3a')],function(_0x1101a3){var _0x4a83f8={};_0x4a83f8[_0x1101a3]={'$like':'%'+_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x4a83f8;})});}_0x42961d['where']=_['merge'](_0x42961d[_0xd1d2('0x3e')],{'mailboxuser':_0x17e149[_0xd1d2('0x57')]});_0x42961d=_[_0xd1d2('0x3f')]({},_0x42961d,_0x1788cd[_0xd1d2('0x42')]);return db['VoiceMailMessage'][_0xd1d2('0x58')](_0x42961d)[_0xd1d2('0x26')](respondWithFilteredResult(_0x54406e,_0x42961d));})[_0xd1d2('0x50')](handleError(_0x54406e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f2a5931..b20e55b 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 _0xc2c0=['rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','../../config/logger','moment','bluebird','path'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc2c0,0xe0));var _0x0c2c=function(_0x141d53,_0x31fd6e){_0x141d53=_0x141d53-0x0;var _0x2c3450=_0xc2c0[_0x141d53];return _0x2c3450;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c2c('0x0'))('api');var moment=require(_0x0c2c('0x1'));var BPromise=require(_0x0c2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c2c('0x3'));var rimraf=require(_0x0c2c('0x4'));var config=require('../../config/environment');var attributes=require(_0x0c2c('0x5'));module[_0x0c2c('0x6')]=function(_0x4bc139,_0x35963d){return _0x4bc139[_0x0c2c('0x7')](_0x0c2c('0x8'),attributes,{'tableName':_0x0c2c('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x0c2c('0xa'),_0x0c2c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe578=['exports','define','VoiceMail','mailbox','context','util','../../config/logger','api','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xe578,0x149));var _0x8e57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe578[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x8e57('0x0'));var logger=require(_0x8e57('0x1'))(_0x8e57('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8e57('0x3'));var fs=require('fs');var path=require(_0x8e57('0x4'));var rimraf=require(_0x8e57('0x5'));var config=require('../../config/environment');var attributes=require(_0x8e57('0x6'));module[_0x8e57('0x7')]=function(_0x5c35b6,_0x5f95d2){return _0x5c35b6[_0x8e57('0x8')](_0x8e57('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8e57('0xa'),_0x8e57('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 4b9a8c0..c486f98 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 _0x28f2=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x163742,_0x488a5f){var _0xb0726c=function(_0x74cadb){while(--_0x74cadb){_0x163742['push'](_0x163742['shift']());}};_0xb0726c(++_0x488a5f);}(_0x28f2,0xaa));var _0x228f=function(_0x4dc88f,_0x2d2c2b){_0x4dc88f=_0x4dc88f-0x0;var _0x4e9790=_0x28f2[_0x4dc88f];return _0x4e9790;};'use strict';var _=require(_0x228f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x228f('0x1'));var rs=require(_0x228f('0x2'));var fs=require('fs');var Redis=require(_0x228f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x228f('0x4'));var config=require(_0x228f('0x5'));var jayson=require(_0x228f('0x6'));var client=jayson[_0x228f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34fa5e,_0x5a2d33,_0x37757){return new BPromise(function(_0x5de01e,_0x33a309){return client[_0x228f('0x8')](_0x34fa5e,_0x37757)[_0x228f('0x9')](function(_0x39739d){logger[_0x228f('0xa')](_0x228f('0xb'),_0x5a2d33,_0x228f('0xc'));logger[_0x228f('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5a2d33,_0x228f('0xc'),JSON[_0x228f('0xe')](_0x39739d));if(_0x39739d['error']){if(_0x39739d[_0x228f('0xf')]['code']===0x1f4){logger[_0x228f('0xf')]('VoiceMail,\x20%s,\x20%s',_0x5a2d33,_0x39739d[_0x228f('0xf')][_0x228f('0x10')]);return _0x33a309(_0x39739d['error'][_0x228f('0x10')]);}logger[_0x228f('0xf')](_0x228f('0xb'),_0x5a2d33,_0x39739d[_0x228f('0xf')][_0x228f('0x10')]);return _0x5de01e(_0x39739d['error']['message']);}else{logger[_0x228f('0xa')]('VoiceMail,\x20%s,\x20%s',_0x5a2d33,_0x228f('0xc'));_0x5de01e(_0x39739d[_0x228f('0x11')]['message']);}})[_0x228f('0x12')](function(_0x3ce2ab){logger[_0x228f('0xf')](_0x228f('0xb'),_0x5a2d33,_0x3ce2ab);_0x33a309(_0x3ce2ab);});});} \ No newline at end of file +var _0x4df9=['error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify'];(function(_0x529668,_0x4e0dba){var _0x1f4630=function(_0x521b75){while(--_0x521b75){_0x529668['push'](_0x529668['shift']());}};_0x1f4630(++_0x4e0dba);}(_0x4df9,0x148));var _0x94df=function(_0x473c78,_0x104aac){_0x473c78=_0x473c78-0x0;var _0x521557=_0x4df9[_0x473c78];return _0x521557;};'use strict';var _=require(_0x94df('0x0'));var util=require(_0x94df('0x1'));var moment=require('moment');var BPromise=require(_0x94df('0x2'));var rs=require(_0x94df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94df('0x4'))['db'];var utils=require(_0x94df('0x5'));var logger=require(_0x94df('0x6'))(_0x94df('0x7'));var config=require(_0x94df('0x8'));var jayson=require(_0x94df('0x9'));var client=jayson[_0x94df('0xa')][_0x94df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18a7d1,_0x214af6,_0x238b20){return new BPromise(function(_0x5e2828,_0x3f4a28){return client[_0x94df('0xc')](_0x18a7d1,_0x238b20)[_0x94df('0xd')](function(_0x40a23c){logger[_0x94df('0xe')]('VoiceMail,\x20%s,\x20%s',_0x214af6,_0x94df('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x214af6,_0x94df('0xf'),JSON[_0x94df('0x10')](_0x40a23c));if(_0x40a23c[_0x94df('0x11')]){if(_0x40a23c[_0x94df('0x11')][_0x94df('0x12')]===0x1f4){logger[_0x94df('0x11')](_0x94df('0x13'),_0x214af6,_0x40a23c[_0x94df('0x11')][_0x94df('0x14')]);return _0x3f4a28(_0x40a23c[_0x94df('0x11')][_0x94df('0x14')]);}logger['error'](_0x94df('0x13'),_0x214af6,_0x40a23c[_0x94df('0x11')][_0x94df('0x14')]);return _0x5e2828(_0x40a23c[_0x94df('0x11')][_0x94df('0x14')]);}else{logger[_0x94df('0xe')](_0x94df('0x13'),_0x214af6,_0x94df('0xf'));_0x5e2828(_0x40a23c[_0x94df('0x15')][_0x94df('0x14')]);}})[_0x94df('0x16')](function(_0x5680d0){logger[_0x94df('0x11')](_0x94df('0x13'),_0x214af6,_0x5680d0);_0x3f4a28(_0x5680d0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6a99df5..c006baa 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 _0x9fcc=['get','show','/:id/download','download','post','create','put','/:id','update','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated'];(function(_0x533155,_0x33ad7e){var _0x24ab44=function(_0x3015c9){while(--_0x3015c9){_0x533155['push'](_0x533155['shift']());}};_0x24ab44(++_0x33ad7e);}(_0x9fcc,0x8f));var _0xc9fc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fcc[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc9fc('0x0'));var util=require(_0xc9fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9fc('0x2')]();var fs_extra=require(_0xc9fc('0x3'));var auth=require(_0xc9fc('0x4'));var interaction=require(_0xc9fc('0x5'));var config=require(_0xc9fc('0x6'));var controller=require(_0xc9fc('0x7'));router['get']('/',auth[_0xc9fc('0x8')](),controller['index']);router[_0xc9fc('0x9')]('/:id',auth[_0xc9fc('0x8')](),controller[_0xc9fc('0xa')]);router[_0xc9fc('0x9')](_0xc9fc('0xb'),auth['isAuthenticated'](),controller[_0xc9fc('0xc')]);router[_0xc9fc('0xd')]('/',auth['isAuthenticated'](),controller[_0xc9fc('0xe')]);router[_0xc9fc('0xf')](_0xc9fc('0x10'),auth['isAuthenticated'](),controller[_0xc9fc('0x11')]);router['delete']('/:id',auth[_0xc9fc('0x8')](),controller['destroy']);module[_0xc9fc('0x12')]=router; \ No newline at end of file +var _0x781f=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','destroy','exports'];(function(_0x59688f,_0x421bad){var _0x3d4d0b=function(_0x5285fd){while(--_0x5285fd){_0x59688f['push'](_0x59688f['shift']());}};_0x3d4d0b(++_0x421bad);}(_0x781f,0x169));var _0xf781=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x781f[_0x3b3cc6];return _0x1161e4;};'use strict';var multer=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var path=require(_0xf781('0x2'));var timeout=require(_0xf781('0x3'));var express=require('express');var router=express[_0xf781('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf781('0x5'));var config=require('../../config/environment');var controller=require(_0xf781('0x6'));router['get']('/',auth[_0xf781('0x7')](),controller[_0xf781('0x8')]);router[_0xf781('0x9')](_0xf781('0xa'),auth[_0xf781('0x7')](),controller[_0xf781('0xb')]);router[_0xf781('0x9')](_0xf781('0xc'),auth[_0xf781('0x7')](),controller[_0xf781('0xd')]);router[_0xf781('0xe')]('/',auth[_0xf781('0x7')](),controller[_0xf781('0xf')]);router['put'](_0xf781('0xa'),auth[_0xf781('0x7')](),controller[_0xf781('0x10')]);router['delete'](_0xf781('0xa'),auth['isAuthenticated'](),controller[_0xf781('0x11')]);module[_0xf781('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d4271f9..a6893b4 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 _0xc931=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x3638fc,_0xe0418b){var _0x28de82=function(_0x513980){while(--_0x513980){_0x3638fc['push'](_0x3638fc['shift']());}};_0x28de82(++_0xe0418b);}(_0xc931,0xd0));var _0x1c93=function(_0x119e76,_0x2dabb0){_0x119e76=_0x119e76-0x0;var _0x29b4bf=_0xc931[_0x119e76];return _0x29b4bf;};'use strict';var Sequelize=require('sequelize');module[_0x1c93('0x0')]={'name':{'type':Sequelize[_0x1c93('0x1')],'get':function(_0x592003){return this[_0x1c93('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x1c93('0x4')](_0x1c93('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1c93('0x3')],'defaultValue':''},'stamp':{'type':_0x1c93('0x6'),'defaultValue':Sequelize[_0x1c93('0x7')](_0x1c93('0x8'))}}; \ No newline at end of file +var _0x54c4=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x2a6022,_0x26cb48){var _0x557ee5=function(_0x573418){while(--_0x573418){_0x2a6022['push'](_0x2a6022['shift']());}};_0x557ee5(++_0x26cb48);}(_0x54c4,0xde));var _0x454c=function(_0x31a7c8,_0x178f72){_0x31a7c8=_0x31a7c8-0x0;var _0x43f4a0=_0x54c4[_0x31a7c8];return _0x43f4a0;};'use strict';var Sequelize=require(_0x454c('0x0'));module[_0x454c('0x1')]={'name':{'type':Sequelize[_0x454c('0x2')],'get':function(_0x42c51e){return this[_0x454c('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x454c('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x454c('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x454c('0x6')](_0x454c('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x454c('0x8'),'defaultValue':Sequelize[_0x454c('0x9')](_0x454c('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index dbbf5fc..b09e267 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 _0x32d4=['count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x480614,_0x3bbaeb){var _0x4ea6eb=function(_0x1413b8){while(--_0x1413b8){_0x480614['push'](_0x480614['shift']());}};_0x4ea6eb(++_0x3bbaeb);}(_0x32d4,0x14c));var _0x432d=function(_0x15b55b,_0x4e0b5b){_0x15b55b=_0x15b55b-0x0;var _0x5786e7=_0x32d4[_0x15b55b];return _0x5786e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x432d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x432d('0x1'));var rp=require(_0x432d('0x2'));var moment=require(_0x432d('0x3'));var BPromise=require(_0x432d('0x4'));var Mustache=require('mustache');var util=require(_0x432d('0x5'));var path=require(_0x432d('0x6'));var sox=require(_0x432d('0x7'));var csv=require('to-csv');var ejs=require(_0x432d('0x8'));var fs=require('fs');var fs_extra=require(_0x432d('0x9'));var _=require(_0x432d('0xa'));var squel=require(_0x432d('0xb'));var crypto=require(_0x432d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432d('0xe'));var Papa=require(_0x432d('0xf'));var Redis=require(_0x432d('0x10'));var authService=require(_0x432d('0x11'));var qs=require(_0x432d('0x12'));var as=require(_0x432d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x432d('0x14'))(_0x432d('0x15'));var utils=require(_0x432d('0x16'));var config=require(_0x432d('0x17'));var licenseUtil=require(_0x432d('0x18'));var db=require(_0x432d('0x19'))['db'];function respondWithStatusCode(_0x56a5a9,_0x453951){_0x453951=_0x453951||0xcc;return function(_0x3c7e7b){if(_0x3c7e7b){return _0x56a5a9[_0x432d('0x1a')](_0x453951);}return _0x56a5a9[_0x432d('0x1b')](_0x453951)[_0x432d('0x1c')]();};}function respondWithResult(_0xe9107,_0x190ce6){_0x190ce6=_0x190ce6||0xc8;return function(_0x377c6d){if(_0x377c6d){return _0xe9107[_0x432d('0x1b')](_0x190ce6)[_0x432d('0x1d')](_0x377c6d);}};}function respondWithFilteredResult(_0x5ac062,_0x5683af){return function(_0x1f5975){if(_0x1f5975){var _0x422a67=typeof _0x5683af[_0x432d('0x1e')]===_0x432d('0x1f')&&typeof _0x5683af['limit']===_0x432d('0x1f');var _0x8fc773=_0x1f5975[_0x432d('0x20')];var _0x3dc177=_0x422a67?0x0:_0x5683af[_0x432d('0x1e')];var _0xb9dcc7=_0x422a67?_0x1f5975[_0x432d('0x20')]:_0x5683af[_0x432d('0x1e')]+_0x5683af[_0x432d('0x21')];var _0x506a67;if(_0xb9dcc7>=_0x8fc773){_0xb9dcc7=_0x8fc773;_0x506a67=0xc8;}else{_0x506a67=0xce;}_0x5ac062[_0x432d('0x1b')](_0x506a67);return _0x5ac062[_0x432d('0x22')](_0x432d('0x23'),_0x3dc177+'-'+_0xb9dcc7+'/'+_0x8fc773)['json'](_0x1f5975);}return null;};}function patchUpdates(_0x476062){return function(_0xe49b84){try{jsonpatch[_0x432d('0x24')](_0xe49b84,_0x476062,!![]);}catch(_0x1a289f){return BPromise[_0x432d('0x25')](_0x1a289f);}return _0xe49b84[_0x432d('0x26')]();};}function saveUpdates(_0x413093,_0x59f376){return function(_0x35157b){if(_0x35157b){return _0x35157b[_0x432d('0x27')](_0x413093)[_0x432d('0x28')](function(_0x44f320){return _0x44f320;});}return null;};}function removeEntity(_0x38ac9f,_0x3b107b){return function(_0x39ab58){if(_0x39ab58){return _0x39ab58['destroy']()[_0x432d('0x28')](function(){_0x38ac9f[_0x432d('0x1b')](0xcc)[_0x432d('0x1c')]();});}};}function handleEntityNotFound(_0x33ce5b,_0x55dad0){return function(_0x134b36){if(!_0x134b36){_0x33ce5b[_0x432d('0x1a')](0x194);}return _0x134b36;};}function handleError(_0x149415,_0x407981){_0x407981=_0x407981||0x1f4;return function(_0xee913d){logger[_0x432d('0x29')](_0xee913d[_0x432d('0x2a')]);if(_0xee913d[_0x432d('0x2b')]){delete _0xee913d[_0x432d('0x2b')];}_0x149415[_0x432d('0x1b')](_0x407981)[_0x432d('0x2c')](_0xee913d);};}exports[_0x432d('0x2d')]=function(_0x41ad3c,_0xe3115f){var _0x201ed4={},_0x2769e1={},_0x53b9f7={'count':0x0,'rows':[]};var _0x1f73ed=_[_0x432d('0x2e')](db['VoiceMailMessage']['rawAttributes'],function(_0x1c4fdd){return{'name':_0x1c4fdd[_0x432d('0x2f')],'type':_0x1c4fdd['type'][_0x432d('0x30')]};});_0x2769e1[_0x432d('0x31')]=_[_0x432d('0x32')](_[_0x432d('0x2e')](_0x1f73ed,_0x432d('0x2b')),['name']);_0x2769e1['query']=_[_0x432d('0x33')](_0x41ad3c[_0x432d('0x34')]);_0x2769e1[_0x432d('0x35')]=_[_0x432d('0x36')](_0x2769e1[_0x432d('0x31')],_0x2769e1[_0x432d('0x34')]);_0x201ed4['attributes']=_[_0x432d('0x36')](_0x2769e1[_0x432d('0x31')],qs[_0x432d('0x37')](_0x41ad3c['query']['fields']));_0x201ed4[_0x432d('0x38')]=_0x201ed4[_0x432d('0x38')][_0x432d('0x39')]?_0x201ed4[_0x432d('0x38')]:_0x2769e1[_0x432d('0x31')];if(!_0x41ad3c['query'][_0x432d('0x3a')](_0x432d('0x3b'))){_0x201ed4[_0x432d('0x21')]=qs[_0x432d('0x21')](_0x41ad3c[_0x432d('0x34')][_0x432d('0x21')]);_0x201ed4[_0x432d('0x1e')]=qs[_0x432d('0x1e')](_0x41ad3c[_0x432d('0x34')][_0x432d('0x1e')]);}_0x201ed4[_0x432d('0x3c')]=qs['sort'](_0x41ad3c[_0x432d('0x34')][_0x432d('0x3d')]);_0x201ed4[_0x432d('0x3e')]=qs[_0x432d('0x35')](_[_0x432d('0x3f')](_0x41ad3c['query'],_0x2769e1[_0x432d('0x35')]),_0x1f73ed);if(_0x41ad3c[_0x432d('0x34')]['filter']){_0x201ed4[_0x432d('0x3e')]=_['merge'](_0x201ed4[_0x432d('0x3e')],{'$or':_[_0x432d('0x2e')](_0x1f73ed,function(_0x259e3d){if(_0x259e3d[_0x432d('0x40')]!==_0x432d('0x41')){var _0x4d4a35={};_0x4d4a35[_0x259e3d[_0x432d('0x2b')]]={'$like':'%'+_0x41ad3c[_0x432d('0x34')][_0x432d('0x42')]+'%'};return _0x4d4a35;}})});}_0x201ed4=_[_0x432d('0x43')]({},_0x201ed4,_0x41ad3c[_0x432d('0x44')]);var _0x4bbd9d={'where':_0x201ed4['where']};return db[_0x432d('0x45')][_0x432d('0x20')](_0x4bbd9d)[_0x432d('0x28')](function(_0xecf495){_0x53b9f7[_0x432d('0x20')]=_0xecf495;if(_0x41ad3c[_0x432d('0x34')][_0x432d('0x46')]){_0x201ed4[_0x432d('0x47')]=[{'all':!![]}];}return db[_0x432d('0x45')][_0x432d('0x48')](_0x201ed4);})[_0x432d('0x28')](function(_0x58be96){_0x53b9f7[_0x432d('0x49')]=_0x58be96;return _0x53b9f7;})['then'](respondWithFilteredResult(_0xe3115f,_0x201ed4))[_0x432d('0x4a')](handleError(_0xe3115f,null));};exports[_0x432d('0x4b')]=function(_0x188732,_0x1c39f6){var _0x38b12c={'raw':!![],'where':{'id':_0x188732[_0x432d('0x4c')]['id']}},_0x2e8f46={};_0x2e8f46[_0x432d('0x31')]=_[_0x432d('0x33')](db[_0x432d('0x45')][_0x432d('0x4d')]);_0x2e8f46['query']=_['keys'](_0x188732[_0x432d('0x34')]);_0x2e8f46[_0x432d('0x35')]=_['intersection'](_0x2e8f46['model'],_0x2e8f46[_0x432d('0x34')]);_0x38b12c[_0x432d('0x38')]=_[_0x432d('0x36')](_0x2e8f46[_0x432d('0x31')],qs[_0x432d('0x37')](_0x188732[_0x432d('0x34')][_0x432d('0x37')]));_0x38b12c[_0x432d('0x38')]=_0x38b12c['attributes'][_0x432d('0x39')]?_0x38b12c[_0x432d('0x38')]:_0x2e8f46['model'];if(_0x188732[_0x432d('0x34')]['includeAll']){_0x38b12c[_0x432d('0x47')]=[{'all':!![]}];}_0x38b12c=_['merge']({},_0x38b12c,_0x188732[_0x432d('0x44')]);return db[_0x432d('0x45')][_0x432d('0x4e')](_0x38b12c)['then'](handleEntityNotFound(_0x1c39f6,null))[_0x432d('0x28')](respondWithResult(_0x1c39f6,null))['catch'](handleError(_0x1c39f6,null));};exports[_0x432d('0x4f')]=function(_0x348dcf,_0x2415e8){return db[_0x432d('0x45')][_0x432d('0x4f')](_0x348dcf['body'],{})[_0x432d('0x28')](respondWithResult(_0x2415e8,0xc9))['catch'](handleError(_0x2415e8,null));};exports[_0x432d('0x27')]=function(_0x4bde23,_0x3d3132){if(_0x4bde23[_0x432d('0x50')]['id']){delete _0x4bde23['body']['id'];}return db[_0x432d('0x45')][_0x432d('0x4e')]({'where':{'id':_0x4bde23[_0x432d('0x4c')]['id']}})[_0x432d('0x28')](handleEntityNotFound(_0x3d3132,null))[_0x432d('0x28')](saveUpdates(_0x4bde23[_0x432d('0x50')],null))[_0x432d('0x28')](respondWithResult(_0x3d3132,null))[_0x432d('0x4a')](handleError(_0x3d3132,null));};exports[_0x432d('0x51')]=function(_0x5e3b8e,_0x1cb87b){return db['VoiceMailMessage'][_0x432d('0x4e')]({'where':{'id':_0x5e3b8e['params']['id']}})[_0x432d('0x28')](handleEntityNotFound(_0x1cb87b,null))[_0x432d('0x28')](removeEntity(_0x1cb87b,null))[_0x432d('0x4a')](handleError(_0x1cb87b,null));};exports[_0x432d('0x52')]=function(_0x40e780,_0x5769d3,_0x1258d0){return db[_0x432d('0x45')][_0x432d('0x4e')]({'where':{'id':_0x40e780['params']['id']},'attributes':['id',_0x432d('0x53'),_0x432d('0x54')]})[_0x432d('0x28')](handleEntityNotFound(_0x5769d3,null))[_0x432d('0x28')](function(_0x127422){if(_0x127422){if(!_0x127422['recording']){throw new db[(_0x432d('0x55'))][(_0x432d('0x56'))](_0x432d('0x57'));}var _0x1317d9={'Content-Type':'audio/wav','Content-Disposition':_0x432d('0x58')};if(_0x127422[_0x432d('0x54')]){_0x1317d9['Content-Disposition']=_0x432d('0x59')+_0x127422['msg_id']+_0x432d('0x5a');}_0x5769d3[_0x432d('0x22')](_0x1317d9);return _0x5769d3['send'](new Buffer(_0x127422[_0x432d('0x53')]));}})[_0x432d('0x4a')](handleError(_0x5769d3,null));}; \ No newline at end of file +var _0xf483=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','find','body','download','recording','msg_id','Sequelize','ValidationError','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters'];(function(_0x4799bf,_0x145838){var _0x436ef4=function(_0x1c0a40){while(--_0x1c0a40){_0x4799bf['push'](_0x4799bf['shift']());}};_0x436ef4(++_0x145838);}(_0xf483,0xc6));var _0x3f48=function(_0x4e76da,_0x291b71){_0x4e76da=_0x4e76da-0x0;var _0x5f14e8=_0xf483[_0x4e76da];return _0x5f14e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f48('0x0'));var zipdir=require(_0x3f48('0x1'));var jsonpatch=require(_0x3f48('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f48('0x3'));var Mustache=require('mustache');var util=require(_0x3f48('0x4'));var path=require(_0x3f48('0x5'));var sox=require(_0x3f48('0x6'));var csv=require(_0x3f48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f48('0x8'));var squel=require(_0x3f48('0x9'));var crypto=require(_0x3f48('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3f48('0xb'));var toCsv=require(_0x3f48('0x7'));var querystring=require(_0x3f48('0xc'));var Papa=require(_0x3f48('0xd'));var Redis=require(_0x3f48('0xe'));var authService=require(_0x3f48('0xf'));var qs=require(_0x3f48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f48('0x11'));var logger=require(_0x3f48('0x12'))(_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(_0x4e7cbd,_0x2c72ae){_0x2c72ae=_0x2c72ae||0xcc;return function(_0x41868a){if(_0x41868a){return _0x4e7cbd[_0x3f48('0x18')](_0x2c72ae);}return _0x4e7cbd['status'](_0x2c72ae)['end']();};}function respondWithResult(_0x117748,_0x2c0ae2){_0x2c0ae2=_0x2c0ae2||0xc8;return function(_0x47782f){if(_0x47782f){return _0x117748['status'](_0x2c0ae2)[_0x3f48('0x19')](_0x47782f);}};}function respondWithFilteredResult(_0x3cc4e1,_0x3370f0){return function(_0x31d242){if(_0x31d242){var _0x587742=typeof _0x3370f0[_0x3f48('0x1a')]===_0x3f48('0x1b')&&typeof _0x3370f0[_0x3f48('0x1c')]===_0x3f48('0x1b');var _0x5560c9=_0x31d242[_0x3f48('0x1d')];var _0xab77a0=_0x587742?0x0:_0x3370f0['offset'];var _0x388592=_0x587742?_0x31d242[_0x3f48('0x1d')]:_0x3370f0[_0x3f48('0x1a')]+_0x3370f0['limit'];var _0x2091a9;if(_0x388592>=_0x5560c9){_0x388592=_0x5560c9;_0x2091a9=0xc8;}else{_0x2091a9=0xce;}_0x3cc4e1[_0x3f48('0x1e')](_0x2091a9);return _0x3cc4e1[_0x3f48('0x1f')]('Content-Range',_0xab77a0+'-'+_0x388592+'/'+_0x5560c9)['json'](_0x31d242);}return null;};}function patchUpdates(_0x15e4d3){return function(_0x297473){try{jsonpatch[_0x3f48('0x20')](_0x297473,_0x15e4d3,!![]);}catch(_0x49b4a0){return BPromise['reject'](_0x49b4a0);}return _0x297473['save']();};}function saveUpdates(_0x56c9e2,_0x1f20a3){return function(_0x5aab11){if(_0x5aab11){return _0x5aab11[_0x3f48('0x21')](_0x56c9e2)[_0x3f48('0x22')](function(_0x3ffb16){return _0x3ffb16;});}return null;};}function removeEntity(_0x3c6686,_0xc650ec){return function(_0x5dd953){if(_0x5dd953){return _0x5dd953[_0x3f48('0x23')]()[_0x3f48('0x22')](function(){_0x3c6686[_0x3f48('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263f74,_0x111dba){return function(_0x622ef3){if(!_0x622ef3){_0x263f74[_0x3f48('0x18')](0x194);}return _0x622ef3;};}function handleError(_0x2d2165,_0x59dd5e){_0x59dd5e=_0x59dd5e||0x1f4;return function(_0x4e97e7){logger[_0x3f48('0x24')](_0x4e97e7[_0x3f48('0x25')]);if(_0x4e97e7[_0x3f48('0x26')]){delete _0x4e97e7[_0x3f48('0x26')];}_0x2d2165['status'](_0x59dd5e)[_0x3f48('0x27')](_0x4e97e7);};}exports[_0x3f48('0x28')]=function(_0xd808ad,_0x12a031){var _0x5a4b10={},_0x53fccd={},_0x809fa4={'count':0x0,'rows':[]};var _0x29f9be=_[_0x3f48('0x29')](db[_0x3f48('0x2a')][_0x3f48('0x2b')],function(_0x36c36b){return{'name':_0x36c36b[_0x3f48('0x2c')],'type':_0x36c36b[_0x3f48('0x2d')][_0x3f48('0x2e')]};});_0x53fccd[_0x3f48('0x2f')]=_[_0x3f48('0x30')](_['map'](_0x29f9be,_0x3f48('0x26')),[_0x3f48('0x26')]);_0x53fccd[_0x3f48('0x31')]=_['keys'](_0xd808ad[_0x3f48('0x31')]);_0x53fccd[_0x3f48('0x32')]=_[_0x3f48('0x33')](_0x53fccd[_0x3f48('0x2f')],_0x53fccd[_0x3f48('0x31')]);_0x5a4b10[_0x3f48('0x34')]=_['intersection'](_0x53fccd[_0x3f48('0x2f')],qs[_0x3f48('0x35')](_0xd808ad[_0x3f48('0x31')][_0x3f48('0x35')]));_0x5a4b10[_0x3f48('0x34')]=_0x5a4b10[_0x3f48('0x34')][_0x3f48('0x36')]?_0x5a4b10[_0x3f48('0x34')]:_0x53fccd['model'];if(!_0xd808ad[_0x3f48('0x31')][_0x3f48('0x37')](_0x3f48('0x38'))){_0x5a4b10[_0x3f48('0x1c')]=qs[_0x3f48('0x1c')](_0xd808ad[_0x3f48('0x31')][_0x3f48('0x1c')]);_0x5a4b10['offset']=qs['offset'](_0xd808ad[_0x3f48('0x31')][_0x3f48('0x1a')]);}_0x5a4b10[_0x3f48('0x39')]=qs['sort'](_0xd808ad[_0x3f48('0x31')][_0x3f48('0x3a')]);_0x5a4b10['where']=qs['filters'](_['pick'](_0xd808ad[_0x3f48('0x31')],_0x53fccd[_0x3f48('0x32')]),_0x29f9be);if(_0xd808ad[_0x3f48('0x31')][_0x3f48('0x3b')]){_0x5a4b10[_0x3f48('0x3c')]=_[_0x3f48('0x3d')](_0x5a4b10['where'],{'$or':_[_0x3f48('0x29')](_0x29f9be,function(_0x1d5828){if(_0x1d5828[_0x3f48('0x2d')]!==_0x3f48('0x3e')){var _0x53f4a0={};_0x53f4a0[_0x1d5828[_0x3f48('0x26')]]={'$like':'%'+_0xd808ad[_0x3f48('0x31')][_0x3f48('0x3b')]+'%'};return _0x53f4a0;}})});}_0x5a4b10=_[_0x3f48('0x3d')]({},_0x5a4b10,_0xd808ad['options']);var _0x2d883e={'where':_0x5a4b10['where']};return db['VoiceMailMessage']['count'](_0x2d883e)[_0x3f48('0x22')](function(_0x50c718){_0x809fa4[_0x3f48('0x1d')]=_0x50c718;if(_0xd808ad[_0x3f48('0x31')][_0x3f48('0x3f')]){_0x5a4b10[_0x3f48('0x40')]=[{'all':!![]}];}return db[_0x3f48('0x2a')][_0x3f48('0x41')](_0x5a4b10);})[_0x3f48('0x22')](function(_0x10b4a2){_0x809fa4[_0x3f48('0x42')]=_0x10b4a2;return _0x809fa4;})['then'](respondWithFilteredResult(_0x12a031,_0x5a4b10))[_0x3f48('0x43')](handleError(_0x12a031,null));};exports[_0x3f48('0x44')]=function(_0x232c83,_0xad9acb){var _0x10931c={'raw':!![],'where':{'id':_0x232c83[_0x3f48('0x45')]['id']}},_0x61f78e={};_0x61f78e[_0x3f48('0x2f')]=_[_0x3f48('0x46')](db['VoiceMailMessage'][_0x3f48('0x2b')]);_0x61f78e[_0x3f48('0x31')]=_['keys'](_0x232c83[_0x3f48('0x31')]);_0x61f78e[_0x3f48('0x32')]=_[_0x3f48('0x33')](_0x61f78e[_0x3f48('0x2f')],_0x61f78e[_0x3f48('0x31')]);_0x10931c['attributes']=_[_0x3f48('0x33')](_0x61f78e[_0x3f48('0x2f')],qs[_0x3f48('0x35')](_0x232c83[_0x3f48('0x31')]['fields']));_0x10931c[_0x3f48('0x34')]=_0x10931c[_0x3f48('0x34')][_0x3f48('0x36')]?_0x10931c[_0x3f48('0x34')]:_0x61f78e[_0x3f48('0x2f')];if(_0x232c83[_0x3f48('0x31')][_0x3f48('0x3f')]){_0x10931c['include']=[{'all':!![]}];}_0x10931c=_[_0x3f48('0x3d')]({},_0x10931c,_0x232c83[_0x3f48('0x47')]);return db['VoiceMailMessage']['find'](_0x10931c)[_0x3f48('0x22')](handleEntityNotFound(_0xad9acb,null))[_0x3f48('0x22')](respondWithResult(_0xad9acb,null))[_0x3f48('0x43')](handleError(_0xad9acb,null));};exports['create']=function(_0x4c54c6,_0x5cb9af){return db['VoiceMailMessage'][_0x3f48('0x48')](_0x4c54c6['body'],{})[_0x3f48('0x22')](respondWithResult(_0x5cb9af,0xc9))['catch'](handleError(_0x5cb9af,null));};exports[_0x3f48('0x21')]=function(_0x413bc3,_0x129127){if(_0x413bc3['body']['id']){delete _0x413bc3['body']['id'];}return db[_0x3f48('0x2a')][_0x3f48('0x49')]({'where':{'id':_0x413bc3[_0x3f48('0x45')]['id']}})[_0x3f48('0x22')](handleEntityNotFound(_0x129127,null))['then'](saveUpdates(_0x413bc3[_0x3f48('0x4a')],null))[_0x3f48('0x22')](respondWithResult(_0x129127,null))[_0x3f48('0x43')](handleError(_0x129127,null));};exports[_0x3f48('0x23')]=function(_0x1fa5e0,_0x38d7b9){return db['VoiceMailMessage']['find']({'where':{'id':_0x1fa5e0[_0x3f48('0x45')]['id']}})['then'](handleEntityNotFound(_0x38d7b9,null))[_0x3f48('0x22')](removeEntity(_0x38d7b9,null))[_0x3f48('0x43')](handleError(_0x38d7b9,null));};exports[_0x3f48('0x4b')]=function(_0x24566d,_0x3ab75d,_0x1742f0){return db['VoiceMailMessage'][_0x3f48('0x49')]({'where':{'id':_0x24566d['params']['id']},'attributes':['id',_0x3f48('0x4c'),_0x3f48('0x4d')]})['then'](handleEntityNotFound(_0x3ab75d,null))[_0x3f48('0x22')](function(_0x422c19){if(_0x422c19){if(!_0x422c19[_0x3f48('0x4c')]){throw new db[(_0x3f48('0x4e'))][(_0x3f48('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x519f99={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x422c19[_0x3f48('0x4d')]){_0x519f99[_0x3f48('0x50')]=_0x3f48('0x51')+_0x422c19['msg_id']+_0x3f48('0x52');}_0x3ab75d[_0x3f48('0x1f')](_0x519f99);return _0x3ab75d[_0x3f48('0x27')](new Buffer(_0x422c19[_0x3f48('0x4c')]));}})[_0x3f48('0x43')](handleError(_0x3ab75d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7c928fd..2da67f3 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 _0x4e95=['dir','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceMailMessage'];(function(_0x3cd616,_0x2425f9){var _0x3eb8b5=function(_0x1345b1){while(--_0x1345b1){_0x3cd616['push'](_0x3cd616['shift']());}};_0x3eb8b5(++_0x2425f9);}(_0x4e95,0x12d));var _0x54e9=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4e95[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0x54e9('0x0'));var logger=require(_0x54e9('0x1'))('api');var moment=require(_0x54e9('0x2'));var BPromise=require('bluebird');var rp=require(_0x54e9('0x3'));var fs=require('fs');var path=require(_0x54e9('0x4'));var rimraf=require(_0x54e9('0x5'));var config=require(_0x54e9('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x54e9('0x7')]=function(_0x476166,_0x48ef70){return _0x476166['define'](_0x54e9('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x54e9('0x9'),'fields':[_0x54e9('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3066=['api','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x1253de,_0x2b60aa){var _0x278961=function(_0x902b68){while(--_0x902b68){_0x1253de['push'](_0x1253de['shift']());}};_0x278961(++_0x2b60aa);}(_0x3066,0x150));var _0x6306=function(_0x52d67e,_0x43c397){_0x52d67e=_0x52d67e-0x0;var _0x5251b2=_0x3066[_0x52d67e];return _0x5251b2;};'use strict';var _=require(_0x6306('0x0'));var util=require(_0x6306('0x1'));var logger=require('../../config/logger')(_0x6306('0x2'));var moment=require(_0x6306('0x3'));var BPromise=require('bluebird');var rp=require(_0x6306('0x4'));var fs=require('fs');var path=require(_0x6306('0x5'));var rimraf=require('rimraf');var config=require(_0x6306('0x6'));var attributes=require(_0x6306('0x7'));module[_0x6306('0x8')]=function(_0x4f4f55,_0x49379d){return _0x4f4f55[_0x6306('0x9')](_0x6306('0xa'),attributes,{'tableName':_0x6306('0xb'),'paranoid':![],'indexes':[{'name':_0x6306('0xc'),'fields':[_0x6306('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 b3eee25..ca9aa28 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 _0x64cd=['VoiceMailMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x3ded2f,_0x5b5bda){var _0x3f917c=function(_0x3bad3d){while(--_0x3bad3d){_0x3ded2f['push'](_0x3ded2f['shift']());}};_0x3f917c(++_0x5b5bda);}(_0x64cd,0x71));var _0xd64c=function(_0x3da72b,_0x4fd809){_0x3da72b=_0x3da72b-0x0;var _0xc64ac4=_0x64cd[_0x3da72b];return _0xc64ac4;};'use strict';var _=require(_0xd64c('0x0'));var util=require(_0xd64c('0x1'));var moment=require(_0xd64c('0x2'));var BPromise=require(_0xd64c('0x3'));var rs=require(_0xd64c('0x4'));var fs=require('fs');var Redis=require(_0xd64c('0x5'));var db=require(_0xd64c('0x6'))['db'];var utils=require(_0xd64c('0x7'));var logger=require('../../config/logger')(_0xd64c('0x8'));var config=require(_0xd64c('0x9'));var jayson=require(_0xd64c('0xa'));var client=jayson[_0xd64c('0xb')][_0xd64c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a1c73,_0x24df80,_0x366a0e){return new BPromise(function(_0x47561c,_0x1e839e){return client[_0xd64c('0xd')](_0x2a1c73,_0x366a0e)[_0xd64c('0xe')](function(_0x283688){logger[_0xd64c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x24df80,_0xd64c('0x10'));logger[_0xd64c('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x24df80,_0xd64c('0x10'),JSON['stringify'](_0x283688));if(_0x283688[_0xd64c('0x12')]){if(_0x283688[_0xd64c('0x12')]['code']===0x1f4){logger['error'](_0xd64c('0x13'),_0x24df80,_0x283688[_0xd64c('0x12')][_0xd64c('0x14')]);return _0x1e839e(_0x283688['error'][_0xd64c('0x14')]);}logger[_0xd64c('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x24df80,_0x283688[_0xd64c('0x12')][_0xd64c('0x14')]);return _0x47561c(_0x283688['error'][_0xd64c('0x14')]);}else{logger[_0xd64c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x24df80,'request\x20sent');_0x47561c(_0x283688[_0xd64c('0x15')][_0xd64c('0x14')]);}})['catch'](function(_0x526b8e){logger[_0xd64c('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x24df80,_0x526b8e);_0x1e839e(_0x526b8e);});});} \ No newline at end of file +var _0x9f8e=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c47bd,_0x6be67a){var _0x29d7d1=function(_0x4bfae6){while(--_0x4bfae6){_0x4c47bd['push'](_0x4c47bd['shift']());}};_0x29d7d1(++_0x6be67a);}(_0x9f8e,0x132));var _0xe9f8=function(_0x5a0776,_0x507b9c){_0x5a0776=_0x5a0776-0x0;var _0x4cbaef=_0x9f8e[_0x5a0776];return _0x4cbaef;};'use strict';var _=require(_0xe9f8('0x0'));var util=require('util');var moment=require(_0xe9f8('0x1'));var BPromise=require(_0xe9f8('0x2'));var rs=require(_0xe9f8('0x3'));var fs=require('fs');var Redis=require(_0xe9f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9f8('0x5'));var logger=require(_0xe9f8('0x6'))(_0xe9f8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35f823,_0x946916,_0x4c4977){return new BPromise(function(_0x5bcc85,_0x22a106){return client['request'](_0x35f823,_0x4c4977)[_0xe9f8('0x8')](function(_0x1230ad){logger[_0xe9f8('0x9')](_0xe9f8('0xa'),_0x946916,_0xe9f8('0xb'));logger[_0xe9f8('0xc')](_0xe9f8('0xd'),_0x946916,_0xe9f8('0xb'),JSON[_0xe9f8('0xe')](_0x1230ad));if(_0x1230ad[_0xe9f8('0xf')]){if(_0x1230ad[_0xe9f8('0xf')][_0xe9f8('0x10')]===0x1f4){logger['error'](_0xe9f8('0xa'),_0x946916,_0x1230ad[_0xe9f8('0xf')][_0xe9f8('0x11')]);return _0x22a106(_0x1230ad[_0xe9f8('0xf')][_0xe9f8('0x11')]);}logger[_0xe9f8('0xf')](_0xe9f8('0xa'),_0x946916,_0x1230ad[_0xe9f8('0xf')][_0xe9f8('0x11')]);return _0x5bcc85(_0x1230ad[_0xe9f8('0xf')]['message']);}else{logger[_0xe9f8('0x9')](_0xe9f8('0xa'),_0x946916,'request\x20sent');_0x5bcc85(_0x1230ad[_0xe9f8('0x12')][_0xe9f8('0x11')]);}})['catch'](function(_0x408db7){logger[_0xe9f8('0xf')](_0xe9f8('0xa'),_0x946916,_0x408db7);_0x22a106(_0x408db7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 80f7c91..3900cad 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 _0x9937=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','/:id','delete','/:id/sounds/:id2','removeSound','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9937,0x196));var _0x7993=function(_0x19d6cc,_0x5180f2){_0x19d6cc=_0x19d6cc-0x0;var _0x11b4ae=_0x9937[_0x19d6cc];return _0x11b4ae;};'use strict';var multer=require(_0x7993('0x0'));var util=require(_0x7993('0x1'));var path=require(_0x7993('0x2'));var timeout=require('connect-timeout');var express=require(_0x7993('0x3'));var router=express[_0x7993('0x4')]();var fs_extra=require(_0x7993('0x5'));var auth=require(_0x7993('0x6'));var interaction=require(_0x7993('0x7'));var config=require(_0x7993('0x8'));var controller=require(_0x7993('0x9'));router[_0x7993('0xa')]('/',auth[_0x7993('0xb')](),controller[_0x7993('0xc')]);router[_0x7993('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7993('0xd')]);router[_0x7993('0xa')](_0x7993('0xe'),auth[_0x7993('0xb')](),controller[_0x7993('0xf')]);router[_0x7993('0x10')]('/',auth[_0x7993('0xb')](),controller[_0x7993('0x11')]);router[_0x7993('0x10')](_0x7993('0xe'),auth[_0x7993('0xb')](),controller[_0x7993('0x12')]);router['put'](_0x7993('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x7993('0x14')]('/:id',auth[_0x7993('0xb')](),controller['destroy']);router[_0x7993('0x14')](_0x7993('0x15'),auth['isAuthenticated'](),controller[_0x7993('0x16')]);module['exports']=router; \ No newline at end of file +var _0x39c9=['Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','post','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express'];(function(_0x118b0a,_0x33d432){var _0x2fd10b=function(_0x3518f9){while(--_0x3518f9){_0x118b0a['push'](_0x118b0a['shift']());}};_0x2fd10b(++_0x33d432);}(_0x39c9,0x1f3));var _0x939c=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0x39c9[_0x412686];return _0x18619e;};'use strict';var multer=require(_0x939c('0x0'));var util=require(_0x939c('0x1'));var path=require(_0x939c('0x2'));var timeout=require(_0x939c('0x3'));var express=require(_0x939c('0x4'));var router=express[_0x939c('0x5')]();var fs_extra=require(_0x939c('0x6'));var auth=require(_0x939c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x939c('0x8'));router['get']('/',auth[_0x939c('0x9')](),controller[_0x939c('0xa')]);router[_0x939c('0xb')](_0x939c('0xc'),auth[_0x939c('0x9')](),controller[_0x939c('0xd')]);router[_0x939c('0xb')](_0x939c('0xe'),auth['isAuthenticated'](),controller['getSounds']);router[_0x939c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x939c('0xf')]('/:id/sounds',auth[_0x939c('0x9')](),controller['addSound']);router['put'](_0x939c('0xc'),auth['isAuthenticated'](),controller[_0x939c('0x10')]);router[_0x939c('0x11')](_0x939c('0xc'),auth[_0x939c('0x9')](),controller[_0x939c('0x12')]);router['delete'](_0x939c('0x13'),auth[_0x939c('0x9')](),controller['removeSound']);module[_0x939c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d7695ac..3b7ac0c 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 _0xd60d=['quietmp3nb','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x49e3e6,_0x4c9bfe){var _0x796707=function(_0x30d01e){while(--_0x30d01e){_0x49e3e6['push'](_0x49e3e6['shift']());}};_0x796707(++_0x4c9bfe);}(_0xd60d,0xdc));var _0xdd60=function(_0x216e21,_0x285c03){_0x216e21=_0x216e21-0x0;var _0x47df40=_0xd60d[_0x216e21];return _0x47df40;};'use strict';var Sequelize=require(_0xdd60('0x0'));module[_0xdd60('0x1')]={'name':{'type':Sequelize[_0xdd60('0x2')],'allowNull':![],'unique':_0xdd60('0x3')},'mode':{'type':Sequelize[_0xdd60('0x4')](_0xdd60('0x5'),_0xdd60('0x6'),_0xdd60('0x7'),_0xdd60('0x8'),'quietmp3',_0xdd60('0x9')),'allowNull':!![],'defaultValue':_0xdd60('0x6')},'directory':{'type':Sequelize[_0xdd60('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xdd60('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdd60('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xdd60('0x2')],'allowNull':!![],'defaultValue':_0xdd60('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xdd60('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe6f9=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','custom','files'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe6f9,0x1b4));var _0x9e6f=function(_0x1262b1,_0x4eee39){_0x1262b1=_0x1262b1-0x0;var _0x28324c=_0xe6f9[_0x1262b1];return _0x28324c;};'use strict';var Sequelize=require(_0x9e6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e6f('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x9e6f('0x2'),_0x9e6f('0x3'),_0x9e6f('0x4'),_0x9e6f('0x5'),_0x9e6f('0x6'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9e6f('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x9e6f('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9e6f('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9e6f('0x8')},'defaultEntry':{'type':Sequelize[_0x9e6f('0x9')],'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 7474481..bfd430f 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 _0x024d=['stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','update','body','params','create','sequelize','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','readdirSync','forEach','unlinkSync','ValidationError','addSound','transaction','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','message','id2','Sound','createdAt','getSounds','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','get','MusicOnHolds','UserProfileResource','destroy'];(function(_0x551fb0,_0x4b9433){var _0x497492=function(_0x3d2a2b){while(--_0x3d2a2b){_0x551fb0['push'](_0x551fb0['shift']());}};_0x497492(++_0x4b9433);}(_0x024d,0xbb));var _0xd024=function(_0xb92798,_0x57be21){_0xb92798=_0xb92798-0x0;var _0x176f9d=_0x024d[_0xb92798];return _0x176f9d;};'use strict';var emlformat=require(_0xd024('0x0'));var rimraf=require(_0xd024('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd024('0x2'));var moment=require(_0xd024('0x3'));var BPromise=require(_0xd024('0x4'));var Mustache=require(_0xd024('0x5'));var util=require(_0xd024('0x6'));var path=require(_0xd024('0x7'));var sox=require('sox');var csv=require(_0xd024('0x8'));var ejs=require(_0xd024('0x9'));var fs=require('fs');var fs_extra=require(_0xd024('0xa'));var _=require(_0xd024('0xb'));var squel=require(_0xd024('0xc'));var crypto=require(_0xd024('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd024('0xe'));var toCsv=require(_0xd024('0x8'));var querystring=require(_0xd024('0xf'));var Papa=require(_0xd024('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd024('0x11'));var as=require(_0xd024('0x12'));var hardwareService=require(_0xd024('0x13'));var logger=require('../../config/logger')(_0xd024('0x14'));var utils=require(_0xd024('0x15'));var config=require(_0xd024('0x16'));var licenseUtil=require(_0xd024('0x17'));var db=require(_0xd024('0x18'))['db'];function respondWithStatusCode(_0x594238,_0x4fcc25){_0x4fcc25=_0x4fcc25||0xcc;return function(_0x16bc28){if(_0x16bc28){return _0x594238[_0xd024('0x19')](_0x4fcc25);}return _0x594238[_0xd024('0x1a')](_0x4fcc25)[_0xd024('0x1b')]();};}function respondWithResult(_0x218ccc,_0x479486){_0x479486=_0x479486||0xc8;return function(_0x535714){if(_0x535714){return _0x218ccc[_0xd024('0x1a')](_0x479486)[_0xd024('0x1c')](_0x535714);}};}function respondWithFilteredResult(_0x3aa2f9,_0x220308){return function(_0x4dac93){if(_0x4dac93){var _0xf7e584=typeof _0x220308['offset']==='undefined'&&typeof _0x220308[_0xd024('0x1d')]===_0xd024('0x1e');var _0x2005fa=_0x4dac93[_0xd024('0x1f')];var _0x785fc1=_0xf7e584?0x0:_0x220308[_0xd024('0x20')];var _0x212fe2=_0xf7e584?_0x4dac93[_0xd024('0x1f')]:_0x220308[_0xd024('0x20')]+_0x220308[_0xd024('0x1d')];var _0x27dacd;if(_0x212fe2>=_0x2005fa){_0x212fe2=_0x2005fa;_0x27dacd=0xc8;}else{_0x27dacd=0xce;}_0x3aa2f9['status'](_0x27dacd);return _0x3aa2f9[_0xd024('0x21')](_0xd024('0x22'),_0x785fc1+'-'+_0x212fe2+'/'+_0x2005fa)[_0xd024('0x1c')](_0x4dac93);}return null;};}function patchUpdates(_0x40aaf5){return function(_0x318d76){try{jsonpatch[_0xd024('0x23')](_0x318d76,_0x40aaf5,!![]);}catch(_0x5d562a){return BPromise[_0xd024('0x24')](_0x5d562a);}return _0x318d76[_0xd024('0x25')]();};}function saveUpdates(_0x524e0d,_0x5e6a94){return function(_0x3f923c){if(_0x3f923c){return _0x3f923c['update'](_0x524e0d)[_0xd024('0x26')](function(_0x203550){return _0x203550;});}return null;};}function removeEntity(_0x303f84,_0x547aef){return function(_0x57841a){if(_0x57841a){return _0x57841a['destroy']()[_0xd024('0x26')](function(){var _0x16adb8=_0x57841a[_0xd024('0x27')]({'plain':!![]});var _0x3b8346=_0xd024('0x28');return db[_0xd024('0x29')][_0xd024('0x2a')]({'where':{'type':_0x3b8346,'resourceId':_0x16adb8['id']}})[_0xd024('0x26')](function(){return _0x57841a;});})[_0xd024('0x26')](function(){_0x303f84[_0xd024('0x1a')](0xcc)[_0xd024('0x1b')]();});}};}function handleEntityNotFound(_0x567a57,_0x78d50f){return function(_0x430f8e){if(!_0x430f8e){_0x567a57[_0xd024('0x19')](0x194);}return _0x430f8e;};}function handleError(_0x5b6888,_0x1fc9cf){_0x1fc9cf=_0x1fc9cf||0x1f4;return function(_0x1f9ce3){logger['error'](_0x1f9ce3[_0xd024('0x2b')]);if(_0x1f9ce3['name']){delete _0x1f9ce3[_0xd024('0x2c')];}_0x5b6888['status'](_0x1fc9cf)[_0xd024('0x2d')](_0x1f9ce3);};}exports[_0xd024('0x2e')]=function(_0x28dfe2,_0x87920b){var _0x36b315={},_0x329793={},_0x42e277={'count':0x0,'rows':[]};var _0x18828d=_[_0xd024('0x2f')](db[_0xd024('0x30')][_0xd024('0x31')],function(_0x5a7420){return{'name':_0x5a7420[_0xd024('0x32')],'type':_0x5a7420[_0xd024('0x33')]['key']};});_0x329793['model']=_['map'](_0x18828d,'name');_0x329793['query']=_[_0xd024('0x34')](_0x28dfe2[_0xd024('0x35')]);_0x329793[_0xd024('0x36')]=_[_0xd024('0x37')](_0x329793[_0xd024('0x38')],_0x329793['query']);_0x36b315[_0xd024('0x39')]=_['intersection'](_0x329793['model'],qs['fields'](_0x28dfe2['query'][_0xd024('0x3a')]));_0x36b315[_0xd024('0x39')]=_0x36b315[_0xd024('0x39')][_0xd024('0x3b')]?_0x36b315[_0xd024('0x39')]:_0x329793['model'];if(!_0x28dfe2[_0xd024('0x35')]['hasOwnProperty'](_0xd024('0x3c'))){_0x36b315['limit']=qs[_0xd024('0x1d')](_0x28dfe2['query'][_0xd024('0x1d')]);_0x36b315[_0xd024('0x20')]=qs[_0xd024('0x20')](_0x28dfe2[_0xd024('0x35')][_0xd024('0x20')]);}_0x36b315[_0xd024('0x3d')]=qs[_0xd024('0x3e')](_0x28dfe2[_0xd024('0x35')][_0xd024('0x3e')]);delete _0x28dfe2[_0xd024('0x35')][_0xd024('0x3e')];_0x36b315['where']=qs[_0xd024('0x36')](_['pick'](_0x28dfe2[_0xd024('0x35')],_0x329793[_0xd024('0x36')]),_0x18828d);if(_0x28dfe2[_0xd024('0x35')][_0xd024('0x3f')]){_0x36b315[_0xd024('0x40')]=_[_0xd024('0x41')](_0x36b315[_0xd024('0x40')],{'$or':_[_0xd024('0x2f')](_0x18828d,function(_0x295d74){if(_0x295d74[_0xd024('0x33')]!==_0xd024('0x42')){var _0x93cdc4={};_0x93cdc4[_0x295d74[_0xd024('0x2c')]]={'$like':'%'+_0x28dfe2[_0xd024('0x35')][_0xd024('0x3f')]+'%'};return _0x93cdc4;}})});}_0x36b315=_[_0xd024('0x41')]({},_0x36b315,_0x28dfe2[_0xd024('0x43')]);var _0x8bfa15={'where':_0x36b315[_0xd024('0x40')]};return db[_0xd024('0x30')][_0xd024('0x1f')](_0x8bfa15)[_0xd024('0x26')](function(_0x4ed04d){_0x42e277['count']=_0x4ed04d;if(_0x28dfe2[_0xd024('0x35')][_0xd024('0x44')]){_0x36b315[_0xd024('0x45')]=[{'all':!![]}];}return db[_0xd024('0x30')]['findAll'](_0x36b315);})['then'](function(_0x484d91){_0x42e277[_0xd024('0x46')]=_0x484d91;return _0x42e277;})[_0xd024('0x26')](respondWithFilteredResult(_0x87920b,_0x36b315))[_0xd024('0x47')](handleError(_0x87920b,null));};exports[_0xd024('0x48')]=function(_0x48f85b,_0x143c35){var _0x2f67f8={'raw':![],'where':{'id':_0x48f85b['params']['id']}},_0x2faded={};_0x2faded[_0xd024('0x38')]=_[_0xd024('0x34')](db[_0xd024('0x30')][_0xd024('0x31')]);_0x2faded[_0xd024('0x35')]=_[_0xd024('0x34')](_0x48f85b[_0xd024('0x35')]);_0x2faded[_0xd024('0x36')]=_['intersection'](_0x2faded[_0xd024('0x38')],_0x2faded[_0xd024('0x35')]);_0x2f67f8['attributes']=_[_0xd024('0x37')](_0x2faded[_0xd024('0x38')],qs['fields'](_0x48f85b[_0xd024('0x35')][_0xd024('0x3a')]));_0x2f67f8[_0xd024('0x39')]=_0x2f67f8['attributes'][_0xd024('0x3b')]?_0x2f67f8[_0xd024('0x39')]:_0x2faded[_0xd024('0x38')];if(_0x48f85b['query'][_0xd024('0x44')]){_0x2f67f8[_0xd024('0x45')]=[{'all':!![]}];}_0x2f67f8=_[_0xd024('0x41')]({},_0x2f67f8,_0x48f85b['options']);return db[_0xd024('0x30')][_0xd024('0x49')](_0x2f67f8)[_0xd024('0x26')](handleEntityNotFound(_0x143c35,null))[_0xd024('0x26')](respondWithResult(_0x143c35,null))[_0xd024('0x47')](handleError(_0x143c35,null));};exports[_0xd024('0x4a')]=function(_0x1e9d22,_0x4dd9ab){if(_0x1e9d22[_0xd024('0x4b')]['id']){delete _0x1e9d22[_0xd024('0x4b')]['id'];}return db[_0xd024('0x30')][_0xd024('0x49')]({'where':{'id':_0x1e9d22[_0xd024('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4dd9ab,null))[_0xd024('0x26')](saveUpdates(_0x1e9d22[_0xd024('0x4b')],null))[_0xd024('0x26')](respondWithResult(_0x4dd9ab,null))[_0xd024('0x47')](handleError(_0x4dd9ab,null));};exports[_0xd024('0x4d')]=function(_0x4ef9e1,_0x34dc5f,_0x4c92d8){return db[_0xd024('0x4e')]['transaction'](function(_0x54d1da){if(_0x4ef9e1['body'][_0xd024('0x4f')]===_0xd024('0x50')){_0x4ef9e1[_0xd024('0x4b')][_0xd024('0x51')]=path[_0xd024('0x52')](config['root'],_0xd024('0x53'),_0x4ef9e1[_0xd024('0x4b')]['name']);}return db[_0xd024('0x30')][_0xd024('0x4d')](_0x4ef9e1[_0xd024('0x4b')],{'transaction':_0x54d1da})[_0xd024('0x26')](function(_0x4bb3b9){if(_0x4ef9e1[_0xd024('0x4b')]['mode']===_0xd024('0x50')){fs[_0xd024('0x54')](_0x4bb3b9[_0xd024('0x51')],parseInt(_0xd024('0x55'),0x8));}var _0xa674cd=_0x4ef9e1[_0xd024('0x56')][_0xd024('0x27')]({'plain':!![]});if(!_0xa674cd)throw new Error(_0xd024('0x57'));if(_0xa674cd[_0xd024('0x58')]===_0xd024('0x56')){var _0x2c8570=_0x4bb3b9[_0xd024('0x27')]({'plain':!![]});return db['UserProfileSection'][_0xd024('0x49')]({'where':{'name':_0xd024('0x28'),'userProfileId':_0xa674cd[_0xd024('0x59')]},'raw':!![]})[_0xd024('0x26')](function(_0x37346d){if(_0x37346d&&_0x37346d[_0xd024('0x5a')]===0x0){return db[_0xd024('0x29')][_0xd024('0x4d')]({'name':_0x2c8570[_0xd024('0x2c')],'resourceId':_0x2c8570['id'],'type':_0x37346d[_0xd024('0x2c')],'sectionId':_0x37346d['id']},{})[_0xd024('0x26')](function(){return _0x4bb3b9;});}else{return _0x4bb3b9;}})[_0xd024('0x47')](function(_0x4b2516){logger[_0xd024('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b2516);});}return _0x4bb3b9;});})[_0xd024('0x26')](respondWithResult(_0x34dc5f,0xc9))[_0xd024('0x47')](handleError(_0x34dc5f,null));};exports['destroy']=function(_0x3a5d4e,_0x4e746c,_0x458ecc){var _0x3d2795;return db[_0xd024('0x30')][_0xd024('0x49')]({'where':{'id':_0x3a5d4e[_0xd024('0x4c')]['id']}})[_0xd024('0x26')](function(_0x5e3546){if(_0x5e3546){return db[_0xd024('0x4e')]['transaction'](function(_0x25097d){return _0x5e3546['destroy']({'transaction':_0x25097d,'raw':!![]})[_0xd024('0x26')](function(_0xc52b7f){if(_0xc52b7f['directory']){fs[_0xd024('0x5c')](_0xc52b7f[_0xd024('0x51')])[_0xd024('0x5d')](function(_0x238c68){fs[_0xd024('0x5e')](path[_0xd024('0x52')](_0xc52b7f[_0xd024('0x51')],_0x238c68));});fs['rmdirSync'](_0xc52b7f['directory']);}return _0xc52b7f;});})['catch'](function(_0x2f5a4d){throw new db['Sequelize'][(_0xd024('0x5f'))](_0x2f5a4d['message']);});}})[_0xd024('0x26')](handleEntityNotFound(_0x4e746c,null))[_0xd024('0x26')](removeEntity(_0x4e746c,null))[_0xd024('0x47')](handleError(_0x4e746c,null));};exports[_0xd024('0x60')]=function(_0x5c945a,_0x5d7dff,_0x346f43){return db[_0xd024('0x4e')][_0xd024('0x61')](function(_0x13d709){var _0x483963;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5c945a['params']['id']}})[_0xd024('0x26')](function(_0x37f43c){if(_0x37f43c){_0x483963=_0x37f43c;return _0x37f43c['addSound'](_0x5c945a[_0xd024('0x4b')]['id'],{'transaction':_0x13d709});}})['then'](function(_0x918da8){if(_0x918da8){return db['Sound'][_0xd024('0x62')]({'where':{'id':_0x5c945a['body']['id']},'attributes':['id',_0xd024('0x2c'),_0xd024('0x63'),_0xd024('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x5f0c46){if(_0x5f0c46){var _0x3162a1=path[_0xd024('0x52')](config[_0xd024('0x65')],_0xd024('0x66'),util[_0xd024('0x67')](_0xd024('0x68'),path[_0xd024('0x69')](_0x5f0c46[_0xd024('0x63')],path[_0xd024('0x6a')](_0x5f0c46['save_name'])),_0x5f0c46[_0xd024('0x64')]));var _0x116e93=path['join'](config[_0xd024('0x65')],_0xd024('0x53'),_0x483963[_0xd024('0x2c')],util[_0xd024('0x67')](_0xd024('0x68'),_0x5f0c46[_0xd024('0x2c')],_0x5f0c46[_0xd024('0x64')]));fs[_0xd024('0x6b')](_0x3162a1,_0x116e93);return _0x5f0c46;}})[_0xd024('0x47')](function(_0x5851b5){throw new db[(_0xd024('0x6c'))][(_0xd024('0x5f'))](_0x5851b5[_0xd024('0x6d')]);});})[_0xd024('0x26')](handleEntityNotFound(_0x5d7dff,null))[_0xd024('0x26')](respondWithResult(_0x5d7dff,0xc9))[_0xd024('0x47')](handleError(_0x5d7dff,null));};exports['removeSound']=function(_0x34cbef,_0x1cace4,_0x7cc237){return db[_0xd024('0x4e')][_0xd024('0x61')](function(_0x5ecb1c){var _0x3b5d7d;return db['VoiceMusicOnHold'][_0xd024('0x62')]({'where':{'id':_0x34cbef[_0xd024('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cace4,null))[_0xd024('0x26')](function(_0xd22104){if(_0xd22104){_0x3b5d7d=_0xd22104;return _0xd22104['removeSound'](_0x34cbef[_0xd024('0x4c')][_0xd024('0x6e')]);}})[_0xd024('0x26')](function(_0x13270b){if(_0x13270b){return db[_0xd024('0x6f')][_0xd024('0x62')]({'where':{'id':_0x34cbef[_0xd024('0x4c')][_0xd024('0x6e')]},'attributes':['id','name','save_name',_0xd024('0x64'),_0xd024('0x70')],'raw':!![]});}})[_0xd024('0x26')](function(_0x3177cc){if(_0x3177cc){fs['unlinkSync'](path['join'](_0x3b5d7d['directory'],util[_0xd024('0x67')](_0xd024('0x68'),_0x3177cc[_0xd024('0x2c')],_0x3177cc['converted_format'])));return _0x3177cc;}})[_0xd024('0x47')](function(_0x2854fb){throw new db['Sequelize'][(_0xd024('0x5f'))](_0x2854fb[_0xd024('0x6d')]);});})[_0xd024('0x26')](handleEntityNotFound(_0x1cace4,null))[_0xd024('0x26')](respondWithStatusCode(_0x1cace4,0xcc))[_0xd024('0x47')](handleError(_0x1cace4,null));};exports[_0xd024('0x71')]=function(_0x55d867,_0x470def,_0x30560f){var _0x391c24={};var _0x1105b0={};var _0x321176;var _0x545887;return db[_0xd024('0x30')]['findOne']({'where':{'id':_0x55d867['params']['id']}})[_0xd024('0x26')](handleEntityNotFound(_0x470def,null))[_0xd024('0x26')](function(_0x2b3d73){if(_0x2b3d73){_0x321176=_0x2b3d73;_0x1105b0[_0xd024('0x38')]=_[_0xd024('0x34')](db[_0xd024('0x6f')][_0xd024('0x31')]);_0x1105b0[_0xd024('0x35')]=_[_0xd024('0x34')](_0x55d867[_0xd024('0x35')]);_0x1105b0[_0xd024('0x36')]=_[_0xd024('0x37')](_0x1105b0['model'],_0x1105b0['query']);_0x391c24[_0xd024('0x39')]=_[_0xd024('0x37')](_0x1105b0[_0xd024('0x38')],qs[_0xd024('0x3a')](_0x55d867[_0xd024('0x35')][_0xd024('0x3a')]));_0x391c24[_0xd024('0x39')]=_0x391c24[_0xd024('0x39')][_0xd024('0x3b')]?_0x391c24[_0xd024('0x39')]:_0x1105b0[_0xd024('0x38')];_0x391c24[_0xd024('0x3d')]=qs[_0xd024('0x3e')](_0x55d867[_0xd024('0x35')][_0xd024('0x3e')]);_0x391c24['where']=qs[_0xd024('0x36')](_['pick'](_0x55d867[_0xd024('0x35')],_0x1105b0[_0xd024('0x36')]));if(_0x55d867['query'][_0xd024('0x3f')]){_0x391c24[_0xd024('0x40')]=_['merge'](_0x391c24[_0xd024('0x40')],{'$or':_[_0xd024('0x2f')](_0x391c24[_0xd024('0x39')],function(_0x10220f){var _0x204313={};_0x204313[_0x10220f]={'$like':'%'+_0x55d867[_0xd024('0x35')][_0xd024('0x3f')]+'%'};return _0x204313;})});}_0x391c24=_['merge']({},_0x391c24,_0x55d867['options']);return _0x321176['getSounds'](_0x391c24);}})[_0xd024('0x26')](function(_0x2f4f93){if(_0x2f4f93){_0x545887=_0x2f4f93[_0xd024('0x3b')];if(!_0x55d867[_0xd024('0x35')][_0xd024('0x72')]('nolimit')){_0x391c24[_0xd024('0x1d')]=qs[_0xd024('0x1d')](_0x55d867[_0xd024('0x35')][_0xd024('0x1d')]);_0x391c24[_0xd024('0x20')]=qs[_0xd024('0x20')](_0x55d867[_0xd024('0x35')][_0xd024('0x20')]);}return _0x321176['getSounds'](_0x391c24);}})[_0xd024('0x26')](function(_0x24074c){if(_0x24074c){return _0x24074c?{'count':_0x545887,'rows':_0x24074c}:null;}})[_0xd024('0x26')](respondWithResult(_0x470def,null))[_0xd024('0x47')](handleError(_0x470def,null));}; \ No newline at end of file +var _0xa3f1=['VoiceMusicOnHold','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','sequelize','transaction','mode','directory','join','server/files/moh','files','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','root','symlinkSync','message','removeSound','id2','getSounds','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','update','destroy','get','MusicOnHolds','UserProfileResource','then','error','name','send','index','map'];(function(_0x4333c9,_0xbb6496){var _0x4bfeb9=function(_0x35d658){while(--_0x35d658){_0x4333c9['push'](_0x4333c9['shift']());}};_0x4bfeb9(++_0xbb6496);}(_0xa3f1,0x197));var _0x1a3f=function(_0x36d9c3,_0x39e57f){_0x36d9c3=_0x36d9c3-0x0;var _0x536441=_0xa3f1[_0x36d9c3];return _0x536441;};'use strict';var emlformat=require(_0x1a3f('0x0'));var rimraf=require(_0x1a3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a3f('0x2'));var rp=require(_0x1a3f('0x3'));var moment=require(_0x1a3f('0x4'));var BPromise=require(_0x1a3f('0x5'));var Mustache=require(_0x1a3f('0x6'));var util=require(_0x1a3f('0x7'));var path=require('path');var sox=require(_0x1a3f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a3f('0x9'));var _=require(_0x1a3f('0xa'));var squel=require(_0x1a3f('0xb'));var crypto=require(_0x1a3f('0xc'));var jsforce=require(_0x1a3f('0xd'));var deskjs=require(_0x1a3f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1a3f('0xf'));var Papa=require(_0x1a3f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a3f('0x11'));var hardwareService=require(_0x1a3f('0x12'));var logger=require(_0x1a3f('0x13'))(_0x1a3f('0x14'));var utils=require(_0x1a3f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a3f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284d47,_0x177f5f){_0x177f5f=_0x177f5f||0xcc;return function(_0x43fc40){if(_0x43fc40){return _0x284d47[_0x1a3f('0x17')](_0x177f5f);}return _0x284d47[_0x1a3f('0x18')](_0x177f5f)[_0x1a3f('0x19')]();};}function respondWithResult(_0x34841f,_0x256824){_0x256824=_0x256824||0xc8;return function(_0x4de9cf){if(_0x4de9cf){return _0x34841f[_0x1a3f('0x18')](_0x256824)['json'](_0x4de9cf);}};}function respondWithFilteredResult(_0x39dc91,_0x1915bd){return function(_0x44023e){if(_0x44023e){var _0x6ce8a4=typeof _0x1915bd[_0x1a3f('0x1a')]===_0x1a3f('0x1b')&&typeof _0x1915bd['limit']===_0x1a3f('0x1b');var _0x4b5eee=_0x44023e[_0x1a3f('0x1c')];var _0x173770=_0x6ce8a4?0x0:_0x1915bd[_0x1a3f('0x1a')];var _0x35d094=_0x6ce8a4?_0x44023e[_0x1a3f('0x1c')]:_0x1915bd['offset']+_0x1915bd[_0x1a3f('0x1d')];var _0x3a8a38;if(_0x35d094>=_0x4b5eee){_0x35d094=_0x4b5eee;_0x3a8a38=0xc8;}else{_0x3a8a38=0xce;}_0x39dc91[_0x1a3f('0x18')](_0x3a8a38);return _0x39dc91[_0x1a3f('0x1e')]('Content-Range',_0x173770+'-'+_0x35d094+'/'+_0x4b5eee)[_0x1a3f('0x1f')](_0x44023e);}return null;};}function patchUpdates(_0x3a88a5){return function(_0x5abc0b){try{jsonpatch[_0x1a3f('0x20')](_0x5abc0b,_0x3a88a5,!![]);}catch(_0x171396){return BPromise[_0x1a3f('0x21')](_0x171396);}return _0x5abc0b['save']();};}function saveUpdates(_0x203e39,_0x4c1be9){return function(_0x4b3bec){if(_0x4b3bec){return _0x4b3bec[_0x1a3f('0x22')](_0x203e39)['then'](function(_0x272486){return _0x272486;});}return null;};}function removeEntity(_0x4dbffe,_0x32f152){return function(_0x353ce4){if(_0x353ce4){return _0x353ce4[_0x1a3f('0x23')]()['then'](function(){var _0x321775=_0x353ce4[_0x1a3f('0x24')]({'plain':!![]});var _0x312572=_0x1a3f('0x25');return db[_0x1a3f('0x26')]['destroy']({'where':{'type':_0x312572,'resourceId':_0x321775['id']}})['then'](function(){return _0x353ce4;});})[_0x1a3f('0x27')](function(){_0x4dbffe[_0x1a3f('0x18')](0xcc)[_0x1a3f('0x19')]();});}};}function handleEntityNotFound(_0x504361,_0x1bd7d1){return function(_0x4a1734){if(!_0x4a1734){_0x504361['sendStatus'](0x194);}return _0x4a1734;};}function handleError(_0x20050e,_0x2602a6){_0x2602a6=_0x2602a6||0x1f4;return function(_0x2a6746){logger[_0x1a3f('0x28')](_0x2a6746['stack']);if(_0x2a6746[_0x1a3f('0x29')]){delete _0x2a6746['name'];}_0x20050e[_0x1a3f('0x18')](_0x2602a6)[_0x1a3f('0x2a')](_0x2a6746);};}exports[_0x1a3f('0x2b')]=function(_0xa9e7b0,_0x507860){var _0x3e8740={},_0x4e19c8={},_0x544184={'count':0x0,'rows':[]};var _0x352bc6=_[_0x1a3f('0x2c')](db[_0x1a3f('0x2d')][_0x1a3f('0x2e')],function(_0x2a12b7){return{'name':_0x2a12b7[_0x1a3f('0x2f')],'type':_0x2a12b7[_0x1a3f('0x30')]['key']};});_0x4e19c8[_0x1a3f('0x31')]=_[_0x1a3f('0x2c')](_0x352bc6,_0x1a3f('0x29'));_0x4e19c8['query']=_[_0x1a3f('0x32')](_0xa9e7b0[_0x1a3f('0x33')]);_0x4e19c8[_0x1a3f('0x34')]=_[_0x1a3f('0x35')](_0x4e19c8['model'],_0x4e19c8['query']);_0x3e8740[_0x1a3f('0x36')]=_[_0x1a3f('0x35')](_0x4e19c8['model'],qs['fields'](_0xa9e7b0[_0x1a3f('0x33')][_0x1a3f('0x37')]));_0x3e8740[_0x1a3f('0x36')]=_0x3e8740[_0x1a3f('0x36')]['length']?_0x3e8740[_0x1a3f('0x36')]:_0x4e19c8[_0x1a3f('0x31')];if(!_0xa9e7b0[_0x1a3f('0x33')]['hasOwnProperty'](_0x1a3f('0x38'))){_0x3e8740['limit']=qs[_0x1a3f('0x1d')](_0xa9e7b0[_0x1a3f('0x33')]['limit']);_0x3e8740[_0x1a3f('0x1a')]=qs['offset'](_0xa9e7b0[_0x1a3f('0x33')][_0x1a3f('0x1a')]);}_0x3e8740[_0x1a3f('0x39')]=qs[_0x1a3f('0x3a')](_0xa9e7b0[_0x1a3f('0x33')][_0x1a3f('0x3a')]);delete _0xa9e7b0[_0x1a3f('0x33')]['sort'];_0x3e8740[_0x1a3f('0x3b')]=qs[_0x1a3f('0x34')](_[_0x1a3f('0x3c')](_0xa9e7b0[_0x1a3f('0x33')],_0x4e19c8[_0x1a3f('0x34')]),_0x352bc6);if(_0xa9e7b0['query'][_0x1a3f('0x3d')]){_0x3e8740[_0x1a3f('0x3b')]=_['merge'](_0x3e8740['where'],{'$or':_[_0x1a3f('0x2c')](_0x352bc6,function(_0x40d7ce){if(_0x40d7ce['type']!==_0x1a3f('0x3e')){var _0x2f3679={};_0x2f3679[_0x40d7ce['name']]={'$like':'%'+_0xa9e7b0[_0x1a3f('0x33')][_0x1a3f('0x3d')]+'%'};return _0x2f3679;}})});}_0x3e8740=_[_0x1a3f('0x3f')]({},_0x3e8740,_0xa9e7b0['options']);var _0x19f717={'where':_0x3e8740['where']};return db[_0x1a3f('0x2d')][_0x1a3f('0x1c')](_0x19f717)['then'](function(_0x48aa9d){_0x544184['count']=_0x48aa9d;if(_0xa9e7b0[_0x1a3f('0x33')][_0x1a3f('0x40')]){_0x3e8740[_0x1a3f('0x41')]=[{'all':!![]}];}return db[_0x1a3f('0x2d')][_0x1a3f('0x42')](_0x3e8740);})[_0x1a3f('0x27')](function(_0x29ebe8){_0x544184[_0x1a3f('0x43')]=_0x29ebe8;return _0x544184;})[_0x1a3f('0x27')](respondWithFilteredResult(_0x507860,_0x3e8740))[_0x1a3f('0x44')](handleError(_0x507860,null));};exports[_0x1a3f('0x45')]=function(_0x239239,_0x48ed09){var _0x3894a5={'raw':![],'where':{'id':_0x239239[_0x1a3f('0x46')]['id']}},_0x4a1b68={};_0x4a1b68[_0x1a3f('0x31')]=_[_0x1a3f('0x32')](db[_0x1a3f('0x2d')][_0x1a3f('0x2e')]);_0x4a1b68['query']=_[_0x1a3f('0x32')](_0x239239[_0x1a3f('0x33')]);_0x4a1b68[_0x1a3f('0x34')]=_[_0x1a3f('0x35')](_0x4a1b68[_0x1a3f('0x31')],_0x4a1b68[_0x1a3f('0x33')]);_0x3894a5[_0x1a3f('0x36')]=_[_0x1a3f('0x35')](_0x4a1b68['model'],qs[_0x1a3f('0x37')](_0x239239[_0x1a3f('0x33')][_0x1a3f('0x37')]));_0x3894a5[_0x1a3f('0x36')]=_0x3894a5['attributes'][_0x1a3f('0x47')]?_0x3894a5['attributes']:_0x4a1b68[_0x1a3f('0x31')];if(_0x239239[_0x1a3f('0x33')][_0x1a3f('0x40')]){_0x3894a5[_0x1a3f('0x41')]=[{'all':!![]}];}_0x3894a5=_[_0x1a3f('0x3f')]({},_0x3894a5,_0x239239[_0x1a3f('0x48')]);return db[_0x1a3f('0x2d')][_0x1a3f('0x49')](_0x3894a5)[_0x1a3f('0x27')](handleEntityNotFound(_0x48ed09,null))[_0x1a3f('0x27')](respondWithResult(_0x48ed09,null))[_0x1a3f('0x44')](handleError(_0x48ed09,null));};exports['update']=function(_0x3cada6,_0x552965){if(_0x3cada6['body']['id']){delete _0x3cada6[_0x1a3f('0x4a')]['id'];}return db[_0x1a3f('0x2d')][_0x1a3f('0x49')]({'where':{'id':_0x3cada6['params']['id']}})[_0x1a3f('0x27')](handleEntityNotFound(_0x552965,null))['then'](saveUpdates(_0x3cada6[_0x1a3f('0x4a')],null))[_0x1a3f('0x27')](respondWithResult(_0x552965,null))[_0x1a3f('0x44')](handleError(_0x552965,null));};exports['create']=function(_0x2ee3d6,_0x55b8e2,_0x9adae2){return db[_0x1a3f('0x4b')][_0x1a3f('0x4c')](function(_0x1a4dbf){if(_0x2ee3d6[_0x1a3f('0x4a')][_0x1a3f('0x4d')]==='files'){_0x2ee3d6[_0x1a3f('0x4a')][_0x1a3f('0x4e')]=path[_0x1a3f('0x4f')](config['root'],_0x1a3f('0x50'),_0x2ee3d6['body'][_0x1a3f('0x29')]);}return db[_0x1a3f('0x2d')]['create'](_0x2ee3d6[_0x1a3f('0x4a')],{'transaction':_0x1a4dbf})[_0x1a3f('0x27')](function(_0x4a02da){if(_0x2ee3d6[_0x1a3f('0x4a')]['mode']===_0x1a3f('0x51')){fs[_0x1a3f('0x52')](_0x4a02da['directory'],parseInt('0777',0x8));}var _0x32fb67=_0x2ee3d6[_0x1a3f('0x53')]['get']({'plain':!![]});if(!_0x32fb67)throw new Error(_0x1a3f('0x54'));if(_0x32fb67[_0x1a3f('0x55')]===_0x1a3f('0x53')){var _0x20bd64=_0x4a02da[_0x1a3f('0x24')]({'plain':!![]});return db[_0x1a3f('0x56')][_0x1a3f('0x49')]({'where':{'name':_0x1a3f('0x25'),'userProfileId':_0x32fb67[_0x1a3f('0x57')]},'raw':!![]})['then'](function(_0x195133){if(_0x195133&&_0x195133['autoAssociation']===0x0){return db[_0x1a3f('0x26')]['create']({'name':_0x20bd64[_0x1a3f('0x29')],'resourceId':_0x20bd64['id'],'type':_0x195133[_0x1a3f('0x29')],'sectionId':_0x195133['id']},{})[_0x1a3f('0x27')](function(){return _0x4a02da;});}else{return _0x4a02da;}})[_0x1a3f('0x44')](function(_0x2e4a49){logger[_0x1a3f('0x28')](_0x1a3f('0x58'),_0x2e4a49);});}return _0x4a02da;});})[_0x1a3f('0x27')](respondWithResult(_0x55b8e2,0xc9))[_0x1a3f('0x44')](handleError(_0x55b8e2,null));};exports[_0x1a3f('0x23')]=function(_0x51733d,_0x1a0624,_0x2d571b){var _0x35b6a3;return db[_0x1a3f('0x2d')][_0x1a3f('0x49')]({'where':{'id':_0x51733d['params']['id']}})[_0x1a3f('0x27')](function(_0x2163c1){if(_0x2163c1){return db[_0x1a3f('0x4b')]['transaction'](function(_0x341eb8){return _0x2163c1[_0x1a3f('0x23')]({'transaction':_0x341eb8,'raw':!![]})[_0x1a3f('0x27')](function(_0x51dde2){if(_0x51dde2[_0x1a3f('0x4e')]){fs[_0x1a3f('0x59')](_0x51dde2[_0x1a3f('0x4e')])[_0x1a3f('0x5a')](function(_0x955bd6){fs[_0x1a3f('0x5b')](path[_0x1a3f('0x4f')](_0x51dde2[_0x1a3f('0x4e')],_0x955bd6));});fs[_0x1a3f('0x5c')](_0x51dde2['directory']);}return _0x51dde2;});})[_0x1a3f('0x44')](function(_0x587748){throw new db[(_0x1a3f('0x5d'))][(_0x1a3f('0x5e'))](_0x587748['message']);});}})[_0x1a3f('0x27')](handleEntityNotFound(_0x1a0624,null))[_0x1a3f('0x27')](removeEntity(_0x1a0624,null))['catch'](handleError(_0x1a0624,null));};exports[_0x1a3f('0x5f')]=function(_0x288ff3,_0x1abab5,_0x3f12c8){return db['sequelize'][_0x1a3f('0x4c')](function(_0x4669e6){var _0x5f3972;return db[_0x1a3f('0x2d')]['find']({'where':{'id':_0x288ff3[_0x1a3f('0x46')]['id']}})[_0x1a3f('0x27')](function(_0x5d8a5b){if(_0x5d8a5b){_0x5f3972=_0x5d8a5b;return _0x5d8a5b[_0x1a3f('0x5f')](_0x288ff3[_0x1a3f('0x4a')]['id'],{'transaction':_0x4669e6});}})[_0x1a3f('0x27')](function(_0x105294){if(_0x105294){return db[_0x1a3f('0x60')][_0x1a3f('0x61')]({'where':{'id':_0x288ff3[_0x1a3f('0x4a')]['id']},'attributes':['id',_0x1a3f('0x29'),_0x1a3f('0x62'),_0x1a3f('0x63'),_0x1a3f('0x64')],'raw':!![]});}})['then'](function(_0x22b35f){if(_0x22b35f){var _0xd1b58e=path[_0x1a3f('0x4f')](config['root'],_0x1a3f('0x65'),util[_0x1a3f('0x66')](_0x1a3f('0x67'),path[_0x1a3f('0x68')](_0x22b35f[_0x1a3f('0x62')],path[_0x1a3f('0x69')](_0x22b35f[_0x1a3f('0x62')])),_0x22b35f[_0x1a3f('0x63')]));var _0x25e999=path[_0x1a3f('0x4f')](config[_0x1a3f('0x6a')],'server/files/moh',_0x5f3972['name'],util['format'](_0x1a3f('0x67'),_0x22b35f[_0x1a3f('0x29')],_0x22b35f[_0x1a3f('0x63')]));fs[_0x1a3f('0x6b')](_0xd1b58e,_0x25e999);return _0x22b35f;}})['catch'](function(_0x175874){throw new db[(_0x1a3f('0x5d'))]['ValidationError'](_0x175874[_0x1a3f('0x6c')]);});})[_0x1a3f('0x27')](handleEntityNotFound(_0x1abab5,null))['then'](respondWithResult(_0x1abab5,0xc9))['catch'](handleError(_0x1abab5,null));};exports[_0x1a3f('0x6d')]=function(_0x41d94c,_0x15c066,_0x4de27b){return db[_0x1a3f('0x4b')][_0x1a3f('0x4c')](function(_0x263523){var _0x4dbdcd;return db[_0x1a3f('0x2d')]['findOne']({'where':{'id':_0x41d94c[_0x1a3f('0x46')]['id']}})[_0x1a3f('0x27')](handleEntityNotFound(_0x15c066,null))[_0x1a3f('0x27')](function(_0xbd626e){if(_0xbd626e){_0x4dbdcd=_0xbd626e;return _0xbd626e[_0x1a3f('0x6d')](_0x41d94c['params'][_0x1a3f('0x6e')]);}})[_0x1a3f('0x27')](function(_0x440f66){if(_0x440f66){return db[_0x1a3f('0x60')][_0x1a3f('0x61')]({'where':{'id':_0x41d94c['params'][_0x1a3f('0x6e')]},'attributes':['id','name',_0x1a3f('0x62'),_0x1a3f('0x63'),'createdAt'],'raw':!![]});}})['then'](function(_0x460a91){if(_0x460a91){fs[_0x1a3f('0x5b')](path['join'](_0x4dbdcd[_0x1a3f('0x4e')],util[_0x1a3f('0x66')](_0x1a3f('0x67'),_0x460a91[_0x1a3f('0x29')],_0x460a91[_0x1a3f('0x63')])));return _0x460a91;}})['catch'](function(_0x5b3be2){throw new db[(_0x1a3f('0x5d'))][(_0x1a3f('0x5e'))](_0x5b3be2[_0x1a3f('0x6c')]);});})[_0x1a3f('0x27')](handleEntityNotFound(_0x15c066,null))[_0x1a3f('0x27')](respondWithStatusCode(_0x15c066,0xcc))[_0x1a3f('0x44')](handleError(_0x15c066,null));};exports[_0x1a3f('0x6f')]=function(_0x4a41ef,_0x3c4547,_0x44317a){var _0x15bc16={};var _0x545863={};var _0x3d0838;var _0x10a351;return db[_0x1a3f('0x2d')][_0x1a3f('0x61')]({'where':{'id':_0x4a41ef[_0x1a3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c4547,null))[_0x1a3f('0x27')](function(_0x11a5c8){if(_0x11a5c8){_0x3d0838=_0x11a5c8;_0x545863[_0x1a3f('0x31')]=_[_0x1a3f('0x32')](db[_0x1a3f('0x60')][_0x1a3f('0x2e')]);_0x545863[_0x1a3f('0x33')]=_[_0x1a3f('0x32')](_0x4a41ef[_0x1a3f('0x33')]);_0x545863[_0x1a3f('0x34')]=_['intersection'](_0x545863['model'],_0x545863['query']);_0x15bc16[_0x1a3f('0x36')]=_[_0x1a3f('0x35')](_0x545863[_0x1a3f('0x31')],qs[_0x1a3f('0x37')](_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x37')]));_0x15bc16[_0x1a3f('0x36')]=_0x15bc16[_0x1a3f('0x36')][_0x1a3f('0x47')]?_0x15bc16['attributes']:_0x545863['model'];_0x15bc16['order']=qs['sort'](_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x3a')]);_0x15bc16[_0x1a3f('0x3b')]=qs[_0x1a3f('0x34')](_[_0x1a3f('0x3c')](_0x4a41ef[_0x1a3f('0x33')],_0x545863[_0x1a3f('0x34')]));if(_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x3d')]){_0x15bc16[_0x1a3f('0x3b')]=_[_0x1a3f('0x3f')](_0x15bc16[_0x1a3f('0x3b')],{'$or':_[_0x1a3f('0x2c')](_0x15bc16[_0x1a3f('0x36')],function(_0x2f706b){var _0xb2f897={};_0xb2f897[_0x2f706b]={'$like':'%'+_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x3d')]+'%'};return _0xb2f897;})});}_0x15bc16=_['merge']({},_0x15bc16,_0x4a41ef[_0x1a3f('0x48')]);return _0x3d0838[_0x1a3f('0x6f')](_0x15bc16);}})['then'](function(_0x2533d8){if(_0x2533d8){_0x10a351=_0x2533d8[_0x1a3f('0x47')];if(!_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x70')](_0x1a3f('0x38'))){_0x15bc16[_0x1a3f('0x1d')]=qs['limit'](_0x4a41ef[_0x1a3f('0x33')]['limit']);_0x15bc16[_0x1a3f('0x1a')]=qs[_0x1a3f('0x1a')](_0x4a41ef[_0x1a3f('0x33')][_0x1a3f('0x1a')]);}return _0x3d0838[_0x1a3f('0x6f')](_0x15bc16);}})[_0x1a3f('0x27')](function(_0x1847e4){if(_0x1847e4){return _0x1847e4?{'count':_0x10a351,'rows':_0x1847e4}:null;}})[_0x1a3f('0x27')](respondWithResult(_0x3c4547,null))[_0x1a3f('0x44')](handleError(_0x3c4547,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index deb5e9e..03dcf92 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 _0x4b23=['voice_musiconhold','lodash','util','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','VoiceMusicOnHold'];(function(_0x5d2ea0,_0x139918){var _0x45c004=function(_0x502aed){while(--_0x502aed){_0x5d2ea0['push'](_0x5d2ea0['shift']());}};_0x45c004(++_0x139918);}(_0x4b23,0xeb));var _0x34b2=function(_0x2cb1bd,_0x42b64c){_0x2cb1bd=_0x2cb1bd-0x0;var _0x393fdf=_0x4b23[_0x2cb1bd];return _0x393fdf;};'use strict';var _=require(_0x34b2('0x0'));var util=require(_0x34b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x34b2('0x3'));var fs=require('fs');var path=require(_0x34b2('0x4'));var rimraf=require(_0x34b2('0x5'));var config=require('../../config/environment');var attributes=require(_0x34b2('0x6'));module['exports']=function(_0x3adf21,_0x2bae41){return _0x3adf21['define'](_0x34b2('0x7'),attributes,{'tableName':_0x34b2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x476a=['request-promise','path','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','bluebird'];(function(_0x31aff8,_0x3a8ed6){var _0xecff93=function(_0x241774){while(--_0x241774){_0x31aff8['push'](_0x31aff8['shift']());}};_0xecff93(++_0x3a8ed6);}(_0x476a,0x1a9));var _0xa476=function(_0xdc1af4,_0x4ed6f1){_0xdc1af4=_0xdc1af4-0x0;var _0x231abb=_0x476a[_0xdc1af4];return _0x231abb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa476('0x0'))(_0xa476('0x1'));var moment=require(_0xa476('0x2'));var BPromise=require(_0xa476('0x3'));var rp=require(_0xa476('0x4'));var fs=require('fs');var path=require(_0xa476('0x5'));var rimraf=require('rimraf');var config=require(_0xa476('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xa476('0x7')]=function(_0x528d53,_0x1917be){return _0x528d53[_0xa476('0x8')](_0xa476('0x9'),attributes,{'tableName':_0xa476('0xa'),'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 8b37df1..b847415 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2f9c44,_0x46a7bf){var _0x80d9db=function(_0x5b1af4){while(--_0x5b1af4){_0x2f9c44['push'](_0x2f9c44['shift']());}};_0x80d9db(++_0x46a7bf);}(_0x34e8,0x12c));var _0x834e=function(_0x27f6be,_0x1e3448){_0x27f6be=_0x27f6be-0x0;var _0x18c174=_0x34e8[_0x27f6be];return _0x18c174;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x28412d,_0x282ffe){var _0x37a355=function(_0x574321){while(--_0x574321){_0x28412d['push'](_0x28412d['shift']());}};_0x37a355(++_0x282ffe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xcb91[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5128337..3af37d2 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 _0xea89=['post','addTeams','put','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0xea89,0x1e2));var _0x9ea8=function(_0x18a1f6,_0x5356c4){_0x18a1f6=_0x18a1f6-0x0;var _0x493551=_0xea89[_0x18a1f6];return _0x493551;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ea8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ea8('0x6'));var config=require('../../config/environment');var controller=require(_0x9ea8('0x7'));router[_0x9ea8('0x8')]('/',auth[_0x9ea8('0x9')](),controller[_0x9ea8('0xa')]);router[_0x9ea8('0x8')](_0x9ea8('0xb'),auth[_0x9ea8('0x9')](),controller['describe']);router[_0x9ea8('0x8')](_0x9ea8('0xc'),auth['isAuthenticated'](),controller[_0x9ea8('0xd')]);router[_0x9ea8('0x8')](_0x9ea8('0xe'),auth['isAuthenticated'](),controller[_0x9ea8('0xf')]);router[_0x9ea8('0x8')](_0x9ea8('0x10'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0x11')]);router[_0x9ea8('0x12')]('/',auth[_0x9ea8('0x9')](),controller['create']);router[_0x9ea8('0x12')](_0x9ea8('0xe'),auth[_0x9ea8('0x9')](),controller['addAgents']);router[_0x9ea8('0x12')](_0x9ea8('0x10'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0x13')]);router[_0x9ea8('0x14')](_0x9ea8('0xc'),auth[_0x9ea8('0x9')](),controller['update']);router[_0x9ea8('0x15')](_0x9ea8('0xc'),auth[_0x9ea8('0x9')](),controller['destroy']);router[_0x9ea8('0x15')]('/:id/users',auth[_0x9ea8('0x9')](),controller[_0x9ea8('0x16')]);router[_0x9ea8('0x15')](_0x9ea8('0x10'),auth[_0x9ea8('0x9')](),controller[_0x9ea8('0x17')]);module[_0x9ea8('0x18')]=router; \ No newline at end of file +var _0x10eb=['create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x265b44,_0x4e9620){var _0x5b1a17=function(_0x32f6c3){while(--_0x32f6c3){_0x265b44['push'](_0x265b44['shift']());}};_0x5b1a17(++_0x4e9620);}(_0x10eb,0x71));var _0xb10e=function(_0x2ed651,_0x5c75af){_0x2ed651=_0x2ed651-0x0;var _0x5780ae=_0x10eb[_0x2ed651];return _0x5780ae;};'use strict';var multer=require(_0xb10e('0x0'));var util=require('util');var path=require(_0xb10e('0x1'));var timeout=require(_0xb10e('0x2'));var express=require(_0xb10e('0x3'));var router=express[_0xb10e('0x4')]();var fs_extra=require(_0xb10e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xb10e('0x8')](),controller[_0xb10e('0x9')]);router[_0xb10e('0xa')](_0xb10e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb10e('0xc')]);router[_0xb10e('0xa')](_0xb10e('0xd'),auth[_0xb10e('0x8')](),controller[_0xb10e('0xe')]);router[_0xb10e('0xa')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x10')]);router['post']('/',auth[_0xb10e('0x8')](),controller[_0xb10e('0x11')]);router[_0xb10e('0x12')]('/:id/users',auth[_0xb10e('0x8')](),controller['addAgents']);router[_0xb10e('0x12')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x13')]);router[_0xb10e('0x14')](_0xb10e('0x15'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x16')]);router[_0xb10e('0x17')]('/:id',auth[_0xb10e('0x8')](),controller[_0xb10e('0x18')]);router[_0xb10e('0x17')](_0xb10e('0xd'),auth[_0xb10e('0x8')](),controller['removeAgents']);router[_0xb10e('0x17')](_0xb10e('0xf'),auth[_0xb10e('0x8')](),controller[_0xb10e('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 11c56ed..4c93132 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 _0xe57d=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x2a3382,_0x3ed2e4){var _0x507f4a=function(_0x42a6cd){while(--_0x42a6cd){_0x2a3382['push'](_0x2a3382['shift']());}};_0x507f4a(++_0x3ed2e4);}(_0xe57d,0x15f));var _0xde57=function(_0x29a7ec,_0x4e3a9c){_0x29a7ec=_0x29a7ec-0x0;var _0x38ad00=_0xe57d[_0x29a7ec];return _0x38ad00;};'use strict';var Sequelize=require(_0xde57('0x0'));module[_0xde57('0x1')]={'name':{'type':Sequelize[_0xde57('0x2')],'allowNull':![],'unique':_0xde57('0x3')},'prefix':{'type':Sequelize[_0xde57('0x4')],'get':function(_0x4bd796){return _0xde57('0x5')+this['getDataValue'](_0xde57('0x3'))+'-';}},'description':{'type':Sequelize[_0xde57('0x2')]},'callerIdAll':{'type':Sequelize[_0xde57('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xde57('0x6')]}}; \ No newline at end of file +var _0x3168=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3168,0xe7));var _0x8316=function(_0x3be641,_0x396724){_0x3be641=_0x3be641-0x0;var _0x2d9e5d=_0x3168[_0x3be641];return _0x2d9e5d;};'use strict';var Sequelize=require(_0x8316('0x0'));module[_0x8316('0x1')]={'name':{'type':Sequelize[_0x8316('0x2')],'allowNull':![],'unique':_0x8316('0x3')},'prefix':{'type':Sequelize[_0x8316('0x4')],'get':function(_0xd6f36a){return _0x8316('0x5')+this[_0x8316('0x6')](_0x8316('0x3'))+'-';}},'description':{'type':Sequelize[_0x8316('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x8316('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6936c59..d5ec562 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 _0x5b12=['QueryTypes','SELECT','TeamId','includes','all','union','compact','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','from-sip','exten','app','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','merge','getTeams','Team','User','online','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b12,0xa3));var _0x25b1=function(_0x45190b,_0x3e8326){_0x45190b=_0x45190b-0x0;var _0x1731d9=_0x5b12[_0x45190b];return _0x1731d9;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];config[_0x25b1('0x19')]=_[_0x25b1('0x1a')](config[_0x25b1('0x19')],{'host':_0x25b1('0x1b'),'port':0x18eb});var socket=require(_0x25b1('0x1c'))(new Redis(config[_0x25b1('0x19')]));require(_0x25b1('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c337a,_0x2559a1){_0x2559a1=_0x2559a1||0xcc;return function(_0x4de13f){if(_0x4de13f){return _0x2c337a[_0x25b1('0x1e')](_0x2559a1);}return _0x2c337a[_0x25b1('0x1f')](_0x2559a1)[_0x25b1('0x20')]();};}function respondWithResult(_0x4a5a58,_0x593165){_0x593165=_0x593165||0xc8;return function(_0x7b50ab){if(_0x7b50ab){return _0x4a5a58['status'](_0x593165)[_0x25b1('0x21')](_0x7b50ab);}};}function respondWithFilteredResult(_0x2ca567,_0x1be2d8){return function(_0x27ccc9){if(_0x27ccc9){var _0x1f78c2=typeof _0x1be2d8[_0x25b1('0x22')]===_0x25b1('0x23')&&typeof _0x1be2d8[_0x25b1('0x24')]==='undefined';var _0x4ecff1=_0x27ccc9[_0x25b1('0x25')];var _0x501dc8=_0x1f78c2?0x0:_0x1be2d8[_0x25b1('0x22')];var _0x50ae0f=_0x1f78c2?_0x27ccc9[_0x25b1('0x25')]:_0x1be2d8['offset']+_0x1be2d8[_0x25b1('0x24')];var _0x529310;if(_0x50ae0f>=_0x4ecff1){_0x50ae0f=_0x4ecff1;_0x529310=0xc8;}else{_0x529310=0xce;}_0x2ca567[_0x25b1('0x1f')](_0x529310);return _0x2ca567['set']('Content-Range',_0x501dc8+'-'+_0x50ae0f+'/'+_0x4ecff1)['json'](_0x27ccc9);}return null;};}function patchUpdates(_0x3bca9f){return function(_0x150436){try{jsonpatch['apply'](_0x150436,_0x3bca9f,!![]);}catch(_0x19bab8){return BPromise[_0x25b1('0x26')](_0x19bab8);}return _0x150436[_0x25b1('0x27')]();};}function saveUpdates(_0x246acd,_0x1aabbb){return function(_0x5e6b6b){if(_0x5e6b6b){return _0x5e6b6b[_0x25b1('0x28')](_0x246acd)[_0x25b1('0x29')](function(_0xd22469){return _0xd22469;});}return null;};}function removeEntity(_0x282187,_0x1f37ed){return function(_0x1292bf){if(_0x1292bf){return _0x1292bf['destroy']()[_0x25b1('0x29')](function(){var _0x27dd68=_0x1292bf[_0x25b1('0x2a')]({'plain':!![]});var _0x5bc8fc=_0x25b1('0x2b');return db[_0x25b1('0x2c')][_0x25b1('0x2d')]({'where':{'type':_0x5bc8fc,'resourceId':_0x27dd68['id']}})['then'](function(){return _0x1292bf;});})[_0x25b1('0x29')](function(){_0x282187['status'](0xcc)[_0x25b1('0x20')]();});}};}function handleEntityNotFound(_0x3febb8,_0x3a4475){return function(_0x293413){if(!_0x293413){_0x3febb8[_0x25b1('0x1e')](0x194);}return _0x293413;};}function handleError(_0x300a14,_0x46e429){_0x46e429=_0x46e429||0x1f4;return function(_0x4cd825){logger[_0x25b1('0x2e')](_0x4cd825[_0x25b1('0x2f')]);if(_0x4cd825[_0x25b1('0x30')]){delete _0x4cd825[_0x25b1('0x30')];}_0x300a14[_0x25b1('0x1f')](_0x46e429)['send'](_0x4cd825);};}exports[_0x25b1('0x31')]=function(_0x548dd0,_0x42441d){var _0x1622e8={},_0x1e1796={},_0x5a4234={'count':0x0,'rows':[]};var _0x5cbde5=_[_0x25b1('0x32')](db['VoicePrefix'][_0x25b1('0x33')],function(_0x391713){return{'name':_0x391713[_0x25b1('0x34')],'type':_0x391713['type']['key']};});_0x1e1796[_0x25b1('0x35')]=_[_0x25b1('0x32')](_0x5cbde5,_0x25b1('0x30'));_0x1e1796['query']=_[_0x25b1('0x36')](_0x548dd0[_0x25b1('0x37')]);_0x1e1796[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x1e1796['model'],_0x1e1796[_0x25b1('0x37')]);_0x1622e8[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1e1796['model'],qs['fields'](_0x548dd0[_0x25b1('0x37')]['fields']));_0x1622e8[_0x25b1('0x3a')]=_0x1622e8[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x1622e8[_0x25b1('0x3a')]:_0x1e1796[_0x25b1('0x35')];if(!_0x548dd0[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x1622e8[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x548dd0[_0x25b1('0x37')][_0x25b1('0x24')]);_0x1622e8[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x548dd0[_0x25b1('0x37')]['offset']);}_0x1622e8[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x548dd0['query'][_0x25b1('0x3f')]);_0x1622e8[_0x25b1('0x40')]=qs[_0x25b1('0x38')](_[_0x25b1('0x41')](_0x548dd0[_0x25b1('0x37')],_0x1e1796['filters']),_0x5cbde5);if(_0x548dd0[_0x25b1('0x37')]['filter']){_0x1622e8[_0x25b1('0x40')]=_['merge'](_0x1622e8[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x5cbde5,function(_0x1b354e){if(_0x1b354e[_0x25b1('0x42')]!==_0x25b1('0x43')){var _0x45713f={};_0x45713f[_0x1b354e[_0x25b1('0x30')]]={'$like':'%'+_0x548dd0[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x45713f;}})});}_0x1622e8=_['merge']({},_0x1622e8,_0x548dd0[_0x25b1('0x45')]);var _0x585c37={'where':_0x1622e8[_0x25b1('0x40')]};return db[_0x25b1('0x46')]['count'](_0x585c37)[_0x25b1('0x29')](function(_0x39b4c7){_0x5a4234[_0x25b1('0x25')]=_0x39b4c7;if(_0x548dd0[_0x25b1('0x37')][_0x25b1('0x47')]){_0x1622e8[_0x25b1('0x48')]=[{'all':!![]}];}return db[_0x25b1('0x46')][_0x25b1('0x49')](_0x1622e8);})[_0x25b1('0x29')](function(_0x453352){_0x5a4234[_0x25b1('0x4a')]=_0x453352;return _0x5a4234;})[_0x25b1('0x29')](respondWithFilteredResult(_0x42441d,_0x1622e8))[_0x25b1('0x4b')](handleError(_0x42441d,null));};exports[_0x25b1('0x4c')]=function(_0x21242a,_0x210cef){var _0x103953={'raw':![],'where':{'id':_0x21242a['params']['id']}},_0x210a13={};_0x210a13['model']=_['keys'](db[_0x25b1('0x46')]['rawAttributes']);_0x210a13[_0x25b1('0x37')]=_['keys'](_0x21242a[_0x25b1('0x37')]);_0x210a13[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x210a13[_0x25b1('0x35')],_0x210a13[_0x25b1('0x37')]);_0x103953[_0x25b1('0x3a')]=_['intersection'](_0x210a13[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x21242a[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x103953['attributes']=_0x103953[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x103953[_0x25b1('0x3a')]:_0x210a13['model'];if(_0x21242a[_0x25b1('0x37')]['includeAll']){_0x103953[_0x25b1('0x48')]=[{'all':!![]}];}_0x103953=_['merge']({},_0x103953,_0x21242a['options']);return db[_0x25b1('0x46')][_0x25b1('0x4e')](_0x103953)[_0x25b1('0x29')](handleEntityNotFound(_0x210cef,null))[_0x25b1('0x29')](respondWithResult(_0x210cef,null))['catch'](handleError(_0x210cef,null));};exports[_0x25b1('0x2d')]=function(_0x58e612,_0x7c30da){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x58e612[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x7c30da,null))['then'](removeEntity(_0x7c30da,null))[_0x25b1('0x4b')](handleError(_0x7c30da,null));};exports[_0x25b1('0x50')]=function(_0x354294,_0xf38a9e){return db[_0x25b1('0x46')][_0x25b1('0x50')]()['then'](respondWithResult(_0xf38a9e,null))[_0x25b1('0x4b')](handleError(_0xf38a9e,null));};exports[_0x25b1('0x51')]=function(_0x168931,_0x2311da){var _0x5e367;return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x40d574){return db[_0x25b1('0x46')][_0x25b1('0x51')](_0x168931[_0x25b1('0x54')],{'transaction':_0x40d574})[_0x25b1('0x29')](function(_0x4190a1){_0x5e367=_0x4190a1[_0x25b1('0x2a')]({'plain':!![]});return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x5e367[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5732a1){return createVoicePrefixExtensions(_0x5e367,_0x5732a1,_0x40d574);});});})[_0x25b1('0x29')](function(){var _0x16e61e=_0x168931[_0x25b1('0x57')][_0x25b1('0x2a')]({'plain':!![]});if(!_0x16e61e)throw new Error(_0x25b1('0x58'));if(_0x16e61e[_0x25b1('0x59')]==='user'){var _0x105587=_0x5e367;return db[_0x25b1('0x5a')][_0x25b1('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x16e61e[_0x25b1('0x5b')]},'raw':!![]})['then'](function(_0x5bd36b){if(_0x5bd36b&&_0x5bd36b['autoAssociation']===0x0){return db['UserProfileResource'][_0x25b1('0x51')]({'name':_0x105587['name'],'resourceId':_0x105587['id'],'type':_0x5bd36b[_0x25b1('0x30')],'sectionId':_0x5bd36b['id']},{})[_0x25b1('0x29')](function(){return _0x5e367;});}else{return _0x5e367;}})[_0x25b1('0x4b')](function(_0x439bab){logger[_0x25b1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439bab);throw _0x439bab;});}return _0x5e367;})[_0x25b1('0x29')](respondWithResult(_0x2311da,null))[_0x25b1('0x4b')](handleError(_0x2311da,null));};function Extension(_0x37b58d,_0x400ec9,_0x5ecc36,_0xcca343){this[_0x25b1('0x5c')]=_0x25b1('0x5d');this[_0x25b1('0x5e')]=_0x37b58d;this[_0x25b1('0x5f')]=_0x5ecc36;this[_0x25b1('0x42')]='system';this[_0x25b1('0x60')]='Voice\x20Prefix\x20Extension';this[_0x25b1('0x61')]=_0x400ec9;this[_0x25b1('0x62')]=_0xcca343;}function createVoicePrefixExtensions(_0x49052b,_0x42a81f,_0x3d8d33){return new BPromise(function(_0x551bed,_0x1351ea){var _0x303049=new Extension(formatPrefixName(_0x49052b[_0x25b1('0x63')]),0x1,_0x25b1('0x64'),_0x25b1('0x65'));_0x303049[_0x25b1('0x66')]=_0x49052b['id'];return db[_0x25b1('0x55')][_0x25b1('0x51')](_0x303049,{'transaction':_0x3d8d33})['then'](function(_0x6f1b1f){var _0x1e2dcb=_0x6f1b1f[_0x25b1('0x2a')]({'plain':!![]});var _0x1da588=_[_0x25b1('0x32')](addVoicePrefixExtensions(_0x49052b,_0x42a81f),function(_0x2b9223){_0x2b9223[_0x25b1('0x56')]=_0x1e2dcb['id'];_0x2b9223[_0x25b1('0x66')]=_0x49052b['id'];return _0x2b9223;});return db['VoiceExtension'][_0x25b1('0x67')](_0x1da588,{'transaction':_0x3d8d33})[_0x25b1('0x29')](function(_0x51f922){if(!_0x51f922){return _0x1351ea(_0x25b1('0x68'));}else{return _0x551bed(_0x51f922);}})[_0x25b1('0x4b')](function(_0x5b71e5){return _0x1351ea(_0x5b71e5);});});;});};function addVoicePrefixExtensions(_0x26e90c,_0x498aca){var _0x44aa87=[];var _0x4e62b5=formatPrefixName(_0x26e90c[_0x25b1('0x63')]);_0x44aa87['push'](new Extension(_0x4e62b5,0x2,_0x25b1('0x69'),_0x25b1('0x6a')+_0x26e90c[_0x25b1('0x30')]));if(_0x26e90c['callerIdAll']){_0x44aa87['push'](new Extension(_0x4e62b5,0x3,_0x25b1('0x69'),_0x25b1('0x6b')+_0x26e90c[_0x25b1('0x6c')]));}else{_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x3,_0x25b1('0x64'),_0x25b1('0x6e')));}_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x4,_0x25b1('0x6f'),_0x498aca[_0x25b1('0x5c')]+','+_0x25b1('0x70')+(0x8+_0x26e90c[_0x25b1('0x30')][_0x25b1('0x3b')])+'}'+','+0x1));return _0x44aa87;}function formatPrefixName(_0x3d06ab){var _0x975b85='_';for(var _0x1c22c4=0x0;_0x1c22c4<_0x3d06ab[_0x25b1('0x3b')];_0x1c22c4++){if(_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)=='-'){_0x975b85+=_0x3d06ab[_0x25b1('0x71')](_0x1c22c4);}else{_0x975b85+='['+_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)+']';}}_0x975b85+='.';return _0x975b85;}exports[_0x25b1('0x28')]=function(_0x15272b,_0x2fe4a5,_0x584499){var _0x1a3368=_0x15272b['body'];_0x1a3368[_0x25b1('0x63')]=_0x25b1('0x72')+_0x1a3368[_0x25b1('0x30')]+'-';return db['sequelize']['transaction'](function(_0x3f9ca7){return db[_0x25b1('0x46')]['update'](_0x1a3368,{'where':{'id':_0x1a3368['id']},'transaction':_0x3f9ca7})[_0x25b1('0x29')](function(){return db[_0x25b1('0x55')][_0x25b1('0x2d')]({'where':{'VoicePrefixId':_0x1a3368['id']},'transaction':_0x3f9ca7})['then'](function(){return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x1a3368[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5f1fef){return createVoicePrefixExtensions(_0x1a3368,_0x5f1fef,_0x3f9ca7);});});});})[_0x25b1('0x29')](function(){return db[_0x25b1('0x46')][_0x25b1('0x73')](_0x1a3368['id']);})[_0x25b1('0x29')](respondWithResult(_0x2fe4a5,null))[_0x25b1('0x4b')](handleError(_0x2fe4a5,null));};exports[_0x25b1('0x74')]=function(_0x4a9fbf,_0x40400e,_0x3f77e0){return db['VoicePrefix']['find']({'where':{'id':_0x4a9fbf[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x40400e,null))[_0x25b1('0x29')](function(_0x3ff99d){if(_0x3ff99d){return _0x3ff99d[_0x25b1('0x74')](_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')],_['omit'](_0x4a9fbf[_0x25b1('0x54')],[_0x25b1('0x75'),'id'])||{})[_0x25b1('0x76')](function(_0x49fac2){for(var _0x1bbb9b=0x0;_0x1bbb9b<_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')]['length'];_0x1bbb9b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x78'),{'UserId':Number(_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')][_0x1bbb9b]),'VoicePrefixId':Number(_0x4a9fbf[_0x25b1('0x4f')]['id'])});}return _0x49fac2;});}})[_0x25b1('0x29')](respondWithResult(_0x40400e,null))[_0x25b1('0x4b')](handleError(_0x40400e,null));};exports[_0x25b1('0x79')]=function(_0x1a07cb,_0x18021f,_0x20b43f){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x1a07cb[_0x25b1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18021f,null))[_0x25b1('0x29')](function(_0x45804b){if(_0x45804b){return _0x45804b[_0x25b1('0x79')](_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')])['then'](function(){if(_['isArray'](_0x1a07cb[_0x25b1('0x37')]['ids'])){for(var _0x3e7f2b=0x0;_0x3e7f2b<_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')][_0x25b1('0x3b')];_0x3e7f2b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query'][_0x25b1('0x75')][_0x3e7f2b]),'VoicePrefixId':Number(_0x1a07cb[_0x25b1('0x4f')]['id'])});}}else{socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query']['ids']),'VoicePrefixId':Number(_0x1a07cb['params']['id'])});}});}})[_0x25b1('0x29')](respondWithStatusCode(_0x18021f,null))[_0x25b1('0x4b')](handleError(_0x18021f,null));};exports['getAgents']=function(_0x49c2d3,_0x271837,_0x102b85){var _0x6bbd44={};var _0x67a4b7={};var _0x54e1a6;var _0x10409f;return db[_0x25b1('0x46')][_0x25b1('0x7b')]({'where':{'id':_0x49c2d3[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x271837,null))[_0x25b1('0x29')](function(_0x175c72){if(_0x175c72){_0x54e1a6=_0x175c72;_0x67a4b7[_0x25b1('0x35')]=_['keys'](db['User'][_0x25b1('0x33')]);_0x67a4b7[_0x25b1('0x37')]=_['keys'](_0x49c2d3['query']);_0x67a4b7[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x67a4b7['model'],_0x67a4b7[_0x25b1('0x37')]);_0x6bbd44[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x67a4b7[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x6bbd44['attributes']=_0x6bbd44[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x6bbd44[_0x25b1('0x3a')]:_0x67a4b7['model'];_0x6bbd44['order']=qs['sort'](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x6bbd44[_0x25b1('0x40')]=qs['filters'](_['pick'](_0x49c2d3[_0x25b1('0x37')],_0x67a4b7[_0x25b1('0x38')]));if(_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x44')]){_0x6bbd44[_0x25b1('0x40')]=_[_0x25b1('0x7c')](_0x6bbd44[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x6bbd44[_0x25b1('0x3a')],function(_0x4c74f8){var _0xb7494b={};_0xb7494b[_0x4c74f8]={'$like':'%'+_0x49c2d3[_0x25b1('0x37')]['filter']+'%'};return _0xb7494b;})});}_0x6bbd44=_['merge']({},_0x6bbd44,_0x49c2d3[_0x25b1('0x45')]);return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x133a5d){if(_0x133a5d){_0x10409f=_0x133a5d[_0x25b1('0x3b')];if(!_0x49c2d3['query']['hasOwnProperty']('nolimit')){_0x6bbd44[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x49c2d3['query'][_0x25b1('0x24')]);_0x6bbd44[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x22')]);}return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x954de5){if(_0x954de5){return _0x954de5?{'count':_0x10409f,'rows':_0x954de5}:null;}})['then'](respondWithResult(_0x271837,null))[_0x25b1('0x4b')](handleError(_0x271837,null));};exports['getTeams']=function(_0x198561,_0x4c2b9f,_0x5c7849){var _0x92b5d6={};var _0x1958c0={};var _0x4428d2;var _0x12e63d;return db[_0x25b1('0x46')]['findOne']({'where':{'id':_0x198561['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x4c2b9f,null))['then'](function(_0x2890c1){if(_0x2890c1){_0x4428d2=_0x2890c1;_0x1958c0[_0x25b1('0x35')]=_[_0x25b1('0x36')](db['Team'][_0x25b1('0x33')]);_0x1958c0['query']=_['keys'](_0x198561['query']);_0x1958c0[_0x25b1('0x38')]=_['intersection'](_0x1958c0[_0x25b1('0x35')],_0x1958c0[_0x25b1('0x37')]);_0x92b5d6[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1958c0[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x198561[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x92b5d6[_0x25b1('0x3a')]=_0x92b5d6[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x92b5d6[_0x25b1('0x3a')]:_0x1958c0[_0x25b1('0x35')];_0x92b5d6[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x198561[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x92b5d6['where']=qs[_0x25b1('0x38')](_['pick'](_0x198561[_0x25b1('0x37')],_0x1958c0[_0x25b1('0x38')]));if(_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]){_0x92b5d6[_0x25b1('0x40')]=_['merge'](_0x92b5d6[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x92b5d6[_0x25b1('0x3a')],function(_0x5af2b6){var _0x339e82={};_0x339e82[_0x5af2b6]={'$like':'%'+_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x339e82;})});}_0x92b5d6=_[_0x25b1('0x7c')]({},_0x92b5d6,_0x198561['options']);return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x270f00){if(_0x270f00){_0x12e63d=_0x270f00['length'];if(!_0x198561[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x92b5d6['limit']=qs[_0x25b1('0x24')](_0x198561[_0x25b1('0x37')]['limit']);_0x92b5d6[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x198561['query'][_0x25b1('0x22')]);}return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x14b909){if(_0x14b909){return _0x14b909?{'count':_0x12e63d,'rows':_0x14b909}:null;}})[_0x25b1('0x29')](respondWithResult(_0x4c2b9f,null))[_0x25b1('0x4b')](handleError(_0x4c2b9f,null));};exports['addTeams']=function(_0x3496a9,_0x30f1e9,_0x18211a){var _0x3038be=_0x3496a9[_0x25b1('0x54')][_0x25b1('0x75')];var _0x310a32;return db[_0x25b1('0x7e')][_0x25b1('0x49')]({'where':{'id':_0x3038be},'attributes':['id'],'include':[{'model':db[_0x25b1('0x7f')],'as':'Agents','attributes':['id',_0x25b1('0x30'),_0x25b1('0x80'),'voicePause','interface'],'raw':!![]}]})[_0x25b1('0x29')](function(_0x96a1b0){if(_0x96a1b0){_0x310a32=_0x96a1b0;var _0x2db4a9=_[_0x25b1('0x81')](_0x96a1b0,function(_0x58e166){var _0x4c6181=_0x58e166['get']({'plain':!![]});return _0x4c6181[_0x25b1('0x82')];});return db[_0x25b1('0x46')][_0x25b1('0x4e')]({'where':{'id':_0x3496a9['params']['id']}})['then'](function(_0x16702d){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x55f740){return _0x16702d[_0x25b1('0x83')](_0x3038be,{'transaction':_0x55f740})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x310a32,function(_0x2da0d9){return db[_0x25b1('0x85')][_0x25b1('0x86')]({'TeamId':_0x2da0d9['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},{'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x2db4a9,function(_0x5c515b){return db[_0x25b1('0x87')][_0x25b1('0x88')]({'where':{'UserId':_0x5c515b['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){_0x2db4a9[_0x25b1('0x89')](function(_0x3c8c4e){socket[_0x25b1('0x77')]('userVoicePrefix:save',{'UserId':_0x3c8c4e['id'],'VoicePrefixId':_0x16702d['id']});});});});});}})[_0x25b1('0x29')](respondWithStatusCode(_0x30f1e9,null))['catch'](handleError(_0x30f1e9,null));};exports[_0x25b1('0x8a')]=function(_0x469405,_0x1010c4,_0x22d3e4){return db['Team']['findAll']({'where':{'id':_0x469405[_0x25b1('0x37')][_0x25b1('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1010c4,null))[_0x25b1('0x29')](function(_0xd05872){var _0x25c07f=_[_0x25b1('0x32')](_0xd05872,'id');var _0x1041d1=[];var _0x1f1160=[];var _0x29d8fe=squel[_0x25b1('0x8b')]();_0x29d8fe[_0x25b1('0x8c')](_0x25b1('0x8d'))[_0x25b1('0x8e')](_0x25b1('0x8f'),'tq')['join'](_0x25b1('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x25b1('0x40')](_0x25b1('0x91'),_0x469405[_0x25b1('0x4f')]['id']);for(var _0x1354c3=0x0;_0x1354c3<_0xd05872[_0x25b1('0x3b')];_0x1354c3+=0x1){let _0x3ccdab=_0xd05872[_0x1354c3];for(var _0x381a62=0x0;_0x381a62<_0x3ccdab[_0x25b1('0x82')]['length'];_0x381a62+=0x1){let _0x330ae7=_0x3ccdab[_0x25b1('0x82')][_0x381a62];var _0xbe6572=_0x29d8fe[_0x25b1('0x92')]();_0xbe6572[_0x25b1('0x40')](_0x25b1('0x93'),_0x330ae7['id']);_0x1f1160[_0x25b1('0x6d')](db['sequelize'][_0x25b1('0x37')](_0xbe6572[_0x25b1('0x94')](),{'type':db[_0x25b1('0x52')][_0x25b1('0x95')][_0x25b1('0x96')]})['then'](function(_0x4edb48){if(_0x4edb48[_0x25b1('0x3b')]===0x1){return _0x330ae7['id'];}else{var _0x2e924b=_['every'](_['map'](_0x4edb48,_0x25b1('0x97')),function(_0x16d969){return _[_0x25b1('0x98')](_0x25c07f,_0x16d969);});if(_0x2e924b){return _0x330ae7['id'];}}}));}}return BPromise[_0x25b1('0x99')](_0x1f1160)[_0x25b1('0x29')](function(_0x3128bd){_0x1041d1=_(_0x1041d1)[_0x25b1('0x9a')](_0x3128bd)[_0x25b1('0x9b')]()['value']();return db[_0x25b1('0x46')]['find']({'where':{'id':_0x469405['params']['id']}})[_0x25b1('0x29')](function(_0x4cf3e6){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x2c0147){return _0x4cf3e6[_0x25b1('0x8a')](_0x469405[_0x25b1('0x37')][_0x25b1('0x75')],{'transaction':_0x2c0147})[_0x25b1('0x29')](function(){if(!_['isEmpty'](_0x1041d1)){return _0x4cf3e6[_0x25b1('0x79')](_0x1041d1,{'transaction':_0x2c0147});}})[_0x25b1('0x29')](function(){_0x1041d1[_0x25b1('0x89')](function(_0x220f92){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':_0x220f92,'VoicePrefixId':_0x4cf3e6['id']});});});});});});})[_0x25b1('0x29')](respondWithStatusCode(_0x1010c4,null))[_0x25b1('0x4b')](handleError(_0x1010c4,null));}; \ No newline at end of file +var _0x3de3=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','VoicePrefixes','UserProfileResource','destroy','end','error','stack','name','send','index','map','VoicePrefix','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','intersection','find','params','describe','create','transaction','body','get','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','callerIdAll','No\x20callerid\x20available','push','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','emit','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto'];(function(_0x831c75,_0x4032ee){var _0x36c0d6=function(_0x4d9703){while(--_0x4d9703){_0x831c75['push'](_0x831c75['shift']());}};_0x36c0d6(++_0x4032ee);}(_0x3de3,0x1ce));var _0x33de=function(_0x49915b,_0x3e2d08){_0x49915b=_0x49915b-0x0;var _0x368a7f=_0x3de3[_0x49915b];return _0x368a7f;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];config[_0x33de('0x19')]=_['defaults'](config[_0x33de('0x19')],{'host':_0x33de('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x33de('0x1b'))[_0x33de('0x1c')](socket);function respondWithStatusCode(_0x2b3748,_0x57a2a1){_0x57a2a1=_0x57a2a1||0xcc;return function(_0x57aa73){if(_0x57aa73){return _0x2b3748[_0x33de('0x1d')](_0x57a2a1);}return _0x2b3748[_0x33de('0x1e')](_0x57a2a1)['end']();};}function respondWithResult(_0x4ff69f,_0x185849){_0x185849=_0x185849||0xc8;return function(_0x16c050){if(_0x16c050){return _0x4ff69f[_0x33de('0x1e')](_0x185849)['json'](_0x16c050);}};}function respondWithFilteredResult(_0x2db887,_0x1203cf){return function(_0x52cfa0){if(_0x52cfa0){var _0x2815a7=typeof _0x1203cf[_0x33de('0x1f')]==='undefined'&&typeof _0x1203cf['limit']===_0x33de('0x20');var _0x52d718=_0x52cfa0[_0x33de('0x21')];var _0x2f0529=_0x2815a7?0x0:_0x1203cf[_0x33de('0x1f')];var _0x315c9b=_0x2815a7?_0x52cfa0[_0x33de('0x21')]:_0x1203cf[_0x33de('0x1f')]+_0x1203cf[_0x33de('0x22')];var _0x493263;if(_0x315c9b>=_0x52d718){_0x315c9b=_0x52d718;_0x493263=0xc8;}else{_0x493263=0xce;}_0x2db887['status'](_0x493263);return _0x2db887[_0x33de('0x23')]('Content-Range',_0x2f0529+'-'+_0x315c9b+'/'+_0x52d718)[_0x33de('0x24')](_0x52cfa0);}return null;};}function patchUpdates(_0x4cd8db){return function(_0x28ed17){try{jsonpatch[_0x33de('0x25')](_0x28ed17,_0x4cd8db,!![]);}catch(_0x575e88){return BPromise[_0x33de('0x26')](_0x575e88);}return _0x28ed17['save']();};}function saveUpdates(_0x67d040,_0x5c602d){return function(_0x62743b){if(_0x62743b){return _0x62743b[_0x33de('0x27')](_0x67d040)[_0x33de('0x28')](function(_0x5b79d7){return _0x5b79d7;});}return null;};}function removeEntity(_0x3bdba4,_0x2d206b){return function(_0x140979){if(_0x140979){return _0x140979['destroy']()[_0x33de('0x28')](function(){var _0x5585a2=_0x140979['get']({'plain':!![]});var _0x1c8de9=_0x33de('0x29');return db[_0x33de('0x2a')][_0x33de('0x2b')]({'where':{'type':_0x1c8de9,'resourceId':_0x5585a2['id']}})[_0x33de('0x28')](function(){return _0x140979;});})[_0x33de('0x28')](function(){_0x3bdba4[_0x33de('0x1e')](0xcc)[_0x33de('0x2c')]();});}};}function handleEntityNotFound(_0x59bc3b,_0x5ae0e8){return function(_0x2755e6){if(!_0x2755e6){_0x59bc3b[_0x33de('0x1d')](0x194);}return _0x2755e6;};}function handleError(_0xaeaec5,_0x451ff5){_0x451ff5=_0x451ff5||0x1f4;return function(_0x167cec){logger[_0x33de('0x2d')](_0x167cec[_0x33de('0x2e')]);if(_0x167cec['name']){delete _0x167cec[_0x33de('0x2f')];}_0xaeaec5[_0x33de('0x1e')](_0x451ff5)[_0x33de('0x30')](_0x167cec);};}exports[_0x33de('0x31')]=function(_0x49e857,_0xe5dc68){var _0xf5d78a={},_0x5a9c43={},_0x5d2da4={'count':0x0,'rows':[]};var _0x57fcf3=_[_0x33de('0x32')](db[_0x33de('0x33')]['rawAttributes'],function(_0x1d0194){return{'name':_0x1d0194['fieldName'],'type':_0x1d0194['type'][_0x33de('0x34')]};});_0x5a9c43[_0x33de('0x35')]=_[_0x33de('0x32')](_0x57fcf3,_0x33de('0x2f'));_0x5a9c43[_0x33de('0x36')]=_[_0x33de('0x37')](_0x49e857[_0x33de('0x36')]);_0x5a9c43[_0x33de('0x38')]=_['intersection'](_0x5a9c43[_0x33de('0x35')],_0x5a9c43['query']);_0xf5d78a[_0x33de('0x39')]=_['intersection'](_0x5a9c43['model'],qs[_0x33de('0x3a')](_0x49e857[_0x33de('0x36')][_0x33de('0x3a')]));_0xf5d78a[_0x33de('0x39')]=_0xf5d78a[_0x33de('0x39')][_0x33de('0x3b')]?_0xf5d78a['attributes']:_0x5a9c43[_0x33de('0x35')];if(!_0x49e857[_0x33de('0x36')][_0x33de('0x3c')](_0x33de('0x3d'))){_0xf5d78a[_0x33de('0x22')]=qs[_0x33de('0x22')](_0x49e857[_0x33de('0x36')]['limit']);_0xf5d78a[_0x33de('0x1f')]=qs[_0x33de('0x1f')](_0x49e857[_0x33de('0x36')][_0x33de('0x1f')]);}_0xf5d78a[_0x33de('0x3e')]=qs[_0x33de('0x3f')](_0x49e857[_0x33de('0x36')]['sort']);_0xf5d78a[_0x33de('0x40')]=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x49e857[_0x33de('0x36')],_0x5a9c43[_0x33de('0x38')]),_0x57fcf3);if(_0x49e857[_0x33de('0x36')]['filter']){_0xf5d78a[_0x33de('0x40')]=_['merge'](_0xf5d78a[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x57fcf3,function(_0x4da2a5){if(_0x4da2a5[_0x33de('0x42')]!==_0x33de('0x43')){var _0x15918c={};_0x15918c[_0x4da2a5[_0x33de('0x2f')]]={'$like':'%'+_0x49e857[_0x33de('0x36')][_0x33de('0x44')]+'%'};return _0x15918c;}})});}_0xf5d78a=_[_0x33de('0x45')]({},_0xf5d78a,_0x49e857[_0x33de('0x46')]);var _0x48e0fc={'where':_0xf5d78a['where']};return db['VoicePrefix'][_0x33de('0x21')](_0x48e0fc)[_0x33de('0x28')](function(_0x20d04f){_0x5d2da4[_0x33de('0x21')]=_0x20d04f;if(_0x49e857['query'][_0x33de('0x47')]){_0xf5d78a['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x33de('0x48')](_0xf5d78a);})[_0x33de('0x28')](function(_0x384b12){_0x5d2da4[_0x33de('0x49')]=_0x384b12;return _0x5d2da4;})[_0x33de('0x28')](respondWithFilteredResult(_0xe5dc68,_0xf5d78a))[_0x33de('0x4a')](handleError(_0xe5dc68,null));};exports[_0x33de('0x4b')]=function(_0x49b067,_0x3b5530){var _0x5de38b={'raw':![],'where':{'id':_0x49b067['params']['id']}},_0x2fbca6={};_0x2fbca6[_0x33de('0x35')]=_[_0x33de('0x37')](db['VoicePrefix'][_0x33de('0x4c')]);_0x2fbca6[_0x33de('0x36')]=_[_0x33de('0x37')](_0x49b067['query']);_0x2fbca6['filters']=_[_0x33de('0x4d')](_0x2fbca6[_0x33de('0x35')],_0x2fbca6['query']);_0x5de38b['attributes']=_[_0x33de('0x4d')](_0x2fbca6['model'],qs['fields'](_0x49b067['query'][_0x33de('0x3a')]));_0x5de38b[_0x33de('0x39')]=_0x5de38b[_0x33de('0x39')][_0x33de('0x3b')]?_0x5de38b['attributes']:_0x2fbca6['model'];if(_0x49b067[_0x33de('0x36')][_0x33de('0x47')]){_0x5de38b['include']=[{'all':!![]}];}_0x5de38b=_[_0x33de('0x45')]({},_0x5de38b,_0x49b067[_0x33de('0x46')]);return db[_0x33de('0x33')][_0x33de('0x4e')](_0x5de38b)[_0x33de('0x28')](handleEntityNotFound(_0x3b5530,null))['then'](respondWithResult(_0x3b5530,null))[_0x33de('0x4a')](handleError(_0x3b5530,null));};exports[_0x33de('0x2b')]=function(_0x4fe3a2,_0x302573){return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x4fe3a2[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x302573,null))[_0x33de('0x28')](removeEntity(_0x302573,null))[_0x33de('0x4a')](handleError(_0x302573,null));};exports[_0x33de('0x50')]=function(_0x24e428,_0x1b4397){return db['VoicePrefix'][_0x33de('0x50')]()[_0x33de('0x28')](respondWithResult(_0x1b4397,null))[_0x33de('0x4a')](handleError(_0x1b4397,null));};exports[_0x33de('0x51')]=function(_0xe6d59,_0x3fe65d){var _0x5c91e7;return db['sequelize'][_0x33de('0x52')](function(_0x32042e){return db[_0x33de('0x33')]['create'](_0xe6d59[_0x33de('0x53')],{'transaction':_0x32042e})[_0x33de('0x28')](function(_0x379224){_0x5c91e7=_0x379224[_0x33de('0x54')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x5c91e7[_0x33de('0x55')]},'raw':!![]})[_0x33de('0x28')](function(_0x232da5){return createVoicePrefixExtensions(_0x5c91e7,_0x232da5,_0x32042e);});});})[_0x33de('0x28')](function(){var _0x379784=_0xe6d59['user']['get']({'plain':!![]});if(!_0x379784)throw new Error(_0x33de('0x56'));if(_0x379784[_0x33de('0x57')]===_0x33de('0x58')){var _0x7112db=_0x5c91e7;return db[_0x33de('0x59')][_0x33de('0x4e')]({'where':{'name':_0x33de('0x29'),'userProfileId':_0x379784[_0x33de('0x5a')]},'raw':!![]})[_0x33de('0x28')](function(_0x5de12f){if(_0x5de12f&&_0x5de12f[_0x33de('0x5b')]===0x0){return db[_0x33de('0x2a')][_0x33de('0x51')]({'name':_0x7112db['name'],'resourceId':_0x7112db['id'],'type':_0x5de12f[_0x33de('0x2f')],'sectionId':_0x5de12f['id']},{})['then'](function(){return _0x5c91e7;});}else{return _0x5c91e7;}})['catch'](function(_0x4dae6d){logger['error'](_0x33de('0x5c'),_0x4dae6d);throw _0x4dae6d;});}return _0x5c91e7;})[_0x33de('0x28')](respondWithResult(_0x3fe65d,null))['catch'](handleError(_0x3fe65d,null));};function Extension(_0x397179,_0x232840,_0x56542f,_0x42c8b9){this[_0x33de('0x5d')]='from-sip';this[_0x33de('0x5e')]=_0x397179;this[_0x33de('0x5f')]=_0x56542f;this[_0x33de('0x42')]=_0x33de('0x60');this[_0x33de('0x61')]=_0x33de('0x62');this[_0x33de('0x63')]=_0x232840;this['appdata']=_0x42c8b9;}function createVoicePrefixExtensions(_0x533863,_0x409e2e,_0x49516d){return new BPromise(function(_0x2af340,_0x3eef03){var _0x4ca20f=new Extension(formatPrefixName(_0x533863[_0x33de('0x64')]),0x1,'NoOp',_0x33de('0x65'));_0x4ca20f[_0x33de('0x66')]=_0x533863['id'];return db['VoiceExtension']['create'](_0x4ca20f,{'transaction':_0x49516d})[_0x33de('0x28')](function(_0x1b2d6f){var _0x17845c=_0x1b2d6f[_0x33de('0x54')]({'plain':!![]});var _0x24d936=_['map'](addVoicePrefixExtensions(_0x533863,_0x409e2e),function(_0x221038){_0x221038[_0x33de('0x55')]=_0x17845c['id'];_0x221038['VoicePrefixId']=_0x533863['id'];return _0x221038;});return db[_0x33de('0x67')][_0x33de('0x68')](_0x24d936,{'transaction':_0x49516d})['then'](function(_0x151551){if(!_0x151551){return _0x3eef03(_0x33de('0x69'));}else{return _0x2af340(_0x151551);}})['catch'](function(_0x4aa203){return _0x3eef03(_0x4aa203);});});;});};function addVoicePrefixExtensions(_0xc2504a,_0x55d7ef){var _0x31a511=[];var _0x4803b8=formatPrefixName(_0xc2504a[_0x33de('0x64')]);_0x31a511['push'](new Extension(_0x4803b8,0x2,'Set','CDR(prefix)='+_0xc2504a['name']));if(_0xc2504a['callerIdAll']){_0x31a511['push'](new Extension(_0x4803b8,0x3,_0x33de('0x6a'),'PREFIX-CALLERIDALL='+_0xc2504a[_0x33de('0x6b')]));}else{_0x31a511['push'](new Extension(_0x4803b8,0x3,'NoOp',_0x33de('0x6c')));}_0x31a511[_0x33de('0x6d')](new Extension(_0x4803b8,0x4,_0x33de('0x6e'),_0x55d7ef[_0x33de('0x5d')]+','+_0x33de('0x6f')+(0x8+_0xc2504a[_0x33de('0x2f')][_0x33de('0x3b')])+'}'+','+0x1));return _0x31a511;}function formatPrefixName(_0x659652){var _0x4893d2='_';for(var _0x297a84=0x0;_0x297a84<_0x659652['length'];_0x297a84++){if(_0x659652[_0x33de('0x70')](_0x297a84)=='-'){_0x4893d2+=_0x659652[_0x33de('0x70')](_0x297a84);}else{_0x4893d2+='['+_0x659652[_0x33de('0x70')](_0x297a84)+']';}}_0x4893d2+='.';return _0x4893d2;}exports[_0x33de('0x27')]=function(_0x8a9729,_0x3f5d52,_0x2a6004){var _0x355b7d=_0x8a9729[_0x33de('0x53')];_0x355b7d[_0x33de('0x64')]=_0x33de('0x71')+_0x355b7d['name']+'-';return db['sequelize'][_0x33de('0x52')](function(_0x1179f6){return db[_0x33de('0x33')][_0x33de('0x27')](_0x355b7d,{'where':{'id':_0x355b7d['id']},'transaction':_0x1179f6})[_0x33de('0x28')](function(){return db[_0x33de('0x67')][_0x33de('0x2b')]({'where':{'VoicePrefixId':_0x355b7d['id']},'transaction':_0x1179f6})[_0x33de('0x28')](function(){return db[_0x33de('0x67')][_0x33de('0x4e')]({'where':{'id':_0x355b7d['VoiceExtensionId']},'raw':!![]})[_0x33de('0x28')](function(_0x43eb19){return createVoicePrefixExtensions(_0x355b7d,_0x43eb19,_0x1179f6);});});});})[_0x33de('0x28')](function(){return db[_0x33de('0x33')][_0x33de('0x72')](_0x355b7d['id']);})[_0x33de('0x28')](respondWithResult(_0x3f5d52,null))['catch'](handleError(_0x3f5d52,null));};exports['addAgents']=function(_0x558c26,_0x1370ac,_0x2d2b02){return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x558c26['params']['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x1370ac,null))[_0x33de('0x28')](function(_0x484827){if(_0x484827){return _0x484827['addAgents'](_0x558c26['body'][_0x33de('0x73')],_[_0x33de('0x74')](_0x558c26[_0x33de('0x53')],[_0x33de('0x73'),'id'])||{})[_0x33de('0x75')](function(_0x545555){for(var _0x2e6389=0x0;_0x2e6389<_0x558c26['body'][_0x33de('0x73')][_0x33de('0x3b')];_0x2e6389+=0x1){socket['emit'](_0x33de('0x76'),{'UserId':Number(_0x558c26[_0x33de('0x53')]['ids'][_0x2e6389]),'VoicePrefixId':Number(_0x558c26[_0x33de('0x4f')]['id'])});}return _0x545555;});}})['then'](respondWithResult(_0x1370ac,null))['catch'](handleError(_0x1370ac,null));};exports[_0x33de('0x77')]=function(_0x2ef94d,_0x3fbbaf,_0x46e3d6){return db[_0x33de('0x33')]['find']({'where':{'id':_0x2ef94d[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x3fbbaf,null))[_0x33de('0x28')](function(_0x1e0637){if(_0x1e0637){return _0x1e0637['removeAgents'](_0x2ef94d[_0x33de('0x36')][_0x33de('0x73')])[_0x33de('0x28')](function(){if(_['isArray'](_0x2ef94d['query']['ids'])){for(var _0x586c51=0x0;_0x586c51<_0x2ef94d['query'][_0x33de('0x73')][_0x33de('0x3b')];_0x586c51+=0x1){socket['emit'](_0x33de('0x78'),{'UserId':Number(_0x2ef94d['query']['ids'][_0x586c51]),'VoicePrefixId':Number(_0x2ef94d[_0x33de('0x4f')]['id'])});}}else{socket[_0x33de('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x2ef94d[_0x33de('0x36')][_0x33de('0x73')]),'VoicePrefixId':Number(_0x2ef94d['params']['id'])});}});}})[_0x33de('0x28')](respondWithStatusCode(_0x3fbbaf,null))['catch'](handleError(_0x3fbbaf,null));};exports[_0x33de('0x7a')]=function(_0x1d060d,_0x487dac,_0x30d749){var _0x2cd94f={};var _0x53ec24={};var _0x4fa42c;var _0x130bbd;return db[_0x33de('0x33')][_0x33de('0x7b')]({'where':{'id':_0x1d060d[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x487dac,null))[_0x33de('0x28')](function(_0x4ef18b){if(_0x4ef18b){_0x4fa42c=_0x4ef18b;_0x53ec24[_0x33de('0x35')]=_[_0x33de('0x37')](db[_0x33de('0x7c')][_0x33de('0x4c')]);_0x53ec24[_0x33de('0x36')]=_[_0x33de('0x37')](_0x1d060d[_0x33de('0x36')]);_0x53ec24[_0x33de('0x38')]=_[_0x33de('0x4d')](_0x53ec24[_0x33de('0x35')],_0x53ec24[_0x33de('0x36')]);_0x2cd94f[_0x33de('0x39')]=_[_0x33de('0x4d')](_0x53ec24[_0x33de('0x35')],qs[_0x33de('0x3a')](_0x1d060d[_0x33de('0x36')]['fields']));_0x2cd94f[_0x33de('0x39')]=_0x2cd94f[_0x33de('0x39')][_0x33de('0x3b')]?_0x2cd94f[_0x33de('0x39')]:_0x53ec24[_0x33de('0x35')];_0x2cd94f['order']=qs[_0x33de('0x3f')](_0x1d060d[_0x33de('0x36')][_0x33de('0x3f')]);_0x2cd94f[_0x33de('0x40')]=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x1d060d[_0x33de('0x36')],_0x53ec24[_0x33de('0x38')]));if(_0x1d060d[_0x33de('0x36')][_0x33de('0x44')]){_0x2cd94f['where']=_['merge'](_0x2cd94f[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x2cd94f[_0x33de('0x39')],function(_0xa0b337){var _0x5b8928={};_0x5b8928[_0xa0b337]={'$like':'%'+_0x1d060d[_0x33de('0x36')][_0x33de('0x44')]+'%'};return _0x5b8928;})});}_0x2cd94f=_[_0x33de('0x45')]({},_0x2cd94f,_0x1d060d['options']);return _0x4fa42c['getAgents'](_0x2cd94f);}})[_0x33de('0x28')](function(_0xe6b940){if(_0xe6b940){_0x130bbd=_0xe6b940[_0x33de('0x3b')];if(!_0x1d060d['query'][_0x33de('0x3c')](_0x33de('0x3d'))){_0x2cd94f[_0x33de('0x22')]=qs['limit'](_0x1d060d[_0x33de('0x36')][_0x33de('0x22')]);_0x2cd94f['offset']=qs[_0x33de('0x1f')](_0x1d060d['query'][_0x33de('0x1f')]);}return _0x4fa42c[_0x33de('0x7a')](_0x2cd94f);}})['then'](function(_0x42546c){if(_0x42546c){return _0x42546c?{'count':_0x130bbd,'rows':_0x42546c}:null;}})[_0x33de('0x28')](respondWithResult(_0x487dac,null))[_0x33de('0x4a')](handleError(_0x487dac,null));};exports['getTeams']=function(_0x52b4e2,_0x48a039,_0xfb0042){var _0x5f46d7={};var _0x5817e3={};var _0x3df0d3;var _0xebf05f;return db[_0x33de('0x33')][_0x33de('0x7b')]({'where':{'id':_0x52b4e2['params']['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x48a039,null))[_0x33de('0x28')](function(_0x27072a){if(_0x27072a){_0x3df0d3=_0x27072a;_0x5817e3['model']=_[_0x33de('0x37')](db[_0x33de('0x7d')][_0x33de('0x4c')]);_0x5817e3[_0x33de('0x36')]=_[_0x33de('0x37')](_0x52b4e2[_0x33de('0x36')]);_0x5817e3[_0x33de('0x38')]=_[_0x33de('0x4d')](_0x5817e3[_0x33de('0x35')],_0x5817e3[_0x33de('0x36')]);_0x5f46d7[_0x33de('0x39')]=_[_0x33de('0x4d')](_0x5817e3[_0x33de('0x35')],qs[_0x33de('0x3a')](_0x52b4e2[_0x33de('0x36')][_0x33de('0x3a')]));_0x5f46d7[_0x33de('0x39')]=_0x5f46d7[_0x33de('0x39')][_0x33de('0x3b')]?_0x5f46d7['attributes']:_0x5817e3[_0x33de('0x35')];_0x5f46d7[_0x33de('0x3e')]=qs[_0x33de('0x3f')](_0x52b4e2[_0x33de('0x36')][_0x33de('0x3f')]);_0x5f46d7['where']=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x52b4e2[_0x33de('0x36')],_0x5817e3[_0x33de('0x38')]));if(_0x52b4e2[_0x33de('0x36')][_0x33de('0x44')]){_0x5f46d7[_0x33de('0x40')]=_[_0x33de('0x45')](_0x5f46d7[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x5f46d7['attributes'],function(_0x3af223){var _0x258238={};_0x258238[_0x3af223]={'$like':'%'+_0x52b4e2['query'][_0x33de('0x44')]+'%'};return _0x258238;})});}_0x5f46d7=_[_0x33de('0x45')]({},_0x5f46d7,_0x52b4e2['options']);return _0x3df0d3['getTeams'](_0x5f46d7);}})['then'](function(_0x1f1bd4){if(_0x1f1bd4){_0xebf05f=_0x1f1bd4['length'];if(!_0x52b4e2[_0x33de('0x36')][_0x33de('0x3c')]('nolimit')){_0x5f46d7[_0x33de('0x22')]=qs['limit'](_0x52b4e2[_0x33de('0x36')][_0x33de('0x22')]);_0x5f46d7[_0x33de('0x1f')]=qs[_0x33de('0x1f')](_0x52b4e2[_0x33de('0x36')]['offset']);}return _0x3df0d3[_0x33de('0x7e')](_0x5f46d7);}})[_0x33de('0x28')](function(_0x24dcfe){if(_0x24dcfe){return _0x24dcfe?{'count':_0xebf05f,'rows':_0x24dcfe}:null;}})['then'](respondWithResult(_0x48a039,null))[_0x33de('0x4a')](handleError(_0x48a039,null));};exports[_0x33de('0x7f')]=function(_0x24af54,_0x2baee6,_0x56fadb){var _0x5ce00e=_0x24af54[_0x33de('0x53')][_0x33de('0x73')];var _0x2127ab;return db[_0x33de('0x7d')][_0x33de('0x48')]({'where':{'id':_0x5ce00e},'attributes':['id'],'include':[{'model':db[_0x33de('0x7c')],'as':_0x33de('0x80'),'attributes':['id',_0x33de('0x2f'),_0x33de('0x81'),_0x33de('0x82'),_0x33de('0x83')],'raw':!![]}]})[_0x33de('0x28')](function(_0x371e4d){if(_0x371e4d){_0x2127ab=_0x371e4d;var _0x17d367=_[_0x33de('0x84')](_0x371e4d,function(_0x21a70f){var _0x5e11f1=_0x21a70f[_0x33de('0x54')]({'plain':!![]});return _0x5e11f1[_0x33de('0x80')];});return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x24af54[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](function(_0x5120f5){return db[_0x33de('0x85')][_0x33de('0x52')](function(_0x51b000){return _0x5120f5[_0x33de('0x7f')](_0x5ce00e,{'transaction':_0x51b000})[_0x33de('0x28')](function(){return BPromise[_0x33de('0x86')](_0x2127ab,function(_0x131d87){return db[_0x33de('0x87')][_0x33de('0x88')]({'TeamId':_0x131d87['id'],'VoicePrefixId':_0x24af54[_0x33de('0x4f')]['id']},{'transaction':_0x51b000});});})['then'](function(){return BPromise['each'](_0x17d367,function(_0x446257){return db[_0x33de('0x89')]['findOrCreate']({'where':{'UserId':_0x446257['id'],'VoicePrefixId':_0x24af54[_0x33de('0x4f')]['id']},'transaction':_0x51b000});});})[_0x33de('0x28')](function(){_0x17d367[_0x33de('0x8a')](function(_0xf06806){socket[_0x33de('0x79')]('userVoicePrefix:save',{'UserId':_0xf06806['id'],'VoicePrefixId':_0x5120f5['id']});});});});});}})[_0x33de('0x28')](respondWithStatusCode(_0x2baee6,null))[_0x33de('0x4a')](handleError(_0x2baee6,null));};exports[_0x33de('0x8b')]=function(_0x1f5872,_0x38d880,_0x40758b){return db[_0x33de('0x7d')][_0x33de('0x48')]({'where':{'id':_0x1f5872[_0x33de('0x36')][_0x33de('0x73')]},'attributes':['id'],'include':[{'model':db[_0x33de('0x7c')],'as':_0x33de('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x38d880,null))[_0x33de('0x28')](function(_0xd41b76){var _0x24fa73=_['map'](_0xd41b76,'id');var _0x93313d=[];var _0x3c854d=[];var _0x3e00b7=squel['select']();_0x3e00b7['field'](_0x33de('0x8c'))['from'](_0x33de('0x8d'),'tq')[_0x33de('0x8e')](_0x33de('0x8f'),'ut',_0x33de('0x90'))[_0x33de('0x40')](_0x33de('0x91'),_0x1f5872[_0x33de('0x4f')]['id']);for(var _0x23b8e9=0x0;_0x23b8e9<_0xd41b76[_0x33de('0x3b')];_0x23b8e9+=0x1){let _0x64836b=_0xd41b76[_0x23b8e9];for(var _0x72b745=0x0;_0x72b745<_0x64836b[_0x33de('0x80')]['length'];_0x72b745+=0x1){let _0x4eacef=_0x64836b[_0x33de('0x80')][_0x72b745];var _0x13cd17=_0x3e00b7[_0x33de('0x92')]();_0x13cd17[_0x33de('0x40')]('ut.UserId\x20=\x20?',_0x4eacef['id']);_0x3c854d[_0x33de('0x6d')](db['sequelize']['query'](_0x13cd17[_0x33de('0x93')](),{'type':db[_0x33de('0x85')][_0x33de('0x94')][_0x33de('0x95')]})[_0x33de('0x28')](function(_0x251b71){if(_0x251b71['length']===0x1){return _0x4eacef['id'];}else{var _0x341b23=_[_0x33de('0x96')](_[_0x33de('0x32')](_0x251b71,_0x33de('0x97')),function(_0x29eda7){return _[_0x33de('0x98')](_0x24fa73,_0x29eda7);});if(_0x341b23){return _0x4eacef['id'];}}}));}}return BPromise[_0x33de('0x99')](_0x3c854d)['then'](function(_0x572532){_0x93313d=_(_0x93313d)[_0x33de('0x9a')](_0x572532)[_0x33de('0x9b')]()[_0x33de('0x9c')]();return db[_0x33de('0x33')]['find']({'where':{'id':_0x1f5872[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](function(_0x24edf8){return db['sequelize'][_0x33de('0x52')](function(_0x1ad90f){return _0x24edf8['removeTeams'](_0x1f5872['query'][_0x33de('0x73')],{'transaction':_0x1ad90f})[_0x33de('0x28')](function(){if(!_[_0x33de('0x9d')](_0x93313d)){return _0x24edf8['removeAgents'](_0x93313d,{'transaction':_0x1ad90f});}})[_0x33de('0x28')](function(){_0x93313d[_0x33de('0x8a')](function(_0x4d56df){socket[_0x33de('0x79')](_0x33de('0x78'),{'UserId':_0x4d56df,'VoicePrefixId':_0x24edf8['id']});});});});});});})['then'](respondWithStatusCode(_0x38d880,null))['catch'](handleError(_0x38d880,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0d47267..e00b021 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 _0x0153=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1f9c1a,_0x20c211){var _0x15cef0=function(_0x4e936f){while(--_0x4e936f){_0x1f9c1a['push'](_0x1f9c1a['shift']());}};_0x15cef0(++_0x20c211);}(_0x0153,0x117));var _0x3015=function(_0x3edc24,_0x35775a){_0x3edc24=_0x3edc24-0x0;var _0x253a3b=_0x0153[_0x3edc24];return _0x253a3b;};'use strict';var EventEmitter=require(_0x3015('0x0'));var VoicePrefix=require(_0x3015('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3015('0x2')](0x0);var events={'afterCreate':_0x3015('0x3'),'afterUpdate':_0x3015('0x4'),'afterDestroy':'remove'};function emitEvent(_0x503e85){return function(_0x593f1a,_0x5741dd,_0x1d07b3){VoicePrefixEvents[_0x3015('0x5')](_0x503e85+':'+_0x593f1a['id'],_0x593f1a);VoicePrefixEvents[_0x3015('0x5')](_0x503e85,_0x593f1a);_0x1d07b3(null);};}for(var e in events){if(events[_0x3015('0x6')](e)){var event=events[e];VoicePrefix[_0x3015('0x7')](e,emitEvent(event));}}module[_0x3015('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x636d=['save','remove','emit','hasOwnProperty','exports','events','VoicePrefix','setMaxListeners'];(function(_0x2c7ff5,_0x504abe){var _0x42fef4=function(_0x117eec){while(--_0x117eec){_0x2c7ff5['push'](_0x2c7ff5['shift']());}};_0x42fef4(++_0x504abe);}(_0x636d,0xad));var _0xd636=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x636d[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0xd636('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xd636('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd636('0x2')](0x0);var events={'afterCreate':_0xd636('0x3'),'afterUpdate':'update','afterDestroy':_0xd636('0x4')};function emitEvent(_0x2d556d){return function(_0x5bb5e1,_0x44fc14,_0x3bac57){VoicePrefixEvents[_0xd636('0x5')](_0x2d556d+':'+_0x5bb5e1['id'],_0x5bb5e1);VoicePrefixEvents[_0xd636('0x5')](_0x2d556d,_0x5bb5e1);_0x3bac57(null);};}for(var e in events){if(events[_0xd636('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xd636('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index fbf80b0..683f387 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 _0x8efc=['request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5975ce,_0x1174ab){var _0x5b1f80=function(_0x27019e){while(--_0x27019e){_0x5975ce['push'](_0x5975ce['shift']());}};_0x5b1f80(++_0x1174ab);}(_0x8efc,0xf7));var _0xc8ef=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x8efc[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0xc8ef('0x0'));var util=require('util');var logger=require(_0xc8ef('0x1'))(_0xc8ef('0x2'));var moment=require(_0xc8ef('0x3'));var BPromise=require(_0xc8ef('0x4'));var rp=require(_0xc8ef('0x5'));var fs=require('fs');var path=require(_0xc8ef('0x6'));var rimraf=require(_0xc8ef('0x7'));var config=require(_0xc8ef('0x8'));var attributes=require(_0xc8ef('0x9'));module[_0xc8ef('0xa')]=function(_0x44816d,_0x360fd1){return _0x44816d[_0xc8ef('0xb')](_0xc8ef('0xc'),attributes,{'tableName':_0xc8ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1082=['lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x2a5f02,_0x19f336){var _0x584a2c=function(_0x53eb62){while(--_0x53eb62){_0x2a5f02['push'](_0x2a5f02['shift']());}};_0x584a2c(++_0x19f336);}(_0x1082,0x1ef));var _0x2108=function(_0x35f4f9,_0x4521fc){_0x35f4f9=_0x35f4f9-0x0;var _0x3d398a=_0x1082[_0x35f4f9];return _0x3d398a;};'use strict';var _=require(_0x2108('0x0'));var util=require('util');var logger=require(_0x2108('0x1'))(_0x2108('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2108('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2108('0x4'));var config=require(_0x2108('0x5'));var attributes=require(_0x2108('0x6'));module[_0x2108('0x7')]=function(_0x45683a,_0x14ce5d){return _0x45683a[_0x2108('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index b0a90ea..dbf907c 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 _0x85de=['../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x85de,0x65));var _0xe85d=function(_0x1796e3,_0x33fd53){_0x1796e3=_0x1796e3-0x0;var _0x48fc92=_0x85de[_0x1796e3];return _0x48fc92;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require(_0xe85d('0x3'));var rs=require(_0xe85d('0x4'));var fs=require('fs');var Redis=require(_0xe85d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe85d('0x6'));var logger=require(_0xe85d('0x7'))(_0xe85d('0x8'));var config=require(_0xe85d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe85d('0xa')]({'port':0x232a});config[_0xe85d('0xb')]=_[_0xe85d('0xc')](config[_0xe85d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe85d('0xd'))(new Redis(config[_0xe85d('0xb')]));require(_0xe85d('0xe'))[_0xe85d('0xf')](socket);function respondWithRpcPromise(_0x46cedc,_0x3c08f7,_0x59bbfb){return new BPromise(function(_0x327be8,_0x16b693){return client[_0xe85d('0x10')](_0x46cedc,_0x59bbfb)[_0xe85d('0x11')](function(_0x3884a2){logger[_0xe85d('0x12')](_0xe85d('0x13'),_0x3c08f7,_0xe85d('0x14'));logger[_0xe85d('0x15')](_0xe85d('0x16'),_0x3c08f7,'request\x20sent',JSON['stringify'](_0x3884a2));if(_0x3884a2[_0xe85d('0x17')]){if(_0x3884a2[_0xe85d('0x17')][_0xe85d('0x18')]===0x1f4){logger[_0xe85d('0x17')](_0xe85d('0x13'),_0x3c08f7,_0x3884a2[_0xe85d('0x17')][_0xe85d('0x19')]);return _0x16b693(_0x3884a2['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3c08f7,_0x3884a2[_0xe85d('0x17')][_0xe85d('0x19')]);return _0x327be8(_0x3884a2['error'][_0xe85d('0x19')]);}else{logger[_0xe85d('0x12')](_0xe85d('0x13'),_0x3c08f7,'request\x20sent');_0x327be8(_0x3884a2[_0xe85d('0x1a')][_0xe85d('0x19')]);}})['catch'](function(_0x234ed0){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3c08f7,_0x234ed0);_0x16b693(_0x234ed0);});});} \ No newline at end of file +var _0x2b29=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x164925,_0x28d616){var _0x350ebe=function(_0x127f11){while(--_0x127f11){_0x164925['push'](_0x164925['shift']());}};_0x350ebe(++_0x28d616);}(_0x2b29,0x163));var _0x92b2=function(_0x3f9f4c,_0x3d1507){_0x3f9f4c=_0x3f9f4c-0x0;var _0x5a7fa4=_0x2b29[_0x3f9f4c];return _0x5a7fa4;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});config['redis']=_[_0x92b2('0xb')](config[_0x92b2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x92b2('0xd'))(new Redis(config[_0x92b2('0xc')]));require(_0x92b2('0xe'))[_0x92b2('0xf')](socket);function respondWithRpcPromise(_0x592c9e,_0x2b17de,_0x21bbf5){return new BPromise(function(_0x187eab,_0x1ef7f3){return client[_0x92b2('0x10')](_0x592c9e,_0x21bbf5)[_0x92b2('0x11')](function(_0xa18d4e){logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));logger[_0x92b2('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2b17de,_0x92b2('0x13'),JSON[_0x92b2('0x15')](_0xa18d4e));if(_0xa18d4e[_0x92b2('0x16')]){if(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x17')]===0x1f4){logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e[_0x92b2('0x16')]['message']);return _0x1ef7f3(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x18')]);}logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e['error'][_0x92b2('0x18')]);return _0x187eab(_0xa18d4e['error'][_0x92b2('0x18')]);}else{logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));_0x187eab(_0xa18d4e[_0x92b2('0x19')][_0x92b2('0x18')]);}})[_0x92b2('0x1a')](function(_0x3dfd47){logger[_0x92b2('0x16')](_0x92b2('0x12'),_0x2b17de,_0x3dfd47);_0x1ef7f3(_0x3dfd47);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4db14de..8e5868c 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 _0xeea4=['./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xeea4,0x19e));var _0x4eea=function(_0x7d0bed,_0x166181){_0x7d0bed=_0x7d0bed-0x0;var _0x1527ab=_0xeea4[_0x7d0bed];return _0x1527ab;};'use strict';var VoicePrefixEvents=require(_0x4eea('0x0'));var events=[_0x4eea('0x1'),_0x4eea('0x2'),_0x4eea('0x3')];function createListener(_0x28e57e,_0x38a9e8){return function(_0x2a47d5){_0x38a9e8[_0x4eea('0x4')](_0x28e57e,_0x2a47d5);};}function removeListener(_0x27997a,_0x5c02db){return function(){VoicePrefixEvents[_0x4eea('0x5')](_0x27997a,_0x5c02db);};}exports['register']=function(_0x2df4ae){for(var _0x383566=0x0,_0x3d5aa8=events['length'];_0x383566<_0x3d5aa8;_0x383566++){var _0x1a2e5e=events[_0x383566];var _0x44116a=createListener('voicePrefix:'+_0x1a2e5e,_0x2df4ae);VoicePrefixEvents['on'](_0x1a2e5e,_0x44116a);}}; \ No newline at end of file +var _0x9234=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update'];(function(_0x449792,_0x5c6ada){var _0x19cff7=function(_0x3e2493){while(--_0x3e2493){_0x449792['push'](_0x449792['shift']());}};_0x19cff7(++_0x5c6ada);}(_0x9234,0x1bd));var _0x4923=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x9234[_0x50e0b4];return _0x2fa8b0;};'use strict';var VoicePrefixEvents=require(_0x4923('0x0'));var events=['save',_0x4923('0x1'),_0x4923('0x2')];function createListener(_0x1f0d3a,_0x34915b){return function(_0x481178){_0x34915b[_0x4923('0x3')](_0x1f0d3a,_0x481178);};}function removeListener(_0x436ce1,_0x4bf615){return function(){VoicePrefixEvents[_0x4923('0x4')](_0x436ce1,_0x4bf615);};}exports[_0x4923('0x5')]=function(_0x526ad7){for(var _0x3c5e3f=0x0,_0x17b854=events[_0x4923('0x6')];_0x3c5e3f<_0x17b854;_0x3c5e3f++){var _0x2de396=events[_0x3c5e3f];var _0x548676=createListener(_0x4923('0x7')+_0x2de396,_0x526ad7);VoicePrefixEvents['on'](_0x2de396,_0x548676);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0d5e440..b48b6aa 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(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b635a,_0x8d01b2){_0x4b635a=_0x4b635a-0x0;var _0x3de488=_0xb10b[_0x4b635a];return _0x3de488;};'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(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xb10b,0x12a));var _0xbb10=function(_0x28e7e1,_0x45f235){_0x28e7e1=_0x28e7e1-0x0;var _0x1d8a9e=_0xb10b[_0x28e7e1];return _0x1d8a9e;};'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 bf71780..5a5b77b 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 _0x659b=['sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','random','rrmemory','linear','type','dialMethod','strategy','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','once','TEXT','join','getDataValue','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0xed49aa,_0x4b69ff){var _0x55c1c6=function(_0x4dbe65){while(--_0x4dbe65){_0xed49aa['push'](_0xed49aa['shift']());}};_0x55c1c6(++_0x4b69ff);}(_0x659b,0x1e0));var _0xb659=function(_0x428df4,_0x44e5a5){_0x428df4=_0x428df4-0x0;var _0x58b721=_0x659b[_0x428df4];return _0x58b721;};'use strict';var Sequelize=require(_0xb659('0x0'));module[_0xb659('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb659('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x4'),_0xb659('0x5')),'allowNull':![],'defaultValue':_0xb659('0x4')},'musiconhold':{'type':Sequelize[_0xb659('0x6')],'defaultValue':_0xb659('0x7')},'announce':{'type':Sequelize[_0xb659('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0xb659('0x3')]('rr',_0xb659('0x8'),_0xb659('0x9'),'fewestcalls',_0xb659('0xa'),_0xb659('0xb'),_0xb659('0xc'),'wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x19e708){this['setDataValue']('strategy',_0x19e708?_0x19e708:_0xb659('0xb'));},'get':function(){var _0x1d5a04=this['getDataValue'](_0xb659('0xd'));var _0x388e15=this['getDataValue'](_0xb659('0xe'));var _0x1a1682=this['getDataValue'](_0xb659('0xf'));if(_0x1d5a04===_0xb659('0x5')){if(_0x388e15===_0xb659('0x10')){return null;}if(_0x388e15===_0xb659('0x11')&&![_0xb659('0xb'),_0xb659('0x12')][_0xb659('0x13')](_0x1a1682)){this[_0xb659('0x14')]('strategy','rrmemory');}}return _0x1a1682;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb659('0x6')]},'weight':{'type':Sequelize[_0xb659('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb659('0x3')]('yes','no'),'defaultValue':_0xb659('0x16')},'autopause':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xb659('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb659('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':_0xb659('0x16')},'announce_holdtime':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no',_0xb659('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb659('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xb659('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xb659('0x6')]},'queue_youarenext':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb659('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xb659('0x6')]},'queue_quantity1':{'type':Sequelize[_0xb659('0x6')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xb659('0x18')],'set':function(_0x1c9764){this[_0xb659('0x14')]('periodic_announce',_0x1c9764?_0x1c9764[_0xb659('0x19')](','):[]);},'get':function(){return this[_0xb659('0x1a')](_0xb659('0x1b'))?this['getDataValue'](_0xb659('0x1b'))[_0xb659('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xb659('0x6')],'defaultValue':_0xb659('0x16'),'set':function(_0x18d315){this[_0xb659('0x14')](_0xb659('0x1d'),_0x18d315?_0x18d315[_0xb659('0x19')](','):undefined);},'get':function(){return this[_0xb659('0x1a')](_0xb659('0x1d'))?this['getDataValue']('joinempty')[_0xb659('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb659('0x6')],'defaultValue':'no','set':function(_0x565cf1){this[_0xb659('0x14')](_0xb659('0x1e'),_0x565cf1?_0x565cf1[_0xb659('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xb659('0x1e'))?this[_0xb659('0x1a')](_0xb659('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xb659('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xb659('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb659('0x6')]},'description':{'type':Sequelize[_0xb659('0x6')]},'acw':{'type':Sequelize[_0xb659('0x1f')],'defaultValue':0x0,'set':function(_0x137076){this[_0xb659('0x14')]('acw',_0x137076);if(_0x137076){if(this[_0xb659('0x1a')](_0xb659('0x20'))<0x2){this[_0xb659('0x14')](_0xb659('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb659('0x21')},'dialMethod':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x10'),'progressive',_0xb659('0x22'),'predictive','booked'),'defaultValue':_0xb659('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xb659('0x15')](0x4)[_0xb659('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb659('0x25')},'dialLimitQueue':{'type':Sequelize[_0xb659('0x15')](0x4)[_0xb659('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb659('0x26')},'dialPowerLevel':{'type':Sequelize[_0xb659('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xb659('0x28'),_0xb659('0x29')),'defaultValue':_0xb659('0x29'),'comment':_0xb659('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xb659('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xb659('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xb659('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb659('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb659('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xb659('0x6')],'defaultValue':_0xb659('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x2f')},'dialQueueProject':{'type':Sequelize[_0xb659('0x6')],'comment':_0xb659('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x3,'comment':_0xb659('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb659('0x34')},'dialTimezone':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb659('0x6')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xb659('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb659('0x3')](_0xb659('0x35'),_0xb659('0x36'),_0xb659('0x37')),'defaultValue':_0xb659('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb659('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb659('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb659('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xb659('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb659('0x15')](0x9)[_0xb659('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb659('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb659('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb659('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xb659('0x15')](0x9)[_0xb659('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb659('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb659('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb659('0x15')](0x9)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb659('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xb659('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb659('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb659('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xb659('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xb659('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb659('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb659('0x41'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xb659('0x6')],'comment':_0xb659('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xb659('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb659('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xb659('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb659('0x42')},'dialCutDigit':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb659('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb659('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb659('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb659('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)[_0xb659('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb659('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb659('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb659('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb659('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xb659('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x553379){if(!_0x553379)this[_0xb659('0x14')](_0xb659('0x4f'),null);this[_0xb659('0x14')]('mandatoryDisposition',_0x553379);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xb659('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xb659('0x15')](0x3)[_0xb659('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb659('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xfc6a=['agentBusyFactor','dropRate','FLOAT','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','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','setDataValue','type','getDataValue','dialMethod','strategy','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','power','predictive','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x4a890a,_0x27a853){var _0x1860ba=function(_0x1babf6){while(--_0x1babf6){_0x4a890a['push'](_0x4a890a['shift']());}};_0x1860ba(++_0x27a853);}(_0xfc6a,0x1b0));var _0xafc6=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xfc6a[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xafc6('0x0'));module[_0xafc6('0x1')]={'name':{'type':Sequelize[_0xafc6('0x2')],'allowNull':![],'unique':_0xafc6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x5'),_0xafc6('0x6')),'allowNull':![],'defaultValue':_0xafc6('0x5')},'musiconhold':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':_0xafc6('0x7')},'announce':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xafc6('0x8'),_0xafc6('0x9'),_0xafc6('0xa'),'random',_0xafc6('0xb'),_0xafc6('0xc'),'wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x235850){this[_0xafc6('0xd')]('strategy',_0x235850?_0x235850:'rrmemory');},'get':function(){var _0x1b4ca2=this['getDataValue'](_0xafc6('0xe'));var _0x487ac9=this[_0xafc6('0xf')](_0xafc6('0x10'));var _0x39dce6=this['getDataValue'](_0xafc6('0x11'));if(_0x1b4ca2===_0xafc6('0x6')){if(_0x487ac9==='preview'){return null;}if(_0x487ac9==='booked'&&!['rrmemory',_0xafc6('0x12')][_0xafc6('0x13')](_0x39dce6)){this[_0xafc6('0xd')]('strategy',_0xafc6('0xb'));}}return _0x39dce6;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xafc6('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xafc6('0x2')]},'weight':{'type':Sequelize[_0xafc6('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':_0xafc6('0x15')},'autopause':{'type':Sequelize[_0xafc6('0x4')]('yes','no',_0xafc6('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xafc6('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xafc6('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xafc6('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xafc6('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xafc6('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xafc6('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xafc6('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xafc6('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xafc6('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xafc6('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no',_0xafc6('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xafc6('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xafc6('0x2')]},'queue_quantity1':{'type':Sequelize[_0xafc6('0x2')]},'queue_quantity2':{'type':Sequelize[_0xafc6('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xafc6('0x2')]},'queue_less_than':{'type':Sequelize[_0xafc6('0x2')]},'periodic_announce':{'type':Sequelize[_0xafc6('0x18')],'set':function(_0x5d1350){this['setDataValue'](_0xafc6('0x19'),_0x5d1350?_0x5d1350[_0xafc6('0x1a')](','):[]);},'get':function(){return this[_0xafc6('0xf')](_0xafc6('0x19'))?this[_0xafc6('0xf')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':_0xafc6('0x15'),'set':function(_0x32c468){this[_0xafc6('0xd')](_0xafc6('0x1b'),_0x32c468?_0x32c468[_0xafc6('0x1a')](','):undefined);},'get':function(){return this[_0xafc6('0xf')]('joinempty')?this[_0xafc6('0xf')]('joinempty')[_0xafc6('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':'no','set':function(_0x44ae51){this['setDataValue'](_0xafc6('0x1d'),_0x44ae51?_0x44ae51[_0xafc6('0x1a')](','):undefined);},'get':function(){return this[_0xafc6('0xf')](_0xafc6('0x1d'))?this[_0xafc6('0xf')](_0xafc6('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xafc6('0x2')]},'description':{'type':Sequelize[_0xafc6('0x2')]},'acw':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':0x0,'set':function(_0xe5b1f8){this[_0xafc6('0xd')]('acw',_0xe5b1f8);if(_0xe5b1f8){if(this[_0xafc6('0xf')](_0xafc6('0x1f'))<0x2){this[_0xafc6('0xd')](_0xafc6('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xafc6('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xafc6('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0xafc6('0x21'),'progressive',_0xafc6('0x22'),_0xafc6('0x23'),_0xafc6('0x24')),'defaultValue':_0xafc6('0x25'),'comment':_0xafc6('0x26')},'dialLimitChannel':{'type':Sequelize[_0xafc6('0x14')](0x4)[_0xafc6('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xafc6('0x28')},'dialLimitQueue':{'type':Sequelize[_0xafc6('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xafc6('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xafc6('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xafc6('0x4')](_0xafc6('0x2a'),_0xafc6('0x2b')),'defaultValue':_0xafc6('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xafc6('0x2c')](0x2)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xafc6('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xafc6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xafc6('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xafc6('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x30')},'dialQueueProject':{'type':Sequelize[_0xafc6('0x2')],'comment':_0xafc6('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafc6('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafc6('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xafc6('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafc6('0x35')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xafc6('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xafc6('0x37')},'dialPrefix':{'type':Sequelize[_0xafc6('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xafc6('0x4')]('always','never','onlyIfOpen'),'defaultValue':_0xafc6('0x38')},'dialAMDActive':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':0x0,'comment':_0xafc6('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xafc6('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xafc6('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xafc6('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xafc6('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xafc6('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xafc6('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xafc6('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xafc6('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xafc6('0x14')](0x9)[_0xafc6('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xafc6('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':0x0,'comment':_0xafc6('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xafc6('0x43'),_0xafc6('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xafc6('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xafc6('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xafc6('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xafc6('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafc6('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafc6('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xafc6('0x14')](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xafc6('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafc6('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafc6('0x14')],'allowNull':!![],'comment':_0xafc6('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':![],'comment':_0xafc6('0x4c'),'set':function(_0x3bc662){if(!_0x3bc662)this[_0xafc6('0xd')](_0xafc6('0x4d'),null);this[_0xafc6('0xd')](_0xafc6('0x4e'),_0x3bc662);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xafc6('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xafc6('0x14')](0x3)[_0xafc6('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xafc6('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 91ac5ff..9b1d80f 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 _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x3938cc,_0x31bec8){var _0x5c1233=function(_0x4b889b){while(--_0x4b889b){_0x3938cc['push'](_0x3938cc['shift']());}};_0x5c1233(++_0x31bec8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0xf3cd[_0x435fa1];return _0x845f9f;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0xc7c064,_0x11068c){var _0x454458=function(_0x170663){while(--_0x170663){_0xc7c064['push'](_0xc7c064['shift']());}};_0x454458(++_0x11068c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 19335b6..426b094 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 _0xad78=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x19a028,_0x161bbc){var _0x2822b0=function(_0x3596e6){while(--_0x3596e6){_0x19a028['push'](_0x19a028['shift']());}};_0x2822b0(++_0x161bbc);}(_0xad78,0x178));var _0x8ad7=function(_0x2bba22,_0x280899){_0x2bba22=_0x2bba22-0x0;var _0x20db8c=_0xad78[_0x2bba22];return _0x20db8c;};'use strict';var EventEmitter=require(_0x8ad7('0x0'));var VoiceQueue=require(_0x8ad7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8ad7('0x2')](0x0);var events={'afterCreate':_0x8ad7('0x3'),'afterUpdate':_0x8ad7('0x4'),'afterDestroy':_0x8ad7('0x5')};function emitEvent(_0x47b302){return function(_0x200862,_0x15cbdf,_0x2d4d91){VoiceQueueEvents[_0x8ad7('0x6')](_0x47b302+':'+_0x200862['id'],_0x200862);VoiceQueueEvents[_0x8ad7('0x6')](_0x47b302,_0x200862);_0x2d4d91(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x8ad7('0x7')](e,emitEvent(event));}}module[_0x8ad7('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x05dc=['events','../../mysqldb','VoiceQueue','update','remove','emit','hook','exports'];(function(_0x304322,_0x4a7ed3){var _0x317a2f=function(_0x22d280){while(--_0x22d280){_0x304322['push'](_0x304322['shift']());}};_0x317a2f(++_0x4a7ed3);}(_0x05dc,0x120));var _0xc05d=function(_0x3495b7,_0x3054fd){_0x3495b7=_0x3495b7-0x0;var _0x55eff5=_0x05dc[_0x3495b7];return _0x55eff5;};'use strict';var EventEmitter=require(_0xc05d('0x0'));var VoiceQueue=require(_0xc05d('0x1'))['db'][_0xc05d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc05d('0x3'),'afterDestroy':_0xc05d('0x4')};function emitEvent(_0x55588f){return function(_0x109291,_0x2e45d5,_0x55af0d){VoiceQueueEvents[_0xc05d('0x5')](_0x55588f+':'+_0x109291['id'],_0x109291);VoiceQueueEvents[_0xc05d('0x5')](_0x55588f,_0x109291);_0x55af0d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc05d('0x6')](e,emitEvent(event));}}module[_0xc05d('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 b0e22d1..fe38a2f 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x238b73,_0x5df76f){var _0x5966d9=function(_0x57802d){while(--_0x57802d){_0x238b73['push'](_0x238b73['shift']());}};_0x5966d9(++_0x5df76f);}(_0x70e0,0x17b));var _0x070e=function(_0x5f2ed4,_0x4c1f14){_0x5f2ed4=_0x5f2ed4-0x0;var _0x2ba8e3=_0x70e0[_0x5f2ed4];return _0x2ba8e3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x55ca,0x126));var _0xa55c=function(_0x519869,_0x5e9535){_0x519869=_0x519869-0x0;var _0x26f819=_0x55ca[_0x519869];return _0x26f819;};'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')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 764f85d..0ac46e0 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 _0x40e6=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceQueue','findAll','options','where','include','map','model','attributes','info','GetVoiceQueue','ShowVoiceQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x87bfdc,_0x320656){var _0x15b3ed=function(_0x221b60){while(--_0x221b60){_0x87bfdc['push'](_0x87bfdc['shift']());}};_0x15b3ed(++_0x320656);}(_0x40e6,0xdc));var _0x640e=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x40e6[_0x179b53];return _0x38a146;};'use strict';var _=require(_0x640e('0x0'));var util=require(_0x640e('0x1'));var moment=require(_0x640e('0x2'));var BPromise=require('bluebird');var rs=require(_0x640e('0x3'));var fs=require('fs');var Redis=require(_0x640e('0x4'));var db=require(_0x640e('0x5'))['db'];var utils=require(_0x640e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x640e('0x7'));var jayson=require(_0x640e('0x8'));var client=jayson[_0x640e('0x9')][_0x640e('0xa')]({'port':0x232a});config[_0x640e('0xb')]=_[_0x640e('0xc')](config[_0x640e('0xb')],{'host':_0x640e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x640e('0xb')]));require(_0x640e('0xe'))[_0x640e('0xf')](socket);function respondWithRpcPromise(_0xbc74d,_0x57debe,_0x34b652){return new BPromise(function(_0x264454,_0x3185c1){return client[_0x640e('0x10')](_0xbc74d,_0x34b652)[_0x640e('0x11')](function(_0xa71ace){logger['info'](_0x640e('0x12'),_0x57debe,_0x640e('0x13'));logger[_0x640e('0x14')](_0x640e('0x15'),_0x57debe,'request\x20sent',JSON['stringify'](_0xa71ace));if(_0xa71ace[_0x640e('0x16')]){if(_0xa71ace['error'][_0x640e('0x17')]===0x1f4){logger[_0x640e('0x16')](_0x640e('0x12'),_0x57debe,_0xa71ace[_0x640e('0x16')]['message']);return _0x3185c1(_0xa71ace[_0x640e('0x16')][_0x640e('0x18')]);}logger[_0x640e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x57debe,_0xa71ace[_0x640e('0x16')]['message']);return _0x264454(_0xa71ace[_0x640e('0x16')][_0x640e('0x18')]);}else{logger['info'](_0x640e('0x12'),_0x57debe,_0x640e('0x13'));_0x264454(_0xa71ace[_0x640e('0x19')][_0x640e('0x18')]);}})[_0x640e('0x1a')](function(_0x383383){logger['error'](_0x640e('0x12'),_0x57debe,_0x383383);_0x3185c1(_0x383383);});});}exports['GetVoiceQueue']=function(_0x4bc5a0){var _0x2108a3=this;return new Promise(function(_0x3dbcae,_0x34a120){return db[_0x640e('0x1b')][_0x640e('0x1c')]({'raw':_0x4bc5a0[_0x640e('0x1d')]?_0x4bc5a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bc5a0[_0x640e('0x1d')]?_0x4bc5a0[_0x640e('0x1d')][_0x640e('0x1e')]||null:null,'attributes':_0x4bc5a0[_0x640e('0x1d')]?_0x4bc5a0[_0x640e('0x1d')]['attributes']||null:null,'limit':_0x4bc5a0[_0x640e('0x1d')]?_0x4bc5a0[_0x640e('0x1d')]['limit']||null:null,'include':_0x4bc5a0[_0x640e('0x1d')]?_0x4bc5a0[_0x640e('0x1d')][_0x640e('0x1f')]?_[_0x640e('0x20')](_0x4bc5a0[_0x640e('0x1d')][_0x640e('0x1f')],function(_0x451a4e){return{'model':db[_0x451a4e[_0x640e('0x21')]],'as':_0x451a4e['as'],'attributes':_0x451a4e[_0x640e('0x22')],'include':_0x451a4e[_0x640e('0x1f')]?_['map'](_0x451a4e[_0x640e('0x1f')],function(_0x51bc84){return{'model':db[_0x51bc84[_0x640e('0x21')]],'as':_0x51bc84['as'],'attributes':_0x51bc84['attributes'],'include':_0x51bc84[_0x640e('0x1f')]?_[_0x640e('0x20')](_0x51bc84[_0x640e('0x1f')],function(_0x414400){return{'model':db[_0x414400[_0x640e('0x21')]],'as':_0x414400['as'],'attributes':_0x414400[_0x640e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x640e('0x11')](function(_0x4b882d){logger[_0x640e('0x23')]('GetVoiceQueue',_0x4bc5a0);logger['debug'](_0x640e('0x24'),_0x4bc5a0,JSON['stringify'](_0x4b882d));_0x3dbcae(_0x4b882d);})[_0x640e('0x1a')](function(_0x3efde7){logger[_0x640e('0x16')](_0x640e('0x24'),_0x3efde7['message'],_0x4bc5a0);_0x34a120(_0x2108a3['error'](0x1f4,_0x3efde7['message']));});});};exports[_0x640e('0x25')]=function(_0x3ed08a){var _0x2e55c5=this;return new Promise(function(_0xb7066f,_0x427195){return db[_0x640e('0x1b')][_0x640e('0x26')]({'raw':_0x3ed08a['options']?_0x3ed08a[_0x640e('0x1d')][_0x640e('0x27')]===undefined?!![]:![]:!![],'where':_0x3ed08a[_0x640e('0x1d')]?_0x3ed08a[_0x640e('0x1d')]['where']||null:null,'attributes':_0x3ed08a[_0x640e('0x1d')]?_0x3ed08a['options'][_0x640e('0x22')]||null:null,'include':_0x3ed08a[_0x640e('0x1d')]?_0x3ed08a[_0x640e('0x1d')][_0x640e('0x1f')]?_[_0x640e('0x20')](_0x3ed08a[_0x640e('0x1d')][_0x640e('0x1f')],function(_0x71dac1){return{'model':db[_0x71dac1[_0x640e('0x21')]],'as':_0x71dac1['as'],'attributes':_0x71dac1[_0x640e('0x22')],'include':_0x71dac1[_0x640e('0x1f')]?_[_0x640e('0x20')](_0x71dac1['include'],function(_0x3fca20){return{'model':db[_0x3fca20[_0x640e('0x21')]],'as':_0x3fca20['as'],'attributes':_0x3fca20['attributes'],'include':_0x3fca20['include']?_[_0x640e('0x20')](_0x3fca20[_0x640e('0x1f')],function(_0x20ef26){return{'model':db[_0x20ef26['model']],'as':_0x20ef26['as'],'attributes':_0x20ef26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfcd903){logger[_0x640e('0x23')]('ShowVoiceQueue',_0x3ed08a);logger[_0x640e('0x14')]('ShowVoiceQueue',_0x3ed08a,JSON['stringify'](_0xfcd903));_0xb7066f(_0xfcd903);})['catch'](function(_0x298e2e){logger[_0x640e('0x16')](_0x640e('0x25'),_0x298e2e[_0x640e('0x18')],_0x3ed08a);_0x427195(_0x2e55c5[_0x640e('0x16')](0x1f4,_0x298e2e[_0x640e('0x18')]));});});}; \ No newline at end of file +var _0x7300=['request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','info','GetVoiceQueue','find','ShowVoiceQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x8c2a7d,_0xc7b745){var _0x1ad9bb=function(_0x22535a){while(--_0x22535a){_0x8c2a7d['push'](_0x8c2a7d['shift']());}};_0x1ad9bb(++_0xc7b745);}(_0x7300,0x91));var _0x0730=function(_0x5f4556,_0x2a3b1f){_0x5f4556=_0x5f4556-0x0;var _0x20ada3=_0x7300[_0x5f4556];return _0x20ada3;};'use strict';var _=require(_0x0730('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0730('0x1'));var fs=require('fs');var Redis=require(_0x0730('0x2'));var db=require(_0x0730('0x3'))['db'];var utils=require(_0x0730('0x4'));var logger=require('../../config/logger')(_0x0730('0x5'));var config=require('../../config/environment');var jayson=require(_0x0730('0x6'));var client=jayson[_0x0730('0x7')][_0x0730('0x8')]({'port':0x232a});config[_0x0730('0x9')]=_[_0x0730('0xa')](config[_0x0730('0x9')],{'host':_0x0730('0xb'),'port':0x18eb});var socket=require(_0x0730('0xc'))(new Redis(config[_0x0730('0x9')]));require(_0x0730('0xd'))[_0x0730('0xe')](socket);function respondWithRpcPromise(_0x6271d6,_0x37afb1,_0x1added){return new BPromise(function(_0x43eaee,_0x3e8804){return client[_0x0730('0xf')](_0x6271d6,_0x1added)[_0x0730('0x10')](function(_0x51a12d){logger['info'](_0x0730('0x11'),_0x37afb1,'request\x20sent');logger[_0x0730('0x12')](_0x0730('0x13'),_0x37afb1,_0x0730('0x14'),JSON[_0x0730('0x15')](_0x51a12d));if(_0x51a12d['error']){if(_0x51a12d[_0x0730('0x16')]['code']===0x1f4){logger[_0x0730('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x37afb1,_0x51a12d['error'][_0x0730('0x17')]);return _0x3e8804(_0x51a12d['error'][_0x0730('0x17')]);}logger[_0x0730('0x16')](_0x0730('0x11'),_0x37afb1,_0x51a12d[_0x0730('0x16')][_0x0730('0x17')]);return _0x43eaee(_0x51a12d[_0x0730('0x16')][_0x0730('0x17')]);}else{logger['info'](_0x0730('0x11'),_0x37afb1,'request\x20sent');_0x43eaee(_0x51a12d[_0x0730('0x18')][_0x0730('0x17')]);}})[_0x0730('0x19')](function(_0x159d3d){logger[_0x0730('0x16')](_0x0730('0x11'),_0x37afb1,_0x159d3d);_0x3e8804(_0x159d3d);});});}exports['GetVoiceQueue']=function(_0x4b964c){var _0x5a078b=this;return new Promise(function(_0x374de6,_0x2790bd){return db[_0x0730('0x1a')][_0x0730('0x1b')]({'raw':_0x4b964c[_0x0730('0x1c')]?_0x4b964c[_0x0730('0x1c')][_0x0730('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b964c[_0x0730('0x1c')]?_0x4b964c[_0x0730('0x1c')][_0x0730('0x1e')]||null:null,'attributes':_0x4b964c[_0x0730('0x1c')]?_0x4b964c[_0x0730('0x1c')]['attributes']||null:null,'limit':_0x4b964c[_0x0730('0x1c')]?_0x4b964c['options'][_0x0730('0x1f')]||null:null,'include':_0x4b964c[_0x0730('0x1c')]?_0x4b964c['options'][_0x0730('0x20')]?_[_0x0730('0x21')](_0x4b964c[_0x0730('0x1c')][_0x0730('0x20')],function(_0x19d402){return{'model':db[_0x19d402[_0x0730('0x22')]],'as':_0x19d402['as'],'attributes':_0x19d402[_0x0730('0x23')],'include':_0x19d402[_0x0730('0x20')]?_[_0x0730('0x21')](_0x19d402[_0x0730('0x20')],function(_0x5aa5c8){return{'model':db[_0x5aa5c8[_0x0730('0x22')]],'as':_0x5aa5c8['as'],'attributes':_0x5aa5c8['attributes'],'include':_0x5aa5c8[_0x0730('0x20')]?_['map'](_0x5aa5c8[_0x0730('0x20')],function(_0x263387){return{'model':db[_0x263387[_0x0730('0x22')]],'as':_0x263387['as'],'attributes':_0x263387['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df255){logger[_0x0730('0x24')](_0x0730('0x25'),_0x4b964c);logger[_0x0730('0x12')](_0x0730('0x25'),_0x4b964c,JSON[_0x0730('0x15')](_0x5df255));_0x374de6(_0x5df255);})[_0x0730('0x19')](function(_0x39f46b){logger[_0x0730('0x16')](_0x0730('0x25'),_0x39f46b[_0x0730('0x17')],_0x4b964c);_0x2790bd(_0x5a078b['error'](0x1f4,_0x39f46b['message']));});});};exports['ShowVoiceQueue']=function(_0x2ec6ea){var _0x2ea1b9=this;return new Promise(function(_0x2d063c,_0x1d3b91){return db['VoiceQueue'][_0x0730('0x26')]({'raw':_0x2ec6ea[_0x0730('0x1c')]?_0x2ec6ea[_0x0730('0x1c')][_0x0730('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ec6ea['options']?_0x2ec6ea[_0x0730('0x1c')][_0x0730('0x1e')]||null:null,'attributes':_0x2ec6ea[_0x0730('0x1c')]?_0x2ec6ea[_0x0730('0x1c')][_0x0730('0x23')]||null:null,'include':_0x2ec6ea[_0x0730('0x1c')]?_0x2ec6ea['options']['include']?_['map'](_0x2ec6ea['options']['include'],function(_0x36bdb2){return{'model':db[_0x36bdb2['model']],'as':_0x36bdb2['as'],'attributes':_0x36bdb2[_0x0730('0x23')],'include':_0x36bdb2[_0x0730('0x20')]?_[_0x0730('0x21')](_0x36bdb2[_0x0730('0x20')],function(_0xca11eb){return{'model':db[_0xca11eb[_0x0730('0x22')]],'as':_0xca11eb['as'],'attributes':_0xca11eb[_0x0730('0x23')],'include':_0xca11eb[_0x0730('0x20')]?_[_0x0730('0x21')](_0xca11eb[_0x0730('0x20')],function(_0x373941){return{'model':db[_0x373941[_0x0730('0x22')]],'as':_0x373941['as'],'attributes':_0x373941[_0x0730('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0730('0x10')](function(_0x146bce){logger['info'](_0x0730('0x27'),_0x2ec6ea);logger[_0x0730('0x12')]('ShowVoiceQueue',_0x2ec6ea,JSON['stringify'](_0x146bce));_0x2d063c(_0x146bce);})[_0x0730('0x19')](function(_0x3e4a42){logger[_0x0730('0x16')](_0x0730('0x27'),_0x3e4a42[_0x0730('0x17')],_0x2ec6ea);_0x1d3b91(_0x2ea1b9[_0x0730('0x16')](0x1f4,_0x3e4a42[_0x0730('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ebbbb14..3805027 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 _0xaa01=['voiceQueue:','save','update','removeListener','register','length'];(function(_0x4f59e5,_0x3e4d09){var _0x76a75=function(_0x3fd58d){while(--_0x3fd58d){_0x4f59e5['push'](_0x4f59e5['shift']());}};_0x76a75(++_0x3e4d09);}(_0xaa01,0x121));var _0x1aa0=function(_0x288139,_0x4fc04f){_0x288139=_0x288139-0x0;var _0x398b1e=_0xaa01[_0x288139];return _0x398b1e;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x1aa0('0x0'),'remove',_0x1aa0('0x1')];function createListener(_0x109c09,_0x501427){return function(_0xd4f687){_0x501427['emit'](_0x109c09,_0xd4f687);};}function removeListener(_0x443a08,_0x10da72){return function(){VoiceQueueEvents[_0x1aa0('0x2')](_0x443a08,_0x10da72);};}exports[_0x1aa0('0x3')]=function(_0xf5571b){for(var _0x4ddb59=0x0,_0x5f2683=events[_0x1aa0('0x4')];_0x4ddb59<_0x5f2683;_0x4ddb59++){var _0x11e3aa=events[_0x4ddb59];var _0x45a62f=createListener(_0x1aa0('0x5')+_0x11e3aa,_0xf5571b);VoiceQueueEvents['on'](_0x11e3aa,_0x45a62f);}}; \ No newline at end of file +var _0xbf91=['save','remove','emit','removeListener','length','./voiceQueue.events'];(function(_0x973a06,_0x1e22cc){var _0x1261b5=function(_0x2ecf02){while(--_0x2ecf02){_0x973a06['push'](_0x973a06['shift']());}};_0x1261b5(++_0x1e22cc);}(_0xbf91,0xd7));var _0x1bf9=function(_0x3d1280,_0x569bb9){_0x3d1280=_0x3d1280-0x0;var _0x4e1988=_0xbf91[_0x3d1280];return _0x4e1988;};'use strict';var VoiceQueueEvents=require(_0x1bf9('0x0'));var events=[_0x1bf9('0x1'),_0x1bf9('0x2'),'update'];function createListener(_0x5abd06,_0xec59be){return function(_0xaaa44d){_0xec59be[_0x1bf9('0x3')](_0x5abd06,_0xaaa44d);};}function removeListener(_0x5ae5a9,_0x130e4d){return function(){VoiceQueueEvents[_0x1bf9('0x4')](_0x5ae5a9,_0x130e4d);};}exports['register']=function(_0xaf1247){for(var _0x1bc652=0x0,_0x3c7141=events[_0x1bf9('0x5')];_0x1bc652<_0x3c7141;_0x1bc652++){var _0x10a2bf=events[_0x1bc652];var _0x143cae=createListener('voiceQueue:'+_0x10a2bf,_0xaf1247);VoiceQueueEvents['on'](_0x10a2bf,_0x143cae);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bb15e62..889e382 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 _0xb636=['isAuthenticated','index','get','/describe','describe','/index','/:id','show','post','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5427c8,_0x18f384){var _0x33a129=function(_0x1940e8){while(--_0x1940e8){_0x5427c8['push'](_0x5427c8['shift']());}};_0x33a129(++_0x18f384);}(_0xb636,0x198));var _0x6b63=function(_0x946b8d,_0x12f215){_0x946b8d=_0x946b8d-0x0;var _0x94b470=_0xb636[_0x946b8d];return _0x94b470;};'use strict';var multer=require(_0x6b63('0x0'));var util=require(_0x6b63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b63('0x2'));var router=express['Router']();var fs_extra=require(_0x6b63('0x3'));var auth=require(_0x6b63('0x4'));var interaction=require(_0x6b63('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x6b63('0x6')](),controller[_0x6b63('0x7')]);router[_0x6b63('0x8')](_0x6b63('0x9'),auth[_0x6b63('0x6')](),controller[_0x6b63('0xa')]);router['get'](_0x6b63('0xb'),auth[_0x6b63('0x6')](),controller['getVoiceQueuesReport']);router[_0x6b63('0x8')](_0x6b63('0xc'),auth[_0x6b63('0x6')](),controller[_0x6b63('0xd')]);router[_0x6b63('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6b63('0xc'),auth[_0x6b63('0x6')](),controller['update']);router[_0x6b63('0xf')](_0x6b63('0xc'),auth['isAuthenticated'](),controller[_0x6b63('0x10')]);module[_0x6b63('0x11')]=router; \ No newline at end of file +var _0x5a99=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','/index','isAuthenticated','/:id','show','post'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x5a99,0xbd));var _0x95a9=function(_0x35335e,_0x46613b){_0x35335e=_0x35335e-0x0;var _0x236530=_0x5a99[_0x35335e];return _0x236530;};'use strict';var multer=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var path=require(_0x95a9('0x2'));var timeout=require(_0x95a9('0x3'));var express=require(_0x95a9('0x4'));var router=express[_0x95a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x95a9('0x6'));var interaction=require(_0x95a9('0x7'));var config=require(_0x95a9('0x8'));var controller=require(_0x95a9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x95a9('0xa')]);router[_0x95a9('0xb')](_0x95a9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x95a9('0xb')](_0x95a9('0xd'),auth[_0x95a9('0xe')](),controller['getVoiceQueuesReport']);router[_0x95a9('0xb')](_0x95a9('0xf'),auth['isAuthenticated'](),controller[_0x95a9('0x10')]);router[_0x95a9('0x11')]('/',auth[_0x95a9('0xe')](),controller[_0x95a9('0x12')]);router['put'](_0x95a9('0xf'),auth[_0x95a9('0xe')](),controller[_0x95a9('0x13')]);router[_0x95a9('0x14')](_0x95a9('0xf'),auth[_0x95a9('0xe')](),controller[_0x95a9('0x15')]);module[_0x95a9('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d5e1ef6..2d2976c 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 _0x97d0=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47cf36,_0x3c2288){var _0x10c485=function(_0x8999e9){while(--_0x8999e9){_0x47cf36['push'](_0x47cf36['shift']());}};_0x10c485(++_0x3c2288);}(_0x97d0,0x118));var _0x097d=function(_0x58170c,_0x19598e){_0x58170c=_0x58170c-0x0;var _0x45fb70=_0x97d0[_0x58170c];return _0x45fb70;};'use strict';var Sequelize=require(_0x097d('0x0'));var moment=require(_0x097d('0x1'));module[_0x097d('0x2')]={'type':{'type':Sequelize[_0x097d('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x097d('0x3')]},'calleridname':{'type':Sequelize[_0x097d('0x3')]},'queue':{'type':Sequelize[_0x097d('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x097d('0x4')],'set':function(_0x54c624){var _0x142b7c=moment(_0x54c624);var _0x287661=moment(this[_0x097d('0x5')](_0x097d('0x6')))[_0x097d('0x7')](_0x097d('0x8'));var _0x2a1daf=_0x142b7c[_0x097d('0x9')](_0x287661,_0x097d('0xa'));this[_0x097d('0xb')](_0x097d('0xc'),_0x54c624);this[_0x097d('0xb')](_0x097d('0xd'),_0x2a1daf||null);}},'position':{'type':Sequelize[_0x097d('0xe')]},'count':{'type':Sequelize[_0x097d('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x097d('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x097d('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x097d('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x097d('0x4')]},'queuecallerexit':{'type':Sequelize[_0x097d('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x097d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x097d('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x097d('0xe')]},'channel':{'type':Sequelize[_0x097d('0x3')]},'connectedlinenum':{'type':Sequelize[_0x097d('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x097d('0x3')]},'exten':{'type':Sequelize[_0x097d('0x3')]},'priority':{'type':Sequelize[_0x097d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x097d('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x097d('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x097d('0x3')]},'transfer':{'type':Sequelize[_0x097d('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x097d('0x3')],'comment':_0x097d('0x10')},'transferexten':{'type':Sequelize[_0x097d('0x3')]},'transferuniqueid':{'type':Sequelize[_0x097d('0x3')]},'disposition':{'type':Sequelize[_0x097d('0x3')]},'secondDisposition':{'type':Sequelize[_0x097d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x097d('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x097d('0x3')]}}; \ No newline at end of file +var _0x5189=['seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x5189,0x1d7));var _0x9518=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x5189[_0x149ca0];return _0x56b6b9;};'use strict';var Sequelize=require(_0x9518('0x0'));var moment=require(_0x9518('0x1'));module[_0x9518('0x2')]={'type':{'type':Sequelize[_0x9518('0x3')]},'uniqueid':{'type':Sequelize[_0x9518('0x3')]},'calleridnum':{'type':Sequelize[_0x9518('0x3')]},'calleridname':{'type':Sequelize[_0x9518('0x3')]},'queue':{'type':Sequelize[_0x9518('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9518('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9518('0x4')],'set':function(_0x52d0e4){var _0x217409=moment(_0x52d0e4);var _0x25013f=moment(this[_0x9518('0x5')](_0x9518('0x6')))['format'](_0x9518('0x7'));var _0x108d72=_0x217409[_0x9518('0x8')](_0x25013f,_0x9518('0x9'));this['setDataValue'](_0x9518('0xa'),_0x52d0e4);this[_0x9518('0xb')](_0x9518('0xc'),_0x108d72||null);}},'position':{'type':Sequelize[_0x9518('0xd')]},'count':{'type':Sequelize[_0x9518('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x9518('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9518('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9518('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9518('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9518('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9518('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x9518('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x9518('0xd')]},'channel':{'type':Sequelize[_0x9518('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9518('0x3')]},'accountcode':{'type':Sequelize[_0x9518('0x3')]},'context':{'type':Sequelize[_0x9518('0x3')]},'exten':{'type':Sequelize[_0x9518('0x3')]},'priority':{'type':Sequelize[_0x9518('0x3')]},'holdtime':{'type':Sequelize[_0x9518('0xd')]},'mohtime':{'type':Sequelize[_0x9518('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9518('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9518('0x3')]},'transfer':{'type':Sequelize[_0x9518('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9518('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9518('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9518('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9518('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9518('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9518('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6c7c2ba..c43ff78 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 _0x4b03=['./voiceQueueReport.socket','register','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0x4b03,0x130));var _0x34b0=function(_0xd03892,_0x4f5416){_0xd03892=_0xd03892-0x0;var _0x2bae0d=_0x4b03[_0xd03892];return _0x2bae0d;};'use strict';var emlformat=require(_0x34b0('0x0'));var rimraf=require(_0x34b0('0x1'));var zipdir=require(_0x34b0('0x2'));var jsonpatch=require(_0x34b0('0x3'));var rp=require('request-promise');var moment=require(_0x34b0('0x4'));var BPromise=require(_0x34b0('0x5'));var Mustache=require(_0x34b0('0x6'));var util=require(_0x34b0('0x7'));var path=require(_0x34b0('0x8'));var sox=require('sox');var csv=require(_0x34b0('0x9'));var ejs=require(_0x34b0('0xa'));var fs=require('fs');var fs_extra=require(_0x34b0('0xb'));var _=require('lodash');var squel=require(_0x34b0('0xc'));var crypto=require(_0x34b0('0xd'));var jsforce=require(_0x34b0('0xe'));var deskjs=require(_0x34b0('0xf'));var toCsv=require(_0x34b0('0x9'));var querystring=require('querystring');var Papa=require(_0x34b0('0x10'));var Redis=require('ioredis');var authService=require(_0x34b0('0x11'));var qs=require(_0x34b0('0x12'));var as=require(_0x34b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x34b0('0x14'));var utils=require('../../config/utils');var config=require(_0x34b0('0x15'));var licenseUtil=require(_0x34b0('0x16'));var db=require(_0x34b0('0x17'))['db'];config[_0x34b0('0x18')]=_[_0x34b0('0x19')](config[_0x34b0('0x18')],{'host':_0x34b0('0x1a'),'port':0x18eb});var socket=require(_0x34b0('0x1b'))(new Redis(config['redis']));require(_0x34b0('0x1c'))[_0x34b0('0x1d')](socket);function respondWithStatusCode(_0x4b1130,_0x5d90d3){_0x5d90d3=_0x5d90d3||0xcc;return function(_0x165ffc){if(_0x165ffc){return _0x4b1130[_0x34b0('0x1e')](_0x5d90d3);}return _0x4b1130['status'](_0x5d90d3)[_0x34b0('0x1f')]();};}function respondWithResult(_0x9b0932,_0x3a3352){_0x3a3352=_0x3a3352||0xc8;return function(_0x126291){if(_0x126291){return _0x9b0932['status'](_0x3a3352)[_0x34b0('0x20')](_0x126291);}};}function respondWithFilteredResult(_0x19f377,_0x396783){return function(_0x595acd){if(_0x595acd){var _0x427cd1=typeof _0x396783['offset']===_0x34b0('0x21')&&typeof _0x396783['limit']===_0x34b0('0x21');var _0x3984a8=_0x595acd[_0x34b0('0x22')];var _0x4a03c4=_0x427cd1?0x0:_0x396783[_0x34b0('0x23')];var _0x4db9f3=_0x427cd1?_0x595acd[_0x34b0('0x22')]:_0x396783['offset']+_0x396783['limit'];var _0x243f75;if(_0x4db9f3>=_0x3984a8){_0x4db9f3=_0x3984a8;_0x243f75=0xc8;}else{_0x243f75=0xce;}_0x19f377[_0x34b0('0x24')](_0x243f75);return _0x19f377[_0x34b0('0x25')](_0x34b0('0x26'),_0x4a03c4+'-'+_0x4db9f3+'/'+_0x3984a8)['json'](_0x595acd);}return null;};}function patchUpdates(_0x2d8a39){return function(_0x2e62d6){try{jsonpatch[_0x34b0('0x27')](_0x2e62d6,_0x2d8a39,!![]);}catch(_0x4e369d){return BPromise['reject'](_0x4e369d);}return _0x2e62d6[_0x34b0('0x28')]();};}function saveUpdates(_0x5e31f7,_0x4ccd07){return function(_0x56a95b){if(_0x56a95b){return _0x56a95b['update'](_0x5e31f7)[_0x34b0('0x29')](function(_0x590441){return _0x590441;});}return null;};}function removeEntity(_0x46ef94,_0xb41444){return function(_0x505572){if(_0x505572){return _0x505572[_0x34b0('0x2a')]()[_0x34b0('0x29')](function(){_0x46ef94[_0x34b0('0x24')](0xcc)[_0x34b0('0x1f')]();});}};}function handleEntityNotFound(_0x769de6,_0x34e06e){return function(_0x4c45e7){if(!_0x4c45e7){_0x769de6[_0x34b0('0x1e')](0x194);}return _0x4c45e7;};}function handleError(_0x3905cb,_0x1124f4){_0x1124f4=_0x1124f4||0x1f4;return function(_0x437ba6){logger[_0x34b0('0x2b')](_0x437ba6[_0x34b0('0x2c')]);if(_0x437ba6[_0x34b0('0x2d')]){delete _0x437ba6['name'];}_0x3905cb[_0x34b0('0x24')](_0x1124f4)[_0x34b0('0x2e')](_0x437ba6);};}exports[_0x34b0('0x2f')]=function(_0x385184,_0x54d660){var _0x493455={},_0x5a2053={},_0x592a95={'count':0x0,'rows':[]};var _0x12d0f7=_[_0x34b0('0x30')](db[_0x34b0('0x31')][_0x34b0('0x32')],function(_0x22fa99){return{'name':_0x22fa99[_0x34b0('0x33')],'type':_0x22fa99['type']['key']};});_0x5a2053[_0x34b0('0x34')]=_['map'](_0x12d0f7,_0x34b0('0x2d'));_0x5a2053[_0x34b0('0x35')]=_[_0x34b0('0x36')](_0x385184['query']);_0x5a2053['filters']=_['intersection'](_0x5a2053[_0x34b0('0x34')],_0x5a2053[_0x34b0('0x35')]);_0x493455[_0x34b0('0x37')]=_[_0x34b0('0x38')](_0x5a2053[_0x34b0('0x34')],qs[_0x34b0('0x39')](_0x385184[_0x34b0('0x35')]['fields']));_0x493455['attributes']=_0x493455[_0x34b0('0x37')][_0x34b0('0x3a')]?_0x493455[_0x34b0('0x37')]:_0x5a2053[_0x34b0('0x34')];if(!_0x385184[_0x34b0('0x35')][_0x34b0('0x3b')]('nolimit')){_0x493455[_0x34b0('0x3c')]=qs[_0x34b0('0x3c')](_0x385184['query']['limit']);_0x493455[_0x34b0('0x23')]=qs[_0x34b0('0x23')](_0x385184[_0x34b0('0x35')][_0x34b0('0x23')]);}_0x493455[_0x34b0('0x3d')]=qs[_0x34b0('0x3e')](_0x385184[_0x34b0('0x35')][_0x34b0('0x3e')]);_0x493455['where']=qs[_0x34b0('0x3f')](_[_0x34b0('0x40')](_0x385184[_0x34b0('0x35')],_0x5a2053['filters']),_0x12d0f7);if(_0x385184[_0x34b0('0x35')][_0x34b0('0x41')]){_0x493455[_0x34b0('0x42')]=_[_0x34b0('0x43')](_0x493455[_0x34b0('0x42')],{'$or':_[_0x34b0('0x30')](_0x12d0f7,function(_0x4abd7a){if(_0x4abd7a[_0x34b0('0x44')]!==_0x34b0('0x45')){var _0x2eaf9c={};_0x2eaf9c[_0x4abd7a[_0x34b0('0x2d')]]={'$like':'%'+_0x385184[_0x34b0('0x35')][_0x34b0('0x41')]+'%'};return _0x2eaf9c;}})});}_0x493455=_[_0x34b0('0x43')]({},_0x493455,_0x385184[_0x34b0('0x46')]);var _0xa0bb73={'where':_0x493455['where']};return db[_0x34b0('0x31')][_0x34b0('0x22')](_0xa0bb73)[_0x34b0('0x29')](function(_0xda6755){_0x592a95[_0x34b0('0x22')]=_0xda6755;if(_0x385184[_0x34b0('0x35')]['includeAll']){_0x493455[_0x34b0('0x47')]=[{'all':!![]}];}return db[_0x34b0('0x31')][_0x34b0('0x48')](_0x493455);})[_0x34b0('0x29')](function(_0x3dc8cc){_0x592a95[_0x34b0('0x49')]=_0x3dc8cc;return _0x592a95;})[_0x34b0('0x29')](respondWithFilteredResult(_0x54d660,_0x493455))[_0x34b0('0x4a')](handleError(_0x54d660,null));};exports[_0x34b0('0x4b')]=function(_0x356d02,_0x2875cb){var _0x114421={'raw':![],'where':{'id':_0x356d02['params']['id']}},_0x44f42a={};_0x44f42a[_0x34b0('0x34')]=_[_0x34b0('0x36')](db[_0x34b0('0x31')]['rawAttributes']);_0x44f42a[_0x34b0('0x35')]=_[_0x34b0('0x36')](_0x356d02['query']);_0x44f42a[_0x34b0('0x3f')]=_[_0x34b0('0x38')](_0x44f42a[_0x34b0('0x34')],_0x44f42a[_0x34b0('0x35')]);_0x114421[_0x34b0('0x37')]=_['intersection'](_0x44f42a['model'],qs[_0x34b0('0x39')](_0x356d02[_0x34b0('0x35')]['fields']));_0x114421[_0x34b0('0x37')]=_0x114421[_0x34b0('0x37')]['length']?_0x114421[_0x34b0('0x37')]:_0x44f42a[_0x34b0('0x34')];if(_0x356d02['query'][_0x34b0('0x4c')]){_0x114421[_0x34b0('0x47')]=[{'all':!![]}];}_0x114421=_['merge']({},_0x114421,_0x356d02[_0x34b0('0x46')]);return db[_0x34b0('0x31')][_0x34b0('0x4d')](_0x114421)['then'](handleEntityNotFound(_0x2875cb,null))[_0x34b0('0x29')](respondWithResult(_0x2875cb,null))[_0x34b0('0x4a')](handleError(_0x2875cb,null));};exports[_0x34b0('0x4e')]=function(_0x2eb27f,_0x197be2){return db[_0x34b0('0x31')][_0x34b0('0x4e')](_0x2eb27f['body'],{})[_0x34b0('0x29')](respondWithResult(_0x197be2,0xc9))[_0x34b0('0x4a')](handleError(_0x197be2,null));};exports['update']=function(_0x56431a,_0x39f7c1){if(_0x56431a[_0x34b0('0x4f')]['id']){delete _0x56431a['body']['id'];}return db[_0x34b0('0x31')][_0x34b0('0x4d')]({'where':{'id':_0x56431a['params']['id']}})[_0x34b0('0x29')](handleEntityNotFound(_0x39f7c1,null))[_0x34b0('0x29')](saveUpdates(_0x56431a[_0x34b0('0x4f')],null))[_0x34b0('0x29')](respondWithResult(_0x39f7c1,null))[_0x34b0('0x4a')](handleError(_0x39f7c1,null));};exports['destroy']=function(_0x13658a,_0x3c8089){return db['VoiceQueueReport'][_0x34b0('0x4d')]({'where':{'id':_0x13658a[_0x34b0('0x50')]['id']}})[_0x34b0('0x29')](handleEntityNotFound(_0x3c8089,null))['then'](removeEntity(_0x3c8089,null))[_0x34b0('0x4a')](handleError(_0x3c8089,null));};exports[_0x34b0('0x51')]=function(_0x37fc20,_0x379c8e){return db[_0x34b0('0x31')]['describe']()[_0x34b0('0x29')](respondWithResult(_0x379c8e,null))[_0x34b0('0x4a')](handleError(_0x379c8e,null));};exports[_0x34b0('0x52')]=function(_0x45ec17,_0xaf904f){var _0x45cb2c={},_0x457cba={},_0x48a9e3={'count':0x0,'rows':[]};_0x457cba[_0x34b0('0x34')]=_[_0x34b0('0x36')](db[_0x34b0('0x31')][_0x34b0('0x32')]);_0x457cba[_0x34b0('0x35')]=_['keys'](_0x45ec17['query']);_0x457cba[_0x34b0('0x3f')]=_['intersection'](_0x457cba[_0x34b0('0x34')],_0x457cba['query']);_0x45cb2c[_0x34b0('0x37')]=_['intersection'](_0x457cba[_0x34b0('0x34')],qs[_0x34b0('0x39')](_0x45ec17['query'][_0x34b0('0x39')]));_0x45cb2c[_0x34b0('0x37')]=_0x45cb2c[_0x34b0('0x37')]['length']?_0x45cb2c[_0x34b0('0x37')]:_0x457cba[_0x34b0('0x34')];if(!_0x45ec17[_0x34b0('0x35')][_0x34b0('0x3b')]('nolimit')){_0x45cb2c[_0x34b0('0x3c')]=qs['limit'](_0x45ec17['query'][_0x34b0('0x3c')]);_0x45cb2c['offset']=qs['offset'](_0x45ec17['query'][_0x34b0('0x23')]);}_0x45cb2c[_0x34b0('0x3d')]=qs['sort'](_0x45ec17[_0x34b0('0x35')]['sort']);_0x45cb2c[_0x34b0('0x42')]=qs[_0x34b0('0x3f')](_[_0x34b0('0x40')](_0x45ec17[_0x34b0('0x35')],_0x457cba[_0x34b0('0x3f')]));if(_0x45ec17[_0x34b0('0x35')]['filter']){_0x45cb2c['where']=_[_0x34b0('0x43')](_0x45cb2c[_0x34b0('0x42')],{'$or':_[_0x34b0('0x30')](_0x45cb2c[_0x34b0('0x37')],function(_0x23d261){var _0x3d09bd={};_0x3d09bd[_0x23d261]={'$like':'%'+_0x45ec17[_0x34b0('0x35')][_0x34b0('0x41')]+'%'};return _0x3d09bd;})});}_0x45cb2c=_[_0x34b0('0x43')]({},_0x45cb2c,_0x45ec17[_0x34b0('0x46')]);var _0x445c05={'where':_0x45cb2c[_0x34b0('0x42')]};return db['VoiceQueueReport'][_0x34b0('0x22')](_0x445c05)[_0x34b0('0x29')](function(_0x2ed8cf){_0x48a9e3[_0x34b0('0x22')]=_0x2ed8cf;if(_0x45ec17['query'][_0x34b0('0x4c')]){_0x45cb2c[_0x34b0('0x47')]=[{'all':!![]}];}return db[_0x34b0('0x31')][_0x34b0('0x48')](_0x45cb2c);})[_0x34b0('0x29')](function(_0x551902){_0x48a9e3[_0x34b0('0x49')]=_0x551902;return _0x48a9e3;})[_0x34b0('0x29')](respondWithFilteredResult(_0xaf904f,_0x45cb2c,_0x34b0('0x52')))[_0x34b0('0x4a')](handleError(_0xaf904f,null,_0x34b0('0x52')));}; \ No newline at end of file +var _0x4122=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','params','describe','rawAttributes','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceQueueReport'];(function(_0x31f186,_0x32cee2){var _0x4cbb16=function(_0x3f7e25){while(--_0x3f7e25){_0x31f186['push'](_0x31f186['shift']());}};_0x4cbb16(++_0x32cee2);}(_0x4122,0x6f));var _0x2412=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4122[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2412('0x0'));var rimraf=require(_0x2412('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2412('0x2'));var rp=require('request-promise');var moment=require(_0x2412('0x3'));var BPromise=require(_0x2412('0x4'));var Mustache=require('mustache');var util=require(_0x2412('0x5'));var path=require('path');var sox=require(_0x2412('0x6'));var csv=require('to-csv');var ejs=require(_0x2412('0x7'));var fs=require('fs');var fs_extra=require(_0x2412('0x8'));var _=require(_0x2412('0x9'));var squel=require('squel');var crypto=require(_0x2412('0xa'));var jsforce=require(_0x2412('0xb'));var deskjs=require(_0x2412('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2412('0xd'));var Papa=require(_0x2412('0xe'));var Redis=require(_0x2412('0xf'));var authService=require(_0x2412('0x10'));var qs=require(_0x2412('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2412('0x12'));var utils=require(_0x2412('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2412('0x14'));var db=require(_0x2412('0x15'))['db'];config[_0x2412('0x16')]=_['defaults'](config[_0x2412('0x16')],{'host':_0x2412('0x17'),'port':0x18eb});var socket=require(_0x2412('0x18'))(new Redis(config[_0x2412('0x16')]));require(_0x2412('0x19'))[_0x2412('0x1a')](socket);function respondWithStatusCode(_0xecde1d,_0x534b9d){_0x534b9d=_0x534b9d||0xcc;return function(_0x2f1cac){if(_0x2f1cac){return _0xecde1d[_0x2412('0x1b')](_0x534b9d);}return _0xecde1d[_0x2412('0x1c')](_0x534b9d)[_0x2412('0x1d')]();};}function respondWithResult(_0x1f8219,_0x3842a9){_0x3842a9=_0x3842a9||0xc8;return function(_0x2608ad){if(_0x2608ad){return _0x1f8219[_0x2412('0x1c')](_0x3842a9)[_0x2412('0x1e')](_0x2608ad);}};}function respondWithFilteredResult(_0x497b95,_0x2aaf84){return function(_0x1783da){if(_0x1783da){var _0xe62341=typeof _0x2aaf84[_0x2412('0x1f')]===_0x2412('0x20')&&typeof _0x2aaf84[_0x2412('0x21')]===_0x2412('0x20');var _0x54166f=_0x1783da[_0x2412('0x22')];var _0x656442=_0xe62341?0x0:_0x2aaf84[_0x2412('0x1f')];var _0x147957=_0xe62341?_0x1783da[_0x2412('0x22')]:_0x2aaf84[_0x2412('0x1f')]+_0x2aaf84[_0x2412('0x21')];var _0x408d5a;if(_0x147957>=_0x54166f){_0x147957=_0x54166f;_0x408d5a=0xc8;}else{_0x408d5a=0xce;}_0x497b95[_0x2412('0x1c')](_0x408d5a);return _0x497b95[_0x2412('0x23')](_0x2412('0x24'),_0x656442+'-'+_0x147957+'/'+_0x54166f)[_0x2412('0x1e')](_0x1783da);}return null;};}function patchUpdates(_0x1a5ee8){return function(_0x4e52fc){try{jsonpatch[_0x2412('0x25')](_0x4e52fc,_0x1a5ee8,!![]);}catch(_0x350f7e){return BPromise[_0x2412('0x26')](_0x350f7e);}return _0x4e52fc[_0x2412('0x27')]();};}function saveUpdates(_0x37fa5d,_0xe10822){return function(_0x301c92){if(_0x301c92){return _0x301c92[_0x2412('0x28')](_0x37fa5d)['then'](function(_0x293375){return _0x293375;});}return null;};}function removeEntity(_0x175e24,_0x3a7ae9){return function(_0x430a7a){if(_0x430a7a){return _0x430a7a[_0x2412('0x29')]()[_0x2412('0x2a')](function(){_0x175e24[_0x2412('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ebc52,_0x5d3fbe){return function(_0x4b8835){if(!_0x4b8835){_0x4ebc52[_0x2412('0x1b')](0x194);}return _0x4b8835;};}function handleError(_0x197eae,_0x6ebf2f){_0x6ebf2f=_0x6ebf2f||0x1f4;return function(_0xacd028){logger[_0x2412('0x2b')](_0xacd028[_0x2412('0x2c')]);if(_0xacd028[_0x2412('0x2d')]){delete _0xacd028[_0x2412('0x2d')];}_0x197eae[_0x2412('0x1c')](_0x6ebf2f)[_0x2412('0x2e')](_0xacd028);};}exports['index']=function(_0x2e8f56,_0x1c7ea5){var _0x2ed005={},_0x3ff22d={},_0x374615={'count':0x0,'rows':[]};var _0x5756eb=_[_0x2412('0x2f')](db[_0x2412('0x30')]['rawAttributes'],function(_0x2542a2){return{'name':_0x2542a2[_0x2412('0x31')],'type':_0x2542a2['type'][_0x2412('0x32')]};});_0x3ff22d[_0x2412('0x33')]=_['map'](_0x5756eb,'name');_0x3ff22d[_0x2412('0x34')]=_[_0x2412('0x35')](_0x2e8f56[_0x2412('0x34')]);_0x3ff22d[_0x2412('0x36')]=_[_0x2412('0x37')](_0x3ff22d[_0x2412('0x33')],_0x3ff22d[_0x2412('0x34')]);_0x2ed005[_0x2412('0x38')]=_['intersection'](_0x3ff22d[_0x2412('0x33')],qs[_0x2412('0x39')](_0x2e8f56[_0x2412('0x34')][_0x2412('0x39')]));_0x2ed005[_0x2412('0x38')]=_0x2ed005['attributes'][_0x2412('0x3a')]?_0x2ed005['attributes']:_0x3ff22d[_0x2412('0x33')];if(!_0x2e8f56[_0x2412('0x34')][_0x2412('0x3b')](_0x2412('0x3c'))){_0x2ed005[_0x2412('0x21')]=qs[_0x2412('0x21')](_0x2e8f56[_0x2412('0x34')]['limit']);_0x2ed005[_0x2412('0x1f')]=qs[_0x2412('0x1f')](_0x2e8f56[_0x2412('0x34')]['offset']);}_0x2ed005[_0x2412('0x3d')]=qs[_0x2412('0x3e')](_0x2e8f56[_0x2412('0x34')][_0x2412('0x3e')]);_0x2ed005['where']=qs[_0x2412('0x36')](_[_0x2412('0x3f')](_0x2e8f56[_0x2412('0x34')],_0x3ff22d[_0x2412('0x36')]),_0x5756eb);if(_0x2e8f56['query'][_0x2412('0x40')]){_0x2ed005[_0x2412('0x41')]=_[_0x2412('0x42')](_0x2ed005['where'],{'$or':_[_0x2412('0x2f')](_0x5756eb,function(_0xa24ba3){if(_0xa24ba3['type']!==_0x2412('0x43')){var _0x3959d5={};_0x3959d5[_0xa24ba3[_0x2412('0x2d')]]={'$like':'%'+_0x2e8f56[_0x2412('0x34')][_0x2412('0x40')]+'%'};return _0x3959d5;}})});}_0x2ed005=_[_0x2412('0x42')]({},_0x2ed005,_0x2e8f56['options']);var _0x312a05={'where':_0x2ed005['where']};return db[_0x2412('0x30')][_0x2412('0x22')](_0x312a05)[_0x2412('0x2a')](function(_0xf221d6){_0x374615[_0x2412('0x22')]=_0xf221d6;if(_0x2e8f56[_0x2412('0x34')][_0x2412('0x44')]){_0x2ed005[_0x2412('0x45')]=[{'all':!![]}];}return db[_0x2412('0x30')][_0x2412('0x46')](_0x2ed005);})[_0x2412('0x2a')](function(_0x535fc9){_0x374615[_0x2412('0x47')]=_0x535fc9;return _0x374615;})[_0x2412('0x2a')](respondWithFilteredResult(_0x1c7ea5,_0x2ed005))[_0x2412('0x48')](handleError(_0x1c7ea5,null));};exports['show']=function(_0x51edd6,_0x26599e){var _0x5af3dc={'raw':![],'where':{'id':_0x51edd6['params']['id']}},_0x3b724c={};_0x3b724c['model']=_[_0x2412('0x35')](db['VoiceQueueReport']['rawAttributes']);_0x3b724c[_0x2412('0x34')]=_[_0x2412('0x35')](_0x51edd6[_0x2412('0x34')]);_0x3b724c[_0x2412('0x36')]=_[_0x2412('0x37')](_0x3b724c[_0x2412('0x33')],_0x3b724c['query']);_0x5af3dc[_0x2412('0x38')]=_['intersection'](_0x3b724c[_0x2412('0x33')],qs[_0x2412('0x39')](_0x51edd6['query'][_0x2412('0x39')]));_0x5af3dc[_0x2412('0x38')]=_0x5af3dc['attributes'][_0x2412('0x3a')]?_0x5af3dc[_0x2412('0x38')]:_0x3b724c[_0x2412('0x33')];if(_0x51edd6[_0x2412('0x34')][_0x2412('0x44')]){_0x5af3dc[_0x2412('0x45')]=[{'all':!![]}];}_0x5af3dc=_[_0x2412('0x42')]({},_0x5af3dc,_0x51edd6[_0x2412('0x49')]);return db['VoiceQueueReport'][_0x2412('0x4a')](_0x5af3dc)[_0x2412('0x2a')](handleEntityNotFound(_0x26599e,null))[_0x2412('0x2a')](respondWithResult(_0x26599e,null))[_0x2412('0x48')](handleError(_0x26599e,null));};exports[_0x2412('0x4b')]=function(_0x852ea2,_0x305220){return db[_0x2412('0x30')][_0x2412('0x4b')](_0x852ea2[_0x2412('0x4c')],{})['then'](respondWithResult(_0x305220,0xc9))[_0x2412('0x48')](handleError(_0x305220,null));};exports[_0x2412('0x28')]=function(_0x59b04e,_0x11a48e){if(_0x59b04e[_0x2412('0x4c')]['id']){delete _0x59b04e[_0x2412('0x4c')]['id'];}return db[_0x2412('0x30')][_0x2412('0x4a')]({'where':{'id':_0x59b04e[_0x2412('0x4d')]['id']}})[_0x2412('0x2a')](handleEntityNotFound(_0x11a48e,null))['then'](saveUpdates(_0x59b04e[_0x2412('0x4c')],null))[_0x2412('0x2a')](respondWithResult(_0x11a48e,null))[_0x2412('0x48')](handleError(_0x11a48e,null));};exports['destroy']=function(_0x108bbf,_0x3a81f7){return db[_0x2412('0x30')][_0x2412('0x4a')]({'where':{'id':_0x108bbf['params']['id']}})['then'](handleEntityNotFound(_0x3a81f7,null))['then'](removeEntity(_0x3a81f7,null))['catch'](handleError(_0x3a81f7,null));};exports['describe']=function(_0x2cdeb3,_0x148e49){return db[_0x2412('0x30')][_0x2412('0x4e')]()[_0x2412('0x2a')](respondWithResult(_0x148e49,null))[_0x2412('0x48')](handleError(_0x148e49,null));};exports['getVoiceQueuesReport']=function(_0x25ba5b,_0xa24634){var _0x2b543a={},_0xf2ae73={},_0x23ff99={'count':0x0,'rows':[]};_0xf2ae73[_0x2412('0x33')]=_[_0x2412('0x35')](db[_0x2412('0x30')][_0x2412('0x4f')]);_0xf2ae73[_0x2412('0x34')]=_['keys'](_0x25ba5b[_0x2412('0x34')]);_0xf2ae73[_0x2412('0x36')]=_[_0x2412('0x37')](_0xf2ae73[_0x2412('0x33')],_0xf2ae73[_0x2412('0x34')]);_0x2b543a[_0x2412('0x38')]=_[_0x2412('0x37')](_0xf2ae73[_0x2412('0x33')],qs[_0x2412('0x39')](_0x25ba5b[_0x2412('0x34')][_0x2412('0x39')]));_0x2b543a[_0x2412('0x38')]=_0x2b543a[_0x2412('0x38')][_0x2412('0x3a')]?_0x2b543a[_0x2412('0x38')]:_0xf2ae73[_0x2412('0x33')];if(!_0x25ba5b['query'][_0x2412('0x3b')](_0x2412('0x3c'))){_0x2b543a[_0x2412('0x21')]=qs[_0x2412('0x21')](_0x25ba5b[_0x2412('0x34')][_0x2412('0x21')]);_0x2b543a[_0x2412('0x1f')]=qs[_0x2412('0x1f')](_0x25ba5b[_0x2412('0x34')][_0x2412('0x1f')]);}_0x2b543a[_0x2412('0x3d')]=qs[_0x2412('0x3e')](_0x25ba5b[_0x2412('0x34')][_0x2412('0x3e')]);_0x2b543a[_0x2412('0x41')]=qs[_0x2412('0x36')](_[_0x2412('0x3f')](_0x25ba5b[_0x2412('0x34')],_0xf2ae73[_0x2412('0x36')]));if(_0x25ba5b[_0x2412('0x34')]['filter']){_0x2b543a[_0x2412('0x41')]=_['merge'](_0x2b543a[_0x2412('0x41')],{'$or':_[_0x2412('0x2f')](_0x2b543a['attributes'],function(_0x1bbe7e){var _0x348a3c={};_0x348a3c[_0x1bbe7e]={'$like':'%'+_0x25ba5b[_0x2412('0x34')]['filter']+'%'};return _0x348a3c;})});}_0x2b543a=_[_0x2412('0x42')]({},_0x2b543a,_0x25ba5b[_0x2412('0x49')]);var _0x4f0f38={'where':_0x2b543a[_0x2412('0x41')]};return db['VoiceQueueReport']['count'](_0x4f0f38)[_0x2412('0x2a')](function(_0x7cf32b){_0x23ff99['count']=_0x7cf32b;if(_0x25ba5b[_0x2412('0x34')][_0x2412('0x44')]){_0x2b543a[_0x2412('0x45')]=[{'all':!![]}];}return db[_0x2412('0x30')][_0x2412('0x46')](_0x2b543a);})['then'](function(_0x566d58){_0x23ff99['rows']=_0x566d58;return _0x23ff99;})[_0x2412('0x2a')](respondWithFilteredResult(_0xa24634,_0x2b543a,'getVoiceQueuesReport'))[_0x2412('0x48')](handleError(_0xa24634,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e9e1cf9..be7ad08 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 _0x465f=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x465f,0x1e3));var _0xf465=function(_0xd562d6,_0x6c72ec){_0xd562d6=_0xd562d6-0x0;var _0x1b36be=_0x465f[_0xd562d6];return _0x1b36be;};'use strict';var EventEmitter=require(_0xf465('0x0'));var VoiceQueueReport=require(_0xf465('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf465('0x2')](0x0);var events={'afterCreate':_0xf465('0x3'),'afterUpdate':_0xf465('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1dad73){return function(_0x367a4a,_0x1ab571,_0x177e55){VoiceQueueReportEvents[_0xf465('0x5')](_0x1dad73+':'+_0x367a4a['id'],_0x367a4a);VoiceQueueReportEvents[_0xf465('0x5')](_0x1dad73,_0x367a4a);_0x177e55(null);};}for(var e in events){if(events[_0xf465('0x6')](e)){var event=events[e];VoiceQueueReport[_0xf465('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x3bff=['../../mysqldb','VoiceQueueReport','emit','hasOwnProperty','hook','exports','events'];(function(_0x349a33,_0xdeb5bd){var _0x1226fe=function(_0x585fcf){while(--_0x585fcf){_0x349a33['push'](_0x349a33['shift']());}};_0x1226fe(++_0xdeb5bd);}(_0x3bff,0x187));var _0xf3bf=function(_0x4935b1,_0x2c6114){_0x4935b1=_0x4935b1-0x0;var _0x3354c1=_0x3bff[_0x4935b1];return _0x3354c1;};'use strict';var EventEmitter=require(_0xf3bf('0x0'));var VoiceQueueReport=require(_0xf3bf('0x1'))['db'][_0xf3bf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55e545){return function(_0x2c658d,_0x83417,_0xf16ef9){VoiceQueueReportEvents[_0xf3bf('0x3')](_0x55e545+':'+_0x2c658d['id'],_0x2c658d);VoiceQueueReportEvents[_0xf3bf('0x3')](_0x55e545,_0x2c658d);_0xf16ef9(null);};}for(var e in events){if(events[_0xf3bf('0x4')](e)){var event=events[e];VoiceQueueReport[_0xf3bf('0x5')](e,emitEvent(event));}}module[_0xf3bf('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ee178f8..cc92072 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 _0x8962=['calleridnum','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x8962,0x1e2));var _0x2896=function(_0x19c0c5,_0x1e5de4){_0x19c0c5=_0x19c0c5-0x0;var _0x2ab557=_0x8962[_0x19c0c5];return _0x2ab557;};'use strict';var _=require('lodash');var util=require(_0x2896('0x0'));var logger=require(_0x2896('0x1'))(_0x2896('0x2'));var moment=require(_0x2896('0x3'));var BPromise=require('bluebird');var rp=require(_0x2896('0x4'));var fs=require('fs');var path=require(_0x2896('0x5'));var rimraf=require(_0x2896('0x6'));var config=require(_0x2896('0x7'));var attributes=require(_0x2896('0x8'));module[_0x2896('0x9')]=function(_0x59ca56,_0x2e052b){return _0x59ca56[_0x2896('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x2896('0xb')]},{'fields':[_0x2896('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3992=['bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3992,0x7b));var _0x2399=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3992[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x2399('0x0'));var util=require(_0x2399('0x1'));var logger=require(_0x2399('0x2'))(_0x2399('0x3'));var moment=require(_0x2399('0x4'));var BPromise=require(_0x2399('0x5'));var rp=require(_0x2399('0x6'));var fs=require('fs');var path=require(_0x2399('0x7'));var rimraf=require('rimraf');var config=require(_0x2399('0x8'));var attributes=require(_0x2399('0x9'));module[_0x2399('0xa')]=function(_0x41ce9d,_0x1204b7){return _0x41ce9d[_0x2399('0xb')](_0x2399('0xc'),attributes,{'tableName':_0x2399('0xd'),'paranoid':![],'indexes':[{'fields':[_0x2399('0xe')]},{'fields':[_0x2399('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 48183f3..7e9738d 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 _0x04df=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','stringify','update','UpdateVoiceQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f4074,_0x1441cb){var _0x30b009=function(_0x617d9b){while(--_0x617d9b){_0x1f4074['push'](_0x1f4074['shift']());}};_0x30b009(++_0x1441cb);}(_0x04df,0x133));var _0xf04d=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x04df[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0xf04d('0x0'));var util=require(_0xf04d('0x1'));var moment=require(_0xf04d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf04d('0x3'));var db=require(_0xf04d('0x4'))['db'];var utils=require(_0xf04d('0x5'));var logger=require(_0xf04d('0x6'))(_0xf04d('0x7'));var config=require(_0xf04d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf04d('0x9')][_0xf04d('0xa')]({'port':0x232a});config[_0xf04d('0xb')]=_[_0xf04d('0xc')](config[_0xf04d('0xb')],{'host':_0xf04d('0xd'),'port':0x18eb});var socket=require(_0xf04d('0xe'))(new Redis(config[_0xf04d('0xb')]));require(_0xf04d('0xf'))[_0xf04d('0x10')](socket);function respondWithRpcPromise(_0x3de58a,_0x53ecdf,_0x5ae266){return new BPromise(function(_0x1fd361,_0x3bd5eb){return client[_0xf04d('0x11')](_0x3de58a,_0x5ae266)[_0xf04d('0x12')](function(_0x57cbdd){logger[_0xf04d('0x13')](_0xf04d('0x14'),_0x53ecdf,_0xf04d('0x15'));logger[_0xf04d('0x16')](_0xf04d('0x17'),_0x53ecdf,_0xf04d('0x15'),JSON['stringify'](_0x57cbdd));if(_0x57cbdd['error']){if(_0x57cbdd[_0xf04d('0x18')][_0xf04d('0x19')]===0x1f4){logger[_0xf04d('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x53ecdf,_0x57cbdd[_0xf04d('0x18')][_0xf04d('0x1a')]);return _0x3bd5eb(_0x57cbdd[_0xf04d('0x18')][_0xf04d('0x1a')]);}logger['error'](_0xf04d('0x14'),_0x53ecdf,_0x57cbdd[_0xf04d('0x18')]['message']);return _0x1fd361(_0x57cbdd[_0xf04d('0x18')][_0xf04d('0x1a')]);}else{logger[_0xf04d('0x13')](_0xf04d('0x14'),_0x53ecdf,_0xf04d('0x15'));_0x1fd361(_0x57cbdd[_0xf04d('0x1b')][_0xf04d('0x1a')]);}})[_0xf04d('0x1c')](function(_0xcfc42e){logger[_0xf04d('0x18')](_0xf04d('0x14'),_0x53ecdf,_0xcfc42e);_0x3bd5eb(_0xcfc42e);});});}exports[_0xf04d('0x1d')]=function(_0x2ce69c){var _0x36e5d4=this;return new Promise(function(_0x43375b,_0x1cf23d){return db[_0xf04d('0x1e')][_0xf04d('0x1f')]({'raw':_0x2ce69c[_0xf04d('0x20')]?_0x2ce69c[_0xf04d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2ce69c['options']?_0x2ce69c['options'][_0xf04d('0x21')]||null:null,'attributes':_0x2ce69c[_0xf04d('0x20')]?_0x2ce69c['options'][_0xf04d('0x22')]||null:null,'limit':_0x2ce69c[_0xf04d('0x20')]?_0x2ce69c[_0xf04d('0x20')][_0xf04d('0x23')]||null:null,'include':_0x2ce69c['options']?_0x2ce69c[_0xf04d('0x20')][_0xf04d('0x24')]?_[_0xf04d('0x25')](_0x2ce69c[_0xf04d('0x20')][_0xf04d('0x24')],function(_0x48cb2d){return{'model':db[_0x48cb2d[_0xf04d('0x26')]],'as':_0x48cb2d['as'],'attributes':_0x48cb2d[_0xf04d('0x22')],'include':_0x48cb2d[_0xf04d('0x24')]?_[_0xf04d('0x25')](_0x48cb2d['include'],function(_0x469981){return{'model':db[_0x469981['model']],'as':_0x469981['as'],'attributes':_0x469981['attributes'],'include':_0x469981[_0xf04d('0x24')]?_['map'](_0x469981['include'],function(_0x5883e0){return{'model':db[_0x5883e0['model']],'as':_0x5883e0['as'],'attributes':_0x5883e0[_0xf04d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf04d('0x12')](function(_0x1a2987){logger[_0xf04d('0x13')](_0xf04d('0x1d'),_0x2ce69c);logger[_0xf04d('0x16')](_0xf04d('0x1d'),_0x2ce69c,JSON['stringify'](_0x1a2987));_0x43375b(_0x1a2987);})['catch'](function(_0x2b1c64){logger[_0xf04d('0x18')]('GetVoiceQueueReport',_0x2b1c64[_0xf04d('0x1a')],_0x2ce69c);_0x1cf23d(_0x36e5d4[_0xf04d('0x18')](0x1f4,_0x2b1c64[_0xf04d('0x1a')]));});});};exports[_0xf04d('0x27')]=function(_0x5e0875){var _0x18b785=this;return new Promise(function(_0x413f22,_0x2335a9){return db['VoiceQueueReport'][_0xf04d('0x28')](_0x5e0875[_0xf04d('0x29')],{'raw':_0x5e0875['options']?_0x5e0875['options']['raw']===undefined?!![]:![]:!![]})[_0xf04d('0x12')](function(_0xa42966){logger['info'](_0xf04d('0x27'),_0x5e0875);logger[_0xf04d('0x16')](_0xf04d('0x27'),_0x5e0875,JSON[_0xf04d('0x2a')](_0xa42966));_0x413f22(_0xa42966);})['catch'](function(_0x529f81){logger[_0xf04d('0x18')](_0xf04d('0x27'),_0x529f81[_0xf04d('0x1a')],_0x5e0875);_0x2335a9(_0x18b785[_0xf04d('0x18')](0x1f4,_0x529f81['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x222879){var _0x5ad692=this;return new Promise(function(_0x1f0cda,_0x9dee9){return db[_0xf04d('0x1e')][_0xf04d('0x2b')](_0x222879[_0xf04d('0x29')],{'raw':_0x222879[_0xf04d('0x20')]?_0x222879[_0xf04d('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222879['options']?_0x222879['options'][_0xf04d('0x21')]||null:null,'attributes':_0x222879[_0xf04d('0x20')]?_0x222879['options']['attributes']||null:null,'limit':_0x222879[_0xf04d('0x20')]?_0x222879[_0xf04d('0x20')]['limit']||null:null})['then'](function(_0x4dfa7e){logger['info']('UpdateVoiceQueueReport',_0x222879);logger[_0xf04d('0x16')](_0xf04d('0x2c'),_0x222879,JSON['stringify'](_0x4dfa7e));_0x1f0cda(_0x4dfa7e);})['catch'](function(_0x408d38){logger[_0xf04d('0x18')](_0xf04d('0x2c'),_0x408d38[_0xf04d('0x1a')],_0x222879);_0x9dee9(_0x5ad692[_0xf04d('0x18')](0x1f4,_0x408d38[_0xf04d('0x1a')]));});});}; \ No newline at end of file +var _0x754c=['include','map','model','debug','CreateVoiceQueueReport','create','then','UpdateVoiceQueueReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit'];(function(_0xc7c7d3,_0x4f453b){var _0x171c14=function(_0xde2e9f){while(--_0xde2e9f){_0xc7c7d3['push'](_0xc7c7d3['shift']());}};_0x171c14(++_0x4f453b);}(_0x754c,0x196));var _0xc754=function(_0xe3d27e,_0x474186){_0xe3d27e=_0xe3d27e-0x0;var _0x4daee4=_0x754c[_0xe3d27e];return _0x4daee4;};'use strict';var _=require(_0xc754('0x0'));var util=require(_0xc754('0x1'));var moment=require('moment');var BPromise=require(_0xc754('0x2'));var rs=require(_0xc754('0x3'));var fs=require('fs');var Redis=require(_0xc754('0x4'));var db=require(_0xc754('0x5'))['db'];var utils=require(_0xc754('0x6'));var logger=require('../../config/logger')(_0xc754('0x7'));var config=require('../../config/environment');var jayson=require(_0xc754('0x8'));var client=jayson[_0xc754('0x9')]['http']({'port':0x232a});config[_0xc754('0xa')]=_[_0xc754('0xb')](config[_0xc754('0xa')],{'host':_0xc754('0xc'),'port':0x18eb});var socket=require(_0xc754('0xd'))(new Redis(config[_0xc754('0xa')]));require('./voiceQueueReport.socket')[_0xc754('0xe')](socket);function respondWithRpcPromise(_0x26f4cb,_0x507781,_0x373c49){return new BPromise(function(_0x2c255a,_0x47e678){return client[_0xc754('0xf')](_0x26f4cb,_0x373c49)['then'](function(_0x4105d5){logger[_0xc754('0x10')](_0xc754('0x11'),_0x507781,_0xc754('0x12'));logger['debug'](_0xc754('0x13'),_0x507781,_0xc754('0x12'),JSON[_0xc754('0x14')](_0x4105d5));if(_0x4105d5[_0xc754('0x15')]){if(_0x4105d5[_0xc754('0x15')][_0xc754('0x16')]===0x1f4){logger[_0xc754('0x15')](_0xc754('0x11'),_0x507781,_0x4105d5[_0xc754('0x15')][_0xc754('0x17')]);return _0x47e678(_0x4105d5[_0xc754('0x15')]['message']);}logger[_0xc754('0x15')](_0xc754('0x11'),_0x507781,_0x4105d5[_0xc754('0x15')]['message']);return _0x2c255a(_0x4105d5[_0xc754('0x15')][_0xc754('0x17')]);}else{logger[_0xc754('0x10')](_0xc754('0x11'),_0x507781,_0xc754('0x12'));_0x2c255a(_0x4105d5[_0xc754('0x18')][_0xc754('0x17')]);}})[_0xc754('0x19')](function(_0x4fe00e){logger[_0xc754('0x15')](_0xc754('0x11'),_0x507781,_0x4fe00e);_0x47e678(_0x4fe00e);});});}exports[_0xc754('0x1a')]=function(_0x4b8877){var _0x1e2877=this;return new Promise(function(_0x4363c7,_0x4a7717){return db[_0xc754('0x1b')][_0xc754('0x1c')]({'raw':_0x4b8877[_0xc754('0x1d')]?_0x4b8877[_0xc754('0x1d')][_0xc754('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b8877[_0xc754('0x1d')]?_0x4b8877[_0xc754('0x1d')][_0xc754('0x1f')]||null:null,'attributes':_0x4b8877[_0xc754('0x1d')]?_0x4b8877[_0xc754('0x1d')][_0xc754('0x20')]||null:null,'limit':_0x4b8877['options']?_0x4b8877['options'][_0xc754('0x21')]||null:null,'include':_0x4b8877['options']?_0x4b8877[_0xc754('0x1d')][_0xc754('0x22')]?_[_0xc754('0x23')](_0x4b8877[_0xc754('0x1d')][_0xc754('0x22')],function(_0x352f74){return{'model':db[_0x352f74['model']],'as':_0x352f74['as'],'attributes':_0x352f74[_0xc754('0x20')],'include':_0x352f74[_0xc754('0x22')]?_[_0xc754('0x23')](_0x352f74['include'],function(_0x26299d){return{'model':db[_0x26299d['model']],'as':_0x26299d['as'],'attributes':_0x26299d[_0xc754('0x20')],'include':_0x26299d[_0xc754('0x22')]?_[_0xc754('0x23')](_0x26299d['include'],function(_0x417d17){return{'model':db[_0x417d17[_0xc754('0x24')]],'as':_0x417d17['as'],'attributes':_0x417d17[_0xc754('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4691ef){logger[_0xc754('0x10')](_0xc754('0x1a'),_0x4b8877);logger[_0xc754('0x25')](_0xc754('0x1a'),_0x4b8877,JSON[_0xc754('0x14')](_0x4691ef));_0x4363c7(_0x4691ef);})['catch'](function(_0x45fe7b){logger[_0xc754('0x15')]('GetVoiceQueueReport',_0x45fe7b[_0xc754('0x17')],_0x4b8877);_0x4a7717(_0x1e2877[_0xc754('0x15')](0x1f4,_0x45fe7b[_0xc754('0x17')]));});});};exports[_0xc754('0x26')]=function(_0x2cb697){var _0x1e0818=this;return new Promise(function(_0x4b64fd,_0x7ef7c0){return db[_0xc754('0x1b')][_0xc754('0x27')](_0x2cb697['body'],{'raw':_0x2cb697[_0xc754('0x1d')]?_0x2cb697[_0xc754('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xc754('0x28')](function(_0x44ab81){logger[_0xc754('0x10')](_0xc754('0x26'),_0x2cb697);logger[_0xc754('0x25')]('CreateVoiceQueueReport',_0x2cb697,JSON['stringify'](_0x44ab81));_0x4b64fd(_0x44ab81);})[_0xc754('0x19')](function(_0x1b7f26){logger['error'](_0xc754('0x26'),_0x1b7f26[_0xc754('0x17')],_0x2cb697);_0x7ef7c0(_0x1e0818['error'](0x1f4,_0x1b7f26[_0xc754('0x17')]));});});};exports[_0xc754('0x29')]=function(_0x24456a){var _0x316ad7=this;return new Promise(function(_0x551ffc,_0x20c5a0){return db[_0xc754('0x1b')][_0xc754('0x2a')](_0x24456a[_0xc754('0x2b')],{'raw':_0x24456a[_0xc754('0x1d')]?_0x24456a['options'][_0xc754('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24456a[_0xc754('0x1d')]?_0x24456a[_0xc754('0x1d')]['where']||null:null,'attributes':_0x24456a[_0xc754('0x1d')]?_0x24456a['options'][_0xc754('0x20')]||null:null,'limit':_0x24456a[_0xc754('0x1d')]?_0x24456a['options'][_0xc754('0x21')]||null:null})[_0xc754('0x28')](function(_0x3f6871){logger[_0xc754('0x10')](_0xc754('0x29'),_0x24456a);logger[_0xc754('0x25')](_0xc754('0x29'),_0x24456a,JSON[_0xc754('0x14')](_0x3f6871));_0x551ffc(_0x3f6871);})['catch'](function(_0x3e36cd){logger[_0xc754('0x15')](_0xc754('0x29'),_0x3e36cd['message'],_0x24456a);_0x20c5a0(_0x316ad7[_0xc754('0x15')](0x1f4,_0x3e36cd[_0xc754('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 28e17c0..8d78b1e 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 _0x14d8=['./voiceQueueReport.events','save','update','emit','register','length','voiceQueueReport:'];(function(_0x326f34,_0x15a0f0){var _0x5dfc1e=function(_0x4cee3e){while(--_0x4cee3e){_0x326f34['push'](_0x326f34['shift']());}};_0x5dfc1e(++_0x15a0f0);}(_0x14d8,0x19d));var _0x814d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x14d8[_0x465028];return _0xb783d4;};'use strict';var VoiceQueueReportEvents=require(_0x814d('0x0'));var events=[_0x814d('0x1'),'remove',_0x814d('0x2')];function createListener(_0x4e8753,_0xfff5ac){return function(_0x43d8df){_0xfff5ac[_0x814d('0x3')](_0x4e8753,_0x43d8df);};}function removeListener(_0x3e07cd,_0x18917c){return function(){VoiceQueueReportEvents['removeListener'](_0x3e07cd,_0x18917c);};}exports[_0x814d('0x4')]=function(_0x2e1be8){for(var _0x1268c9=0x0,_0x214b1b=events[_0x814d('0x5')];_0x1268c9<_0x214b1b;_0x1268c9++){var _0x3e40f3=events[_0x1268c9];var _0x434320=createListener(_0x814d('0x6')+_0x3e40f3,_0x2e1be8);VoiceQueueReportEvents['on'](_0x3e40f3,_0x434320);}}; \ No newline at end of file +var _0x28e3=['remove','update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0xf396fe,_0xed31fb){var _0x14d2dd=function(_0x10d2d5){while(--_0x10d2d5){_0xf396fe['push'](_0xf396fe['shift']());}};_0x14d2dd(++_0xed31fb);}(_0x28e3,0x106));var _0x328e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x28e3[_0x422905];return _0x33dc6c;};'use strict';var VoiceQueueReportEvents=require(_0x328e('0x0'));var events=[_0x328e('0x1'),_0x328e('0x2'),_0x328e('0x3')];function createListener(_0x499442,_0x5f1520){return function(_0x392b85){_0x5f1520[_0x328e('0x4')](_0x499442,_0x392b85);};}function removeListener(_0x168893,_0x8cdc14){return function(){VoiceQueueReportEvents[_0x328e('0x5')](_0x168893,_0x8cdc14);};}exports[_0x328e('0x6')]=function(_0x439182){for(var _0x5e5bcf=0x0,_0x4b5c91=events['length'];_0x5e5bcf<_0x4b5c91;_0x5e5bcf++){var _0x2bddaa=events[_0x5e5bcf];var _0x3696b6=createListener(_0x328e('0x7')+_0x2bddaa,_0x439182);VoiceQueueReportEvents['on'](_0x2bddaa,_0x3696b6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c290e69..dba0eb0 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 _0x65a6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x2e4145,_0x490264){var _0x470893=function(_0x30e099){while(--_0x30e099){_0x2e4145['push'](_0x2e4145['shift']());}};_0x470893(++_0x490264);}(_0x65a6,0x19e));var _0x665a=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x65a6[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0x665a('0x0'));var util=require(_0x665a('0x1'));var path=require('path');var timeout=require(_0x665a('0x2'));var express=require('express');var router=express[_0x665a('0x3')]();var fs_extra=require(_0x665a('0x4'));var auth=require(_0x665a('0x5'));var interaction=require(_0x665a('0x6'));var config=require(_0x665a('0x7'));var controller=require(_0x665a('0x8'));router[_0x665a('0x9')]('/',auth[_0x665a('0xa')](),controller[_0x665a('0xb')]);router[_0x665a('0x9')](_0x665a('0xc'),auth[_0x665a('0xa')](),controller[_0x665a('0xd')]);router[_0x665a('0xe')]('/',auth[_0x665a('0xa')](),controller['create']);router[_0x665a('0xf')](_0x665a('0xc'),auth[_0x665a('0xa')](),controller[_0x665a('0x10')]);router['delete'](_0x665a('0xc'),auth[_0x665a('0xa')](),controller[_0x665a('0x11')]);module[_0x665a('0x12')]=router; \ No newline at end of file +var _0x3402=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x23d7ad,_0x4e7a26){var _0xa7bfb3=function(_0x33edd4){while(--_0x33edd4){_0x23d7ad['push'](_0x23d7ad['shift']());}};_0xa7bfb3(++_0x4e7a26);}(_0x3402,0x1f0));var _0x2340=function(_0x7c6fe3,_0x188961){_0x7c6fe3=_0x7c6fe3-0x0;var _0x974db9=_0x3402[_0x7c6fe3];return _0x974db9;};'use strict';var multer=require(_0x2340('0x0'));var util=require('util');var path=require(_0x2340('0x1'));var timeout=require(_0x2340('0x2'));var express=require(_0x2340('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2340('0x4'));var interaction=require(_0x2340('0x5'));var config=require(_0x2340('0x6'));var controller=require(_0x2340('0x7'));router[_0x2340('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2340('0x8')](_0x2340('0x9'),auth[_0x2340('0xa')](),controller[_0x2340('0xb')]);router[_0x2340('0xc')]('/',auth['isAuthenticated'](),controller[_0x2340('0xd')]);router[_0x2340('0xe')](_0x2340('0x9'),auth[_0x2340('0xa')](),controller[_0x2340('0xf')]);router['delete'](_0x2340('0x9'),auth[_0x2340('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 4b84374..83666cf 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 _0xcc8c=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x535dcd,_0x209c52){var _0x4d42d6=function(_0x8c19d5){while(--_0x8c19d5){_0x535dcd['push'](_0x535dcd['shift']());}};_0x4d42d6(++_0x209c52);}(_0xcc8c,0x136));var _0xccc8=function(_0x45598f,_0x1649ec){_0x45598f=_0x45598f-0x0;var _0x517e2b=_0xcc8c[_0x45598f];return _0x517e2b;};'use strict';var Sequelize=require(_0xccc8('0x0'));var moment=require(_0xccc8('0x1'));module['exports']={'time':{'type':Sequelize[_0xccc8('0x2')]},'callid':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xccc8('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xccc8('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xccc8('0x4')](_0xccc8('0x5'))}}; \ No newline at end of file +var _0xe5af=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x84fa15,_0x22947b){var _0x34e652=function(_0x5367d2){while(--_0x5367d2){_0x84fa15['push'](_0x84fa15['shift']());}};_0x34e652(++_0x22947b);}(_0xe5af,0x1c0));var _0xfe5a=function(_0x3ff54f,_0x1877ad){_0x3ff54f=_0x3ff54f-0x0;var _0x29ae7e=_0xe5af[_0x3ff54f];return _0x29ae7e;};'use strict';var Sequelize=require(_0xfe5a('0x0'));var moment=require('moment');module[_0xfe5a('0x1')]={'time':{'type':Sequelize[_0xfe5a('0x2')]},'callid':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfe5a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfe5a('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xfe5a('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 28c040f..80c0023 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 _0x359f=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','sendStatus','stack','send','index','VoiceQueuesLog','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','fields','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x359f,0xf0));var _0xf359=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x359f[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xf359('0x0'));var rimraf=require(_0xf359('0x1'));var zipdir=require(_0xf359('0x2'));var jsonpatch=require(_0xf359('0x3'));var rp=require(_0xf359('0x4'));var moment=require('moment');var BPromise=require(_0xf359('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf359('0x6'));var sox=require('sox');var csv=require(_0xf359('0x7'));var ejs=require(_0xf359('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf359('0x9'));var crypto=require(_0xf359('0xa'));var jsforce=require(_0xf359('0xb'));var deskjs=require(_0xf359('0xc'));var toCsv=require(_0xf359('0x7'));var querystring=require(_0xf359('0xd'));var Papa=require(_0xf359('0xe'));var Redis=require(_0xf359('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf359('0x10'));var as=require(_0xf359('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf359('0x12'))(_0xf359('0x13'));var utils=require('../../config/utils');var config=require(_0xf359('0x14'));var licenseUtil=require(_0xf359('0x15'));var db=require(_0xf359('0x16'))['db'];function respondWithStatusCode(_0x1552e6,_0x3916fd){_0x3916fd=_0x3916fd||0xcc;return function(_0x392503){if(_0x392503){return _0x1552e6['sendStatus'](_0x3916fd);}return _0x1552e6[_0xf359('0x17')](_0x3916fd)[_0xf359('0x18')]();};}function respondWithResult(_0x1c1691,_0x3beb70){_0x3beb70=_0x3beb70||0xc8;return function(_0xfd2e02){if(_0xfd2e02){return _0x1c1691[_0xf359('0x17')](_0x3beb70)[_0xf359('0x19')](_0xfd2e02);}};}function respondWithFilteredResult(_0x15a215,_0x5d37a1){return function(_0xc33a77){if(_0xc33a77){var _0xf0c48d=typeof _0x5d37a1['offset']===_0xf359('0x1a')&&typeof _0x5d37a1[_0xf359('0x1b')]==='undefined';var _0x36b990=_0xc33a77[_0xf359('0x1c')];var _0x17be0a=_0xf0c48d?0x0:_0x5d37a1[_0xf359('0x1d')];var _0x2b4eb6=_0xf0c48d?_0xc33a77[_0xf359('0x1c')]:_0x5d37a1[_0xf359('0x1d')]+_0x5d37a1['limit'];var _0x12aef4;if(_0x2b4eb6>=_0x36b990){_0x2b4eb6=_0x36b990;_0x12aef4=0xc8;}else{_0x12aef4=0xce;}_0x15a215[_0xf359('0x17')](_0x12aef4);return _0x15a215[_0xf359('0x1e')](_0xf359('0x1f'),_0x17be0a+'-'+_0x2b4eb6+'/'+_0x36b990)[_0xf359('0x19')](_0xc33a77);}return null;};}function patchUpdates(_0x21bf51){return function(_0x4d6997){try{jsonpatch['apply'](_0x4d6997,_0x21bf51,!![]);}catch(_0x5d4ea2){return BPromise['reject'](_0x5d4ea2);}return _0x4d6997[_0xf359('0x20')]();};}function saveUpdates(_0x18ad87,_0x478b4f){return function(_0x2f0ef8){if(_0x2f0ef8){return _0x2f0ef8[_0xf359('0x21')](_0x18ad87)[_0xf359('0x22')](function(_0x4f2178){return _0x4f2178;});}return null;};}function removeEntity(_0x5eba3c,_0x58947a){return function(_0x5be8c0){if(_0x5be8c0){return _0x5be8c0['destroy']()[_0xf359('0x22')](function(){_0x5eba3c[_0xf359('0x17')](0xcc)[_0xf359('0x18')]();});}};}function handleEntityNotFound(_0x34e706,_0x352de4){return function(_0x44d117){if(!_0x44d117){_0x34e706[_0xf359('0x23')](0x194);}return _0x44d117;};}function handleError(_0x1c28f6,_0x54d8be){_0x54d8be=_0x54d8be||0x1f4;return function(_0x1185ce){logger['error'](_0x1185ce[_0xf359('0x24')]);if(_0x1185ce['name']){delete _0x1185ce['name'];}_0x1c28f6[_0xf359('0x17')](_0x54d8be)[_0xf359('0x25')](_0x1185ce);};}exports[_0xf359('0x26')]=function(_0x90678f,_0x2f428d){var _0x1fd6e0={},_0x4ad118={},_0x51fa54={'count':0x0,'rows':[]};var _0x14cf8c=_['map'](db[_0xf359('0x27')][_0xf359('0x28')],function(_0x5e3665){return{'name':_0x5e3665['fieldName'],'type':_0x5e3665[_0xf359('0x29')][_0xf359('0x2a')]};});_0x4ad118[_0xf359('0x2b')]=_[_0xf359('0x2c')](_0x14cf8c,_0xf359('0x2d'));_0x4ad118[_0xf359('0x2e')]=_[_0xf359('0x2f')](_0x90678f[_0xf359('0x2e')]);_0x4ad118[_0xf359('0x30')]=_[_0xf359('0x31')](_0x4ad118[_0xf359('0x2b')],_0x4ad118[_0xf359('0x2e')]);_0x1fd6e0['attributes']=_[_0xf359('0x31')](_0x4ad118['model'],qs[_0xf359('0x32')](_0x90678f[_0xf359('0x2e')][_0xf359('0x32')]));_0x1fd6e0['attributes']=_0x1fd6e0[_0xf359('0x33')]['length']?_0x1fd6e0['attributes']:_0x4ad118[_0xf359('0x2b')];if(!_0x90678f['query'][_0xf359('0x34')](_0xf359('0x35'))){_0x1fd6e0[_0xf359('0x1b')]=qs['limit'](_0x90678f[_0xf359('0x2e')][_0xf359('0x1b')]);_0x1fd6e0[_0xf359('0x1d')]=qs['offset'](_0x90678f['query']['offset']);}_0x1fd6e0[_0xf359('0x36')]=qs[_0xf359('0x37')](_0x90678f[_0xf359('0x2e')][_0xf359('0x37')]);_0x1fd6e0[_0xf359('0x38')]=qs[_0xf359('0x30')](_[_0xf359('0x39')](_0x90678f[_0xf359('0x2e')],_0x4ad118['filters']),_0x14cf8c);if(_0x90678f[_0xf359('0x2e')][_0xf359('0x3a')]){_0x1fd6e0[_0xf359('0x38')]=_[_0xf359('0x3b')](_0x1fd6e0[_0xf359('0x38')],{'$or':_['map'](_0x14cf8c,function(_0x17327d){if(_0x17327d[_0xf359('0x29')]!==_0xf359('0x3c')){var _0x510f8d={};_0x510f8d[_0x17327d[_0xf359('0x2d')]]={'$like':'%'+_0x90678f[_0xf359('0x2e')][_0xf359('0x3a')]+'%'};return _0x510f8d;}})});}_0x1fd6e0=_['merge']({},_0x1fd6e0,_0x90678f[_0xf359('0x3d')]);var _0x1685d1={'where':_0x1fd6e0[_0xf359('0x38')]};return db['VoiceQueuesLog'][_0xf359('0x1c')](_0x1685d1)[_0xf359('0x22')](function(_0x2f7cec){_0x51fa54[_0xf359('0x1c')]=_0x2f7cec;if(_0x90678f['query'][_0xf359('0x3e')]){_0x1fd6e0['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf359('0x3f')](_0x1fd6e0);})['then'](function(_0x342989){_0x51fa54[_0xf359('0x40')]=_0x342989;return _0x51fa54;})['then'](respondWithFilteredResult(_0x2f428d,_0x1fd6e0))[_0xf359('0x41')](handleError(_0x2f428d,null));};exports['show']=function(_0xe2480b,_0x102509){var _0x5d8d7c={'raw':!![],'where':{'id':_0xe2480b[_0xf359('0x42')]['id']}},_0x258a75={};_0x258a75[_0xf359('0x2b')]=_[_0xf359('0x2f')](db[_0xf359('0x27')][_0xf359('0x28')]);_0x258a75[_0xf359('0x2e')]=_[_0xf359('0x2f')](_0xe2480b['query']);_0x258a75['filters']=_[_0xf359('0x31')](_0x258a75[_0xf359('0x2b')],_0x258a75['query']);_0x5d8d7c[_0xf359('0x33')]=_[_0xf359('0x31')](_0x258a75['model'],qs[_0xf359('0x32')](_0xe2480b[_0xf359('0x2e')][_0xf359('0x32')]));_0x5d8d7c[_0xf359('0x33')]=_0x5d8d7c['attributes'][_0xf359('0x43')]?_0x5d8d7c[_0xf359('0x33')]:_0x258a75[_0xf359('0x2b')];if(_0xe2480b[_0xf359('0x2e')][_0xf359('0x3e')]){_0x5d8d7c[_0xf359('0x44')]=[{'all':!![]}];}_0x5d8d7c=_[_0xf359('0x3b')]({},_0x5d8d7c,_0xe2480b['options']);return db[_0xf359('0x27')][_0xf359('0x45')](_0x5d8d7c)[_0xf359('0x22')](handleEntityNotFound(_0x102509,null))[_0xf359('0x22')](respondWithResult(_0x102509,null))['catch'](handleError(_0x102509,null));};exports[_0xf359('0x46')]=function(_0x1673e2,_0x5842b8){return db[_0xf359('0x27')][_0xf359('0x46')](_0x1673e2[_0xf359('0x47')],{})[_0xf359('0x22')](respondWithResult(_0x5842b8,0xc9))['catch'](handleError(_0x5842b8,null));};exports[_0xf359('0x21')]=function(_0x2095c3,_0x30957a){if(_0x2095c3[_0xf359('0x47')]['id']){delete _0x2095c3[_0xf359('0x47')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x2095c3['params']['id']}})[_0xf359('0x22')](handleEntityNotFound(_0x30957a,null))[_0xf359('0x22')](saveUpdates(_0x2095c3['body'],null))[_0xf359('0x22')](respondWithResult(_0x30957a,null))[_0xf359('0x41')](handleError(_0x30957a,null));};exports[_0xf359('0x48')]=function(_0x1300b0,_0x2adc40){return db[_0xf359('0x27')][_0xf359('0x45')]({'where':{'id':_0x1300b0['params']['id']}})[_0xf359('0x22')](handleEntityNotFound(_0x2adc40,null))['then'](removeEntity(_0x2adc40,null))[_0xf359('0x41')](handleError(_0x2adc40,null));}; \ No newline at end of file +var _0x85d6=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model'];(function(_0x19d4c7,_0x5357a6){var _0x814d48=function(_0x25d139){while(--_0x25d139){_0x19d4c7['push'](_0x19d4c7['shift']());}};_0x814d48(++_0x5357a6);}(_0x85d6,0x1d7));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x685d('0x0'));var rimraf=require(_0x685d('0x1'));var zipdir=require(_0x685d('0x2'));var jsonpatch=require(_0x685d('0x3'));var rp=require(_0x685d('0x4'));var moment=require(_0x685d('0x5'));var BPromise=require(_0x685d('0x6'));var Mustache=require(_0x685d('0x7'));var util=require('util');var path=require(_0x685d('0x8'));var sox=require(_0x685d('0x9'));var csv=require(_0x685d('0xa'));var ejs=require(_0x685d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x685d('0xc'));var crypto=require('crypto');var jsforce=require(_0x685d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x685d('0xa'));var querystring=require('querystring');var Papa=require(_0x685d('0xe'));var Redis=require('ioredis');var authService=require(_0x685d('0xf'));var qs=require(_0x685d('0x10'));var as=require(_0x685d('0x11'));var hardwareService=require(_0x685d('0x12'));var logger=require(_0x685d('0x13'))(_0x685d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dc675,_0x539ed1){_0x539ed1=_0x539ed1||0xcc;return function(_0x51bfd2){if(_0x51bfd2){return _0x4dc675[_0x685d('0x15')](_0x539ed1);}return _0x4dc675['status'](_0x539ed1)[_0x685d('0x16')]();};}function respondWithResult(_0x59322d,_0x346542){_0x346542=_0x346542||0xc8;return function(_0x4288dc){if(_0x4288dc){return _0x59322d[_0x685d('0x17')](_0x346542)[_0x685d('0x18')](_0x4288dc);}};}function respondWithFilteredResult(_0x386f03,_0xe14d43){return function(_0x323742){if(_0x323742){var _0x55c021=typeof _0xe14d43[_0x685d('0x19')]===_0x685d('0x1a')&&typeof _0xe14d43['limit']===_0x685d('0x1a');var _0x17f354=_0x323742[_0x685d('0x1b')];var _0xeac0c1=_0x55c021?0x0:_0xe14d43[_0x685d('0x19')];var _0x3cd3ab=_0x55c021?_0x323742[_0x685d('0x1b')]:_0xe14d43[_0x685d('0x19')]+_0xe14d43[_0x685d('0x1c')];var _0x5aac25;if(_0x3cd3ab>=_0x17f354){_0x3cd3ab=_0x17f354;_0x5aac25=0xc8;}else{_0x5aac25=0xce;}_0x386f03[_0x685d('0x17')](_0x5aac25);return _0x386f03[_0x685d('0x1d')](_0x685d('0x1e'),_0xeac0c1+'-'+_0x3cd3ab+'/'+_0x17f354)[_0x685d('0x18')](_0x323742);}return null;};}function patchUpdates(_0x3fd6ef){return function(_0x581765){try{jsonpatch[_0x685d('0x1f')](_0x581765,_0x3fd6ef,!![]);}catch(_0x37d8ed){return BPromise[_0x685d('0x20')](_0x37d8ed);}return _0x581765[_0x685d('0x21')]();};}function saveUpdates(_0x12734c,_0x6b08da){return function(_0x1978c7){if(_0x1978c7){return _0x1978c7[_0x685d('0x22')](_0x12734c)['then'](function(_0x41d6f8){return _0x41d6f8;});}return null;};}function removeEntity(_0x335f5c,_0x38d972){return function(_0x372a0b){if(_0x372a0b){return _0x372a0b[_0x685d('0x23')]()[_0x685d('0x24')](function(){_0x335f5c[_0x685d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38438a,_0x47cc48){return function(_0x44017f){if(!_0x44017f){_0x38438a[_0x685d('0x15')](0x194);}return _0x44017f;};}function handleError(_0x5ddc39,_0x4e4b29){_0x4e4b29=_0x4e4b29||0x1f4;return function(_0x25ae31){logger[_0x685d('0x25')](_0x25ae31['stack']);if(_0x25ae31[_0x685d('0x26')]){delete _0x25ae31[_0x685d('0x26')];}_0x5ddc39[_0x685d('0x17')](_0x4e4b29)['send'](_0x25ae31);};}exports[_0x685d('0x27')]=function(_0x1f8ca7,_0x2b17e1){var _0x4a42b3={},_0x3b9877={},_0x43f554={'count':0x0,'rows':[]};var _0x44d936=_[_0x685d('0x28')](db[_0x685d('0x29')][_0x685d('0x2a')],function(_0x3ae7b6){return{'name':_0x3ae7b6[_0x685d('0x2b')],'type':_0x3ae7b6[_0x685d('0x2c')][_0x685d('0x2d')]};});_0x3b9877[_0x685d('0x2e')]=_[_0x685d('0x28')](_0x44d936,_0x685d('0x26'));_0x3b9877[_0x685d('0x2f')]=_[_0x685d('0x30')](_0x1f8ca7[_0x685d('0x2f')]);_0x3b9877['filters']=_[_0x685d('0x31')](_0x3b9877[_0x685d('0x2e')],_0x3b9877[_0x685d('0x2f')]);_0x4a42b3[_0x685d('0x32')]=_[_0x685d('0x31')](_0x3b9877[_0x685d('0x2e')],qs[_0x685d('0x33')](_0x1f8ca7[_0x685d('0x2f')][_0x685d('0x33')]));_0x4a42b3[_0x685d('0x32')]=_0x4a42b3['attributes'][_0x685d('0x34')]?_0x4a42b3[_0x685d('0x32')]:_0x3b9877['model'];if(!_0x1f8ca7['query'][_0x685d('0x35')](_0x685d('0x36'))){_0x4a42b3['limit']=qs[_0x685d('0x1c')](_0x1f8ca7['query']['limit']);_0x4a42b3[_0x685d('0x19')]=qs[_0x685d('0x19')](_0x1f8ca7[_0x685d('0x2f')]['offset']);}_0x4a42b3[_0x685d('0x37')]=qs[_0x685d('0x38')](_0x1f8ca7[_0x685d('0x2f')][_0x685d('0x38')]);_0x4a42b3[_0x685d('0x39')]=qs[_0x685d('0x3a')](_[_0x685d('0x3b')](_0x1f8ca7[_0x685d('0x2f')],_0x3b9877[_0x685d('0x3a')]),_0x44d936);if(_0x1f8ca7[_0x685d('0x2f')][_0x685d('0x3c')]){_0x4a42b3['where']=_[_0x685d('0x3d')](_0x4a42b3['where'],{'$or':_['map'](_0x44d936,function(_0x5e6fb2){if(_0x5e6fb2[_0x685d('0x2c')]!==_0x685d('0x3e')){var _0x21fe70={};_0x21fe70[_0x5e6fb2[_0x685d('0x26')]]={'$like':'%'+_0x1f8ca7['query'][_0x685d('0x3c')]+'%'};return _0x21fe70;}})});}_0x4a42b3=_[_0x685d('0x3d')]({},_0x4a42b3,_0x1f8ca7[_0x685d('0x3f')]);var _0x52b8b4={'where':_0x4a42b3['where']};return db[_0x685d('0x29')][_0x685d('0x1b')](_0x52b8b4)[_0x685d('0x24')](function(_0x377d3a){_0x43f554[_0x685d('0x1b')]=_0x377d3a;if(_0x1f8ca7[_0x685d('0x2f')]['includeAll']){_0x4a42b3[_0x685d('0x40')]=[{'all':!![]}];}return db[_0x685d('0x29')][_0x685d('0x41')](_0x4a42b3);})[_0x685d('0x24')](function(_0x1a48f2){_0x43f554[_0x685d('0x42')]=_0x1a48f2;return _0x43f554;})[_0x685d('0x24')](respondWithFilteredResult(_0x2b17e1,_0x4a42b3))['catch'](handleError(_0x2b17e1,null));};exports[_0x685d('0x43')]=function(_0x30aa7a,_0x4dc872){var _0xd6be9f={'raw':!![],'where':{'id':_0x30aa7a[_0x685d('0x44')]['id']}},_0x356301={};_0x356301[_0x685d('0x2e')]=_[_0x685d('0x30')](db[_0x685d('0x29')][_0x685d('0x2a')]);_0x356301['query']=_[_0x685d('0x30')](_0x30aa7a[_0x685d('0x2f')]);_0x356301['filters']=_[_0x685d('0x31')](_0x356301['model'],_0x356301[_0x685d('0x2f')]);_0xd6be9f[_0x685d('0x32')]=_[_0x685d('0x31')](_0x356301[_0x685d('0x2e')],qs[_0x685d('0x33')](_0x30aa7a[_0x685d('0x2f')][_0x685d('0x33')]));_0xd6be9f[_0x685d('0x32')]=_0xd6be9f['attributes'][_0x685d('0x34')]?_0xd6be9f[_0x685d('0x32')]:_0x356301[_0x685d('0x2e')];if(_0x30aa7a[_0x685d('0x2f')][_0x685d('0x45')]){_0xd6be9f[_0x685d('0x40')]=[{'all':!![]}];}_0xd6be9f=_[_0x685d('0x3d')]({},_0xd6be9f,_0x30aa7a[_0x685d('0x3f')]);return db[_0x685d('0x29')][_0x685d('0x46')](_0xd6be9f)[_0x685d('0x24')](handleEntityNotFound(_0x4dc872,null))['then'](respondWithResult(_0x4dc872,null))[_0x685d('0x47')](handleError(_0x4dc872,null));};exports['create']=function(_0x1956e3,_0x248fab){return db[_0x685d('0x29')][_0x685d('0x48')](_0x1956e3['body'],{})[_0x685d('0x24')](respondWithResult(_0x248fab,0xc9))['catch'](handleError(_0x248fab,null));};exports[_0x685d('0x22')]=function(_0x5c14a7,_0x89a1cb){if(_0x5c14a7[_0x685d('0x49')]['id']){delete _0x5c14a7[_0x685d('0x49')]['id'];}return db[_0x685d('0x29')][_0x685d('0x46')]({'where':{'id':_0x5c14a7[_0x685d('0x44')]['id']}})[_0x685d('0x24')](handleEntityNotFound(_0x89a1cb,null))[_0x685d('0x24')](saveUpdates(_0x5c14a7[_0x685d('0x49')],null))[_0x685d('0x24')](respondWithResult(_0x89a1cb,null))[_0x685d('0x47')](handleError(_0x89a1cb,null));};exports['destroy']=function(_0x14b86c,_0x1820a4){return db[_0x685d('0x29')][_0x685d('0x46')]({'where':{'id':_0x14b86c[_0x685d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1820a4,null))['then'](removeEntity(_0x1820a4,null))[_0x685d('0x47')](handleError(_0x1820a4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7f9eb22..9e7986c 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 _0xdfbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','api'];(function(_0x5e3c25,_0x3e8711){var _0x4bdb0a=function(_0x1b82d1){while(--_0x1b82d1){_0x5e3c25['push'](_0x5e3c25['shift']());}};_0x4bdb0a(++_0x3e8711);}(_0xdfbe,0x1ab));var _0xedfb=function(_0x206677,_0x5d3dfb){_0x206677=_0x206677-0x0;var _0x46a858=_0xdfbe[_0x206677];return _0x46a858;};'use strict';var _=require('lodash');var util=require(_0xedfb('0x0'));var logger=require('../../config/logger')(_0xedfb('0x1'));var moment=require(_0xedfb('0x2'));var BPromise=require(_0xedfb('0x3'));var rp=require(_0xedfb('0x4'));var fs=require('fs');var path=require(_0xedfb('0x5'));var rimraf=require(_0xedfb('0x6'));var config=require(_0xedfb('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xedfb('0x8')]=function(_0x1962cd,_0x7c3a2c){return _0x1962cd['define'](_0xedfb('0x9'),attributes,{'tableName':_0xedfb('0xa'),'paranoid':![],'indexes':[{'name':_0xedfb('0xb'),'fields':[_0xedfb('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xd73a=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','api','moment','path'];(function(_0x275630,_0x153371){var _0x4ca89c=function(_0x3c0b87){while(--_0x3c0b87){_0x275630['push'](_0x275630['shift']());}};_0x4ca89c(++_0x153371);}(_0xd73a,0x171));var _0xad73=function(_0x442212,_0x2c70ae){_0x442212=_0x442212-0x0;var _0xff6993=_0xd73a[_0x442212];return _0xff6993;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var logger=require(_0xad73('0x2'))(_0xad73('0x3'));var moment=require(_0xad73('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad73('0x5'));var rimraf=require(_0xad73('0x6'));var config=require(_0xad73('0x7'));var attributes=require(_0xad73('0x8'));module[_0xad73('0x9')]=function(_0x7d2258,_0x247d3c){return _0x7d2258[_0xad73('0xa')](_0xad73('0xb'),attributes,{'tableName':_0xad73('0xc'),'paranoid':![],'indexes':[{'name':_0xad73('0xd'),'fields':['event',_0xad73('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0c6357b..38ca611 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 _0x50ab=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x30ec7d,_0x349afb){var _0xe2e575=function(_0x54a94e){while(--_0x54a94e){_0x30ec7d['push'](_0x30ec7d['shift']());}};_0xe2e575(++_0x349afb);}(_0x50ab,0xf1));var _0xb50a=function(_0x464d42,_0x4f1d09){_0x464d42=_0x464d42-0x0;var _0x1483d3=_0x50ab[_0x464d42];return _0x1483d3;};'use strict';var _=require('lodash');var util=require(_0xb50a('0x0'));var moment=require(_0xb50a('0x1'));var BPromise=require(_0xb50a('0x2'));var rs=require(_0xb50a('0x3'));var fs=require('fs');var Redis=require(_0xb50a('0x4'));var db=require(_0xb50a('0x5'))['db'];var utils=require(_0xb50a('0x6'));var logger=require('../../config/logger')(_0xb50a('0x7'));var config=require(_0xb50a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb50a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482e92,_0x51302c,_0x3a0e10){return new BPromise(function(_0x1831ae,_0x48acbb){return client[_0xb50a('0xa')](_0x482e92,_0x3a0e10)['then'](function(_0x4b6622){logger['info'](_0xb50a('0xb'),_0x51302c,_0xb50a('0xc'));logger['debug'](_0xb50a('0xd'),_0x51302c,_0xb50a('0xc'),JSON[_0xb50a('0xe')](_0x4b6622));if(_0x4b6622[_0xb50a('0xf')]){if(_0x4b6622['error'][_0xb50a('0x10')]===0x1f4){logger[_0xb50a('0xf')](_0xb50a('0xb'),_0x51302c,_0x4b6622[_0xb50a('0xf')][_0xb50a('0x11')]);return _0x48acbb(_0x4b6622[_0xb50a('0xf')][_0xb50a('0x11')]);}logger[_0xb50a('0xf')](_0xb50a('0xb'),_0x51302c,_0x4b6622['error'][_0xb50a('0x11')]);return _0x1831ae(_0x4b6622[_0xb50a('0xf')][_0xb50a('0x11')]);}else{logger[_0xb50a('0x12')](_0xb50a('0xb'),_0x51302c,'request\x20sent');_0x1831ae(_0x4b6622['result'][_0xb50a('0x11')]);}})[_0xb50a('0x13')](function(_0x1c606a){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x51302c,_0x1c606a);_0x48acbb(_0x1c606a);});});} \ No newline at end of file +var _0xe78c=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','randomstring','../../mysqldb','../../config/utils','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xe78c,0xaa));var _0xce78=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe78c[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xce78('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce78('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce78('0x2'))['db'];var utils=require(_0xce78('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce78('0x4')][_0xce78('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2afba0,_0x5b2057,_0x204148){return new BPromise(function(_0x1c3788,_0x29c2c0){return client[_0xce78('0x6')](_0x2afba0,_0x204148)[_0xce78('0x7')](function(_0x5d186a){logger['info'](_0xce78('0x8'),_0x5b2057,_0xce78('0x9'));logger[_0xce78('0xa')](_0xce78('0xb'),_0x5b2057,_0xce78('0x9'),JSON['stringify'](_0x5d186a));if(_0x5d186a['error']){if(_0x5d186a[_0xce78('0xc')][_0xce78('0xd')]===0x1f4){logger[_0xce78('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b2057,_0x5d186a[_0xce78('0xc')]['message']);return _0x29c2c0(_0x5d186a[_0xce78('0xc')][_0xce78('0xe')]);}logger['error'](_0xce78('0x8'),_0x5b2057,_0x5d186a['error'][_0xce78('0xe')]);return _0x1c3788(_0x5d186a[_0xce78('0xc')][_0xce78('0xe')]);}else{logger[_0xce78('0xf')](_0xce78('0x8'),_0x5b2057,_0xce78('0x9'));_0x1c3788(_0x5d186a[_0xce78('0x10')][_0xce78('0xe')]);}})[_0xce78('0x11')](function(_0xe5c945){logger[_0xce78('0xc')](_0xce78('0x8'),_0x5b2057,_0xe5c945);_0x29c2c0(_0xe5c945);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index ea4aa4d..80d8027 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 _0xd188=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','post','create','delete','destroy','exports','multer','path','express','Router'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xd188,0x1b5));var _0x8d18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd188[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8d18('0x0'));var util=require('util');var path=require(_0x8d18('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d18('0x2'));var router=express[_0x8d18('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d18('0x4'));var config=require(_0x8d18('0x5'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x8d18('0x6')](),controller[_0x8d18('0x7')]);router[_0x8d18('0x8')](_0x8d18('0x9'),auth[_0x8d18('0x6')](),controller['describe']);router['get'](_0x8d18('0xa'),auth[_0x8d18('0x6')](),controller[_0x8d18('0xb')]);router['get']('/:id/download',auth[_0x8d18('0x6')](),controller[_0x8d18('0xc')]);router[_0x8d18('0x8')](_0x8d18('0xd'),controller[_0x8d18('0xe')]);router[_0x8d18('0x8')](_0x8d18('0xf'),auth[_0x8d18('0x6')](),controller['downloadTranscribe']);router[_0x8d18('0x10')]('/',auth[_0x8d18('0x6')](),controller[_0x8d18('0x11')]);router[_0x8d18('0x10')]('/:id/transcribe',auth[_0x8d18('0x6')](),controller['runTranscribe']);router['put']('/:id',auth[_0x8d18('0x6')](),controller['update']);router[_0x8d18('0x12')](_0x8d18('0xa'),auth['isAuthenticated'](),controller[_0x8d18('0x13')]);module[_0x8d18('0x14')]=router; \ No newline at end of file +var _0xec3d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0xec3d,0xef));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));var path=require(_0xdec3('0x2'));var timeout=require(_0xdec3('0x3'));var express=require(_0xdec3('0x4'));var router=express[_0xdec3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdec3('0x6'));var interaction=require(_0xdec3('0x7'));var config=require(_0xdec3('0x8'));var controller=require('./voiceRecording.controller');router[_0xdec3('0x9')]('/',auth[_0xdec3('0xa')](),controller[_0xdec3('0xb')]);router[_0xdec3('0x9')](_0xdec3('0xc'),auth[_0xdec3('0xa')](),controller[_0xdec3('0xd')]);router[_0xdec3('0x9')]('/:id',auth[_0xdec3('0xa')](),controller['show']);router[_0xdec3('0x9')](_0xdec3('0xe'),auth[_0xdec3('0xa')](),controller['download']);router[_0xdec3('0x9')](_0xdec3('0xf'),controller[_0xdec3('0x10')]);router[_0xdec3('0x9')](_0xdec3('0x11'),auth[_0xdec3('0xa')](),controller['downloadTranscribe']);router[_0xdec3('0x12')]('/',auth[_0xdec3('0xa')](),controller[_0xdec3('0x13')]);router[_0xdec3('0x12')](_0xdec3('0x11'),auth[_0xdec3('0xa')](),controller[_0xdec3('0x14')]);router[_0xdec3('0x15')](_0xdec3('0x16'),auth[_0xdec3('0xa')](),controller[_0xdec3('0x17')]);router[_0xdec3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xdec3('0x19')]);module[_0xdec3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c208431..3e74681 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 7969e7d..6baf131 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 _0xb001=['TranscriptionJob','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','VoiceRecording','includeAll','include','findAll','catch','params','keys','options','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','existsSync','recording','ValidationError','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','listBuckets','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xb001,0x14b));var _0x1b00=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb001[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b00('0x0'));var zipdir=require(_0x1b00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b00('0x2'));var moment=require(_0x1b00('0x3'));var BPromise=require(_0x1b00('0x4'));var Mustache=require(_0x1b00('0x5'));var util=require(_0x1b00('0x6'));var path=require(_0x1b00('0x7'));var sox=require('sox');var csv=require(_0x1b00('0x8'));var ejs=require(_0x1b00('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b00('0xa'));var squel=require(_0x1b00('0xb'));var crypto=require(_0x1b00('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b00('0xd'));var toCsv=require(_0x1b00('0x8'));var querystring=require(_0x1b00('0xe'));var Papa=require(_0x1b00('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x1b00('0x10'));var Redis=require(_0x1b00('0x11'));var authService=require(_0x1b00('0x12'));var qs=require(_0x1b00('0x13'));var as=require(_0x1b00('0x14'));var hardwareService=require(_0x1b00('0x15'));var logger=require('../../config/logger')(_0x1b00('0x16'));var utils=require(_0x1b00('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1b00('0x18'));var db=require(_0x1b00('0x19'))['db'];function respondWithStatusCode(_0x6d281,_0x3351b5){_0x3351b5=_0x3351b5||0xcc;return function(_0x5d13b5){if(_0x5d13b5){return _0x6d281['sendStatus'](_0x3351b5);}return _0x6d281[_0x1b00('0x1a')](_0x3351b5)[_0x1b00('0x1b')]();};}function respondWithResult(_0x124193,_0x3ab258){_0x3ab258=_0x3ab258||0xc8;return function(_0x29f649){if(_0x29f649){return _0x124193[_0x1b00('0x1a')](_0x3ab258)[_0x1b00('0x1c')](_0x29f649);}};}function respondWithFilteredResult(_0x46a4bd,_0x1c63d7){return function(_0x3a0e06){if(_0x3a0e06){var _0x2e5488=typeof _0x1c63d7[_0x1b00('0x1d')]===_0x1b00('0x1e')&&typeof _0x1c63d7['limit']==='undefined';var _0x4abc76=_0x3a0e06[_0x1b00('0x1f')];var _0x3b3f40=_0x2e5488?0x0:_0x1c63d7[_0x1b00('0x1d')];var _0x27b541=_0x2e5488?_0x3a0e06['count']:_0x1c63d7[_0x1b00('0x1d')]+_0x1c63d7[_0x1b00('0x20')];var _0x1a01ae;if(_0x27b541>=_0x4abc76){_0x27b541=_0x4abc76;_0x1a01ae=0xc8;}else{_0x1a01ae=0xce;}_0x46a4bd[_0x1b00('0x1a')](_0x1a01ae);return _0x46a4bd[_0x1b00('0x21')](_0x1b00('0x22'),_0x3b3f40+'-'+_0x27b541+'/'+_0x4abc76)[_0x1b00('0x1c')](_0x3a0e06);}return null;};}function patchUpdates(_0x3d2b9){return function(_0xf5443e){try{jsonpatch[_0x1b00('0x23')](_0xf5443e,_0x3d2b9,!![]);}catch(_0xad2b58){return BPromise[_0x1b00('0x24')](_0xad2b58);}return _0xf5443e[_0x1b00('0x25')]();};}function saveUpdates(_0x5a5c0d,_0x258aa2){return function(_0x1da7eb){if(_0x1da7eb){return _0x1da7eb['update'](_0x5a5c0d)[_0x1b00('0x26')](function(_0x265d42){return _0x265d42;});}return null;};}function removeEntity(_0x2f7a66,_0x2bec7a){return function(_0x572a96){if(_0x572a96){return _0x572a96['destroy']()[_0x1b00('0x26')](function(){_0x2f7a66[_0x1b00('0x1a')](0xcc)[_0x1b00('0x1b')]();});}};}function handleEntityNotFound(_0x43120e,_0x2f2af8){return function(_0x52e0c9){if(!_0x52e0c9){_0x43120e['sendStatus'](0x194);}return _0x52e0c9;};}function handleError(_0x5b4caa,_0x631650){_0x631650=_0x631650||0x1f4;return function(_0x3b97da){logger[_0x1b00('0x27')](_0x3b97da[_0x1b00('0x28')]);if(_0x3b97da[_0x1b00('0x29')]){delete _0x3b97da['name'];}_0x5b4caa['status'](_0x631650)[_0x1b00('0x2a')](_0x3b97da);};}exports['index']=function(_0x50e4c7,_0x2b7953){var _0x4d77b6={},_0x2987e9={},_0x492da9={'count':0x0,'rows':[]};var _0x48b5b2=_[_0x1b00('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x4eab6a){return{'name':_0x4eab6a['fieldName'],'type':_0x4eab6a['type'][_0x1b00('0x2c')]};});_0x2987e9[_0x1b00('0x2d')]=_[_0x1b00('0x2e')](_['map'](_0x48b5b2,'name'),[_0x1b00('0x2f')]);_0x2987e9['query']=_['keys'](_0x50e4c7[_0x1b00('0x30')]);_0x2987e9[_0x1b00('0x31')]=_[_0x1b00('0x32')](_0x2987e9[_0x1b00('0x2d')],_0x2987e9['query']);_0x4d77b6[_0x1b00('0x33')]=_[_0x1b00('0x32')](_0x2987e9['model'],qs[_0x1b00('0x34')](_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x34')]));_0x4d77b6['attributes']=_0x4d77b6[_0x1b00('0x33')][_0x1b00('0x35')]?_0x4d77b6[_0x1b00('0x33')]:_0x2987e9[_0x1b00('0x2d')];if(!_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x36')](_0x1b00('0x37'))){_0x4d77b6[_0x1b00('0x20')]=qs['limit'](_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x20')]);_0x4d77b6[_0x1b00('0x1d')]=qs[_0x1b00('0x1d')](_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x1d')]);}_0x4d77b6[_0x1b00('0x38')]=qs[_0x1b00('0x39')](_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x39')]);_0x4d77b6['where']=qs[_0x1b00('0x31')](_[_0x1b00('0x3a')](_0x50e4c7['query'],_0x2987e9[_0x1b00('0x31')]),_0x48b5b2);if(_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x3b')]){_0x4d77b6[_0x1b00('0x3c')]=_['merge'](_0x4d77b6[_0x1b00('0x3c')],{'$or':_[_0x1b00('0x2b')](_0x48b5b2,function(_0x15bbd8){if(_0x15bbd8[_0x1b00('0x3d')]!==_0x1b00('0x3e')){var _0x51daa5={};_0x51daa5[_0x15bbd8[_0x1b00('0x29')]]={'$like':'%'+_0x50e4c7[_0x1b00('0x30')][_0x1b00('0x3b')]+'%'};return _0x51daa5;}})});}_0x4d77b6=_['merge']({},_0x4d77b6,_0x50e4c7['options']);var _0x10f088={'where':_0x4d77b6[_0x1b00('0x3c')]};return db[_0x1b00('0x3f')][_0x1b00('0x1f')](_0x10f088)[_0x1b00('0x26')](function(_0xc9e1a0){_0x492da9[_0x1b00('0x1f')]=_0xc9e1a0;if(_0x50e4c7['query'][_0x1b00('0x40')]){_0x4d77b6[_0x1b00('0x41')]=[{'all':!![]}];}return db[_0x1b00('0x3f')][_0x1b00('0x42')](_0x4d77b6);})[_0x1b00('0x26')](function(_0x49e7b7){_0x492da9['rows']=_0x49e7b7;return _0x492da9;})[_0x1b00('0x26')](respondWithFilteredResult(_0x2b7953,_0x4d77b6))[_0x1b00('0x43')](handleError(_0x2b7953,null));};exports['show']=function(_0x1a5113,_0x273129){var _0x1b8dd1={'raw':![],'where':{'id':_0x1a5113[_0x1b00('0x44')]['id']}},_0x1c6a75={};_0x1c6a75[_0x1b00('0x2d')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x1c6a75['query']=_[_0x1b00('0x45')](_0x1a5113[_0x1b00('0x30')]);_0x1c6a75['filters']=_[_0x1b00('0x32')](_0x1c6a75[_0x1b00('0x2d')],_0x1c6a75[_0x1b00('0x30')]);_0x1b8dd1[_0x1b00('0x33')]=_['intersection'](_0x1c6a75[_0x1b00('0x2d')],qs[_0x1b00('0x34')](_0x1a5113[_0x1b00('0x30')][_0x1b00('0x34')]));_0x1b8dd1[_0x1b00('0x33')]=_0x1b8dd1['attributes'][_0x1b00('0x35')]?_0x1b8dd1[_0x1b00('0x33')]:_0x1c6a75['model'];if(_0x1a5113[_0x1b00('0x30')][_0x1b00('0x40')]){_0x1b8dd1['include']=[{'all':!![]}];}_0x1b8dd1=_['merge']({},_0x1b8dd1,_0x1a5113[_0x1b00('0x46')]);return db[_0x1b00('0x3f')][_0x1b00('0x47')](_0x1b8dd1)[_0x1b00('0x26')](handleEntityNotFound(_0x273129,null))['then'](respondWithResult(_0x273129,null))['catch'](handleError(_0x273129,null));};exports[_0x1b00('0x48')]=function(_0xcda57b,_0xfb1591){return db['VoiceRecording']['create'](_0xcda57b[_0x1b00('0x49')],{})[_0x1b00('0x26')](respondWithResult(_0xfb1591,0xc9))[_0x1b00('0x43')](handleError(_0xfb1591,null));};exports[_0x1b00('0x4a')]=function(_0x12e91b,_0x5d564a){if(_0x12e91b['body']['id']){delete _0x12e91b['body']['id'];}return db[_0x1b00('0x3f')][_0x1b00('0x47')]({'where':{'id':_0x12e91b['params']['id']}})[_0x1b00('0x26')](handleEntityNotFound(_0x5d564a,null))[_0x1b00('0x26')](saveUpdates(_0x12e91b[_0x1b00('0x49')],null))[_0x1b00('0x26')](respondWithResult(_0x5d564a,null))[_0x1b00('0x43')](handleError(_0x5d564a,null));};exports[_0x1b00('0x4b')]=function(_0x1dd0ff,_0x57f2a7){return db['VoiceRecording'][_0x1b00('0x4b')]()['then'](respondWithResult(_0x57f2a7,null))[_0x1b00('0x43')](handleError(_0x57f2a7,null));};exports[_0x1b00('0x4c')]=function(_0x5e7ee2,_0x36e196,_0x3adb72){var _0x372a9e=require(_0x1b00('0x4d'));var _0x4a0b3c=![];var _0x43bdad={};if(_0x5e7ee2[_0x1b00('0x30')][_0x1b00('0x3d')]&&_0x5e7ee2[_0x1b00('0x30')]['type']===_0x1b00('0x4e')){_0x43bdad[_0x1b00('0x4e')]=_0x5e7ee2[_0x1b00('0x44')]['id'];}else{_0x43bdad['id']=_0x5e7ee2[_0x1b00('0x44')]['id'];}return db[_0x1b00('0x3f')][_0x1b00('0x47')]({'where':_0x43bdad,'attributes':['id','value'],'raw':!![]})[_0x1b00('0x26')](handleEntityNotFound(_0x36e196,null))['then'](function(_0x4c51a8){if(_0x4c51a8){var _0x67c1fb=_0x4c51a8[_0x1b00('0x4f')];var _0x2a034e=util[_0x1b00('0x2f')](_0x1b00('0x50'),_0x67c1fb);if(fs['existsSync'](_0x2a034e)){_0x4a0b3c=!![];return _0x372a9e[_0x1b00('0x51')](_0x2a034e,_0x67c1fb,config[_0x1b00('0x52')]['recording'])['then'](function(){return _0x4c51a8;});}return _0x4c51a8;}})[_0x1b00('0x26')](function(_0x5c72ed){if(_0x5c72ed){var _0x1c587a=_0x5c72ed['value'];if(!fs['existsSync'](_0x1c587a)){throw new db[(_0x1b00('0x53'))]['ValidationError'](_0x1b00('0x54'));}if(_0x5c72ed[_0x1b00('0x55')]){return _0x36e196[_0x1b00('0x4c')](_0x1c587a,_0x5c72ed[_0x1b00('0x55')]+path[_0x1b00('0x56')](_0x1c587a),function(){if(_0x4a0b3c){fs[_0x1b00('0x57')](_0x1c587a);}});}else{return _0x36e196[_0x1b00('0x4c')](_0x1c587a,function(_0x1927ef){if(_0x4a0b3c){fs[_0x1b00('0x57')](_0x1c587a);}});}}})[_0x1b00('0x43')](function(_0x59fccd){if(_0x59fccd[_0x1b00('0x58')]==='VoiceRecording\x20not\x20found'){_0x36e196[_0x1b00('0x1a')](0x194)[_0x1b00('0x2a')]('Not\x20found');}else{return handleError(_0x36e196,null);}});};exports[_0x1b00('0x59')]=function(_0x36fc88,_0x166cdb,_0x448095){var _0x2e8e37=require(_0x1b00('0x4d'));var _0x54a0e9=![];var _0x39d608={'$and':[db[_0x1b00('0x5a')][_0x1b00('0x3c')](db['sequelize']['fn'](_0x1b00('0x5b'),db['sequelize'][_0x1b00('0x5c')](_0x1b00('0x4e'))),_0x36fc88['query'][_0x1b00('0x5d')])]};if(_0x36fc88['query'][_0x1b00('0x3d')]&&_0x36fc88['query'][_0x1b00('0x3d')]===_0x1b00('0x4e')){_0x39d608[_0x1b00('0x5e')][_0x1b00('0x5f')]({'uniqueid':_0x36fc88['params']['id']});}else{_0x39d608[_0x1b00('0x5e')][_0x1b00('0x5f')]({'id':_0x36fc88[_0x1b00('0x44')]['id']});}return db[_0x1b00('0x3f')]['find']({'where':_0x39d608,'attributes':['id',_0x1b00('0x4f')],'raw':!![]})[_0x1b00('0x26')](handleEntityNotFound(_0x166cdb,null))['then'](function(_0x58cb9f){if(_0x58cb9f){var _0x28a846=util[_0x1b00('0x2f')](_0x1b00('0x50'),_0x58cb9f['value']);if(fs[_0x1b00('0x60')](_0x28a846)){_0x54a0e9=!![];return _0x2e8e37['decryptFile'](_0x28a846,_0x58cb9f[_0x1b00('0x4f')],config[_0x1b00('0x52')][_0x1b00('0x61')])[_0x1b00('0x26')](function(){return _0x58cb9f;});}return _0x58cb9f;}})[_0x1b00('0x26')](function(_0x2260ec){if(_0x2260ec){if(!fs['existsSync'](_0x2260ec[_0x1b00('0x4f')])){throw new db[(_0x1b00('0x53'))][(_0x1b00('0x62'))](_0x1b00('0x54'));}if(_0x2260ec[_0x1b00('0x55')]){return _0x166cdb[_0x1b00('0x4c')](_0x2260ec['value'],_0x2260ec[_0x1b00('0x55')]+path[_0x1b00('0x56')](_0x2260ec[_0x1b00('0x4f')]),function(){if(_0x54a0e9){fs[_0x1b00('0x57')](_0x2260ec['value']);}});}else{return _0x166cdb[_0x1b00('0x4c')](_0x2260ec[_0x1b00('0x4f')],function(_0x5d53a4){if(_0x54a0e9){fs[_0x1b00('0x57')](_0x2260ec['value']);}});}}})[_0x1b00('0x43')](handleError(_0x166cdb,null));};exports[_0x1b00('0x63')]=function(_0x296eaf,_0x53f931){return db['VoiceRecording'][_0x1b00('0x47')]({'where':{'id':_0x296eaf[_0x1b00('0x44')]['id']}})[_0x1b00('0x26')](function(_0x38ba85){if(_[_0x1b00('0x64')](_0x38ba85)){throw new ReferenceError(_0x1b00('0x65'));}return _0x38ba85;})[_0x1b00('0x26')](function(_0x237302){var _0x950fdb=_0x237302['value'];logger[_0x1b00('0x66')](_0x1b00('0x67'),_0x950fdb);if(!_[_0x1b00('0x64')](_0x237302[_0x1b00('0x4f')])&&fs['existsSync'](_0x950fdb)){logger['info'](_0x1b00('0x68')+_0x950fdb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x950fdb);}_0x950fdb=_0x950fdb+_0x1b00('0x69');if(!_['isNil'](_0x237302[_0x1b00('0x4f')])&&fs['existsSync'](_0x950fdb)){logger[_0x1b00('0x66')](_0x1b00('0x68')+_0x950fdb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x950fdb);}return _0x237302;})['then'](function(_0x24aecf){if(!_0x24aecf)throw new InternalError();return _0x24aecf[_0x1b00('0x63')]();})[_0x1b00('0x26')](function(){_0x53f931[_0x1b00('0x1a')](0xcc)['end']();})['catch'](handleError(_0x53f931,null));};function getBucketslist(_0x290740,_0x53e2cf,_0x413fdf){return new Promise(function(_0x3c054d,_0x1ad1c9){var _0x409c9b=new AWS['S3']({'accessKeyId':_0x53e2cf,'secretAccessKey':_0x290740,'region':_0x413fdf});_0x409c9b[_0x1b00('0x6a')]({},function(_0x291164,_0x494f6e){if(_0x291164){return _0x1ad1c9(_0x291164);}else{return _0x3c054d(_0x494f6e);}});});}function createBucket(_0x5363fa,_0x256097,_0xad9d06,_0x3a5543){return new Promise(function(_0x263381,_0x1a3fd6){var _0x30a1c6=new AWS['S3']({'accessKeyId':_0x256097,'secretAccessKey':_0x5363fa,'region':_0xad9d06});_0x30a1c6['createBucket']({'Bucket':_0x3a5543},function(_0x39029c,_0x4f4440){if(_0x39029c){return _0x1a3fd6(_0x39029c);}else{return _0x263381(_0x4f4440);}});});}function uploadFile(_0x3349c1,_0x168e77,_0x517804,_0x3549d5,_0x470aaf,_0x5841cf){return new Promise(function(_0x55a87d,_0x1bbafd){var _0x226178=new AWS['S3']({'accessKeyId':_0x168e77,'secretAccessKey':_0x3349c1,'region':_0x517804});_0x226178[_0x1b00('0x6b')]({'Bucket':_0x3549d5,'Key':_0x470aaf,'Body':_0x5841cf},function(_0x461a8b,_0x1dbdff){if(_0x461a8b){return _0x1bbafd(_0x461a8b);}else{return _0x55a87d(_0x1dbdff);}});});}function startTranscribe(_0x7604e4,_0x2b89aa,_0x161654,_0x4042b4,_0x2ce1b0,_0x38d5c9){return new Promise(function(_0x2996ca,_0xaa0312){var _0xe4ab1=new AWS[(_0x1b00('0x6c'))]({'accessKeyId':_0x2b89aa,'secretAccessKey':_0x7604e4,'region':_0x161654});_0xe4ab1['startTranscriptionJob']({'TranscriptionJobName':_0x4042b4,'LanguageCode':_0x2ce1b0,'Media':{'MediaFileUri':_0x38d5c9}},function(_0x1b9ca0,_0x3783cc){if(_0x1b9ca0){return _0xaa0312(_0x1b9ca0);}else{return _0x2996ca(_0x3783cc);}});});}function transcribe(_0x51c078,_0x2ff3bb,_0x352cc1,_0x593733,_0x30b867,_0x335bc7,_0x1b2439){return new Promise(function(_0xa981c7,_0x4dd898){var _0x5de283={};logger[_0x1b00('0x66')](util['format'](_0x1b00('0x6d'),_0x51c078,_0x30b867));return uploadFile(_0x2ff3bb,_0x352cc1,_0x593733,_0x30b867,path['basename'](_0x335bc7),fs[_0x1b00('0x6e')](_0x335bc7))[_0x1b00('0x26')](function(_0x4d200e){logger[_0x1b00('0x66')](util['format'](_0x1b00('0x6f'),_0x51c078,_0x30b867,_0x4d200e[_0x1b00('0x70')]));_0x5de283['bucket']=_0x4d200e[_0x1b00('0x71')];_0x5de283[_0x1b00('0x72')]=_0x4d200e['Location'];logger[_0x1b00('0x66')](util[_0x1b00('0x2f')](_0x1b00('0x73'),_0x51c078));return startTranscribe(_0x2ff3bb,_0x352cc1,_0x593733,uuidv4(),_0x1b2439,_0x4d200e[_0x1b00('0x70')]);})['then'](function(_0x324dad){logger[_0x1b00('0x66')](util[_0x1b00('0x2f')](_0x1b00('0x74'),_0x51c078,_0x324dad['TranscriptionJob'][_0x1b00('0x75')]));_0x5de283[_0x1b00('0x76')]=_0x324dad[_0x1b00('0x77')][_0x1b00('0x75')];_0x5de283[_0x1b00('0x78')]=_0x324dad[_0x1b00('0x77')]['TranscriptionJobStatus'];return _0xa981c7(_0x5de283);})[_0x1b00('0x43')](function(_0x2a1018){return _0x4dd898(_0x2a1018);});});}exports['runTranscribe']=function(_0x12b3d9,_0xa6e2ea,_0x50f9bd){var _0x13ab6f;var _0x40698e;var _0x3cb38a;var _0x2b76c5=require(_0x1b00('0x4d'));return db[_0x1b00('0x3f')][_0x1b00('0x79')]({'where':{'id':_0x12b3d9['params']['id']}})[_0x1b00('0x26')](function(_0x474b82){if(_0x474b82){var _0x33a6ba=util[_0x1b00('0x2f')](_0x1b00('0x50'),_0x474b82[_0x1b00('0x4f')]);if(fs[_0x1b00('0x60')](_0x33a6ba)){cypher=!![];return _0x2b76c5[_0x1b00('0x51')](_0x33a6ba,_0x474b82[_0x1b00('0x4f')],config[_0x1b00('0x52')][_0x1b00('0x61')])[_0x1b00('0x26')](function(){return _0x474b82;});}return _0x474b82;}})[_0x1b00('0x26')](function(_0x59f3f7){if(!_0x59f3f7){throw new db[(_0x1b00('0x53'))][(_0x1b00('0x62'))](_0x1b00('0x7a'));}_0x40698e=_0x59f3f7;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xa6e2ea,null))[_0x1b00('0x26')](function(_0x249778){if(_0x249778){_0x13ab6f=_0x249778;if(!_0x13ab6f['transcribe']||!_0x13ab6f['transcribeAccountId']||!_0x13ab6f['transcribeRegion']||!_0x13ab6f[_0x1b00('0x7b')]||!_0x13ab6f[_0x1b00('0x7c')]){throw new db[(_0x1b00('0x53'))]['ValidationError'](_0x1b00('0x7d'));}if(_0x12b3d9[_0x1b00('0x49')][_0x1b00('0x7e')]&&(!_0x13ab6f[_0x1b00('0x7f')]||!_0x13ab6f[_0x1b00('0x80')]||!_0x13ab6f['sentimentRegion']||!_0x13ab6f[_0x1b00('0x7b')]||!_0x13ab6f[_0x1b00('0x7c')])){throw new db[(_0x1b00('0x53'))][(_0x1b00('0x62'))](_0x1b00('0x81'));}return db[_0x1b00('0x82')][_0x1b00('0x79')]({'where':{'id':_0x13ab6f[_0x1b00('0x83')]}});}})[_0x1b00('0x26')](function(_0x49f48b){if(!_0x49f48b){throw new db['Sequelize'][(_0x1b00('0x62'))](_0x1b00('0x84'));}if(!_0x49f48b[_0x1b00('0x85')]||!_0x49f48b[_0x1b00('0x86')]){throw new db[(_0x1b00('0x53'))]['ValidationError'](_0x1b00('0x87'));}_0x3cb38a=_0x49f48b;return getBucketslist(_0x3cb38a[_0x1b00('0x85')],_0x3cb38a[_0x1b00('0x86')],_0x13ab6f['transcribeRegion']);})[_0x1b00('0x26')](function(_0x41105c){if(_0x41105c&&_0x41105c[_0x1b00('0x88')]){var _0x1abec5=_[_0x1b00('0x47')](_0x41105c['Buckets'],function(_0x2de5a0){return _0x2de5a0[_0x1b00('0x89')]===_0x13ab6f[_0x1b00('0x7c')];});if(!_0x1abec5){logger[_0x1b00('0x66')](util[_0x1b00('0x2f')](_0x1b00('0x8a'),_0x12b3d9['params']['id'],_0x13ab6f['bucket']));return createBucket(_0x3cb38a[_0x1b00('0x85')],_0x3cb38a[_0x1b00('0x86')],_0x13ab6f[_0x1b00('0x8b')],_0x13ab6f['bucket']);}logger[_0x1b00('0x66')](util[_0x1b00('0x2f')](_0x1b00('0x8c'),_0x12b3d9[_0x1b00('0x44')]['id'],_0x13ab6f['bucket']));return;}})[_0x1b00('0x26')](function(_0x249486){if(_0x40698e[_0x1b00('0x78')]===_0x1b00('0x8d')){return transcribe(_0x12b3d9[_0x1b00('0x44')]['id'],_0x3cb38a[_0x1b00('0x85')],_0x3cb38a[_0x1b00('0x86')],_0x13ab6f[_0x1b00('0x8b')],_0x13ab6f[_0x1b00('0x7c')],_0x40698e['value'],_0x13ab6f['language']);}else{logger[_0x1b00('0x66')](util[_0x1b00('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x12b3d9[_0x1b00('0x44')]['id']));return{'transcribeStatus':_0x1b00('0x8e')};}})[_0x1b00('0x26')](function(_0xaafbb1){if(_0xaafbb1){_0xaafbb1[_0x1b00('0x8f')]=_0x12b3d9[_0x1b00('0x49')][_0x1b00('0x7e')];return _0x40698e[_0x1b00('0x90')](_0xaafbb1);}})[_0x1b00('0x26')](respondWithResult(_0xa6e2ea,null))['catch'](handleError(_0xa6e2ea,null));};function writeFile(_0x2cd29e,_0x1cfce1){return new Promise(function(_0x1de26d,_0x3c680e){fs[_0x1b00('0x91')](_0x1cfce1,_0x2cd29e,function(_0xb1e6f7,_0x5c1481){if(_0xb1e6f7){return _0x3c680e(_0xb1e6f7);}else{return _0x1de26d(_0x5c1481);}});});}exports['downloadTranscribe']=function(_0x2f28c8,_0x57a27b,_0x30b902){return db[_0x1b00('0x3f')]['findOne']({'where':{'id':_0x2f28c8[_0x1b00('0x44')]['id']}})[_0x1b00('0x26')](handleEntityNotFound(_0x57a27b))[_0x1b00('0x26')](function(_0x5a0416){if(_0x5a0416&&_0x5a0416[_0x1b00('0x92')]){var _0x3c0f39=_0x5a0416[_0x1b00('0x92')];var _0x1b78dc=config[_0x1b00('0x93')]+_0x1b00('0x94')+_0x5a0416['id']+_0x1b00('0x95');if(fs['existsSync'](_0x1b78dc)){return _0x1b78dc;}return writeFile(_0x3c0f39,_0x1b78dc)[_0x1b00('0x26')](function(){return _0x1b78dc;});}else{throw new db[(_0x1b00('0x53'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x1b00('0x26')](function(_0x31fa95){return _0x57a27b['download'](_0x31fa95);})['catch'](handleError(_0x57a27b));}; \ No newline at end of file +var _0x4ca0=['Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','download','uniqueid','existsSync','decryptFile','value','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','$and','push','%s.cypher','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','format','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','runTranscribe','findOne','secrets','recording','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion'];(function(_0x933266,_0x303366){var _0x2471f4=function(_0x913138){while(--_0x913138){_0x933266['push'](_0x933266['shift']());}};_0x2471f4(++_0x303366);}(_0x4ca0,0x1de));var _0x04ca=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x4ca0[_0x12f9e3];return _0x2de0c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ca('0x0'));var zipdir=require(_0x04ca('0x1'));var jsonpatch=require(_0x04ca('0x2'));var rp=require(_0x04ca('0x3'));var moment=require(_0x04ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x04ca('0x5'));var util=require(_0x04ca('0x6'));var path=require(_0x04ca('0x7'));var sox=require(_0x04ca('0x8'));var csv=require(_0x04ca('0x9'));var ejs=require(_0x04ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ca('0xb'));var squel=require(_0x04ca('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x04ca('0xd'));var toCsv=require(_0x04ca('0x9'));var querystring=require(_0x04ca('0xe'));var Papa=require(_0x04ca('0xf'));var AWS=require(_0x04ca('0x10'));var uuidv4=require(_0x04ca('0x11'));var Redis=require('ioredis');var authService=require(_0x04ca('0x12'));var qs=require(_0x04ca('0x13'));var as=require(_0x04ca('0x14'));var hardwareService=require(_0x04ca('0x15'));var logger=require('../../config/logger')(_0x04ca('0x16'));var utils=require(_0x04ca('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x04ca('0x18'));var db=require(_0x04ca('0x19'))['db'];function respondWithStatusCode(_0x49aa66,_0x4f80e1){_0x4f80e1=_0x4f80e1||0xcc;return function(_0x2e253b){if(_0x2e253b){return _0x49aa66[_0x04ca('0x1a')](_0x4f80e1);}return _0x49aa66[_0x04ca('0x1b')](_0x4f80e1)['end']();};}function respondWithResult(_0x30361e,_0x416cc5){_0x416cc5=_0x416cc5||0xc8;return function(_0x39998d){if(_0x39998d){return _0x30361e[_0x04ca('0x1b')](_0x416cc5)[_0x04ca('0x1c')](_0x39998d);}};}function respondWithFilteredResult(_0x47777e,_0x35da6f){return function(_0x2c8e3d){if(_0x2c8e3d){var _0x97df50=typeof _0x35da6f[_0x04ca('0x1d')]===_0x04ca('0x1e')&&typeof _0x35da6f[_0x04ca('0x1f')]==='undefined';var _0x407da1=_0x2c8e3d[_0x04ca('0x20')];var _0x5e1cf6=_0x97df50?0x0:_0x35da6f[_0x04ca('0x1d')];var _0x2ee2d8=_0x97df50?_0x2c8e3d[_0x04ca('0x20')]:_0x35da6f[_0x04ca('0x1d')]+_0x35da6f[_0x04ca('0x1f')];var _0x3b34ac;if(_0x2ee2d8>=_0x407da1){_0x2ee2d8=_0x407da1;_0x3b34ac=0xc8;}else{_0x3b34ac=0xce;}_0x47777e[_0x04ca('0x1b')](_0x3b34ac);return _0x47777e['set'](_0x04ca('0x21'),_0x5e1cf6+'-'+_0x2ee2d8+'/'+_0x407da1)[_0x04ca('0x1c')](_0x2c8e3d);}return null;};}function patchUpdates(_0xd39d4b){return function(_0x5a6f7d){try{jsonpatch[_0x04ca('0x22')](_0x5a6f7d,_0xd39d4b,!![]);}catch(_0xd69831){return BPromise[_0x04ca('0x23')](_0xd69831);}return _0x5a6f7d[_0x04ca('0x24')]();};}function saveUpdates(_0xe64454,_0x42074c){return function(_0x22ba23){if(_0x22ba23){return _0x22ba23['update'](_0xe64454)[_0x04ca('0x25')](function(_0x1dcf57){return _0x1dcf57;});}return null;};}function removeEntity(_0xa59420,_0x2cb5e2){return function(_0x585f17){if(_0x585f17){return _0x585f17[_0x04ca('0x26')]()['then'](function(){_0xa59420[_0x04ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a057,_0x34b9ea){return function(_0x3446ba){if(!_0x3446ba){_0x17a057['sendStatus'](0x194);}return _0x3446ba;};}function handleError(_0x1db694,_0x3c3e47){_0x3c3e47=_0x3c3e47||0x1f4;return function(_0x25272a){logger[_0x04ca('0x27')](_0x25272a[_0x04ca('0x28')]);if(_0x25272a[_0x04ca('0x29')]){delete _0x25272a[_0x04ca('0x29')];}_0x1db694[_0x04ca('0x1b')](_0x3c3e47)['send'](_0x25272a);};}exports[_0x04ca('0x2a')]=function(_0x4d0bf8,_0x54640e){var _0x36cc51={},_0x1efdee={},_0x6d4610={'count':0x0,'rows':[]};var _0x328d65=_[_0x04ca('0x2b')](db[_0x04ca('0x2c')][_0x04ca('0x2d')],function(_0x1e9fa0){return{'name':_0x1e9fa0[_0x04ca('0x2e')],'type':_0x1e9fa0[_0x04ca('0x2f')][_0x04ca('0x30')]};});_0x1efdee['model']=_['differenceBy'](_[_0x04ca('0x2b')](_0x328d65,_0x04ca('0x29')),['format']);_0x1efdee['query']=_[_0x04ca('0x31')](_0x4d0bf8['query']);_0x1efdee[_0x04ca('0x32')]=_[_0x04ca('0x33')](_0x1efdee[_0x04ca('0x34')],_0x1efdee[_0x04ca('0x35')]);_0x36cc51[_0x04ca('0x36')]=_[_0x04ca('0x33')](_0x1efdee[_0x04ca('0x34')],qs[_0x04ca('0x37')](_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x37')]));_0x36cc51[_0x04ca('0x36')]=_0x36cc51[_0x04ca('0x36')][_0x04ca('0x38')]?_0x36cc51[_0x04ca('0x36')]:_0x1efdee[_0x04ca('0x34')];if(!_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x39')]('nolimit')){_0x36cc51[_0x04ca('0x1f')]=qs[_0x04ca('0x1f')](_0x4d0bf8[_0x04ca('0x35')]['limit']);_0x36cc51['offset']=qs[_0x04ca('0x1d')](_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x1d')]);}_0x36cc51[_0x04ca('0x3a')]=qs[_0x04ca('0x3b')](_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x3b')]);_0x36cc51[_0x04ca('0x3c')]=qs[_0x04ca('0x32')](_[_0x04ca('0x3d')](_0x4d0bf8[_0x04ca('0x35')],_0x1efdee[_0x04ca('0x32')]),_0x328d65);if(_0x4d0bf8['query'][_0x04ca('0x3e')]){_0x36cc51[_0x04ca('0x3c')]=_[_0x04ca('0x3f')](_0x36cc51[_0x04ca('0x3c')],{'$or':_['map'](_0x328d65,function(_0x7e2182){if(_0x7e2182['type']!==_0x04ca('0x40')){var _0x20bf3b={};_0x20bf3b[_0x7e2182[_0x04ca('0x29')]]={'$like':'%'+_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x3e')]+'%'};return _0x20bf3b;}})});}_0x36cc51=_[_0x04ca('0x3f')]({},_0x36cc51,_0x4d0bf8[_0x04ca('0x41')]);var _0x18c46e={'where':_0x36cc51[_0x04ca('0x3c')]};return db[_0x04ca('0x2c')][_0x04ca('0x20')](_0x18c46e)[_0x04ca('0x25')](function(_0x513484){_0x6d4610[_0x04ca('0x20')]=_0x513484;if(_0x4d0bf8[_0x04ca('0x35')][_0x04ca('0x42')]){_0x36cc51[_0x04ca('0x43')]=[{'all':!![]}];}return db[_0x04ca('0x2c')][_0x04ca('0x44')](_0x36cc51);})[_0x04ca('0x25')](function(_0x54a65f){_0x6d4610[_0x04ca('0x45')]=_0x54a65f;return _0x6d4610;})[_0x04ca('0x25')](respondWithFilteredResult(_0x54640e,_0x36cc51))[_0x04ca('0x46')](handleError(_0x54640e,null));};exports['show']=function(_0x5d48fe,_0x22ccae){var _0x42c8af={'raw':![],'where':{'id':_0x5d48fe[_0x04ca('0x47')]['id']}},_0x596a9a={};_0x596a9a[_0x04ca('0x34')]=_[_0x04ca('0x31')](db[_0x04ca('0x2c')]['rawAttributes']);_0x596a9a[_0x04ca('0x35')]=_[_0x04ca('0x31')](_0x5d48fe[_0x04ca('0x35')]);_0x596a9a[_0x04ca('0x32')]=_[_0x04ca('0x33')](_0x596a9a[_0x04ca('0x34')],_0x596a9a[_0x04ca('0x35')]);_0x42c8af[_0x04ca('0x36')]=_['intersection'](_0x596a9a[_0x04ca('0x34')],qs['fields'](_0x5d48fe[_0x04ca('0x35')]['fields']));_0x42c8af[_0x04ca('0x36')]=_0x42c8af[_0x04ca('0x36')]['length']?_0x42c8af[_0x04ca('0x36')]:_0x596a9a[_0x04ca('0x34')];if(_0x5d48fe[_0x04ca('0x35')][_0x04ca('0x42')]){_0x42c8af[_0x04ca('0x43')]=[{'all':!![]}];}_0x42c8af=_['merge']({},_0x42c8af,_0x5d48fe[_0x04ca('0x41')]);return db[_0x04ca('0x2c')][_0x04ca('0x48')](_0x42c8af)[_0x04ca('0x25')](handleEntityNotFound(_0x22ccae,null))[_0x04ca('0x25')](respondWithResult(_0x22ccae,null))[_0x04ca('0x46')](handleError(_0x22ccae,null));};exports['create']=function(_0x42f50f,_0x1170f7){return db[_0x04ca('0x2c')][_0x04ca('0x49')](_0x42f50f[_0x04ca('0x4a')],{})['then'](respondWithResult(_0x1170f7,0xc9))['catch'](handleError(_0x1170f7,null));};exports[_0x04ca('0x4b')]=function(_0x38ca35,_0x3c399b){if(_0x38ca35[_0x04ca('0x4a')]['id']){delete _0x38ca35['body']['id'];}return db[_0x04ca('0x2c')][_0x04ca('0x48')]({'where':{'id':_0x38ca35[_0x04ca('0x47')]['id']}})[_0x04ca('0x25')](handleEntityNotFound(_0x3c399b,null))[_0x04ca('0x25')](saveUpdates(_0x38ca35['body'],null))[_0x04ca('0x25')](respondWithResult(_0x3c399b,null))['catch'](handleError(_0x3c399b,null));};exports[_0x04ca('0x4c')]=function(_0xaf9ac9,_0x22ed6e){return db[_0x04ca('0x2c')][_0x04ca('0x4c')]()['then'](respondWithResult(_0x22ed6e,null))['catch'](handleError(_0x22ed6e,null));};exports[_0x04ca('0x4d')]=function(_0x2f5a9a,_0x5ac427,_0x13c6e1){var _0x59d0a5=require('../../components/encryptor');var _0x15aab5=![];var _0x7d3443={};if(_0x2f5a9a[_0x04ca('0x35')]['type']&&_0x2f5a9a['query'][_0x04ca('0x2f')]===_0x04ca('0x4e')){_0x7d3443[_0x04ca('0x4e')]=_0x2f5a9a[_0x04ca('0x47')]['id'];}else{_0x7d3443['id']=_0x2f5a9a[_0x04ca('0x47')]['id'];}return db[_0x04ca('0x2c')][_0x04ca('0x48')]({'where':_0x7d3443,'attributes':['id','value'],'raw':!![]})[_0x04ca('0x25')](handleEntityNotFound(_0x5ac427,null))[_0x04ca('0x25')](function(_0x1ccc8d){if(_0x1ccc8d){var _0x2427b8=_0x1ccc8d['value'];var _0x510fd3=util['format']('%s.cypher',_0x2427b8);if(fs[_0x04ca('0x4f')](_0x510fd3)){_0x15aab5=!![];return _0x59d0a5[_0x04ca('0x50')](_0x510fd3,_0x2427b8,config['secrets']['recording'])[_0x04ca('0x25')](function(){return _0x1ccc8d;});}return _0x1ccc8d;}})[_0x04ca('0x25')](function(_0x4916a6){if(_0x4916a6){var _0x4a70cd=_0x4916a6[_0x04ca('0x51')];if(!fs[_0x04ca('0x4f')](_0x4a70cd)){throw new db[(_0x04ca('0x52'))][(_0x04ca('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x4916a6['filename']){return _0x5ac427[_0x04ca('0x4d')](_0x4a70cd,_0x4916a6[_0x04ca('0x54')]+path[_0x04ca('0x55')](_0x4a70cd),function(){if(_0x15aab5){fs[_0x04ca('0x56')](_0x4a70cd);}});}else{return _0x5ac427[_0x04ca('0x4d')](_0x4a70cd,function(_0x35e87d){if(_0x15aab5){fs[_0x04ca('0x56')](_0x4a70cd);}});}}})[_0x04ca('0x46')](function(_0x8bf2df){if(_0x8bf2df[_0x04ca('0x57')]===_0x04ca('0x58')){_0x5ac427[_0x04ca('0x1b')](0x194)[_0x04ca('0x59')](_0x04ca('0x5a'));}else{return handleError(_0x5ac427,null);}});};exports[_0x04ca('0x5b')]=function(_0x303ae2,_0x14bd70,_0x2dea44){var _0x2dbca8=require(_0x04ca('0x5c'));var _0x3a0036=![];var _0x3041c2={'$and':[db[_0x04ca('0x5d')][_0x04ca('0x3c')](db['sequelize']['fn'](_0x04ca('0x5e'),db['sequelize']['col'](_0x04ca('0x4e'))),_0x303ae2[_0x04ca('0x35')]['token'])]};if(_0x303ae2[_0x04ca('0x35')][_0x04ca('0x2f')]&&_0x303ae2[_0x04ca('0x35')][_0x04ca('0x2f')]==='uniqueid'){_0x3041c2['$and']['push']({'uniqueid':_0x303ae2[_0x04ca('0x47')]['id']});}else{_0x3041c2[_0x04ca('0x5f')][_0x04ca('0x60')]({'id':_0x303ae2[_0x04ca('0x47')]['id']});}return db[_0x04ca('0x2c')][_0x04ca('0x48')]({'where':_0x3041c2,'attributes':['id',_0x04ca('0x51')],'raw':!![]})[_0x04ca('0x25')](handleEntityNotFound(_0x14bd70,null))[_0x04ca('0x25')](function(_0x39210c){if(_0x39210c){var _0x2e0f0f=util['format'](_0x04ca('0x61'),_0x39210c[_0x04ca('0x51')]);if(fs[_0x04ca('0x4f')](_0x2e0f0f)){_0x3a0036=!![];return _0x2dbca8[_0x04ca('0x50')](_0x2e0f0f,_0x39210c['value'],config['secrets']['recording'])[_0x04ca('0x25')](function(){return _0x39210c;});}return _0x39210c;}})[_0x04ca('0x25')](function(_0x50d5b3){if(_0x50d5b3){if(!fs[_0x04ca('0x4f')](_0x50d5b3['value'])){throw new db[(_0x04ca('0x52'))][(_0x04ca('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x50d5b3[_0x04ca('0x54')]){return _0x14bd70[_0x04ca('0x4d')](_0x50d5b3[_0x04ca('0x51')],_0x50d5b3[_0x04ca('0x54')]+path[_0x04ca('0x55')](_0x50d5b3[_0x04ca('0x51')]),function(){if(_0x3a0036){fs[_0x04ca('0x56')](_0x50d5b3[_0x04ca('0x51')]);}});}else{return _0x14bd70[_0x04ca('0x4d')](_0x50d5b3[_0x04ca('0x51')],function(_0x175041){if(_0x3a0036){fs[_0x04ca('0x56')](_0x50d5b3[_0x04ca('0x51')]);}});}}})[_0x04ca('0x46')](handleError(_0x14bd70,null));};exports[_0x04ca('0x26')]=function(_0x588ad1,_0x203c99){return db[_0x04ca('0x2c')][_0x04ca('0x48')]({'where':{'id':_0x588ad1[_0x04ca('0x47')]['id']}})[_0x04ca('0x25')](function(_0x22a226){if(_[_0x04ca('0x62')](_0x22a226)){throw new ReferenceError(_0x04ca('0x63'));}return _0x22a226;})['then'](function(_0x52b690){var _0x2e847d=_0x52b690['value'];logger[_0x04ca('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x2e847d);if(!_[_0x04ca('0x62')](_0x52b690['value'])&&fs[_0x04ca('0x4f')](_0x2e847d)){logger[_0x04ca('0x64')](_0x04ca('0x65')+_0x2e847d+_0x04ca('0x66'));fs[_0x04ca('0x67')](_0x2e847d);}_0x2e847d=_0x2e847d+'.cypher';if(!_[_0x04ca('0x62')](_0x52b690[_0x04ca('0x51')])&&fs['existsSync'](_0x2e847d)){logger[_0x04ca('0x64')](_0x04ca('0x65')+_0x2e847d+_0x04ca('0x66'));fs[_0x04ca('0x67')](_0x2e847d);}return _0x52b690;})[_0x04ca('0x25')](function(_0xead612){if(!_0xead612)throw new InternalError();return _0xead612[_0x04ca('0x26')]();})[_0x04ca('0x25')](function(){_0x203c99[_0x04ca('0x1b')](0xcc)[_0x04ca('0x68')]();})[_0x04ca('0x46')](handleError(_0x203c99,null));};function getBucketslist(_0x3b7d4c,_0x3bb458,_0x1f5c4d){return new Promise(function(_0x438f62,_0x552532){var _0x3221bb=new AWS['S3']({'accessKeyId':_0x3bb458,'secretAccessKey':_0x3b7d4c,'region':_0x1f5c4d});_0x3221bb[_0x04ca('0x69')]({},function(_0x4a82ed,_0x35eee6){if(_0x4a82ed){return _0x552532(_0x4a82ed);}else{return _0x438f62(_0x35eee6);}});});}function createBucket(_0x5deb9c,_0xaca1c4,_0x23792c,_0x4367f0){return new Promise(function(_0x171be2,_0x34bb4e){var _0x350285=new AWS['S3']({'accessKeyId':_0xaca1c4,'secretAccessKey':_0x5deb9c,'region':_0x23792c});_0x350285[_0x04ca('0x6a')]({'Bucket':_0x4367f0},function(_0x5d43e6,_0x31bb3d){if(_0x5d43e6){return _0x34bb4e(_0x5d43e6);}else{return _0x171be2(_0x31bb3d);}});});}function uploadFile(_0x2fb17f,_0x5237cf,_0x5804db,_0x216fcf,_0x2b0bf8,_0x4412d2){return new Promise(function(_0x305472,_0x29899b){var _0x1eaa04=new AWS['S3']({'accessKeyId':_0x5237cf,'secretAccessKey':_0x2fb17f,'region':_0x5804db});_0x1eaa04[_0x04ca('0x6b')]({'Bucket':_0x216fcf,'Key':_0x2b0bf8,'Body':_0x4412d2},function(_0x3ff99b,_0x570306){if(_0x3ff99b){return _0x29899b(_0x3ff99b);}else{return _0x305472(_0x570306);}});});}function startTranscribe(_0x398eef,_0x228e9c,_0xaca239,_0x4d0478,_0x55ec1a,_0x372876){return new Promise(function(_0x250b94,_0x2dad87){var _0x4b7dbc=new AWS[(_0x04ca('0x6c'))]({'accessKeyId':_0x228e9c,'secretAccessKey':_0x398eef,'region':_0xaca239});_0x4b7dbc[_0x04ca('0x6d')]({'TranscriptionJobName':_0x4d0478,'LanguageCode':_0x55ec1a,'Media':{'MediaFileUri':_0x372876}},function(_0x1e8bc9,_0x3c8228){if(_0x1e8bc9){return _0x2dad87(_0x1e8bc9);}else{return _0x250b94(_0x3c8228);}});});}function transcribe(_0x383fe8,_0x4d5a31,_0x6c932c,_0x7ea747,_0x329410,_0x31470d,_0x28bdff){return new Promise(function(_0x1c7c91,_0x959d28){var _0x469810={};logger[_0x04ca('0x64')](util[_0x04ca('0x6e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x383fe8,_0x329410));return uploadFile(_0x4d5a31,_0x6c932c,_0x7ea747,_0x329410,path['basename'](_0x31470d),fs['readFileSync'](_0x31470d))[_0x04ca('0x25')](function(_0x3cd089){logger['info'](util[_0x04ca('0x6e')](_0x04ca('0x6f'),_0x383fe8,_0x329410,_0x3cd089[_0x04ca('0x70')]));_0x469810[_0x04ca('0x71')]=_0x3cd089['Bucket'];_0x469810['location']=_0x3cd089[_0x04ca('0x70')];logger['info'](util['format'](_0x04ca('0x72'),_0x383fe8));return startTranscribe(_0x4d5a31,_0x6c932c,_0x7ea747,uuidv4(),_0x28bdff,_0x3cd089[_0x04ca('0x70')]);})[_0x04ca('0x25')](function(_0x12400e){logger[_0x04ca('0x64')](util[_0x04ca('0x6e')](_0x04ca('0x73'),_0x383fe8,_0x12400e[_0x04ca('0x74')]['TranscriptionJobName']));_0x469810[_0x04ca('0x75')]=_0x12400e[_0x04ca('0x74')]['TranscriptionJobName'];_0x469810[_0x04ca('0x76')]=_0x12400e[_0x04ca('0x74')]['TranscriptionJobStatus'];return _0x1c7c91(_0x469810);})['catch'](function(_0x4115ab){return _0x959d28(_0x4115ab);});});}exports[_0x04ca('0x77')]=function(_0x2a4164,_0x4961cc,_0x3a0a6f){var _0x24c7b2;var _0xbaebf6;var _0x209b22;var _0x2b10de=require(_0x04ca('0x5c'));return db[_0x04ca('0x2c')][_0x04ca('0x78')]({'where':{'id':_0x2a4164[_0x04ca('0x47')]['id']}})[_0x04ca('0x25')](function(_0x557b74){if(_0x557b74){var _0x295c45=util['format'](_0x04ca('0x61'),_0x557b74[_0x04ca('0x51')]);if(fs['existsSync'](_0x295c45)){cypher=!![];return _0x2b10de[_0x04ca('0x50')](_0x295c45,_0x557b74[_0x04ca('0x51')],config[_0x04ca('0x79')][_0x04ca('0x7a')])[_0x04ca('0x25')](function(){return _0x557b74;});}return _0x557b74;}})['then'](function(_0x7ef534){if(!_0x7ef534){throw new db[(_0x04ca('0x52'))][(_0x04ca('0x53'))]('Voice\x20Recording\x20not\x20found');}_0xbaebf6=_0x7ef534;return db[_0x04ca('0x7b')][_0x04ca('0x78')]({'where':{'id':0x1}});})[_0x04ca('0x25')](handleEntityNotFound(_0x4961cc,null))[_0x04ca('0x25')](function(_0x63c25f){if(_0x63c25f){_0x24c7b2=_0x63c25f;if(!_0x24c7b2['transcribe']||!_0x24c7b2[_0x04ca('0x7c')]||!_0x24c7b2['transcribeRegion']||!_0x24c7b2[_0x04ca('0x7d')]||!_0x24c7b2[_0x04ca('0x71')]){throw new db['Sequelize'][(_0x04ca('0x53'))](_0x04ca('0x7e'));}if(_0x2a4164[_0x04ca('0x4a')][_0x04ca('0x7f')]&&(!_0x24c7b2[_0x04ca('0x80')]||!_0x24c7b2['sentimentAccountId']||!_0x24c7b2[_0x04ca('0x81')]||!_0x24c7b2[_0x04ca('0x7d')]||!_0x24c7b2[_0x04ca('0x71')])){throw new db['Sequelize'][(_0x04ca('0x53'))](_0x04ca('0x82'));}return db[_0x04ca('0x83')][_0x04ca('0x78')]({'where':{'id':_0x24c7b2[_0x04ca('0x7c')]}});}})[_0x04ca('0x25')](function(_0x103cc8){if(!_0x103cc8){throw new db[(_0x04ca('0x52'))][(_0x04ca('0x53'))](_0x04ca('0x84'));}if(!_0x103cc8[_0x04ca('0x85')]||!_0x103cc8[_0x04ca('0x86')]){throw new db[(_0x04ca('0x52'))]['ValidationError'](_0x04ca('0x87'));}_0x209b22=_0x103cc8;return getBucketslist(_0x209b22[_0x04ca('0x85')],_0x209b22[_0x04ca('0x86')],_0x24c7b2[_0x04ca('0x88')]);})['then'](function(_0x2680cf){if(_0x2680cf&&_0x2680cf[_0x04ca('0x89')]){var _0x133a23=_[_0x04ca('0x48')](_0x2680cf[_0x04ca('0x89')],function(_0x55d93e){return _0x55d93e[_0x04ca('0x8a')]===_0x24c7b2[_0x04ca('0x71')];});if(!_0x133a23){logger['info'](util['format'](_0x04ca('0x8b'),_0x2a4164[_0x04ca('0x47')]['id'],_0x24c7b2['bucket']));return createBucket(_0x209b22[_0x04ca('0x85')],_0x209b22[_0x04ca('0x86')],_0x24c7b2['transcribeRegion'],_0x24c7b2[_0x04ca('0x71')]);}logger[_0x04ca('0x64')](util[_0x04ca('0x6e')](_0x04ca('0x8c'),_0x2a4164[_0x04ca('0x47')]['id'],_0x24c7b2['bucket']));return;}})['then'](function(_0x171a28){if(_0xbaebf6[_0x04ca('0x76')]===_0x04ca('0x8d')){return transcribe(_0x2a4164['params']['id'],_0x209b22[_0x04ca('0x85')],_0x209b22[_0x04ca('0x86')],_0x24c7b2[_0x04ca('0x88')],_0x24c7b2[_0x04ca('0x71')],_0xbaebf6['value'],_0x24c7b2[_0x04ca('0x7d')]);}else{logger['info'](util['format'](_0x04ca('0x8e'),_0x2a4164['params']['id']));return{'transcribeStatus':_0x04ca('0x8f')};}})[_0x04ca('0x25')](function(_0x130a9c){if(_0x130a9c){_0x130a9c[_0x04ca('0x90')]=_0x2a4164[_0x04ca('0x4a')][_0x04ca('0x7f')];return _0xbaebf6[_0x04ca('0x91')](_0x130a9c);}})[_0x04ca('0x25')](respondWithResult(_0x4961cc,null))['catch'](handleError(_0x4961cc,null));};function writeFile(_0x2ee948,_0x3e91e4){return new Promise(function(_0x5acf31,_0x19b1f1){fs['writeFile'](_0x3e91e4,_0x2ee948,function(_0x318773,_0x1bbe3a){if(_0x318773){return _0x19b1f1(_0x318773);}else{return _0x5acf31(_0x1bbe3a);}});});}exports[_0x04ca('0x92')]=function(_0x41d670,_0x56cace,_0x1fa8ad){return db[_0x04ca('0x2c')][_0x04ca('0x78')]({'where':{'id':_0x41d670['params']['id']}})[_0x04ca('0x25')](handleEntityNotFound(_0x56cace))['then'](function(_0x24f7a1){if(_0x24f7a1&&_0x24f7a1[_0x04ca('0x93')]){var _0x30345c=_0x24f7a1['fileText'];var _0x45a8c3=config[_0x04ca('0x94')]+_0x04ca('0x95')+_0x24f7a1['id']+_0x04ca('0x96');if(fs[_0x04ca('0x4f')](_0x45a8c3)){return _0x45a8c3;}return writeFile(_0x30345c,_0x45a8c3)['then'](function(){return _0x45a8c3;});}else{throw new db[(_0x04ca('0x52'))][(_0x04ca('0x53'))](_0x04ca('0x97'));}})[_0x04ca('0x25')](function(_0x575b24){return _0x56cace[_0x04ca('0x4d')](_0x575b24);})[_0x04ca('0x46')](handleError(_0x56cace));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2be898a..d24387a 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 _0x207d=['exports','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x207d,0x10d));var _0xd207=function(_0x14f487,_0x38564e){_0x14f487=_0x14f487-0x0;var _0x546284=_0x207d[_0x14f487];return _0x546284;};'use strict';var attributes=require(_0xd207('0x0'));module[_0xd207('0x1')]=function(_0x302062,_0x27a1dc){return _0x302062['define'](_0xd207('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd207('0x3'),'fields':[_0xd207('0x3')]},{'name':'transcribeStatus','fields':[_0xd207('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bdb=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x6d94ed,_0x3d2dba){var _0x5a66aa=function(_0x55ba94){while(--_0x55ba94){_0x6d94ed['push'](_0x6d94ed['shift']());}};_0x5a66aa(++_0x3d2dba);}(_0x2bdb,0x105));var _0xb2bd=function(_0x392c54,_0x421876){_0x392c54=_0x392c54-0x0;var _0x340cb8=_0x2bdb[_0x392c54];return _0x340cb8;};'use strict';var attributes=require(_0xb2bd('0x0'));module['exports']=function(_0x156a93,_0x4af8e4){return _0x156a93[_0xb2bd('0x1')](_0xb2bd('0x2'),attributes,{'tableName':_0xb2bd('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb2bd('0x4')]},{'name':_0xb2bd('0x5'),'fields':[_0xb2bd('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c557b87..d8eb712 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 _0xc6ac=['Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor'];(function(_0x5a7587,_0xfb43d7){var _0x32a565=function(_0x22bca4){while(--_0x22bca4){_0x5a7587['push'](_0x5a7587['shift']());}};_0x32a565(++_0xfb43d7);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5db361,_0x341c6b){_0x5db361=_0x5db361-0x0;var _0x52b2e0=_0xc6ac[_0x5db361];return _0x52b2e0;};'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']('VoiceRecording,\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);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')](_0x33079c[_0xcc6a('0x1b')],{'raw':_0x33079c['options']?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1e')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1f')]||null:null,'limit':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x20')]||null:null})[_0xcc6a('0xf')](function(_0x51be9a){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger[_0xcc6a('0x12')]('UpdateVoiceRecording',_0x33079c,JSON[_0xcc6a('0x21')](_0x51be9a));_0x2d9585(_0x51be9a);})[_0xcc6a('0x22')](function(_0x3a00e5){logger[_0xcc6a('0x15')](_0xcc6a('0x18'),_0x3a00e5[_0xcc6a('0x17')],_0x33079c);_0x412bc7(_0x12ef33['error'](0x1f4,_0x3a00e5[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x23')]=function(_0x3514f3){var _0x5f27e5=this;return new Promise(function(_0x3afb3a,_0x3dad72){var _0x4da301=require(_0xcc6a('0x24'));var _0x8b1b2b;return db[_0xcc6a('0x25')][_0xcc6a('0x26')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xcc6a('0xf')](function(_0x3cf14c){_0x8b1b2b=_0x3cf14c;return db[_0xcc6a('0x19')]['create'](_0x3514f3[_0xcc6a('0x1b')]);})['then'](function(_0x4f67d3){if(_0x8b1b2b[_0xcc6a('0x27')]&&fs[_0xcc6a('0x28')](_0x4f67d3[_0xcc6a('0x29')])){var _0x11b481=util[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x4f67d3['value']);return _0x4da301[_0xcc6a('0x2c')](_0x4f67d3[_0xcc6a('0x29')],_0x11b481,config[_0xcc6a('0x2d')][_0xcc6a('0x2e')])[_0xcc6a('0xf')](function(){fs[_0xcc6a('0x2f')](_0x4f67d3[_0xcc6a('0x29')]);logger[_0xcc6a('0x10')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4f67d3;});}return _0x4f67d3;})[_0xcc6a('0xf')](function(_0xc8c90c){logger[_0xcc6a('0x10')](_0xcc6a('0x23'),_0x3514f3);logger[_0xcc6a('0x12')](_0xcc6a('0x23'),_0x3514f3,JSON[_0xcc6a('0x21')](_0xc8c90c));_0x3afb3a(_0xc8c90c);})['catch'](function(_0x5d2287){logger['error']('CreateVoiceRecording',_0x5d2287['message'],_0x3514f3);_0x3dad72(_0x5f27e5[_0xcc6a('0x15')](0x1f4,_0x5d2287[_0xcc6a('0x17')]));});});}; \ No newline at end of file +var _0x93e9=['http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','debug','stringify','../../components/encryptor','Setting','findOne','existsSync','value','format','%s.cypher','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x3c863c,_0x585fe4){var _0x3af15b=function(_0x483acd){while(--_0x483acd){_0x3c863c['push'](_0x3c863c['shift']());}};_0x3af15b(++_0x585fe4);}(_0x93e9,0xcc));var _0x993e=function(_0x508233,_0x4bbda4){_0x508233=_0x508233-0x0;var _0x2b60e3=_0x93e9[_0x508233];return _0x2b60e3;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['update'](_0x1acd21[_0x993e('0x18')],{'raw':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1b')]||null:null,'attributes':_0x1acd21[_0x993e('0x19')]?_0x1acd21['options'][_0x993e('0x1c')]||null:null,'limit':_0x1acd21['options']?_0x1acd21[_0x993e('0x19')][_0x993e('0x1d')]||null:null})[_0x993e('0xd')](function(_0x5ba2a1){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger[_0x993e('0x1e')](_0x993e('0x16'),_0x1acd21,JSON[_0x993e('0x1f')](_0x5ba2a1));_0x3d6109(_0x5ba2a1);})[_0x993e('0x15')](function(_0xa1c83e){logger[_0x993e('0x12')](_0x993e('0x16'),_0xa1c83e[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9[_0x993e('0x12')](0x1f4,_0xa1c83e[_0x993e('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x2756a7){var _0x279bb8=this;return new Promise(function(_0x52b727,_0x27bbf7){var _0x4f5cc1=require(_0x993e('0x20'));var _0xa03fbd;return db[_0x993e('0x21')][_0x993e('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32e332){_0xa03fbd=_0x32e332;return db[_0x993e('0x17')]['create'](_0x2756a7[_0x993e('0x18')]);})[_0x993e('0xd')](function(_0x248354){if(_0xa03fbd['callRecordingEncryption']&&fs[_0x993e('0x23')](_0x248354[_0x993e('0x24')])){var _0x1f5d51=util[_0x993e('0x25')](_0x993e('0x26'),_0x248354['value']);return _0x4f5cc1[_0x993e('0x27')](_0x248354['value'],_0x1f5d51,config[_0x993e('0x28')]['recording'])[_0x993e('0xd')](function(){fs['unlink'](_0x248354[_0x993e('0x24')]);logger[_0x993e('0xe')](_0x993e('0x29'));return _0x248354;});}return _0x248354;})[_0x993e('0xd')](function(_0xbadd6e){logger[_0x993e('0xe')]('CreateVoiceRecording',_0x2756a7);logger[_0x993e('0x1e')]('CreateVoiceRecording',_0x2756a7,JSON['stringify'](_0xbadd6e));_0x52b727(_0xbadd6e);})[_0x993e('0x15')](function(_0x497d29){logger[_0x993e('0x12')](_0x993e('0x2a'),_0x497d29[_0x993e('0x13')],_0x2756a7);_0x27bbf7(_0x279bb8[_0x993e('0x12')](0x1f4,_0x497d29[_0x993e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 7f92ffb..3dd0e74 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 _0x2ee7=['index','/describe','describe','show','create','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x4f6c67,_0x2f0e92){var _0x27c8b2=function(_0x2a9bb6){while(--_0x2a9bb6){_0x4f6c67['push'](_0x4f6c67['shift']());}};_0x27c8b2(++_0x2f0e92);}(_0x2ee7,0x75));var _0x72ee=function(_0x522b51,_0x36da00){_0x522b51=_0x522b51-0x0;var _0x3314f9=_0x2ee7[_0x522b51];return _0x3314f9;};'use strict';var multer=require(_0x72ee('0x0'));var util=require('util');var path=require(_0x72ee('0x1'));var timeout=require(_0x72ee('0x2'));var express=require(_0x72ee('0x3'));var router=express[_0x72ee('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x72ee('0x5'));var config=require('../../config/environment');var controller=require(_0x72ee('0x6'));router[_0x72ee('0x7')]('/',auth[_0x72ee('0x8')](),controller[_0x72ee('0x9')]);router[_0x72ee('0x7')](_0x72ee('0xa'),auth[_0x72ee('0x8')](),controller[_0x72ee('0xb')]);router[_0x72ee('0x7')]('/:id',auth[_0x72ee('0x8')](),controller[_0x72ee('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x72ee('0xd')]);router['put'](_0x72ee('0xe'),auth[_0x72ee('0x8')](),controller[_0x72ee('0xf')]);router[_0x72ee('0x10')](_0x72ee('0xe'),auth[_0x72ee('0x8')](),controller[_0x72ee('0x11')]);module['exports']=router; \ No newline at end of file +var _0x51cc=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x173fdf,_0x1ba573){var _0x147b6d=function(_0x5dc021){while(--_0x5dc021){_0x173fdf['push'](_0x173fdf['shift']());}};_0x147b6d(++_0x1ba573);}(_0x51cc,0x1e6));var _0xc51c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x51cc[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xc51c('0x0'));var path=require(_0xc51c('0x1'));var timeout=require(_0xc51c('0x2'));var express=require(_0xc51c('0x3'));var router=express[_0xc51c('0x4')]();var fs_extra=require(_0xc51c('0x5'));var auth=require(_0xc51c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc51c('0x7'));var controller=require(_0xc51c('0x8'));router[_0xc51c('0x9')]('/',auth[_0xc51c('0xa')](),controller[_0xc51c('0xb')]);router[_0xc51c('0x9')](_0xc51c('0xc'),auth[_0xc51c('0xa')](),controller[_0xc51c('0xd')]);router[_0xc51c('0x9')](_0xc51c('0xe'),auth[_0xc51c('0xa')](),controller[_0xc51c('0xf')]);router[_0xc51c('0x10')]('/',auth[_0xc51c('0xa')](),controller[_0xc51c('0x11')]);router[_0xc51c('0x12')](_0xc51c('0xe'),auth[_0xc51c('0xa')](),controller['update']);router[_0xc51c('0x13')](_0xc51c('0xe'),auth[_0xc51c('0xa')](),controller[_0xc51c('0x14')]);module[_0xc51c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 05fc5b4..70769e5 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 _0x8954=['attended','STRING','Yes','sequelize','exports','blind'];(function(_0x35ac48,_0x24d60b){var _0x3dcfd7=function(_0x217089){while(--_0x217089){_0x35ac48['push'](_0x35ac48['shift']());}};_0x3dcfd7(++_0x24d60b);}(_0x8954,0x93));var _0x4895=function(_0x443e5f,_0x2d733b){_0x443e5f=_0x443e5f-0x0;var _0x16aab7=_0x8954[_0x443e5f];return _0x16aab7;};'use strict';var Sequelize=require(_0x4895('0x0'));var moment=require('moment');module[_0x4895('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4895('0x2'),_0x4895('0x3'))},'result':{'type':Sequelize[_0x4895('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x4895('0x4')]},'transferercalleridname':{'type':Sequelize[_0x4895('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x4895('0x4')]},'transfererexten':{'type':Sequelize[_0x4895('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x4895('0x4')]},'transfereechannel':{'type':Sequelize[_0x4895('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x4895('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4895('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x4895('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x4895('0x4')]},'transfereeexten':{'type':Sequelize[_0x4895('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x4895('0x5'),'No')},'context':{'type':Sequelize[_0x4895('0x4')]},'extension':{'type':Sequelize[_0x4895('0x4')]}}; \ No newline at end of file +var _0x499e=['Yes','sequelize','ENUM','attended','STRING'];(function(_0x57c5da,_0xe2c98d){var _0x1e3e09=function(_0x6411fc){while(--_0x6411fc){_0x57c5da['push'](_0x57c5da['shift']());}};_0x1e3e09(++_0xe2c98d);}(_0x499e,0x182));var _0xe499=function(_0x32f417,_0x181970){_0x32f417=_0x32f417-0x0;var _0x22108f=_0x499e[_0x32f417];return _0x22108f;};'use strict';var Sequelize=require(_0xe499('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xe499('0x1')]('blind',_0xe499('0x2'))},'result':{'type':Sequelize[_0xe499('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe499('0x3')]},'transferercalleridname':{'type':Sequelize[_0xe499('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xe499('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xe499('0x3')]},'transferercontext':{'type':Sequelize[_0xe499('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe499('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xe499('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe499('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xe499('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xe499('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xe499('0x3')]},'isexternal':{'type':Sequelize[_0xe499('0x1')](_0xe499('0x4'),'No')},'context':{'type':Sequelize[_0xe499('0x3')]},'extension':{'type':Sequelize[_0xe499('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3b06963..48f8768 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 _0x94a0=['../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','status','sendStatus','stack','name','index','VoiceTransferReport','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94a0,0x107));var _0x094a=function(_0x5223f0,_0x12c73c){_0x5223f0=_0x5223f0-0x0;var _0x55dd06=_0x94a0[_0x5223f0];return _0x55dd06;};'use strict';var emlformat=require(_0x094a('0x0'));var rimraf=require(_0x094a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x094a('0x2'));var rp=require(_0x094a('0x3'));var moment=require(_0x094a('0x4'));var BPromise=require(_0x094a('0x5'));var Mustache=require(_0x094a('0x6'));var util=require(_0x094a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x094a('0x8'));var ejs=require(_0x094a('0x9'));var fs=require('fs');var fs_extra=require(_0x094a('0xa'));var _=require(_0x094a('0xb'));var squel=require('squel');var crypto=require(_0x094a('0xc'));var jsforce=require(_0x094a('0xd'));var deskjs=require(_0x094a('0xe'));var toCsv=require(_0x094a('0x8'));var querystring=require(_0x094a('0xf'));var Papa=require(_0x094a('0x10'));var Redis=require('ioredis');var authService=require(_0x094a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x094a('0x12'));var hardwareService=require(_0x094a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x094a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x094a('0x15'));var db=require(_0x094a('0x16'))['db'];function respondWithStatusCode(_0x35cb9c,_0x47eec8){_0x47eec8=_0x47eec8||0xcc;return function(_0x2d03fa){if(_0x2d03fa){return _0x35cb9c['sendStatus'](_0x47eec8);}return _0x35cb9c['status'](_0x47eec8)['end']();};}function respondWithResult(_0x11187e,_0x37d169){_0x37d169=_0x37d169||0xc8;return function(_0x11ebf0){if(_0x11ebf0){return _0x11187e['status'](_0x37d169)[_0x094a('0x17')](_0x11ebf0);}};}function respondWithFilteredResult(_0x5748ca,_0x5c1fb2){return function(_0x5f0601){if(_0x5f0601){var _0x2bc250=typeof _0x5c1fb2[_0x094a('0x18')]===_0x094a('0x19')&&typeof _0x5c1fb2[_0x094a('0x1a')]==='undefined';var _0x529123=_0x5f0601[_0x094a('0x1b')];var _0xcc98c3=_0x2bc250?0x0:_0x5c1fb2[_0x094a('0x18')];var _0x4d708e=_0x2bc250?_0x5f0601[_0x094a('0x1b')]:_0x5c1fb2[_0x094a('0x18')]+_0x5c1fb2['limit'];var _0x33997f;if(_0x4d708e>=_0x529123){_0x4d708e=_0x529123;_0x33997f=0xc8;}else{_0x33997f=0xce;}_0x5748ca['status'](_0x33997f);return _0x5748ca[_0x094a('0x1c')]('Content-Range',_0xcc98c3+'-'+_0x4d708e+'/'+_0x529123)['json'](_0x5f0601);}return null;};}function patchUpdates(_0x15268f){return function(_0x320fab){try{jsonpatch[_0x094a('0x1d')](_0x320fab,_0x15268f,!![]);}catch(_0x3ec291){return BPromise['reject'](_0x3ec291);}return _0x320fab[_0x094a('0x1e')]();};}function saveUpdates(_0xd5538d,_0xd0014d){return function(_0x1fcb6f){if(_0x1fcb6f){return _0x1fcb6f[_0x094a('0x1f')](_0xd5538d)[_0x094a('0x20')](function(_0x5ab2c8){return _0x5ab2c8;});}return null;};}function removeEntity(_0xca2c09,_0x46b9b1){return function(_0x1e68fd){if(_0x1e68fd){return _0x1e68fd[_0x094a('0x21')]()[_0x094a('0x20')](function(){_0xca2c09[_0x094a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x837a38,_0x5e5b14){return function(_0x443b26){if(!_0x443b26){_0x837a38[_0x094a('0x23')](0x194);}return _0x443b26;};}function handleError(_0x554e7c,_0x27828e){_0x27828e=_0x27828e||0x1f4;return function(_0x45d4a8){logger['error'](_0x45d4a8[_0x094a('0x24')]);if(_0x45d4a8[_0x094a('0x25')]){delete _0x45d4a8[_0x094a('0x25')];}_0x554e7c[_0x094a('0x22')](_0x27828e)['send'](_0x45d4a8);};}exports[_0x094a('0x26')]=function(_0x8206f0,_0x226ea3){var _0x4f3734={},_0x40b8ef={},_0x4217f1={'count':0x0,'rows':[]};var _0x588eac=_['map'](db[_0x094a('0x27')][_0x094a('0x28')],function(_0x17b7c5){return{'name':_0x17b7c5['fieldName'],'type':_0x17b7c5[_0x094a('0x29')][_0x094a('0x2a')]};});_0x40b8ef[_0x094a('0x2b')]=_['map'](_0x588eac,_0x094a('0x25'));_0x40b8ef['query']=_['keys'](_0x8206f0[_0x094a('0x2c')]);_0x40b8ef['filters']=_[_0x094a('0x2d')](_0x40b8ef['model'],_0x40b8ef[_0x094a('0x2c')]);_0x4f3734['attributes']=_[_0x094a('0x2d')](_0x40b8ef[_0x094a('0x2b')],qs[_0x094a('0x2e')](_0x8206f0[_0x094a('0x2c')]['fields']));_0x4f3734[_0x094a('0x2f')]=_0x4f3734['attributes']['length']?_0x4f3734['attributes']:_0x40b8ef['model'];if(!_0x8206f0[_0x094a('0x2c')][_0x094a('0x30')](_0x094a('0x31'))){_0x4f3734[_0x094a('0x1a')]=qs[_0x094a('0x1a')](_0x8206f0[_0x094a('0x2c')][_0x094a('0x1a')]);_0x4f3734['offset']=qs[_0x094a('0x18')](_0x8206f0[_0x094a('0x2c')]['offset']);}_0x4f3734['order']=qs[_0x094a('0x32')](_0x8206f0[_0x094a('0x2c')][_0x094a('0x32')]);_0x4f3734[_0x094a('0x33')]=qs[_0x094a('0x34')](_[_0x094a('0x35')](_0x8206f0['query'],_0x40b8ef[_0x094a('0x34')]),_0x588eac);if(_0x8206f0[_0x094a('0x2c')][_0x094a('0x36')]){_0x4f3734['where']=_[_0x094a('0x37')](_0x4f3734[_0x094a('0x33')],{'$or':_[_0x094a('0x38')](_0x588eac,function(_0x368c06){if(_0x368c06[_0x094a('0x29')]!==_0x094a('0x39')){var _0x54ea03={};_0x54ea03[_0x368c06['name']]={'$like':'%'+_0x8206f0[_0x094a('0x2c')][_0x094a('0x36')]+'%'};return _0x54ea03;}})});}_0x4f3734=_[_0x094a('0x37')]({},_0x4f3734,_0x8206f0['options']);var _0x5581b0={'where':_0x4f3734[_0x094a('0x33')]};return db[_0x094a('0x27')]['count'](_0x5581b0)[_0x094a('0x20')](function(_0x515a7a){_0x4217f1['count']=_0x515a7a;if(_0x8206f0[_0x094a('0x2c')]['includeAll']){_0x4f3734[_0x094a('0x3a')]=[{'all':!![]}];}return db[_0x094a('0x27')][_0x094a('0x3b')](_0x4f3734);})['then'](function(_0x4bb547){_0x4217f1[_0x094a('0x3c')]=_0x4bb547;return _0x4217f1;})['then'](respondWithFilteredResult(_0x226ea3,_0x4f3734))[_0x094a('0x3d')](handleError(_0x226ea3,null));};exports[_0x094a('0x3e')]=function(_0x594946,_0x45080d){var _0x17a3e5={'raw':!![],'where':{'id':_0x594946[_0x094a('0x3f')]['id']}},_0x1c3bac={};_0x1c3bac[_0x094a('0x2b')]=_[_0x094a('0x40')](db['VoiceTransferReport'][_0x094a('0x28')]);_0x1c3bac[_0x094a('0x2c')]=_['keys'](_0x594946['query']);_0x1c3bac[_0x094a('0x34')]=_[_0x094a('0x2d')](_0x1c3bac['model'],_0x1c3bac[_0x094a('0x2c')]);_0x17a3e5['attributes']=_['intersection'](_0x1c3bac[_0x094a('0x2b')],qs['fields'](_0x594946[_0x094a('0x2c')][_0x094a('0x2e')]));_0x17a3e5[_0x094a('0x2f')]=_0x17a3e5['attributes'][_0x094a('0x41')]?_0x17a3e5[_0x094a('0x2f')]:_0x1c3bac[_0x094a('0x2b')];if(_0x594946[_0x094a('0x2c')][_0x094a('0x42')]){_0x17a3e5[_0x094a('0x3a')]=[{'all':!![]}];}_0x17a3e5=_[_0x094a('0x37')]({},_0x17a3e5,_0x594946[_0x094a('0x43')]);return db[_0x094a('0x27')][_0x094a('0x44')](_0x17a3e5)[_0x094a('0x20')](handleEntityNotFound(_0x45080d,null))[_0x094a('0x20')](respondWithResult(_0x45080d,null))[_0x094a('0x3d')](handleError(_0x45080d,null));};exports[_0x094a('0x45')]=function(_0x399ddc,_0x135030){return db[_0x094a('0x27')][_0x094a('0x45')](_0x399ddc[_0x094a('0x46')],{})[_0x094a('0x20')](respondWithResult(_0x135030,0xc9))[_0x094a('0x3d')](handleError(_0x135030,null));};exports[_0x094a('0x1f')]=function(_0x423911,_0x244290){if(_0x423911[_0x094a('0x46')]['id']){delete _0x423911[_0x094a('0x46')]['id'];}return db[_0x094a('0x27')][_0x094a('0x44')]({'where':{'id':_0x423911[_0x094a('0x3f')]['id']}})[_0x094a('0x20')](handleEntityNotFound(_0x244290,null))['then'](saveUpdates(_0x423911['body'],null))[_0x094a('0x20')](respondWithResult(_0x244290,null))[_0x094a('0x3d')](handleError(_0x244290,null));};exports['destroy']=function(_0x14e6c1,_0x2c45a5){return db['VoiceTransferReport'][_0x094a('0x44')]({'where':{'id':_0x14e6c1[_0x094a('0x3f')]['id']}})[_0x094a('0x20')](handleEntityNotFound(_0x2c45a5,null))['then'](removeEntity(_0x2c45a5,null))[_0x094a('0x3d')](handleError(_0x2c45a5,null));};exports['describe']=function(_0x19fd54,_0x46abe7){return db[_0x094a('0x27')]['describe']()[_0x094a('0x20')](respondWithResult(_0x46abe7,null))['catch'](handleError(_0x46abe7,null));}; \ No newline at end of file +var _0x7c11=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x3c864e,_0x2883ef){var _0x26e84d=function(_0x5a6b0a){while(--_0x5a6b0a){_0x3c864e['push'](_0x3c864e['shift']());}};_0x26e84d(++_0x2883ef);}(_0x7c11,0x1bf));var _0x17c1=function(_0x45ed91,_0x3b7a15){_0x45ed91=_0x45ed91-0x0;var _0x99ae7a=_0x7c11[_0x45ed91];return _0x99ae7a;};'use strict';var emlformat=require(_0x17c1('0x0'));var rimraf=require(_0x17c1('0x1'));var zipdir=require(_0x17c1('0x2'));var jsonpatch=require(_0x17c1('0x3'));var rp=require(_0x17c1('0x4'));var moment=require(_0x17c1('0x5'));var BPromise=require(_0x17c1('0x6'));var Mustache=require(_0x17c1('0x7'));var util=require('util');var path=require(_0x17c1('0x8'));var sox=require(_0x17c1('0x9'));var csv=require('to-csv');var ejs=require(_0x17c1('0xa'));var fs=require('fs');var fs_extra=require(_0x17c1('0xb'));var _=require(_0x17c1('0xc'));var squel=require(_0x17c1('0xd'));var crypto=require(_0x17c1('0xe'));var jsforce=require(_0x17c1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x17c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x17c1('0x11'));var authService=require(_0x17c1('0x12'));var qs=require(_0x17c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x17c1('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x17c1('0x15'))['db'];function respondWithStatusCode(_0x1c71a5,_0x2bd8bb){_0x2bd8bb=_0x2bd8bb||0xcc;return function(_0x2282bf){if(_0x2282bf){return _0x1c71a5['sendStatus'](_0x2bd8bb);}return _0x1c71a5[_0x17c1('0x16')](_0x2bd8bb)['end']();};}function respondWithResult(_0x551fa7,_0xe7c5cf){_0xe7c5cf=_0xe7c5cf||0xc8;return function(_0x5f59c3){if(_0x5f59c3){return _0x551fa7[_0x17c1('0x16')](_0xe7c5cf)[_0x17c1('0x17')](_0x5f59c3);}};}function respondWithFilteredResult(_0x15b187,_0x169287){return function(_0x22ff01){if(_0x22ff01){var _0x85c640=typeof _0x169287[_0x17c1('0x18')]===_0x17c1('0x19')&&typeof _0x169287['limit']===_0x17c1('0x19');var _0x13eec0=_0x22ff01['count'];var _0x4613a1=_0x85c640?0x0:_0x169287[_0x17c1('0x18')];var _0x39c0fd=_0x85c640?_0x22ff01[_0x17c1('0x1a')]:_0x169287[_0x17c1('0x18')]+_0x169287['limit'];var _0xf4a097;if(_0x39c0fd>=_0x13eec0){_0x39c0fd=_0x13eec0;_0xf4a097=0xc8;}else{_0xf4a097=0xce;}_0x15b187[_0x17c1('0x16')](_0xf4a097);return _0x15b187[_0x17c1('0x1b')](_0x17c1('0x1c'),_0x4613a1+'-'+_0x39c0fd+'/'+_0x13eec0)[_0x17c1('0x17')](_0x22ff01);}return null;};}function patchUpdates(_0xe54b2){return function(_0x29c7c0){try{jsonpatch[_0x17c1('0x1d')](_0x29c7c0,_0xe54b2,!![]);}catch(_0x2156ff){return BPromise[_0x17c1('0x1e')](_0x2156ff);}return _0x29c7c0['save']();};}function saveUpdates(_0xa84906,_0x2e3727){return function(_0x107516){if(_0x107516){return _0x107516['update'](_0xa84906)[_0x17c1('0x1f')](function(_0x1fac80){return _0x1fac80;});}return null;};}function removeEntity(_0x300f4e,_0x32bb8c){return function(_0x2c49a3){if(_0x2c49a3){return _0x2c49a3[_0x17c1('0x20')]()[_0x17c1('0x1f')](function(){_0x300f4e[_0x17c1('0x16')](0xcc)[_0x17c1('0x21')]();});}};}function handleEntityNotFound(_0x3da69d,_0x4112f2){return function(_0x402c9d){if(!_0x402c9d){_0x3da69d[_0x17c1('0x22')](0x194);}return _0x402c9d;};}function handleError(_0x3b17b7,_0x1ed36b){_0x1ed36b=_0x1ed36b||0x1f4;return function(_0x2752e6){logger[_0x17c1('0x23')](_0x2752e6[_0x17c1('0x24')]);if(_0x2752e6[_0x17c1('0x25')]){delete _0x2752e6[_0x17c1('0x25')];}_0x3b17b7[_0x17c1('0x16')](_0x1ed36b)['send'](_0x2752e6);};}exports[_0x17c1('0x26')]=function(_0x1f68ac,_0x5710ef){var _0x438654={},_0x415a96={},_0x4a90ca={'count':0x0,'rows':[]};var _0x55b90b=_[_0x17c1('0x27')](db[_0x17c1('0x28')][_0x17c1('0x29')],function(_0x9de27b){return{'name':_0x9de27b[_0x17c1('0x2a')],'type':_0x9de27b['type'][_0x17c1('0x2b')]};});_0x415a96[_0x17c1('0x2c')]=_[_0x17c1('0x27')](_0x55b90b,_0x17c1('0x25'));_0x415a96[_0x17c1('0x2d')]=_[_0x17c1('0x2e')](_0x1f68ac['query']);_0x415a96[_0x17c1('0x2f')]=_[_0x17c1('0x30')](_0x415a96[_0x17c1('0x2c')],_0x415a96[_0x17c1('0x2d')]);_0x438654[_0x17c1('0x31')]=_[_0x17c1('0x30')](_0x415a96[_0x17c1('0x2c')],qs[_0x17c1('0x32')](_0x1f68ac[_0x17c1('0x2d')]['fields']));_0x438654['attributes']=_0x438654[_0x17c1('0x31')][_0x17c1('0x33')]?_0x438654[_0x17c1('0x31')]:_0x415a96[_0x17c1('0x2c')];if(!_0x1f68ac['query'][_0x17c1('0x34')](_0x17c1('0x35'))){_0x438654[_0x17c1('0x36')]=qs[_0x17c1('0x36')](_0x1f68ac[_0x17c1('0x2d')][_0x17c1('0x36')]);_0x438654['offset']=qs[_0x17c1('0x18')](_0x1f68ac[_0x17c1('0x2d')][_0x17c1('0x18')]);}_0x438654[_0x17c1('0x37')]=qs['sort'](_0x1f68ac['query'][_0x17c1('0x38')]);_0x438654['where']=qs[_0x17c1('0x2f')](_['pick'](_0x1f68ac[_0x17c1('0x2d')],_0x415a96['filters']),_0x55b90b);if(_0x1f68ac[_0x17c1('0x2d')][_0x17c1('0x39')]){_0x438654[_0x17c1('0x3a')]=_[_0x17c1('0x3b')](_0x438654[_0x17c1('0x3a')],{'$or':_['map'](_0x55b90b,function(_0x3b59bf){if(_0x3b59bf[_0x17c1('0x3c')]!==_0x17c1('0x3d')){var _0x431a18={};_0x431a18[_0x3b59bf[_0x17c1('0x25')]]={'$like':'%'+_0x1f68ac[_0x17c1('0x2d')][_0x17c1('0x39')]+'%'};return _0x431a18;}})});}_0x438654=_['merge']({},_0x438654,_0x1f68ac[_0x17c1('0x3e')]);var _0x1c0111={'where':_0x438654[_0x17c1('0x3a')]};return db[_0x17c1('0x28')]['count'](_0x1c0111)[_0x17c1('0x1f')](function(_0x50312f){_0x4a90ca[_0x17c1('0x1a')]=_0x50312f;if(_0x1f68ac[_0x17c1('0x2d')][_0x17c1('0x3f')]){_0x438654['include']=[{'all':!![]}];}return db[_0x17c1('0x28')][_0x17c1('0x40')](_0x438654);})[_0x17c1('0x1f')](function(_0x24649f){_0x4a90ca[_0x17c1('0x41')]=_0x24649f;return _0x4a90ca;})[_0x17c1('0x1f')](respondWithFilteredResult(_0x5710ef,_0x438654))[_0x17c1('0x42')](handleError(_0x5710ef,null));};exports[_0x17c1('0x43')]=function(_0x49bc24,_0x305602){var _0x5ae160={'raw':!![],'where':{'id':_0x49bc24[_0x17c1('0x44')]['id']}},_0x451100={};_0x451100[_0x17c1('0x2c')]=_[_0x17c1('0x2e')](db[_0x17c1('0x28')][_0x17c1('0x29')]);_0x451100[_0x17c1('0x2d')]=_['keys'](_0x49bc24[_0x17c1('0x2d')]);_0x451100[_0x17c1('0x2f')]=_['intersection'](_0x451100[_0x17c1('0x2c')],_0x451100[_0x17c1('0x2d')]);_0x5ae160[_0x17c1('0x31')]=_[_0x17c1('0x30')](_0x451100['model'],qs[_0x17c1('0x32')](_0x49bc24[_0x17c1('0x2d')][_0x17c1('0x32')]));_0x5ae160['attributes']=_0x5ae160[_0x17c1('0x31')][_0x17c1('0x33')]?_0x5ae160[_0x17c1('0x31')]:_0x451100[_0x17c1('0x2c')];if(_0x49bc24[_0x17c1('0x2d')][_0x17c1('0x3f')]){_0x5ae160[_0x17c1('0x45')]=[{'all':!![]}];}_0x5ae160=_['merge']({},_0x5ae160,_0x49bc24[_0x17c1('0x3e')]);return db[_0x17c1('0x28')][_0x17c1('0x46')](_0x5ae160)[_0x17c1('0x1f')](handleEntityNotFound(_0x305602,null))[_0x17c1('0x1f')](respondWithResult(_0x305602,null))[_0x17c1('0x42')](handleError(_0x305602,null));};exports[_0x17c1('0x47')]=function(_0xcb2ea2,_0x4d5369){return db[_0x17c1('0x28')][_0x17c1('0x47')](_0xcb2ea2[_0x17c1('0x48')],{})['then'](respondWithResult(_0x4d5369,0xc9))[_0x17c1('0x42')](handleError(_0x4d5369,null));};exports['update']=function(_0x50d8d3,_0x1320fa){if(_0x50d8d3[_0x17c1('0x48')]['id']){delete _0x50d8d3[_0x17c1('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x50d8d3[_0x17c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1320fa,null))[_0x17c1('0x1f')](saveUpdates(_0x50d8d3[_0x17c1('0x48')],null))[_0x17c1('0x1f')](respondWithResult(_0x1320fa,null))[_0x17c1('0x42')](handleError(_0x1320fa,null));};exports[_0x17c1('0x20')]=function(_0x725245,_0x63bb6d){return db[_0x17c1('0x28')][_0x17c1('0x46')]({'where':{'id':_0x725245[_0x17c1('0x44')]['id']}})[_0x17c1('0x1f')](handleEntityNotFound(_0x63bb6d,null))[_0x17c1('0x1f')](removeEntity(_0x63bb6d,null))[_0x17c1('0x42')](handleError(_0x63bb6d,null));};exports[_0x17c1('0x49')]=function(_0x7c6fc0,_0x464116){return db['VoiceTransferReport']['describe']()[_0x17c1('0x1f')](respondWithResult(_0x464116,null))[_0x17c1('0x42')](handleError(_0x464116,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6309c6d..0f89fe0 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 _0x59e6=['VoiceTransferReport','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define'];(function(_0x676e18,_0x10b8c0){var _0x4c10c9=function(_0x8731f3){while(--_0x8731f3){_0x676e18['push'](_0x676e18['shift']());}};_0x4c10c9(++_0x10b8c0);}(_0x59e6,0x1f0));var _0x659e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x59e6[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x659e('0x0'));var util=require('util');var logger=require(_0x659e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x659e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x659e('0x3'));var rimraf=require(_0x659e('0x4'));var config=require(_0x659e('0x5'));var attributes=require(_0x659e('0x6'));module['exports']=function(_0x5eb499,_0x2afd12){return _0x5eb499[_0x659e('0x7')](_0x659e('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaec=['./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1dded2,_0x46dbbc){var _0x3dfe8c=function(_0x88b322){while(--_0x88b322){_0x1dded2['push'](_0x1dded2['shift']());}};_0x3dfe8c(++_0x46dbbc);}(_0xcaec,0x10c));var _0xccae=function(_0x115400,_0xa46198){_0x115400=_0x115400-0x0;var _0xc96d5d=_0xcaec[_0x115400];return _0xc96d5d;};'use strict';var _=require(_0xccae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xccae('0x1'));var moment=require(_0xccae('0x2'));var BPromise=require(_0xccae('0x3'));var rp=require(_0xccae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccae('0x5'));var config=require(_0xccae('0x6'));var attributes=require(_0xccae('0x7'));module['exports']=function(_0x5debe3,_0x2337a1){return _0x5debe3[_0xccae('0x8')](_0xccae('0x9'),attributes,{'tableName':_0xccae('0xa'),'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 ffb0452..c785e2b 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 _0x7386=['code','message','result','VoiceTransferReport','create','body','options','raw','info','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7386,0xe3));var _0x6738=function(_0x559d6c,_0x124742){_0x559d6c=_0x559d6c-0x0;var _0x40efda=_0x7386[_0x559d6c];return _0x40efda;};'use strict';var _=require(_0x6738('0x0'));var util=require(_0x6738('0x1'));var moment=require(_0x6738('0x2'));var BPromise=require(_0x6738('0x3'));var rs=require(_0x6738('0x4'));var fs=require('fs');var Redis=require(_0x6738('0x5'));var db=require(_0x6738('0x6'))['db'];var utils=require(_0x6738('0x7'));var logger=require(_0x6738('0x8'))(_0x6738('0x9'));var config=require('../../config/environment');var jayson=require(_0x6738('0xa'));var client=jayson[_0x6738('0xb')][_0x6738('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c3db6,_0x1c9506,_0x352b10){return new BPromise(function(_0x96ccef,_0x2ca10c){return client[_0x6738('0xd')](_0x1c3db6,_0x352b10)[_0x6738('0xe')](function(_0x3ac59a){logger['info'](_0x6738('0xf'),_0x1c9506,'request\x20sent');logger[_0x6738('0x10')](_0x6738('0x11'),_0x1c9506,_0x6738('0x12'),JSON[_0x6738('0x13')](_0x3ac59a));if(_0x3ac59a[_0x6738('0x14')]){if(_0x3ac59a['error'][_0x6738('0x15')]===0x1f4){logger['error'](_0x6738('0xf'),_0x1c9506,_0x3ac59a[_0x6738('0x14')]['message']);return _0x2ca10c(_0x3ac59a[_0x6738('0x14')][_0x6738('0x16')]);}logger[_0x6738('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x1c9506,_0x3ac59a[_0x6738('0x14')][_0x6738('0x16')]);return _0x96ccef(_0x3ac59a[_0x6738('0x14')][_0x6738('0x16')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1c9506,'request\x20sent');_0x96ccef(_0x3ac59a[_0x6738('0x17')][_0x6738('0x16')]);}})['catch'](function(_0x417a81){logger[_0x6738('0x14')](_0x6738('0xf'),_0x1c9506,_0x417a81);_0x2ca10c(_0x417a81);});});}exports['CreateVoiceTransferReport']=function(_0x77586b){var _0x55a1b8=this;return new Promise(function(_0x5f0258,_0x41ef78){return db[_0x6738('0x18')][_0x6738('0x19')](_0x77586b[_0x6738('0x1a')],{'raw':_0x77586b[_0x6738('0x1b')]?_0x77586b[_0x6738('0x1b')][_0x6738('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4c4b73){logger[_0x6738('0x1d')](_0x6738('0x1e'),_0x77586b);logger[_0x6738('0x10')](_0x6738('0x1e'),_0x77586b,JSON['stringify'](_0x4c4b73));_0x5f0258(_0x4c4b73);})['catch'](function(_0x17e671){logger[_0x6738('0x14')](_0x6738('0x1e'),_0x17e671['message'],_0x77586b);_0x41ef78(_0x55a1b8[_0x6738('0x14')](0x1f4,_0x17e671[_0x6738('0x16')]));});});}; \ No newline at end of file +var _0x643d=['then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateVoiceTransferReport','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x643d,0x1af));var _0xd643=function(_0x42c96b,_0xeba7de){_0x42c96b=_0x42c96b-0x0;var _0x38e61a=_0x643d[_0x42c96b];return _0x38e61a;};'use strict';var _=require(_0xd643('0x0'));var util=require(_0xd643('0x1'));var moment=require(_0xd643('0x2'));var BPromise=require(_0xd643('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd643('0x4'));var db=require(_0xd643('0x5'))['db'];var utils=require(_0xd643('0x6'));var logger=require(_0xd643('0x7'))('rpc');var config=require(_0xd643('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd643('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9f7a60,_0x256b82,_0x460f7c){return new BPromise(function(_0x8df328,_0x144c4e){return client[_0xd643('0xa')](_0x9f7a60,_0x460f7c)[_0xd643('0xb')](function(_0x3f5be2){logger['info'](_0xd643('0xc'),_0x256b82,'request\x20sent');logger[_0xd643('0xd')](_0xd643('0xe'),_0x256b82,_0xd643('0xf'),JSON['stringify'](_0x3f5be2));if(_0x3f5be2[_0xd643('0x10')]){if(_0x3f5be2[_0xd643('0x10')][_0xd643('0x11')]===0x1f4){logger[_0xd643('0x10')](_0xd643('0xc'),_0x256b82,_0x3f5be2[_0xd643('0x10')][_0xd643('0x12')]);return _0x144c4e(_0x3f5be2['error'][_0xd643('0x12')]);}logger[_0xd643('0x10')](_0xd643('0xc'),_0x256b82,_0x3f5be2['error']['message']);return _0x8df328(_0x3f5be2[_0xd643('0x10')][_0xd643('0x12')]);}else{logger[_0xd643('0x13')](_0xd643('0xc'),_0x256b82,_0xd643('0xf'));_0x8df328(_0x3f5be2[_0xd643('0x14')][_0xd643('0x12')]);}})[_0xd643('0x15')](function(_0x395749){logger[_0xd643('0x10')](_0xd643('0xc'),_0x256b82,_0x395749);_0x144c4e(_0x395749);});});}exports[_0xd643('0x16')]=function(_0x2e3135){var _0x11dd63=this;return new Promise(function(_0x3d94da,_0x30a34a){return db['VoiceTransferReport'][_0xd643('0x17')](_0x2e3135[_0xd643('0x18')],{'raw':_0x2e3135[_0xd643('0x19')]?_0x2e3135['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c925d){logger[_0xd643('0x13')](_0xd643('0x16'),_0x2e3135);logger[_0xd643('0xd')](_0xd643('0x16'),_0x2e3135,JSON['stringify'](_0x4c925d));_0x3d94da(_0x4c925d);})[_0xd643('0x15')](function(_0x24224c){logger['error']('CreateVoiceTransferReport',_0x24224c[_0xd643('0x12')],_0x2e3135);_0x30a34a(_0x11dd63[_0xd643('0x10')](0x1f4,_0x24224c[_0xd643('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8814b54..41a1fbd 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(_0x1f78f1,_0x999b5){var _0x37f1da=function(_0xcaeb2b){while(--_0xcaeb2b){_0x1f78f1['push'](_0x1f78f1['shift']());}};_0x37f1da(++_0x999b5);}(_0xdace,0xc5));var _0xedac=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xdace[_0x1b5aea];return _0x15cfc6;};'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 _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x750a,0x140));var _0xa750=function(_0x2e6e9d,_0x158527){_0x2e6e9d=_0x2e6e9d-0x0;var _0x509c6a=_0x750a[_0x2e6e9d];return _0x509c6a;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('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 e77d514..c25e80d 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 _0xe28e=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','stack','name','send','status','NotFound','request','error','code','message','result','catch','findOne','VoiceChannels','all','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','path','lodash'];(function(_0x422047,_0x412f46){var _0x2667dc=function(_0x405211){while(--_0x405211){_0x422047['push'](_0x422047['shift']());}};_0x2667dc(++_0x412f46);}(_0xe28e,0x1ba));var _0xee28=function(_0x5ae511,_0x1a0a2e){_0x5ae511=_0x5ae511-0x0;var _0x533a39=_0xe28e[_0x5ae511];return _0x533a39;};'use strict';var path=require(_0xee28('0x0'));var fs=require('fs');var _=require(_0xee28('0x1'));var db=require(_0xee28('0x2'))['db'];var config=require(_0xee28('0x3'));var util=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var jayson=require(_0xee28('0x6'));var amiClient=jayson[_0xee28('0x7')][_0xee28('0x8')]({'port':0x232a});var logger=require(_0xee28('0x9'))(_0xee28('0xa'));var Redis=require(_0xee28('0xb'));config[_0xee28('0xc')]=_['defaults'](config[_0xee28('0xc')],{'host':_0xee28('0xd'),'port':0x18eb});var io=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));var Schema=require(_0xee28('0xf'));var originateValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xee28('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x13')]},'transferNumber':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]}});function emit(_0x343358,_0x1ff99e,_0x11c95d){logger['info'](_0x343358,_0x1ff99e,JSON[_0xee28('0x15')](_0x11c95d));io['to'](_0x343358)['emit'](_0x1ff99e,_0x11c95d);}function handleError(_0x37e429){return function(_0x19472a){console['log'](_0xee28('0x16'),_0x19472a,_0x19472a instanceof RangeError);logger['error'](_0x19472a[_0xee28('0x17')]);if(_0x19472a instanceof RangeError){if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429['status'](0x194)[_0xee28('0x19')](_0x19472a);}else{if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429[_0xee28('0x1a')](0x1f4)[_0xee28('0x19')](_0x19472a);}};}function checkError(){return function(_0x3674c7){if(!_0x3674c7){throw new RangeError(_0xee28('0x1b'));}return _0x3674c7;};}function respondWithRpcPromise(_0x1280f5,_0x2dbd49){return new BPromise(function(_0x4bda53,_0x342798){var _0x44d7ff=amiClient;return _0x44d7ff[_0xee28('0x1c')](_0x1280f5,_0x2dbd49)['then'](function(_0x5b500b){if(_0x5b500b[_0xee28('0x1d')]){if(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1e')]===0x1f4){return _0x342798(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}return _0x4bda53(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}else{_0x4bda53(_0x5b500b[_0xee28('0x20')]);}})[_0xee28('0x21')](function(_0x733ca8){_0x342798(_0x733ca8);});});}function getAgent(_0x281c8a){return db['User'][_0xee28('0x22')]({'where':{'id':_0x281c8a,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x54528b,_0x587aac){return new BPromise(function(_0x51eae7,_0x8373a7){var _0x884e7d=respondWithRpcPromise(_0xee28('0x23'));var _0x469889=getAgent(_0x54528b);Promise[_0xee28('0x24')]([_0x884e7d,_0x469889])[_0xee28('0x25')](function(_0xbafd67){var _0x4fcc8f=_0xbafd67[0x0];var _0x84e0ba=_0xbafd67[0x1];var _0x7390dc=_[_0xee28('0x26')](_0x4fcc8f['rows'],function(_0x14f7c4){return _0x14f7c4[_0xee28('0x27')]==_0x84e0ba['id']&&_0x14f7c4[_0xee28('0x28')]==_0x587aac;});if(_0x7390dc[_0xee28('0x29')]==0x1){_0x51eae7(_0x84e0ba);}else{_0x8373a7(new RangeError(_0xee28('0x2a')+_0x587aac+_0xee28('0x2b')));}});});}exports[_0xee28('0x2c')]=function(_0x5d2a9d,_0x15f294){logger[_0xee28('0x2d')]('originate\x20fired:',_0x5d2a9d[_0xee28('0x2e')]);var _0x34dd11=originateValidation[_0xee28('0xf')](_0x5d2a9d[_0xee28('0x2e')]);if(_0x34dd11[_0xee28('0x29')]>0x0){return _0x15f294[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x34dd11);}var _0x5a4f48=_0x5d2a9d['body']['userId'];var _0x1a8ef0=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x30')];var _0x3402ce=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x31')];var _0x5b0c20=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x32')];return getAgent(_0x5a4f48)['then'](function(_0x51b28d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x51b28d['name']);emit(util['format'](_0xee28('0x34'),_0x51b28d[_0xee28('0x18')]),'webbar:originate',{'callNumber':_0x1a8ef0,'callerId':_0x3402ce,'callbackUrl':_0x5b0c20});return _0x15f294[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x35')});})[_0xee28('0x21')](handleError(_0x15f294));};exports[_0xee28('0x36')]=function(_0x594116,_0x2a5d06){logger[_0xee28('0x2d')](_0xee28('0x37'),_0x594116[_0xee28('0x2e')]);var _0x43b587=hangupValidation[_0xee28('0xf')](_0x594116['body']);if(_0x43b587[_0xee28('0x29')]>0x0){return _0x2a5d06['status'](0x190)['json'](_0x43b587);}var _0x265ae5=_0x594116['body'][_0xee28('0x38')];var _0x5c5f08=_0x594116[_0xee28('0x2e')]['sessionId'];return getAgent(_0x265ae5)[_0xee28('0x25')](function(_0x211345){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x211345['name']);emit(util[_0xee28('0x39')]('user:%s',_0x211345[_0xee28('0x18')]),_0xee28('0x3a'),{'sessionId':_0x5c5f08});return _0x2a5d06[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3b')});})[_0xee28('0x21')](handleError(_0x2a5d06));};exports[_0xee28('0x3c')]=function(_0x5a4b9c,_0x4d9d21){logger[_0xee28('0x2d')]('answer\x20fired:',_0x5a4b9c['body']);var _0x4064cf=answerValidation[_0xee28('0xf')](_0x5a4b9c['body']);if(_0x4064cf[_0xee28('0x29')]>0x0){return _0x4d9d21[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x4064cf);}var _0x24cfaa=_0x5a4b9c[_0xee28('0x2e')][_0xee28('0x38')];var _0x1735a9=_0x5a4b9c['body'][_0xee28('0x28')];return getAgent(_0x24cfaa)[_0xee28('0x25')](function(_0x2dd024){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2dd024['name']);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x2dd024['name']),_0xee28('0x3d'),{'sessionId':_0x1735a9});return _0x4d9d21[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3e')});})[_0xee28('0x21')](handleError(_0x4d9d21));};exports[_0xee28('0x3f')]=function(_0x54ab7b,_0x36e5bb){logger['info']('hold\x20fired:',_0x54ab7b[_0xee28('0x2e')]);var _0x2f240f=holdValidation['validate'](_0x54ab7b[_0xee28('0x2e')]);if(_0x2f240f[_0xee28('0x29')]>0x0){return _0x36e5bb[_0xee28('0x1a')](0x190)['json'](_0x2f240f);}var _0x57e57e=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x38')];var _0x1bb1ac=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x57e57e)[_0xee28('0x25')](function(_0x2574c5){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2574c5[_0xee28('0x18')]);emit(util['format'](_0xee28('0x34'),_0x2574c5['name']),_0xee28('0x40'),{'sessionId':_0x1bb1ac});return _0x36e5bb[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x41')});})[_0xee28('0x21')](handleError(_0x36e5bb));};exports['unhold']=function(_0x5247fe,_0x5ca018){logger[_0xee28('0x2d')]('unhold\x20fired:',_0x5247fe['body']);var _0x659fc4=unholdValidation['validate'](_0x5247fe[_0xee28('0x2e')]);if(_0x659fc4[_0xee28('0x29')]>0x0){return _0x5ca018[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x659fc4);}var _0x398120=_0x5247fe[_0xee28('0x2e')][_0xee28('0x38')];var _0xc1bdba=_0x5247fe[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x398120)['then'](function(_0x1f3680){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x1f3680['name']);emit(util['format']('user:%s',_0x1f3680['name']),_0xee28('0x42'),{'sessionId':_0xc1bdba});return _0x5ca018[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xee28('0x21')](handleError(_0x5ca018));};exports[_0xee28('0x43')]=function(_0x204bbe,_0x39b228){logger[_0xee28('0x2d')]('calls\x20fired:',_0x39b228[_0xee28('0x2e')]);var _0x1c6696=callsValidation[_0xee28('0xf')](_0x204bbe['body']);if(_0x1c6696[_0xee28('0x29')]>0x0){return _0x39b228[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x1c6696);}var _0x47794a=_0x204bbe[_0xee28('0x2e')][_0xee28('0x38')];var _0xfcca7e=respondWithRpcPromise('VoiceChannels');var _0x161394=getAgent(_0x47794a);return Promise['all']([_0xfcca7e,_0x161394])['then'](function(_0x5b7292){var _0x333d7e=_0x5b7292[0x0];var _0x7c51d5=_0x5b7292[0x1];var _0x3cad0a=_[_0xee28('0x26')](_0x333d7e[_0xee28('0x44')],function(_0x27d96d){return _0x27d96d[_0xee28('0x27')]==_0x7c51d5['id'];});return _0x39b228[_0xee28('0x1a')](0xc8)['json']({'count':_0x3cad0a[_0xee28('0x29')],'rows':_0x3cad0a});})[_0xee28('0x21')](handleError(_0x39b228));};exports[_0xee28('0x45')]=function(_0x2b8252,_0x209c3e){logger[_0xee28('0x2d')](_0xee28('0x46'),_0x2b8252['body']);var _0x438943=conferenceValidation['validate'](_0x2b8252[_0xee28('0x2e')]);if(_0x438943[_0xee28('0x29')]>0x0){return _0x209c3e['status'](0x190)[_0xee28('0x2f')](_0x438943);}var _0x2a5fa7=_0x2b8252[_0xee28('0x2e')][_0xee28('0x38')];return getAgent(_0x2a5fa7)['then'](function(_0x209d6d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x209d6d[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x209d6d[_0xee28('0x18')]),'webbar:conference');return _0x209c3e[_0xee28('0x1a')](0xc8)['json']({'error':![],'message':_0xee28('0x47')});})[_0xee28('0x21')](handleError(_0x209c3e));};exports['transfer']=function(_0x4b222a,_0x14bc7a){logger['info'](_0xee28('0x48'),_0x4b222a[_0xee28('0x2e')]);var _0x19f81a=transferValidation[_0xee28('0xf')](_0x4b222a[_0xee28('0x2e')]);if(_0x19f81a[_0xee28('0x29')]>0x0){return _0x14bc7a[_0xee28('0x1a')](0x190)['json'](_0x19f81a);}var _0x179ce6=_0x4b222a[_0xee28('0x2e')][_0xee28('0x38')];var _0x57ded5=_0x4b222a[_0xee28('0x2e')][_0xee28('0x28')];var _0x1e190f=_0x4b222a[_0xee28('0x2e')][_0xee28('0x49')];return getAgent(_0x179ce6)[_0xee28('0x25')](function(_0x5dc31e){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x5dc31e[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x5dc31e[_0xee28('0x18')]),'webbar:transfer',{'sessionId':_0x57ded5,'transferNumber':_0x1e190f});return _0x14bc7a[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14bc7a));}; \ No newline at end of file +var _0x80d9=['validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','code','message','catch','User','then','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','callNumber','body','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','defaults','socket.io-emitter','redis'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x80d9,0x15c));var _0x980d=function(_0x1693ad,_0x1c3369){_0x1693ad=_0x1693ad-0x0;var _0x23ce6a=_0x80d9[_0x1693ad];return _0x23ce6a;};'use strict';var path=require(_0x980d('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x980d('0x1'))['db'];var config=require(_0x980d('0x2'));var util=require(_0x980d('0x3'));var BPromise=require('bluebird');var jayson=require(_0x980d('0x4'));var amiClient=jayson[_0x980d('0x5')][_0x980d('0x6')]({'port':0x232a});var logger=require(_0x980d('0x7'))(_0x980d('0x8'));var Redis=require('ioredis');config['redis']=_[_0x980d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x980d('0xa'))(new Redis(config[_0x980d('0xb')]));var Schema=require(_0x980d('0xc'));var originateValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],_0x980d('0xe')]},'callNumber':{'type':_0x980d('0xf'),'required':[!![],_0x980d('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x980d('0xe')]},'sessionId':{'type':_0x980d('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x980d('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x980d('0xf'),'required':[!![],_0x980d('0x11')]},'transferNumber':{'type':_0x980d('0xf'),'required':[!![],_0x980d('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],_0x980d('0xe')]},'sessionId':{'type':_0x980d('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x980d('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],_0x980d('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x980d('0xd'),'required':[!![],_0x980d('0xe')]}});function emit(_0x169648,_0x5824bf,_0x27dd6a){logger[_0x980d('0x13')](_0x169648,_0x5824bf,JSON['stringify'](_0x27dd6a));io['to'](_0x169648)[_0x980d('0x14')](_0x5824bf,_0x27dd6a);}function handleError(_0x4e9d73){return function(_0x23f64c){console[_0x980d('0x15')](_0x980d('0x16'),_0x23f64c,_0x23f64c instanceof RangeError);logger[_0x980d('0x17')](_0x23f64c[_0x980d('0x18')]);if(_0x23f64c instanceof RangeError){if(_0x23f64c[_0x980d('0x19')]){delete _0x23f64c[_0x980d('0x19')];}_0x4e9d73[_0x980d('0x1a')](0x194)[_0x980d('0x1b')](_0x23f64c);}else{if(_0x23f64c[_0x980d('0x19')]){delete _0x23f64c[_0x980d('0x19')];}_0x4e9d73['status'](0x1f4)['send'](_0x23f64c);}};}function checkError(){return function(_0x3cb470){if(!_0x3cb470){throw new RangeError('NotFound');}return _0x3cb470;};}function respondWithRpcPromise(_0x4e37c8,_0x124c3f){return new BPromise(function(_0x1d6286,_0x45d698){var _0xbb89e3=amiClient;return _0xbb89e3['request'](_0x4e37c8,_0x124c3f)['then'](function(_0x11cb45){if(_0x11cb45['error']){if(_0x11cb45[_0x980d('0x17')][_0x980d('0x1c')]===0x1f4){return _0x45d698(_0x11cb45['error'][_0x980d('0x1d')]);}return _0x1d6286(_0x11cb45['error']['message']);}else{_0x1d6286(_0x11cb45['result']);}})[_0x980d('0x1e')](function(_0x43f278){_0x45d698(_0x43f278);});});}function getAgent(_0x117053){return db[_0x980d('0x1f')]['findOne']({'where':{'id':_0x117053,'role':'agent'}})[_0x980d('0x20')](checkError());}function getAgentCheckSession(_0x1d5dad,_0x97ca70){return new BPromise(function(_0x1da8ea,_0x3d5f19){var _0x47b11d=respondWithRpcPromise('VoiceChannels');var _0x2830e5=getAgent(_0x1d5dad);Promise[_0x980d('0x21')]([_0x47b11d,_0x2830e5])[_0x980d('0x20')](function(_0xf00845){var _0x2dab0e=_0xf00845[0x0];var _0x25542b=_0xf00845[0x1];var _0x513693=_[_0x980d('0x22')](_0x2dab0e[_0x980d('0x23')],function(_0xaa9cd6){return _0xaa9cd6[_0x980d('0x24')]==_0x25542b['id']&&_0xaa9cd6[_0x980d('0x25')]==_0x97ca70;});if(_0x513693[_0x980d('0x26')]==0x1){_0x1da8ea(_0x25542b);}else{_0x3d5f19(new RangeError(_0x980d('0x27')+_0x97ca70+_0x980d('0x28')));}});});}exports[_0x980d('0x29')]=function(_0x59a847,_0x3671b8){logger[_0x980d('0x13')](_0x980d('0x2a'),_0x59a847['body']);var _0x5d0771=originateValidation[_0x980d('0xc')](_0x59a847['body']);if(_0x5d0771[_0x980d('0x26')]>0x0){return _0x3671b8['status'](0x190)['json'](_0x5d0771);}var _0x5a3160=_0x59a847['body']['userId'];var _0x511d25=_0x59a847['body'][_0x980d('0x2b')];var _0x3569b8=_0x59a847[_0x980d('0x2c')]['callerId'];var _0x498081=_0x59a847[_0x980d('0x2c')][_0x980d('0x2d')];return getAgent(_0x5a3160)[_0x980d('0x20')](function(_0x120bf1){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x120bf1['name']);emit(util[_0x980d('0x2f')](_0x980d('0x30'),_0x120bf1['name']),_0x980d('0x31'),{'callNumber':_0x511d25,'callerId':_0x3569b8,'callbackUrl':_0x498081});return _0x3671b8['status'](0xc8)[_0x980d('0x32')]({'error':![],'message':_0x980d('0x33')});})[_0x980d('0x1e')](handleError(_0x3671b8));};exports['hangup']=function(_0x5d8c31,_0x5d5903){logger[_0x980d('0x13')]('hangup\x20fired:',_0x5d8c31['body']);var _0x98b1b=hangupValidation[_0x980d('0xc')](_0x5d8c31[_0x980d('0x2c')]);if(_0x98b1b['length']>0x0){return _0x5d5903[_0x980d('0x1a')](0x190)[_0x980d('0x32')](_0x98b1b);}var _0x32f2f9=_0x5d8c31[_0x980d('0x2c')][_0x980d('0x34')];var _0x4e2aac=_0x5d8c31['body'][_0x980d('0x25')];return getAgent(_0x32f2f9)['then'](function(_0x5b49e2){logger['info']('entityFound:',_0x5b49e2[_0x980d('0x19')]);emit(util[_0x980d('0x2f')](_0x980d('0x30'),_0x5b49e2['name']),_0x980d('0x35'),{'sessionId':_0x4e2aac});return _0x5d5903[_0x980d('0x1a')](0xc8)[_0x980d('0x32')]({'error':![],'message':_0x980d('0x36')});})[_0x980d('0x1e')](handleError(_0x5d5903));};exports[_0x980d('0x37')]=function(_0x1221e7,_0x555417){logger[_0x980d('0x13')](_0x980d('0x38'),_0x1221e7[_0x980d('0x2c')]);var _0x5f1f04=answerValidation[_0x980d('0xc')](_0x1221e7[_0x980d('0x2c')]);if(_0x5f1f04[_0x980d('0x26')]>0x0){return _0x555417[_0x980d('0x1a')](0x190)[_0x980d('0x32')](_0x5f1f04);}var _0x45831c=_0x1221e7[_0x980d('0x2c')]['userId'];var _0x473c94=_0x1221e7['body'][_0x980d('0x25')];return getAgent(_0x45831c)[_0x980d('0x20')](function(_0x23980c){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x23980c[_0x980d('0x19')]);emit(util[_0x980d('0x2f')](_0x980d('0x30'),_0x23980c['name']),'webbar:answer',{'sessionId':_0x473c94});return _0x555417[_0x980d('0x1a')](0xc8)[_0x980d('0x32')]({'error':![],'message':_0x980d('0x39')});})[_0x980d('0x1e')](handleError(_0x555417));};exports[_0x980d('0x3a')]=function(_0x48f239,_0x1de28b){logger[_0x980d('0x13')]('hold\x20fired:',_0x48f239[_0x980d('0x2c')]);var _0x169270=holdValidation[_0x980d('0xc')](_0x48f239[_0x980d('0x2c')]);if(_0x169270[_0x980d('0x26')]>0x0){return _0x1de28b[_0x980d('0x1a')](0x190)[_0x980d('0x32')](_0x169270);}var _0x135c26=_0x48f239[_0x980d('0x2c')]['userId'];var _0xaf9c1c=_0x48f239[_0x980d('0x2c')][_0x980d('0x25')];return getAgent(_0x135c26)[_0x980d('0x20')](function(_0x2e18c6){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x2e18c6['name']);emit(util[_0x980d('0x2f')]('user:%s',_0x2e18c6[_0x980d('0x19')]),_0x980d('0x3b'),{'sessionId':_0xaf9c1c});return _0x1de28b[_0x980d('0x1a')](0xc8)[_0x980d('0x32')]({'error':![],'message':_0x980d('0x3c')});})['catch'](handleError(_0x1de28b));};exports[_0x980d('0x3d')]=function(_0x448b3c,_0x242277){logger[_0x980d('0x13')](_0x980d('0x3e'),_0x448b3c[_0x980d('0x2c')]);var _0x411b3a=unholdValidation['validate'](_0x448b3c['body']);if(_0x411b3a['length']>0x0){return _0x242277['status'](0x190)[_0x980d('0x32')](_0x411b3a);}var _0x216458=_0x448b3c[_0x980d('0x2c')][_0x980d('0x34')];var _0x177bb2=_0x448b3c[_0x980d('0x2c')]['sessionId'];return getAgent(_0x216458)[_0x980d('0x20')](function(_0x51c112){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x51c112[_0x980d('0x19')]);emit(util[_0x980d('0x2f')]('user:%s',_0x51c112['name']),_0x980d('0x3f'),{'sessionId':_0x177bb2});return _0x242277[_0x980d('0x1a')](0xc8)[_0x980d('0x32')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x242277));};exports[_0x980d('0x40')]=function(_0x4c61c8,_0x459b0e){logger[_0x980d('0x13')](_0x980d('0x41'),_0x459b0e[_0x980d('0x2c')]);var _0x20459e=callsValidation[_0x980d('0xc')](_0x4c61c8[_0x980d('0x2c')]);if(_0x20459e[_0x980d('0x26')]>0x0){return _0x459b0e['status'](0x190)['json'](_0x20459e);}var _0x899a7e=_0x4c61c8['body'][_0x980d('0x34')];var _0x21cf36=respondWithRpcPromise('VoiceChannels');var _0x2b28e4=getAgent(_0x899a7e);return Promise[_0x980d('0x21')]([_0x21cf36,_0x2b28e4])[_0x980d('0x20')](function(_0x60969d){var _0x5498aa=_0x60969d[0x0];var _0x2ccfff=_0x60969d[0x1];var _0x5e45c6=_['filter'](_0x5498aa[_0x980d('0x23')],function(_0x55a075){return _0x55a075[_0x980d('0x24')]==_0x2ccfff['id'];});return _0x459b0e['status'](0xc8)[_0x980d('0x32')]({'count':_0x5e45c6[_0x980d('0x26')],'rows':_0x5e45c6});})['catch'](handleError(_0x459b0e));};exports[_0x980d('0x42')]=function(_0x132495,_0x36f01e){logger[_0x980d('0x13')](_0x980d('0x43'),_0x132495[_0x980d('0x2c')]);var _0x343deb=conferenceValidation[_0x980d('0xc')](_0x132495[_0x980d('0x2c')]);if(_0x343deb[_0x980d('0x26')]>0x0){return _0x36f01e[_0x980d('0x1a')](0x190)[_0x980d('0x32')](_0x343deb);}var _0x4cb91f=_0x132495['body']['userId'];return getAgent(_0x4cb91f)[_0x980d('0x20')](function(_0x53a444){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x53a444[_0x980d('0x19')]);emit(util[_0x980d('0x2f')]('user:%s',_0x53a444[_0x980d('0x19')]),_0x980d('0x44'));return _0x36f01e['status'](0xc8)[_0x980d('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x980d('0x1e')](handleError(_0x36f01e));};exports['transfer']=function(_0x528e35,_0x465e03){logger[_0x980d('0x13')](_0x980d('0x45'),_0x528e35[_0x980d('0x2c')]);var _0x4dbcca=transferValidation[_0x980d('0xc')](_0x528e35['body']);if(_0x4dbcca['length']>0x0){return _0x465e03[_0x980d('0x1a')](0x190)[_0x980d('0x32')](_0x4dbcca);}var _0x3bd029=_0x528e35[_0x980d('0x2c')][_0x980d('0x34')];var _0x287d47=_0x528e35[_0x980d('0x2c')][_0x980d('0x25')];var _0x392ec3=_0x528e35[_0x980d('0x2c')]['transferNumber'];return getAgent(_0x3bd029)[_0x980d('0x20')](function(_0x4e6f36){logger[_0x980d('0x13')](_0x980d('0x2e'),_0x4e6f36['name']);emit(util[_0x980d('0x2f')](_0x980d('0x30'),_0x4e6f36[_0x980d('0x19')]),_0x980d('0x46'),{'sessionId':_0x287d47,'transferNumber':_0x392ec3});return _0x465e03['status'](0xc8)[_0x980d('0x32')]({'error':![],'message':_0x980d('0x47')});})[_0x980d('0x1e')](handleError(_0x465e03));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cc39df5..ba6bc8f 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 _0xb3be=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','/:id'];(function(_0x17aa06,_0x245bf9){var _0x5b61f4=function(_0x13e9ef){while(--_0x13e9ef){_0x17aa06['push'](_0x17aa06['shift']());}};_0x5b61f4(++_0x245bf9);}(_0xb3be,0x137));var _0xeb3b=function(_0x1c86e0,_0x30b6af){_0x1c86e0=_0x1c86e0-0x0;var _0x14a1b5=_0xb3be[_0x1c86e0];return _0x14a1b5;};'use strict';var multer=require(_0xeb3b('0x0'));var util=require(_0xeb3b('0x1'));var path=require(_0xeb3b('0x2'));var timeout=require(_0xeb3b('0x3'));var express=require(_0xeb3b('0x4'));var router=express[_0xeb3b('0x5')]();var fs_extra=require(_0xeb3b('0x6'));var auth=require(_0xeb3b('0x7'));var interaction=require(_0xeb3b('0x8'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xeb3b('0x9')](),controller['index']);router['get'](_0xeb3b('0xa'),auth[_0xeb3b('0x9')](),controller['describe']);router[_0xeb3b('0xb')](_0xeb3b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xeb3b('0xb')](_0xeb3b('0xd'),auth['isAuthenticated'](),controller[_0xeb3b('0xe')]);router['get'](_0xeb3b('0xf'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x10')]);router['get'](_0xeb3b('0x11'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x12')]);router[_0xeb3b('0xb')]('/:id/applications',auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x13')]);router[_0xeb3b('0x14')]('/',auth[_0xeb3b('0x9')](),controller['create']);router[_0xeb3b('0x14')](_0xeb3b('0xd'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x15')]);router[_0xeb3b('0x14')](_0xeb3b('0xf'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x16')]);router['post'](_0xeb3b('0x11'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x17')]);router[_0xeb3b('0x14')](_0xeb3b('0x18'),auth['isAuthenticated'](),controller[_0xeb3b('0x19')]);router[_0xeb3b('0x14')](_0xeb3b('0x1a'),controller[_0xeb3b('0x1b')]);router[_0xeb3b('0x14')](_0xeb3b('0x1c'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x1d')]);router[_0xeb3b('0x1e')](_0xeb3b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xeb3b('0x1f')](_0xeb3b('0xc'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x20')]);router[_0xeb3b('0x1f')](_0xeb3b('0xd'),auth[_0xeb3b('0x9')](),controller[_0xeb3b('0x21')]);router[_0xeb3b('0x1f')](_0xeb3b('0xf'),auth['isAuthenticated'](),controller[_0xeb3b('0x22')]);router[_0xeb3b('0x1f')](_0xeb3b('0x11'),auth[_0xeb3b('0x9')](),controller['removeAgents']);module[_0xeb3b('0x23')]=router; \ No newline at end of file +var _0x157e=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/users','/:id/applications','getApplications','create','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x33db7c,_0x3fcb11){var _0x3d55a5=function(_0x1358c5){while(--_0x1358c5){_0x33db7c['push'](_0x33db7c['shift']());}};_0x3d55a5(++_0x3fcb11);}(_0x157e,0x19a));var _0xe157=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0x157e[_0x493c8c];return _0x17344b;};'use strict';var multer=require(_0xe157('0x0'));var util=require(_0xe157('0x1'));var path=require(_0xe157('0x2'));var timeout=require(_0xe157('0x3'));var express=require(_0xe157('0x4'));var router=express[_0xe157('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe157('0x6'));var config=require(_0xe157('0x7'));var controller=require('./whatsappAccount.controller');router[_0xe157('0x8')]('/',auth[_0xe157('0x9')](),controller['index']);router[_0xe157('0x8')](_0xe157('0xa'),auth[_0xe157('0x9')](),controller[_0xe157('0xb')]);router[_0xe157('0x8')](_0xe157('0xc'),auth['isAuthenticated'](),controller[_0xe157('0xd')]);router[_0xe157('0x8')]('/:id/dispositions',auth[_0xe157('0x9')](),controller[_0xe157('0xe')]);router[_0xe157('0x8')]('/:id/canned_answers',auth[_0xe157('0x9')](),controller[_0xe157('0xf')]);router[_0xe157('0x8')](_0xe157('0x10'),auth[_0xe157('0x9')](),controller['getAgents']);router[_0xe157('0x8')](_0xe157('0x11'),auth[_0xe157('0x9')](),controller[_0xe157('0x12')]);router['post']('/',auth[_0xe157('0x9')](),controller[_0xe157('0x13')]);router['post'](_0xe157('0x14'),auth['isAuthenticated'](),controller[_0xe157('0x15')]);router[_0xe157('0x16')](_0xe157('0x17'),auth[_0xe157('0x9')](),controller[_0xe157('0x18')]);router['post'](_0xe157('0x10'),auth[_0xe157('0x9')](),controller['addAgents']);router[_0xe157('0x16')](_0xe157('0x11'),auth[_0xe157('0x9')](),controller[_0xe157('0x19')]);router[_0xe157('0x16')](_0xe157('0x1a'),controller[_0xe157('0x1b')]);router[_0xe157('0x16')](_0xe157('0x1c'),auth['isAuthenticated'](),controller[_0xe157('0x1d')]);router[_0xe157('0x1e')](_0xe157('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe157('0x1f')](_0xe157('0xc'),auth[_0xe157('0x9')](),controller[_0xe157('0x20')]);router[_0xe157('0x1f')](_0xe157('0x14'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xe157('0x17'),auth[_0xe157('0x9')](),controller['removeAnswers']);router[_0xe157('0x1f')]('/:id/users',auth[_0xe157('0x9')](),controller[_0xe157('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7d841ca..9b07178 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 _0xc9c7=['randomstring','STRING','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xc9c7,0x150));var _0x7c9c=function(_0x30aedf,_0x3e274d){_0x30aedf=_0x30aedf-0x0;var _0x44757e=_0xc9c7[_0x30aedf];return _0x44757e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7c9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c9c('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7c9c('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x7c9c('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x7c9c('0x1')]},'type':{'type':Sequelize[_0x7c9c('0x2')](_0x7c9c('0x3'),_0x7c9c('0x4'))},'accountSid':{'type':Sequelize[_0x7c9c('0x1')]},'baseUrl':{'type':Sequelize[_0x7c9c('0x1')]},'authToken':{'type':Sequelize[_0x7c9c('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7c9c('0x5');}},'notificationSound':{'type':Sequelize[_0x7c9c('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7c9c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7c9c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c9c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c9c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7c9c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7c9c('0x6')],'defaultValue':![],'comment':_0x7c9c('0x9'),'set':function(_0x313077){if(!_0x313077){this['setDataValue'](_0x7c9c('0xa'),null);}this[_0x7c9c('0xb')]('mandatoryDisposition',_0x313077);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x92f6=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','generate','twilio'];(function(_0x496369,_0x1be924){var _0x4cbfe9=function(_0x3ba23){while(--_0x3ba23){_0x496369['push'](_0x496369['shift']());}};_0x4cbfe9(++_0x1be924);}(_0x92f6,0x108));var _0x692f=function(_0x1bcebc,_0x1437e2){_0x1bcebc=_0x1bcebc-0x0;var _0x52541a=_0x92f6[_0x1bcebc];return _0x52541a;};'use strict';var Sequelize=require(_0x692f('0x0'));var rs=require('randomstring');module[_0x692f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x692f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x692f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x692f('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x692f('0x5'),_0x692f('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x692f('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x692f('0x7')],'defaultValue':function(){return _0x692f('0x8');}},'notificationSound':{'type':Sequelize[_0x692f('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x692f('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x692f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x692f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x692f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x692f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x692f('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x692f('0x9')],'defaultValue':![],'comment':_0x692f('0xc'),'set':function(_0x2cac45){if(!_0x2cac45){this[_0x692f('0xd')]('mandatoryDispositionPauseId',null);}this[_0x692f('0xd')](_0x692f('0xe'),_0x2cac45);}},'description':{'type':Sequelize[_0x692f('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 555bf60..9a9ff1a 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 _0x32de=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','WhatsappAccount','includeAll','include','rows','show','params','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','emit','getAgents','User','addApplications','transaction','sequelize','Transaction','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','list','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','error','code','request\x20sent','message','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x32de,0x7d));var _0xe32d=function(_0x55fc38,_0x19bc7d){_0x55fc38=_0x55fc38-0x0;var _0x3cd5e4=_0x32de[_0x55fc38];return _0x3cd5e4;};'use strict';var emlformat=require(_0xe32d('0x0'));var rimraf=require(_0xe32d('0x1'));var zipdir=require(_0xe32d('0x2'));var jsonpatch=require(_0xe32d('0x3'));var rp=require('request-promise');var moment=require(_0xe32d('0x4'));var BPromise=require(_0xe32d('0x5'));var Mustache=require(_0xe32d('0x6'));var util=require(_0xe32d('0x7'));var path=require('path');var sox=require(_0xe32d('0x8'));var csv=require(_0xe32d('0x9'));var ejs=require(_0xe32d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe32d('0xb'));var squel=require('squel');var crypto=require(_0xe32d('0xc'));var jsforce=require(_0xe32d('0xd'));var deskjs=require(_0xe32d('0xe'));var toCsv=require(_0xe32d('0x9'));var querystring=require(_0xe32d('0xf'));var Papa=require(_0xe32d('0x10'));var Redis=require(_0xe32d('0x11'));var authService=require(_0xe32d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe32d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe32d('0x14'));var utils=require(_0xe32d('0x15'));var config=require(_0xe32d('0x16'));var licenseUtil=require(_0xe32d('0x17'));var db=require(_0xe32d('0x18'))['db'];config[_0xe32d('0x19')]=_['defaults'](config['redis'],{'host':_0xe32d('0x1a'),'port':0x18eb});var socket=require(_0xe32d('0x1b'))(new Redis(config[_0xe32d('0x19')]));require(_0xe32d('0x1c'))[_0xe32d('0x1d')](socket);var jayson=require(_0xe32d('0x1e'));var client=jayson[_0xe32d('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x128709,_0x10e86f,_0x162083,_0x2ff65e){return new BPromise(function(_0x500248,_0x4dc6c3){var _0x75452a=_0x2ff65e||client;return _0x75452a[_0xe32d('0x20')](_0x128709,_0x162083)[_0xe32d('0x21')](function(_0x38b65d){logger[_0xe32d('0x22')](_0xe32d('0x23'),_0x10e86f,'request\x20sent');logger[_0xe32d('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x10e86f,'request\x20sent',JSON['stringify'](_0x38b65d));if(_0x38b65d[_0xe32d('0x25')]){if(_0x38b65d[_0xe32d('0x25')][_0xe32d('0x26')]===0x1f4){logger[_0xe32d('0x25')](_0xe32d('0x23'),_0x10e86f,_0x38b65d[_0xe32d('0x25')]['message']);return _0x4dc6c3(_0x38b65d[_0xe32d('0x25')]['message']);}logger['error'](_0xe32d('0x23'),_0x10e86f,_0x38b65d[_0xe32d('0x25')]['message']);return _0x500248(_0x38b65d[_0xe32d('0x25')]['message']);}else{logger[_0xe32d('0x22')](_0xe32d('0x23'),_0x10e86f,_0xe32d('0x27'));_0x500248(_0x38b65d['result'][_0xe32d('0x28')]);}})[_0xe32d('0x29')](function(_0x24201a){logger[_0xe32d('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x10e86f,_0x24201a);_0x4dc6c3(_0x24201a);});});}function respondWithStatusCode(_0x355566,_0xf938c9){_0xf938c9=_0xf938c9||0xcc;return function(_0x542e0b){if(_0x542e0b){return _0x355566['sendStatus'](_0xf938c9);}return _0x355566[_0xe32d('0x2a')](_0xf938c9)[_0xe32d('0x2b')]();};}function respondWithResult(_0x46a5ab,_0x4fe0cc){_0x4fe0cc=_0x4fe0cc||0xc8;return function(_0xd2118c){if(_0xd2118c){return _0x46a5ab[_0xe32d('0x2a')](_0x4fe0cc)[_0xe32d('0x2c')](_0xd2118c);}};}function respondWithFilteredResult(_0x407422,_0x4f1fc6){return function(_0x5376c6){if(_0x5376c6){var _0x434c79=typeof _0x4f1fc6[_0xe32d('0x2d')]===_0xe32d('0x2e')&&typeof _0x4f1fc6[_0xe32d('0x2f')]===_0xe32d('0x2e');var _0x569f5b=_0x5376c6[_0xe32d('0x30')];var _0x37e77d=_0x434c79?0x0:_0x4f1fc6[_0xe32d('0x2d')];var _0x1b47a4=_0x434c79?_0x5376c6[_0xe32d('0x30')]:_0x4f1fc6['offset']+_0x4f1fc6[_0xe32d('0x2f')];var _0x30646d;if(_0x1b47a4>=_0x569f5b){_0x1b47a4=_0x569f5b;_0x30646d=0xc8;}else{_0x30646d=0xce;}_0x407422[_0xe32d('0x2a')](_0x30646d);return _0x407422[_0xe32d('0x31')]('Content-Range',_0x37e77d+'-'+_0x1b47a4+'/'+_0x569f5b)[_0xe32d('0x2c')](_0x5376c6);}return null;};}function patchUpdates(_0x4bf9f3){return function(_0x15e5e3){try{jsonpatch[_0xe32d('0x32')](_0x15e5e3,_0x4bf9f3,!![]);}catch(_0x460eca){return BPromise[_0xe32d('0x33')](_0x460eca);}return _0x15e5e3[_0xe32d('0x34')]();};}function saveUpdates(_0x594642,_0x4cc5be){return function(_0xa27c22){if(_0xa27c22){return _0xa27c22[_0xe32d('0x35')](_0x594642)[_0xe32d('0x21')](function(_0x24567a){return _0x24567a;});}return null;};}function removeEntity(_0x2e1cbf,_0x211be8){return function(_0xe06dc9){if(_0xe06dc9){return _0xe06dc9[_0xe32d('0x36')]()[_0xe32d('0x21')](function(){var _0x2b6852=_0xe06dc9[_0xe32d('0x37')]({'plain':!![]});var _0x47efa6=_0xe32d('0x38');return db[_0xe32d('0x39')]['destroy']({'where':{'type':_0x47efa6,'resourceId':_0x2b6852['id']}})[_0xe32d('0x21')](function(){return _0xe06dc9;});})[_0xe32d('0x21')](function(){_0x2e1cbf[_0xe32d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108154,_0x25bb06){return function(_0x26bceb){if(!_0x26bceb){_0x108154[_0xe32d('0x3a')](0x194);}return _0x26bceb;};}function handleError(_0x82d1e0,_0x54a3ba){_0x54a3ba=_0x54a3ba||0x1f4;return function(_0xc83410){logger[_0xe32d('0x25')](_0xc83410[_0xe32d('0x3b')]);if(_0xc83410[_0xe32d('0x3c')]){delete _0xc83410['name'];}_0x82d1e0[_0xe32d('0x2a')](_0x54a3ba)[_0xe32d('0x3d')](_0xc83410);};}exports[_0xe32d('0x3e')]=function(_0x1b1234,_0x6ead98){var _0x4cd5f4={'include':[{'model':db[_0xe32d('0x3f')],'as':_0xe32d('0x40')}]},_0x5c7d55={},_0x464bae={'count':0x0,'rows':[]};var _0x1e0210=_[_0xe32d('0x41')](db['WhatsappAccount'][_0xe32d('0x42')],function(_0x1e2d00){return{'name':_0x1e2d00[_0xe32d('0x43')],'type':_0x1e2d00[_0xe32d('0x44')][_0xe32d('0x45')]};});_0x5c7d55[_0xe32d('0x46')]=_[_0xe32d('0x41')](_0x1e0210,_0xe32d('0x3c'));_0x5c7d55[_0xe32d('0x47')]=_[_0xe32d('0x48')](_0x1b1234[_0xe32d('0x47')]);_0x5c7d55[_0xe32d('0x49')]=_[_0xe32d('0x4a')](_0x5c7d55['model'],_0x5c7d55['query']);_0x4cd5f4[_0xe32d('0x4b')]=_[_0xe32d('0x4a')](_0x5c7d55[_0xe32d('0x46')],qs['fields'](_0x1b1234[_0xe32d('0x47')][_0xe32d('0x4c')]));_0x4cd5f4[_0xe32d('0x4b')]=_0x4cd5f4['attributes'][_0xe32d('0x4d')]?_0x4cd5f4[_0xe32d('0x4b')]:_0x5c7d55[_0xe32d('0x46')];if(!_0x1b1234['query']['hasOwnProperty'](_0xe32d('0x4e'))){_0x4cd5f4['limit']=qs[_0xe32d('0x2f')](_0x1b1234[_0xe32d('0x47')][_0xe32d('0x2f')]);_0x4cd5f4[_0xe32d('0x2d')]=qs[_0xe32d('0x2d')](_0x1b1234[_0xe32d('0x47')]['offset']);}_0x4cd5f4[_0xe32d('0x4f')]=qs[_0xe32d('0x50')](_0x1b1234['query'][_0xe32d('0x50')]);_0x4cd5f4['where']=qs[_0xe32d('0x49')](_[_0xe32d('0x51')](_0x1b1234[_0xe32d('0x47')],_0x5c7d55[_0xe32d('0x49')]),_0x1e0210);if(_0x1b1234[_0xe32d('0x47')][_0xe32d('0x52')]){_0x4cd5f4[_0xe32d('0x53')]=_['merge'](_0x4cd5f4[_0xe32d('0x53')],{'$or':_[_0xe32d('0x41')](_0x1e0210,function(_0x41e4d5){if(_0x41e4d5[_0xe32d('0x44')]!=='VIRTUAL'){var _0x1e9f2e={};_0x1e9f2e[_0x41e4d5[_0xe32d('0x3c')]]={'$like':'%'+_0x1b1234['query'][_0xe32d('0x52')]+'%'};return _0x1e9f2e;}})});}_0x4cd5f4=_['merge']({},_0x4cd5f4,_0x1b1234['options']);var _0x54133a={'where':_0x4cd5f4[_0xe32d('0x53')]};return db[_0xe32d('0x54')][_0xe32d('0x30')](_0x54133a)[_0xe32d('0x21')](function(_0x216442){_0x464bae['count']=_0x216442;if(_0x1b1234[_0xe32d('0x47')][_0xe32d('0x55')]){_0x4cd5f4[_0xe32d('0x56')]=[{'all':!![]}];}return db[_0xe32d('0x54')]['findAll'](_0x4cd5f4);})['then'](function(_0x129701){_0x464bae[_0xe32d('0x57')]=_0x129701;return _0x464bae;})[_0xe32d('0x21')](respondWithFilteredResult(_0x6ead98,_0x4cd5f4))[_0xe32d('0x29')](handleError(_0x6ead98,null));};exports[_0xe32d('0x58')]=function(_0x3d0673,_0x5b9700){var _0x3432fe={'raw':![],'where':{'id':_0x3d0673[_0xe32d('0x59')]['id']},'include':[{'model':db[_0xe32d('0x3f')],'as':_0xe32d('0x40')}]},_0x3805b6={};_0x3805b6['model']=_[_0xe32d('0x48')](db[_0xe32d('0x54')][_0xe32d('0x42')]);_0x3805b6['query']=_[_0xe32d('0x48')](_0x3d0673[_0xe32d('0x47')]);_0x3805b6[_0xe32d('0x49')]=_['intersection'](_0x3805b6[_0xe32d('0x46')],_0x3805b6[_0xe32d('0x47')]);_0x3432fe[_0xe32d('0x4b')]=_[_0xe32d('0x4a')](_0x3805b6[_0xe32d('0x46')],qs[_0xe32d('0x4c')](_0x3d0673['query']['fields']));_0x3432fe['attributes']=_0x3432fe[_0xe32d('0x4b')]['length']?_0x3432fe[_0xe32d('0x4b')]:_0x3805b6[_0xe32d('0x46')];if(_0x3d0673[_0xe32d('0x47')][_0xe32d('0x55')]){_0x3432fe[_0xe32d('0x56')]=[{'all':!![]}];}_0x3432fe=_[_0xe32d('0x5a')]({},_0x3432fe,_0x3d0673[_0xe32d('0x5b')]);return db['WhatsappAccount'][_0xe32d('0x5c')](_0x3432fe)['then'](handleEntityNotFound(_0x5b9700,null))[_0xe32d('0x21')](respondWithResult(_0x5b9700,null))[_0xe32d('0x29')](handleError(_0x5b9700,null));};exports[_0xe32d('0x5d')]=function(_0x37d24b,_0x156d76){return db[_0xe32d('0x54')][_0xe32d('0x5d')](_0x37d24b[_0xe32d('0x5e')],{})[_0xe32d('0x21')](function(_0x229919){var _0x5ab19b=_0x37d24b[_0xe32d('0x5f')]['get']({'plain':!![]});if(!_0x5ab19b)throw new Error(_0xe32d('0x60'));if(_0x5ab19b[_0xe32d('0x61')]==='user'){var _0x29e190=_0x229919[_0xe32d('0x37')]({'plain':!![]});var _0x52a692=_0xe32d('0x38');return db['UserProfileSection'][_0xe32d('0x5c')]({'where':{'name':_0x52a692,'userProfileId':_0x5ab19b[_0xe32d('0x62')]},'raw':!![]})[_0xe32d('0x21')](function(_0x4bf85a){if(_0x4bf85a&&_0x4bf85a['autoAssociation']===0x0){return db['UserProfileResource'][_0xe32d('0x5d')]({'name':_0x29e190[_0xe32d('0x3c')],'resourceId':_0x29e190['id'],'type':_0x4bf85a['name'],'sectionId':_0x4bf85a['id']},{})[_0xe32d('0x21')](function(){return _0x229919;});}else{return _0x229919;}})[_0xe32d('0x29')](function(_0x2434ec){logger[_0xe32d('0x25')](_0xe32d('0x63'),_0x2434ec);throw _0x2434ec;});}return _0x229919;})[_0xe32d('0x21')](respondWithResult(_0x156d76,0xc9))[_0xe32d('0x29')](handleError(_0x156d76,null));};exports[_0xe32d('0x35')]=function(_0x54e8c6,_0x3e78cc){if(_0x54e8c6[_0xe32d('0x5e')]['id']){delete _0x54e8c6['body']['id'];}return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x54e8c6[_0xe32d('0x59')]['id']},'include':[{'model':db[_0xe32d('0x3f')],'as':_0xe32d('0x40')}]})['then'](handleEntityNotFound(_0x3e78cc,null))[_0xe32d('0x21')](saveUpdates(_0x54e8c6[_0xe32d('0x5e')],null))[_0xe32d('0x21')](respondWithResult(_0x3e78cc,null))['catch'](handleError(_0x3e78cc,null));};exports[_0xe32d('0x36')]=function(_0x36317b,_0x53a5c1){return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x36317b[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x53a5c1,null))[_0xe32d('0x21')](removeEntity(_0x53a5c1,null))[_0xe32d('0x29')](handleError(_0x53a5c1,null));};exports['describe']=function(_0x22fedc,_0x3f1a13){return db[_0xe32d('0x54')][_0xe32d('0x64')]()[_0xe32d('0x21')](respondWithResult(_0x3f1a13,null))[_0xe32d('0x29')](handleError(_0x3f1a13,null));};exports[_0xe32d('0x65')]=function(_0x485d0f,_0x3622f8,_0x47c073){if(_0x485d0f[_0xe32d('0x5e')]['id']){delete _0x485d0f[_0xe32d('0x5e')]['id'];}return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x485d0f[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x3622f8,null))[_0xe32d('0x21')](function(_0x395ea0){if(_0x395ea0){_0x485d0f['body'][_0xe32d('0x66')]=_0x395ea0['id'];return db[_0xe32d('0x67')][_0xe32d('0x5d')](_0x485d0f[_0xe32d('0x5e')]);}})[_0xe32d('0x21')](respondWithResult(_0x3622f8,null))[_0xe32d('0x29')](handleError(_0x3622f8,null));};exports[_0xe32d('0x68')]=function(_0x44eb4d,_0x11e90f,_0x4360ce){var _0x23fae8={'raw':![],'where':{}};var _0x3a2bad={};var _0x195f2b={'count':0x0,'rows':[]};return db[_0xe32d('0x54')][_0xe32d('0x69')]({'where':{'id':_0x44eb4d[_0xe32d('0x59')]['id']}})['then'](handleEntityNotFound(_0x11e90f,null))['then'](function(_0x2f4209){if(_0x2f4209){_0x3a2bad['model']=_[_0xe32d('0x48')](db[_0xe32d('0x67')][_0xe32d('0x42')]);_0x3a2bad[_0xe32d('0x47')]=_[_0xe32d('0x48')](_0x44eb4d['query']);_0x3a2bad[_0xe32d('0x49')]=_['intersection'](_0x3a2bad[_0xe32d('0x46')],_0x3a2bad['query']);_0x23fae8[_0xe32d('0x4b')]=_[_0xe32d('0x4a')](_0x3a2bad[_0xe32d('0x46')],qs[_0xe32d('0x4c')](_0x44eb4d[_0xe32d('0x47')][_0xe32d('0x4c')]));_0x23fae8['attributes']=_0x23fae8[_0xe32d('0x4b')][_0xe32d('0x4d')]?_0x23fae8[_0xe32d('0x4b')]:_0x3a2bad[_0xe32d('0x46')];if(!_0x44eb4d[_0xe32d('0x47')][_0xe32d('0x6a')](_0xe32d('0x4e'))){_0x23fae8[_0xe32d('0x2f')]=qs[_0xe32d('0x2f')](_0x44eb4d['query'][_0xe32d('0x2f')]);_0x23fae8[_0xe32d('0x2d')]=qs['offset'](_0x44eb4d[_0xe32d('0x47')][_0xe32d('0x2d')]);}_0x23fae8['order']=qs[_0xe32d('0x50')](_0x44eb4d[_0xe32d('0x47')][_0xe32d('0x50')]);_0x23fae8[_0xe32d('0x53')]=qs[_0xe32d('0x49')](_[_0xe32d('0x51')](_0x44eb4d['query'],_0x3a2bad['filters']));_0x23fae8['where'][_0xe32d('0x66')]=_0x2f4209['id'];if(_0x44eb4d[_0xe32d('0x47')]['filter']){_0x23fae8[_0xe32d('0x53')]=_[_0xe32d('0x5a')](_0x23fae8[_0xe32d('0x53')],{'$or':_[_0xe32d('0x41')](_0x23fae8[_0xe32d('0x4b')],function(_0x2a11b2){var _0x499e1e={};_0x499e1e[_0x2a11b2]={'$like':'%'+_0x44eb4d['query'][_0xe32d('0x52')]+'%'};return _0x499e1e;})});}_0x23fae8=_['merge']({},_0x23fae8,_0x44eb4d['options']);return db[_0xe32d('0x67')][_0xe32d('0x30')]({'where':_0x23fae8[_0xe32d('0x53')]})['then'](function(_0x10cd36){_0x195f2b['count']=_0x10cd36;if(_0x44eb4d[_0xe32d('0x47')][_0xe32d('0x55')]){_0x23fae8[_0xe32d('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xe32d('0x6b')](_0x23fae8);})[_0xe32d('0x21')](function(_0x4d129f){_0x195f2b[_0xe32d('0x57')]=_0x4d129f;return _0x195f2b;});}})[_0xe32d('0x21')](respondWithFilteredResult(_0x11e90f,_0x23fae8))[_0xe32d('0x29')](handleError(_0x11e90f,null));};exports[_0xe32d('0x6c')]=function(_0x1ecebf,_0x35ec8d,_0x51406c){return db['WhatsappAccount']['find']({'where':{'id':_0x1ecebf[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x35ec8d,null))[_0xe32d('0x21')](function(_0x449c7e){if(_0x449c7e){return _0x449c7e[_0xe32d('0x6c')](_0x1ecebf['query'][_0xe32d('0x6d')]);}})['then'](respondWithStatusCode(_0x35ec8d,null))[_0xe32d('0x29')](handleError(_0x35ec8d,null));};exports[_0xe32d('0x6e')]=function(_0x4a0785,_0x5118d9,_0x555a09){if(_0x4a0785[_0xe32d('0x5e')]['id']){delete _0x4a0785['body']['id'];}return db[_0xe32d('0x54')]['find']({'where':{'id':_0x4a0785[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x5118d9,null))[_0xe32d('0x21')](function(_0x2e96fa){if(_0x2e96fa){_0x4a0785['body'][_0xe32d('0x66')]=_0x2e96fa['id'];return db['CannedAnswer'][_0xe32d('0x5d')](_0x4a0785[_0xe32d('0x5e')]);}})['then'](respondWithResult(_0x5118d9,null))['catch'](handleError(_0x5118d9,null));};exports[_0xe32d('0x6f')]=function(_0x4b147c,_0x56278b,_0x57692e){var _0x25a1b8={'raw':![],'where':{}};var _0x4ab290={};var _0x2d3cc1={'count':0x0,'rows':[]};return db[_0xe32d('0x54')]['findOne']({'where':{'id':_0x4b147c[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x56278b,null))[_0xe32d('0x21')](function(_0x25483e){if(_0x25483e){_0x4ab290[_0xe32d('0x46')]=_['keys'](db[_0xe32d('0x70')][_0xe32d('0x42')]);_0x4ab290[_0xe32d('0x47')]=_['keys'](_0x4b147c[_0xe32d('0x47')]);_0x4ab290[_0xe32d('0x49')]=_[_0xe32d('0x4a')](_0x4ab290[_0xe32d('0x46')],_0x4ab290[_0xe32d('0x47')]);_0x25a1b8['attributes']=_[_0xe32d('0x4a')](_0x4ab290[_0xe32d('0x46')],qs[_0xe32d('0x4c')](_0x4b147c[_0xe32d('0x47')][_0xe32d('0x4c')]));_0x25a1b8[_0xe32d('0x4b')]=_0x25a1b8[_0xe32d('0x4b')]['length']?_0x25a1b8[_0xe32d('0x4b')]:_0x4ab290[_0xe32d('0x46')];if(!_0x4b147c[_0xe32d('0x47')][_0xe32d('0x6a')]('nolimit')){_0x25a1b8[_0xe32d('0x2f')]=qs[_0xe32d('0x2f')](_0x4b147c[_0xe32d('0x47')][_0xe32d('0x2f')]);_0x25a1b8[_0xe32d('0x2d')]=qs['offset'](_0x4b147c[_0xe32d('0x47')]['offset']);}_0x25a1b8[_0xe32d('0x4f')]=qs[_0xe32d('0x50')](_0x4b147c['query'][_0xe32d('0x50')]);_0x25a1b8[_0xe32d('0x53')]=qs[_0xe32d('0x49')](_[_0xe32d('0x51')](_0x4b147c['query'],_0x4ab290['filters']));_0x25a1b8[_0xe32d('0x53')][_0xe32d('0x66')]=_0x25483e['id'];if(_0x4b147c[_0xe32d('0x47')][_0xe32d('0x52')]){_0x25a1b8[_0xe32d('0x53')]=_['merge'](_0x25a1b8['where'],{'$or':_[_0xe32d('0x41')](_0x25a1b8[_0xe32d('0x4b')],function(_0x3fb662){var _0x1062b8={};_0x1062b8[_0x3fb662]={'$like':'%'+_0x4b147c[_0xe32d('0x47')]['filter']+'%'};return _0x1062b8;})});}_0x25a1b8=_['merge']({},_0x25a1b8,_0x4b147c[_0xe32d('0x5b')]);return db[_0xe32d('0x70')][_0xe32d('0x30')]({'where':_0x25a1b8[_0xe32d('0x53')]})[_0xe32d('0x21')](function(_0x2f794a){_0x2d3cc1[_0xe32d('0x30')]=_0x2f794a;if(_0x4b147c[_0xe32d('0x47')]['includeAll']){_0x25a1b8[_0xe32d('0x56')]=[{'all':!![]}];}return db[_0xe32d('0x70')]['findAll'](_0x25a1b8);})[_0xe32d('0x21')](function(_0x4457a6){_0x2d3cc1[_0xe32d('0x57')]=_0x4457a6;return _0x2d3cc1;});}})[_0xe32d('0x21')](respondWithFilteredResult(_0x56278b,_0x25a1b8))[_0xe32d('0x29')](handleError(_0x56278b,null));};exports[_0xe32d('0x71')]=function(_0x4f6995,_0x233894,_0x38ee01){return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x4f6995['params']['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x233894,null))[_0xe32d('0x21')](function(_0x1e00c9){if(_0x1e00c9){return _0x1e00c9['removeAnswers'](_0x4f6995['query']['ids']);}})[_0xe32d('0x21')](respondWithStatusCode(_0x233894,null))[_0xe32d('0x29')](handleError(_0x233894,null));};exports[_0xe32d('0x72')]=function(_0x32d689,_0x5abcf6,_0x3ce1bc){return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x32d689['params']['id']}})['then'](handleEntityNotFound(_0x5abcf6,null))[_0xe32d('0x21')](function(_0x3a28a7){if(_0x3a28a7){return _0x3a28a7[_0xe32d('0x72')](_0x32d689['body'][_0xe32d('0x6d')],_['omit'](_0x32d689['body'],[_0xe32d('0x6d'),'id'])||{})[_0xe32d('0x73')](function(_0x2a6b84){for(var _0x3a1d2c=0x0;_0x3a1d2c<_0x32d689[_0xe32d('0x5e')][_0xe32d('0x6d')][_0xe32d('0x4d')];_0x3a1d2c+=0x1){socket['emit'](_0xe32d('0x74'),{'UserId':Number(_0x32d689['body'][_0xe32d('0x6d')][_0x3a1d2c]),'WhatsappAccountId':Number(_0x32d689[_0xe32d('0x59')]['id'])});}return _0x2a6b84;});}})[_0xe32d('0x21')](respondWithResult(_0x5abcf6,null))[_0xe32d('0x29')](handleError(_0x5abcf6,null));};exports[_0xe32d('0x75')]=function(_0x842c81,_0x13fbe7,_0xfa4c03){return db[_0xe32d('0x54')]['find']({'where':{'id':_0x842c81[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x13fbe7,null))[_0xe32d('0x21')](function(_0x74c6b0){if(_0x74c6b0){return _0x74c6b0[_0xe32d('0x75')](_0x842c81[_0xe32d('0x47')][_0xe32d('0x6d')])['then'](function(){if(_['isArray'](_0x842c81['query']['ids'])){for(var _0xe8c106=0x0;_0xe8c106<_0x842c81[_0xe32d('0x47')][_0xe32d('0x6d')][_0xe32d('0x4d')];_0xe8c106+=0x1){socket[_0xe32d('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x842c81[_0xe32d('0x47')][_0xe32d('0x6d')][_0xe8c106]),'WhatsappAccountId':Number(_0x842c81[_0xe32d('0x59')]['id'])});}}else{socket[_0xe32d('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x842c81[_0xe32d('0x47')][_0xe32d('0x6d')]),'WhatsappAccountId':Number(_0x842c81[_0xe32d('0x59')]['id'])});}});}})[_0xe32d('0x21')](respondWithStatusCode(_0x13fbe7,null))[_0xe32d('0x29')](handleError(_0x13fbe7,null));};exports[_0xe32d('0x77')]=function(_0x119923,_0x54e71a,_0x316fbf){var _0x41b723={};var _0x2ae12d={};var _0x4c4377;var _0x10979c;return db[_0xe32d('0x54')][_0xe32d('0x69')]({'where':{'id':_0x119923['params']['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x54e71a,null))[_0xe32d('0x21')](function(_0x1fd6c5){if(_0x1fd6c5){_0x4c4377=_0x1fd6c5;_0x2ae12d['model']=_[_0xe32d('0x48')](db[_0xe32d('0x78')][_0xe32d('0x42')]);_0x2ae12d[_0xe32d('0x47')]=_[_0xe32d('0x48')](_0x119923[_0xe32d('0x47')]);_0x2ae12d['filters']=_['intersection'](_0x2ae12d['model'],_0x2ae12d[_0xe32d('0x47')]);_0x41b723['attributes']=_[_0xe32d('0x4a')](_0x2ae12d['model'],qs[_0xe32d('0x4c')](_0x119923[_0xe32d('0x47')][_0xe32d('0x4c')]));_0x41b723[_0xe32d('0x4b')]=_0x41b723[_0xe32d('0x4b')][_0xe32d('0x4d')]?_0x41b723[_0xe32d('0x4b')]:_0x2ae12d[_0xe32d('0x46')];_0x41b723[_0xe32d('0x4f')]=qs[_0xe32d('0x50')](_0x119923[_0xe32d('0x47')][_0xe32d('0x50')]);_0x41b723[_0xe32d('0x53')]=qs[_0xe32d('0x49')](_[_0xe32d('0x51')](_0x119923['query'],_0x2ae12d[_0xe32d('0x49')]));if(_0x119923[_0xe32d('0x47')][_0xe32d('0x52')]){_0x41b723[_0xe32d('0x53')]=_[_0xe32d('0x5a')](_0x41b723[_0xe32d('0x53')],{'$or':_[_0xe32d('0x41')](_0x41b723[_0xe32d('0x4b')],function(_0x731e91){var _0x47cc1b={};_0x47cc1b[_0x731e91]={'$like':'%'+_0x119923[_0xe32d('0x47')][_0xe32d('0x52')]+'%'};return _0x47cc1b;})});}_0x41b723=_[_0xe32d('0x5a')]({},_0x41b723,_0x119923[_0xe32d('0x5b')]);return _0x4c4377[_0xe32d('0x77')](_0x41b723);}})[_0xe32d('0x21')](function(_0x209bdd){if(_0x209bdd){_0x10979c=_0x209bdd[_0xe32d('0x4d')];if(!_0x119923[_0xe32d('0x47')][_0xe32d('0x6a')]('nolimit')){_0x41b723[_0xe32d('0x2f')]=qs[_0xe32d('0x2f')](_0x119923[_0xe32d('0x47')]['limit']);_0x41b723['offset']=qs[_0xe32d('0x2d')](_0x119923[_0xe32d('0x47')][_0xe32d('0x2d')]);}return _0x4c4377['getAgents'](_0x41b723);}})[_0xe32d('0x21')](function(_0x257bcb){if(_0x257bcb){return _0x257bcb?{'count':_0x10979c,'rows':_0x257bcb}:null;}})['then'](respondWithResult(_0x54e71a,null))[_0xe32d('0x29')](handleError(_0x54e71a,null));};exports[_0xe32d('0x79')]=function(_0x2d97a5,_0x1b312b){var _0x414d0c=_0x2d97a5['params']['id'];var _0x35f160=_0x2d97a5[_0xe32d('0x5e')];var _0x38c467=0xc8;var _0x31eaff=null;return db['sequelize'][_0xe32d('0x7a')]({'isolationLevel':db[_0xe32d('0x7b')][_0xe32d('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3be65d){return db['WhatsappAccount']['findOne']({'where':{'id':_0x414d0c},'transaction':_0x3be65d})[_0xe32d('0x21')](function(_0x4a5a4f){if(_0x4a5a4f){return db[_0xe32d('0x7d')][_0xe32d('0x36')]({'where':{'WhatsappAccountId':_0x414d0c},'transaction':_0x3be65d})[_0xe32d('0x21')](function(){var _0x1d08f5=_[_0xe32d('0x41')](_0x35f160,function(_0x1f0b39){_0x1f0b39['WhatsappAccountId']=_0x414d0c;return _0x1f0b39;});return db[_0xe32d('0x7d')]['bulkCreate'](_0x1d08f5,{'transaction':_0x3be65d});});}else{_0x38c467=0x194;_0x31eaff=[];}});})[_0xe32d('0x21')](function(){if(_0x38c467!==0x194){return db[_0xe32d('0x7d')][_0xe32d('0x7e')]({'where':{'WhatsappAccountId':_0x414d0c},'order':_0xe32d('0x7f')})[_0xe32d('0x21')](function(_0x3953ff){_0x31eaff=_0x3953ff;});}})['catch'](function(_0x526f3e){_0x38c467=0x1f4;logger[_0xe32d('0x25')](_0x526f3e[_0xe32d('0x3b')]);if(_0x526f3e[_0xe32d('0x3c')]){delete _0x526f3e[_0xe32d('0x3c')];}_0x31eaff=_0x526f3e;})[_0xe32d('0x80')](function(){if(_0x31eaff===null){_0x1b312b[_0xe32d('0x3a')](_0x38c467);}else{if(_0x38c467===0x1f4){_0x1b312b[_0xe32d('0x2a')](_0x38c467)[_0xe32d('0x3d')](_0x31eaff);}else{_0x1b312b['status'](_0x38c467)[_0xe32d('0x2c')](_0x31eaff);}}});};exports[_0xe32d('0x81')]=function(_0x53da07,_0x24043a,_0x3a4779){var _0x2e7374={};var _0x4d6271={};var _0x4e2beb;var _0x100f39;return db[_0xe32d('0x54')]['findOne']({'where':{'id':_0x53da07[_0xe32d('0x59')]['id']}})[_0xe32d('0x21')](handleEntityNotFound(_0x24043a,null))[_0xe32d('0x21')](function(_0x387cae){if(_0x387cae){_0x4e2beb=_0x387cae;_0x4d6271[_0xe32d('0x46')]=_['keys'](db[_0xe32d('0x7d')][_0xe32d('0x42')]);_0x4d6271['query']=_[_0xe32d('0x48')](_0x53da07[_0xe32d('0x47')]);_0x4d6271[_0xe32d('0x49')]=_[_0xe32d('0x4a')](_0x4d6271['model'],_0x4d6271[_0xe32d('0x47')]);_0x2e7374[_0xe32d('0x4b')]=_['intersection'](_0x4d6271[_0xe32d('0x46')],qs['fields'](_0x53da07[_0xe32d('0x47')][_0xe32d('0x4c')]));_0x2e7374[_0xe32d('0x4b')]=_0x2e7374['attributes']['length']?_0x2e7374[_0xe32d('0x4b')]:_0x4d6271['model'];_0x2e7374[_0xe32d('0x4f')]=qs[_0xe32d('0x50')](_0x53da07[_0xe32d('0x47')][_0xe32d('0x50')]);_0x2e7374[_0xe32d('0x53')]=qs['filters'](_[_0xe32d('0x51')](_0x53da07['query'],_0x4d6271[_0xe32d('0x49')]));if(_0x53da07[_0xe32d('0x47')][_0xe32d('0x52')]){_0x2e7374[_0xe32d('0x53')]=_[_0xe32d('0x5a')](_0x2e7374[_0xe32d('0x53')],{'$or':_[_0xe32d('0x41')](_0x2e7374[_0xe32d('0x4b')],function(_0x177baa){var _0x5103d7={};_0x5103d7[_0x177baa]={'$like':'%'+_0x53da07[_0xe32d('0x47')][_0xe32d('0x52')]+'%'};return _0x5103d7;})});}_0x2e7374=_[_0xe32d('0x5a')]({},_0x2e7374,_0x53da07[_0xe32d('0x5b')]);return _0x4e2beb[_0xe32d('0x81')](_0x2e7374);}})[_0xe32d('0x21')](function(_0x2eea6c){if(_0x2eea6c){_0x100f39=_0x2eea6c[_0xe32d('0x4d')];if(!_0x53da07[_0xe32d('0x47')][_0xe32d('0x6a')](_0xe32d('0x4e'))){_0x2e7374[_0xe32d('0x2f')]=qs[_0xe32d('0x2f')](_0x53da07['query'][_0xe32d('0x2f')]);_0x2e7374[_0xe32d('0x2d')]=qs[_0xe32d('0x2d')](_0x53da07[_0xe32d('0x47')][_0xe32d('0x2d')]);}return _0x4e2beb[_0xe32d('0x81')](_0x2e7374);}})['then'](function(_0xef69b8){if(_0xef69b8){return _0xef69b8?{'count':_0x100f39,'rows':_0xef69b8}:null;}})[_0xe32d('0x21')](respondWithResult(_0x24043a,null))[_0xe32d('0x29')](handleError(_0x24043a,null));};exports[_0xe32d('0x82')]=function(_0x23c99a,_0x35e951,_0x2af2b9){var _0x2f8a80={'channel':'whatsapp'};var _0x2e8e44=[];var _0x4f3e9e=[];var _0x3a8464={};return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x23c99a['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xe32d('0x83')}]})[_0xe32d('0x21')](handleEntityNotFound(_0x35e951,null))['then'](function(_0x35ed6d){_0x2f8a80[_0xe32d('0x84')]=_0x35ed6d;if(_0x2f8a80['account']&&_0x2f8a80['account'][_0xe32d('0x44')]==='sinch'&&_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x85')]){if(_0x23c99a[_0xe32d('0x5e')]['statuses'][_0xe32d('0x4d')]===0x0)return;if(_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x85')][0x0][_0xe32d('0x86')]!==_0xe32d('0x87'))return;return db[_0xe32d('0x88')][_0xe32d('0x35')]({'read':!![],'readAt':_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x85')][0x0]['timestamp']},{'where':{'messageId':_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x85')][0x0][_0xe32d('0x89')]},'individualHooks':!![]})['then'](function(_0x2b04ef){return _0x35e951[_0xe32d('0x2a')](0xc8)[_0xe32d('0x2c')](_0x2b04ef);});}_0x2f8a80[_0xe32d('0x8a')]=_[_0xe32d('0x8b')](_0x35ed6d[_0xe32d('0x83')],[_0xe32d('0x7f')],[_0xe32d('0x8c')]);if(_0x2f8a80[_0xe32d('0x84')][_0xe32d('0x83')]){delete _0x2f8a80[_0xe32d('0x84')][_0xe32d('0x83')];}return db[_0xe32d('0x8d')][_0xe32d('0x64')]()[_0xe32d('0x21')](function(_0x3c3cab){if(!_0x3c3cab){throw new db[(_0xe32d('0x8e'))][(_0xe32d('0x8f'))](_0xe32d('0x90'));}_0x2e8e44=_[_0xe32d('0x91')](_[_0xe32d('0x48')](_0x3c3cab),[_0xe32d('0x92'),_0xe32d('0x93')]);_0x4f3e9e=_[_0xe32d('0x91')](_[_0xe32d('0x48')](_0x3c3cab),[_0xe32d('0x92'),'updatedAt','CompanyId',_0xe32d('0x94')]);_0x2f8a80['body']={'mapKey':_0xe32d('0x95')};if(_0x2f8a80[_0xe32d('0x84')]&&_0x2f8a80[_0xe32d('0x84')]['type']===_0xe32d('0x96')){_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')]=_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x98')]['replace'](_0xe32d('0x99'),'');_0x2f8a80[_0xe32d('0x5e')]['body']=_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x9a')];_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x9b')]=_0x23c99a[_0xe32d('0x5e')]['MessageSid'];}if(_0x2f8a80['account']&&_0x2f8a80[_0xe32d('0x84')][_0xe32d('0x44')]===_0xe32d('0x9c')){_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')]=_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x9d')][0x0][_0xe32d('0x97')];_0x2f8a80[_0xe32d('0x5e')]['body']=_0x23c99a[_0xe32d('0x5e')]['notifications'][0x0]['message']['body'];_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x9b')]=_0x23c99a[_0xe32d('0x5e')][_0xe32d('0x9d')][0x0]['message_id'];}if(_0x2f8a80[_0xe32d('0x5e')]['id']){delete _0x2f8a80[_0xe32d('0x5e')]['id'];}if(_[_0xe32d('0x9e')](_0x2f8a80[_0xe32d('0x5e')]['from'])){throw new db[(_0xe32d('0x8e'))][(_0xe32d('0x8f'))](_0xe32d('0x9f'));}if(_['isNil'](_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x5e')])||_0x2f8a80[_0xe32d('0x5e')]['body']===''){throw new db[(_0xe32d('0x8e'))][(_0xe32d('0x8f'))](_0xe32d('0xa0'));}if(_[_0xe32d('0x9e')](_0x2f8a80['body'][_0xe32d('0xa1')])){throw new db['Sequelize'][(_0xe32d('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f3e9e);}if(!_[_0xe32d('0xa2')](_0x4f3e9e,_0x2f8a80['body']['mapKey'])){throw new db[(_0xe32d('0x8e'))][(_0xe32d('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f3e9e);}_0x3a8464[_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0xa1')]]=_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')];return db['CmList']['find']({'where':{'id':_0x2f8a80[_0xe32d('0x84')][_0xe32d('0x94')]},'include':[{'model':db[_0xe32d('0x8d')],'as':_0xe32d('0xa3'),'where':_0x3a8464,'limit':0x1,'order':[[_0xe32d('0x93'),'DESC']]}]});})[_0xe32d('0x21')](handleEntityNotFound(_0x35e951,null))[_0xe32d('0x21')](function(_0x1457d4){if(_0x1457d4){_0x2f8a80[_0xe32d('0xa4')]=_[_0xe32d('0xa5')](_0x1457d4,[_0xe32d('0xa3')]);if(_0x1457d4[_0xe32d('0xa3')][_0xe32d('0x4d')]){return _0x1457d4[_0xe32d('0xa3')][0x0];}var _0x37b590=_[_0xe32d('0xa6')](_0x2f8a80['body'],{'firstName':_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')],'ListId':_0x1457d4['id']});_0x37b590[_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0xa1')]]=_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')];return db[_0xe32d('0x8d')][_0xe32d('0x5d')](_0x37b590,{'fields':_0x2e8e44,'raw':!![]});}})[_0xe32d('0x21')](handleEntityNotFound(_0x35e951,null))[_0xe32d('0x21')](function(_0x399e73){if(_0x399e73){_0x2f8a80[_0xe32d('0xa7')]=_0x399e73;var _0x887ed2={'ContactId':_0x399e73['id'],'phone':_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')],'WhatsappAccountId':_0x23c99a['params']['id']};var _0x3f0bcd={'ContactId':_0x399e73['id'],'WhatsappAccountId':_0x23c99a[_0xe32d('0x59')]['id'],'closed':![]};return db[_0xe32d('0xa8')][_0xe32d('0x5c')]({'where':_0x3f0bcd})[_0xe32d('0x21')](function(_0x52c247){if(_0x52c247){return[_0x52c247,![]];}return db[_0xe32d('0xa8')][_0xe32d('0x5d')](_0x887ed2)['then'](function(_0xe35620){return[_0xe35620,!![]];});});}})[_0xe32d('0x73')](function(_0x52f833,_0x36e270){_0x2f8a80[_0xe32d('0xa9')]=_0x52f833[_0xe32d('0x37')]({'plain':!![]});_0x2f8a80['interaction'][_0xe32d('0xaa')]=![];if(_0x36e270){if(_0x2f8a80['account'][_0xe32d('0xab')]){_0x2f8a80[_0xe32d('0x8a')]['push']({'id':0x0,'priority':_0x2f8a80['applications'][_0xe32d('0x4d')]+0x1,'app':'close','appdata':_0xe32d('0xac'),'interval':_0xe32d('0xad')});}_0x2f8a80[_0xe32d('0xa9')][_0xe32d('0xaa')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x97')],'messageId':_0x2f8a80['body'][_0xe32d('0x9b')],'body':_0x2f8a80[_0xe32d('0x5e')][_0xe32d('0x5e')],'WhatsappAccountId':_0x23c99a[_0xe32d('0x59')]['id'],'WhatsappInteractionId':_0x52f833['id'],'direction':'in','ContactId':_0x52f833['ContactId'],'AttachmentId':_0x2f8a80['body'][_0xe32d('0xae')]});})[_0xe32d('0x21')](function(_0x1395c4){_0x2f8a80[_0xe32d('0x28')]=_0x1395c4;if(!_0x2f8a80['interaction'][_0xe32d('0xaf')])return;return db[_0xe32d('0x78')][_0xe32d('0x5c')]({'attributes':['id','name'],'where':{'id':_0x2f8a80[_0xe32d('0xa9')]['UserId']}});})['then'](function(_0x5eb757){if(_0x5eb757){_0x2f8a80[_0xe32d('0x8a')][_0xe32d('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5eb757[_0xe32d('0x3c')]+','+(_0x2f8a80[_0xe32d('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0xe32d('0xad')});}if(!_0x2f8a80[_0xe32d('0xa9')][_0xe32d('0xb1')])return;return db['WhatsappQueue'][_0xe32d('0x5c')]({'attributes':['id','name'],'where':{'id':_0x2f8a80[_0xe32d('0xa9')][_0xe32d('0xb1')]}});})[_0xe32d('0x21')](function(_0x5deb46){if(_0x5deb46){_0x2f8a80[_0xe32d('0x8a')][_0xe32d('0xb0')]({'id':0x0,'priority':0x1,'app':_0xe32d('0xb2'),'appdata':_0x5deb46[_0xe32d('0x3c')]+','+(_0x2f8a80[_0xe32d('0x84')][_0xe32d('0xb3')]||0x12c),'interval':_0xe32d('0xad')});}return respondWithRpcPromise(_0xe32d('0xb4'),_0xe32d('0xb5'),_0x2f8a80);})[_0xe32d('0x21')](function(_0x461f98){if(_0x461f98){var _0x3101e8=0xc8;var _0x166fc8=_0xe32d('0xb6');logger['info'](_0xe32d('0xb7'),_0x166fc8,_0x3101e8,_0xe32d('0xb8'));logger[_0xe32d('0x24')](_0xe32d('0xb9'),_0x166fc8,_0x3101e8,_0xe32d('0xb8'),JSON['stringify'](_0x461f98));if(_0x2f8a80['account'][_0xe32d('0x44')]==='twilio'){return _0x35e951[_0xe32d('0x2a')](_0x3101e8)[_0xe32d('0x31')](_0xe32d('0xba'),'text/xml')[_0xe32d('0x3d')](_0xe32d('0xbb'));}else{return _0x35e951[_0xe32d('0x2a')](_0x3101e8)[_0xe32d('0x2c')](_0x461f98);}}});})[_0xe32d('0x29')](handleError(_0x35e951,null));};exports[_0xe32d('0x3d')]=function(_0x328990,_0x4fa6cf,_0x42114f){var _0x568f58,_0x239a89,_0x4bd5cb;if(_[_0xe32d('0x9e')](_0x328990[_0xe32d('0x5e')]['body'])||_0x328990[_0xe32d('0x5e')][_0xe32d('0x5e')]===''){throw new db[(_0xe32d('0x8e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x328990[_0xe32d('0x5e')]['to'])){throw new db['Sequelize'][(_0xe32d('0x8f'))](_0xe32d('0xbc'));}_0x568f58=_0x328990[_0xe32d('0x5e')]['to'];return db[_0xe32d('0x54')][_0xe32d('0x5c')]({'where':{'id':_0x328990[_0xe32d('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xe32d('0xbd'),'include':[{'model':db[_0xe32d('0x8d')],'as':_0xe32d('0xa3'),'where':{'mobile':_0x568f58},'limit':0x1,'order':[['updatedAt',_0xe32d('0xbe')]]}]}]})[_0xe32d('0x21')](handleEntityNotFound(_0x4fa6cf,null))[_0xe32d('0x21')](function(_0x7eee82){if(_0x7eee82&&_0x7eee82[_0xe32d('0xbd')]){_0x239a89=_0x7eee82['get']({'plain':!![]});if(_0x239a89[_0xe32d('0xbd')]&&_0x239a89[_0xe32d('0xbd')][_0xe32d('0xa3')][_0xe32d('0x4d')]){return _0x239a89[_0xe32d('0xbd')][_0xe32d('0xa3')][0x0];}return db[_0xe32d('0x8d')]['create'](_[_0xe32d('0xa6')](_0x328990[_0xe32d('0x5e')],{'firstName':_0x568f58,'mobile':_0x568f58,'phone':_0x568f58,'ListId':_0x239a89[_0xe32d('0x94')]}));}})[_0xe32d('0x21')](handleEntityNotFound(_0x4fa6cf,null))[_0xe32d('0x21')](function(_0x9ace26){if(_0x9ace26){_0x4bd5cb=_0x9ace26;return db[_0xe32d('0xa8')][_0xe32d('0x5c')]({'where':{'ContactId':_0x4bd5cb['id'],'closed':![],'WhatsappAccountId':_0x239a89['id']}})[_0xe32d('0x21')](function(_0x509c98){if(_0x509c98){return[_0x509c98,![]];}return db[_0xe32d('0xa8')][_0xe32d('0x5d')]({'UserId':_0x328990[_0xe32d('0x5f')]['id'],'ContactId':_0x4bd5cb['id'],'WhatsappAccountId':_0x239a89['id'],'phone':_0x568f58,'firstMsgDirection':_0xe32d('0xbf'),'Messages':[_['merge'](_0x328990[_0xe32d('0x5e')],{'read':![],'body':_0x328990['body'][_0xe32d('0x5e')],'phone':_0x568f58,'WhatsappAccountId':_0x239a89['id'],'UserId':_0x328990[_0xe32d('0x5f')]['id'],'ContactId':_0x4bd5cb['id']})]},{'include':[{'model':db[_0xe32d('0x88')],'as':_0xe32d('0xc0')}]})[_0xe32d('0x21')](function(_0x3542f8){return[_0x3542f8,!![]];});});}})[_0xe32d('0x73')](function(_0x1cb75e,_0x55a696){if(_0x55a696){return _0x1cb75e;}return db[_0xe32d('0x88')][_0xe32d('0x5d')](_[_0xe32d('0x5a')](_0x328990['body'],{'read':![],'body':_0x328990[_0xe32d('0x5e')]['body'],'phone':_0x568f58,'WhatsappAccountId':_0x239a89['id'],'WhatsappInteractionId':_0x1cb75e['id'],'UserId':_0x328990[_0xe32d('0x5f')]['id'],'ContactId':_0x4bd5cb['id']}))[_0xe32d('0x21')](function(_0x339458){_0x1cb75e[_0xe32d('0xc1')][_0xe32d('0xc0')]=[];_0x1cb75e[_0xe32d('0xc1')][_0xe32d('0xc0')]['push'](_0x339458[_0xe32d('0xc1')]);return _0x1cb75e;});})[_0xe32d('0x21')](respondWithResult(_0x4fa6cf,null))['catch'](handleError(_0x4fa6cf,null));}; \ No newline at end of file +var _0x7bb9=['isArray','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','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','CmList','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','AttachmentId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','DESC','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','findOne','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x7bb9[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require('moment');var BPromise=require(_0x97bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97bb('0x6'));var csv=require(_0x97bb('0x7'));var ejs=require(_0x97bb('0x8'));var fs=require('fs');var fs_extra=require(_0x97bb('0x9'));var _=require(_0x97bb('0xa'));var squel=require(_0x97bb('0xb'));var crypto=require(_0x97bb('0xc'));var jsforce=require(_0x97bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97bb('0x7'));var querystring=require(_0x97bb('0xe'));var Papa=require(_0x97bb('0xf'));var Redis=require(_0x97bb('0x10'));var authService=require(_0x97bb('0x11'));var qs=require(_0x97bb('0x12'));var as=require(_0x97bb('0x13'));var hardwareService=require(_0x97bb('0x14'));var logger=require(_0x97bb('0x15'))(_0x97bb('0x16'));var utils=require(_0x97bb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97bb('0x18'));var db=require('../../mysqldb')['db'];config[_0x97bb('0x19')]=_[_0x97bb('0x1a')](config[_0x97bb('0x19')],{'host':_0x97bb('0x1b'),'port':0x18eb});var socket=require(_0x97bb('0x1c'))(new Redis(config[_0x97bb('0x19')]));require(_0x97bb('0x1d'))[_0x97bb('0x1e')](socket);var jayson=require(_0x97bb('0x1f'));var client=jayson[_0x97bb('0x20')][_0x97bb('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x1daffb,_0x3d63f2,_0x5dbbd9,_0x149bfe){return new BPromise(function(_0x308a77,_0x4f8506){var _0x101741=_0x149bfe||client;return _0x101741[_0x97bb('0x22')](_0x1daffb,_0x5dbbd9)[_0x97bb('0x23')](function(_0x33bcfb){logger[_0x97bb('0x24')](_0x97bb('0x25'),_0x3d63f2,_0x97bb('0x26'));logger[_0x97bb('0x27')](_0x97bb('0x28'),_0x3d63f2,_0x97bb('0x26'),JSON[_0x97bb('0x29')](_0x33bcfb));if(_0x33bcfb[_0x97bb('0x2a')]){if(_0x33bcfb[_0x97bb('0x2a')]['code']===0x1f4){logger[_0x97bb('0x2a')](_0x97bb('0x25'),_0x3d63f2,_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);return _0x4f8506(_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);}logger[_0x97bb('0x2a')](_0x97bb('0x25'),_0x3d63f2,_0x33bcfb[_0x97bb('0x2a')]['message']);return _0x308a77(_0x33bcfb[_0x97bb('0x2a')][_0x97bb('0x2b')]);}else{logger[_0x97bb('0x24')](_0x97bb('0x25'),_0x3d63f2,_0x97bb('0x26'));_0x308a77(_0x33bcfb[_0x97bb('0x2c')]['message']);}})[_0x97bb('0x2d')](function(_0x3a55b4){logger[_0x97bb('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x3d63f2,_0x3a55b4);_0x4f8506(_0x3a55b4);});});}function respondWithStatusCode(_0x4d7ecd,_0x4e4701){_0x4e4701=_0x4e4701||0xcc;return function(_0x38e7a4){if(_0x38e7a4){return _0x4d7ecd[_0x97bb('0x2e')](_0x4e4701);}return _0x4d7ecd['status'](_0x4e4701)[_0x97bb('0x2f')]();};}function respondWithResult(_0x4d5c06,_0x5768d3){_0x5768d3=_0x5768d3||0xc8;return function(_0x46f90e){if(_0x46f90e){return _0x4d5c06[_0x97bb('0x30')](_0x5768d3)[_0x97bb('0x31')](_0x46f90e);}};}function respondWithFilteredResult(_0x2ed467,_0x49b4aa){return function(_0x2c1d70){if(_0x2c1d70){var _0xe3aa4e=typeof _0x49b4aa['offset']==='undefined'&&typeof _0x49b4aa[_0x97bb('0x32')]===_0x97bb('0x33');var _0x11e872=_0x2c1d70[_0x97bb('0x34')];var _0x1fc0d0=_0xe3aa4e?0x0:_0x49b4aa[_0x97bb('0x35')];var _0x294504=_0xe3aa4e?_0x2c1d70[_0x97bb('0x34')]:_0x49b4aa['offset']+_0x49b4aa[_0x97bb('0x32')];var _0x5cd733;if(_0x294504>=_0x11e872){_0x294504=_0x11e872;_0x5cd733=0xc8;}else{_0x5cd733=0xce;}_0x2ed467['status'](_0x5cd733);return _0x2ed467['set'](_0x97bb('0x36'),_0x1fc0d0+'-'+_0x294504+'/'+_0x11e872)[_0x97bb('0x31')](_0x2c1d70);}return null;};}function patchUpdates(_0x53cc9f){return function(_0x47fea0){try{jsonpatch[_0x97bb('0x37')](_0x47fea0,_0x53cc9f,!![]);}catch(_0x51b34e){return BPromise['reject'](_0x51b34e);}return _0x47fea0[_0x97bb('0x38')]();};}function saveUpdates(_0x5211ac,_0x1f135e){return function(_0x506af1){if(_0x506af1){return _0x506af1[_0x97bb('0x39')](_0x5211ac)[_0x97bb('0x23')](function(_0x44ca59){return _0x44ca59;});}return null;};}function removeEntity(_0xa524f2,_0x1c64c9){return function(_0x1baf65){if(_0x1baf65){return _0x1baf65[_0x97bb('0x3a')]()[_0x97bb('0x23')](function(){var _0x4d626c=_0x1baf65[_0x97bb('0x3b')]({'plain':!![]});var _0x28c0e4=_0x97bb('0x3c');return db[_0x97bb('0x3d')][_0x97bb('0x3a')]({'where':{'type':_0x28c0e4,'resourceId':_0x4d626c['id']}})[_0x97bb('0x23')](function(){return _0x1baf65;});})['then'](function(){_0xa524f2['status'](0xcc)[_0x97bb('0x2f')]();});}};}function handleEntityNotFound(_0x4f60d6,_0x49d45c){return function(_0x2686e1){if(!_0x2686e1){_0x4f60d6[_0x97bb('0x2e')](0x194);}return _0x2686e1;};}function handleError(_0xf96aa8,_0x27830c){_0x27830c=_0x27830c||0x1f4;return function(_0x243977){logger[_0x97bb('0x2a')](_0x243977[_0x97bb('0x3e')]);if(_0x243977[_0x97bb('0x3f')]){delete _0x243977[_0x97bb('0x3f')];}_0xf96aa8[_0x97bb('0x30')](_0x27830c)[_0x97bb('0x40')](_0x243977);};}exports[_0x97bb('0x41')]=function(_0x2888a5,_0x22d591){var _0x4e332e={'include':[{'model':db[_0x97bb('0x42')],'as':_0x97bb('0x43')}]},_0x554311={},_0x11b202={'count':0x0,'rows':[]};var _0x277987=_[_0x97bb('0x44')](db[_0x97bb('0x45')][_0x97bb('0x46')],function(_0x31fa26){return{'name':_0x31fa26['fieldName'],'type':_0x31fa26[_0x97bb('0x47')]['key']};});_0x554311[_0x97bb('0x48')]=_[_0x97bb('0x44')](_0x277987,_0x97bb('0x3f'));_0x554311[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x2888a5[_0x97bb('0x49')]);_0x554311[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x554311[_0x97bb('0x48')],_0x554311['query']);_0x4e332e[_0x97bb('0x4d')]=_['intersection'](_0x554311['model'],qs[_0x97bb('0x4e')](_0x2888a5['query']['fields']));_0x4e332e['attributes']=_0x4e332e[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x4e332e['attributes']:_0x554311[_0x97bb('0x48')];if(!_0x2888a5[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x4e332e[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x32')]);_0x4e332e[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x35')]);}_0x4e332e[_0x97bb('0x52')]=qs['sort'](_0x2888a5[_0x97bb('0x49')][_0x97bb('0x53')]);_0x4e332e[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_['pick'](_0x2888a5[_0x97bb('0x49')],_0x554311[_0x97bb('0x4b')]),_0x277987);if(_0x2888a5[_0x97bb('0x49')][_0x97bb('0x55')]){_0x4e332e[_0x97bb('0x54')]=_['merge'](_0x4e332e[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x277987,function(_0x3d10ef){if(_0x3d10ef['type']!==_0x97bb('0x56')){var _0x375ac0={};_0x375ac0[_0x3d10ef[_0x97bb('0x3f')]]={'$like':'%'+_0x2888a5['query']['filter']+'%'};return _0x375ac0;}})});}_0x4e332e=_[_0x97bb('0x57')]({},_0x4e332e,_0x2888a5[_0x97bb('0x58')]);var _0x4376b1={'where':_0x4e332e['where']};return db[_0x97bb('0x45')][_0x97bb('0x34')](_0x4376b1)['then'](function(_0x271053){_0x11b202['count']=_0x271053;if(_0x2888a5[_0x97bb('0x49')][_0x97bb('0x59')]){_0x4e332e['include']=[{'all':!![]}];}return db[_0x97bb('0x45')][_0x97bb('0x5a')](_0x4e332e);})[_0x97bb('0x23')](function(_0x36274f){_0x11b202[_0x97bb('0x5b')]=_0x36274f;return _0x11b202;})[_0x97bb('0x23')](respondWithFilteredResult(_0x22d591,_0x4e332e))[_0x97bb('0x2d')](handleError(_0x22d591,null));};exports['show']=function(_0x5b399b,_0x353866){var _0x4ce6b8={'raw':![],'where':{'id':_0x5b399b[_0x97bb('0x5c')]['id']},'include':[{'model':db[_0x97bb('0x42')],'as':'mandatoryDispositionPause'}]},_0x3031d0={};_0x3031d0[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x45')][_0x97bb('0x46')]);_0x3031d0[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x5b399b[_0x97bb('0x49')]);_0x3031d0[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x3031d0['model'],_0x3031d0[_0x97bb('0x49')]);_0x4ce6b8[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x3031d0[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x5b399b[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x4ce6b8[_0x97bb('0x4d')]=_0x4ce6b8[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x4ce6b8[_0x97bb('0x4d')]:_0x3031d0[_0x97bb('0x48')];if(_0x5b399b[_0x97bb('0x49')]['includeAll']){_0x4ce6b8['include']=[{'all':!![]}];}_0x4ce6b8=_['merge']({},_0x4ce6b8,_0x5b399b[_0x97bb('0x58')]);return db[_0x97bb('0x45')][_0x97bb('0x5d')](_0x4ce6b8)[_0x97bb('0x23')](handleEntityNotFound(_0x353866,null))[_0x97bb('0x23')](respondWithResult(_0x353866,null))['catch'](handleError(_0x353866,null));};exports[_0x97bb('0x5e')]=function(_0x13f2c9,_0x301d23){return db[_0x97bb('0x45')][_0x97bb('0x5e')](_0x13f2c9[_0x97bb('0x5f')],{})['then'](function(_0x12c307){var _0x5da80a=_0x13f2c9[_0x97bb('0x60')][_0x97bb('0x3b')]({'plain':!![]});if(!_0x5da80a)throw new Error(_0x97bb('0x61'));if(_0x5da80a[_0x97bb('0x62')]===_0x97bb('0x60')){var _0x145a12=_0x12c307[_0x97bb('0x3b')]({'plain':!![]});var _0x10a637='WhatsappAccounts';return db[_0x97bb('0x63')]['find']({'where':{'name':_0x10a637,'userProfileId':_0x5da80a[_0x97bb('0x64')]},'raw':!![]})['then'](function(_0x381417){if(_0x381417&&_0x381417[_0x97bb('0x65')]===0x0){return db[_0x97bb('0x3d')][_0x97bb('0x5e')]({'name':_0x145a12[_0x97bb('0x3f')],'resourceId':_0x145a12['id'],'type':_0x381417[_0x97bb('0x3f')],'sectionId':_0x381417['id']},{})[_0x97bb('0x23')](function(){return _0x12c307;});}else{return _0x12c307;}})[_0x97bb('0x2d')](function(_0x4ffdc6){logger[_0x97bb('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ffdc6);throw _0x4ffdc6;});}return _0x12c307;})[_0x97bb('0x23')](respondWithResult(_0x301d23,0xc9))[_0x97bb('0x2d')](handleError(_0x301d23,null));};exports[_0x97bb('0x39')]=function(_0x251c5a,_0x44d1d4){if(_0x251c5a[_0x97bb('0x5f')]['id']){delete _0x251c5a[_0x97bb('0x5f')]['id'];}return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x251c5a[_0x97bb('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x97bb('0x43')}]})[_0x97bb('0x23')](handleEntityNotFound(_0x44d1d4,null))['then'](saveUpdates(_0x251c5a[_0x97bb('0x5f')],null))[_0x97bb('0x23')](respondWithResult(_0x44d1d4,null))[_0x97bb('0x2d')](handleError(_0x44d1d4,null));};exports[_0x97bb('0x3a')]=function(_0x461628,_0x26dac4){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x461628[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x26dac4,null))[_0x97bb('0x23')](removeEntity(_0x26dac4,null))[_0x97bb('0x2d')](handleError(_0x26dac4,null));};exports[_0x97bb('0x66')]=function(_0x441c1f,_0x310d5a){return db[_0x97bb('0x45')]['describe']()['then'](respondWithResult(_0x310d5a,null))[_0x97bb('0x2d')](handleError(_0x310d5a,null));};exports[_0x97bb('0x67')]=function(_0x5c2489,_0x946eb2,_0x1ee1f6){if(_0x5c2489['body']['id']){delete _0x5c2489['body']['id'];}return db[_0x97bb('0x45')]['find']({'where':{'id':_0x5c2489[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x946eb2,null))[_0x97bb('0x23')](function(_0x244cb8){if(_0x244cb8){_0x5c2489[_0x97bb('0x5f')][_0x97bb('0x68')]=_0x244cb8['id'];return db[_0x97bb('0x69')][_0x97bb('0x5e')](_0x5c2489[_0x97bb('0x5f')]);}})[_0x97bb('0x23')](respondWithResult(_0x946eb2,null))[_0x97bb('0x2d')](handleError(_0x946eb2,null));};exports['getDispositions']=function(_0x54aea7,_0xf1478a,_0x395175){var _0x338b75={'raw':![],'where':{}};var _0x3fffdf={};var _0x8d9838={'count':0x0,'rows':[]};return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x54aea7['params']['id']}})['then'](handleEntityNotFound(_0xf1478a,null))[_0x97bb('0x23')](function(_0x809746){if(_0x809746){_0x3fffdf[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x69')][_0x97bb('0x46')]);_0x3fffdf['query']=_['keys'](_0x54aea7[_0x97bb('0x49')]);_0x3fffdf[_0x97bb('0x4b')]=_[_0x97bb('0x4c')](_0x3fffdf['model'],_0x3fffdf['query']);_0x338b75[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x3fffdf[_0x97bb('0x48')],qs['fields'](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x338b75[_0x97bb('0x4d')]=_0x338b75['attributes'][_0x97bb('0x4f')]?_0x338b75[_0x97bb('0x4d')]:_0x3fffdf['model'];if(!_0x54aea7[_0x97bb('0x49')]['hasOwnProperty']('nolimit')){_0x338b75[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x32')]);_0x338b75[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x54aea7[_0x97bb('0x49')][_0x97bb('0x35')]);}_0x338b75['order']=qs['sort'](_0x54aea7[_0x97bb('0x49')]['sort']);_0x338b75['where']=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x54aea7[_0x97bb('0x49')],_0x3fffdf[_0x97bb('0x4b')]));_0x338b75['where'][_0x97bb('0x68')]=_0x809746['id'];if(_0x54aea7[_0x97bb('0x49')]['filter']){_0x338b75[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x338b75[_0x97bb('0x54')],{'$or':_['map'](_0x338b75[_0x97bb('0x4d')],function(_0x5f01a0){var _0x3227f5={};_0x3227f5[_0x5f01a0]={'$like':'%'+_0x54aea7['query'][_0x97bb('0x55')]+'%'};return _0x3227f5;})});}_0x338b75=_[_0x97bb('0x57')]({},_0x338b75,_0x54aea7[_0x97bb('0x58')]);return db[_0x97bb('0x69')][_0x97bb('0x34')]({'where':_0x338b75[_0x97bb('0x54')]})[_0x97bb('0x23')](function(_0x39d58e){_0x8d9838[_0x97bb('0x34')]=_0x39d58e;if(_0x54aea7[_0x97bb('0x49')][_0x97bb('0x59')]){_0x338b75[_0x97bb('0x6c')]=[{'all':!![]}];}return db['Disposition'][_0x97bb('0x5a')](_0x338b75);})[_0x97bb('0x23')](function(_0xf29d90){_0x8d9838[_0x97bb('0x5b')]=_0xf29d90;return _0x8d9838;});}})[_0x97bb('0x23')](respondWithFilteredResult(_0xf1478a,_0x338b75))[_0x97bb('0x2d')](handleError(_0xf1478a,null));};exports[_0x97bb('0x6d')]=function(_0x14b1cd,_0x181cf1,_0x5be8e0){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x14b1cd[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x181cf1,null))[_0x97bb('0x23')](function(_0x5c18fc){if(_0x5c18fc){return _0x5c18fc[_0x97bb('0x6d')](_0x14b1cd[_0x97bb('0x49')][_0x97bb('0x6e')]);}})[_0x97bb('0x23')](respondWithStatusCode(_0x181cf1,null))[_0x97bb('0x2d')](handleError(_0x181cf1,null));};exports[_0x97bb('0x6f')]=function(_0x3e373a,_0x2fbb8d,_0x4cc100){if(_0x3e373a[_0x97bb('0x5f')]['id']){delete _0x3e373a['body']['id'];}return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x3e373a[_0x97bb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2fbb8d,null))[_0x97bb('0x23')](function(_0x24683f){if(_0x24683f){_0x3e373a['body'][_0x97bb('0x68')]=_0x24683f['id'];return db[_0x97bb('0x70')][_0x97bb('0x5e')](_0x3e373a[_0x97bb('0x5f')]);}})[_0x97bb('0x23')](respondWithResult(_0x2fbb8d,null))['catch'](handleError(_0x2fbb8d,null));};exports[_0x97bb('0x71')]=function(_0x288e12,_0x535a66,_0xc55d67){var _0x1e532a={'raw':![],'where':{}};var _0x2023ad={};var _0x451cb1={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x97bb('0x6a')]({'where':{'id':_0x288e12[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x535a66,null))[_0x97bb('0x23')](function(_0xe9d971){if(_0xe9d971){_0x2023ad['model']=_['keys'](db[_0x97bb('0x70')][_0x97bb('0x46')]);_0x2023ad[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x288e12[_0x97bb('0x49')]);_0x2023ad['filters']=_[_0x97bb('0x4c')](_0x2023ad[_0x97bb('0x48')],_0x2023ad[_0x97bb('0x49')]);_0x1e532a['attributes']=_[_0x97bb('0x4c')](_0x2023ad[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x288e12[_0x97bb('0x49')][_0x97bb('0x4e')]));_0x1e532a['attributes']=_0x1e532a[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x1e532a[_0x97bb('0x4d')]:_0x2023ad[_0x97bb('0x48')];if(!_0x288e12[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x1e532a[_0x97bb('0x32')]=qs['limit'](_0x288e12[_0x97bb('0x49')][_0x97bb('0x32')]);_0x1e532a[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x288e12['query']['offset']);}_0x1e532a[_0x97bb('0x52')]=qs['sort'](_0x288e12['query']['sort']);_0x1e532a[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x288e12[_0x97bb('0x49')],_0x2023ad[_0x97bb('0x4b')]));_0x1e532a[_0x97bb('0x54')]['WhatsappAccountId']=_0xe9d971['id'];if(_0x288e12['query'][_0x97bb('0x55')]){_0x1e532a[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x1e532a['where'],{'$or':_[_0x97bb('0x44')](_0x1e532a[_0x97bb('0x4d')],function(_0x534c60){var _0x44cfe8={};_0x44cfe8[_0x534c60]={'$like':'%'+_0x288e12[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x44cfe8;})});}_0x1e532a=_[_0x97bb('0x57')]({},_0x1e532a,_0x288e12[_0x97bb('0x58')]);return db[_0x97bb('0x70')]['count']({'where':_0x1e532a[_0x97bb('0x54')]})[_0x97bb('0x23')](function(_0x2b040d){_0x451cb1[_0x97bb('0x34')]=_0x2b040d;if(_0x288e12[_0x97bb('0x49')][_0x97bb('0x59')]){_0x1e532a[_0x97bb('0x6c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1e532a);})['then'](function(_0x3d800b){_0x451cb1['rows']=_0x3d800b;return _0x451cb1;});}})[_0x97bb('0x23')](respondWithFilteredResult(_0x535a66,_0x1e532a))[_0x97bb('0x2d')](handleError(_0x535a66,null));};exports['removeAnswers']=function(_0x58bf0b,_0x3a2399,_0x303818){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x58bf0b['params']['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x3a2399,null))[_0x97bb('0x23')](function(_0x571d18){if(_0x571d18){return _0x571d18[_0x97bb('0x72')](_0x58bf0b[_0x97bb('0x49')][_0x97bb('0x6e')]);}})[_0x97bb('0x23')](respondWithStatusCode(_0x3a2399,null))[_0x97bb('0x2d')](handleError(_0x3a2399,null));};exports[_0x97bb('0x73')]=function(_0x5a8b81,_0x503300,_0xd5aab4){return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x5a8b81[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x503300,null))[_0x97bb('0x23')](function(_0x1162df){if(_0x1162df){return _0x1162df[_0x97bb('0x73')](_0x5a8b81[_0x97bb('0x5f')]['ids'],_[_0x97bb('0x74')](_0x5a8b81[_0x97bb('0x5f')],['ids','id'])||{})[_0x97bb('0x75')](function(_0x5a3565){for(var _0x2af565=0x0;_0x2af565<_0x5a8b81[_0x97bb('0x5f')][_0x97bb('0x6e')][_0x97bb('0x4f')];_0x2af565+=0x1){socket[_0x97bb('0x76')](_0x97bb('0x77'),{'UserId':Number(_0x5a8b81[_0x97bb('0x5f')]['ids'][_0x2af565]),'WhatsappAccountId':Number(_0x5a8b81['params']['id'])});}return _0x5a3565;});}})['then'](respondWithResult(_0x503300,null))[_0x97bb('0x2d')](handleError(_0x503300,null));};exports[_0x97bb('0x78')]=function(_0x361cc9,_0x5e3ff5,_0x2b7cbf){return db['WhatsappAccount'][_0x97bb('0x5d')]({'where':{'id':_0x361cc9[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x5e3ff5,null))[_0x97bb('0x23')](function(_0x2c1f4d){if(_0x2c1f4d){return _0x2c1f4d['removeAgents'](_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')])[_0x97bb('0x23')](function(){if(_[_0x97bb('0x79')](_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')])){for(var _0x2a63da=0x0;_0x2a63da<_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')][_0x97bb('0x4f')];_0x2a63da+=0x1){socket['emit'](_0x97bb('0x7a'),{'UserId':Number(_0x361cc9[_0x97bb('0x49')][_0x97bb('0x6e')][_0x2a63da]),'WhatsappAccountId':Number(_0x361cc9[_0x97bb('0x5c')]['id'])});}}else{socket[_0x97bb('0x76')](_0x97bb('0x7a'),{'UserId':Number(_0x361cc9['query'][_0x97bb('0x6e')]),'WhatsappAccountId':Number(_0x361cc9['params']['id'])});}});}})[_0x97bb('0x23')](respondWithStatusCode(_0x5e3ff5,null))[_0x97bb('0x2d')](handleError(_0x5e3ff5,null));};exports[_0x97bb('0x7b')]=function(_0x70e9d1,_0x42fc97,_0x87df23){var _0x586219={};var _0x2c3aff={};var _0x556256;var _0x45d8da;return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x70e9d1[_0x97bb('0x5c')]['id']}})[_0x97bb('0x23')](handleEntityNotFound(_0x42fc97,null))[_0x97bb('0x23')](function(_0x2696b5){if(_0x2696b5){_0x556256=_0x2696b5;_0x2c3aff[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x7c')][_0x97bb('0x46')]);_0x2c3aff[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x70e9d1[_0x97bb('0x49')]);_0x2c3aff[_0x97bb('0x4b')]=_['intersection'](_0x2c3aff[_0x97bb('0x48')],_0x2c3aff[_0x97bb('0x49')]);_0x586219[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x2c3aff[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x70e9d1[_0x97bb('0x49')]['fields']));_0x586219[_0x97bb('0x4d')]=_0x586219[_0x97bb('0x4d')]['length']?_0x586219[_0x97bb('0x4d')]:_0x2c3aff[_0x97bb('0x48')];_0x586219[_0x97bb('0x52')]=qs['sort'](_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x53')]);_0x586219[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x70e9d1[_0x97bb('0x49')],_0x2c3aff[_0x97bb('0x4b')]));if(_0x70e9d1[_0x97bb('0x49')]['filter']){_0x586219[_0x97bb('0x54')]=_[_0x97bb('0x57')](_0x586219[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x586219[_0x97bb('0x4d')],function(_0x334528){var _0x12c033={};_0x12c033[_0x334528]={'$like':'%'+_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x12c033;})});}_0x586219=_[_0x97bb('0x57')]({},_0x586219,_0x70e9d1['options']);return _0x556256[_0x97bb('0x7b')](_0x586219);}})[_0x97bb('0x23')](function(_0x1d7be1){if(_0x1d7be1){_0x45d8da=_0x1d7be1[_0x97bb('0x4f')];if(!_0x70e9d1[_0x97bb('0x49')][_0x97bb('0x50')](_0x97bb('0x51'))){_0x586219[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x70e9d1['query'][_0x97bb('0x32')]);_0x586219[_0x97bb('0x35')]=qs['offset'](_0x70e9d1['query'][_0x97bb('0x35')]);}return _0x556256[_0x97bb('0x7b')](_0x586219);}})[_0x97bb('0x23')](function(_0x585075){if(_0x585075){return _0x585075?{'count':_0x45d8da,'rows':_0x585075}:null;}})['then'](respondWithResult(_0x42fc97,null))[_0x97bb('0x2d')](handleError(_0x42fc97,null));};exports['addApplications']=function(_0x1b2ca9,_0x12f745){var _0x5c1056=_0x1b2ca9[_0x97bb('0x5c')]['id'];var _0x10567b=_0x1b2ca9[_0x97bb('0x5f')];var _0x22699f=0xc8;var _0x3a7621=null;return db['sequelize'][_0x97bb('0x7d')]({'isolationLevel':db[_0x97bb('0x7e')][_0x97bb('0x7f')][_0x97bb('0x80')][_0x97bb('0x81')]},function(_0x41d2a2){return db[_0x97bb('0x45')]['findOne']({'where':{'id':_0x5c1056},'transaction':_0x41d2a2})['then'](function(_0x14f187){if(_0x14f187){return db[_0x97bb('0x82')][_0x97bb('0x3a')]({'where':{'WhatsappAccountId':_0x5c1056},'transaction':_0x41d2a2})[_0x97bb('0x23')](function(){var _0x226515=_['map'](_0x10567b,function(_0x4d8c81){_0x4d8c81[_0x97bb('0x68')]=_0x5c1056;return _0x4d8c81;});return db['WhatsappApplication'][_0x97bb('0x83')](_0x226515,{'transaction':_0x41d2a2});});}else{_0x22699f=0x194;_0x3a7621=[];}});})[_0x97bb('0x23')](function(){if(_0x22699f!==0x194){return db[_0x97bb('0x82')][_0x97bb('0x84')]({'where':{'WhatsappAccountId':_0x5c1056},'order':_0x97bb('0x85')})[_0x97bb('0x23')](function(_0xb3bb2c){_0x3a7621=_0xb3bb2c;});}})[_0x97bb('0x2d')](function(_0x5c98a0){_0x22699f=0x1f4;logger[_0x97bb('0x2a')](_0x5c98a0[_0x97bb('0x3e')]);if(_0x5c98a0[_0x97bb('0x3f')]){delete _0x5c98a0[_0x97bb('0x3f')];}_0x3a7621=_0x5c98a0;})[_0x97bb('0x86')](function(){if(_0x3a7621===null){_0x12f745[_0x97bb('0x2e')](_0x22699f);}else{if(_0x22699f===0x1f4){_0x12f745[_0x97bb('0x30')](_0x22699f)[_0x97bb('0x40')](_0x3a7621);}else{_0x12f745['status'](_0x22699f)[_0x97bb('0x31')](_0x3a7621);}}});};exports[_0x97bb('0x87')]=function(_0x370156,_0xf5c471,_0x4effd6){var _0x3103d5={};var _0x4656e8={};var _0x4a3ea3;var _0x31e51e;return db[_0x97bb('0x45')][_0x97bb('0x6a')]({'where':{'id':_0x370156['params']['id']}})['then'](handleEntityNotFound(_0xf5c471,null))[_0x97bb('0x23')](function(_0x2eddea){if(_0x2eddea){_0x4a3ea3=_0x2eddea;_0x4656e8[_0x97bb('0x48')]=_['keys'](db[_0x97bb('0x82')][_0x97bb('0x46')]);_0x4656e8[_0x97bb('0x49')]=_[_0x97bb('0x4a')](_0x370156['query']);_0x4656e8[_0x97bb('0x4b')]=_['intersection'](_0x4656e8[_0x97bb('0x48')],_0x4656e8[_0x97bb('0x49')]);_0x3103d5[_0x97bb('0x4d')]=_[_0x97bb('0x4c')](_0x4656e8[_0x97bb('0x48')],qs[_0x97bb('0x4e')](_0x370156['query'][_0x97bb('0x4e')]));_0x3103d5[_0x97bb('0x4d')]=_0x3103d5[_0x97bb('0x4d')][_0x97bb('0x4f')]?_0x3103d5[_0x97bb('0x4d')]:_0x4656e8[_0x97bb('0x48')];_0x3103d5[_0x97bb('0x52')]=qs['sort'](_0x370156['query'][_0x97bb('0x53')]);_0x3103d5[_0x97bb('0x54')]=qs[_0x97bb('0x4b')](_[_0x97bb('0x6b')](_0x370156[_0x97bb('0x49')],_0x4656e8['filters']));if(_0x370156[_0x97bb('0x49')]['filter']){_0x3103d5['where']=_[_0x97bb('0x57')](_0x3103d5[_0x97bb('0x54')],{'$or':_[_0x97bb('0x44')](_0x3103d5[_0x97bb('0x4d')],function(_0x1d505e){var _0x34b4a5={};_0x34b4a5[_0x1d505e]={'$like':'%'+_0x370156[_0x97bb('0x49')][_0x97bb('0x55')]+'%'};return _0x34b4a5;})});}_0x3103d5=_['merge']({},_0x3103d5,_0x370156[_0x97bb('0x58')]);return _0x4a3ea3['getApplications'](_0x3103d5);}})[_0x97bb('0x23')](function(_0x5029a3){if(_0x5029a3){_0x31e51e=_0x5029a3[_0x97bb('0x4f')];if(!_0x370156['query'][_0x97bb('0x50')](_0x97bb('0x51'))){_0x3103d5[_0x97bb('0x32')]=qs[_0x97bb('0x32')](_0x370156[_0x97bb('0x49')][_0x97bb('0x32')]);_0x3103d5[_0x97bb('0x35')]=qs[_0x97bb('0x35')](_0x370156[_0x97bb('0x49')]['offset']);}return _0x4a3ea3[_0x97bb('0x87')](_0x3103d5);}})[_0x97bb('0x23')](function(_0x321e5c){if(_0x321e5c){return _0x321e5c?{'count':_0x31e51e,'rows':_0x321e5c}:null;}})[_0x97bb('0x23')](respondWithResult(_0xf5c471,null))[_0x97bb('0x2d')](handleError(_0xf5c471,null));};exports[_0x97bb('0x88')]=function(_0x83116e,_0x26fc25,_0x451e08){var _0x1d1f9d={'channel':_0x97bb('0x89')};var _0x116737=[];var _0x1ee20b=[];var _0x3328f9={};return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x83116e['params']['id']},'include':[{'model':db[_0x97bb('0x82')],'as':_0x97bb('0x8a')}]})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))['then'](function(_0x321932){_0x1d1f9d[_0x97bb('0x8b')]=_0x321932;if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]===_0x97bb('0x8c')&&_0x83116e['body'][_0x97bb('0x8d')]){if(_0x83116e[_0x97bb('0x5f')][_0x97bb('0x8d')]['length']===0x0)return;if(_0x83116e[_0x97bb('0x5f')][_0x97bb('0x8d')][0x0][_0x97bb('0x8e')]!==_0x97bb('0x8f'))return;return db[_0x97bb('0x90')][_0x97bb('0x39')]({'read':!![],'readAt':_0x83116e['body']['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x83116e[_0x97bb('0x5f')]['statuses'][0x0][_0x97bb('0x91')]},'individualHooks':!![]})[_0x97bb('0x23')](function(_0x56d74a){return _0x26fc25[_0x97bb('0x30')](0xc8)[_0x97bb('0x31')](_0x56d74a);});}_0x1d1f9d[_0x97bb('0x92')]=_[_0x97bb('0x93')](_0x321932[_0x97bb('0x8a')],['priority'],[_0x97bb('0x94')]);if(_0x1d1f9d[_0x97bb('0x8b')]['Applications']){delete _0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x8a')];}return db[_0x97bb('0x95')][_0x97bb('0x66')]()[_0x97bb('0x23')](function(_0x14fa37){if(!_0x14fa37){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0x98'));}_0x116737=_[_0x97bb('0x99')](_[_0x97bb('0x4a')](_0x14fa37),[_0x97bb('0x9a'),_0x97bb('0x9b')]);_0x1ee20b=_['difference'](_[_0x97bb('0x4a')](_0x14fa37),['createdAt',_0x97bb('0x9b'),_0x97bb('0x9c'),_0x97bb('0x9d')]);_0x1d1f9d['body']={'mapKey':_0x97bb('0x9e')};if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]===_0x97bb('0x9f')){_0x1d1f9d['body']['from']=_0x83116e['body'][_0x97bb('0xa0')][_0x97bb('0xa1')](_0x97bb('0xa2'),'');_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')]=_0x83116e['body'][_0x97bb('0xa3')];_0x1d1f9d[_0x97bb('0x5f')]['messageId']=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa4')];}if(_0x1d1f9d[_0x97bb('0x8b')]&&_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x47')]==='sinch'){_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')]=_0x83116e['body']['notifications'][0x0][_0x97bb('0xa5')];_0x1d1f9d['body'][_0x97bb('0x5f')]=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa6')][0x0][_0x97bb('0x2b')][_0x97bb('0x5f')];_0x1d1f9d[_0x97bb('0x5f')]['messageId']=_0x83116e[_0x97bb('0x5f')][_0x97bb('0xa6')][0x0][_0x97bb('0x91')];}if(_0x1d1f9d['body']['id']){delete _0x1d1f9d[_0x97bb('0x5f')]['id'];}if(_['isNil'](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')])){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xa7'));}if(_[_0x97bb('0xa8')](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')])||_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')]===''){throw new db[(_0x97bb('0x96'))]['ValidationError'](_0x97bb('0xa9'));}if(_[_0x97bb('0xa8')](_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')])){throw new db[(_0x97bb('0x96'))]['ValidationError'](_0x97bb('0xab')+_0x1ee20b);}if(!_[_0x97bb('0xac')](_0x1ee20b,_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')])){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xad')+_0x1ee20b);}_0x3328f9[_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xaa')]]=_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')];return db[_0x97bb('0xae')][_0x97bb('0x5d')]({'where':{'id':_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0x9d')]},'include':[{'model':db[_0x97bb('0x95')],'as':'Contacts','where':_0x3328f9,'limit':0x1,'order':[[_0x97bb('0x9b'),'DESC']]}]});})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))['then'](function(_0x3d4079){if(_0x3d4079){_0x1d1f9d[_0x97bb('0xaf')]=_[_0x97bb('0x74')](_0x3d4079,[_0x97bb('0xb0')]);if(_0x3d4079['Contacts'][_0x97bb('0x4f')]){return _0x3d4079[_0x97bb('0xb0')][0x0];}var _0x19574c=_[_0x97bb('0x1a')](_0x1d1f9d[_0x97bb('0x5f')],{'firstName':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')],'ListId':_0x3d4079['id']});_0x19574c[_0x1d1f9d['body']['mapKey']]=_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')];return db[_0x97bb('0x95')][_0x97bb('0x5e')](_0x19574c,{'fields':_0x116737,'raw':!![]});}})[_0x97bb('0x23')](handleEntityNotFound(_0x26fc25,null))[_0x97bb('0x23')](function(_0x52cb5d){if(_0x52cb5d){_0x1d1f9d[_0x97bb('0xb1')]=_0x52cb5d;var _0x58a54e={'ContactId':_0x52cb5d['id'],'phone':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xa5')],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id']};var _0x2cc95a={'ContactId':_0x52cb5d['id'],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x97bb('0x5d')]({'where':_0x2cc95a})[_0x97bb('0x23')](function(_0x490beb){if(_0x490beb){return[_0x490beb,![]];}return db[_0x97bb('0xb2')][_0x97bb('0x5e')](_0x58a54e)[_0x97bb('0x23')](function(_0x53174b){return[_0x53174b,!![]];});});}})['spread'](function(_0x27677e,_0xfa5a0f){_0x1d1f9d[_0x97bb('0xb3')]=_0x27677e['get']({'plain':!![]});_0x1d1f9d[_0x97bb('0xb3')][_0x97bb('0xb4')]=![];if(_0xfa5a0f){if(_0x1d1f9d['account'][_0x97bb('0xb5')]){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb6')]({'id':0x0,'priority':_0x1d1f9d['applications'][_0x97bb('0x4f')]+0x1,'app':'close','appdata':_0x97bb('0xb7'),'interval':'*,*,*,*'});}_0x1d1f9d[_0x97bb('0xb3')][_0x97bb('0xb4')]=!![];}return db[_0x97bb('0x90')]['create']({'phone':_0x1d1f9d['body'][_0x97bb('0xa5')],'messageId':_0x1d1f9d[_0x97bb('0x5f')]['messageId'],'body':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0x5f')],'WhatsappAccountId':_0x83116e[_0x97bb('0x5c')]['id'],'WhatsappInteractionId':_0x27677e['id'],'direction':'in','ContactId':_0x27677e['ContactId'],'AttachmentId':_0x1d1f9d[_0x97bb('0x5f')][_0x97bb('0xb8')]});})['then'](function(_0x4587ca){_0x1d1f9d[_0x97bb('0x2b')]=_0x4587ca;if(!_0x1d1f9d[_0x97bb('0xb3')]['UserId'])return;return db['User'][_0x97bb('0x5d')]({'attributes':['id',_0x97bb('0x3f')],'where':{'id':_0x1d1f9d['interaction']['UserId']}});})['then'](function(_0x1dbd3a){if(_0x1dbd3a){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb9')]({'id':0x0,'priority':0x0,'app':_0x97bb('0xba'),'appdata':_0x1dbd3a[_0x97bb('0x3f')]+','+(_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0xbb')]||0xa),'interval':_0x97bb('0xbc')});}if(!_0x1d1f9d['interaction'][_0x97bb('0xbd')])return;return db[_0x97bb('0xbe')][_0x97bb('0x5d')]({'attributes':['id',_0x97bb('0x3f')],'where':{'id':_0x1d1f9d['interaction'][_0x97bb('0xbd')]}});})['then'](function(_0xa85063){if(_0xa85063){_0x1d1f9d[_0x97bb('0x92')][_0x97bb('0xb9')]({'id':0x0,'priority':0x1,'app':_0x97bb('0xbf'),'appdata':_0xa85063['name']+','+(_0x1d1f9d[_0x97bb('0x8b')][_0x97bb('0xc0')]||0x12c),'interval':_0x97bb('0xbc')});}return respondWithRpcPromise(_0x97bb('0xc1'),_0x97bb('0xc2'),_0x1d1f9d);})[_0x97bb('0x23')](function(_0x5a10fb){if(_0x5a10fb){var _0x22aca1=0xc8;var _0xf8d658='receiveMessage';logger['info'](_0x97bb('0x28'),_0xf8d658,_0x22aca1,_0x97bb('0xc3'));logger[_0x97bb('0x27')](_0x97bb('0xc4'),_0xf8d658,_0x22aca1,_0x97bb('0xc3'),JSON[_0x97bb('0x29')](_0x5a10fb));if(_0x1d1f9d[_0x97bb('0x8b')]['type']===_0x97bb('0x9f')){return _0x26fc25[_0x97bb('0x30')](_0x22aca1)[_0x97bb('0xc5')]('Content-Type',_0x97bb('0xc6'))['send']('\x0a');}else{return _0x26fc25['status'](_0x22aca1)['json'](_0x5a10fb);}}});})[_0x97bb('0x2d')](handleError(_0x26fc25,null));};exports['send']=function(_0x8458d3,_0x3c6a7d,_0x18d6fb){var _0x1df677,_0x51c456,_0x9ae2be;if(_['isNil'](_0x8458d3[_0x97bb('0x5f')]['body'])||_0x8458d3[_0x97bb('0x5f')][_0x97bb('0x5f')]===''){throw new db[(_0x97bb('0x96'))][(_0x97bb('0x97'))](_0x97bb('0xa9'));}if(_[_0x97bb('0xa8')](_0x8458d3[_0x97bb('0x5f')]['to'])){throw new db[(_0x97bb('0x96'))]['ValidationError']('to\x20is\x20mandatory');}_0x1df677=_0x8458d3[_0x97bb('0x5f')]['to'];return db[_0x97bb('0x45')][_0x97bb('0x5d')]({'where':{'id':_0x8458d3[_0x97bb('0x5c')]['id']},'include':[{'model':db[_0x97bb('0xae')],'as':'List','include':[{'model':db[_0x97bb('0x95')],'as':_0x97bb('0xb0'),'where':{'mobile':_0x1df677},'limit':0x1,'order':[['updatedAt',_0x97bb('0xc7')]]}]}]})[_0x97bb('0x23')](handleEntityNotFound(_0x3c6a7d,null))['then'](function(_0x3c9fa2){if(_0x3c9fa2&&_0x3c9fa2[_0x97bb('0xc8')]){_0x51c456=_0x3c9fa2[_0x97bb('0x3b')]({'plain':!![]});if(_0x51c456[_0x97bb('0xc8')]&&_0x51c456[_0x97bb('0xc8')][_0x97bb('0xb0')][_0x97bb('0x4f')]){return _0x51c456['List'][_0x97bb('0xb0')][0x0];}return db[_0x97bb('0x95')][_0x97bb('0x5e')](_[_0x97bb('0x1a')](_0x8458d3[_0x97bb('0x5f')],{'firstName':_0x1df677,'mobile':_0x1df677,'phone':_0x1df677,'ListId':_0x51c456[_0x97bb('0x9d')]}));}})[_0x97bb('0x23')](handleEntityNotFound(_0x3c6a7d,null))[_0x97bb('0x23')](function(_0x4d251d){if(_0x4d251d){_0x9ae2be=_0x4d251d;return db['WhatsappInteraction'][_0x97bb('0x5d')]({'where':{'ContactId':_0x9ae2be['id'],'closed':![],'WhatsappAccountId':_0x51c456['id']}})[_0x97bb('0x23')](function(_0x16a188){if(_0x16a188){return[_0x16a188,![]];}return db[_0x97bb('0xb2')][_0x97bb('0x5e')]({'UserId':_0x8458d3['user']['id'],'ContactId':_0x9ae2be['id'],'WhatsappAccountId':_0x51c456['id'],'phone':_0x1df677,'firstMsgDirection':_0x97bb('0xc9'),'Messages':[_[_0x97bb('0x57')](_0x8458d3[_0x97bb('0x5f')],{'read':![],'body':_0x8458d3['body'][_0x97bb('0x5f')],'phone':_0x1df677,'WhatsappAccountId':_0x51c456['id'],'UserId':_0x8458d3[_0x97bb('0x60')]['id'],'ContactId':_0x9ae2be['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x2ace41){return[_0x2ace41,!![]];});});}})[_0x97bb('0x75')](function(_0x3e114b,_0x4513b6){if(_0x4513b6){return _0x3e114b;}return db[_0x97bb('0x90')][_0x97bb('0x5e')](_['merge'](_0x8458d3[_0x97bb('0x5f')],{'read':![],'body':_0x8458d3[_0x97bb('0x5f')]['body'],'phone':_0x1df677,'WhatsappAccountId':_0x51c456['id'],'WhatsappInteractionId':_0x3e114b['id'],'UserId':_0x8458d3[_0x97bb('0x60')]['id'],'ContactId':_0x9ae2be['id']}))[_0x97bb('0x23')](function(_0x1e81e8){_0x3e114b[_0x97bb('0xca')][_0x97bb('0xcb')]=[];_0x3e114b[_0x97bb('0xca')][_0x97bb('0xcb')][_0x97bb('0xb6')](_0x1e81e8[_0x97bb('0xca')]);return _0x3e114b;});})[_0x97bb('0x23')](respondWithResult(_0x3c6a7d,null))[_0x97bb('0x2d')](handleError(_0x3c6a7d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 29ec943..1781130 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 _0xcf35=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit'];(function(_0x2b8d9e,_0x38f52a){var _0x380e14=function(_0xfc9680){while(--_0xfc9680){_0x2b8d9e['push'](_0x2b8d9e['shift']());}};_0x380e14(++_0x38f52a);}(_0xcf35,0x17f));var _0x5cf3=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xcf35[_0x40348a];return _0x290d46;};'use strict';var EventEmitter=require(_0x5cf3('0x0'));var WhatsappAccount=require(_0x5cf3('0x1'))['db'][_0x5cf3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5cf3('0x3')](0x0);var events={'afterCreate':_0x5cf3('0x4'),'afterUpdate':'update','afterDestroy':_0x5cf3('0x5')};function emitEvent(_0x537837){return function(_0x5b5d71,_0x5a43a5,_0x429ca5){WhatsappAccountEvents[_0x5cf3('0x6')](_0x537837+':'+_0x5b5d71['id'],_0x5b5d71);WhatsappAccountEvents[_0x5cf3('0x6')](_0x537837,_0x5b5d71);_0x429ca5(null);};}for(var e in events){if(events[_0x5cf3('0x7')](e)){var event=events[e];WhatsappAccount[_0x5cf3('0x8')](e,emitEvent(event));}}module[_0x5cf3('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xbeda=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x38d6e8,_0x21c3b9){var _0x37e27f=function(_0x2e9a3e){while(--_0x2e9a3e){_0x38d6e8['push'](_0x38d6e8['shift']());}};_0x37e27f(++_0x21c3b9);}(_0xbeda,0xe7));var _0xabed=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xbeda[_0x240261];return _0x45c332;};'use strict';var EventEmitter=require(_0xabed('0x0'));var WhatsappAccount=require(_0xabed('0x1'))['db'][_0xabed('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xabed('0x3')](0x0);var events={'afterCreate':_0xabed('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17074c){return function(_0x46fab2,_0x5e92e7,_0x31084a){WhatsappAccountEvents[_0xabed('0x5')](_0x17074c+':'+_0x46fab2['id'],_0x46fab2);WhatsappAccountEvents[_0xabed('0x5')](_0x17074c,_0x46fab2);_0x31084a(null);};}for(var e in events){if(events[_0xabed('0x6')](e)){var event=events[e];WhatsappAccount[_0xabed('0x7')](e,emitEvent(event));}}module[_0xabed('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9defdbe..1fe500e 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 _0x03c3=['bluebird','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','lodash','util','../../config/logger','api','moment'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x03c3,0x1b3));var _0x303c=function(_0x25a4ab,_0x3cee85){_0x25a4ab=_0x25a4ab-0x0;var _0x1742eb=_0x03c3[_0x25a4ab];return _0x1742eb;};'use strict';var _=require(_0x303c('0x0'));var util=require(_0x303c('0x1'));var logger=require(_0x303c('0x2'))(_0x303c('0x3'));var moment=require(_0x303c('0x4'));var BPromise=require(_0x303c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x303c('0x6'));var rimraf=require(_0x303c('0x7'));var config=require('../../config/environment');var attributes=require(_0x303c('0x8'));module['exports']=function(_0x5c933b,_0x28c026){return _0x5c933b[_0x303c('0x9')](_0x303c('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x925d=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x58bd92,_0x47740c){var _0x31fd24=function(_0x396aaa){while(--_0x396aaa){_0x58bd92['push'](_0x58bd92['shift']());}};_0x31fd24(++_0x47740c);}(_0x925d,0x73));var _0xd925=function(_0x5dabce,_0x2c124d){_0x5dabce=_0x5dabce-0x0;var _0x64fbb6=_0x925d[_0x5dabce];return _0x64fbb6;};'use strict';var _=require(_0xd925('0x0'));var util=require('util');var logger=require(_0xd925('0x1'))(_0xd925('0x2'));var moment=require(_0xd925('0x3'));var BPromise=require('bluebird');var rp=require(_0xd925('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd925('0x5'));var config=require(_0xd925('0x6'));var attributes=require(_0xd925('0x7'));module[_0xd925('0x8')]=function(_0x4802c6,_0x5ae9c1){return _0x4802c6[_0xd925('0x9')](_0xd925('0xa'),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 eb15cb7..81d1607 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 _0x991d=['WhatsappAccount','options','raw','attributes','include','map','model','ShowWhatsappAccount','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x358cfd,_0x396384){var _0x8de686=function(_0x282fba){while(--_0x282fba){_0x358cfd['push'](_0x358cfd['shift']());}};_0x8de686(++_0x396384);}(_0x991d,0x189));var _0xd991=function(_0xbc464e,_0x558e8e){_0xbc464e=_0xbc464e-0x0;var _0x4ce2ee=_0x991d[_0xbc464e];return _0x4ce2ee;};'use strict';var _=require('lodash');var util=require(_0xd991('0x0'));var moment=require(_0xd991('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd991('0x2'));var db=require(_0xd991('0x3'))['db'];var utils=require(_0xd991('0x4'));var logger=require(_0xd991('0x5'))(_0xd991('0x6'));var config=require(_0xd991('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd991('0x8')]({'port':0x232a});config[_0xd991('0x9')]=_[_0xd991('0xa')](config[_0xd991('0x9')],{'host':_0xd991('0xb'),'port':0x18eb});var socket=require(_0xd991('0xc'))(new Redis(config[_0xd991('0x9')]));require(_0xd991('0xd'))[_0xd991('0xe')](socket);function respondWithRpcPromise(_0x3c76be,_0x4218d8,_0x1c4fbe){return new BPromise(function(_0x23954,_0xaeb6ee){return client[_0xd991('0xf')](_0x3c76be,_0x1c4fbe)[_0xd991('0x10')](function(_0x4f0135){logger[_0xd991('0x11')](_0xd991('0x12'),_0x4218d8,_0xd991('0x13'));logger['debug'](_0xd991('0x14'),_0x4218d8,'request\x20sent',JSON[_0xd991('0x15')](_0x4f0135));if(_0x4f0135[_0xd991('0x16')]){if(_0x4f0135['error'][_0xd991('0x17')]===0x1f4){logger[_0xd991('0x16')](_0xd991('0x12'),_0x4218d8,_0x4f0135[_0xd991('0x16')][_0xd991('0x18')]);return _0xaeb6ee(_0x4f0135[_0xd991('0x16')][_0xd991('0x18')]);}logger[_0xd991('0x16')](_0xd991('0x12'),_0x4218d8,_0x4f0135[_0xd991('0x16')][_0xd991('0x18')]);return _0x23954(_0x4f0135[_0xd991('0x16')][_0xd991('0x18')]);}else{logger[_0xd991('0x11')](_0xd991('0x12'),_0x4218d8,_0xd991('0x13'));_0x23954(_0x4f0135[_0xd991('0x19')]['message']);}})[_0xd991('0x1a')](function(_0x544d67){logger[_0xd991('0x16')](_0xd991('0x12'),_0x4218d8,_0x544d67);_0xaeb6ee(_0x544d67);});});}exports['ShowWhatsappAccount']=function(_0x428dfd){var _0x5abd8c=this;return new Promise(function(_0x590bf1,_0x29b036){return db[_0xd991('0x1b')]['find']({'raw':_0x428dfd[_0xd991('0x1c')]?_0x428dfd['options'][_0xd991('0x1d')]===undefined?!![]:![]:!![],'where':_0x428dfd['options']?_0x428dfd[_0xd991('0x1c')]['where']||null:null,'attributes':_0x428dfd[_0xd991('0x1c')]?_0x428dfd[_0xd991('0x1c')][_0xd991('0x1e')]||null:null,'include':_0x428dfd[_0xd991('0x1c')]?_0x428dfd[_0xd991('0x1c')][_0xd991('0x1f')]?_[_0xd991('0x20')](_0x428dfd[_0xd991('0x1c')][_0xd991('0x1f')],function(_0x22620f){return{'model':db[_0x22620f[_0xd991('0x21')]],'as':_0x22620f['as'],'attributes':_0x22620f[_0xd991('0x1e')],'include':_0x22620f[_0xd991('0x1f')]?_['map'](_0x22620f[_0xd991('0x1f')],function(_0x41f650){return{'model':db[_0x41f650[_0xd991('0x21')]],'as':_0x41f650['as'],'attributes':_0x41f650['attributes'],'include':_0x41f650['include']?_['map'](_0x41f650[_0xd991('0x1f')],function(_0x2bc9a4){return{'model':db[_0x2bc9a4[_0xd991('0x21')]],'as':_0x2bc9a4['as'],'attributes':_0x2bc9a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd991('0x10')](function(_0x4492d9){logger[_0xd991('0x11')]('ShowWhatsappAccount',_0x428dfd);logger['debug']('ShowWhatsappAccount',_0x428dfd,JSON[_0xd991('0x15')](_0x4492d9));_0x590bf1(_0x4492d9);})[_0xd991('0x1a')](function(_0x1883ef){logger['error'](_0xd991('0x22'),_0x1883ef[_0xd991('0x18')],_0x428dfd);_0x29b036(_0x5abd8c[_0xd991('0x16')](0x1f4,_0x1883ef[_0xd991('0x18')]));});});}; \ No newline at end of file +var _0xeac6=['defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','WhatsappAccount','options','raw','where','attributes','include','map','model','then','ShowWhatsappAccount','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28a2be,_0x5f6b50){var _0x3925f2=function(_0x32fc03){while(--_0x32fc03){_0x28a2be['push'](_0x28a2be['shift']());}};_0x3925f2(++_0x5f6b50);}(_0xeac6,0x7f));var _0x6eac=function(_0x2b72a6,_0x16620d){_0x2b72a6=_0x2b72a6-0x0;var _0x26e7f3=_0xeac6[_0x2b72a6];return _0x26e7f3;};'use strict';var _=require('lodash');var util=require(_0x6eac('0x0'));var moment=require(_0x6eac('0x1'));var BPromise=require('bluebird');var rs=require(_0x6eac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6eac('0x3'))['db'];var utils=require(_0x6eac('0x4'));var logger=require(_0x6eac('0x5'))(_0x6eac('0x6'));var config=require(_0x6eac('0x7'));var jayson=require(_0x6eac('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6eac('0x9')](config[_0x6eac('0xa')],{'host':_0x6eac('0xb'),'port':0x18eb});var socket=require(_0x6eac('0xc'))(new Redis(config[_0x6eac('0xa')]));require(_0x6eac('0xd'))[_0x6eac('0xe')](socket);function respondWithRpcPromise(_0x198c05,_0x3c857f,_0x508e6c){return new BPromise(function(_0x4bf461,_0x96c574){return client[_0x6eac('0xf')](_0x198c05,_0x508e6c)['then'](function(_0x2a0ce0){logger[_0x6eac('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3c857f,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c857f,_0x6eac('0x11'),JSON[_0x6eac('0x12')](_0x2a0ce0));if(_0x2a0ce0[_0x6eac('0x13')]){if(_0x2a0ce0['error'][_0x6eac('0x14')]===0x1f4){logger[_0x6eac('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x3c857f,_0x2a0ce0['error']['message']);return _0x96c574(_0x2a0ce0[_0x6eac('0x13')][_0x6eac('0x15')]);}logger['error'](_0x6eac('0x16'),_0x3c857f,_0x2a0ce0[_0x6eac('0x13')]['message']);return _0x4bf461(_0x2a0ce0[_0x6eac('0x13')][_0x6eac('0x15')]);}else{logger[_0x6eac('0x10')](_0x6eac('0x16'),_0x3c857f,_0x6eac('0x11'));_0x4bf461(_0x2a0ce0['result'][_0x6eac('0x15')]);}})[_0x6eac('0x17')](function(_0x3d3ad6){logger[_0x6eac('0x13')](_0x6eac('0x16'),_0x3c857f,_0x3d3ad6);_0x96c574(_0x3d3ad6);});});}exports['ShowWhatsappAccount']=function(_0x13672e){var _0x30f4a7=this;return new Promise(function(_0x1163ee,_0x1d75d2){return db[_0x6eac('0x18')]['find']({'raw':_0x13672e[_0x6eac('0x19')]?_0x13672e[_0x6eac('0x19')][_0x6eac('0x1a')]===undefined?!![]:![]:!![],'where':_0x13672e['options']?_0x13672e[_0x6eac('0x19')][_0x6eac('0x1b')]||null:null,'attributes':_0x13672e[_0x6eac('0x19')]?_0x13672e[_0x6eac('0x19')][_0x6eac('0x1c')]||null:null,'include':_0x13672e[_0x6eac('0x19')]?_0x13672e['options'][_0x6eac('0x1d')]?_[_0x6eac('0x1e')](_0x13672e[_0x6eac('0x19')][_0x6eac('0x1d')],function(_0x243233){return{'model':db[_0x243233[_0x6eac('0x1f')]],'as':_0x243233['as'],'attributes':_0x243233['attributes'],'include':_0x243233[_0x6eac('0x1d')]?_[_0x6eac('0x1e')](_0x243233[_0x6eac('0x1d')],function(_0x1849b2){return{'model':db[_0x1849b2['model']],'as':_0x1849b2['as'],'attributes':_0x1849b2[_0x6eac('0x1c')],'include':_0x1849b2[_0x6eac('0x1d')]?_[_0x6eac('0x1e')](_0x1849b2[_0x6eac('0x1d')],function(_0x18c390){return{'model':db[_0x18c390['model']],'as':_0x18c390['as'],'attributes':_0x18c390[_0x6eac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6eac('0x20')](function(_0x4f5c06){logger[_0x6eac('0x10')]('ShowWhatsappAccount',_0x13672e);logger['debug'](_0x6eac('0x21'),_0x13672e,JSON[_0x6eac('0x12')](_0x4f5c06));_0x1163ee(_0x4f5c06);})[_0x6eac('0x17')](function(_0x2e6cc1){logger[_0x6eac('0x13')](_0x6eac('0x21'),_0x2e6cc1[_0x6eac('0x15')],_0x13672e);_0x1d75d2(_0x30f4a7[_0x6eac('0x13')](0x1f4,_0x2e6cc1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d2ab6aa..2cccb3e 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 _0x8f31=['removeListener','register','length','whatsappAccount:','remove','update','emit'];(function(_0x30e3ad,_0x2f4323){var _0x1ca439=function(_0x4dbed8){while(--_0x4dbed8){_0x30e3ad['push'](_0x30e3ad['shift']());}};_0x1ca439(++_0x2f4323);}(_0x8f31,0x19a));var _0x18f3=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x8f31[_0x427352];return _0x23e0e6;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x18f3('0x0'),_0x18f3('0x1')];function createListener(_0x515ac7,_0x12c9b5){return function(_0x2309ab){_0x12c9b5[_0x18f3('0x2')](_0x515ac7,_0x2309ab);};}function removeListener(_0x5a6f95,_0x2257d3){return function(){WhatsappAccountEvents[_0x18f3('0x3')](_0x5a6f95,_0x2257d3);};}exports[_0x18f3('0x4')]=function(_0x2934b8){for(var _0x570aa3=0x0,_0x4e048a=events[_0x18f3('0x5')];_0x570aa3<_0x4e048a;_0x570aa3++){var _0x588a9d=events[_0x570aa3];var _0x31aad7=createListener(_0x18f3('0x6')+_0x588a9d,_0x2934b8);WhatsappAccountEvents['on'](_0x588a9d,_0x31aad7);}}; \ No newline at end of file +var _0x0ed3=['save','remove','update','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x0ed3,0x1e5));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var WhatsappAccountEvents=require(_0x30ed('0x0'));var events=[_0x30ed('0x1'),_0x30ed('0x2'),_0x30ed('0x3')];function createListener(_0x5c7009,_0x38d2d2){return function(_0x19854f){_0x38d2d2['emit'](_0x5c7009,_0x19854f);};}function removeListener(_0x40d059,_0x4a1ac1){return function(){WhatsappAccountEvents['removeListener'](_0x40d059,_0x4a1ac1);};}exports[_0x30ed('0x4')]=function(_0x33dcff){for(var _0x2185e1=0x0,_0x312cac=events['length'];_0x2185e1<_0x312cac;_0x2185e1++){var _0x2cbb58=events[_0x2185e1];var _0x5648bd=createListener(_0x30ed('0x5')+_0x2cbb58,_0x33dcff);WhatsappAccountEvents['on'](_0x2cbb58,_0x5648bd);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c42127b..833b86a 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 _0xc119=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xc119,0xde));var _0x9c11=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0xc119[_0xd21fe7];return _0x14d570;};'use strict';var multer=require('multer');var util=require(_0x9c11('0x0'));var path=require(_0x9c11('0x1'));var timeout=require(_0x9c11('0x2'));var express=require(_0x9c11('0x3'));var router=express[_0x9c11('0x4')]();var fs_extra=require(_0x9c11('0x5'));var auth=require(_0x9c11('0x6'));var interaction=require(_0x9c11('0x7'));var config=require(_0x9c11('0x8'));var controller=require(_0x9c11('0x9'));router[_0x9c11('0xa')]('/',auth[_0x9c11('0xb')](),controller[_0x9c11('0xc')]);router[_0x9c11('0xa')](_0x9c11('0xd'),auth['isAuthenticated'](),controller[_0x9c11('0xe')]);router[_0x9c11('0xf')]('/',auth[_0x9c11('0xb')](),controller['create']);router[_0x9c11('0x10')](_0x9c11('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9c11('0xd'),auth[_0x9c11('0xb')](),controller[_0x9c11('0x11')]);module[_0x9c11('0x12')]=router; \ No newline at end of file +var _0xcfe0=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xcfe0,0x137));var _0x0cfe=function(_0xd0cfa4,_0x4c44af){_0xd0cfa4=_0xd0cfa4-0x0;var _0x1f7ce4=_0xcfe0[_0xd0cfa4];return _0x1f7ce4;};'use strict';var multer=require(_0x0cfe('0x0'));var util=require(_0x0cfe('0x1'));var path=require(_0x0cfe('0x2'));var timeout=require(_0x0cfe('0x3'));var express=require(_0x0cfe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0cfe('0x5'));var interaction=require(_0x0cfe('0x6'));var config=require('../../config/environment');var controller=require(_0x0cfe('0x7'));router[_0x0cfe('0x8')]('/',auth[_0x0cfe('0x9')](),controller[_0x0cfe('0xa')]);router[_0x0cfe('0x8')](_0x0cfe('0xb'),auth[_0x0cfe('0x9')](),controller[_0x0cfe('0xc')]);router[_0x0cfe('0xd')]('/',auth[_0x0cfe('0x9')](),controller[_0x0cfe('0xe')]);router[_0x0cfe('0xf')](_0x0cfe('0xb'),auth[_0x0cfe('0x9')](),controller[_0x0cfe('0x10')]);router[_0x0cfe('0x11')](_0x0cfe('0xb'),auth[_0x0cfe('0x9')](),controller[_0x0cfe('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 72fc45e..6af4754 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 _0x4b67=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2efd78,_0x2d980c){var _0x1559a5=function(_0x392b08){while(--_0x392b08){_0x2efd78['push'](_0x2efd78['shift']());}};_0x1559a5(++_0x2d980c);}(_0x4b67,0x14b));var _0x74b6=function(_0x53ee47,_0x1444a6){_0x53ee47=_0x53ee47-0x0;var _0xf57b09=_0x4b67[_0x53ee47];return _0xf57b09;};'use strict';var Sequelize=require(_0x74b6('0x0'));module[_0x74b6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x74b6('0x2')],'allowNull':![],'defaultValue':_0x74b6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x74b6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x74b6('0x4')}}; \ No newline at end of file +var _0x1f87=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x274fad,_0x3f699e){var _0x47b085=function(_0x372998){while(--_0x372998){_0x274fad['push'](_0x274fad['shift']());}};_0x47b085(++_0x3f699e);}(_0x1f87,0x15e));var _0x71f8=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x1f87[_0xf44d98];return _0x5ebb04;};'use strict';var Sequelize=require(_0x71f8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x71f8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71f8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x71f8('0x3')]()},'description':{'type':Sequelize[_0x71f8('0x2')]},'interval':{'type':Sequelize[_0x71f8('0x2')],'defaultValue':_0x71f8('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 71b4fca..f83cb86 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 _0x6da9=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xde282,_0x5a0e7f){var _0x40447f=function(_0x5231ed){while(--_0x5231ed){_0xde282['push'](_0xde282['shift']());}};_0x40447f(++_0x5a0e7f);}(_0x6da9,0x161));var _0x96da=function(_0x3408b8,_0x136196){_0x3408b8=_0x3408b8-0x0;var _0x8a8f7=_0x6da9[_0x3408b8];return _0x8a8f7;};'use strict';var emlformat=require(_0x96da('0x0'));var rimraf=require(_0x96da('0x1'));var zipdir=require(_0x96da('0x2'));var jsonpatch=require(_0x96da('0x3'));var rp=require(_0x96da('0x4'));var moment=require(_0x96da('0x5'));var BPromise=require(_0x96da('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x96da('0x7'));var csv=require(_0x96da('0x8'));var ejs=require(_0x96da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96da('0xa'));var squel=require('squel');var crypto=require(_0x96da('0xb'));var jsforce=require(_0x96da('0xc'));var deskjs=require(_0x96da('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x96da('0xe'));var authService=require(_0x96da('0xf'));var qs=require(_0x96da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96da('0x11'));var logger=require(_0x96da('0x12'))('api');var utils=require(_0x96da('0x13'));var config=require(_0x96da('0x14'));var licenseUtil=require(_0x96da('0x15'));var db=require(_0x96da('0x16'))['db'];function respondWithStatusCode(_0x116c14,_0x1bc58d){_0x1bc58d=_0x1bc58d||0xcc;return function(_0x2cdcdf){if(_0x2cdcdf){return _0x116c14[_0x96da('0x17')](_0x1bc58d);}return _0x116c14[_0x96da('0x18')](_0x1bc58d)['end']();};}function respondWithResult(_0x235e14,_0x3a0a69){_0x3a0a69=_0x3a0a69||0xc8;return function(_0x4807b7){if(_0x4807b7){return _0x235e14['status'](_0x3a0a69)[_0x96da('0x19')](_0x4807b7);}};}function respondWithFilteredResult(_0x3c6b98,_0x5e472e){return function(_0x13f426){if(_0x13f426){var _0x5e6e0a=typeof _0x5e472e[_0x96da('0x1a')]===_0x96da('0x1b')&&typeof _0x5e472e[_0x96da('0x1c')]===_0x96da('0x1b');var _0x17ced1=_0x13f426['count'];var _0x2bfd0c=_0x5e6e0a?0x0:_0x5e472e[_0x96da('0x1a')];var _0x7ac4a5=_0x5e6e0a?_0x13f426[_0x96da('0x1d')]:_0x5e472e['offset']+_0x5e472e[_0x96da('0x1c')];var _0x575c01;if(_0x7ac4a5>=_0x17ced1){_0x7ac4a5=_0x17ced1;_0x575c01=0xc8;}else{_0x575c01=0xce;}_0x3c6b98[_0x96da('0x18')](_0x575c01);return _0x3c6b98[_0x96da('0x1e')](_0x96da('0x1f'),_0x2bfd0c+'-'+_0x7ac4a5+'/'+_0x17ced1)['json'](_0x13f426);}return null;};}function patchUpdates(_0x1037e9){return function(_0x2cc90c){try{jsonpatch[_0x96da('0x20')](_0x2cc90c,_0x1037e9,!![]);}catch(_0x156d1e){return BPromise[_0x96da('0x21')](_0x156d1e);}return _0x2cc90c[_0x96da('0x22')]();};}function saveUpdates(_0x561140,_0x2e1421){return function(_0x27f41e){if(_0x27f41e){return _0x27f41e[_0x96da('0x23')](_0x561140)['then'](function(_0x44e248){return _0x44e248;});}return null;};}function removeEntity(_0x137789,_0x4a9232){return function(_0x1e5871){if(_0x1e5871){return _0x1e5871['destroy']()[_0x96da('0x24')](function(){_0x137789[_0x96da('0x18')](0xcc)[_0x96da('0x25')]();});}};}function handleEntityNotFound(_0x1b29ae,_0x328357){return function(_0x1f7396){if(!_0x1f7396){_0x1b29ae[_0x96da('0x17')](0x194);}return _0x1f7396;};}function handleError(_0x313aaa,_0x2180fd){_0x2180fd=_0x2180fd||0x1f4;return function(_0x2d197f){logger['error'](_0x2d197f[_0x96da('0x26')]);if(_0x2d197f[_0x96da('0x27')]){delete _0x2d197f[_0x96da('0x27')];}_0x313aaa[_0x96da('0x18')](_0x2180fd)[_0x96da('0x28')](_0x2d197f);};}exports[_0x96da('0x29')]=function(_0x315832,_0x51e80c){var _0x2b4fd7={},_0x4241ba={},_0x2d1ac1={'count':0x0,'rows':[]};var _0x59b13d=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x46d698){return{'name':_0x46d698['fieldName'],'type':_0x46d698[_0x96da('0x2a')][_0x96da('0x2b')]};});_0x4241ba[_0x96da('0x2c')]=_[_0x96da('0x2d')](_0x59b13d,_0x96da('0x27'));_0x4241ba[_0x96da('0x2e')]=_[_0x96da('0x2f')](_0x315832[_0x96da('0x2e')]);_0x4241ba[_0x96da('0x30')]=_['intersection'](_0x4241ba['model'],_0x4241ba[_0x96da('0x2e')]);_0x2b4fd7[_0x96da('0x31')]=_['intersection'](_0x4241ba[_0x96da('0x2c')],qs[_0x96da('0x32')](_0x315832[_0x96da('0x2e')][_0x96da('0x32')]));_0x2b4fd7[_0x96da('0x31')]=_0x2b4fd7[_0x96da('0x31')][_0x96da('0x33')]?_0x2b4fd7[_0x96da('0x31')]:_0x4241ba[_0x96da('0x2c')];if(!_0x315832['query'][_0x96da('0x34')]('nolimit')){_0x2b4fd7['limit']=qs[_0x96da('0x1c')](_0x315832[_0x96da('0x2e')][_0x96da('0x1c')]);_0x2b4fd7[_0x96da('0x1a')]=qs[_0x96da('0x1a')](_0x315832[_0x96da('0x2e')][_0x96da('0x1a')]);}_0x2b4fd7[_0x96da('0x35')]=qs[_0x96da('0x36')](_0x315832[_0x96da('0x2e')][_0x96da('0x36')]);_0x2b4fd7['where']=qs[_0x96da('0x30')](_[_0x96da('0x37')](_0x315832['query'],_0x4241ba['filters']),_0x59b13d);if(_0x315832[_0x96da('0x2e')][_0x96da('0x38')]){_0x2b4fd7[_0x96da('0x39')]=_[_0x96da('0x3a')](_0x2b4fd7[_0x96da('0x39')],{'$or':_['map'](_0x59b13d,function(_0x11afad){if(_0x11afad['type']!==_0x96da('0x3b')){var _0xf60f33={};_0xf60f33[_0x11afad[_0x96da('0x27')]]={'$like':'%'+_0x315832['query']['filter']+'%'};return _0xf60f33;}})});}_0x2b4fd7=_[_0x96da('0x3a')]({},_0x2b4fd7,_0x315832[_0x96da('0x3c')]);var _0x4fdf5d={'where':_0x2b4fd7[_0x96da('0x39')]};return db[_0x96da('0x3d')][_0x96da('0x1d')](_0x4fdf5d)[_0x96da('0x24')](function(_0x1da969){_0x2d1ac1[_0x96da('0x1d')]=_0x1da969;if(_0x315832[_0x96da('0x2e')][_0x96da('0x3e')]){_0x2b4fd7['include']=[{'all':!![]}];}return db[_0x96da('0x3d')][_0x96da('0x3f')](_0x2b4fd7);})['then'](function(_0x2f82fd){_0x2d1ac1[_0x96da('0x40')]=_0x2f82fd;return _0x2d1ac1;})[_0x96da('0x24')](respondWithFilteredResult(_0x51e80c,_0x2b4fd7))[_0x96da('0x41')](handleError(_0x51e80c,null));};exports[_0x96da('0x42')]=function(_0x36ff6c,_0x23a40c){var _0x1e0df0={'raw':!![],'where':{'id':_0x36ff6c[_0x96da('0x43')]['id']}},_0xdccdd7={};_0xdccdd7[_0x96da('0x2c')]=_[_0x96da('0x2f')](db['WhatsappApplication'][_0x96da('0x44')]);_0xdccdd7[_0x96da('0x2e')]=_[_0x96da('0x2f')](_0x36ff6c[_0x96da('0x2e')]);_0xdccdd7[_0x96da('0x30')]=_[_0x96da('0x45')](_0xdccdd7[_0x96da('0x2c')],_0xdccdd7[_0x96da('0x2e')]);_0x1e0df0[_0x96da('0x31')]=_[_0x96da('0x45')](_0xdccdd7['model'],qs[_0x96da('0x32')](_0x36ff6c[_0x96da('0x2e')][_0x96da('0x32')]));_0x1e0df0[_0x96da('0x31')]=_0x1e0df0['attributes'][_0x96da('0x33')]?_0x1e0df0['attributes']:_0xdccdd7[_0x96da('0x2c')];if(_0x36ff6c[_0x96da('0x2e')][_0x96da('0x3e')]){_0x1e0df0[_0x96da('0x46')]=[{'all':!![]}];}_0x1e0df0=_[_0x96da('0x3a')]({},_0x1e0df0,_0x36ff6c[_0x96da('0x3c')]);return db[_0x96da('0x3d')]['find'](_0x1e0df0)[_0x96da('0x24')](handleEntityNotFound(_0x23a40c,null))[_0x96da('0x24')](respondWithResult(_0x23a40c,null))[_0x96da('0x41')](handleError(_0x23a40c,null));};exports[_0x96da('0x47')]=function(_0x20a450,_0x4b541d){return db[_0x96da('0x3d')]['create'](_0x20a450[_0x96da('0x48')],{})[_0x96da('0x24')](respondWithResult(_0x4b541d,0xc9))['catch'](handleError(_0x4b541d,null));};exports[_0x96da('0x23')]=function(_0x296932,_0x48f6bb){if(_0x296932[_0x96da('0x48')]['id']){delete _0x296932[_0x96da('0x48')]['id'];}return db[_0x96da('0x3d')][_0x96da('0x49')]({'where':{'id':_0x296932[_0x96da('0x43')]['id']}})[_0x96da('0x24')](handleEntityNotFound(_0x48f6bb,null))[_0x96da('0x24')](saveUpdates(_0x296932['body'],null))[_0x96da('0x24')](respondWithResult(_0x48f6bb,null))['catch'](handleError(_0x48f6bb,null));};exports[_0x96da('0x4a')]=function(_0x3cb601,_0x266b39){return db[_0x96da('0x3d')][_0x96da('0x49')]({'where':{'id':_0x3cb601['params']['id']}})[_0x96da('0x24')](handleEntityNotFound(_0x266b39,null))[_0x96da('0x24')](removeEntity(_0x266b39,null))['catch'](handleError(_0x266b39,null));}; \ No newline at end of file +var _0xa6b0=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','find','create','body','params','eml-format','rimraf','request-promise','moment','bluebird','util','path','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','index','map','WhatsappApplication','key','model','query','filters','intersection','fields'];(function(_0x26fc0d,_0xa9ae57){var _0x3639ff=function(_0x370ce0){while(--_0x370ce0){_0x26fc0d['push'](_0x26fc0d['shift']());}};_0x3639ff(++_0xa9ae57);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x33f240,_0x42e306){_0x33f240=_0x33f240-0x0;var _0x51bc19=_0xa6b0[_0x33f240];return _0x51bc19;};'use strict';var emlformat=require(_0x0a6b('0x0'));var rimraf=require(_0x0a6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var BPromise=require(_0x0a6b('0x4'));var Mustache=require('mustache');var util=require(_0x0a6b('0x5'));var path=require(_0x0a6b('0x6'));var sox=require(_0x0a6b('0x7'));var csv=require(_0x0a6b('0x8'));var ejs=require(_0x0a6b('0x9'));var fs=require('fs');var fs_extra=require(_0x0a6b('0xa'));var _=require(_0x0a6b('0xb'));var squel=require(_0x0a6b('0xc'));var crypto=require(_0x0a6b('0xd'));var jsforce=require(_0x0a6b('0xe'));var deskjs=require(_0x0a6b('0xf'));var toCsv=require(_0x0a6b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a6b('0x10'));var authService=require(_0x0a6b('0x11'));var qs=require(_0x0a6b('0x12'));var as=require(_0x0a6b('0x13'));var hardwareService=require(_0x0a6b('0x14'));var logger=require(_0x0a6b('0x15'))(_0x0a6b('0x16'));var utils=require(_0x0a6b('0x17'));var config=require(_0x0a6b('0x18'));var licenseUtil=require(_0x0a6b('0x19'));var db=require(_0x0a6b('0x1a'))['db'];function respondWithStatusCode(_0x890493,_0x244a7d){_0x244a7d=_0x244a7d||0xcc;return function(_0x3cd9a4){if(_0x3cd9a4){return _0x890493['sendStatus'](_0x244a7d);}return _0x890493['status'](_0x244a7d)[_0x0a6b('0x1b')]();};}function respondWithResult(_0x2f27d6,_0x2abc4e){_0x2abc4e=_0x2abc4e||0xc8;return function(_0x177e87){if(_0x177e87){return _0x2f27d6[_0x0a6b('0x1c')](_0x2abc4e)[_0x0a6b('0x1d')](_0x177e87);}};}function respondWithFilteredResult(_0x9bb98e,_0x19e84c){return function(_0x1205a3){if(_0x1205a3){var _0x9d7aba=typeof _0x19e84c['offset']===_0x0a6b('0x1e')&&typeof _0x19e84c[_0x0a6b('0x1f')]==='undefined';var _0x290f7f=_0x1205a3['count'];var _0xcb412=_0x9d7aba?0x0:_0x19e84c[_0x0a6b('0x20')];var _0x2cb10b=_0x9d7aba?_0x1205a3[_0x0a6b('0x21')]:_0x19e84c['offset']+_0x19e84c[_0x0a6b('0x1f')];var _0x296162;if(_0x2cb10b>=_0x290f7f){_0x2cb10b=_0x290f7f;_0x296162=0xc8;}else{_0x296162=0xce;}_0x9bb98e['status'](_0x296162);return _0x9bb98e[_0x0a6b('0x22')](_0x0a6b('0x23'),_0xcb412+'-'+_0x2cb10b+'/'+_0x290f7f)[_0x0a6b('0x1d')](_0x1205a3);}return null;};}function patchUpdates(_0x491936){return function(_0x3ae3f4){try{jsonpatch[_0x0a6b('0x24')](_0x3ae3f4,_0x491936,!![]);}catch(_0x4077c6){return BPromise['reject'](_0x4077c6);}return _0x3ae3f4[_0x0a6b('0x25')]();};}function saveUpdates(_0x531e4c,_0xe4c2b9){return function(_0x5e8206){if(_0x5e8206){return _0x5e8206[_0x0a6b('0x26')](_0x531e4c)['then'](function(_0x1e5065){return _0x1e5065;});}return null;};}function removeEntity(_0xdda188,_0x3d153f){return function(_0x5c77fb){if(_0x5c77fb){return _0x5c77fb[_0x0a6b('0x27')]()[_0x0a6b('0x28')](function(){_0xdda188[_0x0a6b('0x1c')](0xcc)[_0x0a6b('0x1b')]();});}};}function handleEntityNotFound(_0x3b12a2,_0x5b2229){return function(_0x3e6a1d){if(!_0x3e6a1d){_0x3b12a2[_0x0a6b('0x29')](0x194);}return _0x3e6a1d;};}function handleError(_0x19a653,_0x4ce9d4){_0x4ce9d4=_0x4ce9d4||0x1f4;return function(_0x3a9092){logger['error'](_0x3a9092[_0x0a6b('0x2a')]);if(_0x3a9092[_0x0a6b('0x2b')]){delete _0x3a9092[_0x0a6b('0x2b')];}_0x19a653['status'](_0x4ce9d4)['send'](_0x3a9092);};}exports[_0x0a6b('0x2c')]=function(_0xe01bba,_0x1aecc7){var _0x3d649e={},_0x1935a3={},_0x2bbcb1={'count':0x0,'rows':[]};var _0x486f0d=_[_0x0a6b('0x2d')](db[_0x0a6b('0x2e')]['rawAttributes'],function(_0x4744d1){return{'name':_0x4744d1['fieldName'],'type':_0x4744d1['type'][_0x0a6b('0x2f')]};});_0x1935a3[_0x0a6b('0x30')]=_[_0x0a6b('0x2d')](_0x486f0d,_0x0a6b('0x2b'));_0x1935a3[_0x0a6b('0x31')]=_['keys'](_0xe01bba['query']);_0x1935a3[_0x0a6b('0x32')]=_[_0x0a6b('0x33')](_0x1935a3[_0x0a6b('0x30')],_0x1935a3[_0x0a6b('0x31')]);_0x3d649e['attributes']=_[_0x0a6b('0x33')](_0x1935a3[_0x0a6b('0x30')],qs['fields'](_0xe01bba['query'][_0x0a6b('0x34')]));_0x3d649e[_0x0a6b('0x35')]=_0x3d649e['attributes'][_0x0a6b('0x36')]?_0x3d649e[_0x0a6b('0x35')]:_0x1935a3[_0x0a6b('0x30')];if(!_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x37')](_0x0a6b('0x38'))){_0x3d649e[_0x0a6b('0x1f')]=qs[_0x0a6b('0x1f')](_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x1f')]);_0x3d649e[_0x0a6b('0x20')]=qs[_0x0a6b('0x20')](_0xe01bba['query'][_0x0a6b('0x20')]);}_0x3d649e[_0x0a6b('0x39')]=qs['sort'](_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x3a')]);_0x3d649e[_0x0a6b('0x3b')]=qs[_0x0a6b('0x32')](_[_0x0a6b('0x3c')](_0xe01bba[_0x0a6b('0x31')],_0x1935a3[_0x0a6b('0x32')]),_0x486f0d);if(_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x3d')]){_0x3d649e['where']=_[_0x0a6b('0x3e')](_0x3d649e[_0x0a6b('0x3b')],{'$or':_[_0x0a6b('0x2d')](_0x486f0d,function(_0x2f7e4b){if(_0x2f7e4b[_0x0a6b('0x3f')]!==_0x0a6b('0x40')){var _0x25254d={};_0x25254d[_0x2f7e4b[_0x0a6b('0x2b')]]={'$like':'%'+_0xe01bba[_0x0a6b('0x31')]['filter']+'%'};return _0x25254d;}})});}_0x3d649e=_[_0x0a6b('0x3e')]({},_0x3d649e,_0xe01bba[_0x0a6b('0x41')]);var _0x3aa7d5={'where':_0x3d649e[_0x0a6b('0x3b')]};return db[_0x0a6b('0x2e')][_0x0a6b('0x21')](_0x3aa7d5)[_0x0a6b('0x28')](function(_0x127e20){_0x2bbcb1[_0x0a6b('0x21')]=_0x127e20;if(_0xe01bba['query'][_0x0a6b('0x42')]){_0x3d649e['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x0a6b('0x43')](_0x3d649e);})['then'](function(_0x556a28){_0x2bbcb1[_0x0a6b('0x44')]=_0x556a28;return _0x2bbcb1;})[_0x0a6b('0x28')](respondWithFilteredResult(_0x1aecc7,_0x3d649e))[_0x0a6b('0x45')](handleError(_0x1aecc7,null));};exports['show']=function(_0x445a7b,_0x4d32bf){var _0x531f94={'raw':!![],'where':{'id':_0x445a7b['params']['id']}},_0x1114f1={};_0x1114f1[_0x0a6b('0x30')]=_['keys'](db[_0x0a6b('0x2e')]['rawAttributes']);_0x1114f1['query']=_[_0x0a6b('0x46')](_0x445a7b[_0x0a6b('0x31')]);_0x1114f1[_0x0a6b('0x32')]=_[_0x0a6b('0x33')](_0x1114f1['model'],_0x1114f1[_0x0a6b('0x31')]);_0x531f94[_0x0a6b('0x35')]=_[_0x0a6b('0x33')](_0x1114f1[_0x0a6b('0x30')],qs[_0x0a6b('0x34')](_0x445a7b[_0x0a6b('0x31')][_0x0a6b('0x34')]));_0x531f94['attributes']=_0x531f94[_0x0a6b('0x35')][_0x0a6b('0x36')]?_0x531f94[_0x0a6b('0x35')]:_0x1114f1[_0x0a6b('0x30')];if(_0x445a7b[_0x0a6b('0x31')][_0x0a6b('0x42')]){_0x531f94[_0x0a6b('0x47')]=[{'all':!![]}];}_0x531f94=_[_0x0a6b('0x3e')]({},_0x531f94,_0x445a7b[_0x0a6b('0x41')]);return db['WhatsappApplication'][_0x0a6b('0x48')](_0x531f94)[_0x0a6b('0x28')](handleEntityNotFound(_0x4d32bf,null))[_0x0a6b('0x28')](respondWithResult(_0x4d32bf,null))[_0x0a6b('0x45')](handleError(_0x4d32bf,null));};exports[_0x0a6b('0x49')]=function(_0x638ba8,_0x8f1372){return db['WhatsappApplication']['create'](_0x638ba8[_0x0a6b('0x4a')],{})[_0x0a6b('0x28')](respondWithResult(_0x8f1372,0xc9))[_0x0a6b('0x45')](handleError(_0x8f1372,null));};exports[_0x0a6b('0x26')]=function(_0x2ca82a,_0x446187){if(_0x2ca82a[_0x0a6b('0x4a')]['id']){delete _0x2ca82a[_0x0a6b('0x4a')]['id'];}return db[_0x0a6b('0x2e')]['find']({'where':{'id':_0x2ca82a[_0x0a6b('0x4b')]['id']}})[_0x0a6b('0x28')](handleEntityNotFound(_0x446187,null))[_0x0a6b('0x28')](saveUpdates(_0x2ca82a[_0x0a6b('0x4a')],null))[_0x0a6b('0x28')](respondWithResult(_0x446187,null))['catch'](handleError(_0x446187,null));};exports[_0x0a6b('0x27')]=function(_0x3fd0df,_0x3aa85f){return db[_0x0a6b('0x2e')][_0x0a6b('0x48')]({'where':{'id':_0x3fd0df[_0x0a6b('0x4b')]['id']}})[_0x0a6b('0x28')](handleEntityNotFound(_0x3aa85f,null))[_0x0a6b('0x28')](removeEntity(_0x3aa85f,null))[_0x0a6b('0x45')](handleError(_0x3aa85f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cd75e0d..4a50fdf 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 _0xa74a=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x468a38,_0xebee57){var _0x160358=function(_0x9c0a43){while(--_0x9c0a43){_0x468a38['push'](_0x468a38['shift']());}};_0x160358(++_0xebee57);}(_0xa74a,0x66));var _0xaa74=function(_0x1177a0,_0x431f77){_0x1177a0=_0x1177a0-0x0;var _0x39714b=_0xa74a[_0x1177a0];return _0x39714b;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var logger=require(_0xaa74('0x2'))(_0xaa74('0x3'));var moment=require(_0xaa74('0x4'));var BPromise=require(_0xaa74('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa74('0x6'));var rimraf=require(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x24eee1,_0x44250c){return _0x24eee1[_0xaa74('0x9')](_0xaa74('0xa'),attributes,{'tableName':_0xaa74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaa74('0xc')});}; \ No newline at end of file +var _0x1da1=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x581b63,_0x3cd4ea){var _0x3e8862=function(_0x581016){while(--_0x581016){_0x581b63['push'](_0x581b63['shift']());}};_0x3e8862(++_0x3cd4ea);}(_0x1da1,0x1a4));var _0x11da=function(_0xd27327,_0x48b1c7){_0xd27327=_0xd27327-0x0;var _0x55a621=_0x1da1[_0xd27327];return _0x55a621;};'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('./whatsappApplication.attributes');module[_0x11da('0x8')]=function(_0x209cbb,_0x15c324){return _0x209cbb['define']('WhatsappApplication',attributes,{'tableName':_0x11da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11da('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f6f841b..8192100 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0x45268e,_0x5ee19e){var _0x36d493=function(_0x59b799){while(--_0x59b799){_0x45268e['push'](_0x45268e['shift']());}};_0x36d493(++_0x5ee19e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b0690,_0x4f742f){_0x2b0690=_0x2b0690-0x0;var _0x82be1=_0xf3cd[_0x2b0690];return _0x82be1;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x4ea3=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 8691baa..7a70562 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 _0x277c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x277c,0x153));var _0xc277=function(_0x41afd7,_0x557c6f){_0x41afd7=_0x41afd7-0x0;var _0x4d4ee6=_0x277c[_0x41afd7];return _0x4d4ee6;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xa')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller['getMessages']);router['get'](_0xc277('0xf'),auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/',auth['isAuthenticated'](),controller[_0xc277('0x12')]);router['post'](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0x13')]);router[_0xc277('0x11')]('/:id/tags',auth[_0xc277('0x9')](),interaction[_0xc277('0x14')](_0xc277('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc277('0x16')]('/:id',auth[_0xc277('0x9')](),interaction['tracked'](_0xc277('0x15'),_0xc277('0x17')),controller[_0xc277('0x18')]);router['delete']('/:id',auth[_0xc277('0x9')](),interaction['tracked']('whatsapp',_0xc277('0x19')),controller[_0xc277('0x1a')]);router[_0xc277('0x1b')](_0xc277('0x1c'),auth[_0xc277('0x9')](),controller[_0xc277('0x1d')]);module[_0xc277('0x1e')]=router; \ No newline at end of file +var _0x326f=['./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','whatsapp','put','/:id','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd89b16,_0x3aa266){var _0x3baa36=function(_0x35fd0b){while(--_0x35fd0b){_0xd89b16['push'](_0xd89b16['shift']());}};_0x3baa36(++_0x3aa266);}(_0x326f,0xd1));var _0xf326=function(_0x194700,_0x310e6b){_0x194700=_0x194700-0x0;var _0x3097e1=_0x326f[_0x194700];return _0x3097e1;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['post']('/',auth[_0xf326('0xa')](),controller['create']);router[_0xf326('0x12')](_0xf326('0xe'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x12')](_0xf326('0x14'),auth[_0xf326('0xa')](),interaction['tracked'](_0xf326('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xf326('0x16')](_0xf326('0x17'),auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x19')),controller[_0xf326('0x1a')]);router[_0xf326('0x1b')]('/:id',auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x1c')),controller[_0xf326('0x1d')]);router[_0xf326('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xf326('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1efb694..7aadbf6 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 _0x88c3=['STRING','DATE','ENUM','out','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2e4955,_0x275410){var _0x3d8147=function(_0x5c022b){while(--_0x5c022b){_0x2e4955['push'](_0x2e4955['shift']());}};_0x3d8147(++_0x275410);}(_0x88c3,0x1ee));var _0x388c=function(_0x3562eb,_0x31aeea){_0x3562eb=_0x3562eb-0x0;var _0x5ecbb8=_0x88c3[_0x3562eb];return _0x5ecbb8;};'use strict';var Sequelize=require(_0x388c('0x0'));var moment=require('moment');module[_0x388c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x388c('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x388c('0x2')]},'phone':{'type':Sequelize[_0x388c('0x2')]},'read1stAt':{'type':Sequelize[_0x388c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x388c('0x4')]('in',_0x388c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x388c('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x388c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x388c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x388c('0x7')]}}; \ No newline at end of file +var _0x4d5a=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','moment','exports'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4d5a[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa4d5('0x0'));module[_0xa4d5('0x1')]={'closed':{'type':Sequelize[_0xa4d5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa4d5('0x3')]},'secondDisposition':{'type':Sequelize[_0xa4d5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa4d5('0x3')]},'note':{'type':Sequelize[_0xa4d5('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa4d5('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa4d5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa4d5('0x5')]('in',_0xa4d5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa4d5('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa4d5('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 70c4c39..46c364a 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 _0x9cd8=['value','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','err','unlinkSync','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','end','status','offset','undefined','limit','set','Content-Range','json','update','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','whatsapp','user','then','catch','show','model','keys','WhatsappInteraction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','count','findAll','rows','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','Attachment','createdAt','direction','WhatsappAccount','Account','Owner','fullname','get','N.A.','toString','closed','disposition','basename','existsSync','pipe','createWriteStream','out','lastName','read'];(function(_0xfc3bc1,_0x17900f){var _0x59fa51=function(_0x1c4d51){while(--_0x1c4d51){_0xfc3bc1['push'](_0xfc3bc1['shift']());}};_0x59fa51(++_0x17900f);}(_0x9cd8,0x108));var _0x89cd=function(_0x200ecf,_0xe6e6b6){_0x200ecf=_0x200ecf-0x0;var _0x1d69f3=_0x9cd8[_0x200ecf];return _0x1d69f3;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x89cd('0x0'));var path=require(_0x89cd('0x1'));var ejs=require(_0x89cd('0x2'));var fs=require('fs');var _=require(_0x89cd('0x3'));var Redis=require(_0x89cd('0x4'));var interaction=require(_0x89cd('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x89cd('0x6'));var logger=require(_0x89cd('0x7'))('api');var config=require('../../config/environment');var db=require(_0x89cd('0x8'))['db'];config[_0x89cd('0x9')]=_['defaults'](config[_0x89cd('0x9')],{'host':_0x89cd('0xa'),'port':0x18eb});var socket=require(_0x89cd('0xb'))(new Redis(config['redis']));require(_0x89cd('0xc'))['register'](socket);function respondWithStatusCode(_0xf98a03,_0xfc1071){_0xfc1071=_0xfc1071||0xcc;return function(_0x375ce6){if(_0x375ce6){return _0xf98a03['sendStatus'](_0xfc1071);}return _0xf98a03['status'](_0xfc1071)[_0x89cd('0xd')]();};}function respondWithResult(_0x335634,_0x2c3c28){_0x2c3c28=_0x2c3c28||0xc8;return function(_0x3e5d41){if(_0x3e5d41){return _0x335634[_0x89cd('0xe')](_0x2c3c28)['json'](_0x3e5d41);}};}function respondWithFilteredResult(_0x5c299f,_0x3e91bb){return function(_0x30f4cc){if(_0x30f4cc){var _0x5b4a12=typeof _0x3e91bb[_0x89cd('0xf')]==='undefined'&&typeof _0x3e91bb['limit']===_0x89cd('0x10');var _0x438e75=_0x30f4cc['count'];var _0x4d95ed=_0x5b4a12?0x0:_0x3e91bb['offset'];var _0x4955ca=_0x5b4a12?_0x30f4cc['count']:_0x3e91bb[_0x89cd('0xf')]+_0x3e91bb[_0x89cd('0x11')];var _0x3c8585;if(_0x4955ca>=_0x438e75){_0x4955ca=_0x438e75;_0x3c8585=0xc8;}else{_0x3c8585=0xce;}_0x5c299f['status'](_0x3c8585);return _0x5c299f[_0x89cd('0x12')](_0x89cd('0x13'),_0x4d95ed+'-'+_0x4955ca+'/'+_0x438e75)[_0x89cd('0x14')](_0x30f4cc);}return null;};}function saveUpdates(_0x18c00b){return function(_0x63db45){if(_0x63db45){return _0x63db45[_0x89cd('0x15')](_0x18c00b)['then'](function(_0x58888b){return _0x58888b;});}return null;};}function removeEntity(_0x5c2a59){return function(_0x5c75d7){if(_0x5c75d7){return _0x5c75d7[_0x89cd('0x16')]()['then'](function(){_0x5c2a59[_0x89cd('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a28a4){return function(_0x52def6){if(!_0x52def6){_0x2a28a4[_0x89cd('0x17')](0x194);}return _0x52def6;};}function handleError(_0x12e78c,_0x59c713){_0x59c713=_0x59c713||0x1f4;return function(_0x23d347){logger[_0x89cd('0x18')](_0x23d347[_0x89cd('0x19')]);if(_0x23d347[_0x89cd('0x1a')]){delete _0x23d347[_0x89cd('0x1a')];}_0x12e78c[_0x89cd('0xe')](_0x59c713)['send'](_0x23d347);};}exports[_0x89cd('0x1b')]=function(_0x1595fe,_0x58f8c8){var _0x44c82f={};var _0x339c12=_[_0x89cd('0x1c')](db['WhatsappInteraction'][_0x89cd('0x1d')],function(_0x1d6ce6){return{'name':_0x1d6ce6[_0x89cd('0x1e')],'type':_0x1d6ce6[_0x89cd('0x1f')][_0x89cd('0x20')]};});_0x44c82f=qs[_0x89cd('0x21')](_0x339c12,_0x1595fe);return interaction['findAll'](_0x89cd('0x22'),_0x1595fe['query'],_0x1595fe[_0x89cd('0x23')],_0x44c82f,_0x339c12)[_0x89cd('0x24')](respondWithFilteredResult(_0x58f8c8,_0x44c82f))[_0x89cd('0x25')](handleError(_0x58f8c8,null));};exports[_0x89cd('0x26')]=function(_0x476130,_0x1d269f){var _0x1643dd={'raw':![],'where':{'id':_0x476130['params']['id']}},_0x1458a0={};_0x1458a0[_0x89cd('0x27')]=_[_0x89cd('0x28')](db[_0x89cd('0x29')][_0x89cd('0x1d')]);_0x1458a0['query']=_['keys'](_0x476130[_0x89cd('0x2a')]);_0x1458a0[_0x89cd('0x2b')]=_[_0x89cd('0x2c')](_0x1458a0[_0x89cd('0x27')],_0x1458a0[_0x89cd('0x2a')]);_0x1643dd[_0x89cd('0x2d')]=_['intersection'](_0x1458a0['model'],qs[_0x89cd('0x2e')](_0x476130[_0x89cd('0x2a')][_0x89cd('0x2e')]));_0x1643dd['attributes']=_0x1643dd[_0x89cd('0x2d')][_0x89cd('0x2f')]?_0x1643dd[_0x89cd('0x2d')]:_0x1458a0['model'];if(_0x476130['query'][_0x89cd('0x30')]){_0x1643dd[_0x89cd('0x31')]=[{'all':!![]}];}_0x1643dd=_[_0x89cd('0x32')]({},_0x1643dd,_0x476130['options']);return db[_0x89cd('0x29')][_0x89cd('0x33')](_0x1643dd)['then'](handleEntityNotFound(_0x1d269f,null))['then'](respondWithResult(_0x1d269f,null))['catch'](handleError(_0x1d269f,null));};exports[_0x89cd('0x34')]=function(_0x46ae5c,_0x1bf51a){return db[_0x89cd('0x29')][_0x89cd('0x34')](_0x46ae5c[_0x89cd('0x35')],{})['then'](respondWithResult(_0x1bf51a,0xc9))[_0x89cd('0x25')](handleError(_0x1bf51a,null));};exports[_0x89cd('0x15')]=function(_0x4194f9,_0x59c5bc){if(_0x4194f9['body']['id']){delete _0x4194f9[_0x89cd('0x35')]['id'];}return db[_0x89cd('0x29')][_0x89cd('0x33')]({'where':{'id':_0x4194f9['params']['id']}})[_0x89cd('0x24')](handleEntityNotFound(_0x59c5bc,null))['then'](saveUpdates(_0x4194f9[_0x89cd('0x35')],null))[_0x89cd('0x24')](respondWithResult(_0x59c5bc,null))[_0x89cd('0x25')](handleError(_0x59c5bc,null));};exports['destroy']=function(_0x947617,_0x20fe5f){return db[_0x89cd('0x29')][_0x89cd('0x33')]({'where':{'id':_0x947617[_0x89cd('0x36')]['id']}})[_0x89cd('0x24')](handleEntityNotFound(_0x20fe5f,null))[_0x89cd('0x24')](removeEntity(_0x20fe5f,null))[_0x89cd('0x25')](handleError(_0x20fe5f,null));};exports[_0x89cd('0x37')]=function(_0x49d9fb,_0xce37b0){return db[_0x89cd('0x29')][_0x89cd('0x37')]()[_0x89cd('0x24')](respondWithResult(_0xce37b0,null))['catch'](handleError(_0xce37b0,null));};exports[_0x89cd('0x38')]=function(_0x3f34cd,_0x112077){return db[_0x89cd('0x39')][_0x89cd('0x33')]({'where':{'id':_0x3f34cd['params']['id']}})[_0x89cd('0x24')](handleEntityNotFound(_0x112077,null))[_0x89cd('0x24')](function(_0x54c0c3){if(_0x54c0c3){return _0x54c0c3[_0x89cd('0x38')](_0x3f34cd[_0x89cd('0x35')][_0x89cd('0x3a')],_['omit'](_0x3f34cd[_0x89cd('0x35')],[_0x89cd('0x3a'),'id'])||{});}})[_0x89cd('0x24')](respondWithResult(_0x112077,null))['catch'](handleError(_0x112077,null));};exports[_0x89cd('0x3b')]=function(_0x567eef,_0x34df6b){var _0x469f11={'raw':![],'where':{}};var _0x4ee3c4={};var _0x9dd2c0={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x89cd('0x3c')]({'where':{'id':_0x567eef[_0x89cd('0x36')]['id']}})[_0x89cd('0x24')](handleEntityNotFound(_0x34df6b,null))['then'](function(_0x31bfaf){if(_0x31bfaf){_0x4ee3c4[_0x89cd('0x27')]=_[_0x89cd('0x28')](db[_0x89cd('0x39')][_0x89cd('0x1d')]);_0x4ee3c4[_0x89cd('0x2a')]=_[_0x89cd('0x28')](_0x567eef['query']);_0x4ee3c4[_0x89cd('0x2b')]=_[_0x89cd('0x2c')](_0x4ee3c4[_0x89cd('0x27')],_0x4ee3c4[_0x89cd('0x2a')]);_0x469f11[_0x89cd('0x2d')]=_['intersection'](_0x4ee3c4[_0x89cd('0x27')],qs['fields'](_0x567eef['query'][_0x89cd('0x2e')]));_0x469f11[_0x89cd('0x2d')]=_0x469f11[_0x89cd('0x2d')][_0x89cd('0x2f')]?_0x469f11[_0x89cd('0x2d')]:_0x4ee3c4['model'];if(!_0x567eef[_0x89cd('0x2a')][_0x89cd('0x3d')](_0x89cd('0x3e'))){_0x469f11['limit']=qs['limit'](_0x567eef[_0x89cd('0x2a')][_0x89cd('0x11')]);_0x469f11[_0x89cd('0xf')]=qs[_0x89cd('0xf')](_0x567eef[_0x89cd('0x2a')]['offset']);}_0x469f11[_0x89cd('0x3f')]=qs[_0x89cd('0x40')](_0x567eef[_0x89cd('0x2a')][_0x89cd('0x40')]);_0x469f11[_0x89cd('0x41')]=qs[_0x89cd('0x2b')](_[_0x89cd('0x42')](_0x567eef[_0x89cd('0x2a')],_0x4ee3c4[_0x89cd('0x2b')]));_0x469f11[_0x89cd('0x41')][_0x89cd('0x43')]=_0x31bfaf['id'];if(_0x567eef[_0x89cd('0x2a')][_0x89cd('0x44')]){_0x469f11['where']=_[_0x89cd('0x32')](_0x469f11[_0x89cd('0x41')],{'$or':_[_0x89cd('0x1c')](_0x469f11[_0x89cd('0x2d')],function(_0x537c2a){var _0x5e5556={};_0x5e5556[_0x537c2a]={'$like':'%'+_0x567eef[_0x89cd('0x2a')]['filter']+'%'};return _0x5e5556;})});}if(_0x567eef[_0x89cd('0x2a')]['$gte']){var _0x58aee4=_0x567eef[_0x89cd('0x2a')][_0x89cd('0x45')]['split'](',');var _0xad7fcc={};_0xad7fcc[_0x58aee4[0x0]]={'$gte':moment(_0x58aee4[0x1])['format'](_0x89cd('0x46'))};_0x469f11[_0x89cd('0x41')]=_[_0x89cd('0x32')](_0x469f11['where'],_0xad7fcc);}_0x469f11=_[_0x89cd('0x32')]({},_0x469f11,_0x567eef[_0x89cd('0x47')]);return db[_0x89cd('0x39')][_0x89cd('0x48')]({'where':_0x469f11[_0x89cd('0x41')]})[_0x89cd('0x24')](function(_0x3858b0){_0x9dd2c0[_0x89cd('0x48')]=_0x3858b0;if(_0x567eef[_0x89cd('0x2a')]['includeAll']){_0x469f11[_0x89cd('0x31')]=[{'all':!![]}];}return db[_0x89cd('0x39')][_0x89cd('0x49')](_0x469f11);})[_0x89cd('0x24')](function(_0x380852){_0x9dd2c0[_0x89cd('0x4a')]=_0x380852;return _0x9dd2c0;});}})[_0x89cd('0x24')](respondWithFilteredResult(_0x34df6b,_0x469f11))['catch'](handleError(_0x34df6b,null));};exports[_0x89cd('0x4b')]=function(_0x26a71a,_0x9ebebf){return db[_0x89cd('0x29')]['find']({'where':{'id':_0x26a71a[_0x89cd('0x36')]['id']}})['then'](handleEntityNotFound(_0x9ebebf,null))[_0x89cd('0x24')](function(_0xbbe0){if(_0xbbe0){return _0xbbe0[_0x89cd('0x4c')](_0x26a71a[_0x89cd('0x35')][_0x89cd('0x3a')],_[_0x89cd('0x4d')](_0x26a71a['body'],['ids','id'])||{})[_0x89cd('0x4e')](function(){return db[_0x89cd('0x4f')][_0x89cd('0x49')]({'attributes':['id','name',_0x89cd('0x50')],'where':{'id':_0x26a71a[_0x89cd('0x35')][_0x89cd('0x3a')]}});})[_0x89cd('0x24')](function(_0x3e856a){socket[_0x89cd('0x51')](_0x89cd('0x52'),{'id':Number(_0x26a71a[_0x89cd('0x36')]['id']),'tags':_0x3e856a||[]});return{'id':Number(_0x26a71a['params']['id']),'tags':_0x3e856a||[]};});}})[_0x89cd('0x24')](respondWithResult(_0x9ebebf,null))[_0x89cd('0x25')](handleError(_0x9ebebf,null));};exports['removeTags']=function(_0x205ed6,_0x2ffa54){return db[_0x89cd('0x29')][_0x89cd('0x33')]({'where':{'id':_0x205ed6['params']['id']}})['then'](handleEntityNotFound(_0x2ffa54,null))[_0x89cd('0x24')](function(_0x3617b5){if(_0x3617b5){return _0x3617b5['removeTags'](_0x205ed6['query']['ids']);}})[_0x89cd('0x24')](respondWithStatusCode(_0x2ffa54,null))[_0x89cd('0x25')](handleError(_0x2ffa54,null));};exports[_0x89cd('0x53')]=function(_0x4619bc,_0x1b3a92){var _0x537371=moment()[_0x89cd('0x54')]()['toString']();var _0x392dd0=path[_0x89cd('0x55')](config[_0x89cd('0x56')],_0x89cd('0x57'),_0x89cd('0x58'),_0x89cd('0x59'));var _0x44a9a0=path[_0x89cd('0x55')](config[_0x89cd('0x56')],'server','files',_0x89cd('0x5a'));var _0x4b16ac=path['join'](_0x392dd0,_0x537371);var _0x12ea27=util[_0x89cd('0x5b')](_0x89cd('0x5c'),_0x4619bc[_0x89cd('0x36')]['id'],_0x537371);var _0x5d1b6f=path[_0x89cd('0x55')](_0x392dd0,_0x12ea27);var _0xd83308=[];_0xd83308['push']({'model':db[_0x89cd('0x5d')],'as':_0x89cd('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0xd83308[_0x89cd('0x5e')]({'model':db[_0x89cd('0x5f')],'as':_0x89cd('0x60'),'attributes':['id',_0x89cd('0x61'),'lastName'],'raw':!![]});if(_0x4619bc['query'][_0x89cd('0x5a')]){_0xd83308['push']({'model':db['Attachment'],'as':_0x89cd('0x62'),'raw':!![]});}var _0x26d477=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x89cd('0x35'),_0x89cd('0x63'),_0x89cd('0x64'),'secret','read'],'include':_0xd83308}];_0x26d477[_0x89cd('0x5e')]({'model':db[_0x89cd('0x65')],'as':_0x89cd('0x66'),'attributes':['id','name']});_0x26d477['push']({'model':db[_0x89cd('0x5d')],'as':_0x89cd('0x67'),'attributes':['id',_0x89cd('0x68')]});return db['WhatsappInteraction'][_0x89cd('0x33')]({'where':{'id':_0x4619bc[_0x89cd('0x36')]['id']},'include':_0x26d477})[_0x89cd('0x24')](handleEntityNotFound(_0x1b3a92,null))[_0x89cd('0x24')](function(_0x2e8b60){if(_0x2e8b60){var _0x1ceb71=_0x2e8b60[_0x89cd('0x69')]({'plain':!![]});fs['mkdirSync'](_0x4b16ac);var _0x5dd09a={'channel':'Whatsapp','account':_0x1ceb71[_0x89cd('0x66')][_0x89cd('0x1a')],'agent':_0x1ceb71[_0x89cd('0x67')]?_0x1ceb71[_0x89cd('0x67')][_0x89cd('0x68')]:_0x89cd('0x6a'),'createdAt':moment(_0x1ceb71['createdAt'])[_0x89cd('0x5b')](_0x89cd('0x46'))[_0x89cd('0x6b')](),'closedAt':_0x1ceb71[_0x89cd('0x6c')]?moment(_0x1ceb71['closedAt'])['format'](_0x89cd('0x46'))[_0x89cd('0x6b')]():'','disposition':_0x1ceb71[_0x89cd('0x6d')],'messages':_(_0x1ceb71['Messages'])['filter']({'secret':![]})['map'](function(_0x1226ab){if(_0x1226ab[_0x89cd('0x62')]){var _0x55201a=path[_0x89cd('0x55')](_0x44a9a0,_0x1226ab['Attachment'][_0x89cd('0x6e')]);if(fs[_0x89cd('0x6f')](_0x55201a)){fs['createReadStream'](_0x55201a)[_0x89cd('0x70')](fs[_0x89cd('0x71')](path[_0x89cd('0x55')](_0x4b16ac,_0x1226ab[_0x89cd('0x62')][_0x89cd('0x6e')])));}}return{'date':moment(_0x1226ab['createdAt'])[_0x89cd('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x89cd('0x6b')](),'sender':_0x1226ab[_0x89cd('0x64')]===_0x89cd('0x72')?_0x1226ab[_0x89cd('0x5d')]?_0x1226ab['User'][_0x89cd('0x68')]:'System':_0x1226ab[_0x89cd('0x60')]['firstName']+(_0x1226ab[_0x89cd('0x60')][_0x89cd('0x73')]?'\x20'+_0x1226ab[_0x89cd('0x60')][_0x89cd('0x73')]:''),'body':_0x1226ab[_0x89cd('0x62')]?_0x1226ab[_0x89cd('0x62')][_0x89cd('0x6e')]:_0x1226ab[_0x89cd('0x35')],'direction':_0x1226ab[_0x89cd('0x64')]===_0x89cd('0x72')?'A':'C','secret':_0x1226ab['secret'],'read':_0x1226ab[_0x89cd('0x74')],'attachment':_0x1226ab['Attachment']};})[_0x89cd('0x75')]()};return ejs[_0x89cd('0x76')](path[_0x89cd('0x55')](config[_0x89cd('0x56')],_0x89cd('0x57'),_0x89cd('0x77'),_0x89cd('0x78')),{'interaction':_0x5dd09a})['then'](function(_0x4a6887){var _0x4eac46=path[_0x89cd('0x55')](_0x4b16ac,_0x89cd('0x79')+_0x1ceb71['id']+'-'+_0x537371+'.pdf');var _0x520496={'path':_0x4eac46,'channel':_0x89cd('0x7a'),'interactionId':_0x1ceb71['id']};return pdf[_0x89cd('0x7b')](_0x4a6887,_0x520496);})['then'](function(){return new BPromise(function(_0x4a1873,_0x5a398a){zipdir(_0x4b16ac,{'saveTo':_0x5d1b6f},function(_0x1bc743,_0x1f0fa2){if(_0x1bc743)return _0x5a398a(_0x1bc743);return _0x4a1873(_0x1f0fa2);});})[_0x89cd('0x24')](function(){return new BPromise(function(_0x4c52a0,_0xa6a51b){rimraf(_0x4b16ac,function(_0x2d1596){if(_0x2d1596)_0xa6a51b(_0x2d1596);return _0x4c52a0();});});})[_0x89cd('0x24')](function(){return _0x1b3a92[_0x89cd('0x53')](_0x5d1b6f,_0x12ea27,function(_0x22a1e7){if(_0x22a1e7){console[_0x89cd('0x7c')](_0x89cd('0x7d'),_0x22a1e7);}else{fs[_0x89cd('0x7e')](_0x5d1b6f);}});});});}else{return _0x1b3a92[_0x89cd('0x17')](0xc8);}})['catch'](handleError(_0x1b3a92,null));}; \ No newline at end of file +var _0x0a2d=['../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','error','stack','send','index','map','WhatsappInteraction','getOptions','findAll','whatsapp','user','catch','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','WhatsappMessage','length','sort','where','filters','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','name','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','createdAt','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','existsSync','pipe','basename','direction','out','System','lastName','read','value','renderFile','views','.pdf','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs'];(function(_0x37ac49,_0x31884b){var _0x3e4f24=function(_0x57cb17){while(--_0x57cb17){_0x37ac49['push'](_0x37ac49['shift']());}};_0x3e4f24(++_0x31884b);}(_0x0a2d,0x1cf));var _0xd0a2=function(_0x146100,_0x21f298){_0x146100=_0x146100-0x0;var _0x4ea820=_0x0a2d[_0x146100];return _0x4ea820;};'use strict';var rimraf=require(_0xd0a2('0x0'));var zipdir=require(_0xd0a2('0x1'));var moment=require(_0xd0a2('0x2'));var BPromise=require(_0xd0a2('0x3'));var util=require(_0xd0a2('0x4'));var path=require('path');var ejs=require(_0xd0a2('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd0a2('0x6'));var interaction=require(_0xd0a2('0x7'));var qs=require(_0xd0a2('0x8'));var pdf=require(_0xd0a2('0x9'));var logger=require(_0xd0a2('0xa'))(_0xd0a2('0xb'));var config=require('../../config/environment');var db=require(_0xd0a2('0xc'))['db'];config['redis']=_[_0xd0a2('0xd')](config['redis'],{'host':_0xd0a2('0xe'),'port':0x18eb});var socket=require(_0xd0a2('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xd0a2('0x10')](socket);function respondWithStatusCode(_0xf87d66,_0x2b720e){_0x2b720e=_0x2b720e||0xcc;return function(_0x4aee27){if(_0x4aee27){return _0xf87d66[_0xd0a2('0x11')](_0x2b720e);}return _0xf87d66[_0xd0a2('0x12')](_0x2b720e)[_0xd0a2('0x13')]();};}function respondWithResult(_0x52e44f,_0x5329f4){_0x5329f4=_0x5329f4||0xc8;return function(_0x2b0449){if(_0x2b0449){return _0x52e44f[_0xd0a2('0x12')](_0x5329f4)[_0xd0a2('0x14')](_0x2b0449);}};}function respondWithFilteredResult(_0x388107,_0x592b17){return function(_0x160051){if(_0x160051){var _0x3c2569=typeof _0x592b17['offset']===_0xd0a2('0x15')&&typeof _0x592b17[_0xd0a2('0x16')]===_0xd0a2('0x15');var _0x407b31=_0x160051[_0xd0a2('0x17')];var _0x5569d9=_0x3c2569?0x0:_0x592b17[_0xd0a2('0x18')];var _0x1b45bc=_0x3c2569?_0x160051[_0xd0a2('0x17')]:_0x592b17[_0xd0a2('0x18')]+_0x592b17[_0xd0a2('0x16')];var _0x4f3203;if(_0x1b45bc>=_0x407b31){_0x1b45bc=_0x407b31;_0x4f3203=0xc8;}else{_0x4f3203=0xce;}_0x388107['status'](_0x4f3203);return _0x388107['set'](_0xd0a2('0x19'),_0x5569d9+'-'+_0x1b45bc+'/'+_0x407b31)[_0xd0a2('0x14')](_0x160051);}return null;};}function saveUpdates(_0x47305c){return function(_0xb658f){if(_0xb658f){return _0xb658f[_0xd0a2('0x1a')](_0x47305c)[_0xd0a2('0x1b')](function(_0x22e418){return _0x22e418;});}return null;};}function removeEntity(_0x42b582){return function(_0x2a1c27){if(_0x2a1c27){return _0x2a1c27['destroy']()[_0xd0a2('0x1b')](function(){_0x42b582[_0xd0a2('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1719ab){return function(_0x410e8d){if(!_0x410e8d){_0x1719ab[_0xd0a2('0x11')](0x194);}return _0x410e8d;};}function handleError(_0x9059e9,_0x3e2b26){_0x3e2b26=_0x3e2b26||0x1f4;return function(_0x34ae7b){logger[_0xd0a2('0x1c')](_0x34ae7b[_0xd0a2('0x1d')]);if(_0x34ae7b['name']){delete _0x34ae7b['name'];}_0x9059e9[_0xd0a2('0x12')](_0x3e2b26)[_0xd0a2('0x1e')](_0x34ae7b);};}exports[_0xd0a2('0x1f')]=function(_0x202f73,_0x1350bc){var _0x5e7eef={};var _0x4990d=_[_0xd0a2('0x20')](db[_0xd0a2('0x21')]['rawAttributes'],function(_0xa826c9){return{'name':_0xa826c9['fieldName'],'type':_0xa826c9['type']['key']};});_0x5e7eef=qs[_0xd0a2('0x22')](_0x4990d,_0x202f73);return interaction[_0xd0a2('0x23')](_0xd0a2('0x24'),_0x202f73['query'],_0x202f73[_0xd0a2('0x25')],_0x5e7eef,_0x4990d)[_0xd0a2('0x1b')](respondWithFilteredResult(_0x1350bc,_0x5e7eef))[_0xd0a2('0x26')](handleError(_0x1350bc,null));};exports[_0xd0a2('0x27')]=function(_0x399071,_0xd646a5){var _0x368d9e={'raw':![],'where':{'id':_0x399071[_0xd0a2('0x28')]['id']}},_0x2e1a9c={};_0x2e1a9c[_0xd0a2('0x29')]=_[_0xd0a2('0x2a')](db[_0xd0a2('0x21')][_0xd0a2('0x2b')]);_0x2e1a9c[_0xd0a2('0x2c')]=_[_0xd0a2('0x2a')](_0x399071[_0xd0a2('0x2c')]);_0x2e1a9c['filters']=_[_0xd0a2('0x2d')](_0x2e1a9c[_0xd0a2('0x29')],_0x2e1a9c[_0xd0a2('0x2c')]);_0x368d9e[_0xd0a2('0x2e')]=_['intersection'](_0x2e1a9c['model'],qs[_0xd0a2('0x2f')](_0x399071[_0xd0a2('0x2c')][_0xd0a2('0x2f')]));_0x368d9e[_0xd0a2('0x2e')]=_0x368d9e['attributes']['length']?_0x368d9e[_0xd0a2('0x2e')]:_0x2e1a9c[_0xd0a2('0x29')];if(_0x399071['query']['includeAll']){_0x368d9e[_0xd0a2('0x30')]=[{'all':!![]}];}_0x368d9e=_[_0xd0a2('0x31')]({},_0x368d9e,_0x399071[_0xd0a2('0x32')]);return db[_0xd0a2('0x21')][_0xd0a2('0x33')](_0x368d9e)['then'](handleEntityNotFound(_0xd646a5,null))[_0xd0a2('0x1b')](respondWithResult(_0xd646a5,null))[_0xd0a2('0x26')](handleError(_0xd646a5,null));};exports[_0xd0a2('0x34')]=function(_0x2a9fca,_0x97d09c){return db[_0xd0a2('0x21')][_0xd0a2('0x34')](_0x2a9fca['body'],{})[_0xd0a2('0x1b')](respondWithResult(_0x97d09c,0xc9))[_0xd0a2('0x26')](handleError(_0x97d09c,null));};exports[_0xd0a2('0x1a')]=function(_0x460460,_0x4118c0){if(_0x460460[_0xd0a2('0x35')]['id']){delete _0x460460[_0xd0a2('0x35')]['id'];}return db[_0xd0a2('0x21')]['find']({'where':{'id':_0x460460[_0xd0a2('0x28')]['id']}})[_0xd0a2('0x1b')](handleEntityNotFound(_0x4118c0,null))[_0xd0a2('0x1b')](saveUpdates(_0x460460[_0xd0a2('0x35')],null))[_0xd0a2('0x1b')](respondWithResult(_0x4118c0,null))[_0xd0a2('0x26')](handleError(_0x4118c0,null));};exports['destroy']=function(_0x453cee,_0x25c0d9){return db[_0xd0a2('0x21')]['find']({'where':{'id':_0x453cee[_0xd0a2('0x28')]['id']}})['then'](handleEntityNotFound(_0x25c0d9,null))['then'](removeEntity(_0x25c0d9,null))[_0xd0a2('0x26')](handleError(_0x25c0d9,null));};exports[_0xd0a2('0x36')]=function(_0x2ba93,_0x2cba20){return db[_0xd0a2('0x21')][_0xd0a2('0x36')]()[_0xd0a2('0x1b')](respondWithResult(_0x2cba20,null))[_0xd0a2('0x26')](handleError(_0x2cba20,null));};exports[_0xd0a2('0x37')]=function(_0x37b1a6,_0x2340c4){return db['WhatsappMessage'][_0xd0a2('0x33')]({'where':{'id':_0x37b1a6['params']['id']}})[_0xd0a2('0x1b')](handleEntityNotFound(_0x2340c4,null))['then'](function(_0x1044f4){if(_0x1044f4){return _0x1044f4[_0xd0a2('0x37')](_0x37b1a6[_0xd0a2('0x35')][_0xd0a2('0x38')],_[_0xd0a2('0x39')](_0x37b1a6['body'],[_0xd0a2('0x38'),'id'])||{});}})[_0xd0a2('0x1b')](respondWithResult(_0x2340c4,null))[_0xd0a2('0x26')](handleError(_0x2340c4,null));};exports[_0xd0a2('0x3a')]=function(_0x32e7a8,_0x284e1c){var _0x3e21a6={'raw':![],'where':{}};var _0x6a7b63={};var _0x1958db={'count':0x0,'rows':[]};return db[_0xd0a2('0x21')]['findOne']({'where':{'id':_0x32e7a8[_0xd0a2('0x28')]['id']}})[_0xd0a2('0x1b')](handleEntityNotFound(_0x284e1c,null))[_0xd0a2('0x1b')](function(_0x2647d0){if(_0x2647d0){_0x6a7b63['model']=_[_0xd0a2('0x2a')](db[_0xd0a2('0x3b')]['rawAttributes']);_0x6a7b63[_0xd0a2('0x2c')]=_['keys'](_0x32e7a8[_0xd0a2('0x2c')]);_0x6a7b63['filters']=_[_0xd0a2('0x2d')](_0x6a7b63[_0xd0a2('0x29')],_0x6a7b63[_0xd0a2('0x2c')]);_0x3e21a6['attributes']=_['intersection'](_0x6a7b63[_0xd0a2('0x29')],qs[_0xd0a2('0x2f')](_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x2f')]));_0x3e21a6[_0xd0a2('0x2e')]=_0x3e21a6[_0xd0a2('0x2e')][_0xd0a2('0x3c')]?_0x3e21a6[_0xd0a2('0x2e')]:_0x6a7b63['model'];if(!_0x32e7a8['query']['hasOwnProperty']('nolimit')){_0x3e21a6[_0xd0a2('0x16')]=qs['limit'](_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x16')]);_0x3e21a6[_0xd0a2('0x18')]=qs[_0xd0a2('0x18')](_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x18')]);}_0x3e21a6['order']=qs[_0xd0a2('0x3d')](_0x32e7a8['query'][_0xd0a2('0x3d')]);_0x3e21a6[_0xd0a2('0x3e')]=qs[_0xd0a2('0x3f')](_[_0xd0a2('0x40')](_0x32e7a8[_0xd0a2('0x2c')],_0x6a7b63[_0xd0a2('0x3f')]));_0x3e21a6[_0xd0a2('0x3e')][_0xd0a2('0x41')]=_0x2647d0['id'];if(_0x32e7a8['query']['filter']){_0x3e21a6[_0xd0a2('0x3e')]=_['merge'](_0x3e21a6[_0xd0a2('0x3e')],{'$or':_[_0xd0a2('0x20')](_0x3e21a6[_0xd0a2('0x2e')],function(_0x42d35b){var _0x15b302={};_0x15b302[_0x42d35b]={'$like':'%'+_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x42')]+'%'};return _0x15b302;})});}if(_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x43')]){var _0x22d371=_0x32e7a8[_0xd0a2('0x2c')][_0xd0a2('0x43')][_0xd0a2('0x44')](',');var _0x36b026={};_0x36b026[_0x22d371[0x0]]={'$gte':moment(_0x22d371[0x1])[_0xd0a2('0x45')](_0xd0a2('0x46'))};_0x3e21a6[_0xd0a2('0x3e')]=_[_0xd0a2('0x31')](_0x3e21a6[_0xd0a2('0x3e')],_0x36b026);}_0x3e21a6=_['merge']({},_0x3e21a6,_0x32e7a8['options']);return db[_0xd0a2('0x3b')][_0xd0a2('0x17')]({'where':_0x3e21a6['where']})[_0xd0a2('0x1b')](function(_0x3622b7){_0x1958db[_0xd0a2('0x17')]=_0x3622b7;if(_0x32e7a8['query']['includeAll']){_0x3e21a6[_0xd0a2('0x30')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd0a2('0x23')](_0x3e21a6);})[_0xd0a2('0x1b')](function(_0x2595cb){_0x1958db[_0xd0a2('0x47')]=_0x2595cb;return _0x1958db;});}})[_0xd0a2('0x1b')](respondWithFilteredResult(_0x284e1c,_0x3e21a6))['catch'](handleError(_0x284e1c,null));};exports[_0xd0a2('0x48')]=function(_0xb0ea08,_0x21a463){return db[_0xd0a2('0x21')]['find']({'where':{'id':_0xb0ea08[_0xd0a2('0x28')]['id']}})[_0xd0a2('0x1b')](handleEntityNotFound(_0x21a463,null))[_0xd0a2('0x1b')](function(_0x23b9b4){if(_0x23b9b4){return _0x23b9b4[_0xd0a2('0x49')](_0xb0ea08['body'][_0xd0a2('0x38')],_[_0xd0a2('0x39')](_0xb0ea08[_0xd0a2('0x35')],[_0xd0a2('0x38'),'id'])||{})[_0xd0a2('0x4a')](function(){return db[_0xd0a2('0x4b')][_0xd0a2('0x23')]({'attributes':['id',_0xd0a2('0x4c'),'color'],'where':{'id':_0xb0ea08[_0xd0a2('0x35')][_0xd0a2('0x38')]}});})[_0xd0a2('0x1b')](function(_0x343eed){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0xb0ea08['params']['id']),'tags':_0x343eed||[]});return{'id':Number(_0xb0ea08['params']['id']),'tags':_0x343eed||[]};});}})[_0xd0a2('0x1b')](respondWithResult(_0x21a463,null))['catch'](handleError(_0x21a463,null));};exports['removeTags']=function(_0x13d1f8,_0x1ff18f){return db[_0xd0a2('0x21')][_0xd0a2('0x33')]({'where':{'id':_0x13d1f8['params']['id']}})[_0xd0a2('0x1b')](handleEntityNotFound(_0x1ff18f,null))[_0xd0a2('0x1b')](function(_0x1eb56e){if(_0x1eb56e){return _0x1eb56e[_0xd0a2('0x4d')](_0x13d1f8[_0xd0a2('0x2c')][_0xd0a2('0x38')]);}})[_0xd0a2('0x1b')](respondWithStatusCode(_0x1ff18f,null))[_0xd0a2('0x26')](handleError(_0x1ff18f,null));};exports[_0xd0a2('0x4e')]=function(_0x55f895,_0x4c8be1){var _0x16580d=moment()[_0xd0a2('0x4f')]()[_0xd0a2('0x50')]();var _0xb7b589=path[_0xd0a2('0x51')](config[_0xd0a2('0x52')],_0xd0a2('0x53'),_0xd0a2('0x54'),'tmp');var _0x94ac75=path[_0xd0a2('0x51')](config['root'],_0xd0a2('0x53'),'files',_0xd0a2('0x55'));var _0x478115=path[_0xd0a2('0x51')](_0xb7b589,_0x16580d);var _0x444f3f=util[_0xd0a2('0x45')](_0xd0a2('0x56'),_0x55f895[_0xd0a2('0x28')]['id'],_0x16580d);var _0x257316=path[_0xd0a2('0x51')](_0xb7b589,_0x444f3f);var _0x22d1e0=[];_0x22d1e0['push']({'model':db[_0xd0a2('0x57')],'as':'User','attributes':['id',_0xd0a2('0x58')],'raw':!![]});_0x22d1e0[_0xd0a2('0x59')]({'model':db[_0xd0a2('0x5a')],'as':_0xd0a2('0x5b'),'attributes':['id',_0xd0a2('0x5c'),'lastName'],'raw':!![]});if(_0x55f895[_0xd0a2('0x2c')][_0xd0a2('0x55')]){_0x22d1e0['push']({'model':db['Attachment'],'as':_0xd0a2('0x5d'),'raw':!![]});}var _0x2a92ee=[{'model':db[_0xd0a2('0x3b')],'as':'Messages','attributes':['id',_0xd0a2('0x35'),_0xd0a2('0x5e'),'direction','secret','read'],'include':_0x22d1e0}];_0x2a92ee[_0xd0a2('0x59')]({'model':db[_0xd0a2('0x5f')],'as':_0xd0a2('0x60'),'attributes':['id',_0xd0a2('0x4c')]});_0x2a92ee[_0xd0a2('0x59')]({'model':db[_0xd0a2('0x57')],'as':_0xd0a2('0x61'),'attributes':['id',_0xd0a2('0x58')]});return db[_0xd0a2('0x21')][_0xd0a2('0x33')]({'where':{'id':_0x55f895[_0xd0a2('0x28')]['id']},'include':_0x2a92ee})[_0xd0a2('0x1b')](handleEntityNotFound(_0x4c8be1,null))[_0xd0a2('0x1b')](function(_0x3172f8){if(_0x3172f8){var _0x54bc2c=_0x3172f8['get']({'plain':!![]});fs[_0xd0a2('0x62')](_0x478115);var _0xd1bf2={'channel':_0xd0a2('0x63'),'account':_0x54bc2c[_0xd0a2('0x60')][_0xd0a2('0x4c')],'agent':_0x54bc2c[_0xd0a2('0x61')]?_0x54bc2c[_0xd0a2('0x61')]['fullname']:_0xd0a2('0x64'),'createdAt':moment(_0x54bc2c[_0xd0a2('0x5e')])['format'](_0xd0a2('0x46'))[_0xd0a2('0x50')](),'closedAt':_0x54bc2c[_0xd0a2('0x65')]?moment(_0x54bc2c[_0xd0a2('0x66')])['format'](_0xd0a2('0x46'))[_0xd0a2('0x50')]():'','disposition':_0x54bc2c[_0xd0a2('0x67')],'messages':_(_0x54bc2c['Messages'])[_0xd0a2('0x42')]({'secret':![]})[_0xd0a2('0x20')](function(_0xf0b617){if(_0xf0b617[_0xd0a2('0x5d')]){var _0xff27d2=path['join'](_0x94ac75,_0xf0b617[_0xd0a2('0x5d')]['basename']);if(fs[_0xd0a2('0x68')](_0xff27d2)){fs['createReadStream'](_0xff27d2)[_0xd0a2('0x69')](fs['createWriteStream'](path['join'](_0x478115,_0xf0b617[_0xd0a2('0x5d')][_0xd0a2('0x6a')])));}}return{'date':moment(_0xf0b617[_0xd0a2('0x5e')])[_0xd0a2('0x45')](_0xd0a2('0x46'))['toString'](),'sender':_0xf0b617[_0xd0a2('0x6b')]===_0xd0a2('0x6c')?_0xf0b617[_0xd0a2('0x57')]?_0xf0b617[_0xd0a2('0x57')][_0xd0a2('0x58')]:_0xd0a2('0x6d'):_0xf0b617[_0xd0a2('0x5b')][_0xd0a2('0x5c')]+(_0xf0b617['Contact'][_0xd0a2('0x6e')]?'\x20'+_0xf0b617['Contact'][_0xd0a2('0x6e')]:''),'body':_0xf0b617['Attachment']?_0xf0b617[_0xd0a2('0x5d')][_0xd0a2('0x6a')]:_0xf0b617[_0xd0a2('0x35')],'direction':_0xf0b617[_0xd0a2('0x6b')]==='out'?'A':'C','secret':_0xf0b617['secret'],'read':_0xf0b617[_0xd0a2('0x6f')],'attachment':_0xf0b617[_0xd0a2('0x5d')]};})[_0xd0a2('0x70')]()};return ejs[_0xd0a2('0x71')](path[_0xd0a2('0x51')](config[_0xd0a2('0x52')],_0xd0a2('0x53'),_0xd0a2('0x72'),'downloadInteraction.ejs'),{'interaction':_0xd1bf2})['then'](function(_0x41d811){var _0xcb75b3=path[_0xd0a2('0x51')](_0x478115,'transcript-'+_0x54bc2c['id']+'-'+_0x16580d+_0xd0a2('0x73'));var _0x5c97e1={'path':_0xcb75b3,'channel':'Whatsapp','interactionId':_0x54bc2c['id']};return pdf['createPdfFromHTML'](_0x41d811,_0x5c97e1);})[_0xd0a2('0x1b')](function(){return new BPromise(function(_0x373eac,_0x5e6ffe){zipdir(_0x478115,{'saveTo':_0x257316},function(_0x463af4,_0x3dd3d5){if(_0x463af4)return _0x5e6ffe(_0x463af4);return _0x373eac(_0x3dd3d5);});})[_0xd0a2('0x1b')](function(){return new BPromise(function(_0x2a666a,_0xb711ad){rimraf(_0x478115,function(_0x7dcc0b){if(_0x7dcc0b)_0xb711ad(_0x7dcc0b);return _0x2a666a();});});})[_0xd0a2('0x1b')](function(){return _0x4c8be1[_0xd0a2('0x4e')](_0x257316,_0x444f3f,function(_0x200783){if(_0x200783){console[_0xd0a2('0x74')](_0xd0a2('0x75'),_0x200783);}else{fs['unlinkSync'](_0x257316);}});});});}else{return _0x4c8be1['sendStatus'](0xc8);}})['catch'](handleError(_0x4c8be1,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 729675a..d6c6e8e 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 _0x063c=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x1cae15,_0x4ef921){var _0x5dc264=function(_0x853032){while(--_0x853032){_0x1cae15['push'](_0x1cae15['shift']());}};_0x5dc264(++_0x4ef921);}(_0x063c,0xba));var _0xc063=function(_0x4c332f,_0x14818c){_0x4c332f=_0x4c332f-0x0;var _0x4cf021=_0x063c[_0x4c332f];return _0x4cf021;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xc063('0x0'))['db'][_0xc063('0x1')];var WhatsappMessage=require(_0xc063('0x0'))['db'][_0xc063('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc063('0x3')](0x0);var events={'afterCreate':_0xc063('0x4'),'afterUpdate':'update','afterDestroy':_0xc063('0x5')};function emitEvent(_0x5ec48e){return function(_0x590831,_0x59b81f,_0x182d20){_0x590831[_0xc063('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3dbe7c){_0x590831[_0xc063('0x7')](_0xc063('0x8'),_0x3dbe7c[_0xc063('0x9')](function(_0x4ac472){return{'id':_0x4ac472['id']};}));return WhatsappMessage[_0xc063('0xa')]({'where':{'WhatsappInteractionId':_0x590831['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc063('0xb')](function(_0x4e788f){_0x590831[_0xc063('0x7')](_0xc063('0xc'),_0x4e788f['length']);WhatsappInteractionEvents[_0xc063('0xd')](_0x5ec48e+':'+_0x590831['id'],_0x590831);WhatsappInteractionEvents['emit'](_0x5ec48e,_0x590831);_0x182d20(null);})['catch'](_0x182d20(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc063('0xe')](e,emitEvent(event));}}module[_0xc063('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xfbb4=['unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','map','then'];(function(_0x3809dd,_0x4203d3){var _0x1420b1=function(_0x198c23){while(--_0x198c23){_0x3809dd['push'](_0x3809dd['shift']());}};_0x1420b1(++_0x4203d3);}(_0xfbb4,0x186));var _0x4fbb=function(_0x501863,_0x57a7bc){_0x501863=_0x501863-0x0;var _0x3059cb=_0xfbb4[_0x501863];return _0x3059cb;};'use strict';var EventEmitter=require(_0x4fbb('0x0'));var WhatsappInteraction=require(_0x4fbb('0x1'))['db'][_0x4fbb('0x2')];var WhatsappMessage=require(_0x4fbb('0x1'))['db'][_0x4fbb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4fbb('0x4')](0x0);var events={'afterCreate':_0x4fbb('0x5'),'afterUpdate':_0x4fbb('0x6'),'afterDestroy':'remove'};function emitEvent(_0x514d23){return function(_0x16c6f2,_0xba265e,_0x2b5756){_0x16c6f2[_0x4fbb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53a552){_0x16c6f2['setDataValue']('Users',_0x53a552[_0x4fbb('0x8')](function(_0x45ac3e){return{'id':_0x45ac3e['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x16c6f2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4fbb('0x9')](function(_0xc3ed78){_0x16c6f2['setDataValue'](_0x4fbb('0xa'),_0xc3ed78[_0x4fbb('0xb')]);WhatsappInteractionEvents[_0x4fbb('0xc')](_0x514d23+':'+_0x16c6f2['id'],_0x16c6f2);WhatsappInteractionEvents[_0x4fbb('0xc')](_0x514d23,_0x16c6f2);_0x2b5756(null);})[_0x4fbb('0xd')](_0x2b5756(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4fbb('0xe')](e,emitEvent(event));}}module[_0x4fbb('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f2c1343..f15d866 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 _0xb234=['closedAt','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x34ad81,_0x833bdc){var _0x1ad081=function(_0x5b46cc){while(--_0x5b46cc){_0x34ad81['push'](_0x34ad81['shift']());}};_0x1ad081(++_0x833bdc);}(_0xb234,0xd1));var _0x4b23=function(_0x579e38,_0x525417){_0x579e38=_0x579e38-0x0;var _0x306d51=_0xb234[_0x579e38];return _0x306d51;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b23('0x0'))(_0x4b23('0x1'));var moment=require(_0x4b23('0x2'));var BPromise=require(_0x4b23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b23('0x4'));var rimraf=require('rimraf');var config=require(_0x4b23('0x5'));var attributes=require(_0x4b23('0x6'));module[_0x4b23('0x7')]=function(_0x54bec6,_0x4d66e9){return _0x54bec6['define'](_0x4b23('0x8'),attributes,{'tableName':_0x4b23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15cd50,_0x30e8d3,_0x4b9509){if(_0x15cd50[_0x4b23('0xa')](_0x4b23('0xb'))){_0x15cd50[_0x4b23('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4b9509(null,_0x15cd50);}}});}; \ No newline at end of file +var _0xf5bf=['moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x6e9a01,_0x41ab36){var _0x238469=function(_0x4811e){while(--_0x4811e){_0x6e9a01['push'](_0x6e9a01['shift']());}};_0x238469(++_0x41ab36);}(_0xf5bf,0x15c));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff5b('0x0'));var util=require(_0xff5b('0x1'));var logger=require(_0xff5b('0x2'))(_0xff5b('0x3'));var moment=require(_0xff5b('0x4'));var BPromise=require(_0xff5b('0x5'));var rp=require(_0xff5b('0x6'));var fs=require('fs');var path=require(_0xff5b('0x7'));var rimraf=require('rimraf');var config=require(_0xff5b('0x8'));var attributes=require(_0xff5b('0x9'));module['exports']=function(_0x4dce05,_0x356c2e){return _0x4dce05['define'](_0xff5b('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52185f,_0x21c7ec,_0x5a4565){if(_0x52185f[_0xff5b('0xb')](_0xff5b('0xc'))){_0x52185f[_0xff5b('0xd')]=moment()[_0xff5b('0xe')](_0xff5b('0xf'));}_0x5a4565(null,_0x52185f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c2670a8..a24bc1a 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 _0x1405=['error','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','info','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','debug','stringify'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x1405,0x1e9));var _0x5140=function(_0x2e9da2,_0x25c4b3){_0x2e9da2=_0x2e9da2-0x0;var _0x5da8ea=_0x1405[_0x2e9da2];return _0x5da8ea;};'use strict';var _=require(_0x5140('0x0'));var util=require(_0x5140('0x1'));var moment=require('moment');var BPromise=require(_0x5140('0x2'));var rs=require(_0x5140('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5140('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5140('0x5'))('rpc');var config=require(_0x5140('0x6'));var jayson=require(_0x5140('0x7'));var client=jayson[_0x5140('0x8')][_0x5140('0x9')]({'port':0x232a});config[_0x5140('0xa')]=_['defaults'](config['redis'],{'host':_0x5140('0xb'),'port':0x18eb});var socket=require(_0x5140('0xc'))(new Redis(config[_0x5140('0xa')]));require(_0x5140('0xd'))['register'](socket);function respondWithRpcPromise(_0xe3d22,_0x14cac4,_0x42a03f){return new BPromise(function(_0xf03e3,_0x5c5f8c){return client[_0x5140('0xe')](_0xe3d22,_0x42a03f)[_0x5140('0xf')](function(_0x3ea638){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x14cac4,'request\x20sent');logger[_0x5140('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x14cac4,'request\x20sent',JSON[_0x5140('0x11')](_0x3ea638));if(_0x3ea638[_0x5140('0x12')]){if(_0x3ea638[_0x5140('0x12')]['code']===0x1f4){logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0x3ea638['error'][_0x5140('0x14')]);return _0x5c5f8c(_0x3ea638[_0x5140('0x12')]['message']);}logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0x3ea638[_0x5140('0x12')][_0x5140('0x14')]);return _0xf03e3(_0x3ea638[_0x5140('0x12')][_0x5140('0x14')]);}else{logger['info'](_0x5140('0x13'),_0x14cac4,_0x5140('0x15'));_0xf03e3(_0x3ea638[_0x5140('0x16')][_0x5140('0x14')]);}})[_0x5140('0x17')](function(_0xe007d9){logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0xe007d9);_0x5c5f8c(_0xe007d9);});});}exports[_0x5140('0x18')]=function(_0x147894){var _0x5e9dee=this;return new Promise(function(_0xd16c24,_0x12e553){return db[_0x5140('0x19')][_0x5140('0x1a')](_0x147894[_0x5140('0x1b')],{'raw':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')][_0x5140('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147894[_0x5140('0x1c')]?_0x147894['options'][_0x5140('0x1e')]||null:null,'attributes':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')]['attributes']||null:null,'limit':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')][_0x5140('0x1f')]||null:null})[_0x5140('0xf')](function(_0x5a174e){logger['info'](_0x5140('0x18'),_0x147894);logger[_0x5140('0x10')](_0x5140('0x18'),_0x147894,JSON[_0x5140('0x11')](_0x5a174e));_0xd16c24(_0x5a174e);})[_0x5140('0x17')](function(_0x1dfe18){logger[_0x5140('0x12')]('UpdateWhatsappInteraction',_0x1dfe18[_0x5140('0x14')],_0x147894);_0x12e553(_0x5e9dee[_0x5140('0x12')](0x1f4,_0x1dfe18['message']));});});};exports[_0x5140('0x20')]=function(_0xf95b85){return new Promise(function(_0x50cba0,_0x37eaf7){return db[_0x5140('0x19')][_0x5140('0x21')]({'where':_0xf95b85['options']?_0xf95b85[_0x5140('0x1c')][_0x5140('0x1e')]||null:null})[_0x5140('0xf')](function(_0x54ffe1){if(_0x54ffe1){return _0x54ffe1['addTags'](_0xf95b85[_0x5140('0x1b')][_0x5140('0x22')],_[_0x5140('0x23')](_0xf95b85[_0x5140('0x1b')],[_0x5140('0x22'),'id'])||{});}})[_0x5140('0x24')](function(_0x4f99f8){logger[_0x5140('0x25')](_0x5140('0x26'),_0xf95b85);logger[_0x5140('0x10')](_0x5140('0x26'),_0xf95b85,JSON['stringify'](_0x4f99f8));_0x50cba0(_0x4f99f8);})[_0x5140('0x17')](function(_0x541f4a){logger[_0x5140('0x12')](_0x5140('0x26'),_0x541f4a[_0x5140('0x14')],_0xf95b85);_0x37eaf7(_this[_0x5140('0x12')](0x1f4,_0x541f4a[_0x5140('0x14')]));});});}; \ No newline at end of file +var _0xfc9b=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','catch','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b7e18,_0xb04a03){var _0x2a48cd=function(_0x137c08){while(--_0x137c08){_0x3b7e18['push'](_0x3b7e18['shift']());}};_0x2a48cd(++_0xb04a03);}(_0xfc9b,0x126));var _0xbfc9=function(_0x22ce25,_0x307747){_0x22ce25=_0x22ce25-0x0;var _0x3bd9c6=_0xfc9b[_0x22ce25];return _0x3bd9c6;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var moment=require(_0xbfc9('0x2'));var BPromise=require(_0xbfc9('0x3'));var rs=require(_0xbfc9('0x4'));var fs=require('fs');var Redis=require(_0xbfc9('0x5'));var db=require(_0xbfc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfc9('0x7'))(_0xbfc9('0x8'));var config=require(_0xbfc9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbfc9('0xa')][_0xbfc9('0xb')]({'port':0x232a});config[_0xbfc9('0xc')]=_[_0xbfc9('0xd')](config['redis'],{'host':_0xbfc9('0xe'),'port':0x18eb});var socket=require(_0xbfc9('0xf'))(new Redis(config['redis']));require(_0xbfc9('0x10'))[_0xbfc9('0x11')](socket);function respondWithRpcPromise(_0x459fa2,_0x5bcd9a,_0x1823b1){return new BPromise(function(_0x31d328,_0x12a420){return client['request'](_0x459fa2,_0x1823b1)[_0xbfc9('0x12')](function(_0x572c75){logger[_0xbfc9('0x13')](_0xbfc9('0x14'),_0x5bcd9a,'request\x20sent');logger[_0xbfc9('0x15')](_0xbfc9('0x16'),_0x5bcd9a,_0xbfc9('0x17'),JSON[_0xbfc9('0x18')](_0x572c75));if(_0x572c75['error']){if(_0x572c75[_0xbfc9('0x19')]['code']===0x1f4){logger[_0xbfc9('0x19')](_0xbfc9('0x14'),_0x5bcd9a,_0x572c75[_0xbfc9('0x19')][_0xbfc9('0x1a')]);return _0x12a420(_0x572c75['error'][_0xbfc9('0x1a')]);}logger[_0xbfc9('0x19')](_0xbfc9('0x14'),_0x5bcd9a,_0x572c75[_0xbfc9('0x19')][_0xbfc9('0x1a')]);return _0x31d328(_0x572c75['error'][_0xbfc9('0x1a')]);}else{logger[_0xbfc9('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x5bcd9a,'request\x20sent');_0x31d328(_0x572c75[_0xbfc9('0x1b')][_0xbfc9('0x1a')]);}})['catch'](function(_0x2ed064){logger[_0xbfc9('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x5bcd9a,_0x2ed064);_0x12a420(_0x2ed064);});});}exports[_0xbfc9('0x1c')]=function(_0x15aa26){var _0x209b12=this;return new Promise(function(_0x581468,_0x284b49){return db[_0xbfc9('0x1d')][_0xbfc9('0x1e')](_0x15aa26[_0xbfc9('0x1f')],{'raw':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26['options'][_0xbfc9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26['options'][_0xbfc9('0x22')]||null:null,'attributes':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26[_0xbfc9('0x20')][_0xbfc9('0x23')]||null:null,'limit':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26[_0xbfc9('0x20')][_0xbfc9('0x24')]||null:null})[_0xbfc9('0x12')](function(_0x39f71d){logger[_0xbfc9('0x13')]('UpdateWhatsappInteraction',_0x15aa26);logger['debug']('UpdateWhatsappInteraction',_0x15aa26,JSON[_0xbfc9('0x18')](_0x39f71d));_0x581468(_0x39f71d);})[_0xbfc9('0x25')](function(_0x37c47e){logger[_0xbfc9('0x19')](_0xbfc9('0x1c'),_0x37c47e[_0xbfc9('0x1a')],_0x15aa26);_0x284b49(_0x209b12[_0xbfc9('0x19')](0x1f4,_0x37c47e['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2bf623){return new Promise(function(_0x39d1a0,_0x4a61e9){return db['WhatsappInteraction'][_0xbfc9('0x26')]({'where':_0x2bf623[_0xbfc9('0x20')]?_0x2bf623[_0xbfc9('0x20')]['where']||null:null})[_0xbfc9('0x12')](function(_0x5a5810){if(_0x5a5810){return _0x5a5810[_0xbfc9('0x27')](_0x2bf623[_0xbfc9('0x1f')][_0xbfc9('0x28')],_['omit'](_0x2bf623[_0xbfc9('0x1f')],[_0xbfc9('0x28'),'id'])||{});}})[_0xbfc9('0x29')](function(_0x18533a){logger['info'](_0xbfc9('0x2a'),_0x2bf623);logger[_0xbfc9('0x15')](_0xbfc9('0x2a'),_0x2bf623,JSON[_0xbfc9('0x18')](_0x18533a));_0x39d1a0(_0x18533a);})[_0xbfc9('0x25')](function(_0x9edd8c){logger[_0xbfc9('0x19')](_0xbfc9('0x2a'),_0x9edd8c[_0xbfc9('0x1a')],_0x2bf623);_0x4a61e9(_this[_0xbfc9('0x19')](0x1f4,_0x9edd8c[_0xbfc9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 11ebe26..f4d7b0f 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 _0x737c=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x49eb23,_0x5a2884){var _0x59cf0a=function(_0xa904b5){while(--_0xa904b5){_0x49eb23['push'](_0x49eb23['shift']());}};_0x59cf0a(++_0x5a2884);}(_0x737c,0x10c));var _0xc737=function(_0x24f17b,_0x526ba7){_0x24f17b=_0x24f17b-0x0;var _0x63a9f8=_0x737c[_0x24f17b];return _0x63a9f8;};'use strict';var WhatsappInteractionEvents=require(_0xc737('0x0'));var events=[_0xc737('0x1'),_0xc737('0x2'),_0xc737('0x3')];function createListener(_0x3fa68e,_0x51361a){return function(_0x2dbaf7){_0x51361a[_0xc737('0x4')](_0x3fa68e,_0x2dbaf7);};}function removeListener(_0x5bd644,_0x25917e){return function(){WhatsappInteractionEvents[_0xc737('0x5')](_0x5bd644,_0x25917e);};}exports['register']=function(_0xcbf965){for(var _0x4d4576=0x0,_0x4c1fa1=events[_0xc737('0x6')];_0x4d4576<_0x4c1fa1;_0x4d4576++){var _0x3daa04=events[_0x4d4576];var _0x14fcba=createListener(_0xc737('0x7')+_0x3daa04,_0xcbf965);WhatsappInteractionEvents['on'](_0x3daa04,_0x14fcba);}}; \ No newline at end of file +var _0x1a35=['update','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4d943a,_0x1c5663){var _0x3dc58e=function(_0x4a0f28){while(--_0x4a0f28){_0x4d943a['push'](_0x4d943a['shift']());}};_0x3dc58e(++_0x1c5663);}(_0x1a35,0x1a7));var _0x51a3=function(_0x4a02ef,_0x6bf96c){_0x4a02ef=_0x4a02ef-0x0;var _0x630d5d=_0x1a35[_0x4a02ef];return _0x630d5d;};'use strict';var WhatsappInteractionEvents=require(_0x51a3('0x0'));var events=[_0x51a3('0x1'),'remove',_0x51a3('0x2')];function createListener(_0x5eaedf,_0x99e6a8){return function(_0x378ba7){_0x99e6a8['emit'](_0x5eaedf,_0x378ba7);};}function removeListener(_0x5f4d43,_0xcf81cb){return function(){WhatsappInteractionEvents['removeListener'](_0x5f4d43,_0xcf81cb);};}exports['register']=function(_0x398dfd){for(var _0x1b7332=0x0,_0x1c2532=events[_0x51a3('0x3')];_0x1b7332<_0x1c2532;_0x1b7332++){var _0x4f8864=events[_0x1b7332];var _0x5a3003=createListener(_0x51a3('0x4')+_0x4f8864,_0x398dfd);WhatsappInteractionEvents['on'](_0x4f8864,_0x5a3003);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 09ccd85..f166600 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 _0xc173=['index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc173,0x150));var _0x3c17=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc173[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3c17('0x0'));var util=require(_0x3c17('0x1'));var path=require(_0x3c17('0x2'));var timeout=require(_0x3c17('0x3'));var express=require(_0x3c17('0x4'));var router=express[_0x3c17('0x5')]();var fs_extra=require(_0x3c17('0x6'));var auth=require(_0x3c17('0x7'));var interaction=require(_0x3c17('0x8'));var config=require('../../config/environment');var controller=require(_0x3c17('0x9'));router[_0x3c17('0xa')]('/',auth[_0x3c17('0xb')](),controller[_0x3c17('0xc')]);router[_0x3c17('0xa')]('/describe',auth[_0x3c17('0xb')](),controller[_0x3c17('0xd')]);router[_0x3c17('0xa')](_0x3c17('0xe'),auth[_0x3c17('0xb')](),controller[_0x3c17('0xf')]);router[_0x3c17('0x10')]('/',auth['isAuthenticated'](),interaction[_0x3c17('0x11')](_0x3c17('0x12'),_0x3c17('0x13')),controller[_0x3c17('0x14')]);router['post'](_0x3c17('0x15'),controller[_0x3c17('0x16')]);router[_0x3c17('0x17')](_0x3c17('0xe'),auth['isAuthenticated'](),controller[_0x3c17('0x18')]);router[_0x3c17('0x17')]('/:id/accept',auth[_0x3c17('0xb')](),controller[_0x3c17('0x19')]);router[_0x3c17('0x17')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3c17('0x1a')]);router[_0x3c17('0x1b')](_0x3c17('0xe'),auth[_0x3c17('0xb')](),controller['destroy']);module[_0x3c17('0x1c')]=router; \ No newline at end of file +var _0x4aaf=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x3bea54,_0x581f54){var _0x13cc53=function(_0x2a6938){while(--_0x2a6938){_0x3bea54['push'](_0x3bea54['shift']());}};_0x13cc53(++_0x581f54);}(_0x4aaf,0x145));var _0xf4aa=function(_0x2980ea,_0x5ebb26){_0x2980ea=_0x2980ea-0x0;var _0x142815=_0x4aaf[_0x2980ea];return _0x142815;};'use strict';var multer=require(_0xf4aa('0x0'));var util=require(_0xf4aa('0x1'));var path=require('path');var timeout=require(_0xf4aa('0x2'));var express=require(_0xf4aa('0x3'));var router=express[_0xf4aa('0x4')]();var fs_extra=require(_0xf4aa('0x5'));var auth=require(_0xf4aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf4aa('0x7'));var controller=require('./whatsappMessage.controller');router[_0xf4aa('0x8')]('/',auth[_0xf4aa('0x9')](),controller['index']);router[_0xf4aa('0x8')](_0xf4aa('0xa'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0xb')]);router[_0xf4aa('0x8')](_0xf4aa('0xc'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0xd')]);router[_0xf4aa('0xe')]('/',auth[_0xf4aa('0x9')](),interaction[_0xf4aa('0xf')]('whatsapp',_0xf4aa('0x10')),controller['create']);router[_0xf4aa('0xe')](_0xf4aa('0x11'),controller['status']);router[_0xf4aa('0x12')]('/:id',auth[_0xf4aa('0x9')](),controller[_0xf4aa('0x13')]);router[_0xf4aa('0x12')](_0xf4aa('0x14'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0x15')]);router[_0xf4aa('0x12')](_0xf4aa('0x16'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0x17')]);router[_0xf4aa('0x18')](_0xf4aa('0xc'),auth[_0xf4aa('0x9')](),controller[_0xf4aa('0x19')]);module[_0xf4aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8ca925a..d381350 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 _0xdf3b=['DATE','TEXT','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3c8355,_0x32e9ff){var _0x135f7e=function(_0x11802d){while(--_0x11802d){_0x3c8355['push'](_0x3c8355['shift']());}};_0x135f7e(++_0x32e9ff);}(_0xdf3b,0x172));var _0xbdf3=function(_0x25483f,_0x43852f){_0x25483f=_0x25483f-0x0;var _0x220d13=_0xdf3b[_0x25483f];return _0x220d13;};'use strict';var Sequelize=require('sequelize');module[_0xbdf3('0x0')]={'body':{'type':Sequelize['TEXT'](_0xbdf3('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xbdf3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbdf3('0x3')]('in',_0xbdf3('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbdf3('0x5')](0xbe)},'phone':{'type':Sequelize[_0xbdf3('0x5')]},'readAt':{'type':Sequelize[_0xbdf3('0x6')]},'secret':{'type':Sequelize[_0xbdf3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbdf3('0x5')]},'providerResponse':{'type':Sequelize[_0xbdf3('0x7')]}}; \ No newline at end of file +var _0x0a51=['STRING','DATE','TEXT','medium','ENUM','out'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0a51,0x158));var _0x10a5=function(_0x3e13f7,_0x199ab5){_0x3e13f7=_0x3e13f7-0x0;var _0x154230=_0x0a51[_0x3e13f7];return _0x154230;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x10a5('0x0')](_0x10a5('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x10a5('0x2')]('in',_0x10a5('0x3')),'defaultValue':_0x10a5('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x10a5('0x4')](0xbe)},'phone':{'type':Sequelize[_0x10a5('0x4')]},'readAt':{'type':Sequelize[_0x10a5('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 375600c..979b9f2 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 _0x6e79=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','internal','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','stack','index','map','rawAttributes','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','WhatsappMessage','findAll','rows','show','create','body','find','params','destroy','describe','accept','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt'];(function(_0x486aa7,_0x53f341){var _0x30133c=function(_0x2eff80){while(--_0x2eff80){_0x486aa7['push'](_0x486aa7['shift']());}};_0x30133c(++_0x53f341);}(_0x6e79,0x13c));var _0x96e7=function(_0x2c0bee,_0x2e4333){_0x2c0bee=_0x2c0bee-0x0;var _0xb91411=_0x6e79[_0x2c0bee];return _0xb91411;};'use strict';var emlformat=require(_0x96e7('0x0'));var rimraf=require(_0x96e7('0x1'));var zipdir=require(_0x96e7('0x2'));var jsonpatch=require(_0x96e7('0x3'));var rp=require(_0x96e7('0x4'));var moment=require(_0x96e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x96e7('0x6'));var util=require(_0x96e7('0x7'));var path=require(_0x96e7('0x8'));var sox=require('sox');var csv=require(_0x96e7('0x9'));var ejs=require(_0x96e7('0xa'));var fs=require('fs');var fs_extra=require(_0x96e7('0xb'));var _=require(_0x96e7('0xc'));var squel=require('squel');var crypto=require(_0x96e7('0xd'));var jsforce=require(_0x96e7('0xe'));var deskjs=require(_0x96e7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96e7('0x10'));var Papa=require(_0x96e7('0x11'));var Redis=require('ioredis');var authService=require(_0x96e7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x96e7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96e7('0x14'))(_0x96e7('0x15'));var utils=require(_0x96e7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x96e7('0x17'));var db=require(_0x96e7('0x18'))['db'];config[_0x96e7('0x19')]=_['defaults'](config[_0x96e7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96e7('0x1a'))(new Redis(config[_0x96e7('0x19')]));require(_0x96e7('0x1b'))[_0x96e7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x96e7('0x1d')][_0x96e7('0x1e')]({'port':0x232c});var client9002=jayson[_0x96e7('0x1d')][_0x96e7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x17cd5a,_0x1253a2,_0x1e016f,_0x37a484){return new BPromise(function(_0x53ace2,_0x543fc5){var _0x1694f6=_0x37a484||client;return _0x1694f6[_0x96e7('0x1f')](_0x17cd5a,_0x1e016f)[_0x96e7('0x20')](function(_0x296a5f){logger[_0x96e7('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x1253a2,_0x96e7('0x22'));logger['debug'](_0x96e7('0x23'),_0x1253a2,'request\x20sent',JSON[_0x96e7('0x24')](_0x296a5f));if(_0x296a5f['error']){if(_0x296a5f[_0x96e7('0x25')][_0x96e7('0x26')]===0x1f4){logger[_0x96e7('0x25')](_0x96e7('0x27'),_0x1253a2,_0x296a5f[_0x96e7('0x25')][_0x96e7('0x28')]);return _0x543fc5(_0x296a5f[_0x96e7('0x25')][_0x96e7('0x28')]);}logger['error'](_0x96e7('0x27'),_0x1253a2,_0x296a5f[_0x96e7('0x25')][_0x96e7('0x28')]);return _0x53ace2(_0x296a5f[_0x96e7('0x25')][_0x96e7('0x28')]);}else{logger['info'](_0x96e7('0x27'),_0x1253a2,_0x96e7('0x22'));_0x53ace2(_0x296a5f['result'][_0x96e7('0x28')]);}})[_0x96e7('0x29')](function(_0x200fa2){logger[_0x96e7('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x1253a2,_0x200fa2);_0x543fc5(_0x200fa2);});});}function respondWithStatusCode(_0x3a5100,_0x3a74d1){_0x3a74d1=_0x3a74d1||0xcc;return function(_0xc10614){if(_0xc10614){return _0x3a5100[_0x96e7('0x2a')](_0x3a74d1);}return _0x3a5100['status'](_0x3a74d1)[_0x96e7('0x2b')]();};}function respondWithResult(_0x2c05c1,_0x47d76c){_0x47d76c=_0x47d76c||0xc8;return function(_0x2c09aa){if(_0x2c09aa){return _0x2c05c1[_0x96e7('0x2c')](_0x47d76c)[_0x96e7('0x2d')](_0x2c09aa);}};}function respondWithFilteredResult(_0x15549a,_0x1f8eb8){return function(_0x4425ff){if(_0x4425ff){var _0x25c7eb=typeof _0x1f8eb8['offset']===_0x96e7('0x2e')&&typeof _0x1f8eb8['limit']===_0x96e7('0x2e');var _0x45a398=_0x4425ff[_0x96e7('0x2f')];var _0x4d4345=_0x25c7eb?0x0:_0x1f8eb8[_0x96e7('0x30')];var _0x4cef3a=_0x25c7eb?_0x4425ff[_0x96e7('0x2f')]:_0x1f8eb8[_0x96e7('0x30')]+_0x1f8eb8[_0x96e7('0x31')];var _0x105451;if(_0x4cef3a>=_0x45a398){_0x4cef3a=_0x45a398;_0x105451=0xc8;}else{_0x105451=0xce;}_0x15549a[_0x96e7('0x2c')](_0x105451);return _0x15549a[_0x96e7('0x32')](_0x96e7('0x33'),_0x4d4345+'-'+_0x4cef3a+'/'+_0x45a398)['json'](_0x4425ff);}return null;};}function patchUpdates(_0x3ec65c){return function(_0x5e9f41){try{jsonpatch[_0x96e7('0x34')](_0x5e9f41,_0x3ec65c,!![]);}catch(_0x5bcc27){return BPromise['reject'](_0x5bcc27);}return _0x5e9f41[_0x96e7('0x35')]();};}function saveUpdates(_0x115e32,_0x3d7ffa){return function(_0xad2de2){if(_0xad2de2){return _0xad2de2[_0x96e7('0x36')](_0x115e32)[_0x96e7('0x20')](function(_0xbf2655){return _0xbf2655;});}return null;};}function removeEntity(_0x42ab75,_0xe461a4){return function(_0x342687){if(_0x342687){return _0x342687['destroy']()[_0x96e7('0x20')](function(){_0x42ab75['status'](0xcc)[_0x96e7('0x2b')]();});}};}function handleEntityNotFound(_0xe48269,_0x5e3ea9){return function(_0x46689a){if(!_0x46689a){_0xe48269['sendStatus'](0x194);}return _0x46689a;};}function handleError(_0x20c1e2,_0x57c786){_0x57c786=_0x57c786||0x1f4;return function(_0x44bd4c){logger['error'](_0x44bd4c[_0x96e7('0x37')]);if(_0x44bd4c['name']){delete _0x44bd4c['name'];}_0x20c1e2[_0x96e7('0x2c')](_0x57c786)['send'](_0x44bd4c);};}exports[_0x96e7('0x38')]=function(_0x5c9815,_0x2894be){var _0x4b1e47={},_0x5b53dc={},_0x61e6f3={'count':0x0,'rows':[]};var _0x59c872=_[_0x96e7('0x39')](db['WhatsappMessage'][_0x96e7('0x3a')],function(_0xdde7d0){return{'name':_0xdde7d0['fieldName'],'type':_0xdde7d0[_0x96e7('0x3b')][_0x96e7('0x3c')]};});_0x5b53dc['model']=_['map'](_0x59c872,_0x96e7('0x3d'));_0x5b53dc[_0x96e7('0x3e')]=_[_0x96e7('0x3f')](_0x5c9815[_0x96e7('0x3e')]);_0x5b53dc['filters']=_[_0x96e7('0x40')](_0x5b53dc[_0x96e7('0x41')],_0x5b53dc[_0x96e7('0x3e')]);_0x4b1e47[_0x96e7('0x42')]=_[_0x96e7('0x40')](_0x5b53dc['model'],qs['fields'](_0x5c9815[_0x96e7('0x3e')][_0x96e7('0x43')]));_0x4b1e47[_0x96e7('0x42')]=_0x4b1e47[_0x96e7('0x42')][_0x96e7('0x44')]?_0x4b1e47[_0x96e7('0x42')]:_0x5b53dc[_0x96e7('0x41')];if(!_0x5c9815[_0x96e7('0x3e')][_0x96e7('0x45')](_0x96e7('0x46'))){_0x4b1e47[_0x96e7('0x31')]=qs[_0x96e7('0x31')](_0x5c9815[_0x96e7('0x3e')]['limit']);_0x4b1e47[_0x96e7('0x30')]=qs['offset'](_0x5c9815[_0x96e7('0x3e')][_0x96e7('0x30')]);}_0x4b1e47[_0x96e7('0x47')]=qs[_0x96e7('0x48')](_0x5c9815['query'][_0x96e7('0x48')]);_0x4b1e47[_0x96e7('0x49')]=qs[_0x96e7('0x4a')](_[_0x96e7('0x4b')](_0x5c9815[_0x96e7('0x3e')],_0x5b53dc['filters']),_0x59c872);if(_0x5c9815[_0x96e7('0x3e')]['filter']){_0x4b1e47[_0x96e7('0x49')]=_[_0x96e7('0x4c')](_0x4b1e47[_0x96e7('0x49')],{'$or':_['map'](_0x59c872,function(_0xf21803){if(_0xf21803[_0x96e7('0x3b')]!==_0x96e7('0x4d')){var _0x20c2e3={};_0x20c2e3[_0xf21803[_0x96e7('0x3d')]]={'$like':'%'+_0x5c9815['query'][_0x96e7('0x4e')]+'%'};return _0x20c2e3;}})});}_0x4b1e47=_[_0x96e7('0x4c')]({},_0x4b1e47,_0x5c9815['options']);var _0x2cae6b={'where':_0x4b1e47[_0x96e7('0x49')]};return db['WhatsappMessage']['count'](_0x2cae6b)[_0x96e7('0x20')](function(_0x5350e7){_0x61e6f3[_0x96e7('0x2f')]=_0x5350e7;if(_0x5c9815[_0x96e7('0x3e')][_0x96e7('0x4f')]){_0x4b1e47[_0x96e7('0x50')]=[{'all':!![]}];}return db[_0x96e7('0x51')][_0x96e7('0x52')](_0x4b1e47);})[_0x96e7('0x20')](function(_0x39f469){_0x61e6f3[_0x96e7('0x53')]=_0x39f469;return _0x61e6f3;})['then'](respondWithFilteredResult(_0x2894be,_0x4b1e47))['catch'](handleError(_0x2894be,null));};exports[_0x96e7('0x54')]=function(_0x24cc89,_0x2f957a){var _0x233de2={'raw':!![],'where':{'id':_0x24cc89['params']['id']}},_0x18b215={};_0x18b215[_0x96e7('0x41')]=_[_0x96e7('0x3f')](db['WhatsappMessage']['rawAttributes']);_0x18b215[_0x96e7('0x3e')]=_['keys'](_0x24cc89[_0x96e7('0x3e')]);_0x18b215[_0x96e7('0x4a')]=_[_0x96e7('0x40')](_0x18b215['model'],_0x18b215[_0x96e7('0x3e')]);_0x233de2[_0x96e7('0x42')]=_[_0x96e7('0x40')](_0x18b215[_0x96e7('0x41')],qs[_0x96e7('0x43')](_0x24cc89['query'][_0x96e7('0x43')]));_0x233de2[_0x96e7('0x42')]=_0x233de2['attributes'][_0x96e7('0x44')]?_0x233de2[_0x96e7('0x42')]:_0x18b215[_0x96e7('0x41')];if(_0x24cc89['query'][_0x96e7('0x4f')]){_0x233de2[_0x96e7('0x50')]=[{'all':!![]}];}_0x233de2=_['merge']({},_0x233de2,_0x24cc89['options']);return db[_0x96e7('0x51')]['find'](_0x233de2)[_0x96e7('0x20')](handleEntityNotFound(_0x2f957a,null))[_0x96e7('0x20')](respondWithResult(_0x2f957a,null))[_0x96e7('0x29')](handleError(_0x2f957a,null));};exports[_0x96e7('0x55')]=function(_0x1ea62e,_0x335bab){return db[_0x96e7('0x51')][_0x96e7('0x55')](_0x1ea62e[_0x96e7('0x56')],{})[_0x96e7('0x20')](respondWithResult(_0x335bab,0xc9))[_0x96e7('0x29')](handleError(_0x335bab,null));};exports[_0x96e7('0x36')]=function(_0x17fcd2,_0x2ca109){if(_0x17fcd2[_0x96e7('0x56')]['id']){delete _0x17fcd2[_0x96e7('0x56')]['id'];}return db['WhatsappMessage'][_0x96e7('0x57')]({'where':{'id':_0x17fcd2[_0x96e7('0x58')]['id']}})[_0x96e7('0x20')](handleEntityNotFound(_0x2ca109,null))[_0x96e7('0x20')](saveUpdates(_0x17fcd2['body'],null))['then'](respondWithResult(_0x2ca109,null))[_0x96e7('0x29')](handleError(_0x2ca109,null));};exports[_0x96e7('0x59')]=function(_0x1a9f1d,_0x416954){return db[_0x96e7('0x51')][_0x96e7('0x57')]({'where':{'id':_0x1a9f1d[_0x96e7('0x58')]['id']}})[_0x96e7('0x20')](handleEntityNotFound(_0x416954,null))[_0x96e7('0x20')](removeEntity(_0x416954,null))[_0x96e7('0x29')](handleError(_0x416954,null));};exports[_0x96e7('0x5a')]=function(_0x45ec13,_0x1abb49){return db['WhatsappMessage'][_0x96e7('0x5a')]()[_0x96e7('0x20')](respondWithResult(_0x1abb49,null))[_0x96e7('0x29')](handleError(_0x1abb49,null));};var interaction_log=require(_0x96e7('0x14'))('whatsapp-interactions');exports[_0x96e7('0x5b')]=function(_0x25d096,_0x2fb837,_0x5a15c2){var _0x39aa1c={'agent':{},'channel':'whatsapp'};if(_0x25d096[_0x96e7('0x56')]['id']){delete _0x25d096[_0x96e7('0x56')]['id'];}_0x25d096[_0x96e7('0x56')][_0x96e7('0x5c')]=!![];_0x25d096['body']['readAt']=moment()[_0x96e7('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x25d096[_0x96e7('0x56')][_0x96e7('0x5e')]=_0x25d096[_0x96e7('0x56')]['UserId']||_0x25d096[_0x96e7('0x5f')]['id'];_0x39aa1c[_0x96e7('0x60')]['id']=_0x25d096[_0x96e7('0x56')][_0x96e7('0x5e')];return db[_0x96e7('0x51')][_0x96e7('0x57')]({'where':{'id':_0x25d096['params']['id'],'UserId':null}})[_0x96e7('0x20')](handleEntityNotFound(_0x2fb837,null))['then'](saveUpdates(_0x25d096[_0x96e7('0x56')],null))[_0x96e7('0x20')](function(_0x8f40a0){if(_0x8f40a0){_0x39aa1c[_0x96e7('0x28')]=_0x8f40a0[_0x96e7('0x61')]({'plain':!![]});return db[_0x96e7('0x62')][_0x96e7('0x57')]({'where':{'id':_0x8f40a0[_0x96e7('0x63')]}});}return null;})[_0x96e7('0x20')](handleEntityNotFound(_0x2fb837,null))[_0x96e7('0x20')](function(_0x54622b){if(_0x54622b){return _0x54622b[_0x96e7('0x36')]({'UserId':_0x25d096['body'][_0x96e7('0x5e')],'read1stAt':_['isNil'](_0x54622b[_0x96e7('0x64')])?moment()[_0x96e7('0x5d')](_0x96e7('0x65')):undefined});}return null;})[_0x96e7('0x20')](function(_0xd77c11){if(_0xd77c11){_0x39aa1c['interaction']=_0xd77c11[_0x96e7('0x61')]({'plain':!![]});interaction_log[_0x96e7('0x21')](_0x96e7('0x66'),_0x25d096['user']['id'],_0x25d096['user'][_0x96e7('0x3d')],_0x25d096[_0x96e7('0x5f')][_0x96e7('0x67')],_0x39aa1c[_0x96e7('0x68')]['id'],_0x25d096['body']?JSON['stringify'](_0x25d096[_0x96e7('0x56')]):_0x96e7('0x69'));return respondWithRpcPromise(_0x96e7('0x6a'),_0x96e7('0x6b'),_0x39aa1c);}return null;})[_0x96e7('0x20')](function(_0x449f06){var _0x4b5b4b=_0x96e7('0x6c')+_0x449f06['message'][_0x96e7('0x6d')];return db[_0x96e7('0x6e')]['query'](_0x4b5b4b,{'type':db[_0x96e7('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x12b5aa){return _0x12b5aa;});})[_0x96e7('0x20')](function(_0x3e6eb4){if(_0x3e6eb4){_0x39aa1c[_0x96e7('0x28')][_0x96e7('0x70')]=_0x3e6eb4[0x0];if(!_0x25d096[_0x96e7('0x56')][_0x96e7('0x5e')])return;return db['User'][_0x96e7('0x57')]({'where':{'id':_0x25d096['body'][_0x96e7('0x5e')],'role':'agent'},'attributes':['id',_0x96e7('0x3d'),_0x96e7('0x71'),_0x96e7('0x72'),'internal'],'raw':!![]});}return null;})[_0x96e7('0x20')](function(_0x2d2f1b){if(!_0x2d2f1b)return null;_0x39aa1c[_0x96e7('0x28')][_0x96e7('0x60')]=_0x2d2f1b;return _0x39aa1c;})[_0x96e7('0x20')](function(_0x31344b){if(_0x31344b){if(_0x25d096['body'][_0x96e7('0x73')]){_0x39aa1c[_0x96e7('0x28')][_0x96e7('0x74')]=util[_0x96e7('0x5d')]('SIP/%s',_0x25d096[_0x96e7('0x5f')][_0x96e7('0x3d')]);_0x39aa1c['message']['channel']=_0x39aa1c[_0x96e7('0x75')];_0x39aa1c[_0x96e7('0x28')][_0x96e7('0x76')]=_0x39aa1c[_0x96e7('0x75')];_0x39aa1c[_0x96e7('0x28')][_0x96e7('0x77')]=_0x96e7('0x5b');return respondWithRpcPromise(_0x96e7('0x78'),_0x96e7('0x78'),{'event':_0x96e7('0x79'),'message':_0x39aa1c[_0x96e7('0x28')]},client9002)[_0x96e7('0x20')](function(){return _0x39aa1c;});}return _0x39aa1c;}return null;})[_0x96e7('0x20')](respondWithResult(_0x2fb837,null))['catch'](handleError(_0x2fb837,null));};var interaction_log=require(_0x96e7('0x14'))(_0x96e7('0x7a'));exports[_0x96e7('0x7b')]=function(_0x3a168f,_0x2d8dee,_0x54d45e){var _0x4a4a1d={'agent':{},'channel':'whatsapp'};if(_0x3a168f[_0x96e7('0x56')]['id']){delete _0x3a168f[_0x96e7('0x56')]['id'];}_0x3a168f[_0x96e7('0x56')]['UserId']=_0x3a168f[_0x96e7('0x56')]['UserId']||_0x3a168f['user']['id'];_0x4a4a1d['agent']['id']=_0x3a168f[_0x96e7('0x56')]['UserId'];return db[_0x96e7('0x51')][_0x96e7('0x57')]({'where':{'id':_0x3a168f[_0x96e7('0x58')]['id'],'UserId':null}})[_0x96e7('0x20')](handleEntityNotFound(_0x2d8dee,null))['then'](function(_0x13a09b){if(_0x13a09b){_0x4a4a1d['message']=_0x13a09b['get']({'plain':!![]});return db[_0x96e7('0x62')]['find']({'where':{'id':_0x13a09b[_0x96e7('0x63')]}});}return null;})[_0x96e7('0x20')](handleEntityNotFound(_0x2d8dee,null))[_0x96e7('0x20')](function(_0x4e586c){if(_0x4e586c){_0x4a4a1d[_0x96e7('0x68')]=_0x4e586c[_0x96e7('0x61')]({'plain':!![]});interaction_log[_0x96e7('0x21')](_0x96e7('0x7c'),_0x3a168f[_0x96e7('0x5f')]['id'],_0x3a168f['user'][_0x96e7('0x3d')],_0x3a168f['user'][_0x96e7('0x67')],_0x4a4a1d[_0x96e7('0x68')]['id'],_0x3a168f[_0x96e7('0x56')]?JSON[_0x96e7('0x24')](_0x3a168f[_0x96e7('0x56')]):_0x96e7('0x69'));return respondWithRpcPromise('RejectMessage',_0x96e7('0x7d'),_0x4a4a1d);}return null;})[_0x96e7('0x20')](function(_0x4c9505){var _0x54459b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c9505[_0x96e7('0x28')]['ContactId'];return db[_0x96e7('0x6e')][_0x96e7('0x3e')](_0x54459b,{'type':db[_0x96e7('0x6f')][_0x96e7('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0xd2c3ee){return _0xd2c3ee;});})[_0x96e7('0x20')](function(_0x3ed732){if(_0x3ed732){_0x4a4a1d['message'][_0x96e7('0x70')]=_0x3ed732[0x0];if(!_0x3a168f[_0x96e7('0x56')][_0x96e7('0x5e')])return;return db['User'][_0x96e7('0x57')]({'where':{'id':_0x3a168f[_0x96e7('0x56')][_0x96e7('0x5e')],'role':'agent'},'attributes':['id',_0x96e7('0x3d'),_0x96e7('0x71'),_0x96e7('0x72'),_0x96e7('0x7f')],'raw':!![]});}return null;})['then'](function(_0x39cc51){if(!_0x39cc51)return null;_0x4a4a1d[_0x96e7('0x28')][_0x96e7('0x60')]=_0x39cc51;return _0x4a4a1d;})[_0x96e7('0x20')](function(_0x43ca31){if(_0x43ca31){_0x43ca31[_0x96e7('0x28')][_0x96e7('0x74')]=util['format'](_0x96e7('0x80'),_0x3a168f[_0x96e7('0x5f')][_0x96e7('0x3d')]);_0x43ca31['message']['channel']=_0x4a4a1d[_0x96e7('0x75')];_0x43ca31[_0x96e7('0x28')][_0x96e7('0x76')]=_0x4a4a1d[_0x96e7('0x75')];_0x43ca31[_0x96e7('0x28')][_0x96e7('0x77')]=_0x96e7('0x7b');respondWithRpcPromise(_0x96e7('0x78'),_0x96e7('0x78'),{'event':_0x96e7('0x81'),'message':_0x43ca31[_0x96e7('0x28')]},client9002);return _0x4a4a1d;}return null;})[_0x96e7('0x20')](respondWithResult(_0x2d8dee,null))[_0x96e7('0x29')](handleError(_0x2d8dee,null));};exports[_0x96e7('0x2c')]=function(_0x28da69,_0x1f1b08,_0x1bc582){if(_0x28da69[_0x96e7('0x56')]['id']){delete _0x28da69['body']['id'];}var _0x2e6ca7;return db['WhatsappMessage'][_0x96e7('0x57')]({'where':{'id':_0x28da69[_0x96e7('0x58')]['id']}})[_0x96e7('0x20')](handleEntityNotFound(_0x1f1b08,null))[_0x96e7('0x20')](function(_0x5c0b4e){if(_0x5c0b4e){_0x2e6ca7=_0x5c0b4e;return db[_0x96e7('0x82')][_0x96e7('0x57')]({'where':{'id':_0x5c0b4e[_0x96e7('0x83')]}});}})[_0x96e7('0x20')](handleEntityNotFound(_0x1f1b08,null))[_0x96e7('0x20')](function(_0x5b836f){if(_0x5b836f){logger['debug'](_0x96e7('0x84'),_0x96e7('0x2c'),'received\x20delivery\x20report\x20from',_0x5b836f[_0x96e7('0x3b')],util[_0x96e7('0x85')](_0x28da69[_0x96e7('0x56')],{'showHidden':![],'depth':null}));switch(_0x5b836f[_0x96e7('0x3b')]){case _0x96e7('0x86'):if(_0x28da69['body'][_0x96e7('0x87')]&&_0x28da69[_0x96e7('0x56')]['MessageSid']===_0x2e6ca7[_0x96e7('0x88')]&&_0x28da69[_0x96e7('0x56')]['MessageStatus']&&_0x28da69[_0x96e7('0x56')][_0x96e7('0x89')]==='read'){return _0x2e6ca7['update']({'read':!![]});}else{logger[_0x96e7('0x25')](_0x96e7('0x8a'),_0x96e7('0x2c'),_0x96e7('0x86'),util['inspect'](_0x28da69[_0x96e7('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2e6ca7;}})[_0x96e7('0x20')](respondWithResult(_0x1f1b08,null))[_0x96e7('0x29')](handleError(_0x1f1b08,null));}; \ No newline at end of file +var _0x45e2=['undefined','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','keys','find','create','body','describe','whatsapp-interactions','whatsapp','read','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','Sequelize','SELECT','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','fullname','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','catch','sendStatus','status','json','limit'];(function(_0x2ff2cd,_0x13057d){var _0x452fc6=function(_0x51b15c){while(--_0x51b15c){_0x2ff2cd['push'](_0x2ff2cd['shift']());}};_0x452fc6(++_0x13057d);}(_0x45e2,0xe3));var _0x245e=function(_0x12f8f4,_0x5afc59){_0x12f8f4=_0x12f8f4-0x0;var _0xf88f33=_0x45e2[_0x12f8f4];return _0xf88f33;};'use strict';var emlformat=require(_0x245e('0x0'));var rimraf=require(_0x245e('0x1'));var zipdir=require(_0x245e('0x2'));var jsonpatch=require(_0x245e('0x3'));var rp=require(_0x245e('0x4'));var moment=require(_0x245e('0x5'));var BPromise=require(_0x245e('0x6'));var Mustache=require(_0x245e('0x7'));var util=require(_0x245e('0x8'));var path=require(_0x245e('0x9'));var sox=require(_0x245e('0xa'));var csv=require(_0x245e('0xb'));var ejs=require(_0x245e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x245e('0xd'));var crypto=require(_0x245e('0xe'));var jsforce=require(_0x245e('0xf'));var deskjs=require(_0x245e('0x10'));var toCsv=require(_0x245e('0xb'));var querystring=require('querystring');var Papa=require(_0x245e('0x11'));var Redis=require(_0x245e('0x12'));var authService=require(_0x245e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x245e('0x14'));var hardwareService=require(_0x245e('0x15'));var logger=require(_0x245e('0x16'))(_0x245e('0x17'));var utils=require(_0x245e('0x18'));var config=require(_0x245e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x245e('0x1a')]=_['defaults'](config['redis'],{'host':_0x245e('0x1b'),'port':0x18eb});var socket=require(_0x245e('0x1c'))(new Redis(config['redis']));require(_0x245e('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x245e('0x1e')][_0x245e('0x1f')]({'port':0x232c});var client9002=jayson[_0x245e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c2fe0,_0x103a50,_0x5c9740,_0x3a799a){return new BPromise(function(_0x280b05,_0xb8a3c4){var _0x1ddbd8=_0x3a799a||client;return _0x1ddbd8[_0x245e('0x20')](_0x2c2fe0,_0x5c9740)['then'](function(_0x2a1062){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x103a50,_0x245e('0x21'));logger[_0x245e('0x22')](_0x245e('0x23'),_0x103a50,_0x245e('0x21'),JSON[_0x245e('0x24')](_0x2a1062));if(_0x2a1062[_0x245e('0x25')]){if(_0x2a1062[_0x245e('0x25')]['code']===0x1f4){logger[_0x245e('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x103a50,_0x2a1062['error']['message']);return _0xb8a3c4(_0x2a1062['error'][_0x245e('0x26')]);}logger[_0x245e('0x25')](_0x245e('0x27'),_0x103a50,_0x2a1062[_0x245e('0x25')][_0x245e('0x26')]);return _0x280b05(_0x2a1062[_0x245e('0x25')][_0x245e('0x26')]);}else{logger['info'](_0x245e('0x27'),_0x103a50,'request\x20sent');_0x280b05(_0x2a1062['result']['message']);}})[_0x245e('0x28')](function(_0x5409d0){logger[_0x245e('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x103a50,_0x5409d0);_0xb8a3c4(_0x5409d0);});});}function respondWithStatusCode(_0x5171b2,_0x5bdfd1){_0x5bdfd1=_0x5bdfd1||0xcc;return function(_0x367c7e){if(_0x367c7e){return _0x5171b2[_0x245e('0x29')](_0x5bdfd1);}return _0x5171b2['status'](_0x5bdfd1)['end']();};}function respondWithResult(_0xfa5c6a,_0x1a5d2c){_0x1a5d2c=_0x1a5d2c||0xc8;return function(_0x1e97f6){if(_0x1e97f6){return _0xfa5c6a[_0x245e('0x2a')](_0x1a5d2c)[_0x245e('0x2b')](_0x1e97f6);}};}function respondWithFilteredResult(_0x14a972,_0x58b375){return function(_0x3cf996){if(_0x3cf996){var _0x1b8ce1=typeof _0x58b375['offset']==='undefined'&&typeof _0x58b375[_0x245e('0x2c')]===_0x245e('0x2d');var _0xd9db38=_0x3cf996[_0x245e('0x2e')];var _0x5ad43e=_0x1b8ce1?0x0:_0x58b375['offset'];var _0xfd1f3=_0x1b8ce1?_0x3cf996[_0x245e('0x2e')]:_0x58b375[_0x245e('0x2f')]+_0x58b375[_0x245e('0x2c')];var _0x50e188;if(_0xfd1f3>=_0xd9db38){_0xfd1f3=_0xd9db38;_0x50e188=0xc8;}else{_0x50e188=0xce;}_0x14a972[_0x245e('0x2a')](_0x50e188);return _0x14a972[_0x245e('0x30')]('Content-Range',_0x5ad43e+'-'+_0xfd1f3+'/'+_0xd9db38)['json'](_0x3cf996);}return null;};}function patchUpdates(_0x3a0701){return function(_0x5d08c0){try{jsonpatch[_0x245e('0x31')](_0x5d08c0,_0x3a0701,!![]);}catch(_0x172532){return BPromise[_0x245e('0x32')](_0x172532);}return _0x5d08c0[_0x245e('0x33')]();};}function saveUpdates(_0x85cf3a,_0x13eb98){return function(_0x46d81d){if(_0x46d81d){return _0x46d81d[_0x245e('0x34')](_0x85cf3a)[_0x245e('0x35')](function(_0x4b5de4){return _0x4b5de4;});}return null;};}function removeEntity(_0x3a90da,_0x898084){return function(_0x5c758b){if(_0x5c758b){return _0x5c758b[_0x245e('0x36')]()[_0x245e('0x35')](function(){_0x3a90da[_0x245e('0x2a')](0xcc)[_0x245e('0x37')]();});}};}function handleEntityNotFound(_0x3cb66c,_0x4b0412){return function(_0x56c9b8){if(!_0x56c9b8){_0x3cb66c[_0x245e('0x29')](0x194);}return _0x56c9b8;};}function handleError(_0x53fa32,_0x306bc3){_0x306bc3=_0x306bc3||0x1f4;return function(_0x2ebbf0){logger[_0x245e('0x25')](_0x2ebbf0[_0x245e('0x38')]);if(_0x2ebbf0[_0x245e('0x39')]){delete _0x2ebbf0[_0x245e('0x39')];}_0x53fa32['status'](_0x306bc3)[_0x245e('0x3a')](_0x2ebbf0);};}exports['index']=function(_0x3293be,_0x2fb9cd){var _0x1fe1db={},_0xa75092={},_0x233969={'count':0x0,'rows':[]};var _0x3bf6b8=_[_0x245e('0x3b')](db[_0x245e('0x3c')]['rawAttributes'],function(_0x503aad){return{'name':_0x503aad[_0x245e('0x3d')],'type':_0x503aad[_0x245e('0x3e')][_0x245e('0x3f')]};});_0xa75092[_0x245e('0x40')]=_['map'](_0x3bf6b8,'name');_0xa75092[_0x245e('0x41')]=_['keys'](_0x3293be[_0x245e('0x41')]);_0xa75092[_0x245e('0x42')]=_[_0x245e('0x43')](_0xa75092[_0x245e('0x40')],_0xa75092['query']);_0x1fe1db['attributes']=_[_0x245e('0x43')](_0xa75092[_0x245e('0x40')],qs['fields'](_0x3293be[_0x245e('0x41')][_0x245e('0x44')]));_0x1fe1db[_0x245e('0x45')]=_0x1fe1db[_0x245e('0x45')][_0x245e('0x46')]?_0x1fe1db[_0x245e('0x45')]:_0xa75092[_0x245e('0x40')];if(!_0x3293be[_0x245e('0x41')][_0x245e('0x47')](_0x245e('0x48'))){_0x1fe1db[_0x245e('0x2c')]=qs['limit'](_0x3293be[_0x245e('0x41')][_0x245e('0x2c')]);_0x1fe1db['offset']=qs[_0x245e('0x2f')](_0x3293be['query']['offset']);}_0x1fe1db['order']=qs['sort'](_0x3293be[_0x245e('0x41')][_0x245e('0x49')]);_0x1fe1db['where']=qs[_0x245e('0x42')](_[_0x245e('0x4a')](_0x3293be[_0x245e('0x41')],_0xa75092[_0x245e('0x42')]),_0x3bf6b8);if(_0x3293be[_0x245e('0x41')][_0x245e('0x4b')]){_0x1fe1db[_0x245e('0x4c')]=_[_0x245e('0x4d')](_0x1fe1db[_0x245e('0x4c')],{'$or':_['map'](_0x3bf6b8,function(_0x2d85d3){if(_0x2d85d3[_0x245e('0x3e')]!==_0x245e('0x4e')){var _0x495607={};_0x495607[_0x2d85d3['name']]={'$like':'%'+_0x3293be[_0x245e('0x41')]['filter']+'%'};return _0x495607;}})});}_0x1fe1db=_['merge']({},_0x1fe1db,_0x3293be['options']);var _0x5a19a1={'where':_0x1fe1db[_0x245e('0x4c')]};return db[_0x245e('0x3c')][_0x245e('0x2e')](_0x5a19a1)['then'](function(_0x3f75c9){_0x233969['count']=_0x3f75c9;if(_0x3293be['query'][_0x245e('0x4f')]){_0x1fe1db[_0x245e('0x50')]=[{'all':!![]}];}return db[_0x245e('0x3c')][_0x245e('0x51')](_0x1fe1db);})[_0x245e('0x35')](function(_0x6782a1){_0x233969[_0x245e('0x52')]=_0x6782a1;return _0x233969;})[_0x245e('0x35')](respondWithFilteredResult(_0x2fb9cd,_0x1fe1db))[_0x245e('0x28')](handleError(_0x2fb9cd,null));};exports['show']=function(_0xfd26d2,_0x189353){var _0x14e4c2={'raw':!![],'where':{'id':_0xfd26d2[_0x245e('0x53')]['id']}},_0x57d91e={};_0x57d91e[_0x245e('0x40')]=_['keys'](db['WhatsappMessage'][_0x245e('0x54')]);_0x57d91e[_0x245e('0x41')]=_[_0x245e('0x55')](_0xfd26d2[_0x245e('0x41')]);_0x57d91e[_0x245e('0x42')]=_[_0x245e('0x43')](_0x57d91e[_0x245e('0x40')],_0x57d91e[_0x245e('0x41')]);_0x14e4c2['attributes']=_['intersection'](_0x57d91e['model'],qs[_0x245e('0x44')](_0xfd26d2['query'][_0x245e('0x44')]));_0x14e4c2['attributes']=_0x14e4c2[_0x245e('0x45')]['length']?_0x14e4c2[_0x245e('0x45')]:_0x57d91e[_0x245e('0x40')];if(_0xfd26d2[_0x245e('0x41')]['includeAll']){_0x14e4c2[_0x245e('0x50')]=[{'all':!![]}];}_0x14e4c2=_[_0x245e('0x4d')]({},_0x14e4c2,_0xfd26d2['options']);return db['WhatsappMessage'][_0x245e('0x56')](_0x14e4c2)[_0x245e('0x35')](handleEntityNotFound(_0x189353,null))['then'](respondWithResult(_0x189353,null))[_0x245e('0x28')](handleError(_0x189353,null));};exports[_0x245e('0x57')]=function(_0x2ac9fc,_0x3fdb19){return db[_0x245e('0x3c')][_0x245e('0x57')](_0x2ac9fc[_0x245e('0x58')],{})[_0x245e('0x35')](respondWithResult(_0x3fdb19,0xc9))['catch'](handleError(_0x3fdb19,null));};exports[_0x245e('0x34')]=function(_0x537760,_0x2e8eee){if(_0x537760['body']['id']){delete _0x537760[_0x245e('0x58')]['id'];}return db[_0x245e('0x3c')][_0x245e('0x56')]({'where':{'id':_0x537760['params']['id']}})['then'](handleEntityNotFound(_0x2e8eee,null))[_0x245e('0x35')](saveUpdates(_0x537760[_0x245e('0x58')],null))[_0x245e('0x35')](respondWithResult(_0x2e8eee,null))['catch'](handleError(_0x2e8eee,null));};exports[_0x245e('0x36')]=function(_0x3d00d3,_0x153fc2){return db[_0x245e('0x3c')][_0x245e('0x56')]({'where':{'id':_0x3d00d3[_0x245e('0x53')]['id']}})[_0x245e('0x35')](handleEntityNotFound(_0x153fc2,null))['then'](removeEntity(_0x153fc2,null))['catch'](handleError(_0x153fc2,null));};exports[_0x245e('0x59')]=function(_0x40a2dd,_0x2c4f4b){return db[_0x245e('0x3c')]['describe']()[_0x245e('0x35')](respondWithResult(_0x2c4f4b,null))[_0x245e('0x28')](handleError(_0x2c4f4b,null));};var interaction_log=require('../../config/logger')(_0x245e('0x5a'));exports['accept']=function(_0x3c2554,_0x49e4a6,_0x4fc4da){var _0x32c26e={'agent':{},'channel':_0x245e('0x5b')};if(_0x3c2554[_0x245e('0x58')]['id']){delete _0x3c2554[_0x245e('0x58')]['id'];}_0x3c2554[_0x245e('0x58')][_0x245e('0x5c')]=!![];_0x3c2554[_0x245e('0x58')]['readAt']=moment()[_0x245e('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c2554['body'][_0x245e('0x5e')]=_0x3c2554['body'][_0x245e('0x5e')]||_0x3c2554[_0x245e('0x5f')]['id'];_0x32c26e[_0x245e('0x60')]['id']=_0x3c2554[_0x245e('0x58')]['UserId'];return db[_0x245e('0x3c')][_0x245e('0x56')]({'where':{'id':_0x3c2554[_0x245e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49e4a6,null))[_0x245e('0x35')](saveUpdates(_0x3c2554[_0x245e('0x58')],null))['then'](function(_0x22af03){if(_0x22af03){_0x32c26e[_0x245e('0x26')]=_0x22af03[_0x245e('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x245e('0x56')]({'where':{'id':_0x22af03[_0x245e('0x62')]}});}return null;})[_0x245e('0x35')](handleEntityNotFound(_0x49e4a6,null))[_0x245e('0x35')](function(_0x4a90ef){if(_0x4a90ef){return _0x4a90ef[_0x245e('0x34')]({'UserId':_0x3c2554[_0x245e('0x58')]['UserId'],'read1stAt':_[_0x245e('0x63')](_0x4a90ef[_0x245e('0x64')])?moment()[_0x245e('0x5d')](_0x245e('0x65')):undefined});}return null;})['then'](function(_0x902b33){if(_0x902b33){_0x32c26e[_0x245e('0x66')]=_0x902b33['get']({'plain':!![]});interaction_log[_0x245e('0x67')](_0x245e('0x68'),_0x3c2554[_0x245e('0x5f')]['id'],_0x3c2554['user'][_0x245e('0x39')],_0x3c2554[_0x245e('0x5f')]['role'],_0x32c26e[_0x245e('0x66')]['id'],_0x3c2554[_0x245e('0x58')]?JSON[_0x245e('0x24')](_0x3c2554[_0x245e('0x58')]):_0x245e('0x69'));return respondWithRpcPromise(_0x245e('0x6a'),_0x245e('0x6b'),_0x32c26e);}return null;})['then'](function(_0x57f04a){var _0x47efab='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57f04a[_0x245e('0x26')][_0x245e('0x6c')];return db['sequelize'][_0x245e('0x41')](_0x47efab,{'type':db[_0x245e('0x6d')]['QueryTypes'][_0x245e('0x6e')],'raw':!![]})[_0x245e('0x35')](function(_0x5ecb20){return _0x5ecb20;});})['then'](function(_0x17ac17){if(_0x17ac17){_0x32c26e[_0x245e('0x26')]['contact']=_0x17ac17[0x0];if(!_0x3c2554['body'][_0x245e('0x5e')])return;return db['User']['find']({'where':{'id':_0x3c2554[_0x245e('0x58')][_0x245e('0x5e')],'role':'agent'},'attributes':['id',_0x245e('0x39'),'fullname','email',_0x245e('0x6f')],'raw':!![]});}return null;})['then'](function(_0x5765b5){if(!_0x5765b5)return null;_0x32c26e[_0x245e('0x26')][_0x245e('0x60')]=_0x5765b5;return _0x32c26e;})[_0x245e('0x35')](function(_0x525225){if(_0x525225){if(_0x3c2554[_0x245e('0x58')][_0x245e('0x70')]){_0x32c26e[_0x245e('0x26')][_0x245e('0x71')]=util[_0x245e('0x5d')](_0x245e('0x72'),_0x3c2554[_0x245e('0x5f')][_0x245e('0x39')]);_0x32c26e[_0x245e('0x26')][_0x245e('0x73')]=_0x32c26e[_0x245e('0x73')];_0x32c26e[_0x245e('0x26')]['motionChannel']=_0x32c26e['channel'];_0x32c26e['message']['event']=_0x245e('0x74');return respondWithRpcPromise(_0x245e('0x75'),'EventManager',{'event':_0x245e('0x76'),'message':_0x32c26e['message']},client9002)[_0x245e('0x35')](function(){return _0x32c26e;});}return _0x32c26e;}return null;})['then'](respondWithResult(_0x49e4a6,null))[_0x245e('0x28')](handleError(_0x49e4a6,null));};var interaction_log=require(_0x245e('0x16'))(_0x245e('0x5a'));exports[_0x245e('0x32')]=function(_0x26ddc1,_0x2034f4,_0xa7b5ef){var _0x373882={'agent':{},'channel':_0x245e('0x5b')};if(_0x26ddc1[_0x245e('0x58')]['id']){delete _0x26ddc1[_0x245e('0x58')]['id'];}_0x26ddc1[_0x245e('0x58')][_0x245e('0x5e')]=_0x26ddc1[_0x245e('0x58')][_0x245e('0x5e')]||_0x26ddc1[_0x245e('0x5f')]['id'];_0x373882[_0x245e('0x60')]['id']=_0x26ddc1[_0x245e('0x58')][_0x245e('0x5e')];return db[_0x245e('0x3c')][_0x245e('0x56')]({'where':{'id':_0x26ddc1[_0x245e('0x53')]['id'],'UserId':null}})[_0x245e('0x35')](handleEntityNotFound(_0x2034f4,null))['then'](function(_0x3a4c08){if(_0x3a4c08){_0x373882[_0x245e('0x26')]=_0x3a4c08[_0x245e('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x245e('0x56')]({'where':{'id':_0x3a4c08[_0x245e('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x2034f4,null))[_0x245e('0x35')](function(_0x2dc264){if(_0x2dc264){_0x373882[_0x245e('0x66')]=_0x2dc264['get']({'plain':!![]});interaction_log[_0x245e('0x67')](_0x245e('0x77'),_0x26ddc1[_0x245e('0x5f')]['id'],_0x26ddc1[_0x245e('0x5f')][_0x245e('0x39')],_0x26ddc1['user'][_0x245e('0x78')],_0x373882[_0x245e('0x66')]['id'],_0x26ddc1[_0x245e('0x58')]?JSON[_0x245e('0x24')](_0x26ddc1[_0x245e('0x58')]):_0x245e('0x69'));return respondWithRpcPromise('RejectMessage',_0x245e('0x79'),_0x373882);}return null;})[_0x245e('0x35')](function(_0x58b3d7){var _0x4e457c=_0x245e('0x7a')+_0x58b3d7[_0x245e('0x26')][_0x245e('0x6c')];return db[_0x245e('0x7b')][_0x245e('0x41')](_0x4e457c,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x245e('0x35')](function(_0x523266){return _0x523266;});})[_0x245e('0x35')](function(_0xc6274a){if(_0xc6274a){_0x373882[_0x245e('0x26')][_0x245e('0x7c')]=_0xc6274a[0x0];if(!_0x26ddc1[_0x245e('0x58')]['UserId'])return;return db['User']['find']({'where':{'id':_0x26ddc1['body'][_0x245e('0x5e')],'role':'agent'},'attributes':['id','name',_0x245e('0x7d'),'email',_0x245e('0x6f')],'raw':!![]});}return null;})['then'](function(_0xd7c846){if(!_0xd7c846)return null;_0x373882[_0x245e('0x26')]['agent']=_0xd7c846;return _0x373882;})['then'](function(_0x4156df){if(_0x4156df){_0x4156df[_0x245e('0x26')][_0x245e('0x71')]=util[_0x245e('0x5d')]('SIP/%s',_0x26ddc1['user'][_0x245e('0x39')]);_0x4156df[_0x245e('0x26')][_0x245e('0x73')]=_0x373882['channel'];_0x4156df[_0x245e('0x26')][_0x245e('0x7e')]=_0x373882[_0x245e('0x73')];_0x4156df['message']['event']=_0x245e('0x32');respondWithRpcPromise(_0x245e('0x75'),_0x245e('0x75'),{'event':_0x245e('0x7f'),'message':_0x4156df[_0x245e('0x26')]},client9002);return _0x373882;}return null;})[_0x245e('0x35')](respondWithResult(_0x2034f4,null))[_0x245e('0x28')](handleError(_0x2034f4,null));};exports[_0x245e('0x2a')]=function(_0x1700ab,_0x7097bb,_0x3d5d20){if(_0x1700ab['body']['id']){delete _0x1700ab[_0x245e('0x58')]['id'];}var _0x55f090;return db['WhatsappMessage'][_0x245e('0x56')]({'where':{'id':_0x1700ab[_0x245e('0x53')]['id']}})[_0x245e('0x35')](handleEntityNotFound(_0x7097bb,null))[_0x245e('0x35')](function(_0x58f5fc){if(_0x58f5fc){_0x55f090=_0x58f5fc;return db['WhatsappAccount'][_0x245e('0x56')]({'where':{'id':_0x58f5fc[_0x245e('0x80')]}});}})[_0x245e('0x35')](handleEntityNotFound(_0x7097bb,null))[_0x245e('0x35')](function(_0x24fea9){if(_0x24fea9){logger[_0x245e('0x22')](_0x245e('0x81'),_0x245e('0x2a'),_0x245e('0x82'),_0x24fea9[_0x245e('0x3e')],util[_0x245e('0x83')](_0x1700ab[_0x245e('0x58')],{'showHidden':![],'depth':null}));switch(_0x24fea9[_0x245e('0x3e')]){case _0x245e('0x84'):if(_0x1700ab[_0x245e('0x58')][_0x245e('0x85')]&&_0x1700ab['body'][_0x245e('0x85')]===_0x55f090['messageId']&&_0x1700ab[_0x245e('0x58')][_0x245e('0x86')]&&_0x1700ab[_0x245e('0x58')][_0x245e('0x86')]===_0x245e('0x5c')){return _0x55f090[_0x245e('0x34')]({'read':!![]});}else{logger[_0x245e('0x25')](_0x245e('0x87'),_0x245e('0x2a'),_0x245e('0x84'),util[_0x245e('0x83')](_0x1700ab[_0x245e('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x55f090;}})[_0x245e('0x35')](respondWithResult(_0x7097bb,null))[_0x245e('0x28')](handleError(_0x7097bb,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3945975..386dc2f 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 _0xaaa2=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x148b06,_0x375597){var _0x222dbf=function(_0x5e8b5d){while(--_0x5e8b5d){_0x148b06['push'](_0x148b06['shift']());}};_0x222dbf(++_0x375597);}(_0xaaa2,0xac));var _0x2aaa=function(_0x4dd42b,_0x238173){_0x4dd42b=_0x4dd42b-0x0;var _0x58b4bb=_0xaaa2[_0x4dd42b];return _0x58b4bb;};'use strict';var EventEmitter=require(_0x2aaa('0x0'));var WhatsappMessage=require(_0x2aaa('0x1'))['db'][_0x2aaa('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2aaa('0x3')](0x0);var events={'afterCreate':_0x2aaa('0x4'),'afterUpdate':_0x2aaa('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfc076){return function(_0x482489,_0x35b5c8,_0x340071){WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076+':'+_0x482489['id'],_0x482489);WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076,_0x482489);_0x340071(null);};}for(var e in events){if(events[_0x2aaa('0x7')](e)){var event=events[e];WhatsappMessage[_0x2aaa('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x52aad2,_0x35c444){var _0x2510af=function(_0x55b391){while(--_0x55b391){_0x52aad2['push'](_0x52aad2['shift']());}};_0x2510af(++_0x35c444);}(_0xb10b,0x12a));var _0xbb10=function(_0x44a518,_0x413a2d){_0x44a518=_0x44a518-0x0;var _0x4a3cdf=_0xb10b[_0x44a518];return _0x4a3cdf;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 43ecdd4..366e77a 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 _0x6108=['messages','create','body','remote','/api/whatsapp/messages/','token','sid','catch','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','node-fetch','path','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','error','out','WhatsappAccount','then','type','twilio','accountSid','authToken','phone'];(function(_0x1ec109,_0x52fb44){var _0x12dc97=function(_0xbfe212){while(--_0xbfe212){_0x1ec109['push'](_0x1ec109['shift']());}};_0x12dc97(++_0x52fb44);}(_0x6108,0xbc));var _0x8610=function(_0x6b322c,_0x2bb0df){_0x6b322c=_0x6b322c-0x0;var _0x363f8b=_0x6108[_0x6b322c];return _0x363f8b;};'use strict';var _=require(_0x8610('0x0'));var util=require('util');var logger=require(_0x8610('0x1'))(_0x8610('0x2'));var moment=require(_0x8610('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x8610('0x4'));var fs=require('fs');var path=require(_0x8610('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8610('0x6'));module[_0x8610('0x7')]=function(_0x28a680,_0x26dab3){return _0x28a680['define'](_0x8610('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x8610('0x9'),'fields':[_0x8610('0x9')]},{'name':_0x8610('0xa'),'fields':['body'],'type':_0x8610('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3682b9,_0x46854f,_0x1eb419){var _0x2a0474=_0x28a680[_0x8610('0xc')];var _0x4b3af2=_0x3682b9[_0x8610('0xd')]({'plain':!![]});if(_0x4b3af2[_0x8610('0xe')][_0x8610('0xf')]()==='in'||_0x4b3af2['direction'][_0x8610('0xf')]()==='out'&&!_0x4b3af2[_0x8610('0x10')]&&!_[_0x8610('0x11')](_0x4b3af2[_0x8610('0x12')])){_0x2a0474[_0x8610('0x13')][_0x8610('0x14')]({'where':{'id':_0x4b3af2['WhatsappInteractionId']}})['then'](function(_0x3ba11a){if(_0x3ba11a){_0x3ba11a[_0x8610('0x15')]({'lastMsgAt':_0x4b3af2[_0x8610('0x16')],'lastMsgDirection':_0x4b3af2['direction']['toLowerCase']()});}})['catch'](function(_0x3d94c2){console[_0x8610('0x17')](_0x3d94c2);});}if(_0x4b3af2[_0x8610('0xe')]===_0x8610('0x18')&&!_0x4b3af2['secret']){var _0x52ac1f;_0x2a0474[_0x8610('0x19')]['find']({'where':{'id':_0x4b3af2['WhatsappAccountId']},'raw':!![]})[_0x8610('0x1a')](function(_0x4c7d56){_0x52ac1f=_0x4c7d56;if(_0x52ac1f&&_0x52ac1f['type']){switch(_0x52ac1f[_0x8610('0x1b')]){case _0x8610('0x1c'):var _0x5a4b44=require(_0x8610('0x1c'));if(_0x52ac1f[_0x8610('0x1d')]&&_0x52ac1f[_0x8610('0x1e')]&&_0x52ac1f[_0x8610('0x1f')]){var _0x15c240=new _0x5a4b44(_0x52ac1f[_0x8610('0x1d')],_0x52ac1f[_0x8610('0x1e')]);_0x15c240[_0x8610('0x20')][_0x8610('0x21')]({'body':_0x4b3af2[_0x8610('0x22')],'to':'whatsapp:'+_0x4b3af2[_0x8610('0x1f')],'from':'whatsapp:'+_0x52ac1f[_0x8610('0x1f')],'statusCallback':_0x52ac1f[_0x8610('0x23')]+_0x8610('0x24')+_0x4b3af2['id']+'/status?token='+_0x52ac1f[_0x8610('0x25')]})['then'](function(_0x585269){if(_0x585269['sid']){return _0x3682b9['update']({'messageId':_0x585269[_0x8610('0x26')]});}})[_0x8610('0x27')](function(_0x5250dd){logger[_0x8610('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8610('0x28'),_0x8610('0x1c'),util['inspect'](_0x5250dd,{'showHidden':![],'depth':null}));});}else{logger[_0x8610('0x17')](_0x8610('0x29'),_0x8610('0x28'),_0x8610('0x1c'),_0x8610('0x2a'));}break;case _0x8610('0x2b'):var _0x4e4c16=_0x52ac1f[_0x8610('0x1d')];var _0x2ccf6d=_0x52ac1f[_0x8610('0x1e')];var _0x558b62=_0x52ac1f[_0x8610('0x2c')]+'/whatsapp/v1/'+_0x4e4c16+_0x8610('0x2d');var _0x5c67f6={'to':[_0x4b3af2['phone']],'message':{'type':_0x8610('0x2e'),'text':_0x4b3af2[_0x8610('0x22')]}};var _0x1de93c={'method':'POST','uri':_0x558b62,'headers':{'Authorization':'Bearer\x20'+_0x2ccf6d,'Content-Type':_0x8610('0x2f')},'body':_0x5c67f6,'json':!![]};rp(_0x1de93c)[_0x8610('0x1a')](function(_0x1c4160){if(_0x1c4160[_0x8610('0x30')][0x0][_0x8610('0x31')]){return _0x3682b9[_0x8610('0x15')]({'messageId':_0x1c4160['statuses'][0x0][_0x8610('0x31')]});}})[_0x8610('0x27')](function(_0x1bdfcd){logger[_0x8610('0x32')](_0x8610('0x33'),_0x1bdfcd);});break;}}})[_0x8610('0x34')](function(){_0x1eb419();});}else{_0x1eb419();}}},'charset':_0x8610('0x35'),'collate':_0x8610('0x36')});}; \ No newline at end of file +var _0xe59a=['rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','toLowerCase','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','node-fetch','path'];(function(_0x5679d7,_0x564b0b){var _0x1b1edf=function(_0x55a68e){while(--_0x55a68e){_0x5679d7['push'](_0x5679d7['shift']());}};_0x1b1edf(++_0x564b0b);}(_0xe59a,0x19f));var _0xae59=function(_0x132be3,_0x375b4c){_0x132be3=_0x132be3-0x0;var _0x535bf0=_0xe59a[_0x132be3];return _0x535bf0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae59('0x0'))('api');var moment=require(_0xae59('0x1'));var BPromise=require(_0xae59('0x2'));var rp=require('request-promise');var fetch=require(_0xae59('0x3'));var fs=require('fs');var path=require(_0xae59('0x4'));var rimraf=require(_0xae59('0x5'));var config=require('../../config/environment');var attributes=require(_0xae59('0x6'));module[_0xae59('0x7')]=function(_0x5a763c,_0x16b4d3){return _0x5a763c[_0xae59('0x8')](_0xae59('0x9'),attributes,{'tableName':_0xae59('0xa'),'paranoid':![],'indexes':[{'name':_0xae59('0xb'),'fields':[_0xae59('0xb')]},{'name':_0xae59('0xc'),'fields':[_0xae59('0xd')],'type':_0xae59('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x153d37,_0x1bdcdd,_0x4f70bc){var _0x3f102d=_0x5a763c[_0xae59('0xf')];var _0x555051=_0x153d37[_0xae59('0x10')]({'plain':!![]});if(_0x555051[_0xae59('0x11')]['toLowerCase']()==='in'||_0x555051[_0xae59('0x11')]['toLowerCase']()===_0xae59('0x12')&&!_0x555051[_0xae59('0x13')]&&!_[_0xae59('0x14')](_0x555051[_0xae59('0x15')])){_0x3f102d[_0xae59('0x16')]['findOne']({'where':{'id':_0x555051[_0xae59('0x17')]}})[_0xae59('0x18')](function(_0x56a9cf){if(_0x56a9cf){_0x56a9cf[_0xae59('0x19')]({'lastMsgAt':_0x555051[_0xae59('0x1a')],'lastMsgDirection':_0x555051[_0xae59('0x11')][_0xae59('0x1b')]()});}})['catch'](function(_0x47d684){console[_0xae59('0x1c')](_0x47d684);});}if(_0x555051[_0xae59('0x11')]===_0xae59('0x12')&&!_0x555051[_0xae59('0x13')]){var _0x2652cc;_0x3f102d['WhatsappAccount'][_0xae59('0x1d')]({'where':{'id':_0x555051[_0xae59('0x1e')]},'raw':!![]})[_0xae59('0x18')](function(_0x6d4967){_0x2652cc=_0x6d4967;if(_0x2652cc&&_0x2652cc[_0xae59('0x1f')]){switch(_0x2652cc[_0xae59('0x1f')]){case _0xae59('0x20'):var _0x553a49=require(_0xae59('0x20'));if(_0x2652cc[_0xae59('0x21')]&&_0x2652cc[_0xae59('0x22')]&&_0x2652cc['phone']){var _0x401e8d=new _0x553a49(_0x2652cc[_0xae59('0x21')],_0x2652cc[_0xae59('0x22')]);_0x401e8d['messages'][_0xae59('0x23')]({'body':_0x555051[_0xae59('0xd')],'to':_0xae59('0x24')+_0x555051[_0xae59('0x25')],'from':_0xae59('0x24')+_0x2652cc[_0xae59('0x25')],'statusCallback':_0x2652cc[_0xae59('0x26')]+_0xae59('0x27')+_0x555051['id']+_0xae59('0x28')+_0x2652cc[_0xae59('0x29')]})[_0xae59('0x18')](function(_0xcfb97a){if(_0xcfb97a['sid']){return _0x153d37[_0xae59('0x19')]({'messageId':_0xcfb97a[_0xae59('0x2a')]});}})[_0xae59('0x2b')](function(_0x438ba2){logger[_0xae59('0x1c')](_0xae59('0x2c'),'afterCreate',_0xae59('0x20'),util[_0xae59('0x2d')](_0x438ba2,{'showHidden':![],'depth':null}));});}else{logger[_0xae59('0x1c')](_0xae59('0x2c'),'afterCreate',_0xae59('0x20'),_0xae59('0x2e'));}break;case _0xae59('0x2f'):var _0x3127cb=_0x2652cc[_0xae59('0x21')];var _0x32d78b=_0x2652cc[_0xae59('0x22')];var _0x270253=_0x2652cc[_0xae59('0x30')]+_0xae59('0x31')+_0x3127cb+_0xae59('0x32');var _0x44e4cc={'to':[_0x555051[_0xae59('0x25')]],'message':{'type':'text','text':_0x555051[_0xae59('0xd')]}};var _0x252cad={'method':_0xae59('0x33'),'uri':_0x270253,'headers':{'Authorization':_0xae59('0x34')+_0x32d78b,'Content-Type':_0xae59('0x35')},'body':_0x44e4cc,'json':!![]};rp(_0x252cad)[_0xae59('0x18')](function(_0x74aa83){if(_0x74aa83[_0xae59('0x36')][0x0][_0xae59('0x37')]){return _0x153d37[_0xae59('0x19')]({'messageId':_0x74aa83['statuses'][0x0]['message_id']});}})[_0xae59('0x2b')](function(_0x230ffb){logger[_0xae59('0x38')]('WhatsappMessage,\x20%s',_0x230ffb);});break;}}})[_0xae59('0x39')](function(){_0x4f70bc();});}else{_0x4f70bc();}}},'charset':_0xae59('0x3a'),'collate':_0xae59('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 82ae258..14eb95a 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 _0xf5f7=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','catch'];(function(_0x5c4786,_0x1c96c8){var _0x3b4bf8=function(_0x502324){while(--_0x502324){_0x5c4786['push'](_0x5c4786['shift']());}};_0x3b4bf8(++_0x1c96c8);}(_0xf5f7,0x1aa));var _0x7f5f=function(_0x355f97,_0x4a821e){_0x355f97=_0x355f97-0x0;var _0x1ad545=_0xf5f7[_0x355f97];return _0x1ad545;};'use strict';var _=require(_0x7f5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7f5f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f5f('0x2'));var db=require(_0x7f5f('0x3'))['db'];var utils=require(_0x7f5f('0x4'));var logger=require(_0x7f5f('0x5'))('rpc');var config=require(_0x7f5f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f5f('0x7')]({'port':0x232a});config[_0x7f5f('0x8')]=_[_0x7f5f('0x9')](config[_0x7f5f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f5f('0xa'))(new Redis(config[_0x7f5f('0x8')]));require('./whatsappMessage.socket')[_0x7f5f('0xb')](socket);function respondWithRpcPromise(_0x2abdcd,_0xdc9371,_0x3cd9bd){return new BPromise(function(_0x27e1a7,_0x1a6890){return client[_0x7f5f('0xc')](_0x2abdcd,_0x3cd9bd)[_0x7f5f('0xd')](function(_0x2b26a4){logger[_0x7f5f('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0xdc9371,'request\x20sent');logger[_0x7f5f('0xf')](_0x7f5f('0x10'),_0xdc9371,_0x7f5f('0x11'),JSON[_0x7f5f('0x12')](_0x2b26a4));if(_0x2b26a4[_0x7f5f('0x13')]){if(_0x2b26a4[_0x7f5f('0x13')][_0x7f5f('0x14')]===0x1f4){logger[_0x7f5f('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0xdc9371,_0x2b26a4[_0x7f5f('0x13')][_0x7f5f('0x15')]);return _0x1a6890(_0x2b26a4[_0x7f5f('0x13')]['message']);}logger[_0x7f5f('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0xdc9371,_0x2b26a4[_0x7f5f('0x13')][_0x7f5f('0x15')]);return _0x27e1a7(_0x2b26a4[_0x7f5f('0x13')]['message']);}else{logger[_0x7f5f('0xe')](_0x7f5f('0x16'),_0xdc9371,_0x7f5f('0x11'));_0x27e1a7(_0x2b26a4['result'][_0x7f5f('0x15')]);}})[_0x7f5f('0x17')](function(_0x2b8fc3){logger[_0x7f5f('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0xdc9371,_0x2b8fc3);_0x1a6890(_0x2b8fc3);});});}exports[_0x7f5f('0x18')]=function(_0x2a6d56){var _0x2ba76b=this;return new Promise(function(_0x35dbb3,_0x567b1f){return db[_0x7f5f('0x19')][_0x7f5f('0x1a')](_0x2a6d56[_0x7f5f('0x1b')],{'raw':_0x2a6d56['options']?_0x2a6d56[_0x7f5f('0x1c')][_0x7f5f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4b49f8){logger[_0x7f5f('0xe')](_0x7f5f('0x18'),_0x2a6d56);logger[_0x7f5f('0xf')](_0x7f5f('0x18'),_0x2a6d56,JSON[_0x7f5f('0x12')](_0x4b49f8));_0x35dbb3(_0x4b49f8);})[_0x7f5f('0x17')](function(_0x36f669){logger[_0x7f5f('0x13')](_0x7f5f('0x18'),_0x36f669[_0x7f5f('0x15')],_0x2a6d56);_0x567b1f(_0x2ba76b[_0x7f5f('0x13')](0x1f4,_0x36f669[_0x7f5f('0x15')]));});});}; \ No newline at end of file +var _0x0c3c=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x510673,_0x4dcacd){var _0x492aaf=function(_0x365fba){while(--_0x365fba){_0x510673['push'](_0x510673['shift']());}};_0x492aaf(++_0x4dcacd);}(_0x0c3c,0x197));var _0xc0c3=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x0c3c[_0x648163];return _0x199d4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0c3('0x0'));var BPromise=require(_0xc0c3('0x1'));var rs=require(_0xc0c3('0x2'));var fs=require('fs');var Redis=require(_0xc0c3('0x3'));var db=require(_0xc0c3('0x4'))['db'];var utils=require(_0xc0c3('0x5'));var logger=require('../../config/logger')(_0xc0c3('0x6'));var config=require(_0xc0c3('0x7'));var jayson=require(_0xc0c3('0x8'));var client=jayson[_0xc0c3('0x9')][_0xc0c3('0xa')]({'port':0x232a});config[_0xc0c3('0xb')]=_[_0xc0c3('0xc')](config[_0xc0c3('0xb')],{'host':_0xc0c3('0xd'),'port':0x18eb});var socket=require(_0xc0c3('0xe'))(new Redis(config[_0xc0c3('0xb')]));require(_0xc0c3('0xf'))[_0xc0c3('0x10')](socket);function respondWithRpcPromise(_0x2c5d16,_0x34b72c,_0x58694a){return new BPromise(function(_0x11765a,_0x236078){return client[_0xc0c3('0x11')](_0x2c5d16,_0x58694a)[_0xc0c3('0x12')](function(_0x1e264b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x34b72c,_0xc0c3('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x34b72c,_0xc0c3('0x13'),JSON[_0xc0c3('0x14')](_0x1e264b));if(_0x1e264b[_0xc0c3('0x15')]){if(_0x1e264b[_0xc0c3('0x15')][_0xc0c3('0x16')]===0x1f4){logger['error'](_0xc0c3('0x17'),_0x34b72c,_0x1e264b[_0xc0c3('0x15')][_0xc0c3('0x18')]);return _0x236078(_0x1e264b[_0xc0c3('0x15')][_0xc0c3('0x18')]);}logger[_0xc0c3('0x15')](_0xc0c3('0x17'),_0x34b72c,_0x1e264b[_0xc0c3('0x15')][_0xc0c3('0x18')]);return _0x11765a(_0x1e264b[_0xc0c3('0x15')]['message']);}else{logger[_0xc0c3('0x19')](_0xc0c3('0x17'),_0x34b72c,_0xc0c3('0x13'));_0x11765a(_0x1e264b[_0xc0c3('0x1a')][_0xc0c3('0x18')]);}})[_0xc0c3('0x1b')](function(_0x156f0e){logger[_0xc0c3('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x34b72c,_0x156f0e);_0x236078(_0x156f0e);});});}exports[_0xc0c3('0x1c')]=function(_0x1830f6){var _0x1c9450=this;return new Promise(function(_0x1b7178,_0x5d8d2f){return db[_0xc0c3('0x1d')][_0xc0c3('0x1e')](_0x1830f6[_0xc0c3('0x1f')],{'raw':_0x1830f6[_0xc0c3('0x20')]?_0x1830f6[_0xc0c3('0x20')][_0xc0c3('0x21')]===undefined?!![]:![]:!![]})[_0xc0c3('0x12')](function(_0xfa7c73){logger[_0xc0c3('0x19')](_0xc0c3('0x1c'),_0x1830f6);logger[_0xc0c3('0x22')]('CreateWhatsappMessage',_0x1830f6,JSON[_0xc0c3('0x14')](_0xfa7c73));_0x1b7178(_0xfa7c73);})[_0xc0c3('0x1b')](function(_0xbf25e){logger['error'](_0xc0c3('0x1c'),_0xbf25e[_0xc0c3('0x18')],_0x1830f6);_0x5d8d2f(_0x1c9450[_0xc0c3('0x15')](0x1f4,_0xbf25e[_0xc0c3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cb531ff..8303626 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 _0xc090=['remove','emit','removeListener','register','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc090,0x9a));var _0x0c09=function(_0x305eb3,_0x3cc2b1){_0x305eb3=_0x305eb3-0x0;var _0x744a7b=_0xc090[_0x305eb3];return _0x744a7b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x0c09('0x0'),_0x0c09('0x1'),'update'];function createListener(_0x410d56,_0x1b9dac){return function(_0x379cb2){_0x1b9dac[_0x0c09('0x2')](_0x410d56,_0x379cb2);};}function removeListener(_0x52b232,_0x4b43de){return function(){WhatsappMessageEvents[_0x0c09('0x3')](_0x52b232,_0x4b43de);};}exports[_0x0c09('0x4')]=function(_0x17fb1c){for(var _0x18f691=0x0,_0x27a235=events['length'];_0x18f691<_0x27a235;_0x18f691++){var _0x5e43ec=events[_0x18f691];var _0x471ae6=createListener('whatsappMessage:'+_0x5e43ec,_0x17fb1c);WhatsappMessageEvents['on'](_0x5e43ec,_0x471ae6);}}; \ No newline at end of file +var _0x5b6b=['removeListener','register','whatsappMessage:','./whatsappMessage.events','remove','update','emit'];(function(_0x3ceb7b,_0x4b6fcf){var _0x244fec=function(_0x1fc4a7){while(--_0x1fc4a7){_0x3ceb7b['push'](_0x3ceb7b['shift']());}};_0x244fec(++_0x4b6fcf);}(_0x5b6b,0x6c));var _0xb5b6=function(_0x3007a4,_0x411c1f){_0x3007a4=_0x3007a4-0x0;var _0x3c96a4=_0x5b6b[_0x3007a4];return _0x3c96a4;};'use strict';var WhatsappMessageEvents=require(_0xb5b6('0x0'));var events=['save',_0xb5b6('0x1'),_0xb5b6('0x2')];function createListener(_0x253711,_0xa6bdde){return function(_0x27c752){_0xa6bdde[_0xb5b6('0x3')](_0x253711,_0x27c752);};}function removeListener(_0x121c2c,_0x40fccd){return function(){WhatsappMessageEvents[_0xb5b6('0x4')](_0x121c2c,_0x40fccd);};}exports[_0xb5b6('0x5')]=function(_0x17e015){for(var _0x52c75d=0x0,_0x17d32e=events['length'];_0x52c75d<_0x17d32e;_0x52c75d++){var _0x3b5ebc=events[_0x52c75d];var _0x386ef1=createListener(_0xb5b6('0x6')+_0x3b5ebc,_0x17e015);WhatsappMessageEvents['on'](_0x3b5ebc,_0x386ef1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 398c7fb..aaefd8c 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 _0xa284=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x455013,_0x5878b9){var _0xd683c9=function(_0x3d8e92){while(--_0x3d8e92){_0x455013['push'](_0x455013['shift']());}};_0xd683c9(++_0x5878b9);}(_0xa284,0x1da));var _0x4a28=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa284[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a28('0x0'));var timeout=require(_0x4a28('0x1'));var express=require(_0x4a28('0x2'));var router=express[_0x4a28('0x3')]();var fs_extra=require(_0x4a28('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a28('0x5'));var config=require(_0x4a28('0x6'));var controller=require(_0x4a28('0x7'));router[_0x4a28('0x8')]('/',auth[_0x4a28('0x9')](),controller[_0x4a28('0xa')]);router[_0x4a28('0x8')](_0x4a28('0xb'),auth[_0x4a28('0x9')](),controller[_0x4a28('0xc')]);router[_0x4a28('0x8')]('/:id',auth[_0x4a28('0x9')](),controller[_0x4a28('0xd')]);router['get'](_0x4a28('0xe'),auth[_0x4a28('0x9')](),controller[_0x4a28('0xf')]);router['get'](_0x4a28('0x10'),auth['isAuthenticated'](),controller[_0x4a28('0x11')]);router[_0x4a28('0x8')]('/:id/users',auth[_0x4a28('0x9')](),controller['getAgents']);router['post']('/',auth[_0x4a28('0x9')](),controller[_0x4a28('0x12')]);router[_0x4a28('0x13')](_0x4a28('0x10'),auth['isAuthenticated'](),controller[_0x4a28('0x14')]);router['post']('/:id/users',auth[_0x4a28('0x9')](),controller[_0x4a28('0x15')]);router['put'](_0x4a28('0x16'),auth['isAuthenticated'](),controller[_0x4a28('0x17')]);router[_0x4a28('0x18')]('/:id',auth[_0x4a28('0x9')](),controller[_0x4a28('0x19')]);router['delete'](_0x4a28('0x10'),auth[_0x4a28('0x9')](),controller[_0x4a28('0x1a')]);router['delete'](_0x4a28('0x1b'),auth[_0x4a28('0x9')](),controller[_0x4a28('0x1c')]);module[_0x4a28('0x1d')]=router; \ No newline at end of file +var _0x5540=['/:id','isAuthenticated','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','update','destroy','delete','removeTeams','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0xd206ce,_0x3031d2){var _0x5b3ec6=function(_0x526993){while(--_0x526993){_0xd206ce['push'](_0xd206ce['shift']());}};_0x5b3ec6(++_0x3031d2);}(_0x5540,0x12a));var _0x0554=function(_0x369a03,_0x24528c){_0x369a03=_0x369a03-0x0;var _0x4a2329=_0x5540[_0x369a03];return _0x4a2329;};'use strict';var multer=require(_0x0554('0x0'));var util=require(_0x0554('0x1'));var path=require(_0x0554('0x2'));var timeout=require('connect-timeout');var express=require(_0x0554('0x3'));var router=express[_0x0554('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0554('0x5'));var interaction=require(_0x0554('0x6'));var config=require(_0x0554('0x7'));var controller=require('./whatsappQueue.controller');router[_0x0554('0x8')]('/',auth['isAuthenticated'](),controller[_0x0554('0x9')]);router[_0x0554('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0554('0x8')](_0x0554('0xa'),auth[_0x0554('0xb')](),controller['show']);router[_0x0554('0x8')](_0x0554('0xc'),auth[_0x0554('0xb')](),controller[_0x0554('0xd')]);router['get']('/:id/teams',auth[_0x0554('0xb')](),controller['getTeams']);router['get'](_0x0554('0xe'),auth['isAuthenticated'](),controller[_0x0554('0xf')]);router[_0x0554('0x10')]('/',auth[_0x0554('0xb')](),controller['create']);router['post'](_0x0554('0x11'),auth[_0x0554('0xb')](),controller['addTeams']);router[_0x0554('0x10')](_0x0554('0xe'),auth[_0x0554('0xb')](),controller['addAgents']);router['put'](_0x0554('0xa'),auth[_0x0554('0xb')](),controller[_0x0554('0x12')]);router['delete'](_0x0554('0xa'),auth[_0x0554('0xb')](),controller[_0x0554('0x13')]);router[_0x0554('0x14')](_0x0554('0x11'),auth[_0x0554('0xb')](),controller[_0x0554('0x15')]);router[_0x0554('0x14')](_0x0554('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c1670a8..57ede58 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d0b=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2870dc,_0x4a2912){var _0x3a3e2f=function(_0x30641b){while(--_0x30641b){_0x2870dc['push'](_0x2870dc['shift']());}};_0x3a3e2f(++_0x4a2912);}(_0x6d0b,0x71));var _0xb6d0=function(_0x55ab8d,_0x5e8814){_0x55ab8d=_0x55ab8d-0x0;var _0x54a618=_0x6d0b[_0x55ab8d];return _0x54a618;};'use strict';var Sequelize=require(_0xb6d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb6d0('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb6d0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6d0('0x3')](_0xb6d0('0x4'),_0xb6d0('0x5'),_0xb6d0('0x6'))},'description':{'type':Sequelize[_0xb6d0('0x1')]}}; \ No newline at end of file +var _0xaf93=['STRING','sequelize','exports','INTEGER','ENUM','beepall','roundrobin'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xaf93,0x151));var _0x3af9=function(_0x325ff5,_0x46dca7){_0x325ff5=_0x325ff5-0x0;var _0x32ccc8=_0xaf93[_0x325ff5];return _0x32ccc8;};'use strict';var Sequelize=require(_0x3af9('0x0'));module[_0x3af9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3af9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3af9('0x3')]('rrmemory',_0x3af9('0x4'),_0x3af9('0x5'))},'description':{'type':Sequelize[_0x3af9('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 83466c3..4aff78e 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 _0x6b0a=['rawAttributes','fieldName','type','key','where','WhatsappQueue','include','findAll','rows','catch','show','params','query','filters','intersection','fields','attributes','length','model','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','UserWhatsappQueue','nolimit','order','sort','pick','WhatsappQueueId','filter','map','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','Team','getTeams','hasOwnProperty','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','end','status','json','limit','undefined','count','offset','update','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','stack','name','send','index'];(function(_0x4e6d8,_0x13c602){var _0x2f9e8c=function(_0x54630a){while(--_0x54630a){_0x4e6d8['push'](_0x4e6d8['shift']());}};_0x2f9e8c(++_0x13c602);}(_0x6b0a,0x1da));var _0xa6b0=function(_0xd9b84d,_0x27a493){_0xd9b84d=_0xd9b84d-0x0;var _0x350e63=_0x6b0a[_0xd9b84d];return _0x350e63;};'use strict';var BPromise=require(_0xa6b0('0x0'));var util=require(_0xa6b0('0x1'));var _=require('lodash');var squel=require(_0xa6b0('0x2'));var Redis=require(_0xa6b0('0x3'));var qs=require(_0xa6b0('0x4'));var logger=require(_0xa6b0('0x5'))(_0xa6b0('0x6'));var config=require('../../config/environment');var db=require(_0xa6b0('0x7'))['db'];config[_0xa6b0('0x8')]=_[_0xa6b0('0x9')](config[_0xa6b0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6b0('0xa'))(new Redis(config[_0xa6b0('0x8')]));require(_0xa6b0('0xb'))['register'](socket);function respondWithStatusCode(_0x160ada,_0x590933){_0x590933=_0x590933||0xcc;return function(_0x2967c1){if(_0x2967c1){return _0x160ada['sendStatus'](_0x590933);}return _0x160ada['status'](_0x590933)[_0xa6b0('0xc')]();};}function respondWithResult(_0x32d5e,_0x377365){_0x377365=_0x377365||0xc8;return function(_0x3641d4){if(_0x3641d4){return _0x32d5e[_0xa6b0('0xd')](_0x377365)[_0xa6b0('0xe')](_0x3641d4);}};}function respondWithFilteredResult(_0x43e079,_0x1eab80){return function(_0xbf1f96){if(_0xbf1f96){var _0x2c5229=typeof _0x1eab80['offset']==='undefined'&&typeof _0x1eab80[_0xa6b0('0xf')]===_0xa6b0('0x10');var _0x30c44e=_0xbf1f96[_0xa6b0('0x11')];var _0x52880f=_0x2c5229?0x0:_0x1eab80[_0xa6b0('0x12')];var _0x50f1d2=_0x2c5229?_0xbf1f96[_0xa6b0('0x11')]:_0x1eab80[_0xa6b0('0x12')]+_0x1eab80[_0xa6b0('0xf')];var _0x3c5323;if(_0x50f1d2>=_0x30c44e){_0x50f1d2=_0x30c44e;_0x3c5323=0xc8;}else{_0x3c5323=0xce;}_0x43e079[_0xa6b0('0xd')](_0x3c5323);return _0x43e079['set']('Content-Range',_0x52880f+'-'+_0x50f1d2+'/'+_0x30c44e)[_0xa6b0('0xe')](_0xbf1f96);}return null;};}function saveUpdates(_0x1c77ae){return function(_0xda7f67){if(_0xda7f67){return _0xda7f67[_0xa6b0('0x13')](_0x1c77ae)[_0xa6b0('0x14')](function(_0x56bc93){return _0x56bc93;});}return null;};}function removeEntity(_0x394b74){return function(_0x12457b){if(_0x12457b){return _0x12457b[_0xa6b0('0x15')]()[_0xa6b0('0x14')](function(){var _0x45bb22=_0x12457b[_0xa6b0('0x16')]({'plain':!![]});var _0x465590=_0xa6b0('0x17');return db[_0xa6b0('0x18')][_0xa6b0('0x15')]({'where':{'type':_0x465590,'resourceId':_0x45bb22['id']}})['then'](function(){return _0x12457b;});})[_0xa6b0('0x14')](function(){_0x394b74[_0xa6b0('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367ef3){return function(_0x3aa1fc){if(!_0x3aa1fc){_0x367ef3[_0xa6b0('0x19')](0x194);}return _0x3aa1fc;};}function handleError(_0x4fb936,_0x56ad1f){_0x56ad1f=_0x56ad1f||0x1f4;return function(_0x35c5b0){logger['error'](_0x35c5b0[_0xa6b0('0x1a')]);if(_0x35c5b0[_0xa6b0('0x1b')]){delete _0x35c5b0[_0xa6b0('0x1b')];}_0x4fb936[_0xa6b0('0xd')](_0x56ad1f)[_0xa6b0('0x1c')](_0x35c5b0);};}exports[_0xa6b0('0x1d')]=function(_0x207a0d,_0x2284bb){var _0x8033e3={};var _0x343b97={'count':0x0,'rows':[]};var _0x5938fa=_['map'](db['WhatsappQueue'][_0xa6b0('0x1e')],function(_0x83db60){return{'name':_0x83db60[_0xa6b0('0x1f')],'type':_0x83db60[_0xa6b0('0x20')][_0xa6b0('0x21')]};});_0x8033e3=qs['getOptions'](_0x5938fa,_0x207a0d);var _0x2b3065={'where':_0x8033e3[_0xa6b0('0x22')]};return db[_0xa6b0('0x23')][_0xa6b0('0x11')](_0x2b3065)[_0xa6b0('0x14')](function(_0x5345b7){_0x343b97[_0xa6b0('0x11')]=_0x5345b7;_0x8033e3[_0xa6b0('0x24')]=qs['include'](_0x207a0d['query']);return db[_0xa6b0('0x23')][_0xa6b0('0x25')](_0x8033e3);})[_0xa6b0('0x14')](function(_0x57b05e){_0x343b97[_0xa6b0('0x26')]=_0x57b05e;return _0x343b97;})[_0xa6b0('0x14')](respondWithFilteredResult(_0x2284bb,_0x8033e3))[_0xa6b0('0x27')](handleError(_0x2284bb,null));};exports[_0xa6b0('0x28')]=function(_0x435387,_0x264c31){var _0x400ddc={'raw':!![],'where':{'id':_0x435387[_0xa6b0('0x29')]['id']}},_0x1cff11={};_0x1cff11['model']=_['keys'](db[_0xa6b0('0x23')][_0xa6b0('0x1e')]);_0x1cff11[_0xa6b0('0x2a')]=_['keys'](_0x435387['query']);_0x1cff11[_0xa6b0('0x2b')]=_[_0xa6b0('0x2c')](_0x1cff11['model'],_0x1cff11[_0xa6b0('0x2a')]);_0x400ddc['attributes']=_[_0xa6b0('0x2c')](_0x1cff11['model'],qs[_0xa6b0('0x2d')](_0x435387[_0xa6b0('0x2a')][_0xa6b0('0x2d')]));_0x400ddc['attributes']=_0x400ddc[_0xa6b0('0x2e')][_0xa6b0('0x2f')]?_0x400ddc[_0xa6b0('0x2e')]:_0x1cff11[_0xa6b0('0x30')];if(_0x435387[_0xa6b0('0x2a')]['includeAll']){_0x400ddc[_0xa6b0('0x24')]=[{'all':!![]}];}_0x400ddc=_[_0xa6b0('0x31')]({},_0x400ddc,_0x435387[_0xa6b0('0x32')]);return db['WhatsappQueue'][_0xa6b0('0x33')](_0x400ddc)['then'](handleEntityNotFound(_0x264c31,null))[_0xa6b0('0x14')](respondWithResult(_0x264c31,null))['catch'](handleError(_0x264c31,null));};exports[_0xa6b0('0x34')]=function(_0x24d57d,_0x22c28e){return db[_0xa6b0('0x23')]['create'](_0x24d57d[_0xa6b0('0x35')],{})[_0xa6b0('0x14')](function(_0x30cb40){var _0x311d8d=_0x24d57d[_0xa6b0('0x36')][_0xa6b0('0x16')]({'plain':!![]});if(!_0x311d8d)throw new Error(_0xa6b0('0x37'));if(_0x311d8d[_0xa6b0('0x38')]===_0xa6b0('0x36')){var _0x49e608=_0x30cb40['get']({'plain':!![]});var _0x1532b4=_0xa6b0('0x17');return db[_0xa6b0('0x39')][_0xa6b0('0x33')]({'where':{'name':_0x1532b4,'userProfileId':_0x311d8d[_0xa6b0('0x3a')]},'raw':!![]})[_0xa6b0('0x14')](function(_0x231c5c){if(_0x231c5c&&_0x231c5c[_0xa6b0('0x3b')]===0x0){return db['UserProfileResource'][_0xa6b0('0x34')]({'name':_0x49e608[_0xa6b0('0x1b')],'resourceId':_0x49e608['id'],'type':_0x231c5c['name'],'sectionId':_0x231c5c['id']},{})[_0xa6b0('0x14')](function(){return _0x30cb40;});}else{return _0x30cb40;}})[_0xa6b0('0x27')](function(_0x53287e){logger[_0xa6b0('0x3c')](_0xa6b0('0x3d'),_0x53287e);throw _0x53287e;});}return _0x30cb40;})[_0xa6b0('0x14')](respondWithResult(_0x22c28e,0xc9))[_0xa6b0('0x27')](handleError(_0x22c28e,null));};exports[_0xa6b0('0x13')]=function(_0x715984,_0x49eda0){if(_0x715984['body']['id']){delete _0x715984[_0xa6b0('0x35')]['id'];}return db[_0xa6b0('0x23')][_0xa6b0('0x33')]({'where':{'id':_0x715984[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](handleEntityNotFound(_0x49eda0,null))[_0xa6b0('0x14')](saveUpdates(_0x715984[_0xa6b0('0x35')],null))['then'](respondWithResult(_0x49eda0,null))[_0xa6b0('0x27')](handleError(_0x49eda0,null));};exports[_0xa6b0('0x15')]=function(_0x51a1a6,_0x5e327c){return db['WhatsappQueue']['find']({'where':{'id':_0x51a1a6[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](handleEntityNotFound(_0x5e327c,null))[_0xa6b0('0x14')](removeEntity(_0x5e327c,null))[_0xa6b0('0x27')](handleError(_0x5e327c,null));};exports[_0xa6b0('0x3e')]=function(_0x4dda34,_0x3404e5){return db[_0xa6b0('0x23')]['describe']()[_0xa6b0('0x14')](respondWithResult(_0x3404e5,null))[_0xa6b0('0x27')](handleError(_0x3404e5,null));};exports[_0xa6b0('0x3f')]=function(_0x3df4fb,_0x22bf1a){var _0x49a2aa={'raw':!![],'where':{}},_0x50d930={},_0x262d4f;return db[_0xa6b0('0x23')][_0xa6b0('0x40')]({'where':{'id':_0x3df4fb[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](handleEntityNotFound(_0x22bf1a,null))[_0xa6b0('0x14')](function(_0x443874){if(_0x443874){_0x262d4f=_0x443874[_0xa6b0('0x16')]({'plain':!![]});_0x50d930['model']=_[_0xa6b0('0x41')](db[_0xa6b0('0x42')][_0xa6b0('0x1e')]);_0x50d930['query']=_[_0xa6b0('0x41')](_0x3df4fb['query']);_0x50d930[_0xa6b0('0x2b')]=_['intersection'](_0x50d930[_0xa6b0('0x30')],_0x50d930[_0xa6b0('0x2a')]);_0x49a2aa[_0xa6b0('0x2e')]=_[_0xa6b0('0x2c')](_0x50d930[_0xa6b0('0x30')],qs[_0xa6b0('0x2d')](_0x3df4fb[_0xa6b0('0x2a')][_0xa6b0('0x2d')]));_0x49a2aa[_0xa6b0('0x2e')]=_0x49a2aa[_0xa6b0('0x2e')][_0xa6b0('0x2f')]?_0x49a2aa[_0xa6b0('0x2e')]:_0x50d930[_0xa6b0('0x30')];if(!_0x3df4fb[_0xa6b0('0x2a')]['hasOwnProperty'](_0xa6b0('0x43'))){_0x49a2aa[_0xa6b0('0xf')]=qs[_0xa6b0('0xf')](_0x3df4fb['query'][_0xa6b0('0xf')]);_0x49a2aa[_0xa6b0('0x12')]=qs[_0xa6b0('0x12')](_0x3df4fb['query'][_0xa6b0('0x12')]);}_0x49a2aa[_0xa6b0('0x44')]=qs[_0xa6b0('0x45')](_0x3df4fb[_0xa6b0('0x2a')][_0xa6b0('0x45')]);_0x49a2aa['where']=qs[_0xa6b0('0x2b')](_[_0xa6b0('0x46')](_0x3df4fb['query'],_0x50d930[_0xa6b0('0x2b')]));_0x49a2aa['where'][_0xa6b0('0x47')]=_0x443874['id'];if(_0x3df4fb[_0xa6b0('0x2a')][_0xa6b0('0x48')]){_0x49a2aa[_0xa6b0('0x22')]=_[_0xa6b0('0x31')](_0x49a2aa[_0xa6b0('0x22')],{'$or':_[_0xa6b0('0x49')](_0x49a2aa[_0xa6b0('0x2e')],function(_0x884bd){var _0x303445={};_0x303445[_0x884bd]={'$like':'%'+_0x3df4fb[_0xa6b0('0x2a')][_0xa6b0('0x48')]+'%'};return _0x303445;})});}_0x49a2aa=_['merge']({},_0x49a2aa,_0x3df4fb[_0xa6b0('0x32')]);return db[_0xa6b0('0x42')][_0xa6b0('0x25')](_0x49a2aa);}})['then'](function(_0x24c52a){if(_0x24c52a){return db[_0xa6b0('0x4a')]['findAndCountAll']({'where':{'id':_[_0xa6b0('0x49')](_0x24c52a,_0xa6b0('0x4b')),'role':_0xa6b0('0x4c')},'attributes':['id',_0xa6b0('0x1b'),_0xa6b0('0x4d'),_0xa6b0('0x4e'),_0xa6b0('0x4f')]});}})[_0xa6b0('0x14')](function(_0x251658){if(_0x251658){return{'count':_0x251658[_0xa6b0('0x11')],'rows':_[_0xa6b0('0x49')](_0x251658[_0xa6b0('0x26')],function(_0x4f4cef){return{'membername':_0x4f4cef[_0xa6b0('0x1b')],'UserId':_0x4f4cef['id'],'queue_name':_0x262d4f['name'],'WhatsappQueueId':_0x262d4f['id'],'interface':util[_0xa6b0('0x50')]('%s/%s',_0xa6b0('0x51'),_0x4f4cef[_0xa6b0('0x1b')]),'penalty':0x0,'paused':_0x4f4cef[_0xa6b0('0x4d')],'createdAt':_0x4f4cef['createdAt'],'updatedAt':_0x4f4cef[_0xa6b0('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6b0('0x14')](respondWithFilteredResult(_0x22bf1a,_0x49a2aa))[_0xa6b0('0x27')](handleError(_0x22bf1a,null));};exports['getTeams']=function(_0x475e3a,_0x1d15f6){var _0x4765f4={};var _0x2f5da1={};var _0x3e0ee1;var _0x527a2a;return db['WhatsappQueue'][_0xa6b0('0x40')]({'where':{'id':_0x475e3a[_0xa6b0('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d15f6,null))[_0xa6b0('0x14')](function(_0x32c51e){if(_0x32c51e){_0x3e0ee1=_0x32c51e;_0x2f5da1[_0xa6b0('0x30')]=_[_0xa6b0('0x41')](db[_0xa6b0('0x52')][_0xa6b0('0x1e')]);_0x2f5da1[_0xa6b0('0x2a')]=_[_0xa6b0('0x41')](_0x475e3a['query']);_0x2f5da1['filters']=_['intersection'](_0x2f5da1[_0xa6b0('0x30')],_0x2f5da1[_0xa6b0('0x2a')]);_0x4765f4[_0xa6b0('0x2e')]=_[_0xa6b0('0x2c')](_0x2f5da1[_0xa6b0('0x30')],qs[_0xa6b0('0x2d')](_0x475e3a[_0xa6b0('0x2a')][_0xa6b0('0x2d')]));_0x4765f4[_0xa6b0('0x2e')]=_0x4765f4[_0xa6b0('0x2e')][_0xa6b0('0x2f')]?_0x4765f4['attributes']:_0x2f5da1[_0xa6b0('0x30')];_0x4765f4[_0xa6b0('0x44')]=qs['sort'](_0x475e3a[_0xa6b0('0x2a')]['sort']);_0x4765f4[_0xa6b0('0x22')]=qs[_0xa6b0('0x2b')](_[_0xa6b0('0x46')](_0x475e3a[_0xa6b0('0x2a')],_0x2f5da1['filters']));if(_0x475e3a[_0xa6b0('0x2a')]['filter']){_0x4765f4[_0xa6b0('0x22')]=_[_0xa6b0('0x31')](_0x4765f4[_0xa6b0('0x22')],{'$or':_['map'](_0x4765f4[_0xa6b0('0x2e')],function(_0x5a0390){var _0x1f81f7={};_0x1f81f7[_0x5a0390]={'$like':'%'+_0x475e3a['query']['filter']+'%'};return _0x1f81f7;})});}_0x4765f4=_[_0xa6b0('0x31')]({},_0x4765f4,_0x475e3a[_0xa6b0('0x32')]);return _0x3e0ee1[_0xa6b0('0x53')](_0x4765f4);}})[_0xa6b0('0x14')](function(_0x72c2d1){if(_0x72c2d1){_0x527a2a=_0x72c2d1[_0xa6b0('0x2f')];if(!_0x475e3a['query'][_0xa6b0('0x54')](_0xa6b0('0x43'))){_0x4765f4['limit']=qs[_0xa6b0('0xf')](_0x475e3a['query'][_0xa6b0('0xf')]);_0x4765f4[_0xa6b0('0x12')]=qs['offset'](_0x475e3a[_0xa6b0('0x2a')][_0xa6b0('0x12')]);}return _0x3e0ee1[_0xa6b0('0x53')](_0x4765f4);}})['then'](function(_0x1c2d05){if(_0x1c2d05){return _0x1c2d05?{'count':_0x527a2a,'rows':_0x1c2d05}:null;}})[_0xa6b0('0x14')](respondWithResult(_0x1d15f6,null))[_0xa6b0('0x27')](handleError(_0x1d15f6,null));};exports['addTeams']=function(_0x2b2d5f,_0x1e7fd6){var _0x254904=_0x2b2d5f[_0xa6b0('0x35')][_0xa6b0('0x55')];return db[_0xa6b0('0x52')]['findAll']({'where':{'id':_0x254904},'attributes':['id'],'include':[{'model':db[_0xa6b0('0x4a')],'as':_0xa6b0('0x56'),'attributes':['id',_0xa6b0('0x1b'),_0xa6b0('0x57'),_0xa6b0('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x5847db){if(_0x5847db){var _0x3928d0=_[_0xa6b0('0x59')](_0x5847db,function(_0x4aa9e8){var _0x4388ad=_0x4aa9e8[_0xa6b0('0x16')]({'plain':!![]});return _0x4388ad['Agents'];});return db[_0xa6b0('0x23')][_0xa6b0('0x33')]({'where':{'id':_0x2b2d5f[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](function(_0x13bdcd){return db[_0xa6b0('0x5a')][_0xa6b0('0x5b')](function(_0x9bc75a){return _0x13bdcd[_0xa6b0('0x5c')](_0x254904,{'transaction':_0x9bc75a})[_0xa6b0('0x14')](function(){return BPromise[_0xa6b0('0x5d')](_0x3928d0,function(_0x43e638){return db[_0xa6b0('0x42')][_0xa6b0('0x5e')]({'where':{'UserId':_0x43e638['id'],'WhatsappQueueId':_0x2b2d5f[_0xa6b0('0x29')]['id']},'transaction':_0x9bc75a});});})[_0xa6b0('0x14')](function(){_0x3928d0[_0xa6b0('0x5f')](function(_0x2484b9){socket[_0xa6b0('0x60')](_0xa6b0('0x61'),{'UserId':_0x2484b9['id'],'WhatsappQueueId':_0x13bdcd['id']});});});});});}})['then'](respondWithStatusCode(_0x1e7fd6,null))[_0xa6b0('0x27')](handleError(_0x1e7fd6,null));};exports['removeTeams']=function(_0x13f467,_0x189d49){return db[_0xa6b0('0x52')][_0xa6b0('0x25')]({'where':{'id':_0x13f467[_0xa6b0('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa6b0('0x4a')],'as':_0xa6b0('0x56'),'attributes':['id'],'raw':!![]}]})[_0xa6b0('0x14')](handleEntityNotFound(_0x189d49,null))['then'](function(_0x41ea04){var _0xd172a6=_['map'](_0x41ea04,'id');var _0x247604=[];var _0x56d3d8=[];var _0x592b19=squel[_0xa6b0('0x62')]();_0x592b19[_0xa6b0('0x63')](_0xa6b0('0x64'))[_0xa6b0('0x65')](_0xa6b0('0x66'),'tq')['join'](_0xa6b0('0x67'),'ut',_0xa6b0('0x68'))['where'](_0xa6b0('0x69'),_0x13f467['params']['id']);for(var _0x181ac4=0x0;_0x181ac4<_0x41ea04['length'];_0x181ac4+=0x1){let _0x1db7f8=_0x41ea04[_0x181ac4];for(var _0x4eff40=0x0;_0x4eff40<_0x1db7f8[_0xa6b0('0x56')][_0xa6b0('0x2f')];_0x4eff40+=0x1){let _0x3ed7ee=_0x1db7f8['Agents'][_0x4eff40];var _0x1311b9=_0x592b19[_0xa6b0('0x6a')]();_0x1311b9[_0xa6b0('0x22')](_0xa6b0('0x6b'),_0x3ed7ee['id']);_0x56d3d8['push'](db['sequelize'][_0xa6b0('0x2a')](_0x1311b9[_0xa6b0('0x6c')](),{'type':db[_0xa6b0('0x5a')][_0xa6b0('0x6d')][_0xa6b0('0x6e')]})[_0xa6b0('0x14')](function(_0x609a51){if(_0x609a51[_0xa6b0('0x2f')]===0x1){return _0x3ed7ee['id'];}else{var _0x6e5d07=_['every'](_[_0xa6b0('0x49')](_0x609a51,_0xa6b0('0x6f')),function(_0xd17993){return _[_0xa6b0('0x70')](_0xd172a6,_0xd17993);});if(_0x6e5d07){return _0x3ed7ee['id'];}}}));}}return BPromise[_0xa6b0('0x71')](_0x56d3d8)['then'](function(_0x1b2ae8){_0x247604=_(_0x247604)[_0xa6b0('0x72')](_0x1b2ae8)[_0xa6b0('0x73')]()[_0xa6b0('0x74')]();return db[_0xa6b0('0x23')][_0xa6b0('0x33')]({'where':{'id':_0x13f467[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](function(_0x249eb6){return db[_0xa6b0('0x5a')][_0xa6b0('0x5b')](function(_0x260668){return _0x249eb6[_0xa6b0('0x75')](_0x13f467[_0xa6b0('0x2a')]['ids'],{'transaction':_0x260668})[_0xa6b0('0x14')](function(){if(!_[_0xa6b0('0x76')](_0x247604)){return _0x249eb6[_0xa6b0('0x77')](_0x247604,{'transaction':_0x260668});}})[_0xa6b0('0x14')](function(){_0x247604[_0xa6b0('0x5f')](function(_0x52ba40){socket[_0xa6b0('0x60')]('userWhatsappQueue:remove',{'UserId':_0x52ba40,'WhatsappQueueId':_0x249eb6['id']});});});});});});})[_0xa6b0('0x14')](respondWithStatusCode(_0x189d49,null))[_0xa6b0('0x27')](handleError(_0x189d49,null));};exports[_0xa6b0('0x78')]=function(_0x436c20,_0x4a61be){return db[_0xa6b0('0x23')][_0xa6b0('0x33')]({'where':{'id':_0x436c20[_0xa6b0('0x29')]['id']}})['then'](handleEntityNotFound(_0x4a61be,null))['then'](function(_0x3bf9e8){if(_0x3bf9e8){return _0x3bf9e8[_0xa6b0('0x78')](_0x436c20[_0xa6b0('0x35')][_0xa6b0('0x55')],_[_0xa6b0('0x79')](_0x436c20['body'],[_0xa6b0('0x55'),'id'])||{})[_0xa6b0('0x7a')](function(_0x5beef9){for(var _0x37430a=0x0;_0x37430a<_0x436c20[_0xa6b0('0x35')][_0xa6b0('0x55')][_0xa6b0('0x2f')];_0x37430a+=0x1){socket[_0xa6b0('0x60')](_0xa6b0('0x61'),{'UserId':Number(_0x436c20[_0xa6b0('0x35')][_0xa6b0('0x55')][_0x37430a]),'WhatsappQueueId':Number(_0x436c20[_0xa6b0('0x29')]['id'])});}return _0x5beef9;});}})['then'](respondWithResult(_0x4a61be,null))['catch'](handleError(_0x4a61be,null));};exports[_0xa6b0('0x77')]=function(_0x509602,_0x25e374){return db['WhatsappQueue'][_0xa6b0('0x33')]({'where':{'id':_0x509602[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](handleEntityNotFound(_0x25e374,null))[_0xa6b0('0x14')](function(_0xf68f58){if(_0xf68f58){return _0xf68f58['removeAgents'](_0x509602[_0xa6b0('0x2a')][_0xa6b0('0x55')])[_0xa6b0('0x14')](function(){if(_[_0xa6b0('0x7b')](_0x509602[_0xa6b0('0x2a')][_0xa6b0('0x55')])){for(var _0x266ef5=0x0;_0x266ef5<_0x509602[_0xa6b0('0x2a')][_0xa6b0('0x55')][_0xa6b0('0x2f')];_0x266ef5+=0x1){socket[_0xa6b0('0x60')]('userWhatsappQueue:remove',{'UserId':Number(_0x509602[_0xa6b0('0x2a')][_0xa6b0('0x55')][_0x266ef5]),'WhatsappQueueId':Number(_0x509602['params']['id'])});}}else{socket[_0xa6b0('0x60')](_0xa6b0('0x7c'),{'UserId':Number(_0x509602[_0xa6b0('0x2a')]['ids']),'WhatsappQueueId':Number(_0x509602[_0xa6b0('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x25e374,null))[_0xa6b0('0x27')](handleError(_0x25e374,null));};exports['getAgents']=function(_0x2a9f3c,_0x3d0db1){var _0x747afd={};var _0x2937ea={};var _0x2abaac;var _0x5bf0f0;return db['WhatsappQueue'][_0xa6b0('0x40')]({'where':{'id':_0x2a9f3c[_0xa6b0('0x29')]['id']}})[_0xa6b0('0x14')](handleEntityNotFound(_0x3d0db1,null))[_0xa6b0('0x14')](function(_0x13c30f){if(_0x13c30f){_0x2abaac=_0x13c30f;_0x2937ea[_0xa6b0('0x30')]=_[_0xa6b0('0x41')](db[_0xa6b0('0x4a')]['rawAttributes']);_0x2937ea[_0xa6b0('0x2a')]=_['keys'](_0x2a9f3c[_0xa6b0('0x2a')]);_0x2937ea['filters']=_['intersection'](_0x2937ea[_0xa6b0('0x30')],_0x2937ea[_0xa6b0('0x2a')]);_0x747afd[_0xa6b0('0x2e')]=_[_0xa6b0('0x2c')](_0x2937ea['model'],qs[_0xa6b0('0x2d')](_0x2a9f3c[_0xa6b0('0x2a')][_0xa6b0('0x2d')]));_0x747afd[_0xa6b0('0x2e')]=_0x747afd['attributes'][_0xa6b0('0x2f')]?_0x747afd[_0xa6b0('0x2e')]:_0x2937ea[_0xa6b0('0x30')];_0x747afd[_0xa6b0('0x44')]=qs[_0xa6b0('0x45')](_0x2a9f3c['query'][_0xa6b0('0x45')]);_0x747afd[_0xa6b0('0x22')]=qs[_0xa6b0('0x2b')](_[_0xa6b0('0x46')](_0x2a9f3c[_0xa6b0('0x2a')],_0x2937ea[_0xa6b0('0x2b')]));if(_0x2a9f3c['query']['filter']){_0x747afd[_0xa6b0('0x22')]=_[_0xa6b0('0x31')](_0x747afd[_0xa6b0('0x22')],{'$or':_['map'](_0x747afd[_0xa6b0('0x2e')],function(_0x438211){var _0x58b21a={};_0x58b21a[_0x438211]={'$like':'%'+_0x2a9f3c['query'][_0xa6b0('0x48')]+'%'};return _0x58b21a;})});}_0x747afd=_[_0xa6b0('0x31')]({},_0x747afd,_0x2a9f3c[_0xa6b0('0x32')]);return _0x2abaac['getAgents'](_0x747afd);}})[_0xa6b0('0x14')](function(_0x52636b){if(_0x52636b){_0x5bf0f0=_0x52636b[_0xa6b0('0x2f')];if(!_0x2a9f3c[_0xa6b0('0x2a')][_0xa6b0('0x54')](_0xa6b0('0x43'))){_0x747afd['limit']=qs[_0xa6b0('0xf')](_0x2a9f3c[_0xa6b0('0x2a')]['limit']);_0x747afd[_0xa6b0('0x12')]=qs[_0xa6b0('0x12')](_0x2a9f3c[_0xa6b0('0x2a')][_0xa6b0('0x12')]);}return _0x2abaac[_0xa6b0('0x7d')](_0x747afd);}})[_0xa6b0('0x14')](function(_0xa53faa){if(_0xa53faa){return _0xa53faa?{'count':_0x5bf0f0,'rows':_0xa53faa}:null;}})['then'](respondWithResult(_0x3d0db1,null))[_0xa6b0('0x27')](handleError(_0x3d0db1,null));}; \ No newline at end of file +var _0x1e3e=['util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','stack','name','send','map','WhatsappQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','params','keys','filters','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','intersection','nolimit','order','sort','pick','filter','UserWhatsappQueue','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','hasOwnProperty','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','User','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','bluebird'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x1e3e,0x167));var _0xe1e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1e3e[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xe1e3('0x0'));var util=require(_0xe1e3('0x1'));var _=require(_0xe1e3('0x2'));var squel=require(_0xe1e3('0x3'));var Redis=require('ioredis');var qs=require(_0xe1e3('0x4'));var logger=require(_0xe1e3('0x5'))('api');var config=require(_0xe1e3('0x6'));var db=require(_0xe1e3('0x7'))['db'];config[_0xe1e3('0x8')]=_[_0xe1e3('0x9')](config[_0xe1e3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1e3('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xe1e3('0xb')](socket);function respondWithStatusCode(_0x281be2,_0x5deff3){_0x5deff3=_0x5deff3||0xcc;return function(_0x3690af){if(_0x3690af){return _0x281be2[_0xe1e3('0xc')](_0x5deff3);}return _0x281be2[_0xe1e3('0xd')](_0x5deff3)[_0xe1e3('0xe')]();};}function respondWithResult(_0xfcda9d,_0x268710){_0x268710=_0x268710||0xc8;return function(_0x2f1285){if(_0x2f1285){return _0xfcda9d[_0xe1e3('0xd')](_0x268710)['json'](_0x2f1285);}};}function respondWithFilteredResult(_0x30203a,_0x3d429c){return function(_0x2fd485){if(_0x2fd485){var _0x57f3e7=typeof _0x3d429c[_0xe1e3('0xf')]===_0xe1e3('0x10')&&typeof _0x3d429c[_0xe1e3('0x11')]===_0xe1e3('0x10');var _0x2598c0=_0x2fd485['count'];var _0x749723=_0x57f3e7?0x0:_0x3d429c['offset'];var _0x53c934=_0x57f3e7?_0x2fd485[_0xe1e3('0x12')]:_0x3d429c[_0xe1e3('0xf')]+_0x3d429c[_0xe1e3('0x11')];var _0x11f8c9;if(_0x53c934>=_0x2598c0){_0x53c934=_0x2598c0;_0x11f8c9=0xc8;}else{_0x11f8c9=0xce;}_0x30203a[_0xe1e3('0xd')](_0x11f8c9);return _0x30203a[_0xe1e3('0x13')](_0xe1e3('0x14'),_0x749723+'-'+_0x53c934+'/'+_0x2598c0)[_0xe1e3('0x15')](_0x2fd485);}return null;};}function saveUpdates(_0x8c8573){return function(_0x5b67ec){if(_0x5b67ec){return _0x5b67ec[_0xe1e3('0x16')](_0x8c8573)[_0xe1e3('0x17')](function(_0x579eaf){return _0x579eaf;});}return null;};}function removeEntity(_0xd64ad2){return function(_0xb1bfb){if(_0xb1bfb){return _0xb1bfb[_0xe1e3('0x18')]()[_0xe1e3('0x17')](function(){var _0x1ff125=_0xb1bfb[_0xe1e3('0x19')]({'plain':!![]});var _0x25a716='WhatsappQueues';return db[_0xe1e3('0x1a')][_0xe1e3('0x18')]({'where':{'type':_0x25a716,'resourceId':_0x1ff125['id']}})['then'](function(){return _0xb1bfb;});})['then'](function(){_0xd64ad2[_0xe1e3('0xd')](0xcc)[_0xe1e3('0xe')]();});}};}function handleEntityNotFound(_0x539182){return function(_0x31fc53){if(!_0x31fc53){_0x539182['sendStatus'](0x194);}return _0x31fc53;};}function handleError(_0x4eafa4,_0x1abde8){_0x1abde8=_0x1abde8||0x1f4;return function(_0x3c6073){logger['error'](_0x3c6073[_0xe1e3('0x1b')]);if(_0x3c6073['name']){delete _0x3c6073[_0xe1e3('0x1c')];}_0x4eafa4['status'](_0x1abde8)[_0xe1e3('0x1d')](_0x3c6073);};}exports['index']=function(_0x2d781c,_0x803aa4){var _0x331c1c={};var _0x846c6={'count':0x0,'rows':[]};var _0x4973fd=_[_0xe1e3('0x1e')](db[_0xe1e3('0x1f')][_0xe1e3('0x20')],function(_0x33f8bd){return{'name':_0x33f8bd['fieldName'],'type':_0x33f8bd[_0xe1e3('0x21')]['key']};});_0x331c1c=qs[_0xe1e3('0x22')](_0x4973fd,_0x2d781c);var _0x266c68={'where':_0x331c1c[_0xe1e3('0x23')]};return db[_0xe1e3('0x1f')][_0xe1e3('0x12')](_0x266c68)['then'](function(_0x1507e0){_0x846c6[_0xe1e3('0x12')]=_0x1507e0;_0x331c1c['include']=qs[_0xe1e3('0x24')](_0x2d781c[_0xe1e3('0x25')]);return db['WhatsappQueue'][_0xe1e3('0x26')](_0x331c1c);})['then'](function(_0x272a24){_0x846c6[_0xe1e3('0x27')]=_0x272a24;return _0x846c6;})[_0xe1e3('0x17')](respondWithFilteredResult(_0x803aa4,_0x331c1c))[_0xe1e3('0x28')](handleError(_0x803aa4,null));};exports['show']=function(_0xf28d77,_0x55f53f){var _0x23e3f1={'raw':!![],'where':{'id':_0xf28d77[_0xe1e3('0x29')]['id']}},_0x16cf2e={};_0x16cf2e['model']=_[_0xe1e3('0x2a')](db[_0xe1e3('0x1f')][_0xe1e3('0x20')]);_0x16cf2e['query']=_['keys'](_0xf28d77['query']);_0x16cf2e[_0xe1e3('0x2b')]=_['intersection'](_0x16cf2e[_0xe1e3('0x2c')],_0x16cf2e[_0xe1e3('0x25')]);_0x23e3f1[_0xe1e3('0x2d')]=_['intersection'](_0x16cf2e[_0xe1e3('0x2c')],qs[_0xe1e3('0x2e')](_0xf28d77[_0xe1e3('0x25')][_0xe1e3('0x2e')]));_0x23e3f1[_0xe1e3('0x2d')]=_0x23e3f1['attributes'][_0xe1e3('0x2f')]?_0x23e3f1[_0xe1e3('0x2d')]:_0x16cf2e[_0xe1e3('0x2c')];if(_0xf28d77[_0xe1e3('0x25')][_0xe1e3('0x30')]){_0x23e3f1['include']=[{'all':!![]}];}_0x23e3f1=_[_0xe1e3('0x31')]({},_0x23e3f1,_0xf28d77[_0xe1e3('0x32')]);return db[_0xe1e3('0x1f')][_0xe1e3('0x33')](_0x23e3f1)[_0xe1e3('0x17')](handleEntityNotFound(_0x55f53f,null))[_0xe1e3('0x17')](respondWithResult(_0x55f53f,null))[_0xe1e3('0x28')](handleError(_0x55f53f,null));};exports[_0xe1e3('0x34')]=function(_0x591386,_0x261769){return db[_0xe1e3('0x1f')][_0xe1e3('0x34')](_0x591386[_0xe1e3('0x35')],{})['then'](function(_0x3b4d67){var _0x3b91a9=_0x591386[_0xe1e3('0x36')]['get']({'plain':!![]});if(!_0x3b91a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b91a9[_0xe1e3('0x37')]===_0xe1e3('0x36')){var _0x2b543e=_0x3b4d67[_0xe1e3('0x19')]({'plain':!![]});var _0x16fb95='WhatsappQueues';return db[_0xe1e3('0x38')][_0xe1e3('0x33')]({'where':{'name':_0x16fb95,'userProfileId':_0x3b91a9['userProfileId']},'raw':!![]})[_0xe1e3('0x17')](function(_0x22b489){if(_0x22b489&&_0x22b489[_0xe1e3('0x39')]===0x0){return db[_0xe1e3('0x1a')][_0xe1e3('0x34')]({'name':_0x2b543e[_0xe1e3('0x1c')],'resourceId':_0x2b543e['id'],'type':_0x22b489['name'],'sectionId':_0x22b489['id']},{})[_0xe1e3('0x17')](function(){return _0x3b4d67;});}else{return _0x3b4d67;}})[_0xe1e3('0x28')](function(_0x28b1b7){logger[_0xe1e3('0x3a')](_0xe1e3('0x3b'),_0x28b1b7);throw _0x28b1b7;});}return _0x3b4d67;})[_0xe1e3('0x17')](respondWithResult(_0x261769,0xc9))['catch'](handleError(_0x261769,null));};exports[_0xe1e3('0x16')]=function(_0x1b44fd,_0x5e2b09){if(_0x1b44fd['body']['id']){delete _0x1b44fd['body']['id'];}return db[_0xe1e3('0x1f')][_0xe1e3('0x33')]({'where':{'id':_0x1b44fd[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x5e2b09,null))[_0xe1e3('0x17')](saveUpdates(_0x1b44fd[_0xe1e3('0x35')],null))[_0xe1e3('0x17')](respondWithResult(_0x5e2b09,null))['catch'](handleError(_0x5e2b09,null));};exports[_0xe1e3('0x18')]=function(_0x5c4b65,_0x24b18d){return db[_0xe1e3('0x1f')][_0xe1e3('0x33')]({'where':{'id':_0x5c4b65['params']['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x24b18d,null))[_0xe1e3('0x17')](removeEntity(_0x24b18d,null))[_0xe1e3('0x28')](handleError(_0x24b18d,null));};exports[_0xe1e3('0x3c')]=function(_0x43e295,_0x3b18cc){return db['WhatsappQueue'][_0xe1e3('0x3c')]()[_0xe1e3('0x17')](respondWithResult(_0x3b18cc,null))['catch'](handleError(_0x3b18cc,null));};exports[_0xe1e3('0x3d')]=function(_0x4f5bfe,_0x1465b1){var _0x33f2f1={'raw':!![],'where':{}},_0x4b45c5={},_0x483bf1;return db[_0xe1e3('0x1f')]['findOne']({'where':{'id':_0x4f5bfe[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x1465b1,null))['then'](function(_0x1dd30e){if(_0x1dd30e){_0x483bf1=_0x1dd30e[_0xe1e3('0x19')]({'plain':!![]});_0x4b45c5[_0xe1e3('0x2c')]=_[_0xe1e3('0x2a')](db['UserWhatsappQueue'][_0xe1e3('0x20')]);_0x4b45c5['query']=_[_0xe1e3('0x2a')](_0x4f5bfe['query']);_0x4b45c5[_0xe1e3('0x2b')]=_['intersection'](_0x4b45c5[_0xe1e3('0x2c')],_0x4b45c5[_0xe1e3('0x25')]);_0x33f2f1[_0xe1e3('0x2d')]=_[_0xe1e3('0x3e')](_0x4b45c5[_0xe1e3('0x2c')],qs[_0xe1e3('0x2e')](_0x4f5bfe[_0xe1e3('0x25')][_0xe1e3('0x2e')]));_0x33f2f1[_0xe1e3('0x2d')]=_0x33f2f1['attributes'][_0xe1e3('0x2f')]?_0x33f2f1['attributes']:_0x4b45c5[_0xe1e3('0x2c')];if(!_0x4f5bfe[_0xe1e3('0x25')]['hasOwnProperty'](_0xe1e3('0x3f'))){_0x33f2f1[_0xe1e3('0x11')]=qs[_0xe1e3('0x11')](_0x4f5bfe[_0xe1e3('0x25')]['limit']);_0x33f2f1[_0xe1e3('0xf')]=qs[_0xe1e3('0xf')](_0x4f5bfe[_0xe1e3('0x25')][_0xe1e3('0xf')]);}_0x33f2f1[_0xe1e3('0x40')]=qs['sort'](_0x4f5bfe['query'][_0xe1e3('0x41')]);_0x33f2f1[_0xe1e3('0x23')]=qs['filters'](_[_0xe1e3('0x42')](_0x4f5bfe[_0xe1e3('0x25')],_0x4b45c5[_0xe1e3('0x2b')]));_0x33f2f1[_0xe1e3('0x23')]['WhatsappQueueId']=_0x1dd30e['id'];if(_0x4f5bfe[_0xe1e3('0x25')]['filter']){_0x33f2f1[_0xe1e3('0x23')]=_[_0xe1e3('0x31')](_0x33f2f1[_0xe1e3('0x23')],{'$or':_[_0xe1e3('0x1e')](_0x33f2f1['attributes'],function(_0x43bada){var _0x453112={};_0x453112[_0x43bada]={'$like':'%'+_0x4f5bfe['query'][_0xe1e3('0x43')]+'%'};return _0x453112;})});}_0x33f2f1=_[_0xe1e3('0x31')]({},_0x33f2f1,_0x4f5bfe[_0xe1e3('0x32')]);return db[_0xe1e3('0x44')]['findAll'](_0x33f2f1);}})[_0xe1e3('0x17')](function(_0x36f26a){if(_0x36f26a){return db['User'][_0xe1e3('0x45')]({'where':{'id':_[_0xe1e3('0x1e')](_0x36f26a,'UserId'),'role':_0xe1e3('0x46')},'attributes':['id',_0xe1e3('0x1c'),_0xe1e3('0x47'),'updatedAt',_0xe1e3('0x48')]});}})[_0xe1e3('0x17')](function(_0x3ea11b){if(_0x3ea11b){return{'count':_0x3ea11b[_0xe1e3('0x12')],'rows':_[_0xe1e3('0x1e')](_0x3ea11b['rows'],function(_0x248434){return{'membername':_0x248434[_0xe1e3('0x1c')],'UserId':_0x248434['id'],'queue_name':_0x483bf1[_0xe1e3('0x1c')],'WhatsappQueueId':_0x483bf1['id'],'interface':util[_0xe1e3('0x49')](_0xe1e3('0x4a'),_0xe1e3('0x4b'),_0x248434['name']),'penalty':0x0,'paused':_0x248434[_0xe1e3('0x47')],'createdAt':_0x248434[_0xe1e3('0x48')],'updatedAt':_0x248434[_0xe1e3('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1e3('0x17')](respondWithFilteredResult(_0x1465b1,_0x33f2f1))[_0xe1e3('0x28')](handleError(_0x1465b1,null));};exports['getTeams']=function(_0x53808f,_0x14b81c){var _0x1f422d={};var _0x3ef58b={};var _0x5c7348;var _0x47355a;return db[_0xe1e3('0x1f')][_0xe1e3('0x4d')]({'where':{'id':_0x53808f[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x14b81c,null))[_0xe1e3('0x17')](function(_0x5a51ab){if(_0x5a51ab){_0x5c7348=_0x5a51ab;_0x3ef58b[_0xe1e3('0x2c')]=_[_0xe1e3('0x2a')](db[_0xe1e3('0x4e')][_0xe1e3('0x20')]);_0x3ef58b['query']=_['keys'](_0x53808f[_0xe1e3('0x25')]);_0x3ef58b[_0xe1e3('0x2b')]=_[_0xe1e3('0x3e')](_0x3ef58b[_0xe1e3('0x2c')],_0x3ef58b[_0xe1e3('0x25')]);_0x1f422d[_0xe1e3('0x2d')]=_['intersection'](_0x3ef58b[_0xe1e3('0x2c')],qs[_0xe1e3('0x2e')](_0x53808f[_0xe1e3('0x25')][_0xe1e3('0x2e')]));_0x1f422d[_0xe1e3('0x2d')]=_0x1f422d[_0xe1e3('0x2d')][_0xe1e3('0x2f')]?_0x1f422d[_0xe1e3('0x2d')]:_0x3ef58b[_0xe1e3('0x2c')];_0x1f422d[_0xe1e3('0x40')]=qs[_0xe1e3('0x41')](_0x53808f[_0xe1e3('0x25')][_0xe1e3('0x41')]);_0x1f422d[_0xe1e3('0x23')]=qs[_0xe1e3('0x2b')](_[_0xe1e3('0x42')](_0x53808f['query'],_0x3ef58b['filters']));if(_0x53808f[_0xe1e3('0x25')][_0xe1e3('0x43')]){_0x1f422d[_0xe1e3('0x23')]=_['merge'](_0x1f422d[_0xe1e3('0x23')],{'$or':_[_0xe1e3('0x1e')](_0x1f422d[_0xe1e3('0x2d')],function(_0x2da465){var _0x555fa2={};_0x555fa2[_0x2da465]={'$like':'%'+_0x53808f[_0xe1e3('0x25')]['filter']+'%'};return _0x555fa2;})});}_0x1f422d=_[_0xe1e3('0x31')]({},_0x1f422d,_0x53808f[_0xe1e3('0x32')]);return _0x5c7348[_0xe1e3('0x4f')](_0x1f422d);}})[_0xe1e3('0x17')](function(_0xcd15ba){if(_0xcd15ba){_0x47355a=_0xcd15ba['length'];if(!_0x53808f[_0xe1e3('0x25')][_0xe1e3('0x50')](_0xe1e3('0x3f'))){_0x1f422d['limit']=qs[_0xe1e3('0x11')](_0x53808f['query'][_0xe1e3('0x11')]);_0x1f422d['offset']=qs[_0xe1e3('0xf')](_0x53808f[_0xe1e3('0x25')][_0xe1e3('0xf')]);}return _0x5c7348[_0xe1e3('0x4f')](_0x1f422d);}})[_0xe1e3('0x17')](function(_0x29259d){if(_0x29259d){return _0x29259d?{'count':_0x47355a,'rows':_0x29259d}:null;}})['then'](respondWithResult(_0x14b81c,null))[_0xe1e3('0x28')](handleError(_0x14b81c,null));};exports['addTeams']=function(_0x54de9f,_0x3d1300){var _0x2a4d0e=_0x54de9f[_0xe1e3('0x35')]['ids'];return db[_0xe1e3('0x4e')][_0xe1e3('0x26')]({'where':{'id':_0x2a4d0e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe1e3('0x51'),'attributes':['id',_0xe1e3('0x1c'),_0xe1e3('0x52'),'voicePause',_0xe1e3('0x53')],'raw':!![]}]})[_0xe1e3('0x17')](function(_0x469e67){if(_0x469e67){var _0x32db70=_[_0xe1e3('0x54')](_0x469e67,function(_0x34e91c){var _0x4eb609=_0x34e91c[_0xe1e3('0x19')]({'plain':!![]});return _0x4eb609['Agents'];});return db[_0xe1e3('0x1f')][_0xe1e3('0x33')]({'where':{'id':_0x54de9f['params']['id']}})[_0xe1e3('0x17')](function(_0x555e2f){return db[_0xe1e3('0x55')][_0xe1e3('0x56')](function(_0x1b3988){return _0x555e2f[_0xe1e3('0x57')](_0x2a4d0e,{'transaction':_0x1b3988})[_0xe1e3('0x17')](function(){return BPromise[_0xe1e3('0x58')](_0x32db70,function(_0x262cd4){return db[_0xe1e3('0x44')][_0xe1e3('0x59')]({'where':{'UserId':_0x262cd4['id'],'WhatsappQueueId':_0x54de9f['params']['id']},'transaction':_0x1b3988});});})[_0xe1e3('0x17')](function(){_0x32db70[_0xe1e3('0x5a')](function(_0x38e98d){socket[_0xe1e3('0x5b')](_0xe1e3('0x5c'),{'UserId':_0x38e98d['id'],'WhatsappQueueId':_0x555e2f['id']});});});});});}})[_0xe1e3('0x17')](respondWithStatusCode(_0x3d1300,null))['catch'](handleError(_0x3d1300,null));};exports['removeTeams']=function(_0x441b3c,_0x202023){return db[_0xe1e3('0x4e')][_0xe1e3('0x26')]({'where':{'id':_0x441b3c[_0xe1e3('0x25')][_0xe1e3('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xe1e3('0x5e')],'as':_0xe1e3('0x51'),'attributes':['id'],'raw':!![]}]})[_0xe1e3('0x17')](handleEntityNotFound(_0x202023,null))['then'](function(_0x293a99){var _0x4aafe2=_[_0xe1e3('0x1e')](_0x293a99,'id');var _0x44c633=[];var _0x16274e=[];var _0x3926de=squel['select']();_0x3926de[_0xe1e3('0x5f')](_0xe1e3('0x60'))[_0xe1e3('0x61')](_0xe1e3('0x62'),'tq')[_0xe1e3('0x63')](_0xe1e3('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe1e3('0x23')](_0xe1e3('0x65'),_0x441b3c[_0xe1e3('0x29')]['id']);for(var _0xf64177=0x0;_0xf64177<_0x293a99[_0xe1e3('0x2f')];_0xf64177+=0x1){let _0x4b3288=_0x293a99[_0xf64177];for(var _0x17fe3d=0x0;_0x17fe3d<_0x4b3288[_0xe1e3('0x51')][_0xe1e3('0x2f')];_0x17fe3d+=0x1){let _0x554e57=_0x4b3288[_0xe1e3('0x51')][_0x17fe3d];var _0x34324d=_0x3926de[_0xe1e3('0x66')]();_0x34324d[_0xe1e3('0x23')](_0xe1e3('0x67'),_0x554e57['id']);_0x16274e[_0xe1e3('0x68')](db[_0xe1e3('0x55')][_0xe1e3('0x25')](_0x34324d['toString'](),{'type':db[_0xe1e3('0x55')]['QueryTypes'][_0xe1e3('0x69')]})[_0xe1e3('0x17')](function(_0x5a7960){if(_0x5a7960[_0xe1e3('0x2f')]===0x1){return _0x554e57['id'];}else{var _0x5aaa9c=_[_0xe1e3('0x6a')](_['map'](_0x5a7960,_0xe1e3('0x6b')),function(_0x559d5b){return _['includes'](_0x4aafe2,_0x559d5b);});if(_0x5aaa9c){return _0x554e57['id'];}}}));}}return BPromise[_0xe1e3('0x6c')](_0x16274e)[_0xe1e3('0x17')](function(_0x1bc617){_0x44c633=_(_0x44c633)[_0xe1e3('0x6d')](_0x1bc617)[_0xe1e3('0x6e')]()[_0xe1e3('0x6f')]();return db[_0xe1e3('0x1f')][_0xe1e3('0x33')]({'where':{'id':_0x441b3c[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](function(_0x5570bc){return db[_0xe1e3('0x55')]['transaction'](function(_0x2934d3){return _0x5570bc[_0xe1e3('0x70')](_0x441b3c[_0xe1e3('0x25')][_0xe1e3('0x5d')],{'transaction':_0x2934d3})[_0xe1e3('0x17')](function(){if(!_[_0xe1e3('0x71')](_0x44c633)){return _0x5570bc[_0xe1e3('0x72')](_0x44c633,{'transaction':_0x2934d3});}})[_0xe1e3('0x17')](function(){_0x44c633[_0xe1e3('0x5a')](function(_0x121806){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x121806,'WhatsappQueueId':_0x5570bc['id']});});});});});});})[_0xe1e3('0x17')](respondWithStatusCode(_0x202023,null))[_0xe1e3('0x28')](handleError(_0x202023,null));};exports[_0xe1e3('0x73')]=function(_0x789139,_0x2b0173){return db['WhatsappQueue'][_0xe1e3('0x33')]({'where':{'id':_0x789139[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x2b0173,null))[_0xe1e3('0x17')](function(_0x83854e){if(_0x83854e){return _0x83854e[_0xe1e3('0x73')](_0x789139['body'][_0xe1e3('0x5d')],_[_0xe1e3('0x74')](_0x789139[_0xe1e3('0x35')],[_0xe1e3('0x5d'),'id'])||{})[_0xe1e3('0x75')](function(_0x148385){for(var _0x501488=0x0;_0x501488<_0x789139[_0xe1e3('0x35')][_0xe1e3('0x5d')][_0xe1e3('0x2f')];_0x501488+=0x1){socket['emit'](_0xe1e3('0x5c'),{'UserId':Number(_0x789139[_0xe1e3('0x35')]['ids'][_0x501488]),'WhatsappQueueId':Number(_0x789139[_0xe1e3('0x29')]['id'])});}return _0x148385;});}})['then'](respondWithResult(_0x2b0173,null))[_0xe1e3('0x28')](handleError(_0x2b0173,null));};exports[_0xe1e3('0x72')]=function(_0x330ca4,_0x4efd06){return db[_0xe1e3('0x1f')][_0xe1e3('0x33')]({'where':{'id':_0x330ca4[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x4efd06,null))[_0xe1e3('0x17')](function(_0x5c6f4e){if(_0x5c6f4e){return _0x5c6f4e['removeAgents'](_0x330ca4[_0xe1e3('0x25')][_0xe1e3('0x5d')])[_0xe1e3('0x17')](function(){if(_['isArray'](_0x330ca4[_0xe1e3('0x25')][_0xe1e3('0x5d')])){for(var _0x44c268=0x0;_0x44c268<_0x330ca4[_0xe1e3('0x25')][_0xe1e3('0x5d')][_0xe1e3('0x2f')];_0x44c268+=0x1){socket['emit'](_0xe1e3('0x76'),{'UserId':Number(_0x330ca4[_0xe1e3('0x25')][_0xe1e3('0x5d')][_0x44c268]),'WhatsappQueueId':Number(_0x330ca4[_0xe1e3('0x29')]['id'])});}}else{socket['emit'](_0xe1e3('0x76'),{'UserId':Number(_0x330ca4[_0xe1e3('0x25')][_0xe1e3('0x5d')]),'WhatsappQueueId':Number(_0x330ca4[_0xe1e3('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x4efd06,null))['catch'](handleError(_0x4efd06,null));};exports[_0xe1e3('0x77')]=function(_0x1a62df,_0x19c350){var _0x1947f7={};var _0x114775={};var _0x4cf3a3;var _0x543c6f;return db[_0xe1e3('0x1f')]['findOne']({'where':{'id':_0x1a62df[_0xe1e3('0x29')]['id']}})[_0xe1e3('0x17')](handleEntityNotFound(_0x19c350,null))[_0xe1e3('0x17')](function(_0x34161e){if(_0x34161e){_0x4cf3a3=_0x34161e;_0x114775[_0xe1e3('0x2c')]=_[_0xe1e3('0x2a')](db[_0xe1e3('0x5e')]['rawAttributes']);_0x114775[_0xe1e3('0x25')]=_[_0xe1e3('0x2a')](_0x1a62df[_0xe1e3('0x25')]);_0x114775[_0xe1e3('0x2b')]=_[_0xe1e3('0x3e')](_0x114775['model'],_0x114775[_0xe1e3('0x25')]);_0x1947f7[_0xe1e3('0x2d')]=_['intersection'](_0x114775[_0xe1e3('0x2c')],qs['fields'](_0x1a62df[_0xe1e3('0x25')]['fields']));_0x1947f7[_0xe1e3('0x2d')]=_0x1947f7['attributes'][_0xe1e3('0x2f')]?_0x1947f7['attributes']:_0x114775['model'];_0x1947f7[_0xe1e3('0x40')]=qs[_0xe1e3('0x41')](_0x1a62df[_0xe1e3('0x25')][_0xe1e3('0x41')]);_0x1947f7[_0xe1e3('0x23')]=qs[_0xe1e3('0x2b')](_[_0xe1e3('0x42')](_0x1a62df['query'],_0x114775[_0xe1e3('0x2b')]));if(_0x1a62df[_0xe1e3('0x25')][_0xe1e3('0x43')]){_0x1947f7[_0xe1e3('0x23')]=_[_0xe1e3('0x31')](_0x1947f7[_0xe1e3('0x23')],{'$or':_[_0xe1e3('0x1e')](_0x1947f7[_0xe1e3('0x2d')],function(_0x52bd59){var _0xed40f7={};_0xed40f7[_0x52bd59]={'$like':'%'+_0x1a62df['query'][_0xe1e3('0x43')]+'%'};return _0xed40f7;})});}_0x1947f7=_[_0xe1e3('0x31')]({},_0x1947f7,_0x1a62df[_0xe1e3('0x32')]);return _0x4cf3a3[_0xe1e3('0x77')](_0x1947f7);}})[_0xe1e3('0x17')](function(_0x147114){if(_0x147114){_0x543c6f=_0x147114[_0xe1e3('0x2f')];if(!_0x1a62df['query'][_0xe1e3('0x50')]('nolimit')){_0x1947f7[_0xe1e3('0x11')]=qs['limit'](_0x1a62df[_0xe1e3('0x25')][_0xe1e3('0x11')]);_0x1947f7[_0xe1e3('0xf')]=qs[_0xe1e3('0xf')](_0x1a62df[_0xe1e3('0x25')][_0xe1e3('0xf')]);}return _0x4cf3a3[_0xe1e3('0x77')](_0x1947f7);}})[_0xe1e3('0x17')](function(_0x1390ef){if(_0x1390ef){return _0x1390ef?{'count':_0x543c6f,'rows':_0x1390ef}:null;}})[_0xe1e3('0x17')](respondWithResult(_0x19c350,null))[_0xe1e3('0x28')](handleError(_0x19c350,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 56ce0c0..9466662 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 _0x5b8b=['WhatsappQueue','save','update','remove','emit','hook','events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5b8b,0xe6));var _0xb5b8=function(_0x582421,_0xe8d453){_0x582421=_0x582421-0x0;var _0x37d703=_0x5b8b[_0x582421];return _0x37d703;};'use strict';var EventEmitter=require(_0xb5b8('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb5b8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb5b8('0x2'),'afterUpdate':_0xb5b8('0x3'),'afterDestroy':_0xb5b8('0x4')};function emitEvent(_0x3aef95){return function(_0x4bb6c7,_0x556c51,_0x42afe0){WhatsappQueueEvents[_0xb5b8('0x5')](_0x3aef95+':'+_0x4bb6c7['id'],_0x4bb6c7);WhatsappQueueEvents[_0xb5b8('0x5')](_0x3aef95,_0x4bb6c7);_0x42afe0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb5b8('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x9ce5=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x51b85f,_0xd3cf3a){var _0x2aded1=function(_0x439243){while(--_0x439243){_0x51b85f['push'](_0x51b85f['shift']());}};_0x2aded1(++_0xd3cf3a);}(_0x9ce5,0x126));var _0x59ce=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9ce5[_0x42bdad];return _0x122626;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x59ce('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x59ce('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x59ce('0x2'),'afterDestroy':_0x59ce('0x3')};function emitEvent(_0x3b8f84){return function(_0x64593f,_0x5bb653,_0x1a0ad2){WhatsappQueueEvents[_0x59ce('0x4')](_0x3b8f84+':'+_0x64593f['id'],_0x64593f);WhatsappQueueEvents['emit'](_0x3b8f84,_0x64593f);_0x1a0ad2(null);};}for(var e in events){if(events[_0x59ce('0x5')](e)){var event=events[e];WhatsappQueue[_0x59ce('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0767e85..f1b204f 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 _0xf319=['request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf319,0x126));var _0x9f31=function(_0x579f4e,_0x28a2c8){_0x579f4e=_0x579f4e-0x0;var _0x5efd59=_0xf319[_0x579f4e];return _0x5efd59;};'use strict';var _=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var logger=require('../../config/logger')(_0x9f31('0x2'));var moment=require(_0x9f31('0x3'));var BPromise=require(_0x9f31('0x4'));var rp=require(_0x9f31('0x5'));var fs=require('fs');var path=require(_0x9f31('0x6'));var rimraf=require('rimraf');var config=require(_0x9f31('0x7'));var attributes=require(_0x9f31('0x8'));module[_0x9f31('0x9')]=function(_0xcf4a9b,_0x39623c){return _0xcf4a9b[_0x9f31('0xa')](_0x9f31('0xb'),attributes,{'tableName':_0x9f31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf404=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','util'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xf404,0x1ac));var _0x4f40=function(_0x32abaf,_0x319a63){_0x32abaf=_0x32abaf-0x0;var _0x3ff745=_0xf404[_0x32abaf];return _0x3ff745;};'use strict';var _=require('lodash');var util=require(_0x4f40('0x0'));var logger=require(_0x4f40('0x1'))(_0x4f40('0x2'));var moment=require('moment');var BPromise=require(_0x4f40('0x3'));var rp=require(_0x4f40('0x4'));var fs=require('fs');var path=require(_0x4f40('0x5'));var rimraf=require(_0x4f40('0x6'));var config=require(_0x4f40('0x7'));var attributes=require(_0x4f40('0x8'));module[_0x4f40('0x9')]=function(_0x8dacae,_0x3148f5){return _0x8dacae['define'](_0x4f40('0xa'),attributes,{'tableName':'whatsapp_queues','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 515a61d..a9ce83f 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 _0xb94d=['info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','GetWhatsappQueue','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then'];(function(_0x52d723,_0x15b9d9){var _0x2b4fa5=function(_0x564044){while(--_0x564044){_0x52d723['push'](_0x52d723['shift']());}};_0x2b4fa5(++_0x15b9d9);}(_0xb94d,0x1da));var _0xdb94=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xb94d[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0xdb94('0x0'));var util=require(_0xdb94('0x1'));var moment=require(_0xdb94('0x2'));var BPromise=require(_0xdb94('0x3'));var rs=require(_0xdb94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb94('0x5'));var logger=require(_0xdb94('0x6'))('rpc');var config=require(_0xdb94('0x7'));var jayson=require(_0xdb94('0x8'));var client=jayson[_0xdb94('0x9')][_0xdb94('0xa')]({'port':0x232a});config[_0xdb94('0xb')]=_[_0xdb94('0xc')](config[_0xdb94('0xb')],{'host':_0xdb94('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb94('0xb')]));require(_0xdb94('0xe'))[_0xdb94('0xf')](socket);function respondWithRpcPromise(_0xe40e32,_0x41828a,_0x140af9){return new BPromise(function(_0x4e1e,_0x22250b){return client[_0xdb94('0x10')](_0xe40e32,_0x140af9)[_0xdb94('0x11')](function(_0x4fa913){logger[_0xdb94('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x41828a,'request\x20sent');logger[_0xdb94('0x13')](_0xdb94('0x14'),_0x41828a,_0xdb94('0x15'),JSON[_0xdb94('0x16')](_0x4fa913));if(_0x4fa913[_0xdb94('0x17')]){if(_0x4fa913[_0xdb94('0x17')][_0xdb94('0x18')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x41828a,_0x4fa913[_0xdb94('0x17')][_0xdb94('0x19')]);return _0x22250b(_0x4fa913[_0xdb94('0x17')][_0xdb94('0x19')]);}logger['error'](_0xdb94('0x1a'),_0x41828a,_0x4fa913[_0xdb94('0x17')]['message']);return _0x4e1e(_0x4fa913[_0xdb94('0x17')][_0xdb94('0x19')]);}else{logger[_0xdb94('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x41828a,_0xdb94('0x15'));_0x4e1e(_0x4fa913[_0xdb94('0x1b')]['message']);}})[_0xdb94('0x1c')](function(_0x4634ce){logger[_0xdb94('0x17')](_0xdb94('0x1a'),_0x41828a,_0x4634ce);_0x22250b(_0x4634ce);});});}exports['GetWhatsappQueue']=function(_0x1e8982){var _0x27fb84=this;return new Promise(function(_0x1907cd,_0x10fa8b){return db[_0xdb94('0x1d')][_0xdb94('0x1e')]({'raw':_0x1e8982[_0xdb94('0x1f')]?_0x1e8982[_0xdb94('0x1f')][_0xdb94('0x20')]===undefined?!![]:![]:!![],'where':_0x1e8982[_0xdb94('0x1f')]?_0x1e8982['options'][_0xdb94('0x21')]||null:null,'attributes':_0x1e8982[_0xdb94('0x1f')]?_0x1e8982[_0xdb94('0x1f')][_0xdb94('0x22')]||null:null,'limit':_0x1e8982[_0xdb94('0x1f')]?_0x1e8982[_0xdb94('0x1f')]['limit']||null:null,'include':_0x1e8982[_0xdb94('0x1f')]?_0x1e8982[_0xdb94('0x1f')][_0xdb94('0x23')]?_[_0xdb94('0x24')](_0x1e8982[_0xdb94('0x1f')][_0xdb94('0x23')],function(_0x141132){return{'model':db[_0x141132[_0xdb94('0x25')]],'as':_0x141132['as'],'attributes':_0x141132[_0xdb94('0x22')],'include':_0x141132['include']?_['map'](_0x141132['include'],function(_0x13174e){return{'model':db[_0x13174e['model']],'as':_0x13174e['as'],'attributes':_0x13174e[_0xdb94('0x22')],'include':_0x13174e[_0xdb94('0x23')]?_[_0xdb94('0x24')](_0x13174e[_0xdb94('0x23')],function(_0xc711b6){return{'model':db[_0xc711b6[_0xdb94('0x25')]],'as':_0xc711b6['as'],'attributes':_0xc711b6[_0xdb94('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdb94('0x11')](function(_0x5abd98){logger[_0xdb94('0x12')](_0xdb94('0x26'),_0x1e8982);logger['debug']('GetWhatsappQueue',_0x1e8982,JSON[_0xdb94('0x16')](_0x5abd98));_0x1907cd(_0x5abd98);})['catch'](function(_0x10a9d0){logger[_0xdb94('0x17')](_0xdb94('0x26'),_0x10a9d0['message'],_0x1e8982);_0x10fa8b(_0x27fb84['error'](0x1f4,_0x10a9d0['message']));});});};exports['ShowWhatsappQueue']=function(_0x2c0c9e){var _0x279bd1=this;return new Promise(function(_0x158a2f,_0x264393){return db[_0xdb94('0x1d')][_0xdb94('0x27')]({'raw':_0x2c0c9e[_0xdb94('0x1f')]?_0x2c0c9e[_0xdb94('0x1f')][_0xdb94('0x20')]===undefined?!![]:![]:!![],'where':_0x2c0c9e['options']?_0x2c0c9e[_0xdb94('0x1f')]['where']||null:null,'attributes':_0x2c0c9e[_0xdb94('0x1f')]?_0x2c0c9e[_0xdb94('0x1f')][_0xdb94('0x22')]||null:null,'include':_0x2c0c9e[_0xdb94('0x1f')]?_0x2c0c9e[_0xdb94('0x1f')][_0xdb94('0x23')]?_[_0xdb94('0x24')](_0x2c0c9e['options'][_0xdb94('0x23')],function(_0x30b2c2){return{'model':db[_0x30b2c2[_0xdb94('0x25')]],'as':_0x30b2c2['as'],'attributes':_0x30b2c2[_0xdb94('0x22')],'include':_0x30b2c2[_0xdb94('0x23')]?_[_0xdb94('0x24')](_0x30b2c2['include'],function(_0x42b2db){return{'model':db[_0x42b2db[_0xdb94('0x25')]],'as':_0x42b2db['as'],'attributes':_0x42b2db[_0xdb94('0x22')],'include':_0x42b2db['include']?_[_0xdb94('0x24')](_0x42b2db[_0xdb94('0x23')],function(_0x32dcb6){return{'model':db[_0x32dcb6[_0xdb94('0x25')]],'as':_0x32dcb6['as'],'attributes':_0x32dcb6[_0xdb94('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdb94('0x11')](function(_0x3a6e3c){logger[_0xdb94('0x12')](_0xdb94('0x28'),_0x2c0c9e);logger[_0xdb94('0x13')]('ShowWhatsappQueue',_0x2c0c9e,JSON[_0xdb94('0x16')](_0x3a6e3c));_0x158a2f(_0x3a6e3c);})[_0xdb94('0x1c')](function(_0xff4ac2){logger[_0xdb94('0x17')](_0xdb94('0x28'),_0xff4ac2[_0xdb94('0x19')],_0x2c0c9e);_0x264393(_0x279bd1[_0xdb94('0x17')](0x1f4,_0xff4ac2[_0xdb94('0x19')]));});});}; \ No newline at end of file +var _0x5733=['ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','then'];(function(_0x5b9b56,_0x1dd1cc){var _0x3360a1=function(_0xe156e5){while(--_0xe156e5){_0x5b9b56['push'](_0x5b9b56['shift']());}};_0x3360a1(++_0x1dd1cc);}(_0x5733,0xff));var _0x3573=function(_0x13f9ce,_0x36b3f2){_0x13f9ce=_0x13f9ce-0x0;var _0x4d6fd4=_0x5733[_0x13f9ce];return _0x4d6fd4;};'use strict';var _=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var moment=require(_0x3573('0x2'));var BPromise=require(_0x3573('0x3'));var rs=require(_0x3573('0x4'));var fs=require('fs');var Redis=require(_0x3573('0x5'));var db=require(_0x3573('0x6'))['db'];var utils=require(_0x3573('0x7'));var logger=require(_0x3573('0x8'))(_0x3573('0x9'));var config=require('../../config/environment');var jayson=require(_0x3573('0xa'));var client=jayson[_0x3573('0xb')]['http']({'port':0x232a});config[_0x3573('0xc')]=_[_0x3573('0xd')](config[_0x3573('0xc')],{'host':_0x3573('0xe'),'port':0x18eb});var socket=require(_0x3573('0xf'))(new Redis(config[_0x3573('0xc')]));require(_0x3573('0x10'))['register'](socket);function respondWithRpcPromise(_0x2a00c3,_0xeed32e,_0x4bf212){return new BPromise(function(_0x11b279,_0x119f24){return client['request'](_0x2a00c3,_0x4bf212)['then'](function(_0x130e4d){logger['info'](_0x3573('0x11'),_0xeed32e,_0x3573('0x12'));logger[_0x3573('0x13')](_0x3573('0x14'),_0xeed32e,_0x3573('0x12'),JSON[_0x3573('0x15')](_0x130e4d));if(_0x130e4d[_0x3573('0x16')]){if(_0x130e4d[_0x3573('0x16')][_0x3573('0x17')]===0x1f4){logger[_0x3573('0x16')](_0x3573('0x11'),_0xeed32e,_0x130e4d[_0x3573('0x16')][_0x3573('0x18')]);return _0x119f24(_0x130e4d['error']['message']);}logger[_0x3573('0x16')](_0x3573('0x11'),_0xeed32e,_0x130e4d[_0x3573('0x16')][_0x3573('0x18')]);return _0x11b279(_0x130e4d['error'][_0x3573('0x18')]);}else{logger[_0x3573('0x19')](_0x3573('0x11'),_0xeed32e,_0x3573('0x12'));_0x11b279(_0x130e4d[_0x3573('0x1a')][_0x3573('0x18')]);}})[_0x3573('0x1b')](function(_0x1a916e){logger[_0x3573('0x16')](_0x3573('0x11'),_0xeed32e,_0x1a916e);_0x119f24(_0x1a916e);});});}exports[_0x3573('0x1c')]=function(_0x2ff2c0){var _0x56709b=this;return new Promise(function(_0x55c4f2,_0x29f6ce){return db['WhatsappQueue'][_0x3573('0x1d')]({'raw':_0x2ff2c0[_0x3573('0x1e')]?_0x2ff2c0['options'][_0x3573('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ff2c0[_0x3573('0x1e')]?_0x2ff2c0[_0x3573('0x1e')][_0x3573('0x20')]||null:null,'attributes':_0x2ff2c0[_0x3573('0x1e')]?_0x2ff2c0[_0x3573('0x1e')][_0x3573('0x21')]||null:null,'limit':_0x2ff2c0['options']?_0x2ff2c0[_0x3573('0x1e')][_0x3573('0x22')]||null:null,'include':_0x2ff2c0[_0x3573('0x1e')]?_0x2ff2c0[_0x3573('0x1e')]['include']?_[_0x3573('0x23')](_0x2ff2c0['options'][_0x3573('0x24')],function(_0x38fc85){return{'model':db[_0x38fc85[_0x3573('0x25')]],'as':_0x38fc85['as'],'attributes':_0x38fc85[_0x3573('0x21')],'include':_0x38fc85[_0x3573('0x24')]?_['map'](_0x38fc85['include'],function(_0x9f6ec6){return{'model':db[_0x9f6ec6[_0x3573('0x25')]],'as':_0x9f6ec6['as'],'attributes':_0x9f6ec6[_0x3573('0x21')],'include':_0x9f6ec6[_0x3573('0x24')]?_[_0x3573('0x23')](_0x9f6ec6[_0x3573('0x24')],function(_0xdc85f9){return{'model':db[_0xdc85f9[_0x3573('0x25')]],'as':_0xdc85f9['as'],'attributes':_0xdc85f9[_0x3573('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3573('0x26')](function(_0xcdae8e){logger[_0x3573('0x19')](_0x3573('0x1c'),_0x2ff2c0);logger[_0x3573('0x13')]('GetWhatsappQueue',_0x2ff2c0,JSON[_0x3573('0x15')](_0xcdae8e));_0x55c4f2(_0xcdae8e);})[_0x3573('0x1b')](function(_0x4fe251){logger[_0x3573('0x16')](_0x3573('0x1c'),_0x4fe251['message'],_0x2ff2c0);_0x29f6ce(_0x56709b[_0x3573('0x16')](0x1f4,_0x4fe251[_0x3573('0x18')]));});});};exports[_0x3573('0x27')]=function(_0x2969c1){var _0x5f316d=this;return new Promise(function(_0x384178,_0x132aa4){return db[_0x3573('0x28')][_0x3573('0x29')]({'raw':_0x2969c1[_0x3573('0x1e')]?_0x2969c1[_0x3573('0x1e')][_0x3573('0x1f')]===undefined?!![]:![]:!![],'where':_0x2969c1[_0x3573('0x1e')]?_0x2969c1[_0x3573('0x1e')][_0x3573('0x20')]||null:null,'attributes':_0x2969c1[_0x3573('0x1e')]?_0x2969c1[_0x3573('0x1e')][_0x3573('0x21')]||null:null,'include':_0x2969c1[_0x3573('0x1e')]?_0x2969c1['options'][_0x3573('0x24')]?_[_0x3573('0x23')](_0x2969c1[_0x3573('0x1e')][_0x3573('0x24')],function(_0x5f5789){return{'model':db[_0x5f5789['model']],'as':_0x5f5789['as'],'attributes':_0x5f5789[_0x3573('0x21')],'include':_0x5f5789[_0x3573('0x24')]?_['map'](_0x5f5789[_0x3573('0x24')],function(_0x59db31){return{'model':db[_0x59db31[_0x3573('0x25')]],'as':_0x59db31['as'],'attributes':_0x59db31[_0x3573('0x21')],'include':_0x59db31[_0x3573('0x24')]?_['map'](_0x59db31[_0x3573('0x24')],function(_0x2e6d01){return{'model':db[_0x2e6d01[_0x3573('0x25')]],'as':_0x2e6d01['as'],'attributes':_0x2e6d01[_0x3573('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41947d){logger['info'](_0x3573('0x27'),_0x2969c1);logger[_0x3573('0x13')](_0x3573('0x27'),_0x2969c1,JSON[_0x3573('0x15')](_0x41947d));_0x384178(_0x41947d);})['catch'](function(_0x1652c5){logger[_0x3573('0x16')](_0x3573('0x27'),_0x1652c5[_0x3573('0x18')],_0x2969c1);_0x132aa4(_0x5f316d[_0x3573('0x16')](0x1f4,_0x1652c5[_0x3573('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5413d36..c8527e1 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 _0xa843=['whatsappQueue:','./whatsappQueue.events','remove','update','emit','register'];(function(_0x14f281,_0x770716){var _0x386d74=function(_0x303e52){while(--_0x303e52){_0x14f281['push'](_0x14f281['shift']());}};_0x386d74(++_0x770716);}(_0xa843,0xc7));var _0x3a84=function(_0x157bfc,_0x3e2d2b){_0x157bfc=_0x157bfc-0x0;var _0x1a7689=_0xa843[_0x157bfc];return _0x1a7689;};'use strict';var WhatsappQueueEvents=require(_0x3a84('0x0'));var events=['save',_0x3a84('0x1'),_0x3a84('0x2')];function createListener(_0x1931e7,_0x2f9cf9){return function(_0x5f3819){_0x2f9cf9[_0x3a84('0x3')](_0x1931e7,_0x5f3819);};}function removeListener(_0x7e9673,_0x1b9349){return function(){WhatsappQueueEvents['removeListener'](_0x7e9673,_0x1b9349);};}exports[_0x3a84('0x4')]=function(_0x35e762){for(var _0x280dd5=0x0,_0x3d9fb1=events['length'];_0x280dd5<_0x3d9fb1;_0x280dd5++){var _0x3def26=events[_0x280dd5];var _0x1cbcec=createListener(_0x3a84('0x5')+_0x3def26,_0x35e762);WhatsappQueueEvents['on'](_0x3def26,_0x1cbcec);}}; \ No newline at end of file +var _0x93e9=['whatsappQueue:','./whatsappQueue.events','save','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93e9,0x19e));var _0x993e=function(_0x48a586,_0x7dae91){_0x48a586=_0x48a586-0x0;var _0xe87f79=_0x93e9[_0x48a586];return _0xe87f79;};'use strict';var WhatsappQueueEvents=require(_0x993e('0x0'));var events=[_0x993e('0x1'),'remove',_0x993e('0x2')];function createListener(_0x41401e,_0x51367d){return function(_0x3557df){_0x51367d['emit'](_0x41401e,_0x3557df);};}function removeListener(_0x538efb,_0x34cde7){return function(){WhatsappQueueEvents[_0x993e('0x3')](_0x538efb,_0x34cde7);};}exports[_0x993e('0x4')]=function(_0x167dac){for(var _0x427bb5=0x0,_0x8b8310=events[_0x993e('0x5')];_0x427bb5<_0x8b8310;_0x427bb5++){var _0x3e9a58=events[_0x427bb5];var _0xc6ae1b=createListener(_0x993e('0x6')+_0x3e9a58,_0x167dac);WhatsappQueueEvents['on'](_0x3e9a58,_0xc6ae1b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c60ba9c..34f9867 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 _0xbe10=['get','isAuthenticated','index','/describe','describe','/:id','post','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0xbe10,0x1d2));var _0x0be1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbe10[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x0be1('0x0'));var util=require('util');var path=require(_0x0be1('0x1'));var timeout=require(_0x0be1('0x2'));var express=require(_0x0be1('0x3'));var router=express[_0x0be1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0be1('0x5'));var interaction=require(_0x0be1('0x6'));var config=require(_0x0be1('0x7'));var controller=require(_0x0be1('0x8'));router[_0x0be1('0x9')]('/',auth[_0x0be1('0xa')](),controller[_0x0be1('0xb')]);router['get'](_0x0be1('0xc'),auth[_0x0be1('0xa')](),controller[_0x0be1('0xd')]);router[_0x0be1('0x9')](_0x0be1('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0be1('0xf')]('/',auth[_0x0be1('0xa')](),controller['create']);router[_0x0be1('0x10')](_0x0be1('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0be1('0xe'),auth['isAuthenticated'](),controller[_0x0be1('0x11')]);module[_0x0be1('0x12')]=router; \ No newline at end of file +var _0xb507=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index'];(function(_0x134bca,_0x19fc26){var _0x5a1754=function(_0x3ecec1){while(--_0x3ecec1){_0x134bca['push'](_0x134bca['shift']());}};_0x5a1754(++_0x19fc26);}(_0xb507,0xdc));var _0x7b50=function(_0x35de8a,_0x7acd4b){_0x35de8a=_0x35de8a-0x0;var _0x9c759d=_0xb507[_0x35de8a];return _0x9c759d;};'use strict';var multer=require(_0x7b50('0x0'));var util=require('util');var path=require(_0x7b50('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b50('0x2'));var router=express['Router']();var fs_extra=require(_0x7b50('0x3'));var auth=require(_0x7b50('0x4'));var interaction=require(_0x7b50('0x5'));var config=require(_0x7b50('0x6'));var controller=require(_0x7b50('0x7'));router[_0x7b50('0x8')]('/',auth[_0x7b50('0x9')](),controller[_0x7b50('0xa')]);router[_0x7b50('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7b50('0xb')]);router[_0x7b50('0x8')](_0x7b50('0xc'),auth[_0x7b50('0x9')](),controller[_0x7b50('0xd')]);router[_0x7b50('0xe')]('/',auth[_0x7b50('0x9')](),controller[_0x7b50('0xf')]);router[_0x7b50('0x10')](_0x7b50('0xc'),auth[_0x7b50('0x9')](),controller[_0x7b50('0x11')]);router[_0x7b50('0x12')](_0x7b50('0xc'),auth['isAuthenticated'](),controller[_0x7b50('0x13')]);module[_0x7b50('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0acc467..9c0bda7 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4921cd,_0x23f67a){var _0x5e553f=function(_0x11eb4e){while(--_0x11eb4e){_0x4921cd['push'](_0x4921cd['shift']());}};_0x5e553f(++_0x23f67a);}(_0x7a54,0x106));var _0x47a5=function(_0xa5512a,_0x118beb){_0xa5512a=_0xa5512a-0x0;var _0x4fb816=_0x7a54[_0xa5512a];return _0x4fb816;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x44661e,_0x2fd669){var _0x32ab77=function(_0x28e38e){while(--_0x28e38e){_0x44661e['push'](_0x44661e['shift']());}};_0x32ab77(++_0x2fd669);}(_0x7a54,0x106));var _0x47a5=function(_0x1d59bc,_0x4583a4){_0x1d59bc=_0x1d59bc-0x0;var _0x338d18=_0x7a54[_0x1d59bc];return _0x338d18;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index affc026..14b50b9 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 _0xae60=['../../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','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x7d8a87,_0x2af37c){var _0x302742=function(_0x516b26){while(--_0x516b26){_0x7d8a87['push'](_0x7d8a87['shift']());}};_0x302742(++_0x2af37c);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xae60[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['WhatsappQueueReport'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));};exports[_0x0ae6('0x4e')]=function(_0x327b55,_0x173acd){return db[_0x0ae6('0x2e')][_0x0ae6('0x4e')]()[_0x0ae6('0x29')](respondWithResult(_0x173acd,null))[_0x0ae6('0x48')](handleError(_0x173acd,null));}; \ No newline at end of file +var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x4d3369,_0x1c842c){var _0x91723b=function(_0x54682b){while(--_0x54682b){_0x4d3369['push'](_0x4d3369['shift']());}};_0x91723b(++_0x1c842c);}(_0xf45e,0x115));var _0xef45=function(_0x560419,_0x32d862){_0x560419=_0x560419-0x0;var _0x56183d=_0xf45e[_0x560419];return _0x56183d;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 698c2ea..b056835 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 _0x9de1=['../../config/environment','./whatsappQueueReport.attributes','uniqueid','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x9de1,0xae));var _0x19de=function(_0x4d74e5,_0x48b33c){_0x4d74e5=_0x4d74e5-0x0;var _0x42ffe5=_0x9de1[_0x4d74e5];return _0x42ffe5;};'use strict';var _=require('lodash');var util=require(_0x19de('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x19de('0x1'));var BPromise=require(_0x19de('0x2'));var rp=require(_0x19de('0x3'));var fs=require('fs');var path=require(_0x19de('0x4'));var rimraf=require(_0x19de('0x5'));var config=require(_0x19de('0x6'));var attributes=require(_0x19de('0x7'));module['exports']=function(_0xcbf725,_0x5cfab6){return _0xcbf725['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x19de('0x8'),'fields':[_0x19de('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x563a=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x563a,0x1cd));var _0xa563=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x563a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa563('0x0'));var util=require('util');var logger=require(_0xa563('0x1'))(_0xa563('0x2'));var moment=require(_0xa563('0x3'));var BPromise=require(_0xa563('0x4'));var rp=require(_0xa563('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa563('0x6'));var config=require('../../config/environment');var attributes=require(_0xa563('0x7'));module[_0xa563('0x8')]=function(_0x6ed59e,_0x47f8c1){return _0x6ed59e['define'](_0xa563('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa563('0xa'),'fields':[_0xa563('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index fec012b..49949ad 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 _0x7259=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','create','body','options','raw','catch','WhatsappQueueReport','where','attributes','limit','UpdateWhatsappQueueReport','lodash'];(function(_0x24c103,_0x51ab17){var _0x3b4e51=function(_0x3e3160){while(--_0x3e3160){_0x24c103['push'](_0x24c103['shift']());}};_0x3b4e51(++_0x51ab17);}(_0x7259,0xd8));var _0x9725=function(_0x20135a,_0x1deb02){_0x20135a=_0x20135a-0x0;var _0x48e5c2=_0x7259[_0x20135a];return _0x48e5c2;};'use strict';var _=require(_0x9725('0x0'));var util=require(_0x9725('0x1'));var moment=require('moment');var BPromise=require(_0x9725('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9725('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9725('0x4'))(_0x9725('0x5'));var config=require(_0x9725('0x6'));var jayson=require(_0x9725('0x7'));var client=jayson[_0x9725('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x529720,_0x162a40,_0xf7fd58){return new BPromise(function(_0x53f492,_0x785366){return client['request'](_0x529720,_0xf7fd58)[_0x9725('0x9')](function(_0x3ae174){logger[_0x9725('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x162a40,_0x9725('0xb'));logger[_0x9725('0xc')](_0x9725('0xd'),_0x162a40,'request\x20sent',JSON[_0x9725('0xe')](_0x3ae174));if(_0x3ae174[_0x9725('0xf')]){if(_0x3ae174[_0x9725('0xf')][_0x9725('0x10')]===0x1f4){logger[_0x9725('0xf')](_0x9725('0x11'),_0x162a40,_0x3ae174[_0x9725('0xf')]['message']);return _0x785366(_0x3ae174[_0x9725('0xf')][_0x9725('0x12')]);}logger[_0x9725('0xf')](_0x9725('0x11'),_0x162a40,_0x3ae174[_0x9725('0xf')][_0x9725('0x12')]);return _0x53f492(_0x3ae174[_0x9725('0xf')][_0x9725('0x12')]);}else{logger[_0x9725('0xa')](_0x9725('0x11'),_0x162a40,_0x9725('0xb'));_0x53f492(_0x3ae174[_0x9725('0x13')][_0x9725('0x12')]);}})['catch'](function(_0x249b4a){logger[_0x9725('0xf')](_0x9725('0x11'),_0x162a40,_0x249b4a);_0x785366(_0x249b4a);});});}exports[_0x9725('0x14')]=function(_0x4865cd){var _0x4af909=this;return new Promise(function(_0x134ba2,_0x5574c3){return db['WhatsappQueueReport'][_0x9725('0x15')](_0x4865cd[_0x9725('0x16')],{'raw':_0x4865cd[_0x9725('0x17')]?_0x4865cd['options'][_0x9725('0x18')]===undefined?!![]:![]:!![]})[_0x9725('0x9')](function(_0x20132c){logger[_0x9725('0xa')](_0x9725('0x14'),_0x4865cd);logger[_0x9725('0xc')](_0x9725('0x14'),_0x4865cd,JSON[_0x9725('0xe')](_0x20132c));_0x134ba2(_0x20132c);})[_0x9725('0x19')](function(_0x56417b){logger[_0x9725('0xf')](_0x9725('0x14'),_0x56417b[_0x9725('0x12')],_0x4865cd);_0x5574c3(_0x4af909[_0x9725('0xf')](0x1f4,_0x56417b['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x53f678){var _0x2ad7c1=this;return new Promise(function(_0x3aff6f,_0x6ea5fe){return db[_0x9725('0x1a')]['update'](_0x53f678[_0x9725('0x16')],{'raw':_0x53f678[_0x9725('0x17')]?_0x53f678[_0x9725('0x17')][_0x9725('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f678['options']?_0x53f678['options'][_0x9725('0x1b')]||null:null,'attributes':_0x53f678[_0x9725('0x17')]?_0x53f678[_0x9725('0x17')][_0x9725('0x1c')]||null:null,'limit':_0x53f678['options']?_0x53f678[_0x9725('0x17')][_0x9725('0x1d')]||null:null})[_0x9725('0x9')](function(_0x4827ce){logger['info'](_0x9725('0x1e'),_0x53f678);logger[_0x9725('0xc')]('UpdateWhatsappQueueReport',_0x53f678,JSON[_0x9725('0xe')](_0x4827ce));_0x3aff6f(_0x4827ce);})[_0x9725('0x19')](function(_0x126d8f){logger[_0x9725('0xf')](_0x9725('0x1e'),_0x126d8f[_0x9725('0x12')],_0x53f678);_0x6ea5fe(_0x2ad7c1[_0x9725('0xf')](0x1f4,_0x126d8f[_0x9725('0x12')]));});});}; \ No newline at end of file +var _0x3ef4=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','body','options','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x3ef4,0x1de));var _0x43ef=function(_0x423797,_0x3d393b){_0x423797=_0x423797-0x0;var _0x57ec0c=_0x3ef4[_0x423797];return _0x57ec0c;};'use strict';var _=require(_0x43ef('0x0'));var util=require(_0x43ef('0x1'));var moment=require(_0x43ef('0x2'));var BPromise=require(_0x43ef('0x3'));var rs=require(_0x43ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43ef('0x5'))['db'];var utils=require(_0x43ef('0x6'));var logger=require(_0x43ef('0x7'))('rpc');var config=require(_0x43ef('0x8'));var jayson=require(_0x43ef('0x9'));var client=jayson[_0x43ef('0xa')][_0x43ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51c087,_0x27f37d,_0x26f139){return new BPromise(function(_0xcd8e0b,_0x482c30){return client['request'](_0x51c087,_0x26f139)[_0x43ef('0xc')](function(_0x20dc15){logger['info'](_0x43ef('0xd'),_0x27f37d,_0x43ef('0xe'));logger[_0x43ef('0xf')](_0x43ef('0x10'),_0x27f37d,_0x43ef('0xe'),JSON['stringify'](_0x20dc15));if(_0x20dc15[_0x43ef('0x11')]){if(_0x20dc15[_0x43ef('0x11')]['code']===0x1f4){logger[_0x43ef('0x11')](_0x43ef('0xd'),_0x27f37d,_0x20dc15[_0x43ef('0x11')][_0x43ef('0x12')]);return _0x482c30(_0x20dc15['error'][_0x43ef('0x12')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x27f37d,_0x20dc15[_0x43ef('0x11')]['message']);return _0xcd8e0b(_0x20dc15['error'][_0x43ef('0x12')]);}else{logger[_0x43ef('0x13')](_0x43ef('0xd'),_0x27f37d,'request\x20sent');_0xcd8e0b(_0x20dc15['result'][_0x43ef('0x12')]);}})[_0x43ef('0x14')](function(_0x3d7065){logger['error'](_0x43ef('0xd'),_0x27f37d,_0x3d7065);_0x482c30(_0x3d7065);});});}exports['CreateWhatsappQueueReport']=function(_0x5b0217){var _0x4edbd6=this;return new Promise(function(_0x4595ae,_0x10bda4){return db['WhatsappQueueReport']['create'](_0x5b0217[_0x43ef('0x15')],{'raw':_0x5b0217[_0x43ef('0x16')]?_0x5b0217[_0x43ef('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x43ef('0xc')](function(_0x39618e){logger['info'](_0x43ef('0x17'),_0x5b0217);logger[_0x43ef('0xf')](_0x43ef('0x17'),_0x5b0217,JSON[_0x43ef('0x18')](_0x39618e));_0x4595ae(_0x39618e);})[_0x43ef('0x14')](function(_0x350f27){logger[_0x43ef('0x11')](_0x43ef('0x17'),_0x350f27['message'],_0x5b0217);_0x10bda4(_0x4edbd6[_0x43ef('0x11')](0x1f4,_0x350f27['message']));});});};exports[_0x43ef('0x19')]=function(_0x32fe44){var _0x23f7e7=this;return new Promise(function(_0x3faf1b,_0x180c06){return db[_0x43ef('0x1a')][_0x43ef('0x1b')](_0x32fe44[_0x43ef('0x15')],{'raw':_0x32fe44[_0x43ef('0x16')]?_0x32fe44[_0x43ef('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe44['options']?_0x32fe44[_0x43ef('0x16')][_0x43ef('0x1c')]||null:null,'attributes':_0x32fe44[_0x43ef('0x16')]?_0x32fe44[_0x43ef('0x16')]['attributes']||null:null,'limit':_0x32fe44[_0x43ef('0x16')]?_0x32fe44[_0x43ef('0x16')]['limit']||null:null})[_0x43ef('0xc')](function(_0x31e997){logger['info'](_0x43ef('0x19'),_0x32fe44);logger['debug'](_0x43ef('0x19'),_0x32fe44,JSON[_0x43ef('0x18')](_0x31e997));_0x3faf1b(_0x31e997);})['catch'](function(_0x63b331){logger[_0x43ef('0x11')](_0x43ef('0x19'),_0x63b331['message'],_0x32fe44);_0x180c06(_0x23f7e7[_0x43ef('0x11')](0x1f4,_0x63b331[_0x43ef('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2826a8d..14b38ee 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 _0x0c34=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy'];(function(_0x58231e,_0x520177){var _0x4d55e4=function(_0x46b949){while(--_0x46b949){_0x58231e['push'](_0x58231e['shift']());}};_0x4d55e4(++_0x520177);}(_0x0c34,0x1a9));var _0x40c3=function(_0x4eb6b4,_0x498603){_0x4eb6b4=_0x4eb6b4-0x0;var _0xe2ba66=_0x0c34[_0x4eb6b4];return _0xe2ba66;};'use strict';var multer=require(_0x40c3('0x0'));var util=require(_0x40c3('0x1'));var path=require('path');var timeout=require(_0x40c3('0x2'));var express=require(_0x40c3('0x3'));var router=express[_0x40c3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40c3('0x5'));var interaction=require(_0x40c3('0x6'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0x40c3('0x7')]('/',auth[_0x40c3('0x8')](),controller['index']);router[_0x40c3('0x7')](_0x40c3('0x9'),auth['isAuthenticated'](),controller[_0x40c3('0xa')]);router[_0x40c3('0x7')](_0x40c3('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x40c3('0xc')]);router[_0x40c3('0xd')](_0x40c3('0xb'),auth[_0x40c3('0x8')](),controller[_0x40c3('0xe')]);router[_0x40c3('0xf')](_0x40c3('0xb'),auth['isAuthenticated'](),controller[_0x40c3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9787=['post','create','put','update','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x9787,0x16c));var _0x7978=function(_0x10abfe,_0x7a9ad6){_0x10abfe=_0x10abfe-0x0;var _0x473c1b=_0x9787[_0x10abfe];return _0x473c1b;};'use strict';var multer=require(_0x7978('0x0'));var util=require(_0x7978('0x1'));var path=require(_0x7978('0x2'));var timeout=require('connect-timeout');var express=require(_0x7978('0x3'));var router=express[_0x7978('0x4')]();var fs_extra=require(_0x7978('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7978('0x6'));var config=require(_0x7978('0x7'));var controller=require(_0x7978('0x8'));router['get']('/',auth[_0x7978('0x9')](),controller[_0x7978('0xa')]);router[_0x7978('0xb')](_0x7978('0xc'),auth[_0x7978('0x9')](),controller[_0x7978('0xd')]);router['get'](_0x7978('0xe'),auth[_0x7978('0x9')](),controller[_0x7978('0xf')]);router[_0x7978('0x10')]('/',auth[_0x7978('0x9')](),controller[_0x7978('0x11')]);router[_0x7978('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7978('0x13')]);router['delete'](_0x7978('0xe'),auth[_0x7978('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 18939f3..5d75d92 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 _0x3670=['exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3670,0x16c));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0367('0x0')]={'uniqueid':{'type':Sequelize[_0x0367('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0367('0x2')](_0x0367('0x3'),_0x0367('0x4'),_0x0367('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0367('0x6')]}}; \ No newline at end of file +var _0x9ffd=['queue','DATE','sequelize','exports','STRING','account','agent'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x16c0f0,_0xf93e70){_0x16c0f0=_0x16c0f0-0x0;var _0x2505f4=_0x9ffd[_0x16c0f0];return _0x2505f4;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'uniqueid':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd9ff('0x3'),_0xd9ff('0x4'),_0xd9ff('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd9ff('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f110f25..66636db 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 _0x02d5=['include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','options','WhatsappTransferReport'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x02d5,0x17d));var _0x502d=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x02d5[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0x502d('0x0'));var rimraf=require(_0x502d('0x1'));var zipdir=require(_0x502d('0x2'));var jsonpatch=require(_0x502d('0x3'));var rp=require(_0x502d('0x4'));var moment=require('moment');var BPromise=require(_0x502d('0x5'));var Mustache=require(_0x502d('0x6'));var util=require('util');var path=require(_0x502d('0x7'));var sox=require(_0x502d('0x8'));var csv=require(_0x502d('0x9'));var ejs=require(_0x502d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x502d('0xb'));var squel=require(_0x502d('0xc'));var crypto=require(_0x502d('0xd'));var jsforce=require(_0x502d('0xe'));var deskjs=require(_0x502d('0xf'));var toCsv=require(_0x502d('0x9'));var querystring=require('querystring');var Papa=require(_0x502d('0x10'));var Redis=require(_0x502d('0x11'));var authService=require(_0x502d('0x12'));var qs=require(_0x502d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x502d('0x14'))(_0x502d('0x15'));var utils=require(_0x502d('0x16'));var config=require(_0x502d('0x17'));var licenseUtil=require(_0x502d('0x18'));var db=require(_0x502d('0x19'))['db'];function respondWithStatusCode(_0x2a6d29,_0x59f6ce){_0x59f6ce=_0x59f6ce||0xcc;return function(_0x3e357e){if(_0x3e357e){return _0x2a6d29[_0x502d('0x1a')](_0x59f6ce);}return _0x2a6d29[_0x502d('0x1b')](_0x59f6ce)['end']();};}function respondWithResult(_0xae2121,_0x570ebf){_0x570ebf=_0x570ebf||0xc8;return function(_0x44e079){if(_0x44e079){return _0xae2121['status'](_0x570ebf)[_0x502d('0x1c')](_0x44e079);}};}function respondWithFilteredResult(_0xd1822a,_0xf3d979){return function(_0x2fd745){if(_0x2fd745){var _0x2a3593=typeof _0xf3d979[_0x502d('0x1d')]===_0x502d('0x1e')&&typeof _0xf3d979[_0x502d('0x1f')]===_0x502d('0x1e');var _0x104bc4=_0x2fd745[_0x502d('0x20')];var _0x5647fc=_0x2a3593?0x0:_0xf3d979[_0x502d('0x1d')];var _0x1c3f4e=_0x2a3593?_0x2fd745['count']:_0xf3d979['offset']+_0xf3d979[_0x502d('0x1f')];var _0x313ae1;if(_0x1c3f4e>=_0x104bc4){_0x1c3f4e=_0x104bc4;_0x313ae1=0xc8;}else{_0x313ae1=0xce;}_0xd1822a[_0x502d('0x1b')](_0x313ae1);return _0xd1822a[_0x502d('0x21')](_0x502d('0x22'),_0x5647fc+'-'+_0x1c3f4e+'/'+_0x104bc4)[_0x502d('0x1c')](_0x2fd745);}return null;};}function patchUpdates(_0x45b407){return function(_0x31bd37){try{jsonpatch['apply'](_0x31bd37,_0x45b407,!![]);}catch(_0x3b3788){return BPromise['reject'](_0x3b3788);}return _0x31bd37[_0x502d('0x23')]();};}function saveUpdates(_0x1dc1be,_0x5d54d2){return function(_0x6eacdf){if(_0x6eacdf){return _0x6eacdf[_0x502d('0x24')](_0x1dc1be)[_0x502d('0x25')](function(_0x2b1c1a){return _0x2b1c1a;});}return null;};}function removeEntity(_0x1445db,_0x5f14a4){return function(_0x18a7f1){if(_0x18a7f1){return _0x18a7f1[_0x502d('0x26')]()[_0x502d('0x25')](function(){_0x1445db[_0x502d('0x1b')](0xcc)[_0x502d('0x27')]();});}};}function handleEntityNotFound(_0x30a4d4,_0x144e99){return function(_0x54f60e){if(!_0x54f60e){_0x30a4d4[_0x502d('0x1a')](0x194);}return _0x54f60e;};}function handleError(_0x5771bc,_0x24a837){_0x24a837=_0x24a837||0x1f4;return function(_0x135982){logger[_0x502d('0x28')](_0x135982['stack']);if(_0x135982[_0x502d('0x29')]){delete _0x135982[_0x502d('0x29')];}_0x5771bc[_0x502d('0x1b')](_0x24a837)[_0x502d('0x2a')](_0x135982);};}exports['index']=function(_0x58e5e2,_0x37143d){var _0x37c9c7={},_0x4401d8={},_0x7f7d59={'count':0x0,'rows':[]};var _0x2d8e88=_['map'](db['WhatsappTransferReport'][_0x502d('0x2b')],function(_0x132257){return{'name':_0x132257[_0x502d('0x2c')],'type':_0x132257[_0x502d('0x2d')][_0x502d('0x2e')]};});_0x4401d8[_0x502d('0x2f')]=_[_0x502d('0x30')](_0x2d8e88,_0x502d('0x29'));_0x4401d8[_0x502d('0x31')]=_['keys'](_0x58e5e2[_0x502d('0x31')]);_0x4401d8[_0x502d('0x32')]=_[_0x502d('0x33')](_0x4401d8[_0x502d('0x2f')],_0x4401d8['query']);_0x37c9c7['attributes']=_[_0x502d('0x33')](_0x4401d8['model'],qs[_0x502d('0x34')](_0x58e5e2[_0x502d('0x31')]['fields']));_0x37c9c7[_0x502d('0x35')]=_0x37c9c7[_0x502d('0x35')]['length']?_0x37c9c7['attributes']:_0x4401d8[_0x502d('0x2f')];if(!_0x58e5e2[_0x502d('0x31')][_0x502d('0x36')](_0x502d('0x37'))){_0x37c9c7['limit']=qs[_0x502d('0x1f')](_0x58e5e2[_0x502d('0x31')]['limit']);_0x37c9c7[_0x502d('0x1d')]=qs[_0x502d('0x1d')](_0x58e5e2[_0x502d('0x31')][_0x502d('0x1d')]);}_0x37c9c7[_0x502d('0x38')]=qs['sort'](_0x58e5e2[_0x502d('0x31')]['sort']);_0x37c9c7['where']=qs[_0x502d('0x32')](_[_0x502d('0x39')](_0x58e5e2['query'],_0x4401d8[_0x502d('0x32')]),_0x2d8e88);if(_0x58e5e2[_0x502d('0x31')]['filter']){_0x37c9c7['where']=_[_0x502d('0x3a')](_0x37c9c7[_0x502d('0x3b')],{'$or':_[_0x502d('0x30')](_0x2d8e88,function(_0x152d98){if(_0x152d98[_0x502d('0x2d')]!==_0x502d('0x3c')){var _0x108161={};_0x108161[_0x152d98[_0x502d('0x29')]]={'$like':'%'+_0x58e5e2['query']['filter']+'%'};return _0x108161;}})});}_0x37c9c7=_[_0x502d('0x3a')]({},_0x37c9c7,_0x58e5e2[_0x502d('0x3d')]);var _0x1a644f={'where':_0x37c9c7['where']};return db[_0x502d('0x3e')][_0x502d('0x20')](_0x1a644f)['then'](function(_0xd682b7){_0x7f7d59['count']=_0xd682b7;if(_0x58e5e2[_0x502d('0x31')]['includeAll']){_0x37c9c7[_0x502d('0x3f')]=[{'all':!![]}];}return db[_0x502d('0x3e')][_0x502d('0x40')](_0x37c9c7);})[_0x502d('0x25')](function(_0x2587a3){_0x7f7d59[_0x502d('0x41')]=_0x2587a3;return _0x7f7d59;})[_0x502d('0x25')](respondWithFilteredResult(_0x37143d,_0x37c9c7))[_0x502d('0x42')](handleError(_0x37143d,null));};exports['show']=function(_0x21d71f,_0x38832f){var _0x4ec0e3={'raw':!![],'where':{'id':_0x21d71f[_0x502d('0x43')]['id']}},_0xb6d78a={};_0xb6d78a[_0x502d('0x2f')]=_['keys'](db[_0x502d('0x3e')][_0x502d('0x2b')]);_0xb6d78a[_0x502d('0x31')]=_['keys'](_0x21d71f[_0x502d('0x31')]);_0xb6d78a[_0x502d('0x32')]=_[_0x502d('0x33')](_0xb6d78a[_0x502d('0x2f')],_0xb6d78a[_0x502d('0x31')]);_0x4ec0e3[_0x502d('0x35')]=_[_0x502d('0x33')](_0xb6d78a[_0x502d('0x2f')],qs[_0x502d('0x34')](_0x21d71f[_0x502d('0x31')][_0x502d('0x34')]));_0x4ec0e3[_0x502d('0x35')]=_0x4ec0e3['attributes'][_0x502d('0x44')]?_0x4ec0e3[_0x502d('0x35')]:_0xb6d78a['model'];if(_0x21d71f[_0x502d('0x31')][_0x502d('0x45')]){_0x4ec0e3['include']=[{'all':!![]}];}_0x4ec0e3=_[_0x502d('0x3a')]({},_0x4ec0e3,_0x21d71f['options']);return db['WhatsappTransferReport'][_0x502d('0x46')](_0x4ec0e3)['then'](handleEntityNotFound(_0x38832f,null))[_0x502d('0x25')](respondWithResult(_0x38832f,null))[_0x502d('0x42')](handleError(_0x38832f,null));};exports[_0x502d('0x47')]=function(_0x56cd95,_0x4918a6){return db[_0x502d('0x3e')][_0x502d('0x47')](_0x56cd95[_0x502d('0x48')],{})[_0x502d('0x25')](respondWithResult(_0x4918a6,0xc9))[_0x502d('0x42')](handleError(_0x4918a6,null));};exports[_0x502d('0x24')]=function(_0x366577,_0x56701e){if(_0x366577['body']['id']){delete _0x366577[_0x502d('0x48')]['id'];}return db[_0x502d('0x3e')][_0x502d('0x46')]({'where':{'id':_0x366577[_0x502d('0x43')]['id']}})[_0x502d('0x25')](handleEntityNotFound(_0x56701e,null))[_0x502d('0x25')](saveUpdates(_0x366577['body'],null))[_0x502d('0x25')](respondWithResult(_0x56701e,null))['catch'](handleError(_0x56701e,null));};exports[_0x502d('0x26')]=function(_0x37c0ea,_0x33de95){return db['WhatsappTransferReport'][_0x502d('0x46')]({'where':{'id':_0x37c0ea[_0x502d('0x43')]['id']}})['then'](handleEntityNotFound(_0x33de95,null))['then'](removeEntity(_0x33de95,null))[_0x502d('0x42')](handleError(_0x33de95,null));};exports[_0x502d('0x49')]=function(_0xf57154,_0x4760f8){return db[_0x502d('0x3e')][_0x502d('0x49')]()[_0x502d('0x25')](respondWithResult(_0x4760f8,null))['catch'](handleError(_0x4760f8,null));}; \ No newline at end of file +var _0xfc0c=['../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','WhatsappTransferReport','include','findAll','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4b90f8,_0x3a3331){var _0x3723f3=function(_0x4b6d7f){while(--_0x4b6d7f){_0x4b90f8['push'](_0x4b90f8['shift']());}};_0x3723f3(++_0x3a3331);}(_0xfc0c,0x103));var _0xcfc0=function(_0x43dec1,_0x53f198){_0x43dec1=_0x43dec1-0x0;var _0x5ca575=_0xfc0c[_0x43dec1];return _0x5ca575;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfc0('0x0'));var zipdir=require(_0xcfc0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfc0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfc0('0x3'));var util=require(_0xcfc0('0x4'));var path=require(_0xcfc0('0x5'));var sox=require(_0xcfc0('0x6'));var csv=require(_0xcfc0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfc0('0x8'));var _=require(_0xcfc0('0x9'));var squel=require('squel');var crypto=require(_0xcfc0('0xa'));var jsforce=require(_0xcfc0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcfc0('0x7'));var querystring=require('querystring');var Papa=require(_0xcfc0('0xc'));var Redis=require(_0xcfc0('0xd'));var authService=require(_0xcfc0('0xe'));var qs=require(_0xcfc0('0xf'));var as=require(_0xcfc0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfc0('0x11'))('api');var utils=require(_0xcfc0('0x12'));var config=require(_0xcfc0('0x13'));var licenseUtil=require(_0xcfc0('0x14'));var db=require(_0xcfc0('0x15'))['db'];function respondWithStatusCode(_0x245bc8,_0x5bd9e5){_0x5bd9e5=_0x5bd9e5||0xcc;return function(_0x14892f){if(_0x14892f){return _0x245bc8[_0xcfc0('0x16')](_0x5bd9e5);}return _0x245bc8['status'](_0x5bd9e5)[_0xcfc0('0x17')]();};}function respondWithResult(_0x32d2fb,_0x12f305){_0x12f305=_0x12f305||0xc8;return function(_0x132ed0){if(_0x132ed0){return _0x32d2fb[_0xcfc0('0x18')](_0x12f305)['json'](_0x132ed0);}};}function respondWithFilteredResult(_0x355b56,_0x1ecece){return function(_0x221515){if(_0x221515){var _0x478d61=typeof _0x1ecece[_0xcfc0('0x19')]===_0xcfc0('0x1a')&&typeof _0x1ecece[_0xcfc0('0x1b')]==='undefined';var _0x42624a=_0x221515[_0xcfc0('0x1c')];var _0x429b20=_0x478d61?0x0:_0x1ecece['offset'];var _0x3e7065=_0x478d61?_0x221515[_0xcfc0('0x1c')]:_0x1ecece[_0xcfc0('0x19')]+_0x1ecece['limit'];var _0x193f5e;if(_0x3e7065>=_0x42624a){_0x3e7065=_0x42624a;_0x193f5e=0xc8;}else{_0x193f5e=0xce;}_0x355b56[_0xcfc0('0x18')](_0x193f5e);return _0x355b56[_0xcfc0('0x1d')]('Content-Range',_0x429b20+'-'+_0x3e7065+'/'+_0x42624a)[_0xcfc0('0x1e')](_0x221515);}return null;};}function patchUpdates(_0x4fa2f8){return function(_0x365d20){try{jsonpatch['apply'](_0x365d20,_0x4fa2f8,!![]);}catch(_0x1d136c){return BPromise[_0xcfc0('0x1f')](_0x1d136c);}return _0x365d20[_0xcfc0('0x20')]();};}function saveUpdates(_0x2ac41a,_0x3e5358){return function(_0x3be8f2){if(_0x3be8f2){return _0x3be8f2[_0xcfc0('0x21')](_0x2ac41a)[_0xcfc0('0x22')](function(_0x36b6bb){return _0x36b6bb;});}return null;};}function removeEntity(_0x265a75,_0x3f43d4){return function(_0x5f4f2e){if(_0x5f4f2e){return _0x5f4f2e[_0xcfc0('0x23')]()[_0xcfc0('0x22')](function(){_0x265a75['status'](0xcc)[_0xcfc0('0x17')]();});}};}function handleEntityNotFound(_0xb42a0b,_0xa52a43){return function(_0x57f3cc){if(!_0x57f3cc){_0xb42a0b['sendStatus'](0x194);}return _0x57f3cc;};}function handleError(_0x14457a,_0x35962d){_0x35962d=_0x35962d||0x1f4;return function(_0x32c99e){logger[_0xcfc0('0x24')](_0x32c99e[_0xcfc0('0x25')]);if(_0x32c99e[_0xcfc0('0x26')]){delete _0x32c99e[_0xcfc0('0x26')];}_0x14457a[_0xcfc0('0x18')](_0x35962d)['send'](_0x32c99e);};}exports['index']=function(_0x7388e4,_0x2d5587){var _0x31a4fc={},_0x32fb3b={},_0x57d132={'count':0x0,'rows':[]};var _0xa0bb8f=_['map'](db['WhatsappTransferReport'][_0xcfc0('0x27')],function(_0x5a4f72){return{'name':_0x5a4f72[_0xcfc0('0x28')],'type':_0x5a4f72[_0xcfc0('0x29')][_0xcfc0('0x2a')]};});_0x32fb3b[_0xcfc0('0x2b')]=_[_0xcfc0('0x2c')](_0xa0bb8f,'name');_0x32fb3b[_0xcfc0('0x2d')]=_[_0xcfc0('0x2e')](_0x7388e4[_0xcfc0('0x2d')]);_0x32fb3b['filters']=_[_0xcfc0('0x2f')](_0x32fb3b[_0xcfc0('0x2b')],_0x32fb3b[_0xcfc0('0x2d')]);_0x31a4fc[_0xcfc0('0x30')]=_[_0xcfc0('0x2f')](_0x32fb3b[_0xcfc0('0x2b')],qs[_0xcfc0('0x31')](_0x7388e4[_0xcfc0('0x2d')][_0xcfc0('0x31')]));_0x31a4fc[_0xcfc0('0x30')]=_0x31a4fc[_0xcfc0('0x30')][_0xcfc0('0x32')]?_0x31a4fc[_0xcfc0('0x30')]:_0x32fb3b[_0xcfc0('0x2b')];if(!_0x7388e4[_0xcfc0('0x2d')]['hasOwnProperty'](_0xcfc0('0x33'))){_0x31a4fc[_0xcfc0('0x1b')]=qs[_0xcfc0('0x1b')](_0x7388e4[_0xcfc0('0x2d')][_0xcfc0('0x1b')]);_0x31a4fc[_0xcfc0('0x19')]=qs[_0xcfc0('0x19')](_0x7388e4[_0xcfc0('0x2d')][_0xcfc0('0x19')]);}_0x31a4fc['order']=qs[_0xcfc0('0x34')](_0x7388e4['query'][_0xcfc0('0x34')]);_0x31a4fc[_0xcfc0('0x35')]=qs[_0xcfc0('0x36')](_[_0xcfc0('0x37')](_0x7388e4['query'],_0x32fb3b['filters']),_0xa0bb8f);if(_0x7388e4[_0xcfc0('0x2d')]['filter']){_0x31a4fc[_0xcfc0('0x35')]=_[_0xcfc0('0x38')](_0x31a4fc[_0xcfc0('0x35')],{'$or':_[_0xcfc0('0x2c')](_0xa0bb8f,function(_0x96fc3c){if(_0x96fc3c['type']!==_0xcfc0('0x39')){var _0x215098={};_0x215098[_0x96fc3c['name']]={'$like':'%'+_0x7388e4[_0xcfc0('0x2d')][_0xcfc0('0x3a')]+'%'};return _0x215098;}})});}_0x31a4fc=_['merge']({},_0x31a4fc,_0x7388e4[_0xcfc0('0x3b')]);var _0x4cc920={'where':_0x31a4fc[_0xcfc0('0x35')]};return db[_0xcfc0('0x3c')][_0xcfc0('0x1c')](_0x4cc920)[_0xcfc0('0x22')](function(_0x4e9451){_0x57d132[_0xcfc0('0x1c')]=_0x4e9451;if(_0x7388e4[_0xcfc0('0x2d')]['includeAll']){_0x31a4fc[_0xcfc0('0x3d')]=[{'all':!![]}];}return db[_0xcfc0('0x3c')][_0xcfc0('0x3e')](_0x31a4fc);})['then'](function(_0x253839){_0x57d132['rows']=_0x253839;return _0x57d132;})['then'](respondWithFilteredResult(_0x2d5587,_0x31a4fc))[_0xcfc0('0x3f')](handleError(_0x2d5587,null));};exports['show']=function(_0x9ca0bf,_0x2c402c){var _0x4b6d44={'raw':!![],'where':{'id':_0x9ca0bf[_0xcfc0('0x40')]['id']}},_0x51e26a={};_0x51e26a[_0xcfc0('0x2b')]=_[_0xcfc0('0x2e')](db['WhatsappTransferReport'][_0xcfc0('0x27')]);_0x51e26a['query']=_[_0xcfc0('0x2e')](_0x9ca0bf[_0xcfc0('0x2d')]);_0x51e26a[_0xcfc0('0x36')]=_[_0xcfc0('0x2f')](_0x51e26a[_0xcfc0('0x2b')],_0x51e26a[_0xcfc0('0x2d')]);_0x4b6d44[_0xcfc0('0x30')]=_[_0xcfc0('0x2f')](_0x51e26a[_0xcfc0('0x2b')],qs[_0xcfc0('0x31')](_0x9ca0bf[_0xcfc0('0x2d')]['fields']));_0x4b6d44[_0xcfc0('0x30')]=_0x4b6d44[_0xcfc0('0x30')][_0xcfc0('0x32')]?_0x4b6d44[_0xcfc0('0x30')]:_0x51e26a['model'];if(_0x9ca0bf[_0xcfc0('0x2d')][_0xcfc0('0x41')]){_0x4b6d44['include']=[{'all':!![]}];}_0x4b6d44=_[_0xcfc0('0x38')]({},_0x4b6d44,_0x9ca0bf[_0xcfc0('0x3b')]);return db[_0xcfc0('0x3c')][_0xcfc0('0x42')](_0x4b6d44)[_0xcfc0('0x22')](handleEntityNotFound(_0x2c402c,null))[_0xcfc0('0x22')](respondWithResult(_0x2c402c,null))[_0xcfc0('0x3f')](handleError(_0x2c402c,null));};exports[_0xcfc0('0x43')]=function(_0x786397,_0x101a15){return db[_0xcfc0('0x3c')][_0xcfc0('0x43')](_0x786397['body'],{})['then'](respondWithResult(_0x101a15,0xc9))[_0xcfc0('0x3f')](handleError(_0x101a15,null));};exports[_0xcfc0('0x21')]=function(_0x3de97e,_0x1f06dd){if(_0x3de97e[_0xcfc0('0x44')]['id']){delete _0x3de97e[_0xcfc0('0x44')]['id'];}return db[_0xcfc0('0x3c')][_0xcfc0('0x42')]({'where':{'id':_0x3de97e[_0xcfc0('0x40')]['id']}})[_0xcfc0('0x22')](handleEntityNotFound(_0x1f06dd,null))[_0xcfc0('0x22')](saveUpdates(_0x3de97e[_0xcfc0('0x44')],null))[_0xcfc0('0x22')](respondWithResult(_0x1f06dd,null))[_0xcfc0('0x3f')](handleError(_0x1f06dd,null));};exports[_0xcfc0('0x23')]=function(_0x35c442,_0x28ad72){return db[_0xcfc0('0x3c')][_0xcfc0('0x42')]({'where':{'id':_0x35c442[_0xcfc0('0x40')]['id']}})[_0xcfc0('0x22')](handleEntityNotFound(_0x28ad72,null))[_0xcfc0('0x22')](removeEntity(_0x28ad72,null))[_0xcfc0('0x3f')](handleError(_0x28ad72,null));};exports[_0xcfc0('0x45')]=function(_0x3bea43,_0x1a680c){return db[_0xcfc0('0x3c')][_0xcfc0('0x45')]()[_0xcfc0('0x22')](respondWithResult(_0x1a680c,null))['catch'](handleError(_0x1a680c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 547dbee..2605a1e 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 _0x3ee0=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x464bc3,_0xc8cc27){var _0x10520e=function(_0x2398f7){while(--_0x2398f7){_0x464bc3['push'](_0x464bc3['shift']());}};_0x10520e(++_0xc8cc27);}(_0x3ee0,0x12c));var _0x03ee=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3ee0[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x03ee('0x0'));var util=require(_0x03ee('0x1'));var logger=require(_0x03ee('0x2'))(_0x03ee('0x3'));var moment=require(_0x03ee('0x4'));var BPromise=require(_0x03ee('0x5'));var rp=require(_0x03ee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03ee('0x7'));var config=require(_0x03ee('0x8'));var attributes=require(_0x03ee('0x9'));module['exports']=function(_0x31b3c1,_0x1051c5){return _0x31b3c1[_0x03ee('0xa')](_0x03ee('0xb'),attributes,{'tableName':_0x03ee('0xc'),'paranoid':![],'indexes':[{'name':_0x03ee('0xd'),'fields':[_0x03ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2ed=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x9a67a4,_0x5bfbad){var _0x5ddcd2=function(_0xadfb5f){while(--_0xadfb5f){_0x9a67a4['push'](_0x9a67a4['shift']());}};_0x5ddcd2(++_0x5bfbad);}(_0xc2ed,0x160));var _0xdc2e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xc2ed[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0xdc2e('0x0'));var util=require(_0xdc2e('0x1'));var logger=require('../../config/logger')(_0xdc2e('0x2'));var moment=require(_0xdc2e('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc2e('0x4'));var fs=require('fs');var path=require(_0xdc2e('0x5'));var rimraf=require(_0xdc2e('0x6'));var config=require(_0xdc2e('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xdc2e('0x8')]=function(_0x4c32e7,_0x5e1240){return _0x4c32e7[_0xdc2e('0x9')](_0xdc2e('0xa'),attributes,{'tableName':_0xdc2e('0xb'),'paranoid':![],'indexes':[{'name':_0xdc2e('0xc'),'fields':[_0xdc2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 75a145c..ef17bcd 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 _0x6d62=['then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1f7648,_0xa8bd62){var _0x1c7ef6=function(_0x4d92ca){while(--_0x4d92ca){_0x1f7648['push'](_0x1f7648['shift']());}};_0x1c7ef6(++_0xa8bd62);}(_0x6d62,0x1ad));var _0x26d6=function(_0x535963,_0x326515){_0x535963=_0x535963-0x0;var _0x3975f6=_0x6d62[_0x535963];return _0x3975f6;};'use strict';var _=require(_0x26d6('0x0'));var util=require(_0x26d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26d6('0x2'));var fs=require('fs');var Redis=require(_0x26d6('0x3'));var db=require(_0x26d6('0x4'))['db'];var utils=require(_0x26d6('0x5'));var logger=require(_0x26d6('0x6'))(_0x26d6('0x7'));var config=require(_0x26d6('0x8'));var jayson=require(_0x26d6('0x9'));var client=jayson[_0x26d6('0xa')][_0x26d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c2ede,_0x47e193,_0x3e200f){return new BPromise(function(_0x44ca36,_0x3f6214){return client['request'](_0x2c2ede,_0x3e200f)[_0x26d6('0xc')](function(_0x34bd4f){logger[_0x26d6('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x47e193,'request\x20sent');logger[_0x26d6('0xe')](_0x26d6('0xf'),_0x47e193,_0x26d6('0x10'),JSON['stringify'](_0x34bd4f));if(_0x34bd4f[_0x26d6('0x11')]){if(_0x34bd4f['error'][_0x26d6('0x12')]===0x1f4){logger[_0x26d6('0x11')](_0x26d6('0x13'),_0x47e193,_0x34bd4f[_0x26d6('0x11')][_0x26d6('0x14')]);return _0x3f6214(_0x34bd4f[_0x26d6('0x11')][_0x26d6('0x14')]);}logger[_0x26d6('0x11')](_0x26d6('0x13'),_0x47e193,_0x34bd4f[_0x26d6('0x11')][_0x26d6('0x14')]);return _0x44ca36(_0x34bd4f[_0x26d6('0x11')][_0x26d6('0x14')]);}else{logger[_0x26d6('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x47e193,_0x26d6('0x10'));_0x44ca36(_0x34bd4f['result'][_0x26d6('0x14')]);}})['catch'](function(_0x1667c2){logger[_0x26d6('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x47e193,_0x1667c2);_0x3f6214(_0x1667c2);});});} \ No newline at end of file +var _0x1564=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x262165,_0x2f5be6){var _0x5e3b12=function(_0x4bf4f7){while(--_0x4bf4f7){_0x262165['push'](_0x262165['shift']());}};_0x5e3b12(++_0x2f5be6);}(_0x1564,0x15c));var _0x4156=function(_0x505b15,_0x576feb){_0x505b15=_0x505b15-0x0;var _0x3f4c13=_0x1564[_0x505b15];return _0x3f4c13;};'use strict';var _=require(_0x4156('0x0'));var util=require(_0x4156('0x1'));var moment=require(_0x4156('0x2'));var BPromise=require('bluebird');var rs=require(_0x4156('0x3'));var fs=require('fs');var Redis=require(_0x4156('0x4'));var db=require(_0x4156('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4156('0x6'))('rpc');var config=require(_0x4156('0x7'));var jayson=require(_0x4156('0x8'));var client=jayson[_0x4156('0x9')][_0x4156('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x192c0a,_0x383af6,_0xb3eef9){return new BPromise(function(_0x5bb863,_0x399b5c){return client[_0x4156('0xb')](_0x192c0a,_0xb3eef9)[_0x4156('0xc')](function(_0x4d5725){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x383af6,_0x4156('0xd'));logger[_0x4156('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x383af6,_0x4156('0xd'),JSON[_0x4156('0xf')](_0x4d5725));if(_0x4d5725['error']){if(_0x4d5725[_0x4156('0x10')][_0x4156('0x11')]===0x1f4){logger[_0x4156('0x10')](_0x4156('0x12'),_0x383af6,_0x4d5725[_0x4156('0x10')][_0x4156('0x13')]);return _0x399b5c(_0x4d5725['error'][_0x4156('0x13')]);}logger['error'](_0x4156('0x12'),_0x383af6,_0x4d5725['error'][_0x4156('0x13')]);return _0x5bb863(_0x4d5725[_0x4156('0x10')][_0x4156('0x13')]);}else{logger[_0x4156('0x14')](_0x4156('0x12'),_0x383af6,_0x4156('0xd'));_0x5bb863(_0x4d5725[_0x4156('0x15')][_0x4156('0x13')]);}})[_0x4156('0x16')](function(_0x197184){logger[_0x4156('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x383af6,_0x197184);_0x399b5c(_0x197184);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 0f8d888..c786ec3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2f1=['lodash','./mysqldb','./config/license','./rpc','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','default','listen','info','start','filter','exitCode','length','pm2_env','Online\x20apps:','map','name','join','Offline\x20apps:','status','online','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2f1,0xee));var _0x1b2f=function(_0x203569,_0x7e5a1e){_0x203569=_0x203569-0x0;var _0x22d2c3=_0xb2f1[_0x203569];return _0x22d2c3;};'use strict';var _=require(_0x1b2f('0x0'));var db=require(_0x1b2f('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x1b2f('0x2'));var rpc=require(_0x1b2f('0x3'));var config=require('./config/environment');var logger=require(_0x1b2f('0x4'))(_0x1b2f('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x1b2f('0x6'));var chat=require(_0x1b2f('0x7'));var whatsapp=require(_0x1b2f('0x8'));var transcribe=require(_0x1b2f('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0x1b2f('0xa')]()[_0x1b2f('0xb')](function(){if(config['seedDB']){return seedDb[_0x1b2f('0xc')]();}})[_0x1b2f('0xb')](function(){return checkLicense['default']();})[_0x1b2f('0xb')](function(){return rpc[_0x1b2f('0xd')]();})[_0x1b2f('0xb')](function(_0x26842c){logger[_0x1b2f('0xe')](_0x26842c);return chat[_0x1b2f('0xf')]();})[_0x1b2f('0xb')](function(){return whatsapp['start']();})[_0x1b2f('0xb')](function(){return schedule[_0x1b2f('0xf')]();})[_0x1b2f('0xb')](function(){return transcribe['start']();})[_0x1b2f('0xb')](function(){return provider['start']();})[_0x1b2f('0xb')](function(_0x2f285a){logger[_0x1b2f('0xe')](_0x2f285a);return pm2[_0x1b2f('0xf')](pm2Config);})[_0x1b2f('0xb')](function(_0x559ef2){var _0x1cfbf3=_0x559ef2[_0x1b2f('0x10')](function(_0x130219){return typeof _0x130219[_0x1b2f('0x11')]==='number'&&_0x130219['exitCode']>=0x0;});if(_0x1cfbf3[_0x1b2f('0x12')]>0x0){throw new Error(_0x1cfbf3['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x1cfbf3,function(_0xb376de){return'\x22'+_0xb376de[_0x1b2f('0x13')]['name']+'\x22';}));}logger['info'](_0x1b2f('0x14'),_[_0x1b2f('0x15')](_[_0x1b2f('0x10')](_0x559ef2,{'status':'online'}),_0x1b2f('0x16'))[_0x1b2f('0x17')]());logger[_0x1b2f('0xe')](_0x1b2f('0x18'),_[_0x1b2f('0x15')](_[_0x1b2f('0x10')](_0x559ef2,function(_0xa1d86b){return _0xa1d86b[_0x1b2f('0x19')]!==_0x1b2f('0x1a');}),'name')[_0x1b2f('0x17')]()||'None');console[_0x1b2f('0x1b')](_0x1b2f('0x1c'));})[_0x1b2f('0x1d')](function(_0x5a1ff0){console['log'](_0x1b2f('0x1e'),_0x5a1ff0);logger[_0x1b2f('0x1f')](_0x1b2f('0x20'),_0x5a1ff0);process[_0x1b2f('0x21')](0x1);});}main(); \ No newline at end of file +var _0xb4c7=['info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen'];(function(_0x409186,_0x4b8b73){var _0x3deb43=function(_0x358728){while(--_0x358728){_0x409186['push'](_0x409186['shift']());}};_0x3deb43(++_0x4b8b73);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x395889,_0x40a0cf){_0x395889=_0x395889-0x0;var _0x50f6b2=_0xb4c7[_0x395889];return _0x50f6b2;};'use strict';var _=require(_0x7b4c('0x0'));var db=require(_0x7b4c('0x1'))['db'];var seedDb=require(_0x7b4c('0x2'));var checkLicense=require(_0x7b4c('0x3'));var rpc=require(_0x7b4c('0x4'));var config=require('./config/environment');var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var pm2=require(_0x7b4c('0x7'));var pm2Config=require(_0x7b4c('0x8'));var schedule=require(_0x7b4c('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x7b4c('0xa'));var transcribe=require(_0x7b4c('0xb'));var provider=require(_0x7b4c('0xc'));function main(){return db['sequelize'][_0x7b4c('0xd')]()[_0x7b4c('0xe')](function(){if(config['seedDB']){return seedDb[_0x7b4c('0xf')]();}})[_0x7b4c('0xe')](function(){return checkLicense[_0x7b4c('0xf')]();})[_0x7b4c('0xe')](function(){return rpc[_0x7b4c('0x10')]();})[_0x7b4c('0xe')](function(_0x1a996f){logger[_0x7b4c('0x11')](_0x1a996f);return chat[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return transcribe[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return provider[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(_0x3ea0da){logger[_0x7b4c('0x11')](_0x3ea0da);return pm2[_0x7b4c('0x12')](pm2Config);})[_0x7b4c('0xe')](function(_0x593a19){var _0x2edb77=_0x593a19[_0x7b4c('0x13')](function(_0xdc71cd){return typeof _0xdc71cd[_0x7b4c('0x14')]===_0x7b4c('0x15')&&_0xdc71cd[_0x7b4c('0x14')]>=0x0;});if(_0x2edb77[_0x7b4c('0x16')]>0x0){throw new Error(_0x2edb77[_0x7b4c('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x7b4c('0x17')](_0x2edb77,function(_0xe71d88){return'\x22'+_0xe71d88[_0x7b4c('0x18')][_0x7b4c('0x19')]+'\x22';}));}logger['info'](_0x7b4c('0x1a'),_[_0x7b4c('0x17')](_[_0x7b4c('0x13')](_0x593a19,{'status':_0x7b4c('0x1b')}),_0x7b4c('0x19'))[_0x7b4c('0x1c')]());logger[_0x7b4c('0x11')](_0x7b4c('0x1d'),_[_0x7b4c('0x17')](_['filter'](_0x593a19,function(_0x1f06ec){return _0x1f06ec[_0x7b4c('0x1e')]!==_0x7b4c('0x1b');}),_0x7b4c('0x19'))[_0x7b4c('0x1c')]()||_0x7b4c('0x1f'));console[_0x7b4c('0x20')](_0x7b4c('0x21'));})[_0x7b4c('0x22')](function(_0x2c267c){console['log'](_0x7b4c('0x23'),_0x2c267c);logger[_0x7b4c('0x24')](_0x7b4c('0x25'),_0x2c267c);process[_0x7b4c('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 787b2c0..8e7e342 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 _0xbbcf=['allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','json','Bearer','Unknown\x20authorization\x20format','getUuid','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','decryptString','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','crudPermissions'];(function(_0xe24a93,_0x17bf79){var _0x1c5a39=function(_0x5a59fc){while(--_0x5a59fc){_0xe24a93['push'](_0xe24a93['shift']());}};_0x1c5a39(++_0x17bf79);}(_0xbbcf,0x6f));var _0xfbbc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbbcf[_0x20a584];return _0x4b41a8;};'use strict';var db=require(_0xfbbc('0x0'))['db'];var config=require(_0xfbbc('0x1'));var hardwareConf=require(_0xfbbc('0x2'));var licenseUtil=require(_0xfbbc('0x3'));var encryptor=require(_0xfbbc('0x4'));var _=require(_0xfbbc('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xfbbc('0x6'));var compose=require(_0xfbbc('0x7'));var basicAuth=require(_0xfbbc('0x8'));var crypto=require(_0xfbbc('0x9'));var BPromise=require(_0xfbbc('0xa'));var util=require(_0xfbbc('0xb'));var moment=require(_0xfbbc('0xc'));var validateJwt=expressJwt({'secret':config[_0xfbbc('0xd')][_0xfbbc('0xe')]});var userAttributes=['id',_0xfbbc('0xf'),_0xfbbc('0x10'),_0xfbbc('0x11'),_0xfbbc('0x12'),_0xfbbc('0x13'),'userpic','permissions',_0xfbbc('0x14'),_0xfbbc('0x15'),_0xfbbc('0x16'),'mailPause',_0xfbbc('0x17'),'smsPause',_0xfbbc('0x18'),_0xfbbc('0x19'),_0xfbbc('0x1a'),'lastLoginAt','lastPauseAt',_0xfbbc('0x1b'),_0xfbbc('0x1c'),_0xfbbc('0x1d'),_0xfbbc('0x1e'),_0xfbbc('0x1f'),_0xfbbc('0x20'),_0xfbbc('0x21'),_0xfbbc('0x22'),_0xfbbc('0x23'),_0xfbbc('0x24'),'phoneBarExpires',_0xfbbc('0x25'),_0xfbbc('0x26'),_0xfbbc('0x27'),'hotdesk',_0xfbbc('0x28'),_0xfbbc('0x29'),_0xfbbc('0x2a'),_0xfbbc('0x2b'),_0xfbbc('0x2c'),_0xfbbc('0x2d'),_0xfbbc('0x2e'),_0xfbbc('0x2f'),'ignorePauseForPreviewCalls',_0xfbbc('0x30'),_0xfbbc('0x31'),_0xfbbc('0x32'),_0xfbbc('0x33'),_0xfbbc('0x34'),_0xfbbc('0x35'),_0xfbbc('0x36'),_0xfbbc('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xfbbc('0x38'),'whatsappAutoanswer',_0xfbbc('0x39'),_0xfbbc('0x3a')];exports[_0xfbbc('0x3b')]=function(){return this['isAuthenticated'](!![])[_0xfbbc('0x3c')](function(_0x3cc6e5,_0x5e3c66,_0x2f078f){if(_0x3cc6e5[_0xfbbc('0x3d')]){_0x2f078f();}else{return db[_0xfbbc('0x3e')][_0xfbbc('0x3f')]({'where':{'id':_0x3cc6e5[_0xfbbc('0x40')]['id']},'attributes':['id',_0xfbbc('0x41'),_0xfbbc('0x42')],'raw':!![]})[_0xfbbc('0x43')](function(_0xd4ce69){if(_0xd4ce69&&_0xd4ce69[_0xfbbc('0x41')]&&!_0x3cc6e5[_0xfbbc('0x44')][_0xfbbc('0x45')]){return _0x5e3c66[_0xfbbc('0x46')](_0xd4ce69[_0xfbbc('0x42')]==='unmanaged'?0x195:0x193)['json']({'message':_0xd4ce69[_0xfbbc('0x42')]===_0xfbbc('0x47')?_0xfbbc('0x48'):_0xfbbc('0x49')});}else{_0x2f078f();}})[_0xfbbc('0x4a')](function(_0xdfd7b8){_0x2f078f(_0xdfd7b8);});}});};exports['isAuthenticated']=function isAuthenticated(_0x20d12c){return compose()[_0xfbbc('0x3c')](function(_0x3c0884,_0x6759aa,_0x197a8f){var _0x5f007c;if(_0x3c0884[_0xfbbc('0x4b')][_0xfbbc('0x4c')]){if(_[_0xfbbc('0x4d')](_0x3c0884[_0xfbbc('0x4b')][_0xfbbc('0x4c')],_0xfbbc('0x4e'))){var _0x452d98=basicAuth(_0x3c0884);db[_0xfbbc('0x4f')]['find']({'where':{'name':_0x452d98['name']}})[_0xfbbc('0x43')](function(_0x3cb157){if(!_0x3cb157||!_0x3cb157[_0xfbbc('0x50')](_0x452d98['pass'])){return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':'Wrong\x20credentials.'});}_0x3c0884[_0xfbbc('0x3d')]={'id':_0x3cb157['id']};_0x197a8f();})[_0xfbbc('0x4a')](function(_0xb14003){_0x197a8f(_0xb14003);});}else if(_[_0xfbbc('0x4d')](_0x3c0884[_0xfbbc('0x4b')][_0xfbbc('0x4c')],_0xfbbc('0x52'))){validateJwt(_0x3c0884,_0x6759aa,_0x197a8f);}else{if(_0x20d12c){_0x197a8f();}else{return _0x6759aa[_0xfbbc('0x46')](0x193)[_0xfbbc('0x51')]({'message':_0xfbbc('0x53')});}}}else if(_0x3c0884[_0xfbbc('0x44')]['apikey']){try{var _0x26808d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfbbc('0x54')]()};verifyJwt(_0x3c0884[_0xfbbc('0x44')][_0xfbbc('0x55')],_0x26808d)[_0xfbbc('0x43')](function(_0x2b716e){return db[_0xfbbc('0x4f')]['find']({'where':{'id':_0x2b716e['sub']}})[_0xfbbc('0x43')](function(_0x124b64){_0x5f007c=_0x124b64;return db[_0xfbbc('0x56')][_0xfbbc('0x3f')]({'where':{'id':0x1},'attributes':[_0xfbbc('0x57'),_0xfbbc('0x58')],'raw':!![]});})[_0xfbbc('0x43')](function(_0x356074){if(!_0x5f007c||!_[_0xfbbc('0x59')](_0x5f007c[_0xfbbc('0x5a')],_0x2b716e[_0xfbbc('0x5b')])){return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x5f007c[_0xfbbc('0x5c')]){return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5f007c['blocked']){if(_0x356074['blockDuration']>0x0){if(moment(_0x5f007c['blockedAt'])[_0xfbbc('0x5d')](_0x356074['blockDuration'],_0xfbbc('0x5e'))>moment()){return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':_0xfbbc('0x5f')});}}else{return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3c0884['user']={'id':_0x5f007c['id']};_0x197a8f();});})['catch'](function(){return _0x6759aa[_0xfbbc('0x46')](0x191)[_0xfbbc('0x51')]({'message':_0xfbbc('0x5f')});});}catch(_0x2e2c9f){_0x197a8f(_0x2e2c9f);}}else if(_0x20d12c){_0x197a8f();}else{return _0x6759aa[_0xfbbc('0x46')](0x193)[_0xfbbc('0x51')]({'message':_0xfbbc('0x53')});}})[_0xfbbc('0x3c')](function(_0x3f7da0,_0xd52526,_0x1f9320){if(_0x3f7da0[_0xfbbc('0x3d')]){db[_0xfbbc('0x4f')]['find']({'where':{'id':_0x3f7da0[_0xfbbc('0x3d')]['id']},'attributes':userAttributes})[_0xfbbc('0x43')](function(_0x5273d1){if(!_0x5273d1){return _0xd52526[_0xfbbc('0x46')](0x194)[_0xfbbc('0x51')]({'message':_0xfbbc('0x60')});}_0x3f7da0[_0xfbbc('0x3d')]=_0x5273d1;_0x1f9320();})[_0xfbbc('0x4a')](function(_0x10e2b1){_0x1f9320(_0x10e2b1);});}else if(_0x20d12c){_0x1f9320();}else{return _0xd52526[_0xfbbc('0x46')](0x194)[_0xfbbc('0x51')]({'message':_0xfbbc('0x61')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfbbc('0x3c')](function(_0x3be04a,_0x535aee,_0x4ca30e){return licenseUtil[_0xfbbc('0x62')]()['then'](function(_0x449e6d){if(_0x449e6d['update']){_0x4ca30e();}else{return _0x535aee[_0xfbbc('0x46')](0x193)[_0xfbbc('0x51')]({'message':_0xfbbc('0x63')});}})[_0xfbbc('0x4a')](function(_0x32acfa){_0x4ca30e(_0x32acfa);});});};exports[_0xfbbc('0x64')]=function isWebrtcLicence(){return compose()[_0xfbbc('0x3c')](function(_0x1f2530,_0x4a7dfb,_0x1e57c0){return licenseUtil['getLicense']()[_0xfbbc('0x43')](function(_0x4948e4){if(_0x4948e4[_0xfbbc('0x65')]){_0x1e57c0();}else{return _0x4a7dfb[_0xfbbc('0x46')](0x193)['json']({'message':'Forbidden'});}})[_0xfbbc('0x4a')](function(_0x348eae){_0x1e57c0(_0x348eae);});});};exports['isMiddleware']=function(_0x2dbf50,_0xe5263c,_0x26f01d){_0x2dbf50[_0xfbbc('0x66')]=!![];return _0x26f01d();};exports[_0xfbbc('0x67')]=function signToken(_0x33a490){return signJwt(_0x33a490);};exports[_0xfbbc('0x68')]=function(_0x258b4a,_0x532cf1){if(!_0x258b4a[_0xfbbc('0x3d')]){return _0x532cf1[_0xfbbc('0x46')](0x194)[_0xfbbc('0x51')]({'message':_0xfbbc('0x69')});}var _0x379e41={'payload':{'id':_0x258b4a[_0xfbbc('0x3d')]['id'],'role':_0x258b4a[_0xfbbc('0x3d')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x379e41)[_0xfbbc('0x43')](function(_0x893ae2){_0x532cf1[_0xfbbc('0x6a')](_0xfbbc('0x6b'),_0x893ae2);_0x532cf1['redirect'](_0xfbbc('0x6c'));})['catch'](function(_0x261138){return _0x532cf1[_0xfbbc('0x46')](0x1f4)[_0xfbbc('0x6d')](_0x261138);});};exports['retrieveApiKey']=function(_0x428c69){if(_[_0xfbbc('0x6e')](_0x428c69[_0xfbbc('0x5a')])||_[_0xfbbc('0x6e')](_0x428c69['apiKeyIat'])){return null;}else{return createJwt(_0x428c69);}};exports['generateApiKey']=function(_0xbb2487){_0xbb2487['apiKeyNonce']=generateNonce();_0xbb2487[_0xfbbc('0x6f')]=generateIssuedAt();return createJwt(_0xbb2487);};exports['regenerateApiKey']=function(_0x10d313,_0x201e4c){var _0x2f832a=_0x10d313[_0xfbbc('0x44')][_0xfbbc('0x55')];if(_0x2f832a){var _0x49a6ba={'nonce':_0x201e4c['apiKeyNonce'],'iat':_0x201e4c['apiKeyIat'],'audience':hardwareConf[_0xfbbc('0x54')](),'issuer':hardwareConf[_0xfbbc('0x54')]()};return verifyJwt(_0x2f832a,_0x49a6ba)['then'](function(){return generateApiKey(_0x201e4c);});}else{throw{'message':_0xfbbc('0x70')};}};exports[_0xfbbc('0x71')]=function(_0x5904b3){var _0x352181=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x352181[_0xfbbc('0x72')](_0x5904b3))throw new db[(_0xfbbc('0x73'))][(_0xfbbc('0x74'))](_0xfbbc('0x75'));return;};exports[_0xfbbc('0x76')]=function(_0x2b1281,_0x50f8e6,_0x48e64e){var _0x218d38=encryptor['decryptString'](_0x50f8e6)[_0xfbbc('0x77')](',');for(var _0x16dc30=0x0;_0x16dc30<_0x48e64e;_0x16dc30++){if(!_0x218d38[_0x16dc30])break;if(_0x2b1281[_0xfbbc('0x78')]()===_0x218d38[_0x16dc30][_0xfbbc('0x78')]()){var _0x3092ab=util[_0xfbbc('0x79')](_0xfbbc('0x7a'),_0x48e64e);if(_0x48e64e===0x1){_0x3092ab=_0xfbbc('0x7b');}throw new db['Sequelize'][(_0xfbbc('0x74'))](_0x3092ab);}}return;};exports['updatePasswordsHistory']=function(_0x2654e8,_0x7d40c5){var _0x221dd3=_0x7d40c5?encryptor[_0xfbbc('0x7c')](_0x7d40c5)['split'](','):[];if(_0x221dd3[_0xfbbc('0x7d')]===0x5){_0x221dd3['splice'](-0x1,0x1);}_0x221dd3[_0xfbbc('0x7e')](_0x2654e8);return encryptor[_0xfbbc('0x7f')](_0x221dd3['join'](','));};function signJwt(_0x1382ba){var _0x1a8f67=BPromise[_0xfbbc('0x80')](jwt[_0xfbbc('0x81')],{'context':jwt});var _0x191d53=_0x1382ba[_0xfbbc('0x82')]||config[_0xfbbc('0xd')]['session'];return new BPromise(function(_0x4c077d,_0x31e09a){_0x1a8f67(_0x1382ba[_0xfbbc('0x83')],_0x191d53,_0x1382ba[_0xfbbc('0x84')])['then'](function(_0x463963){_0x4c077d(_0x463963);})['catch'](function(_0x2ddca7){_0x31e09a(_0x2ddca7);});});}function verifyJwt(_0x218a81,_0x3e34ef,_0x4f7062){var _0x1f0b2c=BPromise[_0xfbbc('0x80')](jwt[_0xfbbc('0x85')],{'context':jwt});var _0xa16948=_0x4f7062||config[_0xfbbc('0xd')][_0xfbbc('0xe')];return new BPromise(function(_0x320b30,_0x1f1465){_0x1f0b2c(_0x218a81,_0xa16948,_0x3e34ef)[_0xfbbc('0x43')](function(_0x19e30a){_0x320b30(_0x19e30a);})[_0xfbbc('0x4a')](function(_0x1835ca){_0x1f1465(_0x1835ca);});});}function generateNonce(){return crypto[_0xfbbc('0x86')](0x10)[_0xfbbc('0x87')](_0xfbbc('0x88'));}function generateIssuedAt(){return Math[_0xfbbc('0x89')](Date[_0xfbbc('0x8a')]()/0x3e8)[_0xfbbc('0x87')]();}function createJwt(_0x55d65d){var _0x389eea={'payload':{'iat':_0x55d65d['apiKeyIat'],'nonce':_0x55d65d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x55d65d['id'][_0xfbbc('0x87')](),'issuer':hardwareConf[_0xfbbc('0x54')](),'audience':hardwareConf[_0xfbbc('0x54')]()}};return signJwt(_0x389eea)[_0xfbbc('0x43')](function(_0x2a07f8){return{'iat':_0x55d65d[_0xfbbc('0x6f')],'nonce':_0x55d65d['apiKeyNonce'],'token':_0x2a07f8};});} \ No newline at end of file +var _0x66c1=['then','closed','query','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','name','authenticate','json','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','use','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','secret','payload','options','session','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','role','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition'];(function(_0x4ce15c,_0x1bbcbd){var _0x5ee259=function(_0xfb0acd){while(--_0xfb0acd){_0x4ce15c['push'](_0x4ce15c['shift']());}};_0x5ee259(++_0x1bbcbd);}(_0x66c1,0xd0));var _0x166c=function(_0x40a0d5,_0x26f161){_0x40a0d5=_0x40a0d5-0x0;var _0x3065c1=_0x66c1[_0x40a0d5];return _0x3065c1;};'use strict';var db=require(_0x166c('0x0'))['db'];var config=require(_0x166c('0x1'));var hardwareConf=require(_0x166c('0x2'));var licenseUtil=require(_0x166c('0x3'));var encryptor=require('../encryptor');var _=require(_0x166c('0x4'));var jwt=require(_0x166c('0x5'));var expressJwt=require(_0x166c('0x6'));var compose=require(_0x166c('0x7'));var basicAuth=require(_0x166c('0x8'));var crypto=require(_0x166c('0x9'));var BPromise=require(_0x166c('0xa'));var util=require(_0x166c('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x166c('0xc')]['session']});var userAttributes=['id',_0x166c('0xd'),'fullname','name',_0x166c('0xe'),_0x166c('0xf'),_0x166c('0x10'),_0x166c('0x11'),_0x166c('0x12'),_0x166c('0x13'),_0x166c('0x14'),_0x166c('0x15'),'faxPause',_0x166c('0x16'),_0x166c('0x17'),_0x166c('0x18'),_0x166c('0x19'),_0x166c('0x1a'),_0x166c('0x1b'),_0x166c('0x1c'),_0x166c('0x1d'),'passwordResetAt',_0x166c('0x1e'),_0x166c('0x1f'),'phoneBarAutoAnswerDelay',_0x166c('0x20'),'phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings',_0x166c('0x21'),'phoneBarPrefixRequired',_0x166c('0x22'),'phoneBarRemoteControlPort',_0x166c('0x23'),_0x166c('0x24'),_0x166c('0x25'),_0x166c('0x26'),_0x166c('0x27'),_0x166c('0x28'),_0x166c('0x29'),_0x166c('0x2a'),_0x166c('0x2b'),_0x166c('0x2c'),_0x166c('0x2d'),_0x166c('0x2e'),_0x166c('0x2f'),_0x166c('0x30'),_0x166c('0x31'),_0x166c('0x32'),_0x166c('0x33'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0x166c('0x34'),'whatsappAutoanswer',_0x166c('0x35'),_0x166c('0x36')];exports[_0x166c('0x37')]=function(){return this[_0x166c('0x38')](!![])['use'](function(_0x4d22a5,_0x4ae734,_0x17aebb){if(_0x4d22a5[_0x166c('0x39')]){_0x17aebb();}else{return db[_0x166c('0x3a')][_0x166c('0x3b')]({'where':{'id':_0x4d22a5[_0x166c('0x3c')]['id']},'attributes':['id','closed',_0x166c('0x3d')],'raw':!![]})[_0x166c('0x3e')](function(_0x1280b6){if(_0x1280b6&&_0x1280b6[_0x166c('0x3f')]&&!_0x4d22a5[_0x166c('0x40')]['forceDownload']){return _0x4ae734[_0x166c('0x41')](_0x1280b6[_0x166c('0x3d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x1280b6[_0x166c('0x3d')]===_0x166c('0x42')?_0x166c('0x43'):_0x166c('0x44')});}else{_0x17aebb();}})['catch'](function(_0x36f81d){_0x17aebb(_0x36f81d);});}});};exports['isAuthenticated']=function isAuthenticated(_0x57c956){return compose()['use'](function(_0x59888d,_0x33b310,_0x52615b){var _0x271ef8;if(_0x59888d[_0x166c('0x45')][_0x166c('0x46')]){if(_[_0x166c('0x47')](_0x59888d[_0x166c('0x45')]['authorization'],_0x166c('0x48'))){var _0x5f1455=basicAuth(_0x59888d);db[_0x166c('0x49')][_0x166c('0x4a')]({'where':{'name':_0x5f1455[_0x166c('0x4b')]}})[_0x166c('0x3e')](function(_0x405918){if(!_0x405918||!_0x405918[_0x166c('0x4c')](_0x5f1455['pass'])){return _0x33b310[_0x166c('0x41')](0x191)[_0x166c('0x4d')]({'message':_0x166c('0x4e')});}_0x59888d['user']={'id':_0x405918['id']};_0x52615b();})[_0x166c('0x4f')](function(_0x32c2da){_0x52615b(_0x32c2da);});}else if(_[_0x166c('0x47')](_0x59888d[_0x166c('0x45')][_0x166c('0x46')],'Bearer')){validateJwt(_0x59888d,_0x33b310,_0x52615b);}else{if(_0x57c956){_0x52615b();}else{return _0x33b310['status'](0x193)[_0x166c('0x4d')]({'message':_0x166c('0x50')});}}}else if(_0x59888d[_0x166c('0x40')][_0x166c('0x51')]){try{var _0x1e5b3a={'audience':hardwareConf[_0x166c('0x52')](),'issuer':hardwareConf[_0x166c('0x52')]()};verifyJwt(_0x59888d[_0x166c('0x40')]['apikey'],_0x1e5b3a)[_0x166c('0x3e')](function(_0x3a9bf4){return db[_0x166c('0x49')][_0x166c('0x4a')]({'where':{'id':_0x3a9bf4['sub']}})[_0x166c('0x3e')](function(_0x47b755){_0x271ef8=_0x47b755;return db[_0x166c('0x53')][_0x166c('0x3b')]({'where':{'id':0x1},'attributes':[_0x166c('0x54'),'blockDuration'],'raw':!![]});})['then'](function(_0x20b26f){if(!_0x271ef8||!_[_0x166c('0x55')](_0x271ef8['apiKeyNonce'],_0x3a9bf4[_0x166c('0x56')])){return _0x33b310[_0x166c('0x41')](0x191)[_0x166c('0x4d')]({'message':_0x166c('0x57')});}if(_0x271ef8[_0x166c('0x58')]){return _0x33b310[_0x166c('0x41')](0x191)[_0x166c('0x4d')]({'message':_0x166c('0x59')});}if(_0x271ef8['blocked']){if(_0x20b26f['blockDuration']>0x0){if(moment(_0x271ef8[_0x166c('0x5a')])[_0x166c('0x5b')](_0x20b26f['blockDuration'],_0x166c('0x5c'))>moment()){return _0x33b310[_0x166c('0x41')](0x191)[_0x166c('0x4d')]({'message':_0x166c('0x59')});}}else{return _0x33b310['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x59888d['user']={'id':_0x271ef8['id']};_0x52615b();});})[_0x166c('0x4f')](function(){return _0x33b310[_0x166c('0x41')](0x191)[_0x166c('0x4d')]({'message':_0x166c('0x59')});});}catch(_0x3e67d3){_0x52615b(_0x3e67d3);}}else if(_0x57c956){_0x52615b();}else{return _0x33b310['status'](0x193)['json']({'message':_0x166c('0x50')});}})['use'](function(_0x21733a,_0x4b898c,_0x2dee88){if(_0x21733a['user']){db[_0x166c('0x49')]['find']({'where':{'id':_0x21733a['user']['id']},'attributes':userAttributes})[_0x166c('0x3e')](function(_0x18b269){if(!_0x18b269){return _0x4b898c[_0x166c('0x41')](0x194)[_0x166c('0x4d')]({'message':_0x166c('0x5d')});}_0x21733a[_0x166c('0x39')]=_0x18b269;_0x2dee88();})[_0x166c('0x4f')](function(_0x5a0e){_0x2dee88(_0x5a0e);});}else if(_0x57c956){_0x2dee88();}else{return _0x4b898c['status'](0x194)[_0x166c('0x4d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x166c('0x5e')]=function canUpdate(){return compose()['use'](function(_0x3e2dc5,_0x5c832d,_0x38ccbb){return licenseUtil[_0x166c('0x5f')]()['then'](function(_0x458da5){if(_0x458da5['update']){_0x38ccbb();}else{return _0x5c832d[_0x166c('0x41')](0x193)['json']({'message':_0x166c('0x60')});}})[_0x166c('0x4f')](function(_0x595b2e){_0x38ccbb(_0x595b2e);});});};exports[_0x166c('0x61')]=function isWebrtcLicence(){return compose()[_0x166c('0x62')](function(_0x4ccf81,_0x564f5a,_0x31e58a){return licenseUtil[_0x166c('0x5f')]()['then'](function(_0x4f9c93){if(_0x4f9c93[_0x166c('0x63')]){_0x31e58a();}else{return _0x564f5a[_0x166c('0x41')](0x193)[_0x166c('0x4d')]({'message':_0x166c('0x60')});}})[_0x166c('0x4f')](function(_0x4246b8){_0x31e58a(_0x4246b8);});});};exports[_0x166c('0x64')]=function(_0x1824d7,_0x3dd1a5,_0x210108){_0x1824d7[_0x166c('0x64')]=!![];return _0x210108();};exports[_0x166c('0x65')]=function signToken(_0x2ba1d7){return signJwt(_0x2ba1d7);};exports[_0x166c('0x66')]=function(_0x137d8d,_0x1842bb){if(!_0x137d8d[_0x166c('0x39')]){return _0x1842bb[_0x166c('0x41')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3f398e={'payload':{'id':_0x137d8d[_0x166c('0x39')]['id'],'role':_0x137d8d['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3f398e)['then'](function(_0x5d89b9){_0x1842bb[_0x166c('0x67')](_0x166c('0x68'),_0x5d89b9);_0x1842bb['redirect']('/dashboards/general');})[_0x166c('0x4f')](function(_0x14b26b){return _0x1842bb[_0x166c('0x41')](0x1f4)[_0x166c('0x69')](_0x14b26b);});};exports['retrieveApiKey']=function(_0x34da16){if(_[_0x166c('0x6a')](_0x34da16[_0x166c('0x6b')])||_[_0x166c('0x6a')](_0x34da16[_0x166c('0x6c')])){return null;}else{return createJwt(_0x34da16);}};exports[_0x166c('0x6d')]=function(_0x3d8dc){_0x3d8dc[_0x166c('0x6b')]=generateNonce();_0x3d8dc['apiKeyIat']=generateIssuedAt();return createJwt(_0x3d8dc);};exports['regenerateApiKey']=function(_0x275492,_0x45dd7d){var _0x556581=_0x275492[_0x166c('0x40')][_0x166c('0x51')];if(_0x556581){var _0x3327cd={'nonce':_0x45dd7d['apiKeyNonce'],'iat':_0x45dd7d['apiKeyIat'],'audience':hardwareConf[_0x166c('0x52')](),'issuer':hardwareConf[_0x166c('0x52')]()};return verifyJwt(_0x556581,_0x3327cd)[_0x166c('0x3e')](function(){return generateApiKey(_0x45dd7d);});}else{throw{'message':_0x166c('0x6e')};}};exports['validatePasswordPattern']=function(_0x565ff2){var _0xe79c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xe79c7['test'](_0x565ff2))throw new db['Sequelize'][(_0x166c('0x6f'))]('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[_0x166c('0x70')]=function(_0x35b2ac,_0x5d5118,_0x563993){var _0xc774eb=encryptor['decryptString'](_0x5d5118)[_0x166c('0x71')](',');for(var _0x50ad4b=0x0;_0x50ad4b<_0x563993;_0x50ad4b++){if(!_0xc774eb[_0x50ad4b])break;if(_0x35b2ac[_0x166c('0x72')]()===_0xc774eb[_0x50ad4b][_0x166c('0x72')]()){var _0x1ad92e=util[_0x166c('0x73')](_0x166c('0x74'),_0x563993);if(_0x563993===0x1){_0x1ad92e=_0x166c('0x75');}throw new db[(_0x166c('0x76'))]['ValidationError'](_0x1ad92e);}}return;};exports[_0x166c('0x77')]=function(_0xe26547,_0x315539){var _0x365d91=_0x315539?encryptor[_0x166c('0x78')](_0x315539)[_0x166c('0x71')](','):[];if(_0x365d91[_0x166c('0x79')]===0x5){_0x365d91[_0x166c('0x7a')](-0x1,0x1);}_0x365d91[_0x166c('0x7b')](_0xe26547);return encryptor['encryptString'](_0x365d91[_0x166c('0x7c')](','));};function signJwt(_0x2a6f23){var _0x4275c0=BPromise[_0x166c('0x7d')](jwt['sign'],{'context':jwt});var _0x37f915=_0x2a6f23[_0x166c('0x7e')]||config['secrets']['session'];return new BPromise(function(_0x396cb4,_0x4b6dec){_0x4275c0(_0x2a6f23[_0x166c('0x7f')],_0x37f915,_0x2a6f23[_0x166c('0x80')])[_0x166c('0x3e')](function(_0x18e7f3){_0x396cb4(_0x18e7f3);})['catch'](function(_0x256732){_0x4b6dec(_0x256732);});});}function verifyJwt(_0x18ebfd,_0x24cc77,_0x10e864){var _0x18c68c=BPromise[_0x166c('0x7d')](jwt['verify'],{'context':jwt});var _0x5e89e3=_0x10e864||config[_0x166c('0xc')][_0x166c('0x81')];return new BPromise(function(_0x26fa52,_0x2f8ab0){_0x18c68c(_0x18ebfd,_0x5e89e3,_0x24cc77)[_0x166c('0x3e')](function(_0xb3b089){_0x26fa52(_0xb3b089);})['catch'](function(_0x29c971){_0x2f8ab0(_0x29c971);});});}function generateNonce(){return crypto[_0x166c('0x82')](0x10)[_0x166c('0x83')](_0x166c('0x84'));}function generateIssuedAt(){return Math[_0x166c('0x85')](Date['now']()/0x3e8)[_0x166c('0x83')]();}function createJwt(_0x1aea94){var _0x1837f9={'payload':{'iat':_0x1aea94['apiKeyIat'],'nonce':_0x1aea94['apiKeyNonce']},'options':{'algorithm':_0x166c('0x86'),'subject':_0x1aea94['id'][_0x166c('0x83')](),'issuer':hardwareConf[_0x166c('0x52')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1837f9)[_0x166c('0x3e')](function(_0x492f4e){return{'iat':_0x1aea94[_0x166c('0x6c')],'nonce':_0x1aea94[_0x166c('0x6b')],'token':_0x492f4e};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index adb865b..d47bd15 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe82c=['describe','CmContact','keys','cf_','findOne','slice','all','length','fieldType','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','skip','checkListsRestrictions','then','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe82c,0xdd));var _0xce82=function(_0x1e27e1,_0x7a1007){_0x1e27e1=_0x1e27e1-0x0;var _0x196c2b=_0xe82c[_0x1e27e1];return _0x196c2b;};'use strict';var _=require('lodash');var sqlUtils=require(_0xce82('0x0'));var db=require(_0xce82('0x1'))['db'];exports[_0xce82('0x2')]=function(_0x4eb1aa,_0x42de27,_0x4bc735,_0xed5567){var _0x125fe3={'count':0x0,'rows':[]};var _0x43fe9a=sqlUtils[_0xce82('0x3')](_0x42de27,_0x4eb1aa);if(_0x43fe9a){return Promise[_0xce82('0x4')](_0x125fe3);}var _0x2d7f61=sqlUtils[_0xce82('0x5')]();var _0x5650b1={};var _0x22a5ff=![];var _0x51eed8=![];return Promise[_0xce82('0x4')]()['then'](function(){if(_0x4eb1aa[_0xce82('0x6')]){return sqlUtils[_0xce82('0x7')](_0x4eb1aa['search'],_0xed5567);}else{return sqlUtils[_0xce82('0x8')](_0x4eb1aa,_0xed5567);}})['then'](function(_0x5f8f4e){_0x2d7f61[_0xce82('0x9')](_0x5f8f4e[_0xce82('0xa')]);_0x2d7f61[_0xce82('0x9')](_0x5f8f4e[_0xce82('0xb')]);_0x2d7f61[_0xce82('0x9')](_0x5f8f4e[_0xce82('0xc')]);_0x2d7f61['where'](_0x5f8f4e[_0xce82('0xd')][_0xce82('0xe')]);_0x5650b1=_0x5f8f4e['tags'];_0x51eed8=_0x5f8f4e[_0xce82('0xd')][_0xce82('0xf')];return sqlUtils[_0xce82('0x10')](_0x42de27,_0x4eb1aa,_0x51eed8);})[_0xce82('0x11')](function(_0x2c1891){_0x2d7f61[_0xce82('0x9')](_0x2c1891);var _0x4e7b25=_0x4eb1aa['search']?_0x5650b1['ids']:_0x4eb1aa[_0xce82('0x12')];_0x22a5ff=_0x4e7b25?!![]:![];return sqlUtils[_0xce82('0x13')](_0x2d7f61,_0x4e7b25);})[_0xce82('0x11')](function(_0x435225){_0x125fe3[_0xce82('0x14')]=_0x435225;if(_0x125fe3[_0xce82('0x14')]===0x0){return;}if(_0x4eb1aa[_0xce82('0x15')]){_0x51eed8=!![];}return sqlUtils[_0xce82('0x16')](_0x2d7f61,_0x4eb1aa[_0xce82('0xb')],_0x4bc735,_0x22a5ff,_0x5650b1[_0xce82('0xe')],_0x51eed8);})[_0xce82('0x11')](function(_0x54cdf6){if(!_0x54cdf6){return[];}return sqlUtils[_0xce82('0x17')](_0x54cdf6,_0x4eb1aa,_0x4bc735);})['then'](function(_0x87fb62){_0x125fe3['rows']=_0x87fb62;return _0x125fe3;})['catch'](function(_0x32e89a){throw _0x32e89a;});};exports[_0xce82('0x18')]=function(){var _0x36fa89={};var _0x219185=[];return db[_0xce82('0x19')][_0xce82('0x18')]()[_0xce82('0x11')](function(_0x3bbd00){_0x36fa89=_0x3bbd00;var _0x40d19f=Object[_0xce82('0x1a')](_0x36fa89)[_0xce82('0xc')](function(_0x22eed6){return _['startsWith'](_0x22eed6,_0xce82('0x1b'))?_0x22eed6:undefined;});var _0x16f043=_0x40d19f['map'](function(_0x5680fa){return db['CmCustomField'][_0xce82('0x1c')]({'where':{'id':_0x5680fa[_0xce82('0x1d')](0x3)},'raw':!![]});});return Promise[_0xce82('0x1e')](_0x16f043);})[_0xce82('0x11')](function(_0x56e80c){for(var _0x5da9a4=0x0;_0x5da9a4<_0x56e80c[_0xce82('0x1f')];_0x5da9a4++){if(_0x56e80c[_0x5da9a4]){var _0x2ecaef=_0xce82('0x1b')+_0x56e80c[_0x5da9a4]['id'];_0x36fa89[_0x2ecaef][_0xce82('0x20')]=_0x56e80c[_0x5da9a4][_0xce82('0x21')];}}_0x219185=_[_0xce82('0x22')](Object[_0xce82('0x1a')](_0x36fa89),function(_0x1d9bd5){return{'name':_0x1d9bd5,'type':_0x36fa89[_0x1d9bd5][_0xce82('0x21')]};});return _0x219185;})['catch'](function(_0x584ab1){throw _0x584ab1;});}; \ No newline at end of file +var _0xbdcc=['user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','startsWith','CmCustomField','findOne','slice','all','length','cf_','fieldType','map','type','lodash','./sql-utils','findAll','skipContactsQuery','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','default','where','fields','filter'];(function(_0x3002a0,_0x6beda2){var _0x9c2ed1=function(_0x1fb3a5){while(--_0x1fb3a5){_0x3002a0['push'](_0x3002a0['shift']());}};_0x9c2ed1(++_0x6beda2);}(_0xbdcc,0x11b));var _0xcbdc=function(_0x2453c1,_0x31fd1e){_0x2453c1=_0x2453c1-0x0;var _0x295a8d=_0xbdcc[_0x2453c1];return _0x295a8d;};'use strict';var _=require(_0xcbdc('0x0'));var sqlUtils=require(_0xcbdc('0x1'));var db=require('../../mysqldb')['db'];exports[_0xcbdc('0x2')]=function(_0x24dd58,_0x2f1354,_0x18e3c8,_0x5f20ca){var _0xfc3f07={'count':0x0,'rows':[]};var _0x317221=sqlUtils[_0xcbdc('0x3')](_0x2f1354,_0x24dd58);if(_0x317221){return Promise['resolve'](_0xfc3f07);}var _0xfe77a4=sqlUtils[_0xcbdc('0x4')]();var _0x1cf13c={};var _0x2e30ab=![];var _0x52ad36=![];return Promise['resolve']()[_0xcbdc('0x5')](function(){if(_0x24dd58['search']){return sqlUtils[_0xcbdc('0x6')](_0x24dd58[_0xcbdc('0x7')],_0x5f20ca);}else{return sqlUtils[_0xcbdc('0x8')](_0x24dd58,_0x5f20ca);}})[_0xcbdc('0x5')](function(_0x541132){_0xfe77a4['where'](_0x541132[_0xcbdc('0x9')]);_0xfe77a4[_0xcbdc('0xa')](_0x541132[_0xcbdc('0xb')]);_0xfe77a4[_0xcbdc('0xa')](_0x541132[_0xcbdc('0xc')]);_0xfe77a4[_0xcbdc('0xa')](_0x541132[_0xcbdc('0xd')][_0xcbdc('0xe')]);_0x1cf13c=_0x541132[_0xcbdc('0xf')];_0x52ad36=_0x541132[_0xcbdc('0xd')][_0xcbdc('0x10')];return sqlUtils[_0xcbdc('0x11')](_0x2f1354,_0x24dd58,_0x52ad36);})[_0xcbdc('0x5')](function(_0x15b5a1){_0xfe77a4[_0xcbdc('0xa')](_0x15b5a1);var _0x2ef01e=_0x24dd58[_0xcbdc('0x7')]?_0x1cf13c['ids']:_0x24dd58[_0xcbdc('0x12')];_0x2e30ab=_0x2ef01e?!![]:![];return sqlUtils[_0xcbdc('0x13')](_0xfe77a4,_0x2ef01e);})[_0xcbdc('0x5')](function(_0x331e21){_0xfc3f07['count']=_0x331e21;if(_0xfc3f07['count']===0x0){return;}if(_0x24dd58[_0xcbdc('0x14')]){_0x52ad36=!![];}return sqlUtils[_0xcbdc('0x15')](_0xfe77a4,_0x24dd58[_0xcbdc('0xb')],_0x18e3c8,_0x2e30ab,_0x1cf13c[_0xcbdc('0xe')],_0x52ad36);})['then'](function(_0x80e8e4){if(!_0x80e8e4){return[];}return sqlUtils[_0xcbdc('0x16')](_0x80e8e4,_0x24dd58,_0x18e3c8);})['then'](function(_0x381718){_0xfc3f07[_0xcbdc('0x17')]=_0x381718;return _0xfc3f07;})[_0xcbdc('0x18')](function(_0x2d942b){throw _0x2d942b;});};exports[_0xcbdc('0x19')]=function(){var _0x5817cd={};var _0x4d1756=[];return db[_0xcbdc('0x1a')][_0xcbdc('0x19')]()[_0xcbdc('0x5')](function(_0x43e790){_0x5817cd=_0x43e790;var _0x33af29=Object['keys'](_0x5817cd)['filter'](function(_0x276181){return _[_0xcbdc('0x1b')](_0x276181,'cf_')?_0x276181:undefined;});var _0x4f4700=_0x33af29['map'](function(_0x3af30c){return db[_0xcbdc('0x1c')][_0xcbdc('0x1d')]({'where':{'id':_0x3af30c[_0xcbdc('0x1e')](0x3)},'raw':!![]});});return Promise[_0xcbdc('0x1f')](_0x4f4700);})['then'](function(_0x20489c){for(var _0x17afdd=0x0;_0x17afdd<_0x20489c[_0xcbdc('0x20')];_0x17afdd++){if(_0x20489c[_0x17afdd]){var _0x175452=_0xcbdc('0x21')+_0x20489c[_0x17afdd]['id'];_0x5817cd[_0x175452][_0xcbdc('0x22')]=_0x20489c[_0x17afdd]['type'];}}_0x4d1756=_[_0xcbdc('0x23')](Object['keys'](_0x5817cd),function(_0x15069c){return{'name':_0x15069c,'type':_0x5817cd[_0x15069c][_0xcbdc('0x24')]};});return _0x4d1756;})[_0xcbdc('0x18')](function(_0x128c85){throw _0x128c85;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 9c91d92..ee1649b 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9ec=['agent','search','ListId','true','from','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','CompanyId','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','getFullTextValue','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','dateOfBirth','castTo','DATE','text','value','start','end','Tag','split','map','clause','and','tags','ids','user','uc.UserId\x20=\x20?','keys','compact','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','getLists','select','group','limit','offset','having','order','DESC','subqry.','findAll','name','keyBy','Sequelize','QueryTypes','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','where','exports','lodash','squel','../interaction/utils','../../mysqldb'];(function(_0x533381,_0x8a69fa){var _0x2877ed=function(_0x45cb54){while(--_0x45cb54){_0x533381['push'](_0x533381['shift']());}};_0x2877ed(++_0x8a69fa);}(_0xe9ec,0x1e6));var _0xce9e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe9ec[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xce9e('0x0'));var squel=require(_0xce9e('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xce9e('0x2'));var db=require(_0xce9e('0x3'))['db'];function skipContactsQuery(_0x154700,_0x3cfd32){var _0x2d445f=![];if(_0x154700['role']===_0xce9e('0x4')&&!_0x3cfd32[_0xce9e('0x5')]&&!_0x3cfd32[_0xce9e('0x6')]&&_0x3cfd32['autocomplete']!==_0xce9e('0x7')){_0x2d445f=!![];}return _0x2d445f;}function getContactsSubquery(){return squel['select']()[_0xce9e('0x8')]('cm_contacts','c')['where'](_0xce9e('0x9'));}function applyJoinClauses(_0x18af6a,_0x3f3364){var _0x48e569=_0x3f3364?'c':_0xce9e('0xa');_0x18af6a[_0xce9e('0xb')](_0xce9e('0xc'),'uc','uc.CmContactId\x20=\x20'+_0x48e569+_0xce9e('0xd'))[_0xce9e('0xb')](_0xce9e('0xe'),'ct',_0xce9e('0xf')+_0x48e569+_0xce9e('0xd'))[_0xce9e('0xb')](_0xce9e('0x10'),'t',_0xce9e('0x11'));return _0x18af6a;}function addFieldsToQuery(_0x470ba0,_0x20fd62,_0x3cb017,_0x31b72f,_0x3e9e87){var _0x10d1ca=_0x3e9e87?'c':_0xce9e('0xa');if(!_0x20fd62){_0x20fd62=['id',_0xce9e('0x12'),_0xce9e('0x13'),_0xce9e('0x14'),_0xce9e('0x15'),'fax',_0xce9e('0x16'),'ListId',_0xce9e('0x17'),'createdAt',_0xce9e('0x18'),_0xce9e('0x19'),_0xce9e('0x1a')];}else if(!_0x20fd62['includes']('id')){_0x20fd62[_0xce9e('0x1b')]('id');}var _0x142a57=_0x3cb017&&_0x3e9e87||!_0x3cb017&&!_0x3e9e87;if(_0x31b72f){_0x142a57=_0x31b72f&&_0x3e9e87||!_0x31b72f&&!_0x3e9e87;}_0x20fd62[_0xce9e('0x1c')](function(_0x204886){if(_0x204886===_0xce9e('0x1a')){if(_0x142a57){_0x470ba0[_0xce9e('0x1d')](_0xce9e('0x1e'),_0x204886);}else if(_0x3cb017||_0x31b72f){_0x470ba0[_0xce9e('0x1d')](_0x10d1ca+'.'+_0x204886);}}else{_0x470ba0['field'](_0x10d1ca+'.'+_0x204886);}});return _0x470ba0;}function getSqlClauses(){var _0x80198d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0xce9e('0x1f')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x80198d;}function parseTagParameter(_0x239083){var _0x58c165=squel[_0xce9e('0x1f')]();if(_0x239083){var _0x2df602=utils[_0xce9e('0x20')](_0x239083);_0x2df602[_0xce9e('0x1c')](function(_0x4df614){_0x58c165['or'](_0xce9e('0x21'),'%,'+_0x4df614+',%');});}return _0x58c165;}function parseSearchFilter(_0x4172b4){var _0x1eb930=squel[_0xce9e('0x1f')]();if(_0x4172b4){var _0x44ec91=_0x4172b4['replace']('\x5c','\x5c\x5c')[_0xce9e('0x22')](/'/g,'\x27\x27');if(_0x44ec91['split']('\x20')[_0xce9e('0x23')]>0x1){_0x1eb930['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xce9e('0x24')](_0x44ec91,!![]),null);}else{if(qs['isNumeric'](_0x44ec91)){_0x1eb930['or']('c.id\x20LIKE\x20?',_0x44ec91+'%');_0x1eb930['or']('c.phone\x20LIKE\x20?',_0x44ec91+'%');_0x1eb930['or'](_0xce9e('0x25'),_0x44ec91+'%');_0x1eb930['or']('c.fax\x20LIKE\x20?',_0x44ec91+'%');}else if(qs['isEmail'](_0x44ec91)){_0x1eb930['or'](_0xce9e('0x26'),_0x44ec91+'%');}else{_0x1eb930['or'](_0xce9e('0x27'),'%'+_0x44ec91+'%');_0x1eb930['or'](_0xce9e('0x28'),'%'+_0x44ec91+'%');_0x1eb930['or'](_0xce9e('0x26'),'%'+_0x44ec91+'%');}}}return _0x1eb930;}function parseAdvancedSearchFilter(_0x300cdb,_0x4dbc0f){var _0x49d297=getSqlClauses();var _0xab6c0c=as[_0xce9e('0x29')](_0x300cdb);var _0x110cf7=_0xab6c0c['sqlOperator'];for(var _0x2af6d2=0x0;_0x2af6d2<_0xab6c0c[_0xce9e('0x2a')][_0xce9e('0x23')];_0x2af6d2++){var _0x2d2c51=_0xab6c0c[_0xce9e('0x2a')][_0x2af6d2];var _0x3e2180='c';var _0x26fb90=_[_0xce9e('0x2b')](_0x4dbc0f,['name',_0x2d2c51[_0xce9e('0x1d')]]);if(_0x26fb90){if(_0x2d2c51['field']===_0xce9e('0x2c')||_0x26fb90['fieldType']==='datetime'){_0x2d2c51[_0xce9e('0x2d')]=_0xce9e('0x2e');}var _0x43152f=as['buildExpression'](_0x3e2180,_0x26fb90['type'],_0x2d2c51);_0x49d297['default'][_0x110cf7](_0x43152f[_0xce9e('0x2f')],_0x43152f[_0xce9e('0x30')][_0xce9e('0x31')],_0x43152f[_0xce9e('0x30')][_0xce9e('0x32')]);}else{if(_0x2d2c51[_0xce9e('0x1d')]===_0xce9e('0x33')){var _0x57a1f8=_0x2d2c51[_0xce9e('0x30')][_0xce9e('0x34')](',')[_0xce9e('0x35')](function(_0x3ffb52){return Number(_0x3ffb52);});var _0x31141b=parseTagParameter(_0x57a1f8);_0x49d297['tags'][_0xce9e('0x36')][_0xce9e('0x37')](_0x31141b);_0x49d297[_0xce9e('0x38')][_0xce9e('0x39')]=_0x57a1f8;}else if(_0x2d2c51[_0xce9e('0x1d')]==='User'){_0x49d297[_0xce9e('0x3a')][_0xce9e('0x36')]['and'](_0xce9e('0x3b'),_0x2d2c51['value']);_0x49d297['user']['skip']=!![];}}}return _0x49d297;}function parseModelFields(_0x3193b6,_0x4b015e){var _0x44a85b=squel[_0xce9e('0x1f')]();var _0x5efa3e=_(_0x3193b6)[_0xce9e('0x3c')]()[_0xce9e('0x35')](function(_0x4fe823){return _['some'](_0x4b015e,['name',_0x4fe823])?_0x4fe823:undefined;})[_0xce9e('0x3d')]()[_0xce9e('0x30')]();if(_0x3193b6[_0xce9e('0x3e')]){_0x5efa3e[_0xce9e('0x1b')](_0xce9e('0x3e'));}if(_0x3193b6[_0xce9e('0x3f')]){_0x5efa3e[_0xce9e('0x1b')](_0xce9e('0x3f'));}if(_0x5efa3e[_0xce9e('0x23')]>0x0){_0x5efa3e[_0xce9e('0x1c')](function(_0xbad206){if(_0xbad206==='ListId'){_0x44a85b['and'](_0xce9e('0x40'),[]['concat'](_0x3193b6[_0xbad206]));}else if(_0xbad206==='Contact'){var _0x24a870='%'+_0x3193b6[_0xbad206]+'%';_0x44a85b['and'](_0xce9e('0x41'),_0x24a870);}else if(_0xbad206==='User'){_0x44a85b['and']('uc.UserId\x20=\x20?',_0x3193b6[_0xbad206]);}else{_0x44a85b[_0xce9e('0x37')]('c.'+_0xbad206+_0xce9e('0x42'),_0x3193b6[_0xbad206]);}});}return _0x44a85b;}function parseQueryParameters(_0x348251,_0x2a9675){var _0x5a7f95=getSqlClauses();return Promise[_0xce9e('0x43')]()[_0xce9e('0x44')](function(){return parseModelFields(_0x348251,_0x2a9675);})[_0xce9e('0x44')](function(_0x3b759f){_0x5a7f95[_0xce9e('0x45')][_0xce9e('0x37')](_0x3b759f);return parseTagParameter(_0x348251[_0xce9e('0x46')]);})[_0xce9e('0x44')](function(_0xc81042){_0x5a7f95['tags'][_0xce9e('0x36')]['and'](_0xc81042);return parseSearchFilter(_0x348251[_0xce9e('0x47')]);})[_0xce9e('0x44')](function(_0x4ed6ac){_0x5a7f95['filter']=_0x4ed6ac;return _0x5a7f95;});}function checkListsRestrictions(_0x113e86,_0x51cb5b,_0x3b578f){var _0x4f364b=squel[_0xce9e('0x1f')]();return Promise[_0xce9e('0x43')]()['then'](function(){if(_0x51cb5b[_0xce9e('0x5')]&&_0x113e86[_0xce9e('0x48')]===_0xce9e('0x4')&&!_0x3b578f){return _0x113e86[_0xce9e('0x49')]({'attributes':['id'],'raw':!![]});}})[_0xce9e('0x44')](function(_0x186444){if(_0x186444){if(_0x186444[_0xce9e('0x23')]===0x0){_0x4f364b[_0xce9e('0x37')]('c.ListId\x20IS\x20NULL');}else{_0x4f364b['and'](_0xce9e('0x40'),_[_0xce9e('0x35')](_0x186444,'id'));}}})[_0xce9e('0x44')](function(){return _0x4f364b;});}function buildContactsQuery(_0x48594c,_0x4029d2,_0xbf2dfb,_0x267175,_0x55a9f6,_0x393709){if(_0x4029d2){_0x4029d2=_0xbf2dfb['attributes'];}_0x48594c=addFieldsToQuery(_0x48594c,_0x4029d2,_0x267175,_0x393709,!![]);var _0x3231e1=squel[_0xce9e('0x4a')]();_0x3231e1=addFieldsToQuery(_0x3231e1,_0x4029d2,_0x267175,_0x393709,![]);if(_0x267175||_0x393709){_0x48594c=applyJoinClauses(_0x48594c,!![]);_0x48594c[_0xce9e('0x4b')]('c.id');if(_0xbf2dfb['limit']){_0x3231e1['limit'](_0xbf2dfb[_0xce9e('0x4c')]);}if(_0xbf2dfb[_0xce9e('0x4d')]){_0x3231e1[_0xce9e('0x4d')](_0xbf2dfb[_0xce9e('0x4d')]);}}else{_0x3231e1=applyJoinClauses(_0x3231e1,![]);_0x3231e1[_0xce9e('0x4b')]('subqry.id');if(_0xbf2dfb[_0xce9e('0x4c')]){_0x48594c['limit'](_0xbf2dfb[_0xce9e('0x4c')]);}if(_0xbf2dfb['offset']){_0x48594c['offset'](_0xbf2dfb[_0xce9e('0x4d')]);}}_0x3231e1[_0xce9e('0x4e')](_0x55a9f6);if(_0xbf2dfb['order']){_0xbf2dfb['order']['forEach'](function(_0x27a4e3){_0x48594c[_0xce9e('0x4f')]('c.'+_0x27a4e3[0x0],_0x27a4e3[0x1]===_0xce9e('0x50')?![]:!![]);_0x3231e1['order'](_0xce9e('0x51')+_0x27a4e3[0x0],_0x27a4e3[0x1]===_0xce9e('0x50')?![]:!![]);});}_0x3231e1['from'](_0x48594c,_0xce9e('0xa'));return _0x3231e1;}function getFilteredContacts(_0x5f1be6){var _0x3a0855=[];return db['Tag'][_0xce9e('0x52')]({'attributes':['id',_0xce9e('0x53'),'color'],'raw':!![]})[_0xce9e('0x44')](function(_0x4b1240){_0x3a0855=_[_0xce9e('0x54')](_0x4b1240,'id');var _0x5d03ea={'type':db[_0xce9e('0x55')][_0xce9e('0x56')][_0xce9e('0x57')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xce9e('0x58')][_0xce9e('0x59')](_0x5f1be6[_0xce9e('0x5a')](),_0x5d03ea);})[_0xce9e('0x44')](function(_0x35e586){_0x35e586[_0xce9e('0x1c')](function(_0x5cd235){if(_0x5cd235[_0xce9e('0x1a')]){_0x5cd235['Tags']=[];_0x5cd235[_0xce9e('0x1a')]['split'](',')['forEach'](function(_0x5d691a){_0x5cd235[_0xce9e('0x5b')][_0xce9e('0x1b')](_0x3a0855[_0x5d691a]);});}delete _0x5cd235['TagIds'];});return _0x35e586;});}function countFilteredContacts(_0x5230af,_0x4da4cb){var _0x54c5b0=_0x5230af[_0xce9e('0x5c')]();_0x54c5b0['field'](_0xce9e('0x5d'));_0x54c5b0=applyJoinClauses(_0x54c5b0,!![]);_0x5230af[_0xce9e('0x4b')](_0xce9e('0x5e'));var _0x2bc6fd=utils[_0xce9e('0x20')](_0x4da4cb);if(!_[_0xce9e('0x5f')](_0x2bc6fd)){_0x54c5b0[_0xce9e('0x60')]('t.id\x20IN\x20?',_0x2bc6fd);}var _0x2b2499={'type':db[_0xce9e('0x55')][_0xce9e('0x56')]['SELECT'],'raw':!![]};return db[_0xce9e('0x58')][_0xce9e('0x59')](_0x54c5b0[_0xce9e('0x5a')](),_0x2b2499)[_0xce9e('0x44')](function(_0x3ebb1a){return _0x3ebb1a[0x0][_0xce9e('0x5d')];});}module[_0xce9e('0x61')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7b8f=['t.id\x20IN\x20?','toString','COUNT(*)','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','length','conditions','find','name','dateOfBirth','datetime','type','default','text','value','start','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','tag','filter','search','role','getLists','c.ListId\x20IS\x20NULL','map','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','clone','isEmpty'];(function(_0x40ddf5,_0x487622){var _0x1e22fd=function(_0x3831d2){while(--_0x3831d2){_0x40ddf5['push'](_0x40ddf5['shift']());}};_0x1e22fd(++_0x487622);}(_0x7b8f,0x1ab));var _0xf7b8=function(_0xa0b432,_0x55f6c9){_0xa0b432=_0xa0b432-0x0;var _0x4a35ed=_0x7b8f[_0xa0b432];return _0x4a35ed;};'use strict';var _=require(_0xf7b8('0x0'));var squel=require('squel');var as=require(_0xf7b8('0x1'));var qs=require(_0xf7b8('0x2'));var utils=require(_0xf7b8('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x133c91,_0x572e04){var _0x3c5ac0=![];if(_0x133c91['role']===_0xf7b8('0x4')&&!_0x572e04['search']&&!_0x572e04['ListId']&&_0x572e04['autocomplete']!==_0xf7b8('0x5')){_0x3c5ac0=!![];}return _0x3c5ac0;}function getContactsSubquery(){return squel[_0xf7b8('0x6')]()[_0xf7b8('0x7')](_0xf7b8('0x8'),'c')[_0xf7b8('0x9')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x2f88c6,_0x512a0b){var _0xd4026c=_0x512a0b?'c':_0xf7b8('0xa');_0x2f88c6[_0xf7b8('0xb')](_0xf7b8('0xc'),'uc','uc.CmContactId\x20=\x20'+_0xd4026c+'.id')['left_join']('cm_contact_has_tags','ct',_0xf7b8('0xd')+_0xd4026c+_0xf7b8('0xe'))[_0xf7b8('0xb')](_0xf7b8('0xf'),'t',_0xf7b8('0x10'));return _0x2f88c6;}function addFieldsToQuery(_0x375622,_0x528cee,_0x104735,_0x14a973,_0x1b66ab){var _0x3c23ef=_0x1b66ab?'c':_0xf7b8('0xa');if(!_0x528cee){_0x528cee=['id',_0xf7b8('0x11'),_0xf7b8('0x12'),_0xf7b8('0x13'),'mobile',_0xf7b8('0x14'),_0xf7b8('0x15'),_0xf7b8('0x16'),_0xf7b8('0x17'),_0xf7b8('0x18'),'updatedAt',_0xf7b8('0x19'),_0xf7b8('0x1a')];}else if(!_0x528cee[_0xf7b8('0x1b')]('id')){_0x528cee[_0xf7b8('0x1c')]('id');}var _0x1dac6b=_0x104735&&_0x1b66ab||!_0x104735&&!_0x1b66ab;if(_0x14a973){_0x1dac6b=_0x14a973&&_0x1b66ab||!_0x14a973&&!_0x1b66ab;}_0x528cee[_0xf7b8('0x1d')](function(_0x329771){if(_0x329771===_0xf7b8('0x1a')){if(_0x1dac6b){_0x375622['field'](_0xf7b8('0x1e'),_0x329771);}else if(_0x104735||_0x14a973){_0x375622[_0xf7b8('0x1f')](_0x3c23ef+'.'+_0x329771);}}else{_0x375622[_0xf7b8('0x1f')](_0x3c23ef+'.'+_0x329771);}});return _0x375622;}function getSqlClauses(){var _0x1f7eb8={'default':squel['expr'](),'fields':squel[_0xf7b8('0x20')](),'filter':squel[_0xf7b8('0x20')](),'tags':{'clause':squel[_0xf7b8('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1f7eb8;}function parseTagParameter(_0x1fdfc0){var _0x6a48a6=squel[_0xf7b8('0x20')]();if(_0x1fdfc0){var _0x32566f=utils[_0xf7b8('0x21')](_0x1fdfc0);_0x32566f[_0xf7b8('0x1d')](function(_0x42c3d){_0x6a48a6['or'](_0xf7b8('0x22'),'%,'+_0x42c3d+',%');});}return _0x6a48a6;}function parseSearchFilter(_0x1886c3){var _0x43fceb=squel[_0xf7b8('0x20')]();if(_0x1886c3){var _0x27223b=_0x1886c3['replace']('\x5c','\x5c\x5c')[_0xf7b8('0x23')](/'/g,'\x27\x27');if(_0x27223b[_0xf7b8('0x24')]('\x20')['length']>0x1){_0x43fceb['or'](_0xf7b8('0x25'),qs[_0xf7b8('0x26')](_0x27223b,!![]),null);}else{if(qs[_0xf7b8('0x27')](_0x27223b)){_0x43fceb['or'](_0xf7b8('0x28'),_0x27223b+'%');_0x43fceb['or'](_0xf7b8('0x29'),_0x27223b+'%');_0x43fceb['or'](_0xf7b8('0x2a'),_0x27223b+'%');_0x43fceb['or'](_0xf7b8('0x2b'),_0x27223b+'%');}else if(qs[_0xf7b8('0x2c')](_0x27223b)){_0x43fceb['or'](_0xf7b8('0x2d'),_0x27223b+'%');}else{_0x43fceb['or'](_0xf7b8('0x2e'),'%'+_0x27223b+'%');_0x43fceb['or'](_0xf7b8('0x2f'),'%'+_0x27223b+'%');_0x43fceb['or'](_0xf7b8('0x2d'),'%'+_0x27223b+'%');}}}return _0x43fceb;}function parseAdvancedSearchFilter(_0x1ba225,_0x1e0304){var _0x2f699c=getSqlClauses();var _0x47ae7d=as[_0xf7b8('0x30')](_0x1ba225);var _0x46ca31=_0x47ae7d['sqlOperator'];for(var _0x5c676b=0x0;_0x5c676b<_0x47ae7d['conditions'][_0xf7b8('0x31')];_0x5c676b++){var _0x26df6f=_0x47ae7d[_0xf7b8('0x32')][_0x5c676b];var _0xb4678b='c';var _0x4dc4cd=_[_0xf7b8('0x33')](_0x1e0304,[_0xf7b8('0x34'),_0x26df6f['field']]);if(_0x4dc4cd){if(_0x26df6f[_0xf7b8('0x1f')]===_0xf7b8('0x35')||_0x4dc4cd['fieldType']===_0xf7b8('0x36')){_0x26df6f['castTo']='DATE';}var _0x53e27b=as['buildExpression'](_0xb4678b,_0x4dc4cd[_0xf7b8('0x37')],_0x26df6f);_0x2f699c[_0xf7b8('0x38')][_0x46ca31](_0x53e27b[_0xf7b8('0x39')],_0x53e27b[_0xf7b8('0x3a')][_0xf7b8('0x3b')],_0x53e27b[_0xf7b8('0x3a')]['end']);}else{if(_0x26df6f[_0xf7b8('0x1f')]===_0xf7b8('0x3c')){var _0x456ab7=_0x26df6f[_0xf7b8('0x3a')][_0xf7b8('0x24')](',')['map'](function(_0x32ad61){return Number(_0x32ad61);});var _0x568dc4=parseTagParameter(_0x456ab7);_0x2f699c[_0xf7b8('0x3d')][_0xf7b8('0x3e')][_0xf7b8('0x3f')](_0x568dc4);_0x2f699c['tags'][_0xf7b8('0x40')]=_0x456ab7;}else if(_0x26df6f[_0xf7b8('0x1f')]===_0xf7b8('0x41')){_0x2f699c[_0xf7b8('0x42')][_0xf7b8('0x3e')]['and'](_0xf7b8('0x43'),_0x26df6f[_0xf7b8('0x3a')]);_0x2f699c[_0xf7b8('0x42')][_0xf7b8('0x44')]=!![];}}}return _0x2f699c;}function parseModelFields(_0x259bf3,_0x5f5358){var _0x41a7ef=squel[_0xf7b8('0x20')]();var _0x18df17=_(_0x259bf3)[_0xf7b8('0x45')]()['map'](function(_0x510a74){return _[_0xf7b8('0x46')](_0x5f5358,[_0xf7b8('0x34'),_0x510a74])?_0x510a74:undefined;})[_0xf7b8('0x47')]()[_0xf7b8('0x3a')]();if(_0x259bf3[_0xf7b8('0x48')]){_0x18df17[_0xf7b8('0x1c')](_0xf7b8('0x48'));}if(_0x259bf3[_0xf7b8('0x41')]){_0x18df17['push'](_0xf7b8('0x41'));}if(_0x18df17['length']>0x0){_0x18df17['forEach'](function(_0x30ef36){if(_0x30ef36===_0xf7b8('0x16')){_0x41a7ef['and'](_0xf7b8('0x49'),[][_0xf7b8('0x4a')](_0x259bf3[_0x30ef36]));}else if(_0x30ef36===_0xf7b8('0x48')){var _0x4eecf5='%'+_0x259bf3[_0x30ef36]+'%';_0x41a7ef[_0xf7b8('0x3f')](_0xf7b8('0x4b'),_0x4eecf5);}else if(_0x30ef36===_0xf7b8('0x41')){_0x41a7ef[_0xf7b8('0x3f')](_0xf7b8('0x43'),_0x259bf3[_0x30ef36]);}else{_0x41a7ef[_0xf7b8('0x3f')]('c.'+_0x30ef36+'\x20=\x20?',_0x259bf3[_0x30ef36]);}});}return _0x41a7ef;}function parseQueryParameters(_0x555cc3,_0xc9bf45){var _0x32ffc1=getSqlClauses();return Promise[_0xf7b8('0x4c')]()[_0xf7b8('0x4d')](function(){return parseModelFields(_0x555cc3,_0xc9bf45);})[_0xf7b8('0x4d')](function(_0x72ac44){_0x32ffc1['fields'][_0xf7b8('0x3f')](_0x72ac44);return parseTagParameter(_0x555cc3[_0xf7b8('0x4e')]);})[_0xf7b8('0x4d')](function(_0x1bffd7){_0x32ffc1['tags'][_0xf7b8('0x3e')]['and'](_0x1bffd7);return parseSearchFilter(_0x555cc3[_0xf7b8('0x4f')]);})[_0xf7b8('0x4d')](function(_0x502815){_0x32ffc1['filter']=_0x502815;return _0x32ffc1;});}function checkListsRestrictions(_0x10096d,_0x3772f1,_0x3efa7a){var _0x322a64=squel[_0xf7b8('0x20')]();return Promise[_0xf7b8('0x4c')]()[_0xf7b8('0x4d')](function(){if(_0x3772f1[_0xf7b8('0x50')]&&_0x10096d[_0xf7b8('0x51')]===_0xf7b8('0x4')&&!_0x3efa7a){return _0x10096d[_0xf7b8('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x596186){if(_0x596186){if(_0x596186[_0xf7b8('0x31')]===0x0){_0x322a64[_0xf7b8('0x3f')](_0xf7b8('0x53'));}else{_0x322a64[_0xf7b8('0x3f')]('c.ListId\x20IN\x20?',_[_0xf7b8('0x54')](_0x596186,'id'));}}})[_0xf7b8('0x4d')](function(){return _0x322a64;});}function buildContactsQuery(_0x3c936b,_0x20c4c0,_0x15ef1d,_0x1e40ba,_0x31c158,_0x24a0e6){if(_0x20c4c0){_0x20c4c0=_0x15ef1d['attributes'];}_0x3c936b=addFieldsToQuery(_0x3c936b,_0x20c4c0,_0x1e40ba,_0x24a0e6,!![]);var _0x1c4325=squel[_0xf7b8('0x6')]();_0x1c4325=addFieldsToQuery(_0x1c4325,_0x20c4c0,_0x1e40ba,_0x24a0e6,![]);if(_0x1e40ba||_0x24a0e6){_0x3c936b=applyJoinClauses(_0x3c936b,!![]);_0x3c936b[_0xf7b8('0x55')](_0xf7b8('0x56'));if(_0x15ef1d['limit']){_0x1c4325[_0xf7b8('0x57')](_0x15ef1d[_0xf7b8('0x57')]);}if(_0x15ef1d[_0xf7b8('0x58')]){_0x1c4325[_0xf7b8('0x58')](_0x15ef1d[_0xf7b8('0x58')]);}}else{_0x1c4325=applyJoinClauses(_0x1c4325,![]);_0x1c4325[_0xf7b8('0x55')](_0xf7b8('0x59'));if(_0x15ef1d[_0xf7b8('0x57')]){_0x3c936b[_0xf7b8('0x57')](_0x15ef1d[_0xf7b8('0x57')]);}if(_0x15ef1d[_0xf7b8('0x58')]){_0x3c936b[_0xf7b8('0x58')](_0x15ef1d['offset']);}}_0x1c4325[_0xf7b8('0x5a')](_0x31c158);if(_0x15ef1d[_0xf7b8('0x5b')]){_0x15ef1d[_0xf7b8('0x5b')]['forEach'](function(_0x22b98a){_0x3c936b[_0xf7b8('0x5b')]('c.'+_0x22b98a[0x0],_0x22b98a[0x1]===_0xf7b8('0x5c')?![]:!![]);_0x1c4325[_0xf7b8('0x5b')]('subqry.'+_0x22b98a[0x0],_0x22b98a[0x1]===_0xf7b8('0x5c')?![]:!![]);});}_0x1c4325[_0xf7b8('0x7')](_0x3c936b,_0xf7b8('0xa'));return _0x1c4325;}function getFilteredContacts(_0x1d4afa){var _0x43fd89=[];return db['Tag'][_0xf7b8('0x5d')]({'attributes':['id',_0xf7b8('0x34'),'color'],'raw':!![]})[_0xf7b8('0x4d')](function(_0x18977a){_0x43fd89=_[_0xf7b8('0x5e')](_0x18977a,'id');var _0x3df0d5={'type':db[_0xf7b8('0x5f')][_0xf7b8('0x60')][_0xf7b8('0x61')],'model':db[_0xf7b8('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xf7b8('0x63')][_0xf7b8('0x64')](_0x1d4afa['toString'](),_0x3df0d5);})[_0xf7b8('0x4d')](function(_0x2096f1){_0x2096f1[_0xf7b8('0x1d')](function(_0x5112c2){if(_0x5112c2[_0xf7b8('0x1a')]){_0x5112c2['Tags']=[];_0x5112c2[_0xf7b8('0x1a')][_0xf7b8('0x24')](',')['forEach'](function(_0x3da917){_0x5112c2['Tags']['push'](_0x43fd89[_0x3da917]);});}delete _0x5112c2[_0xf7b8('0x1a')];});return _0x2096f1;});}function countFilteredContacts(_0x1ec3e7,_0x533d4c){var _0x355ff6=_0x1ec3e7[_0xf7b8('0x65')]();_0x355ff6[_0xf7b8('0x1f')]('COUNT(*)');_0x355ff6=applyJoinClauses(_0x355ff6,!![]);_0x1ec3e7['group'](_0xf7b8('0x56'));var _0x4e5afb=utils[_0xf7b8('0x21')](_0x533d4c);if(!_[_0xf7b8('0x66')](_0x4e5afb)){_0x355ff6[_0xf7b8('0x9')](_0xf7b8('0x67'),_0x4e5afb);}var _0x100019={'type':db[_0xf7b8('0x5f')][_0xf7b8('0x60')]['SELECT'],'raw':!![]};return db['sequelize'][_0xf7b8('0x64')](_0x355ff6[_0xf7b8('0x68')](),_0x100019)[_0xf7b8('0x4d')](function(_0xef6cd2){return _0xef6cd2[0x0][_0xf7b8('0x69')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9d951e1..39a6ada 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 _0x8d18=['encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','secret','base64','utf8','bluebird','lodash','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','hasOwnProperty'];(function(_0x18d79a,_0x353abd){var _0x3b72e5=function(_0xc85d10){while(--_0xc85d10){_0x18d79a['push'](_0x18d79a['shift']());}};_0x3b72e5(++_0x353abd);}(_0x8d18,0xb1));var _0x88d1=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x8d18[_0x58965a];return _0x254efc;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x88d1('0x0'));var _=require(_0x88d1('0x1'));var config=require(_0x88d1('0x2'));var logger=require('../../config/logger')(_0x88d1('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x88d1('0x4')],'algorithm':_0x88d1('0x5')};const fileOptions={'algorithm':_0x88d1('0x6')};if(config['encrypt']&&config[_0x88d1('0x7')][_0x88d1('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x88d1('0x8')]=config[_0x88d1('0x7')][_0x88d1('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x88d1('0x9')](',\x20');logger[_0x88d1('0xa')](config['encrypt']['algorithm'],_0x88d1('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5a5906){return AES_SUPPORTED_RX[_0x88d1('0xc')](_0x5a5906);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x88d1('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5459bc){return getSupportedCiphers()['indexOf'](_0x5459bc)>-0x1;}function combineOptions(_0xb136b5){var _0xe4782a={};for(var _0x50f430 in fileOptions){if(fileOptions[_0x88d1('0xe')](_0x50f430)){_0xe4782a[_0x50f430]=fileOptions[_0x50f430];}}if(_0xb136b5){for(var _0x29425e in _0xb136b5){if(_0xb136b5[_0x88d1('0xe')](_0x29425e)){_0xe4782a[_0x29425e]=_0xb136b5[_0x29425e];}}}return _0xe4782a;}exports[_0x88d1('0xf')]=function(_0x2c6e94,_0x3a836b,_0x4d72fe,_0x11ccab){return new BPromise(function(_0x100dee,_0x54b730){_0x11ccab=combineOptions(_0x11ccab);var _0xdd8647=new Buffer(_0x4d72fe);var _0x5d0ac1=fs[_0x88d1('0x10')](_0x2c6e94);var _0xa5fe5e=fs[_0x88d1('0x11')](_0x3a836b);var _0x19f7c7=crypto[_0x88d1('0x12')](_0x11ccab['algorithm'],_0xdd8647);_0x5d0ac1['on'](_0x88d1('0x13'),function(_0x100002){var _0x22fab2=new Buffer(_0x19f7c7[_0x88d1('0x14')](_0x100002),_0x88d1('0x15'));_0xa5fe5e[_0x88d1('0x16')](_0x22fab2);});_0x5d0ac1['on'](_0x88d1('0x17'),function(){try{var _0x13c055=new Buffer(_0x19f7c7[_0x88d1('0x18')](_0x88d1('0x15')),'binary');_0xa5fe5e[_0x88d1('0x16')](_0x13c055);_0xa5fe5e[_0x88d1('0x17')]();_0xa5fe5e['on'](_0x88d1('0x19'),function(){return _0x100dee(_0x3a836b);});}catch(_0x5d142a){fs[_0x88d1('0x1a')](_0x3a836b);return _0x54b730(_0x5d142a);}});});};exports[_0x88d1('0x1b')]=function(_0xa0acbb,_0x12ac2b,_0x41abf9,_0x13b9cc){return new BPromise(function(_0x489904,_0x1abbff){_0x13b9cc=combineOptions(_0x13b9cc);var _0x3721b5=new Buffer(_0x41abf9);var _0x53abe0=fs[_0x88d1('0x10')](_0xa0acbb);var _0x159675=fs[_0x88d1('0x11')](_0x12ac2b);var _0x31e06e=crypto[_0x88d1('0x1c')](_0x13b9cc[_0x88d1('0x8')],_0x3721b5);_0x53abe0['on']('data',function(_0x396cd3){var _0x2639a4=new Buffer(_0x31e06e[_0x88d1('0x14')](_0x396cd3),_0x88d1('0x15'));_0x159675[_0x88d1('0x16')](_0x2639a4);});_0x53abe0['on'](_0x88d1('0x17'),function(){try{var _0x4a3df9=new Buffer(_0x31e06e['final'](_0x88d1('0x15')),'binary');_0x159675[_0x88d1('0x16')](_0x4a3df9);_0x159675[_0x88d1('0x17')]();_0x159675['on'](_0x88d1('0x19'),function(){return _0x489904(_0x12ac2b);});}catch(_0x22db05){fs[_0x88d1('0x1a')](_0x12ac2b);return _0x1abbff(_0x22db05);}});});};exports['encryptString']=function(_0x505e56,_0x58f535,_0x247259){var _0x1e4ac4=_0x247259||stringOptions[_0x88d1('0x8')];var _0x58ffa1=_0x58f535||stringOptions[_0x88d1('0x1d')];var _0x1502d7=crypto['createCipher'](_0x1e4ac4,_0x58ffa1);var _0x48e529=_0x1502d7['update'](_0x505e56,'utf8',_0x88d1('0x1e'));_0x48e529+=_0x1502d7['final']('base64');return _0x48e529;};exports['decryptString']=function(_0xc8e002,_0x1ee82a,_0x4fb4a8){var _0x2e27f5=_0x4fb4a8||stringOptions[_0x88d1('0x8')];var _0x55b997=_0x1ee82a||stringOptions[_0x88d1('0x1d')];var _0x51f8dd=crypto[_0x88d1('0x1c')](_0x2e27f5,_0x55b997);var _0x2755ba=_0x51f8dd['update'](_0xc8e002,'base64','utf8');_0x2755ba+=_0x51f8dd[_0x88d1('0x18')](_0x88d1('0x1f'));return _0x2755ba;}; \ No newline at end of file +var _0xa6fc=['end','final','close','unlink','createDecipher','data','secret','base64','decryptString','utf8','bluebird','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','write'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xa6fc,0x6d));var _0xca6f=function(_0x20cd42,_0x2c92fc){_0x20cd42=_0x20cd42-0x0;var _0x20013a=_0xa6fc[_0x20cd42];return _0x20013a;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xca6f('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xca6f('0x1'))(_0xca6f('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xca6f('0x3')],'algorithm':_0xca6f('0x4')};const fileOptions={'algorithm':_0xca6f('0x5')};if(config[_0xca6f('0x6')]&&config['encrypt'][_0xca6f('0x7')]){var isSupported=isAlgorithmSupported(config[_0xca6f('0x6')][_0xca6f('0x7')]);if(isSupported){fileOptions[_0xca6f('0x7')]=config[_0xca6f('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xca6f('0x8')](',\x20');logger[_0xca6f('0x9')](config['encrypt']['algorithm'],_0xca6f('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x57a3a5){return AES_SUPPORTED_RX[_0xca6f('0xb')](_0x57a3a5);}function getSupportedCiphers(){return crypto[_0xca6f('0xc')]()[_0xca6f('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x207a2c){return getSupportedCiphers()[_0xca6f('0xe')](_0x207a2c)>-0x1;}function combineOptions(_0x3fd4a4){var _0x1a5d35={};for(var _0x4c4d78 in fileOptions){if(fileOptions[_0xca6f('0xf')](_0x4c4d78)){_0x1a5d35[_0x4c4d78]=fileOptions[_0x4c4d78];}}if(_0x3fd4a4){for(var _0x3655be in _0x3fd4a4){if(_0x3fd4a4['hasOwnProperty'](_0x3655be)){_0x1a5d35[_0x3655be]=_0x3fd4a4[_0x3655be];}}}return _0x1a5d35;}exports[_0xca6f('0x10')]=function(_0x5459c8,_0x489472,_0xb81015,_0x5d1533){return new BPromise(function(_0x403bd9,_0x3fb520){_0x5d1533=combineOptions(_0x5d1533);var _0x99aedd=new Buffer(_0xb81015);var _0x564100=fs[_0xca6f('0x11')](_0x5459c8);var _0x167d29=fs[_0xca6f('0x12')](_0x489472);var _0x3af39b=crypto[_0xca6f('0x13')](_0x5d1533['algorithm'],_0x99aedd);_0x564100['on']('data',function(_0x57327e){var _0x8f7229=new Buffer(_0x3af39b[_0xca6f('0x14')](_0x57327e),_0xca6f('0x15'));_0x167d29[_0xca6f('0x16')](_0x8f7229);});_0x564100['on'](_0xca6f('0x17'),function(){try{var _0x27f8d4=new Buffer(_0x3af39b[_0xca6f('0x18')](_0xca6f('0x15')),_0xca6f('0x15'));_0x167d29[_0xca6f('0x16')](_0x27f8d4);_0x167d29[_0xca6f('0x17')]();_0x167d29['on'](_0xca6f('0x19'),function(){return _0x403bd9(_0x489472);});}catch(_0x569f3e){fs[_0xca6f('0x1a')](_0x489472);return _0x3fb520(_0x569f3e);}});});};exports['decryptFile']=function(_0x4a92dc,_0x37f346,_0x3897e1,_0x49e291){return new BPromise(function(_0x431c8c,_0x4fb119){_0x49e291=combineOptions(_0x49e291);var _0x4425ae=new Buffer(_0x3897e1);var _0x5b02e6=fs['createReadStream'](_0x4a92dc);var _0x55c7e6=fs[_0xca6f('0x12')](_0x37f346);var _0x2e2ee9=crypto[_0xca6f('0x1b')](_0x49e291[_0xca6f('0x7')],_0x4425ae);_0x5b02e6['on'](_0xca6f('0x1c'),function(_0x42e649){var _0x2b5819=new Buffer(_0x2e2ee9[_0xca6f('0x14')](_0x42e649),_0xca6f('0x15'));_0x55c7e6[_0xca6f('0x16')](_0x2b5819);});_0x5b02e6['on']('end',function(){try{var _0x198cbd=new Buffer(_0x2e2ee9[_0xca6f('0x18')](_0xca6f('0x15')),_0xca6f('0x15'));_0x55c7e6[_0xca6f('0x16')](_0x198cbd);_0x55c7e6[_0xca6f('0x17')]();_0x55c7e6['on'](_0xca6f('0x19'),function(){return _0x431c8c(_0x37f346);});}catch(_0x3dd849){fs['unlink'](_0x37f346);return _0x4fb119(_0x3dd849);}});});};exports['encryptString']=function(_0x13ee51,_0x29b079,_0xfb6bd9){var _0x326163=_0xfb6bd9||stringOptions['algorithm'];var _0xeaa11=_0x29b079||stringOptions[_0xca6f('0x1d')];var _0x1f92f1=crypto['createCipher'](_0x326163,_0xeaa11);var _0x4c01e4=_0x1f92f1['update'](_0x13ee51,'utf8','base64');_0x4c01e4+=_0x1f92f1[_0xca6f('0x18')](_0xca6f('0x1e'));return _0x4c01e4;};exports[_0xca6f('0x1f')]=function(_0x396aeb,_0x2bdc6a,_0x295602){var _0x18a35e=_0x295602||stringOptions[_0xca6f('0x7')];var _0x419849=_0x2bdc6a||stringOptions['secret'];var _0x378ee5=crypto[_0xca6f('0x1b')](_0x18a35e,_0x419849);var _0x2f18b1=_0x378ee5[_0xca6f('0x14')](_0x396aeb,_0xca6f('0x1e'),_0xca6f('0x20'));_0x2f18b1+=_0x378ee5[_0xca6f('0x18')](_0xca6f('0x20'));return _0x2f18b1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b27ea04..a4dea86 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 _0x9081=['Failed','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','split','length','range','isInteger','num','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','dirname','basename','.csv','join','mkdirSync','each','push','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9081,0x1d8));var _0x1908=function(_0x450eaa,_0x558c8e){_0x450eaa=_0x450eaa-0x0;var _0x184867=_0x9081[_0x450eaa];return _0x184867;};'use strict';var util=require('util');var path=require(_0x1908('0x0'));var _=require(_0x1908('0x1'));var csv=require(_0x1908('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x1908('0x3'));var rimraf=require(_0x1908('0x4'));var db=require(_0x1908('0x5'))['db'];var dbH=require(_0x1908('0x5'))['dbH'];var logger=require(_0x1908('0x6'))(_0x1908('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1908('0x8')][0x2]);var QUERY=process[_0x1908('0x8')][0x3];var PATH=process[_0x1908('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a96b1,_0x3c147e){var _0x30bb1f={'status':_0x2a96b1};var _0x4aa2cf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c147e){_0x30bb1f['savename']=_0x3c147e;}return db[_0x1908('0x9')][_0x1908('0xa')](_0x30bb1f,_0x4aa2cf);}function main(){var _0x45f1fc=0x1388;var _0x3b5db9;logger[_0x1908('0xb')](util[_0x1908('0xc')](_0x1908('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x1908('0xe')][_0x1908('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x1908('0x10')](function(_0x3b0747){if(_0x3b0747){_0x3b5db9=_0x3b0747;_0x45f1fc=_0x3b5db9['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0x1908('0x11')](util['format'](_0x1908('0x12'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1908('0x13')]});})[_0x1908('0x10')](function(_0xab7f2){if(!_0xab7f2[0x0]['num']){return analyticExtractedReport(_0x1908('0x14'));}var _0x1f277c=[];var _0x35e62e=0x0;if(_0x3b5db9[_0x1908('0x15')]){if(_0xab7f2&&_0xab7f2[_0x1908('0x16')]){var _0x1e3560=_[_0x1908('0x17')](_0xab7f2[0x0]['num']/_0x45f1fc);var _0x5eb79f=Number[_0x1908('0x18')](_0xab7f2[0x0][_0x1908('0x19')]/_0x45f1fc)?_0xab7f2[0x0][_0x1908('0x19')]%_0x45f1fc:0x0;_0x1e3560['forEach'](function(_0x4337ca){if(_0x4337ca>0x0){_0x35e62e+=_0x45f1fc;}_0x1f277c['push'](dbH['sequelize'][_0x1908('0x11')](util[_0x1908('0xc')](_0x1908('0x1a'),QUERY,_0x45f1fc,_0x35e62e),{'type':dbH['sequelize']['QueryTypes'][_0x1908('0x13')]}));});if(_0x5eb79f>0x0){_0x35e62e+=_0x45f1fc;_0x1f277c['push'](dbH[_0x1908('0x1b')][_0x1908('0x11')](util['format'](_0x1908('0x1a'),QUERY,_0x5eb79f,_0x35e62e),{'type':dbH['sequelize'][_0x1908('0x1c')]['SELECT']}));}}}else{_0x1f277c['push'](dbH[_0x1908('0x1b')][_0x1908('0x11')](QUERY,{'type':dbH[_0x1908('0x1b')][_0x1908('0x1c')][_0x1908('0x13')]}));}var _0x152ed5=path[_0x1908('0x1d')](PATH);var _0x1f9109=path[_0x1908('0x1e')](PATH,_0x1908('0x1f'));var _0x34ad63=_0x3b5db9[_0x1908('0x15')]&&_0x1f277c[_0x1908('0x16')]>0x1;var _0xf94a=[];if(!fs['existsSync'](path[_0x1908('0x20')](_0x152ed5,_0x1f9109))&&_0x34ad63){fs[_0x1908('0x21')](path[_0x1908('0x20')](_0x152ed5,_0x1f9109));}return BPromise[_0x1908('0x22')](_0x1f277c,function(_0x245aa8){_0xf94a[_0x1908('0x23')](_0x245aa8);})[_0x1908('0x10')](function(){for(var _0x52d06e=0x0;_0x52d06e<_0xf94a[_0x1908('0x16')];_0x52d06e+=0x1){var _0x452d38;var _0x266ba7=_0xf94a[_0x52d06e];if(_0x34ad63){_0x452d38=path['join'](_0x152ed5,_0x1f9109,util[_0x1908('0xc')](_0x1908('0x24'),_0x1f9109,_0x52d06e,'csv'));}else{_0x452d38=path['join'](_0x152ed5,util[_0x1908('0xc')](_0x1908('0x25'),_0x1f9109,_0x1908('0x26')));}fs[_0x1908('0x27')](_0x452d38,csv(_0x266ba7));}})[_0x1908('0x10')](function(){if(_0x34ad63){return new Promise(function(_0x27cfe6){zipdir(path[_0x1908('0x20')](_0x152ed5,_0x1f9109),{'saveTo':path[_0x1908('0x20')](_0x152ed5,util['format'](_0x1908('0x25'),_0x1f9109,_0x1908('0x28')))},function(_0x14ada1,_0x27ae52){rimraf(path[_0x1908('0x20')](_0x152ed5,_0x1f9109),function(){});_0x27cfe6(_0x1908('0x29'));});});}})[_0x1908('0x10')](function(){logger[_0x1908('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1908('0x2a')));return analyticExtractedReport('Completed',_0x34ad63?util[_0x1908('0xc')](_0x1908('0x25'),_0x1f9109,_0x34ad63?_0x1908('0x28'):_0x1908('0x26')):null);});})[_0x1908('0x2b')](function(_0x316002){logger[_0x1908('0xb')](util['format'](_0x1908('0x2c'),EXTRACTED_REPORT_ID,_0x1908('0x2a')),util['inspect'](_0x316002,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1908('0x2d'));})[_0x1908('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x38b8=['join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','Empty','length','range','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','existsSync'];(function(_0x2197bb,_0x2d7033){var _0x255158=function(_0x45dcbb){while(--_0x45dcbb){_0x2197bb['push'](_0x2197bb['shift']());}};_0x255158(++_0x2d7033);}(_0x38b8,0x160));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x838b('0x0'));var path=require(_0x838b('0x1'));var _=require('lodash');var csv=require(_0x838b('0x2'));var fs=require('fs');var BPromise=require(_0x838b('0x3'));var zipdir=require(_0x838b('0x4'));var rimraf=require('rimraf');var db=require(_0x838b('0x5'))['db'];var dbH=require(_0x838b('0x5'))[_0x838b('0x6')];var logger=require(_0x838b('0x7'))(_0x838b('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x838b('0x9')][0x3];var PATH=process[_0x838b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f9b01,_0x7c2c1f){var _0xf48133={'status':_0x3f9b01};var _0x333b93={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7c2c1f){_0xf48133['savename']=_0x7c2c1f;}return db[_0x838b('0xa')][_0x838b('0xb')](_0xf48133,_0x333b93);}function main(){var _0x3d6b1a=0x1388;var _0x3bc177;logger[_0x838b('0xc')](util['format'](_0x838b('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x838b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x838b('0xf'),_0x838b('0x10')]})[_0x838b('0x11')](function(_0x526e30){if(_0x526e30){_0x3bc177=_0x526e30;_0x3d6b1a=_0x3bc177['splitSizeCsv']||0x1388;}})[_0x838b('0x11')](function(){return dbH['sequelize'][_0x838b('0x12')](util[_0x838b('0x13')](_0x838b('0x14'),QUERY),{'type':dbH[_0x838b('0x15')][_0x838b('0x16')]['SELECT']});})['then'](function(_0x39f4c3){if(!_0x39f4c3[0x0]['num']){return analyticExtractedReport(_0x838b('0x17'));}var _0x9a5900=[];var _0x365fb6=0x0;if(_0x3bc177[_0x838b('0xf')]){if(_0x39f4c3&&_0x39f4c3[_0x838b('0x18')]){var _0x5bf975=_[_0x838b('0x19')](_0x39f4c3[0x0][_0x838b('0x1a')]/_0x3d6b1a);var _0x3bd24a=Number['isInteger'](_0x39f4c3[0x0][_0x838b('0x1a')]/_0x3d6b1a)?_0x39f4c3[0x0][_0x838b('0x1a')]%_0x3d6b1a:0x0;_0x5bf975[_0x838b('0x1b')](function(_0x55e3ea){if(_0x55e3ea>0x0){_0x365fb6+=_0x3d6b1a;}_0x9a5900['push'](dbH[_0x838b('0x15')][_0x838b('0x12')](util['format'](_0x838b('0x1c'),QUERY,_0x3d6b1a,_0x365fb6),{'type':dbH['sequelize'][_0x838b('0x16')]['SELECT']}));});if(_0x3bd24a>0x0){_0x365fb6+=_0x3d6b1a;_0x9a5900[_0x838b('0x1d')](dbH[_0x838b('0x15')][_0x838b('0x12')](util['format'](_0x838b('0x1c'),QUERY,_0x3bd24a,_0x365fb6),{'type':dbH[_0x838b('0x15')][_0x838b('0x16')]['SELECT']}));}}}else{_0x9a5900['push'](dbH[_0x838b('0x15')]['query'](QUERY,{'type':dbH[_0x838b('0x15')][_0x838b('0x16')]['SELECT']}));}var _0x45ba0c=path['dirname'](PATH);var _0x120f0c=path[_0x838b('0x1e')](PATH,'.csv');var _0x374fb3=_0x3bc177[_0x838b('0xf')]&&_0x9a5900[_0x838b('0x18')]>0x1;var _0x43e3de=[];if(!fs[_0x838b('0x1f')](path[_0x838b('0x20')](_0x45ba0c,_0x120f0c))&&_0x374fb3){fs[_0x838b('0x21')](path['join'](_0x45ba0c,_0x120f0c));}return BPromise[_0x838b('0x22')](_0x9a5900,function(_0x35e369){_0x43e3de[_0x838b('0x1d')](_0x35e369);})[_0x838b('0x11')](function(){for(var _0x454d8a=0x0;_0x454d8a<_0x43e3de[_0x838b('0x18')];_0x454d8a+=0x1){var _0x3d2249;var _0x38c672=_0x43e3de[_0x454d8a];if(_0x374fb3){_0x3d2249=path[_0x838b('0x20')](_0x45ba0c,_0x120f0c,util[_0x838b('0x13')](_0x838b('0x23'),_0x120f0c,_0x454d8a,'csv'));}else{_0x3d2249=path[_0x838b('0x20')](_0x45ba0c,util[_0x838b('0x13')](_0x838b('0x24'),_0x120f0c,_0x838b('0x25')));}fs[_0x838b('0x26')](_0x3d2249,csv(_0x38c672));}})[_0x838b('0x11')](function(){if(_0x374fb3){return new Promise(function(_0xc2d342){zipdir(path[_0x838b('0x20')](_0x45ba0c,_0x120f0c),{'saveTo':path[_0x838b('0x20')](_0x45ba0c,util[_0x838b('0x13')](_0x838b('0x24'),_0x120f0c,_0x838b('0x27')))},function(_0x2c05b1,_0x40ca0a){rimraf(path[_0x838b('0x20')](_0x45ba0c,_0x120f0c),function(){});_0xc2d342('zip\x20finished');});});}})[_0x838b('0x11')](function(){logger[_0x838b('0xc')](util[_0x838b('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x838b('0x28')));return analyticExtractedReport(_0x838b('0x29'),_0x374fb3?util[_0x838b('0x13')]('%s.%s',_0x120f0c,_0x374fb3?_0x838b('0x27'):'csv'):null);});})[_0x838b('0x2a')](function(_0x3ddfc9){logger[_0x838b('0xc')](util['format'](_0x838b('0x2b'),EXTRACTED_REPORT_ID,_0x838b('0x28')),util[_0x838b('0x2c')](_0x3ddfc9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x838b('0x2d'));})[_0x838b('0x2e')](function(){process[_0x838b('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ab63c28..1ad6e10 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 _0x3dbb=['footer','right','num','Empty','Setting','find','then','splitSizePdf','split','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','join','mkdirSync','each','flatten','%s%d.%s','all','zip','zip\x20finished','info','PDF','Completed','%s.%s','pdf','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','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','body','push','concat','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','landscape'];(function(_0x82cd19,_0x4e65e6){var _0x47c15a=function(_0x42543d){while(--_0x42543d){_0x82cd19['push'](_0x82cd19['shift']());}};_0x47c15a(++_0x4e65e6);}(_0x3dbb,0x1bc));var _0xb3db=function(_0x1e3923,_0x477ce9){_0x1e3923=_0x1e3923-0x0;var _0x36cd0f=_0x3dbb[_0x1e3923];return _0x36cd0f;};'use strict';var _=require(_0xb3db('0x0'));var fs=require('fs');var util=require(_0xb3db('0x1'));var path=require(_0xb3db('0x2'));var moment=require(_0xb3db('0x3'));var htmlToPdfmake=require(_0xb3db('0x4'));var PdfPrinter=require(_0xb3db('0x5'));var zipdir=require(_0xb3db('0x6'));var rimraf=require(_0xb3db('0x7'));var JSDOM=require(_0xb3db('0x8'))[_0xb3db('0x9')];var window=new JSDOM('')[_0xb3db('0xa')];var BPromise=require(_0xb3db('0xb'));var db=require(_0xb3db('0xc'))['db'];var dbH=require(_0xb3db('0xc'))[_0xb3db('0xd')];var logger=require(_0xb3db('0xe'))(_0xb3db('0xf'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb3db('0x10')][0x3];var PATH=process[_0xb3db('0x10')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xb3db('0x11');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x432f58,_0x50ad74){var _0x25d209={'status':_0x432f58};var _0x33fcd8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50ad74){_0x25d209[_0xb3db('0x12')]=_0x50ad74;}return db[_0xb3db('0x13')][_0xb3db('0x14')](_0x25d209,_0x33fcd8);}function getHeaders(_0x175709){return _[_0xb3db('0x15')](_0x175709,function(_0x3aebb2){return{'text':_0x3aebb2,'style':_0xb3db('0x16')};});}function getRows(_0x100bec,_0x41498e){return _[_0xb3db('0x15')](_0x41498e,function(_0x94f2f3){return _(_0x94f2f3)[_0xb3db('0x17')](_0x100bec)[_0xb3db('0x15')](function(_0x1bc0aa){return _0x1bc0aa?_[_0xb3db('0x18')](_0x1bc0aa):'';})[_0xb3db('0x19')]();});}function createTable(_0x2bff3f,_0x33b8bc){var _0x5ada1d={'widths':_['fill'](Array(_0x2bff3f[_0xb3db('0x1a')]),0x91),'heights':function(_0x191fb7){return _0x191fb7===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x46147f=getHeaders(_0x2bff3f);_0x5ada1d[_0xb3db('0x1b')][_0xb3db('0x1c')](_0x46147f);var _0x9deff9=getRows(_0x2bff3f,_0x33b8bc);_0x5ada1d[_0xb3db('0x1b')]=_0x5ada1d[_0xb3db('0x1b')][_0xb3db('0x1d')](_0x9deff9);return _0x5ada1d;}function createTables(_0x3274dd){var _0x55f060=[];var _0x341485=_[_0xb3db('0x1e')](Object['keys'](_0x3274dd[0x0]),0x5);_0x341485['forEach'](function(_0x5b7163){_0x55f060[_0xb3db('0x1c')](createTable(_0x5b7163,_0x3274dd));});return _0x55f060;}function getPDFDocDefinition(_0x350722){var _0xc4151a=util['format'](_0xb3db('0x1f'),NAME,EXTRACTED_REPORT[_0xb3db('0x20')],moment(EXTRACTED_REPORT[_0xb3db('0x21')])[_0xb3db('0x22')](FORMAT),moment(EXTRACTED_REPORT[_0xb3db('0x23')])['format'](FORMAT));var _0x588ec1=[];for(var _0x2f4724=0x0;_0x2f4724<_0x350722[_0xb3db('0x1a')];_0x2f4724++){var _0x269e6b=[];if(_0x2f4724===0x0){_0x269e6b['push']({'text':_0xc4151a,'style':_0xb3db('0x24')});}var _0x16c45c={'table':_0x350722[_0x2f4724]};if(_0x2f4724>0x0){_0x16c45c[_0xb3db('0x25')]=_0xb3db('0x26');_0x16c45c[_0xb3db('0x27')]=[0x0,0x46,0x0,0x0];}_0x269e6b['push'](_0x16c45c);_0x588ec1[_0xb3db('0x1c')](_0x269e6b);}return{'pageSize':'A4','pageOrientation':_0xb3db('0x28'),'content':_0x588ec1,'footer':function(_0x5ee4db,_0x52f283){return{'text':_0x5ee4db[_0xb3db('0x18')]()+'\x20/\x20'+_0x52f283,'style':_0xb3db('0x29')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xb3db('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x40af86){var _0x91f5d7=0x1388;var _0x27c68e;if(!_0x40af86[0x0][_0xb3db('0x2b')]){return analyticExtractedReport(_0xb3db('0x2c'));}return db[_0xb3db('0x2d')][_0xb3db('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0xb3db('0x2f')](function(_0x539020){if(_0x539020){_0x27c68e=_0x539020;_0x91f5d7=_0x27c68e[_0xb3db('0x30')]||0x3e8;}})[_0xb3db('0x2f')](function(){var _0x2a0999=[];var _0x35eb4b=0x0;if(_0x27c68e[_0xb3db('0x31')]){if(_0x40af86&&_0x40af86['length']){var _0x346883=_[_0xb3db('0x32')](_0x40af86[0x0]['num']/_0x91f5d7);var _0xdf5f1c=Number[_0xb3db('0x33')](_0x40af86[0x0]['num']/_0x91f5d7)?_0x40af86[0x0]['num']%_0x91f5d7:0x0;_0x346883['forEach'](function(_0x44e2a7){if(_0x44e2a7>0x0){_0x35eb4b+=_0x91f5d7;}_0x2a0999[_0xb3db('0x1c')](dbH[_0xb3db('0x34')]['query'](util['format'](_0xb3db('0x35'),QUERY,_0x91f5d7,_0x35eb4b),{'type':dbH[_0xb3db('0x34')][_0xb3db('0x36')][_0xb3db('0x37')]}));});if(_0xdf5f1c>0x0){_0x35eb4b+=_0x91f5d7;_0x2a0999[_0xb3db('0x1c')](dbH[_0xb3db('0x34')]['query'](util[_0xb3db('0x22')](_0xb3db('0x35'),QUERY,_0xdf5f1c,_0x35eb4b),{'type':dbH[_0xb3db('0x34')][_0xb3db('0x36')][_0xb3db('0x37')]}));}}}else{_0x2a0999['push'](dbH['sequelize'][_0xb3db('0x38')](QUERY,{'type':dbH[_0xb3db('0x34')][_0xb3db('0x36')]['SELECT']}));}var _0x22cf9f=path[_0xb3db('0x39')](PATH);var _0x59d7b5=path[_0xb3db('0x3a')](PATH,_0xb3db('0x3b'));var _0x43b9c5=_0x27c68e[_0xb3db('0x31')]&&_0x2a0999[_0xb3db('0x1a')]>0x1;var _0x5d71ad=[];if(!fs['existsSync'](path[_0xb3db('0x3c')](_0x22cf9f,_0x59d7b5))&&_0x43b9c5){fs[_0xb3db('0x3d')](path['join'](_0x22cf9f,_0x59d7b5));}return BPromise[_0xb3db('0x3e')](_0x2a0999,function(_0x4458da){_0x5d71ad[_0xb3db('0x1c')](_0x4458da);})[_0xb3db('0x2f')](function(){var _0x8d6254=[];for(var _0x498ebd=0x0;_0x498ebd<_0x5d71ad[_0xb3db('0x1a')];_0x498ebd+=0x1){var _0x56f73c=_0x5d71ad[_0x498ebd];var _0x10a8d3=createTables(_[_0xb3db('0x3f')](_0x56f73c));var _0x4ec2a1;var _0x3158d8=getPDFDocDefinition(_0x10a8d3);var _0x135006=getPDFPrinter();var _0x367819=_0x135006['createPdfKitDocument'](_0x3158d8);if(_0x43b9c5){_0x4ec2a1=path['join'](_0x22cf9f,_0x59d7b5,util['format'](_0xb3db('0x40'),_0x59d7b5,_0x498ebd,'pdf'));}else{_0x4ec2a1=path[_0xb3db('0x3c')](_0x22cf9f,util[_0xb3db('0x22')]('%s.%s',_0x59d7b5,'pdf'));}_0x8d6254['push'](writePDFDocument(_0x367819,_0x4ec2a1));}return Promise[_0xb3db('0x41')](_0x8d6254);})[_0xb3db('0x2f')](function(){if(_0x43b9c5){return new Promise(function(_0x3f9e44){zipdir(path['join'](_0x22cf9f,_0x59d7b5),{'saveTo':path[_0xb3db('0x3c')](_0x22cf9f,util[_0xb3db('0x22')]('%s.%s',_0x59d7b5,_0xb3db('0x42')))},function(){rimraf(path['join'](_0x22cf9f,_0x59d7b5),function(){});_0x3f9e44(_0xb3db('0x43'));});});}})['then'](function(){if(!_0x43b9c5)return;rimraf(path[_0xb3db('0x3c')](_0x22cf9f,_0x59d7b5),function(){});})[_0xb3db('0x2f')](function(){logger[_0xb3db('0x44')](util[_0xb3db('0x22')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb3db('0x45')));return analyticExtractedReport(_0xb3db('0x46'),_0x43b9c5?util[_0xb3db('0x22')](_0xb3db('0x47'),_0x59d7b5,_0x43b9c5?_0xb3db('0x42'):_0xb3db('0x48')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb3db('0x44')](util[_0xb3db('0x22')](_0xb3db('0x49'),EXTRACTED_REPORT_ID,_0xb3db('0x45')));return db[_0xb3db('0x13')][_0xb3db('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb3db('0x2f')](function(_0x3b4017){EXTRACTED_REPORT=_0x3b4017;return dbH[_0xb3db('0x34')][_0xb3db('0x38')](util[_0xb3db('0x22')](_0xb3db('0x4b'),QUERY),{'type':dbH[_0xb3db('0x34')][_0xb3db('0x36')]['SELECT']});})[_0xb3db('0x2f')](extractReport)[_0xb3db('0x4c')](function(_0x44004e){logger[_0xb3db('0x44')](util[_0xb3db('0x22')](_0xb3db('0x4d'),EXTRACTED_REPORT_ID,_0xb3db('0x45')),util[_0xb3db('0x4e')](_0x44004e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb3db('0x4f'));})[_0xb3db('0x50')](function(){process[_0xb3db('0x51')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5984a8=new PdfPrinter({'Arial':{'normal':__dirname+_0xb3db('0x52'),'bold':__dirname+_0xb3db('0x53'),'italics':__dirname+_0xb3db('0x54'),'bolditalics':__dirname+_0xb3db('0x55')}});return _0x5984a8;}function getPDFDocDefinitionFromHTML(_0x55069e,_0x23c46b){var _0x1f5442=util[_0xb3db('0x22')](_0xb3db('0x56'),_0x23c46b[_0xb3db('0x57')],_0x23c46b[_0xb3db('0x58')]);var _0x3f7c5a=moment()[_0xb3db('0x22')](_0xb3db('0x59'))[_0xb3db('0x18')]();var _0x4cd22b=htmlToPdfmake(_0x55069e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4cd22b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb3db('0x5a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xb3db('0x5b'),'style':_0xb3db('0x24')}];},'footer':function(_0x393235,_0x20c01b){return[{'text':util[_0xb3db('0x22')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1f5442,_0x393235,_0x20c01b,_0x3f7c5a),'style':'footer'}];}};}function writePDFDocument(_0x240f53,_0x32643d){return new Promise(function(_0x5c8ddb,_0x5ad142){var _0x7c7dbb=_0x240f53['pipe'](fs[_0xb3db('0x5c')](_0x32643d));_0x7c7dbb['on']('finish',function(){_0x5c8ddb(_0xb3db('0x5d'));});_0x7c7dbb['on'](_0xb3db('0x5e'),function(_0x24cd3a){_0x5ad142(_0x24cd3a);});_0x240f53[_0xb3db('0x5f')]();});}exports[_0xb3db('0x60')]=function(_0x3aa3f4,_0x506934){var _0x23417d=getPDFPrinter();var _0x4e0a85=getPDFDocDefinitionFromHTML(_0x3aa3f4,_0x506934);var _0x213b64=_0x23417d['createPdfKitDocument'](_0x4e0a85);return writePDFDocument(_0x213b64,_0x506934[_0xb3db('0x2')])[_0xb3db('0x4c')](function(_0x5df263){throw _0x5df263;});}; \ No newline at end of file +var _0xf5ee=['header','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','then','splitSizePdf','sequelize','QueryTypes','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate'];(function(_0x2cac2e,_0x1fcffc){var _0x5cdf17=function(_0xa0dffe){while(--_0xa0dffe){_0x2cac2e['push'](_0x2cac2e['shift']());}};_0x5cdf17(++_0x1fcffc);}(_0xf5ee,0x156));var _0xef5e=function(_0x5917af,_0x5b14b){_0x5917af=_0x5917af-0x0;var _0x263b6d=_0xf5ee[_0x5917af];return _0x263b6d;};'use strict';var _=require(_0xef5e('0x0'));var fs=require('fs');var util=require(_0xef5e('0x1'));var path=require(_0xef5e('0x2'));var moment=require(_0xef5e('0x3'));var htmlToPdfmake=require(_0xef5e('0x4'));var PdfPrinter=require(_0xef5e('0x5'));var zipdir=require(_0xef5e('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0xef5e('0x7'))[_0xef5e('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0xef5e('0x9'));var db=require(_0xef5e('0xa'))['db'];var dbH=require(_0xef5e('0xa'))[_0xef5e('0xb')];var logger=require('../../config/logger')(_0xef5e('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xef5e('0xd')][0x2]);var QUERY=process[_0xef5e('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xef5e('0xd')][0x5];var FORMAT=_0xef5e('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x44ea22,_0x2e93d4){var _0x3acef3={'status':_0x44ea22};var _0x5cf6ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e93d4){_0x3acef3[_0xef5e('0xf')]=_0x2e93d4;}return db[_0xef5e('0x10')][_0xef5e('0x11')](_0x3acef3,_0x5cf6ae);}function getHeaders(_0x2bf03c){return _[_0xef5e('0x12')](_0x2bf03c,function(_0x3acf52){return{'text':_0x3acf52,'style':_0xef5e('0x13')};});}function getRows(_0x1bb9c0,_0x49a911){return _[_0xef5e('0x12')](_0x49a911,function(_0x416378){return _(_0x416378)['pick'](_0x1bb9c0)[_0xef5e('0x12')](function(_0x64ef12){return _0x64ef12?_['toString'](_0x64ef12):'';})[_0xef5e('0x14')]();});}function createTable(_0x2fe72a,_0xf6b760){var _0x256040={'widths':_[_0xef5e('0x15')](Array(_0x2fe72a[_0xef5e('0x16')]),0x91),'heights':function(_0x1722e5){return _0x1722e5===0x0?_0xef5e('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xe0bb42=getHeaders(_0x2fe72a);_0x256040[_0xef5e('0x18')][_0xef5e('0x19')](_0xe0bb42);var _0x16ae86=getRows(_0x2fe72a,_0xf6b760);_0x256040[_0xef5e('0x18')]=_0x256040[_0xef5e('0x18')][_0xef5e('0x1a')](_0x16ae86);return _0x256040;}function createTables(_0x496958){var _0x4b9e84=[];var _0x2261a4=_[_0xef5e('0x1b')](Object[_0xef5e('0x1c')](_0x496958[0x0]),0x5);_0x2261a4[_0xef5e('0x1d')](function(_0x117a96){_0x4b9e84[_0xef5e('0x19')](createTable(_0x117a96,_0x496958));});return _0x4b9e84;}function getPDFDocDefinition(_0x3dd3fa){var _0x36f7f0=util[_0xef5e('0x1e')](_0xef5e('0x1f'),NAME,EXTRACTED_REPORT[_0xef5e('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xef5e('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xef5e('0x21')])[_0xef5e('0x1e')](FORMAT));var _0x2d12a7=[];for(var _0x44a5db=0x0;_0x44a5db<_0x3dd3fa[_0xef5e('0x16')];_0x44a5db++){var _0x23adcb=[];if(_0x44a5db===0x0){_0x23adcb[_0xef5e('0x19')]({'text':_0x36f7f0,'style':_0xef5e('0x22')});}var _0x2e0030={'table':_0x3dd3fa[_0x44a5db]};if(_0x44a5db>0x0){_0x2e0030[_0xef5e('0x23')]=_0xef5e('0x24');_0x2e0030[_0xef5e('0x25')]=[0x0,0x46,0x0,0x0];}_0x23adcb['push'](_0x2e0030);_0x2d12a7[_0xef5e('0x19')](_0x23adcb);}return{'pageSize':'A4','pageOrientation':_0xef5e('0x26'),'content':_0x2d12a7,'footer':function(_0x16355a,_0x5a63e0){return{'text':_0x16355a[_0xef5e('0x27')]()+_0xef5e('0x28')+_0x5a63e0,'style':_0xef5e('0x29')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xef5e('0x2a')},'footer':{'alignment':_0xef5e('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x39ee1e){var _0x5606a3=0x1388;var _0x426600;if(!_0x39ee1e[0x0][_0xef5e('0x2c')]){return analyticExtractedReport(_0xef5e('0x2d'));}return db[_0xef5e('0x2e')][_0xef5e('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xef5e('0x30'),'splitSizePdf']})[_0xef5e('0x31')](function(_0x3da4b3){if(_0x3da4b3){_0x426600=_0x3da4b3;_0x5606a3=_0x426600[_0xef5e('0x32')]||0x3e8;}})[_0xef5e('0x31')](function(){var _0x375754=[];var _0x2aa1d2=0x0;if(_0x426600['split']){if(_0x39ee1e&&_0x39ee1e[_0xef5e('0x16')]){var _0xe3a555=_['range'](_0x39ee1e[0x0]['num']/_0x5606a3);var _0x2a25da=Number['isInteger'](_0x39ee1e[0x0][_0xef5e('0x2c')]/_0x5606a3)?_0x39ee1e[0x0][_0xef5e('0x2c')]%_0x5606a3:0x0;_0xe3a555['forEach'](function(_0x1b3965){if(_0x1b3965>0x0){_0x2aa1d2+=_0x5606a3;}_0x375754[_0xef5e('0x19')](dbH[_0xef5e('0x33')]['query'](util[_0xef5e('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5606a3,_0x2aa1d2),{'type':dbH[_0xef5e('0x33')][_0xef5e('0x34')][_0xef5e('0x35')]}));});if(_0x2a25da>0x0){_0x2aa1d2+=_0x5606a3;_0x375754[_0xef5e('0x19')](dbH[_0xef5e('0x33')][_0xef5e('0x36')](util[_0xef5e('0x1e')](_0xef5e('0x37'),QUERY,_0x2a25da,_0x2aa1d2),{'type':dbH[_0xef5e('0x33')]['QueryTypes'][_0xef5e('0x35')]}));}}}else{_0x375754['push'](dbH['sequelize'][_0xef5e('0x36')](QUERY,{'type':dbH[_0xef5e('0x33')][_0xef5e('0x34')][_0xef5e('0x35')]}));}var _0x1d88c5=path[_0xef5e('0x38')](PATH);var _0x4f03c0=path[_0xef5e('0x39')](PATH,_0xef5e('0x3a'));var _0x2372a3=_0x426600[_0xef5e('0x30')]&&_0x375754[_0xef5e('0x16')]>0x1;var _0x3890fc=[];if(!fs[_0xef5e('0x3b')](path[_0xef5e('0x3c')](_0x1d88c5,_0x4f03c0))&&_0x2372a3){fs['mkdirSync'](path['join'](_0x1d88c5,_0x4f03c0));}return BPromise['each'](_0x375754,function(_0x529af7){_0x3890fc[_0xef5e('0x19')](_0x529af7);})['then'](function(){var _0xaf569e=[];for(var _0x3f163a=0x0;_0x3f163a<_0x3890fc[_0xef5e('0x16')];_0x3f163a+=0x1){var _0x379d5a=_0x3890fc[_0x3f163a];var _0x2d84c5=createTables(_[_0xef5e('0x3d')](_0x379d5a));var _0x158d56;var _0xf0a191=getPDFDocDefinition(_0x2d84c5);var _0x414955=getPDFPrinter();var _0x26d5f4=_0x414955[_0xef5e('0x3e')](_0xf0a191);if(_0x2372a3){_0x158d56=path[_0xef5e('0x3c')](_0x1d88c5,_0x4f03c0,util['format'](_0xef5e('0x3f'),_0x4f03c0,_0x3f163a,_0xef5e('0x40')));}else{_0x158d56=path[_0xef5e('0x3c')](_0x1d88c5,util[_0xef5e('0x1e')](_0xef5e('0x41'),_0x4f03c0,'pdf'));}_0xaf569e[_0xef5e('0x19')](writePDFDocument(_0x26d5f4,_0x158d56));}return Promise[_0xef5e('0x42')](_0xaf569e);})['then'](function(){if(_0x2372a3){return new Promise(function(_0x52b7e0){zipdir(path[_0xef5e('0x3c')](_0x1d88c5,_0x4f03c0),{'saveTo':path['join'](_0x1d88c5,util[_0xef5e('0x1e')](_0xef5e('0x41'),_0x4f03c0,_0xef5e('0x43')))},function(){rimraf(path[_0xef5e('0x3c')](_0x1d88c5,_0x4f03c0),function(){});_0x52b7e0(_0xef5e('0x44'));});});}})[_0xef5e('0x31')](function(){if(!_0x2372a3)return;rimraf(path[_0xef5e('0x3c')](_0x1d88c5,_0x4f03c0),function(){});})['then'](function(){logger['info'](util['format'](_0xef5e('0x45'),EXTRACTED_REPORT_ID,_0xef5e('0x46')));return analyticExtractedReport(_0xef5e('0x47'),_0x2372a3?util[_0xef5e('0x1e')]('%s.%s',_0x4f03c0,_0x2372a3?_0xef5e('0x43'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xef5e('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0xef5e('0x10')][_0xef5e('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xef5e('0x31')](function(_0x17efe1){EXTRACTED_REPORT=_0x17efe1;return dbH['sequelize'][_0xef5e('0x36')](util[_0xef5e('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xef5e('0x33')]['QueryTypes']['SELECT']});})[_0xef5e('0x31')](extractReport)['catch'](function(_0x329406){logger[_0xef5e('0x49')](util[_0xef5e('0x1e')](_0xef5e('0x4a'),EXTRACTED_REPORT_ID,_0xef5e('0x46')),util['inspect'](_0x329406,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xef5e('0x4b')](function(){process[_0xef5e('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x82488=new PdfPrinter({'Arial':{'normal':__dirname+_0xef5e('0x4d'),'bold':__dirname+_0xef5e('0x4e'),'italics':__dirname+_0xef5e('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x82488;}function getPDFDocDefinitionFromHTML(_0x5c7282,_0xf44314){var _0xa544c6=util[_0xef5e('0x1e')](_0xef5e('0x50'),_0xf44314[_0xef5e('0x51')],_0xf44314[_0xef5e('0x52')]);var _0x57d5c0=moment()['format'](_0xef5e('0x53'))['toString']();var _0x3b6667=htmlToPdfmake(_0x5c7282,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3b6667],'defaultStyle':{'font':_0xef5e('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xef5e('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xef5e('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xef5e('0x55')}},'header':function(){return[{'text':_0xef5e('0x56'),'style':_0xef5e('0x22')}];},'footer':function(_0xf5afc2,_0x45b089){return[{'text':util[_0xef5e('0x1e')](_0xef5e('0x57'),_0xa544c6,_0xf5afc2,_0x45b089,_0x57d5c0),'style':'footer'}];}};}function writePDFDocument(_0x388d5e,_0x396f15){return new Promise(function(_0x4432f0,_0x89150d){var _0x1ee682=_0x388d5e[_0xef5e('0x58')](fs[_0xef5e('0x59')](_0x396f15));_0x1ee682['on'](_0xef5e('0x5a'),function(){_0x4432f0(_0xef5e('0x5a'));});_0x1ee682['on']('error',function(_0x34b20d){_0x89150d(_0x34b20d);});_0x388d5e[_0xef5e('0x5b')]();});}exports[_0xef5e('0x5c')]=function(_0x993227,_0x1f096b){var _0x181765=getPDFPrinter();var _0xe2a736=getPDFDocDefinitionFromHTML(_0x993227,_0x1f096b);var _0x1eaf29=_0x181765[_0xef5e('0x3e')](_0xe2a736);return writePDFDocument(_0x1eaf29,_0x1f096b[_0xef5e('0x2')])[_0xef5e('0x5d')](function(_0x18e7ad){throw _0x18e7ad;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index af42a93..b4463d3 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 _0xb2a9=['analytics','argv','savename','update','info','format','Setting','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','XLSX','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x440500,_0x1465b0){var _0x3411b5=function(_0x59c46d){while(--_0x59c46d){_0x440500['push'](_0x440500['shift']());}};_0x3411b5(++_0x1465b0);}(_0xb2a9,0x84));var _0x9b2a=function(_0x206f23,_0x3c2754){_0x206f23=_0x206f23-0x0;var _0xa3979a=_0xb2a9[_0x206f23];return _0xa3979a;};'use strict';var util=require(_0x9b2a('0x0'));var path=require(_0x9b2a('0x1'));var _=require(_0x9b2a('0x2'));var fs=require('fs');var json2xls=require(_0x9b2a('0x3'));var BPromise=require(_0x9b2a('0x4'));var zipdir=require(_0x9b2a('0x5'));var rimraf=require(_0x9b2a('0x6'));var db=require(_0x9b2a('0x7'))['db'];var dbH=require('../../mysqldb')[_0x9b2a('0x8')];var logger=require('../../config/logger')(_0x9b2a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x9b2a('0xa')][0x2]);var QUERY=process[_0x9b2a('0xa')][0x3];var PATH=process[_0x9b2a('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1946ce,_0x45714d){var _0x37ed7c={'status':_0x1946ce};var _0x5a5c6c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x45714d){_0x37ed7c[_0x9b2a('0xb')]=_0x45714d;}return db['AnalyticExtractedReport'][_0x9b2a('0xc')](_0x37ed7c,_0x5a5c6c);}function main(){var _0x50be3a=0x1388;var _0xf857d7;logger[_0x9b2a('0xd')](util[_0x9b2a('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x9b2a('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b2a('0x10'),_0x9b2a('0x11')]})[_0x9b2a('0x12')](function(_0x1b7d6a){if(_0x1b7d6a){_0xf857d7=_0x1b7d6a;_0x50be3a=_0xf857d7[_0x9b2a('0x11')]||0x1388;}})[_0x9b2a('0x12')](function(){return dbH['sequelize'][_0x9b2a('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9b2a('0x14')][_0x9b2a('0x15')][_0x9b2a('0x16')]});})['then'](function(_0x638cde){if(!_0x638cde[0x0][_0x9b2a('0x17')]){return analyticExtractedReport(_0x9b2a('0x18'));}var _0x160ade=[];var _0x7d8864=0x0;if(_0xf857d7[_0x9b2a('0x10')]){if(_0x638cde&&_0x638cde['length']){var _0x462095=_[_0x9b2a('0x19')](_0x638cde[0x0][_0x9b2a('0x17')]/_0x50be3a);var _0x3aa857=Number['isInteger'](_0x638cde[0x0][_0x9b2a('0x17')]/_0x50be3a)?_0x638cde[0x0][_0x9b2a('0x17')]%_0x50be3a:0x0;_0x462095[_0x9b2a('0x1a')](function(_0x2c4609){if(_0x2c4609>0x0){_0x7d8864+=_0x50be3a;}_0x160ade[_0x9b2a('0x1b')](dbH[_0x9b2a('0x14')][_0x9b2a('0x13')](util[_0x9b2a('0xe')](_0x9b2a('0x1c'),QUERY,_0x50be3a,_0x7d8864),{'type':dbH[_0x9b2a('0x14')]['QueryTypes']['SELECT']}));});if(_0x3aa857>0x0){_0x7d8864+=_0x50be3a;_0x160ade[_0x9b2a('0x1b')](dbH['sequelize']['query'](util['format'](_0x9b2a('0x1c'),QUERY,_0x3aa857,_0x7d8864),{'type':dbH['sequelize'][_0x9b2a('0x15')][_0x9b2a('0x16')]}));}}}else{_0x160ade[_0x9b2a('0x1b')](dbH['sequelize'][_0x9b2a('0x13')](QUERY,{'type':dbH[_0x9b2a('0x14')][_0x9b2a('0x15')][_0x9b2a('0x16')]}));}var _0x3c4b8a=path['dirname'](PATH);var _0x1f82b4=path[_0x9b2a('0x1d')](PATH,'.xlsx');var _0x56785c=_0xf857d7[_0x9b2a('0x10')]&&_0x160ade[_0x9b2a('0x1e')]>0x1;var _0xb07d0e=[];if(!fs[_0x9b2a('0x1f')](path[_0x9b2a('0x20')](_0x3c4b8a,_0x1f82b4))&&_0x56785c){fs[_0x9b2a('0x21')](path[_0x9b2a('0x20')](_0x3c4b8a,_0x1f82b4));}return BPromise[_0x9b2a('0x22')](_0x160ade,function(_0x2ae51d){_0xb07d0e[_0x9b2a('0x1b')](_0x2ae51d);})[_0x9b2a('0x12')](function(){for(var _0x267b41=0x0;_0x267b41<_0xb07d0e[_0x9b2a('0x1e')];_0x267b41+=0x1){var _0x12aae7;var _0x3d4c52=_0xb07d0e[_0x267b41];if(_0x56785c){_0x12aae7=path['join'](_0x3c4b8a,_0x1f82b4,util['format'](_0x9b2a('0x23'),_0x1f82b4,_0x267b41,_0x9b2a('0x24')));}else{_0x12aae7=path['join'](_0x3c4b8a,util['format']('%s.%s',_0x1f82b4,'xlsx'));}fs[_0x9b2a('0x25')](_0x12aae7,json2xls(_0x3d4c52),'binary');}})['then'](function(){if(_0x56785c){return new Promise(function(_0x3182e4){zipdir(path[_0x9b2a('0x20')](_0x3c4b8a,_0x1f82b4),{'saveTo':path['join'](_0x3c4b8a,util[_0x9b2a('0xe')]('%s.%s',_0x1f82b4,_0x9b2a('0x26')))},function(_0x59b0cb,_0x55c819){rimraf(path[_0x9b2a('0x20')](_0x3c4b8a,_0x1f82b4),function(){});_0x3182e4(_0x9b2a('0x27'));});});}})[_0x9b2a('0x12')](function(){logger[_0x9b2a('0xd')](util[_0x9b2a('0xe')](_0x9b2a('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x9b2a('0x29'),_0x56785c?util[_0x9b2a('0xe')](_0x9b2a('0x2a'),_0x1f82b4,_0x56785c?_0x9b2a('0x26'):_0x9b2a('0x24')):null);});})[_0x9b2a('0x2b')](function(_0x2aaed3){logger[_0x9b2a('0xd')](util[_0x9b2a('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9b2a('0x2c')),util[_0x9b2a('0x2d')](_0x2aaed3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x9b2a('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x20d6=['push','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','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','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each'];(function(_0x1a1455,_0x499829){var _0xeee74f=function(_0xb17297){while(--_0xb17297){_0x1a1455['push'](_0x1a1455['shift']());}};_0xeee74f(++_0x499829);}(_0x20d6,0x1b8));var _0x620d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x20d6[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x620d('0x0'));var path=require(_0x620d('0x1'));var _=require(_0x620d('0x2'));var fs=require('fs');var json2xls=require(_0x620d('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x620d('0x4'));var rimraf=require(_0x620d('0x5'));var db=require(_0x620d('0x6'))['db'];var dbH=require(_0x620d('0x6'))[_0x620d('0x7')];var logger=require(_0x620d('0x8'))(_0x620d('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x620d('0xa')][0x2]);var QUERY=process[_0x620d('0xa')][0x3];var PATH=process[_0x620d('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x260d43,_0x52657f){var _0x3d93af={'status':_0x260d43};var _0x478aeb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52657f){_0x3d93af['savename']=_0x52657f;}return db[_0x620d('0xb')][_0x620d('0xc')](_0x3d93af,_0x478aeb);}function main(){var _0x3afc77=0x1388;var _0x4325de;logger[_0x620d('0xd')](util[_0x620d('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x620d('0xf')));return db[_0x620d('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x620d('0x11'),_0x620d('0x12')]})[_0x620d('0x13')](function(_0x20abc7){if(_0x20abc7){_0x4325de=_0x20abc7;_0x3afc77=_0x4325de[_0x620d('0x12')]||0x1388;}})[_0x620d('0x13')](function(){return dbH[_0x620d('0x14')][_0x620d('0x15')](util['format'](_0x620d('0x16'),QUERY),{'type':dbH[_0x620d('0x14')][_0x620d('0x17')][_0x620d('0x18')]});})[_0x620d('0x13')](function(_0x5e05d2){if(!_0x5e05d2[0x0]['num']){return analyticExtractedReport('Empty');}var _0x407e43=[];var _0x5a74cc=0x0;if(_0x4325de[_0x620d('0x11')]){if(_0x5e05d2&&_0x5e05d2[_0x620d('0x19')]){var _0x3f2a2d=_[_0x620d('0x1a')](_0x5e05d2[0x0][_0x620d('0x1b')]/_0x3afc77);var _0x3d2242=Number[_0x620d('0x1c')](_0x5e05d2[0x0]['num']/_0x3afc77)?_0x5e05d2[0x0]['num']%_0x3afc77:0x0;_0x3f2a2d[_0x620d('0x1d')](function(_0x4e4e1e){if(_0x4e4e1e>0x0){_0x5a74cc+=_0x3afc77;}_0x407e43['push'](dbH[_0x620d('0x14')]['query'](util[_0x620d('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3afc77,_0x5a74cc),{'type':dbH[_0x620d('0x14')][_0x620d('0x17')][_0x620d('0x18')]}));});if(_0x3d2242>0x0){_0x5a74cc+=_0x3afc77;_0x407e43['push'](dbH[_0x620d('0x14')][_0x620d('0x15')](util[_0x620d('0xe')](_0x620d('0x1e'),QUERY,_0x3d2242,_0x5a74cc),{'type':dbH[_0x620d('0x14')]['QueryTypes'][_0x620d('0x18')]}));}}}else{_0x407e43['push'](dbH[_0x620d('0x14')][_0x620d('0x15')](QUERY,{'type':dbH[_0x620d('0x14')][_0x620d('0x17')][_0x620d('0x18')]}));}var _0x2a17c7=path[_0x620d('0x1f')](PATH);var _0x190421=path[_0x620d('0x20')](PATH,_0x620d('0x21'));var _0x2a596d=_0x4325de[_0x620d('0x11')]&&_0x407e43[_0x620d('0x19')]>0x1;var _0x9dfbaa=[];if(!fs[_0x620d('0x22')](path[_0x620d('0x23')](_0x2a17c7,_0x190421))&&_0x2a596d){fs['mkdirSync'](path['join'](_0x2a17c7,_0x190421));}return BPromise[_0x620d('0x24')](_0x407e43,function(_0x4ef879){_0x9dfbaa[_0x620d('0x25')](_0x4ef879);})[_0x620d('0x13')](function(){for(var _0x45813a=0x0;_0x45813a<_0x9dfbaa[_0x620d('0x19')];_0x45813a+=0x1){var _0x461272;var _0x188f3e=_0x9dfbaa[_0x45813a];if(_0x2a596d){_0x461272=path[_0x620d('0x23')](_0x2a17c7,_0x190421,util[_0x620d('0xe')](_0x620d('0x26'),_0x190421,_0x45813a,_0x620d('0x27')));}else{_0x461272=path[_0x620d('0x23')](_0x2a17c7,util['format'](_0x620d('0x28'),_0x190421,_0x620d('0x27')));}fs[_0x620d('0x29')](_0x461272,json2xls(_0x188f3e),_0x620d('0x2a'));}})[_0x620d('0x13')](function(){if(_0x2a596d){return new Promise(function(_0x2ac443){zipdir(path['join'](_0x2a17c7,_0x190421),{'saveTo':path[_0x620d('0x23')](_0x2a17c7,util[_0x620d('0xe')]('%s.%s',_0x190421,_0x620d('0x2b')))},function(_0x4aef43,_0x427c27){rimraf(path[_0x620d('0x23')](_0x2a17c7,_0x190421),function(){});_0x2ac443(_0x620d('0x2c'));});});}})[_0x620d('0x13')](function(){logger[_0x620d('0xd')](util[_0x620d('0xe')](_0x620d('0x2d'),EXTRACTED_REPORT_ID,_0x620d('0xf')));return analyticExtractedReport(_0x620d('0x2e'),_0x2a596d?util['format'](_0x620d('0x28'),_0x190421,_0x2a596d?_0x620d('0x2b'):_0x620d('0x27')):null);});})[_0x620d('0x2f')](function(_0x105b0f){logger['info'](util['format'](_0x620d('0x30'),EXTRACTED_REPORT_ID,_0x620d('0xf')),util[_0x620d('0x31')](_0x105b0f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x620d('0x32'));})[_0x620d('0x33')](function(){process[_0x620d('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index b7a2e06..f64d01a 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 _0x1076=['models','Interval','then','intervals','findAll','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','CDR(routeid)=','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','MONITOR_OPTIONS=ab','length','interval','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','util'];(function(_0x4bd481,_0x12c28b){var _0x2122b4=function(_0x274aa8){while(--_0x274aa8){_0x4bd481['push'](_0x4bd481['shift']());}};_0x2122b4(++_0x12c28b);}(_0x1076,0x102));var _0x6107=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x1076[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x6107('0x0'));var util=require(_0x6107('0x1'));function rewrite(_0x1efecc,_0x47c798){var _0x5e1111=this;return _0x1efecc[_0x6107('0x2')][_0x6107('0x3')]['findAll']({'raw':!![]})[_0x6107('0x4')](function(_0x279805){_0x5e1111[_0x6107('0x5')]=_0x279805;return _0x1efecc[_0x6107('0x2')]['VoiceExtension'][_0x6107('0x6')]({'where':{'IntervalId':_0x47c798['IntervalId']},'raw':!![]});})[_0x6107('0x4')](function(_0x298072){return _0x1efecc[_0x6107('0x2')][_0x6107('0x7')][_0x6107('0x6')]({'where':{'exten':{'$in':_[_0x6107('0x8')](_[_0x6107('0x9')](_0x298072,_0x6107('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x6107('0x4')](function(_0x20359f){var _0x13d6b3=_[_0x6107('0xb')](_0x20359f,{'priority':'1'});var _0x15732c=_[_0x6107('0xb')](_0x20359f,{'isApp':0x1});var _0x479bed=_[_0x6107('0xc')](_0x15732c,_0x6107('0xa'));var _0x133ddb=[_0x6107('0xd'),_0x6107('0xe')];var _0x464064=[];var _0x548224=[];for(var _0x289612 in _0x479bed){if(_0x479bed[_0x6107('0xf')](_0x289612)){_0x5e1111['priority']=0x2;_0x5e1111['extensions']=[];_0x5e1111[_0x6107('0x10')]=_[_0x6107('0x11')](_0x13d6b3,{'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')]});_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':util[_0x6107('0x16')](_0x6107('0x17'),_0x479bed[_0x289612][0x0]['type']),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});if(_0x479bed[_0x289612][0x0]['type']==='inbound'){_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':'Set','appdata':_0x6107('0x1b')+_0x479bed[_0x289612][0x0][_0x6107('0x1a')],'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0]['exten'],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});}else if(_0x479bed[_0x289612][0x0][_0x6107('0x14')]==='outbound'){if(_0x5e1111[_0x6107('0x10')]){_0x5e1111[_0x6107('0x12')]['push']({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x6107('0x1c')+(_0x5e1111['extension'][_0x6107('0x1d')]?'${EXTEN:'+_0x5e1111['extension'][_0x6107('0x1d')]+'}':'${EXTEN}'),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0]['VoiceExtensionId']});}_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':'Set','appdata':_0x6107('0x1b')+_0x479bed[_0x289612][0x0]['VoiceExtensionId'],'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111['priority']++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});var _0x6cc984=_0x5e1111['priority']++;_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x1e'),'appdata':_0x6107('0x1f')+(_0x6cc984+0x2)+_0x6107('0x20')+(_0x6cc984+0x1)+')','context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x6cc984,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});if(_0x5e1111[_0x6107('0x10')]){_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x5e1111[_0x6107('0x10')][_0x6107('0x1d')]?_0x6107('0x21')+_0x5e1111[_0x6107('0x10')][_0x6107('0x1d')]+'}':_0x6107('0x22'),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});}_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':'outboundrouteid='+_0x479bed[_0x289612][0x0][_0x6107('0x1a')],'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});if(_0x5e1111[_0x6107('0x10')]&&_0x5e1111[_0x6107('0x10')]['hasOwnProperty'](_0x6107('0x23'))&&_0x5e1111['extension'][_0x6107('0x23')]!==_0x6107('0x24')){_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x6107('0x25'),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5e1111[_0x6107('0x10')][_0x6107('0x23')]||_0x6107('0x26'),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0]['exten'],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0]['VoiceExtensionId']});}}_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});_0x5e1111['extensions']['push']({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111[_0x6107('0x19')]++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});_0x5e1111[_0x6107('0x12')][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x6107('0x27'),'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'priority':_0x5e1111['priority']++,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});for(var _0xe65828=0x0,_0x437e66=0x0;_0xe65828<_0x479bed[_0x289612][_0x6107('0x28')];_0xe65828+=0x1,_0x437e66=0x0){var _0x3d7030=_0x479bed[_0x289612][_0xe65828];if(_0x3d7030['type']){_0x3d7030['type']=_0x3d7030[_0x6107('0x14')]['toLowerCase']();}var _0x5a8b44=[];var _0x4714f7=[];delete _0x3d7030['id'];delete _0x3d7030['createdAt'];delete _0x3d7030['updatedAt'];var _0x52ddf2=_0x3d7030['interval']!=='*,*,*,*'?[_0x3d7030[_0x6107('0x29')]]:_0x3d7030[_0x6107('0x2a')]?_[_0x6107('0x9')](_['filter'](_0x5e1111[_0x6107('0x5')],{'IntervalId':_0x3d7030[_0x6107('0x2a')]}),'interval'):[];if(_0x3d7030[_0x6107('0xf')](_0x6107('0x2b'))){if(_0x3d7030['tag']&&_0x3d7030[_0x6107('0x2b')]!=='--'){_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030[_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x6107('0x2c')+_0x3d7030['tag'],'context':_0x3d7030['context'],'exten':_0x3d7030['exten'],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111[_0x6107('0x19')]+_0x437e66++,'VoiceExtensionId':_0x3d7030['VoiceExtensionId']});}}if(_0x3d7030[_0x6107('0x14')]===_0x6107('0x2d')&&_0x3d7030[_0x6107('0xf')](_0x6107('0x2e'))){if(_0x3d7030[_0x6107('0x2e')]){_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030[_0x6107('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3d7030[_0x6107('0x2e')]+')','context':_0x3d7030[_0x6107('0x18')],'exten':_0x3d7030[_0x6107('0xa')],'priority':_0x52ddf2['length']+_0x5e1111[_0x6107('0x19')]+_0x437e66++,'VoiceExtensionId':_0x3d7030[_0x6107('0x1a')]});}else{_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030[_0x6107('0x14')],'app':_0x6107('0x1e'),'appdata':_0x6107('0x2f'),'context':_0x3d7030[_0x6107('0x18')],'exten':_0x3d7030[_0x6107('0xa')],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111[_0x6107('0x19')]+_0x437e66++,'VoiceExtensionId':_0x3d7030[_0x6107('0x1a')]});}}if(_0x3d7030[_0x6107('0xf')]('answer')){if(_0x133ddb[_0x6107('0x30')](_0x3d7030['app'][_0x6107('0x31')]())>=0x0&&_0x3d7030[_0x6107('0x32')]!==_0x6107('0x33')){if(_0x3d7030[_0x6107('0x34')]){_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030['type'],'app':_0x6107('0x1e'),'appdata':_0x6107('0x35'),'context':_0x3d7030['context'],'exten':_0x3d7030[_0x6107('0xa')],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111[_0x6107('0x19')]+_0x437e66++,'VoiceExtensionId':_0x3d7030[_0x6107('0x1a')]});_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030['type'],'app':_0x6107('0x15'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3d7030[_0x6107('0x18')],'exten':_0x3d7030[_0x6107('0xa')],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111['priority']+_0x437e66++,'VoiceExtensionId':_0x3d7030['VoiceExtensionId']});}else{_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030[_0x6107('0x14')],'app':_0x6107('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3d7030[_0x6107('0x18')],'exten':_0x3d7030[_0x6107('0xa')],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111['priority']+_0x437e66++,'VoiceExtensionId':_0x3d7030[_0x6107('0x1a')]});_0x5a8b44[_0x6107('0x13')]({'type':_0x3d7030[_0x6107('0x14')],'app':_0x6107('0x15'),'appdata':_0x6107('0x36'),'context':_0x3d7030[_0x6107('0x18')],'exten':_0x3d7030['exten'],'priority':_0x52ddf2[_0x6107('0x28')]+_0x5e1111[_0x6107('0x19')]+_0x437e66++,'VoiceExtensionId':_0x3d7030[_0x6107('0x1a')]});}}}for(var _0x3c1902=0x0;_0x3c1902<_0x52ddf2[_0x6107('0x28')];_0x3c1902+=0x1){var _0x291042=_0x5e1111[_0x6107('0x19')]+_0x52ddf2['length'];var _0x48c5e2=_0x3c1902===_0x52ddf2[_0x6107('0x28')]-0x1?_0x5e1111[_0x6107('0x19')]+_0x5a8b44[_0x6107('0x28')]+_0x4714f7[_0x6107('0x28')]+0x2:_0x5e1111['priority']+_0x3c1902+0x1;_0x5a8b44[_0x6107('0x37')](_0x3c1902,0x0,{'type':_0x3d7030['type'],'app':_0x6107('0x38'),'appdata':_0x52ddf2[_0x3c1902]+'?'+_0x3d7030[_0x6107('0x18')]+_0x6107('0x39')+_0x291042+':'+_0x3d7030['context']+_0x6107('0x39')+_0x48c5e2,'exten':_0x3d7030[_0x6107('0xa')],'context':_0x3d7030[_0x6107('0x18')],'priority':_0x5e1111['priority']+_0x3c1902,'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});}_0x3d7030[_0x6107('0x19')]=_0x5a8b44['length']?_['last'](_0x5a8b44)[_0x6107('0x19')]+0x1:_0x5e1111[_0x6107('0x19')];_0x5e1111[_0x6107('0x19')]=(_0x4714f7[_0x6107('0x28')]?_['last'](_0x4714f7)['priority']:_0x3d7030[_0x6107('0x19')])+0x1;_0x5e1111['extensions']=_[_0x6107('0x3a')](_0x5e1111[_0x6107('0x12')],_0x5a8b44,[_0x3d7030],_0x4714f7);}_0x5e1111['extensions'][_0x6107('0x13')]({'type':_0x479bed[_0x289612][0x0][_0x6107('0x14')],'app':_0x6107('0x3b'),'exten':_0x479bed[_0x289612][0x0][_0x6107('0xa')],'context':_0x479bed[_0x289612][0x0][_0x6107('0x18')],'priority':_0x5e1111['priority'],'VoiceExtensionId':_0x479bed[_0x289612][0x0][_0x6107('0x1a')]});_0x464064[_0x6107('0x13')](_0x479bed[_0x289612][0x0][_0x6107('0x1a')]);_0x548224=_[_0x6107('0x3a')](_0x548224,_0x5e1111[_0x6107('0x12')]);}}return _0x1efecc['transaction'](function(_0x251f2b){return _0x1efecc[_0x6107('0x2')][_0x6107('0x7')][_0x6107('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x464064}},'transaction':_0x251f2b})['then'](function(_0x5ce7f2){return _0x1efecc[_0x6107('0x2')][_0x6107('0x7')][_0x6107('0x3d')](_[_0x6107('0x3e')](_0x548224,_0x6107('0x19')),{'transaction':_0x251f2b});});});})[_0x6107('0x3f')](function(_0x2f5a51){console[_0x6107('0x40')](_0x2f5a51);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x4d20=['context','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extension','find','extensions','push','type','Set','CDR(type)=%s'];(function(_0x54ade2,_0x4210cf){var _0x3fc785=function(_0x2d9a94){while(--_0x2d9a94){_0x54ade2['push'](_0x54ade2['shift']());}};_0x3fc785(++_0x4210cf);}(_0x4d20,0x13e));var _0x04d2=function(_0x7cd0b,_0x523f57){_0x7cd0b=_0x7cd0b-0x0;var _0x2c58bc=_0x4d20[_0x7cd0b];return _0x2c58bc;};'use strict';var _=require(_0x04d2('0x0'));var util=require(_0x04d2('0x1'));function rewrite(_0x3a7306,_0x37b10c){var _0x5bd448=this;return _0x3a7306[_0x04d2('0x2')]['Interval'][_0x04d2('0x3')]({'raw':!![]})[_0x04d2('0x4')](function(_0x137934){_0x5bd448[_0x04d2('0x5')]=_0x137934;return _0x3a7306['models'][_0x04d2('0x6')][_0x04d2('0x3')]({'where':{'IntervalId':_0x37b10c['IntervalId']},'raw':!![]});})[_0x04d2('0x4')](function(_0x4ca3ec){return _0x3a7306['models'][_0x04d2('0x6')][_0x04d2('0x3')]({'where':{'exten':{'$in':_[_0x04d2('0x7')](_[_0x04d2('0x8')](_0x4ca3ec,_0x04d2('0x9')))}},'order':[{'raw':_0x04d2('0xa')}],'raw':!![]});})[_0x04d2('0x4')](function(_0x1fb47c){var _0x50be86=_['filter'](_0x1fb47c,{'priority':'1'});var _0xca2cb5=_[_0x04d2('0xb')](_0x1fb47c,{'isApp':0x1});var _0x30a87b=_[_0x04d2('0xc')](_0xca2cb5,_0x04d2('0x9'));var _0x2c37c7=['queue',_0x04d2('0xd')];var _0x1f70bd=[];var _0x5de499=[];for(var _0x33598a in _0x30a87b){if(_0x30a87b['hasOwnProperty'](_0x33598a)){_0x5bd448[_0x04d2('0xe')]=0x2;_0x5bd448['extensions']=[];_0x5bd448[_0x04d2('0xf')]=_[_0x04d2('0x10')](_0x50be86,{'exten':_0x30a87b[_0x33598a][0x0]['exten']});_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':util['format'](_0x04d2('0x15'),_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')]),'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});if(_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')]===_0x04d2('0x18')){_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0]['type'],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x19')+_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')],'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0]['exten'],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0]['VoiceExtensionId']});}else if(_0x30a87b[_0x33598a][0x0]['type']==='outbound'){if(_0x5bd448['extension']){_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x1a')+(_0x5bd448[_0x04d2('0xf')][_0x04d2('0x1b')]?_0x04d2('0x1c')+_0x5bd448[_0x04d2('0xf')][_0x04d2('0x1b')]+'}':_0x04d2('0x1d')),'context':_0x30a87b[_0x33598a][0x0]['context'],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448['priority']++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0]['VoiceExtensionId']});}_0x5bd448[_0x04d2('0x11')]['push']({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x19')+_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')],'context':_0x30a87b[_0x33598a][0x0]['context'],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});var _0x441cf7=_0x5bd448['priority']++;_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x1e'),'appdata':_0x04d2('0x1f')+(_0x441cf7+0x2)+_0x04d2('0x20')+(_0x441cf7+0x1)+')','context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x441cf7,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});if(_0x5bd448[_0x04d2('0xf')]){_0x5bd448['extensions'][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x5bd448[_0x04d2('0xf')][_0x04d2('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x5bd448[_0x04d2('0xf')][_0x04d2('0x1b')]+'}':_0x04d2('0x21'),'context':_0x30a87b[_0x33598a][0x0]['context'],'exten':_0x30a87b[_0x33598a][0x0]['exten'],'priority':_0x5bd448['priority']++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0]['VoiceExtensionId']});}_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x22')+_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')],'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});if(_0x5bd448['extension']&&_0x5bd448[_0x04d2('0xf')][_0x04d2('0x23')](_0x04d2('0x24'))&&_0x5bd448[_0x04d2('0xf')][_0x04d2('0x24')]!==_0x04d2('0x25')){_0x5bd448['extensions'][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0]['type'],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x26'),'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5bd448[_0x04d2('0xf')][_0x04d2('0x24')]||_0x04d2('0x27'),'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0]['exten'],'priority':_0x5bd448['priority']++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});}}_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x28'),'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448['priority']++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0]['VoiceExtensionId']});_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x29'),'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});_0x5bd448[_0x04d2('0x11')][_0x04d2('0x12')]({'type':_0x30a87b[_0x33598a][0x0][_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x2a'),'context':_0x30a87b[_0x33598a][0x0]['context'],'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'priority':_0x5bd448[_0x04d2('0xe')]++,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0]['VoiceExtensionId']});for(var _0x5e45ab=0x0,_0x5775aa=0x0;_0x5e45ab<_0x30a87b[_0x33598a][_0x04d2('0x2b')];_0x5e45ab+=0x1,_0x5775aa=0x0){var _0x16495a=_0x30a87b[_0x33598a][_0x5e45ab];if(_0x16495a[_0x04d2('0x13')]){_0x16495a[_0x04d2('0x13')]=_0x16495a['type'][_0x04d2('0x2c')]();}var _0x281ffa=[];var _0x3f456b=[];delete _0x16495a['id'];delete _0x16495a['createdAt'];delete _0x16495a[_0x04d2('0x2d')];var _0x2a5daa=_0x16495a['interval']!=='*,*,*,*'?[_0x16495a['interval']]:_0x16495a[_0x04d2('0x2e')]?_[_0x04d2('0x8')](_['filter'](_0x5bd448[_0x04d2('0x5')],{'IntervalId':_0x16495a[_0x04d2('0x2e')]}),'interval'):[];if(_0x16495a[_0x04d2('0x23')]('tag')){if(_0x16495a[_0x04d2('0x2f')]&&_0x16495a['tag']!=='--'){_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a['type'],'app':_0x04d2('0x14'),'appdata':'CDR(tag)='+_0x16495a['tag'],'context':_0x16495a[_0x04d2('0x16')],'exten':_0x16495a[_0x04d2('0x9')],'priority':_0x2a5daa['length']+_0x5bd448[_0x04d2('0xe')]+_0x5775aa++,'VoiceExtensionId':_0x16495a['VoiceExtensionId']});}}if(_0x16495a['type']==='outbound'&&_0x16495a[_0x04d2('0x23')](_0x04d2('0x30'))){if(_0x16495a[_0x04d2('0x30')]){_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a['type'],'app':'ExecIf','appdata':_0x04d2('0x31')+_0x16495a[_0x04d2('0x30')]+')','context':_0x16495a['context'],'exten':_0x16495a[_0x04d2('0x9')],'priority':_0x2a5daa[_0x04d2('0x2b')]+_0x5bd448[_0x04d2('0xe')]+_0x5775aa++,'VoiceExtensionId':_0x16495a[_0x04d2('0x17')]});}else{_0x281ffa['push']({'type':_0x16495a[_0x04d2('0x13')],'app':_0x04d2('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x16495a['context'],'exten':_0x16495a[_0x04d2('0x9')],'priority':_0x2a5daa[_0x04d2('0x2b')]+_0x5bd448['priority']+_0x5775aa++,'VoiceExtensionId':_0x16495a['VoiceExtensionId']});}}if(_0x16495a[_0x04d2('0x23')](_0x04d2('0x32'))){if(_0x2c37c7[_0x04d2('0x33')](_0x16495a[_0x04d2('0x34')][_0x04d2('0x2c')]())>=0x0&&_0x16495a[_0x04d2('0x35')]!=='custom'){if(_0x16495a[_0x04d2('0x32')]){_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a['type'],'app':_0x04d2('0x1e'),'appdata':_0x04d2('0x36'),'context':_0x16495a['context'],'exten':_0x16495a['exten'],'priority':_0x2a5daa['length']+_0x5bd448[_0x04d2('0xe')]+_0x5775aa++,'VoiceExtensionId':_0x16495a['VoiceExtensionId']});_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a[_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x37'),'context':_0x16495a[_0x04d2('0x16')],'exten':_0x16495a['exten'],'priority':_0x2a5daa[_0x04d2('0x2b')]+_0x5bd448['priority']+_0x5775aa++,'VoiceExtensionId':_0x16495a[_0x04d2('0x17')]});}else{_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a[_0x04d2('0x13')],'app':'ExecIf','appdata':_0x04d2('0x38'),'context':_0x16495a[_0x04d2('0x16')],'exten':_0x16495a[_0x04d2('0x9')],'priority':_0x2a5daa['length']+_0x5bd448[_0x04d2('0xe')]+_0x5775aa++,'VoiceExtensionId':_0x16495a[_0x04d2('0x17')]});_0x281ffa[_0x04d2('0x12')]({'type':_0x16495a[_0x04d2('0x13')],'app':_0x04d2('0x14'),'appdata':_0x04d2('0x39'),'context':_0x16495a[_0x04d2('0x16')],'exten':_0x16495a[_0x04d2('0x9')],'priority':_0x2a5daa[_0x04d2('0x2b')]+_0x5bd448[_0x04d2('0xe')]+_0x5775aa++,'VoiceExtensionId':_0x16495a[_0x04d2('0x17')]});}}}for(var _0x596a9e=0x0;_0x596a9e<_0x2a5daa['length'];_0x596a9e+=0x1){var _0x2660c3=_0x5bd448['priority']+_0x2a5daa[_0x04d2('0x2b')];var _0x25b4d1=_0x596a9e===_0x2a5daa[_0x04d2('0x2b')]-0x1?_0x5bd448[_0x04d2('0xe')]+_0x281ffa['length']+_0x3f456b[_0x04d2('0x2b')]+0x2:_0x5bd448[_0x04d2('0xe')]+_0x596a9e+0x1;_0x281ffa['splice'](_0x596a9e,0x0,{'type':_0x16495a[_0x04d2('0x13')],'app':_0x04d2('0x3a'),'appdata':_0x2a5daa[_0x596a9e]+'?'+_0x16495a[_0x04d2('0x16')]+',${EXTEN},'+_0x2660c3+':'+_0x16495a['context']+_0x04d2('0x3b')+_0x25b4d1,'exten':_0x16495a[_0x04d2('0x9')],'context':_0x16495a[_0x04d2('0x16')],'priority':_0x5bd448[_0x04d2('0xe')]+_0x596a9e,'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});}_0x16495a[_0x04d2('0xe')]=_0x281ffa[_0x04d2('0x2b')]?_[_0x04d2('0x3c')](_0x281ffa)[_0x04d2('0xe')]+0x1:_0x5bd448[_0x04d2('0xe')];_0x5bd448['priority']=(_0x3f456b[_0x04d2('0x2b')]?_['last'](_0x3f456b)[_0x04d2('0xe')]:_0x16495a[_0x04d2('0xe')])+0x1;_0x5bd448['extensions']=_[_0x04d2('0x3d')](_0x5bd448[_0x04d2('0x11')],_0x281ffa,[_0x16495a],_0x3f456b);}_0x5bd448['extensions']['push']({'type':_0x30a87b[_0x33598a][0x0]['type'],'app':_0x04d2('0x3e'),'exten':_0x30a87b[_0x33598a][0x0][_0x04d2('0x9')],'context':_0x30a87b[_0x33598a][0x0][_0x04d2('0x16')],'priority':_0x5bd448['priority'],'VoiceExtensionId':_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]});_0x1f70bd[_0x04d2('0x12')](_0x30a87b[_0x33598a][0x0][_0x04d2('0x17')]);_0x5de499=_['concat'](_0x5de499,_0x5bd448['extensions']);}}return _0x3a7306['transaction'](function(_0x5461a0){return _0x3a7306['models']['VoiceExtension'][_0x04d2('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x1f70bd}},'transaction':_0x5461a0})[_0x04d2('0x4')](function(_0x569282){return _0x3a7306[_0x04d2('0x2')][_0x04d2('0x6')][_0x04d2('0x40')](_[_0x04d2('0x41')](_0x5de499,_0x04d2('0xe')),{'transaction':_0x5461a0});});});})['catch'](function(_0x589494){console[_0x04d2('0x42')](_0x589494);});}exports[_0x04d2('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5a4700a..4cd59fc 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 _0xcbb8=['join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','ContactId','cm_contacts','id\x20IN\x20?','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0xcbb8,0xc3));var _0x8cbb=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xcbb8[_0x36dfbd];return _0x4ecad9;};'use strict';var BPromise=require(_0x8cbb('0x0'));var util=require(_0x8cbb('0x1'));var _=require(_0x8cbb('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x8cbb('0x3'));var Redis=require(_0x8cbb('0x4'));var db=require(_0x8cbb('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x8cbb('0x6'))(_0x8cbb('0x7'));config[_0x8cbb('0x8')]=_['defaults'](config[_0x8cbb('0x8')],{'host':_0x8cbb('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cbb('0x8')]));require(_0x8cbb('0xa'))[_0x8cbb('0xb')](socket);try{if(!process[_0x8cbb('0xc')][0x2]||process[_0x8cbb('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x8cbb('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x8cbb('0xc')][0x3]===_0x8cbb('0xe')||process[_0x8cbb('0xc')][0x3]==='null'||!process[_0x8cbb('0xc')][0x4]||process[_0x8cbb('0xc')][0x4]===_0x8cbb('0xe')||process[_0x8cbb('0xc')][0x4]===_0x8cbb('0xd')){throw new Error(_0x8cbb('0xf'));}var FIELDS=_[_0x8cbb('0x10')](process[_0x8cbb('0xc')][0x3][_0x8cbb('0x11')](','),process[_0x8cbb('0xc')][0x4][_0x8cbb('0x11')](','));if(!process[_0x8cbb('0xc')][0x5]||process['argv'][0x5]===_0x8cbb('0xe')||process[_0x8cbb('0xc')][0x5]===_0x8cbb('0xd')){throw new Error(_0x8cbb('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x8cbb('0xc')][0x6]!==_0x8cbb('0xe')&&process[_0x8cbb('0xc')][0x6]!==_0x8cbb('0xd')?process[_0x8cbb('0xc')][0x6]:null;var DUPLICATES=process[_0x8cbb('0xc')][0x7]&&process[_0x8cbb('0xc')][0x7]!==_0x8cbb('0xe')&&process['argv'][0x7]!==_0x8cbb('0xd')?process[_0x8cbb('0xc')][0x7]:null;if(!process[_0x8cbb('0xc')][0x8]||process['argv'][0x8]===_0x8cbb('0xe')||process[_0x8cbb('0xc')][0x8]===_0x8cbb('0xd')){throw new Error(_0x8cbb('0x13'));}var SOCKET_TIMESTAMP=process[_0x8cbb('0xc')][0x8];}catch(_0x2450a3){logger[_0x8cbb('0x14')](_0x2450a3);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(_0x24ccbe,_0x42d424,_0x419523,_0x1d34c4){var _0x272963={'message':_0x42d424};_0x272963[_0x24ccbe]=!![];if(_0x419523){_0x272963[_0x8cbb('0x15')]=_0x419523;}if(_0x1d34c4){_0x272963[_0x8cbb('0x16')]=_0x1d34c4;}return _0x272963;}function isEmail(_0x1789ba){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'](_0x1789ba);}function checkRow(_0x552c07,_0x35d2a6,_0x4a2bf3){return new BPromise(function(_0x5d1e11,_0x1c611c){if(_[_0x8cbb('0x17')](_0x552c07)){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x18'),null,_0x4a2bf3));}if(_0x552c07[_0x8cbb('0x19')]&&_0x552c07['errors']['length']){var _0x51bdfb=_['map'](_0x552c07[_0x8cbb('0x19')],_0x8cbb('0x1a'))[_0x8cbb('0x1b')](';');return _0x1c611c(handleCheckRowError('error',_0x51bdfb,null,_0x4a2bf3));}var _0x9e6e04={};for(var _0x570042 in FIELDS){if(FIELDS['hasOwnProperty'](_0x570042)&&FIELDS[_0x570042]){_0x9e6e04[_0x570042]=_0x552c07[_0x8cbb('0x1c')][0x0][FIELDS[_0x570042]]||_0x552c07[_0x8cbb('0x1c')][0x0]['\ufeff'+FIELDS[_0x570042]];}}if(!_0x9e6e04[_0x8cbb('0x1d')]){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x1e'),null,_0x4a2bf3));}if(!_0x9e6e04[_0x8cbb('0x1f')]){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x20'),null,_0x4a2bf3));}if(_0x9e6e04['birthDate']){var _0x309981=moment(_0x9e6e04[_0x8cbb('0x21')],_0x8cbb('0x22'));if(!_0x309981[_0x8cbb('0x23')]()){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x24'),null,_0x4a2bf3));}}if(_0x9e6e04[_0x8cbb('0x25')]){if(!isEmail(_0x9e6e04['email'])){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x26'),null,_0x4a2bf3));}}_0x9e6e04[_0x8cbb('0x27')]=LISTID;_0x9e6e04[_0x8cbb('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8cbb('0x29')]&&_0x35d2a6){var _0x4a5137={};for(var _0x37223a=0x0,_0x180cc4=DUPLICATES[_0x8cbb('0x29')];_0x37223a<_0x180cc4;_0x37223a+=0x1){_0x4a5137[DUPLICATES[_0x37223a]]=_0x9e6e04[DUPLICATES[_0x37223a]];}var _0x3d58e1=_[_0x8cbb('0x2a')](_0x35d2a6,_0x4a5137);if(_0x3d58e1){return _0x1c611c(handleCheckRowError(_0x8cbb('0x2b'),_0x8cbb('0x2c'),_0x3d58e1,_0x4a2bf3));}}return db[_0x8cbb('0x2d')][_0x8cbb('0x2e')](_0x9e6e04,{'raw':!![],'hooks':![],'fields':_[_0x8cbb('0x2f')](_0x9e6e04)})[_0x8cbb('0x30')](function(_0x3b6bd9){if(DUPLICATES&&DUPLICATES['length']&&_0x35d2a6){_0x35d2a6[_0x8cbb('0x31')](_[_0x8cbb('0x32')](_0x9e6e04,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3b6bd9['id'];return _0x5d1e11();})[_0x8cbb('0x33')](function(_0x5812a7){return _0x1c611c(handleCheckRowError(_0x8cbb('0x14'),_0x8cbb('0x34')+(_0x5812a7['message']||JSON[_0x8cbb('0x35')](_0x5812a7)),null,_0x4a2bf3));});});}function checkHopper(){function _0x41884b(){return function(_0x43f12b){logger['error'](_0x8cbb('0x36'),'checkHopper',util[_0x8cbb('0x37')](_0x43f12b,{'showHidden':![],'depth':null}));};}var _0x16eeb2=function(_0xc1d92e,_0x530e60){var _0x477558=squel[_0x8cbb('0x38')]()[_0x8cbb('0x39')](_0x8cbb('0x3a'))[_0x8cbb('0x3b')]([_0x8cbb('0x1f'),'scheduledAt','ContactId','ListId',_0x530e60,_0x8cbb('0x3c'),_0x8cbb('0x3d')],squel[_0x8cbb('0x3e')]()[_0x8cbb('0x3f')]('phone',_0x8cbb('0x1f'))[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x41'))[_0x8cbb('0x3f')]('id','ContactId')[_0x8cbb('0x3f')](LISTID[_0x8cbb('0x42')](),_0x8cbb('0x27'))['field'](_0xc1d92e['id'][_0x8cbb('0x42')](),_0x530e60)[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x3c'))['field']('NOW()',_0x8cbb('0x3d'))[_0x8cbb('0x43')]('cm_contacts')['where'](_0x8cbb('0x44'))[_0x8cbb('0x45')](_0x8cbb('0x46'),LISTID['toString']())[_0x8cbb('0x45')](_0x8cbb('0x47'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8cbb('0x3f')](_0x8cbb('0x1f'))[_0x8cbb('0x43')](_0x8cbb('0x3a'))[_0x8cbb('0x45')](_0x530e60+_0x8cbb('0x48'),_0xc1d92e['id'][_0x8cbb('0x42')]())))[_0x8cbb('0x42')]();return _0x477558;};var _0x2e8a98=function(_0x20356a,_0xcd0ea6){var _0x30b3da=squel[_0x8cbb('0x38')]()[_0x8cbb('0x39')](_0x8cbb('0x3a'))['fromQuery']([_0x8cbb('0x1f'),'scheduledAt',_0x8cbb('0x49'),_0x8cbb('0x27'),_0xcd0ea6,_0x8cbb('0x3c'),_0x8cbb('0x3d')],squel[_0x8cbb('0x3e')]()['field'](_0x8cbb('0x1f'),_0x8cbb('0x1f'))[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x41'))[_0x8cbb('0x3f')]('id','ContactId')[_0x8cbb('0x3f')](LISTID[_0x8cbb('0x42')](),'ListId')[_0x8cbb('0x3f')](_0x20356a['id'][_0x8cbb('0x42')](),_0xcd0ea6)[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x3c'))[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x3d'))[_0x8cbb('0x43')](_0x8cbb('0x4a'))[_0x8cbb('0x45')](_0x8cbb('0x44'))[_0x8cbb('0x45')](_0x8cbb('0x46'),LISTID[_0x8cbb('0x42')]())[_0x8cbb('0x45')](_0x8cbb('0x4b'),squel['str'](hopperContacts))[_0x8cbb('0x45')](_0x8cbb('0x47'))[_0x8cbb('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8cbb('0x3e')]()['field'](_0x8cbb('0x4c'))[_0x8cbb('0x43')](_0x8cbb('0x4d'))['where'](_0xcd0ea6+'\x20=\x20?',_0x20356a['id']['toString']()))[_0x8cbb('0x45')](_0x8cbb('0x4e'),squel[_0x8cbb('0x3e')]()[_0x8cbb('0x3f')](_0x8cbb('0x1f'))[_0x8cbb('0x43')](_0x8cbb('0x3a'))['where'](_0xcd0ea6+_0x8cbb('0x48'),_0x20356a['id']['toString']())))['toString']();return _0x30b3da;};function _0x3a0fb9(_0x3d0a81,_0x3f03e0){var _0x56cccd=squel[_0x8cbb('0x38')]()['into'](_0x8cbb('0x3a'))[_0x8cbb('0x3b')]([_0x8cbb('0x1f'),_0x8cbb('0x41'),'ContactId',_0x8cbb('0x27'),_0x3f03e0,_0x8cbb('0x3c'),_0x8cbb('0x3d')],squel[_0x8cbb('0x3e')]()[_0x8cbb('0x3f')](_0x8cbb('0x1f'),_0x8cbb('0x1f'))['field'](_0x8cbb('0x40'),_0x8cbb('0x41'))['field']('id',_0x8cbb('0x49'))[_0x8cbb('0x3f')](LISTID[_0x8cbb('0x42')](),'ListId')[_0x8cbb('0x3f')](_0x3d0a81['id']['toString'](),_0x3f03e0)[_0x8cbb('0x3f')]('NOW()',_0x8cbb('0x3c'))[_0x8cbb('0x3f')](_0x8cbb('0x40'),_0x8cbb('0x3d'))['from'](_0x8cbb('0x4a'))[_0x8cbb('0x45')](_0x8cbb('0x44'))[_0x8cbb('0x45')](_0x8cbb('0x46'),LISTID[_0x8cbb('0x42')]())['where'](_0x8cbb('0x4b'),squel[_0x8cbb('0x4f')](hopperContacts))[_0x8cbb('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x8cbb('0x42')]();return _0x56cccd;}function _0x533209(_0x56b99c,_0x193218){var _0x40b87b=squel[_0x8cbb('0x38')]()['into']('cm_hopper_black')[_0x8cbb('0x3b')](['phone','ContactId',_0x8cbb('0x27'),_0x193218,_0x8cbb('0x3c'),_0x8cbb('0x3d')],squel[_0x8cbb('0x3e')]()[_0x8cbb('0x3f')](_0x8cbb('0x1f'),_0x8cbb('0x1f'))[_0x8cbb('0x3f')]('id',_0x8cbb('0x49'))[_0x8cbb('0x3f')](LISTID[_0x8cbb('0x42')](),'ListId')[_0x8cbb('0x3f')](_0x56b99c['id']['toString'](),_0x193218)[_0x8cbb('0x3f')](_0x8cbb('0x40'),'createdAt')['field'](_0x8cbb('0x40'),_0x8cbb('0x3d'))[_0x8cbb('0x43')](_0x8cbb('0x4a'))[_0x8cbb('0x45')](_0x8cbb('0x44'))[_0x8cbb('0x45')](_0x8cbb('0x46'),LISTID['toString']())['where'](_0x8cbb('0x4b'),squel['str'](hopperContacts))[_0x8cbb('0x45')](_0x8cbb('0x47')))[_0x8cbb('0x42')]();return _0x40b87b;}return db[_0x8cbb('0x50')][_0x8cbb('0x51')]({'where':{'type':_0x8cbb('0x52')},'attributes':['id',_0x8cbb('0x53')],'include':[{'model':db['CmList'],'as':_0x8cbb('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x389d74){var _0x5ac698=[];if(_0x389d74){var _0x5dfcd1;for(var _0x38a456=0x0,_0x2848d4;_0x38a456<_0x389d74[_0x8cbb('0x29')];_0x38a456+=0x1){_0x2848d4=_0x389d74[_0x38a456][_0x8cbb('0x55')]({'plain':!![]});switch(_0x2848d4[_0x8cbb('0x53')]){case _0x8cbb('0x56'):_0x5ac698[_0x8cbb('0x31')](db['sequelize'][_0x8cbb('0x57')](_0x2e8a98(_0x2848d4,_0x8cbb('0x58')))[_0x8cbb('0x30')](function(){})['catch'](_0x41884b()));break;case _0x8cbb('0x59'):_0x5ac698[_0x8cbb('0x31')](db[_0x8cbb('0x5a')][_0x8cbb('0x57')](_0x16eeb2(_0x2848d4,'VoiceQueueId'))[_0x8cbb('0x30')](function(){})[_0x8cbb('0x33')](_0x41884b()));break;default:_0x5ac698['push'](db[_0x8cbb('0x5a')][_0x8cbb('0x57')](_0x3a0fb9(_0x2848d4,_0x8cbb('0x58')))[_0x8cbb('0x30')](function(){})[_0x8cbb('0x33')](_0x41884b()));}}}return _0x5ac698;})[_0x8cbb('0x5b')]()[_0x8cbb('0x30')](function(){return db[_0x8cbb('0x50')]['findAll']({'where':{'type':_0x8cbb('0x52')},'attributes':['id'],'include':[{'model':db[_0x8cbb('0x5c')],'as':_0x8cbb('0x5d'),'where':{'id':LISTID}}]})[_0x8cbb('0x30')](function(_0xb6f53f){var _0x23ffa9=[];if(_0xb6f53f){var _0x9f0927;for(var _0x392584=0x0,_0x3b8303;_0x392584<_0xb6f53f[_0x8cbb('0x29')];_0x392584+=0x1){_0x3b8303=_0xb6f53f[_0x392584][_0x8cbb('0x55')]({'plain':!![]});_0x23ffa9[_0x8cbb('0x31')](db['sequelize']['query'](_0x533209(_0x3b8303,'VoiceQueueId'))['then'](function(){})[_0x8cbb('0x33')](_0x41884b()));}}return _0x23ffa9;})[_0x8cbb('0x5b')]();})[_0x8cbb('0x30')](function(){return db[_0x8cbb('0x5e')][_0x8cbb('0x51')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8cbb('0x5c')],'as':_0x8cbb('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x1b1a63){var _0x10bfac=[];if(_0x1b1a63){for(var _0x6f915b=0x0,_0x1e8d09;_0x6f915b<_0x1b1a63['length'];_0x6f915b+=0x1){_0x1e8d09=_0x1b1a63[_0x6f915b][_0x8cbb('0x55')]({'plain':!![]});switch(_0x1e8d09[_0x8cbb('0x53')]){case _0x8cbb('0x56'):_0x10bfac['push'](db[_0x8cbb('0x5a')]['query'](_0x2e8a98(_0x1e8d09,_0x8cbb('0x5f')))[_0x8cbb('0x30')](function(){})['catch'](_0x41884b()));break;case _0x8cbb('0x59'):_0x10bfac['push'](db[_0x8cbb('0x5a')]['query'](_0x16eeb2(_0x1e8d09,_0x8cbb('0x5f')))[_0x8cbb('0x30')](function(){})[_0x8cbb('0x33')](_0x41884b()));break;default:_0x10bfac['push'](db[_0x8cbb('0x5a')][_0x8cbb('0x57')](_0x3a0fb9(_0x1e8d09,_0x8cbb('0x5f')))[_0x8cbb('0x30')](function(){})[_0x8cbb('0x33')](_0x41884b()));}}}return _0x10bfac;})['all']();})[_0x8cbb('0x30')](function(){return db[_0x8cbb('0x5e')][_0x8cbb('0x51')]({'attributes':['id'],'include':[{'model':db[_0x8cbb('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x8cbb('0x30')](function(_0x231a5e){var _0x644c9b=[];if(_0x231a5e){for(var _0x90bf3b=0x0,_0x2627b1;_0x90bf3b<_0x231a5e['length'];_0x90bf3b+=0x1){_0x2627b1=_0x231a5e[_0x90bf3b][_0x8cbb('0x55')]({'plain':!![]});_0x644c9b['push'](db[_0x8cbb('0x5a')][_0x8cbb('0x57')](_0x533209(_0x2627b1,_0x8cbb('0x5f')))[_0x8cbb('0x30')](function(){})[_0x8cbb('0x33')](_0x41884b()));}}return _0x644c9b;})[_0x8cbb('0x5b')]();})[_0x8cbb('0x33')](function(_0xbba8b2){logger[_0x8cbb('0x14')](_0x8cbb('0x60'),_0x8cbb('0x61'),_0xbba8b2[_0x8cbb('0x1a')]);});}var processPromises=function(_0x1c39f1){return BPromise['all'](promises)[_0x8cbb('0x30')](function(_0x4c1b9f){})[_0x8cbb('0x33')](function(_0x1e2c32){logger[_0x8cbb('0x14')]('Error\x20processing\x20rows\x20block:',JSON[_0x8cbb('0x35')](_0x1e2c32));})['finally'](function(){socket[_0x8cbb('0x62')](_0x8cbb('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1c39f1){return _0x1c39f1['resume']();}});};var endCsv=function(){return BPromise[_0x8cbb('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x8cbb('0x62')](_0x8cbb('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8cbb('0x65')](FILEPATH);}catch(_0x2f942d){logger['error'](_0x8cbb('0x66'),JSON[_0x8cbb('0x35')](_0x2f942d));}finally{process['exit'](0x0);}});};process['on'](_0x8cbb('0x67'),function(){logger['info'](_0x8cbb('0x68'));endCsv();});function main(){return BPromise[_0x8cbb('0x64')]()[_0x8cbb('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x8cbb('0x2d')][_0x8cbb('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8cbb('0x30')](function(_0x3a26f5){var _0x25f4a7=fs[_0x8cbb('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8cbb('0x6a')](_0x25f4a7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2516c0,_0x5f370b){total+=0x1;var _0x239cc1=total;promises[_0x8cbb('0x31')](checkRow(_0x2516c0,_0x3a26f5,_0x239cc1)[_0x8cbb('0x30')](function(){success+=0x1;})[_0x8cbb('0x33')](function(_0x33a768){if(_0x33a768[_0x8cbb('0x14')]){errors+=0x1;delete _0x33a768['error'];}else if(_0x33a768[_0x8cbb('0x2b')]){duplicates+=0x1;delete _0x33a768[_0x8cbb('0x2b')];}rows['push'](_0x33a768);}));if(total%0xc8===0x0){_0x5f370b[_0x8cbb('0x6b')]();return processPromises(_0x5f370b);}},'complete':function(){return processPromises()[_0x8cbb('0x30')](function(){logger[_0x8cbb('0x6c')](_0x8cbb('0x6d'));endCsv();});},'error':function(_0x3f0b92,_0x55bece){logger[_0x8cbb('0x6c')](_0x8cbb('0x6e'),JSON[_0x8cbb('0x35')](_0x3f0b92));endCsv();}});})[_0x8cbb('0x33')](function(_0x52789d){logger[_0x8cbb('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x8cbb('0x35')](_0x52789d));});}main(); \ No newline at end of file +var _0xe5ca=['catch','query','all','findAll','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','updatedAt','from','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','always','push','sequelize','VoiceQueueId'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xe5ca,0x1d6));var _0xae5c=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xe5ca[_0x3181cc];return _0x547a4a;};'use strict';var BPromise=require(_0xae5c('0x0'));var util=require(_0xae5c('0x1'));var _=require(_0xae5c('0x2'));var fs=require('fs');var squel=require(_0xae5c('0x3'));var Papa=require(_0xae5c('0x4'));var Redis=require(_0xae5c('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xae5c('0x6'))(_0xae5c('0x7'));config['redis']=_['defaults'](config[_0xae5c('0x8')],{'host':_0xae5c('0x9'),'port':0x18eb});var socket=require(_0xae5c('0xa'))(new Redis(config[_0xae5c('0x8')]));require(_0xae5c('0xb'))[_0xae5c('0xc')](socket);try{if(!process[_0xae5c('0xd')][0x2]||process[_0xae5c('0xd')][0x2]===_0xae5c('0xe')||process[_0xae5c('0xd')][0x2]===_0xae5c('0xf')){throw new Error(_0xae5c('0x10'));}var FILEPATH=process[_0xae5c('0xd')][0x2];if(!process[_0xae5c('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0xae5c('0xd')][0x3]==='null'||!process[_0xae5c('0xd')][0x4]||process['argv'][0x4]===_0xae5c('0xe')||process[_0xae5c('0xd')][0x4]===_0xae5c('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xae5c('0x11')](process[_0xae5c('0xd')][0x3][_0xae5c('0x12')](','),process[_0xae5c('0xd')][0x4][_0xae5c('0x12')](','));if(!process[_0xae5c('0xd')][0x5]||process[_0xae5c('0xd')][0x5]==='undefined'||process[_0xae5c('0xd')][0x5]===_0xae5c('0xf')){throw new Error(_0xae5c('0x13'));}var LISTID=process[_0xae5c('0xd')][0x5];var COMPANYID=process[_0xae5c('0xd')][0x6]&&process[_0xae5c('0xd')][0x6]!==_0xae5c('0xe')&&process['argv'][0x6]!=='null'?process[_0xae5c('0xd')][0x6]:null;var DUPLICATES=process[_0xae5c('0xd')][0x7]&&process[_0xae5c('0xd')][0x7]!=='undefined'&&process[_0xae5c('0xd')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0xae5c('0xd')][0x8]||process['argv'][0x8]==='undefined'||process['argv'][0x8]===_0xae5c('0xf')){throw new Error(_0xae5c('0x14'));}var SOCKET_TIMESTAMP=process[_0xae5c('0xd')][0x8];}catch(_0x15378a){logger['error'](_0x15378a);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(_0x14039b,_0x45885f,_0x1db73e,_0x397e2e){var _0x34dffd={'message':_0x45885f};_0x34dffd[_0x14039b]=!![];if(_0x1db73e){_0x34dffd['contact']=_0x1db73e;}if(_0x397e2e){_0x34dffd[_0xae5c('0x15')]=_0x397e2e;}return _0x34dffd;}function isEmail(_0x212416){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))*$/[_0xae5c('0x16')](_0x212416);}function checkRow(_0x40fa97,_0x47b6c3,_0x50fa79){return new BPromise(function(_0x52ecd3,_0xa5f524){if(_[_0xae5c('0x17')](_0x40fa97)){return _0xa5f524(handleCheckRowError(_0xae5c('0x18'),_0xae5c('0x19'),null,_0x50fa79));}if(_0x40fa97['errors']&&_0x40fa97[_0xae5c('0x1a')][_0xae5c('0x1b')]){var _0x3bf727=_[_0xae5c('0x1c')](_0x40fa97[_0xae5c('0x1a')],_0xae5c('0x1d'))[_0xae5c('0x1e')](';');return _0xa5f524(handleCheckRowError('error',_0x3bf727,null,_0x50fa79));}var _0x17e32e={};for(var _0x2377f5 in FIELDS){if(FIELDS[_0xae5c('0x1f')](_0x2377f5)&&FIELDS[_0x2377f5]){_0x17e32e[_0x2377f5]=_0x40fa97[_0xae5c('0x20')][0x0][FIELDS[_0x2377f5]]||_0x40fa97[_0xae5c('0x20')][0x0]['\ufeff'+FIELDS[_0x2377f5]];}}if(!_0x17e32e[_0xae5c('0x21')]){return _0xa5f524(handleCheckRowError(_0xae5c('0x18'),'firstName\x20not\x20specified!',null,_0x50fa79));}if(!_0x17e32e[_0xae5c('0x22')]){return _0xa5f524(handleCheckRowError('error',_0xae5c('0x23'),null,_0x50fa79));}if(_0x17e32e[_0xae5c('0x24')]){var _0x5f2110=moment(_0x17e32e[_0xae5c('0x24')],_0xae5c('0x25'));if(!_0x5f2110[_0xae5c('0x26')]()){return _0xa5f524(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x50fa79));}}if(_0x17e32e[_0xae5c('0x27')]){if(!isEmail(_0x17e32e[_0xae5c('0x27')])){return _0xa5f524(handleCheckRowError(_0xae5c('0x18'),_0xae5c('0x28'),null,_0x50fa79));}}_0x17e32e['ListId']=LISTID;_0x17e32e[_0xae5c('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xae5c('0x1b')]&&_0x47b6c3){var _0x1e2787={};for(var _0x10fc66=0x0,_0x324210=DUPLICATES[_0xae5c('0x1b')];_0x10fc66<_0x324210;_0x10fc66+=0x1){_0x1e2787[DUPLICATES[_0x10fc66]]=_0x17e32e[DUPLICATES[_0x10fc66]];}var _0x248f85=_['find'](_0x47b6c3,_0x1e2787);if(_0x248f85){return _0xa5f524(handleCheckRowError(_0xae5c('0x2a'),_0xae5c('0x2b'),_0x248f85,_0x50fa79));}}return db[_0xae5c('0x2c')]['create'](_0x17e32e,{'raw':!![],'hooks':![],'fields':_[_0xae5c('0x2d')](_0x17e32e)})['then'](function(_0x13eeda){if(DUPLICATES&&DUPLICATES[_0xae5c('0x1b')]&&_0x47b6c3){_0x47b6c3['push'](_['pick'](_0x17e32e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x13eeda['id'];return _0x52ecd3();})['catch'](function(_0x339953){return _0xa5f524(handleCheckRowError(_0xae5c('0x18'),_0xae5c('0x2e')+(_0x339953[_0xae5c('0x1d')]||JSON[_0xae5c('0x2f')](_0x339953)),null,_0x50fa79));});});}function checkHopper(){function _0x354940(){return function(_0x45c792){logger['error'](_0xae5c('0x30'),_0xae5c('0x31'),util[_0xae5c('0x32')](_0x45c792,{'showHidden':![],'depth':null}));};}var _0x4bf0fa=function(_0x962d3d,_0x2f4be8){var _0x1b0e24=squel['insert']()[_0xae5c('0x33')](_0xae5c('0x34'))[_0xae5c('0x35')]([_0xae5c('0x22'),_0xae5c('0x36'),_0xae5c('0x37'),_0xae5c('0x38'),_0x2f4be8,_0xae5c('0x39'),'updatedAt'],squel[_0xae5c('0x3a')]()['field']('phone',_0xae5c('0x22'))[_0xae5c('0x3b')](_0xae5c('0x3c'),'scheduledAt')[_0xae5c('0x3b')]('id','ContactId')[_0xae5c('0x3b')](LISTID[_0xae5c('0x3d')](),_0xae5c('0x38'))[_0xae5c('0x3b')](_0x962d3d['id'][_0xae5c('0x3d')](),_0x2f4be8)[_0xae5c('0x3b')](_0xae5c('0x3c'),'createdAt')[_0xae5c('0x3b')]('NOW()',_0xae5c('0x3e'))[_0xae5c('0x3f')]('cm_contacts')[_0xae5c('0x40')]('deletedAt\x20IS\x20NULL')[_0xae5c('0x40')](_0xae5c('0x41'),LISTID[_0xae5c('0x3d')]())['where'](_0xae5c('0x42'))['where'](_0xae5c('0x43'),squel[_0xae5c('0x3a')]()['field'](_0xae5c('0x22'))['from'](_0xae5c('0x34'))[_0xae5c('0x40')](_0x2f4be8+_0xae5c('0x44'),_0x962d3d['id']['toString']())))[_0xae5c('0x3d')]();return _0x1b0e24;};var _0x280e87=function(_0x4f17f6,_0x2dde5e){var _0x4b74ad=squel['insert']()[_0xae5c('0x33')](_0xae5c('0x34'))['fromQuery']([_0xae5c('0x22'),_0xae5c('0x36'),_0xae5c('0x37'),_0xae5c('0x38'),_0x2dde5e,'createdAt',_0xae5c('0x3e')],squel['select']()[_0xae5c('0x3b')]('phone',_0xae5c('0x22'))[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x36'))[_0xae5c('0x3b')]('id',_0xae5c('0x37'))[_0xae5c('0x3b')](LISTID[_0xae5c('0x3d')](),_0xae5c('0x38'))[_0xae5c('0x3b')](_0x4f17f6['id']['toString'](),_0x2dde5e)[_0xae5c('0x3b')](_0xae5c('0x3c'),'createdAt')[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x3e'))['from']('cm_contacts')[_0xae5c('0x40')]('deletedAt\x20IS\x20NULL')[_0xae5c('0x40')]('ListId\x20=\x20?',LISTID[_0xae5c('0x3d')]())[_0xae5c('0x40')](_0xae5c('0x45'),squel[_0xae5c('0x46')](hopperContacts))[_0xae5c('0x40')](_0xae5c('0x42'))[_0xae5c('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xae5c('0x3a')]()[_0xae5c('0x3b')](_0xae5c('0x47'))[_0xae5c('0x3f')](_0xae5c('0x48'))[_0xae5c('0x40')](_0x2dde5e+'\x20=\x20?',_0x4f17f6['id'][_0xae5c('0x3d')]()))[_0xae5c('0x40')](_0xae5c('0x43'),squel[_0xae5c('0x3a')]()[_0xae5c('0x3b')]('phone')['from'](_0xae5c('0x34'))['where'](_0x2dde5e+_0xae5c('0x44'),_0x4f17f6['id'][_0xae5c('0x3d')]())))[_0xae5c('0x3d')]();return _0x4b74ad;};function _0x2f8932(_0x4987e6,_0x1286b7){var _0x55e1c1=squel[_0xae5c('0x49')]()[_0xae5c('0x33')](_0xae5c('0x34'))['fromQuery']([_0xae5c('0x22'),'scheduledAt',_0xae5c('0x37'),_0xae5c('0x38'),_0x1286b7,_0xae5c('0x39'),_0xae5c('0x3e')],squel[_0xae5c('0x3a')]()[_0xae5c('0x3b')](_0xae5c('0x22'),_0xae5c('0x22'))[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x36'))[_0xae5c('0x3b')]('id',_0xae5c('0x37'))[_0xae5c('0x3b')](LISTID[_0xae5c('0x3d')](),'ListId')[_0xae5c('0x3b')](_0x4987e6['id'][_0xae5c('0x3d')](),_0x1286b7)[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x39'))[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x3e'))[_0xae5c('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0xae5c('0x41'),LISTID[_0xae5c('0x3d')]())[_0xae5c('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xae5c('0x40')](_0xae5c('0x42')))[_0xae5c('0x3d')]();return _0x55e1c1;}function _0x3f46c3(_0x3b5b3f,_0x2619ba){var _0x35c7f4=squel[_0xae5c('0x49')]()[_0xae5c('0x33')](_0xae5c('0x4a'))[_0xae5c('0x35')]([_0xae5c('0x22'),_0xae5c('0x37'),_0xae5c('0x38'),_0x2619ba,_0xae5c('0x39'),_0xae5c('0x3e')],squel['select']()[_0xae5c('0x3b')]('phone',_0xae5c('0x22'))[_0xae5c('0x3b')]('id',_0xae5c('0x37'))[_0xae5c('0x3b')](LISTID[_0xae5c('0x3d')](),_0xae5c('0x38'))[_0xae5c('0x3b')](_0x3b5b3f['id'][_0xae5c('0x3d')](),_0x2619ba)[_0xae5c('0x3b')](_0xae5c('0x3c'),_0xae5c('0x39'))['field'](_0xae5c('0x3c'),_0xae5c('0x3e'))[_0xae5c('0x3f')]('cm_contacts')[_0xae5c('0x40')]('deletedAt\x20IS\x20NULL')[_0xae5c('0x40')](_0xae5c('0x41'),LISTID[_0xae5c('0x3d')]())[_0xae5c('0x40')]('id\x20IN\x20?',squel[_0xae5c('0x46')](hopperContacts))[_0xae5c('0x40')](_0xae5c('0x42')))[_0xae5c('0x3d')]();return _0x35c7f4;}return db[_0xae5c('0x4b')]['findAll']({'where':{'type':_0xae5c('0x4c')},'attributes':['id',_0xae5c('0x4d')],'include':[{'model':db[_0xae5c('0x4e')],'as':_0xae5c('0x4f'),'where':{'id':LISTID}}]})[_0xae5c('0x50')](function(_0x4aa7ce){var _0xf02408=[];if(_0x4aa7ce){var _0x26ddec;for(var _0x15f94c=0x0,_0x5695f0;_0x15f94c<_0x4aa7ce[_0xae5c('0x1b')];_0x15f94c+=0x1){_0x5695f0=_0x4aa7ce[_0x15f94c]['get']({'plain':!![]});switch(_0x5695f0[_0xae5c('0x4d')]){case _0xae5c('0x51'):_0xf02408[_0xae5c('0x52')](db[_0xae5c('0x53')]['query'](_0x280e87(_0x5695f0,_0xae5c('0x54')))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));break;case'onlyIfOpen':_0xf02408['push'](db[_0xae5c('0x53')][_0xae5c('0x56')](_0x4bf0fa(_0x5695f0,'VoiceQueueId'))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));break;default:_0xf02408['push'](db['sequelize']['query'](_0x2f8932(_0x5695f0,_0xae5c('0x54')))[_0xae5c('0x50')](function(){})['catch'](_0x354940()));}}}return _0xf02408;})[_0xae5c('0x57')]()[_0xae5c('0x50')](function(){return db[_0xae5c('0x4b')][_0xae5c('0x58')]({'where':{'type':_0xae5c('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xae5c('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x44718c){var _0x3cc552=[];if(_0x44718c){var _0x125324;for(var _0x48f3b5=0x0,_0x25de48;_0x48f3b5<_0x44718c[_0xae5c('0x1b')];_0x48f3b5+=0x1){_0x25de48=_0x44718c[_0x48f3b5][_0xae5c('0x5a')]({'plain':!![]});_0x3cc552[_0xae5c('0x52')](db['sequelize'][_0xae5c('0x56')](_0x3f46c3(_0x25de48,_0xae5c('0x54')))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));}}return _0x3cc552;})[_0xae5c('0x57')]();})[_0xae5c('0x50')](function(){return db[_0xae5c('0x5b')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xae5c('0x4f'),'where':{'id':LISTID}}]})[_0xae5c('0x50')](function(_0x10988d){var _0x7b4628=[];if(_0x10988d){for(var _0x2227b6=0x0,_0x15240f;_0x2227b6<_0x10988d['length'];_0x2227b6+=0x1){_0x15240f=_0x10988d[_0x2227b6][_0xae5c('0x5a')]({'plain':!![]});switch(_0x15240f[_0xae5c('0x4d')]){case'always':_0x7b4628['push'](db[_0xae5c('0x53')]['query'](_0x280e87(_0x15240f,_0xae5c('0x5c')))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));break;case'onlyIfOpen':_0x7b4628[_0xae5c('0x52')](db[_0xae5c('0x53')][_0xae5c('0x56')](_0x4bf0fa(_0x15240f,_0xae5c('0x5c')))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));break;default:_0x7b4628['push'](db['sequelize'][_0xae5c('0x56')](_0x2f8932(_0x15240f,_0xae5c('0x5c')))['then'](function(){})['catch'](_0x354940()));}}}return _0x7b4628;})[_0xae5c('0x57')]();})[_0xae5c('0x50')](function(){return db[_0xae5c('0x5b')][_0xae5c('0x58')]({'attributes':['id'],'include':[{'model':db[_0xae5c('0x4e')],'as':_0xae5c('0x59'),'where':{'id':LISTID}}]})[_0xae5c('0x50')](function(_0x3a374){var _0x28c162=[];if(_0x3a374){for(var _0x11ffac=0x0,_0x3aec34;_0x11ffac<_0x3a374[_0xae5c('0x1b')];_0x11ffac+=0x1){_0x3aec34=_0x3a374[_0x11ffac][_0xae5c('0x5a')]({'plain':!![]});_0x28c162[_0xae5c('0x52')](db[_0xae5c('0x53')][_0xae5c('0x56')](_0x3f46c3(_0x3aec34,_0xae5c('0x5c')))[_0xae5c('0x50')](function(){})[_0xae5c('0x55')](_0x354940()));}}return _0x28c162;})[_0xae5c('0x57')]();})[_0xae5c('0x55')](function(_0x2a3fc3){logger[_0xae5c('0x18')](_0xae5c('0x5d'),_0xae5c('0x5e'),_0x2a3fc3[_0xae5c('0x1d')]);});}var processPromises=function(_0x10d6a5){return BPromise['all'](promises)[_0xae5c('0x50')](function(_0x372df6){})[_0xae5c('0x55')](function(_0x4a8a87){logger[_0xae5c('0x18')](_0xae5c('0x5f'),JSON['stringify'](_0x4a8a87));})[_0xae5c('0x60')](function(){socket[_0xae5c('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x10d6a5){return _0x10d6a5[_0xae5c('0x62')]();}});};var endCsv=function(){return BPromise[_0xae5c('0x63')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xae5c('0x50')](function(){socket[_0xae5c('0x61')](_0xae5c('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3f1eb7){logger[_0xae5c('0x18')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xae5c('0x2f')](_0x3f1eb7));}finally{process[_0xae5c('0x65')](0x0);}});};process['on'](_0xae5c('0x66'),function(){logger[_0xae5c('0x67')](_0xae5c('0x68'));endCsv();});function main(){return BPromise[_0xae5c('0x63')]()[_0xae5c('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xae5c('0x2c')][_0xae5c('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xae5c('0x50')](function(_0x5834e3){var _0x4a3682=fs[_0xae5c('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xae5c('0x6a')](_0x4a3682,{'header':!![],'skipEmptyLines':!![],'step':function(_0x490117,_0x43eea2){total+=0x1;var _0x157cf9=total;promises[_0xae5c('0x52')](checkRow(_0x490117,_0x5834e3,_0x157cf9)[_0xae5c('0x50')](function(){success+=0x1;})[_0xae5c('0x55')](function(_0x216730){if(_0x216730[_0xae5c('0x18')]){errors+=0x1;delete _0x216730[_0xae5c('0x18')];}else if(_0x216730['duplicate']){duplicates+=0x1;delete _0x216730['duplicate'];}rows[_0xae5c('0x52')](_0x216730);}));if(total%0xc8===0x0){_0x43eea2[_0xae5c('0x6b')]();return processPromises(_0x43eea2);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xae5c('0x6c'));endCsv();});},'error':function(_0x493c27,_0x3472d8){logger[_0xae5c('0x67')](_0xae5c('0x6d'),JSON[_0xae5c('0x2f')](_0x493c27));endCsv();}});})[_0xae5c('0x55')](function(_0x3f0a9e){logger['error'](_0xae5c('0x6e'),JSON['stringify'](_0x3f0a9e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b4dc8f5..d2ce887 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 _0xe256=['create','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','createdAt','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','message','exit','errors','code','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','clone','root','includes','findAll','name','_description','header','writeFileSync','parse','data','rows','find','trim','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_lists','finish','affectedRows','contact:import:','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','push','all','length','split','filter','CmContactHasItem','findOne','update','updated'];(function(_0x357206,_0xdacd2d){var _0x105d5b=function(_0x10c980){while(--_0x10c980){_0x357206['push'](_0x357206['shift']());}};_0x105d5b(++_0xdacd2d);}(_0xe256,0x14c));var _0x6e25=function(_0x4d73dc,_0x28d725){_0x4d73dc=_0x4d73dc-0x0;var _0xff681=_0xe256[_0x4d73dc];return _0xff681;};'use strict';var fs=require('fs');var path=require(_0x6e25('0x0'));var _=require(_0x6e25('0x1'));var Papa=require(_0x6e25('0x2'));var util=require(_0x6e25('0x3'));var BPromise=require(_0x6e25('0x4'));var moment=require(_0x6e25('0x5'));var squel=require('squel');var Redis=require(_0x6e25('0x6'));var db=require(_0x6e25('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x6e25('0x8'));var logger=require(_0x6e25('0x9'))(_0x6e25('0xa'));config['redis']=_['defaults'](config[_0x6e25('0xb')],{'host':_0x6e25('0xc'),'port':0x18eb});var socket=require(_0x6e25('0xd'))(new Redis(config[_0x6e25('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6e25('0xe')](_0x6e25('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x6e25('0xf'));function isEmail(_0x5377b0){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))*$/[_0x6e25('0x10')](_0x5377b0);}function selectNotIn(_0x59cad8,_0x140979,_0x4eb9e6,_0xe7cea6,_0x3b46a4){return squel[_0x6e25('0x11')]()[_0x6e25('0x12')](_0x6e25('0x13'))[_0x6e25('0x14')](_0xe7cea6)[_0x6e25('0x15')](_0x140979,null,_0x140979+'.id\x20=\x20'+_0xe7cea6+'.'+_0x4eb9e6)[_0x6e25('0x16')](_0xe7cea6+'.'+_0x4eb9e6+_0x6e25('0x17')+_0x59cad8+'.'+_0x4eb9e6)[_0x6e25('0x16')](_0x140979+_0x6e25('0x18')+_0x3b46a4[_0x6e25('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x105c36,_0x5dbc2a){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x6e25('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6e25('0x1a')](function(_0x14a81f){if(_0x14a81f!==null){var _0x572e22=[];for(var _0x3d64b2=0x0;_0x3d64b2<_0x14a81f['length'];_0x3d64b2++){var _0x30852c=_0x14a81f[_0x3d64b2];_0x572e22[_0x6e25('0x1b')](insertAdditionalPhones(_0x30852c));}}Promise[_0x6e25('0x1c')](_0x572e22)[_0x6e25('0x1a')](function(){_0x105c36({'val':0x1});});});});}function insertAdditionalPhones(_0x131ee6){return new Promise(function(_0x3959fc,_0x356f1f){var _0x4440a8=_0x131ee6['AdditionalPhones'];var _0x3f5b1a=_0x4440a8['split'](';');var _0x356289=[];orderBy=0x0;for(var _0x424d92=0x0;_0x424d92<_0x3f5b1a[_0x6e25('0x1d')];_0x424d92++){_0x356289[_0x6e25('0x1b')](splitAdditionalPhone(_0x131ee6['id'],_0x3f5b1a[_0x424d92]));}Promise[_0x6e25('0x1c')](_0x356289)[_0x6e25('0x1a')](function(){_0x3959fc({'val':_0x3f5b1a['length']});});});}function splitAdditionalPhone(_0x117ef7,_0x3367d0){return new Promise(function(_0x3c004f,_0x4d55af){var _0x3d94b5=_0x3367d0['split'](':');var _0x465c1e=_0x3d94b5[0x0];var _0x1f8103=_0x3d94b5[0x1];if(!_['isNil'](_0x1f8103)){var _0x55ed51=_0x1f8103[_0x6e25('0x1e')]('|');var _0x524ddb=[];for(var _0x49d914=0x0;_0x49d914<_0x55ed51[_0x6e25('0x1d')];_0x49d914++){if(_0x55ed51[_0x49d914]!==''){var _0x3c81a4=_[_0x6e25('0x1f')](promisesAdditionalPhones,{'contactId':_0x117ef7,'phone':_0x55ed51[_0x49d914]});if(_0x3c81a4['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x117ef7,'contactTypeId':_0x465c1e,'phone':_0x55ed51[_0x49d914],'orderBy':orderBy});}}}_0x3c004f({'ok':0x1});}else _0x3c004f({'res':0x0});});}function createAdditionalPhone(_0x582dbb,_0x23d020,_0x202544,_0x46709f){var _0x5b2b3d='';var _0x21f926='';var _0x4921e9=_0x202544[_0x6e25('0x1e')]('§');_0x5b2b3d=_0x4921e9[0x0];if(_0x4921e9[_0x6e25('0x1d')]==0x2)_0x21f926=_0x4921e9[0x1];return new Promise(function(_0x5151f9,_0x471e79){return db[_0x6e25('0x20')][_0x6e25('0x21')]({'where':{'CmContactId':_0x582dbb,'item':_0x5b2b3d}})['then'](function(_0x2f290d){if(_0x2f290d){return db[_0x6e25('0x20')][_0x6e25('0x22')]({'ItemTypeId':_0x23d020,'description':_0x21f926,'OrderBy':_0x46709f},{'where':{'CmContactId':_0x582dbb,'item':_0x5b2b3d}})[_0x6e25('0x1a')](function(_0x334804){_0x5151f9({'res':_0x6e25('0x23')});});}else{return db['CmContactHasItem'][_0x6e25('0x24')]({'CmContactId':_0x582dbb,'item':_0x5b2b3d,'description':_0x21f926,'ItemTypeId':_0x23d020,'OrderBy':_0x46709f,'ItemClass':'PHONE'})[_0x6e25('0x1a')](function(_0x5c137d){_0x5151f9({'res':_0x6e25('0x25')});});}});});}function insertCmHopper(_0x1273d2,_0x2cd88c,_0x259bc9,_0x2cfb53,_0x11ee5a){var _0x2abe62=[_0x6e25('0x26'),'cm_contacts.scheduledat',_0x6e25('0x27'),_0x6e25('0x28'),_0x2cd88c+'.'+_0x2cfb53,_0x6e25('0x29'),_0x6e25('0x2a'),'cm_contacts.priority',_0x6e25('0x2b'),'\x22'+_0x11ee5a+'\x22'];return squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')](_0x6e25('0x2e'))[_0x6e25('0x2f')]([_0x6e25('0x13'),_0x6e25('0x30'),_0x6e25('0x31'),_0x6e25('0x32'),_0x2cfb53,'createdAt',_0x6e25('0x33'),_0x6e25('0x34'),_0x6e25('0x35'),_0x6e25('0x36')],squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x2abe62)['from'](_0x2cd88c)[_0x6e25('0x15')](_0x6e25('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x2cd88c+_0x6e25('0x39'))['join'](_0x259bc9,null,_0x259bc9+_0x6e25('0x3a')+_0x2cd88c+'.'+_0x2cfb53)[_0x6e25('0x16')](_0x2cd88c+_0x6e25('0x3b'),_0x1273d2)[_0x6e25('0x16')](_0x6e25('0x3c'),NOW)[_0x6e25('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2cd88c,_0x259bc9,_0x2cfb53,_0x6e25('0x2e'),['\x22always\x22',_0x6e25('0x3d')]))[_0x6e25('0x16')](_0x6e25('0x3e'),selectNotIn(_0x2cd88c,_0x259bc9,_0x2cfb53,_0x6e25('0x2e'),[_0x6e25('0x3f')])))[_0x6e25('0x40')]();}function insertCmHopperBlack(_0x1cc35a,_0x5fcf7f,_0x4bcd37,_0x378875){var _0x258e0e=[_0x6e25('0x26'),_0x6e25('0x27'),_0x6e25('0x28'),_0x5fcf7f+'.'+_0x378875,_0x6e25('0x29'),_0x6e25('0x2a')];return squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')]('cm_hopper_black')[_0x6e25('0x2f')]([_0x6e25('0x13'),'ContactId','ListId',_0x378875,_0x6e25('0x41'),_0x6e25('0x33')],squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x258e0e)[_0x6e25('0x14')](_0x5fcf7f)[_0x6e25('0x15')](_0x6e25('0x38'),null,_0x6e25('0x42')+_0x5fcf7f+_0x6e25('0x39'))['join'](_0x4bcd37,null,_0x4bcd37+_0x6e25('0x3a')+_0x5fcf7f+'.'+_0x378875)['where'](_0x5fcf7f+_0x6e25('0x3b'),_0x1cc35a)[_0x6e25('0x16')](_0x6e25('0x3c'),NOW)[_0x6e25('0x16')](_0x6e25('0x3e'),squel['select']()['field'](_0x6e25('0x13'))[_0x6e25('0x14')](_0x6e25('0x43'))['where'](_0x6e25('0x44'),_0x1cc35a)[_0x6e25('0x16')](_0x378875+_0x6e25('0x17')+_0x5fcf7f+'.'+_0x378875)))['toString']();}function insertTzCmHopper(_0x267296,_0x2306b9,_0x28be13,_0x123148,_0x88d5be,_0x43f75e){var _0x615714=[_0x6e25('0x26'),_0x6e25('0x45')+_0x43f75e+_0x6e25('0x46'),'cm_contacts.id',_0x6e25('0x28'),_0x2306b9+'.'+_0x123148,_0x6e25('0x29'),_0x6e25('0x2a'),_0x6e25('0x47'),_0x6e25('0x2b'),'\x22'+_0x88d5be+'\x22'];var _0x27c0d6=squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')](_0x6e25('0x2e'))[_0x6e25('0x2f')](['phone',_0x6e25('0x30'),_0x6e25('0x31'),_0x6e25('0x32'),_0x123148,_0x6e25('0x41'),_0x6e25('0x33'),_0x6e25('0x34'),_0x6e25('0x35'),'recallme'],squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x615714)['from'](_0x2306b9)[_0x6e25('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2306b9+'.CmListId')[_0x6e25('0x15')](_0x28be13,null,_0x28be13+_0x6e25('0x3a')+_0x2306b9+'.'+_0x123148)[_0x6e25('0x15')](_0x43f75e,null,_0x43f75e+_0x6e25('0x3a')+_0x2306b9+'.'+_0x123148)[_0x6e25('0x16')](_0x2306b9+_0x6e25('0x3b'),_0x267296)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x6e25('0x3e'),selectNotIn(_0x2306b9,_0x28be13,_0x123148,_0x6e25('0x2e'),[_0x6e25('0x3f'),_0x6e25('0x3d')]))[_0x6e25('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2306b9,_0x28be13,_0x123148,_0x6e25('0x2e'),[_0x6e25('0x3f')])))[_0x6e25('0x40')]();return _0x27c0d6;}function insertTzCmHopperBlack(_0x47d6ba,_0x1e0e18,_0xb0510f,_0x4e1f23){var _0x28ec72=[_0x6e25('0x26'),'cm_contacts.id',_0x6e25('0x28'),_0x1e0e18+'.'+_0x4e1f23,_0x6e25('0x29'),_0x6e25('0x2a')];return squel['insert']()[_0x6e25('0x2d')]('cm_hopper_black')[_0x6e25('0x2f')](['phone',_0x6e25('0x31'),'ListId',_0x4e1f23,'createdAt',_0x6e25('0x33')],squel['select']()[_0x6e25('0x37')](_0x28ec72)['from'](_0x1e0e18)[_0x6e25('0x15')](_0x6e25('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x1e0e18+_0x6e25('0x39'))[_0x6e25('0x15')](_0xb0510f,null,_0xb0510f+_0x6e25('0x3a')+_0x1e0e18+'.'+_0x4e1f23)[_0x6e25('0x16')](_0x1e0e18+_0x6e25('0x3b'),_0x47d6ba)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6e25('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6e25('0x11')]()[_0x6e25('0x12')](_0x6e25('0x13'))[_0x6e25('0x14')](_0x6e25('0x43'))[_0x6e25('0x16')](_0x6e25('0x44'),_0x47d6ba)[_0x6e25('0x16')](_0x4e1f23+_0x6e25('0x17')+_0x1e0e18+'.'+_0x4e1f23)))[_0x6e25('0x40')]();}function insertCmHopperAdditionalPhones(_0x30436c){var _0x509174=[_0x6e25('0x48'),_0x6e25('0x49'),_0x6e25('0x4a'),_0x6e25('0x4b'),_0x6e25('0x4c')];return squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')](_0x6e25('0x4d'))[_0x6e25('0x2f')]([_0x6e25('0x4e'),'phone',_0x6e25('0x4f'),_0x6e25('0x41'),_0x6e25('0x33')],squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x509174)[_0x6e25('0x14')](_0x6e25('0x2e'))[_0x6e25('0x15')](_0x6e25('0x38'),null,_0x6e25('0x50'))[_0x6e25('0x15')](_0x6e25('0x51'),null,_0x6e25('0x52'))['where'](_0x6e25('0x53'),_0x30436c)['where'](_0x6e25('0x3c'),NOW))[_0x6e25('0x40')]();}function insertCmContact(_0x30c770,_0x17a24f,_0x3eba6c,_0x424241){var _0x211a7c=_[_0x6e25('0x54')](_[_0x6e25('0x55')](_0x424241),[_0x6e25('0x32'),_0x6e25('0x56'),_0x6e25('0x41'),_0x6e25('0x33'),'scheduledAt']);return squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')]('cm_contacts')[_0x6e25('0x2f')](_0x211a7c,squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x211a7c)[_0x6e25('0x14')](_0x17a24f)[_0x6e25('0x16')]('('+_0x3eba6c[_0x6e25('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x6e25('0x11')]()[_0x6e25('0x37')](_0x3eba6c)[_0x6e25('0x14')]('cm_contacts')[_0x6e25('0x16')](_0x6e25('0x44'),_0x30c770)[_0x6e25('0x16')](_0x6e25('0x57')))[_0x6e25('0x16')](_0x6e25('0x58'),squel['select']()['field']('MIN(id)',_0x6e25('0x59'))[_0x6e25('0x14')](_0x17a24f)['group'](_0x3eba6c[_0x6e25('0x15')](','))))['toString']();}function handleStop(){logger[_0x6e25('0x5a')](_0x6e25('0x5b'));stopped=!![];}function handleUncaughtException(_0x3a8a98){logger['error'](_0x3a8a98[_0x6e25('0x5c')]);process[_0x6e25('0x5d')](0x1);}function handleError(_0xab8574,_0x422d0d){stats[_0x6e25('0x5e')][_0x6e25('0x1b')]({'name':_0x422d0d[_0x6e25('0x5f')],'message':_0x422d0d[_0x6e25('0x5c')],'row':_0xab8574});}function handleQuery(_0xb418d){logger[_0x6e25('0x5a')](_0xb418d);return db[_0x6e25('0x60')][_0x6e25('0x61')](_0xb418d)[_0x6e25('0x62')](function(_0xa23e86){results[_0x6e25('0x1b')](_0xa23e86);})[_0x6e25('0x63')](function(_0x27494b){logger[_0x6e25('0x64')](_0x27494b[_0x6e25('0x5c')]);});}function updateTzCampaigns(_0x320172){return new Promise(function(_0x4760c5,_0x1c6dea){var _0x1d7c55=squel['select']()[_0x6e25('0x37')]([_0x6e25('0x65'),_0x6e25('0x66')])['from'](_0x6e25('0x67'))['join']('campaigns_has_cm_lists',null,_0x6e25('0x68'))[_0x6e25('0x16')](_0x6e25('0x69')+_0x320172);db[_0x6e25('0x60')]['query'](_0x1d7c55['toString']())['spread'](function(_0x5bc102){var _0x27bccd=[];for(var _0xdfe2e5=0x0;_0xdfe2e5<_0x5bc102['length'];_0xdfe2e5++){_0x27bccd['push'](getTimezoneData(_0x5bc102[_0xdfe2e5],tmp_campaigns));}BPromise[_0x6e25('0x1c')](_0x27bccd)[_0x6e25('0x1a')](function(){_0x4760c5({'val':0x1});});})['catch'](function(_0x344f78){logger[_0x6e25('0x64')](_0x344f78['message']);_0x4760c5({'val':0x0});});});}function updateTzVoiceQueues(_0x31c839){return new Promise(function(_0x15dfe1,_0x341b32){var _0x116d4e=squel['select']()[_0x6e25('0x37')](['voice_queues.id','voice_queues.dialTimezone'])[_0x6e25('0x14')](_0x6e25('0x6a'))['join'](_0x6e25('0x6b'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x6e25('0x6c')+_0x31c839);db[_0x6e25('0x60')][_0x6e25('0x61')](_0x116d4e[_0x6e25('0x40')]())['spread'](function(_0x316c23){var _0x4b86af=[];for(var _0x30ebc0=0x0;_0x30ebc0<_0x316c23[_0x6e25('0x1d')];_0x30ebc0++){_0x4b86af[_0x6e25('0x1b')](getTimezoneData(_0x316c23[_0x30ebc0],tmp_voice_queues));}BPromise['all'](_0x4b86af)['then'](function(){_0x15dfe1({'val':0x1});});})[_0x6e25('0x63')](function(_0x4fd335){logger[_0x6e25('0x64')](_0x4fd335['message']);_0x15dfe1({'val':0x0});});});}function getTimezoneData(_0x4c6527,_0x563d0d){return new Promise(function(_0x4abb91,_0x284798){var _0x489f13=shared[_0x6e25('0x6d')];var _0x59c300=_0x489f13[_0x4c6527[_0x6e25('0x6e')]];if(_[_0x6e25('0x6f')](_0x59c300)){_0x4abb91({'ret':0x1});}else{var _0x2f164a=_0x59c300[_0x6e25('0x70')];var _0x369868=squel[_0x6e25('0x2c')]()[_0x6e25('0x2d')](_0x563d0d)[_0x6e25('0x71')]('id',_0x4c6527['id'])['set'](_0x6e25('0x72'),_0x2f164a)['set']('dialTimezone',_0x4c6527[_0x6e25('0x6e')])['toString']();return db['sequelize']['query'](_0x369868)[_0x6e25('0x62')](function(_0x338899){_0x4abb91({'ret':0x1});})['catch'](function(_0x6e5f1f){logger[_0x6e25('0x64')](_0x6e5f1f[_0x6e25('0x5c')]);_0x284798({'ret':0x1});});}});}function handleTZQuery(_0x55f0e6){logger['info'](_0x55f0e6);return db['sequelize']['query'](_0x55f0e6)['spread'](function(_0x2d5965){})['catch'](function(_0x1ff7b2){logger[_0x6e25('0x64')](_0x1ff7b2[_0x6e25('0x5c')]);});}function main(_0x4daadf,_0x7d9ac,_0x570a3a,_0x4bd0b2){logger[_0x6e25('0x5a')](_0x6e25('0x73'),_0x4daadf,JSON[_0x6e25('0x74')](_0x7d9ac));process[_0x6e25('0x75')](_0x6e25('0x76'));var _0x19c1b5=_0x7d9ac[_0x6e25('0x77')];var _0x9cb9c3=_[_0x6e25('0x78')](_0x19c1b5);var _0x348c56=_0x7d9ac['socket_timestamp'];var _0x4dc8b3=path[_0x6e25('0x15')](config[_0x6e25('0x79')],'server/files/tmp',_0x348c56+'.csv');hasTZ=_[_0x6e25('0x55')](_0x19c1b5)[_0x6e25('0x7a')]('dialTimezone');var _0x243971=_['keys'](_0x19c1b5)[_0x6e25('0x15')]();logger[_0x6e25('0x5a')]('header',_0x243971);db['ContactItemType'][_0x6e25('0x7b')]({'raw':!![],'attributes':['id','name']})[_0x6e25('0x1a')](function(_0x16a33b){for(var _0x38f3c6=0x0;_0x38f3c6<_0x16a33b[_0x6e25('0x1d')];_0x38f3c6++){if(_0x16a33b[_0x38f3c6][_0x6e25('0x7c')]in _0x19c1b5){contactItemTypes[_0x6e25('0x1b')](_0x16a33b[_0x38f3c6]);delete _0x9cb9c3[_0x16a33b[_0x38f3c6][_0x6e25('0x7c')]];hasAdditionalPhones=!![];}for(var _0x1d139a in _0x19c1b5){if(_0x16a33b[_0x38f3c6][_0x6e25('0x7c')]+_0x6e25('0x7d')===_0x1d139a){phoneDescriptions[_0x6e25('0x1b')]({'itemTypeId':_0x16a33b[_0x38f3c6]['id'],'description':_0x1d139a});delete _0x9cb9c3[_0x1d139a];}}}if(hasAdditionalPhones)_0x9cb9c3['AdditionalPhones']='';var _0x3a16c3=_['keys'](_0x9cb9c3)[_0x6e25('0x15')]();logger[_0x6e25('0x5a')](_0x6e25('0x7e'),_0x3a16c3);fs[_0x6e25('0x7f')](_0x4dc8b3,_0x3a16c3+'\x0a');Papa[_0x6e25('0x80')](fs['createReadStream'](_0x4daadf),{'header':!![],'skipEmptyLines':!![],'step':function(_0xd3b1d6,_0x327bdc){try{for(var _0x29ed06=0x0,_0x1eb77e=[];_0x29ed06<_0xd3b1d6[_0x6e25('0x81')][_0x6e25('0x1d')];_0x29ed06++){stats[_0x6e25('0x82')]+=0x1;if(_0xd3b1d6[_0x6e25('0x5e')][_0x29ed06]){handleError(_0xd3b1d6[_0x6e25('0x81')][_0x29ed06],_0xd3b1d6[_0x6e25('0x5e')][_0x29ed06]);}else{var _0x2cac36=[];var _0x8f77e7=[];var _0x261015={};for(var _0x3ae740 in _0x19c1b5){let _0x505a7e=contactItemTypes[_0x6e25('0x83')](_0x17b982=>_0x17b982['name']===_0x3ae740);let _0x4c5eab=contactItemTypes['find'](_0x527e06=>_0x527e06[_0x6e25('0x7c')]+_0x6e25('0x7d')===_0x3ae740);if(_[_0x6e25('0x6f')](_0x505a7e)&&_[_0x6e25('0x6f')](_0x4c5eab)){if(_0x19c1b5['hasOwnProperty'](_0x3ae740)){if(_0xd3b1d6[_0x6e25('0x81')][_0x29ed06][_0x19c1b5[_0x3ae740]]){var _0x556f0f=_[_0x6e25('0x84')](_0xd3b1d6[_0x6e25('0x81')][_0x29ed06][_0x19c1b5[_0x3ae740]]['replace'](/"/g,'\x27'));switch(_0x3ae740){case _0x6e25('0x30'):var _0x5e8333=moment(_0x556f0f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5e8333[_0x6e25('0x85')]()){_0x1eb77e['push']('\x22'+_0x556f0f+'\x22');}else{_0x2cac36[_0x6e25('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x6e25('0x34'):var _0x26cb24=parseInt(_0x556f0f);_0x556f0f=_[_0x6e25('0x86')](_0x26cb24)||_0x26cb24<0x0||_0x26cb24>0x4?_0x4bd0b2?0x3:0x2:_0x26cb24;_0x1eb77e[_0x6e25('0x1b')]('\x22'+_0x556f0f+'\x22');break;case _0x6e25('0x35'):var _0x4fa5d9=parseInt(_0x556f0f);if(_['isNumber'](_0x4fa5d9)&&_[_0x6e25('0x7a')](_0x570a3a,_0x4fa5d9)){_0x1eb77e[_0x6e25('0x1b')]('\x22'+_0x4fa5d9+'\x22');}else{_0x2cac36[_0x6e25('0x1b')](_0x6e25('0x87'));}break;case _0x6e25('0x88'):if(isEmail(_0x556f0f)){_0x1eb77e['push']('\x22'+_0x556f0f+'\x22');}else{_0x2cac36[_0x6e25('0x1b')](_0x6e25('0x89'));}break;case _0x6e25('0x8a'):var _0x31ea01=moment(_0x556f0f,_0x6e25('0x8b'),!![]);if(_0x31ea01[_0x6e25('0x85')]()){_0x1eb77e[_0x6e25('0x1b')]('\x22'+_0x556f0f+'\x22');}else{_0x2cac36['push'](_0x6e25('0x8c'));}break;case _0x6e25('0x6e'):var _0x529c1b=shared[_0x6e25('0x6d')];var _0xcb91e3=_0x529c1b[_0x556f0f];if(!_['isNil'](_0xcb91e3)){var _0x10fb60=_0xcb91e3[_0x6e25('0x70')];_0x1eb77e['push']('\x22'+_0x556f0f+'\x22');_0x1eb77e['push']('\x22'+_0x10fb60+'\x22');}break;default:_0x1eb77e[_0x6e25('0x1b')]('\x22'+_0x556f0f+'\x22');}}else{switch(_0x3ae740){case'firstName':case'phone':_0x2cac36['push'](_0x3ae740+_0x6e25('0x8d'));break;default:_0x1eb77e['push']('\x22\x22');}}}}else{var _0x2edc1f='';if(!_[_0x6e25('0x6f')](_0x505a7e)){if(!_0x261015[_0x6e25('0x8e')](_0x505a7e['id'])){if(!_[_0x6e25('0x6f')](_0xd3b1d6[_0x6e25('0x81')][_0x29ed06][_0x19c1b5[_0x3ae740]])){var _0x556f0f=_[_0x6e25('0x84')](_0xd3b1d6[_0x6e25('0x81')][_0x29ed06][_0x19c1b5[_0x3ae740]][_0x6e25('0x8f')](/"/g,'\x27'));var _0x1fb530=phoneDescriptions['find'](_0x5238f1=>_0x5238f1[_0x6e25('0x90')]===_0x505a7e['id']);if(!_['isNil'](_0x1fb530)){var _0x2f1258=_[_0x6e25('0x84')](_0xd3b1d6[_0x6e25('0x81')][_0x29ed06][_0x19c1b5[_0x1fb530[_0x6e25('0x91')]]][_0x6e25('0x8f')](/"/g,'\x27'));if(!_[_0x6e25('0x6f')](_0x2f1258))_0x556f0f=_0x556f0f+'§'+_0x2f1258;}if(_0x2edc1f=='')_0x2edc1f=_0x556f0f;else _0x2edc1f+='|'+_0x556f0f;}_0x8f77e7[_0x6e25('0x1b')](_0x505a7e['id']+':'+_0x2edc1f);_0x261015[_0x505a7e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1eb77e[_0x6e25('0x1b')]('\x22'+_0x8f77e7[_0x6e25('0x15')](';')+'\x22');}if(_0x2cac36[_0x6e25('0x1d')]){handleError(_0xd3b1d6['data'][_0x29ed06],{'code':_0x6e25('0x92'),'message':_0x2cac36[_0x6e25('0x15')]()});}else{fs[_0x6e25('0x93')](_0x4dc8b3,_0x1eb77e[_0x6e25('0x15')]()+'\x0a');}_0x1eb77e=[];}if(!(stats[_0x6e25('0x82')]%0xc8)){socket[_0x6e25('0x94')]('contact:import:'+_0x348c56,stats);stats['errors']=[];}}if(stopped){logger[_0x6e25('0x5a')](_0x6e25('0x95'));_0x327bdc[_0x6e25('0x96')]();}}catch(_0x329535){handleError(_0xd3b1d6[_0x6e25('0x81')][_0x29ed06],{'code':_0x6e25('0x97'),'message':_0x329535[_0x6e25('0x5c')]});logger[_0x6e25('0x64')](_0x6e25('0x98'),_0x329535[_0x6e25('0x5c')]);}},'complete':function(){try{var _0x3f8076=[];var _0x4cd1cc=[];var _0xe5f0af=_0x6e25('0x38');if(_0x7d9ac['duplicates']&&_0x7d9ac[_0x6e25('0x99')][_0x6e25('0x1d')]){_0xe5f0af='cm_contacts_'+_0x348c56;_0x3f8076[_0x6e25('0x1b')]('CREATE\x20TABLE\x20'+_0xe5f0af+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6e25('0x9a')+_0x348c56;tmp_voice_queues='voice_queues_'+_0x348c56;_0x4cd1cc['push'](_0x6e25('0x9b')+tmp_campaigns+_0x6e25('0x9c'));_0x4cd1cc[_0x6e25('0x1b')](_0x6e25('0x9b')+tmp_voice_queues+_0x6e25('0x9c'));BPromise['each'](_0x4cd1cc,handleTZQuery)[_0x6e25('0x1a')](function(_0x3fb55a){updateTzCampaigns(_0x7d9ac[_0x6e25('0x32')])[_0x6e25('0x1a')](function(_0x481612){updateTzVoiceQueues(_0x7d9ac[_0x6e25('0x32')])[_0x6e25('0x1a')](function(_0x4b8c9e){if(hasTZ)_0x3a16c3=_0x3a16c3[_0x6e25('0x8f')](_0x6e25('0x6e'),_0x6e25('0x9d'));var _0xa255d3=util[_0x6e25('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4dc8b3,_0xe5f0af,_0x3a16c3,_0x7d9ac[_0x6e25('0x32')],_0x7d9ac['CompanyId']||null,NOW,NOW);if(_[_0x6e25('0x6f')](_0x19c1b5['scheduledat'])){_0xa255d3+=',\x20scheduledAt\x20=\x20NOW()';}_0x3f8076[_0x6e25('0x1b')](_0xa255d3);if(_0x7d9ac[_0x6e25('0x99')]&&_0x7d9ac[_0x6e25('0x99')]['length']){_0x3f8076[_0x6e25('0x1b')](insertCmContact(_0x7d9ac[_0x6e25('0x32')],_0xe5f0af,_0x7d9ac[_0x6e25('0x99')],_0x19c1b5));_0x3f8076[_0x6e25('0x1b')](_0x6e25('0x9e')+_0xe5f0af+';');}BPromise[_0x6e25('0x9f')](_0x3f8076,handleQuery)[_0x6e25('0x1a')](function(_0x41c4ac){BPromise['all']([handleAdditionalPhones()])[_0x6e25('0x1a')](function(){_0x3f8076=[];for(var _0x3ae446=0x0;_0x3ae446\x20\x20','argv','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','path','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xe68f,0x1d4));var _0xfe68=function(_0x203db0,_0x42a771){_0x203db0=_0x203db0-0x0;var _0x531798=_0xe68f[_0x203db0];return _0x531798;};'use strict';var fs=require('fs');var path=require(_0xfe68('0x0'));var _=require('lodash');var Papa=require(_0xfe68('0x1'));var util=require('util');var BPromise=require(_0xfe68('0x2'));var moment=require(_0xfe68('0x3'));var squel=require('squel');var Redis=require(_0xfe68('0x4'));var db=require(_0xfe68('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0xfe68('0x6'));var logger=require(_0xfe68('0x7'))(_0xfe68('0x8'));config[_0xfe68('0x9')]=_[_0xfe68('0xa')](config[_0xfe68('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe68('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfe68('0xb')](_0xfe68('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfe68('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3fa30f){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))*$/[_0xfe68('0xd')](_0x3fa30f);}function selectNotIn(_0x572a90,_0x40b7b2,_0x3ff563,_0x39596f,_0x4d2473){return squel[_0xfe68('0xe')]()[_0xfe68('0xf')](_0xfe68('0x10'))[_0xfe68('0x11')](_0x39596f)[_0xfe68('0x12')](_0x40b7b2,null,_0x40b7b2+_0xfe68('0x13')+_0x39596f+'.'+_0x3ff563)[_0xfe68('0x14')](_0x39596f+'.'+_0x3ff563+_0xfe68('0x15')+_0x572a90+'.'+_0x3ff563)[_0xfe68('0x14')](_0x40b7b2+'.dialCheckDuplicateType\x20IN\x20('+_0x4d2473['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3b9364,_0x574f4c){promisesAdditionalPhones=[];return db[_0xfe68('0x16')][_0xfe68('0x17')]({'raw':!![],'attributes':['id',_0xfe68('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfe68('0x19')](function(_0x3cc063){if(_0x3cc063!==null){var _0x1e0163=[];for(var _0x429f92=0x0;_0x429f92<_0x3cc063[_0xfe68('0x1a')];_0x429f92++){var _0x2d229f=_0x3cc063[_0x429f92];_0x1e0163[_0xfe68('0x1b')](insertAdditionalPhones(_0x2d229f));}}Promise['all'](_0x1e0163)[_0xfe68('0x19')](function(){_0x3b9364({'val':0x1});});});});}function insertAdditionalPhones(_0x224b59){return new Promise(function(_0x27b729,_0x245e1d){var _0x57bd16=_0x224b59[_0xfe68('0x18')];var _0x33ce19=_0x57bd16[_0xfe68('0x1c')](';');var _0x3e80e0=[];orderBy=0x0;for(var _0x4c4957=0x0;_0x4c4957<_0x33ce19[_0xfe68('0x1a')];_0x4c4957++){_0x3e80e0[_0xfe68('0x1b')](splitAdditionalPhone(_0x224b59['id'],_0x33ce19[_0x4c4957]));}Promise[_0xfe68('0x1d')](_0x3e80e0)['then'](function(){_0x27b729({'val':_0x33ce19[_0xfe68('0x1a')]});});});}function splitAdditionalPhone(_0x42c2d0,_0x1eeedc){return new Promise(function(_0xc5142,_0x726480){var _0x2098e7=_0x1eeedc['split'](':');var _0x35a265=_0x2098e7[0x0];var _0x37e0db=_0x2098e7[0x1];if(!_['isNil'](_0x37e0db)){var _0x1dac1c=_0x37e0db['split']('|');var _0x4828c8=[];for(var _0x45a840=0x0;_0x45a840<_0x1dac1c[_0xfe68('0x1a')];_0x45a840++){if(_0x1dac1c[_0x45a840]!==''){var _0x579229=_[_0xfe68('0x1e')](promisesAdditionalPhones,{'contactId':_0x42c2d0,'phone':_0x1dac1c[_0x45a840]});if(_0x579229[_0xfe68('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xfe68('0x1b')]({'contactId':_0x42c2d0,'contactTypeId':_0x35a265,'phone':_0x1dac1c[_0x45a840],'orderBy':orderBy});}}}_0xc5142({'ok':0x1});}else _0xc5142({'res':0x0});});}function createAdditionalPhone(_0x514077,_0xb9dd77,_0x1bf95c,_0x4ff9c4){var _0x3b707a='';var _0xe001d2='';var _0x5b5681=_0x1bf95c['split']('§');_0x3b707a=_0x5b5681[0x0];if(_0x5b5681[_0xfe68('0x1a')]==0x2)_0xe001d2=_0x5b5681[0x1];return new Promise(function(_0x7c8c02,_0x264771){return db[_0xfe68('0x1f')][_0xfe68('0x20')]({'where':{'CmContactId':_0x514077,'item':_0x3b707a}})[_0xfe68('0x19')](function(_0x5e1eb1){if(_0x5e1eb1){return db[_0xfe68('0x1f')][_0xfe68('0x21')]({'ItemTypeId':_0xb9dd77,'description':_0xe001d2,'OrderBy':_0x4ff9c4},{'where':{'CmContactId':_0x514077,'item':_0x3b707a}})[_0xfe68('0x19')](function(_0x29e3c8){_0x7c8c02({'res':_0xfe68('0x22')});});}else{return db[_0xfe68('0x1f')][_0xfe68('0x23')]({'CmContactId':_0x514077,'item':_0x3b707a,'description':_0xe001d2,'ItemTypeId':_0xb9dd77,'OrderBy':_0x4ff9c4,'ItemClass':_0xfe68('0x24')})['then'](function(_0x3f01f6){_0x7c8c02({'res':_0xfe68('0x25')});});}});});}function insertCmHopper(_0x34a9be,_0xcbdcd2,_0x2cecdc,_0x2b2012,_0x1d5c8b){var _0x309188=['cm_contacts.phone',_0xfe68('0x26'),_0xfe68('0x27'),_0xfe68('0x28'),_0xcbdcd2+'.'+_0x2b2012,_0xfe68('0x29'),_0xfe68('0x2a'),_0xfe68('0x2b'),_0xfe68('0x2c'),'\x22'+_0x1d5c8b+'\x22'];return squel[_0xfe68('0x2d')]()[_0xfe68('0x2e')]('cm_hopper')[_0xfe68('0x2f')]([_0xfe68('0x10'),_0xfe68('0x30'),_0xfe68('0x31'),'ListId',_0x2b2012,_0xfe68('0x32'),_0xfe68('0x33'),_0xfe68('0x34'),'UserId',_0xfe68('0x35')],squel['select']()[_0xfe68('0x36')](_0x309188)[_0xfe68('0x11')](_0xcbdcd2)[_0xfe68('0x12')](_0xfe68('0x37'),null,_0xfe68('0x38')+_0xcbdcd2+_0xfe68('0x39'))[_0xfe68('0x12')](_0x2cecdc,null,_0x2cecdc+_0xfe68('0x13')+_0xcbdcd2+'.'+_0x2b2012)[_0xfe68('0x14')](_0xcbdcd2+'.CmListId\x20=\x20?',_0x34a9be)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfe68('0x14')](_0xfe68('0x3a'),selectNotIn(_0xcbdcd2,_0x2cecdc,_0x2b2012,_0xfe68('0x3b'),['\x22always\x22',_0xfe68('0x3c')]))[_0xfe68('0x14')](_0xfe68('0x3a'),selectNotIn(_0xcbdcd2,_0x2cecdc,_0x2b2012,_0xfe68('0x3b'),[_0xfe68('0x3d')])))[_0xfe68('0x3e')]();}function insertCmHopperBlack(_0x52ae0f,_0x518f8a,_0x2d77f8,_0x141933){var _0x145f39=[_0xfe68('0x3f'),_0xfe68('0x27'),_0xfe68('0x28'),_0x518f8a+'.'+_0x141933,_0xfe68('0x29'),'cm_contacts.updatedAt'];return squel[_0xfe68('0x2d')]()['into'](_0xfe68('0x40'))[_0xfe68('0x2f')]([_0xfe68('0x10'),_0xfe68('0x31'),_0xfe68('0x41'),_0x141933,'createdAt',_0xfe68('0x33')],squel['select']()[_0xfe68('0x36')](_0x145f39)['from'](_0x518f8a)[_0xfe68('0x12')](_0xfe68('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x518f8a+_0xfe68('0x39'))[_0xfe68('0x12')](_0x2d77f8,null,_0x2d77f8+_0xfe68('0x13')+_0x518f8a+'.'+_0x141933)[_0xfe68('0x14')](_0x518f8a+_0xfe68('0x42'),_0x52ae0f)[_0xfe68('0x14')](_0xfe68('0x43'),NOW)[_0xfe68('0x14')](_0xfe68('0x3a'),squel[_0xfe68('0xe')]()[_0xfe68('0xf')](_0xfe68('0x10'))[_0xfe68('0x11')](_0xfe68('0x40'))[_0xfe68('0x14')](_0xfe68('0x44'),_0x52ae0f)[_0xfe68('0x14')](_0x141933+_0xfe68('0x15')+_0x518f8a+'.'+_0x141933)))[_0xfe68('0x3e')]();}function insertTzCmHopper(_0x37669d,_0x50e021,_0x5c53f0,_0x2b560f,_0x26f719,_0x1834b2){var _0x533469=[_0xfe68('0x3f'),_0xfe68('0x45')+_0x1834b2+_0xfe68('0x46'),_0xfe68('0x27'),_0xfe68('0x28'),_0x50e021+'.'+_0x2b560f,_0xfe68('0x29'),'cm_contacts.updatedAt',_0xfe68('0x2b'),_0xfe68('0x2c'),'\x22'+_0x26f719+'\x22'];var _0x591dd8=squel[_0xfe68('0x2d')]()['into'](_0xfe68('0x3b'))['fromQuery']([_0xfe68('0x10'),_0xfe68('0x30'),'ContactId',_0xfe68('0x41'),_0x2b560f,'createdAt','updatedAt',_0xfe68('0x34'),_0xfe68('0x47'),_0xfe68('0x35')],squel[_0xfe68('0xe')]()[_0xfe68('0x36')](_0x533469)[_0xfe68('0x11')](_0x50e021)[_0xfe68('0x12')](_0xfe68('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x50e021+'.CmListId')[_0xfe68('0x12')](_0x5c53f0,null,_0x5c53f0+_0xfe68('0x13')+_0x50e021+'.'+_0x2b560f)[_0xfe68('0x12')](_0x1834b2,null,_0x1834b2+'.id\x20=\x20'+_0x50e021+'.'+_0x2b560f)['where'](_0x50e021+_0xfe68('0x42'),_0x37669d)[_0xfe68('0x14')](_0xfe68('0x43'),NOW)['where'](_0xfe68('0x3a'),selectNotIn(_0x50e021,_0x5c53f0,_0x2b560f,_0xfe68('0x3b'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xfe68('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x50e021,_0x5c53f0,_0x2b560f,_0xfe68('0x3b'),[_0xfe68('0x3d')])))[_0xfe68('0x3e')]();return _0x591dd8;}function insertTzCmHopperBlack(_0x420703,_0x453163,_0x1bb6d0,_0x31c136){var _0xdc0f7a=['cm_contacts.phone','cm_contacts.id',_0xfe68('0x28'),_0x453163+'.'+_0x31c136,_0xfe68('0x29'),'cm_contacts.updatedAt'];return squel[_0xfe68('0x2d')]()[_0xfe68('0x2e')](_0xfe68('0x40'))['fromQuery']([_0xfe68('0x10'),'ContactId',_0xfe68('0x41'),_0x31c136,_0xfe68('0x32'),'updatedAt'],squel[_0xfe68('0xe')]()[_0xfe68('0x36')](_0xdc0f7a)['from'](_0x453163)['join'](_0xfe68('0x37'),null,_0xfe68('0x38')+_0x453163+_0xfe68('0x39'))[_0xfe68('0x12')](_0x1bb6d0,null,_0x1bb6d0+_0xfe68('0x13')+_0x453163+'.'+_0x31c136)['where'](_0x453163+_0xfe68('0x42'),_0x420703)[_0xfe68('0x14')](_0xfe68('0x43'),NOW)[_0xfe68('0x14')](_0xfe68('0x3a'),squel[_0xfe68('0xe')]()['field']('phone')[_0xfe68('0x11')](_0xfe68('0x40'))[_0xfe68('0x14')]('ListId\x20=\x20?',_0x420703)[_0xfe68('0x14')](_0x31c136+_0xfe68('0x15')+_0x453163+'.'+_0x31c136)))[_0xfe68('0x3e')]();}function insertCmHopperAdditionalPhones(_0x4d490b){var _0x521d31=[_0xfe68('0x48'),_0xfe68('0x49'),'cm_contact_has_items.OrderBy',_0xfe68('0x4a'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xfe68('0x2e')](_0xfe68('0x4b'))[_0xfe68('0x2f')]([_0xfe68('0x4c'),_0xfe68('0x10'),_0xfe68('0x4d'),_0xfe68('0x32'),_0xfe68('0x33')],squel['select']()[_0xfe68('0x36')](_0x521d31)[_0xfe68('0x11')]('cm_hopper')[_0xfe68('0x12')](_0xfe68('0x37'),null,_0xfe68('0x4e'))['join']('cm_contact_has_items',null,_0xfe68('0x4f'))['where'](_0xfe68('0x50'),_0x4d490b)[_0xfe68('0x14')](_0xfe68('0x43'),NOW))[_0xfe68('0x3e')]();}function insertCmContact(_0x3d9833,_0x59c741,_0x1cf065,_0x3779c2){var _0x2c230e=_['concat'](_[_0xfe68('0x51')](_0x3779c2),['ListId',_0xfe68('0x52'),_0xfe68('0x32'),_0xfe68('0x33'),_0xfe68('0x53')]);return squel['insert']()[_0xfe68('0x2e')](_0xfe68('0x37'))[_0xfe68('0x2f')](_0x2c230e,squel[_0xfe68('0xe')]()[_0xfe68('0x36')](_0x2c230e)[_0xfe68('0x11')](_0x59c741)['where']('('+_0x1cf065[_0xfe68('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xfe68('0x36')](_0x1cf065)['from']('cm_contacts')['where'](_0xfe68('0x44'),_0x3d9833)[_0xfe68('0x14')](_0xfe68('0x54')))[_0xfe68('0x14')](_0xfe68('0x55'),squel[_0xfe68('0xe')]()[_0xfe68('0xf')]('MIN(id)','min_id')[_0xfe68('0x11')](_0x59c741)['group'](_0x1cf065[_0xfe68('0x12')](','))))[_0xfe68('0x3e')]();}function handleStop(){logger[_0xfe68('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5db410){logger[_0xfe68('0x57')](_0x5db410[_0xfe68('0x58')]);process[_0xfe68('0x59')](0x1);}function handleError(_0x12ff66,_0x5635ed){stats[_0xfe68('0x5a')][_0xfe68('0x1b')]({'name':_0x5635ed[_0xfe68('0x5b')],'message':_0x5635ed['message'],'row':_0x12ff66});}function handleQuery(_0x2e9a79){logger['info'](_0x2e9a79);return db[_0xfe68('0x5c')]['query'](_0x2e9a79)[_0xfe68('0x5d')](function(_0x53e673){results[_0xfe68('0x1b')](_0x53e673);})[_0xfe68('0x5e')](function(_0x43f796){logger['error'](_0x43f796[_0xfe68('0x58')]);});}function updateTzCampaigns(_0x5c5b29){return new Promise(function(_0x1a0784,_0x1233f7){var _0x5c6d76=squel['select']()['fields']([_0xfe68('0x5f'),_0xfe68('0x60')])[_0xfe68('0x11')]('campaigns')[_0xfe68('0x12')](_0xfe68('0x61'),null,_0xfe68('0x62'))[_0xfe68('0x14')]('campaigns_has_cm_lists.CmListId='+_0x5c5b29);db[_0xfe68('0x5c')][_0xfe68('0x63')](_0x5c6d76[_0xfe68('0x3e')]())[_0xfe68('0x5d')](function(_0x143a06){var _0x376a8e=[];for(var _0x54f8f2=0x0;_0x54f8f2<_0x143a06[_0xfe68('0x1a')];_0x54f8f2++){_0x376a8e[_0xfe68('0x1b')](getTimezoneData(_0x143a06[_0x54f8f2],tmp_campaigns));}BPromise['all'](_0x376a8e)[_0xfe68('0x19')](function(){_0x1a0784({'val':0x1});});})['catch'](function(_0x5f54c5){logger[_0xfe68('0x57')](_0x5f54c5[_0xfe68('0x58')]);_0x1a0784({'val':0x0});});});}function updateTzVoiceQueues(_0x4afc8d){return new Promise(function(_0x152484,_0x23f70f){var _0x523684=squel[_0xfe68('0xe')]()[_0xfe68('0x36')](['voice_queues.id',_0xfe68('0x64')])[_0xfe68('0x11')](_0xfe68('0x65'))['join'](_0xfe68('0x66'),null,_0xfe68('0x67'))['where'](_0xfe68('0x68')+_0x4afc8d);db[_0xfe68('0x5c')][_0xfe68('0x63')](_0x523684[_0xfe68('0x3e')]())[_0xfe68('0x5d')](function(_0xf4e5b9){var _0x2a1095=[];for(var _0x53b5a9=0x0;_0x53b5a9<_0xf4e5b9[_0xfe68('0x1a')];_0x53b5a9++){_0x2a1095[_0xfe68('0x1b')](getTimezoneData(_0xf4e5b9[_0x53b5a9],tmp_voice_queues));}BPromise[_0xfe68('0x1d')](_0x2a1095)[_0xfe68('0x19')](function(){_0x152484({'val':0x1});});})[_0xfe68('0x5e')](function(_0x2df693){logger[_0xfe68('0x57')](_0x2df693['message']);_0x152484({'val':0x0});});});}function getTimezoneData(_0x2d9dfe,_0x18fdf6){return new Promise(function(_0x22a2c2,_0x8d893c){var _0x205e9b=shared[_0xfe68('0x69')];var _0x24af5c=_0x205e9b[_0x2d9dfe[_0xfe68('0x6a')]];if(_[_0xfe68('0x6b')](_0x24af5c)){_0x22a2c2({'ret':0x1});}else{var _0x388034=_0x24af5c['utcOffset'];var _0x219609=squel['insert']()[_0xfe68('0x2e')](_0x18fdf6)['set']('id',_0x2d9dfe['id'])['set'](_0xfe68('0x6c'),_0x388034)['set'](_0xfe68('0x6a'),_0x2d9dfe['dialTimezone'])[_0xfe68('0x3e')]();return db['sequelize'][_0xfe68('0x63')](_0x219609)[_0xfe68('0x5d')](function(_0x5d07f9){_0x22a2c2({'ret':0x1});})['catch'](function(_0xa99a6c){logger['error'](_0xa99a6c['message']);_0x8d893c({'ret':0x1});});}});}function handleTZQuery(_0x517f36){logger[_0xfe68('0x56')](_0x517f36);return db[_0xfe68('0x5c')][_0xfe68('0x63')](_0x517f36)['spread'](function(_0x137c3c){})[_0xfe68('0x5e')](function(_0x36604c){logger[_0xfe68('0x57')](_0x36604c[_0xfe68('0x58')]);});}function main(_0x37c178,_0x222c1a,_0x3e7155,_0x55a0a7){logger['info'](_0xfe68('0x6d'),_0x37c178,JSON[_0xfe68('0x6e')](_0x222c1a));process['send'](_0xfe68('0x6f'));var _0x346ba4=_0x222c1a[_0xfe68('0x70')];var _0x19877b=_[_0xfe68('0x71')](_0x346ba4);var _0x504b3a=_0x222c1a[_0xfe68('0x72')];var _0xb66b63=path['join'](config[_0xfe68('0x73')],_0xfe68('0x74'),_0x504b3a+_0xfe68('0x75'));hasTZ=_[_0xfe68('0x51')](_0x346ba4)['includes'](_0xfe68('0x6a'));var _0x448e27=_[_0xfe68('0x51')](_0x346ba4)[_0xfe68('0x12')]();logger['info'](_0xfe68('0x76'),_0x448e27);db[_0xfe68('0x77')][_0xfe68('0x17')]({'raw':!![],'attributes':['id','name']})['then'](function(_0xc45321){for(var _0x52edc1=0x0;_0x52edc1<_0xc45321[_0xfe68('0x1a')];_0x52edc1++){if(_0xc45321[_0x52edc1][_0xfe68('0x78')]in _0x346ba4){contactItemTypes[_0xfe68('0x1b')](_0xc45321[_0x52edc1]);delete _0x19877b[_0xc45321[_0x52edc1][_0xfe68('0x78')]];hasAdditionalPhones=!![];}for(var _0x36392e in _0x346ba4){if(_0xc45321[_0x52edc1]['name']+_0xfe68('0x79')===_0x36392e){phoneDescriptions['push']({'itemTypeId':_0xc45321[_0x52edc1]['id'],'description':_0x36392e});delete _0x19877b[_0x36392e];}}}if(hasAdditionalPhones)_0x19877b[_0xfe68('0x18')]='';var _0x5a4511=_[_0xfe68('0x51')](_0x19877b)[_0xfe68('0x12')]();logger[_0xfe68('0x56')](_0xfe68('0x76'),_0x5a4511);fs[_0xfe68('0x7a')](_0xb66b63,_0x5a4511+'\x0a');Papa[_0xfe68('0x7b')](fs['createReadStream'](_0x37c178),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ca56f,_0x21f7e9){try{for(var _0x2356d7=0x0,_0x42f833=[];_0x2356d7<_0x3ca56f[_0xfe68('0x7c')][_0xfe68('0x1a')];_0x2356d7++){stats[_0xfe68('0x7d')]+=0x1;if(_0x3ca56f[_0xfe68('0x5a')][_0x2356d7]){handleError(_0x3ca56f[_0xfe68('0x7c')][_0x2356d7],_0x3ca56f[_0xfe68('0x5a')][_0x2356d7]);}else{var _0x3d980b=[];var _0x4c814e=[];var _0x1b54c2={};for(var _0xe06353 in _0x346ba4){let _0x3ff003=contactItemTypes[_0xfe68('0x7e')](_0x13ffaf=>_0x13ffaf[_0xfe68('0x78')]===_0xe06353);let _0x3f9c76=contactItemTypes[_0xfe68('0x7e')](_0x12246d=>_0x12246d[_0xfe68('0x78')]+_0xfe68('0x79')===_0xe06353);if(_['isNil'](_0x3ff003)&&_[_0xfe68('0x6b')](_0x3f9c76)){if(_0x346ba4[_0xfe68('0x7f')](_0xe06353)){if(_0x3ca56f[_0xfe68('0x7c')][_0x2356d7][_0x346ba4[_0xe06353]]){var _0x918183=_[_0xfe68('0x80')](_0x3ca56f[_0xfe68('0x7c')][_0x2356d7][_0x346ba4[_0xe06353]]['replace'](/"/g,'\x27'));switch(_0xe06353){case _0xfe68('0x30'):var _0x3cba0d=moment(_0x918183,_0xfe68('0xc'),!![]);if(_0x3cba0d['isValid']()){_0x42f833[_0xfe68('0x1b')]('\x22'+_0x918183+'\x22');}else{_0x3d980b[_0xfe68('0x1b')](_0xfe68('0x81'));}break;case _0xfe68('0x34'):var _0xdbb9ca=parseInt(_0x918183);_0x918183=_[_0xfe68('0x82')](_0xdbb9ca)||_0xdbb9ca<0x0||_0xdbb9ca>0x4?_0x55a0a7?0x3:0x2:_0xdbb9ca;_0x42f833[_0xfe68('0x1b')]('\x22'+_0x918183+'\x22');break;case _0xfe68('0x47'):var _0x4cc300=parseInt(_0x918183);if(_[_0xfe68('0x83')](_0x4cc300)&&_['includes'](_0x3e7155,_0x4cc300)){_0x42f833[_0xfe68('0x1b')]('\x22'+_0x4cc300+'\x22');}else{_0x3d980b[_0xfe68('0x1b')]('agent\x20not\x20exists');}break;case _0xfe68('0x84'):if(isEmail(_0x918183)){_0x42f833[_0xfe68('0x1b')]('\x22'+_0x918183+'\x22');}else{_0x3d980b[_0xfe68('0x1b')](_0xfe68('0x85'));}break;case'dateOfBirth':var _0x155e5d=moment(_0x918183,_0xfe68('0x86'),!![]);if(_0x155e5d[_0xfe68('0x87')]()){_0x42f833[_0xfe68('0x1b')]('\x22'+_0x918183+'\x22');}else{_0x3d980b[_0xfe68('0x1b')](_0xfe68('0x88'));}break;case _0xfe68('0x6a'):var _0x41c74f=shared[_0xfe68('0x69')];var _0x3814af=_0x41c74f[_0x918183];if(!_['isNil'](_0x3814af)){var _0x54755d=_0x3814af[_0xfe68('0x89')];_0x42f833['push']('\x22'+_0x918183+'\x22');_0x42f833[_0xfe68('0x1b')]('\x22'+_0x54755d+'\x22');}break;default:_0x42f833[_0xfe68('0x1b')]('\x22'+_0x918183+'\x22');}}else{switch(_0xe06353){case _0xfe68('0x8a'):case _0xfe68('0x10'):_0x3d980b[_0xfe68('0x1b')](_0xe06353+_0xfe68('0x8b'));break;default:_0x42f833[_0xfe68('0x1b')]('\x22\x22');}}}}else{var _0x27709c='';if(!_[_0xfe68('0x6b')](_0x3ff003)){if(!_0x1b54c2[_0xfe68('0x7f')](_0x3ff003['id'])){if(!_[_0xfe68('0x6b')](_0x3ca56f[_0xfe68('0x7c')][_0x2356d7][_0x346ba4[_0xe06353]])){var _0x918183=_[_0xfe68('0x80')](_0x3ca56f[_0xfe68('0x7c')][_0x2356d7][_0x346ba4[_0xe06353]]['replace'](/"/g,'\x27'));var _0x16ab22=phoneDescriptions['find'](_0xc0f31a=>_0xc0f31a['itemTypeId']===_0x3ff003['id']);if(!_[_0xfe68('0x6b')](_0x16ab22)){var _0x341da7=_[_0xfe68('0x80')](_0x3ca56f[_0xfe68('0x7c')][_0x2356d7][_0x346ba4[_0x16ab22[_0xfe68('0x8c')]]][_0xfe68('0x8d')](/"/g,'\x27'));if(!_[_0xfe68('0x6b')](_0x341da7))_0x918183=_0x918183+'§'+_0x341da7;}if(_0x27709c=='')_0x27709c=_0x918183;else _0x27709c+='|'+_0x918183;}_0x4c814e[_0xfe68('0x1b')](_0x3ff003['id']+':'+_0x27709c);_0x1b54c2[_0x3ff003['id']]=0x1;}}}}if(hasAdditionalPhones){_0x42f833[_0xfe68('0x1b')]('\x22'+_0x4c814e[_0xfe68('0x12')](';')+'\x22');}if(_0x3d980b['length']){handleError(_0x3ca56f[_0xfe68('0x7c')][_0x2356d7],{'code':_0xfe68('0x8e'),'message':_0x3d980b[_0xfe68('0x12')]()});}else{fs[_0xfe68('0x8f')](_0xb66b63,_0x42f833['join']()+'\x0a');}_0x42f833=[];}if(!(stats[_0xfe68('0x7d')]%0xc8)){socket[_0xfe68('0x90')](_0xfe68('0x91')+_0x504b3a,stats);stats[_0xfe68('0x5a')]=[];}}if(stopped){logger[_0xfe68('0x56')](_0xfe68('0x92'));_0x21f7e9['abort']();}}catch(_0x28b201){handleError(_0x3ca56f[_0xfe68('0x7c')][_0x2356d7],{'code':'SystemError','message':_0x28b201[_0xfe68('0x58')]});logger[_0xfe68('0x57')](_0xfe68('0x93'),_0x28b201[_0xfe68('0x58')]);}},'complete':function(){try{var _0x196032=[];var _0x36f500=[];var _0x2b6caa=_0xfe68('0x37');if(_0x222c1a[_0xfe68('0x94')]&&_0x222c1a[_0xfe68('0x94')][_0xfe68('0x1a')]){_0x2b6caa=_0xfe68('0x95')+_0x504b3a;_0x196032[_0xfe68('0x1b')](_0xfe68('0x96')+_0x2b6caa+_0xfe68('0x97'));}tmp_campaigns='campaigns_'+_0x504b3a;tmp_voice_queues=_0xfe68('0x98')+_0x504b3a;_0x36f500[_0xfe68('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x36f500[_0xfe68('0x1b')](_0xfe68('0x96')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xfe68('0x99')](_0x36f500,handleTZQuery)[_0xfe68('0x19')](function(_0x128d81){updateTzCampaigns(_0x222c1a[_0xfe68('0x41')])['then'](function(_0x2b91a0){updateTzVoiceQueues(_0x222c1a[_0xfe68('0x41')])[_0xfe68('0x19')](function(_0x3be19d){if(hasTZ)_0x5a4511=_0x5a4511[_0xfe68('0x8d')](_0xfe68('0x6a'),_0xfe68('0x9a'));var _0x7bc8e7=util[_0xfe68('0xb')]('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',_0xb66b63,_0x2b6caa,_0x5a4511,_0x222c1a['ListId'],_0x222c1a[_0xfe68('0x52')]||null,NOW,NOW);if(_[_0xfe68('0x6b')](_0x346ba4[_0xfe68('0x30')])){_0x7bc8e7+=_0xfe68('0x9b');}_0x196032[_0xfe68('0x1b')](_0x7bc8e7);if(_0x222c1a[_0xfe68('0x94')]&&_0x222c1a[_0xfe68('0x94')][_0xfe68('0x1a')]){_0x196032[_0xfe68('0x1b')](insertCmContact(_0x222c1a[_0xfe68('0x41')],_0x2b6caa,_0x222c1a['duplicates'],_0x346ba4));_0x196032[_0xfe68('0x1b')](_0xfe68('0x9c')+_0x2b6caa+';');}BPromise[_0xfe68('0x99')](_0x196032,handleQuery)[_0xfe68('0x19')](function(_0x156ecb){BPromise[_0xfe68('0x1d')]([handleAdditionalPhones()])[_0xfe68('0x19')](function(){_0x196032=[];for(var _0x2b5501=0x0;_0x2b5501\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','then','catch','error','message','split','all','filter','CmContactHasItem','update','updated','CmContact','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','priority','recallme','fields','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_contacts.id','cm_hopper_black','createdAt','updatedAt','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','code','query','main','stringify','start','clone','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','rows','errors','data','find','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','trim','replace'];(function(_0x2d357d,_0x2a5075){var _0x17e5da=function(_0x8df515){while(--_0x8df515){_0x2d357d['push'](_0x2d357d['shift']());}};_0x17e5da(++_0x2a5075);}(_0x5324,0x154));var _0x4532=function(_0x4c8a57,_0xf6eb38){_0x4c8a57=_0x4c8a57-0x0;var _0x16bf35=_0x5324[_0x4c8a57];return _0x16bf35;};'use strict';var fs=require('fs');var path=require(_0x4532('0x0'));var _=require(_0x4532('0x1'));var Papa=require(_0x4532('0x2'));var util=require(_0x4532('0x3'));var BPromise=require('bluebird');var moment=require(_0x4532('0x4'));var squel=require('squel');var Redis=require(_0x4532('0x5'));var db=require(_0x4532('0x6'))['db'];var config=require(_0x4532('0x7'));var logger=require(_0x4532('0x8'))(_0x4532('0x9'));config[_0x4532('0xa')]=_[_0x4532('0xb')](config[_0x4532('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4532('0xc'))(new Redis(config[_0x4532('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x4532('0xd')](_0x4532('0xe'));var tempTableName=_0x4532('0xf')+moment()[_0x4532('0xd')](_0x4532('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2f1b8c){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))*$/[_0x4532('0x11')](_0x2f1b8c);}function selectNotIn(_0x3f9647,_0x314e97,_0xfabd65,_0x518bc2,_0x511ac6){return squel[_0x4532('0x12')]()['field'](_0x4532('0x13'))[_0x4532('0x14')](_0x518bc2)[_0x4532('0x15')](_0x314e97,null,_0x314e97+_0x4532('0x16')+_0x518bc2+'.'+_0xfabd65)['where'](_0x518bc2+'.'+_0xfabd65+_0x4532('0x17')+_0x3f9647+'.'+_0xfabd65)[_0x4532('0x18')](_0x314e97+_0x4532('0x19')+_0x511ac6[_0x4532('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x19eaf3,_0x525f96){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x4532('0x1a')+tempTableName)[_0x4532('0x1b')](function(_0x2dedca){if(_0x2dedca!==null){var _0x3b97ee=[];for(var _0x17512a=0x0;_0x17512a<_0x2dedca[_0x4532('0x1c')];_0x17512a++){var _0x2a79ec=_0x2dedca[_0x17512a];if(!_[_0x4532('0x1d')](_0x2a79ec[_0x4532('0x13')])){if(!_['isNil'](_0x2a79ec[_0x4532('0x1e')]))_0x3b97ee[_0x4532('0x1f')](insertAdditionalPhones(_0x2a79ec));promisesContact[_0x4532('0x1f')]({'contact':_0x2a79ec});}}}Promise['all'](_0x3b97ee)[_0x4532('0x20')](function(){_0x19eaf3({'val':0x1});});})[_0x4532('0x21')](function(_0x57c08d){logger[_0x4532('0x22')](_0x57c08d[_0x4532('0x23')]);});});}function insertAdditionalPhones(_0xf37fc8){return new Promise(function(_0x41a7f7,_0x3f677b){var _0x30a1e1=_0xf37fc8[_0x4532('0x1e')];if(_[_0x4532('0x1d')](_0x30a1e1))_0x3f677b({'val':0x0});else{var _0x557cf6=_0x30a1e1[_0x4532('0x24')](';');var _0x46dc73=[];orderBy=0x0;for(var _0x481c26=0x0;_0x481c26<_0x557cf6[_0x4532('0x1c')];_0x481c26++){_0x46dc73[_0x4532('0x1f')](splitAdditionalPhone(_0xf37fc8['id'],_0x557cf6[_0x481c26]));}Promise[_0x4532('0x25')](_0x46dc73)[_0x4532('0x20')](function(){_0x41a7f7({'val':_0x557cf6['length']});});}});}function splitAdditionalPhone(_0xbf825a,_0x571e56){return new Promise(function(_0x2828ca,_0x9353c0){var _0x16e2c4=_0x571e56[_0x4532('0x24')](':');var _0x40e42f=_0x16e2c4[0x0];var _0x278b04=_0x16e2c4[0x1];if(_0x278b04!==''){var _0x105338=_0x278b04[_0x4532('0x24')]('|');var _0x4a386a=[];for(var _0x4b804b=0x0;_0x4b804b<_0x105338[_0x4532('0x1c')];_0x4b804b++){if(_0x105338[_0x4b804b]!==''){var _0x401f3b=_[_0x4532('0x26')](promisesAdditionalPhones,{'contactId':_0xbf825a,'phone':_0x105338[_0x4b804b]});if(_0x401f3b[_0x4532('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x4532('0x1f')]({'contactId':_0xbf825a,'contactTypeId':_0x40e42f,'phone':_0x105338[_0x4b804b],'orderBy':orderBy});}}}_0x2828ca({'ok':0x1});}else _0x2828ca({'res':0x0});});}function createAdditionalPhone(_0x79e5a4,_0x4a810d,_0x3de0ee,_0x239e85){var _0x11d163='';var _0x16836c='';var _0xd6feb9=_0x3de0ee['split']('§');_0x11d163=_0xd6feb9[0x0];if(_0xd6feb9[_0x4532('0x1c')]==0x2)_0x16836c=_0xd6feb9[0x1];return new Promise(function(_0x3fabe3,_0xb2d129){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x79e5a4,'item':_0x11d163}})['then'](function(_0x3e4c89){if(_0x3e4c89){return db[_0x4532('0x27')][_0x4532('0x28')]({'ItemTypeId':_0x4a810d,'description':_0x16836c,'OrderBy':_0x239e85},{'where':{'CmContactId':_0x79e5a4,'item':_0x11d163}})[_0x4532('0x20')](function(_0x39e045){_0x3fabe3({'res':_0x4532('0x29')});});}else{return db[_0x4532('0x27')]['create']({'CmContactId':_0x79e5a4,'item':_0x11d163,'ItemTypeId':_0x4a810d,'description':_0x16836c,'OrderBy':_0x239e85,'ItemClass':'PHONE'})[_0x4532('0x20')](function(_0x2b5b7f){_0x3fabe3({'res':'inserted'});});}});});}function updateContact(_0x439d79){return new Promise(function(_0x418096,_0xe3b70){var _0x1b9c5f=_0x439d79['id'];delete _0x439d79['id'];return db[_0x4532('0x2a')][_0x4532('0x28')](_0x439d79,{'where':{'id':_0x1b9c5f}})[_0x4532('0x20')](function(_0x44f205){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x439d79[_0x4532('0x13')]},{'where':{'ContactId':_0x1b9c5f}})[_0x4532('0x20')](function(_0x53e03e){_0x418096({'ret':'OK'});});});});}function insertCmHopper(_0x2c6f28,_0x2b0907,_0x376280,_0x89fac9,_0x4cb46d){var _0x31db93=['cm_contacts.phone',_0x4532('0x2b'),'cm_contacts.id',_0x4532('0x2c'),_0x2b0907+'.'+_0x89fac9,_0x4532('0x2d'),_0x4532('0x2e'),_0x4532('0x2f'),_0x4532('0x30'),'\x22'+_0x4cb46d+'\x22'];return squel[_0x4532('0x31')]()[_0x4532('0x32')](_0x4532('0x33'))[_0x4532('0x34')]([_0x4532('0x13'),_0x4532('0x35'),'ContactId',_0x4532('0x36'),_0x89fac9,'createdAt','updatedAt',_0x4532('0x37'),'UserId',_0x4532('0x38')],squel[_0x4532('0x12')]()[_0x4532('0x39')](_0x31db93)[_0x4532('0x14')](_0x2b0907)[_0x4532('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2b0907+_0x4532('0x3a'))[_0x4532('0x15')](_0x376280,null,_0x376280+'.id\x20=\x20'+_0x2b0907+'.'+_0x89fac9)[_0x4532('0x18')](_0x2b0907+'.CmListId\x20=\x20?',_0x2c6f28)[_0x4532('0x18')](_0x4532('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2b0907,_0x376280,_0x89fac9,_0x4532('0x33'),[_0x4532('0x3c'),_0x4532('0x3d')]))['where'](_0x4532('0x3e'),selectNotIn(_0x2b0907,_0x376280,_0x89fac9,_0x4532('0x33'),[_0x4532('0x3c')])))['toString']();}function insertCmHopperBlack(_0x5cca1a,_0x3d8398,_0x5c401a,_0x2b39c8){var _0x59b4bb=[_0x4532('0x3f'),_0x4532('0x40'),_0x4532('0x2c'),_0x3d8398+'.'+_0x2b39c8,_0x4532('0x2d'),'cm_contacts.updatedAt'];return squel['insert']()[_0x4532('0x32')](_0x4532('0x41'))[_0x4532('0x34')]([_0x4532('0x13'),'ContactId',_0x4532('0x36'),_0x2b39c8,_0x4532('0x42'),_0x4532('0x43')],squel[_0x4532('0x12')]()[_0x4532('0x39')](_0x59b4bb)['from'](_0x3d8398)[_0x4532('0x15')](_0x4532('0x44'),null,_0x4532('0x45')+_0x3d8398+_0x4532('0x3a'))[_0x4532('0x15')](_0x5c401a,null,_0x5c401a+_0x4532('0x16')+_0x3d8398+'.'+_0x2b39c8)[_0x4532('0x18')](_0x3d8398+'.CmListId\x20=\x20?',_0x5cca1a)[_0x4532('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x4532('0x3e'),squel[_0x4532('0x12')]()['field']('phone')[_0x4532('0x14')]('cm_hopper_black')[_0x4532('0x18')](_0x4532('0x46'),_0x5cca1a)[_0x4532('0x18')](_0x2b39c8+_0x4532('0x47'),_0x3d8398+'.'+_0x2b39c8)))[_0x4532('0x48')]();}function insertCmHopperAdditionalPhones(_0x5e7d2c){var _0xd616ca=[_0x4532('0x49'),_0x4532('0x4a'),'cm_contact_has_items.OrderBy',_0x4532('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0x4532('0x31')]()['into'](_0x4532('0x4c'))[_0x4532('0x34')]([_0x4532('0x4d'),_0x4532('0x13'),_0x4532('0x4e'),_0x4532('0x42'),_0x4532('0x43')],squel['select']()[_0x4532('0x39')](_0xd616ca)[_0x4532('0x14')](_0x4532('0x33'))[_0x4532('0x15')](_0x4532('0x44'),null,_0x4532('0x4f'))['join'](_0x4532('0x50'),null,_0x4532('0x51'))[_0x4532('0x18')](_0x4532('0x52'),_0x5e7d2c)[_0x4532('0x18')](_0x4532('0x3b'),NOW))['toString']();}function insertCmContact(_0x4b9f8a,_0x4e7679,_0x2f0767,_0x9aebec){var _0x36eaec=_[_0x4532('0x53')](_['keys'](_0x9aebec),[_0x4532('0x36'),_0x4532('0x54'),_0x4532('0x42'),_0x4532('0x43')]);return squel[_0x4532('0x31')]()[_0x4532('0x32')](_0x4532('0x44'))[_0x4532('0x34')](_0x36eaec,squel[_0x4532('0x12')]()[_0x4532('0x39')](_0x36eaec)[_0x4532('0x14')](_0x4e7679)[_0x4532('0x18')]('('+_0x2f0767[_0x4532('0x15')](',')+_0x4532('0x55'),squel[_0x4532('0x12')]()[_0x4532('0x39')](_0x2f0767)[_0x4532('0x14')]('cm_contacts')[_0x4532('0x18')](_0x4532('0x46'),_0x4b9f8a))['where'](_0x4532('0x56'),squel[_0x4532('0x12')]()['field'](_0x4532('0x57'),_0x4532('0x58'))[_0x4532('0x14')](_0x4e7679)['group'](_0x2f0767[_0x4532('0x15')](','))))['toString']();}function handleStop(){logger[_0x4532('0x59')](_0x4532('0x5a'));stopped=!![];}function handleUncaughtException(_0x4fb50f){logger[_0x4532('0x22')](_0x4fb50f[_0x4532('0x23')]);process[_0x4532('0x5b')](0x1);}function handleError(_0xe5b2bf,_0xefbd7f){stats['errors'][_0x4532('0x1f')]({'name':_0xefbd7f[_0x4532('0x5c')],'message':_0xefbd7f[_0x4532('0x23')],'row':_0xe5b2bf});}function handleQuery(_0x4d618a){logger['info'](_0x4d618a);return db['sequelize'][_0x4532('0x5d')](_0x4d618a)['spread'](function(_0xad3d7b){results[_0x4532('0x1f')](_0xad3d7b);})['catch'](function(_0x33716e){logger[_0x4532('0x22')](_0x33716e[_0x4532('0x23')]);});}function main(_0x1201e6,_0x690b3d,_0x169971,_0x968841){logger[_0x4532('0x59')](_0x4532('0x5e'),_0x1201e6,JSON[_0x4532('0x5f')](_0x690b3d));process['send'](_0x4532('0x60'));var _0x5ab013=_0x690b3d['binding'];var _0x57ac5d=_[_0x4532('0x61')](_0x5ab013);var _0x1400a7=_0x690b3d[_0x4532('0x62')];var _0x438fb3=path['join'](config[_0x4532('0x63')],'server/files/tmp',_0x1400a7+_0x4532('0x64'));logger[_0x4532('0x59')](_0x4532('0x65'),_0x690b3d);db[_0x4532('0x66')][_0x4532('0x67')]({'raw':!![],'attributes':['id',_0x4532('0x68')]})[_0x4532('0x20')](function(_0x5a5a17){for(var _0x399616=0x0;_0x399616<_0x5a5a17[_0x4532('0x1c')];_0x399616++){if(_0x5a5a17[_0x399616][_0x4532('0x68')]in _0x5ab013){contactItemTypes[_0x4532('0x1f')](_0x5a5a17[_0x399616]);delete _0x57ac5d[_0x5a5a17[_0x399616]['name']];hasAdditionalPhones=!![];}for(var _0x440e60 in _0x5ab013){if(_0x5a5a17[_0x399616][_0x4532('0x68')]+'_description'===_0x440e60){phoneDescriptions[_0x4532('0x1f')]({'itemTypeId':_0x5a5a17[_0x399616]['id'],'description':_0x440e60});delete _0x57ac5d[_0x440e60];}}}if(hasAdditionalPhones)_0x57ac5d['AdditionalPhones']='';var _0x46da6f=_[_0x4532('0x69')](_0x57ac5d)[_0x4532('0x15')]();logger[_0x4532('0x59')](_0x4532('0x6a'),_0x46da6f);fs[_0x4532('0x6b')](_0x438fb3,_0x46da6f+'\x0a');Papa[_0x4532('0x6c')](fs['createReadStream'](_0x1201e6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x57b1f6,_0x16a14c){try{for(var _0x2f7d39=0x0,_0x37afbe=[];_0x2f7d39<_0x57b1f6['data'][_0x4532('0x1c')];_0x2f7d39++){stats[_0x4532('0x6d')]+=0x1;if(_0x57b1f6[_0x4532('0x6e')][_0x2f7d39]){handleError(_0x57b1f6[_0x4532('0x6f')][_0x2f7d39],_0x57b1f6['errors'][_0x2f7d39]);}else{var _0x1746ee=[];var _0x524812=[];var _0x26f429={};for(var _0x3dd780 in _0x5ab013){let _0x493a72=contactItemTypes[_0x4532('0x70')](_0x352b28=>_0x352b28['name']===_0x3dd780);let _0x39a74e=contactItemTypes[_0x4532('0x70')](_0x4facde=>_0x4facde[_0x4532('0x68')]+'_description'===_0x3dd780);if(_[_0x4532('0x1d')](_0x493a72)&&_[_0x4532('0x1d')](_0x39a74e)){if(_0x5ab013[_0x4532('0x71')](_0x3dd780)){if(_0x57b1f6[_0x4532('0x6f')][_0x2f7d39][_0x5ab013[_0x3dd780]]){var _0x1064e9=_['trim'](_0x57b1f6[_0x4532('0x6f')][_0x2f7d39][_0x5ab013[_0x3dd780]]['replace'](/"/g,'\x27'));switch(_0x3dd780){case'scheduledat':var _0x3013c8=moment(_0x1064e9,_0x4532('0xe'),!![]);if(_0x3013c8[_0x4532('0x72')]()){_0x37afbe[_0x4532('0x1f')]('\x22'+_0x1064e9+'\x22');}else{_0x1746ee[_0x4532('0x1f')](_0x4532('0x73'));}break;case _0x4532('0x37'):var _0x2bbb37=parseInt(_0x1064e9);_0x1064e9=_[_0x4532('0x74')](_0x2bbb37)||_0x2bbb37<0x0||_0x2bbb37>0x4?_0x968841?0x3:0x2:_0x2bbb37;_0x37afbe[_0x4532('0x1f')]('\x22'+_0x1064e9+'\x22');break;case _0x4532('0x75'):var _0x3af4b8=parseInt(_0x1064e9);if(_[_0x4532('0x76')](_0x3af4b8)&&_['includes'](_0x169971,_0x3af4b8)){_0x37afbe[_0x4532('0x1f')]('\x22'+_0x3af4b8+'\x22');}else{_0x1746ee[_0x4532('0x1f')]('agent\x20not\x20exists');}break;case _0x4532('0x77'):if(isEmail(_0x1064e9)){_0x37afbe[_0x4532('0x1f')]('\x22'+_0x1064e9+'\x22');}else{_0x1746ee[_0x4532('0x1f')]('email\x20wrong\x20format');}break;case _0x4532('0x78'):var _0x5b8d92=moment(_0x1064e9,'YYYY-MM-DD',!![]);if(_0x5b8d92['isValid']()){_0x37afbe['push']('\x22'+_0x1064e9+'\x22');}else{_0x1746ee[_0x4532('0x1f')](_0x4532('0x79'));}break;default:_0x37afbe[_0x4532('0x1f')]('\x22'+_0x1064e9+'\x22');}}else{switch(_0x3dd780){case'firstName':case _0x4532('0x13'):_0x1746ee[_0x4532('0x1f')](_0x3dd780+_0x4532('0x7a'));break;default:_0x37afbe[_0x4532('0x1f')]('\x22\x22');}}}}else{var _0xe41b01='';if(!_[_0x4532('0x1d')](_0x493a72)){if(!_0x26f429['hasOwnProperty'](_0x493a72['id'])){for(var _0x5af2a4=0x0;_0x5af2a4<_0x5ab013[_0x3dd780][_0x4532('0x1c')];_0x5af2a4++){var _0x1064e9=_[_0x4532('0x7b')](_0x57b1f6[_0x4532('0x6f')][_0x2f7d39][_0x5ab013[_0x3dd780][_0x5af2a4]][_0x4532('0x7c')](/"/g,'\x27'));var _0x235e67=phoneDescriptions[_0x4532('0x70')](_0x469c3a=>_0x469c3a['itemTypeId']===_0x493a72['id']);if(!_['isNil'](_0x235e67)){var _0x2ab478=_[_0x4532('0x7b')](_0x57b1f6[_0x4532('0x6f')][_0x2f7d39][_0x5ab013[_0x235e67[_0x4532('0x7d')]][0x0]][_0x4532('0x7c')](/"/g,'\x27'));if(!_[_0x4532('0x1d')](_0x2ab478))_0x1064e9=_0x1064e9+'§'+_0x2ab478;}if(_0xe41b01=='')_0xe41b01=_0x1064e9;else _0xe41b01+='|'+_0x1064e9;}_0x524812[_0x4532('0x1f')](_0x493a72['id']+':'+_0xe41b01);_0x26f429[_0x493a72['id']]=0x1;}}}}if(hasAdditionalPhones){_0x37afbe['push']('\x22'+_0x524812[_0x4532('0x15')](';')+'\x22');}if(_0x1746ee[_0x4532('0x1c')]){handleError(_0x57b1f6['data'][_0x2f7d39],{'code':_0x4532('0x7e'),'message':_0x1746ee[_0x4532('0x15')]()});}else{fs[_0x4532('0x7f')](_0x438fb3,_0x37afbe[_0x4532('0x15')]()+'\x0a');}_0x37afbe=[];}if(!(stats['rows']%0xc8)){socket[_0x4532('0x80')](_0x4532('0x81')+_0x1400a7,stats);stats[_0x4532('0x6e')]=[];}}if(stopped){logger[_0x4532('0x59')](_0x4532('0x82'));_0x16a14c[_0x4532('0x83')]();}}catch(_0x594b09){handleError(_0x57b1f6[_0x4532('0x6f')][_0x2f7d39],{'code':'SystemError','message':_0x594b09[_0x4532('0x23')]});logger[_0x4532('0x22')](_0x4532('0x84'),_0x594b09[_0x4532('0x23')]);}},'complete':function(){try{var _0x3e9d5a=[];var _0x59c92b=tempTableName;_0x3e9d5a[_0x4532('0x1f')](_0x4532('0x85')+_0x59c92b+_0x4532('0x86'));logger[_0x4532('0x59')](_0x4532('0x87'),contactItemTypes[_0x4532('0x1c')]);var _0x4a772c=util['format'](_0x4532('0x88'),_0x438fb3,_0x59c92b,_0x46da6f,_0x690b3d['ListId'],_0x690b3d[_0x4532('0x54')]||null,NOW,NOW);if(_[_0x4532('0x1d')](_0x5ab013[_0x4532('0x35')])){_0x4a772c+=_0x4532('0x89');}_0x3e9d5a[_0x4532('0x1f')](_0x4a772c);BPromise[_0x4532('0x8a')](_0x3e9d5a,handleQuery)[_0x4532('0x20')](function(_0x4b828f){BPromise[_0x4532('0x25')]([handleAdditionalPhones()])[_0x4532('0x20')](function(){_0x3e9d5a=[];for(var _0x302878=0x0;_0x302878\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','findOne','CmContactHasItem','updated','create','PHONE','inserted','CmContact','CmHopper','update','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','ContactId','ListId','priority','UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_hopper_black','createdAt','fields','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','fromQuery','CmHopperId','OrderBy','updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','ListId\x20=\x20?','id\x20IN\x20?','info','Received\x20SIGINT','message','exit','errors','code','query','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','rows','data','find','hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','DROP\x20TABLE\x20'];(function(_0x299e3c,_0x8ace29){var _0x2eab48=function(_0xf7699e){while(--_0xf7699e){_0x299e3c['push'](_0x299e3c['shift']());}};_0x2eab48(++_0x8ace29);}(_0x9652,0xaf));var _0x2965=function(_0x33a73b,_0x2d367f){_0x33a73b=_0x33a73b-0x0;var _0x30527e=_0x9652[_0x33a73b];return _0x30527e;};'use strict';var fs=require('fs');var path=require(_0x2965('0x0'));var _=require(_0x2965('0x1'));var Papa=require('papaparse');var util=require(_0x2965('0x2'));var BPromise=require(_0x2965('0x3'));var moment=require(_0x2965('0x4'));var squel=require(_0x2965('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x2965('0x6'));var logger=require(_0x2965('0x7'))('import');config['redis']=_['defaults'](config[_0x2965('0x8')],{'host':_0x2965('0x9'),'port':0x18eb});var socket=require(_0x2965('0xa'))(new Redis(config[_0x2965('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x2965('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x2965('0xc')+moment()[_0x2965('0xb')](_0x2965('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2fdf5b){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))*$/[_0x2965('0xe')](_0x2fdf5b);}function selectNotIn(_0x504f29,_0x2f1ec6,_0x88a581,_0x53bd0f,_0x1ff227){return squel[_0x2965('0xf')]()[_0x2965('0x10')](_0x2965('0x11'))[_0x2965('0x12')](_0x53bd0f)[_0x2965('0x13')](_0x2f1ec6,null,_0x2f1ec6+_0x2965('0x14')+_0x53bd0f+'.'+_0x88a581)['where'](_0x53bd0f+'.'+_0x88a581+_0x2965('0x15')+_0x504f29+'.'+_0x88a581)[_0x2965('0x16')](_0x2f1ec6+_0x2965('0x17')+_0x1ff227[_0x2965('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1474bc,_0x38a39c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2965('0x18')]['query'](_0x2965('0x19')+tempTableName)[_0x2965('0x1a')](function(_0x563ff5){if(_0x563ff5!==null){var _0x1547d0=[];for(var _0x3d043c=0x0;_0x3d043c<_0x563ff5[_0x2965('0x1b')];_0x3d043c++){var _0x1e2599=_0x563ff5[_0x3d043c];if(!_[_0x2965('0x1c')](_0x1e2599[_0x2965('0x11')])){if(!_[_0x2965('0x1c')](_0x1e2599[_0x2965('0x1d')]))_0x1547d0[_0x2965('0x1e')](insertAdditionalPhones(_0x1e2599));promisesContact[_0x2965('0x1e')]({'contact':_0x1e2599});}}}Promise[_0x2965('0x1f')](_0x1547d0)[_0x2965('0x20')](function(){_0x1474bc({'val':0x1});});})[_0x2965('0x21')](function(_0xfb9c36){logger[_0x2965('0x22')](_0xfb9c36['message']);});});}function insertAdditionalPhones(_0x3a7c9e){return new Promise(function(_0x3b619c,_0x3110a8){var _0x4a0617=_0x3a7c9e[_0x2965('0x1d')];if(_['isNil'](_0x4a0617))_0x3110a8({'val':0x0});else{var _0x26eb01=_0x4a0617[_0x2965('0x23')](';');var _0x3e3e2b=[];orderBy=0x0;for(var _0x2f2776=0x0;_0x2f2776<_0x26eb01[_0x2965('0x1b')];_0x2f2776++){_0x3e3e2b[_0x2965('0x1e')](splitAdditionalPhone(_0x3a7c9e['id'],_0x26eb01[_0x2f2776]));}Promise[_0x2965('0x1f')](_0x3e3e2b)[_0x2965('0x20')](function(){_0x3b619c({'val':_0x26eb01['length']});});}});}function splitAdditionalPhone(_0xe0ae17,_0x25043a){return new Promise(function(_0x56a0f4,_0x13b03b){var _0x44fc11=_0x25043a[_0x2965('0x23')](':');var _0x365c98=_0x44fc11[0x0];var _0x39e4e2=_0x44fc11[0x1];if(_0x39e4e2!==''){var _0x5f58af=_0x39e4e2[_0x2965('0x23')]('|');var _0x1fe71e=[];for(var _0x22c67b=0x0;_0x22c67b<_0x5f58af[_0x2965('0x1b')];_0x22c67b++){if(_0x5f58af[_0x22c67b]!==''){var _0x8800c4=_['filter'](promisesAdditionalPhones,{'contactId':_0xe0ae17,'phone':_0x5f58af[_0x22c67b]});if(_0x8800c4[_0x2965('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xe0ae17,'contactTypeId':_0x365c98,'phone':_0x5f58af[_0x22c67b],'orderBy':orderBy});}}}_0x56a0f4({'ok':0x1});}else _0x56a0f4({'res':0x0});});}function createAdditionalPhone(_0x1b98d4,_0x2d680f,_0x300b57,_0x3f7f45){var _0x469f22='';var _0x3356ee='';var _0xb03de0=_0x300b57[_0x2965('0x23')]('§');_0x469f22=_0xb03de0[0x0];if(_0xb03de0[_0x2965('0x1b')]==0x2)_0x3356ee=_0xb03de0[0x1];return new Promise(function(_0x3d6b3a,_0x174099){return db['CmContactHasItem'][_0x2965('0x24')]({'where':{'CmContactId':_0x1b98d4,'item':_0x469f22}})['then'](function(_0x5a28a7){if(_0x5a28a7){return db[_0x2965('0x25')]['update']({'ItemTypeId':_0x2d680f,'description':_0x3356ee,'OrderBy':_0x3f7f45},{'where':{'CmContactId':_0x1b98d4,'item':_0x469f22}})[_0x2965('0x20')](function(_0x1705d3){_0x3d6b3a({'res':_0x2965('0x26')});});}else{return db[_0x2965('0x25')][_0x2965('0x27')]({'CmContactId':_0x1b98d4,'item':_0x469f22,'ItemTypeId':_0x2d680f,'description':_0x3356ee,'OrderBy':_0x3f7f45,'ItemClass':_0x2965('0x28')})['then'](function(_0x126681){_0x3d6b3a({'res':_0x2965('0x29')});});}});});}function updateContact(_0x8ed836){return new Promise(function(_0x713d99,_0x300eaf){var _0xfa7d0a=_0x8ed836['id'];delete _0x8ed836['id'];return db[_0x2965('0x2a')]['update'](_0x8ed836,{'where':{'id':_0xfa7d0a}})[_0x2965('0x20')](function(_0x3dc2b3){updatedRows+=0x1;return db[_0x2965('0x2b')][_0x2965('0x2c')]({'phone':_0x8ed836['phone']},{'where':{'ContactId':_0xfa7d0a}})[_0x2965('0x20')](function(_0x441272){_0x713d99({'ret':'OK'});});});});}function insertCmHopper(_0x3b6447,_0xc8415f,_0x45b271,_0x27975c,_0x58d9e9){var _0x208294=['cm_contacts.phone','cm_contacts.scheduledat',_0x2965('0x2d'),_0x2965('0x2e'),_0xc8415f+'.'+_0x27975c,_0x2965('0x2f'),_0x2965('0x30'),_0x2965('0x31'),_0x2965('0x32'),'\x22'+_0x58d9e9+'\x22'];return squel['insert']()[_0x2965('0x33')](_0x2965('0x34'))['fromQuery']([_0x2965('0x11'),'scheduledat',_0x2965('0x35'),_0x2965('0x36'),_0x27975c,'createdAt','updatedAt',_0x2965('0x37'),_0x2965('0x38'),_0x2965('0x39')],squel[_0x2965('0xf')]()['fields'](_0x208294)[_0x2965('0x12')](_0xc8415f)['join'](_0x2965('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0xc8415f+_0x2965('0x3b'))[_0x2965('0x13')](_0x45b271,null,_0x45b271+_0x2965('0x14')+_0xc8415f+'.'+_0x27975c)[_0x2965('0x16')](_0xc8415f+_0x2965('0x3c'),_0x3b6447)[_0x2965('0x16')](_0x2965('0x3d'),NOW)[_0x2965('0x16')](_0x2965('0x3e'),selectNotIn(_0xc8415f,_0x45b271,_0x27975c,_0x2965('0x34'),['\x22always\x22',_0x2965('0x3f')]))[_0x2965('0x16')](_0x2965('0x3e'),selectNotIn(_0xc8415f,_0x45b271,_0x27975c,_0x2965('0x34'),['\x22always\x22'])))[_0x2965('0x40')]();}function insertCmHopperBlack(_0x49afe4,_0x7cfc15,_0xc730da,_0x432cf3){var _0x5939a6=['cm_contacts.phone',_0x2965('0x2d'),_0x2965('0x2e'),_0x7cfc15+'.'+_0x432cf3,'cm_contacts.createdAt',_0x2965('0x30')];return squel['insert']()[_0x2965('0x33')](_0x2965('0x41'))['fromQuery']([_0x2965('0x11'),_0x2965('0x35'),_0x2965('0x36'),_0x432cf3,_0x2965('0x42'),'updatedAt'],squel['select']()[_0x2965('0x43')](_0x5939a6)[_0x2965('0x12')](_0x7cfc15)['join'](_0x2965('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0x7cfc15+_0x2965('0x3b'))[_0x2965('0x13')](_0xc730da,null,_0xc730da+_0x2965('0x14')+_0x7cfc15+'.'+_0x432cf3)['where'](_0x7cfc15+_0x2965('0x3c'),_0x49afe4)['where'](_0x2965('0x3d'),NOW)[_0x2965('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x2965('0x11'))[_0x2965('0x12')](_0x2965('0x41'))[_0x2965('0x16')]('ListId\x20=\x20?',_0x49afe4)['where'](_0x432cf3+_0x2965('0x44'),_0x7cfc15+'.'+_0x432cf3)))[_0x2965('0x40')]();}function insertCmHopperAdditionalPhones(_0x3dbcfa){var _0x400e5d=[_0x2965('0x45'),_0x2965('0x46'),'cm_contact_has_items.OrderBy',_0x2965('0x47'),_0x2965('0x48')];return squel[_0x2965('0x49')]()['into']('cm_hopper_additional_phones')[_0x2965('0x4a')]([_0x2965('0x4b'),_0x2965('0x11'),_0x2965('0x4c'),_0x2965('0x42'),_0x2965('0x4d')],squel[_0x2965('0xf')]()['fields'](_0x400e5d)[_0x2965('0x12')](_0x2965('0x34'))[_0x2965('0x13')](_0x2965('0x3a'),null,_0x2965('0x4e'))[_0x2965('0x13')](_0x2965('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x2965('0x50'),_0x3dbcfa)[_0x2965('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x4e4bcd,_0xdfce71,_0x4d878b,_0x388c35){var _0x3a3a98=_[_0x2965('0x51')](_[_0x2965('0x52')](_0x388c35),[_0x2965('0x36'),_0x2965('0x53'),'createdAt',_0x2965('0x4d')]);return squel[_0x2965('0x49')]()['into'](_0x2965('0x3a'))[_0x2965('0x4a')](_0x3a3a98,squel[_0x2965('0xf')]()[_0x2965('0x43')](_0x3a3a98)[_0x2965('0x12')](_0xdfce71)[_0x2965('0x16')]('('+_0x4d878b[_0x2965('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x2965('0xf')]()[_0x2965('0x43')](_0x4d878b)['from']('cm_contacts')[_0x2965('0x16')](_0x2965('0x54'),_0x4e4bcd))['where'](_0x2965('0x55'),squel[_0x2965('0xf')]()[_0x2965('0x10')]('MIN(id)','min_id')[_0x2965('0x12')](_0xdfce71)['group'](_0x4d878b[_0x2965('0x13')](','))))['toString']();}function handleStop(){logger[_0x2965('0x56')](_0x2965('0x57'));stopped=!![];}function handleUncaughtException(_0x301c81){logger[_0x2965('0x22')](_0x301c81[_0x2965('0x58')]);process[_0x2965('0x59')](0x1);}function handleError(_0x1199aa,_0x4d6255){stats[_0x2965('0x5a')]['push']({'name':_0x4d6255[_0x2965('0x5b')],'message':_0x4d6255[_0x2965('0x58')],'row':_0x1199aa});}function handleQuery(_0x16f527){logger[_0x2965('0x56')](_0x16f527);return db['sequelize'][_0x2965('0x5c')](_0x16f527)[_0x2965('0x1a')](function(_0x6a7d0a){results['push'](_0x6a7d0a);})[_0x2965('0x21')](function(_0x2d07c9){logger[_0x2965('0x22')](_0x2d07c9[_0x2965('0x58')]);});}function main(_0x2f18d1,_0x52e75e,_0x498a3f,_0x5c5d16){logger[_0x2965('0x56')]('main',_0x2f18d1,JSON[_0x2965('0x5d')](_0x52e75e));process[_0x2965('0x5e')](_0x2965('0x5f'));var _0xbb9c79=_0x52e75e[_0x2965('0x60')];var _0x2b5620=_[_0x2965('0x61')](_0xbb9c79);var _0x55b766=_0x52e75e[_0x2965('0x62')];var _0x36c16a=path[_0x2965('0x13')](config['root'],_0x2965('0x63'),_0x55b766+_0x2965('0x64'));logger[_0x2965('0x56')](_0x2965('0x65'),_0x52e75e);db[_0x2965('0x66')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x2965('0x20')](function(_0x11bd14){for(var _0x45d8b1=0x0;_0x45d8b1<_0x11bd14['length'];_0x45d8b1++){if(_0x11bd14[_0x45d8b1][_0x2965('0x67')]in _0xbb9c79){contactItemTypes['push'](_0x11bd14[_0x45d8b1]);delete _0x2b5620[_0x11bd14[_0x45d8b1][_0x2965('0x67')]];hasAdditionalPhones=!![];}for(var _0x5df6a4 in _0xbb9c79){if(_0x11bd14[_0x45d8b1][_0x2965('0x67')]+_0x2965('0x68')===_0x5df6a4){phoneDescriptions[_0x2965('0x1e')]({'itemTypeId':_0x11bd14[_0x45d8b1]['id'],'description':_0x5df6a4});delete _0x2b5620[_0x5df6a4];}}}if(hasAdditionalPhones)_0x2b5620[_0x2965('0x1d')]='';var _0x2c5e37=_['keys'](_0x2b5620)[_0x2965('0x13')]();logger[_0x2965('0x56')](_0x2965('0x69'),_0x2c5e37);fs[_0x2965('0x6a')](_0x36c16a,_0x2c5e37+'\x0a');Papa[_0x2965('0x6b')](fs[_0x2965('0x6c')](_0x2f18d1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ef500,_0x31e898){try{for(var _0x385469=0x0,_0x22cc3d=[];_0x385469<_0x3ef500['data'][_0x2965('0x1b')];_0x385469++){stats[_0x2965('0x6d')]+=0x1;if(_0x3ef500[_0x2965('0x5a')][_0x385469]){handleError(_0x3ef500[_0x2965('0x6e')][_0x385469],_0x3ef500[_0x2965('0x5a')][_0x385469]);}else{var _0x49c0a3=[];var _0x376922=[];var _0x391173={};for(var _0x3d8151 in _0xbb9c79){let _0x105f60=contactItemTypes[_0x2965('0x6f')](_0x3857ad=>_0x3857ad[_0x2965('0x67')]===_0x3d8151);let _0x9e954e=contactItemTypes['find'](_0x260961=>_0x260961[_0x2965('0x67')]+'_description'===_0x3d8151);if(_['isNil'](_0x105f60)&&_['isNil'](_0x9e954e)){if(_0xbb9c79[_0x2965('0x70')](_0x3d8151)){if(_0x3ef500[_0x2965('0x6e')][_0x385469][_0xbb9c79[_0x3d8151]]){var _0x5cf548=_[_0x2965('0x71')](_0x3ef500[_0x2965('0x6e')][_0x385469][_0xbb9c79[_0x3d8151]][_0x2965('0x72')](/"/g,'\x27'));switch(_0x3d8151){case _0x2965('0x73'):var _0x5f743a=moment(_0x5cf548,_0x2965('0x74'),!![]);if(_0x5f743a[_0x2965('0x75')]()){_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x5cf548+'\x22');}else{_0x49c0a3[_0x2965('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5f2c4f=parseInt(_0x5cf548);_0x5cf548=_[_0x2965('0x76')](_0x5f2c4f)||_0x5f2c4f<0x0||_0x5f2c4f>0x4?_0x5c5d16?0x3:0x2:_0x5f2c4f;_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x5cf548+'\x22');break;case'UserId':var _0x56f2f2=parseInt(_0x5cf548);if(_['isNumber'](_0x56f2f2)&&_[_0x2965('0x77')](_0x498a3f,_0x56f2f2)){_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x56f2f2+'\x22');}else{_0x49c0a3[_0x2965('0x1e')](_0x2965('0x78'));}break;case _0x2965('0x79'):if(isEmail(_0x5cf548)){_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x5cf548+'\x22');}else{_0x49c0a3['push'](_0x2965('0x7a'));}break;case _0x2965('0x7b'):var _0x21170f=moment(_0x5cf548,'YYYY-MM-DD',!![]);if(_0x21170f[_0x2965('0x75')]()){_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x5cf548+'\x22');}else{_0x49c0a3[_0x2965('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x5cf548+'\x22');}}else{switch(_0x3d8151){case _0x2965('0x7c'):case _0x2965('0x11'):_0x49c0a3[_0x2965('0x1e')](_0x3d8151+_0x2965('0x7d'));break;default:_0x22cc3d['push']('\x22\x22');}}}}else{var _0x446f4a='';if(!_[_0x2965('0x1c')](_0x105f60)){if(!_0x391173[_0x2965('0x70')](_0x105f60['id'])){for(var _0xa7b4c4=0x0;_0xa7b4c4<_0xbb9c79[_0x3d8151][_0x2965('0x1b')];_0xa7b4c4++){var _0x5cf548=_[_0x2965('0x71')](_0x3ef500[_0x2965('0x6e')][_0x385469][_0xbb9c79[_0x3d8151][_0xa7b4c4]]['replace'](/"/g,'\x27'));var _0xccfed9=phoneDescriptions['find'](_0x1de39d=>_0x1de39d['itemTypeId']===_0x105f60['id']);if(!_[_0x2965('0x1c')](_0xccfed9)){var _0x503c20=_[_0x2965('0x71')](_0x3ef500[_0x2965('0x6e')][_0x385469][_0xbb9c79[_0xccfed9[_0x2965('0x7e')]][0x0]][_0x2965('0x72')](/"/g,'\x27'));if(!_[_0x2965('0x1c')](_0x503c20))_0x5cf548=_0x5cf548+'§'+_0x503c20;}if(_0x446f4a=='')_0x446f4a=_0x5cf548;else _0x446f4a+='|'+_0x5cf548;}_0x376922['push'](_0x105f60['id']+':'+_0x446f4a);_0x391173[_0x105f60['id']]=0x1;}}}}if(hasAdditionalPhones){_0x22cc3d[_0x2965('0x1e')]('\x22'+_0x376922[_0x2965('0x13')](';')+'\x22');}if(_0x49c0a3['length']){handleError(_0x3ef500[_0x2965('0x6e')][_0x385469],{'code':_0x2965('0x7f'),'message':_0x49c0a3[_0x2965('0x13')]()});}else{fs[_0x2965('0x80')](_0x36c16a,_0x22cc3d[_0x2965('0x13')]()+'\x0a');}_0x22cc3d=[];}if(!(stats[_0x2965('0x6d')]%0xc8)){socket['emit']('contact:import:'+_0x55b766,stats);stats[_0x2965('0x5a')]=[];}}if(stopped){logger[_0x2965('0x56')](_0x2965('0x81'));_0x31e898['abort']();}}catch(_0x331dfa){handleError(_0x3ef500[_0x2965('0x6e')][_0x385469],{'code':_0x2965('0x82'),'message':_0x331dfa[_0x2965('0x58')]});logger['error'](_0x2965('0x83'),_0x331dfa[_0x2965('0x58')]);}},'complete':function(){try{var _0x2f2739=[];var _0x333208=tempTableName;_0x2f2739[_0x2965('0x1e')](_0x2965('0x84')+_0x333208+_0x2965('0x85'));logger[_0x2965('0x56')](_0x2965('0x86'),contactItemTypes[_0x2965('0x1b')]);var _0x192d3a=util['format'](_0x2965('0x87'),_0x36c16a,_0x333208,_0x2c5e37,_0x52e75e[_0x2965('0x36')],_0x52e75e[_0x2965('0x53')]||null,NOW,NOW);if(_[_0x2965('0x1c')](_0xbb9c79[_0x2965('0x73')])){_0x192d3a+=_0x2965('0x88');}_0x2f2739[_0x2965('0x1e')](_0x192d3a);BPromise[_0x2965('0x89')](_0x2f2739,handleQuery)[_0x2965('0x20')](function(_0x342938){BPromise[_0x2965('0x1f')]([handleAdditionalPhones()])[_0x2965('0x20')](function(){_0x2f2739=[];for(var _0x201e21=0x0;_0x201e21\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','COUNT(*)','isEmpty','lodash','squel','../parsers/advancedSearch','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','select','name','field','color','from','tools_tags','getInteractionFK','_interactions','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','unreadMessages','and','Contact','operator','split','contact','end','tags','clause','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','some','compact','concat','createdAt','$gte','parse','$lte','null','resolve','then','fields','read','tag','filter','capitalize','chat','Websites','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','Interaction'];(function(_0x141067,_0x2544b9){var _0x14b492=function(_0x2b09ca){while(--_0x2b09ca){_0x141067['push'](_0x141067['shift']());}};_0x14b492(++_0x2544b9);}(_0xe1e0,0x168));var _0x0e1e=function(_0x406ae0,_0x1b8ea5){_0x406ae0=_0x406ae0-0x0;var _0x9e7b8b=_0xe1e0[_0x406ae0];return _0x9e7b8b;};'use strict';var _=require(_0x0e1e('0x0'));var squel=require(_0x0e1e('0x1'));var as=require(_0x0e1e('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x0e1e('0x3')];var utils=require('./utils');var db=require(_0x0e1e('0x4'))['db'];function skipInteractionsQuery(_0x1f7d8b,_0x7540e2,_0x33eb9d){var _0x22cb1c=![];var _0x7dbb7f=utils[_0x0e1e('0x5')](_0x1f7d8b);if(_0x7540e2[_0x0e1e('0x6')]===_0x0e1e('0x7')&&!_0x33eb9d[_0x0e1e('0x8')]&&!_0x33eb9d[_0x7dbb7f]){_0x22cb1c=!![];}return _0x22cb1c;}function getTagsQuery(){return squel[_0x0e1e('0x9')]()['field']('id')['field'](_0x0e1e('0xa'))[_0x0e1e('0xb')](_0x0e1e('0xc'))[_0x0e1e('0xd')](_0x0e1e('0xe'));}function getUsersQuery(_0x327e09,_0x5ced21){var _0x1c546e=utils[_0x0e1e('0xf')](_0x327e09);var _0x4a98dc='user_has_'+_0x327e09+_0x0e1e('0x10');var _0x28b0e3=squel['select']()['field']('u.id')[_0x0e1e('0xb')](_0x0e1e('0x11'))[_0x0e1e('0xb')](_0x0e1e('0x12')+_0x1c546e)[_0x0e1e('0xd')](_0x4a98dc,'ui')['left_join'](_0x0e1e('0x13'),'u',_0x0e1e('0x14'));if(_0x5ced21[_0x0e1e('0x15')]>0x0){_0x28b0e3[_0x0e1e('0x16')](_0x0e1e('0x12')+_0x1c546e+_0x0e1e('0x17'),_[_0x0e1e('0x18')](_0x5ced21,'id'));}return _0x28b0e3;}function getInteractionsQuery(_0x1f766e){var _0x1ca8fe=utils[_0x0e1e('0x19')](_0x1f766e);var _0x5b087a=utils['getAccountFK'](_0x1f766e);var _0x9cde04=utils['getInteractionFK'](_0x1f766e);return squel[_0x0e1e('0x9')]()[_0x0e1e('0xd')](_0x1ca8fe[_0x0e1e('0x1a')],'i')[_0x0e1e('0x1b')]('cm_contacts','c',_0x0e1e('0x1c'))['left_join'](_0x0e1e('0x13'),'o',_0x0e1e('0x1d'))['left_join'](_0x1ca8fe[_0x0e1e('0x1e')],'a',_0x0e1e('0x1f')+_0x5b087a)[_0x0e1e('0x1b')](_0x1ca8fe[_0x0e1e('0x20')],'me',_0x0e1e('0x21')+_0x9cde04+'\x20=\x20i.id')[_0x0e1e('0x1b')](_0x1ca8fe[_0x0e1e('0x22')],'it','it.'+_0x9cde04+_0x0e1e('0x23'))['left_join'](_0x0e1e('0xe'),'t',_0x0e1e('0x24'));}function getSqlClauses(){var _0x2774d7={'body':squel[_0x0e1e('0x25')](),'contact':squel[_0x0e1e('0x25')](),'default':squel[_0x0e1e('0x25')](),'fields':squel[_0x0e1e('0x25')](),'filter':squel[_0x0e1e('0x25')](),'read':squel[_0x0e1e('0x25')](),'tags':{'clause':squel[_0x0e1e('0x25')](),'ids':null},'user':squel[_0x0e1e('0x25')]()};return _0x2774d7;}function parseTagParameter(_0x321ed4){var _0x3be7a5=squel[_0x0e1e('0x25')]();if(_0x321ed4){var _0x20f4aa=utils[_0x0e1e('0x26')](_0x321ed4);_0x20f4aa[_0x0e1e('0x27')](function(_0x31eeba){_0x3be7a5['or'](_0x0e1e('0x28'),'%,'+_0x31eeba+',%');});}return _0x3be7a5;}function parseReadParameter(_0x2a2c3b){var _0x4526db='';if(_0x2a2c3b){_0x4526db='unreadMessages\x20{OPERATOR}\x200';if(_0x2a2c3b==='1'){_0x4526db=_0x4526db[_0x0e1e('0x29')](_0x0e1e('0x2a'),'=');}else{_0x4526db=_0x4526db['replace']('{OPERATOR}','>');}}return _0x4526db;}function parseSearchFilter(_0x4db241,_0x4d4fb4){var _0x28df47=squel[_0x0e1e('0x25')]();if(_0x4d4fb4){var _0x3c4301=_0x4d4fb4[_0x0e1e('0x29')]('\x5c','\x5c\x5c')[_0x0e1e('0x29')](/'/g,'\x27\x27');if(qs[_0x0e1e('0x2b')](_0x3c4301)){_0x28df47['or']('i.id\x20LIKE\x20?',_0x3c4301+'%');if([_0x0e1e('0x2c'),'whatsapp'][_0x0e1e('0x2d')](_0x4db241)){_0x28df47['or'](_0x0e1e('0x2e'),_0x3c4301+'%');}else if(_0x4db241===_0x0e1e('0x2f')){_0x28df47['or'](_0x0e1e('0x30'),_0x3c4301+'%');}else if(_0x4db241==='openchannel'){_0x28df47['or']('i.from\x20LIKE\x20?',_0x3c4301+'%');}}else if(_0x4db241===_0x0e1e('0x31')&&qs['isEmail'](_0x3c4301)){_0x28df47['or']('c.email\x20LIKE\x20?',_0x3c4301+'%');}else{if(_0x4db241===_0x0e1e('0x31')){_0x28df47['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0e1e('0x32')](_0x3c4301,!![]))['or'](_0x0e1e('0x33'),qs['getFullTextValue'](_0x3c4301));}else if(_0x4db241!==_0x0e1e('0x2f')){_0x28df47['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0e1e('0x32')](_0x3c4301));}_0x28df47['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3c4301,!![]),null);}}return _0x28df47;}function parseAdvancedSearchFilter(_0x4f7e,_0x42cf30){var _0x4b153b=getSqlClauses();var _0xaf6785=as[_0x0e1e('0x34')](_0x4f7e);var _0x1e3541=_0xaf6785[_0x0e1e('0x35')];for(var _0x3f6e88=0x0;_0x3f6e88<_0xaf6785[_0x0e1e('0x36')][_0x0e1e('0x15')];_0x3f6e88++){var _0x429d63=_0xaf6785[_0x0e1e('0x36')][_0x3f6e88];var _0x1709be='i';var _0x9fd8fc=_[_0x0e1e('0x37')](_0x42cf30,[_0x0e1e('0xa'),_0x429d63[_0x0e1e('0xb')]]);if(_0x9fd8fc){var _0x4f3fd4=as[_0x0e1e('0x38')](_0x1709be,_0x9fd8fc[_0x0e1e('0x39')],_0x429d63);_0x4b153b[_0x0e1e('0x3a')][_0x1e3541](_0x4f3fd4[_0x0e1e('0x3b')],_0x4f3fd4[_0x0e1e('0x3c')][_0x0e1e('0x3d')],_0x4f3fd4[_0x0e1e('0x3c')]['end']);}else{switch(_0x429d63[_0x0e1e('0xb')]){case _0x0e1e('0x3e'):var _0x29bb28=parseReadParameter(_0x429d63[_0x0e1e('0x3c')]);_0x4b153b['read'][_0x0e1e('0x3f')](_0x29bb28);break;case _0x0e1e('0x40'):if(_0x429d63[_0x0e1e('0x41')]==='$substring'){if(_0x429d63['value'][_0x0e1e('0x42')]('\x20')[_0x0e1e('0x15')]>0x1){_0x4b153b[_0x0e1e('0x43')][_0x1e3541]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x429d63[_0x0e1e('0x3c')],!![]),null);}else{var _0x3eeaef='%'+_0x429d63[_0x0e1e('0x3c')]+'%';_0x4b153b[_0x0e1e('0x43')][_0x1e3541]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3eeaef,_0x3eeaef,_0x3eeaef);}}else{_0x9fd8fc=_['find'](_0x42cf30,['name','ContactId']);_0x429d63['field']='ContactId';_0x4f3fd4=as[_0x0e1e('0x38')](_0x1709be,_0x9fd8fc['type'],_0x429d63);_0x4b153b[_0x0e1e('0x43')][_0x1e3541](_0x4f3fd4[_0x0e1e('0x3b')],_0x4f3fd4[_0x0e1e('0x3c')][_0x0e1e('0x3d')],_0x4f3fd4['value'][_0x0e1e('0x44')]);}break;case'Tag':var _0x56f2e3=_0x429d63[_0x0e1e('0x3c')]['split'](',')[_0x0e1e('0x18')](function(_0x20f8af){return Number(_0x20f8af);});var _0x3b6f96=parseTagParameter(_0x56f2e3);_0x4b153b[_0x0e1e('0x45')][_0x0e1e('0x46')]['and'](_0x3b6f96);_0x4b153b[_0x0e1e('0x45')]['ids']=_0x56f2e3;break;case _0x0e1e('0x47'):if(_0x429d63['operator']===_0x0e1e('0x48')){_0x4b153b[_0x0e1e('0x49')][_0x1e3541](_0x0e1e('0x4a'),'%'+_0x429d63[_0x0e1e('0x3c')]+'%',null);}else{_0x9fd8fc=_[_0x0e1e('0x37')](_0x42cf30,[_0x0e1e('0xa'),_0x0e1e('0x4b')]);_0x429d63[_0x0e1e('0xb')]='UserId';_0x4f3fd4=as['buildExpression'](_0x1709be,_0x9fd8fc[_0x0e1e('0x39')],_0x429d63);_0x4b153b[_0x0e1e('0x49')][_0x1e3541](_0x4f3fd4['text'],_0x4f3fd4[_0x0e1e('0x3c')][_0x0e1e('0x3d')],_0x4f3fd4[_0x0e1e('0x3c')][_0x0e1e('0x44')]);}break;case _0x0e1e('0x4c'):case _0x0e1e('0x4d'):_0x4f3fd4=as[_0x0e1e('0x38')]('me',null,_0x429d63);_0x4b153b[_0x0e1e('0x4c')][_0x1e3541](_0x4f3fd4[_0x0e1e('0x3b')],_0x4f3fd4[_0x0e1e('0x3c')][_0x0e1e('0x3d')],_0x4f3fd4['value']['end']);break;}}}return _0x4b153b;}function parseModelFields(_0x5dc80e,_0x4a3810,_0x2705e6){var _0x149043=utils[_0x0e1e('0x5')](_0x5dc80e);var _0x37e213=squel['expr']();var _0x5bb74a=_(_0x4a3810)['keys']()[_0x0e1e('0x18')](function(_0x58a961){return _[_0x0e1e('0x4e')](_0x2705e6,[_0x0e1e('0xa'),_0x58a961])?_0x58a961:undefined;})[_0x0e1e('0x4f')]()[_0x0e1e('0x3c')]();if(_0x5bb74a[_0x0e1e('0x15')]>0x0){_0x5bb74a['forEach'](function(_0x1eb1fb){if(_0x1eb1fb===_0x149043){_0x37e213[_0x0e1e('0x3f')]('i.'+_0x149043+'\x20IN\x20?',[][_0x0e1e('0x50')](_0x4a3810[_0x1eb1fb]));}else if(_0x1eb1fb===_0x0e1e('0x51')){var _0x19de95=JSON['parse'](_0x4a3810[_0x1eb1fb])[_0x0e1e('0x52')];var _0x371b1a=JSON[_0x0e1e('0x53')](_0x4a3810[_0x1eb1fb])[_0x0e1e('0x54')];_0x37e213[_0x0e1e('0x3f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19de95,_0x371b1a);}else{if(_0x4a3810[_0x1eb1fb]===_0x0e1e('0x55')){_0x37e213[_0x0e1e('0x3f')]('i.'+_0x1eb1fb+'\x20IS\x20NULL');}else{_0x37e213[_0x0e1e('0x3f')]('i.'+_0x1eb1fb+'\x20=\x20?',_0x4a3810[_0x1eb1fb]);}}});}return _0x37e213;}function parseQueryParameters(_0x3908ad,_0x3ee741,_0x1d06fa){var _0x28c8da=getSqlClauses();return Promise[_0x0e1e('0x56')]()['then'](function(){return parseModelFields(_0x3908ad,_0x3ee741,_0x1d06fa);})[_0x0e1e('0x57')](function(_0x126fd8){_0x28c8da[_0x0e1e('0x58')]['and'](_0x126fd8);return parseReadParameter(_0x3ee741['read']);})['then'](function(_0x3899b1){_0x28c8da[_0x0e1e('0x59')][_0x0e1e('0x3f')](_0x3899b1);return parseTagParameter(_0x3ee741[_0x0e1e('0x5a')]);})[_0x0e1e('0x57')](function(_0x289bde){_0x28c8da[_0x0e1e('0x45')][_0x0e1e('0x46')][_0x0e1e('0x3f')](_0x289bde);return parseSearchFilter(_0x3908ad,_0x3ee741['filter']);})['then'](function(_0x57b563){_0x28c8da[_0x0e1e('0x5b')]=_0x57b563;return _0x28c8da;});}function checkAccountsRestrictions(_0x53f6cd,_0x3d20e4,_0x42a72d){var _0x9f6520=utils[_0x0e1e('0x5')](_0x53f6cd);var _0xbdc209='get'+_[_0x0e1e('0x5c')](_0x53f6cd)+(_0x53f6cd===_0x0e1e('0x5d')?_0x0e1e('0x5e'):'Accounts');var _0x35d77b=squel['expr']();return Promise[_0x0e1e('0x56')]()[_0x0e1e('0x57')](function(){if(_0x42a72d['search']&&_0x3d20e4[_0x0e1e('0x6')]===_0x0e1e('0x7')){return _0x3d20e4[_0xbdc209]({'attributes':['id'],'raw':!![]});}})[_0x0e1e('0x57')](function(_0x1a923e){if(_0x1a923e){if(_0x1a923e[_0x0e1e('0x15')]===0x0){_0x35d77b[_0x0e1e('0x3f')]('i.'+_0x9f6520+'\x20IS\x20NULL');}else{_0x35d77b[_0x0e1e('0x3f')]('i.'+_0x9f6520+_0x0e1e('0x17'),_[_0x0e1e('0x18')](_0x1a923e,'id'));}}else if(!_0x42a72d[_0x9f6520]){_0x35d77b[_0x0e1e('0x3f')]('i.'+_0x9f6520+'\x20IS\x20NOT\x20NULL');}})[_0x0e1e('0x57')](function(){return _0x35d77b;});}function getClosedOrderClause(_0x4c9d63,_0x51fced){var _0x3a390f='';var _0x11cdce=['i.thirdDisposition',_0x0e1e('0x5f'),_0x0e1e('0x60')];if(_0x4c9d63===_0x0e1e('0x31')){_0x11cdce[_0x0e1e('0x61')](_0x0e1e('0x62'));}if(_0x51fced[_0x0e1e('0x63')]==='0'&&_0x4c9d63==='mail'){_0x3a390f=_0x0e1e('0x62');}else{if(_0x51fced[_0x0e1e('0x63')]==='1'){_0x11cdce['shift']();}_0x3a390f=_0x0e1e('0x64')+_0x11cdce['join'](',\x20')+')';}return _0x3a390f;}function getFilteredInteractions(_0x20777c,_0xc66810,_0x51a018,_0x2e5113){var _0x34d813=utils[_0x0e1e('0xf')](_0x20777c);var _0x240702=_[_0x0e1e('0x5c')](_0x20777c)+_0x0e1e('0x65');var _0x388157=[];var _0x1ac96c=getTagsQuery();var _0x522e95={'type':db[_0x0e1e('0x66')][_0x0e1e('0x67')]['SELECT'],'raw':!![]};var _0xffa60=[];var _0x34ab3f=[];return db[_0x0e1e('0x68')][_0x0e1e('0x69')](_0x1ac96c[_0x0e1e('0x6a')](),_0x522e95)['then'](function(_0x517e78){_0x388157=_[_0x0e1e('0x6b')](_0x517e78,'id');_0x522e95=_[_0x0e1e('0x6c')](_0x522e95,{'model':db[_0x240702],'mapToModel':!![],'nest':!![]});if(_0x51a018[_0x0e1e('0x58')]){_0x2e5113[_0x0e1e('0x6d')]['forEach'](function(_0x5ce710){_0xc66810[_0x0e1e('0xb')]('i.'+_0x5ce710);});}else{_0xc66810[_0x0e1e('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xc66810[_0x0e1e('0xb')]('a.key','Account.key');_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x6e'),_0x0e1e('0x6f'));if(_0x20777c==='mail'){_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x70'),_0x0e1e('0x71'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x72'),_0x0e1e('0x73'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x74'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x75'));_0xc66810['field'](_0x0e1e('0x76'));_0xc66810['field'](_0x0e1e('0x77'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x78'));_0xc66810[_0x0e1e('0xb')]('i.attach');_0xc66810['field'](_0x0e1e('0x79'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x7a'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x7b'));_0xc66810['field'](_0x0e1e('0x60'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x5f'));_0xc66810['field']('i.thirdDisposition');_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x62'));_0xc66810['field'](_0x0e1e('0x7c'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x7d'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x7e'));_0xc66810['field'](_0x0e1e('0x7f'));}else if(_0x20777c==='openchannel'){_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x80'),_0x0e1e('0x73'));}else{_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x81'),_0x0e1e('0x73'));}if(_0x20777c!=='mail'){_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x82'));}_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x83'),_0x0e1e('0x84'));_0xc66810[_0x0e1e('0xb')]('c.lastName',_0x0e1e('0x85'));_0xc66810['field'](_0x0e1e('0x86'),_0x0e1e('0x87'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x88'),_0x0e1e('0x89'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x8a'),'Contact.mobile');_0xc66810['field'](_0x0e1e('0x8b'),_0x0e1e('0x8c'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x8d'),_0x0e1e('0x8e'));_0xc66810[_0x0e1e('0xb')](_0x0e1e('0x8f'),_0x0e1e('0x90'));_0xc66810['field'](_0x0e1e('0x91'),_0x0e1e('0x92'));}if(_0x2e5113[_0x0e1e('0x93')]){_0xc66810['limit'](_0x2e5113[_0x0e1e('0x93')]);}if(_0x2e5113['offset']){_0xc66810[_0x0e1e('0x94')](_0x2e5113[_0x0e1e('0x94')]);}return db[_0x0e1e('0x68')]['query'](_0xc66810[_0x0e1e('0x6a')](),_0x522e95);})[_0x0e1e('0x57')](function(_0xbd397){_0xffa60=_0xbd397;var _0x409f05=getUsersQuery(_0x20777c,_0xffa60);return db[_0x0e1e('0x68')][_0x0e1e('0x69')](_0x409f05[_0x0e1e('0x6a')](),_0x522e95);})[_0x0e1e('0x57')](function(_0x35bffa){_0x34ab3f=_[_0x0e1e('0x95')](_0x35bffa,_0x34d813);if(_0x20777c==='mail'){return db[_0x0e1e('0x96')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x0e1e('0x57')](function(_0x593721){var _0x53c72e=_0x593721?_0x593721[_0x0e1e('0x97')]:undefined;var _0x39545f=_0xffa60[_0x0e1e('0x18')](function(_0x468473){return updateInteraction(_0x468473,_0x388157,_0x34ab3f,_0x53c72e);});return Promise['all'](_0x39545f);});}function countFilteredInteractions(_0x2be6f3,_0x3617f5){var _0x416186=_0x2be6f3['clone']();_0x416186[_0x0e1e('0xb')](_0x0e1e('0x98'));_0x416186['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x1408b6=utils[_0x0e1e('0x26')](_0x3617f5);if(!_[_0x0e1e('0x99')](_0x1408b6)){_0x416186[_0x0e1e('0x16')]('t.id\x20IN\x20?',_0x1408b6);}var _0x4f9bef={'type':db[_0x0e1e('0x66')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x0e1e('0x68')][_0x0e1e('0x69')](_0x416186['toString'](),_0x4f9bef);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x6713=['openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','operator','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','split','tags','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','plainBody','body','keys','some','forEach','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','then','fields','tag','clause','get','chat','Websites','Accounts','resolve','search','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','name','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','users','length','where','\x20IN\x20?','map','interactions','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6713,0x6d));var _0x3671=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x6713[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0x3671('0x0'));var squel=require(_0x3671('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x3671('0x2'));var updateInteraction=require(_0x3671('0x3'))[_0x3671('0x4')];var utils=require(_0x3671('0x5'));var db=require(_0x3671('0x6'))['db'];function skipInteractionsQuery(_0x430b3b,_0x38f4f1,_0x467b09){var _0x354112=![];var _0xe4eedd=utils[_0x3671('0x7')](_0x430b3b);if(_0x38f4f1[_0x3671('0x8')]===_0x3671('0x9')&&!_0x467b09['search']&&!_0x467b09[_0xe4eedd]){_0x354112=!![];}return _0x354112;}function getTagsQuery(){return squel[_0x3671('0xa')]()['field']('id')[_0x3671('0xb')](_0x3671('0xc'))['field']('color')['from']('tools_tags');}function getUsersQuery(_0x5b8677,_0x6cee84){var _0x58be2e=utils[_0x3671('0xd')](_0x5b8677);var _0x29e27d=_0x3671('0xe')+_0x5b8677+_0x3671('0xf');var _0x2deb9b=squel['select']()[_0x3671('0xb')]('u.id')[_0x3671('0xb')](_0x3671('0x10'))['field'](_0x3671('0x11')+_0x58be2e)[_0x3671('0x12')](_0x29e27d,'ui')[_0x3671('0x13')](_0x3671('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x6cee84[_0x3671('0x15')]>0x0){_0x2deb9b[_0x3671('0x16')](_0x3671('0x11')+_0x58be2e+_0x3671('0x17'),_[_0x3671('0x18')](_0x6cee84,'id'));}return _0x2deb9b;}function getInteractionsQuery(_0x39771a){var _0x5d6fa6=utils['getInteractionsTables'](_0x39771a);var _0x4e5dd7=utils[_0x3671('0x7')](_0x39771a);var _0x1cd862=utils['getInteractionFK'](_0x39771a);return squel[_0x3671('0xa')]()[_0x3671('0x12')](_0x5d6fa6[_0x3671('0x19')],'i')[_0x3671('0x13')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3671('0x13')](_0x3671('0x14'),'o',_0x3671('0x1a'))[_0x3671('0x13')](_0x5d6fa6[_0x3671('0x1b')],'a',_0x3671('0x1c')+_0x4e5dd7)[_0x3671('0x13')](_0x5d6fa6[_0x3671('0x1d')],'me',_0x3671('0x1e')+_0x1cd862+_0x3671('0x1f'))[_0x3671('0x13')](_0x5d6fa6[_0x3671('0x20')],'it',_0x3671('0x21')+_0x1cd862+_0x3671('0x1f'))[_0x3671('0x13')](_0x3671('0x22'),'t',_0x3671('0x23'));}function getSqlClauses(){var _0x1d9330={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x3671('0x24')](),'fields':squel[_0x3671('0x24')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x3671('0x24')](),'ids':null},'user':squel[_0x3671('0x24')]()};return _0x1d9330;}function parseTagParameter(_0x3c72b8){var _0x5a9f41=squel[_0x3671('0x24')]();if(_0x3c72b8){var _0x33997f=utils[_0x3671('0x25')](_0x3c72b8);_0x33997f['forEach'](function(_0x1bbb3b){_0x5a9f41['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bbb3b+',%');});}return _0x5a9f41;}function parseReadParameter(_0x1246c0){var _0x13fad9='';if(_0x1246c0){_0x13fad9=_0x3671('0x26');if(_0x1246c0==='1'){_0x13fad9=_0x13fad9['replace']('{OPERATOR}','=');}else{_0x13fad9=_0x13fad9[_0x3671('0x27')]('{OPERATOR}','>');}}return _0x13fad9;}function parseSearchFilter(_0x4ba582,_0x5573d5){var _0x59a046=squel[_0x3671('0x24')]();if(_0x5573d5){var _0x5945e9=_0x5573d5[_0x3671('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3671('0x28')](_0x5945e9)){_0x59a046['or']('i.id\x20LIKE\x20?',_0x5945e9+'%');if(['sms',_0x3671('0x29')][_0x3671('0x2a')](_0x4ba582)){_0x59a046['or'](_0x3671('0x2b'),_0x5945e9+'%');}else if(_0x4ba582===_0x3671('0x2c')){_0x59a046['or'](_0x3671('0x2d'),_0x5945e9+'%');}else if(_0x4ba582===_0x3671('0x2e')){_0x59a046['or']('i.from\x20LIKE\x20?',_0x5945e9+'%');}}else if(_0x4ba582===_0x3671('0x2f')&&qs[_0x3671('0x30')](_0x5945e9)){_0x59a046['or'](_0x3671('0x31'),_0x5945e9+'%');}else{if(_0x4ba582===_0x3671('0x2f')){_0x59a046['or'](_0x3671('0x32'),qs['getFullTextValue'](_0x5945e9,!![]))['or'](_0x3671('0x33'),qs[_0x3671('0x34')](_0x5945e9));}else if(_0x4ba582!==_0x3671('0x2c')){_0x59a046['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5945e9));}_0x59a046['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3671('0x34')](_0x5945e9,!![]),null);}}return _0x59a046;}function parseAdvancedSearchFilter(_0x57c667,_0x5dbd95){var _0x39fa5d=getSqlClauses();var _0x16e5a8=as[_0x3671('0x35')](_0x57c667);var _0x556d92=_0x16e5a8[_0x3671('0x36')];for(var _0xe6711c=0x0;_0xe6711c<_0x16e5a8[_0x3671('0x37')][_0x3671('0x15')];_0xe6711c++){var _0x4759e4=_0x16e5a8['conditions'][_0xe6711c];var _0x2384cd='i';var _0x508c39=_[_0x3671('0x38')](_0x5dbd95,['name',_0x4759e4[_0x3671('0xb')]]);if(_0x508c39){var _0x40863d=as[_0x3671('0x39')](_0x2384cd,_0x508c39[_0x3671('0x3a')],_0x4759e4);_0x39fa5d[_0x3671('0x3b')][_0x556d92](_0x40863d[_0x3671('0x3c')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3e')],_0x40863d['value'][_0x3671('0x3f')]);}else{switch(_0x4759e4[_0x3671('0xb')]){case _0x3671('0x40'):var _0x491e56=parseReadParameter(_0x4759e4['value']);_0x39fa5d[_0x3671('0x41')][_0x3671('0x42')](_0x491e56);break;case'Contact':if(_0x4759e4[_0x3671('0x43')]==='$substring'){if(_0x4759e4[_0x3671('0x3d')]['split']('\x20')[_0x3671('0x15')]>0x1){_0x39fa5d[_0x3671('0x44')][_0x556d92](_0x3671('0x45'),qs[_0x3671('0x34')](_0x4759e4[_0x3671('0x3d')],!![]),null);}else{var _0x1cab3d='%'+_0x4759e4[_0x3671('0x3d')]+'%';_0x39fa5d[_0x3671('0x44')][_0x556d92](_0x3671('0x46'),_0x1cab3d,_0x1cab3d,_0x1cab3d);}}else{_0x508c39=_[_0x3671('0x38')](_0x5dbd95,[_0x3671('0xc'),_0x3671('0x47')]);_0x4759e4[_0x3671('0xb')]=_0x3671('0x47');_0x40863d=as['buildExpression'](_0x2384cd,_0x508c39[_0x3671('0x3a')],_0x4759e4);_0x39fa5d['contact'][_0x556d92](_0x40863d[_0x3671('0x3c')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3e')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3f')]);}break;case _0x3671('0x48'):var _0x28f538=_0x4759e4[_0x3671('0x3d')][_0x3671('0x49')](',')[_0x3671('0x18')](function(_0x2787d7){return Number(_0x2787d7);});var _0x2076f1=parseTagParameter(_0x28f538);_0x39fa5d[_0x3671('0x4a')]['clause'][_0x3671('0x42')](_0x2076f1);_0x39fa5d[_0x3671('0x4a')]['ids']=_0x28f538;break;case'User':if(_0x4759e4[_0x3671('0x43')]==='$substring'){_0x39fa5d[_0x3671('0x4b')][_0x556d92](_0x3671('0x4c'),'%'+_0x4759e4[_0x3671('0x3d')]+'%',null);}else{_0x508c39=_['find'](_0x5dbd95,[_0x3671('0xc'),'UserId']);_0x4759e4['field']='UserId';_0x40863d=as[_0x3671('0x39')](_0x2384cd,_0x508c39[_0x3671('0x3a')],_0x4759e4);_0x39fa5d[_0x3671('0x4b')][_0x556d92](_0x40863d[_0x3671('0x3c')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3e')],_0x40863d[_0x3671('0x3d')]['end']);}break;case'body':case _0x3671('0x4d'):_0x40863d=as[_0x3671('0x39')]('me',null,_0x4759e4);_0x39fa5d[_0x3671('0x4e')][_0x556d92](_0x40863d[_0x3671('0x3c')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3e')],_0x40863d[_0x3671('0x3d')][_0x3671('0x3f')]);break;}}}return _0x39fa5d;}function parseModelFields(_0x1e8d15,_0x20214a,_0x3a4be1){var _0x1714bf=utils[_0x3671('0x7')](_0x1e8d15);var _0x13de27=squel[_0x3671('0x24')]();var _0x7919f7=_(_0x20214a)[_0x3671('0x4f')]()[_0x3671('0x18')](function(_0x2b3aa2){return _[_0x3671('0x50')](_0x3a4be1,['name',_0x2b3aa2])?_0x2b3aa2:undefined;})['compact']()['value']();if(_0x7919f7[_0x3671('0x15')]>0x0){_0x7919f7[_0x3671('0x51')](function(_0x118b45){if(_0x118b45===_0x1714bf){_0x13de27['and']('i.'+_0x1714bf+_0x3671('0x17'),[]['concat'](_0x20214a[_0x118b45]));}else if(_0x118b45==='createdAt'){var _0x5f3d2d=JSON[_0x3671('0x52')](_0x20214a[_0x118b45])[_0x3671('0x53')];var _0x4f04ea=JSON[_0x3671('0x52')](_0x20214a[_0x118b45])['$lte'];_0x13de27['and'](_0x3671('0x54'),_0x5f3d2d,_0x4f04ea);}else{if(_0x20214a[_0x118b45]===_0x3671('0x55')){_0x13de27[_0x3671('0x42')]('i.'+_0x118b45+_0x3671('0x56'));}else{_0x13de27['and']('i.'+_0x118b45+'\x20=\x20?',_0x20214a[_0x118b45]);}}});}return _0x13de27;}function parseQueryParameters(_0x586cd8,_0x4fe34d,_0xefd2ab){var _0x47caff=getSqlClauses();return Promise['resolve']()[_0x3671('0x57')](function(){return parseModelFields(_0x586cd8,_0x4fe34d,_0xefd2ab);})[_0x3671('0x57')](function(_0xabbd1e){_0x47caff[_0x3671('0x58')][_0x3671('0x42')](_0xabbd1e);return parseReadParameter(_0x4fe34d[_0x3671('0x41')]);})[_0x3671('0x57')](function(_0x40452d){_0x47caff[_0x3671('0x41')]['and'](_0x40452d);return parseTagParameter(_0x4fe34d[_0x3671('0x59')]);})[_0x3671('0x57')](function(_0x592b65){_0x47caff[_0x3671('0x4a')][_0x3671('0x5a')][_0x3671('0x42')](_0x592b65);return parseSearchFilter(_0x586cd8,_0x4fe34d['filter']);})[_0x3671('0x57')](function(_0x456d69){_0x47caff['filter']=_0x456d69;return _0x47caff;});}function checkAccountsRestrictions(_0x1aedd8,_0x4bdd34,_0x1f6281){var _0x526e3c=utils[_0x3671('0x7')](_0x1aedd8);var _0x3ad1d4=_0x3671('0x5b')+_['capitalize'](_0x1aedd8)+(_0x1aedd8===_0x3671('0x5c')?_0x3671('0x5d'):_0x3671('0x5e'));var _0x52a298=squel[_0x3671('0x24')]();return Promise[_0x3671('0x5f')]()[_0x3671('0x57')](function(){if(_0x1f6281[_0x3671('0x60')]&&_0x4bdd34[_0x3671('0x8')]===_0x3671('0x9')){return _0x4bdd34[_0x3ad1d4]({'attributes':['id'],'raw':!![]});}})[_0x3671('0x57')](function(_0x4a4e52){if(_0x4a4e52){if(_0x4a4e52['length']===0x0){_0x52a298['and']('i.'+_0x526e3c+'\x20IS\x20NULL');}else{_0x52a298[_0x3671('0x42')]('i.'+_0x526e3c+'\x20IN\x20?',_['map'](_0x4a4e52,'id'));}}else if(!_0x1f6281[_0x526e3c]){_0x52a298['and']('i.'+_0x526e3c+'\x20IS\x20NOT\x20NULL');}})[_0x3671('0x57')](function(){return _0x52a298;});}function getClosedOrderClause(_0x476c8b,_0x116ca2){var _0x2631ee='';var _0x5ef8ea=[_0x3671('0x61'),_0x3671('0x62'),_0x3671('0x63')];if(_0x476c8b===_0x3671('0x2f')){_0x5ef8ea[_0x3671('0x64')](_0x3671('0x65'));}if(_0x116ca2[_0x3671('0x66')]==='0'&&_0x476c8b===_0x3671('0x2f')){_0x2631ee=_0x3671('0x65');}else{if(_0x116ca2['closed']==='1'){_0x5ef8ea[_0x3671('0x67')]();}_0x2631ee=_0x3671('0x68')+_0x5ef8ea['join'](',\x20')+')';}return _0x2631ee;}function getFilteredInteractions(_0x21536f,_0x57a5cb,_0x41d41a,_0x21782f){var _0x2d5de6=utils[_0x3671('0xd')](_0x21536f);var _0x3ce5d0=_[_0x3671('0x69')](_0x21536f)+_0x3671('0x6a');var _0x695ba6=[];var _0x4cf78a=getTagsQuery();var _0x15d0bb={'type':db[_0x3671('0x6b')][_0x3671('0x6c')][_0x3671('0x6d')],'raw':!![]};var _0xf5b478=[];var _0x4f04a3=[];return db[_0x3671('0x6e')][_0x3671('0x6f')](_0x4cf78a[_0x3671('0x70')](),_0x15d0bb)[_0x3671('0x57')](function(_0x15a9ed){_0x695ba6=_['keyBy'](_0x15a9ed,'id');_0x15d0bb=_['merge'](_0x15d0bb,{'model':db[_0x3ce5d0],'mapToModel':!![],'nest':!![]});if(_0x41d41a['fields']){_0x21782f['attributes']['forEach'](function(_0x8cb2e6){_0x57a5cb['field']('i.'+_0x8cb2e6);});}else{_0x57a5cb[_0x3671('0xb')](_0x3671('0x71'),_0x3671('0x40'));_0x57a5cb[_0x3671('0xb')]('a.key',_0x3671('0x72'));_0x57a5cb['field']('a.mandatoryDisposition',_0x3671('0x73'));if(_0x21536f===_0x3671('0x2f')){_0x57a5cb[_0x3671('0xb')](_0x3671('0x74'),_0x3671('0x75'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x76'),_0x3671('0x77'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x78'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x79'));_0x57a5cb['field'](_0x3671('0x7a'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x7b'));_0x57a5cb['field'](_0x3671('0x7c'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x7d'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x7e'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x7f'));_0x57a5cb[_0x3671('0xb')]('i.subject');_0x57a5cb[_0x3671('0xb')](_0x3671('0x63'));_0x57a5cb['field'](_0x3671('0x62'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x61'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x65'));_0x57a5cb[_0x3671('0xb')]('i.to');_0x57a5cb['field'](_0x3671('0x80'));_0x57a5cb[_0x3671('0xb')]('i.MailAccountId');_0x57a5cb[_0x3671('0xb')]('i.UserId');}else if(_0x21536f===_0x3671('0x2e')){_0x57a5cb[_0x3671('0xb')](_0x3671('0x81'),'contactName');}else{_0x57a5cb['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',_0x3671('0x77'));}if(_0x21536f!==_0x3671('0x2f')){_0x57a5cb['field']('i.*');}_0x57a5cb[_0x3671('0xb')](_0x3671('0x82'),_0x3671('0x83'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x84'),_0x3671('0x85'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x86'),_0x3671('0x87'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x88'),_0x3671('0x89'));_0x57a5cb[_0x3671('0xb')](_0x3671('0x8a'),_0x3671('0x8b'));_0x57a5cb['field'](_0x3671('0x8c'),_0x3671('0x8d'));_0x57a5cb[_0x3671('0xb')]('o.fullname',_0x3671('0x8e'));_0x57a5cb['field'](_0x3671('0x8f'),'Owner.internal');_0x57a5cb[_0x3671('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3671('0x90'));}if(_0x21782f[_0x3671('0x91')]){_0x57a5cb[_0x3671('0x91')](_0x21782f[_0x3671('0x91')]);}if(_0x21782f['offset']){_0x57a5cb['offset'](_0x21782f[_0x3671('0x92')]);}return db['sequelize'][_0x3671('0x6f')](_0x57a5cb[_0x3671('0x70')](),_0x15d0bb);})[_0x3671('0x57')](function(_0x3aa52f){_0xf5b478=_0x3aa52f;var _0x531c9a=getUsersQuery(_0x21536f,_0xf5b478);return db[_0x3671('0x6e')][_0x3671('0x6f')](_0x531c9a['toString'](),_0x15d0bb);})[_0x3671('0x57')](function(_0x223dc9){_0x4f04a3=_[_0x3671('0x93')](_0x223dc9,_0x2d5de6);if(_0x21536f==='mail'){return db[_0x3671('0x94')][_0x3671('0x95')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x3671('0x57')](function(_0x5cf532){var _0xbf37e3=_0x5cf532?_0x5cf532[_0x3671('0x96')]:undefined;var _0x17fccf=_0xf5b478[_0x3671('0x18')](function(_0x53aeb1){return updateInteraction(_0x53aeb1,_0x695ba6,_0x4f04a3,_0xbf37e3);});return Promise['all'](_0x17fccf);});}function countFilteredInteractions(_0x9da68e,_0x48b91a){var _0x5b021b=_0x9da68e[_0x3671('0x97')]();_0x5b021b['field']('COUNT(*)');_0x5b021b[_0x3671('0xb')](_0x3671('0x71'),'unreadMessages');var _0x1364b1=utils[_0x3671('0x25')](_0x48b91a);if(!_[_0x3671('0x98')](_0x1364b1)){_0x5b021b[_0x3671('0x16')](_0x3671('0x99'),_0x1364b1);}var _0x5f30b1={'type':db[_0x3671('0x6b')][_0x3671('0x6c')][_0x3671('0x6d')],'raw':!![]};return db[_0x3671('0x6e')]['query'](_0x5b021b[_0x3671('0x70')](),_0x5f30b1);}module[_0x3671('0x9a')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index ee27d20..f5034ca 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x631e=['talking','answered','unmanaged','abandoned','closed','disposition','UserId','MailMessage','findOne','-id','trimStart','then','Users','TagIds','Tags','catch','lodash','../../mysqldb','fullname','split','push','waiting'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x631e,0x102));var _0xe631=function(_0x1192a5,_0x56b4a4){_0x1192a5=_0x1192a5-0x0;var _0x1716f8=_0x631e[_0x1192a5];return _0x1716f8;};'use strict';var _=require(_0xe631('0x0'));var db=require(_0xe631('0x1'))['db'];function getInteractionUsers(_0xd51e33,_0x1c3cc6){return new Promise(function(_0x1dbde4,_0x289473){try{var _0x18eac6=[];if(_0x1c3cc6[_0xd51e33]){_0x18eac6=_0x1c3cc6[_0xd51e33]['map'](function(_0xf77ff3){return{'id':_0xf77ff3['id'],'fullname':_0xf77ff3[_0xe631('0x2')]};});}return _0x1dbde4(_0x18eac6);}catch(_0x2f051b){_0x289473(_0x2f051b);}});}function getInteractionTags(_0x29a8ea,_0x4547c5){var _0x8e0c92=[];if(_0x29a8ea){_0x29a8ea[_0xe631('0x3')](',')['forEach'](function(_0x452058){_0x8e0c92[_0xe631('0x4')](_0x4547c5[_0x452058]);});}return _0x8e0c92;}function updateWaitingCounter(_0x427c79){if(_0x427c79[_0xe631('0x5')]){_0x427c79[_0xe631('0x5')]-=0x1;}}function updateInteractionCounters(_0x4b7754){_0x4b7754[_0xe631('0x5')]=0x0;_0x4b7754[_0xe631('0x6')]=0x0;_0x4b7754[_0xe631('0x7')]=0x0;_0x4b7754[_0xe631('0x8')]=0x0;_0x4b7754[_0xe631('0x9')]=0x0;_0x4b7754['total']=0x0;if(_0x4b7754[_0xe631('0xa')]){if(_0x4b7754[_0xe631('0xb')]==='abandoned'){_0x4b7754[_0xe631('0x9')]+=0x1;updateWaitingCounter(_0x4b7754);}if(_0x4b7754[_0xe631('0xc')]){_0x4b7754[_0xe631('0x7')]+=0x1;if(_0x4b7754[_0xe631('0x6')]){_0x4b7754[_0xe631('0x6')]-=0x1;}}else{if(_0x4b7754[_0xe631('0xb')]){_0x4b7754['unmanaged']+=0x1;updateWaitingCounter(_0x4b7754);}}}else{if(!_0x4b7754['UserId']){_0x4b7754[_0xe631('0x5')]+=0x1;}if(_0x4b7754[_0xe631('0xc')]){_0x4b7754[_0xe631('0x6')]+=0x1;updateWaitingCounter(_0x4b7754);}}_0x4b7754['total']+=0x1;return _0x4b7754;}function getLastMessageText(_0x19c456){return db[_0xe631('0xd')][_0xe631('0xe')]({'where':{'$and':[{'MailInteractionId':_0x19c456['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xe631('0xf'),'raw':!![]})['then'](function(_0x1dd962){if(_0x1dd962&&_0x1dd962['plainBody']){_0x19c456['lastMsgText']=_[_0xe631('0x10')](_0x1dd962['plainBody']);}return _0x19c456;})['catch'](function(_0x3bc1f0){throw _0x3bc1f0;});}exports['updateInteraction']=function(_0xc9231c,_0xc6fc61,_0x519897,_0x2aef90){return new Promise(function(_0x4e2fee,_0x463bc4){return getInteractionUsers(_0xc9231c['id'],_0x519897)[_0xe631('0x11')](function(_0x2cfc1b){_0xc9231c[_0xe631('0x12')]=_0x2cfc1b;return getInteractionTags(_0xc9231c[_0xe631('0x13')],_0xc6fc61);})[_0xe631('0x11')](function(_0x29c059){_0xc9231c[_0xe631('0x14')]=_0x29c059;delete _0xc9231c[_0xe631('0x13')];return updateInteractionCounters(_0xc9231c);})['then'](function(_0xbbe3e5){if(_0x2aef90){return getLastMessageText(_0xbbe3e5);}else{return _0xbbe3e5;}})['then'](function(_0x1b0aab){_0x4e2fee(_0x1b0aab);})[_0xe631('0x15')](function(_0xbfada4){_0x463bc4(_0xbfada4);});});}; \ No newline at end of file +var _0xc963=['waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','map','fullname','forEach','push'];(function(_0x1621cb,_0x32c214){var _0x1e7bea=function(_0x5565cf){while(--_0x5565cf){_0x1621cb['push'](_0x1621cb['shift']());}};_0x1e7bea(++_0x32c214);}(_0xc963,0x7c));var _0x3c96=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0xc963[_0x385c76];return _0x5c8367;};'use strict';var _=require(_0x3c96('0x0'));var db=require(_0x3c96('0x1'))['db'];function getInteractionUsers(_0x300ecc,_0x2a9d79){return new Promise(function(_0x460b12,_0x4c9f0d){try{var _0x20efb1=[];if(_0x2a9d79[_0x300ecc]){_0x20efb1=_0x2a9d79[_0x300ecc][_0x3c96('0x2')](function(_0x15512b){return{'id':_0x15512b['id'],'fullname':_0x15512b[_0x3c96('0x3')]};});}return _0x460b12(_0x20efb1);}catch(_0xc5822a){_0x4c9f0d(_0xc5822a);}});}function getInteractionTags(_0x13a79c,_0x1e4dc6){var _0x386bd8=[];if(_0x13a79c){_0x13a79c['split'](',')[_0x3c96('0x4')](function(_0x49c789){_0x386bd8[_0x3c96('0x5')](_0x1e4dc6[_0x49c789]);});}return _0x386bd8;}function updateWaitingCounter(_0x5c0e1d){if(_0x5c0e1d[_0x3c96('0x6')]){_0x5c0e1d[_0x3c96('0x6')]-=0x1;}}function updateInteractionCounters(_0x537b37){_0x537b37['waiting']=0x0;_0x537b37[_0x3c96('0x7')]=0x0;_0x537b37[_0x3c96('0x8')]=0x0;_0x537b37[_0x3c96('0x9')]=0x0;_0x537b37[_0x3c96('0xa')]=0x0;_0x537b37[_0x3c96('0xb')]=0x0;if(_0x537b37['closed']){if(_0x537b37[_0x3c96('0xc')]==='abandoned'){_0x537b37[_0x3c96('0xa')]+=0x1;updateWaitingCounter(_0x537b37);}if(_0x537b37[_0x3c96('0xd')]){_0x537b37[_0x3c96('0x8')]+=0x1;if(_0x537b37[_0x3c96('0x7')]){_0x537b37[_0x3c96('0x7')]-=0x1;}}else{if(_0x537b37[_0x3c96('0xc')]){_0x537b37[_0x3c96('0x9')]+=0x1;updateWaitingCounter(_0x537b37);}}}else{if(!_0x537b37[_0x3c96('0xd')]){_0x537b37[_0x3c96('0x6')]+=0x1;}if(_0x537b37[_0x3c96('0xd')]){_0x537b37['talking']+=0x1;updateWaitingCounter(_0x537b37);}}_0x537b37['total']+=0x1;return _0x537b37;}function getLastMessageText(_0x364e40){return db[_0x3c96('0xe')][_0x3c96('0xf')]({'where':{'$and':[{'MailInteractionId':_0x364e40['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3c96('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3c96('0x11')],'order':_0x3c96('0x12'),'raw':!![]})[_0x3c96('0x13')](function(_0x2ad7a2){if(_0x2ad7a2&&_0x2ad7a2[_0x3c96('0x11')]){_0x364e40[_0x3c96('0x14')]=_[_0x3c96('0x15')](_0x2ad7a2['plainBody']);}return _0x364e40;})[_0x3c96('0x16')](function(_0x37ba45){throw _0x37ba45;});}exports[_0x3c96('0x17')]=function(_0x20e328,_0x904ac,_0x59f19a,_0x1aa3b2){return new Promise(function(_0x55b316,_0x27bf20){return getInteractionUsers(_0x20e328['id'],_0x59f19a)[_0x3c96('0x13')](function(_0x1bf80d){_0x20e328['Users']=_0x1bf80d;return getInteractionTags(_0x20e328[_0x3c96('0x18')],_0x904ac);})[_0x3c96('0x13')](function(_0x25b28d){_0x20e328[_0x3c96('0x19')]=_0x25b28d;delete _0x20e328[_0x3c96('0x18')];return updateInteractionCounters(_0x20e328);})[_0x3c96('0x13')](function(_0x34dc76){if(_0x1aa3b2){return getLastMessageText(_0x34dc76);}else{return _0x34dc76;}})[_0x3c96('0x13')](function(_0x59b5bb){_0x55b316(_0x59b5bb);})[_0x3c96('0x16')](function(_0x442061){_0x27bf20(_0x442061);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index b274327..88469db 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1041=['_interaction_has_tags','_messages','isArray','toLowerCase','name','role','null','Interaction','findOne','then','info','catch','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions'];(function(_0x31971c,_0x3a3ca3){var _0x5d9994=function(_0x15798d){while(--_0x15798d){_0x31971c['push'](_0x31971c['shift']());}};_0x5d9994(++_0x3a3ca3);}(_0x1041,0x157));var _0x1104=function(_0xf7c93e,_0x586f4b){_0xf7c93e=_0xf7c93e-0x0;var _0x2e3b2a=_0x1041[_0xf7c93e];return _0x2e3b2a;};'use strict';var _=require(_0x1104('0x0'));var db=require(_0x1104('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x1104('0x2')),'mail':require(_0x1104('0x3'))(_0x1104('0x4')),'fax':require('../../config/logger')(_0x1104('0x5')),'sms':require(_0x1104('0x3'))(_0x1104('0x6')),'chat':require(_0x1104('0x3'))('chat-interactions'),'whatsapp':require(_0x1104('0x3'))(_0x1104('0x7'))};function getAccountFK(_0x2f662d){return _[_0x1104('0x8')](_0x2f662d)+(_0x2f662d===_0x1104('0x9')?_0x1104('0xa'):_0x1104('0xb'))+'Id';}function getInteractionFK(_0x30fb4f){return _[_0x1104('0x8')](_0x30fb4f)+_0x1104('0xc');}function getInteractionId(_0x2901fa,_0x16b8e4,_0x197cda){if(_0x2901fa&&_0x2901fa[_[_0x1104('0xd')](_0x197cda)+_0x1104('0xc')]){return _0x2901fa[_[_0x1104('0xd')](_0x197cda)+_0x1104('0xc')];}else if(_0x2901fa&&_0x2901fa['id']){return _0x2901fa['id'];}else if(_0x16b8e4&&_0x16b8e4['id']){return _0x16b8e4['id'];}else{return _0x1104('0xe');}}function getInteractionsTables(_0x4be45f){return{'accounts':_0x4be45f+'_'+(_0x4be45f===_0x1104('0x9')?_0x1104('0xf'):'accounts'),'interactions':_0x4be45f+_0x1104('0x10'),'interactionsTags':_0x4be45f+_0x1104('0x11'),'messages':_0x4be45f+_0x1104('0x12'),'userInteractions':'user_has_'+_0x4be45f+_0x1104('0x10')};}function getSelectedTags(_0x409b64){var _0x18dd65=[];if(_0x409b64){_0x18dd65=Array[_0x1104('0x13')](_0x409b64)?_0x409b64:[_0x409b64];}return _0x18dd65;}function log(_0x177691,_0x386537,_0x4dae49,_0x5c3be5,_0x596965,_0xe90aa5){loggers[_0x596965[_0x1104('0x14')]()][_0x177691]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe90aa5['toUpperCase'](),_0x386537?_0x386537['id']:null,_0x386537?_0x386537[_0x1104('0x15')]:null,_0x386537?_0x386537[_0x1104('0x16')]:null,getInteractionId(_0x4dae49,_0x5c3be5,_0x596965),_0x4dae49?JSON['stringify'](_0x4dae49):_0x1104('0x17'));}function updateUser(_0x2f800f,_0xf701b2,_0x4131b8,_0x598a1b,_0x2ade1c){db[_['upperFirst'](_0x598a1b)+_0x1104('0x18')][_0x1104('0x19')]({'where':{'id':getInteractionId(_0xf701b2,_0x4131b8,_0x598a1b)}})['then'](function(_0x1bf3cb){if(_0x1bf3cb){return _0x1bf3cb['update']({'UserId':_0x2f800f?_0x2f800f['id']:null});}})[_0x1104('0x1a')](function(_0x3435d3){if(_0x3435d3){log(_0x1104('0x1b'),_0x2f800f,_0xf701b2,_0x4131b8,_0x598a1b,_0x2ade1c);}})[_0x1104('0x1c')](function(){log('error',_0x2f800f,_0xf701b2,_0x4131b8,_0x598a1b,_0x2ade1c);});}module[_0x1104('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x2f76=['unknown','websites','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','then','update','info','error','exports','lodash','../../mysqldb','../../config/logger','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x2f76,0xe5));var _0x62f7=function(_0x14219e,_0x4c974b){_0x14219e=_0x14219e-0x0;var _0x55f735=_0x2f76[_0x14219e];return _0x55f735;};'use strict';var _=require(_0x62f7('0x0'));var db=require(_0x62f7('0x1'))['db'];var loggers={'openchannel':require(_0x62f7('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x62f7('0x2'))('fax-interactions'),'sms':require(_0x62f7('0x2'))(_0x62f7('0x3')),'chat':require(_0x62f7('0x2'))('chat-interactions'),'whatsapp':require(_0x62f7('0x2'))(_0x62f7('0x4'))};function getAccountFK(_0x1a548d){return _[_0x62f7('0x5')](_0x1a548d)+(_0x1a548d===_0x62f7('0x6')?_0x62f7('0x7'):_0x62f7('0x8'))+'Id';}function getInteractionFK(_0x2708ef){return _[_0x62f7('0x5')](_0x2708ef)+_0x62f7('0x9');}function getInteractionId(_0x4e3c79,_0x556d3a,_0xd1d750){if(_0x4e3c79&&_0x4e3c79[_['upperFirst'](_0xd1d750)+_0x62f7('0x9')]){return _0x4e3c79[_[_0x62f7('0xa')](_0xd1d750)+_0x62f7('0x9')];}else if(_0x4e3c79&&_0x4e3c79['id']){return _0x4e3c79['id'];}else if(_0x556d3a&&_0x556d3a['id']){return _0x556d3a['id'];}else{return _0x62f7('0xb');}}function getInteractionsTables(_0x163dca){return{'accounts':_0x163dca+'_'+(_0x163dca===_0x62f7('0x6')?_0x62f7('0xc'):'accounts'),'interactions':_0x163dca+'_interactions','interactionsTags':_0x163dca+_0x62f7('0xd'),'messages':_0x163dca+_0x62f7('0xe'),'userInteractions':_0x62f7('0xf')+_0x163dca+_0x62f7('0x10')};}function getSelectedTags(_0x1b953b){var _0x94dd9d=[];if(_0x1b953b){_0x94dd9d=Array[_0x62f7('0x11')](_0x1b953b)?_0x1b953b:[_0x1b953b];}return _0x94dd9d;}function log(_0x2372d9,_0x584b9e,_0x392bc5,_0x176614,_0x372f78,_0x725ecc){loggers[_0x372f78[_0x62f7('0x12')]()][_0x2372d9]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x725ecc[_0x62f7('0x13')](),_0x584b9e?_0x584b9e['id']:null,_0x584b9e?_0x584b9e[_0x62f7('0x14')]:null,_0x584b9e?_0x584b9e[_0x62f7('0x15')]:null,getInteractionId(_0x392bc5,_0x176614,_0x372f78),_0x392bc5?JSON[_0x62f7('0x16')](_0x392bc5):'null');}function updateUser(_0x253054,_0x51c300,_0x30be18,_0x195403,_0x3ed280){db[_['upperFirst'](_0x195403)+_0x62f7('0x17')][_0x62f7('0x18')]({'where':{'id':getInteractionId(_0x51c300,_0x30be18,_0x195403)}})[_0x62f7('0x19')](function(_0xf400a9){if(_0xf400a9){return _0xf400a9[_0x62f7('0x1a')]({'UserId':_0x253054?_0x253054['id']:null});}})[_0x62f7('0x19')](function(_0x59a289){if(_0x59a289){log(_0x62f7('0x1b'),_0x253054,_0x51c300,_0x30be18,_0x195403,_0x3ed280);}})['catch'](function(){log(_0x62f7('0x1c'),_0x253054,_0x51c300,_0x30be18,_0x195403,_0x3ed280);});}module[_0x62f7('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index ea17f2a..740ce39 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 _0x679a=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util'];(function(_0x45e351,_0x234f5d){var _0x32453b=function(_0x16c8a5){while(--_0x16c8a5){_0x45e351['push'](_0x45e351['shift']());}};_0x32453b(++_0x234f5d);}(_0x679a,0x1b8));var _0xa679=function(_0x4566f7,_0x1812bc){_0x4566f7=_0x4566f7-0x0;var _0xc6428c=_0x679a[_0x4566f7];return _0xc6428c;};'use strict';var crypto=require(_0xa679('0x0'));var util=require(_0xa679('0x1'));var compose=require(_0xa679('0x2'));var db=require(_0xa679('0x3'))['db'];var config=require(_0xa679('0x4'));function getValueFromLicense(_0x58b008,_0x23522f){if(_0x58b008&&_0x23522f){if(_0x23522f[_0xa679('0x5')]&&_0x23522f[_0xa679('0x6')]){var _0x325257=_0x23522f[_0xa679('0x5')];var _0x59ac69=_0x23522f[_0xa679('0x6')];var _0x3c6692=_0x325257['split']('-')[0x4];var _0x3fa852=_0x325257[_0xa679('0x7')]('-')[0x0];var _0x5278bf=crypto[_0xa679('0x8')](_0xa679('0x9'),util[_0xa679('0xa')](_0xa679('0xb'),_0x3c6692,_0x325257,_0x3fa852));var _0x24cb15=_0x5278bf['update'](_0x59ac69,_0xa679('0xc'),_0xa679('0xd'));_0x24cb15+=_0x5278bf['final'](_0xa679('0xd'));var _0x3badaf=JSON['parse'](_0x24cb15);return _0x3badaf[_0xa679('0xe')](_0x58b008)?_0x3badaf[_0x58b008]:null;}}return null;}function isLimit(_0x29cbe4,_0x4ca36d,_0x3a5332,_0x122b39){var _0x44a098=_0x4ca36d;return compose()[_0xa679('0xf')](function(_0x44b4db,_0x462776,_0xdb3591){return db[_0xa679('0x10')][_0xa679('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xa679('0x12')](function(_0x58d9b5){var _0x12122e=getValueFromLicense(_0x29cbe4,_0x58d9b5);return _0x12122e?_0x12122e:_0x44a098;})[_0xa679('0x12')](function(_0xf20caa){_0x44a098=_0xf20caa;return _0x3a5332['count'](_0x122b39);})[_0xa679('0x12')](function(_0x419f1b){if(_0x419f1b>=_0x44a098){return _0x462776[_0xa679('0x13')](0x193)['json']({'message':util[_0xa679('0xa')](_0xa679('0x14'),_0x29cbe4)});}_0xdb3591();})[_0xa679('0x15')](function(_0x292138){_0xdb3591(_0x292138);});});}function isUserLimit(){return isLimit(_0xa679('0x16'),0x1,db[_0xa679('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xa679('0x18')}]}});}exports[_0xa679('0x19')]=isUserLimit; \ No newline at end of file +var _0x7ca3=['json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','hasOwnProperty','use','License','then','status'];(function(_0x3889ae,_0x4770c3){var _0x6533dd=function(_0x4275f7){while(--_0x4275f7){_0x3889ae['push'](_0x3889ae['shift']());}};_0x6533dd(++_0x4770c3);}(_0x7ca3,0xae));var _0x37ca=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0x7ca3[_0x45f4e9];return _0x559d8f;};'use strict';var crypto=require(_0x37ca('0x0'));var util=require(_0x37ca('0x1'));var compose=require(_0x37ca('0x2'));var db=require(_0x37ca('0x3'))['db'];var config=require(_0x37ca('0x4'));function getValueFromLicense(_0x4110e9,_0x174e1a){if(_0x4110e9&&_0x174e1a){if(_0x174e1a['data1']&&_0x174e1a['license']){var _0x3c4a1a=_0x174e1a[_0x37ca('0x5')];var _0x432254=_0x174e1a['license'];var _0x99455a=_0x3c4a1a[_0x37ca('0x6')]('-')[0x4];var _0x27c424=_0x3c4a1a['split']('-')[0x0];var _0x2861f8=crypto[_0x37ca('0x7')](_0x37ca('0x8'),util[_0x37ca('0x9')]('%s:%s:%s',_0x99455a,_0x3c4a1a,_0x27c424));var _0x496f8c=_0x2861f8[_0x37ca('0xa')](_0x432254,_0x37ca('0xb'),_0x37ca('0xc'));_0x496f8c+=_0x2861f8['final']('utf8');var _0x432cfc=JSON['parse'](_0x496f8c);return _0x432cfc[_0x37ca('0xd')](_0x4110e9)?_0x432cfc[_0x4110e9]:null;}}return null;}function isLimit(_0x4093d7,_0x13d797,_0x3e6626,_0x1e6803){var _0x4f15f2=_0x13d797;return compose()[_0x37ca('0xe')](function(_0x17526c,_0x40669f,_0x1e2f7b){return db[_0x37ca('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x121050){var _0x28afe3=getValueFromLicense(_0x4093d7,_0x121050);return _0x28afe3?_0x28afe3:_0x4f15f2;})[_0x37ca('0x10')](function(_0x2658f6){_0x4f15f2=_0x2658f6;return _0x3e6626['count'](_0x1e6803);})['then'](function(_0x39a934){if(_0x39a934>=_0x4f15f2){return _0x40669f[_0x37ca('0x11')](0x193)[_0x37ca('0x12')]({'message':util['format'](_0x37ca('0x13'),_0x4093d7)});}_0x1e2f7b();})[_0x37ca('0x14')](function(_0x1743b2){_0x1e2f7b(_0x1743b2);});});}function isUserLimit(){return isLimit(_0x37ca('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x37ca('0x16')}]}});}exports[_0x37ca('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4b5f3d9..bdfb21e 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 _0x9624=['push','DATE','operator','$eq','value','includes','$gt','add','days','format','castTo','text','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','conditions'];(function(_0x36fc16,_0x3d6e94){var _0xe02e16=function(_0x244371){while(--_0x244371){_0x36fc16['push'](_0x36fc16['shift']());}};_0xe02e16(++_0x3d6e94);}(_0x9624,0xcb));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4962('0x0'));var moment=require(_0x4962('0x1'));exports[_0x4962('0x2')]=function(_0x3f6143){var _0x31ab6f={'conditions':[]};_0x31ab6f[_0x4962('0x3')]=_[_0x4962('0x4')](_0x3f6143,_0x4962('0x5'))?'or':'and';var _0x361b04=_0x3f6143[_0x4962('0x6')](_0x4962('0x7'),'')[_0x4962('0x6')]('[$or]','')[_0x4962('0x8')]('||');for(var _0x34a249=0x0;_0x34a249<_0x361b04[_0x4962('0x9')];_0x34a249++){var _0xe6c5f1=_0x361b04[_0x34a249][_0x4962('0x8')](':=');var _0x57935d=_0xe6c5f1[0x0];var _0x1a244f=_0xe6c5f1[_0x4962('0xa')](0x1);_0x1a244f[_0x4962('0xb')](function(_0x462376){var _0x3328b6=_0x462376[_0x4962('0x8')]('[')[_0x4962('0xc')]();var _0x20e824=_0x462376[_0x4962('0xd')](/\[(.*?)\]/g);_0x20e824[_0x4962('0xb')](function(_0xd237f3){var _0xd2e189=_0xd237f3[_0x4962('0x8')]('[')[_0x4962('0xe')](function(_0x4079b2){return _0x4079b2[_0x4962('0xf')](']')>-0x1;})['map'](function(_0x2a513c){return _0x2a513c[_0x4962('0x8')](']')[0x0];})[0x0];_0x31ab6f[_0x4962('0x10')][_0x4962('0x11')]({'field':_0x57935d,'operator':_0x3328b6,'value':_0xd2e189});});});}return _0x31ab6f;};exports['buildExpression']=function(_0x50d819,_0x52978d,_0x183419){var _0xff5e41={};if(_0x52978d===_0x4962('0x12')){if(_0x183419[_0x4962('0x13')]===_0x4962('0x14')){_0x183419[_0x4962('0x13')]='$between';_0x183419[_0x4962('0x15')]+=','+_0x183419[_0x4962('0x15')];}else if(_[_0x4962('0x16')]([_0x4962('0x17'),'$lte'],_0x183419[_0x4962('0x13')])){_0x183419[_0x4962('0x15')]=moment(_0x183419[_0x4962('0x15')])[_0x4962('0x18')](0x1,_0x4962('0x19'))[_0x4962('0x1a')]('YYYY-MM-DD');}}if(_0x183419[_0x4962('0x1b')]){_0x52978d=_0x183419['castTo'];_0xff5e41[_0x4962('0x1c')]='CAST('+_0x50d819+'.'+_0x183419[_0x4962('0x1d')]+'\x20AS\x20'+_0x183419['castTo']+')\x20'+parseOperator(_0x183419[_0x4962('0x13')]);}else{_0xff5e41['text']=_0x50d819+'.'+_0x183419['field']+'\x20'+parseOperator(_0x183419[_0x4962('0x13')]);}if(_['includes']([_0x4962('0x1e'),_0x4962('0x1f')],_0x183419[_0x4962('0x13')]))_0xff5e41['text']='('+_0xff5e41[_0x4962('0x1c')]+_0x4962('0x20')+_0x50d819+'.'+_0x183419[_0x4962('0x1d')]+'\x20IS\x20NULL)';_0xff5e41[_0x4962('0x15')]=parseValue(_0x52978d,_0x183419[_0x4962('0x13')],_0x183419[_0x4962('0x15')]);return _0xff5e41;};function parseOperator(_0x3c003a){var _0x4505b1;switch(_0x3c003a){case _0x4962('0x21'):_0x4505b1=_0x4962('0x22');break;case'$notIn':_0x4505b1='NOT\x20IN\x20?';break;case _0x4962('0x14'):_0x4505b1='=\x20?';break;case _0x4962('0x1e'):_0x4505b1=_0x4962('0x23');break;case _0x4962('0x24'):case _0x4962('0x25'):case _0x4962('0x26'):_0x4505b1=_0x4962('0x27');break;case _0x4962('0x28'):_0x4505b1=_0x4962('0x29');break;case'$gt':_0x4505b1=_0x4962('0x2a');break;case _0x4962('0x2b'):_0x4505b1=_0x4962('0x2c');break;case _0x4962('0x2d'):_0x4505b1=_0x4962('0x2e');break;case _0x4962('0x2f'):_0x4505b1=_0x4962('0x30');break;}return _0x4505b1;}function parseValue(_0x1b0c1b,_0x1bb189,_0x2a6874){var _0x3a6818={'start':undefined,'end':undefined};switch(_0x1bb189){case _0x4962('0x21'):case _0x4962('0x1f'):_0x3a6818[_0x4962('0x31')]=_0x2a6874[_0x4962('0x8')](',');break;case _0x4962('0x24'):_0x3a6818['start']='%'+_0x2a6874+'%';break;case _0x4962('0x25'):_0x3a6818[_0x4962('0x31')]=_0x2a6874+'%';break;case'$endsWith':_0x3a6818['start']='%'+_0x2a6874;break;case _0x4962('0x2f'):var _0x2f22f7=_0x2a6874[_0x4962('0x8')](',');var _0x2a6874=_0x2f22f7['shift']();var _0x3b6be6=_0x2f22f7[_0x4962('0x32')]();if(_0x1b0c1b===_0x4962('0x12')){_0x2a6874=moment(_0x2a6874)[_0x4962('0x33')](0x0,!![])['format']();_0x3b6be6=moment(_0x3b6be6)['utcOffset'](0x0,!![])[_0x4962('0x18')](0x17,_0x4962('0x34'))[_0x4962('0x18')](0x3b,_0x4962('0x35'))[_0x4962('0x18')](0x3b,_0x4962('0x36'))[_0x4962('0x1a')]();}_0x3a6818={'start':_0x2a6874,'end':_0x3b6be6};break;default:_0x3a6818['start']=_0x2a6874;break;}return _0x3a6818;} \ No newline at end of file +var _0xb72e=['map','conditions','push','$eq','operator','value','$gt','$lte','days','format','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','>=\x20?','start','$substring','$between','DATE','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0xb72e,0xfe));var _0xeb72=function(_0x1a22e9,_0x4b0a43){_0x1a22e9=_0x1a22e9-0x0;var _0x3a0f93=_0xb72e[_0x1a22e9];return _0x3a0f93;};'use strict';var _=require(_0xeb72('0x0'));var moment=require(_0xeb72('0x1'));exports[_0xeb72('0x2')]=function(_0x471fe9){var _0x3d6c98={'conditions':[]};_0x3d6c98[_0xeb72('0x3')]=_[_0xeb72('0x4')](_0x471fe9,_0xeb72('0x5'))?'or':_0xeb72('0x6');var _0x5f237a=_0x471fe9[_0xeb72('0x7')](_0xeb72('0x8'),'')[_0xeb72('0x7')](_0xeb72('0x5'),'')[_0xeb72('0x9')]('||');for(var _0x2586af=0x0;_0x2586af<_0x5f237a[_0xeb72('0xa')];_0x2586af++){var _0x384522=_0x5f237a[_0x2586af][_0xeb72('0x9')](':=');var _0x47b0f0=_0x384522[0x0];var _0x2160dc=_0x384522['slice'](0x1);_0x2160dc[_0xeb72('0xb')](function(_0x475afc){var _0x151022=_0x475afc[_0xeb72('0x9')]('[')[_0xeb72('0xc')]();var _0x402d83=_0x475afc[_0xeb72('0xd')](/\[(.*?)\]/g);_0x402d83[_0xeb72('0xb')](function(_0xf05b22){var _0x3a072e=_0xf05b22[_0xeb72('0x9')]('[')[_0xeb72('0xe')](function(_0x158db3){return _0x158db3[_0xeb72('0xf')](']')>-0x1;})[_0xeb72('0x10')](function(_0x2ef2d8){return _0x2ef2d8[_0xeb72('0x9')](']')[0x0];})[0x0];_0x3d6c98[_0xeb72('0x11')][_0xeb72('0x12')]({'field':_0x47b0f0,'operator':_0x151022,'value':_0x3a072e});});});}return _0x3d6c98;};exports['buildExpression']=function(_0xc2e573,_0x4cb959,_0x3f2b81){var _0x1b43b4={};if(_0x4cb959==='DATE'){if(_0x3f2b81['operator']===_0xeb72('0x13')){_0x3f2b81[_0xeb72('0x14')]='$between';_0x3f2b81[_0xeb72('0x15')]+=','+_0x3f2b81[_0xeb72('0x15')];}else if(_['includes']([_0xeb72('0x16'),_0xeb72('0x17')],_0x3f2b81[_0xeb72('0x14')])){_0x3f2b81[_0xeb72('0x15')]=moment(_0x3f2b81[_0xeb72('0x15')])['add'](0x1,_0xeb72('0x18'))[_0xeb72('0x19')]('YYYY-MM-DD');}}if(_0x3f2b81['castTo']){_0x4cb959=_0x3f2b81[_0xeb72('0x1a')];_0x1b43b4[_0xeb72('0x1b')]=_0xeb72('0x1c')+_0xc2e573+'.'+_0x3f2b81[_0xeb72('0x1d')]+_0xeb72('0x1e')+_0x3f2b81['castTo']+')\x20'+parseOperator(_0x3f2b81[_0xeb72('0x14')]);}else{_0x1b43b4[_0xeb72('0x1b')]=_0xc2e573+'.'+_0x3f2b81['field']+'\x20'+parseOperator(_0x3f2b81[_0xeb72('0x14')]);}if(_[_0xeb72('0x1f')]([_0xeb72('0x20'),_0xeb72('0x21')],_0x3f2b81['operator']))_0x1b43b4['text']='('+_0x1b43b4[_0xeb72('0x1b')]+_0xeb72('0x22')+_0xc2e573+'.'+_0x3f2b81[_0xeb72('0x1d')]+_0xeb72('0x23');_0x1b43b4[_0xeb72('0x15')]=parseValue(_0x4cb959,_0x3f2b81['operator'],_0x3f2b81['value']);return _0x1b43b4;};function parseOperator(_0x23ba39){var _0x754048;switch(_0x23ba39){case _0xeb72('0x24'):_0x754048=_0xeb72('0x25');break;case _0xeb72('0x21'):_0x754048=_0xeb72('0x26');break;case'$eq':_0x754048='=\x20?';break;case _0xeb72('0x20'):_0x754048='<>\x20?';break;case'$substring':case _0xeb72('0x27'):case _0xeb72('0x28'):_0x754048=_0xeb72('0x29');break;case'$lt':_0x754048=_0xeb72('0x2a');break;case _0xeb72('0x16'):_0x754048=_0xeb72('0x2b');break;case'$lte':_0x754048='<=\x20?';break;case'$gte':_0x754048=_0xeb72('0x2c');break;case'$between':_0x754048='BETWEEN\x20?\x20AND\x20?';break;}return _0x754048;}function parseValue(_0x491440,_0x1ad5d9,_0x33f30d){var _0x32dd43={'start':undefined,'end':undefined};switch(_0x1ad5d9){case _0xeb72('0x24'):case'$notIn':_0x32dd43[_0xeb72('0x2d')]=_0x33f30d['split'](',');break;case _0xeb72('0x2e'):_0x32dd43[_0xeb72('0x2d')]='%'+_0x33f30d+'%';break;case _0xeb72('0x27'):_0x32dd43[_0xeb72('0x2d')]=_0x33f30d+'%';break;case _0xeb72('0x28'):_0x32dd43[_0xeb72('0x2d')]='%'+_0x33f30d;break;case _0xeb72('0x2f'):var _0x56d6c5=_0x33f30d[_0xeb72('0x9')](',');var _0x33f30d=_0x56d6c5[_0xeb72('0xc')]();var _0x363ff0=_0x56d6c5['pop']();if(_0x491440===_0xeb72('0x30')){_0x33f30d=moment(_0x33f30d)['utcOffset'](0x0,!![])[_0xeb72('0x19')]();_0x363ff0=moment(_0x363ff0)[_0xeb72('0x31')](0x0,!![])[_0xeb72('0x32')](0x17,_0xeb72('0x33'))[_0xeb72('0x32')](0x3b,_0xeb72('0x34'))['add'](0x3b,_0xeb72('0x35'))[_0xeb72('0x19')]();}_0x32dd43={'start':_0x33f30d,'end':_0x363ff0};break;default:_0x32dd43[_0xeb72('0x2d')]=_0x33f30d;break;}return _0x32dd43;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6e35a40..a946bb6 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 _0xee87=['alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','unsigned','DESC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','push','replace','{EXPR}','join','getOptions','$id','query','intersection','attributes','nolimit','order','pick','filter','columns','value','where','merge','VIRTUAL','lower','options','include','includeAll','sequelize','parse','keys','includes','model'];(function(_0x3c7936,_0x4bf3ec){var _0x56df6c=function(_0x18a2cf){while(--_0x18a2cf){_0x3c7936['push'](_0x3c7936['shift']());}};_0x56df6c(++_0x4bf3ec);}(_0xee87,0x193));var _0x7ee8=function(_0x170e52,_0x5d80e3){_0x170e52=_0x170e52-0x0;var _0x3a53e6=_0xee87[_0x170e52];return _0x3a53e6;};'use strict';var _=require('lodash');var sequelize=require(_0x7ee8('0x0'));var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4d7a1d){var _0x116675=['ne'];try{var _0xe4d376=JSON[_0x7ee8('0x1')](_0x4d7a1d);var _0x5b5055=Object[_0x7ee8('0x2')](_0xe4d376)[0x0];return _0x116675[_0x7ee8('0x3')](_0x5b5055);}catch(_0x5b530b){return![];}}function getOperatorValue(_0x34ee4a){var _0x1d0fe6=JSON[_0x7ee8('0x1')](_0x34ee4a);var _0x3ac05f=Object[_0x7ee8('0x2')](_0x1d0fe6)[0x0];var _0x346771=_0x1d0fe6[_0x3ac05f];return{['$'+_0x3ac05f]:_0x346771};}function parseIncludeModel(_0x2d26bd){var _0x294e37=JSON[_0x7ee8('0x1')](_0x2d26bd);return{'model':db[_0x294e37[_0x7ee8('0x4')]],'as':_0x294e37[_0x7ee8('0x5')],'attributes':_0x294e37[_0x7ee8('0x6')],'raw':_0x294e37[_0x7ee8('0x7')]};}exports['fields']=function(_0x967f9a){var _0x283388=null;if(_0x967f9a){_0x283388=_0x967f9a[_0x7ee8('0x8')](',');}return _0x283388;};exports[_0x7ee8('0x9')]=function(_0x5cf98b,_0xa91c36){var _0xcc032={};if(!_[_0x7ee8('0xa')](_0x5cf98b)){_[_0x7ee8('0xb')](_0x5cf98b,function(_0x14a856,_0x211685){try{if(_0xa91c36){var _0x3971ff=_[_0x7ee8('0xc')](_0xa91c36,{'name':_0x211685})||{};if(hasSequelizeOperator(_0x14a856)){_0xcc032[_0x211685]=getOperatorValue(_0x14a856);}else if(_0x3971ff[_0x7ee8('0xd')]===_0x7ee8('0xe')&&_[_0x7ee8('0xf')](_0x14a856)){var _0x3cb9eb=JSON[_0x7ee8('0x1')](_0x14a856);var _0x3ff469={'$gte':moment(moment(_0x3cb9eb[_0x7ee8('0x10')])[_0x7ee8('0x11')](_0x7ee8('0x12')))[_0x7ee8('0x13')]()[_0x7ee8('0x11')](),'$lte':moment(moment(_0x3cb9eb[_0x7ee8('0x14')])['format'](_0x7ee8('0x12')))[_0x7ee8('0x13')]()[_0x7ee8('0x15')](0x1,'s')[_0x7ee8('0x11')]()};_0xcc032[_0x211685]=_0x3ff469;}else if(_0x3971ff[_0x7ee8('0x16')]===_0x7ee8('0x17')){_0xcc032[_0x211685]=_0x14a856;}else{_0xcc032[_0x211685]=_[_0x7ee8('0x18')](_0x14a856)?_0x14a856:JSON['parse'](_0x14a856);}}else{_0xcc032[_0x211685]=_[_0x7ee8('0x18')](_0x14a856)?_0x14a856:JSON['parse'](_0x14a856);}}catch(_0x25250e){_0xcc032[_0x211685]=_0x14a856['split'](',');}});}return _0xcc032;};exports[_0x7ee8('0x19')]=function(_0x1e3f04){_0x1e3f04=parseInt(_0x1e3f04,0xa);if(!_0x1e3f04||_0x1e3f04<0x0){_0x1e3f04=LIMIT_VALUE;}return _0x1e3f04;};exports[_0x7ee8('0x1a')]=function(_0x9bcec7){_0x9bcec7=parseInt(_0x9bcec7,0xa);if(!_0x9bcec7||_0x9bcec7<0x0){_0x9bcec7=0x0;}return _0x9bcec7;};exports[_0x7ee8('0x1b')]=function(_0x2b8272){var _0x39c836,_0x13c3a7=null;if(_0x2b8272){_0x39c836=_0x2b8272[_0x7ee8('0x8')](',');_0x13c3a7=_[_0x7ee8('0x1c')](_0x39c836,function(_0x161d25){if(_0x161d25['indexOf']('-')===0x0){return[_0x161d25===_0x7ee8('0x1d')?sequelize[_0x7ee8('0x1e')](sequelize[_0x7ee8('0x1f')](_0x7ee8('0x1d')),_0x7ee8('0x20')):_0x161d25['substr'](0x1),_0x7ee8('0x21')];}else{return[_0x161d25===_0x7ee8('0x1d')?sequelize[_0x7ee8('0x1e')](sequelize[_0x7ee8('0x1f')](_0x7ee8('0x1d')),_0x7ee8('0x20')):_0x161d25,'ASC'];}});}return _0x13c3a7;};exports[_0x7ee8('0x22')]=function(_0x57cf44,_0x2234d2){if(_[_0x7ee8('0xa')](_0x57cf44)){return _0x57cf44;}if(_[_0x7ee8('0x18')](_0x57cf44)){for(var _0xb24832=0x0;_0xb24832<_0x57cf44['length'];_0xb24832+=0x1){_0x57cf44[_0xb24832]=this[_0x7ee8('0x22')](_0x57cf44[_0xb24832],_0x2234d2);}return _0x57cf44;}if(!_[_0x7ee8('0x23')](_0x57cf44)){return _0x57cf44;}if(_[_0x7ee8('0x24')](_0x2234d2)){_0x2234d2=[_0x2234d2];}if(!_[_0x7ee8('0x18')](_0x2234d2)){return _0x57cf44;}for(var _0x4a5e5c=0x0;_0x4a5e5c<_0x2234d2[_0x7ee8('0x25')];_0x4a5e5c+=0x1){_[_0x7ee8('0x26')](_0x57cf44,_0x2234d2[_0x4a5e5c]);}for(var _0x53c97e in _0x57cf44){if(_0x57cf44[_0x7ee8('0x27')](_0x53c97e)){_0x57cf44[_0x53c97e]=this['omit'](_0x57cf44[_0x53c97e],_0x2234d2);}}return _0x57cf44;};exports[_0x7ee8('0x28')]=function(_0x2b67ba){return _0x2b67ba[_0x7ee8('0x29')](RegExp(_0x7ee8('0x2a')))?!![]:![];};exports[_0x7ee8('0x2b')]=function(_0x58a033){return _0x58a033['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7ee8('0x2c')]=function(_0x39b22a,_0x437e49){var _0x540dcf=[];var _0x30c78d=/[ `!@#$%^&*()_\-?~]/;var _0x43f698=_0x437e49?_0x7ee8('0x2d'):'{EXPR}';_0x39b22a['split'](/[ ,]+/)['forEach'](function(_0x2a2540){_0x2a2540=_0x2a2540['replace'](/([^:]")"+/g,'$1');_0x2a2540='+'+_0x2a2540+'*';var _0x5f4f6c=_0x2a2540[_0x7ee8('0x29')](_0x30c78d);if(_0x5f4f6c){_0x2a2540='\x22'+_0x2a2540+'\x22';}_0x540dcf[_0x7ee8('0x2e')](_0x2a2540);});_0x43f698=_0x43f698[_0x7ee8('0x2f')](_0x7ee8('0x30'),_0x540dcf[_0x7ee8('0x31')]('\x20'));return _0x43f698;};exports[_0x7ee8('0x32')]=function(_0x2906a7,_0x4a0aa3,_0x19a8c5){var _0x36e6d0={},_0x394b12={};if(_0x4a0aa3['query'][_0x7ee8('0x33')]){_0x4a0aa3[_0x7ee8('0x34')]['id']=_0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x33')];delete _0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x33')];}_0x36e6d0['model']=_['map'](_0x2906a7,'name');_0x36e6d0[_0x7ee8('0x34')]=_[_0x7ee8('0x2')](_0x4a0aa3[_0x7ee8('0x34')]);_0x36e6d0[_0x7ee8('0x9')]=_[_0x7ee8('0x35')](_0x36e6d0[_0x7ee8('0x4')],_0x36e6d0[_0x7ee8('0x34')]);_0x394b12[_0x7ee8('0x36')]=_[_0x7ee8('0x35')](_0x36e6d0['model'],this[_0x7ee8('0x6')](_0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x6')]));_0x394b12[_0x7ee8('0x36')]=_0x394b12[_0x7ee8('0x36')][_0x7ee8('0x25')]?_0x394b12[_0x7ee8('0x36')]:_0x36e6d0[_0x7ee8('0x4')];if(!_0x4a0aa3[_0x7ee8('0x34')]['hasOwnProperty'](_0x7ee8('0x37'))){_0x394b12[_0x7ee8('0x19')]=this[_0x7ee8('0x19')](_0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x19')]);_0x394b12[_0x7ee8('0x1a')]=this['offset'](_0x4a0aa3[_0x7ee8('0x34')]['offset']);}_0x394b12[_0x7ee8('0x38')]=this[_0x7ee8('0x1b')](_0x4a0aa3[_0x7ee8('0x34')]['sort']);_0x394b12['where']=this[_0x7ee8('0x9')](_[_0x7ee8('0x39')](_0x4a0aa3[_0x7ee8('0x34')],_0x36e6d0[_0x7ee8('0x9')]),_0x2906a7);if(_0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x3a')]){var _0x16b91f=_0x2906a7;var _0x128ad6=_0x4a0aa3['query'][_0x7ee8('0x3a')];if(typeof _0x128ad6==='object'){_0x16b91f=_['filter'](_0x2906a7,function(_0x483f13){return _[_0x7ee8('0x3')](_0x128ad6[_0x7ee8('0x3b')],_0x483f13[_0x7ee8('0x16')]);});_0x128ad6=_0x128ad6[_0x7ee8('0x3c')];}_0x394b12[_0x7ee8('0x3d')]=_[_0x7ee8('0x3e')](_0x394b12[_0x7ee8('0x3d')],{'$or':_['map'](_0x16b91f,function(_0x2abaf4){if(_0x2abaf4[_0x7ee8('0xd')]!==_0x7ee8('0x3f')){if(_0x19a8c5){return sequelize[_0x7ee8('0x3d')](sequelize['fn'](_0x7ee8('0x40'),sequelize['col'](_0x2abaf4[_0x7ee8('0x16')])),{'$like':sequelize['fn'](_0x7ee8('0x40'),'%'+_0x4a0aa3[_0x7ee8('0x34')][_0x7ee8('0x3a')]+'%')});}else{var _0x2da8b7={};_0x2da8b7[_0x2abaf4[_0x7ee8('0x16')]]={'$like':'%'+_0x4a0aa3[_0x7ee8('0x34')]['filter']+'%'};return _0x2da8b7;}}})});}_0x394b12=_[_0x7ee8('0x3e')]({},_0x394b12,_0x4a0aa3[_0x7ee8('0x41')]);return _0x394b12;};exports[_0x7ee8('0x42')]=function(_0x473cd4){var _0x3b2f4e=[];if(_0x473cd4[_0x7ee8('0x43')]){_0x3b2f4e[_0x7ee8('0x2e')]({'all':!![]});}else if(_0x473cd4[_0x7ee8('0x42')]){if(Array['isArray'](_0x473cd4[_0x7ee8('0x42')])){_0x3b2f4e=Object[_0x7ee8('0x2')](_0x473cd4[_0x7ee8('0x42')])['map'](function(_0x224df8){return parseIncludeModel(_0x473cd4['include'][_0x224df8]);});}else{var _0x4d6b40=parseIncludeModel(_0x473cd4[_0x7ee8('0x42')]);_0x3b2f4e[_0x7ee8('0x2e')](_0x4d6b40);}}return _0x3b2f4e;}; \ No newline at end of file +var _0x8595=['merge','VIRTUAL','lower','options','include','push','lodash','sequelize','moment','keys','includes','parse','model','fields','raw','filters','isEmpty','forOwn','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','isArray','offset','sort','split','map','indexOf','priority','unsigned','substr','cast','col','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','{EXPR}','join','getOptions','$id','query','name','attributes','intersection','limit','order','where','pick','filter'];(function(_0x1cef3c,_0x5561d6){var _0x4f0d8=function(_0x1d2bcc){while(--_0x1d2bcc){_0x1cef3c['push'](_0x1cef3c['shift']());}};_0x4f0d8(++_0x5561d6);}(_0x8595,0x1b8));var _0x5859=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8595[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x5859('0x0'));var sequelize=require(_0x5859('0x1'));var moment=require(_0x5859('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1fb2a1){var _0x3f5d0f=['ne'];try{var _0x1209e8=JSON['parse'](_0x1fb2a1);var _0x4186b7=Object[_0x5859('0x3')](_0x1209e8)[0x0];return _0x3f5d0f[_0x5859('0x4')](_0x4186b7);}catch(_0x4e7014){return![];}}function getOperatorValue(_0x3478bd){var _0x26c867=JSON[_0x5859('0x5')](_0x3478bd);var _0x347852=Object[_0x5859('0x3')](_0x26c867)[0x0];var _0x48db47=_0x26c867[_0x347852];return{['$'+_0x347852]:_0x48db47};}function parseIncludeModel(_0x1a735f){var _0x596175=JSON['parse'](_0x1a735f);return{'model':db[_0x596175[_0x5859('0x6')]],'as':_0x596175['alias'],'attributes':_0x596175[_0x5859('0x7')],'raw':_0x596175[_0x5859('0x8')]};}exports[_0x5859('0x7')]=function(_0x4bd4d2){var _0x42f690=null;if(_0x4bd4d2){_0x42f690=_0x4bd4d2['split'](',');}return _0x42f690;};exports[_0x5859('0x9')]=function(_0x11de8d,_0x1fde0c){var _0x5960d2={};if(!_[_0x5859('0xa')](_0x11de8d)){_[_0x5859('0xb')](_0x11de8d,function(_0x41ddee,_0x59636c){try{if(_0x1fde0c){var _0x4f1b18=_[_0x5859('0xc')](_0x1fde0c,{'name':_0x59636c})||{};if(hasSequelizeOperator(_0x41ddee)){_0x5960d2[_0x59636c]=getOperatorValue(_0x41ddee);}else if(_0x4f1b18['type']==='DATE'&&_[_0x5859('0xd')](_0x41ddee)){var _0x434887=JSON[_0x5859('0x5')](_0x41ddee);var _0x1d6e90={'$gte':moment(moment(_0x434887[_0x5859('0xe')])[_0x5859('0xf')](_0x5859('0x10')))[_0x5859('0x11')]()[_0x5859('0xf')](),'$lte':moment(moment(_0x434887['$lte'])[_0x5859('0xf')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0x5859('0xf')]()};_0x5960d2[_0x59636c]=_0x1d6e90;}else if(_0x4f1b18['name']==='uniqueid'){_0x5960d2[_0x59636c]=_0x41ddee;}else{_0x5960d2[_0x59636c]=_[_0x5859('0x12')](_0x41ddee)?_0x41ddee:JSON[_0x5859('0x5')](_0x41ddee);}}else{_0x5960d2[_0x59636c]=_[_0x5859('0x12')](_0x41ddee)?_0x41ddee:JSON[_0x5859('0x5')](_0x41ddee);}}catch(_0x180ed3){_0x5960d2[_0x59636c]=_0x41ddee['split'](',');}});}return _0x5960d2;};exports['limit']=function(_0x35d58f){_0x35d58f=parseInt(_0x35d58f,0xa);if(!_0x35d58f||_0x35d58f<0x0){_0x35d58f=LIMIT_VALUE;}return _0x35d58f;};exports[_0x5859('0x13')]=function(_0x2e698d){_0x2e698d=parseInt(_0x2e698d,0xa);if(!_0x2e698d||_0x2e698d<0x0){_0x2e698d=0x0;}return _0x2e698d;};exports[_0x5859('0x14')]=function(_0x3428d6){var _0x2c1cbd,_0x211546=null;if(_0x3428d6){_0x2c1cbd=_0x3428d6[_0x5859('0x15')](',');_0x211546=_[_0x5859('0x16')](_0x2c1cbd,function(_0x17a91e){if(_0x17a91e[_0x5859('0x17')]('-')===0x0){return[_0x17a91e===_0x5859('0x18')?sequelize['cast'](sequelize['col'](_0x5859('0x18')),_0x5859('0x19')):_0x17a91e[_0x5859('0x1a')](0x1),'DESC'];}else{return[_0x17a91e===_0x5859('0x18')?sequelize[_0x5859('0x1b')](sequelize[_0x5859('0x1c')](_0x5859('0x18')),_0x5859('0x19')):_0x17a91e,_0x5859('0x1d')];}});}return _0x211546;};exports[_0x5859('0x1e')]=function(_0x2d347b,_0xf23235){if(_['isEmpty'](_0x2d347b)){return _0x2d347b;}if(_[_0x5859('0x12')](_0x2d347b)){for(var _0x16cc7a=0x0;_0x16cc7a<_0x2d347b['length'];_0x16cc7a+=0x1){_0x2d347b[_0x16cc7a]=this[_0x5859('0x1e')](_0x2d347b[_0x16cc7a],_0xf23235);}return _0x2d347b;}if(!_[_0x5859('0x1f')](_0x2d347b)){return _0x2d347b;}if(_[_0x5859('0x20')](_0xf23235)){_0xf23235=[_0xf23235];}if(!_['isArray'](_0xf23235)){return _0x2d347b;}for(var _0x55fb20=0x0;_0x55fb20<_0xf23235[_0x5859('0x21')];_0x55fb20+=0x1){_[_0x5859('0x22')](_0x2d347b,_0xf23235[_0x55fb20]);}for(var _0x1b3b13 in _0x2d347b){if(_0x2d347b[_0x5859('0x23')](_0x1b3b13)){_0x2d347b[_0x1b3b13]=this['omit'](_0x2d347b[_0x1b3b13],_0xf23235);}}return _0x2d347b;};exports[_0x5859('0x24')]=function(_0x34d1bd){return _0x34d1bd[_0x5859('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x5859('0x26')]=function(_0x1b33e0){return _0x1b33e0[_0x5859('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x5859('0x27')]=function(_0x5612fa,_0x4de5d5){var _0x3a7c2d=[];var _0x42d298=/[ `!@#$%^&*()_\-?~]/;var _0x45756c=_0x4de5d5?_0x5859('0x28'):'{EXPR}';_0x5612fa[_0x5859('0x15')](/[ ,]+/)[_0x5859('0x29')](function(_0x40e26f){_0x40e26f=_0x40e26f[_0x5859('0x2a')](/([^:]")"+/g,'$1');_0x40e26f='+'+_0x40e26f+'*';var _0x559316=_0x40e26f[_0x5859('0x25')](_0x42d298);if(_0x559316){_0x40e26f='\x22'+_0x40e26f+'\x22';}_0x3a7c2d['push'](_0x40e26f);});_0x45756c=_0x45756c[_0x5859('0x2a')](_0x5859('0x2b'),_0x3a7c2d[_0x5859('0x2c')]('\x20'));return _0x45756c;};exports[_0x5859('0x2d')]=function(_0xb94e4c,_0x458a3f,_0x201906){var _0x334bf8={},_0x39fa74={};if(_0x458a3f['query'][_0x5859('0x2e')]){_0x458a3f[_0x5859('0x2f')]['id']=_0x458a3f['query'][_0x5859('0x2e')];delete _0x458a3f[_0x5859('0x2f')][_0x5859('0x2e')];}_0x334bf8[_0x5859('0x6')]=_[_0x5859('0x16')](_0xb94e4c,_0x5859('0x30'));_0x334bf8[_0x5859('0x2f')]=_['keys'](_0x458a3f['query']);_0x334bf8[_0x5859('0x9')]=_['intersection'](_0x334bf8[_0x5859('0x6')],_0x334bf8[_0x5859('0x2f')]);_0x39fa74[_0x5859('0x31')]=_[_0x5859('0x32')](_0x334bf8['model'],this[_0x5859('0x7')](_0x458a3f[_0x5859('0x2f')]['fields']));_0x39fa74[_0x5859('0x31')]=_0x39fa74[_0x5859('0x31')][_0x5859('0x21')]?_0x39fa74[_0x5859('0x31')]:_0x334bf8[_0x5859('0x6')];if(!_0x458a3f[_0x5859('0x2f')][_0x5859('0x23')]('nolimit')){_0x39fa74['limit']=this[_0x5859('0x33')](_0x458a3f['query']['limit']);_0x39fa74['offset']=this['offset'](_0x458a3f['query']['offset']);}_0x39fa74[_0x5859('0x34')]=this[_0x5859('0x14')](_0x458a3f[_0x5859('0x2f')]['sort']);_0x39fa74[_0x5859('0x35')]=this['filters'](_[_0x5859('0x36')](_0x458a3f['query'],_0x334bf8[_0x5859('0x9')]),_0xb94e4c);if(_0x458a3f[_0x5859('0x2f')]['filter']){var _0x551652=_0xb94e4c;var _0x5b7b12=_0x458a3f['query'][_0x5859('0x37')];if(typeof _0x5b7b12==='object'){_0x551652=_[_0x5859('0x37')](_0xb94e4c,function(_0x13f4d8){return _[_0x5859('0x4')](_0x5b7b12['columns'],_0x13f4d8[_0x5859('0x30')]);});_0x5b7b12=_0x5b7b12['value'];}_0x39fa74[_0x5859('0x35')]=_[_0x5859('0x38')](_0x39fa74[_0x5859('0x35')],{'$or':_[_0x5859('0x16')](_0x551652,function(_0x527e02){if(_0x527e02['type']!==_0x5859('0x39')){if(_0x201906){return sequelize[_0x5859('0x35')](sequelize['fn'](_0x5859('0x3a'),sequelize[_0x5859('0x1c')](_0x527e02['name'])),{'$like':sequelize['fn'](_0x5859('0x3a'),'%'+_0x458a3f[_0x5859('0x2f')][_0x5859('0x37')]+'%')});}else{var _0x141065={};_0x141065[_0x527e02[_0x5859('0x30')]]={'$like':'%'+_0x458a3f['query'][_0x5859('0x37')]+'%'};return _0x141065;}}})});}_0x39fa74=_[_0x5859('0x38')]({},_0x39fa74,_0x458a3f[_0x5859('0x3b')]);return _0x39fa74;};exports[_0x5859('0x3c')]=function(_0x715a0e){var _0x5c85c5=[];if(_0x715a0e['includeAll']){_0x5c85c5[_0x5859('0x3d')]({'all':!![]});}else if(_0x715a0e[_0x5859('0x3c')]){if(Array[_0x5859('0x12')](_0x715a0e['include'])){_0x5c85c5=Object['keys'](_0x715a0e['include'])[_0x5859('0x16')](function(_0x5c661f){return parseIncludeModel(_0x715a0e['include'][_0x5c661f]);});}else{var _0x414649=parseIncludeModel(_0x715a0e[_0x5859('0x3c')]);_0x5c85c5[_0x5859('0x3d')](_0x414649);}}return _0x5c85c5;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 790fd44..1a79721 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','destconnectedlinenum','onhold','lodash','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','unknown','*pause','busy','map','findOne','getAgents','all','uniq','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','whatsappPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','toLowerCase','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity'];(function(_0x46ba98,_0x2970c6){var _0x382e4e=function(_0x20bad1){while(--_0x20bad1){_0x46ba98['push'](_0x46ba98['shift']());}};_0x382e4e(++_0x2970c6);}(_0x2675,0x75));var _0x5267=function(_0x5f2c16,_0x3c9ddd){_0x5f2c16=_0x5f2c16-0x0;var _0x28c9f1=_0x2675[_0x5f2c16];return _0x28c9f1;};'use strict';var _=require(_0x5267('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x5267('0x1')]({'port':0x232a});var routingClient=jayson[_0x5267('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x4600fa,_0x36bdf0){var _0x4e2548=[_0x4600fa[_0x5267('0x3')],_0x4600fa[_0x5267('0x4')],_0x4600fa[_0x5267('0x5')],_0x4600fa[_0x5267('0x6')],_0x4600fa[_0x5267('0x7')],_0x4600fa[_0x5267('0x8')],_0x4600fa['whatsappPause']];if(!_0x36bdf0)return _[_0x5267('0x9')](_0x4e2548);var _0x46bfdf=_['filter'](_0x4e2548);return _0x46bfdf[_0x5267('0xa')]>0x0&&_0x46bfdf['length']<_0x4e2548[_0x5267('0xa')]?!![]:![];}function isIdle(_0x207d47){return _0x207d47===_0x5267('0xb')||_0x207d47==='unknown'||_0x207d47===_0x5267('0xc')||_0x207d47==='ringing'||_[_0x5267('0xd')](_0x207d47);}function isAgentIdle(_0x5bbf00){if(_0x5bbf00[_0x5267('0xe')]!==_0x5267('0xb')&&_0x5bbf00[_0x5267('0x8')]){_0x5bbf00[_0x5267('0xe')]=_0x5267('0xf');return![];}return _[_0x5267('0x9')]([_0x5bbf00[_0x5267('0x10')],_0x5bbf00[_0x5267('0x11')],_0x5bbf00[_0x5267('0x12')],_0x5bbf00[_0x5267('0x13')],_0x5bbf00[_0x5267('0x14')],_0x5bbf00[_0x5267('0xe')],_0x5bbf00[_0x5267('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x5267('0x16')](function(_0x40d897){if(_0x40d897[_0x5267('0x17')]){throw new Error(_0x5267('0x18'));}var _0x46b2c2=_0x40d897[_0x5267('0x19')];return routingClient[_0x5267('0x1a')](_0x5267('0x1b'),{})[_0x5267('0x16')](function(_0xb1c97a){if(_0xb1c97a[_0x5267('0x17')]){throw new Error(_0x5267('0x1c'));}var _0x528d61=_0xb1c97a[_0x5267('0x19')];return _[_0x5267('0x1d')]({},_0x46b2c2,_0x528d61);});})['catch'](function(_0x20cb50){throw _0x20cb50;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x1cf835){var _0x1019e7=_0x5267('0x1e');if(isAgentPaused(_0x1cf835))_0x1019e7=_0x5267('0xf');else if(isAgentPaused(_0x1cf835,!![]))_0x1019e7=_0x5267('0x1f');else if(isAgentIdle(_0x1cf835))_0x1019e7='idle';else _0x1019e7=_0x5267('0x20');return _0x1019e7;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0xa32663,_0x420fb8){var _0x3b53ac=_['isArray'](_0xa32663)?_0xa32663:[_0xa32663];var _0x499f19=_['startCase'](_0x420fb8)+'Queue';var _0x5ea6a6=_[_0x5267('0x21')](_0x3b53ac,function(_0x399e64){return db[_0x499f19][_0x5267('0x22')]({'where':{'id':_0x399e64}})[_0x5267('0x16')](function(_0x11c8ea){if(!_0x11c8ea)return[];return _0x11c8ea[_0x5267('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5267('0x24')](_0x5ea6a6)[_0x5267('0x16')](function(_0x2cdc45){var _0x59f112=_(_0x2cdc45)['flatten']()[_0x5267('0x21')]('id')[_0x5267('0x25')]()['value']();return _0x59f112;});}exports[_0x5267('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52504e,_0x4d7c2a,_0x43e7e7){try{if(_0x4d7c2a[_0x5267('0xa')]>0x0){_0x52504e=_0x52504e[_0x5267('0x27')](function(_0x2d2ace){return _0x4d7c2a[_0x5267('0x28')](_0x2d2ace['id']);});}var _0x4f3d4d=_0x52504e['filter'](function(_0x18020c){var _0x10a68c=_0x5267('0x20');if(isAgentIdle(_0x18020c)){_0x10a68c='idle';}return _0x10a68c===_0x43e7e7;});return _['map'](_0x4f3d4d,'id');}catch(_0xbe7922){throw _0xbe7922;}}exports[_0x5267('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1fa725,_0x5bec7e,_0x59b091){return Promise[_0x5267('0x2a')]()[_0x5267('0x16')](function(){if(_0x5bec7e[_0x5267('0xa')]>0x0){_0x1fa725=_0x1fa725[_0x5267('0x27')](function(_0x5bbb83){return _0x5bec7e[_0x5267('0x28')](_0x5bbb83['id']);});}return _0x1fa725;})[_0x5267('0x16')](function(){return db[_0x5267('0x2b')][_0x5267('0x2c')]({'attributes':['id',_0x5267('0x2d'),_0x5267('0x2e'),_0x5267('0x3'),_0x5267('0x4'),'mailPause','openchannelPause',_0x5267('0x7'),'voicePause',_0x5267('0x2f'),_0x5267('0x30')],'where':{'id':{'$in':_[_0x5267('0x21')](_0x1fa725,'id')}},'raw':!![]});})[_0x5267('0x16')](function(_0x4ac4a0){return _0x4ac4a0[_0x5267('0x21')](function(_0xdd06f){var _0x3c6c1a=_[_0x5267('0x31')](_0x1fa725,['id',_0xdd06f['id']]);var _0x35fd12=filterAgentAttributes(_0x3c6c1a);_[_0x5267('0x1d')](_0xdd06f,_0x35fd12);_0xdd06f[_0x5267('0x32')]=getAgentStatus(_0xdd06f);return _0xdd06f;});})[_0x5267('0x16')](function(_0x484b77){var _0x1b297c=sortAgentsByStatus(_0x484b77,_0x59b091);return _['map'](_0x1b297c,'id');})[_0x5267('0x33')](function(_0x335c0e){throw _0x335c0e;});}exports[_0x5267('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x365d98){var _0x41e58b={'fields':[],'order':null};var _0x33ecd7=_0x365d98[_0x5267('0x35')](',');_0x41e58b['fields']=_[_0x5267('0x27')](_0x33ecd7,function(_0x3a2e07){if(!_0x3a2e07[_0x5267('0x28')](_0x5267('0x32'))){return!![];}_0x41e58b[_0x5267('0x36')]=_[_0x5267('0x37')](_0x3a2e07,'-')?_0x5267('0x38'):'ASC';return![];});return _0x41e58b;}exports[_0x5267('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x5ef02e){if(!_0x5ef02e){_0x5ef02e=_0x5267('0x3a');}if(_0x5ef02e['includes']('fullname')&&!_0x5ef02e['includes'](_0x5267('0x3b'))){var _0x50302f=_0x5ef02e[_0x5267('0x3c')](0x0,_0x5ef02e[_0x5267('0x3d')](_0x5267('0x2e')));_0x5ef02e+=','+_0x50302f+_0x5267('0x3b');}return _0x5ef02e;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x456b33,_0x805587){var _0x588edf=_0x456b33['sort'](function(_0x3e1483,_0x560cdf){if(_0x3e1483[_0x5267('0x32')]===_0x560cdf[_0x5267('0x32')]){if(_0x3e1483[_0x5267('0x32')]===_0x5267('0xf')){if(_0x805587===_0x5267('0x38')){return(_0x3e1483[_0x5267('0x30')]||'')<(_0x560cdf[_0x5267('0x30')]||'')||_0x3e1483['fullname']['toLowerCase']()>_0x560cdf[_0x5267('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x3e1483[_0x5267('0x30')]||'')<(_0x560cdf[_0x5267('0x30')]||'')||_0x3e1483['fullname'][_0x5267('0x3e')]()>_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?-0x1:0x1;}}else{if(_0x805587===_0x5267('0x38')){return _0x3e1483[_0x5267('0x2e')][_0x5267('0x3e')]()<_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?0x1:-0x1;}else{return _0x3e1483[_0x5267('0x2e')]['toLowerCase']()<_0x560cdf[_0x5267('0x2e')][_0x5267('0x3e')]()?-0x1:0x1;}}}else{if(_0x805587===_0x5267('0x38')){return _0x3e1483[_0x5267('0x32')]<_0x560cdf[_0x5267('0x32')]?0x1:-0x1;}else{return _0x3e1483['globalStatus']<_0x560cdf[_0x5267('0x32')]?-0x1:0x1;}}});return _0x588edf;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x21e2cb){var _0x5cda8c=['userpic',_0x5267('0x3f'),'lastLoginAt',_0x5267('0x40'),_0x5267('0x30'),_0x5267('0x40'),_0x5267('0x3b'),'address',_0x5267('0x3'),'openchannelPause','mailPause',_0x5267('0x7'),_0x5267('0x2f'),'faxPause','voicePause',_0x5267('0x41'),_0x5267('0x42'),_0x5267('0x43'),_0x5267('0x44'),_0x5267('0x45'),_0x5267('0x46'),_0x5267('0x47'),_0x5267('0x48'),_0x5267('0x49'),_0x5267('0x4a'),_0x5267('0x4b'),_0x5267('0x4c'),_0x5267('0x10'),_0x5267('0x13'),'mailStatus',_0x5267('0x14'),_0x5267('0x15'),_0x5267('0x11'),'voiceStatus',_0x5267('0x4d'),_0x5267('0x4e'),_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x51'),_0x5267('0x52'),'voiceStatusTime',_0x5267('0x53'),'destconnectedlinenum',_0x5267('0x54'),_0x5267('0x55'),_0x5267('0x56'),_0x5267('0x57')];var _0x91b932=[_0x5267('0x3'),_0x5267('0x6'),'mailPause','smsPause',_0x5267('0x2f'),_0x5267('0x4'),'voicePause',_0x5267('0x3f')];var _0x578e4e=_(_0x21e2cb)['omit'](_0x91b932)[_0x5267('0x58')](_0x5cda8c)[_0x5267('0x59')]();return _0x578e4e;}exports[_0x5267('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x5267('0x2d'),_0x5267('0x2e'),_0x5267('0x5b'),_0x5267('0x3b'),_0x5267('0x3f'),_0x5267('0x32'),_0x5267('0x5c'),'lastLoginAt',_0x5267('0x30'),_0x5267('0x40'),_0x5267('0x4'),_0x5267('0x3'),_0x5267('0x5'),_0x5267('0x6'),'smsPause',_0x5267('0x8'),'whatsappPause',_0x5267('0x10'),_0x5267('0x11'),_0x5267('0x12'),'openchannelStatus',_0x5267('0x14'),_0x5267('0xe'),_0x5267('0x15'),_0x5267('0x4d'),_0x5267('0x52'),_0x5267('0x4f'),'openchannelStatusTime',_0x5267('0x50'),_0x5267('0x5d'),_0x5267('0x51'),_0x5267('0x41'),'faxCapacity','mailCapacity',_0x5267('0x42'),'smsCapacity',_0x5267('0x45'),_0x5267('0x47'),'faxCurrentCapacity','mailCurrentCapacity',_0x5267('0x48'),_0x5267('0x4a'),_0x5267('0x4b'),'phoneBarEnableScreenRecordingByAgent',_0x5267('0x56'),_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x53'),'routealias','screenrecording'];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xabce=['pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','fields','order','DESC','ASC','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','openchannelStatusTime','mailCurrentCapacity','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','mailPause','smsPause','whatsappPause','every','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','voicePause','pause','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','error','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','includes','filter','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','faxPause','openchannelPause'];(function(_0x48340b,_0x244588){var _0x1af24b=function(_0x5a4bec){while(--_0x5a4bec){_0x48340b['push'](_0x48340b['shift']());}};_0x1af24b(++_0x244588);}(_0xabce,0x103));var _0xeabc=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xabce[_0x521929];return _0x632436;};'use strict';var _=require(_0xeabc('0x0'));var jayson=require(_0xeabc('0x1'));var db=require(_0xeabc('0x2'))['db'];var amiClient=jayson[_0xeabc('0x3')][_0xeabc('0x4')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function isAgentPaused(_0x2e01eb,_0x1d9f37){var _0x1a88a7=[_0x2e01eb['chatPause'],_0x2e01eb['faxPause'],_0x2e01eb[_0xeabc('0x5')],_0x2e01eb['openchannelPause'],_0x2e01eb[_0xeabc('0x6')],_0x2e01eb['voicePause'],_0x2e01eb[_0xeabc('0x7')]];if(!_0x1d9f37)return _[_0xeabc('0x8')](_0x1a88a7);var _0x8434c5=_['filter'](_0x1a88a7);return _0x8434c5[_0xeabc('0x9')]>0x0&&_0x8434c5[_0xeabc('0x9')]<_0x1a88a7[_0xeabc('0x9')]?!![]:![];}function isIdle(_0x1b4d1b){return _0x1b4d1b===_0xeabc('0xa')||_0x1b4d1b===_0xeabc('0xb')||_0x1b4d1b===_0xeabc('0xc')||_0x1b4d1b===_0xeabc('0xd')||_[_0xeabc('0xe')](_0x1b4d1b);}function isAgentIdle(_0xf0d9c0){if(_0xf0d9c0[_0xeabc('0xf')]!==_0xeabc('0xa')&&_0xf0d9c0[_0xeabc('0x10')]){_0xf0d9c0[_0xeabc('0xf')]=_0xeabc('0x11');return![];}return _[_0xeabc('0x8')]([_0xf0d9c0['chatStatus'],_0xf0d9c0[_0xeabc('0x12')],_0xf0d9c0[_0xeabc('0x13')],_0xf0d9c0[_0xeabc('0x14')],_0xf0d9c0['smsStatus'],_0xf0d9c0['voiceStatus'],_0xf0d9c0[_0xeabc('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xeabc('0x16')](_0xeabc('0x17'),{})['then'](function(_0xf913d7){if(_0xf913d7[_0xeabc('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x53fe28=_0xf913d7[_0xeabc('0x19')];return routingClient['request'](_0xeabc('0x17'),{})[_0xeabc('0x1a')](function(_0x58a3c0){if(_0x58a3c0[_0xeabc('0x18')]){throw new Error(_0xeabc('0x1b'));}var _0x31f52a=_0x58a3c0[_0xeabc('0x19')];return _[_0xeabc('0x1c')]({},_0x53fe28,_0x31f52a);});})['catch'](function(_0x1253e4){throw _0x1253e4;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x31201a){var _0x16530c='unknown';if(isAgentPaused(_0x31201a))_0x16530c=_0xeabc('0x11');else if(isAgentPaused(_0x31201a,!![]))_0x16530c=_0xeabc('0x1d');else if(isAgentIdle(_0x31201a))_0x16530c=_0xeabc('0xa');else _0x16530c=_0xeabc('0x1e');return _0x16530c;}exports[_0xeabc('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x4e99a4,_0xecdbf){var _0x10c675=_[_0xeabc('0x20')](_0x4e99a4)?_0x4e99a4:[_0x4e99a4];var _0x5bdd57=_[_0xeabc('0x21')](_0xecdbf)+_0xeabc('0x22');var _0x214953=_[_0xeabc('0x23')](_0x10c675,function(_0x5b8838){return db[_0x5bdd57][_0xeabc('0x24')]({'where':{'id':_0x5b8838}})['then'](function(_0x27dbaf){if(!_0x27dbaf)return[];return _0x27dbaf['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xeabc('0x25')](_0x214953)[_0xeabc('0x1a')](function(_0x269621){var _0x3f194e=_(_0x269621)[_0xeabc('0x26')]()[_0xeabc('0x23')]('id')[_0xeabc('0x27')]()['value']();return _0x3f194e;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x459c8a,_0x5bf8f2,_0x3c1b5b){try{if(_0x5bf8f2[_0xeabc('0x9')]>0x0){_0x459c8a=_0x459c8a['filter'](function(_0x2163e6){return _0x5bf8f2[_0xeabc('0x28')](_0x2163e6['id']);});}var _0x2b568f=_0x459c8a[_0xeabc('0x29')](function(_0x149170){var _0x481ee1=_0xeabc('0x1e');if(isAgentIdle(_0x149170)){_0x481ee1=_0xeabc('0xa');}return _0x481ee1===_0x3c1b5b;});return _[_0xeabc('0x23')](_0x2b568f,'id');}catch(_0x5ebb86){throw _0x5ebb86;}}exports[_0xeabc('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5bb1f1,_0x2f03e8,_0x2d027e){return Promise[_0xeabc('0x2b')]()[_0xeabc('0x1a')](function(){if(_0x2f03e8[_0xeabc('0x9')]>0x0){_0x5bb1f1=_0x5bb1f1[_0xeabc('0x29')](function(_0x61c0af){return _0x2f03e8['includes'](_0x61c0af['id']);});}return _0x5bb1f1;})[_0xeabc('0x1a')](function(){return db[_0xeabc('0x2c')][_0xeabc('0x2d')]({'attributes':['id','name',_0xeabc('0x2e'),_0xeabc('0x2f'),_0xeabc('0x30'),'mailPause',_0xeabc('0x31'),_0xeabc('0x6'),_0xeabc('0x10'),'whatsappPause',_0xeabc('0x32')],'where':{'id':{'$in':_[_0xeabc('0x23')](_0x5bb1f1,'id')}},'raw':!![]});})['then'](function(_0x50cca2){return _0x50cca2[_0xeabc('0x23')](function(_0x3829a9){var _0x4fc60c=_[_0xeabc('0x33')](_0x5bb1f1,['id',_0x3829a9['id']]);var _0x81976d=filterAgentAttributes(_0x4fc60c);_[_0xeabc('0x1c')](_0x3829a9,_0x81976d);_0x3829a9[_0xeabc('0x34')]=getAgentStatus(_0x3829a9);return _0x3829a9;});})[_0xeabc('0x1a')](function(_0x4b7923){var _0x353e48=sortAgentsByStatus(_0x4b7923,_0x2d027e);return _['map'](_0x353e48,'id');})[_0xeabc('0x35')](function(_0x2bda29){throw _0x2bda29;});}exports[_0xeabc('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5b52c4){var _0x532999={'fields':[],'order':null};var _0x452580=_0x5b52c4['split'](',');_0x532999[_0xeabc('0x37')]=_['filter'](_0x452580,function(_0x54e284){if(!_0x54e284['includes']('globalStatus')){return!![];}_0x532999[_0xeabc('0x38')]=_['startsWith'](_0x54e284,'-')?_0xeabc('0x39'):_0xeabc('0x3a');return![];});return _0x532999;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0xe8fa6e){if(!_0xe8fa6e){_0xe8fa6e='fullname,internal';}if(_0xe8fa6e[_0xeabc('0x28')]('fullname')&&!_0xe8fa6e[_0xeabc('0x28')](_0xeabc('0x3b'))){var _0xeeef02=_0xe8fa6e['substring'](0x0,_0xe8fa6e['indexOf']('fullname'));_0xe8fa6e+=','+_0xeeef02+_0xeabc('0x3b');}return _0xe8fa6e;}exports[_0xeabc('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0xafa59b,_0x4c2df5){var _0x4f1897=_0xafa59b[_0xeabc('0x3d')](function(_0x1680e8,_0x5e9cb3){if(_0x1680e8[_0xeabc('0x34')]===_0x5e9cb3['globalStatus']){if(_0x1680e8[_0xeabc('0x34')]==='pause'){if(_0x4c2df5==='DESC'){return(_0x1680e8['pauseType']||'')<(_0x5e9cb3[_0xeabc('0x32')]||'')||_0x1680e8[_0xeabc('0x2e')][_0xeabc('0x3e')]()>_0x5e9cb3[_0xeabc('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1680e8[_0xeabc('0x32')]||'')<(_0x5e9cb3['pauseType']||'')||_0x1680e8[_0xeabc('0x2e')][_0xeabc('0x3e')]()>_0x5e9cb3[_0xeabc('0x2e')][_0xeabc('0x3e')]()?-0x1:0x1;}}else{if(_0x4c2df5===_0xeabc('0x39')){return _0x1680e8['fullname']['toLowerCase']()<_0x5e9cb3[_0xeabc('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x1680e8[_0xeabc('0x2e')][_0xeabc('0x3e')]()<_0x5e9cb3['fullname'][_0xeabc('0x3e')]()?-0x1:0x1;}}}else{if(_0x4c2df5===_0xeabc('0x39')){return _0x1680e8[_0xeabc('0x34')]<_0x5e9cb3[_0xeabc('0x34')]?0x1:-0x1;}else{return _0x1680e8[_0xeabc('0x34')]<_0x5e9cb3[_0xeabc('0x34')]?-0x1:0x1;}}});return _0x4f1897;}exports[_0xeabc('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x4b2fb6){var _0x3e165f=[_0xeabc('0x40'),_0xeabc('0x41'),_0xeabc('0x42'),_0xeabc('0x43'),_0xeabc('0x32'),_0xeabc('0x43'),_0xeabc('0x3b'),_0xeabc('0x44'),_0xeabc('0x2f'),'openchannelPause',_0xeabc('0x5'),_0xeabc('0x6'),_0xeabc('0x7'),_0xeabc('0x30'),_0xeabc('0x10'),_0xeabc('0x45'),_0xeabc('0x46'),'mailCapacity',_0xeabc('0x47'),_0xeabc('0x48'),_0xeabc('0x49'),_0xeabc('0x4a'),_0xeabc('0x4b'),'mailCurrentCapacity',_0xeabc('0x4c'),_0xeabc('0x4d'),_0xeabc('0x4e'),_0xeabc('0x4f'),'openchannelStatus',_0xeabc('0x13'),_0xeabc('0x50'),'whatsappStatus',_0xeabc('0x12'),'voiceStatus',_0xeabc('0x51'),'openchannelStatusTime',_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55'),_0xeabc('0x56'),_0xeabc('0x57'),_0xeabc('0x58'),_0xeabc('0x59'),_0xeabc('0x5a'),_0xeabc('0x5b'),'routealias'];var _0x180a14=[_0xeabc('0x2f'),_0xeabc('0x31'),_0xeabc('0x5'),'smsPause',_0xeabc('0x7'),_0xeabc('0x30'),_0xeabc('0x10'),_0xeabc('0x41')];var _0x5f2d2f=_(_0x4b2fb6)[_0xeabc('0x5c')](_0x180a14)[_0xeabc('0x5d')](_0x3e165f)[_0xeabc('0x5e')]();return _0x5f2d2f;}exports[_0xeabc('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xeabc('0x60'),_0xeabc('0x2e'),_0xeabc('0x61'),_0xeabc('0x3b'),_0xeabc('0x41'),'globalStatus',_0xeabc('0x40'),'lastLoginAt','pauseType','lastPauseAt',_0xeabc('0x30'),_0xeabc('0x2f'),_0xeabc('0x5'),_0xeabc('0x31'),_0xeabc('0x6'),_0xeabc('0x10'),'whatsappPause',_0xeabc('0x4f'),_0xeabc('0x12'),_0xeabc('0x13'),_0xeabc('0x14'),_0xeabc('0x50'),_0xeabc('0xf'),_0xeabc('0x15'),_0xeabc('0x51'),'faxStatusTime','mailStatusTime',_0xeabc('0x62'),_0xeabc('0x53'),_0xeabc('0x56'),'whatsappStatusTime',_0xeabc('0x45'),'faxCapacity','mailCapacity',_0xeabc('0x46'),_0xeabc('0x47'),_0xeabc('0x48'),_0xeabc('0x4a'),_0xeabc('0x4e'),_0xeabc('0x63'),'openchannelCurrentCapacity',_0xeabc('0x4c'),_0xeabc('0x4d'),_0xeabc('0x5a'),_0xeabc('0x5b'),_0xeabc('0x58'),_0xeabc('0x64'),'queue',_0xeabc('0x65'),_0xeabc('0x59')];}exports[_0xeabc('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 6500e3b..ac75158 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09cc=['predictiveIntervalAvgTalktime','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','voice','concat','outbound','map','get','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','talking','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','predictiveIntervalAvailable'];(function(_0x2772e1,_0x545572){var _0x1fb3af=function(_0x5dd033){while(--_0x5dd033){_0x2772e1['push'](_0x2772e1['shift']());}};_0x1fb3af(++_0x545572);}(_0x09cc,0x118));var _0xc09c=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x09cc[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0xc09c('0x0'));var jayson=require(_0xc09c('0x1'));var util=require(_0xc09c('0x2'));var amiClient=jayson[_0xc09c('0x3')][_0xc09c('0x4')]({'port':0x232a});var routingClient=jayson[_0xc09c('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xc09c('0x5'),_0xc09c('0x6'),_0xc09c('0x7'),_0xc09c('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xc09c('0x9'),'inUse',_0xc09c('0xa'),_0xc09c('0xb'),_0xc09c('0xc'),_0xc09c('0xd'),'ringing','ringInUse',_0xc09c('0xe'),'unavailable',_0xc09c('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xc09c('0x10'),_0xc09c('0x11'),'message',_0xc09c('0x12'),_0xc09c('0x13'),_0xc09c('0x14'),_0xc09c('0x15'),_0xc09c('0x16'),_0xc09c('0x17'),'erlangCalls',_0xc09c('0x18'),_0xc09c('0x19'),_0xc09c('0x1a'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xc09c('0x1b'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0xc09c('0x1c')];function getRealtimeQueues(_0x549233,_0x481613){var _0x4cad57=_0x481613==='voice'?amiClient:routingClient;return _0x4cad57['request'](_[_0xc09c('0x1d')](_0x481613)+_0xc09c('0x1e'),_0x549233)['then'](function(_0x3dc52d){if(_0x3dc52d[_0xc09c('0x1f')])throw new Error(util[_0xc09c('0x20')](_0xc09c('0x21'),_0x481613));return _0x3dc52d[_0xc09c('0x22')];})[_0xc09c('0x23')](function(_0xcb365e){throw _0xcb365e;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x352d3b,_0x51bcde,_0xd8067d,_0x3076cb){var _0x3e403e=DEFAULT_QUEUE_ATTRIBUTES;if(_0xd8067d===_0xc09c('0x24')){if(_0x3076cb==='inbound'){_0x3e403e=_0x3e403e[_0xc09c('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3076cb===_0xc09c('0x26')){_0x3e403e=_0x3e403e['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x352d3b[_0xc09c('0x27')](function(_0x32d673){var _0x2d3ae0=_0x32d673[_0xc09c('0x28')]({'plain':!![]});_0x2d3ae0[_0xc09c('0x7')]=0x0;_0x2d3ae0[_0xc09c('0xb')]=0x0;_0x2d3ae0[_0xc09c('0x6')]=0x0;_0x2d3ae0[_0xc09c('0x5')]=0x0;_0x2d3ae0['waiting']=0x0;if(_0xd8067d===_0xc09c('0x24')){_0x2d3ae0['talking']=0x0;_0x2d3ae0[_0xc09c('0x9')]=0x0;if(_0x3076cb==='outbound'){_0x2d3ae0[_0xc09c('0x10')]=0x0;_0x2d3ae0[_0xc09c('0x11')]=0x0;}}var _0x2662d0=_[_0xc09c('0x29')](_0x51bcde,['id',_0x2d3ae0['id']]);if(_0x2662d0){_[_0xc09c('0x2a')](_0x2d3ae0,_['pick'](_0x2662d0,_0x3e403e));}return _0x2d3ae0;});}exports[_0xc09c('0x2b')]=initializeQueues; \ No newline at end of file +var _0xeeab=['getRealtimeQueues','inbound','concat','map','get','paused','outbound','originated','find','merge','initializeQueues','lodash','jayson/promise','util','http','client','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','unavailable','unknown','pTalking','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','format','result','catch'];(function(_0x3c7731,_0x3b50fc){var _0x50f36b=function(_0x29304d){while(--_0x29304d){_0x3c7731['push'](_0x3c7731['shift']());}};_0x50f36b(++_0x3b50fc);}(_0xeeab,0x185));var _0xbeea=function(_0x1f8264,_0x25b2ed){_0x1f8264=_0x1f8264-0x0;var _0x255f33=_0xeeab[_0x1f8264];return _0x255f33;};'use strict';var _=require(_0xbeea('0x0'));var jayson=require(_0xbeea('0x1'));var util=require(_0xbeea('0x2'));var amiClient=jayson['client'][_0xbeea('0x3')]({'port':0x232a});var routingClient=jayson[_0xbeea('0x4')][_0xbeea('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xbeea('0x5'),_0xbeea('0x6'),'paused',_0xbeea('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xbeea('0x8'),_0xbeea('0x9'),_0xbeea('0xa'),_0xbeea('0xb'),_0xbeea('0xc'),_0xbeea('0xd'),'ringing',_0xbeea('0xe'),'talking',_0xbeea('0xf'),_0xbeea('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbeea('0x11'),'originated',_0xbeea('0x12'),_0xbeea('0x13'),_0xbeea('0x14'),_0xbeea('0x15'),_0xbeea('0x16'),'startPredictive',_0xbeea('0x17'),_0xbeea('0x18'),_0xbeea('0x19'),_0xbeea('0x1a'),'erlangBusyFactor',_0xbeea('0x1b'),'dialPredictiveIntervalMaxThreshold',_0xbeea('0x1c'),_0xbeea('0x1d'),_0xbeea('0x1e'),_0xbeea('0x1f'),_0xbeea('0x20'),_0xbeea('0x21'),_0xbeea('0x22'),_0xbeea('0x23')];function getRealtimeQueues(_0x3fecc1,_0x40ed37){var _0x2fdc53=_0x40ed37===_0xbeea('0x24')?amiClient:routingClient;return _0x2fdc53[_0xbeea('0x25')](_[_0xbeea('0x26')](_0x40ed37)+'Queues',_0x3fecc1)[_0xbeea('0x27')](function(_0xe297c2){if(_0xe297c2['error'])throw new Error(util[_0xbeea('0x28')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x40ed37));return _0xe297c2[_0xbeea('0x29')];})[_0xbeea('0x2a')](function(_0x14bd99){throw _0x14bd99;});}exports[_0xbeea('0x2b')]=getRealtimeQueues;function initializeQueues(_0x1a2e21,_0x4e1aa0,_0x399074,_0x48d00e){var _0x44fda0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x399074==='voice'){if(_0x48d00e===_0xbeea('0x2c')){_0x44fda0=_0x44fda0[_0xbeea('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x48d00e==='outbound'){_0x44fda0=_0x44fda0[_0xbeea('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1a2e21[_0xbeea('0x2e')](function(_0x14e25c){var _0x2b6db9=_0x14e25c[_0xbeea('0x2f')]({'plain':!![]});_0x2b6db9[_0xbeea('0x30')]=0x0;_0x2b6db9[_0xbeea('0xb')]=0x0;_0x2b6db9[_0xbeea('0x6')]=0x0;_0x2b6db9[_0xbeea('0x5')]=0x0;_0x2b6db9['waiting']=0x0;if(_0x399074===_0xbeea('0x24')){_0x2b6db9['talking']=0x0;_0x2b6db9['busy']=0x0;if(_0x48d00e===_0xbeea('0x31')){_0x2b6db9[_0xbeea('0x11')]=0x0;_0x2b6db9[_0xbeea('0x32')]=0x0;}}var _0x1ddada=_[_0xbeea('0x33')](_0x4e1aa0,['id',_0x2b6db9['id']]);if(_0x1ddada){_[_0xbeea('0x34')](_0x2b6db9,_['pick'](_0x1ddada,_0x44fda0));}return _0x2b6db9;});}exports[_0xbeea('0x35')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1e30fd1..dba0c55 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2145c0,_0x549319){var _0x4c613a=function(_0x4e7350){while(--_0x4e7350){_0x2145c0['push'](_0x2145c0['shift']());}};_0x4c613a(++_0x549319);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x14e4c8,_0x2dad18){var _0x488280=function(_0x569ff8){while(--_0x569ff8){_0x14e4c8['push'](_0x14e4c8['shift']());}};_0x488280(++_0x2dad18);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f08f24d..80a317f 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 _0xea67=['family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','utf8','replace','hostname','ipAddress','substring','child_process','execSync','../environment','networkInterfaces','keys','length','filter'];(function(_0x524c74,_0x2b6986){var _0xb4b6f1=function(_0x26c642){while(--_0x26c642){_0x524c74['push'](_0x524c74['shift']());}};_0xb4b6f1(++_0x2b6986);}(_0xea67,0xa3));var _0x7ea6=function(_0x5005ba,_0x423ed1){_0x5005ba=_0x5005ba-0x0;var _0x21278c=_0xea67[_0x5005ba];return _0x21278c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x7ea6('0x0'))[_0x7ea6('0x1')];var config=require(_0x7ea6('0x2'));function getInterfaces(){var _0x38c421=[];var _0x172c91=os[_0x7ea6('0x3')]();var _0x105031=_['orderBy'](_[_0x7ea6('0x4')](_0x172c91));for(var _0x3956f5=0x0;_0x3956f5<_0x105031[_0x7ea6('0x5')];_0x3956f5++){var _0x2f33b1=_0x172c91[_0x105031[_0x3956f5]][_0x7ea6('0x6')](function(_0x416c55){return _0x416c55[_0x7ea6('0x7')]==='IPv4'&&_0x416c55[_0x7ea6('0x8')]===![];});_0x38c421=_0x38c421[_0x7ea6('0x9')](_0x2f33b1);}return _0x38c421;}function getFirstInterface(){var _0x148203=_[_0x7ea6('0xa')](getInterfaces());return{'macAddress':_0x148203&&_0x148203[_0x7ea6('0xb')]?_0x148203[_0x7ea6('0xb')]:_0x7ea6('0xc'),'ipAddress':_0x148203&&_0x148203[_0x7ea6('0xd')]?_0x148203[_0x7ea6('0xd')]:'127.0.0.1'};}exports[_0x7ea6('0xe')]=getFirstInterface;function getCPUhash(){var _0x171199=_[_0x7ea6('0xf')](os[_0x7ea6('0x10')]()[_0x7ea6('0x11')](function(_0x34da9b){return _0x34da9b[_0x7ea6('0x12')];}))[_0x7ea6('0x13')](':');return crypto[_0x7ea6('0x14')](_0x7ea6('0x15'))[_0x7ea6('0x16')](_0x171199)[_0x7ea6('0x17')](_0x7ea6('0x18'));}exports[_0x7ea6('0x19')]=function(){var _0x471fd4=os[_0x7ea6('0x1a')]();var _0x4f2feb=/[0-9a-f-]{36}/;if(config[_0x7ea6('0x1b')]&&_0x4f2feb['test'](config[_0x7ea6('0x1b')])){return config[_0x7ea6('0x1b')];}else if(_0x471fd4===_0x7ea6('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x7ea6('0x1d')})[_0x7ea6('0x1e')]('\x0d\x0a','');}else{var _0xe593ce=getFirstInterface();var _0x368164=getCPUhash();var _0x40e744=_0x368164+'|'+os[_0x7ea6('0x1f')]()+'|'+_0xe593ce['macAddress']+'|'+_0xe593ce[_0x7ea6('0x20')];var _0x4efb33=crypto[_0x7ea6('0x14')]('md5')[_0x7ea6('0x16')](_0x40e744)[_0x7ea6('0x17')](_0x7ea6('0x18'));return _0x4efb33[_0x7ea6('0x21')](0x0,0x8)+'-'+_0x4efb33[_0x7ea6('0x21')](0x8,0xc)+'-'+_0x4efb33[_0x7ea6('0x21')](0xc,0x10)+'-'+_0x4efb33['substring'](0x10,0x14)+'-'+_0x4efb33[_0x7ea6('0x21')](0x14);}}; \ No newline at end of file +var _0xe66f=['map','model','join','createHash','digest','getUuid','platform','licenseToken','win32','utf8','ipAddress','md5','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xe66f,0xfd));var _0xfe66=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe66f[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xfe66('0x0'));var machine=require(_0xfe66('0x1'));var exec=require('child_process')[_0xfe66('0x2')];var config=require(_0xfe66('0x3'));function getInterfaces(){var _0x338a92=[];var _0x1e16e8=os[_0xfe66('0x4')]();var _0xea1e0c=_[_0xfe66('0x5')](_[_0xfe66('0x6')](_0x1e16e8));for(var _0x4895cc=0x0;_0x4895cc<_0xea1e0c[_0xfe66('0x7')];_0x4895cc++){var _0x2cdc73=_0x1e16e8[_0xea1e0c[_0x4895cc]][_0xfe66('0x8')](function(_0x5d45ba){return _0x5d45ba[_0xfe66('0x9')]==='IPv4'&&_0x5d45ba['internal']===![];});_0x338a92=_0x338a92[_0xfe66('0xa')](_0x2cdc73);}return _0x338a92;}function getFirstInterface(){var _0xbc4af7=_[_0xfe66('0xb')](getInterfaces());return{'macAddress':_0xbc4af7&&_0xbc4af7[_0xfe66('0xc')]?_0xbc4af7['mac']:'00:00:00:00:00:00','ipAddress':_0xbc4af7&&_0xbc4af7[_0xfe66('0xd')]?_0xbc4af7[_0xfe66('0xd')]:_0xfe66('0xe')};}exports[_0xfe66('0xf')]=getFirstInterface;function getCPUhash(){var _0x4c2963=_[_0xfe66('0x5')](os[_0xfe66('0x10')]()[_0xfe66('0x11')](function(_0x49976f){return _0x49976f[_0xfe66('0x12')];}))[_0xfe66('0x13')](':');return crypto[_0xfe66('0x14')]('md5')['update'](_0x4c2963)[_0xfe66('0x15')]('hex');}exports[_0xfe66('0x16')]=function(){var _0xf099c8=os[_0xfe66('0x17')]();var _0x26cef3=/[0-9a-f-]{36}/;if(config[_0xfe66('0x18')]&&_0x26cef3['test'](config[_0xfe66('0x18')])){return config[_0xfe66('0x18')];}else if(_0xf099c8===_0xfe66('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xfe66('0x1a')})['replace']('\x0d\x0a','');}else{var _0x37321e=getFirstInterface();var _0x12bca8=getCPUhash();var _0x48949b=_0x12bca8+'|'+os['hostname']()+'|'+_0x37321e['macAddress']+'|'+_0x37321e[_0xfe66('0x1b')];var _0xcd536c=crypto[_0xfe66('0x14')](_0xfe66('0x1c'))['update'](_0x48949b)['digest']('hex');return _0xcd536c[_0xfe66('0x1d')](0x0,0x8)+'-'+_0xcd536c[_0xfe66('0x1d')](0x8,0xc)+'-'+_0xcd536c['substring'](0xc,0x10)+'-'+_0xcd536c[_0xfe66('0x1d')](0x10,0x14)+'-'+_0xcd536c[_0xfe66('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 56b165d..d8953f7 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 _0x34cd=['license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','../../components/encryptor','./hardware','../logger'];(function(_0x4579dc,_0xff67f8){var _0x458962=function(_0x1f9383){while(--_0x1f9383){_0x4579dc['push'](_0x4579dc['shift']());}};_0x458962(++_0xff67f8);}(_0x34cd,0xa1));var _0xd34c=function(_0x4ce2f6,_0x1feabc){_0x4ce2f6=_0x4ce2f6-0x0;var _0x2e6fc4=_0x34cd[_0x4ce2f6];return _0x2e6fc4;};'use strict';var util=require(_0xd34c('0x0'));var moment=require(_0xd34c('0x1'));var rp=require(_0xd34c('0x2'));var BPromise=require(_0xd34c('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xd34c('0x4'));var hardware=require(_0xd34c('0x5'));var logger=require(_0xd34c('0x6'))(_0xd34c('0x7'));var HOST=_0xd34c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3bb9bd){return new BPromise(function(_0x2f958c,_0x1c4f88){var _0x4c887a=util[_0xd34c('0x9')](_0xd34c('0xa'),HOST,_0x3bb9bd,module[_0xd34c('0xb')][_0xd34c('0xc')]);if(oldToken){_0x4c887a=util[_0xd34c('0x9')](_0xd34c('0xd'),HOST,_0x3bb9bd,module['exports']['version'],oldToken);}var _0x194199={'uri':_0x4c887a,'method':_0xd34c('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x194199)[_0xd34c('0xf')](function(_0x2f7b09){_0x2f958c(_0x2f7b09);})[_0xd34c('0x10')](function(_0x52f560){_0x1c4f88(_0x52f560);});});}function manageLicense(_0x59ed22,_0x4c87de){var _0x5327e7=_0x4c87de[_0xd34c('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x5327e7[_0xd34c('0x12')]!==_0x59ed22&&!_0x5327e7['data2']){oldToken=_0x5327e7[_0xd34c('0x12')];}httpRequest(_0x59ed22)[_0xd34c('0xf')](function(_0x33dd97){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x33dd97[_0xd34c('0x13')]){isOldTokenSent=![];if(!_0x5327e7[_0xd34c('0x7')]&&_0x5327e7[_0xd34c('0x7')]!=_0x33dd97[_0xd34c('0x7')]||_0x5327e7['license']&&_0x5327e7[_0xd34c('0x14')]){logger[_0xd34c('0x15')](_0xd34c('0x16'));}if(_0x5327e7[_0xd34c('0x7')]&&!_0x5327e7['data2']&&_0x5327e7['license']!=_0x33dd97[_0xd34c('0x7')]){logger[_0xd34c('0x15')](_0xd34c('0x17'));}if(_0x5327e7[_0xd34c('0x7')]&&!_0x5327e7[_0xd34c('0x14')]&&_0x5327e7[_0xd34c('0x7')]==_0x33dd97[_0xd34c('0x7')]){return _0x4c87de;}return _0x4c87de['update']({'data1':_0x59ed22,'data2':null,'license':_0x33dd97[_0xd34c('0x7')]});}else{if(_0x33dd97['license']||_0x5327e7[_0xd34c('0x7')]){if(!_0x5327e7['data2']){if(_0x5327e7[_0xd34c('0x12')]==_0x59ed22){GRAY_PERIOD_REASON=_0xd34c('0x18');logger[_0xd34c('0x15')](_0xd34c('0x19'));}else{GRAY_PERIOD_REASON=_0xd34c('0x1a');logger[_0xd34c('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5327e7[_0xd34c('0x12')],_0x59ed22);}logger['info'](_0xd34c('0x1b'),GRAY_PERIOD_REASON[_0xd34c('0x1c')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x4c87de[_0xd34c('0x1d')]({'data2':encryptor['encryptString'](moment()[_0xd34c('0x9')](_0xd34c('0x1e')))});}else{if(moment()['diff'](encryptor[_0xd34c('0x1f')](_0x5327e7[_0xd34c('0x14')]),_0xd34c('0x20'))>DAYS){logger[_0xd34c('0x15')](_0xd34c('0x21'),moment()[_0xd34c('0x9')](_0xd34c('0x1e')));isOldTokenSent=![];return _0x4c87de[_0xd34c('0x1d')]({'data1':_0x59ed22,'data2':null,'license':null});}}}else{if(_0x5327e7[_0xd34c('0x12')]!=_0x59ed22){logger[_0xd34c('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5327e7[_0xd34c('0x12')],_0x59ed22);return _0x4c87de[_0xd34c('0x1d')]({'data1':_0x59ed22,'data2':null,'license':null});}}}return _0x4c87de;})['then'](function(_0x15d8a8){_0x4c87de=_0x15d8a8;})[_0xd34c('0x10')](function(_0x3192d5){logger[_0xd34c('0x22')](_0x3192d5['message']);})[_0xd34c('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4c87de);},TIME);});}function defaultLicense(){var _0x5c5f0d=hardware[_0xd34c('0x24')]();if(_0x5c5f0d){return db['License'][_0xd34c('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x5c5f0d}})[_0xd34c('0x26')](function(_0x3ef4da,_0x1c93d3){logger[_0xd34c('0x15')](_0xd34c('0x27'),_0x5c5f0d);manageLicense(_0x5c5f0d,_0x3ef4da);})[_0xd34c('0x10')](function(_0x143c78){logger[_0xd34c('0x22')](_0x143c78[_0xd34c('0x28')]);});}}exports[_0xd34c('0x29')]=defaultLicense; \ No newline at end of file +var _0x2447=['encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm'];(function(_0x1152bb,_0x322e59){var _0x58ddd3=function(_0x346fd8){while(--_0x346fd8){_0x1152bb['push'](_0x1152bb['shift']());}};_0x58ddd3(++_0x322e59);}(_0x2447,0x131));var _0x7244=function(_0x2f0a23,_0xdcad7b){_0x2f0a23=_0x2f0a23-0x0;var _0x42cee1=_0x2447[_0x2f0a23];return _0x42cee1;};'use strict';var util=require(_0x7244('0x0'));var moment=require(_0x7244('0x1'));var rp=require(_0x7244('0x2'));var BPromise=require(_0x7244('0x3'));var pkginfo=require(_0x7244('0x4'))(module,_0x7244('0x5'));var db=require(_0x7244('0x6'))['db'];var encryptor=require(_0x7244('0x7'));var hardware=require(_0x7244('0x8'));var logger=require('../logger')(_0x7244('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x131bc7){return new BPromise(function(_0x2b6a67,_0x2eb578){var _0x2846b3=util[_0x7244('0xa')](_0x7244('0xb'),HOST,_0x131bc7,module[_0x7244('0xc')][_0x7244('0x5')]);if(oldToken){_0x2846b3=util[_0x7244('0xa')](_0x7244('0xd'),HOST,_0x131bc7,module[_0x7244('0xc')]['version'],oldToken);}var _0x2909dc={'uri':_0x2846b3,'method':_0x7244('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2909dc)[_0x7244('0xf')](function(_0x3dbc6f){_0x2b6a67(_0x3dbc6f);})[_0x7244('0x10')](function(_0x50bc56){_0x2eb578(_0x50bc56);});});}function manageLicense(_0x3d2f9e,_0x2ff71a){var _0x16b634=_0x2ff71a[_0x7244('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x16b634[_0x7244('0x12')]!==_0x3d2f9e&&!_0x16b634[_0x7244('0x13')]){oldToken=_0x16b634[_0x7244('0x12')];}httpRequest(_0x3d2f9e)[_0x7244('0xf')](function(_0x50618c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x50618c[_0x7244('0x14')]){isOldTokenSent=![];if(!_0x16b634[_0x7244('0x9')]&&_0x16b634[_0x7244('0x9')]!=_0x50618c[_0x7244('0x9')]||_0x16b634[_0x7244('0x9')]&&_0x16b634[_0x7244('0x13')]){logger[_0x7244('0x15')](_0x7244('0x16'));}if(_0x16b634[_0x7244('0x9')]&&!_0x16b634['data2']&&_0x16b634[_0x7244('0x9')]!=_0x50618c[_0x7244('0x9')]){logger[_0x7244('0x15')](_0x7244('0x17'));}if(_0x16b634[_0x7244('0x9')]&&!_0x16b634[_0x7244('0x13')]&&_0x16b634[_0x7244('0x9')]==_0x50618c['license']){return _0x2ff71a;}return _0x2ff71a[_0x7244('0x18')]({'data1':_0x3d2f9e,'data2':null,'license':_0x50618c[_0x7244('0x9')]});}else{if(_0x50618c[_0x7244('0x9')]||_0x16b634[_0x7244('0x9')]){if(!_0x16b634[_0x7244('0x13')]){if(_0x16b634['data1']==_0x3d2f9e){GRAY_PERIOD_REASON=_0x7244('0x19');logger['info'](_0x7244('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x7244('0x15')](_0x7244('0x1b'),_0x16b634[_0x7244('0x12')],_0x3d2f9e);}logger[_0x7244('0x15')](_0x7244('0x1c'),GRAY_PERIOD_REASON[_0x7244('0x1d')](),moment()[_0x7244('0xa')](_0x7244('0x1e')));return _0x2ff71a[_0x7244('0x18')]({'data2':encryptor[_0x7244('0x1f')](moment()[_0x7244('0xa')](_0x7244('0x1e')))});}else{if(moment()[_0x7244('0x20')](encryptor['decryptString'](_0x16b634[_0x7244('0x13')]),_0x7244('0x21'))>DAYS){logger[_0x7244('0x15')](_0x7244('0x22'),moment()[_0x7244('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2ff71a['update']({'data1':_0x3d2f9e,'data2':null,'license':null});}}}else{if(_0x16b634[_0x7244('0x12')]!=_0x3d2f9e){logger[_0x7244('0x15')](_0x7244('0x1b'),_0x16b634['data1'],_0x3d2f9e);return _0x2ff71a[_0x7244('0x18')]({'data1':_0x3d2f9e,'data2':null,'license':null});}}}return _0x2ff71a;})[_0x7244('0xf')](function(_0x8eae07){_0x2ff71a=_0x8eae07;})[_0x7244('0x10')](function(_0x5b1911){logger[_0x7244('0x23')](_0x5b1911[_0x7244('0x24')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x7244('0x25')](),_0x2ff71a);},TIME);});}function defaultLicense(){var _0x4aec77=hardware[_0x7244('0x25')]();if(_0x4aec77){return db[_0x7244('0x26')][_0x7244('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x4aec77}})['spread'](function(_0x119382,_0x431997){logger['info'](_0x7244('0x28'),_0x4aec77);manageLicense(_0x4aec77,_0x119382);})[_0x7244('0x10')](function(_0x6b86c6){logger[_0x7244('0x23')](_0x6b86c6[_0x7244('0x24')]);});}}exports[_0x7244('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7fa8aa6..b5d91b2 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 _0xaa72=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','split','format','%s:%s:%s','uuid','machineUuid','decryptString','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','user','telephone','users','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa72,0x1a1));var _0x2aa7=function(_0x4e9416,_0x3deeb7){_0x4e9416=_0x4e9416-0x0;var _0x1f0dea=_0xaa72[_0x4e9416];return _0x1f0dea;};'use strict';var util=require(_0x2aa7('0x0'));var _=require(_0x2aa7('0x1'));var moment=require(_0x2aa7('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2aa7('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2aa7('0x4'),'machineUuid':hardware[_0x2aa7('0x5')](),'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':'Breaking\x20license','machineUuid':hardware[_0x2aa7('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x58275b){return new BPromise(function(_0x3c2e0a,_0x421799){return db[_0x2aa7('0x6')][_0x2aa7('0x7')](_[_0x2aa7('0x8')](_0x58275b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3ec345){return checkLicense(_0x3ec345,null);})[_0x2aa7('0x9')](function(_0x382060){_0x3c2e0a(_0x382060);return;})[_0x2aa7('0xa')](function(_0x30f71d){_0x421799(_0x30f71d);});});}function checkLicense(_0x4d6112,_0x2f85ad){if(!_0x4d6112){demoLicense['uuid']=_0x4d6112[_0x2aa7('0xb')];return demoLicense;}try{var _0xa24dbf=_0x2f85ad||_0x4d6112[_0x2aa7('0xc')];if(_['isEmpty'](_0xa24dbf)){throw new Error(_0x2aa7('0xd'));}var _0xce26f2=_0x4d6112['data1'];var _0x59fcfd=_0x4d6112['data2'];var _0x4d3476=_0xce26f2[_0x2aa7('0xe')]('-')[0x4];var _0x4748f5=_0xce26f2[_0x2aa7('0xe')]('-')[0x0];var _0x187d42=encryptor['decryptString'](_0xa24dbf,util[_0x2aa7('0xf')](_0x2aa7('0x10'),_0x4d3476,_0xce26f2,_0x4748f5));var _0x143270=JSON['parse'](_0x187d42);_0x143270['demo']=![];_0x143270[_0x2aa7('0x11')]=_0xce26f2;_0x143270[_0x2aa7('0x12')]=hardware[_0x2aa7('0x5')]();if(_0x59fcfd){var _0xa4bc55=encryptor[_0x2aa7('0x13')](_0x59fcfd);_0x143270[_0x2aa7('0x14')]=_0xa4bc55;_0x143270[_0x2aa7('0x15')]=moment(_0xa4bc55)['add'](0x7,_0x2aa7('0x16'))[_0x2aa7('0xf')]();_0x143270[_0x2aa7('0x17')]=_0x143270[_0x2aa7('0x11')]!=_0x143270[_0x2aa7('0x12')]?_0x2aa7('0x18'):_0x2aa7('0x19');}return _0x143270;}catch(_0xf7200d){breakingLicense[_0x2aa7('0x11')]=_0x4d6112[_0x2aa7('0xb')];breakingLicense[_0x2aa7('0x1a')]=_0xf7200d[_0x2aa7('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5ae907,_0x481227){getLicense()[_0x2aa7('0x9')](function(_0x3b8793){return db[_0x2aa7('0x1b')][_0x2aa7('0x1c')]({'attributes':[_0x2aa7('0x1d'),[db[_0x2aa7('0x1e')]['fn'](_0x2aa7('0x1f'),db[_0x2aa7('0x1e')][_0x2aa7('0x20')](_0x2aa7('0x1d'))),'count']],'group':_0x2aa7('0x1d'),'where':{'role':{'$or':['admin',_0x2aa7('0x21'),_0x2aa7('0x22')]}},'raw':!![]})[_0x2aa7('0x9')](function(_0x4ac374){var _0x26f054={'user':_0x3b8793[_0x2aa7('0x23')]||0x0,'telephone':_0x3b8793['telephones']||0x0};_0x4ac374[_0x2aa7('0x24')](function(_0x44db93){var _0xce3f9e=_0x44db93['role']===_0x2aa7('0x25')?_0x2aa7('0x21'):_0x44db93[_0x2aa7('0x1d')];_0x26f054[_0xce3f9e]-=_0x44db93['count'];if(_0x26f054[_0xce3f9e]<0x0)_0x26f054[_0xce3f9e]=0x0;});_0x5ae907(_0x26f054);return;});})[_0x2aa7('0xa')](function(_0x245e49){_0x481227(_0x245e49);});});}function checkUserLimits(_0x362ce7){return new BPromise(function(_0x41ac17,_0x3a4a2f){getLimits()[_0x2aa7('0x9')](function(_0xc1e5ed){var _0x5e1b8f=_[_0x2aa7('0x26')](_[_0x2aa7('0x27')](_0x362ce7,'role'),[_0x2aa7('0x25'),_0x2aa7('0x21'),_0x2aa7('0x22')]);var _0x2541f6=(_0x5e1b8f[_0x2aa7('0x25')]||0x0)+(_0x5e1b8f[_0x2aa7('0x21')]||0x0);var _0x3a8a7b=_0x5e1b8f['telephone']||0x0;if(_0x2541f6>_0xc1e5ed[_0x2aa7('0x21')])return _0x3a4a2f(_0x2aa7('0x28'));if(_0x3a8a7b>_0xc1e5ed['telephone'])return _0x3a4a2f('License\x20limit\x20reached\x20for\x20telephones');return _0x41ac17();})[_0x2aa7('0xa')](function(_0x1d9cc7){_0x3a4a2f(_0x1d9cc7);});});}module[_0x2aa7('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa1d9=['Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','decryptString','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','uuid','message','User','findAll','sequelize','col','role','count','admin','user','users','forEach','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x5dcc7c,_0x16b1ac){var _0x1ef099=function(_0x29b91e){while(--_0x29b91e){_0x5dcc7c['push'](_0x5dcc7c['shift']());}};_0x1ef099(++_0x16b1ac);}(_0xa1d9,0x13b));var _0x9a1d=function(_0x3aecb2,_0x5e1cb0){_0x3aecb2=_0x3aecb2-0x0;var _0x211de9=_0xa1d9[_0x3aecb2];return _0x211de9;};'use strict';var util=require(_0x9a1d('0x0'));var _=require(_0x9a1d('0x1'));var moment=require('moment');var BPromise=require(_0x9a1d('0x2'));var hardware=require(_0x9a1d('0x3'));var encryptor=require(_0x9a1d('0x4'));var db=require(_0x9a1d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a1d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9a1d('0x7'),'machineUuid':hardware[_0x9a1d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a1d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9a1d('0x9'),'machineUuid':hardware[_0x9a1d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x54829c){return new BPromise(function(_0x3294b1,_0x2991f3){return db[_0x9a1d('0xa')][_0x9a1d('0xb')](_[_0x9a1d('0xc')](_0x54829c,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5187f2){return checkLicense(_0x5187f2,null);})[_0x9a1d('0xd')](function(_0x409946){_0x3294b1(_0x409946);return;})[_0x9a1d('0xe')](function(_0x2ed8e8){_0x2991f3(_0x2ed8e8);});});}function checkLicense(_0x449292,_0x3baf6c){if(!_0x449292){demoLicense['uuid']=_0x449292[_0x9a1d('0xf')];return demoLicense;}try{var _0x397212=_0x3baf6c||_0x449292[_0x9a1d('0x10')];if(_[_0x9a1d('0x11')](_0x397212)){throw new Error(_0x9a1d('0x12'));}var _0x1c6a1b=_0x449292[_0x9a1d('0xf')];var _0x574168=_0x449292['data2'];var _0x4f4015=_0x1c6a1b['split']('-')[0x4];var _0x2e0ac5=_0x1c6a1b['split']('-')[0x0];var _0x11b654=encryptor[_0x9a1d('0x13')](_0x397212,util[_0x9a1d('0x14')]('%s:%s:%s',_0x4f4015,_0x1c6a1b,_0x2e0ac5));var _0x53678d=JSON[_0x9a1d('0x15')](_0x11b654);_0x53678d[_0x9a1d('0x16')]=![];_0x53678d['uuid']=_0x1c6a1b;_0x53678d[_0x9a1d('0x17')]=hardware[_0x9a1d('0x8')]();if(_0x574168){var _0x172d58=encryptor[_0x9a1d('0x13')](_0x574168);_0x53678d[_0x9a1d('0x18')]=_0x172d58;_0x53678d[_0x9a1d('0x19')]=moment(_0x172d58)[_0x9a1d('0x1a')](0x7,_0x9a1d('0x1b'))[_0x9a1d('0x14')]();_0x53678d[_0x9a1d('0x1c')]=_0x53678d['uuid']!=_0x53678d['machineUuid']?_0x9a1d('0x1d'):_0x9a1d('0x1e');}return _0x53678d;}catch(_0x29979f){breakingLicense[_0x9a1d('0x1f')]=_0x449292[_0x9a1d('0xf')];breakingLicense[_0x9a1d('0x20')]=_0x29979f[_0x9a1d('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe6dbd9,_0x1469cd){getLicense()['then'](function(_0x52a957){return db[_0x9a1d('0x21')][_0x9a1d('0x22')]({'attributes':['role',[db[_0x9a1d('0x23')]['fn']('COUNT',db[_0x9a1d('0x23')][_0x9a1d('0x24')](_0x9a1d('0x25'))),_0x9a1d('0x26')]],'group':_0x9a1d('0x25'),'where':{'role':{'$or':[_0x9a1d('0x27'),_0x9a1d('0x28'),'telephone']}},'raw':!![]})['then'](function(_0x1e6eb0){var _0x1a706d={'user':_0x52a957[_0x9a1d('0x29')]||0x0,'telephone':_0x52a957['telephones']||0x0};_0x1e6eb0[_0x9a1d('0x2a')](function(_0x1aeb3f){var _0x352651=_0x1aeb3f['role']==='admin'?_0x9a1d('0x28'):_0x1aeb3f['role'];_0x1a706d[_0x352651]-=_0x1aeb3f[_0x9a1d('0x26')];if(_0x1a706d[_0x352651]<0x0)_0x1a706d[_0x352651]=0x0;});_0xe6dbd9(_0x1a706d);return;});})[_0x9a1d('0xe')](function(_0x38dd03){_0x1469cd(_0x38dd03);});});}function checkUserLimits(_0x28480a){return new BPromise(function(_0x1f2505,_0x42d126){getLimits()[_0x9a1d('0xd')](function(_0x237ee8){var _0x24f489=_['pick'](_['countBy'](_0x28480a,_0x9a1d('0x25')),['admin',_0x9a1d('0x28'),_0x9a1d('0x2b')]);var _0x46a082=(_0x24f489['admin']||0x0)+(_0x24f489['user']||0x0);var _0x2b11cc=_0x24f489[_0x9a1d('0x2b')]||0x0;if(_0x46a082>_0x237ee8[_0x9a1d('0x28')])return _0x42d126(_0x9a1d('0x2c'));if(_0x2b11cc>_0x237ee8[_0x9a1d('0x2b')])return _0x42d126('License\x20limit\x20reached\x20for\x20telephones');return _0x1f2505();})[_0x9a1d('0xe')](function(_0x8b5894){_0x42d126(_0x8b5894);});});}module[_0x9a1d('0x2d')]={'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 a873b60..12019af 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 _0x8f59=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8f59,0x11d));var _0x98f5=function(_0x2a1f8,_0x2ce877){_0x2a1f8=_0x2a1f8-0x0;var _0x50382a=_0x8f59[_0x2a1f8];return _0x50382a;};'use strict';module[_0x98f5('0x0')]={'DOMAIN':_0x98f5('0x1'),'SESSION_SECRET':_0x98f5('0x2'),'GOOGLE_ID':_0x98f5('0x3'),'GOOGLE_SECRET':_0x98f5('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x430c=['exports','app-id','secret'];(function(_0x51b6dc,_0x5a079b){var _0x70be33=function(_0x37584c){while(--_0x37584c){_0x51b6dc['push'](_0x51b6dc['shift']());}};_0x70be33(++_0x5a079b);}(_0x430c,0x1a1));var _0xc430=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x430c[_0x1ad926];return _0x1b81dc;};'use strict';module[_0xc430('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc430('0x1'),'GOOGLE_SECRET':_0xc430('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d44d808..d84ce55 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8513=['fileLogger','exports','../utils/loggers'];(function(_0x1e02a7,_0x4d8558){var _0x5db9f6=function(_0x571bf9){while(--_0x571bf9){_0x1e02a7['push'](_0x1e02a7['shift']());}};_0x5db9f6(++_0x4d8558);}(_0x8513,0x188));var _0x3851=function(_0xf21b2c,_0x44895f){_0xf21b2c=_0xf21b2c-0x0;var _0x493f26=_0x8513[_0xf21b2c];return _0x493f26;};'use strict';var fileLogger=require(_0x3851('0x0'))[_0x3851('0x1')];module[_0x3851('0x2')]=fileLogger; \ No newline at end of file +var _0x6842=['fileLogger','../utils/loggers'];(function(_0x2bf8d2,_0x579c85){var _0x5439e0=function(_0x4cdb23){while(--_0x4cdb23){_0x2bf8d2['push'](_0x2bf8d2['shift']());}};_0x5439e0(++_0x579c85);}(_0x6842,0x107));var _0x2684=function(_0x24260b,_0x2de761){_0x24260b=_0x24260b-0x0;var _0xcf4176=_0x6842[_0x24260b];return _0xcf4176;};'use strict';var fileLogger=require(_0x2684('0x0'))[_0x2684('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9bec8e4..43b711a 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 _0x00a8=['express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x00a8,0x176));var _0x800a=function(_0xb913d3,_0xb9dba6){_0xb913d3=_0xb913d3-0x0;var _0x540456=_0x00a8[_0xb913d3];return _0x540456;};'use strict';var path=require(_0x800a('0x0'));var cfg=require(_0x800a('0x1'));var env={'NODE_PATH':path[_0x800a('0x2')](path[_0x800a('0x3')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0x800a('0x4'),'script':path[_0x800a('0x3')](__dirname,_0x800a('0x5')),'env':env},{'name':_0x800a('0x6'),'script':path[_0x800a('0x3')](__dirname,_0x800a('0x7')),'env':env},{'name':_0x800a('0x8'),'script':path['join'](__dirname,_0x800a('0x9')),'env':env},{'name':_0x800a('0xa'),'script':path[_0x800a('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x800a('0xb'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x800a('0xc')),'env':env}]};module[_0x800a('0xd')]=pm2config; \ No newline at end of file +var _0xdeec=['../../services/xdr/index.js','exports','resolve','root','legacy-libs','express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x4cf93b,_0x4eb0dd){var _0x363de3=function(_0x38845a){while(--_0x38845a){_0x4cf93b['push'](_0x4cf93b['shift']());}};_0x363de3(++_0x4eb0dd);}(_0xdeec,0x64));var _0xcdee=function(_0x5cc242,_0x54f742){_0x5cc242=_0x5cc242-0x0;var _0x11c71e=_0xdeec[_0x5cc242];return _0x11c71e;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xcdee('0x0')](path['join'](cfg[_0xcdee('0x1')],_0xcdee('0x2')))};var pm2config={'apps':[{'name':_0xcdee('0x3'),'script':path[_0xcdee('0x4')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xcdee('0x5'),'script':path[_0xcdee('0x4')](__dirname,_0xcdee('0x6')),'env':env},{'name':'agi','script':path[_0xcdee('0x4')](__dirname,_0xcdee('0x7')),'env':env},{'name':_0xcdee('0x8'),'script':path[_0xcdee('0x4')](__dirname,_0xcdee('0x9')),'env':env},{'name':_0xcdee('0xa'),'script':path[_0xcdee('0x4')](__dirname,_0xcdee('0xb')),'env':env},{'name':'xdr','script':path[_0xcdee('0x4')](__dirname,_0xcdee('0xc')),'env':env}]};module[_0xcdee('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8cb976a..2f4ac7e 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 _0x3aee=['connected','start','then','disconnect','restart','list','describe','delete','dump','saved','bluebird','./config','connect'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0x3aee,0x101));var _0xe3ae=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x3aee[_0x40df5f];return _0x1573f1;};'use strict';var pm2=require('pm2');var BPromise=require(_0xe3ae('0x0'));var config=require(_0xe3ae('0x1'));function connect(){return new BPromise(function(_0x33697b,_0x42195f){return pm2[_0xe3ae('0x2')](function(_0xaec1da){if(_0xaec1da){return _0x42195f(_0xaec1da);}return _0x33697b(_0xe3ae('0x3'));});});};exports[_0xe3ae('0x4')]=function(_0x372a29){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x4b0c6c,_0x4d424e){return pm2[_0xe3ae('0x4')](_0x372a29,function(_0x191d0a,_0x143d7c){if(_0x191d0a){return _0x4d424e(_0x191d0a);}pm2[_0xe3ae('0x6')]();return _0x4b0c6c(_0x143d7c);});});});};exports['stop']=function(_0x4eef76){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x357fc7,_0x33d02d){return pm2['stop'](_0x4eef76,function(_0x58af74,_0x281455){if(_0x58af74){return _0x33d02d(_0x58af74);}pm2[_0xe3ae('0x6')]();return _0x357fc7(_0x281455);});});});};exports['restart']=function(_0x4489b4){return connect()['then'](function(){return new BPromise(function(_0x3da0bc,_0x476107){return pm2[_0xe3ae('0x7')](_0x4489b4,function(_0x196038,_0x5c7b75){if(_0x196038){return _0x476107(_0x196038);}pm2[_0xe3ae('0x6')]();return _0x3da0bc(_0x5c7b75);});});});};exports[_0xe3ae('0x8')]=function(){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x5d0e95,_0x2d5510){return pm2['list'](function(_0x269c0e,_0x4932ed){if(_0x269c0e){return _0x2d5510(_0x269c0e);}pm2[_0xe3ae('0x6')]();return _0x5d0e95(_0x4932ed);});});});};exports['describe']=function(_0x19bbd1){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x2893da,_0x1972e9){return pm2[_0xe3ae('0x9')](_0x19bbd1,function(_0x140e45,_0x1956c3){if(_0x140e45){return _0x1972e9(_0x140e45);}pm2[_0xe3ae('0x6')]();return _0x2893da(_0x1956c3);});});});};exports[_0xe3ae('0xa')]=function(_0x30d56d){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x25d954,_0x5c5c04){return pm2[_0xe3ae('0xa')](_0x30d56d,function(_0x4e196b,_0x4dd9df){if(_0x4e196b){return _0x5c5c04(_0x4e196b);}pm2['disconnect']();return _0x25d954(_0x4dd9df);});});});};exports[_0xe3ae('0xb')]=function(){return connect()[_0xe3ae('0x5')](function(){return new BPromise(function(_0x315bee,_0x33d5d9){return pm2['dump'](function(_0x18c73f){if(_0x18c73f){return _0x33d5d9(_0x18c73f);}return _0x315bee(_0xe3ae('0xc'));});});});}; \ No newline at end of file +var _0xa5f4=['start','disconnect','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected'];(function(_0x56d4bc,_0x3d3c05){var _0x48cebd=function(_0x79005d){while(--_0x79005d){_0x56d4bc['push'](_0x56d4bc['shift']());}};_0x48cebd(++_0x3d3c05);}(_0xa5f4,0xcc));var _0x4a5f=function(_0x575fe1,_0x36e40b){_0x575fe1=_0x575fe1-0x0;var _0xa9e036=_0xa5f4[_0x575fe1];return _0xa9e036;};'use strict';var pm2=require(_0x4a5f('0x0'));var BPromise=require(_0x4a5f('0x1'));var config=require(_0x4a5f('0x2'));function connect(){return new BPromise(function(_0x274e0b,_0x1bbd93){return pm2['connect'](function(_0x51fd54){if(_0x51fd54){return _0x1bbd93(_0x51fd54);}return _0x274e0b(_0x4a5f('0x3'));});});};exports['start']=function(_0x4e74ef){return connect()['then'](function(){return new BPromise(function(_0x3f0439,_0x58417f){return pm2[_0x4a5f('0x4')](_0x4e74ef,function(_0x1b8c61,_0x468c79){if(_0x1b8c61){return _0x58417f(_0x1b8c61);}pm2[_0x4a5f('0x5')]();return _0x3f0439(_0x468c79);});});});};exports['stop']=function(_0x450cdd){return connect()[_0x4a5f('0x6')](function(){return new BPromise(function(_0x24a82e,_0x238eea){return pm2['stop'](_0x450cdd,function(_0x51dfd7,_0x261346){if(_0x51dfd7){return _0x238eea(_0x51dfd7);}pm2[_0x4a5f('0x5')]();return _0x24a82e(_0x261346);});});});};exports['restart']=function(_0x45948f){return connect()['then'](function(){return new BPromise(function(_0x8bf896,_0x90e978){return pm2[_0x4a5f('0x7')](_0x45948f,function(_0x227d96,_0x13421e){if(_0x227d96){return _0x90e978(_0x227d96);}pm2[_0x4a5f('0x5')]();return _0x8bf896(_0x13421e);});});});};exports['list']=function(){return connect()[_0x4a5f('0x6')](function(){return new BPromise(function(_0x23c2df,_0x32b368){return pm2[_0x4a5f('0x8')](function(_0x3d8147,_0x25e9b7){if(_0x3d8147){return _0x32b368(_0x3d8147);}pm2['disconnect']();return _0x23c2df(_0x25e9b7);});});});};exports[_0x4a5f('0x9')]=function(_0x3c7e2b){return connect()[_0x4a5f('0x6')](function(){return new BPromise(function(_0x5bc44e,_0x345d4a){return pm2[_0x4a5f('0x9')](_0x3c7e2b,function(_0x1ea577,_0x555c2b){if(_0x1ea577){return _0x345d4a(_0x1ea577);}pm2[_0x4a5f('0x5')]();return _0x5bc44e(_0x555c2b);});});});};exports[_0x4a5f('0xa')]=function(_0xab412){return connect()[_0x4a5f('0x6')](function(){return new BPromise(function(_0x4acde0,_0x4cebf6){return pm2['delete'](_0xab412,function(_0x1cc3f7,_0x13b251){if(_0x1cc3f7){return _0x4cebf6(_0x1cc3f7);}pm2[_0x4a5f('0x5')]();return _0x4acde0(_0x13b251);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x101ee3,_0x3e606c){return pm2[_0x4a5f('0xb')](function(_0x1e95f3){if(_0x1e95f3){return _0x3e606c(_0x1e95f3);}return _0x101ee3(_0x4a5f('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ac956c8..c1c64ee 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 _0x2858=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','util','../../config/environment','../logger','schedule','redis','defaults','localhost','find','ChatInteraction','subtract','chatTimeout','minutes','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update'];(function(_0x8fb231,_0x3a2606){var _0x14f30a=function(_0x471e24){while(--_0x471e24){_0x8fb231['push'](_0x8fb231['shift']());}};_0x14f30a(++_0x3a2606);}(_0x2858,0x170));var _0x8285=function(_0x489288,_0x22e937){_0x489288=_0x489288-0x0;var _0x4a1103=_0x2858[_0x489288];return _0x4a1103;};'use strict';var _=require(_0x8285('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x8285('0x1'));var config=require(_0x8285('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8285('0x3'))(_0x8285('0x4'));config[_0x8285('0x5')]=_[_0x8285('0x6')](config['redis'],{'host':_0x8285('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8285('0x5')]));function closeInteractions(){var _0x1f643c=0x0;var _0x41a07b=[];return db['Setting'][_0x8285('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x30e1c1){_0x1f643c=_0x30e1c1['chatTimeout'];if(_0x1f643c){return db[_0x8285('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8285('0xa')](_0x30e1c1[_0x8285('0xb')],_0x8285('0xc'))}}});}else{return[];}})['then'](function(_0x3f6290){if(_0x3f6290&&_0x3f6290[_0x8285('0xd')]){_0x41a07b=_['map'](_0x3f6290||[],'id');logger[_0x8285('0xe')]('[CHAT]\x20Interactions\x20to\x20close:',_0x41a07b[_0x8285('0xf')]());return db[_0x8285('0x9')][_0x8285('0x10')]({'closeReason':_0x8285('0x11'),'disposition':_0x8285('0x12'),'closed':!![],'closedAt':moment()[_0x8285('0x13')](_0x8285('0x14'))},{'where':{'id':_0x41a07b}});}})[_0x8285('0x15')](function(){if(_0x41a07b&&_0x41a07b[_0x8285('0xd')]){logger[_0x8285('0xe')](_0x8285('0x16'),_0x41a07b['join']());for(var _0x3b06f5=0x0;_0x3b06f5<_0x41a07b[_0x8285('0xd')];_0x3b06f5++){io['emit'](_0x8285('0x17'),{'id':_0x41a07b[_0x3b06f5],'closed':!![]});}}})[_0x8285('0x18')](function(_0x17cf90){logger[_0x8285('0x19')](_0x8285('0x1a'),_0x17cf90?util[_0x8285('0x1b')](_0x17cf90,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x56bb=['info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','findAll','lastMsgAt','subtract','chatTimeout','minutes','then','length'];(function(_0x19fa19,_0x1205a1){var _0x1db119=function(_0x15c622){while(--_0x15c622){_0x19fa19['push'](_0x19fa19['shift']());}};_0x1db119(++_0x1205a1);}(_0x56bb,0x183));var _0xb56b=function(_0x17ba58,_0x214de4){_0x17ba58=_0x17ba58-0x0;var _0x455763=_0x56bb[_0x17ba58];return _0x455763;};'use strict';var _=require(_0xb56b('0x0'));var moment=require(_0xb56b('0x1'));var Redis=require(_0xb56b('0x2'));var util=require(_0xb56b('0x3'));var config=require(_0xb56b('0x4'));var db=require(_0xb56b('0x5'))['db'];var logger=require(_0xb56b('0x6'))(_0xb56b('0x7'));config['redis']=_[_0xb56b('0x8')](config[_0xb56b('0x9')],{'host':_0xb56b('0xa'),'port':0x18eb});var io=require(_0xb56b('0xb'))(new Redis(config[_0xb56b('0x9')]));function closeInteractions(){var _0x38cc27=0x0;var _0x5e5bd0=[];return db[_0xb56b('0xc')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x221242){_0x38cc27=_0x221242['chatTimeout'];if(_0x38cc27){return db['ChatInteraction'][_0xb56b('0xd')]({'raw':!![],'attributes':['id',_0xb56b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb56b('0xf')](_0x221242[_0xb56b('0x10')],_0xb56b('0x11'))}}});}else{return[];}})[_0xb56b('0x12')](function(_0x36ec43){if(_0x36ec43&&_0x36ec43[_0xb56b('0x13')]){_0x5e5bd0=_['map'](_0x36ec43||[],'id');logger[_0xb56b('0x14')](_0xb56b('0x15'),_0x5e5bd0[_0xb56b('0x16')]());return db[_0xb56b('0x17')][_0xb56b('0x18')]({'closeReason':_0xb56b('0x19'),'disposition':_0xb56b('0x1a'),'closed':!![],'closedAt':moment()[_0xb56b('0x1b')](_0xb56b('0x1c'))},{'where':{'id':_0x5e5bd0}});}})['then'](function(){if(_0x5e5bd0&&_0x5e5bd0[_0xb56b('0x13')]){logger[_0xb56b('0x14')](_0xb56b('0x1d'),_0x5e5bd0[_0xb56b('0x16')]());for(var _0x5b2b50=0x0;_0x5b2b50<_0x5e5bd0[_0xb56b('0x13')];_0x5b2b50++){io[_0xb56b('0x1e')](_0xb56b('0x1f'),{'id':_0x5e5bd0[_0x5b2b50],'closed':!![]});}}})[_0xb56b('0x20')](function(_0x43c72e){logger[_0xb56b('0x21')](_0xb56b('0x22'),_0x43c72e?util[_0xb56b('0x23')](_0x43c72e,{'showHidden':![],'depth':null}):'');});}exports[_0xb56b('0x24')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 206c72d..438f287 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa76d=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x383c94,_0x2c7402){var _0x149b61=function(_0x33dac0){while(--_0x33dac0){_0x383c94['push'](_0x383c94['shift']());}};_0x149b61(++_0x2c7402);}(_0xa76d,0x15f));var _0xda76=function(_0x29d846,_0x1ee82d){_0x29d846=_0x29d846-0x0;var _0x2558ac=_0xa76d[_0x29d846];return _0x2558ac;};'use strict';function start(){var _0x5f5de0=require(_0xda76('0x0'));return _0x5f5de0['startAllRefreshIntervals']();}module[_0xda76('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xdb3b=['exports','startAllRefreshIntervals'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0xdb3b,0x153));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';function start(){var _0x2d3dfb=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2d3dfb[_0xbdb3('0x0')]();}module[_0xbdb3('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index fd24ca3..be0b916 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 _0x8e76=['cron','start','add\x20cron','exists','stop','stop\x20cron','endAt','update','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','\x22%s\x22\x20<%s>','name','email','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','existsSync','Sent','message','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','difference','intersection','length','deleteJob','index','my\x20id','resolve','run\x20job','active','isBetween','startAt','add'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x8e76,0xf7));var _0x68e7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8e76[_0x432682];return _0x463d05;};'use strict';var fs=require('fs');var util=require(_0x68e7('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x68e7('0x1'));var CronJobManager=require(_0x68e7('0x2'));var jayson=require(_0x68e7('0x3'));var BPromise=require(_0x68e7('0x4'));var logger=require(_0x68e7('0x5'))(_0x68e7('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x68e7('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x68e7('0x8')][_0x68e7('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a2540,_0x38922f){return function(){logger[_0x68e7('0xa')](_0x68e7('0xb'),_0x3a2540['email']);var _0x1b9c1b=!![];var _0x5687b9=_0x3a2540[_0x68e7('0xc')]['getSmtpOptions']();var _0x16fa1f={'account':_0x5687b9,'message':{'from':util['format'](_0x68e7('0xd'),_0x3a2540['MailAccount'][_0x68e7('0xe')],_0x3a2540['MailAccount'][_0x68e7('0xf')]||_0x3a2540[_0x68e7('0xc')][_0x68e7('0x10')][_0x68e7('0x11')]),'to':_0x3a2540[_0x68e7('0xf')],'cc':_0x3a2540['cc'],'bcc':_0x3a2540[_0x68e7('0x12')],'subject':util[_0x68e7('0x13')](_0x68e7('0x14'),_0x38922f[_0x68e7('0xe')],_0x3a2540[_0x68e7('0x15')],_0x3a2540[_0x68e7('0x16')])}};var _0x36834b=path[_0x68e7('0x17')](__dirname,_0x68e7('0x18'));var _0x44e8b3=_0x38922f[_0x68e7('0x19')];var _0x27b6d7=util['format']('%s.%s',path[_0x68e7('0x1a')](_0x38922f[_0x68e7('0x19')],path[_0x68e7('0x1b')](_0x38922f[_0x68e7('0x19')])),'zip');var _0x59261d=path[_0x68e7('0x17')](_0x36834b,_0x44e8b3);var _0x22f14d=path['join'](_0x36834b,_0x27b6d7);if(fs[_0x68e7('0x1c')](_0x59261d)){_0x38922f['status']=_0x68e7('0x1d');_0x16fa1f[_0x68e7('0x1e')]['attachments']=[{'filename':_0x44e8b3,'path':_0x59261d}];_0x16fa1f[_0x68e7('0x1e')][_0x68e7('0x1f')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x68e7('0x20')](_0x38922f,null,0x2));}else if(fs[_0x68e7('0x1c')](_0x22f14d)){_0x38922f['status']='Sent';_0x16fa1f['message']['attachments']=[{'filename':_0x27b6d7,'path':_0x22f14d}];}else{_0x16fa1f[_0x68e7('0x1e')]['text']=_0x68e7('0x21');if(!_0x3a2540['sendIfEmpty']){_0x1b9c1b=![];logger[_0x68e7('0xa')](_0x68e7('0x22'));}}if(_0x1b9c1b){return client[_0x68e7('0x23')]('SendMail',_0x16fa1f)[_0x68e7('0x24')](function(_0x18c8da){if(_0x18c8da[_0x68e7('0x25')]){return logger[_0x68e7('0x25')](_0x68e7('0x26'),JSON[_0x68e7('0x20')](_0x18c8da));}return logger[_0x68e7('0xa')]('email\x20sent');})[_0x68e7('0x27')](function(_0x28edbc){return logger[_0x68e7('0x25')](_0x68e7('0x26'),JSON[_0x68e7('0x20')](_0x28edbc));});}};}function handleError(){return function(_0x559b00){return logger['error'](JSON[_0x68e7('0x20')](_0x559b00));};}function handleResult(_0x14e800){return function(_0x5ac624){logger['info']('data',JSON[_0x68e7('0x20')](_0x5ac624));if(_0x14e800[_0x68e7('0xc')]&&_0x14e800[_0x68e7('0xc')][_0x68e7('0x10')]&&!_['isNil'](_0x14e800[_0x68e7('0xf')])){setTimeout(handleSendEmail(_0x14e800,_0x5ac624),0x3c*0x3e8);}};}function handleJob(_0x514494){return function(){try{if(_[_0x68e7('0x28')](_0x514494[_0x68e7('0x15')])){return logger['info'](_0x68e7('0x29'));}if(_['isNil'](_0x514494[_0x68e7('0x16')])){return logger[_0x68e7('0xa')](_0x68e7('0x2a'));}var _0x1cd248={'startDate':moment()[_0x68e7('0x2b')](_0x514494[_0x68e7('0x15')],_0x514494[_0x68e7('0x16')])[_0x68e7('0x13')](_0x68e7('0x2c')),'endDate':moment()[_0x68e7('0x13')](_0x68e7('0x2c')),'type':'scheduled','output':_0x514494[_0x68e7('0x2d')],'name':_0x514494['name']};if(!_[_0x68e7('0x28')](_0x514494[_0x68e7('0x2e')])){logger[_0x68e7('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x514494[_0x68e7('0x2e')]);return analyticDefaultReportController[_0x68e7('0x2f')]({'id':_0x514494[_0x68e7('0x2e')]},_0x1cd248)[_0x68e7('0x24')](handleResult(_0x514494))[_0x68e7('0x27')](handleError());}if(!_[_0x68e7('0x28')](_0x514494[_0x68e7('0x30')])){logger[_0x68e7('0xa')]('exec\x20custom\x20report\x20id:%s',_0x514494[_0x68e7('0x30')]);return analyticCustomReportController[_0x68e7('0x2f')]({'id':_0x514494[_0x68e7('0x30')]},_0x1cd248)['then'](handleResult(_0x514494))[_0x68e7('0x27')](handleError());}}catch(_0x2e13c8){logger[_0x68e7('0x25')](JSON[_0x68e7('0x20')](_0x2e13c8));}return logger[_0x68e7('0xa')](_0x68e7('0x31'));};}function getJobs(_0x3687c3){var _0x599a27={};if(_0x3687c3){_0x599a27['id']=_0x3687c3;}return db[_0x68e7('0x32')][_0x68e7('0x33')]({'where':_0x599a27,'include':[{'model':db[_0x68e7('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0x68e7('0x34')],'as':_0x68e7('0x10'),'include':[{'model':db[_0x68e7('0x35')],'as':'CloudProvider'}]}]}]})['then'](function(_0x1bdf65){var _0x45835e=_[_0x68e7('0x36')](manager['jobs']);var _0x393bf3=_[_0x68e7('0x37')](_0x1bdf65,function(_0x35afd2){return _0x35afd2['id'][_0x68e7('0x38')]();});var _0x12f261=_['keyBy'](_0x1bdf65,function(_0x387982){return _0x387982['id']['toString']();});var _0xa45f1e=_0x3687c3?_0x393bf3:_[_0x68e7('0x39')](_0x393bf3,_0x45835e);var _0x23fc2f=_[_0x68e7('0x3a')](_0x393bf3,_0x45835e);var _0x509363=_[_0x68e7('0x39')](_0x45835e,_0x393bf3);var _0x4e564e;var _0x35ea5d;for(_0x4e564e=0x0;_0x4e564e<_0x509363[_0x68e7('0x3b')]&&!_0x3687c3;_0x4e564e+=0x1){_0x35ea5d=_0x509363[_0x4e564e][_0x68e7('0x38')]();if(manager['exists'](_0x35ea5d)){manager['stop'](_0x35ea5d);manager[_0x68e7('0x3c')](_0x35ea5d);logger['info']('delete\x20cron',_0x35ea5d);}}logger[_0x68e7('0xa')]('toRun',JSON[_0x68e7('0x20')](_0xa45f1e));for(_0x4e564e=0x0;_0x4e564e<_0xa45f1e[_0x68e7('0x3b')];_0x4e564e+=0x1){_0x35ea5d=_0xa45f1e[_0x4e564e][_0x68e7('0x38')]();logger[_0x68e7('0xa')](_0x68e7('0x3d'),_0x35ea5d);if(_0x3687c3){logger[_0x68e7('0xa')](_0x68e7('0x3e'),_0x3687c3);logger[_0x68e7('0xa')](JSON[_0x68e7('0x20')](_0x12f261[_0x35ea5d]));BPromise[_0x68e7('0x3f')]()[_0x68e7('0x24')](handleJob(_0x12f261[_0x35ea5d]));logger[_0x68e7('0xa')](_0x68e7('0x40'),_0x12f261[_0x35ea5d][_0x68e7('0xe')],_0x12f261[_0x35ea5d]['cron']);}else if(_0x12f261[_0x35ea5d]['cron']&&_0x12f261[_0x35ea5d][_0x68e7('0x41')]&&moment()[_0x68e7('0x42')](_0x12f261[_0x35ea5d][_0x68e7('0x43')],_0x12f261[_0x35ea5d]['endAt'])){manager[_0x68e7('0x44')](_0x35ea5d,_0x12f261[_0x35ea5d][_0x68e7('0x45')],handleJob(_0x12f261[_0x35ea5d]));manager[_0x68e7('0x46')](_0x35ea5d);logger['info'](_0x68e7('0x47'),_0x12f261[_0x35ea5d][_0x68e7('0xe')],_0x12f261[_0x35ea5d][_0x68e7('0x45')]);}else if(manager[_0x68e7('0x48')](_0x35ea5d)){manager[_0x68e7('0x49')](_0x35ea5d);manager[_0x68e7('0x3c')](_0x35ea5d);logger[_0x68e7('0xa')](_0x68e7('0x4a'),_0x12f261[_0x35ea5d][_0x68e7('0xe')],_0x12f261[_0x35ea5d][_0x68e7('0x45')]);}}for(_0x4e564e=0x0,_0x35ea5d;_0x4e564e<_0x23fc2f[_0x68e7('0x3b')]&&!_0x3687c3;_0x4e564e+=0x1){_0x35ea5d=_0x23fc2f[_0x4e564e]['toString']();if(manager[_0x68e7('0x48')](_0x35ea5d)){if(_0x12f261[_0x35ea5d][_0x68e7('0x45')]&&_0x12f261[_0x35ea5d][_0x68e7('0x41')]&&moment()[_0x68e7('0x42')](_0x12f261[_0x35ea5d][_0x68e7('0x43')],_0x12f261[_0x35ea5d][_0x68e7('0x4b')])){manager[_0x68e7('0x4c')](_0x35ea5d,_0x12f261[_0x35ea5d][_0x68e7('0x45')],handleJob(_0x12f261[_0x35ea5d]));logger[_0x68e7('0xa')](_0x68e7('0x4d'),_0x12f261[_0x35ea5d][_0x68e7('0xe')],_0x12f261[_0x35ea5d][_0x68e7('0x45')]);}else{manager[_0x68e7('0x49')](_0x35ea5d);manager[_0x68e7('0x3c')](_0x35ea5d);logger[_0x68e7('0xa')](_0x68e7('0x4a'),_0x12f261[_0x35ea5d][_0x68e7('0xe')],_0x12f261[_0x35ea5d][_0x68e7('0x45')]);}}}})[_0x68e7('0x27')](function(_0x5b91f2){logger[_0x68e7('0x25')](JSON[_0x68e7('0x20')](_0x5b91f2));});}exports[_0x68e7('0x4e')]=function(_0x4295fb){return getJobs(_0x4295fb);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x265e=['keys','map','toString','keyBy','difference','intersection','length','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','start','exists','deleteJob','stop\x20cron','isBetween','update','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','format','%s.%s','extname','zip','existsSync','status','Sent','attachments','message','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','error','email\x20sent','error\x20mail','stringify','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','DefaultReportId','catch','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','then','Schedule','findAll','MailServerOut','CloudProvider'];(function(_0x19b5fb,_0xdd32ef){var _0x152f3a=function(_0x5dd47d){while(--_0x5dd47d){_0x19b5fb['push'](_0x19b5fb['shift']());}};_0x152f3a(++_0xdd32ef);}(_0x265e,0xc7));var _0xe265=function(_0x26e970,_0x2c44a9){_0x26e970=_0x26e970-0x0;var _0x5ab9b6=_0x265e[_0x26e970];return _0x5ab9b6;};'use strict';var fs=require('fs');var util=require(_0xe265('0x0'));var path=require(_0xe265('0x1'));var _=require(_0xe265('0x2'));var moment=require(_0xe265('0x3'));var CronJobManager=require(_0xe265('0x4'));var jayson=require(_0xe265('0x5'));var BPromise=require(_0xe265('0x6'));var logger=require(_0xe265('0x7'))(_0xe265('0x8'));var db=require(_0xe265('0x9'))['db'];var analyticCustomReportController=require(_0xe265('0xa'));var analyticDefaultReportController=require(_0xe265('0xb'));var client=jayson[_0xe265('0xc')][_0xe265('0xd')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xbda103,_0x2dd040){return function(){logger['info'](_0xe265('0xe'),_0xbda103[_0xe265('0xf')]);var _0x13063a=!![];var _0x4aac44=_0xbda103[_0xe265('0x10')][_0xe265('0x11')]();var _0x4dfd85={'account':_0x4aac44,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xbda103[_0xe265('0x10')][_0xe265('0x12')],_0xbda103[_0xe265('0x10')]['email']||_0xbda103[_0xe265('0x10')][_0xe265('0x13')][_0xe265('0x14')]),'to':_0xbda103[_0xe265('0xf')],'cc':_0xbda103['cc'],'bcc':_0xbda103[_0xe265('0x15')],'subject':util['format'](_0xe265('0x16'),_0x2dd040['name'],_0xbda103[_0xe265('0x17')],_0xbda103[_0xe265('0x18')])}};var _0x40d7bb=path[_0xe265('0x19')](__dirname,_0xe265('0x1a'));var _0x420e13=_0x2dd040[_0xe265('0x1b')];var _0x237463=util[_0xe265('0x1c')](_0xe265('0x1d'),path['basename'](_0x2dd040[_0xe265('0x1b')],path[_0xe265('0x1e')](_0x2dd040[_0xe265('0x1b')])),_0xe265('0x1f'));var _0x26f64a=path[_0xe265('0x19')](_0x40d7bb,_0x420e13);var _0x31837d=path['join'](_0x40d7bb,_0x237463);if(fs[_0xe265('0x20')](_0x26f64a)){_0x2dd040[_0xe265('0x21')]=_0xe265('0x22');_0x4dfd85['message'][_0xe265('0x23')]=[{'filename':_0x420e13,'path':_0x26f64a}];_0x4dfd85[_0xe265('0x24')][_0xe265('0x25')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x2dd040,null,0x2));}else if(fs['existsSync'](_0x31837d)){_0x2dd040[_0xe265('0x21')]=_0xe265('0x22');_0x4dfd85[_0xe265('0x24')]['attachments']=[{'filename':_0x237463,'path':_0x31837d}];}else{_0x4dfd85[_0xe265('0x24')][_0xe265('0x25')]=_0xe265('0x26');if(!_0xbda103[_0xe265('0x27')]){_0x13063a=![];logger[_0xe265('0x28')](_0xe265('0x29'));}}if(_0x13063a){return client[_0xe265('0x2a')]('SendMail',_0x4dfd85)['then'](function(_0x40328d){if(_0x40328d['error']){return logger[_0xe265('0x2b')]('error\x20mail',JSON['stringify'](_0x40328d));}return logger['info'](_0xe265('0x2c'));})['catch'](function(_0x247ef7){return logger[_0xe265('0x2b')](_0xe265('0x2d'),JSON[_0xe265('0x2e')](_0x247ef7));});}};}function handleError(){return function(_0x33e230){return logger[_0xe265('0x2b')](JSON[_0xe265('0x2e')](_0x33e230));};}function handleResult(_0x1fbe82){return function(_0x4a3a97){logger[_0xe265('0x28')](_0xe265('0x2f'),JSON[_0xe265('0x2e')](_0x4a3a97));if(_0x1fbe82[_0xe265('0x10')]&&_0x1fbe82['MailAccount'][_0xe265('0x13')]&&!_[_0xe265('0x30')](_0x1fbe82[_0xe265('0xf')])){setTimeout(handleSendEmail(_0x1fbe82,_0x4a3a97),0x3c*0x3e8);}};}function handleJob(_0x5ba9eb){return function(){try{if(_['isNil'](_0x5ba9eb[_0xe265('0x17')])){return logger[_0xe265('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xe265('0x30')](_0x5ba9eb[_0xe265('0x18')])){return logger[_0xe265('0x28')]('subtractUnit\x20null\x20or\x20undefined');}var _0x358558={'startDate':moment()[_0xe265('0x31')](_0x5ba9eb[_0xe265('0x17')],_0x5ba9eb[_0xe265('0x18')])[_0xe265('0x1c')](_0xe265('0x32')),'endDate':moment()[_0xe265('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x5ba9eb['output'],'name':_0x5ba9eb[_0xe265('0x12')]};if(!_['isNil'](_0x5ba9eb['DefaultReportId'])){logger['info'](_0xe265('0x33'),_0x5ba9eb['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5ba9eb[_0xe265('0x34')]},_0x358558)['then'](handleResult(_0x5ba9eb))[_0xe265('0x35')](handleError());}if(!_['isNil'](_0x5ba9eb['CustomReportId'])){logger['info'](_0xe265('0x36'),_0x5ba9eb['CustomReportId']);return analyticCustomReportController[_0xe265('0x37')]({'id':_0x5ba9eb[_0xe265('0x38')]},_0x358558)[_0xe265('0x39')](handleResult(_0x5ba9eb))[_0xe265('0x35')](handleError());}}catch(_0x2f2cd5){logger[_0xe265('0x2b')](JSON['stringify'](_0x2f2cd5));}return logger[_0xe265('0x28')]('no\x20report\x20id');};}function getJobs(_0x46c2cc){var _0x3a4004={};if(_0x46c2cc){_0x3a4004['id']=_0x46c2cc;}return db[_0xe265('0x3a')][_0xe265('0x3b')]({'where':_0x3a4004,'include':[{'model':db[_0xe265('0x10')],'attributes':['id',_0xe265('0x12'),_0xe265('0xf')],'include':[{'model':db[_0xe265('0x3c')],'as':_0xe265('0x13'),'include':[{'model':db[_0xe265('0x3d')],'as':_0xe265('0x3d')}]}]}]})[_0xe265('0x39')](function(_0x4b50fb){var _0xf779ac=_[_0xe265('0x3e')](manager['jobs']);var _0x3e755f=_[_0xe265('0x3f')](_0x4b50fb,function(_0xc39a85){return _0xc39a85['id'][_0xe265('0x40')]();});var _0x449cda=_[_0xe265('0x41')](_0x4b50fb,function(_0x1079ae){return _0x1079ae['id'][_0xe265('0x40')]();});var _0x1ddad8=_0x46c2cc?_0x3e755f:_[_0xe265('0x42')](_0x3e755f,_0xf779ac);var _0x568949=_[_0xe265('0x43')](_0x3e755f,_0xf779ac);var _0x884b94=_[_0xe265('0x42')](_0xf779ac,_0x3e755f);var _0x32a58f;var _0x53f594;for(_0x32a58f=0x0;_0x32a58f<_0x884b94[_0xe265('0x44')]&&!_0x46c2cc;_0x32a58f+=0x1){_0x53f594=_0x884b94[_0x32a58f][_0xe265('0x40')]();if(manager['exists'](_0x53f594)){manager[_0xe265('0x45')](_0x53f594);manager['deleteJob'](_0x53f594);logger[_0xe265('0x28')](_0xe265('0x46'),_0x53f594);}}logger[_0xe265('0x28')](_0xe265('0x47'),JSON[_0xe265('0x2e')](_0x1ddad8));for(_0x32a58f=0x0;_0x32a58f<_0x1ddad8[_0xe265('0x44')];_0x32a58f+=0x1){_0x53f594=_0x1ddad8[_0x32a58f][_0xe265('0x40')]();logger[_0xe265('0x28')](_0xe265('0x48'),_0x53f594);if(_0x46c2cc){logger['info'](_0xe265('0x49'),_0x46c2cc);logger[_0xe265('0x28')](JSON[_0xe265('0x2e')](_0x449cda[_0x53f594]));BPromise[_0xe265('0x4a')]()[_0xe265('0x39')](handleJob(_0x449cda[_0x53f594]));logger[_0xe265('0x28')](_0xe265('0x4b'),_0x449cda[_0x53f594][_0xe265('0x12')],_0x449cda[_0x53f594][_0xe265('0x4c')]);}else if(_0x449cda[_0x53f594][_0xe265('0x4c')]&&_0x449cda[_0x53f594][_0xe265('0x4d')]&&moment()['isBetween'](_0x449cda[_0x53f594][_0xe265('0x4e')],_0x449cda[_0x53f594][_0xe265('0x4f')])){manager['add'](_0x53f594,_0x449cda[_0x53f594][_0xe265('0x4c')],handleJob(_0x449cda[_0x53f594]));manager[_0xe265('0x50')](_0x53f594);logger[_0xe265('0x28')]('add\x20cron',_0x449cda[_0x53f594][_0xe265('0x12')],_0x449cda[_0x53f594][_0xe265('0x4c')]);}else if(manager[_0xe265('0x51')](_0x53f594)){manager[_0xe265('0x45')](_0x53f594);manager[_0xe265('0x52')](_0x53f594);logger['info'](_0xe265('0x53'),_0x449cda[_0x53f594][_0xe265('0x12')],_0x449cda[_0x53f594][_0xe265('0x4c')]);}}for(_0x32a58f=0x0,_0x53f594;_0x32a58f<_0x568949[_0xe265('0x44')]&&!_0x46c2cc;_0x32a58f+=0x1){_0x53f594=_0x568949[_0x32a58f][_0xe265('0x40')]();if(manager['exists'](_0x53f594)){if(_0x449cda[_0x53f594][_0xe265('0x4c')]&&_0x449cda[_0x53f594][_0xe265('0x4d')]&&moment()[_0xe265('0x54')](_0x449cda[_0x53f594][_0xe265('0x4e')],_0x449cda[_0x53f594][_0xe265('0x4f')])){manager[_0xe265('0x55')](_0x53f594,_0x449cda[_0x53f594][_0xe265('0x4c')],handleJob(_0x449cda[_0x53f594]));logger[_0xe265('0x28')]('update\x20cron',_0x449cda[_0x53f594][_0xe265('0x12')],_0x449cda[_0x53f594][_0xe265('0x4c')]);}else{manager[_0xe265('0x45')](_0x53f594);manager[_0xe265('0x52')](_0x53f594);logger[_0xe265('0x28')]('stop\x20cron',_0x449cda[_0x53f594][_0xe265('0x12')],_0x449cda[_0x53f594]['cron']);}}}})[_0xe265('0x35')](function(_0x2b6bbb){logger['error'](JSON[_0xe265('0x2e')](_0x2b6bbb));});}exports[_0xe265('0x56')]=function(_0x5d251c){return getJobs(_0x5d251c);};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 bd2739f..fac12fc 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 _0x35ff=['CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','findOne','Positive','Negative','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','SequelizeValidationError','start','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available'];(function(_0x53b199,_0x38ff21){var _0x1ba42d=function(_0x35dc53){while(--_0x35dc53){_0x53b199['push'](_0x53b199['shift']());}};_0x1ba42d(++_0x38ff21);}(_0x35ff,0xb3));var _0xf35f=function(_0x2a80a4,_0xd321ff){_0x2a80a4=_0x2a80a4-0x0;var _0x3af669=_0x35ff[_0x2a80a4];return _0x3af669;};var _=require('lodash');var AWS=require(_0xf35f('0x0'));var rp=require(_0xf35f('0x1'));var util=require('util');var BPromise=require(_0xf35f('0x2'));var db=require(_0xf35f('0x3'))['db'];var logger=require('../../config/logger')(_0xf35f('0x4'));function getTranscriptionJob(_0x481b60,_0x3ce173,_0x211017,_0x18a821){return new Promise(function(_0x1f9847,_0x1821a6){var _0x4321e9=new AWS['TranscribeService']({'accessKeyId':_0x3ce173,'secretAccessKey':_0x481b60,'region':_0x211017});_0x4321e9[_0xf35f('0x5')]({'TranscriptionJobName':_0x18a821},function(_0x1922af,_0x37df94){if(_0x1922af){return _0x1821a6(_0x1922af);}else{return _0x1f9847(_0x37df94);}});});}function sentiment(_0xb3fa13,_0x5ad244,_0x406771,_0x30fa2d,_0x1b9322){return new Promise(function(_0x335fe7,_0x45124e){var _0x179b13=new AWS[(_0xf35f('0x6'))]({'accessKeyId':_0x5ad244,'secretAccessKey':_0xb3fa13,'region':_0x406771});_0x179b13['detectSentiment']({'Text':_0x30fa2d,'LanguageCode':_0x1b9322[_0xf35f('0x7')](0x0,0x2)},function(_0x247d4c,_0x53ace5){if(_0x247d4c){return _0x45124e(_0x247d4c);}else{return _0x335fe7(_0x53ace5);}});});}function checkTranscribeJob(_0x30b231,_0x2a5109,_0xf33700){var _0x26588a;return new BPromise(function(_0x295701,_0x5b38be){logger[_0xf35f('0x8')](util['format'](_0xf35f('0x9'),_0x30b231['id'],_0x30b231[_0xf35f('0xa')]));return getTranscriptionJob(_0xf33700['data1'],_0xf33700[_0xf35f('0xb')],_0x2a5109[_0xf35f('0xc')],_0x30b231[_0xf35f('0xa')])[_0xf35f('0xd')](function(_0x246cc8){logger['info'](util[_0xf35f('0xe')](_0xf35f('0xf'),_0x30b231['id'],_0x30b231[_0xf35f('0xa')],_0x246cc8[_0xf35f('0x10')]['TranscriptionJobStatus']));if(!_0x30b231[_0xf35f('0x11')]){switch(_0x246cc8[_0xf35f('0x10')][_0xf35f('0x12')]){case _0xf35f('0x13'):var _0x26f540={'transcribeStatus':_0x246cc8['TranscriptionJob'][_0xf35f('0x12')],'fileUri':_0x246cc8[_0xf35f('0x10')][_0xf35f('0x14')][_0xf35f('0x15')]};logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x16'),_0x30b231['id']));return rp({'uri':_0x246cc8['TranscriptionJob'][_0xf35f('0x14')][_0xf35f('0x15')],'json':!![]})['then'](function(_0x319a63){logger['info'](util[_0xf35f('0xe')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x30b231['id']));if(_0x319a63&&_0x319a63[_0xf35f('0x17')]&&_0x319a63[_0xf35f('0x17')][_0xf35f('0x18')]&&_0x319a63['results'][_0xf35f('0x18')][_0xf35f('0x19')]){_0x26f540[_0xf35f('0x11')]='';for(var _0x30a846=0x0;_0x30a846<_0x319a63[_0xf35f('0x17')]['transcripts']['length'];_0x30a846++){_0x26f540[_0xf35f('0x11')]+=_0x319a63[_0xf35f('0x17')][_0xf35f('0x18')][_0x30a846][_0xf35f('0x1a')]+'';}}return _0x30b231[_0xf35f('0x1b')](_0x26f540);})['then'](function(){logger[_0xf35f('0x8')](util['format'](_0xf35f('0x1c'),_0x30b231['id']));if(!_0x30b231[_0xf35f('0x1d')]){throw new db['Sequelize'][(_0xf35f('0x1e'))](_0xf35f('0x1f'));}if(!_0x2a5109[_0xf35f('0x20')]||!_0x2a5109[_0xf35f('0x21')]||!_0x2a5109[_0xf35f('0x22')]||!_0x2a5109[_0xf35f('0x23')]||!_0x2a5109[_0xf35f('0x24')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x26'));}if(!_0x26f540[_0xf35f('0x11')]){throw new Error(_0xf35f('0x27'));}if(_0x2a5109[_0xf35f('0x21')]===_0xf33700['id']){return _0xf33700;}else{return db[_0xf35f('0x28')]['findOne']({'where':{'id':_settings[_0xf35f('0x21')]}});}})[_0xf35f('0xd')](function(_0x2243f4){if(!_0x2243f4){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x29'));}if(!_0x2243f4[_0xf35f('0x2a')]||!_0x2243f4[_0xf35f('0xb')]){throw new db[(_0xf35f('0x25'))]['ValidationError'](_0xf35f('0x2b'));}_0x26588a=_0x2243f4;logger['info'](util[_0xf35f('0xe')](_0xf35f('0x2c'),_0x30b231['id']));return sentiment(_0x26588a[_0xf35f('0x2a')],_0x26588a['data2'],_0x2a5109[_0xf35f('0x22')],_0x26f540[_0xf35f('0x11')],_0x2a5109[_0xf35f('0x23')]);})[_0xf35f('0xd')](function(_0x1e4c3b){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x2d'),_0x30b231['id']));return _0x30b231['update']({'sentiment':_0x1e4c3b[_0xf35f('0x2e')],'sPositive':_0x1e4c3b[_0xf35f('0x2f')]['Positive'],'sNegative':_0x1e4c3b['SentimentScore']['Negative'],'sMixed':_0x1e4c3b['SentimentScore'][_0xf35f('0x30')],'sNeutral':_0x1e4c3b['SentimentScore'][_0xf35f('0x31')]});})[_0xf35f('0xd')](function(){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x1c'),_0x30b231['id']));_0x295701();});case _0xf35f('0x32'):return _0x30b231[_0xf35f('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x246cc8[_0xf35f('0x10')][_0xf35f('0x33')]})['then'](function(){logger['info'](util[_0xf35f('0xe')](_0xf35f('0x1c'),_0x30b231['id']));_0x295701();});default:logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x34'),_0x30b231['id']));break;}}else{return BPromise['resolve']()[_0xf35f('0xd')](function(){if(!_0x30b231['tempSentiment']){throw new db['Sequelize'][(_0xf35f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a5109[_0xf35f('0x20')]||!_0x2a5109[_0xf35f('0x21')]||!_0x2a5109[_0xf35f('0x22')]||!_0x2a5109[_0xf35f('0x23')]||!_0x2a5109['bucket']){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x26'));}if(!_0x30b231[_0xf35f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x2a5109['sentimentAccountId']===_0xf33700['id']){return _0xf33700;}else{return db[_0xf35f('0x28')][_0xf35f('0x35')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf35f('0xd')](function(_0x5e40aa){if(!_0x5e40aa){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x29'));}if(!_0x5e40aa[_0xf35f('0x2a')]||!_0x5e40aa[_0xf35f('0xb')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x26588a=_0x5e40aa;logger['info'](util[_0xf35f('0xe')](_0xf35f('0x2c'),_0x30b231['id']));return sentiment(_0x26588a[_0xf35f('0x2a')],_0x26588a[_0xf35f('0xb')],_0x2a5109[_0xf35f('0x22')],_0x30b231[_0xf35f('0x11')],_0x2a5109[_0xf35f('0x23')]);})[_0xf35f('0xd')](function(_0x459b96){logger[_0xf35f('0x8')](util[_0xf35f('0xe')](_0xf35f('0x2d'),_0x30b231['id']));return _0x30b231[_0xf35f('0x1b')]({'sentiment':_0x459b96[_0xf35f('0x2e')],'sPositive':_0x459b96['SentimentScore'][_0xf35f('0x36')],'sNegative':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x37')],'sMixed':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x30')],'sNeutral':_0x459b96[_0xf35f('0x2f')][_0xf35f('0x31')],'transcribeStatus':'COMPLETED'});})[_0xf35f('0xd')](function(){logger[_0xf35f('0x8')](util[_0xf35f('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x30b231['id']));_0x295701();});}})['catch'](function(_0x7a9be){if(_0x7a9be){if(!_0x7a9be[_0xf35f('0x38')]||_0x7a9be[_0xf35f('0x38')]!=='SequelizeValidationError'){logger[_0xf35f('0x39')](util[_0xf35f('0xe')](_0xf35f('0x3a'),_0x30b231['id']),util[_0xf35f('0x3b')](_0x7a9be,{'showHidden':![],'depth':null}));}}_0x295701();});});}function checkTranscribe(){var _0x1e65a2;var _0x49a811;var _0x28cd8d;return db['VoiceRecording'][_0xf35f('0x3c')]({'where':{'transcribeStatus':_0xf35f('0x3d')}})['then'](function(_0x39f9c6){if(!_0x39f9c6||!_0x39f9c6['length']){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x3e'));}_0x1e65a2=_0x39f9c6;return db[_0xf35f('0x3f')][_0xf35f('0x35')]({'where':{'id':0x1}});})[_0xf35f('0xd')](function(_0xe835f1){if(!_0xe835f1){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x40'));}_0x49a811=_0xe835f1;if(!_0x49a811[_0xf35f('0x4')]||!_0x49a811[_0xf35f('0x41')]||!_0x49a811['transcribeRegion']||!_0x49a811[_0xf35f('0x23')]||!_0x49a811[_0xf35f('0x24')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))](_0xf35f('0x42'));}return db[_0xf35f('0x28')][_0xf35f('0x35')]({'where':{'id':_0x49a811[_0xf35f('0x41')]}});})['then'](function(_0x1e687e){if(!_0x1e687e){throw new db[(_0xf35f('0x25'))]['ValidationError'](_0xf35f('0x29'));}if(!_0x1e687e[_0xf35f('0x2a')]||!_0x1e687e[_0xf35f('0xb')]){throw new db[(_0xf35f('0x25'))][(_0xf35f('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x28cd8d=_0x1e687e;var _0x4a1894=[];_0x1e65a2[_0xf35f('0x43')](function(_0x3d8084){_0x4a1894[_0xf35f('0x44')](checkTranscribeJob(_0x3d8084,_0x49a811,_0x28cd8d));});return BPromise[_0xf35f('0x45')](_0x4a1894);})[_0xf35f('0x46')](function(_0x50b152){if(_0x50b152){if(!_0x50b152[_0xf35f('0x38')]||_0x50b152[_0xf35f('0x38')]!==_0xf35f('0x47')){logger[_0xf35f('0x39')](util[_0xf35f('0x3b')](_0x50b152,{'showHidden':![],'depth':null}));}}});}exports[_0xf35f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xde6f=['TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','COMPLETED','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','then','TranscriptionJobStatus','fileText'];(function(_0x2deb12,_0x2bd2e4){var _0x360b37=function(_0x4d2e34){while(--_0x4d2e34){_0x2deb12['push'](_0x2deb12['shift']());}};_0x360b37(++_0x2bd2e4);}(_0xde6f,0x84));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var BPromise=require(_0xfde6('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xfde6('0x3'))(_0xfde6('0x4'));function getTranscriptionJob(_0x3d10be,_0x17d254,_0x44c8f3,_0x347a67){return new Promise(function(_0x50d21a,_0x5628ea){var _0x20ec09=new AWS[(_0xfde6('0x5'))]({'accessKeyId':_0x17d254,'secretAccessKey':_0x3d10be,'region':_0x44c8f3});_0x20ec09[_0xfde6('0x6')]({'TranscriptionJobName':_0x347a67},function(_0x135b39,_0x5e6fb0){if(_0x135b39){return _0x5628ea(_0x135b39);}else{return _0x50d21a(_0x5e6fb0);}});});}function sentiment(_0x333746,_0x3fe159,_0x136937,_0x5d890c,_0x27e896){return new Promise(function(_0x470b8a,_0x48dd4c){var _0x5167e2=new AWS[(_0xfde6('0x7'))]({'accessKeyId':_0x3fe159,'secretAccessKey':_0x333746,'region':_0x136937});_0x5167e2[_0xfde6('0x8')]({'Text':_0x5d890c,'LanguageCode':_0x27e896[_0xfde6('0x9')](0x0,0x2)},function(_0x1a540f,_0x485d23){if(_0x1a540f){return _0x48dd4c(_0x1a540f);}else{return _0x470b8a(_0x485d23);}});});}function checkTranscribeJob(_0xdb1266,_0x9a96cf,_0x3a3776){var _0x1c5ade;return new BPromise(function(_0x13da60,_0x5bf8fb){logger[_0xfde6('0xa')](util[_0xfde6('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xdb1266['id'],_0xdb1266[_0xfde6('0xc')]));return getTranscriptionJob(_0x3a3776[_0xfde6('0xd')],_0x3a3776[_0xfde6('0xe')],_0x9a96cf['transcribeRegion'],_0xdb1266[_0xfde6('0xc')])[_0xfde6('0xf')](function(_0x101ea8){logger[_0xfde6('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xdb1266['id'],_0xdb1266[_0xfde6('0xc')],_0x101ea8['TranscriptionJob'][_0xfde6('0x10')]));if(!_0xdb1266[_0xfde6('0x11')]){switch(_0x101ea8['TranscriptionJob'][_0xfde6('0x10')]){case'COMPLETED':var _0x122e45={'transcribeStatus':_0x101ea8[_0xfde6('0x12')][_0xfde6('0x10')],'fileUri':_0x101ea8[_0xfde6('0x12')][_0xfde6('0x13')][_0xfde6('0x14')]};logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x15'),_0xdb1266['id']));return rp({'uri':_0x101ea8['TranscriptionJob'][_0xfde6('0x13')][_0xfde6('0x14')],'json':!![]})['then'](function(_0x2577a1){logger[_0xfde6('0xa')](util['format'](_0xfde6('0x16'),_0xdb1266['id']));if(_0x2577a1&&_0x2577a1[_0xfde6('0x17')]&&_0x2577a1['results']['transcripts']&&_0x2577a1[_0xfde6('0x17')][_0xfde6('0x18')]['length']){_0x122e45[_0xfde6('0x11')]='';for(var _0x492219=0x0;_0x492219<_0x2577a1['results'][_0xfde6('0x18')][_0xfde6('0x19')];_0x492219++){_0x122e45[_0xfde6('0x11')]+=_0x2577a1[_0xfde6('0x17')][_0xfde6('0x18')][_0x492219][_0xfde6('0x1a')]+'';}}return _0xdb1266['update'](_0x122e45);})[_0xfde6('0xf')](function(){logger[_0xfde6('0xa')](util['format'](_0xfde6('0x1b'),_0xdb1266['id']));if(!_0xdb1266['tempSentiment']){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x9a96cf[_0xfde6('0x1e')]||!_0x9a96cf[_0xfde6('0x1f')]||!_0x9a96cf['sentimentRegion']||!_0x9a96cf[_0xfde6('0x20')]||!_0x9a96cf[_0xfde6('0x21')]){throw new db['Sequelize'][(_0xfde6('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x122e45[_0xfde6('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x9a96cf['sentimentAccountId']===_0x3a3776['id']){return _0x3a3776;}else{return db['CloudProvider'][_0xfde6('0x22')]({'where':{'id':_settings[_0xfde6('0x1f')]}});}})[_0xfde6('0xf')](function(_0x140296){if(!_0x140296){throw new db[(_0xfde6('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x140296['data1']||!_0x140296[_0xfde6('0xe')]){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x23'));}_0x1c5ade=_0x140296;logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x24'),_0xdb1266['id']));return sentiment(_0x1c5ade[_0xfde6('0xd')],_0x1c5ade[_0xfde6('0xe')],_0x9a96cf['sentimentRegion'],_0x122e45[_0xfde6('0x11')],_0x9a96cf[_0xfde6('0x20')]);})[_0xfde6('0xf')](function(_0x180ece){logger['info'](util[_0xfde6('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xdb1266['id']));return _0xdb1266[_0xfde6('0x25')]({'sentiment':_0x180ece[_0xfde6('0x26')],'sPositive':_0x180ece[_0xfde6('0x27')][_0xfde6('0x28')],'sNegative':_0x180ece['SentimentScore'][_0xfde6('0x29')],'sMixed':_0x180ece['SentimentScore'][_0xfde6('0x2a')],'sNeutral':_0x180ece[_0xfde6('0x27')]['Neutral']});})[_0xfde6('0xf')](function(){logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x1b'),_0xdb1266['id']));_0x13da60();});case'FAILED':return _0xdb1266[_0xfde6('0x25')]({'transcribeStatus':_0xfde6('0x2b'),'failureReason':_0x101ea8[_0xfde6('0x12')][_0xfde6('0x2c')]})[_0xfde6('0xf')](function(){logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x1b'),_0xdb1266['id']));_0x13da60();});default:logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x2d'),_0xdb1266['id']));break;}}else{return BPromise[_0xfde6('0x2e')]()[_0xfde6('0xf')](function(){if(!_0xdb1266[_0xfde6('0x2f')]){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x30'));}if(!_0x9a96cf['sentiment']||!_0x9a96cf['sentimentAccountId']||!_0x9a96cf['sentimentRegion']||!_0x9a96cf[_0xfde6('0x20')]||!_0x9a96cf[_0xfde6('0x21')]){throw new db['Sequelize'][(_0xfde6('0x1d'))](_0xfde6('0x31'));}if(!_0xdb1266[_0xfde6('0x11')]){throw new Error(_0xfde6('0x32'));}if(_0x9a96cf[_0xfde6('0x1f')]===_0x3a3776['id']){return _0x3a3776;}else{return db[_0xfde6('0x33')][_0xfde6('0x22')]({'where':{'id':_settings[_0xfde6('0x1f')]}});}})[_0xfde6('0xf')](function(_0x245894){if(!_0x245894){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x34'));}if(!_0x245894['data1']||!_0x245894[_0xfde6('0xe')]){throw new db[(_0xfde6('0x1c'))]['ValidationError'](_0xfde6('0x23'));}_0x1c5ade=_0x245894;logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x24'),_0xdb1266['id']));return sentiment(_0x1c5ade[_0xfde6('0xd')],_0x1c5ade[_0xfde6('0xe')],_0x9a96cf[_0xfde6('0x35')],_0xdb1266[_0xfde6('0x11')],_0x9a96cf[_0xfde6('0x20')]);})[_0xfde6('0xf')](function(_0x387581){logger[_0xfde6('0xa')](util[_0xfde6('0xb')](_0xfde6('0x36'),_0xdb1266['id']));return _0xdb1266[_0xfde6('0x25')]({'sentiment':_0x387581[_0xfde6('0x26')],'sPositive':_0x387581['SentimentScore'][_0xfde6('0x28')],'sNegative':_0x387581[_0xfde6('0x27')][_0xfde6('0x29')],'sMixed':_0x387581[_0xfde6('0x27')][_0xfde6('0x2a')],'sNeutral':_0x387581['SentimentScore'][_0xfde6('0x37')],'transcribeStatus':_0xfde6('0x38')});})[_0xfde6('0xf')](function(){logger['info'](util['format'](_0xfde6('0x1b'),_0xdb1266['id']));_0x13da60();});}})[_0xfde6('0x39')](function(_0x1eb912){if(_0x1eb912){if(!_0x1eb912[_0xfde6('0x3a')]||_0x1eb912[_0xfde6('0x3a')]!=='SequelizeValidationError'){logger[_0xfde6('0x3b')](util[_0xfde6('0xb')](_0xfde6('0x3c'),_0xdb1266['id']),util[_0xfde6('0x3d')](_0x1eb912,{'showHidden':![],'depth':null}));}}_0x13da60();});});}function checkTranscribe(){var _0x545f35;var _0x1419be;var _0x5ccefb;return db[_0xfde6('0x3e')][_0xfde6('0x3f')]({'where':{'transcribeStatus':_0xfde6('0x40')}})[_0xfde6('0xf')](function(_0x3830ea){if(!_0x3830ea||!_0x3830ea[_0xfde6('0x19')]){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x41'));}_0x545f35=_0x3830ea;return db[_0xfde6('0x42')]['findOne']({'where':{'id':0x1}});})[_0xfde6('0xf')](function(_0x43677d){if(!_0x43677d){throw new db['Sequelize'][(_0xfde6('0x1d'))](_0xfde6('0x43'));}_0x1419be=_0x43677d;if(!_0x1419be['transcribe']||!_0x1419be[_0xfde6('0x44')]||!_0x1419be[_0xfde6('0x45')]||!_0x1419be[_0xfde6('0x20')]||!_0x1419be[_0xfde6('0x21')]){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x46'));}return db[_0xfde6('0x33')][_0xfde6('0x22')]({'where':{'id':_0x1419be[_0xfde6('0x44')]}});})[_0xfde6('0xf')](function(_0x507d55){if(!_0x507d55){throw new db['Sequelize'][(_0xfde6('0x1d'))](_0xfde6('0x34'));}if(!_0x507d55[_0xfde6('0xd')]||!_0x507d55[_0xfde6('0xe')]){throw new db[(_0xfde6('0x1c'))][(_0xfde6('0x1d'))](_0xfde6('0x23'));}_0x5ccefb=_0x507d55;var _0x2a25d6=[];_0x545f35[_0xfde6('0x47')](function(_0x13ab70){_0x2a25d6[_0xfde6('0x48')](checkTranscribeJob(_0x13ab70,_0x1419be,_0x5ccefb));});return BPromise[_0xfde6('0x49')](_0x2a25d6);})[_0xfde6('0x39')](function(_0x19915d){if(_0x19915d){if(!_0x19915d[_0xfde6('0x3a')]||_0x19915d[_0xfde6('0x3a')]!==_0xfde6('0x4a')){logger['error'](util['inspect'](_0x19915d,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 1932408..3dfb6b9 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 _0x1702=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1702,0x1d5));var _0x2170=function(_0x482a31,_0xc68d8e){_0x482a31=_0x482a31-0x0;var _0x945060=_0x1702[_0x482a31];return _0x945060;};'use strict';var _=require('lodash');var moment=require(_0x2170('0x0'));var Redis=require(_0x2170('0x1'));var util=require(_0x2170('0x2'));var config=require('../../config/environment');var db=require(_0x2170('0x3'))['db'];var logger=require(_0x2170('0x4'))('schedule');config[_0x2170('0x5')]=_[_0x2170('0x6')](config[_0x2170('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2170('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x581d7c=[];return db[_0x2170('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x2170('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2170('0xa')](0x18,_0x2170('0xb'))}}})[_0x2170('0xc')](function(_0x17edb0){if(_0x17edb0&&_0x17edb0[_0x2170('0xd')]){_0x581d7c=_['map'](_0x17edb0||[],'id');logger[_0x2170('0xe')](_0x2170('0xf'),_0x581d7c[_0x2170('0x10')]());return db[_0x2170('0x8')][_0x2170('0x11')]({'closeReason':_0x2170('0x12'),'disposition':_0x2170('0x13'),'closed':!![],'closedAt':moment()[_0x2170('0x14')](_0x2170('0x15'))},{'where':{'id':_0x581d7c}});}})['then'](function(){if(_0x581d7c&&_0x581d7c[_0x2170('0xd')]){logger[_0x2170('0xe')](_0x2170('0x16'),_0x581d7c[_0x2170('0x10')]());for(var _0x8cde86=0x0;_0x8cde86<_0x581d7c[_0x2170('0xd')];_0x8cde86++){io['emit'](_0x2170('0x17'),{'id':_0x581d7c[_0x8cde86],'closed':!![]});}}})[_0x2170('0x18')](function(_0x404932){logger['error'](_0x2170('0x19'),_0x404932?util[_0x2170('0x1a')](_0x404932,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdbcd=['inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','redis','defaults','subtract','hours','then','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch'];(function(_0x19d394,_0x171598){var _0x56bc5d=function(_0xb12b8a){while(--_0xb12b8a){_0x19d394['push'](_0x19d394['shift']());}};_0x56bc5d(++_0x171598);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x3447a4,_0x528548){_0x3447a4=_0x3447a4-0x0;var _0xa1fe43=_0xdbcd[_0x3447a4];return _0xa1fe43;};'use strict';var _=require(_0xddbc('0x0'));var moment=require(_0xddbc('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xddbc('0x2'));var db=require(_0xddbc('0x3'))['db'];var logger=require(_0xddbc('0x4'))('schedule');config[_0xddbc('0x5')]=_[_0xddbc('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xddbc('0x5')]));function closeInteractions(){var _0x4d8331=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xddbc('0x7')](0x18,_0xddbc('0x8'))}}})[_0xddbc('0x9')](function(_0x123450){if(_0x123450&&_0x123450['length']){_0x4d8331=_['map'](_0x123450||[],'id');logger[_0xddbc('0xa')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4d8331[_0xddbc('0xb')]());return db['WhatsappInteraction'][_0xddbc('0xc')]({'closeReason':_0xddbc('0xd'),'disposition':_0xddbc('0xe'),'closed':!![],'closedAt':moment()[_0xddbc('0xf')](_0xddbc('0x10'))},{'where':{'id':_0x4d8331}});}})[_0xddbc('0x9')](function(){if(_0x4d8331&&_0x4d8331[_0xddbc('0x11')]){logger[_0xddbc('0xa')](_0xddbc('0x12'),_0x4d8331[_0xddbc('0xb')]());for(var _0x458c75=0x0;_0x458c75<_0x4d8331[_0xddbc('0x11')];_0x458c75++){io['emit']('whatsappInteraction:update',{'id':_0x4d8331[_0x458c75],'closed':!![]});}}})[_0xddbc('0x13')](function(_0x4453bf){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4453bf?util[_0xddbc('0x14')](_0x4453bf,{'showHidden':![],'depth':null}):'');});}exports[_0xddbc('0x15')]=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 deb0960..48ec1dc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf036=['catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','then','CmContact','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2'];(function(_0x549d3d,_0x42ccc5){var _0x34f029=function(_0x428518){while(--_0x428518){_0x549d3d['push'](_0x549d3d['shift']());}};_0x34f029(++_0x42ccc5);}(_0xf036,0x10b));var _0x6f03=function(_0x4f32aa,_0x4b23e9){_0x4f32aa=_0x4f32aa-0x0;var _0x24ad15=_0xf036[_0x4f32aa];return _0x24ad15;};'use strict';var util=require(_0x6f03('0x0'));var db=require(_0x6f03('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6f03('0x2')]({'id':i,'firstName':_0x6f03('0x3')+i,'lastName':_0x6f03('0x4')+i,'phone':0xf879fb460+i,'email':_0x6f03('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x6f03('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6f03('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6f03('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6f03('0x5')+i+_0x6f03('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6f03('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6f03('0x6')](),'updatedAt':Date[_0x6f03('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0x6f03('0x8')](function(){return db[_0x6f03('0x9')][_0x6f03('0xa')](contacts);})['then'](function(){console[_0x6f03('0xb')]('finished\x20populating',_0x6f03('0xc'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x6f03('0xd')][_0x6f03('0xa')](hopper);})[_0x6f03('0x8')](function(){console['log'](_0x6f03('0xe'),_0x6f03('0xf'));return db[_0x6f03('0x9')][_0x6f03('0xa')](contacts2);})[_0x6f03('0x8')](function(){console[_0x6f03('0xb')](_0x6f03('0xe'),_0x6f03('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x6f03('0xb')](_0x6f03('0xe'),_0x6f03('0x11'));})[_0x6f03('0x12')](function(_0x3f5ed3){console['log'](_0x3f5ed3);}); \ No newline at end of file +var _0x4662=['now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','hopper1','CmHopper','catch','util','Innocenzo','Biondo','@xcally.com','push'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4662,0xcd));var _0x2466=function(_0x18d429,_0x20414e){_0x18d429=_0x18d429-0x0;var _0x5753db=_0x4662[_0x18d429];return _0x5753db;};'use strict';var util=require(_0x2466('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2466('0x1')+i,'lastName':_0x2466('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2466('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2466('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2466('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2466('0x5')](),'updatedAt':Date[_0x2466('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2466('0x4')]({'id':i,'firstName':_0x2466('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2466('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2466('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2466('0x5')](),'updatedAt':Date[_0x2466('0x5')]()});}db[_0x2466('0x6')][_0x2466('0x7')]({'where':{}})[_0x2466('0x8')](function(){return db[_0x2466('0x6')][_0x2466('0x9')](contacts);})[_0x2466('0x8')](function(){console[_0x2466('0xa')](_0x2466('0xb'),'contacts1');return db['CmHopper'][_0x2466('0x7')]({'where':{}});})[_0x2466('0x8')](function(){return db['CmHopper'][_0x2466('0x9')](hopper);})[_0x2466('0x8')](function(){console['log'](_0x2466('0xb'),_0x2466('0xc'));return db[_0x2466('0x6')][_0x2466('0x9')](contacts2);})[_0x2466('0x8')](function(){console[_0x2466('0xa')](_0x2466('0xb'),'contacts2');return db[_0x2466('0xd')][_0x2466('0x9')](hopper2);})[_0x2466('0x8')](function(){console[_0x2466('0xa')]('finished\x20populating','hopper2');})[_0x2466('0xe')](function(_0x959911){console['log'](_0x959911);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 627af60..0bae19e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9025=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log','util','../mysqldb','push','agent','format','%s%s','password','friend','udp','wss','all','ulaw','yes'];(function(_0x41e3cb,_0x242df9){var _0x58d956=function(_0x3356c5){while(--_0x3356c5){_0x41e3cb['push'](_0x41e3cb['shift']());}};_0x58d956(++_0x242df9);}(_0x9025,0x104));var _0x5902=function(_0x1c4606,_0x2aeb54){_0x1c4606=_0x1c4606-0x0;var _0xa42ee=_0x9025[_0x1c4606];return _0xa42ee;};'use strict';var util=require(_0x5902('0x0'));var db=require(_0x5902('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5902('0x2')]({'name':util['format']('%s%s',_0x5902('0x3'),i),'fullname':util[_0x5902('0x4')](_0x5902('0x5'),'agent',i),'email':util[_0x5902('0x4')]('%s%s@xcally.com',_0x5902('0x3'),i),'role':_0x5902('0x3'),'password':_0x5902('0x6'),'internal':0xfa0+i,'type':_0x5902('0x7'),'transport':[_0x5902('0x8'),'ws',_0x5902('0x9')],'disallow':[_0x5902('0xa')],'allow':[_0x5902('0xb')],'defaultuser':util['format'](_0x5902('0x5'),_0x5902('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':_0x5902('0xc'),'icesupport':_0x5902('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x5902('0xd'),'dtlsprivatekey':_0x5902('0xe'),'dtlssetup':_0x5902('0xf'),'callerid':util[_0x5902('0x4')](_0x5902('0x10'),util[_0x5902('0x4')]('%s%s','agent',i),0xfa0+i)});}db['User'][_0x5902('0x11')](users)[_0x5902('0x12')](function(){console['log']('add\x20user');})[_0x5902('0x13')](function(_0x1b5bb8){console[_0x5902('0x14')](_0x1b5bb8);}); \ No newline at end of file +var _0x47b3=['all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent','format','password','udp','wss'];(function(_0x170ee8,_0x1b2c0d){var _0x57595d=function(_0x433cf6){while(--_0x433cf6){_0x170ee8['push'](_0x170ee8['shift']());}};_0x57595d(++_0x1b2c0d);}(_0x47b3,0xee));var _0x347b=function(_0x39eb3e,_0x14064){_0x39eb3e=_0x39eb3e-0x0;var _0x4240b2=_0x47b3[_0x39eb3e];return _0x4240b2;};'use strict';var util=require(_0x347b('0x0'));var db=require(_0x347b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x347b('0x2')]({'name':util['format'](_0x347b('0x3'),_0x347b('0x4'),i),'fullname':util[_0x347b('0x5')](_0x347b('0x3'),'agent',i),'email':util[_0x347b('0x5')]('%s%s@xcally.com',_0x347b('0x4'),i),'role':'agent','password':_0x347b('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x347b('0x7'),'ws',_0x347b('0x8')],'disallow':[_0x347b('0x9')],'allow':['ulaw'],'defaultuser':util[_0x347b('0x5')](_0x347b('0x3'),_0x347b('0x4'),i),'encryption':_0x347b('0xa'),'avpf':_0x347b('0xa'),'force_avp':_0x347b('0xa'),'icesupport':_0x347b('0xa'),'dtlsenable':_0x347b('0xa'),'dtlsverify':'no','dtlscertfile':_0x347b('0xb'),'dtlsprivatekey':_0x347b('0xc'),'dtlssetup':'actpass','callerid':util[_0x347b('0x5')](_0x347b('0xd'),util[_0x347b('0x5')](_0x347b('0x3'),_0x347b('0x4'),i),0xfa0+i)});}db[_0x347b('0xe')]['bulkCreate'](users)[_0x347b('0xf')](function(){console[_0x347b('0x10')](_0x347b('0x11'));})[_0x347b('0x12')](function(_0x4e67cc){console[_0x347b('0x10')](_0x4e67cc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 73f020c..0dead44 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','role','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','SmsQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','then','where','Campaign'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x2ef3,0xba));var _0x32ef=function(_0xf34bb0,_0x1e65f5){_0xf34bb0=_0xf34bb0-0x0;var _0x51bec9=_0x2ef3[_0xf34bb0];return _0x51bec9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var db=require(_0x32ef('0x3'))['db'];var config=require(_0x32ef('0x4'));var queryQueues={'attributes':['id',_0x32ef('0x5')],'include':[{'as':'Agents','model':db[_0x32ef('0x6')],'attributes':['id',_0x32ef('0x5'),'role'],'raw':!![],'where':{'role':_0x32ef('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':_0x32ef('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x32ef('0x5'),_0x32ef('0x8')],'where':{'type':_0x32ef('0x9')}};function getAssociatedResources(_0x298066,_0x2484a0,_0x2bbb50){return db[_0x32ef('0xa')][_0x32ef('0xb')]({'where':{'name':_0x298066,'userProfileId':_0x2484a0},'raw':!![]})['then'](function(_0x5780e9){if(_0x5780e9){if(_0x5780e9[_0x32ef('0xc')]){switch(_0x298066){case _0x32ef('0xd'):case _0x32ef('0xe'):case _0x32ef('0xf'):case'SmsQueues':case _0x32ef('0x10'):case'OpenchannelQueues':case _0x32ef('0x11'):return db[_0x2bbb50]['findAll'](queryQueues);case _0x32ef('0x12'):return db[_0x2bbb50][_0x32ef('0x13')](queryTelephones);case'Trunks':return db[_0x2bbb50]['findAll'](queryTrunks);case _0x32ef('0x14'):return db[_0x2bbb50]['findAll'](queryCampaigns);}}else{return db[_0x32ef('0x15')][_0x32ef('0x13')]({'attributes':[_0x32ef('0x16')],'where':{'sectionId':_0x5780e9['id']},'raw':!![]})[_0x32ef('0x17')](function(_0x57aff1){if(_0x57aff1){var _0x55bf0b={'where':{'id':_['map'](_0x57aff1,_0x32ef('0x16'))},'raw':!![]};switch(_0x2bbb50){case _0x32ef('0x6'):_0x55bf0b[_0x32ef('0x18')]['role']='telephone';break;case _0x32ef('0x19'):_0x55bf0b[_0x32ef('0x18')][_0x32ef('0x8')]='ivr';break;}return db[_0x2bbb50][_0x32ef('0x13')](_0x55bf0b);}else{return[];}});}}else{return[];}})[_0x32ef('0x17')](function(_0x4f4c98){return _0x4f4c98;});}function joinOrLeaveQueues(_0x304505,_0x314ef1,_0x26aff3,_0x251084){_0x304505[_0x314ef1](util[_0x32ef('0x1a')](_0x32ef('0x1b'),_0x26aff3,_0x251084['name']));if(_0x251084[_0x32ef('0x1c')]){for(var _0x5cc3ef=0x0;_0x5cc3ef<_0x251084[_0x32ef('0x1c')][_0x32ef('0x1d')];_0x5cc3ef+=0x1){_0x304505[_0x314ef1](util['format'](_0x32ef('0x1e'),_0x251084[_0x32ef('0x1c')][_0x5cc3ef][_0x32ef('0x5')]));}}}function joinOrLeave(_0x55f7f2,_0x57f5e5,_0x22f2d7){var _0xb30fab;if(_0x55f7f2[_0x32ef('0x1f')]['query']['id']){db['User'][_0x32ef('0x20')]({'attributes':['id','name','role',_0x32ef('0x21')],'where':{'id':_0x55f7f2[_0x32ef('0x1f')][_0x32ef('0x22')]['id']},'include':[{'model':db[_0x32ef('0x23')],'as':_0x32ef('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x25')],'as':_0x32ef('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x27')],'as':_0x32ef('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x29')],'as':_0x32ef('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2c')],'as':_0x32ef('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x12de1a){if(_0x12de1a){_0xb30fab=_0x12de1a;_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x12de1a[_0x32ef('0x5')]));var _0x50a95b=[];switch(_0x12de1a[_0x32ef('0x2e')]){case _0x32ef('0x2f'):_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));if(queryQueues[_0x32ef('0x32')](_0x32ef('0x33'))){delete queryQueues[_0x32ef('0x33')];}_0x50a95b['push'](db[_0x32ef('0x34')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x36')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x37')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x38')]['findAll'](queryQueues));_0x50a95b['push'](db[_0x32ef('0x39')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3a')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3b')][_0x32ef('0x13')](queryQueues));_0x50a95b['push'](db['User']['findAll'](queryTelephones));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3c')][_0x32ef('0x13')](queryTrunks));_0x50a95b['push'](db['Campaign'][_0x32ef('0x13')](queryCampaigns));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x6')]['findAll'](queryAgents));break;case'user':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xd'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x34')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xe'),_0x12de1a[_0x32ef('0x21')],'ChatQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xf'),_0x12de1a[_0x32ef('0x21')],'FaxQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3d'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x38')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x10'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x39')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3e'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3a')));_0x50a95b['push'](getAssociatedResources(_0x32ef('0x11'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3b')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x12'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x6')));_0x50a95b['push'](getAssociatedResources('Trunks',_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3c')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x14'),_0x12de1a['userProfileId'],_0x32ef('0x19')));_0x50a95b[_0x32ef('0x35')](db['User'][_0x32ef('0x13')](queryAgents));break;case'agent':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x3f')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x40')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x41')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a['getSmsQueues']({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x42')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x43')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x44')]({'attributes':['id',_0x32ef('0x5')]}));break;}return BPromise[_0x32ef('0x45')](_0x50a95b);}})['then'](function(_0x5cb6fc){if(_0x5cb6fc&&_0x5cb6fc[_0x32ef('0x1d')]){for(var _0x270826=0x0;_0x270826<_0x5cb6fc[_0x32ef('0x1d')];_0x270826+=0x1){for(var _0x13b270=0x0;_0x13b270<_0x5cb6fc[_0x270826][_0x32ef('0x1d')];_0x13b270+=0x1){switch(_0x270826){case 0x0:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x46'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x1:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x47'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x2:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x48'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x3:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x49'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x4:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4a'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x5:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4b'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x6:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4c'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x7:if(_0xb30fab[_0x32ef('0x2e')]!=='agent')_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4d'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x8:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x9:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4f'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x8')],_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0xa:_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;}}}}})[_0x32ef('0x17')](function(){if(_0x57f5e5==='leave'){var _0x515ac9=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x24')],'id');return _0xb30fab[_0x32ef('0x51')](_0x515ac9)[_0x32ef('0x17')](function(){for(var _0x34bd3e=0x0;_0x34bd3e<_0x515ac9[_0x32ef('0x1d')];_0x34bd3e+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x53'),{'ChatInteractionId':Number(_0x515ac9[_0x34bd3e]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x3697a7=_['map'](_0xb30fab[_0x32ef('0x26')],'id');return _0xb30fab[_0x32ef('0x55')](_0x3697a7)[_0x32ef('0x17')](function(){for(var _0x3fe01f=0x0;_0x3fe01f<_0x3697a7[_0x32ef('0x1d')];_0x3fe01f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3697a7[_0x3fe01f]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x31d5d8=_['map'](_0xb30fab[_0x32ef('0x28')],'id');return _0xb30fab['removeFaxInteractions'](_0x31d5d8)[_0x32ef('0x17')](function(){for(var _0xbe35b=0x0;_0xbe35b<_0x31d5d8['length'];_0xbe35b+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x31d5d8[_0xbe35b]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x2bff39=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x2a')],'id');return _0xb30fab[_0x32ef('0x56')](_0x2bff39)[_0x32ef('0x17')](function(){for(var _0x56260f=0x0;_0x56260f<_0x2bff39['length'];_0x56260f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2bff39[_0x56260f]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x89d0b3=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x57')],'id');return _0xb30fab[_0x32ef('0x58')](_0x89d0b3)[_0x32ef('0x17')](function(){for(var _0x316547=0x0;_0x316547<_0x89d0b3[_0x32ef('0x1d')];_0x316547+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x59'),{'OpenchannelInteractionId':Number(_0x89d0b3[_0x316547]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5==='leave'){var _0x120d9d=_[_0x32ef('0x50')](_0xb30fab['WhatsappInteractions'],'id');return _0xb30fab[_0x32ef('0x5a')](_0x120d9d)[_0x32ef('0x17')](function(){for(var _0x2b5703=0x0;_0x2b5703<_0x120d9d['length'];_0x2b5703+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x5b'),{'WhatsappInteractionId':Number(_0x120d9d[_0x2b5703]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x5c')](function(_0x52dfe0){_0x55f7f2['log'](_0x52dfe0);});}}function onDisconnect(_0x13ea1a,_0x47d8bf){joinOrLeave(_0x13ea1a,_0x32ef('0x54'),_0x47d8bf);}function onConnect(_0x5bb114){joinOrLeave(_0x5bb114,'join');}exports[_0x32ef('0x5d')]=function(_0x208989){_0x208989['on'](_0x32ef('0x5e'),function(_0x5dca6a){_0x5dca6a[_0x32ef('0x5f')](0x0);_0x5dca6a[_0x32ef('0x60')]=_0x5dca6a[_0x32ef('0x61')]['connection'][_0x32ef('0x62')]+':'+_0x5dca6a[_0x32ef('0x61')]['connection']['remotePort'];_0x5dca6a[_0x32ef('0x63')]=new Date();_0x5dca6a[_0x32ef('0x64')]=function(_0x2518a0){console[_0x32ef('0x64')](_0x32ef('0x65')+_0x5dca6a[_0x32ef('0x66')]['name']+'['+_0x5dca6a[_0x32ef('0x60')]+']',_0x2518a0);};_0x5dca6a['on'](_0x32ef('0x67'),function(){onDisconnect(_0x5dca6a,_0x208989);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x68'));});onConnect(_0x5dca6a);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x69'));});}; \ No newline at end of file +var _0x88f8=['WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','util','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','then','format','%s:queue:%s','length','user:%s','query','find','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','VoiceQueues','userProfileId','ChatQueue','SmsQueue','Trunk','voice:inbound','getVoiceQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','emit','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove'];(function(_0x5f8000,_0x4a56b1){var _0xc8f261=function(_0x53e032){while(--_0x53e032){_0x5f8000['push'](_0x5f8000['shift']());}};_0xc8f261(++_0x4a56b1);}(_0x88f8,0xd4));var _0x888f=function(_0x1dd587,_0x9c184e){_0x1dd587=_0x1dd587-0x0;var _0x3b9da1=_0x88f8[_0x1dd587];return _0x3b9da1;};'use strict';var _=require('lodash');var util=require(_0x888f('0x0'));var BPromise=require('bluebird');var db=require(_0x888f('0x1'))['db'];var config=require(_0x888f('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x888f('0x3'),'model':db[_0x888f('0x4')],'attributes':['id',_0x888f('0x5'),_0x888f('0x6')],'raw':!![],'where':{'role':_0x888f('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x888f('0x5')],'where':{'role':_0x888f('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x888f('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x888f('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x888f('0x5'),_0x888f('0x9')],'where':{'type':_0x888f('0xa')}};function getAssociatedResources(_0x38d0d1,_0x2e5680,_0x45e3a8){return db[_0x888f('0xb')][_0x888f('0xc')]({'where':{'name':_0x38d0d1,'userProfileId':_0x2e5680},'raw':!![]})['then'](function(_0x4b0490){if(_0x4b0490){if(_0x4b0490[_0x888f('0xd')]){switch(_0x38d0d1){case'VoiceQueues':case _0x888f('0xe'):case _0x888f('0xf'):case _0x888f('0x10'):case _0x888f('0x11'):case _0x888f('0x12'):case _0x888f('0x13'):return db[_0x45e3a8][_0x888f('0x14')](queryQueues);case _0x888f('0x15'):return db[_0x45e3a8]['findAll'](queryTelephones);case _0x888f('0x16'):return db[_0x45e3a8][_0x888f('0x14')](queryTrunks);case _0x888f('0x17'):return db[_0x45e3a8][_0x888f('0x14')](queryCampaigns);}}else{return db[_0x888f('0x18')]['findAll']({'attributes':[_0x888f('0x19')],'where':{'sectionId':_0x4b0490['id']},'raw':!![]})['then'](function(_0x41c38e){if(_0x41c38e){var _0x44175e={'where':{'id':_[_0x888f('0x1a')](_0x41c38e,_0x888f('0x19'))},'raw':!![]};switch(_0x45e3a8){case'User':_0x44175e['where'][_0x888f('0x6')]=_0x888f('0x8');break;case _0x888f('0x1b'):_0x44175e[_0x888f('0x1c')][_0x888f('0x9')]=_0x888f('0xa');break;}return db[_0x45e3a8]['findAll'](_0x44175e);}else{return[];}});}}else{return[];}})[_0x888f('0x1d')](function(_0x462394){return _0x462394;});}function joinOrLeaveQueues(_0xf382fa,_0x1bbc22,_0x4d6ccd,_0x51dcb5){_0xf382fa[_0x1bbc22](util[_0x888f('0x1e')](_0x888f('0x1f'),_0x4d6ccd,_0x51dcb5[_0x888f('0x5')]));if(_0x51dcb5['Agents']){for(var _0x48f5b3=0x0;_0x48f5b3<_0x51dcb5[_0x888f('0x3')][_0x888f('0x20')];_0x48f5b3+=0x1){_0xf382fa[_0x1bbc22](util['format'](_0x888f('0x21'),_0x51dcb5[_0x888f('0x3')][_0x48f5b3][_0x888f('0x5')]));}}}function joinOrLeave(_0x5db255,_0x2629be,_0x5c71cd){var _0xff58a1;if(_0x5db255['handshake'][_0x888f('0x22')]['id']){db[_0x888f('0x4')][_0x888f('0x23')]({'attributes':['id','name',_0x888f('0x6'),'userProfileId'],'where':{'id':_0x5db255[_0x888f('0x24')][_0x888f('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x888f('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x888f('0x26')],'as':_0x888f('0x27'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x888f('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x888f('0x29')],'as':_0x888f('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x888f('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x888f('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x888f('0x1d')](function(_0x379c04){if(_0x379c04){_0xff58a1=_0x379c04;_0x5db255[_0x2629be](util[_0x888f('0x1e')](_0x888f('0x21'),_0x379c04[_0x888f('0x5')]));var _0x8a9e8c=[];switch(_0x379c04[_0x888f('0x6')]){case _0x888f('0x2d'):_0x5db255[_0x2629be]('voice:inbound');_0x5db255[_0x2629be](_0x888f('0x2e'));if(queryQueues[_0x888f('0x2f')](_0x888f('0x30'))){delete queryQueues[_0x888f('0x30')];}_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x32')][_0x888f('0x14')](queryQueues));_0x8a9e8c[_0x888f('0x31')](db['ChatQueue'][_0x888f('0x14')](queryQueues));_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x33')]['findAll'](queryQueues));_0x8a9e8c[_0x888f('0x31')](db['SmsQueue']['findAll'](queryQueues));_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x34')][_0x888f('0x14')](queryQueues));_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x35')][_0x888f('0x14')](queryQueues));_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x36')][_0x888f('0x14')](queryQueues));_0x8a9e8c['push'](db[_0x888f('0x4')][_0x888f('0x14')](queryTelephones));_0x8a9e8c['push'](db['Trunk'][_0x888f('0x14')](queryTrunks));_0x8a9e8c[_0x888f('0x31')](db[_0x888f('0x1b')][_0x888f('0x14')](queryCampaigns));_0x8a9e8c['push'](db[_0x888f('0x4')]['findAll'](queryAgents));break;case _0x888f('0x37'):_0x5db255[_0x2629be]('voice:inbound');_0x5db255[_0x2629be](_0x888f('0x2e'));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x38'),_0x379c04[_0x888f('0x39')],_0x888f('0x32')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0xe'),_0x379c04[_0x888f('0x39')],_0x888f('0x3a')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0xf'),_0x379c04['userProfileId'],_0x888f('0x33')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x10'),_0x379c04[_0x888f('0x39')],_0x888f('0x3b')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x11'),_0x379c04[_0x888f('0x39')],_0x888f('0x34')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources('OpenchannelQueues',_0x379c04[_0x888f('0x39')],'OpenchannelQueue'));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x13'),_0x379c04[_0x888f('0x39')],'WhatsappQueue'));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x15'),_0x379c04[_0x888f('0x39')],_0x888f('0x4')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources('Trunks',_0x379c04[_0x888f('0x39')],_0x888f('0x3c')));_0x8a9e8c[_0x888f('0x31')](getAssociatedResources(_0x888f('0x17'),_0x379c04[_0x888f('0x39')],_0x888f('0x1b')));_0x8a9e8c[_0x888f('0x31')](db['User'][_0x888f('0x14')](queryAgents));break;case _0x888f('0x7'):_0x5db255[_0x2629be](_0x888f('0x3d'));_0x5db255[_0x2629be](_0x888f('0x2e'));_0x8a9e8c[_0x888f('0x31')](_0x379c04[_0x888f('0x3e')]({'attributes':['id',_0x888f('0x5')]}));_0x8a9e8c['push'](_0x379c04['getChatQueues']({'attributes':['id','name']}));_0x8a9e8c[_0x888f('0x31')](_0x379c04['getFaxQueues']({'attributes':['id',_0x888f('0x5')]}));_0x8a9e8c['push'](_0x379c04[_0x888f('0x3f')]({'attributes':['id',_0x888f('0x5')]}));_0x8a9e8c[_0x888f('0x31')](_0x379c04['getMailQueues']({'attributes':['id',_0x888f('0x5')]}));_0x8a9e8c[_0x888f('0x31')](_0x379c04[_0x888f('0x40')]({'attributes':['id',_0x888f('0x5')]}));_0x8a9e8c[_0x888f('0x31')](_0x379c04[_0x888f('0x41')]({'attributes':['id',_0x888f('0x5')]}));break;}return BPromise[_0x888f('0x42')](_0x8a9e8c);}})[_0x888f('0x1d')](function(_0x451ad0){if(_0x451ad0&&_0x451ad0[_0x888f('0x20')]){for(var _0x5086c7=0x0;_0x5086c7<_0x451ad0[_0x888f('0x20')];_0x5086c7+=0x1){for(var _0x599df8=0x0;_0x599df8<_0x451ad0[_0x5086c7][_0x888f('0x20')];_0x599df8+=0x1){switch(_0x5086c7){case 0x0:joinOrLeaveQueues(_0x5db255,_0x2629be,_0x888f('0x43'),_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x1:joinOrLeaveQueues(_0x5db255,_0x2629be,_0x888f('0x44'),_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x2:joinOrLeaveQueues(_0x5db255,_0x2629be,_0x888f('0x45'),_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x3:joinOrLeaveQueues(_0x5db255,_0x2629be,'sms',_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x4:joinOrLeaveQueues(_0x5db255,_0x2629be,_0x888f('0x46'),_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x5:joinOrLeaveQueues(_0x5db255,_0x2629be,'openchannel',_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x6:joinOrLeaveQueues(_0x5db255,_0x2629be,_0x888f('0x47'),_0x451ad0[_0x5086c7][_0x599df8]);break;case 0x7:if(_0xff58a1['role']!==_0x888f('0x7'))_0x5db255[_0x2629be](util[_0x888f('0x1e')](_0x888f('0x48'),_0x451ad0[_0x5086c7][_0x599df8][_0x888f('0x5')]));break;case 0x8:if(_0xff58a1[_0x888f('0x6')]!==_0x888f('0x7'))_0x5db255[_0x2629be](util[_0x888f('0x1e')](_0x888f('0x49'),_0x451ad0[_0x5086c7][_0x599df8][_0x888f('0x5')]));break;case 0x9:if(_0xff58a1['role']!=='agent')_0x5db255[_0x2629be](util[_0x888f('0x1e')](_0x888f('0x4a'),_0x451ad0[_0x5086c7][_0x599df8][_0x888f('0x9')],_0x451ad0[_0x5086c7][_0x599df8]['name']));break;case 0xa:_0x5db255[_0x2629be](util[_0x888f('0x1e')](_0x888f('0x21'),_0x451ad0[_0x5086c7][_0x599df8][_0x888f('0x5')]));break;}}}}})[_0x888f('0x1d')](function(){if(_0x2629be===_0x888f('0x4b')){var _0x207a97=_['map'](_0xff58a1[_0x888f('0x25')],'id');return _0xff58a1[_0x888f('0x4c')](_0x207a97)['then'](function(){for(var _0x11b3f6=0x0;_0x11b3f6<_0x207a97[_0x888f('0x20')];_0x11b3f6+=0x1){_0x5c71cd['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x207a97[_0x11b3f6]),'UserId':Number(_0xff58a1['id'])});}});}})[_0x888f('0x1d')](function(){if(_0x2629be==='leave'){var _0x3ec4a4=_[_0x888f('0x1a')](_0xff58a1['MailInteractions'],'id');return _0xff58a1[_0x888f('0x4d')](_0x3ec4a4)[_0x888f('0x1d')](function(){for(var _0x54f18a=0x0;_0x54f18a<_0x3ec4a4[_0x888f('0x20')];_0x54f18a+=0x1){_0x5c71cd['emit'](_0x888f('0x4e'),{'MailInteractionId':Number(_0x3ec4a4[_0x54f18a]),'UserId':Number(_0xff58a1['id'])});}});}})[_0x888f('0x1d')](function(){if(_0x2629be===_0x888f('0x4b')){var _0x3051c2=_[_0x888f('0x1a')](_0xff58a1[_0x888f('0x28')],'id');return _0xff58a1[_0x888f('0x4f')](_0x3051c2)[_0x888f('0x1d')](function(){for(var _0x3f1d0c=0x0;_0x3f1d0c<_0x3051c2['length'];_0x3f1d0c+=0x1){_0x5c71cd[_0x888f('0x50')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3051c2[_0x3f1d0c]),'UserId':Number(_0xff58a1['id'])});}});}})[_0x888f('0x1d')](function(){if(_0x2629be===_0x888f('0x4b')){var _0x1ad773=_['map'](_0xff58a1[_0x888f('0x2a')],'id');return _0xff58a1[_0x888f('0x51')](_0x1ad773)[_0x888f('0x1d')](function(){for(var _0x444099=0x0;_0x444099<_0x1ad773['length'];_0x444099+=0x1){_0x5c71cd[_0x888f('0x50')](_0x888f('0x52'),{'SmsInteractionId':Number(_0x1ad773[_0x444099]),'UserId':Number(_0xff58a1['id'])});}});}})[_0x888f('0x1d')](function(){if(_0x2629be===_0x888f('0x4b')){var _0x691cb7=_[_0x888f('0x1a')](_0xff58a1[_0x888f('0x2b')],'id');return _0xff58a1[_0x888f('0x53')](_0x691cb7)[_0x888f('0x1d')](function(){for(var _0x441492=0x0;_0x441492<_0x691cb7[_0x888f('0x20')];_0x441492+=0x1){_0x5c71cd[_0x888f('0x50')](_0x888f('0x54'),{'OpenchannelInteractionId':Number(_0x691cb7[_0x441492]),'UserId':Number(_0xff58a1['id'])});}});}})['then'](function(){if(_0x2629be===_0x888f('0x4b')){var _0x8bd7ef=_[_0x888f('0x1a')](_0xff58a1[_0x888f('0x55')],'id');return _0xff58a1['removeWhatsappInteractions'](_0x8bd7ef)['then'](function(){for(var _0x570458=0x0;_0x570458<_0x8bd7ef['length'];_0x570458+=0x1){_0x5c71cd['emit'](_0x888f('0x56'),{'WhatsappInteractionId':Number(_0x8bd7ef[_0x570458]),'UserId':Number(_0xff58a1['id'])});}});}})[_0x888f('0x57')](function(_0x1eac92){_0x5db255[_0x888f('0x58')](_0x1eac92);});}}function onDisconnect(_0x335ea1,_0x34ea4f){joinOrLeave(_0x335ea1,_0x888f('0x4b'),_0x34ea4f);}function onConnect(_0x24d770){joinOrLeave(_0x24d770,'join');}exports[_0x888f('0x59')]=function(_0x300db9){_0x300db9['on'](_0x888f('0x5a'),function(_0x1595c8){_0x1595c8['setMaxListeners'](0x0);_0x1595c8[_0x888f('0x5b')]=_0x1595c8[_0x888f('0x5c')][_0x888f('0x5a')]['remoteAddress']+':'+_0x1595c8[_0x888f('0x5c')]['connection'][_0x888f('0x5d')];_0x1595c8[_0x888f('0x5e')]=new Date();_0x1595c8[_0x888f('0x58')]=function(_0x37b8e0){console['log'](_0x888f('0x5f')+_0x1595c8[_0x888f('0x60')][_0x888f('0x5')]+'['+_0x1595c8[_0x888f('0x5b')]+']',_0x37b8e0);};_0x1595c8['on'](_0x888f('0x61'),function(){onDisconnect(_0x1595c8,_0x300db9);_0x1595c8[_0x888f('0x58')]('DISCONNECTED');});onConnect(_0x1595c8);_0x1595c8[_0x888f('0x58')](_0x888f('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7837b45..1a03dc7 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 _0x2d24=['jayson/promise','../logger','client','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','then','ContactId','sequelize','query','QueryTypes','SELECT','contact','undefined','UserId','interface','agent','incomingmessage','outgoingmessage','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','format','SIP/%s','name','changed','closed','substatus','Sequelize','AfterUpdate','User','internal','default','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb'];(function(_0x308839,_0x5f73ae){var _0xbb549d=function(_0x5c8479){while(--_0x5c8479){_0x308839['push'](_0x308839['shift']());}};_0xbb549d(++_0x5f73ae);}(_0x2d24,0xd3));var _0x42d2=function(_0x2c7f22,_0x50fad2){_0x2c7f22=_0x2c7f22-0x0;var _0x287a50=_0x2d24[_0x2c7f22];return _0x287a50;};'use strict';var util=require(_0x42d2('0x0'));var db=require(_0x42d2('0x1'))['db'];var jayson=require(_0x42d2('0x2'));var logger=require(_0x42d2('0x3'))('triggers');var client=jayson[_0x42d2('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x42d2('0x5'),'model':_0x42d2('0x6'),'event':'afterCreate','condition':_0x42d2('0x7'),'callback':afterCreate},{'channel':_0x42d2('0x5'),'model':_0x42d2('0x6'),'event':_0x42d2('0x8'),'condition':_0x42d2('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x42d2('0xa'),'event':_0x42d2('0xb'),'condition':_0x42d2('0xc'),'callback':afterCreateMessage},{'channel':_0x42d2('0x5'),'model':_0x42d2('0xd'),'event':'afterCreate','condition':_0x42d2('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x42d2('0xe'),'model':_0x42d2('0xf'),'event':_0x42d2('0xb'),'condition':_0x42d2('0x7'),'callback':afterCreate},{'channel':_0x42d2('0xe'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x42d2('0x9'),'callback':afterUpdate},{'channel':_0x42d2('0xe'),'model':_0x42d2('0x10'),'event':_0x42d2('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x42d2('0x11'),'model':_0x42d2('0x12'),'event':_0x42d2('0xb'),'condition':_0x42d2('0x7'),'callback':afterCreate},{'channel':_0x42d2('0x11'),'model':'WhatsappInteraction','event':_0x42d2('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x42d2('0x11'),'model':_0x42d2('0x13'),'event':_0x42d2('0xb'),'condition':_0x42d2('0xc'),'callback':afterCreateMessage},{'channel':_0x42d2('0x14'),'model':_0x42d2('0x15'),'event':_0x42d2('0xb'),'condition':_0x42d2('0x7'),'callback':afterCreate},{'channel':_0x42d2('0x14'),'model':'FaxInteraction','event':_0x42d2('0x8'),'condition':_0x42d2('0x9'),'callback':afterUpdate},{'channel':'Fax','model':_0x42d2('0x16'),'event':'afterCreate','condition':_0x42d2('0xc'),'callback':afterCreateMessage},{'channel':_0x42d2('0x17'),'model':_0x42d2('0x18'),'event':_0x42d2('0xb'),'condition':_0x42d2('0x7'),'callback':afterCreate},{'channel':_0x42d2('0x17'),'model':_0x42d2('0x18'),'event':_0x42d2('0x8'),'condition':_0x42d2('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x42d2('0x19'),'event':_0x42d2('0xb'),'condition':_0x42d2('0xc'),'callback':afterCreateMessage},{'channel':_0x42d2('0x1a'),'model':_0x42d2('0x1b'),'event':_0x42d2('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x42d2('0x1a'),'model':_0x42d2('0x1b'),'event':_0x42d2('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x42d2('0x1a'),'model':'OpenchannelMessage','event':_0x42d2('0xb'),'condition':_0x42d2('0xc'),'callback':afterCreateMessage}];function request(_0x43f8a0){return client[_0x42d2('0x1c')](_0x42d2('0x1d'),_0x43f8a0)['then'](function(_0x2716bb){logger['info'](_0x42d2('0x1e'),_0x42d2('0x1d'),_0x2716bb);if(_0x2716bb[_0x42d2('0x1f')]){if(_0x2716bb[_0x42d2('0x1f')][_0x42d2('0x20')]===0x1f4){logger[_0x42d2('0x1f')]('Trigger,\x20%s',_0x42d2('0x1d'),_0x2716bb[_0x42d2('0x1f')]);}}})[_0x42d2('0x21')](function(_0x5ee6e6){logger[_0x42d2('0x1f')]('Trigger,\x20%s',_0x42d2('0x1d'),_0x5ee6e6);});}function afterCreateMessage(_0x5cf280){return function(_0x21c4f9){_0x21c4f9=_0x21c4f9[_0x42d2('0x22')]({'plain':!![]});_0x21c4f9[_0x42d2('0x23')]=_0x5cf280;_0x21c4f9[_0x42d2('0x24')]=_0x5cf280;_0x21c4f9[_0x42d2('0x25')]=_0x21c4f9[_0x42d2('0x26')];Promise['resolve']()[_0x42d2('0x27')](function(){if(typeof _0x21c4f9[_0x42d2('0x28')]==='undefined')return null;var _0x5166fa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21c4f9[_0x42d2('0x28')];return db[_0x42d2('0x29')][_0x42d2('0x2a')](_0x5166fa,{'type':db['Sequelize'][_0x42d2('0x2b')][_0x42d2('0x2c')],'raw':!![]});})['then'](function(_0x1bfb40){if(_0x1bfb40){_0x21c4f9[_0x42d2('0x2d')]=_0x1bfb40[0x0];}if(typeof _0x21c4f9['UserId']===_0x42d2('0x2e'))return;return getAgent(_0x21c4f9[_0x42d2('0x2f')]);})[_0x42d2('0x27')](function(_0x1d1a67){if(_0x1d1a67){_0x21c4f9[_0x42d2('0x30')]=util['format']('SIP/%s',_0x1d1a67['name']);_0x21c4f9[_0x42d2('0x31')]=_0x1d1a67;_0x21c4f9[_0x42d2('0x23')]=_0x5cf280;return request({'event':_0x42d2('0x32'),'message':_0x21c4f9});}else{return request({'event':_0x42d2('0x33'),'message':_0x21c4f9});}})[_0x42d2('0x21')](function(_0x26fb8e){logger[_0x42d2('0x1f')]('Trigger,\x20%s','AfterCreateMessage',_0x26fb8e);});};}function afterCreateOfflineMessage(_0x366b25){return function(_0xd230a9){_0xd230a9=_0xd230a9['get']({'plain':!![]});_0xd230a9[_0x42d2('0x23')]=_0x366b25;_0xd230a9[_0x42d2('0x24')]=_0x366b25;_0xd230a9[_0x42d2('0x25')]=_0x42d2('0x34');return request({'event':_0xd230a9[_0x42d2('0x25')],'message':_0xd230a9});};}function afterCreate(_0x25a756,_0x16b6da){return function(_0x51d38b){_0x51d38b=_0x51d38b[_0x42d2('0x22')]({'plain':!![]});_0x51d38b[_0x42d2('0x23')]=_0x25a756;_0x51d38b[_0x42d2('0x24')]=_0x25a756;_0x51d38b['event']=_0x42d2('0x35');Promise[_0x42d2('0x36')]()[_0x42d2('0x27')](function(){var _0xfcd877=_0x42d2('0x37')+_0x51d38b[_0x42d2('0x28')];return db[_0x42d2('0x29')]['query'](_0xfcd877,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]});})[_0x42d2('0x27')](function(_0x43151d){if(_0x43151d){_0x51d38b['contact']=_0x43151d[0x0];}if(typeof _0x51d38b['UserId']===_0x42d2('0x2e'))return;return getAgent(_0x51d38b[_0x42d2('0x2f')]);})['then'](function(_0x5ad538){if(_0x5ad538){_0x51d38b[_0x42d2('0x30')]=util[_0x42d2('0x38')](_0x42d2('0x39'),_0x5ad538[_0x42d2('0x3a')]);_0x51d38b['agent']=_0x5ad538;}return request({'event':_0x16b6da,'message':_0x51d38b});})[_0x42d2('0x21')](function(_0x221429){logger[_0x42d2('0x1f')](_0x42d2('0x1e'),'AfterCreate',_0x221429);});};}function afterUpdate(_0x1d474c){return function(_0x2919e6){var _0x1f83e1=_0x2919e6[_0x42d2('0x3b')](_0x42d2('0x3c'))&&_0x2919e6['closed'];var _0x136e16=_0x2919e6[_0x42d2('0x3b')](_0x42d2('0x3d'));if(_0x1f83e1||_0x136e16){var _0x1d55ad=_0x1f83e1?_0x42d2('0x9'):'substatus';var _0x2d2a9b=_0x2919e6[_0x42d2('0x22')]({'plain':!![]});_0x2d2a9b[_0x42d2('0x23')]=_0x1d474c;_0x2d2a9b['motionChannel']=_0x1d474c;_0x2d2a9b[_0x42d2('0x25')]=_0x1f83e1?_0x42d2('0x3c'):'substatus';var _0x4e3dba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d2a9b[_0x42d2('0x28')];return db['sequelize'][_0x42d2('0x2a')](_0x4e3dba,{'type':db[_0x42d2('0x3e')][_0x42d2('0x2b')]['SELECT'],'raw':!![]})['then'](function(_0x2dc2a4){if(_0x2dc2a4){_0x2d2a9b[_0x42d2('0x2d')]=_0x2dc2a4[0x0];}if(typeof _0x2d2a9b['UserId']===_0x42d2('0x2e'))return;return getAgent(_0x2d2a9b[_0x42d2('0x2f')]);})['then'](function(_0x77aeb3){if(_0x77aeb3){_0x2d2a9b[_0x42d2('0x30')]=util['format']('SIP/%s',_0x77aeb3[_0x42d2('0x3a')]);_0x2d2a9b['agent']=_0x77aeb3;}return request({'event':_0x1d55ad,'message':_0x2d2a9b});})[_0x42d2('0x21')](function(_0x131159){logger[_0x42d2('0x1f')](_0x42d2('0x1e'),_0x42d2('0x3f'),_0x131159);});}};}function getAgent(_0x1c399c){return db[_0x42d2('0x40')]['find']({'where':{'id':_0x1c399c},'attributes':['id',_0x42d2('0x3a'),'fullname','email',_0x42d2('0x41')],'raw':!![]})[_0x42d2('0x27')](function(_0x1c2ac1){return _0x1c2ac1;});}exports[_0x42d2('0x42')]=function(){for(var _0x53626c=0x0;_0x53626c=_0x3f9d02['agents']){throw Error(_0x94a3('0x11'));}_0x27ec87(_0x213f40);})[_0x94a3('0x12')](function(_0x58e834){_0x1e1b5e(_0x58e834);});});}; \ No newline at end of file +var _0xb394=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','count','agent','then','agents'];(function(_0x161985,_0x202209){var _0x1cbd5b=function(_0x39e8bd){while(--_0x39e8bd){_0x161985['push'](_0x161985['shift']());}};_0x1cbd5b(++_0x202209);}(_0xb394,0xd1));var _0x4b39=function(_0x160d73,_0x4dc4db){_0x160d73=_0x160d73-0x0;var _0x202f2a=_0xb394[_0x160d73];return _0x202f2a;};'use strict';var _=require(_0x4b39('0x0'));var BPromise=require('bluebird');var db=require(_0x4b39('0x1'))['db'];var util=require('./license/util');var channels=[_0x4b39('0x2'),_0x4b39('0x3'),_0x4b39('0x4'),_0x4b39('0x5'),_0x4b39('0x6'),_0x4b39('0x7'),_0x4b39('0x8')];exports[_0x4b39('0x9')]=function(){return channels;};exports[_0x4b39('0xa')]=function(_0x293caa){_0x293caa=_0x293caa['toLowerCase']();return _[_0x4b39('0xb')](channels,_0x293caa);};exports[_0x4b39('0xc')]=function(_0x5e09dc,_0x23298f,_0x1f011e,_0x56dd32){var _0x5457b5={'loginAttempts':_0x23298f,'blocked':_0x1f011e};if(!_['isUndefined'](_0x56dd32)){_0x5457b5[_0x4b39('0xd')]=_0x56dd32;}return _0x5e09dc[_0x4b39('0xe')](_0x5457b5);};exports[_0x4b39('0xf')]=function(_0x1d5dd9){return new BPromise(function(_0x1ade4c,_0x168036){var _0xc1b6ea=0x0;if(_0x1d5dd9[_0x4b39('0x10')]!=='agent'){_0x1ade4c(_0x1d5dd9);}db['User'][_0x4b39('0x11')]({'where':{'role':_0x4b39('0x12'),'online':!![],'id':{'$ne':_0x1d5dd9['id']}}})['then'](function(_0x1919c9){_0xc1b6ea=_0x1919c9;return util[_0x4b39('0xf')]();})[_0x4b39('0x13')](function(_0x573f49){if(_0x573f49&&_0x573f49[_0x4b39('0x14')]&&_0xc1b6ea>=_0x573f49[_0x4b39('0x14')]){throw Error(_0x4b39('0x15'));}_0x1ade4c(_0x1d5dd9);})[_0x4b39('0x16')](function(_0x24bf7b){_0x168036(_0x24bf7b);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e4fc8ae..511fff7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x593f=['Bad\x20Request','message','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Conflict','Out\x20Of\x20Interval','status','util','../config/logger','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x593f,0x78));var _0xf593=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x593f[_0x4c7935];return _0x30651d;};'use strict';var util=require(_0xf593('0x0'));var logger=require(_0xf593('0x1'))('api');var APIError=function(_0x553ca7,_0x41479a){this['message']=_0x553ca7||_0xf593('0x2');this[_0xf593('0x3')]=_0x41479a||_0xf593('0x4');util[_0xf593('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5f2e96){this['message']=_0x5f2e96||_0xf593('0x6');this[_0xf593('0x3')]='Bad\x20Request';util[_0xf593('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x25bbf2){this[_0xf593('0x7')]=_0x25bbf2||'Forbidden';this[_0xf593('0x3')]=_0xf593('0x8');util[_0xf593('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x299007){this[_0xf593('0x7')]=_0x299007||_0xf593('0x9');this[_0xf593('0x3')]=_0xf593('0xa');util[_0xf593('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x5966b0){this['message']=_0x5966b0||_0xf593('0xb');this['name']='Out\x20Of\x20Interval';this[_0xf593('0xc')]=0x193;this[_0xf593('0xd')]={'type':_0xf593('0xe')};util[_0xf593('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2dc1cd){this[_0xf593('0x7')]=_0x2dc1cd||'Resource\x20Conflict';this['name']=_0xf593('0xf');util[_0xf593('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x32c1fa){switch(_0x32c1fa){case _0xf593('0x6'):return 0x190;case'Forbidden',_0xf593('0x10'):return 0x193;case _0xf593('0xa'):return 0x194;case _0xf593('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xb44d10){if(_0xb44d10===_0xf593('0x10'))return _0xb44d10;return null;}function handleError(_0x5aa3a1){return function(_0x54a37d){logger['error'](_0x54a37d['stack']);var _0x25cb09=getStatusCode(_0x54a37d[_0xf593('0x3')]);var _0x15f2f3=getCustomStatusMessage(_0x54a37d[_0xf593('0x3')]);if(_0x54a37d[_0xf593('0x3')]){delete _0x54a37d[_0xf593('0x3')];}if(_0x15f2f3){_0x5aa3a1['statusMessage']=_0x15f2f3;}return _0x5aa3a1[_0xf593('0x11')](_0x25cb09)['send'](_0x54a37d);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xf0b0=['Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0b0,0x108));var _0x0f0b=function(_0x1e6622,_0x102bc4){_0x1e6622=_0x1e6622-0x0;var _0x20c415=_0xf0b0[_0x1e6622];return _0x20c415;};'use strict';var util=require('util');var logger=require(_0x0f0b('0x0'))('api');var APIError=function(_0x48ff97,_0x4a6e57){this[_0x0f0b('0x1')]=_0x48ff97||'Internal\x20Server\x20Error';this[_0x0f0b('0x2')]=_0x4a6e57||_0x0f0b('0x3');util[_0x0f0b('0x4')](APIError,Error);};var APIBadRequestError=function(_0x239609){this[_0x0f0b('0x1')]=_0x239609||_0x0f0b('0x5');this['name']=_0x0f0b('0x5');util[_0x0f0b('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x27185f){this[_0x0f0b('0x1')]=_0x27185f||_0x0f0b('0x6');this[_0x0f0b('0x2')]=_0x0f0b('0x6');util[_0x0f0b('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x272b12){this[_0x0f0b('0x1')]=_0x272b12||_0x0f0b('0x7');this[_0x0f0b('0x2')]=_0x0f0b('0x8');util[_0x0f0b('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x138d4b){this['message']=_0x138d4b||_0x0f0b('0x9');this[_0x0f0b('0x2')]='Out\x20Of\x20Interval';this[_0x0f0b('0xa')]=0x193;this[_0x0f0b('0xb')]={'type':_0x0f0b('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3bc282){this[_0x0f0b('0x1')]=_0x3bc282||_0x0f0b('0xd');this['name']=_0x0f0b('0xe');util[_0x0f0b('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x3f55ba){switch(_0x3f55ba){case _0x0f0b('0x5'):return 0x190;case _0x0f0b('0x6'),'Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0x0f0b('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x29945e){if(_0x29945e===_0x0f0b('0xf'))return _0x29945e;return null;}function handleError(_0x4cab0f){return function(_0x272897){logger[_0x0f0b('0x10')](_0x272897[_0x0f0b('0x11')]);var _0x4289ab=getStatusCode(_0x272897[_0x0f0b('0x2')]);var _0x256b74=getCustomStatusMessage(_0x272897[_0x0f0b('0x2')]);if(_0x272897[_0x0f0b('0x2')]){delete _0x272897[_0x0f0b('0x2')];}if(_0x256b74){_0x4cab0f[_0x0f0b('0x12')]=_0x256b74;}return _0x4cab0f['status'](_0x4289ab)[_0x0f0b('0x13')](_0x272897);};}module[_0x0f0b('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b2d2c7c..80e178e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7ee=['exports','404','status','render','json','send'];(function(_0x35f18a,_0x4e66d3){var _0x52d4e0=function(_0x267f42){while(--_0x267f42){_0x35f18a['push'](_0x35f18a['shift']());}};_0x52d4e0(++_0x4e66d3);}(_0xb7ee,0xba));var _0xeb7e=function(_0x3d1fa7,_0x4a12af){_0x3d1fa7=_0x3d1fa7-0x0;var _0x37f817=_0xb7ee[_0x3d1fa7];return _0x37f817;};'use strict';module[_0xeb7e('0x0')][0x194]=function pageNotFound(_0x27beed,_0x3952a7){var _0x4d5ce5=_0xeb7e('0x1');var _0x3bee91=0x194;var _0x504bad={'status':_0x3bee91};_0x3952a7['status'](_0x504bad[_0xeb7e('0x2')]);_0x3952a7[_0xeb7e('0x3')](_0x4d5ce5,{},function(_0x3dd89f,_0x38ca0f){if(_0x3dd89f){return _0x3952a7[_0xeb7e('0x2')](_0x504bad[_0xeb7e('0x2')])[_0xeb7e('0x4')](_0x504bad);}_0x3952a7[_0xeb7e('0x5')](_0x38ca0f);});}; \ No newline at end of file +var _0xa222=['send','exports','404','status','render','json'];(function(_0x3a64fd,_0x5dcc53){var _0x556b53=function(_0xf65079){while(--_0xf65079){_0x3a64fd['push'](_0x3a64fd['shift']());}};_0x556b53(++_0x5dcc53);}(_0xa222,0x1b7));var _0x2a22=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0xa222[_0x1857d0];return _0x3e3c46;};'use strict';module[_0x2a22('0x0')][0x194]=function pageNotFound(_0x22943,_0xefa312){var _0x3d02a1=_0x2a22('0x1');var _0x1883bf=0x194;var _0x4373ac={'status':_0x1883bf};_0xefa312['status'](_0x4373ac[_0x2a22('0x2')]);_0xefa312[_0x2a22('0x3')](_0x3d02a1,{},function(_0x404769,_0x557f2e){if(_0x404769){return _0xefa312[_0x2a22('0x2')](_0x4373ac[_0x2a22('0x2')])[_0x2a22('0x4')](_0x4373ac);}_0xefa312[_0x2a22('0x5')](_0x557f2e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index dc24bb6..f2dc75b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb999=['HopperBlacks','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','AgentReports','CmContact','MailServerIn','restrict','MailServerOut','MailAccountId','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Contact','ContactId','Owner','mail_interaction_has_tags','Users','Attachments','IntervalId','TagId','MailQueueReport','Items','FaxAccountId','FaxApplication','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','ChatGroupId','CompanyId','Phones','CmContactId','JscriptySessions','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','SalesforceAccount','AccountId','Field','FieldId','Subject','Description','VariableId','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Field','FreshsalesAccount','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','user_has_teams','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','sequelizeHistory','utf8mb4','utf8_general_ci','database','password','username','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','ChatInteractions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','UserVoicePrefix','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories'];(function(_0x412f4e,_0x4bfe0a){var _0x4c57d1=function(_0x4f006f){while(--_0x4f006f){_0x412f4e['push'](_0x412f4e['shift']());}};_0x4c57d1(++_0x4bfe0a);}(_0xb999,0xad));var _0x9b99=function(_0x468d2d,_0x2a58cb){_0x468d2d=_0x468d2d-0x0;var _0x7203b2=_0xb999[_0x468d2d];return _0x7203b2;};'use strict';var config=require(_0x9b99('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x9b99('0x1'));var timezone=jstz[_0x9b99('0x2')]();config[_0x9b99('0x3')]=_['defaultsDeep'](config['sequelize'],{'database':_0x9b99('0x4'),'username':_0x9b99('0x5'),'password':_0x9b99('0x6'),'options':{'host':_0x9b99('0x7'),'port':0xcea,'dialect':_0x9b99('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9b99('0x9')](),'define':{'charset':_0x9b99('0xa'),'collate':'utf8_general_ci'}}});config[_0x9b99('0xb')]=_['defaultsDeep'](config[_0x9b99('0xb')],{'database':'motion2','username':_0x9b99('0x5'),'password':'xC@LL1234','options':{'host':_0x9b99('0x7'),'port':0xcea,'dialect':_0x9b99('0x8'),'dialectOptions':{'charset':_0x9b99('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9b99('0xa'),'collate':_0x9b99('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9b99('0x3')][_0x9b99('0xe')],config[_0x9b99('0x3')]['username'],config['sequelize'][_0x9b99('0xf')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9b99('0xb')]['database'],config[_0x9b99('0xb')][_0x9b99('0x10')],config[_0x9b99('0xb')][_0x9b99('0xf')],config[_0x9b99('0xb')][_0x9b99('0x11')])};db[_0x9b99('0x12')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x13'));db[_0x9b99('0x14')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x16'));db[_0x9b99('0x17')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x18'));db['VoiceExtension']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x19'));db[_0x9b99('0x1a')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x1b'));db[_0x9b99('0x1c')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x1d'));db[_0x9b99('0x1e')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x1f'));db['ScreenRecording']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x20'));db[_0x9b99('0x21')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x22'));db[_0x9b99('0x23')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x24'));db['VoiceCallReport']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0x9b99('0x25')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x9b99('0x26')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x27'));db[_0x9b99('0x28')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x29'));db[_0x9b99('0x2a')]=db[_0x9b99('0x3')]['import']('../api/memberReport/memberReport.model');db[_0x9b99('0x2b')]=db['sequelize'][_0x9b99('0x15')]('../api/trunk/trunk.model');db[_0x9b99('0x2c')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x2d'));db[_0x9b99('0x2e')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x2f'));db[_0x9b99('0x30')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x9b99('0x31')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x32'));db['UserMailQueue']=db[_0x9b99('0x3')]['import'](_0x9b99('0x33'));db[_0x9b99('0x34')]=db['sequelize']['import'](_0x9b99('0x35'));db['UserSmsQueue']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x36'));db[_0x9b99('0x37')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x38'));db['MailServerIn']=db[_0x9b99('0x3')]['import'](_0x9b99('0x39'));db['MailServerOut']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x3a'));db['MailAccount']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x3b'));db[_0x9b99('0x3c')]=db[_0x9b99('0x3')]['import']('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x3d'));db[_0x9b99('0x3e')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x3f'));db['MailMessage']=db[_0x9b99('0x3')]['import'](_0x9b99('0x40'));db[_0x9b99('0x41')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x42'));db['MailQueueReport']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x43'));db[_0x9b99('0x44')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x45'));db[_0x9b99('0x46')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x47'));db[_0x9b99('0x48')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x49'));db['FaxApplication']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/faxApplication/faxApplication.model');db[_0x9b99('0x4a')]=db['sequelize']['import'](_0x9b99('0x4b'));db[_0x9b99('0x4c')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x4d'));db[_0x9b99('0x4e')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x4f'));db[_0x9b99('0x50')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x51'));db['SmsAccount']=db[_0x9b99('0x3')]['import'](_0x9b99('0x52'));db[_0x9b99('0x53')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/smsApplication/smsApplication.model');db[_0x9b99('0x54')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x55'));db[_0x9b99('0x56')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x57'));db[_0x9b99('0x58')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x59'));db['OpenchannelAccount']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x5a'));db[_0x9b99('0x5b')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x5c'));db['OpenchannelInteraction']=db[_0x9b99('0x3')]['import'](_0x9b99('0x5d'));db[_0x9b99('0x5e')]=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x5f'));db[_0x9b99('0x60')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x61'));db[_0x9b99('0x62')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x63'));db[_0x9b99('0x64')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x65'));db[_0x9b99('0x66')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0x9b99('0x67')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x68'));db[_0x9b99('0x69')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x6a'));db[_0x9b99('0x6b')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x6c'));db[_0x9b99('0x6d')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/chatGroup/chatGroup.model');db[_0x9b99('0x6e')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x6f'));db[_0x9b99('0x70')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x71'));db['CmContact']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x72'));db['CmHopper']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x73'));db[_0x9b99('0x74')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x75'));db[_0x9b99('0x76')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x77'));db[_0x9b99('0x78')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x79'));db[_0x9b99('0x7a')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x7b'));db[_0x9b99('0x7c')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x7d'));db[_0x9b99('0x7e')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x7f'));db[_0x9b99('0x80')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x81'));db[_0x9b99('0x82')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x83'));db[_0x9b99('0x84')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x85'));db[_0x9b99('0x86')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x87'));db[_0x9b99('0x88')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/interval/interval.model');db['Pause']=db['sequelize']['import'](_0x9b99('0x89'));db[_0x9b99('0x8a')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x8b'));db['VoiceQueuesLog']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x8c'));db[_0x9b99('0x8d')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x8e'));db[_0x9b99('0x8f')]=db[_0x9b99('0x3')]['import']('../api/sound/sound.model');db[_0x9b99('0x90')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x91'));db[_0x9b99('0x92')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x93'));db[_0x9b99('0x94')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x95'));db[_0x9b99('0x96')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x97'));db['Template']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/template/template.model');db[_0x9b99('0x98')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x99'));db[_0x9b99('0x9a')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x9b'));db['Integration']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x9c'));db[_0x9b99('0x9d')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x9e'));db[_0x9b99('0x9f')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xa0'));db[_0x9b99('0xa1')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xa2'));db[_0x9b99('0xa3')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xa4'));db[_0x9b99('0xa5')]=db[_0x9b99('0x3')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x9b99('0xa6')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xa7'));db[_0x9b99('0xa8')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xa9'));db['SalesforceAccount']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xaa'));db[_0x9b99('0xab')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xac'));db[_0x9b99('0xad')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xae'));db[_0x9b99('0xaf')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9b99('0xb0')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xb1'));db[_0x9b99('0xb2')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x9b99('0xb3')]=db['sequelize']['import'](_0x9b99('0xb4'));db[_0x9b99('0xb5')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xb6'));db[_0x9b99('0xb7')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xb8'));db[_0x9b99('0xb9')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xba'));db[_0x9b99('0xbb')]=db[_0x9b99('0x3')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9b99('0xbc')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xbd'));db['ZendeskAccount']=db['sequelize'][_0x9b99('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x9b99('0xbe')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xbf'));db[_0x9b99('0xc0')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0x9b99('0xc1')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x9b99('0xc2')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9b99('0xc3')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x9b99('0xc4')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xc5'));db['VtigerConfiguration']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x9b99('0xc6')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0x9b99('0xc7')]=db[_0x9b99('0x3')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xc8'));db[_0x9b99('0xc9')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xca'));db[_0x9b99('0xcb')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xcc'));db[_0x9b99('0xcd')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xce'));db['Dynamics365Field']=db['sequelize']['import'](_0x9b99('0xcf'));db['FreshsalesAccount']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xd0'));db[_0x9b99('0xd1')]=db['sequelize'][_0x9b99('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x9b99('0xd2')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xd3'));db[_0x9b99('0xd4')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x9c'));db[_0x9b99('0xd5')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xd6'));db['ChatQueueReport']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xd7'));db[_0x9b99('0xd8')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xd9'));db[_0x9b99('0xda')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xdb'));db['JscriptyQuestionReport']=db[_0x9b99('0x3')]['import'](_0x9b99('0xdc'));db[_0x9b99('0xdd')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xde'));db['SquareReport']=db[_0x9b99('0x3')]['import'](_0x9b99('0xdf'));db[_0x9b99('0xe0')]=db[_0x9b99('0x3')]['import'](_0x9b99('0xe1'));db[_0x9b99('0xe2')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0xe3'));db[_0x9b99('0xe4')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xe5'));db[_0x9b99('0xe6')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xe7'));db['SquareProject']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xe8'));db['SquareRecording']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/squareRecording/squareRecording.model');db[_0x9b99('0xe9')]=db['sequelize'][_0x9b99('0x15')]('../api/squareMessage/squareMessage.model');db[_0x9b99('0xea')]=db['sequelize']['import'](_0x9b99('0xeb'));db[_0x9b99('0xec')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xed'));db[_0x9b99('0xee')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xef'));db[_0x9b99('0xf0')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xf1'));db[_0x9b99('0xf2')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xf3'));db['Plugin']=db['sequelize']['import']('../api/plugin/plugin.model');db[_0x9b99('0xf4')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0x9b99('0xf5')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0x9b99('0xf6')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xf7'));db[_0x9b99('0xf8')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xf9'));db[_0x9b99('0xfa')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xfb'));db[_0x9b99('0xfc')]=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/cmList/cmList.model');db[_0x9b99('0xfd')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0xfe'));db[_0x9b99('0xff')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x100'));db[_0x9b99('0x101')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x102'));db[_0x9b99('0x103')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x104'));db[_0x9b99('0x105')]=db['sequelize']['import'](_0x9b99('0x106'));db['WhatsappAccount']=db[_0x9b99('0x3')]['import']('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize']['import'](_0x9b99('0x107'));db[_0x9b99('0x108')]=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x109'));db[_0x9b99('0x10a')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x10b'));db['WhatsappQueueReport']=db[_0x9b99('0x3')][_0x9b99('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x9b99('0x10c')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x9b99('0x10d')]=db['sequelize'][_0x9b99('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0x9b99('0x10e')]=db[_0x9b99('0x3')]['import'](_0x9b99('0x10f'));db['TeamVoiceQueue']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x110'));db[_0x9b99('0x111')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x112'));db['UserVoicePrefix']=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x113'));db[_0x9b99('0x114')]=db[_0x9b99('0x3')][_0x9b99('0x15')](_0x9b99('0x115'));db['MailInteractionHasTag']=db['sequelize'][_0x9b99('0x15')](_0x9b99('0x116'));db['User'][_0x9b99('0x117')](db['VoiceMail'],{'as':_0x9b99('0x21'),'onDelete':'cascade','foreignKey':_0x9b99('0x118')});db['User']['hasOne'](db['UserSetting'],{'as':_0x9b99('0x119'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')][_0x9b99('0x11b')](db['VoiceRecording'],{'as':_0x9b99('0x11c'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x2e')],{'as':_0x9b99('0x11d'),'foreignKey':_0x9b99('0x118')});db['User'][_0x9b99('0x11b')](db[_0x9b99('0x11e')],{'as':_0x9b99('0x11f'),'onDelete':_0x9b99('0x11a'),'hooks':!![]});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x76')],{'as':_0x9b99('0x120'),'foreignKey':_0x9b99('0x118')});db['User'][_0x9b99('0x11b')](db[_0x9b99('0x78')],{'as':_0x9b99('0x121'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')]['hasMany'](db['ReportAgentPreview'],{'as':_0x9b99('0x7a'),'foreignKey':_0x9b99('0x118')});db['User']['hasMany'](db[_0x9b99('0x122')],{'as':_0x9b99('0x123'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')]['hasMany'](db[_0x9b99('0x66')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0x9b99('0x54')],{'as':_0x9b99('0x124'),'foreignKey':_0x9b99('0x118')});db['User']['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x3e')],{'as':_0x9b99('0x125'),'foreignKey':'UserId'});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x108')],{'as':_0x9b99('0x126'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x105')],{'as':_0x9b99('0x127'),'foreignKey':_0x9b99('0x128')});db[_0x9b99('0x12')][_0x9b99('0x11b')](db[_0x9b99('0x129')],{'as':'Hoppers','foreignKey':_0x9b99('0x118'),'onDelete':_0x9b99('0x12a')});db[_0x9b99('0x12')]['belongsTo'](db['UserProfile'],{'as':_0x9b99('0xff'),'foreignKey':_0x9b99('0x12b')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x6d')],{'as':_0x9b99('0x12d'),'through':_0x9b99('0x12e')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db['CmContact'],{'as':_0x9b99('0x12f'),'through':_0x9b99('0x130')});db[_0x9b99('0x12')]['belongsToMany'](db[_0x9b99('0xfc')],{'as':_0x9b99('0x131'),'through':_0x9b99('0x132')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0xea')],{'through':'user_has_teams'});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x3e')],{'as':_0x9b99('0x125'),'through':_0x9b99('0x133')});db[_0x9b99('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x9b99('0x134'),'through':'user_has_chat_interactions'});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x4a')],{'as':_0x9b99('0x135'),'through':_0x9b99('0x136')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x54')],{'as':_0x9b99('0x124'),'through':_0x9b99('0x137')});db[_0x9b99('0x12')]['belongsToMany'](db[_0x9b99('0x122')],{'as':_0x9b99('0x123'),'through':_0x9b99('0x138')});db['User'][_0x9b99('0x12c')](db[_0x9b99('0x108')],{'as':_0x9b99('0x126'),'through':_0x9b99('0x139')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x1c')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0x9b99('0xfd')],{'as':_0x9b99('0x13a'),'through':_0x9b99('0x13b'),'required':![]});db[_0x9b99('0x12')]['belongsToMany'](db[_0x9b99('0x3c')],{'as':_0x9b99('0x13c'),'through':_0x9b99('0x13d'),'required':![]});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x6b')],{'as':_0x9b99('0x13e'),'through':_0x9b99('0x31'),'required':![],'hooks':!![]});db[_0x9b99('0x12')][_0x9b99('0x12c')](db['FaxQueue'],{'as':_0x9b99('0x13f'),'through':_0x9b99('0x34'),'required':![]});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x58')],{'as':_0x9b99('0x140'),'through':_0x9b99('0x141'),'required':![]});db[_0x9b99('0x12')]['belongsToMany'](db[_0x9b99('0x142')],{'as':_0x9b99('0x143'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x9b99('0x12c')](db[_0x9b99('0x10d')],{'as':_0x9b99('0x144'),'through':_0x9b99('0x145'),'required':![]});db['User'][_0x9b99('0x12c')](db[_0x9b99('0xfc')],{'through':_0x9b99('0x132')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x60')],{'as':_0x9b99('0x146'),'through':_0x9b99('0x147')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x48')],{'as':'FaxAccounts','through':_0x9b99('0x148')});db['User'][_0x9b99('0x12c')](db[_0x9b99('0x149')],{'as':'MailAccounts','through':_0x9b99('0x14a')});db['User'][_0x9b99('0x12c')](db[_0x9b99('0x14b')],{'as':_0x9b99('0x14c'),'through':_0x9b99('0x14d')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x14e')],{'as':'SmsAccounts','through':_0x9b99('0x14f')});db[_0x9b99('0x12')][_0x9b99('0x12c')](db[_0x9b99('0x150')],{'as':_0x9b99('0x151'),'through':'user_has_whatsapp_accounts'});db[_0x9b99('0x14')][_0x9b99('0x11b')](db[_0x9b99('0x11e')],{'as':_0x9b99('0x152'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x153')});db['VoiceContext'][_0x9b99('0x11b')](db[_0x9b99('0x11e')],{'onDelete':'cascade'});db[_0x9b99('0x11e')][_0x9b99('0x11b')](db['VoiceExtension'],{'as':_0x9b99('0x154'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x1a')][_0x9b99('0x12c')](db[_0x9b99('0x8f')],{'as':'Sounds','through':_0x9b99('0x155')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db['UserVoiceQueueRt'],{'as':_0x9b99('0x156'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db[_0x9b99('0x129')],{'as':_0x9b99('0x158'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db['CmHopperFinal'],{'as':_0x9b99('0x120'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db[_0x9b99('0x78')],{'as':_0x9b99('0x159'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db[_0x9b99('0x7a')],{'as':_0x9b99('0x7a'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db[_0x9b99('0x74')],{'as':_0x9b99('0x15a'),'foreignKey':_0x9b99('0x157')});db[_0x9b99('0x1c')][_0x9b99('0x11b')](db[_0x9b99('0xdd')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db[_0x9b99('0x2b')],{'as':_0x9b99('0x2b'),'foreignKey':_0x9b99('0x15b')});db[_0x9b99('0x1c')][_0x9b99('0x15c')](db[_0x9b99('0x2b')],{'as':_0x9b99('0x15d'),'foreignKey':_0x9b99('0x15e')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0x9b99('0x88'),'foreignKey':'IntervalId'});db[_0x9b99('0x1c')][_0x9b99('0x15c')](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':_0x9b99('0x161')});db['VoiceQueue']['belongsToMany'](db[_0x9b99('0xfc')],{'as':_0x9b99('0x131'),'through':_0x9b99('0x162')});db[_0x9b99('0x1c')][_0x9b99('0x12c')](db['User'],{'as':_0x9b99('0x163'),'through':_0x9b99('0x30')});db['VoiceQueue']['belongsToMany'](db['Team'],{'as':_0x9b99('0x164'),'through':_0x9b99('0x165')});db[_0x9b99('0x1c')][_0x9b99('0x12c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x166'),'through':_0x9b99('0x167')});db[_0x9b99('0x1e')]['belongsTo'](db[_0x9b99('0x12')],{'as':'User','foreignKey':_0x9b99('0x118')});db[_0x9b99('0x168')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':'User','foreignKey':_0x9b99('0x118')});db[_0x9b99('0x21')][_0x9b99('0x11b')](db[_0x9b99('0x23')],{'as':'Messages','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x169'),'sourceKey':'mailbox'});db[_0x9b99('0x23')][_0x9b99('0x15c')](db[_0x9b99('0x21')],{'foreignKey':_0x9b99('0x169'),'targetKey':'mailbox'});db[_0x9b99('0x16a')][_0x9b99('0x11b')](db[_0x9b99('0x28')],{'as':_0x9b99('0x16b'),'foreignKey':_0x9b99('0x16c'),'constraints':![]});db[_0x9b99('0x16a')]['hasMany'](db[_0x9b99('0x26')],{'as':_0x9b99('0x16d'),'foreignKey':_0x9b99('0x16c'),'constraints':![]});db[_0x9b99('0x16a')]['belongsTo'](db[_0x9b99('0x12')],{'as':_0x9b99('0x12'),'foreignKey':_0x9b99('0x118')});db['VoiceCallReport'][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9b99('0x16f')][_0x9b99('0x15c')](db['MailAccount'],{'as':_0x9b99('0x149'),'foreignKey':'MailAccountId'});db[_0x9b99('0x16f')][_0x9b99('0x15c')](db[_0x9b99('0x10e')],{'as':_0x9b99('0x10e'),'foreignKey':'CloudProviderId','onDelete':_0x9b99('0x170')});db[_0x9b99('0x171')][_0x9b99('0x15c')](db[_0x9b99('0x149')],{'as':'MailAccount','foreignKey':_0x9b99('0x172')});db['MailServerOut'][_0x9b99('0x15c')](db[_0x9b99('0x10e')],{'as':'CloudProvider','foreignKey':_0x9b99('0x173'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x149')][_0x9b99('0x117')](db[_0x9b99('0x16f')],{'as':_0x9b99('0x174'),'onDelete':_0x9b99('0x11a')});db['MailAccount'][_0x9b99('0x117')](db[_0x9b99('0x171')],{'as':_0x9b99('0x175'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x149')][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':_0x9b99('0x176'),'foreignKey':_0x9b99('0x172'),'onDelete':'cascade'});db[_0x9b99('0x149')]['hasMany'](db[_0x9b99('0x82')],{'as':_0x9b99('0x177'),'foreignKey':'MailAccountId'});db[_0x9b99('0x149')][_0x9b99('0x11b')](db[_0x9b99('0x178')],{'as':_0x9b99('0x179'),'foreignKey':'MailAccountId'});db[_0x9b99('0x149')][_0x9b99('0x11b')](db['MailInteraction'],{'as':_0x9b99('0x17a')});db[_0x9b99('0x149')][_0x9b99('0x11b')](db[_0x9b99('0x41')],{'as':_0x9b99('0x154'),'foreignKey':_0x9b99('0x172'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x149')][_0x9b99('0x15c')](db['CmList'],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db['MailAccount'][_0x9b99('0x15c')](db[_0x9b99('0x17d')],{'as':'Template','foreignKey':_0x9b99('0x17e')});db['MailAccount'][_0x9b99('0x15c')](db['Pause'],{'as':_0x9b99('0x160'),'foreignKey':_0x9b99('0x161')});db[_0x9b99('0x149')]['belongsToMany'](db['User'],{'as':_0x9b99('0x163'),'through':'user_has_mail_accounts'});db[_0x9b99('0x3c')]['belongsToMany'](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':_0x9b99('0x13d')});db[_0x9b99('0x3c')]['belongsToMany'](db['Team'],{'through':_0x9b99('0x17f'),'as':_0x9b99('0x164')});db[_0x9b99('0x3e')][_0x9b99('0x11b')](db[_0x9b99('0x178')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9b99('0x180')});db['MailInteraction']['belongsTo'](db[_0x9b99('0x149')],{'as':_0x9b99('0x181'),'foreignKey':'MailAccountId'});db[_0x9b99('0x3e')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db['MailInteraction'][_0x9b99('0x15c')](db['User'],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x3e')][_0x9b99('0x12c')](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x9b99('0x3e')][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x185'),'as':'ThroughTags'});db[_0x9b99('0x3e')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x186'),'through':_0x9b99('0x133'),'foreignKey':_0x9b99('0x180')});db['MailMessage']['hasMany'](db[_0x9b99('0xf2')],{'as':_0x9b99('0x187'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x178')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x12')});db[_0x9b99('0x178')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x182')});db['MailMessage'][_0x9b99('0x15c')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x9b99('0x180')});db[_0x9b99('0x178')][_0x9b99('0x15c')](db[_0x9b99('0x149')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x172')});db[_0x9b99('0x178')]['belongsTo'](db[_0x9b99('0x60')],{'as':_0x9b99('0x60'),'foreignKey':'ChatWebsiteId'});db[_0x9b99('0x178')][_0x9b99('0x15c')](db[_0x9b99('0x69')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x9b99('0x41')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x41')][_0x9b99('0x15c')](db[_0x9b99('0x3c')],{'onDelete':'restrict'});db[_0x9b99('0x41')][_0x9b99('0x15c')](db[_0x9b99('0x149')],{'onDelete':'restrict'});db[_0x9b99('0x41')][_0x9b99('0x15c')](db[_0x9b99('0x88')],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x188')});db[_0x9b99('0x41')][_0x9b99('0x15c')](db[_0x9b99('0x90')],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x189')});db['MailQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0x149')],{});db[_0x9b99('0x18a')][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x18a')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':'Contact','foreignKey':_0x9b99('0x183')});db['MailQueueReport'][_0x9b99('0x15c')](db['MailInteraction'],{});db[_0x9b99('0x18a')][_0x9b99('0x15c')](db[_0x9b99('0x178')],{});db[_0x9b99('0x18a')][_0x9b99('0x15c')](db['User'],{});db[_0x9b99('0x18a')]['belongsTo'](db[_0x9b99('0x3c')],{});db['Dashboard'][_0x9b99('0x11b')](db[_0x9b99('0x46')],{'as':_0x9b99('0x18b'),'onDelete':_0x9b99('0x11a')});db['FaxAccount'][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':_0x9b99('0x176'),'foreignKey':_0x9b99('0x18c'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x48')]['hasMany'](db[_0x9b99('0x82')],{'as':'Answers','foreignKey':_0x9b99('0x18c')});db[_0x9b99('0x48')][_0x9b99('0x11b')](db[_0x9b99('0x4a')],{'as':'Interactions'});db[_0x9b99('0x48')][_0x9b99('0x11b')](db[_0x9b99('0x18d')],{'as':_0x9b99('0x154'),'foreignKey':_0x9b99('0x18c'),'onDelete':_0x9b99('0x11a')});db['FaxAccount'][_0x9b99('0x11b')](db[_0x9b99('0x11e')],{'as':_0x9b99('0x18e'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x48')][_0x9b99('0x11b')](db[_0x9b99('0x4c')],{'as':_0x9b99('0x179')});db[_0x9b99('0x48')][_0x9b99('0x15c')](db[_0x9b99('0x2b')],{'as':_0x9b99('0x2b')});db[_0x9b99('0x48')]['belongsTo'](db[_0x9b99('0xfc')],{'as':'List','foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x48')]['belongsTo'](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9b99('0x48')]['belongsToMany'](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':_0x9b99('0x148')});db[_0x9b99('0x18d')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':'restrict'});db[_0x9b99('0x18d')][_0x9b99('0x15c')](db[_0x9b99('0x4e')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x18d')][_0x9b99('0x15c')](db[_0x9b99('0x48')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x18d')][_0x9b99('0x15c')](db[_0x9b99('0x90')],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x189')});db['FaxInteraction'][_0x9b99('0x11b')](db['FaxMessage'],{'as':'Messages','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x18f')});db[_0x9b99('0x4a')]['belongsTo'](db[_0x9b99('0x48')],{'as':'Account','foreignKey':_0x9b99('0x18c')});db[_0x9b99('0x4a')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':'ContactId'});db[_0x9b99('0x4a')][_0x9b99('0x15c')](db['User'],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x4a')]['belongsToMany'](db[_0x9b99('0x90')],{'through':_0x9b99('0x190'),'as':_0x9b99('0x191')});db['FaxInteraction'][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x190'),'as':'ThroughTags'});db[_0x9b99('0x4a')]['belongsToMany'](db['User'],{'as':_0x9b99('0x186'),'through':_0x9b99('0x136'),'foreignKey':_0x9b99('0x18f')});db[_0x9b99('0x4c')][_0x9b99('0x15c')](db['User'],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x12')});db['FaxMessage']['belongsTo'](db[_0x9b99('0x4a')],{'as':_0x9b99('0x192'),'foreignKey':_0x9b99('0x18f')});db[_0x9b99('0x4c')]['belongsTo'](db[_0x9b99('0x16e')],{'onDelete':'cascade','as':_0x9b99('0x182')});db['FaxMessage'][_0x9b99('0x15c')](db[_0x9b99('0xf2')],{'as':_0x9b99('0xf2'),'foreignKey':_0x9b99('0x193')});db['FaxMessage'][_0x9b99('0x15c')](db[_0x9b99('0x48')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x18c')});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x9b99('0x163'),'through':_0x9b99('0x34')});db[_0x9b99('0x4e')]['belongsToMany'](db[_0x9b99('0xea')],{'through':_0x9b99('0x194'),'as':_0x9b99('0x164')});db[_0x9b99('0x50')][_0x9b99('0x15c')](db[_0x9b99('0x48')],{});db[_0x9b99('0x50')][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':'ListId'});db[_0x9b99('0x50')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':'ContactId'});db[_0x9b99('0x50')]['belongsTo'](db[_0x9b99('0x4a')],{});db[_0x9b99('0x50')][_0x9b99('0x15c')](db[_0x9b99('0x4c')],{});db[_0x9b99('0x50')]['belongsTo'](db[_0x9b99('0x12')],{});db[_0x9b99('0x50')][_0x9b99('0x15c')](db[_0x9b99('0x4e')],{});db[_0x9b99('0x14e')][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':'Dispositions','foreignKey':_0x9b99('0x195'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x14e')][_0x9b99('0x11b')](db['CannedAnswer'],{'as':_0x9b99('0x177'),'foreignKey':_0x9b99('0x195')});db[_0x9b99('0x14e')]['hasMany'](db[_0x9b99('0x56')],{'as':'Messages','foreignKey':_0x9b99('0x195')});db[_0x9b99('0x14e')][_0x9b99('0x11b')](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0x9b99('0x11b')](db['SmsApplication'],{'as':_0x9b99('0x154'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x9b99('0x14e')][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':'List','foreignKey':'ListId'});db[_0x9b99('0x14e')][_0x9b99('0x15c')](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9b99('0x14e')][_0x9b99('0x12c')](db['User'],{'as':_0x9b99('0x163'),'through':'user_has_sms_accounts'});db[_0x9b99('0x53')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x170')});db['SmsApplication'][_0x9b99('0x15c')](db[_0x9b99('0x58')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x53')][_0x9b99('0x15c')](db['SmsAccount'],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x53')]['belongsTo'](db[_0x9b99('0x88')],{'onDelete':_0x9b99('0x170'),'foreignKey':'IntervalId'});db[_0x9b99('0x53')][_0x9b99('0x15c')](db[_0x9b99('0x90')],{'onDelete':_0x9b99('0x170'),'foreignKey':'TagId'});db[_0x9b99('0x54')]['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x196')});db[_0x9b99('0x54')][_0x9b99('0x15c')](db[_0x9b99('0x14e')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x195')});db[_0x9b99('0x54')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x54')]['belongsTo'](db[_0x9b99('0x12')],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x54')][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':'sms_interaction_has_tags','as':_0x9b99('0x191')});db[_0x9b99('0x54')][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x197'),'as':_0x9b99('0x198')});db[_0x9b99('0x54')][_0x9b99('0x12c')](db['User'],{'as':_0x9b99('0x186'),'through':_0x9b99('0x137'),'foreignKey':_0x9b99('0x196')});db[_0x9b99('0x56')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x12')});db[_0x9b99('0x56')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'onDelete':'cascade','as':_0x9b99('0x182')});db['SmsMessage']['belongsTo'](db[_0x9b99('0x54')],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x192'),'foreignKey':_0x9b99('0x196')});db[_0x9b99('0x56')][_0x9b99('0x15c')](db['SmsAccount'],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x195')});db[_0x9b99('0x58')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db['SmsQueue']['belongsToMany'](db[_0x9b99('0xea')],{'through':_0x9b99('0x199'),'as':_0x9b99('0x164')});db['OpenchannelAccount'][_0x9b99('0x11b')](db['Disposition'],{'as':_0x9b99('0x176'),'foreignKey':'OpenchannelAccountId','onDelete':_0x9b99('0x11a')});db['OpenchannelAccount'][_0x9b99('0x11b')](db[_0x9b99('0x82')],{'as':'Answers','foreignKey':_0x9b99('0x19a')});db[_0x9b99('0x14b')][_0x9b99('0x11b')](db[_0x9b99('0x122')],{'as':_0x9b99('0x17a'),'foreignKey':_0x9b99('0x19a')});db[_0x9b99('0x14b')][_0x9b99('0x11b')](db[_0x9b99('0x5e')],{'as':'Messages','foreignKey':_0x9b99('0x19a')});db[_0x9b99('0x14b')][_0x9b99('0x11b')](db['OpenchannelApplication'],{'as':_0x9b99('0x154'),'foreignKey':_0x9b99('0x19a'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x14b')][_0x9b99('0x15c')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x9b99('0x15c')](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9b99('0x14b')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':_0x9b99('0x14d')});db[_0x9b99('0x5b')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x5b')][_0x9b99('0x15c')](db['OpenchannelQueue'],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x19b')});db[_0x9b99('0x5b')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x9b99('0x19a')});db[_0x9b99('0x5b')][_0x9b99('0x15c')](db[_0x9b99('0x88')],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x188')});db['OpenchannelApplication']['belongsTo'](db[_0x9b99('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x9b99('0x122')][_0x9b99('0x11b')](db[_0x9b99('0x5e')],{'as':_0x9b99('0x179'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x19c')});db[_0x9b99('0x122')]['belongsTo'](db[_0x9b99('0x14b')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x19a')});db[_0x9b99('0x122')]['belongsTo'](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x122')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db['OpenchannelInteraction'][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x19d'),'as':_0x9b99('0x191')});db[_0x9b99('0x122')][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x19d'),'as':_0x9b99('0x198')});db[_0x9b99('0x122')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x186'),'through':_0x9b99('0x138'),'foreignKey':_0x9b99('0x19c')});db[_0x9b99('0x5e')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x11a'),'as':'User'});db[_0x9b99('0x5e')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x182')});db[_0x9b99('0x5e')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x192'),'foreignKey':_0x9b99('0x19c')});db[_0x9b99('0x5e')][_0x9b99('0x15c')](db[_0x9b99('0xf2')],{'as':_0x9b99('0xf2'),'foreignKey':_0x9b99('0x193')});db['OpenchannelMessage'][_0x9b99('0x15c')](db[_0x9b99('0x14b')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x19a')});db['OpenchannelQueue'][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':'UserOpenchannelQueue','foreignKey':_0x9b99('0x19b')});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x9b99('0x164')});db[_0x9b99('0x60')][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':_0x9b99('0x176'),'foreignKey':_0x9b99('0x19e'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x60')][_0x9b99('0x11b')](db[_0x9b99('0x82')],{'as':_0x9b99('0x177'),'foreignKey':'ChatWebsiteId'});db[_0x9b99('0x60')]['hasMany'](db['ChatProactiveAction'],{'as':_0x9b99('0x19f')});db[_0x9b99('0x60')][_0x9b99('0x11b')](db[_0x9b99('0x66')],{'as':_0x9b99('0x17a')});db[_0x9b99('0x60')][_0x9b99('0x11b')](db[_0x9b99('0x64')],{'as':_0x9b99('0x154'),'foreignKey':_0x9b99('0x19e'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x60')][_0x9b99('0x11b')](db['ChatMessage'],{'as':_0x9b99('0x179')});db[_0x9b99('0x60')][_0x9b99('0x15c')](db['CmList'],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x60')][_0x9b99('0x15c')](db[_0x9b99('0x88')],{'as':_0x9b99('0x88'),'foreignKey':_0x9b99('0x188')});db[_0x9b99('0x60')][_0x9b99('0x15c')](db[_0x9b99('0x149')],{'as':_0x9b99('0x149'),'foreignKey':_0x9b99('0x172')});db['ChatWebsite'][_0x9b99('0x15c')](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':_0x9b99('0x161')});db[_0x9b99('0x60')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x9b99('0x62')]['belongsTo'](db[_0x9b99('0x14b')],{});db['OpenchannelQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db['OpenchannelQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x62')][_0x9b99('0x15c')](db[_0x9b99('0x122')],{});db['OpenchannelQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0x5e')],{});db[_0x9b99('0x62')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{});db[_0x9b99('0x62')][_0x9b99('0x15c')](db[_0x9b99('0x142')],{});db[_0x9b99('0x64')]['belongsTo'](db[_0x9b99('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x9b99('0x170')});db[_0x9b99('0x64')][_0x9b99('0x15c')](db[_0x9b99('0x6b')],{'as':_0x9b99('0x1a0'),'foreignKey':_0x9b99('0x1a1'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x64')]['belongsTo'](db[_0x9b99('0x60')],{'as':_0x9b99('0x1a2'),'foreignKey':'ChatWebsiteId','onDelete':_0x9b99('0x170')});db[_0x9b99('0x64')][_0x9b99('0x15c')](db['Tag'],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x189')});db[_0x9b99('0x66')]['hasMany'](db['ChatMessage'],{'as':_0x9b99('0x179'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x9b99('0x66')][_0x9b99('0x15c')](db[_0x9b99('0x60')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x19e')});db[_0x9b99('0x66')][_0x9b99('0x15c')](db['CmContact'],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db['ChatInteraction'][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db['ChatInteraction'][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x1a3'),'as':'Tags'});db[_0x9b99('0x66')][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':_0x9b99('0x1a3'),'as':'ThroughTags'});db['ChatInteraction'][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x186'),'through':'user_has_chat_interactions','foreignKey':_0x9b99('0x1a4')});db[_0x9b99('0x67')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'onDelete':'cascade','as':'User'});db[_0x9b99('0x67')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x182'),'foreignKey':'ContactId'});db[_0x9b99('0x67')][_0x9b99('0x15c')](db['ChatInteraction'],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x192'),'foreignKey':_0x9b99('0x1a4')});db[_0x9b99('0x67')]['belongsTo'](db[_0x9b99('0xf2')],{'as':'Attachment','foreignKey':_0x9b99('0x193')});db['ChatMessage'][_0x9b99('0x15c')](db[_0x9b99('0x60')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x19e')});db[_0x9b99('0x69')]['hasMany'](db['Attachment'],{'as':_0x9b99('0x187'),'foreignKey':_0x9b99('0x1a5'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x69')][_0x9b99('0x15c')](db[_0x9b99('0x60')],{'as':_0x9b99('0x181'),'foreignKey':'ChatWebsiteId'});db[_0x9b99('0x6b')][_0x9b99('0x12c')](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x9b99('0x12c')](db['Team'],{'through':'team_has_chat_queues','as':_0x9b99('0x164')});db['ChatGroup'][_0x9b99('0x11b')](db[_0x9b99('0xd8')],{'as':_0x9b99('0x179'),'foreignKey':_0x9b99('0x1a6'),'onDelete':'cascade'});db[_0x9b99('0x6d')]['belongsToMany'](db['User'],{'as':_0x9b99('0x156'),'through':_0x9b99('0x12e')});db['ChatProactiveAction']['belongsTo'](db[_0x9b99('0x60')],{'as':_0x9b99('0x1a2'),'foreignKey':'ChatWebsiteId'});db[_0x9b99('0x70')][_0x9b99('0x11b')](db['CmContact'],{'as':_0x9b99('0x12f'),'foreignKey':_0x9b99('0x1a7')});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x94')],{'as':_0x9b99('0x1a8'),'foreignKey':_0x9b99('0x1a9')});db[_0x9b99('0x16e')]['hasMany'](db[_0x9b99('0x129')],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact']['hasMany'](db['CmHopperFinal'],{'as':_0x9b99('0x120'),'foreignKey':'ContactId'});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x78')],{'as':_0x9b99('0x159'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x7a')],{'as':_0x9b99('0x7a'),'foreignKey':'ContactId'});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0xdd')],{'as':_0x9b99('0x1aa'),'foreignKey':'ContactId'});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x122')],{'as':_0x9b99('0x123'),'foreignKey':_0x9b99('0x183'),'onDelete':_0x9b99('0x170')});db['CmContact'][_0x9b99('0x11b')](db[_0x9b99('0x66')],{'as':'ChatInteractions','foreignKey':_0x9b99('0x183'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x54')],{'as':_0x9b99('0x124'),'foreignKey':_0x9b99('0x183'),'onDelete':'restrict'});db[_0x9b99('0x16e')][_0x9b99('0x11b')](db[_0x9b99('0x4a')],{'as':_0x9b99('0x135'),'foreignKey':_0x9b99('0x183'),'onDelete':_0x9b99('0x170')});db['CmContact'][_0x9b99('0x11b')](db[_0x9b99('0x3e')],{'as':_0x9b99('0x125'),'foreignKey':_0x9b99('0x183'),'onDelete':'restrict'});db['CmContact'][_0x9b99('0x15c')](db['CmCompany'],{'as':'Company','foreignKey':_0x9b99('0x1a7')});db['CmContact'][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':'List','foreignKey':_0x9b99('0x17c'),'onDelete':_0x9b99('0x11a')});db['CmContact'][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x186'),'through':_0x9b99('0x130')});db[_0x9b99('0x16e')]['belongsToMany'](db['Tag'],{'as':_0x9b99('0x191'),'through':_0x9b99('0x1ab')});db[_0x9b99('0x16e')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':_0x9b99('0x198')});db[_0x9b99('0x129')][_0x9b99('0x11b')](db['CmHopperAdditionalPhone'],{'as':_0x9b99('0x1ac'),'foreignKey':_0x9b99('0x1ad')});db[_0x9b99('0x129')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x129')][_0x9b99('0x15c')](db['CmList'],{'as':_0x9b99('0x17b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9b99('0x129')]['belongsTo'](db['User'],{'as':_0x9b99('0x1ae'),'foreignKey':_0x9b99('0x118')});db['CmHopper'][_0x9b99('0x15c')](db[_0x9b99('0x1c')],{'as':_0x9b99('0x1a0'),'foreignKey':_0x9b99('0x157'),'onDelete':_0x9b99('0x11a')});db['CmHopper'][_0x9b99('0x15c')](db['Campaign'],{'as':_0x9b99('0xee'),'foreignKey':_0x9b99('0x1af'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x129')]['belongsTo'](db[_0x9b99('0x12')],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x1b0')});db[_0x9b99('0x74')][_0x9b99('0x15c')](db['CmContact'],{'as':'Contact','foreignKey':_0x9b99('0x183'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x74')][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':'ListId','onDelete':_0x9b99('0x11a')});db['CmHopperBlack'][_0x9b99('0x15c')](db[_0x9b99('0x1c')],{'as':_0x9b99('0x1a0'),'foreignKey':_0x9b99('0x157'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x74')][_0x9b99('0x15c')](db['Campaign'],{'as':_0x9b99('0xee'),'foreignKey':_0x9b99('0x1af'),'onDelete':'cascade'});db[_0x9b99('0x80')][_0x9b99('0x11b')](db[_0x9b99('0x86')],{'as':{'plural':_0x9b99('0x1b1'),'singular':_0x9b99('0x1b2')},'foreignKey':_0x9b99('0x1b3'),'onDelete':_0x9b99('0x11a'),'hooks':!![]});db[_0x9b99('0x80')][_0x9b99('0x11b')](db[_0x9b99('0x86')],{'as':{'plural':_0x9b99('0x1b4'),'singular':_0x9b99('0x1b5')},'foreignKey':_0x9b99('0x1b6'),'onDelete':_0x9b99('0x11a'),'hooks':!![]});db['Automation']['hasMany'](db[_0x9b99('0x7e')],{'as':_0x9b99('0x1b7'),'foreignKey':_0x9b99('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0x9b99('0x84')][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':_0x9b99('0x176'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x9b99('0x88')][_0x9b99('0x11b')](db['Interval'],{'as':_0x9b99('0x1b9'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x9b99('0x88')]['hasMany'](db['VoiceExtension'],{'as':_0x9b99('0x11f'),'foreignKey':_0x9b99('0x188'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x88')][_0x9b99('0x11b')](db[_0x9b99('0x41')],{'as':_0x9b99('0x1ba'),'foreignKey':'IntervalId'});db[_0x9b99('0x88')]['hasMany'](db[_0x9b99('0x64')],{'as':_0x9b99('0x1bb'),'foreignKey':_0x9b99('0x188')});db[_0x9b99('0x88')][_0x9b99('0x11b')](db['FaxApplication'],{'as':_0x9b99('0x1bc'),'foreignKey':_0x9b99('0x188')});db[_0x9b99('0x88')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x9b99('0x188')});db[_0x9b99('0x8d')][_0x9b99('0x15c')](db['MailAccount'],{});db['Schedule'][_0x9b99('0x15c')](db[_0x9b99('0xa1')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x9b99('0x15c')](db[_0x9b99('0x9f')],{'foreignKey':_0x9b99('0x1bd')});db[_0x9b99('0x8f')][_0x9b99('0x12c')](db[_0x9b99('0x1a')],{'as':'Mohs','through':_0x9b99('0x155'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x90')]['belongsToMany'](db[_0x9b99('0x16e')],{'through':_0x9b99('0x1ab')});db[_0x9b99('0x90')]['belongsToMany'](db[_0x9b99('0x66')],{'through':_0x9b99('0x1a3')});db['Tag'][_0x9b99('0x12c')](db[_0x9b99('0x3e')],{'through':_0x9b99('0x185')});db[_0x9b99('0x90')][_0x9b99('0x12c')](db[_0x9b99('0x54')],{'through':_0x9b99('0x197')});db[_0x9b99('0x90')]['belongsToMany'](db['FaxInteraction'],{'through':_0x9b99('0x190')});db['Tag'][_0x9b99('0x12c')](db[_0x9b99('0x122')],{'through':_0x9b99('0x19d')});db[_0x9b99('0x90')]['belongsToMany'](db[_0x9b99('0x108')],{'through':_0x9b99('0x1be')});db['CmContactHasItem'][_0x9b99('0x15c')](db[_0x9b99('0x92')],{'as':_0x9b99('0x1bf'),'foreignKey':_0x9b99('0x1c0')});db[_0x9b99('0x96')][_0x9b99('0x15c')](db['CmHopper'],{'as':_0x9b99('0x1c1'),'foreignKey':'CmHopperId'});db[_0x9b99('0x94')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x1a9')});db[_0x9b99('0x98')][_0x9b99('0x11b')](db[_0x9b99('0x86')],{'as':{'plural':'AllConditions','singular':_0x9b99('0x1c2')},'foreignKey':_0x9b99('0x1c3'),'onDelete':'cascade','hooks':!![]});db[_0x9b99('0x98')]['hasMany'](db[_0x9b99('0x86')],{'as':{'plural':_0x9b99('0x1c4'),'singular':_0x9b99('0x1c5')},'foreignKey':'TriggerAnyId','onDelete':_0x9b99('0x11a'),'hooks':!![]});db['Trigger'][_0x9b99('0x11b')](db[_0x9b99('0x7e')],{'as':_0x9b99('0x1b7'),'foreignKey':_0x9b99('0x1c6'),'onDelete':'cascade','hooks':!![]});db[_0x9b99('0x9f')][_0x9b99('0x11b')](db['AnalyticFieldReport'],{'as':_0x9b99('0x1c7'),'onDelete':'cascade','foreignKey':_0x9b99('0x1bd'),'hooks':!![]});db[_0x9b99('0xa1')][_0x9b99('0x11b')](db[_0x9b99('0xa6')],{'as':_0x9b99('0x1c7'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x9b99('0xa5')][_0x9b99('0x11b')](db[_0x9b99('0xa6')],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1c8')});db[_0x9b99('0xa6')][_0x9b99('0x15c')](db[_0x9b99('0xa5')],{'foreignKey':_0x9b99('0x1c8')});db['SalesforceAccount'][_0x9b99('0x11b')](db[_0x9b99('0xab')],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x9b99('0x11b')](db['SalesforceField'],{'as':_0x9b99('0x1ca'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xab')][_0x9b99('0x11b')](db[_0x9b99('0xad')],{'as':_0x9b99('0x1cc'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cd')});db['SalesforceConfiguration'][_0x9b99('0x11b')](db['SalesforceField'],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':'FieldId'});db[_0x9b99('0xab')]['belongsTo'](db[_0x9b99('0x1ce')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xad')]['hasMany'](db[_0x9b99('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db['SalesforceField']['hasMany'](db[_0x9b99('0xad')],{'as':'Description','foreignKey':_0x9b99('0x1cd')});db['SalesforceField']['hasMany'](db[_0x9b99('0xad')],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xad')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':'VariableId'});db[_0x9b99('0xaf')][_0x9b99('0x11b')](db[_0x9b99('0xb0')],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cf')});db['SugarcrmConfiguration'][_0x9b99('0x11b')](db[_0x9b99('0xb2')],{'as':_0x9b99('0x1ca'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xb0')][_0x9b99('0x11b')](db['SugarcrmField'],{'as':_0x9b99('0x1cc'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xb0')][_0x9b99('0x11b')](db['SugarcrmField'],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xb0')][_0x9b99('0x15c')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x9b99('0x1cf')});db['SugarcrmField'][_0x9b99('0x11b')](db[_0x9b99('0xb2')],{'as':_0x9b99('0x1d2'),'foreignKey':'SubjectId'});db[_0x9b99('0xb2')]['hasMany'](db['SugarcrmField'],{'as':_0x9b99('0x1d3'),'foreignKey':_0x9b99('0x1cd')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xb2')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':'VariableId'});db[_0x9b99('0xb3')][_0x9b99('0x11b')](db[_0x9b99('0xb5')],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xb5')]['hasMany'](db[_0x9b99('0xb7')],{'as':_0x9b99('0x1ca'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xb5')][_0x9b99('0x11b')](db[_0x9b99('0xb7')],{'as':_0x9b99('0x1cc'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xb5')][_0x9b99('0x11b')](db[_0x9b99('0xb7')],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xb5')]['belongsTo'](db[_0x9b99('0xb3')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x9b99('0x12c')](db[_0x9b99('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0x9b99('0xb7')][_0x9b99('0x11b')](db[_0x9b99('0xb7')],{'as':_0x9b99('0x1d2'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xb7')][_0x9b99('0x11b')](db['DeskField'],{'as':_0x9b99('0x1d3'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xb7')][_0x9b99('0x11b')](db[_0x9b99('0xb7')],{'as':'Field','foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xb7')]['belongsTo'](db['Variable'],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db['ZohoAccount'][_0x9b99('0x11b')](db['ZohoConfiguration'],{'as':_0x9b99('0x1c9'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cf')});db['ZohoConfiguration'][_0x9b99('0x11b')](db['ZohoField'],{'as':_0x9b99('0x1ca'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xbb')][_0x9b99('0x11b')](db['ZohoField'],{'as':_0x9b99('0x1cc'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xbb')][_0x9b99('0x11b')](db[_0x9b99('0xbc')],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xbb')][_0x9b99('0x15c')](db['ZohoAccount'],{'as':_0x9b99('0x181'),'foreignKey':'AccountId'});db[_0x9b99('0xbc')]['hasMany'](db[_0x9b99('0xbc')],{'as':_0x9b99('0x1d2'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xbc')][_0x9b99('0x11b')](db[_0x9b99('0xbc')],{'as':_0x9b99('0x1d3'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xbc')]['hasMany'](db[_0x9b99('0xbc')],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xbc')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db[_0x9b99('0x1d5')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xbe')][_0x9b99('0x11b')](db[_0x9b99('0xc0')],{'as':_0x9b99('0x1ca'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xbe')][_0x9b99('0x11b')](db[_0x9b99('0xc0')],{'as':_0x9b99('0x1cc'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xbe')][_0x9b99('0x11b')](db['ZendeskField'],{'as':_0x9b99('0x1c7'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xbe')][_0x9b99('0x15c')](db[_0x9b99('0x1d5')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xbe')]['belongsToMany'](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x9b99('0xc0')][_0x9b99('0x11b')](db['ZendeskField'],{'as':_0x9b99('0x1d2'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xc0')]['hasMany'](db[_0x9b99('0xc0')],{'as':_0x9b99('0x1d3'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xc0')]['hasMany'](db[_0x9b99('0xc0')],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db['ZendeskField']['belongsTo'](db[_0x9b99('0x9a')],{'as':'Variable','foreignKey':_0x9b99('0x1d4')});db[_0x9b99('0xc1')][_0x9b99('0x11b')](db[_0x9b99('0xc2')],{'as':_0x9b99('0x1c9'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cf')});db['FreshdeskConfiguration'][_0x9b99('0x11b')](db[_0x9b99('0xc3')],{'as':_0x9b99('0x1ca'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9b99('0xc2')]['hasMany'](db[_0x9b99('0xc3')],{'as':_0x9b99('0x1cc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x9b99('0x11b')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1d1')});db['FreshdeskConfiguration'][_0x9b99('0x15c')](db['FreshdeskAccount'],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x1cf')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x9b99('0x90')],{'through':_0x9b99('0x1d6')});db[_0x9b99('0xc3')][_0x9b99('0x11b')](db[_0x9b99('0xc3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9b99('0xc3')][_0x9b99('0x11b')](db[_0x9b99('0xc3')],{'as':_0x9b99('0x1d3'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xc3')][_0x9b99('0x11b')](db[_0x9b99('0xc3')],{'as':'Field','foreignKey':'FieldId'});db[_0x9b99('0xc3')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db[_0x9b99('0xc4')][_0x9b99('0x11b')](db[_0x9b99('0x1d7')],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':'AccountId'});db[_0x9b99('0x1d7')][_0x9b99('0x11b')](db[_0x9b99('0xc6')],{'as':_0x9b99('0x1ca'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0x1d7')][_0x9b99('0x11b')](db['VtigerField'],{'as':_0x9b99('0x1cc'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0x1d7')][_0x9b99('0x11b')](db[_0x9b99('0xc6')],{'as':_0x9b99('0x1c7'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0x1d7')][_0x9b99('0x15c')](db['VtigerAccount'],{'as':_0x9b99('0x181'),'foreignKey':'AccountId'});db[_0x9b99('0xc6')][_0x9b99('0x11b')](db[_0x9b99('0xc6')],{'as':_0x9b99('0x1d2'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xc6')][_0x9b99('0x11b')](db[_0x9b99('0xc6')],{'as':_0x9b99('0x1d3'),'foreignKey':'DescriptionId'});db[_0x9b99('0xc6')]['hasMany'](db[_0x9b99('0xc6')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db['ServicenowAccount'][_0x9b99('0x11b')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cf')});db['ServicenowConfiguration'][_0x9b99('0x11b')](db['ServicenowField'],{'as':_0x9b99('0x1ca'),'foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0x1d8')][_0x9b99('0x11b')](db[_0x9b99('0xc9')],{'as':_0x9b99('0x1cc'),'foreignKey':_0x9b99('0x1cd')});db['ServicenowConfiguration'][_0x9b99('0x11b')](db[_0x9b99('0xc9')],{'as':_0x9b99('0x1c7'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0x1d8')]['belongsTo'](db[_0x9b99('0xc7')],{'as':'Account','foreignKey':_0x9b99('0x1cf')});db['ServicenowField'][_0x9b99('0x11b')](db['ServicenowField'],{'as':_0x9b99('0x1d2'),'foreignKey':_0x9b99('0x1cb')});db['ServicenowField'][_0x9b99('0x11b')](db[_0x9b99('0xc9')],{'as':_0x9b99('0x1d3'),'foreignKey':'DescriptionId'});db[_0x9b99('0xc9')][_0x9b99('0x11b')](db[_0x9b99('0xc9')],{'as':'Field','foreignKey':'FieldId'});db[_0x9b99('0xc9')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db['Dynamics365Account'][_0x9b99('0x11b')](db[_0x9b99('0xcd')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x9b99('0xcb')]['belongsTo'](db['CloudProvider'],{'as':_0x9b99('0x10e'),'foreignKey':_0x9b99('0x173')});db[_0x9b99('0xcd')][_0x9b99('0x11b')](db[_0x9b99('0x1d9')],{'as':_0x9b99('0x1ca'),'onDelete':'cascade','foreignKey':_0x9b99('0x1cb')});db[_0x9b99('0xcd')][_0x9b99('0x11b')](db[_0x9b99('0x1d9')],{'as':_0x9b99('0x1cc'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cd')});db['Dynamics365Configuration'][_0x9b99('0x11b')](db[_0x9b99('0x1d9')],{'as':_0x9b99('0x1c7'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1d1')});db['Dynamics365Configuration'][_0x9b99('0x15c')](db[_0x9b99('0xcb')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x1cf')});db['Dynamics365Field']['hasMany'](db[_0x9b99('0x1d9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9b99('0x1d9')]['hasMany'](db[_0x9b99('0x1d9')],{'as':_0x9b99('0x1d3'),'foreignKey':'DescriptionId'});db[_0x9b99('0x1d9')][_0x9b99('0x11b')](db[_0x9b99('0x1d9')],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0x1d9')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db['FreshsalesAccount'][_0x9b99('0x11b')](db['FreshsalesConfiguration'],{'as':_0x9b99('0x1c9'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xd1')][_0x9b99('0x11b')](db[_0x9b99('0xd2')],{'as':_0x9b99('0x1ca'),'foreignKey':_0x9b99('0x1cb')});db['FreshsalesConfiguration'][_0x9b99('0x11b')](db[_0x9b99('0xd2')],{'as':_0x9b99('0x1cc'),'foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xd1')][_0x9b99('0x11b')](db['FreshsalesField'],{'as':_0x9b99('0x1c7'),'foreignKey':'FieldId'});db[_0x9b99('0xd1')][_0x9b99('0x15c')](db[_0x9b99('0x1da')],{'as':_0x9b99('0x181'),'foreignKey':_0x9b99('0x1cf')});db[_0x9b99('0xd2')]['hasMany'](db['FreshsalesField'],{'as':_0x9b99('0x1d2'),'foreignKey':'SubjectId'});db[_0x9b99('0xd2')][_0x9b99('0x11b')](db[_0x9b99('0xd2')],{'as':'Description','foreignKey':_0x9b99('0x1cd')});db[_0x9b99('0xd2')]['hasMany'](db[_0x9b99('0xd2')],{'as':_0x9b99('0x1d0'),'foreignKey':_0x9b99('0x1d1')});db[_0x9b99('0xd2')][_0x9b99('0x15c')](db[_0x9b99('0x9a')],{'as':_0x9b99('0x9a'),'foreignKey':_0x9b99('0x1d4')});db[_0x9b99('0x1db')][_0x9b99('0x15c')](db[_0x9b99('0x60')],{});db['ChatQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':'List','foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x1db')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9b99('0x1db')][_0x9b99('0x15c')](db[_0x9b99('0x66')],{});db[_0x9b99('0x1db')][_0x9b99('0x15c')](db[_0x9b99('0x67')],{});db[_0x9b99('0x1db')]['belongsTo'](db[_0x9b99('0x12')],{});db[_0x9b99('0x1db')][_0x9b99('0x15c')](db[_0x9b99('0x6b')],{});db[_0x9b99('0xd8')]['belongsTo'](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x11a'),'foreignKey':'FromId'});db[_0x9b99('0xd8')]['belongsTo'](db['User'],{'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x1dc')});db[_0x9b99('0xdd')][_0x9b99('0x11b')](db[_0x9b99('0x1dd')],{'foreignKey':_0x9b99('0x1de'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0xdd')]['hasMany'](db[_0x9b99('0xda')],{'foreignKey':_0x9b99('0x1de'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x1df')][_0x9b99('0x15c')](db[_0x9b99('0x14e')],{});db['SmsQueueReport']['belongsTo'](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x1df')][_0x9b99('0x15c')](db['CmContact'],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x1df')][_0x9b99('0x15c')](db[_0x9b99('0x54')],{});db[_0x9b99('0x1df')][_0x9b99('0x15c')](db[_0x9b99('0x56')],{});db[_0x9b99('0x1df')]['belongsTo'](db[_0x9b99('0x12')],{});db[_0x9b99('0x1df')][_0x9b99('0x15c')](db[_0x9b99('0x58')],{});db['JscriptyProject'][_0x9b99('0x11b')](db[_0x9b99('0xdd')],{'foreignKey':'ProjectId'});db[_0x9b99('0xe2')][_0x9b99('0x11b')](db[_0x9b99('0x1dd')],{'foreignKey':'ProjectId'});db[_0x9b99('0xe2')][_0x9b99('0x11b')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x9b99('0xea')][_0x9b99('0x12c')](db['User'],{'as':_0x9b99('0x163'),'through':_0x9b99('0x1e0')});db[_0x9b99('0xea')][_0x9b99('0x12c')](db[_0x9b99('0x1c')],{'through':_0x9b99('0x165'),'as':'VoiceQueues'});db[_0x9b99('0xea')][_0x9b99('0x12c')](db[_0x9b99('0x3c')],{'through':_0x9b99('0x17f'),'as':_0x9b99('0x13c')});db[_0x9b99('0xea')][_0x9b99('0x12c')](db[_0x9b99('0x6b')],{'through':'team_has_chat_queues','as':_0x9b99('0x13e')});db[_0x9b99('0xea')]['belongsToMany'](db[_0x9b99('0x4e')],{'through':_0x9b99('0x194'),'as':'FaxQueues'});db['Team'][_0x9b99('0x12c')](db[_0x9b99('0x58')],{'through':_0x9b99('0x199'),'as':_0x9b99('0x140')});db[_0x9b99('0xea')][_0x9b99('0x12c')](db[_0x9b99('0x142')],{'through':_0x9b99('0x1e1'),'as':_0x9b99('0x143')});db[_0x9b99('0xea')][_0x9b99('0x12c')](db['WhatsappQueue'],{'through':_0x9b99('0x1e2'),'as':_0x9b99('0x144')});db['Team'][_0x9b99('0x12c')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x9b99('0xee')][_0x9b99('0x11b')](db['CmHopper'],{'as':_0x9b99('0x158'),'foreignKey':_0x9b99('0x1af')});db[_0x9b99('0xee')][_0x9b99('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x9b99('0x1af')});db[_0x9b99('0xee')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x9b99('0xee')][_0x9b99('0x11b')](db[_0x9b99('0x74')],{'as':_0x9b99('0x15a'),'foreignKey':_0x9b99('0x1af')});db[_0x9b99('0xee')][_0x9b99('0x15c')](db[_0x9b99('0x2b')],{'as':_0x9b99('0x2b'),'foreignKey':_0x9b99('0x15b')});db[_0x9b99('0xee')][_0x9b99('0x15c')](db[_0x9b99('0x2b')],{'as':'TrunkBackup','foreignKey':_0x9b99('0x15e')});db[_0x9b99('0xee')][_0x9b99('0x15c')](db[_0x9b99('0x88')],{'as':_0x9b99('0x88'),'foreignKey':_0x9b99('0x188')});db[_0x9b99('0xee')]['belongsTo'](db[_0x9b99('0x1e3')],{'as':_0x9b99('0x1e3'),'foreignKey':_0x9b99('0x1e4')});db['Campaign'][_0x9b99('0x12c')](db[_0x9b99('0xfc')],{'as':'Lists','through':_0x9b99('0x1e5')});db['Campaign']['belongsToMany'](db[_0x9b99('0xfc')],{'as':'BlackLists','through':_0x9b99('0x1e6')});db['Attachment'][_0x9b99('0x15c')](db[_0x9b99('0x69')],{'as':_0x9b99('0x69'),'foreignKey':'ChatOfflineMessageId'});db[_0x9b99('0xf4')]['belongsTo'](db[_0x9b99('0x178')],{});db[_0x9b99('0xf4')]['belongsTo'](db[_0x9b99('0x3e')],{});db[_0x9b99('0xf4')][_0x9b99('0x15c')](db[_0x9b99('0x149')],{'foreignKey':_0x9b99('0x1e7'),'as':_0x9b99('0x1e8')});db['MailTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':'FromUserId','as':_0x9b99('0x1e9')});db[_0x9b99('0xf4')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1ea'),'as':_0x9b99('0x1eb')});db['MailTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x3c')],{'foreignKey':_0x9b99('0x1ec'),'as':_0x9b99('0x1ed')});db['MailTransferReport'][_0x9b99('0x15c')](db['MailAccount'],{'foreignKey':_0x9b99('0x1ee'),'as':_0x9b99('0x1ef')});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db[_0x9b99('0x67')],{});db[_0x9b99('0xf5')]['belongsTo'](db[_0x9b99('0x66')],{});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db[_0x9b99('0x60')],{'foreignKey':_0x9b99('0x1f0'),'as':_0x9b99('0x1e8')});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db['User'],{'foreignKey':_0x9b99('0x1f1'),'as':_0x9b99('0x1e9')});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db[_0x9b99('0x6b')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x9b99('0xf5')][_0x9b99('0x15c')](db[_0x9b99('0x60')],{'foreignKey':_0x9b99('0x1f2'),'as':_0x9b99('0x1ef')});db[_0x9b99('0xf6')]['belongsTo'](db['FaxMessage'],{});db[_0x9b99('0xf6')]['belongsTo'](db['FaxInteraction'],{});db[_0x9b99('0xf6')][_0x9b99('0x15c')](db[_0x9b99('0x48')],{'foreignKey':_0x9b99('0x1f3'),'as':_0x9b99('0x1e8')});db[_0x9b99('0xf6')]['belongsTo'](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1f1'),'as':_0x9b99('0x1e9')});db['FaxTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1ea'),'as':'ToAgent'});db['FaxTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x4e')],{'foreignKey':_0x9b99('0x1f4'),'as':_0x9b99('0x1ed')});db[_0x9b99('0xf6')][_0x9b99('0x15c')](db[_0x9b99('0x48')],{'foreignKey':_0x9b99('0x1f5'),'as':_0x9b99('0x1ef')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9b99('0x5e')],{});db['OpenchannelTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x122')],{});db[_0x9b99('0xf8')][_0x9b99('0x15c')](db['OpenchannelAccount'],{'foreignKey':_0x9b99('0x1f6'),'as':_0x9b99('0x1e8')});db[_0x9b99('0xf8')][_0x9b99('0x15c')](db['User'],{'foreignKey':_0x9b99('0x1f1'),'as':'FromAgent'});db[_0x9b99('0xf8')]['belongsTo'](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1ea'),'as':_0x9b99('0x1eb')});db[_0x9b99('0xf8')][_0x9b99('0x15c')](db[_0x9b99('0x142')],{'foreignKey':_0x9b99('0x1f7'),'as':_0x9b99('0x1ed')});db[_0x9b99('0xf8')][_0x9b99('0x15c')](db[_0x9b99('0x14b')],{'foreignKey':_0x9b99('0x1f8'),'as':_0x9b99('0x1ef')});db['SmsTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x56')],{});db[_0x9b99('0xfa')][_0x9b99('0x15c')](db[_0x9b99('0x54')],{});db['SmsTransferReport'][_0x9b99('0x15c')](db[_0x9b99('0x14e')],{'foreignKey':_0x9b99('0x1f9'),'as':_0x9b99('0x1e8')});db[_0x9b99('0xfa')]['belongsTo'](db[_0x9b99('0x12')],{'foreignKey':'FromUserId','as':_0x9b99('0x1e9')});db[_0x9b99('0xfa')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1ea'),'as':'ToAgent'});db[_0x9b99('0xfa')][_0x9b99('0x15c')](db[_0x9b99('0x58')],{'foreignKey':_0x9b99('0x1fa'),'as':'ToQueue'});db[_0x9b99('0xfa')][_0x9b99('0x15c')](db[_0x9b99('0x14e')],{'foreignKey':_0x9b99('0x1fb'),'as':_0x9b99('0x1ef')});db['CmList']['hasMany'](db['Disposition'],{'as':_0x9b99('0x176'),'foreignKey':_0x9b99('0x17c'),'onDelete':'cascade'});db['CmList'][_0x9b99('0x11b')](db[_0x9b99('0x7c')],{'as':'CustomFields','foreignKey':_0x9b99('0x17c')});db[_0x9b99('0xfc')]['hasMany'](db[_0x9b99('0x16e')],{'as':'Contacts','onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x17c')});db['CmList']['hasMany'](db[_0x9b99('0x76')],{'as':'HopperFinals','foreignKey':_0x9b99('0x17c')});db[_0x9b99('0xfc')][_0x9b99('0x11b')](db[_0x9b99('0x78')],{'as':'HopperHistory','foreignKey':_0x9b99('0x17c')});db[_0x9b99('0xfc')][_0x9b99('0x11b')](db['ReportAgentPreview'],{'as':_0x9b99('0x7a'),'foreignKey':_0x9b99('0x17c')});db['CmList'][_0x9b99('0x12c')](db[_0x9b99('0x1c')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x9b99('0xfc')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':'cm_user_has_lists'});db[_0x9b99('0xfd')][_0x9b99('0x11b')](db[_0x9b99('0x11e')],{'as':_0x9b99('0x11f'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0xfd')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':'UserVoicePrefix'});db[_0x9b99('0xfd')][_0x9b99('0x12c')](db[_0x9b99('0xea')],{'through':_0x9b99('0x111'),'as':_0x9b99('0x164')});db[_0x9b99('0xff')][_0x9b99('0x11b')](db[_0x9b99('0x12')],{'as':_0x9b99('0x186'),'foreignKey':_0x9b99('0x12b')});db['UserProfile'][_0x9b99('0x11b')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x9b99('0x12b'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x101')][_0x9b99('0x11b')](db[_0x9b99('0x103')],{'as':_0x9b99('0x1fc'),'foreignKey':_0x9b99('0x1fd'),'onDelete':'cascade'});db[_0x9b99('0x150')][_0x9b99('0x11b')](db[_0x9b99('0x84')],{'as':'Dispositions','foreignKey':_0x9b99('0x1fe'),'onDelete':_0x9b99('0x11a')});db[_0x9b99('0x150')][_0x9b99('0x11b')](db[_0x9b99('0x82')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x9b99('0x11b')](db[_0x9b99('0x10a')],{'as':_0x9b99('0x179'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x9b99('0x11b')](db[_0x9b99('0x108')],{'as':'Interactions'});db[_0x9b99('0x150')][_0x9b99('0x11b')](db[_0x9b99('0x1ff')],{'as':'Applications','foreignKey':_0x9b99('0x1fe'),'onDelete':'cascade'});db[_0x9b99('0x150')][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db[_0x9b99('0x150')][_0x9b99('0x15c')](db[_0x9b99('0x15f')],{'as':_0x9b99('0x160'),'foreignKey':_0x9b99('0x161')});db[_0x9b99('0x150')]['belongsToMany'](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication']['belongsTo'](db[_0x9b99('0x12')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x1ff')]['belongsTo'](db[_0x9b99('0x10d')],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x1ff')][_0x9b99('0x15c')](db['WhatsappAccount'],{'onDelete':_0x9b99('0x170')});db[_0x9b99('0x1ff')][_0x9b99('0x15c')](db[_0x9b99('0x88')],{'onDelete':'restrict','foreignKey':_0x9b99('0x188')});db[_0x9b99('0x1ff')][_0x9b99('0x15c')](db['Tag'],{'onDelete':_0x9b99('0x170'),'foreignKey':_0x9b99('0x189')});db['WhatsappInteraction'][_0x9b99('0x11b')](db[_0x9b99('0x10a')],{'as':_0x9b99('0x179'),'onDelete':_0x9b99('0x11a'),'foreignKey':_0x9b99('0x200')});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x9b99('0x108')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':'ContactId'});db[_0x9b99('0x108')]['belongsTo'](db[_0x9b99('0x12')],{'as':_0x9b99('0x184'),'foreignKey':_0x9b99('0x118')});db[_0x9b99('0x108')][_0x9b99('0x12c')](db['Tag'],{'through':_0x9b99('0x1be'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0x9b99('0x90')],{'through':_0x9b99('0x1be'),'as':'ThroughTags'});db[_0x9b99('0x108')][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':'Users','through':_0x9b99('0x139'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x12')});db[_0x9b99('0x10a')][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'onDelete':'cascade','as':'Contact'});db[_0x9b99('0x10a')]['belongsTo'](db[_0x9b99('0x108')],{'onDelete':_0x9b99('0x11a'),'as':_0x9b99('0x192'),'foreignKey':_0x9b99('0x200')});db['WhatsappMessage'][_0x9b99('0x15c')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x9b99('0x1fe')});db[_0x9b99('0x201')]['belongsTo'](db[_0x9b99('0x150')],{});db['WhatsappQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0xfc')],{'as':_0x9b99('0x17b'),'foreignKey':_0x9b99('0x17c')});db['WhatsappQueueReport'][_0x9b99('0x15c')](db[_0x9b99('0x16e')],{'as':_0x9b99('0x182'),'foreignKey':_0x9b99('0x183')});db[_0x9b99('0x201')][_0x9b99('0x15c')](db[_0x9b99('0x108')],{});db[_0x9b99('0x201')][_0x9b99('0x15c')](db[_0x9b99('0x10d')],{});db[_0x9b99('0x201')]['belongsTo'](db[_0x9b99('0x10a')],{});db[_0x9b99('0x201')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x9b99('0x10a')],{});db[_0x9b99('0x10c')][_0x9b99('0x15c')](db[_0x9b99('0x108')],{});db[_0x9b99('0x10c')]['belongsTo'](db[_0x9b99('0x150')],{'foreignKey':_0x9b99('0x202'),'as':_0x9b99('0x1e8')});db[_0x9b99('0x10c')][_0x9b99('0x15c')](db[_0x9b99('0x150')],{'foreignKey':_0x9b99('0x203'),'as':'ToAccount'});db[_0x9b99('0x10c')][_0x9b99('0x15c')](db[_0x9b99('0x10d')],{'foreignKey':_0x9b99('0x204'),'as':_0x9b99('0x1ed')});db[_0x9b99('0x10c')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1f1'),'as':_0x9b99('0x1e9')});db[_0x9b99('0x10c')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'foreignKey':_0x9b99('0x1ea'),'as':'ToAgent'});db['WhatsappQueue'][_0x9b99('0x12c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x163'),'through':_0x9b99('0x145'),'foreignKey':'WhatsappQueueId'});db[_0x9b99('0x10d')]['belongsToMany'](db[_0x9b99('0xea')],{'through':'team_has_whatsapp_queues','as':_0x9b99('0x164')});db[_0x9b99('0x114')][_0x9b99('0x15c')](db[_0x9b99('0x12')],{'as':_0x9b99('0x205'),'foreignKey':'UserId','onDelete':_0x9b99('0x11a'),'hooks':!![]});db['CloudProvider'][_0x9b99('0x117')](db[_0x9b99('0xcb')],{'as':_0x9b99('0xcb'),'onDelete':_0x9b99('0x170')});db['CloudProvider'][_0x9b99('0x117')](db[_0x9b99('0x16f')],{'as':_0x9b99('0x174'),'onDelete':_0x9b99('0x170')});db[_0x9b99('0x10e')]['hasOne'](db['MailServerOut'],{'as':_0x9b99('0x175'),'onDelete':_0x9b99('0x170')});module[_0x9b99('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x57b2=['chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','UserVoicePrefix','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Teams','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','Imap','Smtp','Dispositions','Answers','List','Template','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Owner','Tags','mail_interaction_has_tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','ListId','Dashboard','FaxAccountId','Interactions','FaxInteractionId','Account','fax_interaction_has_tags','Users','AttachmentId','FaxQueue','SmsAccountId','user_has_sms_accounts','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','SmsQueue','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmContactId','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','CustomReportId','Mohs','cm_contact_has_tags','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyCondition','Fields','DefaultReportId','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowField','Dynamics365Configuration','ChatQueueReport','FromId','SessionId','ProjectId','JscriptyProject','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','name','utf8_general_ci','sequelizeHistory','defaultsDeep','127.0.0.1','mysql','utf8mb4','utf8','database','username','password','options','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','UserId','userSetting','VoiceRecording','VoiceQueuesRt','hasMany','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','CmHopper','Hoppers','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups'];(function(_0xadbca9,_0x2a30f6){var _0x1e3e1b=function(_0x4dc079){while(--_0x4dc079){_0xadbca9['push'](_0xadbca9['shift']());}};_0x1e3e1b(++_0x2a30f6);}(_0x57b2,0xda));var _0x257b=function(_0x45b4eb,_0x4536ac){_0x45b4eb=_0x45b4eb-0x0;var _0x3b9dc5=_0x57b2[_0x45b4eb];return _0x3b9dc5;};'use strict';var config=require(_0x257b('0x0'));var Sequelize=require(_0x257b('0x1'));var _=require(_0x257b('0x2'));var jstz=require(_0x257b('0x3'));var timezone=jstz[_0x257b('0x4')]();config[_0x257b('0x1')]=_['defaultsDeep'](config[_0x257b('0x1')],{'database':_0x257b('0x5'),'username':_0x257b('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x257b('0x7')](),'define':{'charset':'utf8','collate':_0x257b('0x8')}}});config[_0x257b('0x9')]=_[_0x257b('0xa')](config['sequelizeHistory'],{'database':_0x257b('0x5'),'username':_0x257b('0x6'),'password':'xC@LL1234','options':{'host':_0x257b('0xb'),'port':0xcea,'dialect':_0x257b('0xc'),'dialectOptions':{'charset':_0x257b('0xd')},'logging':![],'timezone':timezone[_0x257b('0x7')](),'define':{'charset':_0x257b('0xe'),'collate':_0x257b('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x257b('0x1')][_0x257b('0xf')],config[_0x257b('0x1')][_0x257b('0x10')],config[_0x257b('0x1')][_0x257b('0x11')],config[_0x257b('0x1')][_0x257b('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x257b('0x9')]['database'],config[_0x257b('0x9')][_0x257b('0x10')],config[_0x257b('0x9')][_0x257b('0x11')],config[_0x257b('0x9')]['options'])};db['User']=db[_0x257b('0x1')]['import'](_0x257b('0x13'));db[_0x257b('0x14')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x16'));db[_0x257b('0x17')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/voiceContext/voiceContext.model');db[_0x257b('0x18')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x257b('0x19')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x1a'));db[_0x257b('0x1b')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x1c'));db['VoiceRecording']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x1d'));db[_0x257b('0x1e')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/screenRecording/screenRecording.model');db[_0x257b('0x1f')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x20'));db[_0x257b('0x21')]=db[_0x257b('0x1')]['import'](_0x257b('0x22'));db[_0x257b('0x23')]=db['sequelize'][_0x257b('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0x257b('0x24')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x25'));db[_0x257b('0x26')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x27'));db['VoiceQueueReport']=db[_0x257b('0x1')]['import'](_0x257b('0x28'));db[_0x257b('0x29')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x2a'));db[_0x257b('0x2b')]=db['sequelize']['import'](_0x257b('0x2c'));db['VoiceTransferReport']=db['sequelize'][_0x257b('0x15')](_0x257b('0x2d'));db[_0x257b('0x2e')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x257b('0x2f')]=db['sequelize']['import'](_0x257b('0x30'));db[_0x257b('0x31')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x32'));db[_0x257b('0x33')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0x257b('0x34')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x35'));db[_0x257b('0x36')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x257b('0x37')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x38'));db[_0x257b('0x39')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0x257b('0x3a')]=db[_0x257b('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x257b('0x3b')]=db[_0x257b('0x1')]['import'](_0x257b('0x3c'));db[_0x257b('0x3d')]=db[_0x257b('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0x257b('0x3e')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x3f'));db['MailInteraction']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x40'));db[_0x257b('0x41')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x42'));db[_0x257b('0x43')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x44'));db[_0x257b('0x45')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x46'));db['Dashboard']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x47'));db[_0x257b('0x48')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x49'));db[_0x257b('0x4a')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x4b'));db[_0x257b('0x4c')]=db[_0x257b('0x1')]['import'](_0x257b('0x4d'));db[_0x257b('0x4e')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x4f'));db[_0x257b('0x50')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x51'));db[_0x257b('0x52')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x53'));db['SmsAccount']=db['sequelize']['import'](_0x257b('0x54'));db['SmsApplication']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x55'));db[_0x257b('0x56')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x57'));db[_0x257b('0x58')]=db[_0x257b('0x1')]['import'](_0x257b('0x59'));db['SmsQueue']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x5a'));db['OpenchannelAccount']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x5b'));db[_0x257b('0x5c')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x5d'));db[_0x257b('0x5e')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x257b('0x5f')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x60'));db[_0x257b('0x61')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x62'));db[_0x257b('0x63')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x64'));db[_0x257b('0x65')]=db['sequelize'][_0x257b('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x257b('0x66')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x67'));db[_0x257b('0x68')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x69'));db[_0x257b('0x6a')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x6b'));db[_0x257b('0x6c')]=db['sequelize'][_0x257b('0x15')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x6d'));db['ChatProactiveAction']=db['sequelize'][_0x257b('0x15')](_0x257b('0x6e'));db[_0x257b('0x6f')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x70'));db[_0x257b('0x71')]=db['sequelize']['import'](_0x257b('0x72'));db['CmHopper']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x73'));db[_0x257b('0x74')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x75'));db['CmHopperFinal']=db[_0x257b('0x1')]['import'](_0x257b('0x76'));db[_0x257b('0x77')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x78'));db[_0x257b('0x79')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x7a'));db[_0x257b('0x7b')]=db['sequelize'][_0x257b('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0x257b('0x7c')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x7d'));db[_0x257b('0x7e')]=db[_0x257b('0x1')]['import'](_0x257b('0x7f'));db[_0x257b('0x80')]=db[_0x257b('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x257b('0x81')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x82'));db[_0x257b('0x83')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x84'));db['Interval']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x85'));db[_0x257b('0x86')]=db['sequelize']['import']('../api/pause/pause.model');db['Cdr']=db[_0x257b('0x1')][_0x257b('0x15')]('../api/cdr/cdr.model');db[_0x257b('0x87')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x88'));db[_0x257b('0x89')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x8a'));db[_0x257b('0x8b')]=db['sequelize'][_0x257b('0x15')]('../api/sound/sound.model');db[_0x257b('0x8c')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/tag/tag.model');db[_0x257b('0x8d')]=db['sequelize']['import']('../api/contactItemType/contactItemType.model');db[_0x257b('0x8e')]=db['sequelize'][_0x257b('0x15')](_0x257b('0x8f'));db['CmHopperAdditionalPhone']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x90'));db['Template']=db[_0x257b('0x1')][_0x257b('0x15')]('../api/template/template.model');db[_0x257b('0x91')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x92'));db['Variable']=db['sequelize']['import'](_0x257b('0x93'));db['Integration']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x94'));db[_0x257b('0x95')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/integrationReport/integrationReport.model');db[_0x257b('0x96')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x97'));db[_0x257b('0x98')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x99'));db[_0x257b('0x9a')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x257b('0x9b')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x257b('0x9c')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x9d'));db[_0x257b('0x9e')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x9f'));db['SalesforceAccount']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xa0'));db[_0x257b('0xa1')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xa2'));db[_0x257b('0xa3')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x257b('0xa4')]=db[_0x257b('0x1')]['import'](_0x257b('0xa5'));db['SugarcrmConfiguration']=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db['sequelize'][_0x257b('0x15')](_0x257b('0xa6'));db[_0x257b('0xa7')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xa8'));db[_0x257b('0xa9')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xaa'));db[_0x257b('0xab')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intDeskField/intDeskField.model');db[_0x257b('0xac')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xad'));db[_0x257b('0xae')]=db[_0x257b('0x1')]['import'](_0x257b('0xaf'));db[_0x257b('0xb0')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intZohoField/intZohoField.model');db[_0x257b('0xb1')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xb2'));db[_0x257b('0xb3')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x257b('0xb4')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xb5'));db[_0x257b('0xb6')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xb7'));db[_0x257b('0xb8')]=db[_0x257b('0x1')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x257b('0xb9')]=db[_0x257b('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xba'));db[_0x257b('0xbb')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xbc'));db['ServicenowAccount']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xbd'));db[_0x257b('0xbe')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xbf'));db['ServicenowField']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xc0'));db[_0x257b('0xc1')]=db[_0x257b('0x1')]['import'](_0x257b('0xc2'));db['Dynamics365Configuration']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xc3'));db[_0x257b('0xc4')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xc5'));db[_0x257b('0xc6')]=db['sequelize']['import'](_0x257b('0xc7'));db[_0x257b('0xc8')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x257b('0xc9')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xca'));db[_0x257b('0xcb')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x94'));db[_0x257b('0xcc')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xcd'));db['ChatQueueReport']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xce'));db[_0x257b('0xcf')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xd0'));db[_0x257b('0xd1')]=db['sequelize'][_0x257b('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x257b('0xd2')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x257b('0xd3')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xd4'));db[_0x257b('0xd5')]=db[_0x257b('0x1')]['import'](_0x257b('0xd6'));db[_0x257b('0xd7')]=db['sequelize'][_0x257b('0x15')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x257b('0x1')]['import'](_0x257b('0xd8'));db['JscriptyProject']=db[_0x257b('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xd9'));db[_0x257b('0xda')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xdb'));db[_0x257b('0xdc')]=db['sequelize'][_0x257b('0x15')]('../api/squareProject/squareProject.model');db[_0x257b('0xdd')]=db[_0x257b('0x1')]['import'](_0x257b('0xde'));db[_0x257b('0xdf')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xe0'));db[_0x257b('0xe1')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/team/team.model');db['License']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xe2'));db[_0x257b('0xe3')]=db[_0x257b('0x1')]['import']('../api/campaign/campaign.model');db[_0x257b('0xe4')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xe5'));db[_0x257b('0xe6')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xe7'));db[_0x257b('0xe8')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xe9'));db['MailTransferReport']=db['sequelize'][_0x257b('0x15')](_0x257b('0xea'));db[_0x257b('0xeb')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xec'));db[_0x257b('0xed')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x257b('0xee')]=db[_0x257b('0x1')]['import'](_0x257b('0xef'));db['SmsTransferReport']=db['sequelize'][_0x257b('0x15')](_0x257b('0xf0'));db[_0x257b('0xf1')]=db[_0x257b('0x1')]['import'](_0x257b('0xf2'));db['VoicePrefix']=db[_0x257b('0x1')]['import'](_0x257b('0xf3'));db[_0x257b('0xf4')]=db[_0x257b('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x257b('0xf5')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xf6'));db[_0x257b('0xf7')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xf8'));db[_0x257b('0xf9')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xfa'));db[_0x257b('0xfb')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0xfc'));db[_0x257b('0xfd')]=db[_0x257b('0x1')][_0x257b('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x257b('0xfe')]=db['sequelize'][_0x257b('0x15')](_0x257b('0xff'));db[_0x257b('0x100')]=db[_0x257b('0x1')]['import'](_0x257b('0x101'));db[_0x257b('0x102')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x103'));db['WhatsappQueue']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x104'));db['CloudProvider']=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x105'));db[_0x257b('0x106')]=db[_0x257b('0x1')]['import'](_0x257b('0x107'));db['TeamVoicePrefix']=db[_0x257b('0x1')][_0x257b('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x257b('0x1')][_0x257b('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x257b('0x108')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x109'));db[_0x257b('0x10a')]=db[_0x257b('0x1')][_0x257b('0x15')](_0x257b('0x10b'));db[_0x257b('0x10c')][_0x257b('0x10d')](db[_0x257b('0x1f')],{'as':_0x257b('0x1f'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x10d')](db['UserSetting'],{'as':_0x257b('0x110'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')]['hasMany'](db[_0x257b('0x111')],{'as':'Recordings','foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')]['hasMany'](db[_0x257b('0x2e')],{'as':_0x257b('0x112'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db[_0x257b('0x18')],{'as':_0x257b('0x114'),'onDelete':_0x257b('0x10e'),'hooks':!![]});db['User'][_0x257b('0x113')](db[_0x257b('0x115')],{'as':_0x257b('0x116'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db[_0x257b('0x77')],{'as':_0x257b('0x117'),'foreignKey':'UserId'});db[_0x257b('0x10c')][_0x257b('0x113')](db['ReportAgentPreview'],{'as':_0x257b('0x79'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db[_0x257b('0x5e')],{'as':_0x257b('0x118'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db['ChatInteraction'],{'as':_0x257b('0x119'),'foreignKey':'UserId'});db['User'][_0x257b('0x113')](db[_0x257b('0x56')],{'as':'SmsInteractions','foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db[_0x257b('0x4e')],{'as':_0x257b('0x11a'),'foreignKey':_0x257b('0x10f')});db['User'][_0x257b('0x113')](db[_0x257b('0x11b')],{'as':_0x257b('0x11c'),'foreignKey':_0x257b('0x10f')});db['User']['hasMany'](db[_0x257b('0xfd')],{'as':_0x257b('0x11d'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x10c')][_0x257b('0x113')](db[_0x257b('0xf9')],{'as':_0x257b('0x11e'),'foreignKey':'SenderId'});db['User'][_0x257b('0x113')](db[_0x257b('0x11f')],{'as':_0x257b('0x120'),'foreignKey':_0x257b('0x10f'),'onDelete':'SET\x20NULL'});db['User'][_0x257b('0x121')](db[_0x257b('0xf4')],{'as':_0x257b('0xf4'),'foreignKey':_0x257b('0x122')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x124')],{'as':_0x257b('0x125'),'through':_0x257b('0x126')});db[_0x257b('0x10c')]['belongsToMany'](db[_0x257b('0x71')],{'as':_0x257b('0x127'),'through':_0x257b('0x128')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0xf1')],{'as':'Lists','through':_0x257b('0x129')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':_0x257b('0x12a')});db[_0x257b('0x10c')]['belongsToMany'](db[_0x257b('0x11b')],{'as':_0x257b('0x11c'),'through':_0x257b('0x12b')});db[_0x257b('0x10c')]['belongsToMany'](db[_0x257b('0x12c')],{'as':_0x257b('0x119'),'through':_0x257b('0x12d')});db['User']['belongsToMany'](db[_0x257b('0x4e')],{'as':'FaxInteractions','through':_0x257b('0x12e')});db[_0x257b('0x10c')]['belongsToMany'](db['SmsInteraction'],{'as':_0x257b('0x12f'),'through':_0x257b('0x130')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x5e')],{'as':_0x257b('0x118'),'through':'user_has_openchannel_interactions'});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0xfd')],{'as':_0x257b('0x11d'),'through':_0x257b('0x131')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x1b')],{'as':_0x257b('0x132'),'through':'UserVoiceQueue','required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x133')],{'as':_0x257b('0x134'),'through':_0x257b('0x135'),'required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x3d')],{'as':'MailQueues','through':_0x257b('0x33'),'required':![]});db[_0x257b('0x10c')]['belongsToMany'](db[_0x257b('0x6c')],{'as':_0x257b('0x136'),'through':_0x257b('0x31'),'required':![],'hooks':!![]});db[_0x257b('0x10c')][_0x257b('0x123')](db['FaxQueue'],{'as':_0x257b('0x137'),'through':_0x257b('0x34'),'required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db['SmsQueue'],{'as':_0x257b('0x138'),'through':_0x257b('0x139'),'required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x61')],{'as':_0x257b('0x13a'),'through':'UserOpenchannelQueue','required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x13b')],{'as':'WhatsappQueues','through':_0x257b('0x37'),'required':![]});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0xf1')],{'through':_0x257b('0x129')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x63')],{'as':_0x257b('0x13c'),'through':_0x257b('0x13d')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x4a')],{'as':_0x257b('0x13e'),'through':_0x257b('0x13f')});db[_0x257b('0x10c')][_0x257b('0x123')](db['MailAccount'],{'as':_0x257b('0x140'),'through':_0x257b('0x141')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':_0x257b('0x142'),'through':_0x257b('0x143')});db[_0x257b('0x10c')][_0x257b('0x123')](db[_0x257b('0x144')],{'as':_0x257b('0x145'),'through':'user_has_sms_accounts'});db[_0x257b('0x10c')]['belongsToMany'](db[_0x257b('0xfb')],{'as':_0x257b('0x146'),'through':_0x257b('0x147')});db['VoiceChanSpy'][_0x257b('0x113')](db[_0x257b('0x18')],{'as':'SpiedAgents','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x148')});db['VoiceContext'][_0x257b('0x113')](db[_0x257b('0x18')],{'onDelete':_0x257b('0x10e')});db[_0x257b('0x18')][_0x257b('0x113')](db['VoiceExtension'],{'as':_0x257b('0x149'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x19')][_0x257b('0x123')](db['Sound'],{'as':_0x257b('0x14a'),'through':_0x257b('0x14b')});db['VoiceQueue']['hasMany'](db[_0x257b('0x2e')],{'as':'Members','foreignKey':_0x257b('0x14c')});db[_0x257b('0x1b')][_0x257b('0x113')](db[_0x257b('0x11f')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x257b('0x1b')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x257b('0x1b')][_0x257b('0x113')](db[_0x257b('0x77')],{'as':_0x257b('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x257b('0x1b')][_0x257b('0x113')](db[_0x257b('0x79')],{'as':_0x257b('0x79'),'foreignKey':_0x257b('0x14c')});db[_0x257b('0x1b')]['hasMany'](db[_0x257b('0x74')],{'as':_0x257b('0x14e'),'foreignKey':_0x257b('0x14c')});db['VoiceQueue'][_0x257b('0x113')](db[_0x257b('0xd3')],{'as':_0x257b('0x14f'),'foreignKey':_0x257b('0x14c')});db[_0x257b('0x1b')][_0x257b('0x121')](db[_0x257b('0x2b')],{'as':_0x257b('0x2b'),'foreignKey':_0x257b('0x150')});db[_0x257b('0x1b')][_0x257b('0x121')](db[_0x257b('0x2b')],{'as':_0x257b('0x151'),'foreignKey':_0x257b('0x152')});db[_0x257b('0x1b')][_0x257b('0x121')](db[_0x257b('0x153')],{'as':_0x257b('0x153'),'foreignKey':_0x257b('0x154')});db['VoiceQueue'][_0x257b('0x121')](db['Pause'],{'as':_0x257b('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x257b('0x1b')][_0x257b('0x123')](db[_0x257b('0xf1')],{'as':_0x257b('0x156'),'through':_0x257b('0x157')});db[_0x257b('0x1b')]['belongsToMany'](db[_0x257b('0x10c')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x257b('0x1b')][_0x257b('0x123')](db[_0x257b('0xe1')],{'as':_0x257b('0x158'),'through':_0x257b('0x106')});db[_0x257b('0x1b')][_0x257b('0x123')](db[_0x257b('0xf1')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x257b('0x111')]['belongsTo'](db[_0x257b('0x10c')],{'as':_0x257b('0x10c'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x1e')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':'User','foreignKey':_0x257b('0x10f')});db[_0x257b('0x1f')][_0x257b('0x113')](db[_0x257b('0x21')],{'as':_0x257b('0x159'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x15a'),'sourceKey':_0x257b('0x15b')});db['VoiceMailMessage'][_0x257b('0x121')](db[_0x257b('0x1f')],{'foreignKey':_0x257b('0x15a'),'targetKey':_0x257b('0x15b')});db['VoiceCallReport'][_0x257b('0x113')](db[_0x257b('0x15c')],{'as':'QueueCalls','foreignKey':_0x257b('0x15d'),'constraints':![]});db[_0x257b('0x23')][_0x257b('0x113')](db[_0x257b('0x26')],{'as':_0x257b('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0x257b('0x23')]['belongsTo'](db[_0x257b('0x10c')],{'as':_0x257b('0x10c'),'foreignKey':_0x257b('0x10f')});db['VoiceCallReport']['belongsTo'](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160')});db[_0x257b('0x39')]['belongsTo'](db[_0x257b('0x3b')],{'as':_0x257b('0x3b'),'foreignKey':_0x257b('0x161')});db[_0x257b('0x39')][_0x257b('0x121')](db[_0x257b('0x162')],{'as':_0x257b('0x162'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x257b('0x3a')][_0x257b('0x121')](db[_0x257b('0x3b')],{'as':_0x257b('0x3b'),'foreignKey':'MailAccountId'});db[_0x257b('0x3a')][_0x257b('0x121')](db[_0x257b('0x162')],{'as':'CloudProvider','foreignKey':_0x257b('0x163'),'onDelete':'restrict'});db[_0x257b('0x3b')][_0x257b('0x10d')](db[_0x257b('0x39')],{'as':_0x257b('0x164'),'onDelete':_0x257b('0x10e')});db['MailAccount'][_0x257b('0x10d')](db['MailServerOut'],{'as':_0x257b('0x165'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x3b')][_0x257b('0x113')](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x161'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x3b')][_0x257b('0x113')](db[_0x257b('0x80')],{'as':_0x257b('0x167'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x257b('0x113')](db['MailMessage'],{'as':'Messages','foreignKey':_0x257b('0x161')});db[_0x257b('0x3b')][_0x257b('0x113')](db['MailInteraction'],{'as':'Interactions'});db[_0x257b('0x3b')][_0x257b('0x113')](db[_0x257b('0x43')],{'as':_0x257b('0x149'),'foreignKey':'MailAccountId','onDelete':_0x257b('0x10e')});db[_0x257b('0x3b')]['belongsTo'](db['CmList'],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db[_0x257b('0x3b')]['belongsTo'](db[_0x257b('0x169')],{'as':_0x257b('0x169'),'foreignKey':_0x257b('0x16a')});db[_0x257b('0x3b')][_0x257b('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x257b('0x16b')});db[_0x257b('0x3b')]['belongsToMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':'user_has_mail_accounts'});db[_0x257b('0x3d')][_0x257b('0x123')](db['User'],{'as':_0x257b('0x16c'),'through':_0x257b('0x33')});db['MailQueue']['belongsToMany'](db[_0x257b('0xe1')],{'through':_0x257b('0x16d'),'as':_0x257b('0x158')});db[_0x257b('0x11b')][_0x257b('0x113')](db[_0x257b('0x41')],{'as':_0x257b('0x159'),'onDelete':_0x257b('0x10e'),'foreignKey':'MailInteractionId'});db[_0x257b('0x11b')][_0x257b('0x121')](db['MailAccount'],{'as':'Account','foreignKey':_0x257b('0x161')});db[_0x257b('0x11b')]['belongsTo'](db['CmContact'],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160')});db[_0x257b('0x11b')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x16e'),'foreignKey':_0x257b('0x10f')});db['MailInteraction'][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'mail_interaction_has_tags','as':_0x257b('0x16f')});db[_0x257b('0x11b')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x170'),'as':_0x257b('0x171')});db[_0x257b('0x11b')][_0x257b('0x123')](db['User'],{'as':'Users','through':_0x257b('0x12b'),'foreignKey':_0x257b('0x172')});db[_0x257b('0x41')][_0x257b('0x113')](db[_0x257b('0xe6')],{'as':_0x257b('0x173'),'onDelete':_0x257b('0x10e')});db['MailMessage'][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x10c')});db[_0x257b('0x41')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':'Contact'});db[_0x257b('0x41')]['belongsTo'](db[_0x257b('0x11b')],{'as':_0x257b('0x174'),'foreignKey':_0x257b('0x172')});db['MailMessage'][_0x257b('0x121')](db[_0x257b('0x3b')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x257b('0x41')][_0x257b('0x121')](db['ChatWebsite'],{'as':_0x257b('0x63'),'foreignKey':_0x257b('0x175')});db[_0x257b('0x41')][_0x257b('0x121')](db['ChatOfflineMessage'],{'as':_0x257b('0x6a'),'foreignKey':_0x257b('0x176')});db[_0x257b('0x43')]['belongsTo'](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x177')});db[_0x257b('0x43')][_0x257b('0x121')](db[_0x257b('0x3d')],{'onDelete':_0x257b('0x177')});db[_0x257b('0x43')][_0x257b('0x121')](db[_0x257b('0x3b')],{'onDelete':_0x257b('0x177')});db['MailApplication'][_0x257b('0x121')](db[_0x257b('0x153')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x257b('0x43')][_0x257b('0x121')](db['Tag'],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x178')});db['MailQueueReport'][_0x257b('0x121')](db[_0x257b('0x3b')],{});db[_0x257b('0x45')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':'List','foreignKey':_0x257b('0x179')});db[_0x257b('0x45')][_0x257b('0x121')](db['CmContact'],{'as':_0x257b('0x15f'),'foreignKey':'ContactId'});db[_0x257b('0x45')]['belongsTo'](db[_0x257b('0x11b')],{});db[_0x257b('0x45')][_0x257b('0x121')](db[_0x257b('0x41')],{});db[_0x257b('0x45')]['belongsTo'](db[_0x257b('0x10c')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x257b('0x17a')][_0x257b('0x113')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0x257b('0x4a')][_0x257b('0x113')](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x17b'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x4a')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x257b('0x17b')});db[_0x257b('0x4a')][_0x257b('0x113')](db[_0x257b('0x4e')],{'as':_0x257b('0x17c')});db[_0x257b('0x4a')][_0x257b('0x113')](db[_0x257b('0x4c')],{'as':_0x257b('0x149'),'foreignKey':_0x257b('0x17b'),'onDelete':_0x257b('0x10e')});db['FaxAccount'][_0x257b('0x113')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x257b('0x10e')});db[_0x257b('0x4a')][_0x257b('0x113')](db[_0x257b('0x50')],{'as':'Messages'});db[_0x257b('0x4a')][_0x257b('0x121')](db[_0x257b('0x2b')],{'as':_0x257b('0x2b')});db[_0x257b('0x4a')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':'List','foreignKey':_0x257b('0x179')});db[_0x257b('0x4a')][_0x257b('0x121')](db[_0x257b('0x86')],{'as':_0x257b('0x155'),'foreignKey':_0x257b('0x16b')});db[_0x257b('0x4a')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':'Agents','through':_0x257b('0x13f')});db[_0x257b('0x4c')]['belongsTo'](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x177')});db[_0x257b('0x4c')][_0x257b('0x121')](db['FaxQueue'],{'onDelete':_0x257b('0x177')});db[_0x257b('0x4c')][_0x257b('0x121')](db[_0x257b('0x4a')],{'onDelete':_0x257b('0x177')});db['FaxApplication'][_0x257b('0x121')](db[_0x257b('0x8c')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x178')});db[_0x257b('0x4e')][_0x257b('0x113')](db[_0x257b('0x50')],{'as':_0x257b('0x159'),'onDelete':'cascade','foreignKey':_0x257b('0x17d')});db[_0x257b('0x4e')][_0x257b('0x121')](db[_0x257b('0x4a')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x17b')});db[_0x257b('0x4e')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':'ContactId'});db[_0x257b('0x4e')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':'Owner','foreignKey':_0x257b('0x10f')});db[_0x257b('0x4e')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x17f'),'as':'Tags'});db[_0x257b('0x4e')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'fax_interaction_has_tags','as':_0x257b('0x171')});db[_0x257b('0x4e')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'through':'user_has_fax_interactions','foreignKey':_0x257b('0x17d')});db[_0x257b('0x50')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x10c')});db[_0x257b('0x50')][_0x257b('0x121')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x257b('0x17d')});db[_0x257b('0x50')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x15f')});db['FaxMessage'][_0x257b('0x121')](db['Attachment'],{'as':_0x257b('0xe6'),'foreignKey':_0x257b('0x181')});db[_0x257b('0x50')][_0x257b('0x121')](db[_0x257b('0x4a')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x34')});db[_0x257b('0x182')][_0x257b('0x123')](db['Team'],{'through':'team_has_fax_queues','as':_0x257b('0x158')});db[_0x257b('0x52')][_0x257b('0x121')](db[_0x257b('0x4a')],{});db[_0x257b('0x52')][_0x257b('0x121')](db['CmList'],{'as':_0x257b('0x168'),'foreignKey':_0x257b('0x179')});db['FaxQueueReport'][_0x257b('0x121')](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':'ContactId'});db[_0x257b('0x52')][_0x257b('0x121')](db[_0x257b('0x4e')],{});db[_0x257b('0x52')]['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0x257b('0x121')](db['User'],{});db[_0x257b('0x52')][_0x257b('0x121')](db['FaxQueue'],{});db['SmsAccount'][_0x257b('0x113')](db[_0x257b('0x81')],{'as':'Dispositions','foreignKey':_0x257b('0x183'),'onDelete':'cascade'});db['SmsAccount'][_0x257b('0x113')](db['CannedAnswer'],{'as':_0x257b('0x167'),'foreignKey':'SmsAccountId'});db[_0x257b('0x144')][_0x257b('0x113')](db[_0x257b('0x58')],{'as':_0x257b('0x159'),'foreignKey':_0x257b('0x183')});db[_0x257b('0x144')][_0x257b('0x113')](db['SmsInteraction'],{'as':_0x257b('0x17c')});db[_0x257b('0x144')][_0x257b('0x113')](db['SmsApplication'],{'as':_0x257b('0x149'),'foreignKey':_0x257b('0x183'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x144')][_0x257b('0x121')](db['CmList'],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db['SmsAccount'][_0x257b('0x121')](db['Pause'],{'as':_0x257b('0x155'),'foreignKey':_0x257b('0x16b')});db[_0x257b('0x144')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x184')});db[_0x257b('0x185')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x177')});db['SmsApplication'][_0x257b('0x121')](db['SmsQueue'],{'onDelete':_0x257b('0x177')});db[_0x257b('0x185')][_0x257b('0x121')](db[_0x257b('0x144')],{'onDelete':'restrict'});db[_0x257b('0x185')][_0x257b('0x121')](db['Interval'],{'onDelete':_0x257b('0x177'),'foreignKey':'IntervalId'});db[_0x257b('0x185')][_0x257b('0x121')](db[_0x257b('0x8c')],{'onDelete':'restrict','foreignKey':_0x257b('0x178')});db[_0x257b('0x56')][_0x257b('0x113')](db[_0x257b('0x58')],{'as':'Messages','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x186')});db['SmsInteraction']['belongsTo'](db[_0x257b('0x144')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x183')});db[_0x257b('0x56')]['belongsTo'](db[_0x257b('0x71')],{'as':'Contact','foreignKey':_0x257b('0x160')});db[_0x257b('0x56')][_0x257b('0x121')](db['User'],{'as':_0x257b('0x16e'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x56')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x187'),'as':'Tags'});db[_0x257b('0x56')]['belongsToMany'](db['Tag'],{'through':_0x257b('0x187'),'as':_0x257b('0x171')});db[_0x257b('0x56')][_0x257b('0x123')](db['User'],{'as':_0x257b('0x180'),'through':_0x257b('0x130'),'foreignKey':_0x257b('0x186')});db[_0x257b('0x58')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x10c')});db[_0x257b('0x58')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x15f')});db[_0x257b('0x58')][_0x257b('0x121')](db[_0x257b('0x56')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x174'),'foreignKey':_0x257b('0x186')});db[_0x257b('0x58')][_0x257b('0x121')](db[_0x257b('0x144')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x183')});db['SmsQueue']['belongsToMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x139'),'foreignKey':_0x257b('0x188')});db[_0x257b('0x189')][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':_0x257b('0x18a'),'as':_0x257b('0x158')});db[_0x257b('0x18b')]['hasMany'](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x18c'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x18b')][_0x257b('0x113')](db[_0x257b('0x80')],{'as':_0x257b('0x167'),'foreignKey':_0x257b('0x18c')});db[_0x257b('0x18b')][_0x257b('0x113')](db['OpenchannelInteraction'],{'as':_0x257b('0x17c'),'foreignKey':_0x257b('0x18c')});db[_0x257b('0x18b')][_0x257b('0x113')](db['OpenchannelMessage'],{'as':_0x257b('0x159'),'foreignKey':_0x257b('0x18c')});db['OpenchannelAccount'][_0x257b('0x113')](db['OpenchannelApplication'],{'as':_0x257b('0x149'),'foreignKey':_0x257b('0x18c'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x18b')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db[_0x257b('0x18b')][_0x257b('0x121')](db[_0x257b('0x86')],{'as':_0x257b('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x143')});db[_0x257b('0x5c')][_0x257b('0x121')](db['User'],{'onDelete':'restrict'});db[_0x257b('0x5c')][_0x257b('0x121')](db[_0x257b('0x61')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x18d')});db[_0x257b('0x5c')][_0x257b('0x121')](db['OpenchannelAccount'],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x18c')});db[_0x257b('0x5c')][_0x257b('0x121')](db[_0x257b('0x153')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x154')});db[_0x257b('0x5c')]['belongsTo'](db[_0x257b('0x8c')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x178')});db[_0x257b('0x5e')]['hasMany'](db[_0x257b('0x5f')],{'as':_0x257b('0x159'),'onDelete':'cascade','foreignKey':_0x257b('0x18e')});db['OpenchannelInteraction'][_0x257b('0x121')](db[_0x257b('0x18b')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x18c')});db[_0x257b('0x5e')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':'Contact','foreignKey':_0x257b('0x160')});db['OpenchannelInteraction']['belongsTo'](db[_0x257b('0x10c')],{'as':_0x257b('0x16e'),'foreignKey':_0x257b('0x10f')});db[_0x257b('0x5e')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x257b('0x5e')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0x257b('0x171')});db[_0x257b('0x5e')]['belongsToMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'through':_0x257b('0x18f'),'foreignKey':'OpenchannelInteractionId'});db[_0x257b('0x5f')]['belongsTo'](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x10e'),'as':'User'});db[_0x257b('0x5f')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x15f')});db[_0x257b('0x5f')][_0x257b('0x121')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x257b('0x174'),'foreignKey':_0x257b('0x18e')});db['OpenchannelMessage'][_0x257b('0x121')](db[_0x257b('0xe6')],{'as':_0x257b('0xe6'),'foreignKey':_0x257b('0x181')});db[_0x257b('0x5f')][_0x257b('0x121')](db['OpenchannelAccount'],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x18c')});db[_0x257b('0x61')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':'Agents','through':_0x257b('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0x257b('0x61')][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':_0x257b('0x190'),'as':'Teams'});db[_0x257b('0x63')]['hasMany'](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x175'),'onDelete':_0x257b('0x10e')});db['ChatWebsite'][_0x257b('0x113')](db[_0x257b('0x80')],{'as':_0x257b('0x167'),'foreignKey':_0x257b('0x175')});db[_0x257b('0x63')]['hasMany'](db[_0x257b('0x191')],{'as':_0x257b('0x192')});db['ChatWebsite'][_0x257b('0x113')](db[_0x257b('0x12c')],{'as':_0x257b('0x17c')});db[_0x257b('0x63')]['hasMany'](db['ChatApplication'],{'as':_0x257b('0x149'),'foreignKey':_0x257b('0x175'),'onDelete':'cascade'});db[_0x257b('0x63')][_0x257b('0x113')](db[_0x257b('0x68')],{'as':_0x257b('0x159')});db[_0x257b('0x63')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db['ChatWebsite'][_0x257b('0x121')](db[_0x257b('0x153')],{'as':_0x257b('0x153'),'foreignKey':'IntervalId'});db[_0x257b('0x63')][_0x257b('0x121')](db[_0x257b('0x3b')],{'as':_0x257b('0x3b'),'foreignKey':'MailAccountId'});db[_0x257b('0x63')]['belongsTo'](db[_0x257b('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x257b('0x16b')});db[_0x257b('0x63')][_0x257b('0x123')](db['User'],{'as':_0x257b('0x16c'),'through':_0x257b('0x13d')});db['OpenchannelQueueReport'][_0x257b('0x121')](db[_0x257b('0x18b')],{});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160')});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0x5e')],{});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0x5f')],{});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0x10c')],{});db[_0x257b('0x65')][_0x257b('0x121')](db[_0x257b('0x61')],{});db[_0x257b('0x66')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x193'),'foreignKey':'UserId','onDelete':_0x257b('0x177')});db[_0x257b('0x66')]['belongsTo'](db[_0x257b('0x6c')],{'as':_0x257b('0x194'),'foreignKey':_0x257b('0x195'),'onDelete':_0x257b('0x177')});db[_0x257b('0x66')][_0x257b('0x121')](db[_0x257b('0x63')],{'as':_0x257b('0x196'),'foreignKey':_0x257b('0x175'),'onDelete':_0x257b('0x177')});db['ChatApplication'][_0x257b('0x121')](db[_0x257b('0x8c')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x178')});db[_0x257b('0x12c')][_0x257b('0x113')](db['ChatMessage'],{'as':_0x257b('0x159'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x197')});db[_0x257b('0x12c')][_0x257b('0x121')](db[_0x257b('0x63')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x175')});db[_0x257b('0x12c')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':'Contact','foreignKey':_0x257b('0x160')});db[_0x257b('0x12c')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x16e'),'foreignKey':'UserId'});db[_0x257b('0x12c')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x198'),'as':'Tags'});db[_0x257b('0x12c')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'chat_interaction_has_tags','as':_0x257b('0x171')});db[_0x257b('0x12c')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'through':_0x257b('0x12d'),'foreignKey':_0x257b('0x197')});db[_0x257b('0x68')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x10c')});db[_0x257b('0x68')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160')});db['ChatMessage'][_0x257b('0x121')](db['ChatInteraction'],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x174'),'foreignKey':_0x257b('0x197')});db[_0x257b('0x68')][_0x257b('0x121')](db['Attachment'],{'as':'Attachment','foreignKey':_0x257b('0x181')});db[_0x257b('0x68')][_0x257b('0x121')](db[_0x257b('0x63')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x175')});db[_0x257b('0x6a')]['hasMany'](db['Attachment'],{'as':_0x257b('0x173'),'foreignKey':_0x257b('0x176'),'onDelete':_0x257b('0x10e'),'hooks':!![]});db[_0x257b('0x6a')]['belongsTo'](db[_0x257b('0x71')],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x15f'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x257b('0x121')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x257b('0x6c')]['belongsToMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x31'),'hooks':!![]});db['ChatQueue'][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':'team_has_chat_queues','as':_0x257b('0x158')});db[_0x257b('0x124')][_0x257b('0x113')](db[_0x257b('0xcf')],{'as':_0x257b('0x159'),'foreignKey':_0x257b('0x199'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x124')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':'Members','through':_0x257b('0x126')});db[_0x257b('0x191')][_0x257b('0x121')](db[_0x257b('0x63')],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x257b('0x127'),'foreignKey':_0x257b('0x19a')});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x8e')],{'as':'Phones','foreignKey':_0x257b('0x19b')});db[_0x257b('0x71')]['hasMany'](db[_0x257b('0x11f')],{'as':_0x257b('0x120'),'foreignKey':'ContactId'});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x115')],{'as':_0x257b('0x116'),'foreignKey':'ContactId'});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x77')],{'as':_0x257b('0x14d'),'foreignKey':'ContactId'});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x79')],{'as':_0x257b('0x79'),'foreignKey':'ContactId'});db['CmContact'][_0x257b('0x113')](db[_0x257b('0xd3')],{'as':'JscriptySessions','foreignKey':_0x257b('0x160')});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x257b('0x160'),'onDelete':_0x257b('0x177')});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x12c')],{'as':_0x257b('0x119'),'foreignKey':_0x257b('0x160'),'onDelete':'restrict'});db[_0x257b('0x71')]['hasMany'](db[_0x257b('0x56')],{'as':_0x257b('0x12f'),'foreignKey':_0x257b('0x160'),'onDelete':_0x257b('0x177')});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x4e')],{'as':_0x257b('0x11a'),'foreignKey':'ContactId','onDelete':_0x257b('0x177')});db[_0x257b('0x71')][_0x257b('0x113')](db[_0x257b('0x11b')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x257b('0x177')});db[_0x257b('0x71')][_0x257b('0x121')](db[_0x257b('0x6f')],{'as':'Company','foreignKey':_0x257b('0x19a')});db[_0x257b('0x71')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':'List','foreignKey':'ListId','onDelete':_0x257b('0x10e')});db[_0x257b('0x71')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'through':'cm_user_has_contacts'});db[_0x257b('0x71')][_0x257b('0x123')](db[_0x257b('0x8c')],{'as':_0x257b('0x16f'),'through':'cm_contact_has_tags'});db['CmContact'][_0x257b('0x123')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x257b('0x171')});db['CmHopper'][_0x257b('0x113')](db[_0x257b('0x19c')],{'as':_0x257b('0x19d'),'foreignKey':_0x257b('0x19e')});db[_0x257b('0x11f')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x11f')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':'ListId','onDelete':_0x257b('0x10e')});db[_0x257b('0x11f')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':'Agent','foreignKey':_0x257b('0x10f')});db[_0x257b('0x11f')]['belongsTo'](db[_0x257b('0x1b')],{'as':'Queue','foreignKey':_0x257b('0x14c'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x11f')]['belongsTo'](db[_0x257b('0xe3')],{'as':_0x257b('0xe3'),'foreignKey':_0x257b('0x19f'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x11f')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x16e'),'foreignKey':_0x257b('0x1a0')});db[_0x257b('0x74')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':'Contact','foreignKey':_0x257b('0x160'),'onDelete':_0x257b('0x10e')});db[_0x257b('0x74')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':_0x257b('0x179'),'onDelete':'cascade'});db[_0x257b('0x74')][_0x257b('0x121')](db[_0x257b('0x1b')],{'as':_0x257b('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopperBlack'][_0x257b('0x121')](db['Campaign'],{'as':_0x257b('0xe3'),'foreignKey':'CampaignId','onDelete':_0x257b('0x10e')});db[_0x257b('0x7e')][_0x257b('0x113')](db[_0x257b('0x83')],{'as':{'plural':_0x257b('0x1a1'),'singular':_0x257b('0x1a2')},'foreignKey':_0x257b('0x1a3'),'onDelete':_0x257b('0x10e'),'hooks':!![]});db[_0x257b('0x7e')]['hasMany'](db[_0x257b('0x83')],{'as':{'plural':_0x257b('0x1a4'),'singular':'OneAny'},'foreignKey':_0x257b('0x1a5'),'onDelete':_0x257b('0x10e'),'hooks':!![]});db[_0x257b('0x7e')][_0x257b('0x113')](db[_0x257b('0x7c')],{'as':_0x257b('0x1a6'),'foreignKey':_0x257b('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x257b('0x81')][_0x257b('0x113')](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x1a8'),'onDelete':'cascade'});db['Interval'][_0x257b('0x113')](db['Interval'],{'as':_0x257b('0x1a9'),'foreignKey':_0x257b('0x154'),'onDelete':_0x257b('0x10e'),'hooks':!![],'required':![]});db[_0x257b('0x153')][_0x257b('0x113')](db[_0x257b('0x18')],{'as':_0x257b('0x114'),'foreignKey':'IntervalId','onDelete':_0x257b('0x177')});db[_0x257b('0x153')]['hasMany'](db[_0x257b('0x43')],{'as':'MailApplications','foreignKey':_0x257b('0x154')});db[_0x257b('0x153')][_0x257b('0x113')](db[_0x257b('0x66')],{'as':_0x257b('0x1aa'),'foreignKey':_0x257b('0x154')});db[_0x257b('0x153')][_0x257b('0x113')](db[_0x257b('0x4c')],{'as':'FaxApplications','foreignKey':_0x257b('0x154')});db[_0x257b('0x153')][_0x257b('0x113')](db[_0x257b('0x185')],{'as':_0x257b('0x1ab'),'foreignKey':_0x257b('0x154')});db['Schedule'][_0x257b('0x121')](db[_0x257b('0x3b')],{});db[_0x257b('0x89')][_0x257b('0x121')](db[_0x257b('0x98')],{'foreignKey':'DefaultReportId'});db[_0x257b('0x89')][_0x257b('0x121')](db[_0x257b('0x96')],{'foreignKey':_0x257b('0x1ac')});db[_0x257b('0x8b')]['belongsToMany'](db[_0x257b('0x19')],{'as':_0x257b('0x1ad'),'through':_0x257b('0x14b'),'onDelete':_0x257b('0x177')});db[_0x257b('0x8c')]['belongsToMany'](db[_0x257b('0x71')],{'through':_0x257b('0x1ae')});db[_0x257b('0x8c')][_0x257b('0x123')](db[_0x257b('0x12c')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x257b('0x123')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x257b('0x8c')][_0x257b('0x123')](db['SmsInteraction'],{'through':_0x257b('0x187')});db[_0x257b('0x8c')][_0x257b('0x123')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x257b('0x5e')],{'through':_0x257b('0x1af')});db[_0x257b('0x8c')][_0x257b('0x123')](db['WhatsappInteraction'],{'through':_0x257b('0x1b0')});db[_0x257b('0x8e')][_0x257b('0x121')](db[_0x257b('0x8d')],{'as':_0x257b('0x1b1'),'foreignKey':_0x257b('0x1b2')});db[_0x257b('0x19c')]['belongsTo'](db['CmHopper'],{'as':_0x257b('0x1b3'),'foreignKey':'CmHopperId'});db['CmContactHasItem']['belongsTo'](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x19b')});db[_0x257b('0x91')][_0x257b('0x113')](db[_0x257b('0x83')],{'as':{'plural':_0x257b('0x1b4'),'singular':'AllCondition'},'foreignKey':_0x257b('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0x257b('0x91')][_0x257b('0x113')](db[_0x257b('0x83')],{'as':{'plural':'AnyConditions','singular':_0x257b('0x1b6')},'foreignKey':'TriggerAnyId','onDelete':_0x257b('0x10e'),'hooks':!![]});db[_0x257b('0x91')][_0x257b('0x113')](db['Action'],{'as':_0x257b('0x1a6'),'foreignKey':'TriggerId','onDelete':_0x257b('0x10e'),'hooks':!![]});db[_0x257b('0x96')][_0x257b('0x113')](db['AnalyticFieldReport'],{'as':_0x257b('0x1b7'),'onDelete':'cascade','foreignKey':_0x257b('0x1ac'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x257b('0x1b7'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1b8')});db[_0x257b('0x9b')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x257b('0x1b7'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1b9')});db['AnalyticFieldReport'][_0x257b('0x121')](db[_0x257b('0x9b')],{'foreignKey':_0x257b('0x1b9')});db[_0x257b('0x1ba')][_0x257b('0x113')](db[_0x257b('0xa1')],{'as':_0x257b('0x1bb'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xa1')]['hasMany'](db[_0x257b('0xa3')],{'as':_0x257b('0x1bd'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xa1')][_0x257b('0x113')](db[_0x257b('0xa3')],{'as':_0x257b('0x1bf'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0xa1')][_0x257b('0x113')](db['SalesforceField'],{'as':'Fields','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c1')});db['SalesforceConfiguration']['belongsTo'](db[_0x257b('0x1ba')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xa3')][_0x257b('0x113')](db[_0x257b('0xa3')],{'as':_0x257b('0x1c2'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xa3')][_0x257b('0x113')](db['SalesforceField'],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0xa3')]['hasMany'](db[_0x257b('0xa3')],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db['SalesforceField']['belongsTo'](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db[_0x257b('0xa4')][_0x257b('0x113')](db[_0x257b('0x1c7')],{'as':_0x257b('0x1bb'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0x1c7')]['hasMany'](db[_0x257b('0x1c8')],{'as':_0x257b('0x1bd'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0x1c7')][_0x257b('0x113')](db[_0x257b('0x1c8')],{'as':'Descriptions','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c0')});db['SugarcrmConfiguration']['hasMany'](db[_0x257b('0x1c8')],{'as':_0x257b('0x1b7'),'onDelete':_0x257b('0x10e'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x257b('0x121')](db['SugarcrmAccount'],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0x1c8')][_0x257b('0x113')](db['SugarcrmField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x257b('0x1c8')][_0x257b('0x113')](db[_0x257b('0x1c8')],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0x1c8')][_0x257b('0x113')](db[_0x257b('0x1c8')],{'as':_0x257b('0x1c4'),'foreignKey':'FieldId'});db[_0x257b('0x1c8')][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db['DeskAccount'][_0x257b('0x113')](db[_0x257b('0xa9')],{'as':'Configurations','onDelete':_0x257b('0x10e'),'foreignKey':'AccountId'});db[_0x257b('0xa9')][_0x257b('0x113')](db[_0x257b('0xab')],{'as':_0x257b('0x1bd'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xa9')][_0x257b('0x113')](db[_0x257b('0xab')],{'as':_0x257b('0x1bf'),'onDelete':_0x257b('0x10e'),'foreignKey':'DescriptionId'});db[_0x257b('0xa9')][_0x257b('0x113')](db[_0x257b('0xab')],{'as':_0x257b('0x1b7'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0xa9')][_0x257b('0x121')](db[_0x257b('0xa7')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xa9')]['belongsToMany'](db[_0x257b('0x8c')],{'through':_0x257b('0x1c9')});db[_0x257b('0xab')]['hasMany'](db[_0x257b('0xab')],{'as':'Subject','foreignKey':_0x257b('0x1be')});db[_0x257b('0xab')]['hasMany'](db[_0x257b('0xab')],{'as':'Description','foreignKey':_0x257b('0x1c0')});db['DeskField']['hasMany'](db[_0x257b('0xab')],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db['DeskField'][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':'VariableId'});db['ZohoAccount']['hasMany'](db[_0x257b('0xae')],{'as':_0x257b('0x1bb'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xae')][_0x257b('0x113')](db[_0x257b('0xb0')],{'as':_0x257b('0x1bd'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xae')][_0x257b('0x113')](db['ZohoField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x257b('0x1c0')});db[_0x257b('0xae')][_0x257b('0x113')](db[_0x257b('0xb0')],{'as':'Fields','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0xae')][_0x257b('0x121')](db[_0x257b('0xac')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xb0')][_0x257b('0x113')](db[_0x257b('0xb0')],{'as':_0x257b('0x1c2'),'foreignKey':_0x257b('0x1be')});db['ZohoField'][_0x257b('0x113')](db[_0x257b('0xb0')],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':_0x257b('0x1c1')});db[_0x257b('0xb0')][_0x257b('0x121')](db['Variable'],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db['ZendeskAccount'][_0x257b('0x113')](db[_0x257b('0x1ca')],{'as':_0x257b('0x1bb'),'onDelete':'cascade','foreignKey':_0x257b('0x1bc')});db[_0x257b('0x1ca')][_0x257b('0x113')](db[_0x257b('0xb3')],{'as':'Subjects','foreignKey':_0x257b('0x1be')});db[_0x257b('0x1ca')][_0x257b('0x113')](db['ZendeskField'],{'as':_0x257b('0x1bf'),'foreignKey':'DescriptionId'});db[_0x257b('0x1ca')][_0x257b('0x113')](db['ZendeskField'],{'as':_0x257b('0x1b7'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0x1ca')][_0x257b('0x121')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x257b('0x1bc')});db[_0x257b('0x1ca')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x1cb')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x257b('0x1c2'),'foreignKey':'SubjectId'});db[_0x257b('0xb3')][_0x257b('0x113')](db[_0x257b('0xb3')],{'as':_0x257b('0x1c3'),'foreignKey':'DescriptionId'});db[_0x257b('0xb3')][_0x257b('0x113')](db['ZendeskField'],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0xb3')][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':'VariableId'});db[_0x257b('0xb4')]['hasMany'](db[_0x257b('0xb6')],{'as':_0x257b('0x1bb'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration']['hasMany'](db[_0x257b('0xb8')],{'as':'Subjects','onDelete':_0x257b('0x10e'),'foreignKey':'SubjectId'});db[_0x257b('0xb6')]['hasMany'](db[_0x257b('0xb8')],{'as':_0x257b('0x1bf'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c0')});db['FreshdeskConfiguration'][_0x257b('0x113')](db[_0x257b('0xb8')],{'as':_0x257b('0x1b7'),'onDelete':'cascade','foreignKey':_0x257b('0x1c1')});db[_0x257b('0xb6')][_0x257b('0x121')](db[_0x257b('0xb4')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xb6')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x257b('0xb8')]['hasMany'](db['FreshdeskField'],{'as':_0x257b('0x1c2'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xb8')][_0x257b('0x113')](db[_0x257b('0xb8')],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0xb8')][_0x257b('0x113')](db[_0x257b('0xb8')],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0xb8')]['belongsTo'](db['Variable'],{'as':_0x257b('0x1c5'),'foreignKey':'VariableId'});db[_0x257b('0xb9')]['hasMany'](db[_0x257b('0x1cc')],{'as':'Configurations','onDelete':_0x257b('0x10e'),'foreignKey':'AccountId'});db[_0x257b('0x1cc')][_0x257b('0x113')](db['VtigerField'],{'as':_0x257b('0x1bd'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0x1cc')][_0x257b('0x113')](db[_0x257b('0xbb')],{'as':_0x257b('0x1bf'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0x1cc')][_0x257b('0x113')](db[_0x257b('0xbb')],{'as':_0x257b('0x1b7'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0x1cc')][_0x257b('0x121')](db[_0x257b('0xb9')],{'as':'Account','foreignKey':_0x257b('0x1bc')});db['VtigerField'][_0x257b('0x113')](db[_0x257b('0xbb')],{'as':_0x257b('0x1c2'),'foreignKey':'SubjectId'});db[_0x257b('0xbb')][_0x257b('0x113')](db[_0x257b('0xbb')],{'as':_0x257b('0x1c3'),'foreignKey':'DescriptionId'});db[_0x257b('0xbb')]['hasMany'](db[_0x257b('0xbb')],{'as':'Field','foreignKey':_0x257b('0x1c1')});db[_0x257b('0xbb')][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db[_0x257b('0x1cd')][_0x257b('0x113')](db[_0x257b('0xbe')],{'as':_0x257b('0x1bb'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xbe')]['hasMany'](db['ServicenowField'],{'as':_0x257b('0x1bd'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xbe')][_0x257b('0x113')](db[_0x257b('0x1ce')],{'as':_0x257b('0x1bf'),'foreignKey':_0x257b('0x1c0')});db['ServicenowConfiguration']['hasMany'](db[_0x257b('0x1ce')],{'as':'Fields','foreignKey':'FieldId'});db[_0x257b('0xbe')][_0x257b('0x121')](db[_0x257b('0x1cd')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0x1ce')][_0x257b('0x113')](db[_0x257b('0x1ce')],{'as':'Subject','foreignKey':_0x257b('0x1be')});db['ServicenowField'][_0x257b('0x113')](db[_0x257b('0x1ce')],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0x1ce')][_0x257b('0x113')](db[_0x257b('0x1ce')],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0x1ce')][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':'VariableId'});db[_0x257b('0xc1')]['hasMany'](db[_0x257b('0x1cf')],{'as':'Configurations','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1bc')});db['Dynamics365Account'][_0x257b('0x121')](db['CloudProvider'],{'as':_0x257b('0x162'),'foreignKey':_0x257b('0x163')});db[_0x257b('0x1cf')][_0x257b('0x113')](db[_0x257b('0xc4')],{'as':_0x257b('0x1bd'),'onDelete':'cascade','foreignKey':_0x257b('0x1be')});db['Dynamics365Configuration'][_0x257b('0x113')](db[_0x257b('0xc4')],{'as':'Descriptions','onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0x1cf')]['hasMany'](db[_0x257b('0xc4')],{'as':_0x257b('0x1b7'),'onDelete':'cascade','foreignKey':_0x257b('0x1c1')});db['Dynamics365Configuration']['belongsTo'](db[_0x257b('0xc1')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1bc')});db[_0x257b('0xc4')][_0x257b('0x113')](db[_0x257b('0xc4')],{'as':'Subject','foreignKey':_0x257b('0x1be')});db[_0x257b('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0xc4')]['hasMany'](db[_0x257b('0xc4')],{'as':_0x257b('0x1c4'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db[_0x257b('0xc6')][_0x257b('0x113')](db[_0x257b('0xc8')],{'as':_0x257b('0x1bb'),'onDelete':'cascade','foreignKey':_0x257b('0x1bc')});db['FreshsalesConfiguration'][_0x257b('0x113')](db['FreshsalesField'],{'as':_0x257b('0x1bd'),'foreignKey':'SubjectId'});db[_0x257b('0xc8')][_0x257b('0x113')](db['FreshsalesField'],{'as':_0x257b('0x1bf'),'foreignKey':_0x257b('0x1c0')});db['FreshsalesConfiguration']['hasMany'](db[_0x257b('0xc9')],{'as':_0x257b('0x1b7'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x257b('0x121')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x257b('0x1bc')});db[_0x257b('0xc9')][_0x257b('0x113')](db[_0x257b('0xc9')],{'as':_0x257b('0x1c2'),'foreignKey':_0x257b('0x1be')});db[_0x257b('0xc9')][_0x257b('0x113')](db[_0x257b('0xc9')],{'as':_0x257b('0x1c3'),'foreignKey':_0x257b('0x1c0')});db[_0x257b('0xc9')][_0x257b('0x113')](db['FreshsalesField'],{'as':_0x257b('0x1c4'),'foreignKey':_0x257b('0x1c1')});db[_0x257b('0xc9')][_0x257b('0x121')](db[_0x257b('0x1c5')],{'as':_0x257b('0x1c5'),'foreignKey':_0x257b('0x1c6')});db['ChatQueueReport'][_0x257b('0x121')](db['ChatWebsite'],{});db[_0x257b('0x1d0')][_0x257b('0x121')](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':'ListId'});db[_0x257b('0x1d0')][_0x257b('0x121')](db[_0x257b('0x71')],{'as':_0x257b('0x15f'),'foreignKey':_0x257b('0x160')});db[_0x257b('0x1d0')][_0x257b('0x121')](db[_0x257b('0x12c')],{});db['ChatQueueReport']['belongsTo'](db[_0x257b('0x68')],{});db[_0x257b('0x1d0')]['belongsTo'](db[_0x257b('0x10c')],{});db['ChatQueueReport'][_0x257b('0x121')](db[_0x257b('0x6c')],{});db[_0x257b('0xcf')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1d1')});db[_0x257b('0xcf')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':_0x257b('0x10e'),'foreignKey':'ToId'});db[_0x257b('0xd3')][_0x257b('0x113')](db[_0x257b('0xd2')],{'foreignKey':_0x257b('0x1d2'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xd3')][_0x257b('0x113')](db[_0x257b('0xd1')],{'foreignKey':_0x257b('0x1d2'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xd5')][_0x257b('0x121')](db[_0x257b('0x144')],{});db['SmsQueueReport'][_0x257b('0x121')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0x257b('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x257b('0x160')});db[_0x257b('0xd5')]['belongsTo'](db['SmsInteraction'],{});db['SmsQueueReport']['belongsTo'](db[_0x257b('0x58')],{});db['SmsQueueReport'][_0x257b('0x121')](db[_0x257b('0x10c')],{});db[_0x257b('0xd5')][_0x257b('0x121')](db[_0x257b('0x189')],{});db['JscriptyProject'][_0x257b('0x113')](db[_0x257b('0xd3')],{'foreignKey':_0x257b('0x1d3')});db['JscriptyProject']['hasMany'](db[_0x257b('0xd2')],{'foreignKey':_0x257b('0x1d3')});db[_0x257b('0x1d4')][_0x257b('0x113')](db[_0x257b('0xd1')],{'foreignKey':_0x257b('0x1d3')});db['Team'][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x12a')});db[_0x257b('0xe1')][_0x257b('0x123')](db[_0x257b('0x1b')],{'through':_0x257b('0x106'),'as':_0x257b('0x132')});db['Team'][_0x257b('0x123')](db['MailQueue'],{'through':_0x257b('0x16d'),'as':'MailQueues'});db[_0x257b('0xe1')]['belongsToMany'](db[_0x257b('0x6c')],{'through':_0x257b('0x1d5'),'as':'ChatQueues'});db[_0x257b('0xe1')][_0x257b('0x123')](db['FaxQueue'],{'through':_0x257b('0x1d6'),'as':'FaxQueues'});db[_0x257b('0xe1')][_0x257b('0x123')](db[_0x257b('0x189')],{'through':_0x257b('0x18a'),'as':'SmsQueues'});db['Team'][_0x257b('0x123')](db['OpenchannelQueue'],{'through':_0x257b('0x190'),'as':'OpenchannelQueues'});db[_0x257b('0xe1')]['belongsToMany'](db[_0x257b('0x13b')],{'through':_0x257b('0x1d7'),'as':_0x257b('0x1d8')});db['Team'][_0x257b('0x123')](db[_0x257b('0x133')],{'through':_0x257b('0x1d9'),'as':_0x257b('0x134')});db['Campaign'][_0x257b('0x113')](db['CmHopper'],{'as':_0x257b('0x120'),'foreignKey':_0x257b('0x19f')});db[_0x257b('0xe3')][_0x257b('0x113')](db[_0x257b('0x115')],{'as':_0x257b('0x116'),'foreignKey':_0x257b('0x19f')});db[_0x257b('0xe3')][_0x257b('0x113')](db[_0x257b('0x77')],{'as':_0x257b('0x14d'),'foreignKey':_0x257b('0x19f')});db[_0x257b('0xe3')][_0x257b('0x113')](db[_0x257b('0x74')],{'as':_0x257b('0x14e'),'foreignKey':_0x257b('0x19f')});db[_0x257b('0xe3')][_0x257b('0x121')](db[_0x257b('0x2b')],{'as':_0x257b('0x2b'),'foreignKey':_0x257b('0x150')});db[_0x257b('0xe3')][_0x257b('0x121')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x257b('0x152')});db['Campaign']['belongsTo'](db[_0x257b('0x153')],{'as':_0x257b('0x153'),'foreignKey':_0x257b('0x154')});db[_0x257b('0xe3')]['belongsTo'](db['SquareProject'],{'as':_0x257b('0xdc'),'foreignKey':_0x257b('0x1da')});db[_0x257b('0xe3')][_0x257b('0x123')](db[_0x257b('0xf1')],{'as':_0x257b('0x156'),'through':_0x257b('0x1db')});db['Campaign'][_0x257b('0x123')](db[_0x257b('0xf1')],{'as':_0x257b('0x1dc'),'through':_0x257b('0x1dd')});db[_0x257b('0xe6')][_0x257b('0x121')](db[_0x257b('0x6a')],{'as':_0x257b('0x6a'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x257b('0x121')](db['MailMessage'],{});db[_0x257b('0x1de')][_0x257b('0x121')](db[_0x257b('0x11b')],{});db[_0x257b('0x1de')]['belongsTo'](db[_0x257b('0x3b')],{'foreignKey':_0x257b('0x1df'),'as':_0x257b('0x1e0')});db[_0x257b('0x1de')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e1'),'as':_0x257b('0x1e2')});db['MailTransferReport'][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e3'),'as':_0x257b('0x1e4')});db[_0x257b('0x1de')][_0x257b('0x121')](db[_0x257b('0x3d')],{'foreignKey':'ToMailQueueId','as':_0x257b('0x1e5')});db[_0x257b('0x1de')]['belongsTo'](db[_0x257b('0x3b')],{'foreignKey':_0x257b('0x1e6'),'as':'ToAccount'});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db[_0x257b('0xeb')]['belongsTo'](db[_0x257b('0x12c')],{});db[_0x257b('0xeb')]['belongsTo'](db[_0x257b('0x63')],{'foreignKey':_0x257b('0x1e7'),'as':'FromAccount'});db['ChatTransferReport'][_0x257b('0x121')](db['User'],{'foreignKey':_0x257b('0x1e1'),'as':_0x257b('0x1e2')});db[_0x257b('0xeb')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e3'),'as':_0x257b('0x1e4')});db[_0x257b('0xeb')][_0x257b('0x121')](db[_0x257b('0x6c')],{'foreignKey':_0x257b('0x1e8'),'as':_0x257b('0x1e5')});db[_0x257b('0xeb')]['belongsTo'](db[_0x257b('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x257b('0x1e9')});db[_0x257b('0xed')][_0x257b('0x121')](db[_0x257b('0x50')],{});db['FaxTransferReport'][_0x257b('0x121')](db[_0x257b('0x4e')],{});db[_0x257b('0xed')][_0x257b('0x121')](db[_0x257b('0x4a')],{'foreignKey':_0x257b('0x1ea'),'as':_0x257b('0x1e0')});db[_0x257b('0xed')]['belongsTo'](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e1'),'as':_0x257b('0x1e2')});db[_0x257b('0xed')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e3'),'as':'ToAgent'});db[_0x257b('0xed')][_0x257b('0x121')](db[_0x257b('0x182')],{'foreignKey':_0x257b('0x1eb'),'as':_0x257b('0x1e5')});db[_0x257b('0xed')]['belongsTo'](db[_0x257b('0x4a')],{'foreignKey':_0x257b('0x1ec'),'as':_0x257b('0x1e9')});db[_0x257b('0xee')][_0x257b('0x121')](db[_0x257b('0x5f')],{});db[_0x257b('0xee')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x257b('0xee')][_0x257b('0x121')](db[_0x257b('0x18b')],{'foreignKey':_0x257b('0x1ed'),'as':'FromAccount'});db[_0x257b('0xee')][_0x257b('0x121')](db['User'],{'foreignKey':_0x257b('0x1e1'),'as':_0x257b('0x1e2')});db[_0x257b('0xee')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e3'),'as':'ToAgent'});db[_0x257b('0xee')]['belongsTo'](db[_0x257b('0x61')],{'foreignKey':_0x257b('0x1ee'),'as':_0x257b('0x1e5')});db[_0x257b('0xee')][_0x257b('0x121')](db[_0x257b('0x18b')],{'foreignKey':_0x257b('0x1ef'),'as':_0x257b('0x1e9')});db[_0x257b('0x1f0')][_0x257b('0x121')](db[_0x257b('0x58')],{});db[_0x257b('0x1f0')][_0x257b('0x121')](db[_0x257b('0x56')],{});db[_0x257b('0x1f0')][_0x257b('0x121')](db[_0x257b('0x144')],{'foreignKey':_0x257b('0x1f1'),'as':_0x257b('0x1e0')});db['SmsTransferReport'][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x257b('0x1f0')]['belongsTo'](db[_0x257b('0x10c')],{'foreignKey':'ToUserId','as':_0x257b('0x1e4')});db['SmsTransferReport'][_0x257b('0x121')](db['SmsQueue'],{'foreignKey':_0x257b('0x1f2'),'as':_0x257b('0x1e5')});db[_0x257b('0x1f0')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x257b('0x1f3'),'as':_0x257b('0x1e9')});db[_0x257b('0xf1')]['hasMany'](db[_0x257b('0x81')],{'as':_0x257b('0x166'),'foreignKey':_0x257b('0x179'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xf1')][_0x257b('0x113')](db['CmCustomField'],{'as':_0x257b('0x1f4'),'foreignKey':_0x257b('0x179')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x257b('0x127'),'onDelete':_0x257b('0x10e'),'foreignKey':'ListId'});db[_0x257b('0xf1')][_0x257b('0x113')](db['CmHopperFinal'],{'as':_0x257b('0x116'),'foreignKey':_0x257b('0x179')});db['CmList'][_0x257b('0x113')](db[_0x257b('0x77')],{'as':_0x257b('0x117'),'foreignKey':_0x257b('0x179')});db[_0x257b('0xf1')][_0x257b('0x113')](db[_0x257b('0x79')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x257b('0xf1')][_0x257b('0x123')](db['VoiceQueue'],{'as':_0x257b('0x1f5'),'through':_0x257b('0x157')});db['CmList'][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':'cm_user_has_lists'});db[_0x257b('0x133')][_0x257b('0x113')](db['VoiceExtension'],{'as':_0x257b('0x114'),'onDelete':_0x257b('0x10e')});db['VoicePrefix'][_0x257b('0x123')](db['User'],{'as':_0x257b('0x16c'),'through':'UserVoicePrefix'});db[_0x257b('0x133')][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':_0x257b('0x1d9'),'as':_0x257b('0x158')});db[_0x257b('0xf4')]['hasMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'foreignKey':_0x257b('0x122')});db[_0x257b('0xf4')][_0x257b('0x113')](db['UserProfileSection'],{'as':_0x257b('0x1f6'),'foreignKey':_0x257b('0x122'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xf5')][_0x257b('0x113')](db[_0x257b('0xf7')],{'as':_0x257b('0x1f7'),'foreignKey':_0x257b('0x1f8'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xfb')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x257b('0x1f9'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xfb')][_0x257b('0x113')](db[_0x257b('0x80')],{'as':_0x257b('0x167'),'foreignKey':_0x257b('0x1f9')});db['WhatsappAccount'][_0x257b('0x113')](db[_0x257b('0xfe')],{'as':_0x257b('0x159'),'foreignKey':'WhatsappAccountId'});db[_0x257b('0xfb')][_0x257b('0x113')](db[_0x257b('0xfd')],{'as':_0x257b('0x17c')});db[_0x257b('0xfb')][_0x257b('0x113')](db[_0x257b('0x1fa')],{'as':_0x257b('0x149'),'foreignKey':_0x257b('0x1f9'),'onDelete':_0x257b('0x10e')});db[_0x257b('0xfb')]['belongsTo'](db[_0x257b('0xf1')],{'as':_0x257b('0x168'),'foreignKey':_0x257b('0x179')});db[_0x257b('0xfb')]['belongsTo'](db[_0x257b('0x86')],{'as':_0x257b('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x257b('0xfb')]['belongsToMany'](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':_0x257b('0x147')});db[_0x257b('0x1fa')][_0x257b('0x121')](db[_0x257b('0x10c')],{'onDelete':'restrict'});db[_0x257b('0x1fa')][_0x257b('0x121')](db[_0x257b('0x13b')],{'onDelete':_0x257b('0x177')});db[_0x257b('0x1fa')][_0x257b('0x121')](db['WhatsappAccount'],{'onDelete':_0x257b('0x177')});db[_0x257b('0x1fa')]['belongsTo'](db[_0x257b('0x153')],{'onDelete':_0x257b('0x177'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0x257b('0x121')](db[_0x257b('0x8c')],{'onDelete':_0x257b('0x177'),'foreignKey':_0x257b('0x178')});db[_0x257b('0xfd')][_0x257b('0x113')](db[_0x257b('0xfe')],{'as':_0x257b('0x159'),'onDelete':_0x257b('0x10e'),'foreignKey':_0x257b('0x1fb')});db[_0x257b('0xfd')][_0x257b('0x121')](db[_0x257b('0xfb')],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1f9')});db[_0x257b('0xfd')]['belongsTo'](db[_0x257b('0x71')],{'as':'Contact','foreignKey':_0x257b('0x160')});db['WhatsappInteraction'][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x16e'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x257b('0x123')](db['Tag'],{'through':_0x257b('0x1b0'),'as':_0x257b('0x16f')});db[_0x257b('0xfd')][_0x257b('0x123')](db[_0x257b('0x8c')],{'through':_0x257b('0x1b0'),'as':'ThroughTags'});db[_0x257b('0xfd')][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x180'),'through':_0x257b('0x131'),'foreignKey':'WhatsappInteractionId'});db[_0x257b('0xfe')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':'User'});db[_0x257b('0xfe')][_0x257b('0x121')](db[_0x257b('0x71')],{'onDelete':'cascade','as':'Contact'});db[_0x257b('0xfe')][_0x257b('0x121')](db['WhatsappInteraction'],{'onDelete':_0x257b('0x10e'),'as':_0x257b('0x174'),'foreignKey':_0x257b('0x1fb')});db[_0x257b('0xfe')]['belongsTo'](db['WhatsappAccount'],{'as':_0x257b('0x17e'),'foreignKey':_0x257b('0x1f9')});db[_0x257b('0x100')][_0x257b('0x121')](db[_0x257b('0xfb')],{});db[_0x257b('0x100')][_0x257b('0x121')](db['CmList'],{'as':_0x257b('0x168'),'foreignKey':_0x257b('0x179')});db['WhatsappQueueReport'][_0x257b('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x257b('0x160')});db[_0x257b('0x100')][_0x257b('0x121')](db[_0x257b('0xfd')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x257b('0x13b')],{});db[_0x257b('0x100')][_0x257b('0x121')](db[_0x257b('0xfe')],{});db[_0x257b('0x100')][_0x257b('0x121')](db['User'],{});db[_0x257b('0x102')]['belongsTo'](db['WhatsappMessage'],{});db[_0x257b('0x102')][_0x257b('0x121')](db[_0x257b('0xfd')],{});db['WhatsappTransferReport'][_0x257b('0x121')](db[_0x257b('0xfb')],{'foreignKey':_0x257b('0x1fc'),'as':'FromAccount'});db[_0x257b('0x102')][_0x257b('0x121')](db[_0x257b('0xfb')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x257b('0x102')][_0x257b('0x121')](db['WhatsappQueue'],{'foreignKey':_0x257b('0x1fd'),'as':_0x257b('0x1e5')});db[_0x257b('0x102')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':'FromUserId','as':_0x257b('0x1e2')});db[_0x257b('0x102')][_0x257b('0x121')](db[_0x257b('0x10c')],{'foreignKey':_0x257b('0x1e3'),'as':_0x257b('0x1e4')});db['WhatsappQueue'][_0x257b('0x123')](db[_0x257b('0x10c')],{'as':_0x257b('0x16c'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x257b('0x13b')][_0x257b('0x123')](db[_0x257b('0xe1')],{'through':_0x257b('0x1d7'),'as':_0x257b('0x158')});db[_0x257b('0x108')][_0x257b('0x121')](db[_0x257b('0x10c')],{'as':_0x257b('0x1fe'),'foreignKey':_0x257b('0x10f'),'onDelete':_0x257b('0x10e'),'hooks':!![]});db['CloudProvider'][_0x257b('0x10d')](db[_0x257b('0xc1')],{'as':_0x257b('0xc1'),'onDelete':_0x257b('0x177')});db[_0x257b('0x162')][_0x257b('0x10d')](db[_0x257b('0x39')],{'as':_0x257b('0x164'),'onDelete':'restrict'});db[_0x257b('0x162')][_0x257b('0x10d')](db[_0x257b('0x3a')],{'as':'Smtp','onDelete':_0x257b('0x177')});module[_0x257b('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b337329..cc0f6bb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe64a=['/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/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/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','root','/www','static','/demo','join','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/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/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue'];(function(_0x4a6049,_0x2f0311){var _0x387434=function(_0x52c034){while(--_0x52c034){_0x4a6049['push'](_0x4a6049['shift']());}};_0x387434(++_0x2f0311);}(_0xe64a,0x1e0));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var path=require(_0xae64('0x0'));var express=require(_0xae64('0x1'));var errors=require(_0xae64('0x2'));var config=require(_0xae64('0x3'));var setupLoggers=require(_0xae64('0x4'))[_0xae64('0x5')];var clientSideLogs=require(_0xae64('0x6'));exports[_0xae64('0x7')]=function(_0x5c8e95){return setupLoggers(_0x5c8e95)['then'](function(){_0x5c8e95['use']('/api/users',require(_0xae64('0x8')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xa'),require(_0xae64('0xb')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xc'),require(_0xae64('0xd')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xe'),require(_0xae64('0xf')));_0x5c8e95[_0xae64('0x9')]('/api/voice/mohs',require(_0xae64('0x10')));_0x5c8e95['use']('/api/voice/queues',require(_0xae64('0x11')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x12'),require(_0xae64('0x13')));_0x5c8e95['use'](_0xae64('0x14'),require('./api/screenRecording'));_0x5c8e95['use'](_0xae64('0x15'),require(_0xae64('0x16')));_0x5c8e95[_0xae64('0x9')]('/api/voice/mails/messages',require(_0xae64('0x17')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x18'),require(_0xae64('0x19')));_0x5c8e95[_0xae64('0x9')]('/api/voice/dials/reports',require(_0xae64('0x1a')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x1b'),require(_0xae64('0x1c')));_0x5c8e95[_0xae64('0x9')]('/api/voice/queues/reports',require(_0xae64('0x1d')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x1e'),require(_0xae64('0x1f')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x20'),require(_0xae64('0x21')));_0x5c8e95[_0xae64('0x9')]('/api/voice/transfers/reports',require(_0xae64('0x22')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x23'),require(_0xae64('0x24')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x25'),require('./api/mailAccount'));_0x5c8e95[_0xae64('0x9')]('/api/mail/queues',require(_0xae64('0x26')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x27'),require(_0xae64('0x28')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x29'),require(_0xae64('0x2a')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x2b'),require(_0xae64('0x2c')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x2d'),require(_0xae64('0x2e')));_0x5c8e95['use']('/api/mail/reports/queue',require(_0xae64('0x2f')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x30'),require(_0xae64('0x31')));_0x5c8e95[_0xae64('0x9')]('/api/dashboards/items',require('./api/dashboardItem'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x32'),require('./api/faxAccount'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x33'),require(_0xae64('0x34')));_0x5c8e95['use'](_0xae64('0x35'),require('./api/faxInteraction'));_0x5c8e95['use']('/api/fax/messages',require(_0xae64('0x36')));_0x5c8e95['use'](_0xae64('0x37'),require('./api/faxQueue'));_0x5c8e95['use']('/api/fax/reports/queue',require(_0xae64('0x38')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x39'),require(_0xae64('0x3a')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x3b'),require(_0xae64('0x3c')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x3d'),require('./api/smsInteraction'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x3e'),require(_0xae64('0x3f')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x40'),require(_0xae64('0x41')));_0x5c8e95['use'](_0xae64('0x42'),require('./api/openchannelAccount'));_0x5c8e95['use'](_0xae64('0x43'),require(_0xae64('0x44')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x45'),require(_0xae64('0x46')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x47'),require('./api/openchannelMessage'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x48'),require(_0xae64('0x49')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x4a'),require(_0xae64('0x4b')));_0x5c8e95['use'](_0xae64('0x4c'),require(_0xae64('0x4d')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x4e'),require('./api/chatApplication'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x4f'),require('./api/chatInteraction'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x50'),require('./api/chatMessage'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x51'),require(_0xae64('0x52')));_0x5c8e95[_0xae64('0x9')]('/api/chat/queues',require(_0xae64('0x53')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x54'),require(_0xae64('0x55')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x56'),require('./api/chatProactiveAction'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x57'),require(_0xae64('0x58')));_0x5c8e95['use'](_0xae64('0x59'),require(_0xae64('0x5a')));_0x5c8e95[_0xae64('0x9')]('/api/cm/hopper',require('./api/cmHopper'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x5b'),require('./api/cmHopperBlack'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x5c'),require(_0xae64('0x5d')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x5e'),require(_0xae64('0x5f')));_0x5c8e95['use'](_0xae64('0x60'),require(_0xae64('0x61')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x62'),require('./api/action'));_0x5c8e95[_0xae64('0x9')]('/api/automations',require('./api/automation'));_0x5c8e95['use'](_0xae64('0x63'),require(_0xae64('0x64')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x65'),require('./api/disposition'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x66'),require(_0xae64('0x67')));_0x5c8e95[_0xae64('0x9')]('/api/intervals',require(_0xae64('0x68')));_0x5c8e95[_0xae64('0x9')]('/api/pauses',require(_0xae64('0x69')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x6a'),require('./api/cdr'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x6b'),require(_0xae64('0x6c')));_0x5c8e95['use'](_0xae64('0x6d'),require(_0xae64('0x6e')));_0x5c8e95['use'](_0xae64('0x6f'),require(_0xae64('0x70')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x71'),require(_0xae64('0x72')));_0x5c8e95[_0xae64('0x9')]('/api/contact_item_types',require(_0xae64('0x73')));_0x5c8e95['use'](_0xae64('0x74'),require(_0xae64('0x75')));_0x5c8e95['use'](_0xae64('0x76'),require(_0xae64('0x77')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x78'),require(_0xae64('0x79')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x7a'),require(_0xae64('0x7b')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x7c'),require(_0xae64('0x7d')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x7e'),require('./api/integration'));_0x5c8e95['use'](_0xae64('0x7f'),require(_0xae64('0x80')));_0x5c8e95[_0xae64('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x81'),require(_0xae64('0x82')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x83'),require(_0xae64('0x84')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x85'),require(_0xae64('0x86')));_0x5c8e95[_0xae64('0x9')]('/api/analytics/field_reports',require(_0xae64('0x87')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x88'),require('./api/analyticTreeReport'));_0x5c8e95[_0xae64('0x9')]('/api/integrations/salesforce/accounts',require(_0xae64('0x89')));_0x5c8e95['use'](_0xae64('0x8a'),require('./api/intSalesforceConfiguration'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x8b'),require(_0xae64('0x8c')));_0x5c8e95['use'](_0xae64('0x8d'),require('./api/intSugarcrmAccount'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x8e'),require(_0xae64('0x8f')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x90'),require(_0xae64('0x91')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x92'),require('./api/intDeskAccount'));_0x5c8e95[_0xae64('0x9')]('/api/integrations/desk/configurations',require(_0xae64('0x93')));_0x5c8e95['use'](_0xae64('0x94'),require('./api/intDeskField'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x95'),require(_0xae64('0x96')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x97'),require('./api/intZohoConfiguration'));_0x5c8e95['use'](_0xae64('0x98'),require('./api/intZohoField'));_0x5c8e95['use'](_0xae64('0x99'),require(_0xae64('0x9a')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x9b'),require('./api/intZendeskConfiguration'));_0x5c8e95[_0xae64('0x9')](_0xae64('0x9c'),require(_0xae64('0x9d')));_0x5c8e95[_0xae64('0x9')]('/api/integrations/freshdesk/accounts',require(_0xae64('0x9e')));_0x5c8e95['use'](_0xae64('0x9f'),require(_0xae64('0xa0')));_0x5c8e95[_0xae64('0x9')]('/api/integrations/freshdesk/fields',require(_0xae64('0xa1')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xa2'),require(_0xae64('0xa3')));_0x5c8e95[_0xae64('0x9')]('/api/integrations/vtiger/configurations',require(_0xae64('0xa4')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xa5'),require('./api/intVtigerField'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xa6'),require(_0xae64('0xa7')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xa8'),require(_0xae64('0xa9')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xaa'),require(_0xae64('0xab')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xac'),require('./api/intDynamics365Account'));_0x5c8e95[_0xae64('0x9')]('/api/integrations/dynamics365/configurations',require(_0xae64('0xad')));_0x5c8e95['use'](_0xae64('0xae'),require(_0xae64('0xaf')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xb0'),require('./api/intFreshsalesAccount'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xb1'),require(_0xae64('0xb2')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xb3'),require(_0xae64('0xb4')));_0x5c8e95[_0xae64('0x9')]('/api/networks',require('./api/network'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xb5'),require(_0xae64('0xb6')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xb7'),require(_0xae64('0xb8')));_0x5c8e95[_0xae64('0x9')]('/api/jscripty/answers/reports',require(_0xae64('0xb9')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xba'),require(_0xae64('0xbb')));_0x5c8e95['use']('/api/jscripty/sessions/reports',require(_0xae64('0xbc')));_0x5c8e95[_0xae64('0x9')]('/api/sms/reports/queue',require(_0xae64('0xbd')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xbe'),require('./api/squareReport'));_0x5c8e95['use'](_0xae64('0xbf'),require('./api/squareReportDetail'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xc0'),require(_0xae64('0xc1')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xc2'),require(_0xae64('0xc3')));_0x5c8e95['use'](_0xae64('0xc4'),require(_0xae64('0xc5')));_0x5c8e95['use'](_0xae64('0xc6'),require('./api/squareProject'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xc7'),require(_0xae64('0xc8')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xc9'),require(_0xae64('0xca')));_0x5c8e95['use'](_0xae64('0xcb'),require(_0xae64('0xcc')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xcd'),require(_0xae64('0xce')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xcf'),require(_0xae64('0xd0')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xd1'),require('./api/migration'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xd2'),require(_0xae64('0xd3')));_0x5c8e95['use'](_0xae64('0xd4'),require(_0xae64('0xd5')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xd6'),require(_0xae64('0xd7')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xd8'),require(_0xae64('0xd9')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xda'),require(_0xae64('0xdb')));_0x5c8e95['use'](_0xae64('0xdc'),require(_0xae64('0xdd')));_0x5c8e95[_0xae64('0x9')]('/api/sms/reports/transfer',require(_0xae64('0xde')));_0x5c8e95[_0xae64('0x9')]('/api/cm/lists',require(_0xae64('0xdf')));_0x5c8e95['use']('/api/voice/prefixes',require(_0xae64('0xe0')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xe1'),require('./api/userProfile'));_0x5c8e95['use'](_0xae64('0xe2'),require(_0xae64('0xe3')));_0x5c8e95[_0xae64('0x9')]('/api/userProfile/resources',require(_0xae64('0xe4')));_0x5c8e95[_0xae64('0x9')]('/api/userNotifications',require(_0xae64('0xe5')));_0x5c8e95[_0xae64('0x9')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xe6'),require(_0xae64('0xe7')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xe8'),require(_0xae64('0xe9')));_0x5c8e95[_0xae64('0x9')]('/api/whatsapp/messages',require(_0xae64('0xea')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xeb'),require(_0xae64('0xec')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xed'),require(_0xae64('0xee')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xef'),require(_0xae64('0xf0')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xf1'),require('./api/cloudProvider'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xf2'),require('./api/realtime'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xf3'),require(_0xae64('0xf4')));_0x5c8e95['use'](_0xae64('0xf5'),require(_0xae64('0xf6')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xf7'),require(_0xae64('0xf8')));_0x5c8e95[_0xae64('0x9')](_0xae64('0xf9'),require('./api/authGoogle'));_0x5c8e95[_0xae64('0x9')](_0xae64('0xfa'),require(_0xae64('0xfb')));_0x5c8e95['use'](_0xae64('0xfc'),require(_0xae64('0xfd')));_0x5c8e95['use']('/api/rpc',require(_0xae64('0xfe')));_0x5c8e95['use'](_0xae64('0xff'),require(_0xae64('0x100')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x101'),require('./api/system'));_0x5c8e95[_0xae64('0x9')]('/api/pm2',require(_0xae64('0x102')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x103'),require(_0xae64('0x104')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x105'),clientSideLogs);_0x5c8e95[_0xae64('0x9')](_0xae64('0x106'),express['static'](path['join'](config[_0xae64('0x107')],'/apidoc')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x108'),express[_0xae64('0x109')](path['join'](config[_0xae64('0x107')],'/www')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x10a'),express[_0xae64('0x109')](path[_0xae64('0x10b')](config[_0xae64('0x107')],_0xae64('0x10a'))));_0x5c8e95[_0xae64('0x9')]('/snippet',express[_0xae64('0x109')](path[_0xae64('0x10b')](config['root'],'snippet','3.9.0')));_0x5c8e95[_0xae64('0x9')](_0xae64('0x10c'),express[_0xae64('0x109')](path[_0xae64('0x10b')](config[_0xae64('0x107')],_0xae64('0x10d'))));_0x5c8e95[_0xae64('0x10e')](_0xae64('0x10f'))[_0xae64('0x110')](errors[0x194]);_0x5c8e95[_0xae64('0x10e')]('/*')[_0xae64('0x110')](function(_0x22c59f,_0x3ae121){_0x3ae121[_0xae64('0x111')](path[_0xae64('0x112')](_0x5c8e95[_0xae64('0x110')](_0xae64('0x113'))+_0xae64('0x114')));});return _0x5c8e95;});}; \ No newline at end of file +var _0x49e5=['./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/plugins','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/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/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','/www','join','root','static','/snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards'];(function(_0x371241,_0x1006c8){var _0x1eb44d=function(_0x587384){while(--_0x587384){_0x371241['push'](_0x371241['shift']());}};_0x1eb44d(++_0x1006c8);}(_0x49e5,0xe9));var _0x549e=function(_0xf07499,_0x48f4c4){_0xf07499=_0xf07499-0x0;var _0x178f02=_0x49e5[_0xf07499];return _0x178f02;};'use strict';var path=require(_0x549e('0x0'));var express=require(_0x549e('0x1'));var errors=require(_0x549e('0x2'));var config=require(_0x549e('0x3'));var setupLoggers=require(_0x549e('0x4'))[_0x549e('0x5')];var clientSideLogs=require(_0x549e('0x6'));exports[_0x549e('0x7')]=function(_0x37a0bb){return setupLoggers(_0x37a0bb)[_0x549e('0x8')](function(){_0x37a0bb[_0x549e('0x9')]('/api/users',require(_0x549e('0xa')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xb'),require(_0x549e('0xc')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xd'),require(_0x549e('0xe')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xf'),require(_0x549e('0x10')));_0x37a0bb['use']('/api/voice/mohs',require(_0x549e('0x11')));_0x37a0bb['use'](_0x549e('0x12'),require('./api/voiceQueue'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x13'),require('./api/voiceRecording'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x14'),require(_0x549e('0x15')));_0x37a0bb[_0x549e('0x9')]('/api/voice/mails',require(_0x549e('0x16')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x17'),require(_0x549e('0x18')));_0x37a0bb['use'](_0x549e('0x19'),require('./api/voiceCallReport'));_0x37a0bb[_0x549e('0x9')]('/api/voice/dials/reports',require(_0x549e('0x1a')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x1b'),require('./api/voiceAgentReport'));_0x37a0bb[_0x549e('0x9')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x37a0bb[_0x549e('0x9')]('/api/members/reports',require(_0x549e('0x1c')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x1d'),require(_0x549e('0x1e')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x1f'),require(_0x549e('0x20')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x21'),require(_0x549e('0x22')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x23'),require(_0x549e('0x24')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x25'),require(_0x549e('0x26')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x27'),require(_0x549e('0x28')));_0x37a0bb['use'](_0x549e('0x29'),require(_0x549e('0x2a')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x2b'),require(_0x549e('0x2c')));_0x37a0bb['use'](_0x549e('0x2d'),require(_0x549e('0x2e')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x2f'),require(_0x549e('0x30')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x31'),require('./api/dashboard'));_0x37a0bb[_0x549e('0x9')]('/api/dashboards/items',require(_0x549e('0x32')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x33'),require('./api/faxAccount'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x34'),require(_0x549e('0x35')));_0x37a0bb[_0x549e('0x9')]('/api/fax/interactions',require(_0x549e('0x36')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x37'),require(_0x549e('0x38')));_0x37a0bb[_0x549e('0x9')]('/api/fax/queues',require('./api/faxQueue'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x39'),require(_0x549e('0x3a')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x3b'),require(_0x549e('0x3c')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x3d'),require(_0x549e('0x3e')));_0x37a0bb['use'](_0x549e('0x3f'),require(_0x549e('0x40')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x41'),require('./api/smsMessage'));_0x37a0bb['use'](_0x549e('0x42'),require('./api/smsQueue'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x43'),require(_0x549e('0x44')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x45'),require(_0x549e('0x46')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x47'),require(_0x549e('0x48')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x49'),require('./api/openchannelMessage'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x4a'),require(_0x549e('0x4b')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x4c'),require(_0x549e('0x4d')));_0x37a0bb['use'](_0x549e('0x4e'),require(_0x549e('0x4f')));_0x37a0bb['use'](_0x549e('0x50'),require(_0x549e('0x51')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x52'),require('./api/chatInteraction'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x53'),require(_0x549e('0x54')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x55'),require(_0x549e('0x56')));_0x37a0bb['use'](_0x549e('0x57'),require(_0x549e('0x58')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x59'),require(_0x549e('0x5a')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x5b'),require(_0x549e('0x5c')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x5d'),require(_0x549e('0x5e')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x5f'),require(_0x549e('0x60')));_0x37a0bb[_0x549e('0x9')]('/api/cm/hopper',require('./api/cmHopper'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x61'),require(_0x549e('0x62')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x63'),require(_0x549e('0x64')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x65'),require(_0x549e('0x66')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x67'),require(_0x549e('0x68')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x69'),require(_0x549e('0x6a')));_0x37a0bb[_0x549e('0x9')]('/api/automations',require(_0x549e('0x6b')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x6c'),require(_0x549e('0x6d')));_0x37a0bb['use'](_0x549e('0x6e'),require('./api/disposition'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x6f'),require(_0x549e('0x70')));_0x37a0bb[_0x549e('0x9')]('/api/intervals',require('./api/interval'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x71'),require(_0x549e('0x72')));_0x37a0bb[_0x549e('0x9')]('/api/cdr',require(_0x549e('0x73')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x74'),require('./api/voiceQueuesLog'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x75'),require('./api/schedule'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x76'),require('./api/sound'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x77'),require(_0x549e('0x78')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x79'),require(_0x549e('0x7a')));_0x37a0bb[_0x549e('0x9')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x7b'),require(_0x549e('0x7c')));_0x37a0bb['use'](_0x549e('0x7d'),require(_0x549e('0x7e')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x7f'),require(_0x549e('0x80')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x81'),require('./api/variable'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x82'),require(_0x549e('0x83')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x84'),require(_0x549e('0x85')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x86'),require(_0x549e('0x87')));_0x37a0bb[_0x549e('0x9')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x37a0bb['use']('/api/analytics/extracted_reports',require(_0x549e('0x88')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x89'),require(_0x549e('0x8a')));_0x37a0bb['use']('/api/analytics/field_reports',require(_0x549e('0x8b')));_0x37a0bb['use'](_0x549e('0x8c'),require(_0x549e('0x8d')));_0x37a0bb['use'](_0x549e('0x8e'),require(_0x549e('0x8f')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x90'),require(_0x549e('0x91')));_0x37a0bb['use'](_0x549e('0x92'),require(_0x549e('0x93')));_0x37a0bb['use'](_0x549e('0x94'),require(_0x549e('0x95')));_0x37a0bb[_0x549e('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x549e('0x96')));_0x37a0bb['use']('/api/integrations/sugarcrm/fields',require(_0x549e('0x97')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x98'),require('./api/intDeskAccount'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x99'),require('./api/intDeskConfiguration'));_0x37a0bb['use']('/api/integrations/desk/fields',require(_0x549e('0x9a')));_0x37a0bb['use'](_0x549e('0x9b'),require(_0x549e('0x9c')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x9d'),require('./api/intZohoConfiguration'));_0x37a0bb['use'](_0x549e('0x9e'),require(_0x549e('0x9f')));_0x37a0bb[_0x549e('0x9')]('/api/integrations/zendesk/accounts',require(_0x549e('0xa0')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xa1'),require('./api/intZendeskConfiguration'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xa2'),require(_0x549e('0xa3')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xa4'),require(_0x549e('0xa5')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xa6'),require(_0x549e('0xa7')));_0x37a0bb['use'](_0x549e('0xa8'),require(_0x549e('0xa9')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xaa'),require(_0x549e('0xab')));_0x37a0bb['use'](_0x549e('0xac'),require('./api/intVtigerConfiguration'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xad'),require(_0x549e('0xae')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xaf'),require(_0x549e('0xb0')));_0x37a0bb['use'](_0x549e('0xb1'),require(_0x549e('0xb2')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xb3'),require(_0x549e('0xb4')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xb5'),require(_0x549e('0xb6')));_0x37a0bb[_0x549e('0x9')]('/api/integrations/dynamics365/configurations',require(_0x549e('0xb7')));_0x37a0bb['use'](_0x549e('0xb8'),require(_0x549e('0xb9')));_0x37a0bb['use'](_0x549e('0xba'),require('./api/intFreshsalesAccount'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xbb'),require(_0x549e('0xbc')));_0x37a0bb[_0x549e('0x9')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xbd'),require(_0x549e('0xbe')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xbf'),require('./api/chatQueueReport'));_0x37a0bb['use'](_0x549e('0xc0'),require(_0x549e('0xc1')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xc2'),require(_0x549e('0xc3')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xc4'),require(_0x549e('0xc5')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xc6'),require('./api/jscriptySessionReport'));_0x37a0bb['use'](_0x549e('0xc7'),require('./api/smsQueueReport'));_0x37a0bb['use'](_0x549e('0xc8'),require(_0x549e('0xc9')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xca'),require(_0x549e('0xcb')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xcc'),require('./api/jscriptyProject'));_0x37a0bb['use']('/api/settings',require(_0x549e('0xcd')));_0x37a0bb['use'](_0x549e('0xce'),require(_0x549e('0xcf')));_0x37a0bb['use'](_0x549e('0xd0'),require(_0x549e('0xd1')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xd2'),require(_0x549e('0xd3')));_0x37a0bb['use'](_0x549e('0xd4'),require(_0x549e('0xd5')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xd6'),require(_0x549e('0xd7')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xd8'),require(_0x549e('0xd9')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xda'),require(_0x549e('0xdb')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xdc'),require('./api/migration'));_0x37a0bb[_0x549e('0x9')]('/api/attachments',require(_0x549e('0xdd')));_0x37a0bb['use'](_0x549e('0xde'),require('./api/plugin'));_0x37a0bb[_0x549e('0x9')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xdf'),require(_0x549e('0xe0')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xe1'),require('./api/faxTransferReport'));_0x37a0bb['use']('/api/openchannel/reports/transfer',require(_0x549e('0xe2')));_0x37a0bb[_0x549e('0x9')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xe3'),require(_0x549e('0xe4')));_0x37a0bb['use'](_0x549e('0xe5'),require(_0x549e('0xe6')));_0x37a0bb['use'](_0x549e('0xe7'),require(_0x549e('0xe8')));_0x37a0bb['use'](_0x549e('0xe9'),require(_0x549e('0xea')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xeb'),require(_0x549e('0xec')));_0x37a0bb[_0x549e('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x37a0bb['use'](_0x549e('0xed'),require(_0x549e('0xee')));_0x37a0bb['use'](_0x549e('0xef'),require(_0x549e('0xf0')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xf1'),require(_0x549e('0xf2')));_0x37a0bb[_0x549e('0x9')]('/api/whatsapp/messages',require(_0x549e('0xf3')));_0x37a0bb[_0x549e('0x9')](_0x549e('0xf4'),require('./api/whatsappQueueReport'));_0x37a0bb['use'](_0x549e('0xf5'),require(_0x549e('0xf6')));_0x37a0bb['use'](_0x549e('0xf7'),require('./api/whatsappQueue'));_0x37a0bb[_0x549e('0x9')](_0x549e('0xf8'),require(_0x549e('0xf9')));_0x37a0bb['use'](_0x549e('0xfa'),require(_0x549e('0xfb')));_0x37a0bb[_0x549e('0x9')]('/api/user-settings',require('./api/user-setting'));_0x37a0bb['use'](_0x549e('0xfc'),require(_0x549e('0xfd')));_0x37a0bb['use'](_0x549e('0xfe'),require(_0x549e('0xff')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x100'),require(_0x549e('0x101')));_0x37a0bb['use'](_0x549e('0x102'),require('./api/authActiveDirectory'));_0x37a0bb[_0x549e('0x9')](_0x549e('0x103'),require(_0x549e('0x104')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x105'),require(_0x549e('0x106')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x107'),require('./api/version'));_0x37a0bb['use']('/api/system',require(_0x549e('0x108')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x109'),require(_0x549e('0x10a')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x10b'),require('./api/webbar'));_0x37a0bb['use'](_0x549e('0x10c'),clientSideLogs);_0x37a0bb[_0x549e('0x9')]('/apidoc',express['static'](path['join'](config['root'],_0x549e('0x10d'))));_0x37a0bb['use'](_0x549e('0x10e'),express['static'](path[_0x549e('0x10f')](config[_0x549e('0x110')],_0x549e('0x10e'))));_0x37a0bb[_0x549e('0x9')]('/demo',express[_0x549e('0x111')](path[_0x549e('0x10f')](config[_0x549e('0x110')],'/demo')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x112'),express[_0x549e('0x111')](path[_0x549e('0x10f')](config[_0x549e('0x110')],'snippet','3.9.0')));_0x37a0bb[_0x549e('0x9')](_0x549e('0x113'),express[_0x549e('0x111')](path['join'](config['root'],_0x549e('0x114'))));_0x37a0bb[_0x549e('0x115')](_0x549e('0x116'))[_0x549e('0x117')](errors[0x194]);_0x37a0bb[_0x549e('0x115')]('/*')['get'](function(_0x4625a3,_0x5d93ea){_0x5d93ea['sendFile'](path[_0x549e('0x118')](_0x37a0bb['get'](_0x549e('0x119'))+_0x549e('0x11a')));});return _0x37a0bb;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 58ec267..86844df 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6552=['../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x1e6d6c,_0x58878f){var _0x5e072d=function(_0x177c66){while(--_0x177c66){_0x1e6d6c['push'](_0x1e6d6c['shift']());}};_0x5e072d(++_0x58878f);}(_0x6552,0x1e3));var _0x2655=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6552[_0x110c3d];return _0x226d67;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2655('0x0'));var config=require(_0x2655('0x1'));exports[_0x2655('0x2')]=function(){return new Promise(function(_0x3344d8,_0x3ec979){var _0x5e6a51={};_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x4')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x5')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x6')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/voiceRecording/voiceRecording.rpc'));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x7')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x8')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x9')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/trunk/trunk.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0xa')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0xb')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0xc')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/mailQueue/mailQueue.rpc'));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0xd')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0xe')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0xf')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x10')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x11')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x12')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/faxMessage/faxMessage.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x13')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x14')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x15')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x16')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x17')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x18')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x19')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x1a')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/chatInteraction/chatInteraction.rpc'));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x1b')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x1c')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x1d')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x1e')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x1f')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x20')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x21')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x22')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x23')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/sound/sound.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x24')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x25')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x26')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x27')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x28')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x29')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x2a')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x2b')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x2c')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x2d')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x2e')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x2f')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x30')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x31')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x32')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x33')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x34')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x35')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x36')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/squareProject/squareProject.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/squareRecording/squareRecording.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x37')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/campaign/campaign.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x38')));_0x5e6a51=_['merge'](_0x5e6a51,require('../api/plugin/plugin.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require(_0x2655('0x39')));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x3a')));_0x5e6a51=_[_0x2655('0x3')](_0x5e6a51,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5e6a51=_['merge'](_0x5e6a51,require(_0x2655('0x3b')));var _0x1846f2=jayson[_0x2655('0x3c')](_0x5e6a51)['http']();var _0x4a9d15=config[_0x2655('0x3d')][_0x2655('0x3e')]||config[_0x2655('0x3e')]+0x1;var _0x51b742=config[_0x2655('0x3d')]['ip']||_0x2655('0x3f');_0x1846f2['on']('error',function(_0x365030){return _0x3ec979(_0x365030);});_0x1846f2[_0x2655('0x2')](_0x4a9d15,_0x51b742,function(){console['log'](_0x2655('0x40'),_0x51b742,_0x4a9d15);require(_0x2655('0x41'))['default']();return _0x3344d8(_0x2655('0x42')+_0x51b742+':'+_0x4a9d15);});});}; \ No newline at end of file +var _0x25d3=['../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc'];(function(_0x48e556,_0x122e2d){var _0x256f39=function(_0x446127){while(--_0x446127){_0x48e556['push'](_0x48e556['shift']());}};_0x256f39(++_0x122e2d);}(_0x25d3,0x1b7));var _0x325d=function(_0x376543,_0x4dd713){_0x376543=_0x376543-0x0;var _0x2e1cb2=_0x25d3[_0x376543];return _0x2e1cb2;};'use strict';var jayson=require(_0x325d('0x0'));var _=require(_0x325d('0x1'));var config=require(_0x325d('0x2'));exports[_0x325d('0x3')]=function(){return new Promise(function(_0x52089e,_0x690b7c){var _0x16be36={};_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x4')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/voiceExtension/voiceExtension.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x6')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x7')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x8')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x9')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0xa')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0xb')));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0xc')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0xd')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0xe')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/mailServerIn/mailServerIn.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/mailAccount/mailAccount.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0xf')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/mailInteraction/mailInteraction.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x10')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x11')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x12')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x13')));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x14')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/faxInteraction/faxInteraction.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x15')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x16')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x17')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x18')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/smsInteraction/smsInteraction.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x19')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1a')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1b')));_0x16be36=_['merge'](_0x16be36,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1c')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1d')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1e')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x1f')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/chatQueue/chatQueue.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/cmContact/cmContact.rpc'));_0x16be36=_['merge'](_0x16be36,require('../api/cmHopper/cmHopper.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x20')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x21')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x22')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x23')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x24')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x25')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x26')));_0x16be36=_['merge'](_0x16be36,require('../api/template/template.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/trigger/trigger.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x27')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x28')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x29')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x2a')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x2b')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x2c')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x2d')));_0x16be36=_['merge'](_0x16be36,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x2e')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x2f')));_0x16be36=_['merge'](_0x16be36,require('../api/squareReport/squareReport.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x30')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/setting/setting.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x31')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/squareProject/squareProject.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/squareRecording/squareRecording.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x32')));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x33')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require('../api/attachment/attachment.rpc'));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x34')));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x35')));_0x16be36=_['merge'](_0x16be36,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x16be36=_['merge'](_0x16be36,require(_0x325d('0x36')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x37')));_0x16be36=_[_0x325d('0x5')](_0x16be36,require(_0x325d('0x38')));var _0x259aa2=jayson[_0x325d('0x39')](_0x16be36)[_0x325d('0x3a')]();var _0x3d1631=config['rpc']['port']||config[_0x325d('0x3b')]+0x1;var _0x5862db=config[_0x325d('0x3c')]['ip']||_0x325d('0x3d');_0x259aa2['on'](_0x325d('0x3e'),function(_0x9fe02e){return _0x690b7c(_0x9fe02e);});_0x259aa2[_0x325d('0x3')](_0x3d1631,_0x5862db,function(){console[_0x325d('0x3f')](_0x325d('0x40'),_0x5862db,_0x3d1631);require(_0x325d('0x41'))[_0x325d('0x42')]();return _0x52089e(_0x325d('0x43')+_0x5862db+':'+_0x3d1631);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 468f33b..e75534b 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 _0xf771=['line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','answer','ANSWER','beep','sendRequest','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','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','exec','AGI','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready'];(function(_0x341cf8,_0x1d29eb){var _0x23ec13=function(_0x154d7d){while(--_0x154d7d){_0x341cf8['push'](_0x341cf8['shift']());}};_0x23ec13(++_0x1d29eb);}(_0xf771,0x8e));var _0x1f77=function(_0x3a37cb,_0x4494a6){_0x3a37cb=_0x3a37cb-0x0;var _0x2a30f3=_0xf771[_0x3a37cb];return _0x2a30f3;};'use strict';var util=require(_0x1f77('0x0'));var _=require(_0x1f77('0x1'));var EventEmitter=require(_0x1f77('0x2'))[_0x1f77('0x3')];var AGIReply=require(_0x1f77('0x4'));var AGIError=require(_0x1f77('0x5'));function AGIChannel(_0x4f4bd9){var _0x459dc7=this,_0x26719f=new AGIReply(),_0x1b1265=![],_0x356d13={};EventEmitter[_0x1f77('0x6')](_0x459dc7);_0x4f4bd9[_0x1f77('0x7')](_0x1f77('0x8'));_0x4f4bd9['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x26719f[_0x1f77('0x7')](_0x1f77('0x8'));_0x26719f['on'](_0x1f77('0x9'),function(_0x4704ed){for(var _0x562bc9 in _0x4704ed){_0x459dc7[_0x562bc9]=_0x4704ed[_0x562bc9];}_0x459dc7[_0x1f77('0xa')](_0x1f77('0xb'));});_0x26719f['on'](_0x1f77('0xc'),function(_0x113226){if(_0x113226['toLowerCase']()==_0x1f77('0xd')){_0x459dc7[_0x1f77('0xa')](_0x1f77('0xd'));return;}if(_0x113226['substring'](0x0,0xb)==_0x1f77('0xe')){_0x1b1265=!![];}if(_0x1b1265){_0x356d13['rx']+=_0x113226+'\x0a';if(_0x113226[_0x1f77('0xf')](_0x1f77('0x10'))!=-0x1){_0x1b1265=![];}}else{_0x356d13['rx']=_0x113226;}if(_0x1b1265){return;}if(typeof _0x356d13['cb']==_0x1f77('0x11')){var _0x27d779=_0x356d13['rx'][_0x1f77('0x12')](0x0,0x3),_0x283093=null,_0x3ad570=null;_0x27d779=parseInt(_0x27d779);if(isNaN(_0x27d779)){_0x356d13['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1f77('0x13')});return;}if(_0x27d779!=0xc8){_0x356d13['cb'](null,{'code':_0x27d779,'result':-0x1,'extra':'KO'});return;}_0x283093=_0x356d13['rx'][_0x1f77('0x12')](0x4)[_0x1f77('0x14')](_0x1f77('0x15'),'');if(_0x283093[_0x1f77('0x16')]('\x20')!=-0x1){_0x283093=_0x283093[_0x1f77('0x17')](0x0,_0x283093[_0x1f77('0x16')]('\x20'));}if(_[_0x1f77('0x18')](_0x283093,'-1')){_0x283093=parseInt(_0x283093);}_0x3ad570=_0x356d13['rx'][_0x1f77('0x19')]('\x20');if(_0x3ad570['length']==0x3){_0x3ad570=_0x3ad570[0x2]['substring'](0x1,_0x3ad570[0x2]['length']-0x1);}else if(_0x3ad570['length']>0x3){var _0x17e901=/\((.+)\)/;var _0x297532=_0x356d13['rx'][_0x1f77('0x1a')](_0x17e901);if(_0x297532){_0x3ad570=_0x297532[0x1];}else{_0x3ad570=null;}}else{_0x3ad570=null;}_0x356d13['cb'](null,{'code':_0x27d779,'result':_0x283093,'extra':_0x3ad570});}});_0x4f4bd9['on']('error',function(_0x64000e){_0x459dc7['emit'](_0x1f77('0x1b'),new AGIError('E_AGI_SOCKET_ERROR',_0x64000e[_0x1f77('0x1c')]));});_0x4f4bd9['on']('close',function(){_0x459dc7['emit'](_0x1f77('0x1d'),new AGIError(_0x1f77('0x1e')));});_0x4f4bd9['on'](_0x1f77('0x1f'),function(){_0x459dc7[_0x1f77('0xa')]('timeout',new AGIError(_0x1f77('0x20')));_0x4f4bd9[_0x1f77('0x21')]();});_0x4f4bd9[_0x1f77('0x22')](_0x26719f);this['command']=function(_0x20274f,_0x5c2ff3){var _0x20274f=_0x20274f||'',_0x5c2ff3=typeof _0x5c2ff3==_0x1f77('0x11')?_0x5c2ff3:new Function();_0x356d13={'tx':_0x20274f,'rx':'','cb':_0x5c2ff3};_0x4f4bd9[_0x1f77('0x23')](_0x20274f+'\x0a');},this[_0x1f77('0x1d')]=function(){_0x4f4bd9['destroy']();};}util[_0x1f77('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x1f77('0x25')]['sendRequest']=function(_0x4e14ba){return this['command']['sync'](this,_0x4e14ba);};AGIChannel['prototype'][_0x1f77('0x26')]=function(){return this['sendRequest'](_0x1f77('0x27'));};AGIChannel[_0x1f77('0x25')]['getData']=function(_0x47ae21,_0x242c23,_0x5c4629){_0x47ae21=_0x47ae21===undefined?_0x1f77('0x28'):_0x47ae21;_0x242c23=_0x242c23===undefined?'5':_0x242c23;_0x5c4629=_0x5c4629===undefined?'1':_0x5c4629;return this[_0x1f77('0x29')](util['format'](_0x1f77('0x2a'),_0x47ae21,_0x242c23*0x3e8,_0x5c4629));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x2b')]=function(_0x1cc123){_0x1cc123=_0x1cc123||_0x1f77('0x2c');return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x2e'),_0x1cc123));};AGIChannel[_0x1f77('0x25')]['exec']=function(_0x1b7787,_0x56951){if(_[_0x1f77('0x2f')](_0x56951)){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x30'),_0x1b7787,_0x56951[_0x1f77('0x31')](',')));}return this[_0x1f77('0x29')](util['format']('EXEC\x20%s\x20%s',_0x1b7787,_0x56951));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x32')]=function(_0x189ecf){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')]('SET\x20CONTEXT\x20%s',_0x189ecf));};AGIChannel['prototype'][_0x1f77('0x33')]=function(_0x5dbefb){return this['sendRequest'](util['format'](_0x1f77('0x34'),_0x5dbefb));};AGIChannel['prototype'][_0x1f77('0x35')]=function(_0x2731b6){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')]('SET\x20PRIORITY\x20%s',_0x2731b6));};AGIChannel[_0x1f77('0x25')]['hangup']=function(){return this['sendRequest'](_0x1f77('0x36'));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x37')]=function(_0x14c376,_0x340aaf){var _0x5b60fb=_['isBoolean'](_0x340aaf)||_[_0x1f77('0x38')](_0x340aaf)?_0x340aaf['toString']():_0x340aaf;return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x39'),_0x14c376,_0x5b60fb?_0x5b60fb[_0x1f77('0x3a')]()[_0x1f77('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x3b')]=function(_0x2ba6e2,_0x188a5e){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x3c'),_0x2ba6e2,_0x188a5e));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x3d')]=function(_0x3352e7,_0x330df9){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x3e'),_0x3352e7,_0x330df9));};AGIChannel[_0x1f77('0x25')][_0x1f77('0x3f')]=function(_0x18da65,_0x4a9385){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x18da65,_0x4a9385));};AGIChannel[_0x1f77('0x25')]['continueAt']=function(_0x38ee6f,_0x24ff61,_0xa34c18){_0x24ff61=_0x24ff61||this['extension'];_0xa34c18=_0xa34c18||0x1;this[_0x1f77('0x32')](_0x38ee6f);this[_0x1f77('0x33')](_0x24ff61);this[_0x1f77('0x35')](_0xa34c18);return this['noop'](util[_0x1f77('0x2d')]('GOTO\x20%s\x20%s\x20%s',_0x38ee6f,_0x24ff61,_0xa34c18));};AGIChannel['prototype'][_0x1f77('0x40')]=function(_0x2e71ee){return this[_0x1f77('0x29')](util[_0x1f77('0x2d')](_0x1f77('0x41'),_0x2e71ee));};AGIChannel[_0x1f77('0x25')]['recordFile']=function(_0x6f75c1,_0x60c9c4,_0x117bb4,_0x36c2fc,_0x543793,_0x4a8953){_0x60c9c4=_0x60c9c4||_0x1f77('0x42');_0x117bb4=_0x117bb4||'';_0x36c2fc=_0x36c2fc===undefined?-0x1:_0x36c2fc==='-1'?-0x1:_0x36c2fc*0x3e8;_0x543793=_0x543793===undefined?'':'s='+_0x543793;_0x4a8953=_0x4a8953?_0x1f77('0x43'):'';return this['sendRequest'](util[_0x1f77('0x2d')](_0x1f77('0x44'),_0x6f75c1,_0x60c9c4,_0x117bb4,_0x36c2fc,_0x4a8953,_0x543793));};AGIChannel['prototype'][_0x1f77('0x45')]=function(_0x4a85cc,_0x59d442){_0x59d442=_0x59d442||'';return this['sendRequest'](util[_0x1f77('0x2d')](_0x1f77('0x46'),_0x4a85cc,_0x59d442));};AGIChannel['prototype'][_0x1f77('0x47')]=function(_0x37e427){return this[_0x1f77('0x48')](_0x1f77('0x49'),_0x37e427);};AGIChannel[_0x1f77('0x25')][_0x1f77('0x4a')]=function(_0x37eef4){return this[_0x1f77('0x48')](_0x1f77('0x4b'),_0x37eef4);};AGIChannel['prototype']['error']=function(_0x502899,_0x1bdedc){this[_0x1f77('0x2b')](util[_0x1f77('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x502899['id'],_0x502899[_0x1f77('0x4c')],_0x1bdedc));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xba29=['AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','search','function','replace','split','length','substring','match','error','E_AGI_SOCKET_ERROR','code','close','emit','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','sendRequest','command','sync','prototype','answer','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec'];(function(_0x22dc81,_0x1f9066){var _0x2ccdba=function(_0x12cc15){while(--_0x12cc15){_0x22dc81['push'](_0x22dc81['shift']());}};_0x2ccdba(++_0x1f9066);}(_0xba29,0x9e));var _0x9ba2=function(_0x34febf,_0x48f9a5){_0x34febf=_0x34febf-0x0;var _0x73784a=_0xba29[_0x34febf];return _0x73784a;};'use strict';var util=require(_0x9ba2('0x0'));var _=require(_0x9ba2('0x1'));var EventEmitter=require(_0x9ba2('0x2'))[_0x9ba2('0x3')];var AGIReply=require(_0x9ba2('0x4'));var AGIError=require(_0x9ba2('0x5'));function AGIChannel(_0x5cdbb2){var _0x55d157=this,_0x4e8cc7=new AGIReply(),_0x27d3f5=![],_0x216ed9={};EventEmitter['call'](_0x55d157);_0x5cdbb2[_0x9ba2('0x6')](_0x9ba2('0x7'));_0x5cdbb2[_0x9ba2('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4e8cc7[_0x9ba2('0x6')](_0x9ba2('0x7'));_0x4e8cc7['on'](_0x9ba2('0x9'),function(_0x1664b7){for(var _0x7b6458 in _0x1664b7){_0x55d157[_0x7b6458]=_0x1664b7[_0x7b6458];}_0x55d157['emit'](_0x9ba2('0xa'));});_0x4e8cc7['on'](_0x9ba2('0xb'),function(_0x156d4a){if(_0x156d4a[_0x9ba2('0xc')]()==_0x9ba2('0xd')){_0x55d157['emit'](_0x9ba2('0xd'));return;}if(_0x156d4a['substring'](0x0,0xb)=='520-Invalid'){_0x27d3f5=!![];}if(_0x27d3f5){_0x216ed9['rx']+=_0x156d4a+'\x0a';if(_0x156d4a[_0x9ba2('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x27d3f5=![];}}else{_0x216ed9['rx']=_0x156d4a;}if(_0x27d3f5){return;}if(typeof _0x216ed9['cb']==_0x9ba2('0xf')){var _0x44849b=_0x216ed9['rx']['substring'](0x0,0x3),_0x83917a=null,_0x112800=null;_0x44849b=parseInt(_0x44849b);if(isNaN(_0x44849b)){_0x216ed9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x44849b!=0xc8){_0x216ed9['cb'](null,{'code':_0x44849b,'result':-0x1,'extra':'KO'});return;}_0x83917a=_0x216ed9['rx']['substring'](0x4)[_0x9ba2('0x10')]('result=','');if(_0x83917a['indexOf']('\x20')!=-0x1){_0x83917a=_0x83917a['substr'](0x0,_0x83917a['indexOf']('\x20'));}if(_['startsWith'](_0x83917a,'-1')){_0x83917a=parseInt(_0x83917a);}_0x112800=_0x216ed9['rx'][_0x9ba2('0x11')]('\x20');if(_0x112800[_0x9ba2('0x12')]==0x3){_0x112800=_0x112800[0x2][_0x9ba2('0x13')](0x1,_0x112800[0x2][_0x9ba2('0x12')]-0x1);}else if(_0x112800[_0x9ba2('0x12')]>0x3){var _0x212aca=/\((.+)\)/;var _0x2c82ca=_0x216ed9['rx'][_0x9ba2('0x14')](_0x212aca);if(_0x2c82ca){_0x112800=_0x2c82ca[0x1];}else{_0x112800=null;}}else{_0x112800=null;}_0x216ed9['cb'](null,{'code':_0x44849b,'result':_0x83917a,'extra':_0x112800});}});_0x5cdbb2['on']('error',function(_0x55b47d){_0x55d157['emit'](_0x9ba2('0x15'),new AGIError(_0x9ba2('0x16'),_0x55b47d[_0x9ba2('0x17')]));});_0x5cdbb2['on'](_0x9ba2('0x18'),function(){_0x55d157[_0x9ba2('0x19')](_0x9ba2('0x18'),new AGIError(_0x9ba2('0x1a')));});_0x5cdbb2['on'](_0x9ba2('0x1b'),function(){_0x55d157['emit']('timeout',new AGIError(_0x9ba2('0x1c')));_0x5cdbb2['destroy']();});_0x5cdbb2[_0x9ba2('0x1d')](_0x4e8cc7);this['command']=function(_0x35c587,_0x145866){var _0x35c587=_0x35c587||'',_0x145866=typeof _0x145866==_0x9ba2('0xf')?_0x145866:new Function();_0x216ed9={'tx':_0x35c587,'rx':'','cb':_0x145866};_0x5cdbb2[_0x9ba2('0x1e')](_0x35c587+'\x0a');},this[_0x9ba2('0x18')]=function(){_0x5cdbb2[_0x9ba2('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x9ba2('0x20')]=function(_0x470d6f){return this[_0x9ba2('0x21')][_0x9ba2('0x22')](this,_0x470d6f);};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x24')]=function(){return this[_0x9ba2('0x20')](_0x9ba2('0x25'));};AGIChannel['prototype']['getData']=function(_0x324c59,_0x1158db,_0x1a6fd7){_0x324c59=_0x324c59===undefined?'beep':_0x324c59;_0x1158db=_0x1158db===undefined?'5':_0x1158db;_0x1a6fd7=_0x1a6fd7===undefined?'1':_0x1a6fd7;return this['sendRequest'](util[_0x9ba2('0x26')](_0x9ba2('0x27'),_0x324c59,_0x1158db*0x3e8,_0x1a6fd7));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x28')]=function(_0x1b3869){_0x1b3869=_0x1b3869||'NO\x20MESSAGE';return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')](_0x9ba2('0x29'),_0x1b3869));};AGIChannel['prototype']['exec']=function(_0x7a51bd,_0x35f7c9){if(_[_0x9ba2('0x2a')](_0x35f7c9)){return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')](_0x9ba2('0x2b'),_0x7a51bd,_0x35f7c9[_0x9ba2('0x2c')](',')));}return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')](_0x9ba2('0x2b'),_0x7a51bd,_0x35f7c9));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x2d')]=function(_0x2e4018){return this['sendRequest'](util[_0x9ba2('0x26')]('SET\x20CONTEXT\x20%s',_0x2e4018));};AGIChannel[_0x9ba2('0x23')]['setExtension']=function(_0x244732){return this[_0x9ba2('0x20')](util['format'](_0x9ba2('0x2e'),_0x244732));};AGIChannel['prototype'][_0x9ba2('0x2f')]=function(_0x35f7c5){return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')]('SET\x20PRIORITY\x20%s',_0x35f7c5));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0xd')]=function(){return this['sendRequest'](_0x9ba2('0x30'));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x31')]=function(_0xcf4768,_0x122c44){var _0x21b992=_['isBoolean'](_0x122c44)||_[_0x9ba2('0x32')](_0x122c44)?_0x122c44[_0x9ba2('0x33')]():_0x122c44;return this[_0x9ba2('0x20')](util['format'](_0x9ba2('0x34'),_0xcf4768,_0x21b992?_0x21b992['toString']()[_0x9ba2('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x9ba2('0x35')]=function(_0x5c79a4,_0x1e7b84){return this['sendRequest'](util[_0x9ba2('0x26')](_0x9ba2('0x36'),_0x5c79a4,_0x1e7b84));};AGIChannel[_0x9ba2('0x23')]['sayDigits']=function(_0x2a4e3d,_0x307685){return this['sendRequest'](util[_0x9ba2('0x26')](_0x9ba2('0x37'),_0x2a4e3d,_0x307685));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x38')]=function(_0x30a766,_0x3abee5){return this['sendRequest'](util['format'](_0x9ba2('0x39'),_0x30a766,_0x3abee5));};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x3a')]=function(_0x66c892,_0x249136,_0x367c8a){_0x249136=_0x249136||this[_0x9ba2('0x3b')];_0x367c8a=_0x367c8a||0x1;this[_0x9ba2('0x2d')](_0x66c892);this[_0x9ba2('0x3c')](_0x249136);this[_0x9ba2('0x2f')](_0x367c8a);return this[_0x9ba2('0x28')](util[_0x9ba2('0x26')](_0x9ba2('0x3d'),_0x66c892,_0x249136,_0x367c8a));};AGIChannel['prototype']['getVariable']=function(_0x157f46){return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')](_0x9ba2('0x3e'),_0x157f46));};AGIChannel['prototype'][_0x9ba2('0x3f')]=function(_0x3715e2,_0x1e7ed5,_0x466156,_0x1f6f63,_0x4a8623,_0x4890a7){_0x1e7ed5=_0x1e7ed5||_0x9ba2('0x40');_0x466156=_0x466156||'';_0x1f6f63=_0x1f6f63===undefined?-0x1:_0x1f6f63==='-1'?-0x1:_0x1f6f63*0x3e8;_0x4a8623=_0x4a8623===undefined?'':'s='+_0x4a8623;_0x4890a7=_0x4890a7?_0x9ba2('0x41'):'';return this['sendRequest'](util[_0x9ba2('0x26')](_0x9ba2('0x42'),_0x3715e2,_0x1e7ed5,_0x466156,_0x1f6f63,_0x4890a7,_0x4a8623));};AGIChannel['prototype'][_0x9ba2('0x43')]=function(_0x2bc253,_0x1e8a51){_0x1e8a51=_0x1e8a51||'';return this[_0x9ba2('0x20')](util[_0x9ba2('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x2bc253,_0x1e8a51));};AGIChannel['prototype'][_0x9ba2('0x44')]=function(_0xedfb82){return this[_0x9ba2('0x45')](_0x9ba2('0x46'),_0xedfb82);};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x47')]=function(_0x5dc61b){return this['exec'](_0x9ba2('0x48'),_0x5dc61b);};AGIChannel[_0x9ba2('0x23')][_0x9ba2('0x15')]=function(_0x485367,_0x28610c){this['noop'](util[_0x9ba2('0x26')](_0x9ba2('0x49'),_0x485367['id'],_0x485367[_0x9ba2('0x4a')],_0x28610c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9ba2('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d8c88ca..4eb45fd 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 _0x0eea=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0eea,0x9b));var _0xa0ee=function(_0x3ebfa0,_0x159fec){_0x3ebfa0=_0x3ebfa0-0x0;var _0x14086e=_0x0eea[_0x3ebfa0];return _0x14086e;};'use strict';var util=require(_0xa0ee('0x0'));var error={'E_AGI_UNDEFINED':_0xa0ee('0x1'),'E_AGI_ARGUMENT_PORT':_0xa0ee('0x2'),'E_AGI_SERVER_ERROR':_0xa0ee('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa0ee('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa0ee('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa0ee('0x6'),'E_AGI_IVR_ENTRY':_0xa0ee('0x7')};function AGIError(_0xff2b74){var _0xff2b74=_0xff2b74||null,_0x47f6f9=_0x47f6f9||[],_0x5bf8a0=0x1,_0x58c197='';if(!error[_0xff2b74]){_0xff2b74=_0xa0ee('0x8');}_0x47f6f9[_0xa0ee('0x9')](error[_0xff2b74]);while(arguments[_0x5bf8a0]){_0x47f6f9[_0xa0ee('0x9')](arguments[_0x5bf8a0]);_0x5bf8a0++;}_0x58c197=util['format'][_0xa0ee('0xa')](util,_0x47f6f9);this[_0xa0ee('0xb')]=_0x58c197;this[_0xa0ee('0xc')]=_0xff2b74;}module[_0xa0ee('0xd')]=AGIError; \ No newline at end of file +var _0x6137=['message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x6137,0x1e3));var _0x7613=function(_0xf36821,_0xae177f){_0xf36821=_0xf36821-0x0;var _0x5d954b=_0x6137[_0xf36821];return _0x5d954b;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7613('0x0'),'E_AGI_ARGUMENT_PORT':_0x7613('0x1'),'E_AGI_SERVER_ERROR':_0x7613('0x2'),'E_AGI_SERVER_CLOSE':_0x7613('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7613('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7613('0x5'),'E_AGI_SOCKET_ERROR':_0x7613('0x6'),'E_AGI_SOCKET_CLOSE':_0x7613('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x7613('0x8'),'E_AGI_COMMAND_EMPTY':_0x7613('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7613('0xa')};function AGIError(_0x33569a){var _0x33569a=_0x33569a||null,_0x45ce2b=_0x45ce2b||[],_0x1d9258=0x1,_0x577ff1='';if(!error[_0x33569a]){_0x33569a='E_AGI_UNDEFINED';}_0x45ce2b[_0x7613('0xb')](error[_0x33569a]);while(arguments[_0x1d9258]){_0x45ce2b[_0x7613('0xb')](arguments[_0x1d9258]);_0x1d9258++;}_0x577ff1=util[_0x7613('0xc')]['apply'](util,_0x45ce2b);this[_0x7613('0xd')]=_0x577ff1;this[_0x7613('0xe')]=_0x33569a;}module[_0x7613('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8094731..37d4779 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb712=['projectUpdate','events','EventEmitter','ioredis','./error','../../config/environment','defaults','redis','localhost','agi','emit','error','E_AGI_SERVER_ERROR','parse'];(function(_0x640457,_0x6b96d1){var _0x1725dc=function(_0x4cc4fa){while(--_0x4cc4fa){_0x640457['push'](_0x640457['shift']());}};_0x1725dc(++_0x6b96d1);}(_0xb712,0xa9));var _0x2b71=function(_0x6d4e69,_0x5337c4){_0x6d4e69=_0x6d4e69-0x0;var _0x433048=_0xb712[_0x6d4e69];return _0x433048;};'use strict';var _=require('lodash');var EventEmitter=require(_0x2b71('0x0'))[_0x2b71('0x1')];var Redis=require(_0x2b71('0x2'));var AGIError=require(_0x2b71('0x3'));var config=require(_0x2b71('0x4'));config['redis']=_[_0x2b71('0x5')](config[_0x2b71('0x6')],{'host':_0x2b71('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2b71('0x6')]);sub['subscribe'](_0x2b71('0x8'),function(_0x487ccd){if(_0x487ccd)return eventEmitter[_0x2b71('0x9')](_0x2b71('0xa'),new AGIError(_0x2b71('0xb'),_0x487ccd));});sub['on']('message',function(_0x3e83db,_0x1e16cd){if(_0x3e83db!==_0x2b71('0x8'))return;try{var _0x4d96c6=JSON[_0x2b71('0xc')](_0x1e16cd);eventEmitter['emit'](_0x2b71('0xd'),_0x4d96c6);}catch(_0x2b9747){eventEmitter[_0x2b71('0x9')]('error',new AGIError(_0x2b71('0xb'),_0x2b9747));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x63cf=['emit','error','events','EventEmitter','ioredis','./error','redis','localhost','agi','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63cf,0xa2));var _0xf63c=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x63cf[_0x2ca2d0];return _0x521c23;};'use strict';var _=require('lodash');var EventEmitter=require(_0xf63c('0x0'))[_0xf63c('0x1')];var Redis=require(_0xf63c('0x2'));var AGIError=require(_0xf63c('0x3'));var config=require('../../config/environment');config[_0xf63c('0x4')]=_['defaults'](config[_0xf63c('0x4')],{'host':_0xf63c('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0xf63c('0x6'),function(_0x53197e){if(_0x53197e)return eventEmitter['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x53197e));});sub['on']('message',function(_0x4109d4,_0x24d5bc){if(_0x4109d4!==_0xf63c('0x6'))return;try{var _0x3a47bd=JSON[_0xf63c('0x7')](_0x24d5bc);eventEmitter['emit']('projectUpdate',_0x3a47bd);}catch(_0x494280){eventEmitter[_0xf63c('0x8')](_0xf63c('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x494280));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index bd3127c..212bed3 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 _0x72ca=['split','length','vswitch','default','target','agicommand','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','condition'];(function(_0x1e280b,_0xb8ce4a){var _0x11abaf=function(_0x29a3fe){while(--_0x29a3fe){_0x1e280b['push'](_0x1e280b['shift']());}};_0x11abaf(++_0xb8ce4a);}(_0x72ca,0x10d));var _0xa72c=function(_0x38411e,_0x297df0){_0x38411e=_0x38411e-0x0;var _0x85c2a5=_0x72ca[_0x38411e];return _0x85c2a5;};'use strict';var _=require(_0xa72c('0x0'));var logger=require(_0xa72c('0x1'))(_0xa72c('0x2'));var verticesWithRetry=['menu',_0xa72c('0x3'),_0xa72c('0x4')];var Graph=function(){this['vertices']={};this[_0xa72c('0x5')]={};this[_0xa72c('0x6')]=0x0;};Graph[_0xa72c('0x7')][_0xa72c('0x8')]=function(_0x4f3252){this[_0xa72c('0x9')][_0x4f3252['id']]=_0x4f3252;this[_0xa72c('0x5')][_0x4f3252['id']]=[];};Graph[_0xa72c('0x7')][_0xa72c('0xa')]=function(_0x5a0484,_0x4b20ff,_0x2c811f){this['edges'][_0x5a0484][_0xa72c('0xb')]({'target':_0x4b20ff,'condition':_0x2c811f});this['numberOfEdges']+=0x1;};Graph[_0xa72c('0x7')][_0xa72c('0xc')]=function(){return _[_0xa72c('0xc')](this['vertices']);};Graph[_0xa72c('0x7')]['relations']=function(){return this[_0xa72c('0x6')];};Graph['prototype'][_0xa72c('0xd')]=function(_0x29ca89){return this[_0xa72c('0x9')][_0x29ca89];};Graph[_0xa72c('0x7')][_0xa72c('0xe')]=function(_0x3fbbe0,_0x59af7f){if(!this['vertices'][_0x3fbbe0]){return logger[_0xa72c('0xf')](_0xa72c('0x10'));}var _0x578dfa=_0x59af7f(this['vertices'][_0x3fbbe0]);if(!_0x578dfa){return logger[_0xa72c('0xf')](_0xa72c('0x11'));}if(this[_0xa72c('0x5')][_0x3fbbe0]['length']===0x0){return logger[_0xa72c('0xf')]('no\x20edge/s\x20available');}for(var _0x1ddd6e=0x0,_0x401293=[],_0x4ae6b5=![];_0x1ddd6e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','./server','listening','lodash','syncho','util','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults','nextTick','error','stack','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','debug'];(function(_0x3a4200,_0x2b2eef){var _0x2a3713=function(_0x1800f0){while(--_0x1800f0){_0x3a4200['push'](_0x3a4200['shift']());}};_0x2a3713(++_0x2b2eef);}(_0xd4cb,0x130));var _0xbd4c=function(_0x1e2aa5,_0x271cd4){_0x1e2aa5=_0x1e2aa5-0x0;var _0xdf8c10=_0xd4cb[_0x1e2aa5];return _0xdf8c10;};'use strict';var _=require(_0xbd4c('0x0'));var syncho=require(_0xbd4c('0x1'));var util=require(_0xbd4c('0x2'));var config=require('../../config/environment');var logger=require(_0xbd4c('0x3'))('agi');var utilLicense=require(_0xbd4c('0x4'));var rpc=require('./rpc');var Project=require(_0xbd4c('0x5'));var AGIEmitter=require(_0xbd4c('0x6'))[_0xbd4c('0x7')];var projects=[];config[_0xbd4c('0x8')]=_[_0xbd4c('0x9')](config[_0xbd4c('0x8')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x197107){process[_0xbd4c('0xa')](function(){syncho(function(){try{setChannelVariables(_0x197107);agiHandler(_0x197107);}catch(_0x114fb5){logger[_0xbd4c('0xb')](_0x114fb5[_0xbd4c('0xc')]);}});});}function projectUpdateHandler(_0x26f88a){try{var _0x28d7d2=_['findIndex'](projects,['id',_0x26f88a['id']]);if(_0x28d7d2>-0x1){if(_0x26f88a[_0xbd4c('0xd')]===!![]){projects['splice'](_0x28d7d2,0x1);}else{projects[_0x28d7d2]=_0x26f88a;}}else{projects[_0xbd4c('0xe')](_0x26f88a);}}catch(_0x2033f0){logger[_0xbd4c('0xb')](_0x2033f0[_0xbd4c('0xc')]);}}function listeningHandler(){console[_0xbd4c('0xf')](_0xbd4c('0x10'),config[_0xbd4c('0x8')][_0xbd4c('0x11')]);logger[_0xbd4c('0x12')](util[_0xbd4c('0x13')](_0xbd4c('0x14'),config[_0xbd4c('0x8')]['ip'],config[_0xbd4c('0x8')]['port']));}function errorHandler(_0x5c1baa){if(_0x5c1baa&&_0x5c1baa[_0xbd4c('0x15')]&&_0x5c1baa[_0xbd4c('0x16')]){logger[_0xbd4c('0xb')](util[_0xbd4c('0x13')](_0xbd4c('0x17'),_0x5c1baa[_0xbd4c('0x15')],_0x5c1baa[_0xbd4c('0x16')]));}else{logger['error'](util[_0xbd4c('0x13')]('[ERROR]\x20%s',_0x5c1baa['stack']));}}function closeHandler(){logger[_0xbd4c('0x12')](util['format'](_0xbd4c('0x18'),this[_0xbd4c('0x19')],this[_0xbd4c('0x1a')],this[_0xbd4c('0x1b')],this[_0xbd4c('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x693bd){logger['error'](_0x693bd['stack']);}}function timeoutHandler(){logger[_0xbd4c('0x12')](util['format'](_0xbd4c('0x1d'),this[_0xbd4c('0x19')],this[_0xbd4c('0x1a')],this[_0xbd4c('0x1b')],this[_0xbd4c('0x1c')],this[_0xbd4c('0x1e')]));}function hangupHandler(){logger['info'](util[_0xbd4c('0x13')](_0xbd4c('0x1f'),this[_0xbd4c('0x19')],this[_0xbd4c('0x1a')],this[_0xbd4c('0x1b')],this[_0xbd4c('0x1c')],this[_0xbd4c('0x1e')]));this[_0xbd4c('0x20')]=!![];}function createSquareReport(_0x4240a,_0x2aa8c3){rpc[_0xbd4c('0x21')](_0x4240a)[_0xbd4c('0x22')](function(_0x493a18){if(_0x2aa8c3){_0x2aa8c3(null,_0x493a18);}})['catch'](function(_0x2498d7){if(_0x2aa8c3){_0x2aa8c3(null,_0x2498d7);}});}function setChannelVariables(_0x16f10d){for(var _0xc06d38 in _0x16f10d){if(_0x16f10d[_0xbd4c('0x23')](_0xc06d38)){if(_0xc06d38[_0xbd4c('0x24')]('agi_')===0x0){_0x16f10d[_0xc06d38['substring'](0x4)]=_0x16f10d[_0xc06d38];delete _0x16f10d[_0xc06d38];}}}}function agiHandler(_0x2210e3){logger[_0xbd4c('0x25')](_0xbd4c('0x26'),JSON[_0xbd4c('0x27')](_0x2210e3,null,0x2));logger[_0xbd4c('0x12')](util['format'](_0xbd4c('0x28'),_0x2210e3['arg_1'],_0x2210e3[_0xbd4c('0x1a')],_0x2210e3[_0xbd4c('0x1b')],_0x2210e3[_0xbd4c('0x1c')],_0x2210e3['uniqueid']));_0x2210e3['on'](_0xbd4c('0xb'),errorHandler);_0x2210e3['on'](_0xbd4c('0x29'),closeHandler);_0x2210e3['on'](_0xbd4c('0x2a'),timeoutHandler);_0x2210e3[_0xbd4c('0x20')]=![];_0x2210e3['on'](_0xbd4c('0x2b'),hangupHandler);var _0x405333=_[_0xbd4c('0x2c')](projects,['name',_0x2210e3[_0xbd4c('0x19')]]);if(!_0x405333)return Project[_0xbd4c('0x2d')](_0x2210e3);if(!_0x405333[_0xbd4c('0x2e')])return Project['handleUnpublished'](_0x2210e3);return Project[_0xbd4c('0x2f')](_0x405333,_0x2210e3);}function main(){var _0x2022cd;return utilLicense[_0xbd4c('0x30')]()['then'](function(_0x3596bf){if(!_0x3596bf)return;if(_0x3596bf['voice']){if(_0x3596bf[_0xbd4c('0x31')]&&_0x3596bf[_0xbd4c('0x31')]>0x0){logger[_0xbd4c('0x12')](util[_0xbd4c('0x13')](_0xbd4c('0x32'),_0x3596bf[_0xbd4c('0x31')]));_0x2022cd=_0x3596bf[_0xbd4c('0x31')];}else{logger[_0xbd4c('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xbd4c('0x12')](_0xbd4c('0x33'));_0x2022cd=-0x1;}})['then'](function(){return Project[_0xbd4c('0x34')]();})[_0xbd4c('0x22')](function(_0x6904b0){projects=_0x6904b0;return;})[_0xbd4c('0x35')](function(_0x5545ab){logger[_0xbd4c('0xb')](_0xbd4c('0x36'),_0x5545ab['stack']);})['finally'](function(){var _0x142b93=require(_0xbd4c('0x37'))(config[_0xbd4c('0x8')][_0xbd4c('0x11')],config[_0xbd4c('0x8')]['ip'],_0x2022cd);_0x142b93['on'](_0xbd4c('0xb'),errorHandler);_0x142b93['on'](_0xbd4c('0x38'),listeningHandler);_0x142b93['on']('connection',connectionHandler);_0x142b93['on'](_0xbd4c('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0xfa46=['[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','error','findIndex','splice','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','production','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED'];(function(_0x5ee0fb,_0x8d23c2){var _0x204bf0=function(_0x1ceb52){while(--_0x1ceb52){_0x5ee0fb['push'](_0x5ee0fb['shift']());}};_0x204bf0(++_0x8d23c2);}(_0xfa46,0xbb));var _0x6fa4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa46[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6fa4('0x0'));var syncho=require(_0x6fa4('0x1'));var util=require(_0x6fa4('0x2'));var config=require(_0x6fa4('0x3'));var logger=require('../../config/logger')(_0x6fa4('0x4'));var utilLicense=require(_0x6fa4('0x5'));var rpc=require(_0x6fa4('0x6'));var Project=require(_0x6fa4('0x7'));var AGIEmitter=require(_0x6fa4('0x8'))[_0x6fa4('0x9')];var projects=[];config['agi']=_['defaults'](config['agi'],{'ip':_0x6fa4('0xa'),'port':0x11dd});AGIEmitter['on'](_0x6fa4('0xb'),projectUpdateHandler);function connectionHandler(_0x486bf5){process[_0x6fa4('0xc')](function(){syncho(function(){try{setChannelVariables(_0x486bf5);agiHandler(_0x486bf5);}catch(_0x2d42b6){logger[_0x6fa4('0xd')](_0x2d42b6['stack']);}});});}function projectUpdateHandler(_0x54b724){try{var _0x46a3fc=_[_0x6fa4('0xe')](projects,['id',_0x54b724['id']]);if(_0x46a3fc>-0x1){if(_0x54b724['deleted']===!![]){projects[_0x6fa4('0xf')](_0x46a3fc,0x1);}else{projects[_0x46a3fc]=_0x54b724;}}else{projects[_0x6fa4('0x10')](_0x54b724);}}catch(_0x5f4fde){logger[_0x6fa4('0xd')](_0x5f4fde[_0x6fa4('0x11')]);}}function listeningHandler(){console[_0x6fa4('0x12')](_0x6fa4('0x13'),config['agi'][_0x6fa4('0x14')]);logger[_0x6fa4('0x15')](util[_0x6fa4('0x16')](_0x6fa4('0x17'),config['agi']['ip'],config['agi'][_0x6fa4('0x14')]));}function errorHandler(_0x32137d){if(_0x32137d&&_0x32137d['name']&&_0x32137d['message']){logger[_0x6fa4('0xd')](util[_0x6fa4('0x16')](_0x6fa4('0x18'),_0x32137d[_0x6fa4('0x19')],_0x32137d[_0x6fa4('0x1a')]));}else{logger[_0x6fa4('0xd')](util['format'](_0x6fa4('0x1b'),_0x32137d[_0x6fa4('0x11')]));}}function closeHandler(){logger['info'](util[_0x6fa4('0x16')](_0x6fa4('0x1c'),this[_0x6fa4('0x1d')],this[_0x6fa4('0x1e')],this[_0x6fa4('0x1f')],this[_0x6fa4('0x20')],this[_0x6fa4('0x21')]));try{createSquareReport(this);}catch(_0x1e3c4d){logger[_0x6fa4('0xd')](_0x1e3c4d[_0x6fa4('0x11')]);}}function timeoutHandler(){logger[_0x6fa4('0x15')](util[_0x6fa4('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x6fa4('0x1e')],this[_0x6fa4('0x1f')],this[_0x6fa4('0x20')],this[_0x6fa4('0x21')]));}function hangupHandler(){logger[_0x6fa4('0x15')](util[_0x6fa4('0x16')](_0x6fa4('0x22'),this[_0x6fa4('0x1d')],this[_0x6fa4('0x1e')],this[_0x6fa4('0x1f')],this[_0x6fa4('0x20')],this[_0x6fa4('0x21')]));this[_0x6fa4('0x23')]=!![];}function createSquareReport(_0x2bd323,_0x40a47e){rpc[_0x6fa4('0x24')](_0x2bd323)['then'](function(_0x312adc){if(_0x40a47e){_0x40a47e(null,_0x312adc);}})[_0x6fa4('0x25')](function(_0x549ac7){if(_0x40a47e){_0x40a47e(null,_0x549ac7);}});}function setChannelVariables(_0x1e1659){for(var _0x151146 in _0x1e1659){if(_0x1e1659[_0x6fa4('0x26')](_0x151146)){if(_0x151146[_0x6fa4('0x27')]('agi_')===0x0){_0x1e1659[_0x151146['substring'](0x4)]=_0x1e1659[_0x151146];delete _0x1e1659[_0x151146];}}}}function agiHandler(_0x515a45){logger[_0x6fa4('0x28')](_0x6fa4('0x29'),JSON['stringify'](_0x515a45,null,0x2));logger[_0x6fa4('0x15')](util[_0x6fa4('0x16')](_0x6fa4('0x2a'),_0x515a45[_0x6fa4('0x1d')],_0x515a45[_0x6fa4('0x1e')],_0x515a45[_0x6fa4('0x1f')],_0x515a45[_0x6fa4('0x20')],_0x515a45['uniqueid']));_0x515a45['on'](_0x6fa4('0xd'),errorHandler);_0x515a45['on'](_0x6fa4('0x2b'),closeHandler);_0x515a45['on'](_0x6fa4('0x2c'),timeoutHandler);_0x515a45[_0x6fa4('0x23')]=![];_0x515a45['on'](_0x6fa4('0x2d'),hangupHandler);var _0x3039d3=_[_0x6fa4('0x2e')](projects,['name',_0x515a45[_0x6fa4('0x1d')]]);if(!_0x3039d3)return Project['handleNotFound'](_0x515a45);if(!_0x3039d3[_0x6fa4('0x2f')])return Project[_0x6fa4('0x30')](_0x515a45);return Project[_0x6fa4('0x31')](_0x3039d3,_0x515a45);}function main(){var _0x4e1da8;return utilLicense[_0x6fa4('0x32')]()[_0x6fa4('0x33')](function(_0x17c24f){if(!_0x17c24f)return;if(_0x17c24f[_0x6fa4('0x34')]){if(_0x17c24f[_0x6fa4('0x35')]&&_0x17c24f[_0x6fa4('0x35')]>0x0){logger[_0x6fa4('0x15')](util['format'](_0x6fa4('0x36'),_0x17c24f[_0x6fa4('0x35')]));_0x4e1da8=_0x17c24f['callysquare'];}else{logger['info'](_0x6fa4('0x37'));}}else{logger[_0x6fa4('0x15')](_0x6fa4('0x38'));_0x4e1da8=-0x1;}})[_0x6fa4('0x33')](function(){return Project['getAll']();})[_0x6fa4('0x33')](function(_0xedad83){projects=_0xedad83;return;})[_0x6fa4('0x25')](function(_0x3f2cb4){logger['error'](_0x6fa4('0x39'),_0x3f2cb4[_0x6fa4('0x11')]);})[_0x6fa4('0x3a')](function(){var _0x17442d=require(_0x6fa4('0x3b'))(config[_0x6fa4('0x4')][_0x6fa4('0x14')],config['agi']['ip'],_0x4e1da8);_0x17442d['on'](_0x6fa4('0xd'),errorHandler);_0x17442d['on']('listening',listeningHandler);_0x17442d['on'](_0x6fa4('0x3c'),connectionHandler);_0x17442d['on'](_0x6fa4('0x2b'),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 d52312a..cba4356 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 _0xb0c0=['then','error','message','result','catch','sendMailMessage','jayson/promise','http','request'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xb0c0,0x192));var _0x0b0c=function(_0x1590c5,_0x369984){_0x1590c5=_0x1590c5-0x0;var _0x3c3afb=_0xb0c0[_0x1590c5];return _0x3c3afb;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0b0c('0x0'));var client=jayson['client'][_0x0b0c('0x1')]({'port':0x232b});function request(_0x198669,_0x276b31){return new BPromise(function(_0x478c82,_0x40d504){return client[_0x0b0c('0x2')](_0x198669,_0x276b31)[_0x0b0c('0x3')](function(_0x227f49){if(_0x227f49[_0x0b0c('0x4')]){return _0x40d504(_0x227f49[_0x0b0c('0x4')][_0x0b0c('0x5')]);}else{return _0x478c82(_0x227f49[_0x0b0c('0x6')]);}})[_0x0b0c('0x7')](function(_0x1bee8a){return _0x40d504(_0x1bee8a);});});}exports[_0x0b0c('0x8')]=function(_0x1679aa,_0xb64431){return request('SendMail',{'account':_0x1679aa,'message':_0xb64431});}; \ No newline at end of file +var _0xb7ab=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','then','error','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb7ab,0xed));var _0xbb7a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb7ab[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xbb7a('0x0'));var jayson=require(_0xbb7a('0x1'));var client=jayson['client'][_0xbb7a('0x2')]({'port':0x232b});function request(_0xf3c2c9,_0x5637c8){return new BPromise(function(_0x1d7c37,_0x467760){return client['request'](_0xf3c2c9,_0x5637c8)[_0xbb7a('0x3')](function(_0x2cc29a){if(_0x2cc29a[_0xbb7a('0x4')]){return _0x467760(_0x2cc29a[_0xbb7a('0x4')]['message']);}else{return _0x1d7c37(_0x2cc29a[_0xbb7a('0x5')]);}})[_0xbb7a('0x6')](function(_0x18c4e7){return _0x467760(_0x18c4e7);});});}exports[_0xbb7a('0x7')]=function(_0x1e8c7d,_0x316276){return request(_0xbb7a('0x8'),{'account':_0x1e8c7d,'message':_0x316276});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7e93b20..22cfc8e 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d85=['calleridname','callerid','dnid','traverseBFS','start','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','finally','isUndefined','toString','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json','../../config/logger','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','debug','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3d85,0x156));var _0x53d8=function(_0x227802,_0x10dd09){_0x227802=_0x227802-0x0;var _0x2d0b53=_0x3d85[_0x227802];return _0x2d0b53;};'use strict';var _=require(_0x53d8('0x0'));var moment=require('moment');var parser=require(_0x53d8('0x1'));var util=require('util');var logger=require(_0x53d8('0x2'))('agi');var rpc=require(_0x53d8('0x3'));var mailRpc=require(_0x53d8('0x4'));var Graph=require(_0x53d8('0x5'));var Vertices=require(_0x53d8('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x53d8('0x7')](function(_0x378ef6){logger[_0x53d8('0x8')](_0x53d8('0x9'),_0x378ef6[_0x53d8('0xa')]);return[];});}function addVertex(_0x353fe9,_0x3227ff,_0x26dd9d){_0x3227ff[_0x53d8('0xb')]=_0x26dd9d;if(_0x3227ff[_0x53d8('0xc')](_0x53d8('0xd'))){_0x3227ff[_0x53d8('0xe')]=parseInt(_0x3227ff[_0x53d8('0xd')],0xa);}_0x353fe9[_0x53d8('0xf')](_[_0x53d8('0x10')](_0x3227ff,_0x53d8('0x11')));}function initGraph(_0x4db707,_0x2e776a){var _0x21cb89=new Graph();for(var _0x2290d7 in _0x4db707){if(_0x4db707[_0x53d8('0xc')](_0x2290d7)){if(_[_0x53d8('0x12')](_0x4db707[_0x2290d7])){for(var _0x2655a1=0x0;_0x2655a1<_0x4db707[_0x2290d7]['length'];_0x2655a1+=0x1){addVertex(_0x21cb89,_0x4db707[_0x2290d7][_0x2655a1],_0x2290d7);}}else{addVertex(_0x21cb89,_0x4db707[_0x2290d7],_0x2290d7);}}}for(var _0x3e8898=0x0;_0x3e8898<_0x2e776a[_0x53d8('0x13')];_0x3e8898+=0x1){if(_0x2e776a[_0x3e8898][_0x53d8('0x14')]&&_0x2e776a[_0x3e8898][_0x53d8('0x15')]){_0x21cb89[_0x53d8('0x16')](_0x2e776a[_0x3e8898]['source'],_0x2e776a[_0x3e8898][_0x53d8('0x15')],_0x2e776a[_0x3e8898][_0x53d8('0x17')]);}}return _0x21cb89;}function getRoot(_0x5d5aa4){return parser[_0x53d8('0x18')](_0x5d5aa4,{'object':!![]})[_0x53d8('0x19')]['root'];}function inspect(_0x3cc268){return util[_0x53d8('0x1a')](_0x3cc268,{'showHidden':![],'depth':null});}function initialize(_0x31eabe,_0x4d98bc){var _0x3d7868=getRoot(_0x31eabe[_0x53d8('0x1b')]);if(!_0x3d7868||!_0x3d7868['start'])return;var _0x4f5d73,_0xb1c805,_0xff5f47;logger[_0x53d8('0x1c')](_0x53d8('0x1d'),JSON['stringify'](_0x3d7868,null,0x2));_0x4d98bc[_0x53d8('0x1e')]=moment()[_0x53d8('0x1f')](_0x53d8('0x20'));_0x4f5d73=initGraph(_[_0x53d8('0x10')](_0x3d7868,_0x53d8('0x11')),_0x3d7868[_0x53d8('0x11')]);_0xb1c805=new Vertices(_0x4d98bc,rpc,mailRpc);logger[_0x53d8('0x21')](util[_0x53d8('0x1f')](_0x53d8('0x22'),_0x4d98bc[_0x53d8('0x23')],_0x4d98bc[_0x53d8('0x24')],_0x4d98bc[_0x53d8('0x25')],_0x4d98bc[_0x53d8('0x26')],_0x4d98bc['uniqueid']));_0x4f5d73[_0x53d8('0x27')](_0x3d7868[_0x53d8('0x28')]['id'],function(_0x248557){try{_0x248557=_0xb1c805[_0x53d8('0x29')](_0x248557);logger['debug'](_0x53d8('0x2a'),JSON[_0x53d8('0x2b')](_0x248557,null,0x2));if(_0x248557[_0x53d8('0xb')]===_0x53d8('0x2c')){logger[_0x53d8('0x21')](_0x53d8('0x2d'));_0x4d98bc[_0x53d8('0x2e')]=_0x248557[_0x53d8('0x2e')]||_0x4d98bc['context'];_0x4d98bc['extension']=_0x248557[_0x53d8('0x2f')];_0x4d98bc[_0x53d8('0x30')]=_0x248557[_0x53d8('0x30')]?_0x248557[_0x53d8('0x30')]-0x1:0x1;return null;}else if(_0x248557&&_0xb1c805[_0x248557[_0x53d8('0xb')]]){_0xff5f47=_0xb1c805[_0x248557[_0x53d8('0xb')]](_0x248557);logger['info']('response',JSON[_0x53d8('0x2b')](_0xff5f47,null,0x2));if(_0xff5f47&&_0xff5f47[_0x53d8('0x31')]===AGI_CODE_SUCCESS&&_0xff5f47[_0x53d8('0x32')]!==AGI_RESULT_ERROR&&!_0x4d98bc[_0x53d8('0x33')]){logger[_0x53d8('0x1c')]('response',inspect(_0xff5f47));return _['isUndefined'](_0xff5f47['result'])?null:_0xff5f47['result']['toString']();}else{logger[_0x53d8('0x8')](_0x53d8('0x34'),inspect(_0xff5f47));return null;}}else{logger[_0x53d8('0x8')](_0x53d8('0x35'));return null;}}catch(_0x3bf98c){logger[_0x53d8('0x8')](_0x3bf98c[_0x53d8('0xa')]);return null;}});if(_0x3d7868['finally']){logger[_0x53d8('0x21')](util[_0x53d8('0x1f')](_0x53d8('0x36'),_0x4d98bc[_0x53d8('0x23')],_0x4d98bc['calleridname'],_0x4d98bc['callerid'],_0x4d98bc[_0x53d8('0x26')],_0x4d98bc[_0x53d8('0x37')]));_0x4f5d73[_0x53d8('0x27')](_0x3d7868[_0x53d8('0x38')]['id'],function(_0x23d5d5){try{_0x23d5d5=_0xb1c805[_0x53d8('0x29')](_0x23d5d5);logger[_0x53d8('0x1c')]('vertex',JSON[_0x53d8('0x2b')](_0x23d5d5,null,0x2));if(_0x23d5d5&&_0xb1c805[_0x23d5d5[_0x53d8('0xb')]]){_0xff5f47=_0xb1c805[_0x23d5d5[_0x53d8('0xb')]](_0x23d5d5);if(_0xff5f47){logger['debug']('response',inspect(_0xff5f47));return _[_0x53d8('0x39')](_0xff5f47[_0x53d8('0x32')])?null:_0xff5f47[_0x53d8('0x32')][_0x53d8('0x3a')]();}else{logger[_0x53d8('0x8')](_0x53d8('0x34'),inspect(_0xff5f47));return null;}}else{logger[_0x53d8('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x5a454f){logger[_0x53d8('0x8')](_0x5a454f[_0x53d8('0xa')]);return null;}});}logger[_0x53d8('0x21')](util[_0x53d8('0x1f')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4d98bc[_0x53d8('0x23')],_0x4d98bc['calleridname'],_0x4d98bc[_0x53d8('0x25')],_0x4d98bc[_0x53d8('0x26')],_0x4d98bc['uniqueid']));logger[_0x53d8('0x21')](util[_0x53d8('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4d98bc[_0x53d8('0x2e')],_0x4d98bc[_0x53d8('0x2f')],parseInt(_0x4d98bc[_0x53d8('0x30')],0xa)+0x1));_0x4d98bc[_0x53d8('0x3b')](_0x4d98bc[_0x53d8('0x2e')],_0x4d98bc[_0x53d8('0x2f')],parseInt(_0x4d98bc[_0x53d8('0x30')],0xa)+0x1);_0x4d98bc[_0x53d8('0x3c')]();}function handleNotFound(_0x37abdc){logger[_0x53d8('0x8')](util[_0x53d8('0x1f')](_0x53d8('0x3d'),_0x37abdc[_0x53d8('0x23')]));_0x37abdc[_0x53d8('0x3b')](_0x37abdc[_0x53d8('0x2e')],_0x37abdc['extension'],parseInt(_0x37abdc['priority'],0xa)+0x1);_0x37abdc[_0x53d8('0x3c')]();}function handleUnpublished(_0x584366){logger[_0x53d8('0x8')](util[_0x53d8('0x1f')]('Project\x20%s\x20not\x20published',_0x584366[_0x53d8('0x23')]));_0x584366['continueAt'](_0x584366['context'],_0x584366[_0x53d8('0x2f')],parseInt(_0x584366[_0x53d8('0x30')],0xa)+0x1);_0x584366[_0x53d8('0x3c')]();}module[_0x53d8('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x2d33=['extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./vertices','catch','error','stack','agicommand','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','start','debug','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d33,0x1c5));var _0x32d3=function(_0xb4a11,_0x2f4b5b){_0xb4a11=_0xb4a11-0x0;var _0x32a010=_0x2d33[_0xb4a11];return _0x32a010;};'use strict';var _=require(_0x32d3('0x0'));var moment=require(_0x32d3('0x1'));var parser=require(_0x32d3('0x2'));var util=require(_0x32d3('0x3'));var logger=require('../../config/logger')(_0x32d3('0x4'));var rpc=require(_0x32d3('0x5'));var mailRpc=require(_0x32d3('0x6'));var Graph=require('./graph');var Vertices=require(_0x32d3('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x32d3('0x8')](function(_0x1daf2d){logger[_0x32d3('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1daf2d[_0x32d3('0xa')]);return[];});}function addVertex(_0x596284,_0x347aac,_0x3a5c75){_0x347aac[_0x32d3('0xb')]=_0x3a5c75;if(_0x347aac['hasOwnProperty'](_0x32d3('0xc'))){_0x347aac[_0x32d3('0xd')]=parseInt(_0x347aac['retry'],0xa);}_0x596284[_0x32d3('0xe')](_['omit'](_0x347aac,_0x32d3('0xf')));}function initGraph(_0x315c34,_0x552f16){var _0x17af71=new Graph();for(var _0x4d47d8 in _0x315c34){if(_0x315c34['hasOwnProperty'](_0x4d47d8)){if(_[_0x32d3('0x10')](_0x315c34[_0x4d47d8])){for(var _0x50f5bd=0x0;_0x50f5bd<_0x315c34[_0x4d47d8][_0x32d3('0x11')];_0x50f5bd+=0x1){addVertex(_0x17af71,_0x315c34[_0x4d47d8][_0x50f5bd],_0x4d47d8);}}else{addVertex(_0x17af71,_0x315c34[_0x4d47d8],_0x4d47d8);}}}for(var _0x229055=0x0;_0x229055<_0x552f16['length'];_0x229055+=0x1){if(_0x552f16[_0x229055][_0x32d3('0x12')]&&_0x552f16[_0x229055][_0x32d3('0x13')]){_0x17af71[_0x32d3('0x14')](_0x552f16[_0x229055]['source'],_0x552f16[_0x229055]['target'],_0x552f16[_0x229055][_0x32d3('0x15')]);}}return _0x17af71;}function getRoot(_0x3df316){return parser[_0x32d3('0x16')](_0x3df316,{'object':!![]})[_0x32d3('0x17')]['root'];}function inspect(_0x23f4b2){return util['inspect'](_0x23f4b2,{'showHidden':![],'depth':null});}function initialize(_0x25572f,_0x224beb){var _0x1c02ab=getRoot(_0x25572f['production']);if(!_0x1c02ab||!_0x1c02ab[_0x32d3('0x18')])return;var _0x1fdd65,_0x2749c7,_0x4f902f;logger[_0x32d3('0x19')](_0x32d3('0x1a'),JSON['stringify'](_0x1c02ab,null,0x2));_0x224beb[_0x32d3('0x1b')]=moment()[_0x32d3('0x1c')](_0x32d3('0x1d'));_0x1fdd65=initGraph(_['omit'](_0x1c02ab,_0x32d3('0xf')),_0x1c02ab[_0x32d3('0xf')]);_0x2749c7=new Vertices(_0x224beb,rpc,mailRpc);logger[_0x32d3('0x1e')](util[_0x32d3('0x1c')](_0x32d3('0x1f'),_0x224beb[_0x32d3('0x20')],_0x224beb[_0x32d3('0x21')],_0x224beb[_0x32d3('0x22')],_0x224beb['dnid'],_0x224beb[_0x32d3('0x23')]));_0x1fdd65[_0x32d3('0x24')](_0x1c02ab[_0x32d3('0x18')]['id'],function(_0x4287e2){try{_0x4287e2=_0x2749c7[_0x32d3('0x25')](_0x4287e2);logger[_0x32d3('0x19')](_0x32d3('0x26'),JSON[_0x32d3('0x27')](_0x4287e2,null,0x2));if(_0x4287e2[_0x32d3('0xb')]===_0x32d3('0x28')){logger[_0x32d3('0x1e')](_0x32d3('0x29'));_0x224beb[_0x32d3('0x2a')]=_0x4287e2[_0x32d3('0x2a')]||_0x224beb['context'];_0x224beb[_0x32d3('0x2b')]=_0x4287e2[_0x32d3('0x2b')];_0x224beb[_0x32d3('0x2c')]=_0x4287e2['priority']?_0x4287e2['priority']-0x1:0x1;return null;}else if(_0x4287e2&&_0x2749c7[_0x4287e2[_0x32d3('0xb')]]){_0x4f902f=_0x2749c7[_0x4287e2['agicommand']](_0x4287e2);logger[_0x32d3('0x1e')](_0x32d3('0x2d'),JSON[_0x32d3('0x27')](_0x4f902f,null,0x2));if(_0x4f902f&&_0x4f902f[_0x32d3('0x2e')]===AGI_CODE_SUCCESS&&_0x4f902f['result']!==AGI_RESULT_ERROR&&!_0x224beb[_0x32d3('0x2f')]){logger['debug'](_0x32d3('0x2d'),inspect(_0x4f902f));return _[_0x32d3('0x30')](_0x4f902f['result'])?null:_0x4f902f[_0x32d3('0x31')][_0x32d3('0x32')]();}else{logger[_0x32d3('0x9')](_0x32d3('0x2d'),inspect(_0x4f902f));return null;}}else{logger['error'](_0x32d3('0x33'));return null;}}catch(_0x4f10b9){logger[_0x32d3('0x9')](_0x4f10b9['stack']);return null;}});if(_0x1c02ab[_0x32d3('0x34')]){logger['info'](util[_0x32d3('0x1c')](_0x32d3('0x35'),_0x224beb[_0x32d3('0x20')],_0x224beb['calleridname'],_0x224beb[_0x32d3('0x22')],_0x224beb['dnid'],_0x224beb[_0x32d3('0x23')]));_0x1fdd65[_0x32d3('0x24')](_0x1c02ab[_0x32d3('0x34')]['id'],function(_0x240d12){try{_0x240d12=_0x2749c7[_0x32d3('0x25')](_0x240d12);logger['debug']('vertex',JSON[_0x32d3('0x27')](_0x240d12,null,0x2));if(_0x240d12&&_0x2749c7[_0x240d12['agicommand']]){_0x4f902f=_0x2749c7[_0x240d12['agicommand']](_0x240d12);if(_0x4f902f){logger[_0x32d3('0x19')](_0x32d3('0x2d'),inspect(_0x4f902f));return _[_0x32d3('0x30')](_0x4f902f['result'])?null:_0x4f902f[_0x32d3('0x31')]['toString']();}else{logger['error']('response',inspect(_0x4f902f));return null;}}else{logger[_0x32d3('0x9')](_0x32d3('0x33'));return null;}}catch(_0x19f446){logger['error'](_0x19f446['stack']);return null;}});}logger['info'](util[_0x32d3('0x1c')](_0x32d3('0x36'),_0x224beb[_0x32d3('0x20')],_0x224beb[_0x32d3('0x21')],_0x224beb['callerid'],_0x224beb[_0x32d3('0x37')],_0x224beb[_0x32d3('0x23')]));logger[_0x32d3('0x1e')](util[_0x32d3('0x1c')](_0x32d3('0x38'),_0x224beb[_0x32d3('0x2a')],_0x224beb[_0x32d3('0x2b')],parseInt(_0x224beb[_0x32d3('0x2c')],0xa)+0x1));_0x224beb[_0x32d3('0x39')](_0x224beb[_0x32d3('0x2a')],_0x224beb[_0x32d3('0x2b')],parseInt(_0x224beb[_0x32d3('0x2c')],0xa)+0x1);_0x224beb[_0x32d3('0x3a')]();}function handleNotFound(_0x42033d){logger[_0x32d3('0x9')](util['format'](_0x32d3('0x3b'),_0x42033d['arg_1']));_0x42033d[_0x32d3('0x39')](_0x42033d[_0x32d3('0x2a')],_0x42033d[_0x32d3('0x2b')],parseInt(_0x42033d[_0x32d3('0x2c')],0xa)+0x1);_0x42033d[_0x32d3('0x3a')]();}function handleUnpublished(_0x9ecb9c){logger['error'](util[_0x32d3('0x1c')](_0x32d3('0x3c'),_0x9ecb9c[_0x32d3('0x20')]));_0x9ecb9c[_0x32d3('0x39')](_0x9ecb9c[_0x32d3('0x2a')],_0x9ecb9c[_0x32d3('0x2b')],parseInt(_0x9ecb9c[_0x32d3('0x2c')],0xa)+0x1);_0x9ecb9c[_0x32d3('0x3a')]();}module[_0x32d3('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index a0960e0..27f3699 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 _0xeadc=['slice','trim','emit','headers','line','length','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring'];(function(_0x376070,_0x170de9){var _0x1bae01=function(_0x31d717){while(--_0x31d717){_0x376070['push'](_0x376070['shift']());}};_0x1bae01(++_0x170de9);}(_0xeadc,0xdf));var _0xcead=function(_0x39d8d2,_0x8bbcad){_0x39d8d2=_0x39d8d2-0x0;var _0x35af15=_0xeadc[_0x39d8d2];return _0x35af15;};'use strict';var util=require(_0xcead('0x0'));var Transform=require('stream')[_0xcead('0x1')];function AGIReply(_0x5c6161){Transform[_0xcead('0x2')](this,_0x5c6161);this[_0xcead('0x3')]='';this[_0xcead('0x4')]=![];}util[_0xcead('0x5')](AGIReply,Transform);AGIReply[_0xcead('0x6')][_0xcead('0x7')]=function(_0x30b7b5,_0x3f1e4c,_0xa3a632){var _0x502229='\x0a',_0x26a4f5=['\x0a\x0a',_0xcead('0x8')],_0x236ab2=-0x1,_0x617299=-0x1,_0x45f9cd='',_0x4873cc=0x0,_0xb6ac6b='',_0x19102e='';this[_0xcead('0x3')]+=_0x30b7b5['toString']();_0xb6ac6b=this[_0xcead('0x3')];if(!this['_inBody']){_0x4873cc=0x0;while(_0x26a4f5[_0x4873cc]){while((_0x617299=_0xb6ac6b[_0xcead('0x9')](_0x26a4f5[_0x4873cc]))!=-0x1){_0x45f9cd=_0x26a4f5[_0x4873cc];_0x19102e=_0xb6ac6b[_0xcead('0xa')](0x0,_0x617299);_0xb6ac6b=_0xb6ac6b[_0xcead('0xa')](_0x617299+_0x45f9cd['length']);var _0xa394fe=_0x19102e['split'](_0x502229),_0x310378=0x0,_0x2f3598={},_0x41c9ab='',_0x34c06c='',_0x3d8d67=-0x1;while(_0xa394fe[_0x310378]){_0x3d8d67=_0xa394fe[_0x310378][_0xcead('0x9')](':');if(_0x3d8d67!=-0x1){_0x41c9ab=_0xa394fe[_0x310378][_0xcead('0xb')](0x0,_0x3d8d67)[_0xcead('0xc')]();_0x34c06c=_0xa394fe[_0x310378]['slice'](_0x3d8d67+0x1)['trim']();if(_0x41c9ab['length']>0x0){_0x2f3598[_0x41c9ab]=_0x34c06c;}}else{}_0x310378++;}this[_0xcead('0xd')](_0xcead('0xe'),_0x2f3598);this[_0xcead('0x4')]=!![];}_0x4873cc++;}this['_localBuffer']=_0xb6ac6b;}else{while((_0x236ab2=_0xb6ac6b[_0xcead('0x9')](_0x502229))!=-0x1){_0x19102e=_0xb6ac6b[_0xcead('0xa')](0x0,_0x236ab2);this[_0xcead('0xd')](_0xcead('0xf'),_0x19102e);_0xb6ac6b=_0xb6ac6b[_0xcead('0xa')](_0x236ab2+_0x502229[_0xcead('0x10')]);}this[_0xcead('0x3')]=_0xb6ac6b;}_0xa3a632();};module[_0xcead('0x11')]=AGIReply; \ No newline at end of file +var _0xc2d0=['call','_localBuffer','_transform','\x0d\x0a\x0d\x0a','_inBody','indexOf','substring','length','split','slice','trim','headers','emit','line','exports','util','stream','Transform'];(function(_0x5bf9a4,_0x4a94bb){var _0xc81727=function(_0x5b7648){while(--_0x5b7648){_0x5bf9a4['push'](_0x5bf9a4['shift']());}};_0xc81727(++_0x4a94bb);}(_0xc2d0,0x9f));var _0x0c2d=function(_0x187e24,_0x393e15){_0x187e24=_0x187e24-0x0;var _0x39b658=_0xc2d0[_0x187e24];return _0x39b658;};'use strict';var util=require(_0x0c2d('0x0'));var Transform=require(_0x0c2d('0x1'))[_0x0c2d('0x2')];function AGIReply(_0x462083){Transform[_0x0c2d('0x3')](this,_0x462083);this[_0x0c2d('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x0c2d('0x5')]=function(_0x38f072,_0x4be0db,_0x213d7c){var _0x28a746='\x0a',_0xb7746f=['\x0a\x0a',_0x0c2d('0x6')],_0x345122=-0x1,_0x3d52a6=-0x1,_0x170380='',_0x3f851f=0x0,_0x28adf3='',_0xcec801='';this[_0x0c2d('0x4')]+=_0x38f072['toString']();_0x28adf3=this[_0x0c2d('0x4')];if(!this[_0x0c2d('0x7')]){_0x3f851f=0x0;while(_0xb7746f[_0x3f851f]){while((_0x3d52a6=_0x28adf3[_0x0c2d('0x8')](_0xb7746f[_0x3f851f]))!=-0x1){_0x170380=_0xb7746f[_0x3f851f];_0xcec801=_0x28adf3[_0x0c2d('0x9')](0x0,_0x3d52a6);_0x28adf3=_0x28adf3[_0x0c2d('0x9')](_0x3d52a6+_0x170380[_0x0c2d('0xa')]);var _0x21bf42=_0xcec801[_0x0c2d('0xb')](_0x28a746),_0x301d3b=0x0,_0x444cd3={},_0x59b08b='',_0x27ccbf='',_0x4146d3=-0x1;while(_0x21bf42[_0x301d3b]){_0x4146d3=_0x21bf42[_0x301d3b][_0x0c2d('0x8')](':');if(_0x4146d3!=-0x1){_0x59b08b=_0x21bf42[_0x301d3b][_0x0c2d('0xc')](0x0,_0x4146d3)[_0x0c2d('0xd')]();_0x27ccbf=_0x21bf42[_0x301d3b]['slice'](_0x4146d3+0x1)[_0x0c2d('0xd')]();if(_0x59b08b[_0x0c2d('0xa')]>0x0){_0x444cd3[_0x59b08b]=_0x27ccbf;}}else{}_0x301d3b++;}this['emit'](_0x0c2d('0xe'),_0x444cd3);this[_0x0c2d('0x7')]=!![];}_0x3f851f++;}this[_0x0c2d('0x4')]=_0x28adf3;}else{while((_0x345122=_0x28adf3[_0x0c2d('0x8')](_0x28a746))!=-0x1){_0xcec801=_0x28adf3['substring'](0x0,_0x345122);this[_0x0c2d('0xf')](_0x0c2d('0x10'),_0xcec801);_0x28adf3=_0x28adf3[_0x0c2d('0x9')](_0x345122+_0x28a746[_0x0c2d('0xa')]);}this[_0x0c2d('0x4')]=_0x28adf3;}_0x213d7c();};module[_0x0c2d('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 acd9a96..83e55c2 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 _0x8ff9=['createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x56f746,_0x631ae0){var _0x478865=function(_0x10a38e){while(--_0x10a38e){_0x56f746['push'](_0x56f746['shift']());}};_0x478865(++_0x631ae0);}(_0x8ff9,0x188));var _0x98ff=function(_0x52474a,_0x23484a){_0x52474a=_0x52474a-0x0;var _0x4f66fd=_0x8ff9[_0x52474a];return _0x4f66fd;};'use strict';var _=require(_0x98ff('0x0'));var moment=require(_0x98ff('0x1'));var jayson=require(_0x98ff('0x2'));var client=jayson['client'][_0x98ff('0x3')]({'port':0x2329});function request(_0x432f67,_0x331be7){return new Promise(function(_0x16e131,_0x1619f1){return client[_0x98ff('0x4')](_0x432f67,_0x331be7)[_0x98ff('0x5')](function(_0x5a925e){if(_0x5a925e[_0x98ff('0x6')]){return _0x1619f1(_0x5a925e['error'][_0x98ff('0x7')]);}else{return _0x16e131(_0x5a925e[_0x98ff('0x8')]);}})['catch'](function(_0x421d77){return _0x1619f1(_0x421d77);});});}exports[_0x98ff('0x9')]=function(){return request(_0x98ff('0xa'),{'options':{'raw':![],'attributes':['id',_0x98ff('0xb'),_0x98ff('0xc')]}});};exports[_0x98ff('0xd')]=function(_0x4975de){return request(_0x98ff('0xe'),{'options':{'raw':![],'where':{'name':_0x4975de},'attributes':[_0x98ff('0xc')]}});};exports[_0x98ff('0xf')]=function(_0x8d837a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x8d837a},'include':[{'model':_0x98ff('0x10'),'as':_0x98ff('0x11'),'include':[{'model':_0x98ff('0x12'),'as':_0x98ff('0x12')}]}],'attributes':['id',_0x98ff('0xb'),_0x98ff('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x514ccd){return request(_0x98ff('0xe'),{'options':{'where':{'id':_0x514ccd},'attributes':['name']}});};exports[_0x98ff('0x14')]=function(_0x1c2b68){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1c2b68},'attributes':[_0x98ff('0xb')]}});};exports['getVariableById']=function(_0x18132e){return request(_0x98ff('0x15'),{'options':{'where':{'id':_0x18132e},'attributes':['name']}});};exports[_0x98ff('0x16')]=function(_0x5471d5){return request(_0x98ff('0x17'),{'options':{'where':{'id':_0x5471d5},'attributes':[_0x98ff('0x18')]}});};exports[_0x98ff('0x19')]=function(_0x4cbb53){return request('ShowUser',{'options':{'where':{'id':_0x4cbb53},'attributes':[_0x98ff('0xb')]}});};exports[_0x98ff('0x1a')]=function(_0x48ca02){return request(_0x98ff('0x1b'),{'options':{'where':{'phone':_0x48ca02[_0x98ff('0x1c')]},'attributes':['id']}});};exports[_0x98ff('0x1d')]=function(_0x1ab7eb){return request(_0x98ff('0x1e'),{'options':{'where':{'id':_0x1ab7eb},'attributes':[_0x98ff('0xb')]}});};exports[_0x98ff('0x1f')]=function(_0x258081){return request(_0x98ff('0x20'),{'options':{'where':{'id':_0x258081},'attributes':['save_name']}});};exports[_0x98ff('0x21')]=function(_0x481a72){return request(_0x98ff('0x22'),{'options':{'raw':![],'where':{'id':_0x481a72},'include':[{'model':_0x98ff('0x23'),'as':_0x98ff('0x24')}]}});};exports[_0x98ff('0x25')]=function(_0x5a1563){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5a1563},'attributes':['id',_0x98ff('0xb')]}});};exports[_0x98ff('0x26')]=function(_0x766b31){return request('CreateSmsMessage',{'body':_0x766b31});};exports[_0x98ff('0x27')]=function(_0x34d7c7){return request(_0x98ff('0x28'),{'body':_0x34d7c7});};exports[_0x98ff('0x29')]=function(_0x3f7e30){return request(_0x98ff('0x2a'),{'body':_[_0x98ff('0x2b')](_0x3f7e30,{'project_name':_0x3f7e30[_0x98ff('0x2c')],'prev_project_name':_0x3f7e30['arg_2']||'','is_subproject':_0x3f7e30[_0x98ff('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0x98ff('0x2e'))})});};exports[_0x98ff('0x2f')]=function(_0x29e5da){return request(_0x98ff('0x30'),{'body':_0x29e5da});};exports[_0x98ff('0x31')]=function(_0x9b284c){return request(_0x98ff('0x32'),{'body':_0x9b284c});};exports[_0x98ff('0x33')]=function(_0xa9787c){return request(_0x98ff('0x34'),{'options':{'raw':![],'where':{'phone':_0xa9787c[_0x98ff('0x1c')],'ListId':_0xa9787c[_0x98ff('0x35')]}}})[_0x98ff('0x5')](function(_0x3e4f74){if(_0x3e4f74){return _0x3e4f74;}return request(_0x98ff('0x36'),{'body':_0xa9787c});});};exports[_0x98ff('0x37')]=function(_0x2b686b){return request('ShowPause',{'options':{'where':{'id':_0x2b686b},'attributes':[_0x98ff('0xb')]}});};exports[_0x98ff('0x38')]=function(_0x9667e4,_0x3b4923){return request('LoginUser',{'body':{'interface':_0x3b4923},'options':{'where':_0x9667e4}});};exports[_0x98ff('0x39')]=function(_0x4ca856,_0x1d8ddd,_0x40f57d){return request(_0x98ff('0x3a'),{'body':{'type':_0x1d8ddd,'uniqueid':_0x40f57d},'options':{'where':_0x4ca856}});};exports[_0x98ff('0x3b')]=function(_0x4fdb85){return request(_0x98ff('0x3c'),{'body':{},'options':{'where':_0x4fdb85}});};exports[_0x98ff('0x3d')]=function(_0x545f93){return request(_0x98ff('0x3e'),{'body':{},'options':{'where':_0x545f93}});}; \ No newline at end of file +var _0x24a6=['production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','CloudProvider','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name'];(function(_0x21c936,_0x3ef642){var _0x2a484d=function(_0x224a4d){while(--_0x224a4d){_0x21c936['push'](_0x21c936['shift']());}};_0x2a484d(++_0x3ef642);}(_0x24a6,0x14f));var _0x624a=function(_0x2b7762,_0x17baae){_0x2b7762=_0x2b7762-0x0;var _0xd7be7a=_0x24a6[_0x2b7762];return _0xd7be7a;};'use strict';var _=require(_0x624a('0x0'));var moment=require('moment');var jayson=require(_0x624a('0x1'));var client=jayson[_0x624a('0x2')][_0x624a('0x3')]({'port':0x2329});function request(_0x346672,_0x3074cb){return new Promise(function(_0x45aae2,_0x389f10){return client[_0x624a('0x4')](_0x346672,_0x3074cb)[_0x624a('0x5')](function(_0x16d101){if(_0x16d101[_0x624a('0x6')]){return _0x389f10(_0x16d101[_0x624a('0x6')][_0x624a('0x7')]);}else{return _0x45aae2(_0x16d101[_0x624a('0x8')]);}})[_0x624a('0x9')](function(_0x40cb85){return _0x389f10(_0x40cb85);});});}exports[_0x624a('0xa')]=function(){return request(_0x624a('0xb'),{'options':{'raw':![],'attributes':['id',_0x624a('0xc'),_0x624a('0xd')]}});};exports[_0x624a('0xe')]=function(_0x1339df){return request(_0x624a('0xf'),{'options':{'raw':![],'where':{'name':_0x1339df},'attributes':['production']}});};exports['getMailAccountById']=function(_0x223846){return request(_0x624a('0x10'),{'options':{'raw':![],'where':{'id':_0x223846},'include':[{'model':_0x624a('0x11'),'as':'Smtp','include':[{'model':_0x624a('0x12'),'as':_0x624a('0x12')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x10080e){return request('ShowSquareProject',{'options':{'where':{'id':_0x10080e},'attributes':[_0x624a('0xc')]}});};exports[_0x624a('0x13')]=function(_0xe310b4){return request(_0x624a('0x14'),{'options':{'where':{'id':_0xe310b4},'attributes':['name']}});};exports[_0x624a('0x15')]=function(_0x4935f4){return request(_0x624a('0x16'),{'options':{'where':{'id':_0x4935f4},'attributes':[_0x624a('0xc')]}});};exports['getSquareOdbcById']=function(_0x201751){return request(_0x624a('0x17'),{'options':{'where':{'id':_0x201751},'attributes':[_0x624a('0x18')]}});};exports[_0x624a('0x19')]=function(_0xce9cd5){return request(_0x624a('0x1a'),{'options':{'where':{'id':_0xce9cd5},'attributes':[_0x624a('0xc')]}});};exports[_0x624a('0x1b')]=function(_0x35342c){return request(_0x624a('0x1c'),{'options':{'where':{'phone':_0x35342c['phone']},'attributes':['id']}});};exports[_0x624a('0x1d')]=function(_0x5c6901){return request(_0x624a('0x1e'),{'options':{'where':{'id':_0x5c6901},'attributes':['name']}});};exports[_0x624a('0x1f')]=function(_0x37c25f){return request(_0x624a('0x20'),{'options':{'where':{'id':_0x37c25f},'attributes':[_0x624a('0x21')]}});};exports[_0x624a('0x22')]=function(_0x54e669){return request(_0x624a('0x23'),{'options':{'raw':![],'where':{'id':_0x54e669},'include':[{'model':_0x624a('0x24'),'as':_0x624a('0x25')}]}});};exports[_0x624a('0x26')]=function(_0x5dfeec){return request(_0x624a('0x27'),{'options':{'where':{'id':_0x5dfeec},'attributes':['id',_0x624a('0xc')]}});};exports[_0x624a('0x28')]=function(_0x4ba881){return request('CreateSmsMessage',{'body':_0x4ba881});};exports['createSquareDetailsReport']=function(_0x29257b){return request(_0x624a('0x29'),{'body':_0x29257b});};exports[_0x624a('0x2a')]=function(_0x26b075){return request('CreateSquareReport',{'body':_['merge'](_0x26b075,{'project_name':_0x26b075[_0x624a('0x2b')],'prev_project_name':_0x26b075[_0x624a('0x2c')]||'','is_subproject':_0x26b075['arg_2']?!![]:![],'leaveAt':moment()[_0x624a('0x2d')](_0x624a('0x2e'))})});};exports['createSquareRecording']=function(_0x5366c4){return request('CreateSquareRecording',{'body':_0x5366c4});};exports[_0x624a('0x2f')]=function(_0x86e555){return request('CreateSquareMessage',{'body':_0x86e555});};exports['createCmContact']=function(_0x59917f){return request(_0x624a('0x30'),{'options':{'raw':![],'where':{'phone':_0x59917f[_0x624a('0x31')],'ListId':_0x59917f[_0x624a('0x32')]}}})['then'](function(_0x16178d){if(_0x16178d){return _0x16178d;}return request(_0x624a('0x33'),{'body':_0x59917f});});};exports['getPauseById']=function(_0x466af4){return request('ShowPause',{'options':{'where':{'id':_0x466af4},'attributes':[_0x624a('0xc')]}});};exports[_0x624a('0x34')]=function(_0x22140a,_0x4619a8){return request('LoginUser',{'body':{'interface':_0x4619a8},'options':{'where':_0x22140a}});};exports[_0x624a('0x35')]=function(_0x16dc8a,_0x5e8983,_0x1310a3){return request(_0x624a('0x36'),{'body':{'type':_0x5e8983,'uniqueid':_0x1310a3},'options':{'where':_0x16dc8a}});};exports[_0x624a('0x37')]=function(_0x31a242){return request(_0x624a('0x38'),{'body':{},'options':{'where':_0x31a242}});};exports[_0x624a('0x39')]=function(_0x4c359c){return request('LogoutUser',{'body':{},'options':{'where':_0x4c359c}});}; \ 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 cfc5544..1738e7e 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 _0xfd6e=['./polly','exports'];(function(_0xb14c00,_0x281183){var _0x236a87=function(_0x290067){while(--_0x290067){_0xb14c00['push'](_0xb14c00['shift']());}};_0x236a87(++_0x281183);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};var polly=require(_0xefd6('0x0'));var lex=require('./lex');module[_0xefd6('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x07e8=['exports','./polly','./lex'];(function(_0x27ca2a,_0x79c1b9){var _0x14c2a=function(_0x1dccc4){while(--_0x1dccc4){_0x27ca2a['push'](_0x27ca2a['shift']());}};_0x14c2a(++_0x79c1b9);}(_0x07e8,0x10f));var _0x807e=function(_0x18a397,_0x4f7413){_0x18a397=_0x18a397-0x0;var _0x50a9b7=_0x07e8[_0x18a397];return _0x50a9b7;};var polly=require(_0x807e('0x0'));var lex=require(_0x807e('0x1'));module[_0x807e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9f2a5e1..560c20a 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64b=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xd64b[_0x498334];return _0x13bb70;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ No newline at end of file +var _0xb7e7=['./lib/api'];(function(_0x14836e,_0x46dc51){var _0x268232=function(_0x58cf1b){while(--_0x58cf1b){_0x14836e['push'](_0x14836e['shift']());}};_0x268232(++_0x46dc51);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var lex=require(_0x7b7e('0x0'));module['exports']=function(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68){return lex(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68);}; \ 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 bfc506a..febe046 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(_0x22ad62,_0x543aa8){var _0x41517f=function(_0x51ac2b){while(--_0x51ac2b){_0x22ad62['push'](_0x22ad62['shift']());}};_0x41517f(++_0x543aa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x47dde3,_0xbdd88b){var _0x3e6484=function(_0x34c2c0){while(--_0x34c2c0){_0x47dde3['push'](_0x47dde3['shift']());}};_0x3e6484(++_0xbdd88b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 45cc5fe..30018b7 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 _0xff4c=['./lib/api'];(function(_0x5786b1,_0x34e627){var _0x489292=function(_0x3a11f6){while(--_0x3a11f6){_0x5786b1['push'](_0x5786b1['shift']());}};_0x489292(++_0x34e627);}(_0xff4c,0x189));var _0xcff4=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xff4c[_0x1fb4e1];return _0x22d1b0;};'use strict';var polly=require(_0xcff4('0x0'));module['exports']=function(_0x4c91a8,_0x368b3a,_0x18e570,_0x5a45d2,_0x91f8a2,_0x5c0063,_0x372cba){return polly(_0x4c91a8,_0x368b3a,_0x18e570,_0x5a45d2,_0x91f8a2,_0x5c0063,_0x372cba);}; \ No newline at end of file +var _0x286e=['exports','./lib/api'];(function(_0x30ef51,_0x4356af){var _0x27e476=function(_0x492b31){while(--_0x492b31){_0x30ef51['push'](_0x30ef51['shift']());}};_0x27e476(++_0x4356af);}(_0x286e,0xc9));var _0xe286=function(_0x3225b4,_0x176296){_0x3225b4=_0x3225b4-0x0;var _0x2c1efb=_0x286e[_0x3225b4];return _0x2c1efb;};'use strict';var polly=require(_0xe286('0x0'));module[_0xe286('0x1')]=function(_0x279450,_0x32c16d,_0x2dffc6,_0x3bd652,_0x54501e,_0x12eae1,_0x3abe36){return polly(_0x279450,_0x32c16d,_0x2dffc6,_0x3bd652,_0x54501e,_0x12eae1,_0x3abe36);}; \ 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 aa82db7..0394e96 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 _0x0193=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4b129b,_0x15477f){var _0x2b89b7=function(_0x150d8d){while(--_0x150d8d){_0x4b129b['push'](_0x4b129b['shift']());}};_0x2b89b7(++_0x15477f);}(_0x0193,0x1a8));var _0x3019=function(_0x23589b,_0xbdd2){_0x23589b=_0x23589b-0x0;var _0x4d9d16=_0x0193[_0x23589b];return _0x4d9d16;};'use strict';var fs=require('fs');var path=require(_0x3019('0x0'));var BPromise=require(_0x3019('0x1'));var rs=require(_0x3019('0x2'));var AWS=require(_0x3019('0x3'));function pollyResult(_0x212b12,_0x1f2812,_0x3040aa){return new BPromise(function(_0x57322d,_0x5680bc){_0x212b12[_0x3019('0x4')](_0x1f2812,function(_0x45fef2,_0xc483df){if(_0x45fef2){_0x5680bc(_0x45fef2);}else if(_0xc483df){if(_0xc483df[_0x3019('0x5')]instanceof Buffer){fs['writeFile'](_0x3040aa,_0xc483df[_0x3019('0x5')],function(_0x19129f){if(_0x19129f){_0x5680bc(_0x19129f);}else{_0x57322d();}});}else{_0x5680bc(new Error(_0x3019('0x6')));}}else{_0x5680bc(new Error(_0x3019('0x7')));}});});}module[_0x3019('0x8')]=function(_0x275e9c,_0x540b7f,_0x101212,_0x1c1f2e,_0x11d82a,_0x1ef7cb,_0x312136){var _0x4a3006=new AWS[(_0x3019('0x9'))]({'accessKeyId':_0x275e9c,'secretAccessKey':_0x540b7f,'region':_0x101212});var _0x4b8097={'Text':_0x11d82a,'TextType':_0x1ef7cb||_0x3019('0xa'),'OutputFormat':_0x3019('0xb'),'VoiceId':_0x1c1f2e};return pollyResult(_0x4a3006,_0x4b8097,_0x312136);}; \ No newline at end of file +var _0xf670=['exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3de2ae,_0x39ee8e){var _0x17405c=function(_0x33f5b1){while(--_0x33f5b1){_0x3de2ae['push'](_0x3de2ae['shift']());}};_0x17405c(++_0x39ee8e);}(_0xf670,0x107));var _0x0f67=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xf670[_0xfcbcb8];return _0x1b1f97;};'use strict';var fs=require('fs');var path=require(_0x0f67('0x0'));var BPromise=require(_0x0f67('0x1'));var rs=require(_0x0f67('0x2'));var AWS=require(_0x0f67('0x3'));function pollyResult(_0x519734,_0x33a8dc,_0x425e49){return new BPromise(function(_0xd8410c,_0x403905){_0x519734[_0x0f67('0x4')](_0x33a8dc,function(_0x11baf7,_0x283029){if(_0x11baf7){_0x403905(_0x11baf7);}else if(_0x283029){if(_0x283029[_0x0f67('0x5')]instanceof Buffer){fs['writeFile'](_0x425e49,_0x283029[_0x0f67('0x5')],function(_0x12c884){if(_0x12c884){_0x403905(_0x12c884);}else{_0xd8410c();}});}else{_0x403905(new Error(_0x0f67('0x6')));}}else{_0x403905(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x0f67('0x7')]=function(_0x42df56,_0x1aeff8,_0x172853,_0x2cb481,_0x314610,_0x5754c7,_0x2814fc){var _0x1ae913=new AWS[(_0x0f67('0x8'))]({'accessKeyId':_0x42df56,'secretAccessKey':_0x1aeff8,'region':_0x172853});var _0x230ace={'Text':_0x314610,'TextType':_0x5754c7||'text','OutputFormat':_0x0f67('0x9'),'VoiceId':_0x2cb481};return pollyResult(_0x1ae913,_0x230ace,_0x2814fc);}; \ 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 5fcd2ec..607a3f3 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 _0x5d5a=['./lib/api','exports'];(function(_0x5cb4ad,_0x409d31){var _0x3747a4=function(_0x1aa7de){while(--_0x1aa7de){_0x5cb4ad['push'](_0x5cb4ad['shift']());}};_0x3747a4(++_0x409d31);}(_0x5d5a,0xf8));var _0xa5d5=function(_0x51daf5,_0x52305b){_0x51daf5=_0x51daf5-0x0;var _0x3356a4=_0x5d5a[_0x51daf5];return _0x3356a4;};'use strict';var asr=require(_0xa5d5('0x0'));module[_0xa5d5('0x1')]=function(_0x3a90c1,_0x22468d,_0x567729,_0x5d2ce0){return asr(_0x3a90c1,_0x22468d,_0x567729);}; \ No newline at end of file +var _0xf8d3=['exports'];(function(_0x521d8d,_0x591aab){var _0x2660cd=function(_0x233589){while(--_0x233589){_0x521d8d['push'](_0x521d8d['shift']());}};_0x2660cd(++_0x591aab);}(_0xf8d3,0x1ab));var _0x3f8d=function(_0x1287a6,_0x38b142){_0x1287a6=_0x1287a6-0x0;var _0x3b6196=_0xf8d3[_0x1287a6];return _0x3b6196;};'use strict';var asr=require('./lib/api');module[_0x3f8d('0x0')]=function(_0x5767b2,_0x20ab51,_0x4ba7c2,_0x410d03){return asr(_0x5767b2,_0x20ab51,_0x4ba7c2);}; \ 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 877a498..462524c 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 _0x593e=['key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x89e59,_0x21503d){var _0x222406=function(_0x31f2c9){while(--_0x31f2c9){_0x89e59['push'](_0x89e59['shift']());}};_0x222406(++_0x21503d);}(_0x593e,0xcb));var _0xe593=function(_0x1128b2,_0x3d9a41){_0x1128b2=_0x1128b2-0x0;var _0x852f2d=_0x593e[_0x1128b2];return _0x852f2d;};'use strict';var url=require(_0xe593('0x0'));var BPromise=require(_0xe593('0x1'));var fs=require('fs');var host=_0xe593('0x2');module[_0xe593('0x3')]=function(_0x43dabb,_0x184a6b,_0x2c7c48){return new BPromise(function(_0x2fa3a7,_0x550574){var _0x8a87e8;if(typeof _0x43dabb!==_0xe593('0x4')||_0x43dabb[_0xe593('0x5')]===0x0){return _0x550574(_0xe593('0x6'));}if(typeof _0x184a6b!==_0xe593('0x4')||_0x184a6b[_0xe593('0x5')]===0x0){return _0x550574(_0xe593('0x7'));}if(typeof _0x2c7c48!==_0xe593('0x8')&&(typeof _0x2c7c48!==_0xe593('0x4')||_0x2c7c48[_0xe593('0x5')]===0x0)){return _0x550574('lang\x20should\x20be\x20a\x20string');}try{_0x8a87e8=fs[_0xe593('0x9')](_0x43dabb)[_0xe593('0xa')](_0xe593('0xb'));}catch(_0x5ba75c){return _0x550574(_0x5ba75c);}return _0x2fa3a7({'method':'POST','uri':host+_0xe593('0xc')+_0x184a6b,'body':{'config':{'encoding':_0xe593('0xd'),'sampleRateHertz':_0xe593('0xe'),'languageCode':_0x2c7c48},'audio':{'content':_0x8a87e8}},'json':!![]});});}; \ No newline at end of file +var _0x4746=['POST','/v1/speech:recognize?key=','8000','url','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','toString'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x4746,0xc6));var _0x6474=function(_0x394e94,_0x352025){_0x394e94=_0x394e94-0x0;var _0x7f2bef=_0x4746[_0x394e94];return _0x7f2bef;};'use strict';var url=require(_0x6474('0x0'));var BPromise=require(_0x6474('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6474('0x2')]=function(_0x59b95a,_0xd115f7,_0x244bc5){return new BPromise(function(_0x863c56,_0x156374){var _0x1314f4;if(typeof _0x59b95a!=='string'||_0x59b95a[_0x6474('0x3')]===0x0){return _0x156374(_0x6474('0x4'));}if(typeof _0xd115f7!=='string'||_0xd115f7[_0x6474('0x3')]===0x0){return _0x156374(_0x6474('0x5'));}if(typeof _0x244bc5!==_0x6474('0x6')&&(typeof _0x244bc5!==_0x6474('0x7')||_0x244bc5[_0x6474('0x3')]===0x0)){return _0x156374(_0x6474('0x8'));}try{_0x1314f4=fs['readFileSync'](_0x59b95a)[_0x6474('0x9')]('base64');}catch(_0x5335ac){return _0x156374(_0x5335ac);}return _0x863c56({'method':_0x6474('0xa'),'uri':host+_0x6474('0xb')+_0xd115f7,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x6474('0xc'),'languageCode':_0x244bc5},'audio':{'content':_0x1314f4}},'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 c7d8a7f..bdfc426 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 _0x71ca=['exports'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x71ca,0x1da));var _0xa71c=function(_0x206e2a,_0x4f1370){_0x206e2a=_0x206e2a-0x0;var _0x542326=_0x71ca[_0x206e2a];return _0x542326;};var asr=require('./asr');module[_0xa71c('0x0')]={'asr':asr}; \ No newline at end of file +var _0x0386=['./asr','exports'];(function(_0x46c91c,_0x45169f){var _0xae55b3=function(_0x58747c){while(--_0x58747c){_0x46c91c['push'](_0x46c91c['shift']());}};_0xae55b3(++_0x45169f);}(_0x0386,0xba));var _0x6038=function(_0x5820fe,_0x2e6d6a){_0x5820fe=_0x5820fe-0x0;var _0x3ca8bd=_0x0386[_0x5820fe];return _0x3ca8bd;};var asr=require(_0x6038('0x0'));module[_0x6038('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index dd9f2ca..1cf83f1 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 _0xb619=['util','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish\x20download\x20file','close','unlink','download\x20error','pipe','data','end','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','generate','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','tmp','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','ispeechASR','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url'];(function(_0x53702a,_0x5bfd9a){var _0x4e1cc3=function(_0x9cf78c){while(--_0x9cf78c){_0x53702a['push'](_0x53702a['shift']());}};_0x4e1cc3(++_0x5bfd9a);}(_0xb619,0x10b));var _0x9b61=function(_0x1a5095,_0x279628){_0x1a5095=_0x1a5095-0x0;var _0x1a6533=_0xb619[_0x1a5095];return _0x1a6533;};'use strict';var apiai=require(_0x9b61('0x0'));var BPromise=require(_0x9b61('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x9b61('0x2'));var https=require(_0x9b61('0x3'));var md5=require(_0x9b61('0x4'));var path=require(_0x9b61('0x5'));var querystring=require(_0x9b61('0x6'));var rp=require(_0x9b61('0x7'));var rs=require('randomstring');var sox=require(_0x9b61('0x8'));var tts=require(_0x9b61('0x9'));var urlParse=require(_0x9b61('0xa'))['parse'];var util=require(_0x9b61('0xb'));var aws=require('./aws');var google=require(_0x9b61('0xc'));var sestek=require(_0x9b61('0xd'));var tilde=require('./tilde');var logger=require(_0x9b61('0xe'))(_0x9b61('0xf'));var ISPEECH_API=_0x9b61('0x10');function downloadFile(_0x1ec419,_0x58becd){return new BPromise(function(_0x5aefc8,_0x4fed95){var _0x547fa8=urlParse(_0x1ec419);var _0xb34dcc=_0x547fa8[_0x9b61('0x11')]==='https:'?https:http;var _0xf967ca={'host':_0x547fa8[_0x9b61('0x12')],'path':_0x547fa8[_0x9b61('0x5')],'headers':{'user-agent':_0x9b61('0x13')}};_0xb34dcc[_0x9b61('0x14')](_0xf967ca,function(_0x155580){if(_0x155580['statusCode']!==0xc8){logger[_0x9b61('0x15')](_0x9b61('0x16')+_0x1ec419+_0x9b61('0x17')+_0x155580[_0x9b61('0x18')]+'\x20('+_0x155580[_0x9b61('0x19')]+')');_0x4fed95(new Error(_0x9b61('0x16')+_0x1ec419+'\x20failed,\x20status\x20code\x20=\x20'+_0x155580[_0x9b61('0x18')]+'\x20('+_0x155580[_0x9b61('0x19')]+')'));return;}var _0x20e2f1=fs[_0x9b61('0x1a')](_0x58becd);_0x20e2f1['on']('finish',function(){logger['info'](_0x9b61('0x1b'));_0x20e2f1[_0x9b61('0x1c')](_0x5aefc8);});_0x20e2f1['on'](_0x9b61('0x15'),function(_0x54bd93){fs[_0x9b61('0x1d')](_0x58becd);logger[_0x9b61('0x15')](_0x9b61('0x1e'),_0x54bd93);_0x4fed95(_0x54bd93);});_0x155580[_0x9b61('0x1f')](_0x20e2f1);})['on'](_0x9b61('0x15'),function(_0x4df6cb){logger[_0x9b61('0x15')](_0x4df6cb);_0x4fed95(_0x4df6cb);})['end']();});}function uploadFile(_0x151aed){return new BPromise(function(_0xdccc4e,_0x213386){var _0x1f7bda=urlParse(_0x151aed);var _0x5e0a78=_0x1f7bda['protocol']==='https:'?https:http;var _0x4f8b6b={'host':_0x1f7bda[_0x9b61('0x12')],'path':_0x1f7bda[_0x9b61('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x5e0a78[_0x9b61('0x14')](_0x4f8b6b,function(_0x435c9c){if(_0x435c9c['statusCode']!==0xc8){_0x213386(new Error(_0x9b61('0x16')+_0x151aed+'\x20failed,\x20status\x20code\x20=\x20'+_0x435c9c[_0x9b61('0x18')]+'\x20('+_0x435c9c['statusMessage']+')'));return;}var _0x379ea4='';_0x435c9c['on'](_0x9b61('0x20'),function(_0x231b0a){_0x379ea4+=_0x231b0a;});_0x435c9c['on'](_0x9b61('0x21'),function(){_0xdccc4e(_0x379ea4);});})['on']('error',function(_0x5265ac){_0x213386(_0x5265ac);})['end']();});}function convertFile(_0x54da20,_0x5f1d0b){return new BPromise(function(_0x324bb5,_0x2be5b9){var _0xbd37e8=sox['transcode'](_0x54da20,_0x5f1d0b,{'sampleRate':0x1f40,'format':_0x9b61('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbd37e8['on'](_0x9b61('0x15'),function(_0x4db5f1){logger[_0x9b61('0x15')](_0x9b61('0x23'),_0x4db5f1);_0x2be5b9(_0x4db5f1);});_0xbd37e8['on']('end',function(){logger[_0x9b61('0x24')](_0x9b61('0x25'));_0x324bb5();});_0xbd37e8[_0x9b61('0x26')]();});}function base64Decode(_0x5ccfec,_0x1926d0){var _0x2498bc=path[_0x9b61('0x27')](__dirname,'tmp',rs[_0x9b61('0x28')](0x4)+'.wav');fs[_0x9b61('0x29')](_0x2498bc,_0x5ccfec,_0x9b61('0x2a'));return convertFile(_0x2498bc,_0x1926d0)['then'](function(){try{fs[_0x9b61('0x1d')](_0x2498bc);fs[_0x9b61('0x2b')](_0x1926d0,_0x9b61('0x2c'));}catch(_0x2aec9b){logger[_0x9b61('0x15')](_0x2aec9b);}return _0x1926d0[_0x9b61('0x2d')]('.')[0x0];});}function base64Encode(_0x44db0a){var _0x56f943=fs[_0x9b61('0x2e')](_0x44db0a);return new Buffer(_0x56f943)[_0x9b61('0x2f')](_0x9b61('0x2a'));}exports[_0x9b61('0x30')]=function(_0x487bb4,_0x275c8b,_0x285564,_0x1ab53a,_0x170549,_0x276b78){var _0x34af8e,_0x1cea5d;var _0x25e344=_0x9b61('0x31');var _0x477df6=_0x9b61('0x32')+_0x487bb4;var _0x4d4001={};if(_0x275c8b===_0x9b61('0x33')){_0x4d4001[_0x9b61('0x34')]={'ssml':_0x285564};}else{_0x4d4001[_0x9b61('0x34')]={'text':_0x285564};};_0x4d4001[_0x9b61('0x35')]={'languageCode':_0x1ab53a,'ssmlGender':_0x170549};_0x4d4001['audioConfig']={'audioEncoding':_0x9b61('0x36'),'sampleRateHertz':0x1f40};var _0x440801={'url':_0x25e344+_0x9b61('0x37')+_0x477df6,'method':_0x9b61('0x38'),'json':!![],'body':_0x4d4001};return rp(_0x440801)['then'](function(_0x195700){return new BPromise(function(_0x5b41df,_0x46894d){_0x34af8e=path[_0x9b61('0x27')](__dirname,_0x9b61('0x39'),rs['generate'](0x4)+'.mp3');var _0x429f01=Buffer['from'](_0x195700[_0x9b61('0x3a')],_0x9b61('0x2a'));return fs[_0x9b61('0x3b')](_0x34af8e,_0x429f01,function(_0x3760cf){_0x46894d(_0x3760cf);},function(_0x3392db){fs['chmodSync'](_0x34af8e,'777');_0x5b41df(_0x3392db);});});})[_0x9b61('0x3c')](function(_0x4188c4){_0x1cea5d=path[_0x9b61('0x27')](__dirname,'tmp',rs[_0x9b61('0x28')](0x4)+'.wav');return convertFile(_0x34af8e,_0x1cea5d);})[_0x9b61('0x3c')](function(){try{fs['unlink'](_0x34af8e);fs[_0x9b61('0x2b')](_0x1cea5d,'777');}catch(_0xecdd6e){logger['error'](_0xecdd6e);}logger[_0x9b61('0x24')](_0x9b61('0x3d'),_0x1cea5d[_0x9b61('0x2d')]('.')[0x0]);return _0x1cea5d['split']('.')[0x0];});};exports[_0x9b61('0x3e')]=function(_0x45200b,_0x50cdd0){var _0x3d1b59=_0x9b61('0x3f');var _0x5794db,_0x3b1817;var _0x11765a;var _0x5e7353={'encoding':_0x9b61('0x40'),'method':_0x9b61('0x38'),'timeout':0x2710,'url':_0x3d1b59,'headers':{'Content-Type':_0x9b61('0x41')},'body':_0x9b61('0x42')+encodeURIComponent(JSON[_0x9b61('0x43')]([[[_0x9b61('0x44'),JSON[_0x9b61('0x43')]([_0x45200b,_0x50cdd0||'en',![],_0x9b61('0x45')]),null,_0x9b61('0x46')]]]))};return rp(_0x5e7353)[_0x9b61('0x3c')](function(_0x54a345){try{_0x11765a=eval(_0x54a345[_0x9b61('0x47')](0x5))[0x0][0x2];}catch(_0x3f16e1){throw new Error(_0x9b61('0x48')+_0x54a345['data']);}if(!_0x11765a){if(_0x45200b[_0x9b61('0x49')]>0xc8){throw new Error(_0x9b61('0x4a'));}else{throw new Error(_0x9b61('0x4b')+_0x50cdd0+_0x9b61('0x4c'));}}try{_0x11765a=eval(_0x11765a)[0x0];}catch(_0x365a19){throw new Error(_0x9b61('0x48')+res[_0x9b61('0x20')]);}const _0x46cdbb=_0x11765a;_0x5794db=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x9b61('0x4d'));fs[_0x9b61('0x29')](_0x5794db,_0x11765a,{'encoding':_0x9b61('0x2a')});_0x3b1817=path[_0x9b61('0x27')](__dirname,_0x9b61('0x39'),rs['generate'](0x4)+_0x9b61('0x4e'));return convertFile(_0x5794db,_0x3b1817);})[_0x9b61('0x3c')](function(){try{fs[_0x9b61('0x1d')](_0x5794db);fs['chmodSync'](_0x3b1817,_0x9b61('0x2c'));}catch(_0x3274e1){logger[_0x9b61('0x15')](_0x3274e1);}logger[_0x9b61('0x24')](_0x9b61('0x4f'),_0x3b1817['split']('.')[0x0]);return _0x3b1817['split']('.')[0x0];});};exports[_0x9b61('0x50')]=function(_0x2bbeda,_0xd440ed,_0x33f199){return google[_0x9b61('0x51')](_0x2bbeda,_0xd440ed,_0x33f199)[_0x9b61('0x3c')](function(_0x46e915){logger[_0x9b61('0x24')](_0x46e915[_0x9b61('0x52')]);return rp(_0x46e915);})['then'](function(_0x45072b){var _0x429a80='';var _0x1f16f0=0x0;try{fs[_0x9b61('0x1d')](_0x2bbeda);}catch(_0x34580c){logger[_0x9b61('0x15')](_0x34580c);}if(_0x45072b&&_0x45072b['results']){_0x429a80=_0x45072b[_0x9b61('0x53')][_0x9b61('0x54')](function(_0x51989d){return _0x51989d&&_0x51989d[_0x9b61('0x55')][0x0]&&_0x51989d['alternatives'][0x0][_0x9b61('0x56')]?_0x51989d[_0x9b61('0x55')][0x0][_0x9b61('0x56')]:'';})['join']('\x0a');_0x1f16f0=_0x45072b[_0x9b61('0x53')][_0x9b61('0x54')](function(_0x2acfaf){return _0x2acfaf&&_0x2acfaf[_0x9b61('0x55')][0x0]&&_0x2acfaf['alternatives'][0x0]['confidence']?_0x2acfaf['alternatives'][0x0][_0x9b61('0x57')]:0x0;})[_0x9b61('0x58')]('\x0a');}logger[_0x9b61('0x24')](_0x9b61('0x59'),_0x429a80);logger['info'](_0x9b61('0x5a'),_0x1f16f0);return{'transcript':_0x429a80,'confidence':_0x1f16f0};})['catch'](function(_0xb4468e){logger[_0x9b61('0x15')](_0x9b61('0x5b'),_0xb4468e[_0x9b61('0x18')],_0xb4468e[_0x9b61('0x5c')],_0xb4468e[_0x9b61('0x5d')]);});};exports[_0x9b61('0x5e')]=function(_0x1a8149,_0x1cb993,_0x1bb6dc,_0xf67130){var _0x19c58a=apiai(_0x1cb993,{'language':_0xf67130||'en'});return _0x19c58a['textRequest'](_0x1bb6dc,{'sessionId':md5(_0x1a8149)})[_0x9b61('0x3c')](function(_0x53eeef){logger[_0x9b61('0x24')](JSON[_0x9b61('0x43')](_0x53eeef));return{'source':_0x53eeef['result'][_0x9b61('0x5f')],'resolvedQuery':_0x53eeef['result']['resolvedQuery'],'action':_0x53eeef[_0x9b61('0x60')][_0x9b61('0x61')],'actionIncomplete':_0x53eeef['result'][_0x9b61('0x62')],'speech':_0x53eeef[_0x9b61('0x60')]['fulfillment'][_0x9b61('0x63')],'score':_0x53eeef[_0x9b61('0x60')][_0x9b61('0x64')],'statusCode':_0x53eeef[_0x9b61('0x65')]['code'],'endConversation':_0x53eeef[_0x9b61('0x60')][_0x9b61('0x66')][_0x9b61('0x67')]||![],'isFallbackIntent':_0x53eeef[_0x9b61('0x60')][_0x9b61('0x66')][_0x9b61('0x68')]};});};exports[_0x9b61('0x69')]=function(_0x2db278,_0x5112e9,_0x46591a,_0x8815db,_0x568420,_0x3e54f0){var _0x599079=_0x8815db[_0x9b61('0x6a')](/\\n/g,'\x0a');var _0x354512={'credentials':{'private_key':_0x599079,'client_email':_0x46591a}};var _0x3153bd=new dialogflow['SessionsClient'](_0x354512);var _0x5c05c8=_0x3153bd[_0x9b61('0x6b')](_0x5112e9,md5(_0x2db278));var _0x6c9118={'session':_0x5c05c8,'queryInput':{'text':{'text':_0x568420,'languageCode':_0x3e54f0}}};return _0x3153bd[_0x9b61('0x6c')](_0x6c9118)[_0x9b61('0x3c')](function(_0x2af2cb){if(_0x2af2cb&&_0x2af2cb[_0x9b61('0x49')]){logger[_0x9b61('0x24')](_0x9b61('0x6d'),JSON[_0x9b61('0x43')](_0x2af2cb));var _0x227f5e=_0x2af2cb[0x0];if(_0x227f5e){var _0x43d319={'action':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x61')],'allRequiredParamsPresent':_0x227f5e[_0x9b61('0x6e')]['allRequiredParamsPresent'],'endConversation':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x6f')]&&_0x227f5e['queryResult'][_0x9b61('0x6f')][_0x9b61('0x70')]?_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x6f')][_0x9b61('0x70')][_0x9b61('0x71')]['boolValue']:![],'fulfillmentText':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x72')],'intentName':_0x227f5e['queryResult'][_0x9b61('0x73')][_0x9b61('0x5c')],'intentDisplayName':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x73')][_0x9b61('0x74')],'isFallbackIntent':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x73')]['isFallback'],'languageCode':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x75')],'queryText':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x76')],'responseId':_0x227f5e[_0x9b61('0x77')],'score':_0x227f5e[_0x9b61('0x6e')][_0x9b61('0x78')],'speech':_0x227f5e[_0x9b61('0x6e')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x2af2cb)};return _0x43d319;}}});};exports['tildeASR']=function(_0x20b479,_0x39abbe,_0x9a3a19,_0xdcf158){return tilde[_0x9b61('0x51')](_0x20b479,_0x39abbe,_0x9a3a19,_0xdcf158)[_0x9b61('0x3c')](function(_0x356666){try{fs[_0x9b61('0x1d')](_0x20b479);}catch(_0x40c582){logger['error'](_0x40c582);}logger['info'](_0x9b61('0x79'),_0x356666[_0x9b61('0x56')]);logger[_0x9b61('0x24')](_0x9b61('0x7a'),_0x356666[_0x9b61('0x57')]);return _0x356666;});};exports[_0x9b61('0x7b')]=function(_0x430755,_0x7d9b6e,_0x417c5d,_0x435ff2,_0x3c6c55,_0x3f3b7f){var _0x3b320b=path['resolve'](__dirname,'tmp',rs[_0x9b61('0x28')](0x4)+_0x9b61('0x4d'));var _0x5e3712;return aws['polly'](_0x430755,_0x7d9b6e,_0x417c5d,_0x435ff2,_0x3c6c55,_0x3f3b7f,_0x3b320b)[_0x9b61('0x3c')](function(){_0x5e3712=path[_0x9b61('0x27')](__dirname,_0x9b61('0x39'),rs['generate'](0x4)+_0x9b61('0x4e'));return convertFile(_0x3b320b,_0x5e3712);})[_0x9b61('0x3c')](function(){try{fs['unlink'](_0x3b320b);fs['chmodSync'](_0x5e3712,_0x9b61('0x2c'));}catch(_0xada79c){logger['error'](_0xada79c);}return _0x5e3712[_0x9b61('0x2d')]('.')[0x0];});};exports[_0x9b61('0x7c')]=function(_0x45b030,_0x53cff8,_0x2a5ea7,_0x5d1b05,_0x15a378,_0x1c33af){return aws['lex'](_0x45b030,_0x53cff8,_0x2a5ea7,_0x5d1b05,_0x15a378,_0x1c33af)['then'](function(_0x51d411){logger['info'](JSON[_0x9b61('0x43')](_0x51d411));return _0x51d411;});};exports[_0x9b61('0x7d')]=function(_0x5f2b05,_0x232dd7,_0x28d668,_0x5e063c){var _0x5b15da=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x5f2b05,encodeURIComponent(_0x232dd7),_0x28d668,_0x5e063c);var _0x2c2879=path[_0x9b61('0x27')](__dirname,'tmp',rs[_0x9b61('0x28')](0x4)+_0x9b61('0x4d'));var _0xdfa61e;return downloadFile(_0x5b15da,_0x2c2879)[_0x9b61('0x3c')](function(){_0xdfa61e=path[_0x9b61('0x27')](__dirname,_0x9b61('0x39'),rs[_0x9b61('0x28')](0x4)+_0x9b61('0x4e'));return convertFile(_0x2c2879,_0xdfa61e);})[_0x9b61('0x3c')](function(){try{fs['unlink'](_0x2c2879);fs[_0x9b61('0x2b')](_0xdfa61e,_0x9b61('0x2c'));}catch(_0x27465a){logger['error'](_0x27465a);}return _0xdfa61e[_0x9b61('0x2d')]('.')[0x0];});};exports[_0x9b61('0x7e')]=function(_0x4566cd,_0x543907,_0x271236,_0x55e592){var _0x4c8fd6=util[_0x9b61('0x7f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x543907,_0x271236,base64Encode(_0x4566cd),_0x55e592?util['format'](_0x9b61('0x80'),encodeURIComponent(_0x55e592)):_0x9b61('0x81'));return uploadFile(_0x4c8fd6)['then'](function(_0x1e2dfe){return querystring[_0x9b61('0x82')](_0x1e2dfe);});};exports[_0x9b61('0x83')]=function(_0x2ab404,_0x5b1846){return sestek[_0x9b61('0x84')](_0x2ab404,_0x5b1846)['then'](function(_0x2a8e97){logger[_0x9b61('0x24')](JSON[_0x9b61('0x43')](_0x2a8e97));var _0x178a63={'speech':_0x2a8e97[_0x9b61('0x85')],'action':_0x2a8e97[_0x9b61('0x86')]?_0x2a8e97[_0x9b61('0x86')]['CustomAction']:undefined,'actiondata':_0x2a8e97[_0x9b61('0x86')]?_0x2a8e97[_0x9b61('0x86')][_0x9b61('0x87')]:undefined};if(_0x2a8e97[_0x9b61('0x86')]&&_0x2a8e97[_0x9b61('0x86')][_0x9b61('0x88')]){return base64Decode(_0x2a8e97['channelData'][_0x9b61('0x88')]['Data'],path[_0x9b61('0x27')](__dirname,_0x9b61('0x39'),rs['generate'](0x4)+_0x9b61('0x4e')))[_0x9b61('0x3c')](function(_0x2e3507){_0x178a63[_0x9b61('0x89')]=_0x2e3507;return _0x178a63;});}return _0x178a63;});};exports[_0x9b61('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x298b=['path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','unlink','error','download\x20error','pipe','end','https:','WHAT_EVER','request\x20to\x20','data','wav','error\x20convert','info','resolve','tmp','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','generate','.mp3','from','audioContent','writeFile','.wav','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','split','googleASR','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','speech','score','status','metadata','endConversation','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','confidence','awsPolly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5'];(function(_0x6bc68,_0x162239){var _0x102cdb=function(_0x6026cb){while(--_0x6026cb){_0x6bc68['push'](_0x6bc68['shift']());}};_0x102cdb(++_0x162239);}(_0x298b,0x19a));var _0xb298=function(_0x233758,_0x4b2bb6){_0x233758=_0x233758-0x0;var _0x206aa9=_0x298b[_0x233758];return _0x206aa9;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xb298('0x0'));var fs=require('fs');var http=require(_0xb298('0x1'));var https=require(_0xb298('0x2'));var md5=require(_0xb298('0x3'));var path=require(_0xb298('0x4'));var querystring=require(_0xb298('0x5'));var rp=require(_0xb298('0x6'));var rs=require(_0xb298('0x7'));var sox=require(_0xb298('0x8'));var tts=require(_0xb298('0x9'));var urlParse=require(_0xb298('0xa'))['parse'];var util=require(_0xb298('0xb'));var aws=require('./aws');var google=require(_0xb298('0xc'));var sestek=require(_0xb298('0xd'));var tilde=require(_0xb298('0xe'));var logger=require(_0xb298('0xf'))(_0xb298('0x10'));var ISPEECH_API=_0xb298('0x11');function downloadFile(_0x8eac2b,_0x5a5bc6){return new BPromise(function(_0x236a8d,_0x15410d){var _0x4a6fd5=urlParse(_0x8eac2b);var _0x3a4e7e=_0x4a6fd5[_0xb298('0x12')]==='https:'?https:http;var _0x5aec5f={'host':_0x4a6fd5[_0xb298('0x13')],'path':_0x4a6fd5['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x3a4e7e[_0xb298('0x14')](_0x5aec5f,function(_0x2257c3){if(_0x2257c3[_0xb298('0x15')]!==0xc8){logger['error']('request\x20to\x20'+_0x8eac2b+_0xb298('0x16')+_0x2257c3[_0xb298('0x15')]+'\x20('+_0x2257c3[_0xb298('0x17')]+')');_0x15410d(new Error('request\x20to\x20'+_0x8eac2b+_0xb298('0x16')+_0x2257c3[_0xb298('0x15')]+'\x20('+_0x2257c3['statusMessage']+')'));return;}var _0xf3ba23=fs[_0xb298('0x18')](_0x5a5bc6);_0xf3ba23['on'](_0xb298('0x19'),function(){logger['info'](_0xb298('0x1a'));_0xf3ba23['close'](_0x236a8d);});_0xf3ba23['on']('error',function(_0x2fe619){fs[_0xb298('0x1b')](_0x5a5bc6);logger[_0xb298('0x1c')](_0xb298('0x1d'),_0x2fe619);_0x15410d(_0x2fe619);});_0x2257c3[_0xb298('0x1e')](_0xf3ba23);})['on'](_0xb298('0x1c'),function(_0x2ebba5){logger[_0xb298('0x1c')](_0x2ebba5);_0x15410d(_0x2ebba5);})[_0xb298('0x1f')]();});}function uploadFile(_0x124241){return new BPromise(function(_0x55ba4a,_0x4ec37a){var _0x4345f4=urlParse(_0x124241);var _0xe37fc0=_0x4345f4[_0xb298('0x12')]===_0xb298('0x20')?https:http;var _0x29f020={'host':_0x4345f4[_0xb298('0x13')],'path':_0x4345f4[_0xb298('0x4')],'headers':{'user-agent':_0xb298('0x21')}};_0xe37fc0[_0xb298('0x14')](_0x29f020,function(_0x1304fb){if(_0x1304fb[_0xb298('0x15')]!==0xc8){_0x4ec37a(new Error(_0xb298('0x22')+_0x124241+_0xb298('0x16')+_0x1304fb[_0xb298('0x15')]+'\x20('+_0x1304fb['statusMessage']+')'));return;}var _0x134dc9='';_0x1304fb['on'](_0xb298('0x23'),function(_0x56107c){_0x134dc9+=_0x56107c;});_0x1304fb['on']('end',function(){_0x55ba4a(_0x134dc9);});})['on']('error',function(_0x4da1d4){_0x4ec37a(_0x4da1d4);})[_0xb298('0x1f')]();});}function convertFile(_0x3e99e6,_0x495da5){return new BPromise(function(_0x4642ad,_0x48d2ad){var _0x22cd11=sox['transcode'](_0x3e99e6,_0x495da5,{'sampleRate':0x1f40,'format':_0xb298('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x22cd11['on'](_0xb298('0x1c'),function(_0xc0ea3c){logger[_0xb298('0x1c')](_0xb298('0x25'),_0xc0ea3c);_0x48d2ad(_0xc0ea3c);});_0x22cd11['on'](_0xb298('0x1f'),function(){logger[_0xb298('0x26')]('finish\x20to\x20convert');_0x4642ad();});_0x22cd11['start']();});}function base64Decode(_0x6b8873,_0x4e1b8b){var _0x1bc118=path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs['generate'](0x4)+'.wav');fs[_0xb298('0x29')](_0x1bc118,_0x6b8873,_0xb298('0x2a'));return convertFile(_0x1bc118,_0x4e1b8b)[_0xb298('0x2b')](function(){try{fs[_0xb298('0x1b')](_0x1bc118);fs[_0xb298('0x2c')](_0x4e1b8b,_0xb298('0x2d'));}catch(_0x2c393f){logger['error'](_0x2c393f);}return _0x4e1b8b['split']('.')[0x0];});}function base64Encode(_0x3c7a7a){var _0x1ddcfe=fs[_0xb298('0x2e')](_0x3c7a7a);return new Buffer(_0x1ddcfe)[_0xb298('0x2f')]('base64');}exports[_0xb298('0x30')]=function(_0x4442b8,_0x19dcb6,_0x48b431,_0x5efcc3,_0x48845b,_0x2b4b9f){var _0x5342bf,_0x27f88b;var _0x3c9b60=_0xb298('0x31');var _0x49ba7d=_0xb298('0x32')+_0x4442b8;var _0xd4490f={};if(_0x19dcb6===_0xb298('0x33')){_0xd4490f[_0xb298('0x34')]={'ssml':_0x48b431};}else{_0xd4490f[_0xb298('0x34')]={'text':_0x48b431};};_0xd4490f[_0xb298('0x35')]={'languageCode':_0x5efcc3,'ssmlGender':_0x48845b};_0xd4490f['audioConfig']={'audioEncoding':_0xb298('0x36'),'sampleRateHertz':0x1f40};var _0x3e5690={'url':_0x3c9b60+'text:synthesize'+_0x49ba7d,'method':_0xb298('0x37'),'json':!![],'body':_0xd4490f};return rp(_0x3e5690)['then'](function(_0x5c556f){return new BPromise(function(_0x1933af,_0x49a970){_0x5342bf=path[_0xb298('0x27')](__dirname,'tmp',rs[_0xb298('0x38')](0x4)+_0xb298('0x39'));var _0x48edb5=Buffer[_0xb298('0x3a')](_0x5c556f[_0xb298('0x3b')],'base64');return fs[_0xb298('0x3c')](_0x5342bf,_0x48edb5,function(_0x17bb10){_0x49a970(_0x17bb10);},function(_0x4b4a4e){fs[_0xb298('0x2c')](_0x5342bf,_0xb298('0x2d'));_0x1933af(_0x4b4a4e);});});})[_0xb298('0x2b')](function(_0x574e36){_0x27f88b=path['resolve'](__dirname,_0xb298('0x28'),rs[_0xb298('0x38')](0x4)+_0xb298('0x3d'));return convertFile(_0x5342bf,_0x27f88b);})[_0xb298('0x2b')](function(){try{fs['unlink'](_0x5342bf);fs['chmodSync'](_0x27f88b,_0xb298('0x2d'));}catch(_0x468bb2){logger[_0xb298('0x1c')](_0x468bb2);}logger['info']('googleCloudTTS\x20path',_0x27f88b['split']('.')[0x0]);return _0x27f88b['split']('.')[0x0];});};exports['googleTTS']=function(_0x10527c,_0x5d1594){var _0x225198=_0xb298('0x3e');var _0x544afb,_0x83fe74;var _0x5d855d;var _0x32987f={'encoding':'utf8','method':_0xb298('0x37'),'timeout':0x2710,'url':_0x225198,'headers':{'Content-Type':_0xb298('0x3f')},'body':_0xb298('0x40')+encodeURIComponent(JSON[_0xb298('0x41')]([[['jQ1olc',JSON['stringify']([_0x10527c,_0x5d1594||'en',![],_0xb298('0x42')]),null,'generic']]]))};return rp(_0x32987f)[_0xb298('0x2b')](function(_0x5bd1e2){try{_0x5d855d=eval(_0x5bd1e2[_0xb298('0x43')](0x5))[0x0][0x2];}catch(_0x4487a8){throw new Error(_0xb298('0x44')+_0x5bd1e2[_0xb298('0x23')]);}if(!_0x5d855d){if(_0x10527c[_0xb298('0x45')]>0xc8){throw new Error(_0xb298('0x46'));}else{throw new Error(_0xb298('0x47')+_0x5d1594+_0xb298('0x48'));}}try{_0x5d855d=eval(_0x5d855d)[0x0];}catch(_0x5b22ef){throw new Error(_0xb298('0x44')+res[_0xb298('0x23')]);}const _0x56db7b=_0x5d855d;_0x544afb=path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x544afb,_0x5d855d,{'encoding':'base64'});_0x83fe74=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xb298('0x3d'));return convertFile(_0x544afb,_0x83fe74);})[_0xb298('0x2b')](function(){try{fs['unlink'](_0x544afb);fs['chmodSync'](_0x83fe74,_0xb298('0x2d'));}catch(_0x527783){logger[_0xb298('0x1c')](_0x527783);}logger['info'](_0xb298('0x49'),_0x83fe74[_0xb298('0x4a')]('.')[0x0]);return _0x83fe74[_0xb298('0x4a')]('.')[0x0];});};exports[_0xb298('0x4b')]=function(_0x25a0f5,_0x4f2667,_0x15c283){return google['asr'](_0x25a0f5,_0x4f2667,_0x15c283)[_0xb298('0x2b')](function(_0x19b05b){logger[_0xb298('0x26')](_0x19b05b[_0xb298('0x4c')]);return rp(_0x19b05b);})['then'](function(_0x3ef994){var _0x5e81da='';var _0x57df43=0x0;try{fs[_0xb298('0x1b')](_0x25a0f5);}catch(_0x27163d){logger[_0xb298('0x1c')](_0x27163d);}if(_0x3ef994&&_0x3ef994['results']){_0x5e81da=_0x3ef994[_0xb298('0x4d')][_0xb298('0x4e')](function(_0x50fcf8){return _0x50fcf8&&_0x50fcf8['alternatives'][0x0]&&_0x50fcf8[_0xb298('0x4f')][0x0][_0xb298('0x50')]?_0x50fcf8['alternatives'][0x0][_0xb298('0x50')]:'';})[_0xb298('0x51')]('\x0a');_0x57df43=_0x3ef994[_0xb298('0x4d')][_0xb298('0x4e')](function(_0x576f2b){return _0x576f2b&&_0x576f2b[_0xb298('0x4f')][0x0]&&_0x576f2b['alternatives'][0x0]['confidence']?_0x576f2b[_0xb298('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info'](_0xb298('0x52'),_0x5e81da);logger[_0xb298('0x26')](_0xb298('0x53'),_0x57df43);return{'transcript':_0x5e81da,'confidence':_0x57df43};})[_0xb298('0x54')](function(_0x5d2b6b){logger[_0xb298('0x1c')](_0xb298('0x55'),_0x5d2b6b[_0xb298('0x15')],_0x5d2b6b['name'],_0x5d2b6b[_0xb298('0x56')]);});};exports[_0xb298('0x57')]=function(_0xf42fa2,_0x3693b5,_0x5f5ba3,_0x5c0279){var _0x243afa=apiai(_0x3693b5,{'language':_0x5c0279||'en'});return _0x243afa[_0xb298('0x58')](_0x5f5ba3,{'sessionId':md5(_0xf42fa2)})[_0xb298('0x2b')](function(_0xdbe183){logger[_0xb298('0x26')](JSON[_0xb298('0x41')](_0xdbe183));return{'source':_0xdbe183[_0xb298('0x59')][_0xb298('0x5a')],'resolvedQuery':_0xdbe183[_0xb298('0x59')][_0xb298('0x5b')],'action':_0xdbe183[_0xb298('0x59')][_0xb298('0x5c')],'actionIncomplete':_0xdbe183[_0xb298('0x59')]['actionIncomplete'],'speech':_0xdbe183[_0xb298('0x59')]['fulfillment'][_0xb298('0x5d')],'score':_0xdbe183[_0xb298('0x59')][_0xb298('0x5e')],'statusCode':_0xdbe183[_0xb298('0x5f')]['code'],'endConversation':_0xdbe183[_0xb298('0x59')][_0xb298('0x60')][_0xb298('0x61')]||![],'isFallbackIntent':_0xdbe183[_0xb298('0x59')][_0xb298('0x60')]['isFallbackIntent']};});};exports[_0xb298('0x62')]=function(_0x29cfba,_0x2cf19d,_0x2749f6,_0x53e78f,_0x525c4c,_0x15f848){var _0x5f90f0=_0x53e78f['replace'](/\\n/g,'\x0a');var _0x2155bf={'credentials':{'private_key':_0x5f90f0,'client_email':_0x2749f6}};var _0x40b230=new dialogflow[(_0xb298('0x63'))](_0x2155bf);var _0x5cb693=_0x40b230[_0xb298('0x64')](_0x2cf19d,md5(_0x29cfba));var _0x50cbe6={'session':_0x5cb693,'queryInput':{'text':{'text':_0x525c4c,'languageCode':_0x15f848}}};return _0x40b230[_0xb298('0x65')](_0x50cbe6)[_0xb298('0x2b')](function(_0x2fdde4){if(_0x2fdde4&&_0x2fdde4['length']){logger[_0xb298('0x26')](_0xb298('0x66'),JSON[_0xb298('0x41')](_0x2fdde4));var _0x1319ea=_0x2fdde4[0x0];if(_0x1319ea){var _0x49baf2={'action':_0x1319ea[_0xb298('0x67')][_0xb298('0x5c')],'allRequiredParamsPresent':_0x1319ea[_0xb298('0x67')]['allRequiredParamsPresent'],'endConversation':_0x1319ea[_0xb298('0x67')]['diagnosticInfo']&&_0x1319ea['queryResult'][_0xb298('0x68')][_0xb298('0x69')]?_0x1319ea[_0xb298('0x67')][_0xb298('0x68')][_0xb298('0x69')][_0xb298('0x6a')][_0xb298('0x6b')]:![],'fulfillmentText':_0x1319ea[_0xb298('0x67')][_0xb298('0x6c')],'intentName':_0x1319ea['queryResult'][_0xb298('0x6d')][_0xb298('0x6e')],'intentDisplayName':_0x1319ea['queryResult'][_0xb298('0x6d')][_0xb298('0x6f')],'isFallbackIntent':_0x1319ea[_0xb298('0x67')][_0xb298('0x6d')]['isFallback'],'languageCode':_0x1319ea['queryResult'][_0xb298('0x70')],'queryText':_0x1319ea[_0xb298('0x67')][_0xb298('0x71')],'responseId':_0x1319ea[_0xb298('0x72')],'score':_0x1319ea['queryResult'][_0xb298('0x73')],'speech':_0x1319ea[_0xb298('0x67')][_0xb298('0x6c')],'providerResponse':JSON[_0xb298('0x41')](_0x2fdde4)};return _0x49baf2;}}});};exports[_0xb298('0x74')]=function(_0x4d6485,_0x5b88f6,_0x2dd7e1,_0x47ba3c){return tilde[_0xb298('0x75')](_0x4d6485,_0x5b88f6,_0x2dd7e1,_0x47ba3c)[_0xb298('0x2b')](function(_0x5a2eca){try{fs[_0xb298('0x1b')](_0x4d6485);}catch(_0x578883){logger[_0xb298('0x1c')](_0x578883);}logger[_0xb298('0x26')]('Tilde\x20ASR\x20transcription',_0x5a2eca[_0xb298('0x50')]);logger[_0xb298('0x26')](_0xb298('0x76'),_0x5a2eca[_0xb298('0x77')]);return _0x5a2eca;});};exports[_0xb298('0x78')]=function(_0x21bafb,_0x5013d2,_0x42d05e,_0x2cbe9b,_0x46de64,_0x2cbe36){var _0x5bb295=path['resolve'](__dirname,_0xb298('0x28'),rs[_0xb298('0x38')](0x4)+_0xb298('0x39'));var _0x8ad3ed;return aws['polly'](_0x21bafb,_0x5013d2,_0x42d05e,_0x2cbe9b,_0x46de64,_0x2cbe36,_0x5bb295)['then'](function(){_0x8ad3ed=path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs['generate'](0x4)+_0xb298('0x3d'));return convertFile(_0x5bb295,_0x8ad3ed);})[_0xb298('0x2b')](function(){try{fs['unlink'](_0x5bb295);fs['chmodSync'](_0x8ad3ed,_0xb298('0x2d'));}catch(_0x41e2b2){logger['error'](_0x41e2b2);}return _0x8ad3ed[_0xb298('0x4a')]('.')[0x0];});};exports[_0xb298('0x79')]=function(_0xa9f79c,_0x19b129,_0x57c7cb,_0x509a37,_0x4adfad,_0x2647e9){return aws['lex'](_0xa9f79c,_0x19b129,_0x57c7cb,_0x509a37,_0x4adfad,_0x2647e9)[_0xb298('0x2b')](function(_0xcda647){logger[_0xb298('0x26')](JSON['stringify'](_0xcda647));return _0xcda647;});};exports[_0xb298('0x7a')]=function(_0x5ba463,_0x5a7aca,_0x3d45ba,_0x249550){var _0x5be6d4=util['format'](_0xb298('0x7b'),ISPEECH_API,_0x5ba463,encodeURIComponent(_0x5a7aca),_0x3d45ba,_0x249550);var _0x480518=path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs[_0xb298('0x38')](0x4)+'.mp3');var _0x5196ae;return downloadFile(_0x5be6d4,_0x480518)[_0xb298('0x2b')](function(){_0x5196ae=path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x480518,_0x5196ae);})[_0xb298('0x2b')](function(){try{fs[_0xb298('0x1b')](_0x480518);fs['chmodSync'](_0x5196ae,_0xb298('0x2d'));}catch(_0x279e21){logger[_0xb298('0x1c')](_0x279e21);}return _0x5196ae[_0xb298('0x4a')]('.')[0x0];});};exports[_0xb298('0x7c')]=function(_0x3a828d,_0x439012,_0x58693a,_0x2b7e07){var _0x19451e=util[_0xb298('0x7d')](_0xb298('0x7e'),ISPEECH_API,_0x439012,_0x58693a,base64Encode(_0x3a828d),_0x2b7e07?util[_0xb298('0x7d')]('model=%s',encodeURIComponent(_0x2b7e07)):_0xb298('0x7f'));return uploadFile(_0x19451e)['then'](function(_0x21fb4b){return querystring[_0xb298('0x80')](_0x21fb4b);});};exports[_0xb298('0x81')]=function(_0x3f3928,_0x337d84){return sestek[_0xb298('0x82')](_0x3f3928,_0x337d84)[_0xb298('0x2b')](function(_0x1f5a81){logger[_0xb298('0x26')](JSON[_0xb298('0x41')](_0x1f5a81));var _0x38642c={'speech':_0x1f5a81[_0xb298('0x83')],'action':_0x1f5a81[_0xb298('0x84')]?_0x1f5a81[_0xb298('0x84')]['CustomAction']:undefined,'actiondata':_0x1f5a81[_0xb298('0x84')]?_0x1f5a81[_0xb298('0x84')][_0xb298('0x85')]:undefined};if(_0x1f5a81['channelData']&&_0x1f5a81['channelData']['AudioFromTts']){return base64Decode(_0x1f5a81['channelData'][_0xb298('0x86')][_0xb298('0x87')],path[_0xb298('0x27')](__dirname,_0xb298('0x28'),rs[_0xb298('0x38')](0x4)+'.wav'))[_0xb298('0x2b')](function(_0x498f88){_0x38642c[_0xb298('0x88')]=_0x498f88;return _0x38642c;});}return _0x38642c;});};exports[_0xb298('0x89')]=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 8f34e03..d31f8ec 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0x6818=['./nda','exports'];(function(_0x542ed0,_0x32e6bb){var _0x2298f5=function(_0x468c57){while(--_0x468c57){_0x542ed0['push'](_0x542ed0['shift']());}};_0x2298f5(++_0x32e6bb);}(_0x6818,0x140));var _0x8681=function(_0x5250d2,_0x50df3b){_0x5250d2=_0x5250d2-0x0;var _0x545b36=_0x6818[_0x5250d2];return _0x545b36;};var nda=require(_0x8681('0x0'));module[_0x8681('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 5e537d4..d5ecdf8 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 _0x3f8c=['CustomAction','custom_action_data','info','stringify','../../../../../config/logger','agi','exports','/token','password','username','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x29fe99,_0x2a4bd8){var _0x1d6acf=function(_0x2468ed){while(--_0x2468ed){_0x29fe99['push'](_0x29fe99['shift']());}};_0x1d6acf(++_0x2a4bd8);}(_0x3f8c,0x104));var _0xc3f8=function(_0x21d1b2,_0x257e3b){_0x21d1b2=_0x21d1b2-0x0;var _0x362930=_0x3f8c[_0x21d1b2];return _0x362930;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));module[_0xc3f8('0x2')]=function(_0xab5f83,_0x4de1c7){var _0x5bd5e7={'method':'POST','uri':url['resolve'](_0x4de1c7['ndauth_url'],_0xc3f8('0x3')),'form':{'grant_type':_0xc3f8('0x4'),'username':_0x4de1c7[_0xc3f8('0x5')],'password':_0x4de1c7[_0xc3f8('0x4')]},'json':!![]};return rp(_0x5bd5e7)[_0xc3f8('0x6')](function(_0x15512a){var _0x51093a={'method':_0xc3f8('0x7'),'uri':url[_0xc3f8('0x8')](_0x4de1c7[_0xc3f8('0x9')],_0xc3f8('0xa')),'body':{'type':_0x4de1c7[_0xc3f8('0xb')]||_0xc3f8('0xc'),'channelId':_0xc3f8('0xd'),'conversation':{'id':_0xab5f83['uniqueid']},'from':{'id':_0xab5f83[_0xc3f8('0xe')],'name':_0xab5f83[_0xc3f8('0xf')]},'recipient':{'id':_0xab5f83[_0xc3f8('0x10')],'name':_0xab5f83[_0xc3f8('0x11')]},'text':_0x4de1c7['text'],'channelData':{}},'headers':{'Authorization':_0xc3f8('0x12')+_0x15512a[_0xc3f8('0x13')]},'json':!![]};if(_0x4de1c7[_0xc3f8('0x14')]){_0x51093a[_0xc3f8('0x15')]['channelData'][_0xc3f8('0x16')]=_0x4de1c7[_0xc3f8('0x14')];}if(_0x4de1c7[_0xc3f8('0x17')]=='1'){_0x51093a[_0xc3f8('0x15')][_0xc3f8('0x18')][_0xc3f8('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc3f8('0x1a')};}if(_0x4de1c7[_0xc3f8('0x1b')]){_0x51093a[_0xc3f8('0x15')][_0xc3f8('0x18')][_0xc3f8('0x1c')]=_0x4de1c7[_0xc3f8('0x1b')];if(_0x4de1c7[_0xc3f8('0x1d')]){_0x51093a['body'][_0xc3f8('0x18')]['CustomActionData']=_0x4de1c7['custom_action_data'];}}logger[_0xc3f8('0x1e')](JSON[_0xc3f8('0x1f')](_0x51093a));return rp(_0x51093a);});}; \ No newline at end of file +var _0x56dc=['calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid'];(function(_0x28f922,_0x1302f8){var _0x4eceac=function(_0x2ce5a0){while(--_0x2ce5a0){_0x28f922['push'](_0x28f922['shift']());}};_0x4eceac(++_0x1302f8);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xc56d('0x0'));var url=require('url');var logger=require(_0xc56d('0x1'))(_0xc56d('0x2'));module[_0xc56d('0x3')]=function(_0x11e58b,_0x1cfc0f){var _0x500a26={'method':_0xc56d('0x4'),'uri':url[_0xc56d('0x5')](_0x1cfc0f[_0xc56d('0x6')],_0xc56d('0x7')),'form':{'grant_type':_0xc56d('0x8'),'username':_0x1cfc0f[_0xc56d('0x9')],'password':_0x1cfc0f['password']},'json':!![]};return rp(_0x500a26)[_0xc56d('0xa')](function(_0x24b556){var _0x3ac7cd={'method':_0xc56d('0x4'),'uri':url[_0xc56d('0x5')](_0x1cfc0f[_0xc56d('0xb')],_0xc56d('0xc')),'body':{'type':_0x1cfc0f[_0xc56d('0xd')]||_0xc56d('0xe'),'channelId':'Nda','conversation':{'id':_0x11e58b[_0xc56d('0xf')]},'from':{'id':_0x11e58b[_0xc56d('0x10')],'name':_0x11e58b[_0xc56d('0x11')]},'recipient':{'id':_0x11e58b['dnid'],'name':_0x11e58b[_0xc56d('0x12')]},'text':_0x1cfc0f[_0xc56d('0x13')],'channelData':{}},'headers':{'Authorization':_0xc56d('0x14')+_0x24b556[_0xc56d('0x15')]},'json':!![]};if(_0x1cfc0f['project']){_0x3ac7cd[_0xc56d('0x16')][_0xc56d('0x17')][_0xc56d('0x18')]=_0x1cfc0f['project'];}if(_0x1cfc0f[_0xc56d('0x19')]=='1'){_0x3ac7cd[_0xc56d('0x16')][_0xc56d('0x17')][_0xc56d('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x1cfc0f[_0xc56d('0x1b')]){_0x3ac7cd[_0xc56d('0x16')]['channelData']['CustomAction']=_0x1cfc0f[_0xc56d('0x1b')];if(_0x1cfc0f[_0xc56d('0x1c')]){_0x3ac7cd[_0xc56d('0x16')][_0xc56d('0x17')]['CustomActionData']=_0x1cfc0f[_0xc56d('0x1c')];}}logger['info'](JSON[_0xc56d('0x1d')](_0x3ac7cd));return rp(_0x3ac7cd);});}; \ 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 f429484..d760137 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 _0x267c=['exports','./lib/api'];(function(_0xb46ca8,_0x4f87be){var _0x52ed62=function(_0x48e5e0){while(--_0x48e5e0){_0xb46ca8['push'](_0xb46ca8['shift']());}};_0x52ed62(++_0x4f87be);}(_0x267c,0x155));var _0xc267=function(_0x43f2ca,_0x53199c){_0x43f2ca=_0x43f2ca-0x0;var _0x4fa4c1=_0x267c[_0x43f2ca];return _0x4fa4c1;};'use strict';var asr=require(_0xc267('0x0'));module[_0xc267('0x1')]=function(_0xe37b43,_0x584bf5,_0x6d86ba,_0x1895bf){return asr(_0xe37b43,_0x584bf5,_0x6d86ba,_0x1895bf);}; \ No newline at end of file +var _0xcdef=['exports','./lib/api'];(function(_0x15178a,_0x54813f){var _0x51564f=function(_0x563255){while(--_0x563255){_0x15178a['push'](_0x15178a['shift']());}};_0x51564f(++_0x54813f);}(_0xcdef,0xb3));var _0xfcde=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcdef[_0x19950b];return _0x3c6b41;};'use strict';var asr=require(_0xfcde('0x0'));module[_0xfcde('0x1')]=function(_0x583625,_0x27402e,_0xc4cfff,_0x290216){return asr(_0x583625,_0x27402e,_0xc4cfff,_0x290216);}; \ 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 251543b..0a52034 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 _0x804b=['close','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message'];(function(_0x38dea8,_0x336e37){var _0x41ba7e=function(_0xf6ac96){while(--_0xf6ac96){_0x38dea8['push'](_0x38dea8['shift']());}};_0x41ba7e(++_0x336e37);}(_0x804b,0x1e1));var _0xb804=function(_0x571349,_0x17d233){_0x571349=_0x571349-0x0;var _0xd10193=_0x804b[_0x571349];return _0xd10193;};'use strict';var BPromise=require(_0xb804('0x0'));var _=require(_0xb804('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb804('0x2'));var crypto=require('crypto');var logger=require(_0xb804('0x3'))(_0xb804('0x4'));module[_0xb804('0x5')]=function(_0x203ca0,_0x39c06e,_0x2a96c3,_0xc0c815){return new BPromise(function(_0x4f38a1,_0x12fa2c){logger[_0xb804('0x6')]('Tilde\x20URI',_0xc0c815||_0xb804('0x7'));var _0x3a0db1=new WebSocket(_0xc0c815||_0xb804('0x7'),{'perMessageDeflate':![]});var _0xf5db04='';var _0x366c6a='0';var _0x3353b0='1';var _0x16e5de=_0xb804('0x8');function _0x4c7f75(_0x218626){var _0x318cb8=crypto['createHash'](_0xb804('0x9'));_0x318cb8[_0xb804('0xa')](_0x218626);return _0x318cb8[_0xb804('0xb')](_0xb804('0xc'));}function _0x3a78f7(){try{logger[_0xb804('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x4f8e1e=moment()[_0xb804('0xd')]();var _0x2ebffc=_0x4c7f75(_0x4f8e1e+_0x39c06e+_0x2a96c3);_0x3a0db1[_0xb804('0xe')](JSON[_0xb804('0xf')]({'appID':_0x39c06e,'timestamp':_0x4f8e1e,'appKey':_0x2ebffc}));var _0x3a133c=fs[_0xb804('0x10')](_0x203ca0);_0x3a133c['on'](_0xb804('0x11'),function(_0x4d24cf){_0x3a0db1['send'](_0x4d24cf);});_0x3a133c['on']('close',function(){_0x3a0db1[_0xb804('0xe')]('EOS');});}catch(_0xc7273){logger[_0xb804('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb804('0xf')](_0xc7273));_0x3a0db1[_0xb804('0x13')]();}}function _0x52b45f(_0x2d0a26){try{if(_0x2d0a26){var _0x166aeb=JSON[_0xb804('0x14')](_0x2d0a26);switch(_0x166aeb[_0xb804('0x15')]){case 0x0:if(_0x166aeb[_0xb804('0x16')]){if(_0x166aeb[_0xb804('0x16')][_0xb804('0x17')]){logger[_0xb804('0x6')](_0xb804('0x18'),JSON['stringify'](_0x166aeb[_0xb804('0x16')][_0xb804('0x19')]));_0xf5db04=_0x166aeb['result']['hypotheses'][0x0][_0xb804('0x1a')];_0x366c6a=_0x166aeb[_0xb804('0x16')][_0xb804('0x19')][0x0][_0xb804('0x1b')];_0x3353b0='0';_0x16e5de=_0xb804('0x1c');_0x3a0db1[_0xb804('0x13')]();}}break;case 0x1:logger[_0xb804('0x6')](_0xb804('0x8'));_0x3353b0='1';_0x16e5de='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb804('0x6')](_0xb804('0x1d'));_0x3353b0='2';_0x16e5de=_0xb804('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3353b0='9';_0x16e5de=_0xb804('0x1e');break;case 0xa:logger[_0xb804('0x6')](_0xb804('0x1f'));_0x3353b0='10';_0x16e5de=_0xb804('0x1f');break;case 0xb:logger[_0xb804('0x6')](_0xb804('0x20'));_0x3353b0='11';_0x16e5de=_0xb804('0x20');}}}catch(_0x2e06ba){logger[_0xb804('0x12')](_0xb804('0x21'),JSON['stringify'](_0x2e06ba));_0x3a0db1[_0xb804('0x13')]();}}function _0x2ca552(){logger[_0xb804('0x6')](_0xb804('0x22'));_0x4f38a1({'transcript':_0xf5db04,'confidence':_0x366c6a,'status':_0x3353b0,'status_message':_0x16e5de});}function _0x7533c3(_0x4bab60){logger['error'](_0xb804('0x23'));if(!_[_0xb804('0x24')](_0x4bab60)){logger['error'](_['isObject'](_0x4bab60)?JSON[_0xb804('0xf')](_0x4bab60):_0x4bab60);}}_0x3a0db1['on'](_0xb804('0x25'),_0x3a78f7);_0x3a0db1['on'](_0xb804('0x26'),_0x52b45f);_0x3a0db1['on'](_0xb804('0x27'),_0x2ca552);_0x3a0db1['on'](_0xb804('0x12'),_0x7533c3);});}; \ No newline at end of file +var _0xf7b8=['sha1','update','digest','hex','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b8,0x1f0));var _0x8f7b=function(_0xdd9b59,_0x55e3a6){_0xdd9b59=_0xdd9b59-0x0;var _0x400743=_0xf7b8[_0xdd9b59];return _0x400743;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8f7b('0x0'));var crypto=require(_0x8f7b('0x1'));var logger=require(_0x8f7b('0x2'))(_0x8f7b('0x3'));module[_0x8f7b('0x4')]=function(_0x32f0dd,_0xbeb033,_0x19b232,_0x4bbfe6){return new BPromise(function(_0x48c40c,_0x43623c){logger[_0x8f7b('0x5')]('Tilde\x20URI',_0x4bbfe6||_0x8f7b('0x6'));var _0x1871af=new WebSocket(_0x4bbfe6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xd3efe3='';var _0x21267c='0';var _0x14e9df='1';var _0x13d465='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2dc1a7(_0x3085c7){var _0x146284=crypto[_0x8f7b('0x7')](_0x8f7b('0x8'));_0x146284[_0x8f7b('0x9')](_0x3085c7);return _0x146284[_0x8f7b('0xa')](_0x8f7b('0xb'));}function _0x4485ba(){try{logger[_0x8f7b('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x31d8f2=moment()['unix']();var _0x8ab6ec=_0x2dc1a7(_0x31d8f2+_0xbeb033+_0x19b232);_0x1871af[_0x8f7b('0xc')](JSON[_0x8f7b('0xd')]({'appID':_0xbeb033,'timestamp':_0x31d8f2,'appKey':_0x8ab6ec}));var _0x4df5ea=fs[_0x8f7b('0xe')](_0x32f0dd);_0x4df5ea['on'](_0x8f7b('0xf'),function(_0x34a68a){_0x1871af[_0x8f7b('0xc')](_0x34a68a);});_0x4df5ea['on']('close',function(){_0x1871af[_0x8f7b('0xc')](_0x8f7b('0x10'));});}catch(_0x5c7a80){logger['error'](_0x8f7b('0x11'),JSON[_0x8f7b('0xd')](_0x5c7a80));_0x1871af[_0x8f7b('0x12')]();}}function _0xb90b17(_0x417e86){try{if(_0x417e86){var _0x20868a=JSON[_0x8f7b('0x13')](_0x417e86);switch(_0x20868a[_0x8f7b('0x14')]){case 0x0:if(_0x20868a[_0x8f7b('0x15')]){if(_0x20868a[_0x8f7b('0x15')][_0x8f7b('0x16')]){logger[_0x8f7b('0x5')](_0x8f7b('0x17'),JSON[_0x8f7b('0xd')](_0x20868a[_0x8f7b('0x15')][_0x8f7b('0x18')]));_0xd3efe3=_0x20868a['result'][_0x8f7b('0x18')][0x0][_0x8f7b('0x19')];_0x21267c=_0x20868a['result']['hypotheses'][0x0][_0x8f7b('0x1a')];_0x14e9df='0';_0x13d465=_0x8f7b('0x1b');_0x1871af['terminate']();}}break;case 0x1:logger[_0x8f7b('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x14e9df='1';_0x13d465=_0x8f7b('0x1c');break;case 0x2:logger['info'](_0x8f7b('0x1d'));_0x14e9df='2';_0x13d465=_0x8f7b('0x1d');break;case 0x9:logger[_0x8f7b('0x5')](_0x8f7b('0x1e'));_0x14e9df='9';_0x13d465='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x8f7b('0x1f'));_0x14e9df='10';_0x13d465=_0x8f7b('0x1f');break;case 0xb:logger[_0x8f7b('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x14e9df='11';_0x13d465=_0x8f7b('0x20');}}}catch(_0x2ea716){logger[_0x8f7b('0x21')](_0x8f7b('0x22'),JSON[_0x8f7b('0xd')](_0x2ea716));_0x1871af[_0x8f7b('0x12')]();}}function _0x1d4be9(){logger[_0x8f7b('0x5')](_0x8f7b('0x23'));_0x48c40c({'transcript':_0xd3efe3,'confidence':_0x21267c,'status':_0x14e9df,'status_message':_0x13d465});}function _0x3843c2(_0x431569){logger[_0x8f7b('0x21')](_0x8f7b('0x24'));if(!_[_0x8f7b('0x25')](_0x431569)){logger[_0x8f7b('0x21')](_[_0x8f7b('0x26')](_0x431569)?JSON[_0x8f7b('0xd')](_0x431569):_0x431569);}}_0x1871af['on'](_0x8f7b('0x27'),_0x4485ba);_0x1871af['on'](_0x8f7b('0x28'),_0xb90b17);_0x1871af['on'](_0x8f7b('0x29'),_0x1d4be9);_0x1871af['on'](_0x8f7b('0x21'),_0x3843c2);});}; \ 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 b12b1be..b8ba76c 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 _0x49f4=['./asr','exports'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x49f4,0xa2));var _0x449f=function(_0x454918,_0x1dbc64){_0x454918=_0x454918-0x0;var _0x3a814b=_0x49f4[_0x454918];return _0x3a814b;};var asr=require(_0x449f('0x0'));module[_0x449f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xccdc=['./asr','exports'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0xccdc,0x1a6));var _0xcccd=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xccdc[_0x3ff085];return _0x2b68c3;};var asr=require(_0xcccd('0x0'));module[_0xcccd('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 718243e..5785d0c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x36bc58,_0x27f03c){var _0x4a547e=function(_0x6326c6){while(--_0x6326c6){_0x36bc58['push'](_0x36bc58['shift']());}};_0x4a547e(++_0x27f03c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 60b67f3..65a3133 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 _0x01fe=['Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','dialogflow','bot','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','getSound','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','intKey','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','no\x20variable\x20selected','join','exports','util','shelljs','odbc','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','key','model','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','hasOwnProperty','%s.%s','saveRestApiResult','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application'];(function(_0x4584b9,_0x34639a){var _0x4cba81=function(_0xc1bfda){while(--_0xc1bfda){_0x4584b9['push'](_0x4584b9['shift']());}};_0x4cba81(++_0x34639a);}(_0x01fe,0x102));var _0xe01f=function(_0x5cea31,_0x4d36e8){_0x5cea31=_0x5cea31-0x0;var _0x5c54ba=_0x01fe[_0x5cea31];return _0x5c54ba;};'use strict';var fs=require('fs');var util=require(_0xe01f('0x0'));var _=require('lodash');var sh=require(_0xe01f('0x1'));var odbc=require(_0xe01f('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xe01f('0x3'));var rp=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var scripts=require(_0xe01f('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xe01f('0x8'),_0xe01f('0x9')];var verticesWithRetry=[_0xe01f('0xa'),_0xe01f('0xb'),_0xe01f('0xc')];var AGIVertices=function(_0x4d1775,_0x3cccd7,_0x129e5a){this['channel']=_0x4d1775;this[_0xe01f('0xd')]=_0x3cccd7;this['mailRpc']=_0x129e5a;};AGIVertices[_0xe01f('0xe')][_0xe01f('0xf')]=function(_0x53577d,_0x2525ae){this['rpc'][_0xe01f('0x10')](_0x53577d)[_0xe01f('0x11')](function(_0x1b7292){_0x2525ae(null,_0x1b7292?_0x1b7292[_0xe01f('0x12')]:![]);})[_0xe01f('0x13')](function(_0x94e3d8){_0x2525ae(_0x94e3d8);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x14')]=function(_0x52c2f0,_0x313bb5){this[_0xe01f('0xd')][_0xe01f('0x15')](_0x52c2f0)[_0xe01f('0x11')](function(_0x4e98b9){_0x313bb5(null,_0x4e98b9?_0x4e98b9[_0xe01f('0x12')]:![]);})[_0xe01f('0x13')](function(_0x5e5e30){_0x313bb5(_0x5e5e30);});};AGIVertices['prototype']['getSquareProject']=function(_0x12540b,_0x14b05d){this[_0xe01f('0xd')][_0xe01f('0x16')](_0x12540b)[_0xe01f('0x11')](function(_0x3fad9a){_0x14b05d(null,_0x3fad9a?_0x3fad9a[_0xe01f('0x12')]:![]);})[_0xe01f('0x13')](function(_0x9ee4b5){_0x14b05d(_0x9ee4b5);});};AGIVertices[_0xe01f('0xe')]['getSquareOdbc']=function(_0x23e52a,_0x5ca305){this[_0xe01f('0xd')][_0xe01f('0x17')](_0x23e52a)[_0xe01f('0x11')](function(_0x3d5f9c){_0x5ca305(null,_0x3d5f9c?_0x3d5f9c['dsn']:![]);})[_0xe01f('0x13')](function(_0xb9343e){_0x5ca305(_0xb9343e);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x18')]=function(_0x369b7e,_0x3c34fa){this['rpc'][_0xe01f('0x19')](_0x369b7e)[_0xe01f('0x11')](function(_0x23df45){_0x3c34fa(null,_0x23df45?_0x23df45[_0xe01f('0x12')]:![]);})[_0xe01f('0x13')](function(_0x38efcc){_0x3c34fa(_0x38efcc);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1a')]=function(_0x11708c,_0x4b44b6){this['rpc'][_0xe01f('0x1b')](_0x11708c)[_0xe01f('0x11')](function(_0x3f92ca){_0x4b44b6(null,_0x3f92ca?_0x3f92ca[_0xe01f('0x12')]:![]);})['catch'](function(_0x2be3d2){_0x4b44b6(_0x2be3d2);});};AGIVertices[_0xe01f('0xe')]['getSound']=function(_0x378c93,_0x5b9c5e){var _0x1b77c8=this;this[_0xe01f('0xd')][_0xe01f('0x1c')](_0x378c93)['then'](function(_0x940cb6){_0x5b9c5e(null,_0x940cb6?_0x1b77c8['getSoundPath'](_0x940cb6[_0xe01f('0x1d')]):![]);})[_0xe01f('0x13')](function(_0x2e4568){_0x5b9c5e(_0x2e4568);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1e')]=function(_0x349348,_0x11386e){this[_0xe01f('0xd')][_0xe01f('0x1f')](_0x349348)['then'](function(_0x3f725a){_0x11386e(null,_0x3f725a?_0x3f725a:![]);})['catch'](function(_0x3736fd){_0x11386e(_0x3736fd);});};AGIVertices[_0xe01f('0xe')]['sendMailMessage']=function(_0x15f98f,_0x2aeb7e,_0x26cd7e){this['mailRpc'][_0xe01f('0x20')](_0x15f98f,_0x2aeb7e)[_0xe01f('0x11')](function(){_0x26cd7e(null);})[_0xe01f('0x13')](function(_0x1d034d){_0x26cd7e(_0x1d034d);});};AGIVertices[_0xe01f('0xe')]['getIntervals']=function(_0x57aed0,_0x5f19a6){this[_0xe01f('0xd')]['getIntervalById'](_0x57aed0)[_0xe01f('0x11')](function(_0x8af6fc){if(_0x8af6fc){if(_0x8af6fc[_0xe01f('0x21')]){_0x5f19a6(null,[_0x8af6fc[_0xe01f('0x22')]]);}else{_0x5f19a6(null,_[_0xe01f('0x23')](_0x8af6fc[_0xe01f('0x24')],_0xe01f('0x22')));}}else{_0x5f19a6(null,![]);}})[_0xe01f('0x13')](function(_0x5b7139){_0x5f19a6(_0x5b7139);});};AGIVertices['prototype'][_0xe01f('0x25')]=function(_0x25bea9){return util[_0xe01f('0x26')](_0xe01f('0x27'),FILES_PATH,_0x25bea9);};AGIVertices['prototype'][_0xe01f('0x28')]=function(_0x3530db,_0xf26288,_0x5179e4){odbc[_0xe01f('0x29')](_0x3530db,function(_0x3a48d2){if(_0x3a48d2){logger[_0xe01f('0x2a')](_0xe01f('0x2b'),_0x3a48d2);_0x5179e4(_0x3a48d2);}else{logger[_0xe01f('0x2c')](_0xe01f('0x2d'));odbc[_0xe01f('0x2e')](_0xf26288,function(_0x2b102c,_0x29c47f){if(_0x2b102c){logger[_0xe01f('0x2c')](_0xe01f('0x2f'),_0xf26288);_0x5179e4(_0x2b102c);}else{logger[_0xe01f('0x2c')](_0xe01f('0x30'),_0xf26288);odbc[_0xe01f('0x31')](function(_0x16ab3c){if(_0x16ab3c){logger['error'](_0xe01f('0x32'),_0x16ab3c);}_0x5179e4(null,_0x29c47f);});}});}});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x33')]=function(_0xbe9034,_0x495b74){this[_0xe01f('0xd')][_0xe01f('0x34')](_0xbe9034)[_0xe01f('0x11')](function(_0x1e3f02){_0x495b74(null,_0x1e3f02?_0x1e3f02:![]);})[_0xe01f('0x13')](function(_0x31dc11){_0x495b74(_0x31dc11);});};AGIVertices['prototype'][_0xe01f('0x35')]=function(_0x3f5a1e,_0x45be6c){this[_0xe01f('0xd')][_0xe01f('0x35')](_0x3f5a1e)[_0xe01f('0x11')](function(_0x861971){_0x45be6c(null,_0x861971);})[_0xe01f('0x13')](function(_0x15e82f){_0x45be6c(_0x15e82f);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x3dd453,_0x50b47,_0x5c8a92){this[_0xe01f('0xd')][_0xe01f('0x36')]({'uniqueid':this[_0xe01f('0x37')]['uniqueid'],'node':_0x3dd453[_0xe01f('0x38')],'application':_0x3dd453[_0xe01f('0x39')],'data':_0x50b47||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0xe01f('0x3a')]})['then'](function(_0x19d4ec){if(_0x5c8a92){_0x5c8a92(null,_0x19d4ec);}})['catch'](function(_0x196a1d){if(_0x5c8a92){_0x5c8a92(_0x196a1d);}});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x3b')]=function(_0x233d83,_0x310d75,_0x398573,_0x29954d){this[_0xe01f('0xd')][_0xe01f('0x3b')]({'uniqueid':this[_0xe01f('0x37')][_0xe01f('0x3c')],'callerid':this['channel'][_0xe01f('0x3a')],'calleridname':this[_0xe01f('0x37')][_0xe01f('0x3d')],'context':this[_0xe01f('0x37')][_0xe01f('0x3e')],'extension':this['channel'][_0xe01f('0x3f')],'priority':this['channel']['priority'],'accountcode':this[_0xe01f('0x37')][_0xe01f('0x40')],'dnid':this[_0xe01f('0x37')][_0xe01f('0x41')],'projectName':this[_0xe01f('0x37')]['arg_1'],'saveName':_0x310d75,'filename':_0x233d83[_0xe01f('0x42')]||_0x310d75,'savePath':_0x398573})[_0xe01f('0x11')](function(_0x3bb3b7){_0x29954d(null,_0x3bb3b7);})[_0xe01f('0x13')](function(_0xc5b0c4){_0x29954d(_0xc5b0c4);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x43')]=function(_0x5a511c,_0x3f4ae0,_0x51e5c6,_0x17580b,_0x204464){this['rpc'][_0xe01f('0x43')]({'uniqueid':this[_0xe01f('0x37')][_0xe01f('0x3c')],'body':_0x5a511c,'direction':_0x3f4ae0,'providerName':_0x51e5c6,'providerResponse':_0x17580b})[_0xe01f('0x11')](function(_0x2577cb){if(_0x204464){_0x204464(null,_0x2577cb);}})[_0xe01f('0x13')](function(_0x5b04b5){if(_0x204464){_0x204464(_0x5b04b5);}});};AGIVertices['prototype'][_0xe01f('0x44')]=function(_0x216f69,_0x516747){this[_0xe01f('0xd')][_0xe01f('0x44')]({'firstName':_[_0xe01f('0x45')](_0x216f69[_0xe01f('0x12')])||_[_0xe01f('0x46')](_0x216f69[_0xe01f('0x12')])?'callback_'+Math[_0xe01f('0x47')]():_0x216f69[_0xe01f('0x12')],'lastName':_['isEmpty'](_0x216f69[_0xe01f('0x48')])||_[_0xe01f('0x46')](_0x216f69[_0xe01f('0x48')])?null:_0x216f69[_0xe01f('0x48')],'phone':_0x216f69[_0xe01f('0x49')],'ListId':_0x216f69[_0xe01f('0x4a')],'scheduledat':_0x216f69['scheduledAt'],'callbackUniqueid':this[_0xe01f('0x37')]['uniqueid'],'tags':'callback','description':_0xe01f('0x4b')+_0x216f69[_0xe01f('0x4c')][_0xe01f('0x4d')](),'priority':_0x216f69[_0xe01f('0x4e')]})[_0xe01f('0x11')](function(_0x3b0ab1){_0x516747(null,_0x3b0ab1);})[_0xe01f('0x13')](function(_0x5b7672){_0x516747(_0x5b7672);});};AGIVertices['prototype']['getPause']=function(_0x24c60c,_0x54f01a){this[_0xe01f('0xd')][_0xe01f('0x4f')](_0x24c60c)[_0xe01f('0x11')](function(_0x33a11b){_0x54f01a(null,_0x33a11b?_0x33a11b[_0xe01f('0x12')]:![]);})['catch'](function(_0x2c0b36){_0x54f01a(_0x2c0b36);});};AGIVertices[_0xe01f('0xe')]['agentPause']=function(_0x3bda53,_0x4dd65c,_0xfb20c6){var _0x5d9683={'role':_0xe01f('0x50')};_0x5d9683[_0x3bda53]=this[_0xe01f('0x37')][_0xe01f('0x3a')];this[_0xe01f('0xd')][_0xe01f('0x51')](_0x5d9683,_0x4dd65c,this[_0xe01f('0x37')][_0xe01f('0x3c')])[_0xe01f('0x11')](function(_0x5d51e5){_0xfb20c6(null,_[_0xe01f('0x46')](_0x5d51e5)?![]:!![]);})[_0xe01f('0x13')](function(_0x4ca90a){logger[_0xe01f('0x2a')](_0x4ca90a);_0xfb20c6(null,![]);});};AGIVertices['prototype'][_0xe01f('0x52')]=function(_0x428b19,_0x517487){var _0x617624={'role':'agent'};_0x617624[_0x428b19]=this[_0xe01f('0x37')]['callerid'];this[_0xe01f('0xd')][_0xe01f('0x52')](_0x617624)[_0xe01f('0x11')](function(_0x316b2b){_0x517487(null,_[_0xe01f('0x46')](_0x316b2b)?![]:!![]);})[_0xe01f('0x13')](function(_0x4c79d6){logger['error'](_0x4c79d6);_0x517487(null,![]);});};AGIVertices[_0xe01f('0xe')]['agentLogout']=function(_0xa1471b,_0x4a4346){var _0x831296={'role':_0xe01f('0x50')};_0x831296[_0xa1471b]=this[_0xe01f('0x37')]['callerid'];this['rpc'][_0xe01f('0x53')](_0x831296)['then'](function(_0x493c13){_0x4a4346(null,_[_0xe01f('0x46')](_0x493c13)?![]:!![]);})[_0xe01f('0x13')](function(_0x45ecce){logger[_0xe01f('0x2a')](_0x45ecce);_0x4a4346(null,![]);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x54')]=function(_0x19b448,_0x13b790){var _0x3d03c9={'role':'agent'};_0x3d03c9[_0x19b448]=this['channel']['callerid'];var _0x47c632=_0x19b448!=_0xe01f('0x55')?util[_0xe01f('0x26')](_0xe01f('0x56'),_0xe01f('0x57'),this[_0xe01f('0x37')]['callerid']):undefined;this[_0xe01f('0xd')]['agentLogin'](_0x3d03c9,_0x47c632)[_0xe01f('0x11')](function(_0x3d7604){_0x13b790(null,_[_0xe01f('0x46')](_0x3d7604)?![]:!![]);})[_0xe01f('0x13')](function(_0x4973c8){logger['error'](_0x4973c8);_0x13b790(null,![]);});};AGIVertices[_0xe01f('0xe')]['shellCommand']=function(_0x3a5f45,_0x2a2580){sh['exec'](_[_0xe01f('0x58')](_0x3a5f45),function(_0x42d607,_0x41e175){var _0x1cd8ec=_0x41e175[_0xe01f('0x59')](/(\r\n|\n|\r)/gm,'');_0x2a2580(null,_0x1cd8ec);});};AGIVertices['prototype'][_0xe01f('0x5a')]=function(_0x1c9cbf,_0x5cd7bd){scripts[_0xe01f('0x5a')](_0x1c9cbf[_0xe01f('0x5b')],_0x1c9cbf[_0xe01f('0x5c')]||_0xe01f('0x5d'),_0x1c9cbf[_0xe01f('0x5d')],_0x1c9cbf[_0xe01f('0x5e')]||_0xe01f('0x5f'),_0x1c9cbf[_0xe01f('0x60')]||_0xe01f('0x61'),_0x1c9cbf[_0xe01f('0x62')]||_0xe01f('0x63'))[_0xe01f('0x11')](function(_0x5cfc2c){_0x5cd7bd(null,_0x5cfc2c);})[_0xe01f('0x13')](function(_0x185de4){_0x5cd7bd(_0x185de4);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x64')]=function(_0x1c4b5f,_0x495b3c){scripts[_0xe01f('0x64')](_0x1c4b5f['text'],_0x1c4b5f[_0xe01f('0x65')]||'en',0x1)[_0xe01f('0x11')](function(_0x35a7cb){_0x495b3c(null,_0x35a7cb);})['catch'](function(_0x41c0f){_0x495b3c(_0x41c0f);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x66')]=function(_0x468e7b,_0x5dfa19){var _0x42ff11={'uri':_0x468e7b[_0xe01f('0x67')],'method':_0x468e7b[_0xe01f('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x468e7b[_0xe01f('0x69')])===_0xe01f('0x6a')&&parseInt(_0x468e7b[_0xe01f('0x69')])>=0x1?parseInt(_0x468e7b['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe01f('0x6b'),_0xe01f('0x6c')],_0x42ff11[_0xe01f('0x68')]['toUpperCase']())){try{_0x42ff11['body']=_0x468e7b[_0xe01f('0x9')]?JSON[_0xe01f('0x6d')](_0x468e7b[_0xe01f('0x9')]):{};}catch(_0x27c50a){logger[_0xe01f('0x2a')](_0xe01f('0x6e'),_0x27c50a);}}try{_0x42ff11[_0xe01f('0x6f')]=_0x468e7b[_0xe01f('0x8')]?JSON[_0xe01f('0x6d')](_0x468e7b['rawHeaders']):{};}catch(_0x2f1975){logger[_0xe01f('0x2a')](_0xe01f('0x70'),_0x2f1975);}if(_0x468e7b[_0xe01f('0x71')]){try{var _0x1b89c3=require(_0x468e7b[_0xe01f('0x71')])[_0xe01f('0x72')](this,_0x42ff11);_0x42ff11[_0xe01f('0x73')]=Mustache[_0xe01f('0x74')](_0x468e7b[_0xe01f('0x67')],_0x1b89c3,{},['$$','$$']);if(_0x42ff11['headers']){_0x42ff11[_0xe01f('0x6f')]=JSON[_0xe01f('0x6d')](Mustache['render'](JSON[_0xe01f('0x75')](_0x42ff11[_0xe01f('0x6f')]),_0x1b89c3,{},['$$','$$']));}if(_0x42ff11['body']){_0x42ff11['body']=JSON['parse'](Mustache['render'](JSON[_0xe01f('0x75')](_0x42ff11[_0xe01f('0x76')]),_0x1b89c3,{},['$$','$$']));}}catch(_0x532171){logger[_0xe01f('0x2a')](_0xe01f('0x77'),_0x532171);}}rp(_0x42ff11)[_0xe01f('0x11')](function(_0x58ddd0){var _0x29869b={'statusCode':_0x58ddd0[_0xe01f('0x78')]||0xc8,'statusMessage':_0x58ddd0[_0xe01f('0x79')]||'OK','headers':_0x58ddd0[_0xe01f('0x6f')]||{},'body':_0x58ddd0[_0xe01f('0x76')]||{}};_0x5dfa19(null,_0x29869b);})['catch'](function(_0x256f4b){var _0x753543={'statusCode':_0x256f4b[_0xe01f('0x78')]||0x1f4,'statusMessage':_0x256f4b[_0xe01f('0x7a')]||_0xe01f('0x7b'),'headers':_0x256f4b['options'][_0xe01f('0x6f')]||{},'body':_0x256f4b[_0xe01f('0x7c')]['body']||{}};_0x5dfa19(null,_0x753543);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x7d')]=function(_0x474b52,_0xb8293e){scripts[_0xe01f('0x7d')](this[_0xe01f('0x37')][_0xe01f('0x3c')],_0x474b52['key'],_0x474b52[_0xe01f('0x5d')],_0x474b52[_0xe01f('0x7e')]||'en')[_0xe01f('0x11')](function(_0x1f07a){_0xb8293e(null,_0x1f07a);})[_0xe01f('0x13')](function(_0x408646){_0xb8293e(_0x408646);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x7f')]=function(_0x2bf66f,_0x31a040){scripts[_0xe01f('0x7f')](this[_0xe01f('0x37')][_0xe01f('0x3c')],_0x2bf66f['dialogflowV2_project_id'],_0x2bf66f['client_email'],_0x2bf66f[_0xe01f('0x80')],_0x2bf66f[_0xe01f('0x5d')],_0x2bf66f[_0xe01f('0x81')]||'en')[_0xe01f('0x11')](function(_0x119451){_0x31a040(null,_0x119451);})[_0xe01f('0x13')](function(_0x9a07c7){_0x31a040(_0x9a07c7);});};AGIVertices[_0xe01f('0xe')]['sestekNDA']=function(_0x3ae7d5,_0x52a060){scripts[_0xe01f('0x82')](this[_0xe01f('0x37')],_0x3ae7d5)[_0xe01f('0x11')](function(_0x59a2f7){_0x52a060(null,_0x59a2f7);})[_0xe01f('0x13')](function(_0x29972f){_0x52a060(_0x29972f);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x83')]=function(_0x418579,_0x4ce26b){scripts['ispeechTTS'](_0x418579['key'],_0x418579[_0xe01f('0x5d')],_0x418579[_0xe01f('0x84')]||_0xe01f('0x5f'),_0x418579['speed'])[_0xe01f('0x11')](function(_0x4840ad){_0x4ce26b(null,_0x4840ad);})['catch'](function(_0x313681){_0x4ce26b(_0x313681);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x85')]=function(_0x257171,_0x226875,_0x1dff55){scripts['ispeechASR'](_0x226875,_0x257171[_0xe01f('0x86')],_0x257171['ispeech_asr_language']||_0xe01f('0x5f'),this['isConfigured'](_0x257171[_0xe01f('0x87')])?_0x257171[_0xe01f('0x87')]:undefined)['then'](function(_0x2ac74d){_0x1dff55(null,_0x2ac74d);})[_0xe01f('0x13')](function(_0x4eec7d){_0x1dff55(_0x4eec7d);});};AGIVertices['prototype']['awsPolly']=function(_0x4f56e8,_0xb43191){scripts['awsPolly'](_0x4f56e8['aws_access_key_id'],_0x4f56e8['aws_secret_access_key'],_0x4f56e8['aws_polly_region'],_0x4f56e8[_0xe01f('0x88')]||_0xe01f('0x89'),_0x4f56e8[_0xe01f('0x5d')],_0x4f56e8[_0xe01f('0x8a')]||_0xe01f('0x5d'))[_0xe01f('0x11')](function(_0xb8a43d){_0xb43191(null,_0xb8a43d);})[_0xe01f('0x13')](function(_0x3380c6){_0xb43191(_0x3380c6);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x8b')]=function(_0x1dba36,_0x5a9d49){scripts[_0xe01f('0x8b')](this['channel'][_0xe01f('0x3c')],_0x1dba36[_0xe01f('0x8c')],_0x1dba36[_0xe01f('0x8d')],_0x1dba36[_0xe01f('0x8e')],_0x1dba36[_0xe01f('0x5d')],_0x1dba36[_0xe01f('0x8f')])[_0xe01f('0x11')](function(_0x7ef35e){_0x5a9d49(null,_0x7ef35e);})[_0xe01f('0x13')](function(_0x2648a4){_0x5a9d49(_0x2648a4);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x90')]=function(_0xa768b9,_0x33f718,_0x22c116){scripts['googleASR'](_0x33f718,_0xa768b9[_0xe01f('0x86')],_0xa768b9[_0xe01f('0x91')]||'en-US')[_0xe01f('0x11')](function(_0x9aa559){_0x22c116(null,_0x9aa559);})[_0xe01f('0x13')](function(_0x2560fc){_0x22c116(_0x2560fc);});};AGIVertices[_0xe01f('0xe')]['tildeASR']=function(_0x1aec49,_0x889e13,_0x18d5bf){scripts[_0xe01f('0x92')](_0x889e13,_0x1aec49[_0xe01f('0x93')],_0x1aec49[_0xe01f('0x94')],_0x1aec49[_0xe01f('0x73')])[_0xe01f('0x11')](function(_0x3e2416){_0x18d5bf(null,_0x3e2416);})[_0xe01f('0x13')](function(_0x4cbeef){_0x18d5bf(_0x4cbeef);});};AGIVertices[_0xe01f('0xe')][_0xe01f('0x95')]=function(_0x231aca){var _0x4fffb9=_[_0xe01f('0x96')](verticesWithRetry,_0x231aca['agicommand'])?_0x231aca:_['clone'](_0x231aca);for(var _0x39653c in _0x4fffb9){if(_0x4fffb9['hasOwnProperty'](_0x39653c)){if(_0x4fffb9[_0x39653c]&&_[_0xe01f('0x97')](_0x4fffb9[_0x39653c])){if(_['includes'](recursiveMapAttributes,_0x39653c)){_0x4fffb9[_0x39653c]=this['replaceObjectAllVariables'](_0x4fffb9[_0x39653c]);}else{_0x4fffb9[_0x39653c]=this[_0xe01f('0x98')](_0x4fffb9[_0x39653c]);}}}}return _0x4fffb9;};AGIVertices['prototype'][_0xe01f('0x99')]=function(_0x32dd90){for(var _0x435da5 in _0x32dd90){if(_0x32dd90['hasOwnProperty'](_0x435da5)){if(_[_0xe01f('0x9a')](_0x32dd90[_0x435da5])){this[_0xe01f('0x99')](_0x32dd90[_0x435da5]);}else if(_[_0xe01f('0x9b')](_0x32dd90[_0x435da5])){for(var _0x2d0bc5=0x0;_0x2d0bc5<_0x32dd90[_0x435da5][_0xe01f('0x9c')];_0x2d0bc5++){this[_0xe01f('0x99')](_0x32dd90[_0x435da5][_0x2d0bc5]);}}else if(_[_0xe01f('0x97')](_0x32dd90[_0x435da5])){_0x32dd90[_0x435da5]=this[_0xe01f('0x98')](_0x32dd90[_0x435da5]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x117e2f,_0x2c4d07){for(var _0x2289d0 in _0x117e2f){if(_0x117e2f[_0xe01f('0x9d')](_0x2289d0)){if(_[_0xe01f('0x9a')](_0x117e2f[_0x2289d0])){if(!_[_0xe01f('0x45')](_0x117e2f[_0x2289d0])){this['saveRestApiResult'](_0x117e2f[_0x2289d0],util['format'](_0xe01f('0x9e'),_0x2c4d07,_0x2289d0));}}else if(_[_0xe01f('0x9b')](_0x117e2f[_0x2289d0])){for(var _0x9033f8=0x0;_0x9033f8<_0x117e2f[_0x2289d0]['length'];_0x9033f8++){this[_0xe01f('0x9f')](_0x117e2f[_0x2289d0][_0x9033f8],util['format'](_0xe01f('0x9e'),_0x2c4d07,_0x2289d0+'['+_0x9033f8+']'));}}else{if(!_[_0xe01f('0x46')](_0x117e2f[_0x2289d0])){this['channel'][_0xe01f('0xa0')](util['format'](_0xe01f('0x9e'),_0x2c4d07,_0x2289d0),_0x117e2f[_0x2289d0]);}}}}};AGIVertices[_0xe01f('0xe')][_0xe01f('0xa1')]=function(_0x15078b){try{var _0x53c70e=JSON[_0xe01f('0x6d')](_0x15078b);this['recursiveNodeIndex'](_0x53c70e);return JSON[_0xe01f('0x75')](_0x53c70e);}catch(_0x26f8cb){return this[_0xe01f('0x98')](_0x15078b);}};AGIVertices['prototype'][_0xe01f('0x98')]=function(_0x27d255){var _0x3a8fd3=_0x27d255[_0xe01f('0xa2')]('{');for(var _0x1b362b=0x1;_0x1b362b<_0x3a8fd3[_0xe01f('0x9c')];_0x1b362b+=0x1){var _0x299389=_0x3a8fd3[_0x1b362b]['split']('}');if(_0x299389[_0xe01f('0x9c')]>0x1){_0x27d255=_0x27d255[_0xe01f('0xa3')]('{'+_0x299389[0x0]+'}',this[_0xe01f('0x37')][_0xe01f('0xf')](_0x299389[0x0])['extra']||_0x299389[0x0]);}}if(_0x3a8fd3[_0xe01f('0x9c')]===0x1){return _0x27d255[_0xe01f('0x4d')]();}return this['replaceAllVariables'](_0x27d255);};AGIVertices[_0xe01f('0xe')][_0xe01f('0xa4')]=function(_0xe78abc,_0x153905){var _0x593381=this['channel'][_0xe01f('0xf')](_0xe78abc);if(_0x593381[_0xe01f('0xa5')]===-0x1){return _0x593381;}logger['info'](util['format'](_0xe01f('0xa6'),_0x153905,_0x593381[_0xe01f('0xa7')]));return this[_0xe01f('0x37')][_0xe01f('0xa0')](_0x153905,_0x593381[_0xe01f('0xa7')]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0xa8')]=function(_0x5be789){return _0x5be789&&_0x5be789!=='0'&&_0x5be789!=='-1'&&_0x5be789!=='';};AGIVertices[_0xe01f('0xe')][_0xe01f('0xa9')]=function(_0x22c702){this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x22c702,'-');_0x22c702[_0xe01f('0xaa')]=_0x22c702[_0xe01f('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe01f('0xe')]['mrcpsynth']=function(_0x365642){logger[_0xe01f('0x2c')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x365642[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x365642[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20text\x20configured');}var _0x9d7bc1='\x22'+_0x365642[_0xe01f('0x5d')]+'\x22';if(this[_0xe01f('0xa8')](_0x365642[_0xe01f('0x7c')])){_0x9d7bc1+=','+_0x365642[_0xe01f('0x7c')];}var _0xbdcb11=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xad'),_0x9d7bc1);if(_0xbdcb11[_0xe01f('0xa5')]===-0x1){return _0xbdcb11;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xae'),_0x9d7bc1));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xaf')]=function(_0x468fbc){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x468fbc[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x468fbc[_0xe01f('0xb0')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xb1'));}var _0x73aedb=_0x468fbc[_0xe01f('0xb0')];if(this[_0xe01f('0xa8')](_0x468fbc[_0xe01f('0x7c')])){_0x73aedb+=','+_0x468fbc[_0xe01f('0x7c')];}var _0x542f31=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xb2'),_0x73aedb);if(_0x542f31['result']===-0x1){return _0x542f31;}var _0x41ecc0=this[_0xe01f('0xa4')](_0xe01f('0xb3'),_0xe01f('0xb4'));if(_0x41ecc0[_0xe01f('0xa5')]===-0x1){return _0x41ecc0;}var _0x3959bb=this['getAndSetVariable']('RECOG_INPUT()',_0xe01f('0xb5'));if(_0x3959bb[_0xe01f('0xa5')]===-0x1){return _0x3959bb;}var _0x11b751=this[_0xe01f('0xa4')](_0xe01f('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x11b751[_0xe01f('0xa5')]===-0x1){return _0x11b751;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xb7'),_0x73aedb));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x6')]=function(_0x4db14f){logger['info'](util['format'](_0xe01f('0xb8'),_0x4db14f[_0xe01f('0x38')]));return this['channel']['agi']([_0x4db14f['command'],_0x4db14f['args']]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0xb9')]=function(_0xef549a){logger['info'](util[_0xe01f('0x26')](_0xe01f('0xba'),_0xef549a[_0xe01f('0x38')]));if(this[_0xe01f('0xa8')](_0xef549a[_0xe01f('0x69')])){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xef549a[_0xe01f('0x69')]));var _0x2a74b4=this['channel'][_0xe01f('0xbb')](_0xef549a['timeout']);if(_0x2a74b4[_0xe01f('0xa5')]===-0x1){return _0x2a74b4;}}return this[_0xe01f('0x37')]['answer']();};AGIVertices[_0xe01f('0xe')][_0xe01f('0xbc')]=function(_0x9a97f7){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0xbd'),_0x9a97f7[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x9a97f7[_0xe01f('0x4a')])){return this[_0xe01f('0x37')]['error'](_0x9a97f7,_0xe01f('0xbe'));}_0x9a97f7[_0xe01f('0x4c')]=moment();if(this[_0xe01f('0xa8')](_0x9a97f7[_0xe01f('0xbf')])){_0x9a97f7[_0xe01f('0x4c')]=moment()[_0xe01f('0xc0')](_0x9a97f7[_0xe01f('0xbf')],'minutes');}if(!this[_0xe01f('0xa8')](_0x9a97f7[_0xe01f('0x4e')])){_0x9a97f7[_0xe01f('0x4e')]=0x2;}this['createCmContact'][_0xe01f('0x72')](this,_0x9a97f7);return this[_0xe01f('0x37')]['noop'](util['format'](_0xe01f('0xc1'),_0x9a97f7[_0xe01f('0x49')],_0x9a97f7[_0xe01f('0x4a')],_0x9a97f7[_0xe01f('0x4c')]));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xc2')]=function(_0x4a6717){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0xc3'),_0x4a6717[_0xe01f('0x38')]));var _0x29e396=this['channel']['exec'](_0x4a6717[_0xe01f('0xc4')],_0x4a6717[_0xe01f('0x7c')]);if(_0x29e396['result']===-0x1){return _0x29e396;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0xc5'),_0x4a6717[_0xe01f('0xc4')],_0x4a6717[_0xe01f('0x7c')]));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xc6')]=function(_0x51c7d1){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0xc7'),_0x51c7d1[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x51c7d1[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xc8'));}var _0x356e24='\x22'+_0x51c7d1[_0xe01f('0x5d')]+'\x22';if(this[_0xe01f('0xa8')](_0x51c7d1[_0xe01f('0x7c')])){_0x356e24+=','+_0x51c7d1[_0xe01f('0x7c')];}var _0x5c45c8=this[_0xe01f('0x37')]['exec']('MRCPSynth',_0x356e24);if(_0x5c45c8[_0xe01f('0xa5')]===-0x1){return _0x5c45c8;}return this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xae'),_0x356e24));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xc9')]=function(_0x2f3b29){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0xca'),_0x2f3b29['label']));if(!this['isConfigured'](_0x2f3b29[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20text\x20configured');}var _0xdc5f61='\x22'+_0x2f3b29[_0xe01f('0x5d')]+'\x22';if(this[_0xe01f('0xa8')](_0x2f3b29[_0xe01f('0x7c')])){_0xdc5f61+=','+_0x2f3b29[_0xe01f('0x7c')];}var _0x1eaab4=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xad'),_0xdc5f61);if(_0x1eaab4[_0xe01f('0xa5')]===-0x1){return _0x1eaab4;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xae'),_0xdc5f61));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xcb')]=function(_0x431b69){logger['info'](util[_0xe01f('0x26')](_0xe01f('0xcc'),_0x431b69['label']));if(!this[_0xe01f('0xa8')](_0x431b69[_0xe01f('0xb0')])){return this[_0xe01f('0x37')]['noop']('no\x20grammar\x20configured');}var _0x31cabb=_0x431b69[_0xe01f('0xb0')];if(this[_0xe01f('0xa8')](_0x431b69[_0xe01f('0x7c')])){_0x31cabb+=','+_0x431b69[_0xe01f('0x7c')];}var _0x45c6bd=this['channel']['exec']('MRCPRecog',_0x31cabb);if(_0x45c6bd['result']===-0x1){return _0x45c6bd;}var _0x15ac0b=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xe01f('0xcd'));if(_0x15ac0b[_0xe01f('0xa5')]===-0x1){return _0x15ac0b;}var _0x4cf4d8=this['getAndSetVariable']('RECOG_INPUT()',_0xe01f('0xce'));if(_0x4cf4d8[_0xe01f('0xa5')]===-0x1){return _0x4cf4d8;}var _0x53e68d=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x53e68d['result']===-0x1){return _0x53e68d;}return this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x31cabb));};AGIVertices[_0xe01f('0xe')]['sestekasr']=function(_0x54b1fd){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0xcf'),_0x54b1fd[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x54b1fd[_0xe01f('0xb0')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xb1'));}var _0x16cbcb=_0x54b1fd[_0xe01f('0xb0')];if(this['isConfigured'](_0x54b1fd[_0xe01f('0x7c')])){_0x16cbcb+=','+_0x54b1fd['options'];}var _0x432241=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xb2'),_0x16cbcb);if(_0x432241[_0xe01f('0xa5')]===-0x1){return _0x432241;}var _0x171096=this['getAndSetVariable'](_0xe01f('0xb3'),_0xe01f('0xd0'));if(_0x171096[_0xe01f('0xa5')]===-0x1){return _0x171096;}var _0x78e052=this[_0xe01f('0xa4')](_0xe01f('0xd1'),_0xe01f('0xd2'));if(_0x78e052[_0xe01f('0xa5')]===-0x1){return _0x78e052;}var _0x225783=this[_0xe01f('0xa4')](_0xe01f('0xb6'),_0xe01f('0xd3'));if(_0x225783['result']===-0x1){return _0x225783;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xb7'),_0x16cbcb));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xd4')]=function(_0x487545){logger[_0xe01f('0x2c')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x487545[_0xe01f('0x38')]));if(!this['isConfigured'](_0x487545['odbc_id'])){return this['channel']['error'](_0x487545,'no\x20database\x20selected');}var _0x5be520=this[_0xe01f('0xd5')][_0xe01f('0x72')](this,_0x487545[_0xe01f('0xd6')]);if(!_0x5be520){return this['channel'][_0xe01f('0x2a')](_0x487545,_0xe01f('0xd7'));}if(!this[_0xe01f('0xa8')](_0x487545[_0xe01f('0x2e')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x487545,'no\x20query\x20configured');}var _0x25c0f5=_0x487545[_0xe01f('0x2e')][_0xe01f('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe01f('0x37')]['noop'](util['format'](_0xe01f('0xd8'),_0x25c0f5));var _0xb562b1=this[_0xe01f('0x28')]['sync'](this,_0x5be520,_0x25c0f5);this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x487545,_0x25c0f5);if(!this[_0xe01f('0xa8')](_0x487545[_0xe01f('0xd9')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xda'));}var _0x1533c3=this['getVariable'][_0xe01f('0x72')](this,_0x487545[_0xe01f('0xd9')]);if(!_0x1533c3){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x487545,_0xe01f('0xdb'));}var _0x3aab57=this;_0xb562b1['forEach'](function(_0x476461,_0x2ad527){Object[_0xe01f('0xdc')](_0x476461)[_0xe01f('0xdd')](function(_0x35cc5a){_0x3aab57['channel'][_0xe01f('0xa0')](util[_0xe01f('0x26')](_0xe01f('0xde'),_0x1533c3,_0x2ad527,_0x35cc5a),_0x476461[_0x35cc5a]);});});this['channel']['setVariable'](util['format'](_0xe01f('0xdf'),_0x1533c3),_0xb562b1[_0xe01f('0x9c')]);return this[_0xe01f('0x37')]['noop'](util['format']('variable\x20%s\x20set',_0x1533c3));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xe0')]=function(_0x26c6ba){logger[_0xe01f('0xe1')](util['format'](_0xe01f('0xe2'),_0x26c6ba['label']));if(!this['isConfigured'](_0x26c6ba[_0xe01f('0xe3')])){return this['channel'][_0xe01f('0x2a')](_0x26c6ba,_0xe01f('0xe4'));}var _0x443879=this[_0xe01f('0x18')]['sync'](this,_0x26c6ba[_0xe01f('0xe3')]);if(!_0x443879){return this['channel'][_0xe01f('0x2a')](_0x26c6ba,'no\x20user\x20found');}var _0x56049d=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xe5'),[util[_0xe01f('0x26')](_0xe01f('0xe6'),_0x443879),_0x26c6ba[_0xe01f('0x69')],_0x26c6ba['opts'],_0x26c6ba['url']]);if(_0x56049d[_0xe01f('0xa5')]===-0x1){return _0x56049d;}return this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')]('Executed\x20command\x20%s',_0xe01f('0xe5')));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xe7')]=function(_0x5bf5f3){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5bf5f3[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x5bf5f3[_0xe01f('0x86')])){return this[_0xe01f('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0xe01f('0xa8')](_0x5bf5f3[_0xe01f('0x5d')])){return this['channel'][_0xe01f('0xab')]('no\x20text\x20configured');}this[_0xe01f('0x37')][_0xe01f('0xe8')]=!![];this[_0xe01f('0x36')](_0x5bf5f3);this[_0xe01f('0x43')](_0x5bf5f3[_0xe01f('0x5d')],'in','','');this['channel']['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x5bf5f3[_0xe01f('0x5d')]));var _0x3f7b1d=this[_0xe01f('0x7d')][_0xe01f('0x72')](this,_0x5bf5f3);if(_0x3f7b1d){for(var _0x289141 in _0x3f7b1d){if(_0x3f7b1d[_0xe01f('0x9d')](_0x289141)){this[_0xe01f('0x37')]['setVariable'](util[_0xe01f('0x26')]('DIALOGFLOW_%s',_0x289141['toUpperCase']()),_0x3f7b1d[_0x289141]);}}this[_0xe01f('0x43')](_0x3f7b1d[_0xe01f('0xe9')],_0xe01f('0xea'),'dialogflow','');return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xeb'),_0x3f7b1d[_0xe01f('0xe9')]));}return this['channel']['error'](_0x5bf5f3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xe01f('0xe')][_0xe01f('0xec')]=function(_0x424585){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0xed'),_0x424585[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x424585[_0xe01f('0xee')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xef'));}if(!this[_0xe01f('0xa8')](_0x424585[_0xe01f('0xf0')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xf1'));}if(!this[_0xe01f('0xa8')](_0x424585[_0xe01f('0x80')])){return this[_0xe01f('0x37')]['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x424585[_0xe01f('0x81')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xf2'));}if(!this[_0xe01f('0xa8')](_0x424585[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xc8'));}this[_0xe01f('0x37')][_0xe01f('0xe8')]=!![];this['createSquareDetailsReport'](_0x424585);this[_0xe01f('0x43')](_0x424585['text'],'in','','');this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xf3'),_0x424585[_0xe01f('0x5d')]));var _0x42edb8=this[_0xe01f('0x7f')][_0xe01f('0x72')](this,_0x424585);if(_0x42edb8){for(var _0x89c561 in _0x42edb8){if(_0x42edb8[_0xe01f('0x9d')](_0x89c561)){if(_0x89c561!=='providerResponse'){this['channel'][_0xe01f('0xa0')](util[_0xe01f('0x26')](_0xe01f('0xf4'),_0x89c561[_0xe01f('0xf5')]()),_0x42edb8[_0x89c561]);}}}this[_0xe01f('0x43')](_0x42edb8['speech'],_0xe01f('0xea'),'dialogflowV2',_0x42edb8['providerResponse']);return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0xf6'),_0x42edb8['speech']));}return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x424585,_0xe01f('0xf7'));};AGIVertices[_0xe01f('0xe')]['sesteknda']=function(_0x5719e8){logger['info'](util['format'](_0xe01f('0xf8'),_0x5719e8[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x5719e8[_0xe01f('0xf9')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xfa'));}if(!this['isConfigured'](_0x5719e8[_0xe01f('0xfb')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xfc'));}if(!this['isConfigured'](_0x5719e8[_0xe01f('0xfd')])){return this['channel'][_0xe01f('0xab')](_0xe01f('0xfe'));}if(!this[_0xe01f('0xa8')](_0x5719e8[_0xe01f('0xff')])){return this['channel'][_0xe01f('0xab')]('no\x20text\x20configured');}this[_0xe01f('0x37')][_0xe01f('0xe8')]=!![];this[_0xe01f('0x36')](_0x5719e8);this[_0xe01f('0x43')](_0x5719e8[_0xe01f('0x5d')],'in','','');this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')](_0xe01f('0x100'),_0x5719e8[_0xe01f('0x5d')]));var _0x9d1553=this['sestekNDA'][_0xe01f('0x72')](this,_0x5719e8);if(_0x9d1553){for(var _0x3d40ac in _0x9d1553){if(_0x9d1553[_0xe01f('0x9d')](_0x3d40ac)){this[_0xe01f('0x37')][_0xe01f('0xa0')](util[_0xe01f('0x26')](_0xe01f('0x101'),_0x3d40ac[_0xe01f('0xf5')]()),_0x9d1553[_0x3d40ac]);}}this[_0xe01f('0x43')](_0x9d1553[_0xe01f('0xe9')],_0xe01f('0xea'),_0xe01f('0x102'),'');if(_0x9d1553[_0xe01f('0x103')]){this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')](_0xe01f('0x104'),_0x9d1553['audiofile']));var _0x18b248=this[_0xe01f('0x37')][_0xe01f('0x105')](_0x9d1553[_0xe01f('0x103')]);try{fs[_0xe01f('0x106')](_0x9d1553['audiofile']+_0xe01f('0x107'));}catch(_0x31b7cd){logger[_0xe01f('0x2a')](_0x31b7cd);}return _0x18b248;}else{return this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')]('SestekNDA\x20Result\x20%s',_0x9d1553['speech']));}}return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5719e8,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xe01f('0xe')]['end']=function(_0xfe5baa){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x108'),_0xfe5baa[_0xe01f('0x38')]));return this[_0xe01f('0x37')]['noop'](_0xe01f('0x109'));};AGIVertices['prototype'][_0xe01f('0x10a')]=function(_0x5751a8){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x10b'),_0x5751a8[_0xe01f('0x38')]));var _0x568949='';if(_0x5751a8['trunk_id']){if(!this[_0xe01f('0xa8')](_0x5751a8[_0xe01f('0x10c')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5751a8,'no\x20trunk\x20selected');}else{var _0x2f7089=parseInt(_0x5751a8['trunk_id'],0xa);if(isNaN(_0x2f7089)){_0x568949=_0x5751a8[_0xe01f('0x10c')];}else{_0x568949=this['getTrunk'][_0xe01f('0x72')](this,_0x5751a8[_0xe01f('0x10c')]);if(!_0x568949){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5751a8,'no\x20trunk\x20found');}}}}else if(_0x5751a8[_0xe01f('0x10d')]){_0x568949=_0x5751a8[_0xe01f('0x10d')];}else{return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5751a8,_0xe01f('0x10e'));}var _0x4505b9=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0xe5'),[util['format'](_0xe01f('0x10f'),_0x568949,_0x5751a8[_0xe01f('0x49')]),_0x5751a8[_0xe01f('0x69')],_0x5751a8[_0xe01f('0x110')],_0x5751a8['url']]);if(_0x4505b9[_0xe01f('0xa5')]===-0x1){return _0x4505b9;}return this['channel']['noop'](util[_0xe01f('0x26')]('Executed\x20command\x20%s',_0xe01f('0xe5')));};AGIVertices[_0xe01f('0xe')]['finally']=function(_0x1ecc37){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x111'),_0x1ecc37['label']));return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x112'));};AGIVertices[_0xe01f('0xe')][_0xe01f('0xb')]=function(_0x3564a8){logger['info'](util[_0xe01f('0x26')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3564a8['label']));if(_0x3564a8[_0xe01f('0xaa')]===0x0){return this[_0xe01f('0xa9')](_0x3564a8);}_0x3564a8[_0xe01f('0xaa')]-=0x1;if(!this[_0xe01f('0xa8')](_0x3564a8[_0xe01f('0x113')])){return this['channel'][_0xe01f('0x2a')](_0x3564a8,_0xe01f('0x114'));}var _0x224d80=this[_0xe01f('0x115')][_0xe01f('0x72')](this,_0x3564a8[_0xe01f('0x113')]);if(!_0x224d80){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x3564a8,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x3564a8['variable_id'])){return this['channel'][_0xe01f('0x2a')](_0xe01f('0xda'));}var _0x647e75=this['channel'][_0xe01f('0x116')](_0x224d80,_0x3564a8[_0xe01f('0x117')],_0x3564a8[_0xe01f('0x118')]);var _0x466833=_0x647e75['result']?_0x647e75[_0xe01f('0xa5')]['toString']():'';logger['info'](_0xe01f('0x119'),JSON['stringify'](_0x647e75));if(_0x647e75['result']===-0x1){this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x3564a8,_0x466833);return _0x647e75;}else if(_0x647e75[_0xe01f('0xa7')]===_0xe01f('0x69')){_0x647e75[_0xe01f('0xa5')]=_0x466833[_0xe01f('0x9c')]>=parseInt(_0x3564a8[_0xe01f('0x11a')])?'x':'i';}else{_0x647e75[_0xe01f('0xa5')]=_0x466833[_0xe01f('0x9c')]>=parseInt(_0x3564a8[_0xe01f('0x11a')])&&_0x466833[_0xe01f('0x9c')]<=parseInt(_0x3564a8[_0xe01f('0x118')])?'x':'i';}var _0xd2df4d=this[_0xe01f('0xf')]['sync'](this,_0x3564a8['variable_id']);if(!_0xd2df4d){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x3564a8,_0xe01f('0xdb'));}this[_0xe01f('0x37')][_0xe01f('0xa0')](_0xd2df4d,_0x466833);if(this[_0xe01f('0xa8')](_0x3564a8[_0xe01f('0x11b')])){var _0xdf6cd5=parseInt(_0x3564a8[_0xe01f('0x11b')],0xa);var _0x8533d4=rs[_0xe01f('0x11c')]({'charset':'*','length':_0xdf6cd5});var _0x44915a=_0x466833[_0xe01f('0x9c')];if(_0x44915a>0x0){if(_0x44915a>_0xdf6cd5){this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x3564a8,_0x3564a8[_0xe01f('0x11d')]===_0xe01f('0x11e')?_0x8533d4+_0x466833[_0xe01f('0x11f')](_0xdf6cd5):_0x466833['substr'](0x0,_0x44915a-_0xdf6cd5)+_0x8533d4);}else{this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x3564a8,rs[_0xe01f('0x11c')]({'charset':'*','length':_0x44915a}));}}else{this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x3564a8,'');}}else{this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x3564a8,_0x466833);}return _0x647e75;};AGIVertices[_0xe01f('0xe')]['getsecretdigits']=function(_0x372813){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x120'),_0x372813['label']));return this[_0xe01f('0xb')](_0x372813);};AGIVertices[_0xe01f('0xe')][_0xe01f('0x121')]=function(_0x1b409e){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1b409e[_0xe01f('0x38')]));this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x1b409e,_0x1b409e[_0xe01f('0x122')]);return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x123'),_0x1b409e[_0xe01f('0x122')]));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x124')]=function(_0x390de1){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x125'),_0x390de1['label']));if(!this[_0xe01f('0xa8')](_0x390de1['aws_access_key_id'])||!this[_0xe01f('0xa8')](_0x390de1['aws_secret_access_key'])){return this[_0xe01f('0x37')]['noop'](_0xe01f('0x126'));}if(!this[_0xe01f('0xa8')](_0x390de1['text'])){return this['channel'][_0xe01f('0xab')]('no\x20text\x20configured');}this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x127'),_0x390de1[_0xe01f('0x5d')]));var _0xf704a=this[_0xe01f('0x128')][_0xe01f('0x72')](this,_0x390de1);if(_0xf704a){this['channel'][_0xe01f('0xab')](util['format'](_0xe01f('0x129'),_0xf704a));var _0x31c499=this['channel'][_0xe01f('0x105')](_0xf704a);try{fs[_0xe01f('0x106')](_0xf704a+_0xe01f('0x107'));}catch(_0xf2be01){logger[_0xe01f('0x2a')](_0xf2be01);}return _0x31c499;}return this['channel']['error'](_0x390de1,_0xe01f('0x12a'));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x12b')]=function(_0x530a05){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x12c'),_0x530a05[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x530a05['aws_access_key_id'])||!this[_0xe01f('0xa8')](_0x530a05[_0xe01f('0x8d')])){return this['channel']['noop'](_0xe01f('0x126'));}if(!this[_0xe01f('0xa8')](_0x530a05[_0xe01f('0x8f')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x12d'));}if(!this[_0xe01f('0xa8')](_0x530a05['text'])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xc8'));}this['channel'][_0xe01f('0xe8')]=!![];this[_0xe01f('0x36')](_0x530a05);this['createSquareMessage'](_0x530a05['text'],'in','','');this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x12e'),_0x530a05[_0xe01f('0x5d')]));var _0x36bd2a=this[_0xe01f('0x8b')]['sync'](this,_0x530a05);if(_0x36bd2a){for(var _0xe6c8f4 in _0x36bd2a){if(_0x36bd2a[_0xe01f('0x9d')](_0xe6c8f4)&&_[_0xe01f('0x97')](_0x36bd2a[_0xe6c8f4])){this[_0xe01f('0x37')][_0xe01f('0xa0')](util['format'](_0xe01f('0x12f'),_0xe6c8f4[_0xe01f('0xf5')]()),_0x36bd2a[_0xe6c8f4]);}}if(_['isNil'](_0x36bd2a[_0xe01f('0x7a')])){return this['channel'][_0xe01f('0xab')](_0xe01f('0x130'));}else{this[_0xe01f('0x43')](_0x36bd2a[_0xe01f('0x7a')],_0xe01f('0xea'),_0xe01f('0x131'),'');return this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0x132'),_0x36bd2a[_0xe01f('0x7a')]));}}return this['channel'][_0xe01f('0x2a')](_0x530a05,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xe01f('0xe')]['googleasr']=function(_0x265b06){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x133'),_0x265b06['label'],_0x265b06[_0xe01f('0x69')]));if(!this[_0xe01f('0xa8')](_0x265b06['key'])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x134'));}var _0x368a1e=_0xe01f('0x135');var _0x466fbd=util[_0xe01f('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xe01f('0x11c')](0x4));var _0x59c632=util['format'](_0xe01f('0x9e'),_0x466fbd,_0x368a1e);var _0x3f5da1=!![];if(_0x265b06[_0xe01f('0x136')]===_0xe01f('0x137')){_0x3f5da1=![];}var _0x1fc959=this['channel'][_0xe01f('0x138')](_0x466fbd,_0x368a1e,_0x265b06['intKey'],_0x265b06[_0xe01f('0x69')],undefined,_0x3f5da1);if(_0x1fc959[_0xe01f('0xa5')]!==-0x1){this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x139'),_0x59c632));var _0x59fa10=this[_0xe01f('0x90')]['sync'](this,_0x265b06,_0x59c632);if(_0x59fa10){for(var _0x4e5e47 in _0x59fa10){if(_0x59fa10[_0xe01f('0x9d')](_0x4e5e47)){this['channel']['setVariable'](util['format'](_0xe01f('0x13a'),_0x4e5e47[_0xe01f('0xf5')]()),_0x59fa10[_0x4e5e47]);}}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x13b'),JSON['stringify'](_0x59fa10)));}}return _0x1fc959;};AGIVertices['prototype'][_0xe01f('0x13c')]=function(_0x273e4d){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x13d'),_0x273e4d[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x273e4d[_0xe01f('0x93')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x13e'));}if(!this[_0xe01f('0xa8')](_0x273e4d[_0xe01f('0x94')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x1b7e30=_0xe01f('0x135');var _0x327c0a=util[_0xe01f('0x26')](_0xe01f('0x13f'),FILES_PATH,rs[_0xe01f('0x11c')](0x4));var _0x284f96=util[_0xe01f('0x26')](_0xe01f('0x9e'),_0x327c0a,_0x1b7e30);var _0x1e8b1b=!![];if(_0x273e4d['beep']===_0xe01f('0x137')){_0x1e8b1b=![];}var _0x5b96b5=this[_0xe01f('0x37')][_0xe01f('0x138')](_0x327c0a,_0x1b7e30,_0x273e4d[_0xe01f('0x140')],_0x273e4d[_0xe01f('0x69')],undefined,_0x1e8b1b);if(_0x5b96b5[_0xe01f('0xa5')]!==-0x1){this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')]('tilde\x20%s\x20file\x20created',_0x284f96));var _0x5e01a7=this[_0xe01f('0x92')][_0xe01f('0x72')](this,_0x273e4d,_0x284f96);if(_0x5e01a7){for(var _0x2d789a in _0x5e01a7){if(_0x5e01a7['hasOwnProperty'](_0x2d789a)){this[_0xe01f('0x37')][_0xe01f('0xa0')](util['format'](_0xe01f('0x141'),_0x2d789a[_0xe01f('0xf5')]()),_0x5e01a7[_0x2d789a]);}}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')]('TildeASR\x20Result\x20%s',JSON[_0xe01f('0x75')](_0x5e01a7)));}}return _0x5b96b5;};AGIVertices[_0xe01f('0xe')][_0xe01f('0x142')]=function(_0x33d212){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x143'),_0x33d212[_0xe01f('0x38')]));return this[_0xe01f('0x37')]['continueAt'](_0x33d212[_0xe01f('0x3e')],_0x33d212[_0xe01f('0x3f')],_0x33d212[_0xe01f('0x144')]);};AGIVertices['prototype'][_0xe01f('0x145')]=function(_0x4a4e4d){logger['info'](util[_0xe01f('0x26')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4a4e4d[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x4a4e4d[_0xe01f('0x146')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x4a4e4d,_0xe01f('0x147'));}try{var _0x141da6=eval(_0x4a4e4d[_0xe01f('0x146')])?_0xe01f('0x148'):'false';this['channel'][_0xe01f('0xab')](util['format'](_0xe01f('0x149'),_0x4a4e4d[_0xe01f('0x146')],_0x141da6));return{'code':0xc8,'result':_0x141da6};}catch(_0x390d60){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xe01f('0xe')][_0xe01f('0x14a')]=function(_0x2b283c){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x14b'),_0x2b283c['label']));if(!this['isConfigured'](_0x2b283c['interval_id'])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x2b283c,'no\x20interval\x20configured');}var _0x214f63=this['getIntervals'][_0xe01f('0x72')](this,_0x2b283c[_0xe01f('0x14c')]);if(!_0x214f63){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x2b283c,_0xe01f('0x14d'));}for(var _0x16811d=0x0;_0x16811d<_0x214f63['length'];_0x16811d+=0x1){var _0x2b3baf=this[_0xe01f('0x37')][_0xe01f('0xf')](util[_0xe01f('0x26')]('IFTIME(%s?true:false)',_0x214f63[_0x16811d]));if(_0x2b3baf['result']===-0x1){return _0x2b3baf;}logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x14e'),_0x214f63[_0x16811d],_0x2b3baf[_0xe01f('0xa7')]));if(_0x2b3baf[_0xe01f('0xa7')]==='true'){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x14e'),_0x214f63[_0x16811d],_0xe01f('0x148')));this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x14e'),_0x214f63[_0x16811d],_0xe01f('0x148')));return{'code':0xc8,'result':_0xe01f('0x148')};}else{logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x14e'),_0x214f63[_0x16811d],_0xe01f('0x14f')));this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x14e'),_0x214f63[_0x16811d],'false'));}}return{'code':0xc8,'result':_0xe01f('0x14f')};};AGIVertices['prototype'][_0xe01f('0x150')]=function(_0x3ef778){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3ef778[_0xe01f('0x38')]));return this[_0xe01f('0x37')][_0xe01f('0x150')]();};AGIVertices[_0xe01f('0xe')][_0xe01f('0x151')]=function(_0x471228){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x152'),_0x471228[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x471228['key'])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x134'));}var _0x204565=_0xe01f('0x135');var _0x30f47a=util['format'](_0xe01f('0x13f'),FILES_PATH,rs[_0xe01f('0x11c')](0x4));var _0xf3486d=util[_0xe01f('0x26')](_0xe01f('0x9e'),_0x30f47a,_0x204565);var _0x5f4888=!![];if(_0x471228[_0xe01f('0x136')]==='NOBEEP'){_0x5f4888=![];}var _0x1a5adb=this[_0xe01f('0x37')][_0xe01f('0x138')](_0x30f47a,_0x204565,_0x471228['intKey'],_0x471228[_0xe01f('0x69')],undefined,_0x5f4888);if(_0x1a5adb[_0xe01f('0xa5')]!==-0x1){this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x153'),_0xf3486d));var _0x34d90e=this[_0xe01f('0x85')][_0xe01f('0x72')](this,_0x471228,_0xf3486d);if(_0x34d90e){for(var _0x179b6e in _0x34d90e){if(_0x34d90e['hasOwnProperty'](_0x179b6e)){this[_0xe01f('0x37')][_0xe01f('0xa0')](util[_0xe01f('0x26')]('ISPEECH_ASR_%s',_0x179b6e[_0xe01f('0xf5')]()),_0x34d90e[_0x179b6e]);}}return this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x154'),JSON[_0xe01f('0x75')](_0x34d90e)));}}return _0x1a5adb;};AGIVertices['prototype'][_0xe01f('0x155')]=function(_0x2f9966){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x156'),_0x2f9966[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x2f9966[_0xe01f('0x86')])){return this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20key\x20configured');}if(!this[_0xe01f('0xa8')](_0x2f9966[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xc8'));}this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x157'),_0x2f9966[_0xe01f('0x5d')]));var _0x5ce563=this['ispeechTTS'][_0xe01f('0x72')](this,_0x2f9966);if(_0x5ce563){this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x153'),_0x5ce563));var _0x38e4b4=this['channel'][_0xe01f('0x105')](_0x5ce563,_0x2f9966[_0xe01f('0x140')]);try{fs[_0xe01f('0x106')](_0x5ce563+_0xe01f('0x107'));}catch(_0x52f76b){logger[_0xe01f('0x2a')](_0x52f76b);}return _0x38e4b4;}return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x2f9966,_0xe01f('0x158'));};AGIVertices['prototype'][_0xe01f('0x159')]=function(_0x227a72){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x227a72[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x227a72[_0xe01f('0x15a')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x227a72,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0xe01f('0x15b'),this['channel'][_0xe01f('0x3a')],_0x227a72[_0xe01f('0x15a')]));var _0x1e4e83=this[_0xe01f('0x54')][_0xe01f('0x72')](this,_0x227a72[_0xe01f('0x15a')]);if(_0x1e4e83){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x227a72['findBy']));this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x227a72[_0xe01f('0x15a')]));return{'code':0xc8,'result':_0xe01f('0x15d')};}else{logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15e'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x227a72[_0xe01f('0x15a')]));this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0x15e'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x227a72['findBy']));return{'code':0xc8,'result':_0xe01f('0x15f')};}};AGIVertices[_0xe01f('0xe')][_0xe01f('0x160')]=function(_0x5754d4){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x161'),_0x5754d4[_0xe01f('0x38')]));if(!this['isConfigured'](_0x5754d4[_0xe01f('0x15a')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5754d4,_0xe01f('0x162'));}logger['info'](util[_0xe01f('0x26')](_0xe01f('0x15b'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x5754d4[_0xe01f('0x15a')]));var _0x9a2870=this[_0xe01f('0x53')][_0xe01f('0x72')](this,_0x5754d4[_0xe01f('0x15a')]);if(_0x9a2870){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x5754d4[_0xe01f('0x15a')]));this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xe01f('0x3a')],_0x5754d4[_0xe01f('0x15a')]));return{'code':0xc8,'result':_0xe01f('0x15d')};}else{logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15e'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x5754d4[_0xe01f('0x15a')]));this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0x15e'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x5754d4[_0xe01f('0x15a')]));return{'code':0xc8,'result':_0xe01f('0x15f')};}};AGIVertices['prototype']['math']=function(_0x1d2586){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x163'),_0x1d2586[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x1d2586[_0xe01f('0x164')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x1d2586,'no\x20operation\x20configured');}this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')]('math\x20%s',_0x1d2586[_0xe01f('0x164')]));var _0xa45081=eval(_0x1d2586[_0xe01f('0x164')]);if(!this[_0xe01f('0xa8')](_0x1d2586[_0xe01f('0xd9')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xda'));}var _0x54f8a2=this[_0xe01f('0xf')]['sync'](this,_0x1d2586['variable_id']);if(!_0x54f8a2){return this[_0xe01f('0x37')]['error'](_0x1d2586,_0xe01f('0xdb'));}if(_[_0xe01f('0x9b')](_0xa45081)){var _0x29beb6=this;_0xa45081[_0xe01f('0xdd')](function(_0x458896,_0x11e363){_0x29beb6[_0xe01f('0x37')][_0xe01f('0xa0')](util[_0xe01f('0x26')](_0xe01f('0x165'),_0x54f8a2,_0x11e363),_0x458896);});return this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x166'),_0x54f8a2));}else{return this[_0xe01f('0x37')]['setVariable'](_0x54f8a2,_0xa45081);}};AGIVertices[_0xe01f('0xe')][_0xe01f('0xa')]=function(_0x45d84c){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x167'),_0x45d84c[_0xe01f('0x38')]));if(_0x45d84c[_0xe01f('0xaa')]===0x0){return this[_0xe01f('0xa9')](_0x45d84c);}_0x45d84c[_0xe01f('0xaa')]-=0x1;if(!this[_0xe01f('0xa8')](_0x45d84c[_0xe01f('0x113')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x45d84c,_0xe01f('0x114'));}var _0x4e2054=this[_0xe01f('0x115')][_0xe01f('0x72')](this,_0x45d84c[_0xe01f('0x113')]);if(!_0x4e2054){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x45d84c,'no\x20file\x20audio\x20found');}var _0x3f258a=this[_0xe01f('0x37')][_0xe01f('0x116')](_0x4e2054,_0x45d84c[_0xe01f('0x117')],_0x45d84c[_0xe01f('0x168')]);var _0x3651e4=_0x3f258a[_0xe01f('0xa5')];if(_0x3f258a[_0xe01f('0xa5')]===-0x1){this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x45d84c,'-1');return _0x3f258a;}else if(_0x3f258a[_0xe01f('0xa7')]===_0xe01f('0x69')){_0x3f258a[_0xe01f('0xa5')]=_0x3f258a[_0xe01f('0xa5')]['length']>0x0?_0x3f258a[_0xe01f('0xa5')]:'t';}else if(_['isEmpty'](_0x3f258a['result'])){_0x3f258a[_0xe01f('0xa5')]='#';_0x3651e4='#';}if(!this[_0xe01f('0xa8')](_0x45d84c['variable_id'])){this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4e2c97=this['getVariable'][_0xe01f('0x72')](this,_0x45d84c[_0xe01f('0xd9')]);if(!_0x4e2c97){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x45d84c,'no\x20variable\x20found');}this[_0xe01f('0x37')][_0xe01f('0xa0')](_0x4e2c97,_0x3651e4);}this['createSquareDetailsReport'][_0xe01f('0x72')](this,_0x45d84c,_0x3651e4);return _0x3f258a;};AGIVertices[_0xe01f('0xe')][_0xe01f('0xab')]=function(_0x3ba4e7){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x169'),_0x3ba4e7['label']));return this[_0xe01f('0x37')][_0xe01f('0xab')](_0x3ba4e7[_0xe01f('0x16a')]||_0x3ba4e7[_0xe01f('0x38')]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0x16b')]=function(_0x228eaa){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x16c'),_0x228eaa[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x228eaa[_0xe01f('0x15a')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x228eaa,_0xe01f('0x162'));}logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15b'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x228eaa[_0xe01f('0x15a')]));var _0x57fc60=this['getPause']['sync'](this,_0x228eaa[_0xe01f('0x16d')]);var _0x1bf178=this[_0xe01f('0x51')][_0xe01f('0x72')](this,_0x228eaa[_0xe01f('0x15a')],_0x57fc60);if(_0x1bf178){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x228eaa['findBy']));this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')]['callerid'],_0x228eaa['findBy']));return{'code':0xc8,'result':_0xe01f('0x15d')};}else{logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15e'),this['channel'][_0xe01f('0x3a')],_0x228eaa[_0xe01f('0x15a')]));this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this['channel']['callerid'],_0x228eaa[_0xe01f('0x15a')]));return{'code':0xc8,'result':_0xe01f('0x15f')};}};AGIVertices['prototype'][_0xe01f('0x16e')]=function(_0x5ed1ce){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x16f'),_0x5ed1ce[_0xe01f('0x38')]));if(!this['isConfigured'](_0x5ed1ce['file_id'])){return this[_0xe01f('0x37')]['error'](_0x5ed1ce,_0xe01f('0x114'));}var _0x12958d=this['getSound'][_0xe01f('0x72')](this,_0x5ed1ce[_0xe01f('0x113')]);if(!_0x12958d){return this['channel'][_0xe01f('0x2a')](_0x5ed1ce,_0xe01f('0x170'));}var _0x2ef073=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0x171'),[_0x12958d,_0x5ed1ce[_0xe01f('0x110')]]);if(_0x2ef073[_0xe01f('0xa5')]===-0x1){return _0x2ef073;}return this['channel']['noop'](util[_0xe01f('0x26')](_0xe01f('0xc5'),_0xe01f('0x171'),_0x12958d));};AGIVertices['prototype']['queue']=function(_0x370647){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x172'),_0x370647[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x370647[_0xe01f('0x173')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x370647,_0xe01f('0x174'));}var _0x34ea47='';var _0x164255=parseInt(_0x370647['queue_id'],0xa);if(isNaN(_0x164255)){_0x34ea47=_0x370647['queue_id'];}else{_0x34ea47=this[_0xe01f('0x14')][_0xe01f('0x72')](this,_0x370647[_0xe01f('0x173')]);if(!_0x34ea47){return this['channel'][_0xe01f('0x2a')](_0x370647,'no\x20queue\x20found');}}var _0x15058c='';if(this['isConfigured'](_0x370647['file_id'])){var _0x1de0fe=this['getSound'][_0xe01f('0x72')](this,_0x370647[_0xe01f('0x113')]);if(_0x1de0fe){_0x15058c=_0x1de0fe;}}this['createSquareDetailsReport'][_0xe01f('0x72')](this,_0x370647,_0x34ea47);if(_0x370647['opts'][_0xe01f('0x175')]('x')<0x0){_0x370647[_0xe01f('0x110')]+='x';}if(_0x370647['opts'][_0xe01f('0x175')]('X')<0x0){_0x370647[_0xe01f('0x110')]+='X';}this[_0xe01f('0x37')][_0xe01f('0xa0')](_0xe01f('0x176'),_0x34ea47?_0x34ea47[_0xe01f('0x177')]():'');var _0xa1ec2=this[_0xe01f('0x37')][_0xe01f('0xac')](_0xe01f('0x178'),[_0x34ea47,_0x370647[_0xe01f('0x110')],_0x370647[_0xe01f('0x67')],_0x15058c,_0x370647[_0xe01f('0x69')],_0x370647[_0xe01f('0x6')],_0x370647[_0xe01f('0x179')],_0x370647[_0xe01f('0x17a')],'',_0x370647[_0xe01f('0x17b')]]);if(_0xa1ec2[_0xe01f('0xa5')]===-0x1){return _0xa1ec2;}return this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0xc5'),_0xe01f('0x178'),_0x34ea47));};AGIVertices[_0xe01f('0xe')]['record']=function(_0x5963fe){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x5963fe[_0xe01f('0x38')]));var _0x23b29a=_0x5963fe[_0xe01f('0x17c')]||_0xe01f('0x135');var _0x4d8f0b=util[_0xe01f('0x26')](_0xe01f('0x17d'),this[_0xe01f('0x37')]['uniqueid'],rs['generate'](0x5));var _0x1aaeba=util[_0xe01f('0x26')](_0xe01f('0x17e'),FILES_PATH,_0x4d8f0b,_0x23b29a);var _0x608a3a=util[_0xe01f('0x26')](_0xe01f('0x13f'),FILES_PATH,_0x4d8f0b);this[_0xe01f('0x3b')]['sync'](this,_0x5963fe,_0x4d8f0b,_0x1aaeba);this['channel'][_0xe01f('0xa0')]('RECORDING_SAVENAME',_0x4d8f0b);logger[_0xe01f('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x608a3a,_0x23b29a,_0x5963fe[_0xe01f('0x17f')],_0x5963fe[_0xe01f('0x69')]);return this[_0xe01f('0x37')][_0xe01f('0x138')](_0x608a3a,_0x23b29a,_0x5963fe[_0xe01f('0x17f')],_0x5963fe[_0xe01f('0x69')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x1a67ee){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x180'),_0x1a67ee[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x1a67ee[_0xe01f('0x67')])){return this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20url\x20configured');}var _0xbc15e8=this['restAPI'][_0xe01f('0x72')](this,_0x1a67ee);logger['info'](util[_0xe01f('0x26')]('Response:',util['inspect'](_0xbc15e8,{'showHidden':![],'depth':null})));if(!this[_0xe01f('0xa8')](_0x1a67ee['variable_id'])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x181'));}var _0x301854=this[_0xe01f('0xf')]['sync'](this,_0x1a67ee[_0xe01f('0xd9')]);if(!_0x301854){return this[_0xe01f('0x37')]['error'](_0x1a67ee,_0xe01f('0xdb'));}this[_0xe01f('0x37')][_0xe01f('0xa0')](util[_0xe01f('0x26')](_0xe01f('0x182'),_0x301854),_0xbc15e8[_0xe01f('0x78')]?_0xbc15e8['statusCode']:_0xe01f('0x183'));this[_0xe01f('0x37')][_0xe01f('0xa0')](util['format']('%s_STATUS_MESSAGE',_0x301854),_0xbc15e8['statusMessage']?_0xbc15e8[_0xe01f('0x79')]:'OK');if(_0xbc15e8[_0xe01f('0x76')]){try{this[_0xe01f('0x9f')](_0xbc15e8['body'],_0x301854);}catch(_0xfaf156){logger['error'](util[_0xe01f('0x26')](_0xe01f('0x184'),_0x301854));}}return this[_0xe01f('0x37')][_0xe01f('0xab')](util['format'](_0xe01f('0x185'),_0x301854));};AGIVertices[_0xe01f('0xe')]['saydigits']=function(_0x9783cc){logger['info'](util[_0xe01f('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x9783cc[_0xe01f('0x38')]));return this['channel'][_0xe01f('0x186')](_0x9783cc[_0xe01f('0x187')][_0xe01f('0x59')](/\s+/g,''),_0x9783cc[_0xe01f('0x17f')]);};AGIVertices['prototype'][_0xe01f('0x188')]=function(_0x4aea88){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x189'),_0x4aea88[_0xe01f('0x38')]));return this[_0xe01f('0x37')][_0xe01f('0x18a')](_0x4aea88[_0xe01f('0x6a')][_0xe01f('0x59')](/\s+/g,''),_0x4aea88[_0xe01f('0x17f')]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0x18b')]=function(_0x3b8de5){logger['info'](util['format'](_0xe01f('0x18c'),_0x3b8de5['label']));return this[_0xe01f('0x37')][_0xe01f('0x18d')](_0x3b8de5['text'],_0x3b8de5[_0xe01f('0x17f')]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0x18e')]=function(_0x358b92){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x358b92['label']));if(!this[_0xe01f('0xa8')](_0x358b92[_0xe01f('0x18f')])){return this[_0xe01f('0x37')][_0xe01f('0xab')]('no\x20mail\x20account\x20configured');}var _0x1ad58e=this['getMailAccount'][_0xe01f('0x72')](this,_0x358b92['account_id']);if(!_0x1ad58e||!_0x1ad58e[_0xe01f('0x190')]){return this[_0xe01f('0x37')]['error'](_0x358b92,_0xe01f('0x191'));}var _0x57b083={'from':util[_0xe01f('0x26')]('\x22%s\x22\x20<%s>',_0x1ad58e[_0xe01f('0x12')],_0x1ad58e[_0xe01f('0x192')]||_0x1ad58e[_0xe01f('0x190')][_0xe01f('0x193')]),'to':_0x358b92['to']||'','cc':_0x358b92['cc']||'','bcc':_0x358b92[_0xe01f('0x194')]||'','subject':_0x358b92[_0xe01f('0x195')],'html':_0x358b92[_0xe01f('0x5d')],'text':_0x358b92[_0xe01f('0x5d')]};if(this[_0xe01f('0xa8')](_0x358b92['template_id'])){}logger['debug'](_0xe01f('0x196'),JSON[_0xe01f('0x75')](_0x57b083));this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x358b92,_0x358b92[_0xe01f('0x18f')]);this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1ad58e[_0xe01f('0x12')]));this[_0xe01f('0x20')][_0xe01f('0x72')](this,_0x1ad58e['smtpOptions'],_0x57b083);return this[_0xe01f('0x37')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xe01f('0xe')]['sendFax']=function(_0x1eabdb){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x197'),_0x1eabdb[_0xe01f('0x38')]));return this['channel'][_0xe01f('0xab')](_0xe01f('0x198'));};AGIVertices[_0xe01f('0xe')]['sendSMS']=function(_0x26f7cf){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x199'),_0x26f7cf[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x26f7cf[_0xe01f('0x19a')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x19b'));}var _0x24d812=this[_0xe01f('0x33')]['sync'](this,_0x26f7cf[_0xe01f('0x19a')]);if(!_0x24d812){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x26f7cf,_0xe01f('0x19c'));}var _0x4858f6={'body':_0x26f7cf[_0xe01f('0x19d')],'phone':_0x26f7cf['to']||'','SmsAccountId':_0x24d812['id']};logger[_0xe01f('0xe1')](_0xe01f('0x19e'),JSON['stringify'](_0x4858f6));this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x26f7cf,_0x26f7cf[_0xe01f('0x19a')]);this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x19f'),_0x24d812[_0xe01f('0x12')]));this['createSmsMessage']['sync'](this,_0x4858f6);return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x1a0'));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1a1')]=function(_0x5c0b1d){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x1a2'),_0x5c0b1d[_0xe01f('0x38')]));if(!this['isConfigured'](_0x5c0b1d[_0xe01f('0xd9')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5c0b1d,'no\x20variable\x20selected');}var _0x3b9657=this[_0xe01f('0xf')]['sync'](this,_0x5c0b1d['variable_id']);if(!_0x3b9657){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x5c0b1d,'no\x20variable\x20found');}return this['channel'][_0xe01f('0xa0')](_0x3b9657,_0x5c0b1d[_0xe01f('0x1a3')]);};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1a4')]=function(_0x5a29fe){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x1a5'),_0x5a29fe[_0xe01f('0x38')]));this['channel'][_0xe01f('0xab')](_0xe01f('0x1a6'));var _0x2533dd=this[_0xe01f('0x37')]['getVariable'](_0xe01f('0x1a7'));if(!_['isEmpty'](_0x2533dd[_0xe01f('0xa7')])){this[_0xe01f('0x37')]['uniqueid']=_0x2533dd[_0xe01f('0xa7')];}if(_0x5a29fe[_0xe01f('0xb9')]==='yes'){this['channel'][_0xe01f('0xab')](_0xe01f('0x1a8'));return this[_0xe01f('0x37')][_0xe01f('0xb9')]();}return this[_0xe01f('0x37')][_0xe01f('0xab')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xe01f('0x1a9')]=function(_0x4da413){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x1aa'),_0x4da413[_0xe01f('0x38')]));if(!this['isConfigured'](_0x4da413['project_id'])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x4da413,_0xe01f('0x1ab'));}var _0x11c807=this[_0xe01f('0x1ac')][_0xe01f('0x72')](this,_0x4da413[_0xe01f('0x1ad')]);if(!this[_0xe01f('0xa8')](_0x11c807)){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x4da413,util[_0xe01f('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4da413[_0xe01f('0x1ad')]));}if(_0x11c807===this[_0xe01f('0x37')][_0xe01f('0x1ae')]){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x4da413,_0xe01f('0x1af'));}this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x4da413,_0x11c807);var _0x3360e7=this['channel'][_0xe01f('0xac')]('AGI',util[_0xe01f('0x26')](_0xe01f('0x1b0'),config[_0xe01f('0x6')][_0xe01f('0x1b1')]||_0xe01f('0x1b2'),_0x11c807,this[_0xe01f('0x37')][_0xe01f('0x1ae')]));if(_0x3360e7[_0xe01f('0xa5')]===-0x1){return _0x3360e7;}return this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')](_0xe01f('0xc5'),_0xe01f('0x1b3'),_0x11c807));};AGIVertices['prototype'][_0xe01f('0x1b4')]=function(_0x284294){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x1b5'),_0x284294[_0xe01f('0x38')]));var _0x10e62a=this['shellCommand']['sync'](this,_0x284294['command']);this[_0xe01f('0x36')][_0xe01f('0x72')](this,_0x284294,_0x284294[_0xe01f('0x1b6')]);if(this['isConfigured'](_0x284294['variable_id'])){var _0x4f73d5=this['getVariable'][_0xe01f('0x72')](this,_0x284294[_0xe01f('0xd9')]);if(_0x4f73d5){this[_0xe01f('0x37')]['setVariable'](_0x4f73d5,_0x10e62a);return this[_0xe01f('0x37')][_0xe01f('0xab')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x284294[_0xe01f('0x1b6')],_0x4f73d5));}}return this['channel']['noop'](util['format'](_0xe01f('0x1b7'),_0x284294[_0xe01f('0x1b6')]));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1b8')]=function(_0x57e6b0){logger[_0xe01f('0x2c')](util['format'](_0xe01f('0x1b9'),_0x57e6b0[_0xe01f('0x38')]));_0x57e6b0['text']=_0x57e6b0['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe01f('0xa8')](_0x57e6b0['apiKey'])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0x1ba'));}if(!this[_0xe01f('0xa8')](_0x57e6b0[_0xe01f('0x5d')])){return this[_0xe01f('0x37')][_0xe01f('0xab')](_0xe01f('0xc8'));}this['channel']['noop'](util[_0xe01f('0x26')](_0xe01f('0x1bb'),_0x57e6b0['text']));var _0x2a7e94=this[_0xe01f('0x5a')][_0xe01f('0x72')](this,_0x57e6b0);if(_0x2a7e94){this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2a7e94));var _0x3908d0=this[_0xe01f('0x37')][_0xe01f('0x105')](_0x2a7e94);try{fs['unlink'](_0x2a7e94+'.wav');}catch(_0xf35d2c){logger['error'](_0xf35d2c);}return _0x3908d0;}return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x57e6b0,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x576d78){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x1bc'),_0x576d78[_0xe01f('0x38')]));_0x576d78['text']=_0x576d78['text'][_0xe01f('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x576d78['text'])){return this['channel'][_0xe01f('0xab')](_0xe01f('0xc8'));}this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x1bd'),_0x576d78[_0xe01f('0x5d')]));var _0x255ec5=this[_0xe01f('0x64')][_0xe01f('0x72')](this,_0x576d78);if(_0x255ec5){this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x255ec5));var _0x4b5da1=this['channel'][_0xe01f('0x105')](_0x255ec5);try{fs[_0xe01f('0x106')](_0x255ec5+'.wav');}catch(_0x87c80){logger[_0xe01f('0x2a')](_0x87c80);}return _0x4b5da1;}return this['channel'][_0xe01f('0x2a')](_0x576d78,_0xe01f('0x1be'));};AGIVertices[_0xe01f('0xe')][_0xe01f('0x1bf')]=function(_0x1fff23){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x1c0'),_0x1fff23['label']));if(!this[_0xe01f('0xa8')](_0x1fff23[_0xe01f('0x15a')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x1fff23,_0xe01f('0x162'));}logger['info'](util[_0xe01f('0x26')](_0xe01f('0x15b'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x1fff23[_0xe01f('0x15a')]));var _0x18a0b9=this[_0xe01f('0x52')][_0xe01f('0x72')](this,_0x1fff23['findBy']);if(_0x18a0b9){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x1fff23['findBy']));this['channel'][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x15c'),this['channel']['callerid'],_0x1fff23[_0xe01f('0x15a')]));return{'code':0xc8,'result':_0xe01f('0x15d')};}else{logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xe01f('0x3a')],_0x1fff23[_0xe01f('0x15a')]));this[_0xe01f('0x37')][_0xe01f('0xab')](util[_0xe01f('0x26')](_0xe01f('0x15e'),this[_0xe01f('0x37')][_0xe01f('0x3a')],_0x1fff23['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe01f('0xe')]['voicemail']=function(_0x1ea260){logger['info'](util[_0xe01f('0x26')](_0xe01f('0x1c1'),_0x1ea260[_0xe01f('0x38')]));var _0x4ee380=this['channel'][_0xe01f('0xac')](_0xe01f('0x1c2'),[_0x1ea260[_0xe01f('0x1c3')],_0x1ea260[_0xe01f('0x7c')]]);if(_0x4ee380[_0xe01f('0xa5')]===-0x1){return _0x4ee380;}return this[_0xe01f('0x37')]['noop'](util[_0xe01f('0x26')](_0xe01f('0xc5'),_0xe01f('0x1c2'),_0x1ea260[_0xe01f('0x1c3')]));};AGIVertices[_0xe01f('0xe')]['vswitch']=function(_0x1b51d6){logger[_0xe01f('0x2c')](util[_0xe01f('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1b51d6[_0xe01f('0x38')]));if(!this[_0xe01f('0xa8')](_0x1b51d6[_0xe01f('0xd9')])){return this[_0xe01f('0x37')][_0xe01f('0x2a')](_0x1b51d6,_0xe01f('0x1c4'));}var _0x20c87e=this[_0xe01f('0xf')][_0xe01f('0x72')](this,_0x1b51d6[_0xe01f('0xd9')]);if(!_0x20c87e){return this['channel'][_0xe01f('0x2a')](_0x1b51d6,_0xe01f('0xdb'));}var _0x2586ac=this[_0xe01f('0x37')]['getVariable'](_0x20c87e);return{'code':0xc8,'result':_0x2586ac[_0xe01f('0xa7')]?_0x2586ac[_0xe01f('0xa7')]:'-'};};String['prototype'][_0xe01f('0xa3')]=function(_0x2f3ba4,_0x222341){return this[_0xe01f('0xa2')](_0x2f3ba4)[_0xe01f('0x1c5')](_0x222341);};module[_0xe01f('0x1c6')]=AGIVertices; \ No newline at end of file +var _0xcb99=['TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','shelljs','moment','mustache','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','uniqueid','callerid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agent','agentPause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','extra','maxRetry','retry','mrcpsynth','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s'];(function(_0x530cd1,_0x5d105f){var _0x263afb=function(_0xfcc2de){while(--_0xfcc2de){_0x530cd1['push'](_0x530cd1['shift']());}};_0x263afb(++_0x5d105f);}(_0xcb99,0x8b));var _0x9cb9=function(_0x3e5325,_0x55af33){_0x3e5325=_0x3e5325-0x0;var _0x5a1c63=_0xcb99[_0x3e5325];return _0x5a1c63;};'use strict';var fs=require('fs');var util=require(_0x9cb9('0x0'));var _=require('lodash');var sh=require(_0x9cb9('0x1'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x9cb9('0x2'));var Mustache=require(_0x9cb9('0x3'));var rp=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var scripts=require('./scripts');var FILES_PATH=_0x9cb9('0x7');var recursiveMapAttributes=['rawHeaders',_0x9cb9('0x8')];var verticesWithRetry=[_0x9cb9('0x9'),_0x9cb9('0xa'),_0x9cb9('0xb')];var AGIVertices=function(_0x82e3e,_0x124bd0,_0x106f17){this[_0x9cb9('0xc')]=_0x82e3e;this['rpc']=_0x124bd0;this['mailRpc']=_0x106f17;};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xe')]=function(_0x1b4fa6,_0x5a0ac7){this[_0x9cb9('0xf')][_0x9cb9('0x10')](_0x1b4fa6)['then'](function(_0x4fb80c){_0x5a0ac7(null,_0x4fb80c?_0x4fb80c[_0x9cb9('0x11')]:![]);})[_0x9cb9('0x12')](function(_0x3382c8){_0x5a0ac7(_0x3382c8);});};AGIVertices[_0x9cb9('0xd')]['getVoiceQueue']=function(_0x255f8e,_0x37dc98){this[_0x9cb9('0xf')][_0x9cb9('0x13')](_0x255f8e)[_0x9cb9('0x14')](function(_0x252bef){_0x37dc98(null,_0x252bef?_0x252bef[_0x9cb9('0x11')]:![]);})[_0x9cb9('0x12')](function(_0x3975a5){_0x37dc98(_0x3975a5);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x15')]=function(_0x191199,_0x220ee8){this[_0x9cb9('0xf')][_0x9cb9('0x16')](_0x191199)[_0x9cb9('0x14')](function(_0x41e598){_0x220ee8(null,_0x41e598?_0x41e598[_0x9cb9('0x11')]:![]);})['catch'](function(_0x59fcae){_0x220ee8(_0x59fcae);});};AGIVertices[_0x9cb9('0xd')]['getSquareOdbc']=function(_0x5ddf77,_0x4e6abc){this[_0x9cb9('0xf')]['getSquareOdbcById'](_0x5ddf77)[_0x9cb9('0x14')](function(_0x3b1244){_0x4e6abc(null,_0x3b1244?_0x3b1244[_0x9cb9('0x17')]:![]);})[_0x9cb9('0x12')](function(_0x3633d0){_0x4e6abc(_0x3633d0);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x18')]=function(_0x1375e3,_0x20d210){this[_0x9cb9('0xf')][_0x9cb9('0x19')](_0x1375e3)[_0x9cb9('0x14')](function(_0x16cc17){_0x20d210(null,_0x16cc17?_0x16cc17[_0x9cb9('0x11')]:![]);})['catch'](function(_0x57fc41){_0x20d210(_0x57fc41);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1a')]=function(_0x274ab3,_0x377e6f){this[_0x9cb9('0xf')][_0x9cb9('0x1b')](_0x274ab3)[_0x9cb9('0x14')](function(_0x110161){_0x377e6f(null,_0x110161?_0x110161[_0x9cb9('0x11')]:![]);})['catch'](function(_0x1f42b3){_0x377e6f(_0x1f42b3);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1c')]=function(_0x40649c,_0x4db8a4){var _0xa1a575=this;this['rpc'][_0x9cb9('0x1d')](_0x40649c)[_0x9cb9('0x14')](function(_0x1ca96c){_0x4db8a4(null,_0x1ca96c?_0xa1a575[_0x9cb9('0x1e')](_0x1ca96c['save_name']):![]);})[_0x9cb9('0x12')](function(_0x3b7bba){_0x4db8a4(_0x3b7bba);});};AGIVertices[_0x9cb9('0xd')]['getMailAccount']=function(_0x3893c7,_0x5a68ac){this[_0x9cb9('0xf')][_0x9cb9('0x1f')](_0x3893c7)[_0x9cb9('0x14')](function(_0x2ed362){_0x5a68ac(null,_0x2ed362?_0x2ed362:![]);})[_0x9cb9('0x12')](function(_0x33ec8e){_0x5a68ac(_0x33ec8e);});};AGIVertices['prototype'][_0x9cb9('0x20')]=function(_0x2603a6,_0x123ada,_0x547ee8){this['mailRpc'][_0x9cb9('0x20')](_0x2603a6,_0x123ada)[_0x9cb9('0x14')](function(){_0x547ee8(null);})[_0x9cb9('0x12')](function(_0x5302f9){_0x547ee8(_0x5302f9);});};AGIVertices['prototype'][_0x9cb9('0x21')]=function(_0x395dae,_0x59a521){this[_0x9cb9('0xf')][_0x9cb9('0x22')](_0x395dae)[_0x9cb9('0x14')](function(_0x354c0f){if(_0x354c0f){if(_0x354c0f[_0x9cb9('0x23')]){_0x59a521(null,[_0x354c0f['interval']]);}else{_0x59a521(null,_[_0x9cb9('0x24')](_0x354c0f[_0x9cb9('0x25')],'interval'));}}else{_0x59a521(null,![]);}})[_0x9cb9('0x12')](function(_0x520ebf){_0x59a521(_0x520ebf);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1e')]=function(_0x5206af){return util['format'](_0x9cb9('0x26'),FILES_PATH,_0x5206af);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x27')]=function(_0x2595f9,_0x448e2c,_0x2dd463){odbc[_0x9cb9('0x28')](_0x2595f9,function(_0x55fa61){if(_0x55fa61){logger[_0x9cb9('0x29')](_0x9cb9('0x2a'),_0x55fa61);_0x2dd463(_0x55fa61);}else{logger[_0x9cb9('0x2b')](_0x9cb9('0x2c'));odbc[_0x9cb9('0x2d')](_0x448e2c,function(_0x2bbbea,_0x4ddbc2){if(_0x2bbbea){logger[_0x9cb9('0x2b')](_0x9cb9('0x2e'),_0x448e2c);_0x2dd463(_0x2bbbea);}else{logger[_0x9cb9('0x2b')](_0x9cb9('0x2f'),_0x448e2c);odbc[_0x9cb9('0x30')](function(_0x3ab4f3){if(_0x3ab4f3){logger[_0x9cb9('0x29')](_0x9cb9('0x31'),_0x3ab4f3);}_0x2dd463(null,_0x4ddbc2);});}});}});};AGIVertices[_0x9cb9('0xd')]['getSmsAccount']=function(_0x448113,_0x5c0811){this[_0x9cb9('0xf')]['getSmsAccountById'](_0x448113)[_0x9cb9('0x14')](function(_0x2f8c06){_0x5c0811(null,_0x2f8c06?_0x2f8c06:![]);})[_0x9cb9('0x12')](function(_0x1d9d54){_0x5c0811(_0x1d9d54);});};AGIVertices['prototype'][_0x9cb9('0x32')]=function(_0x4f9f9f,_0x9a4f8){this[_0x9cb9('0xf')][_0x9cb9('0x32')](_0x4f9f9f)[_0x9cb9('0x14')](function(_0x1ed0b3){_0x9a4f8(null,_0x1ed0b3);})['catch'](function(_0x26a2ff){_0x9a4f8(_0x26a2ff);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x33')]=function(_0x26fea4,_0x3df17f,_0xb7535){this[_0x9cb9('0xf')][_0x9cb9('0x33')]({'uniqueid':this[_0x9cb9('0xc')]['uniqueid'],'node':_0x26fea4[_0x9cb9('0x34')],'application':_0x26fea4[_0x9cb9('0x35')],'data':_0x3df17f||null,'project_name':this[_0x9cb9('0xc')][_0x9cb9('0x36')],'callerid':this[_0x9cb9('0xc')]['callerid']})[_0x9cb9('0x14')](function(_0x1f4314){if(_0xb7535){_0xb7535(null,_0x1f4314);}})[_0x9cb9('0x12')](function(_0x52c295){if(_0xb7535){_0xb7535(_0x52c295);}});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x37')]=function(_0x22fba8,_0x4a6dc9,_0x12b06d,_0x2f72ca){this[_0x9cb9('0xf')][_0x9cb9('0x37')]({'uniqueid':this[_0x9cb9('0xc')][_0x9cb9('0x38')],'callerid':this['channel'][_0x9cb9('0x39')],'calleridname':this[_0x9cb9('0xc')][_0x9cb9('0x3a')],'context':this[_0x9cb9('0xc')][_0x9cb9('0x3b')],'extension':this[_0x9cb9('0xc')][_0x9cb9('0x3c')],'priority':this[_0x9cb9('0xc')][_0x9cb9('0x3d')],'accountcode':this[_0x9cb9('0xc')][_0x9cb9('0x3e')],'dnid':this[_0x9cb9('0xc')][_0x9cb9('0x3f')],'projectName':this['channel'][_0x9cb9('0x36')],'saveName':_0x4a6dc9,'filename':_0x22fba8['file']||_0x4a6dc9,'savePath':_0x12b06d})[_0x9cb9('0x14')](function(_0x23fece){_0x2f72ca(null,_0x23fece);})[_0x9cb9('0x12')](function(_0x5a7691){_0x2f72ca(_0x5a7691);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x40')]=function(_0x32d39f,_0x9da13e,_0x4d4a00,_0x507efe,_0x57475e){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x9cb9('0x38')],'body':_0x32d39f,'direction':_0x9da13e,'providerName':_0x4d4a00,'providerResponse':_0x507efe})[_0x9cb9('0x14')](function(_0x5ffd1e){if(_0x57475e){_0x57475e(null,_0x5ffd1e);}})['catch'](function(_0x26d944){if(_0x57475e){_0x57475e(_0x26d944);}});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x41')]=function(_0xa29e91,_0x2ce626){this[_0x9cb9('0xf')][_0x9cb9('0x41')]({'firstName':_[_0x9cb9('0x42')](_0xa29e91['name'])||_[_0x9cb9('0x43')](_0xa29e91['name'])?_0x9cb9('0x44')+Math[_0x9cb9('0x45')]():_0xa29e91[_0x9cb9('0x11')],'lastName':_[_0x9cb9('0x42')](_0xa29e91['lastName'])||_['isNil'](_0xa29e91[_0x9cb9('0x46')])?null:_0xa29e91[_0x9cb9('0x46')],'phone':_0xa29e91[_0x9cb9('0x47')],'ListId':_0xa29e91['list_id'],'scheduledat':_0xa29e91[_0x9cb9('0x48')],'callbackUniqueid':this['channel'][_0x9cb9('0x38')],'tags':_0x9cb9('0x49'),'description':_0x9cb9('0x4a')+_0xa29e91[_0x9cb9('0x48')]['toString'](),'priority':_0xa29e91[_0x9cb9('0x4b')]})[_0x9cb9('0x14')](function(_0x5b0c80){_0x2ce626(null,_0x5b0c80);})['catch'](function(_0x50b115){_0x2ce626(_0x50b115);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x4c')]=function(_0x5456d4,_0x4fa419){this[_0x9cb9('0xf')][_0x9cb9('0x4d')](_0x5456d4)[_0x9cb9('0x14')](function(_0x146fec){_0x4fa419(null,_0x146fec?_0x146fec[_0x9cb9('0x11')]:![]);})['catch'](function(_0x2c9356){_0x4fa419(_0x2c9356);});};AGIVertices['prototype']['agentPause']=function(_0x32e651,_0x2e7be8,_0x18c0bc){var _0x4f28c2={'role':_0x9cb9('0x4e')};_0x4f28c2[_0x32e651]=this[_0x9cb9('0xc')][_0x9cb9('0x39')];this[_0x9cb9('0xf')][_0x9cb9('0x4f')](_0x4f28c2,_0x2e7be8,this[_0x9cb9('0xc')][_0x9cb9('0x38')])[_0x9cb9('0x14')](function(_0x2f6e63){_0x18c0bc(null,_[_0x9cb9('0x43')](_0x2f6e63)?![]:!![]);})[_0x9cb9('0x12')](function(_0x19f9ff){logger[_0x9cb9('0x29')](_0x19f9ff);_0x18c0bc(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x3e19ca,_0x41ff82){var _0x353bf9={'role':'agent'};_0x353bf9[_0x3e19ca]=this[_0x9cb9('0xc')][_0x9cb9('0x39')];this['rpc']['agentUnpause'](_0x353bf9)[_0x9cb9('0x14')](function(_0x22db43){_0x41ff82(null,_[_0x9cb9('0x43')](_0x22db43)?![]:!![]);})['catch'](function(_0x2f0ab3){logger['error'](_0x2f0ab3);_0x41ff82(null,![]);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x50')]=function(_0x274dcd,_0x2bf1a3){var _0x3b3897={'role':_0x9cb9('0x4e')};_0x3b3897[_0x274dcd]=this['channel']['callerid'];this[_0x9cb9('0xf')][_0x9cb9('0x50')](_0x3b3897)[_0x9cb9('0x14')](function(_0x45406f){_0x2bf1a3(null,_['isNil'](_0x45406f)?![]:!![]);})[_0x9cb9('0x12')](function(_0x36284f){logger[_0x9cb9('0x29')](_0x36284f);_0x2bf1a3(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5a124f,_0x5c4539){var _0x2b487d={'role':'agent'};_0x2b487d[_0x5a124f]=this[_0x9cb9('0xc')][_0x9cb9('0x39')];var _0xb3f7ed=_0x5a124f!=_0x9cb9('0x51')?util[_0x9cb9('0x52')](_0x9cb9('0x53'),_0x9cb9('0x54'),this[_0x9cb9('0xc')][_0x9cb9('0x39')]):undefined;this['rpc']['agentLogin'](_0x2b487d,_0xb3f7ed)[_0x9cb9('0x14')](function(_0xab1aad){_0x5c4539(null,_['isNil'](_0xab1aad)?![]:!![]);})['catch'](function(_0x169f5d){logger[_0x9cb9('0x29')](_0x169f5d);_0x5c4539(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x4f6478,_0x4f939c){sh[_0x9cb9('0x55')](_['trim'](_0x4f6478),function(_0x276f13,_0x397ca9){var _0x56d148=_0x397ca9[_0x9cb9('0x56')](/(\r\n|\n|\r)/gm,'');_0x4f939c(null,_0x56d148);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4dc453,_0x3cf34a){scripts[_0x9cb9('0x57')](_0x4dc453[_0x9cb9('0x58')],_0x4dc453[_0x9cb9('0x59')]||'text',_0x4dc453[_0x9cb9('0x5a')],_0x4dc453[_0x9cb9('0x5b')]||'en-US',_0x4dc453[_0x9cb9('0x5c')]||_0x9cb9('0x5d'),_0x4dc453['audioEncoding']||_0x9cb9('0x5e'))[_0x9cb9('0x14')](function(_0x1f9a1e){_0x3cf34a(null,_0x1f9a1e);})[_0x9cb9('0x12')](function(_0x168d05){_0x3cf34a(_0x168d05);});};AGIVertices[_0x9cb9('0xd')]['googleTTS']=function(_0x496990,_0x37c553){scripts[_0x9cb9('0x5f')](_0x496990[_0x9cb9('0x5a')],_0x496990[_0x9cb9('0x60')]||'en',0x1)[_0x9cb9('0x14')](function(_0x41a6da){_0x37c553(null,_0x41a6da);})[_0x9cb9('0x12')](function(_0x31445b){_0x37c553(_0x31445b);});};AGIVertices[_0x9cb9('0xd')]['restAPI']=function(_0x23a727,_0x1ef68b){var _0x3ceb83={'uri':_0x23a727['url'],'method':_0x23a727[_0x9cb9('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x23a727[_0x9cb9('0x62')])===_0x9cb9('0x63')&&parseInt(_0x23a727[_0x9cb9('0x62')])>=0x1?parseInt(_0x23a727['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x9cb9('0x64')]([_0x9cb9('0x65'),_0x9cb9('0x66')],_0x3ceb83[_0x9cb9('0x61')][_0x9cb9('0x67')]())){try{_0x3ceb83[_0x9cb9('0x68')]=_0x23a727[_0x9cb9('0x8')]?JSON[_0x9cb9('0x69')](_0x23a727[_0x9cb9('0x8')]):{};}catch(_0x24c046){logger[_0x9cb9('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x24c046);}}try{_0x3ceb83['headers']=_0x23a727['rawHeaders']?JSON[_0x9cb9('0x69')](_0x23a727[_0x9cb9('0x6a')]):{};}catch(_0x534e8c){logger[_0x9cb9('0x29')](_0x9cb9('0x6b'),_0x534e8c);}if(_0x23a727['computedVariables']){try{var _0x2ae5d7=require(_0x23a727['computedVariables'])[_0x9cb9('0x6c')](this,_0x3ceb83);_0x3ceb83['uri']=Mustache[_0x9cb9('0x6d')](_0x23a727[_0x9cb9('0x6e')],_0x2ae5d7,{},['$$','$$']);if(_0x3ceb83[_0x9cb9('0x6f')]){_0x3ceb83[_0x9cb9('0x6f')]=JSON[_0x9cb9('0x69')](Mustache['render'](JSON[_0x9cb9('0x70')](_0x3ceb83[_0x9cb9('0x6f')]),_0x2ae5d7,{},['$$','$$']));}if(_0x3ceb83[_0x9cb9('0x68')]){_0x3ceb83['body']=JSON['parse'](Mustache[_0x9cb9('0x6d')](JSON[_0x9cb9('0x70')](_0x3ceb83[_0x9cb9('0x68')]),_0x2ae5d7,{},['$$','$$']));}}catch(_0x288782){logger['error'](_0x9cb9('0x71'),_0x288782);}}rp(_0x3ceb83)[_0x9cb9('0x14')](function(_0x5141d5){var _0x28c5b8={'statusCode':_0x5141d5[_0x9cb9('0x72')]||0xc8,'statusMessage':_0x5141d5[_0x9cb9('0x73')]||'OK','headers':_0x5141d5[_0x9cb9('0x6f')]||{},'body':_0x5141d5['body']||{}};_0x1ef68b(null,_0x28c5b8);})[_0x9cb9('0x12')](function(_0x376e0f){var _0x1605aa={'statusCode':_0x376e0f[_0x9cb9('0x72')]||0x1f4,'statusMessage':_0x376e0f[_0x9cb9('0x74')]||_0x9cb9('0x75'),'headers':_0x376e0f[_0x9cb9('0x76')]['headers']||{},'body':_0x376e0f[_0x9cb9('0x76')]['body']||{}};_0x1ef68b(null,_0x1605aa);});};AGIVertices['prototype']['googleDialogflow']=function(_0x5341d1,_0x32130f){scripts['googleDialogflow'](this['channel'][_0x9cb9('0x38')],_0x5341d1[_0x9cb9('0x77')],_0x5341d1[_0x9cb9('0x5a')],_0x5341d1[_0x9cb9('0x78')]||'en')[_0x9cb9('0x14')](function(_0x393087){_0x32130f(null,_0x393087);})[_0x9cb9('0x12')](function(_0x3271ed){_0x32130f(_0x3271ed);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x79')]=function(_0x5971eb,_0xe48750){scripts[_0x9cb9('0x79')](this[_0x9cb9('0xc')][_0x9cb9('0x38')],_0x5971eb[_0x9cb9('0x7a')],_0x5971eb['client_email'],_0x5971eb['private_key'],_0x5971eb[_0x9cb9('0x5a')],_0x5971eb[_0x9cb9('0x7b')]||'en')['then'](function(_0x5e2feb){_0xe48750(null,_0x5e2feb);})['catch'](function(_0x5c3c4a){_0xe48750(_0x5c3c4a);});};AGIVertices['prototype'][_0x9cb9('0x7c')]=function(_0xf15cb8,_0x3419b6){scripts['sestekNDA'](this[_0x9cb9('0xc')],_0xf15cb8)[_0x9cb9('0x14')](function(_0x3e77eb){_0x3419b6(null,_0x3e77eb);})[_0x9cb9('0x12')](function(_0xe6dee8){_0x3419b6(_0xe6dee8);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x7d')]=function(_0xe4ff96,_0x2bfbd2){scripts[_0x9cb9('0x7d')](_0xe4ff96[_0x9cb9('0x77')],_0xe4ff96[_0x9cb9('0x5a')],_0xe4ff96['ispeech_tts_language']||_0x9cb9('0x7e'),_0xe4ff96[_0x9cb9('0x7f')])[_0x9cb9('0x14')](function(_0x45bcc5){_0x2bfbd2(null,_0x45bcc5);})['catch'](function(_0x4add7e){_0x2bfbd2(_0x4add7e);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x80')]=function(_0x17211d,_0x7e8994,_0x5c7786){scripts[_0x9cb9('0x80')](_0x7e8994,_0x17211d[_0x9cb9('0x77')],_0x17211d[_0x9cb9('0x81')]||_0x9cb9('0x7e'),this[_0x9cb9('0x82')](_0x17211d[_0x9cb9('0x83')])?_0x17211d[_0x9cb9('0x83')]:undefined)[_0x9cb9('0x14')](function(_0x4c5833){_0x5c7786(null,_0x4c5833);})[_0x9cb9('0x12')](function(_0x24bf4c){_0x5c7786(_0x24bf4c);});};AGIVertices['prototype'][_0x9cb9('0x84')]=function(_0x284ebf,_0x4b1a02){scripts[_0x9cb9('0x84')](_0x284ebf[_0x9cb9('0x85')],_0x284ebf['aws_secret_access_key'],_0x284ebf[_0x9cb9('0x86')],_0x284ebf[_0x9cb9('0x87')]||'Amy',_0x284ebf[_0x9cb9('0x5a')],_0x284ebf[_0x9cb9('0x88')]||_0x9cb9('0x5a'))[_0x9cb9('0x14')](function(_0x535cc7){_0x4b1a02(null,_0x535cc7);})['catch'](function(_0x59b2f0){_0x4b1a02(_0x59b2f0);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x89')]=function(_0x248766,_0x25cb1e){scripts[_0x9cb9('0x89')](this[_0x9cb9('0xc')][_0x9cb9('0x38')],_0x248766[_0x9cb9('0x85')],_0x248766[_0x9cb9('0x8a')],_0x248766[_0x9cb9('0x8b')],_0x248766[_0x9cb9('0x5a')],_0x248766[_0x9cb9('0x8c')])[_0x9cb9('0x14')](function(_0x516ff7){_0x25cb1e(null,_0x516ff7);})['catch'](function(_0x5b227f){_0x25cb1e(_0x5b227f);});};AGIVertices[_0x9cb9('0xd')]['googleASR']=function(_0x1b645e,_0x5b90c9,_0x3dc704){scripts[_0x9cb9('0x8d')](_0x5b90c9,_0x1b645e[_0x9cb9('0x77')],_0x1b645e[_0x9cb9('0x8e')]||_0x9cb9('0x7e'))['then'](function(_0x213566){_0x3dc704(null,_0x213566);})[_0x9cb9('0x12')](function(_0x151846){_0x3dc704(_0x151846);});};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x8f')]=function(_0x58c614,_0x54186b,_0x3d9888){scripts['tildeASR'](_0x54186b,_0x58c614[_0x9cb9('0x90')],_0x58c614[_0x9cb9('0x91')],_0x58c614[_0x9cb9('0x92')])['then'](function(_0x40c268){_0x3d9888(null,_0x40c268);})['catch'](function(_0x1fb563){_0x3d9888(_0x1fb563);});};AGIVertices[_0x9cb9('0xd')]['clear']=function(_0x13b2e9){var _0x30b6b1=_[_0x9cb9('0x64')](verticesWithRetry,_0x13b2e9[_0x9cb9('0x35')])?_0x13b2e9:_[_0x9cb9('0x93')](_0x13b2e9);for(var _0x19fa87 in _0x30b6b1){if(_0x30b6b1['hasOwnProperty'](_0x19fa87)){if(_0x30b6b1[_0x19fa87]&&_[_0x9cb9('0x94')](_0x30b6b1[_0x19fa87])){if(_['includes'](recursiveMapAttributes,_0x19fa87)){_0x30b6b1[_0x19fa87]=this[_0x9cb9('0x95')](_0x30b6b1[_0x19fa87]);}else{_0x30b6b1[_0x19fa87]=this[_0x9cb9('0x96')](_0x30b6b1[_0x19fa87]);}}}}return _0x30b6b1;};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x97')]=function(_0x4e836f){for(var _0xf025e1 in _0x4e836f){if(_0x4e836f[_0x9cb9('0x98')](_0xf025e1)){if(_['isPlainObject'](_0x4e836f[_0xf025e1])){this[_0x9cb9('0x97')](_0x4e836f[_0xf025e1]);}else if(_[_0x9cb9('0x99')](_0x4e836f[_0xf025e1])){for(var _0x17d3c3=0x0;_0x17d3c3<_0x4e836f[_0xf025e1][_0x9cb9('0x9a')];_0x17d3c3++){this['recursiveNodeIndex'](_0x4e836f[_0xf025e1][_0x17d3c3]);}}else if(_['isString'](_0x4e836f[_0xf025e1])){_0x4e836f[_0xf025e1]=this[_0x9cb9('0x96')](_0x4e836f[_0xf025e1]);}}}};AGIVertices[_0x9cb9('0xd')]['saveRestApiResult']=function(_0x3c12c2,_0x5ce461){for(var _0x1fd5f5 in _0x3c12c2){if(_0x3c12c2[_0x9cb9('0x98')](_0x1fd5f5)){if(_[_0x9cb9('0x9b')](_0x3c12c2[_0x1fd5f5])){if(!_['isEmpty'](_0x3c12c2[_0x1fd5f5])){this[_0x9cb9('0x9c')](_0x3c12c2[_0x1fd5f5],util[_0x9cb9('0x52')](_0x9cb9('0x9d'),_0x5ce461,_0x1fd5f5));}}else if(_[_0x9cb9('0x99')](_0x3c12c2[_0x1fd5f5])){for(var _0x49bb2e=0x0;_0x49bb2e<_0x3c12c2[_0x1fd5f5][_0x9cb9('0x9a')];_0x49bb2e++){this[_0x9cb9('0x9c')](_0x3c12c2[_0x1fd5f5][_0x49bb2e],util[_0x9cb9('0x52')](_0x9cb9('0x9d'),_0x5ce461,_0x1fd5f5+'['+_0x49bb2e+']'));}}else{if(!_['isNil'](_0x3c12c2[_0x1fd5f5])){this['channel'][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x9d'),_0x5ce461,_0x1fd5f5),_0x3c12c2[_0x1fd5f5]);}}}}};AGIVertices['prototype'][_0x9cb9('0x95')]=function(_0x21f896){try{var _0x228176=JSON[_0x9cb9('0x69')](_0x21f896);this['recursiveNodeIndex'](_0x228176);return JSON[_0x9cb9('0x70')](_0x228176);}catch(_0x4ff442){return this[_0x9cb9('0x96')](_0x21f896);}};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x96')]=function(_0x256035){var _0x5028cb=_0x256035[_0x9cb9('0x9f')]('{');for(var _0x26cc0e=0x1;_0x26cc0e<_0x5028cb['length'];_0x26cc0e+=0x1){var _0x11b177=_0x5028cb[_0x26cc0e][_0x9cb9('0x9f')]('}');if(_0x11b177[_0x9cb9('0x9a')]>0x1){_0x256035=_0x256035[_0x9cb9('0xa0')]('{'+_0x11b177[0x0]+'}',this[_0x9cb9('0xc')][_0x9cb9('0xe')](_0x11b177[0x0])['extra']||_0x11b177[0x0]);}}if(_0x5028cb['length']===0x1){return _0x256035['toString']();}return this[_0x9cb9('0x96')](_0x256035);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xa1')]=function(_0x268025,_0x1e6e23){var _0x4369df=this[_0x9cb9('0xc')][_0x9cb9('0xe')](_0x268025);if(_0x4369df[_0x9cb9('0xa2')]===-0x1){return _0x4369df;}logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1e6e23,_0x4369df[_0x9cb9('0xa3')]));return this[_0x9cb9('0xc')][_0x9cb9('0x9e')](_0x1e6e23,_0x4369df['extra']);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x82')]=function(_0x407873){return _0x407873&&_0x407873!=='0'&&_0x407873!=='-1'&&_0x407873!=='';};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xa4')]=function(_0x7b5eb7){this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x7b5eb7,'-');_0x7b5eb7[_0x9cb9('0xa5')]=_0x7b5eb7[_0x9cb9('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xa6')]=function(_0x2f01e2){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2f01e2[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x2f01e2[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')]['noop']('no\x20text\x20configured');}var _0x18f2d5='\x22'+_0x2f01e2['text']+'\x22';if(this[_0x9cb9('0x82')](_0x2f01e2[_0x9cb9('0x76')])){_0x18f2d5+=','+_0x2f01e2[_0x9cb9('0x76')];}var _0x6b56b6=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xa7'),_0x18f2d5);if(_0x6b56b6['result']===-0x1){return _0x6b56b6;}return this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xa9'),_0x18f2d5));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xaa')]=function(_0x2c4639){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xab'),_0x2c4639[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x2c4639[_0x9cb9('0xac')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xad'));}var _0xaedb83=_0x2c4639[_0x9cb9('0xac')];if(this[_0x9cb9('0x82')](_0x2c4639['options'])){_0xaedb83+=','+_0x2c4639['options'];}var _0x3d16ad=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xae'),_0xaedb83);if(_0x3d16ad[_0x9cb9('0xa2')]===-0x1){return _0x3d16ad;}var _0x2c123f=this[_0x9cb9('0xa1')](_0x9cb9('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x2c123f[_0x9cb9('0xa2')]===-0x1){return _0x2c123f;}var _0x55bdad=this[_0x9cb9('0xa1')](_0x9cb9('0xb0'),_0x9cb9('0xb1'));if(_0x55bdad['result']===-0x1){return _0x55bdad;}var _0x5a28a7=this[_0x9cb9('0xa1')](_0x9cb9('0xb2'),_0x9cb9('0xb3'));if(_0x5a28a7[_0x9cb9('0xa2')]===-0x1){return _0x5a28a7;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xb4'),_0xaedb83));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x5')]=function(_0x11f35b){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x11f35b[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')][_0x9cb9('0x5')]([_0x11f35b['command'],_0x11f35b[_0x9cb9('0xb5')]]);};AGIVertices['prototype'][_0x9cb9('0xb6')]=function(_0x362cf4){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xb7'),_0x362cf4[_0x9cb9('0x34')]));if(this[_0x9cb9('0x82')](_0x362cf4[_0x9cb9('0x62')])){logger[_0x9cb9('0x2b')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x362cf4['timeout']));var _0x20700c=this[_0x9cb9('0xc')][_0x9cb9('0xb8')](_0x362cf4['timeout']);if(_0x20700c[_0x9cb9('0xa2')]===-0x1){return _0x20700c;}}return this[_0x9cb9('0xc')][_0x9cb9('0xb6')]();};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x49')]=function(_0x15291a){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xb9'),_0x15291a[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x15291a[_0x9cb9('0xba')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x15291a,'no\x20list\x20selected');}_0x15291a['scheduledAt']=moment();if(this[_0x9cb9('0x82')](_0x15291a[_0x9cb9('0xbb')])){_0x15291a[_0x9cb9('0x48')]=moment()[_0x9cb9('0xbc')](_0x15291a['delay'],_0x9cb9('0xbd'));}if(!this[_0x9cb9('0x82')](_0x15291a[_0x9cb9('0x4b')])){_0x15291a[_0x9cb9('0x4b')]=0x2;}this[_0x9cb9('0x41')][_0x9cb9('0x6c')](this,_0x15291a);return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xbe'),_0x15291a[_0x9cb9('0x47')],_0x15291a[_0x9cb9('0xba')],_0x15291a['scheduledAt']));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xbf')]=function(_0x5646b7){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xc0'),_0x5646b7[_0x9cb9('0x34')]));var _0xcccf7e=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x5646b7[_0x9cb9('0xc1')],_0x5646b7[_0x9cb9('0x76')]);if(_0xcccf7e[_0x9cb9('0xa2')]===-0x1){return _0xcccf7e;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Executed\x20command\x20%s\x20%s',_0x5646b7[_0x9cb9('0xc1')],_0x5646b7[_0x9cb9('0x76')]));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xc2')]=function(_0x499778){logger['info'](util['format'](_0x9cb9('0xc3'),_0x499778[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x499778[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}var _0x169b51='\x22'+_0x499778[_0x9cb9('0x5a')]+'\x22';if(this[_0x9cb9('0x82')](_0x499778[_0x9cb9('0x76')])){_0x169b51+=','+_0x499778[_0x9cb9('0x76')];}var _0x1200c3=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xa7'),_0x169b51);if(_0x1200c3[_0x9cb9('0xa2')]===-0x1){return _0x1200c3;}return this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xa9'),_0x169b51));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xc5')]=function(_0x1ad3b1){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xc6'),_0x1ad3b1[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x1ad3b1[_0x9cb9('0x5a')])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}var _0x3954cb='\x22'+_0x1ad3b1[_0x9cb9('0x5a')]+'\x22';if(this[_0x9cb9('0x82')](_0x1ad3b1['options'])){_0x3954cb+=','+_0x1ad3b1[_0x9cb9('0x76')];}var _0x4bc7ad=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xa7'),_0x3954cb);if(_0x4bc7ad[_0x9cb9('0xa2')]===-0x1){return _0x4bc7ad;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3954cb));};AGIVertices[_0x9cb9('0xd')]['lumenvoxasr']=function(_0x4d1ec1){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0xc7'),_0x4d1ec1[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x4d1ec1[_0x9cb9('0xac')])){return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0xad'));}var _0x4d1c8d=_0x4d1ec1[_0x9cb9('0xac')];if(this[_0x9cb9('0x82')](_0x4d1ec1[_0x9cb9('0x76')])){_0x4d1c8d+=','+_0x4d1ec1[_0x9cb9('0x76')];}var _0x1d1c63=this[_0x9cb9('0xc')]['exec'](_0x9cb9('0xae'),_0x4d1c8d);if(_0x1d1c63[_0x9cb9('0xa2')]===-0x1){return _0x1d1c63;}var _0x342288=this[_0x9cb9('0xa1')](_0x9cb9('0xaf'),_0x9cb9('0xc8'));if(_0x342288[_0x9cb9('0xa2')]===-0x1){return _0x342288;}var _0x16fbe2=this['getAndSetVariable'](_0x9cb9('0xb0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x16fbe2[_0x9cb9('0xa2')]===-0x1){return _0x16fbe2;}var _0x181636=this['getAndSetVariable'](_0x9cb9('0xb2'),_0x9cb9('0xc9'));if(_0x181636[_0x9cb9('0xa2')]===-0x1){return _0x181636;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xb4'),_0x4d1c8d));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xca')]=function(_0x18c62c){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x18c62c[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x18c62c[_0x9cb9('0xac')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xad'));}var _0x567e2a=_0x18c62c['grammar'];if(this['isConfigured'](_0x18c62c[_0x9cb9('0x76')])){_0x567e2a+=','+_0x18c62c[_0x9cb9('0x76')];}var _0xa0ec41=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xae'),_0x567e2a);if(_0xa0ec41[_0x9cb9('0xa2')]===-0x1){return _0xa0ec41;}var _0x44fcce=this[_0x9cb9('0xa1')](_0x9cb9('0xaf'),_0x9cb9('0xcb'));if(_0x44fcce[_0x9cb9('0xa2')]===-0x1){return _0x44fcce;}var _0x3c1a63=this[_0x9cb9('0xa1')](_0x9cb9('0xb0'),_0x9cb9('0xcc'));if(_0x3c1a63[_0x9cb9('0xa2')]===-0x1){return _0x3c1a63;}var _0x3dec36=this[_0x9cb9('0xa1')](_0x9cb9('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x3dec36['result']===-0x1){return _0x3dec36;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xb4'),_0x567e2a));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xcd')]=function(_0xbff189){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xce'),_0xbff189[_0x9cb9('0x34')]));if(!this['isConfigured'](_0xbff189[_0x9cb9('0xcf')])){return this['channel'][_0x9cb9('0x29')](_0xbff189,_0x9cb9('0xd0'));}var _0x24dae4=this[_0x9cb9('0xd1')]['sync'](this,_0xbff189[_0x9cb9('0xcf')]);if(!_0x24dae4){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0xbff189,_0x9cb9('0xd2'));}if(!this[_0x9cb9('0x82')](_0xbff189[_0x9cb9('0x2d')])){return this[_0x9cb9('0xc')]['error'](_0xbff189,'no\x20query\x20configured');}var _0x3fe35f=_0xbff189[_0x9cb9('0x2d')][_0x9cb9('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xd3'),_0x3fe35f));var _0x4d0b91=this[_0x9cb9('0x27')][_0x9cb9('0x6c')](this,_0x24dae4,_0x3fe35f);this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0xbff189,_0x3fe35f);if(!this['isConfigured'](_0xbff189[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0xd5'));}var _0x49ae6f=this[_0x9cb9('0xe')]['sync'](this,_0xbff189[_0x9cb9('0xd4')]);if(!_0x49ae6f){return this[_0x9cb9('0xc')]['error'](_0xbff189,_0x9cb9('0xd6'));}var _0xf3dc1d=this;_0x4d0b91[_0x9cb9('0xd7')](function(_0x3f2c73,_0x89a724){Object[_0x9cb9('0xd8')](_0x3f2c73)['forEach'](function(_0x1b32a5){_0xf3dc1d[_0x9cb9('0xc')][_0x9cb9('0x9e')](util['format'](_0x9cb9('0xd9'),_0x49ae6f,_0x89a724,_0x1b32a5),_0x3f2c73[_0x1b32a5]);});});this[_0x9cb9('0xc')]['setVariable'](util[_0x9cb9('0x52')](_0x9cb9('0xda'),_0x49ae6f),_0x4d0b91['length']);return this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xdb'),_0x49ae6f));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xdc')]=function(_0x3817b0){logger[_0x9cb9('0xdd')](util[_0x9cb9('0x52')](_0x9cb9('0xde'),_0x3817b0['label']));if(!this['isConfigured'](_0x3817b0[_0x9cb9('0xdf')])){return this[_0x9cb9('0xc')]['error'](_0x3817b0,'no\x20user\x20selected');}var _0x29bbe0=this[_0x9cb9('0x18')][_0x9cb9('0x6c')](this,_0x3817b0['sip_id']);if(!_0x29bbe0){return this['channel'][_0x9cb9('0x29')](_0x3817b0,'no\x20user\x20found');}var _0x4ab451=this['channel'][_0x9cb9('0x55')](_0x9cb9('0xe0'),[util[_0x9cb9('0x52')]('SIP/%s',_0x29bbe0),_0x3817b0[_0x9cb9('0x62')],_0x3817b0[_0x9cb9('0xe1')],_0x3817b0[_0x9cb9('0x6e')]]);if(_0x4ab451[_0x9cb9('0xa2')]===-0x1){return _0x4ab451;}return this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xe2'),_0x9cb9('0xe0')));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0xe3')]=function(_0x593f2a){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xe4'),_0x593f2a[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x593f2a['key'])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0xe5'));}if(!this[_0x9cb9('0x82')](_0x593f2a[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this[_0x9cb9('0xc')][_0x9cb9('0xe6')]=!![];this[_0x9cb9('0x33')](_0x593f2a);this[_0x9cb9('0x40')](_0x593f2a[_0x9cb9('0x5a')],'in','','');this[_0x9cb9('0xc')]['noop'](util[_0x9cb9('0x52')](_0x9cb9('0xe7'),_0x593f2a[_0x9cb9('0x5a')]));var _0x2e33e3=this['googleDialogflow'][_0x9cb9('0x6c')](this,_0x593f2a);if(_0x2e33e3){for(var _0x12b08a in _0x2e33e3){if(_0x2e33e3[_0x9cb9('0x98')](_0x12b08a)){this[_0x9cb9('0xc')][_0x9cb9('0x9e')](util['format'](_0x9cb9('0xe8'),_0x12b08a[_0x9cb9('0x67')]()),_0x2e33e3[_0x12b08a]);}}this[_0x9cb9('0x40')](_0x2e33e3[_0x9cb9('0xe9')],_0x9cb9('0xea'),_0x9cb9('0xe3'),'');return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Dialogflow\x20Result\x20%s',_0x2e33e3['speech']));}return this['channel'][_0x9cb9('0x29')](_0x593f2a,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x9cb9('0xd')]['dialogflowV2']=function(_0x382b75){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x382b75['label']));if(!this['isConfigured'](_0x382b75[_0x9cb9('0x7a')])){return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0xeb'));}if(!this['isConfigured'](_0x382b75[_0x9cb9('0xec')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xed'));}if(!this['isConfigured'](_0x382b75['private_key'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xee'));}if(!this[_0x9cb9('0x82')](_0x382b75[_0x9cb9('0x7b')])){return this['channel']['noop'](_0x9cb9('0xef'));}if(!this[_0x9cb9('0x82')](_0x382b75[_0x9cb9('0x5a')])){return this['channel']['noop'](_0x9cb9('0xc4'));}this[_0x9cb9('0xc')][_0x9cb9('0xe6')]=!![];this[_0x9cb9('0x33')](_0x382b75);this[_0x9cb9('0x40')](_0x382b75[_0x9cb9('0x5a')],'in','','');this[_0x9cb9('0xc')]['noop'](util['format'](_0x9cb9('0xf0'),_0x382b75[_0x9cb9('0x5a')]));var _0x26ed86=this[_0x9cb9('0x79')]['sync'](this,_0x382b75);if(_0x26ed86){for(var _0x48149e in _0x26ed86){if(_0x26ed86[_0x9cb9('0x98')](_0x48149e)){if(_0x48149e!==_0x9cb9('0xf1')){this[_0x9cb9('0xc')][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0xe8'),_0x48149e['toUpperCase']()),_0x26ed86[_0x48149e]);}}}this[_0x9cb9('0x40')](_0x26ed86[_0x9cb9('0xe9')],'out',_0x9cb9('0xf2'),_0x26ed86[_0x9cb9('0xf1')]);return this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xf3'),_0x26ed86[_0x9cb9('0xe9')]));}return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x382b75,_0x9cb9('0xf4'));};AGIVertices[_0x9cb9('0xd')]['sesteknda']=function(_0x4480eb){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0xf5'),_0x4480eb[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x4480eb['ndauth_url'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xf6'));}if(!this[_0x9cb9('0x82')](_0x4480eb[_0x9cb9('0xf7')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xf8'));}if(!this['isConfigured'](_0x4480eb['password'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xf9'));}if(!this[_0x9cb9('0x82')](_0x4480eb[_0x9cb9('0xfa')])){return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0xc4'));}this[_0x9cb9('0xc')][_0x9cb9('0xe6')]=!![];this[_0x9cb9('0x33')](_0x4480eb);this[_0x9cb9('0x40')](_0x4480eb[_0x9cb9('0x5a')],'in','','');this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0xfb'),_0x4480eb['text']));var _0x52cd7f=this[_0x9cb9('0x7c')][_0x9cb9('0x6c')](this,_0x4480eb);if(_0x52cd7f){for(var _0x1deda3 in _0x52cd7f){if(_0x52cd7f['hasOwnProperty'](_0x1deda3)){this[_0x9cb9('0xc')]['setVariable'](util[_0x9cb9('0x52')]('SESTEK_NDA_%s',_0x1deda3[_0x9cb9('0x67')]()),_0x52cd7f[_0x1deda3]);}}this[_0x9cb9('0x40')](_0x52cd7f[_0x9cb9('0xe9')],_0x9cb9('0xea'),_0x9cb9('0xfc'),'');if(_0x52cd7f[_0x9cb9('0xfd')]){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x52cd7f[_0x9cb9('0xfd')]));var _0x4f3880=this[_0x9cb9('0xc')][_0x9cb9('0xfe')](_0x52cd7f[_0x9cb9('0xfd')]);try{fs[_0x9cb9('0xff')](_0x52cd7f[_0x9cb9('0xfd')]+_0x9cb9('0x100'));}catch(_0x17079f){logger[_0x9cb9('0x29')](_0x17079f);}return _0x4f3880;}else{return this['channel'][_0x9cb9('0xa8')](util['format']('SestekNDA\x20Result\x20%s',_0x52cd7f['speech']));}}return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x4480eb,_0x9cb9('0x101'));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x102')]=function(_0x638f65){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20END\x20(%s)\x20block',_0x638f65['label']));return this['channel'][_0x9cb9('0xa8')]('end');};AGIVertices[_0x9cb9('0xd')]['ext_dial']=function(_0x3d377e){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x103'),_0x3d377e[_0x9cb9('0x34')]));var _0x2338f6='';if(_0x3d377e[_0x9cb9('0x104')]){if(!this[_0x9cb9('0x82')](_0x3d377e['trunk_id'])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x3d377e,_0x9cb9('0x105'));}else{var _0x1b036b=parseInt(_0x3d377e[_0x9cb9('0x104')],0xa);if(isNaN(_0x1b036b)){_0x2338f6=_0x3d377e[_0x9cb9('0x104')];}else{_0x2338f6=this[_0x9cb9('0x1a')][_0x9cb9('0x6c')](this,_0x3d377e[_0x9cb9('0x104')]);if(!_0x2338f6){return this['channel'][_0x9cb9('0x29')](_0x3d377e,_0x9cb9('0x106'));}}}}else if(_0x3d377e[_0x9cb9('0x107')]){_0x2338f6=_0x3d377e[_0x9cb9('0x107')];}else{return this['channel'][_0x9cb9('0x29')](_0x3d377e,_0x9cb9('0x105'));}var _0x5a7616=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0xe0'),[util[_0x9cb9('0x52')](_0x9cb9('0x108'),_0x2338f6,_0x3d377e[_0x9cb9('0x47')]),_0x3d377e['timeout'],_0x3d377e[_0x9cb9('0xe1')],_0x3d377e[_0x9cb9('0x6e')]]);if(_0x5a7616[_0x9cb9('0xa2')]===-0x1){return _0x5a7616;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Executed\x20command\x20%s',_0x9cb9('0xe0')));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x109')]=function(_0x2a7657){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x10a'),_0x2a7657[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')][_0x9cb9('0xa8')]('finally');};AGIVertices['prototype'][_0x9cb9('0xa')]=function(_0x1b1ab7){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x10b'),_0x1b1ab7[_0x9cb9('0x34')]));if(_0x1b1ab7['retry']===0x0){return this[_0x9cb9('0xa4')](_0x1b1ab7);}_0x1b1ab7['retry']-=0x1;if(!this[_0x9cb9('0x82')](_0x1b1ab7[_0x9cb9('0x10c')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x1b1ab7,_0x9cb9('0x10d'));}var _0x1a4ee9=this[_0x9cb9('0x1c')]['sync'](this,_0x1b1ab7[_0x9cb9('0x10c')]);if(!_0x1a4ee9){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x1b1ab7,_0x9cb9('0x10e'));}if(!this['isConfigured'](_0x1b1ab7[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x9cb9('0xd5'));}var _0x45d62d=this[_0x9cb9('0xc')]['getData'](_0x1a4ee9,_0x1b1ab7[_0x9cb9('0x10f')],_0x1b1ab7[_0x9cb9('0x110')]);var _0x2daa2c=_0x45d62d[_0x9cb9('0xa2')]?_0x45d62d[_0x9cb9('0xa2')][_0x9cb9('0x111')]():'';logger[_0x9cb9('0x2b')](_0x9cb9('0x112'),JSON['stringify'](_0x45d62d));if(_0x45d62d['result']===-0x1){this['createSquareDetailsReport'][_0x9cb9('0x6c')](this,_0x1b1ab7,_0x2daa2c);return _0x45d62d;}else if(_0x45d62d[_0x9cb9('0xa3')]===_0x9cb9('0x62')){_0x45d62d[_0x9cb9('0xa2')]=_0x2daa2c[_0x9cb9('0x9a')]>=parseInt(_0x1b1ab7[_0x9cb9('0x113')])?'x':'i';}else{_0x45d62d[_0x9cb9('0xa2')]=_0x2daa2c[_0x9cb9('0x9a')]>=parseInt(_0x1b1ab7['mindigit'])&&_0x2daa2c[_0x9cb9('0x9a')]<=parseInt(_0x1b1ab7[_0x9cb9('0x110')])?'x':'i';}var _0x533438=this['getVariable'][_0x9cb9('0x6c')](this,_0x1b1ab7['variable_id']);if(!_0x533438){return this['channel']['error'](_0x1b1ab7,'no\x20variable\x20found');}this[_0x9cb9('0xc')][_0x9cb9('0x9e')](_0x533438,_0x2daa2c);if(this[_0x9cb9('0x82')](_0x1b1ab7[_0x9cb9('0x114')])){var _0x3e4fdb=parseInt(_0x1b1ab7[_0x9cb9('0x114')],0xa);var _0xb18782=rs[_0x9cb9('0x115')]({'charset':'*','length':_0x3e4fdb});var _0x2ba0d3=_0x2daa2c[_0x9cb9('0x9a')];if(_0x2ba0d3>0x0){if(_0x2ba0d3>_0x3e4fdb){this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x1b1ab7,_0x1b1ab7[_0x9cb9('0x116')]===_0x9cb9('0x117')?_0xb18782+_0x2daa2c[_0x9cb9('0x118')](_0x3e4fdb):_0x2daa2c['substr'](0x0,_0x2ba0d3-_0x3e4fdb)+_0xb18782);}else{this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x1b1ab7,rs[_0x9cb9('0x115')]({'charset':'*','length':_0x2ba0d3}));}}else{this[_0x9cb9('0x33')]['sync'](this,_0x1b1ab7,'');}}else{this[_0x9cb9('0x33')]['sync'](this,_0x1b1ab7,_0x2daa2c);}return _0x45d62d;};AGIVertices['prototype']['getsecretdigits']=function(_0x3be036){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x119'),_0x3be036['label']));return this['getdigits'](_0x3be036);};AGIVertices['prototype']['goal']=function(_0x5a7393){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x11a'),_0x5a7393[_0x9cb9('0x34')]));this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x5a7393,_0x5a7393[_0x9cb9('0x11b')]);return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x11c'),_0x5a7393[_0x9cb9('0x11b')]));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x11d')]=function(_0x1551af){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x11e'),_0x1551af[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x1551af[_0x9cb9('0x85')])||!this[_0x9cb9('0x82')](_0x1551af['aws_secret_access_key'])){return this[_0x9cb9('0xc')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x1551af[_0x9cb9('0x5a')])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x11f'),_0x1551af[_0x9cb9('0x5a')]));var _0x1bad53=this[_0x9cb9('0x84')][_0x9cb9('0x6c')](this,_0x1551af);if(_0x1bad53){this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x120'),_0x1bad53));var _0x126e76=this[_0x9cb9('0xc')][_0x9cb9('0xfe')](_0x1bad53);try{fs[_0x9cb9('0xff')](_0x1bad53+_0x9cb9('0x100'));}catch(_0x201768){logger[_0x9cb9('0x29')](_0x201768);}return _0x126e76;}return this['channel'][_0x9cb9('0x29')](_0x1551af,_0x9cb9('0x121'));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x122')]=function(_0x8e6b4c){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x123'),_0x8e6b4c[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x8e6b4c[_0x9cb9('0x85')])||!this[_0x9cb9('0x82')](_0x8e6b4c[_0x9cb9('0x8a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0x124'));}if(!this[_0x9cb9('0x82')](_0x8e6b4c[_0x9cb9('0x8c')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')]('no\x20bot\x20name\x20configured');}if(!this[_0x9cb9('0x82')](_0x8e6b4c[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this['channel'][_0x9cb9('0xe6')]=!![];this['createSquareDetailsReport'](_0x8e6b4c);this['createSquareMessage'](_0x8e6b4c['text'],'in','','');this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Trying\x20Amazon\x20Lex:\x20%s',_0x8e6b4c[_0x9cb9('0x5a')]));var _0x2ec631=this['awsLex'][_0x9cb9('0x6c')](this,_0x8e6b4c);if(_0x2ec631){for(var _0x25f2c9 in _0x2ec631){if(_0x2ec631[_0x9cb9('0x98')](_0x25f2c9)&&_[_0x9cb9('0x94')](_0x2ec631[_0x25f2c9])){this[_0x9cb9('0xc')][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x125'),_0x25f2c9[_0x9cb9('0x67')]()),_0x2ec631[_0x25f2c9]);}}if(_[_0x9cb9('0x43')](_0x2ec631[_0x9cb9('0x74')])){return this['channel'][_0x9cb9('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x2ec631['message'],_0x9cb9('0xea'),_0x9cb9('0x126'),'');return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x127'),_0x2ec631['message']));}}return this['channel'][_0x9cb9('0x29')](_0x8e6b4c,_0x9cb9('0x128'));};AGIVertices['prototype'][_0x9cb9('0x129')]=function(_0x3fed1c){logger['info'](util[_0x9cb9('0x52')](_0x9cb9('0x12a'),_0x3fed1c['label'],_0x3fed1c[_0x9cb9('0x62')]));if(!this[_0x9cb9('0x82')](_0x3fed1c[_0x9cb9('0x77')])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0xe5'));}var _0x431797=_0x9cb9('0x12b');var _0x557d29=util[_0x9cb9('0x52')](_0x9cb9('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x31f570=util['format'](_0x9cb9('0x9d'),_0x557d29,_0x431797);var _0x28e268=!![];if(_0x3fed1c[_0x9cb9('0x12d')]==='NOBEEP'){_0x28e268=![];}var _0x282393=this[_0x9cb9('0xc')][_0x9cb9('0x12e')](_0x557d29,_0x431797,_0x3fed1c[_0x9cb9('0x12f')],_0x3fed1c['timeout'],undefined,_0x28e268);if(_0x282393[_0x9cb9('0xa2')]!==-0x1){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x130'),_0x31f570));var _0x19c712=this[_0x9cb9('0x8d')]['sync'](this,_0x3fed1c,_0x31f570);if(_0x19c712){for(var _0x2c55a5 in _0x19c712){if(_0x19c712[_0x9cb9('0x98')](_0x2c55a5)){this['channel'][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x131'),_0x2c55a5['toUpperCase']()),_0x19c712[_0x2c55a5]);}}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x132'),JSON[_0x9cb9('0x70')](_0x19c712)));}}return _0x282393;};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x133')]=function(_0x525e93){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x134'),_0x525e93[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x525e93['appid'])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0x135'));}if(!this[_0x9cb9('0x82')](_0x525e93[_0x9cb9('0x91')])){return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0x136'));}var _0x3b05e='wav';var _0x3e047a=util[_0x9cb9('0x52')](_0x9cb9('0x12c'),FILES_PATH,rs[_0x9cb9('0x115')](0x4));var _0x1276fd=util[_0x9cb9('0x52')](_0x9cb9('0x9d'),_0x3e047a,_0x3b05e);var _0x34ff79=!![];if(_0x525e93['beep']==='NOBEEP'){_0x34ff79=![];}var _0x64db3a=this[_0x9cb9('0xc')][_0x9cb9('0x12e')](_0x3e047a,_0x3b05e,_0x525e93[_0x9cb9('0x12f')],_0x525e93['timeout'],undefined,_0x34ff79);if(_0x64db3a[_0x9cb9('0xa2')]!==-0x1){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x137'),_0x1276fd));var _0x1b7794=this['tildeASR'][_0x9cb9('0x6c')](this,_0x525e93,_0x1276fd);if(_0x1b7794){for(var _0x8e6c4a in _0x1b7794){if(_0x1b7794[_0x9cb9('0x98')](_0x8e6c4a)){this['channel'][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x138'),_0x8e6c4a[_0x9cb9('0x67')]()),_0x1b7794[_0x8e6c4a]);}}return this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x139'),JSON[_0x9cb9('0x70')](_0x1b7794)));}}return _0x64db3a;};AGIVertices['prototype'][_0x9cb9('0x13a')]=function(_0x32b8cb){logger['info'](util['format'](_0x9cb9('0x13b'),_0x32b8cb['label']));return this['channel'][_0x9cb9('0x13c')](_0x32b8cb['context'],_0x32b8cb[_0x9cb9('0x3c')],_0x32b8cb[_0x9cb9('0x3d')]);};AGIVertices['prototype'][_0x9cb9('0x13d')]=function(_0x5bd962){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5bd962['label']));if(!this[_0x9cb9('0x82')](_0x5bd962[_0x9cb9('0x13e')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x5bd962,_0x9cb9('0x13f'));}try{var _0x365336=eval(_0x5bd962[_0x9cb9('0x13e')])?_0x9cb9('0x140'):_0x9cb9('0x141');this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x142'),_0x5bd962['condition'],_0x365336));return{'code':0xc8,'result':_0x365336};}catch(_0x355493){return{'code':0xc8,'result':_0x9cb9('0x141')};}};AGIVertices[_0x9cb9('0xd')]['gotoiftime']=function(_0x468c8f){logger['info'](util[_0x9cb9('0x52')](_0x9cb9('0x143'),_0x468c8f['label']));if(!this['isConfigured'](_0x468c8f['interval_id'])){return this['channel'][_0x9cb9('0x29')](_0x468c8f,_0x9cb9('0x144'));}var _0x44397a=this[_0x9cb9('0x21')]['sync'](this,_0x468c8f[_0x9cb9('0x145')]);if(!_0x44397a){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x468c8f,_0x9cb9('0x146'));}for(var _0x2b8e0f=0x0;_0x2b8e0f<_0x44397a[_0x9cb9('0x9a')];_0x2b8e0f+=0x1){var _0x683977=this[_0x9cb9('0xc')]['getVariable'](util[_0x9cb9('0x52')](_0x9cb9('0x147'),_0x44397a[_0x2b8e0f]));if(_0x683977[_0x9cb9('0xa2')]===-0x1){return _0x683977;}logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x148'),_0x44397a[_0x2b8e0f],_0x683977[_0x9cb9('0xa3')]));if(_0x683977[_0x9cb9('0xa3')]===_0x9cb9('0x140')){logger['info'](util['format'](_0x9cb9('0x148'),_0x44397a[_0x2b8e0f],'true'));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x148'),_0x44397a[_0x2b8e0f],_0x9cb9('0x140')));return{'code':0xc8,'result':_0x9cb9('0x140')};}else{logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x148'),_0x44397a[_0x2b8e0f],'false'));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x148'),_0x44397a[_0x2b8e0f],_0x9cb9('0x141')));}}return{'code':0xc8,'result':_0x9cb9('0x141')};};AGIVertices[_0x9cb9('0xd')]['hangup']=function(_0x24a30b){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x149'),_0x24a30b[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')][_0x9cb9('0x14a')]();};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x14b')]=function(_0x52fb2a){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x14c'),_0x52fb2a[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x52fb2a['key'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xe5'));}var _0x40ec6f=_0x9cb9('0x12b');var _0x322c81=util[_0x9cb9('0x52')](_0x9cb9('0x12c'),FILES_PATH,rs[_0x9cb9('0x115')](0x4));var _0x59da33=util[_0x9cb9('0x52')](_0x9cb9('0x9d'),_0x322c81,_0x40ec6f);var _0x33d5d2=!![];if(_0x52fb2a['beep']===_0x9cb9('0x14d')){_0x33d5d2=![];}var _0x2f90ff=this[_0x9cb9('0xc')][_0x9cb9('0x12e')](_0x322c81,_0x40ec6f,_0x52fb2a[_0x9cb9('0x12f')],_0x52fb2a[_0x9cb9('0x62')],undefined,_0x33d5d2);if(_0x2f90ff[_0x9cb9('0xa2')]!==-0x1){this['channel']['noop'](util[_0x9cb9('0x52')]('ispeech\x20%s\x20file\x20created',_0x59da33));var _0x4e557d=this[_0x9cb9('0x80')][_0x9cb9('0x6c')](this,_0x52fb2a,_0x59da33);if(_0x4e557d){for(var _0x22380b in _0x4e557d){if(_0x4e557d[_0x9cb9('0x98')](_0x22380b)){this['channel']['setVariable'](util[_0x9cb9('0x52')](_0x9cb9('0x14e'),_0x22380b[_0x9cb9('0x67')]()),_0x4e557d[_0x22380b]);}}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x14f'),JSON[_0x9cb9('0x70')](_0x4e557d)));}}return _0x2f90ff;};AGIVertices[_0x9cb9('0xd')]['ispeechtts']=function(_0x1a6e7e){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1a6e7e[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x1a6e7e[_0x9cb9('0x77')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xe5'));}if(!this[_0x9cb9('0x82')](_0x1a6e7e[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x150'),_0x1a6e7e['text']));var _0xd3a686=this[_0x9cb9('0x7d')][_0x9cb9('0x6c')](this,_0x1a6e7e);if(_0xd3a686){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('ispeech\x20%s\x20file\x20created',_0xd3a686));var _0x4ca3d5=this['channel'][_0x9cb9('0xfe')](_0xd3a686,_0x1a6e7e['intKey']);try{fs[_0x9cb9('0xff')](_0xd3a686+_0x9cb9('0x100'));}catch(_0x548e40){logger[_0x9cb9('0x29')](_0x548e40);}return _0x4ca3d5;}return this[_0x9cb9('0xc')]['error'](_0x1a6e7e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9cb9('0xd')]['login']=function(_0x44796c){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x44796c['label']));if(!this[_0x9cb9('0x82')](_0x44796c['findBy'])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x44796c,'no\x20find\x20by\x20configured');}logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x151'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x44796c[_0x9cb9('0x152')]));var _0x535ddd=this[_0x9cb9('0x153')]['sync'](this,_0x44796c[_0x9cb9('0x152')]);if(_0x535ddd){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this[_0x9cb9('0xc')]['callerid'],_0x44796c[_0x9cb9('0x152')]));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x44796c[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x155')};}else{logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x44796c[_0x9cb9('0x152')]));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x156'),this[_0x9cb9('0xc')]['callerid'],_0x44796c[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x157')};}};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x158')]=function(_0x39ce0d){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x159'),_0x39ce0d[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x39ce0d['findBy'])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x39ce0d,_0x9cb9('0x15a'));}logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x39ce0d[_0x9cb9('0x152')]));var _0x5e8bfc=this[_0x9cb9('0x50')][_0x9cb9('0x6c')](this,_0x39ce0d['findBy']);if(_0x5e8bfc){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this['channel']['callerid'],_0x39ce0d['findBy']));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x154'),this[_0x9cb9('0xc')]['callerid'],_0x39ce0d[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x155')};}else{logger['info'](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x39ce0d['findBy']));this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this['channel'][_0x9cb9('0x39')],_0x39ce0d['findBy']));return{'code':0xc8,'result':_0x9cb9('0x157')};}};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x15b')]=function(_0x5ea352){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x15c'),_0x5ea352[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x5ea352['operation'])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x5ea352,_0x9cb9('0x15d'));}this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('math\x20%s',_0x5ea352[_0x9cb9('0x15e')]));var _0x40361e=eval(_0x5ea352[_0x9cb9('0x15e')]);if(!this[_0x9cb9('0x82')](_0x5ea352[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0xd5'));}var _0x2acd56=this[_0x9cb9('0xe')]['sync'](this,_0x5ea352['variable_id']);if(!_0x2acd56){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x5ea352,_0x9cb9('0xd6'));}if(_[_0x9cb9('0x99')](_0x40361e)){var _0x5869fe=this;_0x40361e[_0x9cb9('0xd7')](function(_0x45700c,_0x5e8721){_0x5869fe[_0x9cb9('0xc')][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x15f'),_0x2acd56,_0x5e8721),_0x45700c);});return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format'](_0x9cb9('0x160'),_0x2acd56));}else{return this['channel'][_0x9cb9('0x9e')](_0x2acd56,_0x40361e);}};AGIVertices[_0x9cb9('0xd')]['menu']=function(_0x291491){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x161'),_0x291491[_0x9cb9('0x34')]));if(_0x291491['retry']===0x0){return this[_0x9cb9('0xa4')](_0x291491);}_0x291491[_0x9cb9('0xa5')]-=0x1;if(!this[_0x9cb9('0x82')](_0x291491['file_id'])){return this['channel'][_0x9cb9('0x29')](_0x291491,_0x9cb9('0x10d'));}var _0xc91a33=this[_0x9cb9('0x1c')][_0x9cb9('0x6c')](this,_0x291491['file_id']);if(!_0xc91a33){return this[_0x9cb9('0xc')]['error'](_0x291491,_0x9cb9('0x10e'));}var _0x10fdf2=this['channel']['getData'](_0xc91a33,_0x291491['response'],_0x291491['digit']);var _0x1a2f18=_0x10fdf2['result'];if(_0x10fdf2[_0x9cb9('0xa2')]===-0x1){this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x291491,'-1');return _0x10fdf2;}else if(_0x10fdf2[_0x9cb9('0xa3')]===_0x9cb9('0x62')){_0x10fdf2[_0x9cb9('0xa2')]=_0x10fdf2['result'][_0x9cb9('0x9a')]>0x0?_0x10fdf2['result']:'t';}else if(_[_0x9cb9('0x42')](_0x10fdf2[_0x9cb9('0xa2')])){_0x10fdf2['result']='#';_0x1a2f18='#';}if(!this[_0x9cb9('0x82')](_0x291491[_0x9cb9('0xd4')])){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xd5'));}else{var _0x3cf512=this['getVariable']['sync'](this,_0x291491[_0x9cb9('0xd4')]);if(!_0x3cf512){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x291491,'no\x20variable\x20found');}this[_0x9cb9('0xc')][_0x9cb9('0x9e')](_0x3cf512,_0x1a2f18);}this['createSquareDetailsReport']['sync'](this,_0x291491,_0x1a2f18);return _0x10fdf2;};AGIVertices[_0x9cb9('0xd')]['noop']=function(_0x4f0374){logger['info'](util[_0x9cb9('0x52')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4f0374[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x4f0374[_0x9cb9('0x162')]||_0x4f0374[_0x9cb9('0x34')]);};AGIVertices[_0x9cb9('0xd')]['pause']=function(_0x4ddc8a){logger['info'](util[_0x9cb9('0x52')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4ddc8a['label']));if(!this[_0x9cb9('0x82')](_0x4ddc8a['findBy'])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x4ddc8a,_0x9cb9('0x15a'));}logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x151'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x4ddc8a[_0x9cb9('0x152')]));var _0x3728d1=this[_0x9cb9('0x4c')][_0x9cb9('0x6c')](this,_0x4ddc8a[_0x9cb9('0x163')]);var _0x5a66aa=this['agentPause'][_0x9cb9('0x6c')](this,_0x4ddc8a[_0x9cb9('0x152')],_0x3728d1);if(_0x5a66aa){logger['info'](util[_0x9cb9('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9cb9('0xc')]['callerid'],_0x4ddc8a[_0x9cb9('0x152')]));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x4ddc8a[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x155')};}else{logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x4ddc8a[_0x9cb9('0x152')]));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x4ddc8a['findBy']));return{'code':0xc8,'result':_0x9cb9('0x157')};}};AGIVertices[_0x9cb9('0xd')]['playback']=function(_0x297dcc){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x164'),_0x297dcc[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x297dcc['file_id'])){return this['channel'][_0x9cb9('0x29')](_0x297dcc,'no\x20file\x20audio\x20selected');}var _0x9aad3=this['getSound']['sync'](this,_0x297dcc[_0x9cb9('0x10c')]);if(!_0x9aad3){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x297dcc,_0x9cb9('0x10e'));}var _0x243ed0=this[_0x9cb9('0xc')][_0x9cb9('0x55')]('PLAYBACK',[_0x9aad3,_0x297dcc[_0x9cb9('0xe1')]]);if(_0x243ed0[_0x9cb9('0xa2')]===-0x1){return _0x243ed0;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x165'),_0x9cb9('0x166'),_0x9aad3));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x167')]=function(_0x488a2e){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x168'),_0x488a2e[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x488a2e[_0x9cb9('0x169')])){return this[_0x9cb9('0xc')]['error'](_0x488a2e,_0x9cb9('0x16a'));}var _0x50e11e='';var _0x1592ca=parseInt(_0x488a2e['queue_id'],0xa);if(isNaN(_0x1592ca)){_0x50e11e=_0x488a2e[_0x9cb9('0x169')];}else{_0x50e11e=this[_0x9cb9('0x16b')][_0x9cb9('0x6c')](this,_0x488a2e[_0x9cb9('0x169')]);if(!_0x50e11e){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x488a2e,'no\x20queue\x20found');}}var _0x5b0f1c='';if(this['isConfigured'](_0x488a2e['file_id'])){var _0x248840=this['getSound'][_0x9cb9('0x6c')](this,_0x488a2e[_0x9cb9('0x10c')]);if(_0x248840){_0x5b0f1c=_0x248840;}}this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x488a2e,_0x50e11e);if(_0x488a2e[_0x9cb9('0xe1')][_0x9cb9('0x16c')]('x')<0x0){_0x488a2e[_0x9cb9('0xe1')]+='x';}if(_0x488a2e[_0x9cb9('0xe1')][_0x9cb9('0x16c')]('X')<0x0){_0x488a2e[_0x9cb9('0xe1')]+='X';}this[_0x9cb9('0xc')][_0x9cb9('0x9e')]('XMCS-QUEUE',_0x50e11e?_0x50e11e[_0x9cb9('0x16d')]():'');var _0x632146=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0x16e'),[_0x50e11e,_0x488a2e[_0x9cb9('0xe1')],_0x488a2e[_0x9cb9('0x6e')],_0x5b0f1c,_0x488a2e['timeout'],_0x488a2e[_0x9cb9('0x5')],_0x488a2e[_0x9cb9('0x16f')],_0x488a2e[_0x9cb9('0x170')],'',_0x488a2e[_0x9cb9('0x171')]]);if(_0x632146[_0x9cb9('0xa2')]===-0x1){return _0x632146;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x165'),'QUEUE',_0x50e11e));};AGIVertices['prototype']['record']=function(_0x3f2e92){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x172'),_0x3f2e92[_0x9cb9('0x34')]));var _0x369075=_0x3f2e92['recordingFormat']||_0x9cb9('0x12b');var _0x2703a0=util[_0x9cb9('0x52')](_0x9cb9('0x173'),this[_0x9cb9('0xc')]['uniqueid'],rs[_0x9cb9('0x115')](0x5));var _0x589479=util['format'](_0x9cb9('0x174'),FILES_PATH,_0x2703a0,_0x369075);var _0x51e1e1=util['format'](_0x9cb9('0x12c'),FILES_PATH,_0x2703a0);this[_0x9cb9('0x37')][_0x9cb9('0x6c')](this,_0x3f2e92,_0x2703a0,_0x589479);this['channel'][_0x9cb9('0x9e')](_0x9cb9('0x175'),_0x2703a0);logger[_0x9cb9('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x51e1e1,_0x369075,_0x3f2e92[_0x9cb9('0x176')],_0x3f2e92['timeout']);return this[_0x9cb9('0xc')]['recordFile'](_0x51e1e1,_0x369075,_0x3f2e92[_0x9cb9('0x176')],_0x3f2e92['timeout'],undefined,!![]);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x177')]=function(_0x1f22df){logger[_0x9cb9('0x2b')](util['format'](_0x9cb9('0x178'),_0x1f22df[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x1f22df['url'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')]('no\x20url\x20configured');}var _0x58c9d7=this[_0x9cb9('0x179')][_0x9cb9('0x6c')](this,_0x1f22df);logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')]('Response:',util[_0x9cb9('0x17a')](_0x58c9d7,{'showHidden':![],'depth':null})));if(!this[_0x9cb9('0x82')](_0x1f22df[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x56cc4e=this[_0x9cb9('0xe')]['sync'](this,_0x1f22df[_0x9cb9('0xd4')]);if(!_0x56cc4e){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x1f22df,'no\x20variable\x20found');}this[_0x9cb9('0xc')][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x17b'),_0x56cc4e),_0x58c9d7['statusCode']?_0x58c9d7[_0x9cb9('0x72')]:_0x9cb9('0x17c'));this['channel'][_0x9cb9('0x9e')](util[_0x9cb9('0x52')](_0x9cb9('0x17d'),_0x56cc4e),_0x58c9d7[_0x9cb9('0x73')]?_0x58c9d7[_0x9cb9('0x73')]:'OK');if(_0x58c9d7['body']){try{this[_0x9cb9('0x9c')](_0x58c9d7['body'],_0x56cc4e);}catch(_0x259d83){logger['error'](util['format'](_0x9cb9('0x17e'),_0x56cc4e));}}return this['channel'][_0x9cb9('0xa8')](util['format'](_0x9cb9('0xdb'),_0x56cc4e));};AGIVertices['prototype'][_0x9cb9('0x17f')]=function(_0xcae6e3){logger['info'](util['format'](_0x9cb9('0x180'),_0xcae6e3[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')][_0x9cb9('0x181')](_0xcae6e3[_0x9cb9('0x182')][_0x9cb9('0x56')](/\s+/g,''),_0xcae6e3[_0x9cb9('0x176')]);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x183')]=function(_0x5e4855){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x184'),_0x5e4855['label']));return this['channel'][_0x9cb9('0x185')](_0x5e4855['number'][_0x9cb9('0x56')](/\s+/g,''),_0x5e4855[_0x9cb9('0x176')]);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x186')]=function(_0x2c6640){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x187'),_0x2c6640[_0x9cb9('0x34')]));return this[_0x9cb9('0xc')]['sayPhonetic'](_0x2c6640[_0x9cb9('0x5a')],_0x2c6640[_0x9cb9('0x176')]);};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x188')]=function(_0x3ba01c){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x189'),_0x3ba01c['label']));if(!this[_0x9cb9('0x82')](_0x3ba01c[_0x9cb9('0x18a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')]('no\x20mail\x20account\x20configured');}var _0x392f37=this['getMailAccount']['sync'](this,_0x3ba01c[_0x9cb9('0x18a')]);if(!_0x392f37||!_0x392f37[_0x9cb9('0x18b')]){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x3ba01c,_0x9cb9('0x18c'));}var _0x20f788={'from':util[_0x9cb9('0x52')](_0x9cb9('0x18d'),_0x392f37[_0x9cb9('0x11')],_0x392f37['email']||_0x392f37['Smtp'][_0x9cb9('0x18e')]),'to':_0x3ba01c['to']||'','cc':_0x3ba01c['cc']||'','bcc':_0x3ba01c[_0x9cb9('0x18f')]||'','subject':_0x3ba01c[_0x9cb9('0x190')],'html':_0x3ba01c['text'],'text':_0x3ba01c[_0x9cb9('0x5a')]};if(this[_0x9cb9('0x82')](_0x3ba01c['template_id'])){}logger[_0x9cb9('0xdd')]('sendMail\x20message',JSON[_0x9cb9('0x70')](_0x20f788));this['createSquareDetailsReport'][_0x9cb9('0x6c')](this,_0x3ba01c,_0x3ba01c[_0x9cb9('0x18a')]);this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x191'),_0x392f37[_0x9cb9('0x11')]));this['sendMailMessage'][_0x9cb9('0x6c')](this,_0x392f37[_0x9cb9('0x192')],_0x20f788);return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0x193'));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x194')]=function(_0x22be7f){logger[_0x9cb9('0x2b')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x22be7f['label']));return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0x195'));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x196')]=function(_0x37fe42){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x197'),_0x37fe42[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x37fe42[_0x9cb9('0x198')])){return this['channel']['noop'](_0x9cb9('0x199'));}var _0x1fb7f8=this[_0x9cb9('0x19a')]['sync'](this,_0x37fe42[_0x9cb9('0x198')]);if(!_0x1fb7f8){return this[_0x9cb9('0xc')]['error'](_0x37fe42,_0x9cb9('0x19b'));}var _0x5487d6={'body':_0x37fe42['sms_text'],'phone':_0x37fe42['to']||'','SmsAccountId':_0x1fb7f8['id']};logger['debug'](_0x9cb9('0x19c'),JSON[_0x9cb9('0x70')](_0x5487d6));this['createSquareDetailsReport'][_0x9cb9('0x6c')](this,_0x37fe42,_0x37fe42[_0x9cb9('0x198')]);this['channel']['noop'](util[_0x9cb9('0x52')](_0x9cb9('0x19d'),_0x1fb7f8[_0x9cb9('0x11')]));this[_0x9cb9('0x32')]['sync'](this,_0x5487d6);return this['channel'][_0x9cb9('0xa8')](_0x9cb9('0x19e'));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x19f')]=function(_0x197186){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1a0'),_0x197186[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x197186[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')]['error'](_0x197186,_0x9cb9('0x1a1'));}var _0xf13301=this['getVariable'][_0x9cb9('0x6c')](this,_0x197186[_0x9cb9('0xd4')]);if(!_0xf13301){return this['channel'][_0x9cb9('0x29')](_0x197186,_0x9cb9('0xd6'));}return this[_0x9cb9('0xc')][_0x9cb9('0x9e')](_0xf13301,_0x197186[_0x9cb9('0x1a2')]);};AGIVertices['prototype']['start']=function(_0x574bb3){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1a3'),_0x574bb3[_0x9cb9('0x34')]));this[_0x9cb9('0xc')][_0x9cb9('0xa8')]('START\x20CALLY\x20SQUARE');var _0xb94df=this[_0x9cb9('0xc')][_0x9cb9('0xe')](_0x9cb9('0x1a4'));if(!_[_0x9cb9('0x42')](_0xb94df[_0x9cb9('0xa3')])){this['channel'][_0x9cb9('0x38')]=_0xb94df['extra'];}if(_0x574bb3[_0x9cb9('0xb6')]===_0x9cb9('0x1a5')){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0x1a6'));return this[_0x9cb9('0xc')]['answer']();}return this[_0x9cb9('0xc')]['noop'](_0x9cb9('0x1a7'));};AGIVertices[_0x9cb9('0xd')]['subproject']=function(_0x34c067){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1a8'),_0x34c067[_0x9cb9('0x34')]));if(!this['isConfigured'](_0x34c067[_0x9cb9('0x1a9')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x34c067,'no\x20subproject\x20selected');}var _0x2bffb6=this[_0x9cb9('0x15')][_0x9cb9('0x6c')](this,_0x34c067['project_id']);if(!this[_0x9cb9('0x82')](_0x2bffb6)){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x34c067,util['format'](_0x9cb9('0x1aa'),_0x34c067[_0x9cb9('0x1a9')]));}if(_0x2bffb6===this[_0x9cb9('0xc')][_0x9cb9('0x36')]){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x34c067,_0x9cb9('0x1ab'));}this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x34c067,_0x2bffb6);var _0x179b28=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0x1ac'),util[_0x9cb9('0x52')](_0x9cb9('0x1ad'),config[_0x9cb9('0x5')]['host']||_0x9cb9('0x1ae'),_0x2bffb6,this[_0x9cb9('0xc')][_0x9cb9('0x36')]));if(_0x179b28[_0x9cb9('0xa2')]===-0x1){return _0x179b28;}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')]('Executed\x20command\x20%s\x20%s','AGI',_0x2bffb6));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1af')]=function(_0x52e937){logger['info'](util['format'](_0x9cb9('0x1b0'),_0x52e937[_0x9cb9('0x34')]));var _0x1888c8=this[_0x9cb9('0x1b1')][_0x9cb9('0x6c')](this,_0x52e937['command']);this[_0x9cb9('0x33')][_0x9cb9('0x6c')](this,_0x52e937,_0x52e937[_0x9cb9('0x1b2')]);if(this[_0x9cb9('0x82')](_0x52e937['variable_id'])){var _0x148523=this[_0x9cb9('0xe')]['sync'](this,_0x52e937[_0x9cb9('0xd4')]);if(_0x148523){this[_0x9cb9('0xc')][_0x9cb9('0x9e')](_0x148523,_0x1888c8);return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x1b3'),_0x52e937[_0x9cb9('0x1b2')],_0x148523));}}return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x1b4'),_0x52e937[_0x9cb9('0x1b2')]));};AGIVertices['prototype'][_0x9cb9('0x1b5')]=function(_0x1f90ab){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1b6'),_0x1f90ab['label']));_0x1f90ab[_0x9cb9('0x5a')]=_0x1f90ab[_0x9cb9('0x5a')][_0x9cb9('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9cb9('0x82')](_0x1f90ab['apiKey'])){return this['channel'][_0x9cb9('0xa8')]('no\x20apiKey\x20configured');}if(!this[_0x9cb9('0x82')](_0x1f90ab[_0x9cb9('0x5a')])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this[_0x9cb9('0xc')]['noop'](util[_0x9cb9('0x52')](_0x9cb9('0x1b7'),_0x1f90ab[_0x9cb9('0x5a')]));var _0x27bfc9=this[_0x9cb9('0x57')][_0x9cb9('0x6c')](this,_0x1f90ab);if(_0x27bfc9){this[_0x9cb9('0xc')]['noop'](util[_0x9cb9('0x52')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x27bfc9));var _0x43b4d3=this[_0x9cb9('0xc')]['streamFile'](_0x27bfc9);try{fs['unlink'](_0x27bfc9+_0x9cb9('0x100'));}catch(_0x20961d){logger[_0x9cb9('0x29')](_0x20961d);}return _0x43b4d3;}return this[_0x9cb9('0xc')]['error'](_0x1f90ab,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1b8')]=function(_0xc349d6){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1b9'),_0xc349d6[_0x9cb9('0x34')]));_0xc349d6[_0x9cb9('0x5a')]=_0xc349d6['text'][_0x9cb9('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xc349d6['text'])){return this[_0x9cb9('0xc')][_0x9cb9('0xa8')](_0x9cb9('0xc4'));}this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x1ba'),_0xc349d6[_0x9cb9('0x5a')]));var _0x2410ad=this[_0x9cb9('0x5f')][_0x9cb9('0x6c')](this,_0xc349d6);if(_0x2410ad){this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2410ad));var _0x36b9c1=this[_0x9cb9('0xc')]['streamFile'](_0x2410ad);try{fs[_0x9cb9('0xff')](_0x2410ad+'.wav');}catch(_0x56288d){logger['error'](_0x56288d);}return _0x36b9c1;}return this['channel'][_0x9cb9('0x29')](_0xc349d6,_0x9cb9('0x1bb'));};AGIVertices['prototype'][_0x9cb9('0x1bc')]=function(_0x25bc97){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1bd'),_0x25bc97[_0x9cb9('0x34')]));if(!this[_0x9cb9('0x82')](_0x25bc97[_0x9cb9('0x152')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x25bc97,_0x9cb9('0x15a'));}logger['info'](util[_0x9cb9('0x52')](_0x9cb9('0x151'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x25bc97['findBy']));var _0x796b11=this['agentUnpause'][_0x9cb9('0x6c')](this,_0x25bc97[_0x9cb9('0x152')]);if(_0x796b11){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this[_0x9cb9('0xc')][_0x9cb9('0x39')],_0x25bc97['findBy']));this[_0x9cb9('0xc')][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x154'),this['channel'][_0x9cb9('0x39')],_0x25bc97[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x155')};}else{logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this[_0x9cb9('0xc')]['callerid'],_0x25bc97[_0x9cb9('0x152')]));this['channel'][_0x9cb9('0xa8')](util[_0x9cb9('0x52')](_0x9cb9('0x156'),this['channel'][_0x9cb9('0x39')],_0x25bc97[_0x9cb9('0x152')]));return{'code':0xc8,'result':_0x9cb9('0x157')};}};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1be')]=function(_0x379786){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1bf'),_0x379786['label']));var _0x3edde2=this[_0x9cb9('0xc')][_0x9cb9('0x55')](_0x9cb9('0x1c0'),[_0x379786[_0x9cb9('0x1c1')],_0x379786[_0x9cb9('0x76')]]);if(_0x3edde2[_0x9cb9('0xa2')]===-0x1){return _0x3edde2;}return this[_0x9cb9('0xc')]['noop'](util[_0x9cb9('0x52')]('Executed\x20command\x20%s\x20%s',_0x9cb9('0x1c0'),_0x379786[_0x9cb9('0x1c1')]));};AGIVertices[_0x9cb9('0xd')][_0x9cb9('0x1c2')]=function(_0x5b5b65){logger[_0x9cb9('0x2b')](util[_0x9cb9('0x52')](_0x9cb9('0x1c3'),_0x5b5b65['label']));if(!this[_0x9cb9('0x82')](_0x5b5b65[_0x9cb9('0xd4')])){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x5b5b65,_0x9cb9('0x1a1'));}var _0x2fcdb=this[_0x9cb9('0xe')][_0x9cb9('0x6c')](this,_0x5b5b65[_0x9cb9('0xd4')]);if(!_0x2fcdb){return this[_0x9cb9('0xc')][_0x9cb9('0x29')](_0x5b5b65,_0x9cb9('0xd6'));}var _0x2299f3=this[_0x9cb9('0xc')][_0x9cb9('0xe')](_0x2fcdb);return{'code':0xc8,'result':_0x2299f3[_0x9cb9('0xa3')]?_0x2299f3[_0x9cb9('0xa3')]:'-'};};String['prototype']['replaceAll']=function(_0x2556a0,_0x11085c){return this['split'](_0x2556a0)['join'](_0x11085c);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ba5017d..1477b77 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 _0x23d5=['prototype','updateAcw','lastPauseAt','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','available','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','pauseType','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','../../../config/logger','acw','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds'];(function(_0x225f7a,_0x2a0447){var _0x418621=function(_0x490958){while(--_0x490958){_0x225f7a['push'](_0x225f7a['shift']());}};_0x418621(++_0x2a0447);}(_0x23d5,0x18d));var _0x523d=function(_0x20273b,_0xe16f81){_0x20273b=_0x20273b-0x0;var _0x22b4d5=_0x23d5[_0x20273b];return _0x22b4d5;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require(_0x523d('0x0'))(_0x523d('0x1'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x111d20){this[_0x523d('0x2')]=_0x111d20[_0x523d('0x2')];this[_0x523d('0x3')]=_0x111d20[_0x523d('0x3')];this[_0x523d('0x4')]=_0x111d20[_0x523d('0x4')];this[_0x523d('0x5')]={};ami['on']('agentconnect',this[_0x523d('0x6')][_0x523d('0x7')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x523d('0x8'),this[_0x523d('0x9')][_0x523d('0x7')](this));ami['on'](_0x523d('0xa'),this[_0x523d('0xb')][_0x523d('0x7')](this));ami['on']('attendedtransfer',this[_0x523d('0xc')][_0x523d('0x7')](this));ami['on']('blindtransfer',this[_0x523d('0xd')][_0x523d('0x7')](this));ami['on'](_0x523d('0xe'),this['syncAgentConnectPreview'][_0x523d('0x7')](this));}function getDiff(_0x389f2a){var _0x56dc35=moment()[_0x523d('0xf')](0x0);var _0x31d718=moment(_0x389f2a)[_0x523d('0xf')](0x0);return _0x56dc35[_0x523d('0x10')](_0x31d718,_0x523d('0x11'));}Acw[_0x523d('0x12')][_0x523d('0x13')]=function(_0x36fd46,_0x5abaee){var _0x3c9a2b=this;var _0x58a356=getDiff(_0x3c9a2b[_0x523d('0x4')][_0x36fd46][_0x523d('0x14')]);clearTimeout(_0x3c9a2b[_0x523d('0x4')][_0x36fd46]['timer']);_0x3c9a2b[_0x523d('0x4')][_0x36fd46]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x58a356},_0x3c9a2b[_0x523d('0x4')][_0x36fd46][_0x523d('0x15')],_0x36fd46)[_0x523d('0x16')](function(_0x348d93){logger[_0x523d('0x17')]('[%s][UPDATE][ACWTIME:%s]',_0x5abaee,_0x58a356,_0x348d93);})[_0x523d('0x18')](function(_0x1237aa){logger[_0x523d('0x19')](_0x523d('0x1a'),_0x5abaee,_0x1237aa);})[_0x523d('0x1b')](function(){delete _0x3c9a2b['timers'][_0x36fd46];});};Acw[_0x523d('0x12')][_0x523d('0x1c')]=function(_0x4a350a){try{var _0x4c70c2=this;var _0x4c5854=this[_0x523d('0x5')][_0x4a350a][_0x523d('0x1d')];var _0x5d719a=this['channels'][_0x4a350a][_0x523d('0x1e')];var _0x1a3ff3=this[_0x523d('0x2')][_0x5d719a];var _0x1d827e=![];var _0x5d4c66=_0x523d('0x1f');if(_0x1a3ff3[_0x523d('0x20')]&&_0x1a3ff3[_0x523d('0x21')][_0x523d('0x22')]){_0x1d827e=!![];_0x5d4c66=_0x1a3ff3[_0x523d('0x21')][_0x523d('0x22')];}return ami[_0x523d('0x23')]({'action':_0x523d('0x24'),'interface':_0x4c5854,'paused':!![],'reason':_0x5d4c66})[_0x523d('0x16')](function(){if(_0x4c70c2[_0x523d('0x3')][_0x4c5854]){return RpcUser[_0x523d('0x25')](_0x4c70c2['agents'][_0x4c5854]['id'])[_0x523d('0x16')](function(_0x7f2ba2){if(!_0x7f2ba2||_0x7f2ba2[_0x523d('0x26')]){logger['info'](_0x523d('0x27'),_0x4a350a,_0x4c5854,_0x5d719a);return;}logger[_0x523d('0x17')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x4a350a,_0x4c5854,_0x5d719a);var _0x3c8262=_0x4c70c2[_0x523d('0x5')][_0x4a350a]['attended']&&_0x4c70c2[_0x523d('0x5')][_0x4a350a]['destlinkedid']?_0x4c70c2['channels'][_0x4a350a][_0x523d('0x28')]:_0x4a350a;return RpcUser['savePause'](_0x4c70c2[_0x523d('0x3')][_0x4c5854],_0x5d4c66,_0x3c8262)[_0x523d('0x16')](function(_0x1a9ea1){_0x4c70c2[_0x523d('0x2')][_0x5d719a][_0x523d('0x29')]-=0x1;_0x4c70c2[_0x523d('0x2')][_0x5d719a]['paused']+=0x1;return _0x1a9ea1;});})[_0x523d('0x16')](function(_0x5c5072){if(_0x1d827e||!_0x5c5072){return;}_0x4c70c2[_0x523d('0x4')][_0x4c5854]={};logger[_0x523d('0x17')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4a350a,_0x4c70c2[_0x523d('0x2')][_0x5d719a][_0x523d('0x2a')],_0x4c5854,_0x5d719a);_0x4c70c2[_0x523d('0x4')][_0x4c5854][_0x523d('0x2b')]=setTimeout(_0x4c70c2[_0x523d('0x2c')][_0x523d('0x7')](_0x4c70c2,_0x4c5854),_0x4c70c2[_0x523d('0x2')][_0x5d719a][_0x523d('0x2a')]*0x3e8);_0x4c70c2[_0x523d('0x4')][_0x4c5854][_0x523d('0x14')]=moment()[_0x523d('0x2d')](_0x523d('0x2e'));_0x4c70c2['timers'][_0x4c5854]['uniqueid']=_0x4a350a;_0x4c70c2[_0x523d('0x4')][_0x4c5854][_0x523d('0x1e')]=_0x5d719a;_0x4c70c2[_0x523d('0x4')][_0x4c5854][_0x523d('0x13')]=_0x4c70c2[_0x523d('0x13')]['bind'](_0x4c70c2,_0x4c5854,_0x4a350a);});}})[_0x523d('0x18')](function(){logger[_0x523d('0x19')](_0x523d('0x2f'),_0x4a350a,_0x4c70c2[_0x523d('0x2')][_0x5d719a][_0x523d('0x2a')],_0x4c5854,_0x5d719a);})['finally'](function(){delete _0x4c70c2['channels'][_0x4a350a];});}catch(_0x2d7b1a){logger[_0x523d('0x19')](_0x523d('0x30'),_0x2d7b1a['message']);}};Acw[_0x523d('0x12')][_0x523d('0x2c')]=function(_0x43c052){try{var _0x52b558=this;if(_0x52b558[_0x523d('0x4')][_0x43c052]){_0x52b558[_0x523d('0x4')][_0x43c052]['timer']=![];var _0x47943d=_0x52b558['timers'][_0x43c052][_0x523d('0x15')];var _0x228b1c=_0x52b558[_0x523d('0x4')][_0x43c052][_0x523d('0x1e')];var _0x1c8a0c=_0x52b558[_0x523d('0x2')][_0x228b1c][_0x523d('0x2a')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x47943d,_0x43c052);RpcUser[_0x523d('0x25')](this[_0x523d('0x3')][_0x43c052]['id'])[_0x523d('0x16')](function(_0x3a2648){if(_0x3a2648[_0x523d('0x31')]===_0x523d('0x1f')){return RpcUser[_0x523d('0x32')](_0x52b558[_0x523d('0x3')][_0x43c052]);}});RpcVoiceAgentReport[_0x523d('0x33')]({'acwtime':_0x1c8a0c,'agentacw':!![]},_0x47943d,_0x43c052)['then'](function(_0x26c00a){logger[_0x523d('0x17')](_0x523d('0x34'),_0x47943d,_0x1c8a0c,_0x26c00a);})[_0x523d('0x18')](function(_0x2480b2){logger['error'](_0x523d('0x1a'),_0x47943d,_0x2480b2);});}else{logger[_0x523d('0x19')](_0x523d('0x35'),_0x43c052);if(_0x52b558[_0x523d('0x4')]){logger['info'](_0x523d('0x36'),JSON[_0x523d('0x37')](_0x52b558[_0x523d('0x4')]));}}}catch(_0x280287){logger[_0x523d('0x19')](_0x523d('0x38'),_0x280287[_0x523d('0x39')]);}};Acw[_0x523d('0x12')][_0x523d('0x6')]=function(_0x30706b){try{if(this[_0x523d('0x2')][_0x30706b[_0x523d('0x1e')]]&&(this[_0x523d('0x2')][_0x30706b[_0x523d('0x1e')]][_0x523d('0x1')]||this[_0x523d('0x2')][_0x30706b['queue']][_0x523d('0x20')])){if(this[_0x523d('0x3')][_0x30706b[_0x523d('0x1d')]]){this['channels'][_0x30706b[_0x523d('0x15')]]={'queue':_0x30706b[_0x523d('0x1e')],'interface':_0x30706b[_0x523d('0x1d')],'destlinkedid':_0x30706b[_0x523d('0x28')]};}}}catch(_0x4594cc){logger[_0x523d('0x19')](_0x523d('0x3a'),_0x4594cc[_0x523d('0x39')]);}};Acw['prototype'][_0x523d('0x3b')]=function(_0x18c0ef){try{if(this['voiceQueues'][_0x18c0ef[_0x523d('0x1e')]]&&(this[_0x523d('0x2')][_0x18c0ef[_0x523d('0x1e')]][_0x523d('0x1')]||this[_0x523d('0x2')][_0x18c0ef[_0x523d('0x1e')]][_0x523d('0x20')])){if(this[_0x523d('0x3')][_0x18c0ef[_0x523d('0x1d')]]){this[_0x523d('0x5')][_0x18c0ef[_0x523d('0x15')]]={'queue':_0x18c0ef[_0x523d('0x1e')],'interface':_0x18c0ef[_0x523d('0x1d')]};}}}catch(_0x83796e){logger[_0x523d('0x19')](_0x523d('0x3c'),_0x83796e['message']);}};Acw[_0x523d('0x12')]['syncHangupRequest']=function(_0x4a0fd3){try{if(this['channels'][_0x4a0fd3[_0x523d('0x15')]]&&_[_0x523d('0x3d')](this['channels'][_0x4a0fd3[_0x523d('0x15')]][_0x523d('0x3e')])){logger[_0x523d('0x17')](_0x523d('0x3f'),_0x4a0fd3['uniqueid']);this[_0x523d('0x1c')](_0x4a0fd3[_0x523d('0x15')]);}else if(this['channels'][_0x4a0fd3[_0x523d('0x40')]]&&_[_0x523d('0x3d')](this[_0x523d('0x5')][_0x4a0fd3[_0x523d('0x40')]][_0x523d('0x3e')])){logger[_0x523d('0x17')]('[%s][HANGUP:LINKEDID]',_0x4a0fd3[_0x523d('0x40')]);this['startAcw'](_0x4a0fd3['linkedid']);}}catch(_0x275a4a){logger[_0x523d('0x19')](_0x523d('0x41'),_0x275a4a[_0x523d('0x39')]);}};Acw[_0x523d('0x12')][_0x523d('0x9')]=function(_0x54aeaa){try{if(this[_0x523d('0x5')][_0x54aeaa['uniqueid']]&&this[_0x523d('0x5')][_0x54aeaa[_0x523d('0x15')]][_0x523d('0x3e')]){logger[_0x523d('0x17')](_0x523d('0x42'),_0x54aeaa[_0x523d('0x15')]);this[_0x523d('0x1c')](_0x54aeaa['uniqueid']);}else if(this[_0x523d('0x5')][_0x54aeaa[_0x523d('0x40')]]&&this['channels'][_0x54aeaa['linkedid']][_0x523d('0x3e')]){logger[_0x523d('0x17')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x54aeaa[_0x523d('0x40')]);this[_0x523d('0x1c')](_0x54aeaa[_0x523d('0x40')]);}}catch(_0x30a47d){logger[_0x523d('0x19')](_0x523d('0x43'),_0x30a47d[_0x523d('0x39')]);}};Acw[_0x523d('0x12')]['syncAttendedTransfer']=function(_0x38708e){try{if(!_[_0x523d('0x44')](this[_0x523d('0x5')][_0x38708e[_0x523d('0x45')]])){this[_0x523d('0x1c')](_0x38708e['transfereeuniqueid']);if(this['channels'][_0x38708e['secondtransfereruniqueid']]){this[_0x523d('0x5')][_0x38708e[_0x523d('0x46')]][_0x523d('0x3e')]=!![];this[_0x523d('0x5')][_0x38708e[_0x523d('0x47')]]=this['channels'][_0x38708e[_0x523d('0x46')]];delete this[_0x523d('0x5')][_0x38708e[_0x523d('0x46')]];}}else if(!_[_0x523d('0x44')](this['channels'][_0x38708e['transfertargetuniqueid']])){this[_0x523d('0x1c')](_0x38708e[_0x523d('0x47')]);if(this['channels'][_0x38708e[_0x523d('0x48')]]){this[_0x523d('0x5')][_0x38708e[_0x523d('0x48')]][_0x523d('0x3e')]=!![];this[_0x523d('0x5')][_0x38708e[_0x523d('0x45')]]=this[_0x523d('0x5')][_0x38708e[_0x523d('0x48')]];delete this[_0x523d('0x5')][_0x38708e[_0x523d('0x48')]];}}}catch(_0x26a2ec){logger['error'](_0x523d('0x49'),_0x26a2ec[_0x523d('0x39')]);}};Acw[_0x523d('0x12')][_0x523d('0xd')]=function(_0x4a241c){try{if(this[_0x523d('0x5')][_0x4a241c[_0x523d('0x4a')]]){logger['info'](_0x523d('0x4b'),JSON[_0x523d('0x37')](_0x4a241c[_0x523d('0x4a')]));this[_0x523d('0x1c')](_0x4a241c['transfereruniqueid']);}else if(this[_0x523d('0x5')][_0x4a241c[_0x523d('0x4c')]]){logger[_0x523d('0x17')](_0x523d('0x4d'),JSON['stringify'](_0x4a241c[_0x523d('0x4c')]));this[_0x523d('0x1c')](_0x4a241c[_0x523d('0x4c')]);}}catch(_0x44c3ff){logger[_0x523d('0x19')]('[ACW][syncBlindTransfer]\x20%s',_0x44c3ff[_0x523d('0x39')]);}};Acw[_0x523d('0x12')][_0x523d('0xb')]=function(_0x549487){try{if(this[_0x523d('0x2')][_0x549487[_0x523d('0x1e')]]&&this[_0x523d('0x2')][_0x549487[_0x523d('0x1e')]][_0x523d('0x4e')]==='all'){if(this[_0x523d('0x3')][_0x549487[_0x523d('0x1d')]]){logger['info'](_0x523d('0x4f'),_0x549487[_0x523d('0x15')],_0x549487[_0x523d('0x1d')],_0x549487[_0x523d('0x1e')]);return RpcUser[_0x523d('0x50')](this[_0x523d('0x3')][_0x549487['interface']],_0x523d('0x51'),_0x549487[_0x523d('0x15')]);}}}catch(_0x418fb3){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x418fb3[_0x523d('0x39')]);}};module[_0x523d('0x52')]=Acw; \ No newline at end of file +var _0xe0cd=['[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','finally','startAcw','queue','mandatoryDispositionPause','name','Action','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','interface','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s'];(function(_0x4377a2,_0x476948){var _0x3bfed7=function(_0x479d11){while(--_0x479d11){_0x4377a2['push'](_0x4377a2['shift']());}};_0x3bfed7(++_0x476948);}(_0xe0cd,0xbc));var _0xde0c=function(_0x7f7fbc,_0x4bf6f6){_0x7f7fbc=_0x7f7fbc-0x0;var _0x18ec90=_0xe0cd[_0x7f7fbc];return _0x18ec90;};'use strict';var _=require(_0xde0c('0x0'));var moment=require(_0xde0c('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xde0c('0x2'));var RpcUser=require(_0xde0c('0x3'));var RpcVoiceAgentReport=require(_0xde0c('0x4'));function Acw(_0x19fa6d){this['voiceQueues']=_0x19fa6d[_0xde0c('0x5')];this[_0xde0c('0x6')]=_0x19fa6d['agents'];this[_0xde0c('0x7')]=_0x19fa6d['timers'];this[_0xde0c('0x8')]={};ami['on'](_0xde0c('0x9'),this[_0xde0c('0xa')][_0xde0c('0xb')](this));ami['on'](_0xde0c('0xc'),this[_0xde0c('0xd')][_0xde0c('0xb')](this));ami['on'](_0xde0c('0xe'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0xde0c('0xf')][_0xde0c('0xb')](this));ami['on'](_0xde0c('0x10'),this[_0xde0c('0x11')][_0xde0c('0xb')](this));ami['on'](_0xde0c('0x12'),this[_0xde0c('0x13')]['bind'](this));ami['on'](_0xde0c('0x14'),this[_0xde0c('0x15')][_0xde0c('0xb')](this));}function getDiff(_0x4fa627){var _0x518a1a=moment()[_0xde0c('0x16')](0x0);var _0x5e1e33=moment(_0x4fa627)[_0xde0c('0x16')](0x0);return _0x518a1a[_0xde0c('0x17')](_0x5e1e33,_0xde0c('0x18'));}Acw[_0xde0c('0x19')]['updateAcw']=function(_0x3f89b9,_0x3cc275){var _0x5b8afd=this;var _0x2d3d44=getDiff(_0x5b8afd[_0xde0c('0x7')][_0x3f89b9]['lastPauseAt']);clearTimeout(_0x5b8afd['timers'][_0x3f89b9]['timer']);_0x5b8afd['timers'][_0x3f89b9][_0xde0c('0x1a')]=![];return RpcVoiceAgentReport[_0xde0c('0x1b')]({'acwtime':_0x2d3d44},_0x5b8afd[_0xde0c('0x7')][_0x3f89b9][_0xde0c('0x1c')],_0x3f89b9)[_0xde0c('0x1d')](function(_0x15db91){logger['info'](_0xde0c('0x1e'),_0x3cc275,_0x2d3d44,_0x15db91);})[_0xde0c('0x1f')](function(_0x8ea711){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x3cc275,_0x8ea711);})[_0xde0c('0x20')](function(){delete _0x5b8afd['timers'][_0x3f89b9];});};Acw[_0xde0c('0x19')][_0xde0c('0x21')]=function(_0x2399c5){try{var _0x56f65c=this;var _0x1e726e=this[_0xde0c('0x8')][_0x2399c5]['interface'];var _0x1a2708=this[_0xde0c('0x8')][_0x2399c5][_0xde0c('0x22')];var _0x928d7=this['voiceQueues'][_0x1a2708];var _0x580df7=![];var _0xd6d9d0='ACW';if(_0x928d7['mandatoryDisposition']&&_0x928d7[_0xde0c('0x23')][_0xde0c('0x24')]){_0x580df7=!![];_0xd6d9d0=_0x928d7['mandatoryDispositionPause']['name'];}return ami[_0xde0c('0x25')]({'action':'QueuePause','interface':_0x1e726e,'paused':!![],'reason':_0xd6d9d0})[_0xde0c('0x1d')](function(){if(_0x56f65c[_0xde0c('0x6')][_0x1e726e]){return RpcUser[_0xde0c('0x26')](_0x56f65c[_0xde0c('0x6')][_0x1e726e]['id'])[_0xde0c('0x1d')](function(_0x9530f9){if(!_0x9530f9||_0x9530f9['voicePause']){logger['info'](_0xde0c('0x27'),_0x2399c5,_0x1e726e,_0x1a2708);return;}logger[_0xde0c('0x28')](_0xde0c('0x29'),_0x2399c5,_0x1e726e,_0x1a2708);var _0x203d7c=_0x56f65c[_0xde0c('0x8')][_0x2399c5][_0xde0c('0x2a')]&&_0x56f65c[_0xde0c('0x8')][_0x2399c5][_0xde0c('0x2b')]?_0x56f65c[_0xde0c('0x8')][_0x2399c5][_0xde0c('0x2b')]:_0x2399c5;return RpcUser[_0xde0c('0x2c')](_0x56f65c[_0xde0c('0x6')][_0x1e726e],_0xd6d9d0,_0x203d7c)[_0xde0c('0x1d')](function(_0x4bd14b){_0x56f65c[_0xde0c('0x5')][_0x1a2708][_0xde0c('0x2d')]-=0x1;_0x56f65c[_0xde0c('0x5')][_0x1a2708][_0xde0c('0x2e')]+=0x1;return _0x4bd14b;});})[_0xde0c('0x1d')](function(_0x2398f6){if(_0x580df7||!_0x2398f6){return;}_0x56f65c['timers'][_0x1e726e]={};logger[_0xde0c('0x28')](_0xde0c('0x2f'),_0x2399c5,_0x56f65c[_0xde0c('0x5')][_0x1a2708][_0xde0c('0x30')],_0x1e726e,_0x1a2708);_0x56f65c[_0xde0c('0x7')][_0x1e726e][_0xde0c('0x1a')]=setTimeout(_0x56f65c[_0xde0c('0x31')]['bind'](_0x56f65c,_0x1e726e),_0x56f65c['voiceQueues'][_0x1a2708][_0xde0c('0x30')]*0x3e8);_0x56f65c[_0xde0c('0x7')][_0x1e726e][_0xde0c('0x32')]=moment()[_0xde0c('0x33')](_0xde0c('0x34'));_0x56f65c['timers'][_0x1e726e][_0xde0c('0x1c')]=_0x2399c5;_0x56f65c[_0xde0c('0x7')][_0x1e726e][_0xde0c('0x22')]=_0x1a2708;_0x56f65c[_0xde0c('0x7')][_0x1e726e][_0xde0c('0x35')]=_0x56f65c[_0xde0c('0x35')][_0xde0c('0xb')](_0x56f65c,_0x1e726e,_0x2399c5);});}})[_0xde0c('0x1f')](function(){logger[_0xde0c('0x36')](_0xde0c('0x2f'),_0x2399c5,_0x56f65c[_0xde0c('0x5')][_0x1a2708][_0xde0c('0x30')],_0x1e726e,_0x1a2708);})[_0xde0c('0x20')](function(){delete _0x56f65c['channels'][_0x2399c5];});}catch(_0x550653){logger['error'](_0xde0c('0x37'),_0x550653[_0xde0c('0x38')]);}};Acw[_0xde0c('0x19')][_0xde0c('0x31')]=function(_0x3f2ae9){try{var _0x47cf06=this;if(_0x47cf06[_0xde0c('0x7')][_0x3f2ae9]){_0x47cf06[_0xde0c('0x7')][_0x3f2ae9][_0xde0c('0x1a')]=![];var _0x892bad=_0x47cf06[_0xde0c('0x7')][_0x3f2ae9][_0xde0c('0x1c')];var _0x562ac3=_0x47cf06[_0xde0c('0x7')][_0x3f2ae9][_0xde0c('0x22')];var _0x4584aa=_0x47cf06[_0xde0c('0x5')][_0x562ac3][_0xde0c('0x30')];logger['info'](_0xde0c('0x39'),_0x892bad,_0x3f2ae9);RpcUser['getAgent'](this[_0xde0c('0x6')][_0x3f2ae9]['id'])[_0xde0c('0x1d')](function(_0x59586c){if(_0x59586c[_0xde0c('0x3a')]==='ACW'){return RpcUser['saveUnpause'](_0x47cf06[_0xde0c('0x6')][_0x3f2ae9]);}});RpcVoiceAgentReport[_0xde0c('0x1b')]({'acwtime':_0x4584aa,'agentacw':!![]},_0x892bad,_0x3f2ae9)[_0xde0c('0x1d')](function(_0x584de4){logger[_0xde0c('0x28')]('[%s][UPDATE][ACWTIME:%s]',_0x892bad,_0x4584aa,_0x584de4);})[_0xde0c('0x1f')](function(_0x278ccf){logger[_0xde0c('0x36')](_0xde0c('0x3b'),_0x892bad,_0x278ccf);});}else{logger['error'](_0xde0c('0x3c'),_0x3f2ae9);if(_0x47cf06['timers']){logger[_0xde0c('0x28')](_0xde0c('0x3d'),JSON[_0xde0c('0x3e')](_0x47cf06[_0xde0c('0x7')]));}}}catch(_0x24d09e){logger['error']('[ACW][STOP]\x20%s',_0x24d09e['message']);}};Acw[_0xde0c('0x19')][_0xde0c('0xa')]=function(_0x581c82){try{if(this[_0xde0c('0x5')][_0x581c82[_0xde0c('0x22')]]&&(this['voiceQueues'][_0x581c82['queue']][_0xde0c('0x2')]||this[_0xde0c('0x5')][_0x581c82['queue']]['mandatoryDisposition'])){if(this[_0xde0c('0x6')][_0x581c82[_0xde0c('0x3f')]]){this[_0xde0c('0x8')][_0x581c82[_0xde0c('0x1c')]]={'queue':_0x581c82['queue'],'interface':_0x581c82['interface'],'destlinkedid':_0x581c82[_0xde0c('0x2b')]};}}}catch(_0x2b58fd){logger[_0xde0c('0x36')](_0xde0c('0x40'),_0x2b58fd[_0xde0c('0x38')]);}};Acw[_0xde0c('0x19')][_0xde0c('0x15')]=function(_0x596af1){try{if(this['voiceQueues'][_0x596af1[_0xde0c('0x22')]]&&(this[_0xde0c('0x5')][_0x596af1['queue']][_0xde0c('0x2')]||this[_0xde0c('0x5')][_0x596af1[_0xde0c('0x22')]][_0xde0c('0x41')])){if(this[_0xde0c('0x6')][_0x596af1[_0xde0c('0x3f')]]){this[_0xde0c('0x8')][_0x596af1[_0xde0c('0x1c')]]={'queue':_0x596af1[_0xde0c('0x22')],'interface':_0x596af1[_0xde0c('0x3f')]};}}}catch(_0x527b67){logger[_0xde0c('0x36')](_0xde0c('0x42'),_0x527b67[_0xde0c('0x38')]);}};Acw['prototype']['syncHangupRequest']=function(_0x283902){try{if(this[_0xde0c('0x8')][_0x283902['uniqueid']]&&_['isUndefined'](this[_0xde0c('0x8')][_0x283902[_0xde0c('0x1c')]][_0xde0c('0x2a')])){logger['info'](_0xde0c('0x43'),_0x283902['uniqueid']);this['startAcw'](_0x283902[_0xde0c('0x1c')]);}else if(this[_0xde0c('0x8')][_0x283902['linkedid']]&&_['isUndefined'](this[_0xde0c('0x8')][_0x283902[_0xde0c('0x44')]][_0xde0c('0x2a')])){logger[_0xde0c('0x28')]('[%s][HANGUP:LINKEDID]',_0x283902[_0xde0c('0x44')]);this['startAcw'](_0x283902['linkedid']);}}catch(_0x1f04ce){logger[_0xde0c('0x36')](_0xde0c('0x45'),_0x1f04ce[_0xde0c('0x38')]);}};Acw['prototype']['syncHangup']=function(_0x5a38fb){try{if(this[_0xde0c('0x8')][_0x5a38fb['uniqueid']]&&this[_0xde0c('0x8')][_0x5a38fb[_0xde0c('0x1c')]][_0xde0c('0x2a')]){logger[_0xde0c('0x28')](_0xde0c('0x46'),_0x5a38fb[_0xde0c('0x1c')]);this[_0xde0c('0x21')](_0x5a38fb[_0xde0c('0x1c')]);}else if(this[_0xde0c('0x8')][_0x5a38fb['linkedid']]&&this['channels'][_0x5a38fb[_0xde0c('0x44')]][_0xde0c('0x2a')]){logger[_0xde0c('0x28')](_0xde0c('0x47'),_0x5a38fb[_0xde0c('0x44')]);this[_0xde0c('0x21')](_0x5a38fb['linkedid']);}}catch(_0x18ec58){logger[_0xde0c('0x36')]('[ACW][syncHangup]\x20%s',_0x18ec58[_0xde0c('0x38')]);}};Acw[_0xde0c('0x19')]['syncAttendedTransfer']=function(_0x14d7a1){try{if(!_[_0xde0c('0x48')](this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x49')]])){this[_0xde0c('0x21')](_0x14d7a1[_0xde0c('0x49')]);if(this['channels'][_0x14d7a1[_0xde0c('0x4a')]]){this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4a')]]['attended']=!![];this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4b')]]=this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4a')]];delete this['channels'][_0x14d7a1['secondtransfereruniqueid']];}}else if(!_[_0xde0c('0x48')](this[_0xde0c('0x8')][_0x14d7a1['transfertargetuniqueid']])){this['startAcw'](_0x14d7a1[_0xde0c('0x4b')]);if(this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4c')]]){this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4c')]]['attended']=!![];this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x49')]]=this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4c')]];delete this[_0xde0c('0x8')][_0x14d7a1[_0xde0c('0x4c')]];}}}catch(_0x2b40be){logger['error'](_0xde0c('0x4d'),_0x2b40be['message']);}};Acw['prototype'][_0xde0c('0x13')]=function(_0x2f5eda){try{if(this['channels'][_0x2f5eda[_0xde0c('0x4e')]]){logger[_0xde0c('0x28')](_0xde0c('0x4f'),JSON['stringify'](_0x2f5eda[_0xde0c('0x4e')]));this[_0xde0c('0x21')](_0x2f5eda['transfereruniqueid']);}else if(this[_0xde0c('0x8')][_0x2f5eda['transfererlinkedid']]){logger[_0xde0c('0x28')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x2f5eda[_0xde0c('0x50')]));this['startAcw'](_0x2f5eda[_0xde0c('0x50')]);}}catch(_0x48e1b8){logger[_0xde0c('0x36')]('[ACW][syncBlindTransfer]\x20%s',_0x48e1b8['message']);}};Acw['prototype'][_0xde0c('0xf')]=function(_0x1dd53c){try{if(this[_0xde0c('0x5')][_0x1dd53c[_0xde0c('0x22')]]&&this[_0xde0c('0x5')][_0x1dd53c[_0xde0c('0x22')]][_0xde0c('0x51')]===_0xde0c('0x52')){if(this['agents'][_0x1dd53c[_0xde0c('0x3f')]]){logger[_0xde0c('0x28')](_0xde0c('0x53'),_0x1dd53c[_0xde0c('0x1c')],_0x1dd53c['interface'],_0x1dd53c[_0xde0c('0x22')]);return RpcUser[_0xde0c('0x2c')](this['agents'][_0x1dd53c[_0xde0c('0x3f')]],_0xde0c('0x54'),_0x1dd53c[_0xde0c('0x1c')]);}}}catch(_0x3e5345){logger[_0xde0c('0x36')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3e5345[_0xde0c('0x38')]);}};module[_0xde0c('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0e626a6..dea1f4c 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 _0x9218=['../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','catch','exports','asterisk-manager','bluebird','util','../../config/logger','ami'];(function(_0x348184,_0x1526ba){var _0x2dfd4f=function(_0x3999da){while(--_0x3999da){_0x348184['push'](_0x348184['shift']());}};_0x2dfd4f(++_0x1526ba);}(_0x9218,0xf7));var _0x8921=function(_0x2eca69,_0x1135e2){_0x2eca69=_0x2eca69-0x0;var _0x3d707c=_0x9218[_0x2eca69];return _0x3d707c;};'use strict';var Manager=require(_0x8921('0x0'));var BPromise=require(_0x8921('0x1'));var util=require(_0x8921('0x2'));var logger=require(_0x8921('0x3'))(_0x8921('0x4'));var config=require(_0x8921('0x5'));var ami=new Manager(config['asterisk'][_0x8921('0x6')],config[_0x8921('0x7')]['ip'],config['asterisk'][_0x8921('0x8')],config['asterisk'][_0x8921('0x9')],!![]);ami[_0x8921('0xa')]();ami[_0x8921('0xb')]=BPromise[_0x8921('0xc')](ami[_0x8921('0xd')]);function error(_0x1694e8){logger[_0x8921('0xe')](util['format'](_0x8921('0xf'),config['asterisk'][_0x8921('0x8')],config['asterisk']['ip'],config[_0x8921('0x7')][_0x8921('0x6')],util[_0x8921('0x10')](_0x1694e8,![],null)));}function close(){logger[_0x8921('0xe')](util[_0x8921('0x11')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8921('0x7')][_0x8921('0x8')],config['asterisk']['ip'],config[_0x8921('0x7')][_0x8921('0x6')]));}ami[_0x8921('0x12')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x8921('0x13')]=function(){return function(){return ami[_0x8921('0xb')]({'action':'devicestatelist'});};};ami[_0x8921('0x14')]=function(){return function(){return ami[_0x8921('0xb')]({'action':_0x8921('0x15')});};};ami[_0x8921('0x16')]=function(){return function(){return ami[_0x8921('0xb')]({'action':_0x8921('0x17')});};};ami[_0x8921('0x18')]=function(){return function(){return ami[_0x8921('0xb')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x8921('0x11')](_0x8921('0x19'),config[_0x8921('0x7')][_0x8921('0x8')],config[_0x8921('0x7')]['ip'],config[_0x8921('0x7')]['port']));ami[_0x8921('0x1a')](_0x8921('0xe'),error);ami[_0x8921('0x1a')](_0x8921('0x1b'),close);}ami['on'](_0x8921('0x1c'),connect);ami['on'](_0x8921('0x1d'),function(_0x199492){logger[_0x8921('0x1e')](util[_0x8921('0x11')](_0x8921('0x1f'),config['asterisk'][_0x8921('0x8')],config[_0x8921('0x7')]['ip'],config[_0x8921('0x7')][_0x8921('0x6')],util[_0x8921('0x10')](_0x199492,![],null)));});ami['on'](_0x8921('0x20'),function(){logger[_0x8921('0x1e')](util[_0x8921('0x11')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x8921('0x7')][_0x8921('0x8')],config[_0x8921('0x7')]['ip'],config[_0x8921('0x7')][_0x8921('0x6')]));return Promise['resolve']()[_0x8921('0x21')](ami[_0x8921('0x12')]())[_0x8921('0x21')](ami['actionDeviceStateList']())['then'](ami[_0x8921('0x14')]())[_0x8921('0x21')](ami[_0x8921('0x16')]())[_0x8921('0x21')](ami[_0x8921('0x18')]())[_0x8921('0x22')](function(_0x4acd55){logger[_0x8921('0xe')]('[ami.js][fullybooted]',util['inspect'](_0x4acd55,{'showHidden':![],'depth':null}));});});ami[_0x8921('0x1a')](_0x8921('0xe'),error);ami[_0x8921('0x1a')](_0x8921('0x1b'),close);module[_0x8921('0x23')]=ami; \ No newline at end of file +var _0x3fc0=['resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','close','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3fc0,0xe4));var _0x03fc=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x3fc0[_0x6d6a66];return _0x11eb6e;};'use strict';var Manager=require(_0x03fc('0x0'));var BPromise=require('bluebird');var util=require(_0x03fc('0x1'));var logger=require(_0x03fc('0x2'))(_0x03fc('0x3'));var config=require(_0x03fc('0x4'));var ami=new Manager(config[_0x03fc('0x5')][_0x03fc('0x6')],config[_0x03fc('0x5')]['ip'],config['asterisk'][_0x03fc('0x7')],config[_0x03fc('0x5')][_0x03fc('0x8')],!![]);ami[_0x03fc('0x9')]();ami['Action']=BPromise[_0x03fc('0xa')](ami['action']);function error(_0x547e57){logger[_0x03fc('0xb')](util[_0x03fc('0xc')](_0x03fc('0xd'),config[_0x03fc('0x5')][_0x03fc('0x7')],config[_0x03fc('0x5')]['ip'],config['asterisk']['port'],util[_0x03fc('0xe')](_0x547e57,![],null)));}function close(){logger['error'](util[_0x03fc('0xc')](_0x03fc('0xf'),config[_0x03fc('0x5')][_0x03fc('0x7')],config['asterisk']['ip'],config[_0x03fc('0x5')][_0x03fc('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x03fc('0x10')]({'action':'sipshowregistry'});};};ami[_0x03fc('0x11')]=function(){return function(){return ami[_0x03fc('0x10')]({'action':_0x03fc('0x12')});};};ami[_0x03fc('0x13')]=function(){return function(){return ami['Action']({'action':_0x03fc('0x14')});};};ami[_0x03fc('0x15')]=function(){return function(){return ami[_0x03fc('0x10')]({'action':_0x03fc('0x16')});};};ami[_0x03fc('0x17')]=function(){return function(){return ami[_0x03fc('0x10')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x03fc('0xc')](_0x03fc('0x18'),config[_0x03fc('0x5')][_0x03fc('0x7')],config[_0x03fc('0x5')]['ip'],config[_0x03fc('0x5')][_0x03fc('0x6')]));ami[_0x03fc('0x19')]('error',error);ami[_0x03fc('0x19')]('close',close);}ami['on'](_0x03fc('0x1a'),connect);ami['on'](_0x03fc('0x1b'),function(_0x4cccfe){logger[_0x03fc('0x1c')](util[_0x03fc('0xc')](_0x03fc('0x1d'),config['asterisk'][_0x03fc('0x7')],config['asterisk']['ip'],config[_0x03fc('0x5')][_0x03fc('0x6')],util['inspect'](_0x4cccfe,![],null)));});ami['on']('fullybooted',function(){logger[_0x03fc('0x1c')](util[_0x03fc('0xc')](_0x03fc('0x1e'),config[_0x03fc('0x5')][_0x03fc('0x7')],config[_0x03fc('0x5')]['ip'],config['asterisk']['port']));return Promise[_0x03fc('0x1f')]()[_0x03fc('0x20')](ami[_0x03fc('0x21')]())[_0x03fc('0x20')](ami[_0x03fc('0x11')]())[_0x03fc('0x20')](ami[_0x03fc('0x13')]())[_0x03fc('0x20')](ami[_0x03fc('0x15')]())[_0x03fc('0x20')](ami[_0x03fc('0x17')]())[_0x03fc('0x22')](function(_0x38411c){logger[_0x03fc('0xb')](_0x03fc('0x23'),util['inspect'](_0x38411c,{'showHidden':![],'depth':null}));});});ami[_0x03fc('0x19')](_0x03fc('0xb'),error);ami[_0x03fc('0x19')](_0x03fc('0x24'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7d586b3..2d0d21f 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0xac4a,0x13f));var _0xaac4=function(_0x3da663,_0x5922cc){_0x3da663=_0x3da663-0x0;var _0x56fdb5=_0xac4a[_0x3da663];return _0x56fdb5;};'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 +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x239ce8,_0x191cb8){var _0x37963f=function(_0x1e9f2a){while(--_0x1e9f2a){_0x239ce8['push'](_0x239ce8['shift']());}};_0x37963f(++_0x191cb8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f319582..b817eec 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 _0x0ee3=['xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','countmachineretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr][createHistory]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','reason19\x20machine....','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','moveContactManagedDialer','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','checkRetriveMax','countnosuchnumberretry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','available','floor','predictiveIntervalHitRate','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','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','avgHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','talking','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','milliseconds','[handlePredictive]','checkContactBlack','booked','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','checkContactEmpty','[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','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','erlangb','util','lodash','moment','ioredis','./utils/hopper','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','inspect','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','getSeconds','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','push','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','dialGlobalInterval','launchHandleIvr','checkDialMethod','predictive','dialMethod','handlePower','power','dialPowerLevel','Queue','dialTimezone','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','voiceQueues','uniqueid','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','TIMEOUT','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','locked','paused','stateinterface','isNil','queueBooked','merge','idHopper','syncQueueStatusComplete','rrmemory','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten'];(function(_0x4dd063,_0x386d0c){var _0x2b8747=function(_0x282e72){while(--_0x282e72){_0x4dd063['push'](_0x4dd063['shift']());}};_0x2b8747(++_0x386d0c);}(_0x0ee3,0x10c));var _0x30ee=function(_0x2a33ca,_0x3d9c2a){_0x2a33ca=_0x2a33ca-0x0;var _0x5a4955=_0x0ee3[_0x2a33ca];return _0x5a4955;};'use strict';var util=require(_0x30ee('0x0'));var _=require(_0x30ee('0x1'));var uuid=require('uuid');var moment=require(_0x30ee('0x2'));var rr=require('rr');var Redis=require(_0x30ee('0x3'));var utils=require('./utils');var hopperUtils=require(_0x30ee('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x30ee('0x5'))(_0x30ee('0x6'));var loggerBooked=require(_0x30ee('0x5'))('booked');var loggerPredictive=require(_0x30ee('0x5'))('predictive');var loggerPredictiveCalls=require(_0x30ee('0x5'))(_0x30ee('0x7'));var loggerSyncQueueSummary=require(_0x30ee('0x5'))(_0x30ee('0x8'));var ami=require('../ami');config[_0x30ee('0x9')]=_[_0x30ee('0xa')](config[_0x30ee('0x9')],{'host':_0x30ee('0xb'),'port':0x18eb});var io=require(_0x30ee('0xc'))(new Redis(config[_0x30ee('0x9')]));var cmHopper=require(_0x30ee('0xd'));var voiceQueueRt=require(_0x30ee('0xe'));var RpcSetting=require(_0x30ee('0xf'));var Interval=require(_0x30ee('0x10'));var Action=require(_0x30ee('0x11'));var History=require(_0x30ee('0x12'));var Final=require(_0x30ee('0x13'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x30ee('0x14'));var Hangup=require(_0x30ee('0x15'));var ipAgi=process['env'][_0x30ee('0x16')]||_0x30ee('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x30ee('0x18')][_0x30ee('0x19')]=function(_0x24d49b){this[_0x30ee('0x1a')]=this[_0x30ee('0x1a')]?this['tail'][_0x30ee('0x1b')](_0x24d49b):_0x24d49b();};function Dialer(_0x28c3f3,_0x39b6c4){this[_0x30ee('0x1c')]=new Sequence();this[_0x30ee('0x1d')]=_0x39b6c4;this['voiceQueues']=_0x28c3f3['voiceQueues'];this['campaigns']=_0x28c3f3[_0x30ee('0x1e')];this[_0x30ee('0x1f')]=_0x28c3f3['agents'];this[_0x30ee('0x20')]=_0x28c3f3['trunks'];this['maxNumberOriginate']=config[_0x30ee('0x21')]||0x2;this[_0x30ee('0x22')]={};this[_0x30ee('0x23')]={};this[_0x30ee('0x24')]={};this[_0x30ee('0x25')]={};this['optionPredictive']={};this[_0x30ee('0x26')]={};this[_0x30ee('0x27')]={};this[_0x30ee('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};this[_0x30ee('0x29')]={};ami['on'](_0x30ee('0x2a'),this[_0x30ee('0x2b')]['bind'](this));ami['on'](_0x30ee('0x2c'),this['syncQueueCallerAbandon'][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x2e'),this[_0x30ee('0x2f')][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x30'),this[_0x30ee('0x31')][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x32'),this[_0x30ee('0x8')][_0x30ee('0x2d')](this));ami['on']('custom:queuesummarycomplete',this[_0x30ee('0x33')][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x34'),this[_0x30ee('0x35')][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x36'),this[_0x30ee('0x37')][_0x30ee('0x2d')](this));ami['on']('varset',this[_0x30ee('0x38')]['bind'](this));ami['on']('queuemember',this[_0x30ee('0x39')][_0x30ee('0x2d')](this));ami['on'](_0x30ee('0x3a'),this['syncQueueStatusComplete'][_0x30ee('0x2d')](this));this[_0x30ee('0x3b')]();this[_0x30ee('0x3c')]();RpcSetting[_0x30ee('0x3d')]()[_0x30ee('0x3e')](function(_0x6f7d0b){previewRecallmeReminderInterval=_0x6f7d0b[_0x30ee('0x3f')];});}function isNotNull(_0x1a8339){return _0x1a8339!==null&&!_['isUndefined'](_0x1a8339);}function msgResponse(_0x43a0c2,_0x414fbf,_0x1ff97b){return{'action':_0x43a0c2,'response':_0x414fbf,'message':_0x1ff97b,'stack':_0x1ff97b};}function emit(_0x518e58,_0x1bb624,_0x47157b){io['to'](_0x518e58)[_0x30ee('0x40')](_0x1bb624,_0x47157b);}function emitOutboundVoiceQueueSummary(_0x3bb2fc){if(_0x3bb2fc[_0x30ee('0x41')]===_0x30ee('0x42')){logger[_0x30ee('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x30ee('0x44')](_0x3bb2fc,{'showHidden':![],'depth':null}));emit(util['format'](_0x30ee('0x45'),_0x3bb2fc['name']),_0x30ee('0x46'),_0x3bb2fc);}}function checkGetDataPredictive(_0x5f2f3e){if(isNotNull(_0x5f2f3e)&&!_[_0x30ee('0x47')](_0x5f2f3e)){loggerPredictive[_0x30ee('0x48')](_0x30ee('0x49'));loggerPredictive['info'](_0x30ee('0x4a'),_0x5f2f3e[_0x30ee('0x4b')]);loggerPredictive['info'](_0x30ee('0x4c'),_0x5f2f3e[_0x30ee('0x4d')]);loggerPredictive['info'](_0x30ee('0x4e'),_0x5f2f3e[_0x30ee('0x4f')]);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x50'),_0x5f2f3e[_0x30ee('0x51')]);loggerPredictive[_0x30ee('0x48')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f2f3e['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x30ee('0x52'),_0x5f2f3e['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x30ee('0x53'));if(_0x5f2f3e[_0x30ee('0x4b')]>0x0){if(!_[_0x30ee('0x54')](_0x5f2f3e[_0x30ee('0x55')])&&_0x5f2f3e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x30ee('0x48')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x30ee('0x54')](_0x5f2f3e[_0x30ee('0x56')])&&_0x5f2f3e[_0x30ee('0x56')]>0x0){return!![];}loggerPredictive[_0x30ee('0x48')](_0x30ee('0x57'));}else{loggerPredictive[_0x30ee('0x48')](_0x30ee('0x58'));}}else{loggerPredictive[_0x30ee('0x48')](_0x30ee('0x59'));}return![];}function mergeDataErlangB(_0x2ecbb9){return function(_0x391bb7){loggerPredictive[_0x30ee('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x30ee('0x48')](_0x30ee('0x5a'),_0x391bb7[_0x30ee('0x5b')]);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x5c'),_0x391bb7['erlangCallToSecond']);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x5d'),_0x391bb7['erlangAbandonmentRate']);loggerPredictive['info'](_0x30ee('0x5e'),_0x391bb7[_0x30ee('0x5f')]);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x5d'),_0x391bb7[_0x30ee('0x60')]);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x53'));_['merge'](_0x2ecbb9,_0x391bb7);};}function ifInterval(_0x31ffc9,_0xb23745){if(_['isUndefined'](_0xb23745)){return![];}return utils[_0x30ee('0x61')](undefined,_0xb23745)<_0x31ffc9*0x3c;}function clearPredictiveAttributes(_0xae80f4){if(_0xae80f4[_0x30ee('0x27')]){_0xae80f4[_0x30ee('0x27')]=undefined;loggerPredictive[_0x30ee('0x43')](_0xae80f4[_0x30ee('0x62')],'startProgressive\x20value\x20cleared');}if(_0xae80f4[_0x30ee('0x26')]){_0xae80f4[_0x30ee('0x26')]=undefined;loggerPredictive['debug'](_0xae80f4[_0x30ee('0x62')],_0x30ee('0x63'));}if(_0xae80f4['handlePredictive']){clearInterval(_0xae80f4[_0x30ee('0x64')]);_0xae80f4[_0x30ee('0x64')]=undefined;loggerPredictive[_0x30ee('0x43')](_0xae80f4[_0x30ee('0x62')],_0x30ee('0x65'));}}function loggerCatchPredictive(_0x421f42,_0x5a1421){return function(_0x4f054a){loggerPredictive['error'](_0x5a1421[_0x30ee('0x62')],_0x421f42);loggerPredictive['error'](_0x4f054a[_0x30ee('0x66')]);clearPredictiveAttributes(_0x5a1421);};}function loggerCatch(_0x49c7d6){return function(_0x297559){logger[_0x30ee('0x67')](_0x49c7d6,util['inspect'](_0x297559,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x987b42,_0x42ea8e,_0x152b9b){return function(_0x56be38){utils[_0x30ee('0x68')](_0x42ea8e,_0x152b9b,0x0);_0x42ea8e[_0x30ee('0x69')]=0x0;logger[_0x30ee('0x67')](_0x987b42,util[_0x30ee('0x44')](_0x56be38,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b38a4){return function(_0x5630d5){if(isNotNull(_0x5630d5)&&isNotNull(_0x5630d5[0x0])){if(_0x5630d5[0x0][_0x30ee('0x6a')]>0x0){_0x5b38a4[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x6d')];logger['info'](_0x30ee('0x6e')+_0x5b38a4[_0x30ee('0x62')],_0x5630d5[0x0][_0x30ee('0x6a')],_0x30ee('0x6f'));}else{_0x5b38a4[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x70')];logger[_0x30ee('0x48')](_0x30ee('0x71')+_0x5b38a4[_0x30ee('0x62')]);}}};}function createObjHistory(_0x212a16,_0xb5c31c,_0x12267e,_0x53e2e6,_0x3c9b12){_0x212a16[_0x30ee('0x6b')]=_0x12267e;var _0x4ce811=new Action(_0x212a16,_0xb5c31c);var _0x256069=new History(_0x4ce811);_0x256069['state']=_0x53e2e6;_0x256069[_0x30ee('0x72')]=_0x3c9b12;_0x256069[_0x30ee('0x73')]=_0x4ce811[_0x30ee('0x74')];return _0x256069;}function unlockQueueStatus(_0x535280,_0x18014d){setTimeout(function(){if(_[_0x30ee('0x54')](_0x535280['queueStatusComplete'])){loggerBooked[_0x30ee('0x67')]('[unlockQueueStatus][undefined]',_0x18014d);}_0x535280[_0x30ee('0x75')]=!![];loggerBooked[_0x30ee('0x48')](_0x30ee('0x76'),_0x18014d,JSON[_0x30ee('0x77')](_[_0x30ee('0x78')](_0x535280,[_0x30ee('0x62'),_0x30ee('0x75')])));},0x1f3);}function checkInterval(_0x3fc4ee){return function(){if(!isNotNull(_0x3fc4ee[_0x30ee('0x79')])){_0x3fc4ee['message']=utils[_0x30ee('0x6c')][_0x30ee('0x7a')];throw _0x3fc4ee['name']+_0x30ee('0x7b');}if(!isNotNull(_0x3fc4ee['Interval'][_0x30ee('0x7c')])){_0x3fc4ee['message']=utils[_0x30ee('0x6c')][_0x30ee('0x7a')];throw _0x3fc4ee[_0x30ee('0x62')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x30ee('0x47')](_0x3fc4ee[_0x30ee('0x79')][_0x30ee('0x7c')]))){_0x3fc4ee[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x7a')];throw _0x3fc4ee['name']+_0x30ee('0x7b');}};}function checkIsIVRCampaignActive(_0x3dd99b){return function(){if(!utils[_0x30ee('0x7d')](_0x3dd99b)){_0x3dd99b[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x7e')];throw _0x3dd99b[_0x30ee('0x62')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x9bee10){if(utils['isIVRCampaign'](_0x9bee10)){emit(util[_0x30ee('0x7f')](_0x30ee('0x80'),_0x9bee10[_0x30ee('0x62')]),_0x30ee('0x81'),_0x9bee10);}}function loggerCatchQueueSummary(_0x50b109,_0x1d5bc7){return function(_0x2971b5){clearPredictiveAttributes(_0x1d5bc7);emitCampaignSummary(_0x1d5bc7);loggerSyncQueueSummary[_0x30ee('0x43')](_0x50b109,util['inspect'](_0x2971b5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x57c203){if(_0x57c203[_0x30ee('0x82')]){if(_0x57c203['originated']===0x0){_0x57c203['sendMessageOneNotActive']=![];_0x57c203['message']=utils[_0x30ee('0x6c')][_0x30ee('0x7e')];loggerSyncQueueSummary['debug'](_0x30ee('0x83'),_0x57c203[_0x30ee('0x62')],_0x30ee('0x84'));}else{_0x57c203[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x85')];loggerSyncQueueSummary[_0x30ee('0x43')](_0x30ee('0x83'),_0x57c203[_0x30ee('0x62')],_0x30ee('0x86'));}emitCampaignSummary(_0x57c203);}}function myreject(_0x3b6ba3){return function(_0x3246b9){return _0x3b6ba3(msgResponse(_0x30ee('0x87'),_0x30ee('0x88'),JSON[_0x30ee('0x77')](_0x3246b9)));};}Dialer[_0x30ee('0x18')][_0x30ee('0x89')]=function(_0x344be7){return!_['isUndefined'](_0x344be7)&&_0x344be7&&!_[_0x30ee('0x54')](_0x344be7[_0x30ee('0x62')])&&!_['isUndefined'](_0x344be7[_0x30ee('0x8a')])&&_0x344be7[_0x30ee('0x8a')]&&(this[_0x30ee('0x20')][util['format'](_0x30ee('0x8b'),_0x344be7[_0x30ee('0x62')])][_0x30ee('0x8c')]==='reachable'||this[_0x30ee('0x20')][util[_0x30ee('0x7f')](_0x30ee('0x8b'),_0x344be7[_0x30ee('0x62')])]['status']==='unmonitored');};Dialer[_0x30ee('0x18')]['checkIsTrunkReachable']=function(_0x2549f7){var _0x554e28=this;return function(){if(!_0x554e28[_0x30ee('0x89')](_0x2549f7['Trunk'])){if(!_0x554e28[_0x30ee('0x89')](_0x2549f7[_0x30ee('0x8d')])){_0x2549f7[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x8e')];throw _0x2549f7['name']+_0x30ee('0x8f');}}};};Dialer[_0x30ee('0x18')][_0x30ee('0x90')]=function(_0x2cf022,_0x4aef6a,_0xad4e12,_0x1b2fab){var _0x4db532=this;return function(){var _0x2220e6=!![];return _0x4db532[_0x30ee('0x91')](_0x2cf022,_0x4aef6a,_0xad4e12,_0x1b2fab,_0x2220e6);};};Dialer[_0x30ee('0x18')][_0x30ee('0x92')]=function(_0x34b4df,_0xa6024f,_0x4c400a,_0xc012fb){var _0x5cbe7e=this;return function(){var _0x1b1911=![];return _0x5cbe7e['ifTimeIvr'](_0x34b4df[_0x30ee('0x7c')],_0xa6024f,_0x4c400a,_0xc012fb,_0x1b1911);};};Dialer[_0x30ee('0x18')]['ifTimeIvr']=function(_0x3e5717,_0x4aa871,_0x4fd3c8,_0xc598f7,_0x5d7c03){var _0x5b2821=[];return new Promise(function(_0x586410,_0x46aa46){if(!isNotNull(_0x3e5717)){_0xc598f7['message']=utils['CAMPAIGN_STATUS'][_0x30ee('0x7a')];return _0x46aa46(msgResponse('ifTime','Failure',_0x4fd3c8+_0x30ee('0x93')));}if(_[_0x30ee('0x47')](_0x3e5717)){_0xc598f7[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x94')];return _0x46aa46(msgResponse('ifTime',_0x30ee('0x95'),_0x4fd3c8+_0x30ee('0x96')));}if(_0x4aa871&&_[_0x30ee('0x54')](config['timezones'][_0x4aa871])){_0xc598f7[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x97')];return _0x46aa46(msgResponse(_0x30ee('0x98'),_0x30ee('0x95'),_0x4fd3c8+_0x30ee('0x99')+_0x4aa871));}if(_['isArray'](_0x3e5717)){for(var _0x2c0dba=0x0;_0x2c0dba<_0x3e5717['length'];_0x2c0dba+=0x1){_0x5b2821['push'](ami['Action']({'action':_0x30ee('0x9a'),'command':util[_0x30ee('0x7f')](_0x30ee('0x9b'),_0x3e5717[_0x2c0dba][_0x30ee('0x9c')],!_['isUndefined'](config[_0x30ee('0x9d')][_0x4aa871])?_0x4aa871:'')})[_0x30ee('0x3e')](function(_0x5d7077){return _0x5d7077[_0x30ee('0x9e')][_0x30ee('0x9f')](_0x30ee('0xa0'))>=0x0;})[_0x30ee('0xa1')](myreject(_0x46aa46)));}}else{_0x5b2821[_0x30ee('0xa2')](ami[_0x30ee('0xa3')]({'action':_0x30ee('0x9a'),'command':util[_0x30ee('0x7f')](_0x30ee('0x9b'),_0x3e5717,!_[_0x30ee('0x54')](config[_0x30ee('0x9d')][_0x4aa871])?_0x4aa871:'')})[_0x30ee('0x3e')](function(_0x2ba02e){return _0x2ba02e['content'][_0x30ee('0x9f')](_0x30ee('0xa0'))>=0x0;})[_0x30ee('0xa1')](myreject(_0x46aa46)));}Promise[_0x30ee('0xa4')](_0x5b2821)[_0x30ee('0x3e')](function(_0x560b5b){var _0x3809d5=_[_0x30ee('0xa5')](_0x560b5b);if(_0x3809d5){return _0x586410(_0x3809d5);}else{_0xc598f7[_0x30ee('0x6b')]=_0x5d7c03?utils[_0x30ee('0x6c')][_0x30ee('0xa6')]:utils[_0x30ee('0x6c')][_0x30ee('0xa7')];return _0x46aa46(msgResponse(_0x30ee('0xa8'),'Failure','Global:\x20'+_0x5d7c03+'\x20'+_0x4fd3c8+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3e5717,{'showHidden':![],'depth':null})+_0x30ee('0xa9')+_0x4aa871));}})[_0x30ee('0xa1')](function(_0x281614){return _0x46aa46(msgResponse(_0x30ee('0x98'),_0x30ee('0x95'),JSON[_0x30ee('0x77')](_0x281614)));});});};Dialer[_0x30ee('0x18')][_0x30ee('0x3b')]=function(){var _0x2a71d3=this;return cmHopper[_0x30ee('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x30ee('0x3e')](function(){setInterval(function(){_0x2a71d3[_0x30ee('0xab')]();},0x3e8);});};Dialer[_0x30ee('0x18')]['syncCampaigns']=function(){var _0x5ee775=this;var _0x54ee6f;for(var _0x279446 in this[_0x30ee('0x1e')]){if(typeof this['campaigns'][_0x279446]!==_0x30ee('0xac')){_0x54ee6f=this[_0x30ee('0x1e')][_0x279446];if(utils[_0x30ee('0xad')](_0x54ee6f)&&utils[_0x30ee('0x7d')](_0x54ee6f)){_0x54ee6f[_0x30ee('0x82')]=!![];Promise['resolve']()[_0x30ee('0x3e')](checkIsIVRCampaignActive(_0x54ee6f))[_0x30ee('0x3e')](checkInterval(_0x54ee6f))['then'](_0x5ee775['checkIsTrunkReachable'](_0x54ee6f))['then'](_0x5ee775[_0x30ee('0x90')](_0x54ee6f[_0x30ee('0xae')],_0x54ee6f['dialTimezone'],_0x54ee6f[_0x30ee('0x62')],_0x54ee6f))['then'](_0x5ee775[_0x30ee('0x92')](_0x54ee6f[_0x30ee('0x79')],_0x54ee6f['dialTimezone'],_0x54ee6f[_0x30ee('0x62')],_0x54ee6f))[_0x30ee('0x3e')](_0x5ee775[_0x30ee('0xaf')](_0x54ee6f))[_0x30ee('0xa1')](loggerCatchQueueSummary('[syncCampaigns]',_0x54ee6f));}else{notSendMessagesCampaign(_0x54ee6f);}}}};Dialer[_0x30ee('0x18')][_0x30ee('0xb0')]=function(_0x5b8ee5){if(_0x5b8ee5['dialMethod']!==_0x30ee('0xb1')){clearPredictiveAttributes(_0x5b8ee5);}switch(_0x5b8ee5[_0x30ee('0xb2')]){case'progressive':this[_0x30ee('0xb3')](_0x5b8ee5,0x1);break;case _0x30ee('0xb4'):this[_0x30ee('0xb3')](_0x5b8ee5,_0x5b8ee5[_0x30ee('0xb5')]);break;case _0x30ee('0xb1'):this[_0x30ee('0xb1')](_0x5b8ee5);break;case'booked':this[_0x30ee('0xb3')](_0x5b8ee5,0x1);break;default:logger['error'](_0x30ee('0xb6'),_0x5b8ee5[_0x30ee('0x62')],'method\x20not\x20recognized');}};Dialer[_0x30ee('0x18')][_0x30ee('0x98')]=function(_0x55809e,_0x4c31ec){var _0xcda868=_0x55809e[_0x30ee('0xb7')];var _0x320216=_0x4c31ec?_0x55809e[_0x30ee('0xae')]:_0x55809e[_0x30ee('0x79')][_0x30ee('0x7c')];logger[_0x30ee('0xb8')](_0x30ee('0xb9'),_0x320216,_0xcda868,_0x55809e[_0x30ee('0x62')],util[_0x30ee('0x7f')](_0x30ee('0xba'),_0x55809e[_0x30ee('0x62')],_0x55809e['id']));var _0x1d02ba=null;return Interval[_0x30ee('0xbb')](_0x320216,_0xcda868)[_0x30ee('0x3e')](function(_0x23a260){if(_0x23a260===!![]){return _0x23a260;}else{_0x55809e['message']=_0x4c31ec?utils['CAMPAIGN_STATUS'][_0x30ee('0xa6')]:utils[_0x30ee('0x6c')][_0x30ee('0xa7')];_0x1d02ba=msgResponse(_0x30ee('0xa8'),_0x30ee('0x95'),_0x30ee('0xbc')+_0x4c31ec+'\x20'+_0x55809e[_0x30ee('0x62')]+_0x30ee('0xbd')+util[_0x30ee('0x44')](_0x320216,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xcda868);}if(_0x1d02ba!==null){logger['silly'](_0x30ee('0xbe'),_0x1d02ba);_0x1d02ba['isGlobal']=_0x4c31ec;throw _0x1d02ba;}})['catch'](function(_0x48080e){logger[_0x30ee('0x67')](_0x30ee('0xbf'),_0x48080e);throw msgResponse(_0x30ee('0x87'),_0x30ee('0x88'),util[_0x30ee('0x44')](_0x48080e,{'showHidden':![],'depth':null}));});};Dialer[_0x30ee('0x18')][_0x30ee('0x2b')]=function(_0x4a7660){if(this[_0x30ee('0xc0')][_0x4a7660['queue']]){if(this['uniqueId'][_0x4a7660[_0x30ee('0xc1')]]&&this[_0x30ee('0x25')][_0x4a7660[_0x30ee('0xc1')]]['type']!=='ivr'){this['updateOriginated'](this[_0x30ee('0xc0')][_0x4a7660[_0x30ee('0xc2')]]);this[_0x30ee('0x25')][_0x4a7660['uniqueid']][_0x30ee('0xc3')]=moment()['format'](_0x30ee('0xc4'));}}};Dialer[_0x30ee('0x18')][_0x30ee('0x31')]=function(_0x2721b9){var _0x5e7ef8=this[_0x30ee('0x25')][_0x2721b9['uniqueid']];if(this[_0x30ee('0xc0')][_0x2721b9[_0x30ee('0xc2')]]){if(_0x5e7ef8&&_0x5e7ef8[_0x30ee('0x41')]!==_0x30ee('0xc5')){delete this[_0x30ee('0x25')][_0x2721b9[_0x30ee('0xc1')]];this['voiceQueues'][_0x2721b9[_0x30ee('0xc2')]][_0x30ee('0xc6')]+=0x1;var _0x13f6fe=new AgentComplete(_0x5e7ef8,_0x2721b9);if(_0x2721b9[_0x30ee('0xc7')]==='agent'){_0x13f6fe[_0x30ee('0xc8')]=this[_0x30ee('0xc0')][_0x2721b9[_0x30ee('0xc2')]][_0x30ee('0xc9')]&&this['voiceQueues'][_0x2721b9[_0x30ee('0xc2')]][_0x30ee('0xca')]?moment()[_0x30ee('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x30ee('0xcb')](_0x13f6fe)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x13f6fe)['catch'](loggerCatch(_0x30ee('0xcc')));}}};Dialer['prototype'][_0x30ee('0xcd')]=function(_0x352541){var _0x5bc8ad=this[_0x30ee('0x25')][_0x352541[_0x30ee('0xc1')]];var _0x4231da=this;var _0x5a6c64=![];var _0x5d6a92;var _0xdd9bbd;if(this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]]){if(_0x5bc8ad&&_0x5bc8ad[_0x30ee('0x41')]!==_0x30ee('0xc5')){delete this[_0x30ee('0x25')][_0x352541[_0x30ee('0xc1')]];this['updateOriginated'](this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]]);_0x5bc8ad[_0x30ee('0xce')]=moment()[_0x30ee('0x7f')](_0x30ee('0xc4'));var _0x41060d=new QueueCallerAbandon(_0x5bc8ad,_0x352541);if(utils['getSeconds'](_0x5bc8ad[_0x30ee('0xce')],_0x5bc8ad[_0x30ee('0xcf')])>=_0x5bc8ad['dialQueueTimeout']){this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0x4f')]+=0x1;this['voiceQueues'][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xd0')]+=0x1;this['voiceQueues'][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xd1')]+=0x1;_0x41060d[_0x30ee('0xd2')]=0xa;_0x41060d[_0x30ee('0x72')]='Drop';_0x41060d['dropreason']=_0x30ee('0xd3');_0x41060d[_0x30ee('0xc8')]=this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xc9')]?moment()[_0x30ee('0x7f')](_0x30ee('0xc4')):undefined;_0x41060d[_0x30ee('0xd4')]+=0x1;_0x41060d[_0x30ee('0xd5')]+=0x1;_0x5d6a92=this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]]['dialDropRetryFrequency'];_0xdd9bbd=this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x30ee('0xd6')](_0x41060d,_0x41060d[_0x30ee('0xd2')],_0x5bc8ad[_0x30ee('0xd7')])['then'](function(_0xb932d9){_0x5a6c64=_0xb932d9[_0x30ee('0xd8')]==0x1;if(_0x41060d[_0x30ee('0xd4')]>=_0x4231da[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xd9')]){_0x4231da[_0x30ee('0xda')](_0x41060d,_0xb932d9[_0x30ee('0xd8')]);}else{hopperUtils[_0x30ee('0xdb')]({'active':![],'countdropretry':_0x41060d['countdropretry'],'scheduledat':moment()[_0x30ee('0xdc')](_0x4231da[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]]['dialDropRetryFrequency'],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x5bc8ad[_0x30ee('0xde')],'ListId':_0x5bc8ad[_0x30ee('0xdf')],'VoiceQueueId':_0x5bc8ad[_0x30ee('0xe0')]||undefined,'CampaignId':_0x5bc8ad[_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0xe2')));var _0x25fde9=new History(_0x41060d);_0x25fde9[_0x30ee('0xd2')]=0xa;_0x25fde9[_0x30ee('0x72')]=_0x30ee('0xe3');_0x25fde9[_0x30ee('0x74')]=moment()[_0x30ee('0x7f')](_0x30ee('0xc4'));_0x25fde9[_0x30ee('0x73')]=_0x25fde9[_0x30ee('0x74')];_0x25fde9['calleridname']=_0x41060d[_0x30ee('0xe4')];_0x25fde9[_0x30ee('0xe5')]=_0x41060d[_0x30ee('0xe5')];hopperUtils['createHistory'](_0x25fde9)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0xe6')));}})[_0x30ee('0x3e')](function(){if(_0x5a6c64)hopperUtils[_0x30ee('0xe7')](_0x41060d,_0x5d6a92,_0xdd9bbd)[_0x30ee('0x3e')](function(){return 0x1;});});}else{this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0x51')]+=0x1;this['voiceQueues'][_0x352541[_0x30ee('0xc2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x41060d[_0x30ee('0xd2')]=0xb;_0x41060d[_0x30ee('0x72')]=_0x30ee('0xe8');_0x41060d[_0x30ee('0xe9')]=_0x30ee('0xea');_0x41060d[_0x30ee('0xeb')]+=0x1;_0x41060d[_0x30ee('0xd5')]+=0x1;_0x5d6a92=this['voiceQueues'][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xec')];_0xdd9bbd=this[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xed')];hopperUtils[_0x30ee('0xd6')](_0x41060d,_0x41060d[_0x30ee('0xd2')],_0x5bc8ad[_0x30ee('0xd7')])[_0x30ee('0x3e')](function(_0xf99253){if(_0x41060d[_0x30ee('0xeb')]>=_0x4231da[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xee')]){_0x4231da[_0x30ee('0xda')](_0x41060d,_0xf99253[_0x30ee('0xd8')]);}else{hopperUtils[_0x30ee('0xdb')]({'active':![],'countabandonedretry':_0x41060d['countabandonedretry'],'scheduledat':moment()['add'](_0x4231da[_0x30ee('0xc0')][_0x352541[_0x30ee('0xc2')]][_0x30ee('0xec')],_0x30ee('0xdd'))[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x5bc8ad['ContactId'],'ListId':_0x5bc8ad['ListId'],'VoiceQueueId':_0x5bc8ad['VoiceQueueId']||undefined,'CampaignId':_0x5bc8ad['CampaignId']||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0xef')));var _0x51da23=new History(_0x41060d);_0x51da23['state']=0xb;_0x51da23[_0x30ee('0x72')]=_0x30ee('0xe8');_0x51da23[_0x30ee('0x74')]=moment()['format'](_0x30ee('0xc4'));_0x51da23[_0x30ee('0x73')]=_0x51da23[_0x30ee('0x74')];_0x51da23[_0x30ee('0xe4')]=_0x41060d[_0x30ee('0xe4')];_0x51da23['calleridnum']=_0x41060d['calleridnum'];hopperUtils[_0x30ee('0xcb')](_0x51da23)['catch'](loggerCatch(_0x30ee('0xf0')));}})[_0x30ee('0x3e')](function(){if(_0x5a6c64)hopperUtils['swapAdditionalPhones'](_0x41060d,_0x5d6a92,_0xdd9bbd)[_0x30ee('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x30ee('0x18')][_0x30ee('0x37')]=function(_0xfff634){if(this[_0x30ee('0x23')][_0xfff634['uniqueid']]){this['actions'][_0xfff634[_0x30ee('0xc1')]][_0x30ee('0xf1')]=_0xfff634[_0x30ee('0xf1')];}if(this[_0x30ee('0x25')][_0xfff634[_0x30ee('0xc1')]]){this['uniqueId'][_0xfff634[_0x30ee('0xc1')]][_0x30ee('0xf1')]=_0xfff634[_0x30ee('0xf1')];}};Dialer[_0x30ee('0x18')][_0x30ee('0x39')]=function(_0x2202cf){if(!this['actions'][_0x2202cf[_0x30ee('0xf2')]]){return;}var _0x5e50b6=this['voiceQueues'][this[_0x30ee('0x23')][_0x2202cf['actionid']][_0x30ee('0xc2')]][_0x30ee('0xf3')]||'rrmemory';if(_0x5e50b6===_0x30ee('0xf4')){if(this[_0x30ee('0x23')][_0x2202cf['actionid']]&&_['isNil'](this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]][_0x30ee('0xf5')])&&_0x2202cf[_0x30ee('0x8c')]==='1'&&_0x2202cf[_0x30ee('0xf6')]==='0'){if(this[_0x30ee('0x1f')][_0x2202cf[_0x30ee('0xf7')]]){if(!this[_0x30ee('0x1f')][_0x2202cf[_0x30ee('0xf7')]][_0x30ee('0xf5')]){this[_0x30ee('0x1f')][_0x2202cf[_0x30ee('0xf7')]][_0x30ee('0xf5')]=!![];this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]][_0x30ee('0xf5')]=!![];this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]]['stateinterface']=_0x2202cf['stateinterface'];}}}}else if(_0x5e50b6==='rrmemory'){if(this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]]){if(this['agents'][_0x2202cf['stateinterface']]){this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]]['stateinterface']=_0x2202cf[_0x30ee('0xf7')];if(_[_0x30ee('0xf8')](this['queueBooked'][this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]][_0x30ee('0xc2')]])){this[_0x30ee('0xf9')][this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]]['queue']]=[];}this['queueBooked'][this[_0x30ee('0x23')][_0x2202cf['actionid']][_0x30ee('0xc2')]][_0x30ee('0xa2')](_[_0x30ee('0xfa')](_[_0x30ee('0x78')](this[_0x30ee('0x23')][_0x2202cf[_0x30ee('0xf2')]],[_0x30ee('0xfb'),'stateinterface']),{'status':_0x2202cf[_0x30ee('0x8c')],'paused':_0x2202cf[_0x30ee('0xf6')]}));}}}};Dialer[_0x30ee('0x18')][_0x30ee('0xfc')]=function(_0x4b682d){if(!this['actions'][_0x4b682d[_0x30ee('0xf2')]]){return;}var _0x59ba0d=this;var _0x45c42c=this[_0x30ee('0xc0')][this['actions'][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]];var _0x459613=_0x45c42c[_0x30ee('0xf3')]||_0x30ee('0xfd');if(_0x459613===_0x30ee('0xf4')){if(this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]]&&this[_0x30ee('0x23')][_0x4b682d['actionid']][_0x30ee('0xf7')]){this[_0x30ee('0x1d')][_0x30ee('0xfe')](this[_0x30ee('0x23')][_0x4b682d['actionid']][_0x30ee('0xfb')],this['actions'][_0x4b682d[_0x30ee('0xf2')]]['stateinterface'])[_0x30ee('0xa1')](function(_0x70116d){logger[_0x30ee('0x67')](_0x30ee('0xff'),util[_0x30ee('0x44')](_0x70116d,{'showHidden':![],'depth':null}));})[_0x30ee('0x1b')](function(){_0x59ba0d['updateOriginated'](_0x59ba0d[_0x30ee('0xc0')][_0x59ba0d['actions'][_0x4b682d[_0x30ee('0xf2')]]['queue']]);_0x59ba0d['agents'][_0x59ba0d[_0x30ee('0x23')][_0x4b682d['actionid']]['stateinterface']][_0x30ee('0xf5')]=![];delete _0x59ba0d[_0x30ee('0x23')][_0x4b682d['actionid']];unlockQueueStatus(_0x45c42c);});}else{this[_0x30ee('0x100')](this[_0x30ee('0xc0')][this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]]);hopperUtils[_0x30ee('0xdb')]({'active':![],'ContactId':this[_0x30ee('0x23')][_0x4b682d['actionid']][_0x30ee('0xde')],'ListId':this['actions'][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xdf')],'VoiceQueueId':this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x101')));delete this['actions'][_0x4b682d['actionid']];unlockQueueStatus(_0x45c42c);}}else if(_0x459613===_0x30ee('0xfd')){var _0x40f309;if(this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]]&&!_[_0x30ee('0x47')](this[_0x30ee('0xf9')][this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]])){if(this[_0x30ee('0x102')][_0x59ba0d[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]]){this[_0x30ee('0x102')][_0x59ba0d[_0x30ee('0x23')][_0x4b682d['actionid']]['queue']]=this[_0x30ee('0x102')][this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]]['queue']]?this[_0x30ee('0x102')][this['actions'][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]]:this['queueBooked'][this[_0x30ee('0x23')][_0x4b682d[_0x30ee('0xf2')]][_0x30ee('0xc2')]]?this[_0x30ee('0xf9')][this[_0x30ee('0x23')][_0x4b682d['actionid']]['queue']]['_rr']||0x0:0x0;}this[_0x30ee('0xf9')][this['actions'][_0x4b682d['actionid']][_0x30ee('0xc2')]][_0x30ee('0x103')]=this[_0x30ee('0x102')][this[_0x30ee('0x23')][_0x4b682d['actionid']]['queue']];for(var _0x427d56=0x0;_0x427d56=_0x476f34[_0x30ee('0x128')]){_0x376892[_0x30ee('0x129')](_0x5f0442,_0xe51313,_0x3db422,'reason19\x20machine....');}else{if(_0x5f0442['countmachineretry']>=_0x476f34[_0x30ee('0x12a')]){_0x376892['createStateFinal'](_0x5f0442,_0xe51313,_0x3db422,_0x30ee('0x12b'));}else{hopperUtils[_0x30ee('0xdb')]({'active':![],'countmachineretry':_0x5f0442[_0x30ee('0x124')],'scheduledat':moment()['add'](_0x476f34['dialMachineRetryFrequency'],'minutes')[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x5f0442[_0x30ee('0xde')],'ListId':_0x5f0442[_0x30ee('0xdf')],'VoiceQueueId':_0x5f0442[_0x30ee('0xe0')]||undefined,'CampaignId':_0x5f0442['CampaignId']||undefined})['catch'](loggerCatch(_0x30ee('0x12c')));_0xe51313({'reschedule':0x1});}}});}if(_0x3c0d21[_0x30ee('0x41')]==='ivr'&&this[_0x30ee('0x1e')][_0x3c0d21['queue']][_0x30ee('0x122')]&&_0x5b1958[_0x30ee('0x117')]===_0x30ee('0x118')){delete this[_0x30ee('0x25')][_0x5b1958['uniqueid']];this['updateOriginated'](this['campaigns'][_0x3c0d21[_0x30ee('0xc2')]]);_0x157931=new Hangup(_0x3c0d21,_0x5b1958);_0x157931[_0x30ee('0xd2')]=0x12;_0x157931[_0x30ee('0x72')]='HangupInAMD';_0x157931['membername']=_0x30ee('0x11c');ami[_0x30ee('0x40')](_0x30ee('0x12d'),ut[_0x30ee('0x11d')](_0x157931,_0x30ee('0x11e')));this[_0x30ee('0x11f')](_0x157931,_0x30ee('0x12e'),'[syncHangupInAMDIvr]');}if(_0x3c0d21[_0x30ee('0x41')]==='ivr'&&this['campaigns'][_0x3c0d21[_0x30ee('0xc2')]][_0x30ee('0x122')]&&_0x5b1958['value']===_0x30ee('0x12f')){return new Promise(function(_0x14e931,_0x46c470){delete _0x376892[_0x30ee('0x25')][_0x5b1958['uniqueid']];_0x376892[_0x30ee('0x100')](_0x376892[_0x30ee('0x1e')][_0x3c0d21[_0x30ee('0xc2')]]);_0x376892[_0x30ee('0x1e')][_0x3c0d21[_0x30ee('0xc2')]][_0x30ee('0xc6')]+=0x1;_0x376892[_0x30ee('0x1e')][_0x3c0d21[_0x30ee('0xc2')]][_0x30ee('0x119')]+=0x1;var _0x5ef412=_0x376892[_0x30ee('0x1e')][_0x3c0d21[_0x30ee('0xc2')]];var _0x3e694c=new Hangup(_0x3c0d21,_0x5b1958);_0x3e694c[_0x30ee('0xd2')]=0x13;_0x3e694c[_0x30ee('0x72')]=_0x30ee('0x123');_0x3e694c[_0x30ee('0x11b')]='AMD';_0x3e694c[_0x30ee('0x124')]+=0x1;_0x3e694c[_0x30ee('0xd5')]+=0x1;_0x3e694c[_0x30ee('0x11e')]=!![];ami[_0x30ee('0x40')](_0x30ee('0x12d'),ut['buildObj'](_0x3e694c,'amd'));hopperUtils[_0x30ee('0xcb')](_0x3e694c)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x130')));if(_0x3e694c[_0x30ee('0x131')]+_0x3e694c[_0x30ee('0x125')]+_0x3e694c['countnoanswerretry']+_0x3e694c['countnosuchnumberretry']+_0x3e694c[_0x30ee('0xd4')]+_0x3e694c[_0x30ee('0xeb')]+_0x3e694c[_0x30ee('0x124')]+_0x3e694c[_0x30ee('0x127')]>=_0x5ef412['dialGlobalMaxRetry']){_0x376892[_0x30ee('0x129')](_0x3e694c,_0x14e931,_0x46c470,_0x30ee('0x132'));}else{if(_0x3e694c[_0x30ee('0x124')]>=_0x5ef412[_0x30ee('0x12a')]){_0x376892[_0x30ee('0x133')](_0x3e694c,_0x14e931,_0x46c470,_0x30ee('0x12b'));}else{hopperUtils[_0x30ee('0xdb')]({'active':![],'countmachineretry':_0x3e694c[_0x30ee('0x124')],'scheduledat':moment()[_0x30ee('0xdc')](_0x5ef412['dialMachineRetryFrequency'],_0x30ee('0xdd'))[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x3e694c['ContactId'],'ListId':_0x3e694c[_0x30ee('0xdf')],'VoiceQueueId':_0x3e694c[_0x30ee('0xe0')]||undefined,'CampaignId':_0x3e694c[_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x12c')));_0x14e931({'reschedule':0x1});}}});}}};Dialer[_0x30ee('0x18')][_0x30ee('0x35')]=function(_0x256ee8){var _0x2a5e50=this[_0x30ee('0x25')][_0x256ee8['uniqueid']];var _0xf37ab7;if(_0x2a5e50&&_0x2a5e50[_0x30ee('0x41')]===_0x30ee('0xc5')){delete this[_0x30ee('0x25')][_0x256ee8['uniqueid']];this['updateOriginated'](this[_0x30ee('0x1e')][_0x2a5e50[_0x30ee('0xc2')]]);this[_0x30ee('0x1e')][_0x2a5e50[_0x30ee('0xc2')]][_0x30ee('0x134')]+=0x1;_0xf37ab7=new Hangup(_0x2a5e50,_0x256ee8);hopperUtils[_0x30ee('0xcb')](_0xf37ab7)[_0x30ee('0xa1')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xf37ab7)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x135')));}if(_0x2a5e50&&_0x2a5e50[_0x30ee('0x41')]!==_0x30ee('0xc5')&&isNotNull(this[_0x30ee('0xc0')][_0x2a5e50[_0x30ee('0xc2')]][_0x30ee('0x136')])){delete this[_0x30ee('0x25')][_0x256ee8[_0x30ee('0xc1')]];this[_0x30ee('0x100')](this[_0x30ee('0xc0')][_0x2a5e50[_0x30ee('0xc2')]]);this['voiceQueues'][_0x2a5e50[_0x30ee('0xc2')]][_0x30ee('0xc6')]+=0x1;this[_0x30ee('0xc0')][_0x2a5e50['queue']][_0x30ee('0x119')]+=0x1;_0xf37ab7=new Hangup(_0x2a5e50,_0x256ee8);_0xf37ab7[_0x30ee('0xd2')]=0x10;_0xf37ab7[_0x30ee('0x72')]=_0x30ee('0x137');_0xf37ab7[_0x30ee('0x11b')]=_0x30ee('0x138');hopperUtils[_0x30ee('0xcb')](_0xf37ab7)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x139')));hopperUtils[_0x30ee('0x13a')](_0xf37ab7)[_0x30ee('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0x2a5e50&&_0x2a5e50[_0x30ee('0x41')]!==_0x30ee('0xc5')&&!isNotNull(this[_0x30ee('0xc0')][_0x2a5e50['queue']][_0x30ee('0x136')])){if(_0x256ee8[_0x30ee('0x13b')]==='Normal\x20Clearing'){delete this[_0x30ee('0x25')][_0x256ee8[_0x30ee('0xc1')]];this['voiceQueues'][_0x2a5e50[_0x30ee('0xc2')]][_0x30ee('0xc6')]+=0x1;const _0x3a2f95=new AgentComplete(_0x2a5e50,_0x256ee8);_0x3a2f95[_0x30ee('0xe1')]=this[_0x30ee('0xc0')][_0x2a5e50['queue']]['id'];hopperUtils['createHistory'](_0x3a2f95)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x30ee('0x13a')](_0x3a2f95)['catch'](loggerCatch(_0x30ee('0xcc')));}else{delete this[_0x30ee('0x25')][_0x256ee8['uniqueid']];this[_0x30ee('0x100')](this[_0x30ee('0xc0')][_0x2a5e50[_0x30ee('0xc2')]]);this[_0x30ee('0xc0')][_0x2a5e50[_0x30ee('0xc2')]]['outboundUnknownCallsDay']+=0x1;_0xf37ab7=new Hangup(_0x2a5e50,_0x256ee8);_0xf37ab7[_0x30ee('0xd2')]=0xc;_0xf37ab7[_0x30ee('0x72')]=_0x256ee8[_0x30ee('0x13b')];_0xf37ab7[_0x30ee('0x11b')]='Unknow';hopperUtils[_0x30ee('0xcb')](_0xf37ab7)['catch'](loggerCatch(_0x30ee('0x139')));hopperUtils[_0x30ee('0x13a')](_0xf37ab7)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x135')));}}};Dialer[_0x30ee('0x18')]['syncQueueSummary']=function(_0x2a4744){var _0x36e7ad=this;if(!_0x36e7ad[_0x30ee('0x29')][_0x2a4744['name']]){_0x36e7ad[_0x30ee('0x29')][_0x2a4744[_0x30ee('0x62')]]={'running':![]};}else if(_0x36e7ad[_0x30ee('0x29')][_0x2a4744[_0x30ee('0x62')]][_0x30ee('0x13c')]===!![]){return;}else if(_0x36e7ad[_0x30ee('0x29')][_0x2a4744[_0x30ee('0x62')]][_0x30ee('0x13c')]===![]){_0x36e7ad['queuesSummary'][_0x2a4744['name']]['running']=!![];}var _0x5d192f=_0x36e7ad[_0x30ee('0xc0')][_0x2a4744[_0x30ee('0x62')]];var _0x2039cd=_0x5d192f[_0x30ee('0x6b')]!==utils[_0x30ee('0x6c')][_0x30ee('0x7e')];var _0x5ae6af=utils[_0x30ee('0x13d')](_0x5d192f);_0x5d192f[_0x30ee('0x13e')]=utils[_0x30ee('0x13f')](_0x5d192f,_0x36e7ad[_0x30ee('0x20')]);Promise[_0x30ee('0x140')]()[_0x30ee('0x3e')](function(){if(_0x5d192f[_0x30ee('0x13e')]===utils[_0x30ee('0x6c')][_0x30ee('0x7e')]){if(_0x2039cd){clearPredictiveAttributes(_0x5d192f);_0x2a4744[_0x30ee('0x26')]=undefined;_0x2a4744[_0x30ee('0x27')]=undefined;}if(_0x5d192f[_0x30ee('0x13e')]===utils[_0x30ee('0x6c')][_0x30ee('0x7e')]){_0x2a4744['available']=0x0;_0x2a4744[_0x30ee('0xf6')]=0x0;_0x2a4744['inUse']=0x0;_0x2a4744['talking']=0x0;_0x2a4744['pTalking']=0x0;}}else if(_0x5d192f[_0x30ee('0x13e')]===utils[_0x30ee('0x6c')][_0x30ee('0x141')]&&!_0x5ae6af){return _0x36e7ad['ifTime'](_0x5d192f,!![])[_0x30ee('0x3e')](function(){return _0x36e7ad[_0x30ee('0x98')](_0x5d192f,![]);})[_0x30ee('0x3e')](function(){return _0x36e7ad['checkDialMethod'](_0x5d192f);})[_0x30ee('0xa1')](function(_0xc0b151){loggerSyncQueueSummary[_0x30ee('0x43')](_0x30ee('0x142'),util['inspect'](_0xc0b151,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5d192f);});}else{clearPredictiveAttributes(_0x5d192f);}})[_0x30ee('0x3e')](function(){var _0x577502=_0x2a4744[_0x30ee('0x143')](_0x5d192f);if(_0x577502||_0x5d192f[_0x30ee('0x144')]){_0x5d192f[_0x30ee('0x144')]=![];_0x2a4744[_0x30ee('0x145')](_0x5d192f);Object[_0x30ee('0x146')](_0x5d192f,_0x2a4744);emitOutboundVoiceQueueSummary(_0x2a4744);}_0x36e7ad[_0x30ee('0x29')][_0x5d192f['name']][_0x30ee('0x13c')]=![];})[_0x30ee('0xa1')](function(_0x3ab356){logger['error']('[syncQueueSummary]',util[_0x30ee('0x44')](_0x3ab356,{'showHidden':![],'depth':null}));_0x36e7ad[_0x30ee('0x29')][_0x5d192f[_0x30ee('0x62')]][_0x30ee('0x13c')]=![];});};Dialer[_0x30ee('0x18')][_0x30ee('0x33')]=_['throttle'](function(){var _0x3f50c1=_['filter'](this[_0x30ee('0xc0')],function(_0x4d5ac0){return _0x4d5ac0[_0x30ee('0x147')];});var _0x5bb217=_[_0x30ee('0x148')](this[_0x30ee('0x1f')],function(_0x570947){return _0x570947[_0x30ee('0x149')]&&_0x570947[_0x30ee('0x8c')]===_0x30ee('0x14a');});if(_0x3f50c1[_0x30ee('0x104')]>0x0&&_0x5bb217[_0x30ee('0x104')]>0x0){return Promise[_0x30ee('0x140')]()[_0x30ee('0x3e')](cmHopper[_0x30ee('0x14b')](_[_0x30ee('0x14c')](_0x3f50c1,'id'),previewRecallmeReminderInterval,_['map'](_0x5bb217,'id')))[_0x30ee('0x3e')](function(_0x5cd223){for(var _0x1b271b=0x0;_0x1b271b<_0x5cd223[_0x30ee('0x104')];_0x1b271b++){var _0x104c86=_0x5cd223[_0x1b271b][_0x30ee('0x14d')][_0x30ee('0x62')];if(_0x104c86)io['to'](util[_0x30ee('0x7f')]('user:%s',_0x104c86))['emit'](_0x30ee('0x14e'),{'hopper':_0x5cd223[_0x1b271b]});}})[_0x30ee('0xa1')](function(_0x344717){logger[_0x30ee('0x67')](_0x30ee('0x14f'),_0x344717);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x30ee('0x18')][_0x30ee('0x3c')]=function(){var _0x25d8fd=this;setInterval(function(){_0x25d8fd[_0x30ee('0x150')](_0x25d8fd['uniqueId'],'[uniqueid]');_0x25d8fd['clearZombieChannels'](_0x25d8fd['actions'],_0x30ee('0x151'));},0x32c8);};Dialer['prototype'][_0x30ee('0x150')]=function(_0x1bdc46,_0x51c04a){var _0x1e7e6b=this;for(var _0x150f51 in _0x1bdc46){if(typeof _0x1bdc46[_0x150f51]!=='undefined'){this[_0x30ee('0x1c')][_0x30ee('0x19')](function(){if(!_[_0x30ee('0xf8')](_0x1bdc46[_0x150f51])){return ami[_0x30ee('0xa3')]({'action':_0x30ee('0x8c'),'channel':_0x1bdc46[_0x150f51]['channel']})[_0x30ee('0xa1')](function(_0x31db82){if(_0x31db82[_0x30ee('0x6b')]===_0x30ee('0x152')){setTimeout(function(){if(_0x1bdc46[_0x150f51]&&_0x1bdc46[_0x150f51][_0x30ee('0x41')]!=='ivr'){_0x1e7e6b[_0x30ee('0x100')](_0x1e7e6b[_0x30ee('0xc0')][_0x1bdc46[_0x150f51][_0x30ee('0xc2')]]);logger[_0x30ee('0x67')](_0x30ee('0x153'),_0x51c04a,_0x150f51,_0x1bdc46[_0x150f51][_0x30ee('0xc2')]);delete _0x1bdc46[_0x150f51];}if(_0x1bdc46[_0x150f51]&&_0x1bdc46[_0x150f51][_0x30ee('0x41')]===_0x30ee('0xc5')){_0x1e7e6b[_0x30ee('0x100')](_0x1e7e6b['campaigns'][_0x1bdc46[_0x150f51][_0x30ee('0xc2')]]);logger[_0x30ee('0x67')](_0x30ee('0x154'),_0x51c04a,_0x150f51,_0x1bdc46[_0x150f51][_0x30ee('0xc2')]);delete _0x1bdc46[_0x150f51];}},0x2328);}});}});}}};Dialer[_0x30ee('0x18')][_0x30ee('0x155')]=function(_0x544141){return Promise['resolve']()[_0x30ee('0x3e')](voiceQueueRt[_0x30ee('0x155')](_0x544141))[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x156')));};Dialer[_0x30ee('0x18')][_0x30ee('0x100')]=function(_0x3d9b96){if(!_['isUndefined'](_0x3d9b96)&&_0x3d9b96!==null){if(typeof _0x3d9b96[_0x30ee('0x157')]!==_0x30ee('0xac')){if(_0x3d9b96[_0x30ee('0x157')]>0x0){_0x3d9b96[_0x30ee('0x157')]-=0x1;}else{logger[_0x30ee('0x67')](_0x30ee('0x158'));}}}else{logger[_0x30ee('0x67')](_0x30ee('0x159'));}};Dialer[_0x30ee('0x18')]['loggerHandler']=function(_0x7297b5,_0x2cd384){var _0x352c45=this;return function(_0x31394c){_0x352c45[_0x30ee('0x100')](_0x2cd384);logger[_0x30ee('0x67')](_0x7297b5,util[_0x30ee('0x44')](_0x31394c,{'showHidden':![],'depth':null}));};};Dialer[_0x30ee('0x18')][_0x30ee('0x15a')]=function(_0x159628,_0x711e7c,_0x40f15b){var _0x35a0f5={'state':0x19,'statedesc':_0x30ee('0x15b')};this[_0x30ee('0x100')](_0x711e7c);this['saveInDb'](_[_0x30ee('0xfa')](_0x35a0f5,_['pick'](_0x40f15b,[_0x30ee('0xde'),_0x30ee('0xdf'),'UserId',_0x30ee('0xe0'),'CampaignId'])),_0x30ee('0x15c'),'[emptyContact]');logger[_0x30ee('0x67')](_0x159628);};Dialer[_0x30ee('0x18')]['saveInDb']=function(_0x186fb7,_0x364de8,_0x2bde6c){hopperUtils[_0x30ee('0xcb')](_0x186fb7)[_0x30ee('0xa1')](loggerCatch(_0x364de8));hopperUtils[_0x30ee('0x13a')](_0x186fb7)['catch'](loggerCatch(_0x2bde6c));};Dialer['prototype'][_0x30ee('0xda')]=function(_0x2b4ea2,_0x293651){hopperUtils[_0x30ee('0xcb')](_0x2b4ea2)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x15d')));if(_0x293651==0x0){hopperUtils[_0x30ee('0x13a')](_0x2b4ea2)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x15e')));}};Dialer[_0x30ee('0x18')][_0x30ee('0x14f')]=function(_0x4a33cb){return Promise[_0x30ee('0x140')]()[_0x30ee('0x3e')](cmHopper[_0x30ee('0x14b')](_0x4a33cb['id'],previewRecallmeReminderInterval))[_0x30ee('0x3e')](function(_0x19b879){for(var _0x224d81=0x0;_0x224d81<_0x19b879[_0x30ee('0x104')];_0x224d81++){var _0x3e482d=_0x19b879[_0x224d81]['Agent'][_0x30ee('0x62')];if(_0x3e482d)io['to'](util[_0x30ee('0x7f')](_0x30ee('0x15f'),_0x3e482d))[_0x30ee('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x19b879[_0x224d81]});}})[_0x30ee('0xa1')](function(){});};Dialer[_0x30ee('0x18')][_0x30ee('0xaf')]=function(_0x10bde4){var _0x3c7594=this;return function(){_0x3c7594[_0x30ee('0x160')](_0x10bde4);};};Dialer['prototype'][_0x30ee('0x161')]=function(_0x39e1f1,_0x2920c5){var _0x3f37b2=this;var _0x3454c4=uuid['v4']();this[_0x30ee('0x23')][_0x3454c4]=new Action(_0x39e1f1,_0x2920c5,_0x3454c4);return new Promise(function(_0x12c248,_0x3aa04f){if(_[_0x30ee('0x54')](_0x39e1f1)&&typeof _0x39e1f1!==_0x30ee('0x162')){return _0x3aa04f(msgResponse(_0x30ee('0x163'),_0x30ee('0x95'),_0x30ee('0x164')));}if(_['isUndefined'](_0x2920c5[_0x30ee('0x165')])||_0x2920c5['phone']===null){return _0x3aa04f(msgResponse(_0x30ee('0x163'),'Failure','contact\x20is\x20undefine'));}var _0x2d6b5c={'XMD-CALLERID':_0x3f37b2['actions'][_0x3454c4][_0x30ee('0x166')](),'XMD-AGI':_0x39e1f1[_0x30ee('0x136')]?util[_0x30ee('0x7f')](_0x30ee('0x167'),ipAgi,_0x39e1f1['dialQueueProject']):_0x30ee('0x168'),'XMD-AGIAFTER':_0x39e1f1[_0x30ee('0xc9')]?util[_0x30ee('0x7f')](_0x30ee('0x167'),ipAgi,_0x39e1f1[_0x30ee('0xc9')]):_0x30ee('0x168'),'XMD-QUEUE':utils['isOutboundQueue'](_0x39e1f1)?util[_0x30ee('0x7f')](_0x30ee('0x169'),_0x39e1f1[_0x30ee('0x62')],_0x39e1f1[_0x30ee('0x16a')]||'',_0x39e1f1[_0x30ee('0xca')]?'c':'',_0x39e1f1['dialQueueTimeout']||0x3):_0x30ee('0x168'),'XMD-CONTACTID':_0x2920c5[_0x30ee('0xde')],'XMD-CDRTYPE':_0x30ee('0x6'),'CALLERID(all)':_0x3f37b2[_0x30ee('0x23')][_0x3454c4][_0x30ee('0x166')](),'XMD-AMD':_0x39e1f1[_0x30ee('0x122')]?_0x30ee('0x141'):_0x30ee('0x168'),'XMD-DESTINATION':_0x30ee('0x116')};if(_0x39e1f1[_0x30ee('0x122')]){_0x2d6b5c['XMD-AMDINITIALSILENCE']=_0x39e1f1[_0x30ee('0x16b')]||0x9c4;_0x2d6b5c[_0x30ee('0x16c')]=_0x39e1f1[_0x30ee('0x16d')]||0x5dc;_0x2d6b5c[_0x30ee('0x16e')]=_0x39e1f1['dialAMDAfterGreetingSilence']||0x320;_0x2d6b5c[_0x30ee('0x16f')]=_0x39e1f1[_0x30ee('0x170')]||0x1388;_0x2d6b5c['XMD-AMDMINWORDLENGTH']=_0x39e1f1['dialAMDMinWordLength']||0x64;_0x2d6b5c[_0x30ee('0x171')]=_0x39e1f1[_0x30ee('0x172')]||0x32;_0x2d6b5c[_0x30ee('0x173')]=_0x39e1f1[_0x30ee('0x174')]||0x3;_0x2d6b5c[_0x30ee('0x175')]=_0x39e1f1['dialAMDSilenceThreshold']||0x100;_0x2d6b5c[_0x30ee('0x176')]=_0x39e1f1[_0x30ee('0x177')]||0x1388;}if(utils[_0x30ee('0x178')](_0x39e1f1)){_0x2d6b5c[_0x30ee('0x179')]=_0x2920c5[_0x30ee('0xe0')];}else{_0x2d6b5c[_0x30ee('0x17a')]=_0x2920c5[_0x30ee('0xe1')];}var _0x219785=utils['setXMDContactVariables'](_0x2920c5[_0x30ee('0x17b')]);Object[_0x30ee('0x146')](_0x2d6b5c,_0x219785);var _0x50a49a=_0x3f37b2[_0x30ee('0x89')](_0x39e1f1[_0x30ee('0x17c')])?utils[_0x30ee('0x17d')](_0x39e1f1[_0x30ee('0x17c')][_0x30ee('0x17e')],_0x39e1f1[_0x30ee('0x17f')],_0x39e1f1['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x30ee('0x180')](_0x39e1f1[_0x30ee('0x181')],_0x39e1f1[_0x30ee('0x182')]):_0x39e1f1[_0x30ee('0x181')]):utils[_0x30ee('0x17d')](_['isNil'](_0x39e1f1[_0x30ee('0x8d')])?_0x39e1f1[_0x30ee('0x17c')][_0x30ee('0x17e')]:_0x39e1f1[_0x30ee('0x8d')][_0x30ee('0x17e')],_0x39e1f1[_0x30ee('0x17f')],_0x39e1f1[_0x30ee('0x182')]>0x0?utils[_0x30ee('0x180')](_0x39e1f1[_0x30ee('0x181')],_0x39e1f1[_0x30ee('0x182')]):_0x39e1f1[_0x30ee('0x181')]);if(_0x50a49a){_0x2d6b5c[_0x30ee('0x183')]=_0x3f37b2[_0x30ee('0x23')][_0x3454c4][_0x30ee('0x184')]=utils[_0x30ee('0x185')](_0x50a49a);_0x2d6b5c[_0x30ee('0x186')]=_0x2920c5[_0x30ee('0x165')];}_0x39e1f1[_0x30ee('0x187')]=_0x2d6b5c;return ami[_0x30ee('0xa3')]({'actionid':_0x3454c4,'action':'originate','channel':_0x3f37b2['isTrunkReachable'](_0x39e1f1[_0x30ee('0x17c')])?util['format'](_0x30ee('0x188'),_0x39e1f1[_0x30ee('0x17c')][_0x30ee('0x62')],isNotNull(_0x39e1f1[_0x30ee('0x189')])?_0x39e1f1[_0x30ee('0x189')][_0x30ee('0x18a')]()||'':'',_0x39e1f1[_0x30ee('0x18b')]>0x0?_0x2920c5[_0x30ee('0x165')]['substring'](_0x39e1f1[_0x30ee('0x18b')]):_0x2920c5[_0x30ee('0x165')]):util[_0x30ee('0x7f')](_0x30ee('0x188'),_[_0x30ee('0xf8')](_0x39e1f1[_0x30ee('0x8d')])?_0x39e1f1[_0x30ee('0x17c')][_0x30ee('0x62')]:_0x39e1f1['TrunkBackup'][_0x30ee('0x62')],isNotNull(_0x39e1f1[_0x30ee('0x189')])?_0x39e1f1['dialPrefix'][_0x30ee('0x18a')]()||'':'',_0x39e1f1['dialCutDigit']>0x0?_0x2920c5[_0x30ee('0x165')][_0x30ee('0x18c')](_0x39e1f1[_0x30ee('0x18b')]):_0x2920c5[_0x30ee('0x165')]),'callerid':_0x50a49a,'Exten':_0x30ee('0x116'),'Context':_0x30ee('0x18d'),'Priority':'1','variable':_0x2d6b5c,'timeout':(_0x39e1f1[_0x30ee('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3454c4})[_0x30ee('0x3e')](function(_0x2ff005){return _0x12c248(_0x2ff005);})[_0x30ee('0xa1')](function(_0xb023dd){_0x39e1f1['outboundOriginateFailureCallsDay']+=0x1;var _0x14f2bc=new History(_0x3f37b2[_0x30ee('0x23')][_0x3454c4]);logger[_0x30ee('0x67')](util['format']('[originateError]:\x20%s',JSON[_0x30ee('0x77')](_0xb023dd)));_0x14f2bc[_0x30ee('0xd2')]=0xe;_0x14f2bc[_0x30ee('0x72')]=_0x30ee('0x18f');_0x14f2bc[_0x30ee('0x74')]=moment()[_0x30ee('0x7f')](_0x30ee('0xc4'));_0x14f2bc[_0x30ee('0x73')]=_0x14f2bc[_0x30ee('0x74')];hopperUtils[_0x30ee('0xcb')](_0x14f2bc)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x190')));_0x3f37b2[_0x30ee('0x13a')](_0x14f2bc)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x190')))[_0x30ee('0x1b')](function(){delete _0x3f37b2[_0x30ee('0x23')][_0x3454c4];return _0x3aa04f(msgResponse(_0x30ee('0x163'),_0x30ee('0x88'),'originate\x20action\x20Error'));});});});};Dialer[_0x30ee('0x18')][_0x30ee('0x191')]=function(_0x1dbdfc,_0x108edf,_0x45b4de){var _0x513b22=new History(_0x108edf);if(_0x513b22[_0x30ee('0x131')]+_0x513b22['countcongestionretry']+_0x513b22[_0x30ee('0x126')]+_0x513b22[_0x30ee('0x192')]+_0x513b22[_0x30ee('0xd4')]+_0x513b22[_0x30ee('0xeb')]+_0x513b22[_0x30ee('0x124')]+_0x513b22[_0x30ee('0x127')]>=_0x45b4de['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1dbdfc){case 0x3:if(_0x513b22['countnoanswerretry']>=_0x45b4de['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x30ee('0xdb')]({'active':![],'countnoanswerretry':_0x513b22[_0x30ee('0x126')]+=0x1,'scheduledat':moment()[_0x30ee('0xdc')](_0x45b4de['dialNoAnswerRetryFrequency'],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22['ListId'],'VoiceQueueId':_0x513b22['VoiceQueueId']||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0x193')));break;case 0x5:if(_0x513b22[_0x30ee('0x131')]>=_0x45b4de['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x30ee('0xdb')]({'active':![],'countbusyretry':_0x513b22[_0x30ee('0x131')]+=0x1,'scheduledat':moment()['add'](_0x45b4de[_0x30ee('0x194')],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x513b22['ContactId'],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0x195')));break;case 0x8:if(_0x513b22['countcongestionretry']>=_0x45b4de[_0x30ee('0x196')]-0x1){return!![];}hopperUtils[_0x30ee('0xdb')]({'active':![],'countcongestionretry':_0x513b22[_0x30ee('0x125')]+=0x1,'scheduledat':moment()['add'](_0x45b4de[_0x30ee('0x197')],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x198')));break;case 0x0:if(_0x513b22[_0x30ee('0x192')]>=_0x45b4de['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x513b22[_0x30ee('0x192')]+=0x1,'scheduledat':moment()[_0x30ee('0xdc')](_0x45b4de[_0x30ee('0x199')],_0x30ee('0xdd'))[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0x19a')));}break;case 0xa:if(_0x513b22[_0x30ee('0xd4')]>=_0x45b4de[_0x30ee('0xd9')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x513b22[_0x30ee('0xd4')]+=0x1,'scheduledat':moment()[_0x30ee('0xdc')](_0x45b4de['dialDropRetryFrequency'],_0x30ee('0xdd'))[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0xe2')));break;case 0xb:if(_0x513b22[_0x30ee('0xeb')]>=_0x45b4de[_0x30ee('0xee')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x513b22[_0x30ee('0xeb')]+=0x1,'scheduledat':moment()[_0x30ee('0xdc')](_0x45b4de[_0x30ee('0xec')],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22['CampaignId']||undefined})[_0x30ee('0xa1')](loggerCatch(_0x30ee('0xef')));break;case 0x13:if(_0x513b22['countmachineretry']>=_0x45b4de[_0x30ee('0x12a')]-0x1){return!![];}hopperUtils[_0x30ee('0xdb')]({'active':![],'countmachineretry':_0x513b22[_0x30ee('0x124')]+=0x1,'scheduledat':moment()[_0x30ee('0xdc')](_0x45b4de[_0x30ee('0x19b')],_0x30ee('0xdd'))['format'](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x513b22['countagentrejectretry']>=_0x45b4de['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x30ee('0xdb')]({'active':![],'countagentrejectretry':_0x513b22[_0x30ee('0x127')]+=0x1,'scheduledat':moment()['add'](_0x45b4de[_0x30ee('0x19c')],'minutes')[_0x30ee('0x7f')](_0x30ee('0xc4')),'ContactId':_0x513b22[_0x30ee('0xde')],'ListId':_0x513b22[_0x30ee('0xdf')],'VoiceQueueId':_0x513b22[_0x30ee('0xe0')]||undefined,'CampaignId':_0x513b22[_0x30ee('0xe1')]||undefined})[_0x30ee('0xa1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x30ee('0x18')]['callProgressDetecting']=function(_0x2dbf66,_0x2f2be3,_0x4ed26e){var _0x31546e=this;var _0x1d032d=new History(_0x2dbf66);var _0x64359c=![];var _0x307159;var _0x1dacfb;return new Promise(function(_0x105ea3,_0x7da846){if(_[_0x30ee('0x54')](_0x2f2be3)&&typeof _0x2f2be3!==_0x30ee('0x162')){return _0x7da846(msgResponse(_0x30ee('0x19d'),_0x30ee('0x95'),_0x30ee('0x19e')));}if(_[_0x30ee('0x54')](_0x4ed26e)&&typeof _0x4ed26e!==_0x30ee('0x162')){return _0x7da846(msgResponse(_0x30ee('0x19d'),_0x30ee('0x95'),_0x30ee('0x19f')));}hopperUtils['verifyAdditionalPhones'](_0x1d032d,_0x4ed26e[_0x30ee('0xc7')],_0x2f2be3)[_0x30ee('0x3e')](function(_0x180e76){if(_0x180e76[_0x30ee('0xd8')]==0x1)_0x64359c=!![];switch(_0x4ed26e['reason']){case'0':_0x2f2be3['outboundNoSuchCallsDay']+=0x1;_0x1d032d[_0x30ee('0xd2')]=0x0;_0x1d032d['statedesc']=_0x30ee('0x1a0');_0x1d032d[_0x30ee('0x192')]+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;ami[_0x30ee('0x40')](_0x30ee('0x1a1'),ut[_0x30ee('0x11d')](_0x2dbf66,'nosuchnumber'));_0x307159=_0x2f2be3[_0x30ee('0x199')];_0x1dacfb=_0x2f2be3[_0x30ee('0xed')];hopperUtils[_0x30ee('0xcb')](_0x1d032d)[_0x30ee('0xa1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x31546e[_0x30ee('0x191')](0x0,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x192')]>=_0x2f2be3['dialNoSuchNumberMaxRetry']){_0x31546e['createStateFinal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1a2'));}else{_0x31546e['stateGlobal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1a2'));}}break;case'3':_0x2f2be3[_0x30ee('0x1a3')]+=0x1;_0x1d032d['state']=0x3;_0x1d032d[_0x30ee('0x72')]=_0x30ee('0x1a4');_0x1d032d['countnoanswerretry']+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;var _0x559164=ut[_0x30ee('0x1a5')](_0x2dbf66,_0x2f2be3);ami[_0x30ee('0x40')](_0x30ee('0x1a6'),_0x559164);_0x307159=_0x2f2be3['dialNoAnswerRetryFrequency'];_0x1dacfb=_0x2f2be3[_0x30ee('0xed')];hopperUtils[_0x30ee('0xcb')](_0x1d032d)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x1a7')));if(_0x31546e[_0x30ee('0x191')](0x3,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x126')]>=_0x2f2be3['dialNoAnswerMaxRetry']){_0x31546e[_0x30ee('0x133')](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1a8'));}else{_0x31546e[_0x30ee('0x129')](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1a8'));}}break;case'5':_0x2f2be3[_0x30ee('0x1a9')]+=0x1;_0x1d032d['state']=0x5;_0x1d032d[_0x30ee('0x72')]='Busy';_0x1d032d[_0x30ee('0x131')]+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;ami[_0x30ee('0x40')]('custom:agentbusy',ut[_0x30ee('0x11d')](_0x2dbf66,_0x30ee('0x1aa')));_0x307159=_0x2f2be3[_0x30ee('0x194')];_0x1dacfb=_0x2f2be3['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1d032d)[_0x30ee('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x31546e['checkRetriveMax'](0x5,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x131')]>=_0x2f2be3[_0x30ee('0x1ab')]){_0x31546e['createStateFinal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1ac'));}else{_0x31546e[_0x30ee('0x129')](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1ac'));}}break;case'8':_0x2f2be3[_0x30ee('0x1ad')]+=0x1;_0x1d032d[_0x30ee('0xd2')]=0x8;_0x1d032d['statedesc']=_0x30ee('0x1ae');_0x1d032d[_0x30ee('0x125')]+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;_0x307159=_0x2f2be3['dialCongestionRetryFrequency'];_0x1dacfb=_0x2f2be3['callAdditionalPhoneAfterMin'];ami[_0x30ee('0x40')](_0x30ee('0x1af'),ut[_0x30ee('0x11d')](_0x2dbf66,_0x30ee('0x1b0')));hopperUtils[_0x30ee('0xcb')](_0x1d032d)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x1b1')));if(_0x31546e[_0x30ee('0x191')](0x8,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x125')]>=_0x2f2be3[_0x30ee('0x196')]){_0x31546e[_0x30ee('0x133')](_0x1d032d,_0x105ea3,_0x7da846,'reason\x208\x20congestion');}else{_0x31546e['stateGlobal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1b2'));}}break;case'11':_0x2f2be3[_0x30ee('0x1b3')]+=0x1;_0x1d032d['state']=0xb;_0x1d032d[_0x30ee('0x72')]='Abandoned';_0x1d032d[_0x30ee('0xeb')]+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;_0x307159=_0x2f2be3['dialAbandonedRetryFrequency'];_0x1dacfb=_0x2f2be3[_0x30ee('0xed')];hopperUtils['createHistory'](_0x1d032d)[_0x30ee('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x31546e['checkRetriveMax'](0xb,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0xeb')]>=_0x2f2be3[_0x30ee('0xee')]){_0x31546e[_0x30ee('0x133')](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1b4'));}else{_0x31546e['stateGlobal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1b4'));}}break;case'20':_0x2f2be3[_0x30ee('0x1b5')]+=0x1;_0x1d032d[_0x30ee('0xd2')]=0x14;_0x1d032d[_0x30ee('0x72')]=_0x30ee('0x1b6');_0x1d032d['countagentrejectretry']+=0x1;_0x1d032d[_0x30ee('0xd5')]+=0x1;_0x307159=_0x2f2be3[_0x30ee('0x19c')];_0x1dacfb=_0x2f2be3[_0x30ee('0xed')];ami[_0x30ee('0x40')](_0x30ee('0x1b7'),ut['buildObj'](_0x2dbf66,_0x30ee('0x1b8')));hopperUtils[_0x30ee('0xcb')](_0x1d032d)[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x1b9')));if(_0x31546e[_0x30ee('0x191')](0x14,_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x127')]>=_0x2f2be3[_0x30ee('0x1ba')]){_0x31546e['createStateFinal'](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1bb'));}else{_0x31546e[_0x30ee('0x129')](_0x1d032d,_0x105ea3,_0x7da846,_0x30ee('0x1bb'));}}break;default:_0x2f2be3['outboundUnknownCallsDay']+=0x1;_0x1d032d[_0x30ee('0xd2')]=0xc;_0x1d032d['statedesc']=_0x4ed26e[_0x30ee('0xc7')];_0x307159=_0x2f2be3[_0x30ee('0x19c')];_0x1dacfb=_0x2f2be3[_0x30ee('0xed')];hopperUtils[_0x30ee('0xcb')](_0x1d032d)['catch'](loggerCatch(_0x30ee('0x1bc')));if(_0x31546e['checkRetriveMax'](_0x4ed26e[_0x30ee('0xc7')],_0x2dbf66,_0x2f2be3)&&!_0x64359c){if(_0x1d032d[_0x30ee('0x131')]+_0x1d032d[_0x30ee('0x125')]+_0x1d032d['countnoanswerretry']+_0x1d032d['countnosuchnumberretry']+_0x1d032d['countdropretry']+_0x1d032d[_0x30ee('0xeb')]+_0x1d032d[_0x30ee('0x124')]+_0x1d032d[_0x30ee('0x127')]>=_0x2f2be3[_0x30ee('0x128')]){_0x31546e['stateGlobal'](_0x1d032d,_0x105ea3,_0x7da846,_0x4ed26e['reason']);}else{_0x31546e[_0x30ee('0x133')](_0x1d032d,_0x105ea3,_0x7da846,_0x4ed26e[_0x30ee('0xc7')]);}}}})[_0x30ee('0x3e')](function(){if(_0x64359c){hopperUtils[_0x30ee('0xe7')](_0x1d032d,_0x307159,_0x1dacfb)[_0x30ee('0x3e')](function(){return _0x105ea3(0x1);});}});});};Dialer[_0x30ee('0x18')][_0x30ee('0x129')]=function(_0x2d9e54,_0x472294,_0x508e1b,_0x1b8dcd){var _0x4c5cc9=new Final(_0x2d9e54);_0x4c5cc9[_0x30ee('0xd2')]=0xf;_0x4c5cc9['statedesc']=_0x30ee('0x1bd');this[_0x30ee('0x133')](_0x4c5cc9,_0x472294,_0x508e1b,_0x1b8dcd);};Dialer[_0x30ee('0x18')][_0x30ee('0x133')]=function(_0x41134e,_0x4742bb,_0x2ddfd8,_0x135f9c){hopperUtils[_0x30ee('0x13a')](_0x41134e)[_0x30ee('0x3e')](function(){return _0x4742bb(msgResponse('[callProgressDetecting]',_0x30ee('0x111'),_0x135f9c));})[_0x30ee('0xa1')](function(){return _0x2ddfd8(msgResponse('[moveContactManagedDialer][0]',_0x30ee('0x95'),_0x30ee('0x1be')));});};Dialer[_0x30ee('0x18')][_0x30ee('0xb1')]=function(_0x2e6db5){var _0x34790f=_0x2e6db5['dialPredictiveOptimizationPercentage']/0x64;var _0x18eb30=_0x2e6db5['outboundDropCallsDayTimeout']/(_0x2e6db5[_0x30ee('0xd0')]+_0x2e6db5['outboundAnswerCallsDay']);var _0x58dd42=Math[_0x30ee('0x1bf')](_0x2e6db5[_0x30ee('0x1c0')]*(_0x2e6db5[_0x30ee('0x1c1')]/0x64));var _0xae2778=Math[_0x30ee('0x1bf')](_0x2e6db5['predictiveIntervalAvailable']*(_0x2e6db5['predictiveIntervalMinThreshold']/0x64));var _0xc70268=_0x2e6db5[_0x30ee('0x1c2')]+_0x2e6db5['talking'];var _0x11d4ad=Math[_0x30ee('0x1c3')](_0x2e6db5[_0x30ee('0x5b')]*_0x2e6db5[_0x30ee('0x60')]*_0x2e6db5[_0x30ee('0x1c4')]*_0x2e6db5[_0x30ee('0x1c5')]);if(_['isUndefined'](_0x2e6db5[_0x30ee('0x27')])){if(!_[_0x30ee('0x54')](_0x2e6db5['startPredictive'])){_0x2e6db5[_0x30ee('0x26')]=undefined;loggerPredictive[_0x30ee('0x67')](_0x30ee('0x1c6'),_0x30ee('0x1c7'));}if(!_[_0x30ee('0x54')](_0x2e6db5[_0x30ee('0x64')])){loggerPredictive[_0x30ee('0x67')](_0x30ee('0x1c6'),_0x30ee('0x1c8'));clearInterval(_0x2e6db5[_0x30ee('0x64')]);_0x2e6db5['handlePredictive']=undefined;}_0x2e6db5[_0x30ee('0x27')]=moment()['format'](_0x30ee('0xc4'));loggerPredictive[_0x30ee('0x48')](_0x2e6db5[_0x30ee('0x62')],_0x30ee('0x1c9'),_0x2e6db5[_0x30ee('0x27')]);this[_0x30ee('0xb3')](_0x2e6db5,0x1);}else if(ifInterval(_0x2e6db5[_0x30ee('0x1ca')],_0x2e6db5[_0x30ee('0x27')])){this[_0x30ee('0xb3')](_0x2e6db5,0x1);loggerPredictiveCalls['info'](_0x30ee('0x1cb'),_0x2e6db5[_0x30ee('0x27')],_0x2e6db5['name']);_0x2e6db5[_0x30ee('0x5b')]=0x0;_0x2e6db5[_0x30ee('0xd1')]=0x0;}else if(_0x34790f<_0x18eb30&&_0x2e6db5[_0x30ee('0x1cc')]===_0x30ee('0x1cd')){clearPredictiveAttributes(_0x2e6db5);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x1ce'),_0x30ee('0x1cf'),_0x18eb30,_0x30ee('0x27'),_0x2e6db5[_0x30ee('0x62')]);}else if(_0x11d4ad<_0x2e6db5[_0x30ee('0xd1')]&&_0x2e6db5['dialPredictiveOptimization']===_0x30ee('0x1cd')){clearPredictiveAttributes(_0x2e6db5);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x1d0'),'Max\x20Drop\x20',_0x11d4ad,_0x30ee('0x1d1'),_0x2e6db5[_0x30ee('0xd1')],_0x30ee('0x27'),_0x2e6db5[_0x30ee('0x62')]);}else if(!ifInterval(_0x2e6db5[_0x30ee('0x1ca')],_0x2e6db5[_0x30ee('0x27')])&&_['isUndefined'](_0x2e6db5['startPredictive'])&&!_[_0x30ee('0x54')](_0x2e6db5['startProgressive'])){_0x2e6db5[_0x30ee('0x26')]=moment()[_0x30ee('0x7f')](_0x30ee('0xc4'));loggerPredictive[_0x30ee('0x48')](_0x2e6db5[_0x30ee('0x62')],_0x30ee('0x1d2'),_0x2e6db5[_0x30ee('0x26')]);hopperUtils['avgHandleTime'](_0x2e6db5[_0x30ee('0x1ca')])[_0x30ee('0x3e')](this[_0x30ee('0x1d3')](_0x2e6db5))['then'](mergeDataErlangB(_0x2e6db5))['then'](this[_0x30ee('0x1d4')](_0x2e6db5))[_0x30ee('0xa1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2e6db5));}else if(!ifInterval(_0x2e6db5[_0x30ee('0x1ca')],_0x2e6db5[_0x30ee('0x26')])){_0x2e6db5[_0x30ee('0xd1')]=0x0;_0x2e6db5[_0x30ee('0x26')]=moment()[_0x30ee('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x30ee('0x48')](_0x2e6db5['name'],_0x30ee('0x1d5'),_0x2e6db5[_0x30ee('0x26')]);clearInterval(_0x2e6db5['handlePredictive']);_0x2e6db5[_0x30ee('0x64')]=undefined;hopperUtils[_0x30ee('0x1d6')](_0x2e6db5['dialPredictiveInterval'])[_0x30ee('0x3e')](this['getDataPredictive'](_0x2e6db5))[_0x30ee('0x3e')](mergeDataErlangB(_0x2e6db5))[_0x30ee('0x3e')](this[_0x30ee('0x1d4')](_0x2e6db5))[_0x30ee('0xa1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2e6db5));}else if(_0x2e6db5['predictiveIntervalAvailable']&&_0xc70268<_0x2e6db5[_0x30ee('0x1c0')]-_0xae2778){clearPredictiveAttributes(_0x2e6db5);loggerPredictive['info'](_0x2e6db5[_0x30ee('0x62')],_0x30ee('0x1d7'),_0xc70268,')\x20are\x20less\x20than\x20threshold\x20(',_0x2e6db5[_0x30ee('0x1c0')],'-',_0xae2778,'=',_0x2e6db5[_0x30ee('0x1c0')]-_0xae2778,')');}else if(_0x2e6db5[_0x30ee('0x1c0')]&&_0xc70268>_0x2e6db5['predictiveIntervalAvailable']+_0x58dd42){clearPredictiveAttributes(_0x2e6db5);loggerPredictive[_0x30ee('0x48')](_0x2e6db5[_0x30ee('0x62')],_0x30ee('0x1d7'),_0xc70268,')\x20are\x20more\x20than\x20threshold\x20(',_0x2e6db5[_0x30ee('0x1c0')],'+',_0x58dd42,'=',_0x2e6db5['predictiveIntervalAvailable']+_0x58dd42,')');}};Dialer[_0x30ee('0x18')]['getDataPredictive']=function(_0x550b62){var _0x4a71b9=this;return function(_0x631fd7){return new Promise(function(_0x9ca614,_0x32ef83){_[_0x30ee('0xfa')](_0x550b62,_0x631fd7[0x0]);if(checkGetDataPredictive(_0x631fd7[0x0])){var _0x493e2d=_0x550b62['predictiveIntervalAvailable']=_0x550b62[_0x30ee('0x1d8')]+_0x550b62['available'];var _0x1a6314=_0x550b62['dialPredictiveInterval']*0x3c;var _0x291418=_0x631fd7[0x0][_0x30ee('0x55')]+_0x631fd7[0x0][_0x30ee('0x56')];var _0x19a9d6=(_0x631fd7[0x0][_0x30ee('0x4d')]+_0x631fd7[0x0][_0x30ee('0x4f')]+_0x631fd7[0x0][_0x30ee('0x51')])/_0x631fd7[0x0][_0x30ee('0x4b')];_0x550b62['predictiveIntervalHitRate']=_0x19a9d6>0x0?_0x19a9d6:0x1;switch(_0x550b62['dialPredictiveOptimization']){case _0x30ee('0x1cd'):var _0x1dccac=_0x550b62[_0x30ee('0x1d9')]/0x64;return _0x4a71b9[_0x30ee('0x1da')](_0x493e2d,_0x1a6314,_0x291418,_0x19a9d6,_0x1dccac)[_0x30ee('0x3e')](function(_0x3f8bf3){return _0x9ca614(_0x3f8bf3);});case _0x30ee('0x1db'):var _0x19e905=_0x550b62[_0x30ee('0x1d9')]/0x64;return _0x4a71b9[_0x30ee('0x1dc')](_0x493e2d,_0x1a6314,_0x291418,_0x19a9d6,_0x19e905)[_0x30ee('0x3e')](function(_0x455040){return _0x9ca614(_0x455040);});default:return _0x32ef83(msgResponse(_0x30ee('0x1dd'),_0x30ee('0x95'),_0x30ee('0x1de')));}}else{return _0x32ef83(msgResponse('[getDataPredictive]',_0x30ee('0x95'),_0x30ee('0x1df')));}});};};Dialer[_0x30ee('0x18')][_0x30ee('0x1e0')]=function(_0x386ca7){var _0x30cd2e=this;return function(_0x4fcfa5){return new Promise(function(_0x57b8af,_0x4a031b){_[_0x30ee('0xfa')](_0x386ca7,_0x4fcfa5[0x0]);if(checkGetDataPredictive(_0x4fcfa5[0x0])){loggerPredictive[_0x30ee('0x48')](JSON['stringify'](_0x4fcfa5[0x0]));if(_0x386ca7[_0x30ee('0x1cc')]===_0x30ee('0x1cd')){return _0x30cd2e[_0x30ee('0x155')](_0x386ca7['id'])[_0x30ee('0x3e')](function(_0x2413a3){var _0x117ab5=_0x386ca7[_0x30ee('0x1e1')]-_0x2413a3[0x0][_0x30ee('0x1e2')];var _0x197b0c=_0x386ca7['dialPredictiveInterval']*0x3c;var _0x26d8a5=_0x4fcfa5[0x0][_0x30ee('0x55')]+_0x4fcfa5[0x0][_0x30ee('0x56')];var _0x26f694=(_0x4fcfa5[0x0][_0x30ee('0x4d')]+_0x4fcfa5[0x0][_0x30ee('0x4f')]+_0x4fcfa5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4fcfa5[0x0][_0x30ee('0x4b')];var _0x30f758=_0x386ca7[_0x30ee('0x1d9')]/0x64;_0x386ca7[_0x30ee('0x1e3')]=_0x2413a3[0x0][_0x30ee('0x1e2')]||0x0;_0x386ca7[_0x30ee('0x1c4')]=_0x26f694>0x0?_0x26f694:0x1;return _0x30cd2e[_0x30ee('0x1da')](_0x117ab5,_0x197b0c,_0x26d8a5,_0x26f694,_0x30f758);})[_0x30ee('0x3e')](function(_0x5b3000){return _0x57b8af(_0x5b3000);})[_0x30ee('0xa1')](function(_0x4f5ff7){return _0x4a031b(msgResponse('[CatchErlangB]',_0x30ee('0x95'),JSON[_0x30ee('0x77')](_0x4f5ff7)));});}if(_0x386ca7[_0x30ee('0x1cc')]==='agentBusyFactor'){return _0x30cd2e[_0x30ee('0x155')](_0x386ca7['id'])[_0x30ee('0x3e')](function(_0x4630cd){var _0x45ae5e=_0x386ca7[_0x30ee('0x1e1')]-_0x4630cd[0x0]['outboundQueuePauses'];var _0x30a841=_0x386ca7[_0x30ee('0x1ca')]*0x3c;var _0x164805=_0x4fcfa5[0x0][_0x30ee('0x55')]+_0x4fcfa5[0x0][_0x30ee('0x56')];var _0x531550=(_0x4fcfa5[0x0]['predictiveIntervalAnsweredCalls']+_0x4fcfa5[0x0][_0x30ee('0x4f')]+_0x4fcfa5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4fcfa5[0x0][_0x30ee('0x4b')];var _0x288df1=_0x386ca7[_0x30ee('0x1d9')]/0x64;_0x386ca7['predictiveIntervalPauses']=_0x4630cd[0x0][_0x30ee('0x1e2')]||0x0;_0x386ca7[_0x30ee('0x1c4')]=_0x531550>0x0?_0x531550:0x1;return _0x30cd2e[_0x30ee('0x1dc')](_0x45ae5e,_0x30a841,_0x164805,_0x531550,_0x288df1);})[_0x30ee('0x3e')](function(_0x5237bd){return _0x57b8af(_0x5237bd);})[_0x30ee('0xa1')](function(_0x377c8f){return _0x4a031b(msgResponse(_0x30ee('0x1e4'),_0x30ee('0x95'),JSON[_0x30ee('0x77')](_0x377c8f)));});}}else{return _0x4a031b(msgResponse(_0x30ee('0x1dd'),_0x30ee('0x95'),'check\x20failure'));}});};};Dialer[_0x30ee('0x18')][_0x30ee('0x1d4')]=function(_0x52fd6c){var _0x1d4174=this;return function(){var _0x35be1e=0x0;var _0x1e0b72=Math[_0x30ee('0x1c3')](_0x52fd6c[_0x30ee('0x1e5')]*0x3e8);if(_0x1e0b72>0x0){_0x1e0b72=_0x1e0b72<0x64?0x64:_0x1e0b72;loggerPredictive[_0x30ee('0x48')](_0x52fd6c[_0x30ee('0x62')],'one\x20call\x20every:',_0x1e0b72,_0x30ee('0x1e6'));_0x52fd6c[_0x30ee('0x64')]=setInterval(function(){_0x1d4174['handlePredictive'](_0x52fd6c);loggerPredictiveCalls['info'](_0x30ee('0x1e7'),_0x35be1e+=0x1);},_0x1e0b72);}else{loggerPredictive[_0x30ee('0x48')](_0x52fd6c['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x30ee('0x18')][_0x30ee('0x1e8')]=function(_0x1552b4,_0x5a7d5c){var _0x248a2e=this;return function(_0x243d7b){if(_[_0x30ee('0x47')](_0x243d7b)){if(_[_0x30ee('0xf8')](_0x5a7d5c['UserId'])||!_0x5a7d5c['recallme']){if(_0x1552b4[_0x30ee('0xb2')]===_0x30ee('0x1e9')){_0x1552b4[_0x30ee('0x75')]=_[_0x30ee('0x54')](_0x1552b4[_0x30ee('0x75')])?!![]:_0x1552b4[_0x30ee('0x75')];var _0x2ad088=uuid['v4']();_0x248a2e[_0x30ee('0x23')][_0x2ad088]=new Action(_0x1552b4,_0x5a7d5c,_0x2ad088);loggerBooked['info']('[booked][checkContactBlack]',_0x2ad088,_0x30ee('0x1ea'),JSON[_0x30ee('0x77')](_0x1552b4[_0x30ee('0x75')]),_0x30ee('0x1eb'),_0x1552b4[_0x30ee('0x62')]);if(_0x1552b4[_0x30ee('0x75')]){_0x1552b4['queueStatusComplete']=![];_0x248a2e[_0x30ee('0xf9')][_0x248a2e[_0x30ee('0x23')][_0x2ad088][_0x30ee('0xc2')]]=[];ami['Action']({'actionid':_0x2ad088,'action':_0x30ee('0x1ec'),'queue':_0x1552b4['name']})[_0x30ee('0xa1')](function(){_0x248a2e[_0x30ee('0x100')](_0x1552b4);hopperUtils[_0x30ee('0xdb')]({'active':![],'ContactId':_0x248a2e['actions'][_0x2ad088][_0x30ee('0xde')],'ListId':_0x248a2e['actions'][_0x2ad088]['ListId'],'VoiceQueueId':_0x248a2e[_0x30ee('0x23')][_0x2ad088]['VoiceQueueId']||undefined,'CampaignId':_0x248a2e['actions'][_0x2ad088][_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0x1ed')));delete _0x248a2e['actions'][_0x2ad088];});}else{loggerBooked['info'](_0x30ee('0x1ee'),JSON[_0x30ee('0x77')](_0x1552b4[_0x30ee('0x75')]),_0x30ee('0x1eb'),_0x1552b4[_0x30ee('0x62')]);_0x248a2e[_0x30ee('0x100')](_0x1552b4);hopperUtils[_0x30ee('0xdb')]({'active':![],'ContactId':_0x248a2e['actions'][_0x2ad088][_0x30ee('0xde')],'ListId':_0x248a2e[_0x30ee('0x23')][_0x2ad088]['ListId'],'VoiceQueueId':_0x248a2e[_0x30ee('0x23')][_0x2ad088][_0x30ee('0xe0')]||undefined,'CampaignId':_0x248a2e[_0x30ee('0x23')][_0x2ad088][_0x30ee('0xe1')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x248a2e['actions'][_0x2ad088];}}else{return _0x248a2e['actionOriginate'](_0x1552b4,_0x5a7d5c);}}else{if(utils['getSeconds'](undefined,_0x5a7d5c[_0x30ee('0x1ef')])<_0x1552b4[_0x30ee('0x1f0')]*0x3c){if(_0x5a7d5c[_0x30ee('0x14d')]&&!_0x5a7d5c[_0x30ee('0x14d')]['voicePause']){_0x248a2e[_0x30ee('0x1d')][_0x30ee('0xfe')](_0x5a7d5c['id'])[_0x30ee('0x1b')](function(){_0x248a2e[_0x30ee('0x100')](_0x1552b4);});}else{hopperUtils[_0x30ee('0x1f1')]({'active':![]},_0x5a7d5c['id'],0x1)[_0x30ee('0x1b')](function(){_0x248a2e[_0x30ee('0x100')](_0x1552b4);});}}else{_0x1552b4['outboundReCallsDay']+=0x1;_0x248a2e[_0x30ee('0x100')](_0x1552b4);if(_0x1552b4[_0x30ee('0x1f2')]){hopperUtils[_0x30ee('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a7d5c[_0x30ee('0xde')],'ListId':_0x5a7d5c['ListId'],'VoiceQueueId':_0x5a7d5c[_0x30ee('0xe0')]||undefined,'CampaignId':_0x5a7d5c[_0x30ee('0xe1')]||undefined})['catch'](loggerCatch(_0x30ee('0x1f3')));hopperUtils[_0x30ee('0xcb')](createObjHistory(_0x1552b4,_0x5a7d5c,utils[_0x30ee('0x6c')]['QUEUE_RECALL'],0x17,_0x30ee('0x1f4')))['catch'](loggerCatch(_0x30ee('0x1f5')));}else{_0x248a2e['saveInDb'](createObjHistory(_0x1552b4,_0x5a7d5c,utils[_0x30ee('0x6c')][_0x30ee('0x1f6')],0x16,'RecallFailedTimeout'),_0x30ee('0x1f7'),_0x30ee('0x1f8'));}}}}else{_0x1552b4[_0x30ee('0x1f9')]+=0x1;_0x248a2e[_0x30ee('0x11f')](createObjHistory(_0x1552b4,_0x5a7d5c,utils['CAMPAIGN_STATUS'][_0x30ee('0x1fa')],0xd,_0x30ee('0x1fb')),_0x30ee('0x1fc'),_0x30ee('0x1fd'));throw'inBlackList';}};};Dialer[_0x30ee('0x18')][_0x30ee('0x160')]=function(_0x4357c1){var _0x36f6ad=this;var _0x36cdfe=_0x4357c1[_0x30ee('0x1fe')]-_0x4357c1[_0x30ee('0x157')];emitCampaignSummary(_0x4357c1);if(_0x36cdfe>0x0&&_0x4357c1[_0x30ee('0x69')]==0x0){if(_0x36cdfe>this[_0x30ee('0x21')]){_0x36cdfe=this[_0x30ee('0x21')];}_0x4357c1[_0x30ee('0x69')]=0x1;hopperUtils['getContactDialerIvr'](_0x4357c1,_0x36cdfe)[_0x30ee('0x3e')](function(_0x33a9b5){_0x4357c1[_0x30ee('0x69')]=0x0;if(_0x33a9b5){if(!utils['checkContactEmpty'](_0x33a9b5)){_0x4357c1['message']=utils['CAMPAIGN_STATUS'][_0x30ee('0x70')];logger[_0x30ee('0x48')](_0x30ee('0x1ff')+_0x4357c1['name']);}else{_0x4357c1[_0x30ee('0x157')]+=_0x33a9b5[_0x30ee('0x104')];_0x4357c1[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')][_0x30ee('0x200')];for(var _0x12180c=0x0;_0x12180c<_0x33a9b5[_0x30ee('0x104')];_0x12180c+=0x1){_0x4357c1[_0x30ee('0x201')]+=0x1;if(_['isNil'](_0x33a9b5[_0x12180c])||_['isNil'](_0x33a9b5[_0x12180c][_0x30ee('0x17b')])||_['isNil'](_0x33a9b5[_0x12180c][_0x30ee('0x165')])){_0x36f6ad[_0x30ee('0x15a')](_0x30ee('0x202'),_0x4357c1,_0x33a9b5[_0x12180c]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x30ee('0x78')](_0x33a9b5[_0x12180c],[_0x30ee('0xe1'),'phone']))[_0x30ee('0x3e')](_0x36f6ad['checkContactBlack'](_0x4357c1,_0x33a9b5[_0x12180c]))['catch'](_0x36f6ad[_0x30ee('0x203')](_0x30ee('0x204'),_0x4357c1));}}}}})[_0x30ee('0xa1')](loggerGetContactDialer(_0x30ee('0x205'),_0x4357c1,_0x36cdfe));}};Dialer[_0x30ee('0x18')][_0x30ee('0xb3')]=function(_0x24a815,_0x285579){var _0x5bfabd=this;var _0x43077e=[];if(_0x285579<0x1||_0x24a815['dialMethod']===_0x30ee('0x1e9')){_0x285579=0x1;}var _0x4a96a6=Math[_0x30ee('0x1c3')](_0x24a815[_0x30ee('0x1c2')]*_0x285579)-_0x24a815[_0x30ee('0x157')];if(_0x24a815[_0x30ee('0x206')]>0x0){var _0x245713=_0x24a815[_0x30ee('0x206')]-_0x24a815[_0x30ee('0x157')]-_0x24a815[_0x30ee('0x1d8')]-_0x24a815[_0x30ee('0x207')];if(_0x4a96a6>_0x245713){_0x4a96a6=_0x245713;}}if(_0x4a96a6>0x0&&_0x24a815[_0x30ee('0x69')]==0x0){if(_0x24a815[_0x30ee('0xb2')]===_0x30ee('0x1e9')){_0x4a96a6=0x1;}if(_0x4a96a6>this[_0x30ee('0x21')]){_0x4a96a6=this['maxNumberOriginate'];}for(var _0x1939b7 in this[_0x30ee('0x1f')]){if(typeof this[_0x30ee('0x1f')][_0x1939b7]!=='undefined'){if(this[_0x30ee('0x1f')][_0x1939b7][_0x30ee('0xd2')]===_0x30ee('0x208')&&this[_0x30ee('0x1f')][_0x1939b7][_0x30ee('0x8c')]===_0x30ee('0x14a')){_0x43077e['push'](this['agents'][_0x1939b7]['id']);}}}_0x24a815[_0x30ee('0x69')]=0x1;hopperUtils['getContactDialer'](_0x24a815,_0x43077e,_0x4a96a6)['then'](function(_0xf501ac){_0x24a815[_0x30ee('0x69')]=0x0;if(_0xf501ac){if(!utils['checkContactEmpty'](_0xf501ac)){hopperUtils[_0x30ee('0x209')](_0x24a815)[_0x30ee('0x3e')](sendMessageReschedule(_0x24a815))[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x20a')));}else{_0x24a815['originated']+=_0xf501ac[_0x30ee('0x104')];_0x24a815[_0x30ee('0x6b')]=_0x24a815[_0x30ee('0xb2')]===_0x30ee('0x1e9')?utils[_0x30ee('0x6c')][_0x30ee('0x141')]:utils[_0x30ee('0x6c')][_0x30ee('0x200')];for(var _0x2f4d55=0x0;_0x2f4d55<_0xf501ac[_0x30ee('0x104')];_0x2f4d55+=0x1){if(_[_0x30ee('0xf8')](_0xf501ac[_0x2f4d55])||_[_0x30ee('0xf8')](_0xf501ac[_0x2f4d55][_0x30ee('0x17b')])||_[_0x30ee('0xf8')](_0xf501ac[_0x2f4d55]['phone'])){_0x5bfabd[_0x30ee('0x15a')](_0x30ee('0x202'),_0x24a815,_0xf501ac[_0x2f4d55]);}else{hopperUtils[_0x30ee('0x20b')](_[_0x30ee('0x78')](_0xf501ac[_0x2f4d55],[_0x30ee('0xe0'),_0x30ee('0x165')]))[_0x30ee('0x3e')](_0x5bfabd[_0x30ee('0x1e8')](_0x24a815,_0xf501ac[_0x2f4d55]))[_0x30ee('0xa1')](_0x5bfabd[_0x30ee('0x203')](_0x30ee('0x202'),_0x24a815));}}}}})[_0x30ee('0xa1')](loggerGetContactDialer('[getContactDialer2]',_0x24a815,_0x4a96a6));}};Dialer[_0x30ee('0x18')]['handlePredictive']=function(_0x5c0ce8){if(_0x5c0ce8[_0x30ee('0x206')]>0x0){var _0x1f1285=_0x5c0ce8[_0x30ee('0x206')]-_0x5c0ce8[_0x30ee('0x157')]-_0x5c0ce8['talking'];if(_0x1f1285>0x0&&_0x5c0ce8[_0x30ee('0x69')]==0x0){this[_0x30ee('0x20c')](_0x5c0ce8);}else{loggerPredictiveCalls[_0x30ee('0x48')]('[handlePredictive][limitChannel]');}}else{this[_0x30ee('0x20c')](_0x5c0ce8);}};Dialer[_0x30ee('0x18')][_0x30ee('0x20c')]=function(_0x29e22b){var _0x497fd8=this;var _0x11ed6f=[];_0x29e22b[_0x30ee('0x157')]+=0x1;for(var _0x1ef6a6 in this[_0x30ee('0x1f')]){if(typeof this[_0x30ee('0x1f')][_0x1ef6a6]!=='undefined'){if(this[_0x30ee('0x1f')][_0x1ef6a6][_0x30ee('0xd2')]===_0x30ee('0x208')&&this[_0x30ee('0x1f')][_0x1ef6a6][_0x30ee('0x8c')]==='reachable'){_0x11ed6f[_0x30ee('0xa2')](this[_0x30ee('0x1f')][_0x1ef6a6]['id']);}}}_0x29e22b[_0x30ee('0x69')]=0x1;return this[_0x30ee('0x20d')](_0x29e22b['id'],_0x11ed6f,0x1,_0x29e22b[_0x30ee('0x20e')],_0x29e22b)['then'](function(_0x4bbba6){_0x29e22b[_0x30ee('0x69')]=0x1;if(_0x4bbba6){if(!utils[_0x30ee('0x20f')](_0x4bbba6)){utils[_0x30ee('0x68')](_0x29e22b,0x1,0x0);return hopperUtils['countReScheduled'](_0x29e22b)[_0x30ee('0x3e')](sendMessageReschedule(_0x29e22b))[_0x30ee('0xa1')](loggerCatch(_0x30ee('0x20a')));}else{_0x29e22b[_0x30ee('0x6b')]=utils[_0x30ee('0x6c')]['RUNNING'];if(_[_0x30ee('0xf8')](_0x4bbba6[0x0])||_['isNil'](_0x4bbba6[0x0][_0x30ee('0x17b')])||_['isNil'](_0x4bbba6[0x0][_0x30ee('0x165')])){_0x497fd8['emptyContact'](_0x30ee('0x202'),_0x29e22b,_0x4bbba6[0x0]);}else{return hopperUtils[_0x30ee('0x20b')](_[_0x30ee('0x78')](_0x4bbba6[0x0],[_0x30ee('0xe0'),_0x30ee('0x165')]))[_0x30ee('0x3e')](_0x497fd8[_0x30ee('0x1e8')](_0x29e22b,_0x4bbba6[0x0]))[_0x30ee('0xa1')](_0x497fd8['loggerHandler']('[actionOriginatePredictive]\x20',_0x29e22b));}}}})['catch'](loggerGetContactDialer(_0x30ee('0x210'),_0x29e22b,0x1));};Dialer[_0x30ee('0x18')]['abandonmentRate']=function(_0x58df88,_0x35f70d,_0xe8137b,_0x36c700,_0x11b7c3,_0x5508a3){loggerPredictive['info'](_0x30ee('0x211'));loggerPredictive[_0x30ee('0x48')](_0x30ee('0x212'),_0x58df88);loggerPredictive['info'](_0x30ee('0x213'),_0x35f70d);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x214'),_0xe8137b);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36c700);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x215'),_0x11b7c3);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x53'));return new Promise(function(_0x206193,_0x1ef0f9){if(_0x58df88<=0x0||isNaN(_0x58df88)){return _0x1ef0f9(msgResponse(_0x30ee('0x216'),_0x30ee('0x88'),_0x30ee('0x217')+_0x58df88));}if(_0xe8137b<=0x0||isNaN(_0xe8137b)){return _0x1ef0f9(msgResponse('[abandonmentRate]',_0x30ee('0x88'),'Ts\x20=\x20'+_0xe8137b));}if(_0x36c700<=0x0||isNaN(_0x36c700)){return _0x1ef0f9(msgResponse(_0x30ee('0x216'),_0x30ee('0x88'),_0x30ee('0x218')+_0x36c700));}if(_0x35f70d<=0x0||isNaN(_0x35f70d)){return _0x1ef0f9(msgResponse(_0x30ee('0x216'),_0x30ee('0x88'),_0x30ee('0x219')+_0x35f70d));}if(_0x11b7c3<=0x0||isNaN(_0x11b7c3)){return _0x1ef0f9(msgResponse(_0x30ee('0x216'),_0x30ee('0x88'),_0x30ee('0x21a')+_0x11b7c3));}_0x5508a3=_0x5508a3||0x0;var _0x37d8fa=0x1/_0xe8137b;var _0x3cf173=0x0;var _0x3e188c=0x0;var _0x1606eb=0x0;var _0x1d4d6e=0x0;for(var _0x1af5ac=0x0;_0x1606eb<_0x11b7c3;_0x1af5ac+=0x1){_0x3e188c=_0x1af5ac/_0x35f70d;_0x3cf173=(_0x36c700*_0x3e188c+_0x5508a3)/_0x37d8fa;_0x1606eb=utils['erlangb'](_0x3cf173,_0x58df88);_0x1d4d6e=_0x3cf173/_0x58df88*(0x1-utils['erlangb'](_0x3cf173,_0x58df88));}return _0x206193({'erlangCalls':_0x1af5ac,'erlangCallToSecond':_0x35f70d/_0x1af5ac,'erlangAbandonmentRate':_0x1606eb,'erlangBusyFactor':_0x1d4d6e});});};Dialer['prototype'][_0x30ee('0x1dc')]=function(_0x315a6b,_0x5cdb29,_0x292717,_0xeab091,_0x3080e6,_0x180ef3){loggerPredictive['info'](_0x30ee('0x21b'));loggerPredictive['info'](_0x30ee('0x212'),_0x315a6b);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x213'),_0x5cdb29);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',_0x292717);loggerPredictive[_0x30ee('0x48')](_0x30ee('0x21c'),_0xeab091);loggerPredictive['info'](_0x30ee('0x21d'),_0x3080e6);loggerPredictive['info'](_0x30ee('0x53'));return new Promise(function(_0xa69c78,_0x3776f9){if(_0x315a6b<=0x0||isNaN(_0x315a6b)){return _0x3776f9(msgResponse(_0x30ee('0x21e'),_0x30ee('0x88'),'m\x20=\x20'+_0x315a6b));}if(_0x292717<=0x0||isNaN(_0x292717)){return _0x3776f9(msgResponse(_0x30ee('0x21e'),_0x30ee('0x88'),_0x30ee('0x21f')+_0x292717));}if(_0xeab091<=0x0||isNaN(_0xeab091)){return _0x3776f9(msgResponse(_0x30ee('0x21e'),_0x30ee('0x88'),'p\x20=\x20'+_0xeab091));}if(_0x5cdb29<=0x0||isNaN(_0x5cdb29)){return _0x3776f9(msgResponse(_0x30ee('0x21e'),_0x30ee('0x88'),_0x30ee('0x219')+_0x5cdb29));}if(_0x3080e6<=0x0||isNaN(_0x3080e6)){return _0x3776f9(msgResponse('[busyFactor]','Error',_0x30ee('0x220')+_0x3080e6));}_0x180ef3=_0x180ef3||0x0;var _0x24f8eb=0x1/_0x292717;var _0x296269=0x0;var _0x1bd040=0x0;var _0xe141e1=0x0;var _0x58f974=0x0;for(var _0x4a5c1d=0x0;_0x58f974<_0x3080e6;_0x4a5c1d+=0x1){_0x1bd040=_0x4a5c1d/_0x5cdb29;_0x296269=(_0xeab091*_0x1bd040+_0x180ef3)/_0x24f8eb;_0xe141e1=utils[_0x30ee('0x221')](_0x296269,_0x315a6b);_0x58f974=_0x296269/_0x315a6b*(0x1-utils['erlangb'](_0x296269,_0x315a6b));}return _0xa69c78({'erlangCalls':_0x4a5c1d,'erlangCallToSecond':_0x5cdb29/_0x4a5c1d,'erlangAbandonmentRate':_0xe141e1,'erlangBusyFactor':_0x58f974});});};module['exports']=Dialer; \ No newline at end of file +var _0xe351=['dialPowerLevel','predictive','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncNewExten','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countabandonedretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HangupInAMD','MACHINE','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','loggerHandler','emptyContact','notFound','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','Agent','user:%s','user:dialPreviewRecallReminder','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','NONE','getCaller','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','talking','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','check\x20failure','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','undefined','not_inuse','countReScheduled','[countReScheduled]\x20','Contact','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','env','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','command','interval','content','true','catch','indexOf','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','stringify','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower'];(function(_0x15e735,_0x1f18ea){var _0x270ce1=function(_0x36bb87){while(--_0x36bb87){_0x15e735['push'](_0x15e735['shift']());}};_0x270ce1(++_0x1f18ea);}(_0xe351,0x165));var _0x1e35=function(_0x522128,_0x3a4911){_0x522128=_0x522128-0x0;var _0x2f8416=_0xe351[_0x522128];return _0x2f8416;};'use strict';var util=require(_0x1e35('0x0'));var _=require('lodash');var uuid=require(_0x1e35('0x1'));var moment=require(_0x1e35('0x2'));var rr=require('rr');var Redis=require(_0x1e35('0x3'));var utils=require(_0x1e35('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x1e35('0x5'));var config=require(_0x1e35('0x6'));var logger=require(_0x1e35('0x7'))(_0x1e35('0x8'));var loggerBooked=require('../../../config/logger')(_0x1e35('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x1e35('0x7'))(_0x1e35('0xa'));var loggerSyncQueueSummary=require(_0x1e35('0x7'))(_0x1e35('0xb'));var ami=require('../ami');config[_0x1e35('0xc')]=_[_0x1e35('0xd')](config[_0x1e35('0xc')],{'host':_0x1e35('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1e35('0xc')]));var cmHopper=require(_0x1e35('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x1e35('0x10'));var Interval=require(_0x1e35('0x11'));var Action=require(_0x1e35('0x12'));var History=require(_0x1e35('0x13'));var Final=require(_0x1e35('0x14'));var AgentComplete=require(_0x1e35('0x15'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0x1e35('0x16')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1e35('0x17')]['enqueue']=function(_0x328e30){this[_0x1e35('0x18')]=this[_0x1e35('0x18')]?this['tail'][_0x1e35('0x19')](_0x328e30):_0x328e30();};function Dialer(_0x22437f,_0x532dc8){this[_0x1e35('0x1a')]=new Sequence();this[_0x1e35('0x1b')]=_0x532dc8;this[_0x1e35('0x1c')]=_0x22437f['voiceQueues'];this[_0x1e35('0x1d')]=_0x22437f[_0x1e35('0x1d')];this[_0x1e35('0x1e')]=_0x22437f[_0x1e35('0x1e')];this['trunks']=_0x22437f[_0x1e35('0x1f')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x1e35('0x20')]={};this[_0x1e35('0x21')]={};this[_0x1e35('0x22')]={};this[_0x1e35('0x23')]={};this[_0x1e35('0x24')]={};this[_0x1e35('0x25')]={};this[_0x1e35('0x26')]={};this[_0x1e35('0x27')]={};this[_0x1e35('0x28')]={};this[_0x1e35('0x29')]={};this['queuesSummary']={};ami['on'](_0x1e35('0x2a'),this[_0x1e35('0x2b')][_0x1e35('0x2c')](this));ami['on']('queuecallerabandon',this[_0x1e35('0x2d')][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x2e'),this[_0x1e35('0x2f')][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x30'),this[_0x1e35('0x31')][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x32'),this[_0x1e35('0xb')]['bind'](this));ami['on'](_0x1e35('0x33'),this['syncQueueSummaryComplete'][_0x1e35('0x2c')](this));ami['on']('hangup',this[_0x1e35('0x34')]['bind'](this));ami['on'](_0x1e35('0x35'),this['syncNewExten'][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x36'),this[_0x1e35('0x37')][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x38'),this[_0x1e35('0x39')][_0x1e35('0x2c')](this));ami['on'](_0x1e35('0x3a'),this[_0x1e35('0x3b')][_0x1e35('0x2c')](this));this[_0x1e35('0x3c')]();this[_0x1e35('0x3d')]();RpcSetting[_0x1e35('0x3e')]()[_0x1e35('0x3f')](function(_0x262cb0){previewRecallmeReminderInterval=_0x262cb0[_0x1e35('0x40')];});}function isNotNull(_0x31a223){return _0x31a223!==null&&!_[_0x1e35('0x41')](_0x31a223);}function msgResponse(_0x34afef,_0x33a889,_0x2d2b1f){return{'action':_0x34afef,'response':_0x33a889,'message':_0x2d2b1f,'stack':_0x2d2b1f};}function emit(_0x30698c,_0x2e2159,_0x41eba8){io['to'](_0x30698c)[_0x1e35('0x42')](_0x2e2159,_0x41eba8);}function emitOutboundVoiceQueueSummary(_0x14d39f){if(_0x14d39f[_0x1e35('0x43')]==='outbound'){logger[_0x1e35('0x44')](_0x1e35('0x45'),util['inspect'](_0x14d39f,{'showHidden':![],'depth':null}));emit(util[_0x1e35('0x46')](_0x1e35('0x47'),_0x14d39f[_0x1e35('0x48')]),_0x1e35('0x49'),_0x14d39f);}}function checkGetDataPredictive(_0x530276){if(isNotNull(_0x530276)&&!_[_0x1e35('0x4a')](_0x530276)){loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x4c'));loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x4d'),_0x530276['predictiveIntervalTotalCalls']);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x4e'),_0x530276[_0x1e35('0x4f')]);loggerPredictive['info'](_0x1e35('0x50'),_0x530276[_0x1e35('0x51')]);loggerPredictive[_0x1e35('0x4b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x530276['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x52'),_0x530276['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x1e35('0x4b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x530276[_0x1e35('0x53')]);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x54'));if(_0x530276['predictiveIntervalTotalCalls']>0x0){if(!_[_0x1e35('0x41')](_0x530276[_0x1e35('0x53')])&&_0x530276[_0x1e35('0x53')]>0x0){return!![];}loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x55'));if(!_[_0x1e35('0x41')](_0x530276['predictiveIntervalAvgHoldtime'])&&_0x530276[_0x1e35('0x56')]>0x0){return!![];}loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x57'));}else{loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x58'));}}else{loggerPredictive[_0x1e35('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x55c438){return function(_0x426268){loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x59'));loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x5a'),_0x426268[_0x1e35('0x5b')]);loggerPredictive[_0x1e35('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426268[_0x1e35('0x5c')]);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x5d'),_0x426268[_0x1e35('0x5e')]);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x5f'),_0x426268[_0x1e35('0x60')]);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x5d'),_0x426268[_0x1e35('0x5e')]);loggerPredictive['info'](_0x1e35('0x54'));_[_0x1e35('0x61')](_0x55c438,_0x426268);};}function ifInterval(_0x2ced7b,_0x3f5108){if(_[_0x1e35('0x41')](_0x3f5108)){return![];}return utils['getSeconds'](undefined,_0x3f5108)<_0x2ced7b*0x3c;}function clearPredictiveAttributes(_0x4a476d){if(_0x4a476d[_0x1e35('0x26')]){_0x4a476d['startProgressive']=undefined;loggerPredictive['debug'](_0x4a476d[_0x1e35('0x48')],'startProgressive\x20value\x20cleared');}if(_0x4a476d['startPredictive']){_0x4a476d['startPredictive']=undefined;loggerPredictive[_0x1e35('0x44')](_0x4a476d['name'],'startPredictive\x20value\x20cleared');}if(_0x4a476d[_0x1e35('0x62')]){clearInterval(_0x4a476d[_0x1e35('0x62')]);_0x4a476d['handlePredictive']=undefined;loggerPredictive[_0x1e35('0x44')](_0x4a476d[_0x1e35('0x48')],_0x1e35('0x63'));}}function loggerCatchPredictive(_0x3a1a63,_0x5a072b){return function(_0x2e68d1){loggerPredictive[_0x1e35('0x64')](_0x5a072b['name'],_0x3a1a63);loggerPredictive[_0x1e35('0x64')](_0x2e68d1[_0x1e35('0x65')]);clearPredictiveAttributes(_0x5a072b);};}function loggerCatch(_0x123b78){return function(_0x4677c0){logger[_0x1e35('0x64')](_0x123b78,util[_0x1e35('0x66')](_0x4677c0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3632ff,_0x4d0792,_0xf56dcd){return function(_0x3d0cb0){utils[_0x1e35('0x67')](_0x4d0792,_0xf56dcd,0x0);_0x4d0792['temp']=0x0;logger['error'](_0x3632ff,util[_0x1e35('0x66')](_0x3d0cb0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x364475){return function(_0x42a903){if(isNotNull(_0x42a903)&&isNotNull(_0x42a903[0x0])){if(_0x42a903[0x0][_0x1e35('0x68')]>0x0){_0x364475['message']=utils[_0x1e35('0x69')][_0x1e35('0x6a')];logger[_0x1e35('0x4b')](_0x1e35('0x6b')+_0x364475[_0x1e35('0x48')],_0x42a903[0x0][_0x1e35('0x68')],'contacts');}else{_0x364475[_0x1e35('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e35('0x6d')];logger[_0x1e35('0x4b')](_0x1e35('0x6e')+_0x364475['name']);}}};}function createObjHistory(_0x403c0a,_0x1c7c79,_0x17e8b7,_0x2cb13d,_0x4e3cba){_0x403c0a[_0x1e35('0x6c')]=_0x17e8b7;var _0xdff37=new Action(_0x403c0a,_0x1c7c79);var _0x506ce5=new History(_0xdff37);_0x506ce5[_0x1e35('0x6f')]=_0x2cb13d;_0x506ce5[_0x1e35('0x70')]=_0x4e3cba;_0x506ce5['endtime']=_0xdff37[_0x1e35('0x71')];return _0x506ce5;}function unlockQueueStatus(_0x2d4e65,_0x45b8a8){setTimeout(function(){if(_[_0x1e35('0x41')](_0x2d4e65[_0x1e35('0x72')])){loggerBooked[_0x1e35('0x64')](_0x1e35('0x73'),_0x45b8a8);}_0x2d4e65[_0x1e35('0x72')]=!![];loggerBooked[_0x1e35('0x4b')](_0x1e35('0x74'),_0x45b8a8,JSON['stringify'](_[_0x1e35('0x75')](_0x2d4e65,[_0x1e35('0x48'),_0x1e35('0x72')])));},0x1f3);}function checkInterval(_0x423700){return function(){if(!isNotNull(_0x423700['Interval'])){_0x423700[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x76')];throw _0x423700[_0x1e35('0x48')]+_0x1e35('0x77');}if(!isNotNull(_0x423700[_0x1e35('0x78')][_0x1e35('0x79')])){_0x423700[_0x1e35('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e35('0x76')];throw _0x423700[_0x1e35('0x48')]+_0x1e35('0x77');}if(!isNotNull(_['isEmpty'](_0x423700[_0x1e35('0x78')]['Intervals']))){_0x423700[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x76')];throw _0x423700[_0x1e35('0x48')]+_0x1e35('0x77');}};}function checkIsIVRCampaignActive(_0x4bac1c){return function(){if(!utils['isIVRCampaignActive'](_0x4bac1c)){_0x4bac1c[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x7a')];throw _0x4bac1c[_0x1e35('0x48')]+_0x1e35('0x7b');}};}function emitCampaignSummary(_0x37ddec){if(utils[_0x1e35('0x7c')](_0x37ddec)){emit(util['format'](_0x1e35('0x7d'),_0x37ddec[_0x1e35('0x48')]),'campaign:save',_0x37ddec);}}function loggerCatchQueueSummary(_0x4a8654,_0x4e234a){return function(_0x3aa871){clearPredictiveAttributes(_0x4e234a);emitCampaignSummary(_0x4e234a);loggerSyncQueueSummary[_0x1e35('0x44')](_0x4a8654,util[_0x1e35('0x66')](_0x3aa871,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1dc458){if(_0x1dc458[_0x1e35('0x7e')]){if(_0x1dc458[_0x1e35('0x7f')]===0x0){_0x1dc458[_0x1e35('0x7e')]=![];_0x1dc458[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x7a')];loggerSyncQueueSummary['debug'](_0x1e35('0x80'),_0x1dc458[_0x1e35('0x48')],'is\x20not\x20active');}else{_0x1dc458[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x81')];loggerSyncQueueSummary[_0x1e35('0x44')](_0x1e35('0x80'),_0x1dc458[_0x1e35('0x48')],_0x1e35('0x82'));}emitCampaignSummary(_0x1dc458);}}function myreject(_0x4a607c){return function(_0x1d9655){return _0x4a607c(msgResponse('[ifTime][Action]',_0x1e35('0x83'),JSON['stringify'](_0x1d9655)));};}Dialer[_0x1e35('0x17')][_0x1e35('0x84')]=function(_0x56823d){return!_['isUndefined'](_0x56823d)&&_0x56823d&&!_[_0x1e35('0x41')](_0x56823d[_0x1e35('0x48')])&&!_[_0x1e35('0x41')](_0x56823d[_0x1e35('0x85')])&&_0x56823d[_0x1e35('0x85')]&&(this[_0x1e35('0x1f')][util[_0x1e35('0x46')](_0x1e35('0x86'),_0x56823d['name'])][_0x1e35('0x87')]===_0x1e35('0x88')||this[_0x1e35('0x1f')][util[_0x1e35('0x46')](_0x1e35('0x86'),_0x56823d[_0x1e35('0x48')])][_0x1e35('0x87')]===_0x1e35('0x89'));};Dialer[_0x1e35('0x17')]['checkIsTrunkReachable']=function(_0x4bc41f){var _0xbb3c5=this;return function(){if(!_0xbb3c5[_0x1e35('0x84')](_0x4bc41f[_0x1e35('0x8a')])){if(!_0xbb3c5[_0x1e35('0x84')](_0x4bc41f['TrunkBackup'])){_0x4bc41f[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x8b')];throw _0x4bc41f[_0x1e35('0x48')]+_0x1e35('0x8c');}}};};Dialer[_0x1e35('0x17')][_0x1e35('0x8d')]=function(_0x39e12d,_0x182fa8,_0x172097,_0x55b6ab){var _0xc56a42=this;return function(){var _0x5edc4e=!![];return _0xc56a42[_0x1e35('0x8e')](_0x39e12d,_0x182fa8,_0x172097,_0x55b6ab,_0x5edc4e);};};Dialer[_0x1e35('0x17')]['checkIfTimeIntervals']=function(_0x56eb86,_0x773c37,_0x269f98,_0x4a9a02){var _0x56936b=this;return function(){var _0x52766d=![];return _0x56936b[_0x1e35('0x8e')](_0x56eb86[_0x1e35('0x79')],_0x773c37,_0x269f98,_0x4a9a02,_0x52766d);};};Dialer[_0x1e35('0x17')][_0x1e35('0x8e')]=function(_0x7694e0,_0xf4a6e2,_0x1639bd,_0x46504c,_0x1d0085){var _0x378a49=[];return new Promise(function(_0x3c9664,_0x3396d5){if(!isNotNull(_0x7694e0)){_0x46504c[_0x1e35('0x6c')]=utils[_0x1e35('0x69')][_0x1e35('0x76')];return _0x3396d5(msgResponse(_0x1e35('0x8f'),_0x1e35('0x90'),_0x1639bd+_0x1e35('0x91')));}if(_[_0x1e35('0x4a')](_0x7694e0)){_0x46504c['message']=utils[_0x1e35('0x69')][_0x1e35('0x92')];return _0x3396d5(msgResponse('ifTime',_0x1e35('0x90'),_0x1639bd+_0x1e35('0x93')));}if(_0xf4a6e2&&_[_0x1e35('0x41')](config[_0x1e35('0x94')][_0xf4a6e2])){_0x46504c['message']=utils['CAMPAIGN_STATUS'][_0x1e35('0x95')];return _0x3396d5(msgResponse(_0x1e35('0x8f'),_0x1e35('0x90'),_0x1639bd+_0x1e35('0x96')+_0xf4a6e2));}if(_['isArray'](_0x7694e0)){for(var _0x4cef12=0x0;_0x4cef12<_0x7694e0[_0x1e35('0x97')];_0x4cef12+=0x1){_0x378a49[_0x1e35('0x98')](ami['Action']({'action':_0x1e35('0x99'),'command':util[_0x1e35('0x46')]('iftime\x20%s,%s',_0x7694e0[_0x4cef12][_0x1e35('0x9a')],!_['isUndefined'](config[_0x1e35('0x94')][_0xf4a6e2])?_0xf4a6e2:'')})[_0x1e35('0x3f')](function(_0xf6f6f9){return _0xf6f6f9[_0x1e35('0x9b')]['indexOf'](_0x1e35('0x9c'))>=0x0;})[_0x1e35('0x9d')](myreject(_0x3396d5)));}}else{_0x378a49[_0x1e35('0x98')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x7694e0,!_[_0x1e35('0x41')](config[_0x1e35('0x94')][_0xf4a6e2])?_0xf4a6e2:'')})[_0x1e35('0x3f')](function(_0x54c1f5){return _0x54c1f5[_0x1e35('0x9b')][_0x1e35('0x9e')](_0x1e35('0x9c'))>=0x0;})[_0x1e35('0x9d')](myreject(_0x3396d5)));}Promise[_0x1e35('0x9f')](_0x378a49)[_0x1e35('0x3f')](function(_0x14574e){var _0x41920f=_['some'](_0x14574e);if(_0x41920f){return _0x3c9664(_0x41920f);}else{_0x46504c[_0x1e35('0x6c')]=_0x1d0085?utils[_0x1e35('0x69')][_0x1e35('0xa0')]:utils[_0x1e35('0x69')][_0x1e35('0xa1')];return _0x3396d5(msgResponse('[ifTime][promiseAll]',_0x1e35('0x90'),'Global:\x20'+_0x1d0085+'\x20'+_0x1639bd+_0x1e35('0xa2')+util[_0x1e35('0x66')](_0x7694e0,{'showHidden':![],'depth':null})+_0x1e35('0xa3')+_0xf4a6e2));}})[_0x1e35('0x9d')](function(_0x1f639d){return _0x3396d5(msgResponse(_0x1e35('0x8f'),'Failure',JSON[_0x1e35('0xa4')](_0x1f639d)));});});};Dialer[_0x1e35('0x17')][_0x1e35('0x3c')]=function(){var _0x408247=this;return cmHopper[_0x1e35('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x1e35('0x3f')](function(){setInterval(function(){_0x408247['syncCampaigns']();},0x3e8);});};Dialer[_0x1e35('0x17')][_0x1e35('0xa6')]=function(){var _0x37d5be=this;var _0x552ec6;for(var _0x232e1e in this[_0x1e35('0x1d')]){if(typeof this[_0x1e35('0x1d')][_0x232e1e]!=='undefined'){_0x552ec6=this[_0x1e35('0x1d')][_0x232e1e];if(utils[_0x1e35('0x7c')](_0x552ec6)&&utils[_0x1e35('0xa7')](_0x552ec6)){_0x552ec6[_0x1e35('0x7e')]=!![];Promise[_0x1e35('0xa8')]()['then'](checkIsIVRCampaignActive(_0x552ec6))[_0x1e35('0x3f')](checkInterval(_0x552ec6))[_0x1e35('0x3f')](_0x37d5be[_0x1e35('0xa9')](_0x552ec6))[_0x1e35('0x3f')](_0x37d5be[_0x1e35('0x8d')](_0x552ec6[_0x1e35('0xaa')],_0x552ec6[_0x1e35('0xab')],_0x552ec6['name'],_0x552ec6))[_0x1e35('0x3f')](_0x37d5be[_0x1e35('0xac')](_0x552ec6['Interval'],_0x552ec6[_0x1e35('0xab')],_0x552ec6[_0x1e35('0x48')],_0x552ec6))[_0x1e35('0x3f')](_0x37d5be[_0x1e35('0xad')](_0x552ec6))[_0x1e35('0x9d')](loggerCatchQueueSummary(_0x1e35('0xae'),_0x552ec6));}else{notSendMessagesCampaign(_0x552ec6);}}}};Dialer['prototype'][_0x1e35('0xaf')]=function(_0xf69491){if(_0xf69491['dialMethod']!=='predictive'){clearPredictiveAttributes(_0xf69491);}switch(_0xf69491[_0x1e35('0xb0')]){case'progressive':this['handlePower'](_0xf69491,0x1);break;case _0x1e35('0xb1'):this[_0x1e35('0xb2')](_0xf69491,_0xf69491[_0x1e35('0xb3')]);break;case'predictive':this[_0x1e35('0xb4')](_0xf69491);break;case'booked':this[_0x1e35('0xb2')](_0xf69491,0x1);break;default:logger[_0x1e35('0x64')](_0x1e35('0xb5'),_0xf69491[_0x1e35('0x48')],_0x1e35('0xb6'));}};Dialer[_0x1e35('0x17')][_0x1e35('0x8f')]=function(_0x587807,_0x22fc4e){var _0x24103b=_0x587807[_0x1e35('0xab')];var _0x6b3a44=_0x22fc4e?_0x587807[_0x1e35('0xaa')]:_0x587807['Interval'][_0x1e35('0x79')];logger[_0x1e35('0xb7')]('Dialer::ifTime()',_0x6b3a44,_0x24103b,_0x587807[_0x1e35('0x48')],util[_0x1e35('0x46')](_0x1e35('0xb8'),_0x587807['name'],_0x587807['id']));var _0x401f95=null;return Interval[_0x1e35('0xb9')](_0x6b3a44,_0x24103b)[_0x1e35('0x3f')](function(_0x2d75dc){if(_0x2d75dc===!![]){return _0x2d75dc;}else{_0x587807[_0x1e35('0x6c')]=_0x22fc4e?utils[_0x1e35('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1e35('0x69')][_0x1e35('0xa1')];_0x401f95=msgResponse('[ifTime][promiseAll]','Failure',_0x1e35('0xba')+_0x22fc4e+'\x20'+_0x587807['name']+_0x1e35('0xa2')+util[_0x1e35('0x66')](_0x6b3a44,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x24103b);}if(_0x401f95!==null){logger[_0x1e35('0xb7')](_0x1e35('0xbb'),_0x401f95);_0x401f95[_0x1e35('0xbc')]=_0x22fc4e;throw _0x401f95;}})[_0x1e35('0x9d')](function(_0x54948b){logger[_0x1e35('0x64')](_0x1e35('0xbd'),_0x54948b);throw msgResponse('[ifTime][Action]','Error',util['inspect'](_0x54948b,{'showHidden':![],'depth':null}));});};Dialer[_0x1e35('0x17')]['syncAgentConnect']=function(_0x245014){if(this['voiceQueues'][_0x245014[_0x1e35('0xbe')]]){if(this[_0x1e35('0x23')][_0x245014[_0x1e35('0xbf')]]&&this['uniqueId'][_0x245014['uniqueid']]['type']!==_0x1e35('0xc0')){this[_0x1e35('0xc1')](this[_0x1e35('0x1c')][_0x245014[_0x1e35('0xbe')]]);this[_0x1e35('0x23')][_0x245014[_0x1e35('0xbf')]][_0x1e35('0xc2')]=moment()[_0x1e35('0x46')](_0x1e35('0xc3'));}}};Dialer[_0x1e35('0x17')][_0x1e35('0x31')]=function(_0x1a1d07){var _0x488c23=this[_0x1e35('0x23')][_0x1a1d07[_0x1e35('0xbf')]];if(this['voiceQueues'][_0x1a1d07[_0x1e35('0xbe')]]){if(_0x488c23&&_0x488c23['type']!==_0x1e35('0xc0')){delete this['uniqueId'][_0x1a1d07['uniqueid']];this[_0x1e35('0x1c')][_0x1a1d07[_0x1e35('0xbe')]][_0x1e35('0xc4')]+=0x1;var _0x113b6f=new AgentComplete(_0x488c23,_0x1a1d07);if(_0x1a1d07[_0x1e35('0xc5')]===_0x1e35('0xc6')){_0x113b6f['agiafterat']=this[_0x1e35('0x1c')][_0x1a1d07[_0x1e35('0xbe')]][_0x1e35('0xc7')]&&this[_0x1e35('0x1c')][_0x1a1d07[_0x1e35('0xbe')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x1e35('0xc3')):undefined;}hopperUtils[_0x1e35('0xc8')](_0x113b6f)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xc9')));hopperUtils[_0x1e35('0xca')](_0x113b6f)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xcb')));}}};Dialer[_0x1e35('0x17')][_0x1e35('0x2d')]=function(_0x8e8e15){var _0xcbeaa7=this[_0x1e35('0x23')][_0x8e8e15[_0x1e35('0xbf')]];var _0x58e418=this;var _0x1402a5=![];var _0x318362;var _0x5b46e3;if(this['voiceQueues'][_0x8e8e15[_0x1e35('0xbe')]]){if(_0xcbeaa7&&_0xcbeaa7[_0x1e35('0x43')]!==_0x1e35('0xc0')){delete this[_0x1e35('0x23')][_0x8e8e15[_0x1e35('0xbf')]];this[_0x1e35('0xc1')](this[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]]);_0xcbeaa7['droptime']=moment()['format'](_0x1e35('0xc3'));var _0xc5aced=new QueueCallerAbandon(_0xcbeaa7,_0x8e8e15);if(utils[_0x1e35('0xcc')](_0xcbeaa7['droptime'],_0xcbeaa7[_0x1e35('0xcd')])>=_0xcbeaa7[_0x1e35('0xce')]){this[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0x51')]+=0x1;this['voiceQueues'][_0x8e8e15['queue']][_0x1e35('0xcf')]+=0x1;this[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0xd0')]+=0x1;_0xc5aced[_0x1e35('0x6f')]=0xa;_0xc5aced[_0x1e35('0x70')]=_0x1e35('0xd1');_0xc5aced[_0x1e35('0xd2')]=_0x1e35('0xd3');_0xc5aced[_0x1e35('0xd4')]=this[_0x1e35('0x1c')][_0x8e8e15['queue']][_0x1e35('0xc7')]?moment()['format'](_0x1e35('0xc3')):undefined;_0xc5aced[_0x1e35('0xd5')]+=0x1;_0xc5aced['countglobal']+=0x1;_0x318362=this['voiceQueues'][_0x8e8e15[_0x1e35('0xbe')]]['dialDropRetryFrequency'];_0x5b46e3=this[_0x1e35('0x1c')][_0x8e8e15['queue']][_0x1e35('0xd6')];hopperUtils[_0x1e35('0xd7')](_0xc5aced,_0xc5aced[_0x1e35('0x6f')],_0xcbeaa7[_0x1e35('0xd8')])['then'](function(_0x3b64ad){_0x1402a5=_0x3b64ad[_0x1e35('0xd9')]==0x1;if(_0xc5aced[_0x1e35('0xd5')]>=_0x58e418[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0xda')]){_0x58e418[_0x1e35('0xdb')](_0xc5aced,_0x3b64ad['additional']);}else{hopperUtils[_0x1e35('0xdc')]({'active':![],'countdropretry':_0xc5aced[_0x1e35('0xd5')],'scheduledat':moment()[_0x1e35('0xdd')](_0x58e418[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0xde')],'minutes')[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0xcbeaa7[_0x1e35('0xdf')],'ListId':_0xcbeaa7[_0x1e35('0xe0')],'VoiceQueueId':_0xcbeaa7[_0x1e35('0xe1')]||undefined,'CampaignId':_0xcbeaa7[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xe3')));var _0x5347fd=new History(_0xc5aced);_0x5347fd[_0x1e35('0x6f')]=0xa;_0x5347fd[_0x1e35('0x70')]=_0x1e35('0xd1');_0x5347fd[_0x1e35('0x71')]=moment()[_0x1e35('0x46')](_0x1e35('0xc3'));_0x5347fd[_0x1e35('0xe4')]=_0x5347fd[_0x1e35('0x71')];_0x5347fd[_0x1e35('0xe5')]=_0xc5aced[_0x1e35('0xe5')];_0x5347fd['calleridnum']=_0xc5aced[_0x1e35('0xe6')];hopperUtils[_0x1e35('0xc8')](_0x5347fd)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xe7')));}})[_0x1e35('0x3f')](function(){if(_0x1402a5)hopperUtils[_0x1e35('0xe8')](_0xc5aced,_0x318362,_0x5b46e3)['then'](function(){return 0x1;});});}else{this[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0xe9')]+=0x1;this[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0xc5aced[_0x1e35('0x6f')]=0xb;_0xc5aced[_0x1e35('0x70')]='Abandoned';_0xc5aced['dropreason']=_0x1e35('0xea');_0xc5aced['countabandonedretry']+=0x1;_0xc5aced[_0x1e35('0xeb')]+=0x1;_0x318362=this[_0x1e35('0x1c')][_0x8e8e15['queue']][_0x1e35('0xec')];_0x5b46e3=this['voiceQueues'][_0x8e8e15['queue']][_0x1e35('0xd6')];hopperUtils[_0x1e35('0xd7')](_0xc5aced,_0xc5aced['state'],_0xcbeaa7[_0x1e35('0xd8')])[_0x1e35('0x3f')](function(_0x5a90ba){if(_0xc5aced['countabandonedretry']>=_0x58e418[_0x1e35('0x1c')][_0x8e8e15['queue']][_0x1e35('0xed')]){_0x58e418[_0x1e35('0xdb')](_0xc5aced,_0x5a90ba['additional']);}else{hopperUtils[_0x1e35('0xdc')]({'active':![],'countabandonedretry':_0xc5aced['countabandonedretry'],'scheduledat':moment()[_0x1e35('0xdd')](_0x58e418[_0x1e35('0x1c')][_0x8e8e15[_0x1e35('0xbe')]][_0x1e35('0xec')],'minutes')[_0x1e35('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcbeaa7[_0x1e35('0xdf')],'ListId':_0xcbeaa7[_0x1e35('0xe0')],'VoiceQueueId':_0xcbeaa7[_0x1e35('0xe1')]||undefined,'CampaignId':_0xcbeaa7[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xee')));var _0x3bef2c=new History(_0xc5aced);_0x3bef2c[_0x1e35('0x6f')]=0xb;_0x3bef2c[_0x1e35('0x70')]='Abandoned';_0x3bef2c[_0x1e35('0x71')]=moment()[_0x1e35('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bef2c['endtime']=_0x3bef2c[_0x1e35('0x71')];_0x3bef2c['calleridname']=_0xc5aced['calleridname'];_0x3bef2c[_0x1e35('0xe6')]=_0xc5aced[_0x1e35('0xe6')];hopperUtils[_0x1e35('0xc8')](_0x3bef2c)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x1402a5)hopperUtils[_0x1e35('0xe8')](_0xc5aced,_0x318362,_0x5b46e3)[_0x1e35('0x3f')](function(){return 0x1;});});}}}};Dialer[_0x1e35('0x17')][_0x1e35('0xef')]=function(_0x3eba71){if(this[_0x1e35('0x21')][_0x3eba71['uniqueid']]){this[_0x1e35('0x21')][_0x3eba71[_0x1e35('0xbf')]][_0x1e35('0xf0')]=_0x3eba71[_0x1e35('0xf0')];}if(this[_0x1e35('0x23')][_0x3eba71[_0x1e35('0xbf')]]){this[_0x1e35('0x23')][_0x3eba71['uniqueid']][_0x1e35('0xf0')]=_0x3eba71[_0x1e35('0xf0')];}};Dialer[_0x1e35('0x17')][_0x1e35('0x39')]=function(_0x25e58e){if(!this['actions'][_0x25e58e['actionid']]){return;}var _0xab3ac9=this[_0x1e35('0x1c')][this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]]['queue']][_0x1e35('0xf2')]||_0x1e35('0xf3');if(_0xab3ac9==='roundrobin'){if(this[_0x1e35('0x21')][_0x25e58e['actionid']]&&_[_0x1e35('0xf4')](this['actions'][_0x25e58e[_0x1e35('0xf1')]][_0x1e35('0xf5')])&&_0x25e58e[_0x1e35('0x87')]==='1'&&_0x25e58e[_0x1e35('0xf6')]==='0'){if(this[_0x1e35('0x1e')][_0x25e58e[_0x1e35('0xf7')]]){if(!this[_0x1e35('0x1e')][_0x25e58e[_0x1e35('0xf7')]]['locked']){this[_0x1e35('0x1e')][_0x25e58e[_0x1e35('0xf7')]][_0x1e35('0xf5')]=!![];this['actions'][_0x25e58e['actionid']][_0x1e35('0xf5')]=!![];this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]][_0x1e35('0xf7')]=_0x25e58e[_0x1e35('0xf7')];}}}}else if(_0xab3ac9===_0x1e35('0xf3')){if(this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]]){if(this[_0x1e35('0x1e')][_0x25e58e['stateinterface']]){this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]][_0x1e35('0xf7')]=_0x25e58e[_0x1e35('0xf7')];if(_['isNil'](this[_0x1e35('0x28')][this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]]['queue']])){this[_0x1e35('0x28')][this['actions'][_0x25e58e[_0x1e35('0xf1')]][_0x1e35('0xbe')]]=[];}this[_0x1e35('0x28')][this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]][_0x1e35('0xbe')]][_0x1e35('0x98')](_[_0x1e35('0x61')](_[_0x1e35('0x75')](this[_0x1e35('0x21')][_0x25e58e[_0x1e35('0xf1')]],[_0x1e35('0xf8'),_0x1e35('0xf7')]),{'status':_0x25e58e[_0x1e35('0x87')],'paused':_0x25e58e[_0x1e35('0xf6')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x3cfa4b){if(!this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]]){return;}var _0x335970=this;var _0x56b144=this[_0x1e35('0x1c')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]];var _0x17a765=_0x56b144['strategy']||_0x1e35('0xf3');if(_0x17a765==='roundrobin'){if(this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]]&&this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xf7')]){this['preview'][_0x1e35('0xf9')](this['actions'][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xf8')],this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]]['stateinterface'])[_0x1e35('0x9d')](function(_0x321cba){logger[_0x1e35('0x64')](_0x1e35('0xfa'),util[_0x1e35('0x66')](_0x321cba,{'showHidden':![],'depth':null}));})['finally'](function(){_0x335970[_0x1e35('0xc1')](_0x335970[_0x1e35('0x1c')][_0x335970[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]]);_0x335970['agents'][_0x335970[_0x1e35('0x21')][_0x3cfa4b['actionid']]['stateinterface']][_0x1e35('0xf5')]=![];delete _0x335970[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]];unlockQueueStatus(_0x56b144);});}else{this[_0x1e35('0xc1')](this[_0x1e35('0x1c')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]]);hopperUtils[_0x1e35('0xdc')]({'active':![],'ContactId':this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xdf')],'ListId':this[_0x1e35('0x21')][_0x3cfa4b['actionid']][_0x1e35('0xe0')],'VoiceQueueId':this['actions'][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xe1')]||undefined,'CampaignId':this['actions'][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xfb')));delete this['actions'][_0x3cfa4b[_0x1e35('0xf1')]];unlockQueueStatus(_0x56b144);}}else if(_0x17a765===_0x1e35('0xf3')){var _0xdbc000;if(this[_0x1e35('0x21')][_0x3cfa4b['actionid']]&&!_['isEmpty'](this[_0x1e35('0x28')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]])){if(this[_0x1e35('0x29')][_0x335970[_0x1e35('0x21')][_0x3cfa4b['actionid']]['queue']]){this[_0x1e35('0x29')][_0x335970[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]]['queue']]=this[_0x1e35('0x29')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]]?this[_0x1e35('0x29')][this[_0x1e35('0x21')][_0x3cfa4b['actionid']][_0x1e35('0xbe')]]:this[_0x1e35('0x28')][this[_0x1e35('0x21')][_0x3cfa4b['actionid']][_0x1e35('0xbe')]]?this[_0x1e35('0x28')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]][_0x1e35('0xbe')]][_0x1e35('0xfc')]||0x0:0x0;}this[_0x1e35('0x28')][this['actions'][_0x3cfa4b[_0x1e35('0xf1')]]['queue']][_0x1e35('0xfc')]=this[_0x1e35('0x29')][this[_0x1e35('0x21')][_0x3cfa4b[_0x1e35('0xf1')]]['queue']];for(var _0xe7cce2=0x0;_0xe7cce2=_0x4c745d['dialGlobalMaxRetry']){_0x40eaa6['stateGlobal'](_0x29df62,_0x25905b,_0x49b00a,_0x1e35('0x11c'));}else{if(_0x29df62[_0x1e35('0x115')]>=_0x4c745d[_0x1e35('0x11d')]){_0x40eaa6['createStateFinal'](_0x29df62,_0x25905b,_0x49b00a,_0x1e35('0x11e'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x29df62[_0x1e35('0x115')],'scheduledat':moment()[_0x1e35('0xdd')](_0x4c745d[_0x1e35('0x11f')],_0x1e35('0x120'))[_0x1e35('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x29df62[_0x1e35('0xdf')],'ListId':_0x29df62[_0x1e35('0xe0')],'VoiceQueueId':_0x29df62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x29df62['CampaignId']||undefined})['catch'](loggerCatch(_0x1e35('0x121')));_0x25905b({'reschedule':0x1});}}});}if(_0x39375a[_0x1e35('0x43')]===_0x1e35('0xc0')&&this[_0x1e35('0x1d')][_0x39375a[_0x1e35('0xbe')]][_0x1e35('0x10a')]&&_0x372b01[_0x1e35('0x10b')]==='HANGUP'){delete this['uniqueId'][_0x372b01[_0x1e35('0xbf')]];this['updateOriginated'](this['campaigns'][_0x39375a[_0x1e35('0xbe')]]);_0x11172c=new Hangup(_0x39375a,_0x372b01);_0x11172c[_0x1e35('0x6f')]=0x12;_0x11172c[_0x1e35('0x70')]=_0x1e35('0x122');_0x11172c['membername']=_0x1e35('0x10f');ami['emit']('custom:amd',ut[_0x1e35('0x111')](_0x11172c,_0x1e35('0x116')));this[_0x1e35('0x112')](_0x11172c,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x39375a[_0x1e35('0x43')]==='ivr'&&this['campaigns'][_0x39375a['queue']][_0x1e35('0x10a')]&&_0x372b01[_0x1e35('0x10b')]===_0x1e35('0x123')){return new Promise(function(_0x8be506,_0x30162c){delete _0x40eaa6['uniqueId'][_0x372b01[_0x1e35('0xbf')]];_0x40eaa6[_0x1e35('0xc1')](_0x40eaa6['campaigns'][_0x39375a[_0x1e35('0xbe')]]);_0x40eaa6[_0x1e35('0x1d')][_0x39375a[_0x1e35('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x40eaa6[_0x1e35('0x1d')][_0x39375a[_0x1e35('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x58a04c=_0x40eaa6[_0x1e35('0x1d')][_0x39375a[_0x1e35('0xbe')]];var _0x388429=new Hangup(_0x39375a,_0x372b01);_0x388429['state']=0x13;_0x388429[_0x1e35('0x70')]=_0x1e35('0x114');_0x388429[_0x1e35('0x10e')]='AMD';_0x388429[_0x1e35('0x115')]+=0x1;_0x388429['countglobal']+=0x1;_0x388429[_0x1e35('0x116')]=!![];ami['emit'](_0x1e35('0x110'),ut[_0x1e35('0x111')](_0x388429,_0x1e35('0x116')));hopperUtils[_0x1e35('0xc8')](_0x388429)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x117')));if(_0x388429[_0x1e35('0x118')]+_0x388429[_0x1e35('0x124')]+_0x388429[_0x1e35('0x119')]+_0x388429[_0x1e35('0x125')]+_0x388429[_0x1e35('0xd5')]+_0x388429[_0x1e35('0x11a')]+_0x388429['countmachineretry']+_0x388429['countagentrejectretry']>=_0x58a04c[_0x1e35('0x126')]){_0x40eaa6[_0x1e35('0x127')](_0x388429,_0x8be506,_0x30162c,_0x1e35('0x11c'));}else{if(_0x388429['countmachineretry']>=_0x58a04c[_0x1e35('0x11d')]){_0x40eaa6['createStateFinal'](_0x388429,_0x8be506,_0x30162c,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x388429[_0x1e35('0x115')],'scheduledat':moment()['add'](_0x58a04c[_0x1e35('0x11f')],_0x1e35('0x120'))['format'](_0x1e35('0xc3')),'ContactId':_0x388429[_0x1e35('0xdf')],'ListId':_0x388429[_0x1e35('0xe0')],'VoiceQueueId':_0x388429[_0x1e35('0xe1')]||undefined,'CampaignId':_0x388429[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch('[rescheduleContact][Machine]'));_0x8be506({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1e35('0x34')]=function(_0x33ba0e){var _0x4416d4=this[_0x1e35('0x23')][_0x33ba0e[_0x1e35('0xbf')]];var _0x3d61e4;if(_0x4416d4&&_0x4416d4[_0x1e35('0x43')]===_0x1e35('0xc0')){delete this[_0x1e35('0x23')][_0x33ba0e[_0x1e35('0xbf')]];this[_0x1e35('0xc1')](this[_0x1e35('0x1d')][_0x4416d4[_0x1e35('0xbe')]]);this['campaigns'][_0x4416d4[_0x1e35('0xbe')]][_0x1e35('0x128')]+=0x1;_0x3d61e4=new Hangup(_0x4416d4,_0x33ba0e);hopperUtils[_0x1e35('0xc8')](_0x3d61e4)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x129')));hopperUtils[_0x1e35('0xca')](_0x3d61e4)['catch'](loggerCatch(_0x1e35('0x12a')));}if(_0x4416d4&&_0x4416d4[_0x1e35('0x43')]!=='ivr'&&isNotNull(this[_0x1e35('0x1c')][_0x4416d4[_0x1e35('0xbe')]][_0x1e35('0x12b')])){delete this['uniqueId'][_0x33ba0e[_0x1e35('0xbf')]];this[_0x1e35('0xc1')](this[_0x1e35('0x1c')][_0x4416d4[_0x1e35('0xbe')]]);this[_0x1e35('0x1c')][_0x4416d4[_0x1e35('0xbe')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x4416d4[_0x1e35('0xbe')]][_0x1e35('0x10d')]+=0x1;_0x3d61e4=new Hangup(_0x4416d4,_0x33ba0e);_0x3d61e4['state']=0x10;_0x3d61e4[_0x1e35('0x70')]='AnswerAGI';_0x3d61e4[_0x1e35('0x10e')]=_0x1e35('0x12c');hopperUtils[_0x1e35('0xc8')](_0x3d61e4)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x129')));hopperUtils[_0x1e35('0xca')](_0x3d61e4)['catch'](loggerCatch(_0x1e35('0x12a')));}if(_0x4416d4&&_0x4416d4[_0x1e35('0x43')]!==_0x1e35('0xc0')&&!isNotNull(this[_0x1e35('0x1c')][_0x4416d4[_0x1e35('0xbe')]][_0x1e35('0x12b')])){if(_0x33ba0e[_0x1e35('0x12d')]===_0x1e35('0x12e')){delete this[_0x1e35('0x23')][_0x33ba0e[_0x1e35('0xbf')]];this[_0x1e35('0x1c')][_0x4416d4['queue']]['outboundAnswerCallsDay']+=0x1;const _0x136d2a=new AgentComplete(_0x4416d4,_0x33ba0e);_0x136d2a[_0x1e35('0xe2')]=this[_0x1e35('0x1c')][_0x4416d4[_0x1e35('0xbe')]]['id'];hopperUtils['createHistory'](_0x136d2a)[_0x1e35('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x136d2a)[_0x1e35('0x9d')](loggerCatch('[syncAgentComplete]'));}else{delete this[_0x1e35('0x23')][_0x33ba0e['uniqueid']];this[_0x1e35('0xc1')](this['voiceQueues'][_0x4416d4[_0x1e35('0xbe')]]);this['voiceQueues'][_0x4416d4[_0x1e35('0xbe')]][_0x1e35('0x12f')]+=0x1;_0x3d61e4=new Hangup(_0x4416d4,_0x33ba0e);_0x3d61e4[_0x1e35('0x6f')]=0xc;_0x3d61e4[_0x1e35('0x70')]=_0x33ba0e['cause-txt'];_0x3d61e4[_0x1e35('0x10e')]='Unknow';hopperUtils[_0x1e35('0xc8')](_0x3d61e4)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x129')));hopperUtils[_0x1e35('0xca')](_0x3d61e4)['catch'](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x1e35('0x17')]['syncQueueSummary']=function(_0x2e61fc){var _0x1fecda=this;if(!_0x1fecda[_0x1e35('0x130')][_0x2e61fc[_0x1e35('0x48')]]){_0x1fecda['queuesSummary'][_0x2e61fc['name']]={'running':![]};}else if(_0x1fecda[_0x1e35('0x130')][_0x2e61fc[_0x1e35('0x48')]][_0x1e35('0x131')]===!![]){return;}else if(_0x1fecda[_0x1e35('0x130')][_0x2e61fc[_0x1e35('0x48')]][_0x1e35('0x131')]===![]){_0x1fecda['queuesSummary'][_0x2e61fc[_0x1e35('0x48')]][_0x1e35('0x131')]=!![];}var _0x5ce386=_0x1fecda['voiceQueues'][_0x2e61fc[_0x1e35('0x48')]];var _0x4f9826=_0x5ce386[_0x1e35('0x6c')]!==utils[_0x1e35('0x69')][_0x1e35('0x7a')];var _0x1d8711=utils[_0x1e35('0x132')](_0x5ce386);_0x5ce386[_0x1e35('0x133')]=utils[_0x1e35('0x134')](_0x5ce386,_0x1fecda[_0x1e35('0x1f')]);Promise[_0x1e35('0xa8')]()[_0x1e35('0x3f')](function(){if(_0x5ce386[_0x1e35('0x133')]===utils[_0x1e35('0x69')]['INACTIVE']){if(_0x4f9826){clearPredictiveAttributes(_0x5ce386);_0x2e61fc[_0x1e35('0x25')]=undefined;_0x2e61fc[_0x1e35('0x26')]=undefined;}if(_0x5ce386[_0x1e35('0x133')]===utils['CAMPAIGN_STATUS'][_0x1e35('0x7a')]){_0x2e61fc[_0x1e35('0x135')]=0x0;_0x2e61fc['paused']=0x0;_0x2e61fc[_0x1e35('0x136')]=0x0;_0x2e61fc['talking']=0x0;_0x2e61fc['pTalking']=0x0;}}else if(_0x5ce386['statusMessage']===utils['CAMPAIGN_STATUS'][_0x1e35('0x137')]&&!_0x1d8711){return _0x1fecda['ifTime'](_0x5ce386,!![])[_0x1e35('0x3f')](function(){return _0x1fecda[_0x1e35('0x8f')](_0x5ce386,![]);})[_0x1e35('0x3f')](function(){return _0x1fecda['checkDialMethod'](_0x5ce386);})[_0x1e35('0x9d')](function(_0x2919c1){loggerSyncQueueSummary['debug'](_0x1e35('0x138'),util[_0x1e35('0x66')](_0x2919c1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5ce386);});}else{clearPredictiveAttributes(_0x5ce386);}})['then'](function(){var _0xb62e2f=_0x2e61fc[_0x1e35('0x139')](_0x5ce386);if(_0xb62e2f||_0x5ce386['queueSummaryCountersUpdated']){_0x5ce386['queueSummaryCountersUpdated']=![];_0x2e61fc[_0x1e35('0x13a')](_0x5ce386);Object[_0x1e35('0x13b')](_0x5ce386,_0x2e61fc);emitOutboundVoiceQueueSummary(_0x2e61fc);}_0x1fecda[_0x1e35('0x130')][_0x5ce386[_0x1e35('0x48')]]['running']=![];})[_0x1e35('0x9d')](function(_0x384d5c){logger[_0x1e35('0x64')](_0x1e35('0x138'),util['inspect'](_0x384d5c,{'showHidden':![],'depth':null}));_0x1fecda[_0x1e35('0x130')][_0x5ce386['name']][_0x1e35('0x131')]=![];});};Dialer[_0x1e35('0x17')]['syncQueueSummaryComplete']=_[_0x1e35('0x13c')](function(){var _0x1e6c36=_[_0x1e35('0x13d')](this['voiceQueues'],function(_0x24152d){return _0x24152d[_0x1e35('0x13e')];});var _0x4ff4ba=_[_0x1e35('0x13d')](this[_0x1e35('0x1e')],function(_0x10c48d){return _0x10c48d[_0x1e35('0x13f')]&&_0x10c48d['status']===_0x1e35('0x88');});if(_0x1e6c36[_0x1e35('0x97')]>0x0&&_0x4ff4ba[_0x1e35('0x97')]>0x0){return Promise[_0x1e35('0xa8')]()['then'](cmHopper[_0x1e35('0x140')](_[_0x1e35('0x141')](_0x1e6c36,'id'),previewRecallmeReminderInterval,_[_0x1e35('0x141')](_0x4ff4ba,'id')))[_0x1e35('0x3f')](function(_0x5600c3){for(var _0x426f6a=0x0;_0x426f6a<_0x5600c3[_0x1e35('0x97')];_0x426f6a++){var _0x31789c=_0x5600c3[_0x426f6a]['Agent']['name'];if(_0x31789c)io['to'](util[_0x1e35('0x46')]('user:%s',_0x31789c))[_0x1e35('0x42')]('user:dialPreviewRecallReminder',{'hopper':_0x5600c3[_0x426f6a]});}})[_0x1e35('0x9d')](function(_0x2694e4){logger[_0x1e35('0x64')]('checkPreviewRecallReminder',_0x2694e4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1e35('0x17')][_0x1e35('0x3d')]=function(){var _0x3ce88e=this;setInterval(function(){_0x3ce88e[_0x1e35('0x142')](_0x3ce88e[_0x1e35('0x23')],_0x1e35('0x143'));_0x3ce88e[_0x1e35('0x142')](_0x3ce88e[_0x1e35('0x21')],_0x1e35('0x144'));},0x32c8);};Dialer['prototype'][_0x1e35('0x142')]=function(_0x530c38,_0x2b23df){var _0x4aec17=this;for(var _0x23e669 in _0x530c38){if(typeof _0x530c38[_0x23e669]!=='undefined'){this[_0x1e35('0x1a')][_0x1e35('0x145')](function(){if(!_['isNil'](_0x530c38[_0x23e669])){return ami[_0x1e35('0x146')]({'action':_0x1e35('0x87'),'channel':_0x530c38[_0x23e669][_0x1e35('0xf0')]})['catch'](function(_0x57832c){if(_0x57832c[_0x1e35('0x6c')]===_0x1e35('0x147')){setTimeout(function(){if(_0x530c38[_0x23e669]&&_0x530c38[_0x23e669]['type']!=='ivr'){_0x4aec17['updateOriginated'](_0x4aec17[_0x1e35('0x1c')][_0x530c38[_0x23e669][_0x1e35('0xbe')]]);logger['error'](_0x1e35('0x148'),_0x2b23df,_0x23e669,_0x530c38[_0x23e669]['queue']);delete _0x530c38[_0x23e669];}if(_0x530c38[_0x23e669]&&_0x530c38[_0x23e669]['type']===_0x1e35('0xc0')){_0x4aec17['updateOriginated'](_0x4aec17['campaigns'][_0x530c38[_0x23e669][_0x1e35('0xbe')]]);logger[_0x1e35('0x64')]('[Dialer][checkChannel][ivr]',_0x2b23df,_0x23e669,_0x530c38[_0x23e669][_0x1e35('0xbe')]);delete _0x530c38[_0x23e669];}},0x2328);}});}});}}};Dialer['prototype'][_0x1e35('0x149')]=function(_0x1be317){return Promise['resolve']()[_0x1e35('0x3f')](voiceQueueRt[_0x1e35('0x149')](_0x1be317))['catch'](loggerCatch(_0x1e35('0x14a')));};Dialer[_0x1e35('0x17')][_0x1e35('0xc1')]=function(_0x110479){if(!_['isUndefined'](_0x110479)&&_0x110479!==null){if(typeof _0x110479[_0x1e35('0x7f')]!=='undefined'){if(_0x110479[_0x1e35('0x7f')]>0x0){_0x110479[_0x1e35('0x7f')]-=0x1;}else{logger[_0x1e35('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1e35('0x64')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x1e35('0x14b')]=function(_0x10e283,_0x371d95){var _0x452c75=this;return function(_0x573f50){_0x452c75[_0x1e35('0xc1')](_0x371d95);logger[_0x1e35('0x64')](_0x10e283,util[_0x1e35('0x66')](_0x573f50,{'showHidden':![],'depth':null}));};};Dialer[_0x1e35('0x17')][_0x1e35('0x14c')]=function(_0x38255b,_0x1d2146,_0x384cea){var _0x405f94={'state':0x19,'statedesc':_0x1e35('0x14d')};this['updateOriginated'](_0x1d2146);this[_0x1e35('0x112')](_[_0x1e35('0x61')](_0x405f94,_['pick'](_0x384cea,['ContactId',_0x1e35('0xe0'),'UserId',_0x1e35('0xe1'),_0x1e35('0xe2')])),'[emptyContact][createHistory]',_0x1e35('0x14e'));logger[_0x1e35('0x64')](_0x38255b);};Dialer['prototype'][_0x1e35('0x112')]=function(_0x47ab0f,_0x370883,_0x2500c6){hopperUtils[_0x1e35('0xc8')](_0x47ab0f)[_0x1e35('0x9d')](loggerCatch(_0x370883));hopperUtils[_0x1e35('0xca')](_0x47ab0f)[_0x1e35('0x9d')](loggerCatch(_0x2500c6));};Dialer[_0x1e35('0x17')][_0x1e35('0xdb')]=function(_0x43ad59,_0x25ad58){hopperUtils[_0x1e35('0xc8')](_0x43ad59)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xc9')));if(_0x25ad58==0x0){hopperUtils[_0x1e35('0xca')](_0x43ad59)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x14f')));}};Dialer[_0x1e35('0x17')][_0x1e35('0x150')]=function(_0x2193dd){return Promise[_0x1e35('0xa8')]()[_0x1e35('0x3f')](cmHopper[_0x1e35('0x140')](_0x2193dd['id'],previewRecallmeReminderInterval))[_0x1e35('0x3f')](function(_0x3dece7){for(var _0x197b36=0x0;_0x197b36<_0x3dece7[_0x1e35('0x97')];_0x197b36++){var _0x24e3d0=_0x3dece7[_0x197b36][_0x1e35('0x151')]['name'];if(_0x24e3d0)io['to'](util[_0x1e35('0x46')](_0x1e35('0x152'),_0x24e3d0))[_0x1e35('0x42')](_0x1e35('0x153'),{'hopper':_0x3dece7[_0x197b36]});}})[_0x1e35('0x9d')](function(){});};Dialer['prototype'][_0x1e35('0xad')]=function(_0x21cc60){var _0x506fc7=this;return function(){_0x506fc7['handleIvr'](_0x21cc60);};};Dialer['prototype'][_0x1e35('0x154')]=function(_0xab5bfe,_0x2307a5){var _0x2c9e9c=this;var _0x489ef0=uuid['v4']();this[_0x1e35('0x21')][_0x489ef0]=new Action(_0xab5bfe,_0x2307a5,_0x489ef0);return new Promise(function(_0x4a00cc,_0x3f91b7){if(_[_0x1e35('0x41')](_0xab5bfe)&&typeof _0xab5bfe!==_0x1e35('0x155')){return _0x3f91b7(msgResponse(_0x1e35('0x156'),_0x1e35('0x90'),_0x1e35('0x157')));}if(_[_0x1e35('0x41')](_0x2307a5[_0x1e35('0x158')])||_0x2307a5[_0x1e35('0x158')]===null){return _0x3f91b7(msgResponse(_0x1e35('0x156'),_0x1e35('0x90'),_0x1e35('0x159')));}var _0xc62e47={'XMD-CALLERID':_0x2c9e9c['actions'][_0x489ef0]['getCaller'](),'XMD-AGI':_0xab5bfe['dialQueueProject']?util[_0x1e35('0x46')]('\x22agi://%s/square,%s\x22',ipAgi,_0xab5bfe[_0x1e35('0x12b')]):'NONE','XMD-AGIAFTER':_0xab5bfe[_0x1e35('0xc7')]?util[_0x1e35('0x46')](_0x1e35('0x15a'),ipAgi,_0xab5bfe[_0x1e35('0xc7')]):'NONE','XMD-QUEUE':utils[_0x1e35('0x15b')](_0xab5bfe)?util[_0x1e35('0x46')](_0x1e35('0x15c'),_0xab5bfe['name'],_0xab5bfe[_0x1e35('0x15d')]||'',_0xab5bfe[_0x1e35('0x15e')]?'c':'',_0xab5bfe['dialQueueTimeout']||0x3):_0x1e35('0x15f'),'XMD-CONTACTID':_0x2307a5['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2c9e9c['actions'][_0x489ef0][_0x1e35('0x160')](),'XMD-AMD':_0xab5bfe[_0x1e35('0x10a')]?_0x1e35('0x137'):_0x1e35('0x15f'),'XMD-DESTINATION':_0x1e35('0x161')};if(_0xab5bfe['dialAMDActive']){_0xc62e47['XMD-AMDINITIALSILENCE']=_0xab5bfe[_0x1e35('0x162')]||0x9c4;_0xc62e47[_0x1e35('0x163')]=_0xab5bfe['dialAMDGreeting']||0x5dc;_0xc62e47[_0x1e35('0x164')]=_0xab5bfe[_0x1e35('0x165')]||0x320;_0xc62e47['XMD-AMDTOTALANALYSISTIME']=_0xab5bfe['dialAMDTotalAnalysisTime']||0x1388;_0xc62e47[_0x1e35('0x166')]=_0xab5bfe[_0x1e35('0x167')]||0x64;_0xc62e47['XMD-AMDBETWEENWORDSSILENCE']=_0xab5bfe['dialAMDBetweenWordsSilence']||0x32;_0xc62e47[_0x1e35('0x168')]=_0xab5bfe[_0x1e35('0x169')]||0x3;_0xc62e47[_0x1e35('0x16a')]=_0xab5bfe[_0x1e35('0x16b')]||0x100;_0xc62e47['XMD-AMDMAXIMUMWORDLENGTH']=_0xab5bfe[_0x1e35('0x16c')]||0x1388;}if(utils[_0x1e35('0x15b')](_0xab5bfe)){_0xc62e47['XMD-VOICEQUEUEID']=_0x2307a5[_0x1e35('0xe1')];}else{_0xc62e47[_0x1e35('0x16d')]=_0x2307a5[_0x1e35('0xe2')];}var _0x5ebc37=utils[_0x1e35('0x16e')](_0x2307a5['Contact']);Object[_0x1e35('0x13b')](_0xc62e47,_0x5ebc37);var _0x2dd86b=_0x2c9e9c[_0x1e35('0x84')](_0xab5bfe[_0x1e35('0x8a')])?utils['getCallerId'](_0xab5bfe[_0x1e35('0x8a')][_0x1e35('0x16f')],_0xab5bfe[_0x1e35('0x170')],_0xab5bfe[_0x1e35('0x171')]>0x0?utils[_0x1e35('0x172')](_0xab5bfe[_0x1e35('0x173')],_0xab5bfe[_0x1e35('0x171')]):_0xab5bfe['dialOriginateCallerIdNumber']):utils[_0x1e35('0x174')](_[_0x1e35('0xf4')](_0xab5bfe[_0x1e35('0x175')])?_0xab5bfe[_0x1e35('0x8a')]['callerid']:_0xab5bfe['TrunkBackup'][_0x1e35('0x16f')],_0xab5bfe[_0x1e35('0x170')],_0xab5bfe[_0x1e35('0x171')]>0x0?utils['getCallerIdRandom'](_0xab5bfe['dialOriginateCallerIdNumber'],_0xab5bfe[_0x1e35('0x171')]):_0xab5bfe[_0x1e35('0x173')]);if(_0x2dd86b){_0xc62e47[_0x1e35('0x176')]=_0x2c9e9c[_0x1e35('0x21')][_0x489ef0][_0x1e35('0x177')]=utils[_0x1e35('0x178')](_0x2dd86b);_0xc62e47[_0x1e35('0x179')]=_0x2307a5[_0x1e35('0x158')];}_0xab5bfe[_0x1e35('0x17a')]=_0xc62e47;return ami[_0x1e35('0x146')]({'actionid':_0x489ef0,'action':'originate','channel':_0x2c9e9c[_0x1e35('0x84')](_0xab5bfe[_0x1e35('0x8a')])?util[_0x1e35('0x46')]('SIP/%s/%s%s',_0xab5bfe[_0x1e35('0x8a')]['name'],isNotNull(_0xab5bfe[_0x1e35('0x17b')])?_0xab5bfe['dialPrefix'][_0x1e35('0x17c')]()||'':'',_0xab5bfe[_0x1e35('0x17d')]>0x0?_0x2307a5[_0x1e35('0x158')][_0x1e35('0x17e')](_0xab5bfe[_0x1e35('0x17d')]):_0x2307a5[_0x1e35('0x158')]):util[_0x1e35('0x46')](_0x1e35('0x17f'),_[_0x1e35('0xf4')](_0xab5bfe[_0x1e35('0x175')])?_0xab5bfe['Trunk'][_0x1e35('0x48')]:_0xab5bfe[_0x1e35('0x175')][_0x1e35('0x48')],isNotNull(_0xab5bfe[_0x1e35('0x17b')])?_0xab5bfe[_0x1e35('0x17b')][_0x1e35('0x17c')]()||'':'',_0xab5bfe['dialCutDigit']>0x0?_0x2307a5[_0x1e35('0x158')][_0x1e35('0x17e')](_0xab5bfe[_0x1e35('0x17d')]):_0x2307a5[_0x1e35('0x158')]),'callerid':_0x2dd86b,'Exten':'xcally-motion-dialer','Context':_0x1e35('0x180'),'Priority':'1','variable':_0xc62e47,'timeout':(_0xab5bfe[_0x1e35('0x181')]||0x1e)*0x3e8,'async':!![],'channelid':_0x489ef0})['then'](function(_0x16e9bb){return _0x4a00cc(_0x16e9bb);})[_0x1e35('0x9d')](function(_0x15f7f2){_0xab5bfe[_0x1e35('0x182')]+=0x1;var _0x1b464e=new History(_0x2c9e9c[_0x1e35('0x21')][_0x489ef0]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x1e35('0xa4')](_0x15f7f2)));_0x1b464e['state']=0xe;_0x1b464e[_0x1e35('0x70')]='OriginateError';_0x1b464e[_0x1e35('0x71')]=moment()[_0x1e35('0x46')](_0x1e35('0xc3'));_0x1b464e[_0x1e35('0xe4')]=_0x1b464e['starttime'];hopperUtils[_0x1e35('0xc8')](_0x1b464e)[_0x1e35('0x9d')](loggerCatch('[originate][error]'));_0x2c9e9c[_0x1e35('0xca')](_0x1b464e)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x183')))['finally'](function(){delete _0x2c9e9c['actions'][_0x489ef0];return _0x3f91b7(msgResponse('originate',_0x1e35('0x83'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x1e35('0x184')]=function(_0x59fb54,_0x8c8722,_0x52f6e1){var _0x4cab62=new History(_0x8c8722);if(_0x4cab62['countbusyretry']+_0x4cab62['countcongestionretry']+_0x4cab62[_0x1e35('0x119')]+_0x4cab62[_0x1e35('0x125')]+_0x4cab62[_0x1e35('0xd5')]+_0x4cab62[_0x1e35('0x11a')]+_0x4cab62[_0x1e35('0x115')]+_0x4cab62[_0x1e35('0x11b')]>=_0x52f6e1[_0x1e35('0x126')]-0x1){return!![];}switch(_0x59fb54){case 0x3:if(_0x4cab62[_0x1e35('0x119')]>=_0x52f6e1[_0x1e35('0x185')]-0x1){return!![];}hopperUtils[_0x1e35('0xdc')]({'active':![],'countnoanswerretry':_0x4cab62[_0x1e35('0x119')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1[_0x1e35('0x186')],_0x1e35('0x120'))[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62['ContactId'],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})['catch'](loggerCatch(_0x1e35('0x187')));break;case 0x5:if(_0x4cab62[_0x1e35('0x118')]>=_0x52f6e1['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x4cab62[_0x1e35('0x118')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1['dialBusyRetryFrequency'],'minutes')[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62[_0x1e35('0xdf')],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62['VoiceQueueId']||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x188')));break;case 0x8:if(_0x4cab62[_0x1e35('0x124')]>=_0x52f6e1['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x1e35('0xdc')]({'active':![],'countcongestionretry':_0x4cab62[_0x1e35('0x124')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1['dialCongestionRetryFrequency'],'minutes')[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62['ContactId'],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x189')));break;case 0x0:if(_0x4cab62[_0x1e35('0x125')]>=_0x52f6e1[_0x1e35('0x18a')]-0x1){return!![];}else{hopperUtils[_0x1e35('0xdc')]({'active':![],'countnosuchnumberretry':_0x4cab62['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x52f6e1[_0x1e35('0x18b')],_0x1e35('0x120'))[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62[_0x1e35('0xdf')],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62['VoiceQueueId']||undefined,'CampaignId':_0x4cab62['CampaignId']||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x18c')));}break;case 0xa:if(_0x4cab62['countdropretry']>=_0x52f6e1[_0x1e35('0xda')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4cab62[_0x1e35('0xd5')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1['dialDropRetryFrequency'],_0x1e35('0x120'))[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62[_0x1e35('0xdf')],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})['catch'](loggerCatch(_0x1e35('0xe3')));break;case 0xb:if(_0x4cab62[_0x1e35('0x11a')]>=_0x52f6e1[_0x1e35('0xed')]-0x1){return!![];}hopperUtils[_0x1e35('0xdc')]({'active':![],'countabandonedretry':_0x4cab62[_0x1e35('0x11a')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1[_0x1e35('0xec')],'minutes')[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62[_0x1e35('0xdf')],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x4cab62['CampaignId']||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0xee')));break;case 0x13:if(_0x4cab62[_0x1e35('0x115')]>=_0x52f6e1[_0x1e35('0x11d')]-0x1){return!![];}hopperUtils[_0x1e35('0xdc')]({'active':![],'countmachineretry':_0x4cab62[_0x1e35('0x115')]+=0x1,'scheduledat':moment()[_0x1e35('0xdd')](_0x52f6e1[_0x1e35('0x11f')],'minutes')['format'](_0x1e35('0xc3')),'ContactId':_0x4cab62['ContactId'],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62[_0x1e35('0xe1')]||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})['catch'](loggerCatch(_0x1e35('0x121')));break;case 0x14:if(_0x4cab62[_0x1e35('0x11b')]>=_0x52f6e1[_0x1e35('0x18d')]-0x1){return!![];}hopperUtils[_0x1e35('0xdc')]({'active':![],'countagentrejectretry':_0x4cab62[_0x1e35('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x52f6e1[_0x1e35('0x18e')],_0x1e35('0x120'))[_0x1e35('0x46')](_0x1e35('0xc3')),'ContactId':_0x4cab62[_0x1e35('0xdf')],'ListId':_0x4cab62[_0x1e35('0xe0')],'VoiceQueueId':_0x4cab62['VoiceQueueId']||undefined,'CampaignId':_0x4cab62[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x18f')));break;default:return!![];}};Dialer[_0x1e35('0x17')][_0x1e35('0x106')]=function(_0xc2d882,_0x30306f,_0x1069c7){var _0x352c5e=this;var _0x3833eb=new History(_0xc2d882);var _0x1d938d=![];var _0x29b27a;var _0x8e6091;return new Promise(function(_0xd639ea,_0x419fef){if(_[_0x1e35('0x41')](_0x30306f)&&typeof _0x30306f!=='object'){return _0x419fef(msgResponse(_0x1e35('0x190'),_0x1e35('0x90'),_0x1e35('0x191')));}if(_[_0x1e35('0x41')](_0x1069c7)&&typeof _0x1069c7!=='object'){return _0x419fef(msgResponse(_0x1e35('0x190'),_0x1e35('0x90'),_0x1e35('0x192')));}hopperUtils[_0x1e35('0xd7')](_0x3833eb,_0x1069c7[_0x1e35('0xc5')],_0x30306f)[_0x1e35('0x3f')](function(_0x11bb67){if(_0x11bb67[_0x1e35('0xd9')]==0x1)_0x1d938d=!![];switch(_0x1069c7[_0x1e35('0xc5')]){case'0':_0x30306f[_0x1e35('0x193')]+=0x1;_0x3833eb[_0x1e35('0x6f')]=0x0;_0x3833eb[_0x1e35('0x70')]=_0x1e35('0x194');_0x3833eb[_0x1e35('0x125')]+=0x1;_0x3833eb['countglobal']+=0x1;ami['emit'](_0x1e35('0x195'),ut[_0x1e35('0x111')](_0xc2d882,_0x1e35('0x196')));_0x29b27a=_0x30306f[_0x1e35('0x18b')];_0x8e6091=_0x30306f[_0x1e35('0xd6')];hopperUtils['createHistory'](_0x3833eb)[_0x1e35('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x352c5e[_0x1e35('0x184')](0x0,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb[_0x1e35('0x125')]>=_0x30306f[_0x1e35('0x18a')]){_0x352c5e[_0x1e35('0x197')](_0x3833eb,_0xd639ea,_0x419fef,'reason\x200\x20no\x20such\x20number....');}else{_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x198'));}}break;case'3':_0x30306f[_0x1e35('0x199')]+=0x1;_0x3833eb[_0x1e35('0x6f')]=0x3;_0x3833eb[_0x1e35('0x70')]=_0x1e35('0x19a');_0x3833eb[_0x1e35('0x119')]+=0x1;_0x3833eb[_0x1e35('0xeb')]+=0x1;var _0x117f0f=ut[_0x1e35('0x19b')](_0xc2d882,_0x30306f);ami[_0x1e35('0x42')](_0x1e35('0x19c'),_0x117f0f);_0x29b27a=_0x30306f[_0x1e35('0x186')];_0x8e6091=_0x30306f['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e35('0xc8')](_0x3833eb)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x19d')));if(_0x352c5e[_0x1e35('0x184')](0x3,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb[_0x1e35('0x119')]>=_0x30306f[_0x1e35('0x185')]){_0x352c5e['createStateFinal'](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x19e'));}else{_0x352c5e['stateGlobal'](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x19e'));}}break;case'5':_0x30306f[_0x1e35('0x19f')]+=0x1;_0x3833eb[_0x1e35('0x6f')]=0x5;_0x3833eb[_0x1e35('0x70')]='Busy';_0x3833eb[_0x1e35('0x118')]+=0x1;_0x3833eb[_0x1e35('0xeb')]+=0x1;ami['emit'](_0x1e35('0x1a0'),ut[_0x1e35('0x111')](_0xc2d882,_0x1e35('0x1a1')));_0x29b27a=_0x30306f[_0x1e35('0x1a2')];_0x8e6091=_0x30306f[_0x1e35('0xd6')];hopperUtils[_0x1e35('0xc8')](_0x3833eb)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1a3')));if(_0x352c5e[_0x1e35('0x184')](0x5,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb['countbusyretry']>=_0x30306f[_0x1e35('0x1a4')]){_0x352c5e[_0x1e35('0x197')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1a5'));}else{_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1a5'));}}break;case'8':_0x30306f[_0x1e35('0x1a6')]+=0x1;_0x3833eb[_0x1e35('0x6f')]=0x8;_0x3833eb['statedesc']='Congestion';_0x3833eb[_0x1e35('0x124')]+=0x1;_0x3833eb[_0x1e35('0xeb')]+=0x1;_0x29b27a=_0x30306f[_0x1e35('0x1a7')];_0x8e6091=_0x30306f[_0x1e35('0xd6')];ami[_0x1e35('0x42')](_0x1e35('0x1a8'),ut['buildObj'](_0xc2d882,_0x1e35('0x1a9')));hopperUtils[_0x1e35('0xc8')](_0x3833eb)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1aa')));if(_0x352c5e[_0x1e35('0x184')](0x8,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb[_0x1e35('0x124')]>=_0x30306f[_0x1e35('0x1ab')]){_0x352c5e[_0x1e35('0x197')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1ac'));}else{_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1ac'));}}break;case'11':_0x30306f['outboundAbandonedCallsDay']+=0x1;_0x3833eb['state']=0xb;_0x3833eb[_0x1e35('0x70')]='Abandoned';_0x3833eb[_0x1e35('0x11a')]+=0x1;_0x3833eb[_0x1e35('0xeb')]+=0x1;_0x29b27a=_0x30306f[_0x1e35('0xec')];_0x8e6091=_0x30306f[_0x1e35('0xd6')];hopperUtils[_0x1e35('0xc8')](_0x3833eb)[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1ad')));if(_0x352c5e[_0x1e35('0x184')](0xb,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb[_0x1e35('0x11a')]>=_0x30306f[_0x1e35('0xed')]){_0x352c5e['createStateFinal'](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1ae'));}else{_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,_0x1e35('0x1ae'));}}break;case'20':_0x30306f[_0x1e35('0x1af')]+=0x1;_0x3833eb['state']=0x14;_0x3833eb['statedesc']=_0x1e35('0x1b0');_0x3833eb[_0x1e35('0x11b')]+=0x1;_0x3833eb[_0x1e35('0xeb')]+=0x1;_0x29b27a=_0x30306f[_0x1e35('0x18e')];_0x8e6091=_0x30306f['callAdditionalPhoneAfterMin'];ami[_0x1e35('0x42')](_0x1e35('0x1b1'),ut[_0x1e35('0x111')](_0xc2d882,_0x1e35('0x1b2')));hopperUtils['createHistory'](_0x3833eb)[_0x1e35('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x352c5e[_0x1e35('0x184')](0x14,_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb[_0x1e35('0x11b')]>=_0x30306f['dialAgentRejectMaxRetry']){_0x352c5e['createStateFinal'](_0x3833eb,_0xd639ea,_0x419fef,'reason\x2020\x20agentreject');}else{_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,'reason\x2020\x20agentreject');}}break;default:_0x30306f[_0x1e35('0x12f')]+=0x1;_0x3833eb[_0x1e35('0x6f')]=0xc;_0x3833eb[_0x1e35('0x70')]=_0x1069c7['reason'];_0x29b27a=_0x30306f[_0x1e35('0x18e')];_0x8e6091=_0x30306f[_0x1e35('0xd6')];hopperUtils['createHistory'](_0x3833eb)[_0x1e35('0x9d')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x352c5e[_0x1e35('0x184')](_0x1069c7[_0x1e35('0xc5')],_0xc2d882,_0x30306f)&&!_0x1d938d){if(_0x3833eb['countbusyretry']+_0x3833eb[_0x1e35('0x124')]+_0x3833eb[_0x1e35('0x119')]+_0x3833eb['countnosuchnumberretry']+_0x3833eb[_0x1e35('0xd5')]+_0x3833eb['countabandonedretry']+_0x3833eb[_0x1e35('0x115')]+_0x3833eb['countagentrejectretry']>=_0x30306f['dialGlobalMaxRetry']){_0x352c5e[_0x1e35('0x127')](_0x3833eb,_0xd639ea,_0x419fef,_0x1069c7[_0x1e35('0xc5')]);}else{_0x352c5e[_0x1e35('0x197')](_0x3833eb,_0xd639ea,_0x419fef,_0x1069c7['reason']);}}}})['then'](function(){if(_0x1d938d){hopperUtils['swapAdditionalPhones'](_0x3833eb,_0x29b27a,_0x8e6091)[_0x1e35('0x3f')](function(){return _0xd639ea(0x1);});}});});};Dialer[_0x1e35('0x17')][_0x1e35('0x127')]=function(_0xbe7738,_0x4eab3e,_0x5244d9,_0x26eb92){var _0x188cdb=new Final(_0xbe7738);_0x188cdb[_0x1e35('0x6f')]=0xf;_0x188cdb[_0x1e35('0x70')]='Global';this['createStateFinal'](_0x188cdb,_0x4eab3e,_0x5244d9,_0x26eb92);};Dialer[_0x1e35('0x17')][_0x1e35('0x197')]=function(_0x18a9b5,_0x5d67a9,_0x1e5b35,_0x1261fb){hopperUtils['moveContactManagedDialer'](_0x18a9b5)[_0x1e35('0x3f')](function(){return _0x5d67a9(msgResponse(_0x1e35('0x190'),_0x1e35('0x105'),_0x1261fb));})[_0x1e35('0x9d')](function(){return _0x1e5b35(msgResponse('[moveContactManagedDialer][0]',_0x1e35('0x90'),_0x1e35('0x1b3')));});};Dialer['prototype']['predictive']=function(_0x5a45d6){var _0x4b4279=_0x5a45d6[_0x1e35('0x1b4')]/0x64;var _0x315d1a=_0x5a45d6[_0x1e35('0xcf')]/(_0x5a45d6['outboundDropCallsDayTimeout']+_0x5a45d6['outboundAnswerCallsDay']);var _0x2cf5b0=Math[_0x1e35('0x1b5')](_0x5a45d6[_0x1e35('0x1b6')]*(_0x5a45d6[_0x1e35('0x1b7')]/0x64));var _0x13acaf=Math[_0x1e35('0x1b5')](_0x5a45d6[_0x1e35('0x1b6')]*(_0x5a45d6['predictiveIntervalMinThreshold']/0x64));var _0x2de555=_0x5a45d6[_0x1e35('0x135')]+_0x5a45d6[_0x1e35('0x1b8')];var _0x4590aa=Math[_0x1e35('0x1b9')](_0x5a45d6['erlangCalls']*_0x5a45d6['erlangAbandonmentRate']*_0x5a45d6[_0x1e35('0x1ba')]*_0x5a45d6[_0x1e35('0x1bb')]);if(_['isUndefined'](_0x5a45d6[_0x1e35('0x26')])){if(!_[_0x1e35('0x41')](_0x5a45d6['startPredictive'])){_0x5a45d6[_0x1e35('0x25')]=undefined;loggerPredictive[_0x1e35('0x64')]('[startMethodPredictive][StartProgressive]',_0x1e35('0x1bc'));}if(!_[_0x1e35('0x41')](_0x5a45d6[_0x1e35('0x62')])){loggerPredictive['error'](_0x1e35('0x1bd'),_0x1e35('0x1be'));clearInterval(_0x5a45d6['handlePredictive']);_0x5a45d6['handlePredictive']=undefined;}_0x5a45d6[_0x1e35('0x26')]=moment()[_0x1e35('0x46')](_0x1e35('0xc3'));loggerPredictive['info'](_0x5a45d6[_0x1e35('0x48')],_0x1e35('0x1bf'),_0x5a45d6[_0x1e35('0x26')]);this[_0x1e35('0xb2')](_0x5a45d6,0x1);}else if(ifInterval(_0x5a45d6['dialPredictiveInterval'],_0x5a45d6['startProgressive'])){this[_0x1e35('0xb2')](_0x5a45d6,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x5a45d6[_0x1e35('0x26')],_0x5a45d6['name']);_0x5a45d6[_0x1e35('0x5b')]=0x0;_0x5a45d6[_0x1e35('0xd0')]=0x0;}else if(_0x4b4279<_0x315d1a&&_0x5a45d6['dialPredictiveOptimization']===_0x1e35('0x1c0')){clearPredictiveAttributes(_0x5a45d6);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x1c1'),_0x1e35('0x1c2'),_0x315d1a,_0x1e35('0x26'),_0x5a45d6[_0x1e35('0x48')]);}else if(_0x4590aa<_0x5a45d6[_0x1e35('0xd0')]&&_0x5a45d6[_0x1e35('0x1c3')]===_0x1e35('0x1c0')){clearPredictiveAttributes(_0x5a45d6);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x1c4'),'Max\x20Drop\x20',_0x4590aa,_0x1e35('0x1c5'),_0x5a45d6['predictiveIntervalErlangCallsDroppedCalls'],_0x1e35('0x26'),_0x5a45d6[_0x1e35('0x48')]);}else if(!ifInterval(_0x5a45d6['dialPredictiveInterval'],_0x5a45d6[_0x1e35('0x26')])&&_[_0x1e35('0x41')](_0x5a45d6['startPredictive'])&&!_[_0x1e35('0x41')](_0x5a45d6[_0x1e35('0x26')])){_0x5a45d6[_0x1e35('0x25')]=moment()['format'](_0x1e35('0xc3'));loggerPredictive['info'](_0x5a45d6[_0x1e35('0x48')],_0x1e35('0x1c6'),_0x5a45d6[_0x1e35('0x25')]);hopperUtils['avgHandleTime'](_0x5a45d6['dialPredictiveInterval'])[_0x1e35('0x3f')](this[_0x1e35('0x1c7')](_0x5a45d6))[_0x1e35('0x3f')](mergeDataErlangB(_0x5a45d6))['then'](this['startMethodPredictive'](_0x5a45d6))[_0x1e35('0x9d')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5a45d6));}else if(!ifInterval(_0x5a45d6[_0x1e35('0x1c8')],_0x5a45d6[_0x1e35('0x25')])){_0x5a45d6[_0x1e35('0xd0')]=0x0;_0x5a45d6[_0x1e35('0x25')]=moment()[_0x1e35('0x46')](_0x1e35('0xc3'));loggerPredictive[_0x1e35('0x4b')](_0x5a45d6['name'],_0x1e35('0x1c9'),_0x5a45d6[_0x1e35('0x25')]);clearInterval(_0x5a45d6['handlePredictive']);_0x5a45d6['handlePredictive']=undefined;hopperUtils[_0x1e35('0x1ca')](_0x5a45d6[_0x1e35('0x1c8')])[_0x1e35('0x3f')](this['getDataPredictive'](_0x5a45d6))[_0x1e35('0x3f')](mergeDataErlangB(_0x5a45d6))[_0x1e35('0x3f')](this[_0x1e35('0x1cb')](_0x5a45d6))[_0x1e35('0x9d')](loggerCatchPredictive(_0x1e35('0x1cc'),_0x5a45d6));}else if(_0x5a45d6[_0x1e35('0x1b6')]&&_0x2de555<_0x5a45d6['predictiveIntervalAvailable']-_0x13acaf){clearPredictiveAttributes(_0x5a45d6);loggerPredictive[_0x1e35('0x4b')](_0x5a45d6['name'],_0x1e35('0x1cd'),_0x2de555,_0x1e35('0x1ce'),_0x5a45d6['predictiveIntervalAvailable'],'-',_0x13acaf,'=',_0x5a45d6['predictiveIntervalAvailable']-_0x13acaf,')');}else if(_0x5a45d6[_0x1e35('0x1b6')]&&_0x2de555>_0x5a45d6[_0x1e35('0x1b6')]+_0x2cf5b0){clearPredictiveAttributes(_0x5a45d6);loggerPredictive[_0x1e35('0x4b')](_0x5a45d6[_0x1e35('0x48')],_0x1e35('0x1cd'),_0x2de555,_0x1e35('0x1cf'),_0x5a45d6['predictiveIntervalAvailable'],'+',_0x2cf5b0,'=',_0x5a45d6[_0x1e35('0x1b6')]+_0x2cf5b0,')');}};Dialer[_0x1e35('0x17')]['getDataPredictive']=function(_0x34e9d6){var _0x423d94=this;return function(_0x4cec43){return new Promise(function(_0x4df008,_0x8e3179){_['merge'](_0x34e9d6,_0x4cec43[0x0]);if(checkGetDataPredictive(_0x4cec43[0x0])){var _0x3b535e=_0x34e9d6['predictiveIntervalAvailable']=_0x34e9d6[_0x1e35('0x1b8')]+_0x34e9d6['available'];var _0xf696e9=_0x34e9d6['dialPredictiveInterval']*0x3c;var _0x36197b=_0x4cec43[0x0][_0x1e35('0x53')]+_0x4cec43[0x0][_0x1e35('0x56')];var _0x19ab03=(_0x4cec43[0x0][_0x1e35('0x4f')]+_0x4cec43[0x0][_0x1e35('0x51')]+_0x4cec43[0x0][_0x1e35('0xe9')])/_0x4cec43[0x0][_0x1e35('0x1d0')];_0x34e9d6['predictiveIntervalHitRate']=_0x19ab03>0x0?_0x19ab03:0x1;switch(_0x34e9d6[_0x1e35('0x1c3')]){case _0x1e35('0x1c0'):var _0x25c64d=_0x34e9d6[_0x1e35('0x1b4')]/0x64;return _0x423d94['abandonmentRate'](_0x3b535e,_0xf696e9,_0x36197b,_0x19ab03,_0x25c64d)[_0x1e35('0x3f')](function(_0x12fc82){return _0x4df008(_0x12fc82);});case'agentBusyFactor':var _0x540bb8=_0x34e9d6['dialPredictiveOptimizationPercentage']/0x64;return _0x423d94['busyFactor'](_0x3b535e,_0xf696e9,_0x36197b,_0x19ab03,_0x540bb8)[_0x1e35('0x3f')](function(_0x49d153){return _0x4df008(_0x49d153);});default:return _0x8e3179(msgResponse(_0x1e35('0x1d1'),'Failure',_0x1e35('0x1d2')));}}else{return _0x8e3179(msgResponse(_0x1e35('0x1d1'),_0x1e35('0x90'),'check\x20failure'));}});};};Dialer[_0x1e35('0x17')][_0x1e35('0x1d3')]=function(_0x14be08){var _0x59e1d0=this;return function(_0x4a4f61){return new Promise(function(_0xc5d9de,_0x272704){_[_0x1e35('0x61')](_0x14be08,_0x4a4f61[0x0]);if(checkGetDataPredictive(_0x4a4f61[0x0])){loggerPredictive[_0x1e35('0x4b')](JSON[_0x1e35('0xa4')](_0x4a4f61[0x0]));if(_0x14be08['dialPredictiveOptimization']==='dropRate'){return _0x59e1d0['getVoiceQueueRtPauses'](_0x14be08['id'])[_0x1e35('0x3f')](function(_0x342e9b){var _0x298669=_0x14be08[_0x1e35('0x1d4')]-_0x342e9b[0x0]['outboundQueuePauses'];var _0x2bcc44=_0x14be08[_0x1e35('0x1c8')]*0x3c;var _0x462f50=_0x4a4f61[0x0][_0x1e35('0x53')]+_0x4a4f61[0x0][_0x1e35('0x56')];var _0x1b4a90=(_0x4a4f61[0x0][_0x1e35('0x4f')]+_0x4a4f61[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4a4f61[0x0][_0x1e35('0xe9')])/_0x4a4f61[0x0][_0x1e35('0x1d0')];var _0x16a140=_0x14be08[_0x1e35('0x1b4')]/0x64;_0x14be08[_0x1e35('0x1d5')]=_0x342e9b[0x0][_0x1e35('0x1d6')]||0x0;_0x14be08[_0x1e35('0x1ba')]=_0x1b4a90>0x0?_0x1b4a90:0x1;return _0x59e1d0['abandonmentRate'](_0x298669,_0x2bcc44,_0x462f50,_0x1b4a90,_0x16a140);})[_0x1e35('0x3f')](function(_0x5424a5){return _0xc5d9de(_0x5424a5);})[_0x1e35('0x9d')](function(_0x468ac4){return _0x272704(msgResponse(_0x1e35('0x1d7'),_0x1e35('0x90'),JSON[_0x1e35('0xa4')](_0x468ac4)));});}if(_0x14be08[_0x1e35('0x1c3')]==='agentBusyFactor'){return _0x59e1d0[_0x1e35('0x149')](_0x14be08['id'])[_0x1e35('0x3f')](function(_0x11067c){var _0x4c896b=_0x14be08[_0x1e35('0x1d4')]-_0x11067c[0x0][_0x1e35('0x1d6')];var _0x2d1853=_0x14be08[_0x1e35('0x1c8')]*0x3c;var _0x189371=_0x4a4f61[0x0]['predictiveIntervalAvgTalktime']+_0x4a4f61[0x0][_0x1e35('0x56')];var _0x290f76=(_0x4a4f61[0x0][_0x1e35('0x4f')]+_0x4a4f61[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4a4f61[0x0][_0x1e35('0xe9')])/_0x4a4f61[0x0][_0x1e35('0x1d0')];var _0xd730fd=_0x14be08[_0x1e35('0x1b4')]/0x64;_0x14be08[_0x1e35('0x1d5')]=_0x11067c[0x0]['outboundQueuePauses']||0x0;_0x14be08[_0x1e35('0x1ba')]=_0x290f76>0x0?_0x290f76:0x1;return _0x59e1d0[_0x1e35('0x1d8')](_0x4c896b,_0x2d1853,_0x189371,_0x290f76,_0xd730fd);})[_0x1e35('0x3f')](function(_0x18bcec){return _0xc5d9de(_0x18bcec);})[_0x1e35('0x9d')](function(_0x2a59c4){return _0x272704(msgResponse(_0x1e35('0x1d7'),_0x1e35('0x90'),JSON[_0x1e35('0xa4')](_0x2a59c4)));});}}else{return _0x272704(msgResponse('[getDataPredictive]',_0x1e35('0x90'),_0x1e35('0x1d9')));}});};};Dialer[_0x1e35('0x17')][_0x1e35('0x1cb')]=function(_0x5afbbc){var _0x207df0=this;return function(){var _0x54f1ca=0x0;var _0x3fe2ac=Math[_0x1e35('0x1b9')](_0x5afbbc[_0x1e35('0x5c')]*0x3e8);if(_0x3fe2ac>0x0){_0x3fe2ac=_0x3fe2ac<0x64?0x64:_0x3fe2ac;loggerPredictive['info'](_0x5afbbc['name'],'one\x20call\x20every:',_0x3fe2ac,_0x1e35('0x1da'));_0x5afbbc[_0x1e35('0x62')]=setInterval(function(){_0x207df0['handlePredictive'](_0x5afbbc);loggerPredictiveCalls[_0x1e35('0x4b')](_0x1e35('0x1db'),_0x54f1ca+=0x1);},_0x3fe2ac);}else{loggerPredictive['info'](_0x5afbbc[_0x1e35('0x48')],_0x1e35('0x1dc'));}};};Dialer[_0x1e35('0x17')][_0x1e35('0x1dd')]=function(_0x560f9f,_0x1eeb61){var _0x145bee=this;return function(_0x1b79c5){if(_[_0x1e35('0x4a')](_0x1b79c5)){if(_[_0x1e35('0xf4')](_0x1eeb61['UserId'])||!_0x1eeb61[_0x1e35('0x1de')]){if(_0x560f9f[_0x1e35('0xb0')]===_0x1e35('0x9')){_0x560f9f['queueStatusComplete']=_[_0x1e35('0x41')](_0x560f9f[_0x1e35('0x72')])?!![]:_0x560f9f['queueStatusComplete'];var _0x38a248=uuid['v4']();_0x145bee[_0x1e35('0x21')][_0x38a248]=new Action(_0x560f9f,_0x1eeb61,_0x38a248);loggerBooked[_0x1e35('0x4b')](_0x1e35('0x1df'),_0x38a248,'queueStatusComplete:\x20',JSON['stringify'](_0x560f9f[_0x1e35('0x72')]),_0x1e35('0x1e0'),_0x560f9f[_0x1e35('0x48')]);if(_0x560f9f['queueStatusComplete']){_0x560f9f['queueStatusComplete']=![];_0x145bee[_0x1e35('0x28')][_0x145bee[_0x1e35('0x21')][_0x38a248]['queue']]=[];ami[_0x1e35('0x146')]({'actionid':_0x38a248,'action':_0x1e35('0x1e1'),'queue':_0x560f9f[_0x1e35('0x48')]})['catch'](function(){_0x145bee[_0x1e35('0xc1')](_0x560f9f);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x145bee[_0x1e35('0x21')][_0x38a248][_0x1e35('0xdf')],'ListId':_0x145bee[_0x1e35('0x21')][_0x38a248][_0x1e35('0xe0')],'VoiceQueueId':_0x145bee[_0x1e35('0x21')][_0x38a248]['VoiceQueueId']||undefined,'CampaignId':_0x145bee[_0x1e35('0x21')][_0x38a248][_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1e2')));delete _0x145bee[_0x1e35('0x21')][_0x38a248];});}else{loggerBooked[_0x1e35('0x4b')]('[booked][checkContactBlack][else]',JSON[_0x1e35('0xa4')](_0x560f9f[_0x1e35('0x72')]),_0x1e35('0x1e0'),_0x560f9f['name']);_0x145bee[_0x1e35('0xc1')](_0x560f9f);hopperUtils[_0x1e35('0xdc')]({'active':![],'ContactId':_0x145bee[_0x1e35('0x21')][_0x38a248]['ContactId'],'ListId':_0x145bee['actions'][_0x38a248]['ListId'],'VoiceQueueId':_0x145bee[_0x1e35('0x21')][_0x38a248][_0x1e35('0xe1')]||undefined,'CampaignId':_0x145bee[_0x1e35('0x21')][_0x38a248]['CampaignId']||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1e2')));delete _0x145bee[_0x1e35('0x21')][_0x38a248];}}else{return _0x145bee[_0x1e35('0x154')](_0x560f9f,_0x1eeb61);}}else{if(utils[_0x1e35('0xcc')](undefined,_0x1eeb61[_0x1e35('0x1e3')])<_0x560f9f['dialRecallMeTimeout']*0x3c){if(_0x1eeb61[_0x1e35('0x151')]&&!_0x1eeb61[_0x1e35('0x151')]['voicePause']){_0x145bee[_0x1e35('0x1b')]['run'](_0x1eeb61['id'])['finally'](function(){_0x145bee[_0x1e35('0xc1')](_0x560f9f);});}else{hopperUtils[_0x1e35('0x1e4')]({'active':![]},_0x1eeb61['id'],0x1)['finally'](function(){_0x145bee[_0x1e35('0xc1')](_0x560f9f);});}}else{_0x560f9f['outboundReCallsDay']+=0x1;_0x145bee[_0x1e35('0xc1')](_0x560f9f);if(_0x560f9f[_0x1e35('0x1e5')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1eeb61[_0x1e35('0xdf')],'ListId':_0x1eeb61['ListId'],'VoiceQueueId':_0x1eeb61[_0x1e35('0xe1')]||undefined,'CampaignId':_0x1eeb61[_0x1e35('0xe2')]||undefined})[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1e6')));hopperUtils['createHistory'](createObjHistory(_0x560f9f,_0x1eeb61,utils[_0x1e35('0x69')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1e7')));}else{_0x145bee[_0x1e35('0x112')](createObjHistory(_0x560f9f,_0x1eeb61,utils['CAMPAIGN_STATUS'][_0x1e35('0x1e8')],0x16,_0x1e35('0x1e9')),_0x1e35('0x1ea'),_0x1e35('0x1eb'));}}}}else{_0x560f9f[_0x1e35('0x1ec')]+=0x1;_0x145bee[_0x1e35('0x112')](createObjHistory(_0x560f9f,_0x1eeb61,utils['CAMPAIGN_STATUS'][_0x1e35('0x1ed')],0xd,_0x1e35('0x1ee')),'[Originate][historyBlacklist]',_0x1e35('0x1ef'));throw _0x1e35('0x1f0');}};};Dialer[_0x1e35('0x17')][_0x1e35('0x1f1')]=function(_0x266234){var _0x25b03a=this;var _0x2bd7c9=_0x266234[_0x1e35('0x1f2')]-_0x266234[_0x1e35('0x7f')];emitCampaignSummary(_0x266234);if(_0x2bd7c9>0x0&&_0x266234[_0x1e35('0x1f3')]==0x0){if(_0x2bd7c9>this[_0x1e35('0x1f4')]){_0x2bd7c9=this[_0x1e35('0x1f4')];}_0x266234[_0x1e35('0x1f3')]=0x1;hopperUtils[_0x1e35('0x1f5')](_0x266234,_0x2bd7c9)[_0x1e35('0x3f')](function(_0x216934){_0x266234[_0x1e35('0x1f3')]=0x0;if(_0x216934){if(!utils[_0x1e35('0x1f6')](_0x216934)){_0x266234[_0x1e35('0x6c')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x1e35('0x4b')]('[getContactCampaign2][Empty]'+_0x266234[_0x1e35('0x48')]);}else{_0x266234[_0x1e35('0x7f')]+=_0x216934[_0x1e35('0x97')];_0x266234['message']=utils[_0x1e35('0x69')][_0x1e35('0x1f7')];for(var _0x4f1450=0x0;_0x4f1450<_0x216934['length'];_0x4f1450+=0x1){_0x266234[_0x1e35('0x1f8')]+=0x1;if(_[_0x1e35('0xf4')](_0x216934[_0x4f1450])||_['isNil'](_0x216934[_0x4f1450]['Contact'])||_[_0x1e35('0xf4')](_0x216934[_0x4f1450][_0x1e35('0x158')])){_0x25b03a[_0x1e35('0x14c')]('[actionOriginate]\x20',_0x266234,_0x216934[_0x4f1450]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x1e35('0x75')](_0x216934[_0x4f1450],[_0x1e35('0xe2'),'phone']))[_0x1e35('0x3f')](_0x25b03a[_0x1e35('0x1dd')](_0x266234,_0x216934[_0x4f1450]))[_0x1e35('0x9d')](_0x25b03a[_0x1e35('0x14b')](_0x1e35('0x1f9'),_0x266234));}}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x266234,_0x2bd7c9));}};Dialer[_0x1e35('0x17')][_0x1e35('0xb2')]=function(_0x1cc88e,_0x2dbb88){var _0x1992f1=this;var _0x2c11d5=[];if(_0x2dbb88<0x1||_0x1cc88e['dialMethod']===_0x1e35('0x9')){_0x2dbb88=0x1;}var _0x21de71=Math[_0x1e35('0x1b9')](_0x1cc88e[_0x1e35('0x135')]*_0x2dbb88)-_0x1cc88e['originated'];if(_0x1cc88e[_0x1e35('0x1fa')]>0x0){var _0x2add84=_0x1cc88e[_0x1e35('0x1fa')]-_0x1cc88e[_0x1e35('0x7f')]-_0x1cc88e['talking']-_0x1cc88e[_0x1e35('0x1fb')];if(_0x21de71>_0x2add84){_0x21de71=_0x2add84;}}if(_0x21de71>0x0&&_0x1cc88e[_0x1e35('0x1f3')]==0x0){if(_0x1cc88e['dialMethod']===_0x1e35('0x9')){_0x21de71=0x1;}if(_0x21de71>this['maxNumberOriginate']){_0x21de71=this['maxNumberOriginate'];}for(var _0x4a4bd0 in this[_0x1e35('0x1e')]){if(typeof this[_0x1e35('0x1e')][_0x4a4bd0]!==_0x1e35('0x1fc')){if(this['agents'][_0x4a4bd0][_0x1e35('0x6f')]===_0x1e35('0x1fd')&&this[_0x1e35('0x1e')][_0x4a4bd0][_0x1e35('0x87')]===_0x1e35('0x88')){_0x2c11d5['push'](this[_0x1e35('0x1e')][_0x4a4bd0]['id']);}}}_0x1cc88e[_0x1e35('0x1f3')]=0x1;hopperUtils['getContactDialer'](_0x1cc88e,_0x2c11d5,_0x21de71)['then'](function(_0x29f9fe){_0x1cc88e[_0x1e35('0x1f3')]=0x0;if(_0x29f9fe){if(!utils[_0x1e35('0x1f6')](_0x29f9fe)){hopperUtils[_0x1e35('0x1fe')](_0x1cc88e)[_0x1e35('0x3f')](sendMessageReschedule(_0x1cc88e))['catch'](loggerCatch(_0x1e35('0x1ff')));}else{_0x1cc88e[_0x1e35('0x7f')]+=_0x29f9fe[_0x1e35('0x97')];_0x1cc88e[_0x1e35('0x6c')]=_0x1cc88e[_0x1e35('0xb0')]==='booked'?utils[_0x1e35('0x69')][_0x1e35('0x137')]:utils[_0x1e35('0x69')]['RUNNING'];for(var _0x5be6d8=0x0;_0x5be6d8<_0x29f9fe['length'];_0x5be6d8+=0x1){if(_[_0x1e35('0xf4')](_0x29f9fe[_0x5be6d8])||_[_0x1e35('0xf4')](_0x29f9fe[_0x5be6d8][_0x1e35('0x200')])||_[_0x1e35('0xf4')](_0x29f9fe[_0x5be6d8][_0x1e35('0x158')])){_0x1992f1[_0x1e35('0x14c')](_0x1e35('0x201'),_0x1cc88e,_0x29f9fe[_0x5be6d8]);}else{hopperUtils[_0x1e35('0x202')](_[_0x1e35('0x75')](_0x29f9fe[_0x5be6d8],[_0x1e35('0xe1'),_0x1e35('0x158')]))[_0x1e35('0x3f')](_0x1992f1[_0x1e35('0x1dd')](_0x1cc88e,_0x29f9fe[_0x5be6d8]))[_0x1e35('0x9d')](_0x1992f1['loggerHandler'](_0x1e35('0x201'),_0x1cc88e));}}}}})[_0x1e35('0x9d')](loggerGetContactDialer(_0x1e35('0x203'),_0x1cc88e,_0x21de71));}};Dialer[_0x1e35('0x17')][_0x1e35('0x62')]=function(_0x17d9d3){if(_0x17d9d3['dialLimitQueue']>0x0){var _0x7edfb5=_0x17d9d3['dialLimitQueue']-_0x17d9d3['originated']-_0x17d9d3[_0x1e35('0x1b8')];if(_0x7edfb5>0x0&&_0x17d9d3[_0x1e35('0x1f3')]==0x0){this[_0x1e35('0x204')](_0x17d9d3);}else{loggerPredictiveCalls[_0x1e35('0x4b')](_0x1e35('0x205'));}}else{this['tryOriginatePredictive'](_0x17d9d3);}};Dialer['prototype'][_0x1e35('0x204')]=function(_0x1b61b0){var _0x398ec3=this;var _0x4fe6bb=[];_0x1b61b0[_0x1e35('0x7f')]+=0x1;for(var _0x24cb37 in this['agents']){if(typeof this['agents'][_0x24cb37]!==_0x1e35('0x1fc')){if(this[_0x1e35('0x1e')][_0x24cb37]['state']==='not_inuse'&&this['agents'][_0x24cb37]['status']==='reachable'){_0x4fe6bb[_0x1e35('0x98')](this[_0x1e35('0x1e')][_0x24cb37]['id']);}}}_0x1b61b0[_0x1e35('0x1f3')]=0x1;return this[_0x1e35('0x206')](_0x1b61b0['id'],_0x4fe6bb,0x1,_0x1b61b0['dialOrderByScheduledAt'],_0x1b61b0)['then'](function(_0x5f542a){_0x1b61b0[_0x1e35('0x1f3')]=0x1;if(_0x5f542a){if(!utils[_0x1e35('0x1f6')](_0x5f542a)){utils[_0x1e35('0x67')](_0x1b61b0,0x1,0x0);return hopperUtils[_0x1e35('0x1fe')](_0x1b61b0)[_0x1e35('0x3f')](sendMessageReschedule(_0x1b61b0))[_0x1e35('0x9d')](loggerCatch(_0x1e35('0x1ff')));}else{_0x1b61b0[_0x1e35('0x6c')]=utils[_0x1e35('0x69')]['RUNNING'];if(_['isNil'](_0x5f542a[0x0])||_['isNil'](_0x5f542a[0x0][_0x1e35('0x200')])||_[_0x1e35('0xf4')](_0x5f542a[0x0][_0x1e35('0x158')])){_0x398ec3[_0x1e35('0x14c')](_0x1e35('0x201'),_0x1b61b0,_0x5f542a[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x5f542a[0x0],[_0x1e35('0xe1'),_0x1e35('0x158')]))[_0x1e35('0x3f')](_0x398ec3[_0x1e35('0x1dd')](_0x1b61b0,_0x5f542a[0x0]))[_0x1e35('0x9d')](_0x398ec3['loggerHandler']('[actionOriginatePredictive]\x20',_0x1b61b0));}}}})[_0x1e35('0x9d')](loggerGetContactDialer(_0x1e35('0x207'),_0x1b61b0,0x1));};Dialer[_0x1e35('0x17')]['abandonmentRate']=function(_0x2a10e8,_0x481dfd,_0xa72574,_0x2cef2f,_0x3e5fac,_0x1f0607){loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x208'));loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x209'),_0x2a10e8);loggerPredictive['info'](_0x1e35('0x20a'),_0x481dfd);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20b'),_0xa72574);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20c'),_0x2cef2f);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20d'),_0x3e5fac);loggerPredictive['info'](_0x1e35('0x54'));return new Promise(function(_0x33a83d,_0x35fe16){if(_0x2a10e8<=0x0||isNaN(_0x2a10e8)){return _0x35fe16(msgResponse('[abandonmentRate]','Error',_0x1e35('0x20e')+_0x2a10e8));}if(_0xa72574<=0x0||isNaN(_0xa72574)){return _0x35fe16(msgResponse(_0x1e35('0x20f'),'Error',_0x1e35('0x210')+_0xa72574));}if(_0x2cef2f<=0x0||isNaN(_0x2cef2f)){return _0x35fe16(msgResponse(_0x1e35('0x20f'),_0x1e35('0x83'),'p\x20=\x20'+_0x2cef2f));}if(_0x481dfd<=0x0||isNaN(_0x481dfd)){return _0x35fe16(msgResponse(_0x1e35('0x20f'),_0x1e35('0x83'),_0x1e35('0x211')+_0x481dfd));}if(_0x3e5fac<=0x0||isNaN(_0x3e5fac)){return _0x35fe16(msgResponse(_0x1e35('0x20f'),_0x1e35('0x83'),'Amax\x20=\x20'+_0x3e5fac));}_0x1f0607=_0x1f0607||0x0;var _0x29af51=0x1/_0xa72574;var _0x4864c3=0x0;var _0x5e34a9=0x0;var _0x3c8950=0x0;var _0x5f1621=0x0;for(var _0x1b35f4=0x0;_0x3c8950<_0x3e5fac;_0x1b35f4+=0x1){_0x5e34a9=_0x1b35f4/_0x481dfd;_0x4864c3=(_0x2cef2f*_0x5e34a9+_0x1f0607)/_0x29af51;_0x3c8950=utils[_0x1e35('0x212')](_0x4864c3,_0x2a10e8);_0x5f1621=_0x4864c3/_0x2a10e8*(0x1-utils['erlangb'](_0x4864c3,_0x2a10e8));}return _0x33a83d({'erlangCalls':_0x1b35f4,'erlangCallToSecond':_0x481dfd/_0x1b35f4,'erlangAbandonmentRate':_0x3c8950,'erlangBusyFactor':_0x5f1621});});};Dialer[_0x1e35('0x17')][_0x1e35('0x1d8')]=function(_0x55260b,_0x5bcdda,_0x1682db,_0x711518,_0x306e2b,_0x116e1e){loggerPredictive['info'](_0x1e35('0x213'));loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x209'),_0x55260b);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20a'),_0x5bcdda);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20b'),_0x1682db);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x20c'),_0x711518);loggerPredictive[_0x1e35('0x4b')](_0x1e35('0x214'),_0x306e2b);loggerPredictive['info'](_0x1e35('0x54'));return new Promise(function(_0x104884,_0x422c2e){if(_0x55260b<=0x0||isNaN(_0x55260b)){return _0x422c2e(msgResponse(_0x1e35('0x215'),_0x1e35('0x83'),'m\x20=\x20'+_0x55260b));}if(_0x1682db<=0x0||isNaN(_0x1682db)){return _0x422c2e(msgResponse(_0x1e35('0x215'),_0x1e35('0x83'),_0x1e35('0x210')+_0x1682db));}if(_0x711518<=0x0||isNaN(_0x711518)){return _0x422c2e(msgResponse(_0x1e35('0x215'),_0x1e35('0x83'),_0x1e35('0x216')+_0x711518));}if(_0x5bcdda<=0x0||isNaN(_0x5bcdda)){return _0x422c2e(msgResponse(_0x1e35('0x215'),'Error',_0x1e35('0x211')+_0x5bcdda));}if(_0x306e2b<=0x0||isNaN(_0x306e2b)){return _0x422c2e(msgResponse('[busyFactor]',_0x1e35('0x83'),_0x1e35('0x217')+_0x306e2b));}_0x116e1e=_0x116e1e||0x0;var _0x4d2af8=0x1/_0x1682db;var _0x1eafd6=0x0;var _0x254d8d=0x0;var _0x2a6241=0x0;var _0x11ee70=0x0;for(var _0x272204=0x0;_0x11ee70<_0x306e2b;_0x272204+=0x1){_0x254d8d=_0x272204/_0x5bcdda;_0x1eafd6=(_0x711518*_0x254d8d+_0x116e1e)/_0x4d2af8;_0x2a6241=utils[_0x1e35('0x212')](_0x1eafd6,_0x55260b);_0x11ee70=_0x1eafd6/_0x55260b*(0x1-utils[_0x1e35('0x212')](_0x1eafd6,_0x55260b));}return _0x104884({'erlangCalls':_0x272204,'erlangCallToSecond':_0x5bcdda/_0x272204,'erlangAbandonmentRate':_0x2a6241,'erlangBusyFactor':_0x11ee70});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 17ffd2c..f4a0f5d 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d91=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','util','lodash','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x388826,_0xd23e67){var _0x1173e3=function(_0x1750c6){while(--_0x1750c6){_0x388826['push'](_0x388826['shift']());}};_0x1173e3(++_0xd23e67);}(_0x3d91,0x114));var _0x13d9=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0x3d91[_0x28cddc];return _0x5ce855;};'use strict';var util=require(_0x13d9('0x0'));var _=require(_0x13d9('0x1'));var moment=require('moment');function checkNameSurname(_0xc43f47,_0x13b0af,_0x531314){var _0x51a514='';if(!_[_0x13d9('0x2')](_0x13b0af)&&'string'===typeof _0x13b0af){_0x51a514+=_0x13b0af;}if(!_['isNil'](_0x531314)&&'string'===typeof _0x531314){_0x51a514+='\x20'+_0x531314;}if(_0x51a514!==''){return _0x51a514;}return _0xc43f47;}function Action(_0x578cf3,_0x417da4,_0x235770){this[_0x13d9('0x3')]=_0x578cf3;this[_0x13d9('0x4')]=_0x235770||undefined;this[_0x13d9('0x5')]=checkNameSurname(_0x417da4[_0x13d9('0x6')][_0x13d9('0x7')],_0x417da4[_0x13d9('0x6')][_0x13d9('0x8')],_0x417da4[_0x13d9('0x6')]['lastName']);this[_0x13d9('0x9')]=_0x417da4['phone'];this[_0x13d9('0xa')]=_0x578cf3['name'];this['active']=_0x417da4[_0x13d9('0xb')]||![];this[_0x13d9('0xc')]=_0x578cf3[_0x13d9('0xc')];this[_0x13d9('0xd')]=_0x578cf3[_0x13d9('0xd')]||0x3;this[_0x13d9('0xe')]=_0x417da4[_0x13d9('0xe')];this[_0x13d9('0xf')]=_0x417da4[_0x13d9('0xf')];this[_0x13d9('0x10')]=_0x417da4['countcongestionretry'];this[_0x13d9('0x11')]=_0x417da4[_0x13d9('0x11')];this['countnosuchnumberretry']=_0x417da4[_0x13d9('0x12')];this[_0x13d9('0x13')]=_0x417da4[_0x13d9('0x13')];this['countabandonedretry']=_0x417da4['countabandonedretry'];this[_0x13d9('0x14')]=_0x417da4[_0x13d9('0x14')];this[_0x13d9('0x15')]=_0x417da4['countagentrejectretry'];this[_0x13d9('0x16')]=_0x417da4[_0x13d9('0x16')];this['ListId']=_0x417da4[_0x13d9('0x17')];this[_0x13d9('0x18')]=_0x417da4['UserId'];this[_0x13d9('0x19')]=_0x417da4['VoiceQueueId'];this[_0x13d9('0x1a')]=_0x417da4[_0x13d9('0x1a')];this['idHopper']=_0x417da4['id'];this[_0x13d9('0x1b')]=_0x417da4[_0x13d9('0x6')][_0x13d9('0x8')]||'';this[_0x13d9('0x1c')]=moment()[_0x13d9('0x1d')](_0x13d9('0x1e'));this['callback']=_0x417da4[_0x13d9('0x1f')];this[_0x13d9('0x20')]=_0x417da4[_0x13d9('0x20')];this[_0x13d9('0x21')]=_0x417da4[_0x13d9('0x21')];this['recallme']=_0x417da4['recallme'];this[_0x13d9('0x22')]='';this[_0x13d9('0x23')]='';}Action[_0x13d9('0x24')]['getCaller']=function(){return util[_0x13d9('0x1d')](_0x13d9('0x25'),this[_0x13d9('0x5')],this[_0x13d9('0x3')]['dialCutDigit']>0x0?this[_0x13d9('0x9')][_0x13d9('0x26')](this[_0x13d9('0x3')][_0x13d9('0x27')]):this['number']);};Action[_0x13d9('0x24')][_0x13d9('0x28')]=function(){return this[_0x13d9('0xa')];};module[_0x13d9('0x29')]=Action; \ No newline at end of file +var _0x5268=['moment','isNil','string','uniqueid','phone','Contact','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','voiceQueue','dialCutDigit','substring','prototype','getQueue','util','lodash'];(function(_0xbe31d1,_0x126345){var _0x7bd03=function(_0xbcacac){while(--_0xbcacac){_0xbe31d1['push'](_0xbe31d1['shift']());}};_0x7bd03(++_0x126345);}(_0x5268,0x193));var _0x8526=function(_0x56e2cb,_0x11a7b1){_0x56e2cb=_0x56e2cb-0x0;var _0x3d84a6=_0x5268[_0x56e2cb];return _0x3d84a6;};'use strict';var util=require(_0x8526('0x0'));var _=require(_0x8526('0x1'));var moment=require(_0x8526('0x2'));function checkNameSurname(_0x3cfe33,_0x2c5336,_0x438fe4){var _0x549d5c='';if(!_[_0x8526('0x3')](_0x2c5336)&&'string'===typeof _0x2c5336){_0x549d5c+=_0x2c5336;}if(!_[_0x8526('0x3')](_0x438fe4)&&_0x8526('0x4')===typeof _0x438fe4){_0x549d5c+='\x20'+_0x438fe4;}if(_0x549d5c!==''){return _0x549d5c;}return _0x3cfe33;}function Action(_0x4620f7,_0x28e6c4,_0x2cf479){this['voiceQueue']=_0x4620f7;this[_0x8526('0x5')]=_0x2cf479||undefined;this['name']=checkNameSurname(_0x28e6c4['Contact'][_0x8526('0x6')],_0x28e6c4[_0x8526('0x7')]['firstName'],_0x28e6c4[_0x8526('0x7')][_0x8526('0x8')]);this['number']=_0x28e6c4[_0x8526('0x6')];this[_0x8526('0x9')]=_0x4620f7[_0x8526('0xa')];this[_0x8526('0xb')]=_0x28e6c4[_0x8526('0xb')]||![];this['type']=_0x4620f7[_0x8526('0xc')];this[_0x8526('0xd')]=_0x4620f7[_0x8526('0xd')]||0x3;this[_0x8526('0xe')]=_0x28e6c4[_0x8526('0xe')];this[_0x8526('0xf')]=_0x28e6c4['countbusyretry'];this['countcongestionretry']=_0x28e6c4[_0x8526('0x10')];this['countnoanswerretry']=_0x28e6c4[_0x8526('0x11')];this[_0x8526('0x12')]=_0x28e6c4[_0x8526('0x12')];this['countdropretry']=_0x28e6c4['countdropretry'];this[_0x8526('0x13')]=_0x28e6c4[_0x8526('0x13')];this[_0x8526('0x14')]=_0x28e6c4[_0x8526('0x14')];this[_0x8526('0x15')]=_0x28e6c4[_0x8526('0x15')];this[_0x8526('0x16')]=_0x28e6c4[_0x8526('0x16')];this[_0x8526('0x17')]=_0x28e6c4[_0x8526('0x17')];this[_0x8526('0x18')]=_0x28e6c4['UserId'];this[_0x8526('0x19')]=_0x28e6c4[_0x8526('0x19')];this['CampaignId']=_0x28e6c4[_0x8526('0x1a')];this[_0x8526('0x1b')]=_0x28e6c4['id'];this[_0x8526('0x1c')]=_0x28e6c4['Contact'][_0x8526('0x1d')]||'';this[_0x8526('0x1e')]=moment()[_0x8526('0x1f')](_0x8526('0x20'));this[_0x8526('0x21')]=_0x28e6c4[_0x8526('0x21')];this['callbackuniqueid']=_0x28e6c4[_0x8526('0x22')];this[_0x8526('0x23')]=_0x28e6c4[_0x8526('0x23')];this[_0x8526('0x24')]=_0x28e6c4['recallme'];this[_0x8526('0x25')]='';this[_0x8526('0x26')]='';}Action['prototype'][_0x8526('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x8526('0xa')],this[_0x8526('0x28')][_0x8526('0x29')]>0x0?this['number'][_0x8526('0x2a')](this[_0x8526('0x28')][_0x8526('0x29')]):this['number']);};Action[_0x8526('0x2b')][_0x8526('0x2c')]=function(){return this[_0x8526('0x9')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index ae7a6af..3cd68f8 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x808b=['reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','getSeconds','endtime','membername'];(function(_0x1a2fab,_0x59ab91){var _0x551460=function(_0x148f1b){while(--_0x148f1b){_0x1a2fab['push'](_0x1a2fab['shift']());}};_0x551460(++_0x59ab91);}(_0x808b,0x1cf));var _0xb808=function(_0x2b7ae8,_0x28947c){_0x2b7ae8=_0x2b7ae8-0x0;var _0x48d4b4=_0x808b[_0x2b7ae8];return _0x48d4b4;};'use strict';var moment=require(_0xb808('0x0'));var utils=require(_0xb808('0x1'));function AgentComplete(_0x40ae58,_0x12e25e){this['state']=0x4;this[_0xb808('0x2')]=_0xb808('0x3');this[_0xb808('0x4')]=_0x40ae58['scheduledat'];this['type']=_0x40ae58[_0xb808('0x5')];this[_0xb808('0x6')]=_0x40ae58[_0xb808('0x5')]==='outbound'?_0xb808('0x7'):_0x40ae58[_0xb808('0x5')];this[_0xb808('0x8')]=_0x40ae58[_0xb808('0x8')];this[_0xb808('0x9')]=_0x40ae58[_0xb808('0x9')];this[_0xb808('0xa')]=_0x40ae58['countnoanswerretry'];this[_0xb808('0xb')]=_0x40ae58[_0xb808('0x8')]+_0x40ae58[_0xb808('0x9')]+_0x40ae58[_0xb808('0xa')]+_0x40ae58[_0xb808('0xc')]+_0x40ae58[_0xb808('0xd')]+_0x40ae58[_0xb808('0xe')]+_0x40ae58[_0xb808('0xf')]+_0x40ae58[_0xb808('0x10')];this[_0xb808('0xc')]=_0x40ae58[_0xb808('0xc')];this[_0xb808('0xd')]=_0x40ae58[_0xb808('0xd')];this['countabandonedretry']=_0x40ae58[_0xb808('0xe')];this[_0xb808('0xf')]=_0x40ae58['countmachineretry'];this[_0xb808('0x10')]=_0x40ae58[_0xb808('0x10')];this['uniqueid']=_0x12e25e[_0xb808('0x11')];this[_0xb808('0x12')]=_0x40ae58[_0xb808('0x13')];this['calleridnum']=_0x40ae58['number'];this['starttime']=_0x40ae58['starttime'];this[_0xb808('0x14')]=_0x40ae58[_0xb808('0x14')];this[_0xb808('0x15')]=_0x40ae58[_0xb808('0x15')];this['endtime']=moment()['format'](_0xb808('0x16'));this[_0xb808('0x17')]=utils['getSeconds'](_0x40ae58[_0xb808('0x14')],_0x40ae58[_0xb808('0x18')]);this[_0xb808('0x19')]=utils[_0xb808('0x1a')](_0x40ae58[_0xb808('0x15')],_0x40ae58['responsetime']);this['talktime']=utils[_0xb808('0x1a')](this[_0xb808('0x1b')],_0x40ae58[_0xb808('0x15')]);this[_0xb808('0x7')]=_0x12e25e['queue'];this[_0xb808('0x1c')]=_0x12e25e[_0xb808('0x1c')];this['reason']=_0x12e25e[_0xb808('0x1d')];this['callback']=_0x40ae58['callback'];this['callbackuniqueid']=_0x40ae58[_0xb808('0x1e')];this[_0xb808('0x1f')]=_0x40ae58[_0xb808('0x1f')];this[_0xb808('0x20')]=_0x40ae58[_0xb808('0x20')];this[_0xb808('0x21')]=_0x40ae58[_0xb808('0x21')];this[_0xb808('0x22')]=_0x40ae58['ListId'];this['UserId']=_0x40ae58['UserId'];this[_0xb808('0x23')]=_0x40ae58[_0xb808('0x23')];this[_0xb808('0x24')]=_0x40ae58[_0xb808('0x24')];this[_0xb808('0x25')]=_0x40ae58[_0xb808('0x25')]||'';this['originatecalleridname']=_0x40ae58[_0xb808('0x26')]||'';this[_0xb808('0x27')]=_0x40ae58[_0xb808('0x27')];}module[_0xb808('0x28')]=AgentComplete; \ No newline at end of file +var _0x5af9=['recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x5ce766,_0x495d80){var _0x4a68f3=function(_0x39aa58){while(--_0x39aa58){_0x5ce766['push'](_0x5ce766['shift']());}};_0x4a68f3(++_0x495d80);}(_0x5af9,0x1ec));var _0x95af=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x5af9[_0x12b8ec];return _0x21af77;};'use strict';var moment=require(_0x95af('0x0'));var utils=require(_0x95af('0x1'));function AgentComplete(_0x56ae3b,_0x532506){this['state']=0x4;this[_0x95af('0x2')]=_0x95af('0x3');this[_0x95af('0x4')]=_0x56ae3b[_0x95af('0x4')];this['type']=_0x56ae3b[_0x95af('0x5')];this[_0x95af('0x6')]=_0x56ae3b[_0x95af('0x5')]===_0x95af('0x7')?_0x95af('0x8'):_0x56ae3b['type'];this[_0x95af('0x9')]=_0x56ae3b[_0x95af('0x9')];this[_0x95af('0xa')]=_0x56ae3b['countcongestionretry'];this['countnoanswerretry']=_0x56ae3b[_0x95af('0xb')];this[_0x95af('0xc')]=_0x56ae3b[_0x95af('0x9')]+_0x56ae3b[_0x95af('0xa')]+_0x56ae3b['countnoanswerretry']+_0x56ae3b[_0x95af('0xd')]+_0x56ae3b[_0x95af('0xe')]+_0x56ae3b[_0x95af('0xf')]+_0x56ae3b[_0x95af('0x10')]+_0x56ae3b['countagentrejectretry'];this[_0x95af('0xd')]=_0x56ae3b[_0x95af('0xd')];this[_0x95af('0xe')]=_0x56ae3b[_0x95af('0xe')];this[_0x95af('0xf')]=_0x56ae3b[_0x95af('0xf')];this[_0x95af('0x10')]=_0x56ae3b[_0x95af('0x10')];this[_0x95af('0x11')]=_0x56ae3b[_0x95af('0x11')];this[_0x95af('0x12')]=_0x532506['uniqueid'];this[_0x95af('0x13')]=_0x56ae3b[_0x95af('0x14')];this['calleridnum']=_0x56ae3b[_0x95af('0x15')];this[_0x95af('0x16')]=_0x56ae3b[_0x95af('0x16')];this[_0x95af('0x17')]=_0x56ae3b[_0x95af('0x17')];this[_0x95af('0x18')]=_0x56ae3b['answertime'];this[_0x95af('0x19')]=moment()[_0x95af('0x1a')](_0x95af('0x1b'));this['ringtime']=utils[_0x95af('0x1c')](_0x56ae3b['responsetime'],_0x56ae3b[_0x95af('0x16')]);this[_0x95af('0x1d')]=utils[_0x95af('0x1c')](_0x56ae3b['answertime'],_0x56ae3b['responsetime']);this[_0x95af('0x1e')]=utils[_0x95af('0x1c')](this['endtime'],_0x56ae3b[_0x95af('0x18')]);this[_0x95af('0x8')]=_0x532506['queue'];this[_0x95af('0x1f')]=_0x532506[_0x95af('0x1f')];this['reason']=_0x532506[_0x95af('0x20')];this['callback']=_0x56ae3b[_0x95af('0x21')];this[_0x95af('0x22')]=_0x56ae3b['callbackuniqueid'];this[_0x95af('0x23')]=_0x56ae3b[_0x95af('0x23')];this[_0x95af('0x24')]=_0x56ae3b['recallme'];this[_0x95af('0x25')]=_0x56ae3b[_0x95af('0x25')];this['ListId']=_0x56ae3b['ListId'];this[_0x95af('0x26')]=_0x56ae3b[_0x95af('0x26')];this[_0x95af('0x27')]=_0x56ae3b[_0x95af('0x27')];this[_0x95af('0x28')]=_0x56ae3b[_0x95af('0x28')];this[_0x95af('0x29')]=_0x56ae3b[_0x95af('0x29')]||'';this['originatecalleridname']=_0x56ae3b[_0x95af('0x2a')]||'';this[_0x95af('0x2b')]=_0x56ae3b[_0x95af('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 0b74db6..fe4cfcd 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a0f=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4a0753,_0x20cd48){var _0x195dbc=function(_0x5da949){while(--_0x5da949){_0x4a0753['push'](_0x4a0753['shift']());}};_0x195dbc(++_0x20cd48);}(_0x4a0f,0x143));var _0xf4a0=function(_0x2768d5,_0x577824){_0x2768d5=_0x2768d5-0x0;var _0x2c1e5c=_0x4a0f[_0x2768d5];return _0x2c1e5c;};'use strict';function Final(_0x307640){this[_0xf4a0('0x0')]=_0x307640['uniqueid'];this[_0xf4a0('0x1')]=_0x307640['scheduledat'];this[_0xf4a0('0x2')]=_0x307640[_0xf4a0('0x2')];this[_0xf4a0('0x3')]=_0x307640[_0xf4a0('0x2')]==='outbound'?'queue':_0x307640[_0xf4a0('0x2')];this['countbusyretry']=_0x307640[_0xf4a0('0x4')];this[_0xf4a0('0x5')]=_0x307640[_0xf4a0('0x5')];this[_0xf4a0('0x6')]=_0x307640['countnoanswerretry'];this[_0xf4a0('0x7')]=_0x307640[_0xf4a0('0x4')]+_0x307640[_0xf4a0('0x5')]+_0x307640[_0xf4a0('0x6')]+_0x307640[_0xf4a0('0x8')]+_0x307640[_0xf4a0('0x9')]+_0x307640['countabandonedretry']+_0x307640[_0xf4a0('0xa')]+_0x307640[_0xf4a0('0xb')];this[_0xf4a0('0x8')]=_0x307640[_0xf4a0('0x8')];this[_0xf4a0('0x9')]=_0x307640[_0xf4a0('0x9')];this[_0xf4a0('0xc')]=_0x307640[_0xf4a0('0xc')];this[_0xf4a0('0xa')]=_0x307640['countmachineretry'];this[_0xf4a0('0xb')]=_0x307640['countagentrejectretry'];this[_0xf4a0('0xd')]=_0x307640[_0xf4a0('0xd')];this[_0xf4a0('0xe')]=_0x307640[_0xf4a0('0xe')];this[_0xf4a0('0xf')]=_0x307640[_0xf4a0('0xf')];this['starttime']=_0x307640[_0xf4a0('0x10')];this['responsetime']=_0x307640[_0xf4a0('0x11')];this['endtime']=_0x307640[_0xf4a0('0x11')];this[_0xf4a0('0x12')]=_0x307640[_0xf4a0('0x12')]||0x0;this[_0xf4a0('0x13')]=_0x307640[_0xf4a0('0x13')]||0x0;this[_0xf4a0('0x14')]=_0x307640[_0xf4a0('0x14')]||0x0;this[_0xf4a0('0x15')]=_0x307640[_0xf4a0('0x15')];this['callbackuniqueid']=_0x307640[_0xf4a0('0x16')];this[_0xf4a0('0x17')]=_0x307640[_0xf4a0('0x17')];this[_0xf4a0('0x18')]=_0x307640[_0xf4a0('0x18')];this['ContactId']=_0x307640['ContactId'];this[_0xf4a0('0x19')]=_0x307640[_0xf4a0('0x19')];this[_0xf4a0('0x1a')]=_0x307640[_0xf4a0('0x1a')];this[_0xf4a0('0x1b')]=_0x307640['VoiceQueueId'];this[_0xf4a0('0x1c')]=_0x307640[_0xf4a0('0x1c')];this[_0xf4a0('0x1d')]=_0x307640[_0xf4a0('0x1d')]||'';this[_0xf4a0('0x1e')]=_0x307640['originatecalleridname']||'';this[_0xf4a0('0x1f')]=_0x307640['state'];this['statedesc']=_0x307640['statedesc'];}module[_0xf4a0('0x20')]=Final; \ No newline at end of file +var _0x7cdc=['statedesc','exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','responsetime','ringtime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridname','state'];(function(_0x13c108,_0x56ab5c){var _0x17ff51=function(_0x54a66a){while(--_0x54a66a){_0x13c108['push'](_0x13c108['shift']());}};_0x17ff51(++_0x56ab5c);}(_0x7cdc,0x15e));var _0xc7cd=function(_0x576374,_0x452727){_0x576374=_0x576374-0x0;var _0x31ff81=_0x7cdc[_0x576374];return _0x31ff81;};'use strict';function Final(_0x132c45){this['uniqueid']=_0x132c45[_0xc7cd('0x0')];this[_0xc7cd('0x1')]=_0x132c45['scheduledat'];this[_0xc7cd('0x2')]=_0x132c45[_0xc7cd('0x2')];this['campaigntype']=_0x132c45[_0xc7cd('0x2')]==='outbound'?_0xc7cd('0x3'):_0x132c45[_0xc7cd('0x2')];this[_0xc7cd('0x4')]=_0x132c45[_0xc7cd('0x4')];this[_0xc7cd('0x5')]=_0x132c45['countcongestionretry'];this[_0xc7cd('0x6')]=_0x132c45[_0xc7cd('0x6')];this[_0xc7cd('0x7')]=_0x132c45[_0xc7cd('0x4')]+_0x132c45[_0xc7cd('0x5')]+_0x132c45[_0xc7cd('0x6')]+_0x132c45[_0xc7cd('0x8')]+_0x132c45[_0xc7cd('0x9')]+_0x132c45[_0xc7cd('0xa')]+_0x132c45['countmachineretry']+_0x132c45[_0xc7cd('0xb')];this[_0xc7cd('0x8')]=_0x132c45[_0xc7cd('0x8')];this[_0xc7cd('0x9')]=_0x132c45[_0xc7cd('0x9')];this['countabandonedretry']=_0x132c45['countabandonedretry'];this[_0xc7cd('0xc')]=_0x132c45['countmachineretry'];this[_0xc7cd('0xb')]=_0x132c45[_0xc7cd('0xb')];this['queue']=_0x132c45[_0xc7cd('0x3')];this[_0xc7cd('0xd')]=_0x132c45[_0xc7cd('0xd')];this[_0xc7cd('0xe')]=_0x132c45[_0xc7cd('0xe')];this['starttime']=_0x132c45['starttime'];this[_0xc7cd('0xf')]=_0x132c45[_0xc7cd('0xf')];this['endtime']=_0x132c45['responsetime'];this[_0xc7cd('0x10')]=_0x132c45['ringtime']||0x0;this[_0xc7cd('0x11')]=_0x132c45['holdtime']||0x0;this['talktime']=_0x132c45['talktime']||0x0;this[_0xc7cd('0x12')]=_0x132c45[_0xc7cd('0x12')];this['callbackuniqueid']=_0x132c45['callbackuniqueid'];this[_0xc7cd('0x13')]=_0x132c45['callbackat'];this[_0xc7cd('0x14')]=_0x132c45[_0xc7cd('0x14')];this[_0xc7cd('0x15')]=_0x132c45[_0xc7cd('0x15')];this[_0xc7cd('0x16')]=_0x132c45['ListId'];this[_0xc7cd('0x17')]=_0x132c45[_0xc7cd('0x17')];this['VoiceQueueId']=_0x132c45['VoiceQueueId'];this['CampaignId']=_0x132c45[_0xc7cd('0x18')];this['originatecalleridnum']=_0x132c45['originatecalleridnum']||'';this[_0xc7cd('0x19')]=_0x132c45[_0xc7cd('0x19')]||'';this[_0xc7cd('0x1a')]=_0x132c45[_0xc7cd('0x1a')];this[_0xc7cd('0x1b')]=_0x132c45[_0xc7cd('0x1b')];}module[_0xc7cd('0x1c')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index beee6c5..a5ae985 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d45=['queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','../utils','statedesc','Answer','scheduledat','campaigntype','type','outbound'];(function(_0x51df5d,_0x467e28){var _0x1baff0=function(_0x2e64d1){while(--_0x2e64d1){_0x51df5d['push'](_0x51df5d['shift']());}};_0x1baff0(++_0x467e28);}(_0x8d45,0x151));var _0x58d4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8d45[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require('moment');var utils=require(_0x58d4('0x0'));function Hangup(_0x156538,_0x439f9e){this['state']=0x4;this[_0x58d4('0x1')]=_0x58d4('0x2');this[_0x58d4('0x3')]=_0x156538[_0x58d4('0x3')];this['type']=_0x156538['type'];this[_0x58d4('0x4')]=_0x156538[_0x58d4('0x5')]===_0x58d4('0x6')?_0x58d4('0x7'):_0x156538[_0x58d4('0x5')];this['amd']=_0x156538[_0x58d4('0x8')]||![];this['countbusyretry']=_0x156538[_0x58d4('0x9')];this[_0x58d4('0xa')]=_0x156538[_0x58d4('0xa')];this['countnoanswerretry']=_0x156538['countnoanswerretry'];this[_0x58d4('0xb')]=_0x156538[_0x58d4('0x9')]+_0x156538['countcongestionretry']+_0x156538[_0x58d4('0xc')]+_0x156538['countnosuchnumberretry']+_0x156538['countdropretry']+_0x156538[_0x58d4('0xd')]+_0x156538[_0x58d4('0xe')]+_0x156538['countagentrejectretry'];this[_0x58d4('0xf')]=_0x156538[_0x58d4('0xf')];this[_0x58d4('0x10')]=_0x156538[_0x58d4('0x10')];this[_0x58d4('0xd')]=_0x156538[_0x58d4('0xd')];this[_0x58d4('0xe')]=_0x156538[_0x58d4('0xe')];this[_0x58d4('0x11')]=_0x156538['countagentrejectretry'];this['uniqueid']=_0x439f9e['uniqueid'];this[_0x58d4('0x12')]=_0x156538[_0x58d4('0x13')];this[_0x58d4('0x14')]=_0x156538['number'];this[_0x58d4('0x15')]=_0x156538[_0x58d4('0x15')];this['responsetime']=_0x156538[_0x58d4('0x16')];this[_0x58d4('0x17')]=moment()[_0x58d4('0x18')](_0x58d4('0x19'));this[_0x58d4('0x1a')]=utils[_0x58d4('0x1b')](_0x156538[_0x58d4('0x16')],_0x156538['starttime']);this[_0x58d4('0x1c')]=0x0;this[_0x58d4('0x1d')]=utils['getSeconds'](this[_0x58d4('0x17')],_0x156538[_0x58d4('0x16')]);this[_0x58d4('0x7')]=_0x156538[_0x58d4('0x7')];this[_0x58d4('0x1e')]=_0x58d4('0x1f');this[_0x58d4('0x20')]=_0x439f9e[_0x58d4('0x21')];this[_0x58d4('0x22')]=_0x156538['callback'];this[_0x58d4('0x23')]=_0x156538[_0x58d4('0x23')];this[_0x58d4('0x24')]=_0x156538[_0x58d4('0x24')];this[_0x58d4('0x25')]=_0x156538[_0x58d4('0x25')];this['ContactId']=_0x156538[_0x58d4('0x26')];this[_0x58d4('0x27')]=_0x156538['ListId'];this['UserId']=_0x156538['UserId'];this[_0x58d4('0x28')]=_0x156538[_0x58d4('0x28')];this[_0x58d4('0x29')]=_0x156538['CampaignId'];}module[_0x58d4('0x2a')]=Hangup; \ No newline at end of file +var _0xa43a=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime'];(function(_0x2b08a3,_0x195bd4){var _0x136fcf=function(_0x480b78){while(--_0x480b78){_0x2b08a3['push'](_0x2b08a3['shift']());}};_0x136fcf(++_0x195bd4);}(_0xa43a,0xe3));var _0xaa43=function(_0x5a5eb7,_0x458210){_0x5a5eb7=_0x5a5eb7-0x0;var _0x14a1b9=_0xa43a[_0x5a5eb7];return _0x14a1b9;};'use strict';var moment=require(_0xaa43('0x0'));var utils=require(_0xaa43('0x1'));function Hangup(_0x3536a2,_0x190c9b){this[_0xaa43('0x2')]=0x4;this[_0xaa43('0x3')]='Answer';this[_0xaa43('0x4')]=_0x3536a2[_0xaa43('0x4')];this[_0xaa43('0x5')]=_0x3536a2[_0xaa43('0x5')];this['campaigntype']=_0x3536a2['type']===_0xaa43('0x6')?_0xaa43('0x7'):_0x3536a2[_0xaa43('0x5')];this[_0xaa43('0x8')]=_0x3536a2['amd']||![];this[_0xaa43('0x9')]=_0x3536a2[_0xaa43('0x9')];this[_0xaa43('0xa')]=_0x3536a2['countcongestionretry'];this['countnoanswerretry']=_0x3536a2[_0xaa43('0xb')];this[_0xaa43('0xc')]=_0x3536a2[_0xaa43('0x9')]+_0x3536a2[_0xaa43('0xa')]+_0x3536a2[_0xaa43('0xb')]+_0x3536a2['countnosuchnumberretry']+_0x3536a2[_0xaa43('0xd')]+_0x3536a2[_0xaa43('0xe')]+_0x3536a2[_0xaa43('0xf')]+_0x3536a2[_0xaa43('0x10')];this[_0xaa43('0x11')]=_0x3536a2['countnosuchnumberretry'];this['countdropretry']=_0x3536a2['countdropretry'];this['countabandonedretry']=_0x3536a2[_0xaa43('0xe')];this[_0xaa43('0xf')]=_0x3536a2['countmachineretry'];this[_0xaa43('0x10')]=_0x3536a2['countagentrejectretry'];this[_0xaa43('0x12')]=_0x190c9b[_0xaa43('0x12')];this[_0xaa43('0x13')]=_0x3536a2[_0xaa43('0x14')];this[_0xaa43('0x15')]=_0x3536a2['number'];this[_0xaa43('0x16')]=_0x3536a2[_0xaa43('0x16')];this[_0xaa43('0x17')]=_0x3536a2[_0xaa43('0x17')];this[_0xaa43('0x18')]=moment()[_0xaa43('0x19')](_0xaa43('0x1a'));this[_0xaa43('0x1b')]=utils[_0xaa43('0x1c')](_0x3536a2[_0xaa43('0x17')],_0x3536a2[_0xaa43('0x16')]);this[_0xaa43('0x1d')]=0x0;this[_0xaa43('0x1e')]=utils[_0xaa43('0x1c')](this['endtime'],_0x3536a2[_0xaa43('0x17')]);this['queue']=_0x3536a2[_0xaa43('0x7')];this[_0xaa43('0x1f')]='IVR';this[_0xaa43('0x20')]=_0x190c9b['cause-txt'];this[_0xaa43('0x21')]=_0x3536a2['callback'];this[_0xaa43('0x22')]=_0x3536a2[_0xaa43('0x22')];this[_0xaa43('0x23')]=_0x3536a2[_0xaa43('0x23')];this[_0xaa43('0x24')]=_0x3536a2[_0xaa43('0x24')];this['ContactId']=_0x3536a2[_0xaa43('0x25')];this[_0xaa43('0x26')]=_0x3536a2[_0xaa43('0x26')];this[_0xaa43('0x27')]=_0x3536a2[_0xaa43('0x27')];this[_0xaa43('0x28')]=_0x3536a2['VoiceQueueId'];this[_0xaa43('0x29')]=_0x3536a2[_0xaa43('0x29')];}module[_0xaa43('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index f33a195..16988ae 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd830=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x279eda,_0x1ffd83){var _0x50a839=function(_0x49047d){while(--_0x49047d){_0x279eda['push'](_0x279eda['shift']());}};_0x50a839(++_0x1ffd83);}(_0xd830,0xe4));var _0x0d83=function(_0x12d4c6,_0x258c28){_0x12d4c6=_0x12d4c6-0x0;var _0x5dc285=_0xd830[_0x12d4c6];return _0x5dc285;};'use strict';var utils=require(_0x0d83('0x0'));function History(_0x1d6561){this['uniqueid']=_0x1d6561[_0x0d83('0x1')];this[_0x0d83('0x2')]=_0x1d6561[_0x0d83('0x2')]||undefined;this[_0x0d83('0x3')]=_0x1d6561[_0x0d83('0x3')];this[_0x0d83('0x4')]=_0x1d6561[_0x0d83('0x3')]===_0x0d83('0x5')?'queue':_0x1d6561[_0x0d83('0x3')];this[_0x0d83('0x6')]=_0x1d6561[_0x0d83('0x6')];this[_0x0d83('0x7')]=_0x1d6561[_0x0d83('0x7')];this[_0x0d83('0x8')]=_0x1d6561[_0x0d83('0x8')];this[_0x0d83('0x9')]=_0x1d6561[_0x0d83('0x6')]+_0x1d6561['countcongestionretry']+_0x1d6561[_0x0d83('0x8')]+_0x1d6561[_0x0d83('0xa')]+_0x1d6561[_0x0d83('0xb')]+_0x1d6561[_0x0d83('0xc')]+_0x1d6561[_0x0d83('0xd')]+_0x1d6561[_0x0d83('0xe')];this['countnosuchnumberretry']=_0x1d6561[_0x0d83('0xa')];this[_0x0d83('0xb')]=_0x1d6561[_0x0d83('0xb')];this[_0x0d83('0xc')]=_0x1d6561['countabandonedretry'];this[_0x0d83('0xd')]=_0x1d6561[_0x0d83('0xd')];this[_0x0d83('0xe')]=_0x1d6561[_0x0d83('0xe')];this[_0x0d83('0xf')]=_0x1d6561['queue'];this[_0x0d83('0x10')]=_0x1d6561['name'];this[_0x0d83('0x11')]=_0x1d6561['number'];this['starttime']=_0x1d6561[_0x0d83('0x12')];this['responsetime']=_0x1d6561[_0x0d83('0x13')];this[_0x0d83('0x14')]=_0x1d6561[_0x0d83('0x13')];this['ringtime']=utils[_0x0d83('0x15')](_0x1d6561[_0x0d83('0x13')],_0x1d6561[_0x0d83('0x12')]);this['holdtime']=0x0;this[_0x0d83('0x16')]=0x0;this[_0x0d83('0x17')]=_0x1d6561[_0x0d83('0x17')];this[_0x0d83('0x18')]=_0x1d6561['callbackuniqueid'];this['callbackat']=_0x1d6561[_0x0d83('0x19')];this[_0x0d83('0x1a')]=_0x1d6561['recallme'];this[_0x0d83('0x1b')]=_0x1d6561[_0x0d83('0x1b')];this[_0x0d83('0x1c')]=_0x1d6561[_0x0d83('0x1c')];this[_0x0d83('0x1d')]=_0x1d6561[_0x0d83('0x1d')];this['VoiceQueueId']=_0x1d6561[_0x0d83('0x1e')];this[_0x0d83('0x1f')]=_0x1d6561[_0x0d83('0x1f')];this['originatecalleridnum']=_0x1d6561[_0x0d83('0x20')]||'';this[_0x0d83('0x21')]=_0x1d6561[_0x0d83('0x21')]||'';this[_0x0d83('0x22')]=_0x1d6561[_0x0d83('0x22')];this[_0x0d83('0x23')]=_0x1d6561[_0x0d83('0x23')];}module[_0x0d83('0x24')]=History; \ No newline at end of file +var _0x4f56=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','number','starttime','endtime','responsetime','ringtime','holdtime','talktime'];(function(_0x15af2f,_0x3c0a01){var _0x359239=function(_0x20da30){while(--_0x20da30){_0x15af2f['push'](_0x15af2f['shift']());}};_0x359239(++_0x3c0a01);}(_0x4f56,0x1a4));var _0x64f5=function(_0x20e05f,_0xed0464){_0x20e05f=_0x20e05f-0x0;var _0x5aba51=_0x4f56[_0x20e05f];return _0x5aba51;};'use strict';var utils=require('../utils');function History(_0x289a9a){this[_0x64f5('0x0')]=_0x289a9a['uniqueid'];this[_0x64f5('0x1')]=_0x289a9a[_0x64f5('0x1')]||undefined;this[_0x64f5('0x2')]=_0x289a9a[_0x64f5('0x2')];this[_0x64f5('0x3')]=_0x289a9a[_0x64f5('0x2')]===_0x64f5('0x4')?_0x64f5('0x5'):_0x289a9a['type'];this[_0x64f5('0x6')]=_0x289a9a[_0x64f5('0x6')];this[_0x64f5('0x7')]=_0x289a9a[_0x64f5('0x7')];this[_0x64f5('0x8')]=_0x289a9a[_0x64f5('0x8')];this[_0x64f5('0x9')]=_0x289a9a[_0x64f5('0x6')]+_0x289a9a['countcongestionretry']+_0x289a9a[_0x64f5('0x8')]+_0x289a9a[_0x64f5('0xa')]+_0x289a9a[_0x64f5('0xb')]+_0x289a9a['countabandonedretry']+_0x289a9a[_0x64f5('0xc')]+_0x289a9a['countagentrejectretry'];this[_0x64f5('0xa')]=_0x289a9a[_0x64f5('0xa')];this['countdropretry']=_0x289a9a[_0x64f5('0xb')];this[_0x64f5('0xd')]=_0x289a9a[_0x64f5('0xd')];this['countmachineretry']=_0x289a9a['countmachineretry'];this[_0x64f5('0xe')]=_0x289a9a[_0x64f5('0xe')];this[_0x64f5('0x5')]=_0x289a9a[_0x64f5('0x5')];this[_0x64f5('0xf')]=_0x289a9a[_0x64f5('0x10')];this['calleridnum']=_0x289a9a[_0x64f5('0x11')];this['starttime']=_0x289a9a[_0x64f5('0x12')];this['responsetime']=_0x289a9a['responsetime'];this[_0x64f5('0x13')]=_0x289a9a[_0x64f5('0x14')];this[_0x64f5('0x15')]=utils['getSeconds'](_0x289a9a['responsetime'],_0x289a9a[_0x64f5('0x12')]);this[_0x64f5('0x16')]=0x0;this[_0x64f5('0x17')]=0x0;this['callback']=_0x289a9a[_0x64f5('0x18')];this['callbackuniqueid']=_0x289a9a[_0x64f5('0x19')];this[_0x64f5('0x1a')]=_0x289a9a[_0x64f5('0x1a')];this[_0x64f5('0x1b')]=_0x289a9a[_0x64f5('0x1b')];this[_0x64f5('0x1c')]=_0x289a9a[_0x64f5('0x1c')];this[_0x64f5('0x1d')]=_0x289a9a['ListId'];this['UserId']=_0x289a9a['UserId'];this['VoiceQueueId']=_0x289a9a[_0x64f5('0x1e')];this['CampaignId']=_0x289a9a[_0x64f5('0x1f')];this['originatecalleridnum']=_0x289a9a[_0x64f5('0x20')]||'';this[_0x64f5('0x21')]=_0x289a9a[_0x64f5('0x21')]||'';this[_0x64f5('0x22')]=_0x289a9a[_0x64f5('0x22')];this['statedesc']=_0x289a9a[_0x64f5('0x23')];}module[_0x64f5('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index ad8e319..b17b96f 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf854=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xf854,0x1c3));var _0x4f85=function(_0x1cb29e,_0x214231){_0x1cb29e=_0x1cb29e-0x0;var _0x18fc32=_0xf854[_0x1cb29e];return _0x18fc32;};'use strict';var utils=require(_0x4f85('0x0'));function QueueCallerAbandon(_0x55a91f,_0xc01a1b){this[_0x4f85('0x1')]=_0x55a91f[_0x4f85('0x1')];this[_0x4f85('0x2')]=_0x55a91f[_0x4f85('0x2')];this[_0x4f85('0x3')]=_0x55a91f['type']===_0x4f85('0x4')?_0x4f85('0x5'):_0x55a91f[_0x4f85('0x2')];this[_0x4f85('0x6')]=_0x55a91f[_0x4f85('0x6')];this['countcongestionretry']=_0x55a91f['countcongestionretry'];this[_0x4f85('0x7')]=_0x55a91f['countnoanswerretry'];this['countglobal']=_0x55a91f[_0x4f85('0x6')]+_0x55a91f[_0x4f85('0x8')]+_0x55a91f[_0x4f85('0x7')]+_0x55a91f[_0x4f85('0x9')]+_0x55a91f['countdropretry']+_0x55a91f[_0x4f85('0xa')]+_0x55a91f[_0x4f85('0xb')]+_0x55a91f[_0x4f85('0xc')];this['countnosuchnumberretry']=_0x55a91f['countnosuchnumberretry'];this['countdropretry']=_0x55a91f[_0x4f85('0xd')];this[_0x4f85('0xa')]=_0x55a91f[_0x4f85('0xa')];this['countmachineretry']=_0x55a91f['countmachineretry'];this[_0x4f85('0xc')]=_0x55a91f['countagentrejectretry'];this[_0x4f85('0xe')]=_0xc01a1b['uniqueid'];this[_0x4f85('0xf')]=_0x55a91f[_0x4f85('0x10')];this['calleridnum']=_0x55a91f[_0x4f85('0x11')];this[_0x4f85('0x12')]=_0x55a91f[_0x4f85('0x12')];this[_0x4f85('0x13')]=_0x55a91f[_0x4f85('0x13')];this[_0x4f85('0x14')]=_0x55a91f[_0x4f85('0x14')];this[_0x4f85('0x15')]=_0x55a91f[_0x4f85('0x15')];this['endtime']=this[_0x4f85('0x14')];this['ringtime']=utils['getSeconds'](_0x55a91f[_0x4f85('0x13')],_0x55a91f[_0x4f85('0x12')]);this['holdtime']=utils['getSeconds'](this[_0x4f85('0x14')],_0x55a91f[_0x4f85('0x13')]);this[_0x4f85('0x16')]=0x0;this[_0x4f85('0x5')]=_0xc01a1b[_0x4f85('0x5')];this[_0x4f85('0x17')]=_0xc01a1b[_0x4f85('0x18')];this['reason']=_0xc01a1b[_0x4f85('0x19')];this[_0x4f85('0x1a')]=_0x55a91f[_0x4f85('0x1a')];this[_0x4f85('0x1b')]=_0x55a91f[_0x4f85('0x1b')];this['callbackat']=_0x55a91f[_0x4f85('0x1c')];this[_0x4f85('0x1d')]=_0x55a91f[_0x4f85('0x1d')];this[_0x4f85('0x1e')]=_0x55a91f[_0x4f85('0x1e')];this[_0x4f85('0x1f')]=_0x55a91f[_0x4f85('0x1f')];this[_0x4f85('0x20')]=_0x55a91f[_0x4f85('0x20')];this['VoiceQueueId']=_0x55a91f[_0x4f85('0x21')];this[_0x4f85('0x22')]=_0x55a91f[_0x4f85('0x22')];this['originatecalleridnum']=_0x55a91f['originatecalleridnum']||'';this[_0x4f85('0x23')]=_0x55a91f['originatecalleridname']||'';this[_0x4f85('0x24')]=_0x55a91f[_0x4f85('0x24')];this[_0x4f85('0x25')]=_0x55a91f[_0x4f85('0x25')];this[_0x4f85('0x26')]=_0x55a91f['statedesc'];}module[_0x4f85('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x33b0=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype'];(function(_0x405342,_0x34b3f0){var _0x452052=function(_0x1cafe3){while(--_0x1cafe3){_0x405342['push'](_0x405342['shift']());}};_0x452052(++_0x34b3f0);}(_0x33b0,0x197));var _0x033b=function(_0x2b2e26,_0x4ece0b){_0x2b2e26=_0x2b2e26-0x0;var _0xe80fb6=_0x33b0[_0x2b2e26];return _0xe80fb6;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x197eb5,_0x1f0a95){this[_0x033b('0x0')]=_0x197eb5[_0x033b('0x0')];this['type']=_0x197eb5[_0x033b('0x1')];this[_0x033b('0x2')]=_0x197eb5['type']===_0x033b('0x3')?_0x033b('0x4'):_0x197eb5[_0x033b('0x1')];this['countbusyretry']=_0x197eb5[_0x033b('0x5')];this[_0x033b('0x6')]=_0x197eb5['countcongestionretry'];this[_0x033b('0x7')]=_0x197eb5[_0x033b('0x7')];this[_0x033b('0x8')]=_0x197eb5[_0x033b('0x5')]+_0x197eb5[_0x033b('0x6')]+_0x197eb5[_0x033b('0x7')]+_0x197eb5['countnosuchnumberretry']+_0x197eb5[_0x033b('0x9')]+_0x197eb5[_0x033b('0xa')]+_0x197eb5[_0x033b('0xb')]+_0x197eb5[_0x033b('0xc')];this[_0x033b('0xd')]=_0x197eb5[_0x033b('0xd')];this[_0x033b('0x9')]=_0x197eb5[_0x033b('0x9')];this[_0x033b('0xa')]=_0x197eb5[_0x033b('0xa')];this['countmachineretry']=_0x197eb5[_0x033b('0xb')];this[_0x033b('0xc')]=_0x197eb5[_0x033b('0xc')];this[_0x033b('0xe')]=_0x1f0a95[_0x033b('0xe')];this[_0x033b('0xf')]=_0x197eb5[_0x033b('0x10')];this[_0x033b('0x11')]=_0x197eb5[_0x033b('0x12')];this[_0x033b('0x13')]=_0x197eb5[_0x033b('0x13')];this['responsetime']=_0x197eb5[_0x033b('0x14')];this[_0x033b('0x15')]=_0x197eb5[_0x033b('0x15')];this[_0x033b('0x16')]=_0x197eb5['dropreason'];this[_0x033b('0x17')]=this['droptime'];this['ringtime']=utils[_0x033b('0x18')](_0x197eb5[_0x033b('0x14')],_0x197eb5[_0x033b('0x13')]);this['holdtime']=utils[_0x033b('0x18')](this[_0x033b('0x15')],_0x197eb5['responsetime']);this[_0x033b('0x19')]=0x0;this['queue']=_0x1f0a95[_0x033b('0x4')];this['membername']=_0x1f0a95['connectedlinename'];this['reason']=_0x1f0a95[_0x033b('0x1a')];this['callback']=_0x197eb5[_0x033b('0x1b')];this[_0x033b('0x1c')]=_0x197eb5['callbackuniqueid'];this[_0x033b('0x1d')]=_0x197eb5['callbackat'];this[_0x033b('0x1e')]=_0x197eb5['recallme'];this[_0x033b('0x1f')]=_0x197eb5[_0x033b('0x1f')];this[_0x033b('0x20')]=_0x197eb5[_0x033b('0x20')];this[_0x033b('0x21')]=_0x197eb5[_0x033b('0x21')];this['VoiceQueueId']=_0x197eb5[_0x033b('0x22')];this['CampaignId']=_0x197eb5[_0x033b('0x23')];this['originatecalleridnum']=_0x197eb5[_0x033b('0x24')]||'';this['originatecalleridname']=_0x197eb5['originatecalleridname']||'';this[_0x033b('0x25')]=_0x197eb5[_0x033b('0x25')];this[_0x033b('0x26')]=_0x197eb5[_0x033b('0x26')];this[_0x033b('0x27')]=_0x197eb5[_0x033b('0x27')];}module[_0x033b('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 5c796f3..9d8831b 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['[rescheduleContact]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','catch','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]'];(function(_0x27ad39,_0x216d45){var _0x21eec0=function(_0x4a533c){while(--_0x4a533c){_0x27ad39['push'](_0x27ad39['shift']());}};_0x21eec0(++_0x216d45);}(_0x5fab,0x177));var _0xb5fa=function(_0x48a0b4,_0x2a4c3f){_0x48a0b4=_0x48a0b4-0x0;var _0x44b1e6=_0x5fab[_0x48a0b4];return _0x44b1e6;};'use strict';var util=require(_0xb5fa('0x0'));var logger=require(_0xb5fa('0x1'))('dialer');var cmHopper=require(_0xb5fa('0x2'));var cmHopperAdditionalPhone=require(_0xb5fa('0x3'));var cmHopperBlack=require(_0xb5fa('0x4'));var cmHopperHistory=require(_0xb5fa('0x5'));function inspectError(_0x67e8e8){return util[_0xb5fa('0x6')](_0x67e8e8,{'showHidden':![],'depth':null});}function getContactDialer(_0x29390a,_0x4341d3,_0x10361d){return cmHopper[_0xb5fa('0x7')](_0x29390a['id'],_0x4341d3,_0x10361d,_0x29390a['dialOrderByScheduledAt'])['catch'](function(_0x2e3804){_0x29390a[_0xb5fa('0x8')]=0x0;logger[_0xb5fa('0x9')]('[getContactDialer]',inspectError(_0x2e3804));});}exports[_0xb5fa('0x7')]=getContactDialer;function getContactDialerIvr(_0x38d9a3,_0x2cf4a5){return cmHopper['getContactDialerIvr'](_0x38d9a3['id'],_0x2cf4a5,_0x38d9a3['dialOrderByScheduledAt'])[_0xb5fa('0xa')](function(_0x23d124){_0x38d9a3[_0xb5fa('0x8')]=0x0;logger[_0xb5fa('0x9')](_0xb5fa('0xb'),inspectError(_0x23d124));});}exports[_0xb5fa('0xc')]=getContactDialerIvr;function countReScheduled(_0x65c6b6){return cmHopper[_0xb5fa('0xd')](_0x65c6b6)[_0xb5fa('0xa')](function(_0x4d3576){logger[_0xb5fa('0x9')](_0xb5fa('0xe'),inspectError(_0x4d3576));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x116849){return cmHopper['rescheduleContact'](_0x116849)[_0xb5fa('0xa')](function(_0x3fc372){logger[_0xb5fa('0x9')](_0xb5fa('0xf'),inspectError(_0x3fc372));});}exports[_0xb5fa('0x10')]=rescheduleContact;function unlockContact(_0x5371cf,_0x567f31,_0x38e964){return cmHopper[_0xb5fa('0x11')](_0x5371cf,_0x567f31,_0x38e964)[_0xb5fa('0xa')](function(_0x27c8f7){logger['error']('[unlockContact]',inspectError(_0x27c8f7));});}exports[_0xb5fa('0x11')]=unlockContact;function moveContactManagedDialer(_0x1f7f05){return cmHopper[_0xb5fa('0x12')](_0x1f7f05)[_0xb5fa('0xa')](function(_0x324ba5){logger[_0xb5fa('0x9')](_0xb5fa('0x13'),inspectError(_0x324ba5));});}exports[_0xb5fa('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0xc14dc4){return cmHopperBlack[_0xb5fa('0x14')](_0xc14dc4)[_0xb5fa('0xa')](function(_0x1f5064){logger['error'](_0xb5fa('0x15'),inspectError(_0x1f5064));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x37ae06){return cmHopperBlack['checkIsBlackListIvr'](_0x37ae06)[_0xb5fa('0xa')](function(_0x43c09f){logger['error'](_0xb5fa('0x16'),inspectError(_0x43c09f));});}exports[_0xb5fa('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x283a56,_0x47f71a,_0x32a85c){return cmHopperAdditionalPhone[_0xb5fa('0x18')](_0x283a56,_0x47f71a,_0x32a85c)[_0xb5fa('0xa')](function(_0x542348){logger[_0xb5fa('0x9')]('[verifyAdditionalPhone]',inspectError(_0x542348));});}exports[_0xb5fa('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x264591,_0x11053a,_0x543edf){return cmHopperAdditionalPhone[_0xb5fa('0x19')](_0x264591,_0x11053a,_0x543edf)[_0xb5fa('0xa')](function(_0x6a455c){logger[_0xb5fa('0x9')]('[swapAdditionalPhone]',inspectError(_0x6a455c));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x5bdf11){return cmHopperHistory['avgHandleTime'](_0x5bdf11)[_0xb5fa('0xa')](function(_0x460b54){logger[_0xb5fa('0x9')](_0xb5fa('0x1a'),inspectError(_0x460b54));});}exports[_0xb5fa('0x1b')]=avgHandleTime;function createHistory(_0x3506a4){return cmHopperHistory[_0xb5fa('0x1c')](_0x3506a4)[_0xb5fa('0xa')](function(_0x409af9){logger[_0xb5fa('0x9')](_0xb5fa('0x1d'),inspectError(_0x409af9));});}exports[_0xb5fa('0x1c')]=createHistory; \ No newline at end of file +var _0xa46e=['getContactDialerIvr','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]'];(function(_0x212348,_0x55415c){var _0x1696e9=function(_0x2b87cb){while(--_0x2b87cb){_0x212348['push'](_0x212348['shift']());}};_0x1696e9(++_0x55415c);}(_0xa46e,0x8a));var _0xea46=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xa46e[_0x20589d];return _0x422de9;};'use strict';var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))('dialer');var cmHopper=require(_0xea46('0x2'));var cmHopperAdditionalPhone=require(_0xea46('0x3'));var cmHopperBlack=require(_0xea46('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x19f135){return util['inspect'](_0x19f135,{'showHidden':![],'depth':null});}function getContactDialer(_0x3a2209,_0x47d633,_0x3599fc){return cmHopper['getContactDialer'](_0x3a2209['id'],_0x47d633,_0x3599fc,_0x3a2209[_0xea46('0x5')])[_0xea46('0x6')](function(_0x5f1cd1){_0x3a2209[_0xea46('0x7')]=0x0;logger[_0xea46('0x8')](_0xea46('0x9'),inspectError(_0x5f1cd1));});}exports[_0xea46('0xa')]=getContactDialer;function getContactDialerIvr(_0x468322,_0x4cf206){return cmHopper['getContactDialerIvr'](_0x468322['id'],_0x4cf206,_0x468322['dialOrderByScheduledAt'])[_0xea46('0x6')](function(_0x45550a){_0x468322['temp']=0x0;logger[_0xea46('0x8')](_0xea46('0xb'),inspectError(_0x45550a));});}exports[_0xea46('0xc')]=getContactDialerIvr;function countReScheduled(_0x594694){return cmHopper[_0xea46('0xd')](_0x594694)[_0xea46('0x6')](function(_0x4e10f3){logger[_0xea46('0x8')](_0xea46('0xe'),inspectError(_0x4e10f3));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x20955e){return cmHopper['rescheduleContact'](_0x20955e)[_0xea46('0x6')](function(_0x42c328){logger[_0xea46('0x8')](_0xea46('0xf'),inspectError(_0x42c328));});}exports[_0xea46('0x10')]=rescheduleContact;function unlockContact(_0x2ef436,_0x81ee45,_0x20a79c){return cmHopper[_0xea46('0x11')](_0x2ef436,_0x81ee45,_0x20a79c)['catch'](function(_0x2fa2f9){logger[_0xea46('0x8')](_0xea46('0x12'),inspectError(_0x2fa2f9));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x58b4da){return cmHopper[_0xea46('0x13')](_0x58b4da)[_0xea46('0x6')](function(_0x5cf5dd){logger['error'](_0xea46('0x14'),inspectError(_0x5cf5dd));});}exports[_0xea46('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ff93d){return cmHopperBlack[_0xea46('0x15')](_0x4ff93d)[_0xea46('0x6')](function(_0x1adba1){logger[_0xea46('0x8')]('[checkIsBlackList]',inspectError(_0x1adba1));});}exports[_0xea46('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4e220f){return cmHopperBlack['checkIsBlackListIvr'](_0x4e220f)[_0xea46('0x6')](function(_0x59e431){logger['error']('[checkIsBlackListIvr]',inspectError(_0x59e431));});}exports[_0xea46('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x36f982,_0x3d1850,_0x5beb44){return cmHopperAdditionalPhone[_0xea46('0x17')](_0x36f982,_0x3d1850,_0x5beb44)['catch'](function(_0x12e688){logger[_0xea46('0x8')]('[verifyAdditionalPhone]',inspectError(_0x12e688));});}exports[_0xea46('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5480eb,_0x2b3a8f,_0x114bf9){return cmHopperAdditionalPhone[_0xea46('0x18')](_0x5480eb,_0x2b3a8f,_0x114bf9)['catch'](function(_0x5d2de1){logger[_0xea46('0x8')](_0xea46('0x19'),inspectError(_0x5d2de1));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x3b3928){return cmHopperHistory['avgHandleTime'](_0x3b3928)[_0xea46('0x6')](function(_0x51ca27){logger[_0xea46('0x8')](_0xea46('0x1a'),inspectError(_0x51ca27));});}exports[_0xea46('0x1b')]=avgHandleTime;function createHistory(_0x44517d){return cmHopperHistory[_0xea46('0x1c')](_0x44517d)[_0xea46('0x6')](function(_0x4a5149){logger[_0xea46('0x8')](_0xea46('0x1d'),inspectError(_0x4a5149));});}exports[_0xea46('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 341f148..55a5553 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a8b=['isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','../../../../config/logger','../../../../config/environment/shared','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','dialMethod','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0a8b,0xee));var _0xb0a8=function(_0x3f83c1,_0x10be1c){_0x3f83c1=_0x3f83c1-0x0;var _0x2f8a39=_0x0a8b[_0x3f83c1];return _0x2f8a39;};'use strict';var _=require(_0xb0a8('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0xb0a8('0x1'))('dialer');var timezones=require(_0xb0a8('0x2'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb0a8('0x3'),'BLACKLIST':_0xb0a8('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb0a8('0x5'),'DISACTIVED':_0xb0a8('0x6'),'EMPTY_INTERVAL':_0xb0a8('0x7'),'INACTIVE':_0xb0a8('0x8'),'NO_AGENTS_LOGGED':_0xb0a8('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xb0a8('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xb0a8('0xb'),'QUEUE_RECALL':_0xb0a8('0xc'),'RECALL_TIMEOUT':_0xb0a8('0xd'),'RUNNING':_0xb0a8('0xe'),'UNKNOWN_TIMEZONE':_0xb0a8('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x38bdd7){return _0x38bdd7[_0xb0a8('0x10')]==='preview';}exports[_0xb0a8('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x24d699){return _0x24d699[_0xb0a8('0x12')]===_0xb0a8('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x56e7b1){return _0x56e7b1[_0xb0a8('0x12')]===_0xb0a8('0x14');}exports[_0xb0a8('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x4c7337){return _0x4c7337[_0xb0a8('0x16')];}exports[_0xb0a8('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5ed0d2){return _0x5ed0d2[_0xb0a8('0x18')];}exports[_0xb0a8('0x19')]=isIVRCampaignActive;function getSeconds(_0x271e01,_0x3264e1){var _0x4611dd=moment(_0x271e01)['milliseconds'](0x0);var _0x40195a=moment(_0x3264e1)[_0xb0a8('0x1a')](0x0);return _0x4611dd[_0xb0a8('0x1b')](_0x40195a,_0xb0a8('0x1c'));}exports[_0xb0a8('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x4d21e8,_0x1b963c){var _0x2e08f4=![];var _0x310169=_0x4d21e8[_0xb0a8('0x10')]!==_0x1b963c['dialMethod']||_0x4d21e8[_0xb0a8('0x16')]!==_0x1b963c[_0xb0a8('0x16')]||_0x4d21e8[_0xb0a8('0x1e')]!==_0x1b963c['message'];var _0x26d9ae=_0x4d21e8[_0xb0a8('0x1f')]!==_0x1b963c['available']||_0x4d21e8[_0xb0a8('0x20')]!==_0x1b963c[_0xb0a8('0x20')]||_0x4d21e8[_0xb0a8('0x21')]!==_0x1b963c['loggedInDb']||_0x4d21e8[_0xb0a8('0x22')]!==_0x1b963c['paused']||_0x4d21e8['talking']!==_0x1b963c[_0xb0a8('0x23')]||_0x4d21e8[_0xb0a8('0x24')]!==_0x1b963c[_0xb0a8('0x24')]||_0x4d21e8[_0xb0a8('0x25')]!==_0x1b963c[_0xb0a8('0x25')]||_0x4d21e8['inUse']!==_0x1b963c[_0xb0a8('0x26')]||_0x4d21e8[_0xb0a8('0x27')]!==_0x1b963c['originated'];if(_0x4d21e8[_0xb0a8('0x28')]&&_0x1b963c[_0xb0a8('0x28')]){_0x2e08f4=_0x4d21e8[_0xb0a8('0x28')][_0xb0a8('0x29')]!==_0x1b963c[_0xb0a8('0x28')][_0xb0a8('0x29')]||_0x4d21e8[_0xb0a8('0x28')][_0xb0a8('0x18')]!==_0x1b963c[_0xb0a8('0x28')]['active'];}return _0x310169||_0x26d9ae||_0x2e08f4;}exports[_0xb0a8('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5e0f9b){var _0x3a0f80=null;var _0x19143f=_0x5e0f9b[_0xb0a8('0x2b')];if(_[_0xb0a8('0x2c')](_0x5e0f9b[_0xb0a8('0x2d')])||_['isNil'](_0x5e0f9b[_0xb0a8('0x2e')])||_[_0xb0a8('0x2c')](_0x5e0f9b[_0xb0a8('0x2e')]['Intervals'])){_0x3a0f80=CAMPAIGN_STATUS[_0xb0a8('0x2f')];}else if(_[_0xb0a8('0x30')](_0x5e0f9b[_0xb0a8('0x2d')])||_[_0xb0a8('0x30')](_0x5e0f9b['Interval'][_0xb0a8('0x31')])){_0x3a0f80=CAMPAIGN_STATUS[_0xb0a8('0x32')];}else if(_0x19143f&&!timezones[_0x19143f]){_0x3a0f80=CAMPAIGN_STATUS[_0xb0a8('0x33')];}return _0x3a0f80;}function checkAnyValidTrunk(_0x1c0cce,_0x49299e){var _0x57901a=null;var _0x4374c7=_0xb0a8('0x34');var _0x3a992e=[_0xb0a8('0x35'),'unmonitored'];var _0x277d00=!![];if(_0x1c0cce[_0xb0a8('0x28')]&&_0x1c0cce[_0xb0a8('0x28')][_0xb0a8('0x18')]){_0x4374c7+=_0x1c0cce[_0xb0a8('0x28')][_0xb0a8('0x29')];_0x57901a=_0x49299e[_0x4374c7];_0x277d00=_0x3a992e['includes'](_0x57901a[_0xb0a8('0x36')]);}else if(_0x1c0cce[_0xb0a8('0x37')]&&_0x1c0cce[_0xb0a8('0x37')][_0xb0a8('0x18')]){_0x4374c7+=_0x1c0cce[_0xb0a8('0x37')]['name'];_0x57901a=_0x49299e[_0x4374c7];_0x277d00=_0x3a992e[_0xb0a8('0x38')](_0x57901a['status']);}return _0x277d00;}function getQueueCampaignStatusMessage(_0x25f2f3,_0x26b16e){var _0x56a975=CAMPAIGN_STATUS[_0xb0a8('0x3')];var _0x1e44ad=isPreviewCampaign(_0x25f2f3);if(!isQueueCampaignActive(_0x25f2f3)){if(_0x1e44ad){_0x56a975=CAMPAIGN_STATUS[_0xb0a8('0x39')];}else{if(_0x25f2f3[_0xb0a8('0x27')]===0x0&&_0x25f2f3['talking']===0x0&&_0x25f2f3[_0xb0a8('0x25')]===0x0&&(_0x25f2f3[_0xb0a8('0x24')]||0x0)===0x0){_0x56a975=CAMPAIGN_STATUS[_0xb0a8('0x39')];}else{_0x56a975=CAMPAIGN_STATUS[_0xb0a8('0x3a')];}}}else if(_0x25f2f3[_0xb0a8('0x20')]===0x0){_0x56a975=CAMPAIGN_STATUS[_0xb0a8('0x3b')];}else if(!checkAnyValidTrunk(_0x25f2f3,_0x26b16e)){_0x56a975=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x25f2f3)){var _0x5c6170=checkAnyValidQueueCampaignInterval(_0x25f2f3);if(_0x5c6170){_0x56a975=_0x5c6170;}}return _0x56a975;}exports[_0xb0a8('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x443284){var _0x552de1=CAMPAIGN_STATUS[_0xb0a8('0x3a')];if(_0x443284[_0xb0a8('0x27')]===0x0&&_0x443284['talking']===0x0&&_0x443284[_0xb0a8('0x25')]===0x0&&(_0x443284[_0xb0a8('0x24')]||0x0)===0x0){_0x552de1=CAMPAIGN_STATUS['INACTIVE'];}return _0x552de1;}exports[_0xb0a8('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x12344b){var _0x16d580=_0x12344b[_0xb0a8('0x3e')](/"(.*?)"/);return _0x16d580?_0x16d580[0x1]:_0x12344b;}exports[_0xb0a8('0x3f')]=extractCalleridName;function getCallerId(_0x395b8f,_0x1d9c03,_0x19e552){if(!_[_0xb0a8('0x40')](_0x19e552)&&typeof _0x19e552==='string'&&!_[_0xb0a8('0x30')](_0x19e552)){if(!_['isUndefined'](_0x1d9c03)&&typeof _0x1d9c03===_0xb0a8('0x41')&&!_['isEmpty'](_0x1d9c03)){return util[_0xb0a8('0x42')](_0xb0a8('0x43'),_0x1d9c03,_0x19e552);}return util[_0xb0a8('0x42')](_0xb0a8('0x43'),_0x19e552,_0x19e552);}if(!_[_0xb0a8('0x40')](_0x395b8f)&&typeof _0x395b8f===_0xb0a8('0x41')&&!_['isEmpty'](_0x395b8f)){return _0x395b8f;}return _0xb0a8('0x44');}exports[_0xb0a8('0x45')]=getCallerId;function getCallerIdRandom(_0x12c1d4,_0x446a4d){var _0x5a9f15;var _0x480517;var _0x4bd40b;if(_0x446a4d<=0x0){_0x446a4d=0x1;}_0x5a9f15=new RegExp('\x5cw{0,'+_0x446a4d+'}$');_0x480517=Math['pow'](0xa,_0x446a4d-0x1);_0x4bd40b=Math[_0xb0a8('0x46')](0xa,_0x446a4d)-0x1;return util[_0xb0a8('0x42')]('%s',_[_0xb0a8('0x47')](_0x12c1d4,_0x5a9f15,_[_0xb0a8('0x48')](_0x480517,_0x4bd40b)[_0xb0a8('0x49')]()));}exports[_0xb0a8('0x4a')]=getCallerIdRandom;function decrementOriginate(_0xe402f3){if(_0xe402f3[_0xb0a8('0x27')]&&_0xe402f3['originated']>0x0){_0xe402f3['originated']-=0x1;}else{logger['error'](_0xb0a8('0x4b'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x36de08){return _0x36de08&&_0x36de08[_0xb0a8('0x4c')]>0x0;}exports[_0xb0a8('0x4d')]=checkContactEmpty;function erlangb(_0x2c76c0,_0x5acb30){if(_0x5acb30===0x0){return 0x0;}var _0x3645df=0x1;for(var _0x1410d7=0x1;_0x1410d7<=_0x5acb30;_0x1410d7+=0x1){_0x3645df=0x1+_0x3645df*_0x1410d7/_0x2c76c0;}return 0x1/_0x3645df;}exports[_0xb0a8('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x4c8fc2,_0xa95901,_0x38e833){if(_0xa95901>_0x38e833){for(var _0x4b1856=0x0;_0x4b1856<_0xa95901-_0x38e833;_0x4b1856+=0x1){decrementOriginate(_0x4c8fc2);}}}exports[_0xb0a8('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x53adc7){var _0x25a8d3={};var _0x2f0f16=['id',_0xb0a8('0x50'),'tags',_0xb0a8('0x51')];const _0x39e361=0xfa;if(_0x53adc7){for(var _0x521585 in _0x53adc7){if(typeof _0x53adc7[_0x521585]!==_0xb0a8('0x52')){if(!_[_0xb0a8('0x2c')](_0x53adc7[_0x521585])&&!_0x2f0f16['includes'](_0x521585)){if(_0x521585==='description'&&_0x53adc7[_0x521585]['length']>_0x39e361){_0x25a8d3[_0xb0a8('0x53')+_0x521585['toUpperCase']()]=_0x53adc7[_0x521585][_0xb0a8('0x49')]()[_0xb0a8('0x54')](0x0,_0x39e361);}else{_0x25a8d3['XMD-'+_0x521585[_0xb0a8('0x55')]()]=_0x53adc7[_0x521585];}}}}}return _0x25a8d3;}exports[_0xb0a8('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x08e1=['\x5cw{0,','pow','replace','toString','error','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','dialActive','active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','dialGlobalInterval','isEmpty','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x08e1,0x1f2));var _0x108e=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x08e1[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0x108e('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0x108e('0x1'))(_0x108e('0x2'));var timezones=require('../../../../config/environment/shared')[_0x108e('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x108e('0x4'),'BLACKLIST':_0x108e('0x5'),'CONTACTS_RESCHEDULED':_0x108e('0x6'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x108e('0x7'),'EMPTY_INTERVAL':_0x108e('0x8'),'INACTIVE':_0x108e('0x9'),'NO_AGENTS_LOGGED':_0x108e('0xa'),'NO_AVAILABLE_CONTACTS':_0x108e('0xb'),'NULL_INTERVAL':_0x108e('0xc'),'OVERTIME_INTERVAL':_0x108e('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x108e('0xe'),'QUEUE_RECALL':_0x108e('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x108e('0x10')};exports[_0x108e('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x227189){return _0x227189[_0x108e('0x12')]==='preview';}exports[_0x108e('0x13')]=isPreviewCampaign;function isIVRCampaign(_0xe91112){return _0xe91112[_0x108e('0x14')]===_0x108e('0x15');}exports[_0x108e('0x16')]=isIVRCampaign;function isOutboundQueue(_0x126213){return _0x126213[_0x108e('0x14')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x3d1c49){return _0x3d1c49[_0x108e('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x33fc52){return _0x33fc52[_0x108e('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1b828c,_0x55febc){var _0x1a7c5e=moment(_0x1b828c)[_0x108e('0x19')](0x0);var _0x324dc5=moment(_0x55febc)[_0x108e('0x19')](0x0);return _0x1a7c5e[_0x108e('0x1a')](_0x324dc5,'seconds');}exports[_0x108e('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x550dc8,_0x4b69dc){var _0x48530f=![];var _0x5d56c5=_0x550dc8[_0x108e('0x12')]!==_0x4b69dc[_0x108e('0x12')]||_0x550dc8[_0x108e('0x17')]!==_0x4b69dc[_0x108e('0x17')]||_0x550dc8[_0x108e('0x1c')]!==_0x4b69dc[_0x108e('0x1c')];var _0x3bd402=_0x550dc8['available']!==_0x4b69dc[_0x108e('0x1d')]||_0x550dc8[_0x108e('0x1e')]!==_0x4b69dc[_0x108e('0x1e')]||_0x550dc8[_0x108e('0x1f')]!==_0x4b69dc[_0x108e('0x1f')]||_0x550dc8[_0x108e('0x20')]!==_0x4b69dc[_0x108e('0x20')]||_0x550dc8[_0x108e('0x21')]!==_0x4b69dc['talking']||_0x550dc8[_0x108e('0x22')]!==_0x4b69dc[_0x108e('0x22')]||_0x550dc8['waiting']!==_0x4b69dc[_0x108e('0x23')]||_0x550dc8[_0x108e('0x24')]!==_0x4b69dc[_0x108e('0x24')]||_0x550dc8[_0x108e('0x25')]!==_0x4b69dc[_0x108e('0x25')];if(_0x550dc8['Trunk']&&_0x4b69dc[_0x108e('0x26')]){_0x48530f=_0x550dc8[_0x108e('0x26')][_0x108e('0x27')]!==_0x4b69dc[_0x108e('0x26')][_0x108e('0x27')]||_0x550dc8[_0x108e('0x26')][_0x108e('0x18')]!==_0x4b69dc[_0x108e('0x26')][_0x108e('0x18')];}return _0x5d56c5||_0x3bd402||_0x48530f;}exports[_0x108e('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x122991){var _0x55dd82=null;var _0x14dc0a=_0x122991[_0x108e('0x29')];if(_[_0x108e('0x2a')](_0x122991['dialGlobalInterval'])||_[_0x108e('0x2a')](_0x122991[_0x108e('0x2b')])||_[_0x108e('0x2a')](_0x122991['Interval'][_0x108e('0x2c')])){_0x55dd82=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x122991[_0x108e('0x2d')])||_[_0x108e('0x2e')](_0x122991[_0x108e('0x2b')][_0x108e('0x2c')])){_0x55dd82=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x14dc0a&&!timezones[_0x14dc0a]){_0x55dd82=CAMPAIGN_STATUS[_0x108e('0x2f')];}return _0x55dd82;}function checkAnyValidTrunk(_0x4faf25,_0xf391a4){var _0xdc3a4d=null;var _0x1e6c92='SIP/';var _0x269b50=[_0x108e('0x30'),_0x108e('0x31')];var _0x5b9c0e=!![];if(_0x4faf25[_0x108e('0x26')]&&_0x4faf25[_0x108e('0x26')]['active']){_0x1e6c92+=_0x4faf25['Trunk'][_0x108e('0x27')];_0xdc3a4d=_0xf391a4[_0x1e6c92];_0x5b9c0e=_0x269b50[_0x108e('0x32')](_0xdc3a4d[_0x108e('0x33')]);}else if(_0x4faf25[_0x108e('0x34')]&&_0x4faf25[_0x108e('0x34')][_0x108e('0x18')]){_0x1e6c92+=_0x4faf25[_0x108e('0x34')][_0x108e('0x27')];_0xdc3a4d=_0xf391a4[_0x1e6c92];_0x5b9c0e=_0x269b50[_0x108e('0x32')](_0xdc3a4d[_0x108e('0x33')]);}return _0x5b9c0e;}function getQueueCampaignStatusMessage(_0x359b44,_0x1db804){var _0x23c8cb=CAMPAIGN_STATUS['ACTIVE'];var _0xfd1402=isPreviewCampaign(_0x359b44);if(!isQueueCampaignActive(_0x359b44)){if(_0xfd1402){_0x23c8cb=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x359b44[_0x108e('0x25')]===0x0&&_0x359b44[_0x108e('0x21')]===0x0&&_0x359b44[_0x108e('0x23')]===0x0&&(_0x359b44[_0x108e('0x22')]||0x0)===0x0){_0x23c8cb=CAMPAIGN_STATUS['INACTIVE'];}else{_0x23c8cb=CAMPAIGN_STATUS[_0x108e('0x35')];}}}else if(_0x359b44[_0x108e('0x1e')]===0x0){_0x23c8cb=CAMPAIGN_STATUS[_0x108e('0x36')];}else if(!checkAnyValidTrunk(_0x359b44,_0x1db804)){_0x23c8cb=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x359b44)){var _0x59e10c=checkAnyValidQueueCampaignInterval(_0x359b44);if(_0x59e10c){_0x23c8cb=_0x59e10c;}}return _0x23c8cb;}exports[_0x108e('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x478614){var _0x35f65b=CAMPAIGN_STATUS[_0x108e('0x35')];if(_0x478614[_0x108e('0x25')]===0x0&&_0x478614['talking']===0x0&&_0x478614['waiting']===0x0&&(_0x478614[_0x108e('0x22')]||0x0)===0x0){_0x35f65b=CAMPAIGN_STATUS['INACTIVE'];}return _0x35f65b;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x108b5b){var _0x453745=_0x108b5b[_0x108e('0x38')](/"(.*?)"/);return _0x453745?_0x453745[0x1]:_0x108b5b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x17d88d,_0x5ce11d,_0x30703e){if(!_[_0x108e('0x39')](_0x30703e)&&typeof _0x30703e===_0x108e('0x3a')&&!_[_0x108e('0x2e')](_0x30703e)){if(!_['isUndefined'](_0x5ce11d)&&typeof _0x5ce11d===_0x108e('0x3a')&&!_[_0x108e('0x2e')](_0x5ce11d)){return util[_0x108e('0x3b')](_0x108e('0x3c'),_0x5ce11d,_0x30703e);}return util[_0x108e('0x3b')](_0x108e('0x3c'),_0x30703e,_0x30703e);}if(!_['isUndefined'](_0x17d88d)&&typeof _0x17d88d===_0x108e('0x3a')&&!_['isEmpty'](_0x17d88d)){return _0x17d88d;}return _0x108e('0x3d');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x53d6bd,_0x57182c){var _0x52c567;var _0xbd0c34;var _0x3575d8;if(_0x57182c<=0x0){_0x57182c=0x1;}_0x52c567=new RegExp(_0x108e('0x3e')+_0x57182c+'}$');_0xbd0c34=Math[_0x108e('0x3f')](0xa,_0x57182c-0x1);_0x3575d8=Math[_0x108e('0x3f')](0xa,_0x57182c)-0x1;return util[_0x108e('0x3b')]('%s',_[_0x108e('0x40')](_0x53d6bd,_0x52c567,_['random'](_0xbd0c34,_0x3575d8)[_0x108e('0x41')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x123ff1){if(_0x123ff1['originated']&&_0x123ff1['originated']>0x0){_0x123ff1[_0x108e('0x25')]-=0x1;}else{logger[_0x108e('0x42')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x108e('0x43')]=decrementOriginate;function checkContactEmpty(_0x263d19){return _0x263d19&&_0x263d19[_0x108e('0x44')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x525a7e,_0x358c0e){if(_0x358c0e===0x0){return 0x0;}var _0x3b6865=0x1;for(var _0x1608a6=0x1;_0x1608a6<=_0x358c0e;_0x1608a6+=0x1){_0x3b6865=0x1+_0x3b6865*_0x1608a6/_0x525a7e;}return 0x1/_0x3b6865;}exports[_0x108e('0x45')]=erlangb;function checkContactLowerLimitOriginate(_0x8cfe5b,_0x4f9810,_0x310e67){if(_0x4f9810>_0x310e67){for(var _0x89833d=0x0;_0x89833d<_0x4f9810-_0x310e67;_0x89833d+=0x1){decrementOriginate(_0x8cfe5b);}}}exports[_0x108e('0x46')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x597e61){var _0x3f2863={};var _0x5daea4=['id',_0x108e('0x47'),_0x108e('0x48'),_0x108e('0x49')];const _0x489fdc=0xfa;if(_0x597e61){for(var _0x1f4b7a in _0x597e61){if(typeof _0x597e61[_0x1f4b7a]!==_0x108e('0x4a')){if(!_[_0x108e('0x2a')](_0x597e61[_0x1f4b7a])&&!_0x5daea4['includes'](_0x1f4b7a)){if(_0x1f4b7a===_0x108e('0x4b')&&_0x597e61[_0x1f4b7a][_0x108e('0x44')]>_0x489fdc){_0x3f2863[_0x108e('0x4c')+_0x1f4b7a[_0x108e('0x4d')]()]=_0x597e61[_0x1f4b7a][_0x108e('0x41')]()[_0x108e('0x4e')](0x0,_0x489fdc);}else{_0x3f2863[_0x108e('0x4c')+_0x1f4b7a[_0x108e('0x4d')]()]=_0x597e61[_0x1f4b7a];}}}}}return _0x3f2863;}exports[_0x108e('0x4f')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a791899..f009d37 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(_0x37f4ef,_0x375f75){var _0x4e1238=function(_0x19a78c){while(--_0x19a78c){_0x37f4ef['push'](_0x37f4ef['shift']());}};_0x4e1238(++_0x375f75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x5d489e,_0x4caf41){var _0x33a2e2=function(_0x15b13f){while(--_0x15b13f){_0x5d489e['push'](_0x5d489e['shift']());}};_0x33a2e2(++_0x4caf41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 875dcd4..01bffee 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 _0x5cd9=['name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','tiff2pdf','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel'];(function(_0x4dafb8,_0x185282){var _0x1a8666=function(_0x178891){while(--_0x178891){_0x4dafb8['push'](_0x4dafb8['shift']());}};_0x1a8666(++_0x185282);}(_0x5cd9,0x13c));var _0x95cd=function(_0x3b6eb9,_0x409248){_0x3b6eb9=_0x3b6eb9-0x0;var _0x2d48a4=_0x5cd9[_0x3b6eb9];return _0x2d48a4;};'use strict';var util=require('util');var _=require(_0x95cd('0x0'));var BPromise=require(_0x95cd('0x1'));var uuid=require(_0x95cd('0x2'));var moment=require(_0x95cd('0x3'));var path=require('path');var tiff2pdf=require(_0x95cd('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x95cd('0x5'));var ami=require(_0x95cd('0x6'));var rpcDb=require(_0x95cd('0x7'));var Channel=require(_0x95cd('0x8'));var ut=require(_0x95cd('0x9'));var Action=require(_0x95cd('0xa'));var faxAccount=require(_0x95cd('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x4fc0f5){this[_0x95cd('0xc')]={};this[_0x95cd('0xd')]=_0x4fc0f5[_0x95cd('0xd')];this[_0x95cd('0xe')]=_0x4fc0f5[_0x95cd('0xe')];this[_0x95cd('0xf')]={};ami['on'](_0x95cd('0x10'),this[_0x95cd('0x11')][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x13'),this[_0x95cd('0x14')][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x15'),this[_0x95cd('0x16')][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x17'),this[_0x95cd('0x18')][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x19'),this['syncFaxStatus']['bind'](this));ami['on'](_0x95cd('0x1a'),this['syncReceiveFax'][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x1b'),this[_0x95cd('0x1c')][_0x95cd('0x12')](this));ami['on'](_0x95cd('0x1d'),this[_0x95cd('0x1e')][_0x95cd('0x12')](this));}Fax[_0x95cd('0x1f')][_0x95cd('0x11')]=function(_0x23e85e){if(_0x23e85e[_0x95cd('0x20')]===_0x95cd('0x21')){for(var _0x10a6fe in this['faxAccounts']){if(this[_0x95cd('0xd')][_0x95cd('0x22')](_0x10a6fe)){if(_0x23e85e['exten']===this[_0x95cd('0xd')][_0x10a6fe][_0x95cd('0x23')]){this[_0x95cd('0xc')][_0x23e85e[_0x95cd('0x24')]]={};this[_0x95cd('0xc')][_0x23e85e[_0x95cd('0x24')]][_0x95cd('0x25')]=_0x23e85e[_0x95cd('0x25')];this['channels'][_0x23e85e['uniqueid']]['id']=this['faxAccounts'][_0x10a6fe]['id'];this[_0x95cd('0xc')][_0x23e85e[_0x95cd('0x24')]][_0x95cd('0x26')]=this[_0x95cd('0xd')][_0x10a6fe][_0x95cd('0x26')];logger[_0x95cd('0x27')](_0x23e85e[_0x95cd('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x95cd('0xf')][_0x23e85e[_0x95cd('0x24')]]){this[_0x95cd('0xc')][_0x23e85e[_0x95cd('0x24')]]={};this['channels'][_0x23e85e[_0x95cd('0x24')]][_0x95cd('0x25')]=_0x23e85e['channel'];logger[_0x95cd('0x27')](_0x23e85e['uniqueid'],_0x95cd('0x28'));}};Fax[_0x95cd('0x1f')][_0x95cd('0x14')]=function(_0x4c4eed){if(this[_0x95cd('0xc')][_0x4c4eed[_0x95cd('0x24')]]){for(var _0x283bcf in _0x4c4eed[_0x95cd('0x29')]){if(_0x4c4eed[_0x95cd('0x29')][_0x95cd('0x22')](_0x283bcf)){this[_0x95cd('0xc')][_0x4c4eed[_0x95cd('0x24')]][_0x283bcf]=_0x4c4eed[_0x95cd('0x2a')];}}}};Fax['prototype'][_0x95cd('0x16')]=function(_0x856e6b){if(this[_0x95cd('0xc')][_0x856e6b['uniqueid']]){this[_0x95cd('0xc')][_0x856e6b[_0x95cd('0x24')]][_0x95cd('0x2b')]=_0x856e6b[_0x95cd('0x2b')];this[_0x95cd('0xc')][_0x856e6b[_0x95cd('0x24')]][_0x95cd('0x2c')]=_0x856e6b[_0x95cd('0x2c')];}};Fax[_0x95cd('0x1f')][_0x95cd('0x18')]=function(_0x273881){if(this[_0x95cd('0xc')][_0x273881[_0x95cd('0x24')]]){for(var _0xc2be53 in _0x273881[_0x95cd('0x29')]){if(_0x273881[_0x95cd('0x29')][_0x95cd('0x22')](_0xc2be53)){this[_0x95cd('0xc')][_0x273881[_0x95cd('0x24')]][_0xc2be53]=_0x273881['value'];}}}};Fax[_0x95cd('0x1f')]['syncFaxStatus']=function(_0x2ba38f){if(this['channels'][_0x2ba38f['uniqueid']]){this[_0x95cd('0xc')][_0x2ba38f[_0x95cd('0x24')]][_0x95cd('0x2d')]=_0x2ba38f[_0x95cd('0x2d')];this['channels'][_0x2ba38f[_0x95cd('0x24')]][_0x95cd('0x2e')]=_0x2ba38f['status'];this[_0x95cd('0xc')][_0x2ba38f[_0x95cd('0x24')]][_0x95cd('0x23')]=_0x2ba38f[_0x95cd('0x23')];this[_0x95cd('0xc')][_0x2ba38f[_0x95cd('0x24')]][_0x95cd('0x2f')]=_0x2ba38f['filename'];logger['info'](_0x2ba38f[_0x95cd('0x24')],_0x95cd('0x30'));}};Fax['prototype'][_0x95cd('0x31')]=function(_0x379da6){var _0x4ae189=this;if(this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]]){var _0x11731e=this['channels'][_0x379da6[_0x95cd('0x24')]]['id'];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x32')]=_0x379da6[_0x95cd('0x32')];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x33')]=_0x379da6[_0x95cd('0x33')];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x23')]=_0x379da6['localstationid'];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x34')]=_0x379da6[_0x95cd('0x34')];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x35')]=_0x379da6[_0x95cd('0x35')];this[_0x95cd('0xc')][_0x379da6['uniqueid']][_0x95cd('0x2f')]=_0x379da6[_0x95cd('0x2f')];this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]][_0x95cd('0x36')]=_0x379da6['calleridnum'];if(this[_0x95cd('0xc')][_0x379da6[_0x95cd('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x379da6[_0x95cd('0x2f')],_0x95cd('0x37'),function(_0x2e6778){logger['info'](_0x379da6[_0x95cd('0x24')],_0x95cd('0x38'),_0x2e6778['message']);attachment['create']({'name':path[_0x95cd('0x39')](_0x379da6[_0x95cd('0x2f')])['name'],'basename':path[_0x95cd('0x39')](_0x379da6['filename'])[_0x95cd('0x26')]+_0x95cd('0x3a'),'type':_0x95cd('0x3b')})[_0x95cd('0x3c')](function(_0x5abb6e){faxAccount[_0x95cd('0x3d')](_0x11731e,{'from':_0x379da6[_0x95cd('0x36')],'mapKey':'fax','body':path['parse'](_0x379da6['filename'])[_0x95cd('0x26')]+_0x95cd('0x3a'),'AttachmentId':_0x5abb6e['id']})[_0x95cd('0x3e')](function(_0x29faa6){logger[_0x95cd('0x3f')](_0x379da6[_0x95cd('0x24')],_0x95cd('0x40'),JSON[_0x95cd('0x41')](_0x29faa6));});})[_0x95cd('0x3e')](function(_0x3142c2){logger[_0x95cd('0x3f')](_0x379da6['uniqueid'],_0x95cd('0x42'),JSON[_0x95cd('0x41')](_0x3142c2));});});}logger[_0x95cd('0x27')](_0x379da6[_0x95cd('0x24')],_0x95cd('0x42'));}};Fax[_0x95cd('0x1f')][_0x95cd('0x1e')]=function(_0x4a6742){if(this['actions'][_0x4a6742['uniqueid']]){_[_0x95cd('0x43')](this[_0x95cd('0xc')][_0x4a6742['uniqueid']],_[_0x95cd('0x44')](_0x4a6742,['response','reason']));}};function updateStatus(_0x4212e1){if(_0x4212e1[_0x95cd('0x45')]){faxMessage[_0x95cd('0x46')](_0x4212e1[_0x95cd('0x45')],{'failMessage':_0x95cd('0x47')})['then'](function(_0x26dec8){ut[_0x95cd('0x48')](_0x95cd('0x49'),_0x26dec8);})[_0x95cd('0x3e')](function(_0x3038ac){ut['logger'](_0x95cd('0x4a'),_0x3038ac);});}else{ut[_0x95cd('0x48')](_0x95cd('0x4b'));}}Fax[_0x95cd('0x1f')]['updateStatus']=function(_0x23d113,_0x5cbf02,_0x2cef48){var _0x36c1d0=this;var _0x4bdc4c={};if(_0x5cbf02){_0x4bdc4c={'read':_0x5cbf02};}else{_0x4bdc4c={'failMessage':_0x2cef48};}if(this[_0x95cd('0xf')][_0x23d113]['AttachmentId']){faxMessage['update'](this[_0x95cd('0xf')][_0x23d113][_0x95cd('0x45')],_0x4bdc4c)[_0x95cd('0x3c')](function(_0x551cfc){ut[_0x95cd('0x48')](_0x95cd('0x4c'),_0x551cfc);})[_0x95cd('0x3e')](function(_0x51123f){ut[_0x95cd('0x48')](_0x95cd('0x4d'),_0x51123f);})[_0x95cd('0x4e')](function(){delete _0x36c1d0[_0x95cd('0xc')][_0x23d113];delete _0x36c1d0['actions'][_0x23d113];});}else{ut['logger'](_0x95cd('0x4f'));delete this['channels'][_0x23d113];delete this['actions'][_0x23d113];}};Fax[_0x95cd('0x1f')]['syncHangup']=function(_0x3c815d){var _0x28d9f3=this;if(this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]]){if(this[_0x95cd('0xf')][_0x3c815d[_0x95cd('0x24')]]){this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]]['id']=this['actions'][_0x3c815d['uniqueid']]['id'];this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]][_0x95cd('0x26')]=this['actions'][_0x3c815d[_0x95cd('0x24')]][_0x95cd('0x26')];}logger[_0x95cd('0x27')](_0x3c815d[_0x95cd('0x24')],this['actions'][_0x3c815d[_0x95cd('0x24')]]?'\x20hangup\x20sendFile\x20':_0x95cd('0x50'),JSON[_0x95cd('0x41')](this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]]));if(this[_0x95cd('0xf')][_0x3c815d['uniqueid']]){if(this['channels'][_0x3c815d[_0x95cd('0x24')]][_0x95cd('0x51')]>0x0&&this['channels'][_0x3c815d[_0x95cd('0x24')]]['faxstatus']==='SUCCESS'){this[_0x95cd('0x52')](_0x3c815d['uniqueid'],!![]);}else{this[_0x95cd('0x52')](_0x3c815d[_0x95cd('0x24')],![],this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]][_0x95cd('0x53')]?_0x95cd('0x54')+this[_0x95cd('0xc')][_0x3c815d[_0x95cd('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x95cd('0x1f')][_0x95cd('0x55')]=function(_0x3e69d2){var _0x396084=this;return new BPromise(function(_0x3538c5,_0x18ba87){_0x396084[_0x95cd('0x56')](_0x3e69d2,_0x396084[_0x95cd('0xd')][_0x3e69d2[_0x95cd('0x57')]])[_0x95cd('0x3c')](function(_0x29e441){ut['logger'](_0x95cd('0x58'),_0x29e441);_0x3538c5(ut[_0x95cd('0x59')](_0x95cd('0x5a')));})[_0x95cd('0x3e')](function(_0xf123b7){ut[_0x95cd('0x48')](_0x95cd('0x5b'),_0xf123b7);updateStatus(_0x3e69d2);_0x18ba87(ut[_0x95cd('0x59')](_0x95cd('0x5c')));});});};Fax[_0x95cd('0x1f')]['checkAfterSend']=function(_0x18a57a){var _0x59e23c=this;return new BPromise(function(_0x25cf81,_0x2aad01){var _0x19f9f0=_0x59e23c['checkTrunk'](_0x59e23c[_0x95cd('0xd')][_0x18a57a[_0x95cd('0x57')]]['Trunk'],_0x18a57a);if(_0x19f9f0['isValid']){_0x25cf81(ut[_0x95cd('0x59')](_0x95cd('0x5d')));}else{_0x2aad01(ut[_0x95cd('0x59')](_0x19f9f0[_0x95cd('0x59')]));}});};function originate(_0x19ca9e,_0x472e5a,_0x21e5bb){return new BPromise(function(_0x39f8a4,_0xe0228a){if(_0x21e5bb){var _0x3a3758=util[_0x95cd('0x5e')](_0x95cd('0x5f'),path[_0x95cd('0x39')](_0x19ca9e[_0x95cd('0x60')])['name'],_0x19ca9e[_0x95cd('0x60')]);gs[_0x95cd('0x61')](_0x3a3758)[_0x95cd('0x3c')](function(){_0x19ca9e['path']=util[_0x95cd('0x5e')](_0x95cd('0x62'),path[_0x95cd('0x39')](_0x19ca9e[_0x95cd('0x60')])[_0x95cd('0x63')],path[_0x95cd('0x39')](_0x19ca9e[_0x95cd('0x60')])['name']);_0x472e5a['XMF-PATH']=_0x19ca9e['path'];ut[_0x95cd('0x48')](_0x95cd('0x64'),'');ami[_0x95cd('0x65')](ut[_0x95cd('0x66')](_0x19ca9e,_0x472e5a))['then'](function(_0x1f3b7c){_0x39f8a4(_0x1f3b7c);})[_0x95cd('0x3e')](function(_0x180b17){_0xe0228a(_0x180b17);});})[_0x95cd('0x3e')](function(_0x272837){_0xe0228a(_0x272837);});}else{ami[_0x95cd('0x65')](ut[_0x95cd('0x66')](_0x19ca9e,_0x472e5a))['then'](function(_0x39ed49){_0x39f8a4(_0x39ed49);})[_0x95cd('0x3e')](function(_0x319bf1){_0xe0228a(_0x319bf1);});}});}Fax[_0x95cd('0x1f')][_0x95cd('0x56')]=function(_0x1abeee,_0x14d8f8){var _0x1b8f9e=this;return new BPromise(function(_0x29fb3f,_0x52d5fd){var _0x110516=uuid['v4']();var _0x597ddc=ut[_0x95cd('0x67')](_0x1abeee,_0x14d8f8);_0x1b8f9e['actions'][_0x110516]=new Action(_0x110516,_0x14d8f8,_0x1abeee);var _0x4848ff=_0x1b8f9e['actions'][_0x110516];if(path[_0x95cd('0x39')](_0x1abeee[_0x95cd('0x60')])[_0x95cd('0x68')]===_0x95cd('0x3a')){originate(_0x4848ff,_0x597ddc,!![])[_0x95cd('0x3c')](function(_0x6571cf){_0x29fb3f(_0x6571cf);})[_0x95cd('0x3e')](function(_0x57ddca){_0x52d5fd(_0x57ddca);});}else{originate(_0x4848ff,_0x597ddc,![])[_0x95cd('0x3c')](function(_0x3f98da){_0x29fb3f(_0x3f98da);})[_0x95cd('0x3e')](function(_0x4df570){_0x52d5fd(_0x4df570);});}});};Fax['prototype'][_0x95cd('0x69')]=function(_0x3fbccd){return!_['isNil'](_0x3fbccd)&&!_[_0x95cd('0x6a')](_0x3fbccd['name'])&&!_[_0x95cd('0x6a')](_0x3fbccd[_0x95cd('0x6b')])&&_0x3fbccd[_0x95cd('0x6b')]&&!_[_0x95cd('0x6a')](this[_0x95cd('0xe')][util['format'](_0x95cd('0x6c'),_0x3fbccd['name'])])&&!_[_0x95cd('0x6a')](this[_0x95cd('0xe')][util[_0x95cd('0x5e')](_0x95cd('0x6c'),_0x3fbccd[_0x95cd('0x26')])][_0x95cd('0x2e')])&&(this[_0x95cd('0xe')][util[_0x95cd('0x5e')](_0x95cd('0x6c'),_0x3fbccd['name'])][_0x95cd('0x2e')]===_0x95cd('0x6d')||this[_0x95cd('0xe')][util['format']('SIP/%s',_0x3fbccd[_0x95cd('0x26')])]['status']==='unmonitored');};Fax[_0x95cd('0x1f')][_0x95cd('0x6e')]=function(_0x164a13,_0x276e59){if(!this[_0x95cd('0x69')](_0x164a13)){ut[_0x95cd('0x48')](_0x95cd('0x6f'),_[_0x95cd('0x6a')](_0x164a13)?'':_0x164a13['name']+_0x95cd('0x70'));return{'isValid':![],'message':_0x95cd('0x71')};}if(_[_0x95cd('0x6a')](_0x276e59[_0x95cd('0x5')])){ut[_0x95cd('0x48')](_0x95cd('0x72'),JSON[_0x95cd('0x41')](_0x276e59));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x95cd('0x6a')](_0x276e59[_0x95cd('0x60')])){ut[_0x95cd('0x48')](_0x95cd('0x73'),JSON['stringify'](_0x276e59));return{'isValid':![],'message':_0x95cd('0x74')};}return{'isValid':!![],'message':_0x95cd('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0x3c7d=['../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','syncNewchannel','from-voip-provider','hasOwnProperty','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','fax','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action'];(function(_0x1b3a09,_0x20c774){var _0x357bb8=function(_0xd7c6d2){while(--_0xd7c6d2){_0x1b3a09['push'](_0x1b3a09['shift']());}};_0x357bb8(++_0x20c774);}(_0x3c7d,0x69));var _0xd3c7=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x3c7d[_0x35da42];return _0x370035;};'use strict';var util=require('util');var _=require(_0xd3c7('0x0'));var BPromise=require('bluebird');var uuid=require(_0xd3c7('0x1'));var moment=require(_0xd3c7('0x2'));var path=require(_0xd3c7('0x3'));var tiff2pdf=require(_0xd3c7('0x4'));var gs=require(_0xd3c7('0x5'));var logger=require(_0xd3c7('0x6'))('fax');var ami=require(_0xd3c7('0x7'));var rpcDb=require(_0xd3c7('0x8'));var Channel=require(_0xd3c7('0x9'));var ut=require(_0xd3c7('0xa'));var Action=require(_0xd3c7('0xb'));var faxAccount=require(_0xd3c7('0xc'));var attachment=require(_0xd3c7('0xd'));var faxMessage=require(_0xd3c7('0xe'));function Fax(_0x2f1b2e){this[_0xd3c7('0xf')]={};this[_0xd3c7('0x10')]=_0x2f1b2e[_0xd3c7('0x10')];this['trunks']=_0x2f1b2e[_0xd3c7('0x11')];this['actions']={};ami['on'](_0xd3c7('0x12'),this['syncNewchannel'][_0xd3c7('0x13')](this));ami['on'](_0xd3c7('0x14'),this['syncVarSet'][_0xd3c7('0x13')](this));ami['on'](_0xd3c7('0x15'),this[_0xd3c7('0x16')][_0xd3c7('0x13')](this));ami['on'](_0xd3c7('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xd3c7('0x18'),this[_0xd3c7('0x19')]['bind'](this));ami['on'](_0xd3c7('0x1a'),this[_0xd3c7('0x1b')][_0xd3c7('0x13')](this));ami['on']('hangup',this[_0xd3c7('0x1c')][_0xd3c7('0x13')](this));ami['on']('originateresponse',this[_0xd3c7('0x1d')][_0xd3c7('0x13')](this));}Fax['prototype'][_0xd3c7('0x1e')]=function(_0x5e3f1c){if(_0x5e3f1c['context']===_0xd3c7('0x1f')){for(var _0x51987e in this['faxAccounts']){if(this[_0xd3c7('0x10')][_0xd3c7('0x20')](_0x51987e)){if(_0x5e3f1c['exten']===this[_0xd3c7('0x10')][_0x51987e]['localstationid']){this[_0xd3c7('0xf')][_0x5e3f1c[_0xd3c7('0x21')]]={};this[_0xd3c7('0xf')][_0x5e3f1c['uniqueid']][_0xd3c7('0x22')]=_0x5e3f1c[_0xd3c7('0x22')];this[_0xd3c7('0xf')][_0x5e3f1c[_0xd3c7('0x21')]]['id']=this[_0xd3c7('0x10')][_0x51987e]['id'];this['channels'][_0x5e3f1c['uniqueid']][_0xd3c7('0x23')]=this[_0xd3c7('0x10')][_0x51987e][_0xd3c7('0x23')];logger[_0xd3c7('0x24')](_0x5e3f1c[_0xd3c7('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0xd3c7('0x25')][_0x5e3f1c[_0xd3c7('0x21')]]){this[_0xd3c7('0xf')][_0x5e3f1c['uniqueid']]={};this['channels'][_0x5e3f1c[_0xd3c7('0x21')]]['channel']=_0x5e3f1c[_0xd3c7('0x22')];logger[_0xd3c7('0x24')](_0x5e3f1c[_0xd3c7('0x21')],_0xd3c7('0x26'));}};Fax[_0xd3c7('0x27')][_0xd3c7('0x28')]=function(_0x3e9200){if(this[_0xd3c7('0xf')][_0x3e9200[_0xd3c7('0x21')]]){for(var _0x51a62c in _0x3e9200[_0xd3c7('0x29')]){if(_0x3e9200[_0xd3c7('0x29')][_0xd3c7('0x20')](_0x51a62c)){this[_0xd3c7('0xf')][_0x3e9200[_0xd3c7('0x21')]][_0x51a62c]=_0x3e9200[_0xd3c7('0x2a')];}}}};Fax[_0xd3c7('0x27')]['syncNewState']=function(_0x2ae7a2){if(this[_0xd3c7('0xf')][_0x2ae7a2[_0xd3c7('0x21')]]){this['channels'][_0x2ae7a2['uniqueid']]['channelstate']=_0x2ae7a2[_0xd3c7('0x2b')];this[_0xd3c7('0xf')][_0x2ae7a2[_0xd3c7('0x21')]][_0xd3c7('0x2c')]=_0x2ae7a2['channelstatedesc'];}};Fax[_0xd3c7('0x27')][_0xd3c7('0x2d')]=function(_0x58dc1e){if(this[_0xd3c7('0xf')][_0x58dc1e[_0xd3c7('0x21')]]){for(var _0x1ac34e in _0x58dc1e['variable']){if(_0x58dc1e[_0xd3c7('0x29')][_0xd3c7('0x20')](_0x1ac34e)){this[_0xd3c7('0xf')][_0x58dc1e['uniqueid']][_0x1ac34e]=_0x58dc1e[_0xd3c7('0x2a')];}}}};Fax['prototype'][_0xd3c7('0x19')]=function(_0x34f2ce){if(this[_0xd3c7('0xf')][_0x34f2ce['uniqueid']]){this[_0xd3c7('0xf')][_0x34f2ce[_0xd3c7('0x21')]]['operation']=_0x34f2ce[_0xd3c7('0x2e')];this[_0xd3c7('0xf')][_0x34f2ce['uniqueid']][_0xd3c7('0x2f')]=_0x34f2ce['status'];this[_0xd3c7('0xf')][_0x34f2ce['uniqueid']]['localstationid']=_0x34f2ce[_0xd3c7('0x30')];this['channels'][_0x34f2ce[_0xd3c7('0x21')]][_0xd3c7('0x31')]=_0x34f2ce['filename'];logger[_0xd3c7('0x24')](_0x34f2ce[_0xd3c7('0x21')],_0xd3c7('0x32'));}};Fax[_0xd3c7('0x27')]['syncReceiveFax']=function(_0x482775){var _0x56a322=this;if(this[_0xd3c7('0xf')][_0x482775['uniqueid']]){var _0x45e8de=this['channels'][_0x482775[_0xd3c7('0x21')]]['id'];this[_0xd3c7('0xf')][_0x482775[_0xd3c7('0x21')]]['remotestationid']=_0x482775[_0xd3c7('0x33')];this['channels'][_0x482775[_0xd3c7('0x21')]][_0xd3c7('0x34')]=_0x482775[_0xd3c7('0x34')];this['channels'][_0x482775['uniqueid']][_0xd3c7('0x30')]=_0x482775[_0xd3c7('0x30')];this['channels'][_0x482775[_0xd3c7('0x21')]][_0xd3c7('0x35')]=_0x482775[_0xd3c7('0x35')];this[_0xd3c7('0xf')][_0x482775[_0xd3c7('0x21')]][_0xd3c7('0x36')]=_0x482775['transferrate'];this[_0xd3c7('0xf')][_0x482775[_0xd3c7('0x21')]]['filename']=_0x482775[_0xd3c7('0x31')];this[_0xd3c7('0xf')][_0x482775[_0xd3c7('0x21')]][_0xd3c7('0x37')]=_0x482775[_0xd3c7('0x37')];if(this[_0xd3c7('0xf')][_0x482775[_0xd3c7('0x21')]][_0xd3c7('0x34')]>0x0){tiff2pdf(_0x482775[_0xd3c7('0x31')],_0xd3c7('0x38'),function(_0x449586){logger['info'](_0x482775[_0xd3c7('0x21')],'\x20result\x20conversion\x20file\x20',_0x449586[_0xd3c7('0x39')]);attachment[_0xd3c7('0x3a')]({'name':path[_0xd3c7('0x3b')](_0x482775[_0xd3c7('0x31')])['name'],'basename':path[_0xd3c7('0x3b')](_0x482775['filename'])[_0xd3c7('0x23')]+'.pdf','type':_0xd3c7('0x3c')})[_0xd3c7('0x3d')](function(_0xdd017b){faxAccount[_0xd3c7('0x3e')](_0x45e8de,{'from':_0x482775['calleridnum'],'mapKey':_0xd3c7('0x3f'),'body':path[_0xd3c7('0x3b')](_0x482775[_0xd3c7('0x31')])[_0xd3c7('0x23')]+'.pdf','AttachmentId':_0xdd017b['id']})['catch'](function(_0x577d54){logger['error'](_0x482775[_0xd3c7('0x21')],_0xd3c7('0x40'),JSON[_0xd3c7('0x41')](_0x577d54));});})[_0xd3c7('0x42')](function(_0x41017c){logger[_0xd3c7('0x43')](_0x482775[_0xd3c7('0x21')],_0xd3c7('0x44'),JSON[_0xd3c7('0x41')](_0x41017c));});});}logger['info'](_0x482775[_0xd3c7('0x21')],'\x20receiveFax\x20');}};Fax[_0xd3c7('0x27')][_0xd3c7('0x1d')]=function(_0x43cd3f){if(this[_0xd3c7('0x25')][_0x43cd3f[_0xd3c7('0x21')]]){_['merge'](this[_0xd3c7('0xf')][_0x43cd3f[_0xd3c7('0x21')]],_[_0xd3c7('0x45')](_0x43cd3f,['response',_0xd3c7('0x46')]));}};function updateStatus(_0x560e0e){if(_0x560e0e[_0xd3c7('0x47')]){faxMessage[_0xd3c7('0x48')](_0x560e0e[_0xd3c7('0x47')],{'failMessage':_0xd3c7('0x49')})[_0xd3c7('0x3d')](function(_0x524c15){ut[_0xd3c7('0x4a')](_0xd3c7('0x4b'),_0x524c15);})[_0xd3c7('0x42')](function(_0x4c2052){ut['logger'](_0xd3c7('0x4c'),_0x4c2052);});}else{ut['logger'](_0xd3c7('0x4d'));}}Fax['prototype'][_0xd3c7('0x4e')]=function(_0x161e4f,_0x58fe6f,_0x9c6795){var _0x3da983=this;var _0x494e39={};if(_0x58fe6f){_0x494e39={'read':_0x58fe6f};}else{_0x494e39={'failMessage':_0x9c6795};}if(this[_0xd3c7('0x25')][_0x161e4f][_0xd3c7('0x47')]){faxMessage[_0xd3c7('0x48')](this['actions'][_0x161e4f][_0xd3c7('0x47')],_0x494e39)[_0xd3c7('0x3d')](function(_0x2a5a81){ut[_0xd3c7('0x4a')]('[Fax][Message][Updated]',_0x2a5a81);})['catch'](function(_0x34bdc9){ut['logger'](_0xd3c7('0x4f'),_0x34bdc9);})['finally'](function(){delete _0x3da983[_0xd3c7('0xf')][_0x161e4f];delete _0x3da983[_0xd3c7('0x25')][_0x161e4f];});}else{ut[_0xd3c7('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0xd3c7('0xf')][_0x161e4f];delete this[_0xd3c7('0x25')][_0x161e4f];}};Fax['prototype'][_0xd3c7('0x1c')]=function(_0x55bfd9){var _0x536bfe=this;if(this['channels'][_0x55bfd9['uniqueid']]){if(this[_0xd3c7('0x25')][_0x55bfd9[_0xd3c7('0x21')]]){this[_0xd3c7('0xf')][_0x55bfd9['uniqueid']]['id']=this[_0xd3c7('0x25')][_0x55bfd9['uniqueid']]['id'];this[_0xd3c7('0xf')][_0x55bfd9['uniqueid']]['name']=this['actions'][_0x55bfd9[_0xd3c7('0x21')]][_0xd3c7('0x23')];}logger[_0xd3c7('0x24')](_0x55bfd9[_0xd3c7('0x21')],this['actions'][_0x55bfd9[_0xd3c7('0x21')]]?_0xd3c7('0x50'):_0xd3c7('0x51'),JSON[_0xd3c7('0x41')](this[_0xd3c7('0xf')][_0x55bfd9[_0xd3c7('0x21')]]));if(this['actions'][_0x55bfd9[_0xd3c7('0x21')]]){if(this['channels'][_0x55bfd9['uniqueid']][_0xd3c7('0x52')]>0x0&&this[_0xd3c7('0xf')][_0x55bfd9[_0xd3c7('0x21')]]['faxstatus']==='SUCCESS'){this[_0xd3c7('0x4e')](_0x55bfd9['uniqueid'],!![]);}else{this[_0xd3c7('0x4e')](_0x55bfd9[_0xd3c7('0x21')],![],this[_0xd3c7('0xf')][_0x55bfd9[_0xd3c7('0x21')]][_0xd3c7('0x53')]?'SENDING\x20FAILED:\x20'+this[_0xd3c7('0xf')][_0x55bfd9['uniqueid']][_0xd3c7('0x53')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xd3c7('0x54')]=function(_0x1da803){var _0x34504d=this;return new BPromise(function(_0x13ddb4,_0x57775e){_0x34504d[_0xd3c7('0x55')](_0x1da803,_0x34504d[_0xd3c7('0x10')][_0x1da803[_0xd3c7('0x56')]])['then'](function(_0x2de618){ut['logger'](_0xd3c7('0x57'),_0x2de618);_0x13ddb4(ut[_0xd3c7('0x39')](_0xd3c7('0x58')));})[_0xd3c7('0x42')](function(_0x34f588){ut[_0xd3c7('0x4a')](_0xd3c7('0x59'),_0x34f588);updateStatus(_0x1da803);_0x57775e(ut['message'](_0xd3c7('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x155284){var _0x57878a=this;return new BPromise(function(_0xd92991,_0x1f9138){var _0x3556bf=_0x57878a[_0xd3c7('0x5b')](_0x57878a['faxAccounts'][_0x155284[_0xd3c7('0x56')]][_0xd3c7('0x5c')],_0x155284);if(_0x3556bf[_0xd3c7('0x5d')]){_0xd92991(ut['message'](_0xd3c7('0x5e')));}else{_0x1f9138(ut[_0xd3c7('0x39')](_0x3556bf[_0xd3c7('0x39')]));}});};function originate(_0x32f2f9,_0x43b6c9,_0x1892ef){return new BPromise(function(_0x37a589,_0x12e511){if(_0x1892ef){var _0x1f0b44=util[_0xd3c7('0x5f')]('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[_0xd3c7('0x3b')](_0x32f2f9[_0xd3c7('0x3')])[_0xd3c7('0x23')],_0x32f2f9[_0xd3c7('0x3')]);gs[_0xd3c7('0x60')](_0x1f0b44)[_0xd3c7('0x3d')](function(){_0x32f2f9[_0xd3c7('0x3')]=util[_0xd3c7('0x5f')](_0xd3c7('0x61'),path['parse'](_0x32f2f9['path'])['dir'],path[_0xd3c7('0x3b')](_0x32f2f9[_0xd3c7('0x3')])[_0xd3c7('0x23')]);_0x43b6c9['XMF-PATH']=_0x32f2f9[_0xd3c7('0x3')];ut[_0xd3c7('0x4a')](_0xd3c7('0x62'),'');ami[_0xd3c7('0x63')](ut['variablesAction'](_0x32f2f9,_0x43b6c9))[_0xd3c7('0x3d')](function(_0x15cc76){_0x37a589(_0x15cc76);})['catch'](function(_0x4650e8){_0x12e511(_0x4650e8);});})['catch'](function(_0x466f78){_0x12e511(_0x466f78);});}else{ami[_0xd3c7('0x63')](ut[_0xd3c7('0x64')](_0x32f2f9,_0x43b6c9))[_0xd3c7('0x3d')](function(_0x29aeb4){_0x37a589(_0x29aeb4);})['catch'](function(_0x2a12a9){_0x12e511(_0x2a12a9);});}});}Fax[_0xd3c7('0x27')][_0xd3c7('0x55')]=function(_0x4546b4,_0x3ba3a9){var _0x185d65=this;return new BPromise(function(_0x4b8da7,_0x1b7d45){var _0x545c02=uuid['v4']();var _0x502967=ut[_0xd3c7('0x65')](_0x4546b4,_0x3ba3a9);_0x185d65['actions'][_0x545c02]=new Action(_0x545c02,_0x3ba3a9,_0x4546b4);var _0x18e955=_0x185d65[_0xd3c7('0x25')][_0x545c02];if(path['parse'](_0x4546b4[_0xd3c7('0x3')])[_0xd3c7('0x66')]==='.pdf'){originate(_0x18e955,_0x502967,!![])[_0xd3c7('0x3d')](function(_0xb7692f){_0x4b8da7(_0xb7692f);})[_0xd3c7('0x42')](function(_0x189b8c){_0x1b7d45(_0x189b8c);});}else{originate(_0x18e955,_0x502967,![])[_0xd3c7('0x3d')](function(_0xcdc4bf){_0x4b8da7(_0xcdc4bf);})[_0xd3c7('0x42')](function(_0x41f129){_0x1b7d45(_0x41f129);});}});};Fax[_0xd3c7('0x27')]['isTrunkReachable']=function(_0x129389){return!_[_0xd3c7('0x67')](_0x129389)&&!_[_0xd3c7('0x67')](_0x129389['name'])&&!_['isNil'](_0x129389[_0xd3c7('0x68')])&&_0x129389[_0xd3c7('0x68')]&&!_['isNil'](this[_0xd3c7('0x11')][util[_0xd3c7('0x5f')](_0xd3c7('0x69'),_0x129389[_0xd3c7('0x23')])])&&!_[_0xd3c7('0x67')](this[_0xd3c7('0x11')][util[_0xd3c7('0x5f')]('SIP/%s',_0x129389[_0xd3c7('0x23')])][_0xd3c7('0x2f')])&&(this[_0xd3c7('0x11')][util[_0xd3c7('0x5f')]('SIP/%s',_0x129389['name'])][_0xd3c7('0x2f')]===_0xd3c7('0x6a')||this[_0xd3c7('0x11')][util[_0xd3c7('0x5f')](_0xd3c7('0x69'),_0x129389[_0xd3c7('0x23')])]['status']==='unmonitored');};Fax[_0xd3c7('0x27')][_0xd3c7('0x5b')]=function(_0x379259,_0x4dd728){if(!this[_0xd3c7('0x6b')](_0x379259)){ut[_0xd3c7('0x4a')](_0xd3c7('0x6c'),_[_0xd3c7('0x67')](_0x379259)?'':_0x379259[_0xd3c7('0x23')]+_0xd3c7('0x6d'));return{'isValid':![],'message':_0xd3c7('0x6e')};}if(_[_0xd3c7('0x67')](_0x4dd728[_0xd3c7('0x3f')])){ut[_0xd3c7('0x4a')](_0xd3c7('0x6f'),JSON['stringify'](_0x4dd728));return{'isValid':![],'message':_0xd3c7('0x70')};}if(_[_0xd3c7('0x67')](_0x4dd728[_0xd3c7('0x3')])){ut[_0xd3c7('0x4a')](_0xd3c7('0x71'),JSON['stringify'](_0x4dd728));return{'isValid':![],'message':_0xd3c7('0x72')};}return{'isValid':!![],'message':_0xd3c7('0x73')};};module[_0xd3c7('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3ca0342..4edbfc1 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 _0x4a62=['notify','catch','[Notify]\x20','util','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0xb91742,_0x1e203f){var _0x19402c=function(_0xe6d76d){while(--_0xe6d76d){_0xb91742['push'](_0xb91742['shift']());}};_0x19402c(++_0x1e203f);}(_0x4a62,0x92));var _0x24a6=function(_0x136120,_0x25bf2b){_0x136120=_0x136120-0x0;var _0xd81136=_0x4a62[_0x136120];return _0xd81136;};'use strict';var util=require(_0x24a6('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x24a6('0x1'));var _=require(_0x24a6('0x2'));var faxAccount=require(_0x24a6('0x3'));function loggerCatch(_0xa578ff){return function(_0x69f5b2){logger[_0x24a6('0x4')](_0xa578ff,util[_0x24a6('0x5')](_0x69f5b2,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1fb599,_0x4a1b52){return BPromise[_0x24a6('0x6')]()[_0x24a6('0x7')](faxAccount[_0x24a6('0x8')](_0x1fb599,_0x4a1b52))[_0x24a6('0x9')](loggerCatch(_0x24a6('0xa')));}; \ No newline at end of file +var _0xfa84=['lodash','notify','resolve','catch','bluebird','../../../config/logger','preview'];(function(_0x241c3b,_0x592963){var _0x1fef38=function(_0x4cb4ba){while(--_0x4cb4ba){_0x241c3b['push'](_0x241c3b['shift']());}};_0x1fef38(++_0x592963);}(_0xfa84,0x185));var _0x4fa8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfa84[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var BPromise=require(_0x4fa8('0x0'));var logger=require(_0x4fa8('0x1'))(_0x4fa8('0x2'));var _=require(_0x4fa8('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5ea10b){return function(_0x54f043){logger['error'](_0x5ea10b,util['inspect'](_0x54f043,{'showHidden':![],'depth':null}));};}exports[_0x4fa8('0x4')]=function(_0x55c71e,_0x266c2c){return BPromise[_0x4fa8('0x5')]()['then'](faxAccount[_0x4fa8('0x4')](_0x55c71e,_0x266c2c))[_0x4fa8('0x6')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 4e33528..d60251f 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 _0x6b73=['bluebird','child_process','exec','info','Exec\x20gs','inspect','util','../../../../config/logger','fax'];(function(_0x5c03dd,_0x33e71c){var _0x145de9=function(_0x4a7537){while(--_0x4a7537){_0x5c03dd['push'](_0x5c03dd['shift']());}};_0x145de9(++_0x33e71c);}(_0x6b73,0x72));var _0x36b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b73[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x36b7('0x0'));var logger=require(_0x36b7('0x1'))(_0x36b7('0x2'));var BPromise=require(_0x36b7('0x3'));var exec=require(_0x36b7('0x4'))[_0x36b7('0x5')];exports['execute']=function(_0xa54d34){return new BPromise(function(_0x3059f1,_0x195908){exec(_0xa54d34,function(_0x3dc05b,_0x35d6ff,_0x1f7e6f){logger[_0x36b7('0x6')](_0x36b7('0x7'),_0x35d6ff);if(_0x3dc05b){logger[_0x36b7('0x6')]('Exec\x20gs','\x20Error\x20:',util[_0x36b7('0x8')](_0x3dc05b,{'showHidden':![],'depth':null}),_0x35d6ff,_0x1f7e6f);_0x195908(_0x3dc05b);}_0x3059f1(_0x35d6ff);});});}; \ No newline at end of file +var _0xa89c=['inspect','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xa89c,0xa1));var _0xca89=function(_0x370c9e,_0x2d2f87){_0x370c9e=_0x370c9e-0x0;var _0x1e3a1f=_0xa89c[_0x370c9e];return _0x1e3a1f;};'use strict';var util=require('util');var logger=require(_0xca89('0x0'))(_0xca89('0x1'));var BPromise=require(_0xca89('0x2'));var exec=require('child_process')[_0xca89('0x3')];exports[_0xca89('0x4')]=function(_0x40635f){return new BPromise(function(_0x1db4a7,_0x347321){exec(_0x40635f,function(_0x559c1d,_0x5a2ceb,_0x1ea7a7){logger[_0xca89('0x5')](_0xca89('0x6'),_0x5a2ceb);if(_0x559c1d){logger[_0xca89('0x5')](_0xca89('0x6'),'\x20Error\x20:',util[_0xca89('0x7')](_0x559c1d,{'showHidden':![],'depth':null}),_0x5a2ceb,_0x1ea7a7);_0x347321(_0x559c1d);}_0x1db4a7(_0x5a2ceb);});});}; \ 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 2460872..f3bfa8b 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 _0x8498=['originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction'];(function(_0xbf7f82,_0x3114d4){var _0x3165fa=function(_0x34bb41){while(--_0x34bb41){_0xbf7f82['push'](_0xbf7f82['shift']());}};_0x3165fa(++_0x3114d4);}(_0x8498,0x1a7));var _0x8849=function(_0xae0b69,_0x2bd756){_0xae0b69=_0xae0b69-0x0;var _0x5e183e=_0x8498[_0xae0b69];return _0x5e183e;};'use strict';var util=require('util');var _=require(_0x8849('0x0'));var moment=require(_0x8849('0x1'));var logger=require(_0x8849('0x2'))(_0x8849('0x3'));exports[_0x8849('0x4')]=function(_0x576570){return{'message':_0x576570};};exports[_0x8849('0x5')]=function(_0x4ce174,_0x3bd809){logger['info'](_0x4ce174,util['inspect'](_0x3bd809,{'showHidden':![],'depth':null}));};exports[_0x8849('0x6')]=function(_0x1ab0bd,_0x352751){var _0x372e53={'XMF-ECM':_0x352751[_0x8849('0x7')],'XMF-HEADERINFO':_0x352751[_0x8849('0x8')],'XMF-MINRATE':_0x352751['minrate'],'XMF-MAXRATE':_0x352751[_0x8849('0x9')],'XMF-MODEM':util['format'](_0x8849('0xa'),_0x352751[_0x8849('0xb')]),'XMF-GATEWAY':_0x352751['gateway'],'XMF-FAXDETECT':_0x352751[_0x8849('0xc')],'XMF-T38TIMEOUT':_0x352751[_0x8849('0xd')],'XMF-LOCALSTATIONID':_0x352751[_0x8849('0xe')],'XMF-PATH':_0x1ab0bd[_0x8849('0xf')]};return _0x372e53;};exports[_0x8849('0x10')]=function(_0xec36cf,_0x5411fa){return{'actionid':_0xec36cf['uniqueid'],'action':_0x8849('0x11'),'channel':_0xec36cf[_0x8849('0x12')],'Exten':_0x8849('0x13'),'Context':_0x8849('0x14'),'Priority':'1','callerid':util['format'](_0x8849('0x15'),_0xec36cf[_0x8849('0x8')]?_0xec36cf[_0x8849('0x8')]:'',_0xec36cf[_0x8849('0xe')]),'variable':_0x5411fa,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xec36cf['uniqueid']};}; \ No newline at end of file +var _0x7858=['util','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid'];(function(_0x4f30f4,_0x5a434c){var _0x58c6a6=function(_0x214522){while(--_0x214522){_0x4f30f4['push'](_0x4f30f4['shift']());}};_0x58c6a6(++_0x5a434c);}(_0x7858,0x8a));var _0x8785=function(_0x44ae75,_0x5ae7ee){_0x44ae75=_0x44ae75-0x0;var _0x12e1c7=_0x7858[_0x44ae75];return _0x12e1c7;};'use strict';var util=require(_0x8785('0x0'));var _=require('lodash');var moment=require(_0x8785('0x1'));var logger=require(_0x8785('0x2'))(_0x8785('0x3'));exports[_0x8785('0x4')]=function(_0x477d84){return{'message':_0x477d84};};exports[_0x8785('0x5')]=function(_0x195105,_0x5ac89b){logger['info'](_0x195105,util['inspect'](_0x5ac89b,{'showHidden':![],'depth':null}));};exports[_0x8785('0x6')]=function(_0x5202b2,_0x58ad79){var _0x5acc6d={'XMF-ECM':_0x58ad79[_0x8785('0x7')],'XMF-HEADERINFO':_0x58ad79[_0x8785('0x8')],'XMF-MINRATE':_0x58ad79['minrate'],'XMF-MAXRATE':_0x58ad79[_0x8785('0x9')],'XMF-MODEM':util[_0x8785('0xa')](_0x8785('0xb'),_0x58ad79['modem']),'XMF-GATEWAY':_0x58ad79[_0x8785('0xc')],'XMF-FAXDETECT':_0x58ad79[_0x8785('0xd')],'XMF-T38TIMEOUT':_0x58ad79[_0x8785('0xe')],'XMF-LOCALSTATIONID':_0x58ad79['localstationid'],'XMF-PATH':_0x5202b2[_0x8785('0xf')]};return _0x5acc6d;};exports[_0x8785('0x10')]=function(_0x581fb6,_0x3fadac){return{'actionid':_0x581fb6['uniqueid'],'action':_0x8785('0x11'),'channel':_0x581fb6[_0x8785('0x12')],'Exten':_0x8785('0x13'),'Context':_0x8785('0x14'),'Priority':'1','callerid':util[_0x8785('0xa')](_0x8785('0x15'),_0x581fb6[_0x8785('0x8')]?_0x581fb6[_0x8785('0x8')]:'',_0x581fb6['localstationid']),'variable':_0x3fadac,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x581fb6[_0x8785('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 535569c..4b9ffa9 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 _0x1642=['getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts'];(function(_0x5a704d,_0x4082d8){var _0x1f76e1=function(_0x3d20c0){while(--_0x3d20c0){_0x5a704d['push'](_0x5a704d['shift']());}};_0x1f76e1(++_0x4082d8);}(_0x1642,0x1ed));var _0x2164=function(_0x4a1433,_0x509eb6){_0x4a1433=_0x4a1433-0x0;var _0x24858a=_0x1642[_0x4a1433];return _0x24858a;};'use strict';var util=require(_0x2164('0x0'));var moment=require(_0x2164('0x1'));var server=require(_0x2164('0x2'));var Realtime=require(_0x2164('0x3'));var Report=require(_0x2164('0x4'));var Acw=require('./acw');var Trigger=require(_0x2164('0x5'));var Dialer=require(_0x2164('0x6'));var Preview=require(_0x2164('0x7'));var Fax=require(_0x2164('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2164('0x9'));var trunk=require(_0x2164('0xa'));var trigger=require(_0x2164('0xb'));var template=require(_0x2164('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x2164('0xd'));var voiceExtension=require(_0x2164('0xe'));var faxAccount=require(_0x2164('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x2164('0x10'));var sugarcrm=require(_0x2164('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x2164('0x12'));var zoho=require(_0x2164('0x13'));var vtiger=require(_0x2164('0x14'));var freshsales=require(_0x2164('0x15'));var servicenow=require(_0x2164('0x16'));var dynamics365=require(_0x2164('0x17'));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(_0x2164('0x18'))(_0x2164('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2164('0x1a')](_0x2164('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2164('0x1a')](_0x2164('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x2164('0x1c')](user[_0x2164('0x1d')]())[_0x2164('0x1c')](realtime[_0x2164('0x1e')]())[_0x2164('0x1c')](user[_0x2164('0x1f')]())['then'](realtime[_0x2164('0x20')]())[_0x2164('0x1c')](trunk[_0x2164('0x21')]())[_0x2164('0x1c')](realtime[_0x2164('0x22')]())[_0x2164('0x1c')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x2164('0x23')]())[_0x2164('0x1c')](trigger[_0x2164('0x24')]())[_0x2164('0x1c')](realtime['initTriggers']())[_0x2164('0x1c')](template[_0x2164('0x25')]())[_0x2164('0x1c')](realtime[_0x2164('0x26')]())['then'](zendesk['getZendeskAccounts']())[_0x2164('0x1c')](realtime[_0x2164('0x27')]())[_0x2164('0x1c')](salesforce[_0x2164('0x28')]())[_0x2164('0x1c')](realtime[_0x2164('0x29')]())[_0x2164('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x2164('0x1c')](realtime[_0x2164('0x2a')]())[_0x2164('0x1c')](freshdesk[_0x2164('0x2b')]())[_0x2164('0x1c')](realtime[_0x2164('0x2c')]())[_0x2164('0x1c')](desk['getDeskAccounts']())[_0x2164('0x1c')](realtime[_0x2164('0x2d')]())[_0x2164('0x1c')](zoho[_0x2164('0x2e')]())[_0x2164('0x1c')](realtime[_0x2164('0x2f')]())['then'](vtiger[_0x2164('0x30')]())[_0x2164('0x1c')](realtime[_0x2164('0x31')]())[_0x2164('0x1c')](freshsales[_0x2164('0x32')]())[_0x2164('0x1c')](realtime['initFreshsalesAccounts']())[_0x2164('0x1c')](servicenow[_0x2164('0x33')]())[_0x2164('0x1c')](realtime[_0x2164('0x34')]())[_0x2164('0x1c')](dynamics365['getDynamics365Accounts']())[_0x2164('0x1c')](realtime[_0x2164('0x35')]())[_0x2164('0x1c')](campaign['getCampaigns']())[_0x2164('0x1c')](realtime[_0x2164('0x36')]())['then'](voiceExtension[_0x2164('0x37')]())[_0x2164('0x1c')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x2164('0x38')]())[_0x2164('0x1c')](realtime[_0x2164('0x39')]())[_0x2164('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x2164('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x2164('0x1c')](realtime[_0x2164('0x3a')]())[_0x2164('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x2164('0x1c')](realtime[_0x2164('0x3b')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x2164('0x1c')](realtime['initCampaignHopperHistory']())[_0x2164('0x1c')](voiceCallReport[_0x2164('0x3c')]())[_0x2164('0x1c')](realtime[_0x2164('0x3d')]())[_0x2164('0x3e')](function(_0x241798){logger[_0x2164('0x3f')]('[index.js][initParams]',util['inspect'](_0x241798,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x2164('0x1c')](function(){return initParams();})[_0x2164('0x1c')](function(){report[_0x2164('0x40')]();setInterval(initRealtime,0x1388);})[_0x2164('0x3e')](function(_0x26b826){logger['error'](_0x2164('0x41'),util[_0x2164('0x42')](_0x26b826,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb04c=['./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','error','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./report','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0xb04c,0xc8));var _0xcb04=function(_0x3b2d95,_0x475e8c){_0x3b2d95=_0x3b2d95-0x0;var _0x127d32=_0xb04c[_0x3b2d95];return _0x127d32;};'use strict';var util=require(_0xcb04('0x0'));var moment=require(_0xcb04('0x1'));var server=require(_0xcb04('0x2'));var Realtime=require('./realtime');var Report=require(_0xcb04('0x3'));var Acw=require(_0xcb04('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xcb04('0x5'));var Preview=require('./preview');var Fax=require(_0xcb04('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xcb04('0x7'));var voiceQueueReport=require(_0xcb04('0x8'));var voiceCallReport=require(_0xcb04('0x9'));var trunk=require(_0xcb04('0xa'));var trigger=require(_0xcb04('0xb'));var template=require(_0xcb04('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xcb04('0xd'));var voiceExtension=require(_0xcb04('0xe'));var faxAccount=require(_0xcb04('0xf'));var zendesk=require(_0xcb04('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xcb04('0x11'));var freshdesk=require(_0xcb04('0x12'));var desk=require(_0xcb04('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xcb04('0x14'));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(_0xcb04('0x15'))(_0xcb04('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xcb04('0x17')](_0xcb04('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xcb04('0x19')]()[_0xcb04('0x1a')](user[_0xcb04('0x1b')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x1c')]())[_0xcb04('0x1a')](user[_0xcb04('0x1d')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x1e')]())['then'](trunk[_0xcb04('0x1f')]())[_0xcb04('0x1a')](realtime['initTrunks']())[_0xcb04('0x1a')](voiceQueue[_0xcb04('0x20')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x21')]())[_0xcb04('0x1a')](trigger[_0xcb04('0x22')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x23')]())[_0xcb04('0x1a')](template[_0xcb04('0x24')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x25')]())[_0xcb04('0x1a')](zendesk[_0xcb04('0x26')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x27')]())[_0xcb04('0x1a')](salesforce[_0xcb04('0x28')]())['then'](realtime[_0xcb04('0x29')]())['then'](sugarcrm[_0xcb04('0x2a')]())['then'](realtime[_0xcb04('0x2b')]())[_0xcb04('0x1a')](freshdesk['getFreshdeskAccounts']())[_0xcb04('0x1a')](realtime[_0xcb04('0x2c')]())[_0xcb04('0x1a')](desk[_0xcb04('0x2d')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x2e')]())[_0xcb04('0x1a')](zoho[_0xcb04('0x2f')]())['then'](realtime[_0xcb04('0x30')]())[_0xcb04('0x1a')](vtiger[_0xcb04('0x31')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x32')]())[_0xcb04('0x1a')](freshsales[_0xcb04('0x33')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x34')]())[_0xcb04('0x1a')](servicenow[_0xcb04('0x35')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x36')]())[_0xcb04('0x1a')](dynamics365[_0xcb04('0x37')]())['then'](realtime[_0xcb04('0x38')]())['then'](campaign[_0xcb04('0x39')]())[_0xcb04('0x1a')](realtime[_0xcb04('0x3a')]())[_0xcb04('0x1a')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xcb04('0x3b')]())[_0xcb04('0x1a')](faxAccount[_0xcb04('0x3c')]())['then'](realtime['initFaxAccounts']())[_0xcb04('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0xcb04('0x19')]()[_0xcb04('0x1a')](voiceQueueReport[_0xcb04('0x3d')]())['then'](realtime[_0xcb04('0x3e')]())['then'](cmHopperHistory[_0xcb04('0x3f')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xcb04('0x1a')](cmHopperHistory[_0xcb04('0x40')]())[_0xcb04('0x1a')](realtime['initCampaignHopperHistory']())[_0xcb04('0x1a')](voiceCallReport[_0xcb04('0x41')]())[_0xcb04('0x1a')](realtime['initVoiceCallReports']())['catch'](function(_0x1a0af6){logger[_0xcb04('0x42')]('[index.js][initParams]',util[_0xcb04('0x43')](_0x1a0af6,{'showHidden':![],'depth':null}));});}function main(){return server[_0xcb04('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xcb04('0x1a')](function(){return initParams();})['then'](function(){report[_0xcb04('0x45')]();setInterval(initRealtime,0x1388);})[_0xcb04('0x46')](function(_0x3cc150){logger['error'](_0xcb04('0x47'),util['inspect'](_0x3cc150,{'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 b0de0f3..46ae718 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 _0x9ba9=['voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','toNumber','stateTime','stringify','format','user:%s','emit','user:ami:update','lodash','moment','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','accountcode','fullname','state','unknown','status','address','mobile','interface','online','voiceStatus'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x9ba9,0x141));var _0x99ba=function(_0x23a1cf,_0x4a38b2){_0x23a1cf=_0x23a1cf-0x0;var _0x19bc58=_0x9ba9[_0x23a1cf];return _0x19bc58;};'use strict';var _=require(_0x99ba('0x0'));var util=require('util');var moment=require(_0x99ba('0x1'));var md5=require(_0x99ba('0x2'));var Redis=require('ioredis');var config=require(_0x99ba('0x3'));config['redis']=_[_0x99ba('0x4')](config[_0x99ba('0x5')],{'host':_0x99ba('0x6'),'port':0x18eb});var io=require(_0x99ba('0x7'))(new Redis(config['redis']));function Agent(_0x102a80){this['id']=_0x102a80['id']||0x0;this[_0x99ba('0x8')]=_0x102a80[_0x99ba('0x8')]||'';this['email']=_0x102a80['email']||'';this[_0x99ba('0x9')]=_0x102a80[_0x99ba('0x9')]||'';this[_0x99ba('0xa')]=_0x102a80[_0x99ba('0xa')]||'';this[_0x99ba('0xb')]=_0x99ba('0xc');this['stateTime']=0x0;this[_0x99ba('0xd')]=_0x99ba('0xc');this[_0x99ba('0xe')]='';this['phone']='';this[_0x99ba('0xf')]='';this[_0x99ba('0x10')]='';this[_0x99ba('0x11')]=_0x102a80[_0x99ba('0x11')]||![];this[_0x99ba('0x12')]=_0x99ba('0xc');this[_0x99ba('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x99ba('0x14')]='';this[_0x99ba('0x15')]=![];this[_0x99ba('0x16')]=![];this[_0x99ba('0x2')]='';}Agent['prototype'][_0x99ba('0x17')]=function(_0x3517fc){var _0x20add8;if(_0x3517fc&&_0x3517fc['state']){_0x20add8=_0x3517fc[_0x99ba('0xb')][_0x99ba('0x18')]();switch(_0x20add8){case _0x99ba('0x19'):_0x20add8='idle';break;case _0x99ba('0x1a'):_0x20add8='talking';break;}}if(_0x20add8&&this[_0x99ba('0x12')]!==_0x20add8||_0x3517fc['statePause']){this[_0x99ba('0x13')]=_[_0x99ba('0x1b')](moment()['format']('x'));}if(_0x20add8){this[_0x99ba('0x12')]=_0x20add8;}var _0x211367={'id':this['id'],'name':this[_0x99ba('0x8')],'email':this['email'],'accountcode':this[_0x99ba('0x9')],'fullname':this['fullname'],'state':this[_0x99ba('0xb')],'stateTime':this[_0x99ba('0x1c')],'status':this[_0x99ba('0xd')],'address':this[_0x99ba('0xe')],'online':this[_0x99ba('0x11')],'voiceStatus':this[_0x99ba('0x12')],'voiceStatusTime':this[_0x99ba('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x99ba('0x14')],'interface':this[_0x99ba('0x10')],'onhold':this[_0x99ba('0x15')]};var _0x467ece=md5(JSON[_0x99ba('0x1d')](_0x211367));if(this[_0x99ba('0x2')]!==_0x467ece){this[_0x99ba('0x2')]=_0x467ece;io['to'](util[_0x99ba('0x1e')](_0x99ba('0x1f'),_0x211367['name']))[_0x99ba('0x20')](_0x99ba('0x21'),_['omit'](_0x211367,[_0x99ba('0x11')]));io[_0x99ba('0x20')]('user:presence',_0x211367);}};module['exports']=Agent; \ No newline at end of file +var _0x5ce4=['emit','user:ami:update','omit','user:presence','exports','lodash','util','md5','redis','localhost','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','status','address','phone','online','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','idle','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','email','voiceStatusCallerIdNumber','interface','user:%s'];(function(_0x32088f,_0x538e0a){var _0x43abf1=function(_0x52c41d){while(--_0x52c41d){_0x32088f['push'](_0x32088f['shift']());}};_0x43abf1(++_0x538e0a);}(_0x5ce4,0x1c1));var _0x45ce=function(_0xbeab9,_0x37ec4a){_0xbeab9=_0xbeab9-0x0;var _0x27650c=_0x5ce4[_0xbeab9];return _0x27650c;};'use strict';var _=require(_0x45ce('0x0'));var util=require(_0x45ce('0x1'));var moment=require('moment');var md5=require(_0x45ce('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x45ce('0x3')]=_['defaults'](config[_0x45ce('0x3')],{'host':_0x45ce('0x4'),'port':0x18eb});var io=require(_0x45ce('0x5'))(new Redis(config['redis']));function Agent(_0x3bb1f7){this['id']=_0x3bb1f7['id']||0x0;this[_0x45ce('0x6')]=_0x3bb1f7['name']||'';this['email']=_0x3bb1f7['email']||'';this['accountcode']=_0x3bb1f7[_0x45ce('0x7')]||'';this['fullname']=_0x3bb1f7[_0x45ce('0x8')]||'';this[_0x45ce('0x9')]=_0x45ce('0xa');this[_0x45ce('0xb')]=0x0;this[_0x45ce('0xc')]='unknown';this[_0x45ce('0xd')]='';this[_0x45ce('0xe')]='';this['mobile']='';this['interface']='';this[_0x45ce('0xf')]=_0x3bb1f7[_0x45ce('0xf')]||![];this['voiceStatus']=_0x45ce('0xa');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x45ce('0x10')]='';this[_0x45ce('0x11')]=![];this[_0x45ce('0x12')]=![];this[_0x45ce('0x2')]='';}Agent['prototype'][_0x45ce('0x13')]=function(_0x2f4e92){var _0x4ab1d6;if(_0x2f4e92&&_0x2f4e92[_0x45ce('0x9')]){_0x4ab1d6=_0x2f4e92[_0x45ce('0x9')][_0x45ce('0x14')]();switch(_0x4ab1d6){case'not_inuse':_0x4ab1d6=_0x45ce('0x15');break;case'inuse':_0x4ab1d6=_0x45ce('0x16');break;}}if(_0x4ab1d6&&this[_0x45ce('0x17')]!==_0x4ab1d6||_0x2f4e92[_0x45ce('0x18')]){this[_0x45ce('0x19')]=_[_0x45ce('0x1a')](moment()[_0x45ce('0x1b')]('x'));}if(_0x4ab1d6){this['voiceStatus']=_0x4ab1d6;}var _0x3d3a26={'id':this['id'],'name':this[_0x45ce('0x6')],'email':this[_0x45ce('0x1c')],'accountcode':this[_0x45ce('0x7')],'fullname':this[_0x45ce('0x8')],'state':this[_0x45ce('0x9')],'stateTime':this[_0x45ce('0xb')],'status':this[_0x45ce('0xc')],'address':this['address'],'online':this[_0x45ce('0xf')],'voiceStatus':this[_0x45ce('0x17')],'voiceStatusTime':this[_0x45ce('0x19')],'voiceStatusCallerIdNumber':this[_0x45ce('0x1d')],'voiceStatusQueue':this[_0x45ce('0x10')],'interface':this[_0x45ce('0x1e')],'onhold':this[_0x45ce('0x11')]};var _0x14215b=md5(JSON['stringify'](_0x3d3a26));if(this[_0x45ce('0x2')]!==_0x14215b){this[_0x45ce('0x2')]=_0x14215b;io['to'](util['format'](_0x45ce('0x1f'),_0x3d3a26[_0x45ce('0x6')]))[_0x45ce('0x20')](_0x45ce('0x21'),_[_0x45ce('0x22')](_0x3d3a26,['online']));io[_0x45ce('0x20')](_0x45ce('0x23'),_0x3d3a26);}};module[_0x45ce('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e3d051a..ccd5cbf 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 _0xd910=['dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0xd910,0x116));var _0x0d91=function(_0x50c9d9,_0x5f2417){_0x50c9d9=_0x50c9d9-0x0;var _0x277ec7=_0xd910[_0x50c9d9];return _0x277ec7;};'use strict';function Campaign(_0x980290){this['id']=_0x980290['id']||0x0;this[_0x0d91('0x0')]=_0x980290[_0x0d91('0x0')]||'';this[_0x0d91('0x1')]=_0x980290[_0x0d91('0x1')]||_0x0d91('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x0d91('0x3')]=0x0;this[_0x0d91('0x4')]=0x0;this[_0x0d91('0x5')]='';this[_0x0d91('0x6')]=!![];this[_0x0d91('0x7')]=_0x980290[_0x0d91('0x7')];this[_0x0d91('0x8')]=_0x980290[_0x0d91('0x8')];this[_0x0d91('0x9')]=_0x980290[_0x0d91('0x9')]||null;this[_0x0d91('0xa')]=_0x980290[_0x0d91('0xa')]?_0x980290['dialGlobalInterval']:null;this[_0x0d91('0xb')]=_0x980290[_0x0d91('0xb')];this[_0x0d91('0xc')]=_0x980290[_0x0d91('0xc')];this['dialOriginateTimeout']=_0x980290[_0x0d91('0xd')]||0x1e;this[_0x0d91('0xe')]=_0x980290[_0x0d91('0xe')];this['dialCongestionRetryFrequency']=_0x980290[_0x0d91('0xf')];this[_0x0d91('0x10')]=_0x980290['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x980290[_0x0d91('0x11')];this[_0x0d91('0x12')]=_0x980290[_0x0d91('0x12')];this[_0x0d91('0x13')]=_0x980290[_0x0d91('0x13')];this['dialGlobalMaxRetry']=_0x980290[_0x0d91('0x14')];this[_0x0d91('0x15')]=_0x980290[_0x0d91('0x15')]||0x3;this[_0x0d91('0x16')]=_0x980290['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0d91('0x17')]=_0x980290['dialDropMaxRetry']||0x3;this[_0x0d91('0x18')]=_0x980290[_0x0d91('0x18')]||0x96;this[_0x0d91('0x19')]=_0x980290[_0x0d91('0x19')]||0x3;this[_0x0d91('0x1a')]=_0x980290[_0x0d91('0x1a')]||0x96;this[_0x0d91('0x1b')]=_0x980290[_0x0d91('0x1b')]||0x3;this[_0x0d91('0x1c')]=_0x980290[_0x0d91('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x980290[_0x0d91('0x1d')]||0x3;this[_0x0d91('0x1e')]=_0x980290['dialAgentRejectRetryFrequency']||0x96;this[_0x0d91('0x1f')]=_0x980290[_0x0d91('0x1f')]||_0x0d91('0x20');this[_0x0d91('0x21')]=_0x980290[_0x0d91('0x21')]||undefined;this[_0x0d91('0x22')]=_0x980290['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0d91('0x23')]=_0x980290['dialCutDigit']||undefined;this[_0x0d91('0x24')]=_0x980290[_0x0d91('0x24')]?_0x980290['TrunkBackup']:undefined;this['Trunk']=_0x980290[_0x0d91('0x25')]?_0x980290[_0x0d91('0x25')]:undefined;this[_0x0d91('0x26')]=_0x980290['Interval']?_0x980290['Interval']:undefined;this['SquareProject']=_0x980290[_0x0d91('0x27')]?_0x980290[_0x0d91('0x27')]:undefined;this[_0x0d91('0x28')]=_0x980290[_0x0d91('0x27')]?_0x980290[_0x0d91('0x27')][_0x0d91('0x0')]:undefined;this[_0x0d91('0x29')]=_0x980290[_0x0d91('0x29')]||![];this[_0x0d91('0x2a')]=_0x980290[_0x0d91('0x2a')];this[_0x0d91('0x2b')]=_0x980290[_0x0d91('0x2b')];this[_0x0d91('0x2c')]=_0x980290[_0x0d91('0x2c')];this[_0x0d91('0x2d')]=_0x980290[_0x0d91('0x2d')];this[_0x0d91('0x2e')]=_0x980290[_0x0d91('0x2e')];this['dialAMDBetweenWordsSilence']=_0x980290[_0x0d91('0x2f')];this[_0x0d91('0x30')]=_0x980290['dialAMDMaximumNumberOfWords'];this[_0x0d91('0x31')]=_0x980290['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x980290[_0x0d91('0x32')];}module[_0x0d91('0x33')]=Campaign; \ No newline at end of file +var _0xec90=['type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xec90,0x1ca));var _0x0ec9=function(_0x10b465,_0x2cccb8){_0x10b465=_0x10b465-0x0;var _0x550ddc=_0xec90[_0x10b465];return _0x550ddc;};'use strict';function Campaign(_0x45a92a){this['id']=_0x45a92a['id']||0x0;this[_0x0ec9('0x0')]=_0x45a92a[_0x0ec9('0x0')]||'';this[_0x0ec9('0x1')]=_0x45a92a['type']||'campaign';this[_0x0ec9('0x2')]=0x0;this[_0x0ec9('0x3')]=0x0;this[_0x0ec9('0x4')]=0x0;this[_0x0ec9('0x5')]=0x0;this[_0x0ec9('0x6')]='';this[_0x0ec9('0x7')]=!![];this[_0x0ec9('0x8')]=_0x45a92a[_0x0ec9('0x8')];this[_0x0ec9('0x9')]=_0x45a92a['limitCalls'];this[_0x0ec9('0xa')]=_0x45a92a[_0x0ec9('0xa')]||null;this['dialGlobalInterval']=_0x45a92a['dialGlobalInterval']?_0x45a92a[_0x0ec9('0xb')]:null;this[_0x0ec9('0xc')]=_0x45a92a[_0x0ec9('0xc')];this[_0x0ec9('0xd')]=_0x45a92a['dialOriginateCallerIdNumber'];this[_0x0ec9('0xe')]=_0x45a92a[_0x0ec9('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x45a92a[_0x0ec9('0xf')];this[_0x0ec9('0x10')]=_0x45a92a[_0x0ec9('0x10')];this[_0x0ec9('0x11')]=_0x45a92a[_0x0ec9('0x11')];this[_0x0ec9('0x12')]=_0x45a92a['dialBusyRetryFrequency'];this[_0x0ec9('0x13')]=_0x45a92a['dialNoAnswerMaxRetry'];this[_0x0ec9('0x14')]=_0x45a92a[_0x0ec9('0x14')];this[_0x0ec9('0x15')]=_0x45a92a[_0x0ec9('0x15')];this[_0x0ec9('0x16')]=_0x45a92a[_0x0ec9('0x16')]||0x3;this[_0x0ec9('0x17')]=_0x45a92a[_0x0ec9('0x17')]||0x96;this[_0x0ec9('0x18')]=_0x45a92a[_0x0ec9('0x18')]||0x3;this[_0x0ec9('0x19')]=_0x45a92a[_0x0ec9('0x19')]||0x96;this[_0x0ec9('0x1a')]=_0x45a92a[_0x0ec9('0x1a')]||0x3;this[_0x0ec9('0x1b')]=_0x45a92a[_0x0ec9('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x45a92a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x45a92a[_0x0ec9('0x1c')]||0x96;this[_0x0ec9('0x1d')]=_0x45a92a['dialAgentRejectMaxRetry']||0x3;this[_0x0ec9('0x1e')]=_0x45a92a[_0x0ec9('0x1e')]||0x96;this[_0x0ec9('0x1f')]=_0x45a92a[_0x0ec9('0x1f')]||_0x0ec9('0x20');this['dialPrefix']=_0x45a92a[_0x0ec9('0x21')]||undefined;this[_0x0ec9('0x22')]=_0x45a92a['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x45a92a[_0x0ec9('0x23')]||undefined;this[_0x0ec9('0x24')]=_0x45a92a[_0x0ec9('0x24')]?_0x45a92a[_0x0ec9('0x24')]:undefined;this[_0x0ec9('0x25')]=_0x45a92a[_0x0ec9('0x25')]?_0x45a92a['Trunk']:undefined;this[_0x0ec9('0x26')]=_0x45a92a[_0x0ec9('0x26')]?_0x45a92a[_0x0ec9('0x26')]:undefined;this[_0x0ec9('0x27')]=_0x45a92a['SquareProject']?_0x45a92a[_0x0ec9('0x27')]:undefined;this[_0x0ec9('0x28')]=_0x45a92a['SquareProject']?_0x45a92a[_0x0ec9('0x27')][_0x0ec9('0x0')]:undefined;this[_0x0ec9('0x29')]=_0x45a92a[_0x0ec9('0x29')]||![];this[_0x0ec9('0x2a')]=_0x45a92a[_0x0ec9('0x2a')];this[_0x0ec9('0x2b')]=_0x45a92a[_0x0ec9('0x2b')];this[_0x0ec9('0x2c')]=_0x45a92a[_0x0ec9('0x2c')];this[_0x0ec9('0x2d')]=_0x45a92a['dialAMDTotalAnalysisTime'];this[_0x0ec9('0x2e')]=_0x45a92a[_0x0ec9('0x2e')];this['dialAMDBetweenWordsSilence']=_0x45a92a['dialAMDBetweenWordsSilence'];this[_0x0ec9('0x2f')]=_0x45a92a[_0x0ec9('0x2f')];this['dialAMDSilenceThreshold']=_0x45a92a[_0x0ec9('0x30')];this[_0x0ec9('0x31')]=_0x45a92a['dialAMDMaximumWordLength'];}module[_0x0ec9('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9bc1026..9524b4c 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 _0x4c84=['endtime','unmanaged','abandoned','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','answered'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x4c84,0x124));var _0x44c8=function(_0x19577e,_0x240310){_0x19577e=_0x19577e-0x0;var _0x30c95a=_0x4c84[_0x19577e];return _0x30c95a;};'use strict';function Channel(){this['starttime']=null;this[_0x44c8('0x0')]='';this[_0x44c8('0x1')]='';this['calleridnum']=0x0;this[_0x44c8('0x2')]='';this[_0x44c8('0x3')]=undefined;this[_0x44c8('0x4')]=undefined;this[_0x44c8('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x44c8('0x6')]=![];this['answertime']=null;this[_0x44c8('0x7')]=null;this[_0x44c8('0x8')]=![];this[_0x44c8('0x9')]=![];this['lastapplication']='';this[_0x44c8('0xa')]='';this['duration']=0x0;this[_0x44c8('0xb')]=0x0;this[_0x44c8('0xc')]=0x0;this[_0x44c8('0xd')]=null;this[_0x44c8('0xe')]=null;this[_0x44c8('0xf')]=null;this[_0x44c8('0x10')]=![];this[_0x44c8('0x11')]=null;this[_0x44c8('0x12')]=null;this['monitors']=[];this[_0x44c8('0x13')]=undefined;this[_0x44c8('0x14')]=undefined;this['transferType']=undefined;this[_0x44c8('0x15')]=0x0;}module[_0x44c8('0x16')]=Channel; \ No newline at end of file +var _0xc3f3=['mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','tag','disposition','monitor','transferconnectedlinenum'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc3f3,0xd2));var _0x3c3f=function(_0x35ccbb,_0x4c8cc5){_0x35ccbb=_0x35ccbb-0x0;var _0x1575f7=_0xc3f3[_0x35ccbb];return _0x1575f7;};'use strict';function Channel(){this['starttime']=null;this[_0x3c3f('0x0')]='';this[_0x3c3f('0x1')]='';this[_0x3c3f('0x2')]=0x0;this[_0x3c3f('0x3')]='';this[_0x3c3f('0x4')]=undefined;this[_0x3c3f('0x5')]=undefined;this[_0x3c3f('0x6')]=0x0;this[_0x3c3f('0x7')]='';this[_0x3c3f('0x8')]=0x0;this[_0x3c3f('0x9')]=0x0;this[_0x3c3f('0xa')]=0x0;this[_0x3c3f('0xb')]=![];this[_0x3c3f('0xc')]=null;this[_0x3c3f('0xd')]=null;this[_0x3c3f('0xe')]=![];this[_0x3c3f('0xf')]=![];this['lastapplication']='';this[_0x3c3f('0x10')]='';this[_0x3c3f('0x11')]=0x0;this['billableseconds']=0x0;this[_0x3c3f('0x12')]=0x0;this[_0x3c3f('0x13')]=null;this[_0x3c3f('0x14')]=null;this[_0x3c3f('0x15')]=null;this[_0x3c3f('0x16')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x3c3f('0x17')]=undefined;this['transferType']=undefined;this[_0x3c3f('0x18')]=0x0;}module[_0x3c3f('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 14f26b5..579e873 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 _0x3afa=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x3afa,0x112));var _0xa3af=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x3afa[_0x1304c6];return _0x2e6654;};'use strict';function DeskAccount(_0x231232){this['id']=_0x231232['id']||0x0;this[_0xa3af('0x0')]=_0x231232['name']||'';this[_0xa3af('0x1')]=_0x231232[_0xa3af('0x1')]||'';this[_0xa3af('0x2')]=_0x231232[_0xa3af('0x2')]||'';this[_0xa3af('0x3')]=_0x231232[_0xa3af('0x3')]||'';this['password']=_0x231232[_0xa3af('0x4')]||'';this[_0xa3af('0x5')]=_0x231232[_0xa3af('0x5')]||'';this[_0xa3af('0x6')]=_0x231232[_0xa3af('0x6')]||'';this['token']=_0x231232[_0xa3af('0x7')]||'';this[_0xa3af('0x8')]=_0x231232[_0xa3af('0x8')]||'';this[_0xa3af('0x9')]=_0x231232[_0xa3af('0x9')]||'';this[_0xa3af('0xa')]=_0x231232['serverUrl']||'';this[_0xa3af('0xb')]=_0x231232[_0xa3af('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x141b=['token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerSecret'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0x141b,0x10e));var _0xb141=function(_0x4ff825,_0x8eef55){_0x4ff825=_0x4ff825-0x0;var _0x473c17=_0x141b[_0x4ff825];return _0x473c17;};'use strict';function DeskAccount(_0x263168){this['id']=_0x263168['id']||0x0;this['name']=_0x263168['name']||'';this[_0xb141('0x0')]=_0x263168[_0xb141('0x0')]||'';this[_0xb141('0x1')]=_0x263168[_0xb141('0x1')]||'';this['authType']=_0x263168[_0xb141('0x2')]||'';this[_0xb141('0x3')]=_0x263168[_0xb141('0x3')]||'';this['consumerKey']=_0x263168['consumerKey']||'';this[_0xb141('0x4')]=_0x263168[_0xb141('0x4')]||'';this[_0xb141('0x5')]=_0x263168['token']||'';this[_0xb141('0x6')]=_0x263168[_0xb141('0x6')]||'';this[_0xb141('0x7')]=_0x263168[_0xb141('0x7')]||'';this[_0xb141('0x8')]=_0x263168[_0xb141('0x8')]||'';this['Configurations']=_0x263168[_0xb141('0x9')]||{};}module[_0xb141('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b5b0968..d77d5bb 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 _0x52b0=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x52b0,0x168));var _0x052b=function(_0x3634e9,_0x20d9fb){_0x3634e9=_0x3634e9-0x0;var _0x46ce35=_0x52b0[_0x3634e9];return _0x46ce35;};'use strict';function Dynamics365Account(_0x8b7491){this['id']=_0x8b7491['id']||0x0;this[_0x052b('0x0')]=_0x8b7491[_0x052b('0x0')]||'';this['username']=_0x8b7491[_0x052b('0x1')]||'';this[_0x052b('0x2')]=_0x8b7491[_0x052b('0x2')]||'';this['remoteUri']=_0x8b7491[_0x052b('0x3')]||'';this[_0x052b('0x4')]=_0x8b7491[_0x052b('0x4')]||'';this['clientId']=_0x8b7491[_0x052b('0x5')]||'';this[_0x052b('0x6')]=_0x8b7491['clientSecret']||{};this[_0x052b('0x7')]=_0x8b7491[_0x052b('0x7')]||'';this[_0x052b('0x8')]=_0x8b7491['modernAuthentication']||![];this[_0x052b('0x9')]=_0x8b7491[_0x052b('0x9')]||{};this[_0x052b('0xa')]=_0x8b7491['CloudProvider']||{};}module[_0x052b('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa67a=['Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xa67a,0x1cb));var _0xaa67=function(_0x4f072c,_0x3a9840){_0x4f072c=_0x4f072c-0x0;var _0x4d2953=_0xa67a[_0x4f072c];return _0x4d2953;};'use strict';function Dynamics365Account(_0x156f80){this['id']=_0x156f80['id']||0x0;this[_0xaa67('0x0')]=_0x156f80[_0xaa67('0x0')]||'';this[_0xaa67('0x1')]=_0x156f80[_0xaa67('0x1')]||'';this[_0xaa67('0x2')]=_0x156f80[_0xaa67('0x2')]||'';this['remoteUri']=_0x156f80[_0xaa67('0x3')]||'';this[_0xaa67('0x4')]=_0x156f80[_0xaa67('0x4')]||'';this['clientId']=_0x156f80[_0xaa67('0x5')]||'';this['clientSecret']=_0x156f80[_0xaa67('0x6')]||{};this[_0xaa67('0x7')]=_0x156f80[_0xaa67('0x7')]||'';this[_0xaa67('0x8')]=_0x156f80[_0xaa67('0x8')]||![];this['Configurations']=_0x156f80[_0xaa67('0x9')]||{};this[_0xaa67('0xa')]=_0x156f80['CloudProvider']||{};}module[_0xaa67('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 355ebaf..0bc3a87 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 _0x3a17=['t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x41d51c,_0x3bb628){var _0x865f6e=function(_0x522e97){while(--_0x522e97){_0x41d51c['push'](_0x41d51c['shift']());}};_0x865f6e(++_0x3bb628);}(_0x3a17,0xb0));var _0x73a1=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x3a17[_0x42bdad];return _0x122626;};'use strict';function FaxAccount(_0x3d14f9){this['id']=_0x3d14f9['id']||0x0;this[_0x73a1('0x0')]=_0x3d14f9[_0x73a1('0x0')]||'';this[_0x73a1('0x1')]=_0x3d14f9[_0x73a1('0x1')];this['ecm']=_0x3d14f9[_0x73a1('0x2')];this[_0x73a1('0x3')]=_0x3d14f9[_0x73a1('0x3')];this[_0x73a1('0x4')]=_0x3d14f9['localstationid'];this[_0x73a1('0x5')]=_0x3d14f9[_0x73a1('0x5')]||0x960;this['maxrate']=_0x3d14f9[_0x73a1('0x6')]||0x3840;this[_0x73a1('0x7')]=_0x3d14f9['modem']||_0x73a1('0x8');this[_0x73a1('0x9')]=_0x3d14f9[_0x73a1('0x9')]||'no';this['faxdetect']=_0x3d14f9[_0x73a1('0xa')]||'no';this[_0x73a1('0xb')]=_0x3d14f9[_0x73a1('0xb')]||0x1388;this[_0x73a1('0xc')]=_0x3d14f9[_0x73a1('0xc')]||_0x73a1('0xd');this[_0x73a1('0xe')]=_0x3d14f9[_0x73a1('0xe')]?_0x3d14f9[_0x73a1('0xe')]:undefined;this['ListId']=_0x3d14f9[_0x73a1('0xf')];this[_0x73a1('0x10')]=_0x3d14f9[_0x73a1('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xa10b=['minrate','maxrate','modem','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid'];(function(_0x217864,_0x183226){var _0x58d26f=function(_0x526adb){while(--_0x526adb){_0x217864['push'](_0x217864['shift']());}};_0x58d26f(++_0x183226);}(_0xa10b,0xb0));var _0xba10=function(_0x29f65f,_0x350f7f){_0x29f65f=_0x29f65f-0x0;var _0x45a6ca=_0xa10b[_0x29f65f];return _0x45a6ca;};'use strict';function FaxAccount(_0x50a7da){this['id']=_0x50a7da['id']||0x0;this[_0xba10('0x0')]=_0x50a7da['name']||'';this[_0xba10('0x1')]=_0x50a7da[_0xba10('0x1')];this['ecm']=_0x50a7da['ecm'];this[_0xba10('0x2')]=_0x50a7da[_0xba10('0x2')];this[_0xba10('0x3')]=_0x50a7da[_0xba10('0x3')];this[_0xba10('0x4')]=_0x50a7da['minrate']||0x960;this['maxrate']=_0x50a7da[_0xba10('0x5')]||0x3840;this[_0xba10('0x6')]=_0x50a7da['modem']||'v17,v27,v29';this[_0xba10('0x7')]=_0x50a7da['gateway']||'no';this[_0xba10('0x8')]=_0x50a7da['faxdetect']||'no';this['t38timeout']=_0x50a7da['t38timeout']||0x1388;this[_0xba10('0x9')]=_0x50a7da['tech']||_0xba10('0xa');this[_0xba10('0xb')]=_0x50a7da[_0xba10('0xb')]?_0x50a7da[_0xba10('0xb')]:undefined;this[_0xba10('0xc')]=_0x50a7da[_0xba10('0xc')];this[_0xba10('0xd')]=_0x50a7da['key'];}module[_0xba10('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d8b2ae9..3466647 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 _0x43d4=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xdfea90,_0x5e0288){var _0x3706c0=function(_0x548035){while(--_0x548035){_0xdfea90['push'](_0xdfea90['shift']());}};_0x3706c0(++_0x5e0288);}(_0x43d4,0x6d));var _0x443d=function(_0x1e3570,_0x20332e){_0x1e3570=_0x1e3570-0x0;var _0x1addaa=_0x43d4[_0x1e3570];return _0x1addaa;};'use strict';function FreshdeskAccount(_0x1fb11b){this['id']=_0x1fb11b['id']||0x0;this[_0x443d('0x0')]=_0x1fb11b[_0x443d('0x0')]||'';this[_0x443d('0x1')]=_0x1fb11b[_0x443d('0x1')]||'';this[_0x443d('0x2')]=_0x1fb11b['token']||'';this[_0x443d('0x3')]=_0x1fb11b[_0x443d('0x3')]||'';this['serverUrl']=_0x1fb11b[_0x443d('0x4')]||'';this[_0x443d('0x5')]=_0x1fb11b[_0x443d('0x5')]||{};}module[_0x443d('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa0e3=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0xee82b5,_0x256c09){var _0x25ac5f=function(_0x490ae7){while(--_0x490ae7){_0xee82b5['push'](_0xee82b5['shift']());}};_0x25ac5f(++_0x256c09);}(_0xa0e3,0x1dc));var _0x3a0e=function(_0xafce29,_0x3c36a4){_0xafce29=_0xafce29-0x0;var _0x41d263=_0xa0e3[_0xafce29];return _0x41d263;};'use strict';function FreshdeskAccount(_0x440e34){this['id']=_0x440e34['id']||0x0;this[_0x3a0e('0x0')]=_0x440e34[_0x3a0e('0x0')]||'';this[_0x3a0e('0x1')]=_0x440e34['username']||'';this[_0x3a0e('0x2')]=_0x440e34[_0x3a0e('0x3')]||'';this['remoteUri']=_0x440e34[_0x3a0e('0x4')]||'';this['serverUrl']=_0x440e34['serverUrl']||'';this[_0x3a0e('0x5')]=_0x440e34[_0x3a0e('0x5')]||{};}module[_0x3a0e('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1d96656..c1c14bb 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 _0x83d0=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x83d0,0xb7));var _0x083d=function(_0x318cb0,_0x8e6f74){_0x318cb0=_0x318cb0-0x0;var _0x120335=_0x83d0[_0x318cb0];return _0x120335;};'use strict';function FreshsalesAccount(_0x351db6){this['id']=_0x351db6['id']||0x0;this[_0x083d('0x0')]=_0x351db6[_0x083d('0x0')]||'';this[_0x083d('0x1')]=_0x351db6[_0x083d('0x1')]||'';this[_0x083d('0x2')]=_0x351db6['token']||'';this[_0x083d('0x3')]=_0x351db6['remoteUri']||'';this['serverUrl']=_0x351db6[_0x083d('0x4')]||'';this[_0x083d('0x5')]=_0x351db6[_0x083d('0x5')]||{};}module[_0x083d('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xed08=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x38262c,_0x2c2f19){var _0x13c78a=function(_0x50b9ef){while(--_0x50b9ef){_0x38262c['push'](_0x38262c['shift']());}};_0x13c78a(++_0x2c2f19);}(_0xed08,0x67));var _0x8ed0=function(_0x368eba,_0x1c6120){_0x368eba=_0x368eba-0x0;var _0x45e49a=_0xed08[_0x368eba];return _0x45e49a;};'use strict';function FreshsalesAccount(_0x12c51f){this['id']=_0x12c51f['id']||0x0;this[_0x8ed0('0x0')]=_0x12c51f[_0x8ed0('0x0')]||'';this[_0x8ed0('0x1')]=_0x12c51f[_0x8ed0('0x1')]||'';this[_0x8ed0('0x2')]=_0x12c51f[_0x8ed0('0x3')]||'';this[_0x8ed0('0x4')]=_0x12c51f[_0x8ed0('0x4')]||'';this[_0x8ed0('0x5')]=_0x12c51f[_0x8ed0('0x5')]||'';this[_0x8ed0('0x6')]=_0x12c51f[_0x8ed0('0x6')]||{};}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 356198a..8cfdcfb 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 _0x2611=['originalposition','channel','connectedlinenum','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x4043ce,_0x175dcc){var _0x191365=function(_0x361aa0){while(--_0x361aa0){_0x4043ce['push'](_0x4043ce['shift']());}};_0x191365(++_0x175dcc);}(_0x2611,0x120));var _0x1261=function(_0x20dbc6,_0x193d50){_0x20dbc6=_0x20dbc6-0x0;var _0x4c5f84=_0x2611[_0x20dbc6];return _0x4c5f84;};'use strict';function QueueReport(){this['type']=_0x1261('0x0');this['uniqueid']='';this[_0x1261('0x1')]='';this['calleridname']='';this[_0x1261('0x2')]='';this[_0x1261('0x3')]=null;this[_0x1261('0x4')]=null;this[_0x1261('0x5')]=0x1;this[_0x1261('0x6')]=0x1;this[_0x1261('0x7')]=![];this[_0x1261('0x8')]=null;this['queuecallercomplete']=![];this[_0x1261('0x9')]=null;this[_0x1261('0xa')]=![];this[_0x1261('0xb')]=null;this[_0x1261('0xc')]=0x1;this[_0x1261('0xd')]='';this[_0x1261('0xe')]='';this['connectedlinename']='';this[_0x1261('0xf')]='';this['context']='';this[_0x1261('0x10')]='';this[_0x1261('0x11')]='';this[_0x1261('0x12')]=0x0;this[_0x1261('0x13')]=![];this[_0x1261('0x14')]='';this[_0x1261('0x15')]=_0x1261('0x16');this['routealias']=null;this[_0x1261('0x17')]=0x0;this[_0x1261('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x4c7e=['connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4c7e,0xf1));var _0xe4c7=function(_0x5f3b30,_0x10400b){_0x5f3b30=_0x5f3b30-0x0;var _0x2584b2=_0x4c7e[_0x5f3b30];return _0x2584b2;};'use strict';function QueueReport(){this['type']=_0xe4c7('0x0');this[_0xe4c7('0x1')]='';this[_0xe4c7('0x2')]='';this[_0xe4c7('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xe4c7('0x4')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xe4c7('0x5')]=![];this[_0xe4c7('0x6')]=null;this[_0xe4c7('0x7')]=![];this[_0xe4c7('0x8')]=null;this[_0xe4c7('0x9')]=0x1;this[_0xe4c7('0xa')]='';this[_0xe4c7('0xb')]='';this[_0xe4c7('0xc')]='';this[_0xe4c7('0xd')]='';this[_0xe4c7('0xe')]='';this[_0xe4c7('0xf')]='';this['priority']='';this[_0xe4c7('0x10')]=0x0;this[_0xe4c7('0x11')]=![];this[_0xe4c7('0x12')]='';this[_0xe4c7('0x13')]='voice';this[_0xe4c7('0x14')]=null;this[_0xe4c7('0x15')]=0x0;this[_0xe4c7('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bd59ab9..b835149 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 _0xf57e=['username','remoteUri','password','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3c7971,_0x53c018){var _0x31a122=function(_0x303b5e){while(--_0x303b5e){_0x3c7971['push'](_0x3c7971['shift']());}};_0x31a122(++_0x53c018);}(_0xf57e,0x1e9));var _0xef57=function(_0x572635,_0x17f586){_0x572635=_0x572635-0x0;var _0x4f772e=_0xf57e[_0x572635];return _0x4f772e;};'use strict';function SalesforceAccount(_0x4f84f5){this['id']=_0x4f84f5['id']||0x0;this[_0xef57('0x0')]=_0x4f84f5[_0xef57('0x0')]||'';this[_0xef57('0x1')]=_0x4f84f5[_0xef57('0x1')]||'';this['remoteUri']=_0x4f84f5[_0xef57('0x2')]||'';this[_0xef57('0x3')]=_0x4f84f5['password']||'';this['clientId']=_0x4f84f5['clientId']||'';this[_0xef57('0x4')]=_0x4f84f5[_0xef57('0x4')]||'';this['securityToken']=_0x4f84f5['securityToken']||'';this['type']=_0x4f84f5[_0xef57('0x5')]||_0xef57('0x6');this[_0xef57('0x7')]=_0x4f84f5[_0xef57('0x7')]||'';this['Configurations']=_0x4f84f5[_0xef57('0x8')]||{};}module[_0xef57('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x1e52=['remoteUri','password','clientId','securityToken','type','serverUrl','Configurations','name','username'];(function(_0x26dca1,_0x4a3622){var _0x177d36=function(_0x378e94){while(--_0x378e94){_0x26dca1['push'](_0x26dca1['shift']());}};_0x177d36(++_0x4a3622);}(_0x1e52,0x7c));var _0x21e5=function(_0x205c48,_0x4d0c4a){_0x205c48=_0x205c48-0x0;var _0x4d8d79=_0x1e52[_0x205c48];return _0x4d8d79;};'use strict';function SalesforceAccount(_0x45d98e){this['id']=_0x45d98e['id']||0x0;this[_0x21e5('0x0')]=_0x45d98e[_0x21e5('0x0')]||'';this[_0x21e5('0x1')]=_0x45d98e[_0x21e5('0x1')]||'';this[_0x21e5('0x2')]=_0x45d98e[_0x21e5('0x2')]||'';this[_0x21e5('0x3')]=_0x45d98e[_0x21e5('0x3')]||'';this[_0x21e5('0x4')]=_0x45d98e[_0x21e5('0x4')]||'';this['clientSecret']=_0x45d98e['clientSecret']||'';this[_0x21e5('0x5')]=_0x45d98e[_0x21e5('0x5')]||'';this[_0x21e5('0x6')]=_0x45d98e[_0x21e5('0x6')]||'integrationTab';this[_0x21e5('0x7')]=_0x45d98e[_0x21e5('0x7')]||'';this[_0x21e5('0x8')]=_0x45d98e[_0x21e5('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2b384d4..0b6bb6f 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 _0xd642=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x582a8a,_0x5e4b83){var _0x548a81=function(_0x48a3b9){while(--_0x48a3b9){_0x582a8a['push'](_0x582a8a['shift']());}};_0x548a81(++_0x5e4b83);}(_0xd642,0x1f4));var _0x2d64=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xd642[_0x2d9c6a];return _0xf3c918;};'use strict';function ServicenowAccount(_0x505061){this['id']=_0x505061['id']||0x0;this[_0x2d64('0x0')]=_0x505061['name']||'';this[_0x2d64('0x1')]=_0x505061[_0x2d64('0x1')]||'';this[_0x2d64('0x2')]=_0x505061['password']||'';this['remoteUri']=_0x505061[_0x2d64('0x3')]||'';this['serverUrl']=_0x505061[_0x2d64('0x4')]||'';this['Configurations']=_0x505061[_0x2d64('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xf0bb=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf0bb,0xc1));var _0xbf0b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf0bb[_0x2dafbe];return _0x58a45a;};'use strict';function ServicenowAccount(_0x5b5ec3){this['id']=_0x5b5ec3['id']||0x0;this['name']=_0x5b5ec3[_0xbf0b('0x0')]||'';this[_0xbf0b('0x1')]=_0x5b5ec3[_0xbf0b('0x1')]||'';this[_0xbf0b('0x2')]=_0x5b5ec3['password']||'';this[_0xbf0b('0x3')]=_0x5b5ec3[_0xbf0b('0x3')]||'';this[_0xbf0b('0x4')]=_0x5b5ec3[_0xbf0b('0x4')]||'';this[_0xbf0b('0x5')]=_0x5b5ec3[_0xbf0b('0x5')]||{};}module[_0xbf0b('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index c112cb0..9a1eb57 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 _0xbbdd=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xbf19d7,_0x58b2bf){var _0x376e11=function(_0x5ab888){while(--_0x5ab888){_0xbf19d7['push'](_0xbf19d7['shift']());}};_0x376e11(++_0x58b2bf);}(_0xbbdd,0x1a9));var _0xdbbd=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xbbdd[_0x119d5a];return _0x15bff4;};'use strict';function SugarcrmAccount(_0x5d6a2f){this['id']=_0x5d6a2f['id']||0x0;this[_0xdbbd('0x0')]=_0x5d6a2f[_0xdbbd('0x0')]||'';this['username']=_0x5d6a2f[_0xdbbd('0x1')]||'';this['password']=_0x5d6a2f['password']||'';this['remoteUri']=_0x5d6a2f[_0xdbbd('0x2')]||'';this['serverUrl']=_0x5d6a2f[_0xdbbd('0x3')]||'';this['Configurations']=_0x5d6a2f[_0xdbbd('0x4')]||{};}module[_0xdbbd('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x7553=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x337be7,_0x506def){var _0x214641=function(_0x2f4edb){while(--_0x2f4edb){_0x337be7['push'](_0x337be7['shift']());}};_0x214641(++_0x506def);}(_0x7553,0x193));var _0x3755=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x7553[_0x55a89e];return _0x3aa2bd;};'use strict';function SugarcrmAccount(_0x48b934){this['id']=_0x48b934['id']||0x0;this[_0x3755('0x0')]=_0x48b934['name']||'';this[_0x3755('0x1')]=_0x48b934['username']||'';this['password']=_0x48b934['password']||'';this[_0x3755('0x2')]=_0x48b934[_0x3755('0x2')]||'';this[_0x3755('0x3')]=_0x48b934[_0x3755('0x3')]||'';this[_0x3755('0x4')]=_0x48b934[_0x3755('0x4')]||{};}module[_0x3755('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 47cb2bf..1201ffd 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 _0x7461=['accountcode','unknown','address','exports','name'];(function(_0x16ccc4,_0x439e40){var _0x2d3fd0=function(_0x16c8e2){while(--_0x16c8e2){_0x16ccc4['push'](_0x16ccc4['shift']());}};_0x2d3fd0(++_0x439e40);}(_0x7461,0xdb));var _0x1746=function(_0x437546,_0x334f47){_0x437546=_0x437546-0x0;var _0x36b04f=_0x7461[_0x437546];return _0x36b04f;};'use strict';function Telephone(_0xe67489){this['id']=_0xe67489['id']||0x0;this[_0x1746('0x0')]=_0xe67489[_0x1746('0x0')]||'';this[_0x1746('0x1')]=_0xe67489[_0x1746('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0x1746('0x2');this[_0x1746('0x3')]='';}module[_0x1746('0x4')]=Telephone; \ No newline at end of file +var _0x5cd9=['exports','name','accountcode','unknown','address'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5cd9,0x13c));var _0x95cd=function(_0x41ec2f,_0xedb083){_0x41ec2f=_0x41ec2f-0x0;var _0x2abd9f=_0x5cd9[_0x41ec2f];return _0x2abd9f;};'use strict';function Telephone(_0x4d5931){this['id']=_0x4d5931['id']||0x0;this[_0x95cd('0x0')]=_0x4d5931[_0x95cd('0x0')]||'';this[_0x95cd('0x1')]=_0x4d5931[_0x95cd('0x1')]||'';this['state']=_0x95cd('0x2');this['stateTime']=0x0;this['status']=_0x95cd('0x2');this[_0x95cd('0x3')]='';}module[_0x95cd('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2be6916..ba60944 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x46266a,_0x1f2467){var _0x9aa23e=function(_0x5d3df8){while(--_0x5d3df8){_0x46266a['push'](_0x46266a['shift']());}};_0x9aa23e(++_0x1f2467);}(_0xb10b,0x12a));var _0xbb10=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xb10b[_0x82129b];return _0x2ae5dc;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x25c54c,_0x260b78){var _0x2ede94=function(_0x1873f8){while(--_0x1873f8){_0x25c54c['push'](_0x25c54c['shift']());}};_0x2ede94(++_0x260b78);}(_0xb10b,0x12a));var _0xbb10=function(_0x313dab,_0x53179c){_0x313dab=_0x313dab-0x0;var _0x18ee37=_0xb10b[_0x313dab];return _0x18ee37;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index cb5972d..f483cd3 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x206707,_0x430c4c){var _0x3296bf=function(_0x24447b){while(--_0x24447b){_0x206707['push'](_0x206707['shift']());}};_0x3296bf(++_0x430c4c);}(_0x757a,0xde));var _0xa757=function(_0x57764d,_0x4c9cfb){_0x57764d=_0x57764d-0x0;var _0xdb7f7b=_0x757a[_0x57764d];return _0xdb7f7b;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x115bd9,_0x3a6ed0){var _0xe0e123=function(_0x59f491){while(--_0x59f491){_0x115bd9['push'](_0x115bd9['shift']());}};_0xe0e123(++_0x3a6ed0);}(_0x2032,0xd9));var _0x2203=function(_0x441a2e,_0x1ead00){_0x441a2e=_0x441a2e-0x0;var _0x2ba171=_0x2032[_0x441a2e];return _0x2ba171;};'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 926f8ca..761f6b1 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 _0x7f4e=['exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x7f4e,0x1d1));var _0xe7f4=function(_0x149b7f,_0xcccc2c){_0x149b7f=_0x149b7f-0x0;var _0x3cd08a=_0x7f4e[_0x149b7f];return _0x3cd08a;};'use strict';function Trunk(_0x5aeb5d){this['id']=_0x5aeb5d['id']||0x0;this['active']=_0x5aeb5d[_0xe7f4('0x0')]||![];this['name']=_0x5aeb5d[_0xe7f4('0x1')]||'';this['state']=_0xe7f4('0x2');this[_0xe7f4('0x3')]=0x0;this[_0xe7f4('0x4')]=_0xe7f4('0x2');this[_0xe7f4('0x5')]=_0x5aeb5d[_0xe7f4('0x5')]&&_0x5aeb5d[_0xe7f4('0x5')][_0xe7f4('0x6')](':')?_0x5aeb5d[_0xe7f4('0x5')][_0xe7f4('0x7')](':')[0x0]:'';this[_0xe7f4('0x8')]='';this[_0xe7f4('0x9')]='';this['domain']='';this[_0xe7f4('0xa')]='';this[_0xe7f4('0xb')]='';this[_0xe7f4('0xc')]='unknown';this[_0xe7f4('0xd')]='';this['address']='';this[_0xe7f4('0xe')]=_0x5aeb5d[_0xe7f4('0xe')]||'';}module[_0xe7f4('0xf')]=Trunk; \ No newline at end of file +var _0xfbfa=['refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport'];(function(_0x5d7965,_0x44010c){var _0x20c8bd=function(_0x16163c){while(--_0x16163c){_0x5d7965['push'](_0x5d7965['shift']());}};_0x20c8bd(++_0x44010c);}(_0xfbfa,0x114));var _0xafbf=function(_0x3027b1,_0x282484){_0x3027b1=_0x3027b1-0x0;var _0x59447f=_0xfbfa[_0x3027b1];return _0x59447f;};'use strict';function Trunk(_0x24e662){this['id']=_0x24e662['id']||0x0;this[_0xafbf('0x0')]=_0x24e662[_0xafbf('0x0')]||![];this[_0xafbf('0x1')]=_0x24e662[_0xafbf('0x1')]||'';this[_0xafbf('0x2')]=_0xafbf('0x3');this[_0xafbf('0x4')]=0x0;this[_0xafbf('0x5')]=_0xafbf('0x3');this['registry']=_0x24e662[_0xafbf('0x6')]&&_0x24e662[_0xafbf('0x6')][_0xafbf('0x7')](':')?_0x24e662[_0xafbf('0x6')][_0xafbf('0x8')](':')[0x0]:'';this[_0xafbf('0x9')]='';this[_0xafbf('0xa')]='';this['domain']='';this[_0xafbf('0xb')]='';this[_0xafbf('0xc')]='';this[_0xafbf('0xd')]='unknown';this[_0xafbf('0xe')]='';this[_0xafbf('0xf')]='';this[_0xafbf('0x10')]=_0x24e662[_0xafbf('0x10')]||'';}module[_0xafbf('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index abe3688..e080b29 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 _0x3d01=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3d01,0x1d0));var _0x13d0=function(_0x18bae6,_0x3590ac){_0x18bae6=_0x18bae6-0x0;var _0xc1f025=_0x3d01[_0x18bae6];return _0xc1f025;};'use strict';function voiceExtension(_0x21d0ef){this['id']=_0x21d0ef['id']||0x0;this[_0x13d0('0x0')]=_0x21d0ef[_0x13d0('0x0')]||'';this[_0x13d0('0x1')]=_0x21d0ef['recordingFormat']||_0x13d0('0x2');this[_0x13d0('0x3')]=_0x21d0ef[_0x13d0('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x5754=['exten','none','mandatoryDisposition','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5754,0x160));var _0x4575=function(_0x1665d2,_0x560f2c){_0x1665d2=_0x1665d2-0x0;var _0x2fbb4c=_0x5754[_0x1665d2];return _0x2fbb4c;};'use strict';function voiceExtension(_0x425993){this['id']=_0x425993['id']||0x0;this[_0x4575('0x0')]=_0x425993['exten']||'';this['recordingFormat']=_0x425993['recordingFormat']||_0x4575('0x1');this[_0x4575('0x2')]=_0x425993['mandatoryDisposition']||![];}module[_0x4575('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 59b1de1..c2dff23 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 _0x6bfc=['talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','available','busy','loggedIn','notInUse','paused','ringing','ringInUse'];(function(_0x1c03b6,_0x1b9c60){var _0x175fcb=function(_0x36ab2f){while(--_0x36ab2f){_0x1c03b6['push'](_0x1c03b6['shift']());}};_0x175fcb(++_0x1b9c60);}(_0x6bfc,0x159));var _0xc6bf=function(_0x55faa0,_0x44b165){_0x55faa0=_0x55faa0-0x0;var _0x5dff21=_0x6bfc[_0x55faa0];return _0x5dff21;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xc6bf('0x0'),'gsm':_0xc6bf('0x1')};var strategy={'fewestcalls':_0xc6bf('0x2'),'leastrecent':'leastrecent','linear':_0xc6bf('0x3'),'random':'random','ringall':_0xc6bf('0x4'),'rr':'roundrobin','rrmemory':_0xc6bf('0x5'),'rrordered':_0xc6bf('0x6'),'wrandom':_0xc6bf('0x7')};function VoiceQueue(_0x4a999e){this['id']=_0x4a999e['id']||0x0;this[_0xc6bf('0x8')]=_0x4a999e[_0xc6bf('0x8')]||'';this[_0xc6bf('0x9')]=_0x4a999e[_0xc6bf('0x9')]||'';this[_0xc6bf('0xa')]=_0x4a999e[_0xc6bf('0xa')]||_0xc6bf('0xb');this[_0xc6bf('0xc')]=0x0;this['total']=0x0;this[_0xc6bf('0xd')]=0x0;this[_0xc6bf('0xe')]=0x0;this[_0xc6bf('0xf')]=0x0;this[_0xc6bf('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xc6bf('0x11')]=0x0;this[_0xc6bf('0x12')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0xc6bf('0x13')]=0x0;this[_0xc6bf('0x14')]=0x0;this['onHold']=0x0;this[_0xc6bf('0x15')]=0x0;this[_0xc6bf('0x16')]=0x0;this[_0xc6bf('0x17')]=0x0;this[_0xc6bf('0x18')]=0x0;this[_0xc6bf('0x19')]=0x0;this['unknown']=0x0;this['acw']=_0x4a999e[_0xc6bf('0x1a')]||![];this[_0xc6bf('0x1b')]=_0x4a999e[_0xc6bf('0x1b')]||0xa;this[_0xc6bf('0x1c')]=_0x4a999e[_0xc6bf('0x1c')]||'no';this[_0xc6bf('0x1d')]=!![];this[_0xc6bf('0x1e')]='';this['statusMessage']='';this[_0xc6bf('0x1f')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x4a999e[_0xc6bf('0x20')]||null;this[_0xc6bf('0x21')]=_0x4a999e['dialGlobalInterval']?_0x4a999e[_0xc6bf('0x21')]:null;this[_0xc6bf('0x22')]=_0x4a999e['dialActive'];this[_0xc6bf('0x23')]=_0x4a999e['dialMethod']||'progressive';this['dialLimitChannel']=_0x4a999e[_0xc6bf('0x24')]||0x0;this[_0xc6bf('0x25')]=_0x4a999e['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x4a999e[_0xc6bf('0x26')]||0x1;this[_0xc6bf('0x27')]=_0x4a999e['dialPredictiveOptimization']||_0xc6bf('0x28');this[_0xc6bf('0x29')]=_0x4a999e[_0xc6bf('0x29')]||0.03;this[_0xc6bf('0x2a')]=_0x4a999e['dialPredictiveInterval']||0x258;this[_0xc6bf('0x2b')]=_0x4a999e[_0xc6bf('0x2b')]||_0xc6bf('0x2c');this[_0xc6bf('0x2d')]=_0x4a999e[_0xc6bf('0x2d')]||_0xc6bf('0x2c');this[_0xc6bf('0x2e')]=_0x4a999e[_0xc6bf('0x2e')]||0x1e;this['dialQueueOptions']=_0x4a999e[_0xc6bf('0x2f')]||_0xc6bf('0x30');this[_0xc6bf('0x31')]=_0x4a999e['dialQueueTimeout']||0x3;this[_0xc6bf('0x32')]=_0x4a999e[_0xc6bf('0x32')]||undefined;this[_0xc6bf('0x33')]=_0x4a999e[_0xc6bf('0x33')]||0x3;this[_0xc6bf('0x34')]=_0x4a999e[_0xc6bf('0x34')]||0x96;this['dialBusyMaxRetry']=_0x4a999e['dialBusyMaxRetry']||0x3;this[_0xc6bf('0x35')]=_0x4a999e['dialBusyRetryFrequency']||0x96;this[_0xc6bf('0x36')]=_0x4a999e['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4a999e[_0xc6bf('0x37')]||0x96;this[_0xc6bf('0x38')]=_0x4a999e[_0xc6bf('0x38')]||0x3;this[_0xc6bf('0x39')]=_0x4a999e['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4a999e['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4a999e[_0xc6bf('0x3a')]||0x96;this[_0xc6bf('0x3b')]=_0x4a999e[_0xc6bf('0x3b')]||0x3;this[_0xc6bf('0x3c')]=_0x4a999e[_0xc6bf('0x3c')]||0x96;this[_0xc6bf('0x3d')]=_0x4a999e[_0xc6bf('0x3d')]||0x3;this[_0xc6bf('0x3e')]=_0x4a999e[_0xc6bf('0x3e')]||0x96;this[_0xc6bf('0x3f')]=_0x4a999e[_0xc6bf('0x3f')]||0x3;this[_0xc6bf('0x40')]=_0x4a999e[_0xc6bf('0x40')]||0x96;this[_0xc6bf('0x41')]=_0x4a999e[_0xc6bf('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x4a999e[_0xc6bf('0x42')]||0x4;this[_0xc6bf('0x43')]=_0x4a999e[_0xc6bf('0x43')]?_0x4a999e[_0xc6bf('0x43')]:undefined;this['TrunkBackup']=_0x4a999e['TrunkBackup']?_0x4a999e[_0xc6bf('0x44')]:undefined;this[_0xc6bf('0x45')]=_0x4a999e[_0xc6bf('0x45')]||undefined;this[_0xc6bf('0x46')]=_0x4a999e[_0xc6bf('0x46')]?_0x4a999e['Interval']:undefined;this[_0xc6bf('0x47')]=_0x4a999e['dialOrderByScheduledAt']||'DESC';this[_0xc6bf('0x48')]=_0x4a999e[_0xc6bf('0x48')]||undefined;this[_0xc6bf('0x49')]=_0x4a999e[_0xc6bf('0x49')]||undefined;this[_0xc6bf('0x4a')]=strategy[_0x4a999e['strategy']];this[_0xc6bf('0x4b')]=!![];this[_0xc6bf('0x4c')]=_0x4a999e['dialAMDActive']||![];this[_0xc6bf('0x4d')]=_0x4a999e[_0xc6bf('0x4d')];this[_0xc6bf('0x4e')]=_0x4a999e['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4a999e['dialAMDAfterGreetingSilence'];this[_0xc6bf('0x4f')]=_0x4a999e[_0xc6bf('0x4f')];this[_0xc6bf('0x50')]=_0x4a999e['dialAMDMinWordLength'];this[_0xc6bf('0x51')]=_0x4a999e['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4a999e[_0xc6bf('0x52')];this[_0xc6bf('0x53')]=_0x4a999e[_0xc6bf('0x53')];this['dialAMDMaximumWordLength']=_0x4a999e['dialAMDMaximumWordLength'];this[_0xc6bf('0x54')]=0x0;this[_0xc6bf('0x55')]=0x0;this[_0xc6bf('0x56')]=_0x4a999e[_0xc6bf('0x56')];this[_0xc6bf('0x57')]=0x0;this[_0xc6bf('0x58')]=0x0;this[_0xc6bf('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xc6bf('0x5a')]=0x0;this[_0xc6bf('0x5b')]=0x0;this[_0xc6bf('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc6bf('0x5d')]=0x0;this[_0xc6bf('0x5e')]=0x0;this[_0xc6bf('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xc6bf('0x60')]=undefined;this[_0xc6bf('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xc6bf('0x62')]=0x0;this[_0xc6bf('0x63')]=0x0;this[_0xc6bf('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xc6bf('0x65')]=0x0;this[_0xc6bf('0x66')]=0x0;this[_0xc6bf('0x67')]=0x0;this[_0xc6bf('0x68')]=_0x4a999e[_0xc6bf('0x69')]||0x14;this[_0xc6bf('0x6a')]=_0x4a999e[_0xc6bf('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xc6bf('0x6b')]=0x1;this[_0xc6bf('0x6c')]=0x0;this[_0xc6bf('0x6d')]=0x0;this[_0xc6bf('0x6e')]=0x0;this[_0xc6bf('0x6f')]=0x0;this[_0xc6bf('0x70')]=_0x4a999e[_0xc6bf('0x70')]||0x1e;this[_0xc6bf('0x71')]=_0x4a999e[_0xc6bf('0x71')]||![];this[_0xc6bf('0x72')]=!!_0x4a999e[_0xc6bf('0x72')]||![];this[_0xc6bf('0x73')]=!!_0x4a999e[_0xc6bf('0x73')]||![];this[_0xc6bf('0x74')]=_0x4a999e[_0xc6bf('0x74')]||undefined;this[_0xc6bf('0x75')]=_0x4a999e[_0xc6bf('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x4a999e[_0xc6bf('0x76')]||![];this[_0xc6bf('0x9')]=monitorFormat[_0x4a999e[_0xc6bf('0x9')]]?monitorFormat[_0x4a999e[_0xc6bf('0x9')]]:undefined;this['mandatoryDisposition']=_0x4a999e[_0xc6bf('0x77')]||![];this[_0xc6bf('0x78')]=_0x4a999e[_0xc6bf('0x78')]?_0x4a999e['mandatoryDispositionPause']:undefined;this[_0xc6bf('0x79')]=![];}module[_0xc6bf('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x6e64=['startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive'];(function(_0x5a0e3f,_0x394d58){var _0x563666=function(_0x5951b4){while(--_0x5951b4){_0x5a0e3f['push'](_0x5a0e3f['shift']());}};_0x563666(++_0x394d58);}(_0x6e64,0x10f));var _0x46e6=function(_0x4b2eba,_0x1532c7){_0x4b2eba=_0x4b2eba-0x0;var _0x352380=_0x6e64[_0x4b2eba];return _0x352380;};'use strict';var monitorFormat={'wav':_0x46e6('0x0'),'wav49':_0x46e6('0x1'),'gsm':_0x46e6('0x2')};var strategy={'fewestcalls':_0x46e6('0x3'),'leastrecent':'leastrecent','linear':_0x46e6('0x4'),'random':'random','ringall':_0x46e6('0x5'),'rr':'roundrobin','rrmemory':_0x46e6('0x6'),'rrordered':_0x46e6('0x7'),'wrandom':_0x46e6('0x8')};function VoiceQueue(_0x1fbeb1){this['id']=_0x1fbeb1['id']||0x0;this[_0x46e6('0x9')]=_0x1fbeb1[_0x46e6('0x9')]||'';this['monitor_format']=_0x1fbeb1[_0x46e6('0xa')]||'';this[_0x46e6('0xb')]=_0x1fbeb1[_0x46e6('0xb')]||_0x46e6('0xc');this[_0x46e6('0xd')]=0x0;this[_0x46e6('0xe')]=0x0;this[_0x46e6('0xf')]=0x0;this[_0x46e6('0x10')]=0x0;this[_0x46e6('0x11')]=0x0;this[_0x46e6('0x12')]=0x0;this['unmanaged']=0x0;this[_0x46e6('0x13')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0x46e6('0x14')]=0x0;this[_0x46e6('0x15')]=0x0;this[_0x46e6('0x16')]=0x0;this[_0x46e6('0x17')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x46e6('0x18')]=0x0;this[_0x46e6('0x19')]=0x0;this[_0x46e6('0x1a')]=0x0;this[_0x46e6('0x1b')]=0x0;this[_0x46e6('0x1c')]=0x0;this[_0x46e6('0x1d')]=_0x1fbeb1[_0x46e6('0x1d')]||![];this['acwTimeout']=_0x1fbeb1[_0x46e6('0x1e')]||0xa;this['autopause']=_0x1fbeb1[_0x46e6('0x1f')]||'no';this[_0x46e6('0x20')]=!![];this['message']='';this['statusMessage']='';this[_0x46e6('0x21')]=0x0;this[_0x46e6('0x22')]=0x0;this[_0x46e6('0x23')]=_0x1fbeb1['dialTimezone']||null;this[_0x46e6('0x24')]=_0x1fbeb1[_0x46e6('0x24')]?_0x1fbeb1[_0x46e6('0x24')]:null;this[_0x46e6('0x25')]=_0x1fbeb1[_0x46e6('0x25')];this[_0x46e6('0x26')]=_0x1fbeb1['dialMethod']||_0x46e6('0x27');this['dialLimitChannel']=_0x1fbeb1[_0x46e6('0x28')]||0x0;this['dialLimitQueue']=_0x1fbeb1[_0x46e6('0x29')]||0x0;this['dialPowerLevel']=_0x1fbeb1['dialPowerLevel']||0x1;this[_0x46e6('0x2a')]=_0x1fbeb1[_0x46e6('0x2a')]||_0x46e6('0x2b');this['dialPredictiveOptimizationPercentage']=_0x1fbeb1[_0x46e6('0x2c')]||0.03;this[_0x46e6('0x2d')]=_0x1fbeb1['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x1fbeb1[_0x46e6('0x2e')]||'anonymous';this[_0x46e6('0x2f')]=_0x1fbeb1[_0x46e6('0x2f')]||_0x46e6('0x30');this['dialOriginateTimeout']=_0x1fbeb1[_0x46e6('0x31')]||0x1e;this[_0x46e6('0x32')]=_0x1fbeb1[_0x46e6('0x32')]||_0x46e6('0x33');this[_0x46e6('0x34')]=_0x1fbeb1[_0x46e6('0x34')]||0x3;this[_0x46e6('0x35')]=_0x1fbeb1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1fbeb1[_0x46e6('0x36')]||0x3;this[_0x46e6('0x37')]=_0x1fbeb1[_0x46e6('0x37')]||0x96;this[_0x46e6('0x38')]=_0x1fbeb1[_0x46e6('0x38')]||0x3;this[_0x46e6('0x39')]=_0x1fbeb1[_0x46e6('0x39')]||0x96;this[_0x46e6('0x3a')]=_0x1fbeb1[_0x46e6('0x3a')]||0x3;this[_0x46e6('0x3b')]=_0x1fbeb1['dialNoAnswerRetryFrequency']||0x96;this[_0x46e6('0x3c')]=_0x1fbeb1[_0x46e6('0x3c')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1fbeb1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x46e6('0x3d')]=_0x1fbeb1[_0x46e6('0x3d')]||0x3;this[_0x46e6('0x3e')]=_0x1fbeb1[_0x46e6('0x3e')]||0x96;this[_0x46e6('0x3f')]=_0x1fbeb1['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1fbeb1[_0x46e6('0x40')]||0x96;this[_0x46e6('0x41')]=_0x1fbeb1[_0x46e6('0x41')]||0x3;this[_0x46e6('0x42')]=_0x1fbeb1[_0x46e6('0x42')]||0x96;this[_0x46e6('0x43')]=_0x1fbeb1[_0x46e6('0x43')]||0x3;this[_0x46e6('0x44')]=_0x1fbeb1[_0x46e6('0x44')]||0x96;this[_0x46e6('0x45')]=_0x1fbeb1[_0x46e6('0x45')]||0x3;this[_0x46e6('0x46')]=_0x1fbeb1[_0x46e6('0x46')]||0x4;this[_0x46e6('0x47')]=_0x1fbeb1['Trunk']?_0x1fbeb1[_0x46e6('0x47')]:undefined;this['TrunkBackup']=_0x1fbeb1[_0x46e6('0x48')]?_0x1fbeb1['TrunkBackup']:undefined;this[_0x46e6('0x49')]=_0x1fbeb1['dialPrefix']||undefined;this[_0x46e6('0x4a')]=_0x1fbeb1[_0x46e6('0x4a')]?_0x1fbeb1[_0x46e6('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x1fbeb1['dialOrderByScheduledAt']||_0x46e6('0x4b');this[_0x46e6('0x4c')]=_0x1fbeb1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x46e6('0x4d')]=_0x1fbeb1[_0x46e6('0x4d')]||undefined;this['strategy']=strategy[_0x1fbeb1[_0x46e6('0x4e')]];this[_0x46e6('0x4f')]=!![];this['dialAMDActive']=_0x1fbeb1[_0x46e6('0x50')]||![];this['dialAMDInitialSilence']=_0x1fbeb1[_0x46e6('0x51')];this[_0x46e6('0x52')]=_0x1fbeb1[_0x46e6('0x52')];this[_0x46e6('0x53')]=_0x1fbeb1[_0x46e6('0x53')];this[_0x46e6('0x54')]=_0x1fbeb1[_0x46e6('0x54')];this[_0x46e6('0x55')]=_0x1fbeb1[_0x46e6('0x55')];this['dialAMDBetweenWordsSilence']=_0x1fbeb1['dialAMDBetweenWordsSilence'];this[_0x46e6('0x56')]=_0x1fbeb1[_0x46e6('0x56')];this[_0x46e6('0x57')]=_0x1fbeb1['dialAMDSilenceThreshold'];this[_0x46e6('0x58')]=_0x1fbeb1[_0x46e6('0x58')];this[_0x46e6('0x59')]=0x0;this['pTalking']=0x0;this[_0x46e6('0x5a')]=_0x1fbeb1[_0x46e6('0x5a')];this[_0x46e6('0x5b')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x46e6('0x5c')]=0x0;this[_0x46e6('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x46e6('0x5e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x46e6('0x5f')]=0x0;this[_0x46e6('0x60')]=0x0;this[_0x46e6('0x61')]=0x0;this[_0x46e6('0x62')]=0x0;this[_0x46e6('0x63')]=0x0;this[_0x46e6('0x64')]=undefined;this[_0x46e6('0x65')]=undefined;this['handlePredictive']=undefined;this[_0x46e6('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x46e6('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x46e6('0x68')]=0x0;this[_0x46e6('0x69')]=0x0;this[_0x46e6('0x6a')]=0x0;this[_0x46e6('0x6b')]=0x0;this[_0x46e6('0x6c')]=_0x1fbeb1[_0x46e6('0x6d')]||0x14;this['predictiveIntervalMinThreshold']=_0x1fbeb1[_0x46e6('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x46e6('0x6e')]=0x1;this[_0x46e6('0x6f')]=0x0;this[_0x46e6('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x46e6('0x71')]=0x0;this['dialRecallMeTimeout']=_0x1fbeb1[_0x46e6('0x72')]||0x1e;this['dialRecallInQueue']=_0x1fbeb1[_0x46e6('0x73')]||![];this[_0x46e6('0x74')]=!!_0x1fbeb1['dialPreviewAutoRecallMe']||![];this[_0x46e6('0x75')]=!!_0x1fbeb1['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x1fbeb1[_0x46e6('0x76')]||undefined;this[_0x46e6('0x77')]=_0x1fbeb1[_0x46e6('0x77')]||![];this[_0x46e6('0x78')]=_0x1fbeb1['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1fbeb1[_0x46e6('0xa')]]?monitorFormat[_0x1fbeb1['monitor_format']]:undefined;this[_0x46e6('0x79')]=_0x1fbeb1[_0x46e6('0x79')]||![];this['mandatoryDispositionPause']=_0x1fbeb1['mandatoryDispositionPause']?_0x1fbeb1['mandatoryDispositionPause']:undefined;this[_0x46e6('0x7a')]=![];}module[_0x46e6('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 81eac67..c07195c 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27c9=['outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','createReport','loggedin','callers','SIP/','incall','status','booked','keys','length','queue','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','active','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay'];(function(_0x17acb5,_0x2445b5){var _0x4aca07=function(_0x3c742d){while(--_0x3c742d){_0x17acb5['push'](_0x17acb5['shift']());}};_0x4aca07(++_0x2445b5);}(_0x27c9,0x1af));var _0x927c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x27c9[_0x21a9d9];return _0x46adce;};'use strict';var INBOUND_COUNTERS=[_0x927c('0x0'),_0x927c('0x1'),_0x927c('0x2'),_0x927c('0x3'),'ringing',_0x927c('0x4'),_0x927c('0x5')];var OUTBOUND_COUNTERS=['available',_0x927c('0x6'),_0x927c('0x7'),_0x927c('0x1'),_0x927c('0x2'),_0x927c('0x8'),'outboundAbandonedCallsDay',_0x927c('0x9'),_0x927c('0xa'),_0x927c('0xb'),'outboundCongestionCallsDay',_0x927c('0xc'),_0x927c('0xd'),_0x927c('0xe'),'outboundRejectCallsDay',_0x927c('0xf'),_0x927c('0x3'),_0x927c('0x10'),_0x927c('0x4'),_0x927c('0x11'),_0x927c('0x12'),_0x927c('0x13'),_0x927c('0x5')];function VoiceQueueSummary(_0x57238b){this['id']=_0x57238b['id'];this['name']=_0x57238b[_0x927c('0x14')];this[_0x927c('0x15')]=_0x57238b[_0x927c('0x15')];this[_0x927c('0x16')]=_0x57238b['abandoned']||0x0;this[_0x927c('0x6')]=_0x57238b['answered']||0x0;this['available']=_0x57238b[_0x927c('0x0')]||0x0;this[_0x927c('0x17')]=_0x57238b[_0x927c('0x17')]||0x0;this[_0x927c('0x7')]=_0x57238b[_0x927c('0x7')]||0x0;this[_0x927c('0x18')]=_0x57238b[_0x927c('0x18')]||0x0;this[_0x927c('0x1')]=_0x57238b[_0x927c('0x1')]||0x0;this[_0x927c('0x2')]=_0x57238b[_0x927c('0x2')]||0x0;this[_0x927c('0x19')]=_0x57238b['onHold']||0x0;this[_0x927c('0x1a')]=_0x57238b[_0x927c('0x1a')]||0x0;this['paused']=_0x57238b[_0x927c('0x3')]||0x0;this[_0x927c('0x1b')]=_0x57238b['ringing']||0x0;this[_0x927c('0x1c')]=_0x57238b[_0x927c('0x1c')];this[_0x927c('0x11')]=_0x57238b[_0x927c('0x11')];this[_0x927c('0x12')]=_0x57238b['sumDuration'];this['sumHoldTime']=_0x57238b['sumHoldTime']||0x0;this[_0x927c('0x4')]=_0x57238b[_0x927c('0x4')]||0x0;this[_0x927c('0x13')]=_0x57238b[_0x927c('0x13')]||0x0;this[_0x927c('0x1d')]=_0x57238b[_0x927c('0x1d')];this['unavailable']=_0x57238b[_0x927c('0x1e')]||0x0;this[_0x927c('0x1f')]=_0x57238b[_0x927c('0x1f')]||0x0;this[_0x927c('0x20')]=_0x57238b[_0x927c('0x20')]||0x0;this[_0x927c('0x5')]=_0x57238b['waiting']||0x0;if(_0x57238b[_0x927c('0x1d')]===_0x927c('0x21')){this[_0x927c('0x10')]=_0x57238b[_0x927c('0x10')]||0x0;this['dialActive']=_0x57238b[_0x927c('0x22')];this[_0x927c('0x23')]=_0x57238b[_0x927c('0x23')];this[_0x927c('0x24')]=_0x57238b[_0x927c('0x24')];this['dialOriginateCallerIdNumber']=_0x57238b[_0x927c('0x25')];this[_0x927c('0x26')]=_0x57238b[_0x927c('0x26')];this['dialPrefix']=_0x57238b[_0x927c('0x27')];this[_0x927c('0x28')]=_0x57238b[_0x927c('0x28')];this[_0x927c('0x29')]=_0x57238b[_0x927c('0x29')];this[_0x927c('0x9')]=_0x57238b[_0x927c('0x9')];this['outboundBlacklistCallsDay']=_0x57238b[_0x927c('0xa')];this[_0x927c('0xb')]=_0x57238b[_0x927c('0xb')];this[_0x927c('0x2a')]=_0x57238b[_0x927c('0x2a')];this[_0x927c('0x2b')]=_0x57238b[_0x927c('0x2b')];this[_0x927c('0x2c')]=_0x57238b[_0x927c('0x2c')];this[_0x927c('0x2d')]=_0x57238b['outboundDropCallsDayTimeout'];this[_0x927c('0xc')]=_0x57238b[_0x927c('0xc')];this[_0x927c('0xd')]=_0x57238b['outboundNoSuchCallsDay'];this[_0x927c('0x2e')]=_0x57238b[_0x927c('0x2e')];this[_0x927c('0xe')]=_0x57238b[_0x927c('0xe')];this['outboundRejectCallsDay']=_0x57238b[_0x927c('0x2f')];this[_0x927c('0xf')]=_0x57238b[_0x927c('0xf')];this[_0x927c('0x30')]=_0x57238b['predictiveIntervalAnsweredCalls'];this[_0x927c('0x31')]=_0x57238b['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x57238b[_0x927c('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x57238b[_0x927c('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x57238b[_0x927c('0x34')];this[_0x927c('0x35')]=_0x57238b[_0x927c('0x35')];this[_0x927c('0x36')]=_0x57238b[_0x927c('0x36')];this['predictiveIntervalHitRate']=_0x57238b[_0x927c('0x37')];this[_0x927c('0x38')]=_0x57238b[_0x927c('0x38')];this['predictiveIntervalPauses']=_0x57238b[_0x927c('0x39')];this['predictiveIntervalAvailable']=_0x57238b['predictiveIntervalAvailable'];this[_0x927c('0x3a')]=_0x57238b['predictiveIntervalTotalCalls'];this['originated']=_0x57238b[_0x927c('0x8')];this[_0x927c('0x3b')]=_0x57238b[_0x927c('0x3b')];this['erlangCallToSecond']=_0x57238b[_0x927c('0x3c')];this[_0x927c('0x3d')]=_0x57238b[_0x927c('0x3d')];this['erlangBusyFactor']=_0x57238b[_0x927c('0x3e')];this[_0x927c('0x3f')]=_0x57238b[_0x927c('0x3f')];this['startProgressive']=_0x57238b[_0x927c('0x40')];this[_0x927c('0x41')]=_0x57238b[_0x927c('0x41')];this['statusMessage']=_0x57238b[_0x927c('0x42')];}if(_0x57238b[_0x927c('0x43')]){this[_0x927c('0x43')]={'id':_0x57238b['Trunk']['id'],'name':_0x57238b['Trunk'][_0x927c('0x14')],'active':_0x57238b[_0x927c('0x43')]['active'],'callerid':_0x57238b['Trunk'][_0x927c('0x44')]};}}VoiceQueueSummary['prototype'][_0x927c('0x45')]=function(_0x238d10,_0x3a57c2,_0x4c3851,_0x3e6c43){this['loggedInDb']=0x0;this[_0x927c('0x4')]=0x0;this[_0x927c('0x3')]=0x0;this[_0x927c('0x1f')]=0x0;this[_0x927c('0x1a')]=0x0;this[_0x927c('0x7')]=0x0;this['busy']=0x0;this[_0x927c('0x18')]=0x0;this[_0x927c('0x1e')]=0x0;this[_0x927c('0x1b')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x4c3851){if(_0x4c3851['available']){this['available']=Number(_0x4c3851['available']);}if(_0x4c3851[_0x927c('0x46')]){this[_0x927c('0x1')]=Number(_0x4c3851[_0x927c('0x46')]);}if(_0x4c3851[_0x927c('0x47')]){this[_0x927c('0x5')]=Number(_0x4c3851['callers']);}}for(var _0x76a7c2=0x0;_0x76a7c2<_0x238d10['length'];_0x76a7c2++){var _0x29c6e6=_0x3a57c2[_0x927c('0x48')+_0x238d10[_0x76a7c2][_0x927c('0x14')]];if(_0x29c6e6&&_0x29c6e6['online']){this['loggedInDb']+=0x1;}if(_0x238d10[_0x76a7c2][_0x927c('0x49')]==='1'){this[_0x927c('0x4')]+=0x1;}if(_0x238d10[_0x76a7c2][_0x927c('0x3')]==='1'&&!['2','7','8']['includes'](_0x238d10[_0x76a7c2]['status'])){this[_0x927c('0x3')]+=0x1;}switch(_0x238d10[_0x76a7c2][_0x927c('0x4a')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x927c('0x1a')]+=0x1;break;case'2':this[_0x927c('0x7')]+=0x1;break;case'3':this[_0x927c('0x17')]+=0x1;break;case'4':this[_0x927c('0x18')]+=0x1;break;case'5':this[_0x927c('0x1e')]+=0x1;break;case'6':this[_0x927c('0x1b')]+=0x1;break;case'7':this[_0x927c('0x1c')]+=0x1;break;case'8':this[_0x927c('0x19')]+=0x1;break;}}if(this[_0x927c('0x23')]===_0x927c('0x4b')){var _0x4f0bb4=Object[_0x927c('0x4c')](_0x3e6c43);for(var _0xc3845b=0x0;_0xc3845b<_0x4f0bb4[_0x927c('0x4d')];_0xc3845b++){var _0x569ecc=_0x4f0bb4[_0xc3845b];var _0x598750=_0x3e6c43[_0x569ecc];if(_0x598750[_0x927c('0x4e')]===this[_0x927c('0x14')]&&_0x598750['type']==='dialer'&&_0x598750[_0x927c('0x4f')]===_0x927c('0x50')){this['talking']+=0x1;}}if(this[_0x927c('0x4')]>this[_0x927c('0x7')]){this['talking']=this[_0x927c('0x7')];}this[_0x927c('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x927c('0x51')][_0x927c('0x52')]=function(_0x4f6c3d){var _0x1f10d0=![];if(_0x4f6c3d){_0x1f10d0=INBOUND_COUNTERS[_0x927c('0x53')](function(_0x453cb1){return this[_0x453cb1]!==_0x4f6c3d[_0x453cb1];},this);}return _0x1f10d0;};VoiceQueueSummary[_0x927c('0x51')][_0x927c('0x54')]=function(_0x5e7e0a){var _0x444857=![];var _0x371535=![];var _0x537121=![];if(_0x5e7e0a){_0x444857=this[_0x927c('0x23')]!==_0x5e7e0a['dialMethod']||this[_0x927c('0x22')]!==_0x5e7e0a[_0x927c('0x22')]||this['message']!==_0x5e7e0a[_0x927c('0x41')]||this['statusMessage']!==_0x5e7e0a[_0x927c('0x42')];_0x371535=OUTBOUND_COUNTERS['some'](function(_0x322fa5){return this[_0x322fa5]!==_0x5e7e0a[_0x322fa5];},this);if(this[_0x927c('0x43')]&&_0x5e7e0a[_0x927c('0x43')]){_0x537121=this['Trunk'][_0x927c('0x14')]!==_0x5e7e0a[_0x927c('0x43')]['name']||this['Trunk'][_0x927c('0x55')]!==_0x5e7e0a[_0x927c('0x43')][_0x927c('0x55')];}}return _0x444857||_0x371535||_0x537121;};VoiceQueueSummary[_0x927c('0x51')]['updateReportFromOutboundQueue']=function(_0x2777c9){this[_0x927c('0x6')]=_0x2777c9['answered'];this['message']=_0x2777c9[_0x927c('0x41')];this['statusMessage']=_0x2777c9[_0x927c('0x42')];this[_0x927c('0x8')]=_0x2777c9['originated'];this[_0x927c('0x56')]=_0x2777c9['outboundAbandonedCallsDay'];this[_0x927c('0x9')]=_0x2777c9[_0x927c('0x9')];this[_0x927c('0xa')]=_0x2777c9[_0x927c('0xa')];this[_0x927c('0xb')]=_0x2777c9['outboundBusyCallsDay'];this[_0x927c('0x2a')]=_0x2777c9[_0x927c('0x2a')];this[_0x927c('0xc')]=_0x2777c9['outboundNoAnswerCallsDay'];this[_0x927c('0xd')]=_0x2777c9['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x2777c9[_0x927c('0xe')];this['outboundRejectCallsDay']=_0x2777c9[_0x927c('0x2f')];this[_0x927c('0xf')]=_0x2777c9[_0x927c('0xf')];this[_0x927c('0x11')]=_0x2777c9['sumBillable'];this[_0x927c('0x12')]=_0x2777c9[_0x927c('0x12')];this['total']=_0x2777c9[_0x927c('0x13')];if(this[_0x927c('0x23')]===_0x927c('0x57')){this[_0x927c('0x10')]=_0x2777c9[_0x927c('0x10')];}};module[_0x927c('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0xd072=['predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xd072,0x132));var _0x2d07=function(_0x58352c,_0x3e8bc){_0x58352c=_0x58352c-0x0;var _0x31fa3c=_0xd072[_0x58352c];return _0x31fa3c;};'use strict';var INBOUND_COUNTERS=[_0x2d07('0x0'),_0x2d07('0x1'),_0x2d07('0x2'),_0x2d07('0x3'),_0x2d07('0x4'),_0x2d07('0x5'),_0x2d07('0x6')];var OUTBOUND_COUNTERS=['available',_0x2d07('0x7'),_0x2d07('0x8'),_0x2d07('0x1'),_0x2d07('0x2'),_0x2d07('0x9'),'outboundAbandonedCallsDay',_0x2d07('0xa'),_0x2d07('0xb'),_0x2d07('0xc'),_0x2d07('0xd'),_0x2d07('0xe'),_0x2d07('0xf'),_0x2d07('0x10'),'outboundRejectCallsDay',_0x2d07('0x11'),_0x2d07('0x3'),_0x2d07('0x12'),_0x2d07('0x5'),_0x2d07('0x13'),_0x2d07('0x14'),_0x2d07('0x15'),_0x2d07('0x6')];function VoiceQueueSummary(_0x231c86){this['id']=_0x231c86['id'];this[_0x2d07('0x16')]=_0x231c86[_0x2d07('0x16')];this[_0x2d07('0x17')]=_0x231c86[_0x2d07('0x17')];this[_0x2d07('0x18')]=_0x231c86[_0x2d07('0x18')]||0x0;this[_0x2d07('0x7')]=_0x231c86[_0x2d07('0x7')]||0x0;this[_0x2d07('0x0')]=_0x231c86[_0x2d07('0x0')]||0x0;this[_0x2d07('0x19')]=_0x231c86[_0x2d07('0x19')]||0x0;this[_0x2d07('0x8')]=_0x231c86[_0x2d07('0x8')]||0x0;this[_0x2d07('0x1a')]=_0x231c86[_0x2d07('0x1a')]||0x0;this['loggedIn']=_0x231c86[_0x2d07('0x1')]||0x0;this[_0x2d07('0x2')]=_0x231c86[_0x2d07('0x2')]||0x0;this[_0x2d07('0x1b')]=_0x231c86[_0x2d07('0x1b')]||0x0;this[_0x2d07('0x1c')]=_0x231c86[_0x2d07('0x1c')]||0x0;this[_0x2d07('0x3')]=_0x231c86['paused']||0x0;this[_0x2d07('0x4')]=_0x231c86[_0x2d07('0x4')]||0x0;this[_0x2d07('0x1d')]=_0x231c86[_0x2d07('0x1d')];this['sumBillable']=_0x231c86[_0x2d07('0x13')];this[_0x2d07('0x14')]=_0x231c86[_0x2d07('0x14')];this[_0x2d07('0x1e')]=_0x231c86[_0x2d07('0x1e')]||0x0;this[_0x2d07('0x5')]=_0x231c86[_0x2d07('0x5')]||0x0;this[_0x2d07('0x15')]=_0x231c86['total']||0x0;this[_0x2d07('0x1f')]=_0x231c86[_0x2d07('0x1f')];this[_0x2d07('0x20')]=_0x231c86['unavailable']||0x0;this[_0x2d07('0x21')]=_0x231c86['unknown']||0x0;this[_0x2d07('0x22')]=_0x231c86[_0x2d07('0x22')]||0x0;this[_0x2d07('0x6')]=_0x231c86['waiting']||0x0;if(_0x231c86[_0x2d07('0x1f')]===_0x2d07('0x23')){this['pTalking']=_0x231c86[_0x2d07('0x12')]||0x0;this['dialActive']=_0x231c86[_0x2d07('0x24')];this[_0x2d07('0x25')]=_0x231c86[_0x2d07('0x25')];this[_0x2d07('0x26')]=_0x231c86['dialOriginateCallerIdName'];this[_0x2d07('0x27')]=_0x231c86[_0x2d07('0x27')];this[_0x2d07('0x28')]=_0x231c86['dialOriginateTimeout'];this[_0x2d07('0x29')]=_0x231c86['dialPrefix'];this['temp']=_0x231c86[_0x2d07('0x2a')];this[_0x2d07('0x2b')]=_0x231c86['outboundAnswerAgiCallsDay'];this[_0x2d07('0xa')]=_0x231c86['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x231c86[_0x2d07('0xb')];this[_0x2d07('0xc')]=_0x231c86['outboundBusyCallsDay'];this[_0x2d07('0xd')]=_0x231c86['outboundCongestionCallsDay'];this[_0x2d07('0x2c')]=_0x231c86[_0x2d07('0x2c')];this['outboundDropCallsDayCallersExit']=_0x231c86[_0x2d07('0x2d')];this['outboundDropCallsDayTimeout']=_0x231c86['outboundDropCallsDayTimeout'];this[_0x2d07('0xe')]=_0x231c86['outboundNoAnswerCallsDay'];this[_0x2d07('0xf')]=_0x231c86[_0x2d07('0xf')];this[_0x2d07('0x2e')]=_0x231c86['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x231c86[_0x2d07('0x10')];this[_0x2d07('0x2f')]=_0x231c86[_0x2d07('0x2f')];this[_0x2d07('0x11')]=_0x231c86['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x231c86['predictiveIntervalAnsweredCalls'];this[_0x2d07('0x30')]=_0x231c86['predictiveIntervalAvgHoldtime'];this[_0x2d07('0x31')]=_0x231c86[_0x2d07('0x31')];this[_0x2d07('0x32')]=_0x231c86[_0x2d07('0x32')];this[_0x2d07('0x33')]=_0x231c86['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x231c86[_0x2d07('0x34')];this[_0x2d07('0x35')]=_0x231c86[_0x2d07('0x35')];this[_0x2d07('0x36')]=_0x231c86['predictiveIntervalHitRate'];this[_0x2d07('0x37')]=_0x231c86[_0x2d07('0x37')];this[_0x2d07('0x38')]=_0x231c86[_0x2d07('0x38')];this['predictiveIntervalAvailable']=_0x231c86['predictiveIntervalAvailable'];this[_0x2d07('0x39')]=_0x231c86[_0x2d07('0x39')];this[_0x2d07('0x9')]=_0x231c86['originated'];this['erlangCalls']=_0x231c86[_0x2d07('0x3a')];this[_0x2d07('0x3b')]=_0x231c86[_0x2d07('0x3b')];this[_0x2d07('0x3c')]=_0x231c86[_0x2d07('0x3c')];this['erlangBusyFactor']=_0x231c86[_0x2d07('0x3d')];this[_0x2d07('0x3e')]=_0x231c86['startPredictive'];this[_0x2d07('0x3f')]=_0x231c86['startProgressive'];this[_0x2d07('0x40')]=_0x231c86[_0x2d07('0x40')];this[_0x2d07('0x41')]=_0x231c86[_0x2d07('0x41')];}if(_0x231c86[_0x2d07('0x42')]){this[_0x2d07('0x42')]={'id':_0x231c86['Trunk']['id'],'name':_0x231c86[_0x2d07('0x42')][_0x2d07('0x16')],'active':_0x231c86[_0x2d07('0x42')][_0x2d07('0x43')],'callerid':_0x231c86['Trunk'][_0x2d07('0x44')]};}}VoiceQueueSummary[_0x2d07('0x45')][_0x2d07('0x46')]=function(_0x2d76e1,_0x2ac0b0,_0x5791f8,_0xbb2c54){this[_0x2d07('0x2')]=0x0;this[_0x2d07('0x5')]=0x0;this[_0x2d07('0x3')]=0x0;this[_0x2d07('0x21')]=0x0;this[_0x2d07('0x1c')]=0x0;this[_0x2d07('0x8')]=0x0;this[_0x2d07('0x19')]=0x0;this[_0x2d07('0x1a')]=0x0;this[_0x2d07('0x20')]=0x0;this[_0x2d07('0x4')]=0x0;this[_0x2d07('0x1d')]=0x0;this[_0x2d07('0x1b')]=0x0;if(_0x5791f8){if(_0x5791f8['available']){this[_0x2d07('0x0')]=Number(_0x5791f8[_0x2d07('0x0')]);}if(_0x5791f8['loggedin']){this[_0x2d07('0x1')]=Number(_0x5791f8[_0x2d07('0x47')]);}if(_0x5791f8[_0x2d07('0x48')]){this['waiting']=Number(_0x5791f8['callers']);}}for(var _0x3fb560=0x0;_0x3fb560<_0x2d76e1[_0x2d07('0x49')];_0x3fb560++){var _0xd7e520=_0x2ac0b0['SIP/'+_0x2d76e1[_0x3fb560][_0x2d07('0x16')]];if(_0xd7e520&&_0xd7e520[_0x2d07('0x4a')]){this['loggedInDb']+=0x1;}if(_0x2d76e1[_0x3fb560][_0x2d07('0x4b')]==='1'){this[_0x2d07('0x5')]+=0x1;}if(_0x2d76e1[_0x3fb560][_0x2d07('0x3')]==='1'&&!['2','7','8'][_0x2d07('0x4c')](_0x2d76e1[_0x3fb560][_0x2d07('0x4d')])){this[_0x2d07('0x3')]+=0x1;}switch(_0x2d76e1[_0x3fb560]['status']){case'0':this[_0x2d07('0x21')]+=0x1;break;case'1':this[_0x2d07('0x1c')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x2d07('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x2d07('0x4')]+=0x1;break;case'7':this[_0x2d07('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x2d07('0x4e')){var _0x53fc26=Object[_0x2d07('0x4f')](_0xbb2c54);for(var _0x5e4495=0x0;_0x5e4495<_0x53fc26[_0x2d07('0x49')];_0x5e4495++){var _0xccd0cf=_0x53fc26[_0x5e4495];var _0x17180b=_0xbb2c54[_0xccd0cf];if(_0x17180b[_0x2d07('0x50')]===this[_0x2d07('0x16')]&&_0x17180b[_0x2d07('0x1f')]===_0x2d07('0x51')&&_0x17180b[_0x2d07('0x52')]===_0x2d07('0x53')){this[_0x2d07('0x5')]+=0x1;}}if(this[_0x2d07('0x5')]>this[_0x2d07('0x8')]){this[_0x2d07('0x5')]=this[_0x2d07('0x8')];}this[_0x2d07('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x2d07('0x45')][_0x2d07('0x54')]=function(_0x2aaa50){var _0x88ff84=![];if(_0x2aaa50){_0x88ff84=INBOUND_COUNTERS[_0x2d07('0x55')](function(_0x2fdea8){return this[_0x2fdea8]!==_0x2aaa50[_0x2fdea8];},this);}return _0x88ff84;};VoiceQueueSummary[_0x2d07('0x45')][_0x2d07('0x56')]=function(_0x40bf8f){var _0x251659=![];var _0x5cf066=![];var _0x1970ef=![];if(_0x40bf8f){_0x251659=this['dialMethod']!==_0x40bf8f[_0x2d07('0x25')]||this['dialActive']!==_0x40bf8f[_0x2d07('0x24')]||this[_0x2d07('0x40')]!==_0x40bf8f[_0x2d07('0x40')]||this[_0x2d07('0x41')]!==_0x40bf8f[_0x2d07('0x41')];_0x5cf066=OUTBOUND_COUNTERS[_0x2d07('0x55')](function(_0x7409d4){return this[_0x7409d4]!==_0x40bf8f[_0x7409d4];},this);if(this[_0x2d07('0x42')]&&_0x40bf8f['Trunk']){_0x1970ef=this['Trunk']['name']!==_0x40bf8f[_0x2d07('0x42')][_0x2d07('0x16')]||this[_0x2d07('0x42')][_0x2d07('0x43')]!==_0x40bf8f[_0x2d07('0x42')][_0x2d07('0x43')];}}return _0x251659||_0x5cf066||_0x1970ef;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x4d42bd){this[_0x2d07('0x7')]=_0x4d42bd[_0x2d07('0x7')];this[_0x2d07('0x40')]=_0x4d42bd[_0x2d07('0x40')];this[_0x2d07('0x41')]=_0x4d42bd[_0x2d07('0x41')];this[_0x2d07('0x9')]=_0x4d42bd[_0x2d07('0x9')];this[_0x2d07('0x57')]=_0x4d42bd[_0x2d07('0x57')];this[_0x2d07('0xa')]=_0x4d42bd[_0x2d07('0xa')];this[_0x2d07('0xb')]=_0x4d42bd[_0x2d07('0xb')];this[_0x2d07('0xc')]=_0x4d42bd[_0x2d07('0xc')];this[_0x2d07('0xd')]=_0x4d42bd[_0x2d07('0xd')];this[_0x2d07('0xe')]=_0x4d42bd[_0x2d07('0xe')];this[_0x2d07('0xf')]=_0x4d42bd[_0x2d07('0xf')];this[_0x2d07('0x10')]=_0x4d42bd[_0x2d07('0x10')];this[_0x2d07('0x2f')]=_0x4d42bd[_0x2d07('0x2f')];this['outboundUnknownCallsDay']=_0x4d42bd['outboundUnknownCallsDay'];this[_0x2d07('0x13')]=_0x4d42bd[_0x2d07('0x13')];this['sumDuration']=_0x4d42bd[_0x2d07('0x14')];this[_0x2d07('0x15')]=_0x4d42bd[_0x2d07('0x15')];if(this[_0x2d07('0x25')]===_0x2d07('0x58')){this['pTalking']=_0x4d42bd[_0x2d07('0x12')];}};module[_0x2d07('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3257eb9..2935e5f 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 _0x5012=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x18799c,_0x221415){var _0x24832d=function(_0x3a78fd){while(--_0x3a78fd){_0x18799c['push'](_0x18799c['shift']());}};_0x24832d(++_0x221415);}(_0x5012,0x1ec));var _0x2501=function(_0x5e7f8e,_0x4ae19e){_0x5e7f8e=_0x5e7f8e-0x0;var _0x4d79c4=_0x5012[_0x5e7f8e];return _0x4d79c4;};'use strict';function VtigerAccount(_0x4b92fa){this['id']=_0x4b92fa['id']||0x0;this[_0x2501('0x0')]=_0x4b92fa[_0x2501('0x0')]||'';this[_0x2501('0x1')]=_0x4b92fa[_0x2501('0x1')]||'';this[_0x2501('0x2')]=_0x4b92fa[_0x2501('0x2')]||'';this[_0x2501('0x3')]=_0x4b92fa[_0x2501('0x3')]||'';this[_0x2501('0x4')]=_0x4b92fa[_0x2501('0x4')]||'';this[_0x2501('0x5')]=_0x4b92fa[_0x2501('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xfa86=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4d24c3,_0x369b16){var _0x1ff57a=function(_0xc85e0b){while(--_0xc85e0b){_0x4d24c3['push'](_0x4d24c3['shift']());}};_0x1ff57a(++_0x369b16);}(_0xfa86,0x1d3));var _0x6fa8=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xfa86[_0x3203a1];return _0x24215e;};'use strict';function VtigerAccount(_0x5d090e){this['id']=_0x5d090e['id']||0x0;this[_0x6fa8('0x0')]=_0x5d090e[_0x6fa8('0x0')]||'';this[_0x6fa8('0x1')]=_0x5d090e['username']||'';this[_0x6fa8('0x2')]=_0x5d090e['accessKey']||'';this[_0x6fa8('0x3')]=_0x5d090e['remoteUri']||'';this[_0x6fa8('0x4')]=_0x5d090e[_0x6fa8('0x4')]||'';this[_0x6fa8('0x5')]=_0x5d090e['Configurations']||{};}module[_0x6fa8('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 9e0dbb6..6c60b5e 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 _0xb560=['authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x56fb4e,_0x3f7cb7){var _0x45c9a3=function(_0x796621){while(--_0x796621){_0x56fb4e['push'](_0x56fb4e['shift']());}};_0x45c9a3(++_0x3f7cb7);}(_0xb560,0xd7));var _0x0b56=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb560[_0x53ccf2];return _0x5a2964;};'use strict';function ZendeskAccount(_0x5c7ba0){this['id']=_0x5c7ba0['id']||0x0;this[_0x0b56('0x0')]=_0x5c7ba0[_0x0b56('0x0')]||'';this[_0x0b56('0x1')]=_0x5c7ba0['username']||'';this[_0x0b56('0x2')]=_0x5c7ba0[_0x0b56('0x2')]||'';this[_0x0b56('0x3')]=_0x5c7ba0['token']||'';this[_0x0b56('0x4')]=_0x5c7ba0[_0x0b56('0x4')]||'';this['authType']=_0x5c7ba0[_0x0b56('0x5')]||'';this['type']=_0x5c7ba0['type']||_0x0b56('0x6');this[_0x0b56('0x7')]=_0x5c7ba0[_0x0b56('0x7')]||'';this[_0x0b56('0x8')]=_0x5c7ba0['Configurations']||{};}module[_0x0b56('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xd70d=['type','integrationTab','serverUrl','Configurations','exports','username','password','token','remoteUri','authType'];(function(_0x14598c,_0x43c6c8){var _0x5adab4=function(_0x3d07b5){while(--_0x3d07b5){_0x14598c['push'](_0x14598c['shift']());}};_0x5adab4(++_0x43c6c8);}(_0xd70d,0xb9));var _0xdd70=function(_0x1b5c7f,_0x454f9d){_0x1b5c7f=_0x1b5c7f-0x0;var _0x1d7d59=_0xd70d[_0x1b5c7f];return _0x1d7d59;};'use strict';function ZendeskAccount(_0x110488){this['id']=_0x110488['id']||0x0;this['name']=_0x110488['name']||'';this[_0xdd70('0x0')]=_0x110488[_0xdd70('0x0')]||'';this[_0xdd70('0x1')]=_0x110488['password']||'';this[_0xdd70('0x2')]=_0x110488['token']||'';this['remoteUri']=_0x110488[_0xdd70('0x3')]||'';this[_0xdd70('0x4')]=_0x110488['authType']||'';this[_0xdd70('0x5')]=_0x110488[_0xdd70('0x5')]||_0xdd70('0x6');this[_0xdd70('0x7')]=_0x110488[_0xdd70('0x7')]||'';this[_0xdd70('0x8')]=_0x110488['Configurations']||{};}module[_0xdd70('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6f0293e..4f0cd83 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 _0xd939=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x534c1f,_0x3d5b10){var _0xf09f6e=function(_0x29e43e){while(--_0x29e43e){_0x534c1f['push'](_0x534c1f['shift']());}};_0xf09f6e(++_0x3d5b10);}(_0xd939,0x64));var _0x9d93=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0xd939[_0x186d17];return _0x5d4b89;};'use strict';function ZohoAccount(_0x432d0e){this['id']=_0x432d0e['id']||0x0;this[_0x9d93('0x0')]=_0x432d0e[_0x9d93('0x0')]||'';this[_0x9d93('0x1')]=_0x432d0e[_0x9d93('0x1')]||'';this[_0x9d93('0x2')]=_0x432d0e['host']||'';this[_0x9d93('0x3')]=_0x432d0e[_0x9d93('0x3')]||'';this[_0x9d93('0x4')]=_0x432d0e[_0x9d93('0x4')]||'';this['clientSecret']=_0x432d0e[_0x9d93('0x5')]||'';this[_0x9d93('0x6')]=_0x432d0e['serverUrl']||'';this[_0x9d93('0x7')]=_0x432d0e[_0x9d93('0x7')]||'';this[_0x9d93('0x8')]=_0x432d0e[_0x9d93('0x8')]||'';this[_0x9d93('0x9')]=_0x432d0e['Configurations']||{};}module[_0x9d93('0xa')]=ZohoAccount; \ No newline at end of file +var _0xce9a=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x3756dc,_0x25b919){var _0x2a35bb=function(_0x56e416){while(--_0x56e416){_0x3756dc['push'](_0x3756dc['shift']());}};_0x2a35bb(++_0x25b919);}(_0xce9a,0xd1));var _0xace9=function(_0x4fbd3d,_0x5ccc08){_0x4fbd3d=_0x4fbd3d-0x0;var _0x17d8ea=_0xce9a[_0x4fbd3d];return _0x17d8ea;};'use strict';function ZohoAccount(_0x2d7cba){this['id']=_0x2d7cba['id']||0x0;this[_0xace9('0x0')]=_0x2d7cba[_0xace9('0x0')]||'';this[_0xace9('0x1')]=_0x2d7cba[_0xace9('0x1')]||'';this['host']=_0x2d7cba[_0xace9('0x2')]||'';this['zone']=_0x2d7cba[_0xace9('0x3')]||'';this['clientId']=_0x2d7cba[_0xace9('0x4')]||'';this['clientSecret']=_0x2d7cba[_0xace9('0x5')]||'';this[_0xace9('0x6')]=_0x2d7cba[_0xace9('0x6')]||'';this[_0xace9('0x7')]=_0x2d7cba[_0xace9('0x7')]||'';this[_0xace9('0x8')]=_0x2d7cba[_0xace9('0x8')]||'';this[_0xace9('0x9')]=_0x2d7cba[_0xace9('0x9')]||{};}module[_0xace9('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 4132850..a02f4ce 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 _0x9f0e=['UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x4deff1,_0x5421fc){var _0x559271=function(_0x2a2e34){while(--_0x2a2e34){_0x4deff1['push'](_0x4deff1['shift']());}};_0x559271(++_0x5421fc);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2fbcdd,_0x5b619b){_0x2fbcdd=_0x2fbcdd-0x0;var _0x1088dc=_0x9f0e[_0x2fbcdd];return _0x1088dc;};'use strict';var util=require(_0xe9f0('0x0'));var _=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));function checkNameSurname(_0x1a7796,_0x146ad8,_0x4a1a30){var _0x5856dc='';if(!_[_0xe9f0('0x3')](_0x146ad8)&&_0xe9f0('0x4')===typeof _0x146ad8){_0x5856dc+=_0x146ad8;}if(!_[_0xe9f0('0x3')](_0x4a1a30)&&_0xe9f0('0x4')===typeof _0x4a1a30){_0x5856dc+='\x20'+_0x4a1a30;}if(_0x5856dc!==''){return _0x5856dc;}return _0x1a7796;}function Action(_0x1eed45,_0x50313d,_0x5b87c1,_0x3a17b3,_0x167198){this[_0xe9f0('0x5')]=_0x5b87c1||undefined;this['idContact']=_0x1eed45['id'];this[_0xe9f0('0x6')]=_0x50313d[_0xe9f0('0x7')];this[_0xe9f0('0x8')]=_0x50313d[_0xe9f0('0x8')];this[_0xe9f0('0x9')]=_0xe9f0('0x6');this[_0xe9f0('0xa')]=![];this[_0xe9f0('0xb')]=_[_0xe9f0('0x3')](_0x1eed45['Agent'])?undefined:_0x1eed45[_0xe9f0('0xc')][_0xe9f0('0x7')];this[_0xe9f0('0xd')]=this['membername']?util[_0xe9f0('0xe')]('SIP/%s',this[_0xe9f0('0xb')]):_0x3a17b3||undefined;this[_0xe9f0('0xf')]=checkNameSurname(_0x1eed45[_0xe9f0('0x10')][_0xe9f0('0x11')],_0x1eed45['Contact'][_0xe9f0('0x12')],_0x1eed45['Contact'][_0xe9f0('0x13')]);this[_0xe9f0('0x14')]=_0x1eed45[_0xe9f0('0x14')]||![];this['calleridnum']=_0x1eed45[_0xe9f0('0x11')];this[_0xe9f0('0x15')]=_0x1eed45[_0xe9f0('0x15')];this['countbusyretry']=_0x1eed45[_0xe9f0('0x16')]||0x0;this[_0xe9f0('0x17')]=_0x1eed45[_0xe9f0('0x17')]||0x0;this[_0xe9f0('0x18')]=_0x1eed45[_0xe9f0('0x18')]||0x0;this[_0xe9f0('0x19')]=(_0x1eed45[_0xe9f0('0x16')]||0x0)+(_0x1eed45['countcongestionretry']||0x0)+(_0x1eed45[_0xe9f0('0x18')]||0x0)+(_0x1eed45[_0xe9f0('0x1a')]||0x0)+(_0x1eed45[_0xe9f0('0x1b')]||0x0)+(_0x1eed45['countabandonedretry']||0x0)+(_0x1eed45[_0xe9f0('0x1c')]||0x0)+(_0x1eed45[_0xe9f0('0x1d')]||0x0);this[_0xe9f0('0x1a')]=_0x1eed45[_0xe9f0('0x1a')]||0x0;this['countdropretry']=_0x1eed45[_0xe9f0('0x1b')]||0x0;this[_0xe9f0('0x1e')]=_0x1eed45['countabandonedretry']||0x0;this['countmachineretry']=_0x1eed45['countmachineretry']||0x0;this[_0xe9f0('0x1d')]=_0x1eed45[_0xe9f0('0x1d')]||0x0;this[_0xe9f0('0x1f')]=_0x1eed45[_0xe9f0('0x1f')];this[_0xe9f0('0x20')]=_0x1eed45['callbackuniqueid'];this[_0xe9f0('0x21')]=_0x1eed45[_0xe9f0('0x21')];this[_0xe9f0('0x22')]=_0x1eed45[_0xe9f0('0x22')];this[_0xe9f0('0x23')]=_0x1eed45[_0xe9f0('0x23')];this[_0xe9f0('0x24')]=_0x1eed45[_0xe9f0('0x24')];this[_0xe9f0('0x25')]=_[_0xe9f0('0x3')](_0x1eed45['Agent'])?_0x1eed45[_0xe9f0('0x25')]:_0x1eed45[_0xe9f0('0xc')]['id'];this[_0xe9f0('0x26')]=_0x1eed45[_0xe9f0('0x26')];this['originatecalleridnum']='';this[_0xe9f0('0x27')]='';}Action[_0xe9f0('0x28')][_0xe9f0('0x29')]=function(){return util[_0xe9f0('0xe')](_0xe9f0('0x2a'),this['calleridname'],this[_0xe9f0('0x2b')]);};module[_0xe9f0('0x2c')]=Action; \ No newline at end of file +var _0x3423=['Agent','membername','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','prototype','getCaller','format','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3342('0x0'));function checkNameSurname(_0x16bdb3,_0x3477de,_0x3b763d){var _0x21bdc2='';if(!_[_0x3342('0x1')](_0x3477de)&&_0x3342('0x2')===typeof _0x3477de){_0x21bdc2+=_0x3477de;}if(!_[_0x3342('0x1')](_0x3b763d)&&_0x3342('0x2')===typeof _0x3b763d){_0x21bdc2+='\x20'+_0x3b763d;}if(_0x21bdc2!==''){return _0x21bdc2;}return _0x16bdb3;}function Action(_0x19206f,_0x467453,_0x2ccbe0,_0x29c40c,_0x420d4b){this[_0x3342('0x3')]=_0x2ccbe0||undefined;this[_0x3342('0x4')]=_0x19206f['id'];this[_0x3342('0x5')]=_0x467453[_0x3342('0x6')];this[_0x3342('0x7')]=_0x467453['type'];this['campaigntype']=_0x3342('0x5');this['dialAnswer']=![];this['membername']=_['isNil'](_0x19206f['Agent'])?undefined:_0x19206f[_0x3342('0x8')][_0x3342('0x6')];this['channelAgent']=this[_0x3342('0x9')]?util['format'](_0x3342('0xa'),this[_0x3342('0x9')]):_0x29c40c||undefined;this['calleridname']=checkNameSurname(_0x19206f[_0x3342('0xb')][_0x3342('0xc')],_0x19206f[_0x3342('0xb')][_0x3342('0xd')],_0x19206f[_0x3342('0xb')][_0x3342('0xe')]);this[_0x3342('0xf')]=_0x19206f['active']||![];this[_0x3342('0x10')]=_0x19206f[_0x3342('0xc')];this['scheduledat']=_0x19206f[_0x3342('0x11')];this[_0x3342('0x12')]=_0x19206f['countbusyretry']||0x0;this['countcongestionretry']=_0x19206f[_0x3342('0x13')]||0x0;this[_0x3342('0x14')]=_0x19206f[_0x3342('0x14')]||0x0;this[_0x3342('0x15')]=(_0x19206f[_0x3342('0x12')]||0x0)+(_0x19206f[_0x3342('0x13')]||0x0)+(_0x19206f[_0x3342('0x14')]||0x0)+(_0x19206f[_0x3342('0x16')]||0x0)+(_0x19206f[_0x3342('0x17')]||0x0)+(_0x19206f['countabandonedretry']||0x0)+(_0x19206f[_0x3342('0x18')]||0x0)+(_0x19206f[_0x3342('0x19')]||0x0);this[_0x3342('0x16')]=_0x19206f['countnosuchnumberretry']||0x0;this[_0x3342('0x17')]=_0x19206f[_0x3342('0x17')]||0x0;this['countabandonedretry']=_0x19206f[_0x3342('0x1a')]||0x0;this[_0x3342('0x18')]=_0x19206f['countmachineretry']||0x0;this[_0x3342('0x19')]=_0x19206f['countagentrejectretry']||0x0;this[_0x3342('0x1b')]=_0x19206f[_0x3342('0x1b')];this[_0x3342('0x1c')]=_0x19206f[_0x3342('0x1c')];this[_0x3342('0x1d')]=_0x19206f[_0x3342('0x1d')];this[_0x3342('0x1e')]=_0x19206f[_0x3342('0x1e')];this['ContactId']=_0x19206f[_0x3342('0x1f')];this['ListId']=_0x19206f['ListId'];this[_0x3342('0x20')]=_['isNil'](_0x19206f['Agent'])?_0x19206f[_0x3342('0x20')]:_0x19206f['Agent']['id'];this[_0x3342('0x21')]=_0x19206f['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x3342('0x22')][_0x3342('0x23')]=function(){return util[_0x3342('0x24')]('\x22%s\x22\x20<%s>',this[_0x3342('0x25')],this[_0x3342('0x26')]);};module[_0x3342('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8a9e23b..ec7ba4e 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3b9df7,_0x16ceb3){var _0x436284=function(_0x462356){while(--_0x462356){_0x3b9df7['push'](_0x3b9df7['shift']());}};_0x436284(++_0x16ceb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x27a871,_0x4ab414){var _0x5eb525=function(_0x3ead2d){while(--_0x3ead2d){_0x27a871['push'](_0x27a871['shift']());}};_0x5eb525(++_0x4ab414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c226033..437f199 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 _0xdb5f=['getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb5f,0x16a));var _0xfdb5=function(_0x1adf7b,_0x3309c7){_0x1adf7b=_0x1adf7b-0x0;var _0x1dc12b=_0xdb5f[_0x1adf7b];return _0x1dc12b;};'use strict';var util=require(_0xfdb5('0x0'));var BPromise=require('bluebird');var logger=require(_0xfdb5('0x1'))(_0xfdb5('0x2'));var cmHopper=require(_0xfdb5('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xfdb5('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2567b0){return function(_0x11ad44){logger[_0xfdb5('0x5')](_0x2567b0,util[_0xfdb5('0x6')](_0x11ad44,{'showHidden':![],'depth':null}));};}function create(_0x18ebf6){return cmHopperHistory['createHistory'](_0x18ebf6)[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0x8')));}function createAgent(_0x2e4aae){return BPromise[_0xfdb5('0x9')]()[_0xfdb5('0xa')](agentReportPreview[_0xfdb5('0xb')](_0x2e4aae))[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0x8')));}function moveContact(_0x8d8d4a){return cmHopper[_0xfdb5('0xc')](_0x8d8d4a,!![])[_0xfdb5('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xfdb5('0xd')]=function(_0x407da1){return cmHopperBlack[_0xfdb5('0xd')](_0x407da1)['catch'](loggerCatch(_0xfdb5('0xe')));};exports['getContactPreview']=function(_0x58bc5f){return BPromise[_0xfdb5('0x9')]()['then'](cmHopper['getContactPreview'](_0x58bc5f))[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0xf')));};exports[_0xfdb5('0xb')]=function(_0x2f79c3,_0xec551d){create(_0x2f79c3)['catch'](loggerCatch(_0xec551d));moveContact(_0x2f79c3)[_0xfdb5('0x7')](loggerCatch(_0xec551d));};exports['createAgentHistory']=function(_0x526c62,_0x1fdf7e){createAgent(_0x526c62)['catch'](loggerCatch(_0x1fdf7e));};exports[_0xfdb5('0x10')]=function(_0x4ea5cc,_0xadb5c9){create(_0x4ea5cc)[_0xfdb5('0x7')](loggerCatch(_0xadb5c9));};exports['createCustomerFinal']=function(_0x16429d,_0x1d7373){moveContact(_0x16429d)[_0xfdb5('0x7')](loggerCatch(_0x1d7373));};exports[_0xfdb5('0x11')]=function(_0x1acd01,_0x5e3332,_0x51d112){if(_0x5e3332){_0x1acd01['UserId']=null;}if(_0x51d112){_0x1acd01[_0xfdb5('0x12')]=![];}return cmHopper[_0xfdb5('0x11')](_0x1acd01)[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0x13')));};exports[_0xfdb5('0x14')]=function(_0x466600){return cmHopper[_0xfdb5('0x14')](_0x466600)[_0xfdb5('0x7')](loggerCatch('[countReScheduled]\x20'));};exports[_0xfdb5('0x15')]=function(_0x46da85){return cmHopper[_0xfdb5('0x15')]({'UserId':null},_0x46da85,0x1)[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0x16')));};exports[_0xfdb5('0x17')]=function(_0x45d2af){return cmHopper[_0xfdb5('0x15')]({'active':![]},_0x45d2af,0x1)[_0xfdb5('0x7')](loggerCatch(_0xfdb5('0x18')));};exports['crateCustomerReportQueue']=function(_0x331fcb){var _0x38ce88={};_0x38ce88[_0xfdb5('0x19')]=_0x331fcb['type'];_0x38ce88[_0xfdb5('0x1a')]=_0x331fcb[_0xfdb5('0x1a')];_0x38ce88[_0xfdb5('0x1b')]=_0x331fcb[_0xfdb5('0x1b')];_0x38ce88[_0xfdb5('0x1c')]=_0x331fcb[_0xfdb5('0x1c')];_0x38ce88[_0xfdb5('0x1d')]=_0x331fcb[_0xfdb5('0x1d')];_0x38ce88[_0xfdb5('0x1e')]=_0x331fcb[_0xfdb5('0x1f')];_0x38ce88['queuecallerleaveAt']=_0x331fcb[_0xfdb5('0x1f')];_0x38ce88[_0xfdb5('0x20')]=0x1;_0x38ce88[_0xfdb5('0x21')]=_0x331fcb[_0xfdb5('0x22')];_0x38ce88['connectedlinename']=_0x331fcb['membername'];_0x38ce88[_0xfdb5('0x23')]=_0xfdb5('0x24');_0x38ce88['exten']='xcally-motion-preview';_0x38ce88[_0xfdb5('0x25')]=0x0;_0x38ce88[_0xfdb5('0x26')]=0x1;_0x38ce88[_0xfdb5('0x27')]=_0x331fcb[_0xfdb5('0x28')];_0x38ce88['queuecallerexitreason']=_0xfdb5('0x29');return BPromise[_0xfdb5('0x9')]()[_0xfdb5('0xa')](voiceQueueReport[_0xfdb5('0x2a')](_0x38ce88))[_0xfdb5('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xfdb5('0x2b')]=function(_0x2d48d8,_0x57bd63){return BPromise[_0xfdb5('0x9')]()[_0xfdb5('0xa')](cmHopper['getContactRecallMe'](_0x2d48d8,_0x57bd63))[_0xfdb5('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xfdb5('0x2c')]=function(_0x5e3883){return cmHopper[_0xfdb5('0x11')](_0x5e3883,!![],!![])[_0xfdb5('0x7')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x1c1f=['../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','[createHistory]\x20','resolve','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger'];(function(_0x2dcd51,_0x366aef){var _0x1c8e93=function(_0x145938){while(--_0x145938){_0x2dcd51['push'](_0x2dcd51['shift']());}};_0x1c8e93(++_0x366aef);}(_0x1c1f,0x10b));var _0xf1c1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x1c1f[_0x5608a3];return _0x1ed50a;};'use strict';var util=require(_0xf1c1('0x0'));var BPromise=require(_0xf1c1('0x1'));var logger=require(_0xf1c1('0x2'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf1c1('0x3'));var cmHopperBlack=require(_0xf1c1('0x4'));var agentReportPreview=require(_0xf1c1('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1152cd){return function(_0xe35ae){logger[_0xf1c1('0x6')](_0x1152cd,util[_0xf1c1('0x7')](_0xe35ae,{'showHidden':![],'depth':null}));};}function create(_0x3850c8){return cmHopperHistory[_0xf1c1('0x8')](_0x3850c8)['catch'](loggerCatch(_0xf1c1('0x9')));}function createAgent(_0x476ff6){return BPromise[_0xf1c1('0xa')]()['then'](agentReportPreview['createHistory'](_0x476ff6))['catch'](loggerCatch(_0xf1c1('0x9')));}function moveContact(_0x2045da){return cmHopper[_0xf1c1('0xb')](_0x2045da,!![])[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0xd')));}exports[_0xf1c1('0xe')]=function(_0x1ed099){return cmHopperBlack[_0xf1c1('0xe')](_0x1ed099)[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0xf')));};exports[_0xf1c1('0x10')]=function(_0xe5370e){return BPromise[_0xf1c1('0xa')]()[_0xf1c1('0x11')](cmHopper[_0xf1c1('0x10')](_0xe5370e))[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0x12')));};exports[_0xf1c1('0x8')]=function(_0x10a589,_0x1a47a3){create(_0x10a589)['catch'](loggerCatch(_0x1a47a3));moveContact(_0x10a589)[_0xf1c1('0xc')](loggerCatch(_0x1a47a3));};exports[_0xf1c1('0x13')]=function(_0x2fefe4,_0xdb6bf1){createAgent(_0x2fefe4)[_0xf1c1('0xc')](loggerCatch(_0xdb6bf1));};exports[_0xf1c1('0x14')]=function(_0x27f0b9,_0x3c921a){create(_0x27f0b9)[_0xf1c1('0xc')](loggerCatch(_0x3c921a));};exports[_0xf1c1('0x15')]=function(_0x368d3e,_0x3e58af){moveContact(_0x368d3e)['catch'](loggerCatch(_0x3e58af));};exports[_0xf1c1('0x16')]=function(_0x35fff9,_0x5f1dbf,_0x59a565){if(_0x5f1dbf){_0x35fff9[_0xf1c1('0x17')]=null;}if(_0x59a565){_0x35fff9['active']=![];}return cmHopper[_0xf1c1('0x16')](_0x35fff9)['catch'](loggerCatch(_0xf1c1('0x18')));};exports['countReScheduled']=function(_0x1815d3){return cmHopper[_0xf1c1('0x19')](_0x1815d3)[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0x1a')));};exports['unlockContact']=function(_0x337aea){return cmHopper['unlockContact']({'UserId':null},_0x337aea,0x1)[_0xf1c1('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x58a589){return cmHopper[_0xf1c1('0x1b')]({'active':![]},_0x58a589,0x1)['catch'](loggerCatch(_0xf1c1('0x1c')));};exports[_0xf1c1('0x1d')]=function(_0x572ed1){var _0x1e9cf2={};_0x1e9cf2[_0xf1c1('0x1e')]=_0x572ed1[_0xf1c1('0x1e')];_0x1e9cf2['uniqueid']=_0x572ed1['uniqueid'];_0x1e9cf2[_0xf1c1('0x1f')]=_0x572ed1[_0xf1c1('0x1f')];_0x1e9cf2['calleridname']=_0x572ed1[_0xf1c1('0x20')];_0x1e9cf2['queue']=_0x572ed1[_0xf1c1('0x21')];_0x1e9cf2['queuecallerjoinAt']=_0x572ed1[_0xf1c1('0x22')];_0x1e9cf2[_0xf1c1('0x23')]=_0x572ed1[_0xf1c1('0x22')];_0x1e9cf2[_0xf1c1('0x24')]=0x1;_0x1e9cf2[_0xf1c1('0x25')]=_0x572ed1[_0xf1c1('0x26')];_0x1e9cf2['connectedlinename']=_0x572ed1[_0xf1c1('0x27')];_0x1e9cf2[_0xf1c1('0x28')]=_0xf1c1('0x29');_0x1e9cf2[_0xf1c1('0x2a')]=_0xf1c1('0x2b');_0x1e9cf2[_0xf1c1('0x2c')]=0x0;_0x1e9cf2[_0xf1c1('0x2d')]=0x1;_0x1e9cf2[_0xf1c1('0x2e')]=_0x572ed1[_0xf1c1('0x27')];_0x1e9cf2[_0xf1c1('0x2f')]=_0xf1c1('0x30');return BPromise['resolve']()[_0xf1c1('0x11')](voiceQueueReport[_0xf1c1('0x31')](_0x1e9cf2))[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0x32')));};exports[_0xf1c1('0x33')]=function(_0x16bf33,_0x4b4d4f){return BPromise[_0xf1c1('0xa')]()[_0xf1c1('0x11')](cmHopper[_0xf1c1('0x33')](_0x16bf33,_0x4b4d4f))[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0x34')));};exports['rescheduleContactInQueue']=function(_0x27e573){return cmHopper['rescheduleContact'](_0x27e573,!![],!![])[_0xf1c1('0xc')](loggerCatch(_0xf1c1('0x35')));}; \ 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 f6fa925..0b08f67 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 _0x82d0=['XCALLY_IP_AGI','127.0.0.1','error','logger','inspect','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','getSeconds','logLookAgent','membername','logCustomer','endtime','ringtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','push','getDiff','milliseconds','seconds','CampaignId','filterKey','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','preview','env'];(function(_0x3263fd,_0x2de078){var _0x287b4a=function(_0x2e68bd){while(--_0x2e68bd){_0x3263fd['push'](_0x3263fd['shift']());}};_0x287b4a(++_0x2de078);}(_0x82d0,0x1a3));var _0x082d=function(_0x5eaefe,_0xc72159){_0x5eaefe=_0x5eaefe-0x0;var _0xe64929=_0x82d0[_0x5eaefe];return _0xe64929;};'use strict';var util=require(_0x082d('0x0'));var _=require('lodash');var moment=require(_0x082d('0x1'));var logger=require('../../../../config/logger')(_0x082d('0x2'));var ipAgi=process[_0x082d('0x3')][_0x082d('0x4')]||_0x082d('0x5');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x190740){return function(_0x1f63d2){logger[_0x082d('0x6')](_0x190740,util['inspect'](_0x1f63d2,{'showHidden':![],'depth':null}));};};exports[_0x082d('0x7')]=function(_0x41362e,_0x29756e){logger['info'](_0x41362e,util[_0x082d('0x8')](_0x29756e,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2ae786,_0x30dc50){logger[_0x082d('0x6')](_0x2ae786,util[_0x082d('0x8')](_0x30dc50,{'showHidden':![],'depth':null}));};exports[_0x082d('0x9')]=function(_0x1518fc){return function(_0x1c1a75){logger[_0x082d('0xa')](_0x1518fc,util[_0x082d('0x8')](_0x1c1a75,{'showHidden':![],'depth':null}));};};exports[_0x082d('0xb')]=function(_0x2f964f,_0x59095a,_0xe7d7c5){return{'message':_0x2f964f,'unlock':_0x59095a,'active':_0xe7d7c5};};exports[_0x082d('0xc')]=function(_0x2f0009,_0x5052aa,_0x1f8fe5){if(!_[_0x082d('0xd')](_0x1f8fe5)&&_0x082d('0xe')===typeof _0x1f8fe5&&!_[_0x082d('0xf')](_0x1f8fe5)){if(!_[_0x082d('0xd')](_0x5052aa)&&_0x082d('0xe')===typeof _0x5052aa&&!_['isEmpty'](_0x5052aa)){return util['format'](_0x082d('0x10'),_0x5052aa,_0x1f8fe5);}return util[_0x082d('0x11')]('\x22%s\x22\x20<%s>',_0x1f8fe5,_0x1f8fe5);}if(!_[_0x082d('0xd')](_0x2f0009)&&_0x082d('0xe')===typeof _0x2f0009&&!_[_0x082d('0xf')](_0x2f0009)){return _0x2f0009;}return _0x082d('0x12');};exports[_0x082d('0x13')]=function(_0x2e80a9){if(_[_0x082d('0x14')](_0x2e80a9)){return![];}return _0x2e80a9;};exports['addVariables']=function(_0x229dff,_0x2564a1,_0x1f780c,_0x4524f1,_0x3508ce,_0x3ff85c){var _0x38ce39={'XMD-QUEUE':_0x2564a1[_0x082d('0x15')]?_0x2564a1[_0x082d('0x15')][_0x082d('0x16')]:'','XMD-CALLERID':_0x4524f1,'XMD-CALLERID-PREVIEW':_0x3ff85c?util[_0x082d('0x11')](_0x082d('0x10'),_0x3ff85c[_0x082d('0x17')],_0x3ff85c[_0x082d('0x18')]):_0x4524f1,'XMD-DIALID':_0x3508ce,'XMD-CONTACTID':_0x2564a1[_0x082d('0x19')],'XMD-CDRTYPE':_0x082d('0x1a'),'CALLERID(all)':_0x4524f1,'XMD-VOICEQUEUEID':_0x2564a1[_0x082d('0x1b')],'XMD-DIALCHANNEL':_0x1f780c,'XMD-DIALTIMEOUT':_0x229dff[_0x082d('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x082d('0x11')]('\x22rtTxX%s%s\x22',_0x229dff[_0x082d('0x1d')]?'g':'',_[_0x082d('0xf')](_0x229dff[_0x082d('0x1e')])?'':_0x082d('0x1f')),'XMD-DIALURL':_0x229dff['dialPreviewUrl']||'','XMD-AGI':_0x229dff['dialQueueProject']?util[_0x082d('0x11')](_0x082d('0x20'),ipAgi,_0x229dff[_0x082d('0x21')]):_0x082d('0x22'),'XMD-AGIAFTER':_0x229dff[_0x082d('0x1d')]?util[_0x082d('0x11')](_0x082d('0x20'),ipAgi,_0x229dff['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3ff85c?_0x3ff85c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3ff85c?_0x3ff85c[_0x082d('0x23')]:'','XMD-DESTINATION':_0x082d('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x229dff[_0x082d('0x1e')])){_0x38ce39[util[_0x082d('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x229dff['monitor_format'];_0x38ce39[util[_0x082d('0x11')]('%s',_0x082d('0x25'))]=_0x3508ce;}return _0x38ce39;};exports['toLowerVariables']=function(_0x516963){var _0x50dfc6={};for(var _0x5d1a72 in _0x516963){if(_0x516963[_0x082d('0x26')](_0x5d1a72)){_0x50dfc6[util[_0x082d('0x11')]('%s',_['toLower'](_0x5d1a72))]=_0x516963[_0x5d1a72];}}return{'variables':_0x50dfc6};};exports[_0x082d('0x27')]=function(_0x13bf11,_0x4744b5){if(!_[_0x082d('0x14')](_0x13bf11)){if(_0x13bf11['hasOwnProperty'](_0x082d('0x28'))){if(_0x13bf11[_0x082d('0x28')]>0x0){_0x13bf11[_0x082d('0x28')]-=0x1;}else{logger[_0x082d('0x6')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4744b5);}}}else{logger[_0x082d('0x6')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4744b5);}};exports[_0x082d('0x29')]=function(_0x4867b9){var _0x29ec06=moment()[_0x082d('0x11')](_0x082d('0x2a'));_0x4867b9[_0x082d('0x2b')]=0xd;_0x4867b9[_0x082d('0x2c')]=_0x082d('0x2d');_0x4867b9[_0x082d('0x2e')]=_0x29ec06;_0x4867b9[_0x082d('0x2f')]=_0x29ec06;_0x4867b9['endtime']=_0x29ec06;};exports[_0x082d('0x30')]=function(_0x58c52d,_0x28b1b1,_0x355fa9){var _0x594ccb=moment()['format'](_0x082d('0x2a'));_0x58c52d[_0x082d('0x2b')]=_0x28b1b1;_0x58c52d[_0x082d('0x2c')]=_0x355fa9;_0x58c52d[_0x082d('0x2f')]=_0x594ccb;_0x58c52d['ringtime']=utils[_0x082d('0x31')](_0x58c52d[_0x082d('0x2f')],_0x58c52d[_0x082d('0x2e')]);};exports[_0x082d('0x32')]=function(_0x4f3680,_0x36c926,_0x1918ac){_0x4f3680[_0x082d('0x33')]=_0x36c926;_0x4f3680['UserId']=_0x1918ac;};exports[_0x082d('0x34')]=function(_0x36500f,_0x5a19e4,_0x1d9ea2){var _0x4311ed=moment()[_0x082d('0x11')](_0x082d('0x2a'));_0x36500f['state']=_0x5a19e4;_0x36500f[_0x082d('0x2c')]=_0x1d9ea2;_0x36500f['responsetime']=_0x36500f[_0x082d('0x2f')]?_0x36500f['responsetime']:_0x4311ed;_0x36500f[_0x082d('0x35')]=_0x36500f[_0x082d('0x35')]?_0x36500f[_0x082d('0x35')]:_0x4311ed;_0x36500f[_0x082d('0x36')]=utils['getSeconds'](_0x36500f[_0x082d('0x2f')]||0x0,_0x36500f[_0x082d('0x2e')]||0x0);_0x36500f[_0x082d('0x37')]=_0x36500f[_0x082d('0x38')]?utils['getSeconds'](_0x36500f[_0x082d('0x35')],_0x36500f['answertime']):0x0;};exports['isFailure']=function(_0x5e5437){return _0x5e5437===_0x082d('0x39');};exports[_0x082d('0x3a')]=function(_0x2750c4,_0x5a8052,_0x4559c3,_0x48f35f,_0xc02b9e){var _0x4b1664=_0x48f35f?_0x082d('0x3b'):_0x2750c4['calleridname'];_0x4b1664=_0xc02b9e?_0x082d('0x3c'):_0x4b1664;return{'actionid':_0x2750c4['uniqueid'],'action':_0x082d('0x3d'),'channel':_0x2750c4[_0x082d('0x3e')],'callerid':util[_0x082d('0x11')](_0x082d('0x10'),_0x4b1664,_0x2750c4[_0x082d('0x18')]),'Exten':'xcally-motion-preview','Context':_0x082d('0x3f'),'Priority':'1','variable':_0x4559c3,'timeout':(_0x5a8052['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2750c4[_0x082d('0x40')]};};exports[_0x082d('0x41')]=function(_0x3ff835){return _0x3ff835[_0x082d('0x42')]+_0x3ff835[_0x082d('0x43')]+_0x3ff835[_0x082d('0x44')]+_0x3ff835[_0x082d('0x45')]+_0x3ff835[_0x082d('0x46')];};exports[_0x082d('0x47')]=function(_0x1e83f2){var _0x555763=_[_0x082d('0x48')](_0x1e83f2);_0x555763[_0x082d('0x2b')]=0xf;_0x555763['statedesc']=_0x082d('0x49');return _0x555763;};exports[_0x082d('0x4a')]=function(_0x1781dd,_0x1b8532,_0x382f73){var _0x202bc1={};_0x202bc1[_0x1b8532]=_0x1781dd[_0x1b8532];_0x202bc1[_0x082d('0x4b')]=![];_0x202bc1[_0x082d('0x4c')]=moment()[_0x082d('0x4d')](_0x382f73,'minutes')[_0x082d('0x11')](_0x082d('0x2a'));_0x202bc1[_0x082d('0x19')]=_0x1781dd[_0x082d('0x19')];_0x202bc1['ListId']=_0x1781dd[_0x082d('0x4e')];_0x202bc1[_0x082d('0x1b')]=_0x1781dd[_0x082d('0x1b')]||undefined;return _0x202bc1;};exports[_0x082d('0x4f')]=function(_0x13035d,_0x4ef0d9){if(!_[_0x082d('0x14')](_0x13035d)){if(_0x13035d[_0x082d('0x50')]>0x0){_0x13035d[_0x082d('0x50')]-=0x1;}else{logger[_0x082d('0x6')](_0x4ef0d9,_0x082d('0x51'));}}else{logger['error'](_0x4ef0d9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x082d('0x52')]=function(_0x49892e){if(_0x49892e<=0x0){return!![];}return![];};function buildObj(_0xdcbc45,_0x36ab69,_0x71b264){_0xdcbc45[_0x082d('0x53')]=_0x36ab69;_0xdcbc45[_0x082d('0x16')]=_0xdcbc45[_0x082d('0x54')];_0xdcbc45[_0x082d('0x55')]=_0xdcbc45[_0x082d('0x3e')];_0xdcbc45['motionChannel']=_0x082d('0x56');if(_0x71b264){_0xdcbc45['mandatoryDisposition']=_0x71b264[_0x082d('0x57')];}return _0xdcbc45;}exports[_0x082d('0x58')]=buildObj;exports[_0x082d('0x59')]=function(_0x2f0220){var _0x1f0cf4=[];for(var _0x3bfd50 in _0x2f0220){if(_0x2f0220[_0x082d('0x26')](_0x3bfd50)){if(!_['isNil'](_0x2f0220[_0x3bfd50])&&_0x2f0220[_0x3bfd50][_0x082d('0x2b')]===_0x082d('0x5a')&&_0x2f0220[_0x3bfd50][_0x082d('0x5b')]==='reachable'){_0x1f0cf4[_0x082d('0x5c')](_0x2f0220[_0x3bfd50]['id']);}}}return _0x1f0cf4;};exports[_0x082d('0x5d')]=function(_0x4c080e){var _0x5af375=moment()['milliseconds'](0x0);var _0x33cf81=moment(_0x4c080e)[_0x082d('0x5e')](0x0);return _0x5af375['diff'](_0x33cf81,_0x082d('0x5f'));};exports['createBody']=function(_0x447ade){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x447ade['ContactId'],'ListId':_0x447ade[_0x082d('0x4e')],'VoiceQueueId':_0x447ade['VoiceQueueId']||undefined,'CampaignId':_0x447ade[_0x082d('0x60')]||undefined};};exports[_0x082d('0x61')]=function(_0x27b944){if(_0x27b944===_0x082d('0x40')||_0x27b944===_0x082d('0x62')||_0x27b944===_0x082d('0x54')||_0x27b944===_0x082d('0x63')||_0x27b944==='campaigntype'||_0x27b944===_0x082d('0x64')||_0x27b944===_0x082d('0x33')||_0x27b944===_0x082d('0x3e')||_0x27b944===_0x082d('0x17')||_0x27b944===_0x082d('0x4b')||_0x27b944==='calleridnum'||_0x27b944==='scheduledat'||_0x27b944===_0x082d('0x42')||_0x27b944==='countcongestionretry'||_0x27b944===_0x082d('0x44')||_0x27b944==='countglobal'||_0x27b944===_0x082d('0x65')||_0x27b944===_0x082d('0x66')||_0x27b944===_0x082d('0x67')||_0x27b944===_0x082d('0x68')||_0x27b944==='ContactId'||_0x27b944===_0x082d('0x4e')||_0x27b944==='UserId'||_0x27b944===_0x082d('0x1b')||_0x27b944===_0x082d('0x69')||_0x27b944===_0x082d('0x6a')||_0x27b944===_0x082d('0x6b')||_0x27b944===_0x082d('0x6c')||_0x27b944===_0x082d('0x6d')||_0x27b944===_0x082d('0x6e')||_0x27b944===_0x082d('0x6f')||_0x27b944===_0x082d('0x70')||_0x27b944==='xmd-dialid'||_0x27b944===_0x082d('0x71')||_0x27b944===_0x082d('0x72')||_0x27b944===_0x082d('0x73')||_0x27b944===_0x082d('0x74')||_0x27b944===_0x082d('0x75')||_0x27b944===_0x082d('0x76')||_0x27b944===_0x082d('0x77')||_0x27b944===_0x082d('0x78')||_0x27b944===_0x082d('0x79')||_0x27b944===_0x082d('0x7a')||_0x27b944===_0x082d('0x7b')||_0x27b944===_0x082d('0x7c')||_0x27b944==='rtpaudioqosrtt'||_0x27b944==='rtpaudioqosrttbridged'||_0x27b944===_0x082d('0x77')||_0x27b944===_0x082d('0x78')||_0x27b944===_0x082d('0x79')||_0x27b944==='rtpaudioqosjitterbridged'||_0x27b944===_0x082d('0x7b')||_0x27b944===_0x082d('0x7c')||_0x27b944===_0x082d('0x7d')||_0x27b944===_0x082d('0x7e')||_0x27b944==='bridgepeer'||_0x27b944===_0x082d('0x7f')||_0x27b944==='state'||_0x27b944===_0x082d('0x2c')){return![];}return!![];};exports[_0x082d('0x80')]=function(_0x5127c1,_0x5001d1){var _0x567bdc,_0x351ea6,_0x13ba64;if(_0x5001d1<=0x0){_0x5001d1=0x1;}_0x567bdc=new RegExp(_0x082d('0x81')+_0x5001d1+'}$');_0x351ea6=Math[_0x082d('0x82')](0xa,_0x5001d1-0x1);_0x13ba64=Math['pow'](0xa,_0x5001d1)-0x1;return util['format']('%s',_[_0x082d('0x83')](_0x5127c1,_0x567bdc,_['random'](_0x351ea6,_0x13ba64)));};exports[_0x082d('0x84')]=function(_0xc96e76){var _0x451a15=_0xc96e76[_0x082d('0x85')](/"(.*?)"/);return _0x451a15?_0x451a15[0x1]:_0xc96e76;};exports[_0x082d('0x86')]=function(_0x1c9696){var _0x3c0935=_0x1c9696['match'](/<(.*?)>/);return _0x3c0935?_0x3c0935[0x1]:_0x1c9696;};function buildNoAnswerEventPayload(_0x5c7984,_0x39718c){var _0x555928=buildObj(_0x5c7984,_0x082d('0x87'));if(!_['isEmpty'](_0x39718c[_0x082d('0x88')])){Object[_0x082d('0x89')](_0x39718c[_0x082d('0x88')])[_0x082d('0x8a')](function(_0x161a1c){_0x555928[_0x161a1c[_0x082d('0x8b')]()]=_0x39718c[_0x082d('0x88')][_0x161a1c];});}return _0x555928;}exports[_0x082d('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xe4bd=['preview','127.0.0.1','error','inspect','info','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','channelAgent','motionChannel','voice','buildObj','not_inuse','status','reachable','push','getDiff','milliseconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','util','lodash','../../../../config/logger'];(function(_0x354216,_0x187a9f){var _0x2bbac1=function(_0x47a62e){while(--_0x47a62e){_0x354216['push'](_0x354216['shift']());}};_0x2bbac1(++_0x187a9f);}(_0xe4bd,0x89));var _0xde4b=function(_0x57e1fb,_0x80bc3d){_0x57e1fb=_0x57e1fb-0x0;var _0x320c25=_0xe4bd[_0x57e1fb];return _0x320c25;};'use strict';var util=require(_0xde4b('0x0'));var _=require(_0xde4b('0x1'));var moment=require('moment');var logger=require(_0xde4b('0x2'))(_0xde4b('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xde4b('0x4');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x1cfb8f){return function(_0x5111bc){logger[_0xde4b('0x5')](_0x1cfb8f,util[_0xde4b('0x6')](_0x5111bc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x39ac6e,_0x4043d4){logger[_0xde4b('0x7')](_0x39ac6e,util['inspect'](_0x4043d4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x55d5e9,_0xeb89ae){logger['error'](_0x55d5e9,util['inspect'](_0xeb89ae,{'showHidden':![],'depth':null}));};exports[_0xde4b('0x8')]=function(_0x510036){return function(_0x295b47){logger[_0xde4b('0x7')](_0x510036,util[_0xde4b('0x6')](_0x295b47,{'showHidden':![],'depth':null}));};};exports[_0xde4b('0x9')]=function(_0x4f62ca,_0x83b330,_0x390a80){return{'message':_0x4f62ca,'unlock':_0x83b330,'active':_0x390a80};};exports[_0xde4b('0xa')]=function(_0x645911,_0x54939c,_0x349ea2){if(!_['isUndefined'](_0x349ea2)&&_0xde4b('0xb')===typeof _0x349ea2&&!_[_0xde4b('0xc')](_0x349ea2)){if(!_[_0xde4b('0xd')](_0x54939c)&&'string'===typeof _0x54939c&&!_[_0xde4b('0xc')](_0x54939c)){return util[_0xde4b('0xe')](_0xde4b('0xf'),_0x54939c,_0x349ea2);}return util[_0xde4b('0xe')](_0xde4b('0xf'),_0x349ea2,_0x349ea2);}if(!_['isUndefined'](_0x645911)&&_0xde4b('0xb')===typeof _0x645911&&!_['isEmpty'](_0x645911)){return _0x645911;}return _0xde4b('0x10');};exports[_0xde4b('0x11')]=function(_0x26921e){if(_[_0xde4b('0x12')](_0x26921e)){return![];}return _0x26921e;};exports[_0xde4b('0x13')]=function(_0x1da8f7,_0x18c1e5,_0x5604aa,_0x2da117,_0x125394,_0x56829c){var _0x42bd1c={'XMD-QUEUE':_0x18c1e5[_0xde4b('0x14')]?_0x18c1e5[_0xde4b('0x14')]['name']:'','XMD-CALLERID':_0x2da117,'XMD-CALLERID-PREVIEW':_0x56829c?util[_0xde4b('0xe')](_0xde4b('0xf'),_0x56829c[_0xde4b('0x15')],_0x56829c[_0xde4b('0x16')]):_0x2da117,'XMD-DIALID':_0x125394,'XMD-CONTACTID':_0x18c1e5[_0xde4b('0x17')],'XMD-CDRTYPE':_0xde4b('0x18'),'CALLERID(all)':_0x2da117,'XMD-VOICEQUEUEID':_0x18c1e5[_0xde4b('0x19')],'XMD-DIALCHANNEL':_0x5604aa,'XMD-DIALTIMEOUT':_0x1da8f7[_0xde4b('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xde4b('0xe')]('\x22rtTxX%s%s\x22',_0x1da8f7['dialQueueProject2']?'g':'',_[_0xde4b('0xc')](_0x1da8f7[_0xde4b('0x1b')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1da8f7[_0xde4b('0x1c')]||'','XMD-AGI':_0x1da8f7[_0xde4b('0x1d')]?util[_0xde4b('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1da8f7[_0xde4b('0x1d')]):_0xde4b('0x1e'),'XMD-AGIAFTER':_0x1da8f7[_0xde4b('0x1f')]?util['format'](_0xde4b('0x20'),ipAgi,_0x1da8f7[_0xde4b('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x56829c?_0x56829c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x56829c?_0x56829c[_0xde4b('0x21')]:'','XMD-DESTINATION':_0xde4b('0x22'),'SIPADDHEADER':_0xde4b('0x23')};if(!_[_0xde4b('0xc')](_0x1da8f7[_0xde4b('0x1b')])){_0x42bd1c[util[_0xde4b('0xe')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1da8f7[_0xde4b('0x1b')];_0x42bd1c[util[_0xde4b('0xe')]('%s',_0xde4b('0x24'))]=_0x125394;}return _0x42bd1c;};exports[_0xde4b('0x25')]=function(_0x1407f0){var _0x60adfd={};for(var _0x4d03dd in _0x1407f0){if(_0x1407f0[_0xde4b('0x26')](_0x4d03dd)){_0x60adfd[util[_0xde4b('0xe')]('%s',_['toLower'](_0x4d03dd))]=_0x1407f0[_0x4d03dd];}}return{'variables':_0x60adfd};};exports[_0xde4b('0x27')]=function(_0x2093de,_0x140dae){if(!_[_0xde4b('0x12')](_0x2093de)){if(_0x2093de[_0xde4b('0x26')](_0xde4b('0x28'))){if(_0x2093de[_0xde4b('0x28')]>0x0){_0x2093de[_0xde4b('0x28')]-=0x1;}else{logger[_0xde4b('0x5')](_0xde4b('0x29'),_0x140dae);}}}else{logger[_0xde4b('0x5')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x140dae);}};exports[_0xde4b('0x2a')]=function(_0x4c4927){var _0x118613=moment()[_0xde4b('0xe')](_0xde4b('0x2b'));_0x4c4927[_0xde4b('0x2c')]=0xd;_0x4c4927[_0xde4b('0x2d')]=_0xde4b('0x2e');_0x4c4927[_0xde4b('0x2f')]=_0x118613;_0x4c4927['responsetime']=_0x118613;_0x4c4927['endtime']=_0x118613;};exports[_0xde4b('0x30')]=function(_0x549311,_0x3c8c6b,_0x41d01b){var _0x26beb6=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x549311[_0xde4b('0x2c')]=_0x3c8c6b;_0x549311['statedesc']=_0x41d01b;_0x549311[_0xde4b('0x31')]=_0x26beb6;_0x549311[_0xde4b('0x32')]=utils[_0xde4b('0x33')](_0x549311[_0xde4b('0x31')],_0x549311[_0xde4b('0x2f')]);};exports[_0xde4b('0x34')]=function(_0x20c796,_0xd682f2,_0x5a8a42){_0x20c796[_0xde4b('0x35')]=_0xd682f2;_0x20c796[_0xde4b('0x36')]=_0x5a8a42;};exports[_0xde4b('0x37')]=function(_0x4bcab5,_0x1406bb,_0x163a4d){var _0x39edaf=moment()['format'](_0xde4b('0x2b'));_0x4bcab5[_0xde4b('0x2c')]=_0x1406bb;_0x4bcab5[_0xde4b('0x2d')]=_0x163a4d;_0x4bcab5['responsetime']=_0x4bcab5[_0xde4b('0x31')]?_0x4bcab5['responsetime']:_0x39edaf;_0x4bcab5[_0xde4b('0x38')]=_0x4bcab5['endtime']?_0x4bcab5[_0xde4b('0x38')]:_0x39edaf;_0x4bcab5['ringtime']=utils[_0xde4b('0x33')](_0x4bcab5[_0xde4b('0x31')]||0x0,_0x4bcab5[_0xde4b('0x2f')]||0x0);_0x4bcab5[_0xde4b('0x39')]=_0x4bcab5[_0xde4b('0x3a')]?utils[_0xde4b('0x33')](_0x4bcab5[_0xde4b('0x38')],_0x4bcab5['answertime']):0x0;};exports[_0xde4b('0x3b')]=function(_0x5d769f){return _0x5d769f===_0xde4b('0x3c');};exports['variablesAction']=function(_0x35f348,_0x2a9fda,_0x3fb83c,_0x273f01,_0x367dc3){var _0x26a1af=_0x273f01?_0xde4b('0x3d'):_0x35f348[_0xde4b('0x15')];_0x26a1af=_0x367dc3?_0xde4b('0x3e'):_0x26a1af;return{'actionid':_0x35f348[_0xde4b('0x3f')],'action':'originate','channel':_0x35f348['channelAgent'],'callerid':util[_0xde4b('0xe')](_0xde4b('0xf'),_0x26a1af,_0x35f348[_0xde4b('0x16')]),'Exten':_0xde4b('0x22'),'Context':'from-sip','Priority':'1','variable':_0x3fb83c,'timeout':(_0x2a9fda[_0xde4b('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35f348[_0xde4b('0x3f')]};};exports[_0xde4b('0x41')]=function(_0x4887ff){return _0x4887ff[_0xde4b('0x42')]+_0x4887ff[_0xde4b('0x43')]+_0x4887ff[_0xde4b('0x44')]+_0x4887ff[_0xde4b('0x45')]+_0x4887ff['countnosuchnumberretry'];};exports[_0xde4b('0x46')]=function(_0x5e211d){var _0x4ff6bf=_[_0xde4b('0x47')](_0x5e211d);_0x4ff6bf[_0xde4b('0x2c')]=0xf;_0x4ff6bf[_0xde4b('0x2d')]=_0xde4b('0x48');return _0x4ff6bf;};exports[_0xde4b('0x49')]=function(_0x129318,_0x47a440,_0x26bc38){var _0x5857d9={};_0x5857d9[_0x47a440]=_0x129318[_0x47a440];_0x5857d9[_0xde4b('0x4a')]=![];_0x5857d9[_0xde4b('0x4b')]=moment()[_0xde4b('0x4c')](_0x26bc38,_0xde4b('0x4d'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5857d9['ContactId']=_0x129318[_0xde4b('0x17')];_0x5857d9[_0xde4b('0x4e')]=_0x129318[_0xde4b('0x4e')];_0x5857d9[_0xde4b('0x19')]=_0x129318[_0xde4b('0x19')]||undefined;return _0x5857d9;};exports['decrementTalkink']=function(_0x297939,_0x3ed500){if(!_[_0xde4b('0x12')](_0x297939)){if(_0x297939[_0xde4b('0x4f')]>0x0){_0x297939[_0xde4b('0x4f')]-=0x1;}else{logger[_0xde4b('0x5')](_0x3ed500,_0xde4b('0x50'));}}else{logger[_0xde4b('0x5')](_0x3ed500,_0xde4b('0x51'));}};exports[_0xde4b('0x52')]=function(_0x3a5dfe){if(_0x3a5dfe<=0x0){return!![];}return![];};function buildObj(_0x26bfd2,_0x320a3f,_0x5f5694){_0x26bfd2[_0xde4b('0x53')]=_0x320a3f;_0x26bfd2[_0xde4b('0x54')]=_0x26bfd2[_0xde4b('0x55')];_0x26bfd2[_0xde4b('0x56')]=_0x26bfd2[_0xde4b('0x57')];_0x26bfd2[_0xde4b('0x58')]=_0xde4b('0x59');if(_0x5f5694){_0x26bfd2['mandatoryDisposition']=_0x5f5694['mandatoryDisposition'];}return _0x26bfd2;}exports[_0xde4b('0x5a')]=buildObj;exports['agentReadyId']=function(_0x515159){var _0x400f38=[];for(var _0x2bcf1d in _0x515159){if(_0x515159['hasOwnProperty'](_0x2bcf1d)){if(!_[_0xde4b('0x12')](_0x515159[_0x2bcf1d])&&_0x515159[_0x2bcf1d]['state']===_0xde4b('0x5b')&&_0x515159[_0x2bcf1d][_0xde4b('0x5c')]===_0xde4b('0x5d')){_0x400f38[_0xde4b('0x5e')](_0x515159[_0x2bcf1d]['id']);}}}return _0x400f38;};exports[_0xde4b('0x5f')]=function(_0xd49057){var _0x542407=moment()[_0xde4b('0x60')](0x0);var _0x5eba44=moment(_0xd49057)[_0xde4b('0x60')](0x0);return _0x542407['diff'](_0x5eba44,'seconds');};exports['createBody']=function(_0x3c1a6b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c1a6b[_0xde4b('0x17')],'ListId':_0x3c1a6b[_0xde4b('0x4e')],'VoiceQueueId':_0x3c1a6b[_0xde4b('0x19')]||undefined,'CampaignId':_0x3c1a6b[_0xde4b('0x61')]||undefined};};exports[_0xde4b('0x62')]=function(_0x4868b5){if(_0x4868b5===_0xde4b('0x3f')||_0x4868b5===_0xde4b('0x63')||_0x4868b5==='queue'||_0x4868b5===_0xde4b('0x64')||_0x4868b5===_0xde4b('0x65')||_0x4868b5===_0xde4b('0x66')||_0x4868b5===_0xde4b('0x35')||_0x4868b5===_0xde4b('0x57')||_0x4868b5===_0xde4b('0x15')||_0x4868b5==='active'||_0x4868b5==='calleridnum'||_0x4868b5===_0xde4b('0x4b')||_0x4868b5==='countbusyretry'||_0x4868b5==='countcongestionretry'||_0x4868b5===_0xde4b('0x44')||_0x4868b5===_0xde4b('0x67')||_0x4868b5===_0xde4b('0x68')||_0x4868b5==='callbackuniqueid'||_0x4868b5==='callbackat'||_0x4868b5===_0xde4b('0x69')||_0x4868b5===_0xde4b('0x17')||_0x4868b5===_0xde4b('0x4e')||_0x4868b5===_0xde4b('0x36')||_0x4868b5===_0xde4b('0x19')||_0x4868b5===_0xde4b('0x6a')||_0x4868b5===_0xde4b('0x6b')||_0x4868b5===_0xde4b('0x6c')||_0x4868b5===_0xde4b('0x6d')||_0x4868b5===_0xde4b('0x6e')||_0x4868b5===_0xde4b('0x6f')||_0x4868b5===_0xde4b('0x70')||_0x4868b5===_0xde4b('0x71')||_0x4868b5===_0xde4b('0x72')||_0x4868b5===_0xde4b('0x73')||_0x4868b5==='xmd-contactid'||_0x4868b5===_0xde4b('0x74')||_0x4868b5===_0xde4b('0x75')||_0x4868b5===_0xde4b('0x76')||_0x4868b5==='xmd-agi'||_0x4868b5===_0xde4b('0x77')||_0x4868b5==='rtpaudioqosbridged'||_0x4868b5==='rtpaudioqosjitter'||_0x4868b5===_0xde4b('0x78')||_0x4868b5===_0xde4b('0x79')||_0x4868b5===_0xde4b('0x7a')||_0x4868b5===_0xde4b('0x7b')||_0x4868b5==='rtpaudioqosrttbridged'||_0x4868b5===_0xde4b('0x77')||_0x4868b5==='rtpaudioqosbridged'||_0x4868b5==='rtpaudioqosjitter'||_0x4868b5===_0xde4b('0x78')||_0x4868b5===_0xde4b('0x79')||_0x4868b5===_0xde4b('0x7a')||_0x4868b5===_0xde4b('0x7b')||_0x4868b5===_0xde4b('0x7c')||_0x4868b5===_0xde4b('0x7d')||_0x4868b5===_0xde4b('0x7e')||_0x4868b5===_0xde4b('0x2c')||_0x4868b5===_0xde4b('0x2d')){return![];}return!![];};exports[_0xde4b('0x7f')]=function(_0x40b56b,_0x195459){var _0x149ec6,_0x7f15e0,_0x7f750;if(_0x195459<=0x0){_0x195459=0x1;}_0x149ec6=new RegExp(_0xde4b('0x80')+_0x195459+'}$');_0x7f15e0=Math[_0xde4b('0x81')](0xa,_0x195459-0x1);_0x7f750=Math[_0xde4b('0x81')](0xa,_0x195459)-0x1;return util[_0xde4b('0xe')]('%s',_[_0xde4b('0x82')](_0x40b56b,_0x149ec6,_[_0xde4b('0x83')](_0x7f15e0,_0x7f750)));};exports[_0xde4b('0x84')]=function(_0x7d7b9e){var _0x15772c=_0x7d7b9e[_0xde4b('0x85')](/"(.*?)"/);return _0x15772c?_0x15772c[0x1]:_0x7d7b9e;};exports[_0xde4b('0x86')]=function(_0x292a16){var _0x78fe1a=_0x292a16[_0xde4b('0x85')](/<(.*?)>/);return _0x78fe1a?_0x78fe1a[0x1]:_0x292a16;};function buildNoAnswerEventPayload(_0x4c142e,_0x32310f){var _0x44b2e0=buildObj(_0x4c142e,_0xde4b('0x87'));if(!_[_0xde4b('0xc')](_0x32310f['variables'])){Object[_0xde4b('0x88')](_0x32310f[_0xde4b('0x89')])[_0xde4b('0x8a')](function(_0x278eba){_0x44b2e0[_0x278eba[_0xde4b('0x8b')]()]=_0x32310f[_0xde4b('0x89')][_0x278eba];});}return _0x44b2e0;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 53e3601..36e6603 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 _0x34cf=['voicequeuechannelhangup','voicequeuechannelredirect','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel'];(function(_0x28afdd,_0xe5f157){var _0x143069=function(_0x23dc08){while(--_0x23dc08){_0x28afdd['push'](_0x28afdd['shift']());}};_0x143069(++_0xe5f157);}(_0x34cf,0xfe));var _0xf34c=function(_0x5c6b32,_0x26f261){_0x5c6b32=_0x5c6b32-0x0;var _0x2f825f=_0x34cf[_0x5c6b32];return _0x2f825f;};'use strict';exports['queueadd']={'queue':{'type':_0xf34c('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xf34c('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xf34c('0x2')]={'queue':{'type':_0xf34c('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xf34c('0x3')]={'interface':{'type':_0xf34c('0x0'),'required':!![]},'paused':{'type':_0xf34c('0x4')},'reason':{'type':_0xf34c('0x0'),'required':![]}};exports[_0xf34c('0x5')]={'module':{'type':_0xf34c('0x0'),'required':![]}};exports[_0xf34c('0x6')]={'uniqueid':{'type':_0xf34c('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xf34c('0x0')},'format':{'type':_0xf34c('0x0')},'mixmonitorid':{'type':'string'}};exports[_0xf34c('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf34c('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf34c('0x0'),'required':!![]},'context':{'type':_0xf34c('0x0')}}; \ No newline at end of file +var _0x745d=['boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x745d,0xab));var _0xd745=function(_0x451e2f,_0x189ff4){_0x451e2f=_0x451e2f-0x0;var _0x2c0c5a=_0x745d[_0x451e2f];return _0x2c0c5a;};'use strict';exports[_0xd745('0x0')]={'queue':{'type':_0xd745('0x1'),'required':!![]},'interface':{'type':_0xd745('0x1'),'required':!![]},'membername':{'type':_0xd745('0x1'),'required':!![]},'penalty':{'type':_0xd745('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xd745('0x3')]={'queue':{'type':_0xd745('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xd745('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xd745('0x5')},'reason':{'type':_0xd745('0x1'),'required':![]}};exports[_0xd745('0x6')]={'module':{'type':_0xd745('0x1'),'required':![]}};exports[_0xd745('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd745('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xd745('0x1')},'format':{'type':_0xd745('0x1')},'mixmonitorid':{'type':_0xd745('0x1')}};exports[_0xd745('0x9')]={'uniqueid':{'type':_0xd745('0x1'),'required':!![]}};exports[_0xd745('0xa')]={'uniqueid':{'type':_0xd745('0x1'),'required':!![]},'exten':{'type':_0xd745('0x1'),'required':!![]},'context':{'type':_0xd745('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3b8789e..6ae81cd 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x4c77d9,_0x3ff64d){var _0x48dc07=function(_0x31a22c){while(--_0x31a22c){_0x4c77d9['push'](_0x4c77d9['shift']());}};_0x48dc07(++_0x3ff64d);}(_0xb10b,0x12a));var _0xbb10=function(_0x25b444,_0x20da5e){_0x25b444=_0x25b444-0x0;var _0x425f88=_0xb10b[_0x25b444];return _0x425f88;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x3bd21b,_0x5a0f36){var _0x2f194a=function(_0x34b0ea){while(--_0x34b0ea){_0x3bd21b['push'](_0x3bd21b['shift']());}};_0x2f194a(++_0x5a0f36);}(_0x757a,0xde));var _0xa757=function(_0x6b2ddc,_0x3c0aaf){_0x6b2ddc=_0x6b2ddc-0x0;var _0x4efd52=_0x757a[_0x6b2ddc];return _0x4efd52;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index b36a1b9..bb71a3c 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5a7=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x52e5c6,_0x232cd2){var _0x48793d=function(_0x2580e7){while(--_0x2580e7){_0x52e5c6['push'](_0x52e5c6['shift']());}};_0x48793d(++_0x232cd2);}(_0xf5a7,0x1ea));var _0x7f5a=function(_0x518bae,_0x1f76ba){_0x518bae=_0x518bae-0x0;var _0x3cc701=_0xf5a7[_0x518bae];return _0x3cc701;};'use strict';function mergeDBDataToRealtime(_0x482ca5,_0x3a55d9){var _0x1aba66=Object[_0x7f5a('0x0')]({},_0x482ca5);for(var _0x33a64b in _0x3a55d9){if(_0x1aba66[_0x7f5a('0x1')](_0x33a64b)){_0x1aba66[_0x33a64b]=_0x3a55d9[_0x33a64b];}}return _0x1aba66;}exports[_0x7f5a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xc9e9=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x13e1f2,_0x5089be){var _0x5d639b=function(_0x10330d){while(--_0x10330d){_0x13e1f2['push'](_0x13e1f2['shift']());}};_0x5d639b(++_0x5089be);}(_0xc9e9,0x111));var _0x9c9e=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xc9e9[_0x13ce0c];return _0x4388fb;};'use strict';function mergeDBDataToRealtime(_0x44bc15,_0x2c3ad9){var _0x1ac682=Object[_0x9c9e('0x0')]({},_0x44bc15);for(var _0x2c5702 in _0x2c3ad9){if(_0x1ac682[_0x9c9e('0x1')](_0x2c5702)){_0x1ac682[_0x2c5702]=_0x2c3ad9[_0x2c5702];}}return _0x1ac682;}exports[_0x9c9e('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bf508b5..1a89f6f 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 _0x401c=['isArray','forEach','voiceDialReport','Local','indexOf','mobile','substring','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil','find','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','accountcode','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','getAgentByInternal','length','getCallType','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitorFilename','monitors','createdAt','xcally-motion-dialer','exten','create'];(function(_0x4c5202,_0x36a2e8){var _0x43a3ce=function(_0x1c90f5){while(--_0x1c90f5){_0x4c5202['push'](_0x4c5202['shift']());}};_0x43a3ce(++_0x36a2e8);}(_0x401c,0x1ba));var _0xc401=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x401c[_0x22868f];return _0x97bc75;};'use strict';var _=require(_0xc401('0x0'));var moment=require('moment');var util=require(_0xc401('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xc401('0x2'));var RpcVoiceCallReport=require(_0xc401('0x3'));var RpcVoiceDialReport=require(_0xc401('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc401('0x5'));var RpcVoiceTransferReport=require(_0xc401('0x6'));var VoiceQueueReport=require(_0xc401('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc401('0x8'));var VoiceDialReport=require(_0xc401('0x9'));var UserReport=require(_0xc401('0xa'));function Report(_0x488753){this[_0xc401('0xb')]=_0x488753;this['agents']=_0x488753[_0xc401('0xc')];this[_0xc401('0xd')]=_0x488753['telephones'];}Report[_0xc401('0xe')][_0xc401('0xf')]=function(_0x24ab4e){var _0x1599d3=new VoiceQueueReport(this[_0xc401('0xb')]);var _0x5c6367=new VoiceAgentReport(this['realtime']);var _0x3cbb8a=new VoiceDialReport(this[_0xc401('0xb')]);var _0x49271f=new VoiceCallReport(this[_0xc401('0xb')]);var _0x4dff3a=new UserReport(this[_0xc401('0xb')]);if(config[_0xc401('0x10')]&&config[_0xc401('0x10')][_0xc401('0x11')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xc401('0x12')](this));ami['on'](_0xc401('0x13'),this[_0xc401('0x14')][_0xc401('0x12')](this));ami['on'](_0xc401('0x15'),this[_0xc401('0x16')][_0xc401('0x12')](this));ami['on'](_0xc401('0x17'),this['voiceDialReport'][_0xc401('0x12')](this));ami['on'](_0xc401('0x18'),this[_0xc401('0x19')][_0xc401('0x12')](this));ami['on'](_0xc401('0x1a'),this[_0xc401('0x1b')]['bind'](this));}};Report[_0xc401('0xe')][_0xc401('0x1c')]=function(_0x2b4b03){var _0x58feab;_0x58feab=_['find'](this['agents'],function(_0x405c81){return _0x405c81['accountcode']==_0x2b4b03||_0x405c81[_0xc401('0x1d')]==_0x2b4b03;});if(_[_0xc401('0x1e')](_0x58feab)){var _0x101430=_[_0xc401('0x1f')](this[_0xc401('0xd')],function(_0xa380b0){return _0xa380b0['accountcode']==_0x2b4b03||_0xa380b0['name']==_0x2b4b03;});if(_0x101430){_0x58feab=_[_0xc401('0x1f')](this[_0xc401('0xc')],function(_0x2a795d){return _0x2a795d[_0xc401('0x20')]==util[_0xc401('0x21')](_0xc401('0x22'),_0x101430[_0xc401('0x1d')]);});}}return _0x58feab;};Report[_0xc401('0xe')][_0xc401('0x23')]=function(_0x2b6f86){for(var _0x689022=0x0;_0x689022<_0x2b6f86['length'];_0x689022+=0x1){var _0x5cf0ed=this[_0xc401('0x1c')](_0x2b6f86[_0x689022][_0xc401('0x24')]);if(_0x5cf0ed){_0x2b6f86[_0x689022][_0xc401('0x25')]=_0x5cf0ed[_0xc401('0x25')];_0x2b6f86[_0x689022]['assigned']=!![];_0x2b6f86[_0x689022][_0xc401('0x26')]=_0x5cf0ed[_0xc401('0x1d')];_0x2b6f86[_0x689022][_0xc401('0x20')]=_[_0xc401('0x1e')](_0x5cf0ed[_0xc401('0x20')])?util[_0xc401('0x21')](_0xc401('0x22'),_0x5cf0ed[_0xc401('0x1d')]):_0x5cf0ed[_0xc401('0x20')];if(_0x2b6f86[_0x689022]['queuecallercomplete']){_0x2b6f86[_0x689022][_0xc401('0x27')]=moment()[_0xc401('0x21')](_0xc401('0x28'));}if(_0x2b6f86[_0x689022][_0xc401('0x29')]){_0x2b6f86[_0x689022][_0xc401('0x2a')]=moment()['format'](_0xc401('0x28'));}RpcMemberReport[_0xc401('0x23')](_0x2b6f86[_0x689022]);}RpcVoiceQueueReport['create'](_0x2b6f86[_0x689022]);}};function extractCalleridNumber(_0x4c58af){var _0x4be939=_0x4c58af['match'](/<(.*?)>/);return _0x4be939?_0x4be939[0x1]:_0x4c58af;}Report[_0xc401('0xe')][_0xc401('0x2b')]=function(_0x2eaae2){for(var _0x6cceff=0x0;_0x6cceff/);return _0x3e89a?_0x3e89a[0x1]:_0x3a18a4;}Report['prototype'][_0xa7ab('0x2e')]=function(_0x127bc2){for(var _0x21cc2d=0x0;_0x21cc2d',_0x247d1c[_0xa7ab('0x43')],_0x247d1c[_0xa7ab('0x3c')]);}if(RpcVoiceTransferReport[_0xa7ab('0x44')][_0x247d1c[_0xa7ab('0x45')]]){var _0x76a071=RpcVoiceTransferReport['transfers'][_0x247d1c[_0xa7ab('0x45')]];_0x76a071[_0xa7ab('0x46')]=_0x247d1c[_0xa7ab('0x47')];RpcVoiceTransferReport[_0xa7ab('0x1c')](_0x76a071);delete RpcVoiceTransferReport[_0xa7ab('0x44')][_0x247d1c[_0xa7ab('0x45')]];}if(_['isNil'](_0x247d1c[_0xa7ab('0x34')])){_0x247d1c[_0xa7ab('0x34')]=this['getCallType'](_0x247d1c);}if(_[_0xa7ab('0x21')](_0x247d1c[_0xa7ab('0x48')])){var _0x51d7e1=_0x247d1c[_0xa7ab('0x3f')][_0xa7ab('0x30')]('-')[0x0];var _0x4479b2=this[_0xa7ab('0x11')][_0x51d7e1];if(!_0x4479b2)_0x4479b2=this[_0xa7ab('0x2e')](_0x247d1c[_0xa7ab('0x22')]);if(_0x4479b2){_0x247d1c[_0xa7ab('0x48')]=_0x4479b2['id'];_0x247d1c[_0xa7ab('0x49')]=_0x4479b2[_0xa7ab('0x20')];}}RpcVoiceCallReport[_0xa7ab('0x2c')](_0x247d1c);if(_0x247d1c[_0xa7ab('0x4a')]){for(var _0x4444fb=0x0;_0x4444fb<_0x247d1c[_0xa7ab('0x4b')][_0xa7ab('0x25')];_0x4444fb+=0x1){_0x247d1c[_0xa7ab('0x4c')]=_0x247d1c[_0xa7ab('0x4b')][_0x4444fb][_0xa7ab('0x4d')];_0x247d1c['createdAt']=_0x247d1c[_0xa7ab('0x4b')][_0x4444fb][_0xa7ab('0x4e')];if(_0x247d1c[_0xa7ab('0x4f')]==_0xa7ab('0x3a')){_0x247d1c[_0xa7ab('0x3c')]=_0x247d1c[_0xa7ab('0x26')];_0x247d1c['calleridname']=_0x247d1c[_0xa7ab('0x50')];_0x247d1c[_0xa7ab('0x26')]=_0x247d1c[_0xa7ab('0x22')];_0x247d1c['connectedlinename']=_0x247d1c[_0xa7ab('0x49')];_0x247d1c[_0xa7ab('0x4f')]=_0x247d1c[_0xa7ab('0x3d')];}else if(_0x247d1c['exten']==_0xa7ab('0x51')){_0x247d1c[_0xa7ab('0x3c')]=_0x247d1c[_0xa7ab('0x33')];_0x247d1c[_0xa7ab('0x4f')]=_0x247d1c['originatecalleridnum'];}RpcVoiceRecording[_0xa7ab('0x2c')](_0x247d1c);}}};Report[_0xa7ab('0x13')][_0xa7ab('0x1a')]=function(_0x1b45c4){if(_['isArray'](_0x1b45c4)){_0x1b45c4[_0xa7ab('0x52')](function(_0x77655e){RpcVoiceAgentReport[_0xa7ab('0x2c')](_0x77655e);});}else{RpcVoiceAgentReport[_0xa7ab('0x2c')](_0x1b45c4);}};Report['prototype'][_0xa7ab('0x1b')]=function(_0x30dccf){RpcVoiceDialReport[_0xa7ab('0x2c')](_0x30dccf);var _0x1ad366;var _0x217b95;var _0x46e951=_0x30dccf[_0xa7ab('0x3f')];if(_[_0xa7ab('0x53')](_0x46e951,_0xa7ab('0x54'))){_0x217b95=_0x46e951[_0xa7ab('0x55')](_0x46e951['indexOf']('/')+0x1,_0x46e951[_0xa7ab('0x56')]('@'));_0x1ad366=_[_0xa7ab('0x1f')](this[_0xa7ab('0x11')],function(_0x115ff2){return _0x115ff2[_0xa7ab('0x57')]==_0x217b95||_0x115ff2[_0xa7ab('0x58')]==_0x217b95||_0x115ff2[_0xa7ab('0x22')]==_0x217b95;});}else{_0x217b95=_0x46e951[_0xa7ab('0x55')](_0x46e951[_0xa7ab('0x56')]('/')+0x1,_0x46e951[_0xa7ab('0x59')]('-'));_0x1ad366=this[_0xa7ab('0x1e')](_0x217b95);}if(_0x1ad366){_0x30dccf[_0xa7ab('0x28')]=_[_0xa7ab('0x21')](_0x1ad366['interface'])?util[_0xa7ab('0x23')]('SIP/%s',_0x1ad366[_0xa7ab('0x20')]):_0x1ad366[_0xa7ab('0x28')];_0x30dccf[_0xa7ab('0x49')]=_0x1ad366[_0xa7ab('0x20')];_0x30dccf[_0xa7ab('0x22')]=_0x1ad366['accountcode'];RpcMemberReport[_0xa7ab('0x1b')](_0x30dccf);}};Report[_0xa7ab('0x13')][_0xa7ab('0x1c')]=function(_0x41e55b){RpcVoiceTransferReport['transfers'][_0x41e55b[_0xa7ab('0x5a')]]=_0x41e55b;};Report[_0xa7ab('0x13')][_0xa7ab('0x5b')]=function(_0x394a4f){RpcVoiceTransferReport[_0xa7ab('0x5b')](_0x394a4f);};module[_0xa7ab('0x5c')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c01ebfb..a255a53 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 _0x79c1=['mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peerstatus','[userReport][peerstatus]','peer','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','stateRegistry','merge','omit','event','actionid','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf'];(function(_0x22a3eb,_0x29809f){var _0x30c83b=function(_0x2bbbae){while(--_0x2bbbae){_0x22a3eb['push'](_0x22a3eb['shift']());}};_0x30c83b(++_0x29809f);}(_0x79c1,0x1a4));var _0x179c=function(_0x4f2a50,_0x4ba021){_0x4f2a50=_0x4f2a50-0x0;var _0x2d210a=_0x79c1[_0x4f2a50];return _0x2d210a;};'use strict';var _=require(_0x179c('0x0'));var moment=require(_0x179c('0x1'));var util=require(_0x179c('0x2'));var Redis=require(_0x179c('0x3'));var BPromise=require(_0x179c('0x4'));var config=require(_0x179c('0x5'));var logger=require(_0x179c('0x6'))('ami');var ami=require(_0x179c('0x7'));config[_0x179c('0x8')]=_['defaults'](config[_0x179c('0x8')],{'host':_0x179c('0x9'),'port':0x18eb});var io=require(_0x179c('0xa'))(new Redis(config['redis']));function UserReport(_0x9bc668){this[_0x179c('0xb')]=_0x9bc668[_0x179c('0xb')];this[_0x179c('0xc')]=_0x9bc668['agents'];this[_0x179c('0xd')]=_0x9bc668[_0x179c('0xd')];ami['on']('registryentry',this[_0x179c('0xe')][_0x179c('0xf')](this));ami['on'](_0x179c('0x10'),this['syncRegistry']['bind'](this));ami['on'](_0x179c('0x11'),this[_0x179c('0x12')][_0x179c('0xf')](this));ami['on']('peerstatus',this[_0x179c('0x13')][_0x179c('0xf')](this));return this[_0x179c('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0x179c('0x15')](ami[_0x179c('0x16')]())[_0x179c('0x17')](function(_0x1d223f){logger[_0x179c('0x18')](_0x179c('0x19'),util[_0x179c('0x1a')](_0x1d223f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x179c('0x15')](ami[_0x179c('0x1b')]())[_0x179c('0x17')](function(_0xed390f){logger['error'](_0x179c('0x1c'),util[_0x179c('0x1a')](_0xed390f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x179c('0x1d')]()[_0x179c('0x15')](ami[_0x179c('0x1e')]())['catch'](function(_0x40b67b){logger[_0x179c('0x18')](_0x179c('0x1f'),util[_0x179c('0x1a')](_0x40b67b,{'showHidden':![],'depth':null}));});}UserReport[_0x179c('0x20')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x179c('0x15')](showSipRegistrations())['then'](listDeviceStates())[_0x179c('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5b51eb){return _0x5b51eb!==null&&!_[_0x179c('0x21')](_0x5b51eb);};UserReport[_0x179c('0x20')][_0x179c('0x22')]=function(_0x592636,_0x5a09a3,_0x3cfb84){io['to'](_0x592636)[_0x179c('0x22')](_0x5a09a3,_0x3cfb84);};UserReport[_0x179c('0x20')][_0x179c('0xe')]=function(_0x503fcf){try{if(this[_0x179c('0x23')](_0x503fcf)){logger[_0x179c('0x24')](_0x179c('0x25'),_0x503fcf['username'],_0x503fcf[_0x179c('0x26')]);logger[_0x179c('0x27')]('[userReport][registry]',util[_0x179c('0x1a')](_0x503fcf,{'showHidden':![],'depth':null}));var _0x199740=_['find'](this['trunks'],{'defaultuser':_0x503fcf['username']});if(_0x199740){_0x503fcf[_0x179c('0x28')]=_0x503fcf['state'];_[_0x179c('0x29')](_0x199740,_[_0x179c('0x2a')](_0x503fcf,[_0x179c('0x2b'),_0x179c('0x2c'),_0x179c('0x2d'),_0x179c('0x26')]));logger['debug'](_0x179c('0x2e'),util[_0x179c('0x1a')](_0x199740,{'showHidden':![],'depth':null}));this[_0x179c('0x22')](util[_0x179c('0x2f')](_0x179c('0x30'),_0x199740[_0x179c('0x31')]),_0x179c('0x32'),_0x199740);}}}catch(_0xeb008a){logger['error'](_0x179c('0x33'),util[_0x179c('0x1a')](_0xeb008a,{'showHidden':![],'depth':null}));}};UserReport[_0x179c('0x20')][_0x179c('0x12')]=function(_0xbc953){try{if(this['isNotNull'](_0xbc953)){logger[_0x179c('0x24')](_0x179c('0x34'),_0xbc953['device'],_0xbc953[_0x179c('0x26')]);logger['debug'](_0x179c('0x35'),util[_0x179c('0x1a')](_0xbc953,{'showHidden':![],'depth':null}));if(this[_0x179c('0xc')][_0xbc953[_0x179c('0x36')]]){if(!this[_0x179c('0xc')][_0xbc953['device']][_0x179c('0x37')]||_0xbc953[_0x179c('0x26')][_0x179c('0x38')]()=='inuse'){this[_0x179c('0xc')][_0xbc953[_0x179c('0x36')]][_0x179c('0x37')]=![];if(this['agents'][_0xbc953['device']][_0x179c('0x26')]!==_0xbc953[_0x179c('0x26')][_0x179c('0x38')]()){this[_0x179c('0xc')][_0xbc953[_0x179c('0x36')]]['stateTime']=_[_0x179c('0x39')](moment()[_0x179c('0x2f')]('x'));}this['agents'][_0xbc953[_0x179c('0x36')]]['state']=_0xbc953[_0x179c('0x26')]['toLowerCase']();this['agents'][_0xbc953[_0x179c('0x36')]]['updateStatusRealtime'](_0xbc953);}}else if(this[_0x179c('0xd')][_0xbc953[_0x179c('0x36')]]){if(this[_0x179c('0xd')][_0xbc953[_0x179c('0x36')]]['state']!==_0xbc953[_0x179c('0x26')][_0x179c('0x38')]()){this['telephones'][_0xbc953[_0x179c('0x36')]]['stateTime']=_['toNumber'](moment()[_0x179c('0x2f')]('x'));}this[_0x179c('0xd')][_0xbc953[_0x179c('0x36')]]['state']=_0xbc953[_0x179c('0x26')][_0x179c('0x38')]();logger[_0x179c('0x27')](_0x179c('0x3a'),util['inspect'](this[_0x179c('0xd')][_0xbc953[_0x179c('0x36')]],{'showHidden':![],'depth':null}));this[_0x179c('0x22')](util['format'](_0x179c('0x3b'),this[_0x179c('0xd')][_0xbc953[_0x179c('0x36')]][_0x179c('0x31')]),'telephone:save',this['telephones'][_0xbc953['device']]);}else if(this['trunks'][_0xbc953[_0x179c('0x36')]]){if(this[_0x179c('0xb')][_0xbc953[_0x179c('0x36')]]['state']!==_0xbc953[_0x179c('0x26')][_0x179c('0x38')]()){this[_0x179c('0xb')][_0xbc953[_0x179c('0x36')]][_0x179c('0x3c')]=_[_0x179c('0x39')](moment()[_0x179c('0x2f')]('x'));}this[_0x179c('0xb')][_0xbc953['device']]['state']=_0xbc953['state'][_0x179c('0x38')]();logger['debug'](_0x179c('0x3d'),util[_0x179c('0x1a')](this[_0x179c('0xb')][_0xbc953[_0x179c('0x36')]],{'showHidden':![],'depth':null}));this[_0x179c('0x22')](util[_0x179c('0x2f')](_0x179c('0x30'),this[_0x179c('0xb')][_0xbc953[_0x179c('0x36')]][_0x179c('0x31')]),'trunk:save',this[_0x179c('0xb')][_0xbc953[_0x179c('0x36')]]);}else if(_[_0x179c('0x3e')](_0xbc953[_0x179c('0x36')],_0x179c('0x3f'))){var _0x12f6c2=_0xbc953[_0x179c('0x36')];var _0x50ca23=_0x12f6c2[_0x179c('0x40')](_0x12f6c2[_0x179c('0x41')]('/')+0x1,_0x12f6c2[_0x179c('0x41')]('@'));var _0x5080e4=_['find'](this[_0x179c('0xc')],function(_0x1861d1){return _0x1861d1[_0x179c('0x42')]==_0x50ca23||_0x1861d1[_0x179c('0x43')]==_0x50ca23||_0x1861d1[_0x179c('0x44')]==_0x50ca23;});if(_0x5080e4){if(_0x5080e4[_0x179c('0x26')]!==_0xbc953['state'][_0x179c('0x38')]()){_0x5080e4[_0x179c('0x3c')]=_['toNumber'](moment()[_0x179c('0x2f')]('x'));}_0x5080e4[_0x179c('0x26')]=_0xbc953[_0x179c('0x26')][_0x179c('0x38')]();_0x5080e4['local']=!![];_0x5080e4[_0x179c('0x45')](_0xbc953);}}}}catch(_0x480a48){logger[_0x179c('0x18')](_0x179c('0x35'),util['inspect'](_0x480a48,{'showHidden':![],'depth':null}));}};UserReport[_0x179c('0x20')][_0x179c('0x13')]=function(_0xdf3a94){try{if(this[_0x179c('0x23')](_0xdf3a94)&&this[_0x179c('0x23')](_0xdf3a94['peerstatus'])){logger[_0x179c('0x24')](_0x179c('0x46'),_0xdf3a94['peer'],_0xdf3a94['address'],_0xdf3a94[_0x179c('0x47')]);logger[_0x179c('0x27')](_0x179c('0x48'),util[_0x179c('0x1a')](_0xdf3a94,{'showHidden':![],'depth':null}));if(this['agents'][_0xdf3a94[_0x179c('0x49')]]){if(!this[_0x179c('0xc')][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x37')]||_0xdf3a94[_0x179c('0x47')][_0x179c('0x38')]()==_0x179c('0x4a')){this[_0x179c('0xc')][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x37')]=![];this[_0x179c('0xc')][_0xdf3a94[_0x179c('0x49')]]['status']=_0xdf3a94[_0x179c('0x47')][_0x179c('0x38')]();this[_0x179c('0xc')][_0xdf3a94[_0x179c('0x49')]]['address']=_0xdf3a94[_0x179c('0x4b')];this[_0x179c('0xc')][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x45')](_0xdf3a94);}}else if(this[_0x179c('0xd')][_0xdf3a94[_0x179c('0x49')]]){this[_0x179c('0xd')][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x4c')]=_0xdf3a94['peerstatus']['toLowerCase']();this['telephones'][_0xdf3a94[_0x179c('0x49')]]['address']=_0xdf3a94[_0x179c('0x4b')];logger[_0x179c('0x27')](_0x179c('0x4d'),util[_0x179c('0x1a')](this['telephones'][_0xdf3a94[_0x179c('0x49')]],{'showHidden':![],'depth':null}));this[_0x179c('0x22')](util['format'](_0x179c('0x3b'),this['telephones'][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x31')]),_0x179c('0x4e'),this['telephones'][_0xdf3a94[_0x179c('0x49')]]);}else if(this[_0x179c('0xb')][_0xdf3a94[_0x179c('0x49')]]){this['trunks'][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x4c')]=_0xdf3a94[_0x179c('0x47')][_0x179c('0x38')]();this['trunks'][_0xdf3a94[_0x179c('0x49')]][_0x179c('0x4b')]=_0xdf3a94[_0x179c('0x4b')];logger[_0x179c('0x27')](_0x179c('0x4f'),util[_0x179c('0x1a')](this[_0x179c('0xb')][_0xdf3a94[_0x179c('0x49')]],{'showHidden':![],'depth':null}));this[_0x179c('0x22')](util[_0x179c('0x2f')](_0x179c('0x30'),this[_0x179c('0xb')][_0xdf3a94['peer']][_0x179c('0x31')]),'trunk:save',this[_0x179c('0xb')][_0xdf3a94[_0x179c('0x49')]]);}}}catch(_0x319aa8){logger['error']('[userReport][peerstatus]',util['inspect'](_0x319aa8,{'showHidden':![],'depth':null}));}};module[_0x179c('0x50')]=UserReport; \ No newline at end of file +var _0xa73e=['ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','error','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','toLowerCase','inuse','local','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','substring','indexOf','mobile','phone','accountcode','info','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','exports','ioredis','bluebird','../../../config/environment','../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa73e,0x1be));var _0xea73=function(_0x39d06b,_0x4cb1d4){_0x39d06b=_0x39d06b-0x0;var _0x37ac26=_0xa73e[_0x39d06b];return _0x37ac26;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xea73('0x0'));var BPromise=require(_0xea73('0x1'));var config=require(_0xea73('0x2'));var logger=require(_0xea73('0x3'))(_0xea73('0x4'));var ami=require(_0xea73('0x5'));config[_0xea73('0x6')]=_['defaults'](config[_0xea73('0x6')],{'host':_0xea73('0x7'),'port':0x18eb});var io=require(_0xea73('0x8'))(new Redis(config[_0xea73('0x6')]));function UserReport(_0x2d50a3){this[_0xea73('0x9')]=_0x2d50a3[_0xea73('0x9')];this[_0xea73('0xa')]=_0x2d50a3[_0xea73('0xa')];this[_0xea73('0xb')]=_0x2d50a3[_0xea73('0xb')];ami['on']('registryentry',this[_0xea73('0xc')]['bind'](this));ami['on'](_0xea73('0xd'),this[_0xea73('0xc')][_0xea73('0xe')](this));ami['on'](_0xea73('0xf'),this[_0xea73('0x10')][_0xea73('0xe')](this));ami['on'](_0xea73('0x11'),this[_0xea73('0x12')][_0xea73('0xe')](this));return this[_0xea73('0x13')]();}function showSipRegistrations(){Promise[_0xea73('0x14')]()[_0xea73('0x15')](ami[_0xea73('0x16')]())[_0xea73('0x17')](function(_0x17bf78){logger['error'](_0xea73('0x18'),util[_0xea73('0x19')](_0x17bf78,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xea73('0x14')]()['then'](ami['actionDeviceStateList']())[_0xea73('0x17')](function(_0x3752fc){logger['error'](_0xea73('0x1a'),util[_0xea73('0x19')](_0x3752fc,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xea73('0x14')]()[_0xea73('0x15')](ami[_0xea73('0x1b')]())['catch'](function(_0x471613){logger['error']('[userReport][sippeerstatus]',util[_0xea73('0x19')](_0x471613,{'showHidden':![],'depth':null}));});}UserReport[_0xea73('0x1c')][_0xea73('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0xea73('0x15')](showSipRegistrations())[_0xea73('0x15')](listDeviceStates())[_0xea73('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xea73('0x1c')][_0xea73('0x1d')]=function(_0x113d88){return _0x113d88!==null&&!_[_0xea73('0x1e')](_0x113d88);};UserReport['prototype'][_0xea73('0x1f')]=function(_0x236af8,_0x1860bf,_0x36edfe){io['to'](_0x236af8)[_0xea73('0x1f')](_0x1860bf,_0x36edfe);};UserReport[_0xea73('0x1c')]['syncRegistry']=function(_0x682770){try{if(this[_0xea73('0x1d')](_0x682770)){logger['info'](_0xea73('0x20'),_0x682770['username'],_0x682770[_0xea73('0x21')]);logger[_0xea73('0x22')](_0xea73('0x23'),util[_0xea73('0x19')](_0x682770,{'showHidden':![],'depth':null}));var _0x23bb4c=_[_0xea73('0x24')](this[_0xea73('0x9')],{'defaultuser':_0x682770['username']});if(_0x23bb4c){_0x682770[_0xea73('0x25')]=_0x682770['state'];_[_0xea73('0x26')](_0x23bb4c,_[_0xea73('0x27')](_0x682770,[_0xea73('0x28'),_0xea73('0x29'),_0xea73('0x2a'),_0xea73('0x21')]));logger[_0xea73('0x22')](_0xea73('0x2b'),util[_0xea73('0x19')](_0x23bb4c,{'showHidden':![],'depth':null}));this[_0xea73('0x1f')](util['format'](_0xea73('0x2c'),_0x23bb4c[_0xea73('0x2d')]),'trunk:save',_0x23bb4c);}}}catch(_0x5f3c29){logger[_0xea73('0x2e')]('[userReport][registry]',util[_0xea73('0x19')](_0x5f3c29,{'showHidden':![],'depth':null}));}};UserReport[_0xea73('0x1c')][_0xea73('0x10')]=function(_0x3f753b){try{if(this[_0xea73('0x1d')](_0x3f753b)){logger['info'](_0xea73('0x2f'),_0x3f753b[_0xea73('0x30')],_0x3f753b[_0xea73('0x21')]);logger[_0xea73('0x22')]('[userReport][devicestatechange]',util[_0xea73('0x19')](_0x3f753b,{'showHidden':![],'depth':null}));if(this[_0xea73('0xa')][_0x3f753b[_0xea73('0x30')]]){if(!this['agents'][_0x3f753b[_0xea73('0x30')]]['local']||_0x3f753b['state'][_0xea73('0x31')]()==_0xea73('0x32')){this[_0xea73('0xa')][_0x3f753b[_0xea73('0x30')]][_0xea73('0x33')]=![];if(this[_0xea73('0xa')][_0x3f753b[_0xea73('0x30')]]['state']!==_0x3f753b[_0xea73('0x21')][_0xea73('0x31')]()){this[_0xea73('0xa')][_0x3f753b[_0xea73('0x30')]]['stateTime']=_[_0xea73('0x34')](moment()[_0xea73('0x35')]('x'));}this[_0xea73('0xa')][_0x3f753b[_0xea73('0x30')]][_0xea73('0x21')]=_0x3f753b[_0xea73('0x21')][_0xea73('0x31')]();this['agents'][_0x3f753b[_0xea73('0x30')]][_0xea73('0x36')](_0x3f753b);}}else if(this[_0xea73('0xb')][_0x3f753b[_0xea73('0x30')]]){if(this['telephones'][_0x3f753b[_0xea73('0x30')]][_0xea73('0x21')]!==_0x3f753b['state'][_0xea73('0x31')]()){this[_0xea73('0xb')][_0x3f753b['device']][_0xea73('0x37')]=_[_0xea73('0x34')](moment()['format']('x'));}this[_0xea73('0xb')][_0x3f753b[_0xea73('0x30')]][_0xea73('0x21')]=_0x3f753b[_0xea73('0x21')][_0xea73('0x31')]();logger[_0xea73('0x22')](_0xea73('0x38'),util[_0xea73('0x19')](this[_0xea73('0xb')][_0x3f753b[_0xea73('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xea73('0x35')]('telephone:%s',this[_0xea73('0xb')][_0x3f753b[_0xea73('0x30')]][_0xea73('0x2d')]),'telephone:save',this[_0xea73('0xb')][_0x3f753b['device']]);}else if(this[_0xea73('0x9')][_0x3f753b[_0xea73('0x30')]]){if(this[_0xea73('0x9')][_0x3f753b[_0xea73('0x30')]]['state']!==_0x3f753b['state'][_0xea73('0x31')]()){this[_0xea73('0x9')][_0x3f753b[_0xea73('0x30')]][_0xea73('0x37')]=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x3f753b[_0xea73('0x30')]][_0xea73('0x21')]=_0x3f753b[_0xea73('0x21')]['toLowerCase']();logger['debug'](_0xea73('0x39'),util[_0xea73('0x19')](this[_0xea73('0x9')][_0x3f753b[_0xea73('0x30')]],{'showHidden':![],'depth':null}));this[_0xea73('0x1f')](util[_0xea73('0x35')](_0xea73('0x2c'),this[_0xea73('0x9')][_0x3f753b['device']]['name']),_0xea73('0x3a'),this[_0xea73('0x9')][_0x3f753b['device']]);}else if(_['startsWith'](_0x3f753b['device'],'Local')){var _0x195e39=_0x3f753b[_0xea73('0x30')];var _0x400a5c=_0x195e39[_0xea73('0x3b')](_0x195e39[_0xea73('0x3c')]('/')+0x1,_0x195e39[_0xea73('0x3c')]('@'));var _0x9e14a5=_['find'](this[_0xea73('0xa')],function(_0x49a178){return _0x49a178[_0xea73('0x3d')]==_0x400a5c||_0x49a178[_0xea73('0x3e')]==_0x400a5c||_0x49a178[_0xea73('0x3f')]==_0x400a5c;});if(_0x9e14a5){if(_0x9e14a5[_0xea73('0x21')]!==_0x3f753b[_0xea73('0x21')][_0xea73('0x31')]()){_0x9e14a5[_0xea73('0x37')]=_[_0xea73('0x34')](moment()[_0xea73('0x35')]('x'));}_0x9e14a5['state']=_0x3f753b[_0xea73('0x21')][_0xea73('0x31')]();_0x9e14a5[_0xea73('0x33')]=!![];_0x9e14a5[_0xea73('0x36')](_0x3f753b);}}}}catch(_0x41e6aa){logger[_0xea73('0x2e')]('[userReport][devicestatechange]',util[_0xea73('0x19')](_0x41e6aa,{'showHidden':![],'depth':null}));}};UserReport[_0xea73('0x1c')][_0xea73('0x12')]=function(_0x4f22f7){try{if(this[_0xea73('0x1d')](_0x4f22f7)&&this['isNotNull'](_0x4f22f7[_0xea73('0x11')])){logger[_0xea73('0x40')](_0xea73('0x41'),_0x4f22f7[_0xea73('0x42')],_0x4f22f7[_0xea73('0x43')],_0x4f22f7['peerstatus']);logger[_0xea73('0x22')](_0xea73('0x44'),util[_0xea73('0x19')](_0x4f22f7,{'showHidden':![],'depth':null}));if(this[_0xea73('0xa')][_0x4f22f7[_0xea73('0x42')]]){if(!this[_0xea73('0xa')][_0x4f22f7[_0xea73('0x42')]]['local']||_0x4f22f7[_0xea73('0x11')][_0xea73('0x31')]()==_0xea73('0x45')){this['agents'][_0x4f22f7[_0xea73('0x42')]][_0xea73('0x33')]=![];this[_0xea73('0xa')][_0x4f22f7[_0xea73('0x42')]]['status']=_0x4f22f7[_0xea73('0x11')][_0xea73('0x31')]();this['agents'][_0x4f22f7['peer']][_0xea73('0x43')]=_0x4f22f7[_0xea73('0x43')];this['agents'][_0x4f22f7['peer']][_0xea73('0x36')](_0x4f22f7);}}else if(this['telephones'][_0x4f22f7[_0xea73('0x42')]]){this[_0xea73('0xb')][_0x4f22f7[_0xea73('0x42')]][_0xea73('0x46')]=_0x4f22f7[_0xea73('0x11')][_0xea73('0x31')]();this['telephones'][_0x4f22f7[_0xea73('0x42')]]['address']=_0x4f22f7[_0xea73('0x43')];logger[_0xea73('0x22')](_0xea73('0x47'),util['inspect'](this[_0xea73('0xb')][_0x4f22f7['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xea73('0x35')](_0xea73('0x48'),this['telephones'][_0x4f22f7[_0xea73('0x42')]][_0xea73('0x2d')]),_0xea73('0x49'),this['telephones'][_0x4f22f7[_0xea73('0x42')]]);}else if(this[_0xea73('0x9')][_0x4f22f7['peer']]){this[_0xea73('0x9')][_0x4f22f7[_0xea73('0x42')]][_0xea73('0x46')]=_0x4f22f7[_0xea73('0x11')]['toLowerCase']();this[_0xea73('0x9')][_0x4f22f7['peer']][_0xea73('0x43')]=_0x4f22f7[_0xea73('0x43')];logger[_0xea73('0x22')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xea73('0x19')](this[_0xea73('0x9')][_0x4f22f7[_0xea73('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xea73('0x35')]('trunk:%s',this['trunks'][_0x4f22f7[_0xea73('0x42')]][_0xea73('0x2d')]),_0xea73('0x3a'),this[_0xea73('0x9')][_0x4f22f7[_0xea73('0x42')]]);}}}catch(_0x36d593){logger['error'](_0xea73('0x44'),util[_0xea73('0x19')](_0x36d593,{'showHidden':![],'depth':null}));}};module[_0xea73('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 6d89afa..cb5e62f 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 _0xabd3=['agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','omit','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon'];(function(_0x40f87c,_0x2d210c){var _0x37f6c7=function(_0x4412f7){while(--_0x4412f7){_0x40f87c['push'](_0x40f87c['shift']());}};_0x37f6c7(++_0x2d210c);}(_0xabd3,0x8e));var _0x3abd=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xabd3[_0x454018];return _0x24697d;};'use strict';var _=require(_0x3abd('0x0'));var moment=require('moment');var util=require(_0x3abd('0x1'));var Redis=require(_0x3abd('0x2'));var config=require(_0x3abd('0x3'));var logger=require(_0x3abd('0x4'))(_0x3abd('0x5'));var ami=require(_0x3abd('0x6'));config['redis']=_[_0x3abd('0x7')](config['redis'],{'host':_0x3abd('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x47eb0e){this['channels']={};this['voiceChannels']=_0x47eb0e[_0x3abd('0x9')];this[_0x3abd('0xa')]=_0x47eb0e['voiceQueues'];this['agents']=_0x47eb0e[_0x3abd('0xb')];this['variables']={};ami['on'](_0x3abd('0xc'),this[_0x3abd('0xd')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0xf'),this[_0x3abd('0x10')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x11'),this[_0x3abd('0x12')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x13'),this[_0x3abd('0x14')]['bind'](this));ami['on'](_0x3abd('0x15'),this[_0x3abd('0x16')]['bind'](this));ami['on'](_0x3abd('0x17'),this[_0x3abd('0x18')]['bind'](this));ami['on'](_0x3abd('0x19'),this[_0x3abd('0x1a')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x1b'),this[_0x3abd('0x1c')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x1d'),this[_0x3abd('0x1e')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x1f'),this[_0x3abd('0x20')][_0x3abd('0xe')](this));ami['on'](_0x3abd('0x21'),this[_0x3abd('0x22')][_0x3abd('0xe')](this));}VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x24')]=function(_0x29ac56,_0x361e77,_0x4d3ad5){io['to'](_0x29ac56)['emit'](_0x361e77,_0x4d3ad5);};VoiceAgentReport[_0x3abd('0x23')]['isNotNull']=function(_0x22e623){return _0x22e623!==null&&!_[_0x3abd('0x25')](_0x22e623);};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0xd')]=function(_0x478da3){try{if(this[_0x3abd('0x26')](_0x478da3)){logger[_0x3abd('0x27')](_0x3abd('0x28'),_0x478da3[_0x3abd('0x29')],_0x478da3[_0x3abd('0x2a')],_0x478da3[_0x3abd('0x2b')]);logger['debug'](_0x3abd('0x2c'),_0x478da3[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x478da3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3abd('0x9')][_0x478da3[_0x3abd('0x29')]])){this[_0x3abd('0x9')][_0x478da3[_0x3abd('0x29')]]={};}var _0x339ce0=this[_0x3abd('0xb')][_0x478da3[_0x3abd('0x2e')]];var _0x1257e6=this[_0x3abd('0x9')][_0x478da3[_0x3abd('0x29')]][_0x478da3[_0x3abd('0x2b')]];var _0x22bc63=this[_0x3abd('0xa')][_0x478da3[_0x3abd('0x2f')]];var _0x20c5cb=this[_0x3abd('0x30')][_0x478da3[_0x3abd('0x29')]];if(_['isUndefined'](_0x1257e6)){_0x1257e6={'agentcalledAt':moment()[_0x3abd('0x31')](_0x3abd('0x32')),'lastevent':_0x3abd('0x33'),'mandatoryDisposition':_0x22bc63&&_0x22bc63[_0x3abd('0x34')]?_0x22bc63['mandatoryDisposition']:![],'type':_0x22bc63&&_0x22bc63[_0x3abd('0x35')]?_0x22bc63[_0x3abd('0x35')]:_0x3abd('0x36'),'variables':_0x20c5cb,'motionChannel':'voice'};}Object['assign'](_0x1257e6,_[_0x3abd('0x37')](_0x478da3,['event',_0x3abd('0x38')]));this[_0x3abd('0x9')][_0x478da3['uniqueid']][_0x478da3[_0x3abd('0x2b')]]=_0x1257e6;logger[_0x3abd('0x39')](_0x3abd('0x3a'),_0x478da3[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x1257e6,{'showHidden':![],'depth':null}));ami[_0x3abd('0x24')](_0x3abd('0x3b'),_0x1257e6);var _0x3375ce={'id':_0x339ce0['id'],'calleridnum':_0x1257e6[_0x3abd('0x3c')],'queue':_0x1257e6['queue'],'variables':_0x1257e6[_0x3abd('0x30')],'uniqueid':_0x478da3[_0x3abd('0x29')]};logger[_0x3abd('0x39')](_0x3abd('0x3d'),_0x478da3[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x3375ce,{'showHidden':![],'depth':null}));this[_0x3abd('0x24')](util[_0x3abd('0x31')]('user:%s',_0x478da3['membername']),_0x3abd('0x3e'),_0x3375ce);}}catch(_0x462a5c){logger[_0x3abd('0x3f')]('[%s][voiceAgentReport][agentcalled]',_0x478da3['uniqueid'],util[_0x3abd('0x2d')](_0x462a5c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x10')]=function(_0x3e943a){try{if(this[_0x3abd('0x26')](_0x3e943a)){if(this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]]){for(var _0x4b2c6e in this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]]){if(this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x3abd('0x40')](_0x4b2c6e)){if(_0x3e943a['destuniqueid']===_0x4b2c6e){logger[_0x3abd('0x27')](_0x3abd('0x41'),_0x3e943a[_0x3abd('0x29')],_0x3e943a[_0x3abd('0x2a')],_0x3e943a[_0x3abd('0x2b')]);this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x42')]=moment()[_0x3abd('0x31')](_0x3abd('0x32'));this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e][_0x3abd('0x43')]=_0x3e943a[_0x3abd('0x43')];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x44')]=_0x3e943a['connectedlinenum'];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x45')]=_0x3e943a[_0x3abd('0x45')];this['channels'][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x46')]=_0x3e943a[_0x3abd('0x46')];this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e][_0x3abd('0x47')]=_0x3e943a['holdtime'];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x48')]=_0x3abd('0x49');if(this['voiceChannels'][this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e][_0x3abd('0x29')]]){var _0x1e6bc7=this['voiceChannels'][this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x29')]][_0x3abd('0x4a')];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x4a')]=_0x1e6bc7;_0x3e943a[_0x3abd('0x4a')]=_0x1e6bc7;}_[_0x3abd('0x4b')](this['agents'][_0x3e943a[_0x3abd('0x2e')]],_['pick'](_0x3e943a,[_0x3abd('0x2f'),_0x3abd('0x4c'),_0x3abd('0x4a')]));var _0x439b6e=this[_0x3abd('0xb')][_0x3e943a[_0x3abd('0x2e')]];var _0x5c496c={'id':_0x439b6e['id'],'name':_0x439b6e['name'],'agentconnected':!![],'destaccountcode':_0x439b6e[_0x3abd('0x4d')],'destconnectedlinenum':this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x3e943a[_0x3abd('0x2b')]][_0x3abd('0x4e')],'queue':this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x3e943a[_0x3abd('0x2b')]]['queue'],'routealias':this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x3e943a['destuniqueid']]['routealias'],'uniqueid':this['channels'][_0x3e943a[_0x3abd('0x29')]][_0x3e943a[_0x3abd('0x2b')]][_0x3abd('0x29')]};ami['emit'](_0x3abd('0x4f'),this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x3e943a['destuniqueid']]);this[_0x3abd('0x24')](util[_0x3abd('0x31')](_0x3abd('0x50'),_0x3e943a[_0x3abd('0x2a')]),_0x3abd('0x51'),_0x5c496c);}else if(!this['channels'][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e]['agentringnoanswer']&&!this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x15')]){logger[_0x3abd('0x27')](_0x3abd('0x52'),_0x3e943a['uniqueid'],this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e]['membername'],_0x4b2c6e);this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e][_0x3abd('0x11')]=!![];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x53')]=moment()[_0x3abd('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e]['answeredelsewheredestinationuniqueid']=_0x3e943a[_0x3abd('0x2b')];this['channels'][_0x3e943a['uniqueid']][_0x4b2c6e]['answeredelsewheremembername']=_0x3e943a[_0x3abd('0x2a')];this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e][_0x3abd('0x48')]='answered_elsewhere';this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e][_0x3abd('0x54')]=_0x3abd('0x55');logger['debug'](_0x3abd('0x56'),_0x3e943a[_0x3abd('0x29')],util['inspect'](this[_0x3abd('0x9')][_0x3e943a['uniqueid']][_0x4b2c6e],{'showHidden':![],'depth':null}));ami[_0x3abd('0x24')](_0x3abd('0x57'),this[_0x3abd('0x9')][_0x3e943a[_0x3abd('0x29')]][_0x4b2c6e]);}else{logger[_0x3abd('0x39')](_0x3abd('0x58'),_0x3e943a[_0x3abd('0x29')]);}}}}}}catch(_0x93e885){logger[_0x3abd('0x3f')](_0x3abd('0x59'),_0x3e943a[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x93e885,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x12')]=function(_0x209d8f){try{if(this[_0x3abd('0x26')](_0x209d8f)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x209d8f['uniqueid'],util[_0x3abd('0x2d')](_0x209d8f,{'showHidden':![],'depth':null}));if(this[_0x3abd('0x9')][_0x209d8f[_0x3abd('0x29')]]&&this['channels'][_0x209d8f[_0x3abd('0x29')]][_0x209d8f[_0x3abd('0x2b')]]){logger[_0x3abd('0x27')](_0x3abd('0x5a'),_0x209d8f['uniqueid'],_0x209d8f[_0x3abd('0x2a')],_0x209d8f[_0x3abd('0x2b')]);var _0x13f72e=this[_0x3abd('0xb')][_0x209d8f[_0x3abd('0x2e')]];var _0x343801=this[_0x3abd('0x9')][_0x209d8f[_0x3abd('0x29')]][_0x209d8f[_0x3abd('0x2b')]];_0x343801[_0x3abd('0x11')]=!![];_0x343801[_0x3abd('0x53')]=moment()['format'](_0x3abd('0x32'));_0x343801[_0x3abd('0x48')]=_0x3abd('0x5b');_0x343801['reason']=_0x3abd('0x5b');var _0x8f6298={'id':_0x13f72e['id'],'name':_0x13f72e[_0x3abd('0x5c')],'queue':_0x343801[_0x3abd('0x2f')],'uniqueid':_0x343801[_0x3abd('0x29')]};logger['debug'](_0x3abd('0x5d'),_0x209d8f[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x8f6298,{'showHidden':![],'depth':null}));this[_0x3abd('0x24')](util[_0x3abd('0x31')]('user:%s',_0x13f72e['name']),_0x3abd('0x5e'),_0x8f6298);ami[_0x3abd('0x24')](_0x3abd('0x5f'),_0x343801);this[_0x3abd('0x9')][_0x209d8f[_0x3abd('0x29')]][_0x209d8f[_0x3abd('0x2b')]]=Object[_0x3abd('0x60')]({},_0x343801);}}}catch(_0x1aec43){logger[_0x3abd('0x3f')](_0x3abd('0x61'),_0x209d8f[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x1aec43,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x14')]=function(_0xfa1155){try{if(this[_0x3abd('0x26')](_0xfa1155)){logger[_0x3abd('0x39')](_0x3abd('0x62'),_0xfa1155[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0xfa1155,{'showHidden':![],'depth':null}));if(this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]]){for(var _0x1af747 in this[_0x3abd('0x9')][_0xfa1155['uniqueid']]){if(this[_0x3abd('0x9')][_0xfa1155['uniqueid']][_0x3abd('0x40')](_0x1af747)&&!this['channels'][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x11')]&&!this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x15')]){logger[_0x3abd('0x27')](_0x3abd('0x63'),_0xfa1155[_0x3abd('0x29')],this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x2a')],_0x1af747);this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x11')]=!![];this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x53')]=moment()['format'](_0x3abd('0x32'));this[_0x3abd('0x9')][_0xfa1155['uniqueid']][_0x1af747][_0x3abd('0x48')]=_0x3abd('0x64');this[_0x3abd('0x9')][_0xfa1155[_0x3abd('0x29')]][_0x1af747][_0x3abd('0x54')]='abandoned';logger[_0x3abd('0x39')](_0x3abd('0x65'),_0xfa1155['uniqueid'],util[_0x3abd('0x2d')](this['channels'][_0xfa1155[_0x3abd('0x29')]][_0x1af747],{'showHidden':![],'depth':null}));ami['emit'](_0x3abd('0x66'),this[_0x3abd('0x9')][_0xfa1155['uniqueid']][_0x1af747]);}}}}}catch(_0x3df418){logger[_0x3abd('0x3f')]('[%s][voiceAgentReport][queuecallerabandon]',_0xfa1155[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x3df418,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x16')]=function(_0x3c9afd){try{if(this[_0x3abd('0x26')](_0x3c9afd)){logger['debug'](_0x3abd('0x67'),_0x3c9afd[_0x3abd('0x29')],util['inspect'](_0x3c9afd,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c9afd['uniqueid']]){for(var _0x412aef in this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]]){if(this[_0x3abd('0x9')][_0x3c9afd['uniqueid']][_0x3abd('0x40')](_0x412aef)){if(this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef]['agentconnectAt']&&!this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x15')]){logger[_0x3abd('0x27')](_0x3abd('0x68'),_0x3c9afd[_0x3abd('0x29')],this[_0x3abd('0x9')][_0x3c9afd['uniqueid']][_0x412aef][_0x3abd('0x2a')],_0x412aef);this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x15')]=!![];this[_0x3abd('0x9')][_0x3c9afd['uniqueid']][_0x412aef][_0x3abd('0x69')]=moment()[_0x3abd('0x31')](_0x3abd('0x32'));this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef]['lastevent']=_0x3abd('0x6a');this['channels'][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x54')]=_0x3c9afd['reason']=='transfer'?_0x3abd('0x6b'):_0x3c9afd[_0x3abd('0x54')];this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x6c')]=_0x3c9afd['talktime'];if(this[_0x3abd('0xa')][_0x3c9afd['queue']]&&this['voiceQueues'][_0x3c9afd[_0x3abd('0x2f')]][_0x3abd('0x6d')]){this[_0x3abd('0x9')][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x6e')]=this[_0x3abd('0xa')][_0x3c9afd[_0x3abd('0x2f')]]['acwTimeout'];this['channels'][_0x3c9afd[_0x3abd('0x29')]][_0x412aef][_0x3abd('0x6f')]=!![];}this[_0x3abd('0xb')][_0x3c9afd[_0x3abd('0x2e')]]=_['omit'](this[_0x3abd('0xb')][_0x3c9afd['interface']],[_0x3abd('0x2f'),_0x3abd('0x4c')]);logger[_0x3abd('0x39')](_0x3abd('0x70'),_0x3c9afd[_0x3abd('0x29')],util[_0x3abd('0x2d')](this[_0x3abd('0x9')][_0x3c9afd['uniqueid']][_0x412aef],{'showHidden':![],'depth':null}));ami[_0x3abd('0x24')]('custom:agentcomplete',this['channels'][_0x3c9afd[_0x3abd('0x29')]][_0x412aef]);logger[_0x3abd('0x39')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3c9afd[_0x3abd('0x29')],util['inspect']({'id':this[_0x3abd('0xb')][_0x3c9afd[_0x3abd('0x2e')]]['id'],'destaccountcode':_0x3c9afd[_0x3abd('0x71')]},{'showHidden':![],'depth':null}));this[_0x3abd('0x24')](util[_0x3abd('0x31')]('user:%s',_0x3c9afd[_0x3abd('0x2a')]),_0x3abd('0x72'),{'id':this[_0x3abd('0xb')][_0x3c9afd[_0x3abd('0x2e')]]['id'],'destaccountcode':Number(_0x3c9afd[_0x3abd('0x71')])});}}}}}}catch(_0x486707){logger[_0x3abd('0x3f')]('[%s][voiceAgentReport][agentcomplete]',_0x3c9afd[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x486707,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')]['syncVarSet']=function(_0x133e21){try{if(this[_0x3abd('0x26')](_0x133e21)){logger['debug'](_0x3abd('0x73'),_0x133e21[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x133e21,{'showHidden':![],'depth':null}));this[_0x3abd('0x74')](_0x133e21[_0x3abd('0x29')],_[_0x3abd('0x75')](_0x133e21[_0x3abd('0x76')])[0x0],_0x133e21[_0x3abd('0x77')]);if(this[_0x3abd('0x9')][_0x133e21['uniqueid']]){for(var _0x4fce73 in this[_0x3abd('0x9')][_0x133e21[_0x3abd('0x29')]]){if(this[_0x3abd('0x9')][_0x133e21[_0x3abd('0x29')]][_0x3abd('0x40')](_0x4fce73)){logger[_0x3abd('0x27')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x133e21[_0x3abd('0x29')],_0x4fce73,_[_0x3abd('0x75')](_0x133e21[_0x3abd('0x76')])[0x0],_0x133e21[_0x3abd('0x77')]);if(_[_0x3abd('0x25')](this['channels'][_0x133e21['uniqueid']][_0x4fce73][_0x3abd('0x30')])){this[_0x3abd('0x9')][_0x133e21[_0x3abd('0x29')]][_0x4fce73][_0x3abd('0x30')]={};}this['channels'][_0x133e21[_0x3abd('0x29')]][_0x4fce73][_0x3abd('0x30')]=this['variables'][_0x133e21[_0x3abd('0x29')]];}}}}}catch(_0x121c6d){logger[_0x3abd('0x3f')]('[%s][voiceAgentReport][varset]',_0x133e21[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x121c6d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x74')]=function(_0x296e75,_0x4d2fff,_0x3a9ec5){var _0x4507a7=['rtpaudioqos','rtpaudioqosbridged',_0x3abd('0x78'),_0x3abd('0x79'),_0x3abd('0x7a'),_0x3abd('0x7b'),'rtpaudioqosrtt',_0x3abd('0x7c'),_0x3abd('0x7d'),_0x3abd('0x7e'),_0x3abd('0x7f'),_0x3abd('0x80'),'membercalls',_0x3abd('0x81'),_0x3abd('0x82'),_0x3abd('0x83'),'membername',_0x3abd('0x84'),_0x3abd('0x85')];if(!_['isNil'](_0x4d2fff)&&!_[_0x3abd('0x86')](_0x4507a7,_0x4d2fff)){if(_[_0x3abd('0x25')](this[_0x3abd('0x30')][_0x296e75])){this['variables'][_0x296e75]={};}this['variables'][_0x296e75][_0x4d2fff]=_0x3a9ec5;}};VoiceAgentReport[_0x3abd('0x23')]['syncHangup']=function(_0x476417){try{if(this['isNotNull'](_0x476417)){logger[_0x3abd('0x39')](_0x3abd('0x87'),_0x476417['uniqueid'],util[_0x3abd('0x2d')](_0x476417,{'showHidden':![],'depth':null}));if(this[_0x3abd('0x9')][_0x476417[_0x3abd('0x29')]]){for(var _0x584dc1 in this['channels'][_0x476417[_0x3abd('0x29')]]){if(this[_0x3abd('0x9')][_0x476417[_0x3abd('0x29')]][_0x3abd('0x40')](_0x584dc1)){if(this['channels'][_0x476417['uniqueid']][_0x584dc1]['reason']=='transfer'&&this[_0x3abd('0x9')][_0x476417['uniqueid']][_0x584dc1][_0x3abd('0x15')]){logger[_0x3abd('0x27')](_0x3abd('0x88'),_0x476417[_0x3abd('0x29')],_0x584dc1);this['channels'][_0x476417[_0x3abd('0x29')]][_0x584dc1][_0x3abd('0x69')]=moment()[_0x3abd('0x31')](_0x3abd('0x32'));}}}logger[_0x3abd('0x39')](_0x3abd('0x89'),_0x476417[_0x3abd('0x29')],util[_0x3abd('0x2d')](_[_0x3abd('0x8a')](this[_0x3abd('0x9')][_0x476417[_0x3abd('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x3abd('0x24')](_0x3abd('0x8b'),_[_0x3abd('0x8a')](this[_0x3abd('0x9')][_0x476417[_0x3abd('0x29')]]));delete this[_0x3abd('0x9')][_0x476417[_0x3abd('0x29')]];}if(this[_0x3abd('0x30')][_0x476417[_0x3abd('0x29')]]){delete this[_0x3abd('0x30')][_0x476417[_0x3abd('0x29')]];}}}catch(_0x2252af){logger['error'](_0x3abd('0x8c'),_0x476417[_0x3abd('0x29')],util['inspect'](_0x2252af,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')][_0x3abd('0x20')]=function(_0x123639){try{if(this[_0x3abd('0x26')](_0x123639)){logger[_0x3abd('0x39')](_0x3abd('0x8d'),_0x123639[_0x3abd('0x29')],util['inspect'](_0x123639,{'showHidden':![],'depth':null}));if(this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]]){for(var _0x5bf363 in this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]]){if(this[_0x3abd('0x9')][_0x123639['transfereeuniqueid']][_0x3abd('0x40')](_0x5bf363)){if(_0x123639[_0x3abd('0x8f')]===_0x5bf363){logger[_0x3abd('0x27')](_0x3abd('0x90'),_0x123639['uniqueid'],this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x2a')],_0x5bf363);var _0x4fc1b5=moment();this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363]['agentcomplete']=!![];this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x69')]=moment()[_0x3abd('0x31')](_0x3abd('0x32'));this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x48')]=_0x3abd('0x6a');this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x54')]='transfer';this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x6c')]=_0x4fc1b5[_0x3abd('0x91')](this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]][_0x5bf363][_0x3abd('0x42')],'seconds');}}}}if(this[_0x3abd('0x9')][_0x123639['secondtransfereruniqueid']]){var _0x4d3df6=this[_0x3abd('0x9')][_0x123639[_0x3abd('0x92')]];this[_0x3abd('0x9')][_0x123639[_0x3abd('0x92')]]=this[_0x3abd('0x9')][_0x123639[_0x3abd('0x8e')]];this[_0x3abd('0x9')][_0x123639['transfereeuniqueid']]=_0x4d3df6;}}}catch(_0x5e3ddc){logger[_0x3abd('0x3f')](_0x3abd('0x93'),_0x123639[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x5e3ddc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3abd('0x23')]['syncBlindTransfer']=function(_0x49aa42){try{if(this[_0x3abd('0x26')](_0x49aa42)){logger[_0x3abd('0x39')](_0x3abd('0x94'),_0x49aa42[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x49aa42,{'showHidden':![],'depth':null}));if(this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]]){for(var _0x2fcf23 in this[_0x3abd('0x9')][_0x49aa42['transfereeuniqueid']]){if(this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]][_0x3abd('0x40')](_0x2fcf23)){if(_0x49aa42[_0x3abd('0x95')]===_0x2fcf23){logger['info'](_0x3abd('0x96'),_0x49aa42[_0x3abd('0x29')],this['channels'][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x2a')],_0x2fcf23);var _0x2d6275=moment();this['channels'][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x15')]=!![];this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x69')]=_0x2d6275;this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23]['lastevent']=_0x3abd('0x6a');this['channels'][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x54')]=_0x3abd('0x97');this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x6c')]=_0x2d6275[_0x3abd('0x91')](this[_0x3abd('0x9')][_0x49aa42[_0x3abd('0x8e')]][_0x2fcf23][_0x3abd('0x42')],_0x3abd('0x98'));}}}}}}catch(_0x47a775){logger[_0x3abd('0x3f')](_0x3abd('0x99'),_0x49aa42['uniqueid'],util['inspect'](_0x47a775,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3abd('0x1c')]=function(_0x59d247){var _0x2c67be='';try{if(this['isNotNull'](_0x59d247)){logger[_0x3abd('0x39')](_0x3abd('0x9a'),_0x59d247[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x59d247,{'showHidden':![],'depth':null}));if(_0x59d247[_0x3abd('0x9b')]){_0x2c67be=_0x59d247[_0x3abd('0x9b')][_0x3abd('0x9c')](0x0,_0x59d247['channel'][_0x3abd('0x9d')]('-'));if(this[_0x3abd('0xb')][_0x2c67be]){logger[_0x3abd('0x27')](_0x3abd('0x9e'),_0x59d247['uniqueid'],_0x2c67be);this[_0x3abd('0xb')][_0x2c67be]['onhold']=!![];}}}}catch(_0x21e357){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x59d247[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x21e357,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x31cc8a){var _0x5ae7f0='';try{if(this[_0x3abd('0x26')](_0x31cc8a)){logger[_0x3abd('0x39')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x31cc8a['uniqueid'],util['inspect'](_0x31cc8a,{'showHidden':![],'depth':null}));if(_0x31cc8a[_0x3abd('0x9b')]){_0x5ae7f0=_0x31cc8a[_0x3abd('0x9b')][_0x3abd('0x9c')](0x0,_0x31cc8a[_0x3abd('0x9b')][_0x3abd('0x9d')]('-'));if(this[_0x3abd('0xb')][_0x5ae7f0]){logger[_0x3abd('0x27')](_0x3abd('0x9f'),_0x31cc8a[_0x3abd('0x29')],_0x5ae7f0);this[_0x3abd('0xb')][_0x5ae7f0][_0x3abd('0xa0')]=![];}}}}catch(_0x53c0e9){logger[_0x3abd('0x3f')](_0x3abd('0xa1'),_0x31cc8a[_0x3abd('0x29')],util[_0x3abd('0x2d')](_0x53c0e9,{'showHidden':![],'depth':null}));}};module[_0x3abd('0xa2')]=VoiceAgentReport; \ No newline at end of file +var _0xb4e1=['inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','inbound','voice','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','emit','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','pick','destconnectedlinenum','exten','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:%s','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','variable','keys','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lodash','moment','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:'];(function(_0x533d7b,_0x3ce49d){var _0x3818fd=function(_0x59ebdf){while(--_0x59ebdf){_0x533d7b['push'](_0x533d7b['shift']());}};_0x3818fd(++_0x3ce49d);}(_0xb4e1,0x1b3));var _0x1b4e=function(_0x35b336,_0x347d1c){_0x35b336=_0x35b336-0x0;var _0x51d28c=_0xb4e1[_0x35b336];return _0x51d28c;};'use strict';var _=require(_0x1b4e('0x0'));var moment=require(_0x1b4e('0x1'));var util=require(_0x1b4e('0x2'));var Redis=require('ioredis');var config=require(_0x1b4e('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config['redis']=_[_0x1b4e('0x4')](config['redis'],{'host':_0x1b4e('0x5'),'port':0x18eb});var io=require(_0x1b4e('0x6'))(new Redis(config[_0x1b4e('0x7')]));function VoiceAgentReport(_0x4a69eb){this[_0x1b4e('0x8')]={};this[_0x1b4e('0x9')]=_0x4a69eb[_0x1b4e('0x8')];this[_0x1b4e('0xa')]=_0x4a69eb[_0x1b4e('0xa')];this['agents']=_0x4a69eb[_0x1b4e('0xb')];this[_0x1b4e('0xc')]={};ami['on'](_0x1b4e('0xd'),this[_0x1b4e('0xe')]['bind'](this));ami['on'](_0x1b4e('0xf'),this['syncAgentConnect'][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x11'),this[_0x1b4e('0x12')][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x13'),this[_0x1b4e('0x14')][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x15'),this[_0x1b4e('0x16')]['bind'](this));ami['on'](_0x1b4e('0x17'),this[_0x1b4e('0x18')][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x19'),this[_0x1b4e('0x1a')][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x1b'),this['syncMusicOnHoldStart'][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x1c'),this[_0x1b4e('0x1d')][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x1e'),this['syncAttendedTransfer'][_0x1b4e('0x10')](this));ami['on'](_0x1b4e('0x1f'),this['syncBlindTransfer'][_0x1b4e('0x10')](this));}VoiceAgentReport[_0x1b4e('0x20')]['emit']=function(_0x3766fb,_0x54aefa,_0x309ec3){io['to'](_0x3766fb)['emit'](_0x54aefa,_0x309ec3);};VoiceAgentReport['prototype'][_0x1b4e('0x21')]=function(_0x2d23ac){return _0x2d23ac!==null&&!_[_0x1b4e('0x22')](_0x2d23ac);};VoiceAgentReport[_0x1b4e('0x20')][_0x1b4e('0xe')]=function(_0x4ab303){try{if(this['isNotNull'](_0x4ab303)){logger[_0x1b4e('0x23')](_0x1b4e('0x24'),_0x4ab303[_0x1b4e('0x25')],_0x4ab303[_0x1b4e('0x26')],_0x4ab303[_0x1b4e('0x27')]);logger[_0x1b4e('0x28')](_0x1b4e('0x29'),_0x4ab303[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x4ab303,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x4ab303[_0x1b4e('0x25')]])){this[_0x1b4e('0x8')][_0x4ab303[_0x1b4e('0x25')]]={};}var _0x1d25d0=this['agents'][_0x4ab303[_0x1b4e('0x2b')]];var _0x2ad326=this[_0x1b4e('0x8')][_0x4ab303[_0x1b4e('0x25')]][_0x4ab303['destuniqueid']];var _0x15c6fd=this['voiceQueues'][_0x4ab303[_0x1b4e('0x2c')]];var _0x2debc5=this[_0x1b4e('0xc')][_0x4ab303[_0x1b4e('0x25')]];if(_[_0x1b4e('0x22')](_0x2ad326)){_0x2ad326={'agentcalledAt':moment()[_0x1b4e('0x2d')](_0x1b4e('0x2e')),'lastevent':_0x1b4e('0x2f'),'mandatoryDisposition':_0x15c6fd&&_0x15c6fd[_0x1b4e('0x30')]?_0x15c6fd[_0x1b4e('0x30')]:![],'type':_0x15c6fd&&_0x15c6fd['type']?_0x15c6fd['type']:_0x1b4e('0x31'),'variables':_0x2debc5,'motionChannel':_0x1b4e('0x32')};}Object['assign'](_0x2ad326,_[_0x1b4e('0x33')](_0x4ab303,[_0x1b4e('0x34'),'privilege']));this[_0x1b4e('0x8')][_0x4ab303['uniqueid']][_0x4ab303[_0x1b4e('0x27')]]=_0x2ad326;logger[_0x1b4e('0x28')](_0x1b4e('0x35'),_0x4ab303[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x2ad326,{'showHidden':![],'depth':null}));ami[_0x1b4e('0x36')](_0x1b4e('0x37'),_0x2ad326);var _0x1a574e={'id':_0x1d25d0['id'],'calleridnum':_0x2ad326[_0x1b4e('0x38')],'queue':_0x2ad326[_0x1b4e('0x2c')],'variables':_0x2ad326[_0x1b4e('0xc')],'uniqueid':_0x4ab303[_0x1b4e('0x25')]};logger[_0x1b4e('0x28')](_0x1b4e('0x39'),_0x4ab303['uniqueid'],util[_0x1b4e('0x2a')](_0x1a574e,{'showHidden':![],'depth':null}));this[_0x1b4e('0x36')](util[_0x1b4e('0x2d')]('user:%s',_0x4ab303[_0x1b4e('0x26')]),_0x1b4e('0x3a'),_0x1a574e);}}catch(_0x51a464){logger[_0x1b4e('0x3b')](_0x1b4e('0x3c'),_0x4ab303[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x51a464,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')][_0x1b4e('0x3d')]=function(_0x53a423){try{if(this[_0x1b4e('0x21')](_0x53a423)){if(this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]]){for(var _0x12bf08 in this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]]){if(this[_0x1b4e('0x8')][_0x53a423['uniqueid']][_0x1b4e('0x3e')](_0x12bf08)){if(_0x53a423['destuniqueid']===_0x12bf08){logger[_0x1b4e('0x23')](_0x1b4e('0x3f'),_0x53a423[_0x1b4e('0x25')],_0x53a423['membername'],_0x53a423[_0x1b4e('0x27')]);this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x40')]=moment()['format'](_0x1b4e('0x2e'));this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08]['connectedlinename']=_0x53a423[_0x1b4e('0x41')];this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x42')]=_0x53a423[_0x1b4e('0x42')];this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x12bf08]['destchannelstate']=_0x53a423[_0x1b4e('0x43')];this[_0x1b4e('0x8')][_0x53a423['uniqueid']][_0x12bf08][_0x1b4e('0x44')]=_0x53a423['destchannelstatedesc'];this[_0x1b4e('0x8')][_0x53a423['uniqueid']][_0x12bf08][_0x1b4e('0x45')]=_0x53a423['holdtime'];this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x46')]=_0x1b4e('0x47');if(this[_0x1b4e('0x9')][this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08]['uniqueid']]){var _0x9d21ac=this['voiceChannels'][this['channels'][_0x53a423['uniqueid']][_0x12bf08][_0x1b4e('0x25')]][_0x1b4e('0x48')];this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x48')]=_0x9d21ac;_0x53a423[_0x1b4e('0x48')]=_0x9d21ac;}_[_0x1b4e('0x49')](this['agents'][_0x53a423['interface']],_[_0x1b4e('0x4a')](_0x53a423,[_0x1b4e('0x2c'),_0x1b4e('0x4b'),_0x1b4e('0x48')]));var _0x5414e9=this[_0x1b4e('0xb')][_0x53a423[_0x1b4e('0x2b')]];var _0x4b4213={'id':_0x5414e9['id'],'name':_0x5414e9['name'],'agentconnected':!![],'destaccountcode':_0x5414e9['accountcode'],'destconnectedlinenum':this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x53a423[_0x1b4e('0x27')]][_0x1b4e('0x4c')],'queue':this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x53a423['destuniqueid']]['queue'],'routealias':this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x53a423['destuniqueid']]['routealias'],'uniqueid':this[_0x1b4e('0x8')][_0x53a423['uniqueid']][_0x53a423[_0x1b4e('0x27')]][_0x1b4e('0x25')]};ami[_0x1b4e('0x36')]('custom:agentconnect',this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x53a423['destuniqueid']]);this['emit'](util[_0x1b4e('0x2d')]('user:%s',_0x53a423['membername']),_0x1b4e('0x4d'),_0x4b4213);}else if(!this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x11')]&&!this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x15')]){logger['info'](_0x1b4e('0x4e'),_0x53a423[_0x1b4e('0x25')],this['channels'][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x26')],_0x12bf08);this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x11')]=!![];this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08]['agentringnoanswerAt']=moment()[_0x1b4e('0x2d')](_0x1b4e('0x2e'));this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x4f')]=_0x53a423['destuniqueid'];this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x50')]=_0x53a423[_0x1b4e('0x26')];this['channels'][_0x53a423['uniqueid']][_0x12bf08]['lastevent']=_0x1b4e('0x51');this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08][_0x1b4e('0x52')]=_0x1b4e('0x51');logger[_0x1b4e('0x28')](_0x1b4e('0x53'),_0x53a423[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08],{'showHidden':![],'depth':null}));ami[_0x1b4e('0x36')](_0x1b4e('0x54'),this[_0x1b4e('0x8')][_0x53a423[_0x1b4e('0x25')]][_0x12bf08]);}else{logger[_0x1b4e('0x28')](_0x1b4e('0x55'),_0x53a423[_0x1b4e('0x25')]);}}}}}}catch(_0x397aea){logger[_0x1b4e('0x3b')](_0x1b4e('0x56'),_0x53a423[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x397aea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')][_0x1b4e('0x12')]=function(_0x46007c){try{if(this['isNotNull'](_0x46007c)){logger['debug'](_0x1b4e('0x57'),_0x46007c[_0x1b4e('0x25')],util['inspect'](_0x46007c,{'showHidden':![],'depth':null}));if(this['channels'][_0x46007c['uniqueid']]&&this[_0x1b4e('0x8')][_0x46007c['uniqueid']][_0x46007c[_0x1b4e('0x27')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x46007c[_0x1b4e('0x25')],_0x46007c['membername'],_0x46007c[_0x1b4e('0x27')]);var _0x41ae3d=this[_0x1b4e('0xb')][_0x46007c[_0x1b4e('0x2b')]];var _0x99c921=this[_0x1b4e('0x8')][_0x46007c['uniqueid']][_0x46007c['destuniqueid']];_0x99c921[_0x1b4e('0x11')]=!![];_0x99c921[_0x1b4e('0x58')]=moment()[_0x1b4e('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x99c921[_0x1b4e('0x46')]='rejected';_0x99c921[_0x1b4e('0x52')]=_0x1b4e('0x59');var _0xb21d4={'id':_0x41ae3d['id'],'name':_0x41ae3d['name'],'queue':_0x99c921['queue'],'uniqueid':_0x99c921[_0x1b4e('0x25')]};logger[_0x1b4e('0x28')](_0x1b4e('0x5a'),_0x46007c[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0xb21d4,{'showHidden':![],'depth':null}));this[_0x1b4e('0x36')](util[_0x1b4e('0x2d')]('user:%s',_0x41ae3d[_0x1b4e('0x5b')]),_0x1b4e('0x5c'),_0xb21d4);ami[_0x1b4e('0x36')](_0x1b4e('0x5d'),_0x99c921);this[_0x1b4e('0x8')][_0x46007c[_0x1b4e('0x25')]][_0x46007c[_0x1b4e('0x27')]]=Object[_0x1b4e('0x5e')]({},_0x99c921);}}}catch(_0x49963a){logger[_0x1b4e('0x3b')](_0x1b4e('0x5f'),_0x46007c[_0x1b4e('0x25')],util['inspect'](_0x49963a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1b4e('0x14')]=function(_0xec09ca){try{if(this['isNotNull'](_0xec09ca)){logger['debug'](_0x1b4e('0x60'),_0xec09ca[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0xec09ca,{'showHidden':![],'depth':null}));if(this['channels'][_0xec09ca['uniqueid']]){for(var _0x3dab4f in this['channels'][_0xec09ca[_0x1b4e('0x25')]]){if(this['channels'][_0xec09ca[_0x1b4e('0x25')]][_0x1b4e('0x3e')](_0x3dab4f)&&!this[_0x1b4e('0x8')][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f][_0x1b4e('0x11')]&&!this[_0x1b4e('0x8')][_0xec09ca['uniqueid']][_0x3dab4f][_0x1b4e('0x15')]){logger[_0x1b4e('0x23')](_0x1b4e('0x61'),_0xec09ca['uniqueid'],this[_0x1b4e('0x8')][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f]['membername'],_0x3dab4f);this[_0x1b4e('0x8')][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f][_0x1b4e('0x11')]=!![];this['channels'][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f][_0x1b4e('0x58')]=moment()['format'](_0x1b4e('0x2e'));this['channels'][_0xec09ca['uniqueid']][_0x3dab4f][_0x1b4e('0x46')]=_0x1b4e('0x62');this[_0x1b4e('0x8')][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f]['reason']=_0x1b4e('0x62');logger['debug'](_0x1b4e('0x63'),_0xec09ca['uniqueid'],util['inspect'](this[_0x1b4e('0x8')][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f],{'showHidden':![],'depth':null}));ami['emit'](_0x1b4e('0x64'),this['channels'][_0xec09ca[_0x1b4e('0x25')]][_0x3dab4f]);}}}}}catch(_0x59aac0){logger[_0x1b4e('0x3b')](_0x1b4e('0x65'),_0xec09ca[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x59aac0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x582743){try{if(this[_0x1b4e('0x21')](_0x582743)){logger[_0x1b4e('0x28')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x582743['uniqueid'],util[_0x1b4e('0x2a')](_0x582743,{'showHidden':![],'depth':null}));if(this['channels'][_0x582743[_0x1b4e('0x25')]]){for(var _0x23c82a in this['channels'][_0x582743[_0x1b4e('0x25')]]){if(this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x1b4e('0x3e')](_0x23c82a)){if(this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x40')]&&!this['channels'][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x15')]){logger['info'](_0x1b4e('0x66'),_0x582743[_0x1b4e('0x25')],this['channels'][_0x582743['uniqueid']][_0x23c82a][_0x1b4e('0x26')],_0x23c82a);this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x15')]=!![];this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x67')]=moment()[_0x1b4e('0x2d')](_0x1b4e('0x2e'));this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x46')]=_0x1b4e('0x68');this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x52')]=_0x582743[_0x1b4e('0x52')]==_0x1b4e('0x69')?_0x1b4e('0x6a'):_0x582743[_0x1b4e('0x52')];this[_0x1b4e('0x8')][_0x582743['uniqueid']][_0x23c82a][_0x1b4e('0x6b')]=_0x582743['talktime'];if(this['voiceQueues'][_0x582743[_0x1b4e('0x2c')]]&&this[_0x1b4e('0xa')][_0x582743[_0x1b4e('0x2c')]][_0x1b4e('0x6c')]){this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a][_0x1b4e('0x6d')]=this[_0x1b4e('0xa')][_0x582743['queue']]['acwTimeout'];this['channels'][_0x582743['uniqueid']][_0x23c82a]['agentacw']=!![];}this[_0x1b4e('0xb')][_0x582743[_0x1b4e('0x2b')]]=_['omit'](this[_0x1b4e('0xb')][_0x582743[_0x1b4e('0x2b')]],[_0x1b4e('0x2c'),_0x1b4e('0x4b')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x582743[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a],{'showHidden':![],'depth':null}));ami[_0x1b4e('0x36')]('custom:agentcomplete',this[_0x1b4e('0x8')][_0x582743[_0x1b4e('0x25')]][_0x23c82a]);logger[_0x1b4e('0x28')](_0x1b4e('0x6e'),_0x582743[_0x1b4e('0x25')],util[_0x1b4e('0x2a')]({'id':this[_0x1b4e('0xb')][_0x582743[_0x1b4e('0x2b')]]['id'],'destaccountcode':_0x582743[_0x1b4e('0x6f')]},{'showHidden':![],'depth':null}));this[_0x1b4e('0x36')](util['format'](_0x1b4e('0x70'),_0x582743[_0x1b4e('0x26')]),_0x1b4e('0x71'),{'id':this[_0x1b4e('0xb')][_0x582743['interface']]['id'],'destaccountcode':Number(_0x582743[_0x1b4e('0x6f')])});}}}}}}catch(_0x4c20f5){logger[_0x1b4e('0x3b')]('[%s][voiceAgentReport][agentcomplete]',_0x582743[_0x1b4e('0x25')],util['inspect'](_0x4c20f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1b4e('0x18')]=function(_0x5ddd4d){try{if(this['isNotNull'](_0x5ddd4d)){logger['debug'](_0x1b4e('0x72'),_0x5ddd4d[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x5ddd4d,{'showHidden':![],'depth':null}));this['addVariable'](_0x5ddd4d[_0x1b4e('0x25')],_['keys'](_0x5ddd4d[_0x1b4e('0x73')])[0x0],_0x5ddd4d['value']);if(this[_0x1b4e('0x8')][_0x5ddd4d[_0x1b4e('0x25')]]){for(var _0x31dfd6 in this['channels'][_0x5ddd4d[_0x1b4e('0x25')]]){if(this['channels'][_0x5ddd4d[_0x1b4e('0x25')]]['hasOwnProperty'](_0x31dfd6)){logger[_0x1b4e('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x5ddd4d[_0x1b4e('0x25')],_0x31dfd6,_[_0x1b4e('0x74')](_0x5ddd4d[_0x1b4e('0x73')])[0x0],_0x5ddd4d[_0x1b4e('0x75')]);if(_[_0x1b4e('0x22')](this[_0x1b4e('0x8')][_0x5ddd4d['uniqueid']][_0x31dfd6][_0x1b4e('0xc')])){this[_0x1b4e('0x8')][_0x5ddd4d[_0x1b4e('0x25')]][_0x31dfd6][_0x1b4e('0xc')]={};}this['channels'][_0x5ddd4d[_0x1b4e('0x25')]][_0x31dfd6]['variables']=this[_0x1b4e('0xc')][_0x5ddd4d[_0x1b4e('0x25')]];}}}}}catch(_0x3dce3f){logger['error'](_0x1b4e('0x76'),_0x5ddd4d[_0x1b4e('0x25')],util['inspect'](_0x3dce3f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')]['addVariable']=function(_0x2054a3,_0x4206b2,_0x1eaa16){var _0x3d686d=[_0x1b4e('0x77'),_0x1b4e('0x78'),_0x1b4e('0x79'),'rtpaudioqosjitterbridged',_0x1b4e('0x7a'),_0x1b4e('0x7b'),_0x1b4e('0x7c'),_0x1b4e('0x7d'),'sipcallid',_0x1b4e('0x7e'),_0x1b4e('0x7f'),'bridgepvtcallid',_0x1b4e('0x80'),_0x1b4e('0x81'),_0x1b4e('0x82'),_0x1b4e('0x83'),'membername',_0x1b4e('0x84'),'memberrealtime'];if(!_['isNil'](_0x4206b2)&&!_[_0x1b4e('0x85')](_0x3d686d,_0x4206b2)){if(_[_0x1b4e('0x22')](this['variables'][_0x2054a3])){this[_0x1b4e('0xc')][_0x2054a3]={};}this[_0x1b4e('0xc')][_0x2054a3][_0x4206b2]=_0x1eaa16;}};VoiceAgentReport[_0x1b4e('0x20')][_0x1b4e('0x1a')]=function(_0x9190d9){try{if(this[_0x1b4e('0x21')](_0x9190d9)){logger[_0x1b4e('0x28')](_0x1b4e('0x86'),_0x9190d9[_0x1b4e('0x25')],util['inspect'](_0x9190d9,{'showHidden':![],'depth':null}));if(this['channels'][_0x9190d9[_0x1b4e('0x25')]]){for(var _0x4c8057 in this[_0x1b4e('0x8')][_0x9190d9[_0x1b4e('0x25')]]){if(this[_0x1b4e('0x8')][_0x9190d9[_0x1b4e('0x25')]][_0x1b4e('0x3e')](_0x4c8057)){if(this[_0x1b4e('0x8')][_0x9190d9[_0x1b4e('0x25')]][_0x4c8057][_0x1b4e('0x52')]==_0x1b4e('0x69')&&this['channels'][_0x9190d9[_0x1b4e('0x25')]][_0x4c8057]['agentcomplete']){logger[_0x1b4e('0x23')](_0x1b4e('0x87'),_0x9190d9[_0x1b4e('0x25')],_0x4c8057);this['channels'][_0x9190d9[_0x1b4e('0x25')]][_0x4c8057][_0x1b4e('0x67')]=moment()[_0x1b4e('0x2d')](_0x1b4e('0x2e'));}}}logger[_0x1b4e('0x28')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x9190d9[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_[_0x1b4e('0x88')](this['channels'][_0x9190d9[_0x1b4e('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x1b4e('0x36')](_0x1b4e('0x89'),_[_0x1b4e('0x88')](this[_0x1b4e('0x8')][_0x9190d9['uniqueid']]));delete this[_0x1b4e('0x8')][_0x9190d9[_0x1b4e('0x25')]];}if(this['variables'][_0x9190d9[_0x1b4e('0x25')]]){delete this[_0x1b4e('0xc')][_0x9190d9[_0x1b4e('0x25')]];}}}catch(_0x5ece15){logger['error'](_0x1b4e('0x8a'),_0x9190d9[_0x1b4e('0x25')],util['inspect'](_0x5ece15,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')]['syncAttendedTransfer']=function(_0x2c1bfe){try{if(this[_0x1b4e('0x21')](_0x2c1bfe)){logger[_0x1b4e('0x28')](_0x1b4e('0x8b'),_0x2c1bfe['uniqueid'],util[_0x1b4e('0x2a')](_0x2c1bfe,{'showHidden':![],'depth':null}));if(this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]]){for(var _0x2afc1f in this['channels'][_0x2c1bfe[_0x1b4e('0x8c')]]){if(this['channels'][_0x2c1bfe[_0x1b4e('0x8c')]][_0x1b4e('0x3e')](_0x2afc1f)){if(_0x2c1bfe[_0x1b4e('0x8d')]===_0x2afc1f){logger[_0x1b4e('0x23')](_0x1b4e('0x8e'),_0x2c1bfe[_0x1b4e('0x25')],this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f][_0x1b4e('0x26')],_0x2afc1f);var _0x2cc466=moment();this['channels'][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f]['agentcomplete']=!![];this['channels'][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f][_0x1b4e('0x67')]=moment()[_0x1b4e('0x2d')](_0x1b4e('0x2e'));this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f][_0x1b4e('0x46')]=_0x1b4e('0x68');this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f]['reason']=_0x1b4e('0x69');this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f][_0x1b4e('0x6b')]=_0x2cc466[_0x1b4e('0x8f')](this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]][_0x2afc1f][_0x1b4e('0x40')],'seconds');}}}}if(this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x90')]]){var _0xe21cad=this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x90')]];this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x90')]]=this[_0x1b4e('0x8')][_0x2c1bfe[_0x1b4e('0x8c')]];this[_0x1b4e('0x8')][_0x2c1bfe['transfereeuniqueid']]=_0xe21cad;}}}catch(_0x37c4e9){logger[_0x1b4e('0x3b')](_0x1b4e('0x91'),_0x2c1bfe[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x37c4e9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')][_0x1b4e('0x92')]=function(_0x14b0c4){try{if(this[_0x1b4e('0x21')](_0x14b0c4)){logger[_0x1b4e('0x28')](_0x1b4e('0x93'),_0x14b0c4['uniqueid'],util[_0x1b4e('0x2a')](_0x14b0c4,{'showHidden':![],'depth':null}));if(this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]]){for(var _0x1290fd in this['channels'][_0x14b0c4['transfereeuniqueid']]){if(this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]]['hasOwnProperty'](_0x1290fd)){if(_0x14b0c4[_0x1b4e('0x94')]===_0x1290fd){logger[_0x1b4e('0x23')](_0x1b4e('0x95'),_0x14b0c4[_0x1b4e('0x25')],this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x26')],_0x1290fd);var _0x530c4c=moment();this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x15')]=!![];this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x67')]=_0x530c4c;this['channels'][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd]['lastevent']='complete';this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x52')]=_0x1b4e('0x69');this[_0x1b4e('0x8')][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x6b')]=_0x530c4c[_0x1b4e('0x8f')](this['channels'][_0x14b0c4[_0x1b4e('0x8c')]][_0x1290fd][_0x1b4e('0x40')],_0x1b4e('0x96'));}}}}}}catch(_0xa5ebbe){logger[_0x1b4e('0x3b')]('[%s][voiceAgentReport][blindtransfer]',_0x14b0c4['uniqueid'],util[_0x1b4e('0x2a')](_0xa5ebbe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')]['syncMusicOnHoldStart']=function(_0x1c86f4){var _0x2df4a9='';try{if(this[_0x1b4e('0x21')](_0x1c86f4)){logger[_0x1b4e('0x28')](_0x1b4e('0x97'),_0x1c86f4[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x1c86f4,{'showHidden':![],'depth':null}));if(_0x1c86f4[_0x1b4e('0x98')]){_0x2df4a9=_0x1c86f4[_0x1b4e('0x98')][_0x1b4e('0x99')](0x0,_0x1c86f4[_0x1b4e('0x98')][_0x1b4e('0x9a')]('-'));if(this[_0x1b4e('0xb')][_0x2df4a9]){logger[_0x1b4e('0x23')](_0x1b4e('0x9b'),_0x1c86f4[_0x1b4e('0x25')],_0x2df4a9);this[_0x1b4e('0xb')][_0x2df4a9][_0x1b4e('0x9c')]=!![];}}}}catch(_0x2fcb51){logger[_0x1b4e('0x3b')](_0x1b4e('0x9d'),_0x1c86f4[_0x1b4e('0x25')],util[_0x1b4e('0x2a')](_0x2fcb51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b4e('0x20')]['syncMusicOnHoldStop']=function(_0x4a06bf){var _0x2a8a53='';try{if(this[_0x1b4e('0x21')](_0x4a06bf)){logger[_0x1b4e('0x28')](_0x1b4e('0x9e'),_0x4a06bf['uniqueid'],util[_0x1b4e('0x2a')](_0x4a06bf,{'showHidden':![],'depth':null}));if(_0x4a06bf['channel']){_0x2a8a53=_0x4a06bf[_0x1b4e('0x98')][_0x1b4e('0x99')](0x0,_0x4a06bf[_0x1b4e('0x98')][_0x1b4e('0x9a')]('-'));if(this['agents'][_0x2a8a53]){logger[_0x1b4e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x4a06bf[_0x1b4e('0x25')],_0x2a8a53);this[_0x1b4e('0xb')][_0x2a8a53][_0x1b4e('0x9c')]=![];}}}}catch(_0x4ad5ff){logger[_0x1b4e('0x3b')]('[%s][voiceAgentReport][musiconholdstop]',_0x4a06bf[_0x1b4e('0x25')],util['inspect'](_0x4ad5ff,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 937a3e1..3e6a0e0 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 _0x061c=['name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','set','cdr(','split','match','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','diff','connectedlinename','destinationchannel','membername','holdtime','toNumber','channelstate','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','error','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','answertime','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','transferToInternal','isEmpty','getSettings','then','catch','StopMixMonitor','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','newexten','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x061c,0x7b));var _0xc061=function(_0x37391f,_0x57b31a){_0x37391f=_0x37391f-0x0;var _0x1afd4d=_0x061c[_0x37391f];return _0x1afd4d;};'use strict';var _=require(_0xc061('0x0'));var moment=require('moment');var util=require(_0xc061('0x1'));var path=require(_0xc061('0x2'));var Redis=require(_0xc061('0x3'));var config=require(_0xc061('0x4'));var logger=require(_0xc061('0x5'))(_0xc061('0x6'));var ami=require(_0xc061('0x7'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=['set',_0xc061('0x8'),_0xc061('0x9'),_0xc061('0xa'),_0xc061('0xb'),_0xc061('0xc')];var dispositions=[_0xc061('0xd'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xc061('0xe'),_0xc061('0xf'),'FAILED',_0xc061('0x10'),'FAILED'];config[_0xc061('0x11')]=_[_0xc061('0x12')](config[_0xc061('0x11')],{'host':_0xc061('0x13'),'port':0x18eb});var io=require(_0xc061('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0xead7ed){this['channels']=_0xead7ed[_0xc061('0x15')];this['agents']=_0xead7ed[_0xc061('0x16')];this[_0xc061('0x17')]={};ami['on'](_0xc061('0x18'),this['syncNewExten']['bind'](this));ami['on'](_0xc061('0x19'),this[_0xc061('0x1a')][_0xc061('0x1b')](this));ami['on'](_0xc061('0x1c'),this[_0xc061('0x1d')][_0xc061('0x1b')](this));ami['on'](_0xc061('0x1e'),this[_0xc061('0x1f')][_0xc061('0x1b')](this));ami['on']('varset',this[_0xc061('0x20')]['bind'](this));ami['on'](_0xc061('0x21'),this[_0xc061('0x22')][_0xc061('0x1b')](this));ami['on'](_0xc061('0x23'),this[_0xc061('0x24')][_0xc061('0x1b')](this));ami['on'](_0xc061('0x25'),this[_0xc061('0x26')][_0xc061('0x1b')](this));ami['on'](_0xc061('0x27'),this[_0xc061('0x28')][_0xc061('0x1b')](this));ami['on']('musiconholdstart',this[_0xc061('0x29')]['bind'](this));ami['on'](_0xc061('0x2a'),this['syncMusicOnHoldStop'][_0xc061('0x1b')](this));try{logger[_0xc061('0x2b')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x1fb2f1){logger['error'](_0xc061('0x2c'),util[_0xc061('0x2d')](_0x1fb2f1,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xc061('0x2e')][_0xc061('0x2f')]=function(_0xccacb7){return _0xccacb7!==null&&!_[_0xc061('0x30')](_0xccacb7);};VoiceCallReport['prototype'][_0xc061('0x31')]=function(_0x3d45a9,_0xf7a82,_0x4d645e){io['to'](_0x3d45a9)[_0xc061('0x31')](_0xf7a82,_0x4d645e);};VoiceCallReport[_0xc061('0x2e')][_0xc061('0x24')]=function(_0x5c6b28){try{if(this['isNotNull'](_0x5c6b28)){logger['info'](_0xc061('0x32'),_0x5c6b28[_0xc061('0x33')],_0x5c6b28[_0xc061('0x34')],_0x5c6b28['calleridnum']);logger[_0xc061('0x35')](_0xc061('0x36'),_0x5c6b28[_0xc061('0x33')],util[_0xc061('0x2d')](_0x5c6b28,{'showHidden':![],'depth':null}));if(_0x5c6b28['uniqueid']===_0x5c6b28[_0xc061('0x37')]){if(!_['isUndefined'](this[_0xc061('0x15')][_0x5c6b28['uniqueid']])){_[_0xc061('0x38')](this[_0xc061('0x15')][_0x5c6b28[_0xc061('0x33')]],_[_0xc061('0x39')](_0x5c6b28,_[_0xc061('0x3a')](this[_0xc061('0x15')][_0x5c6b28[_0xc061('0x33')]])));}}if(_0x5c6b28[_0xc061('0x3b')]===_0xc061('0x3c')){var _0x5ae7f9=this[_0xc061('0x16')][_0x5c6b28[_0xc061('0x3d')]['split']('-')[0x0]];if(_0x5ae7f9){if(_0x5c6b28[_0xc061('0x3e')]==_0xc061('0x3f')){_0x5ae7f9[_0xc061('0x40')]=_0x5c6b28[_0xc061('0x41')];this[_0xc061('0x31')](util[_0xc061('0x42')]('user:%s',_0x5ae7f9['name']),_0xc061('0x43'),{'id':_0x5ae7f9['id'],'destaccountcode':_0x5ae7f9[_0xc061('0x44')],'destconnectedlinenum':_0x5c6b28[_0xc061('0x41')]});}}}}}catch(_0x30f5e9){logger['error']('[%s][voiceCallReport][newcallerid]',_0x5c6b28[_0xc061('0x33')],util[_0xc061('0x2d')](_0x30f5e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc061('0x2e')][_0xc061('0x1d')]=function(_0x398eef){try{if(this[_0xc061('0x2f')](_0x398eef)){logger['debug'](_0xc061('0x45'),_0x398eef[_0xc061('0x33')],util['inspect'](_0x398eef,{'showHidden':![],'depth':null}));if(this[_0xc061('0x15')][_0x398eef[_0xc061('0x33')]]){return;}if(_0x398eef['channel']===_0xc061('0x46')){return;}if(_0x398eef['uniqueid']!==_0x398eef[_0xc061('0x37')]&&!this[_0xc061('0x17')][_0x398eef[_0xc061('0x37')]]){return;}logger[_0xc061('0x2b')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x398eef[_0xc061('0x33')],_0x398eef[_0xc061('0x3b')],_0x398eef[_0xc061('0x3e')]);this[_0xc061('0x15')][_0x398eef[_0xc061('0x33')]]=new Channel();this[_0xc061('0x15')][_0x398eef['uniqueid']][_0xc061('0x47')]=moment()[_0xc061('0x42')](_0xc061('0x48'));this[_0xc061('0x15')][_0x398eef[_0xc061('0x33')]][_0xc061('0x49')]=dispositions[_['toNumber'](_0x398eef['channelstate'])];_[_0xc061('0x38')](this['channels'][_0x398eef[_0xc061('0x33')]],_[_0xc061('0x39')](_0x398eef,_['keys'](this['channels'][_0x398eef['uniqueid']])));if(_0x398eef[_0xc061('0x3b')]===_0xc061('0x3c')){var _0x34a39e=this['agents'][_0x398eef[_0xc061('0x3d')]['split']('-')[0x0]];if(_0x34a39e&&typeof _0x34a39e[_0xc061('0x40')]===_0xc061('0x4a')){_0x34a39e['destconnectedlinenum']=_0x398eef['exten'];logger[_0xc061('0x35')](_0xc061('0x4b'),_0x398eef[_0xc061('0x33')],util[_0xc061('0x2d')]({'id':_0x34a39e['id'],'destaccountcode':_0x34a39e['accountcode'],'destconnectedlinenum':_0x398eef[_0xc061('0x3e')]},{'showHidden':![],'depth':null}));this[_0xc061('0x31')](util[_0xc061('0x42')]('user:%s',_0x34a39e[_0xc061('0x4c')]),'user:agentconnect',{'id':_0x34a39e['id'],'destaccountcode':_0x34a39e[_0xc061('0x44')],'destconnectedlinenum':_0x398eef[_0xc061('0x3e')]});}}}}catch(_0xe0decd){logger['error'](_0xc061('0x4d'),_0x398eef['uniqueid'],util['inspect'](_0xe0decd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc061('0x1a')]=function(_0x3ab0c1){try{if(this['isNotNull'](_0x3ab0c1)){logger[_0xc061('0x35')](_0xc061('0x4e'),_0x3ab0c1['uniqueid'],util[_0xc061('0x2d')](_0x3ab0c1,{'showHidden':![],'depth':null}));if(_0x3ab0c1[_0xc061('0x3d')]===_0xc061('0x46')||_0x3ab0c1[_0xc061('0x3e')]==='h')return;if(_0x3ab0c1[_0xc061('0x33')]===_0x3ab0c1[_0xc061('0x37')]||this['blindTransfers'][_0x3ab0c1[_0xc061('0x37')]]){_0x3ab0c1[_0xc061('0x4f')]=_0x3ab0c1['application']?_0x3ab0c1['application'][_0xc061('0x50')]():undefined;_0x3ab0c1[_0xc061('0x51')]=_0x3ab0c1[_0xc061('0x52')]||_0x3ab0c1[_0xc061('0x51')];if(_0x3ab0c1[_0xc061('0x52')]&&!_0x3ab0c1[_0xc061('0x52')][_0xc061('0x53')]('CDR(routeAlias)')&&_0x3ab0c1[_0xc061('0x4f')]!==_0xc061('0x8')){_0x3ab0c1[_0xc061('0x51')]=_0x3ab0c1[_0xc061('0x51')]['toLowerCase']();}logger[_0xc061('0x2b')](_0xc061('0x54'),_0x3ab0c1[_0xc061('0x33')],_0x3ab0c1['application'],_0x3ab0c1[_0xc061('0x51')]);if(_[_0xc061('0x30')](this[_0xc061('0x15')][_0x3ab0c1['uniqueid']])){this[_0xc061('0x15')][_0x3ab0c1[_0xc061('0x33')]]=new Channel();this[_0xc061('0x15')][_0x3ab0c1['uniqueid']][_0xc061('0x47')]=_0x3ab0c1['duration']?moment()[_0xc061('0x55')](moment[_0xc061('0x56')](_0x3ab0c1[_0xc061('0x56')])[_0xc061('0x57')](),_0xc061('0x57'))[_0xc061('0x42')](_0xc061('0x48')):moment()[_0xc061('0x42')](_0xc061('0x48'));this['channels'][_0x3ab0c1[_0xc061('0x33')]]['disposition']=_0xc061('0xd');}_['merge'](this[_0xc061('0x15')][_0x3ab0c1[_0xc061('0x33')]],_[_0xc061('0x39')](_0x3ab0c1,_[_0xc061('0x3a')](this[_0xc061('0x15')][_0x3ab0c1[_0xc061('0x33')]])));if(_[_0xc061('0x58')](applications,_0x3ab0c1[_0xc061('0x4f')])){this[_0xc061('0x15')][_0x3ab0c1[_0xc061('0x33')]]['lastapplication']=_0x3ab0c1[_0xc061('0x4f')];this['channels'][_0x3ab0c1[_0xc061('0x33')]]['lastdata']=_0x3ab0c1[_0xc061('0x51')];if(_0x3ab0c1[_0xc061('0x4f')]===_0xc061('0x59')&&_[_0xc061('0x53')](_0x3ab0c1[_0xc061('0x51')][_0xc061('0x50')](),_0xc061('0x5a'))){var _0x53225a=_0x3ab0c1[_0xc061('0x51')][_0xc061('0x5b')]('=');var _0x21e60e=_0x53225a[0x0][_0xc061('0x50')]()[_0xc061('0x5c')](/cdr\((.*)\)/);if(_0x21e60e){if(_0x21e60e[0x1]===_0xc061('0x5d')&&!_['isNil'](this[_0xc061('0x15')][_0x3ab0c1[_0xc061('0x33')]][_0x21e60e[0x1]]))return;this[_0xc061('0x15')][_0x3ab0c1['uniqueid']][_0x21e60e[0x1]]=_0x53225a[0x1];}}else if(_0x3ab0c1[_0xc061('0x4f')]==='queue'){this[_0xc061('0x15')][_0x3ab0c1['uniqueid']][_0xc061('0x8')]=_0x3ab0c1[_0xc061('0x51')][_0xc061('0x5b')](',')[0x0];}}}}}catch(_0x9ee19d){logger['error'](_0xc061('0x5e'),_0x3ab0c1[_0xc061('0x33')],util[_0xc061('0x2d')](_0x9ee19d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc061('0x1f')]=function(_0xac9767){try{if(this['isNotNull'](_0xac9767)){logger[_0xc061('0x2b')](_0xc061('0x5f'),_0xac9767[_0xc061('0x33')],_0xac9767[_0xc061('0x37')],_0xac9767[_0xc061('0x34')],_0xac9767[_0xc061('0x60')]);logger[_0xc061('0x35')](_0xc061('0x61'),_0xac9767['uniqueid'],util['inspect'](_0xac9767,{'showHidden':![],'depth':null}));if(_0xac9767['channelstate']!=='6')return;var _0x1afde5=this[_0xc061('0x16')][_0xac9767['channel'][_0xc061('0x5b')]('-')[0x0]];if(_0xac9767[_0xc061('0x33')]!==_0xac9767[_0xc061('0x37')]){var _0x566fcb=moment();if(this['channels'][_0xac9767[_0xc061('0x37')]]){if(!this[_0xc061('0x15')][_0xac9767['linkedid']][_0xc061('0x62')]){this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x62')]=!![];this['channels'][_0xac9767[_0xc061('0x37')]]['answertime']=_0x566fcb['format'](_0xc061('0x48'));if(this['channels'][_0xac9767[_0xc061('0x37')]][_0xc061('0x47')]){this[_0xc061('0x15')][_0xac9767['linkedid']]['holdtime']=_0x566fcb[_0xc061('0x63')](this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x47')],_0xc061('0x57'));}}this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x37')]=_0xac9767[_0xc061('0x33')];if(_0xac9767[_0xc061('0x60')]!==_0xc061('0x3f')){this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x41')]=_0xac9767['calleridnum'];}this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x64')]=_0xac9767['calleridname'];this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x65')]=_0xac9767[_0xc061('0x3d')];this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x49')]=dispositions[_['toNumber'](_0xac9767['channelstate'])];if(_0x1afde5){this[_0xc061('0x15')][_0xac9767['linkedid']]['UserId']=_0x1afde5['id'];this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]][_0xc061('0x66')]=_0x1afde5[_0xc061('0x4c')];}}if(this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]]){if(!this['channels'][_0xac9767[_0xc061('0x33')]]['answered']){this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]]['answered']=!![];this['channels'][_0xac9767[_0xc061('0x33')]]['answertime']=_0x566fcb['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]][_0xc061('0x47')]){this['channels'][_0xac9767[_0xc061('0x33')]][_0xc061('0x67')]=_0x566fcb['diff'](this['channels'][_0xac9767[_0xc061('0x33')]][_0xc061('0x47')],'seconds');}}if(_0xac9767[_0xc061('0x60')]!=='xcally-motion-preview'){this[_0xc061('0x15')][_0xac9767['uniqueid']][_0xc061('0x41')]=_0xac9767[_0xc061('0x60')];}this['channels'][_0xac9767['uniqueid']][_0xc061('0x64')]=_0xac9767[_0xc061('0x34')];this[_0xc061('0x15')][_0xac9767['uniqueid']][_0xc061('0x65')]=_0xac9767[_0xc061('0x3d')];this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]][_0xc061('0x49')]=dispositions[_[_0xc061('0x68')](_0xac9767[_0xc061('0x69')])];}}else{if(this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]]){if(_0x1afde5){this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]]['UserId']=_0x1afde5['id'];this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]][_0xc061('0x66')]=_0x1afde5['name'];}}}if(_0xac9767[_0xc061('0x3b')]===_0xc061('0x3c')){if(_0x1afde5){_0x1afde5['destconnectedlinenum']=_0xac9767[_0xc061('0x3e')];var _0x22af81,_0x41eabc;if(this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]]){_0x22af81=this[_0xc061('0x15')][_0xac9767[_0xc061('0x33')]][_0xc061('0x6a')];_0x41eabc=this['channels'][_0xac9767['uniqueid']][_0xc061('0x8')];}else if(this[_0xc061('0x15')][_0xac9767[_0xc061('0x37')]]){_0x22af81=this[_0xc061('0x15')][_0xac9767['linkedid']][_0xc061('0x6a')];_0x41eabc=this['channels'][_0xac9767['linkedid']][_0xc061('0x8')];}_0x1afde5[_0xc061('0x8')]=_0x41eabc;_0x1afde5[_0xc061('0x6a')]=_0x22af81;var _0x512c82={'id':_0x1afde5['id'],'name':_0x1afde5[_0xc061('0x4c')],'agentconnected':!![],'destaccountcode':_0x1afde5[_0xc061('0x44')],'destconnectedlinenum':_0xac9767[_0xc061('0x3e')],'queue':_0x41eabc||undefined,'routealias':_0x22af81,'uniqueid':_0xac9767[_0xc061('0x37')]};logger[_0xc061('0x35')](_0xc061('0x6b'),_0xac9767['uniqueid'],util['inspect'](_0x512c82,{'showHidden':![],'depth':null}));this[_0xc061('0x31')](util[_0xc061('0x42')](_0xc061('0x6c'),_0x1afde5[_0xc061('0x4c')]),'user:agentconnect',_0x512c82);}}}}catch(_0x4c181e){logger[_0xc061('0x6d')](_0xc061('0x6e'),_0xac9767[_0xc061('0x33')],util[_0xc061('0x2d')](_0x4c181e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc061('0x2e')][_0xc061('0x6f')]=function(_0x3bec67,_0x4e8060){try{if(this['channels'][_0x3bec67]){logger[_0xc061('0x2b')](_0xc061('0x70'),_0x3bec67,_0x4e8060);this[_0xc061('0x15')][_0x3bec67][_0xc061('0x71')]=!![];if(_['endsWith'](_0x4e8060,_0xc061('0x72'))){_0x4e8060=_0x4e8060['replace'](_0xc061('0x72'),_0xc061('0x73'));}this[_0xc061('0x15')][_0x3bec67][_0xc061('0x74')]=_0x4e8060;var _0x531504=_['find'](this[_0xc061('0x15')][_0x3bec67]['monitors'],{'filename':_0x4e8060});if(_['isNil'](_0x531504)){this[_0xc061('0x15')][_0x3bec67][_0xc061('0x75')][_0xc061('0x76')]({'filename':_0x4e8060,'createdAt':moment()[_0xc061('0x42')](_0xc061('0x48')),'mixmonitorid':'','status':_0xc061('0x77')});}}}catch(_0x37b349){logger['error'](_0xc061('0x78'),_0x3bec67,util[_0xc061('0x2d')](_0x37b349,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc061('0x2e')][_0xc061('0x20')]=function(_0x2432c1){try{if(this[_0xc061('0x2f')](_0x2432c1)){logger[_0xc061('0x35')](_0xc061('0x79'),_0x2432c1[_0xc061('0x33')],util[_0xc061('0x2d')](_0x2432c1,{'showHidden':![],'depth':null}));if(this['channels'][_0x2432c1['uniqueid']]&&_0x2432c1[_0xc061('0x3d')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x2432c1[_0xc061('0x7a')])){if(this['isNotNull'](_0x2432c1[_0xc061('0x7a')]['mixmonitor_filename'])){logger[_0xc061('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2432c1['uniqueid'],_0x2432c1['value']);this['syncMixMonitorFilename'](_0x2432c1[_0xc061('0x33')],_0x2432c1['value']);}else if(this[_0xc061('0x2f')](_0x2432c1[_0xc061('0x7a')][_0xc061('0x7b')])){logger[_0xc061('0x2b')](_0xc061('0x7c'),_0x2432c1[_0xc061('0x33')],_0x2432c1['value']);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x33')]]['calleridnum']=_0x2432c1[_0xc061('0x7d')];}else if(this[_0xc061('0x2f')](_0x2432c1[_0xc061('0x7a')]['xmd-callerid'])){logger[_0xc061('0x2b')](_0xc061('0x7e'),_0x2432c1[_0xc061('0x33')],_0x2432c1['value']);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x33')]][_0xc061('0x7f')]=_0x2432c1[_0xc061('0x7d')];}else if(this[_0xc061('0x2f')](_0x2432c1['variable']['xmd-cdrtype'])){logger[_0xc061('0x2b')](_0xc061('0x80'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x33')]][_0xc061('0x5d')]=_0x2432c1[_0xc061('0x7d')];}else if(this['isNotNull'](_0x2432c1[_0xc061('0x7a')][_0xc061('0x81')])){logger[_0xc061('0x2b')](_0xc061('0x82'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')][_0xc061('0x5b')](',')[0x0]);this[_0xc061('0x15')][_0x2432c1['uniqueid']]['queue']=_0x2432c1[_0xc061('0x7d')][_0xc061('0x5b')](',')[0x0];}else if(this[_0xc061('0x2f')](_0x2432c1[_0xc061('0x7a')][_0xc061('0x83')])){logger[_0xc061('0x2b')](_0xc061('0x84'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x33')]][_0xc061('0x85')]=_0x2432c1[_0xc061('0x7d')];}else if(this['isNotNull'](_0x2432c1['variable']['xmd-destination'])){logger[_0xc061('0x2b')](_0xc061('0x86'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x15')][_0x2432c1['uniqueid']]['destination']=_0x2432c1['value'];}else if(this['isNotNull'](_0x2432c1[_0xc061('0x7a')][_0xc061('0x87')])){logger[_0xc061('0x2b')](_0xc061('0x88'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')]);this['channels'][_0x2432c1[_0xc061('0x33')]][_0xc061('0x89')]=_0x2432c1[_0xc061('0x7d')];}else if(this[_0xc061('0x2f')](_0x2432c1['variable']['xmcs-queue'])){logger[_0xc061('0x2b')](_0xc061('0x8a'),_0x2432c1[_0xc061('0x33')],_0x2432c1['value']);this[_0xc061('0x15')][_0x2432c1['uniqueid']][_0xc061('0x8')]=_0x2432c1[_0xc061('0x7d')];}else if(this[_0xc061('0x2f')](_0x2432c1[_0xc061('0x7a')]['sipcallid'])){logger['info'](_0xc061('0x8b'),_0x2432c1[_0xc061('0x33')],_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x33')]][_0xc061('0x8c')]=_0x2432c1[_0xc061('0x7d')];}}}else if(this[_0xc061('0x2f')](_0x2432c1[_0xc061('0x7a')]['mixmonitor_filename'])){if(_0x2432c1[_0xc061('0x7d')]){var _0x1884b3=path[_0xc061('0x8d')](_0x2432c1[_0xc061('0x7d')])[_0xc061('0x4c')];logger[_0xc061('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1884b3,_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x6f')](_0x1884b3,_0x2432c1[_0xc061('0x7d')]);}}else if(this[_0xc061('0x15')][_0x2432c1[_0xc061('0x37')]]){if(this[_0xc061('0x2f')](_0x2432c1['variable'])){if(this['isNotNull'](_0x2432c1[_0xc061('0x7a')]['sipcallid'])){logger[_0xc061('0x2b')](_0xc061('0x8b'),_0x2432c1[_0xc061('0x37')],_0x2432c1[_0xc061('0x7d')]);this[_0xc061('0x15')][_0x2432c1[_0xc061('0x37')]]['sipcalllinkedid']=_0x2432c1[_0xc061('0x7d')];}}}}}catch(_0xc1ac1f){logger[_0xc061('0x6d')](_0xc061('0x8e'),_0x2432c1[_0xc061('0x33')],util[_0xc061('0x2d')](_0xc1ac1f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc061('0x2e')][_0xc061('0x22')]=function(_0x1c3ef2){try{if(this[_0xc061('0x2f')](_0x1c3ef2)){logger['debug'](_0xc061('0x8f'),_0x1c3ef2[_0xc061('0x33')],util[_0xc061('0x2d')](_0x1c3ef2,{'showHidden':![],'depth':null}));if(this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]]){if(this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2['linkedid']][_0xc061('0x37')]]){this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x37')]][_0xc061('0x33')]=_0x1c3ef2[_0xc061('0x33')];this[_0xc061('0x15')][this['blindTransfers'][_0x1c3ef2[_0xc061('0x37')]]['linkedid']][_0xc061('0x62')]=this[_0xc061('0x15')][_0x1c3ef2['uniqueid']]['answered'];this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x37')]]['answertime']=this['channels'][_0x1c3ef2[_0xc061('0x33')]]['answertime'];this[_0xc061('0x15')][this['blindTransfers'][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x37')]][_0xc061('0x65')]=this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x37')]][_0xc061('0x3d')];this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2['linkedid']][_0xc061('0x37')]][_0xc061('0x49')]=this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]][_0xc061('0x49')];this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]=this['channels'][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x37')]];delete this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]]['linkedid']];}else if(this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2['linkedid']]['uniqueid']]){this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x33')]=[this['channels'][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x37')],this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x37')]=this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]]['uniqueid']][0x0];this['channels'][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x62')]=this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]][_0xc061('0x62')];this['channels'][this['blindTransfers'][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x90')]=this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]['answertime'];this['channels'][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]]['uniqueid']]['destinationchannel']=this['channels'][this['blindTransfers'][_0x1c3ef2[_0xc061('0x37')]]['uniqueid']][_0xc061('0x3d')];this['channels'][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]][_0xc061('0x33')]][_0xc061('0x49')]=this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]][_0xc061('0x49')];this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]=this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2['linkedid']][_0xc061('0x33')]];delete this[_0xc061('0x15')][this[_0xc061('0x17')][_0x1c3ef2[_0xc061('0x37')]]['uniqueid']];}}if(this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]){logger[_0xc061('0x2b')](_0xc061('0x91'),_0x1c3ef2['uniqueid'],_0x1c3ef2[_0xc061('0x92')]);var _0x23d35f=moment();this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]['endtime']=_0x23d35f['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]][_0xc061('0x56')]=_0x23d35f['diff'](this[_0xc061('0x15')][_0x1c3ef2['uniqueid']][_0xc061('0x47')],_0xc061('0x57'));if(this['channels'][_0x1c3ef2['uniqueid']][_0xc061('0x62')]){this['channels'][_0x1c3ef2[_0xc061('0x33')]]['billableseconds']=_0x23d35f['diff'](this['channels'][_0x1c3ef2[_0xc061('0x33')]]['answertime'],_0xc061('0x57'));this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]][_0xc061('0x67')]=this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]['duration']-this[_0xc061('0x15')][_0x1c3ef2[_0xc061('0x33')]]['billableseconds'];}if(_0x1c3ef2[_0xc061('0x3b')]===_0xc061('0x3c')){if(this[_0xc061('0x16')][_0x1c3ef2[_0xc061('0x3d')][_0xc061('0x5b')]('-')[0x0]]){this[_0xc061('0x16')][_0x1c3ef2[_0xc061('0x3d')][_0xc061('0x5b')]('-')[0x0]]=_[_0xc061('0x93')](this[_0xc061('0x16')][_0x1c3ef2[_0xc061('0x3d')]['split']('-')[0x0]],[_0xc061('0x40')]);logger[_0xc061('0x35')](_0xc061('0x94'),_0x1c3ef2[_0xc061('0x33')],util['inspect']({'id':this[_0xc061('0x16')][_0x1c3ef2['channel'][_0xc061('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0xc061('0x16')][_0x1c3ef2[_0xc061('0x3d')][_0xc061('0x5b')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xc061('0x31')](util[_0xc061('0x42')](_0xc061('0x6c'),this['agents'][_0x1c3ef2['channel'][_0xc061('0x5b')]('-')[0x0]][_0xc061('0x4c')]),_0xc061('0x95'),{'id':this['agents'][_0x1c3ef2[_0xc061('0x3d')][_0xc061('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0xc061('0x16')][_0x1c3ef2[_0xc061('0x3d')][_0xc061('0x5b')]('-')[0x0]][_0xc061('0x44')]});for(var _0x3540b5=0x0;_0x3540b50x0?!![]:![];if(!_0x31ec4b){return this[_0xe84d('0x1b')](this[_0xe84d('0x15')]['completeEvent']);}};VoiceQueueReport[_0xe84d('0xd')][_0xe84d('0x1d')]=function(_0xa87b1f){var _0x116e09=this['summary']['id'];if(this[_0xe84d('0x15')][_0xe84d('0x67')][_0x116e09]&&this['summary'][_0xe84d('0x67')][_0x116e09][_0xa87b1f['actionid']]){this[_0xe84d('0x15')][_0xe84d('0x67')][_0x116e09][_0xa87b1f[_0xe84d('0x60')]][_0xe84d('0x11')][_0xe84d('0x6a')](_0xa87b1f);}};VoiceQueueReport[_0xe84d('0xd')][_0xe84d('0x18')]=function(_0x34fe5f){var _0x30f0db=this;try{if(this[_0xe84d('0x5d')](_0x34fe5f)&&this[_0xe84d('0x5d')](_0x34fe5f[_0xe84d('0x51')])){logger[_0xe84d('0x4b')](_0xe84d('0x6b'),util[_0xe84d('0x42')](_0x34fe5f,{'showHidden':![],'depth':null}));var _0x41b095=this[_0xe84d('0x13')][_0x34fe5f[_0xe84d('0x51')]];if(_0x41b095){logger['debug'](_0xe84d('0x6c'),_0x41b095['name']);this[_0xe84d('0x15')][_0xe84d('0x63')][_0x41b095[_0xe84d('0x5b')]]={'summaryEvent':_0x34fe5f};this[_0xe84d('0x15')]['statusRequests']+=0x1;return ami[_0xe84d('0x3d')]({'action':_0xe84d('0x67'),'queue':_0x41b095['name']})[_0xe84d('0x6d')](function(_0x5c2e2b){if(!_0x30f0db[_0xe84d('0x15')][_0xe84d('0x67')][_0x34fe5f[_0xe84d('0x60')]]){_0x30f0db[_0xe84d('0x15')]['queuestatus'][_0x34fe5f['actionid']]={};}_0x30f0db[_0xe84d('0x15')]['queuestatus'][_0x34fe5f['actionid']][_0x5c2e2b['actionid']]={'queue':_0x41b095[_0xe84d('0x5b')],'agents':[]};})[_0xe84d('0x3e')](function(_0x40046c){throw _0x40046c;});}}}catch(_0x1e450a){logger[_0xe84d('0x40')](_0xe84d('0x61'),util[_0xe84d('0x42')](_0x1e450a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe84d('0xd')]['syncQueueSummaryComplete']=function(_0x70b250){if(this[_0xe84d('0x15')][_0xe84d('0x69')]>0x0){this['summary'][_0xe84d('0x6e')]=_0x70b250;return;}logger[_0xe84d('0x4b')](_0xe84d('0x6f'),util['inspect'](_0x70b250,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0xe84d('0x70'),{});};VoiceQueueReport[_0xe84d('0xd')]['syncQueueCallerJoin']=function(_0x5d0c3c){try{if(this[_0xe84d('0x5d')](_0x5d0c3c)){logger[_0xe84d('0x4b')](_0xe84d('0x71'),_0x5d0c3c[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x5d0c3c,{'showHidden':![],'depth':null}));if(_[_0xe84d('0x5e')](this[_0xe84d('0x10')][_0x5d0c3c[_0xe84d('0x4e')]])){this[_0xe84d('0x10')][_0x5d0c3c[_0xe84d('0x4e')]]=[];}if(_['isUndefined'](this['channels'][_0x5d0c3c[_0xe84d('0x4e')]])){this[_0xe84d('0x12')][_0x5d0c3c[_0xe84d('0x4e')]]={};}var _0x4d46db=new QueueReport();_0x4d46db['queue']=_0x5d0c3c[_0xe84d('0x51')];_0x4d46db[_0xe84d('0x58')]=this[_0xe84d('0x13')][_0x4d46db[_0xe84d('0x51')]]&&this[_0xe84d('0x13')][_0x4d46db['queue']][_0xe84d('0x58')]?this[_0xe84d('0x13')][_0x4d46db['queue']][_0xe84d('0x58')]||_0xe84d('0x59'):'inbound';_0x4d46db[_0xe84d('0x72')]=moment()[_0xe84d('0x4f')](_0xe84d('0x73'));_0x4d46db['position']=_0x5d0c3c[_0xe84d('0x74')];_0x4d46db['count']=_0x5d0c3c[_0xe84d('0x75')];_0x4d46db[_0xe84d('0x4e')]=_0x5d0c3c['uniqueid'];_0x4d46db['routealias']=this[_0xe84d('0x12')][_0x5d0c3c[_0xe84d('0x4e')]][_0xe84d('0x76')];logger[_0xe84d('0x77')](_0xe84d('0x78'),_0x4d46db[_0xe84d('0x51')],_0x4d46db[_0xe84d('0x58')]);Object[_0xe84d('0x79')](_0x4d46db,_[_0xe84d('0x7a')](_0x5d0c3c,_[_0xe84d('0x7b')](_0x4d46db)));this[_0xe84d('0x10')][_0x5d0c3c[_0xe84d('0x4e')]][_0xe84d('0x6a')](_0x4d46db);this[_0xe84d('0x12')][_0x5d0c3c[_0xe84d('0x4e')]]=_0x4d46db;this[_0xe84d('0x4a')](_0x4d46db,'queuecallerjoin');}}catch(_0x4736ef){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5d0c3c[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x4736ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe84d('0x22')]=function(_0x390b50){try{if(this[_0xe84d('0x5d')](_0x390b50)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x390b50[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x390b50,{'showHidden':![],'depth':null}));if(this[_0xe84d('0x10')][_0x390b50['uniqueid']]){var _0x5379cd=_['last'](this[_0xe84d('0x10')][_0x390b50[_0xe84d('0x4e')]]);_0x5379cd['queuecallercomplete']=![];_0x5379cd[_0xe84d('0x7c')]=null;_0x5379cd[_0xe84d('0x7d')]=_0x390b50[_0xe84d('0x7d')];_0x5379cd['originalposition']=_0x390b50[_0xe84d('0x7e')];_0x5379cd[_0xe84d('0x21')]=!![];_0x5379cd[_0xe84d('0x7f')]=moment()[_0xe84d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5379cd[_0xe84d('0x54')]='ABANDONED';_0x5379cd[_0xe84d('0x80')]=null;logger[_0xe84d('0x77')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5379cd['queue'],_0x5379cd[_0xe84d('0x58')]);this[_0xe84d('0x12')][_0x390b50['uniqueid']]=_0x5379cd;this[_0xe84d('0x47')](_0x5379cd,_0xe84d('0x21'));}}}catch(_0x5062ea){logger['error'](_0xe84d('0x81'),_0x390b50[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x5062ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe84d('0xd')][_0xe84d('0x82')]=function(_0x4859a3){try{if(this[_0xe84d('0x5d')](_0x4859a3)){logger[_0xe84d('0x4b')](_0xe84d('0x83'),_0x4859a3[_0xe84d('0x4e')],util['inspect'](_0x4859a3,{'showHidden':![],'depth':null}));if(this[_0xe84d('0x10')][_0x4859a3['uniqueid']]){var _0x30fdcb=_['last'](this[_0xe84d('0x10')][_0x4859a3[_0xe84d('0x4e')]]);_0x30fdcb['queuecallerleaveAt']=moment()[_0xe84d('0x4f')](_0xe84d('0x73'));_0x30fdcb[_0xe84d('0x84')]=_0x4859a3['connectedlinenum'];_0x30fdcb[_0xe84d('0x85')]=_0x4859a3['connectedlinename'];logger[_0xe84d('0x77')](_0xe84d('0x86'),_0x30fdcb[_0xe84d('0x51')],_0x30fdcb[_0xe84d('0x58')],_0x4859a3[_0xe84d('0x84')],_0x4859a3[_0xe84d('0x85')]);this[_0xe84d('0x12')][_0x4859a3[_0xe84d('0x4e')]]=_0x30fdcb;this[_0xe84d('0x4a')](_0x30fdcb,_0xe84d('0x23'));}}}catch(_0x13707d){logger[_0xe84d('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x4859a3[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x13707d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe84d('0xd')]['syncAgentConnect']=function(_0x320cf9){try{if(this[_0xe84d('0x5d')](_0x320cf9)){logger[_0xe84d('0x4b')](_0xe84d('0x87'),_0x320cf9[_0xe84d('0x4e')],util['inspect'](_0x320cf9,{'showHidden':![],'depth':null}));if(this[_0xe84d('0x10')][_0x320cf9[_0xe84d('0x4e')]]){var _0x539c24=_[_0xe84d('0x88')](this['queueReports'][_0x320cf9[_0xe84d('0x4e')]]);_0x539c24[_0xe84d('0x39')]=!![];_0x539c24[_0xe84d('0x54')]=_0xe84d('0x89');logger[_0xe84d('0x77')](_0xe84d('0x8a'),_0x539c24[_0xe84d('0x51')],_0x539c24[_0xe84d('0x58')]);}}}catch(_0x23cc9b){logger[_0xe84d('0x40')](_0xe84d('0x87'),_0x320cf9[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x23cc9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x17759f){try{if(this[_0xe84d('0x5d')](_0x17759f)){logger[_0xe84d('0x4b')]('[%s][voiceQueueReport][agentcomplete]',_0x17759f['uniqueid'],util['inspect'](_0x17759f,{'showHidden':![],'depth':null}));if(this[_0xe84d('0x10')][_0x17759f['uniqueid']]){var _0x1eff1e=_[_0xe84d('0x88')](this['queueReports'][_0x17759f[_0xe84d('0x4e')]]);_0x1eff1e[_0xe84d('0x21')]=![];_0x1eff1e[_0xe84d('0x7f')]=null;_0x1eff1e[_0xe84d('0x8b')]=!![];_0x1eff1e[_0xe84d('0x80')]=_0x17759f[_0xe84d('0x8c')];_0x1eff1e[_0xe84d('0x7d')]=_0x17759f[_0xe84d('0x7d')];_0x1eff1e[_0xe84d('0x39')]=!![];_0x1eff1e['queuecallerexit']=![];_0x1eff1e[_0xe84d('0x8d')]=null;if(!_0x1eff1e[_0xe84d('0x8e')]){if(_0x17759f[_0xe84d('0x8f')]==_0xe84d('0x8e')){_0x1eff1e[_0xe84d('0x54')]='COMPLETED';logger['info'](_0xe84d('0x90'),_0x1eff1e[_0xe84d('0x51')],_0x1eff1e[_0xe84d('0x58')]);}else{if(_[_0xe84d('0x91')](_0x17759f[_0xe84d('0x92')][_0xe84d('0x93')](),_0xe84d('0x94'))){if(this[_0xe84d('0x10')][_0x17759f['linkedid']]){var _0x160539=_[_0xe84d('0x88')](this[_0xe84d('0x10')][_0x17759f[_0xe84d('0x95')]]);_0x160539[_0xe84d('0x39')]=![];_0x160539['queuecallerexit']=!![];_0x160539[_0xe84d('0x8d')]=moment(_0x1eff1e[_0xe84d('0x72')])[_0xe84d('0x96')](_0x17759f['holdtime'],_0xe84d('0x97'))[_0xe84d('0x4f')](_0xe84d('0x73'));_0x160539[_0xe84d('0x54')]=_0xe84d('0x98');_0x160539['transfer']=!![];_0x160539[_0xe84d('0x99')]='FORWARD';_0x160539[_0xe84d('0x9a')]=_0x17759f['destexten'];_0x160539[_0xe84d('0x9b')]=_0x17759f['uniqueid'];logger[_0xe84d('0x77')](_0xe84d('0x9c'),_0x160539[_0xe84d('0x51')],_0x160539[_0xe84d('0x58')]);var _0x1989bd=this['queueReports'][_0x17759f[_0xe84d('0x95')]];this[_0xe84d('0x10')][_0x17759f['linkedid']]=this[_0xe84d('0x10')][_0x17759f[_0xe84d('0x4e')]];this[_0xe84d('0x10')][_0x17759f[_0xe84d('0x4e')]]=_0x1989bd;}}else{_0x1eff1e[_0xe84d('0x54')]='COMPLETEDBY'+_0x17759f[_0xe84d('0x8f')][_0xe84d('0x9d')]();logger[_0xe84d('0x77')](_0xe84d('0x9e'),_0x1eff1e[_0xe84d('0x51')],_0x1eff1e[_0xe84d('0x58')],_0x1eff1e[_0xe84d('0x54')]);}}}this['channels'][_0x17759f[_0xe84d('0x4e')]]=_0x1eff1e;}}}catch(_0x497595){logger[_0xe84d('0x40')](_0xe84d('0x9f'),_0x17759f['uniqueid'],util[_0xe84d('0x42')](_0x497595,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe84d('0xd')][_0xe84d('0xa0')]=function(_0x5ddca3){try{if(this[_0xe84d('0x5d')](_0x5ddca3)){logger[_0xe84d('0x4b')](_0xe84d('0xa1'),_0x5ddca3['uniqueid'],util[_0xe84d('0x42')](_0x5ddca3,{'showHidden':![],'depth':null}));this[_0xe84d('0xa2')](_0x5ddca3[_0xe84d('0x4e')],_[_0xe84d('0x7b')](_0x5ddca3[_0xe84d('0xa3')])[0x0],_0x5ddca3[_0xe84d('0xa4')]);if(this[_0xe84d('0x10')][_0x5ddca3[_0xe84d('0x4e')]]){var _0x4ef19a=_['last'](this[_0xe84d('0x10')][_0x5ddca3[_0xe84d('0x4e')]]);if(_0x4ef19a){if(this['isNotNull'](_0x5ddca3[_0xe84d('0xa3')])&&this['isNotNull'](_0x5ddca3[_0xe84d('0xa3')][_0xe84d('0x67')])){switch(_0x5ddca3[_0xe84d('0xa4')]){case'CONTINUE':_0x4ef19a[_0xe84d('0xa5')]=![];_0x4ef19a[_0xe84d('0x8d')]=null;break;case _0xe84d('0xa6'):_0x4ef19a['lastevent']=_0xe84d('0xa7');_0x4ef19a['queuecallerexit']=!![];_0x4ef19a['queuecallerexitAt']=moment()[_0xe84d('0x4f')](_0xe84d('0x73'));_0x4ef19a[_0xe84d('0xa8')]=moment()[_0xe84d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xe84d('0x4b')](_0xe84d('0xa9'),_0x5ddca3['uniqueid'],util[_0xe84d('0x42')](_0x4ef19a,{'showHidden':![],'depth':null}));ami[_0xe84d('0x49')]('custom:timeout',_0x4ef19a);break;default:_0x4ef19a[_0xe84d('0xa5')]=!![];_0x4ef19a[_0xe84d('0x8d')]=moment()['format'](_0xe84d('0x73'));_0x4ef19a[_0xe84d('0xa8')]=moment()[_0xe84d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ef19a[_0xe84d('0x21')]=![];_0x4ef19a[_0xe84d('0x7f')]=null;_0x4ef19a[_0xe84d('0x54')]=_0x5ddca3[_0xe84d('0xa4')];this['channels'][_0x5ddca3[_0xe84d('0x4e')]]=_0x4ef19a;this[_0xe84d('0x47')](_0x4ef19a,_0xe84d('0x28'));}else if(this[_0xe84d('0x5d')](_0x5ddca3[_0xe84d('0xa3')])&&this['isNotNull'](_0x5ddca3[_0xe84d('0xa3')][_0xe84d('0xaa')])){if(!_0x4ef19a[_0xe84d('0x21')]){_0x4ef19a[_0xe84d('0xa5')]=!![];_0x4ef19a[_0xe84d('0x8d')]=moment()[_0xe84d('0x4f')](_0xe84d('0x73'));_0x4ef19a[_0xe84d('0x54')]=_0xe84d('0xab');_0x4ef19a['queuecallerleaveAt']=moment()[_0xe84d('0x4f')](_0xe84d('0x73'));this['channels'][_0x5ddca3[_0xe84d('0x4e')]]=_0x4ef19a;}}logger[_0xe84d('0x77')](_0xe84d('0xac'),_0x5ddca3[_0xe84d('0x4e')],_0x4ef19a[_0xe84d('0x51')],_0x4ef19a[_0xe84d('0x58')],_[_0xe84d('0x7b')](_0x5ddca3[_0xe84d('0xa3')])[0x0],_0x5ddca3['value']);_0x4ef19a[_0xe84d('0x16')]=this['variables'][_0x5ddca3[_0xe84d('0x4e')]];}}}}catch(_0x631b7e){logger[_0xe84d('0x40')]('[%s][voiceQueueReport][varset]',_0x5ddca3[_0xe84d('0x4e')],util[_0xe84d('0x42')](_0x631b7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe84d('0xd')][_0xe84d('0xa2')]=function(_0x443e8b,_0x1cb724,_0x129b38){var _0x570a3c=[_0xe84d('0xad'),'rtpaudioqosbridged',_0xe84d('0xae'),_0xe84d('0xaf'),_0xe84d('0xb0'),_0xe84d('0xb1'),_0xe84d('0xb2'),_0xe84d('0xb3'),_0xe84d('0xb4'),_0xe84d('0xb5'),_0xe84d('0xb6'),_0xe84d('0xb7'),'membercalls',_0xe84d('0xb8'),_0xe84d('0xb9'),_0xe84d('0xba'),'membername',_0xe84d('0xbb'),_0xe84d('0xbc')];if(!_[_0xe84d('0x3c')](_0x1cb724)&&!_[_0xe84d('0xbd')](_0x570a3c,_0x1cb724)){if(_['isUndefined'](this[_0xe84d('0x16')][_0x443e8b])){this[_0xe84d('0x16')][_0x443e8b]={};}this['variables'][_0x443e8b][_0x1cb724]=_0x129b38;}};VoiceQueueReport[_0xe84d('0xd')]['handleHangup']=function(_0xba17c0,_0x20fa07,_0x263ec2){try{var _0x2a0b95={};if(this['queueReports'][_0xba17c0]){for(var _0x2edb7e=0x0;_0x2edb7e0x0?!![]:![];if(!_0x45ed1f){return this[_0x3371('0x1c')](this[_0x3371('0x16')][_0x3371('0x70')]);}};VoiceQueueReport[_0x3371('0xc')]['syncQueueMember']=function(_0x2f8231){var _0x56b0ac=this[_0x3371('0x16')]['id'];if(this[_0x3371('0x16')][_0x3371('0x63')][_0x56b0ac]&&this[_0x3371('0x16')][_0x3371('0x63')][_0x56b0ac][_0x2f8231[_0x3371('0x62')]]){this['summary'][_0x3371('0x63')][_0x56b0ac][_0x2f8231[_0x3371('0x62')]][_0x3371('0x11')][_0x3371('0x71')](_0x2f8231);}};VoiceQueueReport[_0x3371('0xc')][_0x3371('0x19')]=function(_0x434b8f){var _0x3e58e1=this;try{if(this[_0x3371('0x5a')](_0x434b8f)&&this[_0x3371('0x5a')](_0x434b8f[_0x3371('0x4f')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x434b8f,{'showHidden':![],'depth':null}));var _0x3a4330=this[_0x3371('0x14')][_0x434b8f[_0x3371('0x4f')]];if(_0x3a4330){logger[_0x3371('0x4a')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x3a4330['name']);this[_0x3371('0x16')]['queues'][_0x3a4330[_0x3371('0x65')]]={'summaryEvent':_0x434b8f};this[_0x3371('0x16')][_0x3371('0x6f')]+=0x1;return ami[_0x3371('0x3d')]({'action':_0x3371('0x63'),'queue':_0x3a4330[_0x3371('0x65')]})['then'](function(_0xc2ebd3){if(!_0x3e58e1[_0x3371('0x16')]['queuestatus'][_0x434b8f['actionid']]){_0x3e58e1[_0x3371('0x16')][_0x3371('0x63')][_0x434b8f['actionid']]={};}_0x3e58e1['summary'][_0x3371('0x63')][_0x434b8f[_0x3371('0x62')]][_0xc2ebd3[_0x3371('0x62')]]={'queue':_0x3a4330[_0x3371('0x65')],'agents':[]};})['catch'](function(_0x22bcb0){throw _0x22bcb0;});}}}catch(_0x2a9612){logger[_0x3371('0x44')](_0x3371('0x72'),util[_0x3371('0x42')](_0x2a9612,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3371('0xc')][_0x3371('0x1c')]=function(_0x55e386){if(this[_0x3371('0x16')]['statusRequests']>0x0){this['summary']['completeEvent']=_0x55e386;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x55e386,{'showHidden':![],'depth':null}));this[_0x3371('0x16')]=initializeSummary();ami[_0x3371('0x49')](_0x3371('0x73'),{});};VoiceQueueReport['prototype'][_0x3371('0x20')]=function(_0x158ded){try{if(this[_0x3371('0x5a')](_0x158ded)){logger[_0x3371('0x4a')](_0x3371('0x74'),_0x158ded[_0x3371('0x4d')],util[_0x3371('0x42')](_0x158ded,{'showHidden':![],'depth':null}));if(_[_0x3371('0x5b')](this[_0x3371('0x43')][_0x158ded[_0x3371('0x4d')]])){this[_0x3371('0x43')][_0x158ded[_0x3371('0x4d')]]=[];}if(_[_0x3371('0x5b')](this[_0x3371('0x12')][_0x158ded[_0x3371('0x4d')]])){this['channels'][_0x158ded[_0x3371('0x4d')]]={};}var _0x40ea72=new QueueReport();_0x40ea72[_0x3371('0x4f')]=_0x158ded[_0x3371('0x4f')];_0x40ea72[_0x3371('0x56')]=this[_0x3371('0x14')][_0x40ea72[_0x3371('0x4f')]]&&this[_0x3371('0x14')][_0x40ea72['queue']][_0x3371('0x56')]?this['voiceQueues'][_0x40ea72['queue']]['type']||_0x3371('0x57'):_0x3371('0x57');_0x40ea72['queuecallerjoinAt']=moment()[_0x3371('0x53')](_0x3371('0x75'));_0x40ea72['position']=_0x158ded[_0x3371('0x76')];_0x40ea72[_0x3371('0x77')]=_0x158ded[_0x3371('0x77')];_0x40ea72['uniqueid']=_0x158ded[_0x3371('0x4d')];_0x40ea72[_0x3371('0x78')]=this[_0x3371('0x12')][_0x158ded[_0x3371('0x4d')]][_0x3371('0x78')];logger[_0x3371('0x79')](_0x3371('0x7a'),_0x40ea72[_0x3371('0x4f')],_0x40ea72['type']);Object[_0x3371('0x6b')](_0x40ea72,_[_0x3371('0x7b')](_0x158ded,_[_0x3371('0x7c')](_0x40ea72)));this[_0x3371('0x43')][_0x158ded[_0x3371('0x4d')]][_0x3371('0x71')](_0x40ea72);this[_0x3371('0x12')][_0x158ded[_0x3371('0x4d')]]=_0x40ea72;this['emitVoiceQueueChannelSave'](_0x40ea72,_0x3371('0x7d'));}}catch(_0x57a625){logger[_0x3371('0x44')](_0x3371('0x74'),_0x158ded[_0x3371('0x4d')],util[_0x3371('0x42')](_0x57a625,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3371('0xc')]['syncQueueCallerAbandon']=function(_0x10169e){try{if(this[_0x3371('0x5a')](_0x10169e)){logger[_0x3371('0x4a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x10169e[_0x3371('0x4d')],util[_0x3371('0x42')](_0x10169e,{'showHidden':![],'depth':null}));if(this[_0x3371('0x43')][_0x10169e[_0x3371('0x4d')]]){var _0x377842=_[_0x3371('0x7e')](this[_0x3371('0x43')][_0x10169e['uniqueid']]);_0x377842[_0x3371('0x3a')]=![];_0x377842[_0x3371('0x7f')]=null;_0x377842['holdtime']=_0x10169e['holdtime'];_0x377842['originalposition']=_0x10169e[_0x3371('0x80')];_0x377842['queuecallerabandon']=!![];_0x377842[_0x3371('0x81')]=moment()['format'](_0x3371('0x75'));_0x377842['queuecallerexitreason']='ABANDONED';_0x377842[_0x3371('0x82')]=null;logger[_0x3371('0x79')](_0x3371('0x83'),_0x377842['queue'],_0x377842[_0x3371('0x56')]);this[_0x3371('0x12')][_0x10169e['uniqueid']]=_0x377842;this[_0x3371('0x48')](_0x377842,'queuecallerabandon');}}}catch(_0x3e600b){logger[_0x3371('0x44')](_0x3371('0x84'),_0x10169e[_0x3371('0x4d')],util[_0x3371('0x42')](_0x3e600b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3371('0x24')]=function(_0x49c248){try{if(this[_0x3371('0x5a')](_0x49c248)){logger[_0x3371('0x4a')](_0x3371('0x85'),_0x49c248[_0x3371('0x4d')],util[_0x3371('0x42')](_0x49c248,{'showHidden':![],'depth':null}));if(this[_0x3371('0x43')][_0x49c248['uniqueid']]){var _0x2ca87f=_[_0x3371('0x7e')](this[_0x3371('0x43')][_0x49c248['uniqueid']]);_0x2ca87f[_0x3371('0x86')]=moment()[_0x3371('0x53')](_0x3371('0x75'));_0x2ca87f[_0x3371('0x87')]=_0x49c248[_0x3371('0x87')];_0x2ca87f[_0x3371('0x88')]=_0x49c248['connectedlinename'];logger[_0x3371('0x79')](_0x3371('0x89'),_0x2ca87f[_0x3371('0x4f')],_0x2ca87f[_0x3371('0x56')],_0x49c248[_0x3371('0x87')],_0x49c248['connectedlinename']);this[_0x3371('0x12')][_0x49c248[_0x3371('0x4d')]]=_0x2ca87f;this[_0x3371('0x8a')](_0x2ca87f,_0x3371('0x23'));}}}catch(_0x23b8ce){logger[_0x3371('0x44')](_0x3371('0x85'),_0x49c248[_0x3371('0x4d')],util[_0x3371('0x42')](_0x23b8ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3371('0xc')][_0x3371('0x27')]=function(_0x7372c1){try{if(this['isNotNull'](_0x7372c1)){logger[_0x3371('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x7372c1[_0x3371('0x4d')],util[_0x3371('0x42')](_0x7372c1,{'showHidden':![],'depth':null}));if(this[_0x3371('0x43')][_0x7372c1[_0x3371('0x4d')]]){var _0x18e19d=_[_0x3371('0x7e')](this[_0x3371('0x43')][_0x7372c1['uniqueid']]);_0x18e19d[_0x3371('0x3a')]=!![];_0x18e19d[_0x3371('0x52')]=_0x3371('0x8b');logger[_0x3371('0x79')](_0x3371('0x8c'),_0x18e19d[_0x3371('0x4f')],_0x18e19d['type']);}}}catch(_0x3256d6){logger[_0x3371('0x44')](_0x3371('0x8d'),_0x7372c1[_0x3371('0x4d')],util['inspect'](_0x3256d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3371('0x8e')]=function(_0x14556b){try{if(this[_0x3371('0x5a')](_0x14556b)){logger[_0x3371('0x4a')](_0x3371('0x8f'),_0x14556b[_0x3371('0x4d')],util[_0x3371('0x42')](_0x14556b,{'showHidden':![],'depth':null}));if(this[_0x3371('0x43')][_0x14556b[_0x3371('0x4d')]]){var _0x2eebbc=_[_0x3371('0x7e')](this[_0x3371('0x43')][_0x14556b[_0x3371('0x4d')]]);_0x2eebbc['queuecallerabandon']=![];_0x2eebbc[_0x3371('0x81')]=null;_0x2eebbc[_0x3371('0x90')]=!![];_0x2eebbc[_0x3371('0x82')]=_0x14556b[_0x3371('0x91')];_0x2eebbc[_0x3371('0x92')]=_0x14556b[_0x3371('0x92')];_0x2eebbc['queuecallercomplete']=!![];_0x2eebbc[_0x3371('0x93')]=![];_0x2eebbc[_0x3371('0x94')]=null;if(!_0x2eebbc['transfer']){if(_0x14556b['reason']==_0x3371('0x95')){_0x2eebbc[_0x3371('0x52')]=_0x3371('0x96');logger['info'](_0x3371('0x97'),_0x2eebbc[_0x3371('0x4f')],_0x2eebbc['type']);}else{if(_['startsWith'](_0x14556b['channel'][_0x3371('0x98')](),_0x3371('0x99'))){if(this[_0x3371('0x43')][_0x14556b[_0x3371('0x9a')]]){var _0x37e3e2=_[_0x3371('0x7e')](this[_0x3371('0x43')][_0x14556b[_0x3371('0x9a')]]);_0x37e3e2['queuecallercomplete']=![];_0x37e3e2[_0x3371('0x93')]=!![];_0x37e3e2[_0x3371('0x94')]=moment(_0x2eebbc[_0x3371('0x9b')])[_0x3371('0x9c')](_0x14556b['holdtime'],'seconds')['format'](_0x3371('0x75'));_0x37e3e2[_0x3371('0x52')]=_0x3371('0x9d');_0x37e3e2[_0x3371('0x95')]=!![];_0x37e3e2[_0x3371('0x9e')]=_0x3371('0x9f');_0x37e3e2[_0x3371('0xa0')]=_0x14556b['destexten'];_0x37e3e2[_0x3371('0xa1')]=_0x14556b[_0x3371('0x4d')];logger[_0x3371('0x79')](_0x3371('0xa2'),_0x37e3e2['queue'],_0x37e3e2[_0x3371('0x56')]);var _0x3056da=this[_0x3371('0x43')][_0x14556b[_0x3371('0x9a')]];this[_0x3371('0x43')][_0x14556b[_0x3371('0x9a')]]=this[_0x3371('0x43')][_0x14556b[_0x3371('0x4d')]];this[_0x3371('0x43')][_0x14556b['uniqueid']]=_0x3056da;}}else{_0x2eebbc[_0x3371('0x52')]='COMPLETEDBY'+_0x14556b['reason']['toUpperCase']();logger[_0x3371('0x79')](_0x3371('0xa3'),_0x2eebbc[_0x3371('0x4f')],_0x2eebbc['type'],_0x2eebbc['queuecallerexitreason']);}}}this[_0x3371('0x12')][_0x14556b[_0x3371('0x4d')]]=_0x2eebbc;}}}catch(_0x10cc2f){logger[_0x3371('0x44')](_0x3371('0x8f'),_0x14556b['uniqueid'],util[_0x3371('0x42')](_0x10cc2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3371('0x28')]=function(_0x1f2690){try{if(this['isNotNull'](_0x1f2690)){logger['debug'](_0x3371('0xa4'),_0x1f2690[_0x3371('0x4d')],util[_0x3371('0x42')](_0x1f2690,{'showHidden':![],'depth':null}));this[_0x3371('0xa5')](_0x1f2690[_0x3371('0x4d')],_[_0x3371('0x7c')](_0x1f2690['variable'])[0x0],_0x1f2690[_0x3371('0xa6')]);if(this[_0x3371('0x43')][_0x1f2690[_0x3371('0x4d')]]){var _0x3703aa=_['last'](this[_0x3371('0x43')][_0x1f2690[_0x3371('0x4d')]]);if(_0x3703aa){if(this[_0x3371('0x5a')](_0x1f2690[_0x3371('0xa7')])&&this[_0x3371('0x5a')](_0x1f2690[_0x3371('0xa7')]['queuestatus'])){switch(_0x1f2690[_0x3371('0xa6')]){case _0x3371('0xa8'):_0x3703aa['queuecallerexit']=![];_0x3703aa[_0x3371('0x94')]=null;break;case _0x3371('0xa9'):_0x3703aa[_0x3371('0xaa')]=_0x3371('0xab');_0x3703aa[_0x3371('0x93')]=!![];_0x3703aa[_0x3371('0x94')]=moment()[_0x3371('0x53')](_0x3371('0x75'));_0x3703aa['queuecallerleaveAt']=moment()[_0x3371('0x53')](_0x3371('0x75'));logger[_0x3371('0x4a')](_0x3371('0xac'),_0x1f2690['uniqueid'],util[_0x3371('0x42')](_0x3703aa,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x3703aa);break;default:_0x3703aa['queuecallerexit']=!![];_0x3703aa[_0x3371('0x94')]=moment()[_0x3371('0x53')](_0x3371('0x75'));_0x3703aa[_0x3371('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3703aa[_0x3371('0x21')]=![];_0x3703aa[_0x3371('0x81')]=null;_0x3703aa[_0x3371('0x52')]=_0x1f2690[_0x3371('0xa6')];this[_0x3371('0x12')][_0x1f2690[_0x3371('0x4d')]]=_0x3703aa;this['emitVoiceQueueChannelRemove'](_0x3703aa,_0x3371('0xad'));}else if(this[_0x3371('0x5a')](_0x1f2690[_0x3371('0xa7')])&&this[_0x3371('0x5a')](_0x1f2690[_0x3371('0xa7')][_0x3371('0xae')])){if(!_0x3703aa[_0x3371('0x21')]){_0x3703aa[_0x3371('0x93')]=!![];_0x3703aa[_0x3371('0x94')]=moment()[_0x3371('0x53')](_0x3371('0x75'));_0x3703aa[_0x3371('0x52')]=_0x3371('0xaf');_0x3703aa['queuecallerleaveAt']=moment()['format'](_0x3371('0x75'));this[_0x3371('0x12')][_0x1f2690['uniqueid']]=_0x3703aa;}}logger['info'](_0x3371('0xb0'),_0x1f2690[_0x3371('0x4d')],_0x3703aa[_0x3371('0x4f')],_0x3703aa[_0x3371('0x56')],_[_0x3371('0x7c')](_0x1f2690[_0x3371('0xa7')])[0x0],_0x1f2690[_0x3371('0xa6')]);_0x3703aa['variables']=this[_0x3371('0x17')][_0x1f2690['uniqueid']];}}}}catch(_0x3638cb){logger[_0x3371('0x44')](_0x3371('0xa4'),_0x1f2690['uniqueid'],util['inspect'](_0x3638cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3371('0xc')][_0x3371('0xa5')]=function(_0x14b009,_0x4f2158,_0x16859b){var _0x1a0cda=[_0x3371('0xb1'),_0x3371('0xb2'),_0x3371('0xb3'),_0x3371('0xb4'),'rtpaudioqosloss',_0x3371('0xb5'),_0x3371('0xb6'),_0x3371('0xb7'),_0x3371('0xb8'),_0x3371('0xb9'),'bridgepeer',_0x3371('0xba'),_0x3371('0xbb'),_0x3371('0xbc'),_0x3371('0xbd'),_0x3371('0xbe'),'membername',_0x3371('0xbf'),_0x3371('0xc0')];if(!_[_0x3371('0x3c')](_0x4f2158)&&!_[_0x3371('0xc1')](_0x1a0cda,_0x4f2158)){if(_['isUndefined'](this[_0x3371('0x17')][_0x14b009])){this[_0x3371('0x17')][_0x14b009]={};}this[_0x3371('0x17')][_0x14b009][_0x4f2158]=_0x16859b;}};VoiceQueueReport[_0x3371('0xc')][_0x3371('0xc2')]=function(_0x558b17,_0x187798,_0x17c905){try{var _0x32366b={};if(this[_0x3371('0x43')][_0x558b17]){for(var _0x8c7c19=0x0;_0x8c7c19=0x0?moment(_0x4fe5f5[_0xe68d('0x17')])[_0xe68d('0x18')](_0x4fe5f5[_0xe68d('0x19')],'seconds'):null,'data1':_0xe68d('0x1a'),'data2':_0x4fe5f5[_0xe68d('0x13')],'data3':_0x4fe5f5[_0xe68d('0x11')],'data4':_0x4fe5f5[_0xe68d('0x1b')]||null,'role':_0xe68d('0x1c'),'internal':_0x4fe5f5[_0xe68d('0x13')]?_['toNumber'](_0x4fe5f5[_0xe68d('0x13')]):undefined,'uniqueid':_0x4fe5f5[_0xe68d('0x1d')]},'log':_0xe68d('0x14')});}; \ No newline at end of file +var _0xf464=['inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','voice','membername','starttime','endtime','outbound','toNumber','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds'];(function(_0x812b4,_0x5c732f){var _0x1b1950=function(_0xfe8cb1){while(--_0xfe8cb1){_0x812b4['push'](_0x812b4['shift']());}};_0x1b1950(++_0x5c732f);}(_0xf464,0x66));var _0x4f46=function(_0x24d9b1,_0x520660){_0x24d9b1=_0x24d9b1-0x0;var _0xdee682=_0xf464[_0x24d9b1];return _0xdee682;};'use strict';var moment=require('moment');var _=require(_0x4f46('0x0'));var util=require('util');var client=require(_0x4f46('0x1'));exports[_0x4f46('0x2')]=function(_0x5ab444){var _0x20a6c0=_0x5ab444[_0x4f46('0x3')]||_0x5ab444[_0x4f46('0x4')];return client[_0x4f46('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x5ab444[_0x4f46('0x6')],'interface':_['isNil'](_0x5ab444[_0x4f46('0x7')])?util[_0x4f46('0x8')](_0x4f46('0x9'),_0x5ab444['lastAssignedTo']):_0x5ab444[_0x4f46('0x7')],'type':_0x4f46('0xa'),'enterAt':_0x5ab444[_0x4f46('0xb')],'exitAt':_0x20a6c0,'duration':moment(_0x20a6c0)[_0x4f46('0xc')](_0x5ab444[_0x4f46('0xb')],_0x4f46('0xd')),'data1':_0x4f46('0xe'),'data2':_0x5ab444[_0x4f46('0xf')],'data3':_0x5ab444[_0x4f46('0x10')],'data4':null,'data5':_0x5ab444[_0x4f46('0x11')],'role':_0x4f46('0x12'),'internal':_0x5ab444[_0x4f46('0x13')]?_['toNumber'](_0x5ab444[_0x4f46('0x13')]):undefined,'uniqueid':_0x5ab444[_0x4f46('0x14')]},'log':_0x4f46('0x15')});};exports[_0x4f46('0x16')]=function(_0x256ae3){return client['Request'](_0x4f46('0x15'),{'body':{'channel':_0x4f46('0x17'),'membername':_0x256ae3[_0x4f46('0x18')],'interface':_0x256ae3[_0x4f46('0x7')],'type':_0x4f46('0xa'),'enterAt':_0x256ae3[_0x4f46('0x19')],'exitAt':_0x256ae3['endtime'],'duration':moment(_0x256ae3[_0x4f46('0x1a')])[_0x4f46('0xc')](_0x256ae3['starttime'],_0x4f46('0xd'))>=0x0?moment(_0x256ae3[_0x4f46('0x1a')])[_0x4f46('0xc')](_0x256ae3[_0x4f46('0x19')],_0x4f46('0xd')):null,'data1':_0x4f46('0x1b'),'data2':_0x256ae3['accountcode'],'data3':_0x256ae3[_0x4f46('0x10')],'data4':_0x256ae3['dialstring']||null,'role':'agent','internal':_0x256ae3[_0x4f46('0x13')]?_[_0x4f46('0x1c')](_0x256ae3[_0x4f46('0x13')]):undefined,'uniqueid':_0x256ae3[_0x4f46('0x14')]},'log':_0x4f46('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4a21f7b..7692c24 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 _0xd5e5=['ShowSetting','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x5814ca,_0x3b6713){var _0xeb1833=function(_0x553de1){while(--_0x553de1){_0x5814ca['push'](_0x5814ca['shift']());}};_0xeb1833(++_0x3b6713);}(_0xd5e5,0x187));var _0x5d5e=function(_0x2f1f0f,_0xaf3d2a){_0x2f1f0f=_0x2f1f0f-0x0;var _0x1163bd=_0xd5e5[_0x2f1f0f];return _0x1163bd;};'use strict';var client=require('../client');exports[_0x5d5e('0x0')]=function(){return client['Request'](_0x5d5e('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x5d5e('0x2')]},'log':_0x5d5e('0x3')});}; \ No newline at end of file +var _0x6ee9=['GetSettings','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x266291,_0x3cded0){var _0x2f824c=function(_0xc6eacb){while(--_0xc6eacb){_0x266291['push'](_0x266291['shift']());}};_0x2f824c(++_0x3cded0);}(_0x6ee9,0x9c));var _0x96ee=function(_0x56ee9c,_0x35d6a6){_0x56ee9c=_0x56ee9c-0x0;var _0x212d28=_0x6ee9[_0x56ee9c];return _0x212d28;};'use strict';var client=require('../client');exports[_0x96ee('0x0')]=function(){return client[_0x96ee('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x96ee('0x2'),_0x96ee('0x3')]},'log':_0x96ee('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 3cc2b83..1d40f8b 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 _0x60e1=['name','html','../client','Request','GetTemplate'];(function(_0x18559d,_0x54a0d6){var _0x557152=function(_0x481a18){while(--_0x481a18){_0x18559d['push'](_0x18559d['shift']());}};_0x557152(++_0x54a0d6);}(_0x60e1,0x14c));var _0x160e=function(_0x3ef49a,_0x5e586d){_0x3ef49a=_0x3ef49a-0x0;var _0x2d5c10=_0x60e1[_0x3ef49a];return _0x2d5c10;};'use strict';var client=require(_0x160e('0x0'));exports['getTemplates']=function(_0x6f51a){return function(_0x368d82){return client[_0x160e('0x1')](_0x160e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x160e('0x3'),_0x160e('0x4')]},'log':_0x160e('0x2')});};}; \ No newline at end of file +var _0xf3f2=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xf3f2,0x140));var _0x2f3f=function(_0x46df89,_0x2f5cec){_0x46df89=_0x46df89-0x0;var _0x22531b=_0xf3f2[_0x46df89];return _0x22531b;};'use strict';var client=require(_0x2f3f('0x0'));exports[_0x2f3f('0x1')]=function(_0xa6e193){return function(_0x1bbd45){return client[_0x2f3f('0x2')](_0x2f3f('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2f3f('0x4'),'html']},'log':_0x2f3f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c882ab5..8ee8112 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 _0x01c7=['action','data1','data3','data4','data5','data6','../client','getTriggers','Request','GetTrigger','name','AllConditions','field','value','Condition','operator','Actions'];(function(_0x225d44,_0x399b52){var _0x4aa98a=function(_0xeffa74){while(--_0xeffa74){_0x225d44['push'](_0x225d44['shift']());}};_0x4aa98a(++_0x399b52);}(_0x01c7,0xe3));var _0x701c=function(_0x26cb01,_0x3ab8a7){_0x26cb01=_0x26cb01-0x0;var _0xe49a17=_0x01c7[_0x26cb01];return _0xe49a17;};'use strict';var client=require(_0x701c('0x0'));exports[_0x701c('0x1')]=function(_0x2efcba){return function(_0x33fb29){return client[_0x701c('0x2')](_0x701c('0x3'),{'options':{'raw':![],'attributes':['id',_0x701c('0x4'),'channel','status'],'include':[{'model':'Condition','as':_0x701c('0x5'),'attributes':['id',_0x701c('0x6'),'operator',_0x701c('0x7')]},{'model':_0x701c('0x8'),'as':'AnyConditions','attributes':['id',_0x701c('0x6'),_0x701c('0x9'),_0x701c('0x7')]},{'model':'Action','as':_0x701c('0xa'),'attributes':['id',_0x701c('0xb'),_0x701c('0xc'),'data2',_0x701c('0xd'),_0x701c('0xe'),_0x701c('0xf'),_0x701c('0x10'),'data7']}]},'log':_0x701c('0x3')});};}; \ No newline at end of file +var _0xdbc4=['data3','data4','data5','data6','data7','../client','GetTrigger','name','channel','status','AllConditions','field','operator','AnyConditions','value','Action','Actions','data1'];(function(_0x1cde38,_0x4b85b9){var _0x42af72=function(_0x516e45){while(--_0x516e45){_0x1cde38['push'](_0x1cde38['shift']());}};_0x42af72(++_0x4b85b9);}(_0xdbc4,0x1b5));var _0x4dbc=function(_0x4a97e4,_0x4a87ab){_0x4a97e4=_0x4a97e4-0x0;var _0x6d8512=_0xdbc4[_0x4a97e4];return _0x6d8512;};'use strict';var client=require(_0x4dbc('0x0'));exports['getTriggers']=function(_0x1e2e96){return function(_0x5d1b5b){return client['Request'](_0x4dbc('0x1'),{'options':{'raw':![],'attributes':['id',_0x4dbc('0x2'),_0x4dbc('0x3'),_0x4dbc('0x4')],'include':[{'model':'Condition','as':_0x4dbc('0x5'),'attributes':['id',_0x4dbc('0x6'),_0x4dbc('0x7'),'value']},{'model':'Condition','as':_0x4dbc('0x8'),'attributes':['id',_0x4dbc('0x6'),_0x4dbc('0x7'),_0x4dbc('0x9')]},{'model':_0x4dbc('0xa'),'as':_0x4dbc('0xb'),'attributes':['id','action',_0x4dbc('0xc'),'data2',_0x4dbc('0xd'),_0x4dbc('0xe'),_0x4dbc('0xf'),_0x4dbc('0x10'),_0x4dbc('0x11')]}]},'log':_0x4dbc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 76c8b25..a15ecd9 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 _0x2029=['defaultuser','getTrunks','Request','GetTrunk','name','registry'];(function(_0x5ed2a3,_0x187431){var _0x5e8011=function(_0xfb3bb9){while(--_0xfb3bb9){_0x5ed2a3['push'](_0x5ed2a3['shift']());}};_0x5e8011(++_0x187431);}(_0x2029,0xb5));var _0x9202=function(_0x335f33,_0x2bbce0){_0x335f33=_0x335f33-0x0;var _0x796c65=_0x2029[_0x335f33];return _0x796c65;};'use strict';var client=require('../client');exports[_0x9202('0x0')]=function(_0x51a87b){return function(_0xe31a4b){return client[_0x9202('0x1')](_0x9202('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9202('0x3'),_0x9202('0x4'),_0x9202('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x68de=['Request','GetTrunk','name','registry','../client','getTrunks'];(function(_0x71690f,_0x11f550){var _0x2f93fd=function(_0xd1272f){while(--_0xd1272f){_0x71690f['push'](_0x71690f['shift']());}};_0x2f93fd(++_0x11f550);}(_0x68de,0xfa));var _0xe68d=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x68de[_0x31b5a5];return _0x364cc9;};'use strict';var client=require(_0xe68d('0x0'));exports[_0xe68d('0x1')]=function(_0x54ab67){return function(_0x5b4078){return client[_0xe68d('0x2')](_0xe68d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe68d('0x4'),_0xe68d('0x5'),'defaultuser']},'log':_0xe68d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a2b4037..485c91b 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0x27a824,_0x50dc82){_0x27a824=_0x27a824-0x0;var _0x5a1a7b=_0xe706[_0x27a824];return _0x5a1a7b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x5e1de6,_0xc1c462){var _0x3e2d3d=function(_0x3d58f3){while(--_0x3d58f3){_0x5e1de6['push'](_0x5e1de6['shift']());}};_0x3e2d3d(++_0xc1c462);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xcb91[_0xdd2bfa];return _0x55397e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 99c8383..10d59d2 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 _0xe578=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x4bfb40,_0x438c7b){var _0x393ce5=function(_0x506b33){while(--_0x506b33){_0x4bfb40['push'](_0x4bfb40['shift']());}};_0x393ce5(++_0x438c7b);}(_0xe578,0x17a));var _0x8e57=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe578[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x8e57('0x0'));exports[_0x8e57('0x1')]=function(_0x483e4f){return client[_0x8e57('0x2')](_0x8e57('0x3'),{'body':_0x483e4f,'log':_0x8e57('0x3')});};exports[_0x8e57('0x4')]=function(_0x42c405,_0x36aad3,_0x426805){return client[_0x8e57('0x2')](_0x8e57('0x5'),{'body':_0x42c405,'options':{'where':{'uniqueid':_0x36aad3,'interface':_0x426805,'agentcomplete':!![]}},'log':_0x8e57('0x5')});}; \ No newline at end of file +var _0x4125=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x4125,0xbf));var _0x5412=function(_0x8fb66b,_0x537fe1){_0x8fb66b=_0x8fb66b-0x0;var _0x2fa2c7=_0x4125[_0x8fb66b];return _0x2fa2c7;};'use strict';var client=require(_0x5412('0x0'));exports[_0x5412('0x1')]=function(_0x39ebde){return client[_0x5412('0x2')](_0x5412('0x3'),{'body':_0x39ebde,'log':_0x5412('0x3')});};exports[_0x5412('0x4')]=function(_0xe6bd77,_0x1792d4,_0x27314b){return client[_0x5412('0x2')](_0x5412('0x5'),{'body':_0xe6bd77,'options':{'where':{'uniqueid':_0x1792d4,'interface':_0x27314b,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index de6e248..4d86c0f 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 _0x799a=['YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x103cdb,_0x372b5f){var _0xaccac2=function(_0x37220e){while(--_0x37220e){_0x103cdb['push'](_0x103cdb['shift']());}};_0xaccac2(++_0x372b5f);}(_0x799a,0x6b));var _0xa799=function(_0x49aa40,_0x4034c5){_0x49aa40=_0x49aa40-0x0;var _0x23aaa0=_0x799a[_0x49aa40];return _0x23aaa0;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xa799('0x0'));var client=require(_0xa799('0x1'));exports[_0xa799('0x2')]=function(_0x4c38c3){return client[_0xa799('0x3')](_0xa799('0x4'),{'body':_[_0xa799('0x5')](_0x4c38c3,{'source':_0x4c38c3[_0xa799('0x6')],'destinationcontext':_0x4c38c3[_0xa799('0x7')],'callerid':_0x4c38c3['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xa799('0x4')});};exports[_0xa799('0x8')]=function(){return function(){return client[_0xa799('0x3')](_0xa799('0x9'),{'options':{'where':{'type':[_0xa799('0xa')],'createdAt':{'$between':[moment()[_0xa799('0xb')](_0xa799('0xc'))['format'](_0xa799('0xd')),moment()[_0xa799('0xe')](_0xa799('0xc'))[_0xa799('0xf')](_0xa799('0xd'))]}},'attributes':[_0xa799('0x10'),_0xa799('0x11'),_0xa799('0x12'),_0xa799('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x0afa=['endOf','type','duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0afa,0x98));var _0xa0af=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0afa[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0xa0af('0x0'));var util=require('util');var _=require(_0xa0af('0x1'));var client=require('../client');exports[_0xa0af('0x2')]=function(_0x4ea47f){return client[_0xa0af('0x3')](_0xa0af('0x4'),{'body':_[_0xa0af('0x5')](_0x4ea47f,{'source':_0x4ea47f[_0xa0af('0x6')],'destinationcontext':_0x4ea47f[_0xa0af('0x7')],'callerid':_0x4ea47f[_0xa0af('0x8')],'amaflags':_0xa0af('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xa0af('0xa')]=function(){return function(){return client[_0xa0af('0x3')](_0xa0af('0xb'),{'options':{'where':{'type':[_0xa0af('0xc')],'createdAt':{'$between':[moment()[_0xa0af('0xd')](_0xa0af('0xe'))[_0xa0af('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa0af('0x10')](_0xa0af('0xe'))[_0xa0af('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa0af('0x11'),'disposition',_0xa0af('0x12'),_0xa0af('0x13')]},'log':_0xa0af('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index dc8b21e..e935a67 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 _0xcd20=['../client','create','Request','CreateVoiceDialReport'];(function(_0x530a00,_0x449fde){var _0x154742=function(_0x3b6846){while(--_0x3b6846){_0x530a00['push'](_0x530a00['shift']());}};_0x154742(++_0x449fde);}(_0xcd20,0xb8));var _0x0cd2=function(_0x567758,_0x533bba){_0x567758=_0x567758-0x0;var _0x1d0e7f=_0xcd20[_0x567758];return _0x1d0e7f;};'use strict';var client=require(_0x0cd2('0x0'));exports[_0x0cd2('0x1')]=function(_0x438f10){return client[_0x0cd2('0x2')]('CreateVoiceDialReport',{'body':_0x438f10,'log':_0x0cd2('0x3')});}; \ No newline at end of file +var _0xba8c=['Request','CreateVoiceDialReport','../client','create'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0xba8c,0x8e));var _0xcba8=function(_0x226d2e,_0x458258){_0x226d2e=_0x226d2e-0x0;var _0xc5791=_0xba8c[_0x226d2e];return _0xc5791;};'use strict';var client=require(_0xcba8('0x0'));exports[_0xcba8('0x1')]=function(_0x3a2fbe){return client[_0xcba8('0x2')](_0xcba8('0x3'),{'body':_0x3a2fbe,'log':_0xcba8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c5e2bde..8a2c9e2 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 _0x2bdb=['getVoiceExtensions','../client','Request','exten','recordingFormat'];(function(_0x2b8962,_0xa2b753){var _0x19ed1e=function(_0x36dd07){while(--_0x36dd07){_0x2b8962['push'](_0x2b8962['shift']());}};_0x19ed1e(++_0xa2b753);}(_0x2bdb,0x105));var _0xb2bd=function(_0x1cac77,_0x430161){_0x1cac77=_0x1cac77-0x0;var _0x4d94dd=_0x2bdb[_0x1cac77];return _0x4d94dd;};'use strict';var client=require(_0xb2bd('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb2bd('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xb2bd('0x2'),_0xb2bd('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb2bd('0x4')});};}; \ No newline at end of file +var _0x750a=['exten','recordingFormat','getVoiceExtensions'];(function(_0x49147e,_0x56b4e7){var _0x48c3d5=function(_0x1a236d){while(--_0x1a236d){_0x49147e['push'](_0x49147e['shift']());}};_0x48c3d5(++_0x56b4e7);}(_0x750a,0x140));var _0xa750=function(_0x4d84bf,_0x5adbcf){_0x4d84bf=_0x4d84bf-0x0;var _0xcd730e=_0x750a[_0x4d84bf];return _0xcd730e;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xa750('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 16a58c4..bb83b3c 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 _0xe5f7=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','name','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x48122d,_0x5902d8){var _0x5c5070=function(_0x10ac27){while(--_0x10ac27){_0x48122d['push'](_0x48122d['shift']());}};_0x5c5070(++_0x5902d8);}(_0xe5f7,0x178));var _0x7e5f=function(_0x2b28ed,_0x102243){_0x2b28ed=_0x2b28ed-0x0;var _0x2618a2=_0xe5f7[_0x2b28ed];return _0x2618a2;};'use strict';var client=require(_0x7e5f('0x0'));exports[_0x7e5f('0x1')]=function(){return function(){return client[_0x7e5f('0x2')](_0x7e5f('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x7e5f('0x4'),_0x7e5f('0x5'),_0x7e5f('0x6'),'type',_0x7e5f('0x7'),_0x7e5f('0x8'),'dialLimitChannel',_0x7e5f('0x9'),_0x7e5f('0xa'),_0x7e5f('0xb'),_0x7e5f('0xc'),_0x7e5f('0xd'),_0x7e5f('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x7e5f('0xf'),_0x7e5f('0x10'),_0x7e5f('0x11'),_0x7e5f('0x12'),_0x7e5f('0x13'),_0x7e5f('0x14'),_0x7e5f('0x15'),_0x7e5f('0x16'),_0x7e5f('0x17'),_0x7e5f('0x18'),'dialTimezone',_0x7e5f('0x19'),'dialPrefix',_0x7e5f('0x1a'),_0x7e5f('0x1b'),_0x7e5f('0x1c'),_0x7e5f('0x1d'),_0x7e5f('0x1e'),_0x7e5f('0x1f'),_0x7e5f('0x20'),_0x7e5f('0x21'),_0x7e5f('0x22'),_0x7e5f('0x23'),'dialAMDMaximumWordLength',_0x7e5f('0x24'),_0x7e5f('0x25'),_0x7e5f('0x26'),_0x7e5f('0x27'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0x7e5f('0x6'),_0x7e5f('0x28'),'dialRandomLastDigitCallerIdNumber',_0x7e5f('0x29'),_0x7e5f('0x2a'),_0x7e5f('0x2b'),_0x7e5f('0x2c'),_0x7e5f('0x2d'),_0x7e5f('0x2e'),_0x7e5f('0x2f'),'dialMachineMaxRetry',_0x7e5f('0x30'),'dialAgentRejectMaxRetry',_0x7e5f('0x31'),_0x7e5f('0x32'),'dialPredictiveIntervalMaxThreshold',_0x7e5f('0x33'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x7e5f('0x34'),'as':'Trunk','attributes':['id',_0x7e5f('0x35'),'callerid',_0x7e5f('0x36')]},{'model':_0x7e5f('0x37'),'as':_0x7e5f('0x38'),'attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x7e5f('0x35'),_0x7e5f('0x39'),_0x7e5f('0x36')]},{'model':_0x7e5f('0x3a'),'as':_0x7e5f('0x3a'),'attributes':['id',_0x7e5f('0x35')],'include':[{'model':_0x7e5f('0x3a'),'as':_0x7e5f('0x3b'),'attributes':['id','name','interval']}]}]},'log':_0x7e5f('0x1')});};}; \ No newline at end of file +var _0xfa71=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','mandatoryDispositionPause','TrunkBackup','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence'];(function(_0x2ca445,_0x40a985){var _0x434e3d=function(_0x354ff3){while(--_0x354ff3){_0x2ca445['push'](_0x2ca445['shift']());}};_0x434e3d(++_0x40a985);}(_0xfa71,0xa2));var _0x1fa7=function(_0x251429,_0x55f265){_0x251429=_0x251429-0x0;var _0x2d5d69=_0xfa71[_0x251429];return _0x2d5d69;};'use strict';var client=require(_0x1fa7('0x0'));exports[_0x1fa7('0x1')]=function(){return function(){return client[_0x1fa7('0x2')](_0x1fa7('0x3'),{'options':{'raw':![],'attributes':['id',_0x1fa7('0x4'),_0x1fa7('0x5'),_0x1fa7('0x6'),'autopause',_0x1fa7('0x7'),_0x1fa7('0x8'),'dialActive',_0x1fa7('0x9'),_0x1fa7('0xa'),_0x1fa7('0xb'),_0x1fa7('0xc'),_0x1fa7('0xd'),_0x1fa7('0xe'),_0x1fa7('0xf'),_0x1fa7('0x10'),_0x1fa7('0x11'),_0x1fa7('0x12'),'dialQueueOptions',_0x1fa7('0x13'),_0x1fa7('0x14'),'dialCongestionMaxRetry',_0x1fa7('0x15'),_0x1fa7('0x16'),'dialBusyRetryFrequency',_0x1fa7('0x17'),_0x1fa7('0x18'),_0x1fa7('0x19'),_0x1fa7('0x1a'),'dialGlobalInterval',_0x1fa7('0x1b'),_0x1fa7('0x1c'),_0x1fa7('0x1d'),'dialAMDInitialSilence',_0x1fa7('0x1e'),_0x1fa7('0x1f'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x1fa7('0x20'),_0x1fa7('0x21'),_0x1fa7('0x22'),_0x1fa7('0x23'),_0x1fa7('0x24'),_0x1fa7('0x25'),_0x1fa7('0x26'),_0x1fa7('0x27'),_0x1fa7('0x28'),_0x1fa7('0x29'),_0x1fa7('0x2a'),_0x1fa7('0x7'),_0x1fa7('0x2b'),_0x1fa7('0x2c'),_0x1fa7('0x2d'),'dialNoSuchNumberMaxRetry',_0x1fa7('0x2e'),_0x1fa7('0x2f'),_0x1fa7('0x30'),_0x1fa7('0x31'),_0x1fa7('0x32'),_0x1fa7('0x33'),_0x1fa7('0x34'),_0x1fa7('0x35'),_0x1fa7('0x36'),_0x1fa7('0x37'),_0x1fa7('0x38'),_0x1fa7('0x39'),_0x1fa7('0x3a'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x1fa7('0x3b'),'attributes':['id',_0x1fa7('0x4'),_0x1fa7('0x3c'),'active']},{'model':'Pause','as':_0x1fa7('0x3d'),'attributes':['id',_0x1fa7('0x4')]},{'model':'Trunk','as':_0x1fa7('0x3e'),'attributes':['id',_0x1fa7('0x4'),_0x1fa7('0x3c'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x1fa7('0x4')],'include':[{'model':'Interval','as':_0x1fa7('0x3f'),'attributes':['id',_0x1fa7('0x4'),_0x1fa7('0x40')]}]}]},'log':_0x1fa7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1992afd..8ecac5d 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(_0x3ee79,_0x49a3b1){var _0x1fe997=function(_0xb47b75){while(--_0xb47b75){_0x3ee79['push'](_0x3ee79['shift']());}};_0x1fe997(++_0x49a3b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x2448d4,_0xb97fda){var _0x2b08df=function(_0x52bf52){while(--_0x52bf52){_0x2448d4['push'](_0x2448d4['shift']());}};_0x2b08df(++_0xb97fda);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 b8a168c..6fb22ab 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 _0x8f3c=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x16fcfe,_0x5383fc){var _0xe1aa65=function(_0x39e575){while(--_0x39e575){_0x16fcfe['push'](_0x16fcfe['shift']());}};_0xe1aa65(++_0x5383fc);}(_0x8f3c,0x135));var _0xc8f3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f3c[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xc8f3('0x0'));exports[_0xc8f3('0x1')]=function(_0xd84583){return function(){return client['Request'](_0xc8f3('0x2'),{'options':{'where':{'VoiceQueueId':_0xd84583,'paused':!![]},'raw':!![]},'log':_0xc8f3('0x1')});};}; \ No newline at end of file +var _0x7d8c=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7d8c,0xac));var _0xc7d8=function(_0xacad5f,_0x26f77b){_0xacad5f=_0xacad5f-0x0;var _0x55853c=_0x7d8c[_0xacad5f];return _0x55853c;};'use strict';var client=require(_0xc7d8('0x0'));exports['getVoiceQueueRtPauses']=function(_0x54bdab){return function(){return client[_0xc7d8('0x1')](_0xc7d8('0x2'),{'options':{'where':{'VoiceQueueId':_0x54bdab,'paused':!![]},'raw':!![]},'log':_0xc7d8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c3e1e02..434cd48 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x541e97,_0xc662e6){var _0x2a3e0d=function(_0x8d177e){while(--_0x8d177e){_0x541e97['push'](_0x541e97['shift']());}};_0x2a3e0d(++_0xc662e6);}(_0x7a54,0x106));var _0x47a5=function(_0x1602ee,_0x231b8d){_0x1602ee=_0x1602ee-0x0;var _0x243269=_0x7a54[_0x1602ee];return _0x243269;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4e9c84,_0x562674){var _0x2267db=function(_0x396b5b){while(--_0x396b5b){_0x4e9c84['push'](_0x4e9c84['shift']());}};_0x2267db(++_0x562674);}(_0x7a54,0x106));var _0x47a5=function(_0x365316,_0x471018){_0x365316=_0x365316-0x0;var _0x1009de=_0x7a54[_0x365316];return _0x1009de;};'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 3fe16bf..eeb5ad4 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 _0x50a0=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereelinkedid','context','extension','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','transfers','blindTransfer','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x50a0,0xbf));var _0x050a=function(_0x121078,_0x1ba431){_0x121078=_0x121078-0x0;var _0x495e6a=_0x50a0[_0x121078];return _0x495e6a;};'use strict';var client=require('../client');exports[_0x050a('0x0')]={};exports[_0x050a('0x1')]=function(_0x2b3222){return client['Request'](_0x050a('0x2'),{'body':{'result':_0x2b3222['result'],'transfererchannel':_0x2b3222['transfererchannel'],'transferercalleridnum':_0x2b3222[_0x050a('0x3')],'transferercalleridname':_0x2b3222[_0x050a('0x4')],'transfererconnectedlinenum':_0x2b3222[_0x050a('0x5')],'transfererconnectedlinename':_0x2b3222[_0x050a('0x6')],'transfereraccountcode':_0x2b3222[_0x050a('0x7')],'transferercontext':_0x2b3222[_0x050a('0x8')],'transfererexten':_0x2b3222[_0x050a('0x9')],'transfererlinkedid':_0x2b3222[_0x050a('0xa')],'transfereechannel':_0x2b3222[_0x050a('0xb')],'transfereecalleridnum':_0x2b3222[_0x050a('0xc')],'transfereecalleridname':_0x2b3222[_0x050a('0xd')],'transfereeconnectedlinenum':_0x2b3222[_0x050a('0xe')],'transfereeconnectedlinename':_0x2b3222[_0x050a('0xf')],'transfereeaccountcode':_0x2b3222['transfereeaccountcode'],'transfereecontext':_0x2b3222['transfereecontext'],'transfereeexten':_0x2b3222['transfereeexten'],'transfereelinkedid':_0x2b3222[_0x050a('0x10')],'isexternal':_0x2b3222['isexternal'],'context':_0x2b3222[_0x050a('0x11')],'extension':_0x2b3222[_0x050a('0x12')],'type':_0x050a('0x13')},'log':_0x050a('0x2')});};exports[_0x050a('0x14')]=function(_0x5c478f){return client[_0x050a('0x15')](_0x050a('0x2'),{'body':{'result':_0x5c478f[_0x050a('0x16')],'transfererchannel':_0x5c478f[_0x050a('0x17')],'transferercalleridnum':_0x5c478f[_0x050a('0x18')],'transferercalleridname':_0x5c478f[_0x050a('0x19')],'transfererconnectedlinenum':_0x5c478f[_0x050a('0x1a')],'transfererconnectedlinename':_0x5c478f[_0x050a('0x1b')],'transfereraccountcode':_0x5c478f[_0x050a('0x1c')],'transferercontext':_0x5c478f[_0x050a('0x1d')],'transfererexten':_0x5c478f['secondtransfererexten'],'transfererlinkedid':_0x5c478f[_0x050a('0x1e')],'transfereechannel':_0x5c478f[_0x050a('0x1f')],'transfereecalleridnum':_0x5c478f[_0x050a('0x20')],'transfereecalleridname':_0x5c478f[_0x050a('0x21')],'transfereeconnectedlinenum':_0x5c478f[_0x050a('0x22')],'transfereeconnectedlinename':_0x5c478f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5c478f['transfertargetaccountcode'],'transfereecontext':_0x5c478f[_0x050a('0x23')],'transfereeexten':_0x5c478f[_0x050a('0x24')],'transfereelinkedid':_0x5c478f[_0x050a('0x25')],'isexternal':_0x5c478f[_0x050a('0x26')],'context':_0x5c478f[_0x050a('0x27')],'extension':_0x5c478f['origtransfererexten'],'type':_0x050a('0x28')},'log':_0x050a('0x2')});}; \ No newline at end of file +var _0xcbe2=['transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xcbe2,0x18b));var _0x2cbe=function(_0x429fe1,_0x27200d){_0x429fe1=_0x429fe1-0x0;var _0x38274b=_0xcbe2[_0x429fe1];return _0x38274b;};'use strict';var client=require('../client');exports[_0x2cbe('0x0')]={};exports['blindTransfer']=function(_0x38edc5){return client['Request'](_0x2cbe('0x1'),{'body':{'result':_0x38edc5[_0x2cbe('0x2')],'transfererchannel':_0x38edc5[_0x2cbe('0x3')],'transferercalleridnum':_0x38edc5[_0x2cbe('0x4')],'transferercalleridname':_0x38edc5[_0x2cbe('0x5')],'transfererconnectedlinenum':_0x38edc5[_0x2cbe('0x6')],'transfererconnectedlinename':_0x38edc5[_0x2cbe('0x7')],'transfereraccountcode':_0x38edc5['transfereraccountcode'],'transferercontext':_0x38edc5[_0x2cbe('0x8')],'transfererexten':_0x38edc5[_0x2cbe('0x9')],'transfererlinkedid':_0x38edc5[_0x2cbe('0xa')],'transfereechannel':_0x38edc5[_0x2cbe('0xb')],'transfereecalleridnum':_0x38edc5['transfereecalleridnum'],'transfereecalleridname':_0x38edc5['transfereecalleridname'],'transfereeconnectedlinenum':_0x38edc5['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x38edc5[_0x2cbe('0xc')],'transfereeaccountcode':_0x38edc5[_0x2cbe('0xd')],'transfereecontext':_0x38edc5[_0x2cbe('0xe')],'transfereeexten':_0x38edc5[_0x2cbe('0xf')],'transfereelinkedid':_0x38edc5[_0x2cbe('0x10')],'isexternal':_0x38edc5[_0x2cbe('0x11')],'context':_0x38edc5[_0x2cbe('0x12')],'extension':_0x38edc5[_0x2cbe('0x13')],'type':_0x2cbe('0x14')},'log':_0x2cbe('0x1')});};exports[_0x2cbe('0x15')]=function(_0x2f3d7c){return client[_0x2cbe('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x2f3d7c[_0x2cbe('0x2')],'transfererchannel':_0x2f3d7c[_0x2cbe('0x17')],'transferercalleridnum':_0x2f3d7c[_0x2cbe('0x18')],'transferercalleridname':_0x2f3d7c['origtransferercalleridname'],'transfererconnectedlinenum':_0x2f3d7c[_0x2cbe('0x19')],'transfererconnectedlinename':_0x2f3d7c[_0x2cbe('0x1a')],'transfereraccountcode':_0x2f3d7c[_0x2cbe('0x1b')],'transferercontext':_0x2f3d7c[_0x2cbe('0x1c')],'transfererexten':_0x2f3d7c['secondtransfererexten'],'transfererlinkedid':_0x2f3d7c[_0x2cbe('0x1d')],'transfereechannel':_0x2f3d7c[_0x2cbe('0x1e')],'transfereecalleridnum':_0x2f3d7c['transfertargetcalleridnum'],'transfereecalleridname':_0x2f3d7c[_0x2cbe('0x1f')],'transfereeconnectedlinenum':_0x2f3d7c[_0x2cbe('0x20')],'transfereeconnectedlinename':_0x2f3d7c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2f3d7c[_0x2cbe('0x21')],'transfereecontext':_0x2f3d7c[_0x2cbe('0x22')],'transfereeexten':_0x2f3d7c[_0x2cbe('0x23')],'transfereelinkedid':_0x2f3d7c['transfertargetlinkedid'],'isexternal':_0x2f3d7c[_0x2cbe('0x11')],'context':_0x2f3d7c[_0x2cbe('0x24')],'extension':_0x2f3d7c[_0x2cbe('0x25')],'type':_0x2cbe('0x26')},'log':_0x2cbe('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7eb1d59..c7560bc 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1c3df0,_0x508ec1){var _0x1ff4f5=function(_0x3b28a0){while(--_0x3b28a0){_0x1c3df0['push'](_0x1c3df0['shift']());}};_0x1ff4f5(++_0x508ec1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e54e9,_0x40a2b7){_0x4e54e9=_0x4e54e9-0x0;var _0x32be8f=_0xb10b[_0x4e54e9];return _0x32be8f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4affd5,_0x417b85){var _0x37b836=function(_0x2b07cc){while(--_0x2b07cc){_0x4affd5['push'](_0x4affd5['shift']());}};_0x37b836(++_0x417b85);}(_0xb10b,0x12a));var _0xbb10=function(_0x469c7c,_0x4a54c6){_0x469c7c=_0x469c7c-0x0;var _0x4b8ffa=_0xb10b[_0x469c7c];return _0x4b8ffa;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 93b0dcd..72d7cb1 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 _0xbdcf=['createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','fax'];(function(_0x30fa89,_0x46cc7d){var _0x2f03df=function(_0x18f02c){while(--_0x18f02c){_0x30fa89['push'](_0x30fa89['shift']());}};_0x2f03df(++_0x46cc7d);}(_0xbdcf,0x173));var _0xfbdc=function(_0x557419,_0x20839f){_0x557419=_0x557419-0x0;var _0x10c03b=_0xbdcf[_0x557419];return _0x10c03b;};'use strict';var _=require(_0xfbdc('0x0'));var BPromise=require('bluebird');var Redis=require(_0xfbdc('0x1'));var util=require(_0xfbdc('0x2'));var config=require(_0xfbdc('0x3'));var logger=require(_0xfbdc('0x4'))('trigger');var cmContactRpc=require(_0xfbdc('0x5'));config['redis']=_[_0xfbdc('0x6')](config['redis'],{'host':_0xfbdc('0x7'),'port':0x18eb});var io=require(_0xfbdc('0x8'))(new Redis(config['redis']));function emit(_0x3346a2,_0x5855d1,_0x497675,_0x2bb9f7,_0x3df7e4){logger[_0xfbdc('0x9')](_0xfbdc('0xa'),_0x3346a2,_0x5855d1['id'],_0x497675,_0x2bb9f7,JSON[_0xfbdc('0xb')](_0x3df7e4));io['to'](_0x497675)[_0xfbdc('0xc')](_0x2bb9f7,_0x3df7e4);}exports[_0xfbdc('0xd')]=function(_0x585a88,_0x104d7f,_0x119d60,_0x44d535){var _0x2a560a,_0x20cabf;var _0x25576d={};var _0x18a5c3;var _0x2f7358=Number(_0x119d60['data1']);var _0x40b8d9=_0x119d60[_0xfbdc('0xe')]?Boolean(Number(_0x119d60[_0xfbdc('0xe')])):![];var _0x36298b;var _0x2704cb=![];if(!_[_0xfbdc('0xf')](_0x119d60[_0xfbdc('0x10')])){if(_0x119d60[_0xfbdc('0x10')]=='1')_0x2704cb=!![];}if(!_0x2704cb){if(_0x44d535['xmd-contactid']){_0x25576d['id']=_0x44d535['xmd-contactid'];}}if(!_0x25576d['id']){_0x25576d[_0xfbdc('0x11')]=_0x2f7358;_0x36298b=_0x119d60[_0xfbdc('0x12')]&&_0x119d60[_0xfbdc('0x12')]!=='0'?_0x119d60[_0xfbdc('0x12')][_0xfbdc('0x13')](','):[_0xfbdc('0x14')];_0x25576d[_0xfbdc('0x15')]=_[_0xfbdc('0x16')](_0x36298b,function(_0x10aed9){var _0x117ad2={};_0x117ad2[_0x10aed9]=_0x44d535[_0xfbdc('0x17')]?_0x44d535[_0xfbdc('0x18')]:_0x44d535['calleridnum'];return _0x117ad2;});_0x18a5c3=_0x44d535['routeId']?_0x44d535['destcalleridnum']:_0x44d535[_0xfbdc('0x19')];}var _0x4f7301=['id','firstName',_0xfbdc('0x1a'),_0xfbdc('0x14'),'mobile',_0xfbdc('0x1b'),_0xfbdc('0x11'),_0xfbdc('0x1c'),_0xfbdc('0x1d'),_0xfbdc('0x1e')];var _0x351173=_[_0xfbdc('0x1f')](_0x4f7301,_0x36298b);BPromise[_0xfbdc('0x20')]()[_0xfbdc('0x21')](cmContactRpc[_0xfbdc('0x22')]({'attributes':_0x351173,'where':_0x25576d,'phone':_0x18a5c3}))[_0xfbdc('0x21')](function(_0x5a12ad){_0x20cabf=_0x5a12ad;if(!_[_0xfbdc('0x23')](_0x20cabf)){if(_0x20cabf[_0xfbdc('0x24')]===0x1){_0x2a560a=_0x20cabf[0x0];logger[_0xfbdc('0x9')](_0xfbdc('0x25'),_0x44d535[_0xfbdc('0x26')],_0x104d7f['id'],_0x2a560a['id']);}else{logger[_0xfbdc('0x9')](_0xfbdc('0x27'),_0x44d535[_0xfbdc('0x26')],_0x104d7f['id'],_[_0xfbdc('0x16')](_0x20cabf,'id')['join'](','));}return;}else{logger[_0xfbdc('0x9')](_0xfbdc('0x28'),_0x44d535[_0xfbdc('0x26')],_0x104d7f['id']);var _0x2bdeeb={'ListId':_0x2f7358};var _0x9f874a=_0x119d60[_0xfbdc('0x29')]&&_0x119d60[_0xfbdc('0x29')]!=='0'?_0x119d60['data4']:'phone';if(_0x40b8d9){logger[_0xfbdc('0x9')](_0xfbdc('0x2a'),_0x44d535['uniqueid'],_0x104d7f['id']);_0x2bdeeb[_0x9f874a]=_[_0xfbdc('0xf')](_0x44d535[_0xfbdc('0x17')])?_0x44d535[_0xfbdc('0x19')]:_0x44d535[_0xfbdc('0x18')];if(_[_0xfbdc('0xf')](_0x44d535[_0xfbdc('0x17')])){_0x2bdeeb[_0xfbdc('0x2b')]=_0x44d535['calleridname']&&_0x44d535[_0xfbdc('0x2c')]!==_0xfbdc('0x2d')?_0x44d535[_0xfbdc('0x2c')]:_0xfbdc('0x2e');}else{_0x2bdeeb[_0xfbdc('0x2b')]=_0x44d535[_0xfbdc('0x2f')]&&_0x44d535[_0xfbdc('0x2f')]!==_0xfbdc('0x2d')?_0x44d535['destcalleridname']:_0xfbdc('0x2e');}return BPromise[_0xfbdc('0x20')]()[_0xfbdc('0x21')](cmContactRpc['createContact'](_0x2bdeeb))[_0xfbdc('0x21')](function(_0x42c0c7){_0x2a560a=_0x42c0c7;_0x20cabf[_0xfbdc('0x30')](_0x42c0c7);if(_0x2a560a){logger[_0xfbdc('0x9')](_0xfbdc('0x31'),_0x44d535[_0xfbdc('0x26')],_0x104d7f['id'],_0x2a560a['id']);}return;});}else{logger['info'](_0xfbdc('0x32'),_0x44d535['uniqueid'],_0x104d7f['id']);_0x2bdeeb[_0x9f874a]=_[_0xfbdc('0xf')](_0x44d535[_0xfbdc('0x17')])?_0x44d535['calleridnum']:_0x44d535['destcalleridnum'];if(_[_0xfbdc('0xf')](_0x44d535[_0xfbdc('0x17')])){_0x2bdeeb[_0xfbdc('0x2b')]=_0x44d535[_0xfbdc('0x2c')]&&_0x44d535[_0xfbdc('0x2c')]!==_0xfbdc('0x2d')?_0x44d535['calleridname']:_0xfbdc('0x2e');}else{_0x2bdeeb[_0xfbdc('0x2b')]=_0x44d535[_0xfbdc('0x2f')]&&_0x44d535[_0xfbdc('0x2f')]!==_0xfbdc('0x2d')?_0x44d535[_0xfbdc('0x2f')]:'Unknown';}_0x2a560a=_0x2bdeeb;_0x20cabf['push'](_0x2bdeeb);return;}}})[_0xfbdc('0x21')](function(){if(_0x585a88){emit(_0x44d535[_0xfbdc('0x26')],_0x104d7f,util[_0xfbdc('0x33')]('user:%s',_0x585a88[_0xfbdc('0x34')]),util[_0xfbdc('0x33')](_0xfbdc('0x35'),_0x119d60[_0xfbdc('0x36')][_0xfbdc('0x37')]()),{'evt':_[_0xfbdc('0x38')](_0x44d535,{'autoCreate':_0x40b8d9}),'contact':_0x2a560a===undefined?{}:_0x2a560a,'contacts':_0x20cabf[_0xfbdc('0x24')]===0x0?undefined:_0x20cabf});}});}; \ No newline at end of file +var _0x844d=['Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','data5','xmd-contactid','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname',''];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x844d,0xec));var _0xd844=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x844d[_0x23b85e];return _0x329756;};'use strict';var _=require('lodash');var BPromise=require(_0xd844('0x0'));var Redis=require('ioredis');var util=require(_0xd844('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd844('0x2'));var cmContactRpc=require(_0xd844('0x3'));config[_0xd844('0x4')]=_[_0xd844('0x5')](config[_0xd844('0x4')],{'host':_0xd844('0x6'),'port':0x18eb});var io=require(_0xd844('0x7'))(new Redis(config[_0xd844('0x4')]));function emit(_0x389e21,_0x4d995f,_0x204ff2,_0x1186b0,_0x35fc5b){logger[_0xd844('0x8')](_0xd844('0x9'),_0x389e21,_0x4d995f['id'],_0x204ff2,_0x1186b0,JSON[_0xd844('0xa')](_0x35fc5b));io['to'](_0x204ff2)[_0xd844('0xb')](_0x1186b0,_0x35fc5b);}exports[_0xd844('0xc')]=function(_0x32e309,_0x242412,_0x515d3a,_0x27382c){var _0x14ed7d,_0x11e14c;var _0x39e000={};var _0x3905a1;var _0x5e3773=Number(_0x515d3a['data1']);var _0x152ced=_0x515d3a[_0xd844('0xd')]?Boolean(Number(_0x515d3a[_0xd844('0xd')])):![];var _0x5a4133;var _0x36cc42=![];if(!_['isNil'](_0x515d3a[_0xd844('0xe')])){if(_0x515d3a[_0xd844('0xe')]=='1')_0x36cc42=!![];}if(!_0x36cc42){if(_0x27382c[_0xd844('0xf')]){_0x39e000['id']=_0x27382c[_0xd844('0xf')];}}if(!_0x39e000['id']){_0x39e000['ListId']=_0x5e3773;_0x5a4133=_0x515d3a[_0xd844('0x10')]&&_0x515d3a[_0xd844('0x10')]!=='0'?_0x515d3a[_0xd844('0x10')]['split'](','):['phone'];_0x39e000[_0xd844('0x11')]=_[_0xd844('0x12')](_0x5a4133,function(_0x37cebb){var _0x1a87de={};_0x1a87de[_0x37cebb]=_0x27382c[_0xd844('0x13')]?_0x27382c[_0xd844('0x14')]:_0x27382c[_0xd844('0x15')];return _0x1a87de;});_0x3905a1=_0x27382c[_0xd844('0x13')]?_0x27382c[_0xd844('0x14')]:_0x27382c[_0xd844('0x15')];}var _0x3298cc=['id',_0xd844('0x16'),_0xd844('0x17'),'phone',_0xd844('0x18'),_0xd844('0x19'),_0xd844('0x1a'),_0xd844('0x1b'),_0xd844('0x1c'),_0xd844('0x1d')];var _0x4286bc=_[_0xd844('0x1e')](_0x3298cc,_0x5a4133);BPromise['resolve']()['then'](cmContactRpc[_0xd844('0x1f')]({'attributes':_0x4286bc,'where':_0x39e000,'phone':_0x3905a1}))[_0xd844('0x20')](function(_0x5398fe){_0x11e14c=_0x5398fe;if(!_[_0xd844('0x21')](_0x11e14c)){if(_0x11e14c['length']===0x1){_0x14ed7d=_0x11e14c[0x0];logger[_0xd844('0x8')](_0xd844('0x22'),_0x27382c[_0xd844('0x23')],_0x242412['id'],_0x14ed7d['id']);}else{logger[_0xd844('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x27382c[_0xd844('0x23')],_0x242412['id'],_[_0xd844('0x12')](_0x11e14c,'id')[_0xd844('0x24')](','));}return;}else{logger[_0xd844('0x8')](_0xd844('0x25'),_0x27382c['uniqueid'],_0x242412['id']);var _0x579470={'ListId':_0x5e3773};var _0x440454=_0x515d3a['data4']&&_0x515d3a[_0xd844('0x26')]!=='0'?_0x515d3a[_0xd844('0x26')]:_0xd844('0x27');if(_0x152ced){logger[_0xd844('0x8')](_0xd844('0x28'),_0x27382c[_0xd844('0x23')],_0x242412['id']);_0x579470[_0x440454]=_[_0xd844('0x29')](_0x27382c[_0xd844('0x13')])?_0x27382c[_0xd844('0x15')]:_0x27382c[_0xd844('0x14')];if(_['isNil'](_0x27382c[_0xd844('0x13')])){_0x579470[_0xd844('0x16')]=_0x27382c[_0xd844('0x2a')]&&_0x27382c[_0xd844('0x2a')]!==_0xd844('0x2b')?_0x27382c[_0xd844('0x2a')]:_0xd844('0x2c');}else{_0x579470[_0xd844('0x16')]=_0x27382c[_0xd844('0x2d')]&&_0x27382c[_0xd844('0x2d')]!==_0xd844('0x2b')?_0x27382c[_0xd844('0x2d')]:_0xd844('0x2c');}return BPromise[_0xd844('0x2e')]()[_0xd844('0x20')](cmContactRpc[_0xd844('0x2f')](_0x579470))[_0xd844('0x20')](function(_0x109e8d){_0x14ed7d=_0x109e8d;_0x11e14c['push'](_0x109e8d);if(_0x14ed7d){logger[_0xd844('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x27382c[_0xd844('0x23')],_0x242412['id'],_0x14ed7d['id']);}return;});}else{logger[_0xd844('0x8')](_0xd844('0x30'),_0x27382c['uniqueid'],_0x242412['id']);_0x579470[_0x440454]=_[_0xd844('0x29')](_0x27382c[_0xd844('0x13')])?_0x27382c[_0xd844('0x15')]:_0x27382c[_0xd844('0x14')];if(_[_0xd844('0x29')](_0x27382c[_0xd844('0x13')])){_0x579470[_0xd844('0x16')]=_0x27382c[_0xd844('0x2a')]&&_0x27382c[_0xd844('0x2a')]!==_0xd844('0x2b')?_0x27382c['calleridname']:_0xd844('0x2c');}else{_0x579470[_0xd844('0x16')]=_0x27382c[_0xd844('0x2d')]&&_0x27382c[_0xd844('0x2d')]!==_0xd844('0x2b')?_0x27382c[_0xd844('0x2d')]:_0xd844('0x2c');}_0x14ed7d=_0x579470;_0x11e14c['push'](_0x579470);return;}}})[_0xd844('0x20')](function(){if(_0x32e309){emit(_0x27382c[_0xd844('0x23')],_0x242412,util[_0xd844('0x31')](_0xd844('0x32'),_0x32e309[_0xd844('0x33')]),util[_0xd844('0x31')](_0xd844('0x34'),_0x515d3a[_0xd844('0x35')][_0xd844('0x36')]()),{'evt':_[_0xd844('0x37')](_0x27382c,{'autoCreate':_0x152ced}),'contact':_0x14ed7d===undefined?{}:_0x14ed7d,'contacts':_0x11e14c['length']===0x0?undefined:_0x11e14c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3b9be2c..bae91b3 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 _0x6cf5=['merge','variables','Actions','length','action','toLowerCase','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','format','user:%s','trigger:%s:%s','trigger:%s','contactmanager','exec','queue','routeId','urlforward','script','parse','search','replace','channel','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/logger','../ami','defaults','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6cf5,0x1cf));var _0x56cf=function(_0x30900b,_0x2c1d22){_0x30900b=_0x30900b-0x0;var _0x14cfa1=_0x6cf5[_0x30900b];return _0x14cfa1;};'use strict';var util=require(_0x56cf('0x0'));var _=require(_0x56cf('0x1'));var url=require(_0x56cf('0x2'));var Mustache=require(_0x56cf('0x3'));var Redis=require('ioredis');var urlforward=require(_0x56cf('0x4'));var integration=require(_0x56cf('0x5'));var cmContact=require(_0x56cf('0x6'));var script=require(_0x56cf('0x7'));var config=require('../../../config/environment');var logger=require(_0x56cf('0x8'))('trigger');var ami=require(_0x56cf('0x9'));config['redis']=_[_0x56cf('0xa')](config[_0x56cf('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x56cf('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x51b676,_0x4b65ac){return _0x51b676==_0x4b65ac;},'not_equals':function(_0x4b78ce,_0x18c2ba){return _0x4b78ce!=_0x18c2ba;}};var barAndWebActions=[_0x56cf('0xd'),_0x56cf('0x2'),_0x56cf('0xe')];function Trigger(_0x23e1e6){this[_0x56cf('0xf')]=_0x23e1e6['triggers'];this[_0x56cf('0x10')]=_0x23e1e6[_0x56cf('0x10')];this[_0x56cf('0x11')]=_0x23e1e6[_0x56cf('0x11')];this[_0x56cf('0x12')]=_0x23e1e6[_0x56cf('0x12')];this[_0x56cf('0x13')]=_0x23e1e6['voiceExtensions'];this[_0x56cf('0x14')]=_0x23e1e6[_0x56cf('0x14')];this[_0x56cf('0x15')]=_0x23e1e6[_0x56cf('0x15')];this[_0x56cf('0x16')]=_0x23e1e6[_0x56cf('0x16')];this['sugarcrmAccounts']=_0x23e1e6[_0x56cf('0x17')];this[_0x56cf('0x18')]=_0x23e1e6[_0x56cf('0x18')];this[_0x56cf('0x19')]=_0x23e1e6[_0x56cf('0x19')];this['vtigerAccounts']=_0x23e1e6[_0x56cf('0x1a')];this[_0x56cf('0x1b')]=_0x23e1e6[_0x56cf('0x1b')];this[_0x56cf('0x1c')]=_0x23e1e6[_0x56cf('0x1c')];this[_0x56cf('0x1d')]=_0x23e1e6[_0x56cf('0x1d')];this[_0x56cf('0x1e')]={'zendesk':this[_0x56cf('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x56cf('0x15')],'sugarcrm':this[_0x56cf('0x17')],'zoho':this[_0x56cf('0x18')],'desk':this[_0x56cf('0x19')],'vtiger':this[_0x56cf('0x1a')],'dynamics365':this[_0x56cf('0x1c')],'freshsales':this[_0x56cf('0x1d')],'servicenow':this[_0x56cf('0x1b')]};ami['on'](_0x56cf('0x1f'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x22'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x23'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x24'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x25'),this[_0x56cf('0x20')]['bind'](this));ami['on'](_0x56cf('0x26'),this[_0x56cf('0x20')]['bind'](this));ami['on']('custom:agentbusy',this[_0x56cf('0x20')]['bind'](this));ami['on'](_0x56cf('0x27'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x28'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x29'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x2a'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x2b'),this[_0x56cf('0x2c')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x2d'),this[_0x56cf('0x2c')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x2e'),this[_0x56cf('0x2c')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x2f'),this['syncCustomEvent'][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x30'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x31'),this['syncCustomEvent'][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x32'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x33'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on']('custom:acceptmessage',this[_0x56cf('0x20')][_0x56cf('0x21')](this));ami['on'](_0x56cf('0x34'),this[_0x56cf('0x20')]['bind'](this));ami['on'](_0x56cf('0x35'),this[_0x56cf('0x20')][_0x56cf('0x21')](this));}Trigger[_0x56cf('0x36')]['emit']=function(_0x32287f,_0x44ac62,_0x54edaf){logger[_0x56cf('0x37')](_0x32287f,_0x44ac62,JSON[_0x56cf('0x38')](_0x54edaf));io['to'](_0x32287f)[_0x56cf('0x39')](_0x44ac62,_0x54edaf);};Trigger[_0x56cf('0x36')][_0x56cf('0x20')]=function(_0x3bff23){var _0x37650c=_[_0x56cf('0x3a')](_0x3bff23);if(typeof _0x37650c[_0x56cf('0x3b')]===_0x56cf('0x3c')){_0x37650c[_0x56cf('0x3b')]=_0x56cf('0x3d');}logger[_0x56cf('0x3e')](_0x56cf('0x20'),util[_0x56cf('0x3f')](_0x37650c,{'showHidden':!![],'depth':null}));this[_0x56cf('0x40')](_0x37650c);};Trigger[_0x56cf('0x36')][_0x56cf('0x2c')]=function(_0x2c0d39){if(this[_0x56cf('0x10')][_0x2c0d39[_0x56cf('0x41')]]){this[_0x56cf('0x20')](_0x2c0d39);}};Trigger[_0x56cf('0x36')][_0x56cf('0x40')]=function(_0x5b9ae1){var _0x1e5070;for(var _0x286f22 in this[_0x56cf('0xf')]){if(this[_0x56cf('0xf')][_0x56cf('0x42')](_0x286f22)){if(this[_0x56cf('0xf')][_0x286f22][_0x56cf('0x43')]){_0x1e5070=this[_0x56cf('0x44')](this[_0x56cf('0xf')][_0x286f22],_0x5b9ae1);if(_0x1e5070){_[_0x56cf('0x45')](_0x5b9ae1,_0x5b9ae1[_0x56cf('0x46')]);for(var _0x14bed9=0x0,_0x4cf7fd,_0x305385,_0x4c346d;_0x14bed90x0){_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 +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0xb3732d,_0x2d1e9c){var _0x9556d0=function(_0xbc8d16){while(--_0xbc8d16){_0xb3732d['push'](_0xb3732d['shift']());}};_0x9556d0(++_0x2d1e9c);}(_0x55ca,0x126));var _0xa55c=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x55ca[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 4a7894c..0477434 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 _0x5b44=['Bearer\x20','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','catch','outbound','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','customField','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','4.0','phonecall','callDirection','queue','phonecalls','assign','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','POST','remoteUri','password','clientSecret','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5b44,0x130));var _0x45b4=function(_0x43511b,_0x47ceed){_0x43511b=_0x43511b-0x0;var _0x1e3f3f=_0x5b44[_0x43511b];return _0x1e3f3f;};'use strict';var _=require(_0x45b4('0x0'));var rp=require('request-promise');var util=require(_0x45b4('0x1'));var intUtil=require(_0x45b4('0x2'));var md5=require(_0x45b4('0x3'));var Redis=require(_0x45b4('0x4'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x45b4('0x5'));config['redis']=_[_0x45b4('0x6')](config[_0x45b4('0x7')],{'host':_0x45b4('0x8'),'port':0x18eb});var io=require(_0x45b4('0x9'))(new Redis(config[_0x45b4('0x7')]));function getAuthToken(_0x23214e,_0x8305fd,_0x52503e){if(_0x23214e[_0x45b4('0xa')]){_0x23214e['remoteUri']=_0x23214e[_0x45b4('0xb')][_0x45b4('0xc')];_0x23214e[_0x45b4('0xd')]=_0x23214e[_0x45b4('0xb')]['data2'];return Promise['resolve'](_0x23214e[_0x45b4('0xb')]['data5']);}var _0x3456fb={'method':_0x45b4('0xe'),'uri':_0x8305fd,'form':{'client_id':_0x23214e['clientId'],'resource':_0x23214e[_0x45b4('0xf')],'username':_0x23214e['username'],'password':_0x23214e[_0x45b4('0x10')],'grant_type':_0x45b4('0x10'),'client_secret':_0x23214e[_0x45b4('0x11')]},'json':!![]};return rp(_0x3456fb)['then'](function(_0x4beefe){return _0x4beefe['access_token'];})['catch'](function(_0x2ffb5d){logger['error']('['+[_0x52503e[_0x45b4('0x12')]()]+_0x45b4('0x13'));return _0x2ffb5d[_0x45b4('0x14')];});}function getUser(_0x4ae612,_0x18b2ff,_0x4cac1e,_0x430cd6,_0x3471da,_0x396006){return new Promise(function(_0x2f628b,_0x3f61b6){return getAuthToken(_0x18b2ff,_0x430cd6,_0x396006)[_0x45b4('0x15')](function(_0x4a8b23){var _0x687e7f={'method':_0x45b4('0x16'),'uri':_0x3471da+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x45b4('0x17')+_0x4a8b23,'OData-Version':'4.0'},'json':!![]};return rp(_0x687e7f);})[_0x45b4('0x15')](function(_0x2e3954){var _0x527933=_0x2e3954['value'];var _0x3c1b68=![];var _0x5659c9=null;if(!_[_0x45b4('0x18')](_0x4cac1e)){if(intUtil[_0x45b4('0x19')](_0x4cac1e['email'])){_0x4ae612[_0x45b4('0x1a')]=_0x4cac1e[_0x45b4('0x1b')];for(_0x5659c9=0x0;_0x5659c9<_0x527933[_0x45b4('0x1c')];_0x5659c9++){if(_0x527933[_0x5659c9][_0x45b4('0x1d')]===_0x4cac1e[_0x45b4('0x1b')]&&!_0x527933[_0x5659c9][_0x45b4('0x1e')]){_0x3c1b68=!![];logger[_0x45b4('0x1f')]('['+[_0x396006[_0x45b4('0x12')]()]+_0x45b4('0x20')+_0x527933[_0x5659c9][_0x45b4('0x21')]+'!');_0x4ae612[_0x45b4('0x22')]=_0x527933[_0x5659c9][_0x45b4('0x21')];}}}}if(!_0x3c1b68){logger[_0x45b4('0x1f')]('['+[_0x396006[_0x45b4('0x12')]()]+_0x45b4('0x23'));_0x4ae612[_0x45b4('0x1a')]=_0x18b2ff[_0x45b4('0x24')];for(_0x5659c9=0x0;_0x5659c9<_0x527933[_0x45b4('0x1c')];_0x5659c9++){if(_0x527933[_0x5659c9][_0x45b4('0x1d')]===_0x18b2ff[_0x45b4('0x24')]){_0x4ae612[_0x45b4('0x22')]=_0x527933[_0x5659c9][_0x45b4('0x21')];}}}_0x2f628b(_0x4ae612);})[_0x45b4('0x25')](function(_0x58e771){_0x3f61b6(_0x58e771[_0x45b4('0x14')]);});});}function createEndUser(_0x287934,_0x229631,_0x407acd,_0x25a9e9,_0x4abd27,_0xa4d0ad,_0x470ffa){return new Promise(function(_0xce3ae3,_0x14c18e){return getAuthToken(_0x229631,_0x407acd,_0xa4d0ad)[_0x45b4('0x15')](function(_0x49432f){var _0x124108=_0xa4d0ad['toLowerCase']()===_0x45b4('0x26')?_0x4abd27['destcalleridnum']:_0x4abd27[_0x45b4('0x27')];var _0x1e14c5={'method':'POST','uri':_0x25a9e9+_0x45b4('0x28'),'body':{'fullname':_0x124108,'firstname':_0x124108,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x45b4('0x29')+_0x287934[_0x45b4('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x49432f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1e14c5[_0x45b4('0x2a')][_0x470ffa]=_0x124108;return rp(_0x1e14c5);})['then'](function(_0x477803){var _0x3bafdf=_0x477803[_0x45b4('0x2b')][_0x45b4('0x2c')];var _0x2bd24e=_0x3bafdf[_0x45b4('0x2d')](_0x3bafdf['lastIndexOf']('(')+0x1,_0x3bafdf[_0x45b4('0x2e')](')'));_0x287934[_0x45b4('0x2f')]=_0x2bd24e;_0xce3ae3(_0x287934);})[_0x45b4('0x25')](function(_0x3b9f28){_0x14c18e(_0x3b9f28[_0x45b4('0x14')]);});});}function getEndUser(_0x5e8a91,_0x53d429,_0x25a3de,_0x46b9ec,_0x3e0997,_0x26e7d5,_0x2ef4ae,_0x25beec){var _0x1add1b=_0x26e7d5['toLowerCase']()===_0x45b4('0x26')?_0x3e0997[_0x45b4('0x30')]:_0x3e0997[_0x45b4('0x27')];return getAuthToken(_0x53d429,_0x25a3de,_0x26e7d5)[_0x45b4('0x15')](function(_0x3fabb4){_0x25beec=_0x25beec?_0x25beec:_0x45b4('0x31');var _0x2f4655={'method':_0x45b4('0x16'),'uri':_0x46b9ec+'contacts?$select='+_0x25beec+_0x45b4('0x32')+_0x25beec+_0x45b4('0x33')+_0x1add1b[_0x45b4('0x34')]('+',_0x45b4('0x35'))+'\x27','headers':{'Authorization':_0x45b4('0x17')+_0x3fabb4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f4655);})[_0x45b4('0x15')](function(_0x360114){var _0x42f7bb=![];if(!_0x360114)return _0x42f7bb;var _0x57ed64=_0x360114[_0x45b4('0x36')];for(var _0x2e4824=0x0;_0x2e4824<_0x57ed64[_0x45b4('0x1c')];_0x2e4824++){if(_0x57ed64[_0x2e4824][_0x25beec]===_0x1add1b){_0x42f7bb=!![];_0x5e8a91['enduserId']=_0x57ed64[_0x2e4824][_0x45b4('0x37')];}}return _0x42f7bb;})['then'](function(_0x159c95){if(_0x159c95)return _0x5e8a91;if(_0x2ef4ae==='nothing'){logger['info']('['+[_0x26e7d5[_0x45b4('0x12')]()]+_0x45b4('0x38'));return _0x5e8a91;}return createEndUser(_0x5e8a91,_0x53d429,_0x25a3de,_0x46b9ec,_0x3e0997,_0x26e7d5,_0x25beec)[_0x45b4('0x15')](function(_0x1fe328){logger['info']('['+[_0x26e7d5[_0x45b4('0x12')]()]+']\x20Enduser\x20created!',_0x1fe328['enduserId']);return _0x1fe328;});});}function getCustomFields(_0x5727c0,_0x9dbd22,_0x46c031){var _0x279001={};if(_0x5727c0['length']>0x0){_[_0x45b4('0x39')](_0x5727c0,function(_0x883a94){if(_[_0x45b4('0x3a')]([_0x45b4('0x3b'),_0x45b4('0x3c')],_0x883a94[_0x45b4('0x3d')])&&_0x883a94['nameField']&&!_0x883a94[_0x45b4('0x3e')]){var _0x4273c3=_0x883a94['idField']['toLowerCase']();var _0x3de0af=_0x4273c3[_0x45b4('0x2d')](0x0,_0x4273c3['indexOf']('_'));var _0x4e3b06=_0x4273c3[_0x45b4('0x2d')](_0x4273c3['indexOf']('_')+0x1);if(_0x3de0af===_0x46c031){_0x279001[_0x4e3b06]=_0x883a94[_0x45b4('0x3f')];}}});}return _0x279001;}function getTicket(_0x49ad89,_0x333c20,_0x485ef3,_0x4a51e4,_0x588844,_0x3c4d7c,_0x554936){return new Promise(function(_0x24e2ba,_0x36df99){var _0x18b9e4;return getAuthToken(_0x333c20,_0x485ef3,_0x554936)['then'](function(_0x48df93){if(_0x3c4d7c[_0x45b4('0x40')]===_0x45b4('0x41')){_0x18b9e4={'method':_0x45b4('0xe'),'uri':_0x4a51e4+_0x45b4('0x42'),'body':Object['assign']({},{'title':intUtil[_0x45b4('0x43')](_0x3c4d7c[_0x45b4('0x44')],_0x588844,'\x20'),'description':intUtil[_0x45b4('0x43')](_0x3c4d7c[_0x45b4('0x45')],_0x588844,'\x0a'),'customerid_contact@odata.bind':_0x49ad89[_0x45b4('0x2f')]?_0x45b4('0x46')+_0x49ad89[_0x45b4('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x49ad89[_0x45b4('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x3c4d7c[_0x45b4('0x47')],_0x588844,_0x3c4d7c[_0x45b4('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x48df93,'OData-Version':_0x45b4('0x48')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3c4d7c[_0x45b4('0x40')]===_0x45b4('0x49')){var _0xdb14d2=_0x49ad89[_0x45b4('0x2f')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x49ad89['userId']+')','participationtypemask':_0x49ad89[_0x45b4('0x4a')]===_0x45b4('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x45b4('0x46')+_0x49ad89['enduserId']+')','participationtypemask':_0x49ad89['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x45b4('0x29')+_0x49ad89[_0x45b4('0x22')]+')','participationtypemask':_0x49ad89['callDirection']===_0x45b4('0x4b')?0x2:0x1}];_0x18b9e4={'method':_0x45b4('0xe'),'uri':_0x4a51e4+_0x45b4('0x4c'),'body':Object[_0x45b4('0x4d')]({},{'subject':intUtil[_0x45b4('0x43')](_0x3c4d7c[_0x45b4('0x44')],_0x588844,'\x20'),'phonenumber':String(_0x588844[_0x45b4('0x27')]),'description':intUtil[_0x45b4('0x43')](_0x3c4d7c[_0x45b4('0x45')],_0x588844,'\x0a'),'regardingobjectid_contact@odata.bind':_0x49ad89[_0x45b4('0x2f')]?'/contacts('+_0x49ad89[_0x45b4('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x49ad89[_0x45b4('0x22')]+')','directioncode':_0x49ad89[_0x45b4('0x4a')]===_0x45b4('0x4b')?![]:!![],'phonecall_activity_parties':_0xdb14d2},getCustomFields(_0x3c4d7c[_0x45b4('0x47')],_0x588844,_0x3c4d7c[_0x45b4('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x48df93,'OData-Version':_0x45b4('0x48')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x18b9e4);})[_0x45b4('0x15')](function(_0x385ee1){var _0x570642=_0x385ee1['headers'][_0x45b4('0x2c')];var _0x75e72=_0x570642[_0x45b4('0x2d')](_0x570642[_0x45b4('0x2e')]('(')+0x1,_0x570642[_0x45b4('0x2e')](')'));_0x49ad89[_0x45b4('0x4e')]=_0x75e72;_0x24e2ba(_0x49ad89);})['catch'](function(_0x426d8d){_0x36df99(_0x426d8d['message']);});});}function emit(_0x1e7d20,_0x5cc212,_0x563fd1,_0x2ce898){var _0x4301a2={'uri':util[_0x45b4('0x4f')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1e7d20,_0x563fd1,_0x2ce898)};io['to'](util['format'](_0x45b4('0x50'),_0x5cc212))[_0x45b4('0x51')](_0x45b4('0x52'),_0x4301a2);}exports['cs']=function(_0x1e685a,_0x1ce384,_0x436d93,_0x24121d,_0x2d6f36,_0x368a39,_0x45715d,_0x3725e8){var _0x5809c2={};_0x368a39[_0x45b4('0xf')]=_0x368a39[_0x45b4('0xa')]?intUtil['stripTrailingSlash'](_0x368a39[_0x45b4('0xb')][_0x45b4('0xc')]):intUtil[_0x45b4('0x53')](_0x368a39['remoteUri']);_0x368a39[_0x45b4('0x54')]=intUtil[_0x45b4('0x53')](_0x368a39[_0x45b4('0x54')]);_0x5809c2['callDirection']=_0x3725e8===_0x45b4('0x4b')||_0x3725e8===_0x45b4('0x55')?_0x45b4('0x4b'):_0x45b4('0x26');var _0x5b4507=_0x368a39['modernAuthentication']?util[_0x45b4('0x4f')](_0x45b4('0x56'),_0x368a39[_0x45b4('0xb')][_0x45b4('0xc')]):util[_0x45b4('0x4f')](_0x45b4('0x56'),_0x368a39['remoteUri']);var _0x32c29e=util['format'](_0x45b4('0x57'),_0x368a39[_0x45b4('0xd')]);var _0x5dc9a9=util[_0x45b4('0x4f')](_0x45b4('0x58'),_0x368a39[_0x45b4('0x54')],_0x1ce384['uniqueid'],md5(_0x1ce384[_0x45b4('0x59')]));if(_0x2d6f36&&_0x2d6f36['monitor_format']){logger[_0x45b4('0x1f')](_0x45b4('0x5a'),_0x45b4('0x5b'));_0x1ce384[_0x45b4('0x5c')]=_0x5dc9a9;}else if(_0x45715d&&_0x45715d[_0x45b4('0x5d')]&&_0x45715d['recordingFormat']!==_0x45b4('0x5e')){logger['info'](_0x45b4('0x5f'),_0x45b4('0x5b'));_0x1ce384[_0x45b4('0x5c')]=_0x5dc9a9;}else{_0x1ce384[_0x45b4('0x5c')]='';}return getUser(_0x5809c2,_0x368a39,_0x24121d,_0x32c29e,_0x5b4507,_0x3725e8)[_0x45b4('0x15')](function(_0x42c012){logger[_0x45b4('0x1f')]('['+_0x3725e8[_0x45b4('0x12')]()+_0x45b4('0x60'),_0x42c012[_0x45b4('0x22')]);logger['info']('['+_0x3725e8['toUpperCase']()+_0x45b4('0x61'),_0x42c012[_0x45b4('0x1a')]);return getEndUser(_0x42c012,_0x368a39,_0x32c29e,_0x5b4507,_0x1ce384,_0x3725e8,_0x436d93[_0x45b4('0x62')],_0x436d93[_0x45b4('0x63')]);})[_0x45b4('0x15')](function(_0x598ce6){logger[_0x45b4('0x1f')]('['+_0x3725e8['toUpperCase']()+_0x45b4('0x64'),_0x598ce6['enduserId']);logger['info']('['+_0x3725e8[_0x45b4('0x12')]()+_0x45b4('0x65'),_0x1ce384['calleridnum']);return getTicket(_0x598ce6,_0x368a39,_0x32c29e,_0x5b4507,_0x1ce384,_0x436d93,_0x3725e8);})[_0x45b4('0x15')](function(_0x31dc90){logger[_0x45b4('0x1f')](util['format']('['+_0x3725e8[_0x45b4('0x12')]()+_0x45b4('0x66'),_0x436d93[_0x45b4('0x40')],_0x31dc90[_0x45b4('0x4e')]));logger['info'](util[_0x45b4('0x4f')]('['+_0x3725e8['toUpperCase']()+_0x45b4('0x67'),_0x3725e8));if(_0x3725e8!=='unmanaged'&&_0x436d93[_0x45b4('0x68')]){logger['info']('['+_0x3725e8[_0x45b4('0x12')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x368a39[_0x45b4('0xf')],_0x24121d[_0x45b4('0x69')],_0x436d93[_0x45b4('0x40')],_0x31dc90[_0x45b4('0x4e')]);}})['catch'](function(_0x2a4559){logger['error']('['+_0x3725e8[_0x45b4('0x12')]()+_0x45b4('0x6a'),_0x2a4559['message']);console[_0x45b4('0x6b')](_0x45b4('0x6c'),_0x2a4559);});}; \ No newline at end of file +var _0xe991=['incidents','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','Descriptions','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','data7','tenantId','CloudProvider','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter=','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','ticketType','incident'];(function(_0x68b90b,_0xb8b06a){var _0x5220ec=function(_0x226484){while(--_0x226484){_0x68b90b['push'](_0x68b90b['shift']());}};_0x5220ec(++_0xb8b06a);}(_0xe991,0xfe));var _0x1e99=function(_0x3a2bd3,_0x3c1fa5){_0x3a2bd3=_0x3a2bd3-0x0;var _0x2a250b=_0xe991[_0x3a2bd3];return _0x2a250b;};'use strict';var _=require(_0x1e99('0x0'));var rp=require(_0x1e99('0x1'));var util=require(_0x1e99('0x2'));var intUtil=require('./util');var md5=require(_0x1e99('0x3'));var Redis=require(_0x1e99('0x4'));var logger=require(_0x1e99('0x5'))(_0x1e99('0x6'));var config=require('../../../../config/environment');config[_0x1e99('0x7')]=_['defaults'](config[_0x1e99('0x7')],{'host':_0x1e99('0x8'),'port':0x18eb});var io=require(_0x1e99('0x9'))(new Redis(config[_0x1e99('0x7')]));function getAuthToken(_0x2d1cad,_0x46fe8d,_0x4532a2){if(_0x2d1cad['modernAuthentication']){_0x2d1cad['remoteUri']=_0x2d1cad['CloudProvider'][_0x1e99('0xa')];_0x2d1cad[_0x1e99('0xb')]=_0x2d1cad[_0x1e99('0xc')]['data2'];return Promise[_0x1e99('0xd')](_0x2d1cad[_0x1e99('0xc')][_0x1e99('0xe')]);}var _0x101464={'method':_0x1e99('0xf'),'uri':_0x46fe8d,'form':{'client_id':_0x2d1cad[_0x1e99('0x10')],'resource':_0x2d1cad[_0x1e99('0x11')],'username':_0x2d1cad[_0x1e99('0x12')],'password':_0x2d1cad[_0x1e99('0x13')],'grant_type':_0x1e99('0x13'),'client_secret':_0x2d1cad[_0x1e99('0x14')]},'json':!![]};return rp(_0x101464)['then'](function(_0x3307e6){return _0x3307e6[_0x1e99('0x15')];})[_0x1e99('0x16')](function(_0x3c38c1){logger[_0x1e99('0x17')]('['+[_0x4532a2[_0x1e99('0x18')]()]+']\x20Wrong\x20credentials!');return _0x3c38c1[_0x1e99('0x19')];});}function getUser(_0x3edc0e,_0x341b23,_0x345e8c,_0x5aa1b4,_0x2f2d12,_0x58207d){return new Promise(function(_0x143143,_0x569b3b){return getAuthToken(_0x341b23,_0x5aa1b4,_0x58207d)[_0x1e99('0x1a')](function(_0x5ef2cb){var _0x1e4e3a={'method':'GET','uri':_0x2f2d12+_0x1e99('0x1b'),'headers':{'Authorization':_0x1e99('0x1c')+_0x5ef2cb,'OData-Version':_0x1e99('0x1d')},'json':!![]};return rp(_0x1e4e3a);})[_0x1e99('0x1a')](function(_0x2db687){var _0x1c3577=_0x2db687[_0x1e99('0x1e')];var _0x4d3324=![];var _0x2322bf=null;if(!_[_0x1e99('0x1f')](_0x345e8c)){if(intUtil[_0x1e99('0x20')](_0x345e8c[_0x1e99('0x21')])){_0x3edc0e['userEmail']=_0x345e8c['email'];for(_0x2322bf=0x0;_0x2322bf<_0x1c3577[_0x1e99('0x22')];_0x2322bf++){if(_0x1c3577[_0x2322bf][_0x1e99('0x23')]===_0x345e8c[_0x1e99('0x21')]&&!_0x1c3577[_0x2322bf]['isdisabled']){_0x4d3324=!![];logger[_0x1e99('0x24')]('['+[_0x58207d[_0x1e99('0x18')]()]+_0x1e99('0x25')+_0x1c3577[_0x2322bf]['systemuserid']+'!');_0x3edc0e[_0x1e99('0x26')]=_0x1c3577[_0x2322bf][_0x1e99('0x27')];}}}}if(!_0x4d3324){logger[_0x1e99('0x24')]('['+[_0x58207d['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3edc0e[_0x1e99('0x28')]=_0x341b23['username'];for(_0x2322bf=0x0;_0x2322bf<_0x1c3577['length'];_0x2322bf++){if(_0x1c3577[_0x2322bf][_0x1e99('0x23')]===_0x341b23[_0x1e99('0x12')]){_0x3edc0e[_0x1e99('0x26')]=_0x1c3577[_0x2322bf]['systemuserid'];}}}_0x143143(_0x3edc0e);})[_0x1e99('0x16')](function(_0x5d0f96){_0x569b3b(_0x5d0f96['message']);});});}function createEndUser(_0x4c9e71,_0x1c3eb1,_0x4168cb,_0x50b845,_0xfa3cb,_0x4fb8bf,_0x4a58b9){return new Promise(function(_0x25a364,_0x1a9d2d){return getAuthToken(_0x1c3eb1,_0x4168cb,_0x4fb8bf)[_0x1e99('0x1a')](function(_0x73f96f){var _0x31ff98=_0x4fb8bf[_0x1e99('0x29')]()===_0x1e99('0x2a')?_0xfa3cb[_0x1e99('0x2b')]:_0xfa3cb[_0x1e99('0x2c')];var _0x338fc2={'method':_0x1e99('0xf'),'uri':_0x50b845+_0x1e99('0x2d'),'body':{'fullname':_0x31ff98,'firstname':_0x31ff98,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1e99('0x2e')+_0x4c9e71[_0x1e99('0x26')]+')'},'headers':{'Authorization':_0x1e99('0x1c')+_0x73f96f,'OData-Version':_0x1e99('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x338fc2[_0x1e99('0x2f')][_0x4a58b9]=_0x31ff98;return rp(_0x338fc2);})[_0x1e99('0x1a')](function(_0x5dad99){var _0x33c4be=_0x5dad99[_0x1e99('0x30')][_0x1e99('0x31')];var _0x44df2c=_0x33c4be[_0x1e99('0x32')](_0x33c4be[_0x1e99('0x33')]('(')+0x1,_0x33c4be[_0x1e99('0x33')](')'));_0x4c9e71[_0x1e99('0x34')]=_0x44df2c;_0x25a364(_0x4c9e71);})[_0x1e99('0x16')](function(_0x23fb4e){_0x1a9d2d(_0x23fb4e['message']);});});}function getEndUser(_0x11709a,_0x535e1f,_0x22c929,_0x42a1a5,_0x2b6249,_0xbc15a3,_0xc7de66,_0x59f661){var _0x3fd6a2=_0xbc15a3[_0x1e99('0x29')]()===_0x1e99('0x2a')?_0x2b6249[_0x1e99('0x2b')]:_0x2b6249[_0x1e99('0x2c')];return getAuthToken(_0x535e1f,_0x22c929,_0xbc15a3)[_0x1e99('0x1a')](function(_0x152a69){_0x59f661=_0x59f661?_0x59f661:_0x1e99('0x35');var _0x3d0ea4={'method':_0x1e99('0x36'),'uri':_0x42a1a5+_0x1e99('0x37')+_0x59f661+_0x1e99('0x38')+_0x59f661+'\x20eq\x20\x27'+_0x3fd6a2['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x152a69,'If-None-Match':null,'OData-Version':_0x1e99('0x1d')},'json':!![]};return rp(_0x3d0ea4);})['then'](function(_0x139c99){var _0x22d792=![];if(!_0x139c99)return _0x22d792;var _0x60f708=_0x139c99[_0x1e99('0x1e')];for(var _0x1a5142=0x0;_0x1a5142<_0x60f708[_0x1e99('0x22')];_0x1a5142++){if(_0x60f708[_0x1a5142][_0x59f661]===_0x3fd6a2){_0x22d792=!![];_0x11709a[_0x1e99('0x34')]=_0x60f708[_0x1a5142][_0x1e99('0x39')];}}return _0x22d792;})[_0x1e99('0x1a')](function(_0x2d4e8f){if(_0x2d4e8f)return _0x11709a;if(_0xc7de66==='nothing'){logger['info']('['+[_0xbc15a3[_0x1e99('0x18')]()]+_0x1e99('0x3a'));return _0x11709a;}return createEndUser(_0x11709a,_0x535e1f,_0x22c929,_0x42a1a5,_0x2b6249,_0xbc15a3,_0x59f661)['then'](function(_0x497a2f){logger[_0x1e99('0x24')]('['+[_0xbc15a3[_0x1e99('0x18')]()]+_0x1e99('0x3b'),_0x497a2f[_0x1e99('0x34')]);return _0x497a2f;});});}function getCustomFields(_0x350403,_0x21b905,_0x1e3954){var _0x3a279d={};if(_0x350403[_0x1e99('0x22')]>0x0){_[_0x1e99('0x3c')](_0x350403,function(_0x15276b){if(_[_0x1e99('0x3d')](['string',_0x1e99('0x3e')],_0x15276b[_0x1e99('0x3f')])&&_0x15276b[_0x1e99('0x40')]&&!_0x15276b[_0x1e99('0x41')]){var _0x546d87=_0x15276b[_0x1e99('0x42')][_0x1e99('0x29')]();var _0x538c73=_0x546d87[_0x1e99('0x32')](0x0,_0x546d87['indexOf']('_'));var _0x1cbef3=_0x546d87['substring'](_0x546d87[_0x1e99('0x43')]('_')+0x1);if(_0x538c73===_0x1e3954){_0x3a279d[_0x1cbef3]=_0x15276b['content'];}}});}return _0x3a279d;}function getTicket(_0x1f6220,_0x13735b,_0x53213a,_0x1c356f,_0x311488,_0x452037,_0x261225){return new Promise(function(_0x33d980,_0x1e08c0){var _0xc26d5;return getAuthToken(_0x13735b,_0x53213a,_0x261225)['then'](function(_0x267815){if(_0x452037[_0x1e99('0x44')]===_0x1e99('0x45')){_0xc26d5={'method':'POST','uri':_0x1c356f+_0x1e99('0x46'),'body':Object['assign']({},{'title':intUtil['getString'](_0x452037[_0x1e99('0x47')],_0x311488,'\x20'),'description':intUtil[_0x1e99('0x48')](_0x452037['Descriptions'],_0x311488,'\x0a'),'customerid_contact@odata.bind':_0x1f6220[_0x1e99('0x34')]?_0x1e99('0x49')+_0x1f6220[_0x1e99('0x34')]+')':undefined,'ownerid@odata.bind':_0x1e99('0x2e')+_0x1f6220[_0x1e99('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x452037[_0x1e99('0x4a')],_0x311488,_0x452037['ticketType'])),'headers':{'Authorization':_0x1e99('0x1c')+_0x267815,'OData-Version':_0x1e99('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x452037[_0x1e99('0x44')]===_0x1e99('0x4b')){var _0x21be03=_0x1f6220[_0x1e99('0x34')]?[{'partyid_systemuser@odata.bind':_0x1e99('0x2e')+_0x1f6220[_0x1e99('0x26')]+')','participationtypemask':_0x1f6220[_0x1e99('0x4c')]===_0x1e99('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x1f6220[_0x1e99('0x34')]+')','participationtypemask':_0x1f6220['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1f6220[_0x1e99('0x26')]+')','participationtypemask':_0x1f6220['callDirection']==='queue'?0x2:0x1}];_0xc26d5={'method':'POST','uri':_0x1c356f+_0x1e99('0x4e'),'body':Object[_0x1e99('0x4f')]({},{'subject':intUtil['getString'](_0x452037[_0x1e99('0x47')],_0x311488,'\x20'),'phonenumber':String(_0x311488[_0x1e99('0x2c')]),'description':intUtil['getString'](_0x452037[_0x1e99('0x50')],_0x311488,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1f6220[_0x1e99('0x34')]?'/contacts('+_0x1f6220['enduserId']+')':undefined,'ownerid@odata.bind':_0x1e99('0x2e')+_0x1f6220[_0x1e99('0x26')]+')','directioncode':_0x1f6220['callDirection']===_0x1e99('0x4d')?![]:!![],'phonecall_activity_parties':_0x21be03},getCustomFields(_0x452037[_0x1e99('0x4a')],_0x311488,_0x452037[_0x1e99('0x44')])),'headers':{'Authorization':_0x1e99('0x1c')+_0x267815,'OData-Version':_0x1e99('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xc26d5);})[_0x1e99('0x1a')](function(_0x204b37){var _0x4a14a2=_0x204b37[_0x1e99('0x30')]['odata-entityid'];var _0x222f33=_0x4a14a2[_0x1e99('0x32')](_0x4a14a2['lastIndexOf']('(')+0x1,_0x4a14a2[_0x1e99('0x33')](')'));_0x1f6220['ticketId']=_0x222f33;_0x33d980(_0x1f6220);})[_0x1e99('0x16')](function(_0x2a6121){_0x1e08c0(_0x2a6121['message']);});});}function emit(_0x1c16ad,_0x119fe8,_0x498c93,_0x23add2){var _0x281f61={'uri':util[_0x1e99('0x51')](_0x1e99('0x52'),_0x1c16ad,_0x498c93,_0x23add2)};io['to'](util[_0x1e99('0x51')](_0x1e99('0x53'),_0x119fe8))[_0x1e99('0x54')](_0x1e99('0x55'),_0x281f61);}exports['cs']=function(_0xe39a49,_0x1af4c9,_0x590b15,_0x5a1407,_0x8b431a,_0x2cefa2,_0x3289cd,_0x4ea518){var _0xe32f67={};_0x2cefa2['remoteUri']=_0x2cefa2['modernAuthentication']?intUtil[_0x1e99('0x56')](_0x2cefa2['CloudProvider'][_0x1e99('0xa')]):intUtil[_0x1e99('0x56')](_0x2cefa2[_0x1e99('0x11')]);_0x2cefa2['serverUrl']=intUtil[_0x1e99('0x56')](_0x2cefa2[_0x1e99('0x57')]);_0xe32f67[_0x1e99('0x4c')]=_0x4ea518===_0x1e99('0x4d')||_0x4ea518==='unmanaged'?_0x1e99('0x4d'):_0x1e99('0x2a');var _0x315ad6=_0x2cefa2[_0x1e99('0x58')]?util[_0x1e99('0x51')](_0x1e99('0x59'),_0x2cefa2[_0x1e99('0xc')][_0x1e99('0xa')]):util[_0x1e99('0x51')](_0x1e99('0x59'),_0x2cefa2['remoteUri']);var _0x8d39c=util[_0x1e99('0x51')](_0x1e99('0x5a'),_0x2cefa2[_0x1e99('0xb')]);var _0x36a309=util[_0x1e99('0x51')](_0x1e99('0x5b'),_0x2cefa2[_0x1e99('0x57')],_0x1af4c9[_0x1e99('0x5c')],md5(_0x1af4c9[_0x1e99('0x5c')]));if(_0x8b431a&&_0x8b431a[_0x1e99('0x5d')]){logger[_0x1e99('0x24')]('[QUEUE]',_0x1e99('0x5e'));_0x1af4c9[_0x1e99('0x5f')]=_0x36a309;}else if(_0x3289cd&&_0x3289cd['recordingFormat']&&_0x3289cd[_0x1e99('0x60')]!==_0x1e99('0x61')){logger[_0x1e99('0x24')](_0x1e99('0x62'),_0x1e99('0x5e'));_0x1af4c9[_0x1e99('0x5f')]=_0x36a309;}else{_0x1af4c9[_0x1e99('0x5f')]='';}return getUser(_0xe32f67,_0x2cefa2,_0x5a1407,_0x8d39c,_0x315ad6,_0x4ea518)[_0x1e99('0x1a')](function(_0x322113){logger[_0x1e99('0x24')]('['+_0x4ea518['toUpperCase']()+_0x1e99('0x63'),_0x322113['userId']);logger[_0x1e99('0x24')]('['+_0x4ea518[_0x1e99('0x18')]()+_0x1e99('0x64'),_0x322113[_0x1e99('0x28')]);return getEndUser(_0x322113,_0x2cefa2,_0x8d39c,_0x315ad6,_0x1af4c9,_0x4ea518,_0x590b15['moduleCreate'],_0x590b15[_0x1e99('0x65')]);})[_0x1e99('0x1a')](function(_0x2c2e0b){logger[_0x1e99('0x24')]('['+_0x4ea518[_0x1e99('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2c2e0b[_0x1e99('0x34')]);logger[_0x1e99('0x24')]('['+_0x4ea518[_0x1e99('0x18')]()+_0x1e99('0x66'),_0x1af4c9[_0x1e99('0x2c')]);return getTicket(_0x2c2e0b,_0x2cefa2,_0x8d39c,_0x315ad6,_0x1af4c9,_0x590b15,_0x4ea518);})['then'](function(_0x2da8d3){logger[_0x1e99('0x24')](util[_0x1e99('0x51')]('['+_0x4ea518[_0x1e99('0x18')]()+_0x1e99('0x67'),_0x590b15[_0x1e99('0x44')],_0x2da8d3['ticketId']));logger[_0x1e99('0x24')](util[_0x1e99('0x51')]('['+_0x4ea518[_0x1e99('0x18')]()+']\x20Call\x20direction:\x20%s',_0x4ea518));if(_0x4ea518!==_0x1e99('0x68')&&_0x590b15['openNewTab']){logger[_0x1e99('0x24')]('['+_0x4ea518[_0x1e99('0x18')]()+']',_0x1e99('0x69'));emit(_0x2cefa2[_0x1e99('0x11')],_0x5a1407[_0x1e99('0x6a')],_0x590b15[_0x1e99('0x44')],_0x2da8d3['ticketId']);}})[_0x1e99('0x16')](function(_0x3246be){logger[_0x1e99('0x17')]('['+_0x4ea518[_0x1e99('0x18')]()+_0x1e99('0x6b'),_0x3246be[_0x1e99('0x19')]);console[_0x1e99('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x3246be);});}; \ 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 da32ec3..6f4c5c1 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 _0x666b=['length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','push','idField','content','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','catch','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents'];(function(_0x2a53ad,_0x234135){var _0x31b3b6=function(_0x141ec6){while(--_0x141ec6){_0x2a53ad['push'](_0x2a53ad['shift']());}};_0x31b3b6(++_0x234135);}(_0x666b,0x1ba));var _0xb666=function(_0x4c4284,_0x581403){_0x4c4284=_0x4c4284-0x0;var _0x18e0fb=_0x666b[_0x4c4284];return _0x18e0fb;};'use strict';var _=require(_0xb666('0x0'));var rp=require(_0xb666('0x1'));var md5=require('md5');var util=require(_0xb666('0x2'));var Redis=require(_0xb666('0x3'));var intUtil=require(_0xb666('0x4'));var config=require(_0xb666('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0xb666('0x6')]=_[_0xb666('0x7')](config['redis'],{'host':_0xb666('0x8'),'port':0x18eb});var io=require(_0xb666('0x9'))(new Redis(config[_0xb666('0x6')]));var headers={'Content-Type':_0xb666('0xa'),'Accept':_0xb666('0xa')};function emit(_0x1396f0,_0x5a0c62,_0x3485da){io['to'](_0x1396f0)[_0xb666('0xb')](_0x5a0c62,_0x3485da);}function getTicket(_0x36849c,_0xddbfcf,_0x46b425,_0x4726d6,_0x18e3a8){logger[_0xb666('0xc')](_0xb666('0xd'));var _0x501792=_[_0xb666('0xe')]({'responder_id':_0xddbfcf['id'],'requester_id':_0x46b425['id'],'name':util[_0xb666('0xf')]('Caller\x20-\x20%s',_0x18e3a8[_0xb666('0x10')]),'phone':_0x18e3a8[_0xb666('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb666('0x12')](_0x4726d6[_0xb666('0x13')],_0x18e3a8,'\x20'),'description':intUtil['getString'](_0x4726d6[_0xb666('0x14')],_0x18e3a8,_0xb666('0x15')),'tags':getTags(_0x4726d6['Tags'],_0xb666('0x16'))},getCustomFields(_0x4726d6[_0xb666('0x17')],_0x18e3a8));_0x501792[_0xb666('0x18')]=_[_0xb666('0x19')](_['keyBy'](_0x501792[_0xb666('0x18')],'id'),_0xb666('0x1a'));return request({'uri':util[_0xb666('0xf')](_0xb666('0x1b'),_0x36849c[_0xb666('0x1c')]),'method':_0xb666('0x1d'),'body':_0x501792})[_0xb666('0x1e')](function(_0x4339df){logger[_0xb666('0xc')](_0xb666('0x1f'));return _0x4339df;});}function getUser(_0x46f931,_0x499315){if(intUtil['validateEmail'](_0x499315)){return request({'uri':util[_0xb666('0xf')](_0xb666('0x20'),_0x46f931[_0xb666('0x1c')]),'qs':{'email':_0x499315}})[_0xb666('0x1e')](function(_0x346715){if(_0x346715[_0xb666('0x21')]){logger['info']('Agent\x20found!');return _['find'](_0x346715,function(_0x4058ba){return _0x4058ba[_0xb666('0x22')][_0xb666('0x23')]===_0x499315;});}else{logger[_0xb666('0xc')](_0xb666('0x24'));return request({'uri':util[_0xb666('0xf')](_0xb666('0x25'),_0x46f931[_0xb666('0x1c')])})['then'](function(_0x217d59){logger[_0xb666('0xc')](_0xb666('0x26'));return _0x217d59;});}});}else{logger[_0xb666('0xc')](_0xb666('0x27'));return request({'uri':util[_0xb666('0xf')](_0xb666('0x25'),_0x46f931[_0xb666('0x1c')])})['then'](function(_0x372cec){logger[_0xb666('0xc')]('Admin\x20account\x20selected.');return _0x372cec;});}}function getEndUser(_0x5b6142,_0x358f3b,_0x4714d6){logger[_0xb666('0xc')](_0xb666('0x28'),_0x4714d6);return request({'uri':util[_0xb666('0xf')](_0xb666('0x29'),_0x5b6142[_0xb666('0x1c')]),'qs':{'phone':_0x4714d6}})[_0xb666('0x1e')](function(_0x3a63be){if(_0x3a63be[_0xb666('0x21')]){logger[_0xb666('0xc')](_0xb666('0x2a'));return _[_0xb666('0x2b')](_0x3a63be,{'phone':_0x4714d6});}else{logger[_0xb666('0xc')](_0xb666('0x2c'));return request({'uri':util['format'](_0xb666('0x29'),_0x5b6142[_0xb666('0x1c')]),'method':_0xb666('0x1d'),'body':{'name':_0x358f3b,'phone':_0x4714d6}})['then'](function(_0x3a8281){logger[_0xb666('0xc')](_0xb666('0x2d'));return _0x3a8281;});}});}function getAuth(_0x11c3d3){return util[_0xb666('0xf')](_0xb666('0x2e'),new Buffer(_0x11c3d3[_0xb666('0x2f')]+':X')[_0xb666('0x30')](_0xb666('0x31')));}function request(_0x4e4251){logger[_0xb666('0x32')](_0xb666('0x33'),JSON[_0xb666('0x34')](_0x4e4251));return rp(_[_0xb666('0x7')](_0x4e4251,{'method':_0xb666('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x155daa,_0x1fd465){var _0x40d9d7=[];if(_0x155daa&&_0x155daa['length']>0x0){_0x40d9d7=_[_0xb666('0x36')](_0x155daa,_0x1fd465);}return _0x40d9d7;}function getCustomFields(_0x400c28,_0x27dece){var _0x160c4c=[];var _0x2951b7={'custom_fields':[]};if(_0x400c28[_0xb666('0x21')]>0x0){_[_0xb666('0x37')](_0x400c28,function(_0x4147b7){if(_[_0xb666('0x38')]([_0xb666('0x39'),_0xb666('0x3a')],_0x4147b7[_0xb666('0x3b')])&&_0x4147b7[_0xb666('0x3c')]&&!_0x4147b7[_0xb666('0x3d')]){_0x2951b7[_0x4147b7['nameField'][_0xb666('0x3e')]()]=_0x4147b7['content'][_0xb666('0x30')]();}else if(_[_0xb666('0x38')]([_0xb666('0x39'),_0xb666('0x3a')],_0x4147b7['type'])&&_0x4147b7['idField']&&_0x4147b7['customField']){_0x2951b7[_0xb666('0x18')][_0xb666('0x3f')]({'id':_0x4147b7[_0xb666('0x40')],'value':_0x4147b7[_0xb666('0x41')]['toString']()});}else if(_0x4147b7[_0xb666('0x3b')]==='variable'&&_0x4147b7[_0xb666('0x42')]&&_0x4147b7[_0xb666('0x40')]&&_0x4147b7[_0xb666('0x3d')]){_0x27dece[_0x4147b7['variableName']]&&_0x2951b7[_0xb666('0x18')][_0xb666('0x3f')]({'id':_0x4147b7[_0xb666('0x40')],'value':_0x27dece[_0x4147b7['variableName']][_0xb666('0x30')]()});}else if(_0x4147b7['type']===_0xb666('0x43')&&_0x4147b7[_0xb666('0x44')]&&_0x4147b7['Variable']['name']&&_0x4147b7[_0xb666('0x40')]&&_0x4147b7[_0xb666('0x3d')]){_0x27dece[_0x4147b7[_0xb666('0x44')][_0xb666('0x16')][_0xb666('0x3e')]()]&&_0x2951b7[_0xb666('0x18')][_0xb666('0x3f')]({'id':_0x4147b7['idField'],'value':_0x27dece[_0x4147b7['Variable']['name'][_0xb666('0x3e')]()][_0xb666('0x30')]()});}});}return _0x2951b7;}exports['queue']=function(_0x12ae66,_0x1b00ce,_0x5570d2,_0x1d6745,_0x12f2cf,_0x303552){var _0x5c1240,_0x1263a8;_0x303552[_0xb666('0x1c')]=intUtil[_0xb666('0x45')](_0x303552[_0xb666('0x1c')]);_0x303552[_0xb666('0x46')]=intUtil[_0xb666('0x45')](_0x303552[_0xb666('0x46')]);if(_0x12f2cf&&_0x12f2cf[_0xb666('0x47')]){logger['info'](_0xb666('0x48'),'Recording\x20is\x20enabled!');_0x1b00ce[_0xb666('0x49')]=util[_0xb666('0xf')](_0xb666('0x4a'),_0x303552[_0xb666('0x46')],_0x1b00ce[_0xb666('0x4b')],md5(_0x1b00ce[_0xb666('0x4b')]));}else{_0x1b00ce[_0xb666('0x49')]='';}headers['Authorization']=getAuth(_0x303552);return getUser(_0x303552,_0x1d6745['email'])[_0xb666('0x1e')](function(_0x25e0b3){_0x5c1240=_0x25e0b3;logger['info'](_0xb666('0x4c'),_0x5c1240['id']);return getEndUser(_0x303552,_0x1b00ce[_0xb666('0x10')],_0x1b00ce[_0xb666('0x11')]);})[_0xb666('0x1e')](function(_0x5dc21f){_0x1263a8=_0x5dc21f;logger[_0xb666('0xc')](_0xb666('0x4d'),_0x1263a8['id']);return getTicket(_0x303552,_0x5c1240,_0x1263a8,_0x5570d2,_0x1b00ce);})['then'](function(_0x82ca71){if(_0x82ca71&&_0x82ca71['id']){logger[_0xb666('0xc')](_0xb666('0x1f'));logger[_0xb666('0xc')]('The\x20Ticket\x20ID\x20is:',_0x82ca71['id']);logger[_0xb666('0xc')](_0xb666('0x48'),_0xb666('0x4e'));emit(util[_0xb666('0xf')](_0xb666('0x4f'),_0x1d6745[_0xb666('0x16')]),_0xb666('0x50'),{'uri':util[_0xb666('0xf')](_0xb666('0x51'),_0x303552[_0xb666('0x1c')],_0x82ca71['id'])});}})['catch'](function(_0x3749ae){logger[_0xb666('0x52')](_0xb666('0x48'),JSON[_0xb666('0x34')](_0x3749ae));});};exports[_0xb666('0x53')]=function(_0xeac364,_0x317865,_0x3276cb,_0x78f5a3,_0x5ce7f9,_0x25839d,_0x3c1e73){var _0x2983dd,_0x2ea5f4;_0x25839d[_0xb666('0x1c')]=intUtil[_0xb666('0x45')](_0x25839d['remoteUri']);_0x25839d['serverUrl']=intUtil['stripTrailingSlash'](_0x25839d[_0xb666('0x46')]);if(_0x3c1e73&&_0x3c1e73[_0xb666('0x54')]&&_0x3c1e73[_0xb666('0x54')]!==_0xb666('0x55')){logger[_0xb666('0xc')]('[OUTBOUND]',_0xb666('0x56'));_0x317865[_0xb666('0x49')]=util[_0xb666('0xf')](_0xb666('0x4a'),_0x25839d[_0xb666('0x46')],_0x317865[_0xb666('0x4b')],md5(_0x317865[_0xb666('0x4b')]));}headers[_0xb666('0x57')]=getAuth(_0x25839d);return getUser(_0x25839d,_0x78f5a3['email'])[_0xb666('0x1e')](function(_0x207173){_0x2983dd=_0x207173;logger[_0xb666('0xc')]('The\x20User\x20ID\x20is:',_0x2983dd['id']);return getEndUser(_0x25839d,_0x317865[_0xb666('0x58')],_0x317865[_0xb666('0x59')]);})['then'](function(_0x33d54a){_0x2ea5f4=_0x33d54a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2ea5f4['id']);return getTicket(_0x25839d,_0x2983dd,_0x2ea5f4,_0x3276cb,_0x317865);})[_0xb666('0x1e')](function(_0x50493f){if(_0x50493f&&_0x50493f['id']){logger[_0xb666('0xc')]('Ticket\x20created!');logger[_0xb666('0xc')]('The\x20Ticket\x20ID\x20is:',_0x50493f['id']);logger[_0xb666('0xc')](_0xb666('0x5a'),_0xb666('0x4e'));emit(util[_0xb666('0xf')]('user:%s',_0x78f5a3[_0xb666('0x16')]),'trigger:browser:url',{'uri':util[_0xb666('0xf')](_0xb666('0x51'),_0x25839d['remoteUri'],_0x50493f['id'])});}})[_0xb666('0x5b')](function(_0x4f5f38){logger[_0xb666('0x52')](_0xb666('0x5a'),JSON[_0xb666('0x34')](_0x4f5f38));});};exports['unmanaged']=function(_0x716d45,_0x3af78f,_0x37cc8b,_0x2c7dde,_0x130724,_0x13b4da){var _0x35df78,_0x19eeab;_0x13b4da['remoteUri']=intUtil[_0xb666('0x45')](_0x13b4da[_0xb666('0x1c')]);_0x13b4da[_0xb666('0x46')]=intUtil[_0xb666('0x45')](_0x13b4da[_0xb666('0x46')]);if(_0x130724&&_0x130724[_0xb666('0x47')]){logger[_0xb666('0xc')]('['+_0x3af78f[_0xb666('0x5c')][_0xb666('0x5d')]()+']',_0xb666('0x56'));_0x3af78f[_0xb666('0x49')]=util[_0xb666('0xf')](_0xb666('0x4a'),_0x13b4da['serverUrl'],_0x3af78f['uniqueid'],md5(_0x3af78f[_0xb666('0x4b')]));}else{_0x3af78f[_0xb666('0x49')]='';}headers[_0xb666('0x57')]=getAuth(_0x13b4da);return getUser(_0x13b4da,'')[_0xb666('0x1e')](function(_0x710543){_0x35df78=_0x710543;logger[_0xb666('0xc')]('The\x20User\x20ID\x20is:',_0x35df78['id']);return getEndUser(_0x13b4da,_0x3af78f[_0xb666('0x10')],_0x3af78f[_0xb666('0x11')]);})['then'](function(_0x3d5af7){_0x19eeab=_0x3d5af7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x19eeab['id']);return getTicket(_0x13b4da,_0x35df78,_0x19eeab,_0x37cc8b,_0x3af78f);})['then'](function(_0x372e16){if(_0x372e16){logger[_0xb666('0xc')](_0xb666('0x1f'));logger[_0xb666('0xc')](_0xb666('0x5e'),_0x372e16['id']);}})[_0xb666('0x5b')](function(_0x3b1671){logger[_0xb666('0x52')]('['+_0x3af78f[_0xb666('0x5c')][_0xb666('0x5d')]()+']',JSON[_0xb666('0x34')](_0x3b1671));});}; \ No newline at end of file +var _0xc0c6=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','Ticket\x20created!','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:'];(function(_0x186d89,_0x47703d){var _0x39fea3=function(_0x3eddf0){while(--_0x3eddf0){_0x186d89['push'](_0x186d89['shift']());}};_0x39fea3(++_0x47703d);}(_0xc0c6,0xd1));var _0x6c0c=function(_0xd5d8da,_0xf598a0){_0xd5d8da=_0xd5d8da-0x0;var _0x3d1707=_0xc0c6[_0xd5d8da];return _0x3d1707;};'use strict';var _=require('lodash');var rp=require(_0x6c0c('0x0'));var md5=require(_0x6c0c('0x1'));var util=require(_0x6c0c('0x2'));var Redis=require(_0x6c0c('0x3'));var intUtil=require('./util');var config=require(_0x6c0c('0x4'));var logger=require(_0x6c0c('0x5'))(_0x6c0c('0x6'));config[_0x6c0c('0x7')]=_[_0x6c0c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6c0c('0x9'))(new Redis(config[_0x6c0c('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x6c0c('0xa')};function emit(_0x3ab8c5,_0x55c3e2,_0x158592){io['to'](_0x3ab8c5)[_0x6c0c('0xb')](_0x55c3e2,_0x158592);}function getTicket(_0x35d52b,_0x51798b,_0x3f7187,_0x42b87f,_0x1dfb84){logger[_0x6c0c('0xc')](_0x6c0c('0xd'));var _0x1444b2=_[_0x6c0c('0xe')]({'responder_id':_0x51798b['id'],'requester_id':_0x3f7187['id'],'name':util['format']('Caller\x20-\x20%s',_0x1dfb84[_0x6c0c('0xf')]),'phone':_0x1dfb84[_0x6c0c('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6c0c('0x11')](_0x42b87f[_0x6c0c('0x12')],_0x1dfb84,'\x20'),'description':intUtil['getString'](_0x42b87f[_0x6c0c('0x13')],_0x1dfb84,_0x6c0c('0x14')),'tags':getTags(_0x42b87f['Tags'],_0x6c0c('0x15'))},getCustomFields(_0x42b87f[_0x6c0c('0x16')],_0x1dfb84));_0x1444b2[_0x6c0c('0x17')]=_[_0x6c0c('0x18')](_[_0x6c0c('0x19')](_0x1444b2[_0x6c0c('0x17')],'id'),_0x6c0c('0x1a'));return request({'uri':util[_0x6c0c('0x1b')](_0x6c0c('0x1c'),_0x35d52b[_0x6c0c('0x1d')]),'method':'POST','body':_0x1444b2})[_0x6c0c('0x1e')](function(_0xbed185){logger[_0x6c0c('0xc')]('Ticket\x20created!');return _0xbed185;});}function getUser(_0x5c1f0f,_0x8437b1){if(intUtil[_0x6c0c('0x1f')](_0x8437b1)){return request({'uri':util[_0x6c0c('0x1b')](_0x6c0c('0x20'),_0x5c1f0f[_0x6c0c('0x1d')]),'qs':{'email':_0x8437b1}})[_0x6c0c('0x1e')](function(_0x3a2516){if(_0x3a2516[_0x6c0c('0x21')]){logger[_0x6c0c('0xc')]('Agent\x20found!');return _[_0x6c0c('0x22')](_0x3a2516,function(_0x5a9da1){return _0x5a9da1[_0x6c0c('0x23')]['email']===_0x8437b1;});}else{logger[_0x6c0c('0xc')](_0x6c0c('0x24'));return request({'uri':util[_0x6c0c('0x1b')](_0x6c0c('0x25'),_0x5c1f0f['remoteUri'])})[_0x6c0c('0x1e')](function(_0x40ab1e){logger['info']('Admin\x20account\x20selected.');return _0x40ab1e;});}});}else{logger[_0x6c0c('0xc')](_0x6c0c('0x26'));return request({'uri':util['format'](_0x6c0c('0x25'),_0x5c1f0f[_0x6c0c('0x1d')])})[_0x6c0c('0x1e')](function(_0xb49424){logger[_0x6c0c('0xc')](_0x6c0c('0x27'));return _0xb49424;});}}function getEndUser(_0x1af812,_0x32181e,_0x58abcf){logger[_0x6c0c('0xc')](_0x6c0c('0x28'),_0x58abcf);return request({'uri':util[_0x6c0c('0x1b')](_0x6c0c('0x29'),_0x1af812[_0x6c0c('0x1d')]),'qs':{'phone':_0x58abcf}})[_0x6c0c('0x1e')](function(_0xdc3389){if(_0xdc3389[_0x6c0c('0x21')]){logger[_0x6c0c('0xc')](_0x6c0c('0x2a'));return _[_0x6c0c('0x22')](_0xdc3389,{'phone':_0x58abcf});}else{logger[_0x6c0c('0xc')](_0x6c0c('0x2b'));return request({'uri':util['format'](_0x6c0c('0x29'),_0x1af812[_0x6c0c('0x1d')]),'method':'POST','body':{'name':_0x32181e,'phone':_0x58abcf}})[_0x6c0c('0x1e')](function(_0x4009d4){logger[_0x6c0c('0xc')](_0x6c0c('0x2c'));return _0x4009d4;});}});}function getAuth(_0x217249){return util['format']('Basic\x20%s',new Buffer(_0x217249[_0x6c0c('0x2d')]+':X')['toString'](_0x6c0c('0x2e')));}function request(_0xf1861e){logger['debug'](_0x6c0c('0x2f'),JSON[_0x6c0c('0x30')](_0xf1861e));return rp(_['defaults'](_0xf1861e,{'method':_0x6c0c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5459c6,_0x27f968){var _0x2aa9cb=[];if(_0x5459c6&&_0x5459c6[_0x6c0c('0x21')]>0x0){_0x2aa9cb=_['map'](_0x5459c6,_0x27f968);}return _0x2aa9cb;}function getCustomFields(_0x582ff6,_0x26a80a){var _0x2c68c5=[];var _0x4bc903={'custom_fields':[]};if(_0x582ff6[_0x6c0c('0x21')]>0x0){_[_0x6c0c('0x32')](_0x582ff6,function(_0x56d652){if(_[_0x6c0c('0x33')]([_0x6c0c('0x34'),_0x6c0c('0x35')],_0x56d652[_0x6c0c('0x36')])&&_0x56d652[_0x6c0c('0x37')]&&!_0x56d652['customField']){_0x4bc903[_0x56d652[_0x6c0c('0x37')][_0x6c0c('0x38')]()]=_0x56d652[_0x6c0c('0x39')][_0x6c0c('0x3a')]();}else if(_['includes'](['string','picklist'],_0x56d652[_0x6c0c('0x36')])&&_0x56d652[_0x6c0c('0x3b')]&&_0x56d652[_0x6c0c('0x3c')]){_0x4bc903[_0x6c0c('0x17')][_0x6c0c('0x3d')]({'id':_0x56d652['idField'],'value':_0x56d652[_0x6c0c('0x39')]['toString']()});}else if(_0x56d652[_0x6c0c('0x36')]===_0x6c0c('0x3e')&&_0x56d652[_0x6c0c('0x3f')]&&_0x56d652['idField']&&_0x56d652['customField']){_0x26a80a[_0x56d652[_0x6c0c('0x3f')]]&&_0x4bc903[_0x6c0c('0x17')]['push']({'id':_0x56d652[_0x6c0c('0x3b')],'value':_0x26a80a[_0x56d652['variableName']][_0x6c0c('0x3a')]()});}else if(_0x56d652['type']===_0x6c0c('0x40')&&_0x56d652[_0x6c0c('0x41')]&&_0x56d652[_0x6c0c('0x41')][_0x6c0c('0x15')]&&_0x56d652['idField']&&_0x56d652[_0x6c0c('0x3c')]){_0x26a80a[_0x56d652[_0x6c0c('0x41')]['name'][_0x6c0c('0x38')]()]&&_0x4bc903[_0x6c0c('0x17')][_0x6c0c('0x3d')]({'id':_0x56d652[_0x6c0c('0x3b')],'value':_0x26a80a[_0x56d652[_0x6c0c('0x41')][_0x6c0c('0x15')][_0x6c0c('0x38')]()][_0x6c0c('0x3a')]()});}});}return _0x4bc903;}exports['queue']=function(_0xd5bc1d,_0x59b6db,_0x2a6089,_0x106de4,_0x3db97c,_0x110e4d){var _0x621bb9,_0x25092c;_0x110e4d['remoteUri']=intUtil[_0x6c0c('0x42')](_0x110e4d[_0x6c0c('0x1d')]);_0x110e4d[_0x6c0c('0x43')]=intUtil[_0x6c0c('0x42')](_0x110e4d[_0x6c0c('0x43')]);if(_0x3db97c&&_0x3db97c[_0x6c0c('0x44')]){logger[_0x6c0c('0xc')](_0x6c0c('0x45'),_0x6c0c('0x46'));_0x59b6db[_0x6c0c('0x47')]=util[_0x6c0c('0x1b')](_0x6c0c('0x48'),_0x110e4d['serverUrl'],_0x59b6db['uniqueid'],md5(_0x59b6db[_0x6c0c('0x49')]));}else{_0x59b6db['recordingURL']='';}headers['Authorization']=getAuth(_0x110e4d);return getUser(_0x110e4d,_0x106de4[_0x6c0c('0x4a')])[_0x6c0c('0x1e')](function(_0x1c3023){_0x621bb9=_0x1c3023;logger[_0x6c0c('0xc')](_0x6c0c('0x4b'),_0x621bb9['id']);return getEndUser(_0x110e4d,_0x59b6db['calleridname'],_0x59b6db[_0x6c0c('0x10')]);})[_0x6c0c('0x1e')](function(_0x18f263){_0x25092c=_0x18f263;logger[_0x6c0c('0xc')](_0x6c0c('0x4c'),_0x25092c['id']);return getTicket(_0x110e4d,_0x621bb9,_0x25092c,_0x2a6089,_0x59b6db);})[_0x6c0c('0x1e')](function(_0x23f985){if(_0x23f985&&_0x23f985['id']){logger['info']('Ticket\x20created!');logger['info'](_0x6c0c('0x4d'),_0x23f985['id']);logger[_0x6c0c('0xc')](_0x6c0c('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c0c('0x1b')](_0x6c0c('0x4e'),_0x106de4[_0x6c0c('0x15')]),_0x6c0c('0x4f'),{'uri':util[_0x6c0c('0x1b')](_0x6c0c('0x50'),_0x110e4d['remoteUri'],_0x23f985['id'])});}})[_0x6c0c('0x51')](function(_0x24dace){logger[_0x6c0c('0x52')](_0x6c0c('0x45'),JSON['stringify'](_0x24dace));});};exports[_0x6c0c('0x53')]=function(_0x4ffb34,_0x4777a1,_0x4ade35,_0x3cec7c,_0x24e5df,_0x11076c,_0x141e11){var _0x3cf01a,_0x3aa648;_0x11076c['remoteUri']=intUtil['stripTrailingSlash'](_0x11076c[_0x6c0c('0x1d')]);_0x11076c[_0x6c0c('0x43')]=intUtil['stripTrailingSlash'](_0x11076c['serverUrl']);if(_0x141e11&&_0x141e11['recordingFormat']&&_0x141e11[_0x6c0c('0x54')]!==_0x6c0c('0x55')){logger[_0x6c0c('0xc')]('[OUTBOUND]',_0x6c0c('0x46'));_0x4777a1[_0x6c0c('0x47')]=util[_0x6c0c('0x1b')](_0x6c0c('0x48'),_0x11076c['serverUrl'],_0x4777a1[_0x6c0c('0x49')],md5(_0x4777a1[_0x6c0c('0x49')]));}headers[_0x6c0c('0x56')]=getAuth(_0x11076c);return getUser(_0x11076c,_0x3cec7c['email'])[_0x6c0c('0x1e')](function(_0x180b6a){_0x3cf01a=_0x180b6a;logger[_0x6c0c('0xc')](_0x6c0c('0x4b'),_0x3cf01a['id']);return getEndUser(_0x11076c,_0x4777a1[_0x6c0c('0x57')],_0x4777a1[_0x6c0c('0x58')]);})['then'](function(_0x48dc28){_0x3aa648=_0x48dc28;logger[_0x6c0c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3aa648['id']);return getTicket(_0x11076c,_0x3cf01a,_0x3aa648,_0x4ade35,_0x4777a1);})[_0x6c0c('0x1e')](function(_0xe79d1f){if(_0xe79d1f&&_0xe79d1f['id']){logger[_0x6c0c('0xc')](_0x6c0c('0x59'));logger[_0x6c0c('0xc')]('The\x20Ticket\x20ID\x20is:',_0xe79d1f['id']);logger['info'](_0x6c0c('0x5a'),_0x6c0c('0x5b'));emit(util[_0x6c0c('0x1b')](_0x6c0c('0x4e'),_0x3cec7c[_0x6c0c('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x6c0c('0x50'),_0x11076c[_0x6c0c('0x1d')],_0xe79d1f['id'])});}})['catch'](function(_0x520838){logger[_0x6c0c('0x52')](_0x6c0c('0x5a'),JSON[_0x6c0c('0x30')](_0x520838));});};exports[_0x6c0c('0x5c')]=function(_0x40cfdb,_0x3336fc,_0x2b8e0b,_0x34429a,_0xb28879,_0x34882a){var _0x2ee1e6,_0x475c2c;_0x34882a[_0x6c0c('0x1d')]=intUtil['stripTrailingSlash'](_0x34882a[_0x6c0c('0x1d')]);_0x34882a[_0x6c0c('0x43')]=intUtil['stripTrailingSlash'](_0x34882a['serverUrl']);if(_0xb28879&&_0xb28879[_0x6c0c('0x44')]){logger[_0x6c0c('0xc')]('['+_0x3336fc[_0x6c0c('0x5d')][_0x6c0c('0x5e')]()+']',_0x6c0c('0x46'));_0x3336fc['recordingURL']=util[_0x6c0c('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34882a[_0x6c0c('0x43')],_0x3336fc['uniqueid'],md5(_0x3336fc[_0x6c0c('0x49')]));}else{_0x3336fc[_0x6c0c('0x47')]='';}headers[_0x6c0c('0x56')]=getAuth(_0x34882a);return getUser(_0x34882a,'')[_0x6c0c('0x1e')](function(_0x53c6ff){_0x2ee1e6=_0x53c6ff;logger['info'](_0x6c0c('0x4b'),_0x2ee1e6['id']);return getEndUser(_0x34882a,_0x3336fc['calleridname'],_0x3336fc[_0x6c0c('0x10')]);})[_0x6c0c('0x1e')](function(_0x355fdf){_0x475c2c=_0x355fdf;logger[_0x6c0c('0xc')](_0x6c0c('0x4c'),_0x475c2c['id']);return getTicket(_0x34882a,_0x2ee1e6,_0x475c2c,_0x2b8e0b,_0x3336fc);})[_0x6c0c('0x1e')](function(_0x12c254){if(_0x12c254){logger['info']('Ticket\x20created!');logger[_0x6c0c('0xc')](_0x6c0c('0x4d'),_0x12c254['id']);}})[_0x6c0c('0x51')](function(_0x4643f7){logger[_0x6c0c('0x52')]('['+_0x3336fc[_0x6c0c('0x5d')][_0x6c0c('0x5e')]()+']',JSON[_0x6c0c('0x30')](_0x4643f7));});}; \ 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 e10d01a..aafa667 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 _0x85fe=['recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&entities=contact','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','endUserId','Contact\x20created:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x85fe,0x104));var _0xe85f=function(_0x33daba,_0x26688b){_0x33daba=_0x33daba-0x0;var _0x1b4fa1=_0x85fe[_0x33daba];return _0x1b4fa1;};'use strict';var _=require(_0xe85f('0x0'));var rp=require(_0xe85f('0x1'));var md5=require('md5');var util=require(_0xe85f('0x2'));var moment=require(_0xe85f('0x3'));var Promise=require(_0xe85f('0x4'));var Redis=require(_0xe85f('0x5'));var intUtil=require('./util');var config=require(_0xe85f('0x6'));var logger=require(_0xe85f('0x7'))(_0xe85f('0x8'));config[_0xe85f('0x9')]=_[_0xe85f('0xa')](config['redis'],{'host':_0xe85f('0xb'),'port':0x18eb});var io=require(_0xe85f('0xc'))(new Redis(config[_0xe85f('0x9')]));function getAdminId(_0x5a90c2,_0x9ccd55,_0x360fb3,_0x3d58f8){return new Promise(function(_0x2dc8af,_0x3ffc3d){var _0x24678f=![];var _0x5ad547={'method':_0xe85f('0xd'),'uri':_0x3d58f8+_0xe85f('0xe'),'json':!![]};_0x5ad547[_0xe85f('0xf')]=_0x360fb3;logger[_0xe85f('0x10')](_0xe85f('0x11'));return rp(_0x5ad547)[_0xe85f('0x12')](function(_0x1d11b8){if(_0x1d11b8){var _0x37b0f5=_0x1d11b8[_0xe85f('0x13')];var _0x3b8d0b=null;for(_0x3b8d0b=0x0;_0x3b8d0b<_0x37b0f5[_0xe85f('0x14')];_0x3b8d0b++){if(_0x37b0f5[_0x3b8d0b]['email']===_0x5a90c2[_0xe85f('0x15')]){_0x5a90c2[_0xe85f('0x16')]=_0x37b0f5[_0x3b8d0b]['id'];_0x24678f=!![];}}if(_0x24678f){logger[_0xe85f('0x10')](_0xe85f('0x17'),_0x5a90c2[_0xe85f('0x16')]);_0x2dc8af(_0x5a90c2);}else{_0x3ffc3d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3ffc3d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe85f('0x18')](function(_0x453162){logger[_0xe85f('0x19')]('['+[_0x9ccd55[_0xe85f('0x1a')]()]+']',_0x453162[_0xe85f('0x1b')]);_0x3ffc3d(_0x453162);});});}function getUser(_0x10b035,_0x3276c2,_0x80616f){return function(_0x45fc7f){return new Promise(function(_0x2c6ec0,_0x20175e){var _0x5955e0={'method':_0xe85f('0xd'),'uri':_0x80616f+_0xe85f('0xe'),'json':!![]};_0x5955e0[_0xe85f('0xf')]=_0x3276c2;logger[_0xe85f('0x10')]('Getting\x20user\x20list');return rp(_0x5955e0)[_0xe85f('0x12')](function(_0x1dc57f){if(_0x1dc57f){var _0x48097f=_0x1dc57f[_0xe85f('0x13')];var _0x336561=![];var _0x115ce9=null;if(_0x45fc7f[_0xe85f('0x1c')]!==null){logger['info'](_0xe85f('0x1d'),_0x45fc7f['agentEmail']);_0x45fc7f[_0xe85f('0x1e')]=_0x45fc7f[_0xe85f('0x1c')];for(_0x115ce9=0x0;_0x115ce9<_0x48097f[_0xe85f('0x14')];_0x115ce9++){if(_0x48097f[_0x115ce9]['email']===_0x45fc7f[_0xe85f('0x1c')]){_0x336561=!![];_0x45fc7f[_0xe85f('0x1f')]=_0x48097f[_0x115ce9]['id'];logger[_0xe85f('0x10')](_0xe85f('0x20'),_0x45fc7f[_0xe85f('0x1f')]);}}}if(!_0x336561){logger[_0xe85f('0x10')]('Admin\x20selected');_0x45fc7f[_0xe85f('0x1e')]=_0x45fc7f[_0xe85f('0x15')];_0x45fc7f[_0xe85f('0x1f')]=_0x45fc7f[_0xe85f('0x16')];_0x336561=!![];}if(_0x336561){_0x2c6ec0(_0x45fc7f);}else{_0x20175e({'statusCode':0x194,'message':_0xe85f('0x21')});}}else{_0x20175e({'statusCode':0x194,'message':_0xe85f('0x21')});}})[_0xe85f('0x18')](function(_0xee1b9f){logger[_0xe85f('0x19')]('['+[_0x10b035[_0xe85f('0x1a')]()]+']',_0xee1b9f[_0xe85f('0x1b')]);_0x20175e(_0xee1b9f);});});};}function searchContact(_0xf2e829,_0x19fcb7,_0x25e681,_0x2ce245){return new Promise(function(_0x329ade,_0x4468f9){var _0x1c6788={'method':_0xe85f('0xd'),'headers':_0x19fcb7,'uri':_0xf2e829+_0xe85f('0x22')+_0x2ce245+'&f='+_0x25e681+_0xe85f('0x23'),'json':!![]};rp(_0x1c6788)[_0xe85f('0x12')](function(_0xc1348a){var _0x45c4a3=_['find'](_0xc1348a['contacts']['contacts'],[_0x25e681,_0x2ce245]);_0x329ade(_0x45c4a3);})['catch'](function(_0x4e1f17){_0x4468f9(_0x4e1f17);});});}function getEndUser(_0x2b398d,_0x15c624,_0x5cb171){return function(_0x236b28){return new Promise(function(_0x5399ce,_0x199b6c){logger[_0xe85f('0x10')](util[_0xe85f('0x24')](_0xe85f('0x25'),_0x236b28[_0xe85f('0x26')]));searchContact(_0x5cb171,_0x15c624,_0xe85f('0x27'),_0x236b28[_0xe85f('0x26')])[_0xe85f('0x12')](function(_0xf62c68){if(_0xf62c68){_0x236b28['endUserId']=_0xf62c68['id'];logger[_0xe85f('0x10')](_0xe85f('0x28'),_0x236b28['endUserId']);return _0x5399ce(_0x236b28);}searchContact(_0x5cb171,_0x15c624,_0xe85f('0x29'),_0x236b28['contactNumber'])['then'](function(_0x174a4a){if(_0x174a4a){_0x236b28['endUserId']=_0x174a4a['id'];logger[_0xe85f('0x10')](_0xe85f('0x2a'),_0x236b28[_0xe85f('0x2b')]);return _0x5399ce(_0x236b28);}createEndUser(_0x236b28,_0x2b398d,_0x15c624,_0x5cb171)[_0xe85f('0x12')](function(_0x1b317e){logger[_0xe85f('0x10')](_0xe85f('0x2c'),_0x1b317e[_0xe85f('0x2b')]);return _0x5399ce(_0x1b317e);});});})[_0xe85f('0x18')](function(_0x4f4ef7){_0x199b6c(_0x4f4ef7);});});};}function createEndUser(_0x5ee3ad,_0x3aa5c4,_0x41cc66,_0x5d9cd5){return new Promise(function(_0x928311,_0x458d93){var _0x970e64=moment();var _0x55c8a5={'method':'POST','uri':_0x5d9cd5+_0xe85f('0x2d'),'body':{'contact':{'last_name':_0x5ee3ad[_0xe85f('0x26')],'work_number':_0x5ee3ad['contactNumber'],'mobile_number':_0x5ee3ad[_0xe85f('0x26')],'owner_id':_0x5ee3ad[_0xe85f('0x1f')],'created_at':_0x970e64[_0xe85f('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x55c8a5['headers']=_0x41cc66;logger[_0xe85f('0x10')](_0xe85f('0x2e'));return rp(_0x55c8a5)[_0xe85f('0x12')](function(_0x219aad){_0x5ee3ad['endUserId']=_0x219aad[_0xe85f('0x2f')]['id'];_0x928311(_0x5ee3ad);})[_0xe85f('0x18')](function(_0x23c71d){logger[_0xe85f('0x19')]('['+[_0x3aa5c4[_0xe85f('0x1a')]()]+']',_0x23c71d[_0xe85f('0x1b')]);_0x458d93(_0x23c71d[_0xe85f('0x1b')]);});});}function getTicket(_0x51e2d9,_0x42a5fd,_0xe0b084,_0x5e9985,_0x53ce79){return function(_0x2e20d9){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x13d177,_0x189eec){var _0x5d13a4=moment();var _0x463c6d={'method':_0xe85f('0x30'),'uri':_0xe0b084+_0xe85f('0x31'),'body':{'title':intUtil[_0xe85f('0x32')](_0x5e9985[_0xe85f('0x33')],_0x53ce79,'\x20'),'description':intUtil['getString'](_0x5e9985[_0xe85f('0x34')],_0x53ce79,'\x0a'),'owner_id':_0x2e20d9[_0xe85f('0x1f')],'creater_id':_0x2e20d9[_0xe85f('0x16')],'targetable_id':_0x2e20d9['endUserId'],'targetable_type':_0xe85f('0x35'),'created_at':_0x5d13a4['format'](_0xe85f('0x36')),'due_date':_0x5d13a4['add'](0x1e,'m')[_0xe85f('0x24')](_0xe85f('0x36'))},'json':!![]};_0x463c6d[_0xe85f('0xf')]=_0x42a5fd;return rp(_0x463c6d)[_0xe85f('0x12')](function(_0x36882e){_0x2e20d9[_0xe85f('0x37')]=_0x36882e[_0xe85f('0x38')]['id'];logger[_0xe85f('0x10')](_0xe85f('0x39'),_0x2e20d9[_0xe85f('0x37')]);_0x13d177(_0x2e20d9);})[_0xe85f('0x18')](function(_0x5db1a2){logger[_0xe85f('0x19')]('['+[_0x51e2d9[_0xe85f('0x1a')]()]+']',_0x5db1a2[_0xe85f('0x1b')]);_0x189eec(_0x5db1a2[_0xe85f('0x1b')]);});});};}function emit(_0x585124,_0xe6ec79,_0x17f8a4){var _0x33af88={'uri':_0x585124+_0xe85f('0x3a')+_0x17f8a4};io['to'](util[_0xe85f('0x24')](_0xe85f('0x3b'),_0xe6ec79))['emit']('trigger:browser:url',_0x33af88);}exports['cs']=function(_0x1d4e51,_0x14a40a,_0x5ca1dd,_0x1f0259,_0x15353d,_0xbe3de3,_0x45eac1,_0x20f574){var _0x52dc54={};var _0x5beb55={'Authorization':'Token\x20token='+_0xbe3de3['apiKey']};_0xbe3de3['remoteUri']=intUtil[_0xe85f('0x3c')](_0xbe3de3[_0xe85f('0x3d')]);_0xbe3de3['serverUrl']=intUtil[_0xe85f('0x3c')](_0xbe3de3[_0xe85f('0x3e')]);var _0xb721c1=_0xbe3de3[_0xe85f('0x3d')];_0x52dc54[_0xe85f('0x15')]=_0xbe3de3['username'];_0x52dc54['contactNumber']=_0x20f574[_0xe85f('0x3f')]()===_0xe85f('0x40')?_0x14a40a[_0xe85f('0x41')]:_0x14a40a[_0xe85f('0x42')];_0x52dc54[_0xe85f('0x43')]=_0x20f574===_0xe85f('0x44')||_0x20f574===_0xe85f('0x45')?_0xe85f('0x44'):'outbound';if(_0x1f0259){_0x52dc54[_0xe85f('0x1c')]=_0x1f0259[_0xe85f('0x46')];}var _0x5c4e4d=util[_0xe85f('0x24')](_0xe85f('0x47'),_0xbe3de3['serverUrl'],_0x14a40a[_0xe85f('0x48')],md5(_0x14a40a[_0xe85f('0x48')]));if(_0x15353d&&_0x15353d[_0xe85f('0x49')]){logger[_0xe85f('0x10')]('[QUEUE]',_0xe85f('0x4a'));_0x14a40a[_0xe85f('0x4b')]=_0x5c4e4d;}else if(_0x45eac1&&_0x45eac1[_0xe85f('0x4c')]&&_0x45eac1[_0xe85f('0x4c')]!==_0xe85f('0x4d')){logger['info'](_0xe85f('0x4e'),_0xe85f('0x4a'));_0x14a40a[_0xe85f('0x4b')]=_0x5c4e4d;}else{_0x14a40a[_0xe85f('0x4b')]='';}return getAdminId(_0x52dc54,_0x20f574,_0x5beb55,_0xb721c1)['then'](getUser(_0x20f574,_0x5beb55,_0xb721c1))['then'](getEndUser(_0x20f574,_0x5beb55,_0xb721c1))[_0xe85f('0x12')](getTicket(_0x20f574,_0x5beb55,_0xb721c1,_0x5ca1dd,_0x14a40a))[_0xe85f('0x12')](function(_0x480437){logger[_0xe85f('0x10')](util[_0xe85f('0x24')](_0xe85f('0x4f'),_0x480437[_0xe85f('0x37')]));if(_0x20f574!==_0xe85f('0x45')){logger[_0xe85f('0x10')]('['+[_0x20f574['toUpperCase']()]+']',_0xe85f('0x50'));emit(_0xb721c1,_0x1f0259[_0xe85f('0x51')],_0x480437[_0xe85f('0x2b')]);}})['catch'](function(_0x13df25){logger[_0xe85f('0x19')]('['+[_0x20f574[_0xe85f('0x1a')]()]+_0xe85f('0x52'),util[_0xe85f('0x53')](_0x13df25,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8b87=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','destcalleridnum','calleridnum','callDirection','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','GET','/api/selector/owners','headers','then','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x8b87,0x118));var _0x78b8=function(_0x553a34,_0x4d7070){_0x553a34=_0x553a34-0x0;var _0x217fe3=_0x8b87[_0x553a34];return _0x217fe3;};'use strict';var _=require(_0x78b8('0x0'));var rp=require(_0x78b8('0x1'));var md5=require(_0x78b8('0x2'));var util=require(_0x78b8('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x78b8('0x4'));var intUtil=require(_0x78b8('0x5'));var config=require(_0x78b8('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x78b8('0x7')]=_[_0x78b8('0x8')](config[_0x78b8('0x7')],{'host':_0x78b8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x78b8('0x7')]));function getAdminId(_0x16193d,_0x5507b2,_0x184cfb,_0x3e5945){return new Promise(function(_0x95225b,_0x587116){var _0x2248d6=![];var _0x3aac53={'method':_0x78b8('0xa'),'uri':_0x3e5945+_0x78b8('0xb'),'json':!![]};_0x3aac53[_0x78b8('0xc')]=_0x184cfb;logger['info']('Getting\x20admin\x20information');return rp(_0x3aac53)[_0x78b8('0xd')](function(_0x1aa83c){if(_0x1aa83c){var _0x2f7843=_0x1aa83c[_0x78b8('0xe')];var _0x4b345b=null;for(_0x4b345b=0x0;_0x4b345b<_0x2f7843[_0x78b8('0xf')];_0x4b345b++){if(_0x2f7843[_0x4b345b][_0x78b8('0x10')]===_0x16193d[_0x78b8('0x11')]){_0x16193d[_0x78b8('0x12')]=_0x2f7843[_0x4b345b]['id'];_0x2248d6=!![];}}if(_0x2248d6){logger[_0x78b8('0x13')](_0x78b8('0x14'),_0x16193d[_0x78b8('0x12')]);_0x95225b(_0x16193d);}else{_0x587116({'statusCode':0x194,'message':_0x78b8('0x15')});}}else{_0x587116({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x78b8('0x16')](function(_0xa63fb3){logger[_0x78b8('0x17')]('['+[_0x5507b2[_0x78b8('0x18')]()]+']',_0xa63fb3[_0x78b8('0x19')]);_0x587116(_0xa63fb3);});});}function getUser(_0xc0c354,_0xa2a01,_0x3a1a8f){return function(_0x1de8ec){return new Promise(function(_0x428a55,_0x252bfd){var _0x56e4c5={'method':_0x78b8('0xa'),'uri':_0x3a1a8f+_0x78b8('0xb'),'json':!![]};_0x56e4c5[_0x78b8('0xc')]=_0xa2a01;logger[_0x78b8('0x13')](_0x78b8('0x1a'));return rp(_0x56e4c5)[_0x78b8('0xd')](function(_0x1e35cc){if(_0x1e35cc){var _0x1a365b=_0x1e35cc[_0x78b8('0xe')];var _0x3dc973=![];var _0x5c67ce=null;if(_0x1de8ec[_0x78b8('0x1b')]!==null){logger[_0x78b8('0x13')](_0x78b8('0x1c'),_0x1de8ec[_0x78b8('0x1b')]);_0x1de8ec[_0x78b8('0x1d')]=_0x1de8ec[_0x78b8('0x1b')];for(_0x5c67ce=0x0;_0x5c67ce<_0x1a365b[_0x78b8('0xf')];_0x5c67ce++){if(_0x1a365b[_0x5c67ce]['email']===_0x1de8ec[_0x78b8('0x1b')]){_0x3dc973=!![];_0x1de8ec[_0x78b8('0x1e')]=_0x1a365b[_0x5c67ce]['id'];logger[_0x78b8('0x13')](_0x78b8('0x1f'),_0x1de8ec[_0x78b8('0x1e')]);}}}if(!_0x3dc973){logger['info'](_0x78b8('0x20'));_0x1de8ec[_0x78b8('0x1d')]=_0x1de8ec[_0x78b8('0x11')];_0x1de8ec[_0x78b8('0x1e')]=_0x1de8ec['adminId'];_0x3dc973=!![];}if(_0x3dc973){_0x428a55(_0x1de8ec);}else{_0x252bfd({'statusCode':0x194,'message':_0x78b8('0x15')});}}else{_0x252bfd({'statusCode':0x194,'message':_0x78b8('0x15')});}})[_0x78b8('0x16')](function(_0x259fec){logger['error']('['+[_0xc0c354['toUpperCase']()]+']',_0x259fec[_0x78b8('0x19')]);_0x252bfd(_0x259fec);});});};}function searchContact(_0x436024,_0x17e80b,_0x5651e0,_0x2a6c7f){return new Promise(function(_0x1861be,_0x280d12){var _0x3a0eb7={'method':'GET','headers':_0x17e80b,'uri':_0x436024+_0x78b8('0x21')+_0x2a6c7f+_0x78b8('0x22')+_0x5651e0+_0x78b8('0x23'),'json':!![]};rp(_0x3a0eb7)[_0x78b8('0xd')](function(_0x217a29){var _0x549461=_[_0x78b8('0x24')](_0x217a29[_0x78b8('0x25')][_0x78b8('0x25')],[_0x5651e0,_0x2a6c7f]);_0x1861be(_0x549461);})[_0x78b8('0x16')](function(_0x3a8d40){_0x280d12(_0x3a8d40);});});}function getEndUser(_0x1b1904,_0x7f9a20,_0x1157ba){return function(_0x45b4c7){return new Promise(function(_0x4855e5,_0x466260){logger[_0x78b8('0x13')](util[_0x78b8('0x26')](_0x78b8('0x27'),_0x45b4c7[_0x78b8('0x28')]));searchContact(_0x1157ba,_0x7f9a20,_0x78b8('0x29'),_0x45b4c7['contactNumber'])[_0x78b8('0xd')](function(_0x27001c){if(_0x27001c){_0x45b4c7[_0x78b8('0x2a')]=_0x27001c['id'];logger[_0x78b8('0x13')]('Contact\x20found\x20mobile_number:',_0x45b4c7['endUserId']);return _0x4855e5(_0x45b4c7);}searchContact(_0x1157ba,_0x7f9a20,'work_number',_0x45b4c7[_0x78b8('0x28')])[_0x78b8('0xd')](function(_0x16d9f1){if(_0x16d9f1){_0x45b4c7['endUserId']=_0x16d9f1['id'];logger[_0x78b8('0x13')]('Contact\x20found\x20work_number:',_0x45b4c7['endUserId']);return _0x4855e5(_0x45b4c7);}createEndUser(_0x45b4c7,_0x1b1904,_0x7f9a20,_0x1157ba)[_0x78b8('0xd')](function(_0x1810fe){logger[_0x78b8('0x13')](_0x78b8('0x2b'),_0x1810fe[_0x78b8('0x2a')]);return _0x4855e5(_0x1810fe);});});})[_0x78b8('0x16')](function(_0x25b7a9){_0x466260(_0x25b7a9);});});};}function createEndUser(_0x2d11c6,_0x216148,_0x20b4bc,_0x1c62ba){return new Promise(function(_0xec5d4,_0x2ea3c0){var _0x5b660a=moment();var _0x4e9f12={'method':_0x78b8('0x2c'),'uri':_0x1c62ba+_0x78b8('0x2d'),'body':{'contact':{'last_name':_0x2d11c6[_0x78b8('0x28')],'work_number':_0x2d11c6[_0x78b8('0x28')],'mobile_number':_0x2d11c6[_0x78b8('0x28')],'owner_id':_0x2d11c6['userId'],'created_at':_0x5b660a[_0x78b8('0x26')](_0x78b8('0x2e'))}},'json':!![]};_0x4e9f12[_0x78b8('0xc')]=_0x20b4bc;logger[_0x78b8('0x13')](_0x78b8('0x2f'));return rp(_0x4e9f12)[_0x78b8('0xd')](function(_0x12ce5a){_0x2d11c6[_0x78b8('0x2a')]=_0x12ce5a[_0x78b8('0x30')]['id'];_0xec5d4(_0x2d11c6);})['catch'](function(_0x382412){logger[_0x78b8('0x17')]('['+[_0x216148[_0x78b8('0x18')]()]+']',_0x382412[_0x78b8('0x19')]);_0x2ea3c0(_0x382412[_0x78b8('0x19')]);});});}function getTicket(_0x55cb25,_0x4ee00b,_0x38086a,_0x28fa6e,_0x3e9a28){return function(_0x58284b){logger[_0x78b8('0x13')](_0x78b8('0x31'));return new Promise(function(_0x4a63a5,_0x1fd4a2){var _0x438ff3=moment();var _0x471d6c={'method':_0x78b8('0x2c'),'uri':_0x38086a+_0x78b8('0x32'),'body':{'title':intUtil[_0x78b8('0x33')](_0x28fa6e[_0x78b8('0x34')],_0x3e9a28,'\x20'),'description':intUtil[_0x78b8('0x33')](_0x28fa6e[_0x78b8('0x35')],_0x3e9a28,'\x0a'),'owner_id':_0x58284b[_0x78b8('0x1e')],'creater_id':_0x58284b[_0x78b8('0x12')],'targetable_id':_0x58284b['endUserId'],'targetable_type':_0x78b8('0x36'),'created_at':_0x438ff3[_0x78b8('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x438ff3[_0x78b8('0x37')](0x1e,'m')[_0x78b8('0x26')](_0x78b8('0x2e'))},'json':!![]};_0x471d6c['headers']=_0x4ee00b;return rp(_0x471d6c)['then'](function(_0xa01cff){_0x58284b[_0x78b8('0x38')]=_0xa01cff[_0x78b8('0x39')]['id'];logger['info']('Task\x20created:',_0x58284b[_0x78b8('0x38')]);_0x4a63a5(_0x58284b);})['catch'](function(_0x485dd8){logger['error']('['+[_0x55cb25['toUpperCase']()]+']',_0x485dd8['message']);_0x1fd4a2(_0x485dd8[_0x78b8('0x19')]);});});};}function emit(_0xfe6c7f,_0x26a4db,_0x4ce9b8){var _0x3df5a4={'uri':_0xfe6c7f+'/contacts/'+_0x4ce9b8};io['to'](util[_0x78b8('0x26')]('user:%s',_0x26a4db))[_0x78b8('0x3a')](_0x78b8('0x3b'),_0x3df5a4);}exports['cs']=function(_0x265df7,_0x801304,_0xc27e84,_0x1e93f0,_0x157b9f,_0x395a1c,_0xc0e83d,_0x2b203c){var _0x20f437={};var _0x3d85e2={'Authorization':_0x78b8('0x3c')+_0x395a1c[_0x78b8('0x3d')]};_0x395a1c['remoteUri']=intUtil['stripTrailingSlash'](_0x395a1c[_0x78b8('0x3e')]);_0x395a1c[_0x78b8('0x3f')]=intUtil[_0x78b8('0x40')](_0x395a1c[_0x78b8('0x3f')]);var _0x353ee8=_0x395a1c['remoteUri'];_0x20f437[_0x78b8('0x11')]=_0x395a1c['username'];_0x20f437[_0x78b8('0x28')]=_0x2b203c['toLowerCase']()==='outbound'?_0x801304[_0x78b8('0x41')]:_0x801304[_0x78b8('0x42')];_0x20f437[_0x78b8('0x43')]=_0x2b203c==='queue'||_0x2b203c===_0x78b8('0x44')?'queue':_0x78b8('0x45');if(_0x1e93f0){_0x20f437[_0x78b8('0x1b')]=_0x1e93f0[_0x78b8('0x10')];}var _0x4ef162=util[_0x78b8('0x26')](_0x78b8('0x46'),_0x395a1c['serverUrl'],_0x801304['uniqueid'],md5(_0x801304[_0x78b8('0x47')]));if(_0x157b9f&&_0x157b9f[_0x78b8('0x48')]){logger['info']('[QUEUE]',_0x78b8('0x49'));_0x801304[_0x78b8('0x4a')]=_0x4ef162;}else if(_0xc0e83d&&_0xc0e83d[_0x78b8('0x4b')]&&_0xc0e83d[_0x78b8('0x4b')]!==_0x78b8('0x4c')){logger[_0x78b8('0x13')](_0x78b8('0x4d'),'Recording\x20is\x20enabled!');_0x801304['recordingURL']=_0x4ef162;}else{_0x801304[_0x78b8('0x4a')]='';}return getAdminId(_0x20f437,_0x2b203c,_0x3d85e2,_0x353ee8)['then'](getUser(_0x2b203c,_0x3d85e2,_0x353ee8))['then'](getEndUser(_0x2b203c,_0x3d85e2,_0x353ee8))['then'](getTicket(_0x2b203c,_0x3d85e2,_0x353ee8,_0xc27e84,_0x801304))[_0x78b8('0xd')](function(_0x511d9b){logger[_0x78b8('0x13')](util[_0x78b8('0x26')](_0x78b8('0x4e'),_0x511d9b[_0x78b8('0x38')]));if(_0x2b203c!=='unmanaged'){logger[_0x78b8('0x13')]('['+[_0x2b203c[_0x78b8('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x353ee8,_0x1e93f0['name'],_0x511d9b['endUserId']);}})['catch'](function(_0x15dd04){logger[_0x78b8('0x17')]('['+[_0x2b203c[_0x78b8('0x18')]()]+_0x78b8('0x4f'),util[_0x78b8('0x50')](_0x15dd04,{'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 8745ed9..155b373 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 _0xa9bf=['exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unknown\x20integration','[EXEC]','format','../../../../config/logger','error','lodash','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xa9bf,0x19c));var _0xfa9b=function(_0x3d80ca,_0x549db6){_0x3d80ca=_0x3d80ca-0x0;var _0x1cd947=_0xa9bf[_0x3d80ca];return _0x1cd947;};'use strict';var _=require(_0xfa9b('0x0'));var util=require('util');var zendesk=require(_0xfa9b('0x1'));var salesforce=require(_0xfa9b('0x2'));var sugarcrm=require(_0xfa9b('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0xfa9b('0x4'));var desk=require(_0xfa9b('0x5'));var vtiger=require(_0xfa9b('0x6'));var servicenow=require(_0xfa9b('0x7'));var dynamics365=require(_0xfa9b('0x8'));var freshsales=require(_0xfa9b('0x9'));var integrations=[_0xfa9b('0xa'),_0xfa9b('0xb'),_0xfa9b('0xc'),_0xfa9b('0xd'),_0xfa9b('0xe'),_0xfa9b('0xf'),_0xfa9b('0x10'),_0xfa9b('0x11'),_0xfa9b('0x12'),_0xfa9b('0x13')];exports[_0xfa9b('0x14')]=function(_0x2c3e8f,_0x35a4fe,_0x51b328,_0x52a1c4,_0x2d5d1c,_0x471f43){if(_0x51b328){if(_['includes'](integrations,_0x2c3e8f[_0xfa9b('0x15')][_0xfa9b('0x16')]())){try{var _0x452233=null;var _0x2a64e6='';var _0x5e391a=_0x51b328[_0x2c3e8f[_0xfa9b('0x15')][_0xfa9b('0x16')]()];if(_0x5e391a){var _0x1d802f=_0x5e391a[_0x2c3e8f[_0xfa9b('0x17')]];if(_0x1d802f){var _0x5b6d60=_[_0xfa9b('0x18')](_0x1d802f[_0xfa9b('0x19')],{'id':parseInt(_0x2c3e8f[_0xfa9b('0x1a')],0xa)});if(_0x5b6d60){if(_0x52a1c4){if(_0x2d5d1c&&_0x35a4fe[_0xfa9b('0x1b')]){_0x2a64e6=_0xfa9b('0x1b');}else if(_0x35a4fe[_0xfa9b('0x1c')]){_0x2a64e6=_0xfa9b('0x1d');}else{console[_0xfa9b('0x1e')]('EVENT\x20UNKNOWN',_0x35a4fe);}}else{_0x2a64e6='unmanaged';}switch(_0x2c3e8f[_0xfa9b('0x15')]['toLowerCase']()){case _0xfa9b('0xa'):zendesk[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0xb'):salesforce[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0xc'):sugarcrm[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case'freshdesk':freshdesk[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0xe'):zoho[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0xf'):desk[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0x10'):vtiger[_0x2a64e6](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43);break;case _0xfa9b('0x12'):freshsales['cs'](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43,_0x2a64e6);break;case _0xfa9b('0x13'):servicenow['cs'](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43,_0x2a64e6);break;case _0xfa9b('0x11'):dynamics365['cs'](_0x2c3e8f,_0x35a4fe,_0x5b6d60,_0x52a1c4,_0x2d5d1c,_0x1d802f,_0x471f43,_0x2a64e6);break;default:console['log'](_0xfa9b('0x1f'));}}else{_0x452233=require('../../../../config/logger')(_0x2c3e8f[_0xfa9b('0x15')]['toLowerCase']());_0x452233['error'](_0xfa9b('0x20'),util[_0xfa9b('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2c3e8f['data1'][_0xfa9b('0x16')](),_0x2c3e8f[_0xfa9b('0x1a')]));}}else{_0x452233=require(_0xfa9b('0x22'))(_0x2c3e8f[_0xfa9b('0x15')][_0xfa9b('0x16')]());_0x452233['error'](_0xfa9b('0x20'),util[_0xfa9b('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x2c3e8f[_0xfa9b('0x15')]['toLowerCase'](),_0x2c3e8f[_0xfa9b('0x17')]));}}else{}}catch(_0x410f96){console[_0xfa9b('0x23')](_0x410f96);}}}}; \ No newline at end of file +var _0x8cee=['[EXEC]','format','data3','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','exec','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','servicenow','dynamics365','unknown\x20integration','../../../../config/logger'];(function(_0x5e61fe,_0x4ec70b){var _0x13ff2b=function(_0x300006){while(--_0x300006){_0x5e61fe['push'](_0x5e61fe['shift']());}};_0x13ff2b(++_0x4ec70b);}(_0x8cee,0x12d));var _0xe8ce=function(_0x2a56ce,_0x448f12){_0x2a56ce=_0x2a56ce-0x0;var _0x1f9977=_0x8cee[_0x2a56ce];return _0x1f9977;};'use strict';var _=require(_0xe8ce('0x0'));var util=require(_0xe8ce('0x1'));var zendesk=require(_0xe8ce('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe8ce('0x3'));var freshdesk=require(_0xe8ce('0x4'));var zoho=require(_0xe8ce('0x5'));var desk=require(_0xe8ce('0x6'));var vtiger=require(_0xe8ce('0x7'));var servicenow=require(_0xe8ce('0x8'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0xe8ce('0x9'),_0xe8ce('0xa'),_0xe8ce('0xb'),_0xe8ce('0xc'),_0xe8ce('0xd'),_0xe8ce('0xe'),_0xe8ce('0xf'),'dynamics365',_0xe8ce('0x10'),'servicenow'];exports[_0xe8ce('0x11')]=function(_0x404f6f,_0x2272d1,_0x211381,_0x3691d4,_0x103e27,_0x48443e){if(_0x211381){if(_['includes'](integrations,_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')]())){try{var _0x2b3001=null;var _0x3f96fc='';var _0xb048e5=_0x211381[_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')]()];if(_0xb048e5){var _0x2f7935=_0xb048e5[_0x404f6f[_0xe8ce('0x14')]];if(_0x2f7935){var _0x21bd25=_[_0xe8ce('0x15')](_0x2f7935[_0xe8ce('0x16')],{'id':parseInt(_0x404f6f['data3'],0xa)});if(_0x21bd25){if(_0x3691d4){if(_0x103e27&&_0x2272d1[_0xe8ce('0x17')]){_0x3f96fc=_0xe8ce('0x17');}else if(_0x2272d1[_0xe8ce('0x18')]){_0x3f96fc=_0xe8ce('0x19');}else{console[_0xe8ce('0x1a')]('EVENT\x20UNKNOWN',_0x2272d1);}}else{_0x3f96fc=_0xe8ce('0x1b');}switch(_0x404f6f[_0xe8ce('0x12')]['toLowerCase']()){case'zendesk':zendesk[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case _0xe8ce('0xa'):salesforce[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case _0xe8ce('0xb'):sugarcrm[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case _0xe8ce('0xc'):freshdesk[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case _0xe8ce('0xd'):zoho[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case _0xe8ce('0xe'):desk[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case'vtiger':vtiger[_0x3f96fc](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e);break;case'freshsales':freshsales['cs'](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e,_0x3f96fc);break;case _0xe8ce('0x1c'):servicenow['cs'](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e,_0x3f96fc);break;case _0xe8ce('0x1d'):dynamics365['cs'](_0x404f6f,_0x2272d1,_0x21bd25,_0x3691d4,_0x103e27,_0x2f7935,_0x48443e,_0x3f96fc);break;default:console[_0xe8ce('0x1a')](_0xe8ce('0x1e'));}}else{_0x2b3001=require(_0xe8ce('0x1f'))(_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')]());_0x2b3001['error'](_0xe8ce('0x20'),util[_0xe8ce('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')](),_0x404f6f[_0xe8ce('0x22')]));}}else{_0x2b3001=require('../../../../config/logger')(_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')]());_0x2b3001[_0xe8ce('0x23')](_0xe8ce('0x20'),util[_0xe8ce('0x21')](_0xe8ce('0x24'),_0x404f6f[_0xe8ce('0x12')][_0xe8ce('0x13')](),_0x404f6f[_0xe8ce('0x14')]));}}else{}}catch(_0x17bc26){console[_0xe8ce('0x23')](_0x17bc26);}}}}; \ 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 9dd229a..c087d1c 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 _0xab3c=['contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','first','Name','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','picklist','idField','content','toString','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Subjects','Descriptions','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','find','execute','then','length','Email','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x564c58,_0xfb160c){var _0xa29c5c=function(_0x4afa22){while(--_0x4afa22){_0x564c58['push'](_0x564c58['shift']());}};_0xa29c5c(++_0xfb160c);}(_0xab3c,0xc7));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var rp=require(_0xcab3('0x1'));var moment=require('moment');var BPromise=require(_0xcab3('0x2'));var md5=require('md5');var jsforce=require(_0xcab3('0x3'));var util=require(_0xcab3('0x4'));var Redis=require(_0xcab3('0x5'));var intUtil=require(_0xcab3('0x6'));var config=require(_0xcab3('0x7'));var logger=require(_0xcab3('0x8'))(_0xcab3('0x9'));config[_0xcab3('0xa')]=_[_0xcab3('0xb')](config[_0xcab3('0xa')],{'host':_0xcab3('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcab3('0xa')]));function emit(_0x6e770a,_0x217bcb,_0x592d32){io['to'](_0x6e770a)['emit'](_0x217bcb,_0x592d32);}function getTicket(_0x3c56f8,_0x3a4459,_0x3e9430,_0x1e3368,_0x5f4e5c,_0x352068,_0x392c98,_0x35d17e){var _0x22dc46=Object[_0xcab3('0xd')]({},{'OwnerId':_0x3a4459['id'],'Subject':intUtil[_0xcab3('0xe')](_0x1e3368[_0xcab3('0xf')],_0x5f4e5c,'\x20'),'Description':intUtil['getString'](_0x1e3368[_0xcab3('0x10')],_0x5f4e5c,'\x0a')},getCustomFields(_0x352068,_0x5f4e5c));if(_0x3e9430){if(_0x1e3368['ticketType']==='Task'){_0x22dc46[_0xcab3('0x11')]=moment[_0xcab3('0x12')]();_0x22dc46['IsReminderSet']=![];_0x22dc46[_0xcab3('0x13')]=![];if(_0x3e9430['endUserType']===_0xcab3('0x14')||_0x3e9430[_0xcab3('0x15')]===_0xcab3('0x16')){_0x22dc46['WhoId']=_0x3e9430['id'];}else if(_0x3e9430[_0xcab3('0x15')]===_0xcab3('0x17')){_0x22dc46[_0xcab3('0x18')]=_0x3e9430['id'];}}else if(_0x1e3368['ticketType']===_0xcab3('0x19')){if(_0x3e9430[_0xcab3('0x15')]==='contact'){_0x22dc46[_0xcab3('0x1a')]=_0x3e9430['id'];}else if(_0x3e9430[_0xcab3('0x15')]===_0xcab3('0x17')){_0x22dc46[_0xcab3('0x1b')]=_0x3e9430['id'];}else if(_0x3e9430[_0xcab3('0x15')]===_0xcab3('0x16')&&_0x1e3368[_0xcab3('0x1c')]){_0x22dc46[_0x1e3368[_0xcab3('0x1c')]]=_0x3e9430['id'];}else{logger[_0xcab3('0x1d')](_0xcab3('0x1e'));}}}return _0x392c98[_0xcab3('0x1f')](_0x1e3368['ticketType'])['create'](_0x22dc46);}function getUser(_0x4a67e6,_0x2c82f7,_0x3b1d77){if(!_[_0xcab3('0x20')](_0x2c82f7)&&intUtil['validateEmail'](_0x2c82f7)){var _0x433b05={'Email':_0x2c82f7};var _0x5315be={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b1d77[_0xcab3('0x1f')]('User')[_0xcab3('0x21')](_0x433b05,_0x5315be)[_0xcab3('0x22')]()[_0xcab3('0x23')](function(_0x3ea9e3){if(_0x3ea9e3[_0xcab3('0x24')]){var _0x3033f1=_['find'](_0x3ea9e3,function(_0x5a6a87){return _0x5a6a87[_0xcab3('0x25')]===_0x2c82f7;});if(_0x3033f1){logger[_0xcab3('0x1d')]('Agent\x20%s\x20found.',_0x2c82f7);return BPromise['resolve']({'id':_0x3033f1['Id'],'name':_0x3033f1['Name']});}}else{logger[_0xcab3('0x1d')](_0xcab3('0x26'),_0x2c82f7);return _0x3b1d77[_0xcab3('0x27')]()['then'](function(_0x1d4aea){return BPromise[_0xcab3('0x28')]({'id':_0x1d4aea[_0xcab3('0x29')],'name':_0x1d4aea['display_name']});});}});}else{logger[_0xcab3('0x1d')](_0xcab3('0x26'),_0x2c82f7);return _0x3b1d77[_0xcab3('0x27')]()[_0xcab3('0x23')](function(_0x25cf32){return BPromise[_0xcab3('0x28')]({'id':_0x25cf32['user_id'],'name':_0x25cf32[_0xcab3('0x2a')]});});}}function getEndUser(_0x4cd00e,_0x2dde75,_0x154791,_0x17d0a4,_0x3c4a56){var _0x4d807a={'$or':{'Phone':_0x17d0a4}};var _0x1ff6c8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcab3('0x28')]()[_0xcab3('0x23')](function(){logger[_0xcab3('0x1d')](_0xcab3('0x2b'),_0x17d0a4,_0x2dde75[_0xcab3('0x2c')]);switch(_0x2dde75['moduleSearch']){case _0xcab3('0x2d'):var _0xae2991=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75[_0xcab3('0x2f')]){var _0x1ee08e={};_0x1ee08e[_0x2dde75['additionalSearchContact']]=_0x17d0a4;_['merge'](_0xae2991['$or'],_0x1ee08e);}return _0x3c4a56[_0xcab3('0x1f')](_0xcab3('0x30'))[_0xcab3('0x21')](_0xae2991,_0x1ff6c8)['execute']()[_0xcab3('0x23')](function(_0x30a205){if(_0x30a205&&_0x30a205['length']){return _0x30a205;}else{var _0x4ae202=_['cloneDeep'](_0x4d807a);if(_0x2dde75[_0xcab3('0x31')]){var _0x246123={};_0x246123[_0x2dde75['additionalSearchLead']]=_0x17d0a4;_[_0xcab3('0x32')](_0x4ae202[_0xcab3('0x33')],_0x246123);}return _0x3c4a56[_0xcab3('0x1f')](_0xcab3('0x34'))[_0xcab3('0x21')](_0x4ae202,_0x1ff6c8);}});case _0xcab3('0x35'):var _0x1428dc=_['cloneDeep'](_0x4d807a);if(_0x2dde75[_0xcab3('0x36')]){var _0x1ee08e={};_0x1ee08e[_0x2dde75[_0xcab3('0x36')]]=_0x17d0a4;_[_0xcab3('0x32')](_0x1428dc[_0xcab3('0x33')],_0x1ee08e);}return _0x3c4a56[_0xcab3('0x1f')]('Account')[_0xcab3('0x21')](_0x1428dc,_0x1ff6c8)['execute']()[_0xcab3('0x23')](function(_0x412e57){if(_0x412e57&&_0x412e57[_0xcab3('0x24')]){return _0x412e57;}else{var _0x559781=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75[_0xcab3('0x2f')]){var _0xb806aa={};_0xb806aa[_0x2dde75['additionalSearchContact']]=_0x17d0a4;_[_0xcab3('0x32')](_0x559781[_0xcab3('0x33')],_0xb806aa);}return _0x3c4a56[_0xcab3('0x1f')]('Contact')['find'](_0x559781,_0x1ff6c8)[_0xcab3('0x23')](function(_0x212e13){if(_0x212e13&&_0x212e13[_0xcab3('0x24')]){return _0x212e13;}else{var _0x30395e=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75[_0xcab3('0x31')]){var _0x12c77c={};_0x12c77c[_0x2dde75[_0xcab3('0x31')]]=_0x17d0a4;_[_0xcab3('0x32')](_0x30395e[_0xcab3('0x33')],_0x12c77c);}return _0x3c4a56[_0xcab3('0x1f')](_0xcab3('0x34'))[_0xcab3('0x21')](_0x30395e,_0x1ff6c8);}});}});case _0xcab3('0x14'):var _0xae2991=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75[_0xcab3('0x2f')]){var _0x1ee08e={};_0x1ee08e[_0x2dde75[_0xcab3('0x2f')]]=_0x17d0a4;_['merge'](_0xae2991[_0xcab3('0x33')],_0x1ee08e);}return _0x3c4a56[_0xcab3('0x1f')](_0xcab3('0x30'))[_0xcab3('0x21')](_0xae2991,_0x1ff6c8)[_0xcab3('0x22')]();case _0xcab3('0x16'):var _0x128220=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75['additionalSearchLead']){var _0x1ee08e={};_0x1ee08e[_0x2dde75[_0xcab3('0x31')]]=_0x17d0a4;_[_0xcab3('0x32')](_0x128220[_0xcab3('0x33')],_0x1ee08e);}return _0x3c4a56['sobject']('Lead')[_0xcab3('0x21')](_0x128220,_0x1ff6c8);case _0xcab3('0x17'):var _0x1428dc=_[_0xcab3('0x2e')](_0x4d807a);if(_0x2dde75[_0xcab3('0x36')]){var _0x1ee08e={};_0x1ee08e[_0x2dde75[_0xcab3('0x36')]]=_0x17d0a4;_['merge'](_0x1428dc[_0xcab3('0x33')],_0x1ee08e);}return _0x3c4a56[_0xcab3('0x1f')]('Account')[_0xcab3('0x21')](_0x1428dc,_0x1ff6c8);default:return null;}})[_0xcab3('0x23')](function(_0x3b8535){if(_0x3b8535&&_0x3b8535[_0xcab3('0x24')]){var _0x157464=_[_0xcab3('0x37')](_0x3b8535);if(_0x157464){return BPromise[_0xcab3('0x28')]({'id':_0x157464['Id'],'name':_0x157464[_0xcab3('0x38')],'phone':_0x157464['Phone'],'endUserType':_0x157464['attributes'][_0xcab3('0x39')][_0xcab3('0x3a')]()});}}})[_0xcab3('0x23')](function(_0x3a28b6){if(_0x3a28b6){logger[_0xcab3('0x1d')](_0xcab3('0x3b'),_0x3a28b6[_0xcab3('0x15')],_0x17d0a4);return BPromise[_0xcab3('0x28')](_0x3a28b6);}else{logger[_0xcab3('0x1d')](_0xcab3('0x3c'),_0x17d0a4);var _0x20e045={'Phone':_0x17d0a4};if(_0x2dde75['moduleCreate']){if(_0x2dde75[_0xcab3('0x3d')]===_0xcab3('0x14')){logger[_0xcab3('0x1d')](_0xcab3('0x3e'),_0x17d0a4,_0x2dde75[_0xcab3('0x3d')]);_0x20e045[_0xcab3('0x3f')]=_0x154791!==_0xcab3('0x40')?_0x154791:util[_0xcab3('0x41')]('Caller\x20-\x20%s',_0x17d0a4);}else if(_0x2dde75[_0xcab3('0x3d')]==='lead'){logger[_0xcab3('0x1d')](_0xcab3('0x3e'),_0x17d0a4,_0x2dde75[_0xcab3('0x3d')]);_0x20e045[_0xcab3('0x3f')]=_0x154791!==''?_0x154791:util[_0xcab3('0x41')](_0xcab3('0x42'),_0x17d0a4);_0x20e045[_0xcab3('0x43')]=_0xcab3('0x44');}else if(_0x2dde75[_0xcab3('0x3d')]==='account'){logger[_0xcab3('0x1d')](_0xcab3('0x3e'),_0x17d0a4,_0x2dde75[_0xcab3('0x3d')]);_0x20e045['Name']=_0x154791!==_0xcab3('0x40')?_0x154791:util[_0xcab3('0x41')](_0xcab3('0x42'),_0x17d0a4);}else{return null;}}return _0x3c4a56[_0xcab3('0x1f')](_[_0xcab3('0x45')](_0x2dde75[_0xcab3('0x3d')]))[_0xcab3('0x46')](_0x20e045)[_0xcab3('0x23')](function(_0x4a0fc2){return BPromise[_0xcab3('0x28')]({'id':_0x4a0fc2['id'],'endUserType':_0x2dde75[_0xcab3('0x3d')]});});}});}function getCustomFields(_0x2d3873,_0x25b463){var _0xc943cf={};if(_0x2d3873[_0xcab3('0x24')]>0x0){_[_0xcab3('0x47')](_0x2d3873,function(_0x58b5e7){if(_['includes'](['string',_0xcab3('0x48')],_0x58b5e7[_0xcab3('0x39')])&&_0x58b5e7[_0xcab3('0x49')]){_0xc943cf[_0x58b5e7[_0xcab3('0x49')]]=_0x58b5e7[_0xcab3('0x4a')][_0xcab3('0x4b')]();}else if(_0x58b5e7[_0xcab3('0x39')]==='variable'&&_0x58b5e7[_0xcab3('0x4c')]&&_0x58b5e7[_0xcab3('0x49')]){_0x25b463[_0x58b5e7[_0xcab3('0x4c')]]&&(_0xc943cf[_0x58b5e7[_0xcab3('0x49')]]=_0x25b463[_0x58b5e7[_0xcab3('0x4c')]][_0xcab3('0x4b')]());}else if(_0x58b5e7[_0xcab3('0x39')]===_0xcab3('0x4d')&&_0x58b5e7[_0xcab3('0x4e')]&&_0x58b5e7[_0xcab3('0x4e')][_0xcab3('0x4f')]&&_0x58b5e7[_0xcab3('0x49')]){_0x25b463[_0x58b5e7[_0xcab3('0x4e')][_0xcab3('0x4f')][_0xcab3('0x3a')]()]&&(_0xc943cf[_0x58b5e7['idField']]=_0x25b463[_0x58b5e7[_0xcab3('0x4e')][_0xcab3('0x4f')]['toLowerCase']()]['toString']());}});}return _0xc943cf;}function getConnection(_0x3c7aad){var _0x5b00ec=_0x3c7aad['password'][_0xcab3('0x50')](_0x3c7aad[_0xcab3('0x51')]);var _0x357803=new jsforce[(_0xcab3('0x52'))]({'oauth2':{'loginUrl':_0x3c7aad['remoteUri']||_0xcab3('0x53'),'clientId':_0x3c7aad[_0xcab3('0x54')],'clientSecret':_0x3c7aad[_0xcab3('0x55')]}});return _0x357803[_0xcab3('0x56')](_0x3c7aad[_0xcab3('0x57')],_0x5b00ec)[_0xcab3('0x23')](function(){logger[_0xcab3('0x1d')](_0xcab3('0x58'));return _0x357803;});}exports['queue']=function(_0x105b1c,_0x5e498b,_0x435bfb,_0x19027e,_0xc790fd,_0x14cc15){var _0x5aefb9,_0x209374,_0x1b5c35,_0x3c6c38;_0x14cc15[_0xcab3('0x59')]=intUtil[_0xcab3('0x5a')](_0x14cc15[_0xcab3('0x59')]);_0x14cc15['remoteUri']=intUtil[_0xcab3('0x5a')](_0x14cc15[_0xcab3('0x5b')]);if(_0xc790fd&&_0xc790fd['monitor_format']){logger['info']('[QUEUE]',_0xcab3('0x5c'));_0x5e498b[_0xcab3('0x5d')]=util['format'](_0xcab3('0x5e'),_0x14cc15[_0xcab3('0x59')],_0x5e498b[_0xcab3('0x5f')],md5(_0x5e498b[_0xcab3('0x5f')]));}else{_0x5e498b[_0xcab3('0x5d')]='';}return getConnection(_0x14cc15)[_0xcab3('0x23')](function(_0x533a30){_0x3c6c38=_0x533a30;return getUser(_0x14cc15,_0x19027e[_0xcab3('0x60')],_0x3c6c38);})[_0xcab3('0x23')](function(_0xc0abe3){_0x5aefb9=_0xc0abe3;return getEndUser(_0x14cc15,_0x435bfb,_0x5e498b[_0xcab3('0x61')],_0x5e498b[_0xcab3('0x62')],_0x3c6c38);})['then'](function(_0x364f87){_0x209374=_0x364f87;return getTicket(_0x14cc15,_0x5aefb9,_0x209374,_0x435bfb,_0x5e498b,_0x435bfb['Fields'],_0x3c6c38,_0xcab3('0x63'));})[_0xcab3('0x23')](function(_0x23ab9d){_0x1b5c35=_0x23ab9d;logger[_0xcab3('0x1d')](_0xcab3('0x64'),_0x1b5c35['id']);logger[_0xcab3('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1b5c35['id'],_0x19027e[_0xcab3('0x4f')],_0x14cc15[_0xcab3('0x39')]);switch(_0x14cc15[_0xcab3('0x39')]){case'integrationTab':emit(util[_0xcab3('0x41')]('user:%s',_0x19027e[_0xcab3('0x4f')]),_0xcab3('0x65'),{'recordId':_0x1b5c35['id']});break;case _0xcab3('0x66'):emit(util['format'](_0xcab3('0x67'),_0x19027e['name']),'trigger:browser:url',{'uri':util[_0xcab3('0x41')](_0xcab3('0x68'),_0x3c6c38[_0xcab3('0x69')],_0x1b5c35['id'])});break;default:logger[_0xcab3('0x6a')](_0xcab3('0x6b'));}})[_0xcab3('0x6c')](function(_0x39fe4f){logger['error']('[QUEUE]',_0x39fe4f);});};exports[_0xcab3('0x6d')]=function(_0x341f44,_0x58fb1e,_0x41e7b5,_0x5c44e5,_0x5acd42,_0x5a4b53,_0x5209eb){var _0x3bd845,_0x2ca527,_0x40d9ca,_0x55efe3;_0x5a4b53[_0xcab3('0x59')]=intUtil[_0xcab3('0x5a')](_0x5a4b53[_0xcab3('0x59')]);_0x5a4b53[_0xcab3('0x5b')]=intUtil[_0xcab3('0x5a')](_0x5a4b53[_0xcab3('0x5b')]);if(_0x5209eb&&_0x5209eb[_0xcab3('0x6e')]&&_0x5209eb[_0xcab3('0x6e')]!==_0xcab3('0x6f')){logger[_0xcab3('0x1d')](_0xcab3('0x70'),_0xcab3('0x5c'));_0x58fb1e[_0xcab3('0x5d')]=util[_0xcab3('0x41')](_0xcab3('0x5e'),_0x5a4b53[_0xcab3('0x59')],_0x58fb1e[_0xcab3('0x5f')],md5(_0x58fb1e[_0xcab3('0x5f')]));}return getConnection(_0x5a4b53)[_0xcab3('0x23')](function(_0x288314){_0x55efe3=_0x288314;return getUser(_0x5a4b53,_0x5c44e5[_0xcab3('0x60')],_0x55efe3);})[_0xcab3('0x23')](function(_0x2544d1){_0x3bd845=_0x2544d1;return getEndUser(_0x5a4b53,_0x41e7b5,_0x58fb1e['destcalleridname'],_0x58fb1e['destcalleridnum'],_0x55efe3);})[_0xcab3('0x23')](function(_0x36cd58){_0x2ca527=_0x36cd58;return getTicket(_0x5a4b53,_0x3bd845,_0x2ca527,_0x41e7b5,_0x58fb1e,_0x41e7b5[_0xcab3('0x71')],_0x55efe3,_0xcab3('0x6d'));})['then'](function(_0xfc7678){_0x40d9ca=_0xfc7678;logger[_0xcab3('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x40d9ca['id']);logger[_0xcab3('0x1d')](_0xcab3('0x72'),_0x40d9ca['id'],_0x5c44e5[_0xcab3('0x4f')],_0x5a4b53[_0xcab3('0x39')]);switch(_0x5a4b53[_0xcab3('0x39')]){case _0xcab3('0x73'):emit(util[_0xcab3('0x41')](_0xcab3('0x67'),_0x5c44e5[_0xcab3('0x4f')]),_0xcab3('0x65'),{'recordId':_0x40d9ca['id']});break;case _0xcab3('0x66'):emit(util[_0xcab3('0x41')]('user:%s',_0x5c44e5[_0xcab3('0x4f')]),_0xcab3('0x74'),{'uri':util['format'](_0xcab3('0x68'),_0x55efe3[_0xcab3('0x69')],_0x40d9ca['id'])});break;default:logger[_0xcab3('0x6a')](_0xcab3('0x70'),_0xcab3('0x75'));}})[_0xcab3('0x6c')](function(_0x1f0f1c){logger[_0xcab3('0x6a')](_0xcab3('0x70'),_0x1f0f1c);});};exports[_0xcab3('0x76')]=function(_0x12aeb9,_0x39811f,_0x3ab6e8,_0x155ac1,_0x5d48bf,_0x1ce396){var _0x1e656e,_0x37b2a0,_0x122e85,_0x27c428;_0x1ce396[_0xcab3('0x59')]=intUtil[_0xcab3('0x5a')](_0x1ce396[_0xcab3('0x59')]);_0x1ce396[_0xcab3('0x5b')]=intUtil['stripTrailingSlash'](_0x1ce396[_0xcab3('0x5b')]);if(_0x5d48bf&&_0x5d48bf[_0xcab3('0x77')]){logger[_0xcab3('0x1d')]('['+_0x39811f[_0xcab3('0x78')]['toUpperCase']()+']',_0xcab3('0x5c'));_0x39811f[_0xcab3('0x5d')]=util[_0xcab3('0x41')](_0xcab3('0x5e'),_0x1ce396['serverUrl'],_0x39811f['uniqueid'],md5(_0x39811f['uniqueid']));}else{_0x39811f[_0xcab3('0x5d')]='';}return getConnection(_0x1ce396)[_0xcab3('0x23')](function(_0x9f0051){_0x27c428=_0x9f0051;if(!_[_0xcab3('0x20')](_0x155ac1)){return getUser(_0x1ce396,_0x155ac1['name'],_0x27c428);}else{return getUser(_0x1ce396,null,_0x27c428);}})[_0xcab3('0x23')](function(_0x34affe){_0x1e656e=_0x34affe;return getEndUser(_0x1ce396,_0x3ab6e8,_0x39811f[_0xcab3('0x61')],_0x39811f['calleridnum'],_0x27c428);})[_0xcab3('0x23')](function(_0x1f056b){_0x37b2a0=_0x1f056b;return getTicket(_0x1ce396,_0x1e656e,_0x37b2a0,_0x3ab6e8,_0x39811f,_0x3ab6e8[_0xcab3('0x71')],_0x27c428);})['then'](function(_0x175824){_0x122e85=_0x175824;logger['info']('['+_0x39811f[_0xcab3('0x78')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x122e85['id']);logger[_0xcab3('0x1d')]('['+_0x39811f[_0xcab3('0x78')][_0xcab3('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x1ce396['type']);})[_0xcab3('0x6c')](function(_0x448d15){logger[_0xcab3('0x6a')]('['+_0x39811f['lastevent'][_0xcab3('0x79')]()+']',_0x448d15);});}; \ No newline at end of file +var _0x279d=['account','WhatId','Case','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Name','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','additionalSearchAccount','Account','Lead','contact','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','trigger:salesforce:display','instanceUrl','[OUTBOUND]','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId'];(function(_0x5a3a81,_0x5e862f){var _0x59f7fa=function(_0x445a70){while(--_0x445a70){_0x5a3a81['push'](_0x5a3a81['shift']());}};_0x59f7fa(++_0x5e862f);}(_0x279d,0x162));var _0xd279=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x279d[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xd279('0x0'));var rp=require(_0xd279('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xd279('0x2'));var jsforce=require(_0xd279('0x3'));var util=require(_0xd279('0x4'));var Redis=require(_0xd279('0x5'));var intUtil=require(_0xd279('0x6'));var config=require(_0xd279('0x7'));var logger=require(_0xd279('0x8'))('salesforce');config['redis']=_[_0xd279('0x9')](config[_0xd279('0xa')],{'host':_0xd279('0xb'),'port':0x18eb});var io=require(_0xd279('0xc'))(new Redis(config[_0xd279('0xa')]));function emit(_0x255c56,_0x595511,_0x10c3b9){io['to'](_0x255c56)[_0xd279('0xd')](_0x595511,_0x10c3b9);}function getTicket(_0x30def7,_0xcf86f7,_0x309c7a,_0x4f3072,_0x32a491,_0x2bb4a7,_0x32c474,_0x628612){var _0x5c75ef=Object[_0xd279('0xe')]({},{'OwnerId':_0xcf86f7['id'],'Subject':intUtil[_0xd279('0xf')](_0x4f3072['Subjects'],_0x32a491,'\x20'),'Description':intUtil[_0xd279('0xf')](_0x4f3072['Descriptions'],_0x32a491,'\x0a')},getCustomFields(_0x2bb4a7,_0x32a491));if(_0x309c7a){if(_0x4f3072[_0xd279('0x10')]===_0xd279('0x11')){_0x5c75ef[_0xd279('0x12')]=moment[_0xd279('0x13')]();_0x5c75ef['IsReminderSet']=![];_0x5c75ef[_0xd279('0x14')]=![];if(_0x309c7a[_0xd279('0x15')]==='contact'||_0x309c7a[_0xd279('0x15')]===_0xd279('0x16')){_0x5c75ef[_0xd279('0x17')]=_0x309c7a['id'];}else if(_0x309c7a[_0xd279('0x15')]===_0xd279('0x18')){_0x5c75ef[_0xd279('0x19')]=_0x309c7a['id'];}}else if(_0x4f3072['ticketType']===_0xd279('0x1a')){if(_0x309c7a[_0xd279('0x15')]==='contact'){_0x5c75ef['ContactId']=_0x309c7a['id'];}else if(_0x309c7a[_0xd279('0x15')]===_0xd279('0x18')){_0x5c75ef[_0xd279('0x1b')]=_0x309c7a['id'];}else if(_0x309c7a['endUserType']===_0xd279('0x16')&&_0x4f3072['leadId']){_0x5c75ef[_0x4f3072['leadId']]=_0x309c7a['id'];}else{logger[_0xd279('0x1c')](_0xd279('0x1d'));}}}return _0x32c474[_0xd279('0x1e')](_0x4f3072[_0xd279('0x10')])[_0xd279('0x1f')](_0x5c75ef);}function getUser(_0x5e6d82,_0x110217,_0xff8477){if(!_[_0xd279('0x20')](_0x110217)&&intUtil[_0xd279('0x21')](_0x110217)){var _0x2769d6={'Email':_0x110217};var _0x121022={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xff8477[_0xd279('0x1e')](_0xd279('0x22'))[_0xd279('0x23')](_0x2769d6,_0x121022)[_0xd279('0x24')]()[_0xd279('0x25')](function(_0x5eb148){if(_0x5eb148[_0xd279('0x26')]){var _0x1383e1=_[_0xd279('0x23')](_0x5eb148,function(_0x36a267){return _0x36a267[_0xd279('0x27')]===_0x110217;});if(_0x1383e1){logger[_0xd279('0x1c')]('Agent\x20%s\x20found.',_0x110217);return BPromise['resolve']({'id':_0x1383e1['Id'],'name':_0x1383e1[_0xd279('0x28')]});}}else{logger[_0xd279('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x110217);return _0xff8477[_0xd279('0x29')]()[_0xd279('0x25')](function(_0x3093f0){return BPromise['resolve']({'id':_0x3093f0[_0xd279('0x2a')],'name':_0x3093f0[_0xd279('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x110217);return _0xff8477[_0xd279('0x29')]()['then'](function(_0x49aade){return BPromise['resolve']({'id':_0x49aade[_0xd279('0x2a')],'name':_0x49aade[_0xd279('0x2b')]});});}}function getEndUser(_0x259e6e,_0x306139,_0x1148f1,_0x18fc64,_0x61295c){var _0x432bb0={'$or':{'Phone':_0x18fc64}};var _0x114e9f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd279('0x2c')]()[_0xd279('0x25')](function(){logger[_0xd279('0x1c')](_0xd279('0x2d'),_0x18fc64,_0x306139[_0xd279('0x2e')]);switch(_0x306139[_0xd279('0x2e')]){case _0xd279('0x2f'):var _0xeeb8e5=_[_0xd279('0x30')](_0x432bb0);if(_0x306139[_0xd279('0x31')]){var _0x27c702={};_0x27c702[_0x306139[_0xd279('0x31')]]=_0x18fc64;_[_0xd279('0x32')](_0xeeb8e5[_0xd279('0x33')],_0x27c702);}return _0x61295c[_0xd279('0x1e')](_0xd279('0x34'))[_0xd279('0x23')](_0xeeb8e5,_0x114e9f)['execute']()['then'](function(_0xbb8627){if(_0xbb8627&&_0xbb8627[_0xd279('0x26')]){return _0xbb8627;}else{var _0x17e04d=_[_0xd279('0x30')](_0x432bb0);if(_0x306139['additionalSearchLead']){var _0xdd6beb={};_0xdd6beb[_0x306139[_0xd279('0x35')]]=_0x18fc64;_[_0xd279('0x32')](_0x17e04d['$or'],_0xdd6beb);}return _0x61295c[_0xd279('0x1e')]('Lead')[_0xd279('0x23')](_0x17e04d,_0x114e9f);}});case'account_contact_lead':var _0x31a07e=_['cloneDeep'](_0x432bb0);if(_0x306139[_0xd279('0x36')]){var _0x27c702={};_0x27c702[_0x306139['additionalSearchAccount']]=_0x18fc64;_[_0xd279('0x32')](_0x31a07e[_0xd279('0x33')],_0x27c702);}return _0x61295c[_0xd279('0x1e')](_0xd279('0x37'))[_0xd279('0x23')](_0x31a07e,_0x114e9f)[_0xd279('0x24')]()[_0xd279('0x25')](function(_0x1e5b82){if(_0x1e5b82&&_0x1e5b82['length']){return _0x1e5b82;}else{var _0x19d1eb=_[_0xd279('0x30')](_0x432bb0);if(_0x306139[_0xd279('0x31')]){var _0x14d69e={};_0x14d69e[_0x306139[_0xd279('0x31')]]=_0x18fc64;_[_0xd279('0x32')](_0x19d1eb[_0xd279('0x33')],_0x14d69e);}return _0x61295c[_0xd279('0x1e')](_0xd279('0x34'))['find'](_0x19d1eb,_0x114e9f)[_0xd279('0x25')](function(_0x400939){if(_0x400939&&_0x400939[_0xd279('0x26')]){return _0x400939;}else{var _0x40ac69=_[_0xd279('0x30')](_0x432bb0);if(_0x306139[_0xd279('0x35')]){var _0x108ea7={};_0x108ea7[_0x306139[_0xd279('0x35')]]=_0x18fc64;_[_0xd279('0x32')](_0x40ac69[_0xd279('0x33')],_0x108ea7);}return _0x61295c[_0xd279('0x1e')](_0xd279('0x38'))[_0xd279('0x23')](_0x40ac69,_0x114e9f);}});}});case _0xd279('0x39'):var _0xeeb8e5=_[_0xd279('0x30')](_0x432bb0);if(_0x306139[_0xd279('0x31')]){var _0x27c702={};_0x27c702[_0x306139[_0xd279('0x31')]]=_0x18fc64;_[_0xd279('0x32')](_0xeeb8e5[_0xd279('0x33')],_0x27c702);}return _0x61295c['sobject']('Contact')[_0xd279('0x23')](_0xeeb8e5,_0x114e9f)['execute']();case _0xd279('0x16'):var _0x4e8c4c=_[_0xd279('0x30')](_0x432bb0);if(_0x306139[_0xd279('0x35')]){var _0x27c702={};_0x27c702[_0x306139[_0xd279('0x35')]]=_0x18fc64;_[_0xd279('0x32')](_0x4e8c4c[_0xd279('0x33')],_0x27c702);}return _0x61295c[_0xd279('0x1e')]('Lead')[_0xd279('0x23')](_0x4e8c4c,_0x114e9f);case _0xd279('0x18'):var _0x31a07e=_['cloneDeep'](_0x432bb0);if(_0x306139['additionalSearchAccount']){var _0x27c702={};_0x27c702[_0x306139[_0xd279('0x36')]]=_0x18fc64;_[_0xd279('0x32')](_0x31a07e[_0xd279('0x33')],_0x27c702);}return _0x61295c[_0xd279('0x1e')](_0xd279('0x37'))['find'](_0x31a07e,_0x114e9f);default:return null;}})['then'](function(_0xc9742c){if(_0xc9742c&&_0xc9742c[_0xd279('0x26')]){var _0x56dd7e=_[_0xd279('0x3a')](_0xc9742c);if(_0x56dd7e){return BPromise[_0xd279('0x2c')]({'id':_0x56dd7e['Id'],'name':_0x56dd7e[_0xd279('0x28')],'phone':_0x56dd7e[_0xd279('0x3b')],'endUserType':_0x56dd7e[_0xd279('0x3c')][_0xd279('0x3d')][_0xd279('0x3e')]()});}}})[_0xd279('0x25')](function(_0x4d0d8b){if(_0x4d0d8b){logger[_0xd279('0x1c')](_0xd279('0x3f'),_0x4d0d8b[_0xd279('0x15')],_0x18fc64);return BPromise[_0xd279('0x2c')](_0x4d0d8b);}else{logger['info'](_0xd279('0x40'),_0x18fc64);var _0x329a16={'Phone':_0x18fc64};if(_0x306139[_0xd279('0x41')]){if(_0x306139[_0xd279('0x41')]===_0xd279('0x39')){logger[_0xd279('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x18fc64,_0x306139[_0xd279('0x41')]);_0x329a16[_0xd279('0x42')]=_0x1148f1!==_0xd279('0x43')?_0x1148f1:util[_0xd279('0x44')](_0xd279('0x45'),_0x18fc64);}else if(_0x306139[_0xd279('0x41')]===_0xd279('0x16')){logger[_0xd279('0x1c')](_0xd279('0x46'),_0x18fc64,_0x306139[_0xd279('0x41')]);_0x329a16['LastName']=_0x1148f1!==_0xd279('0x43')?_0x1148f1:util[_0xd279('0x44')](_0xd279('0x45'),_0x18fc64);_0x329a16[_0xd279('0x47')]=_0xd279('0x48');}else if(_0x306139[_0xd279('0x41')]===_0xd279('0x18')){logger[_0xd279('0x1c')](_0xd279('0x46'),_0x18fc64,_0x306139[_0xd279('0x41')]);_0x329a16[_0xd279('0x28')]=_0x1148f1!==_0xd279('0x43')?_0x1148f1:util[_0xd279('0x44')](_0xd279('0x45'),_0x18fc64);}else{return null;}}return _0x61295c[_0xd279('0x1e')](_[_0xd279('0x49')](_0x306139[_0xd279('0x41')]))['create'](_0x329a16)[_0xd279('0x25')](function(_0x4121ac){return BPromise[_0xd279('0x2c')]({'id':_0x4121ac['id'],'endUserType':_0x306139['moduleCreate']});});}});}function getCustomFields(_0x5696a1,_0x51e798){var _0x25d906={};if(_0x5696a1['length']>0x0){_[_0xd279('0x4a')](_0x5696a1,function(_0x343e06){if(_[_0xd279('0x4b')]([_0xd279('0x4c'),_0xd279('0x4d')],_0x343e06['type'])&&_0x343e06[_0xd279('0x4e')]){_0x25d906[_0x343e06[_0xd279('0x4e')]]=_0x343e06[_0xd279('0x4f')][_0xd279('0x50')]();}else if(_0x343e06['type']===_0xd279('0x51')&&_0x343e06['variableName']&&_0x343e06['idField']){_0x51e798[_0x343e06[_0xd279('0x52')]]&&(_0x25d906[_0x343e06[_0xd279('0x4e')]]=_0x51e798[_0x343e06['variableName']][_0xd279('0x50')]());}else if(_0x343e06[_0xd279('0x3d')]===_0xd279('0x53')&&_0x343e06[_0xd279('0x54')]&&_0x343e06[_0xd279('0x54')][_0xd279('0x55')]&&_0x343e06['idField']){_0x51e798[_0x343e06['Variable']['name'][_0xd279('0x3e')]()]&&(_0x25d906[_0x343e06['idField']]=_0x51e798[_0x343e06[_0xd279('0x54')]['name']['toLowerCase']()]['toString']());}});}return _0x25d906;}function getConnection(_0x59679c){var _0x5100c3=_0x59679c[_0xd279('0x56')][_0xd279('0x57')](_0x59679c[_0xd279('0x58')]);var _0x21aaa4=new jsforce[(_0xd279('0x59'))]({'oauth2':{'loginUrl':_0x59679c[_0xd279('0x5a')]||_0xd279('0x5b'),'clientId':_0x59679c['clientId'],'clientSecret':_0x59679c['clientSecret']}});return _0x21aaa4[_0xd279('0x5c')](_0x59679c[_0xd279('0x5d')],_0x5100c3)['then'](function(){logger['info'](_0xd279('0x5e'));return _0x21aaa4;});}exports['queue']=function(_0x19f486,_0xb4deaa,_0x4da2c4,_0x195ed9,_0x32a09b,_0x184b97){var _0x1b3a8b,_0x1f85f7,_0xb7e27e,_0x22caf4;_0x184b97[_0xd279('0x5f')]=intUtil[_0xd279('0x60')](_0x184b97[_0xd279('0x5f')]);_0x184b97['remoteUri']=intUtil[_0xd279('0x60')](_0x184b97[_0xd279('0x5a')]);if(_0x32a09b&&_0x32a09b['monitor_format']){logger[_0xd279('0x1c')]('[QUEUE]',_0xd279('0x61'));_0xb4deaa[_0xd279('0x62')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x184b97[_0xd279('0x5f')],_0xb4deaa[_0xd279('0x63')],md5(_0xb4deaa[_0xd279('0x63')]));}else{_0xb4deaa[_0xd279('0x62')]='';}return getConnection(_0x184b97)[_0xd279('0x25')](function(_0x544bb5){_0x22caf4=_0x544bb5;return getUser(_0x184b97,_0x195ed9[_0xd279('0x64')],_0x22caf4);})[_0xd279('0x25')](function(_0x2e3441){_0x1b3a8b=_0x2e3441;return getEndUser(_0x184b97,_0x4da2c4,_0xb4deaa[_0xd279('0x65')],_0xb4deaa[_0xd279('0x66')],_0x22caf4);})[_0xd279('0x25')](function(_0x5e127d){_0x1f85f7=_0x5e127d;return getTicket(_0x184b97,_0x1b3a8b,_0x1f85f7,_0x4da2c4,_0xb4deaa,_0x4da2c4[_0xd279('0x67')],_0x22caf4,_0xd279('0x68'));})[_0xd279('0x25')](function(_0x4ba3cd){_0xb7e27e=_0x4ba3cd;logger[_0xd279('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0xb7e27e['id']);logger['info'](_0xd279('0x69'),_0xb7e27e['id'],_0x195ed9[_0xd279('0x55')],_0x184b97[_0xd279('0x3d')]);switch(_0x184b97[_0xd279('0x3d')]){case _0xd279('0x6a'):emit(util[_0xd279('0x44')](_0xd279('0x6b'),_0x195ed9['name']),'trigger:salesforce:display',{'recordId':_0xb7e27e['id']});break;case'newTab':emit(util[_0xd279('0x44')](_0xd279('0x6b'),_0x195ed9[_0xd279('0x55')]),_0xd279('0x6c'),{'uri':util['format'](_0xd279('0x6d'),_0x22caf4['instanceUrl'],_0xb7e27e['id'])});break;default:logger[_0xd279('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5695f8){logger['error'](_0xd279('0x6f'),_0x5695f8);});};exports[_0xd279('0x70')]=function(_0x39fb82,_0x43cbcf,_0x1b6ab3,_0x4a9f04,_0x23fdc7,_0x1296f1,_0x373e23){var _0x4ee704,_0xc324fc,_0x22cc84,_0x1b574d;_0x1296f1[_0xd279('0x5f')]=intUtil['stripTrailingSlash'](_0x1296f1[_0xd279('0x5f')]);_0x1296f1[_0xd279('0x5a')]=intUtil[_0xd279('0x60')](_0x1296f1[_0xd279('0x5a')]);if(_0x373e23&&_0x373e23[_0xd279('0x71')]&&_0x373e23[_0xd279('0x71')]!==_0xd279('0x72')){logger[_0xd279('0x1c')]('[OUTBOUND]',_0xd279('0x61'));_0x43cbcf[_0xd279('0x62')]=util[_0xd279('0x44')](_0xd279('0x73'),_0x1296f1['serverUrl'],_0x43cbcf[_0xd279('0x63')],md5(_0x43cbcf[_0xd279('0x63')]));}return getConnection(_0x1296f1)[_0xd279('0x25')](function(_0x223f04){_0x1b574d=_0x223f04;return getUser(_0x1296f1,_0x4a9f04[_0xd279('0x64')],_0x1b574d);})[_0xd279('0x25')](function(_0x25cfb5){_0x4ee704=_0x25cfb5;return getEndUser(_0x1296f1,_0x1b6ab3,_0x43cbcf[_0xd279('0x74')],_0x43cbcf[_0xd279('0x75')],_0x1b574d);})[_0xd279('0x25')](function(_0x4d7812){_0xc324fc=_0x4d7812;return getTicket(_0x1296f1,_0x4ee704,_0xc324fc,_0x1b6ab3,_0x43cbcf,_0x1b6ab3[_0xd279('0x67')],_0x1b574d,_0xd279('0x70'));})['then'](function(_0x427fc0){_0x22cc84=_0x427fc0;logger[_0xd279('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x22cc84['id']);logger[_0xd279('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x22cc84['id'],_0x4a9f04['name'],_0x1296f1[_0xd279('0x3d')]);switch(_0x1296f1[_0xd279('0x3d')]){case _0xd279('0x6a'):emit(util[_0xd279('0x44')](_0xd279('0x6b'),_0x4a9f04[_0xd279('0x55')]),_0xd279('0x76'),{'recordId':_0x22cc84['id']});break;case'newTab':emit(util['format'](_0xd279('0x6b'),_0x4a9f04[_0xd279('0x55')]),_0xd279('0x6c'),{'uri':util['format'](_0xd279('0x6d'),_0x1b574d[_0xd279('0x77')],_0x22cc84['id'])});break;default:logger[_0xd279('0x6e')](_0xd279('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd279('0x79')](function(_0x4ea3a6){logger[_0xd279('0x6e')](_0xd279('0x78'),_0x4ea3a6);});};exports['unmanaged']=function(_0x3340a8,_0x5d0314,_0x269628,_0x23d47d,_0x164ae9,_0x3c3c68){var _0x50c983,_0xafb910,_0x56592a,_0x5d4b07;_0x3c3c68[_0xd279('0x5f')]=intUtil[_0xd279('0x60')](_0x3c3c68[_0xd279('0x5f')]);_0x3c3c68[_0xd279('0x5a')]=intUtil[_0xd279('0x60')](_0x3c3c68['remoteUri']);if(_0x164ae9&&_0x164ae9['monitor_format']){logger[_0xd279('0x1c')]('['+_0x5d0314[_0xd279('0x7a')][_0xd279('0x7b')]()+']','Recording\x20is\x20enabled!');_0x5d0314[_0xd279('0x62')]=util[_0xd279('0x44')](_0xd279('0x73'),_0x3c3c68[_0xd279('0x5f')],_0x5d0314[_0xd279('0x63')],md5(_0x5d0314['uniqueid']));}else{_0x5d0314['recordingURL']='';}return getConnection(_0x3c3c68)[_0xd279('0x25')](function(_0x149c98){_0x5d4b07=_0x149c98;if(!_[_0xd279('0x20')](_0x23d47d)){return getUser(_0x3c3c68,_0x23d47d[_0xd279('0x55')],_0x5d4b07);}else{return getUser(_0x3c3c68,null,_0x5d4b07);}})['then'](function(_0x4e4722){_0x50c983=_0x4e4722;return getEndUser(_0x3c3c68,_0x269628,_0x5d0314['calleridname'],_0x5d0314[_0xd279('0x66')],_0x5d4b07);})[_0xd279('0x25')](function(_0x275594){_0xafb910=_0x275594;return getTicket(_0x3c3c68,_0x50c983,_0xafb910,_0x269628,_0x5d0314,_0x269628[_0xd279('0x67')],_0x5d4b07);})['then'](function(_0x5030f3){_0x56592a=_0x5030f3;logger['info']('['+_0x5d0314[_0xd279('0x7a')][_0xd279('0x7b')]()+_0xd279('0x7c'),_0x56592a['id']);logger[_0xd279('0x1c')]('['+_0x5d0314[_0xd279('0x7a')][_0xd279('0x7b')]()+_0xd279('0x7d'),_0x3c3c68['type']);})[_0xd279('0x79')](function(_0xa0cb3a){logger['error']('['+_0x5d0314[_0xd279('0x7a')][_0xd279('0x7b')]()+']',_0xa0cb3a);});}; \ 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 f99f318..d688a6b 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 _0x01f0=['variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketId','forEach','all','push','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','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','userEmail','adminEmail','],\x20createEndUser\x20input\x20crm','POST','System','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','picklist','type','nameField','content','toString','idField','customField','toLowerCase'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x01f0,0x109));var _0x001f=function(_0x39d9b3,_0x435774){_0x39d9b3=_0x39d9b3-0x0;var _0x32bfc7=_0x01f0[_0x39d9b3];return _0x32bfc7;};'use strict';var _=require(_0x001f('0x0'));var Promise=require(_0x001f('0x1'));var rp=require(_0x001f('0x2'));var util=require('util');var md5=require(_0x001f('0x3'));var Redis=require(_0x001f('0x4'));var intUtil=require(_0x001f('0x5'));var config=require(_0x001f('0x6'));var logger=require(_0x001f('0x7'))(_0x001f('0x8'));config[_0x001f('0x9')]=_['defaults'](config[_0x001f('0x9')],{'host':_0x001f('0xa'),'port':0x18eb});var io=require(_0x001f('0xb'))(new Redis(config[_0x001f('0x9')]));function getAdminUser(_0x1e2859,_0x32aef0,_0x13ebc5,_0x4a2b90,_0xc44bc5,_0x2cb0ed){return new Promise(function(_0x548697,_0x11caf5){var _0x1d9e9c={'method':_0x001f('0xc'),'uri':_0x4a2b90+_0x001f('0xd')+'&'+_0xc44bc5+'&'+_0x2cb0ed,'auth':_0x32aef0,'json':!![]};return rp(_0x1d9e9c)[_0x001f('0xe')](function(_0x23cc15){if(_0x23cc15[_0x001f('0xf')][_0x001f('0x10')]>0x0){_0x13ebc5[_0x001f('0x11')]=_0x23cc15[_0x001f('0xf')][0x0][_0x001f('0x12')];}logger[_0x001f('0x13')]('['+[_0x1e2859[_0x001f('0x14')]()]+_0x001f('0x15'),_0x13ebc5);_0x548697(_0x13ebc5);})[_0x001f('0x16')](function(_0x4c3e39){logger[_0x001f('0x17')]('['+[_0x1e2859[_0x001f('0x14')]()]+']',_0x4c3e39[_0x001f('0x18')]);_0x11caf5(_0x4c3e39[_0x001f('0x18')]);});});}function getUser(_0x3ac46a,_0x497c51,_0x6efb60,_0x49d25d,_0x3e3848){return function(_0x46471c){logger[_0x001f('0x13')]('['+[_0x3ac46a[_0x001f('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x46471c);return new Promise(function(_0x3b5b9e,_0x504113){if(intUtil[_0x001f('0x19')](_0x46471c['userEmail'])){var _0x53d5a4={'method':'GET','uri':_0x6efb60+_0x001f('0x1a')+_0x46471c['userEmail']+'&'+_0x49d25d+'&'+_0x3e3848,'auth':_0x497c51,'json':!![]};logger['info']('['+[_0x3ac46a[_0x001f('0x14')]()]+_0x001f('0x1b'),_0x53d5a4);return rp(_0x53d5a4)[_0x001f('0xe')](function(_0x25a678){logger[_0x001f('0x13')]('['+[_0x3ac46a[_0x001f('0x14')]()]+_0x001f('0x1c'),_0x25a678);if(_0x25a678['result'][_0x001f('0x10')]>0x0&&String(_0x25a678[_0x001f('0xf')][0x0]['active'])==='true'){_0x46471c[_0x001f('0x1d')]=_0x25a678['result'][0x0][_0x001f('0x12')];}else{_0x46471c[_0x001f('0x1d')]=_0x46471c[_0x001f('0x11')];_0x46471c[_0x001f('0x1e')]=_0x46471c[_0x001f('0x1f')];}logger[_0x001f('0x13')]('['+[_0x3ac46a[_0x001f('0x14')]()]+'],\x20getUser\x20crm',_0x46471c);_0x3b5b9e(_0x46471c);})[_0x001f('0x16')](function(_0xa4c657){logger[_0x001f('0x17')]('['+[_0x3ac46a[_0x001f('0x14')]()]+']',_0xa4c657[_0x001f('0x18')]);_0x504113(_0xa4c657[_0x001f('0x18')]);});}else{logger[_0x001f('0x13')]('['+[_0x3ac46a['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x46471c[_0x001f('0x1d')]=_0x46471c[_0x001f('0x11')];_0x46471c[_0x001f('0x1e')]=_0x46471c[_0x001f('0x1f')];_0x3b5b9e(_0x46471c);}});};}function createEndUser(_0x548a07,_0x4c8b8d,_0x395a1b,_0x5b80c4,_0x5ad07e){logger[_0x001f('0x13')]('['+[_0x548a07[_0x001f('0x14')]()]+_0x001f('0x20'),_0x395a1b);return new Promise(function(_0x43633e,_0x3ea895){var _0x41f836={'method':_0x001f('0x21'),'uri':_0x5b80c4+'sys_user?'+_0x5ad07e,'body':{'user_name':_0x395a1b['endUserNumber'],'roles':'user','first_name':_0x395a1b['endUserNumber'],'active':'true','date_format':_0x001f('0x22'),'phone':_0x395a1b[_0x001f('0x23')]},'auth':_0x4c8b8d,'json':!![]};return rp(_0x41f836)['then'](function(_0x466c1b){logger[_0x001f('0x13')]('['+[_0x548a07[_0x001f('0x14')]()]+'],\x20EndUser\x20schema',_0x466c1b['result']);_0x395a1b['endUserId']=_0x466c1b['result'][_0x001f('0x12')];_0x43633e(_0x395a1b);})[_0x001f('0x16')](function(_0x5f6b2d){logger['error']('['+[_0x548a07['toUpperCase']()]+']',_0x5f6b2d[_0x001f('0x18')]);_0x3ea895(_0x5f6b2d[_0x001f('0x18')]);});});}function getEndUser(_0x1aeb72,_0x5e4636,_0x5e9d26,_0x453dbc,_0x387865){return function(_0x3197dc){logger[_0x001f('0x13')]('['+[_0x1aeb72[_0x001f('0x14')]()]+_0x001f('0x24'),_0x3197dc);return new Promise(function(_0x2f7d34,_0x180f23){var _0x350b7a={'method':_0x001f('0xc'),'uri':_0x5e9d26+_0x001f('0x25')+_0x3197dc[_0x001f('0x23')]+'&'+_0x453dbc+'&'+_0x387865,'auth':_0x5e4636,'json':!![]};return rp(_0x350b7a)[_0x001f('0xe')](function(_0xbb59fc){if(_0xbb59fc[_0x001f('0xf')][_0x001f('0x10')]>0x0){_0x3197dc[_0x001f('0x26')]=_0xbb59fc[_0x001f('0xf')][0x0][_0x001f('0x12')];logger[_0x001f('0x13')]('['+[_0x1aeb72[_0x001f('0x14')]()]+_0x001f('0x27'),_0x3197dc);_0x2f7d34(_0x3197dc);}else{return createEndUser(_0x1aeb72,_0x5e4636,_0x3197dc,_0x5e9d26,_0x453dbc)[_0x001f('0xe')](function(_0x2dd6be){logger[_0x001f('0x13')]('['+[_0x1aeb72['toUpperCase']()]+_0x001f('0x28'),_0x2dd6be);_0x2f7d34(_0x2dd6be);});}})[_0x001f('0x16')](function(_0x399791){logger[_0x001f('0x17')]('['+[_0x1aeb72[_0x001f('0x14')]()]+']',_0x399791['message']);_0x180f23(_0x399791[_0x001f('0x18')]);});});};}function getCustomFields(_0x1e00c7,_0x4e20fc){var _0x13d323={};if(_0x1e00c7[_0x001f('0x10')]>0x0){_['forEach'](_0x1e00c7,function(_0x339a40){if(_[_0x001f('0x29')](['string',_0x001f('0x2a')],_0x339a40[_0x001f('0x2b')])&&_0x339a40['nameField']&&!_0x339a40['customField']){_0x13d323[_0x339a40[_0x001f('0x2c')]['toLowerCase']()]=_0x339a40[_0x001f('0x2d')][_0x001f('0x2e')]();}else if(_[_0x001f('0x29')](['string',_0x001f('0x2a')],_0x339a40[_0x001f('0x2b')])&&_0x339a40[_0x001f('0x2f')]&&_0x339a40[_0x001f('0x30')]){_0x13d323[_0x339a40[_0x001f('0x2f')][_0x001f('0x31')]()]=_0x339a40['content'][_0x001f('0x2e')]();}else if(_0x339a40['type']===_0x001f('0x32')&&_0x339a40['variableName']&&_0x339a40[_0x001f('0x2f')]&&_0x339a40[_0x001f('0x30')]){_0x13d323[_0x339a40[_0x001f('0x2f')][_0x001f('0x31')]()]=_0x4e20fc[_0x339a40['variableName']][_0x001f('0x2e')]();}else if(_0x339a40[_0x001f('0x2b')]===_0x001f('0x33')&&_0x339a40[_0x001f('0x34')]&&_0x339a40['Variable'][_0x001f('0x35')]&&_0x339a40[_0x001f('0x2f')]&&_0x339a40['customField']){_0x13d323[_0x339a40[_0x001f('0x2f')][_0x001f('0x31')]()]=_0x4e20fc[_0x339a40[_0x001f('0x34')][_0x001f('0x35')][_0x001f('0x31')]()]['toString']();}});}return _0x13d323;}function getTicket(_0x350e88,_0x42df13,_0x3b8df7,_0x2ae22f,_0xc58b5e,_0x445d0f){return function(_0x5e0188){logger[_0x001f('0x13')]('['+[_0x350e88['toUpperCase']()]+_0x001f('0x36'),_0x5e0188);return new Promise(function(_0x4b4cb6,_0x2f40d4){var _0x1b4b6e=_0x350e88[_0x001f('0x31')]()===_0x001f('0x37')?_0x5e0188[_0x001f('0x1d')]:_0x5e0188['endUserId'];var _0x245702={'method':_0x001f('0x21'),'uri':_0x3b8df7+_0x001f('0x38')+'?'+_0x445d0f,'body':Object['assign']({},{'active':_0x001f('0x39'),'caller_id':_0x1b4b6e,'assigned_to':_0x5e0188[_0x001f('0x1d')],'short_description':intUtil[_0x001f('0x3a')](_0x2ae22f[_0x001f('0x3b')],_0xc58b5e,'\x20'),'description':intUtil[_0x001f('0x3a')](_0x2ae22f[_0x001f('0x3c')],_0xc58b5e,'\x0a')},getCustomFields(_0x2ae22f[_0x001f('0x3d')],_0xc58b5e)),'auth':_0x42df13,'json':!![]};return rp(_0x245702)[_0x001f('0xe')](function(_0x4ef7c8){logger['info']('['+[_0x350e88[_0x001f('0x14')]()]+_0x001f('0x3e'),_0x4ef7c8[_0x001f('0xf')]);_0x5e0188['ticketId']=_0x4ef7c8[_0x001f('0xf')]['sys_id'];_0x5e0188[_0x001f('0x3f')]=_0x4ef7c8['result'][_0x001f('0x40')];logger[_0x001f('0x13')]('['+[_0x350e88[_0x001f('0x14')]()]+_0x001f('0x41'),_0x5e0188);_0x4b4cb6(_0x5e0188);})[_0x001f('0x16')](function(_0x382ad8){logger[_0x001f('0x17')]('['+[_0x350e88[_0x001f('0x14')]()]+']',_0x382ad8['message']);_0x2f40d4(_0x382ad8['message']);});});};}function createRemoteTag(_0xc8e078,_0x420c71,_0x33274e,_0x25702a){return new Promise(function(_0x36d9cf,_0x1a024a){var _0x53a07e={'method':_0x001f('0x21'),'uri':_0x33274e+_0x001f('0x42')+'?'+_0x25702a,'body':{'short_description':_0xc8e078,'global':!![],'active':!![],'name':_0xc8e078},'auth':_0x420c71,'json':!![]};return rp(_0x53a07e)[_0x001f('0xe')](function(_0x247506){var _0x1b0b6b=_0x247506[_0x001f('0xf')][_0x001f('0x12')];_0x36d9cf(_0x1b0b6b);});});}function getRemoteTag(_0x442403,_0x2deb06,_0x3857bc,_0xf42919,_0x6ce178){return new Promise(function(_0x430ede,_0x33f6ff){var _0x24c160={'method':'GET','uri':_0x3857bc+_0x001f('0x42')+'?sysparm_query=name%3D'+_0x442403+'&'+_0xf42919,'auth':_0x2deb06,'json':!![]};return rp(_0x24c160)[_0x001f('0xe')](function(_0x174de8){if(_0x174de8[_0x001f('0xf')][_0x001f('0x10')]>0x0){var _0x24840f=_0x174de8[_0x001f('0xf')][0x0][_0x001f('0x12')];_0x430ede(_0x24840f);}else{return createRemoteTag(_0x442403,_0x2deb06,_0x3857bc,_0xf42919)[_0x001f('0xe')](function(_0x3820e8){_0x430ede(_0x3820e8);});}});});}function assignTagToIncident(_0x4bff5d,_0x29abca,_0x98eb3e,_0x1633eb,_0xa10537){return new Promise(function(_0x372c70,_0x272b04){var _0x41d3ca={'method':_0x001f('0x21'),'uri':_0x98eb3e+_0x001f('0x43')+'?'+_0xa10537,'body':{'label':_0x4bff5d,'table':_0x001f('0x38'),'id_type':_0x001f('0x44'),'table_key':_0x1633eb[_0x001f('0x45')],'title':'Incident\x20-\x20'+_0x1633eb[_0x001f('0x3f')],'id_display':_0x1633eb[_0x001f('0x3f')]},'auth':_0x29abca,'json':!![]};return rp(_0x41d3ca)[_0x001f('0xe')](function(_0x1c4611){_0x372c70();})[_0x001f('0x16')](function(){_0x372c70();});});}function manageTags(_0xfce7f6,_0x462c93,_0x25c7da,_0x2fe779,_0x5839e4,_0x3d7d05,_0x2592fa){return new Promise(function(_0x404669,_0x4c48bb){var _0x1040a4=[];_0x462c93[_0x001f('0x46')](function(_0x252649){_0x1040a4['push'](getRemoteTag(_0x252649,_0x25c7da,_0x2fe779,_0x3d7d05,_0x2592fa));});return Promise[_0x001f('0x47')](_0x1040a4)[_0x001f('0xe')](function(_0x559585){if(_0x559585[_0x001f('0x10')]){logger[_0x001f('0x13')]('['+[_0xfce7f6['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x559585);var _0x282b1b=[];_0x559585['forEach'](function(_0x2f8a08){_0x282b1b[_0x001f('0x48')](assignTagToIncident(_0x2f8a08,_0x25c7da,_0x2fe779,_0x5839e4,_0x3d7d05));});return Promise[_0x001f('0x47')](_0x282b1b)[_0x001f('0xe')](function(){_0x404669();})[_0x001f('0x16')](function(){_0x404669();});}else{_0x404669();}});});}function getTags(_0x273b9e,_0xdc360,_0x526f14,_0x4bd189,_0x3f8cf6,_0x622239){return function(_0x145086){return new Promise(function(_0x929c46,_0x5d94b6){var _0xab7bfc=[];var _0x211c80=_0x4bd189[_0x001f('0x49')];if(_0x211c80&&_0x211c80[_0x001f('0x10')]>0x0){_0xab7bfc=_[_0x001f('0x4a')](_0x211c80,_0x001f('0x35'));}if(_0xab7bfc[_0x001f('0x10')]>0x0){return manageTags(_0x273b9e,_0xab7bfc,_0xdc360,_0x526f14,_0x145086,_0x3f8cf6,_0x622239)[_0x001f('0xe')](function(){_0x929c46(_0x145086);});}else{_0x929c46(_0x145086);}});};}function emit(_0x54ede4,_0x2db1a0,_0x35b79c){var _0x2ef71d=_0x001f('0x4b')+_0x001f('0x4c')+_0x001f('0x4d')+'%255EORDERBYDESCnumber';var _0x545e0d={'uri':_0x54ede4+_0x001f('0x4e')+_0x35b79c+_0x2ef71d};io['to'](util[_0x001f('0x4f')](_0x001f('0x50'),_0x2db1a0))[_0x001f('0x51')](_0x001f('0x52'),_0x545e0d);}exports['cs']=function(_0x16c38d,_0x545f82,_0x23fc7a,_0x4d4c05,_0x390b96,_0x510c8e,_0x2cf965,_0x44806a){var _0x181b5f={};var _0x1604a4={'user':_0x510c8e[_0x001f('0x53')],'pass':_0x510c8e[_0x001f('0x54')]};var _0x5ec2ef=_0x001f('0x55');var _0x275fd0=_0x001f('0x56');_0x510c8e['remoteUri']=intUtil[_0x001f('0x57')](_0x510c8e[_0x001f('0x58')]);_0x510c8e['serverUrl']=intUtil[_0x001f('0x57')](_0x510c8e[_0x001f('0x59')]);var _0x386b1e=util['format']('%s/api/now/table/',_0x510c8e[_0x001f('0x58')]);_0x181b5f[_0x001f('0x1e')]=!_['isNil'](_0x4d4c05)?_0x4d4c05[_0x001f('0x5a')]:null;_0x181b5f[_0x001f('0x1f')]=_0x510c8e['email'];_0x181b5f[_0x001f('0x23')]=_0x44806a[_0x001f('0x31')]()===_0x001f('0x37')?_0x545f82[_0x001f('0x5b')]:_0x545f82[_0x001f('0x5c')];_0x181b5f['callDirection']=_0x44806a===_0x001f('0x5d')||_0x44806a===_0x001f('0x5e')?_0x001f('0x5d'):'outbound';var _0x4aa6d8=util[_0x001f('0x4f')](_0x001f('0x5f'),_0x510c8e[_0x001f('0x59')],_0x545f82[_0x001f('0x60')],md5(_0x545f82['uniqueid']));if(_0x390b96&&_0x390b96[_0x001f('0x61')]){logger[_0x001f('0x13')]('[QUEUE]',_0x001f('0x62'));_0x545f82[_0x001f('0x63')]=_0x4aa6d8;}else if(_0x2cf965&&_0x2cf965['recordingFormat']&&_0x2cf965[_0x001f('0x64')]!==_0x001f('0x65')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x545f82['recordingURL']=_0x4aa6d8;}else{_0x545f82[_0x001f('0x63')]='';}return getAdminUser(_0x44806a,_0x1604a4,_0x181b5f,_0x386b1e,_0x275fd0,_0x5ec2ef)['then'](getUser(_0x44806a,_0x1604a4,_0x386b1e,_0x275fd0,_0x5ec2ef))[_0x001f('0xe')](getEndUser(_0x44806a,_0x1604a4,_0x386b1e,_0x275fd0,_0x5ec2ef))['then'](getTicket(_0x44806a,_0x1604a4,_0x386b1e,_0x23fc7a,_0x545f82,_0x275fd0))[_0x001f('0xe')](function(_0x36ed68){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x36ed68['ticketId']));logger[_0x001f('0x13')](util[_0x001f('0x4f')]('call\x20direction:\x20%s',_0x44806a));if(_0x44806a!==_0x001f('0x5e')){logger[_0x001f('0x13')]('['+[_0x44806a[_0x001f('0x14')]()]+']',_0x001f('0x66'));emit(_0x510c8e[_0x001f('0x58')],_0x4d4c05['name'],_0x36ed68[_0x001f('0x45')]);}})['catch'](function(_0x3375b6){logger['error']('['+[_0x44806a[_0x001f('0x14')]()]+_0x001f('0x67'),util[_0x001f('0x68')](_0x3375b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x09c8=['user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','incident','Incident','all','push','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','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','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','localhost','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','active','true','sys_id','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber'];(function(_0x32d797,_0x53c890){var _0x3eb3b6=function(_0x35e0a5){while(--_0x35e0a5){_0x32d797['push'](_0x32d797['shift']());}};_0x3eb3b6(++_0x53c890);}(_0x09c8,0x191));var _0x809c=function(_0x21bad0,_0x4798f9){_0x21bad0=_0x21bad0-0x0;var _0x2f2990=_0x09c8[_0x21bad0];return _0x2f2990;};'use strict';var _=require(_0x809c('0x0'));var Promise=require(_0x809c('0x1'));var rp=require(_0x809c('0x2'));var util=require(_0x809c('0x3'));var md5=require(_0x809c('0x4'));var Redis=require('ioredis');var intUtil=require(_0x809c('0x5'));var config=require(_0x809c('0x6'));var logger=require(_0x809c('0x7'))(_0x809c('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x809c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x809c('0xa')]));function getAdminUser(_0x1cea28,_0x2e9149,_0x3112e1,_0x5dfcb6,_0x3f6bf7,_0x209138){return new Promise(function(_0x306708,_0x15c49d){var _0x3e7c73={'method':_0x809c('0xb'),'uri':_0x5dfcb6+_0x809c('0xc')+'&'+_0x3f6bf7+'&'+_0x209138,'auth':_0x2e9149,'json':!![]};return rp(_0x3e7c73)['then'](function(_0x56b9a5){if(_0x56b9a5[_0x809c('0xd')][_0x809c('0xe')]>0x0){_0x3112e1[_0x809c('0xf')]=_0x56b9a5[_0x809c('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x1cea28['toUpperCase']()]+_0x809c('0x10'),_0x3112e1);_0x306708(_0x3112e1);})[_0x809c('0x11')](function(_0x368723){logger[_0x809c('0x12')]('['+[_0x1cea28[_0x809c('0x13')]()]+']',_0x368723[_0x809c('0x14')]);_0x15c49d(_0x368723[_0x809c('0x14')]);});});}function getUser(_0x537be7,_0x4d96ea,_0x2e97a5,_0x19cdc3,_0x56a6d6){return function(_0x2a7d35){logger[_0x809c('0x15')]('['+[_0x537be7[_0x809c('0x13')]()]+_0x809c('0x16'),_0x2a7d35);return new Promise(function(_0x58a5b2,_0x20da2a){if(intUtil[_0x809c('0x17')](_0x2a7d35[_0x809c('0x18')])){var _0x1b9398={'method':_0x809c('0xb'),'uri':_0x2e97a5+_0x809c('0x19')+_0x2a7d35['userEmail']+'&'+_0x19cdc3+'&'+_0x56a6d6,'auth':_0x4d96ea,'json':!![]};logger[_0x809c('0x15')]('['+[_0x537be7[_0x809c('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x1b9398);return rp(_0x1b9398)[_0x809c('0x1a')](function(_0x4bea43){logger['info']('['+[_0x537be7[_0x809c('0x13')]()]+_0x809c('0x1b'),_0x4bea43);if(_0x4bea43['result'][_0x809c('0xe')]>0x0&&String(_0x4bea43[_0x809c('0xd')][0x0][_0x809c('0x1c')])===_0x809c('0x1d')){_0x2a7d35['userId']=_0x4bea43[_0x809c('0xd')][0x0][_0x809c('0x1e')];}else{_0x2a7d35[_0x809c('0x1f')]=_0x2a7d35[_0x809c('0xf')];_0x2a7d35[_0x809c('0x18')]=_0x2a7d35['adminEmail'];}logger[_0x809c('0x15')]('['+[_0x537be7['toUpperCase']()]+_0x809c('0x20'),_0x2a7d35);_0x58a5b2(_0x2a7d35);})['catch'](function(_0x1b40f9){logger[_0x809c('0x12')]('['+[_0x537be7['toUpperCase']()]+']',_0x1b40f9['message']);_0x20da2a(_0x1b40f9[_0x809c('0x14')]);});}else{logger[_0x809c('0x15')]('['+[_0x537be7[_0x809c('0x13')]()]+_0x809c('0x21'));_0x2a7d35[_0x809c('0x1f')]=_0x2a7d35[_0x809c('0xf')];_0x2a7d35[_0x809c('0x18')]=_0x2a7d35[_0x809c('0x22')];_0x58a5b2(_0x2a7d35);}});};}function createEndUser(_0x2effb7,_0x436ea4,_0x5d9936,_0x3d99d9,_0xb34853){logger[_0x809c('0x15')]('['+[_0x2effb7['toUpperCase']()]+_0x809c('0x23'),_0x5d9936);return new Promise(function(_0x378be6,_0x5bc49b){var _0x1b2b5f={'method':_0x809c('0x24'),'uri':_0x3d99d9+_0x809c('0x25')+_0xb34853,'body':{'user_name':_0x5d9936[_0x809c('0x26')],'roles':_0x809c('0x27'),'first_name':_0x5d9936['endUserNumber'],'active':_0x809c('0x1d'),'date_format':_0x809c('0x28'),'phone':_0x5d9936['endUserNumber']},'auth':_0x436ea4,'json':!![]};return rp(_0x1b2b5f)[_0x809c('0x1a')](function(_0xc6edcd){logger[_0x809c('0x15')]('['+[_0x2effb7['toUpperCase']()]+_0x809c('0x29'),_0xc6edcd[_0x809c('0xd')]);_0x5d9936['endUserId']=_0xc6edcd['result'][_0x809c('0x1e')];_0x378be6(_0x5d9936);})[_0x809c('0x11')](function(_0x3a0662){logger[_0x809c('0x12')]('['+[_0x2effb7[_0x809c('0x13')]()]+']',_0x3a0662[_0x809c('0x14')]);_0x5bc49b(_0x3a0662[_0x809c('0x14')]);});});}function getEndUser(_0x34d3b3,_0x1514d7,_0x9cb6c3,_0x12292c,_0x2f0afe){return function(_0x35fa28){logger[_0x809c('0x15')]('['+[_0x34d3b3['toUpperCase']()]+_0x809c('0x2a'),_0x35fa28);return new Promise(function(_0x21cca6,_0xb60b8c){var _0x503971={'method':_0x809c('0xb'),'uri':_0x9cb6c3+_0x809c('0x2b')+_0x35fa28['endUserNumber']+'&'+_0x12292c+'&'+_0x2f0afe,'auth':_0x1514d7,'json':!![]};return rp(_0x503971)[_0x809c('0x1a')](function(_0x5c1ecd){if(_0x5c1ecd[_0x809c('0xd')][_0x809c('0xe')]>0x0){_0x35fa28[_0x809c('0x2c')]=_0x5c1ecd[_0x809c('0xd')][0x0][_0x809c('0x1e')];logger[_0x809c('0x15')]('['+[_0x34d3b3['toUpperCase']()]+_0x809c('0x2d'),_0x35fa28);_0x21cca6(_0x35fa28);}else{return createEndUser(_0x34d3b3,_0x1514d7,_0x35fa28,_0x9cb6c3,_0x12292c)[_0x809c('0x1a')](function(_0x19c635){logger[_0x809c('0x15')]('['+[_0x34d3b3['toUpperCase']()]+_0x809c('0x2e'),_0x19c635);_0x21cca6(_0x19c635);});}})[_0x809c('0x11')](function(_0x4dd774){logger[_0x809c('0x12')]('['+[_0x34d3b3[_0x809c('0x13')]()]+']',_0x4dd774[_0x809c('0x14')]);_0xb60b8c(_0x4dd774['message']);});});};}function getCustomFields(_0x6e8264,_0x3634f7){var _0x304dd1={};if(_0x6e8264[_0x809c('0xe')]>0x0){_[_0x809c('0x2f')](_0x6e8264,function(_0x30695e){if(_[_0x809c('0x30')]([_0x809c('0x31'),_0x809c('0x32')],_0x30695e[_0x809c('0x33')])&&_0x30695e[_0x809c('0x34')]&&!_0x30695e[_0x809c('0x35')]){_0x304dd1[_0x30695e['nameField'][_0x809c('0x36')]()]=_0x30695e[_0x809c('0x37')][_0x809c('0x38')]();}else if(_['includes'](['string',_0x809c('0x32')],_0x30695e[_0x809c('0x33')])&&_0x30695e[_0x809c('0x39')]&&_0x30695e['customField']){_0x304dd1[_0x30695e[_0x809c('0x39')][_0x809c('0x36')]()]=_0x30695e[_0x809c('0x37')][_0x809c('0x38')]();}else if(_0x30695e[_0x809c('0x33')]===_0x809c('0x3a')&&_0x30695e[_0x809c('0x3b')]&&_0x30695e[_0x809c('0x39')]&&_0x30695e['customField']){_0x304dd1[_0x30695e[_0x809c('0x39')][_0x809c('0x36')]()]=_0x3634f7[_0x30695e[_0x809c('0x3b')]]['toString']();}else if(_0x30695e[_0x809c('0x33')]===_0x809c('0x3c')&&_0x30695e['Variable']&&_0x30695e[_0x809c('0x3d')]['name']&&_0x30695e[_0x809c('0x39')]&&_0x30695e[_0x809c('0x35')]){_0x304dd1[_0x30695e[_0x809c('0x39')][_0x809c('0x36')]()]=_0x3634f7[_0x30695e['Variable'][_0x809c('0x3e')][_0x809c('0x36')]()]['toString']();}});}return _0x304dd1;}function getTicket(_0xc3d7c4,_0x4a1a3f,_0x109521,_0x2fb98b,_0xfa101d,_0x2d1307){return function(_0x1dad7e){logger[_0x809c('0x15')]('['+[_0xc3d7c4[_0x809c('0x13')]()]+_0x809c('0x3f'),_0x1dad7e);return new Promise(function(_0x635906,_0xc6f441){var _0x54d1b6=_0xc3d7c4[_0x809c('0x36')]()===_0x809c('0x40')?_0x1dad7e[_0x809c('0x1f')]:_0x1dad7e[_0x809c('0x2c')];var _0x547e9f={'method':'POST','uri':_0x109521+'incident'+'?'+_0x2d1307,'body':Object[_0x809c('0x41')]({},{'active':_0x809c('0x1d'),'caller_id':_0x54d1b6,'assigned_to':_0x1dad7e[_0x809c('0x1f')],'short_description':intUtil[_0x809c('0x42')](_0x2fb98b[_0x809c('0x43')],_0xfa101d,'\x20'),'description':intUtil['getString'](_0x2fb98b['Descriptions'],_0xfa101d,'\x0a')},getCustomFields(_0x2fb98b[_0x809c('0x44')],_0xfa101d)),'auth':_0x4a1a3f,'json':!![]};return rp(_0x547e9f)[_0x809c('0x1a')](function(_0xb75340){logger[_0x809c('0x15')]('['+[_0xc3d7c4['toUpperCase']()]+_0x809c('0x45'),_0xb75340[_0x809c('0xd')]);_0x1dad7e[_0x809c('0x46')]=_0xb75340[_0x809c('0xd')][_0x809c('0x1e')];_0x1dad7e[_0x809c('0x47')]=_0xb75340['result'][_0x809c('0x48')];logger[_0x809c('0x15')]('['+[_0xc3d7c4[_0x809c('0x13')]()]+_0x809c('0x49'),_0x1dad7e);_0x635906(_0x1dad7e);})[_0x809c('0x11')](function(_0x9d813d){logger[_0x809c('0x12')]('['+[_0xc3d7c4[_0x809c('0x13')]()]+']',_0x9d813d['message']);_0xc6f441(_0x9d813d[_0x809c('0x14')]);});});};}function createRemoteTag(_0x2bb638,_0x41c5a0,_0x48bbb2,_0x22e03d){return new Promise(function(_0x4e8aac,_0x333666){var _0x309125={'method':'POST','uri':_0x48bbb2+_0x809c('0x4a')+'?'+_0x22e03d,'body':{'short_description':_0x2bb638,'global':!![],'active':!![],'name':_0x2bb638},'auth':_0x41c5a0,'json':!![]};return rp(_0x309125)[_0x809c('0x1a')](function(_0x3eabb4){var _0x58555c=_0x3eabb4[_0x809c('0xd')][_0x809c('0x1e')];_0x4e8aac(_0x58555c);});});}function getRemoteTag(_0x1e9dbb,_0x57aa29,_0x4d54b7,_0x14f8ca,_0x4f1c43){return new Promise(function(_0x72724d,_0x2c7ae6){var _0x24e9f2={'method':_0x809c('0xb'),'uri':_0x4d54b7+_0x809c('0x4a')+'?sysparm_query=name%3D'+_0x1e9dbb+'&'+_0x14f8ca,'auth':_0x57aa29,'json':!![]};return rp(_0x24e9f2)[_0x809c('0x1a')](function(_0xfec905){if(_0xfec905[_0x809c('0xd')]['length']>0x0){var _0x48b893=_0xfec905[_0x809c('0xd')][0x0][_0x809c('0x1e')];_0x72724d(_0x48b893);}else{return createRemoteTag(_0x1e9dbb,_0x57aa29,_0x4d54b7,_0x14f8ca)[_0x809c('0x1a')](function(_0x4ff14e){_0x72724d(_0x4ff14e);});}});});}function assignTagToIncident(_0xcf832c,_0x33c52e,_0x41f75e,_0x39fc9e,_0x3581b3){return new Promise(function(_0x3e3248,_0x2472fa){var _0x77bc6a={'method':'POST','uri':_0x41f75e+'label_entry'+'?'+_0x3581b3,'body':{'label':_0xcf832c,'table':_0x809c('0x4b'),'id_type':_0x809c('0x4c'),'table_key':_0x39fc9e[_0x809c('0x46')],'title':'Incident\x20-\x20'+_0x39fc9e[_0x809c('0x47')],'id_display':_0x39fc9e[_0x809c('0x47')]},'auth':_0x33c52e,'json':!![]};return rp(_0x77bc6a)[_0x809c('0x1a')](function(_0x116bed){_0x3e3248();})['catch'](function(){_0x3e3248();});});}function manageTags(_0x4477c8,_0x462e5f,_0x263d2f,_0x36d6fe,_0x4b5355,_0x2eb2dd,_0x160117){return new Promise(function(_0x31c50b,_0xb1adc4){var _0x459396=[];_0x462e5f['forEach'](function(_0x4f4d1e){_0x459396['push'](getRemoteTag(_0x4f4d1e,_0x263d2f,_0x36d6fe,_0x2eb2dd,_0x160117));});return Promise[_0x809c('0x4d')](_0x459396)['then'](function(_0x41cc1f){if(_0x41cc1f[_0x809c('0xe')]){logger[_0x809c('0x15')]('['+[_0x4477c8['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x41cc1f);var _0x264738=[];_0x41cc1f['forEach'](function(_0x581e2f){_0x264738[_0x809c('0x4e')](assignTagToIncident(_0x581e2f,_0x263d2f,_0x36d6fe,_0x4b5355,_0x2eb2dd));});return Promise[_0x809c('0x4d')](_0x264738)[_0x809c('0x1a')](function(){_0x31c50b();})[_0x809c('0x11')](function(){_0x31c50b();});}else{_0x31c50b();}});});}function getTags(_0x30f8d0,_0x4e8081,_0x53fcad,_0x4f1a3c,_0x3a369e,_0x11ea51){return function(_0x5ccca2){return new Promise(function(_0x2b75a1,_0x4c45ca){var _0x380c92=[];var _0x24909b=_0x4f1a3c['Tags'];if(_0x24909b&&_0x24909b[_0x809c('0xe')]>0x0){_0x380c92=_[_0x809c('0x4f')](_0x24909b,_0x809c('0x3e'));}if(_0x380c92[_0x809c('0xe')]>0x0){return manageTags(_0x30f8d0,_0x380c92,_0x4e8081,_0x53fcad,_0x5ccca2,_0x3a369e,_0x11ea51)[_0x809c('0x1a')](function(){_0x2b75a1(_0x5ccca2);});}else{_0x2b75a1(_0x5ccca2);}});};}function emit(_0x267de4,_0x31344d,_0x56fcef){var _0x5f1da1='%26sysparm_record_target%3Dincident'+_0x809c('0x50')+_0x809c('0x51')+_0x809c('0x52');var _0x354c8f={'uri':_0x267de4+_0x809c('0x53')+_0x56fcef+_0x5f1da1};io['to'](util[_0x809c('0x54')]('user:%s',_0x31344d))['emit'](_0x809c('0x55'),_0x354c8f);}exports['cs']=function(_0x174101,_0x576666,_0xf59e1e,_0x3570d5,_0x439912,_0x6723b,_0x2ead1f,_0x1938f4){var _0x487223={};var _0x4fab93={'user':_0x6723b[_0x809c('0x56')],'pass':_0x6723b[_0x809c('0x57')]};var _0x561021=_0x809c('0x58');var _0x3a0102='sysparm_display_value=true';_0x6723b[_0x809c('0x59')]=intUtil[_0x809c('0x5a')](_0x6723b[_0x809c('0x59')]);_0x6723b[_0x809c('0x5b')]=intUtil['stripTrailingSlash'](_0x6723b[_0x809c('0x5b')]);var _0x168fd8=util[_0x809c('0x54')](_0x809c('0x5c'),_0x6723b[_0x809c('0x59')]);_0x487223['userEmail']=!_['isNil'](_0x3570d5)?_0x3570d5[_0x809c('0x5d')]:null;_0x487223[_0x809c('0x22')]=_0x6723b[_0x809c('0x5d')];_0x487223[_0x809c('0x26')]=_0x1938f4[_0x809c('0x36')]()===_0x809c('0x40')?_0x576666[_0x809c('0x5e')]:_0x576666[_0x809c('0x5f')];_0x487223[_0x809c('0x60')]=_0x1938f4===_0x809c('0x61')||_0x1938f4===_0x809c('0x62')?_0x809c('0x61'):'outbound';var _0x11cbf5=util[_0x809c('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6723b[_0x809c('0x5b')],_0x576666[_0x809c('0x63')],md5(_0x576666[_0x809c('0x63')]));if(_0x439912&&_0x439912[_0x809c('0x64')]){logger[_0x809c('0x15')](_0x809c('0x65'),_0x809c('0x66'));_0x576666[_0x809c('0x67')]=_0x11cbf5;}else if(_0x2ead1f&&_0x2ead1f['recordingFormat']&&_0x2ead1f[_0x809c('0x68')]!==_0x809c('0x69')){logger['info']('[OUTBOUND]',_0x809c('0x66'));_0x576666['recordingURL']=_0x11cbf5;}else{_0x576666['recordingURL']='';}return getAdminUser(_0x1938f4,_0x4fab93,_0x487223,_0x168fd8,_0x3a0102,_0x561021)['then'](getUser(_0x1938f4,_0x4fab93,_0x168fd8,_0x3a0102,_0x561021))[_0x809c('0x1a')](getEndUser(_0x1938f4,_0x4fab93,_0x168fd8,_0x3a0102,_0x561021))[_0x809c('0x1a')](getTicket(_0x1938f4,_0x4fab93,_0x168fd8,_0xf59e1e,_0x576666,_0x3a0102))[_0x809c('0x1a')](function(_0x3a917e){logger['info'](util[_0x809c('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3a917e[_0x809c('0x46')]));logger['info'](util[_0x809c('0x54')](_0x809c('0x6a'),_0x1938f4));if(_0x1938f4!==_0x809c('0x62')){logger[_0x809c('0x15')]('['+[_0x1938f4['toUpperCase']()]+']',_0x809c('0x6b'));emit(_0x6723b[_0x809c('0x59')],_0x3570d5[_0x809c('0x3e')],_0x3a917e[_0x809c('0x46')]);}})[_0x809c('0x11')](function(_0x25b716){logger[_0x809c('0x12')]('['+[_0x1938f4['toUpperCase']()]+_0x809c('0x6c'),util[_0x809c('0x6d')](_0x25b716,{'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 7474218..41d847d 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 _0x473e=['POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','Inbound','The\x20Ticket\x20ID\x20is:','request-promise','bluebird','util','../../../../config/environment','redis','defaults','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','date_start','slice','replace','duration_hours','parent_id','Contacts','direction','length','forEach','push','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','info','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','string','customField','nameField','content','custom_fields','variableName','customVariable','Variable','toLowerCase'];(function(_0x21d6a6,_0x54e297){var _0x3b0782=function(_0x4778fb){while(--_0x4778fb){_0x21d6a6['push'](_0x21d6a6['shift']());}};_0x3b0782(++_0x54e297);}(_0x473e,0x195));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xe473('0x0'));var BPromise=require(_0xe473('0x1'));var md5=require('md5');var util=require(_0xe473('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xe473('0x3'));var logger=require('../../../../config/logger')('sugarcrm');config[_0xe473('0x4')]=_[_0xe473('0x5')](config[_0xe473('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x331a03,_0x4f3551,_0x37d36b){io['to'](_0x331a03)[_0xe473('0x6')](_0x4f3551,_0x37d36b);}function getTicket(_0x55ef52,_0x447d2f,_0x4abd76,_0x34c772,_0xe71f88,_0x16a4e7,_0x136f07,_0x1a3981){logger['info'](_0xe473('0x7'));var _0x381bb7=new Date();var _0x15b485=[{'name':_0xe473('0x8'),'value':intUtil[_0xe473('0x9')](_0x34c772['Subjects'],_0xe71f88,'\x20')},{'name':_0xe473('0xa'),'value':_0x447d2f['id']},{'name':'created_by','value':_0x447d2f['id']},{'name':_0xe473('0xb'),'value':intUtil[_0xe473('0x9')](_0x34c772[_0xe473('0xc')],_0xe71f88,'\x0a')},{'name':_0xe473('0xd'),'value':_0x381bb7['toISOString']()[_0xe473('0xe')](0x0,0x13)[_0xe473('0xf')]('T','\x20')},{'name':_0xe473('0x10'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe473('0x11'),'value':_0x4abd76['id']},{'name':'parent_type','value':_0xe473('0x12')},{'name':'parent_name','value':_0x4abd76[_0xe473('0x8')]},{'name':_0xe473('0x13'),'value':_0x1a3981}];if(_0x16a4e7[_0xe473('0x14')]){_[_0xe473('0x15')](_0x16a4e7,function(_0x5c8907){if(_0xe71f88[_0x5c8907['variableName']]){_0x15b485[_0xe473('0x16')]({'name':_0x5c8907[_0xe473('0x17')],'value':_0xe71f88[_0x5c8907['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0xe473('0x18'),'response_type':_0xe473('0x18'),'rest_data':JSON['stringify']({'session':_0x136f07['id'],'module_name':_0xe473('0x19'),'name_value_list':_0x15b485})}});}function getAuth(_0xdb0a6c){return util[_0xe473('0x1a')](_0xe473('0x1b'),new Buffer(_0xdb0a6c[_0xe473('0x1c')]+':X')[_0xe473('0x1d')](_0xe473('0x1e')));}function getServerInfo(_0x40c9d8){return request({'form':{'method':'get_server_info','input_type':_0xe473('0x18'),'response_type':_0xe473('0x18'),'rest_data':JSON['stringify']({'session':_0x40c9d8['id']})}});}function getUser(_0x1eb174,_0xdfeb2c,_0x18f864){if(!_[_0xe473('0x1f')](_0xdfeb2c)){logger['info'](_0xe473('0x20'),_0xdfeb2c);return request({'form':{'method':_0xe473('0x21'),'input_type':_0xe473('0x18'),'response_type':_0xe473('0x18'),'rest_data':JSON[_0xe473('0x22')]({'session':_0x18f864['id'],'module_name':_0xe473('0x23'),'query':util['format'](_0xe473('0x24'),_0xdfeb2c),'order_by':'','offset':'0','select_fields':['id',_0xe473('0x8'),_0xe473('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe473('0x26')](function(_0x49ed5f){if(_0x49ed5f[_0xe473('0x27')]['length']){var _0x465b73=_['find'](_0x49ed5f[_0xe473('0x27')],function(_0x32e844){return _0x32e844['name_value_list'][_0xe473('0x25')][_0xe473('0x28')]===_0xdfeb2c;});if(_0x465b73){logger[_0xe473('0x29')](_0xe473('0x2a'));return BPromise[_0xe473('0x2b')]({'id':_0x465b73['name_value_list']['id'][_0xe473('0x28')],'name':_0x465b73[_0xe473('0x2c')]['name']['value']});}}logger[_0xe473('0x29')](_0xe473('0x2d'));return BPromise['resolve']({'id':_0x18f864['name_value_list'][_0xe473('0x2e')]['value'],'name':_0x18f864[_0xe473('0x2c')]['user_name']['value']});});}else{logger['info'](_0xe473('0x2f'));return BPromise[_0xe473('0x2b')]({'id':_0x18f864[_0xe473('0x2c')][_0xe473('0x2e')][_0xe473('0x28')],'name':_0x18f864['name_value_list'][_0xe473('0x25')]['value']});}}function getEndUser(_0x4b3222,_0xbca857,_0xf9b7b6,_0x5ce027){logger['info'](_0xe473('0x30'),_0xf9b7b6);return request({'form':{'method':_0xe473('0x21'),'input_type':_0xe473('0x18'),'response_type':_0xe473('0x18'),'rest_data':JSON[_0xe473('0x22')]({'session':_0x5ce027['id'],'module_name':_0xe473('0x12'),'query':util[_0xe473('0x1a')](_0xe473('0x31'),_0xf9b7b6),'order_by':'','offset':'0','select_fields':['id',_0xe473('0x8'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe473('0x26')](function(_0x5046b9){if(_0x5046b9['entry_list'][_0xe473('0x14')]){var _0x5a9f5c=_[_0xe473('0x32')](_0x5046b9[_0xe473('0x27')],function(_0x476292){return _0x476292['name_value_list'][_0xe473('0x33')][_0xe473('0x28')]===_0xf9b7b6;});if(_0x5a9f5c){logger[_0xe473('0x29')]('Enduser\x20found!');return BPromise[_0xe473('0x2b')]({'id':_0x5a9f5c[_0xe473('0x2c')]['id'][_0xe473('0x28')],'name':_0x5a9f5c[_0xe473('0x2c')][_0xe473('0x8')][_0xe473('0x28')],'phone':_0x5a9f5c[_0xe473('0x2c')][_0xe473('0x33')][_0xe473('0x28')]});}}else{logger[_0xe473('0x29')](_0xe473('0x34'));return request({'form':{'method':_0xe473('0x35'),'input_type':_0xe473('0x18'),'response_type':_0xe473('0x18'),'rest_data':JSON['stringify']({'session':_0x5ce027['id'],'module_name':'Contacts','name_value_list':[{'name':_0xe473('0x36'),'value':_0xbca857!==_0xe473('0x37')?_0xbca857:util[_0xe473('0x1a')](_0xe473('0x38'),_0xf9b7b6)},{'name':_0xe473('0x33'),'value':_0xf9b7b6}]})}})[_0xe473('0x26')](function(_0x4649cf){logger[_0xe473('0x29')](_0xe473('0x39'));return BPromise['resolve']({'id':_0x4649cf['id'],'name':_0x4649cf[_0xe473('0x27')][_0xe473('0x36')]['value'],'phone':_0x4649cf[_0xe473('0x27')]['phone_home'][_0xe473('0x28')]});});}});}function request(_0x556d14){logger[_0xe473('0x3a')](_0xe473('0x3b'),JSON[_0xe473('0x22')](_0x556d14));return rp(_[_0xe473('0x3c')](def,_0x556d14));}function getTags(_0x5a5f6c,_0x38470b){var _0x11afa2=[];if(_0x5a5f6c&&_0x5a5f6c[_0xe473('0x14')]>0x0){_0x11afa2=_['map'](_0x5a5f6c,_0x38470b);}return _0x11afa2;}function getCustomFields(_0x10e476,_0xfda885){var _0x19a642=[];var _0x1b5339={'custom_fields':[]};if(_0x10e476[_0xe473('0x14')]>0x0){_[_0xe473('0x15')](_0x10e476,function(_0xefae8e){if(_0xefae8e[_0xe473('0x3d')]===_0xe473('0x3e')&&_0xefae8e['nameField']&&!_0xefae8e[_0xe473('0x3f')]){_0x1b5339[_0xefae8e[_0xe473('0x40')]['toLowerCase']()]=_0xefae8e[_0xe473('0x41')][_0xe473('0x1d')]();}else if(_0xefae8e[_0xe473('0x3d')]===_0xe473('0x3e')&&_0xefae8e[_0xe473('0x17')]&&_0xefae8e['customField']){_0x1b5339[_0xe473('0x42')][_0xe473('0x16')]({'id':_0xefae8e[_0xe473('0x17')],'value':_0xefae8e['content'][_0xe473('0x1d')]()});}else if(_0xefae8e['type']==='variable'&&_0xefae8e[_0xe473('0x43')]&&_0xefae8e[_0xe473('0x17')]&&_0xefae8e[_0xe473('0x3f')]){_0xfda885[_0xefae8e[_0xe473('0x43')]]&&_0x1b5339[_0xe473('0x42')][_0xe473('0x16')]({'id':_0xefae8e[_0xe473('0x17')],'value':_0xfda885[_0xefae8e[_0xe473('0x43')]][_0xe473('0x1d')]()});}else if(_0xefae8e['type']===_0xe473('0x44')&&_0xefae8e['Variable']&&_0xefae8e[_0xe473('0x45')][_0xe473('0x8')]&&_0xefae8e[_0xe473('0x17')]&&_0xefae8e[_0xe473('0x3f')]){_0xfda885[_0xefae8e[_0xe473('0x45')][_0xe473('0x8')][_0xe473('0x46')]()]&&_0x1b5339[_0xe473('0x42')][_0xe473('0x16')]({'id':_0xefae8e[_0xe473('0x17')],'value':_0xfda885[_0xefae8e['Variable'][_0xe473('0x8')][_0xe473('0x46')]()][_0xe473('0x1d')]()});}});}return _0x1b5339;}function getConnection(_0x202400){return request({'method':_0xe473('0x47'),'form':{'method':_0xe473('0x48'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe473('0x22')]({'user_auth':{'user_name':_0x202400[_0xe473('0x49')],'password':_0x202400[_0xe473('0x4a')],'encryption':'PLAIN'},'application':_0xe473('0x4b')})}})[_0xe473('0x26')](function(_0x49a510){var _0x2b7a65=_0x49a510;if(_0x2b7a65['id']){def[_0xe473('0x4c')]=_0x2b7a65['id'];return BPromise[_0xe473('0x2b')](_0x2b7a65);}else{throw new Error(util['format'](_0xe473('0x4d'),_0x202400['id']));}});}function setRelationship(_0x332ba7,_0x1e626a,_0x3697b5,_0x401109){return request({'form':{'method':_0xe473('0x4e'),'input_type':'JSON','response_type':_0xe473('0x18'),'rest_data':JSON[_0xe473('0x22')]({'session':_0x332ba7['id'],'module_name':_0xe473('0x19'),'module_id':_0x3697b5['id'],'link_field_name':_0x401109,'related_ids':[_0x1e626a['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x57ae11,_0x27720a,_0x27c1f8,_0x13b968,_0xfbba84,_0x5f2371){var _0x284181,_0x513c07,_0x533006,_0x4d08e5;_0x5f2371['remoteUri']=intUtil[_0xe473('0x4f')](_0x5f2371['remoteUri']);_0x5f2371[_0xe473('0x50')]=intUtil[_0xe473('0x4f')](_0x5f2371[_0xe473('0x50')]);def[_0xe473('0x51')]=util['format'](_0xe473('0x52'),_0x5f2371[_0xe473('0x53')]);if(_0xfbba84&&_0xfbba84[_0xe473('0x54')]){logger[_0xe473('0x29')](_0xe473('0x55'),_0xe473('0x56'));_0x27720a[_0xe473('0x57')]=util[_0xe473('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f2371[_0xe473('0x50')],_0x27720a[_0xe473('0x58')],md5(_0x27720a[_0xe473('0x58')]));}else{_0x27720a[_0xe473('0x57')]='';}return getConnection(_0x5f2371)['then'](function(_0x2da068){_0x4d08e5=_0x2da068;return getUser(_0x5f2371,_0x13b968[_0xe473('0x8')],_0x4d08e5);})[_0xe473('0x26')](function(_0x30a2e5){_0x284181=_0x30a2e5;logger[_0xe473('0x29')](_0xe473('0x59'),_0x284181['id']);return getEndUser(_0x5f2371,_0x27720a[_0xe473('0x5a')],_0x27720a[_0xe473('0x5b')],_0x4d08e5);})[_0xe473('0x26')](function(_0xb07c5b){_0x513c07=_0xb07c5b;logger[_0xe473('0x29')](_0xe473('0x5c'),_0x513c07['id']);return getTicket(_0x5f2371,_0x284181,_0x513c07,_0x27c1f8,_0x27720a,_0x27c1f8[_0xe473('0x5d')],_0x4d08e5,'Inbound');})[_0xe473('0x26')](function(_0xc53db2){_0x533006=_0xc53db2;logger[_0xe473('0x29')](_0xe473('0x5e'));logger[_0xe473('0x29')]('The\x20Ticket\x20ID\x20is:',_0x533006['id']);return setRelationship(_0x4d08e5,_0x284181,_0x533006,_0xe473('0x5f'));})['then'](function(){return setRelationship(_0x4d08e5,_0x513c07,_0x533006,_0xe473('0x60'));})[_0xe473('0x26')](function(){return getServerInfo(_0x4d08e5);})['then'](function(_0x4f8c08){var _0x6be3a1=parseInt(_0x4f8c08[_0xe473('0x61')][_0xe473('0x62')](0x0));var _0x12d6a9=util[_0xe473('0x1a')](_0xe473('0x63'),_0x5f2371[_0xe473('0x53')],_0x533006['id']);if(_0x6be3a1>0x6){_0x12d6a9=util['format'](_0xe473('0x64'),_0x5f2371['remoteUri'],_0x533006['id']);}logger[_0xe473('0x29')](_0xe473('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe473('0x1a')](_0xe473('0x65'),_0x13b968[_0xe473('0x8')]),_0xe473('0x66'),{'uri':_0x12d6a9});})[_0xe473('0x67')](function(_0x442d80){logger[_0xe473('0x68')]('[QUEUE]',JSON[_0xe473('0x22')](_0x442d80));});};exports[_0xe473('0x69')]=function(_0x2b54fc,_0x1f504a,_0x35ac20,_0x3f09b0,_0xfebd42,_0x371311,_0x1190bd){var _0x48aa2a,_0x180892,_0x36df94,_0x819b04;_0x371311[_0xe473('0x53')]=intUtil[_0xe473('0x4f')](_0x371311['remoteUri']);_0x371311['serverUrl']=intUtil[_0xe473('0x4f')](_0x371311[_0xe473('0x50')]);def[_0xe473('0x51')]=util['format']('%s/service/v4_1/rest.php',_0x371311[_0xe473('0x53')]);if(_0x1190bd&&_0x1190bd[_0xe473('0x6a')]&&_0x1190bd['recordingFormat']!==_0xe473('0x6b')){logger['info']('[OUTBOUND]',_0xe473('0x56'));_0x1f504a[_0xe473('0x57')]=util['format'](_0xe473('0x6c'),_0x371311[_0xe473('0x50')],_0x1f504a['uniqueid'],md5(_0x1f504a[_0xe473('0x58')]));}return getConnection(_0x371311)[_0xe473('0x26')](function(_0x8d2000){_0x819b04=_0x8d2000;return getUser(_0x371311,_0x3f09b0[_0xe473('0x8')],_0x819b04);})[_0xe473('0x26')](function(_0xd98c3d){_0x48aa2a=_0xd98c3d;logger[_0xe473('0x29')](_0xe473('0x59'),_0x48aa2a['id']);return getEndUser(_0x371311,_0x1f504a[_0xe473('0x6d')],_0x1f504a[_0xe473('0x6e')],_0x819b04);})[_0xe473('0x26')](function(_0x3fd04f){_0x180892=_0x3fd04f;logger[_0xe473('0x29')](_0xe473('0x5c'),_0x180892['id']);return getTicket(_0x371311,_0x48aa2a,_0x180892,_0x35ac20,_0x1f504a,_0x35ac20[_0xe473('0x5d')],_0x819b04,_0xe473('0x6f'));})[_0xe473('0x26')](function(_0x410abb){_0x36df94=_0x410abb;logger[_0xe473('0x29')](_0xe473('0x5e'));logger[_0xe473('0x29')]('The\x20Ticket\x20ID\x20is:',_0x36df94['id']);return setRelationship(_0x819b04,_0x48aa2a,_0x36df94,_0xe473('0x5f'));})[_0xe473('0x26')](function(){return setRelationship(_0x819b04,_0x180892,_0x36df94,_0xe473('0x60'));})['then'](function(){return getServerInfo(_0x819b04);})[_0xe473('0x26')](function(_0x13207a){var _0x2bd9ec=parseInt(_0x13207a['version']['charAt'](0x0));var _0x154d9b=util['format'](_0xe473('0x63'),_0x371311[_0xe473('0x53')],_0x36df94['id']);if(_0x2bd9ec>0x6){_0x154d9b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x371311['remoteUri'],_0x36df94['id']);}logger[_0xe473('0x29')](_0xe473('0x70'),_0xe473('0x71'));emit(util['format'](_0xe473('0x65'),_0x3f09b0['name']),'trigger:browser:url',{'uri':_0x154d9b});})[_0xe473('0x67')](function(_0x3d3ac3){logger['error'](_0xe473('0x70'),JSON[_0xe473('0x22')](_0x3d3ac3));});};exports[_0xe473('0x72')]=function(_0x539232,_0x40ba94,_0x461c72,_0x335317,_0x3f95b5,_0x5519fb){var _0x36d62d,_0x438016,_0x7adfe,_0x5646d3;_0x5519fb[_0xe473('0x53')]=intUtil[_0xe473('0x4f')](_0x5519fb[_0xe473('0x53')]);_0x5519fb[_0xe473('0x50')]=intUtil[_0xe473('0x4f')](_0x5519fb[_0xe473('0x50')]);def[_0xe473('0x51')]=util['format'](_0xe473('0x52'),_0x5519fb[_0xe473('0x53')]);if(_0x3f95b5&&_0x3f95b5['monitor_format']){logger[_0xe473('0x29')]('['+_0x40ba94[_0xe473('0x73')][_0xe473('0x74')]()+']',_0xe473('0x56'));_0x40ba94[_0xe473('0x57')]=util[_0xe473('0x1a')](_0xe473('0x6c'),_0x5519fb[_0xe473('0x50')],_0x40ba94[_0xe473('0x58')],md5(_0x40ba94[_0xe473('0x58')]));}else{_0x40ba94[_0xe473('0x57')]='';}return getConnection(_0x5519fb)['then'](function(_0x5f3e4c){_0x5646d3=_0x5f3e4c;if(!_[_0xe473('0x1f')](_0x335317)){return getUser(_0x5519fb,_0x335317['name'],_0x5646d3);}else{return getUser(_0x5519fb,null,_0x5646d3);}})['then'](function(_0x5685ad){_0x36d62d=_0x5685ad;logger['info']('The\x20User\x20ID\x20is:',_0x36d62d['id']);return getEndUser(_0x5519fb,_0x40ba94['calleridname'],_0x40ba94[_0xe473('0x5b')],_0x5646d3);})[_0xe473('0x26')](function(_0x50416b){_0x438016=_0x50416b;logger[_0xe473('0x29')](_0xe473('0x5c'),_0x438016['id']);return getTicket(_0x5519fb,_0x36d62d,_0x438016,_0x461c72,_0x40ba94,_0x461c72['Fields'],_0x5646d3,_0xe473('0x75'));})[_0xe473('0x26')](function(_0x44a5b5){_0x7adfe=_0x44a5b5;logger[_0xe473('0x29')](_0xe473('0x5e'));logger[_0xe473('0x29')](_0xe473('0x76'),_0x7adfe['id']);return setRelationship(_0x5646d3,_0x36d62d,_0x7adfe,_0xe473('0x5f'));})[_0xe473('0x26')](function(){return setRelationship(_0x5646d3,_0x438016,_0x7adfe,_0xe473('0x60'));})[_0xe473('0x26')](function(){return getServerInfo(_0x5646d3);})[_0xe473('0x67')](function(_0x21cd08){logger[_0xe473('0x68')]('['+_0x40ba94[_0xe473('0x73')][_0xe473('0x74')]()+']',JSON[_0xe473('0x22')](_0x21cd08));});}; \ No newline at end of file +var _0x0558=['isNil','The\x20User\x20ID\x20is:','calleridname','Ticket\x20created!','bluebird','ioredis','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','push','idField','variableName','JSON','stringify','Calls','format','Basic\x20%s','apiKey','Employees','name','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Enduser\x20created.','first_name','[HTTP]','merge','map','string','nameField','toLowerCase','content','toString','type','customField','custom_fields','variable','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','error','[QUEUE]','outbound','%s/service/v4_1/rest.php','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','[OUTBOUND]','lastevent','toUpperCase'];(function(_0x42c6cc,_0x3ad790){var _0x203753=function(_0x1aaa2c){while(--_0x1aaa2c){_0x42c6cc['push'](_0x42c6cc['shift']());}};_0x203753(++_0x3ad790);}(_0x0558,0x1dc));var _0x8055=function(_0x42f0d1,_0x45fe4a){_0x42f0d1=_0x42f0d1-0x0;var _0x43f981=_0x0558[_0x42f0d1];return _0x43f981;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x8055('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8055('0x1'));var intUtil=require('./util');var config=require(_0x8055('0x2'));var logger=require('../../../../config/logger')(_0x8055('0x3'));config[_0x8055('0x4')]=_[_0x8055('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8055('0x6'))(new Redis(config['redis']));var def={'method':_0x8055('0x7'),'json':!![]};function emit(_0x3ecdee,_0x49671b,_0x363853){io['to'](_0x3ecdee)[_0x8055('0x8')](_0x49671b,_0x363853);}function getTicket(_0x363fa4,_0x4dc341,_0x5ba3ab,_0x1a86bb,_0x452d90,_0x36c5ee,_0x4874ca,_0x41d597){logger[_0x8055('0x9')]('Creating\x20new\x20ticket...');var _0x484264=new Date();var _0x4a7647=[{'name':'name','value':intUtil[_0x8055('0xa')](_0x1a86bb[_0x8055('0xb')],_0x452d90,'\x20')},{'name':_0x8055('0xc'),'value':_0x4dc341['id']},{'name':_0x8055('0xd'),'value':_0x4dc341['id']},{'name':_0x8055('0xe'),'value':intUtil['getString'](_0x1a86bb[_0x8055('0xf')],_0x452d90,'\x0a')},{'name':_0x8055('0x10'),'value':_0x484264[_0x8055('0x11')]()[_0x8055('0x12')](0x0,0x13)[_0x8055('0x13')]('T','\x20')},{'name':_0x8055('0x14'),'value':'0'},{'name':_0x8055('0x15'),'value':'15'},{'name':'parent_id','value':_0x5ba3ab['id']},{'name':'parent_type','value':_0x8055('0x16')},{'name':_0x8055('0x17'),'value':_0x5ba3ab['name']},{'name':_0x8055('0x18'),'value':_0x41d597}];if(_0x36c5ee[_0x8055('0x19')]){_[_0x8055('0x1a')](_0x36c5ee,function(_0x57e64e){if(_0x452d90[_0x57e64e['variableName']]){_0x4a7647[_0x8055('0x1b')]({'name':_0x57e64e[_0x8055('0x1c')],'value':_0x452d90[_0x57e64e[_0x8055('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON[_0x8055('0x1f')]({'session':_0x4874ca['id'],'module_name':_0x8055('0x20'),'name_value_list':_0x4a7647})}});}function getAuth(_0x16dd34){return util[_0x8055('0x21')](_0x8055('0x22'),new Buffer(_0x16dd34[_0x8055('0x23')]+':X')['toString']('base64'));}function getServerInfo(_0xab1c6d){return request({'form':{'method':'get_server_info','input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON[_0x8055('0x1f')]({'session':_0xab1c6d['id']})}});}function getUser(_0x346b14,_0x15d521,_0x4282fa){if(!_['isNil'](_0x15d521)){logger['info']('Getting\x20agent\x20with\x20name',_0x15d521);return request({'form':{'method':'get_entry_list','input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON[_0x8055('0x1f')]({'session':_0x4282fa['id'],'module_name':_0x8055('0x24'),'query':util[_0x8055('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x15d521),'order_by':'','offset':'0','select_fields':['id',_0x8055('0x25'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x43064f){if(_0x43064f[_0x8055('0x26')][_0x8055('0x19')]){var _0x58f547=_['find'](_0x43064f[_0x8055('0x26')],function(_0x5cc8de){return _0x5cc8de[_0x8055('0x27')]['user_name']['value']===_0x15d521;});if(_0x58f547){logger['info'](_0x8055('0x28'));return BPromise[_0x8055('0x29')]({'id':_0x58f547['name_value_list']['id'][_0x8055('0x2a')],'name':_0x58f547[_0x8055('0x27')][_0x8055('0x25')][_0x8055('0x2a')]});}}logger[_0x8055('0x9')](_0x8055('0x2b'));return BPromise[_0x8055('0x29')]({'id':_0x4282fa[_0x8055('0x27')][_0x8055('0x2c')][_0x8055('0x2a')],'name':_0x4282fa[_0x8055('0x27')][_0x8055('0x2d')][_0x8055('0x2a')]});});}else{logger['info'](_0x8055('0x2e'));return BPromise[_0x8055('0x29')]({'id':_0x4282fa[_0x8055('0x27')]['user_id'][_0x8055('0x2a')],'name':_0x4282fa[_0x8055('0x27')]['user_name'][_0x8055('0x2a')]});}}function getEndUser(_0x110f91,_0x2474b2,_0x1578a4,_0xb3af60){logger[_0x8055('0x9')](_0x8055('0x2f'),_0x1578a4);return request({'form':{'method':_0x8055('0x30'),'input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON['stringify']({'session':_0xb3af60['id'],'module_name':_0x8055('0x16'),'query':util[_0x8055('0x21')](_0x8055('0x31'),_0x1578a4),'order_by':'','offset':'0','select_fields':['id',_0x8055('0x25'),_0x8055('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8055('0x33')](function(_0x3fea6c){if(_0x3fea6c['entry_list'][_0x8055('0x19')]){var _0x55c4e7=_['find'](_0x3fea6c[_0x8055('0x26')],function(_0x3a19bc){return _0x3a19bc[_0x8055('0x27')][_0x8055('0x32')]['value']===_0x1578a4;});if(_0x55c4e7){logger[_0x8055('0x9')](_0x8055('0x34'));return BPromise[_0x8055('0x29')]({'id':_0x55c4e7[_0x8055('0x27')]['id'][_0x8055('0x2a')],'name':_0x55c4e7[_0x8055('0x27')][_0x8055('0x25')][_0x8055('0x2a')],'phone':_0x55c4e7[_0x8055('0x27')][_0x8055('0x32')][_0x8055('0x2a')]});}}else{logger[_0x8055('0x9')](_0x8055('0x35'));return request({'form':{'method':_0x8055('0x36'),'input_type':_0x8055('0x1e'),'response_type':'JSON','rest_data':JSON[_0x8055('0x1f')]({'session':_0xb3af60['id'],'module_name':_0x8055('0x16'),'name_value_list':[{'name':'first_name','value':_0x2474b2!==_0x8055('0x37')?_0x2474b2:util[_0x8055('0x21')]('Caller\x20-\x20%s',_0x1578a4)},{'name':_0x8055('0x32'),'value':_0x1578a4}]})}})[_0x8055('0x33')](function(_0x44a666){logger['info'](_0x8055('0x38'));return BPromise[_0x8055('0x29')]({'id':_0x44a666['id'],'name':_0x44a666['entry_list'][_0x8055('0x39')][_0x8055('0x2a')],'phone':_0x44a666[_0x8055('0x26')]['phone_home'][_0x8055('0x2a')]});});}});}function request(_0x4e2060){logger['debug'](_0x8055('0x3a'),JSON['stringify'](_0x4e2060));return rp(_[_0x8055('0x3b')](def,_0x4e2060));}function getTags(_0x2d778f,_0xc9dde9){var _0x53c469=[];if(_0x2d778f&&_0x2d778f[_0x8055('0x19')]>0x0){_0x53c469=_[_0x8055('0x3c')](_0x2d778f,_0xc9dde9);}return _0x53c469;}function getCustomFields(_0x58361b,_0x563cde){var _0x50dc28=[];var _0x3707ee={'custom_fields':[]};if(_0x58361b['length']>0x0){_[_0x8055('0x1a')](_0x58361b,function(_0xa977d0){if(_0xa977d0['type']===_0x8055('0x3d')&&_0xa977d0[_0x8055('0x3e')]&&!_0xa977d0['customField']){_0x3707ee[_0xa977d0[_0x8055('0x3e')][_0x8055('0x3f')]()]=_0xa977d0[_0x8055('0x40')][_0x8055('0x41')]();}else if(_0xa977d0[_0x8055('0x42')]==='string'&&_0xa977d0[_0x8055('0x1c')]&&_0xa977d0[_0x8055('0x43')]){_0x3707ee[_0x8055('0x44')]['push']({'id':_0xa977d0['idField'],'value':_0xa977d0['content'][_0x8055('0x41')]()});}else if(_0xa977d0[_0x8055('0x42')]===_0x8055('0x45')&&_0xa977d0['variableName']&&_0xa977d0['idField']&&_0xa977d0[_0x8055('0x43')]){_0x563cde[_0xa977d0['variableName']]&&_0x3707ee[_0x8055('0x44')]['push']({'id':_0xa977d0[_0x8055('0x1c')],'value':_0x563cde[_0xa977d0[_0x8055('0x1d')]]['toString']()});}else if(_0xa977d0[_0x8055('0x42')]===_0x8055('0x46')&&_0xa977d0[_0x8055('0x47')]&&_0xa977d0[_0x8055('0x47')][_0x8055('0x25')]&&_0xa977d0['idField']&&_0xa977d0['customField']){_0x563cde[_0xa977d0['Variable'][_0x8055('0x25')][_0x8055('0x3f')]()]&&_0x3707ee[_0x8055('0x44')][_0x8055('0x1b')]({'id':_0xa977d0[_0x8055('0x1c')],'value':_0x563cde[_0xa977d0[_0x8055('0x47')]['name'][_0x8055('0x3f')]()]['toString']()});}});}return _0x3707ee;}function getConnection(_0x48367e){return request({'method':_0x8055('0x7'),'form':{'method':'login','input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON[_0x8055('0x1f')]({'user_auth':{'user_name':_0x48367e['username'],'password':_0x48367e[_0x8055('0x48')],'encryption':_0x8055('0x49')},'application':_0x8055('0x4a')})}})[_0x8055('0x33')](function(_0x3472d6){var _0x3f4103=_0x3472d6;if(_0x3f4103['id']){def[_0x8055('0x4b')]=_0x3f4103['id'];return BPromise[_0x8055('0x29')](_0x3f4103);}else{throw new Error(util[_0x8055('0x21')](_0x8055('0x4c'),_0x48367e['id']));}});}function setRelationship(_0x5cd024,_0x961c3f,_0x25fb0c,_0x3d7b13){return request({'form':{'method':_0x8055('0x4d'),'input_type':_0x8055('0x1e'),'response_type':_0x8055('0x1e'),'rest_data':JSON[_0x8055('0x1f')]({'session':_0x5cd024['id'],'module_name':'Calls','module_id':_0x25fb0c['id'],'link_field_name':_0x3d7b13,'related_ids':[_0x961c3f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8055('0x4e')]=function(_0x43eeb8,_0x2ba69e,_0x40745d,_0xf3dc6c,_0x5c68e9,_0xf83f6e){var _0x4146ae,_0x3010f0,_0x2fa0b8,_0x3176cd;_0xf83f6e[_0x8055('0x4f')]=intUtil[_0x8055('0x50')](_0xf83f6e[_0x8055('0x4f')]);_0xf83f6e[_0x8055('0x51')]=intUtil[_0x8055('0x50')](_0xf83f6e[_0x8055('0x51')]);def[_0x8055('0x52')]=util[_0x8055('0x21')]('%s/service/v4_1/rest.php',_0xf83f6e['remoteUri']);if(_0x5c68e9&&_0x5c68e9[_0x8055('0x53')]){logger[_0x8055('0x9')]('[QUEUE]',_0x8055('0x54'));_0x2ba69e[_0x8055('0x55')]=util[_0x8055('0x21')](_0x8055('0x56'),_0xf83f6e[_0x8055('0x51')],_0x2ba69e[_0x8055('0x57')],md5(_0x2ba69e[_0x8055('0x57')]));}else{_0x2ba69e[_0x8055('0x55')]='';}return getConnection(_0xf83f6e)[_0x8055('0x33')](function(_0x50d569){_0x3176cd=_0x50d569;return getUser(_0xf83f6e,_0xf3dc6c[_0x8055('0x25')],_0x3176cd);})['then'](function(_0x2554fd){_0x4146ae=_0x2554fd;logger['info']('The\x20User\x20ID\x20is:',_0x4146ae['id']);return getEndUser(_0xf83f6e,_0x2ba69e['calleridname'],_0x2ba69e[_0x8055('0x58')],_0x3176cd);})['then'](function(_0x5c28b9){_0x3010f0=_0x5c28b9;logger[_0x8055('0x9')]('The\x20Enduser\x20ID\x20is:',_0x3010f0['id']);return getTicket(_0xf83f6e,_0x4146ae,_0x3010f0,_0x40745d,_0x2ba69e,_0x40745d['Fields'],_0x3176cd,_0x8055('0x59'));})[_0x8055('0x33')](function(_0x2da201){_0x2fa0b8=_0x2da201;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2fa0b8['id']);return setRelationship(_0x3176cd,_0x4146ae,_0x2fa0b8,_0x8055('0x5a'));})[_0x8055('0x33')](function(){return setRelationship(_0x3176cd,_0x3010f0,_0x2fa0b8,_0x8055('0x5b'));})[_0x8055('0x33')](function(){return getServerInfo(_0x3176cd);})['then'](function(_0xa5628a){var _0x58057b=parseInt(_0xa5628a[_0x8055('0x5c')][_0x8055('0x5d')](0x0));var _0x433a07=util['format'](_0x8055('0x5e'),_0xf83f6e[_0x8055('0x4f')],_0x2fa0b8['id']);if(_0x58057b>0x6){_0x433a07=util[_0x8055('0x21')](_0x8055('0x5f'),_0xf83f6e[_0x8055('0x4f')],_0x2fa0b8['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8055('0x21')]('user:%s',_0xf3dc6c[_0x8055('0x25')]),'trigger:browser:url',{'uri':_0x433a07});})[_0x8055('0x60')](function(_0x4a472f){logger[_0x8055('0x61')](_0x8055('0x62'),JSON[_0x8055('0x1f')](_0x4a472f));});};exports[_0x8055('0x63')]=function(_0x15dfd2,_0x187208,_0x57743b,_0x41e579,_0x5dfe43,_0x4a4a15,_0x3c624e){var _0x3720bd,_0x195674,_0x391a65,_0x617bb0;_0x4a4a15[_0x8055('0x4f')]=intUtil[_0x8055('0x50')](_0x4a4a15[_0x8055('0x4f')]);_0x4a4a15['serverUrl']=intUtil['stripTrailingSlash'](_0x4a4a15[_0x8055('0x51')]);def['uri']=util['format'](_0x8055('0x64'),_0x4a4a15['remoteUri']);if(_0x3c624e&&_0x3c624e[_0x8055('0x65')]&&_0x3c624e['recordingFormat']!==_0x8055('0x66')){logger[_0x8055('0x9')]('[OUTBOUND]',_0x8055('0x54'));_0x187208['recordingURL']=util[_0x8055('0x21')](_0x8055('0x56'),_0x4a4a15[_0x8055('0x51')],_0x187208[_0x8055('0x57')],md5(_0x187208[_0x8055('0x57')]));}return getConnection(_0x4a4a15)[_0x8055('0x33')](function(_0x28b2ce){_0x617bb0=_0x28b2ce;return getUser(_0x4a4a15,_0x41e579[_0x8055('0x25')],_0x617bb0);})['then'](function(_0xc5bad){_0x3720bd=_0xc5bad;logger['info']('The\x20User\x20ID\x20is:',_0x3720bd['id']);return getEndUser(_0x4a4a15,_0x187208[_0x8055('0x67')],_0x187208[_0x8055('0x68')],_0x617bb0);})[_0x8055('0x33')](function(_0x54fbbf){_0x195674=_0x54fbbf;logger['info'](_0x8055('0x69'),_0x195674['id']);return getTicket(_0x4a4a15,_0x3720bd,_0x195674,_0x57743b,_0x187208,_0x57743b[_0x8055('0x6a')],_0x617bb0,_0x8055('0x6b'));})['then'](function(_0x5af225){_0x391a65=_0x5af225;logger[_0x8055('0x9')]('Ticket\x20created!');logger[_0x8055('0x9')](_0x8055('0x6c'),_0x391a65['id']);return setRelationship(_0x617bb0,_0x3720bd,_0x391a65,_0x8055('0x5a'));})[_0x8055('0x33')](function(){return setRelationship(_0x617bb0,_0x195674,_0x391a65,_0x8055('0x5b'));})[_0x8055('0x33')](function(){return getServerInfo(_0x617bb0);})[_0x8055('0x33')](function(_0x3ee7f9){var _0x3e5f4a=parseInt(_0x3ee7f9[_0x8055('0x5c')][_0x8055('0x5d')](0x0));var _0x234fa2=util[_0x8055('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4a4a15[_0x8055('0x4f')],_0x391a65['id']);if(_0x3e5f4a>0x6){_0x234fa2=util[_0x8055('0x21')](_0x8055('0x5f'),_0x4a4a15[_0x8055('0x4f')],_0x391a65['id']);}logger['info']('[OUTBOUND]',_0x8055('0x6d'));emit(util['format']('user:%s',_0x41e579['name']),_0x8055('0x6e'),{'uri':_0x234fa2});})[_0x8055('0x60')](function(_0x2e3bf9){logger[_0x8055('0x61')](_0x8055('0x6f'),JSON[_0x8055('0x1f')](_0x2e3bf9));});};exports['unmanaged']=function(_0xcdaf3a,_0x5741c5,_0x52cc15,_0x473f54,_0x4726af,_0x5a792b){var _0x22bca1,_0x5080cd,_0x37bf68,_0x38c442;_0x5a792b[_0x8055('0x4f')]=intUtil[_0x8055('0x50')](_0x5a792b[_0x8055('0x4f')]);_0x5a792b['serverUrl']=intUtil[_0x8055('0x50')](_0x5a792b[_0x8055('0x51')]);def[_0x8055('0x52')]=util[_0x8055('0x21')](_0x8055('0x64'),_0x5a792b[_0x8055('0x4f')]);if(_0x4726af&&_0x4726af[_0x8055('0x53')]){logger[_0x8055('0x9')]('['+_0x5741c5[_0x8055('0x70')][_0x8055('0x71')]()+']',_0x8055('0x54'));_0x5741c5['recordingURL']=util[_0x8055('0x21')](_0x8055('0x56'),_0x5a792b[_0x8055('0x51')],_0x5741c5['uniqueid'],md5(_0x5741c5['uniqueid']));}else{_0x5741c5['recordingURL']='';}return getConnection(_0x5a792b)[_0x8055('0x33')](function(_0x17a2dc){_0x38c442=_0x17a2dc;if(!_[_0x8055('0x72')](_0x473f54)){return getUser(_0x5a792b,_0x473f54['name'],_0x38c442);}else{return getUser(_0x5a792b,null,_0x38c442);}})['then'](function(_0x3d6c6d){_0x22bca1=_0x3d6c6d;logger[_0x8055('0x9')](_0x8055('0x73'),_0x22bca1['id']);return getEndUser(_0x5a792b,_0x5741c5[_0x8055('0x74')],_0x5741c5['calleridnum'],_0x38c442);})['then'](function(_0x20c091){_0x5080cd=_0x20c091;logger['info'](_0x8055('0x69'),_0x5080cd['id']);return getTicket(_0x5a792b,_0x22bca1,_0x5080cd,_0x52cc15,_0x5741c5,_0x52cc15['Fields'],_0x38c442,_0x8055('0x59'));})[_0x8055('0x33')](function(_0x1efac6){_0x37bf68=_0x1efac6;logger[_0x8055('0x9')](_0x8055('0x75'));logger[_0x8055('0x9')](_0x8055('0x6c'),_0x37bf68['id']);return setRelationship(_0x38c442,_0x22bca1,_0x37bf68,_0x8055('0x5a'));})[_0x8055('0x33')](function(){return setRelationship(_0x38c442,_0x5080cd,_0x37bf68,_0x8055('0x5b'));})['then'](function(){return getServerInfo(_0x38c442);})[_0x8055('0x60')](function(_0x252436){logger[_0x8055('0x61')]('['+_0x5741c5[_0x8055('0x70')][_0x8055('0x71')]()+']',JSON[_0x8055('0x1f')](_0x252436));});}; \ 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 e9aa782..b56e72a 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 _0x8f8d=['content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','string','key','format','keyContent','%s:\x20%s','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type'];(function(_0x3136fa,_0x179312){var _0x4fdecb=function(_0x4b7c9d){while(--_0x4b7c9d){_0x3136fa['push'](_0x3136fa['shift']());}};_0x4fdecb(++_0x179312);}(_0x8f8d,0x7d));var _0xd8f8=function(_0x192f67,_0x31a74e){_0x192f67=_0x192f67-0x0;var _0x5ebd7c=_0x8f8d[_0x192f67];return _0x5ebd7c;};'use strict';var _=require(_0xd8f8('0x0'));var util=require(_0xd8f8('0x1'));exports[_0xd8f8('0x2')]=function(_0x429c25,_0x308af1,_0x484625){var _0x27eac7=[];if(_0x429c25[_0xd8f8('0x3')]>0x0){var _0x59c28b=_['sortBy'](_0x429c25,['id']);for(var _0x5a440d=0x0;_0x5a440d<_0x59c28b[_0xd8f8('0x3')];_0x5a440d++){var _0x3b8aad=_0x59c28b[_0x5a440d];if(_0x3b8aad[_0xd8f8('0x4')]==='string'){_0x27eac7['push'](_0x3b8aad[_0xd8f8('0x5')]);}else if(_0x3b8aad[_0xd8f8('0x4')]===_0xd8f8('0x6')&&_0x3b8aad[_0xd8f8('0x7')]){_0x308af1[_0x3b8aad['variableName']]&&_0x27eac7[_0xd8f8('0x8')](_0x308af1[_0x3b8aad[_0xd8f8('0x7')]][_0xd8f8('0x9')]());}else if(_0x3b8aad[_0xd8f8('0x4')]===_0xd8f8('0xa')&&_0x3b8aad['Variable']&&_0x3b8aad[_0xd8f8('0xb')][_0xd8f8('0xc')]){_0x308af1[_0x3b8aad['Variable'][_0xd8f8('0xc')][_0xd8f8('0xd')]()]&&_0x27eac7[_0xd8f8('0x8')](_0x308af1[_0x3b8aad[_0xd8f8('0xb')][_0xd8f8('0xc')][_0xd8f8('0xd')]()][_0xd8f8('0x9')]());}else if(_0x3b8aad[_0xd8f8('0x4')]==='keyValue'){if(_0x3b8aad[_0xd8f8('0xe')]===_0xd8f8('0xf')&&_0x3b8aad[_0xd8f8('0x10')]){_0x27eac7['push'](util[_0xd8f8('0x11')]('%s:\x20%s',_0x3b8aad[_0xd8f8('0x10')],_0x3b8aad[_0xd8f8('0x12')]));}else if(_0x3b8aad[_0xd8f8('0xe')]===_0xd8f8('0x6')&&_0x3b8aad[_0xd8f8('0x7')]&&_0x3b8aad[_0xd8f8('0x10')]){_0x308af1[_0x3b8aad[_0xd8f8('0x7')]]&&_0x27eac7[_0xd8f8('0x8')](util[_0xd8f8('0x11')](_0xd8f8('0x13'),_0x3b8aad['key'],_0x308af1[_0x3b8aad[_0xd8f8('0x7')]]));}else if(_0x3b8aad[_0xd8f8('0xe')]==='customVariable'&&_0x3b8aad[_0xd8f8('0xb')]&&_0x3b8aad[_0xd8f8('0xb')]['name']&&_0x3b8aad[_0xd8f8('0x10')]){_0x308af1[_0x3b8aad[_0xd8f8('0xb')][_0xd8f8('0xc')][_0xd8f8('0xd')]()]&&_0x27eac7['push'](util[_0xd8f8('0x11')](_0xd8f8('0x13'),_0x3b8aad['key'],_0x308af1[_0x3b8aad[_0xd8f8('0xb')]['name']['toLowerCase']()]));}}}}return _0x27eac7['join'](_0x484625);};exports[_0xd8f8('0x14')]=function(_0x4c90b1){var _0x4f5021=_0x4c90b1[_0xd8f8('0x15')](-0x1);if(_0x4f5021==='/'){_0x4c90b1=_0x4c90b1[_0xd8f8('0x16')](0x0,_0x4c90b1['lastIndexOf'](_0x4f5021));}return _0x4c90b1;};exports[_0xd8f8('0x17')]=function(_0x239127){if(!_[_0xd8f8('0x18')](_0x239127)&&_0x239127!==''){var _0x4e8324=/^(([^<>()\[\]\\.,;:\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 _0x4e8324[_0xd8f8('0x19')](String(_0x239127)[_0xd8f8('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x01d5=['stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','key','format','%s:\x20%s','keyType','customVariable','join'];(function(_0x14b1aa,_0xda93f6){var _0x51b55e=function(_0x225326){while(--_0x225326){_0x14b1aa['push'](_0x14b1aa['shift']());}};_0x51b55e(++_0xda93f6);}(_0x01d5,0xd6));var _0x501d=function(_0x39d058,_0x5da013){_0x39d058=_0x39d058-0x0;var _0x40a174=_0x01d5[_0x39d058];return _0x40a174;};'use strict';var _=require('lodash');var util=require(_0x501d('0x0'));exports[_0x501d('0x1')]=function(_0x75e5c6,_0x4a3641,_0xb133d5){var _0x17edaf=[];if(_0x75e5c6[_0x501d('0x2')]>0x0){var _0x40e19a=_[_0x501d('0x3')](_0x75e5c6,['id']);for(var _0x2bda05=0x0;_0x2bda05<_0x40e19a[_0x501d('0x2')];_0x2bda05++){var _0x4c184b=_0x40e19a[_0x2bda05];if(_0x4c184b[_0x501d('0x4')]===_0x501d('0x5')){_0x17edaf[_0x501d('0x6')](_0x4c184b[_0x501d('0x7')]);}else if(_0x4c184b['type']===_0x501d('0x8')&&_0x4c184b['variableName']){_0x4a3641[_0x4c184b[_0x501d('0x9')]]&&_0x17edaf[_0x501d('0x6')](_0x4a3641[_0x4c184b[_0x501d('0x9')]][_0x501d('0xa')]());}else if(_0x4c184b['type']==='customVariable'&&_0x4c184b[_0x501d('0xb')]&&_0x4c184b['Variable'][_0x501d('0xc')]){_0x4a3641[_0x4c184b['Variable'][_0x501d('0xc')][_0x501d('0xd')]()]&&_0x17edaf[_0x501d('0x6')](_0x4a3641[_0x4c184b[_0x501d('0xb')][_0x501d('0xc')][_0x501d('0xd')]()][_0x501d('0xa')]());}else if(_0x4c184b[_0x501d('0x4')]==='keyValue'){if(_0x4c184b['keyType']===_0x501d('0x5')&&_0x4c184b[_0x501d('0xe')]){_0x17edaf[_0x501d('0x6')](util[_0x501d('0xf')](_0x501d('0x10'),_0x4c184b[_0x501d('0xe')],_0x4c184b['keyContent']));}else if(_0x4c184b[_0x501d('0x11')]===_0x501d('0x8')&&_0x4c184b[_0x501d('0x9')]&&_0x4c184b['key']){_0x4a3641[_0x4c184b[_0x501d('0x9')]]&&_0x17edaf[_0x501d('0x6')](util[_0x501d('0xf')](_0x501d('0x10'),_0x4c184b['key'],_0x4a3641[_0x4c184b['variableName']]));}else if(_0x4c184b[_0x501d('0x11')]===_0x501d('0x12')&&_0x4c184b['Variable']&&_0x4c184b[_0x501d('0xb')][_0x501d('0xc')]&&_0x4c184b[_0x501d('0xe')]){_0x4a3641[_0x4c184b[_0x501d('0xb')]['name']['toLowerCase']()]&&_0x17edaf[_0x501d('0x6')](util['format'](_0x501d('0x10'),_0x4c184b[_0x501d('0xe')],_0x4a3641[_0x4c184b[_0x501d('0xb')]['name'][_0x501d('0xd')]()]));}}}}return _0x17edaf[_0x501d('0x13')](_0xb133d5);};exports[_0x501d('0x14')]=function(_0x472bae){var _0x44801c=_0x472bae[_0x501d('0x15')](-0x1);if(_0x44801c==='/'){_0x472bae=_0x472bae[_0x501d('0x16')](0x0,_0x472bae['lastIndexOf'](_0x44801c));}return _0x472bae;};exports[_0x501d('0x17')]=function(_0x16fa06){if(!_[_0x501d('0x18')](_0x16fa06)&&_0x16fa06!==''){var _0x45a2da=/^(([^<>()\[\]\\.,;:\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 _0x45a2da[_0x501d('0x19')](String(_0x16fa06)[_0x501d('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 fb20284..0cce6df 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(_0x2bcede,_0x351c5d){var _0x137209=function(_0x176030){while(--_0x176030){_0x2bcede['push'](_0x2bcede['shift']());}};_0x137209(++_0x351c5d);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x187c7f,_0x17bb75){var _0x291034=function(_0x4c472c){while(--_0x4c472c){_0x187c7f['push'](_0x187c7f['shift']());}};_0x291034(++_0x17bb75);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 414673b..17dab10 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 _0x3f43=['Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','push','variableName','custom_fields','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','inspect','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user'];(function(_0x394def,_0xbbc89){var _0x94bbfc=function(_0x10c69f){while(--_0x10c69f){_0x394def['push'](_0x394def['shift']());}};_0x94bbfc(++_0xbbc89);}(_0x3f43,0xb7));var _0x33f4=function(_0x44a3b6,_0x34b10b){_0x44a3b6=_0x44a3b6-0x0;var _0x479ea4=_0x3f43[_0x44a3b6];return _0x479ea4;};'use strict';var _=require(_0x33f4('0x0'));var rp=require('request-promise');var md5=require(_0x33f4('0x1'));var util=require(_0x33f4('0x2'));var Redis=require(_0x33f4('0x3'));var intUtil=require('./util');var config=require(_0x33f4('0x4'));var logger=require(_0x33f4('0x5'))(_0x33f4('0x6'));config[_0x33f4('0x7')]=_[_0x33f4('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x33f4('0x9'))(new Redis(config['redis']));function emit(_0x34f13a,_0x10a016,_0x435584){io['to'](_0x34f13a)[_0x33f4('0xa')](_0x10a016,_0x435584);}var headers={'Content-Type':_0x33f4('0xb'),'Accept':'application/json'};function getTicket(_0x34763,_0x29e753,_0x2d63cb,_0x450c93,_0x43d700){logger[_0x33f4('0xc')](_0x33f4('0xd'));return request({'uri':util[_0x33f4('0xe')](_0x33f4('0xf'),_0x34763[_0x33f4('0x10')]),'method':'POST','body':{'ticket':_[_0x33f4('0x11')]({'requester_id':_0x2d63cb['id'],'submitter_id':_0x29e753?_0x29e753['id']:undefined,'assignee_id':_0x29e753?_0x29e753['id']:undefined,'tags':getTags(_0x450c93['Tags'],'name'),'subject':intUtil[_0x33f4('0x12')](_0x450c93['Subjects'],_0x43d700,'\x20'),'description':intUtil[_0x33f4('0x12')](_0x450c93[_0x33f4('0x13')],_0x43d700,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x450c93[_0x33f4('0x13')],_0x43d700,'\x0a')}},getCustomFields(_0x450c93[_0x33f4('0x14')],_0x43d700))}})[_0x33f4('0x15')](function(_0x29d389){logger['info']('Ticket\x20created!');return _0x29d389[_0x33f4('0x16')];});}function getUser(_0x34b6be,_0x4de2ef){if(intUtil[_0x33f4('0x17')](_0x4de2ef)){logger[_0x33f4('0xc')](_0x33f4('0x18'),_0x4de2ef);return request({'uri':util['format'](_0x33f4('0x19'),_0x34b6be[_0x33f4('0x10')]),'qs':{'query':util[_0x33f4('0xe')]('type:user\x20role:agent\x20email:%s',_0x4de2ef)}})[_0x33f4('0x15')](function(_0x3c6592){if(_0x3c6592[_0x33f4('0x1a')]){logger[_0x33f4('0xc')]('Agent\x20found!');return _[_0x33f4('0x1b')](_0x3c6592['results'],{'email':_0x4de2ef,'role':_0x33f4('0x1c')});}else{logger[_0x33f4('0xc')](_0x33f4('0x1d'));return request({'uri':util[_0x33f4('0xe')](_0x33f4('0x1e'),_0x34b6be[_0x33f4('0x10')])})[_0x33f4('0x15')](function(_0xb2825f){logger[_0x33f4('0xc')](_0x33f4('0x1f'));return _0xb2825f[_0x33f4('0x20')];});}});}else{logger[_0x33f4('0xc')](_0x33f4('0x1d'));return request({'uri':util[_0x33f4('0xe')](_0x33f4('0x1e'),_0x34b6be[_0x33f4('0x10')])})[_0x33f4('0x15')](function(_0x509ee0){logger[_0x33f4('0xc')]('Admin\x20account\x20selected.');return _0x509ee0['user'];});}}function getEndUser(_0x11b507,_0xc99ed5,_0x1ebfa7){logger[_0x33f4('0xc')](_0x33f4('0x21'),_0x1ebfa7);return request({'uri':util['format'](_0x33f4('0x19'),_0x11b507[_0x33f4('0x10')]),'qs':{'query':util[_0x33f4('0xe')](_0x33f4('0x22'),_0x1ebfa7)}})['then'](function(_0x439a30){var _0x4aab8d;if(_0x439a30[_0x33f4('0x23')][_0x33f4('0x24')]){_0x439a30['results']=_['filter'](_0x439a30['results'],{'suspended':![],'role':_0x33f4('0x25')});if(_0x439a30[_0x33f4('0x23')][_0x33f4('0x24')]){_0x4aab8d=_[_0x33f4('0x26')](_0x439a30[_0x33f4('0x23')]);}}if(_0x4aab8d){logger['info']('Enduser\x20found!');return _0x4aab8d;}else{logger[_0x33f4('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x33f4('0xe')]('%s/users.json',_0x11b507['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x33f4('0xe')](_0x33f4('0x27'),_0xc99ed5||_0x1ebfa7),'phone':_0x1ebfa7}}})['then'](function(_0x3f5930){logger[_0x33f4('0xc')](_0x33f4('0x28'));return _0x3f5930['user'];});}});}function getAuth(_0x14633a){var _0x144a01;if(_0x14633a[_0x33f4('0x29')]==='password'){_0x144a01=util['format'](_0x33f4('0x2a'),_0x14633a[_0x33f4('0x2b')],_0x14633a[_0x33f4('0x2c')]);}else if(_0x14633a['authType']===_0x33f4('0x2d')){_0x144a01=util[_0x33f4('0xe')](_0x33f4('0x2e'),_0x14633a[_0x33f4('0x2b')],_0x14633a['token']);}return util[_0x33f4('0xe')](_0x33f4('0x2f'),new Buffer(_0x144a01)['toString'](_0x33f4('0x30')));}function request(_0x47cdf7){logger[_0x33f4('0x31')](_0x33f4('0x32'),JSON[_0x33f4('0x33')](_0x47cdf7));return rp(_['defaults'](_0x47cdf7,{'method':_0x33f4('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3abf58,_0x4714e1){var _0x33e0ce=[];if(_0x3abf58&&_0x3abf58[_0x33f4('0x24')]>0x0){_0x33e0ce=_[_0x33f4('0x35')](_0x3abf58,_0x4714e1);}return _0x33e0ce;}function getCustomFields(_0x508592,_0x26e41e){var _0x3326cf=[];var _0x319a15={'custom_fields':[]};if(_0x508592[_0x33f4('0x24')]>0x0){_['forEach'](_0x508592,function(_0x32fdb4){if(_[_0x33f4('0x36')]([_0x33f4('0x37'),_0x33f4('0x38')],_0x32fdb4[_0x33f4('0x39')])&&_0x32fdb4[_0x33f4('0x3a')]&&!_0x32fdb4[_0x33f4('0x3b')]){_0x319a15[_0x32fdb4['nameField'][_0x33f4('0x3c')]()]=_0x32fdb4[_0x33f4('0x3d')][_0x33f4('0x3e')]();}else if(_['includes'](['string','picklist'],_0x32fdb4[_0x33f4('0x39')])&&_0x32fdb4[_0x33f4('0x3f')]&&_0x32fdb4['customField']){_0x319a15['custom_fields'][_0x33f4('0x40')]({'id':_0x32fdb4['idField'],'value':_0x32fdb4['content'][_0x33f4('0x3e')]()});}else if(_0x32fdb4['type']==='variable'&&_0x32fdb4[_0x33f4('0x41')]&&_0x32fdb4['idField']&&_0x32fdb4['customField']){_0x26e41e[_0x32fdb4[_0x33f4('0x41')]]&&_0x319a15[_0x33f4('0x42')][_0x33f4('0x40')]({'id':_0x32fdb4[_0x33f4('0x3f')],'value':_0x26e41e[_0x32fdb4[_0x33f4('0x41')]][_0x33f4('0x3e')]()});}else if(_0x32fdb4[_0x33f4('0x39')]==='customVariable'&&_0x32fdb4[_0x33f4('0x43')]&&_0x32fdb4[_0x33f4('0x43')][_0x33f4('0x44')]&&_0x32fdb4[_0x33f4('0x3f')]&&_0x32fdb4[_0x33f4('0x3b')]){_0x26e41e[_0x32fdb4[_0x33f4('0x43')][_0x33f4('0x44')][_0x33f4('0x3c')]()]&&_0x319a15[_0x33f4('0x42')][_0x33f4('0x40')]({'id':_0x32fdb4['idField'],'value':_0x26e41e[_0x32fdb4['Variable'][_0x33f4('0x44')][_0x33f4('0x3c')]()][_0x33f4('0x3e')]()});}});}return _0x319a15;}exports[_0x33f4('0x45')]=function(_0x73c250,_0x1ab287,_0x4b24c8,_0x49c19c,_0x65ba0d,_0x33503e){var _0x4f141e,_0x5bc4d9;_0x33503e['remoteUri']=intUtil['stripTrailingSlash'](_0x33503e['remoteUri']);_0x33503e['serverUrl']=intUtil[_0x33f4('0x46')](_0x33503e[_0x33f4('0x47')]);if(_0x65ba0d&&_0x65ba0d[_0x33f4('0x48')]){logger[_0x33f4('0xc')](_0x33f4('0x49'),_0x33f4('0x4a'));_0x1ab287['recordingURL']=util['format'](_0x33f4('0x4b'),_0x33503e[_0x33f4('0x47')],_0x1ab287[_0x33f4('0x4c')],md5(_0x1ab287['uniqueid']));}else{_0x1ab287['recordingURL']='';}headers['Authorization']=getAuth(_0x33503e);return getUser(_0x33503e,_0x49c19c[_0x33f4('0x4d')])['then'](function(_0x248380){_0x4f141e=_0x248380;logger[_0x33f4('0xc')](_0x33f4('0x4e'),_0x4f141e['id']);return getEndUser(_0x33503e,_0x1ab287['calleridname'],_0x1ab287[_0x33f4('0x4f')]);})[_0x33f4('0x15')](function(_0x4b7a2d){_0x5bc4d9=_0x4b7a2d;logger[_0x33f4('0xc')](_0x33f4('0x50'),_0x5bc4d9['id']);return getTicket(_0x33503e,_0x4f141e,_0x5bc4d9,_0x4b24c8,_0x1ab287);})['then'](function(_0x197de3){if(_0x197de3){logger[_0x33f4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x197de3['id']);switch(_0x33503e[_0x33f4('0x39')]){case _0x33f4('0x51'):logger[_0x33f4('0xc')](_0x33f4('0x49'),_0x33f4('0x52'));return request({'uri':util[_0x33f4('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x33503e[_0x33f4('0x10')],_0x4f141e['id'],_0x197de3['id']),'method':_0x33f4('0x53')});case _0x33f4('0x54'):logger['info'](_0x33f4('0x49'),_0x33f4('0x55'));emit(util[_0x33f4('0xe')](_0x33f4('0x56'),_0x49c19c[_0x33f4('0x44')]),_0x33f4('0x57'),{'uri':util[_0x33f4('0xe')](_0x33f4('0x58'),_0x33503e[_0x33f4('0x10')][_0x33f4('0x59')](_0x33f4('0x5a'),''),_0x197de3['id'])});break;default:logger['error']('[QUEUE]',_0x33f4('0x5b'));}}})[_0x33f4('0x5c')](function(_0x4c0800){logger[_0x33f4('0x5d')](_0x33f4('0x5e'),util['inspect'](_0x4c0800,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x402402,_0x22824b,_0x494fdb,_0x537a47,_0x517131,_0x5c2401,_0x216f3c){var _0x1b337d,_0xd1db9c;_0x5c2401[_0x33f4('0x10')]=intUtil['stripTrailingSlash'](_0x5c2401['remoteUri']);_0x5c2401['serverUrl']=intUtil[_0x33f4('0x46')](_0x5c2401[_0x33f4('0x47')]);if(_0x216f3c&&_0x216f3c[_0x33f4('0x5f')]&&_0x216f3c[_0x33f4('0x5f')]!==_0x33f4('0x60')){logger[_0x33f4('0xc')]('[OUTBOUND]',_0x33f4('0x4a'));_0x22824b[_0x33f4('0x61')]=util['format'](_0x33f4('0x4b'),_0x5c2401[_0x33f4('0x47')],_0x22824b[_0x33f4('0x4c')],md5(_0x22824b[_0x33f4('0x4c')]));}headers['Authorization']=getAuth(_0x5c2401);return getUser(_0x5c2401,_0x537a47[_0x33f4('0x4d')])['then'](function(_0x500aac){_0x1b337d=_0x500aac;logger['info']('The\x20User\x20ID\x20is:',_0x1b337d['id']);return getEndUser(_0x5c2401,_0x22824b[_0x33f4('0x62')],_0x22824b[_0x33f4('0x63')]);})['then'](function(_0x348e1b){_0xd1db9c=_0x348e1b;logger[_0x33f4('0xc')](_0x33f4('0x50'),_0xd1db9c['id']);return getTicket(_0x5c2401,_0x1b337d,_0xd1db9c,_0x494fdb,_0x22824b);})['then'](function(_0xebb0b2){if(_0xebb0b2){logger[_0x33f4('0xc')]('The\x20Ticket\x20ID\x20is:',_0xebb0b2['id']);switch(_0x5c2401[_0x33f4('0x39')]){case'integrationTab':logger[_0x33f4('0xc')](_0x33f4('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x33f4('0xe')](_0x33f4('0x65'),_0x5c2401[_0x33f4('0x10')],_0x1b337d['id'],_0xebb0b2['id']),'method':_0x33f4('0x53')});case _0x33f4('0x54'):logger['info'](_0x33f4('0x64'),_0x33f4('0x55'));emit(util[_0x33f4('0xe')]('user:%s',_0x537a47[_0x33f4('0x44')]),_0x33f4('0x57'),{'uri':util['format'](_0x33f4('0x58'),_0x5c2401[_0x33f4('0x10')]['replace'](_0x33f4('0x5a'),''),_0xebb0b2['id'])});break;default:logger[_0x33f4('0x5d')](_0x33f4('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x20e5c3){logger[_0x33f4('0x5d')](_0x33f4('0x66'),util['inspect'](_0x20e5c3,{'showHidden':!![],'depth':null}));});};exports[_0x33f4('0x67')]=function(_0x4a120,_0x1c1c0c,_0x4c19e3,_0x39a6e7,_0x1996d0,_0x2fe0d4){var _0xeaf258,_0x2b4ef8;_0x2fe0d4[_0x33f4('0x10')]=intUtil[_0x33f4('0x46')](_0x2fe0d4[_0x33f4('0x10')]);_0x2fe0d4[_0x33f4('0x47')]=intUtil[_0x33f4('0x46')](_0x2fe0d4['serverUrl']);if(_0x1996d0&&_0x1996d0[_0x33f4('0x48')]){logger['info']('['+_0x1c1c0c[_0x33f4('0x68')][_0x33f4('0x69')]()+']',_0x33f4('0x4a'));_0x1c1c0c[_0x33f4('0x61')]=util[_0x33f4('0xe')](_0x33f4('0x4b'),_0x2fe0d4[_0x33f4('0x47')],_0x1c1c0c[_0x33f4('0x4c')],md5(_0x1c1c0c[_0x33f4('0x4c')]));}else{_0x1c1c0c['recordingURL']='';}headers['Authorization']=getAuth(_0x2fe0d4);return getUser(_0x2fe0d4)[_0x33f4('0x15')](function(_0x13742a){_0xeaf258=_0x13742a;logger[_0x33f4('0xc')](_0x33f4('0x4e'),_0xeaf258['id']);return getEndUser(_0x2fe0d4,_0x1c1c0c['calleridname'],_0x1c1c0c[_0x33f4('0x4f')]);})['then'](function(_0x3d5e1d){_0x2b4ef8=_0x3d5e1d;logger[_0x33f4('0xc')](_0x33f4('0x50'),_0x2b4ef8['id']);return getTicket(_0x2fe0d4,_0xeaf258,_0x2b4ef8,_0x4c19e3,_0x1c1c0c);})[_0x33f4('0x15')](function(_0x1d3cac){if(_0x1d3cac){logger[_0x33f4('0xc')](_0x33f4('0x6a'),_0x1d3cac['id']);}})['catch'](function(_0x32882a){logger[_0x33f4('0x5d')]('['+_0x1c1c0c[_0x33f4('0x68')][_0x33f4('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x33f4('0x6b')](_0x32882a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8365=['push','content','variable','variableName','custom_fields','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','[OUTBOUND]','recordingURL','email','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','map','includes','picklist','type','nameField','toLowerCase','idField','customField'];(function(_0x552b08,_0x8fbec8){var _0x145d1b=function(_0x4ec2d2){while(--_0x4ec2d2){_0x552b08['push'](_0x552b08['shift']());}};_0x145d1b(++_0x8fbec8);}(_0x8365,0x105));var _0x5836=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x8365[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x5836('0x0'));var rp=require(_0x5836('0x1'));var md5=require('md5');var util=require(_0x5836('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5836('0x3'));var config=require(_0x5836('0x4'));var logger=require(_0x5836('0x5'))('zendesk');config[_0x5836('0x6')]=_[_0x5836('0x7')](config[_0x5836('0x6')],{'host':_0x5836('0x8'),'port':0x18eb});var io=require(_0x5836('0x9'))(new Redis(config[_0x5836('0x6')]));function emit(_0x40dd1a,_0x20719c,_0x6a9a21){io['to'](_0x40dd1a)[_0x5836('0xa')](_0x20719c,_0x6a9a21);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x377d3e,_0x153cb5,_0xc10399,_0x5dd7cc,_0x1f07aa){logger[_0x5836('0xb')](_0x5836('0xc'));return request({'uri':util[_0x5836('0xd')](_0x5836('0xe'),_0x377d3e['remoteUri']),'method':_0x5836('0xf'),'body':{'ticket':_[_0x5836('0x10')]({'requester_id':_0xc10399['id'],'submitter_id':_0x153cb5?_0x153cb5['id']:undefined,'assignee_id':_0x153cb5?_0x153cb5['id']:undefined,'tags':getTags(_0x5dd7cc[_0x5836('0x11')],_0x5836('0x12')),'subject':intUtil[_0x5836('0x13')](_0x5dd7cc[_0x5836('0x14')],_0x1f07aa,'\x20'),'description':intUtil[_0x5836('0x13')](_0x5dd7cc[_0x5836('0x15')],_0x1f07aa,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5dd7cc['Descriptions'],_0x1f07aa,'\x0a')}},getCustomFields(_0x5dd7cc[_0x5836('0x16')],_0x1f07aa))}})[_0x5836('0x17')](function(_0x242e8d){logger['info'](_0x5836('0x18'));return _0x242e8d[_0x5836('0x19')];});}function getUser(_0x1352e4,_0x3e40d1){if(intUtil[_0x5836('0x1a')](_0x3e40d1)){logger['info']('Getting\x20agent\x20with\x20email',_0x3e40d1);return request({'uri':util[_0x5836('0xd')](_0x5836('0x1b'),_0x1352e4[_0x5836('0x1c')]),'qs':{'query':util[_0x5836('0xd')]('type:user\x20role:agent\x20email:%s',_0x3e40d1)}})[_0x5836('0x17')](function(_0x2ba245){if(_0x2ba245[_0x5836('0x1d')]){logger[_0x5836('0xb')](_0x5836('0x1e'));return _['find'](_0x2ba245[_0x5836('0x1f')],{'email':_0x3e40d1,'role':'agent'});}else{logger['info'](_0x5836('0x20'));return request({'uri':util[_0x5836('0xd')]('%s/users/me.json',_0x1352e4[_0x5836('0x1c')])})[_0x5836('0x17')](function(_0x3140a3){logger[_0x5836('0xb')]('Admin\x20account\x20selected.');return _0x3140a3['user'];});}});}else{logger[_0x5836('0xb')](_0x5836('0x20'));return request({'uri':util[_0x5836('0xd')](_0x5836('0x21'),_0x1352e4['remoteUri'])})[_0x5836('0x17')](function(_0x24cec8){logger['info'](_0x5836('0x22'));return _0x24cec8['user'];});}}function getEndUser(_0x386920,_0x585323,_0x638d4a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x638d4a);return request({'uri':util['format'](_0x5836('0x1b'),_0x386920[_0x5836('0x1c')]),'qs':{'query':util[_0x5836('0xd')](_0x5836('0x23'),_0x638d4a)}})['then'](function(_0x2c1b89){var _0xe0e64c;if(_0x2c1b89[_0x5836('0x1f')][_0x5836('0x24')]){_0x2c1b89['results']=_[_0x5836('0x25')](_0x2c1b89[_0x5836('0x1f')],{'suspended':![],'role':_0x5836('0x26')});if(_0x2c1b89[_0x5836('0x1f')]['length']){_0xe0e64c=_['first'](_0x2c1b89[_0x5836('0x1f')]);}}if(_0xe0e64c){logger[_0x5836('0xb')](_0x5836('0x27'));return _0xe0e64c;}else{logger[_0x5836('0xb')](_0x5836('0x28'));return request({'uri':util[_0x5836('0xd')](_0x5836('0x29'),_0x386920[_0x5836('0x1c')]),'method':_0x5836('0xf'),'body':{'user':{'role':_0x5836('0x26'),'name':util[_0x5836('0xd')](_0x5836('0x2a'),_0x585323||_0x638d4a),'phone':_0x638d4a}}})[_0x5836('0x17')](function(_0xfac375){logger['info'](_0x5836('0x2b'));return _0xfac375[_0x5836('0x2c')];});}});}function getAuth(_0x2a5d82){var _0x5a3811;if(_0x2a5d82[_0x5836('0x2d')]===_0x5836('0x2e')){_0x5a3811=util['format']('%s:%s',_0x2a5d82[_0x5836('0x2f')],_0x2a5d82['password']);}else if(_0x2a5d82[_0x5836('0x2d')]===_0x5836('0x30')){_0x5a3811=util['format'](_0x5836('0x31'),_0x2a5d82[_0x5836('0x2f')],_0x2a5d82[_0x5836('0x30')]);}return util['format'](_0x5836('0x32'),new Buffer(_0x5a3811)[_0x5836('0x33')](_0x5836('0x34')));}function request(_0x5b1800){logger[_0x5836('0x35')]('[HTTP]',JSON[_0x5836('0x36')](_0x5b1800));return rp(_[_0x5836('0x7')](_0x5b1800,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4124a3,_0x5015c8){var _0x39ffd0=[];if(_0x4124a3&&_0x4124a3[_0x5836('0x24')]>0x0){_0x39ffd0=_[_0x5836('0x37')](_0x4124a3,_0x5015c8);}return _0x39ffd0;}function getCustomFields(_0x3c2d2a,_0x4734b6){var _0x25456d=[];var _0x3f1b0b={'custom_fields':[]};if(_0x3c2d2a[_0x5836('0x24')]>0x0){_['forEach'](_0x3c2d2a,function(_0x3f8149){if(_[_0x5836('0x38')](['string',_0x5836('0x39')],_0x3f8149[_0x5836('0x3a')])&&_0x3f8149[_0x5836('0x3b')]&&!_0x3f8149['customField']){_0x3f1b0b[_0x3f8149[_0x5836('0x3b')][_0x5836('0x3c')]()]=_0x3f8149['content'][_0x5836('0x33')]();}else if(_['includes'](['string',_0x5836('0x39')],_0x3f8149[_0x5836('0x3a')])&&_0x3f8149[_0x5836('0x3d')]&&_0x3f8149[_0x5836('0x3e')]){_0x3f1b0b['custom_fields'][_0x5836('0x3f')]({'id':_0x3f8149['idField'],'value':_0x3f8149[_0x5836('0x40')][_0x5836('0x33')]()});}else if(_0x3f8149[_0x5836('0x3a')]===_0x5836('0x41')&&_0x3f8149['variableName']&&_0x3f8149[_0x5836('0x3d')]&&_0x3f8149[_0x5836('0x3e')]){_0x4734b6[_0x3f8149[_0x5836('0x42')]]&&_0x3f1b0b[_0x5836('0x43')][_0x5836('0x3f')]({'id':_0x3f8149[_0x5836('0x3d')],'value':_0x4734b6[_0x3f8149[_0x5836('0x42')]][_0x5836('0x33')]()});}else if(_0x3f8149[_0x5836('0x3a')]===_0x5836('0x44')&&_0x3f8149[_0x5836('0x45')]&&_0x3f8149['Variable']['name']&&_0x3f8149['idField']&&_0x3f8149['customField']){_0x4734b6[_0x3f8149[_0x5836('0x45')][_0x5836('0x12')][_0x5836('0x3c')]()]&&_0x3f1b0b[_0x5836('0x43')]['push']({'id':_0x3f8149[_0x5836('0x3d')],'value':_0x4734b6[_0x3f8149[_0x5836('0x45')][_0x5836('0x12')]['toLowerCase']()][_0x5836('0x33')]()});}});}return _0x3f1b0b;}exports['queue']=function(_0x4b04ac,_0x11d093,_0x315fa6,_0x1ce644,_0x44597f,_0x1e2a54){var _0x47cb75,_0x157b4f;_0x1e2a54[_0x5836('0x1c')]=intUtil['stripTrailingSlash'](_0x1e2a54[_0x5836('0x1c')]);_0x1e2a54[_0x5836('0x46')]=intUtil[_0x5836('0x47')](_0x1e2a54[_0x5836('0x46')]);if(_0x44597f&&_0x44597f[_0x5836('0x48')]){logger[_0x5836('0xb')](_0x5836('0x49'),_0x5836('0x4a'));_0x11d093['recordingURL']=util[_0x5836('0xd')](_0x5836('0x4b'),_0x1e2a54['serverUrl'],_0x11d093[_0x5836('0x4c')],md5(_0x11d093[_0x5836('0x4c')]));}else{_0x11d093['recordingURL']='';}headers[_0x5836('0x4d')]=getAuth(_0x1e2a54);return getUser(_0x1e2a54,_0x1ce644['email'])['then'](function(_0xa3b7b2){_0x47cb75=_0xa3b7b2;logger['info'](_0x5836('0x4e'),_0x47cb75['id']);return getEndUser(_0x1e2a54,_0x11d093[_0x5836('0x4f')],_0x11d093[_0x5836('0x50')]);})['then'](function(_0x432b6e){_0x157b4f=_0x432b6e;logger[_0x5836('0xb')](_0x5836('0x51'),_0x157b4f['id']);return getTicket(_0x1e2a54,_0x47cb75,_0x157b4f,_0x315fa6,_0x11d093);})[_0x5836('0x17')](function(_0x59e764){if(_0x59e764){logger[_0x5836('0xb')](_0x5836('0x52'),_0x59e764['id']);switch(_0x1e2a54['type']){case'integrationTab':logger[_0x5836('0xb')](_0x5836('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5836('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1e2a54['remoteUri'],_0x47cb75['id'],_0x59e764['id']),'method':_0x5836('0xf')});case _0x5836('0x53'):logger[_0x5836('0xb')]('[QUEUE]',_0x5836('0x54'));emit(util[_0x5836('0xd')](_0x5836('0x55'),_0x1ce644[_0x5836('0x12')]),_0x5836('0x56'),{'uri':util[_0x5836('0xd')](_0x5836('0x57'),_0x1e2a54[_0x5836('0x1c')][_0x5836('0x58')]('/api/v2',''),_0x59e764['id'])});break;default:logger[_0x5836('0x59')]('[QUEUE]',_0x5836('0x5a'));}}})['catch'](function(_0x488501){logger[_0x5836('0x59')](_0x5836('0x5b'),util[_0x5836('0x5c')](_0x488501,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x550cab,_0x1a422f,_0xf7f38,_0x5f01d4,_0x2f1ab8,_0x30b8aa,_0x576852){var _0x14cea5,_0x5ee290;_0x30b8aa[_0x5836('0x1c')]=intUtil['stripTrailingSlash'](_0x30b8aa[_0x5836('0x1c')]);_0x30b8aa[_0x5836('0x46')]=intUtil['stripTrailingSlash'](_0x30b8aa[_0x5836('0x46')]);if(_0x576852&&_0x576852['recordingFormat']&&_0x576852[_0x5836('0x5d')]!=='none'){logger[_0x5836('0xb')](_0x5836('0x5e'),_0x5836('0x4a'));_0x1a422f[_0x5836('0x5f')]=util[_0x5836('0xd')](_0x5836('0x4b'),_0x30b8aa['serverUrl'],_0x1a422f[_0x5836('0x4c')],md5(_0x1a422f[_0x5836('0x4c')]));}headers[_0x5836('0x4d')]=getAuth(_0x30b8aa);return getUser(_0x30b8aa,_0x5f01d4[_0x5836('0x60')])['then'](function(_0x3fcb4e){_0x14cea5=_0x3fcb4e;logger[_0x5836('0xb')]('The\x20User\x20ID\x20is:',_0x14cea5['id']);return getEndUser(_0x30b8aa,_0x1a422f[_0x5836('0x61')],_0x1a422f[_0x5836('0x62')]);})[_0x5836('0x17')](function(_0xa4e560){_0x5ee290=_0xa4e560;logger[_0x5836('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5ee290['id']);return getTicket(_0x30b8aa,_0x14cea5,_0x5ee290,_0xf7f38,_0x1a422f);})[_0x5836('0x17')](function(_0x28a6be){if(_0x28a6be){logger['info'](_0x5836('0x52'),_0x28a6be['id']);switch(_0x30b8aa[_0x5836('0x3a')]){case _0x5836('0x63'):logger['info'](_0x5836('0x5e'),_0x5836('0x64'));return request({'uri':util[_0x5836('0xd')](_0x5836('0x65'),_0x30b8aa[_0x5836('0x1c')],_0x14cea5['id'],_0x28a6be['id']),'method':'POST'});case _0x5836('0x53'):logger[_0x5836('0xb')](_0x5836('0x5e'),_0x5836('0x54'));emit(util[_0x5836('0xd')](_0x5836('0x55'),_0x5f01d4['name']),_0x5836('0x56'),{'uri':util['format'](_0x5836('0x57'),_0x30b8aa['remoteUri'][_0x5836('0x58')](_0x5836('0x66'),''),_0x28a6be['id'])});break;default:logger[_0x5836('0x59')]('[OUTBOUND]',_0x5836('0x5a'));}}})[_0x5836('0x67')](function(_0x1135c1){logger[_0x5836('0x59')](_0x5836('0x68'),util[_0x5836('0x5c')](_0x1135c1,{'showHidden':!![],'depth':null}));});};exports[_0x5836('0x69')]=function(_0x1e7cf0,_0x21d38a,_0x581da1,_0x5092e6,_0x4aeea7,_0x4f90e8){var _0x5793ce,_0x2ba32d;_0x4f90e8[_0x5836('0x1c')]=intUtil[_0x5836('0x47')](_0x4f90e8[_0x5836('0x1c')]);_0x4f90e8['serverUrl']=intUtil[_0x5836('0x47')](_0x4f90e8['serverUrl']);if(_0x4aeea7&&_0x4aeea7[_0x5836('0x48')]){logger['info']('['+_0x21d38a['lastevent'][_0x5836('0x6a')]()+']',_0x5836('0x4a'));_0x21d38a['recordingURL']=util[_0x5836('0xd')](_0x5836('0x4b'),_0x4f90e8[_0x5836('0x46')],_0x21d38a['uniqueid'],md5(_0x21d38a[_0x5836('0x4c')]));}else{_0x21d38a[_0x5836('0x5f')]='';}headers[_0x5836('0x4d')]=getAuth(_0x4f90e8);return getUser(_0x4f90e8)['then'](function(_0x16624e){_0x5793ce=_0x16624e;logger[_0x5836('0xb')](_0x5836('0x4e'),_0x5793ce['id']);return getEndUser(_0x4f90e8,_0x21d38a[_0x5836('0x4f')],_0x21d38a['calleridnum']);})[_0x5836('0x17')](function(_0x4cc57b){_0x2ba32d=_0x4cc57b;logger[_0x5836('0xb')](_0x5836('0x51'),_0x2ba32d['id']);return getTicket(_0x4f90e8,_0x5793ce,_0x2ba32d,_0x581da1,_0x21d38a);})[_0x5836('0x17')](function(_0x4819b6){if(_0x4819b6){logger[_0x5836('0xb')](_0x5836('0x52'),_0x4819b6['id']);}})[_0x5836('0x67')](function(_0x2f9b95){logger[_0x5836('0x59')]('['+_0x21d38a['lastevent']['toUpperCase']()+']'+_0x5836('0x6b'),util['inspect'](_0x2f9b95,{'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 16dc3e2..49852eb 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 _0xf440=['timeout','outbound','format','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','log','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','/api/voice/recordings/','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','stack','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','enduserType','CREATE\x20ERROR','GET','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','abandoned'];(function(_0x11520f,_0x2545f8){var _0xe131cc=function(_0x33f86a){while(--_0x33f86a){_0x11520f['push'](_0x11520f['shift']());}};_0xe131cc(++_0x2545f8);}(_0xf440,0x1ee));var _0x0f44=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf440[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var rp=require(_0x0f44('0x0'));var md5=require(_0x0f44('0x1'));var util=require(_0x0f44('0x2'));var intUtil=require(_0x0f44('0x3'));var moment=require(_0x0f44('0x4'));var Redis=require(_0x0f44('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x0f44('0x6'))(_0x0f44('0x7'));config['redis']=_[_0x0f44('0x8')](config[_0x0f44('0x9')],{'host':_0x0f44('0xa'),'port':0x18eb});var io=require(_0x0f44('0xb'))(new Redis(config['redis']));function emit(_0x527f28,_0xfc8383,_0x336b80){io['to'](_0x527f28)[_0x0f44('0xc')](_0xfc8383,_0x336b80);}function request(_0x59fe15){logger[_0x0f44('0xd')](_0x0f44('0xe'),JSON[_0x0f44('0xf')](_0x59fe15));return rp(_0x59fe15);}function getCustomFields(_0x21f89f,_0x5f104f){var _0x300f1f={};if(_0x21f89f['length']>0x0){_['forEach'](_0x21f89f,function(_0xe28d11){if(_['includes']([_0x0f44('0x10'),_0x0f44('0x11')],_0xe28d11[_0x0f44('0x12')])&&_0xe28d11['idField']){_0x300f1f[_0xe28d11[_0x0f44('0x13')]]=_0xe28d11['content'][_0x0f44('0x14')]();}else if(_0xe28d11[_0x0f44('0x12')]===_0x0f44('0x15')&&_0xe28d11[_0x0f44('0x16')]&&_0xe28d11[_0x0f44('0x13')]&&_0x5f104f[_0xe28d11['variableName']]){_0x300f1f[_0xe28d11[_0x0f44('0x13')]]=_0x5f104f[_0xe28d11[_0x0f44('0x16')]][_0x0f44('0x14')]();}else if(_0xe28d11['type']==='customVariable'&&_0xe28d11[_0x0f44('0x17')]&&_0xe28d11[_0x0f44('0x17')][_0x0f44('0x18')]&&_0xe28d11[_0x0f44('0x13')]&&_0x5f104f[_0xe28d11[_0x0f44('0x17')][_0x0f44('0x18')][_0x0f44('0x19')]()]){_0x300f1f[_0xe28d11[_0x0f44('0x13')]]=_0x5f104f[_0xe28d11[_0x0f44('0x17')][_0x0f44('0x18')][_0x0f44('0x19')]()][_0x0f44('0x14')]();}});}return _0x300f1f;}function getName(_0x3a93e0){if(_0x3a93e0[_0x0f44('0x1a')]('\x20')>0x0){var _0x2a5b5a=_0x3a93e0[_0x0f44('0x1b')](/ (.+)/);if(_0x2a5b5a[0x1]){return _0x2a5b5a;}}return[_0x3a93e0,_0x3a93e0];}var accountsTokens={};function getAccessToken(_0x481f5f){return new Promise(function(_0x3a51ad,_0x4ed384){if(!_['isNil'](accountsTokens[_0x481f5f['id']])&&!_[_0x0f44('0x1c')](accountsTokens[_0x481f5f['id']][_0x0f44('0x1d')])){if(moment()[_0x0f44('0x1e')](accountsTokens[_0x481f5f['id']][_0x0f44('0x1f')])){_0x3a51ad(accountsTokens[_0x481f5f['id']][_0x0f44('0x1d')]);}}var _0x48f79b;switch(_0x481f5f[_0x0f44('0x20')]){case'US':_0x48f79b=_0x0f44('0x21');break;case'AU':_0x48f79b=_0x0f44('0x22');break;case'EU':_0x48f79b=_0x0f44('0x23');break;case'IN':_0x48f79b=_0x0f44('0x24');break;case'CN':_0x48f79b=_0x0f44('0x25');break;default:_0x48f79b=_0x0f44('0x23');break;}var _0xe60b0f={'method':'POST','uri':_0x48f79b+_0x0f44('0x26'),'qs':{'refresh_token':_0x481f5f[_0x0f44('0x27')],'client_id':_0x481f5f[_0x0f44('0x28')],'client_secret':_0x481f5f[_0x0f44('0x29')],'grant_type':_0x0f44('0x2a')},'json':!![]};return rp(_0xe60b0f)[_0x0f44('0x2b')](function(_0x23d146){accountsTokens[_0x481f5f['id']]={'access_token':_0x23d146['access_token'],'expires_in':moment()[_0x0f44('0x2c')](_0x23d146[_0x0f44('0x1f')],'seconds')};_0x3a51ad(_0x23d146[_0x0f44('0x1d')]);})[_0x0f44('0x2d')](function(_0xbdf34c){logger['error']('Failing\x20creating\x20the\x20access_token',_0xbdf34c[_0x0f44('0x2e')]);_0x4ed384(_0xbdf34c);});});}function getUser(_0x3600dc,_0x117dc8,_0x142943,_0x438696){logger['info'](_0x0f44('0x2f'));return request({'method':'GET','uri':util['format'](_0x0f44('0x30'),_0x117dc8),'qs':{'type':_0x0f44('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3600dc},'json':!![]})['then'](function(_0xe98bd2){if(_0xe98bd2[_0x0f44('0x32')]){var _0x145eb4=-0x1;if(_[_0x0f44('0x33')](_0xe98bd2['users'])){if(!_[_0x0f44('0x1c')](_0x438696)){_0x145eb4=_[_0x0f44('0x34')](_0xe98bd2[_0x0f44('0x32')],function(_0x5a3627){return _0x5a3627[_0x0f44('0x35')]===_0x438696;});}if(_0x145eb4>=0x0){logger[_0x0f44('0x36')](_0x0f44('0x37'));}else{logger['info'](_0x0f44('0x38'));_0x145eb4=_['findIndex'](_0xe98bd2['users'],function(_0x17a035){return _0x17a035[_0x0f44('0x39')][_0x0f44('0x18')]===_0x0f44('0x3a');});}return _0xe98bd2[_0x0f44('0x32')][_0x145eb4];}else{if(_0xe98bd2[_0x0f44('0x3b')][_0x0f44('0x39')]['name']==='Administrator'){logger[_0x0f44('0x36')]('Using\x20the\x20admin\x20account!');user=_0xe98bd2[_0x0f44('0x3b')];return user;}else{logger[_0x0f44('0x3c')](_0x0f44('0x3d'),JSON[_0x0f44('0xf')](_0xe98bd2));throw new Error(_0x0f44('0x3e')+JSON[_0x0f44('0xf')](_0xe98bd2));}}}else{logger[_0x0f44('0x3c')](_0x0f44('0x3d'),JSON['stringify'](_0xe98bd2));throw new Error(_0x0f44('0x3e')+JSON[_0x0f44('0xf')](_0xe98bd2));}})[_0x0f44('0x2d')](function(_0x2ad5bf){console['error'](_0x2ad5bf);});}function getZohoUser(_0x51d939,_0x537265){return new BPromise(function(_0x3d751d,_0x18146f){request(_0x51d939)[_0x0f44('0x2b')](function(_0x26c6bb){var _0x1dcee3=null;if(_0x26c6bb){_0x1dcee3=_0x26c6bb[_0x0f44('0x3f')][0x0];_0x1dcee3['enduserType']=_0x537265;}_0x3d751d(_0x1dcee3);})[_0x0f44('0x2d')](function(_0x121bc5){_0x18146f(_0x121bc5);});});}function createEndUser(_0x54191c,_0x116720,_0x5d8445,_0x2c4ba4,_0x435966,_0x538c79){var _0x5d8445=getName(_0x5d8445);return request({'method':_0x0f44('0x40'),'uri':_0x0f44('0x41')+_0x116720+'/crm/v2/'+_[_0x0f44('0x42')](_0x538c79['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5d8445[0x1],'First_Name':_0x5d8445[0x0],'Phone':_0x2c4ba4,'Owner':{'name':!_[_0x0f44('0x1c')](_0x435966[_0x0f44('0x43')]['name'])?_0x435966[_0x0f44('0x43')][_0x0f44('0x18')]:!_[_0x0f44('0x1c')](_0x435966[_0x0f44('0x44')])?_0x435966[_0x0f44('0x44')]+'\x20'+_0x435966['last_name']:_0x435966[_0x0f44('0x45')],'id':_0x435966['id']}}]},'headers':{'Authorization':_0x0f44('0x46')+_0x54191c},'json':!![]})[_0x0f44('0x2b')](function(_0x1f48f9){if(_0x1f48f9&&_0x1f48f9[_0x0f44('0x3f')][0x0][_0x0f44('0x47')]===_0x0f44('0x48')){var _0x222b9e=_0x1f48f9[_0x0f44('0x3f')][0x0]['details'];_0x222b9e[_0x0f44('0x49')]=_['startCase'](_0x538c79['moduleCreate'])+'s';return _0x222b9e;}logger[_0x0f44('0x3c')]('The\x20failing\x20result\x20is',JSON[_0x0f44('0xf')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x0f44('0x2d')](function(_0x56b2e1){console['log'](_0x0f44('0x4a'),_0x56b2e1);});}function getEndUser(_0x3e5cbc,_0x2777a7,_0x28a96b,_0x380458,_0x2ae51a,_0x533c42,_0x3cb6fb){var _0x5a4960={'method':_0x0f44('0x4b'),'uri':'','headers':{'Authorization':_0x0f44('0x46')+_0x3e5cbc},'json':!![]};switch(_0x3cb6fb['moduleSearch']){case'contact_lead':_0x5a4960['uri']='https://www.zohoapis.'+_0x2777a7+_0x0f44('0x4c')+_0x2ae51a+'))';return getZohoUser(_0x5a4960,_0x0f44('0x4d'))['then'](function(_0x9f2ea9){if(_0x9f2ea9)return _0x9f2ea9;_0x5a4960[_0x0f44('0x4e')]='https://www.zohoapis.'+_0x2777a7+_0x0f44('0x4f')+_0x2ae51a+'))';return getZohoUser(_0x5a4960,_0x0f44('0x50'))[_0x0f44('0x2b')](function(_0x29e8f0){if(_0x29e8f0)return _0x29e8f0;if(_0x3cb6fb[_0x0f44('0x51')]!=_0x0f44('0x52')){return createEndUser(_0x3e5cbc,_0x2777a7,_0x380458,_0x2ae51a,_0x533c42,_0x3cb6fb);}else{return{};}});});break;case _0x0f44('0x53'):_0x5a4960[_0x0f44('0x4e')]=_0x0f44('0x41')+_0x2777a7+_0x0f44('0x4c')+_0x2ae51a+'))';return getZohoUser(_0x5a4960,_0x0f44('0x4d'))[_0x0f44('0x2b')](function(_0x1eb5aa){if(_0x1eb5aa)return _0x1eb5aa;if(_0x3cb6fb[_0x0f44('0x51')]!=_0x0f44('0x52')){return createEndUser(_0x3e5cbc,_0x2777a7,_0x380458,_0x2ae51a,_0x533c42,_0x3cb6fb);}else{return{};}});break;case _0x0f44('0x54'):_0x5a4960[_0x0f44('0x4e')]=_0x0f44('0x41')+_0x2777a7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ae51a+'))';return getZohoUser(_0x5a4960,_0x0f44('0x50'))[_0x0f44('0x2b')](function(_0x103231){if(_0x103231)return _0x103231;if(_0x3cb6fb['moduleCreate']!=_0x0f44('0x52')){return createEndUser(_0x3e5cbc,_0x2777a7,_0x380458,_0x2ae51a,_0x533c42,_0x3cb6fb);}else{return{};}});break;}}function getCall(_0x20b70c,_0x420f09,_0x436b3b,_0x31036c,_0x2015ab,_0x34a047,_0xe45cf9,_0x4e8611){logger[_0x0f44('0x36')](_0x0f44('0x55'));var _0x4ad979={};_0x4ad979[_0x0f44('0x56')]={'name':!_[_0x0f44('0x1c')](_0x31036c['role'][_0x0f44('0x18')])&&!_[_0x0f44('0x1c')](_0x31036c[_0x0f44('0x39')]['name'])&&_0x31036c['profile'][_0x0f44('0x18')]===_0x0f44('0x57')?_0x31036c[_0x0f44('0x43')]['name']:!_[_0x0f44('0x1c')](_0x31036c[_0x0f44('0x44')])?_0x31036c['first_name']+'\x20'+_0x31036c[_0x0f44('0x45')]:_0x31036c['last_name'],'id':_0x31036c['id']};_0x4ad979[_0x0f44('0x58')]=intUtil['getString'](_0x34a047[_0x0f44('0x59')],_0xe45cf9,'\x20');_0x4ad979['Description']=intUtil['getString'](_0x34a047[_0x0f44('0x5a')],_0xe45cf9,'\x0a');if(_0x2015ab[_0x0f44('0x49')]===_0x0f44('0x4d')){_0x4ad979[_0x0f44('0x5b')]={'name':!_['isNil'](_0x2015ab[_0x0f44('0x5c')])?_0x2015ab[_0x0f44('0x5c')]:!_[_0x0f44('0x1c')](_0x2015ab[_0x0f44('0x5d')])?_0x2015ab[_0x0f44('0x5d')]+'\x20'+_0x2015ab[_0x0f44('0x5e')]:_0x2015ab[_0x0f44('0x5e')],'id':_0x2015ab['id']};}if(_0x2015ab['enduserType']===_0x0f44('0x50')){_0x4ad979[_0x0f44('0x5f')]={'name':!_[_0x0f44('0x1c')](_0x2015ab[_0x0f44('0x5c')])?_0x2015ab[_0x0f44('0x5c')]:!_[_0x0f44('0x1c')](_0x2015ab[_0x0f44('0x5d')])?_0x2015ab[_0x0f44('0x5d')]+'\x20'+_0x2015ab[_0x0f44('0x5e')]:_0x2015ab[_0x0f44('0x5e')],'id':_0x2015ab['id']};_0x4ad979['$se_module']=_[_0x0f44('0x42')](_0x2015ab[_0x0f44('0x49')]);}if(_0xe45cf9[_0x0f44('0x60')]){_0x4ad979[_0x0f44('0x61')]=moment[_0x0f44('0x62')](parseInt(_0xe45cf9[_0x0f44('0x60')])*0x3e8)['format'](_0x0f44('0x63'));}else if(_0xe45cf9['answertime']&&_0xe45cf9[_0x0f44('0x64')]){_0x4ad979[_0x0f44('0x61')]=moment[_0x0f44('0x62')](moment(_0xe45cf9[_0x0f44('0x64')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0xe45cf9[_0x0f44('0x65')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x0f44('0x63'));}switch(_0xe45cf9[_0x0f44('0x66')]){case _0x0f44('0x67'):_0x4ad979[_0x0f44('0x68')]=_0x0f44('0x69');break;case'complete':case _0x0f44('0x6a'):_0x4ad979[_0x0f44('0x68')]=_0x0f44('0x6b');break;case _0x0f44('0x6c'):_0x4ad979[_0x0f44('0x68')]='Rejected';break;case _0x0f44('0x6d'):_0x4ad979[_0x0f44('0x68')]='Abandoned';break;case _0x0f44('0x6e'):_0x4ad979['Call_Result']='Timeout';default:}_0x4ad979['Call_Start_Time']=(_0x4e8611===_0x0f44('0x6f')?moment(_0xe45cf9['starttime'])[_0x0f44('0x70')](_0x0f44('0x71')):moment(_0xe45cf9[_0x0f44('0x72')])[_0x0f44('0x70')](_0x0f44('0x71')))||moment()[_0x0f44('0x70')](_0x0f44('0x71'));_0x4ad979[_0x0f44('0x73')]=_0x4e8611||_0x0f44('0x74');_0x4ad979=_[_0x0f44('0x75')](_0x4ad979,getCustomFields(_0x34a047[_0x0f44('0x76')],_0xe45cf9));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x420f09+'/crm/v2/Calls','headers':{'Authorization':_0x0f44('0x46')+_0x20b70c},'body':{'data':[_0x4ad979]},'json':!![]})[_0x0f44('0x2b')](function(_0x23f136){if(_0x23f136&&_0x23f136['data'][0x0][_0x0f44('0x47')]==='SUCCESS'){logger[_0x0f44('0x36')](_0x0f44('0x77'));return{'id':_0x23f136[_0x0f44('0x3f')][0x0]['details']['id']};}})[_0x0f44('0x2d')](function(_0xf85b0d){logger[_0x0f44('0x36')](_0x0f44('0x78'),_0xf85b0d[_0x0f44('0x2e')]);console[_0x0f44('0x79')]('err',_0xf85b0d);});}exports[_0x0f44('0x7a')]=function(_0x2cf64b,_0x42e000,_0x1d7da9,_0x5a3b56,_0xf8d6bb,_0x51a5b6){var _0x3153af,_0x563594,_0x43c3cb;_0x51a5b6['host']=intUtil[_0x0f44('0x7b')](_0x51a5b6['host']);_0x51a5b6['serverUrl']=intUtil[_0x0f44('0x7b')](_0x51a5b6[_0x0f44('0x7c')]);if(_0xf8d6bb&&_0xf8d6bb[_0x0f44('0x7d')]){logger[_0x0f44('0x36')]('[QUEUE]',_0x0f44('0x7e'));_0x42e000['recordingURL']=_0x51a5b6[_0x0f44('0x7c')]+'/api/voice/recordings/'+_0x42e000[_0x0f44('0x7f')]+_0x0f44('0x80')+md5(_0x42e000['uniqueid']);}else{_0x42e000[_0x0f44('0x81')]='';}var _0x1cc18c=_0x51a5b6[_0x0f44('0x82')]===_0x0f44('0x83')?'eu':_0x0f44('0x84');return getAccessToken(_0x51a5b6)['then'](function(_0x4e93b3){_0x43c3cb=_0x4e93b3;return getUser(_0x43c3cb,_0x1cc18c,_0x51a5b6,_0x5a3b56[_0x0f44('0x35')]);})[_0x0f44('0x2b')](function(_0x4ecdf9){_0x3153af=_0x4ecdf9;logger[_0x0f44('0x36')]('The\x20User\x20ID\x20is:',_0x3153af['id']);return getEndUser(_0x43c3cb,_0x1cc18c,_0x51a5b6,_0x42e000[_0x0f44('0x85')],_0x42e000[_0x0f44('0x86')],_0x3153af,_0x1d7da9);})[_0x0f44('0x2b')](function(_0x40b65a){_0x563594=_0x40b65a;return getCall(_0x43c3cb,_0x1cc18c,_0x51a5b6,_0x3153af,_0x563594,_0x1d7da9,_0x42e000,_0x0f44('0x74'));})[_0x0f44('0x2b')](function(_0x515b68){if(_0x515b68){logger[_0x0f44('0x36')](_0x0f44('0x87'),_0x515b68['id']);logger[_0x0f44('0x36')](_0x0f44('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0f44('0x70')](_0x0f44('0x89'),_0x5a3b56[_0x0f44('0x18')]),_0x0f44('0x8a'),{'uri':_0x0f44('0x8b')+_0x51a5b6[_0x0f44('0x82')]+_0x0f44('0x8c')+_0x515b68['id']});}})[_0x0f44('0x2d')](function(_0x50fe60){logger[_0x0f44('0x3c')](_0x0f44('0x88'),JSON[_0x0f44('0xf')](_0x50fe60));});};exports[_0x0f44('0x6f')]=function(_0x53215d,_0x5e28a6,_0x408549,_0xb8853a,_0x222d86,_0x5c30a4,_0x47d789){var _0x26671d,_0x5ebbc9,_0x3d114e;_0x5c30a4[_0x0f44('0x82')]=intUtil[_0x0f44('0x7b')](_0x5c30a4['host']);_0x5c30a4[_0x0f44('0x7c')]=intUtil[_0x0f44('0x7b')](_0x5c30a4[_0x0f44('0x7c')]);if(_0x47d789&&_0x47d789[_0x0f44('0x8d')]&&_0x47d789['recordingFormat']!=='none'){logger[_0x0f44('0x36')](_0x0f44('0x8e'),'Recording\x20is\x20enabled!');_0x5e28a6[_0x0f44('0x81')]=_0x5c30a4[_0x0f44('0x7c')]+'/api/voice/recordings/'+_0x5e28a6[_0x0f44('0x7f')]+_0x0f44('0x80')+md5(_0x5e28a6[_0x0f44('0x7f')]);}var _0x5c91d1=_0x5c30a4[_0x0f44('0x82')]===_0x0f44('0x83')?'eu':_0x0f44('0x84');return getAccessToken(_0x5c30a4)[_0x0f44('0x2b')](function(_0x150de7){_0x3d114e=_0x150de7;return getUser(_0x3d114e,_0x5c91d1,_0x5c30a4,_0xb8853a['email']);})['then'](function(_0x1dff57){_0x26671d=_0x1dff57;logger[_0x0f44('0x36')](_0x0f44('0x8f'),_0x26671d['id']);return getEndUser(_0x3d114e,_0x5c91d1,_0x5c30a4,_0x5e28a6[_0x0f44('0x90')],_0x5e28a6[_0x0f44('0x91')],_0x26671d,_0x408549);})[_0x0f44('0x2b')](function(_0x1dd26a){_0x5ebbc9=_0x1dd26a;return getCall(_0x3d114e,_0x5c91d1,_0x5c30a4,_0x26671d,_0x5ebbc9,_0x408549,_0x5e28a6,_0x0f44('0x92'));})['then'](function(_0x47c27a){if(_0x47c27a){logger[_0x0f44('0x36')]('The\x20Call\x20ID\x20is:',_0x47c27a['id']);logger[_0x0f44('0x36')](_0x0f44('0x8e'),_0x0f44('0x93'));emit(util[_0x0f44('0x70')]('user:%s',_0xb8853a[_0x0f44('0x18')]),_0x0f44('0x8a'),{'uri':_0x0f44('0x8b')+_0x5c30a4[_0x0f44('0x82')]+_0x0f44('0x8c')+_0x47c27a['id']});}})[_0x0f44('0x2d')](function(_0x2cfe4b){logger['error'](_0x0f44('0x8e'),JSON[_0x0f44('0xf')](_0x2cfe4b));});};exports[_0x0f44('0x94')]=function(_0x1944ab,_0xeebfac,_0x283963,_0x574b89,_0x1cede7,_0x17af1e){var _0x23b576,_0x537385,_0x5bb268;_0x17af1e[_0x0f44('0x82')]=intUtil[_0x0f44('0x7b')](_0x17af1e[_0x0f44('0x82')]);_0x17af1e[_0x0f44('0x7c')]=intUtil[_0x0f44('0x7b')](_0x17af1e['serverUrl']);if(_0x1cede7&&_0x1cede7[_0x0f44('0x7d')]){logger[_0x0f44('0x36')]('['+_0xeebfac[_0x0f44('0x66')][_0x0f44('0x95')]()+']',_0x0f44('0x7e'));_0xeebfac[_0x0f44('0x81')]=_0x17af1e['serverUrl']+_0x0f44('0x96')+_0xeebfac['uniqueid']+_0x0f44('0x80')+md5(_0xeebfac[_0x0f44('0x7f')]);}else{_0xeebfac[_0x0f44('0x81')]='';}var _0x35725d=_0x17af1e[_0x0f44('0x82')]===_0x0f44('0x83')?'eu':_0x0f44('0x84');return getAccessToken(_0x17af1e)[_0x0f44('0x2b')](function(_0xf3bc72){_0x5bb268=_0xf3bc72;return getUser(_0x5bb268,_0x35725d,_0x17af1e);})[_0x0f44('0x2b')](function(_0x367329){_0x23b576=_0x367329;logger[_0x0f44('0x36')](_0x0f44('0x8f'),_0x23b576['id']);return getEndUser(_0x5bb268,_0x35725d,_0x17af1e,_0xeebfac[_0x0f44('0x85')],_0xeebfac[_0x0f44('0x86')],_0x23b576,_0x283963);})[_0x0f44('0x2b')](function(_0x1aa65f){_0x537385=_0x1aa65f;return getCall(_0x5bb268,_0x35725d,_0x17af1e,_0x23b576,_0x537385,_0x283963,_0xeebfac,_0x0f44('0x74'));})[_0x0f44('0x2b')](function(_0xd9c198){if(_0xd9c198){logger[_0x0f44('0x36')](_0x0f44('0x87'),_0xd9c198['id']);}})[_0x0f44('0x2d')](function(_0x540173){logger['error']('['+_0xeebfac[_0x0f44('0x66')][_0x0f44('0x95')]()+']',JSON[_0x0f44('0xf')](_0x540173));});}; \ No newline at end of file +var _0x5e14=['outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','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...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','https://www.zohoapis.','startCase','role','first_name','last_name','data','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var rp=require(_0x45e1('0x1'));var md5=require(_0x45e1('0x2'));var util=require(_0x45e1('0x3'));var intUtil=require(_0x45e1('0x4'));var moment=require(_0x45e1('0x5'));var Redis=require(_0x45e1('0x6'));var BPromise=require(_0x45e1('0x7'));var config=require(_0x45e1('0x8'));var logger=require(_0x45e1('0x9'))(_0x45e1('0xa'));config[_0x45e1('0xb')]=_[_0x45e1('0xc')](config[_0x45e1('0xb')],{'host':_0x45e1('0xd'),'port':0x18eb});var io=require(_0x45e1('0xe'))(new Redis(config[_0x45e1('0xb')]));function emit(_0x4062de,_0x2296b3,_0x128854){io['to'](_0x4062de)[_0x45e1('0xf')](_0x2296b3,_0x128854);}function request(_0x1c57cf){logger['debug'](_0x45e1('0x10'),JSON[_0x45e1('0x11')](_0x1c57cf));return rp(_0x1c57cf);}function getCustomFields(_0x3f45ac,_0x514726){var _0x2f58a3={};if(_0x3f45ac['length']>0x0){_[_0x45e1('0x12')](_0x3f45ac,function(_0x257ac8){if(_[_0x45e1('0x13')]([_0x45e1('0x14'),_0x45e1('0x15')],_0x257ac8[_0x45e1('0x16')])&&_0x257ac8[_0x45e1('0x17')]){_0x2f58a3[_0x257ac8['idField']]=_0x257ac8[_0x45e1('0x18')][_0x45e1('0x19')]();}else if(_0x257ac8[_0x45e1('0x16')]===_0x45e1('0x1a')&&_0x257ac8[_0x45e1('0x1b')]&&_0x257ac8[_0x45e1('0x17')]&&_0x514726[_0x257ac8[_0x45e1('0x1b')]]){_0x2f58a3[_0x257ac8['idField']]=_0x514726[_0x257ac8['variableName']][_0x45e1('0x19')]();}else if(_0x257ac8['type']==='customVariable'&&_0x257ac8['Variable']&&_0x257ac8[_0x45e1('0x1c')][_0x45e1('0x1d')]&&_0x257ac8[_0x45e1('0x17')]&&_0x514726[_0x257ac8[_0x45e1('0x1c')][_0x45e1('0x1d')][_0x45e1('0x1e')]()]){_0x2f58a3[_0x257ac8[_0x45e1('0x17')]]=_0x514726[_0x257ac8[_0x45e1('0x1c')]['name'][_0x45e1('0x1e')]()]['toString']();}});}return _0x2f58a3;}function getName(_0x3134f4){if(_0x3134f4[_0x45e1('0x1f')]('\x20')>0x0){var _0x1f2c01=_0x3134f4[_0x45e1('0x20')](/ (.+)/);if(_0x1f2c01[0x1]){return _0x1f2c01;}}return[_0x3134f4,_0x3134f4];}var accountsTokens={};function getAccessToken(_0x393fdf){return new Promise(function(_0x4f4884,_0x34d043){if(!_[_0x45e1('0x21')](accountsTokens[_0x393fdf['id']])&&!_[_0x45e1('0x21')](accountsTokens[_0x393fdf['id']][_0x45e1('0x22')])){if(moment()[_0x45e1('0x23')](accountsTokens[_0x393fdf['id']][_0x45e1('0x24')])){_0x4f4884(accountsTokens[_0x393fdf['id']][_0x45e1('0x22')]);}}var _0x2bdd53;switch(_0x393fdf[_0x45e1('0x25')]){case'US':_0x2bdd53=_0x45e1('0x26');break;case'AU':_0x2bdd53=_0x45e1('0x27');break;case'EU':_0x2bdd53=_0x45e1('0x28');break;case'IN':_0x2bdd53=_0x45e1('0x29');break;case'CN':_0x2bdd53=_0x45e1('0x2a');break;default:_0x2bdd53=_0x45e1('0x28');break;}var _0x2d615a={'method':_0x45e1('0x2b'),'uri':_0x2bdd53+_0x45e1('0x2c'),'qs':{'refresh_token':_0x393fdf[_0x45e1('0x2d')],'client_id':_0x393fdf[_0x45e1('0x2e')],'client_secret':_0x393fdf[_0x45e1('0x2f')],'grant_type':_0x45e1('0x30')},'json':!![]};return rp(_0x2d615a)[_0x45e1('0x31')](function(_0x668f14){accountsTokens[_0x393fdf['id']]={'access_token':_0x668f14[_0x45e1('0x22')],'expires_in':moment()[_0x45e1('0x32')](_0x668f14[_0x45e1('0x24')],_0x45e1('0x33'))};_0x4f4884(_0x668f14[_0x45e1('0x22')]);})[_0x45e1('0x34')](function(_0x541a9a){logger[_0x45e1('0x35')]('Failing\x20creating\x20the\x20access_token',_0x541a9a[_0x45e1('0x36')]);_0x34d043(_0x541a9a);});});}function getUser(_0x1b97ff,_0x4fccf0,_0x2f42f2,_0x327b22){logger[_0x45e1('0x37')](_0x45e1('0x38'));return request({'method':_0x45e1('0x39'),'uri':util[_0x45e1('0x3a')](_0x45e1('0x3b'),_0x4fccf0),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x45e1('0x3c')+_0x1b97ff},'json':!![]})['then'](function(_0x2c87e0){if(_0x2c87e0[_0x45e1('0x3d')]){var _0x3df426=-0x1;if(_[_0x45e1('0x3e')](_0x2c87e0['users'])){if(!_['isNil'](_0x327b22)){_0x3df426=_[_0x45e1('0x3f')](_0x2c87e0['users'],function(_0x36e74a){return _0x36e74a[_0x45e1('0x40')]===_0x327b22;});}if(_0x3df426>=0x0){logger[_0x45e1('0x37')]('Agent\x20found!');}else{logger[_0x45e1('0x37')](_0x45e1('0x41'));_0x3df426=_[_0x45e1('0x3f')](_0x2c87e0[_0x45e1('0x3d')],function(_0x2658f8){return _0x2658f8['profile'][_0x45e1('0x1d')]===_0x45e1('0x42');});}return _0x2c87e0[_0x45e1('0x3d')][_0x3df426];}else{if(_0x2c87e0['user']['profile'][_0x45e1('0x1d')]===_0x45e1('0x42')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x2c87e0[_0x45e1('0x43')];return user;}else{logger[_0x45e1('0x35')]('The\x20failing\x20result\x20is',JSON[_0x45e1('0x11')](_0x2c87e0));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x45e1('0x11')](_0x2c87e0));}}}else{logger[_0x45e1('0x35')](_0x45e1('0x44'),JSON['stringify'](_0x2c87e0));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x45e1('0x11')](_0x2c87e0));}})[_0x45e1('0x34')](function(_0x2bd459){console[_0x45e1('0x35')](_0x2bd459);});}function getZohoUser(_0x5e0b48,_0x4b3d8f){return new BPromise(function(_0x537556,_0x14b90c){request(_0x5e0b48)[_0x45e1('0x31')](function(_0x2c1500){var _0x534357=null;if(_0x2c1500){_0x534357=_0x2c1500['data'][0x0];_0x534357['enduserType']=_0x4b3d8f;}_0x537556(_0x534357);})[_0x45e1('0x34')](function(_0x114a13){_0x14b90c(_0x114a13);});});}function createEndUser(_0x466cac,_0x134210,_0xf264db,_0x2ef57b,_0x566b6f,_0x14ced3){var _0xf264db=getName(_0xf264db);return request({'method':_0x45e1('0x2b'),'uri':_0x45e1('0x45')+_0x134210+'/crm/v2/'+_[_0x45e1('0x46')](_0x14ced3['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xf264db[0x1],'First_Name':_0xf264db[0x0],'Phone':_0x2ef57b,'Owner':{'name':!_[_0x45e1('0x21')](_0x566b6f['role'][_0x45e1('0x1d')])?_0x566b6f[_0x45e1('0x47')][_0x45e1('0x1d')]:!_[_0x45e1('0x21')](_0x566b6f[_0x45e1('0x48')])?_0x566b6f['first_name']+'\x20'+_0x566b6f[_0x45e1('0x49')]:_0x566b6f[_0x45e1('0x49')],'id':_0x566b6f['id']}}]},'headers':{'Authorization':_0x45e1('0x3c')+_0x466cac},'json':!![]})[_0x45e1('0x31')](function(_0x1c1a10){if(_0x1c1a10&&_0x1c1a10[_0x45e1('0x4a')][0x0]['code']===_0x45e1('0x4b')){var _0x859bb3=_0x1c1a10['data'][0x0][_0x45e1('0x4c')];_0x859bb3[_0x45e1('0x4d')]=_[_0x45e1('0x46')](_0x14ced3[_0x45e1('0x4e')])+'s';return _0x859bb3;}logger[_0x45e1('0x35')](_0x45e1('0x44'),JSON[_0x45e1('0x11')](data));throw new Error(_0x45e1('0x4f')+JSON[_0x45e1('0x11')](data));})[_0x45e1('0x34')](function(_0x10629e){console[_0x45e1('0x50')](_0x45e1('0x51'),_0x10629e);});}function getEndUser(_0x307c42,_0x20f299,_0x480f13,_0x138f48,_0x24fe84,_0x7362,_0x2f9b98){var _0x112d67={'method':_0x45e1('0x39'),'uri':'','headers':{'Authorization':_0x45e1('0x3c')+_0x307c42},'json':!![]};switch(_0x2f9b98[_0x45e1('0x52')]){case _0x45e1('0x53'):_0x112d67[_0x45e1('0x54')]=_0x45e1('0x45')+_0x20f299+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x24fe84+'))';return getZohoUser(_0x112d67,_0x45e1('0x55'))['then'](function(_0x21f7e9){if(_0x21f7e9)return _0x21f7e9;_0x112d67[_0x45e1('0x54')]=_0x45e1('0x45')+_0x20f299+_0x45e1('0x56')+_0x24fe84+'))';return getZohoUser(_0x112d67,'Leads')[_0x45e1('0x31')](function(_0x38f779){if(_0x38f779)return _0x38f779;if(_0x2f9b98[_0x45e1('0x4e')]!=_0x45e1('0x57')){return createEndUser(_0x307c42,_0x20f299,_0x138f48,_0x24fe84,_0x7362,_0x2f9b98);}else{return{};}});});break;case _0x45e1('0x58'):_0x112d67[_0x45e1('0x54')]='https://www.zohoapis.'+_0x20f299+_0x45e1('0x59')+_0x24fe84+'))';return getZohoUser(_0x112d67,_0x45e1('0x55'))[_0x45e1('0x31')](function(_0x43bba4){if(_0x43bba4)return _0x43bba4;if(_0x2f9b98['moduleCreate']!=_0x45e1('0x57')){return createEndUser(_0x307c42,_0x20f299,_0x138f48,_0x24fe84,_0x7362,_0x2f9b98);}else{return{};}});break;case _0x45e1('0x5a'):_0x112d67[_0x45e1('0x54')]=_0x45e1('0x45')+_0x20f299+_0x45e1('0x56')+_0x24fe84+'))';return getZohoUser(_0x112d67,_0x45e1('0x5b'))[_0x45e1('0x31')](function(_0x36e1e2){if(_0x36e1e2)return _0x36e1e2;if(_0x2f9b98[_0x45e1('0x4e')]!=_0x45e1('0x57')){return createEndUser(_0x307c42,_0x20f299,_0x138f48,_0x24fe84,_0x7362,_0x2f9b98);}else{return{};}});break;}}function getCall(_0x53f2f4,_0x2e9a34,_0x273043,_0x3234f1,_0x2126a9,_0x5f1be7,_0x2a5a99,_0x10d9ff){logger['info'](_0x45e1('0x5c'));var _0x46caae={};_0x46caae[_0x45e1('0x5d')]={'name':!_[_0x45e1('0x21')](_0x3234f1[_0x45e1('0x47')]['name'])&&!_[_0x45e1('0x21')](_0x3234f1[_0x45e1('0x5e')][_0x45e1('0x1d')])&&_0x3234f1[_0x45e1('0x5e')]['name']===_0x45e1('0x5f')?_0x3234f1[_0x45e1('0x47')]['name']:!_[_0x45e1('0x21')](_0x3234f1[_0x45e1('0x48')])?_0x3234f1[_0x45e1('0x48')]+'\x20'+_0x3234f1[_0x45e1('0x49')]:_0x3234f1[_0x45e1('0x49')],'id':_0x3234f1['id']};_0x46caae[_0x45e1('0x60')]=intUtil['getString'](_0x5f1be7['Subjects'],_0x2a5a99,'\x20');_0x46caae['Description']=intUtil[_0x45e1('0x61')](_0x5f1be7['Descriptions'],_0x2a5a99,'\x0a');if(_0x2126a9[_0x45e1('0x4d')]===_0x45e1('0x55')){_0x46caae[_0x45e1('0x62')]={'name':!_['isNil'](_0x2126a9[_0x45e1('0x63')])?_0x2126a9[_0x45e1('0x63')]:!_[_0x45e1('0x21')](_0x2126a9[_0x45e1('0x64')])?_0x2126a9[_0x45e1('0x64')]+'\x20'+_0x2126a9['Last_Name']:_0x2126a9[_0x45e1('0x65')],'id':_0x2126a9['id']};}if(_0x2126a9[_0x45e1('0x4d')]===_0x45e1('0x5b')){_0x46caae[_0x45e1('0x66')]={'name':!_[_0x45e1('0x21')](_0x2126a9[_0x45e1('0x63')])?_0x2126a9[_0x45e1('0x63')]:!_['isNil'](_0x2126a9[_0x45e1('0x64')])?_0x2126a9[_0x45e1('0x64')]+'\x20'+_0x2126a9[_0x45e1('0x65')]:_0x2126a9[_0x45e1('0x65')],'id':_0x2126a9['id']};_0x46caae[_0x45e1('0x67')]=_[_0x45e1('0x46')](_0x2126a9[_0x45e1('0x4d')]);}if(_0x2a5a99[_0x45e1('0x68')]){_0x46caae[_0x45e1('0x69')]=moment[_0x45e1('0x6a')](parseInt(_0x2a5a99['talktime'])*0x3e8)[_0x45e1('0x3a')](_0x45e1('0x6b'));}else if(_0x2a5a99[_0x45e1('0x6c')]&&_0x2a5a99[_0x45e1('0x6d')]){_0x46caae['Call_Duration']=moment[_0x45e1('0x6a')](moment(_0x2a5a99[_0x45e1('0x6d')],'YYYY-MM-DDTHH:mm:ss')[_0x45e1('0x6e')](moment(_0x2a5a99[_0x45e1('0x6f')],_0x45e1('0x70'))))['format'](_0x45e1('0x6b'));}switch(_0x2a5a99['lastevent']){case _0x45e1('0x71'):_0x46caae[_0x45e1('0x72')]=_0x45e1('0x73');break;case _0x45e1('0x74'):case'connect':_0x46caae['Call_Result']=_0x45e1('0x75');break;case _0x45e1('0x76'):_0x46caae[_0x45e1('0x72')]='Rejected';break;case _0x45e1('0x77'):_0x46caae[_0x45e1('0x72')]=_0x45e1('0x78');break;case _0x45e1('0x79'):_0x46caae['Call_Result']=_0x45e1('0x7a');default:}_0x46caae[_0x45e1('0x7b')]=(_0x10d9ff===_0x45e1('0x7c')?moment(_0x2a5a99[_0x45e1('0x6f')])[_0x45e1('0x3a')](_0x45e1('0x70')):moment(_0x2a5a99[_0x45e1('0x7d')])[_0x45e1('0x3a')](_0x45e1('0x70')))||moment()['format'](_0x45e1('0x70'));_0x46caae['Call_Type']=_0x10d9ff||_0x45e1('0x7e');_0x46caae=_[_0x45e1('0x7f')](_0x46caae,getCustomFields(_0x5f1be7['Fields'],_0x2a5a99));return request({'method':_0x45e1('0x2b'),'uri':_0x45e1('0x45')+_0x2e9a34+_0x45e1('0x80'),'headers':{'Authorization':_0x45e1('0x3c')+_0x53f2f4},'body':{'data':[_0x46caae]},'json':!![]})[_0x45e1('0x31')](function(_0x422c9b){if(_0x422c9b&&_0x422c9b[_0x45e1('0x4a')][0x0][_0x45e1('0x81')]===_0x45e1('0x4b')){logger[_0x45e1('0x37')](_0x45e1('0x82'));return{'id':_0x422c9b[_0x45e1('0x4a')][0x0][_0x45e1('0x4c')]['id']};}})[_0x45e1('0x34')](function(_0x3aa63a){logger['info'](_0x45e1('0x83'),_0x3aa63a[_0x45e1('0x36')]);console[_0x45e1('0x50')](_0x45e1('0x83'),_0x3aa63a);});}exports[_0x45e1('0x84')]=function(_0xf29469,_0x14eff9,_0x12afc0,_0x3bf436,_0x4c1afd,_0xb45629){var _0x4661de,_0x116711,_0x4f7bd4;_0xb45629[_0x45e1('0x85')]=intUtil['stripTrailingSlash'](_0xb45629['host']);_0xb45629[_0x45e1('0x86')]=intUtil[_0x45e1('0x87')](_0xb45629['serverUrl']);if(_0x4c1afd&&_0x4c1afd['monitor_format']){logger[_0x45e1('0x37')](_0x45e1('0x88'),_0x45e1('0x89'));_0x14eff9[_0x45e1('0x8a')]=_0xb45629[_0x45e1('0x86')]+_0x45e1('0x8b')+_0x14eff9['uniqueid']+_0x45e1('0x8c')+md5(_0x14eff9[_0x45e1('0x8d')]);}else{_0x14eff9[_0x45e1('0x8a')]='';}var _0x2af5bc=_0xb45629[_0x45e1('0x85')]===_0x45e1('0x8e')?'eu':_0x45e1('0x8f');return getAccessToken(_0xb45629)['then'](function(_0x523b7f){_0x4f7bd4=_0x523b7f;return getUser(_0x4f7bd4,_0x2af5bc,_0xb45629,_0x3bf436[_0x45e1('0x40')]);})['then'](function(_0x518b44){_0x4661de=_0x518b44;logger[_0x45e1('0x37')](_0x45e1('0x90'),_0x4661de['id']);return getEndUser(_0x4f7bd4,_0x2af5bc,_0xb45629,_0x14eff9[_0x45e1('0x91')],_0x14eff9[_0x45e1('0x92')],_0x4661de,_0x12afc0);})[_0x45e1('0x31')](function(_0x295edf){_0x116711=_0x295edf;return getCall(_0x4f7bd4,_0x2af5bc,_0xb45629,_0x4661de,_0x116711,_0x12afc0,_0x14eff9,_0x45e1('0x7e'));})[_0x45e1('0x31')](function(_0x295481){if(_0x295481){logger['info'](_0x45e1('0x93'),_0x295481['id']);logger[_0x45e1('0x37')](_0x45e1('0x88'),_0x45e1('0x94'));emit(util['format']('user:%s',_0x3bf436['name']),_0x45e1('0x95'),{'uri':'https://crm.'+_0xb45629[_0x45e1('0x85')]+_0x45e1('0x96')+_0x295481['id']});}})[_0x45e1('0x34')](function(_0x273709){logger[_0x45e1('0x35')](_0x45e1('0x88'),JSON['stringify'](_0x273709));});};exports[_0x45e1('0x7c')]=function(_0x3e4589,_0x15a96a,_0x1f6753,_0x1242e1,_0x141a3b,_0x2e7374,_0xf12da5){var _0x84481c,_0x315040,_0x577a2b;_0x2e7374[_0x45e1('0x85')]=intUtil['stripTrailingSlash'](_0x2e7374[_0x45e1('0x85')]);_0x2e7374[_0x45e1('0x86')]=intUtil[_0x45e1('0x87')](_0x2e7374[_0x45e1('0x86')]);if(_0xf12da5&&_0xf12da5[_0x45e1('0x97')]&&_0xf12da5[_0x45e1('0x97')]!=='none'){logger[_0x45e1('0x37')](_0x45e1('0x98'),'Recording\x20is\x20enabled!');_0x15a96a[_0x45e1('0x8a')]=_0x2e7374[_0x45e1('0x86')]+'/api/voice/recordings/'+_0x15a96a[_0x45e1('0x8d')]+'/downloads?type=uniqueid&token='+md5(_0x15a96a[_0x45e1('0x8d')]);}var _0x5ed00c=_0x2e7374[_0x45e1('0x85')]===_0x45e1('0x8e')?'eu':_0x45e1('0x8f');return getAccessToken(_0x2e7374)[_0x45e1('0x31')](function(_0x1da8ce){_0x577a2b=_0x1da8ce;return getUser(_0x577a2b,_0x5ed00c,_0x2e7374,_0x1242e1[_0x45e1('0x40')]);})[_0x45e1('0x31')](function(_0x26cab0){_0x84481c=_0x26cab0;logger['info']('The\x20User\x20ID\x20is:',_0x84481c['id']);return getEndUser(_0x577a2b,_0x5ed00c,_0x2e7374,_0x15a96a[_0x45e1('0x99')],_0x15a96a['destcalleridnum'],_0x84481c,_0x1f6753);})['then'](function(_0x72e054){_0x315040=_0x72e054;return getCall(_0x577a2b,_0x5ed00c,_0x2e7374,_0x84481c,_0x315040,_0x1f6753,_0x15a96a,_0x45e1('0x9a'));})[_0x45e1('0x31')](function(_0x42f46e){if(_0x42f46e){logger[_0x45e1('0x37')](_0x45e1('0x93'),_0x42f46e['id']);logger[_0x45e1('0x37')](_0x45e1('0x98'),_0x45e1('0x94'));emit(util[_0x45e1('0x3a')](_0x45e1('0x9b'),_0x1242e1[_0x45e1('0x1d')]),_0x45e1('0x95'),{'uri':'https://crm.'+_0x2e7374[_0x45e1('0x85')]+_0x45e1('0x96')+_0x42f46e['id']});}})[_0x45e1('0x34')](function(_0x190a93){logger[_0x45e1('0x35')]('[OUTBOUND]',JSON['stringify'](_0x190a93));});};exports[_0x45e1('0x9c')]=function(_0x2d9455,_0x1e781e,_0x4ce0e1,_0x279148,_0x115358,_0x31c2e6){var _0x58f309,_0x3fe214,_0x5284bc;_0x31c2e6['host']=intUtil[_0x45e1('0x87')](_0x31c2e6[_0x45e1('0x85')]);_0x31c2e6[_0x45e1('0x86')]=intUtil[_0x45e1('0x87')](_0x31c2e6[_0x45e1('0x86')]);if(_0x115358&&_0x115358[_0x45e1('0x9d')]){logger[_0x45e1('0x37')]('['+_0x1e781e[_0x45e1('0x9e')][_0x45e1('0x9f')]()+']','Recording\x20is\x20enabled!');_0x1e781e[_0x45e1('0x8a')]=_0x31c2e6['serverUrl']+_0x45e1('0x8b')+_0x1e781e['uniqueid']+_0x45e1('0x8c')+md5(_0x1e781e[_0x45e1('0x8d')]);}else{_0x1e781e['recordingURL']='';}var _0x45e8bf=_0x31c2e6[_0x45e1('0x85')]==='zoho.eu'?'eu':_0x45e1('0x8f');return getAccessToken(_0x31c2e6)[_0x45e1('0x31')](function(_0x3f134a){_0x5284bc=_0x3f134a;return getUser(_0x5284bc,_0x45e8bf,_0x31c2e6);})[_0x45e1('0x31')](function(_0x41554c){_0x58f309=_0x41554c;logger[_0x45e1('0x37')](_0x45e1('0x90'),_0x58f309['id']);return getEndUser(_0x5284bc,_0x45e8bf,_0x31c2e6,_0x1e781e[_0x45e1('0x91')],_0x1e781e[_0x45e1('0x92')],_0x58f309,_0x4ce0e1);})[_0x45e1('0x31')](function(_0x14a4b8){_0x3fe214=_0x14a4b8;return getCall(_0x5284bc,_0x45e8bf,_0x31c2e6,_0x58f309,_0x3fe214,_0x4ce0e1,_0x1e781e,_0x45e1('0x7e'));})[_0x45e1('0x31')](function(_0x464dc5){if(_0x464dc5){logger[_0x45e1('0x37')](_0x45e1('0x93'),_0x464dc5['id']);}})['catch'](function(_0x29bb55){logger[_0x45e1('0x35')]('['+_0x1e781e[_0x45e1('0x9e')][_0x45e1('0x9f')]()+']',JSON['stringify'](_0x29bb55));});}; \ 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 4e256b2..6afe46c 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 _0x6839=['shelljs','mustache','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x1e5245,_0x8f83a9){var _0x1c2dfd=function(_0xa771d8){while(--_0xa771d8){_0x1e5245['push'](_0x1e5245['shift']());}};_0x1c2dfd(++_0x8f83a9);}(_0x6839,0x1ef));var _0x9683=function(_0xc0754,_0x37f107){_0xc0754=_0xc0754-0x0;var _0x195498=_0x6839[_0xc0754];return _0x195498;};'use strict';var util=require('util');var sh=require(_0x9683('0x0'));var Mustache=require(_0x9683('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x9683('0x2')]=function(_0x476eaf,_0x455472){var _0x18aa29=_0x476eaf[_0x9683('0x3')]?_0x476eaf[_0x9683('0x3')]:_0x9683('0x4');var _0x480912=_0x476eaf[_0x9683('0x5')]?Mustache[_0x9683('0x6')](_0x476eaf['data3'],_0x455472):_0x455472;sh[_0x9683('0x2')](_0x480912,function(_0x2b53bc,_0x71a70f,_0x281adf){if(_0x2b53bc!==0x0){logger[_0x9683('0x7')](util[_0x9683('0x8')](_0x9683('0x9'),_0x18aa29,_0x480912,_0x2b53bc,_0x281adf));}else{logger[_0x9683('0xa')](util[_0x9683('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x18aa29,_0x480912,_0x71a70f));}});}; \ No newline at end of file +var _0x0ba1=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','mustache','../../../../config/logger','trigger','data2','Script','data3','exec','format'];(function(_0xddedad,_0x4c5e10){var _0xe4e8e6=function(_0x467080){while(--_0x467080){_0xddedad['push'](_0xddedad['shift']());}};_0xe4e8e6(++_0x4c5e10);}(_0x0ba1,0x1e1));var _0x10ba=function(_0x24517a,_0x174f91){_0x24517a=_0x24517a-0x0;var _0x55a0a0=_0x0ba1[_0x24517a];return _0x55a0a0;};'use strict';var util=require(_0x10ba('0x0'));var sh=require('shelljs');var Mustache=require(_0x10ba('0x1'));var logger=require(_0x10ba('0x2'))(_0x10ba('0x3'));exports['exec']=function(_0x2b87d1,_0x531257){var _0x4fdef3=_0x2b87d1[_0x10ba('0x4')]?_0x2b87d1['data2']:_0x10ba('0x5');var _0x13ce0a=_0x2b87d1['data3']?Mustache['render'](_0x2b87d1[_0x10ba('0x6')],_0x531257):_0x531257;sh[_0x10ba('0x7')](_0x13ce0a,function(_0x295b6f,_0x36176e,_0x52da12){if(_0x295b6f!==0x0){logger['error'](util[_0x10ba('0x8')](_0x10ba('0x9'),_0x4fdef3,_0x13ce0a,_0x295b6f,_0x52da12));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4fdef3,_0x13ce0a,_0x36176e));}});}; \ 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 22ad459..f401803 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 _0xe7ad=['POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','%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','request-promise','util','lodash','mustache','trigger','render','data2','data5','headers','data6','parse','error','stack','data1','toUpperCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7ad,0x11d));var _0xde7a=function(_0x392415,_0xf6ced0){_0x392415=_0x392415-0x0;var _0x115169=_0xe7ad[_0x392415];return _0x115169;};'use strict';var rp=require(_0xde7a('0x0'));var util=require(_0xde7a('0x1'));var _=require(_0xde7a('0x2'));var Mustache=require(_0xde7a('0x3'));var logger=require('../../../../config/logger')(_0xde7a('0x4'));exports['exec']=function(_0x39a434,_0x22a81b){var _0x55f2d9,_0x16328b;var _0x59cd24={'method':_0x39a434['data1']['toUpperCase'](),'uri':Mustache[_0xde7a('0x5')](_0x39a434[_0xde7a('0x6')],_0x22a81b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39a434['data5'])==='number'&&parseInt(_0x39a434['data5'])>=0x1&&parseInt(_0x39a434[_0xde7a('0x7')])<=0xa?parseInt(_0x39a434[_0xde7a('0x7')])*0x3e8:0x5*0x3e8};try{_0x59cd24[_0xde7a('0x8')]=_0x39a434[_0xde7a('0x9')]?JSON[_0xde7a('0xa')](Mustache[_0xde7a('0x5')](_0x39a434[_0xde7a('0x9')],_0x22a81b)):{};}catch(_0x4c0425){logger[_0xde7a('0xb')](_0x4c0425[_0xde7a('0xc')]);}switch(_0x39a434[_0xde7a('0xd')][_0xde7a('0xe')]()){case'GET':case'DELETE':_0x55f2d9=null;_0x59cd24['qs']=_0x22a81b;break;case _0xde7a('0xf'):case _0xde7a('0x10'):if(_0x39a434[_0xde7a('0x11')]){try{_0x55f2d9=JSON[_0xde7a('0xa')](Mustache[_0xde7a('0x5')](_0x39a434['data7'],_0x22a81b));_0x59cd24[_0xde7a('0x12')]=_0x55f2d9;}catch(_0x5d8209){logger[_0xde7a('0xb')](_0x5d8209['stack']);logger[_0xde7a('0xb')](_0xde7a('0x13'));}}else{_0x55f2d9=_0x22a81b;_0x59cd24[_0xde7a('0x12')]=_0x55f2d9;}break;}logger[_0xde7a('0x14')](util[_0xde7a('0x15')](_0xde7a('0x16'),_0x39a434[_0xde7a('0xd')],_0x39a434[_0xde7a('0x6')],JSON[_0xde7a('0x17')](_0x59cd24)));rp(_0x59cd24)[_0xde7a('0x18')](function(_0x5ed38a){_0x55f2d9=!_['isNil'](_0x55f2d9)?_0xde7a('0x19')+_0x55f2d9:'';_0x16328b=typeof _0x5ed38a[_0xde7a('0x12')]==='object'?JSON[_0xde7a('0x17')](_0x5ed38a['body']):_0x5ed38a[_0xde7a('0x12')];logger[_0xde7a('0x14')](util[_0xde7a('0x15')](_0xde7a('0x1a'),_0x39a434[_0xde7a('0xd')],_0x39a434[_0xde7a('0x6')],_0x5ed38a[_0xde7a('0x1b')],_0x16328b));})[_0xde7a('0x1c')](function(_0x547c9d){logger['error'](util[_0xde7a('0x15')](_0xde7a('0x1d'),_0x39a434[_0xde7a('0xd')],_0x39a434['data2'],_0x547c9d['statusCode'],_0x547c9d['name'],_0x547c9d['message']));});}; \ No newline at end of file +var _0x3401=['info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20'];(function(_0x1bd4a6,_0x13116c){var _0x2ce051=function(_0x4c96b8){while(--_0x4c96b8){_0x1bd4a6['push'](_0x1bd4a6['shift']());}};_0x2ce051(++_0x13116c);}(_0x3401,0x1a9));var _0x1340=function(_0x19cd0c,_0xd18fa1){_0x19cd0c=_0x19cd0c-0x0;var _0x2008e9=_0x3401[_0x19cd0c];return _0x2008e9;};'use strict';var rp=require(_0x1340('0x0'));var util=require(_0x1340('0x1'));var _=require(_0x1340('0x2'));var Mustache=require(_0x1340('0x3'));var logger=require(_0x1340('0x4'))(_0x1340('0x5'));exports[_0x1340('0x6')]=function(_0xd7a154,_0x3abc69){var _0x23dbb4,_0x45aefc;var _0x2c2611={'method':_0xd7a154[_0x1340('0x7')][_0x1340('0x8')](),'uri':Mustache[_0x1340('0x9')](_0xd7a154[_0x1340('0xa')],_0x3abc69),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd7a154[_0x1340('0xb')])===_0x1340('0xc')&&parseInt(_0xd7a154[_0x1340('0xb')])>=0x1&&parseInt(_0xd7a154['data5'])<=0xa?parseInt(_0xd7a154[_0x1340('0xb')])*0x3e8:0x5*0x3e8};try{_0x2c2611[_0x1340('0xd')]=_0xd7a154[_0x1340('0xe')]?JSON[_0x1340('0xf')](Mustache['render'](_0xd7a154[_0x1340('0xe')],_0x3abc69)):{};}catch(_0x20aca7){logger[_0x1340('0x10')](_0x20aca7[_0x1340('0x11')]);}switch(_0xd7a154[_0x1340('0x7')][_0x1340('0x8')]()){case _0x1340('0x12'):case'DELETE':_0x23dbb4=null;_0x2c2611['qs']=_0x3abc69;break;case _0x1340('0x13'):case _0x1340('0x14'):if(_0xd7a154[_0x1340('0x15')]){try{_0x23dbb4=JSON[_0x1340('0xf')](Mustache[_0x1340('0x9')](_0xd7a154['data7'],_0x3abc69));_0x2c2611[_0x1340('0x16')]=_0x23dbb4;}catch(_0x2f9c06){logger[_0x1340('0x10')](_0x2f9c06[_0x1340('0x11')]);logger[_0x1340('0x10')](_0x1340('0x17'));}}else{_0x23dbb4=_0x3abc69;_0x2c2611[_0x1340('0x16')]=_0x23dbb4;}break;}logger['info'](util[_0x1340('0x18')](_0x1340('0x19'),_0xd7a154[_0x1340('0x7')],_0xd7a154['data2'],JSON[_0x1340('0x1a')](_0x2c2611)));rp(_0x2c2611)[_0x1340('0x1b')](function(_0x18b425){_0x23dbb4=!_[_0x1340('0x1c')](_0x23dbb4)?_0x1340('0x1d')+_0x23dbb4:'';_0x45aefc=typeof _0x18b425[_0x1340('0x16')]==='object'?JSON['stringify'](_0x18b425[_0x1340('0x16')]):_0x18b425[_0x1340('0x16')];logger[_0x1340('0x1e')](util[_0x1340('0x18')](_0x1340('0x1f'),_0xd7a154[_0x1340('0x7')],_0xd7a154['data2'],_0x18b425['statusCode'],_0x45aefc));})['catch'](function(_0x5a1380){logger[_0x1340('0x10')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xd7a154[_0x1340('0x7')],_0xd7a154[_0x1340('0xa')],_0x5a1380[_0x1340('0x20')],_0x5a1380[_0x1340('0x21')],_0x5a1380[_0x1340('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a6eee7c..e308fe3 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 _0x2875=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2875,0x1de));var _0x5287=function(_0x3e6a06,_0x5ddcd6){_0x3e6a06=_0x3e6a06-0x0;var _0xcdc571=_0x2875[_0x3e6a06];return _0xcdc571;};'use strict';var jayson=require(_0x5287('0x0'));var BPromise=require(_0x5287('0x1'));var logger=require(_0x5287('0x2'))(_0x5287('0x3'));var client=jayson[_0x5287('0x4')][_0x5287('0x5')]({'port':0x2329});client[_0x5287('0x6')]=function(_0x45356f,_0x281967){return new BPromise(function(_0x17db25,_0x2f900e){return client[_0x5287('0x7')](_0x45356f,_0x281967)[_0x5287('0x8')](function(_0x5d7804){logger[_0x5287('0x9')](_0x5287('0xa'),_0x5287('0x3'),_0x45356f,_0x281967,_0x5d7804);if(_0x5d7804[_0x5287('0xb')]){logger[_0x5287('0xb')](_0x5287('0xa'),'routing',_0x45356f,_0x5d7804[_0x5287('0xb')][_0x5287('0xc')],_0x281967);return _0x2f900e(_0x5d7804[_0x5287('0xb')][_0x5287('0xc')]);}else{return _0x17db25(_0x5d7804[_0x5287('0xd')]);}})[_0x5287('0xe')](function(_0x16a9fb){logger[_0x5287('0xb')](_0x5287('0xa'),_0x5287('0x3'),_0x45356f,_0x16a9fb,_0x281967);return _0x2f900e(_0x16a9fb);});});};module[_0x5287('0xf')]=client; \ No newline at end of file +var _0xdd24=['result','catch','exports','bluebird','routing','client','request','then','rpc','error','message'];(function(_0x41b6e3,_0x505829){var _0x3cb0ab=function(_0x5c2492){while(--_0x5c2492){_0x41b6e3['push'](_0x41b6e3['shift']());}};_0x3cb0ab(++_0x505829);}(_0xdd24,0xbe));var _0x4dd2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdd24[_0x432682];return _0x463d05;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4dd2('0x0'));var logger=require('../../config/logger')(_0x4dd2('0x1'));var client=jayson[_0x4dd2('0x2')]['http']({'port':0x2329});client['Request']=function(_0x29a757,_0x18744a){return new BPromise(function(_0x30c3ce,_0x234655){return client[_0x4dd2('0x3')](_0x29a757,_0x18744a)[_0x4dd2('0x4')](function(_0x5eba38){logger['debug'](_0x4dd2('0x5'),_0x4dd2('0x1'),_0x29a757,_0x18744a,_0x5eba38);if(_0x5eba38[_0x4dd2('0x6')]){logger[_0x4dd2('0x6')](_0x4dd2('0x5'),_0x4dd2('0x1'),_0x29a757,_0x5eba38[_0x4dd2('0x6')][_0x4dd2('0x7')],_0x18744a);return _0x234655(_0x5eba38[_0x4dd2('0x6')][_0x4dd2('0x7')]);}else{return _0x30c3ce(_0x5eba38[_0x4dd2('0x8')]);}})[_0x4dd2('0x9')](function(_0x45b8a6){logger[_0x4dd2('0x6')](_0x4dd2('0x5'),_0x4dd2('0x1'),_0x29a757,_0x45b8a6,_0x18744a);return _0x234655(_0x45b8a6);});});};module[_0x4dd2('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 562c3b8..1a9cc2e 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 _0xd4b2=['then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x1b6ad6,_0x26dce7){var _0x5c9c91=function(_0x6e0b22){while(--_0x6e0b22){_0x1b6ad6['push'](_0x1b6ad6['shift']());}};_0x5c9c91(++_0x26dce7);}(_0xd4b2,0xb3));var _0x2d4b=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0xd4b2[_0x317cc5];return _0x44fe81;};'use strict';var server=require(_0x2d4b('0x0'));var Realtime=require(_0x2d4b('0x1'));var EmailChannel=require(_0x2d4b('0x2'));var mailAccount=require(_0x2d4b('0x3'));var setting=require(_0x2d4b('0x4'));var logger=require(_0x2d4b('0x5'))(_0x2d4b('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2d4b('0x7')]()[_0x2d4b('0x8')](mailAccount[_0x2d4b('0x9')]())[_0x2d4b('0x8')](realtime['initMailAccounts']())[_0x2d4b('0x8')](function(){email[_0x2d4b('0xa')](realtime[_0x2d4b('0xb')]);return realtime;});}function main(){return server[_0x2d4b('0xc')](realtime,email)[_0x2d4b('0x8')](function(){return initRealtime();})[_0x2d4b('0x8')](function(){return setting[_0x2d4b('0xd')]();})[_0x2d4b('0x8')](function(_0x29eafd){return setInterval(initRealtime,_0x29eafd[_0x2d4b('0xe')]*0x3e8);})[_0x2d4b('0xf')](function(_0x367ca0){logger['error'](_0x2d4b('0x10'),_0x367ca0);});}main(); \ No newline at end of file +var _0xd7a4=['listen','loginMailFrequency','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x31a1cd,_0x35d7e1){var _0x13fa9b=function(_0xf40c74){while(--_0xf40c74){_0x31a1cd['push'](_0x31a1cd['shift']());}};_0x13fa9b(++_0x35d7e1);}(_0xd7a4,0x1bc));var _0x4d7a=function(_0x125bef,_0x1ec954){_0x125bef=_0x125bef-0x0;var _0x1be6bd=_0xd7a4[_0x125bef];return _0x1be6bd;};'use strict';var server=require(_0x4d7a('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x4d7a('0x1'));var mailAccount=require(_0x4d7a('0x2'));var setting=require(_0x4d7a('0x3'));var logger=require(_0x4d7a('0x4'))(_0x4d7a('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x4d7a('0x6')]()['then'](mailAccount[_0x4d7a('0x7')]())[_0x4d7a('0x8')](realtime[_0x4d7a('0x9')]())[_0x4d7a('0x8')](function(){email[_0x4d7a('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x4d7a('0xb')](realtime,email)[_0x4d7a('0x8')](function(){return initRealtime();})[_0x4d7a('0x8')](function(){return setting['getSettings']();})['then'](function(_0x2934b5){return setInterval(initRealtime,_0x2934b5[_0x4d7a('0xc')]*0x3e8);})['catch'](function(_0x3e1af8){logger['error']('Email\x20service\x20initialization',_0x3e1af8);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 556d511..2d48709 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 _0xc8ec=['send','isNil','Smtp','verify','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','handleImapBox','status','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','sendMail'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc8ec,0x127));var _0xcc8e=function(_0x4b5c38,_0x44e4ca){_0x4b5c38=_0x4b5c38-0x0;var _0x522619=_0xc8ec[_0x4b5c38];return _0x522619;};'use strict';var _=require(_0xcc8e('0x0'));var moment=require(_0xcc8e('0x1'));var BPromise=require(_0xcc8e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xcc8e('0x3'));var logger=require(_0xcc8e('0x4'))(_0xcc8e('0x5'));config[_0xcc8e('0x6')]=_[_0xcc8e('0x7')](config[_0xcc8e('0x6')],{'host':_0xcc8e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc8e('0x6')]));var EmailImap=require(_0xcc8e('0x9'));var EmailSmtp=require(_0xcc8e('0xa'));var mailAccount=require(_0xcc8e('0xb'));var md5Accounts={};function EmailChannel(_0x44cf39){logger['info'](_0xcc8e('0xc'));this[_0xcc8e('0xd')]=_0x44cf39[_0xcc8e('0xd')];this[_0xcc8e('0xe')]={};this[_0xcc8e('0xf')]=new EmailSmtp();}EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x11')]=function(_0x2afc85){var _0x399579=this[_0xcc8e('0xd')][_0x2afc85];var _0x105033={'id':_0x399579['id'],'name':_0x399579[_0xcc8e('0x12')],'key':_0x399579[_0xcc8e('0x13')],'active':_0x399579[_0xcc8e('0x14')],'Imap':{'status':_0x399579[_0xcc8e('0x15')]['status'],'messageStatus':_0x399579[_0xcc8e('0x15')][_0xcc8e('0x16')],'total':_0x399579[_0xcc8e('0x15')][_0xcc8e('0x17')]}};if(_['isNil'](md5Accounts[_0x2afc85])){md5Accounts[_0x2afc85]={};}var _0x14d76c=md5(JSON[_0xcc8e('0x18')](_0x105033));if(md5Accounts[_0x2afc85]['md5']!==_0x14d76c){md5Accounts[_0x2afc85][_0xcc8e('0x19')]=_0x14d76c;io['emit'](_0xcc8e('0x1a'),_0x105033);}};EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x1b')]=function(_0x17b980){for(var _0x52f27f in _0x17b980){if(_0x17b980[_0xcc8e('0x1c')](_0x52f27f)){if(_0x17b980[_0x52f27f][_0xcc8e('0x15')]&&_0x17b980[_0x52f27f][_0xcc8e('0x14')]){var _0x1488f3=_0x17b980[_0x52f27f]['Imap'];if(!_0x1488f3['service']&&_0x17b980[_0x52f27f][_0xcc8e('0x1d')]!==_0xcc8e('0x1e'))_0x1488f3[_0xcc8e('0x1f')]=_0x17b980[_0x52f27f][_0xcc8e('0x1d')];if(!this[_0xcc8e('0xe')]['hasOwnProperty'](_0x1488f3['id'])){this[_0xcc8e('0xe')][_0x1488f3['id']]=new EmailImap(_0x1488f3,_0x17b980[_0x52f27f]['email']);this[_0xcc8e('0xe')][_0x1488f3['id']]['on']('box',this['handleImapBox'][_0xcc8e('0x20')](this,_0x52f27f));this['imapAccounts'][_0x1488f3['id']]['on']('email',this[_0xcc8e('0x21')][_0xcc8e('0x20')](this,_0x52f27f));this[_0xcc8e('0xe')][_0x1488f3['id']]['on'](_0xcc8e('0x22'),this[_0xcc8e('0x23')]['bind'](this,_0x52f27f));this[_0xcc8e('0xe')][_0x1488f3['id']]['on']('error',this[_0xcc8e('0x24')]['bind'](this,_0x52f27f));}}else{if(_['isNil'](this[_0xcc8e('0xd')][_0x52f27f][_0xcc8e('0x15')])){this[_0xcc8e('0xd')][_0x52f27f][_0xcc8e('0x15')]={};}this[_0xcc8e('0xd')][_0x52f27f][_0xcc8e('0x15')]['status']=_0xcc8e('0x25');this[_0xcc8e('0xd')][_0x52f27f][_0xcc8e('0x15')]['messageStatus']='';this[_0xcc8e('0x11')](_0x52f27f);}}}};EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x26')]=function(_0x23704c,_0x3905e8){if(this[_0xcc8e('0xd')][_0x23704c]){this[_0xcc8e('0xd')][_0x23704c]['Imap'][_0xcc8e('0x27')]=_0xcc8e('0x28');this[_0xcc8e('0xd')][_0x23704c]['Imap'][_0xcc8e('0x16')]=_0x3905e8[_0xcc8e('0x12')];if(_0x3905e8[_0xcc8e('0x29')]){this[_0xcc8e('0xd')][_0x23704c]['Imap'][_0xcc8e('0x17')]=_0x3905e8[_0xcc8e('0x29')][_0xcc8e('0x17')];}return this[_0xcc8e('0x11')](_0x23704c);}};EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x21')]=function(_0x31c8d1,_0x520be6){logger[_0xcc8e('0x2a')](_0xcc8e('0x2b'),_0x520be6[_0xcc8e('0x2c')],_0x520be6[_0xcc8e('0x2d')],_0x520be6['from'],_0x31c8d1);if(this[_0xcc8e('0xd')][_0x31c8d1]){return mailAccount[_0xcc8e('0x2e')](_0x31c8d1,_0x520be6)[_0xcc8e('0x2f')](function(_0x227e43){if(_0x227e43){logger[_0xcc8e('0x2a')](_0xcc8e('0x30'));}})[_0xcc8e('0x31')](function(_0x3322fe){logger[_0xcc8e('0x32')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xcc8e('0x18')](_0x3322fe));});}};EmailChannel[_0xcc8e('0x10')]['handleImapEnd']=function(_0xa0926d){if(this[_0xcc8e('0xd')][_0xa0926d]&&this[_0xcc8e('0xd')][_0xa0926d][_0xcc8e('0x15')]){if(this[_0xcc8e('0xe')][this[_0xcc8e('0xd')][_0xa0926d][_0xcc8e('0x15')]['id']]){delete this[_0xcc8e('0xe')][this[_0xcc8e('0xd')][_0xa0926d][_0xcc8e('0x15')]['id']];}this['mailAccounts'][_0xa0926d][_0xcc8e('0x15')][_0xcc8e('0x33')]=moment();this[_0xcc8e('0x11')](_0xa0926d);}};EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x24')]=function(_0x16741c,_0x58bfb1){if(this[_0xcc8e('0xd')][_0x16741c]){this['mailAccounts'][_0x16741c]['Imap'][_0xcc8e('0x27')]=_0xcc8e('0x32');this['mailAccounts'][_0x16741c][_0xcc8e('0x15')]['messageStatus']=_0x58bfb1;return this['emit'](_0x16741c);}};EmailChannel[_0xcc8e('0x10')][_0xcc8e('0x34')]=function(_0x3332da,_0x209260){return this['smtp'][_0xcc8e('0x35')](_0x3332da,_0x209260);};EmailChannel['prototype']['verifySmtp']=function(_0x4b6a70){var _0x52edb5=this;if(this[_0xcc8e('0xd')][_0x4b6a70['id']]){if(_[_0xcc8e('0x36')](this[_0xcc8e('0xd')][_0x4b6a70['id']][_0xcc8e('0x37')])){this[_0xcc8e('0xd')][_0x4b6a70['id']][_0xcc8e('0x37')]={};}this['mailAccounts'][_0x4b6a70['id']][_0xcc8e('0x37')][_0xcc8e('0x33')]=moment();return new BPromise(function(_0x202f50,_0x35fb7c){return _0x52edb5[_0xcc8e('0xf')][_0xcc8e('0x38')](_0x4b6a70)[_0xcc8e('0x2f')](function(_0x345786){_0x52edb5[_0xcc8e('0xd')][_0x4b6a70['id']][_0xcc8e('0x37')][_0xcc8e('0x27')]='verified';_0x52edb5[_0xcc8e('0xd')][_0x4b6a70['id']][_0xcc8e('0x37')]['messageStatus']='';_0x52edb5[_0xcc8e('0x11')](_0x4b6a70['id']);_0x202f50(_0x345786);})['catch'](function(_0x102742){_0x52edb5['mailAccounts'][_0x4b6a70['id']]['Smtp'][_0xcc8e('0x27')]=_0xcc8e('0x32');_0x52edb5[_0xcc8e('0xd')][_0x4b6a70['id']][_0xcc8e('0x37')][_0xcc8e('0x16')]=_0x102742;_0x52edb5['emit'](_0x4b6a70['id']);_0x35fb7c(_0x102742);});});}return this[_0xcc8e('0xf')][_0xcc8e('0x38')](_0x4b6a70);};module[_0xcc8e('0x39')]=EmailChannel; \ No newline at end of file +var _0xe877=['connected','messages','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','smtp','catch','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','isNil','disabled'];(function(_0x4e3c96,_0x2237a9){var _0x10e946=function(_0xc4a7bb){while(--_0xc4a7bb){_0x4e3c96['push'](_0x4e3c96['shift']());}};_0x10e946(++_0x2237a9);}(_0xe877,0xeb));var _0x7e87=function(_0x2dad32,_0x448732){_0x2dad32=_0x2dad32-0x0;var _0x3a8966=_0xe877[_0x2dad32];return _0x3a8966;};'use strict';var _=require(_0x7e87('0x0'));var moment=require(_0x7e87('0x1'));var BPromise=require(_0x7e87('0x2'));var md5=require(_0x7e87('0x3'));var Redis=require('ioredis');var config=require(_0x7e87('0x4'));var logger=require(_0x7e87('0x5'))(_0x7e87('0x6'));config[_0x7e87('0x7')]=_[_0x7e87('0x8')](config[_0x7e87('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7e87('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x7e87('0x9'));var mailAccount=require(_0x7e87('0xa'));var md5Accounts={};function EmailChannel(_0x8e8ad1){logger[_0x7e87('0xb')](_0x7e87('0xc'));this[_0x7e87('0xd')]=_0x8e8ad1[_0x7e87('0xd')];this[_0x7e87('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x7e87('0xf')]=function(_0x43f5cb){var _0x764882=this['mailAccounts'][_0x43f5cb];var _0x1a7f69={'id':_0x764882['id'],'name':_0x764882[_0x7e87('0x10')],'key':_0x764882[_0x7e87('0x11')],'active':_0x764882[_0x7e87('0x12')],'Imap':{'status':_0x764882[_0x7e87('0x13')][_0x7e87('0x14')],'messageStatus':_0x764882[_0x7e87('0x13')][_0x7e87('0x15')],'total':_0x764882[_0x7e87('0x13')][_0x7e87('0x16')]}};if(_['isNil'](md5Accounts[_0x43f5cb])){md5Accounts[_0x43f5cb]={};}var _0x42db61=md5(JSON[_0x7e87('0x17')](_0x1a7f69));if(md5Accounts[_0x43f5cb][_0x7e87('0x3')]!==_0x42db61){md5Accounts[_0x43f5cb][_0x7e87('0x3')]=_0x42db61;io[_0x7e87('0xf')](_0x7e87('0x18'),_0x1a7f69);}};EmailChannel[_0x7e87('0x19')][_0x7e87('0x1a')]=function(_0x4db2eb){for(var _0x302a84 in _0x4db2eb){if(_0x4db2eb[_0x7e87('0x1b')](_0x302a84)){if(_0x4db2eb[_0x302a84][_0x7e87('0x13')]&&_0x4db2eb[_0x302a84]['active']){var _0x1f1663=_0x4db2eb[_0x302a84]['Imap'];if(!_0x1f1663[_0x7e87('0x1c')]&&_0x4db2eb[_0x302a84][_0x7e87('0x1d')]!==_0x7e87('0x1e'))_0x1f1663['service']=_0x4db2eb[_0x302a84][_0x7e87('0x1d')];if(!this[_0x7e87('0xe')][_0x7e87('0x1b')](_0x1f1663['id'])){this[_0x7e87('0xe')][_0x1f1663['id']]=new EmailImap(_0x1f1663,_0x4db2eb[_0x302a84]['email']);this[_0x7e87('0xe')][_0x1f1663['id']]['on']('box',this[_0x7e87('0x1f')]['bind'](this,_0x302a84));this[_0x7e87('0xe')][_0x1f1663['id']]['on'](_0x7e87('0x6'),this[_0x7e87('0x20')][_0x7e87('0x21')](this,_0x302a84));this['imapAccounts'][_0x1f1663['id']]['on'](_0x7e87('0x22'),this[_0x7e87('0x23')][_0x7e87('0x21')](this,_0x302a84));this['imapAccounts'][_0x1f1663['id']]['on'](_0x7e87('0x24'),this[_0x7e87('0x25')][_0x7e87('0x21')](this,_0x302a84));}}else{if(_[_0x7e87('0x26')](this[_0x7e87('0xd')][_0x302a84][_0x7e87('0x13')])){this['mailAccounts'][_0x302a84][_0x7e87('0x13')]={};}this['mailAccounts'][_0x302a84]['Imap'][_0x7e87('0x14')]=_0x7e87('0x27');this['mailAccounts'][_0x302a84][_0x7e87('0x13')][_0x7e87('0x15')]='';this[_0x7e87('0xf')](_0x302a84);}}}};EmailChannel[_0x7e87('0x19')][_0x7e87('0x1f')]=function(_0x1c2754,_0x37f181){if(this[_0x7e87('0xd')][_0x1c2754]){this[_0x7e87('0xd')][_0x1c2754]['Imap']['status']=_0x7e87('0x28');this[_0x7e87('0xd')][_0x1c2754][_0x7e87('0x13')][_0x7e87('0x15')]=_0x37f181[_0x7e87('0x10')];if(_0x37f181[_0x7e87('0x29')]){this[_0x7e87('0xd')][_0x1c2754][_0x7e87('0x13')][_0x7e87('0x16')]=_0x37f181[_0x7e87('0x29')][_0x7e87('0x16')];}return this[_0x7e87('0xf')](_0x1c2754);}};EmailChannel['prototype'][_0x7e87('0x20')]=function(_0x14d5ed,_0x975fe1){logger[_0x7e87('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x975fe1[_0x7e87('0x2a')],_0x975fe1['lastName'],_0x975fe1[_0x7e87('0x2b')],_0x14d5ed);if(this[_0x7e87('0xd')][_0x14d5ed]){return mailAccount[_0x7e87('0x2c')](_0x14d5ed,_0x975fe1)[_0x7e87('0x2d')](function(_0xa2458e){if(_0xa2458e){logger[_0x7e87('0xb')](_0x7e87('0x2e'));}})['catch'](function(_0x15a6df){logger['error'](_0x7e87('0x2f'),JSON['stringify'](_0x15a6df));});}};EmailChannel[_0x7e87('0x19')][_0x7e87('0x23')]=function(_0x3d7979){if(this[_0x7e87('0xd')][_0x3d7979]&&this['mailAccounts'][_0x3d7979][_0x7e87('0x13')]){if(this['imapAccounts'][this[_0x7e87('0xd')][_0x3d7979][_0x7e87('0x13')]['id']]){delete this['imapAccounts'][this[_0x7e87('0xd')][_0x3d7979][_0x7e87('0x13')]['id']];}this['mailAccounts'][_0x3d7979][_0x7e87('0x13')]['lastSync']=moment();this['emit'](_0x3d7979);}};EmailChannel[_0x7e87('0x19')][_0x7e87('0x25')]=function(_0x95553e,_0x1e0913){if(this['mailAccounts'][_0x95553e]){this[_0x7e87('0xd')][_0x95553e][_0x7e87('0x13')][_0x7e87('0x14')]=_0x7e87('0x24');this[_0x7e87('0xd')][_0x95553e][_0x7e87('0x13')][_0x7e87('0x15')]=_0x1e0913;return this['emit'](_0x95553e);}};EmailChannel['prototype'][_0x7e87('0x30')]=function(_0x21dda1,_0xc576e3){return this['smtp'][_0x7e87('0x31')](_0x21dda1,_0xc576e3);};EmailChannel[_0x7e87('0x19')][_0x7e87('0x32')]=function(_0x4c1e8b){var _0x838afa=this;if(this[_0x7e87('0xd')][_0x4c1e8b['id']]){if(_['isNil'](this[_0x7e87('0xd')][_0x4c1e8b['id']]['Smtp'])){this[_0x7e87('0xd')][_0x4c1e8b['id']][_0x7e87('0x33')]={};}this[_0x7e87('0xd')][_0x4c1e8b['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x443120,_0x1cefa5){return _0x838afa[_0x7e87('0x34')]['verify'](_0x4c1e8b)[_0x7e87('0x2d')](function(_0x4be45f){_0x838afa['mailAccounts'][_0x4c1e8b['id']][_0x7e87('0x33')][_0x7e87('0x14')]='verified';_0x838afa[_0x7e87('0xd')][_0x4c1e8b['id']]['Smtp'][_0x7e87('0x15')]='';_0x838afa[_0x7e87('0xf')](_0x4c1e8b['id']);_0x443120(_0x4be45f);})[_0x7e87('0x35')](function(_0x52c69a){_0x838afa[_0x7e87('0xd')][_0x4c1e8b['id']][_0x7e87('0x33')][_0x7e87('0x14')]=_0x7e87('0x24');_0x838afa[_0x7e87('0xd')][_0x4c1e8b['id']]['Smtp'][_0x7e87('0x15')]=_0x52c69a;_0x838afa[_0x7e87('0xf')](_0x4c1e8b['id']);_0x1cefa5(_0x52c69a);});});}return this[_0x7e87('0x34')]['verify'](_0x4c1e8b);};module[_0x7e87('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index beaef95..5c79722 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 _0xdca3=['../../../config/logger','mailbox','account','ready','handleReady','bind','once','handleEnd','error','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','end','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','closeBox','stringify','upperFirst','lodash','imap','mailparser','simpleParser','events','EventEmitter','./utils'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0xdca3,0x125));var _0x3dca=function(_0x5077c0,_0x44d1b4){_0x5077c0=_0x5077c0-0x0;var _0x5c3409=_0xdca3[_0x5077c0];return _0x5c3409;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var Imap=require(_0x3dca('0x1'));var simpleParser=require(_0x3dca('0x2'))[_0x3dca('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x3dca('0x4'))[_0x3dca('0x5')];var utils=require(_0x3dca('0x6'));var logger=require(_0x3dca('0x7'))('email');function EmailImap(_0x37b3c6,_0x5b5905){this[_0x3dca('0x8')]=_0x37b3c6[_0x3dca('0x8')];this[_0x3dca('0x9')]=this['getAccount'](_0x37b3c6,_0x5b5905);this[_0x3dca('0x1')]=new Imap(this['account']);this['imap']['once'](_0x3dca('0xa'),this[_0x3dca('0xb')][_0x3dca('0xc')](this));this['imap'][_0x3dca('0xd')]('end',this[_0x3dca('0xe')][_0x3dca('0xc')](this));this[_0x3dca('0x1')]['on'](_0x3dca('0xf'),this['handleError'][_0x3dca('0xc')](this));this['imap'][_0x3dca('0x10')]();}util[_0x3dca('0x11')](EmailImap,EventEmitter);EmailImap[_0x3dca('0x12')][_0x3dca('0x13')]=function(_0xc266a4,_0x39251a){var _0x581113={'connTimeout':_0xc266a4[_0x3dca('0x14')]?_0xc266a4['connTimeout']*0x3e8:0x2710,'authTimeout':_0xc266a4['authTimeout']?_0xc266a4[_0x3dca('0x15')]*0x3e8:0x1388};if(_0xc266a4['service']){_0x581113[_0x3dca('0x16')]=_0xc266a4[_0x3dca('0x16')];if(_0xc266a4[_0x3dca('0x17')]){_0x581113[_0x3dca('0x18')]=utils[_0x3dca('0x19')](_0xc266a4[_0x3dca('0x1a')]['data5'],_0xc266a4[_0x3dca('0x16')]);}else{_0x581113[_0x3dca('0x1b')]=_0xc266a4[_0x3dca('0x1b')];}}else{if(_0xc266a4[_0x3dca('0x1c')]){_0x581113[_0x3dca('0x16')]=_0xc266a4[_0x3dca('0x16')];_0x581113[_0x3dca('0x1b')]=_0xc266a4[_0x3dca('0x1b')];}}_0x581113[_0x3dca('0x1d')]=_0x39251a||_0xc266a4[_0x3dca('0x16')]||_0x3dca('0x1e');_0x581113[_0x3dca('0x1f')]=_0xc266a4[_0x3dca('0x1f')];_0x581113[_0x3dca('0x20')]=_0xc266a4['port']||0x3e1;if(_0xc266a4[_0x3dca('0x21')]){_0x581113[_0x3dca('0x21')]=!![];}else{_0x581113[_0x3dca('0x21')]=![];_0x581113[_0x3dca('0x22')]='required';}return _0x581113;};EmailImap[_0x3dca('0x12')][_0x3dca('0xb')]=function(){this[_0x3dca('0x1')][_0x3dca('0x23')](this[_0x3dca('0x8')],![],this[_0x3dca('0x24')][_0x3dca('0xc')](this));};EmailImap['prototype'][_0x3dca('0x24')]=function(_0x2f0f5b,_0x4d619c){if(_0x2f0f5b){this[_0x3dca('0x25')](_0x2f0f5b,!![]);}else{this[_0x3dca('0x26')](_0x3dca('0x27'),_0x4d619c);this[_0x3dca('0x28')]();}};EmailImap[_0x3dca('0x12')]['handleCloseBox']=function(_0x321060){if(_0x321060){this[_0x3dca('0x25')](_0x321060,!![]);}else{this[_0x3dca('0x1')]['end']();}};EmailImap[_0x3dca('0x12')][_0x3dca('0x28')]=function(){this[_0x3dca('0x1')][_0x3dca('0x29')]([_0x3dca('0x2a')],this[_0x3dca('0x2b')][_0x3dca('0xc')](this));};EmailImap[_0x3dca('0x12')]['handleReadUnseen']=function(_0x574305,_0x4f2ae0){if(_0x574305){this['handleError'](_0x574305,!![]);}else{if(_0x4f2ae0['length']){try{var _0x5699c9=this[_0x3dca('0x1')][_0x3dca('0x2c')](_0x4f2ae0,{'bodies':'','markSeen':!![]});_0x5699c9['on'](_0x3dca('0x2d'),this[_0x3dca('0x2e')][_0x3dca('0xc')](this));_0x5699c9['once'](_0x3dca('0xf'),this[_0x3dca('0x2f')][_0x3dca('0xc')](this));_0x5699c9[_0x3dca('0xd')](_0x3dca('0x30'),this['handleFetchEnd'][_0x3dca('0xc')](this));}catch(_0x3f0e49){logger[_0x3dca('0xf')](_0x3f0e49);}}else{this['imap']['closeBox'](!![],this[_0x3dca('0x31')][_0x3dca('0xc')](this));}}};EmailImap[_0x3dca('0x12')]['handleFetchMessage']=function(_0x23ee02){_0x23ee02['on'](_0x3dca('0x32'),this['handleMessageBody'][_0x3dca('0xc')](this));_0x23ee02[_0x3dca('0xd')](_0x3dca('0x33'),this[_0x3dca('0x34')][_0x3dca('0xc')](this));_0x23ee02[_0x3dca('0xd')](_0x3dca('0x30'),this[_0x3dca('0x35')]['bind'](this));};EmailImap['prototype'][_0x3dca('0x36')]=function(_0x354baf){simpleParser(_0x354baf,{'Iconv':Iconv},this[_0x3dca('0x37')][_0x3dca('0xc')](this));};EmailImap[_0x3dca('0x12')][_0x3dca('0x34')]=function(){};EmailImap['prototype'][_0x3dca('0x35')]=function(){};EmailImap['prototype'][_0x3dca('0x37')]=function(_0x37badb,_0xbcf60c){if(_0x37badb){logger[_0x3dca('0xf')](_0x37badb);}else{var _0x9ac47a=this;utils[_0x3dca('0x38')](this[_0x3dca('0x9')],_0xbcf60c,function(_0x2b430b){_0x9ac47a['emit'](_0x3dca('0x1d'),_0x2b430b);});}};EmailImap[_0x3dca('0x12')]['handleFetchEnd']=function(){this[_0x3dca('0x1')][_0x3dca('0x39')](!![],this[_0x3dca('0x31')][_0x3dca('0xc')](this));};EmailImap['prototype']['handleFetchError']=function(_0x3eb4b3){this[_0x3dca('0x25')](_0x3eb4b3);this[_0x3dca('0x1')][_0x3dca('0x39')](!![],this['handleCloseBox'][_0x3dca('0xc')](this));};EmailImap[_0x3dca('0x12')]['handleEnd']=function(){this[_0x3dca('0x26')](_0x3dca('0x30'));};EmailImap[_0x3dca('0x12')]['handleError']=function(_0x5e608e,_0x5c9471){logger[_0x3dca('0xf')](_0x3dca('0x25'),this[_0x3dca('0x9')][_0x3dca('0x1d')],JSON[_0x3dca('0x3a')](_0x5e608e));var _0x47a503='';if(_0x5e608e){if(_0x5e608e['textCode']){_0x47a503=_0x5e608e['textCode'];}else{for(var _0x43b669 in _0x5e608e){if(_0x5e608e['hasOwnProperty'](_0x43b669)){_0x47a503+=_[_0x3dca('0x3b')](_0x43b669)+':\x20'+_0x5e608e[_0x43b669]+'\x0a';}}}}if(_0x5c9471){this[_0x3dca('0x1')][_0x3dca('0x30')]();}else{this[_0x3dca('0x26')](_0x3dca('0xf'),_0x47a503);this[_0x3dca('0x26')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x755e=['emit','box','readUnseen','handleCloseBox','handleError','search','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x755e,0x96));var _0xe755=function(_0x19e206,_0x3e945d){_0x19e206=_0x19e206-0x0;var _0x531b21=_0x755e[_0x19e206];return _0x531b21;};'use strict';var _=require(_0xe755('0x0'));var util=require(_0xe755('0x1'));var Imap=require(_0xe755('0x2'));var simpleParser=require(_0xe755('0x3'))[_0xe755('0x4')];var Iconv=require(_0xe755('0x5'))[_0xe755('0x6')];var EventEmitter=require('events')[_0xe755('0x7')];var utils=require('./utils');var logger=require(_0xe755('0x8'))(_0xe755('0x9'));function EmailImap(_0xe29839,_0x3b82da){this[_0xe755('0xa')]=_0xe29839['mailbox'];this[_0xe755('0xb')]=this['getAccount'](_0xe29839,_0x3b82da);this[_0xe755('0x2')]=new Imap(this['account']);this[_0xe755('0x2')][_0xe755('0xc')](_0xe755('0xd'),this[_0xe755('0xe')][_0xe755('0xf')](this));this[_0xe755('0x2')][_0xe755('0xc')](_0xe755('0x10'),this[_0xe755('0x11')][_0xe755('0xf')](this));this[_0xe755('0x2')]['on'](_0xe755('0x12'),this['handleError'][_0xe755('0xf')](this));this[_0xe755('0x2')]['connect']();}util[_0xe755('0x13')](EmailImap,EventEmitter);EmailImap[_0xe755('0x14')][_0xe755('0x15')]=function(_0x5e0a17,_0x3a7848){var _0x306ddc={'connTimeout':_0x5e0a17['connTimeout']?_0x5e0a17[_0xe755('0x16')]*0x3e8:0x2710,'authTimeout':_0x5e0a17[_0xe755('0x17')]?_0x5e0a17['authTimeout']*0x3e8:0x1388};if(_0x5e0a17[_0xe755('0x18')]){_0x306ddc['user']=_0x5e0a17[_0xe755('0x19')];if(_0x5e0a17[_0xe755('0x1a')]){_0x306ddc[_0xe755('0x1b')]=utils[_0xe755('0x1c')](_0x5e0a17['CloudProvider'][_0xe755('0x1d')],_0x5e0a17['user']);}else{_0x306ddc[_0xe755('0x1e')]=_0x5e0a17['password'];}}else{if(_0x5e0a17[_0xe755('0x1f')]){_0x306ddc[_0xe755('0x19')]=_0x5e0a17['user'];_0x306ddc[_0xe755('0x1e')]=_0x5e0a17[_0xe755('0x1e')];}}_0x306ddc[_0xe755('0x9')]=_0x3a7848||_0x5e0a17[_0xe755('0x19')]||'anonymous@xcally.com';_0x306ddc[_0xe755('0x20')]=_0x5e0a17[_0xe755('0x20')];_0x306ddc[_0xe755('0x21')]=_0x5e0a17[_0xe755('0x21')]||0x3e1;if(_0x5e0a17[_0xe755('0x22')]){_0x306ddc[_0xe755('0x22')]=!![];}else{_0x306ddc[_0xe755('0x22')]=![];_0x306ddc[_0xe755('0x23')]=_0xe755('0x24');}return _0x306ddc;};EmailImap[_0xe755('0x14')]['handleReady']=function(){this[_0xe755('0x2')][_0xe755('0x25')](this[_0xe755('0xa')],![],this[_0xe755('0x26')][_0xe755('0xf')](this));};EmailImap[_0xe755('0x14')][_0xe755('0x26')]=function(_0x8c24d8,_0x5a2e38){if(_0x8c24d8){this['handleError'](_0x8c24d8,!![]);}else{this[_0xe755('0x27')](_0xe755('0x28'),_0x5a2e38);this[_0xe755('0x29')]();}};EmailImap[_0xe755('0x14')][_0xe755('0x2a')]=function(_0x43b4da){if(_0x43b4da){this[_0xe755('0x2b')](_0x43b4da,!![]);}else{this[_0xe755('0x2')]['end']();}};EmailImap[_0xe755('0x14')][_0xe755('0x29')]=function(){this['imap'][_0xe755('0x2c')](['UNSEEN'],this[_0xe755('0x2d')][_0xe755('0xf')](this));};EmailImap['prototype'][_0xe755('0x2d')]=function(_0xf95ffa,_0x1e19dc){if(_0xf95ffa){this[_0xe755('0x2b')](_0xf95ffa,!![]);}else{if(_0x1e19dc['length']){try{var _0x3d0cb6=this[_0xe755('0x2')][_0xe755('0x2e')](_0x1e19dc,{'bodies':'','markSeen':!![]});_0x3d0cb6['on']('message',this[_0xe755('0x2f')][_0xe755('0xf')](this));_0x3d0cb6[_0xe755('0xc')](_0xe755('0x12'),this[_0xe755('0x30')]['bind'](this));_0x3d0cb6[_0xe755('0xc')](_0xe755('0x10'),this['handleFetchEnd'][_0xe755('0xf')](this));}catch(_0x1a7e2e){logger[_0xe755('0x12')](_0x1a7e2e);}}else{this[_0xe755('0x2')][_0xe755('0x31')](!![],this[_0xe755('0x2a')][_0xe755('0xf')](this));}}};EmailImap[_0xe755('0x14')]['handleFetchMessage']=function(_0x1fadab){_0x1fadab['on'](_0xe755('0x32'),this[_0xe755('0x33')]['bind'](this));_0x1fadab[_0xe755('0xc')](_0xe755('0x34'),this['handleMessageAttributes'][_0xe755('0xf')](this));_0x1fadab[_0xe755('0xc')](_0xe755('0x10'),this[_0xe755('0x35')][_0xe755('0xf')](this));};EmailImap[_0xe755('0x14')][_0xe755('0x33')]=function(_0x3e661d){simpleParser(_0x3e661d,{'Iconv':Iconv},this['handleSimpleParser'][_0xe755('0xf')](this));};EmailImap[_0xe755('0x14')][_0xe755('0x36')]=function(){};EmailImap['prototype'][_0xe755('0x35')]=function(){};EmailImap[_0xe755('0x14')][_0xe755('0x37')]=function(_0x5321c6,_0x48e7df){if(_0x5321c6){logger[_0xe755('0x12')](_0x5321c6);}else{var _0x3cf0db=this;utils[_0xe755('0x38')](this['account'],_0x48e7df,function(_0x4a545c){_0x3cf0db[_0xe755('0x27')](_0xe755('0x9'),_0x4a545c);});}};EmailImap[_0xe755('0x14')][_0xe755('0x39')]=function(){this[_0xe755('0x2')][_0xe755('0x31')](!![],this[_0xe755('0x2a')][_0xe755('0xf')](this));};EmailImap[_0xe755('0x14')][_0xe755('0x30')]=function(_0x28e6b5){this[_0xe755('0x2b')](_0x28e6b5);this[_0xe755('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xe755('0xf')](this));};EmailImap[_0xe755('0x14')][_0xe755('0x11')]=function(){this[_0xe755('0x27')](_0xe755('0x10'));};EmailImap[_0xe755('0x14')]['handleError']=function(_0x915a5,_0x32d165){logger[_0xe755('0x12')](_0xe755('0x2b'),this[_0xe755('0xb')][_0xe755('0x9')],JSON[_0xe755('0x3a')](_0x915a5));var _0x5ded3b='';if(_0x915a5){if(_0x915a5[_0xe755('0x3b')]){_0x5ded3b=_0x915a5['textCode'];}else{for(var _0x16f4a8 in _0x915a5){if(_0x915a5[_0xe755('0x3c')](_0x16f4a8)){_0x5ded3b+=_[_0xe755('0x3d')](_0x16f4a8)+':\x20'+_0x915a5[_0x16f4a8]+'\x0a';}}}}if(_0x32d165){this[_0xe755('0x2')][_0xe755('0x10')]();}else{this[_0xe755('0x27')](_0xe755('0x12'),_0x5ded3b);this[_0xe755('0x27')](_0xe755('0x10'));}};module[_0xe755('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8237b98..754fabe 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 _0x0111=['createTransport','compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x4b2c57,_0x2d8cd9){var _0x10ac0b=function(_0x48de8b){while(--_0x48de8b){_0x4b2c57['push'](_0x4b2c57['shift']());}};_0x10ac0b(++_0x2d8cd9);}(_0x0111,0x19b));var _0x1011=function(_0x386e9f,_0x3d499e){_0x386e9f=_0x386e9f-0x0;var _0x39ef57=_0x0111[_0x386e9f];return _0x39ef57;};'use strict';var nodemailer=require(_0x1011('0x0'));var inlineBase64=require(_0x1011('0x1'));function EmailSmtp(){}EmailSmtp[_0x1011('0x2')]['send']=function(_0x461250,_0x3275a0){return new Promise(function(_0x312be0,_0x3e4984){var _0x351b6e=nodemailer[_0x1011('0x3')](_0x461250);_0x351b6e['use'](_0x1011('0x4'),inlineBase64());_0x351b6e['sendMail'](_0x3275a0,function(_0x307af0,_0x9e4c93){if(_0x307af0){_0x3e4984(_0x307af0[_0x1011('0x5')]());}else{_0x312be0(_0x9e4c93);}});});};EmailSmtp[_0x1011('0x2')][_0x1011('0x6')]=function(_0x52d8a7){return new Promise(function(_0x32d3fa,_0x4d13d){var _0x1eaf2d=nodemailer['createTransport'](_0x52d8a7);_0x1eaf2d[_0x1011('0x6')](function(_0x35ff49,_0x58ffe9){if(_0x35ff49){_0x4d13d(_0x35ff49[_0x1011('0x5')]());}else{if(_0x58ffe9){_0x32d3fa(_0x58ffe9);}else{_0x4d13d(_0x1011('0x7'));}}});});};module[_0x1011('0x8')]=EmailSmtp; \ No newline at end of file +var _0x90ba=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','use','compile','verify','createTransport','Not\x20verifired'];(function(_0x3371cb,_0x45cb27){var _0x2be43b=function(_0x170456){while(--_0x170456){_0x3371cb['push'](_0x3371cb['shift']());}};_0x2be43b(++_0x45cb27);}(_0x90ba,0x160));var _0xa90b=function(_0x1ba90e,_0x2743c2){_0x1ba90e=_0x1ba90e-0x0;var _0x5b2075=_0x90ba[_0x1ba90e];return _0x5b2075;};'use strict';var nodemailer=require(_0xa90b('0x0'));var inlineBase64=require(_0xa90b('0x1'));function EmailSmtp(){}EmailSmtp[_0xa90b('0x2')]['send']=function(_0x3005ee,_0x324d88){return new Promise(function(_0xc9d8,_0x11e2b1){var _0x430a8c=nodemailer['createTransport'](_0x3005ee);_0x430a8c[_0xa90b('0x3')](_0xa90b('0x4'),inlineBase64());_0x430a8c['sendMail'](_0x324d88,function(_0x3ffdfe,_0x536da1){if(_0x3ffdfe){_0x11e2b1(_0x3ffdfe['toString']());}else{_0xc9d8(_0x536da1);}});});};EmailSmtp['prototype'][_0xa90b('0x5')]=function(_0x48c8d1){return new Promise(function(_0x8f1e24,_0x26b8e2){var _0x4cf2fe=nodemailer[_0xa90b('0x6')](_0x48c8d1);_0x4cf2fe[_0xa90b('0x5')](function(_0x4aa2fc,_0x1cabf6){if(_0x4aa2fc){_0x26b8e2(_0x4aa2fc['toString']());}else{if(_0x1cabf6){_0x8f1e24(_0x1cabf6);}else{_0x26b8e2(_0xa90b('0x7'));}}});});};module[_0xa90b('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index c755004..e578fa6 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 _0x2992=['inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','utf-8','toString','base64','moment','randomstring','util','node-tnef','../../../config/environment','head','address','generate','@xcally.com','value','name','indexOf','split','length','slice','join','Anonymous','pop','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x4555da[_0x2299('0xe')](0x0,-0x1)[_0x2299('0xf')]('\x20'):_0x5d8ce1[_0x2299('0xa')];}return _0x2299('0x10');}function getLastName(_0x2c2793){var _0x5a4305=_[_0x2299('0x5')](_0x2c2793[_0x2299('0x9')]);if(_0x5a4305&&_0x5a4305['name']){var _0x1d3627=_0x5a4305[_0x2299('0xa')]['split'](/\s+/);return _0x1d3627[_0x2299('0xd')]>0x1?_0x1d3627[_0x2299('0x11')]():'';}return'';}function getMails(_0x4e0527,_0x1a3fa7){var _0x24c836='';for(var _0xc0852e=0x0;_0xc0852e<_0x1a3fa7[_0x2299('0x9')]['length'];_0xc0852e+=0x1){if(_0x1a3fa7[_0x2299('0x9')][_0xc0852e][_0x2299('0x6')]!==_0x4e0527){if(!_['isEmpty'](_0x24c836)){_0x24c836+=',';}_0x24c836+=_0x1a3fa7[_0x2299('0x9')][_0xc0852e][_0x2299('0xa')]||_0x1a3fa7[_0x2299('0x9')][_0xc0852e][_0x2299('0x6')]||'';_0x24c836+='\x20<';_0x24c836+=_0x1a3fa7[_0x2299('0x9')][_0xc0852e][_0x2299('0x6')]?_0x1a3fa7[_0x2299('0x9')][_0xc0852e][_0x2299('0x6')]:_0x2299('0x12')+random[_0x2299('0x7')](0x6)+'@xcally.com';_0x24c836+='>';}}return _0x24c836;}function parseEmail(_0x470460,_0x4bbdd9,_0x46fe1e){if(_0x4bbdd9[_0x2299('0x13')]){var _0x340c4d=/)<[^<]*)*<\/script>/gi;while(_0x340c4d[_0x2299('0x14')](_0x4bbdd9[_0x2299('0x13')])){_0x4bbdd9['html']=_0x4bbdd9[_0x2299('0x13')][_0x2299('0x15')](_0x340c4d,'');}if(_0x4bbdd9[_0x2299('0x13')][_0x2299('0x16')](_0x2299('0x17'))){var _0x475b92=[];_0x4bbdd9['attachments']['forEach'](_0x590336=>{_0x475b92[_0x2299('0x18')](_0x590336[_0x2299('0x19')]);});var _0x49fe8d=/]+>/g;var _0x21e5c0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b9910=_0x4bbdd9[_0x2299('0x13')][_0x2299('0x15')](_0x21e5c0,_0x2299('0x1a'));var _0x96567b=_0x5b9910[_0x2299('0x15')](_0x49fe8d,'_IMG');for(let _0x1b168f=0x0;_0x1b168f<_0x475b92['length'];_0x1b168f++){var _0x1d1ce0=_0x96567b[_0x2299('0x15')](_0x2299('0x1b'),_0x2299('0x1c')+_0x475b92[_0x1b168f]+_0x2299('0x1d'));_0x96567b=_0x1d1ce0;}_0x4bbdd9[_0x2299('0x13')]=_0x96567b;}_0x46fe1e[_0x2299('0x1e')]=_0x4bbdd9[_0x2299('0x13')];}else{_0x46fe1e[_0x2299('0x1e')]=_0x4bbdd9[_0x2299('0x1f')];}if(_0x46fe1e[_0x2299('0x1e')]){_0x46fe1e[_0x2299('0x1e')]=_0x46fe1e[_0x2299('0x1e')][_0x2299('0x15')](/0x0){var _0x3a746f=['Auto-Submitted:\x20auto-replied',_0x2299('0x32'),_0x2299('0x33')];for(var _0x331145=0x0;_0x331145<_0x4bbdd9[_0x2299('0x31')][_0x2299('0xd')];_0x331145++){var _0xf1c806=_[_0x2299('0xb')](_0x3a746f,_0x4bbdd9[_0x2299('0x31')][_0x331145][_0x2299('0x34')]);if(_0xf1c806>=0x0){_0x46fe1e[_0x2299('0x35')]=!![];}}}return _0x46fe1e;}exports[_0x2299('0x36')]=function(_0x4aac9b,_0x4d69d7,_0x205dbb){var _0x1fe818={'from':getAddress(_0x4d69d7[_0x2299('0x37')]),'firstName':getFirstName(_0x4d69d7['from']),'lastName':getLastName(_0x4d69d7[_0x2299('0x37')]),'mapKey':'email','message':{'from':getMails(_0x4aac9b[_0x2299('0x25')],_0x4d69d7[_0x2299('0x37')]),'to':_0x4aac9b[_0x2299('0x25')],'cc':'','subject':_0x4d69d7['subject']||'','messageId':_0x4d69d7[_0x2299('0x38')],'inReplyTo':_0x4d69d7[_0x2299('0x39')],'sentAt':moment(_0x4d69d7[_0x2299('0x3a')])['format'](_0x2299('0x3b')),'attach':![],'attachments':[]}};if(!_0x4d69d7[_0x2299('0x13')]&&!_0x4d69d7[_0x2299('0x1f')]){var _0xf15b83=_['filter'](_0x4d69d7['attachments'],{'contentType':'application/ms-tnef'});if(_0xf15b83[_0x2299('0xd')]){logger[_0x2299('0x3c')](util['format'](_0x2299('0x3d'),_0x4d69d7['messageId']));tnef['parseBuffer'](_[_0x2299('0x3e')](_0xf15b83)[_0x2299('0x2f')],function(_0x4d4c85,_0x10bb85){if(_0x10bb85){_0x4d69d7[_0x2299('0x13')]=_0x10bb85[_0x2299('0x3f')]||_0x2299('0x40');if(_0x10bb85['Attachments']){for(var _0x107ce4=0x0;_0x107ce4<_0x10bb85[_0x2299('0x41')][_0x2299('0xd')];_0x107ce4++){var _0x196e47=_0x10bb85['Attachments'][_0x107ce4];_0x1fe818['message']['attachments']['push']({'filename':_0x196e47[_0x2299('0x42')],'content':Buffer[_0x2299('0x37')](_0x196e47[_0x2299('0x43')])});}}}_0x205dbb(parseEmail(_0x4aac9b,_0x4d69d7,_0x1fe818));});}else{_0x4d69d7[_0x2299('0x13')]=_0x2299('0x40');_0x205dbb(parseEmail(_0x4aac9b,_0x4d69d7,_0x1fe818));}}else{_0x205dbb(parseEmail(_0x4aac9b,_0x4d69d7,_0x1fe818));}};exports[_0x2299('0x44')]=function(_0x3c1050,_0x2834e5){var _0x2b3b14=[_0x2299('0x45')+(_0x2834e5||''),'auth=Bearer\x20'+_0x3c1050,'',''];return Buffer[_0x2299('0x37')](_0x2b3b14[_0x2299('0xf')](''),_0x2299('0x46'))[_0x2299('0x47')](_0x2299('0x48'));}; \ No newline at end of file +var _0x9d23=['content','contentType','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','indexOf','line','isAutoreply','from','messageId','inReplyTo','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','user=','auth=Bearer\x20','utf-8','base64','moment','path','util','email','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','test','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','attachments','attach','type','attachment','attachment-','format','root','writeFileSync'];(function(_0x528fde,_0x312f46){var _0x163f8b=function(_0x3a4fc2){while(--_0x3a4fc2){_0x528fde['push'](_0x528fde['shift']());}};_0x163f8b(++_0x312f46);}(_0x9d23,0xa4));var _0x39d2=function(_0x5ea13a,_0x1abd76){_0x5ea13a=_0x5ea13a-0x0;var _0x1073b7=_0x9d23[_0x5ea13a];return _0x1073b7;};'use strict';var _=require('lodash');var moment=require(_0x39d2('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x39d2('0x1'));var util=require(_0x39d2('0x2'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x39d2('0x3'));var config=require('../../../config/environment');function getAddress(_0x422b63){var _0x38658b=_[_0x39d2('0x4')](_0x422b63[_0x39d2('0x5')]);return _0x38658b&&_0x38658b[_0x39d2('0x6')]?_0x38658b[_0x39d2('0x6')]:_0x39d2('0x7')+random[_0x39d2('0x8')](0x6)+_0x39d2('0x9');}function getFirstName(_0x13ab42){var _0x4e8c8b=_[_0x39d2('0x4')](_0x13ab42[_0x39d2('0x5')]);if(_0x4e8c8b&&_0x4e8c8b[_0x39d2('0xa')]){if(_0x4e8c8b[_0x39d2('0xa')]==_0x4e8c8b[_0x39d2('0x6')]){return _0x4e8c8b[_0x39d2('0xa')][_0x39d2('0xb')](0x0,_0x4e8c8b[_0x39d2('0xa')]['indexOf']('@'));}var _0x4eff2d=_0x4e8c8b[_0x39d2('0xa')][_0x39d2('0xc')](/\s+/);return _0x4eff2d[_0x39d2('0xd')]>0x1?_0x4eff2d[_0x39d2('0xe')](0x0,-0x1)[_0x39d2('0xf')]('\x20'):_0x4e8c8b[_0x39d2('0xa')];}return _0x39d2('0x10');}function getLastName(_0x2829c8){var _0x518593=_[_0x39d2('0x4')](_0x2829c8[_0x39d2('0x5')]);if(_0x518593&&_0x518593['name']){var _0x983e10=_0x518593[_0x39d2('0xa')][_0x39d2('0xc')](/\s+/);return _0x983e10[_0x39d2('0xd')]>0x1?_0x983e10[_0x39d2('0x11')]():'';}return'';}function getMails(_0x1e2caa,_0x438945){var _0x54c4e7='';for(var _0x145059=0x0;_0x145059<_0x438945[_0x39d2('0x5')][_0x39d2('0xd')];_0x145059+=0x1){if(_0x438945[_0x39d2('0x5')][_0x145059][_0x39d2('0x6')]!==_0x1e2caa){if(!_[_0x39d2('0x12')](_0x54c4e7)){_0x54c4e7+=',';}_0x54c4e7+=_0x438945[_0x39d2('0x5')][_0x145059][_0x39d2('0xa')]||_0x438945[_0x39d2('0x5')][_0x145059][_0x39d2('0x6')]||'';_0x54c4e7+='\x20<';_0x54c4e7+=_0x438945[_0x39d2('0x5')][_0x145059]['address']?_0x438945[_0x39d2('0x5')][_0x145059][_0x39d2('0x6')]:_0x39d2('0x7')+random[_0x39d2('0x8')](0x6)+'@xcally.com';_0x54c4e7+='>';}}return _0x54c4e7;}function parseEmail(_0x43f17e,_0x12aeb0,_0x3f8628){if(_0x12aeb0['html']){var _0x3dcf79=/)<[^<]*)*<\/script>/gi;while(_0x3dcf79[_0x39d2('0x13')](_0x12aeb0[_0x39d2('0x14')])){_0x12aeb0[_0x39d2('0x14')]=_0x12aeb0[_0x39d2('0x14')]['replace'](_0x3dcf79,'');}if(_0x12aeb0[_0x39d2('0x14')][_0x39d2('0x15')](_0x39d2('0x16'))){var _0x5535ed=[];_0x12aeb0['attachments'][_0x39d2('0x17')](_0x3d8eed=>{_0x5535ed[_0x39d2('0x18')](_0x3d8eed[_0x39d2('0x19')]);});var _0x3c4f95=/]+>/g;var _0x530508=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1eb1e0=_0x12aeb0[_0x39d2('0x14')][_0x39d2('0x1a')](_0x530508,'_SRC');var _0x5700e0=_0x1eb1e0[_0x39d2('0x1a')](_0x3c4f95,_0x39d2('0x1b'));for(let _0x3ef732=0x0;_0x3ef732<_0x5535ed['length'];_0x3ef732++){var _0x40baa9=_0x5700e0[_0x39d2('0x1a')](_0x39d2('0x1b'),_0x39d2('0x1c')+_0x5535ed[_0x3ef732]+_0x39d2('0x1d'));_0x5700e0=_0x40baa9;}_0x12aeb0['html']=_0x5700e0;}_0x3f8628[_0x39d2('0x1e')]=_0x12aeb0[_0x39d2('0x14')];}else{_0x3f8628[_0x39d2('0x1e')]=_0x12aeb0[_0x39d2('0x1f')];}if(_0x3f8628['body']){_0x3f8628[_0x39d2('0x1e')]=_0x3f8628[_0x39d2('0x1e')][_0x39d2('0x1a')](/0x0){var _0x44d547=[_0x39d2('0x2d'),_0x39d2('0x2e'),_0x39d2('0x2f')];for(var _0x12ea82=0x0;_0x12ea82<_0x12aeb0[_0x39d2('0x30')][_0x39d2('0xd')];_0x12ea82++){var _0x3300c9=_[_0x39d2('0x31')](_0x44d547,_0x12aeb0[_0x39d2('0x30')][_0x12ea82][_0x39d2('0x32')]);if(_0x3300c9>=0x0){_0x3f8628[_0x39d2('0x33')]=!![];}}}return _0x3f8628;}exports['parser']=function(_0x2270fe,_0x1223ca,_0x3bb01a){var _0xf915e0={'from':getAddress(_0x1223ca[_0x39d2('0x34')]),'firstName':getFirstName(_0x1223ca[_0x39d2('0x34')]),'lastName':getLastName(_0x1223ca[_0x39d2('0x34')]),'mapKey':'email','message':{'from':getMails(_0x2270fe[_0x39d2('0x3')],_0x1223ca[_0x39d2('0x34')]),'to':_0x2270fe['email'],'cc':'','subject':_0x1223ca['subject']||'','messageId':_0x1223ca[_0x39d2('0x35')],'inReplyTo':_0x1223ca[_0x39d2('0x36')],'sentAt':moment(_0x1223ca['date'])[_0x39d2('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1223ca[_0x39d2('0x14')]&&!_0x1223ca[_0x39d2('0x1f')]){var _0x4b1e37=_[_0x39d2('0x37')](_0x1223ca[_0x39d2('0x23')],{'contentType':_0x39d2('0x38')});if(_0x4b1e37[_0x39d2('0xd')]){logger['info'](util[_0x39d2('0x28')](_0x39d2('0x39'),_0x1223ca['messageId']));tnef[_0x39d2('0x3a')](_[_0x39d2('0x3b')](_0x4b1e37)[_0x39d2('0x2b')],function(_0xd71718,_0x56591f){if(_0x56591f){_0x1223ca[_0x39d2('0x14')]=_0x56591f[_0x39d2('0x3c')]||'

Empty\x20message

';if(_0x56591f[_0x39d2('0x3d')]){for(var _0x13aef4=0x0;_0x13aef4<_0x56591f[_0x39d2('0x3d')][_0x39d2('0xd')];_0x13aef4++){var _0x2d88a1=_0x56591f['Attachments'][_0x13aef4];_0xf915e0['message'][_0x39d2('0x23')][_0x39d2('0x18')]({'filename':_0x2d88a1[_0x39d2('0x3e')],'content':Buffer[_0x39d2('0x34')](_0x2d88a1[_0x39d2('0x3f')])});}}}_0x3bb01a(parseEmail(_0x2270fe,_0x1223ca,_0xf915e0));});}else{_0x1223ca[_0x39d2('0x14')]=_0x39d2('0x40');_0x3bb01a(parseEmail(_0x2270fe,_0x1223ca,_0xf915e0));}}else{_0x3bb01a(parseEmail(_0x2270fe,_0x1223ca,_0xf915e0));}};exports['generateXOAuth2Token']=function(_0x1eafbd,_0x4761fa){var _0x5e202e=[_0x39d2('0x41')+(_0x4761fa||''),_0x39d2('0x42')+_0x1eafbd,'',''];return Buffer['from'](_0x5e202e[_0x39d2('0xf')](''),_0x39d2('0x43'))['toString'](_0x39d2('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6c1ce00..58378e9 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 _0xb895=['active','Imap','Smtp','exports','lodash','name','Service','SERV'];(function(_0x163e24,_0x12cfb9){var _0x166072=function(_0x4c31be){while(--_0x4c31be){_0x163e24['push'](_0x163e24['shift']());}};_0x166072(++_0x12cfb9);}(_0xb895,0x9c));var _0x5b89=function(_0x173c62,_0x217b5d){_0x173c62=_0x173c62-0x0;var _0x21b5aa=_0xb895[_0x173c62];return _0x21b5aa;};'use strict';var _=require(_0x5b89('0x0'));function MailAccount(_0x83d3f0){this['id']=_0x83d3f0['id']||0x0;this[_0x5b89('0x1')]=_0x83d3f0['name']||_0x5b89('0x2');this['key']=_0x83d3f0['key']||_0x5b89('0x3');this[_0x5b89('0x4')]=_0x83d3f0['active']||![];this['Imap']=_0x83d3f0[_0x5b89('0x5')]||[];this[_0x5b89('0x6')]=_0x83d3f0['Smtp']||[];}module[_0x5b89('0x7')]=MailAccount; \ No newline at end of file +var _0x8dde=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x5de3a6,_0x12bca5){var _0x4caac7=function(_0x53f91a){while(--_0x53f91a){_0x5de3a6['push'](_0x5de3a6['shift']());}};_0x4caac7(++_0x12bca5);}(_0x8dde,0x9a));var _0xe8dd=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x8dde[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0xe8dd('0x0'));function MailAccount(_0x109166){this['id']=_0x109166['id']||0x0;this[_0xe8dd('0x1')]=_0x109166[_0xe8dd('0x1')]||_0xe8dd('0x2');this[_0xe8dd('0x3')]=_0x109166[_0xe8dd('0x3')]||_0xe8dd('0x4');this[_0xe8dd('0x5')]=_0x109166[_0xe8dd('0x5')]||![];this[_0xe8dd('0x6')]=_0x109166[_0xe8dd('0x6')]||[];this[_0xe8dd('0x7')]=_0x109166['Smtp']||[];}module[_0xe8dd('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 972addf..533066e 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 _0x13f2=['length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','prototype'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0x13f2,0x1e8));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x213f('0x0'));var MailAccount=require(_0x213f('0x1'));var Realtime=function(){this[_0x213f('0x2')]={};};function freeIsNotKey(_0x5280b4,_0x3f6f47,_0x2dbac9){var _0x1108aa=_[_0x213f('0x3')](_0x5280b4,function(_0x58a3f6,_0x417d64){return _0x58a3f6[_0x2dbac9];});for(var _0x4478ea in _0x3f6f47){if(_0x3f6f47['hasOwnProperty'](_0x4478ea)){if(!_0x1108aa[_0x4478ea]){delete _0x3f6f47[_0x4478ea];}}}}Realtime['prototype'][_0x213f('0x4')]=function(_0x54c186,_0x5acdef){for(var _0x39a352 in _0x5acdef){if(_0x54c186[_0x213f('0x5')](_0x39a352)){_0x54c186[_0x39a352]=_0x5acdef[_0x39a352];}}};Realtime[_0x213f('0x6')]['initMailAccounts']=function(){var _0x4318c1=this;return function(_0x2a59d1){if(_0x2a59d1){freeIsNotKey(_0x2a59d1,_0x4318c1[_0x213f('0x2')],'id');for(var _0x50ba2c=0x0,_0x182f99={},_0x320feb={};_0x50ba2c<_0x2a59d1[_0x213f('0x7')];_0x50ba2c+=0x1){_0x182f99=_0x2a59d1[_0x50ba2c];if(_[_0x213f('0x8')](_0x4318c1['mailAccounts'][_0x182f99['id']])){_0x4318c1[_0x213f('0x2')][_0x182f99['id']]=new MailAccount(_0x182f99);}else{_[_0x213f('0x9')](_0x4318c1[_0x213f('0x2')][_0x182f99['id']],_0x182f99);}}}return _0x4318c1[_0x213f('0x2')];};};module[_0x213f('0xa')]=Realtime; \ No newline at end of file +var _0xa407=['initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x48338c,_0x579750){var _0x411564=function(_0x4440c3){while(--_0x4440c3){_0x48338c['push'](_0x48338c['shift']());}};_0x411564(++_0x579750);}(_0xa407,0x93));var _0x7a40=function(_0x18e781,_0x297e3d){_0x18e781=_0x18e781-0x0;var _0x1a60ef=_0xa407[_0x18e781];return _0x1a60ef;};'use strict';var _=require(_0x7a40('0x0'));var MailAccount=require(_0x7a40('0x1'));var Realtime=function(){this[_0x7a40('0x2')]={};};function freeIsNotKey(_0x2dc9fa,_0x5dc682,_0x59218c){var _0x383692=_[_0x7a40('0x3')](_0x2dc9fa,function(_0x34e0f0,_0x265ce3){return _0x34e0f0[_0x59218c];});for(var _0x310ebb in _0x5dc682){if(_0x5dc682[_0x7a40('0x4')](_0x310ebb)){if(!_0x383692[_0x310ebb]){delete _0x5dc682[_0x310ebb];}}}}Realtime['prototype'][_0x7a40('0x5')]=function(_0x3641c1,_0x4b09d5){for(var _0x59d826 in _0x4b09d5){if(_0x3641c1['hasOwnProperty'](_0x59d826)){_0x3641c1[_0x59d826]=_0x4b09d5[_0x59d826];}}};Realtime[_0x7a40('0x6')][_0x7a40('0x7')]=function(){var _0x2de832=this;return function(_0x2efe87){if(_0x2efe87){freeIsNotKey(_0x2efe87,_0x2de832['mailAccounts'],'id');for(var _0x5b6b50=0x0,_0x40cc9d={},_0x4e3bc9={};_0x5b6b50<_0x2efe87[_0x7a40('0x8')];_0x5b6b50+=0x1){_0x40cc9d=_0x2efe87[_0x5b6b50];if(_[_0x7a40('0x9')](_0x2de832[_0x7a40('0x2')][_0x40cc9d['id']])){_0x2de832[_0x7a40('0x2')][_0x40cc9d['id']]=new MailAccount(_0x40cc9d);}else{_['merge'](_0x2de832[_0x7a40('0x2')][_0x40cc9d['id']],_0x40cc9d);}}}return _0x2de832[_0x7a40('0x2')];};};module[_0x7a40('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ad8de6d..cf4ddaa 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 _0x35a6=['service','email','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','Request','GetMailAccount','name','provider'];(function(_0x3a92cf,_0x38518b){var _0x15b124=function(_0x14a058){while(--_0x14a058){_0x3a92cf['push'](_0x3a92cf['shift']());}};_0x15b124(++_0x38518b);}(_0x35a6,0x122));var _0x635a=function(_0x4369ef,_0x55cfbc){_0x4369ef=_0x4369ef-0x0;var _0x5b6913=_0x35a6[_0x4369ef];return _0x5b6913;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x635a('0x0')](_0x635a('0x1'),{'options':{'attributes':['id',_0x635a('0x2'),_0x635a('0x3'),_0x635a('0x4'),_0x635a('0x5'),'active','key','ListId','TemplateId'],'raw':![],'include':[{'model':_0x635a('0x6'),'as':_0x635a('0x7'),'include':[{'model':_0x635a('0x8'),'attributes':['id',_0x635a('0x2'),_0x635a('0x4'),_0x635a('0x9'),_0x635a('0xa')],'as':_0x635a('0x8')}]},{'model':_0x635a('0xb'),'as':_0x635a('0xc'),'include':[{'model':_0x635a('0x8'),'attributes':['id',_0x635a('0x2'),'service','type',_0x635a('0xa')],'as':_0x635a('0x8')}]}]},'log':_0x635a('0xd')});};};exports['notify']=function(_0x179137,_0x187e3f){return client[_0x635a('0x0')]('NotifyMailAccount',{'account':{'id':_0x179137},'body':_0x187e3f,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xe61c=['Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut'];(function(_0x2e2e41,_0x3a7848){var _0x266226=function(_0x458e0a){while(--_0x458e0a){_0x2e2e41['push'](_0x2e2e41['shift']());}};_0x266226(++_0x3a7848);}(_0xe61c,0xee));var _0xce61=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe61c[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0xce61('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xce61('0x1')](_0xce61('0x2'),{'options':{'attributes':['id',_0xce61('0x3'),'provider','service',_0xce61('0x4'),'active',_0xce61('0x5'),_0xce61('0x6'),_0xce61('0x7')],'raw':![],'include':[{'model':_0xce61('0x8'),'as':_0xce61('0x9'),'include':[{'model':_0xce61('0xa'),'attributes':['id',_0xce61('0x3'),'service',_0xce61('0xb'),_0xce61('0xc')],'as':_0xce61('0xa')}]},{'model':_0xce61('0xd'),'as':_0xce61('0xe'),'include':[{'model':_0xce61('0xa'),'attributes':['id',_0xce61('0x3'),'service',_0xce61('0xb'),_0xce61('0xc')],'as':'CloudProvider'}]}]},'log':_0xce61('0xf')});};};exports[_0xce61('0x10')]=function(_0x50a936,_0x32e03e){return client['Request'](_0xce61('0x11'),{'account':{'id':_0x50a936},'body':_0x32e03e,'log':_0xce61('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1ffbedb..00f1938 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 _0xfb2d=['GetSettings','../client','getSettings','loginMailFrequency'];(function(_0x2a1843,_0x4417e9){var _0x6cebd1=function(_0x39f0ee){while(--_0x39f0ee){_0x2a1843['push'](_0x2a1843['shift']());}};_0x6cebd1(++_0x4417e9);}(_0xfb2d,0x75));var _0xdfb2=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0xfb2d[_0x31c19c];return _0x1a87f7;};'use strict';var client=require(_0xdfb2('0x0'));exports[_0xdfb2('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdfb2('0x2')]},'log':_0xdfb2('0x3')});}; \ No newline at end of file +var _0x8e50=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x8e50,0xeb));var _0x08e5=function(_0x19ee3a,_0x1c597f){_0x19ee3a=_0x19ee3a-0x0;var _0x3d7d89=_0x8e50[_0x19ee3a];return _0x3d7d89;};'use strict';var client=require(_0x08e5('0x0'));exports[_0x08e5('0x1')]=function(){return client[_0x08e5('0x2')](_0x08e5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x08e5('0x4')]},'log':_0x08e5('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 122728f..303176e 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(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 cb0fcc3..857b1bb 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 _0xae63=['redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xae63,0x1bc));var _0x3ae6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ae6('0x0'));var http=require(_0x3ae6('0x1'));var express=require(_0x3ae6('0x2'));var sticky=require(_0x3ae6('0x3'));var Redis=require(_0x3ae6('0x4'));var config=require(_0x3ae6('0x5'));var app=express();var server=http[_0x3ae6('0x6')](app);server[_0x3ae6('0x7')]=0xdbba0;if(sticky[_0x3ae6('0x8')](server,config[_0x3ae6('0x9')])){var socketio=require('socket.io')(server,{'transports':[_0x3ae6('0xa'),_0x3ae6('0xb')]});config[_0x3ae6('0xc')]=_[_0x3ae6('0xd')](config[_0x3ae6('0xc')],{'host':_0x3ae6('0xe'),'port':0x18eb});socketio['adapter'](require(_0x3ae6('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3ae6('0xc')])}));require('../../config/triggers')[_0x3ae6('0x10')]();require(_0x3ae6('0x11'))[_0x3ae6('0x10')](socketio);require(_0x3ae6('0x12'))[_0x3ae6('0x10')](app);require(_0x3ae6('0x13'))[_0x3ae6('0x10')](app);}else{server['once'](_0x3ae6('0x14'),function(){console[_0x3ae6('0x15')](_0x3ae6('0x16'),config['port']);});}exports=module[_0x3ae6('0x17')]=app; \ No newline at end of file +var _0x2b53=['createServer','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis'];(function(_0x36f3df,_0x2b1621){var _0xcfb7b7=function(_0xcc9fc0){while(--_0xcc9fc0){_0x36f3df['push'](_0x36f3df['shift']());}};_0xcfb7b7(++_0x2b1621);}(_0x2b53,0x183));var _0x32b5=function(_0x5a14d6,_0x52b6f8){_0x5a14d6=_0x5a14d6-0x0;var _0x11865f=_0x2b53[_0x5a14d6];return _0x11865f;};'use strict';var _=require('lodash');var http=require(_0x32b5('0x0'));var express=require(_0x32b5('0x1'));var sticky=require(_0x32b5('0x2'));var Redis=require(_0x32b5('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x32b5('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x32b5('0x5')](server,config[_0x32b5('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x32b5('0x7'),_0x32b5('0x8')]});config[_0x32b5('0x9')]=_[_0x32b5('0xa')](config[_0x32b5('0x9')],{'host':_0x32b5('0xb'),'port':0x18eb});socketio[_0x32b5('0xc')](require(_0x32b5('0xd'))({'pubClient':new Redis(config[_0x32b5('0x9')]),'subClient':new Redis(config[_0x32b5('0x9')])}));require(_0x32b5('0xe'))[_0x32b5('0xf')]();require(_0x32b5('0x10'))[_0x32b5('0xf')](socketio);require('../../config/express')[_0x32b5('0xf')](app);require(_0x32b5('0x11'))[_0x32b5('0xf')](app);}else{server[_0x32b5('0x12')](_0x32b5('0x13'),function(){console[_0x32b5('0x14')](_0x32b5('0x15'),config[_0x32b5('0x6')]);});}exports=module[_0x32b5('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 6ca1faf..e9a7dd4 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 _0xebe2=['bluebird','../../config/logger','client','Request','request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0x4bdeaf,_0x32f6bd){var _0x181155=function(_0x1cfda6){while(--_0x1cfda6){_0x4bdeaf['push'](_0x4bdeaf['shift']());}};_0x181155(++_0x32f6bd);}(_0xebe2,0x194));var _0x2ebe=function(_0x27c3f0,_0x198aa2){_0x27c3f0=_0x27c3f0-0x0;var _0x11e51c=_0xebe2[_0x27c3f0];return _0x11e51c;};'use strict';var jayson=require(_0x2ebe('0x0'));var BPromise=require(_0x2ebe('0x1'));var logger=require(_0x2ebe('0x2'))('routing');var client=jayson[_0x2ebe('0x3')]['http']({'port':0x2329});client[_0x2ebe('0x4')]=function(_0x33d50c,_0x4b7af7){return new BPromise(function(_0x36b434,_0x38eb11){return client[_0x2ebe('0x5')](_0x33d50c,_0x4b7af7)[_0x2ebe('0x6')](function(_0x3d303b){logger[_0x2ebe('0x7')](_0x2ebe('0x8'),_0x2ebe('0x9'),_0x33d50c,_0x4b7af7,_0x3d303b);if(_0x3d303b[_0x2ebe('0xa')]){logger['error'](_0x2ebe('0x8'),_0x2ebe('0x9'),_0x33d50c,_0x3d303b[_0x2ebe('0xa')]['message'],_0x4b7af7);return _0x38eb11(_0x3d303b[_0x2ebe('0xa')][_0x2ebe('0xb')]);}else{return _0x36b434(_0x3d303b[_0x2ebe('0xc')]);}})[_0x2ebe('0xd')](function(_0x26615c){logger['error'](_0x2ebe('0x8'),_0x2ebe('0x9'),_0x33d50c,_0x26615c,_0x4b7af7);return _0x38eb11(_0x26615c);});});};module[_0x2ebe('0xe')]=client; \ No newline at end of file +var _0x725f=['http','Request','request','then','rpc','error','message','result','exports','jayson/promise','bluebird','routing','client'];(function(_0x174530,_0xc92416){var _0x260378=function(_0x4740dd){while(--_0x4740dd){_0x174530['push'](_0x174530['shift']());}};_0x260378(++_0xc92416);}(_0x725f,0x98));var _0xf725=function(_0x2ecc14,_0x27a19c){_0x2ecc14=_0x2ecc14-0x0;var _0x24ba1e=_0x725f[_0x2ecc14];return _0x24ba1e;};'use strict';var jayson=require(_0xf725('0x0'));var BPromise=require(_0xf725('0x1'));var logger=require('../../config/logger')(_0xf725('0x2'));var client=jayson[_0xf725('0x3')][_0xf725('0x4')]({'port':0x2329});client[_0xf725('0x5')]=function(_0x95685,_0x4627e6){return new BPromise(function(_0x3476fc,_0xa0f9c0){return client[_0xf725('0x6')](_0x95685,_0x4627e6)[_0xf725('0x7')](function(_0x5b820b){logger['debug'](_0xf725('0x8'),_0xf725('0x2'),_0x95685,_0x4627e6,_0x5b820b);if(_0x5b820b[_0xf725('0x9')]){logger[_0xf725('0x9')](_0xf725('0x8'),_0xf725('0x2'),_0x95685,_0x5b820b['error'][_0xf725('0xa')],_0x4627e6);return _0xa0f9c0(_0x5b820b[_0xf725('0x9')]['message']);}else{return _0x3476fc(_0x5b820b[_0xf725('0xb')]);}})['catch'](function(_0x31393a){logger[_0xf725('0x9')]('rpc',_0xf725('0x2'),_0x95685,_0x31393a,_0x4627e6);return _0xa0f9c0(_0x31393a);});});};module[_0xf725('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index fa0012b..83ff4b3 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 _0x2c8e=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','log','bluebird','./server','./realtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c8e,0x1a6));var _0xe2c8=function(_0x5d2478,_0x6e81da){_0x5d2478=_0x5d2478-0x0;var _0x265588=_0x2c8e[_0x5d2478];return _0x265588;};'use strict';var BPromise=require(_0xe2c8('0x0'));var server=require(_0xe2c8('0x1'));var Realtime=require(_0xe2c8('0x2'));var user=require(_0xe2c8('0x3'));var interval=require(_0xe2c8('0x4'));var openchannelQueue=require(_0xe2c8('0x5'));var chatQueue=require(_0xe2c8('0x6'));var smsQueue=require(_0xe2c8('0x7'));var mailQueue=require(_0xe2c8('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xe2c8('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe2c8('0xa')]()['then'](user[_0xe2c8('0xb')]())[_0xe2c8('0xc')](realtime['initAgents']())[_0xe2c8('0xc')](interval[_0xe2c8('0xd')]())[_0xe2c8('0xc')](realtime[_0xe2c8('0xe')]())[_0xe2c8('0xc')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xe2c8('0xf')]())[_0xe2c8('0xc')](chatQueue[_0xe2c8('0x10')]())[_0xe2c8('0xc')](realtime[_0xe2c8('0x11')]())[_0xe2c8('0xc')](smsQueue['getSmsQueues']())[_0xe2c8('0xc')](realtime[_0xe2c8('0x12')]())[_0xe2c8('0xc')](mailQueue['getMailQueues']())[_0xe2c8('0xc')](realtime[_0xe2c8('0x13')]())['then'](faxQueue[_0xe2c8('0x14')]())[_0xe2c8('0xc')](realtime[_0xe2c8('0x15')]())['then'](whatsappQueue[_0xe2c8('0x16')]())[_0xe2c8('0xc')](realtime['initWhatsappQueues']())[_0xe2c8('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe2c8('0xc')](function(_0x317549){return initRealtime();})[_0xe2c8('0xc')](function(_0x3b642c){return setInterval(initRealtime,0x1388);})[_0xe2c8('0x17')](function(_0x1be798){console[_0xe2c8('0x18')](_0x1be798);});}main(); \ No newline at end of file +var _0xd54c=['initMailQueues','getFaxQueues','initWhatsappQueues','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initIntervals','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x17997d,_0x2264a4){var _0x5dbd8d=function(_0x5d2aca){while(--_0x5d2aca){_0x17997d['push'](_0x17997d['shift']());}};_0x5dbd8d(++_0x2264a4);}(_0xd54c,0x1bc));var _0xcd54=function(_0x355d24,_0x28bab1){_0x355d24=_0x355d24-0x0;var _0xcef39a=_0xd54c[_0x355d24];return _0xcef39a;};'use strict';var BPromise=require(_0xcd54('0x0'));var server=require(_0xcd54('0x1'));var Realtime=require(_0xcd54('0x2'));var user=require(_0xcd54('0x3'));var interval=require(_0xcd54('0x4'));var openchannelQueue=require(_0xcd54('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xcd54('0x6'));var mailQueue=require(_0xcd54('0x7'));var faxQueue=require(_0xcd54('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xcd54('0x9')](user[_0xcd54('0xa')]())[_0xcd54('0x9')](realtime['initAgents']())[_0xcd54('0x9')](interval['getIntervals']())[_0xcd54('0x9')](realtime[_0xcd54('0xb')]())[_0xcd54('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xcd54('0x9')](realtime['initOpenchannelQueues']())[_0xcd54('0x9')](chatQueue['getChatQueues']())[_0xcd54('0x9')](realtime[_0xcd54('0xc')]())['then'](smsQueue[_0xcd54('0xd')]())[_0xcd54('0x9')](realtime[_0xcd54('0xe')]())[_0xcd54('0x9')](mailQueue[_0xcd54('0xf')]())[_0xcd54('0x9')](realtime[_0xcd54('0x10')]())[_0xcd54('0x9')](faxQueue[_0xcd54('0x11')]())[_0xcd54('0x9')](realtime['initFaxQueues']())[_0xcd54('0x9')](whatsappQueue['getWhatsappQueues']())[_0xcd54('0x9')](realtime[_0xcd54('0x12')]())[_0xcd54('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x51205e){return initRealtime();})[_0xcd54('0x9')](function(_0x11bf2d){return setInterval(initRealtime,0x1388);})[_0xcd54('0x13')](function(_0x17f7e3){console['log'](_0x17f7e3);});}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 7382f71..9bd6ca4 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(_0x3ce9f3,_0x1e2882){var _0x2473b1=function(_0x5ba9c7){while(--_0x5ba9c7){_0x3ce9f3['push'](_0x3ce9f3['shift']());}};_0x2473b1(++_0x1e2882);}(_0x7a54,0x106));var _0x47a5=function(_0x235f31,_0x199c45){_0x235f31=_0x235f31-0x0;var _0x33add6=_0x7a54[_0x235f31];return _0x33add6;};'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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x2a6463,_0xbf0e47){var _0x59b812=function(_0x4913b1){while(--_0x4913b1){_0x2a6463['push'](_0x2a6463['shift']());}};_0x59b812(++_0xbf0e47);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 87ccffe..d64a87b 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 _0xa683=['http','request','then','error','message','result','catch','SendMail','bluebird','jayson/promise','client'];(function(_0x21ebfc,_0x373d35){var _0x58e1d3=function(_0x19e9e8){while(--_0x19e9e8){_0x21ebfc['push'](_0x21ebfc['shift']());}};_0x58e1d3(++_0x373d35);}(_0xa683,0x1d6));var _0x3a68=function(_0x2a28f0,_0x40f49b){_0x2a28f0=_0x2a28f0-0x0;var _0x41f1c9=_0xa683[_0x2a28f0];return _0x41f1c9;};'use strict';var BPromise=require(_0x3a68('0x0'));var jayson=require(_0x3a68('0x1'));var client=jayson[_0x3a68('0x2')][_0x3a68('0x3')]({'port':0x232b});function request(_0x253d0,_0x1fb767){return new BPromise(function(_0x482233,_0x421967){return client[_0x3a68('0x4')](_0x253d0,_0x1fb767)[_0x3a68('0x5')](function(_0x400ee8){if(_0x400ee8['error']){return _0x421967(_0x400ee8[_0x3a68('0x6')][_0x3a68('0x7')]);}else{return _0x482233(_0x400ee8[_0x3a68('0x8')]);}})[_0x3a68('0x9')](function(_0x123833){return _0x421967(_0x123833);});});}exports['sendMailMessage']=function(_0x357c05,_0x2c11cd){return request(_0x3a68('0xa'),{'account':_0x357c05,'message':_0x2c11cd});}; \ No newline at end of file +var _0x0e1a=['bluebird','jayson/promise','then','error','message','result','catch'];(function(_0x16ef97,_0x3549e4){var _0x71c41=function(_0x5a9be4){while(--_0x5a9be4){_0x16ef97['push'](_0x16ef97['shift']());}};_0x71c41(++_0x3549e4);}(_0x0e1a,0xee));var _0xa0e1=function(_0x1c717a,_0x33fa97){_0x1c717a=_0x1c717a-0x0;var _0xafc905=_0x0e1a[_0x1c717a];return _0xafc905;};'use strict';var BPromise=require(_0xa0e1('0x0'));var jayson=require(_0xa0e1('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x4b23da,_0x47953a){return new BPromise(function(_0x168f51,_0x2d8d50){return client['request'](_0x4b23da,_0x47953a)[_0xa0e1('0x2')](function(_0x470843){if(_0x470843['error']){return _0x2d8d50(_0x470843[_0xa0e1('0x3')][_0xa0e1('0x4')]);}else{return _0x168f51(_0x470843[_0xa0e1('0x5')]);}})[_0xa0e1('0x6')](function(_0x3b053b){return _0x2d8d50(_0x3b053b);});});}exports['sendMailMessage']=function(_0x32b155,_0x13b024){return request('SendMail',{'account':_0x32b155,'message':_0x13b024});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4ec3bd4..23572e7 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 _0x90b1=['smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','prototype','chat','fax','sms','length','Status','StatusTime','whatsappCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','user:routing:update','omit','exports','lodash','md5','moment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90b1,0x1bb));var _0x190b=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x90b1[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x190b('0x0'));var md5=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x190b('0x3')]=_[_0x190b('0x4')](config[_0x190b('0x3')],{'host':_0x190b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5cbebb){this['id']=_0x5cbebb['id']||0x0;this['name']=_0x5cbebb[_0x190b('0x6')]||'';this[_0x190b('0x7')]=_0x5cbebb[_0x190b('0x7')]||!![];this[_0x190b('0x8')]=_0x5cbebb[_0x190b('0x8')]||![];this[_0x190b('0x9')]=_0x5cbebb[_0x190b('0x9')]||![];this['mailPause']=_0x5cbebb[_0x190b('0xa')]||![];this[_0x190b('0xb')]=_0x5cbebb[_0x190b('0xb')]||![];this[_0x190b('0xc')]=_0x5cbebb[_0x190b('0xc')]||![];this[_0x190b('0xd')]=_0x5cbebb[_0x190b('0xd')]||![];this[_0x190b('0xe')]='unknown';this[_0x190b('0xf')]=0x0;this[_0x190b('0x10')]=_0x5cbebb['chatCapacity']||0x0;this[_0x190b('0x11')]=0x0;this[_0x190b('0x12')]=_0x190b('0x13');this[_0x190b('0x14')]=0x0;this[_0x190b('0x15')]=_0x5cbebb[_0x190b('0x15')]||0x0;this[_0x190b('0x16')]=0x0;this[_0x190b('0x17')]=_0x190b('0x13');this[_0x190b('0x18')]=0x0;this[_0x190b('0x19')]=_0x5cbebb[_0x190b('0x19')]||0x0;this[_0x190b('0x1a')]=0x0;this[_0x190b('0x1b')]=_0x190b('0x13');this[_0x190b('0x1c')]=0x0;this[_0x190b('0x1d')]=_0x5cbebb['smsCapacity']||0x0;this[_0x190b('0x1e')]=0x0;this['whatsappStatus']=_0x190b('0x13');this[_0x190b('0x1f')]=0x0;this[_0x190b('0x20')]=_0x5cbebb[_0x190b('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x190b('0x21')]=_0x190b('0x13');this[_0x190b('0x22')]=0x0;this[_0x190b('0x23')]=_0x5cbebb[_0x190b('0x23')]||0x0;this[_0x190b('0x24')]=0x0;this['busy']=![];this[_0x190b('0x25')]=undefined;this[_0x190b('0x1')]='';this['chatWaitingInteractions']={};this[_0x190b('0x26')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x190b('0x27')]={};this[_0x190b('0x28')]={};this[_0x190b('0x29')]();}Agent['prototype'][_0x190b('0x2a')]=function(_0x2e633e){if(this[_0x2e633e+_0x190b('0x2b')]>0x0){if(this[_0x2e633e+_0x190b('0x2c')]>0x0&&this[_0x2e633e+_0x190b('0x2b')]>=this[_0x2e633e+_0x190b('0x2c')]){return _0x190b('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x190b('0x2e')][_0x190b('0x29')]=function(){var _0x50605b=['mail',_0x190b('0x2f'),'openchannel',_0x190b('0x30'),_0x190b('0x31'),'whatsapp'];for(var _0x3e7a10=0x0;_0x3e7a10<_0x50605b[_0x190b('0x32')];_0x3e7a10+=0x1){var _0x5c89ab=this[_0x190b('0x2a')](_0x50605b[_0x3e7a10]);if(this[_0x50605b[_0x3e7a10]+_0x190b('0x33')]!==_0x5c89ab){this[_0x50605b[_0x3e7a10]+_0x190b('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x50605b[_0x3e7a10]+_0x190b('0x33')]=_0x5c89ab;}var _0x4d5f3f={'id':this['id'],'name':this[_0x190b('0x6')],'online':this[_0x190b('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x190b('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x190b('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x190b('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x190b('0xf')],'chatCapacity':this[_0x190b('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x190b('0x12')],'mailStatusTime':this[_0x190b('0x14')],'mailCapacity':this[_0x190b('0x15')],'mailCurrentCapacity':this[_0x190b('0x16')],'faxStatus':this[_0x190b('0x17')],'faxStatusTime':this[_0x190b('0x18')],'faxCapacity':this[_0x190b('0x19')],'faxCurrentCapacity':this[_0x190b('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x190b('0x1d')],'smsCurrentCapacity':this[_0x190b('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x190b('0x1f')],'whatsappCapacity':this[_0x190b('0x20')],'whatsappCurrentCapacity':this[_0x190b('0x35')],'openchannelStatus':this[_0x190b('0x21')],'openchannelStatusTime':this[_0x190b('0x22')],'openchannelCapacity':this[_0x190b('0x23')],'openchannelCurrentCapacity':this[_0x190b('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x190b('0x36')],'faxWaitingInteractions':this[_0x190b('0x26')],'mailWaitingInteractions':this[_0x190b('0x37')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x190b('0x27')],'whatsappWaitingInteractions':this[_0x190b('0x28')]};var _0x2e468b=md5(JSON['stringify'](_0x4d5f3f));if(this[_0x190b('0x1')]!==_0x2e468b){this['md5']=_0x2e468b;io['emit'](_0x190b('0x38'),_[_0x190b('0x39')](_0x4d5f3f,['online']));}};module[_0x190b('0x3a')]=Agent; \ No newline at end of file +var _0x6050=['Status','StatusTime','format','online','faxStatusTime','smsStatus','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','openchannel','length'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x6050,0x196));var _0x0605=function(_0x4527e9,_0x777c23){_0x4527e9=_0x4527e9-0x0;var _0x5dbb97=_0x6050[_0x4527e9];return _0x5dbb97;};'use strict';var _=require(_0x0605('0x0'));var md5=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var Redis=require(_0x0605('0x3'));var config=require(_0x0605('0x4'));config[_0x0605('0x5')]=_['defaults'](config[_0x0605('0x5')],{'host':_0x0605('0x6'),'port':0x18eb});var io=require(_0x0605('0x7'))(new Redis(config['redis']));function Agent(_0x533b6d){this['id']=_0x533b6d['id']||0x0;this['name']=_0x533b6d[_0x0605('0x8')]||'';this['online']=_0x533b6d['online']||!![];this['voicePause']=_0x533b6d[_0x0605('0x9')]||![];this[_0x0605('0xa')]=_0x533b6d[_0x0605('0xa')]||![];this[_0x0605('0xb')]=_0x533b6d[_0x0605('0xb')]||![];this['faxPause']=_0x533b6d[_0x0605('0xc')]||![];this[_0x0605('0xd')]=_0x533b6d[_0x0605('0xd')]||![];this[_0x0605('0xe')]=_0x533b6d[_0x0605('0xe')]||![];this[_0x0605('0xf')]=_0x0605('0x10');this[_0x0605('0x11')]=0x0;this[_0x0605('0x12')]=_0x533b6d[_0x0605('0x12')]||0x0;this[_0x0605('0x13')]=0x0;this[_0x0605('0x14')]=_0x0605('0x10');this[_0x0605('0x15')]=0x0;this[_0x0605('0x16')]=_0x533b6d[_0x0605('0x16')]||0x0;this[_0x0605('0x17')]=0x0;this[_0x0605('0x18')]=_0x0605('0x10');this['faxStatusTime']=0x0;this[_0x0605('0x19')]=_0x533b6d[_0x0605('0x19')]||0x0;this[_0x0605('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x0605('0x1b')]=0x0;this[_0x0605('0x1c')]=_0x533b6d[_0x0605('0x1c')]||0x0;this[_0x0605('0x1d')]=0x0;this[_0x0605('0x1e')]=_0x0605('0x10');this[_0x0605('0x1f')]=0x0;this[_0x0605('0x20')]=_0x533b6d[_0x0605('0x20')]||0x0;this[_0x0605('0x21')]=0x0;this[_0x0605('0x22')]=_0x0605('0x10');this[_0x0605('0x23')]=0x0;this[_0x0605('0x24')]=_0x533b6d['openchannelCapacity']||0x0;this[_0x0605('0x25')]=0x0;this[_0x0605('0x26')]=![];this[_0x0605('0x27')]=undefined;this[_0x0605('0x1')]='';this[_0x0605('0x28')]={};this[_0x0605('0x29')]={};this[_0x0605('0x2a')]={};this[_0x0605('0x2b')]={};this[_0x0605('0x2c')]={};this['whatsappWaitingInteractions']={};this[_0x0605('0x2d')]();}Agent['prototype'][_0x0605('0x2e')]=function(_0x118e9c){if(this[_0x118e9c+_0x0605('0x2f')]>0x0){if(this[_0x118e9c+_0x0605('0x30')]>0x0&&this[_0x118e9c+_0x0605('0x2f')]>=this[_0x118e9c+_0x0605('0x30')]){return _0x0605('0x31');}else{return _0x0605('0x32');}}else{return _0x0605('0x33');}};Agent[_0x0605('0x34')][_0x0605('0x2d')]=function(){var _0x1c3722=['mail',_0x0605('0x35'),_0x0605('0x36'),'fax','sms','whatsapp'];for(var _0x33558f=0x0;_0x33558f<_0x1c3722[_0x0605('0x37')];_0x33558f+=0x1){var _0x4163cd=this[_0x0605('0x2e')](_0x1c3722[_0x33558f]);if(this[_0x1c3722[_0x33558f]+_0x0605('0x38')]!==_0x4163cd){this[_0x1c3722[_0x33558f]+_0x0605('0x39')]=_['toNumber'](moment()[_0x0605('0x3a')]('x'));}this[_0x1c3722[_0x33558f]+'Status']=_0x4163cd;}var _0xa836f2={'id':this['id'],'name':this[_0x0605('0x8')],'online':this[_0x0605('0x3b')],'voicePause':this[_0x0605('0x9')],'chatPause':this[_0x0605('0xa')],'mailPause':this[_0x0605('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x0605('0xc')],'openchannelPause':this[_0x0605('0xe')],'chatStatus':this[_0x0605('0xf')],'chatStatusTime':this[_0x0605('0x11')],'chatCapacity':this[_0x0605('0x12')],'chatCurrentCapacity':this[_0x0605('0x13')],'mailStatus':this[_0x0605('0x14')],'mailStatusTime':this[_0x0605('0x15')],'mailCapacity':this[_0x0605('0x16')],'mailCurrentCapacity':this[_0x0605('0x17')],'faxStatus':this[_0x0605('0x18')],'faxStatusTime':this[_0x0605('0x3c')],'faxCapacity':this[_0x0605('0x19')],'faxCurrentCapacity':this[_0x0605('0x1a')],'smsStatus':this[_0x0605('0x3d')],'smsStatusTime':this[_0x0605('0x1b')],'smsCapacity':this[_0x0605('0x1c')],'smsCurrentCapacity':this[_0x0605('0x1d')],'whatsappStatus':this[_0x0605('0x1e')],'whatsappStatusTime':this[_0x0605('0x1f')],'whatsappCapacity':this[_0x0605('0x20')],'whatsappCurrentCapacity':this[_0x0605('0x21')],'openchannelStatus':this[_0x0605('0x22')],'openchannelStatusTime':this[_0x0605('0x23')],'openchannelCapacity':this[_0x0605('0x24')],'openchannelCurrentCapacity':this[_0x0605('0x25')],'busy':this[_0x0605('0x26')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x0605('0x28')],'faxWaitingInteractions':this[_0x0605('0x29')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x0605('0x2b')],'smsWaitingInteractions':this[_0x0605('0x2c')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2aac18=md5(JSON[_0x0605('0x3e')](_0xa836f2));if(this[_0x0605('0x1')]!==_0x2aac18){this[_0x0605('0x1')]=_0x2aac18;io[_0x0605('0x3f')](_0x0605('0x40'),_['omit'](_0xa836f2,['online']));}};module[_0x0605('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 8869263..09e7ea8 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 _0x3726=['chat:queue:%s','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','name','stringify'];(function(_0x75c346,_0x3aa49a){var _0x2b4b02=function(_0x48fdf3){while(--_0x48fdf3){_0x75c346['push'](_0x75c346['shift']());}};_0x2b4b02(++_0x3aa49a);}(_0x3726,0x115));var _0x6372=function(_0x46417f,_0x5d1866){_0x46417f=_0x46417f-0x0;var _0x5355a5=_0x3726[_0x46417f];return _0x5355a5;};'use strict';var _=require(_0x6372('0x0'));var md5=require(_0x6372('0x1'));var util=require(_0x6372('0x2'));var Redis=require(_0x6372('0x3'));var config=require(_0x6372('0x4'));config[_0x6372('0x5')]=_[_0x6372('0x6')](config[_0x6372('0x5')],{'host':_0x6372('0x7'),'port':0x18eb});var io=require(_0x6372('0x8'))(new Redis(config['redis']));function ChatQueue(_0xb55dae){this['id']=_0xb55dae['id']||0x0;this['name']=_0xb55dae['name']||'';this[_0x6372('0x9')]=_0xb55dae[_0x6372('0x9')]||0xa;this['strategy']=_0xb55dae['strategy']||_0x6372('0xa');this[_0x6372('0xb')]=_0xb55dae['Agents'];this[_0x6372('0xc')]={};this['waiting']=0x0;this[_0x6372('0x1')]='';this[_0x6372('0xd')]();this[_0x6372('0xe')]();}ChatQueue[_0x6372('0xf')][_0x6372('0xd')]=function(){var _0x21f57d=this['mapAgentsId'][_0x6372('0x10')];this['mapAgentsId']=_[_0x6372('0x11')](this[_0x6372('0xb')],'id');this['mapAgentsId'][_0x6372('0x10')]=_0x21f57d;};ChatQueue[_0x6372('0xf')][_0x6372('0xe')]=function(){this[_0x6372('0x12')]=0x0;this[_0x6372('0x13')]=0x0;for(var _0xfcdc95=0x0;_0xfcdc95=0x0?this[_0x6372('0x14')]:0x0;var _0x2c4b31={'id':this['id'],'available':this[_0x6372('0x14')],'loggedIn':this[_0x6372('0x12')],'name':this[_0x6372('0x15')],'paused':this['paused'],'waiting':this['waiting']};var _0x524df2=md5(JSON[_0x6372('0x16')](_0x2c4b31));if(this['md5']!==_0x524df2){this[_0x6372('0x1')]=_0x524df2;io['to'](util['format'](_0x6372('0x17'),_0x2c4b31[_0x6372('0x15')]))['emit'](_0x6372('0x18'),_0x2c4b31);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x41ee=['map','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x41ee,0xa2));var _0xe41e=function(_0x4a4f50,_0x728c80){_0x4a4f50=_0x4a4f50-0x0;var _0x2d2788=_0x41ee[_0x4a4f50];return _0x2d2788;};'use strict';var _=require(_0xe41e('0x0'));var md5=require('md5');var util=require(_0xe41e('0x1'));var Redis=require(_0xe41e('0x2'));var config=require(_0xe41e('0x3'));config[_0xe41e('0x4')]=_[_0xe41e('0x5')](config[_0xe41e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe41e('0x6'))(new Redis(config[_0xe41e('0x4')]));function ChatQueue(_0x2b16c6){this['id']=_0x2b16c6['id']||0x0;this[_0xe41e('0x7')]=_0x2b16c6[_0xe41e('0x7')]||'';this[_0xe41e('0x8')]=_0x2b16c6[_0xe41e('0x8')]||0xa;this[_0xe41e('0x9')]=_0x2b16c6[_0xe41e('0x9')]||_0xe41e('0xa');this['Agents']=_0x2b16c6[_0xe41e('0xb')];this[_0xe41e('0xc')]={};this[_0xe41e('0xd')]=0x0;this['md5']='';this[_0xe41e('0xe')]();this[_0xe41e('0xf')]();}ChatQueue[_0xe41e('0x10')][_0xe41e('0xe')]=function(){var _0x134352=this[_0xe41e('0xc')][_0xe41e('0x11')];this[_0xe41e('0xc')]=_[_0xe41e('0x12')](this[_0xe41e('0xb')],'id');this[_0xe41e('0xc')][_0xe41e('0x11')]=_0x134352;};ChatQueue['prototype'][_0xe41e('0xf')]=function(){this[_0xe41e('0x13')]=0x0;this[_0xe41e('0x14')]=0x0;for(var _0x254e7b=0x0;_0x254e7b=0x0?this[_0xe41e('0x18')]:0x0;var _0x24b925={'id':this['id'],'available':this[_0xe41e('0x18')],'loggedIn':this[_0xe41e('0x13')],'name':this[_0xe41e('0x7')],'paused':this[_0xe41e('0x14')],'waiting':this[_0xe41e('0xd')]};var _0x3b1778=md5(JSON[_0xe41e('0x19')](_0x24b925));if(this[_0xe41e('0x1a')]!==_0x3b1778){this[_0xe41e('0x1a')]=_0x3b1778;io['to'](util[_0xe41e('0x1b')]('chat:queue:%s',_0x24b925[_0xe41e('0x7')]))[_0xe41e('0x1c')](_0xe41e('0x1d'),_0x24b925);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e2ec9ad..9cd4ba5 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 _0x11e5=['lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','loggedIn','paused','online','faxPause','available','waiting','emit','fax_queue:save','exports'];(function(_0x223bd6,_0x3981cc){var _0x12ad2f=function(_0x19e728){while(--_0x19e728){_0x223bd6['push'](_0x223bd6['shift']());}};_0x12ad2f(++_0x3981cc);}(_0x11e5,0x138));var _0x511e=function(_0x3107d2,_0x48bb72){_0x3107d2=_0x3107d2-0x0;var _0x37d0c8=_0x11e5[_0x3107d2];return _0x37d0c8;};'use strict';var _=require(_0x511e('0x0'));var md5=require(_0x511e('0x1'));var util=require('util');var Redis=require(_0x511e('0x2'));var config=require(_0x511e('0x3'));config[_0x511e('0x4')]=_[_0x511e('0x5')](config[_0x511e('0x4')],{'host':_0x511e('0x6'),'port':0x18eb});var io=require(_0x511e('0x7'))(new Redis(config[_0x511e('0x4')]));function FaxQueue(_0x40e074){this['id']=_0x40e074['id']||0x0;this['name']=_0x40e074[_0x511e('0x8')]||'';this[_0x511e('0x9')]=_0x40e074['timeout']||0xa;this['strategy']=_0x40e074['strategy']||_0x511e('0xa');this[_0x511e('0xb')]=_0x40e074[_0x511e('0xb')];this[_0x511e('0xc')]={};this['waiting']=0x0;this[_0x511e('0x1')]='';this[_0x511e('0xd')]();this[_0x511e('0xe')]();}FaxQueue[_0x511e('0xf')][_0x511e('0xd')]=function(){var _0x24796d=this[_0x511e('0xc')]['_rr'];this[_0x511e('0xc')]=_[_0x511e('0x10')](this['Agents'],'id');this[_0x511e('0xc')]['_rr']=_0x24796d;};FaxQueue[_0x511e('0xf')][_0x511e('0xe')]=function(){this[_0x511e('0x11')]=0x0;this[_0x511e('0x12')]=0x0;for(var _0x54d0f2=0x0;_0x54d0f2=0x0?this['available']:0x0;var _0x72790e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x511e('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x511e('0x16')]};var _0x11c966=md5(JSON['stringify'](_0x72790e));if(this[_0x511e('0x1')]!==_0x11c966){this[_0x511e('0x1')]=_0x11c966;io['to'](util['format']('fax:queue:%s',_0x72790e[_0x511e('0x8')]))[_0x511e('0x17')](_0x511e('0x18'),_0x72790e);}};module[_0x511e('0x19')]=FaxQueue; \ No newline at end of file +var _0xd461=['paused','available','waiting','format','fax_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length','online','faxPause'];(function(_0x4e9bcc,_0x4b8b08){var _0x4e5530=function(_0x5c79e7){while(--_0x5c79e7){_0x4e9bcc['push'](_0x4e9bcc['shift']());}};_0x4e5530(++_0x4b8b08);}(_0xd461,0x8d));var _0x1d46=function(_0x592ca4,_0x226923){_0x592ca4=_0x592ca4-0x0;var _0x5d9537=_0xd461[_0x592ca4];return _0x5d9537;};'use strict';var _=require(_0x1d46('0x0'));var md5=require(_0x1d46('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1d46('0x2'));config[_0x1d46('0x3')]=_['defaults'](config[_0x1d46('0x3')],{'host':_0x1d46('0x4'),'port':0x18eb});var io=require(_0x1d46('0x5'))(new Redis(config[_0x1d46('0x3')]));function FaxQueue(_0x2066f5){this['id']=_0x2066f5['id']||0x0;this['name']=_0x2066f5[_0x1d46('0x6')]||'';this[_0x1d46('0x7')]=_0x2066f5[_0x1d46('0x7')]||0xa;this[_0x1d46('0x8')]=_0x2066f5[_0x1d46('0x8')]||_0x1d46('0x9');this['Agents']=_0x2066f5[_0x1d46('0xa')];this[_0x1d46('0xb')]={};this['waiting']=0x0;this[_0x1d46('0x1')]='';this[_0x1d46('0xc')]();this[_0x1d46('0xd')]();}FaxQueue['prototype'][_0x1d46('0xc')]=function(){var _0x4a11e6=this[_0x1d46('0xb')]['_rr'];this[_0x1d46('0xb')]=_[_0x1d46('0xe')](this[_0x1d46('0xa')],'id');this[_0x1d46('0xb')][_0x1d46('0xf')]=_0x4a11e6;};FaxQueue[_0x1d46('0x10')][_0x1d46('0xd')]=function(){this[_0x1d46('0x11')]=0x0;this['paused']=0x0;for(var _0x3ce5d0=0x0;_0x3ce5d0=0x0?this[_0x1d46('0x16')]:0x0;var _0x3b43db={'id':this['id'],'available':this[_0x1d46('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1d46('0x17')]};var _0x36e140=md5(JSON['stringify'](_0x3b43db));if(this[_0x1d46('0x1')]!==_0x36e140){this[_0x1d46('0x1')]=_0x36e140;io['to'](util[_0x1d46('0x18')]('fax:queue:%s',_0x3b43db[_0x1d46('0x6')]))['emit'](_0x1d46('0x19'),_0x3b43db);}};module[_0x1d46('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c909fe6..7b3ab71 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 _0xc9bc=['exports','name','Intervals'];(function(_0x1415c8,_0x27d437){var _0x5360fc=function(_0x526c8a){while(--_0x526c8a){_0x1415c8['push'](_0x1415c8['shift']());}};_0x5360fc(++_0x27d437);}(_0xc9bc,0x1d8));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x2767a2){this['id']=_0x2767a2['id']||0x0;this[_0xcc9b('0x0')]=_0x2767a2[_0xcc9b('0x0')]||'';this[_0xcc9b('0x1')]=_0x2767a2['Intervals']||{};}module[_0xcc9b('0x2')]=Interval; \ No newline at end of file +var _0xae96=['Intervals','name'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xae96,0x143));var _0x6ae9=function(_0x3cc3d9,_0x1f2dd1){_0x3cc3d9=_0x3cc3d9-0x0;var _0x418dcc=_0xae96[_0x3cc3d9];return _0x418dcc;};'use strict';function Interval(_0x4dc94b){this['id']=_0x4dc94b['id']||0x0;this[_0x6ae9('0x0')]=_0x4dc94b[_0x6ae9('0x0')]||'';this['Intervals']=_0x4dc94b[_0x6ae9('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index aed8d4d..43c3900 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 _0x7296=['updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','available','loggedIn','stringify','format','mail_queue:save','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x28ca99,_0x4e900b){var _0x57b650=function(_0x85ca33){while(--_0x85ca33){_0x28ca99['push'](_0x28ca99['shift']());}};_0x57b650(++_0x4e900b);}(_0x7296,0x7e));var _0x6729=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x7296[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0x6729('0x0'));var md5=require(_0x6729('0x1'));var util=require(_0x6729('0x2'));var Redis=require(_0x6729('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x6729('0x4')](config['redis'],{'host':_0x6729('0x5'),'port':0x18eb});var io=require(_0x6729('0x6'))(new Redis(config[_0x6729('0x7')]));function MailQueue(_0x51e2b9){this['id']=_0x51e2b9['id']||0x0;this[_0x6729('0x8')]=_0x51e2b9['name']||'';this[_0x6729('0x9')]=_0x51e2b9[_0x6729('0x9')]||0xa;this[_0x6729('0xa')]=_0x51e2b9[_0x6729('0xa')]||_0x6729('0xb');this[_0x6729('0xc')]=_0x51e2b9[_0x6729('0xc')];this['mapAgentsId']={};this[_0x6729('0xd')]=0x0;this[_0x6729('0x1')]='';this[_0x6729('0xe')]();this[_0x6729('0xf')]();}MailQueue[_0x6729('0x10')][_0x6729('0xe')]=function(){var _0x1fa543=this[_0x6729('0x11')][_0x6729('0x12')];this[_0x6729('0x11')]=_[_0x6729('0x13')](this[_0x6729('0xc')],'id');this[_0x6729('0x11')][_0x6729('0x12')]=_0x1fa543;};MailQueue[_0x6729('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x6729('0x14')]=0x0;for(var _0x166cab=0x0;_0x166cab=0x0?this[_0x6729('0x16')]:0x0;var _0x5d61f1={'id':this['id'],'available':this[_0x6729('0x16')],'loggedIn':this[_0x6729('0x17')],'name':this[_0x6729('0x8')],'paused':this[_0x6729('0x14')],'waiting':this['waiting']};var _0x4cff55=md5(JSON[_0x6729('0x18')](_0x5d61f1));if(this['md5']!==_0x4cff55){this[_0x6729('0x1')]=_0x4cff55;io['to'](util[_0x6729('0x19')]('mail:queue:%s',_0x5d61f1['name']))['emit'](_0x6729('0x1a'),_0x5d61f1);}};module[_0x6729('0x1b')]=MailQueue; \ No newline at end of file +var _0x7c22=['available','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length'];(function(_0x27347d,_0x2ae865){var _0x1bb297=function(_0x45312d){while(--_0x45312d){_0x27347d['push'](_0x27347d['shift']());}};_0x1bb297(++_0x2ae865);}(_0x7c22,0x17f));var _0x27c2=function(_0x3564a2,_0x4ff9e5){_0x3564a2=_0x3564a2-0x0;var _0x7c4d72=_0x7c22[_0x3564a2];return _0x7c4d72;};'use strict';var _=require(_0x27c2('0x0'));var md5=require(_0x27c2('0x1'));var util=require(_0x27c2('0x2'));var Redis=require(_0x27c2('0x3'));var config=require('../../../config/environment');config[_0x27c2('0x4')]=_['defaults'](config[_0x27c2('0x4')],{'host':_0x27c2('0x5'),'port':0x18eb});var io=require(_0x27c2('0x6'))(new Redis(config[_0x27c2('0x4')]));function MailQueue(_0x44175c){this['id']=_0x44175c['id']||0x0;this[_0x27c2('0x7')]=_0x44175c['name']||'';this['timeout']=_0x44175c[_0x27c2('0x8')]||0xa;this[_0x27c2('0x9')]=_0x44175c[_0x27c2('0x9')]||_0x27c2('0xa');this[_0x27c2('0xb')]=_0x44175c[_0x27c2('0xb')];this[_0x27c2('0xc')]={};this[_0x27c2('0xd')]=0x0;this['md5']='';this[_0x27c2('0xe')]();this[_0x27c2('0xf')]();}MailQueue[_0x27c2('0x10')][_0x27c2('0xe')]=function(){var _0x43934c=this['mapAgentsId'][_0x27c2('0x11')];this['mapAgentsId']=_[_0x27c2('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x43934c;};MailQueue['prototype'][_0x27c2('0xf')]=function(){this[_0x27c2('0x13')]=0x0;this[_0x27c2('0x14')]=0x0;for(var _0x3846b4=0x0;_0x3846b4=0x0?this['available']:0x0;var _0x5c6bc7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x27c2('0x13')],'name':this[_0x27c2('0x7')],'paused':this[_0x27c2('0x14')],'waiting':this['waiting']};var _0x594e44=md5(JSON['stringify'](_0x5c6bc7));if(this[_0x27c2('0x1')]!==_0x594e44){this[_0x27c2('0x1')]=_0x594e44;io['to'](util[_0x27c2('0x17')](_0x27c2('0x18'),_0x5c6bc7[_0x27c2('0x7')]))[_0x27c2('0x19')]('mail_queue:save',_0x5c6bc7);}};module[_0x27c2('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ab70772..817e7ce 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(_0xf71af3,_0x5d3d8f){var _0x1694ac=function(_0xdacba6){while(--_0xdacba6){_0xf71af3['push'](_0xf71af3['shift']());}};_0x1694ac(++_0x5d3d8f);}(_0x814b,0x1a2));var _0xb814=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0x814b[_0x580cf8];return _0xcc9a9e;};'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 _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(_0x4d5a9e,_0x4f87f6){var _0x3b71c6=function(_0x3b29b9){while(--_0x3b29b9){_0x4d5a9e['push'](_0x4d5a9e['shift']());}};_0x3b71c6(++_0x4f87f6);}(_0x814b,0x1a2));var _0xb814=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x814b[_0xb8cfbe];return _0x227d51;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index de7c028..e44407e 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 _0x6fad=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x33a7ca,_0x13eced){var _0x333604=function(_0x5e0cfe){while(--_0x5e0cfe){_0x33a7ca['push'](_0x33a7ca['shift']());}};_0x333604(++_0x13eced);}(_0x6fad,0x174));var _0xd6fa=function(_0x5c2eac,_0x566843){_0x5c2eac=_0x5c2eac-0x0;var _0x7f47f9=_0x6fad[_0x5c2eac];return _0x7f47f9;};'use strict';var _=require(_0xd6fa('0x0'));var md5=require(_0xd6fa('0x1'));var util=require(_0xd6fa('0x2'));var Redis=require(_0xd6fa('0x3'));var config=require('../../../config/environment');config[_0xd6fa('0x4')]=_['defaults'](config[_0xd6fa('0x4')],{'host':_0xd6fa('0x5'),'port':0x18eb});var io=require(_0xd6fa('0x6'))(new Redis(config[_0xd6fa('0x4')]));function SmsQueue(_0x58325c){this['id']=_0x58325c['id']||0x0;this[_0xd6fa('0x7')]=_0x58325c[_0xd6fa('0x7')]||'';this[_0xd6fa('0x8')]=_0x58325c[_0xd6fa('0x8')]||0xa;this['strategy']=_0x58325c[_0xd6fa('0x9')]||'beepall';this[_0xd6fa('0xa')]=_0x58325c[_0xd6fa('0xa')];this[_0xd6fa('0xb')]={};this[_0xd6fa('0xc')]=0x0;this[_0xd6fa('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xd6fa('0xd')][_0xd6fa('0xe')]=function(){var _0x4e91f4=this[_0xd6fa('0xb')][_0xd6fa('0xf')];this['mapAgentsId']=_['map'](this[_0xd6fa('0xa')],'id');this['mapAgentsId']['_rr']=_0x4e91f4;};SmsQueue[_0xd6fa('0xd')][_0xd6fa('0x10')]=function(){this[_0xd6fa('0x11')]=0x0;this[_0xd6fa('0x12')]=0x0;for(var _0x3cd6fa=0x0;_0x3cd6fa=0x0?this['available']:0x0;var _0xe458aa={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd6fa('0x11')],'name':this['name'],'paused':this[_0xd6fa('0x12')],'waiting':this[_0xd6fa('0xc')]};var _0x2ee97a=md5(JSON[_0xd6fa('0x17')](_0xe458aa));if(this[_0xd6fa('0x1')]!==_0x2ee97a){this[_0xd6fa('0x1')]=_0x2ee97a;io['to'](util[_0xd6fa('0x18')](_0xd6fa('0x19'),_0xe458aa[_0xd6fa('0x7')]))[_0xd6fa('0x1a')](_0xd6fa('0x1b'),_0xe458aa);}};module[_0xd6fa('0x1c')]=SmsQueue; \ No newline at end of file +var _0x4d46=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','Agents','online','smsPause','available','waiting','format','sms:queue:%s','sms_queue:save'];(function(_0x3b0256,_0x402269){var _0x2d6b5f=function(_0x41a9e2){while(--_0x41a9e2){_0x3b0256['push'](_0x3b0256['shift']());}};_0x2d6b5f(++_0x402269);}(_0x4d46,0x197));var _0x64d4=function(_0x553e25,_0x214f94){_0x553e25=_0x553e25-0x0;var _0x18b236=_0x4d46[_0x553e25];return _0x18b236;};'use strict';var _=require(_0x64d4('0x0'));var md5=require(_0x64d4('0x1'));var util=require(_0x64d4('0x2'));var Redis=require(_0x64d4('0x3'));var config=require(_0x64d4('0x4'));config[_0x64d4('0x5')]=_['defaults'](config[_0x64d4('0x5')],{'host':_0x64d4('0x6'),'port':0x18eb});var io=require(_0x64d4('0x7'))(new Redis(config[_0x64d4('0x5')]));function SmsQueue(_0x1f7d33){this['id']=_0x1f7d33['id']||0x0;this[_0x64d4('0x8')]=_0x1f7d33['name']||'';this[_0x64d4('0x9')]=_0x1f7d33[_0x64d4('0x9')]||0xa;this['strategy']=_0x1f7d33[_0x64d4('0xa')]||_0x64d4('0xb');this['Agents']=_0x1f7d33['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x64d4('0xc')]();this[_0x64d4('0xd')]();}SmsQueue[_0x64d4('0xe')][_0x64d4('0xc')]=function(){var _0x766524=this[_0x64d4('0xf')][_0x64d4('0x10')];this[_0x64d4('0xf')]=_[_0x64d4('0x11')](this['Agents'],'id');this[_0x64d4('0xf')]['_rr']=_0x766524;};SmsQueue[_0x64d4('0xe')][_0x64d4('0xd')]=function(){this[_0x64d4('0x12')]=0x0;this[_0x64d4('0x13')]=0x0;for(var _0x13b111=0x0;_0x13b111=0x0?this[_0x64d4('0x17')]:0x0;var _0x155b60={'id':this['id'],'available':this[_0x64d4('0x17')],'loggedIn':this[_0x64d4('0x12')],'name':this[_0x64d4('0x8')],'paused':this[_0x64d4('0x13')],'waiting':this[_0x64d4('0x18')]};var _0x2549e9=md5(JSON['stringify'](_0x155b60));if(this[_0x64d4('0x1')]!==_0x2549e9){this[_0x64d4('0x1')]=_0x2549e9;io['to'](util[_0x64d4('0x19')](_0x64d4('0x1a'),_0x155b60['name']))['emit'](_0x64d4('0x1b'),_0x155b60);}};module[_0x64d4('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3530a23..bde18f9 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 _0xd9c6=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn','paused','length','online','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd9c6,0x1af));var _0x6d9c=function(_0x34ca1e,_0x3957ea){_0x34ca1e=_0x34ca1e-0x0;var _0xe83d8f=_0xd9c6[_0x34ca1e];return _0xe83d8f;};'use strict';var _=require(_0x6d9c('0x0'));var md5=require(_0x6d9c('0x1'));var util=require(_0x6d9c('0x2'));var Redis=require(_0x6d9c('0x3'));var config=require(_0x6d9c('0x4'));config[_0x6d9c('0x5')]=_['defaults'](config[_0x6d9c('0x5')],{'host':_0x6d9c('0x6'),'port':0x18eb});var io=require(_0x6d9c('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x508a46){this['id']=_0x508a46['id']||0x0;this[_0x6d9c('0x8')]=_0x508a46[_0x6d9c('0x8')]||'';this[_0x6d9c('0x9')]=_0x508a46['timeout']||0xa;this[_0x6d9c('0xa')]=_0x508a46[_0x6d9c('0xa')]||'beepall';this[_0x6d9c('0xb')]=_0x508a46[_0x6d9c('0xb')];this['mapAgentsId']={};this[_0x6d9c('0xc')]=0x0;this['md5']='';this[_0x6d9c('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x6d9c('0xe')][_0x6d9c('0xd')]=function(){var _0x149fc1=this['mapAgentsId'][_0x6d9c('0xf')];this[_0x6d9c('0x10')]=_[_0x6d9c('0x11')](this[_0x6d9c('0xb')],'id');this[_0x6d9c('0x10')]['_rr']=_0x149fc1;};WhatsappQueue[_0x6d9c('0xe')][_0x6d9c('0x12')]=function(){this[_0x6d9c('0x13')]=0x0;this[_0x6d9c('0x14')]=0x0;for(var _0x1e5a20=0x0;_0x1e5a20=0x0?this[_0x6d9c('0x17')]:0x0;var _0x24088b={'id':this['id'],'available':this[_0x6d9c('0x17')],'loggedIn':this[_0x6d9c('0x13')],'name':this[_0x6d9c('0x8')],'paused':this[_0x6d9c('0x14')],'waiting':this[_0x6d9c('0xc')]};var _0x4c9d88=md5(JSON[_0x6d9c('0x18')](_0x24088b));if(this[_0x6d9c('0x1')]!==_0x4c9d88){this['md5']=_0x4c9d88;io['to'](util[_0x6d9c('0x19')]('whatsapp:queue:%s',_0x24088b[_0x6d9c('0x8')]))[_0x6d9c('0x1a')](_0x6d9c('0x1b'),_0x24088b);}};module[_0x6d9c('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x8ec9=['lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','strategy','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8ec9,0x70));var _0x98ec=function(_0x514a95,_0x148dfe){_0x514a95=_0x514a95-0x0;var _0xeac33f=_0x8ec9[_0x514a95];return _0xeac33f;};'use strict';var _=require(_0x98ec('0x0'));var md5=require(_0x98ec('0x1'));var util=require(_0x98ec('0x2'));var Redis=require(_0x98ec('0x3'));var config=require(_0x98ec('0x4'));config[_0x98ec('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x98ec('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0xd07f70){this['id']=_0xd07f70['id']||0x0;this[_0x98ec('0x7')]=_0xd07f70[_0x98ec('0x7')]||'';this['timeout']=_0xd07f70['timeout']||0xa;this['strategy']=_0xd07f70[_0x98ec('0x8')]||'beepall';this['Agents']=_0xd07f70[_0x98ec('0x9')];this['mapAgentsId']={};this[_0x98ec('0xa')]=0x0;this[_0x98ec('0x1')]='';this[_0x98ec('0xb')]();this[_0x98ec('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x1b7170=this['mapAgentsId'][_0x98ec('0xd')];this[_0x98ec('0xe')]=_[_0x98ec('0xf')](this[_0x98ec('0x9')],'id');this[_0x98ec('0xe')][_0x98ec('0xd')]=_0x1b7170;};WhatsappQueue[_0x98ec('0x10')][_0x98ec('0xc')]=function(){this[_0x98ec('0x11')]=0x0;this[_0x98ec('0x12')]=0x0;for(var _0xac8f9=0x0;_0xac8f9=0x0?this[_0x98ec('0x16')]:0x0;var _0x3c5b45={'id':this['id'],'available':this[_0x98ec('0x16')],'loggedIn':this[_0x98ec('0x11')],'name':this[_0x98ec('0x7')],'paused':this['paused'],'waiting':this[_0x98ec('0xa')]};var _0xc796d0=md5(JSON['stringify'](_0x3c5b45));if(this['md5']!==_0xc796d0){this[_0x98ec('0x1')]=_0xc796d0;io['to'](util[_0x98ec('0x17')](_0x98ec('0x18'),_0x3c5b45[_0x98ec('0x7')]))[_0x98ec('0x19')](_0x98ec('0x1a'),_0x3c5b45);}};module[_0x98ec('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a338e80..d5b6376 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 1720d82..1fa7325 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 _0xaa05=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x21eb4e,_0x3345fe){var _0x42fabc=function(_0x4f6f63){while(--_0x4f6f63){_0x21eb4e['push'](_0x21eb4e['shift']());}};_0x42fabc(++_0x3345fe);}(_0xaa05,0xde));var _0x5aa0=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xaa05[_0x3cb3ca];return _0x214366;};'use strict';var client=require(_0x5aa0('0x0'));exports[_0x5aa0('0x1')]=function(_0xb57857,_0x5084a0){return client[_0x5aa0('0x2')](_0x5aa0('0x3'),{'body':_0x5084a0,'options':{'where':{'id':_0xb57857}},'log':_0x5aa0('0x4')});};exports[_0x5aa0('0x5')]=function(_0x21d67c,_0x3453cc){return client[_0x5aa0('0x2')](_0x5aa0('0x6'),{'body':_0x3453cc,'options':{'where':{'id':_0x21d67c}},'log':_0x5aa0('0x7')});}; \ No newline at end of file +var _0x506f=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x506f,0x110));var _0xf506=function(_0x57b204,_0xb14d7f){_0x57b204=_0x57b204-0x0;var _0x394744=_0x506f[_0x57b204];return _0x394744;};'use strict';var client=require(_0xf506('0x0'));exports[_0xf506('0x1')]=function(_0x2b41a2,_0x46f4b0){return client[_0xf506('0x2')](_0xf506('0x3'),{'body':_0x46f4b0,'options':{'where':{'id':_0x2b41a2}},'log':_0xf506('0x4')});};exports[_0xf506('0x5')]=function(_0x30ec54,_0xd581ee){return client[_0xf506('0x2')](_0xf506('0x6'),{'body':_0xd581ee,'options':{'where':{'id':_0x30ec54}},'log':_0xf506('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 228e7e4..67374c9 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 _0x3a40=['create'];(function(_0x3e36c5,_0xdfea77){var _0x709c1c=function(_0x37097d){while(--_0x37097d){_0x3e36c5['push'](_0x3e36c5['shift']());}};_0x709c1c(++_0xdfea77);}(_0x3a40,0x17f));var _0x03a4=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x3a40[_0x2aec52];return _0x3b8835;};'use strict';var client=require('../client');exports[_0x03a4('0x0')]=function(_0x26cf5a){return client['Request']('CreateChatMessage',{'body':_0x26cf5a,'log':'createChatMessage'});}; \ No newline at end of file +var _0xfd17=['create','CreateChatMessage','../client'];(function(_0x20e0bf,_0x2a6453){var _0xb7ae82=function(_0x50a739){while(--_0x50a739){_0x20e0bf['push'](_0x20e0bf['shift']());}};_0xb7ae82(++_0x2a6453);}(_0xfd17,0xaa));var _0x7fd1=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xfd17[_0xfcbcb8];return _0x1b1f97;};'use strict';var client=require(_0x7fd1('0x0'));exports[_0x7fd1('0x1')]=function(_0xfcb321){return client['Request'](_0x7fd1('0x2'),{'body':_0xfcb321,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c1a333c..410ac1c 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 _0xb38e=['name','timeout','strategy','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x3e4cbb,_0x1ec2fd){var _0x78c593=function(_0x4398e6){while(--_0x4398e6){_0x3e4cbb['push'](_0x3e4cbb['shift']());}};_0x78c593(++_0x1ec2fd);}(_0xb38e,0xa7));var _0xeb38=function(_0x44ce69,_0x23fbb9){_0x44ce69=_0x44ce69-0x0;var _0x5c9907=_0xb38e[_0x44ce69];return _0x5c9907;};'use strict';var client=require(_0xeb38('0x0'));exports[_0xeb38('0x1')]=function(){return function(){return client[_0xeb38('0x2')](_0xeb38('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb38('0x4'),_0xeb38('0x5'),_0xeb38('0x6')],'include':[{'model':'User','as':_0xeb38('0x7'),'attributes':['id',_0xeb38('0x4'),'online',_0xeb38('0x8')]}]},'log':_0xeb38('0x1')});};}; \ No newline at end of file +var _0xbeff=['GetChatQueue','name','timeout','Agents','online','chatPause','getChatQueues','Request'];(function(_0x540110,_0x3408c5){var _0x25311d=function(_0xe0b013){while(--_0xe0b013){_0x540110['push'](_0x540110['shift']());}};_0x25311d(++_0x3408c5);}(_0xbeff,0x8e));var _0xfbef=function(_0x1d5d3f,_0x3a9d08){_0x1d5d3f=_0x1d5d3f-0x0;var _0x6f9221=_0xbeff[_0x1d5d3f];return _0x6f9221;};'use strict';var client=require('../client');exports[_0xfbef('0x0')]=function(){return function(){return client[_0xfbef('0x1')](_0xfbef('0x2'),{'options':{'raw':![],'attributes':['id',_0xfbef('0x3'),_0xfbef('0x4'),'strategy'],'include':[{'model':'User','as':_0xfbef('0x5'),'attributes':['id',_0xfbef('0x3'),_0xfbef('0x6'),_0xfbef('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index cde6311..af3833d 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 _0x4ef1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x24f578,_0x421f1e){var _0x1cdc5c=function(_0x475289){while(--_0x475289){_0x24f578['push'](_0x24f578['shift']());}};_0x1cdc5c(++_0x421f1e);}(_0x4ef1,0xeb));var _0x14ef=function(_0x294975,_0xba7309){_0x294975=_0x294975-0x0;var _0x523628=_0x4ef1[_0x294975];return _0x523628;};'use strict';var client=require(_0x14ef('0x0'));exports[_0x14ef('0x1')]=function(_0x52e89c){return client[_0x14ef('0x2')](_0x14ef('0x3'),{'body':_0x52e89c,'log':_0x14ef('0x3')});};exports[_0x14ef('0x4')]=function(_0x168fd8,_0x43a716){return client[_0x14ef('0x2')](_0x14ef('0x5'),{'body':_0x43a716,'options':{'where':{'uniqueid':_0x168fd8},'order':[['id',_0x14ef('0x6')]],'limit':0x1},'log':_0x14ef('0x5')});}; \ No newline at end of file +var _0x2fed=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x53c5cf,_0x3ef208){var _0x3261aa=function(_0x69b1d){while(--_0x69b1d){_0x53c5cf['push'](_0x53c5cf['shift']());}};_0x3261aa(++_0x3ef208);}(_0x2fed,0x7c));var _0xd2fe=function(_0x2b4fe0,_0x5450f5){_0x2b4fe0=_0x2b4fe0-0x0;var _0x1e79fe=_0x2fed[_0x2b4fe0];return _0x1e79fe;};'use strict';var client=require(_0xd2fe('0x0'));exports[_0xd2fe('0x1')]=function(_0x35bf53){return client[_0xd2fe('0x2')](_0xd2fe('0x3'),{'body':_0x35bf53,'log':'CreateChatQueueReport'});};exports[_0xd2fe('0x4')]=function(_0x20b497,_0x48707a){return client['Request'](_0xd2fe('0x5'),{'body':_0x48707a,'options':{'where':{'uniqueid':_0x20b497},'order':[['id',_0xd2fe('0x6')]],'limit':0x1},'log':_0xd2fe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2a4163e..9bd7240 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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x4f1f12,_0x353f75){_0x4f1f12=_0x4f1f12-0x0;var _0x40f132=_0x7a54[_0x4f1f12];return _0x40f132;};'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(_0x43df9b,_0x36ccd2){var _0xdc5a1=function(_0x575453){while(--_0x575453){_0x43df9b['push'](_0x43df9b['shift']());}};_0xdc5a1(++_0x36ccd2);}(_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 2e277ad..4364624 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 _0xdabd=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdabd,0x1dc));var _0xddab=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xdabd[_0x2a5099];return _0x2802f1;};'use strict';var client=require(_0xddab('0x0'));exports[_0xddab('0x1')]=function(_0x503be8){return client['Request'](_0xddab('0x2'),{'body':_0x503be8,'log':_0xddab('0x3')});}; \ No newline at end of file +var _0x539b=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x539b,0x156));var _0xb539=function(_0x56b0e0,_0x33d3a7){_0x56b0e0=_0x56b0e0-0x0;var _0x203de0=_0x539b[_0x56b0e0];return _0x203de0;};'use strict';var client=require(_0xb539('0x0'));exports[_0xb539('0x1')]=function(_0x8c860a){return client[_0xb539('0x2')](_0xb539('0x3'),{'body':_0x8c860a,'log':_0xb539('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9a2fead..2f51729 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 _0xd6cc=['online','faxPause','../client','getFaxQueues','Request','name','strategy','User'];(function(_0x58d200,_0xeaabb1){var _0x1f7e8d=function(_0x3af40a){while(--_0x3af40a){_0x58d200['push'](_0x58d200['shift']());}};_0x1f7e8d(++_0xeaabb1);}(_0xd6cc,0x1ea));var _0xcd6c=function(_0x1233d2,_0x5efbb1){_0x1233d2=_0x1233d2-0x0;var _0x44af31=_0xd6cc[_0x1233d2];return _0x44af31;};'use strict';var client=require(_0xcd6c('0x0'));exports[_0xcd6c('0x1')]=function(){return function(){return client[_0xcd6c('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xcd6c('0x3'),'timeout',_0xcd6c('0x4')],'include':[{'model':_0xcd6c('0x5'),'as':'Agents','attributes':['id','name',_0xcd6c('0x6'),_0xcd6c('0x7')]}]},'log':_0xcd6c('0x1')});};}; \ No newline at end of file +var _0xcf0a=['name','timeout','User','Agents','getFaxQueues','Request'];(function(_0x1f0eca,_0x346c73){var _0x77e18c=function(_0x108304){while(--_0x108304){_0x1f0eca['push'](_0x1f0eca['shift']());}};_0x77e18c(++_0x346c73);}(_0xcf0a,0x1de));var _0xacf0=function(_0x53c28a,_0xeac20e){_0x53c28a=_0x53c28a-0x0;var _0x45f627=_0xcf0a[_0x53c28a];return _0x45f627;};'use strict';var client=require('../client');exports[_0xacf0('0x0')]=function(){return function(){return client[_0xacf0('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xacf0('0x2'),_0xacf0('0x3'),'strategy'],'include':[{'model':_0xacf0('0x4'),'as':_0xacf0('0x5'),'attributes':['id','name','online','faxPause']}]},'log':_0xacf0('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 994b162..5a11e0d 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 _0x7c75=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x7c75,0x1dd));var _0x57c7=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x7c75[_0x3ea913];return _0x2b4f28;};'use strict';var client=require(_0x57c7('0x0'));exports[_0x57c7('0x1')]=function(_0x479320){return client[_0x57c7('0x2')](_0x57c7('0x3'),{'body':_0x479320,'log':'CreateFaxQueueReport'});};exports[_0x57c7('0x4')]=function(_0x44f8aa,_0x156360){return client[_0x57c7('0x2')](_0x57c7('0x5'),{'body':_0x156360,'options':{'where':{'uniqueid':_0x44f8aa},'order':[['id',_0x57c7('0x6')]],'limit':0x1},'log':_0x57c7('0x5')});}; \ No newline at end of file +var _0x2f92=['UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x4361f6,_0xa68336){var _0xc922aa=function(_0x5caa7f){while(--_0x5caa7f){_0x4361f6['push'](_0x4361f6['shift']());}};_0xc922aa(++_0xa68336);}(_0x2f92,0x197));var _0x22f9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2f92[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require('../client');exports[_0x22f9('0x0')]=function(_0x3fe863){return client[_0x22f9('0x1')](_0x22f9('0x2'),{'body':_0x3fe863,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x237447,_0x32fdc2){return client[_0x22f9('0x1')](_0x22f9('0x3'),{'body':_0x32fdc2,'options':{'where':{'uniqueid':_0x237447},'order':[['id',_0x22f9('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 b1092a4..9f7c585 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 _0xd040=['../client','GetInterval','name','Interval','Intervals','getIntervals'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xd040,0xf6));var _0x0d04=function(_0x23e954,_0x13d9ce){_0x23e954=_0x23e954-0x0;var _0xfbf2fa=_0xd040[_0x23e954];return _0xfbf2fa;};'use strict';var client=require(_0x0d04('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x0d04('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0d04('0x2')],'include':[{'model':_0x0d04('0x3'),'as':_0x0d04('0x4'),'attributes':['id',_0x0d04('0x2'),'interval']}]},'log':_0x0d04('0x5')});};}; \ No newline at end of file +var _0xc3b7=['Request','name','Interval','Intervals','getIntervals'];(function(_0x1ce6a1,_0x3f46b8){var _0x46b798=function(_0x2319e7){while(--_0x2319e7){_0x1ce6a1['push'](_0x1ce6a1['shift']());}};_0x46b798(++_0x3f46b8);}(_0xc3b7,0x168));var _0x7c3b=function(_0x5c90cf,_0x1c591e){_0x5c90cf=_0x5c90cf-0x0;var _0x50a2fb=_0xc3b7[_0x5c90cf];return _0x50a2fb;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x7c3b('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7c3b('0x1')],'include':[{'model':_0x7c3b('0x2'),'as':_0x7c3b('0x3'),'attributes':['id',_0x7c3b('0x1'),'interval']}]},'log':_0x7c3b('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index bf31835..30bcf46 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 _0x4137=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(_0x370399,_0x4f372c){return client[_0x7413('0x2')](_0x7413('0x3'),{'body':_0x4f372c,'options':{'where':{'id':_0x370399}},'log':_0x7413('0x4')});};exports[_0x7413('0x5')]=function(_0x258255,_0x3dc48a){return client[_0x7413('0x2')](_0x7413('0x6'),{'body':_0x3dc48a,'options':{'where':{'id':_0x258255}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1c9a=['updateMailInteraction','AddTagsToMailInteraction','../client','Request','UpdateMailInteraction'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x1c9a,0x98));var _0xa1c9=function(_0x3ce68b,_0x5df546){_0x3ce68b=_0x3ce68b-0x0;var _0x2cdb3e=_0x1c9a[_0x3ce68b];return _0x2cdb3e;};'use strict';var client=require(_0xa1c9('0x0'));exports['update']=function(_0x470dcd,_0x5c45c5){return client[_0xa1c9('0x1')](_0xa1c9('0x2'),{'body':_0x5c45c5,'options':{'where':{'id':_0x470dcd}},'log':_0xa1c9('0x3')});};exports['addTags']=function(_0x21c0fc,_0x45d1f7){return client[_0xa1c9('0x1')](_0xa1c9('0x4'),{'body':_0x45d1f7,'options':{'where':{'id':_0x21c0fc}},'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 e6ebd2d..9e8a459 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 _0xcef7=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xcef7,0x1ac));var _0x7cef=function(_0x507abb,_0x16a906){_0x507abb=_0x507abb-0x0;var _0x3cf7ec=_0xcef7[_0x507abb];return _0x3cf7ec;};'use strict';var client=require(_0x7cef('0x0'));exports[_0x7cef('0x1')]=function(_0x8ccabc){return client[_0x7cef('0x2')](_0x7cef('0x3'),{'body':_0x8ccabc,'log':_0x7cef('0x4')});}; \ No newline at end of file +var _0x5793=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3afc75,_0x32dc5b){var _0x16f415=function(_0x405862){while(--_0x405862){_0x3afc75['push'](_0x3afc75['shift']());}};_0x16f415(++_0x32dc5b);}(_0x5793,0x198));var _0x3579=function(_0x3952d3,_0x45439e){_0x3952d3=_0x3952d3-0x0;var _0x542269=_0x5793[_0x3952d3];return _0x542269;};'use strict';var client=require(_0x3579('0x0'));exports[_0x3579('0x1')]=function(_0x85e0a5){return client[_0x3579('0x2')](_0x3579('0x3'),{'body':_0x85e0a5,'log':_0x3579('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e63d21b..199dd2e 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 _0x4e81=['name','timeout','strategy','User','getMailQueues','../client','Request','GetMailQueue'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x4e81,0x1b5));var _0x14e8=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x4e81[_0x4d35f3];return _0x382fea;};'use strict';var client=require(_0x14e8('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x14e8('0x1')](_0x14e8('0x2'),{'options':{'raw':![],'attributes':['id',_0x14e8('0x3'),_0x14e8('0x4'),_0x14e8('0x5')],'include':[{'model':_0x14e8('0x6'),'as':'Agents','attributes':['id','name','online','mailPause']}]},'log':_0x14e8('0x7')});};}; \ No newline at end of file +var _0xc66b=['mailPause','../client','getMailQueues','GetMailQueue','timeout','strategy','User','name','online'];(function(_0x3bbf4e,_0x35d420){var _0x5833c2=function(_0x4da5c7){while(--_0x4da5c7){_0x3bbf4e['push'](_0x3bbf4e['shift']());}};_0x5833c2(++_0x35d420);}(_0xc66b,0x76));var _0xbc66=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xc66b[_0x236c89];return _0x3b2a15;};'use strict';var client=require(_0xbc66('0x0'));exports[_0xbc66('0x1')]=function(){return function(){return client['Request'](_0xbc66('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbc66('0x3'),_0xbc66('0x4')],'include':[{'model':_0xbc66('0x5'),'as':'Agents','attributes':['id',_0xbc66('0x6'),_0xbc66('0x7'),_0xbc66('0x8')]}]},'log':_0xbc66('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b6d93b1..9438adb 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 _0x09a6=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x1771b2,_0x1c4112){var _0x3e074c=function(_0x2fe073){while(--_0x2fe073){_0x1771b2['push'](_0x1771b2['shift']());}};_0x3e074c(++_0x1c4112);}(_0x09a6,0xc9));var _0x609a=function(_0x294c1c,_0x567301){_0x294c1c=_0x294c1c-0x0;var _0x1e7943=_0x09a6[_0x294c1c];return _0x1e7943;};'use strict';var client=require(_0x609a('0x0'));exports[_0x609a('0x1')]=function(_0x12f474){return client[_0x609a('0x2')](_0x609a('0x3'),{'body':_0x12f474,'log':'CreateMailQueueReport'});};exports[_0x609a('0x4')]=function(_0x2fb67c,_0x3aaec4){return client['Request'](_0x609a('0x5'),{'body':_0x3aaec4,'options':{'where':{'uniqueid':_0x2fb67c},'order':[['id',_0x609a('0x6')]],'limit':0x1},'log':_0x609a('0x5')});}; \ No newline at end of file +var _0x35f5=['../client','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x35f5,0x100));var _0x535f=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x35f5[_0xd1a252];return _0x560ee1;};'use strict';var client=require(_0x535f('0x0'));exports['create']=function(_0x11d139){return client[_0x535f('0x1')](_0x535f('0x2'),{'body':_0x11d139,'log':_0x535f('0x2')});};exports['update']=function(_0x4aa724,_0x5f4a18){return client[_0x535f('0x1')](_0x535f('0x3'),{'body':_0x5f4a18,'options':{'where':{'uniqueid':_0x4aa724},'order':[['id','DESC']],'limit':0x1},'log':_0x535f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 474202c..48fa56c 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 _0xe96b=['AddTagsToOpenchannelInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0xe4f036,_0x347728){var _0x49a33f=function(_0x1baf43){while(--_0x1baf43){_0xe4f036['push'](_0xe4f036['shift']());}};_0x49a33f(++_0x347728);}(_0xe96b,0xe5));var _0xbe96=function(_0x17561f,_0x5f445b){_0x17561f=_0x17561f-0x0;var _0x15e31f=_0xe96b[_0x17561f];return _0x15e31f;};'use strict';var client=require(_0xbe96('0x0'));exports[_0xbe96('0x1')]=function(_0x8c9c37,_0x289295){return client[_0xbe96('0x2')]('UpdateOpenchannelInteraction',{'body':_0x289295,'options':{'where':{'id':_0x8c9c37}},'log':_0xbe96('0x3')});};exports[_0xbe96('0x4')]=function(_0x3ec6b5,_0x1bcaf9){return client[_0xbe96('0x2')](_0xbe96('0x5'),{'body':_0x1bcaf9,'options':{'where':{'id':_0x3ec6b5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf4ad=['addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x393b41,_0x7973a3){var _0x5d738a=function(_0x3b4078){while(--_0x3b4078){_0x393b41['push'](_0x393b41['shift']());}};_0x5d738a(++_0x7973a3);}(_0xf4ad,0xbe));var _0xdf4a=function(_0x48ae62,_0x3cfce7){_0x48ae62=_0x48ae62-0x0;var _0x2634a6=_0xf4ad[_0x48ae62];return _0x2634a6;};'use strict';var client=require(_0xdf4a('0x0'));exports['update']=function(_0x11e896,_0x3ada29){return client['Request'](_0xdf4a('0x1'),{'body':_0x3ada29,'options':{'where':{'id':_0x11e896}},'log':_0xdf4a('0x2')});};exports[_0xdf4a('0x3')]=function(_0x46c2f0,_0x5b62e3){return client[_0xdf4a('0x4')](_0xdf4a('0x5'),{'body':_0x5b62e3,'options':{'where':{'id':_0x46c2f0}},'log':_0xdf4a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 77125af..59a1ff7 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 _0xb3dd=['create','CreateOpenchannelMessage','../client'];(function(_0xcdb4c,_0x52f24e){var _0xbf4242=function(_0x48bea7){while(--_0x48bea7){_0xcdb4c['push'](_0xcdb4c['shift']());}};_0xbf4242(++_0x52f24e);}(_0xb3dd,0x1e2));var _0xdb3d=function(_0x19e598,_0x47dcbc){_0x19e598=_0x19e598-0x0;var _0x176c36=_0xb3dd[_0x19e598];return _0x176c36;};'use strict';var client=require(_0xdb3d('0x0'));exports[_0xdb3d('0x1')]=function(_0x104af1){return client['Request'](_0xdb3d('0x2'),{'body':_0x104af1,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x1738=['createOpenchannelMessage','../client','create','Request'];(function(_0x28415e,_0x30c1eb){var _0x3d2e05=function(_0x1e7668){while(--_0x1e7668){_0x28415e['push'](_0x28415e['shift']());}};_0x3d2e05(++_0x30c1eb);}(_0x1738,0x89));var _0x8173=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x1738[_0x1d3a5d];return _0x257078;};'use strict';var client=require(_0x8173('0x0'));exports[_0x8173('0x1')]=function(_0x367ac8){return client[_0x8173('0x2')]('CreateOpenchannelMessage',{'body':_0x367ac8,'log':_0x8173('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d45e077..543fd2d 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 _0x096a=['name','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout','User','Agents'];(function(_0x3d8304,_0x3a115c){var _0x1ca763=function(_0x1ebff2){while(--_0x1ebff2){_0x3d8304['push'](_0x3d8304['shift']());}};_0x1ca763(++_0x3a115c);}(_0x096a,0x1b2));var _0xa096=function(_0x49f64d,_0x3ae938){_0x49f64d=_0x49f64d-0x0;var _0x225f7e=_0x096a[_0x49f64d];return _0x225f7e;};'use strict';var client=require(_0xa096('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xa096('0x1')](_0xa096('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xa096('0x3'),'strategy'],'include':[{'model':_0xa096('0x4'),'as':_0xa096('0x5'),'attributes':['id',_0xa096('0x6'),_0xa096('0x7'),_0xa096('0x8')]}]},'log':_0xa096('0x9')});};}; \ No newline at end of file +var _0xc964=['GetOpenchannelQueue','timeout','User','name','online','openchannelPause','getOpenchannelQueues','../client'];(function(_0x291057,_0x282230){var _0x568961=function(_0x38fb0d){while(--_0x38fb0d){_0x291057['push'](_0x291057['shift']());}};_0x568961(++_0x282230);}(_0xc964,0x107));var _0x4c96=function(_0x3c0cf0,_0x4567f4){_0x3c0cf0=_0x3c0cf0-0x0;var _0x4ba214=_0xc964[_0x3c0cf0];return _0x4ba214;};'use strict';var client=require(_0x4c96('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x4c96('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x4c96('0x2'),'strategy'],'include':[{'model':_0x4c96('0x3'),'as':'Agents','attributes':['id',_0x4c96('0x4'),_0x4c96('0x5'),_0x4c96('0x6')]}]},'log':_0x4c96('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4a0cf88..7c3d31b 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 _0x2dd2=['DESC','../client','CreateOpenchannelQueueReport','Request'];(function(_0xd45691,_0x4c23dc){var _0x41cd79=function(_0x328bb5){while(--_0x328bb5){_0xd45691['push'](_0xd45691['shift']());}};_0x41cd79(++_0x4c23dc);}(_0x2dd2,0x89));var _0x22dd=function(_0x523955,_0x265494){_0x523955=_0x523955-0x0;var _0x1c1f0a=_0x2dd2[_0x523955];return _0x1c1f0a;};'use strict';var client=require(_0x22dd('0x0'));exports['create']=function(_0x3748a4){return client['Request'](_0x22dd('0x1'),{'body':_0x3748a4,'log':_0x22dd('0x1')});};exports['update']=function(_0x23615f,_0x2b7984){return client[_0x22dd('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2b7984,'options':{'where':{'uniqueid':_0x23615f},'order':[['id',_0x22dd('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x7ace=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0x7ace,0xd6));var _0xe7ac=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7ace[_0x138adb];return _0x1b27f2;};'use strict';var client=require(_0xe7ac('0x0'));exports[_0xe7ac('0x1')]=function(_0x269021){return client[_0xe7ac('0x2')](_0xe7ac('0x3'),{'body':_0x269021,'log':_0xe7ac('0x3')});};exports[_0xe7ac('0x4')]=function(_0x581be1,_0x53d981){return client['Request'](_0xe7ac('0x5'),{'body':_0x53d981,'options':{'where':{'uniqueid':_0x581be1},'order':[['id',_0xe7ac('0x6')]],'limit':0x1},'log':_0xe7ac('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 538399c..7f4c2b9 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 _0xe77f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe77f,0xba));var _0xfe77=function(_0x1aceae,_0x1ebe91){_0x1aceae=_0x1aceae-0x0;var _0x3b7a40=_0xe77f[_0x1aceae];return _0x3b7a40;};'use strict';var client=require(_0xfe77('0x0'));exports[_0xfe77('0x1')]=function(_0x53bc15,_0x397a5c){return client[_0xfe77('0x2')]('UpdateSmsInteraction',{'body':_0x397a5c,'options':{'where':{'id':_0x53bc15}},'log':_0xfe77('0x3')});};exports[_0xfe77('0x4')]=function(_0x55a414,_0x150fc9){return client[_0xfe77('0x2')](_0xfe77('0x5'),{'body':_0x150fc9,'options':{'where':{'id':_0x55a414}},'log':_0xfe77('0x6')});}; \ No newline at end of file +var _0x34f8=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','addTags'];(function(_0x1ce269,_0x20ec6e){var _0x3c66e0=function(_0x115c45){while(--_0x115c45){_0x1ce269['push'](_0x1ce269['shift']());}};_0x3c66e0(++_0x20ec6e);}(_0x34f8,0x80));var _0x834f=function(_0x3046a7,_0x224ffb){_0x3046a7=_0x3046a7-0x0;var _0x6b4b2=_0x34f8[_0x3046a7];return _0x6b4b2;};'use strict';var client=require(_0x834f('0x0'));exports[_0x834f('0x1')]=function(_0x2a7837,_0x45ec5b){return client[_0x834f('0x2')]('UpdateSmsInteraction',{'body':_0x45ec5b,'options':{'where':{'id':_0x2a7837}},'log':'updateSmsInteraction'});};exports[_0x834f('0x3')]=function(_0x92264b,_0x4d23b1){return client[_0x834f('0x2')](_0x834f('0x4'),{'body':_0x4d23b1,'options':{'where':{'id':_0x92264b}},'log':_0x834f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a792e8a..9b3e7a4 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 _0x834a=['Request','createSmsMessage','../client','create'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x834a,0x126));var _0xa834=function(_0x164afa,_0x27f927){_0x164afa=_0x164afa-0x0;var _0x5c8e2a=_0x834a[_0x164afa];return _0x5c8e2a;};'use strict';var client=require(_0xa834('0x0'));exports[_0xa834('0x1')]=function(_0x508600){return client[_0xa834('0x2')]('CreateSmsMessage',{'body':_0x508600,'log':_0xa834('0x3')});}; \ No newline at end of file +var _0x252e=['Request','createSmsMessage','../client','create'];(function(_0x17e696,_0xad1c39){var _0x1a9e33=function(_0x28d22a){while(--_0x28d22a){_0x17e696['push'](_0x17e696['shift']());}};_0x1a9e33(++_0xad1c39);}(_0x252e,0xd6));var _0xe252=function(_0x50e402,_0x3b585f){_0x50e402=_0x50e402-0x0;var _0x1c33a3=_0x252e[_0x50e402];return _0x1c33a3;};'use strict';var client=require(_0xe252('0x0'));exports[_0xe252('0x1')]=function(_0x3ecc22){return client[_0xe252('0x2')]('CreateSmsMessage',{'body':_0x3ecc22,'log':_0xe252('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1101747..e4d4dae 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x2bc1e7,_0x530b80){var _0x31f458=function(_0x11cd80){while(--_0x11cd80){_0x2bc1e7['push'](_0x2bc1e7['shift']());}};_0x31f458(++_0x530b80);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x5023ff,_0x27993a){var _0x3f1764=function(_0x13e6f1){while(--_0x13e6f1){_0x5023ff['push'](_0x5023ff['shift']());}};_0x3f1764(++_0x27993a);}(_0xe706,0xa3));var _0x6e70=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0xe706[_0x2a59af];return _0x3af243;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 522a236..c4b6f02 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x1e33a4,_0x2b0573){var _0x28ad0b=function(_0x128a0e){while(--_0x128a0e){_0x1e33a4['push'](_0x1e33a4['shift']());}};_0x28ad0b(++_0x2b0573);}(_0x55ca,0x126));var _0xa55c=function(_0x160cd5,_0x19c58e){_0x160cd5=_0x160cd5-0x0;var _0x366763=_0x55ca[_0x160cd5];return _0x366763;};'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 +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xedd9,0xfc));var _0x9edd=function(_0x26e9d3,_0x4cb793){_0x26e9d3=_0x26e9d3-0x0;var _0x17739b=_0xedd9[_0x26e9d3];return _0x17739b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 25f487b..bb50cfb 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(_0x58d767,_0x3379c4){var _0x10da02=function(_0x43d6fb){while(--_0x43d6fb){_0x58d767['push'](_0x58d767['shift']());}};_0x10da02(++_0x3379c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x273e2b,_0x13d430){var _0x3d891b=function(_0x5d77b7){while(--_0x5d77b7){_0x273e2b['push'](_0x273e2b['shift']());}};_0x3d891b(++_0x13d430);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 a79dcef..0594ecb 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 _0xc21e=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x55a756,_0x48b9ba){var _0x40f535=function(_0x6aa12e){while(--_0x6aa12e){_0x55a756['push'](_0x55a756['shift']());}};_0x40f535(++_0x48b9ba);}(_0xc21e,0x1ca));var _0xec21=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc21e[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0xec21('0x0')]=function(_0x2f8bc2,_0x1aa991){return client[_0xec21('0x1')](_0xec21('0x2'),{'body':_0x1aa991,'options':{'where':{'id':_0x2f8bc2}},'log':_0xec21('0x3')});};exports['addTags']=function(_0x42881c,_0x3524f1){return client[_0xec21('0x1')](_0xec21('0x4'),{'body':_0x3524f1,'options':{'where':{'id':_0x42881c}},'log':_0xec21('0x5')});}; \ No newline at end of file +var _0xcde7=['addTagsToWhatsappInteraction','Request','addTags','AddTagsToWhatsappInteraction'];(function(_0x3f70d8,_0x56bee8){var _0x57c8b2=function(_0x496dc2){while(--_0x496dc2){_0x3f70d8['push'](_0x3f70d8['shift']());}};_0x57c8b2(++_0x56bee8);}(_0xcde7,0x65));var _0x7cde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcde7[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports['update']=function(_0x210314,_0x2e1936){return client[_0x7cde('0x0')]('UpdateWhatsappInteraction',{'body':_0x2e1936,'options':{'where':{'id':_0x210314}},'log':'updateWhatsappInteraction'});};exports[_0x7cde('0x1')]=function(_0x47962e,_0x23ec50){return client[_0x7cde('0x0')](_0x7cde('0x2'),{'body':_0x23ec50,'options':{'where':{'id':_0x47962e}},'log':_0x7cde('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7d252cc..ccaa617 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 _0x7bb8=['CreateWhatsappMessage','create','Request'];(function(_0x2b467e,_0x2a6b15){var _0x50453a=function(_0x16758c){while(--_0x16758c){_0x2b467e['push'](_0x2b467e['shift']());}};_0x50453a(++_0x2a6b15);}(_0x7bb8,0x1ed));var _0x87bb=function(_0x46f7ff,_0x3be51f){_0x46f7ff=_0x46f7ff-0x0;var _0x113e70=_0x7bb8[_0x46f7ff];return _0x113e70;};'use strict';var client=require('../client');exports[_0x87bb('0x0')]=function(_0x1df85f){return client[_0x87bb('0x1')](_0x87bb('0x2'),{'body':_0x1df85f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x52e4=['CreateWhatsappMessage','create'];(function(_0x496ebe,_0x5a224a){var _0x392b56=function(_0x18d137){while(--_0x18d137){_0x496ebe['push'](_0x496ebe['shift']());}};_0x392b56(++_0x5a224a);}(_0x52e4,0x1b3));var _0x452e=function(_0x3f5f1a,_0x47bf16){_0x3f5f1a=_0x3f5f1a-0x0;var _0x3d28bd=_0x52e4[_0x3f5f1a];return _0x3d28bd;};'use strict';var client=require('../client');exports[_0x452e('0x0')]=function(_0x1201b8){return client['Request'](_0x452e('0x1'),{'body':_0x1201b8,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5afaf37..7b58b9b 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 _0x8773=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name'];(function(_0x51d012,_0x425390){var _0x1e5639=function(_0x41d672){while(--_0x41d672){_0x51d012['push'](_0x51d012['shift']());}};_0x1e5639(++_0x425390);}(_0x8773,0x13c));var _0x3877=function(_0x5577f0,_0x1d04ab){_0x5577f0=_0x5577f0-0x0;var _0x4055fa=_0x8773[_0x5577f0];return _0x4055fa;};'use strict';var client=require(_0x3877('0x0'));exports[_0x3877('0x1')]=function(){return function(){return client[_0x3877('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3877('0x3'),_0x3877('0x4'),_0x3877('0x5')],'include':[{'model':_0x3877('0x6'),'as':_0x3877('0x7'),'attributes':['id',_0x3877('0x3'),_0x3877('0x8'),_0x3877('0x9')]}]},'log':_0x3877('0x1')});};}; \ No newline at end of file +var _0x6a31=['GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x2650c6,_0x1c56df){var _0x207c8c=function(_0x6a470b){while(--_0x6a470b){_0x2650c6['push'](_0x2650c6['shift']());}};_0x207c8c(++_0x1c56df);}(_0x6a31,0xed));var _0x16a3=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x6a31[_0x2fee96];return _0x2e6ad1;};'use strict';var client=require(_0x16a3('0x0'));exports[_0x16a3('0x1')]=function(){return function(){return client[_0x16a3('0x2')](_0x16a3('0x3'),{'options':{'raw':![],'attributes':['id',_0x16a3('0x4'),'timeout',_0x16a3('0x5')],'include':[{'model':_0x16a3('0x6'),'as':_0x16a3('0x7'),'attributes':['id',_0x16a3('0x4'),_0x16a3('0x8'),_0x16a3('0x9')]}]},'log':_0x16a3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a1f480e..60fcfc0 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 _0x2173=['DESC','../client','Request','UpdateWhatsappQueueReport'];(function(_0x368538,_0x52c9d3){var _0x1b097b=function(_0x53388c){while(--_0x53388c){_0x368538['push'](_0x368538['shift']());}};_0x1b097b(++_0x52c9d3);}(_0x2173,0x189));var _0x3217=function(_0x457cff,_0x4beaf6){_0x457cff=_0x457cff-0x0;var _0x314e85=_0x2173[_0x457cff];return _0x314e85;};'use strict';var client=require(_0x3217('0x0'));exports['create']=function(_0xf760fc){return client['Request']('CreateWhatsappQueueReport',{'body':_0xf760fc,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x5688e5,_0x532052){return client[_0x3217('0x1')](_0x3217('0x2'),{'body':_0x532052,'options':{'where':{'uniqueid':_0x5688e5},'order':[['id',_0x3217('0x3')]],'limit':0x1},'log':_0x3217('0x2')});}; \ No newline at end of file +var _0xed29=['create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0xed29,0x6b));var _0x9ed2=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0xed29[_0x3328b4];return _0x530143;};'use strict';var client=require(_0x9ed2('0x0'));exports[_0x9ed2('0x1')]=function(_0x281b6e){return client['Request'](_0x9ed2('0x2'),{'body':_0x281b6e,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x4b1252,_0x5c5926){return client[_0x9ed2('0x3')](_0x9ed2('0x4'),{'body':_0x5c5926,'options':{'where':{'uniqueid':_0x4b1252},'order':[['id',_0x9ed2('0x5')]],'limit':0x1},'log':_0x9ed2('0x4')});}; \ 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 861ef99..7a210c1 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 _0x628d=['channel','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','atimeout'];(function(_0x22fe82,_0x4779d6){var _0x365ca6=function(_0x47f4c1){while(--_0x47f4c1){_0x22fe82['push'](_0x22fe82['shift']());}};_0x365ca6(++_0x4779d6);}(_0x628d,0x12b));var _0xd628=function(_0x27761d,_0x2aea87){_0x27761d=_0x27761d-0x0;var _0x2b54bc=_0x628d[_0x27761d];return _0x2b54bc;};'use strict';var schema=require(_0xd628('0x0'));var _=require(_0xd628('0x1'));var util=require(_0xd628('0x2'));var seqqueue=require(_0xd628('0x3'));var logger=require(_0xd628('0x4'))(_0xd628('0x5'));var strategy=require(_0xd628('0x6'));var queue=schema({'name':{'type':_0xd628('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x13e3aa,_0x4b8c64,_0x337fda){return logger[_0xd628('0x8')](util['format'](_0xd628('0x9'),_0x13e3aa,_0x4b8c64[_0xd628('0xa')],_0x337fda));}function handleFindAgent(_0x5dab83){return function(_0x134b0f){return _0x134b0f[_0xd628('0xa')][_0xd628('0xb')]()===_0x5dab83[_0xd628('0xb')]();};}exports['consequence']=function(_0x10c226,_0x51dcc7,_0xc8dad9,_0x13c104){return function(_0x1b693c){try{var _0x4bba40={'name':_0x51dcc7[0x0],'timeout':_0x51dcc7[0x1]};var _0x5dfaed=queue[_0xd628('0x0')](_0x4bba40,{'typecast':!![]});if(_0x5dfaed['length']){logger[_0xd628('0xc')](_0xd628('0xd'),_0x10c226,_[_0xd628('0xe')](_0x5dfaed,'message')[_0xd628('0xf')](',\x20'));_0x1b693c[_0xd628('0x10')]();}else{var _0x5b4002=_[_0xd628('0x11')](_0xc8dad9[_0xd628('0x12')],handleFindAgent(_0x4bba40[_0xd628('0xa')]));if(_0x5b4002){var _0x4b9080=(_0x4bba40[_0xd628('0x13')]||0xa)*0x3e8;var _0x285d39,_0x45f260;var _0x197719=seqqueue['createQueue'](_0x4b9080);_0x197719['id']=_0x10c226;_0x197719[_0xd628('0x14')]=_0x4b9080;_0x197719[_0xd628('0x15')]=_0x13c104[_0xd628('0x15')];writeLog(_0x10c226,_0x5b4002,util['format']('START:%s',_0x4b9080));_0xc8dad9['rules'][_0x10c226]['on']('end',function(){logger[_0xd628('0x8')](_0xd628('0x16'),_0x10c226);clearTimeout(_0x45f260);_0x45f260=undefined;_0x197719[_0xd628('0x17')]();if(_0xc8dad9[_0xd628('0x18')][_0x10c226]){delete _0xc8dad9[_0xd628('0x18')][_0x10c226];}_0x1b693c[_0xd628('0x10')]();});_0xc8dad9[_0xd628('0x18')][_0x10c226]['on'](_0xd628('0x19'),function(){if(_0xc8dad9[_0xd628('0x18')][_0x10c226]){delete _0xc8dad9[_0xd628('0x18')][_0x10c226];}});_0x45f260=setTimeout(function(){logger['info'](_0xd628('0x1a'),_0x10c226);clearTimeout(_0x45f260);_0x197719[_0xd628('0x17')]();_0x1b693c[_0xd628('0x1b')]();},_0x4b9080);strategy[_0xd628('0x1c')](_0x197719,_0x5b4002,_0xc8dad9,_0x13c104);}else{logger[_0xd628('0xc')](_0xd628('0x1d'),_0x10c226,_0x4bba40[_0xd628('0xa')]);_0x1b693c['stop']();}}}catch(_0x340d78){console[_0xd628('0x1e')](_0x340d78);logger[_0xd628('0xc')]('[%s][QUEUE]\x20%s',_0x10c226,_0x340d78[_0xd628('0x1f')]);_0x1b693c[_0xd628('0x10')]();}};}; \ No newline at end of file +var _0xe205=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','rules','info','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','stop','find','timeout','createQueue','atimeout','channel','START:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe205,0xc5));var _0x5e20=function(_0x3c317a,_0x298a26){_0x3c317a=_0x3c317a-0x0;var _0x45d798=_0xe205[_0x3c317a];return _0x45d798;};'use strict';var schema=require(_0x5e20('0x0'));var _=require(_0x5e20('0x1'));var util=require(_0x5e20('0x2'));var seqqueue=require(_0x5e20('0x3'));var logger=require(_0x5e20('0x4'))(_0x5e20('0x5'));var strategy=require(_0x5e20('0x6'));var queue=schema({'name':{'type':_0x5e20('0x7'),'required':!![],'message':_0x5e20('0x8')},'timeout':{'type':_0x5e20('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x158684,_0x564995,_0x446633){return logger['info'](util[_0x5e20('0xa')](_0x5e20('0xb'),_0x158684,_0x564995['name'],_0x446633));}function handleFindAgent(_0x31615c){return function(_0xf6aeec){return _0xf6aeec[_0x5e20('0xc')][_0x5e20('0xd')]()===_0x31615c[_0x5e20('0xd')]();};}exports[_0x5e20('0xe')]=function(_0x5b2428,_0x53d503,_0x6106d7,_0x1cea27){return function(_0x12634a){try{var _0x26c74a={'name':_0x53d503[0x0],'timeout':_0x53d503[0x1]};var _0x245751=queue['validate'](_0x26c74a,{'typecast':!![]});if(_0x245751['length']){logger['error'](_0x5e20('0xf'),_0x5b2428,_[_0x5e20('0x10')](_0x245751,_0x5e20('0x11'))['join'](',\x20'));_0x12634a[_0x5e20('0x12')]();}else{var _0x1daf55=_[_0x5e20('0x13')](_0x6106d7['agents'],handleFindAgent(_0x26c74a[_0x5e20('0xc')]));if(_0x1daf55){var _0x2824f2=(_0x26c74a[_0x5e20('0x14')]||0xa)*0x3e8;var _0x57d8cd,_0x52b37c;var _0x2f9b3b=seqqueue[_0x5e20('0x15')](_0x2824f2);_0x2f9b3b['id']=_0x5b2428;_0x2f9b3b[_0x5e20('0x16')]=_0x2824f2;_0x2f9b3b[_0x5e20('0x17')]=_0x1cea27[_0x5e20('0x17')];writeLog(_0x5b2428,_0x1daf55,util[_0x5e20('0xa')](_0x5e20('0x18'),_0x2824f2));_0x6106d7['rules'][_0x5b2428]['on'](_0x5e20('0x19'),function(){logger['info'](_0x5e20('0x1a'),_0x5b2428);clearTimeout(_0x52b37c);_0x52b37c=undefined;_0x2f9b3b[_0x5e20('0x1b')]();if(_0x6106d7['rules'][_0x5b2428]){delete _0x6106d7['rules'][_0x5b2428];}_0x12634a[_0x5e20('0x12')]();});_0x6106d7['rules'][_0x5b2428]['on'](_0x5e20('0x1c'),function(){if(_0x6106d7[_0x5e20('0x1d')][_0x5b2428]){delete _0x6106d7[_0x5e20('0x1d')][_0x5b2428];}});_0x52b37c=setTimeout(function(){logger[_0x5e20('0x1e')](_0x5e20('0x1f'),_0x5b2428);clearTimeout(_0x52b37c);_0x2f9b3b['close']();_0x12634a[_0x5e20('0x20')]();},_0x2824f2);strategy['agent'](_0x2f9b3b,_0x1daf55,_0x6106d7,_0x1cea27);}else{logger[_0x5e20('0x21')](_0x5e20('0x22'),_0x5b2428,_0x26c74a[_0x5e20('0xc')]);_0x12634a[_0x5e20('0x12')]();}}}catch(_0x38606b){console[_0x5e20('0x23')](_0x38606b);logger[_0x5e20('0x21')](_0x5e20('0x24'),_0x5b2428,_0x38606b['stack']);_0x12634a[_0x5e20('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 938bfd5..bb30ff0 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 _0x51bc=['error','providerName','amazonlex','providerResponse','dialogState','Failed','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x51bc,0xbf));var _0xc51b=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x51bc[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0xc51b('0x0'));var moment=require(_0xc51b('0x1'));var AWS=require('aws-sdk');var utils=require(_0xc51b('0x2'));var logger=require(_0xc51b('0x3'))(_0xc51b('0x4'));var rpc={'chatMessage':require(_0xc51b('0x5')),'openchannelMessage':require(_0xc51b('0x6')),'mailMessage':require(_0xc51b('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1e77e6,_0x1da8ef){return function(_0x275847){try{if(!_['isNil'](this['interaction'][_0xc51b('0x8')])){logger[_0xc51b('0x9')](_0xc51b('0xa'),_0x1e77e6,_0xc51b('0xb'));return _0x275847[_0xc51b('0xc')]();}var _0x4dbd2b={'ContactId':this[_0xc51b('0xd')]['id'],'sentAt':moment()[_0xc51b('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc51b('0xf')};if(this[_0xc51b('0x10')]===_0xc51b('0x11')||this[_0xc51b('0x10')]==='whatsapp'){_0x4dbd2b[_0xc51b('0x12')]=this[_0xc51b('0x13')]['phone'];}var _0xacea61=this[_0xc51b('0x10')];if(_0xacea61==='chat'){_0x4dbd2b[_0xc51b('0x14')]=this[_0xc51b('0x15')]['id'];}else{_0x4dbd2b[_[_0xc51b('0x16')](_0xacea61)+_0xc51b('0x17')]=this[_0xc51b('0x15')]['id'];}_0x4dbd2b[_[_0xc51b('0x16')](_0xacea61)+_0xc51b('0x18')]=this[_0xc51b('0x13')]['id'];if(this[_0xc51b('0x13')][_0xc51b('0x19')]){var _0x3393ba=_0x1da8ef[0x4];if(!_[_0xc51b('0x1a')](_0x3393ba)){_0x4dbd2b[_0xc51b('0x1b')]=utils['getMustacheRender'](_0x3393ba,this);return rpc[_0xacea61+_0xc51b('0x1c')][_0xc51b('0x1d')](_0x4dbd2b)['then'](function(_0x45cd48){logger[_0xc51b('0x9')]('[%s][AMAZONLEX]\x20%s',_0x1e77e6,_0x4dbd2b['body']);})['catch'](function(_0x40a209){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1e77e6,JSON[_0xc51b('0x1e')](_0x40a209));})[_0xc51b('0x1f')](function(){logger[_0xc51b('0x9')](_0xc51b('0x20'),_0x1e77e6);_0x275847[_0xc51b('0x21')]();});}else{logger[_0xc51b('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1e77e6);_0x275847[_0xc51b('0x21')]();}}else{var _0x445231=this;var _0x5a9e53=new AWS[(_0xc51b('0x22'))]({'accessKeyId':_0x1da8ef[0x0],'secretAccessKey':_0x1da8ef[0x1],'region':_0x1da8ef[0x2]});var _0xe9b385={'botAlias':_0xc51b('0x23'),'botName':_0x1da8ef[0x3],'inputText':this[_0xc51b('0x24')]['body'],'userId':this[_0xc51b('0x10')]+':'+this[_0xc51b('0x13')]['id'][_0xc51b('0x25')]()};_0x5a9e53[_0xc51b('0x26')](_0xe9b385,function(_0x94365,_0x3e1250){if(_0x94365){logger[_0xc51b('0x27')]('[%s][AMAZONLEX]\x20%s',_0x1e77e6,_0x94365[_0xc51b('0x24')]);_0x275847[_0xc51b('0xc')]();}else if(_0x3e1250&&_0x3e1250[_0xc51b('0x24')]){_0x445231[_0xc51b('0x1b')]['amazonlex']=_0x3e1250;_0x4dbd2b['body']=_0x3e1250[_0xc51b('0x24')];_0x4dbd2b[_0xc51b('0x28')]=_0xc51b('0x29');_0x4dbd2b[_0xc51b('0x2a')]=JSON[_0xc51b('0x1e')](_0x3e1250);return rpc[_0xacea61+_0xc51b('0x1c')]['create'](_0x4dbd2b)['then'](function(_0x4a62e3){logger[_0xc51b('0x9')](_0xc51b('0xa'),_0x1e77e6,_0x4dbd2b[_0xc51b('0x1b')]);if(_0x3e1250[_0xc51b('0x2b')]==_0xc51b('0x2c')){_0x275847[_0xc51b('0xc')]();}else{_0x275847[_0xc51b('0x21')]();}})[_0xc51b('0x2d')](function(_0x1e7626){logger[_0xc51b('0x27')](_0xc51b('0xa'),_0x1e77e6,JSON[_0xc51b('0x1e')](_0x1e7626));_0x275847['next']();});}else{_0x275847['next']();}});}}catch(_0x541e29){logger['error'](_0xc51b('0xa'),_0x1e77e6,JSON[_0xc51b('0x1e')](_0x541e29));_0x275847[_0xc51b('0x21')]();}};}; \ No newline at end of file +var _0xc2cc=['info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerName','stringify','create','Failed','catch','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x1d38fc,_0x27cd20){var _0x1a260c=function(_0x3f31ab){while(--_0x3f31ab){_0x1d38fc['push'](_0x1d38fc['shift']());}};_0x1a260c(++_0x27cd20);}(_0xc2cc,0x9d));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var moment=require(_0xcc2c('0x0'));var AWS=require('aws-sdk');var utils=require(_0xcc2c('0x1'));var logger=require(_0xcc2c('0x2'))(_0xcc2c('0x3'));var rpc={'chatMessage':require(_0xcc2c('0x4')),'openchannelMessage':require(_0xcc2c('0x5')),'mailMessage':require(_0xcc2c('0x6')),'smsMessage':require(_0xcc2c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xcc2c('0x8')]=function(_0x59901a,_0x39dd93){return function(_0xeade23){try{if(!_[_0xcc2c('0x9')](this[_0xcc2c('0xa')][_0xcc2c('0xb')])){logger['info'](_0xcc2c('0xc'),_0x59901a,_0xcc2c('0xd'));return _0xeade23[_0xcc2c('0xe')]();}var _0x2e9e4a={'ContactId':this[_0xcc2c('0xf')]['id'],'sentAt':moment()[_0xcc2c('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcc2c('0x11')};if(this[_0xcc2c('0x12')]===_0xcc2c('0x13')||this[_0xcc2c('0x12')]===_0xcc2c('0x14')){_0x2e9e4a['phone']=this[_0xcc2c('0xa')]['phone'];}var _0x39eb7c=this[_0xcc2c('0x12')];if(_0x39eb7c===_0xcc2c('0x15')){_0x2e9e4a[_0xcc2c('0x16')]=this[_0xcc2c('0x17')]['id'];}else{_0x2e9e4a[_['upperFirst'](_0x39eb7c)+'AccountId']=this[_0xcc2c('0x17')]['id'];}_0x2e9e4a[_[_0xcc2c('0x18')](_0x39eb7c)+'InteractionId']=this[_0xcc2c('0xa')]['id'];if(this['interaction'][_0xcc2c('0x19')]){var _0x5a2637=_0x39dd93[0x4];if(!_[_0xcc2c('0x1a')](_0x5a2637)){_0x2e9e4a[_0xcc2c('0x1b')]=utils[_0xcc2c('0x1c')](_0x5a2637,this);return rpc[_0x39eb7c+_0xcc2c('0x1d')]['create'](_0x2e9e4a)[_0xcc2c('0x1e')](function(_0xcbde4a){logger['info']('[%s][AMAZONLEX]\x20%s',_0x59901a,_0x2e9e4a[_0xcc2c('0x1b')]);})['catch'](function(_0x2d8c5a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x59901a,JSON['stringify'](_0x2d8c5a));})['finally'](function(){logger[_0xcc2c('0x1f')](_0xcc2c('0x20'),_0x59901a);_0xeade23[_0xcc2c('0x21')]();});}else{logger['info'](_0xcc2c('0x22'),_0x59901a);_0xeade23[_0xcc2c('0x21')]();}}else{var _0x11d13b=this;var _0xc5c2e4=new AWS[(_0xcc2c('0x23'))]({'accessKeyId':_0x39dd93[0x0],'secretAccessKey':_0x39dd93[0x1],'region':_0x39dd93[0x2]});var _0x91b91a={'botAlias':_0xcc2c('0x24'),'botName':_0x39dd93[0x3],'inputText':this[_0xcc2c('0x25')][_0xcc2c('0x1b')],'userId':this[_0xcc2c('0x12')]+':'+this[_0xcc2c('0xa')]['id'][_0xcc2c('0x26')]()};_0xc5c2e4[_0xcc2c('0x27')](_0x91b91a,function(_0x2dd509,_0x30a7b1){if(_0x2dd509){logger[_0xcc2c('0x28')](_0xcc2c('0xc'),_0x59901a,_0x2dd509[_0xcc2c('0x25')]);_0xeade23[_0xcc2c('0xe')]();}else if(_0x30a7b1&&_0x30a7b1[_0xcc2c('0x25')]){_0x11d13b['body'][_0xcc2c('0x29')]=_0x30a7b1;_0x2e9e4a[_0xcc2c('0x1b')]=_0x30a7b1[_0xcc2c('0x25')];_0x2e9e4a[_0xcc2c('0x2a')]=_0xcc2c('0x29');_0x2e9e4a['providerResponse']=JSON[_0xcc2c('0x2b')](_0x30a7b1);return rpc[_0x39eb7c+_0xcc2c('0x1d')][_0xcc2c('0x2c')](_0x2e9e4a)[_0xcc2c('0x1e')](function(_0x7542b4){logger[_0xcc2c('0x1f')](_0xcc2c('0xc'),_0x59901a,_0x2e9e4a[_0xcc2c('0x1b')]);if(_0x30a7b1['dialogState']==_0xcc2c('0x2d')){_0xeade23[_0xcc2c('0xe')]();}else{_0xeade23['stop']();}})[_0xcc2c('0x2e')](function(_0x26af80){logger[_0xcc2c('0x28')](_0xcc2c('0xc'),_0x59901a,JSON[_0xcc2c('0x2b')](_0x26af80));_0xeade23[_0xcc2c('0xe')]();});}else{_0xeade23[_0xcc2c('0xe')]();}});}}catch(_0x5a2359){logger[_0xcc2c('0x28')]('[%s][AMAZONLEX]\x20%s',_0x59901a,JSON['stringify'](_0x5a2359));_0xeade23[_0xcc2c('0x21')]();}};}; \ 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 8f07cd9..960a091 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 _0x9cbb=['channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc'];(function(_0xf30fa3,_0x444759){var _0x5ea4bf=function(_0x216239){while(--_0x216239){_0xf30fa3['push'](_0xf30fa3['shift']());}};_0x5ea4bf(++_0x444759);}(_0x9cbb,0x103));var _0xb9cb=function(_0x5e6939,_0x3dcd8a){_0x5e6939=_0x5e6939-0x0;var _0x45d3f1=_0x9cbb[_0x5e6939];return _0x45d3f1;};'use strict';var _=require(_0xb9cb('0x0'));var moment=require(_0xb9cb('0x1'));var utils=require(_0xb9cb('0x2'));var logger=require(_0xb9cb('0x3'))(_0xb9cb('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb9cb('0x5')),'faxMessage':require(_0xb9cb('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb9cb('0x7')),'mailInteraction':require(_0xb9cb('0x8')),'smsInteraction':require(_0xb9cb('0x9')),'faxInteraction':require(_0xb9cb('0xa')),'whatsappInteraction':require(_0xb9cb('0xb'))};var mailRpc=require(_0xb9cb('0xc'));exports['consequence']=function(_0x1b5e57,_0x5e3f22,_0x2fe9f4,_0xbfed32){return function(_0x18955e){try{var _0x2a252a=this[_0xb9cb('0xd')];if(_0x2a252a===_0xb9cb('0xe')&&_0xbfed32[_0xb9cb('0xf')][_0xb9cb('0x10')]){logger['info'](_0xb9cb('0x11'),_0x1b5e57,_0xb9cb('0x12'));return _0x18955e[_0xb9cb('0x13')]();}if(_0x5e3f22[0x0]==='1'&&(_[_0xb9cb('0x14')](this[_0xb9cb('0x15')][_0xb9cb('0x16')])||!this[_0xb9cb('0x15')][_0xb9cb('0x16')])){logger[_0xb9cb('0x17')]('[%s][AUTOREPLY]\x20%s',_0x1b5e57,_0xb9cb('0x18'));return _0x18955e[_0xb9cb('0x13')]();}if(_0x5e3f22[0x0]==='2'&&this['interaction'][_0xb9cb('0x19')]){logger[_0xb9cb('0x17')](_0xb9cb('0x1a'),_0x1b5e57,_0xb9cb('0x1b'));return _0x18955e[_0xb9cb('0x13')]();}var _0x41c806={'ContactId':this[_0xb9cb('0x1c')]['id'],'sentAt':moment()[_0xb9cb('0x1d')](_0xb9cb('0x1e')),'direction':_0xb9cb('0x1f')};if(this[_0xb9cb('0xd')]===_0xb9cb('0xe')){_0x41c806[_0xb9cb('0xf')]=utils[_0xb9cb('0x20')](_0x5e3f22[0x2],this);}else{_0x41c806[_0xb9cb('0xf')]=utils[_0xb9cb('0x20')](_0x5e3f22[0x1],this);}if(this[_0xb9cb('0x21')]){_0x41c806['to']=this[_0xb9cb('0x21')][_0xb9cb('0x22')]||'';if(this[_0xb9cb('0xd')]===_0xb9cb('0xe')&&_0x5e3f22[0x1]==='1'){_0x41c806['cc']=this[_0xb9cb('0x21')]['cc']||'';}_0x41c806['from']=this['message']['to']||'';_0x41c806[_0xb9cb('0x23')]=this[_0xb9cb('0x21')]['phone']||'';_0x41c806['read']=!![];if(this[_0xb9cb('0x21')][_0xb9cb('0x24')]){_0x41c806[_0xb9cb('0x24')]='';_0x41c806[_0xb9cb('0x24')]+=_[_0xb9cb('0x25')](this['message'][_0xb9cb('0x24')],_0xb9cb('0x26'))?'':'Re:\x20';_0x41c806['subject']+=this[_0xb9cb('0x21')]['subject'];}}if(this[_0xb9cb('0xd')]==='chat'){_0x41c806[_0xb9cb('0x27')]=this[_0xb9cb('0x28')]['id'];}else{_0x41c806[_[_0xb9cb('0x29')](this[_0xb9cb('0xd')])+_0xb9cb('0x2a')]=this[_0xb9cb('0x28')]['id'];}_0x41c806[_['upperFirst'](this[_0xb9cb('0xd')])+_0xb9cb('0x2b')]=this[_0xb9cb('0x15')]['id'];var _0x5cb09d=this['interaction'];if(rpc[this[_0xb9cb('0xd')]+_0xb9cb('0x2c')]){if(this['channel']===_0xb9cb('0xe')){_0x41c806[_0xb9cb('0x2d')]=this[_0xb9cb('0x21')]['messageId'];_0x41c806[_0xb9cb('0x2e')]=_0xb9cb('0x2f')+_['replace'](_0x41c806[_0xb9cb('0xf')],_0xb9cb('0x30'),_0xb9cb('0x31'))+_0xb9cb('0x32');_0x41c806[_0xb9cb('0x33')]={'Auto-Submitted':_0xb9cb('0x34'),'X-Auto-Response-Suppress':_0xb9cb('0x35'),'Precedence':'auto_reply'};return mailRpc[_0xb9cb('0x36')](this['account'][_0xb9cb('0x37')],_0x41c806)[_0xb9cb('0x38')](function(_0x4cd30f){logger[_0xb9cb('0x17')](_0xb9cb('0x39'),_0x1b5e57);_0x41c806[_0xb9cb('0x3a')]=_0x4cd30f[_0xb9cb('0x21')][_0xb9cb('0x3a')];return rpc[_0x2a252a+'Message'][_0xb9cb('0x3b')](_0x41c806);})[_0xb9cb('0x38')](function(_0x10c2de){logger[_0xb9cb('0x17')](_0xb9cb('0x11'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x10c2de));})[_0xb9cb('0x3d')](function(_0x433320){logger['error'](_0xb9cb('0x3e'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x433320));})['finally'](function(){Promise[_0xb9cb('0x3f')]()['then'](function(){if(_0x5e3f22[0x0]!=='2'||_0x5cb09d[_0xb9cb('0x19')])return;return rpc[_0x2a252a+'Interaction'][_0xb9cb('0x40')](_0x5cb09d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2c1ec3){logger[_0xb9cb('0x17')](_0xb9cb('0x1a'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x2c1ec3));})[_0xb9cb('0x3d')](function(_0x41c15a){logger[_0xb9cb('0x41')](_0xb9cb('0x42'),_0x1b5e57,JSON['stringify'](_0x41c15a));});})['then'](function(){_0x18955e[_0xb9cb('0x13')]();});});}else{return rpc[this[_0xb9cb('0xd')]+_0xb9cb('0x2c')][_0xb9cb('0x3b')](_0x41c806)['then'](function(){logger[_0xb9cb('0x17')](_0xb9cb('0x11'),_0x1b5e57,_0x41c806[_0xb9cb('0xf')]);})[_0xb9cb('0x3d')](function(_0x544162){logger[_0xb9cb('0x41')](_0xb9cb('0x11'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x544162));})['finally'](function(){Promise[_0xb9cb('0x3f')]()[_0xb9cb('0x38')](function(){if(_0x5e3f22[0x0]!=='2'||_0x5cb09d[_0xb9cb('0x19')])return;return rpc[_0x2a252a+_0xb9cb('0x43')][_0xb9cb('0x40')](_0x5cb09d['id'],{'autoreplyExecuted':!![]})[_0xb9cb('0x38')](function(_0x59a904){logger[_0xb9cb('0x17')](_0xb9cb('0x1a'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x59a904));})[_0xb9cb('0x3d')](function(_0x518e6b){logger[_0xb9cb('0x41')](_0xb9cb('0x42'),_0x1b5e57,JSON[_0xb9cb('0x3c')](_0x518e6b));});})['then'](function(){_0x18955e[_0xb9cb('0x13')]();});});}}}catch(_0x1f8c91){logger['error'](_0xb9cb('0x11'),_0x1b5e57,JSON['stringify'](_0x1f8c91));_0x18955e['stop']();}};}; \ No newline at end of file +var _0xfa83=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/smsInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','inReplyTo','messageId','html','','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','lodash','moment','./utils'];(function(_0x1ba6b1,_0x43dc2e){var _0x3e7af9=function(_0xa876ab){while(--_0xa876ab){_0x1ba6b1['push'](_0x1ba6b1['shift']());}};_0x3e7af9(++_0x43dc2e);}(_0xfa83,0x147));var _0x3fa8=function(_0x4de835,_0x400376){_0x4de835=_0x4de835-0x0;var _0xfebeb8=_0xfa83[_0x4de835];return _0xfebeb8;};'use strict';var _=require(_0x3fa8('0x0'));var moment=require(_0x3fa8('0x1'));var utils=require(_0x3fa8('0x2'));var logger=require('../../../../config/logger')(_0x3fa8('0x3'));var rpc={'chatMessage':require(_0x3fa8('0x4')),'openchannelMessage':require(_0x3fa8('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3fa8('0x6')),'faxMessage':require(_0x3fa8('0x7')),'whatsappMessage':require(_0x3fa8('0x8')),'chatInteraction':require(_0x3fa8('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x3fa8('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x3fa8('0xb'));exports['consequence']=function(_0x18c4bb,_0x2714f8,_0x43abfe,_0x263dd1){return function(_0x5dc9ba){try{var _0x50f81d=this[_0x3fa8('0xc')];if(_0x50f81d===_0x3fa8('0xd')&&_0x263dd1[_0x3fa8('0xe')][_0x3fa8('0xf')]){logger[_0x3fa8('0x10')](_0x3fa8('0x11'),_0x18c4bb,_0x3fa8('0x12'));return _0x5dc9ba[_0x3fa8('0x13')]();}if(_0x2714f8[0x0]==='1'&&(_[_0x3fa8('0x14')](this[_0x3fa8('0x15')][_0x3fa8('0x16')])||!this[_0x3fa8('0x15')]['created'])){logger[_0x3fa8('0x10')]('[%s][AUTOREPLY]\x20%s',_0x18c4bb,'Autoreply\x20already\x20sent');return _0x5dc9ba[_0x3fa8('0x13')]();}if(_0x2714f8[0x0]==='2'&&this[_0x3fa8('0x15')][_0x3fa8('0x17')]){logger[_0x3fa8('0x10')](_0x3fa8('0x18'),_0x18c4bb,_0x3fa8('0x19'));return _0x5dc9ba[_0x3fa8('0x13')]();}var _0x2965c4={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3fa8('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3fa8('0x1b')};if(this[_0x3fa8('0xc')]==='mail'){_0x2965c4[_0x3fa8('0xe')]=utils[_0x3fa8('0x1c')](_0x2714f8[0x2],this);}else{_0x2965c4[_0x3fa8('0xe')]=utils[_0x3fa8('0x1c')](_0x2714f8[0x1],this);}if(this[_0x3fa8('0x1d')]){_0x2965c4['to']=this[_0x3fa8('0x1d')][_0x3fa8('0x1e')]||'';if(this[_0x3fa8('0xc')]===_0x3fa8('0xd')&&_0x2714f8[0x1]==='1'){_0x2965c4['cc']=this[_0x3fa8('0x1d')]['cc']||'';}_0x2965c4[_0x3fa8('0x1e')]=this['message']['to']||'';_0x2965c4['phone']=this['message'][_0x3fa8('0x1f')]||'';_0x2965c4[_0x3fa8('0x20')]=!![];if(this[_0x3fa8('0x1d')][_0x3fa8('0x21')]){_0x2965c4[_0x3fa8('0x21')]='';_0x2965c4[_0x3fa8('0x21')]+=_[_0x3fa8('0x22')](this[_0x3fa8('0x1d')][_0x3fa8('0x21')],_0x3fa8('0x23'))?'':_0x3fa8('0x24');_0x2965c4[_0x3fa8('0x21')]+=this[_0x3fa8('0x1d')][_0x3fa8('0x21')];}}if(this[_0x3fa8('0xc')]===_0x3fa8('0x25')){_0x2965c4[_0x3fa8('0x26')]=this[_0x3fa8('0x27')]['id'];}else{_0x2965c4[_[_0x3fa8('0x28')](this[_0x3fa8('0xc')])+_0x3fa8('0x29')]=this['account']['id'];}_0x2965c4[_[_0x3fa8('0x28')](this[_0x3fa8('0xc')])+'InteractionId']=this['interaction']['id'];var _0x4406cb=this['interaction'];if(rpc[this['channel']+'Message']){if(this[_0x3fa8('0xc')]===_0x3fa8('0xd')){_0x2965c4[_0x3fa8('0x2a')]=this['message'][_0x3fa8('0x2b')];_0x2965c4[_0x3fa8('0x2c')]=_0x3fa8('0x2d')+_['replace'](_0x2965c4[_0x3fa8('0xe')],_0x3fa8('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x251383[0x1],'priorityFalse':_0x251383[0x2]};var _0x1b97fb=gotoif[_0x3219('0x0')](_0x4bd521,{'typecast':!![]});if(_0x1b97fb[_0x3219('0xc')]){logger['error'](_0x3219('0xd'),_0x4fdfea,_[_0x3219('0xe')](_0x1b97fb,'message')[_0x3219('0xf')](',\x20'));_0x15cb80[_0x3219('0x10')]();}else{try{var _0xaefe7f=eval('('+_0x4bd521[_0x3219('0x11')]+')');var _0x456515=_0xaefe7f?_0x4bd521[_0x3219('0x12')]:_0x4bd521['priorityFalse'];logger[_0x3219('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4fdfea,_0x4bd521[_0x3219('0x11')],_0xaefe7f,_0x456515||_0x3219('0x14'));if(_0x456515){var _0x31b4b0=_[_0x3219('0x15')](_0x15cb80[_0x3219('0x16')](),{'p':_0x456515});if(_0x31b4b0>=0x0){logger['info'](_0x3219('0x17'),_0x4fdfea,_0x456515||_0x3219('0x14'),_0x31b4b0);_0x15cb80[_0x3219('0x14')](_0x31b4b0);}else{logger[_0x3219('0x13')](_0x3219('0x18'),_0x4fdfea,_0x456515||_0x3219('0x14'));_0x15cb80[_0x3219('0x10')]();}}else{_0x15cb80['next']();}}catch(_0x14793a){logger[_0x3219('0x19')](_0x3219('0x1a'),_0x4fdfea,_0x14793a[_0x3219('0x1b')]);_0x15cb80[_0x3219('0x10')]();}}}catch(_0x2e4d83){logger['error'](_0x3219('0xd'),_0x4fdfea,JSON[_0x3219('0x1c')](_0x2e4d83));_0x15cb80[_0x3219('0x10')]();}};}; \ No newline at end of file +var _0xa21a=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','[%s][GOTOIF]\x20%s','map','join','stop','condition'];(function(_0x50abc4,_0x558d64){var _0x5a745d=function(_0x4e835b){while(--_0x4e835b){_0x50abc4['push'](_0x50abc4['shift']());}};_0x5a745d(++_0x558d64);}(_0xa21a,0x84));var _0xaa21=function(_0x393a64,_0x21edb5){_0x393a64=_0x393a64-0x0;var _0x443751=_0xa21a[_0x393a64];return _0x443751;};'use strict';var schema=require(_0xaa21('0x0'));var _=require(_0xaa21('0x1'));var htmlToText=require(_0xaa21('0x2'));var utils=require(_0xaa21('0x3'));var logger=require(_0xaa21('0x4'))(_0xaa21('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xaa21('0x6')},'priorityTrue':{'type':_0xaa21('0x7'),'message':_0xaa21('0x8')},'priorityFalse':{'type':_0xaa21('0x7'),'message':_0xaa21('0x9')}});exports['consequence']=function(_0x2c6307,_0x43ba26){return function(_0x5b7250){try{var _0x53e14e={'condition':htmlToText[_0xaa21('0xa')](utils[_0xaa21('0xb')](_0x43ba26[0x0],this),{'wordwrap':![]})[_0xaa21('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x43ba26[0x1],'priorityFalse':_0x43ba26[0x2]};var _0x1082c7=gotoif['validate'](_0x53e14e,{'typecast':!![]});if(_0x1082c7['length']){logger['error'](_0xaa21('0xd'),_0x2c6307,_[_0xaa21('0xe')](_0x1082c7,'message')[_0xaa21('0xf')](',\x20'));_0x5b7250[_0xaa21('0x10')]();}else{try{var _0x5e295b=eval('('+_0x53e14e[_0xaa21('0x11')]+')');var _0x4664c=_0x5e295b?_0x53e14e['priorityTrue']:_0x53e14e[_0xaa21('0x12')];logger[_0xaa21('0x13')](_0xaa21('0x14'),_0x2c6307,_0x53e14e[_0xaa21('0x11')],_0x5e295b,_0x4664c||'next');if(_0x4664c){var _0x5b8bcf=_[_0xaa21('0x15')](_0x5b7250[_0xaa21('0x16')](),{'p':_0x4664c});if(_0x5b8bcf>=0x0){logger[_0xaa21('0x13')](_0xaa21('0x17'),_0x2c6307,_0x4664c||_0xaa21('0x18'),_0x5b8bcf);_0x5b7250[_0xaa21('0x18')](_0x5b8bcf);}else{logger[_0xaa21('0x13')](_0xaa21('0x19'),_0x2c6307,_0x4664c||_0xaa21('0x18'));_0x5b7250[_0xaa21('0x10')]();}}else{_0x5b7250[_0xaa21('0x18')]();}}catch(_0x3c0eb2){logger[_0xaa21('0x1a')](_0xaa21('0x1b'),_0x2c6307,_0x3c0eb2[_0xaa21('0x1c')]);_0x5b7250[_0xaa21('0x10')]();}}}catch(_0x112856){logger[_0xaa21('0x1a')](_0xaa21('0xd'),_0x2c6307,JSON[_0xaa21('0x1d')](_0x112856));_0x5b7250[_0xaa21('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 1774c69..61ee75e 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 _0x5ae6=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x4739e5,_0x532219){var _0x4dd074=function(_0x5e45ce){while(--_0x5e45ce){_0x4739e5['push'](_0x4739e5['shift']());}};_0x4dd074(++_0x532219);}(_0x5ae6,0x1ab));var _0x65ae=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x5ae6[_0x470e67];return _0x28bbde;};'use strict';var schema=require(_0x65ae('0x0'));var _=require('lodash');var logger=require(_0x65ae('0x1'))(_0x65ae('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x65ae('0x3')}});exports[_0x65ae('0x4')]=function(_0x483a72,_0x502a01){return function(_0x213963){try{var _0xfa4c4={'priority':_0x502a01[0x0]};var _0x3baa8e=gotop[_0x65ae('0x0')](_0xfa4c4,{'typecast':!![]});if(_0x3baa8e[_0x65ae('0x5')]){logger[_0x65ae('0x6')](_0x65ae('0x7'),_0x483a72,_[_0x65ae('0x8')](_0x3baa8e,_0x65ae('0x9'))[_0x65ae('0xa')](',\x20'));_0x213963['stop']();}else{logger[_0x65ae('0xb')](_0x65ae('0xc'),_0x483a72,_0xfa4c4[_0x65ae('0xd')]);if(_0xfa4c4[_0x65ae('0xd')]){var _0x2f5316=_[_0x65ae('0xe')](_0x213963[_0x65ae('0xf')](),{'p':_0xfa4c4[_0x65ae('0xd')]});if(_0x2f5316>=0x0){logger[_0x65ae('0xb')](_0x65ae('0x10'),_0x483a72,_0xfa4c4[_0x65ae('0xd')]||'next',_0x2f5316);_0x213963['next'](_0x2f5316);}else{logger[_0x65ae('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x483a72,_0xfa4c4[_0x65ae('0xd')]||_0x65ae('0x11'));_0x213963[_0x65ae('0x12')]();}}else{_0x213963[_0x65ae('0x11')]();}}}catch(_0x4de97c){logger[_0x65ae('0x6')](_0x65ae('0x7'),_0x483a72,JSON[_0x65ae('0x13')](_0x4de97c));_0x213963['stop']();}};}; \ No newline at end of file +var _0xc63f=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xc63f,0x11d));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xfc63('0x0'));var _=require(_0xfc63('0x1'));var logger=require('../../../../config/logger')(_0xfc63('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xfc63('0x3')}});exports[_0xfc63('0x4')]=function(_0x17ae34,_0x382ea0){return function(_0x1848e9){try{var _0xd6e38e={'priority':_0x382ea0[0x0]};var _0x455b08=gotop['validate'](_0xd6e38e,{'typecast':!![]});if(_0x455b08[_0xfc63('0x5')]){logger[_0xfc63('0x6')](_0xfc63('0x7'),_0x17ae34,_[_0xfc63('0x8')](_0x455b08,_0xfc63('0x9'))['join'](',\x20'));_0x1848e9[_0xfc63('0xa')]();}else{logger[_0xfc63('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x17ae34,_0xd6e38e[_0xfc63('0xc')]);if(_0xd6e38e[_0xfc63('0xc')]){var _0x3901e5=_[_0xfc63('0xd')](_0x1848e9[_0xfc63('0xe')](),{'p':_0xd6e38e[_0xfc63('0xc')]});if(_0x3901e5>=0x0){logger[_0xfc63('0xb')](_0xfc63('0xf'),_0x17ae34,_0xd6e38e[_0xfc63('0xc')]||_0xfc63('0x10'),_0x3901e5);_0x1848e9[_0xfc63('0x10')](_0x3901e5);}else{logger[_0xfc63('0xb')](_0xfc63('0x11'),_0x17ae34,_0xd6e38e[_0xfc63('0xc')]||_0xfc63('0x10'));_0x1848e9['stop']();}}else{_0x1848e9[_0xfc63('0x10')]();}}}catch(_0x1acfce){logger['error']('[%s][GOTOP]\x20%s',_0x17ae34,JSON['stringify'](_0x1acfce));_0x1848e9[_0xfc63('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 c54f100..10604df 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 _0xceb5=['chat','account','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel'];(function(_0x221653,_0x2b341e){var _0x101040=function(_0x508db8){while(--_0x508db8){_0x221653['push'](_0x221653['shift']());}};_0x101040(++_0x2b341e);}(_0xceb5,0x81));var _0x5ceb=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xceb5[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x5ceb('0x0'));var utils=require(_0x5ceb('0x1'));var logger=require('../../../../config/logger')(_0x5ceb('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5ceb('0x3')),'mailMessage':require(_0x5ceb('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5ceb('0x5'))};exports['consequence']=function(_0x5890a3,_0xa70c09){return function(_0x5cefc2){try{var _0x3c69d8={'body':utils[_0x5ceb('0x6')](_0xa70c09[0x0],this),'ContactId':this[_0x5ceb('0x7')]['id']};if(this[_0x5ceb('0x8')]===_0x5ceb('0x9')){_0x3c69d8['ChatWebsiteId']=this[_0x5ceb('0xa')]['id'];}else{_0x3c69d8[_[_0x5ceb('0xb')](this[_0x5ceb('0x8')])+'AccountId']=this['account']['id'];}_0x3c69d8[_[_0x5ceb('0xb')](this[_0x5ceb('0x8')])+'InteractionId']=this[_0x5ceb('0xc')]['id'];if(rpc[this[_0x5ceb('0x8')]+_0x5ceb('0xd')]){return rpc[this[_0x5ceb('0x8')]+_0x5ceb('0xd')][_0x5ceb('0xe')](_0x3c69d8)[_0x5ceb('0xf')](function(_0x2c4044){logger[_0x5ceb('0x10')](_0x5ceb('0x11'),_0x5890a3,_0x3c69d8[_0x5ceb('0x12')]);_0x5cefc2[_0x5ceb('0x13')]();})[_0x5ceb('0x14')](function(_0x21b8d9){logger[_0x5ceb('0x15')]('[%s][MESSAGE]\x20%s',_0x5890a3,JSON['stringify'](_0x21b8d9));_0x5cefc2['stop']();});}}catch(_0x1a8d4c){logger['error'](_0x5ceb('0x11'),_0x5890a3,JSON[_0x5ceb('0x16')](_0x1a8d4c));_0x5cefc2['stop']();}};}; \ No newline at end of file +var _0x4f9b=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x1fd8fa,_0x3c2e0f){var _0x311b53=function(_0x550012){while(--_0x550012){_0x1fd8fa['push'](_0x1fd8fa['shift']());}};_0x311b53(++_0x3c2e0f);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x9cfbbe,_0x12a1cf){_0x9cfbbe=_0x9cfbbe-0x0;var _0x21c39b=_0x4f9b[_0x9cfbbe];return _0x21c39b;};'use strict';var _=require(_0xb4f9('0x0'));var utils=require(_0xb4f9('0x1'));var logger=require(_0xb4f9('0x2'))(_0xb4f9('0x3'));var rpc={'chatMessage':require(_0xb4f9('0x4')),'openchannelMessage':require(_0xb4f9('0x5')),'mailMessage':require(_0xb4f9('0x6')),'smsMessage':require(_0xb4f9('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x25947a,_0x38c813){return function(_0x2fa71b){try{var _0x4e8f3c={'body':utils[_0xb4f9('0x8')](_0x38c813[0x0],this),'ContactId':this[_0xb4f9('0x9')]['id']};if(this['channel']===_0xb4f9('0xa')){_0x4e8f3c[_0xb4f9('0xb')]=this[_0xb4f9('0xc')]['id'];}else{_0x4e8f3c[_['upperFirst'](this[_0xb4f9('0xd')])+'AccountId']=this[_0xb4f9('0xc')]['id'];}_0x4e8f3c[_[_0xb4f9('0xe')](this[_0xb4f9('0xd')])+_0xb4f9('0xf')]=this[_0xb4f9('0x10')]['id'];if(rpc[this[_0xb4f9('0xd')]+_0xb4f9('0x11')]){return rpc[this['channel']+_0xb4f9('0x11')][_0xb4f9('0x12')](_0x4e8f3c)[_0xb4f9('0x13')](function(_0x4927d9){logger['info'](_0xb4f9('0x14'),_0x25947a,_0x4e8f3c[_0xb4f9('0x15')]);_0x2fa71b[_0xb4f9('0x16')]();})[_0xb4f9('0x17')](function(_0x25b8d9){logger[_0xb4f9('0x18')](_0xb4f9('0x14'),_0x25947a,JSON[_0xb4f9('0x19')](_0x25b8d9));_0x2fa71b[_0xb4f9('0x1a')]();});}}catch(_0x170792){logger[_0xb4f9('0x18')](_0xb4f9('0x14'),_0x25947a,JSON['stringify'](_0x170792));_0x2fa71b[_0xb4f9('0x1a')]();}};}; \ 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 507eb73..6968fc9 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 _0x4804=['stop','../../../../config/logger','routing','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify'];(function(_0x1ba8b9,_0x46beb9){var _0x2b5446=function(_0x29d7b4){while(--_0x29d7b4){_0x1ba8b9['push'](_0x1ba8b9['shift']());}};_0x2b5446(++_0x46beb9);}(_0x4804,0xab));var _0x4480=function(_0x30f221,_0x37df21){_0x30f221=_0x30f221-0x0;var _0x23fbed=_0x4804[_0x30f221];return _0x23fbed;};'use strict';var utils=require('./utils');var logger=require(_0x4480('0x0'))(_0x4480('0x1'));exports[_0x4480('0x2')]=function(_0x6b28c5,_0xbc168){return function(_0x51c31f){try{logger[_0x4480('0x3')]('[%s][NOOP]\x20%s',_0x6b28c5,utils[_0x4480('0x4')](_0xbc168[0x0],this));_0x51c31f[_0x4480('0x5')]();}catch(_0x527a5a){logger[_0x4480('0x6')](_0x4480('0x7'),_0x6b28c5,JSON[_0x4480('0x8')](_0x527a5a));_0x51c31f[_0x4480('0x9')]();}};}; \ No newline at end of file +var _0x0146=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x4fc06b,_0x1bd518){var _0x47e08b=function(_0x3d7c5c){while(--_0x3d7c5c){_0x4fc06b['push'](_0x4fc06b['shift']());}};_0x47e08b(++_0x1bd518);}(_0x0146,0x118));var _0x6014=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x0146[_0x2cd1fb];return _0x48fd2b;};'use strict';var utils=require('./utils');var logger=require(_0x6014('0x0'))(_0x6014('0x1'));exports['consequence']=function(_0xc2d208,_0x48e4d6){return function(_0x1bce7a){try{logger[_0x6014('0x2')](_0x6014('0x3'),_0xc2d208,utils[_0x6014('0x4')](_0x48e4d6[0x0],this));_0x1bce7a['next']();}catch(_0x309fe8){logger[_0x6014('0x5')]('[%s][NOOP]\x20%s',_0xc2d208,JSON[_0x6014('0x6')](_0x309fe8));_0x1bce7a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 52616f4..08529db 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 _0x8aa2=['../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','channel','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','interaction','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','createQueue','atimeout','qtimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','routing','./strategy','defaults','redis','localhost','socket.io-emitter','account','queue','from','emit','clone','queue_id','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','save','pick','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction'];(function(_0x115d95,_0x5e7589){var _0x27fe57=function(_0x4149c9){while(--_0x4149c9){_0x115d95['push'](_0x115d95['shift']());}};_0x27fe57(++_0x5e7589);}(_0x8aa2,0x12e));var _0x28aa=function(_0x301590,_0x2c129b){_0x301590=_0x301590-0x0;var _0x405d17=_0x8aa2[_0x301590];return _0x405d17;};'use strict';var schema=require(_0x28aa('0x0'));var _=require(_0x28aa('0x1'));var util=require(_0x28aa('0x2'));var seqqueue=require(_0x28aa('0x3'));var moment=require(_0x28aa('0x4'));var Redis=require(_0x28aa('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x28aa('0x6'));var strategy=require(_0x28aa('0x7'));config['redis']=_[_0x28aa('0x8')](config[_0x28aa('0x9')],{'host':_0x28aa('0xa'),'port':0x18eb});var io=require(_0x28aa('0xb'))(new Redis(config[_0x28aa('0x9')]));var attributes=['id','queue_id',_0x28aa('0xc'),_0x28aa('0xd'),_0x28aa('0xe'),'joinAt'];function emit(_0x32deb2,_0x32aed2,_0x428e20){io['to'](_0x32deb2)[_0x28aa('0xf')](_0x32aed2,_0x428e20);}function emitChannelQueueInteraction(_0x13ec63,_0x176891,_0x2af30e,_0x52ce19,_0x260851,_0x293892,_0x43af32,_0x6e1f9f){var _0x45154f=_[_0x28aa('0x10')](_0x2af30e);_0x45154f[_0x28aa('0x11')]=_0x6e1f9f;_0x45154f[_0x28aa('0xd')]=_0x176891;_0x45154f[_0x28aa('0xc')]=_0x52ce19;_0x45154f['id']=_0x260851;if(_0x293892){attributes[_0x28aa('0x12')](_[_0x28aa('0x13')](_0x13ec63)+_0x28aa('0x14'));_0x43af32[util[_0x28aa('0x15')](_0x28aa('0x16'),_0x13ec63)][_0x260851]=_['pick'](_0x45154f,attributes);}else{delete _0x43af32[util[_0x28aa('0x15')](_0x28aa('0x16'),_0x13ec63)][_0x260851];}emit(util[_0x28aa('0x15')]('%s:queue:%s',_0x13ec63,_0x176891),util['format']('%s_queue_waiting_interaction:%s',_0x13ec63,_0x293892?_0x28aa('0x17'):'remove'),_[_0x28aa('0x18')](_0x45154f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x28aa('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x28aa('0x1a')),'faxQueueReport':require(_0x28aa('0x1b')),'whatsappQueueReport':require(_0x28aa('0x1c')),'chatInteraction':require(_0x28aa('0x1d')),'faxInteraction':require(_0x28aa('0x1e')),'mailInteraction':require(_0x28aa('0x1f')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x28aa('0x20')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x28aa('0x21'),'required':!![],'message':_0x28aa('0x22')},'timeout':{'type':_0x28aa('0x23'),'message':_0x28aa('0x24')}});function startRouting(_0x78cdd5,_0x98b33f,_0x3c327d,_0x213081){if(_0x78cdd5&&_0x98b33f&&_0x3c327d){_0x98b33f[_0x28aa('0x25')]+=0x1;var _0x4b8255={'uniqueid':_0x78cdd5,'from':_0x3c327d[_0x28aa('0x26')]?_0x3c327d['body']['from']:'','joinAt':moment()[_0x28aa('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c327d[_0x28aa('0x27')]?_0x3c327d[_0x28aa('0x27')]['id']:null,'ListId':_0x3c327d['list']?_0x3c327d[_0x28aa('0x28')]['id']:null};_0x4b8255[_[_0x28aa('0x29')](_0x3c327d['channel'])+_0x28aa('0x2a')]=_0x98b33f['id']||null;_0x4b8255[_['upperFirst'](_0x3c327d[_0x28aa('0x2b')])+_0x28aa('0x14')]=_0x3c327d['interaction']?_0x3c327d['interaction']['id']:null;_0x4b8255[_['upperFirst'](_0x3c327d[_0x28aa('0x2b')])+_0x28aa('0x2c')]=_0x3c327d[_0x28aa('0x2d')]?_0x3c327d[_0x28aa('0x2d')]['id']:null;_0x4b8255[_[_0x28aa('0x29')](_0x3c327d[_0x28aa('0x2b')])+(_0x3c327d[_0x28aa('0x2b')]!==_0x28aa('0x2e')?_0x28aa('0x2f'):'WebsiteId')]=_0x3c327d[_0x28aa('0xc')]?_0x3c327d[_0x28aa('0xc')]['id']:null;logger[_0x28aa('0x30')](util['format'](_0x28aa('0x31'),_0x78cdd5,_0x98b33f['name']));emitChannelQueueInteraction(_0x3c327d[_0x28aa('0x2b')],_0x98b33f[_0x28aa('0x32')],_0x4b8255,_0x3c327d[_0x28aa('0xc')][_0x28aa('0x32')],_0x3c327d[_0x28aa('0x2d')]['id'],!![],_0x213081,_0x98b33f['id']);if(rpc[_0x3c327d[_0x28aa('0x2b')]+'QueueReport']){return rpc[_0x3c327d[_0x28aa('0x2b')]+_0x28aa('0x33')][_0x28aa('0x34')](_0x4b8255)['catch'](function(_0x39fb11){logger[_0x28aa('0x35')](_0x28aa('0x36'),_0x39fb11);});}}}function stopRouting(_0x3edec7,_0x44c0e1,_0x26fe2b,_0x2c0f67){if(_0x3edec7&&_0x44c0e1){_0x44c0e1['waiting']-=0x1;var _0x494d2d={'leaveAt':moment()['format'](_0x28aa('0x37')),'acceptAt':moment()[_0x28aa('0x15')](_0x28aa('0x37')),'reason':_0x28aa('0x38')};logger[_0x28aa('0x30')](util[_0x28aa('0x15')](_0x28aa('0x39'),_0x3edec7,_0x44c0e1[_0x28aa('0x32')]));emitChannelQueueInteraction(_0x26fe2b[_0x28aa('0x2b')],_0x44c0e1[_0x28aa('0x32')],_0x26fe2b['body'],_0x26fe2b[_0x28aa('0xc')][_0x28aa('0x32')],_0x26fe2b[_0x28aa('0x2d')]['id'],![],_0x2c0f67,_0x44c0e1['id']);return rpc[_0x26fe2b[_0x28aa('0x2b')]+_0x28aa('0x3a')][_0x28aa('0x3b')](_0x26fe2b[_0x28aa('0x3c')]['id'],{'queueId':_0x44c0e1['id']})['then'](function(){if(rpc[_0x26fe2b[_0x28aa('0x2b')]+_0x28aa('0x33')]){return rpc[_0x26fe2b[_0x28aa('0x2b')]+_0x28aa('0x33')][_0x28aa('0x3b')](_0x3edec7,_0x494d2d)[_0x28aa('0x3d')](function(_0x1aec9b){logger['error'](_0x28aa('0x3e'),_0x1aec9b);});}});}}function endRouting(_0x2d34d6,_0x193e9f,_0x11ae2a,_0x2396a7){if(_0x2d34d6&&_0x193e9f){_0x193e9f[_0x28aa('0x25')]-=0x1;var _0x3d8aea={'leaveAt':moment()[_0x28aa('0x15')](_0x28aa('0x37')),'exitAt':moment()[_0x28aa('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x28aa('0x3f')};logger[_0x28aa('0x30')](util[_0x28aa('0x15')](_0x28aa('0x40'),_0x2d34d6,_0x193e9f['name']));emitChannelQueueInteraction(_0x11ae2a[_0x28aa('0x2b')],_0x193e9f[_0x28aa('0x32')],_0x11ae2a[_0x28aa('0x26')],_0x11ae2a['account'][_0x28aa('0x32')],_0x11ae2a[_0x28aa('0x2d')]['id'],![],_0x2396a7);if(rpc[_0x11ae2a['channel']+'QueueReport']){return rpc[_0x11ae2a[_0x28aa('0x2b')]+_0x28aa('0x33')][_0x28aa('0x3b')](_0x2d34d6,_0x3d8aea)[_0x28aa('0x3d')](function(_0xa057bc){logger['error'](_0x28aa('0x3e'),_0xa057bc);});}}}function handleFindQueue(_0x39c113){return function(_0x706c25){return _0x706c25['name'][_0x28aa('0x41')]()===_0x39c113[_0x28aa('0x41')]();};}exports['consequence']=function(_0x209e0a,_0x3c16a7,_0x35cc4f,_0x45a700){return function(_0x27188a){try{var _0x52bc29={'name':_0x3c16a7[0x0],'timeout':_0x3c16a7[0x1]};var _0x44d58e=queue[_0x28aa('0x0')](_0x52bc29,{'typecast':!![]});if(_0x44d58e[_0x28aa('0x42')]){logger[_0x28aa('0x35')](_0x28aa('0x43'),_0x209e0a,_['map'](_0x44d58e,_0x28aa('0x2d'))[_0x28aa('0x44')](',\x20'));_0x27188a[_0x28aa('0x45')]();}else{var _0x382c3c=_[_0x28aa('0x46')](_0x35cc4f[_0x45a700[_0x28aa('0x2b')]+'Queues'],handleFindQueue(_0x52bc29[_0x28aa('0x32')]));if(_0x382c3c){startRouting(_0x209e0a,_0x382c3c,_0x45a700,_0x35cc4f);var _0x2f47f1=(_0x382c3c[_0x28aa('0x3f')]||0xa)*0x3e8;var _0x32b942=(_0x52bc29[_0x28aa('0x3f')]||0x14)*0x3e8;var _0x87bfd8;if(_0x2f47f1>_0x32b942){_0x32b942=_0x2f47f1;}var _0x22fcf0=seqqueue[_0x28aa('0x47')](_0x2f47f1);_0x22fcf0['id']=_0x209e0a;_0x22fcf0[_0x28aa('0x48')]=_0x2f47f1;_0x22fcf0[_0x28aa('0x49')]=_0x32b942;_0x22fcf0[_0x28aa('0x2b')]=_0x45a700[_0x28aa('0x2b')];_0x35cc4f[_0x28aa('0x4a')][_0x209e0a]['on'](_0x28aa('0x4b'),function(){logger[_0x28aa('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x209e0a);stopRouting(_0x209e0a,_0x382c3c,_0x45a700,_0x35cc4f);clearTimeout(_0x87bfd8);_0x87bfd8=undefined;_0x22fcf0['close'](!![]);if(_0x35cc4f[_0x28aa('0x4a')][_0x209e0a]){delete _0x35cc4f[_0x28aa('0x4a')][_0x209e0a];}_0x27188a['stop']();});_0x35cc4f[_0x28aa('0x4a')][_0x209e0a]['on'](_0x28aa('0x4c'),function(){if(_0x35cc4f[_0x28aa('0x4a')][_0x209e0a]){delete _0x35cc4f[_0x28aa('0x4a')][_0x209e0a];}});_0x87bfd8=setTimeout(function(){logger[_0x28aa('0x30')](_0x28aa('0x4d'),_0x209e0a);endRouting(_0x209e0a,_0x382c3c,_0x45a700,_0x35cc4f);clearTimeout(_0x87bfd8);_0x22fcf0['close'](!![]);_0x27188a[_0x28aa('0x4e')]();},_0x32b942);switch(_0x382c3c['strategy']){case'rrmemory':strategy[_0x28aa('0x4f')](_0x22fcf0,_0x382c3c,_0x35cc4f,_0x45a700);break;default:strategy[_0x28aa('0x50')](_0x22fcf0,_0x382c3c,_0x35cc4f,_0x45a700);}}else{logger['error'](_0x28aa('0x51'),_0x209e0a,_0x52bc29['name']);_0x27188a[_0x28aa('0x45')]();}}}catch(_0x4f70ce){logger[_0x28aa('0x35')](_0x28aa('0x43'),_0x209e0a,_0x4f70ce[_0x28aa('0x52')]);_0x27188a['stop']();}};}; \ No newline at end of file +var _0xf519=['WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','then','timeout','[%s][END:QUEUE][NAME:%s]','error','update\x20queue\x20report','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','account','queue','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId'];(function(_0xb2eb8,_0xeebbdf){var _0xd94a48=function(_0x34344b){while(--_0x34344b){_0xb2eb8['push'](_0xb2eb8['shift']());}};_0xd94a48(++_0xeebbdf);}(_0xf519,0xcd));var _0x9f51=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xf519[_0x5751e6];return _0x4199e4;};'use strict';var schema=require('validate');var _=require(_0x9f51('0x0'));var util=require(_0x9f51('0x1'));var seqqueue=require(_0x9f51('0x2'));var moment=require(_0x9f51('0x3'));var Redis=require(_0x9f51('0x4'));var config=require(_0x9f51('0x5'));var logger=require(_0x9f51('0x6'))(_0x9f51('0x7'));var strategy=require(_0x9f51('0x8'));config[_0x9f51('0x9')]=_[_0x9f51('0xa')](config[_0x9f51('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id',_0x9f51('0xb'),_0x9f51('0xc'),'from',_0x9f51('0xd')];function emit(_0x3dbffe,_0xf8ca8a,_0x43913e){io['to'](_0x3dbffe)[_0x9f51('0xe')](_0xf8ca8a,_0x43913e);}function emitChannelQueueInteraction(_0x51cc02,_0x5dd9aa,_0x534b59,_0x225242,_0x510cf1,_0xe18219,_0x2e096a,_0x13ac98){var _0x36c1e3=_[_0x9f51('0xf')](_0x534b59);_0x36c1e3['queue_id']=_0x13ac98;_0x36c1e3['queue']=_0x5dd9aa;_0x36c1e3['account']=_0x225242;_0x36c1e3['id']=_0x510cf1;if(_0xe18219){attributes[_0x9f51('0x10')](_[_0x9f51('0x11')](_0x51cc02)+_0x9f51('0x12'));_0x2e096a[util['format'](_0x9f51('0x13'),_0x51cc02)][_0x510cf1]=_[_0x9f51('0x14')](_0x36c1e3,attributes);}else{delete _0x2e096a[util[_0x9f51('0x15')]('%sQueuesWaitingInteractions',_0x51cc02)][_0x510cf1];}emit(util[_0x9f51('0x15')](_0x9f51('0x16'),_0x51cc02,_0x5dd9aa),util[_0x9f51('0x15')](_0x9f51('0x17'),_0x51cc02,_0xe18219?_0x9f51('0x18'):_0x9f51('0x19')),_[_0x9f51('0x14')](_0x36c1e3,attributes));}var rpc={'openchannelQueueReport':require(_0x9f51('0x1a')),'mailQueueReport':require(_0x9f51('0x1b')),'chatQueueReport':require(_0x9f51('0x1c')),'smsQueueReport':require(_0x9f51('0x1d')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x9f51('0x1e')),'chatInteraction':require(_0x9f51('0x1f')),'faxInteraction':require(_0x9f51('0x20')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9f51('0x21')),'whatsappInteraction':require(_0x9f51('0x22'))};var queue=schema({'name':{'type':_0x9f51('0x23'),'required':!![],'message':_0x9f51('0x24')},'timeout':{'type':'number','message':_0x9f51('0x25')}});function startRouting(_0x4bb0fe,_0xe6ba87,_0x5aa363,_0x509516){if(_0x4bb0fe&&_0xe6ba87&&_0x5aa363){_0xe6ba87[_0x9f51('0x26')]+=0x1;var _0x1b64ab={'uniqueid':_0x4bb0fe,'from':_0x5aa363['body']?_0x5aa363[_0x9f51('0x27')]['from']:'','joinAt':moment()[_0x9f51('0x15')](_0x9f51('0x28')),'ContactId':_0x5aa363[_0x9f51('0x29')]?_0x5aa363[_0x9f51('0x29')]['id']:null,'ListId':_0x5aa363[_0x9f51('0x2a')]?_0x5aa363['list']['id']:null};_0x1b64ab[_[_0x9f51('0x2b')](_0x5aa363[_0x9f51('0x2c')])+'QueueId']=_0xe6ba87['id']||null;_0x1b64ab[_['upperFirst'](_0x5aa363['channel'])+_0x9f51('0x12')]=_0x5aa363[_0x9f51('0x2d')]?_0x5aa363[_0x9f51('0x2d')]['id']:null;_0x1b64ab[_[_0x9f51('0x2b')](_0x5aa363['channel'])+_0x9f51('0x2e')]=_0x5aa363[_0x9f51('0x2f')]?_0x5aa363[_0x9f51('0x2f')]['id']:null;_0x1b64ab[_[_0x9f51('0x2b')](_0x5aa363[_0x9f51('0x2c')])+(_0x5aa363[_0x9f51('0x2c')]!==_0x9f51('0x30')?_0x9f51('0x31'):_0x9f51('0x32'))]=_0x5aa363[_0x9f51('0xb')]?_0x5aa363['account']['id']:null;logger[_0x9f51('0x33')](util[_0x9f51('0x15')](_0x9f51('0x34'),_0x4bb0fe,_0xe6ba87[_0x9f51('0x35')]));emitChannelQueueInteraction(_0x5aa363[_0x9f51('0x2c')],_0xe6ba87['name'],_0x1b64ab,_0x5aa363[_0x9f51('0xb')]['name'],_0x5aa363[_0x9f51('0x2f')]['id'],!![],_0x509516,_0xe6ba87['id']);if(rpc[_0x5aa363['channel']+_0x9f51('0x36')]){return rpc[_0x5aa363['channel']+_0x9f51('0x36')][_0x9f51('0x37')](_0x1b64ab)[_0x9f51('0x38')](function(_0x4f3501){logger['error'](_0x9f51('0x39'),_0x4f3501);});}}}function stopRouting(_0x53f15f,_0x4bf600,_0x1b7e76,_0x3f3546){if(_0x53f15f&&_0x4bf600){_0x4bf600[_0x9f51('0x26')]-=0x1;var _0x1fa8d7={'leaveAt':moment()[_0x9f51('0x15')](_0x9f51('0x28')),'acceptAt':moment()[_0x9f51('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x9f51('0x33')](util['format'](_0x9f51('0x3a'),_0x53f15f,_0x4bf600['name']));emitChannelQueueInteraction(_0x1b7e76[_0x9f51('0x2c')],_0x4bf600[_0x9f51('0x35')],_0x1b7e76[_0x9f51('0x27')],_0x1b7e76[_0x9f51('0xb')][_0x9f51('0x35')],_0x1b7e76[_0x9f51('0x2f')]['id'],![],_0x3f3546,_0x4bf600['id']);return rpc[_0x1b7e76['channel']+'Interaction'][_0x9f51('0x3b')](_0x1b7e76[_0x9f51('0x2d')]['id'],{'queueId':_0x4bf600['id']})[_0x9f51('0x3c')](function(){if(rpc[_0x1b7e76[_0x9f51('0x2c')]+'QueueReport']){return rpc[_0x1b7e76[_0x9f51('0x2c')]+_0x9f51('0x36')][_0x9f51('0x3b')](_0x53f15f,_0x1fa8d7)[_0x9f51('0x38')](function(_0x113bc6){logger['error']('update\x20queue\x20report',_0x113bc6);});}});}}function endRouting(_0x3cfcc1,_0x32e958,_0x4a0606,_0x149de5){if(_0x3cfcc1&&_0x32e958){_0x32e958[_0x9f51('0x26')]-=0x1;var _0x65f35e={'leaveAt':moment()[_0x9f51('0x15')](_0x9f51('0x28')),'exitAt':moment()[_0x9f51('0x15')](_0x9f51('0x28')),'reason':_0x9f51('0x3d')};logger['info'](util[_0x9f51('0x15')](_0x9f51('0x3e'),_0x3cfcc1,_0x32e958[_0x9f51('0x35')]));emitChannelQueueInteraction(_0x4a0606[_0x9f51('0x2c')],_0x32e958[_0x9f51('0x35')],_0x4a0606[_0x9f51('0x27')],_0x4a0606[_0x9f51('0xb')]['name'],_0x4a0606[_0x9f51('0x2f')]['id'],![],_0x149de5);if(rpc[_0x4a0606[_0x9f51('0x2c')]+'QueueReport']){return rpc[_0x4a0606[_0x9f51('0x2c')]+_0x9f51('0x36')]['update'](_0x3cfcc1,_0x65f35e)[_0x9f51('0x38')](function(_0x2d691d){logger[_0x9f51('0x3f')](_0x9f51('0x40'),_0x2d691d);});}}}function handleFindQueue(_0x720792){return function(_0x3bc85d){return _0x3bc85d[_0x9f51('0x35')]['toLowerCase']()===_0x720792[_0x9f51('0x41')]();};}exports['consequence']=function(_0x16e8c7,_0x5408d4,_0x31c6cb,_0x2dbd61){return function(_0x445087){try{var _0x3f862f={'name':_0x5408d4[0x0],'timeout':_0x5408d4[0x1]};var _0x1c6d8e=queue[_0x9f51('0x42')](_0x3f862f,{'typecast':!![]});if(_0x1c6d8e[_0x9f51('0x43')]){logger['error'](_0x9f51('0x44'),_0x16e8c7,_[_0x9f51('0x45')](_0x1c6d8e,'message')[_0x9f51('0x46')](',\x20'));_0x445087['stop']();}else{var _0x19044a=_[_0x9f51('0x47')](_0x31c6cb[_0x2dbd61[_0x9f51('0x2c')]+'Queues'],handleFindQueue(_0x3f862f[_0x9f51('0x35')]));if(_0x19044a){startRouting(_0x16e8c7,_0x19044a,_0x2dbd61,_0x31c6cb);var _0x2710f8=(_0x19044a[_0x9f51('0x3d')]||0xa)*0x3e8;var _0x472887=(_0x3f862f[_0x9f51('0x3d')]||0x14)*0x3e8;var _0x3d70a3;if(_0x2710f8>_0x472887){_0x472887=_0x2710f8;}var _0x5b5334=seqqueue['createQueue'](_0x2710f8);_0x5b5334['id']=_0x16e8c7;_0x5b5334[_0x9f51('0x48')]=_0x2710f8;_0x5b5334[_0x9f51('0x49')]=_0x472887;_0x5b5334[_0x9f51('0x2c')]=_0x2dbd61[_0x9f51('0x2c')];_0x31c6cb[_0x9f51('0x4a')][_0x16e8c7]['on'](_0x9f51('0x4b'),function(){logger[_0x9f51('0x33')](_0x9f51('0x4c'),_0x16e8c7);stopRouting(_0x16e8c7,_0x19044a,_0x2dbd61,_0x31c6cb);clearTimeout(_0x3d70a3);_0x3d70a3=undefined;_0x5b5334[_0x9f51('0x4d')](!![]);if(_0x31c6cb['rules'][_0x16e8c7]){delete _0x31c6cb['rules'][_0x16e8c7];}_0x445087[_0x9f51('0x4e')]();});_0x31c6cb[_0x9f51('0x4a')][_0x16e8c7]['on'](_0x9f51('0x4f'),function(){if(_0x31c6cb[_0x9f51('0x4a')][_0x16e8c7]){delete _0x31c6cb[_0x9f51('0x4a')][_0x16e8c7];}});_0x3d70a3=setTimeout(function(){logger['info'](_0x9f51('0x50'),_0x16e8c7);endRouting(_0x16e8c7,_0x19044a,_0x2dbd61,_0x31c6cb);clearTimeout(_0x3d70a3);_0x5b5334[_0x9f51('0x4d')](!![]);_0x445087[_0x9f51('0x51')]();},_0x472887);switch(_0x19044a['strategy']){case'rrmemory':strategy[_0x9f51('0x52')](_0x5b5334,_0x19044a,_0x31c6cb,_0x2dbd61);break;default:strategy[_0x9f51('0x53')](_0x5b5334,_0x19044a,_0x31c6cb,_0x2dbd61);}}else{logger[_0x9f51('0x3f')](_0x9f51('0x54'),_0x16e8c7,_0x3f862f[_0x9f51('0x35')]);_0x445087[_0x9f51('0x4e')]();}}}catch(_0x5a35bd){logger[_0x9f51('0x3f')](_0x9f51('0x44'),_0x16e8c7,_0x5a35bd['stack']);_0x445087['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 ae2d256..1cd7cd3 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 _0xd67b=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push'];(function(_0x1a71c1,_0x16e38c){var _0x33aaef=function(_0x2f14df){while(--_0x2f14df){_0x1a71c1['push'](_0x1a71c1['shift']());}};_0x33aaef(++_0x16e38c);}(_0xd67b,0x133));var _0xbd67=function(_0x6c1b52,_0x2d4d72){_0x6c1b52=_0x6c1b52-0x0;var _0x1224d9=_0xd67b[_0x6c1b52];return _0x1224d9;};'use strict';var _=require('lodash');var uuid=require(_0xbd67('0x0'));var util=require('./util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var Agent=function(_0x317e33,_0x5e967b,_0x40e384,_0x50da5a){this[_0xbd67('0x3')]=uuid['v4']();this['squeue']=_0x317e33;this[_0xbd67('0x4')]=_0x5e967b;this[_0xbd67('0x5')]=_0x40e384;this[_0xbd67('0x2')]=_0x50da5a;this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this[_0xbd67('0x6')]['on'](_0xbd67('0xb'),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this['squeue']['on']('drained',this[_0xbd67('0xc')]['bind'](this));};Agent[_0xbd67('0xd')][_0xbd67('0x7')]=function(){this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));};Agent[_0xbd67('0xd')][_0xbd67('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbd67('0xd')][_0xbd67('0x8')]=function(){logger[_0xbd67('0xe')](_0xbd67('0xf'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this[_0xbd67('0x7')]['bind'](this),0x3e8);}else{if(this[_0xbd67('0x2')][_0xbd67('0x12')]||util[_0xbd67('0x13')](this['squeue']['id'],this[_0xbd67('0x5')]['agents'][this[_0xbd67('0x4')]['id']],this[_0xbd67('0x6')][_0xbd67('0x14')],![])){this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=!![];this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']]['busyQueue']=undefined;util[_0xbd67('0x16')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this[_0xbd67('0x6')][_0xbd67('0x14')]);util[_0xbd67('0x17')](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this[_0xbd67('0x2')]);util['writeLog'](this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],_0xbd67('0x18')+(this[_0xbd67('0x2')]['forcedOwnership']?_0xbd67('0x19'):''));}else{logger[_0xbd67('0xe')](_0xbd67('0x1a'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbd67('0xd')][_0xbd67('0xa')]=function(_0x4675ac){if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){return logger[_0xbd67('0xe')](_0xbd67('0x1b'),this[_0xbd67('0x6')]['id'],this['agent']['id']);}else{logger['debug'](_0xbd67('0x1c'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);util['hideNotification'](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=![];this['realtime']['agents'][this[_0xbd67('0x4')]['id']][_0xbd67('0x1d')]=undefined;util[_0xbd67('0x1e')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this['squeue'][_0xbd67('0x14')]);util[_0xbd67('0x1f')](this[_0xbd67('0x6')]['id'],this['realtime'][_0xbd67('0x11')][this['agent']['id']],_0x4675ac?_0xbd67('0x20'):_0xbd67('0x21'));}if(!_0x4675ac){setTimeout(this['push'][_0xbd67('0x9')](this),0x3e8);}};function agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777){return new Agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777);}module[_0xbd67('0x22')]=agent; \ No newline at end of file +var _0x8d0e=['handleTimeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','busy','busyQueue','saveWaitingNotification','channel','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','push','handleRun','bind'];(function(_0x280899,_0x578f6e){var _0x3f5e38=function(_0x123e52){while(--_0x123e52){_0x280899['push'](_0x280899['shift']());}};_0x3f5e38(++_0x578f6e);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x32d43e,_0x30db72){_0x32d43e=_0x32d43e-0x0;var _0x1fc269=_0x8d0e[_0x32d43e];return _0x1fc269;};'use strict';var _=require(_0xe8d0('0x0'));var uuid=require(_0xe8d0('0x1'));var util=require(_0xe8d0('0x2'));var logger=require(_0xe8d0('0x3'))(_0xe8d0('0x4'));var Agent=function(_0x3584ab,_0x15521e,_0x940176,_0x32cee9){this['notificationId']=uuid['v4']();this[_0xe8d0('0x5')]=_0x3584ab;this['agent']=_0x15521e;this['realtime']=_0x940176;this[_0xe8d0('0x4')]=_0x32cee9;this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')][_0xe8d0('0x8')](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('timeout',this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('drained',this['handleDrained'][_0xe8d0('0x8')](this));};Agent[_0xe8d0('0xa')][_0xe8d0('0x6')]=function(){this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')]['bind'](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));};Agent['prototype'][_0xe8d0('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xe8d0('0x7')]=function(){logger[_0xe8d0('0xc')](_0xe8d0('0xd'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);if(_[_0xe8d0('0xf')](this['realtime'][_0xe8d0('0x10')][this['agent']['id']])){logger[_0xe8d0('0xc')](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xe8d0('0x4')][_0xe8d0('0x12')]||util[_0xe8d0('0x13')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],this[_0xe8d0('0x5')]['channel'],![])){this['realtime']['agents'][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x15')]=!![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x16')]=undefined;util[_0xe8d0('0x17')](this[_0xe8d0('0x14')],this[_0xe8d0('0x4')],this['agent'],this[_0xe8d0('0x5')][_0xe8d0('0x18')]);util['showNotification'](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],null,this[_0xe8d0('0x4')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],'RINGING'+(this[_0xe8d0('0x4')][_0xe8d0('0x12')]?_0xe8d0('0x1b'):''));}else{logger['debug'](_0xe8d0('0x1c'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xe8d0('0x6')][_0xe8d0('0x8')](this),0x3e8);}}};Agent[_0xe8d0('0xa')][_0xe8d0('0x9')]=function(_0x3cf3d6){if(_['isNil'](this[_0xe8d0('0x14')]['agents'][this['agent']['id']])){return logger['debug'](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe8d0('0x5')]['id'],this['agent']['id']);util[_0xe8d0('0x1d')](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']],null,this[_0xe8d0('0x4')]);this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']]['busy']=![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']][_0xe8d0('0x16')]=undefined;util['removeWaitingNotification'](this[_0xe8d0('0x14')],this['routing'],this[_0xe8d0('0xe')],this['squeue'][_0xe8d0('0x18')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],_0x3cf3d6?_0xe8d0('0x1e'):_0xe8d0('0x1f'));}if(!_0x3cf3d6){setTimeout(this['push'][_0xe8d0('0x8')](this),0x3e8);}};function agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41){return new Agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index f991445..9ba0dc4 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 _0xf8fe=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','TIMEOUT','removeWaitingNotification','lodash','uuid','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','busyQueue','name','showNotification','notificationId'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xf8fe,0x14e));var _0xef8f=function(_0x4254fc,_0x203620){_0x4254fc=_0x4254fc-0x0;var _0x2bdd70=_0xf8fe[_0x4254fc];return _0x2bdd70;};'use strict';var _=require(_0xef8f('0x0'));var uuid=require(_0xef8f('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xef8f('0x2'));var Beepall=function(_0x5081d5,_0xfea4f2,_0x2d370b,_0x34dd9d){this['notificationId']=uuid['v4']();this[_0xef8f('0x3')]=_0x5081d5;this[_0xef8f('0x4')]=_0xfea4f2;this[_0xef8f('0x5')]=_0x2d370b;this[_0xef8f('0x2')]=_0x34dd9d;this[_0xef8f('0x3')][_0xef8f('0x6')](this[_0xef8f('0x7')][_0xef8f('0x8')](this),this['handleTimeout'][_0xef8f('0x8')](this));this[_0xef8f('0x3')]['on']('timeout',this[_0xef8f('0x9')][_0xef8f('0x8')](this));this[_0xef8f('0x3')]['on'](_0xef8f('0xa'),this['handleDrained'][_0xef8f('0x8')](this));};Beepall[_0xef8f('0xb')][_0xef8f('0x6')]=function(){this[_0xef8f('0x3')][_0xef8f('0x6')](this[_0xef8f('0x7')][_0xef8f('0x8')](this),this[_0xef8f('0x9')][_0xef8f('0x8')](this));};Beepall[_0xef8f('0xb')][_0xef8f('0xc')]=function(){this['handleTimeout'](!![]);};Beepall[_0xef8f('0xb')][_0xef8f('0x7')]=function(){var _0x501bd7=!![];if(!_['isNil'](this[_0xef8f('0x4')])&&!_[_0xef8f('0xd')](this[_0xef8f('0x4')]['Agents'])&&this['queue'][_0xef8f('0xe')][_0xef8f('0xf')]>0x0){for(var _0x58f147=0x0,_0xebd6f1;_0x58f1470x0){for(var _0x44171f=0x0,_0x54cd88;_0x44171f0x0&&_0x5d0910[_0x4622e7+_0x16df('0x24')]>=_0x5d0910[_0x4622e7+_0x16df('0x23')]){writeLog(_0x2c11d1,_0x5d0910,_0x4622e7['toUpperCase']()+_0x16df('0x25'));return![];}}return!![];};exports[_0x16df('0x26')]=function(_0xb24c04,_0x661a60,_0x17cdda,_0xe86c20,_0x47b976){return sendNotification(!![],_0xb24c04,_0x661a60,_0x17cdda,_0xe86c20,_0x47b976);};exports[_0x16df('0x27')]=function(_0x5a3ee4,_0x284e4f,_0x56bdf,_0xd20ddf,_0x22931f){return sendNotification(![],_0x5a3ee4,_0x284e4f,_0x56bdf,_0xd20ddf,_0x22931f);};exports[_0x16df('0x28')]=function(_0x1874e3,_0x7a8c10,_0x46d608){var _0x2b5544=_0x7a8c10['interaction']['UserId'];if(!_0x2b5544&&_0x46d608){_0x2b5544=_0x46d608['id'];}var _0x3c9824=_[_0x16df('0x29')](_0x1874e3[_0x7a8c10[_0x16df('0x2a')]+_0x16df('0x2b')],function(_0x3321eb){var _0xa59eaf=_[_0x16df('0x2c')](_0x7a8c10[_0x16df('0x2a')])+_0x16df('0x2d');return _0x3321eb[_0xa59eaf]===_0x7a8c10[_0x16df('0x2e')]['id'];});if(!_0x3c9824&&_0x2b5544&&_0x1874e3[_0x16df('0x2f')][_0x2b5544]){_0x3c9824=_['some'](_0x1874e3['agents'][_0x2b5544][_0x7a8c10['channel']+_0x16df('0x30')],function(_0x410856){return _0x410856['id']===_0x7a8c10['interaction']['id'];});}return _0x3c9824;};exports[_0x16df('0x31')]=function(_0x3bd3d3,_0x429d8d,_0x296f27,_0x56064a){if(_0x296f27&&_0x296f27['id']&&_0x3bd3d3[_0x16df('0x2f')]&&_0x3bd3d3[_0x16df('0x2f')][_0x296f27['id']]){_0x3bd3d3['agents'][_0x296f27['id']][_0x56064a+'WaitingInteractions'][_0x429d8d[_0x16df('0x15')]['id']]={'id':_0x429d8d[_0x16df('0x2e')]['id']};}};exports[_0x16df('0x32')]=function(_0x93c74c,_0x201227,_0x512e19,_0x1f1bfd){if(_0x512e19&&_0x512e19['id']&&_0x93c74c[_0x16df('0x2f')]&&_0x93c74c[_0x16df('0x2f')][_0x512e19['id']]){delete _0x93c74c[_0x16df('0x2f')][_0x512e19['id']][_0x1f1bfd+_0x16df('0x30')][_0x201227[_0x16df('0x15')]['id']];}};exports[_0x16df('0x33')]=writeLog; \ No newline at end of file +var _0x4503=['\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','debug','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','removeWaitingNotification','util','../utils','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split'];(function(_0x343303,_0x4bf6aa){var _0x24598c=function(_0x501e76){while(--_0x501e76){_0x343303['push'](_0x343303['shift']());}};_0x24598c(++_0x4bf6aa);}(_0x4503,0x111));var _0x3450=function(_0x2808b2,_0x1885fa){_0x2808b2=_0x2808b2-0x0;var _0x46e829=_0x4503[_0x2808b2];return _0x46e829;};'use strict';var _=require('lodash');var util=require(_0x3450('0x0'));var utils=require(_0x3450('0x1'));var Redis=require(_0x3450('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x3450('0x3'))(_0x3450('0x4'));config[_0x3450('0x5')]=_['defaults'](config[_0x3450('0x5')],{'host':_0x3450('0x6'),'port':0x18eb});var io=require(_0x3450('0x7'))(new Redis(config['redis']));function sendNotification(_0x2a0acb,_0x358ef3,_0x25ed5c,_0x252d2f,_0x5457b9,_0xb3b9f5){var _0x47c3da=_0xb3b9f5||{};var _0xc1653b=_0x25ed5c[_0x3450('0x8')]('.');var _0x5e2d9c={'uniqueid':_0x358ef3,'channel':_0xc1653b[0x0],'id':_0xc1653b[0x1],'title':_0xc1653b[0x0]+_0x3450('0x9'),'interactionId':_0xc1653b[0x2],'queue':_0x5457b9?_0x5457b9[_0x3450('0xa')]:null,'sound':_0x47c3da[_0x3450('0xb')][_0x3450('0xc')],'shake':_0x47c3da['account'][_0x3450('0xd')]};try{if(!_0x47c3da[_0x3450('0xe')]){_0x47c3da['body']={};}if(_0x5457b9){_0x47c3da[_0x3450('0xe')][_0x3450('0xf')]=_0x5457b9;}else if(_0x47c3da[_0x3450('0xe')][_0x3450('0xf')]){delete _0x47c3da[_0x3450('0xe')]['queue'];}_0x5e2d9c[_0x3450('0x10')]=utils['getMustacheRender'](_0x47c3da[_0x3450('0xb')][_0x3450('0x11')],_0x47c3da);}catch(_0x305fbe){_0x5e2d9c[_0x3450('0x10')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x3450('0x12')](util[_0x3450('0x13')](_0x3450('0x14'),_0x358ef3,_0x305fbe[_0x3450('0x15')]));}io['to'](util['format'](_0x3450('0x16'),_0x252d2f[_0x3450('0xa')]))[_0x3450('0x17')](util[_0x3450('0x13')](_0x3450('0x18'),_0x2a0acb?_0x3450('0x19'):'remove'),_0x5e2d9c);}function writeLog(_0x4cd449,_0x3ba5f,_0x5a26dd){return logger[_0x3450('0x1a')](util[_0x3450('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4cd449,_0x3ba5f[_0x3450('0xa')],_0x5a26dd));}exports['isAgentAvailable']=function(_0x263154,_0x483f04,_0x3a686a,_0x295f4c){if(_0x483f04['busy']){writeLog(_0x263154,_0x483f04,_0x3450('0x1b'));return![];}if(!_0x483f04[_0x3450('0x1c')]){writeLog(_0x263154,_0x483f04,_0x3450('0x1d'));return![];}if(_0x483f04[_0x3a686a+'Pause']){writeLog(_0x263154,_0x483f04,_0x3450('0x1e'));return![];}if(_0x295f4c&&_0x483f04[_0x3450('0x1f')](_0x3a686a+_0x3450('0x20'))&&_0x483f04[_0x3450('0x1f')](_0x3a686a+_0x3450('0x21'))){if(_0x483f04[_0x3a686a+_0x3450('0x20')]>0x0&&_0x483f04[_0x3a686a+_0x3450('0x21')]>=_0x483f04[_0x3a686a+'Capacity']){writeLog(_0x263154,_0x483f04,_0x3a686a[_0x3450('0x22')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x3450('0x23')]=function(_0x6f83a7,_0x1e36ef,_0x446289,_0x427002,_0x51ff61){return sendNotification(!![],_0x6f83a7,_0x1e36ef,_0x446289,_0x427002,_0x51ff61);};exports[_0x3450('0x24')]=function(_0xfadde1,_0x3874f8,_0x21f009,_0x4466ff,_0x2dc089){return sendNotification(![],_0xfadde1,_0x3874f8,_0x21f009,_0x4466ff,_0x2dc089);};exports['checkWaitingNotifications']=function(_0x14b2d2,_0x47fbf0,_0x26f6e2){var _0xd738a7=_0x47fbf0[_0x3450('0x25')][_0x3450('0x26')];if(!_0xd738a7&&_0x26f6e2){_0xd738a7=_0x26f6e2['id'];}var _0x3804af=_[_0x3450('0x27')](_0x14b2d2[_0x47fbf0[_0x3450('0x28')]+_0x3450('0x29')],function(_0x29fe16){var _0x4378a5=_[_0x3450('0x2a')](_0x47fbf0[_0x3450('0x28')])+_0x3450('0x2b');return _0x29fe16[_0x4378a5]===_0x47fbf0[_0x3450('0x25')]['id'];});if(!_0x3804af&&_0xd738a7&&_0x14b2d2['agents'][_0xd738a7]){_0x3804af=_[_0x3450('0x27')](_0x14b2d2[_0x3450('0x2c')][_0xd738a7][_0x47fbf0['channel']+_0x3450('0x2d')],function(_0x91f820){return _0x91f820['id']===_0x47fbf0[_0x3450('0x25')]['id'];});}return _0x3804af;};exports['saveWaitingNotification']=function(_0x20b2e4,_0xb8f07c,_0x5a15c6,_0x29d817){if(_0x5a15c6&&_0x5a15c6['id']&&_0x20b2e4[_0x3450('0x2c')]&&_0x20b2e4['agents'][_0x5a15c6['id']]){_0x20b2e4['agents'][_0x5a15c6['id']][_0x29d817+_0x3450('0x2d')][_0xb8f07c[_0x3450('0x15')]['id']]={'id':_0xb8f07c['interaction']['id']};}};exports[_0x3450('0x2e')]=function(_0x11dbe8,_0x312889,_0x357dfd,_0x1091ef){if(_0x357dfd&&_0x357dfd['id']&&_0x11dbe8[_0x3450('0x2c')]&&_0x11dbe8[_0x3450('0x2c')][_0x357dfd['id']]){delete _0x11dbe8[_0x3450('0x2c')][_0x357dfd['id']][_0x1091ef+'WaitingInteractions'][_0x312889[_0x3450('0x15')]['id']];}};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 53a63c2..d894225 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 _0x3d10=['next','error','isObject','validate','lodash','../../../../config/logger','routing','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x338d1d,_0x320946){var _0x18edda=function(_0x3f6249){while(--_0x3f6249){_0x338d1d['push'](_0x338d1d['shift']());}};_0x18edda(++_0x320946);}(_0x3d10,0x7b));var _0x03d1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x3d10[_0x4eafed];return _0x159c85;};'use strict';var schema=require(_0x03d1('0x0'));var sh=require('shelljs');var _=require(_0x03d1('0x1'));var utils=require('./utils');var logger=require(_0x03d1('0x2'))(_0x03d1('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x03d1('0x4')]=function(_0x2c8f1a,_0x112247){return function(_0x812d8){try{var _0x5f260a={'command':_0x112247[0x0]};var _0x2b319e=system[_0x03d1('0x0')](_0x5f260a,{'typecast':!![]});if(_0x2b319e[_0x03d1('0x5')]){logger['error'](_0x03d1('0x6'),_0x2c8f1a,_[_0x03d1('0x7')](_0x2b319e,_0x03d1('0x8'))[_0x03d1('0x9')](',\x20'));logger[_0x03d1('0xa')](_0x03d1('0xb'),_0x2c8f1a);_0x812d8['next']();}else{var _0x22e87f=this;var _0x1f6ae8=utils[_0x03d1('0xc')](_0x112247[0x0],this);logger[_0x03d1('0xa')](_0x03d1('0xd'),_0x2c8f1a,_0x1f6ae8);sh[_0x03d1('0xe')](_['trim'](_0x1f6ae8),function(_0x23acda,_0x15a1a4){logger[_0x03d1('0xa')](_0x03d1('0xf'),_0x2c8f1a,_0x23acda);if(_0x23acda==0x0){var _0x5b05f8=_0x15a1a4[_0x03d1('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x03d1('0x11')](_0x112247[0x1])||_['isEmpty'](_0x112247[0x1])){logger[_0x03d1('0xa')](_0x03d1('0x12'),_0x2c8f1a);_0x22e87f[_0x03d1('0x13')][_0x112247[0x1]]=_0x5b05f8;}else{logger[_0x03d1('0xa')](_0x03d1('0x14'),_0x2c8f1a,_0x112247[0x1],_0x5b05f8);_0x22e87f[_0x03d1('0x13')][_0x112247[0x1]]=_0x5b05f8;}}_0x812d8[_0x03d1('0x15')]();});}}catch(_0x10ff97){logger[_0x03d1('0x16')](_0x03d1('0x6'),_0x2c8f1a,_[_0x03d1('0x17')](_0x10ff97)?JSON['stringify'](_0x10ff97):_0x10ff97);logger[_0x03d1('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2c8f1a);_0x812d8[_0x03d1('0x15')]();}};}; \ No newline at end of file +var _0x8a13=['isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x8a13,0xd6));var _0x38a1=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x8a13[_0x59befa];return _0x1dd63d;};'use strict';var schema=require(_0x38a1('0x0'));var sh=require(_0x38a1('0x1'));var _=require(_0x38a1('0x2'));var utils=require(_0x38a1('0x3'));var logger=require(_0x38a1('0x4'))(_0x38a1('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x38a1('0x6')}});exports[_0x38a1('0x7')]=function(_0x397f8d,_0x10b66e){return function(_0x2ccc1a){try{var _0x1bf204={'command':_0x10b66e[0x0]};var _0x4d4fcd=system['validate'](_0x1bf204,{'typecast':!![]});if(_0x4d4fcd[_0x38a1('0x8')]){logger[_0x38a1('0x9')](_0x38a1('0xa'),_0x397f8d,_[_0x38a1('0xb')](_0x4d4fcd,'message')['join'](',\x20'));logger[_0x38a1('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x397f8d);_0x2ccc1a[_0x38a1('0xd')]();}else{var _0x3e6f3d=this;var _0xf7c34e=utils[_0x38a1('0xe')](_0x10b66e[0x0],this);logger[_0x38a1('0xc')](_0x38a1('0xf'),_0x397f8d,_0xf7c34e);sh[_0x38a1('0x10')](_['trim'](_0xf7c34e),function(_0x4e4c11,_0xc46104){logger[_0x38a1('0xc')](_0x38a1('0x11'),_0x397f8d,_0x4e4c11);if(_0x4e4c11==0x0){var _0x9eb9e5=_0xc46104[_0x38a1('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x38a1('0x13')](_0x10b66e[0x1])||_[_0x38a1('0x14')](_0x10b66e[0x1])){logger[_0x38a1('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x397f8d);_0x3e6f3d[_0x38a1('0x15')][_0x10b66e[0x1]]=_0x9eb9e5;}else{logger[_0x38a1('0xc')](_0x38a1('0x16'),_0x397f8d,_0x10b66e[0x1],_0x9eb9e5);_0x3e6f3d[_0x38a1('0x15')][_0x10b66e[0x1]]=_0x9eb9e5;}}_0x2ccc1a[_0x38a1('0xd')]();});}}catch(_0x3412f7){logger[_0x38a1('0x9')]('[%s][SYSTEM]\x20%s',_0x397f8d,_[_0x38a1('0x17')](_0x3412f7)?JSON[_0x38a1('0x18')](_0x3412f7):_0x3412f7);logger[_0x38a1('0xc')](_0x38a1('0x19'),_0x397f8d);_0x2ccc1a[_0x38a1('0xd')]();}};}; \ 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 af0ffcd..e07d506 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 _0xc439=['addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction'];(function(_0x408ca9,_0x114a12){var _0x35d3f3=function(_0x32bc29){while(--_0x32bc29){_0x408ca9['push'](_0x408ca9['shift']());}};_0x35d3f3(++_0x114a12);}(_0xc439,0x8e));var _0x9c43=function(_0x31bdb5,_0x23e6a4){_0x31bdb5=_0x31bdb5-0x0;var _0x44a62e=_0xc439[_0x31bdb5];return _0x44a62e;};'use strict';var schema=require(_0x9c43('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x9c43('0x1')),'openchannelInteraction':require(_0x9c43('0x2')),'smsInteraction':require(_0x9c43('0x3')),'mailInteraction':require(_0x9c43('0x4')),'faxInteraction':require(_0x9c43('0x5')),'whatsappInteraction':require(_0x9c43('0x6'))};var logger=require(_0x9c43('0x7'))('routing');var tag=schema({'tag':{'type':_0x9c43('0x8'),'required':!![],'message':_0x9c43('0x9')}});exports['consequence']=function(_0x3d1cfb,_0x2a5a19,_0xb42f80,_0x2373fb){return function(_0x38a7a0){try{var _0x35af10={'tag':_0x2a5a19[0x0]};var _0x109a7b=tag[_0x9c43('0x0')](_0x35af10,{'typecast':!![]});if(_0x109a7b['length']){logger[_0x9c43('0xa')](_0x9c43('0xb'),_0x3d1cfb,_[_0x9c43('0xc')](_0x109a7b,_0x9c43('0xd'))[_0x9c43('0xe')](',\x20'));logger[_0x9c43('0xf')](_0x9c43('0x10'),_0x3d1cfb);_0x38a7a0[_0x9c43('0x11')]();}else{var _0x47faba={'ids':[_0x2a5a19[0x0]]};if(rpc[_0x2373fb[_0x9c43('0x12')]+_0x9c43('0x13')]){rpc[_0x2373fb[_0x9c43('0x12')]+_0x9c43('0x13')][_0x9c43('0x14')](_0x2373fb[_0x9c43('0x15')]['id'],_0x47faba)['then'](function(_0x574288){logger[_0x9c43('0xf')](_0x9c43('0x16'),_0x3d1cfb,_0x2a5a19[0x1],_0x2373fb[_0x9c43('0x12')],_0x2373fb[_0x9c43('0x15')]['id']);})[_0x9c43('0x17')](function(_0x3bb64c){logger[_0x9c43('0xa')](_0x9c43('0xb'),_0x3d1cfb,JSON[_0x9c43('0x18')](_0x3bb64c));logger[_0x9c43('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3d1cfb);})[_0x9c43('0x19')](function(){_0x38a7a0['next']();});}}}catch(_0x259c35){logger[_0x9c43('0xa')](_0x9c43('0xb'),_0x3d1cfb,_[_0x9c43('0x1a')](_0x259c35)?JSON[_0x9c43('0x18')](_0x259c35):_0x259c35);logger[_0x9c43('0xf')](_0x9c43('0x10'),_0x3d1cfb);_0x38a7a0[_0x9c43('0x11')]();}};}; \ No newline at end of file +var _0x195e=['Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0xe1346d,_0x296c8b){var _0x11ccec=function(_0x50799f){while(--_0x50799f){_0xe1346d['push'](_0xe1346d['shift']());}};_0x11ccec(++_0x296c8b);}(_0x195e,0xe9));var _0xe195=function(_0xf32008,_0x461060){_0xf32008=_0xf32008-0x0;var _0x6be258=_0x195e[_0xf32008];return _0x6be258;};'use strict';var schema=require(_0xe195('0x0'));var _=require(_0xe195('0x1'));var rpc={'chatInteraction':require(_0xe195('0x2')),'openchannelInteraction':require(_0xe195('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe195('0x4')),'faxInteraction':require(_0xe195('0x5')),'whatsappInteraction':require(_0xe195('0x6'))};var logger=require(_0xe195('0x7'))(_0xe195('0x8'));var tag=schema({'tag':{'type':_0xe195('0x9'),'required':!![],'message':_0xe195('0xa')}});exports[_0xe195('0xb')]=function(_0x2b5014,_0x4cf9b1,_0x39636b,_0xd1258d){return function(_0x569c09){try{var _0x39215c={'tag':_0x4cf9b1[0x0]};var _0x123b39=tag[_0xe195('0x0')](_0x39215c,{'typecast':!![]});if(_0x123b39[_0xe195('0xc')]){logger[_0xe195('0xd')](_0xe195('0xe'),_0x2b5014,_['map'](_0x123b39,'message')[_0xe195('0xf')](',\x20'));logger[_0xe195('0x10')](_0xe195('0x11'),_0x2b5014);_0x569c09['next']();}else{var _0x3c27de={'ids':[_0x4cf9b1[0x0]]};if(rpc[_0xd1258d[_0xe195('0x12')]+_0xe195('0x13')]){rpc[_0xd1258d[_0xe195('0x12')]+_0xe195('0x13')]['addTags'](_0xd1258d[_0xe195('0x14')]['id'],_0x3c27de)[_0xe195('0x15')](function(_0x34c1b3){logger[_0xe195('0x10')](_0xe195('0x16'),_0x2b5014,_0x4cf9b1[0x1],_0xd1258d['channel'],_0xd1258d[_0xe195('0x14')]['id']);})[_0xe195('0x17')](function(_0x48f9cb){logger[_0xe195('0xd')](_0xe195('0xe'),_0x2b5014,JSON[_0xe195('0x18')](_0x48f9cb));logger['info'](_0xe195('0x11'),_0x2b5014);})[_0xe195('0x19')](function(){_0x569c09[_0xe195('0x1a')]();});}}}catch(_0x4c70f3){logger[_0xe195('0xd')](_0xe195('0xe'),_0x2b5014,_[_0xe195('0x1b')](_0x4c70f3)?JSON[_0xe195('0x18')](_0x4c70f3):_0x4c70f3);logger[_0xe195('0x10')](_0xe195('0x11'),_0x2b5014);_0x569c09[_0xe195('0x1a')]();}};}; \ 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 1d39cc2..e33e84e 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 _0x4392=['urlOnAnswer','urlOnRing','?params=','title','jsonrpc','login','params','stringify','utf8','POST','then','parse','result','logged','channelId=','&serviceId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push'];(function(_0x251908,_0x3e5ff9){var _0x4e0ed2=function(_0x3e73ee){while(--_0x3e73ee){_0x251908['push'](_0x251908['shift']());}};_0x4e0ed2(++_0x3e5ff9);}(_0x4392,0x178));var _0x2439=function(_0x1e6d58,_0x33595a){_0x1e6d58=_0x1e6d58-0x0;var _0xa3c9ef=_0x4392[_0x1e6d58];return _0xa3c9ef;};'use strict';var rp=require(_0x2439('0x0'));var logger=require(_0x2439('0x1'))('routing');var _=require(_0x2439('0x2'));var arr=[];exports[_0x2439('0x3')]=function(_0x334f1b,_0x5037cc){return function(_0x1ade2a){var _0x3ed887=_0x5037cc[0xa];var _0x36b7ee=_0x5037cc[0xb];var _0x1a9f3d=_0x5037cc[0xc];var _0xd664b1=_0x5037cc[0xd];var _0x2543a4=_0x5037cc[0xe];var _0x5717a2=_0x5037cc[0xf][_0x2439('0x4')](/\n/g,_0x2439('0x5'));var _0x59cadc=_0x5037cc[0x10][_0x2439('0x4')](/\n/g,'\x20');if(!arr[_0x2439('0x6')](_0x36b7ee)){arr[_0x2439('0x7')](_0x36b7ee);var _0x5a3bc8=_0x5037cc[0x3];var _0x2a90a1=_0x5037cc[0x4];var _0x2f4cd5=_0x5037cc[0x1];var _0x4a1ab0=_0x5037cc[0x0];var _0x5259c3={};_0x5259c3[_0x2439('0x8')]=_0x5037cc[0x8]+'?params='+_0x1a9f3d+'|'+_0x3ed887+'|'+_0xd664b1+'|'+_0x36b7ee+'|'+_0x2543a4;_0x5259c3[_0x2439('0x9')]=_0x5037cc[0x7]+_0x2439('0xa')+_0x1a9f3d+'|'+_0x3ed887+'|'+_0xd664b1+'|'+_0x36b7ee+'|'+_0x2543a4+'|'+_0x5717a2+'|'+_0x59cadc;_0x5259c3[_0x2439('0xb')]=_0x5037cc[0x9];var _0x411b89={};_0x411b89[_0x2439('0xc')]='2.0';_0x411b89['method']=_0x2439('0xd');var _0x26a1ae=[];_0x26a1ae[_0x2439('0x7')](_0x5037cc[0x2]);_0x26a1ae[_0x2439('0x7')](_0x5037cc[0x5]);_0x26a1ae['push'](_0x5037cc[0x6]);_0x411b89[_0x2439('0xe')]=_0x26a1ae;_0x411b89['id']=0x1;var _0xef00de=JSON[_0x2439('0xf')](_0x411b89);var _0x42cf4f={'encoding':_0x2439('0x10'),'method':_0x2439('0x11'),'timeout':0x2710,'url':_0x5a3bc8,'headers':{'Content-Type':'application/json-rpc'},'body':_0xef00de};return rp(_0x42cf4f)[_0x2439('0x12')](function(_0x536232){const _0x30c77a=JSON[_0x2439('0x13')](_0x536232);if(!_0x30c77a[_0x2439('0x14')][_0x2439('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x507b16=_0x36b7ee;var _0x3e0b79=_0x2439('0x16')+_0x2f4cd5+_0x2439('0x17')+_0x4a1ab0+'&sessionId='+_0x507b16+'&data='+JSON['stringify'](_0x5259c3);var _0x7df31c=_0x2a90a1+'?'+_0x3e0b79;return rp(_0x7df31c);})[_0x2439('0x12')](function(_0x479343){logger[_0x2439('0x18')](_0x2439('0x19'),_0x334f1b,_0x479343);_0x1ade2a[_0x2439('0x1a')]();})[_0x2439('0x1b')](function(_0x437576){logger['error'](_0x2439('0x1c'),_0x334f1b,_[_0x2439('0x1d')](_0x437576)?JSON['stringify'](_0x437576):_0x437576);_0x1ade2a[_0x2439('0x1a')]();});}else{logger[_0x2439('0x18')](_0x2439('0x1e'),_0x334f1b);_0x1ade2a[_0x2439('0x1f')]();}};}; \ No newline at end of file +var _0xe434=['logged','&serviceId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','stringify','POST','result'];(function(_0x3d7d68,_0x2e5967){var _0x43c8f4=function(_0x49f5cc){while(--_0x49f5cc){_0x3d7d68['push'](_0x3d7d68['shift']());}};_0x43c8f4(++_0x2e5967);}(_0xe434,0x191));var _0x4e43=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xe434[_0x46aff0];return _0x9d78cf;};'use strict';var rp=require(_0x4e43('0x0'));var logger=require(_0x4e43('0x1'))(_0x4e43('0x2'));var _=require(_0x4e43('0x3'));var arr=[];exports[_0x4e43('0x4')]=function(_0x5415fa,_0x1e43e4){return function(_0x124373){var _0x34b2af=_0x1e43e4[0xa];var _0x56f2f3=_0x1e43e4[0xb];var _0x131154=_0x1e43e4[0xc];var _0x334c7c=_0x1e43e4[0xd];var _0x3c264e=_0x1e43e4[0xe];var _0xeadf3b=_0x1e43e4[0xf][_0x4e43('0x5')](/\n/g,_0x4e43('0x6'));var _0x2acdf4=_0x1e43e4[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4e43('0x7')](_0x56f2f3)){arr[_0x4e43('0x8')](_0x56f2f3);var _0xe3d87=_0x1e43e4[0x3];var _0x134f2e=_0x1e43e4[0x4];var _0x2665f7=_0x1e43e4[0x1];var _0x567764=_0x1e43e4[0x0];var _0x5a675e={};_0x5a675e[_0x4e43('0x9')]=_0x1e43e4[0x8]+_0x4e43('0xa')+_0x131154+'|'+_0x34b2af+'|'+_0x334c7c+'|'+_0x56f2f3+'|'+_0x3c264e;_0x5a675e['urlOnRing']=_0x1e43e4[0x7]+'?params='+_0x131154+'|'+_0x34b2af+'|'+_0x334c7c+'|'+_0x56f2f3+'|'+_0x3c264e+'|'+_0xeadf3b+'|'+_0x2acdf4;_0x5a675e[_0x4e43('0xb')]=_0x1e43e4[0x9];var _0x51f7ca={};_0x51f7ca[_0x4e43('0xc')]=_0x4e43('0xd');_0x51f7ca[_0x4e43('0xe')]=_0x4e43('0xf');var _0x5ecc6b=[];_0x5ecc6b['push'](_0x1e43e4[0x2]);_0x5ecc6b[_0x4e43('0x8')](_0x1e43e4[0x5]);_0x5ecc6b[_0x4e43('0x8')](_0x1e43e4[0x6]);_0x51f7ca['params']=_0x5ecc6b;_0x51f7ca['id']=0x1;var _0x1fc059=JSON[_0x4e43('0x10')](_0x51f7ca);var _0x537e83={'encoding':'utf8','method':_0x4e43('0x11'),'timeout':0x2710,'url':_0xe3d87,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1fc059};return rp(_0x537e83)['then'](function(_0x1c4a06){const _0x4a4674=JSON['parse'](_0x1c4a06);if(!_0x4a4674[_0x4e43('0x12')][_0x4e43('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1a7b4e=_0x56f2f3;var _0x3f5a75='channelId='+_0x2665f7+_0x4e43('0x14')+_0x567764+'&sessionId='+_0x1a7b4e+_0x4e43('0x15')+JSON['stringify'](_0x5a675e);var _0x341dd6=_0x134f2e+'?'+_0x3f5a75;return rp(_0x341dd6);})[_0x4e43('0x16')](function(_0x26e8cc){logger[_0x4e43('0x17')](_0x4e43('0x18'),_0x5415fa,_0x26e8cc);_0x124373[_0x4e43('0x19')]();})[_0x4e43('0x1a')](function(_0x4fd76b){logger[_0x4e43('0x1b')](_0x4e43('0x1c'),_0x5415fa,_['isObject'](_0x4fd76b)?JSON[_0x4e43('0x10')](_0x4fd76b):_0x4fd76b);_0x124373[_0x4e43('0x19')]();});}else{logger[_0x4e43('0x17')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5415fa);_0x124373[_0x4e43('0x1d')]();}};}; \ 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 82242af..4aec888 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(_0x50c994,_0x333c98){var _0x474676=function(_0x545512){while(--_0x545512){_0x50c994['push'](_0x50c994['shift']());}};_0x474676(++_0x333c98);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x55a858,_0x1fd254){var _0x3fc987=function(_0x564d5e){while(--_0x564d5e){_0x55a858['push'](_0x55a858['shift']());}};_0x3fc987(++_0x1fd254);}(_0xe706,0xa3));var _0x6e70=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0xe706[_0x5089ea];return _0xabe953;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 46d740e..982d7f5 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 _0xf65d=['%s:%s:%s','./interval','consequence','priority','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','app','toLowerCase','autoreply','appdata','split','push','join','slice','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body'];(function(_0x742c2b,_0x1358fa){var _0x682d75=function(_0x7fb2da){while(--_0x7fb2da){_0x742c2b['push'](_0x742c2b['shift']());}};_0x682d75(++_0x1358fa);}(_0xf65d,0x9f));var _0xdf65=function(_0x5ecde7,_0x411905){_0x5ecde7=_0x5ecde7-0x0;var _0x4c037e=_0xf65d[_0x5ecde7];return _0x4c037e;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var path=require(_0xdf65('0x1'));var fs=require('fs');var jayson=require(_0xdf65('0x2'));var BPromise=require(_0xdf65('0x3'));var utils=require(_0xdf65('0x4'));var sUtils=require(_0xdf65('0x5'));var logger=require(_0xdf65('0x6'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xdf65('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xdf65('0x8')),'whatsappQueueReport':require(_0xdf65('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x40cc08,_0x3f5cae,_0x97292b){return util[_0xdf65('0xa')](_0xdf65('0xb'),_0x40cc08,_0x3f5cae||0x0,_0x97292b||0x0);}function getIntervals(_0x46a70d,_0x483974){var _0x27df5c=[];if(!_['isNil'](_0x483974[_0xdf65('0xc')])&&!_[_0xdf65('0xd')](_0x46a70d[_0x483974[_0xdf65('0xc')]])&&!_['isNil'](_0x46a70d[_0x483974['IntervalId']][_0xdf65('0xe')])){_0x27df5c=_[_0xdf65('0xf')](_0x46a70d[_0x483974[_0xdf65('0xc')]][_0xdf65('0xe')],_0xdf65('0x10'));}else if(!_[_0xdf65('0xd')](_0x483974['interval'])){_0x27df5c=[_0x483974[_0xdf65('0x10')]];}return _0x27df5c;}exports[_0xdf65('0x11')]=function(_0x51f281){_0x51f281['rules']={};return new BPromise(function(_0x5a0ae1,_0x26868c){var _0x110170={'Start':function(_0x11f0e3){var _0x1b6d10=this;return new Promise(function(_0x1d6f22,_0x9bcb1c){if(_0x11f0e3){try{var _0x16ced1=[];var _0x230429=getId(_0x11f0e3[_0xdf65('0x12')],_0x11f0e3[_0xdf65('0x13')]?_0x11f0e3['message']['id']:0x0,_0x11f0e3[_0xdf65('0x14')]?_0x11f0e3['interaction']['id']:0x0);var _0x28fcd1=sUtils[_0xdf65('0x15')](_0x51f281,_0x11f0e3);if(_0x11f0e3[_0xdf65('0x16')]||!_0x28fcd1&&_0x11f0e3[_0xdf65('0x17')]&&_[_0xdf65('0x18')](_0x11f0e3[_0xdf65('0x17')])&&_0x11f0e3['applications'][_0xdf65('0x19')]){for(var _0x5db9c0=0x0;_0x5db9c0<_0x11f0e3[_0xdf65('0x17')][_0xdf65('0x19')];_0x5db9c0+=0x1){var _0xd57bc8=_0x11f0e3[_0xdf65('0x17')][_0x5db9c0];if(fs[_0xdf65('0x1a')](path['join'](__dirname,_0xdf65('0x17'),_0xd57bc8[_0xdf65('0x1b')]+'.js'))){var _0x45fb5f=[];switch(_0xd57bc8[_0xdf65('0x1b')][_0xdf65('0x1c')]()){case _0xdf65('0x1d'):var _0x529bf0=_0xd57bc8[_0xdf65('0x1e')][_0xdf65('0x1f')](',');if(_0x11f0e3['channel']==='mail'){_0x45fb5f[_0xdf65('0x20')](_0x529bf0[0x0]);_0x45fb5f[_0xdf65('0x20')](_0x529bf0[0x1]);_0x45fb5f[_0xdf65('0x20')](_0x529bf0['slice'](0x2,_0x529bf0['length'])[_0xdf65('0x21')](','));}else{_0x45fb5f[_0xdf65('0x20')](_0x529bf0[0x0]);_0x45fb5f['push'](_0x529bf0['slice'](0x1,_0x529bf0['length'])[_0xdf65('0x21')](','));}break;case'dialogflow':var _0xa04154=_0xd57bc8['appdata'][_0xdf65('0x1f')](',');_0x45fb5f[_0xdf65('0x20')](_0xa04154[0x0]);_0x45fb5f[_0xdf65('0x20')](_0xa04154[0x1]);_0x45fb5f[_0xdf65('0x20')](_0xa04154[_0xdf65('0x22')](0x2,_0xa04154[_0xdf65('0x19')])[_0xdf65('0x21')](','));break;case _0xdf65('0x23'):var _0xf73b57=_0xd57bc8[_0xdf65('0x1e')][_0xdf65('0x1f')](',');_0x45fb5f['push'](_0xf73b57[0x0]);_0x45fb5f['push'](_0xf73b57[0x1]);_0x45fb5f[_0xdf65('0x20')](_0xf73b57[0x2]);_0x45fb5f[_0xdf65('0x20')](_0xf73b57[0x3]);_0x45fb5f[_0xdf65('0x20')](_0xf73b57['slice'](0x4,_0xf73b57[_0xdf65('0x19')])['join'](','));break;case _0xdf65('0x24'):var _0x3de60c=_0xd57bc8['appdata'][_0xdf65('0x1f')](',');_0x45fb5f[_0xdf65('0x20')](_0x3de60c[0x0]);_0x45fb5f[_0xdf65('0x20')](_0x3de60c[0x1]);_0x45fb5f[_0xdf65('0x20')](_0x3de60c[0x2]);_0x45fb5f[_0xdf65('0x20')](_0x3de60c[0x3]);_0x45fb5f[_0xdf65('0x20')](_0x3de60c['slice'](0x4,_0x3de60c['length'])[_0xdf65('0x21')](','));break;case'message':_0x45fb5f[_0xdf65('0x20')](_0xd57bc8[_0xdf65('0x1e')]);break;case _0xdf65('0x25'):_0x45fb5f['push'](_0xd57bc8[_0xdf65('0x26')]);_0x45fb5f[_0xdf65('0x20')](_0xd57bc8[_0xdf65('0x1e')]);break;case _0xdf65('0x27'):var _0x27ac6b=utils['getMustacheRender'](_0x11f0e3[_0xdf65('0x28')][_0xdf65('0x29')],_0x11f0e3);var _0x116164=_0xd57bc8['appdata'][_0xdf65('0x1f')](',');_0x45fb5f[_0xdf65('0x20')](_0x116164[0x0]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x1]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x2]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x3]);_0x45fb5f['push'](_0x116164[0x4]);_0x45fb5f['push'](_0x116164[0x5]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x6]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x7]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0x8]);_0x45fb5f['push'](_0x116164[0x9]);_0x45fb5f[_0xdf65('0x20')](_0x116164[0xa]);_0x45fb5f['push'](_0x11f0e3[_0xdf65('0x14')]['id']);_0x45fb5f[_0xdf65('0x20')](_0x11f0e3[_0xdf65('0x13')]['id']);_0x45fb5f['push'](_0xd57bc8[_0xdf65('0x2a')]);_0x45fb5f[_0xdf65('0x20')](_0x11f0e3[_0xdf65('0x14')][_0xdf65('0x2b')]);_0x45fb5f[_0xdf65('0x20')](_0x11f0e3[_0xdf65('0x2c')][_0xdf65('0x2c')]);_0x45fb5f[_0xdf65('0x20')](_0x27ac6b);break;default:_0x45fb5f=_['isNil'](_0xd57bc8[_0xdf65('0x1e')])?[]:_0xd57bc8[_0xdf65('0x1e')][_0xdf65('0x1f')](',');}var _0x4fe02d={'id':util['format'](_0xdf65('0x2d'),_0x230429,_0xd57bc8['id'],_0xd57bc8['app']),'condition':require(_0xdf65('0x2e'))['condition'](_0x230429,getIntervals(_0x51f281['intervals'],_0xd57bc8),_0x51f281),'consequence':require('./applications/'+_0xd57bc8[_0xdf65('0x1b')])[_0xdf65('0x2f')](_0x230429,_0x45fb5f,_0x51f281,_0x11f0e3),'p':_0xd57bc8[_0xdf65('0x30')]||0x0};logger['info']('Push\x20new\x20rule',_0x4fe02d['id'],_0xdf65('0x31'),getIntervals(_0x51f281['intervals'],_0xd57bc8)[_0xdf65('0x21')](_0xdf65('0x32')));_0x16ced1[_0xdf65('0x20')](_0x4fe02d);}else{logger['error'](_0xdf65('0x33'),path['join'](__dirname,_0xdf65('0x17'),_0xd57bc8[_0xdf65('0x1b')]+'.js'));}}_0x51f281[_0xdf65('0x34')][_0x230429]=new RuleEngine(_0x16ced1);_0x51f281[_0xdf65('0x34')][_0x230429][_0xdf65('0x35')](_0x11f0e3,function(_0x5e1195){logger[_0xdf65('0x36')](_0xdf65('0x37'),JSON[_0xdf65('0x38')](_0x5e1195[_0xdf65('0x39')]));if(_0x51f281[_0xdf65('0x34')][_0x230429]){_0x51f281[_0xdf65('0x34')][_0x230429][_0xdf65('0x3a')]('complete');}});return _0x1d6f22({'code':0xc8,'message':_0x11f0e3});}else{if(_0x28fcd1){logger[_0xdf65('0x36')](util[_0xdf65('0xa')](_0xdf65('0x3b'),_0x230429));}else{logger[_0xdf65('0x36')](_0xdf65('0x3c'));}return _0x1d6f22({'code':0xc8,'message':_0x11f0e3});}}catch(_0x5e36cf){logger['error'](_0x5e36cf[_0xdf65('0x3d')]);return _0x9bcb1c(_0x1b6d10[_0xdf65('0x3e')](0x1f4,_0x5e36cf));}}return _0x9bcb1c(_0xdf65('0x3f'));});},'AcceptMessage':function(_0x3b9d48){var _0x17ef62=this;return new Promise(function(_0x369d38,_0x281fc8){if(_0x3b9d48[_0xdf65('0x40')]&&_0x3b9d48[_0xdf65('0x40')]['id']){if(_0x51f281[_0xdf65('0x41')][_0x3b9d48['agent']['id']]){_0x51f281[_0xdf65('0x41')][_0x3b9d48[_0xdf65('0x40')]['id']]['busy']=![];_0x51f281[_0xdf65('0x41')][_0x3b9d48[_0xdf65('0x40')]['id']][_0xdf65('0x42')]=undefined;}}if(_0x3b9d48['message']&&_0x3b9d48[_0xdf65('0x13')]['id']){try{var _0x164be8=getId(_0x3b9d48[_0xdf65('0x12')],_0x3b9d48['message']?_0x3b9d48[_0xdf65('0x13')]['id']:0x0,_0x3b9d48['interaction']?_0x3b9d48['interaction']['id']:0x0);if(_0x51f281['rules'][_0x164be8]){_0x51f281[_0xdf65('0x34')][_0x164be8][_0xdf65('0x3a')]('end');if(rpc[_0x3b9d48[_0xdf65('0x12')]+_0xdf65('0x43')]){rpc[_0x3b9d48[_0xdf65('0x12')]+'QueueReport'][_0xdf65('0x44')](_0x164be8,{'UserId':_0x3b9d48[_0xdf65('0x13')][_0xdf65('0x45')]})[_0xdf65('0x46')](function(){logger['error'](_0xdf65('0x47'));});}}return _0x369d38({'code':0xc8,'message':_0x3b9d48});}catch(_0x446a2d){logger[_0xdf65('0x3e')](_0x446a2d[_0xdf65('0x3d')]);return _0x281fc8(_0x17ef62[_0xdf65('0x3e')](0x1f4,_0x446a2d));}}logger[_0xdf65('0x3e')](_0xdf65('0x48'));return _0x281fc8(_0x17ef62[_0xdf65('0x3e')](0x1f4,_0xdf65('0x48')));});},'RejectMessage':function(_0x4baad2){var _0x83e749=this;return new Promise(function(_0x3ba49f,_0x48c9eb){if(_0x4baad2[_0xdf65('0x40')]&&_0x4baad2[_0xdf65('0x40')]['id']){try{if(_0x51f281[_0xdf65('0x41')][_0x4baad2[_0xdf65('0x40')]['id']]){_0x51f281[_0xdf65('0x41')][_0x4baad2[_0xdf65('0x40')]['id']][_0xdf65('0x49')]=![];_0x51f281[_0xdf65('0x41')][_0x4baad2[_0xdf65('0x40')]['id']][_0xdf65('0x42')]=undefined;}return _0x3ba49f({'code':0xc8,'message':_0x4baad2});}catch(_0x4c6b40){logger[_0xdf65('0x3e')](_0x4c6b40[_0xdf65('0x3d')]);return _0x48c9eb(_0x83e749[_0xdf65('0x3e')](0x1f4,_0x4c6b40));}}logger[_0xdf65('0x3e')](_0xdf65('0x48'));return _0x48c9eb(_0x83e749[_0xdf65('0x3e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x24f01c){var _0x34f3fa=this;return new Promise(function(_0x1777a1,_0x54528d){if(_0x24f01c[_0xdf65('0x12')]&&_0x24f01c[_0xdf65('0x14')]&&_0x24f01c[_0xdf65('0x14')]['id']){try{var _0x2fc66c=getId(_0x24f01c[_0xdf65('0x12')],_0x24f01c[_0xdf65('0x13')]?_0x24f01c['message']['id']:0x0,_0x24f01c[_0xdf65('0x14')]?_0x24f01c[_0xdf65('0x14')]['id']:0x0);if(_0x51f281[_0xdf65('0x34')][_0x2fc66c]){_0x51f281['rules'][_0x2fc66c]['emit'](_0xdf65('0x4a'));}return _0x1777a1({'code':0xc8,'message':_0x24f01c});}catch(_0xf8a30a){logger[_0xdf65('0x3e')](_0xf8a30a['stack']);return _0x54528d(_0x34f3fa[_0xdf65('0x3e')](0x1f4,_0xf8a30a));}}logger[_0xdf65('0x3e')](_0xdf65('0x48'));return _0x54528d(_0x34f3fa['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x292eee){var _0x5f2c2c=this;return new Promise(function(_0x532af9,_0x3786fb){if(_0x51f281['agents'][_0xdf65('0x4b')](_0x292eee['id'])){for(var _0x28ad26 in _0x292eee[_0xdf65('0x4c')]){if(_0x292eee[_0xdf65('0x4c')][_0xdf65('0x4b')](_0x28ad26)){if(_0x51f281['agents'][_0x292eee['id']][_0xdf65('0x4b')](_0x28ad26+'CurrentCapacity')){_0x51f281['agents'][_0x292eee['id']][_0x28ad26+_0xdf65('0x4d')]=parseInt(_0x292eee[_0xdf65('0x4c')][_0x28ad26],0xa);}}}_0x51f281[_0xdf65('0x41')][_0x292eee['id']][_0xdf65('0x4e')]();return _0x532af9({'code':0xc8,'message':_0x51f281[_0xdf65('0x41')][_0x292eee['id']]});}else{return _0x3786fb(_0x5f2c2c[_0xdf65('0x3e')](0x1f4,_0xdf65('0x4f')));}});},'Agents':function(_0x5e47ed){return new Promise(function(_0x651c52){var _0x4d624d=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x41')]);if(_0x5e47ed&&_0x5e47ed['id']){var _0x59b0cc=_[_0xdf65('0x51')](_0x4d624d,function(_0x841b2e){return _0x841b2e['id']===_0x5e47ed['id'];});_0x651c52(_0x59b0cc);}else{_0x651c52({'count':_0x4d624d[_0xdf65('0x19')],'rows':_0x4d624d});}});},'ChatQueues':function(){return new Promise(function(_0x605fa9){var _0x256294=[];for(var _0x56f541 in _0x51f281[_0xdf65('0x52')]){if(_0x51f281[_0xdf65('0x52')][_0xdf65('0x4b')](_0x56f541)){var _0x3d12a2=_0x51f281[_0xdf65('0x52')][_0x56f541];var _0x36de61={'id':_0x3d12a2['id'],'available':_0x3d12a2[_0xdf65('0x53')],'loggedIn':_0x3d12a2['loggedIn'],'name':_0x3d12a2[_0xdf65('0x54')],'paused':_0x3d12a2[_0xdf65('0x55')],'waiting':_0x3d12a2[_0xdf65('0x56')]};_0x256294['push'](_0x36de61);}}_0x605fa9({'count':_0x256294[_0xdf65('0x19')],'rows':_0x256294});});},'MailQueues':function(){return new Promise(function(_0xaac728){var _0x58f0e4=[];for(var _0x55c211 in _0x51f281['mailQueues']){if(_0x51f281['mailQueues']['hasOwnProperty'](_0x55c211)){var _0x2f1a65=_0x51f281[_0xdf65('0x57')][_0x55c211];var _0x3a7e96={'id':_0x2f1a65['id'],'available':_0x2f1a65['available'],'loggedIn':_0x2f1a65[_0xdf65('0x58')],'name':_0x2f1a65[_0xdf65('0x54')],'paused':_0x2f1a65['paused'],'waiting':_0x2f1a65[_0xdf65('0x56')]};_0x58f0e4[_0xdf65('0x20')](_0x3a7e96);}}_0xaac728({'count':_0x58f0e4[_0xdf65('0x19')],'rows':_0x58f0e4});});},'OpenchannelQueues':function(){return new Promise(function(_0xb0ee4c){var _0x4980e8=[];for(var _0x596cab in _0x51f281['openchannelQueues']){if(_0x51f281[_0xdf65('0x59')][_0xdf65('0x4b')](_0x596cab)){var _0x2b6603=_0x51f281[_0xdf65('0x59')][_0x596cab];var _0x140526={'id':_0x2b6603['id'],'available':_0x2b6603[_0xdf65('0x53')],'loggedIn':_0x2b6603['loggedIn'],'name':_0x2b6603[_0xdf65('0x54')],'paused':_0x2b6603[_0xdf65('0x55')],'waiting':_0x2b6603[_0xdf65('0x56')]};_0x4980e8[_0xdf65('0x20')](_0x140526);}}_0xb0ee4c({'count':_0x4980e8['length'],'rows':_0x4980e8});});},'SmsQueues':function(){return new Promise(function(_0x4da996){var _0x1d9619=[];for(var _0x447947 in _0x51f281['smsQueues']){if(_0x51f281[_0xdf65('0x5a')]['hasOwnProperty'](_0x447947)){var _0x44bad2=_0x51f281['smsQueues'][_0x447947];var _0x4b0eec={'id':_0x44bad2['id'],'available':_0x44bad2[_0xdf65('0x53')],'loggedIn':_0x44bad2['loggedIn'],'name':_0x44bad2[_0xdf65('0x54')],'paused':_0x44bad2[_0xdf65('0x55')],'waiting':_0x44bad2[_0xdf65('0x56')]};_0x1d9619[_0xdf65('0x20')](_0x4b0eec);}}_0x4da996({'count':_0x1d9619[_0xdf65('0x19')],'rows':_0x1d9619});});},'FaxQueues':function(){return new Promise(function(_0x2dea75){var _0x42641c=[];for(var _0x6e6892 in _0x51f281[_0xdf65('0x5b')]){if(_0x51f281[_0xdf65('0x5b')]['hasOwnProperty'](_0x6e6892)){var _0x1de471=_0x51f281[_0xdf65('0x5b')][_0x6e6892];var _0x138fa7={'id':_0x1de471['id'],'available':_0x1de471['available'],'loggedIn':_0x1de471[_0xdf65('0x58')],'name':_0x1de471[_0xdf65('0x54')],'paused':_0x1de471[_0xdf65('0x55')],'waiting':_0x1de471[_0xdf65('0x56')]};_0x42641c[_0xdf65('0x20')](_0x138fa7);}}_0x2dea75({'count':_0x42641c[_0xdf65('0x19')],'rows':_0x42641c});});},'WhatsappQueues':function(){return new Promise(function(_0x36675e){var _0x1c8d90=[];for(var _0xc993e1 in _0x51f281[_0xdf65('0x5c')]){if(_0x51f281[_0xdf65('0x5c')]['hasOwnProperty'](_0xc993e1)){var _0x437a00=_0x51f281['whatsappQueues'][_0xc993e1];var _0x315b13={'id':_0x437a00['id'],'available':_0x437a00[_0xdf65('0x53')],'loggedIn':_0x437a00[_0xdf65('0x58')],'name':_0x437a00[_0xdf65('0x54')],'paused':_0x437a00[_0xdf65('0x55')],'waiting':_0x437a00[_0xdf65('0x56')]};_0x1c8d90[_0xdf65('0x20')](_0x315b13);}}_0x36675e({'count':_0x1c8d90[_0xdf65('0x19')],'rows':_0x1c8d90});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x454cc6){var _0x254b90=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x5d')]);_0x454cc6({'count':_0x254b90[_0xdf65('0x19')],'rows':_0x254b90});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1138b2){var _0x55ee5b=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x5e')]);_0x1138b2({'count':_0x55ee5b[_0xdf65('0x19')],'rows':_0x55ee5b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2e885a){var _0xc87c7=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x5f')]);_0x2e885a({'count':_0xc87c7[_0xdf65('0x19')],'rows':_0xc87c7});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x414710){var _0x457568=_[_0xdf65('0x50')](_0x51f281['smsQueuesWaitingInteractions']);_0x414710({'count':_0x457568[_0xdf65('0x19')],'rows':_0x457568});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4718a6){var _0x298669=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x60')]);_0x4718a6({'count':_0x298669[_0xdf65('0x19')],'rows':_0x298669});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xe8f273){var _0x2c6923=_[_0xdf65('0x50')](_0x51f281[_0xdf65('0x61')]);_0xe8f273({'count':_0x2c6923['length'],'rows':_0x2c6923});});}};var _0x142fd2=jayson['server'](_0x110170)[_0xdf65('0x62')]();_0x142fd2['on']('error',function(_0x497d19){logger['error'](JSON[_0xdf65('0x38')](_0x497d19));return _0x26868c(_0x497d19);});_0x142fd2[_0xdf65('0x11')](0x232c,_0xdf65('0x63'),function(){console['log'](_0xdf65('0x64'),0x232c);return _0x5a0ae1(_0xdf65('0x65')+0x232c);});});}; \ No newline at end of file +var _0x96f2=['length','existsSync','join','.js','app','push','slice','appdata','split','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','execute','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','isArray','applications'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x96f2,0xb0));var _0x296f=function(_0x378549,_0x263305){_0x378549=_0x378549-0x0;var _0x2c4e75=_0x96f2[_0x378549];return _0x2c4e75;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var fs=require('fs');var jayson=require(_0x296f('0x2'));var BPromise=require(_0x296f('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x296f('0x4'));var logger=require(_0x296f('0x5'))(_0x296f('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x296f('0x7')),'chatQueueReport':require(_0x296f('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x296f('0x9'))};var RuleEngine=require(_0x296f('0xa'));function getId(_0x2dc0ca,_0x28f708,_0x30ed43){return util[_0x296f('0xb')](_0x296f('0xc'),_0x2dc0ca,_0x28f708||0x0,_0x30ed43||0x0);}function getIntervals(_0x3ea699,_0x2f81ac){var _0x3729ab=[];if(!_['isNil'](_0x2f81ac[_0x296f('0xd')])&&!_[_0x296f('0xe')](_0x3ea699[_0x2f81ac[_0x296f('0xd')]])&&!_['isNil'](_0x3ea699[_0x2f81ac[_0x296f('0xd')]][_0x296f('0xf')])){_0x3729ab=_[_0x296f('0x10')](_0x3ea699[_0x2f81ac[_0x296f('0xd')]]['Intervals'],'interval');}else if(!_['isNil'](_0x2f81ac[_0x296f('0x11')])){_0x3729ab=[_0x2f81ac[_0x296f('0x11')]];}return _0x3729ab;}exports[_0x296f('0x12')]=function(_0xe843fc){_0xe843fc['rules']={};return new BPromise(function(_0xac5d0,_0x496675){var _0x4e0b88={'Start':function(_0x367e03){var _0x2ae0f4=this;return new Promise(function(_0x33654c,_0xa3d57a){if(_0x367e03){try{var _0x4cfa9a=[];var _0x4a2aaa=getId(_0x367e03[_0x296f('0x13')],_0x367e03['message']?_0x367e03[_0x296f('0x14')]['id']:0x0,_0x367e03[_0x296f('0x15')]?_0x367e03[_0x296f('0x15')]['id']:0x0);var _0x48725e=sUtils[_0x296f('0x16')](_0xe843fc,_0x367e03);if(_0x367e03[_0x296f('0x17')]||!_0x48725e&&_0x367e03['applications']&&_[_0x296f('0x18')](_0x367e03[_0x296f('0x19')])&&_0x367e03[_0x296f('0x19')][_0x296f('0x1a')]){for(var _0x5cedbc=0x0;_0x5cedbc<_0x367e03[_0x296f('0x19')][_0x296f('0x1a')];_0x5cedbc+=0x1){var _0x54f5d8=_0x367e03['applications'][_0x5cedbc];if(fs[_0x296f('0x1b')](path[_0x296f('0x1c')](__dirname,_0x296f('0x19'),_0x54f5d8['app']+_0x296f('0x1d')))){var _0x108c9b=[];switch(_0x54f5d8[_0x296f('0x1e')]['toLowerCase']()){case'autoreply':var _0x12abfb=_0x54f5d8['appdata']['split'](',');if(_0x367e03[_0x296f('0x13')]==='mail'){_0x108c9b['push'](_0x12abfb[0x0]);_0x108c9b['push'](_0x12abfb[0x1]);_0x108c9b[_0x296f('0x1f')](_0x12abfb[_0x296f('0x20')](0x2,_0x12abfb[_0x296f('0x1a')])[_0x296f('0x1c')](','));}else{_0x108c9b[_0x296f('0x1f')](_0x12abfb[0x0]);_0x108c9b[_0x296f('0x1f')](_0x12abfb['slice'](0x1,_0x12abfb['length'])[_0x296f('0x1c')](','));}break;case'dialogflow':var _0xc47d1f=_0x54f5d8[_0x296f('0x21')][_0x296f('0x22')](',');_0x108c9b[_0x296f('0x1f')](_0xc47d1f[0x0]);_0x108c9b[_0x296f('0x1f')](_0xc47d1f[0x1]);_0x108c9b[_0x296f('0x1f')](_0xc47d1f['slice'](0x2,_0xc47d1f[_0x296f('0x1a')])['join'](','));break;case _0x296f('0x23'):var _0x288c3e=_0x54f5d8[_0x296f('0x21')][_0x296f('0x22')](',');_0x108c9b[_0x296f('0x1f')](_0x288c3e[0x0]);_0x108c9b[_0x296f('0x1f')](_0x288c3e[0x1]);_0x108c9b[_0x296f('0x1f')](_0x288c3e[0x2]);_0x108c9b[_0x296f('0x1f')](_0x288c3e[0x3]);_0x108c9b[_0x296f('0x1f')](_0x288c3e[_0x296f('0x20')](0x4,_0x288c3e[_0x296f('0x1a')])[_0x296f('0x1c')](','));break;case _0x296f('0x24'):var _0x54bab2=_0x54f5d8[_0x296f('0x21')][_0x296f('0x22')](',');_0x108c9b[_0x296f('0x1f')](_0x54bab2[0x0]);_0x108c9b[_0x296f('0x1f')](_0x54bab2[0x1]);_0x108c9b['push'](_0x54bab2[0x2]);_0x108c9b['push'](_0x54bab2[0x3]);_0x108c9b['push'](_0x54bab2[_0x296f('0x20')](0x4,_0x54bab2[_0x296f('0x1a')])['join'](','));break;case _0x296f('0x14'):_0x108c9b[_0x296f('0x1f')](_0x54f5d8['appdata']);break;case'tag':_0x108c9b[_0x296f('0x1f')](_0x54f5d8[_0x296f('0x25')]);_0x108c9b['push'](_0x54f5d8[_0x296f('0x21')]);break;case _0x296f('0x26'):var _0x1f57de=utils[_0x296f('0x27')](_0x367e03[_0x296f('0x28')][_0x296f('0x29')],_0x367e03);var _0x532ed1=_0x54f5d8['appdata']['split'](',');_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x0]);_0x108c9b['push'](_0x532ed1[0x1]);_0x108c9b['push'](_0x532ed1[0x2]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x3]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x4]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x5]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x6]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x7]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x8]);_0x108c9b[_0x296f('0x1f')](_0x532ed1[0x9]);_0x108c9b['push'](_0x532ed1[0xa]);_0x108c9b[_0x296f('0x1f')](_0x367e03[_0x296f('0x15')]['id']);_0x108c9b[_0x296f('0x1f')](_0x367e03[_0x296f('0x14')]['id']);_0x108c9b[_0x296f('0x1f')](_0x54f5d8[_0x296f('0x2a')]);_0x108c9b[_0x296f('0x1f')](_0x367e03[_0x296f('0x15')]['ContactId']);_0x108c9b[_0x296f('0x1f')](_0x367e03[_0x296f('0x2b')]['body']);_0x108c9b[_0x296f('0x1f')](_0x1f57de);break;default:_0x108c9b=_[_0x296f('0xe')](_0x54f5d8['appdata'])?[]:_0x54f5d8['appdata'][_0x296f('0x22')](',');}var _0x150f29={'id':util[_0x296f('0xb')](_0x296f('0x2c'),_0x4a2aaa,_0x54f5d8['id'],_0x54f5d8[_0x296f('0x1e')]),'condition':require(_0x296f('0x2d'))[_0x296f('0x2e')](_0x4a2aaa,getIntervals(_0xe843fc[_0x296f('0x2f')],_0x54f5d8),_0xe843fc),'consequence':require(_0x296f('0x30')+_0x54f5d8['app'])[_0x296f('0x31')](_0x4a2aaa,_0x108c9b,_0xe843fc,_0x367e03),'p':_0x54f5d8['priority']||0x0};logger[_0x296f('0x32')](_0x296f('0x33'),_0x150f29['id'],_0x296f('0x34'),getIntervals(_0xe843fc[_0x296f('0x2f')],_0x54f5d8)['join'](_0x296f('0x35')));_0x4cfa9a['push'](_0x150f29);}else{logger[_0x296f('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x54f5d8[_0x296f('0x1e')]+_0x296f('0x1d')));}}_0xe843fc[_0x296f('0x37')][_0x4a2aaa]=new RuleEngine(_0x4cfa9a);_0xe843fc[_0x296f('0x37')][_0x4a2aaa][_0x296f('0x38')](_0x367e03,function(_0x2e962e){logger[_0x296f('0x32')]('Applications\x20executed',JSON['stringify'](_0x2e962e[_0x296f('0x39')]));if(_0xe843fc['rules'][_0x4a2aaa]){_0xe843fc[_0x296f('0x37')][_0x4a2aaa][_0x296f('0x3a')](_0x296f('0x3b'));}});return _0x33654c({'code':0xc8,'message':_0x367e03});}else{if(_0x48725e){logger[_0x296f('0x32')](util[_0x296f('0xb')](_0x296f('0x3c'),_0x4a2aaa));}else{logger[_0x296f('0x32')](_0x296f('0x3d'));}return _0x33654c({'code':0xc8,'message':_0x367e03});}}catch(_0x58b308){logger['error'](_0x58b308[_0x296f('0x3e')]);return _0xa3d57a(_0x2ae0f4[_0x296f('0x36')](0x1f4,_0x58b308));}}return _0xa3d57a(_0x296f('0x3f'));});},'AcceptMessage':function(_0x420e0c){var _0x4c96fb=this;return new Promise(function(_0xc4724f,_0x4ccd43){if(_0x420e0c['agent']&&_0x420e0c[_0x296f('0x40')]['id']){if(_0xe843fc[_0x296f('0x41')][_0x420e0c['agent']['id']]){_0xe843fc['agents'][_0x420e0c[_0x296f('0x40')]['id']][_0x296f('0x42')]=![];_0xe843fc['agents'][_0x420e0c[_0x296f('0x40')]['id']]['busyQueue']=undefined;}}if(_0x420e0c['message']&&_0x420e0c['message']['id']){try{var _0x164a60=getId(_0x420e0c[_0x296f('0x13')],_0x420e0c[_0x296f('0x14')]?_0x420e0c['message']['id']:0x0,_0x420e0c[_0x296f('0x15')]?_0x420e0c[_0x296f('0x15')]['id']:0x0);if(_0xe843fc[_0x296f('0x37')][_0x164a60]){_0xe843fc['rules'][_0x164a60][_0x296f('0x3a')](_0x296f('0x43'));if(rpc[_0x420e0c['channel']+_0x296f('0x44')]){rpc[_0x420e0c[_0x296f('0x13')]+'QueueReport'][_0x296f('0x45')](_0x164a60,{'UserId':_0x420e0c['message']['UserId']})['catch'](function(){logger[_0x296f('0x36')](_0x296f('0x46'));});}}return _0xc4724f({'code':0xc8,'message':_0x420e0c});}catch(_0x561407){logger[_0x296f('0x36')](_0x561407[_0x296f('0x3e')]);return _0x4ccd43(_0x4c96fb[_0x296f('0x36')](0x1f4,_0x561407));}}logger[_0x296f('0x36')]('message\x20is\x20empty');return _0x4ccd43(_0x4c96fb['error'](0x1f4,_0x296f('0x47')));});},'RejectMessage':function(_0x5425bc){var _0x164bb2=this;return new Promise(function(_0x1c7c26,_0x4f2c16){if(_0x5425bc[_0x296f('0x40')]&&_0x5425bc[_0x296f('0x40')]['id']){try{if(_0xe843fc[_0x296f('0x41')][_0x5425bc['agent']['id']]){_0xe843fc[_0x296f('0x41')][_0x5425bc[_0x296f('0x40')]['id']][_0x296f('0x42')]=![];_0xe843fc[_0x296f('0x41')][_0x5425bc[_0x296f('0x40')]['id']][_0x296f('0x48')]=undefined;}return _0x1c7c26({'code':0xc8,'message':_0x5425bc});}catch(_0x4787fb){logger[_0x296f('0x36')](_0x4787fb['stack']);return _0x4f2c16(_0x164bb2[_0x296f('0x36')](0x1f4,_0x4787fb));}}logger[_0x296f('0x36')](_0x296f('0x47'));return _0x4f2c16(_0x164bb2[_0x296f('0x36')](0x1f4,_0x296f('0x47')));});},'AbandonInteraction':function(_0x373b9c){var _0x301ba7=this;return new Promise(function(_0x5621ad,_0x34357a){if(_0x373b9c[_0x296f('0x13')]&&_0x373b9c['interaction']&&_0x373b9c[_0x296f('0x15')]['id']){try{var _0x426e08=getId(_0x373b9c['channel'],_0x373b9c[_0x296f('0x14')]?_0x373b9c[_0x296f('0x14')]['id']:0x0,_0x373b9c[_0x296f('0x15')]?_0x373b9c['interaction']['id']:0x0);if(_0xe843fc[_0x296f('0x37')][_0x426e08]){_0xe843fc[_0x296f('0x37')][_0x426e08][_0x296f('0x3a')](_0x296f('0x43'));}return _0x5621ad({'code':0xc8,'message':_0x373b9c});}catch(_0x4a7203){logger[_0x296f('0x36')](_0x4a7203[_0x296f('0x3e')]);return _0x34357a(_0x301ba7['error'](0x1f4,_0x4a7203));}}logger[_0x296f('0x36')](_0x296f('0x47'));return _0x34357a(_0x301ba7[_0x296f('0x36')](0x1f4,_0x296f('0x47')));});},'AgentCapacity':function(_0x7c088){var _0x269de9=this;return new Promise(function(_0x2a8444,_0x14c324){if(_0xe843fc[_0x296f('0x41')][_0x296f('0x49')](_0x7c088['id'])){for(var _0x56b59d in _0x7c088[_0x296f('0x4a')]){if(_0x7c088['capacity'][_0x296f('0x49')](_0x56b59d)){if(_0xe843fc[_0x296f('0x41')][_0x7c088['id']][_0x296f('0x49')](_0x56b59d+_0x296f('0x4b'))){_0xe843fc[_0x296f('0x41')][_0x7c088['id']][_0x56b59d+'CurrentCapacity']=parseInt(_0x7c088['capacity'][_0x56b59d],0xa);}}}_0xe843fc[_0x296f('0x41')][_0x7c088['id']][_0x296f('0x4c')]();return _0x2a8444({'code':0xc8,'message':_0xe843fc['agents'][_0x7c088['id']]});}else{return _0x14c324(_0x269de9[_0x296f('0x36')](0x1f4,_0x296f('0x4d')));}});},'Agents':function(_0x46a4c6){return new Promise(function(_0x50a96a){var _0x1e3fe4=_['values'](_0xe843fc[_0x296f('0x41')]);if(_0x46a4c6&&_0x46a4c6['id']){var _0x13702f=_['find'](_0x1e3fe4,function(_0x12063a){return _0x12063a['id']===_0x46a4c6['id'];});_0x50a96a(_0x13702f);}else{_0x50a96a({'count':_0x1e3fe4['length'],'rows':_0x1e3fe4});}});},'ChatQueues':function(){return new Promise(function(_0x483a6e){var _0xa63a05=[];for(var _0x317bf3 in _0xe843fc['chatQueues']){if(_0xe843fc[_0x296f('0x4e')][_0x296f('0x49')](_0x317bf3)){var _0x22b98a=_0xe843fc[_0x296f('0x4e')][_0x317bf3];var _0x947ec={'id':_0x22b98a['id'],'available':_0x22b98a[_0x296f('0x4f')],'loggedIn':_0x22b98a[_0x296f('0x50')],'name':_0x22b98a[_0x296f('0x51')],'paused':_0x22b98a[_0x296f('0x52')],'waiting':_0x22b98a[_0x296f('0x53')]};_0xa63a05[_0x296f('0x1f')](_0x947ec);}}_0x483a6e({'count':_0xa63a05[_0x296f('0x1a')],'rows':_0xa63a05});});},'MailQueues':function(){return new Promise(function(_0x509a83){var _0x40ce8e=[];for(var _0x5fa47e in _0xe843fc[_0x296f('0x54')]){if(_0xe843fc[_0x296f('0x54')][_0x296f('0x49')](_0x5fa47e)){var _0x14482a=_0xe843fc['mailQueues'][_0x5fa47e];var _0x572189={'id':_0x14482a['id'],'available':_0x14482a[_0x296f('0x4f')],'loggedIn':_0x14482a[_0x296f('0x50')],'name':_0x14482a['name'],'paused':_0x14482a['paused'],'waiting':_0x14482a[_0x296f('0x53')]};_0x40ce8e[_0x296f('0x1f')](_0x572189);}}_0x509a83({'count':_0x40ce8e[_0x296f('0x1a')],'rows':_0x40ce8e});});},'OpenchannelQueues':function(){return new Promise(function(_0x35b5a5){var _0x476b9d=[];for(var _0x597a85 in _0xe843fc[_0x296f('0x55')]){if(_0xe843fc[_0x296f('0x55')][_0x296f('0x49')](_0x597a85)){var _0x3eb46e=_0xe843fc['openchannelQueues'][_0x597a85];var _0x142155={'id':_0x3eb46e['id'],'available':_0x3eb46e[_0x296f('0x4f')],'loggedIn':_0x3eb46e['loggedIn'],'name':_0x3eb46e[_0x296f('0x51')],'paused':_0x3eb46e[_0x296f('0x52')],'waiting':_0x3eb46e[_0x296f('0x53')]};_0x476b9d[_0x296f('0x1f')](_0x142155);}}_0x35b5a5({'count':_0x476b9d[_0x296f('0x1a')],'rows':_0x476b9d});});},'SmsQueues':function(){return new Promise(function(_0x5a1996){var _0x1b9a8c=[];for(var _0x137b1d in _0xe843fc['smsQueues']){if(_0xe843fc[_0x296f('0x56')][_0x296f('0x49')](_0x137b1d)){var _0x203ee7=_0xe843fc[_0x296f('0x56')][_0x137b1d];var _0x5e766f={'id':_0x203ee7['id'],'available':_0x203ee7[_0x296f('0x4f')],'loggedIn':_0x203ee7[_0x296f('0x50')],'name':_0x203ee7[_0x296f('0x51')],'paused':_0x203ee7[_0x296f('0x52')],'waiting':_0x203ee7['waiting']};_0x1b9a8c['push'](_0x5e766f);}}_0x5a1996({'count':_0x1b9a8c[_0x296f('0x1a')],'rows':_0x1b9a8c});});},'FaxQueues':function(){return new Promise(function(_0x2def58){var _0x3a803d=[];for(var _0x42c9be in _0xe843fc[_0x296f('0x57')]){if(_0xe843fc[_0x296f('0x57')][_0x296f('0x49')](_0x42c9be)){var _0x45f7a1=_0xe843fc[_0x296f('0x57')][_0x42c9be];var _0x5478e7={'id':_0x45f7a1['id'],'available':_0x45f7a1[_0x296f('0x4f')],'loggedIn':_0x45f7a1[_0x296f('0x50')],'name':_0x45f7a1['name'],'paused':_0x45f7a1[_0x296f('0x52')],'waiting':_0x45f7a1[_0x296f('0x53')]};_0x3a803d[_0x296f('0x1f')](_0x5478e7);}}_0x2def58({'count':_0x3a803d[_0x296f('0x1a')],'rows':_0x3a803d});});},'WhatsappQueues':function(){return new Promise(function(_0x518949){var _0x4c7e03=[];for(var _0x48a0d3 in _0xe843fc[_0x296f('0x58')]){if(_0xe843fc['whatsappQueues'][_0x296f('0x49')](_0x48a0d3)){var _0xc058b1=_0xe843fc[_0x296f('0x58')][_0x48a0d3];var _0x365c41={'id':_0xc058b1['id'],'available':_0xc058b1[_0x296f('0x4f')],'loggedIn':_0xc058b1[_0x296f('0x50')],'name':_0xc058b1[_0x296f('0x51')],'paused':_0xc058b1[_0x296f('0x52')],'waiting':_0xc058b1[_0x296f('0x53')]};_0x4c7e03[_0x296f('0x1f')](_0x365c41);}}_0x518949({'count':_0x4c7e03[_0x296f('0x1a')],'rows':_0x4c7e03});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4315ea){var _0x30a5af=_[_0x296f('0x59')](_0xe843fc[_0x296f('0x5a')]);_0x4315ea({'count':_0x30a5af[_0x296f('0x1a')],'rows':_0x30a5af});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x17e899){var _0x2f8da4=_[_0x296f('0x59')](_0xe843fc[_0x296f('0x5b')]);_0x17e899({'count':_0x2f8da4[_0x296f('0x1a')],'rows':_0x2f8da4});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x39cab0){var _0x5bb2d1=_['values'](_0xe843fc['openchannelQueuesWaitingInteractions']);_0x39cab0({'count':_0x5bb2d1[_0x296f('0x1a')],'rows':_0x5bb2d1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x37a721){var _0xdf7dba=_[_0x296f('0x59')](_0xe843fc[_0x296f('0x5c')]);_0x37a721({'count':_0xdf7dba[_0x296f('0x1a')],'rows':_0xdf7dba});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x575b16){var _0x1ca525=_[_0x296f('0x59')](_0xe843fc[_0x296f('0x5d')]);_0x575b16({'count':_0x1ca525['length'],'rows':_0x1ca525});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4eb94f){var _0x2a63e1=_[_0x296f('0x59')](_0xe843fc[_0x296f('0x5e')]);_0x4eb94f({'count':_0x2a63e1[_0x296f('0x1a')],'rows':_0x2a63e1});});}};var _0x5e21e4=jayson[_0x296f('0x5f')](_0x4e0b88)['http']();_0x5e21e4['on'](_0x296f('0x36'),function(_0x4e8586){logger[_0x296f('0x36')](JSON[_0x296f('0x60')](_0x4e8586));return _0x496675(_0x4e8586);});_0x5e21e4[_0x296f('0x12')](0x232c,_0x296f('0x61'),function(){console[_0x296f('0x62')](_0x296f('0x63'),0x232c);return _0xac5d0(_0x296f('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 41b4dc4..7c24f94 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 _0x0833=['catch','stack','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x1311e5,_0x3ec7c1){var _0x5e6d41=function(_0x3f0b93){while(--_0x3f0b93){_0x1311e5['push'](_0x1311e5['shift']());}};_0x5e6d41(++_0x3ec7c1);}(_0x0833,0x98));var _0x3083=function(_0x4eb236,_0x2c28a3){_0x4eb236=_0x4eb236-0x0;var _0x26be12=_0x0833[_0x4eb236];return _0x26be12;};'use strict';var util=require('util');var BPromise=require(_0x3083('0x0'));var jayson=require('jayson/promise');var _=require(_0x3083('0x1'));var logger=require(_0x3083('0x2'))(_0x3083('0x3'));var client=jayson[_0x3083('0x4')][_0x3083('0x5')]({'port':0x232a});function request(_0x45d55f,_0x3bc05e){return new BPromise(function(_0x2bccfc,_0x704f19){return client[_0x3083('0x6')](_0x45d55f,_0x3bc05e)[_0x3083('0x7')](function(_0x3a6386){if(_0x3a6386[_0x3083('0x8')]){return _0x704f19(_0x3a6386[_0x3083('0x8')][_0x3083('0x9')]);}else{return _0x2bccfc(_0x3a6386[_0x3083('0xa')]);}})['catch'](function(_0x9636b3){return _0x704f19(_0x9636b3);});});}exports[_0x3083('0xb')]=function(_0x4c90ec,_0x5179ac,_0x58a753){return function(_0x483591){if(_0x58a753['rules']&&!_0x58a753[_0x3083('0xc')][_0x4c90ec]){logger['info'](_0x3083('0xd'),_0x4c90ec);return _0x483591[_0x3083('0xe')]();}var _0x4242d5=[];for(var _0x32fd3e=0x0;_0x32fd3e<_0x5179ac['length'];_0x32fd3e+=0x1){_0x4242d5[_0x3083('0xf')](request(_0x3083('0x10'),{'command':util[_0x3083('0x11')](_0x3083('0x12'),_0x5179ac[_0x32fd3e])})[_0x3083('0x7')](function(_0x448666){return _0x448666&&_0x448666[_0x3083('0x9')]&&_0x448666[_0x3083('0x9')][_0x3083('0x13')]('true')>=0x0?!![]:![];})['catch'](function(){logger[_0x3083('0x8')](_0x3083('0x14'),_0x4c90ec,_0x5179ac[_0x32fd3e]);}));}BPromise[_0x3083('0x15')](_0x4242d5)[_0x3083('0x7')](function(_0x46773e){var _0x20dcb1=_[_0x3083('0x16')](_0x46773e);logger[_0x3083('0x17')](_0x3083('0x18'),_0x4c90ec,_0x5179ac[_0x3083('0x19')](_0x3083('0x1a')),_0x20dcb1);_0x483591[_0x3083('0x1b')](_0x20dcb1);})[_0x3083('0x1c')](function(_0x1a2e81){logger[_0x3083('0x8')](_0x3083('0x18'),_0x4c90ec,_0x5179ac[_0x3083('0x19')](_0x3083('0x1a')),_0x1a2e81[_0x3083('0x1d')]);_0x483591[_0x3083('0xe')]();});};}; \ No newline at end of file +var _0xcf63=['client','http','request','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','util','bluebird','jayson/promise','../../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcf63,0x8d));var _0x3cf6=function(_0x24571d,_0x3bd61b){_0x24571d=_0x24571d-0x0;var _0x57de25=_0xcf63[_0x24571d];return _0x57de25;};'use strict';var util=require(_0x3cf6('0x0'));var BPromise=require(_0x3cf6('0x1'));var jayson=require(_0x3cf6('0x2'));var _=require('lodash');var logger=require(_0x3cf6('0x3'))('routing');var client=jayson[_0x3cf6('0x4')][_0x3cf6('0x5')]({'port':0x232a});function request(_0x1c9e39,_0x2c35cd){return new BPromise(function(_0x3263e8,_0x317139){return client[_0x3cf6('0x6')](_0x1c9e39,_0x2c35cd)[_0x3cf6('0x7')](function(_0x497ec8){if(_0x497ec8['error']){return _0x317139(_0x497ec8[_0x3cf6('0x8')][_0x3cf6('0x9')]);}else{return _0x3263e8(_0x497ec8[_0x3cf6('0xa')]);}})[_0x3cf6('0xb')](function(_0x178be4){return _0x317139(_0x178be4);});});}exports[_0x3cf6('0xc')]=function(_0x1d5c67,_0x5864ff,_0x50a0bd){return function(_0x4db520){if(_0x50a0bd['rules']&&!_0x50a0bd['rules'][_0x1d5c67]){logger[_0x3cf6('0xd')](_0x3cf6('0xe'),_0x1d5c67);return _0x4db520[_0x3cf6('0xf')]();}var _0x5a483a=[];for(var _0xdc3605=0x0;_0xdc3605<_0x5864ff[_0x3cf6('0x10')];_0xdc3605+=0x1){_0x5a483a[_0x3cf6('0x11')](request('Command',{'command':util[_0x3cf6('0x12')](_0x3cf6('0x13'),_0x5864ff[_0xdc3605])})[_0x3cf6('0x7')](function(_0x130bcf){return _0x130bcf&&_0x130bcf[_0x3cf6('0x9')]&&_0x130bcf[_0x3cf6('0x9')][_0x3cf6('0x14')](_0x3cf6('0x15'))>=0x0?!![]:![];})[_0x3cf6('0xb')](function(){logger[_0x3cf6('0x8')](_0x3cf6('0x16'),_0x1d5c67,_0x5864ff[_0xdc3605]);}));}BPromise[_0x3cf6('0x17')](_0x5a483a)['then'](function(_0x496411){var _0x519423=_[_0x3cf6('0x18')](_0x496411);logger[_0x3cf6('0xd')](_0x3cf6('0x19'),_0x1d5c67,_0x5864ff[_0x3cf6('0x1a')]('\x20|\x20'),_0x519423);_0x4db520[_0x3cf6('0x1b')](_0x519423);})[_0x3cf6('0xb')](function(_0x123fd5){logger[_0x3cf6('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x1d5c67,_0x5864ff[_0x3cf6('0x1a')](_0x3cf6('0x1c')),_0x123fd5['stack']);_0x4db520['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d240f8a..a93b2fb 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 _0x750a=['interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%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','connectedlinename','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x750a,0x140));var _0xa750=function(_0x4d75b8,_0x1cf0e0){_0x4d75b8=_0x4d75b8-0x0;var _0x485e55=_0x750a[_0x4d75b8];return _0x485e55;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x499583,_0x139fa5){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x3'),_0x499583[_0xa750('0x4')],_0x499583[_0xa750('0x5')],_0x499583[_0xa750('0x6')],_0x499583[_0xa750('0x7')],_0x499583[_0xa750('0x8')],_0x499583[_0xa750('0x9')],_0x499583[_0xa750('0xa')],_0x499583[_0xa750('0xb')]));if(_0x499583[_0xa750('0x6')]){utils['getVoiceQueueByName'](_0x499583['queue'])[_0xa750('0xc')](function(_0x5b684e){if(_0x5b684e){_0x499583[_0xa750('0xd')]=_0x5b684e[_0xa750('0xd')];_0x499583['agentacw']=_0x499583[_0xa750('0xe')]?_0x5b684e[_0xa750('0xf')]:![];_0x499583['acwtime']=_0x499583['agentacw']?_0x5b684e[_0xa750('0x10')]:0x0;}utils['request'](_0xa750('0x11'),_0x499583);});}else{utils[_0xa750('0x12')]('CreateVoiceAgentReport',_0x499583);}if(_0x139fa5){delete transfers[_0x499583[_0xa750('0x4')]];}else{delete agents[_0x499583[_0xa750('0x13')]];}}exports[_0xa750('0x14')]=function(_0x567c51){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x16'),_0x567c51[_0xa750('0x4')]),_0x567c51);agents[_0x567c51[_0xa750('0x13')]]=_0x567c51;agents[_0x567c51[_0xa750('0x13')]]['agentcalledAt']=utils[_0xa750('0x17')]();agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xb')]='called';agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xa')]=null;agents[_0x567c51['destuniqueid']]['connectedlinename']=null;utils[_0xa750('0x1')](util['format'](_0xa750('0x18'),_0x567c51[_0xa750('0x4')],agents[_0x567c51['destuniqueid']][_0xa750('0x7')],_0x567c51['destuniqueid']));}catch(_0x5f28f4){utils[_0xa750('0x19')](util['format'](_0xa750('0x16'),_0x567c51['uniqueid']),_0x5f28f4);}};exports[_0xa750('0x1a')]=function(_0x4a007d){try{if(!_[_0xa750('0x1b')](agents[_0x4a007d['destuniqueid']])){utils[_0xa750('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x4a007d[_0xa750('0x4')]),_0x4a007d);utils['info'](util[_0xa750('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4a007d['uniqueid'],agents[_0x4a007d['destuniqueid']]['membername'],_0x4a007d[_0xa750('0x13')]));agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1a')]=!![];agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1c')]=utils[_0xa750('0x17')]();agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1e')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1f')]=_0x4a007d[_0xa750('0x20')]?parseInt(_0x4a007d['ringtime'])/0x3e8:0x0;agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x21')]=0x0;unanswered[_0xa750('0x22')](_0x4a007d['destuniqueid']);}}catch(_0x35ab53){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x23'),_0x4a007d['uniqueid']),_0x35ab53);}};exports[_0xa750('0x24')]=function(_0x34d5e9){try{_[_0xa750('0x25')](agents,function(_0x2aef3a,_0x2c5253){if(_0x2aef3a['uniqueid']==_0x34d5e9[_0xa750('0x4')]&&!_['includes'](unanswered,_0x2aef3a[_0xa750('0x13')])){utils[_0xa750('0x15')](util['format'](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x34d5e9);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x27'),_0x34d5e9[_0xa750('0x4')],_0x2aef3a[_0xa750('0x7')],_0x2aef3a[_0xa750('0x13')]));_0x2aef3a['agentringnoanswer']=!![];_0x2aef3a[_0xa750('0x1c')]=utils['now']();_0x2aef3a[_0xa750('0xb')]=_0xa750('0x28');_0x2aef3a[_0xa750('0x1e')]=_0xa750('0x28');_0x2aef3a['holdtime']=_0x34d5e9[_0xa750('0x1f')];_0x2aef3a[_0xa750('0x21')]=0x0;writeDB(_0x2aef3a);}});}catch(_0x5c2e02){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x5c2e02);}};exports['agentconnect']=function(_0xf60128){try{if(agents[_0xf60128['destuniqueid']]){utils['debug'](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0xf60128);utils['info'](util[_0xa750('0x2')](_0xa750('0x2a'),_0xf60128[_0xa750('0x4')],agents[_0xf60128['destuniqueid']][_0xa750('0x7')],_0xf60128[_0xa750('0x13')]));agents[_0xf60128[_0xa750('0x13')]]['agentconnectAt']=utils[_0xa750('0x17')]();agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xa')]=_0xf60128['connectedlinenum'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0x2b')]=_0xf60128[_0xa750('0x2b')];agents[_0xf60128[_0xa750('0x13')]]['holdtime']=_0xf60128['ringtime'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xb')]='connect';_[_0xa750('0x25')](agents,function(_0x2f57e9,_0x15d35a){if(_0x2f57e9[_0xa750('0x13')]!=_0xf60128[_0xa750('0x13')]&&_0x2f57e9['uniqueid']==_0xf60128[_0xa750('0x4')]){_0x2f57e9[_0xa750('0x21')]=0x0;_0x2f57e9[_0xa750('0x1f')]=_0xf60128[_0xa750('0x20')];_0x2f57e9[_0xa750('0x1a')]=!![];_0x2f57e9[_0xa750('0x1c')]=utils[_0xa750('0x17')]();_0x2f57e9['lastevent']=_0xa750('0x2c');_0x2f57e9['reason']=_0xa750('0x2c');_0x2f57e9['answeredelsewheredestinationuniqueid']=_0xf60128[_0xa750('0x13')];_0x2f57e9[_0xa750('0x2d')]=_0xf60128[_0xa750('0x7')];writeDB(_0x2f57e9);}});}}catch(_0x1be24e){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0x1be24e);}};exports[_0xa750('0xe')]=function(_0x108a1a){try{if(!_[_0xa750('0x1b')](agents[_0x108a1a[_0xa750('0x13')]])){utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x108a1a);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x2f'),_0x108a1a[_0xa750('0x4')],agents[_0x108a1a['destuniqueid']][_0xa750('0x7')],_0x108a1a[_0xa750('0x13')]));agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xe')]=!![];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')]=utils[_0xa750('0x17')]();agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x21')]=utils['diffTime'](agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')],agents[_0x108a1a['destuniqueid']][_0xa750('0x31')]);agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x1e')]=_0x108a1a[_0xa750('0x1e')];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x32');writeDB(agents[_0x108a1a[_0xa750('0x13')]]);}}catch(_0x3faf01){utils[_0xa750('0x19')](util['format'](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x3faf01);}};exports['blindtransfer']=function(_0x93e49f){try{if(!_[_0xa750('0x1b')](agents[_0x93e49f[_0xa750('0x33')]])){utils['debug'](util[_0xa750('0x2')](_0xa750('0x34'),_0x93e49f[_0xa750('0x4')]),_0x93e49f);utils[_0xa750('0x1')](util['format'](_0xa750('0x35'),_0x93e49f[_0xa750('0x4')],agents[_0x93e49f[_0xa750('0x33')]][_0xa750('0x7')],agents[_0x93e49f['transfereruniqueid']][_0xa750('0x4')]));agents[_0x93e49f[_0xa750('0x33')]]['transfer']=!![];agents[_0x93e49f[_0xa750('0x33')]]['transfertype']=_0xa750('0x36');agents[_0x93e49f[_0xa750('0x33')]]['transferexten']=_0x93e49f['extension'];agents[_0x93e49f['transfereruniqueid']][_0xa750('0x37')]=agents[_0x93e49f[_0xa750('0x33')]]['uniqueid'];}}catch(_0xe88dc){utils[_0xa750('0x19')](util[_0xa750('0x2')]('[%s][agents][blindtransfer]',_0x93e49f['uniqueid']),_0xe88dc);}};exports['attendedtransfer']=function(_0x5d8dd2){try{utils[_0xa750('0x15')](util['format'](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5d8dd2);if(_0x5d8dd2['origtransfereruniqueid']==_0x5d8dd2[_0xa750('0x3a')]){if(!_['isNil'](agents[_0x5d8dd2[_0xa750('0x3b')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d8dd2['origtransfereruniqueid'],agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x7')]));agents[_0x5d8dd2['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5d8dd2['secondtransfereruniqueid']][_0xa750('0x3c')]=_0xa750('0x3d');agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x3f')];agents[_0x5d8dd2[_0xa750('0x3b')]]['transferuniqueid']=_0x5d8dd2['origtransfereruniqueid'];}if(_0x5d8dd2[_0xa750('0x40')]&&agents[_0x5d8dd2[_0xa750('0x40')]]){agents[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2[_0xa750('0x40')]]=_['clone'](agents[_0x5d8dd2[_0xa750('0x40')]]);transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x3b')]]['calleridname'];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x31')]=utils['now']();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x2;}}else if(_0x5d8dd2[_0xa750('0x3b')]==_0x5d8dd2[_0xa750('0x44')]){if(!_[_0xa750('0x1b')](agents[_0x5d8dd2[_0xa750('0x39')]])){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x45'),_0x5d8dd2[_0xa750('0x39')],agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x7')]));agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x46')]=!![];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x3c')]='ATTENDED';agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x47')];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x37')]=_0x5d8dd2[_0xa750('0x3b')];}if(_0x5d8dd2[_0xa750('0x48')]&&agents[_0x5d8dd2[_0xa750('0x48')]]){agents[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2['transfertargetuniqueid']]=_[_0xa750('0x49')](agents[_0x5d8dd2[_0xa750('0x48')]]);transfers[_0x5d8dd2['transfertargetuniqueid']][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x42')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x2;}}}catch(_0x5e17a0){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5e17a0);}};exports[_0xa750('0x4a')]=function(_0x473188){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x4b'),_0x473188[_0xa750('0x4')]),_0x473188);if(agents[_0x473188[_0xa750('0x4')]]&&agents[_0x473188['uniqueid']]['reason']===_0xa750('0x1d')){if(_0x473188['cause']==='21'){agents[_0x473188['uniqueid']][_0xa750('0x1e')]=_0xa750('0x4c');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x4c');}utils['info'](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]]['reason'],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);var _0x30a371=unanswered[_0xa750('0x4e')](_0x473188[_0xa750('0x4')]);if(_0x30a371>-0x1){unanswered[_0xa750('0x4f')](_0x30a371,0x1);}}if(transfers[_0x473188[_0xa750('0x4')]]){transfers[_0x473188[_0xa750('0x4')]]['agentcomplete']=!![];transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt'],transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x31')]);transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')]='agent';transfers[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x32');utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],transfers[_0x473188[_0xa750('0x4')]]['membername'],transfers[_0x473188['uniqueid']][_0xa750('0x1e')],transfers[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(transfers[_0x473188[_0xa750('0x4')]],!![]);}if(agents[_0x473188['uniqueid']]&&agents[_0x473188[_0xa750('0x4')]]['agentconnectAt']){agents[_0x473188[_0xa750('0x4')]][_0xa750('0xe')]=!![];agents[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils[_0xa750('0x17')]();agents[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](agents[_0x473188['uniqueid']]['agentcompleteAt'],agents[_0x473188['uniqueid']][_0xa750('0x31')]);agents[_0x473188[_0xa750('0x4')]]['reason']=agents[_0x473188[_0xa750('0x4')]][_0xa750('0x46')]?_0xa750('0x46'):_0xa750('0x51');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]='complete';utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188['uniqueid'],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);}}catch(_0x32b8e7){utils['error'](util[_0xa750('0x2')]('[%s][agents][hangup]',_0x473188[_0xa750('0x4')]),_0x32b8e7);}}; \ No newline at end of file +var _0x5ec6=['connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agentcompleteAt','agent','lodash','util','./utils','format','uniqueid','queue','interface','calleridnum','lastevent','then','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]'];(function(_0x4d2258,_0x47083d){var _0x3a5163=function(_0x3ddce0){while(--_0x3ddce0){_0x4d2258['push'](_0x4d2258['shift']());}};_0x3a5163(++_0x47083d);}(_0x5ec6,0x7f));var _0x65ec=function(_0x291d6e,_0x56c25f){_0x291d6e=_0x291d6e-0x0;var _0x23af80=_0x5ec6[_0x291d6e];return _0x23af80;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var utils=require(_0x65ec('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5c0775,_0x1b924d){utils['info'](util[_0x65ec('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5c0775[_0x65ec('0x4')],_0x5c0775['channel'],_0x5c0775[_0x65ec('0x5')],_0x5c0775['membername'],_0x5c0775[_0x65ec('0x6')],_0x5c0775[_0x65ec('0x7')],_0x5c0775['connectedlinenum'],_0x5c0775[_0x65ec('0x8')]));if(_0x5c0775[_0x65ec('0x5')]){utils['getVoiceQueueByName'](_0x5c0775[_0x65ec('0x5')])[_0x65ec('0x9')](function(_0x300f83){if(_0x300f83){_0x5c0775['type']=_0x300f83['type'];_0x5c0775[_0x65ec('0xa')]=_0x5c0775['agentcomplete']?_0x300f83[_0x65ec('0xb')]:![];_0x5c0775[_0x65ec('0xc')]=_0x5c0775['agentacw']?_0x300f83[_0x65ec('0xd')]:0x0;}utils[_0x65ec('0xe')]('CreateVoiceAgentReport',_0x5c0775);});}else{utils[_0x65ec('0xe')](_0x65ec('0xf'),_0x5c0775);}if(_0x1b924d){delete transfers[_0x5c0775['uniqueid']];}else{delete agents[_0x5c0775[_0x65ec('0x10')]];}}exports[_0x65ec('0x11')]=function(_0x411a7b){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x411a7b);agents[_0x411a7b[_0x65ec('0x10')]]=_0x411a7b;agents[_0x411a7b['destuniqueid']][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();agents[_0x411a7b[_0x65ec('0x10')]]['lastevent']='called';agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x16')]=null;agents[_0x411a7b[_0x65ec('0x10')]]['connectedlinename']=null;utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x18'),_0x411a7b[_0x65ec('0x4')],agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x19')],_0x411a7b[_0x65ec('0x10')]));}catch(_0x3ef058){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x3ef058);}};exports[_0x65ec('0x1b')]=function(_0x1467ac){try{if(!_[_0x65ec('0x1c')](agents[_0x1467ac[_0x65ec('0x10')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac['uniqueid']),_0x1467ac);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x1e'),_0x1467ac[_0x65ec('0x4')],agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x19')],_0x1467ac[_0x65ec('0x10')]));agents[_0x1467ac['destuniqueid']][_0x65ec('0x1b')]=!![];agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x20');agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x21')]='timeout';agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x1467ac[_0x65ec('0x23')]?parseInt(_0x1467ac[_0x65ec('0x23')])/0x3e8:0x0;agents[_0x1467ac['destuniqueid']][_0x65ec('0x24')]=0x0;unanswered['push'](_0x1467ac[_0x65ec('0x10')]);}}catch(_0x1ada47){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac[_0x65ec('0x4')]),_0x1ada47);}};exports[_0x65ec('0x25')]=function(_0x39410f){try{_[_0x65ec('0x26')](agents,function(_0xeec5d4,_0x3c97e2){if(_0xeec5d4['uniqueid']==_0x39410f['uniqueid']&&!_[_0x65ec('0x27')](unanswered,_0xeec5d4['destuniqueid'])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')]('[%s][agents][queuecallerabandon]',_0x39410f[_0x65ec('0x4')]),_0x39410f);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x28'),_0x39410f['uniqueid'],_0xeec5d4[_0x65ec('0x19')],_0xeec5d4[_0x65ec('0x10')]));_0xeec5d4[_0x65ec('0x1b')]=!![];_0xeec5d4[_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();_0xeec5d4[_0x65ec('0x8')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x21')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x22')]=_0x39410f['holdtime'];_0xeec5d4[_0x65ec('0x24')]=0x0;writeDB(_0xeec5d4);}});}catch(_0x1e20c4){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2a'),_0x39410f[_0x65ec('0x4')]),_0x1e20c4);}};exports[_0x65ec('0x2b')]=function(_0x134cce){try{if(agents[_0x134cce[_0x65ec('0x10')]]){utils[_0x65ec('0x12')](util['format'](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x134cce);utils[_0x65ec('0x17')](util[_0x65ec('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x134cce[_0x65ec('0x4')],agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x19')],_0x134cce[_0x65ec('0x10')]));agents[_0x134cce['destuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();agents[_0x134cce['destuniqueid']][_0x65ec('0x16')]=_0x134cce[_0x65ec('0x16')];agents[_0x134cce['destuniqueid']][_0x65ec('0x2d')]=_0x134cce[_0x65ec('0x2d')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x2e');_[_0x65ec('0x26')](agents,function(_0x2ce56f,_0x3561ef){if(_0x2ce56f['destuniqueid']!=_0x134cce[_0x65ec('0x10')]&&_0x2ce56f['uniqueid']==_0x134cce[_0x65ec('0x4')]){_0x2ce56f[_0x65ec('0x24')]=0x0;_0x2ce56f[_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];_0x2ce56f[_0x65ec('0x1b')]=!![];_0x2ce56f[_0x65ec('0x1f')]=utils['now']();_0x2ce56f[_0x65ec('0x8')]='answered_elsewhere';_0x2ce56f['reason']=_0x65ec('0x2f');_0x2ce56f[_0x65ec('0x30')]=_0x134cce[_0x65ec('0x10')];_0x2ce56f[_0x65ec('0x31')]=_0x134cce[_0x65ec('0x19')];writeDB(_0x2ce56f);}});}}catch(_0x524235){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x524235);}};exports[_0x65ec('0x32')]=function(_0x11edd1){try{if(!_['isNil'](agents[_0x11edd1['destuniqueid']])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x11edd1);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x34'),_0x11edd1['uniqueid'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x19')],_0x11edd1[_0x65ec('0x10')]));agents[_0x11edd1['destuniqueid']][_0x65ec('0x32')]=!![];agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x36')]);agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x21')]=_0x11edd1['reason'];agents[_0x11edd1[_0x65ec('0x10')]]['lastevent']=_0x65ec('0x37');writeDB(agents[_0x11edd1[_0x65ec('0x10')]]);}}catch(_0x3095f5){utils['error'](util['format'](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x3095f5);}};exports[_0x65ec('0x38')]=function(_0x2111af){try{if(!_[_0x65ec('0x1c')](agents[_0x2111af[_0x65ec('0x39')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x2111af);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x3b'),_0x2111af[_0x65ec('0x4')],agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x19')],agents[_0x2111af[_0x65ec('0x39')]]['uniqueid']));agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x3c')]=!![];agents[_0x2111af['transfereruniqueid']][_0x65ec('0x3d')]=_0x65ec('0x3e');agents[_0x2111af[_0x65ec('0x39')]]['transferexten']=_0x2111af[_0x65ec('0x3f')];agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x40')]=agents[_0x2111af['transfereruniqueid']][_0x65ec('0x4')];}}catch(_0x5e5e48){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x5e5e48);}};exports['attendedtransfer']=function(_0x2df855){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855[_0x65ec('0x42')]),_0x2df855);if(_0x2df855[_0x65ec('0x42')]==_0x2df855[_0x65ec('0x43')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x44')]])){utils['info'](util['format'](_0x65ec('0x45'),_0x2df855['origtransfereruniqueid'],agents[_0x2df855[_0x65ec('0x44')]]['membername']));agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3d')]=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x47')]=_0x2df855['origtransfererexten'];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x42')];}if(_0x2df855[_0x65ec('0x48')]&&agents[_0x2df855[_0x65ec('0x48')]]){agents[_0x2df855['transfereeuniqueid']][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x48')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x48')]]);transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x7')];transfers[_0x2df855['transfereeuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x4b')];transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855[_0x65ec('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x2df855[_0x65ec('0x48')]]['holdtime']=0x0;transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x49')]=0x2;}}else if(_0x2df855['secondtransfereruniqueid']==_0x2df855[_0x65ec('0x4c')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x42')]])){utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x45'),_0x2df855[_0x65ec('0x42')],agents[_0x2df855['origtransfereruniqueid']]['membername']));agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x42')]]['transfertype']=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x47')]=_0x2df855[_0x65ec('0x4d')];agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x44')];}if(_0x2df855['transfertargetuniqueid']&&agents[_0x2df855[_0x65ec('0x4e')]]){agents[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x4e')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x4e')]]);transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x42')]]['calleridnum'];transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855['origtransfereruniqueid']]['calleridname'];transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x49')]=0x2;}}}catch(_0x4f52ed){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855['origtransfereruniqueid']),_0x4f52ed);}};exports['hangup']=function(_0x258e14){try{utils['debug'](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x258e14);if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]===_0x65ec('0x20')){if(_0x258e14[_0x65ec('0x50')]==='21'){agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]='rejected';agents[_0x258e14[_0x65ec('0x4')]]['lastevent']=_0x65ec('0x51');}utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],agents[_0x258e14[_0x65ec('0x4')]]['membername'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14['uniqueid']]);var _0x5307ac=unanswered['indexOf'](_0x258e14[_0x65ec('0x4')]);if(_0x5307ac>-0x1){unanswered[_0x65ec('0x53')](_0x5307ac,0x1);}}if(transfers[_0x258e14[_0x65ec('0x4')]]){transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x32')]=!![];transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')]=utils[_0x65ec('0x15')]();transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],transfers[_0x258e14['uniqueid']][_0x65ec('0x36')]);transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=_0x65ec('0x55');transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]=_0x65ec('0x37');utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],transfers[_0x258e14[_0x65ec('0x4')]]['membername'],transfers[_0x258e14['uniqueid']][_0x65ec('0x21')],transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(transfers[_0x258e14[_0x65ec('0x4')]],!![]);}if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]){agents[_0x258e14[_0x65ec('0x4')]]['agentcomplete']=!![];agents[_0x258e14[_0x65ec('0x4')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils['diffTime'](agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]);agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=agents[_0x258e14[_0x65ec('0x4')]]['transfer']?_0x65ec('0x3c'):_0x65ec('0x55');agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]='complete';utils['info'](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14[_0x65ec('0x4')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x19')],agents[_0x258e14[_0x65ec('0x4')]]['reason'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14[_0x65ec('0x4')]]);}}catch(_0x127e67){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x127e67);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 792264b..3690bde 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 _0x0afd=['destinationchannel','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','starttime','billableseconds','answertime','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','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','execif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','calleridnum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','channel','context','exten','DOCUMENTATION','error','debug','channelstate','systemanswertime','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x2455e4,_0x3c81a8){var _0x316e40=function(_0x165c01){while(--_0x165c01){_0x2455e4['push'](_0x2455e4['shift']());}};_0x316e40(++_0x3c81a8);}(_0x0afd,0xac));var _0xd0af=function(_0x5c6109,_0x4ec78a){_0x5c6109=_0x5c6109-0x0;var _0xeaeaa2=_0x0afd[_0x5c6109];return _0xeaeaa2;};'use strict';var _=require(_0xd0af('0x0'));var util=require(_0xd0af('0x1'));var utils=require(_0xd0af('0x2'));var dispositions=[_0xd0af('0x3'),_0xd0af('0x4'),'FAILED','NO\x20ANSWER',_0xd0af('0x3'),_0xd0af('0x3'),_0xd0af('0x5'),'BUSY','FAILED',_0xd0af('0x4'),'FAILED'];var channels={};function writeDB(_0x30eed7){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x8'),_0x30eed7[_0xd0af('0x9')],_0x30eed7['channel'],_0x30eed7[_0xd0af('0xa')],_0x30eed7['membername'],_0x30eed7[_0xd0af('0xb')],_0x30eed7[_0xd0af('0xc')],_0x30eed7['connectedlinenum'],_0x30eed7['lastevent']));if(_0x30eed7[_0xd0af('0xd')]){utils[_0xd0af('0xe')](_0x30eed7[_0xd0af('0xd')])[_0xd0af('0xf')](function(_0x2d2354){if(_0x2d2354){_0x30eed7[_0xd0af('0x10')]=_0x2d2354['id'];}utils[_0xd0af('0x11')]('CreateVoiceCallReport',_0x30eed7);});}else{utils['request'](_0xd0af('0x12'),_0x30eed7);}if(channels[_0x30eed7[_0xd0af('0x9')]]){delete channels[_0x30eed7[_0xd0af('0x9')]];}}exports[_0xd0af('0x13')]=function(_0x5b0798){try{utils['debug'](util[_0xd0af('0x7')](_0xd0af('0x14'),_0x5b0798[_0xd0af('0x9')]),_0x5b0798);if(_0x5b0798[_0xd0af('0x9')]==_0x5b0798[_0xd0af('0x15')]&&_0x5b0798[_0xd0af('0x16')]!='OutgoingSpoolFailed'){utils[_0xd0af('0x6')](util[_0xd0af('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5b0798[_0xd0af('0x9')],_0x5b0798[_0xd0af('0x17')],_0x5b0798[_0xd0af('0x18')]));channels[_0x5b0798['uniqueid']]={'uniqueid':_0x5b0798[_0xd0af('0x9')],'accountcode':_0x5b0798['accountcode'],'source':_0x5b0798[_0xd0af('0xc')],'destination':_0x5b0798[_0xd0af('0x18')],'destinationcontext':_0x5b0798[_0xd0af('0x17')],'channel':_0x5b0798[_0xd0af('0x16')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd0af('0x19')};}}catch(_0x4ea73f){utils[_0xd0af('0x1a')](util[_0xd0af('0x7')](_0xd0af('0x14'),_0x5b0798[_0xd0af('0x9')]),_0x4ea73f);}};exports['newstate']=function(_0x3cb29b){try{utils[_0xd0af('0x1b')](util[_0xd0af('0x7')]('[%s][calls][newstate]',_0x3cb29b['uniqueid']),_0x3cb29b);if(!_['isNil'](channels[_0x3cb29b[_0xd0af('0x9')]])&&_0x3cb29b[_0xd0af('0x1c')]==0x6){utils[_0xd0af('0x6')](util[_0xd0af('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3cb29b['uniqueid'],_0x3cb29b[_0xd0af('0x17')],_0x3cb29b['channel']));if(_['isNil'](channels[_0x3cb29b[_0xd0af('0x9')]][_0xd0af('0x1d')])){channels[_0x3cb29b[_0xd0af('0x9')]][_0xd0af('0x1d')]=utils[_0xd0af('0x1e')]();}}else if(!_[_0xd0af('0x1f')](channels[_0x3cb29b['linkedid']])&&_0x3cb29b[_0xd0af('0x1c')]==0x6&&_0x3cb29b[_0xd0af('0x17')]!=_0xd0af('0x20')){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x21'),_0x3cb29b[_0xd0af('0x9')],_0x3cb29b[_0xd0af('0x15')],_0x3cb29b[_0xd0af('0x17')],_0x3cb29b[_0xd0af('0x16')]));channels[_0x3cb29b[_0xd0af('0x15')]][_0xd0af('0xd')]=_0x3cb29b[_0xd0af('0xd')];channels[_0x3cb29b['linkedid']][_0xd0af('0x22')]=_0x3cb29b['channel'];if(_[_0xd0af('0x1f')](channels[_0x3cb29b[_0xd0af('0x15')]]['answertime'])){channels[_0x3cb29b[_0xd0af('0x15')]]['answertime']=utils[_0xd0af('0x1e')]();}channels[_0x3cb29b[_0xd0af('0x15')]]['disposition']=dispositions[_[_0xd0af('0x23')](_0x3cb29b[_0xd0af('0x1c')])]||'ANSWERED';}}catch(_0x1903dc){utils['error'](util['format'](_0xd0af('0x24'),_0x3cb29b[_0xd0af('0x9')]),_0x1903dc);}};exports[_0xd0af('0x25')]=function(_0x2f7ec6){try{if(!_[_0xd0af('0x1f')](channels[_0x2f7ec6['uniqueid']])){utils[_0xd0af('0x1b')](util[_0xd0af('0x7')](_0xd0af('0x26'),_0x2f7ec6[_0xd0af('0x9')]),_0x2f7ec6);if(_[_0xd0af('0x1f')](channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x27')])){channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x27')]=_0x2f7ec6['calleridname']+'\x20<'+_0x2f7ec6[_0xd0af('0xc')]+'>';}utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x28'),_0x2f7ec6['uniqueid'],channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x27')],_0x2f7ec6['cause-txt']));channels[_0x2f7ec6[_0xd0af('0x9')]]['endtime']=utils[_0xd0af('0x1e')]();channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x29')]=utils[_0xd0af('0x2a')](channels[_0x2f7ec6[_0xd0af('0x9')]]['endtime'],channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x2b')]);channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x2c')]=channels[_0x2f7ec6['uniqueid']][_0xd0af('0x2d')]?utils['diffTime'](channels[_0x2f7ec6[_0xd0af('0x9')]]['endtime'],channels[_0x2f7ec6[_0xd0af('0x9')]][_0xd0af('0x2d')]):0x0;writeDB(channels[_0x2f7ec6[_0xd0af('0x9')]]);}}catch(_0x1ebd16){utils[_0xd0af('0x1a')](util[_0xd0af('0x7')](_0xd0af('0x26'),_0x2f7ec6[_0xd0af('0x9')]),_0x1ebd16);}};exports[_0xd0af('0x2e')]=function(_0x33464e){try{if(!_[_0xd0af('0x1f')](channels[_0x33464e[_0xd0af('0x2f')]])){utils[_0xd0af('0x1b')](util[_0xd0af('0x7')](_0xd0af('0x30'),_0x33464e[_0xd0af('0x31')]),_0x33464e);if(channels[_0x33464e[_0xd0af('0x2f')]]['channel']==_0x33464e[_0xd0af('0x32')]){utils['info'](util[_0xd0af('0x7')](_0xd0af('0x33'),_0x33464e[_0xd0af('0x31')],_0x33464e[_0xd0af('0x2f')],_0x33464e['secondtransfererchannel']));channels[_0x33464e[_0xd0af('0x2f')]][_0xd0af('0x22')]=_0x33464e[_0xd0af('0x34')];channels[_0x33464e[_0xd0af('0x2f')]][_0xd0af('0x35')]=_0xd0af('0x36');}else if(channels[_0x33464e[_0xd0af('0x2f')]][_0xd0af('0x16')]=_0x33464e['transfertargetchannel']){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x33'),_0x33464e['origtransfereruniqueid'],_0x33464e[_0xd0af('0x2f')],_0x33464e[_0xd0af('0x37')]));channels[_0x33464e['localtwolinkedid']]['destinationchannel']=_0x33464e[_0xd0af('0x37')];channels[_0x33464e['localtwolinkedid']][_0xd0af('0x35')]=_0xd0af('0x36');}}}catch(_0x16ad75){utils[_0xd0af('0x1a')](util[_0xd0af('0x7')]('[%s][calls][attendedtransfer]',_0x33464e[_0xd0af('0x31')]),_0x16ad75);}};exports['musiconholdstart']=function(_0x4bc150){try{if(!_[_0xd0af('0x1f')](channels[_0x4bc150[_0xd0af('0x9')]])){utils[_0xd0af('0x1b')](util['format'](_0xd0af('0x38'),_0x4bc150[_0xd0af('0x9')]),_0x4bc150);channels[_0x4bc150['uniqueid']][_0xd0af('0x39')]=utils[_0xd0af('0x1e')]();utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x3a'),_0x4bc150[_0xd0af('0x9')],channels[_0x4bc150['uniqueid']][_0xd0af('0x39')]));}}catch(_0x25a0b1){utils[_0xd0af('0x1a')](util[_0xd0af('0x7')]('[%s][calls][musiconholdstart]',_0x4bc150[_0xd0af('0x9')]),_0x25a0b1);}};exports[_0xd0af('0x3b')]=function(_0x53972c){try{if(!_[_0xd0af('0x1f')](channels[_0x53972c[_0xd0af('0x9')]])){utils[_0xd0af('0x1b')](util[_0xd0af('0x7')]('[%s][calls][musiconholdstop]',_0x53972c[_0xd0af('0x9')]),_0x53972c);if(!_[_0xd0af('0x1f')](channels[_0x53972c[_0xd0af('0x9')]][_0xd0af('0x39')])){channels[_0x53972c[_0xd0af('0x9')]][_0xd0af('0x3c')]+=utils['diffTime'](utils[_0xd0af('0x1e')](),channels[_0x53972c[_0xd0af('0x9')]]['musiconholdstartAt']);utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x3d'),_0x53972c[_0xd0af('0x9')],channels[_0x53972c[_0xd0af('0x9')]][_0xd0af('0x3c')]));delete channels[_0x53972c[_0xd0af('0x9')]]['musiconholdstartAt'];}}}catch(_0x3c80ee){utils[_0xd0af('0x1a')](util['format'](_0xd0af('0x3e'),_0x53972c[_0xd0af('0x9')]),_0x3c80ee);}};exports[_0xd0af('0x3f')]=function(_0x4f02aa){try{if(!_[_0xd0af('0x1f')](channels[_0x4f02aa['uniqueid']])){utils[_0xd0af('0x1b')](util[_0xd0af('0x7')](_0xd0af('0x40'),_0x4f02aa[_0xd0af('0x9')]),_0x4f02aa);if(!_[_0xd0af('0x1f')](_0x4f02aa['variable'][_0xd0af('0x41')])){utils[_0xd0af('0x6')](util['format'](_0xd0af('0x42'),_0x4f02aa['uniqueid'],_0x4f02aa['value']));channels[_0x4f02aa[_0xd0af('0x9')]][_0xd0af('0x43')]=_0x4f02aa['value'];}if(!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x45')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x46'),_0x4f02aa[_0xd0af('0x9')],_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa[_0xd0af('0x9')]]['destination']=_0x4f02aa[_0xd0af('0x47')];channels[_0x4f02aa['uniqueid']][_0xd0af('0x27')]='\x22'+_0x4f02aa[_0xd0af('0x47')]+_0xd0af('0x48')+_0x4f02aa[_0xd0af('0x47')]+'>';}if(!_['isNil'](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x49')])||!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x4a')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x4b'),_0x4f02aa[_0xd0af('0x9')],!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x49')])?'xmd-callerid-preview':_0xd0af('0x4a'),_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa[_0xd0af('0x9')]][_0xd0af('0x27')]=_0x4f02aa['value'];}if(!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x4c')])||!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x4d')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x4b'),_0x4f02aa[_0xd0af('0x9')],!_['isNil'](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x4c')])?'xmd-queue':_0xd0af('0x4d'),_0x4f02aa['value']));channels[_0x4f02aa[_0xd0af('0x9')]]['lastapplication']=_0xd0af('0x4e');channels[_0x4f02aa[_0xd0af('0x9')]][_0xd0af('0x4f')]=_0x4f02aa[_0xd0af('0x47')];channels[_0x4f02aa[_0xd0af('0x9')]]['queue']=!![];}if(!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')]['xmd-contactid'])){utils[_0xd0af('0x6')](util['format'](_0xd0af('0x50'),_0x4f02aa[_0xd0af('0x9')],_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa[_0xd0af('0x9')]][_0xd0af('0x51')]=_0x4f02aa[_0xd0af('0x47')];}if(!_[_0xd0af('0x1f')](_0x4f02aa['variable'][_0xd0af('0x52')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4f02aa['uniqueid'],_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa['uniqueid']][_0xd0af('0x53')]=_0x4f02aa[_0xd0af('0x47')];}if(!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x54')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4f02aa[_0xd0af('0x9')],_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa[_0xd0af('0x9')]][_0xd0af('0x55')]=_0x4f02aa['value'];}if(!_[_0xd0af('0x1f')](_0x4f02aa[_0xd0af('0x44')][_0xd0af('0x56')])){utils[_0xd0af('0x6')](util[_0xd0af('0x7')](_0xd0af('0x57'),_0x4f02aa['uniqueid'],_0x4f02aa[_0xd0af('0x47')]));channels[_0x4f02aa['uniqueid']][_0xd0af('0x56')]=_0x4f02aa[_0xd0af('0x47')];}}}catch(_0x318a2e){utils[_0xd0af('0x1a')](util[_0xd0af('0x7')]('[%s][calls][varset]',_0x4f02aa['uniqueid']),_0x318a2e);}};exports[_0xd0af('0x58')]=function(_0x2e738f){try{if(!_[_0xd0af('0x1f')](channels[_0x2e738f[_0xd0af('0x9')]])){utils['debug'](util['format'](_0xd0af('0x59'),_0x2e738f[_0xd0af('0x9')]),_0x2e738f);utils['info'](util[_0xd0af('0x7')](_0xd0af('0x5a'),_0x2e738f[_0xd0af('0x9')],_0x2e738f['application'],_0x2e738f[_0xd0af('0x5b')]));if(_0x2e738f[_0xd0af('0x5c')][_0xd0af('0x5d')]()==_0xd0af('0x5e')&&_[_0xd0af('0x5f')](_0x2e738f[_0xd0af('0x5b')][_0xd0af('0x5d')](),_0xd0af('0x60'))){var _0xeb89d=_0x2e738f[_0xd0af('0x5b')][_0xd0af('0x61')]('=');var _0x1cd219=_0xeb89d[0x0][_0xd0af('0x62')](_0xeb89d[0x0][_0xd0af('0x63')]('(')+0x1,_0xeb89d[0x0][_0xd0af('0x63')](')'));var _0x3aa929=_0xeb89d[0x1];channels[_0x2e738f[_0xd0af('0x9')]][_0x1cd219]=_0x3aa929;}if(!_[_0xd0af('0x64')]([_0xd0af('0x25'),'noop',_0xd0af('0x65'),'set','gotoif'],_0x2e738f[_0xd0af('0x5c')][_0xd0af('0x5d')]())){channels[_0x2e738f['uniqueid']][_0xd0af('0x66')]=_0x2e738f[_0xd0af('0x5c')];channels[_0x2e738f['uniqueid']][_0xd0af('0x4f')]=_0x2e738f[_0xd0af('0x5b')];}}}catch(_0x5f8837){utils[_0xd0af('0x1a')](util['format'](_0xd0af('0x59'),_0x2e738f[_0xd0af('0x9')]),_0x5f8837);}}; \ No newline at end of file +var _0xca9a=['musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','appdata','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','application','lastapplication','[%s][calls][newexten]','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','error','[%s][calls][newchannel]','newstate','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','channelstate','transfer','answertime','disposition','toNumber','hangup','callerid','cause-txt','duration','diffTime','starttime','billableseconds','endtime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfererchannel','_attended'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xca9a,0x172));var _0xaca9=function(_0x537217,_0x3f38b3){_0x537217=_0x537217-0x0;var _0x34aeb6=_0xca9a[_0x537217];return _0x34aeb6;};'use strict';var _=require(_0xaca9('0x0'));var util=require(_0xaca9('0x1'));var utils=require(_0xaca9('0x2'));var dispositions=['NO\x20ANSWER',_0xaca9('0x3'),_0xaca9('0x3'),_0xaca9('0x4'),_0xaca9('0x4'),_0xaca9('0x4'),_0xaca9('0x5'),_0xaca9('0x6'),_0xaca9('0x3'),_0xaca9('0x3'),'FAILED'];var channels={};function writeDB(_0xad8b45){utils[_0xaca9('0x7')](util[_0xaca9('0x8')](_0xaca9('0x9'),_0xad8b45['uniqueid'],_0xad8b45['channel'],_0xad8b45[_0xaca9('0xa')],_0xad8b45[_0xaca9('0xb')],_0xad8b45[_0xaca9('0xc')],_0xad8b45[_0xaca9('0xd')],_0xad8b45[_0xaca9('0xe')],_0xad8b45[_0xaca9('0xf')]));if(_0xad8b45[_0xaca9('0x10')]){utils[_0xaca9('0x11')](_0xad8b45['accountcode'])[_0xaca9('0x12')](function(_0xee4eb8){if(_0xee4eb8){_0xad8b45[_0xaca9('0x13')]=_0xee4eb8['id'];}utils[_0xaca9('0x14')](_0xaca9('0x15'),_0xad8b45);});}else{utils[_0xaca9('0x14')]('CreateVoiceCallReport',_0xad8b45);}if(channels[_0xad8b45[_0xaca9('0x16')]]){delete channels[_0xad8b45[_0xaca9('0x16')]];}}exports[_0xaca9('0x17')]=function(_0x1f6d5f){try{utils[_0xaca9('0x18')](util['format']('[%s][calls][newchannel]',_0x1f6d5f[_0xaca9('0x16')]),_0x1f6d5f);if(_0x1f6d5f[_0xaca9('0x16')]==_0x1f6d5f['linkedid']&&_0x1f6d5f[_0xaca9('0x19')]!=_0xaca9('0x1a')){utils['info'](util['format'](_0xaca9('0x1b'),_0x1f6d5f[_0xaca9('0x16')],_0x1f6d5f['context'],_0x1f6d5f['exten']));channels[_0x1f6d5f[_0xaca9('0x16')]]={'uniqueid':_0x1f6d5f[_0xaca9('0x16')],'accountcode':_0x1f6d5f[_0xaca9('0x10')],'source':_0x1f6d5f[_0xaca9('0xd')],'destination':_0x1f6d5f['exten'],'destinationcontext':_0x1f6d5f[_0xaca9('0x1c')],'channel':_0x1f6d5f[_0xaca9('0x19')],'starttime':utils[_0xaca9('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xaca9('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x2808a7){utils[_0xaca9('0x1e')](util['format'](_0xaca9('0x1f'),_0x1f6d5f[_0xaca9('0x16')]),_0x2808a7);}};exports[_0xaca9('0x20')]=function(_0x1f0427){try{utils[_0xaca9('0x18')](util[_0xaca9('0x8')]('[%s][calls][newstate]',_0x1f0427[_0xaca9('0x16')]),_0x1f0427);if(!_[_0xaca9('0x21')](channels[_0x1f0427['uniqueid']])&&_0x1f0427['channelstate']==0x6){utils[_0xaca9('0x7')](util[_0xaca9('0x8')](_0xaca9('0x22'),_0x1f0427[_0xaca9('0x16')],_0x1f0427['context'],_0x1f0427[_0xaca9('0x19')]));if(_[_0xaca9('0x21')](channels[_0x1f0427['uniqueid']][_0xaca9('0x23')])){channels[_0x1f0427[_0xaca9('0x16')]][_0xaca9('0x23')]=utils[_0xaca9('0x1d')]();}}else if(!_['isNil'](channels[_0x1f0427[_0xaca9('0x24')]])&&_0x1f0427[_0xaca9('0x25')]==0x6&&_0x1f0427['context']!=_0xaca9('0x26')){utils[_0xaca9('0x7')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f0427[_0xaca9('0x16')],_0x1f0427[_0xaca9('0x24')],_0x1f0427[_0xaca9('0x1c')],_0x1f0427['channel']));channels[_0x1f0427[_0xaca9('0x24')]][_0xaca9('0x10')]=_0x1f0427[_0xaca9('0x10')];channels[_0x1f0427[_0xaca9('0x24')]]['destinationchannel']=_0x1f0427[_0xaca9('0x19')];if(_[_0xaca9('0x21')](channels[_0x1f0427[_0xaca9('0x24')]][_0xaca9('0x27')])){channels[_0x1f0427[_0xaca9('0x24')]][_0xaca9('0x27')]=utils[_0xaca9('0x1d')]();}channels[_0x1f0427['linkedid']][_0xaca9('0x28')]=dispositions[_[_0xaca9('0x29')](_0x1f0427['channelstate'])]||_0xaca9('0x5');}}catch(_0x172349){utils[_0xaca9('0x1e')](util[_0xaca9('0x8')]('[%s][calls][newstate]',_0x1f0427[_0xaca9('0x16')]),_0x172349);}};exports[_0xaca9('0x2a')]=function(_0xa393d8){try{if(!_[_0xaca9('0x21')](channels[_0xa393d8[_0xaca9('0x16')]])){utils[_0xaca9('0x18')](util[_0xaca9('0x8')]('[%s][calls][hangup]',_0xa393d8[_0xaca9('0x16')]),_0xa393d8);if(_[_0xaca9('0x21')](channels[_0xa393d8[_0xaca9('0x16')]]['callerid'])){channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x2b')]=_0xa393d8['calleridname']+'\x20<'+_0xa393d8[_0xaca9('0xd')]+'>';}utils['info'](util[_0xaca9('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xa393d8[_0xaca9('0x16')],channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x2b')],_0xa393d8[_0xaca9('0x2c')]));channels[_0xa393d8[_0xaca9('0x16')]]['endtime']=utils[_0xaca9('0x1d')]();channels[_0xa393d8['uniqueid']][_0xaca9('0x2d')]=utils[_0xaca9('0x2e')](channels[_0xa393d8[_0xaca9('0x16')]]['endtime'],channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x2f')]);channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x30')]=channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x27')]?utils[_0xaca9('0x2e')](channels[_0xa393d8['uniqueid']][_0xaca9('0x31')],channels[_0xa393d8[_0xaca9('0x16')]][_0xaca9('0x27')]):0x0;writeDB(channels[_0xa393d8['uniqueid']]);}}catch(_0xff4d3){utils[_0xaca9('0x1e')](util[_0xaca9('0x8')](_0xaca9('0x32'),_0xa393d8[_0xaca9('0x16')]),_0xff4d3);}};exports[_0xaca9('0x33')]=function(_0x5064c5){try{if(!_[_0xaca9('0x21')](channels[_0x5064c5[_0xaca9('0x34')]])){utils['debug'](util[_0xaca9('0x8')](_0xaca9('0x35'),_0x5064c5[_0xaca9('0x36')]),_0x5064c5);if(channels[_0x5064c5[_0xaca9('0x34')]]['channel']==_0x5064c5[_0xaca9('0x37')]){utils['info'](util[_0xaca9('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5064c5[_0xaca9('0x36')],_0x5064c5[_0xaca9('0x34')],_0x5064c5[_0xaca9('0x38')]));channels[_0x5064c5[_0xaca9('0x34')]][_0xaca9('0x39')]=_0x5064c5[_0xaca9('0x38')];channels[_0x5064c5['localtwolinkedid']][_0xaca9('0x3a')]='_attended';}else if(channels[_0x5064c5[_0xaca9('0x34')]][_0xaca9('0x19')]=_0x5064c5[_0xaca9('0x3b')]){utils[_0xaca9('0x7')](util[_0xaca9('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5064c5[_0xaca9('0x36')],_0x5064c5[_0xaca9('0x34')],_0x5064c5[_0xaca9('0x3c')]));channels[_0x5064c5[_0xaca9('0x34')]]['destinationchannel']=_0x5064c5[_0xaca9('0x3c')];channels[_0x5064c5['localtwolinkedid']][_0xaca9('0x3a')]=_0xaca9('0x3d');}}}catch(_0x54b58d){utils['error'](util[_0xaca9('0x8')](_0xaca9('0x35'),_0x5064c5[_0xaca9('0x36')]),_0x54b58d);}};exports[_0xaca9('0x3e')]=function(_0x222603){try{if(!_['isNil'](channels[_0x222603[_0xaca9('0x16')]])){utils[_0xaca9('0x18')](util[_0xaca9('0x8')](_0xaca9('0x3f'),_0x222603['uniqueid']),_0x222603);channels[_0x222603[_0xaca9('0x16')]][_0xaca9('0x40')]=utils[_0xaca9('0x1d')]();utils['info'](util[_0xaca9('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x222603[_0xaca9('0x16')],channels[_0x222603[_0xaca9('0x16')]][_0xaca9('0x40')]));}}catch(_0x240f83){utils[_0xaca9('0x1e')](util[_0xaca9('0x8')](_0xaca9('0x3f'),_0x222603[_0xaca9('0x16')]),_0x240f83);}};exports[_0xaca9('0x41')]=function(_0x42838d){try{if(!_[_0xaca9('0x21')](channels[_0x42838d[_0xaca9('0x16')]])){utils[_0xaca9('0x18')](util[_0xaca9('0x8')](_0xaca9('0x42'),_0x42838d[_0xaca9('0x16')]),_0x42838d);if(!_[_0xaca9('0x21')](channels[_0x42838d['uniqueid']][_0xaca9('0x40')])){channels[_0x42838d[_0xaca9('0x16')]][_0xaca9('0x43')]+=utils['diffTime'](utils['now'](),channels[_0x42838d[_0xaca9('0x16')]][_0xaca9('0x40')]);utils['info'](util[_0xaca9('0x8')](_0xaca9('0x44'),_0x42838d[_0xaca9('0x16')],channels[_0x42838d[_0xaca9('0x16')]][_0xaca9('0x43')]));delete channels[_0x42838d['uniqueid']][_0xaca9('0x40')];}}}catch(_0xeb2e28){utils[_0xaca9('0x1e')](util['format']('[%s][calls][musiconholdstop]',_0x42838d['uniqueid']),_0xeb2e28);}};exports['varset']=function(_0xb02044){try{if(!_[_0xaca9('0x21')](channels[_0xb02044[_0xaca9('0x16')]])){utils[_0xaca9('0x18')](util[_0xaca9('0x8')](_0xaca9('0x45'),_0xb02044[_0xaca9('0x16')]),_0xb02044);if(!_[_0xaca9('0x21')](_0xb02044[_0xaca9('0x46')][_0xaca9('0x47')])){utils['info'](util['format'](_0xaca9('0x48'),_0xb02044[_0xaca9('0x16')],_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]]['source']=_0xb02044[_0xaca9('0x49')];}if(!_['isNil'](_0xb02044[_0xaca9('0x46')][_0xaca9('0x4a')])){utils['info'](util[_0xaca9('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xb02044[_0xaca9('0x16')],_0xb02044['value']));channels[_0xb02044[_0xaca9('0x16')]]['destination']=_0xb02044[_0xaca9('0x49')];channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x2b')]='\x22'+_0xb02044[_0xaca9('0x49')]+_0xaca9('0x4b')+_0xb02044[_0xaca9('0x49')]+'>';}if(!_['isNil'](_0xb02044[_0xaca9('0x46')][_0xaca9('0x4c')])||!_[_0xaca9('0x21')](_0xb02044['variable'][_0xaca9('0x4d')])){utils[_0xaca9('0x7')](util[_0xaca9('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xb02044[_0xaca9('0x16')],!_[_0xaca9('0x21')](_0xb02044['variable']['xmd-callerid-preview'])?_0xaca9('0x4c'):'xmd-callerid',_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x2b')]=_0xb02044[_0xaca9('0x49')];}if(!_[_0xaca9('0x21')](_0xb02044[_0xaca9('0x46')][_0xaca9('0x4e')])||!_[_0xaca9('0x21')](_0xb02044['variable'][_0xaca9('0x4f')])){utils[_0xaca9('0x7')](util[_0xaca9('0x8')](_0xaca9('0x50'),_0xb02044[_0xaca9('0x16')],!_[_0xaca9('0x21')](_0xb02044[_0xaca9('0x46')][_0xaca9('0x4e')])?_0xaca9('0x4e'):_0xaca9('0x4f'),_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]]['lastapplication']='Queue';channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x51')]=_0xb02044[_0xaca9('0x49')];channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0xa')]=!![];}if(!_[_0xaca9('0x21')](_0xb02044[_0xaca9('0x46')][_0xaca9('0x52')])){utils[_0xaca9('0x7')](util[_0xaca9('0x8')](_0xaca9('0x53'),_0xb02044[_0xaca9('0x16')],_0xb02044['value']));channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x54')]=_0xb02044[_0xaca9('0x49')];}if(!_[_0xaca9('0x21')](_0xb02044['variable'][_0xaca9('0x55')])){utils['info'](util[_0xaca9('0x8')](_0xaca9('0x56'),_0xb02044[_0xaca9('0x16')],_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x57')]=_0xb02044[_0xaca9('0x49')];}if(!_[_0xaca9('0x21')](_0xb02044['variable'][_0xaca9('0x58')])){utils[_0xaca9('0x7')](util[_0xaca9('0x8')](_0xaca9('0x59'),_0xb02044[_0xaca9('0x16')],_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x5a')]=_0xb02044[_0xaca9('0x49')];}if(!_['isNil'](_0xb02044[_0xaca9('0x46')]['sipcallid'])){utils['info'](util[_0xaca9('0x8')](_0xaca9('0x5b'),_0xb02044[_0xaca9('0x16')],_0xb02044[_0xaca9('0x49')]));channels[_0xb02044[_0xaca9('0x16')]][_0xaca9('0x5c')]=_0xb02044['value'];}}}catch(_0x2625fe){utils[_0xaca9('0x1e')](util[_0xaca9('0x8')]('[%s][calls][varset]',_0xb02044['uniqueid']),_0x2625fe);}};exports[_0xaca9('0x5d')]=function(_0x2a4db4){try{if(!_[_0xaca9('0x21')](channels[_0x2a4db4['uniqueid']])){utils[_0xaca9('0x18')](util[_0xaca9('0x8')]('[%s][calls][newexten]',_0x2a4db4[_0xaca9('0x16')]),_0x2a4db4);utils['info'](util[_0xaca9('0x8')](_0xaca9('0x5e'),_0x2a4db4[_0xaca9('0x16')],_0x2a4db4['application'],_0x2a4db4['appdata']));if(_0x2a4db4['application'][_0xaca9('0x5f')]()=='set'&&_['startsWith'](_0x2a4db4[_0xaca9('0x60')]['toLowerCase'](),_0xaca9('0x61'))){var _0x2ffd20=_0x2a4db4['appdata']['split']('=');var _0x388afe=_0x2ffd20[0x0][_0xaca9('0x62')](_0x2ffd20[0x0]['lastIndexOf']('(')+0x1,_0x2ffd20[0x0][_0xaca9('0x63')](')'));var _0x157898=_0x2ffd20[0x1];channels[_0x2a4db4[_0xaca9('0x16')]][_0x388afe]=_0x157898;}if(!_[_0xaca9('0x64')]([_0xaca9('0x2a'),_0xaca9('0x65'),_0xaca9('0x66'),_0xaca9('0x67'),_0xaca9('0x68')],_0x2a4db4[_0xaca9('0x69')][_0xaca9('0x5f')]())){channels[_0x2a4db4[_0xaca9('0x16')]][_0xaca9('0x6a')]=_0x2a4db4[_0xaca9('0x69')];channels[_0x2a4db4['uniqueid']]['lastdata']=_0x2a4db4[_0xaca9('0x60')];}}}catch(_0x460dd9){utils['error'](util[_0xaca9('0x8')](_0xaca9('0x6b'),_0x2a4db4['uniqueid']),_0x460dd9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d9e0a93..f523759 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 _0x27b3=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','shutdown','fullybooted'];(function(_0x219950,_0x2399c3){var _0x52efbd=function(_0x568f46){while(--_0x568f46){_0x219950['push'](_0x219950['shift']());}};_0x52efbd(++_0x2399c3);}(_0x27b3,0xd7));var _0x327b=function(_0x2a1f50,_0x1d88b5){_0x2a1f50=_0x2a1f50-0x0;var _0x1799d3=_0x27b3[_0x2a1f50];return _0x1799d3;};'use strict';var utils=require(_0x327b('0x0'));exports[_0x327b('0x1')]=function(){utils[_0x327b('0x2')]('[core]\x20connected');};exports[_0x327b('0x3')]=function(){utils[_0x327b('0x2')]('[core]\x20shutdown');};exports[_0x327b('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x327b('0x5')]=function(_0x136592){utils['error'](_0x327b('0x6'),_0x136592);};exports[_0x327b('0x7')]=function(){utils['info'](_0x327b('0x8'));};exports[_0x327b('0x9')]=function(_0x2dec63){}; \ No newline at end of file +var _0x5327=['[core]\x20fullybooted','error','close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0xbf802e,_0x329296){var _0x19e99b=function(_0x36e374){while(--_0x36e374){_0xbf802e['push'](_0xbf802e['shift']());}};_0x19e99b(++_0x329296);}(_0x5327,0x1bc));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x7532('0x0'));exports[_0x7532('0x1')]=function(){utils[_0x7532('0x2')](_0x7532('0x3'));};exports[_0x7532('0x4')]=function(){utils[_0x7532('0x2')](_0x7532('0x5'));};exports[_0x7532('0x6')]=function(){utils[_0x7532('0x2')](_0x7532('0x7'));};exports[_0x7532('0x8')]=function(_0x4b5655){utils['error']('[core]\x20error',_0x4b5655);};exports[_0x7532('0x9')]=function(){utils[_0x7532('0x2')]('[core]\x20close');};exports[_0x7532('0xa')]=function(_0xa8e9a6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a8261a5..c7c9785 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 _0xe493=['variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','isNil','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','now','endtime','starttime','diffTime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','error','[%s][dials][varset]'];(function(_0x4eda33,_0x200db8){var _0x5d6eb4=function(_0x57312c){while(--_0x57312c){_0x4eda33['push'](_0x4eda33['shift']());}};_0x5d6eb4(++_0x200db8);}(_0xe493,0x139));var _0x3e49=function(_0x19e0d8,_0xbec4da){_0x19e0d8=_0x19e0d8-0x0;var _0x7aafa4=_0xe493[_0x19e0d8];return _0x7aafa4;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var utils=require(_0x3e49('0x2'));var dials={};function writeDB(_0x5c5197){utils[_0x3e49('0x3')](util[_0x3e49('0x4')](_0x3e49('0x5'),_0x5c5197['uniqueid'],_0x5c5197[_0x3e49('0x6')],_0x5c5197[_0x3e49('0x7')],_0x5c5197[_0x3e49('0x8')],_0x5c5197[_0x3e49('0x9')],_0x5c5197[_0x3e49('0xa')]));utils['request']('CreateVoiceDialReport',_0x5c5197);delete dials[_0x5c5197[_0x3e49('0xb')]];}exports[_0x3e49('0xc')]=function(_0x93f01){try{utils[_0x3e49('0xd')](util[_0x3e49('0x4')](_0x3e49('0xe'),_0x93f01[_0x3e49('0xb')]),_0x93f01);utils['info'](util[_0x3e49('0x4')](_0x3e49('0xf'),_0x93f01['uniqueid'],_0x93f01[_0x3e49('0x10')],_0x93f01[_0x3e49('0x11')]));if(_0x93f01[_0x3e49('0x10')]['toLowerCase']()==_0x3e49('0x12')&&_[_0x3e49('0x13')](_0x93f01[_0x3e49('0x11')][_0x3e49('0x14')](),'cdr(routeid)')){var _0x10f514=_0x93f01[_0x3e49('0x11')]['split']('=');dials[_0x93f01['uniqueid']]={'routeId':_0x10f514[0x1]};}}catch(_0x9a14b0){utils[_0x3e49('0x15')](util[_0x3e49('0x4')](_0x3e49('0xe'),_0x93f01[_0x3e49('0xb')]),_0x9a14b0);}};exports['varset']=function(_0x29ab12){try{utils[_0x3e49('0xd')](util[_0x3e49('0x4')](_0x3e49('0x16'),_0x29ab12[_0x3e49('0xb')]),_0x29ab12);if(!_['isNil'](_0x29ab12[_0x3e49('0x17')][_0x3e49('0x18')])){utils[_0x3e49('0x3')](util[_0x3e49('0x4')](_0x3e49('0x19'),_0x29ab12['uniqueid'],_0x29ab12[_0x3e49('0x1a')]));dials[_0x29ab12[_0x3e49('0xb')]]={'routeId':_0x29ab12[_0x3e49('0x1a')]};}}catch(_0x170c30){utils[_0x3e49('0x15')](util[_0x3e49('0x4')](_0x3e49('0x16'),_0x29ab12['uniqueid']),_0x170c30);}};exports[_0x3e49('0x1b')]=function(_0x2437f4){try{if(!_['isNil'](dials[_0x2437f4['uniqueid']])){utils[_0x3e49('0xd')](util[_0x3e49('0x4')]('[%s][dials][dialbegin]',_0x2437f4[_0x3e49('0xb')]),_0x2437f4);dials[_0x2437f4['uniqueid']]=_['assign'](dials[_0x2437f4[_0x3e49('0xb')]],_0x2437f4);dials[_0x2437f4[_0x3e49('0xb')]]['starttime']=utils['now']();dials[_0x2437f4[_0x3e49('0xb')]][_0x3e49('0x1c')]=_0x3e49('0x1d');utils[_0x3e49('0x3')](util[_0x3e49('0x4')](_0x3e49('0x1e'),_0x2437f4['uniqueid'],dials[_0x2437f4[_0x3e49('0xb')]]['starttime']));}}catch(_0x58ad12){utils['error'](util['format'](_0x3e49('0x1f'),_0x2437f4[_0x3e49('0xb')]),_0x58ad12);}};exports[_0x3e49('0x20')]=function(_0x28fb8b){try{if(!_[_0x3e49('0x21')](dials[_0x28fb8b[_0x3e49('0xb')]])){utils['debug'](util[_0x3e49('0x4')](_0x3e49('0x22'),_0x28fb8b[_0x3e49('0xb')]),_0x28fb8b);dials[_0x28fb8b[_0x3e49('0xb')]][_0x3e49('0xa')]=_0x28fb8b[_0x3e49('0xa')];if(_0x28fb8b['dialstatus']==_0x3e49('0x23')){dials[_0x28fb8b['uniqueid']]=_[_0x3e49('0x24')](dials[_0x28fb8b[_0x3e49('0xb')]],_0x28fb8b);dials[_0x28fb8b['uniqueid']][_0x3e49('0x25')]=utils['now']();dials[_0x28fb8b[_0x3e49('0xb')]][_0x3e49('0x1c')]=_0x3e49('0x26');utils[_0x3e49('0x3')](util[_0x3e49('0x4')](_0x3e49('0x27'),_0x28fb8b[_0x3e49('0xb')],_0x28fb8b[_0x3e49('0xa')],dials[_0x28fb8b[_0x3e49('0xb')]][_0x3e49('0x25')]));}else{utils['info'](util['format'](_0x3e49('0x28'),_0x28fb8b[_0x3e49('0xb')],_0x28fb8b[_0x3e49('0xa')]));}}}catch(_0x484c8f){utils[_0x3e49('0x15')](util['format']('[%s][dials][dialend]',_0x28fb8b[_0x3e49('0xb')]),_0x484c8f);}};exports['hangup']=function(_0x22bb1a){try{if(!_[_0x3e49('0x21')](dials[_0x22bb1a['uniqueid']])){utils['debug'](util[_0x3e49('0x4')](_0x3e49('0x29'),_0x22bb1a[_0x3e49('0xb')]),_0x22bb1a);utils[_0x3e49('0x3')](util[_0x3e49('0x4')](_0x3e49('0x2a'),_0x22bb1a[_0x3e49('0xb')],_0x22bb1a[_0x3e49('0x8')],_0x22bb1a[_0x3e49('0x2b')],_0x22bb1a['cause-txt']));dials[_0x22bb1a[_0x3e49('0xb')]]=_[_0x3e49('0x24')](dials[_0x22bb1a[_0x3e49('0xb')]],{'endtime':utils[_0x3e49('0x2c')](),'lastevent':'complete'});dials[_0x22bb1a['uniqueid']]['duration']=utils['diffTime'](dials[_0x22bb1a[_0x3e49('0xb')]][_0x3e49('0x2d')],dials[_0x22bb1a['uniqueid']][_0x3e49('0x2e')]);dials[_0x22bb1a[_0x3e49('0xb')]]['holdtime']=utils[_0x3e49('0x2f')](dials[_0x22bb1a['uniqueid']][_0x3e49('0x25')]||dials[_0x22bb1a['uniqueid']][_0x3e49('0x2d')],dials[_0x22bb1a[_0x3e49('0xb')]][_0x3e49('0x2e')]);dials[_0x22bb1a[_0x3e49('0xb')]]['billableseconds']=dials[_0x22bb1a[_0x3e49('0xb')]][_0x3e49('0x25')]?utils[_0x3e49('0x2f')](dials[_0x22bb1a[_0x3e49('0xb')]][_0x3e49('0x2d')],dials[_0x22bb1a[_0x3e49('0xb')]][_0x3e49('0x25')]):0x0;writeDB(dials[_0x22bb1a['uniqueid']]);}}catch(_0x43ea9a){utils[_0x3e49('0x15')](util['format']('[%s][dials][hangup]',_0x22bb1a[_0x3e49('0xb')]),_0x43ea9a);}}; \ No newline at end of file +var _0x33e9=['dialbegin','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','error','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','starttime','holdtime','diffTime','endtime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','request','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x33e9,0x184));var _0x933e=function(_0x1d5191,_0x9e2c74){_0x1d5191=_0x1d5191-0x0;var _0x3aa495=_0x33e9[_0x1d5191];return _0x3aa495;};'use strict';var _=require(_0x933e('0x0'));var util=require(_0x933e('0x1'));var utils=require(_0x933e('0x2'));var dials={};function writeDB(_0xce3594){utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0x5'),_0xce3594[_0x933e('0x6')],_0xce3594[_0x933e('0x7')],_0xce3594['dialstring'],_0xce3594[_0x933e('0x8')],_0xce3594[_0x933e('0x9')],_0xce3594['dialstatus']));utils[_0x933e('0xa')]('CreateVoiceDialReport',_0xce3594);delete dials[_0xce3594['uniqueid']];}exports[_0x933e('0xb')]=function(_0x52fb4e){try{utils['debug'](util[_0x933e('0x4')](_0x933e('0xc'),_0x52fb4e[_0x933e('0x6')]),_0x52fb4e);utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0xd'),_0x52fb4e[_0x933e('0x6')],_0x52fb4e[_0x933e('0xe')],_0x52fb4e[_0x933e('0xf')]));if(_0x52fb4e[_0x933e('0xe')][_0x933e('0x10')]()=='set'&&_[_0x933e('0x11')](_0x52fb4e[_0x933e('0xf')][_0x933e('0x10')](),_0x933e('0x12'))){var _0x2d3fe2=_0x52fb4e[_0x933e('0xf')][_0x933e('0x13')]('=');dials[_0x52fb4e[_0x933e('0x6')]]={'routeId':_0x2d3fe2[0x1]};}}catch(_0x212f0b){utils['error'](util[_0x933e('0x4')](_0x933e('0xc'),_0x52fb4e[_0x933e('0x6')]),_0x212f0b);}};exports[_0x933e('0x14')]=function(_0x19acb3){try{utils[_0x933e('0x15')](util[_0x933e('0x4')](_0x933e('0x16'),_0x19acb3[_0x933e('0x6')]),_0x19acb3);if(!_[_0x933e('0x17')](_0x19acb3[_0x933e('0x18')][_0x933e('0x19')])){utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0x1a'),_0x19acb3['uniqueid'],_0x19acb3[_0x933e('0x1b')]));dials[_0x19acb3[_0x933e('0x6')]]={'routeId':_0x19acb3['value']};}}catch(_0xb3f6){utils['error'](util[_0x933e('0x4')](_0x933e('0x16'),_0x19acb3[_0x933e('0x6')]),_0xb3f6);}};exports[_0x933e('0x1c')]=function(_0x4f382){try{if(!_['isNil'](dials[_0x4f382[_0x933e('0x6')]])){utils[_0x933e('0x15')](util[_0x933e('0x4')]('[%s][dials][dialbegin]',_0x4f382[_0x933e('0x6')]),_0x4f382);dials[_0x4f382[_0x933e('0x6')]]=_[_0x933e('0x1d')](dials[_0x4f382['uniqueid']],_0x4f382);dials[_0x4f382['uniqueid']]['starttime']=utils['now']();dials[_0x4f382['uniqueid']][_0x933e('0x1e')]=_0x933e('0x1f');utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0x20'),_0x4f382[_0x933e('0x6')],dials[_0x4f382[_0x933e('0x6')]]['starttime']));}}catch(_0x80d80c){utils['error'](util[_0x933e('0x4')](_0x933e('0x21'),_0x4f382[_0x933e('0x6')]),_0x80d80c);}};exports[_0x933e('0x22')]=function(_0x5ecb33){try{if(!_[_0x933e('0x17')](dials[_0x5ecb33[_0x933e('0x6')]])){utils[_0x933e('0x15')](util[_0x933e('0x4')](_0x933e('0x23'),_0x5ecb33[_0x933e('0x6')]),_0x5ecb33);dials[_0x5ecb33['uniqueid']][_0x933e('0x24')]=_0x5ecb33[_0x933e('0x24')];if(_0x5ecb33[_0x933e('0x24')]==_0x933e('0x25')){dials[_0x5ecb33[_0x933e('0x6')]]=_['assign'](dials[_0x5ecb33[_0x933e('0x6')]],_0x5ecb33);dials[_0x5ecb33['uniqueid']][_0x933e('0x26')]=utils[_0x933e('0x27')]();dials[_0x5ecb33['uniqueid']][_0x933e('0x1e')]=_0x933e('0x28');utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0x29'),_0x5ecb33[_0x933e('0x6')],_0x5ecb33[_0x933e('0x24')],dials[_0x5ecb33[_0x933e('0x6')]][_0x933e('0x26')]));}else{utils[_0x933e('0x3')](util[_0x933e('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5ecb33['uniqueid'],_0x5ecb33['dialstatus']));}}}catch(_0x2bfde7){utils[_0x933e('0x2a')](util[_0x933e('0x4')]('[%s][dials][dialend]',_0x5ecb33['uniqueid']),_0x2bfde7);}};exports[_0x933e('0x2b')]=function(_0x31998b){try{if(!_[_0x933e('0x17')](dials[_0x31998b['uniqueid']])){utils[_0x933e('0x15')](util['format']('[%s][dials][hangup]',_0x31998b[_0x933e('0x6')]),_0x31998b);utils[_0x933e('0x3')](util[_0x933e('0x4')](_0x933e('0x2c'),_0x31998b[_0x933e('0x6')],_0x31998b[_0x933e('0x8')],_0x31998b['calleridname'],_0x31998b[_0x933e('0x2d')]));dials[_0x31998b[_0x933e('0x6')]]=_[_0x933e('0x1d')](dials[_0x31998b[_0x933e('0x6')]],{'endtime':utils[_0x933e('0x27')](),'lastevent':'complete'});dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x2e')]=utils['diffTime'](dials[_0x31998b['uniqueid']]['endtime'],dials[_0x31998b['uniqueid']][_0x933e('0x2f')]);dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x30')]=utils[_0x933e('0x31')](dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x26')]||dials[_0x31998b['uniqueid']][_0x933e('0x32')],dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x2f')]);dials[_0x31998b['uniqueid']]['billableseconds']=dials[_0x31998b[_0x933e('0x6')]]['answertime']?utils[_0x933e('0x31')](dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x32')],dials[_0x31998b[_0x933e('0x6')]][_0x933e('0x26')]):0x0;writeDB(dials[_0x31998b[_0x933e('0x6')]]);}}catch(_0x53c1f0){utils['error'](util[_0x933e('0x4')](_0x933e('0x33'),_0x31998b[_0x933e('0x6')]),_0x53c1f0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c80e432..ecf1ca3 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 _0xac58=['debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','[%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]','[%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]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x2e067a,_0xab528c){var _0xc64976=function(_0x53a98e){while(--_0x53a98e){_0x2e067a['push'](_0x2e067a['shift']());}};_0xc64976(++_0xab528c);}(_0xac58,0x1db));var _0x8ac5=function(_0x58ea29,_0x3f7b43){_0x58ea29=_0x58ea29-0x0;var _0x3dc212=_0xac58[_0x58ea29];return _0x3dc212;};var AsteriskManager=require(_0x8ac5('0x0'));var config=require(_0x8ac5('0x1'));var utils=require(_0x8ac5('0x2'));var util=require(_0x8ac5('0x3'));var isXDREnabled=config[_0x8ac5('0x4')]&&config[_0x8ac5('0x4')]['disabled']?!config[_0x8ac5('0x4')][_0x8ac5('0x5')]:!![];var isProduction=config[_0x8ac5('0x6')]===_0x8ac5('0x7')||![];var isLocalAsterisk=config[_0x8ac5('0x4')]&&config['xdr'][_0x8ac5('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x8ac5('0x9')][_0x8ac5('0xa')],config[_0x8ac5('0x9')]['ip'],config[_0x8ac5('0x9')][_0x8ac5('0xb')],config[_0x8ac5('0x9')][_0x8ac5('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x8ac5('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8ac5('0xe')](_0x8ac5('0xf'));}else{var agents=require('./agents.controller');var calls=require(_0x8ac5('0x10'));var queues=require('./queues.controller');var recordings=require(_0x8ac5('0x11'));var members=require(_0x8ac5('0x12'));var dials=require(_0x8ac5('0x13'));var transfers=require(_0x8ac5('0x14'));var core=require(_0x8ac5('0x15'));ami['on']('connect',core[_0x8ac5('0x16')]);ami['on']('shutdown',core[_0x8ac5('0x17')]);ami['on'](_0x8ac5('0x18'),core[_0x8ac5('0x18')]);ami['on'](_0x8ac5('0x19'),core[_0x8ac5('0x19')]);ami['on']('close',core[_0x8ac5('0x1a')]);ami['on'](_0x8ac5('0x1b'),core['managerevent']);ami['on'](_0x8ac5('0x1c'),function(_0x1e5efd){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')]('[%s][index][devicestatechange]',_0x1e5efd['device']),_0x1e5efd);members[_0x8ac5('0x1c')](_0x1e5efd);}catch(_0x5ca518){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x1f'),_0x1e5efd[_0x8ac5('0x20')]),_0x5ca518);}});ami['on']('agentcalled',function(_0xdf89f5){try{utils[_0x8ac5('0x1d')](util['format'](_0x8ac5('0x21'),_0xdf89f5[_0x8ac5('0x22')]),_0xdf89f5);agents[_0x8ac5('0x23')](_0xdf89f5);}catch(_0x3151bc){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x21'),_0xdf89f5[_0x8ac5('0x22')]),_0x3151bc);}});ami['on']('agentringnoanswer',function(_0x4c0743){try{utils[_0x8ac5('0x1d')](util['format'](_0x8ac5('0x24'),_0x4c0743['uniqueid']),_0x4c0743);agents['agentringnoanswer'](_0x4c0743);}catch(_0x39ead7){utils[_0x8ac5('0x19')](util['format'](_0x8ac5('0x24'),_0x4c0743['uniqueid']),_0x39ead7);}});ami['on'](_0x8ac5('0x25'),function(_0x1f7099){try{utils[_0x8ac5('0x1d')](util['format'](_0x8ac5('0x26'),_0x1f7099[_0x8ac5('0x22')]),_0x1f7099);agents[_0x8ac5('0x25')](_0x1f7099);queues[_0x8ac5('0x25')](_0x1f7099);}catch(_0x3a904e){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x26'),_0x1f7099[_0x8ac5('0x22')]),_0x3a904e);}});ami['on'](_0x8ac5('0x27'),function(_0x28f8f9){try{utils[_0x8ac5('0x1d')](util['format'](_0x8ac5('0x28'),_0x28f8f9[_0x8ac5('0x22')]),_0x28f8f9);agents[_0x8ac5('0x27')](_0x28f8f9);queues[_0x8ac5('0x27')](_0x28f8f9);members[_0x8ac5('0x27')](_0x28f8f9);}catch(_0x2263f3){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x28'),_0x28f8f9[_0x8ac5('0x22')]),_0x2263f3);}});ami['on'](_0x8ac5('0x29'),function(_0x173a81){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')](_0x8ac5('0x2a'),_0x173a81[_0x8ac5('0x22')]),_0x173a81);agents[_0x8ac5('0x29')](_0x173a81);queues[_0x8ac5('0x29')](_0x173a81);}catch(_0xdae6e2){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x2a'),_0x173a81[_0x8ac5('0x22')]),_0xdae6e2);}});ami['on']('queuecallerjoin',function(_0x19efe7){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x19efe7[_0x8ac5('0x22')]),_0x19efe7);queues[_0x8ac5('0x2b')](_0x19efe7);recordings[_0x8ac5('0x2b')](_0x19efe7);}catch(_0x3696fc){utils['error'](util['format'](_0x8ac5('0x2c'),_0x19efe7['uniqueid']),_0x3696fc);}});ami['on'](_0x8ac5('0x2d'),function(_0x268196){try{utils['debug'](util[_0x8ac5('0x1e')](_0x8ac5('0x2e'),_0x268196[_0x8ac5('0x22')]),_0x268196);queues[_0x8ac5('0x2d')](_0x268196);}catch(_0x177929){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x2e'),_0x268196['uniqueid']),_0x177929);}});ami['on'](_0x8ac5('0x2f'),function(_0x180a84){try{utils['debug'](util[_0x8ac5('0x1e')](_0x8ac5('0x30'),_0x180a84[_0x8ac5('0x22')]),_0x180a84);queues[_0x8ac5('0x2f')](_0x180a84);calls[_0x8ac5('0x2f')](_0x180a84);}catch(_0x2f6e7f){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x30'),_0x180a84[_0x8ac5('0x22')]),_0x2f6e7f);}});ami['on']('musiconholdstop',function(_0x367386){try{utils['debug'](util['format'](_0x8ac5('0x31'),_0x367386[_0x8ac5('0x22')]),_0x367386);queues['musiconholdstop'](_0x367386);calls[_0x8ac5('0x32')](_0x367386);}catch(_0x429e89){utils[_0x8ac5('0x19')](util['format'](_0x8ac5('0x31'),_0x367386['uniqueid']),_0x429e89);}});ami['on']('newstate',function(_0x1dcc45){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')](_0x8ac5('0x33'),_0x1dcc45[_0x8ac5('0x22')]),_0x1dcc45);calls[_0x8ac5('0x34')](_0x1dcc45);recordings[_0x8ac5('0x34')](_0x1dcc45);}catch(_0x21aa43){utils['error'](util[_0x8ac5('0x1e')](_0x8ac5('0x33'),_0x1dcc45[_0x8ac5('0x22')]),_0x21aa43);}});ami['on'](_0x8ac5('0x35'),function(_0x1fbeff){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')](_0x8ac5('0x36'),_0x1fbeff[_0x8ac5('0x22')]),_0x1fbeff);calls['hangup'](_0x1fbeff);recordings['hangup'](_0x1fbeff);dials[_0x8ac5('0x35')](_0x1fbeff);agents[_0x8ac5('0x35')](_0x1fbeff);queues[_0x8ac5('0x35')](_0x1fbeff);}catch(_0x5d20db){utils['error'](util[_0x8ac5('0x1e')](_0x8ac5('0x36'),_0x1fbeff[_0x8ac5('0x22')]),_0x5d20db);}});ami['on'](_0x8ac5('0x37'),function(_0xb0e37d){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')]('[%s][index][cdr]',_0xb0e37d[_0x8ac5('0x22')]),_0xb0e37d);members[_0x8ac5('0x37')](_0xb0e37d);}catch(_0x1d24bf){utils[_0x8ac5('0x19')](util['format'](_0x8ac5('0x38'),_0xb0e37d[_0x8ac5('0x22')]),_0x1d24bf);}});ami['on']('blindtransfer',function(_0x3f2c1f){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')]('[%s][index][blindtransfer]',_0x3f2c1f['uniqueid']),_0x3f2c1f);queues[_0x8ac5('0x39')](_0x3f2c1f);agents['blindtransfer'](_0x3f2c1f);transfers[_0x8ac5('0x39')](_0x3f2c1f);}catch(_0x46c06d){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x3a'),_0x3f2c1f[_0x8ac5('0x22')]),_0x46c06d);}});ami['on'](_0x8ac5('0x3b'),function(_0x1e3d87){try{utils['debug'](util[_0x8ac5('0x1e')]('[%s][index][attendedtransfer]',_0x1e3d87['origtransfereruniqueid']),_0x1e3d87);queues['attendedtransfer'](_0x1e3d87);transfers[_0x8ac5('0x3b')](_0x1e3d87);agents[_0x8ac5('0x3b')](_0x1e3d87);calls[_0x8ac5('0x3b')](_0x1e3d87);}catch(_0xaa66b0){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x3c'),_0x1e3d87[_0x8ac5('0x3d')]),_0xaa66b0);}});ami['on'](_0x8ac5('0x3e'),function(_0x116c79){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')](_0x8ac5('0x3f'),_0x116c79[_0x8ac5('0x22')]),_0x116c79);queues[_0x8ac5('0x3e')](_0x116c79);recordings['varset'](_0x116c79);calls[_0x8ac5('0x3e')](_0x116c79);dials[_0x8ac5('0x3e')](_0x116c79);}catch(_0x5da6c6){utils['error'](util[_0x8ac5('0x1e')]('[%s][index][varset]',_0x116c79[_0x8ac5('0x22')]),_0x5da6c6);}});ami['on'](_0x8ac5('0x40'),function(_0xd7cbfd){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')]('[%s][index][newexten]',_0xd7cbfd[_0x8ac5('0x22')]),_0xd7cbfd);calls[_0x8ac5('0x40')](_0xd7cbfd);recordings[_0x8ac5('0x40')](_0xd7cbfd);dials['newexten'](_0xd7cbfd);}catch(_0x6468ec){utils[_0x8ac5('0x19')](util['format']('[%s][index][newexten]',_0xd7cbfd['uniqueid']),_0x6468ec);}});ami['on'](_0x8ac5('0x41'),function(_0x41ab46){try{utils[_0x8ac5('0x1d')](util[_0x8ac5('0x1e')]('[%s][index][newchannel]',_0x41ab46['uniqueid']),_0x41ab46);calls[_0x8ac5('0x41')](_0x41ab46);recordings[_0x8ac5('0x41')](_0x41ab46);}catch(_0x2d2df7){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')](_0x8ac5('0x42'),_0x41ab46[_0x8ac5('0x22')]),_0x2d2df7);}});ami['on']('dialbegin',function(_0x55561b){try{utils['debug'](util[_0x8ac5('0x1e')](_0x8ac5('0x43'),_0x55561b[_0x8ac5('0x22')]),_0x55561b);dials[_0x8ac5('0x44')](_0x55561b);}catch(_0x478ba0){utils['error'](util['format'](_0x8ac5('0x45'),_0x55561b[_0x8ac5('0x22')]),_0x478ba0);}});ami['on'](_0x8ac5('0x46'),function(_0x384141){try{utils[_0x8ac5('0x1d')](util['format'](_0x8ac5('0x47'),_0x384141[_0x8ac5('0x22')]),_0x384141);dials[_0x8ac5('0x46')](_0x384141);}catch(_0x5a81c6){utils[_0x8ac5('0x19')](util[_0x8ac5('0x1e')]('[%s][index][dialend]',_0x384141[_0x8ac5('0x22')]),_0x5a81c6);}});} \ No newline at end of file +var _0x6aa0=['device','format','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','port','asterisk','username','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]'];(function(_0x4eae00,_0x3cac00){var _0x479b17=function(_0x3b684b){while(--_0x3b684b){_0x4eae00['push'](_0x4eae00['shift']());}};_0x479b17(++_0x3cac00);}(_0x6aa0,0xb1));var _0x06aa=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6aa0[_0x3c8e9a];return _0x2d4c57;};var AsteriskManager=require(_0x06aa('0x0'));var config=require(_0x06aa('0x1'));var utils=require(_0x06aa('0x2'));var util=require(_0x06aa('0x3'));var isXDREnabled=config[_0x06aa('0x4')]&&config[_0x06aa('0x4')][_0x06aa('0x5')]?!config['xdr']['disabled']:!![];var isProduction=config['env']===_0x06aa('0x6')||![];var isLocalAsterisk=config[_0x06aa('0x4')]&&config[_0x06aa('0x4')][_0x06aa('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x06aa('0x8')],config[_0x06aa('0x9')]['ip'],config[_0x06aa('0x9')][_0x06aa('0xa')],config[_0x06aa('0x9')]['password'],!![]);ami[_0x06aa('0xb')]();if(!isXDREnabled){utils[_0x06aa('0xc')](_0x06aa('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x06aa('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x06aa('0xe'));var calls=require(_0x06aa('0xf'));var queues=require(_0x06aa('0x10'));var recordings=require(_0x06aa('0x11'));var members=require(_0x06aa('0x12'));var dials=require('./dials.controller');var transfers=require(_0x06aa('0x13'));var core=require(_0x06aa('0x14'));ami['on'](_0x06aa('0x15'),core[_0x06aa('0x15')]);ami['on'](_0x06aa('0x16'),core[_0x06aa('0x16')]);ami['on']('fullybooted',core[_0x06aa('0x17')]);ami['on'](_0x06aa('0x18'),core[_0x06aa('0x18')]);ami['on'](_0x06aa('0x19'),core[_0x06aa('0x19')]);ami['on'](_0x06aa('0x1a'),core[_0x06aa('0x1a')]);ami['on'](_0x06aa('0x1b'),function(_0x2538c7){try{utils[_0x06aa('0x1c')](util['format'](_0x06aa('0x1d'),_0x2538c7[_0x06aa('0x1e')]),_0x2538c7);members['devicestatechange'](_0x2538c7);}catch(_0x436783){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x1d'),_0x2538c7[_0x06aa('0x1e')]),_0x436783);}});ami['on'](_0x06aa('0x20'),function(_0x5c7f4d){try{utils['debug'](util[_0x06aa('0x1f')]('[%s][index][agentcalled]',_0x5c7f4d[_0x06aa('0x21')]),_0x5c7f4d);agents[_0x06aa('0x20')](_0x5c7f4d);}catch(_0x5d270b){utils['error'](util[_0x06aa('0x1f')](_0x06aa('0x22'),_0x5c7f4d['uniqueid']),_0x5d270b);}});ami['on'](_0x06aa('0x23'),function(_0x128c84){try{utils['debug'](util[_0x06aa('0x1f')](_0x06aa('0x24'),_0x128c84[_0x06aa('0x21')]),_0x128c84);agents[_0x06aa('0x23')](_0x128c84);}catch(_0x182e13){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x24'),_0x128c84[_0x06aa('0x21')]),_0x182e13);}});ami['on'](_0x06aa('0x25'),function(_0x48cdab){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x26'),_0x48cdab['uniqueid']),_0x48cdab);agents['agentconnect'](_0x48cdab);queues[_0x06aa('0x25')](_0x48cdab);}catch(_0x2bd350){utils['error'](util[_0x06aa('0x1f')](_0x06aa('0x26'),_0x48cdab[_0x06aa('0x21')]),_0x2bd350);}});ami['on'](_0x06aa('0x27'),function(_0x352f39){try{utils[_0x06aa('0x1c')](util['format']('[%s][index][agentcomplete]',_0x352f39[_0x06aa('0x21')]),_0x352f39);agents[_0x06aa('0x27')](_0x352f39);queues[_0x06aa('0x27')](_0x352f39);members[_0x06aa('0x27')](_0x352f39);}catch(_0x41102a){utils['error'](util[_0x06aa('0x1f')]('[%s][index][agentcomplete]',_0x352f39[_0x06aa('0x21')]),_0x41102a);}});ami['on'](_0x06aa('0x28'),function(_0x1c9b02){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x29'),_0x1c9b02[_0x06aa('0x21')]),_0x1c9b02);agents['queuecallerabandon'](_0x1c9b02);queues[_0x06aa('0x28')](_0x1c9b02);}catch(_0x562a5f){utils[_0x06aa('0x18')](util['format'](_0x06aa('0x29'),_0x1c9b02['uniqueid']),_0x562a5f);}});ami['on'](_0x06aa('0x2a'),function(_0x309275){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')]('[%s][index][queuecallerjoin]',_0x309275[_0x06aa('0x21')]),_0x309275);queues[_0x06aa('0x2a')](_0x309275);recordings[_0x06aa('0x2a')](_0x309275);}catch(_0x5d4b79){utils[_0x06aa('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x309275[_0x06aa('0x21')]),_0x5d4b79);}});ami['on'](_0x06aa('0x2b'),function(_0x369b85){try{utils['debug'](util[_0x06aa('0x1f')]('[%s][index][queuecallerleave]',_0x369b85[_0x06aa('0x21')]),_0x369b85);queues[_0x06aa('0x2b')](_0x369b85);}catch(_0x3549b2){utils['error'](util['format']('[%s][index][queuecallerleave]',_0x369b85[_0x06aa('0x21')]),_0x3549b2);}});ami['on']('musiconholdstart',function(_0x315fb3){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x2c'),_0x315fb3[_0x06aa('0x21')]),_0x315fb3);queues[_0x06aa('0x2d')](_0x315fb3);calls[_0x06aa('0x2d')](_0x315fb3);}catch(_0x2aee5a){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')]('[%s][index][musiconholdstart]',_0x315fb3[_0x06aa('0x21')]),_0x2aee5a);}});ami['on'](_0x06aa('0x2e'),function(_0x3fec9e){try{utils['debug'](util['format']('[%s][index][musiconholdstop]',_0x3fec9e[_0x06aa('0x21')]),_0x3fec9e);queues[_0x06aa('0x2e')](_0x3fec9e);calls[_0x06aa('0x2e')](_0x3fec9e);}catch(_0x41a54a){utils['error'](util[_0x06aa('0x1f')](_0x06aa('0x2f'),_0x3fec9e[_0x06aa('0x21')]),_0x41a54a);}});ami['on'](_0x06aa('0x30'),function(_0x4ad763){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x31'),_0x4ad763[_0x06aa('0x21')]),_0x4ad763);calls[_0x06aa('0x30')](_0x4ad763);recordings['newstate'](_0x4ad763);}catch(_0x2d3631){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x31'),_0x4ad763[_0x06aa('0x21')]),_0x2d3631);}});ami['on'](_0x06aa('0x32'),function(_0xb9dbcd){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')]('[%s][index][hangup]',_0xb9dbcd[_0x06aa('0x21')]),_0xb9dbcd);calls[_0x06aa('0x32')](_0xb9dbcd);recordings[_0x06aa('0x32')](_0xb9dbcd);dials[_0x06aa('0x32')](_0xb9dbcd);agents['hangup'](_0xb9dbcd);queues[_0x06aa('0x32')](_0xb9dbcd);}catch(_0x293519){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x33'),_0xb9dbcd[_0x06aa('0x21')]),_0x293519);}});ami['on'](_0x06aa('0x34'),function(_0x1bdba8){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x35'),_0x1bdba8[_0x06aa('0x21')]),_0x1bdba8);members[_0x06aa('0x34')](_0x1bdba8);}catch(_0x4e25a9){utils[_0x06aa('0x18')](util['format']('[%s][index][cdr]',_0x1bdba8['uniqueid']),_0x4e25a9);}});ami['on'](_0x06aa('0x36'),function(_0x1b040f){try{utils[_0x06aa('0x1c')](util['format'](_0x06aa('0x37'),_0x1b040f[_0x06aa('0x21')]),_0x1b040f);queues[_0x06aa('0x36')](_0x1b040f);agents[_0x06aa('0x36')](_0x1b040f);transfers['blindtransfer'](_0x1b040f);}catch(_0x2aeff4){utils['error'](util[_0x06aa('0x1f')](_0x06aa('0x37'),_0x1b040f['uniqueid']),_0x2aeff4);}});ami['on'](_0x06aa('0x38'),function(_0x5f076f){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x39'),_0x5f076f[_0x06aa('0x3a')]),_0x5f076f);queues['attendedtransfer'](_0x5f076f);transfers[_0x06aa('0x38')](_0x5f076f);agents[_0x06aa('0x38')](_0x5f076f);calls[_0x06aa('0x38')](_0x5f076f);}catch(_0x4e5f6d){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x39'),_0x5f076f[_0x06aa('0x3a')]),_0x4e5f6d);}});ami['on'](_0x06aa('0x3b'),function(_0x394b7a){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x3c'),_0x394b7a[_0x06aa('0x21')]),_0x394b7a);queues[_0x06aa('0x3b')](_0x394b7a);recordings['varset'](_0x394b7a);calls['varset'](_0x394b7a);dials[_0x06aa('0x3b')](_0x394b7a);}catch(_0x45a5f6){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')]('[%s][index][varset]',_0x394b7a[_0x06aa('0x21')]),_0x45a5f6);}});ami['on'](_0x06aa('0x3d'),function(_0x42853a){try{utils['debug'](util[_0x06aa('0x1f')](_0x06aa('0x3e'),_0x42853a[_0x06aa('0x21')]),_0x42853a);calls[_0x06aa('0x3d')](_0x42853a);recordings[_0x06aa('0x3d')](_0x42853a);dials['newexten'](_0x42853a);}catch(_0x3c9c57){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x3e'),_0x42853a[_0x06aa('0x21')]),_0x3c9c57);}});ami['on']('newchannel',function(_0x1cc3dc){try{utils['debug'](util[_0x06aa('0x1f')]('[%s][index][newchannel]',_0x1cc3dc['uniqueid']),_0x1cc3dc);calls[_0x06aa('0x3f')](_0x1cc3dc);recordings[_0x06aa('0x3f')](_0x1cc3dc);}catch(_0x263aa7){utils[_0x06aa('0x18')](util['format'](_0x06aa('0x40'),_0x1cc3dc[_0x06aa('0x21')]),_0x263aa7);}});ami['on'](_0x06aa('0x41'),function(_0x2b1ae7){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x42'),_0x2b1ae7[_0x06aa('0x21')]),_0x2b1ae7);dials[_0x06aa('0x41')](_0x2b1ae7);}catch(_0x524ca3){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')]('[%s]dialbegin',_0x2b1ae7[_0x06aa('0x21')]),_0x524ca3);}});ami['on'](_0x06aa('0x43'),function(_0x2887e8){try{utils[_0x06aa('0x1c')](util[_0x06aa('0x1f')](_0x06aa('0x44'),_0x2887e8[_0x06aa('0x21')]),_0x2887e8);dials[_0x06aa('0x43')](_0x2887e8);}catch(_0x5f33d5){utils[_0x06aa('0x18')](util[_0x06aa('0x1f')](_0x06aa('0x44'),_0x2887e8[_0x06aa('0x21')]),_0x5f33d5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a7a4fb6..8003599 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 _0x2295=['name','internal','request','getUserByName','split','[%s][members][writeDB]','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then'];(function(_0x482d06,_0x1c7c4a){var _0x3bdd88=function(_0x476f12){while(--_0x476f12){_0x482d06['push'](_0x482d06['shift']());}};_0x3bdd88(++_0x1c7c4a);}(_0x2295,0xb6));var _0x5229=function(_0x4d800b,_0x447e9e){_0x4d800b=_0x4d800b-0x0;var _0x594635=_0x2295[_0x4d800b];return _0x594635;};'use strict';var _=require('lodash');var util=require(_0x5229('0x0'));var utils=require(_0x5229('0x1'));var members={};var exclude=[_0x5229('0x2'),_0x5229('0x3')];function writeDB(_0x4b6b8e){utils['info'](util[_0x5229('0x4')](_0x5229('0x5'),_0x4b6b8e[_0x5229('0x6')],_0x4b6b8e['interface'],_0x4b6b8e[_0x5229('0x7')],_0x4b6b8e[_0x5229('0x8')],_0x4b6b8e[_0x5229('0x9')],_0x4b6b8e[_0x5229('0xa')]));if(_0x4b6b8e[_0x5229('0xb')]){utils[_0x5229('0xc')](_0x4b6b8e['interface'])[_0x5229('0xd')](function(_0x159bd7){if(_0x159bd7){_0x4b6b8e[_0x5229('0x9')]=_0x159bd7[_0x5229('0xe')];_0x4b6b8e[_0x5229('0xf')]=_0x159bd7[_0x5229('0xf')];utils[_0x5229('0x10')]('CreateMemberReport',_0x4b6b8e);}else{utils[_0x5229('0x11')](_0x4b6b8e[_0x5229('0xb')][_0x5229('0x12')]('/')[0x1])[_0x5229('0xd')](function(_0x3d6de9){if(_0x3d6de9){_0x4b6b8e[_0x5229('0x9')]=_0x3d6de9[_0x5229('0xe')];_0x4b6b8e[_0x5229('0xf')]=_0x3d6de9[_0x5229('0xf')];utils[_0x5229('0x10')]('CreateMemberReport',_0x4b6b8e);}});}})['catch'](function(_0x55ff55){utils['error'](util[_0x5229('0x4')](_0x5229('0x13'),_0x4b6b8e[_0x5229('0x6')]),_0x55ff55);});}delete members[_0x4b6b8e[_0x5229('0xb')]];}function startsWith(_0x24fb23,_0x50a69c){return _['some'](_0x24fb23,function(_0xeaa54e){return _['startsWith'](_0x50a69c,_0xeaa54e);});}exports['devicestatechange']=function(_0x8bc8cd){try{utils[_0x5229('0x14')](util[_0x5229('0x4')]('[%s][members][devicestatechange]',members[_0x8bc8cd[_0x5229('0x15')]]?members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x6')]:_0x8bc8cd[_0x5229('0x15')]),_0x8bc8cd);utils[_0x5229('0x16')](util[_0x5229('0x4')](_0x5229('0x17'),members[_0x8bc8cd[_0x5229('0x15')]]?members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x6')]:_0x8bc8cd[_0x5229('0x15')],_0x8bc8cd[_0x5229('0x18')],_0x8bc8cd[_0x5229('0x15')]));switch(_0x8bc8cd['state']){case _0x5229('0x19'):case _0x5229('0x1a'):if(!startsWith(exclude,_0x8bc8cd[_0x5229('0x15')])){members[_0x8bc8cd[_0x5229('0x15')]]={'channel':_0x5229('0x1b'),'interface':_0x8bc8cd['device'],'type':_0x5229('0x1c'),'enterAt':utils[_0x5229('0x1d')](),'role':'agent'};}break;case _0x5229('0x1e'):if(!_[_0x5229('0x1f')](members[_0x8bc8cd[_0x5229('0x15')]])){members[_0x8bc8cd['device']][_0x5229('0x20')]=utils[_0x5229('0x1d')]();members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x21')]=utils[_0x5229('0x22')](members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x20')],members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x23')]);if(members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x6')]){writeDB(members[_0x8bc8cd[_0x5229('0x15')]]);}}break;default:break;}}catch(_0x38a9e6){utils[_0x5229('0x24')](util[_0x5229('0x4')](_0x5229('0x25'),members[_0x8bc8cd[_0x5229('0x15')]]?members[_0x8bc8cd[_0x5229('0x15')]][_0x5229('0x6')]:_0x8bc8cd[_0x5229('0x15')]),_0x38a9e6);}};exports[_0x5229('0x26')]=function(_0x58bc77){try{if(!_[_0x5229('0x1f')](members[_0x58bc77[_0x5229('0xb')]])){utils[_0x5229('0x14')](util[_0x5229('0x4')]('[%s][members][agentcomplete]',_0x58bc77[_0x5229('0x6')]),_0x58bc77);utils[_0x5229('0x16')](util[_0x5229('0x4')](_0x5229('0x27'),_0x58bc77['uniqueid'],_0x58bc77[_0x5229('0xb')],_0x58bc77[_0x5229('0x28')]));members[_0x58bc77[_0x5229('0xb')]]=_[_0x5229('0x29')](members[_0x58bc77[_0x5229('0xb')]],{'data4':_0x58bc77[_0x5229('0x28')],'uniqueid':_0x58bc77[_0x5229('0x6')]});}}catch(_0x26c2bb){utils[_0x5229('0x24')](util['format']('[%s][members][agentcomplete]',_0x58bc77[_0x5229('0x6')]),_0x26c2bb);}};exports[_0x5229('0x2a')]=function(_0x34b7fd){try{utils[_0x5229('0x14')](util[_0x5229('0x4')]('[%s][members][cdr]',_0x34b7fd[_0x5229('0x6')]),_0x34b7fd);if(_0x34b7fd[_0x5229('0x7')]){var _0x15b636=_0x34b7fd[_0x5229('0x7')][_0x5229('0x12')]('-')[0x0];if(!_[_0x5229('0x1f')](members[_0x15b636])){members[_0x15b636]=_[_0x5229('0x29')](members[_0x15b636],{'data1':members[_0x15b636][_0x5229('0x2b')]||_0x34b7fd[_0x5229('0xa')],'data2':members[_0x15b636][_0x5229('0x8')]||_0x34b7fd[_0x5229('0x2c')],'data3':members[_0x15b636]['data3']||_0x34b7fd[_0x5229('0x2d')],'uniqueid':members[_0x15b636]['uniqueid']||_0x34b7fd[_0x5229('0x6')]});utils[_0x5229('0x16')](util[_0x5229('0x4')](_0x5229('0x2e'),_0x34b7fd['uniqueid'],members[_0x15b636]['data1'],members[_0x15b636]['data2'],members[_0x15b636]['data3']));if(members[_0x15b636][_0x5229('0x20')]){writeDB(members[_0x15b636]);}}}if(_0x34b7fd[_0x5229('0x2f')]){var _0x3b08ac=_0x34b7fd[_0x5229('0x2f')][_0x5229('0x12')]('-')[0x0];if(!_['isNil'](members[_0x3b08ac])){members[_0x3b08ac]=_['assign'](members[_0x3b08ac],{'data1':members[_0x3b08ac][_0x5229('0x2b')]||_0x34b7fd[_0x5229('0xa')],'data2':members[_0x3b08ac][_0x5229('0x8')]||_0x34b7fd[_0x5229('0x2c')],'data3':members[_0x3b08ac]['data3']||_0x34b7fd[_0x5229('0x2d')],'uniqueid':members[_0x3b08ac][_0x5229('0x6')]||_0x34b7fd[_0x5229('0x6')]});utils[_0x5229('0x16')](util['format'](_0x5229('0x2e'),_0x34b7fd[_0x5229('0x6')],members[_0x3b08ac][_0x5229('0x2b')],members[_0x3b08ac][_0x5229('0x8')],members[_0x3b08ac][_0x5229('0x30')]));if(members[_0x3b08ac]['exitAt']){writeDB(members[_0x3b08ac]);}}}}catch(_0x4b0536){utils[_0x5229('0x24')](util[_0x5229('0x4')]('[%s][members][cdr]',_0x34b7fd[_0x5229('0x6')]),_0x4b0536);}}; \ No newline at end of file +var _0x6d66=['source','data1','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','format','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','assign','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x6d66,0x9c));var _0x66d6=function(_0x52dfb6,_0xd5f97){_0x52dfb6=_0x52dfb6-0x0;var _0x45d9e9=_0x6d66[_0x52dfb6];return _0x45d9e9;};'use strict';var _=require(_0x66d6('0x0'));var util=require(_0x66d6('0x1'));var utils=require(_0x66d6('0x2'));var members={};var exclude=[_0x66d6('0x3'),'Queue:'];function writeDB(_0x12d820){utils['info'](util[_0x66d6('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x12d820['uniqueid'],_0x12d820[_0x66d6('0x5')],_0x12d820[_0x66d6('0x6')],_0x12d820[_0x66d6('0x7')],_0x12d820[_0x66d6('0x8')],_0x12d820[_0x66d6('0x9')]));if(_0x12d820[_0x66d6('0x5')]){utils[_0x66d6('0xa')](_0x12d820[_0x66d6('0x5')])[_0x66d6('0xb')](function(_0x47a275){if(_0x47a275){_0x12d820['membername']=_0x47a275[_0x66d6('0xc')];_0x12d820[_0x66d6('0xd')]=_0x47a275[_0x66d6('0xd')];utils[_0x66d6('0xe')](_0x66d6('0xf'),_0x12d820);}else{utils[_0x66d6('0x10')](_0x12d820[_0x66d6('0x5')][_0x66d6('0x11')]('/')[0x1])[_0x66d6('0xb')](function(_0x3d4819){if(_0x3d4819){_0x12d820['membername']=_0x3d4819[_0x66d6('0xc')];_0x12d820[_0x66d6('0xd')]=_0x3d4819[_0x66d6('0xd')];utils[_0x66d6('0xe')](_0x66d6('0xf'),_0x12d820);}});}})['catch'](function(_0x1e4503){utils[_0x66d6('0x12')](util[_0x66d6('0x4')](_0x66d6('0x13'),_0x12d820['uniqueid']),_0x1e4503);});}delete members[_0x12d820[_0x66d6('0x5')]];}function startsWith(_0x156323,_0x3da88b){return _['some'](_0x156323,function(_0x36e04b){return _[_0x66d6('0x14')](_0x3da88b,_0x36e04b);});}exports[_0x66d6('0x15')]=function(_0x5a5f8f){try{utils[_0x66d6('0x16')](util[_0x66d6('0x4')](_0x66d6('0x17'),members[_0x5a5f8f[_0x66d6('0x18')]]?members[_0x5a5f8f['device']][_0x66d6('0x19')]:_0x5a5f8f['device']),_0x5a5f8f);utils[_0x66d6('0x1a')](util['format'](_0x66d6('0x1b'),members[_0x5a5f8f[_0x66d6('0x18')]]?members[_0x5a5f8f[_0x66d6('0x18')]]['uniqueid']:_0x5a5f8f[_0x66d6('0x18')],_0x5a5f8f[_0x66d6('0x1c')],_0x5a5f8f[_0x66d6('0x18')]));switch(_0x5a5f8f[_0x66d6('0x1c')]){case _0x66d6('0x1d'):case _0x66d6('0x1e'):if(!startsWith(exclude,_0x5a5f8f['device'])){members[_0x5a5f8f[_0x66d6('0x18')]]={'channel':'voice','interface':_0x5a5f8f[_0x66d6('0x18')],'type':'TALKING','enterAt':utils[_0x66d6('0x1f')](),'role':'agent'};}break;case _0x66d6('0x20'):if(!_[_0x66d6('0x21')](members[_0x5a5f8f[_0x66d6('0x18')]])){members[_0x5a5f8f[_0x66d6('0x18')]][_0x66d6('0x22')]=utils['now']();members[_0x5a5f8f['device']][_0x66d6('0x23')]=utils[_0x66d6('0x24')](members[_0x5a5f8f[_0x66d6('0x18')]][_0x66d6('0x22')],members[_0x5a5f8f[_0x66d6('0x18')]][_0x66d6('0x25')]);if(members[_0x5a5f8f[_0x66d6('0x18')]]['uniqueid']){writeDB(members[_0x5a5f8f[_0x66d6('0x18')]]);}}break;default:break;}}catch(_0x451480){utils['error'](util[_0x66d6('0x4')]('[%s][members][devicestatechange]',members[_0x5a5f8f[_0x66d6('0x18')]]?members[_0x5a5f8f[_0x66d6('0x18')]][_0x66d6('0x19')]:_0x5a5f8f[_0x66d6('0x18')]),_0x451480);}};exports[_0x66d6('0x26')]=function(_0x55dc37){try{if(!_['isNil'](members[_0x55dc37[_0x66d6('0x5')]])){utils[_0x66d6('0x16')](util['format'](_0x66d6('0x27'),_0x55dc37[_0x66d6('0x19')]),_0x55dc37);utils['info'](util[_0x66d6('0x4')](_0x66d6('0x28'),_0x55dc37['uniqueid'],_0x55dc37[_0x66d6('0x5')],_0x55dc37[_0x66d6('0x29')]));members[_0x55dc37[_0x66d6('0x5')]]=_['assign'](members[_0x55dc37[_0x66d6('0x5')]],{'data4':_0x55dc37[_0x66d6('0x29')],'uniqueid':_0x55dc37[_0x66d6('0x19')]});}}catch(_0x4db862){utils[_0x66d6('0x12')](util['format']('[%s][members][agentcomplete]',_0x55dc37[_0x66d6('0x19')]),_0x4db862);}};exports[_0x66d6('0x2a')]=function(_0x1db520){try{utils[_0x66d6('0x16')](util['format']('[%s][members][cdr]',_0x1db520[_0x66d6('0x19')]),_0x1db520);if(_0x1db520[_0x66d6('0x6')]){var _0x4ef4c4=_0x1db520[_0x66d6('0x6')][_0x66d6('0x11')]('-')[0x0];if(!_[_0x66d6('0x21')](members[_0x4ef4c4])){members[_0x4ef4c4]=_[_0x66d6('0x2b')](members[_0x4ef4c4],{'data1':members[_0x4ef4c4]['data1']||_0x1db520[_0x66d6('0x9')],'data2':members[_0x4ef4c4][_0x66d6('0x7')]||_0x1db520['source'],'data3':members[_0x4ef4c4][_0x66d6('0x2c')]||_0x1db520[_0x66d6('0x2d')],'uniqueid':members[_0x4ef4c4][_0x66d6('0x19')]||_0x1db520[_0x66d6('0x19')]});utils['info'](util[_0x66d6('0x4')](_0x66d6('0x2e'),_0x1db520[_0x66d6('0x19')],members[_0x4ef4c4]['data1'],members[_0x4ef4c4]['data2'],members[_0x4ef4c4][_0x66d6('0x2c')]));if(members[_0x4ef4c4][_0x66d6('0x22')]){writeDB(members[_0x4ef4c4]);}}}if(_0x1db520[_0x66d6('0x2f')]){var _0x33d4d2=_0x1db520['destinationchannel'][_0x66d6('0x11')]('-')[0x0];if(!_[_0x66d6('0x21')](members[_0x33d4d2])){members[_0x33d4d2]=_[_0x66d6('0x2b')](members[_0x33d4d2],{'data1':members[_0x33d4d2]['data1']||_0x1db520[_0x66d6('0x9')],'data2':members[_0x33d4d2]['data2']||_0x1db520[_0x66d6('0x30')],'data3':members[_0x33d4d2][_0x66d6('0x2c')]||_0x1db520[_0x66d6('0x2d')],'uniqueid':members[_0x33d4d2][_0x66d6('0x19')]||_0x1db520[_0x66d6('0x19')]});utils['info'](util[_0x66d6('0x4')](_0x66d6('0x2e'),_0x1db520[_0x66d6('0x19')],members[_0x33d4d2][_0x66d6('0x31')],members[_0x33d4d2][_0x66d6('0x7')],members[_0x33d4d2][_0x66d6('0x2c')]));if(members[_0x33d4d2][_0x66d6('0x22')]){writeDB(members[_0x33d4d2]);}}}}catch(_0x53bf6b){utils[_0x66d6('0x12')](util[_0x66d6('0x4')](_0x66d6('0x32'),_0x1db520[_0x66d6('0x19')]),_0x53bf6b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 62f4a8c..dbd70cd 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 _0x5def=['calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','accountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','transfertype','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid'];(function(_0x1ea338,_0x156226){var _0x2c428b=function(_0x1bcca9){while(--_0x1bcca9){_0x1ea338['push'](_0x1ea338['shift']());}};_0x2c428b(++_0x156226);}(_0x5def,0xdd));var _0xf5de=function(_0x81a26e,_0x4a6f01){_0x81a26e=_0x81a26e-0x0;var _0x343910=_0x5def[_0x81a26e];return _0x343910;};'use strict';var _=require(_0xf5de('0x0'));var util=require('util');var utils=require(_0xf5de('0x1'));var queues={};function writeDB(_0x4f60a7){utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x4'),_0x4f60a7['uniqueid'],_0x4f60a7[_0xf5de('0x5')],_0x4f60a7[_0xf5de('0x6')],_0x4f60a7['lastAssignedTo'],_0x4f60a7[_0xf5de('0x7')],_0x4f60a7['accountcode'],_0x4f60a7[_0xf5de('0x8')]));if(_0x4f60a7[_0xf5de('0x6')]){utils['getVoiceQueueByName'](_0x4f60a7[_0xf5de('0x6')])[_0xf5de('0x9')](function(_0x10d85){if(_0x10d85){_0x4f60a7[_0xf5de('0xa')]=_0x10d85[_0xf5de('0xa')];}utils[_0xf5de('0xb')]('CreateVoiceQueueReport',_0x4f60a7);});}else{utils['request'](_0xf5de('0xc'),_0x4f60a7);}if(_0x4f60a7['transfereduniqueid']){delete queues[_0x4f60a7[_0xf5de('0xd')]];}else{delete queues[_0x4f60a7[_0xf5de('0xe')]];}}exports['queuecallerjoin']=function(_0x10087f){try{utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x10'),_0x10087f[_0xf5de('0xe')]),_0x10087f);utils['info'](util[_0xf5de('0x3')](_0xf5de('0x11'),_0x10087f[_0xf5de('0xe')],_0x10087f[_0xf5de('0x6')],_0x10087f[_0xf5de('0x12')]));queues[_0x10087f[_0xf5de('0xe')]]=_['assign'](_0x10087f,{'originalposition':_0x10087f['position'],'queuecallerjoinAt':utils[_0xf5de('0x13')](),'mohtime':0x0});}catch(_0x4962f5){utils[_0xf5de('0x14')](util[_0xf5de('0x3')](_0xf5de('0x10'),_0x10087f[_0xf5de('0xe')]),_0x4962f5);}};exports[_0xf5de('0x15')]=function(_0x591c0e){try{if(!_['isNil'](queues[_0x591c0e[_0xf5de('0xe')]])){utils['debug'](util[_0xf5de('0x3')](_0xf5de('0x16'),_0x591c0e[_0xf5de('0xe')]),_0x591c0e);if(queues[_0x591c0e['uniqueid']][_0xf5de('0x17')]){if(!queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0x18')]&&!queues[_0x591c0e[_0xf5de('0xe')]]['queuecallerexit']){queues[_0x591c0e[_0xf5de('0xe')]]['queuecallercomplete']=!![];queues[_0x591c0e['uniqueid']][_0xf5de('0x19')]=utils['now']();queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0x8')]=_0xf5de('0x1a');}utils['info'](util[_0xf5de('0x3')](_0xf5de('0x1b'),_0x591c0e['uniqueid'],queues[_0x591c0e[_0xf5de('0xe')]]['name'],queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0x8')]));writeDB(queues[_0x591c0e[_0xf5de('0xe')]]);}else if(queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0xd')]){utils[_0xf5de('0x2')](util[_0xf5de('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x591c0e[_0xf5de('0xe')],queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0x1c')],queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0xd')]));queues[queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0xd')]]=queues[_0x591c0e[_0xf5de('0xe')]];queues[queues[_0x591c0e[_0xf5de('0xe')]][_0xf5de('0xd')]][_0xf5de('0x1d')]=0x2;delete queues[_0x591c0e['uniqueid']];}}}catch(_0x46a54f){utils[_0xf5de('0x14')](util[_0xf5de('0x3')](_0xf5de('0x16'),_0x591c0e['uniqueid']),_0x46a54f);}};exports[_0xf5de('0x1e')]=function(_0x5e4018){try{utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x1f'),_0x5e4018['uniqueid']),_0x5e4018);if(!_[_0xf5de('0x20')](_0x5e4018['variable']['queuestatus'])&&_0x5e4018['value'][_0xf5de('0x21')]()!==_0xf5de('0x22')){if(!_[_0xf5de('0x20')](queues[_0x5e4018[_0xf5de('0xe')]])){queues[_0x5e4018['uniqueid']][_0xf5de('0x18')]=![];queues[_0x5e4018[_0xf5de('0xe')]][_0xf5de('0x23')]=null;queues[_0x5e4018['uniqueid']][_0xf5de('0x24')]=!![];queues[_0x5e4018[_0xf5de('0xe')]]['queuecallerexitAt']=utils[_0xf5de('0x13')]();queues[_0x5e4018[_0xf5de('0xe')]][_0xf5de('0x8')]=_0x5e4018['value'][_0xf5de('0x21')]();utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x25'),_0x5e4018[_0xf5de('0xe')],queues[_0x5e4018['uniqueid']][_0xf5de('0x1c')],_0x5e4018[_0xf5de('0x26')],queues[_0x5e4018[_0xf5de('0xe')]][_0xf5de('0x8')]));writeDB(queues[_0x5e4018['uniqueid']]);}}else if(!_[_0xf5de('0x20')](_0x5e4018[_0xf5de('0x27')][_0xf5de('0x28')])){if(!_[_0xf5de('0x20')](queues[_0x5e4018[_0xf5de('0xe')]])&&!queues[_0x5e4018['uniqueid']]['queuecallerabandon']){queues[_0x5e4018[_0xf5de('0xe')]][_0xf5de('0x18')]=![];queues[_0x5e4018['uniqueid']][_0xf5de('0x23')]=null;queues[_0x5e4018['uniqueid']][_0xf5de('0x24')]=!![];queues[_0x5e4018[_0xf5de('0xe')]][_0xf5de('0x29')]=utils['now']();queues[_0x5e4018['uniqueid']][_0xf5de('0x8')]=_0xf5de('0x2a');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5e4018[_0xf5de('0xe')],queues[_0x5e4018['uniqueid']][_0xf5de('0x1c')],_0x5e4018[_0xf5de('0x26')],queues[_0x5e4018['uniqueid']][_0xf5de('0x8')]));}}}catch(_0x48b7bd){utils['error'](util[_0xf5de('0x3')](_0xf5de('0x1f'),_0x5e4018['uniqueid']),_0x48b7bd);}};exports['queuecallerabandon']=function(_0x1255b6){try{if(!_[_0xf5de('0x20')](queues[_0x1255b6[_0xf5de('0xe')]])){utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x2b'),_0x1255b6[_0xf5de('0xe')]),_0x1255b6);queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x24')]=![];queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x29')]=null;queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x18')]=!![];queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x23')]=utils['now']();queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x8')]=_0xf5de('0x2c');utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x2d'),_0x1255b6[_0xf5de('0xe')],queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x1c')],queues[_0x1255b6[_0xf5de('0xe')]][_0xf5de('0x8')]));}}catch(_0xec5df6){utils[_0xf5de('0x14')](util['format']('[%s][queues][queuecallerabandon]',_0x1255b6[_0xf5de('0xe')]),_0xec5df6);}};exports[_0xf5de('0x2e')]=function(_0x1f44de){try{if(!_[_0xf5de('0x20')](queues[_0x1f44de[_0xf5de('0xe')]])){utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x2f'),_0x1f44de[_0xf5de('0xe')]),_0x1f44de);utils[_0xf5de('0x2')](util[_0xf5de('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1f44de[_0xf5de('0xe')],queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x1c')],_0x1f44de[_0xf5de('0x30')],_0x1f44de[_0xf5de('0x31')]));queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x2e')]=!![];queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x17')]=utils[_0xf5de('0x13')]();queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x32')]=utils[_0xf5de('0x33')](queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x17')],queues[_0x1f44de['uniqueid']][_0xf5de('0x34')]);queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x12')]=_0x1f44de[_0xf5de('0x12')];queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x35')]=_0x1f44de[_0xf5de('0x35')];queues[_0x1f44de[_0xf5de('0xe')]][_0xf5de('0x30')]=_0x1f44de[_0xf5de('0x30')];queues[_0x1f44de['uniqueid']][_0xf5de('0x31')]=_0x1f44de[_0xf5de('0x31')];}}catch(_0x5e05fa){utils[_0xf5de('0x14')](util[_0xf5de('0x3')](_0xf5de('0x2f'),_0x1f44de[_0xf5de('0xe')]),_0x5e05fa);}};exports[_0xf5de('0x36')]=function(_0x3cc6e2){try{if(!_['isNil'](queues[_0x3cc6e2[_0xf5de('0xe')]])){utils['debug'](util[_0xf5de('0x3')](_0xf5de('0x37'),_0x3cc6e2['uniqueid']),_0x3cc6e2);utils[_0xf5de('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3cc6e2['uniqueid'],queues[_0x3cc6e2[_0xf5de('0xe')]]['name'],_0x3cc6e2[_0xf5de('0x38')],_0x3cc6e2[_0xf5de('0x39')]));queues[_0x3cc6e2['uniqueid']][_0xf5de('0x18')]=![];queues[_0x3cc6e2[_0xf5de('0xe')]]['queuecallerabandon']=![];queues[_0x3cc6e2[_0xf5de('0xe')]]['queuecallerabandonAt']=null;queues[_0x3cc6e2[_0xf5de('0xe')]][_0xf5de('0x24')]=![];queues[_0x3cc6e2[_0xf5de('0xe')]]['queuecallerexitreason']=null;queues[_0x3cc6e2[_0xf5de('0xe')]][_0xf5de('0x29')]=null;queues[_0x3cc6e2[_0xf5de('0xe')]][_0xf5de('0x3a')]=!![];queues[_0x3cc6e2['uniqueid']][_0xf5de('0x3b')]=_0x3cc6e2[_0xf5de('0x39')];queues[_0x3cc6e2[_0xf5de('0xe')]][_0xf5de('0x3c')]=_0x3cc6e2[_0xf5de('0x38')];}}catch(_0x2b52c8){utils[_0xf5de('0x14')](util['format'](_0xf5de('0x37'),_0x3cc6e2['uniqueid']),_0x2b52c8);}};exports[_0xf5de('0x3d')]=function(_0x21f63c){try{if(!_[_0xf5de('0x20')](queues[_0x21f63c[_0xf5de('0xe')]])){if(queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x17')]){utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x3e'),_0x21f63c[_0xf5de('0xe')]),_0x21f63c);queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x18')]=![];queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x18')]=![];queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x23')]=null;queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x24')]=![];queues[_0x21f63c[_0xf5de('0xe')]]['queuecallerexitAt']=null;queues[_0x21f63c[_0xf5de('0xe')]]['assigned']=!![];queues[_0x21f63c[_0xf5de('0xe')]]['lastAssignedTo']=_0x21f63c['membername'];queues[_0x21f63c[_0xf5de('0xe')]]['queuecallercomplete']=!![];queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x19')]=utils[_0xf5de('0x13')]();if(_0x21f63c[_0xf5de('0x3f')]==_0xf5de('0x40')){if(!queues[_0x21f63c['uniqueid']]['transfer']){queues[_0x21f63c[_0xf5de('0xe')]]['queuecallerexitreason']=_0xf5de('0x41');}}else{queues[_0x21f63c[_0xf5de('0xe')]][_0xf5de('0x8')]=_0xf5de('0x42')+_0x21f63c[_0xf5de('0x3f')][_0xf5de('0x21')]();}utils['info'](util[_0xf5de('0x3')](_0xf5de('0x43'),_0x21f63c[_0xf5de('0xe')],queues[_0x21f63c['uniqueid']][_0xf5de('0x1c')],_0x21f63c[_0xf5de('0x38')],queues[_0x21f63c['uniqueid']][_0xf5de('0x8')]));writeDB(queues[_0x21f63c[_0xf5de('0xe')]]);}}}catch(_0x562c35){utils['error'](util[_0xf5de('0x3')](_0xf5de('0x3e'),_0x21f63c[_0xf5de('0xe')]),_0x562c35);}};exports[_0xf5de('0x44')]=function(_0x18bae7){try{if(!_['isNil'](queues[_0x18bae7['transfereeuniqueid']])){utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x45'),_0x18bae7[_0xf5de('0xe')]),_0x18bae7);queues[_0x18bae7[_0xf5de('0x46')]]['transfer']=!![];queues[_0x18bae7[_0xf5de('0x46')]]['transfertype']=_0xf5de('0x47');queues[_0x18bae7[_0xf5de('0x46')]]['transferexten']=_0x18bae7[_0xf5de('0x48')];queues[_0x18bae7['transfereeuniqueid']][_0xf5de('0x49')]=_0x18bae7[_0xf5de('0x46')];queues[_0x18bae7[_0xf5de('0x46')]][_0xf5de('0x8')]=_0xf5de('0x4a');utils[_0xf5de('0x2')](util['format'](_0xf5de('0x4b'),_0x18bae7['uniqueid'],queues[_0x18bae7[_0xf5de('0x46')]][_0xf5de('0x1c')],_0x18bae7[_0xf5de('0x46')],_0x18bae7[_0xf5de('0x48')]));}}catch(_0x23cec6){utils[_0xf5de('0x14')](util['format'](_0xf5de('0x45'),_0x18bae7[_0xf5de('0xe')]),_0x23cec6);}};exports[_0xf5de('0x4c')]=function(_0x136481){try{utils['debug'](util['format'](_0xf5de('0x4d'),_0x136481['origtransfereruniqueid']),_0x136481);if(_0x136481[_0xf5de('0x4e')]==_0x136481['origtransfererlinkedid']){if(!_['isNil'](queues[_0x136481[_0xf5de('0x4f')]])){utils[_0xf5de('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x1c')],_0x136481['origtransfererexten']));queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x40')]=!![];queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x50')]=_0xf5de('0x51');queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x52')]=_0x136481[_0xf5de('0x53')];queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x49')]=_0x136481[_0xf5de('0x4e')];queues[_0x136481[_0xf5de('0x4f')]]['queuecallerexitreason']=_0xf5de('0x54');}if(!_[_0xf5de('0x20')](queues[_0x136481[_0xf5de('0x55')]])){if(_0x136481['transfereelinkedid']&&queues[_0x136481['transfereelinkedid']]){queues[_0x136481[_0xf5de('0x56')]][_0xf5de('0x1d')]=0x1;queues[_0x136481[_0xf5de('0x46')]]=_['clone'](queues[_0x136481['transfereelinkedid']]);queues[_0x136481[_0xf5de('0x46')]]['transfereduniqueid']=_0x136481[_0xf5de('0x57')];queues[_0x136481[_0xf5de('0x46')]]['queuecallerenterreason']=0x2;queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x7')]=queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x7')];queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x58')]=queues[_0x136481['secondtransfererlinkedid']][_0xf5de('0x58')];queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x34')]=utils[_0xf5de('0x13')]();queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x17')]=utils[_0xf5de('0x13')]();queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x32')]=0x0;queues[_0x136481['transfereeuniqueid']][_0xf5de('0x59')]=0x0;utils[_0xf5de('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x1c')],queues[_0x136481[_0xf5de('0x46')]]['calleridnum'],queues[_0x136481[_0xf5de('0x46')]][_0xf5de('0x58')]));}else{utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x5a'),_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0x1c')],_0x136481[_0xf5de('0x4f')]));queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0xd')]=_0x136481[_0xf5de('0x4f')];}}}else if(_0x136481[_0xf5de('0x5b')]==_0x136481[_0xf5de('0x4f')]){if(!_[_0xf5de('0x20')](queues[_0x136481[_0xf5de('0x55')]])){utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x5c'),_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0x1c')],_0x136481[_0xf5de('0x5b')],_0x136481[_0xf5de('0x5d')]));queues[_0x136481['origtransfererlinkedid']]['transfer']=!![];queues[_0x136481[_0xf5de('0x55')]]['transfertype']=_0xf5de('0x51');queues[_0x136481[_0xf5de('0x55')]]['transferexten']=_0x136481[_0xf5de('0x5d')];queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0x49')]=_0x136481[_0xf5de('0x5b')];queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0x8')]=_0xf5de('0x54');}if(!_[_0xf5de('0x20')](queues[_0x136481[_0xf5de('0x4f')]])){if(_0x136481[_0xf5de('0x5e')]&&queues[_0x136481['transfertargetlinkedid']]){queues[_0x136481[_0xf5de('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x136481['transfertargetuniqueid']]=_['clone'](queues[_0x136481[_0xf5de('0x5e')]]);queues[_0x136481[_0xf5de('0x57')]][_0xf5de('0xd')]=_0x136481[_0xf5de('0x57')];queues[_0x136481['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x136481['transfertargetuniqueid']]['calleridnum']=queues[_0x136481[_0xf5de('0x55')]][_0xf5de('0x7')];queues[_0x136481[_0xf5de('0x57')]]['calleridname']=queues[_0x136481['origtransfererlinkedid']][_0xf5de('0x58')];queues[_0x136481[_0xf5de('0x57')]]['queuecallerjoinAt']=utils[_0xf5de('0x13')]();queues[_0x136481[_0xf5de('0x57')]]['queuecallerleaveAt']=utils[_0xf5de('0x13')]();queues[_0x136481['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x136481[_0xf5de('0x57')]]['mohtime']=0x0;utils[_0xf5de('0x2')](util['format'](_0xf5de('0x5f'),_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x57')]][_0xf5de('0x1c')],queues[_0x136481['transfertargetuniqueid']][_0xf5de('0xd')],queues[_0x136481[_0xf5de('0x57')]][_0xf5de('0x7')],queues[_0x136481[_0xf5de('0x57')]][_0xf5de('0x58')]));}else{utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x5a'),_0x136481[_0xf5de('0x4e')],queues[_0x136481[_0xf5de('0x4f')]][_0xf5de('0x1c')],_0x136481['origtransfererlinkedid']));queues[_0x136481[_0xf5de('0x4f')]]['transfereduniqueid']=_0x136481[_0xf5de('0x55')];}}}}catch(_0x218185){utils[_0xf5de('0x14')](util[_0xf5de('0x3')](_0xf5de('0x4d'),_0x136481[_0xf5de('0x4e')]),_0x218185);}};exports[_0xf5de('0x60')]=function(_0x4d08dc){try{if(!_[_0xf5de('0x20')](queues[_0x4d08dc[_0xf5de('0xe')]])){utils[_0xf5de('0xf')](util[_0xf5de('0x3')](_0xf5de('0x61'),_0x4d08dc[_0xf5de('0xe')]),_0x4d08dc);queues[_0x4d08dc[_0xf5de('0xe')]][_0xf5de('0x62')]=utils['now']();utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x63'),_0x4d08dc[_0xf5de('0xe')],queues[_0x4d08dc['uniqueid']][_0xf5de('0x1c')],queues[_0x4d08dc['uniqueid']][_0xf5de('0x62')]));}}catch(_0x3aaf19){utils[_0xf5de('0x14')](util['format'](_0xf5de('0x61'),_0x4d08dc[_0xf5de('0xe')]),_0x3aaf19);}};exports[_0xf5de('0x64')]=function(_0x59d05c){try{if(!_[_0xf5de('0x20')](queues[_0x59d05c[_0xf5de('0xe')]])){if(!_[_0xf5de('0x20')](queues[_0x59d05c['uniqueid']]['musiconholdstartAt'])){utils[_0xf5de('0xf')](util['format'](_0xf5de('0x65'),_0x59d05c['uniqueid']),_0x59d05c);queues[_0x59d05c[_0xf5de('0xe')]][_0xf5de('0x59')]+=utils[_0xf5de('0x33')](utils[_0xf5de('0x13')](),queues[_0x59d05c['uniqueid']][_0xf5de('0x62')]);utils[_0xf5de('0x2')](util[_0xf5de('0x3')](_0xf5de('0x66'),_0x59d05c['uniqueid'],queues[_0x59d05c[_0xf5de('0xe')]][_0xf5de('0x1c')],queues[_0x59d05c[_0xf5de('0xe')]][_0xf5de('0x59')]));delete queues[_0x59d05c['uniqueid']][_0xf5de('0x62')];}}}catch(_0x28c2fe){utils[_0xf5de('0x14')](util['format'](_0xf5de('0x65'),_0x59d05c[_0xf5de('0xe')]),_0x28c2fe);}}; \ No newline at end of file +var _0x11c0=['then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','position','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][blindtransfer]','transfereeuniqueid','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertype','ATTENDED','transferexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','accountcode','getVoiceQueueByName'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x11c0,0x191));var _0x011c=function(_0x31b0de,_0x1a70ca){_0x31b0de=_0x31b0de-0x0;var _0x34b2ce=_0x11c0[_0x31b0de];return _0x34b2ce;};'use strict';var _=require(_0x011c('0x0'));var util=require(_0x011c('0x1'));var utils=require(_0x011c('0x2'));var queues={};function writeDB(_0x5aafec){utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x5'),_0x5aafec['uniqueid'],_0x5aafec[_0x011c('0x6')],_0x5aafec[_0x011c('0x7')],_0x5aafec['lastAssignedTo'],_0x5aafec[_0x011c('0x8')],_0x5aafec[_0x011c('0x9')],_0x5aafec['queuecallerexitreason']));if(_0x5aafec[_0x011c('0x7')]){utils[_0x011c('0xa')](_0x5aafec[_0x011c('0x7')])[_0x011c('0xb')](function(_0x1bcf4d){if(_0x1bcf4d){_0x5aafec['type']=_0x1bcf4d[_0x011c('0xc')];}utils[_0x011c('0xd')](_0x011c('0xe'),_0x5aafec);});}else{utils[_0x011c('0xd')](_0x011c('0xe'),_0x5aafec);}if(_0x5aafec['transfereduniqueid']){delete queues[_0x5aafec[_0x011c('0xf')]];}else{delete queues[_0x5aafec[_0x011c('0x10')]];}}exports[_0x011c('0x11')]=function(_0x49ed3b){try{utils['debug'](util[_0x011c('0x4')](_0x011c('0x12'),_0x49ed3b[_0x011c('0x10')]),_0x49ed3b);utils[_0x011c('0x3')](util[_0x011c('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x49ed3b[_0x011c('0x10')],_0x49ed3b[_0x011c('0x7')],_0x49ed3b[_0x011c('0x13')]));queues[_0x49ed3b[_0x011c('0x10')]]=_['assign'](_0x49ed3b,{'originalposition':_0x49ed3b['position'],'queuecallerjoinAt':utils[_0x011c('0x14')](),'mohtime':0x0});}catch(_0x4b61b3){utils[_0x011c('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x49ed3b[_0x011c('0x10')]),_0x4b61b3);}};exports[_0x011c('0x16')]=function(_0x4c9252){try{if(!_[_0x011c('0x17')](queues[_0x4c9252[_0x011c('0x10')]])){utils[_0x011c('0x18')](util['format'](_0x011c('0x19'),_0x4c9252[_0x011c('0x10')]),_0x4c9252);if(queues[_0x4c9252[_0x011c('0x10')]]['queuecallerleaveAt']){if(!queues[_0x4c9252['uniqueid']]['queuecallerabandon']&&!queues[_0x4c9252[_0x011c('0x10')]]['queuecallerexit']){queues[_0x4c9252[_0x011c('0x10')]]['queuecallercomplete']=!![];queues[_0x4c9252[_0x011c('0x10')]][_0x011c('0x1a')]=utils['now']();queues[_0x4c9252['uniqueid']][_0x011c('0x1b')]=_0x011c('0x1c');}utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x1d'),_0x4c9252[_0x011c('0x10')],queues[_0x4c9252[_0x011c('0x10')]][_0x011c('0x1e')],queues[_0x4c9252[_0x011c('0x10')]][_0x011c('0x1b')]));writeDB(queues[_0x4c9252[_0x011c('0x10')]]);}else if(queues[_0x4c9252[_0x011c('0x10')]]['transfereduniqueid']){utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x1f'),_0x4c9252[_0x011c('0x10')],queues[_0x4c9252[_0x011c('0x10')]][_0x011c('0x1e')],queues[_0x4c9252[_0x011c('0x10')]][_0x011c('0xf')]));queues[queues[_0x4c9252[_0x011c('0x10')]]['transfereduniqueid']]=queues[_0x4c9252['uniqueid']];queues[queues[_0x4c9252[_0x011c('0x10')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x4c9252[_0x011c('0x10')]];}}}catch(_0x283571){utils[_0x011c('0x15')](util['format']('[%s][queues][hangup]',_0x4c9252[_0x011c('0x10')]),_0x283571);}};exports[_0x011c('0x20')]=function(_0x4cd466){try{utils[_0x011c('0x18')](util['format']('[%s][queues][varset]',_0x4cd466[_0x011c('0x10')]),_0x4cd466);if(!_[_0x011c('0x17')](_0x4cd466['variable'][_0x011c('0x21')])&&_0x4cd466[_0x011c('0x22')][_0x011c('0x23')]()!==_0x011c('0x24')){if(!_[_0x011c('0x17')](queues[_0x4cd466[_0x011c('0x10')]])){queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x25')]=![];queues[_0x4cd466['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x26')]=!![];queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x27')]=utils['now']();queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x1b')]=_0x4cd466[_0x011c('0x22')][_0x011c('0x23')]();utils['info'](util['format'](_0x011c('0x28'),_0x4cd466[_0x011c('0x10')],queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x1e')],_0x4cd466['value'],queues[_0x4cd466['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x4cd466[_0x011c('0x10')]]);}}else if(!_['isNil'](_0x4cd466['variable'][_0x011c('0x29')])){if(!_['isNil'](queues[_0x4cd466['uniqueid']])&&!queues[_0x4cd466[_0x011c('0x10')]]['queuecallerabandon']){queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x25')]=![];queues[_0x4cd466['uniqueid']][_0x011c('0x2a')]=null;queues[_0x4cd466[_0x011c('0x10')]]['queuecallerexit']=!![];queues[_0x4cd466[_0x011c('0x10')]]['queuecallerexitAt']=utils['now']();queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x1b')]=_0x011c('0x2b');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4cd466[_0x011c('0x10')],queues[_0x4cd466[_0x011c('0x10')]][_0x011c('0x1e')],_0x4cd466['value'],queues[_0x4cd466['uniqueid']][_0x011c('0x1b')]));}}}catch(_0x2e427c){utils['error'](util[_0x011c('0x4')](_0x011c('0x2c'),_0x4cd466[_0x011c('0x10')]),_0x2e427c);}};exports['queuecallerabandon']=function(_0x36282a){try{if(!_[_0x011c('0x17')](queues[_0x36282a[_0x011c('0x10')]])){utils[_0x011c('0x18')](util[_0x011c('0x4')]('[%s][queues][queuecallerabandon]',_0x36282a[_0x011c('0x10')]),_0x36282a);queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x26')]=![];queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x27')]=null;queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x25')]=!![];queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x2a')]=utils[_0x011c('0x14')]();queues[_0x36282a['uniqueid']][_0x011c('0x1b')]=_0x011c('0x2d');utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x2e'),_0x36282a[_0x011c('0x10')],queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x1e')],queues[_0x36282a[_0x011c('0x10')]][_0x011c('0x1b')]));}}catch(_0x34f247){utils['error'](util['format']('[%s][queues][queuecallerabandon]',_0x36282a[_0x011c('0x10')]),_0x34f247);}};exports[_0x011c('0x2f')]=function(_0x2cb24b){try{if(!_[_0x011c('0x17')](queues[_0x2cb24b[_0x011c('0x10')]])){utils[_0x011c('0x18')](util[_0x011c('0x4')](_0x011c('0x30'),_0x2cb24b[_0x011c('0x10')]),_0x2cb24b);utils[_0x011c('0x3')](util['format'](_0x011c('0x31'),_0x2cb24b[_0x011c('0x10')],queues[_0x2cb24b[_0x011c('0x10')]][_0x011c('0x1e')],_0x2cb24b[_0x011c('0x32')],_0x2cb24b[_0x011c('0x33')]));queues[_0x2cb24b['uniqueid']][_0x011c('0x2f')]=!![];queues[_0x2cb24b['uniqueid']][_0x011c('0x34')]=utils[_0x011c('0x14')]();queues[_0x2cb24b[_0x011c('0x10')]][_0x011c('0x35')]=utils['diffTime'](queues[_0x2cb24b[_0x011c('0x10')]]['queuecallerleaveAt'],queues[_0x2cb24b[_0x011c('0x10')]][_0x011c('0x36')]);queues[_0x2cb24b[_0x011c('0x10')]]['position']=_0x2cb24b[_0x011c('0x13')];queues[_0x2cb24b['uniqueid']][_0x011c('0x37')]=_0x2cb24b[_0x011c('0x37')];queues[_0x2cb24b[_0x011c('0x10')]][_0x011c('0x32')]=_0x2cb24b[_0x011c('0x32')];queues[_0x2cb24b[_0x011c('0x10')]][_0x011c('0x33')]=_0x2cb24b[_0x011c('0x33')];}}catch(_0x3dff93){utils[_0x011c('0x15')](util[_0x011c('0x4')]('[%s][queues][queuecallerleave]',_0x2cb24b[_0x011c('0x10')]),_0x3dff93);}};exports[_0x011c('0x38')]=function(_0x1b5185){try{if(!_[_0x011c('0x17')](queues[_0x1b5185[_0x011c('0x10')]])){utils[_0x011c('0x18')](util[_0x011c('0x4')](_0x011c('0x39'),_0x1b5185[_0x011c('0x10')]),_0x1b5185);utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x3a'),_0x1b5185[_0x011c('0x10')],queues[_0x1b5185[_0x011c('0x10')]][_0x011c('0x1e')],_0x1b5185[_0x011c('0x3b')],_0x1b5185['destaccountcode']));queues[_0x1b5185[_0x011c('0x10')]][_0x011c('0x25')]=![];queues[_0x1b5185['uniqueid']][_0x011c('0x25')]=![];queues[_0x1b5185[_0x011c('0x10')]]['queuecallerabandonAt']=null;queues[_0x1b5185[_0x011c('0x10')]][_0x011c('0x26')]=![];queues[_0x1b5185['uniqueid']][_0x011c('0x1b')]=null;queues[_0x1b5185[_0x011c('0x10')]][_0x011c('0x27')]=null;queues[_0x1b5185[_0x011c('0x10')]]['assigned']=!![];queues[_0x1b5185[_0x011c('0x10')]]['accountcode']=_0x1b5185[_0x011c('0x3c')];queues[_0x1b5185[_0x011c('0x10')]][_0x011c('0x3d')]=_0x1b5185[_0x011c('0x3b')];}}catch(_0x319012){utils['error'](util[_0x011c('0x4')](_0x011c('0x39'),_0x1b5185[_0x011c('0x10')]),_0x319012);}};exports[_0x011c('0x3e')]=function(_0x51e622){try{if(!_[_0x011c('0x17')](queues[_0x51e622[_0x011c('0x10')]])){if(queues[_0x51e622[_0x011c('0x10')]]['queuecallerleaveAt']){utils['debug'](util[_0x011c('0x4')](_0x011c('0x3f'),_0x51e622['uniqueid']),_0x51e622);queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x25')]=![];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x25')]=![];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x2a')]=null;queues[_0x51e622['uniqueid']][_0x011c('0x26')]=![];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x27')]=null;queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x40')]=!![];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x3d')]=_0x51e622[_0x011c('0x3b')];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x41')]=!![];queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x1a')]=utils[_0x011c('0x14')]();if(_0x51e622[_0x011c('0x42')]==_0x011c('0x43')){if(!queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x43')]){queues[_0x51e622['uniqueid']][_0x011c('0x1b')]=_0x011c('0x44');}}else{queues[_0x51e622['uniqueid']][_0x011c('0x1b')]=_0x011c('0x45')+_0x51e622['reason']['toUpperCase']();}utils[_0x011c('0x3')](util[_0x011c('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x51e622[_0x011c('0x10')],queues[_0x51e622[_0x011c('0x10')]]['name'],_0x51e622[_0x011c('0x3b')],queues[_0x51e622[_0x011c('0x10')]][_0x011c('0x1b')]));writeDB(queues[_0x51e622[_0x011c('0x10')]]);}}}catch(_0x4a5c79){utils[_0x011c('0x15')](util[_0x011c('0x4')]('[%s][queues][agentcomplete]',_0x51e622['uniqueid']),_0x4a5c79);}};exports['blindtransfer']=function(_0x31fcbb){try{if(!_[_0x011c('0x17')](queues[_0x31fcbb['transfereeuniqueid']])){utils[_0x011c('0x18')](util['format'](_0x011c('0x46'),_0x31fcbb[_0x011c('0x10')]),_0x31fcbb);queues[_0x31fcbb[_0x011c('0x47')]][_0x011c('0x43')]=!![];queues[_0x31fcbb['transfereeuniqueid']]['transfertype']='BLIND';queues[_0x31fcbb[_0x011c('0x47')]]['transferexten']=_0x31fcbb[_0x011c('0x48')];queues[_0x31fcbb[_0x011c('0x47')]][_0x011c('0x49')]=_0x31fcbb[_0x011c('0x47')];queues[_0x31fcbb[_0x011c('0x47')]][_0x011c('0x1b')]=_0x011c('0x4a');utils[_0x011c('0x3')](util['format'](_0x011c('0x4b'),_0x31fcbb[_0x011c('0x10')],queues[_0x31fcbb['transfereeuniqueid']]['name'],_0x31fcbb[_0x011c('0x47')],_0x31fcbb[_0x011c('0x48')]));}}catch(_0x30b070){utils['error'](util[_0x011c('0x4')](_0x011c('0x46'),_0x31fcbb[_0x011c('0x10')]),_0x30b070);}};exports[_0x011c('0x4c')]=function(_0x146cee){try{utils[_0x011c('0x18')](util[_0x011c('0x4')](_0x011c('0x4d'),_0x146cee['origtransfereruniqueid']),_0x146cee);if(_0x146cee[_0x011c('0x4e')]==_0x146cee[_0x011c('0x4f')]){if(!_['isNil'](queues[_0x146cee[_0x011c('0x50')]])){utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x51'),_0x146cee[_0x011c('0x4e')],queues[_0x146cee['secondtransfererlinkedid']]['name'],_0x146cee['origtransfererexten']));queues[_0x146cee[_0x011c('0x50')]][_0x011c('0x43')]=!![];queues[_0x146cee[_0x011c('0x50')]]['transfertype']='ATTENDED';queues[_0x146cee['secondtransfererlinkedid']]['transferexten']=_0x146cee['origtransfererexten'];queues[_0x146cee[_0x011c('0x50')]][_0x011c('0x49')]=_0x146cee[_0x011c('0x4e')];queues[_0x146cee[_0x011c('0x50')]][_0x011c('0x1b')]=_0x011c('0x52');}if(!_['isNil'](queues[_0x146cee['origtransfererlinkedid']])){if(_0x146cee[_0x011c('0x53')]&&queues[_0x146cee[_0x011c('0x53')]]){queues[_0x146cee['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x146cee['transfereeuniqueid']]=_['clone'](queues[_0x146cee[_0x011c('0x53')]]);queues[_0x146cee[_0x011c('0x47')]]['transfereduniqueid']=_0x146cee['transfertargetuniqueid'];queues[_0x146cee['transfereeuniqueid']][_0x011c('0x54')]=0x2;queues[_0x146cee['transfereeuniqueid']][_0x011c('0x8')]=queues[_0x146cee[_0x011c('0x50')]][_0x011c('0x8')];queues[_0x146cee[_0x011c('0x47')]][_0x011c('0x55')]=queues[_0x146cee['secondtransfererlinkedid']][_0x011c('0x55')];queues[_0x146cee[_0x011c('0x47')]][_0x011c('0x36')]=utils[_0x011c('0x14')]();queues[_0x146cee['transfereeuniqueid']][_0x011c('0x34')]=utils['now']();queues[_0x146cee[_0x011c('0x47')]][_0x011c('0x35')]=0x0;queues[_0x146cee['transfereeuniqueid']][_0x011c('0x56')]=0x0;utils[_0x011c('0x3')](util['format'](_0x011c('0x57'),_0x146cee[_0x011c('0x4e')],queues[_0x146cee['transfereeuniqueid']]['name'],queues[_0x146cee['transfereeuniqueid']]['calleridnum'],queues[_0x146cee[_0x011c('0x47')]][_0x011c('0x55')]));}else{utils[_0x011c('0x3')](util['format'](_0x011c('0x58'),_0x146cee['origtransfereruniqueid'],queues[_0x146cee[_0x011c('0x4f')]][_0x011c('0x1e')],_0x146cee[_0x011c('0x50')]));queues[_0x146cee[_0x011c('0x4f')]][_0x011c('0xf')]=_0x146cee['secondtransfererlinkedid'];}}}else if(_0x146cee[_0x011c('0x59')]==_0x146cee[_0x011c('0x50')]){if(!_[_0x011c('0x17')](queues[_0x146cee[_0x011c('0x4f')]])){utils[_0x011c('0x3')](util[_0x011c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x146cee[_0x011c('0x4e')],queues[_0x146cee[_0x011c('0x4f')]]['name'],_0x146cee[_0x011c('0x59')],_0x146cee[_0x011c('0x5a')]));queues[_0x146cee['origtransfererlinkedid']][_0x011c('0x43')]=!![];queues[_0x146cee[_0x011c('0x4f')]][_0x011c('0x5b')]=_0x011c('0x5c');queues[_0x146cee[_0x011c('0x4f')]][_0x011c('0x5d')]=_0x146cee[_0x011c('0x5a')];queues[_0x146cee[_0x011c('0x4f')]][_0x011c('0x49')]=_0x146cee[_0x011c('0x59')];queues[_0x146cee['origtransfererlinkedid']][_0x011c('0x1b')]='ATTENDEDTRANSFER';}if(!_[_0x011c('0x17')](queues[_0x146cee['secondtransfererlinkedid']])){if(_0x146cee[_0x011c('0x5e')]&&queues[_0x146cee[_0x011c('0x5e')]]){queues[_0x146cee[_0x011c('0x5e')]][_0x011c('0x54')]=0x1;queues[_0x146cee[_0x011c('0x5f')]]=_['clone'](queues[_0x146cee['transfertargetlinkedid']]);queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0xf')]=_0x146cee['transfertargetuniqueid'];queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x54')]=0x2;queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x8')]=queues[_0x146cee[_0x011c('0x4f')]]['calleridnum'];queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x55')]=queues[_0x146cee[_0x011c('0x4f')]]['calleridname'];queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x36')]=utils[_0x011c('0x14')]();queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x34')]=utils[_0x011c('0x14')]();queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x35')]=0x0;queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x56')]=0x0;utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x60'),_0x146cee[_0x011c('0x4e')],queues[_0x146cee['transfertargetuniqueid']][_0x011c('0x1e')],queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0xf')],queues[_0x146cee['transfertargetuniqueid']][_0x011c('0x8')],queues[_0x146cee[_0x011c('0x5f')]][_0x011c('0x55')]));}else{utils['info'](util[_0x011c('0x4')](_0x011c('0x58'),_0x146cee['origtransfereruniqueid'],queues[_0x146cee[_0x011c('0x50')]][_0x011c('0x1e')],_0x146cee[_0x011c('0x4f')]));queues[_0x146cee[_0x011c('0x50')]][_0x011c('0xf')]=_0x146cee['origtransfererlinkedid'];}}}}catch(_0x5c0dbd){utils[_0x011c('0x15')](util[_0x011c('0x4')](_0x011c('0x4d'),_0x146cee[_0x011c('0x4e')]),_0x5c0dbd);}};exports[_0x011c('0x61')]=function(_0x18fa02){try{if(!_[_0x011c('0x17')](queues[_0x18fa02[_0x011c('0x10')]])){utils[_0x011c('0x18')](util[_0x011c('0x4')](_0x011c('0x62'),_0x18fa02[_0x011c('0x10')]),_0x18fa02);queues[_0x18fa02[_0x011c('0x10')]][_0x011c('0x63')]=utils['now']();utils[_0x011c('0x3')](util[_0x011c('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x18fa02['uniqueid'],queues[_0x18fa02[_0x011c('0x10')]][_0x011c('0x1e')],queues[_0x18fa02[_0x011c('0x10')]]['musiconholdstartAt']));}}catch(_0x4ae0e5){utils[_0x011c('0x15')](util['format'](_0x011c('0x62'),_0x18fa02[_0x011c('0x10')]),_0x4ae0e5);}};exports[_0x011c('0x64')]=function(_0x4abbe1){try{if(!_[_0x011c('0x17')](queues[_0x4abbe1[_0x011c('0x10')]])){if(!_[_0x011c('0x17')](queues[_0x4abbe1[_0x011c('0x10')]][_0x011c('0x63')])){utils[_0x011c('0x18')](util[_0x011c('0x4')](_0x011c('0x65'),_0x4abbe1[_0x011c('0x10')]),_0x4abbe1);queues[_0x4abbe1[_0x011c('0x10')]][_0x011c('0x56')]+=utils['diffTime'](utils[_0x011c('0x14')](),queues[_0x4abbe1[_0x011c('0x10')]][_0x011c('0x63')]);utils[_0x011c('0x3')](util[_0x011c('0x4')](_0x011c('0x66'),_0x4abbe1[_0x011c('0x10')],queues[_0x4abbe1[_0x011c('0x10')]]['name'],queues[_0x4abbe1[_0x011c('0x10')]][_0x011c('0x56')]));delete queues[_0x4abbe1['uniqueid']]['musiconholdstartAt'];}}}catch(_0x206c52){utils[_0x011c('0x15')](util['format']('[%s][queues][musiconholdstop]',_0x4abbe1[_0x011c('0x10')]),_0x206c52);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 175379b..d4ee1bd 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 _0x559b=['variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x502694,_0x4504da){var _0x5280bd=function(_0x1e2f0c){while(--_0x1e2f0c){_0x502694['push'](_0x502694['shift']());}};_0x5280bd(++_0x4504da);}(_0x559b,0x182));var _0xb559=function(_0x490c11,_0x27bf2b){_0x490c11=_0x490c11-0x0;var _0x5a37ab=_0x559b[_0x490c11];return _0x5a37ab;};'use strict';var _=require(_0xb559('0x0'));var util=require(_0xb559('0x1'));var utils=require(_0xb559('0x2'));var recordings={};function writeDB(_0x18736f){utils[_0xb559('0x3')](util[_0xb559('0x4')]('[%s][recordings][writeDB]',_0x18736f[_0xb559('0x5')]));if(_0x18736f[_0xb559('0x6')]){utils['getUserByInternal'](_0x18736f['accountcode'])[_0xb559('0x7')](function(_0x3e39ad){if(_0x3e39ad){_0x18736f['membername']=_0x3e39ad[_0xb559('0x8')];_0x18736f[_0xb559('0x9')]=_0x3e39ad['id'];}utils[_0xb559('0xa')](_0xb559('0xb'),_0x18736f);});}else{utils['request'](_0xb559('0xb'),_0x18736f);}}exports[_0xb559('0xc')]=function(_0x4180b2){try{utils[_0xb559('0xd')](util[_0xb559('0x4')](_0xb559('0xe'),_0x4180b2[_0xb559('0x5')]),_0x4180b2);if(_0x4180b2['uniqueid']==_0x4180b2[_0xb559('0xf')]){utils[_0xb559('0x3')](util['format'](_0xb559('0x10'),_0x4180b2[_0xb559('0x5')],_0x4180b2[_0xb559('0x11')],_0x4180b2[_0xb559('0x12')]));recordings[_0x4180b2[_0xb559('0x5')]]={'uniqueid':_0x4180b2[_0xb559('0x5')],'accountcode':_0x4180b2['accountcode'],'exten':_0x4180b2['exten'],'context':_0x4180b2[_0xb559('0x11')],'channel':_0x4180b2['channel'],'monitors':[]};}}catch(_0x47411a){utils[_0xb559('0x13')](util[_0xb559('0x4')](_0xb559('0xe'),_0x4180b2[_0xb559('0x5')]),_0x47411a);}};exports[_0xb559('0x14')]=function(_0x3d42c8){try{utils[_0xb559('0xd')](util[_0xb559('0x4')](_0xb559('0x15'),_0x3d42c8[_0xb559('0x5')]),_0x3d42c8);if(!_[_0xb559('0x16')](recordings[_0x3d42c8[_0xb559('0x5')]])&&_0x3d42c8[_0xb559('0x17')]==0x6){utils[_0xb559('0x3')](util[_0xb559('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3d42c8[_0xb559('0x5')],_0x3d42c8[_0xb559('0x11')],_0x3d42c8[_0xb559('0x18')]));}else if(!_['isNil'](recordings[_0x3d42c8[_0xb559('0xf')]])&&_0x3d42c8['channelstate']==0x6&&_0x3d42c8[_0xb559('0x11')]!=_0xb559('0x19')){utils[_0xb559('0x3')](util[_0xb559('0x4')](_0xb559('0x1a'),_0x3d42c8['uniqueid'],_0x3d42c8[_0xb559('0xf')],_0x3d42c8[_0xb559('0x11')],_0x3d42c8[_0xb559('0x18')]));recordings[_0x3d42c8[_0xb559('0xf')]]['accountcode']=_0x3d42c8['accountcode'];}}catch(_0x28469d){utils[_0xb559('0x13')](util[_0xb559('0x4')](_0xb559('0x15'),_0x3d42c8['uniqueid']),_0x28469d);}};exports['varset']=function(_0x38acf8){try{if(!_[_0xb559('0x16')](_0x38acf8[_0xb559('0x1b')])&&!_['isNil'](_0x38acf8['variable'][_0xb559('0x1c')])){utils['debug'](util[_0xb559('0x4')](_0xb559('0x1d'),_0x38acf8[_0xb559('0x5')]),_0x38acf8);utils[_0xb559('0x3')](util[_0xb559('0x4')](_0xb559('0x1e'),_0x38acf8['uniqueid'],_0x38acf8[_0xb559('0x1b')],_0x38acf8['value']));if(_[_0xb559('0x1f')](_0x38acf8[_0xb559('0x20')],_0xb559('0x21'))){_0x38acf8[_0xb559('0x20')]=_0x38acf8['value'][_0xb559('0x22')]('.wav49',_0xb559('0x23'));}if(recordings[_0x38acf8[_0xb559('0xf')]]){var _0x4133fa=_[_0xb559('0x24')](recordings[_0x38acf8[_0xb559('0xf')]][_0xb559('0x25')],{'value':_0x38acf8[_0xb559('0x20')]});if(_[_0xb559('0x16')](_0x4133fa)){recordings[_0x38acf8[_0xb559('0xf')]]['monitors'][_0xb559('0x26')]({'value':_0x38acf8[_0xb559('0x20')]});}}}}catch(_0x4a1d51){utils[_0xb559('0x13')](util[_0xb559('0x4')]('[%s][recordings][varset]',_0x38acf8[_0xb559('0x5')]),_0x4a1d51);}};exports[_0xb559('0x27')]=function(_0x28f4f9){try{if(!_['isNil'](recordings[_0x28f4f9['uniqueid']])){utils[_0xb559('0xd')](util[_0xb559('0x4')](_0xb559('0x28'),_0x28f4f9[_0xb559('0x5')]),_0x28f4f9);utils[_0xb559('0x3')](util[_0xb559('0x4')](_0xb559('0x29'),_0x28f4f9[_0xb559('0x5')],_0x28f4f9[_0xb559('0x2a')],_0x28f4f9[_0xb559('0x2b')],_0x28f4f9['cause-txt']));recordings[_0x28f4f9[_0xb559('0x5')]][_0xb559('0x2a')]=_0x28f4f9[_0xb559('0x2a')];recordings[_0x28f4f9[_0xb559('0x5')]][_0xb559('0x2b')]=_0x28f4f9[_0xb559('0x2b')];recordings[_0x28f4f9[_0xb559('0x5')]]['connectedlinenum']=_0x28f4f9['connectedlinenum'];recordings[_0x28f4f9[_0xb559('0x5')]]['connectedlinename']=_0x28f4f9[_0xb559('0x2c')];if(recordings[_0x28f4f9[_0xb559('0x5')]][_0xb559('0x2d')]=='outbound'&&recordings[_0x28f4f9[_0xb559('0x5')]]['accountcode']){recordings[_0x28f4f9[_0xb559('0x5')]]['connectedlinenum']=recordings[_0x28f4f9[_0xb559('0x5')]][_0xb559('0x6')];recordings[_0x28f4f9[_0xb559('0x5')]]['connectedlinename']='';}recordings[_0x28f4f9[_0xb559('0x5')]][_0xb559('0x25')][_0xb559('0x2e')](function(_0x23672d){var _0x1ba975=_['clone'](recordings[_0x28f4f9[_0xb559('0x5')]]);_0x1ba975['value']=_0x23672d['value'];writeDB(_0x1ba975);});delete recordings[_0x28f4f9[_0xb559('0x5')]];}}catch(_0x4ec5b0){utils['error'](util['format'](_0xb559('0x28'),_0x28f4f9[_0xb559('0x5')]),_0x4ec5b0);}};exports[_0xb559('0x2f')]=function(_0x219881){try{if(!_[_0xb559('0x16')](recordings[_0x219881['uniqueid']])){utils[_0xb559('0xd')](util[_0xb559('0x4')]('[%s][recordings][newexten]',_0x219881[_0xb559('0x5')]),_0x219881);utils[_0xb559('0x3')](util['format'](_0xb559('0x30'),_0x219881[_0xb559('0x5')],_0x219881[_0xb559('0x31')],_0x219881[_0xb559('0x32')]));if(_0x219881[_0xb559('0x31')][_0xb559('0x33')]()=='set'&&_[_0xb559('0x34')](_0x219881[_0xb559('0x32')][_0xb559('0x33')](),_0xb559('0x35'))){var _0x26db90=_0x219881[_0xb559('0x32')][_0xb559('0x36')]('=');var _0x348430=_0x26db90[0x0][_0xb559('0x37')](_0x26db90[0x0]['lastIndexOf']('(')+0x1,_0x26db90[0x0]['lastIndexOf'](')'));var _0x2ccc04=_0x26db90[0x1];recordings[_0x219881[_0xb559('0x5')]][_0x348430]=_0x2ccc04;}}}catch(_0x312040){utils['error'](util[_0xb559('0x4')]('[%s][recordings][newexten]',_0x219881[_0xb559('0x5')]),_0x312040);}};exports['queuecallerjoin']=function(_0x3c2428){try{if(!_[_0xb559('0x16')](recordings[_0x3c2428[_0xb559('0x5')]])){utils[_0xb559('0xd')](util[_0xb559('0x4')](_0xb559('0x38'),_0x3c2428[_0xb559('0x5')]),_0x3c2428);utils[_0xb559('0x3')](util[_0xb559('0x4')](_0xb559('0x39'),_0x3c2428['uniqueid'],_0x3c2428[_0xb559('0x3a')]));recordings[_0x3c2428[_0xb559('0x5')]]['queue']=_0x3c2428[_0xb559('0x3a')];}}catch(_0x59803d){utils[_0xb559('0x13')](util[_0xb559('0x4')]('[%s][recordings][queuecallerjoin]',_0x3c2428[_0xb559('0x5')]),_0x59803d);}}; \ No newline at end of file +var _0x112e=['push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','find','monitors'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0x112e,0x194));var _0xe112=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x112e[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xe112('0x0'));var util=require(_0xe112('0x1'));var utils=require(_0xe112('0x2'));var recordings={};function writeDB(_0x2a88f8){utils[_0xe112('0x3')](util[_0xe112('0x4')](_0xe112('0x5'),_0x2a88f8[_0xe112('0x6')]));if(_0x2a88f8['accountcode']){utils['getUserByInternal'](_0x2a88f8[_0xe112('0x7')])[_0xe112('0x8')](function(_0x237e35){if(_0x237e35){_0x2a88f8['membername']=_0x237e35[_0xe112('0x9')];_0x2a88f8[_0xe112('0xa')]=_0x237e35['id'];}utils[_0xe112('0xb')]('CreateVoiceRecording',_0x2a88f8);});}else{utils[_0xe112('0xb')](_0xe112('0xc'),_0x2a88f8);}}exports[_0xe112('0xd')]=function(_0x91f6b2){try{utils[_0xe112('0xe')](util[_0xe112('0x4')]('[%s][recordings][newchannel]',_0x91f6b2[_0xe112('0x6')]),_0x91f6b2);if(_0x91f6b2[_0xe112('0x6')]==_0x91f6b2[_0xe112('0xf')]){utils['info'](util[_0xe112('0x4')](_0xe112('0x10'),_0x91f6b2[_0xe112('0x6')],_0x91f6b2[_0xe112('0x11')],_0x91f6b2[_0xe112('0x12')]));recordings[_0x91f6b2['uniqueid']]={'uniqueid':_0x91f6b2[_0xe112('0x6')],'accountcode':_0x91f6b2[_0xe112('0x7')],'exten':_0x91f6b2[_0xe112('0x12')],'context':_0x91f6b2[_0xe112('0x11')],'channel':_0x91f6b2[_0xe112('0x13')],'monitors':[]};}}catch(_0x363a2c){utils['error'](util['format']('[%s][recordings][newchannel]',_0x91f6b2['uniqueid']),_0x363a2c);}};exports[_0xe112('0x14')]=function(_0x437955){try{utils['debug'](util[_0xe112('0x4')]('[%s][recordings][newstate]',_0x437955[_0xe112('0x6')]),_0x437955);if(!_[_0xe112('0x15')](recordings[_0x437955[_0xe112('0x6')]])&&_0x437955[_0xe112('0x16')]==0x6){utils[_0xe112('0x3')](util[_0xe112('0x4')](_0xe112('0x17'),_0x437955[_0xe112('0x6')],_0x437955[_0xe112('0x11')],_0x437955['channel']));}else if(!_['isNil'](recordings[_0x437955[_0xe112('0xf')]])&&_0x437955[_0xe112('0x16')]==0x6&&_0x437955['context']!=_0xe112('0x18')){utils[_0xe112('0x3')](util[_0xe112('0x4')](_0xe112('0x19'),_0x437955[_0xe112('0x6')],_0x437955[_0xe112('0xf')],_0x437955[_0xe112('0x11')],_0x437955[_0xe112('0x13')]));recordings[_0x437955['linkedid']]['accountcode']=_0x437955[_0xe112('0x7')];}}catch(_0x15c894){utils[_0xe112('0x1a')](util[_0xe112('0x4')](_0xe112('0x1b'),_0x437955[_0xe112('0x6')]),_0x15c894);}};exports['varset']=function(_0x26447c){try{if(!_[_0xe112('0x15')](_0x26447c[_0xe112('0x1c')])&&!_['isNil'](_0x26447c[_0xe112('0x1c')][_0xe112('0x1d')])){utils[_0xe112('0xe')](util[_0xe112('0x4')]('[%s][recordings][varset]',_0x26447c[_0xe112('0x6')]),_0x26447c);utils['info'](util[_0xe112('0x4')](_0xe112('0x1e'),_0x26447c[_0xe112('0x6')],_0x26447c[_0xe112('0x1c')],_0x26447c[_0xe112('0x1f')]));if(_[_0xe112('0x20')](_0x26447c['value'],'.wav49')){_0x26447c['value']=_0x26447c['value'][_0xe112('0x21')](_0xe112('0x22'),'.WAV');}if(recordings[_0x26447c['linkedid']]){var _0xac3589=_[_0xe112('0x23')](recordings[_0x26447c[_0xe112('0xf')]][_0xe112('0x24')],{'value':_0x26447c['value']});if(_[_0xe112('0x15')](_0xac3589)){recordings[_0x26447c['linkedid']]['monitors'][_0xe112('0x25')]({'value':_0x26447c[_0xe112('0x1f')]});}}}}catch(_0x1b70fe){utils[_0xe112('0x1a')](util['format'](_0xe112('0x26'),_0x26447c[_0xe112('0x6')]),_0x1b70fe);}};exports[_0xe112('0x27')]=function(_0x24e140){try{if(!_[_0xe112('0x15')](recordings[_0x24e140['uniqueid']])){utils[_0xe112('0xe')](util[_0xe112('0x4')](_0xe112('0x28'),_0x24e140[_0xe112('0x6')]),_0x24e140);utils[_0xe112('0x3')](util[_0xe112('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x24e140['uniqueid'],_0x24e140['calleridnum'],_0x24e140[_0xe112('0x29')],_0x24e140[_0xe112('0x2a')]));recordings[_0x24e140[_0xe112('0x6')]][_0xe112('0x2b')]=_0x24e140[_0xe112('0x2b')];recordings[_0x24e140['uniqueid']][_0xe112('0x29')]=_0x24e140['calleridname'];recordings[_0x24e140[_0xe112('0x6')]][_0xe112('0x2c')]=_0x24e140[_0xe112('0x2c')];recordings[_0x24e140[_0xe112('0x6')]]['connectedlinename']=_0x24e140[_0xe112('0x2d')];if(recordings[_0x24e140[_0xe112('0x6')]][_0xe112('0x2e')]==_0xe112('0x2f')&&recordings[_0x24e140[_0xe112('0x6')]]['accountcode']){recordings[_0x24e140['uniqueid']][_0xe112('0x2c')]=recordings[_0x24e140[_0xe112('0x6')]][_0xe112('0x7')];recordings[_0x24e140[_0xe112('0x6')]][_0xe112('0x2d')]='';}recordings[_0x24e140['uniqueid']][_0xe112('0x24')][_0xe112('0x30')](function(_0x3f7d97){var _0x47f96c=_[_0xe112('0x31')](recordings[_0x24e140[_0xe112('0x6')]]);_0x47f96c[_0xe112('0x1f')]=_0x3f7d97[_0xe112('0x1f')];writeDB(_0x47f96c);});delete recordings[_0x24e140[_0xe112('0x6')]];}}catch(_0x87559d){utils[_0xe112('0x1a')](util[_0xe112('0x4')]('[%s][recordings][hangup]',_0x24e140[_0xe112('0x6')]),_0x87559d);}};exports['newexten']=function(_0x350bd4){try{if(!_[_0xe112('0x15')](recordings[_0x350bd4['uniqueid']])){utils[_0xe112('0xe')](util[_0xe112('0x4')]('[%s][recordings][newexten]',_0x350bd4[_0xe112('0x6')]),_0x350bd4);utils[_0xe112('0x3')](util[_0xe112('0x4')](_0xe112('0x32'),_0x350bd4[_0xe112('0x6')],_0x350bd4[_0xe112('0x33')],_0x350bd4[_0xe112('0x34')]));if(_0x350bd4[_0xe112('0x33')][_0xe112('0x35')]()==_0xe112('0x36')&&_[_0xe112('0x37')](_0x350bd4[_0xe112('0x34')][_0xe112('0x35')](),_0xe112('0x38'))){var _0x374dfe=_0x350bd4['appdata']['split']('=');var _0x2581fb=_0x374dfe[0x0]['substring'](_0x374dfe[0x0]['lastIndexOf']('(')+0x1,_0x374dfe[0x0][_0xe112('0x39')](')'));var _0x4c595d=_0x374dfe[0x1];recordings[_0x350bd4[_0xe112('0x6')]][_0x2581fb]=_0x4c595d;}}}catch(_0x22e27b){utils[_0xe112('0x1a')](util[_0xe112('0x4')](_0xe112('0x3a'),_0x350bd4[_0xe112('0x6')]),_0x22e27b);}};exports[_0xe112('0x3b')]=function(_0x3084f6){try{if(!_[_0xe112('0x15')](recordings[_0x3084f6[_0xe112('0x6')]])){utils['debug'](util['format'](_0xe112('0x3c'),_0x3084f6['uniqueid']),_0x3084f6);utils[_0xe112('0x3')](util['format'](_0xe112('0x3d'),_0x3084f6[_0xe112('0x6')],_0x3084f6[_0xe112('0x3e')]));recordings[_0x3084f6[_0xe112('0x6')]][_0xe112('0x3e')]=_0x3084f6['queue'];}}catch(_0x173cc5){utils[_0xe112('0x1a')](util[_0xe112('0x4')](_0xe112('0x3c'),_0x3084f6[_0xe112('0x6')]),_0x173cc5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ba278f6..8e7aaaf 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 _0x3819=['type','origtransfereruniqueid','uniqueid','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x4cc041,_0x518f78){var _0x44a3de=function(_0x49a932){while(--_0x49a932){_0x4cc041['push'](_0x4cc041['shift']());}};_0x44a3de(++_0x518f78);}(_0x3819,0xaa));var _0x9381=function(_0x171429,_0x5d7d4c){_0x171429=_0x171429-0x0;var _0x3d2026=_0x3819[_0x171429];return _0x3d2026;};'use strict';var _=require(_0x9381('0x0'));var util=require(_0x9381('0x1'));var utils=require('./utils');function writeDB(_0x2fc669){utils[_0x9381('0x2')](util[_0x9381('0x3')](_0x9381('0x4'),_0x2fc669[_0x9381('0x5')]==='attended'?_0x2fc669[_0x9381('0x6')]:_0x2fc669[_0x9381('0x7')],_0x2fc669[_0x9381('0x5')]));utils['request']('CreateVoiceTransferReport',_0x2fc669);}exports['blindtransfer']=function(_0x229e83){try{utils[_0x9381('0x8')](util[_0x9381('0x3')](_0x9381('0x9'),_0x229e83['uniqueid']),_0x229e83);utils[_0x9381('0x2')](util['format'](_0x9381('0xa'),_0x229e83[_0x9381('0x7')],_0x229e83[_0x9381('0xb')],_0x229e83[_0x9381('0xc')],_0x229e83[_0x9381('0xd')],_0x229e83[_0x9381('0xe')]));_0x229e83[_0x9381('0x5')]='blind';writeDB(_0x229e83);}catch(_0x5dc36f){utils[_0x9381('0xf')](util[_0x9381('0x3')]('[%s][transfers][blindtransfer]',_0x229e83[_0x9381('0x7')]),_0x5dc36f);}};exports['attendedtransfer']=function(_0x1601ad){try{utils[_0x9381('0x8')](util[_0x9381('0x3')](_0x9381('0x10'),_0x1601ad['origtransfereruniqueid']),_0x1601ad);utils[_0x9381('0x2')](util['format'](_0x9381('0x11'),_0x1601ad[_0x9381('0x6')],_0x1601ad['origtransferercalleridnum'],_0x1601ad['origtransferercalleridname'],_0x1601ad[_0x9381('0x12')],_0x1601ad[_0x9381('0x13')]));_0x1601ad=_[_0x9381('0x14')](_0x1601ad,{'transfererchannel':_0x1601ad['origtransfererchannel'],'transferercalleridnum':_0x1601ad[_0x9381('0x15')],'transferercalleridname':_0x1601ad['origtransferercalleridname'],'transfererconnectedlinenum':_0x1601ad[_0x9381('0x16')],'transfererconnectedlinename':_0x1601ad[_0x9381('0x17')],'transfereraccountcode':_0x1601ad[_0x9381('0x18')],'transferercontext':_0x1601ad[_0x9381('0x19')],'transfererexten':_0x1601ad[_0x9381('0x1a')],'transfererlinkedid':_0x1601ad[_0x9381('0x1b')],'context':_0x1601ad[_0x9381('0x1c')],'extension':_0x1601ad['origtransfererexten'],'type':'attended'});if(_[_0x9381('0x1d')](_0x1601ad['transfereechannel'])){_0x1601ad=_[_0x9381('0x14')](_0x1601ad,{'transfereechannel':_0x1601ad[_0x9381('0x1e')],'transfereecalleridnum':_0x1601ad['transfertargetcalleridnum'],'transfereecalleridname':_0x1601ad[_0x9381('0x13')],'transfereeconnectedlinenum':_0x1601ad[_0x9381('0x1f')],'transfereeconnectedlinename':_0x1601ad[_0x9381('0x20')],'transfereeaccountcode':_0x1601ad[_0x9381('0x21')],'transfereecontext':_0x1601ad[_0x9381('0x22')],'transfereeexten':_0x1601ad['transfertargetexten'],'transfereelinkedid':_0x1601ad['transfertargetlinkedid']});}writeDB(_0x1601ad);}catch(_0x3fadc1){utils[_0x9381('0xf')](util[_0x9381('0x3')](_0x9381('0x10'),_0x1601ad[_0x9381('0x6')]),_0x3fadc1);}}; \ No newline at end of file +var _0xed65=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x38d6f0,_0x5ef3f5){var _0x420dcf=function(_0x1b52d4){while(--_0x1b52d4){_0x38d6f0['push'](_0x38d6f0['shift']());}};_0x420dcf(++_0x5ef3f5);}(_0xed65,0xd6));var _0x5ed6=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xed65[_0x31b5b2];return _0x364f13;};'use strict';var _=require('lodash');var util=require(_0x5ed6('0x0'));var utils=require(_0x5ed6('0x1'));function writeDB(_0x3ec3a2){utils[_0x5ed6('0x2')](util[_0x5ed6('0x3')](_0x5ed6('0x4'),_0x3ec3a2[_0x5ed6('0x5')]===_0x5ed6('0x6')?_0x3ec3a2[_0x5ed6('0x7')]:_0x3ec3a2[_0x5ed6('0x8')],_0x3ec3a2[_0x5ed6('0x5')]));utils[_0x5ed6('0x9')](_0x5ed6('0xa'),_0x3ec3a2);}exports[_0x5ed6('0xb')]=function(_0x174cba){try{utils[_0x5ed6('0xc')](util['format'](_0x5ed6('0xd'),_0x174cba['uniqueid']),_0x174cba);utils[_0x5ed6('0x2')](util[_0x5ed6('0x3')](_0x5ed6('0xe'),_0x174cba[_0x5ed6('0x8')],_0x174cba['transferercalleridnum'],_0x174cba['transferercalleridname'],_0x174cba[_0x5ed6('0xf')],_0x174cba[_0x5ed6('0x10')]));_0x174cba['type']=_0x5ed6('0x11');writeDB(_0x174cba);}catch(_0x42e5ea){utils[_0x5ed6('0x12')](util[_0x5ed6('0x3')](_0x5ed6('0xd'),_0x174cba[_0x5ed6('0x8')]),_0x42e5ea);}};exports[_0x5ed6('0x13')]=function(_0x18afbc){try{utils[_0x5ed6('0xc')](util[_0x5ed6('0x3')]('[%s][transfers][attendedtransfer]',_0x18afbc[_0x5ed6('0x7')]),_0x18afbc);utils[_0x5ed6('0x2')](util[_0x5ed6('0x3')](_0x5ed6('0x14'),_0x18afbc['origtransfereruniqueid'],_0x18afbc[_0x5ed6('0x15')],_0x18afbc[_0x5ed6('0x16')],_0x18afbc[_0x5ed6('0x17')],_0x18afbc['transfertargetcalleridname']));_0x18afbc=_[_0x5ed6('0x18')](_0x18afbc,{'transfererchannel':_0x18afbc['origtransfererchannel'],'transferercalleridnum':_0x18afbc[_0x5ed6('0x15')],'transferercalleridname':_0x18afbc['origtransferercalleridname'],'transfererconnectedlinenum':_0x18afbc['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x18afbc[_0x5ed6('0x19')],'transfereraccountcode':_0x18afbc[_0x5ed6('0x1a')],'transferercontext':_0x18afbc[_0x5ed6('0x1b')],'transfererexten':_0x18afbc[_0x5ed6('0x1c')],'transfererlinkedid':_0x18afbc[_0x5ed6('0x1d')],'context':_0x18afbc[_0x5ed6('0x1e')],'extension':_0x18afbc[_0x5ed6('0x1f')],'type':_0x5ed6('0x6')});if(_[_0x5ed6('0x20')](_0x18afbc[_0x5ed6('0x21')])){_0x18afbc=_[_0x5ed6('0x18')](_0x18afbc,{'transfereechannel':_0x18afbc[_0x5ed6('0x22')],'transfereecalleridnum':_0x18afbc['transfertargetcalleridnum'],'transfereecalleridname':_0x18afbc[_0x5ed6('0x23')],'transfereeconnectedlinenum':_0x18afbc[_0x5ed6('0x24')],'transfereeconnectedlinename':_0x18afbc['transfertargetconnectedlinename'],'transfereeaccountcode':_0x18afbc[_0x5ed6('0x25')],'transfereecontext':_0x18afbc[_0x5ed6('0x26')],'transfereeexten':_0x18afbc[_0x5ed6('0x27')],'transfereelinkedid':_0x18afbc[_0x5ed6('0x28')]});}writeDB(_0x18afbc);}catch(_0x40ad0b){utils[_0x5ed6('0x12')](util[_0x5ed6('0x3')](_0x5ed6('0x29'),_0x18afbc[_0x5ed6('0x7')]),_0x40ad0b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8b5888a..18643cb 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 _0x5e89=['seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','sumTime','now','isAfter','isBefore','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0x5e89,0x19d));var _0x95e8=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5e89[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0x95e8('0x0')][_0x95e8('0x1')]({'port':0x2329});var logger=require(_0x95e8('0x2'))(_0x95e8('0x3'));exports[_0x95e8('0x4')]=function(_0x4e9159,_0x4f110c){logger[_0x95e8('0x4')](_0x4e9159,_0x4f110c?util[_0x95e8('0x5')](_0x4f110c,{'showHidden':![],'depth':null}):'');};exports[_0x95e8('0x6')]=function(_0x3c21c7,_0x5bc956){logger[_0x95e8('0x6')](_0x3c21c7,_0x5bc956?util[_0x95e8('0x5')](_0x5bc956,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x124601,_0x17f9b8){logger[_0x95e8('0x7')](_0x124601,_0x17f9b8?util[_0x95e8('0x5')](_0x17f9b8,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x41c0b2,_0x26c2af){return client[_0x95e8('0x8')](_0x41c0b2,{'body':_0x26c2af})[_0x95e8('0x9')](function(_0x375857){logger[_0x95e8('0x6')]('[utils][request]\x20name:%s',_0x41c0b2,_0x375857?util['inspect'](_0x375857,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x57f809){logger[_0x95e8('0x7')](_0x95e8('0xa'),_0x41c0b2,_0x57f809?util[_0x95e8('0x5')](_0x57f809,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1bc70b){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x95e8('0xb'),_0x95e8('0xc'),'interface'],'where':_0x1bc70b,'limit':0x1}})[_0x95e8('0x9')](function(_0x152efd){logger[_0x95e8('0x6')](_0x95e8('0xd'),JSON[_0x95e8('0xe')](_0x1bc70b),_0x152efd?util[_0x95e8('0x5')](_0x152efd,{'showHidden':![],'depth':null}):'');return _0x152efd[_0x95e8('0xf')][_0x95e8('0x10')]?_0x152efd[_0x95e8('0xf')][0x0]:null;});}exports[_0x95e8('0x11')]=function(_0x3fde9d){return new BPromise(function(_0x2b8bb8,_0x9133a3){if(_0x3fde9d){return getUser({'internal':_0x3fde9d})[_0x95e8('0x9')](function(_0x1cfe27){logger[_0x95e8('0x4')](_0x95e8('0x12'),_0x3fde9d,_0x1cfe27?_0x95e8('0x13'):_0x95e8('0x14'));return _0x2b8bb8(_0x1cfe27);})[_0x95e8('0x15')](function(_0x1f49da){logger[_0x95e8('0x7')](_0x95e8('0x16'),_0x1f49da?util[_0x95e8('0x5')](_0x1f49da,{'showHidden':![],'depth':null}):'');return _0x2b8bb8(null);});}return _0x2b8bb8(null);});};exports[_0x95e8('0x17')]=function(_0x25d4ca){return new BPromise(function(_0x26be17,_0x512bfe){if(_0x25d4ca){return getUser({'interface':_0x25d4ca})[_0x95e8('0x9')](function(_0x5b1e6b){logger['info'](_0x95e8('0x18'),_0x25d4ca,_0x5b1e6b?_0x95e8('0x13'):'notfound');return _0x26be17(_0x5b1e6b);})['catch'](function(_0x571969){logger[_0x95e8('0x7')](_0x95e8('0x19'),_0x571969?util['inspect'](_0x571969,{'showHidden':![],'depth':null}):'');return _0x26be17(null);});}return _0x26be17(null);});};exports[_0x95e8('0x1a')]=function(_0x10f64c){return new BPromise(function(_0x6d97a9,_0x237cf3){if(_0x10f64c){return getUser({'name':_0x10f64c})[_0x95e8('0x9')](function(_0x161aab){logger['info'](_0x95e8('0x1b'),_0x10f64c,_0x161aab?'found':_0x95e8('0x14'));return _0x6d97a9(_0x161aab);})[_0x95e8('0x15')](function(_0x458b9f){logger[_0x95e8('0x7')](_0x95e8('0x1c'),_0x458b9f?util['inspect'](_0x458b9f,{'showHidden':![],'depth':null}):'');return _0x6d97a9(null);});}return _0x6d97a9(null);});};exports['getVoiceQueueByName']=function(_0x2849a3){return new BPromise(function(_0x666426,_0xcda85c){if(_0x2849a3){return client[_0x95e8('0x8')](_0x95e8('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0x95e8('0x1e'),'acw',_0x95e8('0x1f')],'where':{'name':_0x2849a3},'limit':0x1}})[_0x95e8('0x9')](function(_0xc2295e){logger[_0x95e8('0x6')](_0x95e8('0x20'),_0x2849a3,_0xc2295e?util[_0x95e8('0x5')](_0xc2295e,{'showHidden':![],'depth':null}):'');logger['info'](_0x95e8('0x21'),_0x2849a3,_0xc2295e?_0x95e8('0x13'):_0x95e8('0x14'));return _0x666426(_0xc2295e[_0x95e8('0xf')][_0x95e8('0x10')]?_0xc2295e[_0x95e8('0xf')][0x0]:null);})[_0x95e8('0x15')](function(_0x36422a){logger[_0x95e8('0x7')](_0x95e8('0x22'),_0x36422a?util[_0x95e8('0x5')](_0x36422a,{'showHidden':![],'depth':null}):'');return _0x666426(null);});}return _0x666426(null);});};exports[_0x95e8('0x23')]=function(_0x494eea,_0x315020){return moment(_0x494eea)[_0x95e8('0x24')](_0x315020,_0x95e8('0x25'))[_0x95e8('0x26')](_0x95e8('0x27'));};exports['subtractTime']=function(_0x584d0a,_0xdc9239){return moment(_0x584d0a)[_0x95e8('0x28')](_0xdc9239,_0x95e8('0x25'))[_0x95e8('0x26')](_0x95e8('0x27'));};exports['diffTime']=function(_0x4d9a9a,_0x527832){return moment(_0x4d9a9a)['diff'](moment(_0x527832),_0x95e8('0x25'));};exports[_0x95e8('0x29')]=function(_0x127251,_0x5e2f90){return parseInt(_0x127251,0xa)+parseInt(_0x5e2f90,0xa);};exports[_0x95e8('0x2a')]=function(){return moment()[_0x95e8('0x26')](_0x95e8('0x27'));};exports[_0x95e8('0x2b')]=function(_0x21e0cb,_0x5cf182){if(_0x5cf182){return moment(_0x21e0cb)['isAfter'](_0x5cf182);}return!![];};exports[_0x95e8('0x2c')]=function(_0x1b1fe0,_0x3c2df7){if(_0x3c2df7){return moment(_0x1b1fe0)[_0x95e8('0x2c')](_0x3c2df7);}else if(_0x1b1fe0){return!![];}return![];}; \ No newline at end of file +var _0x7527=['type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x3ab0ac,_0x1ea9cf){var _0x1f743d=function(_0x45fb92){while(--_0x45fb92){_0x3ab0ac['push'](_0x3ab0ac['shift']());}};_0x1f743d(++_0x1ea9cf);}(_0x7527,0x1a9));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7752('0x0'));var moment=require(_0x7752('0x1'));var util=require(_0x7752('0x2'));var client=jayson[_0x7752('0x3')][_0x7752('0x4')]({'port':0x2329});var logger=require(_0x7752('0x5'))(_0x7752('0x6'));exports[_0x7752('0x7')]=function(_0x1b0fca,_0xd9fe55){logger['info'](_0x1b0fca,_0xd9fe55?util[_0x7752('0x8')](_0xd9fe55,{'showHidden':![],'depth':null}):'');};exports[_0x7752('0x9')]=function(_0x4af8e8,_0xdec6ea){logger[_0x7752('0x9')](_0x4af8e8,_0xdec6ea?util[_0x7752('0x8')](_0xdec6ea,{'showHidden':![],'depth':null}):'');};exports[_0x7752('0xa')]=function(_0x3dd1b7,_0x50557f){logger[_0x7752('0xa')](_0x3dd1b7,_0x50557f?util[_0x7752('0x8')](_0x50557f,{'showHidden':![],'depth':null}):'');};exports[_0x7752('0xb')]=function(_0x128a4c,_0x17bc06){return client['request'](_0x128a4c,{'body':_0x17bc06})[_0x7752('0xc')](function(_0x165977){logger[_0x7752('0x9')]('[utils][request]\x20name:%s',_0x128a4c,_0x165977?util['inspect'](_0x165977,{'showHidden':![],'depth':null}):'');})[_0x7752('0xd')](function(_0x4d38f0){logger[_0x7752('0xa')](_0x7752('0xe'),_0x128a4c,_0x4d38f0?util[_0x7752('0x8')](_0x4d38f0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x43f3cb){return client[_0x7752('0xb')](_0x7752('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7752('0x10'),_0x7752('0x11'),_0x7752('0x12')],'where':_0x43f3cb,'limit':0x1}})[_0x7752('0xc')](function(_0x263cb3){logger[_0x7752('0x9')](_0x7752('0x13'),JSON[_0x7752('0x14')](_0x43f3cb),_0x263cb3?util[_0x7752('0x8')](_0x263cb3,{'showHidden':![],'depth':null}):'');return _0x263cb3[_0x7752('0x15')][_0x7752('0x16')]?_0x263cb3[_0x7752('0x15')][0x0]:null;});}exports[_0x7752('0x17')]=function(_0xfe8b4){return new BPromise(function(_0x7e2e55,_0x203c0b){if(_0xfe8b4){return getUser({'internal':_0xfe8b4})[_0x7752('0xc')](function(_0x33c46c){logger[_0x7752('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xfe8b4,_0x33c46c?_0x7752('0x18'):_0x7752('0x19'));return _0x7e2e55(_0x33c46c);})[_0x7752('0xd')](function(_0x456cbb){logger[_0x7752('0xa')](_0x7752('0x1a'),_0x456cbb?util[_0x7752('0x8')](_0x456cbb,{'showHidden':![],'depth':null}):'');return _0x7e2e55(null);});}return _0x7e2e55(null);});};exports[_0x7752('0x1b')]=function(_0x24fccc){return new BPromise(function(_0x1c6917,_0x41f15f){if(_0x24fccc){return getUser({'interface':_0x24fccc})[_0x7752('0xc')](function(_0x2a9345){logger[_0x7752('0x7')](_0x7752('0x1c'),_0x24fccc,_0x2a9345?_0x7752('0x18'):'notfound');return _0x1c6917(_0x2a9345);})[_0x7752('0xd')](function(_0x3c44af){logger[_0x7752('0xa')](_0x7752('0x1d'),_0x3c44af?util[_0x7752('0x8')](_0x3c44af,{'showHidden':![],'depth':null}):'');return _0x1c6917(null);});}return _0x1c6917(null);});};exports['getUserByName']=function(_0x5e0717){return new BPromise(function(_0x547d18,_0x3f7c18){if(_0x5e0717){return getUser({'name':_0x5e0717})[_0x7752('0xc')](function(_0x296735){logger[_0x7752('0x7')](_0x7752('0x1e'),_0x5e0717,_0x296735?_0x7752('0x18'):_0x7752('0x19'));return _0x547d18(_0x296735);})['catch'](function(_0x218d7d){logger[_0x7752('0xa')](_0x7752('0x1f'),_0x218d7d?util[_0x7752('0x8')](_0x218d7d,{'showHidden':![],'depth':null}):'');return _0x547d18(null);});}return _0x547d18(null);});};exports[_0x7752('0x20')]=function(_0x2f467c){return new BPromise(function(_0x5bc029,_0x12350d){if(_0x2f467c){return client[_0x7752('0xb')](_0x7752('0x21'),{'options':{'raw':!![],'attributes':['id',_0x7752('0x11'),_0x7752('0x22'),_0x7752('0x23'),_0x7752('0x24')],'where':{'name':_0x2f467c},'limit':0x1}})['then'](function(_0x51a1c1){logger[_0x7752('0x9')](_0x7752('0x25'),_0x2f467c,_0x51a1c1?util['inspect'](_0x51a1c1,{'showHidden':![],'depth':null}):'');logger[_0x7752('0x7')](_0x7752('0x26'),_0x2f467c,_0x51a1c1?_0x7752('0x18'):_0x7752('0x19'));return _0x5bc029(_0x51a1c1['result']['length']?_0x51a1c1['result'][0x0]:null);})[_0x7752('0xd')](function(_0x24ae34){logger[_0x7752('0xa')](_0x7752('0x27'),_0x24ae34?util[_0x7752('0x8')](_0x24ae34,{'showHidden':![],'depth':null}):'');return _0x5bc029(null);});}return _0x5bc029(null);});};exports[_0x7752('0x28')]=function(_0x6d22f0,_0x400079){return moment(_0x6d22f0)['add'](_0x400079,_0x7752('0x29'))['format'](_0x7752('0x2a'));};exports[_0x7752('0x2b')]=function(_0x203953,_0x249a96){return moment(_0x203953)['subtract'](_0x249a96,_0x7752('0x29'))[_0x7752('0x2c')](_0x7752('0x2a'));};exports[_0x7752('0x2d')]=function(_0x599f0,_0x4a16f1){return moment(_0x599f0)[_0x7752('0x2e')](moment(_0x4a16f1),_0x7752('0x29'));};exports[_0x7752('0x2f')]=function(_0x427a33,_0x2bccc6){return parseInt(_0x427a33,0xa)+parseInt(_0x2bccc6,0xa);};exports[_0x7752('0x30')]=function(){return moment()[_0x7752('0x2c')](_0x7752('0x2a'));};exports[_0x7752('0x31')]=function(_0x1cd15a,_0x4258ed){if(_0x4258ed){return moment(_0x1cd15a)[_0x7752('0x31')](_0x4258ed);}return!![];};exports['isBefore']=function(_0x96eeb5,_0x402b41){if(_0x402b41){return moment(_0x96eeb5)[_0x7752('0x32')](_0x402b41);}else if(_0x96eeb5){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index ff53807..2918cc9 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92f8=['logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','statusCode','agent_name','setupLoggers','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','client','role','name','ensureDir','join','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','responseTime','inspect'];(function(_0x291501,_0x177f28){var _0xfa89f2=function(_0x431541){while(--_0x431541){_0x291501['push'](_0x291501['shift']());}};_0xfa89f2(++_0x177f28);}(_0x92f8,0x65));var _0x892f=function(_0x2fdc16,_0x46b810){_0x2fdc16=_0x2fdc16-0x0;var _0x210f85=_0x92f8[_0x2fdc16];return _0x210f85;};var fs=require('fs-extra');var _=require(_0x892f('0x0'));var ewinston=require(_0x892f('0x1'));var path=require(_0x892f('0x2'));var util=require('util');var fileLogger=require(_0x892f('0x3'))[_0x892f('0x4')];var safeTemplate=require(_0x892f('0x5'))[_0x892f('0x6')];var maskSensitiveData=require(_0x892f('0x7'))[_0x892f('0x8')];function ClientSideLogger(){function _0x46fcb4(_0x2f380a){var _0x5b24fd=path['join'](_0x892f('0x9'),_0x892f('0xa'),_0x892f('0xb'));var _0x4e28c2=path['join'](_0x892f('0xc'),_0x2f380a[_0x892f('0xd')]+'-'+_0x2f380a[_0x892f('0xe')]);return fs[_0x892f('0xf')](path[_0x892f('0x10')](_0x5b24fd,_0x4e28c2))[_0x892f('0x11')](function(){var _0x3c43d4=fileLogger(_0x892f('0xc'),path[_0x892f('0x10')](_0x5b24fd,_0x4e28c2));return _0x3c43d4;})[_0x892f('0x12')](function(_0x5404d5){throw _0x5404d5;});}this[_0x892f('0xa')]=function(_0x377be6,_0x11d968,_0x1af378,_0x196413){return _0x46fcb4(_0x377be6[_0x892f('0x13')])[_0x892f('0x11')](function(_0x502ab1){var _0x2430f1=_0x502ab1[_0x11d968];return _0x2430f1;})[_0x892f('0x11')](function(_0x1cc07c){var _0x333892=_0x377be6['user']?_0x377be6[_0x892f('0x13')]['id']:_0x892f('0x14');var _0x149c9b=_0x196413[_0x892f('0x15')];var _0x425283=_0x196413[_0x892f('0x16')];var _0x1ec256=new Date(Number(_0x425283));return _0x1cc07c(_0x333892,_0x1ec256,_0x1af378,_0x149c9b);})[_0x892f('0x12')](function(_0x4d0324){fileLogger(_0x892f('0xc'))[_0x892f('0x17')](_0x4d0324);});};}function setupLoggers(_0x109577){return new Promise(function(_0x2a8852){var _0x327ad6=new ClientSideLogger();var _0x296c7c=fileLogger(_0x892f('0x18'));var _0x10d35f=fileLogger(_0x892f('0x19'));_0x109577[_0x892f('0x1a')](_0x892f('0x1b'),_0x327ad6);_0x109577[_0x892f('0x1c')](ewinston['logger']({'winstonInstance':_0x296c7c,'meta':![],'statusLevels':!![],'msg':function(_0x58c7df,_0x9151fa){var _0x5eb294='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x892f('0x1d')](_0x58c7df[_0x892f('0x1e')])){_0x5eb294+=_0x892f('0x1f');var _0x459427=_0x58c7df[_0x892f('0x1e')];maskSensitiveData(_0x459427);}return safeTemplate(util[_0x892f('0x20')](_0x5eb294,_0x58c7df[_0x892f('0x21')],_0x58c7df['headers']['x-forwarded-for']?_0x58c7df[_0x892f('0x22')][_0x892f('0x23')]:_0x58c7df['connection'][_0x892f('0x24')]||_0x58c7df['ip'],_0x58c7df[_0x892f('0x25')],_0x9151fa['statusCode'],_0x9151fa[_0x892f('0x26')],_0x58c7df[_0x892f('0x13')]?_0x58c7df['user']['id']:null,_0x58c7df[_0x892f('0x13')]?_0x58c7df[_0x892f('0x13')][_0x892f('0xe')]:null,_0x58c7df['user']?_0x58c7df[_0x892f('0x13')]['role']:null,_0x459427?util[_0x892f('0x27')](_0x459427,![],null):''));}}));_0x109577[_0x892f('0x1c')](ewinston[_0x892f('0x28')]({'winstonInstance':_0x10d35f,'meta':![],'statusLevels':!![],'msg':function(_0x5e4978,_0x32dae7){var _0xbabc4a=_0x892f('0x29');if(_0x5e4978[_0x892f('0x1e')]&&_0x5e4978[_0x892f('0x1e')][_0x892f('0x2a')]&&_0x5e4978[_0x892f('0x1e')][_0x892f('0x2b')]){_0xbabc4a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x892f('0x20')](_0xbabc4a,_0x5e4978['method'],_0x5e4978['headers'][_0x892f('0x23')]?_0x5e4978[_0x892f('0x22')][_0x892f('0x23')]:_0x5e4978['connection']['remoteAddress']||_0x5e4978['ip'],_0x5e4978[_0x892f('0x25')],_0x32dae7[_0x892f('0x2c')],_0x32dae7[_0x892f('0x26')],_0x5e4978[_0x892f('0x13')]?_0x5e4978[_0x892f('0x13')]['id']:null,_0x5e4978['user']?_0x5e4978[_0x892f('0x13')][_0x892f('0xe')]:null,_0x5e4978['user']?_0x5e4978[_0x892f('0x13')][_0x892f('0xd')]:null,_0x5e4978[_0x892f('0x1e')]&&_0x5e4978[_0x892f('0x1e')][_0x892f('0x2a')]?_0x5e4978[_0x892f('0x1e')][_0x892f('0x2a')]:'other',_0x5e4978['body']&&_0x5e4978[_0x892f('0x1e')][_0x892f('0x2b')]?_0x5e4978[_0x892f('0x1e')]['agent_id']:'',_0x5e4978[_0x892f('0x1e')]&&_0x5e4978[_0x892f('0x1e')]['agent_name']?_0x5e4978[_0x892f('0x1e')][_0x892f('0x2d')]:'');},'ignoreRoute':function(_0x87ac49){var _0x4c6955=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4c6955['test'](_0x87ac49['url']);}}));return _0x2a8852();});}exports[_0x892f('0x2e')]=setupLoggers; \ No newline at end of file +var _0x24e1=['name','ensureDir','log','user','then','no-user','data','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','format','remoteAddress','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','./mask-sensitive-data','join','/var','xcally','client','role'];(function(_0x53760b,_0x10983b){var _0x13eb2a=function(_0x3c62d2){while(--_0x3c62d2){_0x53760b['push'](_0x53760b['shift']());}};_0x13eb2a(++_0x10983b);}(_0x24e1,0x1d9));var _0x124e=function(_0x39ee89,_0x249960){_0x39ee89=_0x39ee89-0x0;var _0x2065ec=_0x24e1[_0x39ee89];return _0x2065ec;};var fs=require(_0x124e('0x0'));var _=require(_0x124e('0x1'));var ewinston=require('express-winston');var path=require(_0x124e('0x2'));var util=require(_0x124e('0x3'));var fileLogger=require(_0x124e('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x124e('0x5'))['maskSensitiveData'];function ClientSideLogger(){function _0x550c3a(_0x38060f){var _0x1a9b2c=path[_0x124e('0x6')](_0x124e('0x7'),'log',_0x124e('0x8'));var _0x460299=path[_0x124e('0x6')](_0x124e('0x9'),_0x38060f[_0x124e('0xa')]+'-'+_0x38060f[_0x124e('0xb')]);return fs[_0x124e('0xc')](path[_0x124e('0x6')](_0x1a9b2c,_0x460299))['then'](function(){var _0x58868f=fileLogger(_0x124e('0x9'),path[_0x124e('0x6')](_0x1a9b2c,_0x460299));return _0x58868f;})['catch'](function(_0x1bfdbc){throw _0x1bfdbc;});}this[_0x124e('0xd')]=function(_0x5d474d,_0x2b1a4c,_0x5bd603,_0x46fce2){return _0x550c3a(_0x5d474d[_0x124e('0xe')])[_0x124e('0xf')](function(_0x2b3de3){var _0x158063=_0x2b3de3[_0x2b1a4c];return _0x158063;})[_0x124e('0xf')](function(_0x3494bc){var _0x421be1=_0x5d474d[_0x124e('0xe')]?_0x5d474d['user']['id']:_0x124e('0x10');var _0x4e366d=_0x46fce2[_0x124e('0x11')];var _0x22f940=_0x46fce2['timestamp'];var _0x43fa0d=new Date(Number(_0x22f940));return _0x3494bc(_0x421be1,_0x43fa0d,_0x5bd603,_0x4e366d);})['catch'](function(_0x1c93e2){fileLogger(_0x124e('0x9'))['error'](_0x1c93e2);});};}function setupLoggers(_0x476d9d){return new Promise(function(_0x4b358b){var _0x531f45=new ClientSideLogger();var _0x475840=fileLogger(_0x124e('0x12'));var _0x532e3d=fileLogger(_0x124e('0x13'));_0x476d9d['set'](_0x124e('0x14'),_0x531f45);_0x476d9d[_0x124e('0x15')](ewinston[_0x124e('0x16')]({'winstonInstance':_0x475840,'meta':![],'statusLevels':!![],'msg':function(_0x44523b,_0x4df09a){var _0x1aa126=_0x124e('0x17');if(!_[_0x124e('0x18')](_0x44523b[_0x124e('0x19')])){_0x1aa126+=_0x124e('0x1a');var _0x376a0c=_0x44523b[_0x124e('0x19')];maskSensitiveData(_0x376a0c);}return safeTemplate(util['format'](_0x1aa126,_0x44523b[_0x124e('0x1b')],_0x44523b[_0x124e('0x1c')][_0x124e('0x1d')]?_0x44523b[_0x124e('0x1c')]['x-forwarded-for']:_0x44523b[_0x124e('0x1e')]['remoteAddress']||_0x44523b['ip'],_0x44523b[_0x124e('0x1f')],_0x4df09a[_0x124e('0x20')],_0x4df09a[_0x124e('0x21')],_0x44523b['user']?_0x44523b[_0x124e('0xe')]['id']:null,_0x44523b[_0x124e('0xe')]?_0x44523b[_0x124e('0xe')][_0x124e('0xb')]:null,_0x44523b['user']?_0x44523b[_0x124e('0xe')]['role']:null,_0x376a0c?util[_0x124e('0x22')](_0x376a0c,![],null):''));}}));_0x476d9d['use'](ewinston['logger']({'winstonInstance':_0x532e3d,'meta':![],'statusLevels':!![],'msg':function(_0x1df961,_0x238a9f){var _0xa618ef=_0x124e('0x23');if(_0x1df961['body']&&_0x1df961[_0x124e('0x19')][_0x124e('0x24')]&&_0x1df961[_0x124e('0x19')]['agent_id']){_0xa618ef='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x124e('0x25')](_0xa618ef,_0x1df961[_0x124e('0x1b')],_0x1df961['headers'][_0x124e('0x1d')]?_0x1df961[_0x124e('0x1c')][_0x124e('0x1d')]:_0x1df961['connection'][_0x124e('0x26')]||_0x1df961['ip'],_0x1df961['url'],_0x238a9f[_0x124e('0x20')],_0x238a9f[_0x124e('0x21')],_0x1df961[_0x124e('0xe')]?_0x1df961[_0x124e('0xe')]['id']:null,_0x1df961[_0x124e('0xe')]?_0x1df961['user'][_0x124e('0xb')]:null,_0x1df961['user']?_0x1df961[_0x124e('0xe')][_0x124e('0xa')]:null,_0x1df961[_0x124e('0x19')]&&_0x1df961[_0x124e('0x19')][_0x124e('0x24')]?_0x1df961[_0x124e('0x19')][_0x124e('0x24')]:_0x124e('0x27'),_0x1df961[_0x124e('0x19')]&&_0x1df961[_0x124e('0x19')][_0x124e('0x28')]?_0x1df961['body'][_0x124e('0x28')]:'',_0x1df961[_0x124e('0x19')]&&_0x1df961[_0x124e('0x19')][_0x124e('0x29')]?_0x1df961[_0x124e('0x19')]['agent_name']:'');},'ignoreRoute':function(_0x1bb88e){var _0x1ae87d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ae87d[_0x124e('0x2a')](_0x1bb88e[_0x124e('0x1f')]);}}));return _0x4b358b();});}exports[_0x124e('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index db6ea8b..19aaf05 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf91c=['monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','format','ddd','dowCompare','date','daysInMonth','max','MMM','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf91c,0xcf));var _0xcf91=function(_0x3182f2,_0x242888){_0x3182f2=_0x3182f2-0x0;var _0x5ed78d=_0xf91c[_0x3182f2];return _0x5ed78d;};var _=require(_0xcf91('0x0'));var moment=require(_0xcf91('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcf91('0x2')](function(_0x4cf9d){return _0x4cf9d['source'];})[_0xcf91('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcf91('0x4');var EINVALID_DATE=_0xcf91('0x5');function throwIfDateNotValid(_0x9c29e2){if(!_0x9c29e2[_0xcf91('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3c6171){var _0xdec35d=_0x3c6171[_0xcf91('0x7')](':')['map'](function(_0x5d004f){return parseInt(_0x5d004f,0xa);});var _0x28ab79=_0xdec35d[0x0];var _0x4e8936=_0xdec35d[0x1];if(_0x28ab79<0x0||_0x28ab79>0x17||_0x4e8936<0x0||_0x4e8936>0x3b){throw new Error(EINVALID_DATE);}return[_0x28ab79,_0x4e8936];}function circularDoWInterval(_0x832dc9,_0x1ecb52){if(_0x832dc9===_0x1ecb52){return[_0x832dc9];}else{var _0xfc44f8=moment[_0xcf91('0x8')]();moment[_0xcf91('0x8')]('en');var _0x23d594=moment[_0xcf91('0x9')]()[_0xcf91('0x2')](function(_0x79235d){return _0x79235d[_0xcf91('0xa')]();});moment[_0xcf91('0x8')](_0xfc44f8);var _0x1834b9=_0x23d594[_0xcf91('0xb')](_0x832dc9);var _0x854075=_0x23d594[_0xcf91('0xb')](_0x1ecb52);if(_0x854075>_0x1834b9){return _0x23d594[_0xcf91('0xc')](_0x1834b9,_0x854075+0x1);}else{var _0x2381c6=_0x23d594[_0xcf91('0xc')](0x0,_0x854075+0x1);var _0x2b4ed7=_0x23d594[_0xcf91('0xc')](_0x1834b9);return _0x2b4ed7[_0xcf91('0xd')](_0x2381c6);}}}module[_0xcf91('0xe')][_0xcf91('0xf')]=circularDoWInterval;function circularMonthInterval(_0x2cc444,_0x439926){if(_0x2cc444===_0x439926){return[_0x2cc444];}else{var _0x1b3cf3=moment[_0xcf91('0x8')]();moment[_0xcf91('0x8')]('en');var _0x3d351e=moment[_0xcf91('0x10')]()['map'](function(_0x3d24fb){return _0x3d24fb[_0xcf91('0xa')]();});moment[_0xcf91('0x8')](_0x1b3cf3);var _0x4f7b06=_0x3d351e[_0xcf91('0xb')](_0x2cc444);var _0xf366e6=_0x3d351e[_0xcf91('0xb')](_0x439926);if(_0xf366e6>_0x4f7b06){return _0x3d351e['slice'](_0x4f7b06,_0xf366e6+0x1);}else{var _0x79dc8b=_0x3d351e[_0xcf91('0xc')](0x0,_0xf366e6+0x1);var _0x1a619b=_0x3d351e[_0xcf91('0xc')](_0x4f7b06);return _0x1a619b[_0xcf91('0xd')](_0x79dc8b);}}}module[_0xcf91('0xe')][_0xcf91('0x11')]=circularMonthInterval;function parseDom(_0x45646f){var _0x25049f=parseInt(_0x45646f,0xa);if(_0x25049f<0x1||_0x25049f>0x1f){throw new Error(EINVALID_DATE);}return _0x25049f;}function timeCompare(_0x245f7c,_0x788e9c,_0x49c8cb){var _0x2dfd7c=_0x245f7c[_0xcf91('0x12')]();var _0x32bc1a=extractTime(_0x788e9c);var _0x525f5a=_0x32bc1a[0x0];var _0x1a1038=_0x32bc1a[0x1];var _0x406abd=_0x245f7c[_0xcf91('0x12')]()['hours'](_0x525f5a)['minutes'](_0x1a1038);throwIfDateNotValid(_0x406abd);var _0x37ab50=extractTime(_0x49c8cb);var _0xa2a521=_0x37ab50[0x0];var _0x52fcf2=_0x37ab50[0x1];var _0x24c167=_0x245f7c[_0xcf91('0x12')]()[_0xcf91('0x13')](_0xa2a521)[_0xcf91('0x14')](_0x52fcf2);throwIfDateNotValid(_0x24c167);if(_0x24c167['isBefore'](_0x406abd)){var _0x3c3e9d=_0x2dfd7c[_0xcf91('0x12')]()[_0xcf91('0x15')](_0xcf91('0x16'));var _0x178516=_0x2dfd7c[_0xcf91('0x12')]()[_0xcf91('0x17')]('day');return _0x2dfd7c[_0xcf91('0x18')](_0x406abd,_0x178516,undefined,'[]')||_0x2dfd7c[_0xcf91('0x18')](_0x3c3e9d,_0x24c167,undefined,'[]');}else{return _0x2dfd7c[_0xcf91('0x18')](_0x406abd,_0x24c167,undefined,'[]');}}module[_0xcf91('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x342166,_0x87c1a8,_0x11e99a){var _0x552e4c=_0x342166[_0xcf91('0x8')]('en')[_0xcf91('0x19')](_0xcf91('0x1a'))[_0xcf91('0xa')]();return circularDoWInterval(_0x87c1a8,_0x11e99a)['includes'](_0x552e4c);}module[_0xcf91('0xe')][_0xcf91('0x1b')]=dowCompare;function domCompare(_0x26054b,_0x423754,_0x12321d){var _0x19094b=_0x26054b[_0xcf91('0x1c')]();if(_0x423754===_0x12321d){return _0x19094b===_0x423754;}else{var _0x5ed18a=_0x26054b[_0xcf91('0x1d')]();var _0x2d987f=_0x423754<_0x12321d;let _0xb82b6b=![];var _0x5793ca=0x0;var _0x3131d7=0x0;if(_0x2d987f){_0x5793ca=Math[_0xcf91('0x1e')](0x1,_0x423754);_0x3131d7=Math['min'](_0x12321d,_0x5ed18a);_0xb82b6b=_0x19094b>=_0x5793ca&&_0x19094b<=_0x3131d7;}else{_0x5793ca=Math['min'](_0x423754,_0x5ed18a);_0x3131d7=Math[_0xcf91('0x1e')](0x1,_0x12321d);_0xb82b6b=_0x19094b>=_0x5793ca||_0x19094b<=_0x3131d7;}return _0xb82b6b;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x3b67a3,_0x685008,_0x3071fd){var _0x1ff3d6=_0x3b67a3[_0xcf91('0x8')]('en')[_0xcf91('0x19')](_0xcf91('0x1f'))[_0xcf91('0xa')]();return circularMonthInterval(_0x685008,_0x3071fd)[_0xcf91('0x20')](_0x1ff3d6);}module[_0xcf91('0xe')][_0xcf91('0x21')]=monthCompare;function iftime(_0x8c501a,_0x31fdca=moment['tz'][_0xcf91('0x22')](),_0x2e7ae3=moment()){if(!validateRx[_0xcf91('0x23')](_0x8c501a)){throw new Error(EINVALID_STRING);}else{var _0x42ce07=(moment[_0xcf91('0x24')](_0x2e7ae3)?_0x2e7ae3[_0xcf91('0x12')]():moment(_0x2e7ae3))['tz'](_0x31fdca)[_0xcf91('0x8')]('en');throwIfDateNotValid(_0x42ce07);var _0x4c9a81=_0x8c501a['split'](',');var _0x46e4ca=_0x4c9a81[0x0];var _0x3ccedd=_0x4c9a81[0x1];var _0x3cf8fa=_0x4c9a81[0x2];var _0xeffc9d=_0x4c9a81[0x3];let _0x53e018=!![];if(_0x46e4ca!=='*'){var _0x5cb0a7=_0x46e4ca[_0xcf91('0x7')]('-');var _0x5575b5=_[_0xcf91('0x25')](_0x5cb0a7[0x0],0x5,'0');var _0x5ba986=_0x5cb0a7[_0xcf91('0x26')]===0x2?_[_0xcf91('0x25')](_0x5cb0a7[0x1],0x5,'0'):_0x5575b5;_0x53e018=timeCompare(_0x42ce07,_0x5575b5,_0x5ba986);}let _0x1f3f27=!![];if(_0x3ccedd!=='*'){var _0x46e2e8=_0x3ccedd[_0xcf91('0x7')]('-');var _0x6ec10f=_0x46e2e8[0x0];var _0x969e81=_0x46e2e8[_0xcf91('0x26')]===0x2?_0x46e2e8[0x1]:_0x6ec10f;_0x1f3f27=dowCompare(_0x42ce07,_0x6ec10f,_0x969e81);}let _0x3d71ee=!![];if(_0x3cf8fa!=='*'){var _0x148ac4=_0x3cf8fa[_0xcf91('0x7')]('-');var _0x4dac0a=parseDom(_0x148ac4[0x0]);var _0x574634=_0x148ac4[_0xcf91('0x26')]===0x2?parseDom(_0x148ac4[0x1]):_0x4dac0a;_0x3d71ee=domCompare(_0x42ce07,_0x4dac0a,_0x574634);}let _0x37cb52=!![];if(_0xeffc9d!=='*'){var _0x5babb4=_0xeffc9d['split']('-');var _0x371274=_0x5babb4[0x0];var _0x38ce00=_0x5babb4['length']===0x2?_0x5babb4[0x1]:_0x5babb4[0x0];_0x37cb52=monthCompare(_0x42ce07,_0x371274,_0x38ce00);}return _0x53e018&&_0x1f3f27&&_0x3d71ee&&_0x37cb52;}}module[_0xcf91('0xe')][_0xcf91('0x27')]=iftime; \ No newline at end of file +var _0xc684=['iftime','moment-timezone','source','join','isValid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','concat','circularMonthInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','test','split','padStart','length'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0xc684,0xbf));var _0x4c68=function(_0x4403c8,_0x47e7f8){_0x4403c8=_0x4403c8-0x0;var _0x221ca2=_0xc684[_0x4403c8];return _0x221ca2;};var _=require('lodash');var moment=require(_0x4c68('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x577645){return _0x577645[_0x4c68('0x1')];})[_0x4c68('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x3ade64){if(!_0x3ade64[_0x4c68('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x37a432){var _0x290a28=_0x37a432['split'](':')[_0x4c68('0x4')](function(_0x282ba2){return parseInt(_0x282ba2,0xa);});var _0x3d91ee=_0x290a28[0x0];var _0x5d11e5=_0x290a28[0x1];if(_0x3d91ee<0x0||_0x3d91ee>0x17||_0x5d11e5<0x0||_0x5d11e5>0x3b){throw new Error(EINVALID_DATE);}return[_0x3d91ee,_0x5d11e5];}function circularDoWInterval(_0x3062ff,_0x540375){if(_0x3062ff===_0x540375){return[_0x3062ff];}else{var _0x3da32b=moment[_0x4c68('0x5')]();moment[_0x4c68('0x5')]('en');var _0x40b210=moment[_0x4c68('0x6')]()[_0x4c68('0x4')](function(_0x214c24){return _0x214c24[_0x4c68('0x7')]();});moment[_0x4c68('0x5')](_0x3da32b);var _0x26cfd9=_0x40b210[_0x4c68('0x8')](_0x3062ff);var _0x345fdd=_0x40b210[_0x4c68('0x8')](_0x540375);if(_0x345fdd>_0x26cfd9){return _0x40b210[_0x4c68('0x9')](_0x26cfd9,_0x345fdd+0x1);}else{var _0x565a8a=_0x40b210[_0x4c68('0x9')](0x0,_0x345fdd+0x1);var _0x7ce7c3=_0x40b210[_0x4c68('0x9')](_0x26cfd9);return _0x7ce7c3['concat'](_0x565a8a);}}}module[_0x4c68('0xa')][_0x4c68('0xb')]=circularDoWInterval;function circularMonthInterval(_0x23c8c0,_0x5135c9){if(_0x23c8c0===_0x5135c9){return[_0x23c8c0];}else{var _0x591cea=moment[_0x4c68('0x5')]();moment[_0x4c68('0x5')]('en');var _0xb5314e=moment['monthsShort']()[_0x4c68('0x4')](function(_0x4280cd){return _0x4280cd[_0x4c68('0x7')]();});moment['locale'](_0x591cea);var _0x4ee9b9=_0xb5314e['indexOf'](_0x23c8c0);var _0x3a5910=_0xb5314e[_0x4c68('0x8')](_0x5135c9);if(_0x3a5910>_0x4ee9b9){return _0xb5314e[_0x4c68('0x9')](_0x4ee9b9,_0x3a5910+0x1);}else{var _0x2f51a3=_0xb5314e['slice'](0x0,_0x3a5910+0x1);var _0x320ebf=_0xb5314e[_0x4c68('0x9')](_0x4ee9b9);return _0x320ebf[_0x4c68('0xc')](_0x2f51a3);}}}module['exports'][_0x4c68('0xd')]=circularMonthInterval;function parseDom(_0x229687){var _0x1798f5=parseInt(_0x229687,0xa);if(_0x1798f5<0x1||_0x1798f5>0x1f){throw new Error(EINVALID_DATE);}return _0x1798f5;}function timeCompare(_0x5c2749,_0x5e152a,_0x11d177){var _0xecffb8=_0x5c2749[_0x4c68('0xe')]();var _0x39cee6=extractTime(_0x5e152a);var _0x45a644=_0x39cee6[0x0];var _0x1fac9a=_0x39cee6[0x1];var _0x2c7323=_0x5c2749[_0x4c68('0xe')]()[_0x4c68('0xf')](_0x45a644)[_0x4c68('0x10')](_0x1fac9a);throwIfDateNotValid(_0x2c7323);var _0x507c90=extractTime(_0x11d177);var _0x267f5e=_0x507c90[0x0];var _0x35a2f9=_0x507c90[0x1];var _0x534268=_0x5c2749['clone']()['hours'](_0x267f5e)['minutes'](_0x35a2f9);throwIfDateNotValid(_0x534268);if(_0x534268[_0x4c68('0x11')](_0x2c7323)){var _0x11bff0=_0xecffb8['clone']()['startOf'](_0x4c68('0x12'));var _0x10b29e=_0xecffb8[_0x4c68('0xe')]()[_0x4c68('0x13')](_0x4c68('0x12'));return _0xecffb8['isBetween'](_0x2c7323,_0x10b29e,undefined,'[]')||_0xecffb8['isBetween'](_0x11bff0,_0x534268,undefined,'[]');}else{return _0xecffb8[_0x4c68('0x14')](_0x2c7323,_0x534268,undefined,'[]');}}module[_0x4c68('0xa')][_0x4c68('0x15')]=timeCompare;function dowCompare(_0x186c58,_0x1322a0,_0x428ac5){var _0x144180=_0x186c58['locale']('en')[_0x4c68('0x16')](_0x4c68('0x17'))[_0x4c68('0x7')]();return circularDoWInterval(_0x1322a0,_0x428ac5)[_0x4c68('0x18')](_0x144180);}module[_0x4c68('0xa')][_0x4c68('0x19')]=dowCompare;function domCompare(_0x138cdb,_0x5f25d5,_0x21d143){var _0x56cb4f=_0x138cdb[_0x4c68('0x1a')]();if(_0x5f25d5===_0x21d143){return _0x56cb4f===_0x5f25d5;}else{var _0x1042ce=_0x138cdb[_0x4c68('0x1b')]();var _0x5c5f26=_0x5f25d5<_0x21d143;let _0x197e48=![];var _0x561b8f=0x0;var _0x1066fd=0x0;if(_0x5c5f26){_0x561b8f=Math[_0x4c68('0x1c')](0x1,_0x5f25d5);_0x1066fd=Math[_0x4c68('0x1d')](_0x21d143,_0x1042ce);_0x197e48=_0x56cb4f>=_0x561b8f&&_0x56cb4f<=_0x1066fd;}else{_0x561b8f=Math['min'](_0x5f25d5,_0x1042ce);_0x1066fd=Math['max'](0x1,_0x21d143);_0x197e48=_0x56cb4f>=_0x561b8f||_0x56cb4f<=_0x1066fd;}return _0x197e48;}}module['exports'][_0x4c68('0x1e')]=domCompare;function monthCompare(_0x35a6d2,_0x3fde3c,_0x1bdff4){var _0x117747=_0x35a6d2[_0x4c68('0x5')]('en')['format'](_0x4c68('0x1f'))['toLowerCase']();return circularMonthInterval(_0x3fde3c,_0x1bdff4)[_0x4c68('0x18')](_0x117747);}module[_0x4c68('0xa')][_0x4c68('0x20')]=monthCompare;function iftime(_0x711e7d,_0x3e2cf3=moment['tz']['guess'](),_0x1cb3b9=moment()){if(!validateRx[_0x4c68('0x21')](_0x711e7d)){throw new Error(EINVALID_STRING);}else{var _0x227fa6=(moment['isMoment'](_0x1cb3b9)?_0x1cb3b9['clone']():moment(_0x1cb3b9))['tz'](_0x3e2cf3)['locale']('en');throwIfDateNotValid(_0x227fa6);var _0x3af8ed=_0x711e7d['split'](',');var _0x3c1e09=_0x3af8ed[0x0];var _0x2c401f=_0x3af8ed[0x1];var _0x458835=_0x3af8ed[0x2];var _0x3202a8=_0x3af8ed[0x3];let _0x37a467=!![];if(_0x3c1e09!=='*'){var _0x295ad4=_0x3c1e09[_0x4c68('0x22')]('-');var _0x419777=_[_0x4c68('0x23')](_0x295ad4[0x0],0x5,'0');var _0xe4b8d3=_0x295ad4[_0x4c68('0x24')]===0x2?_[_0x4c68('0x23')](_0x295ad4[0x1],0x5,'0'):_0x419777;_0x37a467=timeCompare(_0x227fa6,_0x419777,_0xe4b8d3);}let _0x2bb6fd=!![];if(_0x2c401f!=='*'){var _0x4289c8=_0x2c401f[_0x4c68('0x22')]('-');var _0x51cee1=_0x4289c8[0x0];var _0x54b21b=_0x4289c8[_0x4c68('0x24')]===0x2?_0x4289c8[0x1]:_0x51cee1;_0x2bb6fd=dowCompare(_0x227fa6,_0x51cee1,_0x54b21b);}let _0x12ebe6=!![];if(_0x458835!=='*'){var _0x103699=_0x458835[_0x4c68('0x22')]('-');var _0x108303=parseDom(_0x103699[0x0]);var _0x41b396=_0x103699[_0x4c68('0x24')]===0x2?parseDom(_0x103699[0x1]):_0x108303;_0x12ebe6=domCompare(_0x227fa6,_0x108303,_0x41b396);}let _0x3f1300=!![];if(_0x3202a8!=='*'){var _0x31a20a=_0x3202a8[_0x4c68('0x22')]('-');var _0x34c48f=_0x31a20a[0x0];var _0x4a517a=_0x31a20a[_0x4c68('0x24')]===0x2?_0x31a20a[0x1]:_0x31a20a[0x0];_0x3f1300=monthCompare(_0x227fa6,_0x34c48f,_0x4a517a);}return _0x37a467&&_0x2bb6fd&&_0x12ebe6&&_0x3f1300;}}module[_0x4c68('0xa')][_0x4c68('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ad28a89..6c2f00b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f27=['bold\x20blue','/var/log/xcally','format','%s-%s.log','message','{{{','}}}','replace','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','transports','Console','Logger','%s-%s','error','File','warn','consoleLogger','fileLogger','moment','winston','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta'];(function(_0x3d5cd9,_0x16db35){var _0x116080=function(_0x4c80fc){while(--_0x4c80fc){_0x3d5cd9['push'](_0x3d5cd9['shift']());}};_0x116080(++_0x16db35);}(_0x8f27,0x9b));var _0x78f2=function(_0x36b444,_0x505b35){_0x36b444=_0x36b444-0x0;var _0x786323=_0x8f27[_0x36b444];return _0x786323;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x78f2('0x0'));var winston=require(_0x78f2('0x1'));var config=require('../config/environment');var debugLevel=config[_0x78f2('0x2')]?config[_0x78f2('0x2')]['toLowerCase']():_0x78f2('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x78f2('0x4'),'warn':_0x78f2('0x5'),'info':_0x78f2('0x6'),'print':_0x78f2('0x7'),'success':_0x78f2('0x8'),'http':'gray','verbose':_0x78f2('0x9'),'debug':_0x78f2('0xa'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x25b764,_0x101d83,_0x36a2a9){var _0x2a2c44=_0x25b764||_0x78f2('0xb');return path['join'](_0x2a2c44,util[_0x78f2('0xc')](_0x78f2('0xd'),_0x101d83,_0x36a2a9));}function formatter(_0x4839d9,_0x15e6e7){_0x15e6e7[_0x78f2('0xe')]=_0x15e6e7[_0x78f2('0xe')]['replace'](/@@{/g,_0x78f2('0xf'))['replace'](/}@@/g,_0x78f2('0x10'))[_0x78f2('0x11')](/@{/g,'{{')[_0x78f2('0x11')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x78f2('0xc')](_0x78f2('0x12')),_0x15e6e7[_0x78f2('0x13')]['toUpperCase'](),_0x4839d9,_0x15e6e7['message']);}function fileFormat(_0x56b6bd,_0x109957){_0x109957[_0x78f2('0xe')]=_0x109957[_0x78f2('0xe')][_0x78f2('0x11')](/@@{/g,_0x78f2('0xf'))['replace'](/}@@/g,'}}}')[_0x78f2('0x11')](/@{/g,'{{')[_0x78f2('0x11')](/}@/g,'}}');var _0x4a5be0=_0x109957['meta']&&Object['keys'](_0x109957[_0x78f2('0x14')])[_0x78f2('0x15')]?'\x0a\x09'+JSON['stringify'](_0x109957[_0x78f2('0x14')]):'';return util[_0x78f2('0xc')](_0x78f2('0x16'),moment()['format'](_0x78f2('0x12')),_0x109957[_0x78f2('0x13')][_0x78f2('0x17')](),_0x56b6bd,_0x109957[_0x78f2('0xe')],_0x4a5be0);}function consoleLogger(){var _0x14c76d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x78f2('0x18'))][(_0x78f2('0x19'))]({'level':'warn','json':![],'formatter':function(_0x41fa2f){return formatter('',_0x41fa2f);}})]});return _0x14c76d;}function fileLogger(_0x3ba9c9,_0x3cc542){var _0x35e178=new winston[(_0x78f2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util['format'](_0x78f2('0x1b'),_0x3ba9c9,'error'),'filename':getLogFileName(_0x3cc542,_0x3ba9c9,_0x78f2('0x1c')),'level':_0x78f2('0x1c'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1bd6e2){return fileFormat(_0x3ba9c9,_0x1bd6e2);}}),new winston[(_0x78f2('0x18'))][(_0x78f2('0x1d'))]({'name':util[_0x78f2('0xc')](_0x78f2('0x1b'),_0x3ba9c9,debugLevel),'filename':getLogFileName(_0x3cc542,_0x3ba9c9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4702eb){return fileFormat(_0x3ba9c9,_0x4702eb);}}),new winston['transports'][(_0x78f2('0x19'))]({'level':_0x78f2('0x1e'),'json':![],'formatter':function(_0x32b9ec){return fileFormat(_0x3ba9c9,_0x32b9ec);}})]});return _0x35e178;}exports[_0x78f2('0x1f')]=consoleLogger;exports[_0x78f2('0x20')]=fileLogger; \ No newline at end of file +var _0xec61=['path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger'];(function(_0x3254f5,_0x10843d){var _0x38910b=function(_0x35c9b6){while(--_0x35c9b6){_0x3254f5['push'](_0x3254f5['shift']());}};_0x38910b(++_0x10843d);}(_0xec61,0x18c));var _0x1ec6=function(_0x1c05b8,_0x2f0355){_0x1c05b8=_0x1c05b8-0x0;var _0x1a8b05=_0xec61[_0x1c05b8];return _0x1a8b05;};'use strict';var path=require(_0x1ec6('0x0'));var util=require(_0x1ec6('0x1'));var moment=require(_0x1ec6('0x2'));var winston=require(_0x1ec6('0x3'));var config=require(_0x1ec6('0x4'));var debugLevel=config[_0x1ec6('0x5')]?config['debugLevel'][_0x1ec6('0x6')]():_0x1ec6('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1ec6('0x8'),'error':_0x1ec6('0x9'),'warn':_0x1ec6('0xa'),'info':_0x1ec6('0xb'),'print':_0x1ec6('0xc'),'success':_0x1ec6('0xd'),'http':_0x1ec6('0xe'),'verbose':_0x1ec6('0xf'),'debug':_0x1ec6('0x10'),'silly':_0x1ec6('0x11')};winston[_0x1ec6('0x12')](XC_LOG_COLORS);function getLogFileName(_0x5c3fd6,_0x11c9cd,_0x5efa5f){var _0x2f4c6f=_0x5c3fd6||_0x1ec6('0x13');return path[_0x1ec6('0x14')](_0x2f4c6f,util[_0x1ec6('0x15')](_0x1ec6('0x16'),_0x11c9cd,_0x5efa5f));}function formatter(_0x5a568a,_0x395109){_0x395109[_0x1ec6('0x17')]=_0x395109[_0x1ec6('0x17')][_0x1ec6('0x18')](/@@{/g,_0x1ec6('0x19'))[_0x1ec6('0x18')](/}@@/g,_0x1ec6('0x1a'))['replace'](/@{/g,'{{')[_0x1ec6('0x18')](/}@/g,'}}');return util[_0x1ec6('0x15')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x395109['level'][_0x1ec6('0x1b')](),_0x5a568a,_0x395109[_0x1ec6('0x17')]);}function fileFormat(_0x1aa045,_0x24a351){_0x24a351['message']=_0x24a351[_0x1ec6('0x17')][_0x1ec6('0x18')](/@@{/g,_0x1ec6('0x19'))[_0x1ec6('0x18')](/}@@/g,'}}}')[_0x1ec6('0x18')](/@{/g,'{{')[_0x1ec6('0x18')](/}@/g,'}}');var _0x2e5976=_0x24a351[_0x1ec6('0x1c')]&&Object[_0x1ec6('0x1d')](_0x24a351[_0x1ec6('0x1c')])[_0x1ec6('0x1e')]?'\x0a\x09'+JSON[_0x1ec6('0x1f')](_0x24a351[_0x1ec6('0x1c')]):'';return util[_0x1ec6('0x15')](_0x1ec6('0x20'),moment()[_0x1ec6('0x15')](_0x1ec6('0x21')),_0x24a351[_0x1ec6('0x22')][_0x1ec6('0x1b')](),_0x1aa045,_0x24a351[_0x1ec6('0x17')],_0x2e5976);}function consoleLogger(){var _0x1be9c0=new winston[(_0x1ec6('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1ec6('0x24'))][(_0x1ec6('0x25'))]({'level':_0x1ec6('0x26'),'json':![],'formatter':function(_0x31ceb9){return formatter('',_0x31ceb9);}})]});return _0x1be9c0;}function fileLogger(_0x16c3d0,_0x1ff5c8){var _0x543bcc=new winston[(_0x1ec6('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1ec6('0x27'))]({'name':util[_0x1ec6('0x15')]('%s-%s',_0x16c3d0,_0x1ec6('0x28')),'filename':getLogFileName(_0x1ff5c8,_0x16c3d0,_0x1ec6('0x28')),'level':_0x1ec6('0x28'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3e6492){return fileFormat(_0x16c3d0,_0x3e6492);}}),new winston[(_0x1ec6('0x24'))]['File']({'name':util[_0x1ec6('0x15')](_0x1ec6('0x29'),_0x16c3d0,debugLevel),'filename':getLogFileName(_0x1ff5c8,_0x16c3d0,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x262afd){return fileFormat(_0x16c3d0,_0x262afd);}}),new winston[(_0x1ec6('0x24'))]['Console']({'level':_0x1ec6('0x26'),'json':![],'formatter':function(_0x58d02f){return fileFormat(_0x16c3d0,_0x58d02f);}})]});return _0x543bcc;}exports[_0x1ec6('0x2a')]=consoleLogger;exports[_0x1ec6('0x2b')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 1f2a01e..3054726 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0x0295,0x1f0));var _0x5029=function(_0x5c2871,_0x9f21e6){_0x5c2871=_0x5c2871-0x0;var _0x4d962d=_0x0295[_0x5c2871];return _0x4d962d;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x57ca,0x108));var _0xa57c=function(_0x170901,_0x2fba04){_0x170901=_0x170901-0x0;var _0x1ae418=_0x57ca[_0x170901];return _0x1ae418;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 4b26895..183a37a 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['exports','replace','\x5c$&'];(function(_0x28a66d,_0x326d64){var _0x1402f0=function(_0x400440){while(--_0x400440){_0x28a66d['push'](_0x28a66d['shift']());}};_0x1402f0(++_0x326d64);}(_0x53ec,0x192));var _0xc53e=function(_0x48d732,_0x202a72){_0x48d732=_0x48d732-0x0;var _0x221c79=_0x53ec[_0x48d732];return _0x221c79;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file +var _0x57ca=['\x5c$&'];(function(_0x45ebfc,_0x5be1b0){var _0x4aace6=function(_0x5c658e){while(--_0x5c658e){_0x45ebfc['push'](_0x45ebfc['shift']());}};_0x4aace6(++_0x5be1b0);}(_0x57ca,0x108));var _0xa57c=function(_0xdc175a,_0xd7340f){_0xdc175a=_0xdc175a-0x0;var _0x5e22e5=_0x57ca[_0xdc175a];return _0x5e22e5;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index baf5a8b..9983cb5 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x20396c,_0x50dfa){var _0x13d443=function(_0x323548){while(--_0x323548){_0x20396c['push'](_0x20396c['shift']());}};_0x13d443(++_0x50dfa);}(_0x4fc2,0x111));var _0x24fc=function(_0x5b906a,_0x31b5fc){_0x5b906a=_0x5b906a-0x0;var _0x2a1dcf=_0x4fc2[_0x5b906a];return _0x2a1dcf;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file +var _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x18ac52,_0x356756){var _0x107bd2=function(_0x53d564){while(--_0x53d564){_0x18ac52['push'](_0x18ac52['shift']());}};_0x107bd2(++_0x356756);}(_0x5c00,0x17e));var _0x05c0=function(_0x318054,_0x516efd){_0x318054=_0x318054-0x0;var _0x19a6ae=_0x5c00[_0x318054];return _0x19a6ae;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 76323d7..15b9b66 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe465=['pathExists','then','updated','info','exports','fs-extra','path','../config/environment','resolve','server/app.json','apps','findIndex','name','motion2','NODE_PATH','string','env'];(function(_0x419119,_0x1d1cf8){var _0x3e8808=function(_0x61b79c){while(--_0x61b79c){_0x419119['push'](_0x419119['shift']());}};_0x3e8808(++_0x1d1cf8);}(_0xe465,0x115));var _0x5e46=function(_0xd2502d,_0x59a1a6){_0xd2502d=_0xd2502d-0x0;var _0x5df028=_0xe465[_0xd2502d];return _0x5df028;};var fs=require(_0x5e46('0x0'));var path=require(_0x5e46('0x1'));var config=require(_0x5e46('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x5e46('0x3')](root,_0x5e46('0x4'));var NODEPATH=path[_0x5e46('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x3f8ec0){let _0x17383d=![];if(Array['isArray'](_0x3f8ec0[_0x5e46('0x5')])){var _0x3b1788=_0x3f8ec0[_0x5e46('0x5')][_0x5e46('0x6')](function(_0x25e0d1){return _0x25e0d1[_0x5e46('0x7')]===_0x5e46('0x8');});if(_0x3b1788>-0x1){var _0x5bab17=_0x3f8ec0[_0x5e46('0x5')][_0x3b1788];if(typeof _0x5bab17['env'][_0x5e46('0x9')]!==_0x5e46('0xa')){_0x5bab17[_0x5e46('0xb')][_0x5e46('0x9')]=NODEPATH;_0x17383d=!![];}}return{'appConfig':_0x3f8ec0,'updated':_0x17383d};}}function updateAppConfig(_0x33a5b9){return fs[_0x5e46('0xc')](APP_JSON_PATH)['then'](function(_0x14e444){if(_0x14e444){return fs['readJSON'](APP_JSON_PATH)[_0x5e46('0xd')](function(_0x5d8762){var _0x4a43cc=setLegacyLibsNodeEnvPath(_0x5d8762);if(_0x4a43cc[_0x5e46('0xe')]){_0x33a5b9[_0x5e46('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x5d8762,{'spaces':0x2});}else{return Promise[_0x5e46('0x3')]();}});}else{return Promise[_0x5e46('0x3')]();}});}module[_0x5e46('0x10')]=updateAppConfig; \ No newline at end of file +var _0x64f9=['resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','string','NODE_PATH','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root'];(function(_0x2ae7b0,_0x30137f){var _0x111498=function(_0x5efbce){while(--_0x5efbce){_0x2ae7b0['push'](_0x2ae7b0['shift']());}};_0x111498(++_0x30137f);}(_0x64f9,0x189));var _0x964f=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x64f9[_0x29aefc];return _0x11be36;};var fs=require(_0x964f('0x0'));var path=require(_0x964f('0x1'));var config=require('../config/environment');var root=config[_0x964f('0x2')];var APP_JSON_PATH=path[_0x964f('0x3')](root,_0x964f('0x4'));var NODEPATH=path['resolve'](root,_0x964f('0x5'));function setLegacyLibsNodeEnvPath(_0x9e6607){let _0x529792=![];if(Array[_0x964f('0x6')](_0x9e6607[_0x964f('0x7')])){var _0x1d5215=_0x9e6607[_0x964f('0x7')][_0x964f('0x8')](function(_0x3abaaf){return _0x3abaaf[_0x964f('0x9')]==='motion2';});if(_0x1d5215>-0x1){var _0x78e6b2=_0x9e6607[_0x964f('0x7')][_0x1d5215];if(typeof _0x78e6b2[_0x964f('0xa')]['NODE_PATH']!==_0x964f('0xb')){_0x78e6b2[_0x964f('0xa')][_0x964f('0xc')]=NODEPATH;_0x529792=!![];}}return{'appConfig':_0x9e6607,'updated':_0x529792};}}function updateAppConfig(_0x555890){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x4dbd4){if(_0x4dbd4){return fs[_0x964f('0xd')](APP_JSON_PATH)['then'](function(_0x3bec7e){var _0xca87ea=setLegacyLibsNodeEnvPath(_0x3bec7e);if(_0xca87ea['updated']){_0x555890[_0x964f('0xe')](_0x964f('0xf'));return fs[_0x964f('0x10')](APP_JSON_PATH,_0x3bec7e,{'spaces':0x2});}else{return Promise[_0x964f('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x964f('0x11')]=updateAppConfig; \ No newline at end of file